From: Andrea Bianco Date: Sun, 31 Oct 2021 21:36:36 +0000 (+0100) Subject: Built motion from commit 9fbeeb6e.|2.5.37 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css//%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20110license.mail?a=commitdiff_plain;h=19344ef5a7e7c534e5499bc1697eb587f137daa3;p=motion2.git Built motion from commit 9fbeeb6e.|2.5.37 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 5992fe2..b834d9f 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-10-31T18:41:03.692Z", + "time": "2021-10-31T21:22:38.786Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 60de990..ff26f53 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-10-31T18:41:03.692Z", + "time": "2021-10-31T21:22:38.786Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/public/app/main/apps/staff/i18n/en.json b/public/app/main/apps/staff/i18n/en.json index 9edf2f3..6fe6483 100644 --- a/public/app/main/apps/staff/i18n/en.json +++ b/public/app/main/apps/staff/i18n/en.json @@ -112,7 +112,7 @@ "ALLOWCODECS": "Allowed Codecs", "DISABLED": "Deactivated", "BLOCKED": "Locked", - "AD_SSO_ENABLED": "Active Directory SSO Enabled", + "AD_SSO_ENABLED": "Active Directory SSO", "AUTHENTICATION": "Authentication", "HELP": { "DISABLED": "select to deactivate / unselect to reactivate", diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index cd140d0..c189604 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 _0x7eff=['urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','exports','VIRTUAL','action','STRING','contactManager','integration'];(function(_0xe5b349,_0x5f06e4){var _0x26b0ad=function(_0x1a97f1){while(--_0x1a97f1){_0xe5b349['push'](_0xe5b349['shift']());}};_0x26b0ad(++_0x5f06e4);}(_0x7eff,0x162));var _0xf7ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7eff[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xf7ef('0x0')]={'name':{'type':Sequelize[_0xf7ef('0x1')],'get':function(_0x2d6db5){return this['getDataValue'](_0xf7ef('0x2'));}},'action':{'type':Sequelize[_0xf7ef('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0xf7ef('0x4'),_0xf7ef('0x5'),'motionbar','jscripty',_0xf7ef('0x6'),_0xf7ef('0x7'),_0xf7ef('0x8'),_0xf7ef('0x9')]],'msg':_0xf7ef('0xa')}},'comment':_0xf7ef('0xa')},'data1':{'type':Sequelize[_0xf7ef('0x3')](0x1000),'comment':_0xf7ef('0xb')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0xf7ef('0xc')},'data3':{'type':Sequelize[_0xf7ef('0x3')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0xf7ef('0x3')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0xf7ef('0xd')},'data6':{'type':Sequelize['STRING'],'comments':_0xf7ef('0xe')},'data7':{'type':Sequelize['TEXT'],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0x4803=['contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','VIRTUAL','action','contactManager','motionbar','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','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)]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4803,0x137));var _0x3480=function(_0x26b814,_0x35f2b1){_0x26b814=_0x26b814-0x0;var _0x428cbd=_0x4803[_0x26b814];return _0x428cbd;};'use strict';var Sequelize=require(_0x3480('0x0'));module['exports']={'name':{'type':Sequelize[_0x3480('0x1')],'get':function(_0x221297){return this['getDataValue'](_0x3480('0x2'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x3480('0x3'),'integration',_0x3480('0x4'),'jscripty',_0x3480('0x5'),_0x3480('0x6'),_0x3480('0x7'),_0x3480('0x8')]],'msg':_0x3480('0x9')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x3480('0xa')](0x1000),'comment':_0x3480('0xb')},'data2':{'type':Sequelize[_0x3480('0xa')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x3480('0xa')](0x1000),'comment':_0x3480('0xc')},'data4':{'type':Sequelize[_0x3480('0xa')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x3480('0xa')](0x1000),'comments':_0x3480('0xd')},'data6':{'type':Sequelize[_0x3480('0xa')],'comments':_0x3480('0xe')},'data7':{'type':Sequelize[_0x3480('0xf')],'comments':_0x3480('0x10')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index aa0ef07..f32438c 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 _0x19d4=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','name','send','update','body','Action','find','params','catch','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0xb89ac4,_0x29849a){var _0x2a26b4=function(_0x2ada35){while(--_0x2ada35){_0xb89ac4['push'](_0xb89ac4['shift']());}};_0x2a26b4(++_0x29849a);}(_0x19d4,0x110));var _0x419d=function(_0x4c13a0,_0x3ba38a){_0x4c13a0=_0x4c13a0-0x0;var _0x37dbb5=_0x19d4[_0x4c13a0];return _0x37dbb5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x419d('0x0'));var zipdir=require(_0x419d('0x1'));var jsonpatch=require(_0x419d('0x2'));var rp=require('request-promise');var moment=require(_0x419d('0x3'));var BPromise=require(_0x419d('0x4'));var Mustache=require(_0x419d('0x5'));var util=require(_0x419d('0x6'));var path=require(_0x419d('0x7'));var sox=require(_0x419d('0x8'));var csv=require(_0x419d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x419d('0xa'));var _=require(_0x419d('0xb'));var squel=require(_0x419d('0xc'));var crypto=require(_0x419d('0xd'));var jsforce=require(_0x419d('0xe'));var deskjs=require(_0x419d('0xf'));var toCsv=require(_0x419d('0x9'));var querystring=require(_0x419d('0x10'));var Papa=require(_0x419d('0x11'));var Redis=require(_0x419d('0x12'));var authService=require(_0x419d('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x419d('0x14'));var hardwareService=require(_0x419d('0x15'));var logger=require('../../config/logger')(_0x419d('0x16'));var utils=require('../../config/utils');var config=require(_0x419d('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32fdb9,_0x140b5d){_0x140b5d=_0x140b5d||0xcc;return function(_0x3d75b6){if(_0x3d75b6){return _0x32fdb9[_0x419d('0x18')](_0x140b5d);}return _0x32fdb9[_0x419d('0x19')](_0x140b5d)[_0x419d('0x1a')]();};}function respondWithResult(_0x477e64,_0xf105c3){_0xf105c3=_0xf105c3||0xc8;return function(_0xac5823){if(_0xac5823){return _0x477e64[_0x419d('0x19')](_0xf105c3)[_0x419d('0x1b')](_0xac5823);}};}function respondWithFilteredResult(_0x335d07,_0x4a6ae0){return function(_0x2a3804){if(_0x2a3804){var _0x3d4c4c=typeof _0x4a6ae0[_0x419d('0x1c')]===_0x419d('0x1d')&&typeof _0x4a6ae0['limit']===_0x419d('0x1d');var _0x6f12da=_0x2a3804[_0x419d('0x1e')];var _0x1af614=_0x3d4c4c?0x0:_0x4a6ae0[_0x419d('0x1c')];var _0x1294fb=_0x3d4c4c?_0x2a3804['count']:_0x4a6ae0[_0x419d('0x1c')]+_0x4a6ae0[_0x419d('0x1f')];var _0x448c8f;if(_0x1294fb>=_0x6f12da){_0x1294fb=_0x6f12da;_0x448c8f=0xc8;}else{_0x448c8f=0xce;}_0x335d07['status'](_0x448c8f);return _0x335d07[_0x419d('0x20')](_0x419d('0x21'),_0x1af614+'-'+_0x1294fb+'/'+_0x6f12da)['json'](_0x2a3804);}return null;};}function patchUpdates(_0x529d59){return function(_0x483ce9){try{jsonpatch[_0x419d('0x22')](_0x483ce9,_0x529d59,!![]);}catch(_0x1f7b9c){return BPromise[_0x419d('0x23')](_0x1f7b9c);}return _0x483ce9[_0x419d('0x24')]();};}function saveUpdates(_0x1ba2cc,_0x305b26){return function(_0x9a8dd4){if(_0x9a8dd4){return _0x9a8dd4['update'](_0x1ba2cc)[_0x419d('0x25')](function(_0x39ca43){return _0x39ca43;});}return null;};}function removeEntity(_0x81763d,_0x590e36){return function(_0x3b425e){if(_0x3b425e){return _0x3b425e[_0x419d('0x26')]()['then'](function(){_0x81763d[_0x419d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x353d70,_0x1784c7){return function(_0x877122){if(!_0x877122){_0x353d70[_0x419d('0x18')](0x194);}return _0x877122;};}function handleError(_0x45f565,_0xa7bd59){_0xa7bd59=_0xa7bd59||0x1f4;return function(_0xaabd64){logger['error'](_0xaabd64['stack']);if(_0xaabd64[_0x419d('0x27')]){delete _0xaabd64[_0x419d('0x27')];}_0x45f565[_0x419d('0x19')](_0xa7bd59)[_0x419d('0x28')](_0xaabd64);};}exports[_0x419d('0x29')]=function(_0x5aa0f6,_0x522cf9){if(_0x5aa0f6[_0x419d('0x2a')]['id']){delete _0x5aa0f6[_0x419d('0x2a')]['id'];}return db[_0x419d('0x2b')][_0x419d('0x2c')]({'where':{'id':_0x5aa0f6[_0x419d('0x2d')]['id']}})[_0x419d('0x25')](handleEntityNotFound(_0x522cf9,null))[_0x419d('0x25')](saveUpdates(_0x5aa0f6[_0x419d('0x2a')],null))['then'](respondWithResult(_0x522cf9,null))['catch'](handleError(_0x522cf9,null));};exports['destroy']=function(_0x25ca8a,_0x261a86){return db['Action'][_0x419d('0x2c')]({'where':{'id':_0x25ca8a[_0x419d('0x2d')]['id']}})[_0x419d('0x25')](handleEntityNotFound(_0x261a86,null))['then'](removeEntity(_0x261a86,null))[_0x419d('0x2e')](handleError(_0x261a86,null));}; \ No newline at end of file +var _0x1a45=['undefined','limit','count','Content-Range','apply','reject','save','update','destroy','error','stack','name','body','Action','params','then','catch','find','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset'];(function(_0x5f1dd9,_0x59871c){var _0x54579a=function(_0x267eaa){while(--_0x267eaa){_0x5f1dd9['push'](_0x5f1dd9['shift']());}};_0x54579a(++_0x59871c);}(_0x1a45,0x6a));var _0x51a4=function(_0x48526c,_0x26df5e){_0x48526c=_0x48526c-0x0;var _0x1a09a1=_0x1a45[_0x48526c];return _0x1a09a1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x51a4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x51a4('0x1'));var moment=require(_0x51a4('0x2'));var BPromise=require(_0x51a4('0x3'));var Mustache=require(_0x51a4('0x4'));var util=require(_0x51a4('0x5'));var path=require(_0x51a4('0x6'));var sox=require(_0x51a4('0x7'));var csv=require(_0x51a4('0x8'));var ejs=require(_0x51a4('0x9'));var fs=require('fs');var fs_extra=require(_0x51a4('0xa'));var _=require(_0x51a4('0xb'));var squel=require(_0x51a4('0xc'));var crypto=require(_0x51a4('0xd'));var jsforce=require(_0x51a4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x51a4('0x8'));var querystring=require('querystring');var Papa=require(_0x51a4('0xf'));var Redis=require(_0x51a4('0x10'));var authService=require(_0x51a4('0x11'));var qs=require(_0x51a4('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x51a4('0x13'));var config=require(_0x51a4('0x14'));var licenseUtil=require(_0x51a4('0x15'));var db=require(_0x51a4('0x16'))['db'];function respondWithStatusCode(_0x59f691,_0x337aa5){_0x337aa5=_0x337aa5||0xcc;return function(_0x84d744){if(_0x84d744){return _0x59f691['sendStatus'](_0x337aa5);}return _0x59f691[_0x51a4('0x17')](_0x337aa5)[_0x51a4('0x18')]();};}function respondWithResult(_0x50dd59,_0x11242f){_0x11242f=_0x11242f||0xc8;return function(_0x219059){if(_0x219059){return _0x50dd59[_0x51a4('0x17')](_0x11242f)['json'](_0x219059);}};}function respondWithFilteredResult(_0xb14455,_0x43b6dd){return function(_0x5049fa){if(_0x5049fa){var _0x49a45f=typeof _0x43b6dd[_0x51a4('0x19')]===_0x51a4('0x1a')&&typeof _0x43b6dd[_0x51a4('0x1b')]===_0x51a4('0x1a');var _0x5da166=_0x5049fa['count'];var _0x38e6b9=_0x49a45f?0x0:_0x43b6dd['offset'];var _0x1be7fd=_0x49a45f?_0x5049fa[_0x51a4('0x1c')]:_0x43b6dd['offset']+_0x43b6dd['limit'];var _0x2a4745;if(_0x1be7fd>=_0x5da166){_0x1be7fd=_0x5da166;_0x2a4745=0xc8;}else{_0x2a4745=0xce;}_0xb14455[_0x51a4('0x17')](_0x2a4745);return _0xb14455['set'](_0x51a4('0x1d'),_0x38e6b9+'-'+_0x1be7fd+'/'+_0x5da166)['json'](_0x5049fa);}return null;};}function patchUpdates(_0x4dc894){return function(_0x546ba5){try{jsonpatch[_0x51a4('0x1e')](_0x546ba5,_0x4dc894,!![]);}catch(_0x566f69){return BPromise[_0x51a4('0x1f')](_0x566f69);}return _0x546ba5[_0x51a4('0x20')]();};}function saveUpdates(_0x16393d,_0x244bfc){return function(_0xa4c102){if(_0xa4c102){return _0xa4c102[_0x51a4('0x21')](_0x16393d)['then'](function(_0x43b753){return _0x43b753;});}return null;};}function removeEntity(_0x49b697,_0x1863a2){return function(_0x4bc066){if(_0x4bc066){return _0x4bc066[_0x51a4('0x22')]()['then'](function(){_0x49b697[_0x51a4('0x17')](0xcc)[_0x51a4('0x18')]();});}};}function handleEntityNotFound(_0x4b73b8,_0x3421d9){return function(_0x54e3ee){if(!_0x54e3ee){_0x4b73b8['sendStatus'](0x194);}return _0x54e3ee;};}function handleError(_0x113c59,_0x12f0f8){_0x12f0f8=_0x12f0f8||0x1f4;return function(_0x52bed3){logger[_0x51a4('0x23')](_0x52bed3[_0x51a4('0x24')]);if(_0x52bed3[_0x51a4('0x25')]){delete _0x52bed3[_0x51a4('0x25')];}_0x113c59[_0x51a4('0x17')](_0x12f0f8)['send'](_0x52bed3);};}exports[_0x51a4('0x21')]=function(_0x224e1b,_0x1c3e9b){if(_0x224e1b[_0x51a4('0x26')]['id']){delete _0x224e1b[_0x51a4('0x26')]['id'];}return db[_0x51a4('0x27')]['find']({'where':{'id':_0x224e1b[_0x51a4('0x28')]['id']}})[_0x51a4('0x29')](handleEntityNotFound(_0x1c3e9b,null))['then'](saveUpdates(_0x224e1b['body'],null))[_0x51a4('0x29')](respondWithResult(_0x1c3e9b,null))[_0x51a4('0x2a')](handleError(_0x1c3e9b,null));};exports['destroy']=function(_0x33696f,_0x85b097){return db[_0x51a4('0x27')][_0x51a4('0x2b')]({'where':{'id':_0x33696f['params']['id']}})[_0x51a4('0x29')](handleEntityNotFound(_0x85b097,null))['then'](removeEntity(_0x85b097,null))[_0x51a4('0x2a')](handleError(_0x85b097,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 58ee0a4..be12776 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 _0xe007=['lodash','../../config/logger','api','bluebird','rimraf','../../config/environment','./action.attributes'];(function(_0x32076a,_0x1b8c0c){var _0x382196=function(_0x42e557){while(--_0x42e557){_0x32076a['push'](_0x32076a['shift']());}};_0x382196(++_0x1b8c0c);}(_0xe007,0xe7));var _0x7e00=function(_0x4448e2,_0x215d51){_0x4448e2=_0x4448e2-0x0;var _0x1b5648=_0xe007[_0x4448e2];return _0x1b5648;};'use strict';var _=require(_0x7e00('0x0'));var util=require('util');var logger=require(_0x7e00('0x1'))(_0x7e00('0x2'));var moment=require('moment');var BPromise=require(_0x7e00('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7e00('0x4'));var config=require(_0x7e00('0x5'));var attributes=require(_0x7e00('0x6'));module['exports']=function(_0x4db8c2,_0x5c0c13){return _0x4db8c2['define']('Action',attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d89=['define','Action','tools_actions','lodash','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x13b3e7,_0x29c10f){var _0x1d0106=function(_0x201048){while(--_0x201048){_0x13b3e7['push'](_0x13b3e7['shift']());}};_0x1d0106(++_0x29c10f);}(_0x1d89,0x18f));var _0x91d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d89[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x91d8('0x0'));var util=require('util');var logger=require(_0x91d8('0x1'))(_0x91d8('0x2'));var moment=require(_0x91d8('0x3'));var BPromise=require(_0x91d8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x91d8('0x5'));var config=require('../../config/environment');var attributes=require('./action.attributes');module['exports']=function(_0x2940a8,_0x4cdfed){return _0x2940a8[_0x91d8('0x6')](_0x91d8('0x7'),attributes,{'tableName':_0x91d8('0x8'),'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 08ed9c8..2f3b053 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 _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x2bae5f,_0x8ac4f7){var _0x3714e5=function(_0x59397e){while(--_0x59397e){_0x2bae5f['push'](_0x2bae5f['shift']());}};_0x3714e5(++_0x8ac4f7);}(_0x5fc3,0xa8));var _0x35fc=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x5fc3[_0x58afd5];return _0x3e503b;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Action,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Action,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Action,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});} \ No newline at end of file +var _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x1cb9,0x14e));var _0x91cb=function(_0x28b805,_0x10554a){_0x28b805=_0x28b805-0x0;var _0x231b70=_0x1cb9[_0x28b805];return _0x231b70;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Action,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 77ff1f8..bf170d8 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 _0x6f18=['/:id','isAuthenticated','update','delete','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','put'];(function(_0x1872bb,_0x139eff){var _0x8566be=function(_0x1c663c){while(--_0x1c663c){_0x1872bb['push'](_0x1872bb['shift']());}};_0x8566be(++_0x139eff);}(_0x6f18,0x1e6));var _0x86f1=function(_0x197825,_0x3d056e){_0x197825=_0x197825-0x0;var _0x3714b3=_0x6f18[_0x197825];return _0x3714b3;};'use strict';var multer=require(_0x86f1('0x0'));var util=require(_0x86f1('0x1'));var path=require(_0x86f1('0x2'));var timeout=require('connect-timeout');var express=require(_0x86f1('0x3'));var router=express[_0x86f1('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x86f1('0x5'));var config=require(_0x86f1('0x6'));var controller=require('./action.controller');router[_0x86f1('0x7')](_0x86f1('0x8'),auth[_0x86f1('0x9')](),controller[_0x86f1('0xa')]);router[_0x86f1('0xb')](_0x86f1('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x86f1('0xc')]=router; \ No newline at end of file +var _0x15c7=['put','/:id','isAuthenticated','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x52b408,_0x22fe7e){var _0x403deb=function(_0x13defa){while(--_0x13defa){_0x52b408['push'](_0x52b408['shift']());}};_0x403deb(++_0x22fe7e);}(_0x15c7,0xa1));var _0x715c=function(_0x158424,_0x3081a7){_0x158424=_0x158424-0x0;var _0x4948d8=_0x15c7[_0x158424];return _0x4948d8;};'use strict';var multer=require(_0x715c('0x0'));var util=require('util');var path=require(_0x715c('0x1'));var timeout=require('connect-timeout');var express=require(_0x715c('0x2'));var router=express['Router']();var fs_extra=require(_0x715c('0x3'));var auth=require(_0x715c('0x4'));var interaction=require(_0x715c('0x5'));var config=require(_0x715c('0x6'));var controller=require('./action.controller');router[_0x715c('0x7')](_0x715c('0x8'),auth[_0x715c('0x9')](),controller['update']);router['delete'](_0x715c('0x8'),auth['isAuthenticated'](),controller[_0x715c('0xa')]);module[_0x715c('0xb')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 958f834..a6f83de 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 _0xdc97=['exports','STRING','TEXT','sequelize'];(function(_0x23e6bb,_0x5c2d69){var _0x1e3b4c=function(_0x1afc46){while(--_0x1afc46){_0x23e6bb['push'](_0x23e6bb['shift']());}};_0x1e3b4c(++_0x5c2d69);}(_0xdc97,0x13b));var _0x7dc9=function(_0x5c139d,_0x3ccbb4){_0x5c139d=_0x5c139d-0x0;var _0x1ca9a5=_0xdc97[_0x5c139d];return _0x1ca9a5;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'name':{'type':Sequelize[_0x7dc9('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x7dc9('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x7dc9('0x3')]},'joins':{'type':Sequelize[_0x7dc9('0x3')]}}; \ No newline at end of file +var _0xd8fb=['TEXT','sequelize','exports','STRING'];(function(_0x5bfb4d,_0x44a0eb){var _0x128703=function(_0xaf0134){while(--_0xaf0134){_0x5bfb4d['push'](_0x5bfb4d['shift']());}};_0x128703(++_0x44a0eb);}(_0xd8fb,0x99));var _0xbd8f=function(_0x3f8b7b,_0x53f0b7){_0x3f8b7b=_0x3f8b7b-0x0;var _0x313cd7=_0xd8fb[_0x3f8b7b];return _0x313cd7;};'use strict';var Sequelize=require(_0xbd8f('0x0'));module[_0xbd8f('0x1')]={'name':{'type':Sequelize[_0xbd8f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xbd8f('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xbd8f('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index abd9ba2..08c39fe 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 _0xdb8d=['bluebird','util','sox','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','index','AnalyticCustomReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','map','filter','merge','includeAll','rows','catch','show','params','keys','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','autoAssociation','CustomReports','preview','join','left_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','options','getFields','ValidationErrorItem','AnalyticMetric','findAll','keyBy','from','table','MetricId','metric','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','toString','sequelize','right_join','cross_join','SUM(%s)','GROUP_CONCAT(%s)','HOUR(%s)','value','Sequelize','select','function','output','web','fullPath','randomstring','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','fork','../../files/reports','savename','countTable','SELECT','QueryTypes','runReport','Please\x20insert\x20at\x20least\x20one\x20field','Limited\x20Query:','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0xbcf185,_0x251002){var _0x2ae4de=function(_0x26f5d2){while(--_0x26f5d2){_0xbcf185['push'](_0xbcf185['shift']());}};_0x2ae4de(++_0x251002);}(_0xdb8d,0x136));var _0xddb8=function(_0x28bcbc,_0x30ec21){_0x28bcbc=_0x28bcbc-0x0;var _0x3a814e=_0xdb8d[_0x28bcbc];return _0x3a814e;};'use strict';var emlformat=require(_0xddb8('0x0'));var rimraf=require(_0xddb8('0x1'));var zipdir=require(_0xddb8('0x2'));var jsonpatch=require(_0xddb8('0x3'));var rp=require(_0xddb8('0x4'));var moment=require(_0xddb8('0x5'));var BPromise=require(_0xddb8('0x6'));var Mustache=require('mustache');var util=require(_0xddb8('0x7'));var path=require('path');var sox=require(_0xddb8('0x8'));var csv=require('to-csv');var ejs=require(_0xddb8('0x9'));var fs=require('fs');var fs_extra=require(_0xddb8('0xa'));var _=require('lodash');var squel=require(_0xddb8('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xddb8('0xc'));var toCsv=require('to-csv');var querystring=require(_0xddb8('0xd'));var Papa=require(_0xddb8('0xe'));var Redis=require(_0xddb8('0xf'));var authService=require(_0xddb8('0x10'));var qs=require(_0xddb8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xddb8('0x12'));var utils=require('../../config/utils');var config=require(_0xddb8('0x13'));var licenseUtil=require(_0xddb8('0x14'));var db=require(_0xddb8('0x15'))['db'];var dbH=require(_0xddb8('0x15'))[_0xddb8('0x16')];function respondWithStatusCode(_0x10cb5d,_0x1a0087){_0x1a0087=_0x1a0087||0xcc;return function(_0x102fea){if(_0x102fea){return _0x10cb5d[_0xddb8('0x17')](_0x1a0087);}return _0x10cb5d[_0xddb8('0x18')](_0x1a0087)[_0xddb8('0x19')]();};}function respondWithResult(_0x1d328c,_0x535010){_0x535010=_0x535010||0xc8;return function(_0x41e27a){if(_0x41e27a){return _0x1d328c[_0xddb8('0x18')](_0x535010)[_0xddb8('0x1a')](_0x41e27a);}};}function respondWithFilteredResult(_0x14bf86,_0x3ccd41){return function(_0x197da8){if(_0x197da8){var _0x4ad260=typeof _0x3ccd41[_0xddb8('0x1b')]==='undefined'&&typeof _0x3ccd41[_0xddb8('0x1c')]===_0xddb8('0x1d');var _0x55c8dc=_0x197da8['count'];var _0x540ad3=_0x4ad260?0x0:_0x3ccd41[_0xddb8('0x1b')];var _0x53b88f=_0x4ad260?_0x197da8[_0xddb8('0x1e')]:_0x3ccd41[_0xddb8('0x1b')]+_0x3ccd41['limit'];var _0x601cf6;if(_0x53b88f>=_0x55c8dc){_0x53b88f=_0x55c8dc;_0x601cf6=0xc8;}else{_0x601cf6=0xce;}_0x14bf86['status'](_0x601cf6);return _0x14bf86['set'](_0xddb8('0x1f'),_0x540ad3+'-'+_0x53b88f+'/'+_0x55c8dc)['json'](_0x197da8);}return null;};}function patchUpdates(_0x4b2ced){return function(_0x35d7d5){try{jsonpatch['apply'](_0x35d7d5,_0x4b2ced,!![]);}catch(_0x43b8f6){return BPromise[_0xddb8('0x20')](_0x43b8f6);}return _0x35d7d5[_0xddb8('0x21')]();};}function saveUpdates(_0x33bea7,_0x21b663){return function(_0xf20cd6){if(_0xf20cd6){return _0xf20cd6[_0xddb8('0x22')](_0x33bea7)[_0xddb8('0x23')](function(_0x4a4a94){return _0x4a4a94;});}return null;};}function removeEntity(_0x410a07,_0x50f303){return function(_0x6b8550){if(_0x6b8550){return _0x6b8550[_0xddb8('0x24')]()['then'](function(){var _0xedaaff=_0x6b8550[_0xddb8('0x25')]({'plain':!![]});var _0xa3411c='CustomReports';return db[_0xddb8('0x26')][_0xddb8('0x24')]({'where':{'type':_0xa3411c,'resourceId':_0xedaaff['id']}})[_0xddb8('0x23')](function(){return _0x6b8550;});})['then'](function(){_0x410a07[_0xddb8('0x18')](0xcc)[_0xddb8('0x19')]();});}};}function handleEntityNotFound(_0x5cf747,_0x2dd540){return function(_0x25ca12){if(!_0x25ca12){_0x5cf747[_0xddb8('0x17')](0x194);}return _0x25ca12;};}function handleError(_0x527462,_0x41577f){_0x41577f=_0x41577f||0x1f4;return function(_0x14bed6){logger[_0xddb8('0x27')](_0x14bed6[_0xddb8('0x28')]);if(_0x14bed6['name']){delete _0x14bed6[_0xddb8('0x29')];}_0x527462[_0xddb8('0x18')](_0x41577f)['send'](_0x14bed6);};}exports[_0xddb8('0x2a')]=function(_0xfd64b5,_0x521757){var _0xf0dc9d={},_0x4efe56={},_0x110614={'count':0x0,'rows':[]};var _0xfd41ca=_['map'](db[_0xddb8('0x2b')][_0xddb8('0x2c')],function(_0x244c9c){return{'name':_0x244c9c['fieldName'],'type':_0x244c9c[_0xddb8('0x2d')][_0xddb8('0x2e')]};});_0x4efe56[_0xddb8('0x2f')]=_['map'](_0xfd41ca,_0xddb8('0x29'));_0x4efe56[_0xddb8('0x30')]=_['keys'](_0xfd64b5[_0xddb8('0x30')]);_0x4efe56[_0xddb8('0x31')]=_[_0xddb8('0x32')](_0x4efe56[_0xddb8('0x2f')],_0x4efe56['query']);_0xf0dc9d[_0xddb8('0x33')]=_[_0xddb8('0x32')](_0x4efe56[_0xddb8('0x2f')],qs[_0xddb8('0x34')](_0xfd64b5[_0xddb8('0x30')]['fields']));_0xf0dc9d[_0xddb8('0x33')]=_0xf0dc9d[_0xddb8('0x33')][_0xddb8('0x35')]?_0xf0dc9d[_0xddb8('0x33')]:_0x4efe56['model'];if(!_0xfd64b5[_0xddb8('0x30')]['hasOwnProperty']('nolimit')){_0xf0dc9d[_0xddb8('0x1c')]=qs[_0xddb8('0x1c')](_0xfd64b5['query'][_0xddb8('0x1c')]);_0xf0dc9d[_0xddb8('0x1b')]=qs['offset'](_0xfd64b5[_0xddb8('0x30')]['offset']);}_0xf0dc9d[_0xddb8('0x36')]=qs[_0xddb8('0x37')](_0xfd64b5[_0xddb8('0x30')]['sort']);_0xf0dc9d[_0xddb8('0x38')]=qs['filters'](_[_0xddb8('0x39')](_0xfd64b5[_0xddb8('0x30')],_0x4efe56[_0xddb8('0x31')]),_0xfd41ca);if(_0xfd64b5[_0xddb8('0x30')]['filter']){_0xf0dc9d['where']=_['merge'](_0xf0dc9d['where'],{'$or':_[_0xddb8('0x3a')](_0xfd41ca,function(_0x5fdaeb){if(_0x5fdaeb['type']!=='VIRTUAL'){var _0xffa075={};_0xffa075[_0x5fdaeb[_0xddb8('0x29')]]={'$like':'%'+_0xfd64b5[_0xddb8('0x30')][_0xddb8('0x3b')]+'%'};return _0xffa075;}})});}_0xf0dc9d=_[_0xddb8('0x3c')]({},_0xf0dc9d,_0xfd64b5['options']);var _0x21884c={'where':_0xf0dc9d[_0xddb8('0x38')]};return db['AnalyticCustomReport'][_0xddb8('0x1e')](_0x21884c)[_0xddb8('0x23')](function(_0xbf27ef){_0x110614[_0xddb8('0x1e')]=_0xbf27ef;if(_0xfd64b5[_0xddb8('0x30')][_0xddb8('0x3d')]){_0xf0dc9d['include']=[{'all':!![]}];}return db['AnalyticCustomReport']['findAll'](_0xf0dc9d);})[_0xddb8('0x23')](function(_0x2b4b47){_0x110614[_0xddb8('0x3e')]=_0x2b4b47;return _0x110614;})[_0xddb8('0x23')](respondWithFilteredResult(_0x521757,_0xf0dc9d))[_0xddb8('0x3f')](handleError(_0x521757,null));};exports[_0xddb8('0x40')]=function(_0x3a89b8,_0x1e8bd1){var _0x395b51={'raw':![],'where':{'id':_0x3a89b8[_0xddb8('0x41')]['id']}},_0x4e5786={};_0x4e5786[_0xddb8('0x2f')]=_['keys'](db['AnalyticCustomReport'][_0xddb8('0x2c')]);_0x4e5786[_0xddb8('0x30')]=_[_0xddb8('0x42')](_0x3a89b8[_0xddb8('0x30')]);_0x4e5786['filters']=_[_0xddb8('0x32')](_0x4e5786[_0xddb8('0x2f')],_0x4e5786[_0xddb8('0x30')]);_0x395b51[_0xddb8('0x33')]=_[_0xddb8('0x32')](_0x4e5786['model'],qs[_0xddb8('0x34')](_0x3a89b8['query'][_0xddb8('0x34')]));_0x395b51[_0xddb8('0x33')]=_0x395b51['attributes'][_0xddb8('0x35')]?_0x395b51['attributes']:_0x4e5786[_0xddb8('0x2f')];if(_0x3a89b8['query'][_0xddb8('0x3d')]){_0x395b51[_0xddb8('0x43')]=[{'all':!![]}];}_0x395b51=_['merge']({},_0x395b51,_0x3a89b8['options']);return db[_0xddb8('0x2b')]['find'](_0x395b51)['then'](handleEntityNotFound(_0x1e8bd1,null))[_0xddb8('0x23')](respondWithResult(_0x1e8bd1,null))[_0xddb8('0x3f')](handleError(_0x1e8bd1,null));};exports[_0xddb8('0x44')]=function(_0x1bede5,_0xd6b198){return db[_0xddb8('0x2b')][_0xddb8('0x44')](_0x1bede5[_0xddb8('0x45')],{})[_0xddb8('0x23')](function(_0x26b648){var _0x5bfca9=_0x1bede5[_0xddb8('0x46')][_0xddb8('0x25')]({'plain':!![]});if(!_0x5bfca9)throw new Error(_0xddb8('0x47'));if(_0x5bfca9[_0xddb8('0x48')]===_0xddb8('0x46')){var _0xd807f7=_0x26b648[_0xddb8('0x25')]({'plain':!![]});var _0x354766=_0xddb8('0x49');return db[_0xddb8('0x4a')][_0xddb8('0x4b')]({'where':{'name':_0x354766,'userProfileId':_0x5bfca9['userProfileId']},'raw':!![]})['then'](function(_0x5e4ab6){if(_0x5e4ab6&&_0x5e4ab6[_0xddb8('0x4c')]===0x0){return db[_0xddb8('0x26')]['create']({'name':_0xd807f7[_0xddb8('0x29')],'resourceId':_0xd807f7['id'],'type':_0xddb8('0x4d'),'sectionId':_0x5e4ab6['id']},{})['then'](function(){return _0x26b648;});}else{return _0x26b648;}})['catch'](function(_0x4566bd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4566bd);throw _0x4566bd;});}return _0x26b648;})[_0xddb8('0x23')](respondWithResult(_0xd6b198,0xc9))[_0xddb8('0x3f')](handleError(_0xd6b198,null));};exports[_0xddb8('0x22')]=function(_0x44c962,_0x4a5000){if(_0x44c962['body']['id']){delete _0x44c962[_0xddb8('0x45')]['id'];}return db[_0xddb8('0x2b')][_0xddb8('0x4b')]({'where':{'id':_0x44c962['params']['id']}})[_0xddb8('0x23')](handleEntityNotFound(_0x4a5000,null))['then'](saveUpdates(_0x44c962[_0xddb8('0x45')],null))[_0xddb8('0x23')](respondWithResult(_0x4a5000,null))[_0xddb8('0x3f')](handleError(_0x4a5000,null));};exports['destroy']=function(_0x5a99c3,_0xd8e2b8){return db[_0xddb8('0x2b')]['find']({'where':{'id':_0x5a99c3['params']['id']}})[_0xddb8('0x23')](handleEntityNotFound(_0xd8e2b8,null))[_0xddb8('0x23')](removeEntity(_0xd8e2b8,null))['catch'](handleError(_0xd8e2b8,null));};exports[_0xddb8('0x4e')]=function(_0x300749,_0x5da048){var _0x5cfbb2=0xa;var _0x4687bd=[_0xddb8('0x4f'),_0xddb8('0x50'),'right_join','cross_join'];var _0xcee83={'SUM':'SUM(%s)','COUNT':_0xddb8('0x51'),'COUNT DISTINCT':_0xddb8('0x52'),'MAX':_0xddb8('0x53'),'MIN':_0xddb8('0x54'),'AVG':_0xddb8('0x55'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xddb8('0x56'),'GROUP_CONCAT DESC':_0xddb8('0x57')};var _0x13bc0e={'SEC_TO_TIME':_0xddb8('0x58'),'DATE':_0xddb8('0x59'),'HOUR':'HOUR(%s)','ROUND':_0xddb8('0x5a'),'UNIX_TIMESTAMP':_0xddb8('0x5b')};var _0x46318a=function(_0x3d61cf){return!_[_0xddb8('0x5c')]([_0xddb8('0x5d'),_0xddb8('0x5e'),'IS\x20EMPTY',_0xddb8('0x5f')],_0x3d61cf);};var _0x1d18fc=function(_0x2c9222){if(!_0x2c9222||!_0x2c9222[_0xddb8('0x60')][_0xddb8('0x35')]){return'';}for(var _0x266de0='(',_0x3d19ba=0x0;_0x3d19ba<_0x2c9222[_0xddb8('0x60')][_0xddb8('0x35')];_0x3d19ba+=0x1){_0x3d19ba>0x0&&(_0x266de0+='\x20'+_0x2c9222[_0xddb8('0x61')]+'\x20');_0x266de0+=_0x2c9222[_0xddb8('0x60')][_0x3d19ba][_0xddb8('0x62')]?_0x1d18fc(_0x2c9222[_0xddb8('0x60')][_0x3d19ba][_0xddb8('0x62')]):_0x2c9222[_0xddb8('0x60')][_0x3d19ba][_0xddb8('0x63')]+'\x20'+_0x2c9222['rules'][_0x3d19ba][_0xddb8('0x64')]+(_0x46318a(_0x2c9222['rules'][_0x3d19ba]['condition'])?'\x20'+_0x2c9222[_0xddb8('0x60')][_0x3d19ba]['value']:'');}return _0x266de0+')';};var _0x499fa7={'where':{'id':_0x300749[_0xddb8('0x41')]['id']}},_0x2c7f9b,_0x49fb8a,_0x249d0f,_0x1e46a9,_0x581fcd;_0x499fa7=_[_0xddb8('0x3c')]({},_0x499fa7,_0x300749[_0xddb8('0x65')]);return db[_0xddb8('0x2b')][_0xddb8('0x4b')](_0x499fa7)[_0xddb8('0x23')](function(_0x26e13e){if(_0x26e13e){_0x2c7f9b=_0x26e13e;return _0x26e13e[_0xddb8('0x66')]();}return null;})['then'](function(_0x13afac){if(_0x13afac){if(!_0x13afac['length']){throw new db['Sequelize'][(_0xddb8('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x49fb8a=_0x13afac;return db[_0xddb8('0x68')][_0xddb8('0x69')]({'raw':!![]});}return null;})[_0xddb8('0x23')](function(_0x4c7b47){if(_0x4c7b47){_0x249d0f=_[_0xddb8('0x6a')](_0x4c7b47,'id');var _0x3b9c15;var _0x5dbbc4=squel['select']();_0x5dbbc4[_0xddb8('0x6b')](_0x2c7f9b[_0xddb8('0x6c')]);for(var _0x5e10a8=0x0;_0x5e10a8<_0x49fb8a[_0xddb8('0x35')];_0x5e10a8+=0x1){_0x3b9c15=_0x49fb8a[_0x5e10a8][_0xddb8('0x6d')]?_0x249d0f[_0x49fb8a[_0x5e10a8][_0xddb8('0x6d')]][_0xddb8('0x6e')]:_0x49fb8a[_0x5e10a8]['field'];_0x3b9c15=_0x49fb8a[_0x5e10a8]['function']?_[_0xddb8('0x6f')](_0xcee83[_0x49fb8a[_0x5e10a8]['function']],'%s',_0x3b9c15):_0x3b9c15;_0x3b9c15=_0x49fb8a[_0x5e10a8][_0xddb8('0x70')]?_[_0xddb8('0x6f')](_0x13bc0e[_0x49fb8a[_0x5e10a8][_0xddb8('0x70')]],'%s',_0x3b9c15):_0x3b9c15;if(_0x49fb8a[_0x5e10a8][_0xddb8('0x71')]){_0x5dbbc4[_0xddb8('0x62')](_0x3b9c15);}_0x49fb8a[_0x5e10a8]['orderBy']&&_0x5dbbc4['order'](_0x3b9c15,_0x49fb8a[_0x5e10a8][_0xddb8('0x72')]===_0xddb8('0x73')?![]:!![]);_0x5dbbc4['field'](_0x3b9c15,_0x49fb8a[_0x5e10a8][_0xddb8('0x74')]||_0x3b9c15);}if(_0x2c7f9b[_0xddb8('0x75')]){_0x2c7f9b[_0xddb8('0x75')]=JSON[_0xddb8('0x76')](_0x2c7f9b[_0xddb8('0x75')]);for(var _0x20f548=0x0;_0x20f548<_0x2c7f9b['joins'][_0xddb8('0x35')];_0x20f548+=0x1){if(_0x2c7f9b[_0xddb8('0x75')][_0x20f548][_0xddb8('0x2d')]&&_[_0xddb8('0x5c')](_0x4687bd,_0x2c7f9b[_0xddb8('0x75')][_0x20f548][_0xddb8('0x2d')])&&_0x2c7f9b[_0xddb8('0x75')][_0x20f548][_0xddb8('0x77')]&&_0x2c7f9b[_0xddb8('0x75')][_0x20f548][_0xddb8('0x78')]&&_0x2c7f9b[_0xddb8('0x75')][_0x20f548][_0xddb8('0x79')]){_0x5dbbc4[_0x2c7f9b[_0xddb8('0x75')][_0x20f548][_0xddb8('0x2d')]](_0x2c7f9b['joins'][_0x20f548][_0xddb8('0x78')],null,util[_0xddb8('0x70')](_0xddb8('0x7a'),_0x2c7f9b[_0xddb8('0x6c')],_0x2c7f9b[_0xddb8('0x75')][_0x20f548][_0xddb8('0x77')],_0x2c7f9b[_0xddb8('0x75')][_0x20f548]['foreignTable'],_0x2c7f9b[_0xddb8('0x75')][_0x20f548][_0xddb8('0x79')]));}}}if(_0x2c7f9b[_0xddb8('0x7b')]){_0x2c7f9b[_0xddb8('0x7b')]=JSON[_0xddb8('0x76')](_0x2c7f9b[_0xddb8('0x7b')]);_0x5dbbc4['where'](_0x1d18fc(_0x2c7f9b[_0xddb8('0x7b')][_0xddb8('0x62')]));}_0x581fcd=_0x5dbbc4[_0xddb8('0x7c')]();_0x5dbbc4[_0xddb8('0x1c')](_0x5cfbb2);_0x5dbbc4[_0xddb8('0x1b')](0x0);logger[_0xddb8('0x7d')]('Limited\x20Query:',_0x5dbbc4[_0xddb8('0x7e')]());return dbH[_0xddb8('0x7f')]['query'](_0x5dbbc4[_0xddb8('0x7e')](),{'type':dbH[_0xddb8('0x7f')]['QueryTypes']['SELECT']});}})['then'](respondWithResult(_0x5da048,null))[_0xddb8('0x3f')](handleError(_0x5da048,null));};function runReport(_0x20bc25,_0x2a8df5,_0x6eee1d){var _0xccb1f8=_0x2a8df5[_0xddb8('0x29')];var _0x536385=0xa;var _0x4bedd2=[_0xddb8('0x4f'),'left_join',_0xddb8('0x80'),_0xddb8('0x81')];var _0x451711={'SUM':_0xddb8('0x82'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xddb8('0x52'),'MAX':_0xddb8('0x53'),'MIN':_0xddb8('0x54'),'AVG':_0xddb8('0x55'),'GROUP_CONCAT':_0xddb8('0x83'),'GROUP_CONCAT ASC':_0xddb8('0x56'),'GROUP_CONCAT DESC':_0xddb8('0x57')};var _0x571a0b={'SEC_TO_TIME':_0xddb8('0x58'),'DATE':_0xddb8('0x59'),'HOUR':_0xddb8('0x84'),'ROUND':_0xddb8('0x5a'),'UNIX_TIMESTAMP':_0xddb8('0x5b')};var _0x505259=function(_0x2fc2b6){return!_[_0xddb8('0x5c')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0xddb8('0x5f')],_0x2fc2b6);};var _0x2849a3=function(_0x3a515c){if(!_0x3a515c||!_0x3a515c[_0xddb8('0x60')][_0xddb8('0x35')]){return'';}for(var _0x59fb1a='(',_0x510ab8=0x0;_0x510ab8<_0x3a515c['rules'][_0xddb8('0x35')];_0x510ab8+=0x1){_0x510ab8>0x0&&(_0x59fb1a+='\x20'+_0x3a515c[_0xddb8('0x61')]+'\x20');_0x59fb1a+=_0x3a515c[_0xddb8('0x60')][_0x510ab8]['group']?_0x2849a3(_0x3a515c['rules'][_0x510ab8][_0xddb8('0x62')]):_0x3a515c[_0xddb8('0x60')][_0x510ab8][_0xddb8('0x63')]+'\x20'+_0x3a515c[_0xddb8('0x60')][_0x510ab8][_0xddb8('0x64')]+(_0x505259(_0x3a515c[_0xddb8('0x60')][_0x510ab8][_0xddb8('0x64')])?'\x20'+_0x3a515c['rules'][_0x510ab8][_0xddb8('0x85')]:'');}return _0x59fb1a+')';};var _0x51f9a7={'where':{'id':_0x20bc25['id']}},_0x5af679,_0xd28dde,_0x3eae35,_0x5a86ca,_0x11a881;_0x51f9a7=_[_0xddb8('0x3c')]({},_0x51f9a7,_0x6eee1d);return db[_0xddb8('0x2b')][_0xddb8('0x4b')](_0x51f9a7)['then'](function(_0x2119bf){if(_0x2119bf){_0x5af679=_0x2119bf;return _0x2119bf[_0xddb8('0x66')]();}return null;})['then'](function(_0x4c504b){if(_0x4c504b){if(!_0x4c504b[_0xddb8('0x35')]){throw new db[(_0xddb8('0x86'))][(_0xddb8('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xd28dde=_0x4c504b;return db[_0xddb8('0x68')]['findAll']({'raw':!![]});}return null;})[_0xddb8('0x23')](function(_0x331385){if(_0x331385){_0x3eae35=_[_0xddb8('0x6a')](_0x331385,'id');var _0x8a6a29;var _0x495596=squel[_0xddb8('0x87')]();_0x495596[_0xddb8('0x6b')](_0x5af679['table']);for(var _0x4a0e66=0x0;_0x4a0e66<_0xd28dde[_0xddb8('0x35')];_0x4a0e66+=0x1){_0x8a6a29=_0xd28dde[_0x4a0e66]['MetricId']?_0x3eae35[_0xd28dde[_0x4a0e66][_0xddb8('0x6d')]][_0xddb8('0x6e')]:_0xd28dde[_0x4a0e66][_0xddb8('0x63')];_0x8a6a29=_0xd28dde[_0x4a0e66]['function']?_[_0xddb8('0x6f')](_0x451711[_0xd28dde[_0x4a0e66][_0xddb8('0x88')]],'%s',_0x8a6a29):_0x8a6a29;_0x8a6a29=_0xd28dde[_0x4a0e66][_0xddb8('0x70')]?_[_0xddb8('0x6f')](_0x571a0b[_0xd28dde[_0x4a0e66][_0xddb8('0x70')]],'%s',_0x8a6a29):_0x8a6a29;if(_0xd28dde[_0x4a0e66]['groupBy']){_0x495596['group'](_0x8a6a29);}_0xd28dde[_0x4a0e66][_0xddb8('0x72')]&&_0x495596[_0xddb8('0x36')](_0x8a6a29,_0xd28dde[_0x4a0e66][_0xddb8('0x72')]===_0xddb8('0x73')?![]:!![]);_0x495596[_0xddb8('0x63')](_0x8a6a29,_0xd28dde[_0x4a0e66][_0xddb8('0x74')]||_0x8a6a29);}if(_0x5af679[_0xddb8('0x75')]){_0x5af679[_0xddb8('0x75')]=JSON[_0xddb8('0x76')](_0x5af679[_0xddb8('0x75')]);for(var _0x320c52=0x0;_0x320c52<_0x5af679[_0xddb8('0x75')][_0xddb8('0x35')];_0x320c52+=0x1){if(_0x5af679[_0xddb8('0x75')][_0x320c52][_0xddb8('0x2d')]&&_[_0xddb8('0x5c')](_0x4bedd2,_0x5af679[_0xddb8('0x75')][_0x320c52][_0xddb8('0x2d')])&&_0x5af679[_0xddb8('0x75')][_0x320c52][_0xddb8('0x77')]&&_0x5af679[_0xddb8('0x75')][_0x320c52][_0xddb8('0x78')]&&_0x5af679[_0xddb8('0x75')][_0x320c52][_0xddb8('0x79')]){_0x495596[_0x5af679['joins'][_0x320c52][_0xddb8('0x2d')]](_0x5af679[_0xddb8('0x75')][_0x320c52][_0xddb8('0x78')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x5af679[_0xddb8('0x6c')],_0x5af679['joins'][_0x320c52][_0xddb8('0x77')],_0x5af679[_0xddb8('0x75')][_0x320c52]['foreignTable'],_0x5af679[_0xddb8('0x75')][_0x320c52]['foreignKey']));}}}if(_0x5af679[_0xddb8('0x7b')]){_0x5af679[_0xddb8('0x7b')]=JSON['parse'](_0x5af679[_0xddb8('0x7b')]);_0x495596[_0xddb8('0x38')](_0x2849a3(_0x5af679[_0xddb8('0x7b')][_0xddb8('0x62')]));}_0x11a881=_0x495596[_0xddb8('0x7c')]();_0x495596[_0xddb8('0x1c')](_0x536385);_0x495596[_0xddb8('0x1b')](0x0);return;}})[_0xddb8('0x23')](function(){if(_0x2a8df5[_0xddb8('0x89')]===_0xddb8('0x8a')){return null;}var _0x9305df=_[_0xddb8('0x3c')](_0x2a8df5,{'name':_0x2a8df5[_0xddb8('0x8b')]||_0x2a8df5['name']||_0x5af679[_0xddb8('0x29')],'basename':_0xccb1f8,'savename':util[_0xddb8('0x70')]('%s-%s.%s',_0x2a8df5['name']||_0x5af679[_0xddb8('0x29')],require(_0xddb8('0x8c'))[_0xddb8('0x8d')](0x4),_0x2a8df5[_0xddb8('0x89')]||_0xddb8('0x8e')),'reportId':_0x5af679['id'],'reportType':'custom'});return db[_0xddb8('0x8f')]['create'](_0x9305df,{'raw':!![]});})[_0xddb8('0x23')](function(_0x308d58){if(_0x5af679[_0xddb8('0x6c')]===_0xddb8('0x90')){_0x11a881[_0xddb8('0x38')](_0x5af679['table']+_0xddb8('0x91'),_0x2a8df5['startDate'],_0x2a8df5['endDate']);}else{_0x11a881[_0xddb8('0x38')](_0x5af679[_0xddb8('0x6c')]+_0xddb8('0x92'),_0x2a8df5['startDate'],_0x2a8df5[_0xddb8('0x93')]);}if(_0x308d58){logger['info'](_0xddb8('0x94'),_0x11a881[_0xddb8('0x7e')]());require('child_process')[_0xddb8('0x95')](path[_0xddb8('0x4f')](__dirname,'../../components/export/',_0x308d58[_0xddb8('0x89')]),[_0x308d58['id'],_0x11a881[_0xddb8('0x7e')](),path['join'](__dirname,_0xddb8('0x96'),_0x308d58[_0xddb8('0x97')]),_0xccb1f8]);return _0x308d58;}else{var _0x4ae690=squel[_0xddb8('0x87')]();_0x4ae690[_0xddb8('0x6b')]('('+_0x11a881['toString']()+')',_0xddb8('0x98'));_0x4ae690[_0xddb8('0x63')]('COUNT(*)',_0xddb8('0x1e'));_0x11a881[_0xddb8('0x1c')](_0x2a8df5['limit']||_0x536385);_0x11a881[_0xddb8('0x1b')](_0x2a8df5['offset']||0x0);return dbH[_0xddb8('0x7f')][_0xddb8('0x30')](_0x4ae690[_0xddb8('0x7e')](),{'type':dbH['sequelize']['QueryTypes'][_0xddb8('0x99')]})[_0xddb8('0x23')](function(_0x2a7ec8){if(!_0x2a7ec8[_0xddb8('0x35')]){_0x5a86ca=0x0;}else{_0x5a86ca=_0x2a7ec8[0x0]['count']||0x0;}return dbH[_0xddb8('0x7f')]['query'](_0x11a881[_0xddb8('0x7e')](),{'type':dbH[_0xddb8('0x7f')][_0xddb8('0x9a')][_0xddb8('0x99')]});})[_0xddb8('0x23')](function(_0x3ae5b5){return{'rows':_0x3ae5b5||[],'count':_0x5a86ca};});}});}exports['run']=function(_0x146b04,_0x272099){return runReport(_0x146b04[_0xddb8('0x41')],_0x146b04[_0xddb8('0x30')],_0x146b04['options'])['then'](respondWithResult(_0x272099,null))[_0xddb8('0x3f')](handleError(_0x272099,null));};exports[_0xddb8('0x9b')]=runReport;exports[_0xddb8('0x30')]=function(_0x2a5eee,_0x3ba098){var _0x1a358a=0xa;var _0x165889=[_0xddb8('0x4f'),'left_join',_0xddb8('0x80'),_0xddb8('0x81')];var _0x32c8a0={'SUM':'SUM(%s)','COUNT':_0xddb8('0x51'),'COUNT DISTINCT':_0xddb8('0x52'),'MAX':_0xddb8('0x53'),'MIN':_0xddb8('0x54'),'AVG':_0xddb8('0x55'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xddb8('0x56'),'GROUP_CONCAT DESC':_0xddb8('0x57')};var _0x447262={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xddb8('0x84'),'ROUND':_0xddb8('0x5a'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x186959=function(_0x235fdf){return!_[_0xddb8('0x5c')]([_0xddb8('0x5d'),_0xddb8('0x5e'),'IS\x20EMPTY',_0xddb8('0x5f')],_0x235fdf);};var _0x57c5e7=function(_0x24c753){if(!_0x24c753||!_0x24c753[_0xddb8('0x60')][_0xddb8('0x35')]){return'';}for(var _0x55c730='(',_0xc18a60=0x0;_0xc18a60<_0x24c753[_0xddb8('0x60')][_0xddb8('0x35')];_0xc18a60+=0x1){_0xc18a60>0x0&&(_0x55c730+='\x20'+_0x24c753[_0xddb8('0x61')]+'\x20');_0x55c730+=_0x24c753['rules'][_0xc18a60]['group']?_0x57c5e7(_0x24c753[_0xddb8('0x60')][_0xc18a60][_0xddb8('0x62')]):_0x24c753['rules'][_0xc18a60]['field']+'\x20'+_0x24c753[_0xddb8('0x60')][_0xc18a60][_0xddb8('0x64')]+(_0x186959(_0x24c753[_0xddb8('0x60')][_0xc18a60][_0xddb8('0x64')])?'\x20'+_0x24c753['rules'][_0xc18a60][_0xddb8('0x85')]:'');}return _0x55c730+')';};var _0x22a463={'where':{'id':_0x2a5eee['params']['id']}},_0x43cb18,_0x3be3c0,_0x156524,_0x24b040,_0x2a7200;_0x22a463=_[_0xddb8('0x3c')]({},_0x22a463,_0x2a5eee['options']);return db[_0xddb8('0x2b')][_0xddb8('0x4b')](_0x22a463)[_0xddb8('0x23')](function(_0x50fccd){if(_0x50fccd){_0x43cb18=_0x50fccd;return _0x50fccd[_0xddb8('0x66')]();}return null;})['then'](function(_0xb58b86){if(_0xb58b86){if(!_0xb58b86[_0xddb8('0x35')]){throw new db[(_0xddb8('0x86'))]['ValidationErrorItem'](_0xddb8('0x9c'),0x193);}_0x3be3c0=_0xb58b86;return db[_0xddb8('0x68')][_0xddb8('0x69')]({'raw':!![]});}return null;})[_0xddb8('0x23')](function(_0x3ddddd){if(_0x3ddddd){_0x156524=_[_0xddb8('0x6a')](_0x3ddddd,'id');var _0x3553c8;var _0x37342e=squel[_0xddb8('0x87')]();_0x37342e[_0xddb8('0x6b')](_0x43cb18[_0xddb8('0x6c')]);for(var _0x3fbd7c=0x0;_0x3fbd7c<_0x3be3c0[_0xddb8('0x35')];_0x3fbd7c+=0x1){_0x3553c8=_0x3be3c0[_0x3fbd7c][_0xddb8('0x6d')]?_0x156524[_0x3be3c0[_0x3fbd7c][_0xddb8('0x6d')]]['metric']:_0x3be3c0[_0x3fbd7c][_0xddb8('0x63')];_0x3553c8=_0x3be3c0[_0x3fbd7c][_0xddb8('0x88')]?_[_0xddb8('0x6f')](_0x32c8a0[_0x3be3c0[_0x3fbd7c]['function']],'%s',_0x3553c8):_0x3553c8;_0x3553c8=_0x3be3c0[_0x3fbd7c][_0xddb8('0x70')]?_[_0xddb8('0x6f')](_0x447262[_0x3be3c0[_0x3fbd7c]['format']],'%s',_0x3553c8):_0x3553c8;if(_0x3be3c0[_0x3fbd7c][_0xddb8('0x71')]){_0x37342e[_0xddb8('0x62')](_0x3553c8);}_0x3be3c0[_0x3fbd7c][_0xddb8('0x72')]&&_0x37342e['order'](_0x3553c8,_0x3be3c0[_0x3fbd7c][_0xddb8('0x72')]===_0xddb8('0x73')?![]:!![]);_0x37342e[_0xddb8('0x63')](_0x3553c8,_0x3be3c0[_0x3fbd7c][_0xddb8('0x74')]||_0x3553c8);}if(_0x43cb18[_0xddb8('0x75')]){_0x43cb18[_0xddb8('0x75')]=JSON[_0xddb8('0x76')](_0x43cb18[_0xddb8('0x75')]);for(var _0x27eb61=0x0;_0x27eb61<_0x43cb18[_0xddb8('0x75')]['length'];_0x27eb61+=0x1){if(_0x43cb18[_0xddb8('0x75')][_0x27eb61][_0xddb8('0x2d')]&&_[_0xddb8('0x5c')](_0x165889,_0x43cb18[_0xddb8('0x75')][_0x27eb61][_0xddb8('0x2d')])&&_0x43cb18[_0xddb8('0x75')][_0x27eb61][_0xddb8('0x77')]&&_0x43cb18['joins'][_0x27eb61]['foreignTable']&&_0x43cb18[_0xddb8('0x75')][_0x27eb61][_0xddb8('0x79')]){_0x37342e[_0x43cb18[_0xddb8('0x75')][_0x27eb61][_0xddb8('0x2d')]](_0x43cb18['joins'][_0x27eb61]['foreignTable'],null,util[_0xddb8('0x70')](_0xddb8('0x7a'),_0x43cb18[_0xddb8('0x6c')],_0x43cb18[_0xddb8('0x75')][_0x27eb61][_0xddb8('0x77')],_0x43cb18[_0xddb8('0x75')][_0x27eb61][_0xddb8('0x78')],_0x43cb18[_0xddb8('0x75')][_0x27eb61][_0xddb8('0x79')]));}}}if(_0x43cb18['conditions']){_0x43cb18['conditions']=JSON['parse'](_0x43cb18[_0xddb8('0x7b')]);_0x37342e[_0xddb8('0x38')](_0x57c5e7(_0x43cb18['conditions']['group']));}_0x2a7200=_0x37342e[_0xddb8('0x7c')]();_0x37342e['limit'](_0x1a358a);_0x37342e[_0xddb8('0x1b')](0x0);logger['debug'](_0xddb8('0x9d'),_0x37342e[_0xddb8('0x7e')]());return dbH[_0xddb8('0x7f')][_0xddb8('0x30')](_0x37342e[_0xddb8('0x7e')](),{'type':dbH[_0xddb8('0x7f')][_0xddb8('0x9a')]['SELECT']});}})['then'](function(){return{'sql':_0x2a7200[_0xddb8('0x7e')]()};})[_0xddb8('0x23')](respondWithResult(_0x3ba098,null))[_0xddb8('0x3f')](handleError(_0x3ba098,null));}; \ No newline at end of file +var _0xa1ac=['orderBy','output','web','%s-%s.%s','randomstring','generate','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','run','runReport','QueryTypes','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','dbH','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomReports','sendStatus','error','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','keys','find','body','role','user','userProfileId','autoAssociation','UserProfileResource','create','join','right_join','SUM(%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','merge','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','metric','field','replace','function','format','groupBy','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','left_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','SEC_TO_TIME(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','getFields','Please\x20insert\x20at\x20least\x20one\x20field'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa1ac,0xbb));var _0xca1a=function(_0xd44bc1,_0x524adc){_0xd44bc1=_0xd44bc1-0x0;var _0x6f240e=_0xa1ac[_0xd44bc1];return _0x6f240e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xca1a('0x0'));var zipdir=require(_0xca1a('0x1'));var jsonpatch=require(_0xca1a('0x2'));var rp=require(_0xca1a('0x3'));var moment=require(_0xca1a('0x4'));var BPromise=require(_0xca1a('0x5'));var Mustache=require(_0xca1a('0x6'));var util=require(_0xca1a('0x7'));var path=require(_0xca1a('0x8'));var sox=require('sox');var csv=require(_0xca1a('0x9'));var ejs=require(_0xca1a('0xa'));var fs=require('fs');var fs_extra=require(_0xca1a('0xb'));var _=require(_0xca1a('0xc'));var squel=require(_0xca1a('0xd'));var crypto=require(_0xca1a('0xe'));var jsforce=require(_0xca1a('0xf'));var deskjs=require(_0xca1a('0x10'));var toCsv=require(_0xca1a('0x9'));var querystring=require('querystring');var Papa=require(_0xca1a('0x11'));var Redis=require(_0xca1a('0x12'));var authService=require(_0xca1a('0x13'));var qs=require(_0xca1a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xca1a('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xca1a('0x16'));var licenseUtil=require(_0xca1a('0x17'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xca1a('0x18')];function respondWithStatusCode(_0x264399,_0x2c136d){_0x2c136d=_0x2c136d||0xcc;return function(_0xe7622c){if(_0xe7622c){return _0x264399['sendStatus'](_0x2c136d);}return _0x264399['status'](_0x2c136d)[_0xca1a('0x19')]();};}function respondWithResult(_0x3b7f14,_0x2bf135){_0x2bf135=_0x2bf135||0xc8;return function(_0x5027a5){if(_0x5027a5){return _0x3b7f14[_0xca1a('0x1a')](_0x2bf135)[_0xca1a('0x1b')](_0x5027a5);}};}function respondWithFilteredResult(_0x3d2fc2,_0x4f2598){return function(_0x56a580){if(_0x56a580){var _0x3d7ed3=typeof _0x4f2598[_0xca1a('0x1c')]==='undefined'&&typeof _0x4f2598[_0xca1a('0x1d')]==='undefined';var _0x5029d0=_0x56a580['count'];var _0x195290=_0x3d7ed3?0x0:_0x4f2598[_0xca1a('0x1c')];var _0x389e29=_0x3d7ed3?_0x56a580['count']:_0x4f2598[_0xca1a('0x1c')]+_0x4f2598[_0xca1a('0x1d')];var _0x2ff1c4;if(_0x389e29>=_0x5029d0){_0x389e29=_0x5029d0;_0x2ff1c4=0xc8;}else{_0x2ff1c4=0xce;}_0x3d2fc2[_0xca1a('0x1a')](_0x2ff1c4);return _0x3d2fc2[_0xca1a('0x1e')](_0xca1a('0x1f'),_0x195290+'-'+_0x389e29+'/'+_0x5029d0)['json'](_0x56a580);}return null;};}function patchUpdates(_0x36795c){return function(_0x2276af){try{jsonpatch[_0xca1a('0x20')](_0x2276af,_0x36795c,!![]);}catch(_0x19fc8b){return BPromise[_0xca1a('0x21')](_0x19fc8b);}return _0x2276af[_0xca1a('0x22')]();};}function saveUpdates(_0x552d33,_0x2193ec){return function(_0x5c7fb1){if(_0x5c7fb1){return _0x5c7fb1[_0xca1a('0x23')](_0x552d33)[_0xca1a('0x24')](function(_0x2cd555){return _0x2cd555;});}return null;};}function removeEntity(_0x383015,_0x142625){return function(_0x2da4cd){if(_0x2da4cd){return _0x2da4cd[_0xca1a('0x25')]()['then'](function(){var _0x1a9c74=_0x2da4cd[_0xca1a('0x26')]({'plain':!![]});var _0x1fc77e=_0xca1a('0x27');return db['UserProfileResource'][_0xca1a('0x25')]({'where':{'type':_0x1fc77e,'resourceId':_0x1a9c74['id']}})[_0xca1a('0x24')](function(){return _0x2da4cd;});})[_0xca1a('0x24')](function(){_0x383015[_0xca1a('0x1a')](0xcc)[_0xca1a('0x19')]();});}};}function handleEntityNotFound(_0x2db480,_0x173808){return function(_0xc957b7){if(!_0xc957b7){_0x2db480[_0xca1a('0x28')](0x194);}return _0xc957b7;};}function handleError(_0x16ec0e,_0x41a565){_0x41a565=_0x41a565||0x1f4;return function(_0x49c8f0){logger[_0xca1a('0x29')](_0x49c8f0['stack']);if(_0x49c8f0[_0xca1a('0x2a')]){delete _0x49c8f0[_0xca1a('0x2a')];}_0x16ec0e['status'](_0x41a565)[_0xca1a('0x2b')](_0x49c8f0);};}exports[_0xca1a('0x2c')]=function(_0x3cf160,_0x79fe7){var _0x29468c={},_0x1409b4={},_0x176f27={'count':0x0,'rows':[]};var _0x1818fd=_[_0xca1a('0x2d')](db[_0xca1a('0x2e')][_0xca1a('0x2f')],function(_0xea4022){return{'name':_0xea4022[_0xca1a('0x30')],'type':_0xea4022[_0xca1a('0x31')]['key']};});_0x1409b4[_0xca1a('0x32')]=_[_0xca1a('0x2d')](_0x1818fd,_0xca1a('0x2a'));_0x1409b4[_0xca1a('0x33')]=_['keys'](_0x3cf160['query']);_0x1409b4['filters']=_['intersection'](_0x1409b4[_0xca1a('0x32')],_0x1409b4[_0xca1a('0x33')]);_0x29468c[_0xca1a('0x34')]=_[_0xca1a('0x35')](_0x1409b4[_0xca1a('0x32')],qs[_0xca1a('0x36')](_0x3cf160[_0xca1a('0x33')][_0xca1a('0x36')]));_0x29468c[_0xca1a('0x34')]=_0x29468c[_0xca1a('0x34')][_0xca1a('0x37')]?_0x29468c[_0xca1a('0x34')]:_0x1409b4['model'];if(!_0x3cf160[_0xca1a('0x33')][_0xca1a('0x38')](_0xca1a('0x39'))){_0x29468c[_0xca1a('0x1d')]=qs['limit'](_0x3cf160['query']['limit']);_0x29468c['offset']=qs['offset'](_0x3cf160[_0xca1a('0x33')]['offset']);}_0x29468c[_0xca1a('0x3a')]=qs[_0xca1a('0x3b')](_0x3cf160['query'][_0xca1a('0x3b')]);_0x29468c['where']=qs[_0xca1a('0x3c')](_[_0xca1a('0x3d')](_0x3cf160[_0xca1a('0x33')],_0x1409b4[_0xca1a('0x3c')]),_0x1818fd);if(_0x3cf160[_0xca1a('0x33')][_0xca1a('0x3e')]){_0x29468c[_0xca1a('0x3f')]=_['merge'](_0x29468c[_0xca1a('0x3f')],{'$or':_[_0xca1a('0x2d')](_0x1818fd,function(_0x35cb93){if(_0x35cb93[_0xca1a('0x31')]!==_0xca1a('0x40')){var _0x43781d={};_0x43781d[_0x35cb93[_0xca1a('0x2a')]]={'$like':'%'+_0x3cf160[_0xca1a('0x33')][_0xca1a('0x3e')]+'%'};return _0x43781d;}})});}_0x29468c=_['merge']({},_0x29468c,_0x3cf160[_0xca1a('0x41')]);var _0x51ed16={'where':_0x29468c[_0xca1a('0x3f')]};return db[_0xca1a('0x2e')][_0xca1a('0x42')](_0x51ed16)[_0xca1a('0x24')](function(_0x2b80fc){_0x176f27[_0xca1a('0x42')]=_0x2b80fc;if(_0x3cf160['query'][_0xca1a('0x43')]){_0x29468c[_0xca1a('0x44')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xca1a('0x45')](_0x29468c);})[_0xca1a('0x24')](function(_0x325b0e){_0x176f27['rows']=_0x325b0e;return _0x176f27;})['then'](respondWithFilteredResult(_0x79fe7,_0x29468c))[_0xca1a('0x46')](handleError(_0x79fe7,null));};exports[_0xca1a('0x47')]=function(_0x3071ed,_0x3d628d){var _0xc50eb2={'raw':![],'where':{'id':_0x3071ed[_0xca1a('0x48')]['id']}},_0x4c9a54={};_0x4c9a54[_0xca1a('0x32')]=_[_0xca1a('0x49')](db[_0xca1a('0x2e')][_0xca1a('0x2f')]);_0x4c9a54[_0xca1a('0x33')]=_[_0xca1a('0x49')](_0x3071ed[_0xca1a('0x33')]);_0x4c9a54['filters']=_[_0xca1a('0x35')](_0x4c9a54[_0xca1a('0x32')],_0x4c9a54[_0xca1a('0x33')]);_0xc50eb2[_0xca1a('0x34')]=_['intersection'](_0x4c9a54[_0xca1a('0x32')],qs[_0xca1a('0x36')](_0x3071ed[_0xca1a('0x33')][_0xca1a('0x36')]));_0xc50eb2[_0xca1a('0x34')]=_0xc50eb2[_0xca1a('0x34')]['length']?_0xc50eb2[_0xca1a('0x34')]:_0x4c9a54[_0xca1a('0x32')];if(_0x3071ed[_0xca1a('0x33')][_0xca1a('0x43')]){_0xc50eb2['include']=[{'all':!![]}];}_0xc50eb2=_['merge']({},_0xc50eb2,_0x3071ed['options']);return db[_0xca1a('0x2e')][_0xca1a('0x4a')](_0xc50eb2)[_0xca1a('0x24')](handleEntityNotFound(_0x3d628d,null))[_0xca1a('0x24')](respondWithResult(_0x3d628d,null))[_0xca1a('0x46')](handleError(_0x3d628d,null));};exports['create']=function(_0x554b22,_0x3cbff8){return db[_0xca1a('0x2e')]['create'](_0x554b22[_0xca1a('0x4b')],{})['then'](function(_0x1c6196){var _0x1fd2ba=_0x554b22['user']['get']({'plain':!![]});if(!_0x1fd2ba)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1fd2ba[_0xca1a('0x4c')]===_0xca1a('0x4d')){var _0x431843=_0x1c6196[_0xca1a('0x26')]({'plain':!![]});var _0x1bfaea='Reports';return db['UserProfileSection'][_0xca1a('0x4a')]({'where':{'name':_0x1bfaea,'userProfileId':_0x1fd2ba[_0xca1a('0x4e')]},'raw':!![]})[_0xca1a('0x24')](function(_0x33f8de){if(_0x33f8de&&_0x33f8de[_0xca1a('0x4f')]===0x0){return db[_0xca1a('0x50')][_0xca1a('0x51')]({'name':_0x431843[_0xca1a('0x2a')],'resourceId':_0x431843['id'],'type':'CustomReports','sectionId':_0x33f8de['id']},{})['then'](function(){return _0x1c6196;});}else{return _0x1c6196;}})[_0xca1a('0x46')](function(_0x4a0cf6){logger[_0xca1a('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a0cf6);throw _0x4a0cf6;});}return _0x1c6196;})['then'](respondWithResult(_0x3cbff8,0xc9))[_0xca1a('0x46')](handleError(_0x3cbff8,null));};exports[_0xca1a('0x23')]=function(_0x38e01e,_0x2a7210){if(_0x38e01e['body']['id']){delete _0x38e01e[_0xca1a('0x4b')]['id'];}return db[_0xca1a('0x2e')]['find']({'where':{'id':_0x38e01e[_0xca1a('0x48')]['id']}})[_0xca1a('0x24')](handleEntityNotFound(_0x2a7210,null))['then'](saveUpdates(_0x38e01e[_0xca1a('0x4b')],null))[_0xca1a('0x24')](respondWithResult(_0x2a7210,null))[_0xca1a('0x46')](handleError(_0x2a7210,null));};exports['destroy']=function(_0x28cbd3,_0x3401aa){return db[_0xca1a('0x2e')][_0xca1a('0x4a')]({'where':{'id':_0x28cbd3[_0xca1a('0x48')]['id']}})[_0xca1a('0x24')](handleEntityNotFound(_0x3401aa,null))[_0xca1a('0x24')](removeEntity(_0x3401aa,null))[_0xca1a('0x46')](handleError(_0x3401aa,null));};exports['preview']=function(_0x253d57,_0x59978f){var _0x5d0487=0xa;var _0x47e3bc=[_0xca1a('0x52'),'left_join',_0xca1a('0x53'),'cross_join'];var _0x2f5d2f={'SUM':_0xca1a('0x54'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xca1a('0x55'),'MIN':'MIN(%s)','AVG':_0xca1a('0x56'),'GROUP_CONCAT':_0xca1a('0x57'),'GROUP_CONCAT ASC':_0xca1a('0x58'),'GROUP_CONCAT DESC':_0xca1a('0x59')};var _0x12b4ed={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xca1a('0x5a'),'HOUR':_0xca1a('0x5b'),'ROUND':_0xca1a('0x5c'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3ad689=function(_0x459637){return!_[_0xca1a('0x5d')]([_0xca1a('0x5e'),'IS\x20NOT\x20NULL',_0xca1a('0x5f'),_0xca1a('0x60')],_0x459637);};var _0x4e0d71=function(_0x2418bd){if(!_0x2418bd||!_0x2418bd['rules'][_0xca1a('0x37')]){return'';}for(var _0x16ed51='(',_0xa06ec=0x0;_0xa06ec<_0x2418bd[_0xca1a('0x61')]['length'];_0xa06ec+=0x1){_0xa06ec>0x0&&(_0x16ed51+='\x20'+_0x2418bd[_0xca1a('0x62')]+'\x20');_0x16ed51+=_0x2418bd[_0xca1a('0x61')][_0xa06ec][_0xca1a('0x63')]?_0x4e0d71(_0x2418bd['rules'][_0xa06ec]['group']):_0x2418bd[_0xca1a('0x61')][_0xa06ec]['field']+'\x20'+_0x2418bd[_0xca1a('0x61')][_0xa06ec][_0xca1a('0x64')]+(_0x3ad689(_0x2418bd[_0xca1a('0x61')][_0xa06ec][_0xca1a('0x64')])?'\x20'+_0x2418bd[_0xca1a('0x61')][_0xa06ec][_0xca1a('0x65')]:'');}return _0x16ed51+')';};var _0x14d3f3={'where':{'id':_0x253d57[_0xca1a('0x48')]['id']}},_0x5d5645,_0x4ec7a4,_0x367bb4,_0x123353,_0x44d3f1;_0x14d3f3=_[_0xca1a('0x66')]({},_0x14d3f3,_0x253d57[_0xca1a('0x41')]);return db[_0xca1a('0x2e')][_0xca1a('0x4a')](_0x14d3f3)[_0xca1a('0x24')](function(_0x4db5fc){if(_0x4db5fc){_0x5d5645=_0x4db5fc;return _0x4db5fc['getFields']();}return null;})[_0xca1a('0x24')](function(_0x154d71){if(_0x154d71){if(!_0x154d71['length']){throw new db[(_0xca1a('0x67'))][(_0xca1a('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4ec7a4=_0x154d71;return db[_0xca1a('0x69')][_0xca1a('0x45')]({'raw':!![]});}return null;})[_0xca1a('0x24')](function(_0x51d587){if(_0x51d587){_0x367bb4=_[_0xca1a('0x6a')](_0x51d587,'id');var _0x55f191;var _0x23e214=squel[_0xca1a('0x6b')]();_0x23e214[_0xca1a('0x6c')](_0x5d5645[_0xca1a('0x6d')]);for(var _0x343b06=0x0;_0x343b06<_0x4ec7a4[_0xca1a('0x37')];_0x343b06+=0x1){_0x55f191=_0x4ec7a4[_0x343b06]['MetricId']?_0x367bb4[_0x4ec7a4[_0x343b06][_0xca1a('0x6e')]][_0xca1a('0x6f')]:_0x4ec7a4[_0x343b06][_0xca1a('0x70')];_0x55f191=_0x4ec7a4[_0x343b06]['function']?_[_0xca1a('0x71')](_0x2f5d2f[_0x4ec7a4[_0x343b06][_0xca1a('0x72')]],'%s',_0x55f191):_0x55f191;_0x55f191=_0x4ec7a4[_0x343b06][_0xca1a('0x73')]?_['replace'](_0x12b4ed[_0x4ec7a4[_0x343b06][_0xca1a('0x73')]],'%s',_0x55f191):_0x55f191;if(_0x4ec7a4[_0x343b06][_0xca1a('0x74')]){_0x23e214[_0xca1a('0x63')](_0x55f191);}_0x4ec7a4[_0x343b06]['orderBy']&&_0x23e214[_0xca1a('0x3a')](_0x55f191,_0x4ec7a4[_0x343b06]['orderBy']===_0xca1a('0x75')?![]:!![]);_0x23e214[_0xca1a('0x70')](_0x55f191,_0x4ec7a4[_0x343b06][_0xca1a('0x76')]||_0x55f191);}if(_0x5d5645[_0xca1a('0x77')]){_0x5d5645['joins']=JSON[_0xca1a('0x78')](_0x5d5645[_0xca1a('0x77')]);for(var _0x17ec70=0x0;_0x17ec70<_0x5d5645[_0xca1a('0x77')]['length'];_0x17ec70+=0x1){if(_0x5d5645[_0xca1a('0x77')][_0x17ec70][_0xca1a('0x31')]&&_['includes'](_0x47e3bc,_0x5d5645['joins'][_0x17ec70][_0xca1a('0x31')])&&_0x5d5645['joins'][_0x17ec70]['parentKey']&&_0x5d5645[_0xca1a('0x77')][_0x17ec70][_0xca1a('0x79')]&&_0x5d5645[_0xca1a('0x77')][_0x17ec70][_0xca1a('0x7a')]){_0x23e214[_0x5d5645['joins'][_0x17ec70][_0xca1a('0x31')]](_0x5d5645[_0xca1a('0x77')][_0x17ec70][_0xca1a('0x79')],null,util[_0xca1a('0x73')](_0xca1a('0x7b'),_0x5d5645[_0xca1a('0x6d')],_0x5d5645[_0xca1a('0x77')][_0x17ec70][_0xca1a('0x7c')],_0x5d5645[_0xca1a('0x77')][_0x17ec70][_0xca1a('0x79')],_0x5d5645['joins'][_0x17ec70][_0xca1a('0x7a')]));}}}if(_0x5d5645[_0xca1a('0x7d')]){_0x5d5645['conditions']=JSON['parse'](_0x5d5645[_0xca1a('0x7d')]);_0x23e214['where'](_0x4e0d71(_0x5d5645[_0xca1a('0x7d')][_0xca1a('0x63')]));}_0x44d3f1=_0x23e214[_0xca1a('0x7e')]();_0x23e214[_0xca1a('0x1d')](_0x5d0487);_0x23e214['offset'](0x0);logger[_0xca1a('0x7f')](_0xca1a('0x80'),_0x23e214[_0xca1a('0x81')]());return dbH[_0xca1a('0x82')][_0xca1a('0x33')](_0x23e214['toString'](),{'type':dbH[_0xca1a('0x82')]['QueryTypes'][_0xca1a('0x83')]});}})[_0xca1a('0x24')](respondWithResult(_0x59978f,null))[_0xca1a('0x46')](handleError(_0x59978f,null));};function runReport(_0xd70387,_0x25983b,_0x4cb65f){var _0x2dd895=_0x25983b[_0xca1a('0x2a')];var _0x5b59e7=0xa;var _0x4e09e7=[_0xca1a('0x52'),_0xca1a('0x84'),_0xca1a('0x53'),_0xca1a('0x85')];var _0x16607a={'SUM':_0xca1a('0x54'),'COUNT':_0xca1a('0x86'),'COUNT DISTINCT':_0xca1a('0x87'),'MAX':_0xca1a('0x55'),'MIN':'MIN(%s)','AVG':_0xca1a('0x56'),'GROUP_CONCAT':_0xca1a('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xca1a('0x59')};var _0x534c98={'SEC_TO_TIME':_0xca1a('0x88'),'DATE':_0xca1a('0x5a'),'HOUR':_0xca1a('0x5b'),'ROUND':_0xca1a('0x5c'),'UNIX_TIMESTAMP':_0xca1a('0x89')};var _0x25ff05=function(_0x27880c){return!_[_0xca1a('0x5d')]([_0xca1a('0x5e'),_0xca1a('0x8a'),_0xca1a('0x5f'),_0xca1a('0x60')],_0x27880c);};var _0xe1ef42=function(_0x5eede5){if(!_0x5eede5||!_0x5eede5[_0xca1a('0x61')][_0xca1a('0x37')]){return'';}for(var _0x43ea6e='(',_0x1f0625=0x0;_0x1f0625<_0x5eede5[_0xca1a('0x61')][_0xca1a('0x37')];_0x1f0625+=0x1){_0x1f0625>0x0&&(_0x43ea6e+='\x20'+_0x5eede5[_0xca1a('0x62')]+'\x20');_0x43ea6e+=_0x5eede5[_0xca1a('0x61')][_0x1f0625][_0xca1a('0x63')]?_0xe1ef42(_0x5eede5['rules'][_0x1f0625][_0xca1a('0x63')]):_0x5eede5['rules'][_0x1f0625]['field']+'\x20'+_0x5eede5[_0xca1a('0x61')][_0x1f0625][_0xca1a('0x64')]+(_0x25ff05(_0x5eede5[_0xca1a('0x61')][_0x1f0625][_0xca1a('0x64')])?'\x20'+_0x5eede5['rules'][_0x1f0625]['value']:'');}return _0x43ea6e+')';};var _0x7b23be={'where':{'id':_0xd70387['id']}},_0x23b64d,_0x30c9d3,_0x5462a3,_0x2903fb,_0x206259;_0x7b23be=_['merge']({},_0x7b23be,_0x4cb65f);return db[_0xca1a('0x2e')][_0xca1a('0x4a')](_0x7b23be)[_0xca1a('0x24')](function(_0x214889){if(_0x214889){_0x23b64d=_0x214889;return _0x214889[_0xca1a('0x8b')]();}return null;})[_0xca1a('0x24')](function(_0x53742b){if(_0x53742b){if(!_0x53742b['length']){throw new db[(_0xca1a('0x67'))][(_0xca1a('0x68'))](_0xca1a('0x8c'),0x193);}_0x30c9d3=_0x53742b;return db[_0xca1a('0x69')][_0xca1a('0x45')]({'raw':!![]});}return null;})[_0xca1a('0x24')](function(_0x5ad057){if(_0x5ad057){_0x5462a3=_[_0xca1a('0x6a')](_0x5ad057,'id');var _0x518140;var _0x12136a=squel[_0xca1a('0x6b')]();_0x12136a['from'](_0x23b64d['table']);for(var _0x429ed2=0x0;_0x429ed2<_0x30c9d3[_0xca1a('0x37')];_0x429ed2+=0x1){_0x518140=_0x30c9d3[_0x429ed2][_0xca1a('0x6e')]?_0x5462a3[_0x30c9d3[_0x429ed2][_0xca1a('0x6e')]][_0xca1a('0x6f')]:_0x30c9d3[_0x429ed2][_0xca1a('0x70')];_0x518140=_0x30c9d3[_0x429ed2][_0xca1a('0x72')]?_['replace'](_0x16607a[_0x30c9d3[_0x429ed2][_0xca1a('0x72')]],'%s',_0x518140):_0x518140;_0x518140=_0x30c9d3[_0x429ed2][_0xca1a('0x73')]?_[_0xca1a('0x71')](_0x534c98[_0x30c9d3[_0x429ed2][_0xca1a('0x73')]],'%s',_0x518140):_0x518140;if(_0x30c9d3[_0x429ed2][_0xca1a('0x74')]){_0x12136a[_0xca1a('0x63')](_0x518140);}_0x30c9d3[_0x429ed2][_0xca1a('0x8d')]&&_0x12136a[_0xca1a('0x3a')](_0x518140,_0x30c9d3[_0x429ed2]['orderBy']==='DESC'?![]:!![]);_0x12136a[_0xca1a('0x70')](_0x518140,_0x30c9d3[_0x429ed2][_0xca1a('0x76')]||_0x518140);}if(_0x23b64d[_0xca1a('0x77')]){_0x23b64d[_0xca1a('0x77')]=JSON[_0xca1a('0x78')](_0x23b64d[_0xca1a('0x77')]);for(var _0x267e20=0x0;_0x267e20<_0x23b64d['joins']['length'];_0x267e20+=0x1){if(_0x23b64d[_0xca1a('0x77')][_0x267e20][_0xca1a('0x31')]&&_['includes'](_0x4e09e7,_0x23b64d['joins'][_0x267e20][_0xca1a('0x31')])&&_0x23b64d['joins'][_0x267e20][_0xca1a('0x7c')]&&_0x23b64d[_0xca1a('0x77')][_0x267e20][_0xca1a('0x79')]&&_0x23b64d[_0xca1a('0x77')][_0x267e20][_0xca1a('0x7a')]){_0x12136a[_0x23b64d[_0xca1a('0x77')][_0x267e20][_0xca1a('0x31')]](_0x23b64d['joins'][_0x267e20][_0xca1a('0x79')],null,util[_0xca1a('0x73')](_0xca1a('0x7b'),_0x23b64d['table'],_0x23b64d[_0xca1a('0x77')][_0x267e20]['parentKey'],_0x23b64d['joins'][_0x267e20][_0xca1a('0x79')],_0x23b64d['joins'][_0x267e20][_0xca1a('0x7a')]));}}}if(_0x23b64d[_0xca1a('0x7d')]){_0x23b64d['conditions']=JSON[_0xca1a('0x78')](_0x23b64d[_0xca1a('0x7d')]);_0x12136a['where'](_0xe1ef42(_0x23b64d['conditions'][_0xca1a('0x63')]));}_0x206259=_0x12136a[_0xca1a('0x7e')]();_0x12136a[_0xca1a('0x1d')](_0x5b59e7);_0x12136a[_0xca1a('0x1c')](0x0);return;}})['then'](function(){if(_0x25983b[_0xca1a('0x8e')]===_0xca1a('0x8f')){return null;}var _0x19d55d=_[_0xca1a('0x66')](_0x25983b,{'name':_0x25983b['fullPath']||_0x25983b[_0xca1a('0x2a')]||_0x23b64d[_0xca1a('0x2a')],'basename':_0x2dd895,'savename':util[_0xca1a('0x73')](_0xca1a('0x90'),_0x25983b['name']||_0x23b64d[_0xca1a('0x2a')],require(_0xca1a('0x91'))[_0xca1a('0x92')](0x4),_0x25983b['output']||_0xca1a('0x93')),'reportId':_0x23b64d['id'],'reportType':_0xca1a('0x94')});return db['AnalyticExtractedReport'][_0xca1a('0x51')](_0x19d55d,{'raw':!![]});})[_0xca1a('0x24')](function(_0x16c2ba){if(_0x23b64d['table']===_0xca1a('0x95')){_0x206259['where'](_0x23b64d[_0xca1a('0x6d')]+_0xca1a('0x96'),_0x25983b[_0xca1a('0x97')],_0x25983b[_0xca1a('0x98')]);}else{_0x206259[_0xca1a('0x3f')](_0x23b64d['table']+_0xca1a('0x99'),_0x25983b['startDate'],_0x25983b[_0xca1a('0x98')]);}if(_0x16c2ba){logger['info'](_0xca1a('0x9a'),_0x206259['toString']());require(_0xca1a('0x9b'))[_0xca1a('0x9c')](path[_0xca1a('0x52')](__dirname,_0xca1a('0x9d'),_0x16c2ba['output']),[_0x16c2ba['id'],_0x206259['toString'](),path[_0xca1a('0x52')](__dirname,_0xca1a('0x9e'),_0x16c2ba[_0xca1a('0x9f')]),_0x2dd895]);return _0x16c2ba;}else{var _0x14a75c=squel['select']();_0x14a75c[_0xca1a('0x6c')]('('+_0x206259[_0xca1a('0x81')]()+')',_0xca1a('0xa0'));_0x14a75c['field']('COUNT(*)',_0xca1a('0x42'));_0x206259[_0xca1a('0x1d')](_0x25983b[_0xca1a('0x1d')]||_0x5b59e7);_0x206259[_0xca1a('0x1c')](_0x25983b[_0xca1a('0x1c')]||0x0);return dbH[_0xca1a('0x82')][_0xca1a('0x33')](_0x14a75c[_0xca1a('0x81')](),{'type':dbH[_0xca1a('0x82')]['QueryTypes'][_0xca1a('0x83')]})[_0xca1a('0x24')](function(_0x1c519c){if(!_0x1c519c[_0xca1a('0x37')]){_0x2903fb=0x0;}else{_0x2903fb=_0x1c519c[0x0][_0xca1a('0x42')]||0x0;}return dbH[_0xca1a('0x82')][_0xca1a('0x33')](_0x206259[_0xca1a('0x81')](),{'type':dbH['sequelize']['QueryTypes'][_0xca1a('0x83')]});})['then'](function(_0x37c0c7){return{'rows':_0x37c0c7||[],'count':_0x2903fb};});}});}exports[_0xca1a('0xa1')]=function(_0x333289,_0x35c9d4){return runReport(_0x333289['params'],_0x333289['query'],_0x333289['options'])[_0xca1a('0x24')](respondWithResult(_0x35c9d4,null))['catch'](handleError(_0x35c9d4,null));};exports[_0xca1a('0xa2')]=runReport;exports[_0xca1a('0x33')]=function(_0x971aaa,_0x4d42a5){var _0x51fc53=0xa;var _0xc3a3ab=[_0xca1a('0x52'),_0xca1a('0x84'),_0xca1a('0x53'),_0xca1a('0x85')];var _0x2c2782={'SUM':'SUM(%s)','COUNT':_0xca1a('0x86'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xca1a('0x55'),'MIN':'MIN(%s)','AVG':_0xca1a('0x56'),'GROUP_CONCAT':_0xca1a('0x57'),'GROUP_CONCAT ASC':_0xca1a('0x58'),'GROUP_CONCAT DESC':_0xca1a('0x59')};var _0x27b695={'SEC_TO_TIME':_0xca1a('0x88'),'DATE':'DATE(%s)','HOUR':_0xca1a('0x5b'),'ROUND':_0xca1a('0x5c'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x174284=function(_0x49e6cd){return!_[_0xca1a('0x5d')](['IS\x20NULL',_0xca1a('0x8a'),_0xca1a('0x5f'),_0xca1a('0x60')],_0x49e6cd);};var _0x1cbfee=function(_0x145d95){if(!_0x145d95||!_0x145d95['rules'][_0xca1a('0x37')]){return'';}for(var _0x5114db='(',_0x127ed2=0x0;_0x127ed2<_0x145d95['rules'][_0xca1a('0x37')];_0x127ed2+=0x1){_0x127ed2>0x0&&(_0x5114db+='\x20'+_0x145d95[_0xca1a('0x62')]+'\x20');_0x5114db+=_0x145d95[_0xca1a('0x61')][_0x127ed2][_0xca1a('0x63')]?_0x1cbfee(_0x145d95['rules'][_0x127ed2][_0xca1a('0x63')]):_0x145d95['rules'][_0x127ed2]['field']+'\x20'+_0x145d95[_0xca1a('0x61')][_0x127ed2][_0xca1a('0x64')]+(_0x174284(_0x145d95[_0xca1a('0x61')][_0x127ed2][_0xca1a('0x64')])?'\x20'+_0x145d95[_0xca1a('0x61')][_0x127ed2][_0xca1a('0x65')]:'');}return _0x5114db+')';};var _0x151211={'where':{'id':_0x971aaa[_0xca1a('0x48')]['id']}},_0xb36e2,_0x4b9353,_0x47fd5c,_0x148b9d,_0x4d50de;_0x151211=_[_0xca1a('0x66')]({},_0x151211,_0x971aaa[_0xca1a('0x41')]);return db['AnalyticCustomReport']['find'](_0x151211)[_0xca1a('0x24')](function(_0x20d190){if(_0x20d190){_0xb36e2=_0x20d190;return _0x20d190[_0xca1a('0x8b')]();}return null;})['then'](function(_0x3fb5a3){if(_0x3fb5a3){if(!_0x3fb5a3['length']){throw new db[(_0xca1a('0x67'))]['ValidationErrorItem'](_0xca1a('0x8c'),0x193);}_0x4b9353=_0x3fb5a3;return db[_0xca1a('0x69')]['findAll']({'raw':!![]});}return null;})[_0xca1a('0x24')](function(_0x23bfc7){if(_0x23bfc7){_0x47fd5c=_['keyBy'](_0x23bfc7,'id');var _0x32f6ef;var _0x3c0f10=squel[_0xca1a('0x6b')]();_0x3c0f10[_0xca1a('0x6c')](_0xb36e2[_0xca1a('0x6d')]);for(var _0xf1df5b=0x0;_0xf1df5b<_0x4b9353['length'];_0xf1df5b+=0x1){_0x32f6ef=_0x4b9353[_0xf1df5b][_0xca1a('0x6e')]?_0x47fd5c[_0x4b9353[_0xf1df5b]['MetricId']][_0xca1a('0x6f')]:_0x4b9353[_0xf1df5b][_0xca1a('0x70')];_0x32f6ef=_0x4b9353[_0xf1df5b][_0xca1a('0x72')]?_['replace'](_0x2c2782[_0x4b9353[_0xf1df5b][_0xca1a('0x72')]],'%s',_0x32f6ef):_0x32f6ef;_0x32f6ef=_0x4b9353[_0xf1df5b]['format']?_['replace'](_0x27b695[_0x4b9353[_0xf1df5b]['format']],'%s',_0x32f6ef):_0x32f6ef;if(_0x4b9353[_0xf1df5b][_0xca1a('0x74')]){_0x3c0f10[_0xca1a('0x63')](_0x32f6ef);}_0x4b9353[_0xf1df5b][_0xca1a('0x8d')]&&_0x3c0f10['order'](_0x32f6ef,_0x4b9353[_0xf1df5b][_0xca1a('0x8d')]===_0xca1a('0x75')?![]:!![]);_0x3c0f10['field'](_0x32f6ef,_0x4b9353[_0xf1df5b][_0xca1a('0x76')]||_0x32f6ef);}if(_0xb36e2['joins']){_0xb36e2[_0xca1a('0x77')]=JSON[_0xca1a('0x78')](_0xb36e2[_0xca1a('0x77')]);for(var _0x535d9a=0x0;_0x535d9a<_0xb36e2['joins'][_0xca1a('0x37')];_0x535d9a+=0x1){if(_0xb36e2[_0xca1a('0x77')][_0x535d9a][_0xca1a('0x31')]&&_[_0xca1a('0x5d')](_0xc3a3ab,_0xb36e2[_0xca1a('0x77')][_0x535d9a]['type'])&&_0xb36e2[_0xca1a('0x77')][_0x535d9a][_0xca1a('0x7c')]&&_0xb36e2['joins'][_0x535d9a][_0xca1a('0x79')]&&_0xb36e2[_0xca1a('0x77')][_0x535d9a][_0xca1a('0x7a')]){_0x3c0f10[_0xb36e2['joins'][_0x535d9a][_0xca1a('0x31')]](_0xb36e2[_0xca1a('0x77')][_0x535d9a]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0xb36e2[_0xca1a('0x6d')],_0xb36e2[_0xca1a('0x77')][_0x535d9a][_0xca1a('0x7c')],_0xb36e2[_0xca1a('0x77')][_0x535d9a][_0xca1a('0x79')],_0xb36e2['joins'][_0x535d9a][_0xca1a('0x7a')]));}}}if(_0xb36e2['conditions']){_0xb36e2['conditions']=JSON[_0xca1a('0x78')](_0xb36e2['conditions']);_0x3c0f10[_0xca1a('0x3f')](_0x1cbfee(_0xb36e2[_0xca1a('0x7d')][_0xca1a('0x63')]));}_0x4d50de=_0x3c0f10[_0xca1a('0x7e')]();_0x3c0f10[_0xca1a('0x1d')](_0x51fc53);_0x3c0f10['offset'](0x0);logger[_0xca1a('0x7f')](_0xca1a('0x80'),_0x3c0f10[_0xca1a('0x81')]());return dbH[_0xca1a('0x82')][_0xca1a('0x33')](_0x3c0f10['toString'](),{'type':dbH[_0xca1a('0x82')][_0xca1a('0xa3')]['SELECT']});}})[_0xca1a('0x24')](function(){return{'sql':_0x4d50de[_0xca1a('0x81')]()};})[_0xca1a('0x24')](respondWithResult(_0x4d42a5,null))[_0xca1a('0x46')](handleError(_0x4d42a5,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 9975069..3a85dd5 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 _0x674d=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0x674d,0x1c5));var _0xd674=function(_0xf47939,_0x124b6a){_0xf47939=_0xf47939-0x0;var _0x5f1ec1=_0x674d[_0xf47939];return _0x5f1ec1;};'use strict';var _=require(_0xd674('0x0'));var util=require(_0xd674('0x1'));var logger=require(_0xd674('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd674('0x3'));var rp=require(_0xd674('0x4'));var fs=require('fs');var path=require(_0xd674('0x5'));var rimraf=require(_0xd674('0x6'));var config=require(_0xd674('0x7'));var attributes=require(_0xd674('0x8'));module[_0xd674('0x9')]=function(_0x451e4f,_0x26ec5d){return _0x451e4f[_0xd674('0xa')](_0xd674('0xb'),attributes,{'tableName':_0xd674('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x582d=['request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xb4f654,_0x33ce4b){var _0x521323=function(_0x531016){while(--_0x531016){_0xb4f654['push'](_0xb4f654['shift']());}};_0x521323(++_0x33ce4b);}(_0x582d,0x14a));var _0xd582=function(_0x19d30f,_0x59d859){_0x19d30f=_0x19d30f-0x0;var _0x4cf401=_0x582d[_0x19d30f];return _0x4cf401;};'use strict';var _=require(_0xd582('0x0'));var util=require(_0xd582('0x1'));var logger=require(_0xd582('0x2'))(_0xd582('0x3'));var moment=require(_0xd582('0x4'));var BPromise=require(_0xd582('0x5'));var rp=require(_0xd582('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd582('0x7'));var config=require(_0xd582('0x8'));var attributes=require(_0xd582('0x9'));module[_0xd582('0xa')]=function(_0x109bc1,_0x2484a6){return _0x109bc1[_0xd582('0xb')](_0xd582('0xc'),attributes,{'tableName':_0xd582('0xd'),'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 a9aa098..82f9779 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 _0x1147=['client','http','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x54bbf0,_0x218cef){var _0x1e54ac=function(_0x31a233){while(--_0x31a233){_0x54bbf0['push'](_0x54bbf0['shift']());}};_0x1e54ac(++_0x218cef);}(_0x1147,0x12a));var _0x7114=function(_0x18ec8d,_0xe7f6be){_0x18ec8d=_0x18ec8d-0x0;var _0x2b162e=_0x1147[_0x18ec8d];return _0x2b162e;};'use strict';var _=require('lodash');var util=require(_0x7114('0x0'));var moment=require(_0x7114('0x1'));var BPromise=require(_0x7114('0x2'));var rs=require(_0x7114('0x3'));var fs=require('fs');var Redis=require(_0x7114('0x4'));var db=require(_0x7114('0x5'))['db'];var utils=require(_0x7114('0x6'));var logger=require('../../config/logger')(_0x7114('0x7'));var config=require(_0x7114('0x8'));var jayson=require(_0x7114('0x9'));var client=jayson[_0x7114('0xa')][_0x7114('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24b175,_0xb5170f,_0x172977){return new BPromise(function(_0x4fc97d,_0xd6da87){return client[_0x7114('0xc')](_0x24b175,_0x172977)[_0x7114('0xd')](function(_0x38f9dd){logger['info'](_0x7114('0xe'),_0xb5170f,_0x7114('0xf'));logger[_0x7114('0x10')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0xb5170f,'request\x20sent',JSON[_0x7114('0x11')](_0x38f9dd));if(_0x38f9dd['error']){if(_0x38f9dd['error']['code']===0x1f4){logger[_0x7114('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0xb5170f,_0x38f9dd[_0x7114('0x12')][_0x7114('0x13')]);return _0xd6da87(_0x38f9dd[_0x7114('0x12')][_0x7114('0x13')]);}logger[_0x7114('0x12')](_0x7114('0xe'),_0xb5170f,_0x38f9dd[_0x7114('0x12')][_0x7114('0x13')]);return _0x4fc97d(_0x38f9dd['error']['message']);}else{logger['info'](_0x7114('0xe'),_0xb5170f,_0x7114('0xf'));_0x4fc97d(_0x38f9dd[_0x7114('0x14')][_0x7114('0x13')]);}})[_0x7114('0x15')](function(_0xb0b9a6){logger[_0x7114('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0xb5170f,_0xb0b9a6);_0xd6da87(_0xb0b9a6);});});} \ No newline at end of file +var _0xba41=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','then','info','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','lodash'];(function(_0x166953,_0x214d3a){var _0x4a8baf=function(_0x4de85c){while(--_0x4de85c){_0x166953['push'](_0x166953['shift']());}};_0x4a8baf(++_0x214d3a);}(_0xba41,0xaa));var _0x1ba4=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xba41[_0x36884e];return _0x1cc367;};'use strict';var _=require(_0x1ba4('0x0'));var util=require(_0x1ba4('0x1'));var moment=require(_0x1ba4('0x2'));var BPromise=require(_0x1ba4('0x3'));var rs=require(_0x1ba4('0x4'));var fs=require('fs');var Redis=require(_0x1ba4('0x5'));var db=require(_0x1ba4('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1ba4('0x7'));var config=require('../../config/environment');var jayson=require(_0x1ba4('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xe355e0,_0x2a0f90,_0x452a5a){return new BPromise(function(_0x1cd322,_0xeb5aee){return client['request'](_0xe355e0,_0x452a5a)[_0x1ba4('0x9')](function(_0xfa74df){logger[_0x1ba4('0xa')]('AnalyticCustomReport,\x20%s,\x20%s',_0x2a0f90,'request\x20sent');logger[_0x1ba4('0xb')](_0x1ba4('0xc'),_0x2a0f90,_0x1ba4('0xd'),JSON[_0x1ba4('0xe')](_0xfa74df));if(_0xfa74df['error']){if(_0xfa74df[_0x1ba4('0xf')][_0x1ba4('0x10')]===0x1f4){logger[_0x1ba4('0xf')](_0x1ba4('0x11'),_0x2a0f90,_0xfa74df[_0x1ba4('0xf')][_0x1ba4('0x12')]);return _0xeb5aee(_0xfa74df[_0x1ba4('0xf')][_0x1ba4('0x12')]);}logger[_0x1ba4('0xf')](_0x1ba4('0x11'),_0x2a0f90,_0xfa74df[_0x1ba4('0xf')][_0x1ba4('0x12')]);return _0x1cd322(_0xfa74df['error']['message']);}else{logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x2a0f90,_0x1ba4('0xd'));_0x1cd322(_0xfa74df['result'][_0x1ba4('0x12')]);}})['catch'](function(_0x584c48){logger[_0x1ba4('0xf')](_0x1ba4('0x11'),_0x2a0f90,_0x584c48);_0xeb5aee(_0x584c48);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index d77e840..e8db83a 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 _0xd676=['update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','run','/:id/query','post','create','put'];(function(_0x5ad220,_0x27407e){var _0xdec77d=function(_0x58d736){while(--_0x58d736){_0x5ad220['push'](_0x5ad220['shift']());}};_0xdec77d(++_0x27407e);}(_0xd676,0x76));var _0x6d67=function(_0xaefa77,_0x34c56d){_0xaefa77=_0xaefa77-0x0;var _0x159f15=_0xd676[_0xaefa77];return _0x159f15;};'use strict';var multer=require(_0x6d67('0x0'));var util=require('util');var path=require(_0x6d67('0x1'));var timeout=require(_0x6d67('0x2'));var express=require(_0x6d67('0x3'));var router=express['Router']();var fs_extra=require(_0x6d67('0x4'));var auth=require(_0x6d67('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6d67('0x6'));var controller=require(_0x6d67('0x7'));router[_0x6d67('0x8')]('/',auth[_0x6d67('0x9')](),controller[_0x6d67('0xa')]);router[_0x6d67('0x8')](_0x6d67('0xb'),auth[_0x6d67('0x9')](),controller[_0x6d67('0xc')]);router[_0x6d67('0x8')](_0x6d67('0xd'),auth['isAuthenticated'](),controller[_0x6d67('0xe')]);router[_0x6d67('0x8')]('/:id/run',auth[_0x6d67('0x9')](),controller[_0x6d67('0xf')]);router[_0x6d67('0x8')](_0x6d67('0x10'),auth[_0x6d67('0x9')](),controller['query']);router[_0x6d67('0x11')]('/',auth['isAuthenticated'](),controller[_0x6d67('0x12')]);router[_0x6d67('0x13')](_0x6d67('0xb'),auth['isAuthenticated'](),controller[_0x6d67('0x14')]);router[_0x6d67('0x15')](_0x6d67('0xb'),auth[_0x6d67('0x9')](),controller[_0x6d67('0x16')]);module['exports']=router; \ No newline at end of file +var _0x9ee9=['util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/run','run','/:id/query','create','put','update','destroy','exports','multer'];(function(_0x577fc1,_0x4aaf10){var _0x4c9a79=function(_0x5302cd){while(--_0x5302cd){_0x577fc1['push'](_0x577fc1['shift']());}};_0x4c9a79(++_0x4aaf10);}(_0x9ee9,0x11d));var _0x99ee=function(_0x368cbe,_0x36331c){_0x368cbe=_0x368cbe-0x0;var _0x2a04de=_0x9ee9[_0x368cbe];return _0x2a04de;};'use strict';var multer=require(_0x99ee('0x0'));var util=require(_0x99ee('0x1'));var path=require(_0x99ee('0x2'));var timeout=require(_0x99ee('0x3'));var express=require('express');var router=express[_0x99ee('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x99ee('0x5'));var config=require(_0x99ee('0x6'));var controller=require(_0x99ee('0x7'));router[_0x99ee('0x8')]('/',auth[_0x99ee('0x9')](),controller[_0x99ee('0xa')]);router[_0x99ee('0x8')](_0x99ee('0xb'),auth[_0x99ee('0x9')](),controller['show']);router[_0x99ee('0x8')](_0x99ee('0xc'),auth[_0x99ee('0x9')](),controller[_0x99ee('0xd')]);router[_0x99ee('0x8')](_0x99ee('0xe'),auth[_0x99ee('0x9')](),controller[_0x99ee('0xf')]);router[_0x99ee('0x8')](_0x99ee('0x10'),auth[_0x99ee('0x9')](),controller['query']);router['post']('/',auth[_0x99ee('0x9')](),controller[_0x99ee('0x11')]);router[_0x99ee('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x99ee('0x13')]);router['delete'](_0x99ee('0xb'),auth[_0x99ee('0x9')](),controller[_0x99ee('0x14')]);module[_0x99ee('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index a423f21..e524d7f 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 _0x2eb2=['TEXT','exports','STRING'];(function(_0x39194a,_0x10366c){var _0x21af77=function(_0x6e421b){while(--_0x6e421b){_0x39194a['push'](_0x39194a['shift']());}};_0x21af77(++_0x10366c);}(_0x2eb2,0x19f));var _0x22eb=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x2eb2[_0x12d033];return _0x3b4e80;};'use strict';var Sequelize=require('sequelize');module[_0x22eb('0x0')]={'name':{'type':Sequelize[_0x22eb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x22eb('0x1')]},'parent':{'type':Sequelize[_0x22eb('0x1')]},'table':{'type':Sequelize[_0x22eb('0x1')]},'conditions':{'type':Sequelize[_0x22eb('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x326f=['STRING','TEXT','sequelize'];(function(_0xaf70a4,_0x8a3649){var _0x35eee1=function(_0x492eb8){while(--_0x492eb8){_0xaf70a4['push'](_0xaf70a4['shift']());}};_0x35eee1(++_0x8a3649);}(_0x326f,0xd1));var _0xf326=function(_0x10cc01,_0x122eb2){_0x10cc01=_0x10cc01-0x0;var _0x29a7c6=_0x326f[_0x10cc01];return _0x29a7c6;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xf326('0x1')]},'parent':{'type':Sequelize[_0xf326('0x1')]},'table':{'type':Sequelize[_0xf326('0x1')]},'conditions':{'type':Sequelize[_0xf326('0x2')]},'joins':{'type':Sequelize[_0xf326('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 7fb311f..991a4a2 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 _0x46ed=['SEC_TO_TIME(%s)','value','AnalyticMetric','select','DESC','output','fullPath','%s-%s.%s','randomstring','csv','default','AnalyticExtractedReport','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','../../files/reports','savename','countTable','COUNT(*)','sequelize','runReport','left_join','COUNT(%s)','MIN(%s)','AVG(%s)','Limited\x20Query:','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','catch','params','find','create','body','user','Reports','UserProfileSection','userProfileId','autoAssociation','preview','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','order','alias','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','QueryTypes','SELECT'];(function(_0x4c8dfa,_0xd9c68b){var _0x2ec23b=function(_0x3e151b){while(--_0x3e151b){_0x4c8dfa['push'](_0x4c8dfa['shift']());}};_0x2ec23b(++_0xd9c68b);}(_0x46ed,0x168));var _0xd46e=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x46ed[_0xa148b7];return _0x51efd3;};'use strict';var emlformat=require(_0xd46e('0x0'));var rimraf=require(_0xd46e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd46e('0x2'));var rp=require(_0xd46e('0x3'));var moment=require(_0xd46e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd46e('0x5'));var util=require(_0xd46e('0x6'));var path=require('path');var sox=require(_0xd46e('0x7'));var csv=require(_0xd46e('0x8'));var ejs=require(_0xd46e('0x9'));var fs=require('fs');var fs_extra=require(_0xd46e('0xa'));var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x8'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0xf3048c,_0x27dbfb){_0x27dbfb=_0x27dbfb||0xcc;return function(_0x53b309){if(_0x53b309){return _0xf3048c['sendStatus'](_0x27dbfb);}return _0xf3048c[_0xd46e('0x1a')](_0x27dbfb)[_0xd46e('0x1b')]();};}function respondWithResult(_0x1e9aae,_0x3fdf88){_0x3fdf88=_0x3fdf88||0xc8;return function(_0x50c7c3){if(_0x50c7c3){return _0x1e9aae[_0xd46e('0x1a')](_0x3fdf88)[_0xd46e('0x1c')](_0x50c7c3);}};}function respondWithFilteredResult(_0x417402,_0x3d72ce){return function(_0x36a317){if(_0x36a317){var _0x47fa8f=typeof _0x3d72ce[_0xd46e('0x1d')]===_0xd46e('0x1e')&&typeof _0x3d72ce[_0xd46e('0x1f')]==='undefined';var _0x5ddd04=_0x36a317[_0xd46e('0x20')];var _0x1bd574=_0x47fa8f?0x0:_0x3d72ce['offset'];var _0x4fd1f2=_0x47fa8f?_0x36a317[_0xd46e('0x20')]:_0x3d72ce[_0xd46e('0x1d')]+_0x3d72ce[_0xd46e('0x1f')];var _0x2273c5;if(_0x4fd1f2>=_0x5ddd04){_0x4fd1f2=_0x5ddd04;_0x2273c5=0xc8;}else{_0x2273c5=0xce;}_0x417402[_0xd46e('0x1a')](_0x2273c5);return _0x417402[_0xd46e('0x21')](_0xd46e('0x22'),_0x1bd574+'-'+_0x4fd1f2+'/'+_0x5ddd04)[_0xd46e('0x1c')](_0x36a317);}return null;};}function patchUpdates(_0xb4940){return function(_0x3c7e91){try{jsonpatch[_0xd46e('0x23')](_0x3c7e91,_0xb4940,!![]);}catch(_0x5ba94d){return BPromise[_0xd46e('0x24')](_0x5ba94d);}return _0x3c7e91[_0xd46e('0x25')]();};}function saveUpdates(_0x79aa51,_0x45ce0b){return function(_0x128246){if(_0x128246){return _0x128246[_0xd46e('0x26')](_0x79aa51)[_0xd46e('0x27')](function(_0x8a1be){return _0x8a1be;});}return null;};}function removeEntity(_0x62dea5,_0x4cf899){return function(_0x314570){if(_0x314570){return _0x314570['destroy']()['then'](function(){var _0x371054=_0x314570[_0xd46e('0x28')]({'plain':!![]});var _0x21135f=_0xd46e('0x29');return db[_0xd46e('0x2a')][_0xd46e('0x2b')]({'where':{'type':_0x21135f,'resourceId':_0x371054['id']}})[_0xd46e('0x27')](function(){return _0x314570;});})['then'](function(){_0x62dea5[_0xd46e('0x1a')](0xcc)[_0xd46e('0x1b')]();});}};}function handleEntityNotFound(_0xddbce9,_0x17db79){return function(_0x96f15c){if(!_0x96f15c){_0xddbce9[_0xd46e('0x2c')](0x194);}return _0x96f15c;};}function handleError(_0x58aeef,_0x465d54){_0x465d54=_0x465d54||0x1f4;return function(_0x3a1ced){logger[_0xd46e('0x2d')](_0x3a1ced[_0xd46e('0x2e')]);if(_0x3a1ced[_0xd46e('0x2f')]){delete _0x3a1ced[_0xd46e('0x2f')];}_0x58aeef[_0xd46e('0x1a')](_0x465d54)[_0xd46e('0x30')](_0x3a1ced);};}exports[_0xd46e('0x31')]=function(_0x45ea47,_0x2ff785){var _0x504324={},_0x2f4a1b={},_0x5ed8dc={'count':0x0,'rows':[]};var _0x1248ce=_[_0xd46e('0x32')](db[_0xd46e('0x33')][_0xd46e('0x34')],function(_0x5ef248){return{'name':_0x5ef248[_0xd46e('0x35')],'type':_0x5ef248[_0xd46e('0x36')]['key']};});_0x2f4a1b[_0xd46e('0x37')]=_[_0xd46e('0x32')](_0x1248ce,'name');_0x2f4a1b[_0xd46e('0x38')]=_[_0xd46e('0x39')](_0x45ea47[_0xd46e('0x38')]);_0x2f4a1b['filters']=_['intersection'](_0x2f4a1b[_0xd46e('0x37')],_0x2f4a1b[_0xd46e('0x38')]);_0x504324[_0xd46e('0x3a')]=_[_0xd46e('0x3b')](_0x2f4a1b[_0xd46e('0x37')],qs[_0xd46e('0x3c')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x3c')]));_0x504324['attributes']=_0x504324[_0xd46e('0x3a')][_0xd46e('0x3d')]?_0x504324[_0xd46e('0x3a')]:_0x2f4a1b[_0xd46e('0x37')];if(!_0x45ea47[_0xd46e('0x38')][_0xd46e('0x3e')](_0xd46e('0x3f'))){_0x504324['limit']=qs[_0xd46e('0x1f')](_0x45ea47[_0xd46e('0x38')]['limit']);_0x504324[_0xd46e('0x1d')]=qs[_0xd46e('0x1d')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x1d')]);}_0x504324['order']=qs[_0xd46e('0x40')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x40')]);_0x504324[_0xd46e('0x41')]=qs[_0xd46e('0x42')](_[_0xd46e('0x43')](_0x45ea47[_0xd46e('0x38')],_0x2f4a1b[_0xd46e('0x42')]),_0x1248ce);if(_0x45ea47['query'][_0xd46e('0x44')]){_0x504324[_0xd46e('0x41')]=_[_0xd46e('0x45')](_0x504324[_0xd46e('0x41')],{'$or':_[_0xd46e('0x32')](_0x1248ce,function(_0x56f99c){if(_0x56f99c[_0xd46e('0x36')]!=='VIRTUAL'){var _0x55230d={};_0x55230d[_0x56f99c['name']]={'$like':'%'+_0x45ea47['query'][_0xd46e('0x44')]+'%'};return _0x55230d;}})});}_0x504324=_['merge']({},_0x504324,_0x45ea47[_0xd46e('0x46')]);var _0x40720e={'where':_0x504324['where']};return db[_0xd46e('0x33')][_0xd46e('0x20')](_0x40720e)[_0xd46e('0x27')](function(_0x31ba12){_0x5ed8dc[_0xd46e('0x20')]=_0x31ba12;if(_0x45ea47[_0xd46e('0x38')][_0xd46e('0x47')]){_0x504324[_0xd46e('0x48')]=[{'all':!![]}];}return db[_0xd46e('0x33')][_0xd46e('0x49')](_0x504324);})[_0xd46e('0x27')](function(_0x5ea048){_0x5ed8dc['rows']=_0x5ea048;return _0x5ed8dc;})['then'](respondWithFilteredResult(_0x2ff785,_0x504324))[_0xd46e('0x4a')](handleError(_0x2ff785,null));};exports['show']=function(_0x168d35,_0x272f5f){var _0x3fdf67={'raw':!![],'where':{'id':_0x168d35[_0xd46e('0x4b')]['id']}},_0x416505={};_0x416505[_0xd46e('0x37')]=_[_0xd46e('0x39')](db[_0xd46e('0x33')]['rawAttributes']);_0x416505[_0xd46e('0x38')]=_['keys'](_0x168d35[_0xd46e('0x38')]);_0x416505[_0xd46e('0x42')]=_[_0xd46e('0x3b')](_0x416505[_0xd46e('0x37')],_0x416505[_0xd46e('0x38')]);_0x3fdf67['attributes']=_[_0xd46e('0x3b')](_0x416505[_0xd46e('0x37')],qs[_0xd46e('0x3c')](_0x168d35[_0xd46e('0x38')][_0xd46e('0x3c')]));_0x3fdf67['attributes']=_0x3fdf67[_0xd46e('0x3a')][_0xd46e('0x3d')]?_0x3fdf67[_0xd46e('0x3a')]:_0x416505[_0xd46e('0x37')];if(_0x168d35[_0xd46e('0x38')]['includeAll']){_0x3fdf67[_0xd46e('0x48')]=[{'all':!![]}];}_0x3fdf67=_[_0xd46e('0x45')]({},_0x3fdf67,_0x168d35[_0xd46e('0x46')]);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0x3fdf67)[_0xd46e('0x27')](handleEntityNotFound(_0x272f5f,null))[_0xd46e('0x27')](respondWithResult(_0x272f5f,null))[_0xd46e('0x4a')](handleError(_0x272f5f,null));};exports['create']=function(_0xf9dab,_0x71a8dc){return db[_0xd46e('0x33')][_0xd46e('0x4d')](_0xf9dab[_0xd46e('0x4e')],{})['then'](function(_0x4ae314){var _0x3a94cf=_0xf9dab[_0xd46e('0x4f')][_0xd46e('0x28')]({'plain':!![]});if(!_0x3a94cf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a94cf['role']===_0xd46e('0x4f')){var _0x9d8638=_0x4ae314['get']({'plain':!![]});var _0x2eee92=_0xd46e('0x50');return db[_0xd46e('0x51')][_0xd46e('0x4c')]({'where':{'name':_0x2eee92,'userProfileId':_0x3a94cf[_0xd46e('0x52')]},'raw':!![]})[_0xd46e('0x27')](function(_0x80ed51){if(_0x80ed51&&_0x80ed51[_0xd46e('0x53')]===0x0){return db['UserProfileResource'][_0xd46e('0x4d')]({'name':_0x9d8638[_0xd46e('0x2f')],'resourceId':_0x9d8638['id'],'type':_0xd46e('0x29'),'sectionId':_0x80ed51['id']},{})[_0xd46e('0x27')](function(){return _0x4ae314;});}else{return _0x4ae314;}})['catch'](function(_0x56dd9a){logger[_0xd46e('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56dd9a);throw _0x56dd9a;});}return _0x4ae314;})[_0xd46e('0x27')](respondWithResult(_0x71a8dc,0xc9))[_0xd46e('0x4a')](handleError(_0x71a8dc,null));};exports[_0xd46e('0x26')]=function(_0x31f7eb,_0x5a7870){if(_0x31f7eb[_0xd46e('0x4e')]['id']){delete _0x31f7eb['body']['id'];}return db[_0xd46e('0x33')][_0xd46e('0x4c')]({'where':{'id':_0x31f7eb[_0xd46e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5a7870,null))[_0xd46e('0x27')](saveUpdates(_0x31f7eb[_0xd46e('0x4e')],null))[_0xd46e('0x27')](respondWithResult(_0x5a7870,null))[_0xd46e('0x4a')](handleError(_0x5a7870,null));};exports[_0xd46e('0x2b')]=function(_0x2cc676,_0x2760ef){return db[_0xd46e('0x33')][_0xd46e('0x4c')]({'where':{'id':_0x2cc676[_0xd46e('0x4b')]['id']}})[_0xd46e('0x27')](handleEntityNotFound(_0x2760ef,null))[_0xd46e('0x27')](removeEntity(_0x2760ef,null))[_0xd46e('0x4a')](handleError(_0x2760ef,null));};exports[_0xd46e('0x54')]=function(_0x47a86c,_0x3ec709){var _0x37a22f=0xa;var _0xe0cd61=[_0xd46e('0x55'),'left_join',_0xd46e('0x56'),_0xd46e('0x57')];var _0xaf9641={'SUM':_0xd46e('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':_0xd46e('0x5c'),'GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x481dce={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':_0xd46e('0x61')};var _0x2dacb4=function(_0x2f9fcb){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),_0xd46e('0x64'),_0xd46e('0x65'),_0xd46e('0x66')],_0x2f9fcb);};var _0x1aaa99=function(_0x272514){if(!_0x272514||!_0x272514[_0xd46e('0x67')][_0xd46e('0x3d')]){return'';}for(var _0x476f09='(',_0x5067b7=0x0;_0x5067b7<_0x272514[_0xd46e('0x67')][_0xd46e('0x3d')];_0x5067b7+=0x1){_0x5067b7>0x0&&(_0x476f09+='\x20'+_0x272514[_0xd46e('0x68')]+'\x20');_0x476f09+=_0x272514['rules'][_0x5067b7][_0xd46e('0x69')]?_0x1aaa99(_0x272514[_0xd46e('0x67')][_0x5067b7]['group']):_0x272514[_0xd46e('0x67')][_0x5067b7][_0xd46e('0x6a')]+'\x20'+_0x272514[_0xd46e('0x67')][_0x5067b7]['condition']+(_0x2dacb4(_0x272514[_0xd46e('0x67')][_0x5067b7][_0xd46e('0x6b')])?'\x20'+_0x272514[_0xd46e('0x67')][_0x5067b7]['value']:'');}return _0x476f09+')';};var _0xe5f8cd={'where':{'id':_0x47a86c[_0xd46e('0x4b')]['id']}},_0x516e7d,_0x32eed0,_0x148187,_0x35db1b,_0x4f3ba0;_0xe5f8cd=_[_0xd46e('0x45')]({},_0xe5f8cd,_0x47a86c[_0xd46e('0x46')]);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0xe5f8cd)[_0xd46e('0x27')](function(_0x16f906){if(_0x16f906){_0x516e7d=_0x16f906;return _0x16f906[_0xd46e('0x6c')]();}return null;})[_0xd46e('0x27')](function(_0x3e55a3){if(_0x3e55a3){if(!_0x3e55a3[_0xd46e('0x3d')]){throw new db[(_0xd46e('0x6d'))][(_0xd46e('0x6e'))](_0xd46e('0x6f'),0x193);}_0x32eed0=_0x3e55a3;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xd46e('0x27')](function(_0x3e0ed5){if(_0x3e0ed5){_0x148187=_[_0xd46e('0x70')](_0x3e0ed5,'id');var _0x2fff69;var _0x249938=squel['select']();_0x249938[_0xd46e('0x71')](_0x516e7d[_0xd46e('0x72')]);for(var _0xfb4073=0x0;_0xfb4073<_0x32eed0[_0xd46e('0x3d')];_0xfb4073+=0x1){_0x2fff69=_0x32eed0[_0xfb4073]['MetricId']?_0x148187[_0x32eed0[_0xfb4073][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x32eed0[_0xfb4073]['field'];_0x2fff69=_0x32eed0[_0xfb4073][_0xd46e('0x75')]?_[_0xd46e('0x76')](_0xaf9641[_0x32eed0[_0xfb4073]['function']],'%s',_0x2fff69):_0x2fff69;_0x2fff69=_0x32eed0[_0xfb4073][_0xd46e('0x77')]?_[_0xd46e('0x76')](_0x481dce[_0x32eed0[_0xfb4073]['format']],'%s',_0x2fff69):_0x2fff69;if(_0x32eed0[_0xfb4073][_0xd46e('0x78')]){_0x249938['group'](_0x2fff69);}_0x32eed0[_0xfb4073][_0xd46e('0x79')]&&_0x249938[_0xd46e('0x7a')](_0x2fff69,_0x32eed0[_0xfb4073]['orderBy']==='DESC'?![]:!![]);_0x249938[_0xd46e('0x6a')](_0x2fff69,_0x32eed0[_0xfb4073][_0xd46e('0x7b')]||_0x2fff69);}if(_0x516e7d[_0xd46e('0x7c')]){_0x516e7d[_0xd46e('0x7c')]=JSON['parse'](_0x516e7d[_0xd46e('0x7c')]);for(var _0x372509=0x0;_0x372509<_0x516e7d['joins'][_0xd46e('0x3d')];_0x372509+=0x1){if(_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0xe0cd61,_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x36')])&&_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7d')]&&_0x516e7d[_0xd46e('0x7c')][_0x372509]['foreignTable']&&_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7e')]){_0x249938[_0x516e7d['joins'][_0x372509][_0xd46e('0x36')]](_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7f')],null,util[_0xd46e('0x77')](_0xd46e('0x80'),_0x516e7d[_0xd46e('0x72')],_0x516e7d['joins'][_0x372509]['parentKey'],_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7f')],_0x516e7d['joins'][_0x372509]['foreignKey']));}}}if(_0x516e7d['conditions']){_0x516e7d[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0x516e7d[_0xd46e('0x81')]);_0x249938['where'](_0x1aaa99(_0x516e7d[_0xd46e('0x81')][_0xd46e('0x69')]));}_0x4f3ba0=_0x249938[_0xd46e('0x83')]();_0x249938['limit'](_0x37a22f);_0x249938['offset'](0x0);logger['debug']('Limited\x20Query:',_0x249938[_0xd46e('0x84')]());return dbH['sequelize'][_0xd46e('0x38')](_0x249938['toString'](),{'type':dbH['sequelize'][_0xd46e('0x85')][_0xd46e('0x86')]});}})[_0xd46e('0x27')](respondWithResult(_0x3ec709,null))[_0xd46e('0x4a')](handleError(_0x3ec709,null));};function runReport(_0xf16d87,_0x99872a,_0x57a7cc){var _0x586024=_0x99872a[_0xd46e('0x2f')];var _0x383919=0xa;var _0x114f2c=[_0xd46e('0x55'),'left_join',_0xd46e('0x56'),_0xd46e('0x57')];var _0x4ca21f={'SUM':_0xd46e('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':_0xd46e('0x5c'),'GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x5ef4cc={'SEC_TO_TIME':_0xd46e('0x87'),'DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':_0xd46e('0x61')};var _0x88460a=function(_0x3a3744){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),_0xd46e('0x64'),_0xd46e('0x65'),_0xd46e('0x66')],_0x3a3744);};var _0x3c476d=function(_0x1b2a6d){if(!_0x1b2a6d||!_0x1b2a6d[_0xd46e('0x67')][_0xd46e('0x3d')]){return'';}for(var _0x441f73='(',_0x1d2738=0x0;_0x1d2738<_0x1b2a6d['rules'][_0xd46e('0x3d')];_0x1d2738+=0x1){_0x1d2738>0x0&&(_0x441f73+='\x20'+_0x1b2a6d['operator']+'\x20');_0x441f73+=_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x69')]?_0x3c476d(_0x1b2a6d['rules'][_0x1d2738][_0xd46e('0x69')]):_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6a')]+'\x20'+_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6b')]+(_0x88460a(_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6b')])?'\x20'+_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x88')]:'');}return _0x441f73+')';};var _0x3fa34d={'where':{'id':_0xf16d87['id']}},_0xc098c9,_0x5f5ba7,_0x493df5,_0x18e140,_0x459a0c;_0x3fa34d=_[_0xd46e('0x45')]({},_0x3fa34d,_0x57a7cc);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0x3fa34d)[_0xd46e('0x27')](function(_0x5b554e){if(_0x5b554e){_0xc098c9=_0x5b554e;return _0x5b554e[_0xd46e('0x6c')]();}return null;})[_0xd46e('0x27')](function(_0xa254f5){if(_0xa254f5){if(!_0xa254f5[_0xd46e('0x3d')]){throw new db[(_0xd46e('0x6d'))][(_0xd46e('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5f5ba7=_0xa254f5;return db[_0xd46e('0x89')][_0xd46e('0x49')]({'raw':!![]});}return null;})['then'](function(_0x3c8d68){if(_0x3c8d68){_0x493df5=_[_0xd46e('0x70')](_0x3c8d68,'id');var _0x9e222d;var _0x3da17e=squel[_0xd46e('0x8a')]();_0x3da17e[_0xd46e('0x71')](_0xc098c9[_0xd46e('0x72')]);for(var _0x282f71=0x0;_0x282f71<_0x5f5ba7[_0xd46e('0x3d')];_0x282f71+=0x1){_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x73')]?_0x493df5[_0x5f5ba7[_0x282f71][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x5f5ba7[_0x282f71][_0xd46e('0x6a')];_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x75')]?_['replace'](_0x4ca21f[_0x5f5ba7[_0x282f71]['function']],'%s',_0x9e222d):_0x9e222d;_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x77')]?_[_0xd46e('0x76')](_0x5ef4cc[_0x5f5ba7[_0x282f71][_0xd46e('0x77')]],'%s',_0x9e222d):_0x9e222d;if(_0x5f5ba7[_0x282f71][_0xd46e('0x78')]){_0x3da17e[_0xd46e('0x69')](_0x9e222d);}_0x5f5ba7[_0x282f71][_0xd46e('0x79')]&&_0x3da17e['order'](_0x9e222d,_0x5f5ba7[_0x282f71][_0xd46e('0x79')]===_0xd46e('0x8b')?![]:!![]);_0x3da17e[_0xd46e('0x6a')](_0x9e222d,_0x5f5ba7[_0x282f71][_0xd46e('0x7b')]||_0x9e222d);}if(_0xc098c9['joins']){_0xc098c9[_0xd46e('0x7c')]=JSON[_0xd46e('0x82')](_0xc098c9['joins']);for(var _0xdf967c=0x0;_0xdf967c<_0xc098c9['joins']['length'];_0xdf967c+=0x1){if(_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0x114f2c,_0xc098c9[_0xd46e('0x7c')][_0xdf967c]['type'])&&_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7d')]&&_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7f')]&&_0xc098c9['joins'][_0xdf967c]['foreignKey']){_0x3da17e[_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x36')]](_0xc098c9['joins'][_0xdf967c]['foreignTable'],null,util[_0xd46e('0x77')](_0xd46e('0x80'),_0xc098c9[_0xd46e('0x72')],_0xc098c9[_0xd46e('0x7c')][_0xdf967c]['parentKey'],_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x7f')],_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7e')]));}}}if(_0xc098c9[_0xd46e('0x81')]){_0xc098c9[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0xc098c9[_0xd46e('0x81')]);_0x3da17e[_0xd46e('0x41')](_0x3c476d(_0xc098c9['conditions'][_0xd46e('0x69')]));}_0x459a0c=_0x3da17e[_0xd46e('0x83')]();_0x3da17e['limit'](_0x383919);_0x3da17e['offset'](0x0);return;}})[_0xd46e('0x27')](function(){if(_0x99872a[_0xd46e('0x8c')]==='web'){return null;}var _0x5e637d=_[_0xd46e('0x45')](_0x99872a,{'name':_0x99872a[_0xd46e('0x8d')]||_0x99872a['name']||_0xc098c9[_0xd46e('0x2f')],'basename':_0x586024,'savename':util[_0xd46e('0x77')](_0xd46e('0x8e'),_0x99872a[_0xd46e('0x2f')]||_0xc098c9[_0xd46e('0x2f')],require(_0xd46e('0x8f'))['generate'](0x4),_0x99872a[_0xd46e('0x8c')]||_0xd46e('0x90')),'reportId':_0xc098c9['id'],'reportType':_0xd46e('0x91')});return db[_0xd46e('0x92')][_0xd46e('0x4d')](_0x5e637d,{'raw':!![]});})[_0xd46e('0x27')](function(_0x3311a6){if(_0xc098c9[_0xd46e('0x72')]===_0xd46e('0x93')){_0x459a0c[_0xd46e('0x41')](_0xc098c9[_0xd46e('0x72')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x99872a[_0xd46e('0x94')],_0x99872a['endDate']);}else{_0x459a0c['where'](_0xc098c9[_0xd46e('0x72')]+_0xd46e('0x95'),_0x99872a[_0xd46e('0x94')],_0x99872a[_0xd46e('0x96')]);}if(_0x3311a6){logger[_0xd46e('0x97')](_0xd46e('0x98'),_0x459a0c[_0xd46e('0x84')]());require(_0xd46e('0x99'))['fork'](path[_0xd46e('0x55')](__dirname,'../../components/export/',_0x3311a6[_0xd46e('0x8c')]),[_0x3311a6['id'],_0x459a0c[_0xd46e('0x84')](),path[_0xd46e('0x55')](__dirname,_0xd46e('0x9a'),_0x3311a6[_0xd46e('0x9b')]),_0x586024]);return _0x3311a6;}else{var _0x399918=squel[_0xd46e('0x8a')]();_0x399918[_0xd46e('0x71')]('('+_0x459a0c['toString']()+')',_0xd46e('0x9c'));_0x399918[_0xd46e('0x6a')](_0xd46e('0x9d'),'count');_0x459a0c[_0xd46e('0x1f')](_0x99872a[_0xd46e('0x1f')]||_0x383919);_0x459a0c[_0xd46e('0x1d')](_0x99872a['offset']||0x0);return dbH[_0xd46e('0x9e')][_0xd46e('0x38')](_0x399918[_0xd46e('0x84')](),{'type':dbH[_0xd46e('0x9e')][_0xd46e('0x85')][_0xd46e('0x86')]})['then'](function(_0x4967ff){if(!_0x4967ff[_0xd46e('0x3d')]){_0x18e140=0x0;}else{_0x18e140=_0x4967ff[0x0][_0xd46e('0x20')]||0x0;}return dbH['sequelize'][_0xd46e('0x38')](_0x459a0c[_0xd46e('0x84')](),{'type':dbH[_0xd46e('0x9e')][_0xd46e('0x85')][_0xd46e('0x86')]});})[_0xd46e('0x27')](function(_0x4bb76b){return{'rows':_0x4bb76b||[],'count':_0x18e140};});}});}exports['run']=function(_0x204a9f,_0x52ca5a){return runReport(_0x204a9f[_0xd46e('0x4b')],_0x204a9f[_0xd46e('0x38')],_0x204a9f['options'])[_0xd46e('0x27')](respondWithResult(_0x52ca5a,null))[_0xd46e('0x4a')](handleError(_0x52ca5a,null));};exports[_0xd46e('0x9f')]=runReport;exports[_0xd46e('0x38')]=function(_0x786ae,_0x537c73){var _0x1610bd=0xa;var _0x20cc4c=[_0xd46e('0x55'),_0xd46e('0xa0'),_0xd46e('0x56'),_0xd46e('0x57')];var _0x368742={'SUM':_0xd46e('0x58'),'COUNT':_0xd46e('0xa1'),'COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':_0xd46e('0xa2'),'AVG':_0xd46e('0xa3'),'GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x285cf8={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xc87da2=function(_0x195f02){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),'IS\x20NOT\x20NULL',_0xd46e('0x65'),_0xd46e('0x66')],_0x195f02);};var _0x44322f=function(_0x49959f){if(!_0x49959f||!_0x49959f['rules'][_0xd46e('0x3d')]){return'';}for(var _0x2094e5='(',_0x85aac1=0x0;_0x85aac1<_0x49959f[_0xd46e('0x67')][_0xd46e('0x3d')];_0x85aac1+=0x1){_0x85aac1>0x0&&(_0x2094e5+='\x20'+_0x49959f[_0xd46e('0x68')]+'\x20');_0x2094e5+=_0x49959f['rules'][_0x85aac1][_0xd46e('0x69')]?_0x44322f(_0x49959f['rules'][_0x85aac1][_0xd46e('0x69')]):_0x49959f['rules'][_0x85aac1][_0xd46e('0x6a')]+'\x20'+_0x49959f['rules'][_0x85aac1]['condition']+(_0xc87da2(_0x49959f[_0xd46e('0x67')][_0x85aac1][_0xd46e('0x6b')])?'\x20'+_0x49959f[_0xd46e('0x67')][_0x85aac1][_0xd46e('0x88')]:'');}return _0x2094e5+')';};var _0x101a29={'where':{'id':_0x786ae[_0xd46e('0x4b')]['id']}},_0x3a44da,_0x417068,_0x52e73e,_0x206077,_0xe729b6;_0x101a29=_[_0xd46e('0x45')]({},_0x101a29,_0x786ae[_0xd46e('0x46')]);return db['AnalyticDefaultReport'][_0xd46e('0x4c')](_0x101a29)[_0xd46e('0x27')](function(_0x1d08bb){if(_0x1d08bb){_0x3a44da=_0x1d08bb;return _0x1d08bb['getFields']();}return null;})[_0xd46e('0x27')](function(_0x8c6ed1){if(_0x8c6ed1){if(!_0x8c6ed1['length']){throw new db['Sequelize']['ValidationErrorItem'](_0xd46e('0x6f'),0x193);}_0x417068=_0x8c6ed1;return db[_0xd46e('0x89')]['findAll']({'raw':!![]});}return null;})[_0xd46e('0x27')](function(_0x3a13f8){if(_0x3a13f8){_0x52e73e=_['keyBy'](_0x3a13f8,'id');var _0x5a8661;var _0x157fb0=squel[_0xd46e('0x8a')]();_0x157fb0[_0xd46e('0x71')](_0x3a44da[_0xd46e('0x72')]);for(var _0x50750f=0x0;_0x50750f<_0x417068['length'];_0x50750f+=0x1){_0x5a8661=_0x417068[_0x50750f][_0xd46e('0x73')]?_0x52e73e[_0x417068[_0x50750f][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x417068[_0x50750f][_0xd46e('0x6a')];_0x5a8661=_0x417068[_0x50750f][_0xd46e('0x75')]?_[_0xd46e('0x76')](_0x368742[_0x417068[_0x50750f][_0xd46e('0x75')]],'%s',_0x5a8661):_0x5a8661;_0x5a8661=_0x417068[_0x50750f]['format']?_[_0xd46e('0x76')](_0x285cf8[_0x417068[_0x50750f][_0xd46e('0x77')]],'%s',_0x5a8661):_0x5a8661;if(_0x417068[_0x50750f]['groupBy']){_0x157fb0[_0xd46e('0x69')](_0x5a8661);}_0x417068[_0x50750f][_0xd46e('0x79')]&&_0x157fb0[_0xd46e('0x7a')](_0x5a8661,_0x417068[_0x50750f][_0xd46e('0x79')]===_0xd46e('0x8b')?![]:!![]);_0x157fb0[_0xd46e('0x6a')](_0x5a8661,_0x417068[_0x50750f][_0xd46e('0x7b')]||_0x5a8661);}if(_0x3a44da[_0xd46e('0x7c')]){_0x3a44da['joins']=JSON[_0xd46e('0x82')](_0x3a44da[_0xd46e('0x7c')]);for(var _0x3c819b=0x0;_0x3c819b<_0x3a44da[_0xd46e('0x7c')][_0xd46e('0x3d')];_0x3c819b+=0x1){if(_0x3a44da['joins'][_0x3c819b][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0x20cc4c,_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x36')])&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7d')]&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')]&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b]['foreignKey']){_0x157fb0[_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x36')]](_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3a44da[_0xd46e('0x72')],_0x3a44da['joins'][_0x3c819b][_0xd46e('0x7d')],_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')],_0x3a44da[_0xd46e('0x7c')][_0x3c819b]['foreignKey']));}}}if(_0x3a44da[_0xd46e('0x81')]){_0x3a44da[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0x3a44da[_0xd46e('0x81')]);_0x157fb0[_0xd46e('0x41')](_0x44322f(_0x3a44da[_0xd46e('0x81')][_0xd46e('0x69')]));}_0xe729b6=_0x157fb0[_0xd46e('0x83')]();_0x157fb0[_0xd46e('0x1f')](_0x1610bd);_0x157fb0['offset'](0x0);logger['debug'](_0xd46e('0xa4'),_0x157fb0['toString']());return dbH[_0xd46e('0x9e')][_0xd46e('0x38')](_0x157fb0[_0xd46e('0x84')](),{'type':dbH['sequelize'][_0xd46e('0x85')][_0xd46e('0x86')]});}})[_0xd46e('0x27')](function(){return{'sql':_0xe729b6['toString']()};})['then'](respondWithResult(_0x537c73,null))[_0xd46e('0x4a')](handleError(_0x537c73,null));}; \ No newline at end of file +var _0xc4aa=['Content-Range','apply','reject','save','update','then','destroy','get','DefaultReports','UserProfileResource','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','AnalyticDefaultReport','findAll','rows','catch','show','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(%s)','MAX(%s)','AVG(%s)','SEC_TO_TIME(%s)','IS\x20NOT\x20EMPTY','value','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','groupBy','alias','includes','foreignKey','output','web','fullPath','%s-%s.%s','randomstring','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','child_process','fork','countTable','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20NULL','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x4664db,_0x1de672){var _0x5615b4=function(_0x54fb5a){while(--_0x54fb5a){_0x4664db['push'](_0x4664db['shift']());}};_0x5615b4(++_0x1de672);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xc4aa[_0x2070da];return _0x4f9fe1;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];var dbH=require(_0xac4a('0x16'))['dbH'];function respondWithStatusCode(_0x21a79,_0x68424a){_0x68424a=_0x68424a||0xcc;return function(_0x247b78){if(_0x247b78){return _0x21a79[_0xac4a('0x17')](_0x68424a);}return _0x21a79[_0xac4a('0x18')](_0x68424a)[_0xac4a('0x19')]();};}function respondWithResult(_0x34bc01,_0x33c287){_0x33c287=_0x33c287||0xc8;return function(_0x190418){if(_0x190418){return _0x34bc01[_0xac4a('0x18')](_0x33c287)[_0xac4a('0x1a')](_0x190418);}};}function respondWithFilteredResult(_0x26dbb8,_0x4a2119){return function(_0x402fff){if(_0x402fff){var _0x34d797=typeof _0x4a2119[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x4a2119[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x28e304=_0x402fff[_0xac4a('0x1e')];var _0x546c5d=_0x34d797?0x0:_0x4a2119['offset'];var _0x21a729=_0x34d797?_0x402fff[_0xac4a('0x1e')]:_0x4a2119[_0xac4a('0x1b')]+_0x4a2119['limit'];var _0x39e83e;if(_0x21a729>=_0x28e304){_0x21a729=_0x28e304;_0x39e83e=0xc8;}else{_0x39e83e=0xce;}_0x26dbb8[_0xac4a('0x18')](_0x39e83e);return _0x26dbb8[_0xac4a('0x1f')](_0xac4a('0x20'),_0x546c5d+'-'+_0x21a729+'/'+_0x28e304)[_0xac4a('0x1a')](_0x402fff);}return null;};}function patchUpdates(_0x3e829c){return function(_0xe38996){try{jsonpatch[_0xac4a('0x21')](_0xe38996,_0x3e829c,!![]);}catch(_0x534092){return BPromise[_0xac4a('0x22')](_0x534092);}return _0xe38996[_0xac4a('0x23')]();};}function saveUpdates(_0x599787,_0x3d7ce0){return function(_0x4169c0){if(_0x4169c0){return _0x4169c0[_0xac4a('0x24')](_0x599787)[_0xac4a('0x25')](function(_0x4d2d6c){return _0x4d2d6c;});}return null;};}function removeEntity(_0x1b7998,_0x2503d8){return function(_0x15435c){if(_0x15435c){return _0x15435c[_0xac4a('0x26')]()[_0xac4a('0x25')](function(){var _0x2b0dc2=_0x15435c[_0xac4a('0x27')]({'plain':!![]});var _0x36054a=_0xac4a('0x28');return db[_0xac4a('0x29')][_0xac4a('0x26')]({'where':{'type':_0x36054a,'resourceId':_0x2b0dc2['id']}})[_0xac4a('0x25')](function(){return _0x15435c;});})[_0xac4a('0x25')](function(){_0x1b7998[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x20202c,_0x4e17ce){return function(_0x23b061){if(!_0x23b061){_0x20202c[_0xac4a('0x17')](0x194);}return _0x23b061;};}function handleError(_0x42a33c,_0x2772fe){_0x2772fe=_0x2772fe||0x1f4;return function(_0x116700){logger['error'](_0x116700['stack']);if(_0x116700[_0xac4a('0x2a')]){delete _0x116700[_0xac4a('0x2a')];}_0x42a33c[_0xac4a('0x18')](_0x2772fe)['send'](_0x116700);};}exports['index']=function(_0x355755,_0x2896bc){var _0x228629={},_0x432066={},_0x17118e={'count':0x0,'rows':[]};var _0x53d3a5=_[_0xac4a('0x2b')](db['AnalyticDefaultReport'][_0xac4a('0x2c')],function(_0x57adcf){return{'name':_0x57adcf[_0xac4a('0x2d')],'type':_0x57adcf[_0xac4a('0x2e')][_0xac4a('0x2f')]};});_0x432066[_0xac4a('0x30')]=_[_0xac4a('0x2b')](_0x53d3a5,_0xac4a('0x2a'));_0x432066[_0xac4a('0x31')]=_[_0xac4a('0x32')](_0x355755[_0xac4a('0x31')]);_0x432066[_0xac4a('0x33')]=_[_0xac4a('0x34')](_0x432066[_0xac4a('0x30')],_0x432066[_0xac4a('0x31')]);_0x228629[_0xac4a('0x35')]=_['intersection'](_0x432066[_0xac4a('0x30')],qs[_0xac4a('0x36')](_0x355755['query'][_0xac4a('0x36')]));_0x228629[_0xac4a('0x35')]=_0x228629['attributes']['length']?_0x228629[_0xac4a('0x35')]:_0x432066[_0xac4a('0x30')];if(!_0x355755[_0xac4a('0x31')][_0xac4a('0x37')]('nolimit')){_0x228629[_0xac4a('0x1d')]=qs[_0xac4a('0x1d')](_0x355755['query'][_0xac4a('0x1d')]);_0x228629[_0xac4a('0x1b')]=qs[_0xac4a('0x1b')](_0x355755['query'][_0xac4a('0x1b')]);}_0x228629[_0xac4a('0x38')]=qs[_0xac4a('0x39')](_0x355755['query'][_0xac4a('0x39')]);_0x228629[_0xac4a('0x3a')]=qs['filters'](_['pick'](_0x355755[_0xac4a('0x31')],_0x432066['filters']),_0x53d3a5);if(_0x355755['query']['filter']){_0x228629['where']=_[_0xac4a('0x3b')](_0x228629[_0xac4a('0x3a')],{'$or':_[_0xac4a('0x2b')](_0x53d3a5,function(_0x472484){if(_0x472484[_0xac4a('0x2e')]!==_0xac4a('0x3c')){var _0x4220e2={};_0x4220e2[_0x472484[_0xac4a('0x2a')]]={'$like':'%'+_0x355755[_0xac4a('0x31')][_0xac4a('0x3d')]+'%'};return _0x4220e2;}})});}_0x228629=_[_0xac4a('0x3b')]({},_0x228629,_0x355755[_0xac4a('0x3e')]);var _0x4e4994={'where':_0x228629['where']};return db['AnalyticDefaultReport'][_0xac4a('0x1e')](_0x4e4994)[_0xac4a('0x25')](function(_0x14e80b){_0x17118e[_0xac4a('0x1e')]=_0x14e80b;if(_0x355755[_0xac4a('0x31')][_0xac4a('0x3f')]){_0x228629[_0xac4a('0x40')]=[{'all':!![]}];}return db[_0xac4a('0x41')][_0xac4a('0x42')](_0x228629);})[_0xac4a('0x25')](function(_0x561cb7){_0x17118e[_0xac4a('0x43')]=_0x561cb7;return _0x17118e;})[_0xac4a('0x25')](respondWithFilteredResult(_0x2896bc,_0x228629))[_0xac4a('0x44')](handleError(_0x2896bc,null));};exports[_0xac4a('0x45')]=function(_0x1a96cf,_0x57b879){var _0x8700b4={'raw':!![],'where':{'id':_0x1a96cf['params']['id']}},_0x1b77bb={};_0x1b77bb[_0xac4a('0x30')]=_['keys'](db[_0xac4a('0x41')][_0xac4a('0x2c')]);_0x1b77bb[_0xac4a('0x31')]=_[_0xac4a('0x32')](_0x1a96cf[_0xac4a('0x31')]);_0x1b77bb[_0xac4a('0x33')]=_[_0xac4a('0x34')](_0x1b77bb[_0xac4a('0x30')],_0x1b77bb[_0xac4a('0x31')]);_0x8700b4[_0xac4a('0x35')]=_[_0xac4a('0x34')](_0x1b77bb[_0xac4a('0x30')],qs['fields'](_0x1a96cf[_0xac4a('0x31')][_0xac4a('0x36')]));_0x8700b4[_0xac4a('0x35')]=_0x8700b4['attributes'][_0xac4a('0x46')]?_0x8700b4[_0xac4a('0x35')]:_0x1b77bb['model'];if(_0x1a96cf[_0xac4a('0x31')]['includeAll']){_0x8700b4[_0xac4a('0x40')]=[{'all':!![]}];}_0x8700b4=_[_0xac4a('0x3b')]({},_0x8700b4,_0x1a96cf[_0xac4a('0x3e')]);return db['AnalyticDefaultReport']['find'](_0x8700b4)[_0xac4a('0x25')](handleEntityNotFound(_0x57b879,null))['then'](respondWithResult(_0x57b879,null))[_0xac4a('0x44')](handleError(_0x57b879,null));};exports['create']=function(_0x3d2aaf,_0x530bbb){return db[_0xac4a('0x41')][_0xac4a('0x47')](_0x3d2aaf[_0xac4a('0x48')],{})[_0xac4a('0x25')](function(_0x54782f){var _0x31c794=_0x3d2aaf[_0xac4a('0x49')][_0xac4a('0x27')]({'plain':!![]});if(!_0x31c794)throw new Error(_0xac4a('0x4a'));if(_0x31c794[_0xac4a('0x4b')]===_0xac4a('0x49')){var _0x187306=_0x54782f['get']({'plain':!![]});var _0x35dee5=_0xac4a('0x4c');return db['UserProfileSection'][_0xac4a('0x4d')]({'where':{'name':_0x35dee5,'userProfileId':_0x31c794[_0xac4a('0x4e')]},'raw':!![]})[_0xac4a('0x25')](function(_0x3ac36e){if(_0x3ac36e&&_0x3ac36e['autoAssociation']===0x0){return db[_0xac4a('0x29')][_0xac4a('0x47')]({'name':_0x187306[_0xac4a('0x2a')],'resourceId':_0x187306['id'],'type':_0xac4a('0x28'),'sectionId':_0x3ac36e['id']},{})[_0xac4a('0x25')](function(){return _0x54782f;});}else{return _0x54782f;}})['catch'](function(_0x179373){logger['error'](_0xac4a('0x4f'),_0x179373);throw _0x179373;});}return _0x54782f;})[_0xac4a('0x25')](respondWithResult(_0x530bbb,0xc9))['catch'](handleError(_0x530bbb,null));};exports['update']=function(_0x437466,_0x70fdc3){if(_0x437466['body']['id']){delete _0x437466[_0xac4a('0x48')]['id'];}return db[_0xac4a('0x41')][_0xac4a('0x4d')]({'where':{'id':_0x437466[_0xac4a('0x50')]['id']}})['then'](handleEntityNotFound(_0x70fdc3,null))[_0xac4a('0x25')](saveUpdates(_0x437466[_0xac4a('0x48')],null))[_0xac4a('0x25')](respondWithResult(_0x70fdc3,null))[_0xac4a('0x44')](handleError(_0x70fdc3,null));};exports[_0xac4a('0x26')]=function(_0x411547,_0x36179a){return db['AnalyticDefaultReport'][_0xac4a('0x4d')]({'where':{'id':_0x411547[_0xac4a('0x50')]['id']}})[_0xac4a('0x25')](handleEntityNotFound(_0x36179a,null))[_0xac4a('0x25')](removeEntity(_0x36179a,null))[_0xac4a('0x44')](handleError(_0x36179a,null));};exports[_0xac4a('0x51')]=function(_0x213df2,_0x236f57){var _0x159e43=0xa;var _0x786d9=[_0xac4a('0x52'),_0xac4a('0x53'),_0xac4a('0x54'),_0xac4a('0x55')];var _0x5222f3={'SUM':_0xac4a('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xac4a('0x57'),'MAX':'MAX(%s)','MIN':_0xac4a('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xac4a('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xac4a('0x5a')};var _0x5cac9b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xac4a('0x5b'),'HOUR':_0xac4a('0x5c'),'ROUND':_0xac4a('0x5d'),'UNIX_TIMESTAMP':_0xac4a('0x5e')};var _0x2f9940=function(_0xb7b884){return!_['includes']([_0xac4a('0x5f'),'IS\x20NOT\x20NULL',_0xac4a('0x60'),'IS\x20NOT\x20EMPTY'],_0xb7b884);};var _0x347880=function(_0x19ce2c){if(!_0x19ce2c||!_0x19ce2c[_0xac4a('0x61')][_0xac4a('0x46')]){return'';}for(var _0x429273='(',_0x2bc39a=0x0;_0x2bc39a<_0x19ce2c[_0xac4a('0x61')][_0xac4a('0x46')];_0x2bc39a+=0x1){_0x2bc39a>0x0&&(_0x429273+='\x20'+_0x19ce2c[_0xac4a('0x62')]+'\x20');_0x429273+=_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x63')]?_0x347880(_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x63')]):_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x64')]+'\x20'+_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x65')]+(_0x2f9940(_0x19ce2c['rules'][_0x2bc39a][_0xac4a('0x65')])?'\x20'+_0x19ce2c[_0xac4a('0x61')][_0x2bc39a]['value']:'');}return _0x429273+')';};var _0x3c3576={'where':{'id':_0x213df2['params']['id']}},_0x34bd1c,_0x2d24c7,_0x2b8562,_0x357cac,_0x4d1440;_0x3c3576=_[_0xac4a('0x3b')]({},_0x3c3576,_0x213df2[_0xac4a('0x3e')]);return db[_0xac4a('0x41')][_0xac4a('0x4d')](_0x3c3576)[_0xac4a('0x25')](function(_0x21ef8b){if(_0x21ef8b){_0x34bd1c=_0x21ef8b;return _0x21ef8b[_0xac4a('0x66')]();}return null;})[_0xac4a('0x25')](function(_0x44c60b){if(_0x44c60b){if(!_0x44c60b[_0xac4a('0x46')]){throw new db[(_0xac4a('0x67'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2d24c7=_0x44c60b;return db[_0xac4a('0x68')][_0xac4a('0x42')]({'raw':!![]});}return null;})[_0xac4a('0x25')](function(_0x423f70){if(_0x423f70){_0x2b8562=_[_0xac4a('0x69')](_0x423f70,'id');var _0x283107;var _0x1d24bb=squel[_0xac4a('0x6a')]();_0x1d24bb[_0xac4a('0x6b')](_0x34bd1c[_0xac4a('0x6c')]);for(var _0xb09b89=0x0;_0xb09b89<_0x2d24c7[_0xac4a('0x46')];_0xb09b89+=0x1){_0x283107=_0x2d24c7[_0xb09b89]['MetricId']?_0x2b8562[_0x2d24c7[_0xb09b89][_0xac4a('0x6d')]][_0xac4a('0x6e')]:_0x2d24c7[_0xb09b89][_0xac4a('0x64')];_0x283107=_0x2d24c7[_0xb09b89][_0xac4a('0x6f')]?_['replace'](_0x5222f3[_0x2d24c7[_0xb09b89][_0xac4a('0x6f')]],'%s',_0x283107):_0x283107;_0x283107=_0x2d24c7[_0xb09b89]['format']?_[_0xac4a('0x70')](_0x5cac9b[_0x2d24c7[_0xb09b89][_0xac4a('0x71')]],'%s',_0x283107):_0x283107;if(_0x2d24c7[_0xb09b89]['groupBy']){_0x1d24bb['group'](_0x283107);}_0x2d24c7[_0xb09b89][_0xac4a('0x72')]&&_0x1d24bb[_0xac4a('0x38')](_0x283107,_0x2d24c7[_0xb09b89][_0xac4a('0x72')]==='DESC'?![]:!![]);_0x1d24bb[_0xac4a('0x64')](_0x283107,_0x2d24c7[_0xb09b89]['alias']||_0x283107);}if(_0x34bd1c[_0xac4a('0x73')]){_0x34bd1c['joins']=JSON['parse'](_0x34bd1c[_0xac4a('0x73')]);for(var _0x56ef2a=0x0;_0x56ef2a<_0x34bd1c[_0xac4a('0x73')]['length'];_0x56ef2a+=0x1){if(_0x34bd1c[_0xac4a('0x73')][_0x56ef2a][_0xac4a('0x2e')]&&_['includes'](_0x786d9,_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['type'])&&_0x34bd1c[_0xac4a('0x73')][_0x56ef2a][_0xac4a('0x74')]&&_0x34bd1c['joins'][_0x56ef2a][_0xac4a('0x75')]&&_0x34bd1c['joins'][_0x56ef2a]['foreignKey']){_0x1d24bb[_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['type']](_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['foreignTable'],null,util['format'](_0xac4a('0x76'),_0x34bd1c[_0xac4a('0x6c')],_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['parentKey'],_0x34bd1c['joins'][_0x56ef2a][_0xac4a('0x75')],_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['foreignKey']));}}}if(_0x34bd1c['conditions']){_0x34bd1c[_0xac4a('0x77')]=JSON[_0xac4a('0x78')](_0x34bd1c[_0xac4a('0x77')]);_0x1d24bb[_0xac4a('0x3a')](_0x347880(_0x34bd1c[_0xac4a('0x77')][_0xac4a('0x63')]));}_0x4d1440=_0x1d24bb[_0xac4a('0x79')]();_0x1d24bb[_0xac4a('0x1d')](_0x159e43);_0x1d24bb[_0xac4a('0x1b')](0x0);logger['debug'](_0xac4a('0x7a'),_0x1d24bb[_0xac4a('0x7b')]());return dbH[_0xac4a('0x7c')]['query'](_0x1d24bb[_0xac4a('0x7b')](),{'type':dbH[_0xac4a('0x7c')][_0xac4a('0x7d')][_0xac4a('0x7e')]});}})[_0xac4a('0x25')](respondWithResult(_0x236f57,null))['catch'](handleError(_0x236f57,null));};function runReport(_0x290a73,_0x19ce24,_0xc9d040){var _0x37e519=_0x19ce24[_0xac4a('0x2a')];var _0x451248=0xa;var _0xd7bdd6=['join',_0xac4a('0x53'),_0xac4a('0x54'),_0xac4a('0x55')];var _0x35a97c={'SUM':_0xac4a('0x56'),'COUNT':_0xac4a('0x7f'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xac4a('0x80'),'MIN':_0xac4a('0x58'),'AVG':_0xac4a('0x81'),'GROUP_CONCAT':_0xac4a('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xac4a('0x5a')};var _0x56a934={'SEC_TO_TIME':_0xac4a('0x82'),'DATE':_0xac4a('0x5b'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xac4a('0x5e')};var _0x212a22=function(_0x1fe86a){return!_['includes']([_0xac4a('0x5f'),'IS\x20NOT\x20NULL',_0xac4a('0x60'),_0xac4a('0x83')],_0x1fe86a);};var _0x406b64=function(_0x35328e){if(!_0x35328e||!_0x35328e[_0xac4a('0x61')]['length']){return'';}for(var _0x50f471='(',_0x31cda0=0x0;_0x31cda0<_0x35328e[_0xac4a('0x61')][_0xac4a('0x46')];_0x31cda0+=0x1){_0x31cda0>0x0&&(_0x50f471+='\x20'+_0x35328e[_0xac4a('0x62')]+'\x20');_0x50f471+=_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x63')]?_0x406b64(_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x63')]):_0x35328e['rules'][_0x31cda0]['field']+'\x20'+_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x65')]+(_0x212a22(_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x65')])?'\x20'+_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x84')]:'');}return _0x50f471+')';};var _0xdaa2ef={'where':{'id':_0x290a73['id']}},_0x2e704b,_0x540d8e,_0x5e0be4,_0x32fd0c,_0x168f30;_0xdaa2ef=_[_0xac4a('0x3b')]({},_0xdaa2ef,_0xc9d040);return db[_0xac4a('0x41')][_0xac4a('0x4d')](_0xdaa2ef)[_0xac4a('0x25')](function(_0x338af3){if(_0x338af3){_0x2e704b=_0x338af3;return _0x338af3['getFields']();}return null;})[_0xac4a('0x25')](function(_0x1bacf2){if(_0x1bacf2){if(!_0x1bacf2[_0xac4a('0x46')]){throw new db['Sequelize'][(_0xac4a('0x85'))](_0xac4a('0x86'),0x193);}_0x540d8e=_0x1bacf2;return db[_0xac4a('0x68')][_0xac4a('0x42')]({'raw':!![]});}return null;})[_0xac4a('0x25')](function(_0x27d023){if(_0x27d023){_0x5e0be4=_[_0xac4a('0x69')](_0x27d023,'id');var _0x2ef42a;var _0x322465=squel['select']();_0x322465[_0xac4a('0x6b')](_0x2e704b['table']);for(var _0x203321=0x0;_0x203321<_0x540d8e[_0xac4a('0x46')];_0x203321+=0x1){_0x2ef42a=_0x540d8e[_0x203321][_0xac4a('0x6d')]?_0x5e0be4[_0x540d8e[_0x203321][_0xac4a('0x6d')]][_0xac4a('0x6e')]:_0x540d8e[_0x203321][_0xac4a('0x64')];_0x2ef42a=_0x540d8e[_0x203321][_0xac4a('0x6f')]?_['replace'](_0x35a97c[_0x540d8e[_0x203321][_0xac4a('0x6f')]],'%s',_0x2ef42a):_0x2ef42a;_0x2ef42a=_0x540d8e[_0x203321][_0xac4a('0x71')]?_[_0xac4a('0x70')](_0x56a934[_0x540d8e[_0x203321][_0xac4a('0x71')]],'%s',_0x2ef42a):_0x2ef42a;if(_0x540d8e[_0x203321][_0xac4a('0x87')]){_0x322465['group'](_0x2ef42a);}_0x540d8e[_0x203321][_0xac4a('0x72')]&&_0x322465[_0xac4a('0x38')](_0x2ef42a,_0x540d8e[_0x203321]['orderBy']==='DESC'?![]:!![]);_0x322465[_0xac4a('0x64')](_0x2ef42a,_0x540d8e[_0x203321][_0xac4a('0x88')]||_0x2ef42a);}if(_0x2e704b['joins']){_0x2e704b[_0xac4a('0x73')]=JSON[_0xac4a('0x78')](_0x2e704b[_0xac4a('0x73')]);for(var _0x37657e=0x0;_0x37657e<_0x2e704b[_0xac4a('0x73')][_0xac4a('0x46')];_0x37657e+=0x1){if(_0x2e704b['joins'][_0x37657e][_0xac4a('0x2e')]&&_[_0xac4a('0x89')](_0xd7bdd6,_0x2e704b[_0xac4a('0x73')][_0x37657e]['type'])&&_0x2e704b[_0xac4a('0x73')][_0x37657e][_0xac4a('0x74')]&&_0x2e704b[_0xac4a('0x73')][_0x37657e][_0xac4a('0x75')]&&_0x2e704b[_0xac4a('0x73')][_0x37657e][_0xac4a('0x8a')]){_0x322465[_0x2e704b['joins'][_0x37657e][_0xac4a('0x2e')]](_0x2e704b[_0xac4a('0x73')][_0x37657e]['foreignTable'],null,util[_0xac4a('0x71')]('%s.%s\x20=\x20%s.%s',_0x2e704b[_0xac4a('0x6c')],_0x2e704b[_0xac4a('0x73')][_0x37657e]['parentKey'],_0x2e704b[_0xac4a('0x73')][_0x37657e]['foreignTable'],_0x2e704b[_0xac4a('0x73')][_0x37657e]['foreignKey']));}}}if(_0x2e704b[_0xac4a('0x77')]){_0x2e704b[_0xac4a('0x77')]=JSON[_0xac4a('0x78')](_0x2e704b[_0xac4a('0x77')]);_0x322465[_0xac4a('0x3a')](_0x406b64(_0x2e704b[_0xac4a('0x77')][_0xac4a('0x63')]));}_0x168f30=_0x322465[_0xac4a('0x79')]();_0x322465[_0xac4a('0x1d')](_0x451248);_0x322465[_0xac4a('0x1b')](0x0);return;}})[_0xac4a('0x25')](function(){if(_0x19ce24[_0xac4a('0x8b')]===_0xac4a('0x8c')){return null;}var _0x4217df=_['merge'](_0x19ce24,{'name':_0x19ce24[_0xac4a('0x8d')]||_0x19ce24[_0xac4a('0x2a')]||_0x2e704b['name'],'basename':_0x37e519,'savename':util[_0xac4a('0x71')](_0xac4a('0x8e'),_0x19ce24[_0xac4a('0x2a')]||_0x2e704b[_0xac4a('0x2a')],require(_0xac4a('0x8f'))['generate'](0x4),_0x19ce24[_0xac4a('0x8b')]||'csv'),'reportId':_0x2e704b['id'],'reportType':_0xac4a('0x90')});return db[_0xac4a('0x91')][_0xac4a('0x47')](_0x4217df,{'raw':!![]});})[_0xac4a('0x25')](function(_0x53f23d){if(_0x2e704b[_0xac4a('0x6c')]==='cdr'){_0x168f30[_0xac4a('0x3a')](_0x2e704b[_0xac4a('0x6c')]+_0xac4a('0x92'),_0x19ce24['startDate'],_0x19ce24[_0xac4a('0x93')]);}else{_0x168f30[_0xac4a('0x3a')](_0x2e704b[_0xac4a('0x6c')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x19ce24[_0xac4a('0x94')],_0x19ce24[_0xac4a('0x93')]);}if(_0x53f23d){logger[_0xac4a('0x95')](_0xac4a('0x96'),_0x168f30[_0xac4a('0x7b')]());require(_0xac4a('0x97'))[_0xac4a('0x98')](path[_0xac4a('0x52')](__dirname,'../../components/export/',_0x53f23d[_0xac4a('0x8b')]),[_0x53f23d['id'],_0x168f30['toString'](),path['join'](__dirname,'../../files/reports',_0x53f23d['savename']),_0x37e519]);return _0x53f23d;}else{var _0x502275=squel[_0xac4a('0x6a')]();_0x502275[_0xac4a('0x6b')]('('+_0x168f30[_0xac4a('0x7b')]()+')',_0xac4a('0x99'));_0x502275[_0xac4a('0x64')]('COUNT(*)',_0xac4a('0x1e'));_0x168f30[_0xac4a('0x1d')](_0x19ce24[_0xac4a('0x1d')]||_0x451248);_0x168f30[_0xac4a('0x1b')](_0x19ce24[_0xac4a('0x1b')]||0x0);return dbH[_0xac4a('0x7c')][_0xac4a('0x31')](_0x502275[_0xac4a('0x7b')](),{'type':dbH['sequelize'][_0xac4a('0x7d')][_0xac4a('0x7e')]})[_0xac4a('0x25')](function(_0x25331f){if(!_0x25331f[_0xac4a('0x46')]){_0x32fd0c=0x0;}else{_0x32fd0c=_0x25331f[0x0][_0xac4a('0x1e')]||0x0;}return dbH[_0xac4a('0x7c')]['query'](_0x168f30['toString'](),{'type':dbH[_0xac4a('0x7c')][_0xac4a('0x7d')]['SELECT']});})[_0xac4a('0x25')](function(_0x366f5a){return{'rows':_0x366f5a||[],'count':_0x32fd0c};});}});}exports['run']=function(_0x5bd013,_0x2fe103){return runReport(_0x5bd013[_0xac4a('0x50')],_0x5bd013[_0xac4a('0x31')],_0x5bd013[_0xac4a('0x3e')])[_0xac4a('0x25')](respondWithResult(_0x2fe103,null))['catch'](handleError(_0x2fe103,null));};exports[_0xac4a('0x9a')]=runReport;exports['query']=function(_0x4f2d85,_0x538cfd){var _0x63c30=0xa;var _0x4301c3=[_0xac4a('0x52'),_0xac4a('0x53'),_0xac4a('0x54'),_0xac4a('0x55')];var _0xcad25d={'SUM':_0xac4a('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xac4a('0x58'),'AVG':_0xac4a('0x81'),'GROUP_CONCAT':_0xac4a('0x59'),'GROUP_CONCAT ASC':_0xac4a('0x9b'),'GROUP_CONCAT DESC':_0xac4a('0x5a')};var _0xcd140e={'SEC_TO_TIME':_0xac4a('0x82'),'DATE':_0xac4a('0x5b'),'HOUR':_0xac4a('0x5c'),'ROUND':_0xac4a('0x5d'),'UNIX_TIMESTAMP':_0xac4a('0x5e')};var _0x37cb49=function(_0xe0fd57){return!_[_0xac4a('0x89')]([_0xac4a('0x5f'),_0xac4a('0x9c'),_0xac4a('0x60'),_0xac4a('0x83')],_0xe0fd57);};var _0x41cdb5=function(_0x172d03){if(!_0x172d03||!_0x172d03[_0xac4a('0x61')][_0xac4a('0x46')]){return'';}for(var _0x3e2575='(',_0x4cc581=0x0;_0x4cc581<_0x172d03[_0xac4a('0x61')][_0xac4a('0x46')];_0x4cc581+=0x1){_0x4cc581>0x0&&(_0x3e2575+='\x20'+_0x172d03[_0xac4a('0x62')]+'\x20');_0x3e2575+=_0x172d03[_0xac4a('0x61')][_0x4cc581][_0xac4a('0x63')]?_0x41cdb5(_0x172d03[_0xac4a('0x61')][_0x4cc581][_0xac4a('0x63')]):_0x172d03[_0xac4a('0x61')][_0x4cc581]['field']+'\x20'+_0x172d03['rules'][_0x4cc581][_0xac4a('0x65')]+(_0x37cb49(_0x172d03[_0xac4a('0x61')][_0x4cc581][_0xac4a('0x65')])?'\x20'+_0x172d03['rules'][_0x4cc581]['value']:'');}return _0x3e2575+')';};var _0x5de198={'where':{'id':_0x4f2d85[_0xac4a('0x50')]['id']}},_0x2b6773,_0x52df82,_0x59e82c,_0x216055,_0x52963c;_0x5de198=_['merge']({},_0x5de198,_0x4f2d85[_0xac4a('0x3e')]);return db[_0xac4a('0x41')][_0xac4a('0x4d')](_0x5de198)[_0xac4a('0x25')](function(_0x403a16){if(_0x403a16){_0x2b6773=_0x403a16;return _0x403a16[_0xac4a('0x66')]();}return null;})['then'](function(_0x25bf23){if(_0x25bf23){if(!_0x25bf23[_0xac4a('0x46')]){throw new db[(_0xac4a('0x67'))]['ValidationErrorItem'](_0xac4a('0x86'),0x193);}_0x52df82=_0x25bf23;return db[_0xac4a('0x68')][_0xac4a('0x42')]({'raw':!![]});}return null;})[_0xac4a('0x25')](function(_0x5bb911){if(_0x5bb911){_0x59e82c=_[_0xac4a('0x69')](_0x5bb911,'id');var _0x403f5a;var _0x3eae2f=squel[_0xac4a('0x6a')]();_0x3eae2f[_0xac4a('0x6b')](_0x2b6773[_0xac4a('0x6c')]);for(var _0x4a0cd9=0x0;_0x4a0cd9<_0x52df82['length'];_0x4a0cd9+=0x1){_0x403f5a=_0x52df82[_0x4a0cd9][_0xac4a('0x6d')]?_0x59e82c[_0x52df82[_0x4a0cd9][_0xac4a('0x6d')]][_0xac4a('0x6e')]:_0x52df82[_0x4a0cd9][_0xac4a('0x64')];_0x403f5a=_0x52df82[_0x4a0cd9][_0xac4a('0x6f')]?_[_0xac4a('0x70')](_0xcad25d[_0x52df82[_0x4a0cd9]['function']],'%s',_0x403f5a):_0x403f5a;_0x403f5a=_0x52df82[_0x4a0cd9][_0xac4a('0x71')]?_['replace'](_0xcd140e[_0x52df82[_0x4a0cd9][_0xac4a('0x71')]],'%s',_0x403f5a):_0x403f5a;if(_0x52df82[_0x4a0cd9]['groupBy']){_0x3eae2f[_0xac4a('0x63')](_0x403f5a);}_0x52df82[_0x4a0cd9][_0xac4a('0x72')]&&_0x3eae2f[_0xac4a('0x38')](_0x403f5a,_0x52df82[_0x4a0cd9][_0xac4a('0x72')]==='DESC'?![]:!![]);_0x3eae2f[_0xac4a('0x64')](_0x403f5a,_0x52df82[_0x4a0cd9][_0xac4a('0x88')]||_0x403f5a);}if(_0x2b6773[_0xac4a('0x73')]){_0x2b6773[_0xac4a('0x73')]=JSON[_0xac4a('0x78')](_0x2b6773['joins']);for(var _0x3dd60a=0x0;_0x3dd60a<_0x2b6773[_0xac4a('0x73')][_0xac4a('0x46')];_0x3dd60a+=0x1){if(_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x2e')]&&_['includes'](_0x4301c3,_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x2e')])&&_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x74')]&&_0x2b6773[_0xac4a('0x73')][_0x3dd60a]['foreignTable']&&_0x2b6773['joins'][_0x3dd60a]['foreignKey']){_0x3eae2f[_0x2b6773['joins'][_0x3dd60a][_0xac4a('0x2e')]](_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x75')],null,util[_0xac4a('0x71')](_0xac4a('0x76'),_0x2b6773['table'],_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x74')],_0x2b6773['joins'][_0x3dd60a][_0xac4a('0x75')],_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x8a')]));}}}if(_0x2b6773['conditions']){_0x2b6773[_0xac4a('0x77')]=JSON[_0xac4a('0x78')](_0x2b6773[_0xac4a('0x77')]);_0x3eae2f[_0xac4a('0x3a')](_0x41cdb5(_0x2b6773[_0xac4a('0x77')][_0xac4a('0x63')]));}_0x52963c=_0x3eae2f[_0xac4a('0x79')]();_0x3eae2f[_0xac4a('0x1d')](_0x63c30);_0x3eae2f[_0xac4a('0x1b')](0x0);logger['debug'](_0xac4a('0x7a'),_0x3eae2f[_0xac4a('0x7b')]());return dbH['sequelize'][_0xac4a('0x31')](_0x3eae2f['toString'](),{'type':dbH[_0xac4a('0x7c')][_0xac4a('0x7d')]['SELECT']});}})[_0xac4a('0x25')](function(){return{'sql':_0x52963c[_0xac4a('0x7b')]()};})[_0xac4a('0x25')](respondWithResult(_0x538cfd,null))[_0xac4a('0x44')](handleError(_0x538cfd,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 6168eab..2190d4c 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 _0xefcd=['analytics_default_reports','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport'];(function(_0x3539ba,_0x16846e){var _0x10b176=function(_0x36a5a5){while(--_0x36a5a5){_0x3539ba['push'](_0x3539ba['shift']());}};_0x10b176(++_0x16846e);}(_0xefcd,0xb7));var _0xdefc=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xefcd[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0xdefc('0x0'));var util=require('util');var logger=require(_0xdefc('0x1'))(_0xdefc('0x2'));var moment=require(_0xdefc('0x3'));var BPromise=require(_0xdefc('0x4'));var rp=require(_0xdefc('0x5'));var fs=require('fs');var path=require(_0xdefc('0x6'));var rimraf=require(_0xdefc('0x7'));var config=require(_0xdefc('0x8'));var attributes=require(_0xdefc('0x9'));module['exports']=function(_0x4ead0f,_0x2b40b6){return _0x4ead0f[_0xdefc('0xa')](_0xdefc('0xb'),attributes,{'tableName':_0xdefc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ac8=['../../config/logger','moment','request-promise','path','./analyticDefaultReport.attributes','AnalyticDefaultReport','analytics_default_reports','lodash'];(function(_0x55da67,_0x318930){var _0x13af60=function(_0x1b882a){while(--_0x1b882a){_0x55da67['push'](_0x55da67['shift']());}};_0x13af60(++_0x318930);}(_0x9ac8,0x7f));var _0x89ac=function(_0x31ba51,_0x51ac52){_0x31ba51=_0x31ba51-0x0;var _0x4c9225=_0x9ac8[_0x31ba51];return _0x4c9225;};'use strict';var _=require(_0x89ac('0x0'));var util=require('util');var logger=require(_0x89ac('0x1'))('api');var moment=require(_0x89ac('0x2'));var BPromise=require('bluebird');var rp=require(_0x89ac('0x3'));var fs=require('fs');var path=require(_0x89ac('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x89ac('0x5'));module['exports']=function(_0x11c2de,_0x40c352){return _0x11c2de['define'](_0x89ac('0x6'),attributes,{'tableName':_0x89ac('0x7'),'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 977874d..f89eb86 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 _0x1807=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','ioredis'];(function(_0x41294a,_0x2c4e3e){var _0x3231f1=function(_0x3a2c38){while(--_0x3a2c38){_0x41294a['push'](_0x41294a['shift']());}};_0x3231f1(++_0x2c4e3e);}(_0x1807,0xb9));var _0x7180=function(_0x2feffe,_0x104382){_0x2feffe=_0x2feffe-0x0;var _0x190bb3=_0x1807[_0x2feffe];return _0x190bb3;};'use strict';var _=require(_0x7180('0x0'));var util=require(_0x7180('0x1'));var moment=require(_0x7180('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7180('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7180('0x4'));var logger=require(_0x7180('0x5'))('rpc');var config=require(_0x7180('0x6'));var jayson=require(_0x7180('0x7'));var client=jayson['client'][_0x7180('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5c11d0,_0x18ac74,_0x5aa8a9){return new BPromise(function(_0x100e63,_0x22628c){return client[_0x7180('0x9')](_0x5c11d0,_0x5aa8a9)[_0x7180('0xa')](function(_0x452644){logger['info'](_0x7180('0xb'),_0x18ac74,_0x7180('0xc'));logger[_0x7180('0xd')](_0x7180('0xe'),_0x18ac74,_0x7180('0xc'),JSON[_0x7180('0xf')](_0x452644));if(_0x452644[_0x7180('0x10')]){if(_0x452644[_0x7180('0x10')]['code']===0x1f4){logger[_0x7180('0x10')](_0x7180('0xb'),_0x18ac74,_0x452644[_0x7180('0x10')][_0x7180('0x11')]);return _0x22628c(_0x452644[_0x7180('0x10')][_0x7180('0x11')]);}logger[_0x7180('0x10')](_0x7180('0xb'),_0x18ac74,_0x452644[_0x7180('0x10')][_0x7180('0x11')]);return _0x100e63(_0x452644[_0x7180('0x10')][_0x7180('0x11')]);}else{logger[_0x7180('0x12')](_0x7180('0xb'),_0x18ac74,'request\x20sent');_0x100e63(_0x452644[_0x7180('0x13')][_0x7180('0x11')]);}})[_0x7180('0x14')](function(_0x5a1a3c){logger[_0x7180('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x18ac74,_0x5a1a3c);_0x22628c(_0x5a1a3c);});});} \ No newline at end of file +var _0x53ec=['catch','lodash','util','moment','../../mysqldb','rpc','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x3057dc,_0x587284){var _0x145878=function(_0x463e18){while(--_0x463e18){_0x3057dc['push'](_0x3057dc['shift']());}};_0x145878(++_0x587284);}(_0x53ec,0x1b1));var _0xc53e=function(_0x428ec2,_0x150404){_0x428ec2=_0x428ec2-0x0;var _0x1654d6=_0x53ec[_0x428ec2];return _0x1654d6;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc53e('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc53e('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc53e('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x453f05,_0x5860df,_0x409207){return new BPromise(function(_0x433aea,_0x174622){return client[_0xc53e('0x6')](_0x453f05,_0x409207)[_0xc53e('0x7')](function(_0x5376b3){logger[_0xc53e('0x8')](_0xc53e('0x9'),_0x5860df,_0xc53e('0xa'));logger[_0xc53e('0xb')](_0xc53e('0xc'),_0x5860df,'request\x20sent',JSON['stringify'](_0x5376b3));if(_0x5376b3['error']){if(_0x5376b3[_0xc53e('0xd')][_0xc53e('0xe')]===0x1f4){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x5860df,_0x5376b3['error'][_0xc53e('0xf')]);return _0x174622(_0x5376b3[_0xc53e('0xd')][_0xc53e('0xf')]);}logger[_0xc53e('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x5860df,_0x5376b3['error'][_0xc53e('0xf')]);return _0x433aea(_0x5376b3[_0xc53e('0xd')]['message']);}else{logger[_0xc53e('0x8')](_0xc53e('0x9'),_0x5860df,_0xc53e('0xa'));_0x433aea(_0x5376b3[_0xc53e('0x10')][_0xc53e('0xf')]);}})[_0xc53e('0x11')](function(_0x4c83d7){logger['error'](_0xc53e('0x9'),_0x5860df,_0x4c83d7);_0x174622(_0x4c83d7);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index dfbb907..26d5f73 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 _0x524a=['index','/:id','/:id/preview','isAuthenticated','/:id/run','run','/:id/query','query','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get'];(function(_0x59f79c,_0x5b7ac2){var _0x16eb4f=function(_0x282450){while(--_0x282450){_0x59f79c['push'](_0x59f79c['shift']());}};_0x16eb4f(++_0x5b7ac2);}(_0x524a,0xa4));var _0xa524=function(_0x29026c,_0x5a1f6f){_0x29026c=_0x29026c-0x0;var _0x1be1d9=_0x524a[_0x29026c];return _0x1be1d9;};'use strict';var multer=require(_0xa524('0x0'));var util=require(_0xa524('0x1'));var path=require(_0xa524('0x2'));var timeout=require(_0xa524('0x3'));var express=require(_0xa524('0x4'));var router=express[_0xa524('0x5')]();var fs_extra=require(_0xa524('0x6'));var auth=require(_0xa524('0x7'));var interaction=require(_0xa524('0x8'));var config=require(_0xa524('0x9'));var controller=require(_0xa524('0xa'));router[_0xa524('0xb')]('/',auth['isAuthenticated'](),controller[_0xa524('0xc')]);router[_0xa524('0xb')](_0xa524('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xa524('0xb')](_0xa524('0xe'),auth[_0xa524('0xf')](),controller['preview']);router[_0xa524('0xb')](_0xa524('0x10'),auth[_0xa524('0xf')](),controller[_0xa524('0x11')]);router[_0xa524('0xb')](_0xa524('0x12'),auth['isAuthenticated'](),controller[_0xa524('0x13')]);router['post']('/',auth[_0xa524('0xf')](),controller['create']);router['put'](_0xa524('0xd'),auth[_0xa524('0xf')](),controller['update']);router[_0xa524('0x14')](_0xa524('0xd'),auth[_0xa524('0xf')](),controller[_0xa524('0x15')]);module['exports']=router; \ No newline at end of file +var _0x3383=['index','/:id/preview','/:id/query','post','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0xd02def,_0x144f25){var _0x2e8374=function(_0x5ceb35){while(--_0x5ceb35){_0xd02def['push'](_0xd02def['shift']());}};_0x2e8374(++_0x144f25);}(_0x3383,0x1a7));var _0x3338=function(_0x466476,_0x2c8216){_0x466476=_0x466476-0x0;var _0x42d93f=_0x3383[_0x466476];return _0x42d93f;};'use strict';var multer=require(_0x3338('0x0'));var util=require(_0x3338('0x1'));var path=require(_0x3338('0x2'));var timeout=require(_0x3338('0x3'));var express=require('express');var router=express[_0x3338('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3338('0x5'));var interaction=require(_0x3338('0x6'));var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router[_0x3338('0x7')]('/',auth[_0x3338('0x8')](),controller[_0x3338('0x9')]);router[_0x3338('0x7')]('/:id',auth[_0x3338('0x8')](),controller['show']);router[_0x3338('0x7')](_0x3338('0xa'),auth[_0x3338('0x8')](),controller['preview']);router['get']('/:id/run',auth['isAuthenticated'](),controller['run']);router[_0x3338('0x7')](_0x3338('0xb'),auth['isAuthenticated'](),controller['query']);router[_0x3338('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3338('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x3338('0xe')]);router[_0x3338('0xf')](_0x3338('0x10'),auth[_0x3338('0x8')](),controller[_0x3338('0x11')]);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 c90a300..e1df3d7 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 _0x2b9e=['DATE','Loading','ENUM','manual','scheduled','UNSIGNED','sequelize','exports','STRING','csv','pdf','xlsx'];(function(_0x185bcc,_0x816a57){var _0x855416=function(_0x2afea4){while(--_0x2afea4){_0x185bcc['push'](_0x185bcc['shift']());}};_0x855416(++_0x816a57);}(_0x2b9e,0x126));var _0xe2b9=function(_0x59562d,_0x3413ed){_0x59562d=_0x59562d-0x0;var _0x2b618e=_0x2b9e[_0x59562d];return _0x2b618e;};'use strict';var Sequelize=require(_0xe2b9('0x0'));var moment=require('moment');module[_0xe2b9('0x1')]={'name':{'type':Sequelize[_0xe2b9('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xe2b9('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xe2b9('0x3'),_0xe2b9('0x4'),_0xe2b9('0x5')),'allowNull':![],'defaultValue':_0xe2b9('0x3')},'savename':{'type':Sequelize[_0xe2b9('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xe2b9('0x6')]},'endDate':{'type':Sequelize[_0xe2b9('0x6')]},'status':{'type':Sequelize[_0xe2b9('0x2')],'defaultValue':_0xe2b9('0x7')},'type':{'type':Sequelize[_0xe2b9('0x8')](_0xe2b9('0x9'),_0xe2b9('0xa')),'allowNull':![],'defaultValue':_0xe2b9('0x9')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xe2b9('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x72c2=['UNSIGNED','moment','STRING','csv','xlsx','DATE','Loading','ENUM','manual','scheduled','INTEGER'];(function(_0x5fc9df,_0x120aca){var _0x3a537d=function(_0x4b2ffb){while(--_0x4b2ffb){_0x5fc9df['push'](_0x5fc9df['shift']());}};_0x3a537d(++_0x120aca);}(_0x72c2,0x12a));var _0x272c=function(_0x151ae9,_0x121f36){_0x151ae9=_0x151ae9-0x0;var _0xce4d51=_0x72c2[_0x151ae9];return _0xce4d51;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x272c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x272c('0x1')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x272c('0x2'),'pdf',_0x272c('0x3')),'allowNull':![],'defaultValue':_0x272c('0x2')},'savename':{'type':Sequelize[_0x272c('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0x272c('0x4')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x272c('0x1')],'defaultValue':_0x272c('0x5')},'type':{'type':Sequelize[_0x272c('0x6')](_0x272c('0x7'),_0x272c('0x8')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x272c('0x9')](0xb)[_0x272c('0xa')]},'reportType':{'type':Sequelize[_0x272c('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 9d0ff16..fdc3047 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 _0x2ede=['userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','basename','savename','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','format','%s.%s','output','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','get','ExtractedReports','UserProfileResource','destroy','end','stack','name','send','index','AnalyticExtractedReport','rawAttributes','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','params','keys','includeAll','find','catch','create','user','role','UserProfileSection'];(function(_0x396eb7,_0x5ad2b4){var _0x3621e2=function(_0xb0526){while(--_0xb0526){_0x396eb7['push'](_0x396eb7['shift']());}};_0x3621e2(++_0x5ad2b4);}(_0x2ede,0xd6));var _0xe2ed=function(_0x41016d,_0x10a6d9){_0x41016d=_0x41016d-0x0;var _0x3e9b26=_0x2ede[_0x41016d];return _0x3e9b26;};'use strict';var emlformat=require(_0xe2ed('0x0'));var rimraf=require(_0xe2ed('0x1'));var zipdir=require(_0xe2ed('0x2'));var jsonpatch=require(_0xe2ed('0x3'));var rp=require(_0xe2ed('0x4'));var moment=require(_0xe2ed('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe2ed('0x6'));var util=require(_0xe2ed('0x7'));var path=require(_0xe2ed('0x8'));var sox=require(_0xe2ed('0x9'));var csv=require(_0xe2ed('0xa'));var ejs=require(_0xe2ed('0xb'));var fs=require('fs');var fs_extra=require(_0xe2ed('0xc'));var _=require(_0xe2ed('0xd'));var squel=require(_0xe2ed('0xe'));var crypto=require(_0xe2ed('0xf'));var jsforce=require(_0xe2ed('0x10'));var deskjs=require(_0xe2ed('0x11'));var toCsv=require(_0xe2ed('0xa'));var querystring=require(_0xe2ed('0x12'));var Papa=require(_0xe2ed('0x13'));var Redis=require(_0xe2ed('0x14'));var authService=require(_0xe2ed('0x15'));var qs=require(_0xe2ed('0x16'));var as=require(_0xe2ed('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe2ed('0x18'));var utils=require(_0xe2ed('0x19'));var config=require(_0xe2ed('0x1a'));var licenseUtil=require(_0xe2ed('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x79810,_0x3aa8a0){_0x3aa8a0=_0x3aa8a0||0xcc;return function(_0x3cd1ab){if(_0x3cd1ab){return _0x79810[_0xe2ed('0x1c')](_0x3aa8a0);}return _0x79810[_0xe2ed('0x1d')](_0x3aa8a0)['end']();};}function respondWithResult(_0x36fb97,_0xb62891){_0xb62891=_0xb62891||0xc8;return function(_0xa74cac){if(_0xa74cac){return _0x36fb97['status'](_0xb62891)[_0xe2ed('0x1e')](_0xa74cac);}};}function respondWithFilteredResult(_0x16eabe,_0x1abe83){return function(_0xcca6ea){if(_0xcca6ea){var _0x15ad52=typeof _0x1abe83[_0xe2ed('0x1f')]===_0xe2ed('0x20')&&typeof _0x1abe83[_0xe2ed('0x21')]===_0xe2ed('0x20');var _0x3d4780=_0xcca6ea[_0xe2ed('0x22')];var _0xcd51dd=_0x15ad52?0x0:_0x1abe83['offset'];var _0x532cc9=_0x15ad52?_0xcca6ea[_0xe2ed('0x22')]:_0x1abe83[_0xe2ed('0x1f')]+_0x1abe83['limit'];var _0x3630b6;if(_0x532cc9>=_0x3d4780){_0x532cc9=_0x3d4780;_0x3630b6=0xc8;}else{_0x3630b6=0xce;}_0x16eabe[_0xe2ed('0x1d')](_0x3630b6);return _0x16eabe['set'](_0xe2ed('0x23'),_0xcd51dd+'-'+_0x532cc9+'/'+_0x3d4780)['json'](_0xcca6ea);}return null;};}function patchUpdates(_0x232f43){return function(_0x175898){try{jsonpatch[_0xe2ed('0x24')](_0x175898,_0x232f43,!![]);}catch(_0x3cb660){return BPromise[_0xe2ed('0x25')](_0x3cb660);}return _0x175898[_0xe2ed('0x26')]();};}function saveUpdates(_0x365c49,_0xdaf86e){return function(_0x447142){if(_0x447142){return _0x447142['update'](_0x365c49)['then'](function(_0x58263d){return _0x58263d;});}return null;};}function removeEntity(_0x3d490a,_0x3d37a2){return function(_0x256604){if(_0x256604){return _0x256604['destroy']()[_0xe2ed('0x27')](function(){var _0x4dd9fa=_0x256604[_0xe2ed('0x28')]({'plain':!![]});var _0x574897=_0xe2ed('0x29');return db[_0xe2ed('0x2a')][_0xe2ed('0x2b')]({'where':{'type':_0x574897,'resourceId':_0x4dd9fa['id']}})[_0xe2ed('0x27')](function(){return _0x256604;});})[_0xe2ed('0x27')](function(){_0x3d490a[_0xe2ed('0x1d')](0xcc)[_0xe2ed('0x2c')]();});}};}function handleEntityNotFound(_0xa163cb,_0x49438a){return function(_0x57cc10){if(!_0x57cc10){_0xa163cb[_0xe2ed('0x1c')](0x194);}return _0x57cc10;};}function handleError(_0x2d86a0,_0x12735d){_0x12735d=_0x12735d||0x1f4;return function(_0x265c7f){logger['error'](_0x265c7f[_0xe2ed('0x2d')]);if(_0x265c7f['name']){delete _0x265c7f[_0xe2ed('0x2e')];}_0x2d86a0['status'](_0x12735d)[_0xe2ed('0x2f')](_0x265c7f);};}exports[_0xe2ed('0x30')]=function(_0x5eea10,_0xfd0bd1){var _0x4a25a1={},_0x2de984={},_0x5795d1={'count':0x0,'rows':[]};var _0x13ec36=_['map'](db[_0xe2ed('0x31')][_0xe2ed('0x32')],function(_0x593bce){return{'name':_0x593bce['fieldName'],'type':_0x593bce['type'][_0xe2ed('0x33')]};});_0x2de984[_0xe2ed('0x34')]=_[_0xe2ed('0x35')](_0x13ec36,'name');_0x2de984[_0xe2ed('0x36')]=_['keys'](_0x5eea10[_0xe2ed('0x36')]);_0x2de984[_0xe2ed('0x37')]=_[_0xe2ed('0x38')](_0x2de984[_0xe2ed('0x34')],_0x2de984[_0xe2ed('0x36')]);_0x4a25a1[_0xe2ed('0x39')]=_[_0xe2ed('0x38')](_0x2de984['model'],qs[_0xe2ed('0x3a')](_0x5eea10[_0xe2ed('0x36')][_0xe2ed('0x3a')]));_0x4a25a1[_0xe2ed('0x39')]=_0x4a25a1[_0xe2ed('0x39')][_0xe2ed('0x3b')]?_0x4a25a1[_0xe2ed('0x39')]:_0x2de984[_0xe2ed('0x34')];if(!_0x5eea10['query'][_0xe2ed('0x3c')]('nolimit')){_0x4a25a1[_0xe2ed('0x21')]=qs[_0xe2ed('0x21')](_0x5eea10['query'][_0xe2ed('0x21')]);_0x4a25a1['offset']=qs[_0xe2ed('0x1f')](_0x5eea10[_0xe2ed('0x36')]['offset']);}_0x4a25a1[_0xe2ed('0x3d')]=qs[_0xe2ed('0x3e')](_0x5eea10[_0xe2ed('0x36')][_0xe2ed('0x3e')]);_0x4a25a1[_0xe2ed('0x3f')]=qs[_0xe2ed('0x37')](_['pick'](_0x5eea10[_0xe2ed('0x36')],_0x2de984[_0xe2ed('0x37')]),_0x13ec36);if(_0x5eea10[_0xe2ed('0x36')][_0xe2ed('0x40')]){_0x4a25a1[_0xe2ed('0x3f')]=_[_0xe2ed('0x41')](_0x4a25a1[_0xe2ed('0x3f')],{'$or':_[_0xe2ed('0x35')](_0x13ec36,function(_0x2874d3){if(_0x2874d3['type']!==_0xe2ed('0x42')){var _0xb0c99f={};_0xb0c99f[_0x2874d3['name']]={'$like':'%'+_0x5eea10['query'][_0xe2ed('0x40')]+'%'};return _0xb0c99f;}})});}_0x4a25a1=_['merge']({},_0x4a25a1,_0x5eea10[_0xe2ed('0x43')]);var _0xf29842={'where':_0x4a25a1[_0xe2ed('0x3f')]};return db['AnalyticExtractedReport'][_0xe2ed('0x22')](_0xf29842)[_0xe2ed('0x27')](function(_0x68a763){_0x5795d1[_0xe2ed('0x22')]=_0x68a763;if(_0x5eea10[_0xe2ed('0x36')]['includeAll']){_0x4a25a1[_0xe2ed('0x44')]=[{'all':!![]}];}return db[_0xe2ed('0x31')][_0xe2ed('0x45')](_0x4a25a1);})[_0xe2ed('0x27')](function(_0x54a027){_0x5795d1[_0xe2ed('0x46')]=_0x54a027;return _0x5795d1;})[_0xe2ed('0x27')](respondWithFilteredResult(_0xfd0bd1,_0x4a25a1))['catch'](handleError(_0xfd0bd1,null));};exports['show']=function(_0x30df70,_0x1d7c55){var _0x55e329={'raw':!![],'where':{'id':_0x30df70[_0xe2ed('0x47')]['id']}},_0x57ab32={};_0x57ab32[_0xe2ed('0x34')]=_[_0xe2ed('0x48')](db['AnalyticExtractedReport']['rawAttributes']);_0x57ab32['query']=_['keys'](_0x30df70[_0xe2ed('0x36')]);_0x57ab32[_0xe2ed('0x37')]=_[_0xe2ed('0x38')](_0x57ab32[_0xe2ed('0x34')],_0x57ab32[_0xe2ed('0x36')]);_0x55e329['attributes']=_[_0xe2ed('0x38')](_0x57ab32[_0xe2ed('0x34')],qs['fields'](_0x30df70[_0xe2ed('0x36')]['fields']));_0x55e329[_0xe2ed('0x39')]=_0x55e329[_0xe2ed('0x39')]['length']?_0x55e329[_0xe2ed('0x39')]:_0x57ab32[_0xe2ed('0x34')];if(_0x30df70[_0xe2ed('0x36')][_0xe2ed('0x49')]){_0x55e329['include']=[{'all':!![]}];}_0x55e329=_[_0xe2ed('0x41')]({},_0x55e329,_0x30df70[_0xe2ed('0x43')]);return db['AnalyticExtractedReport'][_0xe2ed('0x4a')](_0x55e329)[_0xe2ed('0x27')](handleEntityNotFound(_0x1d7c55,null))[_0xe2ed('0x27')](respondWithResult(_0x1d7c55,null))[_0xe2ed('0x4b')](handleError(_0x1d7c55,null));};exports[_0xe2ed('0x4c')]=function(_0x4ac112,_0x43e106){return db[_0xe2ed('0x31')][_0xe2ed('0x4c')](_0x4ac112['body'],{})[_0xe2ed('0x27')](function(_0x5e9679){var _0x476cc9=_0x4ac112[_0xe2ed('0x4d')][_0xe2ed('0x28')]({'plain':!![]});if(!_0x476cc9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x476cc9[_0xe2ed('0x4e')]===_0xe2ed('0x4d')){var _0x3b4040=_0x5e9679[_0xe2ed('0x28')]({'plain':!![]});var _0x2f1797='ExtractedReports';return db[_0xe2ed('0x4f')][_0xe2ed('0x4a')]({'where':{'name':_0x2f1797,'userProfileId':_0x476cc9[_0xe2ed('0x50')]},'raw':!![]})[_0xe2ed('0x27')](function(_0x3016b0){if(_0x3016b0&&_0x3016b0[_0xe2ed('0x51')]===0x0){return db[_0xe2ed('0x2a')]['create']({'name':_0x3b4040[_0xe2ed('0x2e')],'resourceId':_0x3b4040['id'],'type':_0x3016b0[_0xe2ed('0x2e')],'sectionId':_0x3016b0['id']},{})[_0xe2ed('0x27')](function(){return _0x5e9679;});}else{return _0x5e9679;}})[_0xe2ed('0x4b')](function(_0x3011af){logger[_0xe2ed('0x52')](_0xe2ed('0x53'),_0x3011af);throw _0x3011af;});}return _0x5e9679;})[_0xe2ed('0x27')](respondWithResult(_0x43e106,0xc9))[_0xe2ed('0x4b')](handleError(_0x43e106,null));};exports['update']=function(_0x4614a1,_0x37b040){if(_0x4614a1[_0xe2ed('0x54')]['id']){delete _0x4614a1[_0xe2ed('0x54')]['id'];}return db[_0xe2ed('0x31')][_0xe2ed('0x4a')]({'where':{'id':_0x4614a1[_0xe2ed('0x47')]['id']}})['then'](handleEntityNotFound(_0x37b040,null))[_0xe2ed('0x27')](saveUpdates(_0x4614a1[_0xe2ed('0x54')],null))[_0xe2ed('0x27')](respondWithResult(_0x37b040,null))[_0xe2ed('0x4b')](handleError(_0x37b040,null));};exports[_0xe2ed('0x2b')]=function(_0x1a172a,_0x17aaae){return db[_0xe2ed('0x31')][_0xe2ed('0x4a')]({'where':{'id':_0x1a172a[_0xe2ed('0x47')]['id']}})['then'](handleEntityNotFound(_0x17aaae,null))[_0xe2ed('0x27')](removeEntity(_0x17aaae,null))[_0xe2ed('0x4b')](handleError(_0x17aaae,null));};exports['download']=function(_0xaabf48,_0x121d5f,_0x4a613e){return db[_0xe2ed('0x31')][_0xe2ed('0x4a')]({'where':{'id':_0xaabf48['params']['id']},'attributes':[_0xe2ed('0x2e'),_0xe2ed('0x55'),_0xe2ed('0x56'),'output'],'raw':!![]})[_0xe2ed('0x27')](handleEntityNotFound(_0x121d5f,null))[_0xe2ed('0x27')](function(_0x3d7009){if(_0x3d7009){if(!fs[_0xe2ed('0x57')](path[_0xe2ed('0x58')](config[_0xe2ed('0x59')],_0xe2ed('0x5a'),_0x3d7009[_0xe2ed('0x56')]))){throw new db[(_0xe2ed('0x5b'))][(_0xe2ed('0x5c'))](_0xe2ed('0x5d'));}if(_0xaabf48[_0xe2ed('0x36')]['exists']){return _0x121d5f[_0xe2ed('0x1c')](0xc8);}return _0x121d5f['download'](path[_0xe2ed('0x58')](config[_0xe2ed('0x59')],_0xe2ed('0x5a'),_0x3d7009[_0xe2ed('0x56')]),util[_0xe2ed('0x5e')](_0xe2ed('0x5f'),_0x3d7009[_0xe2ed('0x55')]||_0x3d7009[_0xe2ed('0x2e')],_0x3d7009[_0xe2ed('0x60')][_0xe2ed('0x61')]()));}})[_0xe2ed('0x4b')](handleError(_0x121d5f,null));}; \ No newline at end of file +var _0xa627=['savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','exists','format','%s.%s','eml-format','rimraf','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','stack','name','send','index','map','AnalyticExtractedReport','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','basename'];(function(_0x35f7d1,_0x39d318){var _0x53ac5f=function(_0x30b171){while(--_0x30b171){_0x35f7d1['push'](_0x35f7d1['shift']());}};_0x53ac5f(++_0x39d318);}(_0xa627,0x12b));var _0x7a62=function(_0x351ac6,_0x233039){_0x351ac6=_0x351ac6-0x0;var _0x33905f=_0xa627[_0x351ac6];return _0x33905f;};'use strict';var emlformat=require(_0x7a62('0x0'));var rimraf=require(_0x7a62('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7a62('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x7a62('0x3'));var util=require(_0x7a62('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x7a62('0x5'));var ejs=require(_0x7a62('0x6'));var fs=require('fs');var fs_extra=require(_0x7a62('0x7'));var _=require(_0x7a62('0x8'));var squel=require(_0x7a62('0x9'));var crypto=require('crypto');var jsforce=require(_0x7a62('0xa'));var deskjs=require(_0x7a62('0xb'));var toCsv=require(_0x7a62('0x5'));var querystring=require(_0x7a62('0xc'));var Papa=require(_0x7a62('0xd'));var Redis=require(_0x7a62('0xe'));var authService=require(_0x7a62('0xf'));var qs=require(_0x7a62('0x10'));var as=require(_0x7a62('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7a62('0x12'))(_0x7a62('0x13'));var utils=require(_0x7a62('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7a62('0x15'))['db'];function respondWithStatusCode(_0x509e76,_0x375216){_0x375216=_0x375216||0xcc;return function(_0x23e9b6){if(_0x23e9b6){return _0x509e76[_0x7a62('0x16')](_0x375216);}return _0x509e76[_0x7a62('0x17')](_0x375216)[_0x7a62('0x18')]();};}function respondWithResult(_0xb57a8d,_0x1095e2){_0x1095e2=_0x1095e2||0xc8;return function(_0x33fb9a){if(_0x33fb9a){return _0xb57a8d[_0x7a62('0x17')](_0x1095e2)['json'](_0x33fb9a);}};}function respondWithFilteredResult(_0x222312,_0x352e4e){return function(_0x49b28b){if(_0x49b28b){var _0x31cd5f=typeof _0x352e4e[_0x7a62('0x19')]===_0x7a62('0x1a')&&typeof _0x352e4e['limit']==='undefined';var _0x2ce369=_0x49b28b[_0x7a62('0x1b')];var _0x2cfddb=_0x31cd5f?0x0:_0x352e4e['offset'];var _0x43225b=_0x31cd5f?_0x49b28b[_0x7a62('0x1b')]:_0x352e4e['offset']+_0x352e4e[_0x7a62('0x1c')];var _0x322268;if(_0x43225b>=_0x2ce369){_0x43225b=_0x2ce369;_0x322268=0xc8;}else{_0x322268=0xce;}_0x222312[_0x7a62('0x17')](_0x322268);return _0x222312[_0x7a62('0x1d')](_0x7a62('0x1e'),_0x2cfddb+'-'+_0x43225b+'/'+_0x2ce369)[_0x7a62('0x1f')](_0x49b28b);}return null;};}function patchUpdates(_0x195ac2){return function(_0x1329e7){try{jsonpatch[_0x7a62('0x20')](_0x1329e7,_0x195ac2,!![]);}catch(_0x26d73e){return BPromise[_0x7a62('0x21')](_0x26d73e);}return _0x1329e7[_0x7a62('0x22')]();};}function saveUpdates(_0x5544ae,_0x4eff01){return function(_0x3f9f8d){if(_0x3f9f8d){return _0x3f9f8d[_0x7a62('0x23')](_0x5544ae)[_0x7a62('0x24')](function(_0x24730d){return _0x24730d;});}return null;};}function removeEntity(_0xdadd4,_0x1af485){return function(_0x5f27c6){if(_0x5f27c6){return _0x5f27c6[_0x7a62('0x25')]()[_0x7a62('0x24')](function(){var _0x312ce7=_0x5f27c6[_0x7a62('0x26')]({'plain':!![]});var _0xe87d37=_0x7a62('0x27');return db[_0x7a62('0x28')][_0x7a62('0x25')]({'where':{'type':_0xe87d37,'resourceId':_0x312ce7['id']}})['then'](function(){return _0x5f27c6;});})['then'](function(){_0xdadd4[_0x7a62('0x17')](0xcc)[_0x7a62('0x18')]();});}};}function handleEntityNotFound(_0x35be24,_0x1bbb12){return function(_0xa3f42d){if(!_0xa3f42d){_0x35be24['sendStatus'](0x194);}return _0xa3f42d;};}function handleError(_0x3b3dab,_0x335ac3){_0x335ac3=_0x335ac3||0x1f4;return function(_0x4eeebb){logger['error'](_0x4eeebb[_0x7a62('0x29')]);if(_0x4eeebb['name']){delete _0x4eeebb[_0x7a62('0x2a')];}_0x3b3dab['status'](_0x335ac3)[_0x7a62('0x2b')](_0x4eeebb);};}exports[_0x7a62('0x2c')]=function(_0x42e965,_0x52ac21){var _0x1cffa8={},_0x37295a={},_0x25081a={'count':0x0,'rows':[]};var _0x58ee17=_[_0x7a62('0x2d')](db[_0x7a62('0x2e')]['rawAttributes'],function(_0x142c4c){return{'name':_0x142c4c['fieldName'],'type':_0x142c4c[_0x7a62('0x2f')][_0x7a62('0x30')]};});_0x37295a['model']=_[_0x7a62('0x2d')](_0x58ee17,_0x7a62('0x2a'));_0x37295a[_0x7a62('0x31')]=_['keys'](_0x42e965[_0x7a62('0x31')]);_0x37295a[_0x7a62('0x32')]=_[_0x7a62('0x33')](_0x37295a[_0x7a62('0x34')],_0x37295a['query']);_0x1cffa8[_0x7a62('0x35')]=_['intersection'](_0x37295a['model'],qs['fields'](_0x42e965[_0x7a62('0x31')][_0x7a62('0x36')]));_0x1cffa8[_0x7a62('0x35')]=_0x1cffa8[_0x7a62('0x35')]['length']?_0x1cffa8[_0x7a62('0x35')]:_0x37295a[_0x7a62('0x34')];if(!_0x42e965['query'][_0x7a62('0x37')](_0x7a62('0x38'))){_0x1cffa8[_0x7a62('0x1c')]=qs[_0x7a62('0x1c')](_0x42e965[_0x7a62('0x31')][_0x7a62('0x1c')]);_0x1cffa8['offset']=qs['offset'](_0x42e965['query'][_0x7a62('0x19')]);}_0x1cffa8[_0x7a62('0x39')]=qs[_0x7a62('0x3a')](_0x42e965[_0x7a62('0x31')]['sort']);_0x1cffa8[_0x7a62('0x3b')]=qs[_0x7a62('0x32')](_['pick'](_0x42e965[_0x7a62('0x31')],_0x37295a[_0x7a62('0x32')]),_0x58ee17);if(_0x42e965[_0x7a62('0x31')][_0x7a62('0x3c')]){_0x1cffa8['where']=_[_0x7a62('0x3d')](_0x1cffa8[_0x7a62('0x3b')],{'$or':_[_0x7a62('0x2d')](_0x58ee17,function(_0x41f2fb){if(_0x41f2fb[_0x7a62('0x2f')]!==_0x7a62('0x3e')){var _0x285fa={};_0x285fa[_0x41f2fb[_0x7a62('0x2a')]]={'$like':'%'+_0x42e965[_0x7a62('0x31')][_0x7a62('0x3c')]+'%'};return _0x285fa;}})});}_0x1cffa8=_[_0x7a62('0x3d')]({},_0x1cffa8,_0x42e965[_0x7a62('0x3f')]);var _0x579a77={'where':_0x1cffa8[_0x7a62('0x3b')]};return db[_0x7a62('0x2e')][_0x7a62('0x1b')](_0x579a77)[_0x7a62('0x24')](function(_0x2271af){_0x25081a[_0x7a62('0x1b')]=_0x2271af;if(_0x42e965[_0x7a62('0x31')][_0x7a62('0x40')]){_0x1cffa8[_0x7a62('0x41')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x7a62('0x42')](_0x1cffa8);})['then'](function(_0x4de573){_0x25081a[_0x7a62('0x43')]=_0x4de573;return _0x25081a;})[_0x7a62('0x24')](respondWithFilteredResult(_0x52ac21,_0x1cffa8))[_0x7a62('0x44')](handleError(_0x52ac21,null));};exports[_0x7a62('0x45')]=function(_0x5c4b7c,_0x547788){var _0x262126={'raw':!![],'where':{'id':_0x5c4b7c['params']['id']}},_0x13dfb8={};_0x13dfb8[_0x7a62('0x34')]=_[_0x7a62('0x46')](db['AnalyticExtractedReport']['rawAttributes']);_0x13dfb8[_0x7a62('0x31')]=_[_0x7a62('0x46')](_0x5c4b7c[_0x7a62('0x31')]);_0x13dfb8[_0x7a62('0x32')]=_['intersection'](_0x13dfb8[_0x7a62('0x34')],_0x13dfb8['query']);_0x262126[_0x7a62('0x35')]=_[_0x7a62('0x33')](_0x13dfb8[_0x7a62('0x34')],qs[_0x7a62('0x36')](_0x5c4b7c[_0x7a62('0x31')]['fields']));_0x262126[_0x7a62('0x35')]=_0x262126['attributes'][_0x7a62('0x47')]?_0x262126['attributes']:_0x13dfb8[_0x7a62('0x34')];if(_0x5c4b7c[_0x7a62('0x31')][_0x7a62('0x40')]){_0x262126[_0x7a62('0x41')]=[{'all':!![]}];}_0x262126=_[_0x7a62('0x3d')]({},_0x262126,_0x5c4b7c[_0x7a62('0x3f')]);return db[_0x7a62('0x2e')][_0x7a62('0x48')](_0x262126)['then'](handleEntityNotFound(_0x547788,null))['then'](respondWithResult(_0x547788,null))[_0x7a62('0x44')](handleError(_0x547788,null));};exports[_0x7a62('0x49')]=function(_0x41cc9c,_0x3fe9f3){return db[_0x7a62('0x2e')][_0x7a62('0x49')](_0x41cc9c[_0x7a62('0x4a')],{})[_0x7a62('0x24')](function(_0x3c7db5){var _0x378bba=_0x41cc9c[_0x7a62('0x4b')][_0x7a62('0x26')]({'plain':!![]});if(!_0x378bba)throw new Error(_0x7a62('0x4c'));if(_0x378bba[_0x7a62('0x4d')]===_0x7a62('0x4b')){var _0x2f6416=_0x3c7db5[_0x7a62('0x26')]({'plain':!![]});var _0x3eb800='ExtractedReports';return db['UserProfileSection'][_0x7a62('0x48')]({'where':{'name':_0x3eb800,'userProfileId':_0x378bba[_0x7a62('0x4e')]},'raw':!![]})['then'](function(_0x3d7269){if(_0x3d7269&&_0x3d7269[_0x7a62('0x4f')]===0x0){return db[_0x7a62('0x28')][_0x7a62('0x49')]({'name':_0x2f6416['name'],'resourceId':_0x2f6416['id'],'type':_0x3d7269[_0x7a62('0x2a')],'sectionId':_0x3d7269['id']},{})['then'](function(){return _0x3c7db5;});}else{return _0x3c7db5;}})[_0x7a62('0x44')](function(_0x31d5ef){logger[_0x7a62('0x50')](_0x7a62('0x51'),_0x31d5ef);throw _0x31d5ef;});}return _0x3c7db5;})[_0x7a62('0x24')](respondWithResult(_0x3fe9f3,0xc9))['catch'](handleError(_0x3fe9f3,null));};exports[_0x7a62('0x23')]=function(_0x33f704,_0x545458){if(_0x33f704[_0x7a62('0x4a')]['id']){delete _0x33f704[_0x7a62('0x4a')]['id'];}return db[_0x7a62('0x2e')][_0x7a62('0x48')]({'where':{'id':_0x33f704['params']['id']}})['then'](handleEntityNotFound(_0x545458,null))['then'](saveUpdates(_0x33f704[_0x7a62('0x4a')],null))[_0x7a62('0x24')](respondWithResult(_0x545458,null))['catch'](handleError(_0x545458,null));};exports[_0x7a62('0x25')]=function(_0x1fd255,_0x575330){return db['AnalyticExtractedReport'][_0x7a62('0x48')]({'where':{'id':_0x1fd255[_0x7a62('0x52')]['id']}})['then'](handleEntityNotFound(_0x575330,null))[_0x7a62('0x24')](removeEntity(_0x575330,null))['catch'](handleError(_0x575330,null));};exports[_0x7a62('0x53')]=function(_0x125fd2,_0x52f140,_0x1d644d){return db[_0x7a62('0x2e')][_0x7a62('0x48')]({'where':{'id':_0x125fd2[_0x7a62('0x52')]['id']},'attributes':[_0x7a62('0x2a'),_0x7a62('0x54'),_0x7a62('0x55'),_0x7a62('0x56')],'raw':!![]})[_0x7a62('0x24')](handleEntityNotFound(_0x52f140,null))[_0x7a62('0x24')](function(_0x3e6571){if(_0x3e6571){if(!fs[_0x7a62('0x57')](path[_0x7a62('0x58')](config[_0x7a62('0x59')],_0x7a62('0x5a'),_0x3e6571[_0x7a62('0x55')]))){throw new db[(_0x7a62('0x5b'))][(_0x7a62('0x5c'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x125fd2[_0x7a62('0x31')][_0x7a62('0x5d')]){return _0x52f140[_0x7a62('0x16')](0xc8);}return _0x52f140[_0x7a62('0x53')](path[_0x7a62('0x58')](config[_0x7a62('0x59')],_0x7a62('0x5a'),_0x3e6571['savename']),util[_0x7a62('0x5e')](_0x7a62('0x5f'),_0x3e6571['basename']||_0x3e6571[_0x7a62('0x2a')],_0x3e6571['output']['toLowerCase']()));}})[_0x7a62('0x44')](handleError(_0x52f140,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 41df33f..8ce6f06 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 _0x5c40=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','analytics_extracted_reports','lodash','util'];(function(_0x7e1db7,_0x1da70f){var _0xc82fa0=function(_0x23b276){while(--_0x23b276){_0x7e1db7['push'](_0x7e1db7['shift']());}};_0xc82fa0(++_0x1da70f);}(_0x5c40,0xa7));var _0x05c4=function(_0x385510,_0x476690){_0x385510=_0x385510-0x0;var _0x5b5e1f=_0x5c40[_0x385510];return _0x5b5e1f;};'use strict';var _=require(_0x05c4('0x0'));var util=require(_0x05c4('0x1'));var logger=require('../../config/logger')(_0x05c4('0x2'));var moment=require(_0x05c4('0x3'));var BPromise=require(_0x05c4('0x4'));var rp=require(_0x05c4('0x5'));var fs=require('fs');var path=require(_0x05c4('0x6'));var rimraf=require(_0x05c4('0x7'));var config=require(_0x05c4('0x8'));var attributes=require(_0x05c4('0x9'));module[_0x05c4('0xa')]=function(_0x2e2842,_0x3e5fac){return _0x2e2842[_0x05c4('0xb')]('AnalyticExtractedReport',attributes,{'tableName':_0x05c4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8bd=['exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes'];(function(_0x2d20ae,_0x3b1d15){var _0x58451e=function(_0xd0aed7){while(--_0xd0aed7){_0x2d20ae['push'](_0x2d20ae['shift']());}};_0x58451e(++_0x3b1d15);}(_0xd8bd,0x156));var _0xdd8b=function(_0x411f29,_0x561085){_0x411f29=_0x411f29-0x0;var _0xbbb918=_0xd8bd[_0x411f29];return _0xbbb918;};'use strict';var _=require(_0xdd8b('0x0'));var util=require('util');var logger=require(_0xdd8b('0x1'))(_0xdd8b('0x2'));var moment=require('moment');var BPromise=require(_0xdd8b('0x3'));var rp=require(_0xdd8b('0x4'));var fs=require('fs');var path=require(_0xdd8b('0x5'));var rimraf=require(_0xdd8b('0x6'));var config=require(_0xdd8b('0x7'));var attributes=require(_0xdd8b('0x8'));module[_0xdd8b('0x9')]=function(_0x29e326,_0x45c39f){return _0x29e326[_0xdd8b('0xa')](_0xdd8b('0xb'),attributes,{'tableName':_0xdd8b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 34310f2..1b52fee 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 _0x849e=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','../../mysqldb'];(function(_0x53ad9c,_0x448a91){var _0x51a477=function(_0x1cc81e){while(--_0x1cc81e){_0x53ad9c['push'](_0x53ad9c['shift']());}};_0x51a477(++_0x448a91);}(_0x849e,0xf4));var _0xe849=function(_0x3c8366,_0x46df4c){_0x3c8366=_0x3c8366-0x0;var _0xae08f1=_0x849e[_0x3c8366];return _0xae08f1;};'use strict';var _=require(_0xe849('0x0'));var util=require(_0xe849('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe849('0x2'))['db'];var utils=require(_0xe849('0x3'));var logger=require(_0xe849('0x4'))(_0xe849('0x5'));var config=require(_0xe849('0x6'));var jayson=require(_0xe849('0x7'));var client=jayson[_0xe849('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19965f,_0x316fda,_0x527092){return new BPromise(function(_0x254c1d,_0x1a666e){return client[_0xe849('0x9')](_0x19965f,_0x527092)['then'](function(_0x5154e2){logger[_0xe849('0xa')](_0xe849('0xb'),_0x316fda,_0xe849('0xc'));logger[_0xe849('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x316fda,_0xe849('0xc'),JSON[_0xe849('0xe')](_0x5154e2));if(_0x5154e2[_0xe849('0xf')]){if(_0x5154e2[_0xe849('0xf')][_0xe849('0x10')]===0x1f4){logger[_0xe849('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x316fda,_0x5154e2['error'][_0xe849('0x11')]);return _0x1a666e(_0x5154e2[_0xe849('0xf')][_0xe849('0x11')]);}logger[_0xe849('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x316fda,_0x5154e2[_0xe849('0xf')][_0xe849('0x11')]);return _0x254c1d(_0x5154e2[_0xe849('0xf')][_0xe849('0x11')]);}else{logger[_0xe849('0xa')](_0xe849('0xb'),_0x316fda,_0xe849('0xc'));_0x254c1d(_0x5154e2['result'][_0xe849('0x11')]);}})[_0xe849('0x12')](function(_0x26db49){logger[_0xe849('0xf')](_0xe849('0xb'),_0x316fda,_0x26db49);_0x1a666e(_0x26db49);});});} \ No newline at end of file +var _0xb8a2=['then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','request'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xb8a2,0xd2));var _0x2b8a=function(_0x3aa59f,_0x16229e){_0x3aa59f=_0x3aa59f-0x0;var _0x452bf5=_0xb8a2[_0x3aa59f];return _0x452bf5;};'use strict';var _=require(_0x2b8a('0x0'));var util=require('util');var moment=require(_0x2b8a('0x1'));var BPromise=require(_0x2b8a('0x2'));var rs=require(_0x2b8a('0x3'));var fs=require('fs');var Redis=require(_0x2b8a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2b8a('0x5'))(_0x2b8a('0x6'));var config=require(_0x2b8a('0x7'));var jayson=require(_0x2b8a('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3b7e8d,_0x21bf10,_0x1f6bef){return new BPromise(function(_0x534a7b,_0x477e5a){return client[_0x2b8a('0x9')](_0x3b7e8d,_0x1f6bef)[_0x2b8a('0xa')](function(_0x3949b7){logger[_0x2b8a('0xb')](_0x2b8a('0xc'),_0x21bf10,_0x2b8a('0xd'));logger[_0x2b8a('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x21bf10,_0x2b8a('0xd'),JSON[_0x2b8a('0xf')](_0x3949b7));if(_0x3949b7['error']){if(_0x3949b7[_0x2b8a('0x10')][_0x2b8a('0x11')]===0x1f4){logger[_0x2b8a('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x21bf10,_0x3949b7['error'][_0x2b8a('0x12')]);return _0x477e5a(_0x3949b7[_0x2b8a('0x10')][_0x2b8a('0x12')]);}logger[_0x2b8a('0x10')](_0x2b8a('0xc'),_0x21bf10,_0x3949b7[_0x2b8a('0x10')][_0x2b8a('0x12')]);return _0x534a7b(_0x3949b7[_0x2b8a('0x10')][_0x2b8a('0x12')]);}else{logger[_0x2b8a('0xb')](_0x2b8a('0xc'),_0x21bf10,_0x2b8a('0xd'));_0x534a7b(_0x3949b7['result'][_0x2b8a('0x12')]);}})[_0x2b8a('0x13')](function(_0x20ace2){logger['error'](_0x2b8a('0xc'),_0x21bf10,_0x20ace2);_0x477e5a(_0x20ace2);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index aed7f8f..3f72fe6 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 _0xe440=['./analyticExtractedReport.controller','get','index','/:id','show','isAuthenticated','download','put','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x248a08,_0x43eaa0){var _0x16f178=function(_0x2e4e18){while(--_0x2e4e18){_0x248a08['push'](_0x248a08['shift']());}};_0x16f178(++_0x43eaa0);}(_0xe440,0xdd));var _0x0e44=function(_0x182bdd,_0x43bad3){_0x182bdd=_0x182bdd-0x0;var _0x156cf4=_0xe440[_0x182bdd];return _0x156cf4;};'use strict';var multer=require(_0x0e44('0x0'));var util=require(_0x0e44('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0e44('0x2'));var router=express['Router']();var fs_extra=require(_0x0e44('0x3'));var auth=require(_0x0e44('0x4'));var interaction=require(_0x0e44('0x5'));var config=require(_0x0e44('0x6'));var controller=require(_0x0e44('0x7'));router[_0x0e44('0x8')]('/',auth['isAuthenticated'](),controller[_0x0e44('0x9')]);router[_0x0e44('0x8')](_0x0e44('0xa'),auth['isAuthenticated'](),controller[_0x0e44('0xb')]);router[_0x0e44('0x8')]('/:id/download',auth[_0x0e44('0xc')](),controller[_0x0e44('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x0e44('0xe')]('/:id',auth[_0x0e44('0xc')](),controller[_0x0e44('0xf')]);router[_0x0e44('0x10')](_0x0e44('0xa'),auth[_0x0e44('0xc')](),controller[_0x0e44('0x11')]);module[_0x0e44('0x12')]=router; \ No newline at end of file +var _0x1ef7=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','get','index','isAuthenticated','show','/:id/download','download','create','/:id','delete','exports','multer'];(function(_0x2a100e,_0x263ba5){var _0x517ac8=function(_0x3342b9){while(--_0x3342b9){_0x2a100e['push'](_0x2a100e['shift']());}};_0x517ac8(++_0x263ba5);}(_0x1ef7,0x167));var _0x71ef=function(_0x3fd3a3,_0x36c863){_0x3fd3a3=_0x3fd3a3-0x0;var _0xa3e4d5=_0x1ef7[_0x3fd3a3];return _0xa3e4d5;};'use strict';var multer=require(_0x71ef('0x0'));var util=require('util');var path=require(_0x71ef('0x1'));var timeout=require('connect-timeout');var express=require(_0x71ef('0x2'));var router=express[_0x71ef('0x3')]();var fs_extra=require(_0x71ef('0x4'));var auth=require(_0x71ef('0x5'));var interaction=require(_0x71ef('0x6'));var config=require('../../config/environment');var controller=require(_0x71ef('0x7'));router[_0x71ef('0x8')]('/',auth['isAuthenticated'](),controller[_0x71ef('0x9')]);router[_0x71ef('0x8')]('/:id',auth[_0x71ef('0xa')](),controller[_0x71ef('0xb')]);router[_0x71ef('0x8')](_0x71ef('0xc'),auth['isAuthenticated'](),controller[_0x71ef('0xd')]);router['post']('/',auth[_0x71ef('0xa')](),controller[_0x71ef('0xe')]);router['put'](_0x71ef('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x71ef('0x10')](_0x71ef('0xf'),auth[_0x71ef('0xa')](),controller['destroy']);module[_0x71ef('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 6e83e9c..8db4ffb 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 _0x19fd=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x4d6674,_0x23734a){var _0x4fcd4d=function(_0x2df1c9){while(--_0x2df1c9){_0x4d6674['push'](_0x4d6674['shift']());}};_0x4fcd4d(++_0x23734a);}(_0x19fd,0x10e));var _0xd19f=function(_0x59e229,_0x130f86){_0x59e229=_0x59e229-0x0;var _0x7f5d6b=_0x19fd[_0x59e229];return _0x7f5d6b;};'use strict';var Sequelize=require(_0xd19f('0x0'));module[_0xd19f('0x1')]={'field':{'type':Sequelize[_0xd19f('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xd19f('0x3')]},'format':{'type':Sequelize[_0xd19f('0x3')]},'groupBy':{'type':Sequelize[_0xd19f('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xd19f('0x3')]},'custom':{'type':Sequelize[_0xd19f('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x6ab4=['BOOLEAN','sequelize','exports','STRING'];(function(_0x28002a,_0x565666){var _0x45a345=function(_0x97bae4){while(--_0x97bae4){_0x28002a['push'](_0x28002a['shift']());}};_0x45a345(++_0x565666);}(_0x6ab4,0x139));var _0x46ab=function(_0x16e734,_0x46281a){_0x16e734=_0x16e734-0x0;var _0x45f4c3=_0x6ab4[_0x16e734];return _0x45f4c3;};'use strict';var Sequelize=require(_0x46ab('0x0'));module[_0x46ab('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x46ab('0x2')]},'function':{'type':Sequelize[_0x46ab('0x2')]},'format':{'type':Sequelize[_0x46ab('0x2')]},'groupBy':{'type':Sequelize[_0x46ab('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x46ab('0x2')]},'custom':{'type':Sequelize[_0x46ab('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index ec6a862..99eb121 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 _0xa694=['create','bulkCreate','body','bulkDestroy','ids','AnalyticCustomReport','sequelize','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','name','send','index','map','AnalyticFieldReport','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find'];(function(_0x3b0966,_0x3fc4ca){var _0x18e6b0=function(_0x535058){while(--_0x535058){_0x3b0966['push'](_0x3b0966['shift']());}};_0x18e6b0(++_0x3fc4ca);}(_0xa694,0x153));var _0x4a69=function(_0xe8e923,_0x1cf325){_0xe8e923=_0xe8e923-0x0;var _0x2ab28c=_0xa694[_0xe8e923];return _0x2ab28c;};'use strict';var emlformat=require(_0x4a69('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4a69('0x1'));var jsonpatch=require(_0x4a69('0x2'));var rp=require(_0x4a69('0x3'));var moment=require(_0x4a69('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4a69('0x5'));var util=require(_0x4a69('0x6'));var path=require(_0x4a69('0x7'));var sox=require(_0x4a69('0x8'));var csv=require('to-csv');var ejs=require(_0x4a69('0x9'));var fs=require('fs');var fs_extra=require(_0x4a69('0xa'));var _=require(_0x4a69('0xb'));var squel=require(_0x4a69('0xc'));var crypto=require(_0x4a69('0xd'));var jsforce=require(_0x4a69('0xe'));var deskjs=require(_0x4a69('0xf'));var toCsv=require(_0x4a69('0x10'));var querystring=require(_0x4a69('0x11'));var Papa=require(_0x4a69('0x12'));var Redis=require(_0x4a69('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x4a69('0x14'));var as=require(_0x4a69('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4a69('0x16'))('api');var utils=require(_0x4a69('0x17'));var config=require(_0x4a69('0x18'));var licenseUtil=require(_0x4a69('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b62df,_0x356b54){_0x356b54=_0x356b54||0xcc;return function(_0x3398a7){if(_0x3398a7){return _0x2b62df['sendStatus'](_0x356b54);}return _0x2b62df[_0x4a69('0x1a')](_0x356b54)[_0x4a69('0x1b')]();};}function respondWithResult(_0x1ae675,_0x3e13cf){_0x3e13cf=_0x3e13cf||0xc8;return function(_0x3a02c9){if(_0x3a02c9){return _0x1ae675['status'](_0x3e13cf)[_0x4a69('0x1c')](_0x3a02c9);}};}function respondWithFilteredResult(_0x1f305b,_0x5d7abb){return function(_0x9ff15f){if(_0x9ff15f){var _0x27445d=typeof _0x5d7abb[_0x4a69('0x1d')]===_0x4a69('0x1e')&&typeof _0x5d7abb[_0x4a69('0x1f')]===_0x4a69('0x1e');var _0x32dc26=_0x9ff15f[_0x4a69('0x20')];var _0x31f51e=_0x27445d?0x0:_0x5d7abb[_0x4a69('0x1d')];var _0x3df39f=_0x27445d?_0x9ff15f[_0x4a69('0x20')]:_0x5d7abb[_0x4a69('0x1d')]+_0x5d7abb[_0x4a69('0x1f')];var _0xa8d12;if(_0x3df39f>=_0x32dc26){_0x3df39f=_0x32dc26;_0xa8d12=0xc8;}else{_0xa8d12=0xce;}_0x1f305b[_0x4a69('0x1a')](_0xa8d12);return _0x1f305b[_0x4a69('0x21')](_0x4a69('0x22'),_0x31f51e+'-'+_0x3df39f+'/'+_0x32dc26)[_0x4a69('0x1c')](_0x9ff15f);}return null;};}function patchUpdates(_0x309656){return function(_0x331c97){try{jsonpatch[_0x4a69('0x23')](_0x331c97,_0x309656,!![]);}catch(_0x1ade6f){return BPromise[_0x4a69('0x24')](_0x1ade6f);}return _0x331c97[_0x4a69('0x25')]();};}function saveUpdates(_0x4edca4,_0x2f7085){return function(_0x4ccec0){if(_0x4ccec0){return _0x4ccec0[_0x4a69('0x26')](_0x4edca4)[_0x4a69('0x27')](function(_0x583e05){return _0x583e05;});}return null;};}function removeEntity(_0x1ae83a,_0x52c886){return function(_0x2c4676){if(_0x2c4676){return _0x2c4676[_0x4a69('0x28')]()[_0x4a69('0x27')](function(){_0x1ae83a[_0x4a69('0x1a')](0xcc)[_0x4a69('0x1b')]();});}};}function handleEntityNotFound(_0x11b8d9,_0x497a22){return function(_0x2144de){if(!_0x2144de){_0x11b8d9[_0x4a69('0x29')](0x194);}return _0x2144de;};}function handleError(_0x5b01ad,_0xcd1af1){_0xcd1af1=_0xcd1af1||0x1f4;return function(_0x305eb1){logger['error'](_0x305eb1['stack']);if(_0x305eb1[_0x4a69('0x2a')]){delete _0x305eb1['name'];}_0x5b01ad['status'](_0xcd1af1)[_0x4a69('0x2b')](_0x305eb1);};}exports[_0x4a69('0x2c')]=function(_0x34e36b,_0x436f08){var _0x3ff847={},_0x2d487c={},_0xad11cf={'count':0x0,'rows':[]};var _0xfe4538=_[_0x4a69('0x2d')](db[_0x4a69('0x2e')]['rawAttributes'],function(_0x283eb7){return{'name':_0x283eb7[_0x4a69('0x2f')],'type':_0x283eb7[_0x4a69('0x30')][_0x4a69('0x31')]};});_0x2d487c[_0x4a69('0x32')]=_[_0x4a69('0x2d')](_0xfe4538,_0x4a69('0x2a'));_0x2d487c['query']=_[_0x4a69('0x33')](_0x34e36b[_0x4a69('0x34')]);_0x2d487c['filters']=_[_0x4a69('0x35')](_0x2d487c[_0x4a69('0x32')],_0x2d487c[_0x4a69('0x34')]);_0x3ff847[_0x4a69('0x36')]=_[_0x4a69('0x35')](_0x2d487c[_0x4a69('0x32')],qs[_0x4a69('0x37')](_0x34e36b[_0x4a69('0x34')]['fields']));_0x3ff847[_0x4a69('0x36')]=_0x3ff847['attributes'][_0x4a69('0x38')]?_0x3ff847[_0x4a69('0x36')]:_0x2d487c[_0x4a69('0x32')];if(!_0x34e36b[_0x4a69('0x34')]['hasOwnProperty'](_0x4a69('0x39'))){_0x3ff847[_0x4a69('0x1f')]=qs[_0x4a69('0x1f')](_0x34e36b[_0x4a69('0x34')][_0x4a69('0x1f')]);_0x3ff847[_0x4a69('0x1d')]=qs[_0x4a69('0x1d')](_0x34e36b[_0x4a69('0x34')][_0x4a69('0x1d')]);}_0x3ff847[_0x4a69('0x3a')]=qs[_0x4a69('0x3b')](_0x34e36b[_0x4a69('0x34')]['sort']);_0x3ff847[_0x4a69('0x3c')]=qs['filters'](_[_0x4a69('0x3d')](_0x34e36b[_0x4a69('0x34')],_0x2d487c[_0x4a69('0x3e')]),_0xfe4538);if(_0x34e36b[_0x4a69('0x34')][_0x4a69('0x3f')]){_0x3ff847[_0x4a69('0x3c')]=_[_0x4a69('0x40')](_0x3ff847[_0x4a69('0x3c')],{'$or':_[_0x4a69('0x2d')](_0xfe4538,function(_0x22baf5){if(_0x22baf5[_0x4a69('0x30')]!==_0x4a69('0x41')){var _0x4e6de6={};_0x4e6de6[_0x22baf5['name']]={'$like':'%'+_0x34e36b[_0x4a69('0x34')]['filter']+'%'};return _0x4e6de6;}})});}_0x3ff847=_[_0x4a69('0x40')]({},_0x3ff847,_0x34e36b[_0x4a69('0x42')]);var _0x4ba11f={'where':_0x3ff847[_0x4a69('0x3c')]};return db[_0x4a69('0x2e')][_0x4a69('0x20')](_0x4ba11f)[_0x4a69('0x27')](function(_0x778d34){_0xad11cf[_0x4a69('0x20')]=_0x778d34;if(_0x34e36b[_0x4a69('0x34')][_0x4a69('0x43')]){_0x3ff847[_0x4a69('0x44')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x4a69('0x45')](_0x3ff847);})[_0x4a69('0x27')](function(_0x8ac1c0){_0xad11cf[_0x4a69('0x46')]=_0x8ac1c0;return _0xad11cf;})['then'](respondWithFilteredResult(_0x436f08,_0x3ff847))[_0x4a69('0x47')](handleError(_0x436f08,null));};exports[_0x4a69('0x48')]=function(_0x5bee9f,_0x23ffbe){var _0x19a05f={'raw':![],'where':{'id':_0x5bee9f[_0x4a69('0x49')]['id']}},_0x7370f1={};_0x7370f1[_0x4a69('0x32')]=_[_0x4a69('0x33')](db[_0x4a69('0x2e')][_0x4a69('0x4a')]);_0x7370f1[_0x4a69('0x34')]=_[_0x4a69('0x33')](_0x5bee9f[_0x4a69('0x34')]);_0x7370f1[_0x4a69('0x3e')]=_[_0x4a69('0x35')](_0x7370f1[_0x4a69('0x32')],_0x7370f1['query']);_0x19a05f[_0x4a69('0x36')]=_['intersection'](_0x7370f1['model'],qs[_0x4a69('0x37')](_0x5bee9f['query'][_0x4a69('0x37')]));_0x19a05f[_0x4a69('0x36')]=_0x19a05f[_0x4a69('0x36')][_0x4a69('0x38')]?_0x19a05f[_0x4a69('0x36')]:_0x7370f1[_0x4a69('0x32')];if(_0x5bee9f[_0x4a69('0x34')][_0x4a69('0x43')]){_0x19a05f[_0x4a69('0x44')]=[{'all':!![]}];}_0x19a05f=_['merge']({},_0x19a05f,_0x5bee9f[_0x4a69('0x42')]);return db[_0x4a69('0x2e')][_0x4a69('0x4b')](_0x19a05f)[_0x4a69('0x27')](handleEntityNotFound(_0x23ffbe,null))['then'](respondWithResult(_0x23ffbe,null))['catch'](handleError(_0x23ffbe,null));};exports['create']=function(_0x15880c,_0x42643){return db['AnalyticFieldReport'][_0x4a69('0x4c')](_0x15880c['body'],{})['then'](respondWithResult(_0x42643,0xc9))[_0x4a69('0x47')](handleError(_0x42643,null));};exports[_0x4a69('0x4d')]=function(_0x5397c4,_0x1e94b3){return db['AnalyticFieldReport'][_0x4a69('0x4d')](_0x5397c4[_0x4a69('0x4e')],{'raw':![],'individualHooks':!![]})[_0x4a69('0x27')](respondWithResult(_0x1e94b3,0xc9))[_0x4a69('0x47')](handleError(_0x1e94b3,null));};exports[_0x4a69('0x26')]=function(_0x482655,_0x4149a6){if(_0x482655[_0x4a69('0x4e')]['id']){delete _0x482655[_0x4a69('0x4e')]['id'];}return db[_0x4a69('0x2e')][_0x4a69('0x4b')]({'where':{'id':_0x482655['params']['id']}})[_0x4a69('0x27')](handleEntityNotFound(_0x4149a6,null))[_0x4a69('0x27')](saveUpdates(_0x482655[_0x4a69('0x4e')],null))[_0x4a69('0x27')](respondWithResult(_0x4149a6,null))[_0x4a69('0x47')](handleError(_0x4149a6,null));};exports['destroy']=function(_0x50be0b,_0x325b0a){return db['AnalyticFieldReport']['find']({'where':{'id':_0x50be0b[_0x4a69('0x49')]['id']}})[_0x4a69('0x27')](handleEntityNotFound(_0x325b0a,null))[_0x4a69('0x27')](removeEntity(_0x325b0a,null))[_0x4a69('0x47')](handleError(_0x325b0a,null));};exports[_0x4a69('0x4f')]=function(_0x108f1e,_0x16ae16){return db[_0x4a69('0x2e')][_0x4a69('0x28')]({'where':{'id':_0x108f1e['query'][_0x4a69('0x50')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x16ae16,0xcc))[_0x4a69('0x47')](handleError(_0x16ae16,null));};exports['addFields']=function(_0x16ebd6,_0x52ee6c,_0x30d304){return db[_0x4a69('0x51')]['findOne']({'where':{'id':_0x16ebd6[_0x4a69('0x49')]['id']}})[_0x4a69('0x27')](handleEntityNotFound(_0x52ee6c,null))[_0x4a69('0x27')](function(_0x5c7b07){if(_0x5c7b07){return db[_0x4a69('0x52')]['transaction'](function(_0x1319b7){return db['AnalyticFieldReport'][_0x4a69('0x28')]({'where':{'CustomReportId':_0x16ebd6['params']['id']},'transaction':_0x1319b7})[_0x4a69('0x27')](function(_0x403d2c){var _0x3a4ac1=_[_0x4a69('0x2d')](_0x16ebd6[_0x4a69('0x4e')],function(_0x2f0cfb){delete _0x2f0cfb['id'];_0x2f0cfb['CustomReportId']=_0x16ebd6[_0x4a69('0x49')]['id'];return _0x2f0cfb;});return db['AnalyticFieldReport'][_0x4a69('0x4d')](_0x3a4ac1,{'transaction':_0x1319b7});});})['then'](function(){return db[_0x4a69('0x2e')][_0x4a69('0x45')]({'where':{'CustomReportId':_0x16ebd6[_0x4a69('0x49')]['id']}});});}})[_0x4a69('0x27')](respondWithResult(_0x52ee6c,null))[_0x4a69('0x47')](handleError(_0x52ee6c,null));}; \ No newline at end of file +var _0xef0d=['destroy','stack','name','send','index','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','bulkCreate','bulkDestroy','addFields','findOne','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','moment','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then'];(function(_0x28941b,_0x47603b){var _0x5d7a6b=function(_0x4ba646){while(--_0x4ba646){_0x28941b['push'](_0x28941b['shift']());}};_0x5d7a6b(++_0x47603b);}(_0xef0d,0x7d));var _0xdef0=function(_0x21b788,_0x1b000c){_0x21b788=_0x21b788-0x0;var _0x32e4ba=_0xef0d[_0x21b788];return _0x32e4ba;};'use strict';var emlformat=require(_0xdef0('0x0'));var rimraf=require(_0xdef0('0x1'));var zipdir=require(_0xdef0('0x2'));var jsonpatch=require(_0xdef0('0x3'));var rp=require('request-promise');var moment=require(_0xdef0('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xdef0('0x5'));var ejs=require(_0xdef0('0x6'));var fs=require('fs');var fs_extra=require(_0xdef0('0x7'));var _=require(_0xdef0('0x8'));var squel=require(_0xdef0('0x9'));var crypto=require(_0xdef0('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xdef0('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdef0('0xc'));var Redis=require(_0xdef0('0xd'));var authService=require(_0xdef0('0xe'));var qs=require(_0xdef0('0xf'));var as=require(_0xdef0('0x10'));var hardwareService=require(_0xdef0('0x11'));var logger=require(_0xdef0('0x12'))(_0xdef0('0x13'));var utils=require(_0xdef0('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xdef0('0x15'));var db=require(_0xdef0('0x16'))['db'];function respondWithStatusCode(_0x128521,_0x136a26){_0x136a26=_0x136a26||0xcc;return function(_0x529a52){if(_0x529a52){return _0x128521[_0xdef0('0x17')](_0x136a26);}return _0x128521[_0xdef0('0x18')](_0x136a26)[_0xdef0('0x19')]();};}function respondWithResult(_0xb9dd6d,_0x4f3005){_0x4f3005=_0x4f3005||0xc8;return function(_0x28e80b){if(_0x28e80b){return _0xb9dd6d['status'](_0x4f3005)['json'](_0x28e80b);}};}function respondWithFilteredResult(_0x30b05d,_0x297368){return function(_0x4e3be2){if(_0x4e3be2){var _0x472f9b=typeof _0x297368[_0xdef0('0x1a')]===_0xdef0('0x1b')&&typeof _0x297368[_0xdef0('0x1c')]===_0xdef0('0x1b');var _0x5c9cf8=_0x4e3be2[_0xdef0('0x1d')];var _0x46d330=_0x472f9b?0x0:_0x297368[_0xdef0('0x1a')];var _0x514c84=_0x472f9b?_0x4e3be2[_0xdef0('0x1d')]:_0x297368['offset']+_0x297368['limit'];var _0x1e2dca;if(_0x514c84>=_0x5c9cf8){_0x514c84=_0x5c9cf8;_0x1e2dca=0xc8;}else{_0x1e2dca=0xce;}_0x30b05d['status'](_0x1e2dca);return _0x30b05d[_0xdef0('0x1e')](_0xdef0('0x1f'),_0x46d330+'-'+_0x514c84+'/'+_0x5c9cf8)[_0xdef0('0x20')](_0x4e3be2);}return null;};}function patchUpdates(_0x387f29){return function(_0xa0ab0c){try{jsonpatch[_0xdef0('0x21')](_0xa0ab0c,_0x387f29,!![]);}catch(_0x18a64b){return BPromise[_0xdef0('0x22')](_0x18a64b);}return _0xa0ab0c['save']();};}function saveUpdates(_0x356263,_0x45db66){return function(_0x5d6a21){if(_0x5d6a21){return _0x5d6a21[_0xdef0('0x23')](_0x356263)[_0xdef0('0x24')](function(_0x1ef2ec){return _0x1ef2ec;});}return null;};}function removeEntity(_0x130302,_0x3824e4){return function(_0x33a16f){if(_0x33a16f){return _0x33a16f[_0xdef0('0x25')]()[_0xdef0('0x24')](function(){_0x130302['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xd24cef,_0x5b0440){return function(_0x452728){if(!_0x452728){_0xd24cef[_0xdef0('0x17')](0x194);}return _0x452728;};}function handleError(_0x58519f,_0x21b422){_0x21b422=_0x21b422||0x1f4;return function(_0x45ad28){logger['error'](_0x45ad28[_0xdef0('0x26')]);if(_0x45ad28[_0xdef0('0x27')]){delete _0x45ad28[_0xdef0('0x27')];}_0x58519f['status'](_0x21b422)[_0xdef0('0x28')](_0x45ad28);};}exports[_0xdef0('0x29')]=function(_0x433deb,_0x3f8b23){var _0x371d65={},_0x28921b={},_0x263793={'count':0x0,'rows':[]};var _0x1ba2e0=_['map'](db[_0xdef0('0x2a')][_0xdef0('0x2b')],function(_0x1065b9){return{'name':_0x1065b9[_0xdef0('0x2c')],'type':_0x1065b9[_0xdef0('0x2d')][_0xdef0('0x2e')]};});_0x28921b[_0xdef0('0x2f')]=_[_0xdef0('0x30')](_0x1ba2e0,_0xdef0('0x27'));_0x28921b['query']=_[_0xdef0('0x31')](_0x433deb['query']);_0x28921b[_0xdef0('0x32')]=_[_0xdef0('0x33')](_0x28921b[_0xdef0('0x2f')],_0x28921b[_0xdef0('0x34')]);_0x371d65['attributes']=_[_0xdef0('0x33')](_0x28921b[_0xdef0('0x2f')],qs['fields'](_0x433deb[_0xdef0('0x34')]['fields']));_0x371d65[_0xdef0('0x35')]=_0x371d65['attributes'][_0xdef0('0x36')]?_0x371d65['attributes']:_0x28921b['model'];if(!_0x433deb[_0xdef0('0x34')][_0xdef0('0x37')](_0xdef0('0x38'))){_0x371d65[_0xdef0('0x1c')]=qs[_0xdef0('0x1c')](_0x433deb['query'][_0xdef0('0x1c')]);_0x371d65[_0xdef0('0x1a')]=qs[_0xdef0('0x1a')](_0x433deb['query'][_0xdef0('0x1a')]);}_0x371d65['order']=qs['sort'](_0x433deb['query'][_0xdef0('0x39')]);_0x371d65[_0xdef0('0x3a')]=qs[_0xdef0('0x32')](_[_0xdef0('0x3b')](_0x433deb[_0xdef0('0x34')],_0x28921b[_0xdef0('0x32')]),_0x1ba2e0);if(_0x433deb[_0xdef0('0x34')][_0xdef0('0x3c')]){_0x371d65[_0xdef0('0x3a')]=_[_0xdef0('0x3d')](_0x371d65[_0xdef0('0x3a')],{'$or':_['map'](_0x1ba2e0,function(_0x2e5a9b){if(_0x2e5a9b[_0xdef0('0x2d')]!==_0xdef0('0x3e')){var _0x3a5c9f={};_0x3a5c9f[_0x2e5a9b['name']]={'$like':'%'+_0x433deb['query'][_0xdef0('0x3c')]+'%'};return _0x3a5c9f;}})});}_0x371d65=_[_0xdef0('0x3d')]({},_0x371d65,_0x433deb[_0xdef0('0x3f')]);var _0x111186={'where':_0x371d65['where']};return db['AnalyticFieldReport'][_0xdef0('0x1d')](_0x111186)[_0xdef0('0x24')](function(_0x409a5c){_0x263793['count']=_0x409a5c;if(_0x433deb['query'][_0xdef0('0x40')]){_0x371d65[_0xdef0('0x41')]=[{'all':!![]}];}return db[_0xdef0('0x2a')][_0xdef0('0x42')](_0x371d65);})['then'](function(_0x3e55de){_0x263793[_0xdef0('0x43')]=_0x3e55de;return _0x263793;})[_0xdef0('0x24')](respondWithFilteredResult(_0x3f8b23,_0x371d65))[_0xdef0('0x44')](handleError(_0x3f8b23,null));};exports[_0xdef0('0x45')]=function(_0x6c73a3,_0x361136){var _0x35f970={'raw':![],'where':{'id':_0x6c73a3[_0xdef0('0x46')]['id']}},_0x30ee41={};_0x30ee41['model']=_[_0xdef0('0x31')](db[_0xdef0('0x2a')][_0xdef0('0x2b')]);_0x30ee41[_0xdef0('0x34')]=_[_0xdef0('0x31')](_0x6c73a3[_0xdef0('0x34')]);_0x30ee41[_0xdef0('0x32')]=_['intersection'](_0x30ee41[_0xdef0('0x2f')],_0x30ee41['query']);_0x35f970[_0xdef0('0x35')]=_[_0xdef0('0x33')](_0x30ee41[_0xdef0('0x2f')],qs[_0xdef0('0x47')](_0x6c73a3[_0xdef0('0x34')][_0xdef0('0x47')]));_0x35f970['attributes']=_0x35f970['attributes']['length']?_0x35f970[_0xdef0('0x35')]:_0x30ee41[_0xdef0('0x2f')];if(_0x6c73a3[_0xdef0('0x34')][_0xdef0('0x40')]){_0x35f970[_0xdef0('0x41')]=[{'all':!![]}];}_0x35f970=_[_0xdef0('0x3d')]({},_0x35f970,_0x6c73a3[_0xdef0('0x3f')]);return db[_0xdef0('0x2a')][_0xdef0('0x48')](_0x35f970)[_0xdef0('0x24')](handleEntityNotFound(_0x361136,null))[_0xdef0('0x24')](respondWithResult(_0x361136,null))[_0xdef0('0x44')](handleError(_0x361136,null));};exports['create']=function(_0x41a9fc,_0x5350ab){return db[_0xdef0('0x2a')][_0xdef0('0x49')](_0x41a9fc[_0xdef0('0x4a')],{})[_0xdef0('0x24')](respondWithResult(_0x5350ab,0xc9))['catch'](handleError(_0x5350ab,null));};exports[_0xdef0('0x4b')]=function(_0x4a92eb,_0x7eafa8){return db['AnalyticFieldReport'][_0xdef0('0x4b')](_0x4a92eb[_0xdef0('0x4a')],{'raw':![],'individualHooks':!![]})[_0xdef0('0x24')](respondWithResult(_0x7eafa8,0xc9))[_0xdef0('0x44')](handleError(_0x7eafa8,null));};exports['update']=function(_0x5f2ab8,_0x1a0db3){if(_0x5f2ab8[_0xdef0('0x4a')]['id']){delete _0x5f2ab8['body']['id'];}return db['AnalyticFieldReport'][_0xdef0('0x48')]({'where':{'id':_0x5f2ab8['params']['id']}})['then'](handleEntityNotFound(_0x1a0db3,null))[_0xdef0('0x24')](saveUpdates(_0x5f2ab8[_0xdef0('0x4a')],null))[_0xdef0('0x24')](respondWithResult(_0x1a0db3,null))[_0xdef0('0x44')](handleError(_0x1a0db3,null));};exports[_0xdef0('0x25')]=function(_0x3b62c2,_0x342be5){return db['AnalyticFieldReport'][_0xdef0('0x48')]({'where':{'id':_0x3b62c2[_0xdef0('0x46')]['id']}})[_0xdef0('0x24')](handleEntityNotFound(_0x342be5,null))[_0xdef0('0x24')](removeEntity(_0x342be5,null))[_0xdef0('0x44')](handleError(_0x342be5,null));};exports[_0xdef0('0x4c')]=function(_0x5e75e3,_0xfef31d){return db[_0xdef0('0x2a')][_0xdef0('0x25')]({'where':{'id':_0x5e75e3[_0xdef0('0x34')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0xdef0('0x24')](respondWithResult(_0xfef31d,0xcc))[_0xdef0('0x44')](handleError(_0xfef31d,null));};exports[_0xdef0('0x4d')]=function(_0x3314a5,_0x4c9543,_0x404edb){return db['AnalyticCustomReport'][_0xdef0('0x4e')]({'where':{'id':_0x3314a5['params']['id']}})[_0xdef0('0x24')](handleEntityNotFound(_0x4c9543,null))[_0xdef0('0x24')](function(_0x36f994){if(_0x36f994){return db['sequelize'][_0xdef0('0x4f')](function(_0x4ccb83){return db['AnalyticFieldReport'][_0xdef0('0x25')]({'where':{'CustomReportId':_0x3314a5[_0xdef0('0x46')]['id']},'transaction':_0x4ccb83})[_0xdef0('0x24')](function(_0x3b7639){var _0x29ee51=_[_0xdef0('0x30')](_0x3314a5[_0xdef0('0x4a')],function(_0x2cbda4){delete _0x2cbda4['id'];_0x2cbda4[_0xdef0('0x50')]=_0x3314a5[_0xdef0('0x46')]['id'];return _0x2cbda4;});return db['AnalyticFieldReport'][_0xdef0('0x4b')](_0x29ee51,{'transaction':_0x4ccb83});});})[_0xdef0('0x24')](function(){return db['AnalyticFieldReport'][_0xdef0('0x42')]({'where':{'CustomReportId':_0x3314a5[_0xdef0('0x46')]['id']}});});}})[_0xdef0('0x24')](respondWithResult(_0x4c9543,null))[_0xdef0('0x44')](handleError(_0x4c9543,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index c9f53bd..5ecbd52 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 _0x8d15=['define','analytics_report_fields','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./analyticFieldReport.attributes','exports'];(function(_0x48708a,_0x224103){var _0x1c596e=function(_0x5b73d4){while(--_0x5b73d4){_0x48708a['push'](_0x48708a['shift']());}};_0x1c596e(++_0x224103);}(_0x8d15,0x1ee));var _0x58d1=function(_0x2df588,_0x318219){_0x2df588=_0x2df588-0x0;var _0x2871a9=_0x8d15[_0x2df588];return _0x2871a9;};'use strict';var _=require(_0x58d1('0x0'));var util=require(_0x58d1('0x1'));var logger=require('../../config/logger')(_0x58d1('0x2'));var moment=require(_0x58d1('0x3'));var BPromise=require(_0x58d1('0x4'));var rp=require(_0x58d1('0x5'));var fs=require('fs');var path=require(_0x58d1('0x6'));var rimraf=require(_0x58d1('0x7'));var config=require('../../config/environment');var attributes=require(_0x58d1('0x8'));module[_0x58d1('0x9')]=function(_0x67f943,_0x812963){return _0x67f943[_0x58d1('0xa')]('AnalyticFieldReport',attributes,{'tableName':_0x58d1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc938=['moment','request-promise','rimraf','./analyticFieldReport.attributes','exports','AnalyticFieldReport','lodash','util','../../config/logger','api'];(function(_0x4d35eb,_0x543ce3){var _0x1e248b=function(_0x184594){while(--_0x184594){_0x4d35eb['push'](_0x4d35eb['shift']());}};_0x1e248b(++_0x543ce3);}(_0xc938,0x1be));var _0x8c93=function(_0x5643fd,_0x220b84){_0x5643fd=_0x5643fd-0x0;var _0x11df89=_0xc938[_0x5643fd];return _0x11df89;};'use strict';var _=require(_0x8c93('0x0'));var util=require(_0x8c93('0x1'));var logger=require(_0x8c93('0x2'))(_0x8c93('0x3'));var moment=require(_0x8c93('0x4'));var BPromise=require('bluebird');var rp=require(_0x8c93('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8c93('0x6'));var config=require('../../config/environment');var attributes=require(_0x8c93('0x7'));module[_0x8c93('0x8')]=function(_0x4c60f3,_0x4787c6){return _0x4c60f3['define'](_0x8c93('0x9'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 3e02af0..dea0172 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 _0xa9c9=['rpc','../../config/environment','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x57b287,_0x495d83){var _0x3cafa5=function(_0x295881){while(--_0x295881){_0x57b287['push'](_0x57b287['shift']());}};_0x3cafa5(++_0x495d83);}(_0xa9c9,0xbf));var _0x9a9c=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xa9c9[_0x565ed7];return _0x183ad7;};'use strict';var _=require('lodash');var util=require(_0x9a9c('0x0'));var moment=require(_0x9a9c('0x1'));var BPromise=require(_0x9a9c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9a9c('0x3'));var db=require(_0x9a9c('0x4'))['db'];var utils=require(_0x9a9c('0x5'));var logger=require(_0x9a9c('0x6'))(_0x9a9c('0x7'));var config=require(_0x9a9c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9a9c('0x9')][_0x9a9c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d6ea6,_0x523c4,_0x2d73ce){return new BPromise(function(_0x461e18,_0x11b9c8){return client[_0x9a9c('0xb')](_0x2d6ea6,_0x2d73ce)[_0x9a9c('0xc')](function(_0x361824){logger[_0x9a9c('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x523c4,'request\x20sent');logger['debug'](_0x9a9c('0xe'),_0x523c4,_0x9a9c('0xf'),JSON[_0x9a9c('0x10')](_0x361824));if(_0x361824[_0x9a9c('0x11')]){if(_0x361824[_0x9a9c('0x11')]['code']===0x1f4){logger[_0x9a9c('0x11')](_0x9a9c('0x12'),_0x523c4,_0x361824[_0x9a9c('0x11')][_0x9a9c('0x13')]);return _0x11b9c8(_0x361824[_0x9a9c('0x11')][_0x9a9c('0x13')]);}logger[_0x9a9c('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x523c4,_0x361824[_0x9a9c('0x11')][_0x9a9c('0x13')]);return _0x461e18(_0x361824[_0x9a9c('0x11')][_0x9a9c('0x13')]);}else{logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x523c4,_0x9a9c('0xf'));_0x461e18(_0x361824[_0x9a9c('0x14')][_0x9a9c('0x13')]);}})[_0x9a9c('0x15')](function(_0x88c5f8){logger[_0x9a9c('0x11')](_0x9a9c('0x12'),_0x523c4,_0x88c5f8);_0x11b9c8(_0x88c5f8);});});} \ No newline at end of file +var _0x6a3d=['rpc','jayson/promise','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger'];(function(_0x45fc6a,_0x166adb){var _0x14bcfd=function(_0x3ba718){while(--_0x3ba718){_0x45fc6a['push'](_0x45fc6a['shift']());}};_0x14bcfd(++_0x166adb);}(_0x6a3d,0x162));var _0xd6a3=function(_0x2c85c0,_0x1dac4f){_0x2c85c0=_0x2c85c0-0x0;var _0xf4d4c9=_0x6a3d[_0x2c85c0];return _0xf4d4c9;};'use strict';var _=require(_0xd6a3('0x0'));var util=require(_0xd6a3('0x1'));var moment=require(_0xd6a3('0x2'));var BPromise=require('bluebird');var rs=require(_0xd6a3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6a3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd6a3('0x5'))(_0xd6a3('0x6'));var config=require('../../config/environment');var jayson=require(_0xd6a3('0x7'));var client=jayson['client'][_0xd6a3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3be654,_0xbd5fc1,_0x12b21f){return new BPromise(function(_0x404d2e,_0x1ceeeb){return client[_0xd6a3('0x9')](_0x3be654,_0x12b21f)[_0xd6a3('0xa')](function(_0x552b5b){logger[_0xd6a3('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0xbd5fc1,'request\x20sent');logger['debug'](_0xd6a3('0xc'),_0xbd5fc1,'request\x20sent',JSON['stringify'](_0x552b5b));if(_0x552b5b[_0xd6a3('0xd')]){if(_0x552b5b[_0xd6a3('0xd')][_0xd6a3('0xe')]===0x1f4){logger[_0xd6a3('0xd')](_0xd6a3('0xf'),_0xbd5fc1,_0x552b5b[_0xd6a3('0xd')][_0xd6a3('0x10')]);return _0x1ceeeb(_0x552b5b['error'][_0xd6a3('0x10')]);}logger[_0xd6a3('0xd')](_0xd6a3('0xf'),_0xbd5fc1,_0x552b5b['error'][_0xd6a3('0x10')]);return _0x404d2e(_0x552b5b[_0xd6a3('0xd')][_0xd6a3('0x10')]);}else{logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0xbd5fc1,_0xd6a3('0x11'));_0x404d2e(_0x552b5b[_0xd6a3('0x12')][_0xd6a3('0x10')]);}})[_0xd6a3('0x13')](function(_0x337591){logger[_0xd6a3('0xd')](_0xd6a3('0xf'),_0xbd5fc1,_0x337591);_0x1ceeeb(_0x337591);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 1c4dada..f586cb4 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(_0x23a399,_0x5b4e73){var _0x8a61e8=function(_0x5afa12){while(--_0x5afa12){_0x23a399['push'](_0x23a399['shift']());}};_0x8a61e8(++_0x5b4e73);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x22a29e,_0xedff6b){var _0x1742b8=function(_0x15332b){while(--_0x15332b){_0x22a29e['push'](_0x22a29e['shift']());}};_0x1742b8(++_0xedff6b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 730925c..ff887c3 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 _0x4dfc=['STRING','TEXT','name'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x4dfc,0xda));var _0xc4df=function(_0x1793de,_0x4d7233){_0x1793de=_0x1793de-0x0;var _0x4f0309=_0x4dfc[_0x1793de];return _0x4f0309;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc4df('0x0')},'table':{'type':Sequelize[_0xc4df('0x1')]},'metric':{'type':Sequelize[_0xc4df('0x2')]},'description':{'type':Sequelize[_0xc4df('0x1')]}}; \ No newline at end of file +var _0xaa2d=['TEXT','STRING','exports'];(function(_0x56873b,_0x2852d0){var _0x89900d=function(_0x41c4a3){while(--_0x41c4a3){_0x56873b['push'](_0x56873b['shift']());}};_0x89900d(++_0x2852d0);}(_0xaa2d,0x11c));var _0xdaa2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa2d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xdaa2('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0xdaa2('0x1')]},'description':{'type':Sequelize[_0xdaa2('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index a45bc99..eddda8d 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 _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(_0x42a791,_0x1f32c7){var _0x1732b1=function(_0x5ed167){while(--_0x5ed167){_0x42a791['push'](_0x42a791['shift']());}};_0x1732b1(++_0x1f32c7);}(_0x008c,0x188));var _0xc008=function(_0x1f5974,_0x11540c){_0x1f5974=_0x1f5974-0x0;var _0x5cb353=_0x008c[_0x1f5974];return _0x5cb353;};'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 +var _0xd6d6=['includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','include','AnalyticMetric','rows','show'];(function(_0x2b82a7,_0x12a217){var _0x54c5f5=function(_0x2016f3){while(--_0x2016f3){_0x2b82a7['push'](_0x2b82a7['shift']());}};_0x54c5f5(++_0x12a217);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x609711,_0x34ff04){_0x609711=_0x609711-0x0;var _0x5b0fe7=_0xd6d6[_0x609711];return _0x5b0fe7;};'use strict';var emlformat=require(_0x6d6d('0x0'));var rimraf=require(_0x6d6d('0x1'));var zipdir=require(_0x6d6d('0x2'));var jsonpatch=require(_0x6d6d('0x3'));var rp=require('request-promise');var moment=require(_0x6d6d('0x4'));var BPromise=require(_0x6d6d('0x5'));var Mustache=require(_0x6d6d('0x6'));var util=require(_0x6d6d('0x7'));var path=require(_0x6d6d('0x8'));var sox=require(_0x6d6d('0x9'));var csv=require(_0x6d6d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d6d('0xb'));var _=require(_0x6d6d('0xc'));var squel=require(_0x6d6d('0xd'));var crypto=require(_0x6d6d('0xe'));var jsforce=require(_0x6d6d('0xf'));var deskjs=require(_0x6d6d('0x10'));var toCsv=require(_0x6d6d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d6d('0x11'));var authService=require(_0x6d6d('0x12'));var qs=require(_0x6d6d('0x13'));var as=require(_0x6d6d('0x14'));var hardwareService=require(_0x6d6d('0x15'));var logger=require('../../config/logger')(_0x6d6d('0x16'));var utils=require(_0x6d6d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6d6d('0x18'))['db'];function respondWithStatusCode(_0x32146d,_0xe61c36){_0xe61c36=_0xe61c36||0xcc;return function(_0x3f8542){if(_0x3f8542){return _0x32146d[_0x6d6d('0x19')](_0xe61c36);}return _0x32146d[_0x6d6d('0x1a')](_0xe61c36)[_0x6d6d('0x1b')]();};}function respondWithResult(_0x2cb2dd,_0x5f4154){_0x5f4154=_0x5f4154||0xc8;return function(_0xd09ea7){if(_0xd09ea7){return _0x2cb2dd[_0x6d6d('0x1a')](_0x5f4154)[_0x6d6d('0x1c')](_0xd09ea7);}};}function respondWithFilteredResult(_0xa3b05d,_0x29cbd8){return function(_0x5d80c0){if(_0x5d80c0){var _0x2e6fdb=typeof _0x29cbd8['offset']===_0x6d6d('0x1d')&&typeof _0x29cbd8[_0x6d6d('0x1e')]===_0x6d6d('0x1d');var _0x4bb3d1=_0x5d80c0['count'];var _0x9e1e18=_0x2e6fdb?0x0:_0x29cbd8[_0x6d6d('0x1f')];var _0x2b59d4=_0x2e6fdb?_0x5d80c0[_0x6d6d('0x20')]:_0x29cbd8['offset']+_0x29cbd8['limit'];var _0x474873;if(_0x2b59d4>=_0x4bb3d1){_0x2b59d4=_0x4bb3d1;_0x474873=0xc8;}else{_0x474873=0xce;}_0xa3b05d['status'](_0x474873);return _0xa3b05d[_0x6d6d('0x21')](_0x6d6d('0x22'),_0x9e1e18+'-'+_0x2b59d4+'/'+_0x4bb3d1)[_0x6d6d('0x1c')](_0x5d80c0);}return null;};}function patchUpdates(_0x450352){return function(_0x40d35b){try{jsonpatch[_0x6d6d('0x23')](_0x40d35b,_0x450352,!![]);}catch(_0x164c67){return BPromise[_0x6d6d('0x24')](_0x164c67);}return _0x40d35b[_0x6d6d('0x25')]();};}function saveUpdates(_0x6f64e3,_0x24b10d){return function(_0x6e58e3){if(_0x6e58e3){return _0x6e58e3[_0x6d6d('0x26')](_0x6f64e3)[_0x6d6d('0x27')](function(_0x1f7f88){return _0x1f7f88;});}return null;};}function removeEntity(_0x25a02e,_0xced622){return function(_0x583b10){if(_0x583b10){return _0x583b10[_0x6d6d('0x28')]()[_0x6d6d('0x27')](function(){var _0x99f7d6=_0x583b10[_0x6d6d('0x29')]({'plain':!![]});var _0xf0df7f=_0x6d6d('0x2a');return db['UserProfileResource'][_0x6d6d('0x28')]({'where':{'type':_0xf0df7f,'resourceId':_0x99f7d6['id']}})[_0x6d6d('0x27')](function(){return _0x583b10;});})[_0x6d6d('0x27')](function(){_0x25a02e[_0x6d6d('0x1a')](0xcc)[_0x6d6d('0x1b')]();});}};}function handleEntityNotFound(_0x408f98,_0x3641fc){return function(_0x4a57a1){if(!_0x4a57a1){_0x408f98[_0x6d6d('0x19')](0x194);}return _0x4a57a1;};}function handleError(_0x9595d8,_0x51bd68){_0x51bd68=_0x51bd68||0x1f4;return function(_0x553645){logger[_0x6d6d('0x2b')](_0x553645[_0x6d6d('0x2c')]);if(_0x553645[_0x6d6d('0x2d')]){delete _0x553645['name'];}_0x9595d8[_0x6d6d('0x1a')](_0x51bd68)[_0x6d6d('0x2e')](_0x553645);};}exports[_0x6d6d('0x2f')]=function(_0x1c8340,_0x64d1f7){var _0x428c17={},_0xdda3f2={},_0x359cfd={'count':0x0,'rows':[]};var _0x6c4741=_[_0x6d6d('0x30')](db['AnalyticMetric'][_0x6d6d('0x31')],function(_0x4f1fc5){return{'name':_0x4f1fc5[_0x6d6d('0x32')],'type':_0x4f1fc5[_0x6d6d('0x33')][_0x6d6d('0x34')]};});_0xdda3f2[_0x6d6d('0x35')]=_['map'](_0x6c4741,_0x6d6d('0x2d'));_0xdda3f2['query']=_[_0x6d6d('0x36')](_0x1c8340[_0x6d6d('0x37')]);_0xdda3f2['filters']=_[_0x6d6d('0x38')](_0xdda3f2[_0x6d6d('0x35')],_0xdda3f2[_0x6d6d('0x37')]);_0x428c17[_0x6d6d('0x39')]=_[_0x6d6d('0x38')](_0xdda3f2[_0x6d6d('0x35')],qs[_0x6d6d('0x3a')](_0x1c8340[_0x6d6d('0x37')][_0x6d6d('0x3a')]));_0x428c17[_0x6d6d('0x39')]=_0x428c17[_0x6d6d('0x39')][_0x6d6d('0x3b')]?_0x428c17[_0x6d6d('0x39')]:_0xdda3f2[_0x6d6d('0x35')];if(!_0x1c8340['query'][_0x6d6d('0x3c')](_0x6d6d('0x3d'))){_0x428c17[_0x6d6d('0x1e')]=qs[_0x6d6d('0x1e')](_0x1c8340['query']['limit']);_0x428c17[_0x6d6d('0x1f')]=qs[_0x6d6d('0x1f')](_0x1c8340[_0x6d6d('0x37')]['offset']);}_0x428c17[_0x6d6d('0x3e')]=qs[_0x6d6d('0x3f')](_0x1c8340[_0x6d6d('0x37')][_0x6d6d('0x3f')]);_0x428c17['where']=qs['filters'](_['pick'](_0x1c8340[_0x6d6d('0x37')],_0xdda3f2[_0x6d6d('0x40')]),_0x6c4741);if(_0x1c8340[_0x6d6d('0x37')][_0x6d6d('0x41')]){_0x428c17['where']=_[_0x6d6d('0x42')](_0x428c17[_0x6d6d('0x43')],{'$or':_[_0x6d6d('0x30')](_0x6c4741,function(_0x3c6d23){if(_0x3c6d23[_0x6d6d('0x33')]!==_0x6d6d('0x44')){var _0x4b457d={};_0x4b457d[_0x3c6d23[_0x6d6d('0x2d')]]={'$like':'%'+_0x1c8340[_0x6d6d('0x37')][_0x6d6d('0x41')]+'%'};return _0x4b457d;}})});}_0x428c17=_[_0x6d6d('0x42')]({},_0x428c17,_0x1c8340[_0x6d6d('0x45')]);var _0x3e27b7={'where':_0x428c17[_0x6d6d('0x43')]};return db['AnalyticMetric'][_0x6d6d('0x20')](_0x3e27b7)[_0x6d6d('0x27')](function(_0x16e177){_0x359cfd[_0x6d6d('0x20')]=_0x16e177;if(_0x1c8340[_0x6d6d('0x37')]['includeAll']){_0x428c17[_0x6d6d('0x46')]=[{'all':!![]}];}return db[_0x6d6d('0x47')]['findAll'](_0x428c17);})[_0x6d6d('0x27')](function(_0x50dc17){_0x359cfd[_0x6d6d('0x48')]=_0x50dc17;return _0x359cfd;})[_0x6d6d('0x27')](respondWithFilteredResult(_0x64d1f7,_0x428c17))['catch'](handleError(_0x64d1f7,null));};exports[_0x6d6d('0x49')]=function(_0x3324ec,_0x252cbe){var _0x4041f3={'raw':!![],'where':{'id':_0x3324ec['params']['id']}},_0xf7ea0d={};_0xf7ea0d['model']=_[_0x6d6d('0x36')](db['AnalyticMetric']['rawAttributes']);_0xf7ea0d[_0x6d6d('0x37')]=_[_0x6d6d('0x36')](_0x3324ec[_0x6d6d('0x37')]);_0xf7ea0d['filters']=_[_0x6d6d('0x38')](_0xf7ea0d['model'],_0xf7ea0d[_0x6d6d('0x37')]);_0x4041f3[_0x6d6d('0x39')]=_[_0x6d6d('0x38')](_0xf7ea0d[_0x6d6d('0x35')],qs[_0x6d6d('0x3a')](_0x3324ec[_0x6d6d('0x37')][_0x6d6d('0x3a')]));_0x4041f3['attributes']=_0x4041f3[_0x6d6d('0x39')][_0x6d6d('0x3b')]?_0x4041f3[_0x6d6d('0x39')]:_0xf7ea0d[_0x6d6d('0x35')];if(_0x3324ec[_0x6d6d('0x37')][_0x6d6d('0x4a')]){_0x4041f3[_0x6d6d('0x46')]=[{'all':!![]}];}_0x4041f3=_[_0x6d6d('0x42')]({},_0x4041f3,_0x3324ec[_0x6d6d('0x45')]);return db['AnalyticMetric']['find'](_0x4041f3)[_0x6d6d('0x27')](handleEntityNotFound(_0x252cbe,null))[_0x6d6d('0x27')](respondWithResult(_0x252cbe,null))[_0x6d6d('0x4b')](handleError(_0x252cbe,null));};exports[_0x6d6d('0x4c')]=function(_0xe2a20e,_0x492834){return db[_0x6d6d('0x47')][_0x6d6d('0x4c')](_0xe2a20e[_0x6d6d('0x4d')],{})[_0x6d6d('0x27')](function(_0x2ee917){var _0x23c2db=_0xe2a20e[_0x6d6d('0x4e')][_0x6d6d('0x29')]({'plain':!![]});if(!_0x23c2db)throw new Error(_0x6d6d('0x4f'));if(_0x23c2db[_0x6d6d('0x50')]===_0x6d6d('0x4e')){var _0x175e26=_0x2ee917['get']({'plain':!![]});var _0x190786=_0x6d6d('0x2a');return db[_0x6d6d('0x51')][_0x6d6d('0x52')]({'where':{'name':_0x190786,'userProfileId':_0x23c2db[_0x6d6d('0x53')]},'raw':!![]})['then'](function(_0x38c307){if(_0x38c307&&_0x38c307[_0x6d6d('0x54')]===0x0){return db[_0x6d6d('0x55')]['create']({'name':_0x175e26['name'],'resourceId':_0x175e26['id'],'type':_0x38c307[_0x6d6d('0x2d')],'sectionId':_0x38c307['id']},{})['then'](function(){return _0x2ee917;});}else{return _0x2ee917;}})[_0x6d6d('0x4b')](function(_0x995fe2){logger[_0x6d6d('0x2b')](_0x6d6d('0x56'),_0x995fe2);throw _0x995fe2;});}return _0x2ee917;})[_0x6d6d('0x27')](respondWithResult(_0x492834,0xc9))[_0x6d6d('0x4b')](handleError(_0x492834,null));};exports[_0x6d6d('0x26')]=function(_0x26c23a,_0x1a8f33){if(_0x26c23a[_0x6d6d('0x4d')]['id']){delete _0x26c23a['body']['id'];}return db[_0x6d6d('0x47')][_0x6d6d('0x52')]({'where':{'id':_0x26c23a[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x27')](handleEntityNotFound(_0x1a8f33,null))[_0x6d6d('0x27')](saveUpdates(_0x26c23a[_0x6d6d('0x4d')],null))[_0x6d6d('0x27')](respondWithResult(_0x1a8f33,null))['catch'](handleError(_0x1a8f33,null));};exports['destroy']=function(_0x3ad9b0,_0x122865){return db['AnalyticMetric'][_0x6d6d('0x52')]({'where':{'id':_0x3ad9b0[_0x6d6d('0x57')]['id']}})[_0x6d6d('0x27')](handleEntityNotFound(_0x122865,null))[_0x6d6d('0x27')](removeEntity(_0x122865,null))[_0x6d6d('0x4b')](handleError(_0x122865,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index d0cd987..999f109 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 _0x03db=['AnalyticMetric','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x79ed15,_0x2aceae){var _0x5b609e=function(_0x5916e8){while(--_0x5916e8){_0x79ed15['push'](_0x79ed15['shift']());}};_0x5b609e(++_0x2aceae);}(_0x03db,0x156));var _0xb03d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x03db[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb03d('0x0'));var util=require(_0xb03d('0x1'));var logger=require(_0xb03d('0x2'))(_0xb03d('0x3'));var moment=require('moment');var BPromise=require(_0xb03d('0x4'));var rp=require(_0xb03d('0x5'));var fs=require('fs');var path=require(_0xb03d('0x6'));var rimraf=require(_0xb03d('0x7'));var config=require(_0xb03d('0x8'));var attributes=require('./analyticMetric.attributes');module[_0xb03d('0x9')]=function(_0x1a01ba,_0x9a0f36){return _0x1a01ba['define'](_0xb03d('0xa'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9aac=['./analyticMetric.attributes','define','analytics_metrics','lodash','../../config/logger','api','bluebird','path','../../config/environment'];(function(_0x118867,_0x4fc6ee){var _0xc51d94=function(_0x45538b){while(--_0x45538b){_0x118867['push'](_0x118867['shift']());}};_0xc51d94(++_0x4fc6ee);}(_0x9aac,0x135));var _0xc9aa=function(_0x47ef54,_0x5b0637){_0x47ef54=_0x47ef54-0x0;var _0x323367=_0x9aac[_0x47ef54];return _0x323367;};'use strict';var _=require(_0xc9aa('0x0'));var util=require('util');var logger=require(_0xc9aa('0x1'))(_0xc9aa('0x2'));var moment=require('moment');var BPromise=require(_0xc9aa('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc9aa('0x4'));var rimraf=require('rimraf');var config=require(_0xc9aa('0x5'));var attributes=require(_0xc9aa('0x6'));module['exports']=function(_0x280687,_0x2f9029){return _0x280687[_0xc9aa('0x7')]('AnalyticMetric',attributes,{'tableName':_0xc9aa('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 6b7d1c9..a6e6bd4 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 _0x7df3=['request\x20sent','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s'];(function(_0x39e164,_0x2cb93b){var _0x13fa6b=function(_0x511cb2){while(--_0x511cb2){_0x39e164['push'](_0x39e164['shift']());}};_0x13fa6b(++_0x2cb93b);}(_0x7df3,0x14b));var _0x37df=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x7df3[_0x164eca];return _0x2ce562;};'use strict';var _=require(_0x37df('0x0'));var util=require('util');var moment=require(_0x37df('0x1'));var BPromise=require(_0x37df('0x2'));var rs=require(_0x37df('0x3'));var fs=require('fs');var Redis=require(_0x37df('0x4'));var db=require(_0x37df('0x5'))['db'];var utils=require(_0x37df('0x6'));var logger=require(_0x37df('0x7'))(_0x37df('0x8'));var config=require(_0x37df('0x9'));var jayson=require(_0x37df('0xa'));var client=jayson[_0x37df('0xb')][_0x37df('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2c1caf,_0x2ab2f2,_0xd605da){return new BPromise(function(_0xc56756,_0x1e1b16){return client[_0x37df('0xd')](_0x2c1caf,_0xd605da)[_0x37df('0xe')](function(_0x1cc92a){logger[_0x37df('0xf')](_0x37df('0x10'),_0x2ab2f2,'request\x20sent');logger[_0x37df('0x11')](_0x37df('0x12'),_0x2ab2f2,_0x37df('0x13'),JSON['stringify'](_0x1cc92a));if(_0x1cc92a[_0x37df('0x14')]){if(_0x1cc92a['error'][_0x37df('0x15')]===0x1f4){logger[_0x37df('0x14')]('AnalyticMetric,\x20%s,\x20%s',_0x2ab2f2,_0x1cc92a['error'][_0x37df('0x16')]);return _0x1e1b16(_0x1cc92a[_0x37df('0x14')][_0x37df('0x16')]);}logger[_0x37df('0x14')](_0x37df('0x10'),_0x2ab2f2,_0x1cc92a[_0x37df('0x14')][_0x37df('0x16')]);return _0xc56756(_0x1cc92a[_0x37df('0x14')][_0x37df('0x16')]);}else{logger[_0x37df('0xf')](_0x37df('0x10'),_0x2ab2f2,_0x37df('0x13'));_0xc56756(_0x1cc92a[_0x37df('0x17')]['message']);}})[_0x37df('0x18')](function(_0x51f115){logger[_0x37df('0x14')]('AnalyticMetric,\x20%s,\x20%s',_0x2ab2f2,_0x51f115);_0x1e1b16(_0x51f115);});});} \ No newline at end of file +var _0xe2cb=['info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','error','code','message','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x19416d,_0x54c85e){var _0x17528f=function(_0x29fb3f){while(--_0x29fb3f){_0x19416d['push'](_0x19416d['shift']());}};_0x17528f(++_0x54c85e);}(_0xe2cb,0xcd));var _0xbe2c=function(_0x35112c,_0x2240b2){_0x35112c=_0x35112c-0x0;var _0x3bda61=_0xe2cb[_0x35112c];return _0x3bda61;};'use strict';var _=require('lodash');var util=require(_0xbe2c('0x0'));var moment=require(_0xbe2c('0x1'));var BPromise=require(_0xbe2c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbe2c('0x3'));var db=require(_0xbe2c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbe2c('0x5'));var config=require(_0xbe2c('0x6'));var jayson=require(_0xbe2c('0x7'));var client=jayson[_0xbe2c('0x8')][_0xbe2c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa5f10a,_0x336335,_0x36ffde){return new BPromise(function(_0x21b19e,_0x3a1244){return client[_0xbe2c('0xa')](_0xa5f10a,_0x36ffde)['then'](function(_0x59a4f9){logger[_0xbe2c('0xb')](_0xbe2c('0xc'),_0x336335,_0xbe2c('0xd'));logger[_0xbe2c('0xe')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x336335,_0xbe2c('0xd'),JSON['stringify'](_0x59a4f9));if(_0x59a4f9['error']){if(_0x59a4f9[_0xbe2c('0xf')][_0xbe2c('0x10')]===0x1f4){logger['error'](_0xbe2c('0xc'),_0x336335,_0x59a4f9[_0xbe2c('0xf')][_0xbe2c('0x11')]);return _0x3a1244(_0x59a4f9[_0xbe2c('0xf')][_0xbe2c('0x11')]);}logger['error'](_0xbe2c('0xc'),_0x336335,_0x59a4f9['error'][_0xbe2c('0x11')]);return _0x21b19e(_0x59a4f9[_0xbe2c('0xf')][_0xbe2c('0x11')]);}else{logger[_0xbe2c('0xb')](_0xbe2c('0xc'),_0x336335,'request\x20sent');_0x21b19e(_0x59a4f9['result'][_0xbe2c('0x11')]);}})['catch'](function(_0x2cf8dc){logger[_0xbe2c('0xf')](_0xbe2c('0xc'),_0x336335,_0x2cf8dc);_0x3a1244(_0x2cf8dc);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 30fdf70..a068ae1 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 _0x7118=['show','post','create','put','destroy','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','index','/:id','isAuthenticated'];(function(_0xe5b349,_0x5f06e4){var _0x26b0ad=function(_0x1a97f1){while(--_0x1a97f1){_0xe5b349['push'](_0xe5b349['shift']());}};_0x26b0ad(++_0x5f06e4);}(_0x7118,0x159));var _0x8711=function(_0x1bb4a8,_0x11b51e){_0x1bb4a8=_0x1bb4a8-0x0;var _0x270930=_0x7118[_0x1bb4a8];return _0x270930;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8711('0x0'));var timeout=require(_0x8711('0x1'));var express=require('express');var router=express[_0x8711('0x2')]();var fs_extra=require(_0x8711('0x3'));var auth=require(_0x8711('0x4'));var interaction=require(_0x8711('0x5'));var config=require(_0x8711('0x6'));var controller=require(_0x8711('0x7'));router[_0x8711('0x8')]('/',auth['isAuthenticated'](),controller[_0x8711('0x9')]);router[_0x8711('0x8')](_0x8711('0xa'),auth[_0x8711('0xb')](),controller[_0x8711('0xc')]);router[_0x8711('0xd')]('/',auth[_0x8711('0xb')](),controller[_0x8711('0xe')]);router[_0x8711('0xf')](_0x8711('0xa'),auth[_0x8711('0xb')](),controller['update']);router['delete'](_0x8711('0xa'),auth[_0x8711('0xb')](),controller[_0x8711('0x10')]);module['exports']=router; \ No newline at end of file +var _0x3981=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','/:id','post','create','put','delete','destroy'];(function(_0x5e51c0,_0x481fc4){var _0x200337=function(_0x5ee1ce){while(--_0x5ee1ce){_0x5e51c0['push'](_0x5e51c0['shift']());}};_0x200337(++_0x481fc4);}(_0x3981,0x144));var _0x1398=function(_0x582ef4,_0x3f1108){_0x582ef4=_0x582ef4-0x0;var _0x2aeed2=_0x3981[_0x582ef4];return _0x2aeed2;};'use strict';var multer=require(_0x1398('0x0'));var util=require('util');var path=require(_0x1398('0x1'));var timeout=require(_0x1398('0x2'));var express=require(_0x1398('0x3'));var router=express[_0x1398('0x4')]();var fs_extra=require(_0x1398('0x5'));var auth=require(_0x1398('0x6'));var interaction=require(_0x1398('0x7'));var config=require(_0x1398('0x8'));var controller=require(_0x1398('0x9'));router[_0x1398('0xa')]('/',auth[_0x1398('0xb')](),controller['index']);router[_0x1398('0xa')](_0x1398('0xc'),auth[_0x1398('0xb')](),controller['show']);router[_0x1398('0xd')]('/',auth[_0x1398('0xb')](),controller[_0x1398('0xe')]);router[_0x1398('0xf')](_0x1398('0xc'),auth[_0x1398('0xb')](),controller['update']);router[_0x1398('0x10')](_0x1398('0xc'),auth[_0x1398('0xb')](),controller[_0x1398('0x11')]);module[_0x1398('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index dd479d3..9d8fe60 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 _0x1db5=['sequelize','TEXT'];(function(_0x5884b2,_0xa393d2){var _0x31574f=function(_0x316964){while(--_0x316964){_0x5884b2['push'](_0x5884b2['shift']());}};_0x31574f(++_0xa393d2);}(_0x1db5,0x1c0));var _0x51db=function(_0x32e3bb,_0x24dc99){_0x32e3bb=_0x32e3bb-0x0;var _0x572aca=_0x1db5[_0x32e3bb];return _0x572aca;};'use strict';var Sequelize=require(_0x51db('0x0'));module['exports']={'tree':{'type':Sequelize[_0x51db('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x1b9b=['exports','sequelize'];(function(_0x509f40,_0x59b376){var _0x1786f1=function(_0x32fb5f){while(--_0x32fb5f){_0x509f40['push'](_0x509f40['shift']());}};_0x1786f1(++_0x59b376);}(_0x1b9b,0xb9));var _0xb1b9=function(_0x200b8a,_0x23cd2b){_0x200b8a=_0x200b8a-0x0;var _0x4d9ca9=_0x1b9b[_0x200b8a];return _0x4d9ca9;};'use strict';var Sequelize=require(_0xb1b9('0x0'));module[_0xb1b9('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 881f5ce..7eabc96 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 _0xffc4=['count','offset','set','apply','reject','then','destroy','error','stack','name','index','AnalyticTreeReport','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','map','filter','options','includeAll','include','rows','catch','show','find','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit'];(function(_0x45f741,_0xc0ea1d){var _0x12e05a=function(_0x483c01){while(--_0x483c01){_0x45f741['push'](_0x45f741['shift']());}};_0x12e05a(++_0xc0ea1d);}(_0xffc4,0x6c));var _0x4ffc=function(_0x42dd53,_0xec94a){_0x42dd53=_0x42dd53-0x0;var _0x3d77cb=_0xffc4[_0x42dd53];return _0x3d77cb;};'use strict';var emlformat=require(_0x4ffc('0x0'));var rimraf=require(_0x4ffc('0x1'));var zipdir=require(_0x4ffc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4ffc('0x3'));var moment=require(_0x4ffc('0x4'));var BPromise=require(_0x4ffc('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4ffc('0x6'));var sox=require(_0x4ffc('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4ffc('0x8'));var _=require(_0x4ffc('0x9'));var squel=require('squel');var crypto=require(_0x4ffc('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4ffc('0xb'));var toCsv=require(_0x4ffc('0xc'));var querystring=require(_0x4ffc('0xd'));var Papa=require(_0x4ffc('0xe'));var Redis=require('ioredis');var authService=require(_0x4ffc('0xf'));var qs=require(_0x4ffc('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4ffc('0x11'));var logger=require(_0x4ffc('0x12'))(_0x4ffc('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4ffc('0x14'));var db=require(_0x4ffc('0x15'))['db'];function respondWithStatusCode(_0x2b68f6,_0x71d8f9){_0x71d8f9=_0x71d8f9||0xcc;return function(_0x5df1f1){if(_0x5df1f1){return _0x2b68f6[_0x4ffc('0x16')](_0x71d8f9);}return _0x2b68f6[_0x4ffc('0x17')](_0x71d8f9)[_0x4ffc('0x18')]();};}function respondWithResult(_0x1d2a88,_0x1bd94f){_0x1bd94f=_0x1bd94f||0xc8;return function(_0xcc8b6b){if(_0xcc8b6b){return _0x1d2a88[_0x4ffc('0x17')](_0x1bd94f)[_0x4ffc('0x19')](_0xcc8b6b);}};}function respondWithFilteredResult(_0x19f2aa,_0x6e4c4b){return function(_0x1c33f6){if(_0x1c33f6){var _0x578a70=typeof _0x6e4c4b['offset']===_0x4ffc('0x1a')&&typeof _0x6e4c4b[_0x4ffc('0x1b')]===_0x4ffc('0x1a');var _0x7a9f77=_0x1c33f6[_0x4ffc('0x1c')];var _0x2186e9=_0x578a70?0x0:_0x6e4c4b[_0x4ffc('0x1d')];var _0x2e682d=_0x578a70?_0x1c33f6[_0x4ffc('0x1c')]:_0x6e4c4b[_0x4ffc('0x1d')]+_0x6e4c4b[_0x4ffc('0x1b')];var _0x36d69f;if(_0x2e682d>=_0x7a9f77){_0x2e682d=_0x7a9f77;_0x36d69f=0xc8;}else{_0x36d69f=0xce;}_0x19f2aa[_0x4ffc('0x17')](_0x36d69f);return _0x19f2aa[_0x4ffc('0x1e')]('Content-Range',_0x2186e9+'-'+_0x2e682d+'/'+_0x7a9f77)[_0x4ffc('0x19')](_0x1c33f6);}return null;};}function patchUpdates(_0x1e5230){return function(_0x56660a){try{jsonpatch[_0x4ffc('0x1f')](_0x56660a,_0x1e5230,!![]);}catch(_0x12e28d){return BPromise[_0x4ffc('0x20')](_0x12e28d);}return _0x56660a['save']();};}function saveUpdates(_0x3b2191,_0x109442){return function(_0x25984a){if(_0x25984a){return _0x25984a['update'](_0x3b2191)[_0x4ffc('0x21')](function(_0x5b4bdb){return _0x5b4bdb;});}return null;};}function removeEntity(_0x1109c6,_0x2565e4){return function(_0x52bd14){if(_0x52bd14){return _0x52bd14[_0x4ffc('0x22')]()[_0x4ffc('0x21')](function(){_0x1109c6[_0x4ffc('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bd2ee,_0x1ac269){return function(_0x5ce627){if(!_0x5ce627){_0x4bd2ee[_0x4ffc('0x16')](0x194);}return _0x5ce627;};}function handleError(_0x244145,_0xdd3cec){_0xdd3cec=_0xdd3cec||0x1f4;return function(_0xe233b3){logger[_0x4ffc('0x23')](_0xe233b3[_0x4ffc('0x24')]);if(_0xe233b3[_0x4ffc('0x25')]){delete _0xe233b3[_0x4ffc('0x25')];}_0x244145['status'](_0xdd3cec)['send'](_0xe233b3);};}exports[_0x4ffc('0x26')]=function(_0x3e9a42,_0x16dceb){var _0x1e2854={},_0x2758bd={},_0x334c0f={'count':0x0,'rows':[]};var _0x403bf8=_['map'](db[_0x4ffc('0x27')][_0x4ffc('0x28')],function(_0xb294d0){return{'name':_0xb294d0[_0x4ffc('0x29')],'type':_0xb294d0['type'][_0x4ffc('0x2a')]};});_0x2758bd['model']=_['map'](_0x403bf8,_0x4ffc('0x25'));_0x2758bd['query']=_[_0x4ffc('0x2b')](_0x3e9a42[_0x4ffc('0x2c')]);_0x2758bd[_0x4ffc('0x2d')]=_[_0x4ffc('0x2e')](_0x2758bd[_0x4ffc('0x2f')],_0x2758bd[_0x4ffc('0x2c')]);_0x1e2854[_0x4ffc('0x30')]=_[_0x4ffc('0x2e')](_0x2758bd[_0x4ffc('0x2f')],qs[_0x4ffc('0x31')](_0x3e9a42[_0x4ffc('0x2c')]['fields']));_0x1e2854[_0x4ffc('0x30')]=_0x1e2854[_0x4ffc('0x30')][_0x4ffc('0x32')]?_0x1e2854['attributes']:_0x2758bd[_0x4ffc('0x2f')];if(!_0x3e9a42[_0x4ffc('0x2c')][_0x4ffc('0x33')](_0x4ffc('0x34'))){_0x1e2854['limit']=qs[_0x4ffc('0x1b')](_0x3e9a42[_0x4ffc('0x2c')]['limit']);_0x1e2854['offset']=qs[_0x4ffc('0x1d')](_0x3e9a42['query'][_0x4ffc('0x1d')]);}_0x1e2854[_0x4ffc('0x35')]=qs[_0x4ffc('0x36')](_0x3e9a42['query'][_0x4ffc('0x36')]);_0x1e2854[_0x4ffc('0x37')]=qs[_0x4ffc('0x2d')](_['pick'](_0x3e9a42['query'],_0x2758bd[_0x4ffc('0x2d')]),_0x403bf8);if(_0x3e9a42[_0x4ffc('0x2c')]['filter']){_0x1e2854[_0x4ffc('0x37')]=_[_0x4ffc('0x38')](_0x1e2854[_0x4ffc('0x37')],{'$or':_[_0x4ffc('0x39')](_0x403bf8,function(_0x18625c){if(_0x18625c['type']!=='VIRTUAL'){var _0xf7f0d2={};_0xf7f0d2[_0x18625c[_0x4ffc('0x25')]]={'$like':'%'+_0x3e9a42[_0x4ffc('0x2c')][_0x4ffc('0x3a')]+'%'};return _0xf7f0d2;}})});}_0x1e2854=_[_0x4ffc('0x38')]({},_0x1e2854,_0x3e9a42[_0x4ffc('0x3b')]);var _0x3b3da9={'where':_0x1e2854['where']};return db['AnalyticTreeReport'][_0x4ffc('0x1c')](_0x3b3da9)[_0x4ffc('0x21')](function(_0x6bf5c){_0x334c0f[_0x4ffc('0x1c')]=_0x6bf5c;if(_0x3e9a42[_0x4ffc('0x2c')][_0x4ffc('0x3c')]){_0x1e2854[_0x4ffc('0x3d')]=[{'all':!![]}];}return db[_0x4ffc('0x27')]['findAll'](_0x1e2854);})[_0x4ffc('0x21')](function(_0x14d9a6){_0x334c0f[_0x4ffc('0x3e')]=_0x14d9a6;return _0x334c0f;})[_0x4ffc('0x21')](respondWithFilteredResult(_0x16dceb,_0x1e2854))[_0x4ffc('0x3f')](handleError(_0x16dceb,null));};exports[_0x4ffc('0x40')]=function(_0x563995,_0xdd1086){var _0x49de5b={'raw':!![],'where':{'id':_0x563995['params']['id']}},_0x1d055e={};_0x1d055e[_0x4ffc('0x2f')]=_[_0x4ffc('0x2b')](db['AnalyticTreeReport'][_0x4ffc('0x28')]);_0x1d055e['query']=_[_0x4ffc('0x2b')](_0x563995[_0x4ffc('0x2c')]);_0x1d055e[_0x4ffc('0x2d')]=_[_0x4ffc('0x2e')](_0x1d055e[_0x4ffc('0x2f')],_0x1d055e['query']);_0x49de5b[_0x4ffc('0x30')]=_[_0x4ffc('0x2e')](_0x1d055e['model'],qs['fields'](_0x563995[_0x4ffc('0x2c')][_0x4ffc('0x31')]));_0x49de5b['attributes']=_0x49de5b[_0x4ffc('0x30')][_0x4ffc('0x32')]?_0x49de5b['attributes']:_0x1d055e[_0x4ffc('0x2f')];if(_0x563995['query']['includeAll']){_0x49de5b['include']=[{'all':!![]}];}_0x49de5b=_[_0x4ffc('0x38')]({},_0x49de5b,_0x563995['options']);return db[_0x4ffc('0x27')][_0x4ffc('0x41')](_0x49de5b)[_0x4ffc('0x21')](handleEntityNotFound(_0xdd1086,null))[_0x4ffc('0x21')](respondWithResult(_0xdd1086,null))[_0x4ffc('0x3f')](handleError(_0xdd1086,null));};exports['create']=function(_0x364429,_0x23b56b){return db[_0x4ffc('0x27')]['create'](_0x364429[_0x4ffc('0x42')],{})[_0x4ffc('0x21')](respondWithResult(_0x23b56b,0xc9))[_0x4ffc('0x3f')](handleError(_0x23b56b,null));};exports['update']=function(_0x478d98,_0x174752){if(_0x478d98[_0x4ffc('0x42')]['id']){delete _0x478d98[_0x4ffc('0x42')]['id'];}return db[_0x4ffc('0x27')][_0x4ffc('0x41')]({'where':{'id':_0x478d98['params']['id']}})[_0x4ffc('0x21')](handleEntityNotFound(_0x174752,null))[_0x4ffc('0x21')](saveUpdates(_0x478d98['body'],null))[_0x4ffc('0x21')](respondWithResult(_0x174752,null))[_0x4ffc('0x3f')](handleError(_0x174752,null));};exports[_0x4ffc('0x22')]=function(_0x1f02ca,_0x5db87c){return db[_0x4ffc('0x27')][_0x4ffc('0x41')]({'where':{'id':_0x1f02ca[_0x4ffc('0x43')]['id']}})['then'](handleEntityNotFound(_0x5db87c,null))[_0x4ffc('0x21')](removeEntity(_0x5db87c,null))[_0x4ffc('0x3f')](handleError(_0x5db87c,null));}; \ No newline at end of file +var _0x3da6=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','include','rows','catch','show','params','includeAll','find','create','body','update','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','save','destroy','error','name','send','index','map','AnalyticTreeReport','rawAttributes','key','query','keys','filters','model','attributes','intersection','fields'];(function(_0xb7b878,_0x5c3b92){var _0x3c84b9=function(_0x21d5a2){while(--_0x21d5a2){_0xb7b878['push'](_0xb7b878['shift']());}};_0x3c84b9(++_0x5c3b92);}(_0x3da6,0x126));var _0x63da=function(_0x586642,_0x3b2e5d){_0x586642=_0x586642-0x0;var _0xef997a=_0x3da6[_0x586642];return _0xef997a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x63da('0x0'));var zipdir=require(_0x63da('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x63da('0x2'));var moment=require(_0x63da('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x63da('0x4'));var util=require(_0x63da('0x5'));var path=require('path');var sox=require(_0x63da('0x6'));var csv=require(_0x63da('0x7'));var ejs=require(_0x63da('0x8'));var fs=require('fs');var fs_extra=require(_0x63da('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x63da('0xa'));var toCsv=require('to-csv');var querystring=require(_0x63da('0xb'));var Papa=require(_0x63da('0xc'));var Redis=require(_0x63da('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x63da('0xe'));var as=require(_0x63da('0xf'));var hardwareService=require(_0x63da('0x10'));var logger=require(_0x63da('0x11'))(_0x63da('0x12'));var utils=require(_0x63da('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x63da('0x14'));var db=require(_0x63da('0x15'))['db'];function respondWithStatusCode(_0x173624,_0x592a2d){_0x592a2d=_0x592a2d||0xcc;return function(_0x3c7330){if(_0x3c7330){return _0x173624[_0x63da('0x16')](_0x592a2d);}return _0x173624['status'](_0x592a2d)['end']();};}function respondWithResult(_0x50afa4,_0x2de1f9){_0x2de1f9=_0x2de1f9||0xc8;return function(_0x346178){if(_0x346178){return _0x50afa4[_0x63da('0x17')](_0x2de1f9)['json'](_0x346178);}};}function respondWithFilteredResult(_0x16f45b,_0x11e4f3){return function(_0x199628){if(_0x199628){var _0x92e0b7=typeof _0x11e4f3[_0x63da('0x18')]===_0x63da('0x19')&&typeof _0x11e4f3['limit']===_0x63da('0x19');var _0x5c697d=_0x199628[_0x63da('0x1a')];var _0x1c4532=_0x92e0b7?0x0:_0x11e4f3[_0x63da('0x18')];var _0x3218ea=_0x92e0b7?_0x199628[_0x63da('0x1a')]:_0x11e4f3['offset']+_0x11e4f3[_0x63da('0x1b')];var _0x1f6ffa;if(_0x3218ea>=_0x5c697d){_0x3218ea=_0x5c697d;_0x1f6ffa=0xc8;}else{_0x1f6ffa=0xce;}_0x16f45b[_0x63da('0x17')](_0x1f6ffa);return _0x16f45b[_0x63da('0x1c')]('Content-Range',_0x1c4532+'-'+_0x3218ea+'/'+_0x5c697d)['json'](_0x199628);}return null;};}function patchUpdates(_0x425d1b){return function(_0x13d80d){try{jsonpatch['apply'](_0x13d80d,_0x425d1b,!![]);}catch(_0x100ae6){return BPromise['reject'](_0x100ae6);}return _0x13d80d[_0x63da('0x1d')]();};}function saveUpdates(_0x3128b0,_0x435cdd){return function(_0x2a78aa){if(_0x2a78aa){return _0x2a78aa['update'](_0x3128b0)['then'](function(_0x1cad00){return _0x1cad00;});}return null;};}function removeEntity(_0x3b02ec,_0x358f47){return function(_0x4f8006){if(_0x4f8006){return _0x4f8006[_0x63da('0x1e')]()['then'](function(){_0x3b02ec[_0x63da('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x251910,_0x186bf3){return function(_0x4a3109){if(!_0x4a3109){_0x251910[_0x63da('0x16')](0x194);}return _0x4a3109;};}function handleError(_0x173ffb,_0x227c5e){_0x227c5e=_0x227c5e||0x1f4;return function(_0x201478){logger[_0x63da('0x1f')](_0x201478['stack']);if(_0x201478[_0x63da('0x20')]){delete _0x201478[_0x63da('0x20')];}_0x173ffb[_0x63da('0x17')](_0x227c5e)[_0x63da('0x21')](_0x201478);};}exports[_0x63da('0x22')]=function(_0x391253,_0x51b05c){var _0x2cd60e={},_0x20bcfe={},_0x1f1a50={'count':0x0,'rows':[]};var _0x5830d2=_[_0x63da('0x23')](db[_0x63da('0x24')][_0x63da('0x25')],function(_0x1b61e9){return{'name':_0x1b61e9['fieldName'],'type':_0x1b61e9['type'][_0x63da('0x26')]};});_0x20bcfe['model']=_[_0x63da('0x23')](_0x5830d2,_0x63da('0x20'));_0x20bcfe[_0x63da('0x27')]=_[_0x63da('0x28')](_0x391253[_0x63da('0x27')]);_0x20bcfe[_0x63da('0x29')]=_['intersection'](_0x20bcfe[_0x63da('0x2a')],_0x20bcfe['query']);_0x2cd60e[_0x63da('0x2b')]=_[_0x63da('0x2c')](_0x20bcfe['model'],qs[_0x63da('0x2d')](_0x391253[_0x63da('0x27')]['fields']));_0x2cd60e[_0x63da('0x2b')]=_0x2cd60e[_0x63da('0x2b')][_0x63da('0x2e')]?_0x2cd60e[_0x63da('0x2b')]:_0x20bcfe[_0x63da('0x2a')];if(!_0x391253[_0x63da('0x27')][_0x63da('0x2f')](_0x63da('0x30'))){_0x2cd60e['limit']=qs[_0x63da('0x1b')](_0x391253['query'][_0x63da('0x1b')]);_0x2cd60e[_0x63da('0x18')]=qs[_0x63da('0x18')](_0x391253['query']['offset']);}_0x2cd60e[_0x63da('0x31')]=qs[_0x63da('0x32')](_0x391253[_0x63da('0x27')][_0x63da('0x32')]);_0x2cd60e[_0x63da('0x33')]=qs[_0x63da('0x29')](_[_0x63da('0x34')](_0x391253[_0x63da('0x27')],_0x20bcfe[_0x63da('0x29')]),_0x5830d2);if(_0x391253['query'][_0x63da('0x35')]){_0x2cd60e[_0x63da('0x33')]=_[_0x63da('0x36')](_0x2cd60e[_0x63da('0x33')],{'$or':_['map'](_0x5830d2,function(_0x49647f){if(_0x49647f['type']!==_0x63da('0x37')){var _0x3eacd1={};_0x3eacd1[_0x49647f[_0x63da('0x20')]]={'$like':'%'+_0x391253[_0x63da('0x27')]['filter']+'%'};return _0x3eacd1;}})});}_0x2cd60e=_[_0x63da('0x36')]({},_0x2cd60e,_0x391253[_0x63da('0x38')]);var _0x5610cf={'where':_0x2cd60e['where']};return db[_0x63da('0x24')][_0x63da('0x1a')](_0x5610cf)[_0x63da('0x39')](function(_0x167e8a){_0x1f1a50[_0x63da('0x1a')]=_0x167e8a;if(_0x391253[_0x63da('0x27')]['includeAll']){_0x2cd60e[_0x63da('0x3a')]=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0x2cd60e);})['then'](function(_0x37f0e8){_0x1f1a50[_0x63da('0x3b')]=_0x37f0e8;return _0x1f1a50;})[_0x63da('0x39')](respondWithFilteredResult(_0x51b05c,_0x2cd60e))[_0x63da('0x3c')](handleError(_0x51b05c,null));};exports[_0x63da('0x3d')]=function(_0x3e514f,_0x1208b6){var _0x1f0df0={'raw':!![],'where':{'id':_0x3e514f[_0x63da('0x3e')]['id']}},_0x41570d={};_0x41570d[_0x63da('0x2a')]=_[_0x63da('0x28')](db['AnalyticTreeReport']['rawAttributes']);_0x41570d['query']=_[_0x63da('0x28')](_0x3e514f[_0x63da('0x27')]);_0x41570d['filters']=_[_0x63da('0x2c')](_0x41570d[_0x63da('0x2a')],_0x41570d[_0x63da('0x27')]);_0x1f0df0['attributes']=_['intersection'](_0x41570d['model'],qs['fields'](_0x3e514f[_0x63da('0x27')][_0x63da('0x2d')]));_0x1f0df0[_0x63da('0x2b')]=_0x1f0df0[_0x63da('0x2b')][_0x63da('0x2e')]?_0x1f0df0[_0x63da('0x2b')]:_0x41570d[_0x63da('0x2a')];if(_0x3e514f['query'][_0x63da('0x3f')]){_0x1f0df0['include']=[{'all':!![]}];}_0x1f0df0=_[_0x63da('0x36')]({},_0x1f0df0,_0x3e514f['options']);return db[_0x63da('0x24')][_0x63da('0x40')](_0x1f0df0)[_0x63da('0x39')](handleEntityNotFound(_0x1208b6,null))[_0x63da('0x39')](respondWithResult(_0x1208b6,null))['catch'](handleError(_0x1208b6,null));};exports[_0x63da('0x41')]=function(_0x1a5ceb,_0x3d4be8){return db['AnalyticTreeReport'][_0x63da('0x41')](_0x1a5ceb[_0x63da('0x42')],{})['then'](respondWithResult(_0x3d4be8,0xc9))[_0x63da('0x3c')](handleError(_0x3d4be8,null));};exports[_0x63da('0x43')]=function(_0x578a6d,_0x3cc1a2){if(_0x578a6d[_0x63da('0x42')]['id']){delete _0x578a6d[_0x63da('0x42')]['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x578a6d['params']['id']}})[_0x63da('0x39')](handleEntityNotFound(_0x3cc1a2,null))[_0x63da('0x39')](saveUpdates(_0x578a6d[_0x63da('0x42')],null))[_0x63da('0x39')](respondWithResult(_0x3cc1a2,null))[_0x63da('0x3c')](handleError(_0x3cc1a2,null));};exports[_0x63da('0x1e')]=function(_0x1935c3,_0x32cac9){return db[_0x63da('0x24')][_0x63da('0x40')]({'where':{'id':_0x1935c3[_0x63da('0x3e')]['id']}})[_0x63da('0x39')](handleEntityNotFound(_0x32cac9,null))[_0x63da('0x39')](removeEntity(_0x32cac9,null))[_0x63da('0x3c')](handleError(_0x32cac9,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 5c8bcad..da697d8 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 _0x9311=['../../config/logger','request-promise','path','rimraf','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util'];(function(_0x34d346,_0x4c6502){var _0x122d76=function(_0x22a5fd){while(--_0x22a5fd){_0x34d346['push'](_0x34d346['shift']());}};_0x122d76(++_0x4c6502);}(_0x9311,0x1a2));var _0x1931=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9311[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x1931('0x0'));var util=require(_0x1931('0x1'));var logger=require(_0x1931('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1931('0x3'));var fs=require('fs');var path=require(_0x1931('0x4'));var rimraf=require(_0x1931('0x5'));var config=require('../../config/environment');var attributes=require('./analyticTreeReport.attributes');module[_0x1931('0x6')]=function(_0x271523,_0x2b4068){return _0x271523[_0x1931('0x7')](_0x1931('0x8'),attributes,{'tableName':_0x1931('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1607=['exports','AnalyticTreeReport','analytics_report_trees','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes'];(function(_0x5aef75,_0x39228e){var _0x1bb942=function(_0x33884c){while(--_0x33884c){_0x5aef75['push'](_0x5aef75['shift']());}};_0x1bb942(++_0x39228e);}(_0x1607,0xb7));var _0x7160=function(_0x28e1dd,_0x1fa30f){_0x28e1dd=_0x28e1dd-0x0;var _0x14e3fe=_0x1607[_0x28e1dd];return _0x14e3fe;};'use strict';var _=require('lodash');var util=require(_0x7160('0x0'));var logger=require(_0x7160('0x1'))(_0x7160('0x2'));var moment=require('moment');var BPromise=require(_0x7160('0x3'));var rp=require(_0x7160('0x4'));var fs=require('fs');var path=require(_0x7160('0x5'));var rimraf=require(_0x7160('0x6'));var config=require(_0x7160('0x7'));var attributes=require(_0x7160('0x8'));module[_0x7160('0x9')]=function(_0x492370,_0x5bb043){return _0x492370['define'](_0x7160('0xa'),attributes,{'tableName':_0x7160('0xb'),'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 be8bdde..a6f147f 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(_0x227bfa,_0x51bedc){var _0x331aba=function(_0x36e65b){while(--_0x36e65b){_0x227bfa['push'](_0x227bfa['shift']());}};_0x331aba(++_0x51bedc);}(_0x2ef3,0xba));var _0x32ef=function(_0x144c0e,_0x57d78e){_0x144c0e=_0x144c0e-0x0;var _0x2c8e1f=_0x2ef3[_0x144c0e];return _0x2c8e1f;};'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 _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x11b25a,_0x5e4f65){var _0x27b8b2=function(_0x576318){while(--_0x576318){_0x11b25a['push'](_0x11b25a['shift']());}};_0x27b8b2(++_0x5e4f65);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x5f66[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index e85d5c3..7a99c1f 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 _0x03dd=['destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','get','isAuthenticated','create','/:id','update','delete'];(function(_0x592cbc,_0x5ec030){var _0x39b8d9=function(_0x39055c){while(--_0x39055c){_0x592cbc['push'](_0x592cbc['shift']());}};_0x39b8d9(++_0x5ec030);}(_0x03dd,0x72));var _0xd03d=function(_0x12fec1,_0x20be9c){_0x12fec1=_0x12fec1-0x0;var _0x26c3af=_0x03dd[_0x12fec1];return _0x26c3af;};'use strict';var multer=require(_0xd03d('0x0'));var util=require('util');var path=require(_0xd03d('0x1'));var timeout=require('connect-timeout');var express=require(_0xd03d('0x2'));var router=express[_0xd03d('0x3')]();var fs_extra=require(_0xd03d('0x4'));var auth=require(_0xd03d('0x5'));var interaction=require(_0xd03d('0x6'));var config=require('../../config/environment');var controller=require(_0xd03d('0x7'));router[_0xd03d('0x8')]('/',auth[_0xd03d('0x9')](),controller['index']);router[_0xd03d('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xd03d('0x9')](),controller[_0xd03d('0xa')]);router['put'](_0xd03d('0xb'),auth[_0xd03d('0x9')](),controller[_0xd03d('0xc')]);router[_0xd03d('0xd')]('/:id',auth[_0xd03d('0x9')](),controller[_0xd03d('0xe')]);module[_0xd03d('0xf')]=router; \ No newline at end of file +var _0x19e2=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','create','put','/:id','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x40ca6f,_0x806df8){var _0x4ad99d=function(_0x2785f4){while(--_0x2785f4){_0x40ca6f['push'](_0x40ca6f['shift']());}};_0x4ad99d(++_0x806df8);}(_0x19e2,0x19a));var _0x219e=function(_0x341de2,_0x31c27b){_0x341de2=_0x341de2-0x0;var _0x3d10b1=_0x19e2[_0x341de2];return _0x3d10b1;};'use strict';var multer=require(_0x219e('0x0'));var util=require(_0x219e('0x1'));var path=require(_0x219e('0x2'));var timeout=require(_0x219e('0x3'));var express=require(_0x219e('0x4'));var router=express[_0x219e('0x5')]();var fs_extra=require(_0x219e('0x6'));var auth=require(_0x219e('0x7'));var interaction=require(_0x219e('0x8'));var config=require(_0x219e('0x9'));var controller=require('./analyticTreeReport.controller');router[_0x219e('0xa')]('/',auth[_0x219e('0xb')](),controller[_0x219e('0xc')]);router[_0x219e('0xa')]('/:id',auth[_0x219e('0xb')](),controller[_0x219e('0xd')]);router['post']('/',auth[_0x219e('0xb')](),controller[_0x219e('0xe')]);router[_0x219e('0xf')](_0x219e('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x219e('0x11')](_0x219e('0x10'),auth[_0x219e('0xb')](),controller['destroy']);module[_0x219e('0x12')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 9077e08..25523db 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 _0x87ae=['STRING'];(function(_0x239cac,_0x143b28){var _0x1f3bbf=function(_0x572828){while(--_0x572828){_0x239cac['push'](_0x239cac['shift']());}};_0x1f3bbf(++_0x143b28);}(_0x87ae,0xf5));var _0xe87a=function(_0x22e47a,_0x4ea10c){_0x22e47a=_0x22e47a-0x0;var _0x15a12a=_0x87ae[_0x22e47a];return _0x15a12a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe87a('0x0')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x18a5=['exports','STRING','sequelize'];(function(_0x43548f,_0x24ebb8){var _0x49b301=function(_0x45c336){while(--_0x45c336){_0x43548f['push'](_0x43548f['shift']());}};_0x49b301(++_0x24ebb8);}(_0x18a5,0x164));var _0x518a=function(_0x1f9ba0,_0x1d91d5){_0x1f9ba0=_0x1f9ba0-0x0;var _0x3267d5=_0x18a5[_0x1f9ba0];return _0x3267d5;};'use strict';var Sequelize=require(_0x518a('0x0'));module[_0x518a('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x518a('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 033a07e..2ddddf5 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 _0x5401=['reject','save','update','destroy','then','stack','name','index','map','Attachment','rawAttributes','fieldName','key','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','clone','get','omit','updatedAt','body','createdAt','create','file','originalname','basename','type','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply'];(function(_0x57c711,_0x3fe948){var _0x123995=function(_0x538957){while(--_0x538957){_0x57c711['push'](_0x57c711['shift']());}};_0x123995(++_0x3fe948);}(_0x5401,0x9a));var _0x1540=function(_0x4b140a,_0x3d82ed){_0x4b140a=_0x4b140a-0x0;var _0x1d3b60=_0x5401[_0x4b140a];return _0x1d3b60;};'use strict';var emlformat=require(_0x1540('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1540('0x1'));var jsonpatch=require(_0x1540('0x2'));var rp=require(_0x1540('0x3'));var moment=require(_0x1540('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1540('0x5'));var util=require(_0x1540('0x6'));var path=require(_0x1540('0x7'));var sox=require(_0x1540('0x8'));var csv=require(_0x1540('0x9'));var ejs=require(_0x1540('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1540('0xb'));var squel=require(_0x1540('0xc'));var crypto=require(_0x1540('0xd'));var jsforce=require(_0x1540('0xe'));var deskjs=require(_0x1540('0xf'));var toCsv=require(_0x1540('0x9'));var querystring=require(_0x1540('0x10'));var Papa=require(_0x1540('0x11'));var Redis=require(_0x1540('0x12'));var authService=require(_0x1540('0x13'));var qs=require(_0x1540('0x14'));var as=require(_0x1540('0x15'));var hardwareService=require(_0x1540('0x16'));var logger=require(_0x1540('0x17'))(_0x1540('0x18'));var utils=require(_0x1540('0x19'));var config=require(_0x1540('0x1a'));var licenseUtil=require(_0x1540('0x1b'));var db=require(_0x1540('0x1c'))['db'];function respondWithStatusCode(_0x5a838b,_0x12fbb3){_0x12fbb3=_0x12fbb3||0xcc;return function(_0x44be7b){if(_0x44be7b){return _0x5a838b[_0x1540('0x1d')](_0x12fbb3);}return _0x5a838b[_0x1540('0x1e')](_0x12fbb3)[_0x1540('0x1f')]();};}function respondWithResult(_0x2987bc,_0x1fa8bc){_0x1fa8bc=_0x1fa8bc||0xc8;return function(_0xd10d67){if(_0xd10d67){return _0x2987bc[_0x1540('0x1e')](_0x1fa8bc)[_0x1540('0x20')](_0xd10d67);}};}function respondWithFilteredResult(_0x172e16,_0x5245ab){return function(_0x366991){if(_0x366991){var _0x29ecb5=typeof _0x5245ab['offset']===_0x1540('0x21')&&typeof _0x5245ab[_0x1540('0x22')]===_0x1540('0x21');var _0x212de4=_0x366991[_0x1540('0x23')];var _0x34cd9f=_0x29ecb5?0x0:_0x5245ab['offset'];var _0x24fc69=_0x29ecb5?_0x366991[_0x1540('0x23')]:_0x5245ab[_0x1540('0x24')]+_0x5245ab[_0x1540('0x22')];var _0x571fa7;if(_0x24fc69>=_0x212de4){_0x24fc69=_0x212de4;_0x571fa7=0xc8;}else{_0x571fa7=0xce;}_0x172e16[_0x1540('0x1e')](_0x571fa7);return _0x172e16[_0x1540('0x25')](_0x1540('0x26'),_0x34cd9f+'-'+_0x24fc69+'/'+_0x212de4)[_0x1540('0x20')](_0x366991);}return null;};}function patchUpdates(_0x433aee){return function(_0x3567de){try{jsonpatch[_0x1540('0x27')](_0x3567de,_0x433aee,!![]);}catch(_0x20825c){return BPromise[_0x1540('0x28')](_0x20825c);}return _0x3567de[_0x1540('0x29')]();};}function saveUpdates(_0x48d799,_0x556eed){return function(_0x3ce7a7){if(_0x3ce7a7){return _0x3ce7a7[_0x1540('0x2a')](_0x48d799)['then'](function(_0x59cbfb){return _0x59cbfb;});}return null;};}function removeEntity(_0x34dec4,_0x389162){return function(_0x3d9587){if(_0x3d9587){return _0x3d9587[_0x1540('0x2b')]()[_0x1540('0x2c')](function(){_0x34dec4['status'](0xcc)[_0x1540('0x1f')]();});}};}function handleEntityNotFound(_0x63408f,_0x378cf1){return function(_0x34015a){if(!_0x34015a){_0x63408f[_0x1540('0x1d')](0x194);}return _0x34015a;};}function handleError(_0x3d4ab7,_0x40d05b){_0x40d05b=_0x40d05b||0x1f4;return function(_0x166c6f){logger['error'](_0x166c6f[_0x1540('0x2d')]);if(_0x166c6f[_0x1540('0x2e')]){delete _0x166c6f['name'];}_0x3d4ab7['status'](_0x40d05b)['send'](_0x166c6f);};}exports[_0x1540('0x2f')]=function(_0x341b73,_0x25ec4e){var _0x19bec5={},_0x1f1249={},_0x3793f0={'count':0x0,'rows':[]};var _0x40e559=_[_0x1540('0x30')](db[_0x1540('0x31')][_0x1540('0x32')],function(_0xff683a){return{'name':_0xff683a[_0x1540('0x33')],'type':_0xff683a['type'][_0x1540('0x34')]};});_0x1f1249[_0x1540('0x35')]=_[_0x1540('0x30')](_0x40e559,_0x1540('0x2e'));_0x1f1249['query']=_[_0x1540('0x36')](_0x341b73['query']);_0x1f1249['filters']=_[_0x1540('0x37')](_0x1f1249[_0x1540('0x35')],_0x1f1249[_0x1540('0x38')]);_0x19bec5['attributes']=_['intersection'](_0x1f1249['model'],qs[_0x1540('0x39')](_0x341b73['query'][_0x1540('0x39')]));_0x19bec5['attributes']=_0x19bec5[_0x1540('0x3a')][_0x1540('0x3b')]?_0x19bec5[_0x1540('0x3a')]:_0x1f1249[_0x1540('0x35')];if(!_0x341b73[_0x1540('0x38')][_0x1540('0x3c')](_0x1540('0x3d'))){_0x19bec5[_0x1540('0x22')]=qs[_0x1540('0x22')](_0x341b73[_0x1540('0x38')][_0x1540('0x22')]);_0x19bec5[_0x1540('0x24')]=qs['offset'](_0x341b73['query'][_0x1540('0x24')]);}_0x19bec5[_0x1540('0x3e')]=qs[_0x1540('0x3f')](_0x341b73[_0x1540('0x38')][_0x1540('0x3f')]);_0x19bec5[_0x1540('0x40')]=qs[_0x1540('0x41')](_[_0x1540('0x42')](_0x341b73[_0x1540('0x38')],_0x1f1249[_0x1540('0x41')]),_0x40e559);if(_0x341b73[_0x1540('0x38')][_0x1540('0x43')]){_0x19bec5[_0x1540('0x40')]=_[_0x1540('0x44')](_0x19bec5[_0x1540('0x40')],{'$or':_[_0x1540('0x30')](_0x40e559,function(_0x69aede){if(_0x69aede['type']!==_0x1540('0x45')){var _0xc74270={};_0xc74270[_0x69aede[_0x1540('0x2e')]]={'$like':'%'+_0x341b73[_0x1540('0x38')][_0x1540('0x43')]+'%'};return _0xc74270;}})});}_0x19bec5=_[_0x1540('0x44')]({},_0x19bec5,_0x341b73[_0x1540('0x46')]);var _0xf5148b={'where':_0x19bec5[_0x1540('0x40')]};return db[_0x1540('0x31')][_0x1540('0x23')](_0xf5148b)[_0x1540('0x2c')](function(_0x398453){_0x3793f0[_0x1540('0x23')]=_0x398453;if(_0x341b73[_0x1540('0x38')]['includeAll']){_0x19bec5[_0x1540('0x47')]=[{'all':!![]}];}return db[_0x1540('0x31')][_0x1540('0x48')](_0x19bec5);})[_0x1540('0x2c')](function(_0x56af95){_0x3793f0[_0x1540('0x49')]=_0x56af95;return _0x3793f0;})[_0x1540('0x2c')](respondWithFilteredResult(_0x25ec4e,_0x19bec5))[_0x1540('0x4a')](handleError(_0x25ec4e,null));};exports[_0x1540('0x4b')]=function(_0x361f41,_0x9a25c4){var _0x49fc9f={'raw':!![],'where':{'id':_0x361f41[_0x1540('0x4c')]['id']}},_0x58ac8b={};_0x58ac8b['model']=_[_0x1540('0x36')](db[_0x1540('0x31')][_0x1540('0x32')]);_0x58ac8b[_0x1540('0x38')]=_[_0x1540('0x36')](_0x361f41[_0x1540('0x38')]);_0x58ac8b[_0x1540('0x41')]=_[_0x1540('0x37')](_0x58ac8b[_0x1540('0x35')],_0x58ac8b[_0x1540('0x38')]);_0x49fc9f['attributes']=_['intersection'](_0x58ac8b['model'],qs[_0x1540('0x39')](_0x361f41['query'][_0x1540('0x39')]));_0x49fc9f['attributes']=_0x49fc9f['attributes']['length']?_0x49fc9f[_0x1540('0x3a')]:_0x58ac8b['model'];if(_0x361f41[_0x1540('0x38')][_0x1540('0x4d')]){_0x49fc9f[_0x1540('0x47')]=[{'all':!![]}];}_0x49fc9f=_[_0x1540('0x44')]({},_0x49fc9f,_0x361f41[_0x1540('0x46')]);return db[_0x1540('0x31')][_0x1540('0x4e')](_0x49fc9f)[_0x1540('0x2c')](handleEntityNotFound(_0x9a25c4,null))[_0x1540('0x2c')](respondWithResult(_0x9a25c4,null))['catch'](handleError(_0x9a25c4,null));};exports[_0x1540('0x4f')]=function(_0x177ad1,_0x4b4204){var _0x21e7d7={'where':{'id':_0x177ad1[_0x1540('0x4c')]['id']}},_0x20531d={};_0x20531d['model']=_[_0x1540('0x36')](db['Attachment']['rawAttributes']);_0x21e7d7[_0x1540('0x3a')]=_[_0x1540('0x37')](_0x20531d[_0x1540('0x35')],qs[_0x1540('0x39')](_0x177ad1[_0x1540('0x38')]['fields']));_0x21e7d7['attributes']=_0x21e7d7[_0x1540('0x3a')][_0x1540('0x3b')]?_0x21e7d7[_0x1540('0x3a')]:_0x20531d[_0x1540('0x35')];if(_0x177ad1['query'][_0x1540('0x4d')]){_0x21e7d7[_0x1540('0x47')]=[{'all':!![]}];}_0x21e7d7=_[_0x1540('0x44')]({},_0x21e7d7,_0x177ad1[_0x1540('0x46')]);return db[_0x1540('0x31')][_0x1540('0x4e')](_0x21e7d7)['then'](handleEntityNotFound(_0x4b4204,null))[_0x1540('0x2c')](function(_0x57bb4a){if(_0x57bb4a){var _0x2d7095=_0x57bb4a[_0x1540('0x50')]({'plain':!![]});_0x2d7095=qs[_0x1540('0x51')](_0x2d7095,['id','createdAt',_0x1540('0x52')]);_0x177ad1[_0x1540('0x53')]=_[_0x1540('0x51')](_0x177ad1[_0x1540('0x53')],['id',_0x1540('0x54'),_0x1540('0x52')]);return db[_0x1540('0x31')][_0x1540('0x55')](_[_0x1540('0x44')](_0x2d7095,_0x177ad1['body']),{'include':_0x177ad1[_0x1540('0x38')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x1540('0x2c')](respondWithResult(_0x4b4204,0xc9))[_0x1540('0x4a')](handleError(_0x4b4204,null));};exports['update']=function(_0x439ed5,_0x19c18b){if(_0x439ed5[_0x1540('0x53')]['id']){delete _0x439ed5[_0x1540('0x53')]['id'];}return db[_0x1540('0x31')][_0x1540('0x4e')]({'where':{'id':_0x439ed5[_0x1540('0x4c')]['id']}})[_0x1540('0x2c')](handleEntityNotFound(_0x19c18b,null))[_0x1540('0x2c')](saveUpdates(_0x439ed5[_0x1540('0x53')],null))[_0x1540('0x2c')](respondWithResult(_0x19c18b,null))[_0x1540('0x4a')](handleError(_0x19c18b,null));};exports[_0x1540('0x2b')]=function(_0x42feb2,_0x13b44d){return db[_0x1540('0x31')]['find']({'where':{'id':_0x42feb2[_0x1540('0x4c')]['id']}})['then'](handleEntityNotFound(_0x13b44d,null))[_0x1540('0x2c')](removeEntity(_0x13b44d,null))[_0x1540('0x4a')](handleError(_0x13b44d,null));};exports['create']=function(_0x532f9b,_0x378b4a,_0x10b69e){_0x532f9b[_0x1540('0x53')][_0x1540('0x2e')]=_0x532f9b[_0x1540('0x56')][_0x1540('0x57')];_0x532f9b[_0x1540('0x53')][_0x1540('0x58')]=_0x532f9b['file']['filename'];_0x532f9b[_0x1540('0x53')][_0x1540('0x59')]=_0x532f9b[_0x1540('0x56')]['mimetype'];return db[_0x1540('0x31')][_0x1540('0x55')](_0x532f9b[_0x1540('0x53')])[_0x1540('0x2c')](respondWithResult(_0x378b4a,0xc9))[_0x1540('0x4a')](handleError(_0x378b4a,null));};exports[_0x1540('0x5a')]=function(_0x26d08,_0x56657a,_0x346d3e){return db[_0x1540('0x31')][_0x1540('0x5b')]({'where':{'id':_0x26d08[_0x1540('0x4c')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x56657a,null))[_0x1540('0x2c')](function(_0x14986e){if(_0x14986e){var _0x29ff53=_0x14986e[_0x1540('0x5c')]!==null;var _0x3710e0=path[_0x1540('0x5d')](config[_0x1540('0x5e')],_0x1540('0x5f'));if(_0x29ff53){_0x3710e0=path[_0x1540('0x5d')](_0x3710e0,_0x1540('0x60'));}var _0x2651ce=path['join'](_0x3710e0,_0x14986e[_0x1540('0x58')]);return _0x56657a[_0x1540('0x5a')](_0x2651ce);}})[_0x1540('0x4a')](handleError(_0x56657a,null));}; \ No newline at end of file +var _0xefa5=['update','then','destroy','error','name','send','index','Attachment','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','clone','omit','updatedAt','body','create','file','basename','filename','mimetype','download','findOne','join','server/files/attachments/','offline-chat/','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','undefined','count','status','json','apply','reject','save'];(function(_0x14a381,_0x1887d6){var _0xad254b=function(_0x1bb797){while(--_0x1bb797){_0x14a381['push'](_0x14a381['shift']());}};_0xad254b(++_0x1887d6);}(_0xefa5,0x18c));var _0x5efa=function(_0x283c87,_0x545688){_0x283c87=_0x283c87-0x0;var _0xde4143=_0xefa5[_0x283c87];return _0xde4143;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5efa('0x0'));var zipdir=require(_0x5efa('0x1'));var jsonpatch=require(_0x5efa('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5efa('0x3'));var Mustache=require('mustache');var util=require(_0x5efa('0x4'));var path=require(_0x5efa('0x5'));var sox=require(_0x5efa('0x6'));var csv=require(_0x5efa('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5efa('0x8'));var _=require(_0x5efa('0x9'));var squel=require(_0x5efa('0xa'));var crypto=require(_0x5efa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5efa('0xc'));var toCsv=require(_0x5efa('0x7'));var querystring=require(_0x5efa('0xd'));var Papa=require(_0x5efa('0xe'));var Redis=require(_0x5efa('0xf'));var authService=require(_0x5efa('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5efa('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5efa('0x12'))(_0x5efa('0x13'));var utils=require(_0x5efa('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5efa('0x15'));var db=require(_0x5efa('0x16'))['db'];function respondWithStatusCode(_0x57a0d1,_0x281280){_0x281280=_0x281280||0xcc;return function(_0x1f09e2){if(_0x1f09e2){return _0x57a0d1[_0x5efa('0x17')](_0x281280);}return _0x57a0d1['status'](_0x281280)[_0x5efa('0x18')]();};}function respondWithResult(_0x4299aa,_0x4336ad){_0x4336ad=_0x4336ad||0xc8;return function(_0x251619){if(_0x251619){return _0x4299aa['status'](_0x4336ad)['json'](_0x251619);}};}function respondWithFilteredResult(_0x345c06,_0x6c814f){return function(_0x40cf34){if(_0x40cf34){var _0x4e1705=typeof _0x6c814f[_0x5efa('0x19')]==='undefined'&&typeof _0x6c814f[_0x5efa('0x1a')]===_0x5efa('0x1b');var _0x515f72=_0x40cf34[_0x5efa('0x1c')];var _0x3cab3d=_0x4e1705?0x0:_0x6c814f[_0x5efa('0x19')];var _0x4a9381=_0x4e1705?_0x40cf34[_0x5efa('0x1c')]:_0x6c814f[_0x5efa('0x19')]+_0x6c814f[_0x5efa('0x1a')];var _0x3b2700;if(_0x4a9381>=_0x515f72){_0x4a9381=_0x515f72;_0x3b2700=0xc8;}else{_0x3b2700=0xce;}_0x345c06[_0x5efa('0x1d')](_0x3b2700);return _0x345c06['set']('Content-Range',_0x3cab3d+'-'+_0x4a9381+'/'+_0x515f72)[_0x5efa('0x1e')](_0x40cf34);}return null;};}function patchUpdates(_0x3c6f98){return function(_0x24ad7b){try{jsonpatch[_0x5efa('0x1f')](_0x24ad7b,_0x3c6f98,!![]);}catch(_0x2302a5){return BPromise[_0x5efa('0x20')](_0x2302a5);}return _0x24ad7b[_0x5efa('0x21')]();};}function saveUpdates(_0x3c62d9,_0x236ed2){return function(_0x3a69d1){if(_0x3a69d1){return _0x3a69d1[_0x5efa('0x22')](_0x3c62d9)[_0x5efa('0x23')](function(_0x5b718f){return _0x5b718f;});}return null;};}function removeEntity(_0x1cdc7a,_0x2471ba){return function(_0x36d539){if(_0x36d539){return _0x36d539[_0x5efa('0x24')]()[_0x5efa('0x23')](function(){_0x1cdc7a[_0x5efa('0x1d')](0xcc)[_0x5efa('0x18')]();});}};}function handleEntityNotFound(_0xb99be7,_0x50d115){return function(_0x37f75c){if(!_0x37f75c){_0xb99be7['sendStatus'](0x194);}return _0x37f75c;};}function handleError(_0xc17675,_0x559bbf){_0x559bbf=_0x559bbf||0x1f4;return function(_0x31f1bb){logger[_0x5efa('0x25')](_0x31f1bb['stack']);if(_0x31f1bb[_0x5efa('0x26')]){delete _0x31f1bb[_0x5efa('0x26')];}_0xc17675[_0x5efa('0x1d')](_0x559bbf)[_0x5efa('0x27')](_0x31f1bb);};}exports[_0x5efa('0x28')]=function(_0x1c1494,_0x1943a9){var _0x393df5={},_0xdb5375={},_0x3e21bb={'count':0x0,'rows':[]};var _0x1942b1=_['map'](db[_0x5efa('0x29')][_0x5efa('0x2a')],function(_0x567a57){return{'name':_0x567a57[_0x5efa('0x2b')],'type':_0x567a57[_0x5efa('0x2c')][_0x5efa('0x2d')]};});_0xdb5375[_0x5efa('0x2e')]=_[_0x5efa('0x2f')](_0x1942b1,_0x5efa('0x26'));_0xdb5375[_0x5efa('0x30')]=_[_0x5efa('0x31')](_0x1c1494[_0x5efa('0x30')]);_0xdb5375[_0x5efa('0x32')]=_[_0x5efa('0x33')](_0xdb5375[_0x5efa('0x2e')],_0xdb5375[_0x5efa('0x30')]);_0x393df5[_0x5efa('0x34')]=_[_0x5efa('0x33')](_0xdb5375[_0x5efa('0x2e')],qs[_0x5efa('0x35')](_0x1c1494[_0x5efa('0x30')]['fields']));_0x393df5[_0x5efa('0x34')]=_0x393df5[_0x5efa('0x34')][_0x5efa('0x36')]?_0x393df5[_0x5efa('0x34')]:_0xdb5375[_0x5efa('0x2e')];if(!_0x1c1494[_0x5efa('0x30')][_0x5efa('0x37')](_0x5efa('0x38'))){_0x393df5[_0x5efa('0x1a')]=qs[_0x5efa('0x1a')](_0x1c1494['query'][_0x5efa('0x1a')]);_0x393df5[_0x5efa('0x19')]=qs[_0x5efa('0x19')](_0x1c1494[_0x5efa('0x30')]['offset']);}_0x393df5[_0x5efa('0x39')]=qs[_0x5efa('0x3a')](_0x1c1494[_0x5efa('0x30')][_0x5efa('0x3a')]);_0x393df5['where']=qs['filters'](_['pick'](_0x1c1494[_0x5efa('0x30')],_0xdb5375[_0x5efa('0x32')]),_0x1942b1);if(_0x1c1494[_0x5efa('0x30')][_0x5efa('0x3b')]){_0x393df5[_0x5efa('0x3c')]=_[_0x5efa('0x3d')](_0x393df5[_0x5efa('0x3c')],{'$or':_[_0x5efa('0x2f')](_0x1942b1,function(_0x39f62c){if(_0x39f62c[_0x5efa('0x2c')]!==_0x5efa('0x3e')){var _0x517144={};_0x517144[_0x39f62c['name']]={'$like':'%'+_0x1c1494[_0x5efa('0x30')][_0x5efa('0x3b')]+'%'};return _0x517144;}})});}_0x393df5=_[_0x5efa('0x3d')]({},_0x393df5,_0x1c1494[_0x5efa('0x3f')]);var _0x3b990c={'where':_0x393df5[_0x5efa('0x3c')]};return db[_0x5efa('0x29')][_0x5efa('0x1c')](_0x3b990c)[_0x5efa('0x23')](function(_0x2449a7){_0x3e21bb[_0x5efa('0x1c')]=_0x2449a7;if(_0x1c1494['query']['includeAll']){_0x393df5[_0x5efa('0x40')]=[{'all':!![]}];}return db[_0x5efa('0x29')][_0x5efa('0x41')](_0x393df5);})[_0x5efa('0x23')](function(_0x180c6e){_0x3e21bb[_0x5efa('0x42')]=_0x180c6e;return _0x3e21bb;})['then'](respondWithFilteredResult(_0x1943a9,_0x393df5))[_0x5efa('0x43')](handleError(_0x1943a9,null));};exports[_0x5efa('0x44')]=function(_0x1cc531,_0x2b4165){var _0x19ffe0={'raw':!![],'where':{'id':_0x1cc531[_0x5efa('0x45')]['id']}},_0x17dc53={};_0x17dc53[_0x5efa('0x2e')]=_[_0x5efa('0x31')](db[_0x5efa('0x29')][_0x5efa('0x2a')]);_0x17dc53['query']=_['keys'](_0x1cc531[_0x5efa('0x30')]);_0x17dc53[_0x5efa('0x32')]=_[_0x5efa('0x33')](_0x17dc53[_0x5efa('0x2e')],_0x17dc53[_0x5efa('0x30')]);_0x19ffe0[_0x5efa('0x34')]=_[_0x5efa('0x33')](_0x17dc53[_0x5efa('0x2e')],qs['fields'](_0x1cc531[_0x5efa('0x30')][_0x5efa('0x35')]));_0x19ffe0['attributes']=_0x19ffe0[_0x5efa('0x34')][_0x5efa('0x36')]?_0x19ffe0[_0x5efa('0x34')]:_0x17dc53[_0x5efa('0x2e')];if(_0x1cc531[_0x5efa('0x30')][_0x5efa('0x46')]){_0x19ffe0['include']=[{'all':!![]}];}_0x19ffe0=_[_0x5efa('0x3d')]({},_0x19ffe0,_0x1cc531[_0x5efa('0x3f')]);return db[_0x5efa('0x29')][_0x5efa('0x47')](_0x19ffe0)[_0x5efa('0x23')](handleEntityNotFound(_0x2b4165,null))[_0x5efa('0x23')](respondWithResult(_0x2b4165,null))[_0x5efa('0x43')](handleError(_0x2b4165,null));};exports[_0x5efa('0x48')]=function(_0x391ddb,_0x1108d4){var _0x2e124d={'where':{'id':_0x391ddb[_0x5efa('0x45')]['id']}},_0x364e66={};_0x364e66['model']=_[_0x5efa('0x31')](db['Attachment'][_0x5efa('0x2a')]);_0x2e124d['attributes']=_[_0x5efa('0x33')](_0x364e66[_0x5efa('0x2e')],qs[_0x5efa('0x35')](_0x391ddb['query'][_0x5efa('0x35')]));_0x2e124d[_0x5efa('0x34')]=_0x2e124d[_0x5efa('0x34')][_0x5efa('0x36')]?_0x2e124d['attributes']:_0x364e66['model'];if(_0x391ddb[_0x5efa('0x30')][_0x5efa('0x46')]){_0x2e124d['include']=[{'all':!![]}];}_0x2e124d=_[_0x5efa('0x3d')]({},_0x2e124d,_0x391ddb[_0x5efa('0x3f')]);return db[_0x5efa('0x29')][_0x5efa('0x47')](_0x2e124d)[_0x5efa('0x23')](handleEntityNotFound(_0x1108d4,null))[_0x5efa('0x23')](function(_0x310a61){if(_0x310a61){var _0x31d7e2=_0x310a61['get']({'plain':!![]});_0x31d7e2=qs[_0x5efa('0x49')](_0x31d7e2,['id','createdAt',_0x5efa('0x4a')]);_0x391ddb['body']=_[_0x5efa('0x49')](_0x391ddb[_0x5efa('0x4b')],['id','createdAt',_0x5efa('0x4a')]);return db[_0x5efa('0x29')]['create'](_[_0x5efa('0x3d')](_0x31d7e2,_0x391ddb[_0x5efa('0x4b')]),{'include':_0x391ddb['query']['includeAll']?[{'all':!![]}]:undefined});}})[_0x5efa('0x23')](respondWithResult(_0x1108d4,0xc9))['catch'](handleError(_0x1108d4,null));};exports['update']=function(_0x4fe530,_0x139443){if(_0x4fe530[_0x5efa('0x4b')]['id']){delete _0x4fe530[_0x5efa('0x4b')]['id'];}return db['Attachment'][_0x5efa('0x47')]({'where':{'id':_0x4fe530['params']['id']}})[_0x5efa('0x23')](handleEntityNotFound(_0x139443,null))[_0x5efa('0x23')](saveUpdates(_0x4fe530[_0x5efa('0x4b')],null))[_0x5efa('0x23')](respondWithResult(_0x139443,null))[_0x5efa('0x43')](handleError(_0x139443,null));};exports[_0x5efa('0x24')]=function(_0xdb5563,_0x2b1379){return db[_0x5efa('0x29')][_0x5efa('0x47')]({'where':{'id':_0xdb5563['params']['id']}})['then'](handleEntityNotFound(_0x2b1379,null))['then'](removeEntity(_0x2b1379,null))[_0x5efa('0x43')](handleError(_0x2b1379,null));};exports[_0x5efa('0x4c')]=function(_0x28cb7c,_0x189829,_0xa91d25){_0x28cb7c[_0x5efa('0x4b')][_0x5efa('0x26')]=_0x28cb7c[_0x5efa('0x4d')]['originalname'];_0x28cb7c[_0x5efa('0x4b')][_0x5efa('0x4e')]=_0x28cb7c[_0x5efa('0x4d')][_0x5efa('0x4f')];_0x28cb7c[_0x5efa('0x4b')][_0x5efa('0x2c')]=_0x28cb7c[_0x5efa('0x4d')][_0x5efa('0x50')];return db['Attachment']['create'](_0x28cb7c[_0x5efa('0x4b')])[_0x5efa('0x23')](respondWithResult(_0x189829,0xc9))['catch'](handleError(_0x189829,null));};exports[_0x5efa('0x51')]=function(_0xc38bf0,_0x13ed4b,_0x4f4009){return db['Attachment'][_0x5efa('0x52')]({'where':{'id':_0xc38bf0[_0x5efa('0x45')]['id']},'raw':!![]})[_0x5efa('0x23')](handleEntityNotFound(_0x13ed4b,null))[_0x5efa('0x23')](function(_0xde35f3){if(_0xde35f3){var _0x13f17f=_0xde35f3['ChatOfflineMessageId']!==null;var _0x4e71a4=path[_0x5efa('0x53')](config['root'],_0x5efa('0x54'));if(_0x13f17f){_0x4e71a4=path[_0x5efa('0x53')](_0x4e71a4,_0x5efa('0x55'));}var _0x28518f=path[_0x5efa('0x53')](_0x4e71a4,_0xde35f3[_0x5efa('0x4e')]);return _0x13ed4b[_0x5efa('0x51')](_0x28518f);}})['catch'](handleError(_0x13ed4b,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 427a80c..384500b 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 _0x546b=['Attachment','attachments','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x1b8442,_0x5a33e0){var _0x334c40=function(_0x41d48a){while(--_0x41d48a){_0x1b8442['push'](_0x1b8442['shift']());}};_0x334c40(++_0x5a33e0);}(_0x546b,0x1db));var _0xb546=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0x546b[_0x599e60];return _0x468e19;};'use strict';var _=require('lodash');var util=require(_0xb546('0x0'));var logger=require(_0xb546('0x1'))(_0xb546('0x2'));var moment=require('moment');var BPromise=require(_0xb546('0x3'));var rp=require(_0xb546('0x4'));var fs=require('fs');var path=require(_0xb546('0x5'));var rimraf=require(_0xb546('0x6'));var config=require(_0xb546('0x7'));var attributes=require('./attachment.attributes');module['exports']=function(_0x54be7d,_0x305a43){return _0x54be7d[_0xb546('0x8')](_0xb546('0x9'),attributes,{'tableName':_0xb546('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x969f=['exports','attachments','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes'];(function(_0x1868a1,_0x315386){var _0x18de1a=function(_0x5647c4){while(--_0x5647c4){_0x1868a1['push'](_0x1868a1['shift']());}};_0x18de1a(++_0x315386);}(_0x969f,0xf2));var _0xf969=function(_0x1558ee,_0x40ed70){_0x1558ee=_0x1558ee-0x0;var _0x252dba=_0x969f[_0x1558ee];return _0x252dba;};'use strict';var _=require(_0xf969('0x0'));var util=require(_0xf969('0x1'));var logger=require(_0xf969('0x2'))('api');var moment=require(_0xf969('0x3'));var BPromise=require(_0xf969('0x4'));var rp=require(_0xf969('0x5'));var fs=require('fs');var path=require(_0xf969('0x6'));var rimraf=require(_0xf969('0x7'));var config=require(_0xf969('0x8'));var attributes=require(_0xf969('0x9'));module[_0xf969('0xa')]=function(_0xb306ff,_0x44e7b1){return _0xb306ff['define']('Attachment',attributes,{'tableName':_0xf969('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 6b9a964..a6e22e0 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 _0x544a=['lodash','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateAttachment','Attachment','create','options','raw','then','stringify','catch'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x544a,0xbd));var _0xa544=function(_0x5b0500,_0x49be7d){_0x5b0500=_0x5b0500-0x0;var _0x2a5476=_0x544a[_0x5b0500];return _0x2a5476;};'use strict';var _=require(_0xa544('0x0'));var util=require(_0xa544('0x1'));var moment=require(_0xa544('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa544('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa544('0x4'));var logger=require(_0xa544('0x5'))('rpc');var config=require(_0xa544('0x6'));var jayson=require(_0xa544('0x7'));var client=jayson[_0xa544('0x8')][_0xa544('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39caac,_0x543cd1,_0x407443){return new BPromise(function(_0x495819,_0x39bcd7){return client[_0xa544('0xa')](_0x39caac,_0x407443)['then'](function(_0x2e9a6a){logger[_0xa544('0xb')](_0xa544('0xc'),_0x543cd1,_0xa544('0xd'));logger['debug'](_0xa544('0xe'),_0x543cd1,_0xa544('0xd'),JSON['stringify'](_0x2e9a6a));if(_0x2e9a6a[_0xa544('0xf')]){if(_0x2e9a6a['error'][_0xa544('0x10')]===0x1f4){logger[_0xa544('0xf')]('Attachment,\x20%s,\x20%s',_0x543cd1,_0x2e9a6a[_0xa544('0xf')][_0xa544('0x11')]);return _0x39bcd7(_0x2e9a6a[_0xa544('0xf')][_0xa544('0x11')]);}logger[_0xa544('0xf')](_0xa544('0xc'),_0x543cd1,_0x2e9a6a[_0xa544('0xf')][_0xa544('0x11')]);return _0x495819(_0x2e9a6a[_0xa544('0xf')][_0xa544('0x11')]);}else{logger[_0xa544('0xb')](_0xa544('0xc'),_0x543cd1,'request\x20sent');_0x495819(_0x2e9a6a[_0xa544('0x12')][_0xa544('0x11')]);}})['catch'](function(_0x9093bd){logger[_0xa544('0xf')](_0xa544('0xc'),_0x543cd1,_0x9093bd);_0x39bcd7(_0x9093bd);});});}exports[_0xa544('0x13')]=function(_0x2c5ae8){var _0x297298=this;return new Promise(function(_0x1f3fcc,_0x44ccd3){return db[_0xa544('0x14')][_0xa544('0x15')](_0x2c5ae8['body'],{'raw':_0x2c5ae8['options']?_0x2c5ae8[_0xa544('0x16')][_0xa544('0x17')]===undefined?!![]:![]:!![]})[_0xa544('0x18')](function(_0x57a154){logger[_0xa544('0xb')](_0xa544('0x13'),_0x2c5ae8);logger['debug'](_0xa544('0x13'),_0x2c5ae8,JSON[_0xa544('0x19')](_0x57a154));_0x1f3fcc(_0x57a154);})[_0xa544('0x1a')](function(_0xb7df3d){logger[_0xa544('0xf')]('CreateAttachment',_0xb7df3d['message'],_0x2c5ae8);_0x44ccd3(_0x297298[_0xa544('0xf')](0x1f4,_0xb7df3d['message']));});});}; \ No newline at end of file +var _0x8eeb=['../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','Attachment,\x20%s,\x20%s','message','result','CreateAttachment','create','body','options','raw','catch','lodash','moment','bluebird','ioredis','../../mysqldb'];(function(_0x770d52,_0x58cd79){var _0x36f0b1=function(_0x499e5d){while(--_0x499e5d){_0x770d52['push'](_0x770d52['shift']());}};_0x36f0b1(++_0x58cd79);}(_0x8eeb,0x183));var _0xb8ee=function(_0x12b1ca,_0x6262dd){_0x12b1ca=_0x12b1ca-0x0;var _0x261745=_0x8eeb[_0x12b1ca];return _0x261745;};'use strict';var _=require(_0xb8ee('0x0'));var util=require('util');var moment=require(_0xb8ee('0x1'));var BPromise=require(_0xb8ee('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb8ee('0x3'));var db=require(_0xb8ee('0x4'))['db'];var utils=require(_0xb8ee('0x5'));var logger=require(_0xb8ee('0x6'))(_0xb8ee('0x7'));var config=require('../../config/environment');var jayson=require(_0xb8ee('0x8'));var client=jayson['client'][_0xb8ee('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30dff7,_0x430b38,_0x469393){return new BPromise(function(_0x4e2428,_0x27243c){return client[_0xb8ee('0xa')](_0x30dff7,_0x469393)[_0xb8ee('0xb')](function(_0x5ea3ab){logger[_0xb8ee('0xc')]('Attachment,\x20%s,\x20%s',_0x430b38,_0xb8ee('0xd'));logger[_0xb8ee('0xe')](_0xb8ee('0xf'),_0x430b38,_0xb8ee('0xd'),JSON[_0xb8ee('0x10')](_0x5ea3ab));if(_0x5ea3ab[_0xb8ee('0x11')]){if(_0x5ea3ab[_0xb8ee('0x11')][_0xb8ee('0x12')]===0x1f4){logger['error'](_0xb8ee('0x13'),_0x430b38,_0x5ea3ab[_0xb8ee('0x11')][_0xb8ee('0x14')]);return _0x27243c(_0x5ea3ab[_0xb8ee('0x11')][_0xb8ee('0x14')]);}logger[_0xb8ee('0x11')]('Attachment,\x20%s,\x20%s',_0x430b38,_0x5ea3ab[_0xb8ee('0x11')][_0xb8ee('0x14')]);return _0x4e2428(_0x5ea3ab[_0xb8ee('0x11')][_0xb8ee('0x14')]);}else{logger[_0xb8ee('0xc')](_0xb8ee('0x13'),_0x430b38,_0xb8ee('0xd'));_0x4e2428(_0x5ea3ab[_0xb8ee('0x15')][_0xb8ee('0x14')]);}})['catch'](function(_0x135d5d){logger['error']('Attachment,\x20%s,\x20%s',_0x430b38,_0x135d5d);_0x27243c(_0x135d5d);});});}exports[_0xb8ee('0x16')]=function(_0x34dfb9){var _0x4d9a82=this;return new Promise(function(_0x3f0577,_0x369e3e){return db['Attachment'][_0xb8ee('0x17')](_0x34dfb9[_0xb8ee('0x18')],{'raw':_0x34dfb9[_0xb8ee('0x19')]?_0x34dfb9['options'][_0xb8ee('0x1a')]===undefined?!![]:![]:!![]})[_0xb8ee('0xb')](function(_0x39d8b2){logger[_0xb8ee('0xc')](_0xb8ee('0x16'),_0x34dfb9);logger['debug'](_0xb8ee('0x16'),_0x34dfb9,JSON['stringify'](_0x39d8b2));_0x3f0577(_0x39d8b2);})[_0xb8ee('0x1b')](function(_0x134ddb){logger[_0xb8ee('0x11')](_0xb8ee('0x16'),_0x134ddb[_0xb8ee('0x14')],_0x34dfb9);_0x369e3e(_0x4d9a82[_0xb8ee('0x11')](0x1f4,_0x134ddb[_0xb8ee('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 355d4e2..f5069ff 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 _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','clone','join','root','server/files/attachments/','%s-%s','now','originalname','replace','post','single','file','create','put','update','delete','destroy','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb28,0x106));var _0x8db2=function(_0x532c66,_0x1a885c){_0x532c66=_0x532c66-0x0;var _0x25fb9f=_0xdb28[_0x532c66];return _0x25fb9f;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./attachment.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d9371,_0x150942,_0x576475){_0x576475(null,path[_0x8db2('0x11')](config[_0x8db2('0x12')],_0x8db2('0x13')));},'filename':function(_0x204f49,_0x37d017,_0x559fb1){_0x559fb1(null,util['format'](_0x8db2('0x14'),Date[_0x8db2('0x15')](),_0x37d017[_0x8db2('0x16')][_0x8db2('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8db2('0x18')]('/',upload[_0x8db2('0x19')](_0x8db2('0x1a')),controller[_0x8db2('0x1b')]);router[_0x8db2('0x1c')](_0x8db2('0xb'),auth['isAuthenticated'](),controller[_0x8db2('0x1d')]);router[_0x8db2('0x1e')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);module[_0x8db2('0x20')]=router; \ No newline at end of file +var _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x414334,_0x23d761){var _0x47cf2b=function(_0x46051b){while(--_0x46051b){_0x414334['push'](_0x414334['shift']());}};_0x47cf2b(++_0x23d761);}(_0xadb5,0xad));var _0x5adb=function(_0x38ace2,_0x28ea21){_0x38ace2=_0x38ace2-0x0;var _0x12fe49=_0xadb5[_0x38ace2];return _0x12fe49;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 4c3e293..b30582d 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 _0xf442=['use','password','User','passport','Strategy','moment','activedirectory2','bluebird','../../mysqldb','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url','authenticate','adAuthenticate','error','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Setting','adSsoEnabled','blockDuration','then','log','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','salt','role','disabled','blockedAt','admin','agent','user','name','domain','res','minutes','getLicense','status','send','message','ad-login','login','signToken','json'];(function(_0x1502ef,_0x1182a7){var _0x115c6f=function(_0x22d504){while(--_0x22d504){_0x1502ef['push'](_0x1502ef['shift']());}};_0x115c6f(++_0x1182a7);}(_0xf442,0x123));var _0x2f44=function(_0x1cd8d1,_0x52fa43){_0x1cd8d1=_0x1cd8d1-0x0;var _0x450f18=_0xf442[_0x1cd8d1];return _0x450f18;};'use strict';var passport=require(_0x2f44('0x0'));var LocalStrategy=require('passport-local')[_0x2f44('0x1')];var moment=require(_0x2f44('0x2'));var ActiveDirectory=require(_0x2f44('0x3'));var BPromise=require(_0x2f44('0x4'));var db=require(_0x2f44('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x2f44('0x6'));var config=require(_0x2f44('0x7'));var logger=require(_0x2f44('0x8'))(_0x2f44('0x9'));function isActiveDirectoryConfigured(_0x173abc){var _0x3c57cf=![];if(typeof _0x173abc[_0x2f44('0xa')]!==_0x2f44('0xb')){_0x3c57cf=_0x173abc[_0x2f44('0xa')][_0x2f44('0xc')]&&_0x173abc[_0x2f44('0xa')][_0x2f44('0xd')]&&_0x173abc[_0x2f44('0xa')]['domain'];}return _0x3c57cf;}function adAuthenticate(_0x494763,_0x502d51,_0x59fd00){return new BPromise(function(_0x2482a4,_0x4a2185){try{var _0x2feffb=new ActiveDirectory(_0x494763);_0x2feffb[_0x2f44('0xe')](_0x502d51,_0x59fd00,function(_0x4f59d3,_0x5ccd39){console['log'](_0x2f44('0xf'),_0x4f59d3,_0x5ccd39);if(_0x4f59d3){_0x4a2185(_0x4f59d3);}else if(!_0x5ccd39){_0x4a2185('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x2482a4(_0x5ccd39);}});}catch(_0xb6605d){_0x4a2185(_0xb6605d);}});}function ActiveDirectoryAuthenticate(_0x1eadca,_0x18f7c2,_0x363684,_0x11e0e8){var _0x854eda,_0x424435;if(!isActiveDirectoryConfigured(config)){logger[_0x2f44('0x10')](_0x2f44('0x11'),_0x18f7c2);return _0x11e0e8(null,![],{'message':_0x2f44('0x12')});}return db[_0x2f44('0x13')]['findOne']({'where':{'id':0x1},'attributes':[_0x2f44('0x14'),_0x2f44('0x15')],'raw':!![]})[_0x2f44('0x16')](function(_0x3a1b3a){console[_0x2f44('0x17')]('settings',_0x3a1b3a);_0x854eda=_0x3a1b3a;if(!_0x854eda['adSsoEnabled']){logger['error'](_0x2f44('0x18'),_0x18f7c2);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x1eadca[_0x2f44('0x19')]({'logging':!![],'attributes':['id','name','password',_0x2f44('0x1a'),_0x2f44('0x1b'),_0x2f44('0x1c'),'blocked',_0x2f44('0x1d')],'where':{'name':_0x18f7c2,'role':{'$or':[_0x2f44('0x1e'),'user',_0x2f44('0x1f')]},'adSsoEnabled':!![]}});})[_0x2f44('0x16')](function(_0x5ba04f){console[_0x2f44('0x17')](_0x2f44('0x20'),_0x5ba04f);if(!_0x5ba04f||_0x5ba04f&&_0x5ba04f[_0x2f44('0x21')]!==_0x18f7c2){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x424435=_0x5ba04f;var _0x243a1b=_0x424435[_0x2f44('0x21')]+'@'+config['activedirectory'][_0x2f44('0x22')];return adAuthenticate(config[_0x2f44('0xa')],_0x243a1b,_0x363684);})[_0x2f44('0x16')](function(_0x2829fe){console[_0x2f44('0x17')](_0x2f44('0x23'),_0x2829fe);if(_0x424435[_0x2f44('0x1c')]){throw new Error(_0x2f44('0x12'));}if(_0x854eda['blockDuration']>0x0){if(_0x424435['blocked']){if(moment(_0x424435[_0x2f44('0x1d')])['add'](_0x854eda[_0x2f44('0x15')],_0x2f44('0x24'))>moment()){throw new Error(_0x2f44('0x12'));}return utils['clearBlockUser'](_0x424435,0x0,![],null)['then'](function(){return utils['getLicense'](_0x424435);})[_0x2f44('0x16')](function(){return _0x11e0e8(null,_0x424435);});}else{return utils[_0x2f44('0x25')](_0x424435)[_0x2f44('0x16')](function(){return _0x11e0e8(null,_0x424435);});}}else{return utils['getLicense'](_0x424435)['then'](function(){return _0x11e0e8(null,_0x424435);});}})['catch'](function(_0x4481bc){return _0x11e0e8(null,![],_0x4481bc);});}function handleError(_0xfc679e,_0x2df2d3,_0x30386c){return _0xfc679e[_0x2f44('0x26')](_0x2df2d3||0x1f4)[_0x2f44('0x27')]({'message':_0x30386c?_0x30386c[_0x2f44('0x28')]||_0x30386c:''});}exports['login']=function(_0x1f1e04,_0x1a6475,_0x10c0b0){passport['authenticate'](_0x2f44('0x29'),function(_0x5dca5d,_0xbeef9e,_0x2a0941){console[_0x2f44('0x17')](_0x2f44('0x2a'),_0x5dca5d,_0xbeef9e,_0x2a0941);var _0x162a6b=_0x5dca5d||_0x2a0941;if(_0x162a6b){return handleError(_0x1a6475,0x191,_0x162a6b);}if(!_0xbeef9e){return handleError(_0x1a6475,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x3f7cfa={'payload':{'id':_0xbeef9e['id'],'role':_0xbeef9e[_0x2f44('0x1b')]},'options':{'expiresIn':0x15180}};return authService[_0x2f44('0x2b')](_0x3f7cfa)[_0x2f44('0x16')](function(_0x1414a6){_0x1a6475[_0x2f44('0x2c')]({'id':_0xbeef9e['id'],'token':_0x1414a6,'statusCall':'','isAlreadyLogged':_0xbeef9e['online']});});}})(_0x1f1e04,_0x1a6475,_0x10c0b0);};passport[_0x2f44('0x2d')](_0x2f44('0x29'),new LocalStrategy({'usernameField':_0x2f44('0x21'),'passwordField':_0x2f44('0x2e')},function(_0x5aa025,_0x19eef0,_0x2b5810){return ActiveDirectoryAuthenticate(db[_0x2f44('0x2f')],_0x5aa025,_0x19eef0,_0x2b5810);})); \ No newline at end of file +var _0xa9e0=['salt','role','disabled','blocked','admin','user','then','minutes','clearBlockUser','getLicense','catch','status','message','login','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','use','User','passport','passport-local','Strategy','bluebird','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','activedirectory','baseDN','domain','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','blockDuration','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var passport=require(_0x0a9e('0x0'));var LocalStrategy=require(_0x0a9e('0x1'))[_0x0a9e('0x2')];var moment=require('moment');var ActiveDirectory=require('activedirectory2');var BPromise=require(_0x0a9e('0x3'));var util=require('util');var db=require(_0x0a9e('0x4'))['db'];var authService=require(_0x0a9e('0x5'));var utils=require(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var logger=require(_0x0a9e('0x8'))('api');function isActiveDirectoryConfigured(_0x219af0){var _0x441e3a=![];if(typeof _0x219af0[_0x0a9e('0x9')]!=='undefined'){_0x441e3a=_0x219af0['activedirectory'][_0x0a9e('0xa')]&&_0x219af0['activedirectory']['url']&&_0x219af0[_0x0a9e('0x9')][_0x0a9e('0xb')];}return _0x441e3a;}function adAuthenticate(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){try{var _0x50dfb2=new ActiveDirectory(_0x307b3e);_0x50dfb2['authenticate'](_0x3ab53f,_0xfeb75b,function(_0x4cfe67,_0x273d4d){if(_0x4cfe67){logger[_0x0a9e('0xc')](_0x0a9e('0xd'),_0x3ab53f,util[_0x0a9e('0xe')](_0x4cfe67,{'showHidden':![],'depth':null}));_0x4a4c56(_0x0a9e('0xf'));}else if(!_0x273d4d){logger[_0x0a9e('0xc')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x3ab53f);_0x4a4c56(_0x0a9e('0xf'));}else{_0xbd1168(_0x273d4d);}});}catch(_0x239b12){_0x4a4c56(_0x239b12);}});}function ActiveDirectoryAuthenticate(_0x2b4227,_0x281129,_0x44dcfd,_0x4d5611){var _0x52a03d,_0x22dccb;if(!isActiveDirectoryConfigured(config)){logger['error'](_0x0a9e('0x10'),_0x281129);return _0x4d5611(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0x0a9e('0x11')][_0x0a9e('0x12')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x0a9e('0x13')],'raw':!![]})['then'](function(_0x459eb1){_0x52a03d=_0x459eb1;if(!_0x52a03d[_0x0a9e('0x14')]){logger[_0x0a9e('0xc')](_0x0a9e('0x15'),_0x281129);throw new Error(_0x0a9e('0xf'));}return _0x2b4227[_0x0a9e('0x12')]({'logging':!![],'attributes':['id',_0x0a9e('0x16'),_0x0a9e('0x17'),_0x0a9e('0x18'),_0x0a9e('0x19'),_0x0a9e('0x1a'),_0x0a9e('0x1b'),'blockedAt'],'where':{'name':_0x281129,'role':{'$or':[_0x0a9e('0x1c'),_0x0a9e('0x1d'),'agent']},'adSsoEnabled':!![]}});})[_0x0a9e('0x1e')](function(_0x5a09ef){if(!_0x5a09ef||_0x5a09ef&&_0x5a09ef['name']!==_0x281129){throw new Error(_0x0a9e('0xf'));}_0x22dccb=_0x5a09ef;var _0x432e56=_0x22dccb[_0x0a9e('0x16')]+'@'+config[_0x0a9e('0x9')]['domain'];return adAuthenticate(config[_0x0a9e('0x9')],_0x432e56,_0x44dcfd);})[_0x0a9e('0x1e')](function(_0x3b45bc){if(_0x22dccb[_0x0a9e('0x1a')]){throw new Error(_0x0a9e('0xf'));}if(_0x52a03d[_0x0a9e('0x13')]>0x0){if(_0x22dccb[_0x0a9e('0x1b')]){if(moment(_0x22dccb['blockedAt'])['add'](_0x52a03d[_0x0a9e('0x13')],_0x0a9e('0x1f'))>moment()){throw new Error(_0x0a9e('0xf'));}return utils[_0x0a9e('0x20')](_0x22dccb,0x0,![],null)['then'](function(){return utils[_0x0a9e('0x21')](_0x22dccb);})['then'](function(){return _0x4d5611(null,_0x22dccb);});}else{return utils[_0x0a9e('0x21')](_0x22dccb)['then'](function(){return _0x4d5611(null,_0x22dccb);});}}else{return utils[_0x0a9e('0x21')](_0x22dccb)[_0x0a9e('0x1e')](function(){return _0x4d5611(null,_0x22dccb);});}})[_0x0a9e('0x22')](function(_0x14433c){return _0x4d5611(null,![],_0x14433c);});}function handleError(_0x140511,_0x1538a4,_0x11c3b6){return _0x140511[_0x0a9e('0x23')](_0x1538a4||0x1f4)['send']({'message':_0x11c3b6?_0x11c3b6[_0x0a9e('0x24')]||_0x11c3b6:''});}exports[_0x0a9e('0x25')]=function(_0x2b1f27,_0x2ec755,_0x5c877d){passport[_0x0a9e('0x26')](_0x0a9e('0x27'),function(_0x1843b2,_0x824a4f,_0x58b06f){var _0x563b45=_0x1843b2||_0x58b06f;if(_0x563b45){return handleError(_0x2ec755,0x191,_0x563b45);}if(!_0x824a4f){return handleError(_0x2ec755,0x194,{'message':_0x0a9e('0x28')});}else{var _0x2e8759={'payload':{'id':_0x824a4f['id'],'role':_0x824a4f[_0x0a9e('0x19')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x2e8759)[_0x0a9e('0x1e')](function(_0x5d1e0e){_0x2ec755[_0x0a9e('0x29')]({'id':_0x824a4f['id'],'token':_0x5d1e0e,'statusCall':'','isAlreadyLogged':_0x824a4f[_0x0a9e('0x2a')]});});}})(_0x2b1f27,_0x2ec755,_0x5c877d);};passport[_0x0a9e('0x2b')](_0x0a9e('0x27'),new LocalStrategy({'usernameField':_0x0a9e('0x16'),'passwordField':'password'},function(_0x66c1d2,_0x46f0a5,_0x40cb85){return ActiveDirectoryAuthenticate(db[_0x0a9e('0x2c')],_0x66c1d2,_0x46f0a5,_0x40cb85);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index e675764..2d2c3a0 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 _0xc73f=['Router','./authActiveDirectory.controller','exports'];(function(_0x49508f,_0x172399){var _0x1787ef=function(_0x1a9f45){while(--_0x1a9f45){_0x49508f['push'](_0x49508f['shift']());}};_0x1787ef(++_0x172399);}(_0xc73f,0x84));var _0xfc73=function(_0x32f262,_0x35e978){_0x32f262=_0x32f262-0x0;var _0x2f2e16=_0xc73f[_0x32f262];return _0x2f2e16;};'use strict';var express=require('express');var router=express[_0xfc73('0x0')]();var controller=require(_0xfc73('0x1'));router['post']('/',controller['login']);module[_0xfc73('0x2')]=router; \ No newline at end of file +var _0xb2c0=['Router','./authActiveDirectory.controller','exports','express'];(function(_0x44b3bd,_0x44c97d){var _0x1efc4a=function(_0x5d0205){while(--_0x5d0205){_0x44b3bd['push'](_0x44b3bd['shift']());}};_0x1efc4a(++_0x44c97d);}(_0xb2c0,0xff));var _0x0b2c=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xb2c0[_0x4b369d];return _0x571a98;};'use strict';var express=require(_0x0b2c('0x0'));var router=express[_0x0b2c('0x1')]();var controller=require(_0x0b2c('0x2'));router['post']('/',controller['login']);module[_0x0b2c('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 7a964b2..d95d167 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7a54,0x106));var _0x47a5=function(_0x87f427,_0x11699d){_0x87f427=_0x87f427-0x0;var _0x135498=_0x7a54[_0x87f427];return _0x135498;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x7a54,0x106));var _0x47a5=function(_0x1ee28d,_0x44577f){_0x1ee28d=_0x1ee28d-0x0;var _0x51be0e=_0x7a54[_0x1ee28d];return _0x51be0e;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index a52c40c..e615484 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 _0x4d85=['callback','isMiddleware','login','express','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','/callback'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4d85,0x99));var _0x54d8=function(_0x4b912,_0x183b72){_0x4b912=_0x4b912-0x0;var _0x59d609=_0x4d85[_0x4b912];return _0x59d609;};'use strict';var express=require(_0x54d8('0x0'));var passport=require('passport');var router=express[_0x54d8('0x1')]();var controller=require(_0x54d8('0x2'));var userController=require(_0x54d8('0x3'));var authService=require(_0x54d8('0x4'));router['get']('/',controller['login']);router[_0x54d8('0x5')](_0x54d8('0x6'),controller[_0x54d8('0x7')],authService[_0x54d8('0x8')],userController[_0x54d8('0x9')],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file +var _0x8c79=['express','../user/user.controller.js','get','login','/callback','setTokenCookie'];(function(_0x104857,_0x34844c){var _0x5c7d6d=function(_0x1aa95f){while(--_0x1aa95f){_0x104857['push'](_0x104857['shift']());}};_0x5c7d6d(++_0x34844c);}(_0x8c79,0xa8));var _0x98c7=function(_0x47c902,_0x220fd2){_0x47c902=_0x47c902-0x0;var _0x1ad6a0=_0x8c79[_0x47c902];return _0x1ad6a0;};'use strict';var express=require(_0x98c7('0x0'));var passport=require('passport');var router=express['Router']();var controller=require('./authGoogle.controller');var userController=require(_0x98c7('0x1'));var authService=require('../../components/auth/service');router[_0x98c7('0x2')]('/',controller[_0x98c7('0x3')]);router['get'](_0x98c7('0x4'),controller['callback'],authService['isMiddleware'],userController['login'],authService[_0x98c7('0x5')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index fe380b7..9b44277 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 _0xcd2c=['util','passport','passport-local','Strategy','lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','role','disabled','blockedAt','loginAttempts','admin','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','minutes','clearBlockUser','blocked','getLicense','catch','MailAccount','find','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','user','merge','format','request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','body','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','Reset\x20Email\x20sent!','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','validatePasswordHistory','previousPasswords'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcd2c,0x195));var _0xccd2=function(_0x5c61e4,_0x20a992){_0x5c61e4=_0x5c61e4-0x0;var _0x5224dc=_0xcd2c[_0x5c61e4];return _0x5224dc;};'use strict';var util=require(_0xccd2('0x0'));var passport=require(_0xccd2('0x1'));var LocalStrategy=require(_0xccd2('0x2'))[_0xccd2('0x3')];var jayson=require('jayson/promise');var _=require(_0xccd2('0x4'));var rs=require('randomstring');var moment=require(_0xccd2('0x5'));var db=require(_0xccd2('0x6'))['db'];var authService=require(_0xccd2('0x7'));var utils=require(_0xccd2('0x8'));var client=jayson[_0xccd2('0x9')][_0xccd2('0xa')]({'port':0x232b});function localAuthenticate(_0x40999d,_0x1a1fec,_0x44c4e7,_0x2fbd19){var _0x4b2ac2,_0x2b5982;return db[_0xccd2('0xb')][_0xccd2('0xc')]({'where':{'id':0x1},'attributes':[_0xccd2('0xd'),_0xccd2('0xe')],'raw':!![]})[_0xccd2('0xf')](function(_0x28ba04){_0x4b2ac2=_0x28ba04;return _0x40999d[_0xccd2('0xc')]({'attributes':['id',_0xccd2('0x10'),_0xccd2('0x11'),'salt',_0xccd2('0x12'),_0xccd2('0x13'),'blocked',_0xccd2('0x14'),_0xccd2('0x15')],'where':{'name':_0x1a1fec,'role':{'$or':[_0xccd2('0x16'),'user','agent']}}});})['then'](function(_0x365d3d){if(!_0x365d3d||_0x365d3d&&_0x365d3d['name']!==_0x1a1fec){throw new Error(_0xccd2('0x17'));}else{_0x2b5982=_0x365d3d;return _0x2b5982;}})[_0xccd2('0xf')](function(){_0x2b5982[_0xccd2('0x18')](_0x44c4e7,function(_0x2e7564,_0x51c5dd){var _0x1bbd95=_0x2b5982[_0xccd2('0x15')]+0x1;if(_0x2e7564){return _0x2fbd19(_0x2e7564);}else if(!_0x51c5dd){if(_0x2b5982[_0xccd2('0x13')]){return _0x2fbd19(null,![],{'message':_0xccd2('0x17')});}else if(_0x4b2ac2['allowedLoginAttempts']>0x0){if(_0x2b5982['blocked']){if(_0x4b2ac2[_0xccd2('0xe')]>0x0){if(moment(_0x2b5982[_0xccd2('0x14')])[_0xccd2('0x19')](_0x4b2ac2[_0xccd2('0xe')],_0xccd2('0x1a'))>moment()){return _0x2fbd19(null,![],{'message':_0xccd2('0x17')});}else{return utils[_0xccd2('0x1b')](_0x2b5982,_0x1bbd95,![],null)[_0xccd2('0xf')](function(){return _0x2fbd19(null,![],{'message':_0xccd2('0x17')});});}}else{return _0x2fbd19(null,![],{'message':_0xccd2('0x17')});}}else{if(_0x1bbd95>=_0x4b2ac2['allowedLoginAttempts']){return utils[_0xccd2('0x1b')](_0x2b5982,0x0,!![],moment())[_0xccd2('0xf')](function(){return _0x2fbd19(null,![],{'message':_0xccd2('0x17')});});}else{return utils[_0xccd2('0x1b')](_0x2b5982,_0x1bbd95,![],null)[_0xccd2('0xf')](function(){return _0x2fbd19(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x2fbd19(null,![],{'message':_0xccd2('0x17')});}}else{if(_0x2b5982[_0xccd2('0x13')]){return _0x2fbd19(null,![],{'message':_0xccd2('0x17')});}else if(_0x4b2ac2[_0xccd2('0xd')]>0x0){if(_0x2b5982[_0xccd2('0x1c')]){if(_0x4b2ac2[_0xccd2('0xe')]>0x0){if(moment(_0x2b5982[_0xccd2('0x14')])['add'](_0x4b2ac2['blockDuration'],'minutes')>moment()){return _0x2fbd19(null,![],{'message':_0xccd2('0x17')});}else{return utils[_0xccd2('0x1b')](_0x2b5982,0x0,![],null)[_0xccd2('0xf')](function(){return utils['getLicense'](_0x2b5982);})[_0xccd2('0xf')](function(){return _0x2fbd19(null,_0x2b5982);});}}else{return _0x2fbd19(null,![],{'message':_0xccd2('0x17')});}}else{return utils[_0xccd2('0x1b')](_0x2b5982,0x0,![],null)['then'](function(){return utils[_0xccd2('0x1d')](_0x2b5982);})[_0xccd2('0xf')](function(){return _0x2fbd19(null,_0x2b5982);})[_0xccd2('0x1e')](function(_0x3b2d26){return _0x2fbd19(null,![],_0x3b2d26);});}}else{if(_0x2b5982[_0xccd2('0x1c')]){return _0x2fbd19(null,![],{'message':_0xccd2('0x17')});}else{return utils[_0xccd2('0x1d')](_0x2b5982)[_0xccd2('0xf')](function(){return _0x2fbd19(null,_0x2b5982);});}}}});})['catch'](function(_0x3037e1){return _0x2fbd19(null,![],_0x3037e1);});}function sendServiceMail(_0x5ab231){return db[_0xccd2('0x1f')][_0xccd2('0x20')]({'where':{'service':!![]},'attributes':['id',_0xccd2('0x10'),_0xccd2('0x21')],'include':[{'model':db['MailServerOut'],'as':_0xccd2('0x22')}]})[_0xccd2('0xf')](function(_0x4d5cf2){if(!_0x4d5cf2){throw new Error(_0xccd2('0x23'));}var _0x15a3dd={'tls':{'rejectUnauthorized':![]}};if(_0x4d5cf2['Smtp'][_0xccd2('0x24')]){_0x15a3dd[_0xccd2('0x24')]=_0x4d5cf2['Smtp'][_0xccd2('0x24')];}else{_0x15a3dd[_0xccd2('0x25')]=_0x4d5cf2[_0xccd2('0x22')]['host'];_0x15a3dd['port']=_0x4d5cf2['Smtp'][_0xccd2('0x26')];_0x15a3dd[_0xccd2('0x27')]=_0x4d5cf2[_0xccd2('0x22')][_0xccd2('0x27')];}if(_0x4d5cf2[_0xccd2('0x22')][_0xccd2('0x28')]){_0x15a3dd[_0xccd2('0x29')]={'user':_0x4d5cf2['Smtp'][_0xccd2('0x2a')],'pass':_0x4d5cf2['Smtp']['pass']};}var _0x20cab7={'account':_0x15a3dd,'message':_[_0xccd2('0x2b')]({'from':util[_0xccd2('0x2c')]('\x22%s\x22\x20<%s>',_0x4d5cf2[_0xccd2('0x10')],_0x4d5cf2[_0xccd2('0x21')]||_0x4d5cf2[_0xccd2('0x22')]['user'])},_0x5ab231)};return client[_0xccd2('0x2d')]('SendMail',_0x20cab7);})[_0xccd2('0xf')](function(_0x3e125c){if(_0x3e125c[_0xccd2('0x2e')]){throw new Error(util[_0xccd2('0x2c')](_0xccd2('0x2f'),_0x3e125c[_0xccd2('0x2e')][_0xccd2('0x30')]||JSON[_0xccd2('0x31')](_0x3e125c[_0xccd2('0x2e')])));}return!![];});}function handleError(_0x9393a,_0x522622,_0x4e686a){return _0x9393a[_0xccd2('0x32')](_0x522622||0x1f4)[_0xccd2('0x33')]({'message':_0x4e686a?_0x4e686a[_0xccd2('0x30')]||_0x4e686a:''});}exports['login']=function(_0x3be377,_0x27ad43,_0x296968){passport[_0xccd2('0x18')](_0xccd2('0x34'),function(_0x963167,_0x283d53,_0xf10b1f){var _0x4e9055=_0x963167||_0xf10b1f;if(_0x4e9055){return handleError(_0x27ad43,0x191,_0x4e9055);}if(!_0x283d53){return handleError(_0x27ad43,0x194,{'message':_0xccd2('0x35')});}else{var _0x349478={'payload':{'id':_0x283d53['id'],'role':_0x283d53[_0xccd2('0x12')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x349478)[_0xccd2('0xf')](function(_0x802e0d){_0x27ad43[_0xccd2('0x36')]({'id':_0x283d53['id'],'token':_0x802e0d,'statusCall':'','isAlreadyLogged':_0x283d53[_0xccd2('0x37')]});});}})(_0x3be377,_0x27ad43,_0x296968);};exports[_0xccd2('0x38')]=function(_0x3a5dab,_0x56a8fa,_0x48decb){if(!_0x3a5dab['body'][_0xccd2('0x21')]){return handleError(_0x56a8fa,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x34fa5a=rs['generate']();_0x3a5dab[_0xccd2('0x39')]['email']=_0x3a5dab[_0xccd2('0x39')][_0xccd2('0x21')][_0xccd2('0x3a')]()[_0xccd2('0x3b')]();var _0x53edbe;return db[_0xccd2('0xb')][_0xccd2('0xc')]({'where':{'id':0x1},'attributes':[_0xccd2('0xd'),_0xccd2('0xe')],'raw':!![]})[_0xccd2('0xf')](function(_0x35b6c2){_0x53edbe=_0x35b6c2;return db[_0xccd2('0x3c')][_0xccd2('0x20')]({'where':{'email':_0x3a5dab[_0xccd2('0x39')][_0xccd2('0x21')]}});})[_0xccd2('0xf')](function(_0x19d38a){if(!_0x19d38a){throw new Error(_0xccd2('0x3d'));}if(_0x19d38a[_0xccd2('0x13')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x19d38a[_0xccd2('0x1c')]){if(moment(_0x19d38a[_0xccd2('0x14')])[_0xccd2('0x19')](_0x53edbe[_0xccd2('0xe')],'minutes')>moment()){throw new Error(_0xccd2('0x3e'));}else{_0x19d38a[_0xccd2('0x1c')]=![];_0x19d38a[_0xccd2('0x14')]=null;}}_0x19d38a[_0xccd2('0x3f')]=_0x34fa5a;_0x19d38a[_0xccd2('0x40')]=Date[_0xccd2('0x41')]()+0x36ee80;return _0x19d38a[_0xccd2('0x42')]();})[_0xccd2('0xf')](function(){return sendServiceMail({'to':_0x3a5dab[_0xccd2('0x39')][_0xccd2('0x21')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xccd2('0x43')+_0xccd2('0x44')+_0xccd2('0x45')+_0x3a5dab[_0xccd2('0x46')][_0xccd2('0x25')]+_0xccd2('0x47')+_0x34fa5a+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0xccd2('0xf')](function(){_0x56a8fa[_0xccd2('0x32')](0xc8)['send']({'message':_0xccd2('0x48')});})[_0xccd2('0x1e')](function(_0x2be123){return handleError(_0x56a8fa,0x1f4,_0x2be123);});};exports['reset']=function(_0x113e04,_0x2e521b,_0x39f042){return db['User'][_0xccd2('0x20')]({'where':{'resetPasswordToken':_0x113e04['params'][_0xccd2('0x49')],'resetPasswordExpires':{'$gt':Date[_0xccd2('0x41')]()}}})[_0xccd2('0xf')](function(_0x3b2598){if(!_0x3b2598){throw new Error(_0xccd2('0x4a'));}return db['Setting'][_0xccd2('0xc')]({'attributes':['id',_0xccd2('0x4b'),_0xccd2('0x4c'),_0xccd2('0x4d')]})[_0xccd2('0xf')](function(_0x19114b){if(_0x19114b[_0xccd2('0x4b')])authService[_0xccd2('0x4e')](_0x113e04[_0xccd2('0x39')][_0xccd2('0x11')]);if(!_0x19114b[_0xccd2('0x4c')]||!_0x3b2598['previousPasswords'])return _0x3b2598;authService[_0xccd2('0x4f')](_0x113e04[_0xccd2('0x39')][_0xccd2('0x11')],_0x3b2598[_0xccd2('0x50')],_0x19114b['passwordHistoryLimit']);return _0x3b2598;})[_0xccd2('0xf')](function(){_0x3b2598[_0xccd2('0x11')]=_0x113e04['body']['password'];_0x3b2598[_0xccd2('0x3f')]=null;_0x3b2598[_0xccd2('0x40')]=null;return _0x3b2598[_0xccd2('0x42')]();});})[_0xccd2('0xf')](function(){_0x2e521b['status'](0xc8)['send']({'message':'Password\x20reset!'});})['catch'](function(_0x253fc6){return handleError(_0x2e521b,0x1f4,_0x253fc6);});};passport['use'](_0xccd2('0x34'),new LocalStrategy({'usernameField':'name','passwordField':_0xccd2('0x11')},function(_0xc92f16,_0x3a2e83,_0x25813c){return localAuthenticate(db[_0xccd2('0x3c')],_0xc92f16,_0x3a2e83,_0x25813c);})); \ No newline at end of file +var _0xf95a=['\x22%s\x22\x20<%s>','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','stringify','status','send','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','findOne','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','resetPasswordToken','Password\x20reset!','use','passport','Strategy','jayson/promise','randomstring','moment','../../components/auth/service','../../config/utils','client','http','Setting','allowedLoginAttempts','blockDuration','then','name','password','salt','role','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','service','host','port','secure','authentication','auth','merge','format'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xf95a,0xd6));var _0xaf95=function(_0x8584dd,_0x502183){_0x8584dd=_0x8584dd-0x0;var _0x5cc927=_0xf95a[_0x8584dd];return _0x5cc927;};'use strict';var util=require('util');var passport=require(_0xaf95('0x0'));var LocalStrategy=require('passport-local')[_0xaf95('0x1')];var jayson=require(_0xaf95('0x2'));var _=require('lodash');var rs=require(_0xaf95('0x3'));var moment=require(_0xaf95('0x4'));var db=require('../../mysqldb')['db'];var authService=require(_0xaf95('0x5'));var utils=require(_0xaf95('0x6'));var client=jayson[_0xaf95('0x7')][_0xaf95('0x8')]({'port':0x232b});function localAuthenticate(_0x159c4c,_0x2e9df2,_0x16f322,_0x3029ee){var _0x546824,_0x5d7ece;return db[_0xaf95('0x9')]['findOne']({'where':{'id':0x1},'attributes':[_0xaf95('0xa'),_0xaf95('0xb')],'raw':!![]})[_0xaf95('0xc')](function(_0x101f5b){_0x546824=_0x101f5b;return _0x159c4c['findOne']({'attributes':['id',_0xaf95('0xd'),_0xaf95('0xe'),_0xaf95('0xf'),_0xaf95('0x10'),'disabled',_0xaf95('0x11'),_0xaf95('0x12'),_0xaf95('0x13')],'where':{'name':_0x2e9df2,'role':{'$or':[_0xaf95('0x14'),_0xaf95('0x15'),_0xaf95('0x16')]}}});})['then'](function(_0x51dcfd){if(!_0x51dcfd||_0x51dcfd&&_0x51dcfd[_0xaf95('0xd')]!==_0x2e9df2){throw new Error(_0xaf95('0x17'));}else{_0x5d7ece=_0x51dcfd;return _0x5d7ece;}})[_0xaf95('0xc')](function(){_0x5d7ece[_0xaf95('0x18')](_0x16f322,function(_0x2320c5,_0x47010b){var _0x29c81d=_0x5d7ece[_0xaf95('0x13')]+0x1;if(_0x2320c5){return _0x3029ee(_0x2320c5);}else if(!_0x47010b){if(_0x5d7ece[_0xaf95('0x19')]){return _0x3029ee(null,![],{'message':_0xaf95('0x17')});}else if(_0x546824['allowedLoginAttempts']>0x0){if(_0x5d7ece[_0xaf95('0x11')]){if(_0x546824['blockDuration']>0x0){if(moment(_0x5d7ece[_0xaf95('0x12')])[_0xaf95('0x1a')](_0x546824[_0xaf95('0xb')],_0xaf95('0x1b'))>moment()){return _0x3029ee(null,![],{'message':_0xaf95('0x17')});}else{return utils[_0xaf95('0x1c')](_0x5d7ece,_0x29c81d,![],null)[_0xaf95('0xc')](function(){return _0x3029ee(null,![],{'message':_0xaf95('0x17')});});}}else{return _0x3029ee(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x29c81d>=_0x546824['allowedLoginAttempts']){return utils['clearBlockUser'](_0x5d7ece,0x0,!![],moment())[_0xaf95('0xc')](function(){return _0x3029ee(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0xaf95('0x1c')](_0x5d7ece,_0x29c81d,![],null)[_0xaf95('0xc')](function(){return _0x3029ee(null,![],{'message':_0xaf95('0x17')});});}}}else{return _0x3029ee(null,![],{'message':_0xaf95('0x17')});}}else{if(_0x5d7ece[_0xaf95('0x19')]){return _0x3029ee(null,![],{'message':_0xaf95('0x17')});}else if(_0x546824[_0xaf95('0xa')]>0x0){if(_0x5d7ece[_0xaf95('0x11')]){if(_0x546824[_0xaf95('0xb')]>0x0){if(moment(_0x5d7ece[_0xaf95('0x12')])[_0xaf95('0x1a')](_0x546824[_0xaf95('0xb')],_0xaf95('0x1b'))>moment()){return _0x3029ee(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xaf95('0x1c')](_0x5d7ece,0x0,![],null)['then'](function(){return utils[_0xaf95('0x1d')](_0x5d7ece);})['then'](function(){return _0x3029ee(null,_0x5d7ece);});}}else{return _0x3029ee(null,![],{'message':_0xaf95('0x17')});}}else{return utils[_0xaf95('0x1c')](_0x5d7ece,0x0,![],null)[_0xaf95('0xc')](function(){return utils[_0xaf95('0x1d')](_0x5d7ece);})[_0xaf95('0xc')](function(){return _0x3029ee(null,_0x5d7ece);})['catch'](function(_0x156af0){return _0x3029ee(null,![],_0x156af0);});}}else{if(_0x5d7ece[_0xaf95('0x11')]){return _0x3029ee(null,![],{'message':_0xaf95('0x17')});}else{return utils[_0xaf95('0x1d')](_0x5d7ece)[_0xaf95('0xc')](function(){return _0x3029ee(null,_0x5d7ece);});}}}});})[_0xaf95('0x1e')](function(_0x2323be){return _0x3029ee(null,![],_0x2323be);});}function sendServiceMail(_0x1f417e){return db[_0xaf95('0x1f')][_0xaf95('0x20')]({'where':{'service':!![]},'attributes':['id',_0xaf95('0xd'),_0xaf95('0x21')],'include':[{'model':db[_0xaf95('0x22')],'as':_0xaf95('0x23')}]})['then'](function(_0x19555d){if(!_0x19555d){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x5a6e44={'tls':{'rejectUnauthorized':![]}};if(_0x19555d[_0xaf95('0x23')]['service']){_0x5a6e44[_0xaf95('0x24')]=_0x19555d['Smtp']['service'];}else{_0x5a6e44[_0xaf95('0x25')]=_0x19555d[_0xaf95('0x23')][_0xaf95('0x25')];_0x5a6e44[_0xaf95('0x26')]=_0x19555d[_0xaf95('0x23')][_0xaf95('0x26')];_0x5a6e44[_0xaf95('0x27')]=_0x19555d[_0xaf95('0x23')][_0xaf95('0x27')];}if(_0x19555d['Smtp'][_0xaf95('0x28')]){_0x5a6e44[_0xaf95('0x29')]={'user':_0x19555d[_0xaf95('0x23')][_0xaf95('0x15')],'pass':_0x19555d['Smtp']['pass']};}var _0x2c24a6={'account':_0x5a6e44,'message':_[_0xaf95('0x2a')]({'from':util[_0xaf95('0x2b')](_0xaf95('0x2c'),_0x19555d[_0xaf95('0xd')],_0x19555d['email']||_0x19555d['Smtp'][_0xaf95('0x15')])},_0x1f417e)};return client[_0xaf95('0x2d')](_0xaf95('0x2e'),_0x2c24a6);})[_0xaf95('0xc')](function(_0x302150){if(_0x302150['error']){throw new Error(util[_0xaf95('0x2b')](_0xaf95('0x2f'),_0x302150[_0xaf95('0x30')][_0xaf95('0x31')]||JSON[_0xaf95('0x32')](_0x302150[_0xaf95('0x30')])));}return!![];});}function handleError(_0x450288,_0x5134a6,_0x5d8149){return _0x450288[_0xaf95('0x33')](_0x5134a6||0x1f4)[_0xaf95('0x34')]({'message':_0x5d8149?_0x5d8149[_0xaf95('0x31')]||_0x5d8149:''});}exports['login']=function(_0x426b26,_0x50bfe9,_0x4008f6){passport[_0xaf95('0x18')](_0xaf95('0x35'),function(_0x1b4a22,_0x49dd4a,_0x19b778){var _0x149a1a=_0x1b4a22||_0x19b778;if(_0x149a1a){return handleError(_0x50bfe9,0x191,_0x149a1a);}if(!_0x49dd4a){return handleError(_0x50bfe9,0x194,{'message':_0xaf95('0x36')});}else{var _0x21e1f4={'payload':{'id':_0x49dd4a['id'],'role':_0x49dd4a['role']},'options':{'expiresIn':0x15180}};return authService[_0xaf95('0x37')](_0x21e1f4)[_0xaf95('0xc')](function(_0x53a3b6){_0x50bfe9[_0xaf95('0x38')]({'id':_0x49dd4a['id'],'token':_0x53a3b6,'statusCall':'','isAlreadyLogged':_0x49dd4a[_0xaf95('0x39')]});});}})(_0x426b26,_0x50bfe9,_0x4008f6);};exports[_0xaf95('0x3a')]=function(_0x550d88,_0x43d301,_0x1387fc){if(!_0x550d88[_0xaf95('0x3b')][_0xaf95('0x21')]){return handleError(_0x43d301,0x1f4,{'message':_0xaf95('0x3c')});}var _0x3c9bf4=rs[_0xaf95('0x3d')]();_0x550d88[_0xaf95('0x3b')]['email']=_0x550d88['body'][_0xaf95('0x21')]['trim']()[_0xaf95('0x3e')]();var _0xdb9776;return db[_0xaf95('0x9')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xaf95('0xb')],'raw':!![]})[_0xaf95('0xc')](function(_0xbdc73){_0xdb9776=_0xbdc73;return db[_0xaf95('0x3f')][_0xaf95('0x20')]({'where':{'email':_0x550d88[_0xaf95('0x3b')][_0xaf95('0x21')]}});})[_0xaf95('0xc')](function(_0x11a64d){if(!_0x11a64d){throw new Error(_0xaf95('0x40'));}if(_0x11a64d[_0xaf95('0x19')]){throw new Error(_0xaf95('0x41'));}if(_0x11a64d['blocked']){if(moment(_0x11a64d[_0xaf95('0x12')])['add'](_0xdb9776['blockDuration'],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x11a64d[_0xaf95('0x11')]=![];_0x11a64d['blockedAt']=null;}}_0x11a64d['resetPasswordToken']=_0x3c9bf4;_0x11a64d[_0xaf95('0x42')]=Date[_0xaf95('0x43')]()+0x36ee80;return _0x11a64d[_0xaf95('0x44')]();})[_0xaf95('0xc')](function(){return sendServiceMail({'to':_0x550d88[_0xaf95('0x3b')]['email'],'subject':_0xaf95('0x45'),'text':_0xaf95('0x46')+_0xaf95('0x47')+_0xaf95('0x48')+_0x550d88['headers']['host']+_0xaf95('0x49')+_0x3c9bf4+'\x0a\x0a'+_0xaf95('0x4a')});})[_0xaf95('0xc')](function(){_0x43d301[_0xaf95('0x33')](0xc8)['send']({'message':'Reset\x20Email\x20sent!'});})[_0xaf95('0x1e')](function(_0x267f11){return handleError(_0x43d301,0x1f4,_0x267f11);});};exports[_0xaf95('0x4b')]=function(_0x4d3fd1,_0x88e0f0,_0x475a77){return db['User']['find']({'where':{'resetPasswordToken':_0x4d3fd1['params'][_0xaf95('0x4c')],'resetPasswordExpires':{'$gt':Date[_0xaf95('0x43')]()}}})[_0xaf95('0xc')](function(_0x35148a){if(!_0x35148a){throw new Error(_0xaf95('0x4d'));}return db['Setting'][_0xaf95('0x4e')]({'attributes':['id',_0xaf95('0x4f'),_0xaf95('0x50'),_0xaf95('0x51')]})[_0xaf95('0xc')](function(_0x409ee3){if(_0x409ee3['securePassword'])authService['validatePasswordPattern'](_0x4d3fd1[_0xaf95('0x3b')]['password']);if(!_0x409ee3['enforcePasswordHistory']||!_0x35148a[_0xaf95('0x52')])return _0x35148a;authService['validatePasswordHistory'](_0x4d3fd1[_0xaf95('0x3b')][_0xaf95('0xe')],_0x35148a['previousPasswords'],_0x409ee3[_0xaf95('0x51')]);return _0x35148a;})[_0xaf95('0xc')](function(){_0x35148a['password']=_0x4d3fd1[_0xaf95('0x3b')][_0xaf95('0xe')];_0x35148a[_0xaf95('0x53')]=null;_0x35148a[_0xaf95('0x42')]=null;return _0x35148a['save']();});})[_0xaf95('0xc')](function(){_0x88e0f0['status'](0xc8)[_0xaf95('0x34')]({'message':_0xaf95('0x54')});})[_0xaf95('0x1e')](function(_0x4390a1){return handleError(_0x88e0f0,0x1f4,_0x4390a1);});};passport[_0xaf95('0x55')](_0xaf95('0x35'),new LocalStrategy({'usernameField':'name','passwordField':_0xaf95('0xe')},function(_0x51024a,_0x2c5e01,_0x2e861a){return localAuthenticate(db['User'],_0x51024a,_0x2c5e01,_0x2e861a);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index c8f4e4d..409eee8 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 _0x6af4=['./authLocal.controller','post','login','/forgot','forgot','/reset/:token','reset','exports','express'];(function(_0x1791b7,_0x205e7a){var _0x49d71a=function(_0x1c36a8){while(--_0x1c36a8){_0x1791b7['push'](_0x1791b7['shift']());}};_0x49d71a(++_0x205e7a);}(_0x6af4,0xce));var _0x46af=function(_0x126b67,_0x331b2e){_0x126b67=_0x126b67-0x0;var _0x351931=_0x6af4[_0x126b67];return _0x351931;};'use strict';var express=require(_0x46af('0x0'));var router=express['Router']();var controller=require(_0x46af('0x1'));router[_0x46af('0x2')]('/',controller[_0x46af('0x3')]);router[_0x46af('0x2')](_0x46af('0x4'),controller[_0x46af('0x5')]);router[_0x46af('0x2')](_0x46af('0x6'),controller[_0x46af('0x7')]);module[_0x46af('0x8')]=router; \ No newline at end of file +var _0xf81f=['/forgot','/reset/:token','reset','express','Router','./authLocal.controller','post','login'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf81f,0x1db));var _0xff81=function(_0x4f11dc,_0x4e3a99){_0x4f11dc=_0x4f11dc-0x0;var _0x37b7e3=_0xf81f[_0x4f11dc];return _0x37b7e3;};'use strict';var express=require(_0xff81('0x0'));var router=express[_0xff81('0x1')]();var controller=require(_0xff81('0x2'));router[_0xff81('0x3')]('/',controller[_0xff81('0x4')]);router[_0xff81('0x3')](_0xff81('0x5'),controller['forgot']);router[_0xff81('0x3')](_0xff81('0x6'),controller[_0xff81('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 1753516..329b28d 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 _0x3698=['INTEGER','sequelize','STRING'];(function(_0x204ce5,_0x46fb75){var _0x4f5a44=function(_0x55e0ac){while(--_0x55e0ac){_0x204ce5['push'](_0x204ce5['shift']());}};_0x4f5a44(++_0x46fb75);}(_0x3698,0x181));var _0x8369=function(_0xeb5575,_0x486f40){_0xeb5575=_0xeb5575-0x0;var _0x2da5cd=_0x3698[_0xeb5575];return _0x2da5cd;};'use strict';var Sequelize=require(_0x8369('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x8369('0x1')]},'description':{'type':Sequelize[_0x8369('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x8369('0x2')],'defaultValue':0xa}}; \ No newline at end of file +var _0x5f54=['STRING','INTEGER','sequelize','exports'];(function(_0x2d819b,_0x321af5){var _0x3799fd=function(_0x50090b){while(--_0x50090b){_0x2d819b['push'](_0x2d819b['shift']());}};_0x3799fd(++_0x321af5);}(_0x5f54,0x13e));var _0x45f5=function(_0x3bfad2,_0xe86c5b){_0x3bfad2=_0x3bfad2-0x0;var _0x1a688e=_0x5f54[_0x3bfad2];return _0x1a688e;};'use strict';var Sequelize=require(_0x45f5('0x0'));module[_0x45f5('0x1')]={'name':{'type':Sequelize[_0x45f5('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x45f5('0x2')]},'description':{'type':Sequelize[_0x45f5('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x45f5('0x3')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index ef53243..47139d6 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 _0x7a89=['Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','Automation','includeAll','include','show','params','find','catch','create','body','destroy','Condition','addConditions','ids','omit','getConditions','findOne','hasOwnProperty','addActions'];(function(_0x44474f,_0x431580){var _0x427d97=function(_0x53f7d4){while(--_0x53f7d4){_0x44474f['push'](_0x44474f['shift']());}};_0x427d97(++_0x431580);}(_0x7a89,0x104));var _0x97a8=function(_0x15ec78,_0x1e3a18){_0x15ec78=_0x15ec78-0x0;var _0x191f90=_0x7a89[_0x15ec78];return _0x191f90;};'use strict';var emlformat=require(_0x97a8('0x0'));var rimraf=require(_0x97a8('0x1'));var zipdir=require(_0x97a8('0x2'));var jsonpatch=require(_0x97a8('0x3'));var rp=require(_0x97a8('0x4'));var moment=require(_0x97a8('0x5'));var BPromise=require(_0x97a8('0x6'));var Mustache=require(_0x97a8('0x7'));var util=require(_0x97a8('0x8'));var path=require('path');var sox=require(_0x97a8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x97a8('0xa'));var _=require('lodash');var squel=require(_0x97a8('0xb'));var crypto=require(_0x97a8('0xc'));var jsforce=require(_0x97a8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x97a8('0xe'));var querystring=require(_0x97a8('0xf'));var Papa=require(_0x97a8('0x10'));var Redis=require(_0x97a8('0x11'));var authService=require(_0x97a8('0x12'));var qs=require(_0x97a8('0x13'));var as=require(_0x97a8('0x14'));var hardwareService=require(_0x97a8('0x15'));var logger=require(_0x97a8('0x16'))(_0x97a8('0x17'));var utils=require(_0x97a8('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x97a8('0x19'))['db'];function respondWithStatusCode(_0x457aef,_0x21bb48){_0x21bb48=_0x21bb48||0xcc;return function(_0x27b945){if(_0x27b945){return _0x457aef[_0x97a8('0x1a')](_0x21bb48);}return _0x457aef['status'](_0x21bb48)['end']();};}function respondWithResult(_0x135c19,_0x37d687){_0x37d687=_0x37d687||0xc8;return function(_0x286609){if(_0x286609){return _0x135c19[_0x97a8('0x1b')](_0x37d687)[_0x97a8('0x1c')](_0x286609);}};}function respondWithFilteredResult(_0x40c8a9,_0x43c061){return function(_0x14199d){if(_0x14199d){var _0x2ecdb8=typeof _0x43c061[_0x97a8('0x1d')]===_0x97a8('0x1e')&&typeof _0x43c061['limit']===_0x97a8('0x1e');var _0x8820bf=_0x14199d[_0x97a8('0x1f')];var _0x2e87a9=_0x2ecdb8?0x0:_0x43c061[_0x97a8('0x1d')];var _0x47127c=_0x2ecdb8?_0x14199d[_0x97a8('0x1f')]:_0x43c061[_0x97a8('0x1d')]+_0x43c061[_0x97a8('0x20')];var _0x55fe5e;if(_0x47127c>=_0x8820bf){_0x47127c=_0x8820bf;_0x55fe5e=0xc8;}else{_0x55fe5e=0xce;}_0x40c8a9[_0x97a8('0x1b')](_0x55fe5e);return _0x40c8a9['set'](_0x97a8('0x21'),_0x2e87a9+'-'+_0x47127c+'/'+_0x8820bf)[_0x97a8('0x1c')](_0x14199d);}return null;};}function patchUpdates(_0x43ca2a){return function(_0x10b80d){try{jsonpatch[_0x97a8('0x22')](_0x10b80d,_0x43ca2a,!![]);}catch(_0x4666b0){return BPromise[_0x97a8('0x23')](_0x4666b0);}return _0x10b80d[_0x97a8('0x24')]();};}function saveUpdates(_0x40659d,_0x370950){return function(_0x269f1b){if(_0x269f1b){return _0x269f1b[_0x97a8('0x25')](_0x40659d)[_0x97a8('0x26')](function(_0x56ace7){return _0x56ace7;});}return null;};}function removeEntity(_0x4439c0,_0x5a81c6){return function(_0x291df7){if(_0x291df7){return _0x291df7['destroy']()[_0x97a8('0x26')](function(){_0x4439c0[_0x97a8('0x1b')](0xcc)[_0x97a8('0x27')]();});}};}function handleEntityNotFound(_0x400c2a,_0x1532ad){return function(_0x41512d){if(!_0x41512d){_0x400c2a[_0x97a8('0x1a')](0x194);}return _0x41512d;};}function handleError(_0x516c17,_0x1e3697){_0x1e3697=_0x1e3697||0x1f4;return function(_0x461136){logger[_0x97a8('0x28')](_0x461136[_0x97a8('0x29')]);if(_0x461136[_0x97a8('0x2a')]){delete _0x461136[_0x97a8('0x2a')];}_0x516c17[_0x97a8('0x1b')](_0x1e3697)[_0x97a8('0x2b')](_0x461136);};}exports[_0x97a8('0x2c')]=function(_0x223131,_0x2dc307){var _0x58df78={},_0x4d0217={},_0xf70eef={'count':0x0,'rows':[]};var _0x5c0803=_['map'](db['Automation'][_0x97a8('0x2d')],function(_0x5ba2fd){return{'name':_0x5ba2fd[_0x97a8('0x2e')],'type':_0x5ba2fd[_0x97a8('0x2f')]['key']};});_0x4d0217[_0x97a8('0x30')]=_[_0x97a8('0x31')](_0x5c0803,_0x97a8('0x2a'));_0x4d0217[_0x97a8('0x32')]=_[_0x97a8('0x33')](_0x223131[_0x97a8('0x32')]);_0x4d0217[_0x97a8('0x34')]=_[_0x97a8('0x35')](_0x4d0217[_0x97a8('0x30')],_0x4d0217[_0x97a8('0x32')]);_0x58df78[_0x97a8('0x36')]=_['intersection'](_0x4d0217[_0x97a8('0x30')],qs[_0x97a8('0x37')](_0x223131[_0x97a8('0x32')]['fields']));_0x58df78[_0x97a8('0x36')]=_0x58df78[_0x97a8('0x36')][_0x97a8('0x38')]?_0x58df78[_0x97a8('0x36')]:_0x4d0217[_0x97a8('0x30')];if(!_0x223131[_0x97a8('0x32')]['hasOwnProperty'](_0x97a8('0x39'))){_0x58df78[_0x97a8('0x20')]=qs[_0x97a8('0x20')](_0x223131[_0x97a8('0x32')]['limit']);_0x58df78['offset']=qs[_0x97a8('0x1d')](_0x223131[_0x97a8('0x32')][_0x97a8('0x1d')]);}_0x58df78[_0x97a8('0x3a')]=qs['sort'](_0x223131[_0x97a8('0x32')][_0x97a8('0x3b')]);_0x58df78[_0x97a8('0x3c')]=qs[_0x97a8('0x34')](_[_0x97a8('0x3d')](_0x223131[_0x97a8('0x32')],_0x4d0217['filters']),_0x5c0803);if(_0x223131[_0x97a8('0x32')]['filter']){_0x58df78[_0x97a8('0x3c')]=_[_0x97a8('0x3e')](_0x58df78[_0x97a8('0x3c')],{'$or':_[_0x97a8('0x31')](_0x5c0803,function(_0x409c29){if(_0x409c29[_0x97a8('0x2f')]!==_0x97a8('0x3f')){var _0x8ad478={};_0x8ad478[_0x409c29[_0x97a8('0x2a')]]={'$like':'%'+_0x223131[_0x97a8('0x32')][_0x97a8('0x40')]+'%'};return _0x8ad478;}})});}_0x58df78=_['merge']({},_0x58df78,_0x223131[_0x97a8('0x41')]);var _0x2214fd={'where':_0x58df78[_0x97a8('0x3c')]};return db[_0x97a8('0x42')][_0x97a8('0x1f')](_0x2214fd)['then'](function(_0x4a95e2){_0xf70eef[_0x97a8('0x1f')]=_0x4a95e2;if(_0x223131[_0x97a8('0x32')][_0x97a8('0x43')]){_0x58df78[_0x97a8('0x44')]=[{'all':!![]}];}return db[_0x97a8('0x42')]['findAll'](_0x58df78);})[_0x97a8('0x26')](function(_0x85562e){_0xf70eef['rows']=_0x85562e;return _0xf70eef;})[_0x97a8('0x26')](respondWithFilteredResult(_0x2dc307,_0x58df78))['catch'](handleError(_0x2dc307,null));};exports[_0x97a8('0x45')]=function(_0x4d3b76,_0x5e52ff){var _0x140f37={'raw':![],'where':{'id':_0x4d3b76[_0x97a8('0x46')]['id']}},_0x1343e2={};_0x1343e2[_0x97a8('0x30')]=_['keys'](db[_0x97a8('0x42')][_0x97a8('0x2d')]);_0x1343e2[_0x97a8('0x32')]=_[_0x97a8('0x33')](_0x4d3b76['query']);_0x1343e2[_0x97a8('0x34')]=_[_0x97a8('0x35')](_0x1343e2[_0x97a8('0x30')],_0x1343e2[_0x97a8('0x32')]);_0x140f37[_0x97a8('0x36')]=_[_0x97a8('0x35')](_0x1343e2[_0x97a8('0x30')],qs['fields'](_0x4d3b76[_0x97a8('0x32')][_0x97a8('0x37')]));_0x140f37['attributes']=_0x140f37[_0x97a8('0x36')][_0x97a8('0x38')]?_0x140f37[_0x97a8('0x36')]:_0x1343e2[_0x97a8('0x30')];if(_0x4d3b76[_0x97a8('0x32')][_0x97a8('0x43')]){_0x140f37[_0x97a8('0x44')]=[{'all':!![]}];}_0x140f37=_['merge']({},_0x140f37,_0x4d3b76[_0x97a8('0x41')]);return db[_0x97a8('0x42')][_0x97a8('0x47')](_0x140f37)[_0x97a8('0x26')](handleEntityNotFound(_0x5e52ff,null))[_0x97a8('0x26')](respondWithResult(_0x5e52ff,null))[_0x97a8('0x48')](handleError(_0x5e52ff,null));};exports[_0x97a8('0x49')]=function(_0x311ffb,_0x58b054){return db[_0x97a8('0x42')][_0x97a8('0x49')](_0x311ffb[_0x97a8('0x4a')],{})[_0x97a8('0x26')](respondWithResult(_0x58b054,0xc9))['catch'](handleError(_0x58b054,null));};exports[_0x97a8('0x25')]=function(_0x3caada,_0x505931){if(_0x3caada[_0x97a8('0x4a')]['id']){delete _0x3caada[_0x97a8('0x4a')]['id'];}return db[_0x97a8('0x42')][_0x97a8('0x47')]({'where':{'id':_0x3caada[_0x97a8('0x46')]['id']}})[_0x97a8('0x26')](handleEntityNotFound(_0x505931,null))['then'](saveUpdates(_0x3caada[_0x97a8('0x4a')],null))['then'](respondWithResult(_0x505931,null))['catch'](handleError(_0x505931,null));};exports[_0x97a8('0x4b')]=function(_0x3cecc5,_0xc9d98b){return db[_0x97a8('0x42')]['find']({'where':{'id':_0x3cecc5[_0x97a8('0x46')]['id']}})[_0x97a8('0x26')](handleEntityNotFound(_0xc9d98b,null))['then'](removeEntity(_0xc9d98b,null))[_0x97a8('0x48')](handleError(_0xc9d98b,null));};exports['addConditions']=function(_0x384b6c,_0xe8fcd6,_0x15b3be){return db[_0x97a8('0x4c')][_0x97a8('0x47')]({'where':{'id':_0x384b6c['params']['id']}})[_0x97a8('0x26')](handleEntityNotFound(_0xe8fcd6,null))[_0x97a8('0x26')](function(_0x2a2e59){if(_0x2a2e59){return _0x2a2e59[_0x97a8('0x4d')](_0x384b6c['body'][_0x97a8('0x4e')],_[_0x97a8('0x4f')](_0x384b6c[_0x97a8('0x4a')],[_0x97a8('0x4e'),'id'])||{});}})[_0x97a8('0x26')](respondWithResult(_0xe8fcd6,null))['catch'](handleError(_0xe8fcd6,null));};exports[_0x97a8('0x50')]=function(_0x2cfa07,_0xa79baa,_0x54fe93){var _0xcaea47={};var _0x2b40c0={};var _0x496f52;var _0x337ec6;return db['Automation'][_0x97a8('0x51')]({'where':{'id':_0x2cfa07[_0x97a8('0x46')]['id']}})['then'](handleEntityNotFound(_0xa79baa,null))[_0x97a8('0x26')](function(_0x33b2db){if(_0x33b2db){_0x496f52=_0x33b2db;_0x2b40c0[_0x97a8('0x30')]=_['keys'](db['Condition']['rawAttributes']);_0x2b40c0[_0x97a8('0x32')]=_['keys'](_0x2cfa07[_0x97a8('0x32')]);_0x2b40c0[_0x97a8('0x34')]=_[_0x97a8('0x35')](_0x2b40c0[_0x97a8('0x30')],_0x2b40c0[_0x97a8('0x32')]);_0xcaea47[_0x97a8('0x36')]=_[_0x97a8('0x35')](_0x2b40c0[_0x97a8('0x30')],qs[_0x97a8('0x37')](_0x2cfa07['query'][_0x97a8('0x37')]));_0xcaea47[_0x97a8('0x36')]=_0xcaea47[_0x97a8('0x36')][_0x97a8('0x38')]?_0xcaea47['attributes']:_0x2b40c0[_0x97a8('0x30')];_0xcaea47[_0x97a8('0x3a')]=qs[_0x97a8('0x3b')](_0x2cfa07[_0x97a8('0x32')][_0x97a8('0x3b')]);_0xcaea47[_0x97a8('0x3c')]=qs['filters'](_[_0x97a8('0x3d')](_0x2cfa07['query'],_0x2b40c0[_0x97a8('0x34')]));if(_0x2cfa07[_0x97a8('0x32')][_0x97a8('0x40')]){_0xcaea47['where']=_[_0x97a8('0x3e')](_0xcaea47[_0x97a8('0x3c')],{'$or':_[_0x97a8('0x31')](_0xcaea47[_0x97a8('0x36')],function(_0x560b1b){var _0x2be4b7={};_0x2be4b7[_0x560b1b]={'$like':'%'+_0x2cfa07[_0x97a8('0x32')][_0x97a8('0x40')]+'%'};return _0x2be4b7;})});}_0xcaea47=_['merge']({},_0xcaea47,_0x2cfa07[_0x97a8('0x41')]);return _0x496f52[_0x97a8('0x50')](_0xcaea47);}})[_0x97a8('0x26')](function(_0x14bd7e){if(_0x14bd7e){_0x337ec6=_0x14bd7e[_0x97a8('0x38')];if(!_0x2cfa07[_0x97a8('0x32')][_0x97a8('0x52')](_0x97a8('0x39'))){_0xcaea47[_0x97a8('0x20')]=qs[_0x97a8('0x20')](_0x2cfa07[_0x97a8('0x32')][_0x97a8('0x20')]);_0xcaea47['offset']=qs[_0x97a8('0x1d')](_0x2cfa07['query'][_0x97a8('0x1d')]);}return _0x496f52[_0x97a8('0x50')](_0xcaea47);}})[_0x97a8('0x26')](function(_0x15d80f){if(_0x15d80f){return _0x15d80f?{'count':_0x337ec6,'rows':_0x15d80f}:null;}})[_0x97a8('0x26')](respondWithResult(_0xa79baa,null))['catch'](handleError(_0xa79baa,null));};exports[_0x97a8('0x53')]=function(_0x4b53d4,_0x51b6eb,_0x207a1f){return db[_0x97a8('0x54')][_0x97a8('0x47')]({'where':{'id':_0x4b53d4[_0x97a8('0x46')]['id']}})['then'](handleEntityNotFound(_0x51b6eb,null))[_0x97a8('0x26')](function(_0x44f0b2){if(_0x44f0b2){return _0x44f0b2['addActions'](_0x4b53d4[_0x97a8('0x4a')][_0x97a8('0x4e')],_[_0x97a8('0x4f')](_0x4b53d4[_0x97a8('0x4a')],[_0x97a8('0x4e'),'id'])||{});}})['then'](respondWithResult(_0x51b6eb,null))[_0x97a8('0x48')](handleError(_0x51b6eb,null));};exports['getActions']=function(_0x172034,_0x55857e,_0x159459){var _0xc5e309={};var _0x368a9d={};var _0x5c1c9d;var _0x50622e;return db[_0x97a8('0x42')][_0x97a8('0x51')]({'where':{'id':_0x172034[_0x97a8('0x46')]['id']}})[_0x97a8('0x26')](handleEntityNotFound(_0x55857e,null))[_0x97a8('0x26')](function(_0x74a5a7){if(_0x74a5a7){_0x5c1c9d=_0x74a5a7;_0x368a9d['model']=_[_0x97a8('0x33')](db['Action'][_0x97a8('0x2d')]);_0x368a9d[_0x97a8('0x32')]=_[_0x97a8('0x33')](_0x172034[_0x97a8('0x32')]);_0x368a9d['filters']=_[_0x97a8('0x35')](_0x368a9d['model'],_0x368a9d['query']);_0xc5e309[_0x97a8('0x36')]=_[_0x97a8('0x35')](_0x368a9d['model'],qs['fields'](_0x172034[_0x97a8('0x32')]['fields']));_0xc5e309['attributes']=_0xc5e309[_0x97a8('0x36')][_0x97a8('0x38')]?_0xc5e309['attributes']:_0x368a9d[_0x97a8('0x30')];_0xc5e309['order']=qs['sort'](_0x172034[_0x97a8('0x32')][_0x97a8('0x3b')]);_0xc5e309[_0x97a8('0x3c')]=qs['filters'](_[_0x97a8('0x3d')](_0x172034[_0x97a8('0x32')],_0x368a9d[_0x97a8('0x34')]));if(_0x172034[_0x97a8('0x32')][_0x97a8('0x40')]){_0xc5e309[_0x97a8('0x3c')]=_[_0x97a8('0x3e')](_0xc5e309[_0x97a8('0x3c')],{'$or':_[_0x97a8('0x31')](_0xc5e309[_0x97a8('0x36')],function(_0x204efa){var _0x290f86={};_0x290f86[_0x204efa]={'$like':'%'+_0x172034[_0x97a8('0x32')][_0x97a8('0x40')]+'%'};return _0x290f86;})});}_0xc5e309=_[_0x97a8('0x3e')]({},_0xc5e309,_0x172034[_0x97a8('0x41')]);return _0x5c1c9d[_0x97a8('0x55')](_0xc5e309);}})[_0x97a8('0x26')](function(_0x35c79b){if(_0x35c79b){_0x50622e=_0x35c79b[_0x97a8('0x38')];if(!_0x172034[_0x97a8('0x32')][_0x97a8('0x52')](_0x97a8('0x39'))){_0xc5e309[_0x97a8('0x20')]=qs[_0x97a8('0x20')](_0x172034[_0x97a8('0x32')]['limit']);_0xc5e309[_0x97a8('0x1d')]=qs[_0x97a8('0x1d')](_0x172034['query']['offset']);}return _0x5c1c9d[_0x97a8('0x55')](_0xc5e309);}})[_0x97a8('0x26')](function(_0x5b55ba){if(_0x5b55ba){return _0x5b55ba?{'count':_0x50622e,'rows':_0x5b55ba}:null;}})[_0x97a8('0x26')](respondWithResult(_0x55857e,null))[_0x97a8('0x48')](handleError(_0x55857e,null));}; \ No newline at end of file +var _0x6daa=['attributes','fields','nolimit','limit','offset','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','length','catch','update','body','find','params','addConditions','ids','omit','getConditions','Condition','pick','hasOwnProperty','addActions','Action','getActions','findOne','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','status','end','json','undefined','count','set','Content-Range','reject','save','destroy','then','sendStatus','stack','name','index','Automation','fieldName','key','model','map','query','keys','intersection'];(function(_0x335ff7,_0x3853e4){var _0x38637c=function(_0x1628f9){while(--_0x1628f9){_0x335ff7['push'](_0x335ff7['shift']());}};_0x38637c(++_0x3853e4);}(_0x6daa,0xc5));var _0xa6da=function(_0x4f9353,_0x253dc3){_0x4f9353=_0x4f9353-0x0;var _0x2de7b1=_0x6daa[_0x4f9353];return _0x2de7b1;};'use strict';var emlformat=require(_0xa6da('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa6da('0x1'));var rp=require(_0xa6da('0x2'));var moment=require('moment');var BPromise=require(_0xa6da('0x3'));var Mustache=require(_0xa6da('0x4'));var util=require(_0xa6da('0x5'));var path=require(_0xa6da('0x6'));var sox=require(_0xa6da('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa6da('0x8'));var _=require(_0xa6da('0x9'));var squel=require(_0xa6da('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa6da('0xb'));var toCsv=require(_0xa6da('0xc'));var querystring=require(_0xa6da('0xd'));var Papa=require(_0xa6da('0xe'));var Redis=require('ioredis');var authService=require(_0xa6da('0xf'));var qs=require(_0xa6da('0x10'));var as=require(_0xa6da('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa6da('0x12'))('api');var utils=require(_0xa6da('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e9790,_0x5a60d2){_0x5a60d2=_0x5a60d2||0xcc;return function(_0x32d04e){if(_0x32d04e){return _0x5e9790['sendStatus'](_0x5a60d2);}return _0x5e9790[_0xa6da('0x14')](_0x5a60d2)[_0xa6da('0x15')]();};}function respondWithResult(_0x4f54c9,_0x1b712d){_0x1b712d=_0x1b712d||0xc8;return function(_0x4a9806){if(_0x4a9806){return _0x4f54c9[_0xa6da('0x14')](_0x1b712d)[_0xa6da('0x16')](_0x4a9806);}};}function respondWithFilteredResult(_0x5bdf56,_0x161255){return function(_0x25d519){if(_0x25d519){var _0x58e482=typeof _0x161255['offset']===_0xa6da('0x17')&&typeof _0x161255['limit']===_0xa6da('0x17');var _0x34d3b9=_0x25d519[_0xa6da('0x18')];var _0x5ae34c=_0x58e482?0x0:_0x161255['offset'];var _0x460490=_0x58e482?_0x25d519[_0xa6da('0x18')]:_0x161255['offset']+_0x161255['limit'];var _0x24ee47;if(_0x460490>=_0x34d3b9){_0x460490=_0x34d3b9;_0x24ee47=0xc8;}else{_0x24ee47=0xce;}_0x5bdf56[_0xa6da('0x14')](_0x24ee47);return _0x5bdf56[_0xa6da('0x19')](_0xa6da('0x1a'),_0x5ae34c+'-'+_0x460490+'/'+_0x34d3b9)[_0xa6da('0x16')](_0x25d519);}return null;};}function patchUpdates(_0x2c1ed1){return function(_0x5a6724){try{jsonpatch['apply'](_0x5a6724,_0x2c1ed1,!![]);}catch(_0x5c4055){return BPromise[_0xa6da('0x1b')](_0x5c4055);}return _0x5a6724[_0xa6da('0x1c')]();};}function saveUpdates(_0x2336d2,_0x1bdf1c){return function(_0x30e928){if(_0x30e928){return _0x30e928['update'](_0x2336d2)['then'](function(_0x537f00){return _0x537f00;});}return null;};}function removeEntity(_0x587ef1,_0x49d4af){return function(_0x2e10f4){if(_0x2e10f4){return _0x2e10f4[_0xa6da('0x1d')]()[_0xa6da('0x1e')](function(){_0x587ef1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x547e35,_0x256491){return function(_0x2dcf64){if(!_0x2dcf64){_0x547e35[_0xa6da('0x1f')](0x194);}return _0x2dcf64;};}function handleError(_0x3d38e8,_0x3748c6){_0x3748c6=_0x3748c6||0x1f4;return function(_0x4a9d98){logger['error'](_0x4a9d98[_0xa6da('0x20')]);if(_0x4a9d98[_0xa6da('0x21')]){delete _0x4a9d98['name'];}_0x3d38e8[_0xa6da('0x14')](_0x3748c6)['send'](_0x4a9d98);};}exports[_0xa6da('0x22')]=function(_0x49b424,_0x26a47c){var _0x541c0a={},_0xd185a9={},_0x3790f7={'count':0x0,'rows':[]};var _0x48bfe8=_['map'](db[_0xa6da('0x23')]['rawAttributes'],function(_0x5ebeca){return{'name':_0x5ebeca[_0xa6da('0x24')],'type':_0x5ebeca['type'][_0xa6da('0x25')]};});_0xd185a9[_0xa6da('0x26')]=_[_0xa6da('0x27')](_0x48bfe8,_0xa6da('0x21'));_0xd185a9[_0xa6da('0x28')]=_[_0xa6da('0x29')](_0x49b424['query']);_0xd185a9['filters']=_[_0xa6da('0x2a')](_0xd185a9[_0xa6da('0x26')],_0xd185a9[_0xa6da('0x28')]);_0x541c0a[_0xa6da('0x2b')]=_['intersection'](_0xd185a9['model'],qs['fields'](_0x49b424['query'][_0xa6da('0x2c')]));_0x541c0a[_0xa6da('0x2b')]=_0x541c0a[_0xa6da('0x2b')]['length']?_0x541c0a[_0xa6da('0x2b')]:_0xd185a9[_0xa6da('0x26')];if(!_0x49b424['query']['hasOwnProperty'](_0xa6da('0x2d'))){_0x541c0a[_0xa6da('0x2e')]=qs[_0xa6da('0x2e')](_0x49b424[_0xa6da('0x28')][_0xa6da('0x2e')]);_0x541c0a['offset']=qs['offset'](_0x49b424[_0xa6da('0x28')][_0xa6da('0x2f')]);}_0x541c0a[_0xa6da('0x30')]=qs[_0xa6da('0x31')](_0x49b424[_0xa6da('0x28')][_0xa6da('0x31')]);_0x541c0a[_0xa6da('0x32')]=qs[_0xa6da('0x33')](_['pick'](_0x49b424[_0xa6da('0x28')],_0xd185a9[_0xa6da('0x33')]),_0x48bfe8);if(_0x49b424[_0xa6da('0x28')][_0xa6da('0x34')]){_0x541c0a[_0xa6da('0x32')]=_[_0xa6da('0x35')](_0x541c0a[_0xa6da('0x32')],{'$or':_['map'](_0x48bfe8,function(_0x2aaab4){if(_0x2aaab4[_0xa6da('0x36')]!==_0xa6da('0x37')){var _0x49236e={};_0x49236e[_0x2aaab4[_0xa6da('0x21')]]={'$like':'%'+_0x49b424[_0xa6da('0x28')][_0xa6da('0x34')]+'%'};return _0x49236e;}})});}_0x541c0a=_[_0xa6da('0x35')]({},_0x541c0a,_0x49b424[_0xa6da('0x38')]);var _0x536220={'where':_0x541c0a[_0xa6da('0x32')]};return db[_0xa6da('0x23')]['count'](_0x536220)[_0xa6da('0x1e')](function(_0x323cd5){_0x3790f7[_0xa6da('0x18')]=_0x323cd5;if(_0x49b424['query'][_0xa6da('0x39')]){_0x541c0a[_0xa6da('0x3a')]=[{'all':!![]}];}return db[_0xa6da('0x23')][_0xa6da('0x3b')](_0x541c0a);})[_0xa6da('0x1e')](function(_0x58a5e8){_0x3790f7[_0xa6da('0x3c')]=_0x58a5e8;return _0x3790f7;})[_0xa6da('0x1e')](respondWithFilteredResult(_0x26a47c,_0x541c0a))['catch'](handleError(_0x26a47c,null));};exports[_0xa6da('0x3d')]=function(_0x13e5c4,_0x17ae0d){var _0x1d84d4={'raw':![],'where':{'id':_0x13e5c4['params']['id']}},_0x559122={};_0x559122[_0xa6da('0x26')]=_['keys'](db[_0xa6da('0x23')][_0xa6da('0x3e')]);_0x559122[_0xa6da('0x28')]=_[_0xa6da('0x29')](_0x13e5c4[_0xa6da('0x28')]);_0x559122['filters']=_[_0xa6da('0x2a')](_0x559122[_0xa6da('0x26')],_0x559122[_0xa6da('0x28')]);_0x1d84d4[_0xa6da('0x2b')]=_[_0xa6da('0x2a')](_0x559122[_0xa6da('0x26')],qs[_0xa6da('0x2c')](_0x13e5c4[_0xa6da('0x28')][_0xa6da('0x2c')]));_0x1d84d4[_0xa6da('0x2b')]=_0x1d84d4[_0xa6da('0x2b')][_0xa6da('0x3f')]?_0x1d84d4[_0xa6da('0x2b')]:_0x559122[_0xa6da('0x26')];if(_0x13e5c4['query']['includeAll']){_0x1d84d4['include']=[{'all':!![]}];}_0x1d84d4=_[_0xa6da('0x35')]({},_0x1d84d4,_0x13e5c4[_0xa6da('0x38')]);return db[_0xa6da('0x23')]['find'](_0x1d84d4)[_0xa6da('0x1e')](handleEntityNotFound(_0x17ae0d,null))[_0xa6da('0x1e')](respondWithResult(_0x17ae0d,null))[_0xa6da('0x40')](handleError(_0x17ae0d,null));};exports['create']=function(_0xf33946,_0x41fca0){return db[_0xa6da('0x23')]['create'](_0xf33946['body'],{})[_0xa6da('0x1e')](respondWithResult(_0x41fca0,0xc9))['catch'](handleError(_0x41fca0,null));};exports[_0xa6da('0x41')]=function(_0x25032e,_0x235fac){if(_0x25032e[_0xa6da('0x42')]['id']){delete _0x25032e[_0xa6da('0x42')]['id'];}return db[_0xa6da('0x23')][_0xa6da('0x43')]({'where':{'id':_0x25032e[_0xa6da('0x44')]['id']}})[_0xa6da('0x1e')](handleEntityNotFound(_0x235fac,null))['then'](saveUpdates(_0x25032e[_0xa6da('0x42')],null))[_0xa6da('0x1e')](respondWithResult(_0x235fac,null))[_0xa6da('0x40')](handleError(_0x235fac,null));};exports['destroy']=function(_0x2736bb,_0x13ab43){return db[_0xa6da('0x23')][_0xa6da('0x43')]({'where':{'id':_0x2736bb[_0xa6da('0x44')]['id']}})['then'](handleEntityNotFound(_0x13ab43,null))[_0xa6da('0x1e')](removeEntity(_0x13ab43,null))[_0xa6da('0x40')](handleError(_0x13ab43,null));};exports[_0xa6da('0x45')]=function(_0x16b93a,_0x35d887,_0x1ad75b){return db['Condition'][_0xa6da('0x43')]({'where':{'id':_0x16b93a[_0xa6da('0x44')]['id']}})[_0xa6da('0x1e')](handleEntityNotFound(_0x35d887,null))[_0xa6da('0x1e')](function(_0x462ae4){if(_0x462ae4){return _0x462ae4[_0xa6da('0x45')](_0x16b93a[_0xa6da('0x42')][_0xa6da('0x46')],_[_0xa6da('0x47')](_0x16b93a['body'],[_0xa6da('0x46'),'id'])||{});}})[_0xa6da('0x1e')](respondWithResult(_0x35d887,null))[_0xa6da('0x40')](handleError(_0x35d887,null));};exports[_0xa6da('0x48')]=function(_0xb5ac44,_0x29ffb4,_0x36567a){var _0x3b451a={};var _0x16d086={};var _0x9d2a7e;var _0x1f1030;return db[_0xa6da('0x23')]['findOne']({'where':{'id':_0xb5ac44[_0xa6da('0x44')]['id']}})['then'](handleEntityNotFound(_0x29ffb4,null))[_0xa6da('0x1e')](function(_0x412dd6){if(_0x412dd6){_0x9d2a7e=_0x412dd6;_0x16d086['model']=_[_0xa6da('0x29')](db[_0xa6da('0x49')][_0xa6da('0x3e')]);_0x16d086[_0xa6da('0x28')]=_[_0xa6da('0x29')](_0xb5ac44[_0xa6da('0x28')]);_0x16d086[_0xa6da('0x33')]=_['intersection'](_0x16d086[_0xa6da('0x26')],_0x16d086[_0xa6da('0x28')]);_0x3b451a['attributes']=_[_0xa6da('0x2a')](_0x16d086['model'],qs['fields'](_0xb5ac44['query']['fields']));_0x3b451a['attributes']=_0x3b451a['attributes'][_0xa6da('0x3f')]?_0x3b451a[_0xa6da('0x2b')]:_0x16d086[_0xa6da('0x26')];_0x3b451a['order']=qs['sort'](_0xb5ac44[_0xa6da('0x28')][_0xa6da('0x31')]);_0x3b451a['where']=qs['filters'](_[_0xa6da('0x4a')](_0xb5ac44[_0xa6da('0x28')],_0x16d086[_0xa6da('0x33')]));if(_0xb5ac44[_0xa6da('0x28')][_0xa6da('0x34')]){_0x3b451a[_0xa6da('0x32')]=_[_0xa6da('0x35')](_0x3b451a[_0xa6da('0x32')],{'$or':_[_0xa6da('0x27')](_0x3b451a[_0xa6da('0x2b')],function(_0x51dbcb){var _0x560a70={};_0x560a70[_0x51dbcb]={'$like':'%'+_0xb5ac44[_0xa6da('0x28')][_0xa6da('0x34')]+'%'};return _0x560a70;})});}_0x3b451a=_[_0xa6da('0x35')]({},_0x3b451a,_0xb5ac44[_0xa6da('0x38')]);return _0x9d2a7e[_0xa6da('0x48')](_0x3b451a);}})[_0xa6da('0x1e')](function(_0x38f7f8){if(_0x38f7f8){_0x1f1030=_0x38f7f8[_0xa6da('0x3f')];if(!_0xb5ac44[_0xa6da('0x28')][_0xa6da('0x4b')](_0xa6da('0x2d'))){_0x3b451a['limit']=qs[_0xa6da('0x2e')](_0xb5ac44['query'][_0xa6da('0x2e')]);_0x3b451a[_0xa6da('0x2f')]=qs[_0xa6da('0x2f')](_0xb5ac44['query'][_0xa6da('0x2f')]);}return _0x9d2a7e[_0xa6da('0x48')](_0x3b451a);}})[_0xa6da('0x1e')](function(_0x10c8b1){if(_0x10c8b1){return _0x10c8b1?{'count':_0x1f1030,'rows':_0x10c8b1}:null;}})['then'](respondWithResult(_0x29ffb4,null))[_0xa6da('0x40')](handleError(_0x29ffb4,null));};exports[_0xa6da('0x4c')]=function(_0x3fcfd5,_0x4001a9,_0x5e70e5){return db[_0xa6da('0x4d')][_0xa6da('0x43')]({'where':{'id':_0x3fcfd5[_0xa6da('0x44')]['id']}})[_0xa6da('0x1e')](handleEntityNotFound(_0x4001a9,null))['then'](function(_0x2044f6){if(_0x2044f6){return _0x2044f6[_0xa6da('0x4c')](_0x3fcfd5['body'][_0xa6da('0x46')],_[_0xa6da('0x47')](_0x3fcfd5['body'],[_0xa6da('0x46'),'id'])||{});}})[_0xa6da('0x1e')](respondWithResult(_0x4001a9,null))[_0xa6da('0x40')](handleError(_0x4001a9,null));};exports[_0xa6da('0x4e')]=function(_0x1b0a7b,_0x3dd787,_0x460382){var _0x4b436c={};var _0x48583a={};var _0x417ed5;var _0x565b1c;return db['Automation'][_0xa6da('0x4f')]({'where':{'id':_0x1b0a7b[_0xa6da('0x44')]['id']}})[_0xa6da('0x1e')](handleEntityNotFound(_0x3dd787,null))[_0xa6da('0x1e')](function(_0x2dd286){if(_0x2dd286){_0x417ed5=_0x2dd286;_0x48583a[_0xa6da('0x26')]=_['keys'](db[_0xa6da('0x4d')][_0xa6da('0x3e')]);_0x48583a[_0xa6da('0x28')]=_[_0xa6da('0x29')](_0x1b0a7b[_0xa6da('0x28')]);_0x48583a[_0xa6da('0x33')]=_[_0xa6da('0x2a')](_0x48583a[_0xa6da('0x26')],_0x48583a['query']);_0x4b436c['attributes']=_[_0xa6da('0x2a')](_0x48583a['model'],qs[_0xa6da('0x2c')](_0x1b0a7b['query']['fields']));_0x4b436c['attributes']=_0x4b436c[_0xa6da('0x2b')][_0xa6da('0x3f')]?_0x4b436c[_0xa6da('0x2b')]:_0x48583a[_0xa6da('0x26')];_0x4b436c[_0xa6da('0x30')]=qs[_0xa6da('0x31')](_0x1b0a7b[_0xa6da('0x28')][_0xa6da('0x31')]);_0x4b436c[_0xa6da('0x32')]=qs['filters'](_['pick'](_0x1b0a7b[_0xa6da('0x28')],_0x48583a[_0xa6da('0x33')]));if(_0x1b0a7b[_0xa6da('0x28')][_0xa6da('0x34')]){_0x4b436c[_0xa6da('0x32')]=_[_0xa6da('0x35')](_0x4b436c[_0xa6da('0x32')],{'$or':_['map'](_0x4b436c[_0xa6da('0x2b')],function(_0x2386db){var _0x5ac2ad={};_0x5ac2ad[_0x2386db]={'$like':'%'+_0x1b0a7b[_0xa6da('0x28')][_0xa6da('0x34')]+'%'};return _0x5ac2ad;})});}_0x4b436c=_['merge']({},_0x4b436c,_0x1b0a7b[_0xa6da('0x38')]);return _0x417ed5['getActions'](_0x4b436c);}})['then'](function(_0x11324c){if(_0x11324c){_0x565b1c=_0x11324c['length'];if(!_0x1b0a7b[_0xa6da('0x28')][_0xa6da('0x4b')](_0xa6da('0x2d'))){_0x4b436c[_0xa6da('0x2e')]=qs[_0xa6da('0x2e')](_0x1b0a7b[_0xa6da('0x28')][_0xa6da('0x2e')]);_0x4b436c[_0xa6da('0x2f')]=qs[_0xa6da('0x2f')](_0x1b0a7b['query']['offset']);}return _0x417ed5['getActions'](_0x4b436c);}})['then'](function(_0x1fa6d0){if(_0x1fa6d0){return _0x1fa6d0?{'count':_0x565b1c,'rows':_0x1fa6d0}:null;}})[_0xa6da('0x1e')](respondWithResult(_0x3dd787,null))[_0xa6da('0x40')](handleError(_0x3dd787,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index dfcd005..890ae98 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 _0x0926=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Automation','tools_automations','lodash'];(function(_0x1b56a8,_0x139cf0){var _0x5b2289=function(_0x48f2d4){while(--_0x48f2d4){_0x1b56a8['push'](_0x1b56a8['shift']());}};_0x5b2289(++_0x139cf0);}(_0x0926,0x1b1));var _0x6092=function(_0x38af48,_0x400460){_0x38af48=_0x38af48-0x0;var _0x445384=_0x0926[_0x38af48];return _0x445384;};'use strict';var _=require(_0x6092('0x0'));var util=require(_0x6092('0x1'));var logger=require(_0x6092('0x2'))(_0x6092('0x3'));var moment=require(_0x6092('0x4'));var BPromise=require(_0x6092('0x5'));var rp=require(_0x6092('0x6'));var fs=require('fs');var path=require(_0x6092('0x7'));var rimraf=require(_0x6092('0x8'));var config=require(_0x6092('0x9'));var attributes=require('./automation.attributes');module[_0x6092('0xa')]=function(_0x33bef1,_0x11cc23){return _0x33bef1[_0x6092('0xb')](_0x6092('0xc'),attributes,{'tableName':_0x6092('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0fa6=['lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./automation.attributes','exports','Automation','tools_automations'];(function(_0x376c94,_0x59131c){var _0x3bd8bb=function(_0x5c3fd4){while(--_0x5c3fd4){_0x376c94['push'](_0x376c94['shift']());}};_0x3bd8bb(++_0x59131c);}(_0x0fa6,0x176));var _0x60fa=function(_0xc8459e,_0x357636){_0xc8459e=_0xc8459e-0x0;var _0x2cff12=_0x0fa6[_0xc8459e];return _0x2cff12;};'use strict';var _=require(_0x60fa('0x0'));var util=require('util');var logger=require(_0x60fa('0x1'))('api');var moment=require(_0x60fa('0x2'));var BPromise=require(_0x60fa('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x60fa('0x4'));var rimraf=require(_0x60fa('0x5'));var config=require(_0x60fa('0x6'));var attributes=require(_0x60fa('0x7'));module[_0x60fa('0x8')]=function(_0x195fea,_0x14486b){return _0x195fea['define'](_0x60fa('0x9'),attributes,{'tableName':_0x60fa('0xa'),'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 2468377..7165bb8 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 _0x9ab8=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','Automation,\x20%s,\x20%s','message','catch','lodash','util','moment','ioredis'];(function(_0x503790,_0x525c78){var _0x388092=function(_0x2ab2b8){while(--_0x2ab2b8){_0x503790['push'](_0x503790['shift']());}};_0x388092(++_0x525c78);}(_0x9ab8,0x81));var _0x89ab=function(_0x54b800,_0x36bb53){_0x54b800=_0x54b800-0x0;var _0x541239=_0x9ab8[_0x54b800];return _0x541239;};'use strict';var _=require(_0x89ab('0x0'));var util=require(_0x89ab('0x1'));var moment=require(_0x89ab('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x89ab('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x89ab('0x4'));var logger=require(_0x89ab('0x5'))('rpc');var config=require(_0x89ab('0x6'));var jayson=require(_0x89ab('0x7'));var client=jayson[_0x89ab('0x8')][_0x89ab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29a984,_0x3ecaa0,_0x366c32){return new BPromise(function(_0x5fd99f,_0x42da87){return client[_0x89ab('0xa')](_0x29a984,_0x366c32)[_0x89ab('0xb')](function(_0x36dc63){logger['info']('Automation,\x20%s,\x20%s',_0x3ecaa0,'request\x20sent');logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0x3ecaa0,_0x89ab('0xc'),JSON[_0x89ab('0xd')](_0x36dc63));if(_0x36dc63[_0x89ab('0xe')]){if(_0x36dc63[_0x89ab('0xe')][_0x89ab('0xf')]===0x1f4){logger[_0x89ab('0xe')](_0x89ab('0x10'),_0x3ecaa0,_0x36dc63['error'][_0x89ab('0x11')]);return _0x42da87(_0x36dc63[_0x89ab('0xe')][_0x89ab('0x11')]);}logger[_0x89ab('0xe')](_0x89ab('0x10'),_0x3ecaa0,_0x36dc63['error'][_0x89ab('0x11')]);return _0x5fd99f(_0x36dc63[_0x89ab('0xe')]['message']);}else{logger['info']('Automation,\x20%s,\x20%s',_0x3ecaa0,'request\x20sent');_0x5fd99f(_0x36dc63['result']['message']);}})[_0x89ab('0x12')](function(_0x1ce918){logger[_0x89ab('0xe')](_0x89ab('0x10'),_0x3ecaa0,_0x1ce918);_0x42da87(_0x1ce918);});});} \ No newline at end of file +var _0x349f=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','Automation,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x48cabe,_0x1b60b5){var _0x3cc062=function(_0x25216c){while(--_0x25216c){_0x48cabe['push'](_0x48cabe['shift']());}};_0x3cc062(++_0x1b60b5);}(_0x349f,0xa8));var _0xf349=function(_0x3c58cc,_0x3d85c8){_0x3c58cc=_0x3c58cc-0x0;var _0x2f51de=_0x349f[_0x3c58cc];return _0x2f51de;};'use strict';var _=require(_0xf349('0x0'));var util=require(_0xf349('0x1'));var moment=require(_0xf349('0x2'));var BPromise=require('bluebird');var rs=require(_0xf349('0x3'));var fs=require('fs');var Redis=require(_0xf349('0x4'));var db=require(_0xf349('0x5'))['db'];var utils=require(_0xf349('0x6'));var logger=require(_0xf349('0x7'))(_0xf349('0x8'));var config=require(_0xf349('0x9'));var jayson=require(_0xf349('0xa'));var client=jayson[_0xf349('0xb')][_0xf349('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4c6f4c,_0x1bd44a,_0x23fb4b){return new BPromise(function(_0x6c6cd2,_0x21a480){return client[_0xf349('0xd')](_0x4c6f4c,_0x23fb4b)[_0xf349('0xe')](function(_0x3e2147){logger['info']('Automation,\x20%s,\x20%s',_0x1bd44a,_0xf349('0xf'));logger[_0xf349('0x10')](_0xf349('0x11'),_0x1bd44a,_0xf349('0xf'),JSON[_0xf349('0x12')](_0x3e2147));if(_0x3e2147['error']){if(_0x3e2147['error']['code']===0x1f4){logger[_0xf349('0x13')](_0xf349('0x14'),_0x1bd44a,_0x3e2147[_0xf349('0x13')][_0xf349('0x15')]);return _0x21a480(_0x3e2147[_0xf349('0x13')]['message']);}logger[_0xf349('0x13')](_0xf349('0x14'),_0x1bd44a,_0x3e2147['error'][_0xf349('0x15')]);return _0x6c6cd2(_0x3e2147[_0xf349('0x13')]['message']);}else{logger[_0xf349('0x16')]('Automation,\x20%s,\x20%s',_0x1bd44a,_0xf349('0xf'));_0x6c6cd2(_0x3e2147[_0xf349('0x17')][_0xf349('0x15')]);}})[_0xf349('0x18')](function(_0x14c06d){logger[_0xf349('0x13')](_0xf349('0x14'),_0x1bd44a,_0x14c06d);_0x21a480(_0x14c06d);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 89d0740..bda007b 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 _0xb647=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','post','addConditions','put','update'];(function(_0x6fe240,_0x1827a6){var _0x2fc18b=function(_0x3111a3){while(--_0x3111a3){_0x6fe240['push'](_0x6fe240['shift']());}};_0x2fc18b(++_0x1827a6);}(_0xb647,0xdb));var _0x7b64=function(_0x17c95e,_0x1348c2){_0x17c95e=_0x17c95e-0x0;var _0x47d54c=_0xb647[_0x17c95e];return _0x47d54c;};'use strict';var multer=require(_0x7b64('0x0'));var util=require(_0x7b64('0x1'));var path=require(_0x7b64('0x2'));var timeout=require(_0x7b64('0x3'));var express=require(_0x7b64('0x4'));var router=express[_0x7b64('0x5')]();var fs_extra=require(_0x7b64('0x6'));var auth=require(_0x7b64('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7b64('0x8'));var controller=require('./automation.controller');router[_0x7b64('0x9')]('/',auth[_0x7b64('0xa')](),controller[_0x7b64('0xb')]);router[_0x7b64('0x9')](_0x7b64('0xc'),auth[_0x7b64('0xa')](),controller[_0x7b64('0xd')]);router[_0x7b64('0x9')](_0x7b64('0xe'),auth['isAuthenticated'](),controller[_0x7b64('0xf')]);router['get'](_0x7b64('0x10'),auth['isAuthenticated'](),controller['getActions']);router[_0x7b64('0x11')]('/',auth[_0x7b64('0xa')](),controller['create']);router[_0x7b64('0x11')](_0x7b64('0xe'),auth[_0x7b64('0xa')](),controller[_0x7b64('0x12')]);router[_0x7b64('0x11')](_0x7b64('0x10'),auth[_0x7b64('0xa')](),controller['addActions']);router[_0x7b64('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x7b64('0x14')]);router[_0x7b64('0x15')](_0x7b64('0xc'),auth[_0x7b64('0xa')](),controller[_0x7b64('0x16')]);module[_0x7b64('0x17')]=router; \ No newline at end of file +var _0x1a66=['../../components/interaction/service','../../config/environment','./automation.controller','/:id','isAuthenticated','get','getConditions','/:id/actions','post','create','addConditions','addActions','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x24693e,_0x2ba888){var _0x53e672=function(_0x5f6cff){while(--_0x5f6cff){_0x24693e['push'](_0x24693e['shift']());}};_0x53e672(++_0x2ba888);}(_0x1a66,0x102));var _0x61a6=function(_0x2abd73,_0x340684){_0x2abd73=_0x2abd73-0x0;var _0x4fc21d=_0x1a66[_0x2abd73];return _0x4fc21d;};'use strict';var multer=require(_0x61a6('0x0'));var util=require(_0x61a6('0x1'));var path=require(_0x61a6('0x2'));var timeout=require(_0x61a6('0x3'));var express=require(_0x61a6('0x4'));var router=express[_0x61a6('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x61a6('0x6'));var config=require(_0x61a6('0x7'));var controller=require(_0x61a6('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x61a6('0x9'),auth[_0x61a6('0xa')](),controller['show']);router[_0x61a6('0xb')]('/:id/conditions',auth[_0x61a6('0xa')](),controller[_0x61a6('0xc')]);router['get'](_0x61a6('0xd'),auth['isAuthenticated'](),controller['getActions']);router[_0x61a6('0xe')]('/',auth[_0x61a6('0xa')](),controller[_0x61a6('0xf')]);router[_0x61a6('0xe')]('/:id/conditions',auth[_0x61a6('0xa')](),controller[_0x61a6('0x10')]);router['post'](_0x61a6('0xd'),auth['isAuthenticated'](),controller[_0x61a6('0x11')]);router['put']('/:id',auth[_0x61a6('0xa')](),controller[_0x61a6('0x12')]);router[_0x61a6('0x13')](_0x61a6('0x9'),auth[_0x61a6('0xa')](),controller[_0x61a6('0x14')]);module[_0x61a6('0x15')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 5ebd46b..ef48bb9 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 _0x2741=['Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)'];(function(_0x4952a0,_0x396813){var _0x301cfb=function(_0x797af1){while(--_0x797af1){_0x4952a0['push'](_0x4952a0['shift']());}};_0x301cfb(++_0x396813);}(_0x2741,0xef));var _0x1274=function(_0x41a3d3,_0x5ef4f6){_0x41a3d3=_0x41a3d3-0x0;var _0x1b581e=_0x2741[_0x41a3d3];return _0x1b581e;};'use strict';var Sequelize=require(_0x1274('0x0'));module[_0x1274('0x1')]={'name':{'type':Sequelize[_0x1274('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x1274('0x3')](_0x1274('0x4')),'allowNull':![],'defaultValue':_0x1274('0x4')},'description':{'type':Sequelize[_0x1274('0x2')]},'active':{'type':Sequelize[_0x1274('0x5')],'defaultValue':0x0,'comment':_0x1274('0x6')},'limitCalls':{'type':Sequelize[_0x1274('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x1274('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x1274('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1274('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x1274('0x7')](0x3)[_0x1274('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1274('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x1274('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1274('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1274('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x1274('0x7')](0x3)[_0x1274('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1274('0xc')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1274('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1274('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1274('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x1274('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1274('0x7')](0x5)[_0x1274('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1274('0xf')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1274('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1274('0x10')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x1274('0x3')](_0x1274('0x11'),_0x1274('0x12'),_0x1274('0x13')),'defaultValue':_0x1274('0x11')},'dialAMDActive':{'type':Sequelize[_0x1274('0x5')],'defaultValue':0x0,'comment':_0x1274('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x1274('0x7')](0x9)[_0x1274('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x1274('0x7')](0x9)[_0x1274('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1274('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1274('0x7')](0x9)[_0x1274('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1274('0x7')](0x9)[_0x1274('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1274('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x1274('0x7')](0x9)[_0x1274('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1274('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1274('0x7')](0x9)[_0x1274('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x1274('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1274('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1274('0x7')](0x5)[_0x1274('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1274('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1274('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1274('0x3')](_0x1274('0x1b'),'ASC'),'defaultValue':_0x1274('0x1b')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1274('0x7')](0x3)[_0x1274('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x1274('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1274('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1274('0x7')](0x3)[_0x1274('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1274('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1274('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0x1274('0x7')](0x3)[_0x1274('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1274('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0x1274('0x7')](0x5)[_0x1274('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1274('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1274('0x7')](0x5)[_0x1274('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1274('0x1f')},'dialMachineMaxRetry':{'type':Sequelize[_0x1274('0x7')](0x3)[_0x1274('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1274('0x20')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1274('0x7')](0x5)[_0x1274('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1274('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1274('0x7')](0x3)[_0x1274('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1274('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1274('0x7')](0x5)[_0x1274('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1274('0x23')}}; \ No newline at end of file +var _0x473b=['ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','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\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#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)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM'];(function(_0x402360,_0x348a93){var _0x8a9941=function(_0x102fea){while(--_0x102fea){_0x402360['push'](_0x402360['shift']());}};_0x8a9941(++_0x348a93);}(_0x473b,0x11a));var _0xb473=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0x473b[_0xa6cc5c];return _0x44803d;};'use strict';var Sequelize=require(_0xb473('0x0'));module[_0xb473('0x1')]={'name':{'type':Sequelize[_0xb473('0x2')],'unique':_0xb473('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xb473('0x4')](_0xb473('0x5')),'allowNull':![],'defaultValue':_0xb473('0x5')},'description':{'type':Sequelize[_0xb473('0x2')]},'active':{'type':Sequelize[_0xb473('0x6')],'defaultValue':0x0,'comment':_0xb473('0x7')},'limitCalls':{'type':Sequelize[_0xb473('0x8')](0x4)[_0xb473('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xb473('0xa')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xb473('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xb473('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb473('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0xb473('0x8')](0x3)[_0xb473('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb473('0xc')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xb473('0x8')](0x5)[_0xb473('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb473('0xd')},'dialBusyMaxRetry':{'type':Sequelize[_0xb473('0x8')](0x3)[_0xb473('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb473('0xe')},'dialBusyRetryFrequency':{'type':Sequelize[_0xb473('0x8')](0x5)[_0xb473('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb473('0xf')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb473('0x9')],'defaultValue':0x3,'comment':_0xb473('0x10')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xb473('0x8')](0x5)[_0xb473('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb473('0x11')},'dialGlobalMaxRetry':{'type':Sequelize[_0xb473('0x8')](0x3)[_0xb473('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xb473('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xb473('0x2')],'defaultValue':_0xb473('0x12')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xb473('0x13'),_0xb473('0x14'),_0xb473('0x15')),'defaultValue':_0xb473('0x13')},'dialAMDActive':{'type':Sequelize[_0xb473('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xb473('0x8')](0x9)[_0xb473('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xb473('0x16')},'dialAMDGreeting':{'type':Sequelize[_0xb473('0x8')](0x9)[_0xb473('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xb473('0x17')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xb473('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xb473('0x18')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xb473('0x8')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xb473('0x19')},'dialAMDMinWordLength':{'type':Sequelize[_0xb473('0x8')](0x9)[_0xb473('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xb473('0x1a')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xb473('0x8')](0x9)[_0xb473('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xb473('0x1b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xb473('0x8')](0x9)[_0xb473('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xb473('0x1c')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xb473('0x8')](0x5)[_0xb473('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xb473('0x1d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xb473('0x8')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xb473('0x4')](_0xb473('0x1e'),'ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xb473('0x8')](0x3)[_0xb473('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb473('0x1f')},'dialCutDigit':{'type':Sequelize[_0xb473('0x8')](0x3)[_0xb473('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb473('0x20')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xb473('0x8')](0x3)[_0xb473('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb473('0x21')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xb473('0x8')](0x5)[_0xb473('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb473('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xb473('0x8')](0x5)[_0xb473('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb473('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb473('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb473('0x23')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xb473('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb473('0x24')},'dialMachineMaxRetry':{'type':Sequelize[_0xb473('0x8')](0x3)[_0xb473('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb473('0x25')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb473('0x26')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb473('0x27')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xb473('0x8')](0x5)[_0xb473('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb473('0x28')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index ab64b46..fadc9b1 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 _0xbe72=['offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','get','IvrCampaigns','end','stack','name','send','Campaign','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','order','sort','where','filter','merge','options','includeAll','rows','catch','show','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','UserProfileResource','clone','params','createdAt','updatedAt','body','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','hasOwnProperty','nolimit','pick','CampaignId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','omit','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','toString','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','COALESCE(phone,\x27\x27)','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','all','removeBlackLists','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json'];(function(_0x28b2f2,_0x5c45b6){var _0x51aa69=function(_0x3bc10f){while(--_0x3bc10f){_0x28b2f2['push'](_0x28b2f2['shift']());}};_0x51aa69(++_0x5c45b6);}(_0xbe72,0xf4));var _0x2be7=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xbe72[_0x5c3c0b];return _0x52ecd2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2be7('0x0'));var zipdir=require(_0x2be7('0x1'));var jsonpatch=require(_0x2be7('0x2'));var rp=require('request-promise');var moment=require(_0x2be7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2be7('0x4'));var util=require(_0x2be7('0x5'));var path=require(_0x2be7('0x6'));var sox=require(_0x2be7('0x7'));var csv=require('to-csv');var ejs=require(_0x2be7('0x8'));var fs=require('fs');var fs_extra=require(_0x2be7('0x9'));var _=require(_0x2be7('0xa'));var squel=require('squel');var crypto=require(_0x2be7('0xb'));var jsforce=require(_0x2be7('0xc'));var deskjs=require(_0x2be7('0xd'));var toCsv=require(_0x2be7('0xe'));var querystring=require('querystring');var Papa=require(_0x2be7('0xf'));var Redis=require(_0x2be7('0x10'));var authService=require(_0x2be7('0x11'));var qs=require(_0x2be7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2be7('0x13'))(_0x2be7('0x14'));var utils=require(_0x2be7('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2be7('0x16'));var db=require(_0x2be7('0x17'))['db'];function respondWithStatusCode(_0x387dd5,_0x2e15a2){_0x2e15a2=_0x2e15a2||0xcc;return function(_0x2ee522){if(_0x2ee522){return _0x387dd5['sendStatus'](_0x2e15a2);}return _0x387dd5[_0x2be7('0x18')](_0x2e15a2)['end']();};}function respondWithResult(_0x266877,_0x14bda5){_0x14bda5=_0x14bda5||0xc8;return function(_0x50c232){if(_0x50c232){return _0x266877['status'](_0x14bda5)[_0x2be7('0x19')](_0x50c232);}};}function respondWithFilteredResult(_0x2e879d,_0x24b0e6){return function(_0x1a9b80){if(_0x1a9b80){var _0x17e96b=typeof _0x24b0e6[_0x2be7('0x1a')]===_0x2be7('0x1b')&&typeof _0x24b0e6[_0x2be7('0x1c')]===_0x2be7('0x1b');var _0x362b72=_0x1a9b80[_0x2be7('0x1d')];var _0x4033cf=_0x17e96b?0x0:_0x24b0e6[_0x2be7('0x1a')];var _0x202479=_0x17e96b?_0x1a9b80[_0x2be7('0x1d')]:_0x24b0e6[_0x2be7('0x1a')]+_0x24b0e6[_0x2be7('0x1c')];var _0x2fbe83;if(_0x202479>=_0x362b72){_0x202479=_0x362b72;_0x2fbe83=0xc8;}else{_0x2fbe83=0xce;}_0x2e879d[_0x2be7('0x18')](_0x2fbe83);return _0x2e879d[_0x2be7('0x1e')](_0x2be7('0x1f'),_0x4033cf+'-'+_0x202479+'/'+_0x362b72)['json'](_0x1a9b80);}return null;};}function patchUpdates(_0x179905){return function(_0x3c5483){try{jsonpatch[_0x2be7('0x20')](_0x3c5483,_0x179905,!![]);}catch(_0x4c33a2){return BPromise['reject'](_0x4c33a2);}return _0x3c5483[_0x2be7('0x21')]();};}function saveUpdates(_0x240a12,_0x23b9d2){return function(_0x456efb){if(_0x456efb){return _0x456efb[_0x2be7('0x22')](_0x240a12)['then'](function(_0x42ce49){return _0x42ce49;});}return null;};}function removeEntity(_0x5cf822,_0x113885){return function(_0x4e3cf3){if(_0x4e3cf3){return _0x4e3cf3[_0x2be7('0x23')]()[_0x2be7('0x24')](function(){var _0x27e88a=_0x4e3cf3[_0x2be7('0x25')]({'plain':!![]});var _0x24082f=_0x2be7('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x24082f,'resourceId':_0x27e88a['id']}})['then'](function(){return _0x4e3cf3;});})['then'](function(){_0x5cf822['status'](0xcc)[_0x2be7('0x27')]();});}};}function handleEntityNotFound(_0x441c4a,_0x2dbd24){return function(_0x3c9e51){if(!_0x3c9e51){_0x441c4a['sendStatus'](0x194);}return _0x3c9e51;};}function handleError(_0x1ea5ee,_0x32bce1){_0x32bce1=_0x32bce1||0x1f4;return function(_0x17a4ae){logger['error'](_0x17a4ae[_0x2be7('0x28')]);if(_0x17a4ae[_0x2be7('0x29')]){delete _0x17a4ae[_0x2be7('0x29')];}_0x1ea5ee[_0x2be7('0x18')](_0x32bce1)[_0x2be7('0x2a')](_0x17a4ae);};}exports['index']=function(_0x4c0886,_0x312096){var _0x12a8e3={},_0x375d7a={},_0x3276da={'count':0x0,'rows':[]};var _0x1ef1eb=_['map'](db[_0x2be7('0x2b')][_0x2be7('0x2c')],function(_0x579f30){return{'name':_0x579f30[_0x2be7('0x2d')],'type':_0x579f30[_0x2be7('0x2e')][_0x2be7('0x2f')]};});_0x375d7a[_0x2be7('0x30')]=_[_0x2be7('0x31')](_0x1ef1eb,_0x2be7('0x29'));_0x375d7a[_0x2be7('0x32')]=_[_0x2be7('0x33')](_0x4c0886['query']);_0x375d7a[_0x2be7('0x34')]=_[_0x2be7('0x35')](_0x375d7a[_0x2be7('0x30')],_0x375d7a[_0x2be7('0x32')]);_0x12a8e3['attributes']=_[_0x2be7('0x35')](_0x375d7a['model'],qs['fields'](_0x4c0886[_0x2be7('0x32')][_0x2be7('0x36')]));_0x12a8e3['attributes']=_0x12a8e3[_0x2be7('0x37')][_0x2be7('0x38')]?_0x12a8e3[_0x2be7('0x37')]:_0x375d7a[_0x2be7('0x30')];if(!_0x4c0886[_0x2be7('0x32')]['hasOwnProperty']('nolimit')){_0x12a8e3['limit']=qs['limit'](_0x4c0886['query']['limit']);_0x12a8e3[_0x2be7('0x1a')]=qs[_0x2be7('0x1a')](_0x4c0886[_0x2be7('0x32')][_0x2be7('0x1a')]);}_0x12a8e3[_0x2be7('0x39')]=qs[_0x2be7('0x3a')](_0x4c0886[_0x2be7('0x32')][_0x2be7('0x3a')]);_0x12a8e3[_0x2be7('0x3b')]=qs[_0x2be7('0x34')](_['pick'](_0x4c0886[_0x2be7('0x32')],_0x375d7a[_0x2be7('0x34')]),_0x1ef1eb);if(_0x4c0886[_0x2be7('0x32')][_0x2be7('0x3c')]){_0x12a8e3['where']=_[_0x2be7('0x3d')](_0x12a8e3[_0x2be7('0x3b')],{'$or':_['map'](_0x1ef1eb,function(_0x4b9385){if(_0x4b9385['type']!=='VIRTUAL'){var _0xa12a5a={};_0xa12a5a[_0x4b9385[_0x2be7('0x29')]]={'$like':'%'+_0x4c0886[_0x2be7('0x32')]['filter']+'%'};return _0xa12a5a;}})});}_0x12a8e3=_[_0x2be7('0x3d')]({},_0x12a8e3,_0x4c0886[_0x2be7('0x3e')]);var _0x55ea50={'where':_0x12a8e3[_0x2be7('0x3b')]};return db[_0x2be7('0x2b')]['count'](_0x55ea50)[_0x2be7('0x24')](function(_0x40ef2d){_0x3276da[_0x2be7('0x1d')]=_0x40ef2d;if(_0x4c0886[_0x2be7('0x32')][_0x2be7('0x3f')]){_0x12a8e3['include']=[{'all':!![]}];}return db[_0x2be7('0x2b')]['findAll'](_0x12a8e3);})[_0x2be7('0x24')](function(_0x516189){_0x3276da[_0x2be7('0x40')]=_0x516189;return _0x3276da;})[_0x2be7('0x24')](respondWithFilteredResult(_0x312096,_0x12a8e3))[_0x2be7('0x41')](handleError(_0x312096,null));};exports[_0x2be7('0x42')]=function(_0x1b2be0,_0x5d3419){var _0x216218={'raw':![],'where':{'id':_0x1b2be0['params']['id']}},_0x2db05f={};_0x2db05f['model']=_[_0x2be7('0x33')](db[_0x2be7('0x2b')]['rawAttributes']);_0x2db05f[_0x2be7('0x32')]=_[_0x2be7('0x33')](_0x1b2be0[_0x2be7('0x32')]);_0x2db05f[_0x2be7('0x34')]=_[_0x2be7('0x35')](_0x2db05f[_0x2be7('0x30')],_0x2db05f['query']);_0x216218[_0x2be7('0x37')]=_[_0x2be7('0x35')](_0x2db05f[_0x2be7('0x30')],qs['fields'](_0x1b2be0[_0x2be7('0x32')][_0x2be7('0x36')]));_0x216218[_0x2be7('0x37')]=_0x216218[_0x2be7('0x37')][_0x2be7('0x38')]?_0x216218[_0x2be7('0x37')]:_0x2db05f[_0x2be7('0x30')];if(_0x1b2be0[_0x2be7('0x32')][_0x2be7('0x3f')]){_0x216218[_0x2be7('0x43')]=[{'all':!![]}];}_0x216218=_[_0x2be7('0x3d')]({},_0x216218,_0x1b2be0[_0x2be7('0x3e')]);return db[_0x2be7('0x2b')][_0x2be7('0x44')](_0x216218)[_0x2be7('0x24')](handleEntityNotFound(_0x5d3419,null))[_0x2be7('0x24')](respondWithResult(_0x5d3419,null))[_0x2be7('0x41')](handleError(_0x5d3419,null));};exports[_0x2be7('0x45')]=function(_0x1346f9,_0x361bf9){return db[_0x2be7('0x2b')][_0x2be7('0x45')](_0x1346f9['body'],{})[_0x2be7('0x24')](function(_0x1e26ed){var _0x202127=_0x1346f9['user']['get']({'plain':!![]});if(!_0x202127)throw new Error(_0x2be7('0x46'));if(_0x202127['role']===_0x2be7('0x47')){var _0x2bf1b4=_0x1e26ed['get']({'plain':!![]});var _0x27ef60=_0x2be7('0x26');return db[_0x2be7('0x48')]['find']({'where':{'name':_0x27ef60,'userProfileId':_0x202127['userProfileId']},'raw':!![]})[_0x2be7('0x24')](function(_0x1e73e1){if(_0x1e73e1&&_0x1e73e1[_0x2be7('0x49')]===0x0){return db[_0x2be7('0x4a')]['create']({'name':_0x2bf1b4[_0x2be7('0x29')],'resourceId':_0x2bf1b4['id'],'type':_0x1e73e1['name'],'sectionId':_0x1e73e1['id']},{})[_0x2be7('0x24')](function(){return _0x1e26ed;});}else{return _0x1e26ed;}})[_0x2be7('0x41')](function(_0x565c81){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x565c81);throw _0x565c81;});}return _0x1e26ed;})[_0x2be7('0x24')](respondWithResult(_0x361bf9,0xc9))[_0x2be7('0x41')](handleError(_0x361bf9,null));};exports[_0x2be7('0x4b')]=function(_0xe2b232,_0x3b0dea){var _0x40546c={'where':{'id':_0xe2b232[_0x2be7('0x4c')]['id']}},_0x28fc91={};_0x28fc91[_0x2be7('0x30')]=_[_0x2be7('0x33')](db['Campaign']['rawAttributes']);_0x40546c['attributes']=_['intersection'](_0x28fc91[_0x2be7('0x30')],qs[_0x2be7('0x36')](_0xe2b232[_0x2be7('0x32')][_0x2be7('0x36')]));_0x40546c[_0x2be7('0x37')]=_0x40546c[_0x2be7('0x37')][_0x2be7('0x38')]?_0x40546c[_0x2be7('0x37')]:_0x28fc91[_0x2be7('0x30')];if(_0xe2b232[_0x2be7('0x32')][_0x2be7('0x3f')]){_0x40546c[_0x2be7('0x43')]=[{'all':!![]}];}_0x40546c=_['merge']({},_0x40546c,_0xe2b232[_0x2be7('0x3e')]);return db[_0x2be7('0x2b')]['find'](_0x40546c)[_0x2be7('0x24')](handleEntityNotFound(_0x3b0dea,null))['then'](function(_0x1ca702){if(_0x1ca702){var _0xe985de=_0x1ca702[_0x2be7('0x25')]({'plain':!![]});_0xe985de=qs['omit'](_0xe985de,['id',_0x2be7('0x4d'),_0x2be7('0x4e')]);_0xe2b232[_0x2be7('0x4f')]=_['omit'](_0xe2b232[_0x2be7('0x4f')],['id',_0x2be7('0x4d'),_0x2be7('0x4e')]);return db[_0x2be7('0x2b')][_0x2be7('0x45')](_[_0x2be7('0x3d')](_0xe985de,_0xe2b232[_0x2be7('0x4f')]),{'include':_0xe2b232[_0x2be7('0x32')][_0x2be7('0x3f')]?[{'all':!![]}]:undefined})['then'](function(_0x1f9b03){var _0x2e68cc=_0xe2b232[_0x2be7('0x47')][_0x2be7('0x25')]({'plain':!![]});if(!_0x2e68cc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e68cc['role']===_0x2be7('0x47')){var _0x75c42f=_0x1f9b03[_0x2be7('0x25')]({'plain':!![]});var _0x177fc1=_0x2be7('0x26');return db['UserProfileSection'][_0x2be7('0x44')]({'where':{'name':_0x177fc1,'userProfileId':_0x2e68cc['userProfileId']},'raw':!![]})[_0x2be7('0x24')](function(_0x581ea4){if(_0x581ea4&&_0x581ea4['autoAssociation']===0x0){return db[_0x2be7('0x4a')][_0x2be7('0x45')]({'name':_0x75c42f[_0x2be7('0x29')],'resourceId':_0x75c42f['id'],'type':_0x581ea4[_0x2be7('0x29')],'sectionId':_0x581ea4['id']},{})['then'](function(){return _0x1f9b03;});}else{return _0x1f9b03;}})[_0x2be7('0x41')](function(_0x2b262e){logger['error'](_0x2be7('0x50'),_0x2b262e);throw _0x2b262e;});}return _0x1f9b03;});}})[_0x2be7('0x24')](respondWithResult(_0x3b0dea,0xc9))[_0x2be7('0x41')](handleError(_0x3b0dea,null));};exports['update']=function(_0x449fe7,_0x118f16){if(_0x449fe7[_0x2be7('0x4f')]['id']){delete _0x449fe7[_0x2be7('0x4f')]['id'];}return db[_0x2be7('0x2b')][_0x2be7('0x44')]({'where':{'id':_0x449fe7[_0x2be7('0x4c')]['id']}})['then'](handleEntityNotFound(_0x118f16,null))[_0x2be7('0x24')](saveUpdates(_0x449fe7['body'],null))[_0x2be7('0x24')](respondWithResult(_0x118f16,null))['catch'](handleError(_0x118f16,null));};exports['destroy']=function(_0x4084fd,_0x307122){return db[_0x2be7('0x2b')][_0x2be7('0x44')]({'where':{'id':_0x4084fd[_0x2be7('0x4c')]['id']}})[_0x2be7('0x24')](handleEntityNotFound(_0x307122,null))[_0x2be7('0x24')](removeEntity(_0x307122,null))[_0x2be7('0x41')](handleError(_0x307122,null));};exports[_0x2be7('0x51')]=function(_0x4bdf3b,_0x1360e0,_0x44b7e1){var _0x5afdeb={'raw':!![],'where':{}};var _0x456cbc={};var _0x322c42={'count':0x0,'rows':[]};return db['Campaign'][_0x2be7('0x52')]({'where':{'id':_0x4bdf3b[_0x2be7('0x4c')]['id']}})[_0x2be7('0x24')](handleEntityNotFound(_0x1360e0,null))[_0x2be7('0x24')](function(_0x3cae55){if(_0x3cae55){_0x456cbc['model']=_['keys'](db[_0x2be7('0x53')][_0x2be7('0x2c')]);_0x456cbc[_0x2be7('0x32')]=_[_0x2be7('0x33')](_0x4bdf3b[_0x2be7('0x32')]);_0x456cbc[_0x2be7('0x34')]=_[_0x2be7('0x35')](_0x456cbc[_0x2be7('0x30')],_0x456cbc[_0x2be7('0x32')]);_0x5afdeb[_0x2be7('0x37')]=_['intersection'](_0x456cbc[_0x2be7('0x30')],qs[_0x2be7('0x36')](_0x4bdf3b[_0x2be7('0x32')]['fields']));_0x5afdeb[_0x2be7('0x37')]=_0x5afdeb[_0x2be7('0x37')][_0x2be7('0x38')]?_0x5afdeb[_0x2be7('0x37')]:_0x456cbc[_0x2be7('0x30')];if(!_0x4bdf3b[_0x2be7('0x32')][_0x2be7('0x54')](_0x2be7('0x55'))){_0x5afdeb[_0x2be7('0x1c')]=qs['limit'](_0x4bdf3b[_0x2be7('0x32')]['limit']);_0x5afdeb['offset']=qs[_0x2be7('0x1a')](_0x4bdf3b[_0x2be7('0x32')][_0x2be7('0x1a')]);}_0x5afdeb[_0x2be7('0x39')]=qs['sort'](_0x4bdf3b[_0x2be7('0x32')][_0x2be7('0x3a')]);_0x5afdeb[_0x2be7('0x3b')]=qs[_0x2be7('0x34')](_[_0x2be7('0x56')](_0x4bdf3b[_0x2be7('0x32')],_0x456cbc[_0x2be7('0x34')]));_0x5afdeb[_0x2be7('0x3b')][_0x2be7('0x57')]=_0x3cae55['id'];if(_0x4bdf3b[_0x2be7('0x32')][_0x2be7('0x3c')]){_0x5afdeb[_0x2be7('0x3b')]=_['merge'](_0x5afdeb[_0x2be7('0x3b')],{'$or':_['map'](_0x5afdeb[_0x2be7('0x37')],function(_0x16c036){var _0x397e87={};_0x397e87[_0x16c036]={'$like':'%'+_0x4bdf3b[_0x2be7('0x32')][_0x2be7('0x3c')]+'%'};return _0x397e87;})});}_0x5afdeb=_[_0x2be7('0x3d')]({},_0x5afdeb,_0x4bdf3b['options']);return db[_0x2be7('0x53')]['count']({'where':_0x5afdeb[_0x2be7('0x3b')]})['then'](function(_0x6770a9){_0x322c42[_0x2be7('0x1d')]=_0x6770a9;if(_0x4bdf3b[_0x2be7('0x32')][_0x2be7('0x3f')]){_0x5afdeb[_0x2be7('0x43')]=[{'all':!![]}];}return db[_0x2be7('0x53')][_0x2be7('0x58')](_0x5afdeb);})[_0x2be7('0x24')](function(_0x16d869){_0x322c42[_0x2be7('0x40')]=_0x16d869;return _0x322c42;});}})[_0x2be7('0x24')](respondWithFilteredResult(_0x1360e0,_0x5afdeb))['catch'](handleError(_0x1360e0,null));};exports[_0x2be7('0x59')]=function(_0x26087c,_0x1ea470,_0x5aefb9){var _0x3e1089={'raw':!![],'where':{}};var _0x307754={};var _0x4959ee={'count':0x0,'rows':[]};return db[_0x2be7('0x2b')][_0x2be7('0x52')]({'where':{'id':_0x26087c[_0x2be7('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1ea470,null))[_0x2be7('0x24')](function(_0x175902){if(_0x175902){_0x307754['model']=_['keys'](db['CmHopperHistory'][_0x2be7('0x2c')]);_0x307754[_0x2be7('0x32')]=_[_0x2be7('0x33')](_0x26087c['query']);_0x307754[_0x2be7('0x34')]=_[_0x2be7('0x35')](_0x307754[_0x2be7('0x30')],_0x307754[_0x2be7('0x32')]);_0x3e1089[_0x2be7('0x37')]=_[_0x2be7('0x35')](_0x307754['model'],qs['fields'](_0x26087c[_0x2be7('0x32')]['fields']));_0x3e1089[_0x2be7('0x37')]=_0x3e1089[_0x2be7('0x37')][_0x2be7('0x38')]?_0x3e1089['attributes']:_0x307754[_0x2be7('0x30')];if(!_0x26087c[_0x2be7('0x32')][_0x2be7('0x54')](_0x2be7('0x55'))){_0x3e1089[_0x2be7('0x1c')]=qs[_0x2be7('0x1c')](_0x26087c[_0x2be7('0x32')][_0x2be7('0x1c')]);_0x3e1089[_0x2be7('0x1a')]=qs[_0x2be7('0x1a')](_0x26087c['query'][_0x2be7('0x1a')]);}_0x3e1089[_0x2be7('0x39')]=qs[_0x2be7('0x3a')](_0x26087c['query'][_0x2be7('0x3a')]);_0x3e1089[_0x2be7('0x3b')]=qs[_0x2be7('0x34')](_[_0x2be7('0x56')](_0x26087c[_0x2be7('0x32')],_0x307754[_0x2be7('0x34')]));_0x3e1089['where'][_0x2be7('0x57')]=_0x175902['id'];if(_0x26087c[_0x2be7('0x32')][_0x2be7('0x3c')]){_0x3e1089[_0x2be7('0x3b')]=_[_0x2be7('0x3d')](_0x3e1089[_0x2be7('0x3b')],{'$or':_[_0x2be7('0x31')](_0x3e1089['attributes'],function(_0x23e4d6){var _0x5d37e1={};_0x5d37e1[_0x23e4d6]={'$like':'%'+_0x26087c[_0x2be7('0x32')]['filter']+'%'};return _0x5d37e1;})});}_0x3e1089=_[_0x2be7('0x3d')]({},_0x3e1089,_0x26087c[_0x2be7('0x3e')]);return db['CmHopperHistory'][_0x2be7('0x1d')]({'where':_0x3e1089[_0x2be7('0x3b')]})['then'](function(_0xd7e3a6){_0x4959ee[_0x2be7('0x1d')]=_0xd7e3a6;if(_0x26087c[_0x2be7('0x32')][_0x2be7('0x3f')]){_0x3e1089[_0x2be7('0x43')]=[{'all':!![]}];}return db[_0x2be7('0x5a')][_0x2be7('0x58')](_0x3e1089);})['then'](function(_0x3e82e0){_0x4959ee[_0x2be7('0x40')]=_0x3e82e0;return _0x4959ee;});}})[_0x2be7('0x24')](respondWithFilteredResult(_0x1ea470,_0x3e1089))['catch'](handleError(_0x1ea470,null));};exports[_0x2be7('0x5b')]=function(_0x12393c,_0x4c0139,_0x4cf138){var _0x166f52={'raw':!![],'where':{}};var _0x5bd0c4={};var _0x4a09e8={'count':0x0,'rows':[]};return db[_0x2be7('0x2b')][_0x2be7('0x52')]({'where':{'id':_0x12393c[_0x2be7('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4c0139,null))[_0x2be7('0x24')](function(_0x551fe1){if(_0x551fe1){_0x5bd0c4[_0x2be7('0x30')]=_[_0x2be7('0x33')](db[_0x2be7('0x5c')][_0x2be7('0x2c')]);_0x5bd0c4[_0x2be7('0x32')]=_[_0x2be7('0x33')](_0x12393c['query']);_0x5bd0c4[_0x2be7('0x34')]=_[_0x2be7('0x35')](_0x5bd0c4['model'],_0x5bd0c4[_0x2be7('0x32')]);_0x166f52[_0x2be7('0x37')]=_[_0x2be7('0x35')](_0x5bd0c4[_0x2be7('0x30')],qs[_0x2be7('0x36')](_0x12393c[_0x2be7('0x32')][_0x2be7('0x36')]));_0x166f52['attributes']=_0x166f52[_0x2be7('0x37')][_0x2be7('0x38')]?_0x166f52[_0x2be7('0x37')]:_0x5bd0c4['model'];if(!_0x12393c[_0x2be7('0x32')][_0x2be7('0x54')](_0x2be7('0x55'))){_0x166f52[_0x2be7('0x1c')]=qs[_0x2be7('0x1c')](_0x12393c['query'][_0x2be7('0x1c')]);_0x166f52[_0x2be7('0x1a')]=qs['offset'](_0x12393c[_0x2be7('0x32')][_0x2be7('0x1a')]);}_0x166f52[_0x2be7('0x39')]=qs[_0x2be7('0x3a')](_0x12393c[_0x2be7('0x32')][_0x2be7('0x3a')]);_0x166f52[_0x2be7('0x3b')]=qs[_0x2be7('0x34')](_[_0x2be7('0x56')](_0x12393c['query'],_0x5bd0c4[_0x2be7('0x34')]));_0x166f52['where'][_0x2be7('0x57')]=_0x551fe1['id'];if(_0x12393c[_0x2be7('0x32')][_0x2be7('0x3c')]){_0x166f52[_0x2be7('0x3b')]=_['merge'](_0x166f52['where'],{'$or':_[_0x2be7('0x31')](_0x166f52['attributes'],function(_0xee061e){var _0x24dd77={};_0x24dd77[_0xee061e]={'$like':'%'+_0x12393c[_0x2be7('0x32')]['filter']+'%'};return _0x24dd77;})});}_0x166f52=_[_0x2be7('0x3d')]({},_0x166f52,_0x12393c[_0x2be7('0x3e')]);return db[_0x2be7('0x5c')][_0x2be7('0x1d')]({'where':_0x166f52['where']})[_0x2be7('0x24')](function(_0x4ce5ba){_0x4a09e8[_0x2be7('0x1d')]=_0x4ce5ba;if(_0x12393c[_0x2be7('0x32')]['includeAll']){_0x166f52[_0x2be7('0x43')]=[{'all':!![]}];}return db[_0x2be7('0x5c')][_0x2be7('0x58')](_0x166f52);})[_0x2be7('0x24')](function(_0x5d325a){_0x4a09e8[_0x2be7('0x40')]=_0x5d325a;return _0x4a09e8;});}})['then'](respondWithFilteredResult(_0x4c0139,_0x166f52))['catch'](handleError(_0x4c0139,null));};exports[_0x2be7('0x5d')]=function(_0x59fd75,_0xe0cb06,_0x4dc152){var _0x431b6a={'raw':!![],'where':{}};var _0x333a39={};var _0x1c821c={'count':0x0,'rows':[]};return db[_0x2be7('0x2b')][_0x2be7('0x52')]({'where':{'id':_0x59fd75[_0x2be7('0x4c')]['id']}})[_0x2be7('0x24')](handleEntityNotFound(_0xe0cb06,null))['then'](function(_0x35d47f){if(_0x35d47f){_0x333a39[_0x2be7('0x30')]=_[_0x2be7('0x33')](db['CmHopperBlack'][_0x2be7('0x2c')]);_0x333a39['query']=_[_0x2be7('0x33')](_0x59fd75['query']);_0x333a39['filters']=_['intersection'](_0x333a39[_0x2be7('0x30')],_0x333a39['query']);_0x431b6a[_0x2be7('0x37')]=_[_0x2be7('0x35')](_0x333a39['model'],qs[_0x2be7('0x36')](_0x59fd75['query'][_0x2be7('0x36')]));_0x431b6a[_0x2be7('0x37')]=_0x431b6a[_0x2be7('0x37')]['length']?_0x431b6a['attributes']:_0x333a39[_0x2be7('0x30')];if(!_0x59fd75['query'][_0x2be7('0x54')](_0x2be7('0x55'))){_0x431b6a['limit']=qs[_0x2be7('0x1c')](_0x59fd75[_0x2be7('0x32')][_0x2be7('0x1c')]);_0x431b6a['offset']=qs[_0x2be7('0x1a')](_0x59fd75[_0x2be7('0x32')][_0x2be7('0x1a')]);}_0x431b6a[_0x2be7('0x39')]=qs[_0x2be7('0x3a')](_0x59fd75[_0x2be7('0x32')][_0x2be7('0x3a')]);_0x431b6a['where']=qs[_0x2be7('0x34')](_['pick'](_0x59fd75[_0x2be7('0x32')],_0x333a39[_0x2be7('0x34')]));_0x431b6a[_0x2be7('0x3b')][_0x2be7('0x57')]=_0x35d47f['id'];if(_0x59fd75[_0x2be7('0x32')]['filter']){_0x431b6a[_0x2be7('0x3b')]=_[_0x2be7('0x3d')](_0x431b6a[_0x2be7('0x3b')],{'$or':_[_0x2be7('0x31')](_0x431b6a[_0x2be7('0x37')],function(_0x620e58){var _0x10b757={};_0x10b757[_0x620e58]={'$like':'%'+_0x59fd75[_0x2be7('0x32')][_0x2be7('0x3c')]+'%'};return _0x10b757;})});}_0x431b6a=_[_0x2be7('0x3d')]({},_0x431b6a,_0x59fd75[_0x2be7('0x3e')]);return db[_0x2be7('0x5e')][_0x2be7('0x1d')]({'where':_0x431b6a['where']})[_0x2be7('0x24')](function(_0x5f0d10){_0x1c821c[_0x2be7('0x1d')]=_0x5f0d10;if(_0x59fd75[_0x2be7('0x32')][_0x2be7('0x3f')]){_0x431b6a['include']=[{'all':!![]}];}return db[_0x2be7('0x5e')][_0x2be7('0x58')](_0x431b6a);})[_0x2be7('0x24')](function(_0x36f68e){_0x1c821c[_0x2be7('0x40')]=_0x36f68e;return _0x1c821c;});}})[_0x2be7('0x24')](respondWithFilteredResult(_0xe0cb06,_0x431b6a))[_0x2be7('0x41')](handleError(_0xe0cb06,null));};exports[_0x2be7('0x5f')]=function(_0x4832a1,_0x4d03e5,_0x2d708b){var _0x174c4f={};var _0x3b65f7={};var _0x3ce945;var _0x2e50ba;return db[_0x2be7('0x2b')][_0x2be7('0x52')]({'where':{'id':_0x4832a1[_0x2be7('0x4c')]['id']}})[_0x2be7('0x24')](handleEntityNotFound(_0x4d03e5,null))[_0x2be7('0x24')](function(_0x142954){if(_0x142954){_0x3ce945=_0x142954;_0x3b65f7['model']=_['keys'](db[_0x2be7('0x60')][_0x2be7('0x2c')]);_0x3b65f7[_0x2be7('0x32')]=_[_0x2be7('0x33')](_0x4832a1[_0x2be7('0x32')]);_0x3b65f7[_0x2be7('0x34')]=_['intersection'](_0x3b65f7[_0x2be7('0x30')],_0x3b65f7[_0x2be7('0x32')]);_0x174c4f[_0x2be7('0x37')]=_['intersection'](_0x3b65f7[_0x2be7('0x30')],qs[_0x2be7('0x36')](_0x4832a1[_0x2be7('0x32')][_0x2be7('0x36')]));_0x174c4f[_0x2be7('0x37')]=_0x174c4f[_0x2be7('0x37')][_0x2be7('0x38')]?_0x174c4f[_0x2be7('0x37')]:_0x3b65f7[_0x2be7('0x30')];_0x174c4f['order']=qs[_0x2be7('0x3a')](_0x4832a1[_0x2be7('0x32')][_0x2be7('0x3a')]);_0x174c4f[_0x2be7('0x3b')]=qs[_0x2be7('0x34')](_[_0x2be7('0x56')](_0x4832a1[_0x2be7('0x32')],_0x3b65f7[_0x2be7('0x34')]));if(_0x4832a1[_0x2be7('0x32')][_0x2be7('0x3c')]){_0x174c4f[_0x2be7('0x3b')]=_[_0x2be7('0x3d')](_0x174c4f[_0x2be7('0x3b')],{'$or':_['map'](_0x174c4f[_0x2be7('0x37')],function(_0x31c5af){var _0x4265c3={};_0x4265c3[_0x31c5af]={'$like':'%'+_0x4832a1['query'][_0x2be7('0x3c')]+'%'};return _0x4265c3;})});}_0x174c4f=_[_0x2be7('0x3d')]({},_0x174c4f,_0x4832a1['options']);return _0x3ce945['getLists'](_0x174c4f);}})[_0x2be7('0x24')](function(_0x1fb344){if(_0x1fb344){_0x2e50ba=_0x1fb344[_0x2be7('0x38')];if(!_0x4832a1[_0x2be7('0x32')][_0x2be7('0x54')]('nolimit')){_0x174c4f[_0x2be7('0x1c')]=qs[_0x2be7('0x1c')](_0x4832a1[_0x2be7('0x32')][_0x2be7('0x1c')]);_0x174c4f[_0x2be7('0x1a')]=qs[_0x2be7('0x1a')](_0x4832a1[_0x2be7('0x32')][_0x2be7('0x1a')]);}return _0x3ce945[_0x2be7('0x5f')](_0x174c4f);}})[_0x2be7('0x24')](function(_0x49ef37){if(_0x49ef37){return _0x49ef37?{'count':_0x2e50ba,'rows':_0x49ef37}:null;}})[_0x2be7('0x24')](respondWithResult(_0x4d03e5,null))[_0x2be7('0x41')](handleError(_0x4d03e5,null));};exports[_0x2be7('0x61')]=function(_0x3b1146,_0x1885a4,_0x494380){var _0x23c775,_0x35f56b;return db['Campaign'][_0x2be7('0x44')]({'where':{'id':_0x3b1146[_0x2be7('0x4c')]['id']}})[_0x2be7('0x24')](handleEntityNotFound(_0x1885a4,null))[_0x2be7('0x24')](function(_0x2e4ae8){if(_0x2e4ae8){_0x35f56b=_0x2e4ae8;return _0x2e4ae8[_0x2be7('0x61')](_0x3b1146[_0x2be7('0x4f')][_0x2be7('0x62')],_[_0x2be7('0x63')](_0x3b1146['body'],['ids','id'])||{});}return null;})[_0x2be7('0x64')](function(_0x1141d2){var _0x22fdf4;_0x23c775=_0x1141d2||[];var _0x2711a9=[];if(_0x1141d2){for(var _0x847256=0x0;_0x847256<_0x1141d2['length'];_0x847256+=0x1){var _0x2dec55=_0x1141d2[_0x847256]['get']({'plain':!![]});_0x35f56b[_0x2be7('0x65')]=_0x3b1146[_0x2be7('0x4f')][_0x2be7('0x65')]?_0x3b1146[_0x2be7('0x4f')][_0x2be7('0x65')]:_0x35f56b[_0x2be7('0x65')];switch(_0x35f56b[_0x2be7('0x65')]){case _0x2be7('0x66'):_0x22fdf4=squel[_0x2be7('0x67')]()[_0x2be7('0x68')](_0x2be7('0x69'))[_0x2be7('0x6a')]([_0x2be7('0x6b'),_0x2be7('0x6c'),_0x2be7('0x6d'),_0x2be7('0x6e'),_0x2be7('0x57'),_0x2be7('0x4d'),'updatedAt'],squel[_0x2be7('0x6f')]()[_0x2be7('0x70')](_0x2be7('0x6b'),_0x2be7('0x6b'))[_0x2be7('0x70')]('NOW()',_0x2be7('0x6c'))[_0x2be7('0x70')]('id',_0x2be7('0x6d'))['field'](_0x2dec55['CmListId'][_0x2be7('0x71')](),'ListId')[_0x2be7('0x70')](_0x3b1146[_0x2be7('0x4c')]['id'][_0x2be7('0x71')](),_0x2be7('0x57'))[_0x2be7('0x70')]('NOW()','createdAt')[_0x2be7('0x70')](_0x2be7('0x72'),_0x2be7('0x4e'))[_0x2be7('0x73')](_0x2be7('0x74'))[_0x2be7('0x3b')](_0x2be7('0x75'))['where'](_0x2be7('0x76'),_0x2dec55[_0x2be7('0x77')][_0x2be7('0x71')]())[_0x2be7('0x3b')](_0x2be7('0x78'))[_0x2be7('0x3b')](_0x2be7('0x79'),squel[_0x2be7('0x6f')]()[_0x2be7('0x70')](_0x2be7('0x7a'))[_0x2be7('0x73')](_0x2be7('0x7b'))[_0x2be7('0x3b')](_0x2be7('0x7c'),_0x3b1146[_0x2be7('0x4c')]['id']['toString']()))[_0x2be7('0x3b')](_0x2be7('0x79'),squel[_0x2be7('0x6f')]()[_0x2be7('0x70')]('COALESCE(phone,\x27\x27)')[_0x2be7('0x73')](_0x2be7('0x69'))['where'](_0x2be7('0x7c'),_0x3b1146[_0x2be7('0x4c')]['id']['toString']())))['toString']();break;case _0x2be7('0x7d'):_0x22fdf4=squel[_0x2be7('0x67')]()['into'](_0x2be7('0x69'))[_0x2be7('0x6a')]([_0x2be7('0x6b'),_0x2be7('0x6c'),_0x2be7('0x6d'),'ListId','CampaignId',_0x2be7('0x4d'),_0x2be7('0x4e')],squel[_0x2be7('0x6f')]()['field'](_0x2be7('0x6b'),_0x2be7('0x6b'))[_0x2be7('0x70')]('NOW()','scheduledAt')[_0x2be7('0x70')]('id',_0x2be7('0x6d'))['field'](_0x2dec55[_0x2be7('0x77')][_0x2be7('0x71')](),_0x2be7('0x6e'))[_0x2be7('0x70')](_0x3b1146[_0x2be7('0x4c')]['id'][_0x2be7('0x71')](),'CampaignId')[_0x2be7('0x70')](_0x2be7('0x72'),_0x2be7('0x4d'))[_0x2be7('0x70')](_0x2be7('0x72'),_0x2be7('0x4e'))[_0x2be7('0x73')]('cm_contacts')[_0x2be7('0x3b')]('deletedAt\x20IS\x20NULL')[_0x2be7('0x3b')](_0x2be7('0x76'),_0x2dec55[_0x2be7('0x77')][_0x2be7('0x71')]())[_0x2be7('0x3b')](_0x2be7('0x78'))[_0x2be7('0x3b')](_0x2be7('0x79'),squel[_0x2be7('0x6f')]()[_0x2be7('0x70')](_0x2be7('0x7e'))[_0x2be7('0x73')]('cm_hopper')[_0x2be7('0x3b')](_0x2be7('0x7c'),_0x3b1146[_0x2be7('0x4c')]['id'][_0x2be7('0x71')]())))['toString']();break;default:_0x22fdf4=squel[_0x2be7('0x67')]()['into']('cm_hopper')['fromQuery']([_0x2be7('0x6b'),_0x2be7('0x6c'),_0x2be7('0x6d'),_0x2be7('0x6e'),_0x2be7('0x57'),_0x2be7('0x4d'),_0x2be7('0x4e')],squel[_0x2be7('0x6f')]()['field'](_0x2be7('0x6b'),'phone')[_0x2be7('0x70')]('NOW()',_0x2be7('0x6c'))[_0x2be7('0x70')]('id',_0x2be7('0x6d'))['field'](_0x2dec55[_0x2be7('0x77')]['toString'](),_0x2be7('0x6e'))['field'](_0x3b1146[_0x2be7('0x4c')]['id'][_0x2be7('0x71')](),_0x2be7('0x57'))[_0x2be7('0x70')]('NOW()',_0x2be7('0x4d'))['field'](_0x2be7('0x72'),_0x2be7('0x4e'))[_0x2be7('0x73')](_0x2be7('0x74'))[_0x2be7('0x3b')](_0x2be7('0x75'))[_0x2be7('0x3b')](_0x2be7('0x76'),_0x2dec55[_0x2be7('0x77')][_0x2be7('0x71')]())[_0x2be7('0x3b')](_0x2be7('0x78')))[_0x2be7('0x71')]();}_0x2711a9[_0x2be7('0x7f')](db[_0x2be7('0x80')][_0x2be7('0x32')](_0x22fdf4));}return BPromise['all'](_0x2711a9);}})[_0x2be7('0x24')](function(){return _0x23c775;})[_0x2be7('0x24')](respondWithResult(_0x1885a4,null))[_0x2be7('0x41')](handleError(_0x1885a4,null));};exports[_0x2be7('0x81')]=function(_0x5ef377,_0x335986,_0x280d21){return db[_0x2be7('0x2b')][_0x2be7('0x44')]({'where':{'id':_0x5ef377['params']['id']}})[_0x2be7('0x24')](handleEntityNotFound(_0x335986,null))[_0x2be7('0x24')](function(_0xd09e0b){if(_0xd09e0b){return _0xd09e0b['removeLists'](_0x5ef377[_0x2be7('0x32')]['ids']);}})['then'](function(_0x848cef){if(_0x848cef){return db['CmHopper'][_0x2be7('0x23')]({'where':{'ListId':_0x5ef377[_0x2be7('0x32')]['ids'],'CampaignId':_0x5ef377['params']['id']}})[_0x2be7('0x24')](function(){return _0x848cef;});}})['then'](respondWithStatusCode(_0x335986,null))[_0x2be7('0x41')](handleError(_0x335986,null));};exports[_0x2be7('0x82')]=function(_0x341edc,_0x2c6484,_0x4fb989){var _0x16a350={};var _0x42305e={};var _0x3f4d9b;var _0x1efa06;return db[_0x2be7('0x2b')][_0x2be7('0x52')]({'where':{'id':_0x341edc['params']['id']}})['then'](handleEntityNotFound(_0x2c6484,null))['then'](function(_0x413003){if(_0x413003){_0x3f4d9b=_0x413003;_0x42305e[_0x2be7('0x30')]=_[_0x2be7('0x33')](db[_0x2be7('0x60')][_0x2be7('0x2c')]);_0x42305e[_0x2be7('0x32')]=_[_0x2be7('0x33')](_0x341edc['query']);_0x42305e[_0x2be7('0x34')]=_['intersection'](_0x42305e['model'],_0x42305e[_0x2be7('0x32')]);_0x16a350[_0x2be7('0x37')]=_[_0x2be7('0x35')](_0x42305e['model'],qs[_0x2be7('0x36')](_0x341edc[_0x2be7('0x32')][_0x2be7('0x36')]));_0x16a350[_0x2be7('0x37')]=_0x16a350[_0x2be7('0x37')][_0x2be7('0x38')]?_0x16a350[_0x2be7('0x37')]:_0x42305e[_0x2be7('0x30')];_0x16a350['order']=qs[_0x2be7('0x3a')](_0x341edc[_0x2be7('0x32')][_0x2be7('0x3a')]);_0x16a350[_0x2be7('0x3b')]=qs[_0x2be7('0x34')](_[_0x2be7('0x56')](_0x341edc[_0x2be7('0x32')],_0x42305e[_0x2be7('0x34')]));if(_0x341edc[_0x2be7('0x32')][_0x2be7('0x3c')]){_0x16a350[_0x2be7('0x3b')]=_[_0x2be7('0x3d')](_0x16a350['where'],{'$or':_[_0x2be7('0x31')](_0x16a350['attributes'],function(_0x52ca73){var _0x54af26={};_0x54af26[_0x52ca73]={'$like':'%'+_0x341edc[_0x2be7('0x32')][_0x2be7('0x3c')]+'%'};return _0x54af26;})});}_0x16a350=_[_0x2be7('0x3d')]({},_0x16a350,_0x341edc['options']);return _0x3f4d9b['getBlackLists'](_0x16a350);}})[_0x2be7('0x24')](function(_0x592927){if(_0x592927){_0x1efa06=_0x592927['length'];if(!_0x341edc[_0x2be7('0x32')][_0x2be7('0x54')](_0x2be7('0x55'))){_0x16a350[_0x2be7('0x1c')]=qs['limit'](_0x341edc[_0x2be7('0x32')][_0x2be7('0x1c')]);_0x16a350[_0x2be7('0x1a')]=qs[_0x2be7('0x1a')](_0x341edc[_0x2be7('0x32')][_0x2be7('0x1a')]);}return _0x3f4d9b[_0x2be7('0x82')](_0x16a350);}})['then'](function(_0x493b67){if(_0x493b67){return _0x493b67?{'count':_0x1efa06,'rows':_0x493b67}:null;}})[_0x2be7('0x24')](respondWithResult(_0x2c6484,null))['catch'](handleError(_0x2c6484,null));};exports[_0x2be7('0x83')]=function(_0x44f59f,_0x184a1c,_0x190a93){var _0x28bb4b,_0x1c9397;return db[_0x2be7('0x2b')][_0x2be7('0x44')]({'where':{'id':_0x44f59f[_0x2be7('0x4c')]['id']}})[_0x2be7('0x24')](handleEntityNotFound(_0x184a1c,null))['then'](function(_0x34da78){if(_0x34da78){_0x1c9397=_0x34da78;return _0x34da78[_0x2be7('0x83')](_0x44f59f['body'][_0x2be7('0x62')],_[_0x2be7('0x63')](_0x44f59f['body'],[_0x2be7('0x62'),'id'])||{});}return null;})[_0x2be7('0x64')](function(_0x5f510a){var _0x3d253c;_0x28bb4b=_0x5f510a||[];var _0x4c62fe=[];if(_0x5f510a){for(var _0x384dd2=0x0;_0x384dd2<_0x5f510a[_0x2be7('0x38')];_0x384dd2+=0x1){var _0x577781=_0x5f510a[_0x384dd2][_0x2be7('0x25')]({'plain':!![]});_0x3d253c=squel[_0x2be7('0x67')]()[_0x2be7('0x68')](_0x2be7('0x84'))[_0x2be7('0x6a')]([_0x2be7('0x6b'),_0x2be7('0x6d'),_0x2be7('0x6e'),'CampaignId',_0x2be7('0x4d'),'updatedAt'],squel[_0x2be7('0x6f')]()[_0x2be7('0x70')](_0x2be7('0x6b'),_0x2be7('0x6b'))[_0x2be7('0x70')]('id','ContactId')[_0x2be7('0x70')](_0x577781[_0x2be7('0x77')][_0x2be7('0x71')](),_0x2be7('0x6e'))['field'](_0x44f59f[_0x2be7('0x4c')]['id'][_0x2be7('0x71')](),_0x2be7('0x57'))[_0x2be7('0x70')](_0x2be7('0x72'),_0x2be7('0x4d'))[_0x2be7('0x70')]('NOW()','updatedAt')[_0x2be7('0x73')](_0x2be7('0x74'))[_0x2be7('0x3b')](_0x2be7('0x75'))['where'](_0x2be7('0x76'),_0x577781['CmListId'][_0x2be7('0x71')]())['where'](_0x2be7('0x78')))[_0x2be7('0x71')]();_0x4c62fe[_0x2be7('0x7f')](db[_0x2be7('0x80')][_0x2be7('0x32')](_0x3d253c));}return BPromise[_0x2be7('0x85')](_0x4c62fe);}})[_0x2be7('0x24')](function(){return _0x28bb4b;})[_0x2be7('0x24')](respondWithResult(_0x184a1c,null))[_0x2be7('0x41')](handleError(_0x184a1c,null));};exports['removeBlackLists']=function(_0x319213,_0x1e8de1,_0x214375){return db['Campaign'][_0x2be7('0x44')]({'where':{'id':_0x319213['params']['id']}})[_0x2be7('0x24')](handleEntityNotFound(_0x1e8de1,null))[_0x2be7('0x24')](function(_0x2cd476){if(_0x2cd476){return _0x2cd476[_0x2be7('0x86')](_0x319213['query']['ids']);}})[_0x2be7('0x24')](function(_0x3bc67e){if(_0x3bc67e){return db['CmHopperBlack'][_0x2be7('0x23')]({'where':{'ListId':_0x319213['query'][_0x2be7('0x62')],'CampaignId':_0x319213['params']['id']}})[_0x2be7('0x24')](function(){return _0x3bc67e;});}})[_0x2be7('0x24')](respondWithStatusCode(_0x1e8de1,null))[_0x2be7('0x41')](handleError(_0x1e8de1,null));}; \ No newline at end of file +var _0x53fb=['lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','UserProfileResource','error','name','send','index','map','Campaign','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','user','get','role','IvrCampaigns','userProfileId','autoAssociation','clone','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','CampaignId','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','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?','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','all','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0xd73c75,_0x2a023b){var _0x1cb520=function(_0x16bff0){while(--_0x16bff0){_0xd73c75['push'](_0xd73c75['shift']());}};_0x1cb520(++_0x2a023b);}(_0x53fb,0x19d));var _0xb53f=function(_0x43ab5f,_0x358ba8){_0x43ab5f=_0x43ab5f-0x0;var _0x1c952b=_0x53fb[_0x43ab5f];return _0x1c952b;};'use strict';var emlformat=require(_0xb53f('0x0'));var rimraf=require(_0xb53f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb53f('0x2'));var rp=require(_0xb53f('0x3'));var moment=require(_0xb53f('0x4'));var BPromise=require(_0xb53f('0x5'));var Mustache=require(_0xb53f('0x6'));var util=require(_0xb53f('0x7'));var path=require(_0xb53f('0x8'));var sox=require(_0xb53f('0x9'));var csv=require(_0xb53f('0xa'));var ejs=require(_0xb53f('0xb'));var fs=require('fs');var fs_extra=require(_0xb53f('0xc'));var _=require(_0xb53f('0xd'));var squel=require(_0xb53f('0xe'));var crypto=require(_0xb53f('0xf'));var jsforce=require(_0xb53f('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xb53f('0xa'));var querystring=require(_0xb53f('0x11'));var Papa=require(_0xb53f('0x12'));var Redis=require(_0xb53f('0x13'));var authService=require(_0xb53f('0x14'));var qs=require(_0xb53f('0x15'));var as=require(_0xb53f('0x16'));var hardwareService=require(_0xb53f('0x17'));var logger=require(_0xb53f('0x18'))(_0xb53f('0x19'));var utils=require(_0xb53f('0x1a'));var config=require(_0xb53f('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xb53f('0x1c'))['db'];function respondWithStatusCode(_0x47b95b,_0x4a16e0){_0x4a16e0=_0x4a16e0||0xcc;return function(_0x1c1210){if(_0x1c1210){return _0x47b95b[_0xb53f('0x1d')](_0x4a16e0);}return _0x47b95b[_0xb53f('0x1e')](_0x4a16e0)[_0xb53f('0x1f')]();};}function respondWithResult(_0x5ac2a3,_0x38c177){_0x38c177=_0x38c177||0xc8;return function(_0x321d3c){if(_0x321d3c){return _0x5ac2a3[_0xb53f('0x1e')](_0x38c177)[_0xb53f('0x20')](_0x321d3c);}};}function respondWithFilteredResult(_0x3065a8,_0x3a8592){return function(_0x42d57a){if(_0x42d57a){var _0x551e99=typeof _0x3a8592[_0xb53f('0x21')]===_0xb53f('0x22')&&typeof _0x3a8592[_0xb53f('0x23')]===_0xb53f('0x22');var _0x2f4101=_0x42d57a['count'];var _0x38b35a=_0x551e99?0x0:_0x3a8592[_0xb53f('0x21')];var _0x142b67=_0x551e99?_0x42d57a[_0xb53f('0x24')]:_0x3a8592['offset']+_0x3a8592[_0xb53f('0x23')];var _0x25d3f0;if(_0x142b67>=_0x2f4101){_0x142b67=_0x2f4101;_0x25d3f0=0xc8;}else{_0x25d3f0=0xce;}_0x3065a8[_0xb53f('0x1e')](_0x25d3f0);return _0x3065a8['set'](_0xb53f('0x25'),_0x38b35a+'-'+_0x142b67+'/'+_0x2f4101)[_0xb53f('0x20')](_0x42d57a);}return null;};}function patchUpdates(_0x44404a){return function(_0x31a676){try{jsonpatch[_0xb53f('0x26')](_0x31a676,_0x44404a,!![]);}catch(_0x5cb9eb){return BPromise[_0xb53f('0x27')](_0x5cb9eb);}return _0x31a676[_0xb53f('0x28')]();};}function saveUpdates(_0x21092c,_0x5d0296){return function(_0x5309ad){if(_0x5309ad){return _0x5309ad[_0xb53f('0x29')](_0x21092c)['then'](function(_0x1e089c){return _0x1e089c;});}return null;};}function removeEntity(_0x4306ee,_0x17190a){return function(_0x2f5327){if(_0x2f5327){return _0x2f5327[_0xb53f('0x2a')]()[_0xb53f('0x2b')](function(){var _0x136618=_0x2f5327['get']({'plain':!![]});var _0x3af620='IvrCampaigns';return db[_0xb53f('0x2c')]['destroy']({'where':{'type':_0x3af620,'resourceId':_0x136618['id']}})[_0xb53f('0x2b')](function(){return _0x2f5327;});})[_0xb53f('0x2b')](function(){_0x4306ee[_0xb53f('0x1e')](0xcc)[_0xb53f('0x1f')]();});}};}function handleEntityNotFound(_0x3aaf50,_0x57c0df){return function(_0x148e10){if(!_0x148e10){_0x3aaf50['sendStatus'](0x194);}return _0x148e10;};}function handleError(_0x2ed22f,_0x2fd439){_0x2fd439=_0x2fd439||0x1f4;return function(_0xfda78b){logger[_0xb53f('0x2d')](_0xfda78b['stack']);if(_0xfda78b[_0xb53f('0x2e')]){delete _0xfda78b[_0xb53f('0x2e')];}_0x2ed22f[_0xb53f('0x1e')](_0x2fd439)[_0xb53f('0x2f')](_0xfda78b);};}exports[_0xb53f('0x30')]=function(_0x53c013,_0x34eea7){var _0x22252e={},_0x589ff5={},_0x2f6e79={'count':0x0,'rows':[]};var _0x49e36b=_[_0xb53f('0x31')](db[_0xb53f('0x32')]['rawAttributes'],function(_0x1731c4){return{'name':_0x1731c4['fieldName'],'type':_0x1731c4[_0xb53f('0x33')][_0xb53f('0x34')]};});_0x589ff5[_0xb53f('0x35')]=_[_0xb53f('0x31')](_0x49e36b,'name');_0x589ff5[_0xb53f('0x36')]=_[_0xb53f('0x37')](_0x53c013[_0xb53f('0x36')]);_0x589ff5[_0xb53f('0x38')]=_[_0xb53f('0x39')](_0x589ff5[_0xb53f('0x35')],_0x589ff5[_0xb53f('0x36')]);_0x22252e['attributes']=_[_0xb53f('0x39')](_0x589ff5[_0xb53f('0x35')],qs[_0xb53f('0x3a')](_0x53c013['query']['fields']));_0x22252e[_0xb53f('0x3b')]=_0x22252e['attributes']['length']?_0x22252e[_0xb53f('0x3b')]:_0x589ff5[_0xb53f('0x35')];if(!_0x53c013['query'][_0xb53f('0x3c')](_0xb53f('0x3d'))){_0x22252e[_0xb53f('0x23')]=qs[_0xb53f('0x23')](_0x53c013[_0xb53f('0x36')][_0xb53f('0x23')]);_0x22252e['offset']=qs[_0xb53f('0x21')](_0x53c013[_0xb53f('0x36')][_0xb53f('0x21')]);}_0x22252e[_0xb53f('0x3e')]=qs[_0xb53f('0x3f')](_0x53c013[_0xb53f('0x36')][_0xb53f('0x3f')]);_0x22252e[_0xb53f('0x40')]=qs[_0xb53f('0x38')](_[_0xb53f('0x41')](_0x53c013[_0xb53f('0x36')],_0x589ff5[_0xb53f('0x38')]),_0x49e36b);if(_0x53c013[_0xb53f('0x36')][_0xb53f('0x42')]){_0x22252e[_0xb53f('0x40')]=_[_0xb53f('0x43')](_0x22252e[_0xb53f('0x40')],{'$or':_['map'](_0x49e36b,function(_0x53d4fc){if(_0x53d4fc['type']!=='VIRTUAL'){var _0x48b760={};_0x48b760[_0x53d4fc['name']]={'$like':'%'+_0x53c013['query']['filter']+'%'};return _0x48b760;}})});}_0x22252e=_['merge']({},_0x22252e,_0x53c013[_0xb53f('0x44')]);var _0xfb058d={'where':_0x22252e[_0xb53f('0x40')]};return db[_0xb53f('0x32')][_0xb53f('0x24')](_0xfb058d)[_0xb53f('0x2b')](function(_0xced5d2){_0x2f6e79[_0xb53f('0x24')]=_0xced5d2;if(_0x53c013['query'][_0xb53f('0x45')]){_0x22252e[_0xb53f('0x46')]=[{'all':!![]}];}return db[_0xb53f('0x32')][_0xb53f('0x47')](_0x22252e);})[_0xb53f('0x2b')](function(_0x4bf8ea){_0x2f6e79[_0xb53f('0x48')]=_0x4bf8ea;return _0x2f6e79;})[_0xb53f('0x2b')](respondWithFilteredResult(_0x34eea7,_0x22252e))[_0xb53f('0x49')](handleError(_0x34eea7,null));};exports[_0xb53f('0x4a')]=function(_0x980d4e,_0x4b6473){var _0x8079e5={'raw':![],'where':{'id':_0x980d4e[_0xb53f('0x4b')]['id']}},_0x45ce4e={};_0x45ce4e[_0xb53f('0x35')]=_[_0xb53f('0x37')](db[_0xb53f('0x32')][_0xb53f('0x4c')]);_0x45ce4e[_0xb53f('0x36')]=_[_0xb53f('0x37')](_0x980d4e[_0xb53f('0x36')]);_0x45ce4e[_0xb53f('0x38')]=_[_0xb53f('0x39')](_0x45ce4e[_0xb53f('0x35')],_0x45ce4e['query']);_0x8079e5[_0xb53f('0x3b')]=_[_0xb53f('0x39')](_0x45ce4e['model'],qs['fields'](_0x980d4e[_0xb53f('0x36')]['fields']));_0x8079e5[_0xb53f('0x3b')]=_0x8079e5[_0xb53f('0x3b')][_0xb53f('0x4d')]?_0x8079e5[_0xb53f('0x3b')]:_0x45ce4e[_0xb53f('0x35')];if(_0x980d4e[_0xb53f('0x36')][_0xb53f('0x45')]){_0x8079e5[_0xb53f('0x46')]=[{'all':!![]}];}_0x8079e5=_[_0xb53f('0x43')]({},_0x8079e5,_0x980d4e[_0xb53f('0x44')]);return db['Campaign'][_0xb53f('0x4e')](_0x8079e5)[_0xb53f('0x2b')](handleEntityNotFound(_0x4b6473,null))[_0xb53f('0x2b')](respondWithResult(_0x4b6473,null))[_0xb53f('0x49')](handleError(_0x4b6473,null));};exports[_0xb53f('0x4f')]=function(_0x2983ce,_0x116a3d){return db[_0xb53f('0x32')]['create'](_0x2983ce[_0xb53f('0x50')],{})[_0xb53f('0x2b')](function(_0x320b28){var _0x284a81=_0x2983ce[_0xb53f('0x51')][_0xb53f('0x52')]({'plain':!![]});if(!_0x284a81)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x284a81[_0xb53f('0x53')]==='user'){var _0x3461c9=_0x320b28[_0xb53f('0x52')]({'plain':!![]});var _0x519574=_0xb53f('0x54');return db['UserProfileSection'][_0xb53f('0x4e')]({'where':{'name':_0x519574,'userProfileId':_0x284a81[_0xb53f('0x55')]},'raw':!![]})[_0xb53f('0x2b')](function(_0x4cea40){if(_0x4cea40&&_0x4cea40[_0xb53f('0x56')]===0x0){return db[_0xb53f('0x2c')]['create']({'name':_0x3461c9[_0xb53f('0x2e')],'resourceId':_0x3461c9['id'],'type':_0x4cea40[_0xb53f('0x2e')],'sectionId':_0x4cea40['id']},{})[_0xb53f('0x2b')](function(){return _0x320b28;});}else{return _0x320b28;}})['catch'](function(_0x384410){logger[_0xb53f('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x384410);throw _0x384410;});}return _0x320b28;})[_0xb53f('0x2b')](respondWithResult(_0x116a3d,0xc9))['catch'](handleError(_0x116a3d,null));};exports[_0xb53f('0x57')]=function(_0x549ac3,_0x4c3ee1){var _0x1b47a5={'where':{'id':_0x549ac3[_0xb53f('0x4b')]['id']}},_0x274d15={};_0x274d15['model']=_[_0xb53f('0x37')](db[_0xb53f('0x32')][_0xb53f('0x4c')]);_0x1b47a5[_0xb53f('0x3b')]=_['intersection'](_0x274d15[_0xb53f('0x35')],qs[_0xb53f('0x3a')](_0x549ac3['query'][_0xb53f('0x3a')]));_0x1b47a5[_0xb53f('0x3b')]=_0x1b47a5['attributes'][_0xb53f('0x4d')]?_0x1b47a5['attributes']:_0x274d15[_0xb53f('0x35')];if(_0x549ac3[_0xb53f('0x36')]['includeAll']){_0x1b47a5[_0xb53f('0x46')]=[{'all':!![]}];}_0x1b47a5=_[_0xb53f('0x43')]({},_0x1b47a5,_0x549ac3[_0xb53f('0x44')]);return db[_0xb53f('0x32')][_0xb53f('0x4e')](_0x1b47a5)[_0xb53f('0x2b')](handleEntityNotFound(_0x4c3ee1,null))[_0xb53f('0x2b')](function(_0x39b5f6){if(_0x39b5f6){var _0x2f08fb=_0x39b5f6[_0xb53f('0x52')]({'plain':!![]});_0x2f08fb=qs[_0xb53f('0x58')](_0x2f08fb,['id','createdAt',_0xb53f('0x59')]);_0x549ac3['body']=_[_0xb53f('0x58')](_0x549ac3[_0xb53f('0x50')],['id',_0xb53f('0x5a'),_0xb53f('0x59')]);return db[_0xb53f('0x32')][_0xb53f('0x4f')](_[_0xb53f('0x43')](_0x2f08fb,_0x549ac3[_0xb53f('0x50')]),{'include':_0x549ac3['query'][_0xb53f('0x45')]?[{'all':!![]}]:undefined})[_0xb53f('0x2b')](function(_0x3bc5dd){var _0x599e5e=_0x549ac3[_0xb53f('0x51')][_0xb53f('0x52')]({'plain':!![]});if(!_0x599e5e)throw new Error(_0xb53f('0x5b'));if(_0x599e5e[_0xb53f('0x53')]===_0xb53f('0x51')){var _0x43c7c1=_0x3bc5dd[_0xb53f('0x52')]({'plain':!![]});var _0x5c255b=_0xb53f('0x54');return db[_0xb53f('0x5c')][_0xb53f('0x4e')]({'where':{'name':_0x5c255b,'userProfileId':_0x599e5e[_0xb53f('0x55')]},'raw':!![]})[_0xb53f('0x2b')](function(_0x22e578){if(_0x22e578&&_0x22e578[_0xb53f('0x56')]===0x0){return db[_0xb53f('0x2c')][_0xb53f('0x4f')]({'name':_0x43c7c1[_0xb53f('0x2e')],'resourceId':_0x43c7c1['id'],'type':_0x22e578[_0xb53f('0x2e')],'sectionId':_0x22e578['id']},{})[_0xb53f('0x2b')](function(){return _0x3bc5dd;});}else{return _0x3bc5dd;}})[_0xb53f('0x49')](function(_0x5937ee){logger['error'](_0xb53f('0x5d'),_0x5937ee);throw _0x5937ee;});}return _0x3bc5dd;});}})[_0xb53f('0x2b')](respondWithResult(_0x4c3ee1,0xc9))[_0xb53f('0x49')](handleError(_0x4c3ee1,null));};exports['update']=function(_0x555ce1,_0x5049b5){if(_0x555ce1[_0xb53f('0x50')]['id']){delete _0x555ce1['body']['id'];}return db[_0xb53f('0x32')][_0xb53f('0x4e')]({'where':{'id':_0x555ce1[_0xb53f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5049b5,null))[_0xb53f('0x2b')](saveUpdates(_0x555ce1[_0xb53f('0x50')],null))[_0xb53f('0x2b')](respondWithResult(_0x5049b5,null))[_0xb53f('0x49')](handleError(_0x5049b5,null));};exports[_0xb53f('0x2a')]=function(_0x244568,_0x2f8673){return db['Campaign'][_0xb53f('0x4e')]({'where':{'id':_0x244568[_0xb53f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2f8673,null))[_0xb53f('0x2b')](removeEntity(_0x2f8673,null))['catch'](handleError(_0x2f8673,null));};exports[_0xb53f('0x5e')]=function(_0x442009,_0x3fe48a,_0x1c1890){var _0x18072f={'raw':!![],'where':{}};var _0x5db9ca={};var _0x408378={'count':0x0,'rows':[]};return db[_0xb53f('0x32')][_0xb53f('0x5f')]({'where':{'id':_0x442009[_0xb53f('0x4b')]['id']}})[_0xb53f('0x2b')](handleEntityNotFound(_0x3fe48a,null))[_0xb53f('0x2b')](function(_0xc2b1a){if(_0xc2b1a){_0x5db9ca[_0xb53f('0x35')]=_[_0xb53f('0x37')](db[_0xb53f('0x60')][_0xb53f('0x4c')]);_0x5db9ca[_0xb53f('0x36')]=_[_0xb53f('0x37')](_0x442009[_0xb53f('0x36')]);_0x5db9ca[_0xb53f('0x38')]=_[_0xb53f('0x39')](_0x5db9ca[_0xb53f('0x35')],_0x5db9ca[_0xb53f('0x36')]);_0x18072f[_0xb53f('0x3b')]=_['intersection'](_0x5db9ca[_0xb53f('0x35')],qs[_0xb53f('0x3a')](_0x442009[_0xb53f('0x36')][_0xb53f('0x3a')]));_0x18072f[_0xb53f('0x3b')]=_0x18072f[_0xb53f('0x3b')][_0xb53f('0x4d')]?_0x18072f[_0xb53f('0x3b')]:_0x5db9ca[_0xb53f('0x35')];if(!_0x442009[_0xb53f('0x36')]['hasOwnProperty'](_0xb53f('0x3d'))){_0x18072f[_0xb53f('0x23')]=qs[_0xb53f('0x23')](_0x442009[_0xb53f('0x36')][_0xb53f('0x23')]);_0x18072f[_0xb53f('0x21')]=qs['offset'](_0x442009['query'][_0xb53f('0x21')]);}_0x18072f[_0xb53f('0x3e')]=qs[_0xb53f('0x3f')](_0x442009[_0xb53f('0x36')][_0xb53f('0x3f')]);_0x18072f[_0xb53f('0x40')]=qs[_0xb53f('0x38')](_['pick'](_0x442009[_0xb53f('0x36')],_0x5db9ca[_0xb53f('0x38')]));_0x18072f[_0xb53f('0x40')][_0xb53f('0x61')]=_0xc2b1a['id'];if(_0x442009[_0xb53f('0x36')][_0xb53f('0x42')]){_0x18072f[_0xb53f('0x40')]=_['merge'](_0x18072f[_0xb53f('0x40')],{'$or':_[_0xb53f('0x31')](_0x18072f['attributes'],function(_0x1bd915){var _0x343bf3={};_0x343bf3[_0x1bd915]={'$like':'%'+_0x442009['query'][_0xb53f('0x42')]+'%'};return _0x343bf3;})});}_0x18072f=_[_0xb53f('0x43')]({},_0x18072f,_0x442009[_0xb53f('0x44')]);return db[_0xb53f('0x60')][_0xb53f('0x24')]({'where':_0x18072f['where']})['then'](function(_0x13321a){_0x408378[_0xb53f('0x24')]=_0x13321a;if(_0x442009[_0xb53f('0x36')][_0xb53f('0x45')]){_0x18072f['include']=[{'all':!![]}];}return db['CmHopper'][_0xb53f('0x47')](_0x18072f);})[_0xb53f('0x2b')](function(_0x3a2323){_0x408378['rows']=_0x3a2323;return _0x408378;});}})[_0xb53f('0x2b')](respondWithFilteredResult(_0x3fe48a,_0x18072f))[_0xb53f('0x49')](handleError(_0x3fe48a,null));};exports[_0xb53f('0x62')]=function(_0x59faef,_0x4f17ad,_0x165940){var _0xf947cc={'raw':!![],'where':{}};var _0x87f27f={};var _0xbc14d6={'count':0x0,'rows':[]};return db['Campaign'][_0xb53f('0x5f')]({'where':{'id':_0x59faef[_0xb53f('0x4b')]['id']}})[_0xb53f('0x2b')](handleEntityNotFound(_0x4f17ad,null))['then'](function(_0x42fb9b){if(_0x42fb9b){_0x87f27f['model']=_['keys'](db['CmHopperHistory'][_0xb53f('0x4c')]);_0x87f27f[_0xb53f('0x36')]=_['keys'](_0x59faef['query']);_0x87f27f[_0xb53f('0x38')]=_[_0xb53f('0x39')](_0x87f27f['model'],_0x87f27f[_0xb53f('0x36')]);_0xf947cc[_0xb53f('0x3b')]=_[_0xb53f('0x39')](_0x87f27f['model'],qs[_0xb53f('0x3a')](_0x59faef['query'][_0xb53f('0x3a')]));_0xf947cc['attributes']=_0xf947cc[_0xb53f('0x3b')][_0xb53f('0x4d')]?_0xf947cc[_0xb53f('0x3b')]:_0x87f27f[_0xb53f('0x35')];if(!_0x59faef[_0xb53f('0x36')][_0xb53f('0x3c')](_0xb53f('0x3d'))){_0xf947cc[_0xb53f('0x23')]=qs[_0xb53f('0x23')](_0x59faef['query'][_0xb53f('0x23')]);_0xf947cc[_0xb53f('0x21')]=qs['offset'](_0x59faef[_0xb53f('0x36')][_0xb53f('0x21')]);}_0xf947cc['order']=qs['sort'](_0x59faef[_0xb53f('0x36')][_0xb53f('0x3f')]);_0xf947cc[_0xb53f('0x40')]=qs['filters'](_[_0xb53f('0x41')](_0x59faef[_0xb53f('0x36')],_0x87f27f[_0xb53f('0x38')]));_0xf947cc[_0xb53f('0x40')]['CampaignId']=_0x42fb9b['id'];if(_0x59faef[_0xb53f('0x36')]['filter']){_0xf947cc[_0xb53f('0x40')]=_['merge'](_0xf947cc[_0xb53f('0x40')],{'$or':_[_0xb53f('0x31')](_0xf947cc[_0xb53f('0x3b')],function(_0x2e0d53){var _0x177e74={};_0x177e74[_0x2e0d53]={'$like':'%'+_0x59faef[_0xb53f('0x36')][_0xb53f('0x42')]+'%'};return _0x177e74;})});}_0xf947cc=_['merge']({},_0xf947cc,_0x59faef['options']);return db[_0xb53f('0x63')][_0xb53f('0x24')]({'where':_0xf947cc['where']})[_0xb53f('0x2b')](function(_0xce3fb8){_0xbc14d6[_0xb53f('0x24')]=_0xce3fb8;if(_0x59faef[_0xb53f('0x36')]['includeAll']){_0xf947cc[_0xb53f('0x46')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xb53f('0x47')](_0xf947cc);})[_0xb53f('0x2b')](function(_0x47cc3d){_0xbc14d6['rows']=_0x47cc3d;return _0xbc14d6;});}})[_0xb53f('0x2b')](respondWithFilteredResult(_0x4f17ad,_0xf947cc))[_0xb53f('0x49')](handleError(_0x4f17ad,null));};exports['getHopperFinals']=function(_0x516c37,_0x3d7f03,_0x5ef47f){var _0x1e56f4={'raw':!![],'where':{}};var _0x8f4185={};var _0x1feaed={'count':0x0,'rows':[]};return db['Campaign'][_0xb53f('0x5f')]({'where':{'id':_0x516c37[_0xb53f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3d7f03,null))[_0xb53f('0x2b')](function(_0x2caa2d){if(_0x2caa2d){_0x8f4185['model']=_[_0xb53f('0x37')](db[_0xb53f('0x64')][_0xb53f('0x4c')]);_0x8f4185[_0xb53f('0x36')]=_['keys'](_0x516c37[_0xb53f('0x36')]);_0x8f4185[_0xb53f('0x38')]=_[_0xb53f('0x39')](_0x8f4185[_0xb53f('0x35')],_0x8f4185[_0xb53f('0x36')]);_0x1e56f4[_0xb53f('0x3b')]=_['intersection'](_0x8f4185[_0xb53f('0x35')],qs['fields'](_0x516c37[_0xb53f('0x36')][_0xb53f('0x3a')]));_0x1e56f4['attributes']=_0x1e56f4[_0xb53f('0x3b')]['length']?_0x1e56f4[_0xb53f('0x3b')]:_0x8f4185[_0xb53f('0x35')];if(!_0x516c37[_0xb53f('0x36')][_0xb53f('0x3c')](_0xb53f('0x3d'))){_0x1e56f4[_0xb53f('0x23')]=qs[_0xb53f('0x23')](_0x516c37[_0xb53f('0x36')][_0xb53f('0x23')]);_0x1e56f4[_0xb53f('0x21')]=qs['offset'](_0x516c37['query'][_0xb53f('0x21')]);}_0x1e56f4['order']=qs[_0xb53f('0x3f')](_0x516c37[_0xb53f('0x36')]['sort']);_0x1e56f4[_0xb53f('0x40')]=qs['filters'](_[_0xb53f('0x41')](_0x516c37['query'],_0x8f4185[_0xb53f('0x38')]));_0x1e56f4[_0xb53f('0x40')][_0xb53f('0x61')]=_0x2caa2d['id'];if(_0x516c37[_0xb53f('0x36')][_0xb53f('0x42')]){_0x1e56f4[_0xb53f('0x40')]=_['merge'](_0x1e56f4[_0xb53f('0x40')],{'$or':_[_0xb53f('0x31')](_0x1e56f4[_0xb53f('0x3b')],function(_0x4c9475){var _0x2d483e={};_0x2d483e[_0x4c9475]={'$like':'%'+_0x516c37[_0xb53f('0x36')]['filter']+'%'};return _0x2d483e;})});}_0x1e56f4=_['merge']({},_0x1e56f4,_0x516c37[_0xb53f('0x44')]);return db[_0xb53f('0x64')]['count']({'where':_0x1e56f4[_0xb53f('0x40')]})[_0xb53f('0x2b')](function(_0x57188e){_0x1feaed[_0xb53f('0x24')]=_0x57188e;if(_0x516c37[_0xb53f('0x36')][_0xb53f('0x45')]){_0x1e56f4[_0xb53f('0x46')]=[{'all':!![]}];}return db[_0xb53f('0x64')][_0xb53f('0x47')](_0x1e56f4);})[_0xb53f('0x2b')](function(_0x11ba83){_0x1feaed['rows']=_0x11ba83;return _0x1feaed;});}})['then'](respondWithFilteredResult(_0x3d7f03,_0x1e56f4))[_0xb53f('0x49')](handleError(_0x3d7f03,null));};exports[_0xb53f('0x65')]=function(_0x55eef6,_0x4849ba,_0x25c979){var _0x3c2627={'raw':!![],'where':{}};var _0x52892a={};var _0x22ac6d={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x55eef6[_0xb53f('0x4b')]['id']}})[_0xb53f('0x2b')](handleEntityNotFound(_0x4849ba,null))[_0xb53f('0x2b')](function(_0x182bd2){if(_0x182bd2){_0x52892a['model']=_['keys'](db[_0xb53f('0x66')]['rawAttributes']);_0x52892a[_0xb53f('0x36')]=_['keys'](_0x55eef6[_0xb53f('0x36')]);_0x52892a['filters']=_[_0xb53f('0x39')](_0x52892a[_0xb53f('0x35')],_0x52892a[_0xb53f('0x36')]);_0x3c2627[_0xb53f('0x3b')]=_[_0xb53f('0x39')](_0x52892a[_0xb53f('0x35')],qs['fields'](_0x55eef6['query'][_0xb53f('0x3a')]));_0x3c2627[_0xb53f('0x3b')]=_0x3c2627[_0xb53f('0x3b')][_0xb53f('0x4d')]?_0x3c2627[_0xb53f('0x3b')]:_0x52892a[_0xb53f('0x35')];if(!_0x55eef6['query']['hasOwnProperty'](_0xb53f('0x3d'))){_0x3c2627[_0xb53f('0x23')]=qs['limit'](_0x55eef6[_0xb53f('0x36')][_0xb53f('0x23')]);_0x3c2627[_0xb53f('0x21')]=qs[_0xb53f('0x21')](_0x55eef6['query'][_0xb53f('0x21')]);}_0x3c2627[_0xb53f('0x3e')]=qs[_0xb53f('0x3f')](_0x55eef6[_0xb53f('0x36')][_0xb53f('0x3f')]);_0x3c2627[_0xb53f('0x40')]=qs[_0xb53f('0x38')](_[_0xb53f('0x41')](_0x55eef6[_0xb53f('0x36')],_0x52892a[_0xb53f('0x38')]));_0x3c2627[_0xb53f('0x40')][_0xb53f('0x61')]=_0x182bd2['id'];if(_0x55eef6['query'][_0xb53f('0x42')]){_0x3c2627['where']=_['merge'](_0x3c2627[_0xb53f('0x40')],{'$or':_['map'](_0x3c2627[_0xb53f('0x3b')],function(_0x5d1924){var _0x557f6c={};_0x557f6c[_0x5d1924]={'$like':'%'+_0x55eef6[_0xb53f('0x36')][_0xb53f('0x42')]+'%'};return _0x557f6c;})});}_0x3c2627=_['merge']({},_0x3c2627,_0x55eef6[_0xb53f('0x44')]);return db[_0xb53f('0x66')][_0xb53f('0x24')]({'where':_0x3c2627[_0xb53f('0x40')]})[_0xb53f('0x2b')](function(_0x7319f6){_0x22ac6d[_0xb53f('0x24')]=_0x7319f6;if(_0x55eef6[_0xb53f('0x36')][_0xb53f('0x45')]){_0x3c2627[_0xb53f('0x46')]=[{'all':!![]}];}return db[_0xb53f('0x66')][_0xb53f('0x47')](_0x3c2627);})['then'](function(_0x4048b0){_0x22ac6d[_0xb53f('0x48')]=_0x4048b0;return _0x22ac6d;});}})[_0xb53f('0x2b')](respondWithFilteredResult(_0x4849ba,_0x3c2627))[_0xb53f('0x49')](handleError(_0x4849ba,null));};exports[_0xb53f('0x67')]=function(_0x49706d,_0x1aae49,_0x3ac2ba){var _0x1edd75={};var _0x431b70={};var _0x50672e;var _0x43036c;return db['Campaign'][_0xb53f('0x5f')]({'where':{'id':_0x49706d[_0xb53f('0x4b')]['id']}})[_0xb53f('0x2b')](handleEntityNotFound(_0x1aae49,null))['then'](function(_0xc7e389){if(_0xc7e389){_0x50672e=_0xc7e389;_0x431b70[_0xb53f('0x35')]=_[_0xb53f('0x37')](db[_0xb53f('0x68')][_0xb53f('0x4c')]);_0x431b70[_0xb53f('0x36')]=_[_0xb53f('0x37')](_0x49706d[_0xb53f('0x36')]);_0x431b70[_0xb53f('0x38')]=_[_0xb53f('0x39')](_0x431b70[_0xb53f('0x35')],_0x431b70[_0xb53f('0x36')]);_0x1edd75[_0xb53f('0x3b')]=_[_0xb53f('0x39')](_0x431b70[_0xb53f('0x35')],qs[_0xb53f('0x3a')](_0x49706d['query']['fields']));_0x1edd75[_0xb53f('0x3b')]=_0x1edd75['attributes'][_0xb53f('0x4d')]?_0x1edd75[_0xb53f('0x3b')]:_0x431b70[_0xb53f('0x35')];_0x1edd75[_0xb53f('0x3e')]=qs[_0xb53f('0x3f')](_0x49706d['query'][_0xb53f('0x3f')]);_0x1edd75[_0xb53f('0x40')]=qs[_0xb53f('0x38')](_['pick'](_0x49706d[_0xb53f('0x36')],_0x431b70[_0xb53f('0x38')]));if(_0x49706d[_0xb53f('0x36')][_0xb53f('0x42')]){_0x1edd75[_0xb53f('0x40')]=_[_0xb53f('0x43')](_0x1edd75[_0xb53f('0x40')],{'$or':_[_0xb53f('0x31')](_0x1edd75['attributes'],function(_0x35d8de){var _0x155562={};_0x155562[_0x35d8de]={'$like':'%'+_0x49706d['query']['filter']+'%'};return _0x155562;})});}_0x1edd75=_[_0xb53f('0x43')]({},_0x1edd75,_0x49706d['options']);return _0x50672e[_0xb53f('0x67')](_0x1edd75);}})[_0xb53f('0x2b')](function(_0xef8012){if(_0xef8012){_0x43036c=_0xef8012[_0xb53f('0x4d')];if(!_0x49706d['query'][_0xb53f('0x3c')]('nolimit')){_0x1edd75[_0xb53f('0x23')]=qs[_0xb53f('0x23')](_0x49706d[_0xb53f('0x36')][_0xb53f('0x23')]);_0x1edd75[_0xb53f('0x21')]=qs[_0xb53f('0x21')](_0x49706d[_0xb53f('0x36')][_0xb53f('0x21')]);}return _0x50672e[_0xb53f('0x67')](_0x1edd75);}})[_0xb53f('0x2b')](function(_0x2483ad){if(_0x2483ad){return _0x2483ad?{'count':_0x43036c,'rows':_0x2483ad}:null;}})[_0xb53f('0x2b')](respondWithResult(_0x1aae49,null))['catch'](handleError(_0x1aae49,null));};exports['addLists']=function(_0x28df97,_0x28e85b,_0x18d26d){var _0x1ddb0a,_0x1e2ea7;return db[_0xb53f('0x32')][_0xb53f('0x4e')]({'where':{'id':_0x28df97['params']['id']}})[_0xb53f('0x2b')](handleEntityNotFound(_0x28e85b,null))[_0xb53f('0x2b')](function(_0x287278){if(_0x287278){_0x1e2ea7=_0x287278;return _0x287278[_0xb53f('0x69')](_0x28df97[_0xb53f('0x50')]['ids'],_[_0xb53f('0x58')](_0x28df97[_0xb53f('0x50')],[_0xb53f('0x6a'),'id'])||{});}return null;})[_0xb53f('0x6b')](function(_0x22239f){var _0x5ef379;_0x1ddb0a=_0x22239f||[];var _0x896b53=[];if(_0x22239f){for(var _0x375cb2=0x0;_0x375cb2<_0x22239f[_0xb53f('0x4d')];_0x375cb2+=0x1){var _0x5e7d67=_0x22239f[_0x375cb2][_0xb53f('0x52')]({'plain':!![]});_0x1e2ea7['dialCheckDuplicateType']=_0x28df97['body'][_0xb53f('0x6c')]?_0x28df97[_0xb53f('0x50')][_0xb53f('0x6c')]:_0x1e2ea7[_0xb53f('0x6c')];switch(_0x1e2ea7[_0xb53f('0x6c')]){case _0xb53f('0x6d'):_0x5ef379=squel[_0xb53f('0x6e')]()[_0xb53f('0x6f')](_0xb53f('0x70'))[_0xb53f('0x71')]([_0xb53f('0x72'),_0xb53f('0x73'),_0xb53f('0x74'),_0xb53f('0x75'),_0xb53f('0x61'),_0xb53f('0x5a'),'updatedAt'],squel[_0xb53f('0x76')]()['field'](_0xb53f('0x72'),_0xb53f('0x72'))[_0xb53f('0x77')](_0xb53f('0x78'),'scheduledAt')[_0xb53f('0x77')]('id',_0xb53f('0x74'))[_0xb53f('0x77')](_0x5e7d67[_0xb53f('0x79')][_0xb53f('0x7a')](),_0xb53f('0x75'))['field'](_0x28df97[_0xb53f('0x4b')]['id'][_0xb53f('0x7a')](),_0xb53f('0x61'))[_0xb53f('0x77')](_0xb53f('0x78'),_0xb53f('0x5a'))[_0xb53f('0x77')](_0xb53f('0x78'),_0xb53f('0x59'))[_0xb53f('0x7b')]('cm_contacts')[_0xb53f('0x40')](_0xb53f('0x7c'))['where'](_0xb53f('0x7d'),_0x5e7d67[_0xb53f('0x79')]['toString']())[_0xb53f('0x40')](_0xb53f('0x7e'))['where'](_0xb53f('0x7f'),squel['select']()[_0xb53f('0x77')](_0xb53f('0x80'))[_0xb53f('0x7b')](_0xb53f('0x81'))['where'](_0xb53f('0x82'),_0x28df97[_0xb53f('0x4b')]['id'][_0xb53f('0x7a')]()))[_0xb53f('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0xb53f('0x76')]()['field'](_0xb53f('0x83'))[_0xb53f('0x7b')](_0xb53f('0x70'))[_0xb53f('0x40')]('CampaignId\x20=\x20?',_0x28df97[_0xb53f('0x4b')]['id'][_0xb53f('0x7a')]())))['toString']();break;case _0xb53f('0x84'):_0x5ef379=squel['insert']()[_0xb53f('0x6f')](_0xb53f('0x70'))[_0xb53f('0x71')]([_0xb53f('0x72'),_0xb53f('0x73'),_0xb53f('0x74'),_0xb53f('0x75'),_0xb53f('0x61'),'createdAt',_0xb53f('0x59')],squel[_0xb53f('0x76')]()[_0xb53f('0x77')](_0xb53f('0x72'),'phone')[_0xb53f('0x77')](_0xb53f('0x78'),_0xb53f('0x73'))[_0xb53f('0x77')]('id',_0xb53f('0x74'))[_0xb53f('0x77')](_0x5e7d67['CmListId'][_0xb53f('0x7a')](),_0xb53f('0x75'))['field'](_0x28df97[_0xb53f('0x4b')]['id'][_0xb53f('0x7a')](),'CampaignId')[_0xb53f('0x77')](_0xb53f('0x78'),_0xb53f('0x5a'))['field']('NOW()',_0xb53f('0x59'))[_0xb53f('0x7b')]('cm_contacts')[_0xb53f('0x40')](_0xb53f('0x7c'))['where'](_0xb53f('0x7d'),_0x5e7d67[_0xb53f('0x79')][_0xb53f('0x7a')]())[_0xb53f('0x40')](_0xb53f('0x7e'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xb53f('0x76')]()['field']('COALESCE(phone,\x27\x27)')[_0xb53f('0x7b')](_0xb53f('0x70'))['where'](_0xb53f('0x82'),_0x28df97[_0xb53f('0x4b')]['id'][_0xb53f('0x7a')]())))['toString']();break;default:_0x5ef379=squel['insert']()[_0xb53f('0x6f')](_0xb53f('0x70'))['fromQuery']([_0xb53f('0x72'),_0xb53f('0x73'),_0xb53f('0x74'),_0xb53f('0x75'),_0xb53f('0x61'),_0xb53f('0x5a'),_0xb53f('0x59')],squel[_0xb53f('0x76')]()[_0xb53f('0x77')](_0xb53f('0x72'),'phone')['field'](_0xb53f('0x78'),_0xb53f('0x73'))[_0xb53f('0x77')]('id',_0xb53f('0x74'))[_0xb53f('0x77')](_0x5e7d67[_0xb53f('0x79')][_0xb53f('0x7a')](),_0xb53f('0x75'))[_0xb53f('0x77')](_0x28df97[_0xb53f('0x4b')]['id'][_0xb53f('0x7a')](),_0xb53f('0x61'))[_0xb53f('0x77')](_0xb53f('0x78'),_0xb53f('0x5a'))[_0xb53f('0x77')](_0xb53f('0x78'),_0xb53f('0x59'))['from'](_0xb53f('0x85'))[_0xb53f('0x40')](_0xb53f('0x7c'))[_0xb53f('0x40')]('ListId\x20=\x20?',_0x5e7d67[_0xb53f('0x79')][_0xb53f('0x7a')]())[_0xb53f('0x40')](_0xb53f('0x7e')))[_0xb53f('0x7a')]();}_0x896b53[_0xb53f('0x86')](db[_0xb53f('0x87')][_0xb53f('0x36')](_0x5ef379));}return BPromise['all'](_0x896b53);}})['then'](function(){return _0x1ddb0a;})[_0xb53f('0x2b')](respondWithResult(_0x28e85b,null))['catch'](handleError(_0x28e85b,null));};exports[_0xb53f('0x88')]=function(_0x544144,_0xd4cfd2,_0x4f7e43){return db[_0xb53f('0x32')][_0xb53f('0x4e')]({'where':{'id':_0x544144[_0xb53f('0x4b')]['id']}})[_0xb53f('0x2b')](handleEntityNotFound(_0xd4cfd2,null))['then'](function(_0x2460c7){if(_0x2460c7){return _0x2460c7['removeLists'](_0x544144[_0xb53f('0x36')][_0xb53f('0x6a')]);}})[_0xb53f('0x2b')](function(_0x41ff7d){if(_0x41ff7d){return db[_0xb53f('0x60')]['destroy']({'where':{'ListId':_0x544144['query']['ids'],'CampaignId':_0x544144[_0xb53f('0x4b')]['id']}})[_0xb53f('0x2b')](function(){return _0x41ff7d;});}})['then'](respondWithStatusCode(_0xd4cfd2,null))['catch'](handleError(_0xd4cfd2,null));};exports[_0xb53f('0x89')]=function(_0x35c752,_0x8e0bdf,_0x1d6847){var _0x3b4dac={};var _0x1ca6fe={};var _0x44fbb4;var _0x34acb6;return db[_0xb53f('0x32')]['findOne']({'where':{'id':_0x35c752[_0xb53f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x8e0bdf,null))[_0xb53f('0x2b')](function(_0x42f5ce){if(_0x42f5ce){_0x44fbb4=_0x42f5ce;_0x1ca6fe[_0xb53f('0x35')]=_[_0xb53f('0x37')](db[_0xb53f('0x68')][_0xb53f('0x4c')]);_0x1ca6fe['query']=_['keys'](_0x35c752[_0xb53f('0x36')]);_0x1ca6fe['filters']=_[_0xb53f('0x39')](_0x1ca6fe[_0xb53f('0x35')],_0x1ca6fe['query']);_0x3b4dac[_0xb53f('0x3b')]=_['intersection'](_0x1ca6fe[_0xb53f('0x35')],qs[_0xb53f('0x3a')](_0x35c752[_0xb53f('0x36')][_0xb53f('0x3a')]));_0x3b4dac['attributes']=_0x3b4dac[_0xb53f('0x3b')][_0xb53f('0x4d')]?_0x3b4dac[_0xb53f('0x3b')]:_0x1ca6fe['model'];_0x3b4dac['order']=qs[_0xb53f('0x3f')](_0x35c752[_0xb53f('0x36')]['sort']);_0x3b4dac['where']=qs[_0xb53f('0x38')](_['pick'](_0x35c752[_0xb53f('0x36')],_0x1ca6fe[_0xb53f('0x38')]));if(_0x35c752[_0xb53f('0x36')][_0xb53f('0x42')]){_0x3b4dac['where']=_[_0xb53f('0x43')](_0x3b4dac[_0xb53f('0x40')],{'$or':_[_0xb53f('0x31')](_0x3b4dac[_0xb53f('0x3b')],function(_0x2497e3){var _0x1052d5={};_0x1052d5[_0x2497e3]={'$like':'%'+_0x35c752[_0xb53f('0x36')]['filter']+'%'};return _0x1052d5;})});}_0x3b4dac=_[_0xb53f('0x43')]({},_0x3b4dac,_0x35c752['options']);return _0x44fbb4[_0xb53f('0x89')](_0x3b4dac);}})['then'](function(_0xa95323){if(_0xa95323){_0x34acb6=_0xa95323[_0xb53f('0x4d')];if(!_0x35c752[_0xb53f('0x36')]['hasOwnProperty'](_0xb53f('0x3d'))){_0x3b4dac[_0xb53f('0x23')]=qs[_0xb53f('0x23')](_0x35c752['query']['limit']);_0x3b4dac[_0xb53f('0x21')]=qs[_0xb53f('0x21')](_0x35c752[_0xb53f('0x36')][_0xb53f('0x21')]);}return _0x44fbb4[_0xb53f('0x89')](_0x3b4dac);}})['then'](function(_0x378ace){if(_0x378ace){return _0x378ace?{'count':_0x34acb6,'rows':_0x378ace}:null;}})['then'](respondWithResult(_0x8e0bdf,null))[_0xb53f('0x49')](handleError(_0x8e0bdf,null));};exports[_0xb53f('0x8a')]=function(_0x3e88c3,_0x2cc85f,_0x59b615){var _0x1ab7eb,_0x3b91ce;return db[_0xb53f('0x32')][_0xb53f('0x4e')]({'where':{'id':_0x3e88c3[_0xb53f('0x4b')]['id']}})[_0xb53f('0x2b')](handleEntityNotFound(_0x2cc85f,null))['then'](function(_0x133c47){if(_0x133c47){_0x3b91ce=_0x133c47;return _0x133c47[_0xb53f('0x8a')](_0x3e88c3[_0xb53f('0x50')][_0xb53f('0x6a')],_[_0xb53f('0x58')](_0x3e88c3[_0xb53f('0x50')],[_0xb53f('0x6a'),'id'])||{});}return null;})[_0xb53f('0x6b')](function(_0x12a4e7){var _0x1838b9;_0x1ab7eb=_0x12a4e7||[];var _0x2542e4=[];if(_0x12a4e7){for(var _0x2e147c=0x0;_0x2e147c<_0x12a4e7[_0xb53f('0x4d')];_0x2e147c+=0x1){var _0x484e73=_0x12a4e7[_0x2e147c][_0xb53f('0x52')]({'plain':!![]});_0x1838b9=squel[_0xb53f('0x6e')]()[_0xb53f('0x6f')](_0xb53f('0x8b'))[_0xb53f('0x71')]([_0xb53f('0x72'),_0xb53f('0x74'),_0xb53f('0x75'),'CampaignId',_0xb53f('0x5a'),_0xb53f('0x59')],squel[_0xb53f('0x76')]()['field'](_0xb53f('0x72'),_0xb53f('0x72'))['field']('id',_0xb53f('0x74'))['field'](_0x484e73[_0xb53f('0x79')][_0xb53f('0x7a')](),_0xb53f('0x75'))[_0xb53f('0x77')](_0x3e88c3['params']['id'][_0xb53f('0x7a')](),_0xb53f('0x61'))[_0xb53f('0x77')](_0xb53f('0x78'),_0xb53f('0x5a'))[_0xb53f('0x77')](_0xb53f('0x78'),_0xb53f('0x59'))[_0xb53f('0x7b')](_0xb53f('0x85'))[_0xb53f('0x40')](_0xb53f('0x7c'))[_0xb53f('0x40')](_0xb53f('0x7d'),_0x484e73[_0xb53f('0x79')]['toString']())['where']('phone\x20IS\x20NOT\x20NULL'))[_0xb53f('0x7a')]();_0x2542e4['push'](db[_0xb53f('0x87')][_0xb53f('0x36')](_0x1838b9));}return BPromise[_0xb53f('0x8c')](_0x2542e4);}})['then'](function(){return _0x1ab7eb;})['then'](respondWithResult(_0x2cc85f,null))['catch'](handleError(_0x2cc85f,null));};exports[_0xb53f('0x8d')]=function(_0x2c9787,_0x108c83,_0x494538){return db[_0xb53f('0x32')][_0xb53f('0x4e')]({'where':{'id':_0x2c9787[_0xb53f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x108c83,null))[_0xb53f('0x2b')](function(_0x4e6da9){if(_0x4e6da9){return _0x4e6da9['removeBlackLists'](_0x2c9787[_0xb53f('0x36')][_0xb53f('0x6a')]);}})[_0xb53f('0x2b')](function(_0x24e14b){if(_0x24e14b){return db[_0xb53f('0x66')]['destroy']({'where':{'ListId':_0x2c9787[_0xb53f('0x36')][_0xb53f('0x6a')],'CampaignId':_0x2c9787[_0xb53f('0x4b')]['id']}})[_0xb53f('0x2b')](function(){return _0x24e14b;});}})[_0xb53f('0x2b')](respondWithStatusCode(_0x108c83,null))[_0xb53f('0x49')](handleError(_0x108c83,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index d97db0f..ae624ea 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(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x2fe457,_0x1c58d6){var _0x40dac7=function(_0x29839b){while(--_0x29839b){_0x2fe457['push'](_0x2fe457['shift']());}};_0x40dac7(++_0x1c58d6);}(_0x7a54,0x106));var _0x47a5=function(_0x132b80,_0x5d1fa7){_0x132b80=_0x132b80-0x0;var _0x23b2cf=_0x7a54[_0x132b80];return _0x23b2cf;};'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 9fe1161..cb5b41d 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 _0xb18e=['attributes','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetCampaign','Campaign','findAll','options','raw','where','limit','include','map','model'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xb18e,0x181));var _0xeb18=function(_0x385eb1,_0x497a94){_0x385eb1=_0x385eb1-0x0;var _0x5d40eb=_0xb18e[_0x385eb1];return _0x5d40eb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xeb18('0x0'));var BPromise=require('bluebird');var rs=require(_0xeb18('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeb18('0x2'))['db'];var utils=require(_0xeb18('0x3'));var logger=require('../../config/logger')(_0xeb18('0x4'));var config=require(_0xeb18('0x5'));var jayson=require(_0xeb18('0x6'));var client=jayson[_0xeb18('0x7')][_0xeb18('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x183bdf,_0x4a9ddd,_0x1bc3ee){return new BPromise(function(_0x131389,_0x534358){return client[_0xeb18('0x9')](_0x183bdf,_0x1bc3ee)[_0xeb18('0xa')](function(_0x942945){logger[_0xeb18('0xb')](_0xeb18('0xc'),_0x4a9ddd,_0xeb18('0xd'));logger[_0xeb18('0xe')](_0xeb18('0xf'),_0x4a9ddd,_0xeb18('0xd'),JSON[_0xeb18('0x10')](_0x942945));if(_0x942945['error']){if(_0x942945[_0xeb18('0x11')][_0xeb18('0x12')]===0x1f4){logger['error'](_0xeb18('0xc'),_0x4a9ddd,_0x942945['error']['message']);return _0x534358(_0x942945[_0xeb18('0x11')][_0xeb18('0x13')]);}logger[_0xeb18('0x11')]('Campaign,\x20%s,\x20%s',_0x4a9ddd,_0x942945['error'][_0xeb18('0x13')]);return _0x131389(_0x942945[_0xeb18('0x11')]['message']);}else{logger[_0xeb18('0xb')](_0xeb18('0xc'),_0x4a9ddd,_0xeb18('0xd'));_0x131389(_0x942945['result'][_0xeb18('0x13')]);}})[_0xeb18('0x14')](function(_0x318043){logger[_0xeb18('0x11')](_0xeb18('0xc'),_0x4a9ddd,_0x318043);_0x534358(_0x318043);});});}exports[_0xeb18('0x15')]=function(_0x284733){var _0x5bc586=this;return new Promise(function(_0x30f706,_0x5c4adc){return db[_0xeb18('0x16')][_0xeb18('0x17')]({'raw':_0x284733[_0xeb18('0x18')]?_0x284733[_0xeb18('0x18')][_0xeb18('0x19')]===undefined?!![]:![]:!![],'where':_0x284733['options']?_0x284733[_0xeb18('0x18')][_0xeb18('0x1a')]||null:null,'attributes':_0x284733[_0xeb18('0x18')]?_0x284733[_0xeb18('0x18')]['attributes']||null:null,'limit':_0x284733[_0xeb18('0x18')]?_0x284733[_0xeb18('0x18')][_0xeb18('0x1b')]||null:null,'include':_0x284733[_0xeb18('0x18')]?_0x284733[_0xeb18('0x18')][_0xeb18('0x1c')]?_[_0xeb18('0x1d')](_0x284733[_0xeb18('0x18')][_0xeb18('0x1c')],function(_0x7464fd){return{'model':db[_0x7464fd[_0xeb18('0x1e')]],'as':_0x7464fd['as'],'attributes':_0x7464fd[_0xeb18('0x1f')],'include':_0x7464fd['include']?_[_0xeb18('0x1d')](_0x7464fd['include'],function(_0x51867f){return{'model':db[_0x51867f[_0xeb18('0x1e')]],'as':_0x51867f['as'],'attributes':_0x51867f[_0xeb18('0x1f')],'include':_0x51867f[_0xeb18('0x1c')]?_[_0xeb18('0x1d')](_0x51867f[_0xeb18('0x1c')],function(_0x48d10b){return{'model':db[_0x48d10b['model']],'as':_0x48d10b['as'],'attributes':_0x48d10b[_0xeb18('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xeb18('0xa')](function(_0x3312d8){logger['info'](_0xeb18('0x15'),_0x284733);logger[_0xeb18('0xe')]('GetCampaign',_0x284733,JSON[_0xeb18('0x10')](_0x3312d8));_0x30f706(_0x3312d8);})['catch'](function(_0x54e62b){logger['error']('GetCampaign',_0x54e62b['message'],_0x284733);_0x5c4adc(_0x5bc586[_0xeb18('0x11')](0x1f4,_0x54e62b[_0xeb18('0x13')]));});});}; \ No newline at end of file +var _0x3dd5=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Campaign','options','attributes','limit','map','model','include','GetCampaign','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3dd5,0x73));var _0x53dd=function(_0x372974,_0x3faaaf){_0x372974=_0x372974-0x0;var _0x47f05=_0x3dd5[_0x372974];return _0x47f05;};'use strict';var _=require(_0x53dd('0x0'));var util=require('util');var moment=require(_0x53dd('0x1'));var BPromise=require(_0x53dd('0x2'));var rs=require(_0x53dd('0x3'));var fs=require('fs');var Redis=require(_0x53dd('0x4'));var db=require(_0x53dd('0x5'))['db'];var utils=require(_0x53dd('0x6'));var logger=require(_0x53dd('0x7'))(_0x53dd('0x8'));var config=require(_0x53dd('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x53dd('0xa')][_0x53dd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37e012,_0x264e7b,_0x4d3132){return new BPromise(function(_0x561ded,_0x3e1512){return client['request'](_0x37e012,_0x4d3132)[_0x53dd('0xc')](function(_0x1f9ce3){logger[_0x53dd('0xd')](_0x53dd('0xe'),_0x264e7b,_0x53dd('0xf'));logger['debug'](_0x53dd('0x10'),_0x264e7b,_0x53dd('0xf'),JSON[_0x53dd('0x11')](_0x1f9ce3));if(_0x1f9ce3[_0x53dd('0x12')]){if(_0x1f9ce3['error']['code']===0x1f4){logger[_0x53dd('0x12')](_0x53dd('0xe'),_0x264e7b,_0x1f9ce3[_0x53dd('0x12')]['message']);return _0x3e1512(_0x1f9ce3[_0x53dd('0x12')][_0x53dd('0x13')]);}logger[_0x53dd('0x12')]('Campaign,\x20%s,\x20%s',_0x264e7b,_0x1f9ce3[_0x53dd('0x12')][_0x53dd('0x13')]);return _0x561ded(_0x1f9ce3[_0x53dd('0x12')]['message']);}else{logger['info']('Campaign,\x20%s,\x20%s',_0x264e7b,'request\x20sent');_0x561ded(_0x1f9ce3[_0x53dd('0x14')][_0x53dd('0x13')]);}})[_0x53dd('0x15')](function(_0x30052e){logger[_0x53dd('0x12')]('Campaign,\x20%s,\x20%s',_0x264e7b,_0x30052e);_0x3e1512(_0x30052e);});});}exports['GetCampaign']=function(_0x45765e){var _0x193c99=this;return new Promise(function(_0x350d03,_0x464eb8){return db[_0x53dd('0x16')]['findAll']({'raw':_0x45765e['options']?_0x45765e['options']['raw']===undefined?!![]:![]:!![],'where':_0x45765e['options']?_0x45765e[_0x53dd('0x17')]['where']||null:null,'attributes':_0x45765e['options']?_0x45765e[_0x53dd('0x17')][_0x53dd('0x18')]||null:null,'limit':_0x45765e[_0x53dd('0x17')]?_0x45765e[_0x53dd('0x17')][_0x53dd('0x19')]||null:null,'include':_0x45765e['options']?_0x45765e[_0x53dd('0x17')]['include']?_[_0x53dd('0x1a')](_0x45765e[_0x53dd('0x17')]['include'],function(_0x42e72e){return{'model':db[_0x42e72e[_0x53dd('0x1b')]],'as':_0x42e72e['as'],'attributes':_0x42e72e['attributes'],'include':_0x42e72e[_0x53dd('0x1c')]?_['map'](_0x42e72e[_0x53dd('0x1c')],function(_0x3506cc){return{'model':db[_0x3506cc[_0x53dd('0x1b')]],'as':_0x3506cc['as'],'attributes':_0x3506cc[_0x53dd('0x18')],'include':_0x3506cc[_0x53dd('0x1c')]?_[_0x53dd('0x1a')](_0x3506cc[_0x53dd('0x1c')],function(_0x1c6d36){return{'model':db[_0x1c6d36[_0x53dd('0x1b')]],'as':_0x1c6d36['as'],'attributes':_0x1c6d36[_0x53dd('0x18')]};}):[]};}):[]};}):[]:[]})[_0x53dd('0xc')](function(_0x57c3e9){logger[_0x53dd('0xd')]('GetCampaign',_0x45765e);logger['debug'](_0x53dd('0x1d'),_0x45765e,JSON[_0x53dd('0x11')](_0x57c3e9));_0x350d03(_0x57c3e9);})['catch'](function(_0x24403d){logger['error'](_0x53dd('0x1d'),_0x24403d[_0x53dd('0x13')],_0x45765e);_0x464eb8(_0x193c99['error'](0x1f4,_0x24403d[_0x53dd('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 76d04d6..ed31728 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 _0xc770=['exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','index','isAuthenticated','/:id/hoppers','/:id/hopper_histories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/blacklists','getBlackLists','create','/:id/clone','/:id/lists','addBlackLists','put','update','delete','destroy','removeLists','removeBlackLists'];(function(_0x169877,_0x282159){var _0x220d3d=function(_0x34b6b2){while(--_0x34b6b2){_0x169877['push'](_0x169877['shift']());}};_0x220d3d(++_0x282159);}(_0xc770,0xd3));var _0x0c77=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc770[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0c77('0x0'));var util=require(_0x0c77('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0c77('0x2'));var router=express[_0x0c77('0x3')]();var fs_extra=require(_0x0c77('0x4'));var auth=require(_0x0c77('0x5'));var interaction=require(_0x0c77('0x6'));var config=require(_0x0c77('0x7'));var controller=require(_0x0c77('0x8'));router[_0x0c77('0x9')]('/',auth['isAuthenticated'](),controller[_0x0c77('0xa')]);router[_0x0c77('0x9')]('/:id',auth[_0x0c77('0xb')](),controller['show']);router[_0x0c77('0x9')](_0x0c77('0xc'),auth[_0x0c77('0xb')](),controller['getHoppers']);router[_0x0c77('0x9')](_0x0c77('0xd'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0x0c77('0x9')]('/:id/hopper_finals',auth[_0x0c77('0xb')](),controller[_0x0c77('0xe')]);router['get'](_0x0c77('0xf'),auth[_0x0c77('0xb')](),controller[_0x0c77('0x10')]);router[_0x0c77('0x9')]('/:id/lists',auth['isAuthenticated'](),controller['getLists']);router[_0x0c77('0x9')](_0x0c77('0x11'),auth[_0x0c77('0xb')](),controller[_0x0c77('0x12')]);router['post']('/',auth[_0x0c77('0xb')](),controller[_0x0c77('0x13')]);router['post'](_0x0c77('0x14'),auth[_0x0c77('0xb')](),controller['clone']);router['post'](_0x0c77('0x15'),auth[_0x0c77('0xb')](),controller['addLists']);router['post'](_0x0c77('0x11'),auth[_0x0c77('0xb')](),controller[_0x0c77('0x16')]);router[_0x0c77('0x17')]('/:id',auth[_0x0c77('0xb')](),controller[_0x0c77('0x18')]);router[_0x0c77('0x19')]('/:id',auth[_0x0c77('0xb')](),controller[_0x0c77('0x1a')]);router['delete']('/:id/lists',auth['isAuthenticated'](),controller[_0x0c77('0x1b')]);router[_0x0c77('0x19')](_0x0c77('0x11'),auth[_0x0c77('0xb')](),controller[_0x0c77('0x1c')]);module[_0x0c77('0x1d')]=router; \ No newline at end of file +var _0x3678=['../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','/:id/hopper_black','/:id/lists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','addLists','addBlackLists','put','delete','destroy','removeLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x54e14b,_0x4476a1){var _0x129ae0=function(_0x504426){while(--_0x504426){_0x54e14b['push'](_0x54e14b['shift']());}};_0x129ae0(++_0x4476a1);}(_0x3678,0x81));var _0x8367=function(_0x1aa049,_0x9ae13c){_0x1aa049=_0x1aa049-0x0;var _0x357f29=_0x3678[_0x1aa049];return _0x357f29;};'use strict';var multer=require(_0x8367('0x0'));var util=require(_0x8367('0x1'));var path=require(_0x8367('0x2'));var timeout=require(_0x8367('0x3'));var express=require(_0x8367('0x4'));var router=express[_0x8367('0x5')]();var fs_extra=require(_0x8367('0x6'));var auth=require(_0x8367('0x7'));var interaction=require(_0x8367('0x8'));var config=require(_0x8367('0x9'));var controller=require(_0x8367('0xa'));router[_0x8367('0xb')]('/',auth[_0x8367('0xc')](),controller[_0x8367('0xd')]);router[_0x8367('0xb')](_0x8367('0xe'),auth['isAuthenticated'](),controller[_0x8367('0xf')]);router[_0x8367('0xb')](_0x8367('0x10'),auth[_0x8367('0xc')](),controller[_0x8367('0x11')]);router[_0x8367('0xb')](_0x8367('0x12'),auth[_0x8367('0xc')](),controller['getHopperHistories']);router[_0x8367('0xb')](_0x8367('0x13'),auth[_0x8367('0xc')](),controller['getHopperFinals']);router[_0x8367('0xb')](_0x8367('0x14'),auth[_0x8367('0xc')](),controller['getHopperBlacks']);router[_0x8367('0xb')](_0x8367('0x15'),auth['isAuthenticated'](),controller['getLists']);router[_0x8367('0xb')](_0x8367('0x16'),auth['isAuthenticated'](),controller[_0x8367('0x17')]);router[_0x8367('0x18')]('/',auth[_0x8367('0xc')](),controller['create']);router['post'](_0x8367('0x19'),auth[_0x8367('0xc')](),controller[_0x8367('0x1a')]);router[_0x8367('0x18')](_0x8367('0x15'),auth[_0x8367('0xc')](),controller[_0x8367('0x1b')]);router[_0x8367('0x18')](_0x8367('0x16'),auth[_0x8367('0xc')](),controller[_0x8367('0x1c')]);router[_0x8367('0x1d')](_0x8367('0xe'),auth[_0x8367('0xc')](),controller['update']);router[_0x8367('0x1e')](_0x8367('0xe'),auth['isAuthenticated'](),controller[_0x8367('0x1f')]);router[_0x8367('0x1e')](_0x8367('0x15'),auth[_0x8367('0xc')](),controller[_0x8367('0x20')]);router[_0x8367('0x1e')]('/:id/blacklists',auth[_0x8367('0xc')](),controller['removeBlackLists']);module[_0x8367('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 c414e21..f738d3a 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 _0xd87a=['exports','STRING','TEXT','VIRTUAL','getDataValue','key','sequelize'];(function(_0x4de86b,_0x5eb642){var _0x306c57=function(_0x20ab50){while(--_0x20ab50){_0x4de86b['push'](_0x4de86b['shift']());}};_0x306c57(++_0x5eb642);}(_0xd87a,0x8b));var _0xad87=function(_0x1663ae,_0x10484a){_0x1663ae=_0x1663ae-0x0;var _0x30ffb8=_0xd87a[_0x1663ae];return _0x30ffb8;};'use strict';var Sequelize=require(_0xad87('0x0'));module[_0xad87('0x1')]={'key':{'type':Sequelize[_0xad87('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xad87('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0xad87('0x2')]},'name':{'type':Sequelize[_0xad87('0x4')],'get':function(){return this[_0xad87('0x5')](_0xad87('0x6'));}}}; \ No newline at end of file +var _0xfb58=['TEXT','getDataValue','key','sequelize','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfb58,0x19b));var _0x8fb5=function(_0x404b7a,_0xe3a16c){_0x404b7a=_0x404b7a-0x0;var _0x35a076=_0xfb58[_0x404b7a];return _0x35a076;};'use strict';var Sequelize=require(_0x8fb5('0x0'));module[_0x8fb5('0x1')]={'key':{'type':Sequelize[_0x8fb5('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x8fb5('0x3')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x8fb5('0x4')](_0x8fb5('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 73d46be..a19aa50 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 _0x91df=['stack','name','send','map','CannedAnswer','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','params','find','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','limit','undefined','count','offset','apply','save','update','then','destroy','get','CannedAnswers','end','sendStatus','error'];(function(_0xf501f3,_0x29979a){var _0x390b76=function(_0x4369b7){while(--_0x4369b7){_0xf501f3['push'](_0xf501f3['shift']());}};_0x390b76(++_0x29979a);}(_0x91df,0x132));var _0xf91d=function(_0x3fbe58,_0x264f56){_0x3fbe58=_0x3fbe58-0x0;var _0x459187=_0x91df[_0x3fbe58];return _0x459187;};'use strict';var emlformat=require(_0xf91d('0x0'));var rimraf=require(_0xf91d('0x1'));var zipdir=require(_0xf91d('0x2'));var jsonpatch=require(_0xf91d('0x3'));var rp=require('request-promise');var moment=require(_0xf91d('0x4'));var BPromise=require(_0xf91d('0x5'));var Mustache=require(_0xf91d('0x6'));var util=require(_0xf91d('0x7'));var path=require('path');var sox=require(_0xf91d('0x8'));var csv=require(_0xf91d('0x9'));var ejs=require(_0xf91d('0xa'));var fs=require('fs');var fs_extra=require(_0xf91d('0xb'));var _=require('lodash');var squel=require(_0xf91d('0xc'));var crypto=require(_0xf91d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf91d('0xe'));var toCsv=require(_0xf91d('0x9'));var querystring=require(_0xf91d('0xf'));var Papa=require(_0xf91d('0x10'));var Redis=require('ioredis');var authService=require(_0xf91d('0x11'));var qs=require(_0xf91d('0x12'));var as=require(_0xf91d('0x13'));var hardwareService=require(_0xf91d('0x14'));var logger=require(_0xf91d('0x15'))(_0xf91d('0x16'));var utils=require('../../config/utils');var config=require(_0xf91d('0x17'));var licenseUtil=require(_0xf91d('0x18'));var db=require(_0xf91d('0x19'))['db'];function respondWithStatusCode(_0x33084b,_0x47986e){_0x47986e=_0x47986e||0xcc;return function(_0x169791){if(_0x169791){return _0x33084b['sendStatus'](_0x47986e);}return _0x33084b[_0xf91d('0x1a')](_0x47986e)['end']();};}function respondWithResult(_0x57ca28,_0xe6afd1){_0xe6afd1=_0xe6afd1||0xc8;return function(_0x4cbb8d){if(_0x4cbb8d){return _0x57ca28['status'](_0xe6afd1)[_0xf91d('0x1b')](_0x4cbb8d);}};}function respondWithFilteredResult(_0x15c651,_0x1c1976){return function(_0x1c0610){if(_0x1c0610){var _0x190e69=typeof _0x1c1976['offset']==='undefined'&&typeof _0x1c1976[_0xf91d('0x1c')]===_0xf91d('0x1d');var _0x2acd16=_0x1c0610[_0xf91d('0x1e')];var _0x55de53=_0x190e69?0x0:_0x1c1976[_0xf91d('0x1f')];var _0x57b6e6=_0x190e69?_0x1c0610[_0xf91d('0x1e')]:_0x1c1976['offset']+_0x1c1976[_0xf91d('0x1c')];var _0x4f422a;if(_0x57b6e6>=_0x2acd16){_0x57b6e6=_0x2acd16;_0x4f422a=0xc8;}else{_0x4f422a=0xce;}_0x15c651[_0xf91d('0x1a')](_0x4f422a);return _0x15c651['set']('Content-Range',_0x55de53+'-'+_0x57b6e6+'/'+_0x2acd16)['json'](_0x1c0610);}return null;};}function patchUpdates(_0x24e211){return function(_0x43eec7){try{jsonpatch[_0xf91d('0x20')](_0x43eec7,_0x24e211,!![]);}catch(_0x2ca2c9){return BPromise['reject'](_0x2ca2c9);}return _0x43eec7[_0xf91d('0x21')]();};}function saveUpdates(_0x1fbf62,_0x46c284){return function(_0x83b660){if(_0x83b660){return _0x83b660[_0xf91d('0x22')](_0x1fbf62)[_0xf91d('0x23')](function(_0x3411db){return _0x3411db;});}return null;};}function removeEntity(_0x275a7a,_0x1338f2){return function(_0x1408d0){if(_0x1408d0){return _0x1408d0[_0xf91d('0x24')]()[_0xf91d('0x23')](function(){var _0x46c869=_0x1408d0[_0xf91d('0x25')]({'plain':!![]});var _0x3a57c3=_0xf91d('0x26');return db['UserProfileResource'][_0xf91d('0x24')]({'where':{'type':_0x3a57c3,'resourceId':_0x46c869['id']}})['then'](function(){return _0x1408d0;});})[_0xf91d('0x23')](function(){_0x275a7a[_0xf91d('0x1a')](0xcc)[_0xf91d('0x27')]();});}};}function handleEntityNotFound(_0x264307,_0xa55d1){return function(_0x581470){if(!_0x581470){_0x264307[_0xf91d('0x28')](0x194);}return _0x581470;};}function handleError(_0x11260f,_0x44a756){_0x44a756=_0x44a756||0x1f4;return function(_0x5738c4){logger[_0xf91d('0x29')](_0x5738c4[_0xf91d('0x2a')]);if(_0x5738c4[_0xf91d('0x2b')]){delete _0x5738c4['name'];}_0x11260f[_0xf91d('0x1a')](_0x44a756)[_0xf91d('0x2c')](_0x5738c4);};}exports['index']=function(_0xb59615,_0x39a1bc){var _0x3dfdf3={},_0x5ab102={},_0x57c1d8={'count':0x0,'rows':[]};var _0x41e94b=_[_0xf91d('0x2d')](db[_0xf91d('0x2e')][_0xf91d('0x2f')],function(_0x5a4c3f){return{'name':_0x5a4c3f[_0xf91d('0x30')],'type':_0x5a4c3f['type'][_0xf91d('0x31')]};});_0x5ab102[_0xf91d('0x32')]=_[_0xf91d('0x2d')](_0x41e94b,_0xf91d('0x2b'));_0x5ab102[_0xf91d('0x33')]=_[_0xf91d('0x34')](_0xb59615[_0xf91d('0x33')]);_0x5ab102[_0xf91d('0x35')]=_[_0xf91d('0x36')](_0x5ab102['model'],_0x5ab102[_0xf91d('0x33')]);_0x3dfdf3[_0xf91d('0x37')]=_[_0xf91d('0x36')](_0x5ab102[_0xf91d('0x32')],qs[_0xf91d('0x38')](_0xb59615[_0xf91d('0x33')][_0xf91d('0x38')]));_0x3dfdf3[_0xf91d('0x37')]=_0x3dfdf3['attributes'][_0xf91d('0x39')]?_0x3dfdf3[_0xf91d('0x37')]:_0x5ab102[_0xf91d('0x32')];if(!_0xb59615[_0xf91d('0x33')][_0xf91d('0x3a')](_0xf91d('0x3b'))){_0x3dfdf3[_0xf91d('0x1c')]=qs[_0xf91d('0x1c')](_0xb59615[_0xf91d('0x33')][_0xf91d('0x1c')]);_0x3dfdf3[_0xf91d('0x1f')]=qs['offset'](_0xb59615[_0xf91d('0x33')][_0xf91d('0x1f')]);}_0x3dfdf3[_0xf91d('0x3c')]=qs[_0xf91d('0x3d')](_0xb59615[_0xf91d('0x33')]['sort']);_0x3dfdf3[_0xf91d('0x3e')]=qs['filters'](_[_0xf91d('0x3f')](_0xb59615[_0xf91d('0x33')],_0x5ab102['filters']),_0x41e94b);if(_0xb59615['query']['filter']){_0x3dfdf3['where']=_[_0xf91d('0x40')](_0x3dfdf3[_0xf91d('0x3e')],{'$or':[{'key':{'$like':'%'+_0xb59615[_0xf91d('0x33')]['filter']+'%'}},{'value':{'$like':'%'+_0xb59615[_0xf91d('0x33')][_0xf91d('0x41')]+'%'}}]});}_0x3dfdf3=_[_0xf91d('0x40')]({},_0x3dfdf3,_0xb59615[_0xf91d('0x42')]);var _0x4002b0={'where':_0x3dfdf3[_0xf91d('0x3e')]};return db[_0xf91d('0x2e')][_0xf91d('0x1e')](_0x4002b0)[_0xf91d('0x23')](function(_0x17592a){_0x57c1d8[_0xf91d('0x1e')]=_0x17592a;if(_0xb59615[_0xf91d('0x33')][_0xf91d('0x43')]){_0x3dfdf3[_0xf91d('0x44')]=[{'all':!![]}];}return db['CannedAnswer'][_0xf91d('0x45')](_0x3dfdf3);})[_0xf91d('0x23')](function(_0x3044e7){_0x57c1d8[_0xf91d('0x46')]=_0x3044e7;return _0x57c1d8;})[_0xf91d('0x23')](respondWithFilteredResult(_0x39a1bc,_0x3dfdf3))[_0xf91d('0x47')](handleError(_0x39a1bc,null));};exports['show']=function(_0x3d3c11,_0x119376){var _0x1a8dca={'raw':!![],'where':{'id':_0x3d3c11[_0xf91d('0x48')]['id']}},_0x3fd697={};_0x3fd697[_0xf91d('0x32')]=_[_0xf91d('0x34')](db['CannedAnswer']['rawAttributes']);_0x3fd697[_0xf91d('0x33')]=_[_0xf91d('0x34')](_0x3d3c11[_0xf91d('0x33')]);_0x3fd697['filters']=_[_0xf91d('0x36')](_0x3fd697[_0xf91d('0x32')],_0x3fd697['query']);_0x1a8dca[_0xf91d('0x37')]=_[_0xf91d('0x36')](_0x3fd697[_0xf91d('0x32')],qs[_0xf91d('0x38')](_0x3d3c11[_0xf91d('0x33')][_0xf91d('0x38')]));_0x1a8dca[_0xf91d('0x37')]=_0x1a8dca[_0xf91d('0x37')][_0xf91d('0x39')]?_0x1a8dca[_0xf91d('0x37')]:_0x3fd697[_0xf91d('0x32')];if(_0x3d3c11[_0xf91d('0x33')]['includeAll']){_0x1a8dca[_0xf91d('0x44')]=[{'all':!![]}];}_0x1a8dca=_[_0xf91d('0x40')]({},_0x1a8dca,_0x3d3c11[_0xf91d('0x42')]);return db['CannedAnswer'][_0xf91d('0x49')](_0x1a8dca)[_0xf91d('0x23')](handleEntityNotFound(_0x119376,null))[_0xf91d('0x23')](respondWithResult(_0x119376,null))['catch'](handleError(_0x119376,null));};exports['update']=function(_0x7eefca,_0x13f3b6){if(_0x7eefca['body']['id']){delete _0x7eefca[_0xf91d('0x4a')]['id'];}return db[_0xf91d('0x2e')]['find']({'where':{'id':_0x7eefca['params']['id']}})['then'](handleEntityNotFound(_0x13f3b6,null))['then'](saveUpdates(_0x7eefca[_0xf91d('0x4a')],null))['then'](respondWithResult(_0x13f3b6,null))[_0xf91d('0x47')](handleError(_0x13f3b6,null));};exports[_0xf91d('0x24')]=function(_0xca0820,_0x2e3a9f){return db[_0xf91d('0x2e')][_0xf91d('0x49')]({'where':{'id':_0xca0820[_0xf91d('0x48')]['id']}})[_0xf91d('0x23')](handleEntityNotFound(_0x2e3a9f,null))['then'](removeEntity(_0x2e3a9f,null))[_0xf91d('0x47')](handleError(_0x2e3a9f,null));};exports['create']=function(_0x2de373,_0x431424){var _0x3d8518={'key':_0x2de373[_0xf91d('0x4a')][_0xf91d('0x31')]};if(_0x2de373[_0xf91d('0x4a')]['MailAccountId']){_0x3d8518['MailAccountId']=_0x2de373[_0xf91d('0x4a')][_0xf91d('0x4b')];}else if(_0x2de373['body'][_0xf91d('0x4c')]){_0x3d8518[_0xf91d('0x4c')]=_0x2de373[_0xf91d('0x4a')][_0xf91d('0x4c')];}else if(_0x2de373[_0xf91d('0x4a')][_0xf91d('0x4d')]){_0x3d8518[_0xf91d('0x4d')]=_0x2de373['body'][_0xf91d('0x4d')];}else if(_0x2de373['body'][_0xf91d('0x4e')]){_0x3d8518[_0xf91d('0x4e')]=_0x2de373[_0xf91d('0x4a')][_0xf91d('0x4e')];}return db[_0xf91d('0x2e')][_0xf91d('0x49')]({'where':_0x3d8518})[_0xf91d('0x23')](function(_0x406f02){if(_0x406f02){throw new db[(_0xf91d('0x4f'))]['ValidationError'](_0xf91d('0x50'));}return db[_0xf91d('0x2e')][_0xf91d('0x51')](_0x2de373[_0xf91d('0x4a')]);})[_0xf91d('0x23')](function(_0xcd4d01){var _0x3a5109=_0x2de373[_0xf91d('0x52')][_0xf91d('0x25')]({'plain':!![]});if(!_0x3a5109)throw new Error(_0xf91d('0x53'));if(_0x3a5109[_0xf91d('0x54')]===_0xf91d('0x52')){var _0x20fc57=_0xcd4d01[_0xf91d('0x25')]({'plain':!![]});return db[_0xf91d('0x55')][_0xf91d('0x49')]({'where':{'name':'CannedAnswers','userProfileId':_0x3a5109[_0xf91d('0x56')]},'raw':!![]})[_0xf91d('0x23')](function(_0x5a8e02){if(_0x5a8e02&&_0x5a8e02['autoAssociation']===0x0){return db['UserProfileResource'][_0xf91d('0x51')]({'name':_0x20fc57['name'],'resourceId':_0x20fc57['id'],'type':_0x5a8e02[_0xf91d('0x2b')],'sectionId':_0x5a8e02['id']},{})[_0xf91d('0x23')](function(){return _0xcd4d01;});}else{return _0xcd4d01;}})['catch'](function(_0x2b4dc1){logger[_0xf91d('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b4dc1);throw _0x2b4dc1;});}return _0xcd4d01;})['then'](respondWithResult(_0x431424,0xc9))['catch'](handleError(_0x431424,null));}; \ No newline at end of file +var _0x4c21=['CannedAnswer','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','CannedAnswers','UserProfileResource','error','stack','name','index'];(function(_0x1fd0c2,_0xc20d9b){var _0x57ccaa=function(_0xfe186d){while(--_0xfe186d){_0x1fd0c2['push'](_0x1fd0c2['shift']());}};_0x57ccaa(++_0xc20d9b);}(_0x4c21,0x88));var _0x14c2=function(_0x65c0bb,_0x82e7b8){_0x65c0bb=_0x65c0bb-0x0;var _0x320bd5=_0x4c21[_0x65c0bb];return _0x320bd5;};'use strict';var emlformat=require(_0x14c2('0x0'));var rimraf=require(_0x14c2('0x1'));var zipdir=require(_0x14c2('0x2'));var jsonpatch=require(_0x14c2('0x3'));var rp=require(_0x14c2('0x4'));var moment=require(_0x14c2('0x5'));var BPromise=require(_0x14c2('0x6'));var Mustache=require(_0x14c2('0x7'));var util=require(_0x14c2('0x8'));var path=require('path');var sox=require(_0x14c2('0x9'));var csv=require('to-csv');var ejs=require(_0x14c2('0xa'));var fs=require('fs');var fs_extra=require(_0x14c2('0xb'));var _=require(_0x14c2('0xc'));var squel=require(_0x14c2('0xd'));var crypto=require('crypto');var jsforce=require(_0x14c2('0xe'));var deskjs=require(_0x14c2('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x14c2('0x10'));var Redis=require(_0x14c2('0x11'));var authService=require(_0x14c2('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x14c2('0x13'));var logger=require(_0x14c2('0x14'))(_0x14c2('0x15'));var utils=require(_0x14c2('0x16'));var config=require(_0x14c2('0x17'));var licenseUtil=require(_0x14c2('0x18'));var db=require(_0x14c2('0x19'))['db'];function respondWithStatusCode(_0x46b7c6,_0x247b8d){_0x247b8d=_0x247b8d||0xcc;return function(_0x2c8506){if(_0x2c8506){return _0x46b7c6[_0x14c2('0x1a')](_0x247b8d);}return _0x46b7c6[_0x14c2('0x1b')](_0x247b8d)[_0x14c2('0x1c')]();};}function respondWithResult(_0x2a75a2,_0x240b2c){_0x240b2c=_0x240b2c||0xc8;return function(_0x3ab0d8){if(_0x3ab0d8){return _0x2a75a2[_0x14c2('0x1b')](_0x240b2c)[_0x14c2('0x1d')](_0x3ab0d8);}};}function respondWithFilteredResult(_0x2e9215,_0x593b67){return function(_0x47c1ae){if(_0x47c1ae){var _0x2e562d=typeof _0x593b67['offset']==='undefined'&&typeof _0x593b67[_0x14c2('0x1e')]==='undefined';var _0x3e6512=_0x47c1ae[_0x14c2('0x1f')];var _0x2621a0=_0x2e562d?0x0:_0x593b67[_0x14c2('0x20')];var _0x2e7590=_0x2e562d?_0x47c1ae['count']:_0x593b67[_0x14c2('0x20')]+_0x593b67['limit'];var _0x54915e;if(_0x2e7590>=_0x3e6512){_0x2e7590=_0x3e6512;_0x54915e=0xc8;}else{_0x54915e=0xce;}_0x2e9215[_0x14c2('0x1b')](_0x54915e);return _0x2e9215['set'](_0x14c2('0x21'),_0x2621a0+'-'+_0x2e7590+'/'+_0x3e6512)[_0x14c2('0x1d')](_0x47c1ae);}return null;};}function patchUpdates(_0x5cfb0e){return function(_0x319061){try{jsonpatch[_0x14c2('0x22')](_0x319061,_0x5cfb0e,!![]);}catch(_0x2b239b){return BPromise[_0x14c2('0x23')](_0x2b239b);}return _0x319061[_0x14c2('0x24')]();};}function saveUpdates(_0x470b56,_0x3f561c){return function(_0x1f8ab9){if(_0x1f8ab9){return _0x1f8ab9[_0x14c2('0x25')](_0x470b56)[_0x14c2('0x26')](function(_0x23bebe){return _0x23bebe;});}return null;};}function removeEntity(_0x1611cf,_0x3ebb53){return function(_0x54032c){if(_0x54032c){return _0x54032c[_0x14c2('0x27')]()['then'](function(){var _0xe15fa9=_0x54032c['get']({'plain':!![]});var _0x5be4ab=_0x14c2('0x28');return db[_0x14c2('0x29')][_0x14c2('0x27')]({'where':{'type':_0x5be4ab,'resourceId':_0xe15fa9['id']}})[_0x14c2('0x26')](function(){return _0x54032c;});})[_0x14c2('0x26')](function(){_0x1611cf[_0x14c2('0x1b')](0xcc)[_0x14c2('0x1c')]();});}};}function handleEntityNotFound(_0x25144d,_0xe65e8c){return function(_0x5bd827){if(!_0x5bd827){_0x25144d[_0x14c2('0x1a')](0x194);}return _0x5bd827;};}function handleError(_0x23c834,_0xddef23){_0xddef23=_0xddef23||0x1f4;return function(_0x2c98ea){logger[_0x14c2('0x2a')](_0x2c98ea[_0x14c2('0x2b')]);if(_0x2c98ea['name']){delete _0x2c98ea[_0x14c2('0x2c')];}_0x23c834['status'](_0xddef23)['send'](_0x2c98ea);};}exports[_0x14c2('0x2d')]=function(_0x4c0bc1,_0x3fddcb){var _0x1bdb62={},_0x4e9718={},_0x3332e0={'count':0x0,'rows':[]};var _0x2dcb78=_['map'](db[_0x14c2('0x2e')]['rawAttributes'],function(_0x4fa764){return{'name':_0x4fa764[_0x14c2('0x2f')],'type':_0x4fa764[_0x14c2('0x30')][_0x14c2('0x31')]};});_0x4e9718[_0x14c2('0x32')]=_[_0x14c2('0x33')](_0x2dcb78,_0x14c2('0x2c'));_0x4e9718[_0x14c2('0x34')]=_[_0x14c2('0x35')](_0x4c0bc1['query']);_0x4e9718[_0x14c2('0x36')]=_[_0x14c2('0x37')](_0x4e9718[_0x14c2('0x32')],_0x4e9718['query']);_0x1bdb62['attributes']=_[_0x14c2('0x37')](_0x4e9718[_0x14c2('0x32')],qs[_0x14c2('0x38')](_0x4c0bc1[_0x14c2('0x34')][_0x14c2('0x38')]));_0x1bdb62[_0x14c2('0x39')]=_0x1bdb62['attributes'][_0x14c2('0x3a')]?_0x1bdb62['attributes']:_0x4e9718[_0x14c2('0x32')];if(!_0x4c0bc1[_0x14c2('0x34')][_0x14c2('0x3b')](_0x14c2('0x3c'))){_0x1bdb62[_0x14c2('0x1e')]=qs[_0x14c2('0x1e')](_0x4c0bc1['query'][_0x14c2('0x1e')]);_0x1bdb62[_0x14c2('0x20')]=qs[_0x14c2('0x20')](_0x4c0bc1[_0x14c2('0x34')][_0x14c2('0x20')]);}_0x1bdb62[_0x14c2('0x3d')]=qs['sort'](_0x4c0bc1[_0x14c2('0x34')]['sort']);_0x1bdb62[_0x14c2('0x3e')]=qs[_0x14c2('0x36')](_[_0x14c2('0x3f')](_0x4c0bc1[_0x14c2('0x34')],_0x4e9718['filters']),_0x2dcb78);if(_0x4c0bc1[_0x14c2('0x34')][_0x14c2('0x40')]){_0x1bdb62[_0x14c2('0x3e')]=_['merge'](_0x1bdb62[_0x14c2('0x3e')],{'$or':[{'key':{'$like':'%'+_0x4c0bc1['query'][_0x14c2('0x40')]+'%'}},{'value':{'$like':'%'+_0x4c0bc1['query'][_0x14c2('0x40')]+'%'}}]});}_0x1bdb62=_[_0x14c2('0x41')]({},_0x1bdb62,_0x4c0bc1[_0x14c2('0x42')]);var _0x8ce2cd={'where':_0x1bdb62[_0x14c2('0x3e')]};return db[_0x14c2('0x2e')]['count'](_0x8ce2cd)['then'](function(_0x28e59e){_0x3332e0['count']=_0x28e59e;if(_0x4c0bc1['query'][_0x14c2('0x43')]){_0x1bdb62[_0x14c2('0x44')]=[{'all':!![]}];}return db[_0x14c2('0x2e')][_0x14c2('0x45')](_0x1bdb62);})[_0x14c2('0x26')](function(_0x459ec5){_0x3332e0[_0x14c2('0x46')]=_0x459ec5;return _0x3332e0;})[_0x14c2('0x26')](respondWithFilteredResult(_0x3fddcb,_0x1bdb62))[_0x14c2('0x47')](handleError(_0x3fddcb,null));};exports[_0x14c2('0x48')]=function(_0x376358,_0x2030b5){var _0x147f20={'raw':!![],'where':{'id':_0x376358['params']['id']}},_0x2f6a06={};_0x2f6a06['model']=_[_0x14c2('0x35')](db['CannedAnswer'][_0x14c2('0x49')]);_0x2f6a06[_0x14c2('0x34')]=_[_0x14c2('0x35')](_0x376358[_0x14c2('0x34')]);_0x2f6a06[_0x14c2('0x36')]=_[_0x14c2('0x37')](_0x2f6a06[_0x14c2('0x32')],_0x2f6a06[_0x14c2('0x34')]);_0x147f20[_0x14c2('0x39')]=_['intersection'](_0x2f6a06['model'],qs[_0x14c2('0x38')](_0x376358[_0x14c2('0x34')][_0x14c2('0x38')]));_0x147f20['attributes']=_0x147f20[_0x14c2('0x39')][_0x14c2('0x3a')]?_0x147f20[_0x14c2('0x39')]:_0x2f6a06[_0x14c2('0x32')];if(_0x376358['query'][_0x14c2('0x43')]){_0x147f20[_0x14c2('0x44')]=[{'all':!![]}];}_0x147f20=_[_0x14c2('0x41')]({},_0x147f20,_0x376358[_0x14c2('0x42')]);return db[_0x14c2('0x2e')][_0x14c2('0x4a')](_0x147f20)[_0x14c2('0x26')](handleEntityNotFound(_0x2030b5,null))['then'](respondWithResult(_0x2030b5,null))[_0x14c2('0x47')](handleError(_0x2030b5,null));};exports[_0x14c2('0x25')]=function(_0xc02a6,_0x2d168e){if(_0xc02a6[_0x14c2('0x4b')]['id']){delete _0xc02a6[_0x14c2('0x4b')]['id'];}return db[_0x14c2('0x2e')][_0x14c2('0x4a')]({'where':{'id':_0xc02a6[_0x14c2('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2d168e,null))[_0x14c2('0x26')](saveUpdates(_0xc02a6[_0x14c2('0x4b')],null))[_0x14c2('0x26')](respondWithResult(_0x2d168e,null))['catch'](handleError(_0x2d168e,null));};exports['destroy']=function(_0x426abd,_0x74450d){return db[_0x14c2('0x2e')][_0x14c2('0x4a')]({'where':{'id':_0x426abd[_0x14c2('0x4c')]['id']}})['then'](handleEntityNotFound(_0x74450d,null))[_0x14c2('0x26')](removeEntity(_0x74450d,null))['catch'](handleError(_0x74450d,null));};exports[_0x14c2('0x4d')]=function(_0x535147,_0x101321){var _0x5a54cc={'key':_0x535147[_0x14c2('0x4b')][_0x14c2('0x31')]};if(_0x535147['body'][_0x14c2('0x4e')]){_0x5a54cc[_0x14c2('0x4e')]=_0x535147['body'][_0x14c2('0x4e')];}else if(_0x535147['body']['SmsAccountId']){_0x5a54cc[_0x14c2('0x4f')]=_0x535147[_0x14c2('0x4b')]['SmsAccountId'];}else if(_0x535147[_0x14c2('0x4b')][_0x14c2('0x50')]){_0x5a54cc[_0x14c2('0x50')]=_0x535147[_0x14c2('0x4b')][_0x14c2('0x50')];}else if(_0x535147[_0x14c2('0x4b')][_0x14c2('0x51')]){_0x5a54cc[_0x14c2('0x51')]=_0x535147[_0x14c2('0x4b')][_0x14c2('0x51')];}return db[_0x14c2('0x2e')][_0x14c2('0x4a')]({'where':_0x5a54cc})['then'](function(_0x67ca86){if(_0x67ca86){throw new db[(_0x14c2('0x52'))]['ValidationError'](_0x14c2('0x53'));}return db['CannedAnswer']['create'](_0x535147[_0x14c2('0x4b')]);})['then'](function(_0x399618){var _0x4b271a=_0x535147[_0x14c2('0x54')]['get']({'plain':!![]});if(!_0x4b271a)throw new Error(_0x14c2('0x55'));if(_0x4b271a[_0x14c2('0x56')]===_0x14c2('0x54')){var _0x5bb13b=_0x399618[_0x14c2('0x57')]({'plain':!![]});return db[_0x14c2('0x58')][_0x14c2('0x4a')]({'where':{'name':_0x14c2('0x28'),'userProfileId':_0x4b271a[_0x14c2('0x59')]},'raw':!![]})['then'](function(_0x263b9d){if(_0x263b9d&&_0x263b9d[_0x14c2('0x5a')]===0x0){return db['UserProfileResource'][_0x14c2('0x4d')]({'name':_0x5bb13b['name'],'resourceId':_0x5bb13b['id'],'type':_0x263b9d[_0x14c2('0x2c')],'sectionId':_0x263b9d['id']},{})[_0x14c2('0x26')](function(){return _0x399618;});}else{return _0x399618;}})[_0x14c2('0x47')](function(_0x2256bd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2256bd);throw _0x2256bd;});}return _0x399618;})[_0x14c2('0x26')](respondWithResult(_0x101321,0xc9))[_0x14c2('0x47')](handleError(_0x101321,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index f6f959f..554f24e 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 _0xf35d=['lodash','../../config/logger','moment','bluebird','path','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer'];(function(_0x3b0413,_0xd316dd){var _0x4e8dd5=function(_0x205a11){while(--_0x205a11){_0x3b0413['push'](_0x3b0413['shift']());}};_0x4e8dd5(++_0xd316dd);}(_0xf35d,0x17c));var _0xdf35=function(_0x35be98,_0x533d82){_0x35be98=_0x35be98-0x0;var _0x5e2f45=_0xf35d[_0x35be98];return _0x5e2f45;};'use strict';var _=require(_0xdf35('0x0'));var util=require('util');var logger=require(_0xdf35('0x1'))('api');var moment=require(_0xdf35('0x2'));var BPromise=require(_0xdf35('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf35('0x4'));var rimraf=require('rimraf');var config=require(_0xdf35('0x5'));var attributes=require(_0xdf35('0x6'));module[_0xdf35('0x7')]=function(_0x7cfe71,_0x41036b){return _0x7cfe71[_0xdf35('0x8')](_0xdf35('0x9'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc953=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','exports','define','CannedAnswer','tools_canned_answers'];(function(_0x4b826e,_0x33b6b){var _0x10e06c=function(_0x842a7b){while(--_0x842a7b){_0x4b826e['push'](_0x4b826e['shift']());}};_0x10e06c(++_0x33b6b);}(_0xc953,0x195));var _0x3c95=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xc953[_0x102e37];return _0x35a07c;};'use strict';var _=require(_0x3c95('0x0'));var util=require(_0x3c95('0x1'));var logger=require(_0x3c95('0x2'))(_0x3c95('0x3'));var moment=require(_0x3c95('0x4'));var BPromise=require('bluebird');var rp=require(_0x3c95('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3c95('0x6'));var attributes=require('./cannedAnswer.attributes');module[_0x3c95('0x7')]=function(_0x1fe09b,_0x31b33d){return _0x1fe09b[_0x3c95('0x8')](_0x3c95('0x9'),attributes,{'tableName':_0x3c95('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3c95('0xb'),'collate':_0x3c95('0xc')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 37be577..84e41bc 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(_0x4f097d,_0x588037){var _0x141bc3=function(_0x40ae17){while(--_0x40ae17){_0x4f097d['push'](_0x4f097d['shift']());}};_0x141bc3(++_0x588037);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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(_0x3ecd13,_0x13cc21){var _0x8b5c09=function(_0x288244){while(--_0x288244){_0x3ecd13['push'](_0x3ecd13['shift']());}};_0x8b5c09(++_0x13cc21);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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 000deb5..68ea2af 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 _0x7f26=['/:id','update','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','post','create','put'];(function(_0x255ac0,_0x3f6645){var _0x437bf1=function(_0x5baff0){while(--_0x5baff0){_0x255ac0['push'](_0x255ac0['shift']());}};_0x437bf1(++_0x3f6645);}(_0x7f26,0x1f1));var _0x67f2=function(_0x22a481,_0x512770){_0x22a481=_0x22a481-0x0;var _0x5a4a04=_0x7f26[_0x22a481];return _0x5a4a04;};'use strict';var multer=require(_0x67f2('0x0'));var util=require('util');var path=require(_0x67f2('0x1'));var timeout=require(_0x67f2('0x2'));var express=require(_0x67f2('0x3'));var router=express[_0x67f2('0x4')]();var fs_extra=require(_0x67f2('0x5'));var auth=require(_0x67f2('0x6'));var interaction=require(_0x67f2('0x7'));var config=require(_0x67f2('0x8'));var controller=require(_0x67f2('0x9'));router[_0x67f2('0xa')]('/',auth[_0x67f2('0xb')](),controller[_0x67f2('0xc')]);router[_0x67f2('0xa')]('/:id',auth[_0x67f2('0xb')](),controller['show']);router[_0x67f2('0xd')]('/',auth[_0x67f2('0xb')](),controller[_0x67f2('0xe')]);router[_0x67f2('0xf')](_0x67f2('0x10'),auth[_0x67f2('0xb')](),controller[_0x67f2('0x11')]);router['delete'](_0x67f2('0x10'),auth[_0x67f2('0xb')](),controller[_0x67f2('0x12')]);module['exports']=router; \ No newline at end of file +var _0xa458=['isAuthenticated','show','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./cannedAnswer.controller','get','index','/:id'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa458,0x195));var _0x8a45=function(_0x4fa23c,_0x120df9){_0x4fa23c=_0x4fa23c-0x0;var _0x516487=_0xa458[_0x4fa23c];return _0x516487;};'use strict';var multer=require(_0x8a45('0x0'));var util=require(_0x8a45('0x1'));var path=require(_0x8a45('0x2'));var timeout=require(_0x8a45('0x3'));var express=require('express');var router=express[_0x8a45('0x4')]();var fs_extra=require(_0x8a45('0x5'));var auth=require(_0x8a45('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8a45('0x7'));router[_0x8a45('0x8')]('/',auth['isAuthenticated'](),controller[_0x8a45('0x9')]);router['get'](_0x8a45('0xa'),auth[_0x8a45('0xb')](),controller[_0x8a45('0xc')]);router['post']('/',auth[_0x8a45('0xb')](),controller['create']);router['put']('/:id',auth[_0x8a45('0xb')](),controller[_0x8a45('0xd')]);router[_0x8a45('0xe')](_0x8a45('0xa'),auth[_0x8a45('0xb')](),controller[_0x8a45('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 52978ac..ea78381 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 _0xe74e=['INTEGER','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x26db6a,_0x3cff3c){var _0x5ac65f=function(_0x2f4e1e){while(--_0x2f4e1e){_0x26db6a['push'](_0x26db6a['shift']());}};_0x5ac65f(++_0x3cff3c);}(_0xe74e,0x10a));var _0xee74=function(_0x291e6a,_0x94ec18){_0x291e6a=_0x291e6a-0x0;var _0x579e40=_0xe74e[_0x291e6a];return _0x579e40;};'use strict';var Sequelize=require('sequelize');module[_0xee74('0x0')]={'calldate':{'type':Sequelize[_0xee74('0x1')],'allowNull':![],'defaultValue':_0xee74('0x2')},'clid':{'type':Sequelize[_0xee74('0x3')]},'src':{'type':Sequelize[_0xee74('0x3')]},'dst':{'type':Sequelize[_0xee74('0x3')]},'dcontext':{'type':Sequelize[_0xee74('0x3')]},'channel':{'type':Sequelize[_0xee74('0x3')]},'dstchannel':{'type':Sequelize[_0xee74('0x3')]},'lastapp':{'type':Sequelize[_0xee74('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xee74('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xee74('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xee74('0x3')]},'uniqueid':{'type':Sequelize[_0xee74('0x3')]},'linkedid':{'type':Sequelize[_0xee74('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xee74('0x3')]},'tag':{'type':Sequelize[_0xee74('0x3')]}}; \ No newline at end of file +var _0x61ea=['INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x1000a5,_0x238386){var _0x4d3077=function(_0x5dcce6){while(--_0x5dcce6){_0x1000a5['push'](_0x1000a5['shift']());}};_0x4d3077(++_0x238386);}(_0x61ea,0x1d5));var _0xa61e=function(_0x3cb09c,_0x43849e){_0x3cb09c=_0x3cb09c-0x0;var _0x2be7cc=_0x61ea[_0x3cb09c];return _0x2be7cc;};'use strict';var Sequelize=require(_0xa61e('0x0'));module[_0xa61e('0x1')]={'calldate':{'type':Sequelize[_0xa61e('0x2')],'allowNull':![],'defaultValue':_0xa61e('0x3')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0xa61e('0x4')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xa61e('0x4')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0xa61e('0x4')]},'lastdata':{'type':Sequelize[_0xa61e('0x4')]},'duration':{'type':Sequelize[_0xa61e('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xa61e('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xa61e('0x4')]},'amaflags':{'type':Sequelize[_0xa61e('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xa61e('0x4')]},'userfield':{'type':Sequelize[_0xa61e('0x4')]},'uniqueid':{'type':Sequelize[_0xa61e('0x4')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa61e('0x4')]},'tag':{'type':Sequelize[_0xa61e('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 5eb877d..8593a87 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 _0x1af3=['../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x77b86d,_0x200223){var _0x4e84b0=function(_0x7fc3f3){while(--_0x7fc3f3){_0x77b86d['push'](_0x77b86d['shift']());}};_0x4e84b0(++_0x200223);}(_0x1af3,0x1ca));var _0x31af=function(_0xf34b0a,_0x11e116){_0xf34b0a=_0xf34b0a-0x0;var _0x5021e1=_0x1af3[_0xf34b0a];return _0x5021e1;};'use strict';var emlformat=require(_0x31af('0x0'));var rimraf=require(_0x31af('0x1'));var zipdir=require(_0x31af('0x2'));var jsonpatch=require(_0x31af('0x3'));var rp=require(_0x31af('0x4'));var moment=require(_0x31af('0x5'));var BPromise=require(_0x31af('0x6'));var Mustache=require(_0x31af('0x7'));var util=require(_0x31af('0x8'));var path=require(_0x31af('0x9'));var sox=require('sox');var csv=require(_0x31af('0xa'));var ejs=require(_0x31af('0xb'));var fs=require('fs');var fs_extra=require(_0x31af('0xc'));var _=require(_0x31af('0xd'));var squel=require('squel');var crypto=require(_0x31af('0xe'));var jsforce=require(_0x31af('0xf'));var deskjs=require(_0x31af('0x10'));var toCsv=require('to-csv');var querystring=require(_0x31af('0x11'));var Papa=require(_0x31af('0x12'));var Redis=require(_0x31af('0x13'));var authService=require(_0x31af('0x14'));var qs=require(_0x31af('0x15'));var as=require(_0x31af('0x16'));var hardwareService=require(_0x31af('0x17'));var logger=require(_0x31af('0x18'))('api');var utils=require(_0x31af('0x19'));var config=require(_0x31af('0x1a'));var licenseUtil=require(_0x31af('0x1b'));var db=require(_0x31af('0x1c'))['db'];function respondWithStatusCode(_0x144406,_0x481f20){_0x481f20=_0x481f20||0xcc;return function(_0x358fb4){if(_0x358fb4){return _0x144406[_0x31af('0x1d')](_0x481f20);}return _0x144406['status'](_0x481f20)['end']();};}function respondWithResult(_0x2a4727,_0x46a494){_0x46a494=_0x46a494||0xc8;return function(_0x14c57e){if(_0x14c57e){return _0x2a4727[_0x31af('0x1e')](_0x46a494)[_0x31af('0x1f')](_0x14c57e);}};}function respondWithFilteredResult(_0x1d35fa,_0x369934){return function(_0x37c275){if(_0x37c275){var _0xd431e4=typeof _0x369934[_0x31af('0x20')]===_0x31af('0x21')&&typeof _0x369934['limit']===_0x31af('0x21');var _0xd33b3f=_0x37c275[_0x31af('0x22')];var _0x477ada=_0xd431e4?0x0:_0x369934[_0x31af('0x20')];var _0x30a112=_0xd431e4?_0x37c275[_0x31af('0x22')]:_0x369934[_0x31af('0x20')]+_0x369934[_0x31af('0x23')];var _0x550870;if(_0x30a112>=_0xd33b3f){_0x30a112=_0xd33b3f;_0x550870=0xc8;}else{_0x550870=0xce;}_0x1d35fa[_0x31af('0x1e')](_0x550870);return _0x1d35fa[_0x31af('0x24')](_0x31af('0x25'),_0x477ada+'-'+_0x30a112+'/'+_0xd33b3f)[_0x31af('0x1f')](_0x37c275);}return null;};}function patchUpdates(_0x414ad8){return function(_0x5d96ca){try{jsonpatch[_0x31af('0x26')](_0x5d96ca,_0x414ad8,!![]);}catch(_0x46b03e){return BPromise[_0x31af('0x27')](_0x46b03e);}return _0x5d96ca[_0x31af('0x28')]();};}function saveUpdates(_0x394d13,_0x14c3f9){return function(_0x1ddfba){if(_0x1ddfba){return _0x1ddfba[_0x31af('0x29')](_0x394d13)[_0x31af('0x2a')](function(_0x6634e3){return _0x6634e3;});}return null;};}function removeEntity(_0x40aa32,_0x1a67e3){return function(_0x3a98d3){if(_0x3a98d3){return _0x3a98d3[_0x31af('0x2b')]()[_0x31af('0x2a')](function(){_0x40aa32['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d3832,_0x20a50c){return function(_0x2b3bad){if(!_0x2b3bad){_0x5d3832['sendStatus'](0x194);}return _0x2b3bad;};}function handleError(_0x4c958,_0x8f9f60){_0x8f9f60=_0x8f9f60||0x1f4;return function(_0x49812a){logger[_0x31af('0x2c')](_0x49812a[_0x31af('0x2d')]);if(_0x49812a['name']){delete _0x49812a[_0x31af('0x2e')];}_0x4c958[_0x31af('0x1e')](_0x8f9f60)[_0x31af('0x2f')](_0x49812a);};}exports[_0x31af('0x30')]=function(_0x3326a7,_0x5a1f41){var _0xb1f5b1={},_0x3eb61f={},_0x1e6df8={'count':0x0,'rows':[]};var _0x1f4eae=_[_0x31af('0x31')](db[_0x31af('0x32')][_0x31af('0x33')],function(_0x231438){return{'name':_0x231438[_0x31af('0x34')],'type':_0x231438[_0x31af('0x35')][_0x31af('0x36')]};});_0x3eb61f[_0x31af('0x37')]=_['map'](_0x1f4eae,_0x31af('0x2e'));_0x3eb61f[_0x31af('0x38')]=_['keys'](_0x3326a7['query']);_0x3eb61f['filters']=_[_0x31af('0x39')](_0x3eb61f['model'],_0x3eb61f[_0x31af('0x38')]);_0xb1f5b1[_0x31af('0x3a')]=_[_0x31af('0x39')](_0x3eb61f[_0x31af('0x37')],qs[_0x31af('0x3b')](_0x3326a7[_0x31af('0x38')]['fields']));_0xb1f5b1[_0x31af('0x3a')]=_0xb1f5b1[_0x31af('0x3a')][_0x31af('0x3c')]?_0xb1f5b1[_0x31af('0x3a')]:_0x3eb61f[_0x31af('0x37')];if(!_0x3326a7[_0x31af('0x38')][_0x31af('0x3d')](_0x31af('0x3e'))){_0xb1f5b1['limit']=qs[_0x31af('0x23')](_0x3326a7['query'][_0x31af('0x23')]);_0xb1f5b1[_0x31af('0x20')]=qs[_0x31af('0x20')](_0x3326a7[_0x31af('0x38')][_0x31af('0x20')]);}_0xb1f5b1['order']=qs['sort'](_0x3326a7['query'][_0x31af('0x3f')]);_0xb1f5b1[_0x31af('0x40')]=qs[_0x31af('0x41')](_[_0x31af('0x42')](_0x3326a7[_0x31af('0x38')],_0x3eb61f[_0x31af('0x41')]),_0x1f4eae);if(_0x3326a7[_0x31af('0x38')][_0x31af('0x43')]){_0xb1f5b1['where']=_[_0x31af('0x44')](_0xb1f5b1[_0x31af('0x40')],{'$or':_[_0x31af('0x31')](_0x1f4eae,function(_0x2a5cde){if(_0x2a5cde[_0x31af('0x35')]!==_0x31af('0x45')){var _0x32d1b9={};_0x32d1b9[_0x2a5cde[_0x31af('0x2e')]]={'$like':'%'+_0x3326a7[_0x31af('0x38')]['filter']+'%'};return _0x32d1b9;}})});}_0xb1f5b1=_[_0x31af('0x44')]({},_0xb1f5b1,_0x3326a7['options']);var _0x447a01={'where':_0xb1f5b1['where']};return db['Cdr'][_0x31af('0x22')](_0x447a01)[_0x31af('0x2a')](function(_0x110f38){_0x1e6df8[_0x31af('0x22')]=_0x110f38;if(_0x3326a7[_0x31af('0x38')][_0x31af('0x46')]){_0xb1f5b1[_0x31af('0x47')]=[{'all':!![]}];}return db['Cdr'][_0x31af('0x48')](_0xb1f5b1);})[_0x31af('0x2a')](function(_0xb53565){_0x1e6df8['rows']=_0xb53565;return _0x1e6df8;})[_0x31af('0x2a')](respondWithFilteredResult(_0x5a1f41,_0xb1f5b1))[_0x31af('0x49')](handleError(_0x5a1f41,null));};exports[_0x31af('0x4a')]=function(_0x23942b,_0x34205a){var _0x57da2c={'raw':!![],'where':{'id':_0x23942b[_0x31af('0x4b')]['id']}},_0x12357c={};_0x12357c[_0x31af('0x37')]=_[_0x31af('0x4c')](db['Cdr'][_0x31af('0x33')]);_0x12357c[_0x31af('0x38')]=_['keys'](_0x23942b[_0x31af('0x38')]);_0x12357c[_0x31af('0x41')]=_[_0x31af('0x39')](_0x12357c[_0x31af('0x37')],_0x12357c[_0x31af('0x38')]);_0x57da2c[_0x31af('0x3a')]=_[_0x31af('0x39')](_0x12357c[_0x31af('0x37')],qs[_0x31af('0x3b')](_0x23942b[_0x31af('0x38')]['fields']));_0x57da2c['attributes']=_0x57da2c[_0x31af('0x3a')]['length']?_0x57da2c[_0x31af('0x3a')]:_0x12357c[_0x31af('0x37')];if(_0x23942b[_0x31af('0x38')]['includeAll']){_0x57da2c['include']=[{'all':!![]}];}_0x57da2c=_[_0x31af('0x44')]({},_0x57da2c,_0x23942b['options']);return db[_0x31af('0x32')][_0x31af('0x4d')](_0x57da2c)[_0x31af('0x2a')](handleEntityNotFound(_0x34205a,null))[_0x31af('0x2a')](respondWithResult(_0x34205a,null))['catch'](handleError(_0x34205a,null));};exports['create']=function(_0x407386,_0x3acff1){return db[_0x31af('0x32')][_0x31af('0x4e')](_0x407386['body'],{})[_0x31af('0x2a')](respondWithResult(_0x3acff1,0xc9))[_0x31af('0x49')](handleError(_0x3acff1,null));};exports[_0x31af('0x29')]=function(_0x4ad7a6,_0x5a1cbe){if(_0x4ad7a6[_0x31af('0x4f')]['id']){delete _0x4ad7a6[_0x31af('0x4f')]['id'];}return db[_0x31af('0x32')][_0x31af('0x4d')]({'where':{'id':_0x4ad7a6[_0x31af('0x4b')]['id']}})[_0x31af('0x2a')](handleEntityNotFound(_0x5a1cbe,null))[_0x31af('0x2a')](saveUpdates(_0x4ad7a6[_0x31af('0x4f')],null))[_0x31af('0x2a')](respondWithResult(_0x5a1cbe,null))[_0x31af('0x49')](handleError(_0x5a1cbe,null));};exports['destroy']=function(_0x441362,_0x29de7e){return db[_0x31af('0x32')][_0x31af('0x4d')]({'where':{'id':_0x441362[_0x31af('0x4b')]['id']}})[_0x31af('0x2a')](handleEntityNotFound(_0x29de7e,null))[_0x31af('0x2a')](removeEntity(_0x29de7e,null))[_0x31af('0x49')](handleError(_0x29de7e,null));};exports[_0x31af('0x50')]=function(_0x25369b,_0x3bfbae){return db[_0x31af('0x32')][_0x31af('0x50')]()[_0x31af('0x2a')](respondWithResult(_0x3bfbae,null))['catch'](handleError(_0x3bfbae,null));}; \ No newline at end of file +var _0x8ce1=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','error','send','index','Cdr','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','map','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x479160,_0x3ab560){var _0x47ac6d=function(_0x3f7314){while(--_0x3f7314){_0x479160['push'](_0x479160['shift']());}};_0x47ac6d(++_0x3ab560);}(_0x8ce1,0x183));var _0x18ce=function(_0x3d1c96,_0x526df2){_0x3d1c96=_0x3d1c96-0x0;var _0x17f4d9=_0x8ce1[_0x3d1c96];return _0x17f4d9;};'use strict';var emlformat=require(_0x18ce('0x0'));var rimraf=require(_0x18ce('0x1'));var zipdir=require(_0x18ce('0x2'));var jsonpatch=require(_0x18ce('0x3'));var rp=require(_0x18ce('0x4'));var moment=require(_0x18ce('0x5'));var BPromise=require(_0x18ce('0x6'));var Mustache=require(_0x18ce('0x7'));var util=require(_0x18ce('0x8'));var path=require(_0x18ce('0x9'));var sox=require(_0x18ce('0xa'));var csv=require(_0x18ce('0xb'));var ejs=require(_0x18ce('0xc'));var fs=require('fs');var fs_extra=require(_0x18ce('0xd'));var _=require(_0x18ce('0xe'));var squel=require(_0x18ce('0xf'));var crypto=require('crypto');var jsforce=require(_0x18ce('0x10'));var deskjs=require(_0x18ce('0x11'));var toCsv=require(_0x18ce('0xb'));var querystring=require(_0x18ce('0x12'));var Papa=require('papaparse');var Redis=require(_0x18ce('0x13'));var authService=require(_0x18ce('0x14'));var qs=require(_0x18ce('0x15'));var as=require(_0x18ce('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x18ce('0x17'));var utils=require(_0x18ce('0x18'));var config=require(_0x18ce('0x19'));var licenseUtil=require(_0x18ce('0x1a'));var db=require(_0x18ce('0x1b'))['db'];function respondWithStatusCode(_0x5e8c23,_0xbd514b){_0xbd514b=_0xbd514b||0xcc;return function(_0x402ba4){if(_0x402ba4){return _0x5e8c23[_0x18ce('0x1c')](_0xbd514b);}return _0x5e8c23[_0x18ce('0x1d')](_0xbd514b)[_0x18ce('0x1e')]();};}function respondWithResult(_0x5daf04,_0x176797){_0x176797=_0x176797||0xc8;return function(_0xdd4626){if(_0xdd4626){return _0x5daf04[_0x18ce('0x1d')](_0x176797)[_0x18ce('0x1f')](_0xdd4626);}};}function respondWithFilteredResult(_0x46e346,_0x36b5da){return function(_0x17460e){if(_0x17460e){var _0x4a934f=typeof _0x36b5da[_0x18ce('0x20')]===_0x18ce('0x21')&&typeof _0x36b5da[_0x18ce('0x22')]===_0x18ce('0x21');var _0x1edc10=_0x17460e[_0x18ce('0x23')];var _0x482458=_0x4a934f?0x0:_0x36b5da[_0x18ce('0x20')];var _0x29c691=_0x4a934f?_0x17460e[_0x18ce('0x23')]:_0x36b5da['offset']+_0x36b5da[_0x18ce('0x22')];var _0x2fa3d4;if(_0x29c691>=_0x1edc10){_0x29c691=_0x1edc10;_0x2fa3d4=0xc8;}else{_0x2fa3d4=0xce;}_0x46e346[_0x18ce('0x1d')](_0x2fa3d4);return _0x46e346['set'](_0x18ce('0x24'),_0x482458+'-'+_0x29c691+'/'+_0x1edc10)[_0x18ce('0x1f')](_0x17460e);}return null;};}function patchUpdates(_0x5d22cd){return function(_0x29c1ab){try{jsonpatch[_0x18ce('0x25')](_0x29c1ab,_0x5d22cd,!![]);}catch(_0x16802e){return BPromise[_0x18ce('0x26')](_0x16802e);}return _0x29c1ab[_0x18ce('0x27')]();};}function saveUpdates(_0xd41f29,_0x35abf9){return function(_0x545459){if(_0x545459){return _0x545459[_0x18ce('0x28')](_0xd41f29)['then'](function(_0x482c90){return _0x482c90;});}return null;};}function removeEntity(_0x5d2299,_0x32e910){return function(_0x576ecc){if(_0x576ecc){return _0x576ecc[_0x18ce('0x29')]()[_0x18ce('0x2a')](function(){_0x5d2299[_0x18ce('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53abbd,_0x55e17c){return function(_0x317812){if(!_0x317812){_0x53abbd[_0x18ce('0x1c')](0x194);}return _0x317812;};}function handleError(_0x12dbd2,_0x461113){_0x461113=_0x461113||0x1f4;return function(_0x62b2bd){logger[_0x18ce('0x2b')](_0x62b2bd['stack']);if(_0x62b2bd['name']){delete _0x62b2bd['name'];}_0x12dbd2[_0x18ce('0x1d')](_0x461113)[_0x18ce('0x2c')](_0x62b2bd);};}exports[_0x18ce('0x2d')]=function(_0x5f3ec2,_0x1a87f6){var _0xf2683f={},_0x1988e4={},_0x5ef96c={'count':0x0,'rows':[]};var _0x56d296=_['map'](db[_0x18ce('0x2e')][_0x18ce('0x2f')],function(_0x5c2d96){return{'name':_0x5c2d96['fieldName'],'type':_0x5c2d96[_0x18ce('0x30')][_0x18ce('0x31')]};});_0x1988e4[_0x18ce('0x32')]=_['map'](_0x56d296,'name');_0x1988e4[_0x18ce('0x33')]=_[_0x18ce('0x34')](_0x5f3ec2[_0x18ce('0x33')]);_0x1988e4[_0x18ce('0x35')]=_[_0x18ce('0x36')](_0x1988e4[_0x18ce('0x32')],_0x1988e4[_0x18ce('0x33')]);_0xf2683f[_0x18ce('0x37')]=_['intersection'](_0x1988e4['model'],qs[_0x18ce('0x38')](_0x5f3ec2[_0x18ce('0x33')]['fields']));_0xf2683f[_0x18ce('0x37')]=_0xf2683f['attributes'][_0x18ce('0x39')]?_0xf2683f['attributes']:_0x1988e4[_0x18ce('0x32')];if(!_0x5f3ec2[_0x18ce('0x33')][_0x18ce('0x3a')]('nolimit')){_0xf2683f['limit']=qs[_0x18ce('0x22')](_0x5f3ec2[_0x18ce('0x33')]['limit']);_0xf2683f['offset']=qs[_0x18ce('0x20')](_0x5f3ec2[_0x18ce('0x33')][_0x18ce('0x20')]);}_0xf2683f[_0x18ce('0x3b')]=qs[_0x18ce('0x3c')](_0x5f3ec2[_0x18ce('0x33')][_0x18ce('0x3c')]);_0xf2683f[_0x18ce('0x3d')]=qs[_0x18ce('0x35')](_[_0x18ce('0x3e')](_0x5f3ec2[_0x18ce('0x33')],_0x1988e4[_0x18ce('0x35')]),_0x56d296);if(_0x5f3ec2[_0x18ce('0x33')]['filter']){_0xf2683f[_0x18ce('0x3d')]=_[_0x18ce('0x3f')](_0xf2683f[_0x18ce('0x3d')],{'$or':_[_0x18ce('0x40')](_0x56d296,function(_0x1e67dd){if(_0x1e67dd[_0x18ce('0x30')]!==_0x18ce('0x41')){var _0x27c55a={};_0x27c55a[_0x1e67dd[_0x18ce('0x42')]]={'$like':'%'+_0x5f3ec2[_0x18ce('0x33')]['filter']+'%'};return _0x27c55a;}})});}_0xf2683f=_['merge']({},_0xf2683f,_0x5f3ec2[_0x18ce('0x43')]);var _0x23486c={'where':_0xf2683f[_0x18ce('0x3d')]};return db[_0x18ce('0x2e')][_0x18ce('0x23')](_0x23486c)[_0x18ce('0x2a')](function(_0x2eba88){_0x5ef96c['count']=_0x2eba88;if(_0x5f3ec2['query'][_0x18ce('0x44')]){_0xf2683f[_0x18ce('0x45')]=[{'all':!![]}];}return db['Cdr'][_0x18ce('0x46')](_0xf2683f);})[_0x18ce('0x2a')](function(_0x2941ce){_0x5ef96c[_0x18ce('0x47')]=_0x2941ce;return _0x5ef96c;})[_0x18ce('0x2a')](respondWithFilteredResult(_0x1a87f6,_0xf2683f))[_0x18ce('0x48')](handleError(_0x1a87f6,null));};exports[_0x18ce('0x49')]=function(_0x2a96a7,_0x33b409){var _0x1d6d5f={'raw':!![],'where':{'id':_0x2a96a7[_0x18ce('0x4a')]['id']}},_0x3885e6={};_0x3885e6['model']=_[_0x18ce('0x34')](db[_0x18ce('0x2e')][_0x18ce('0x2f')]);_0x3885e6[_0x18ce('0x33')]=_[_0x18ce('0x34')](_0x2a96a7[_0x18ce('0x33')]);_0x3885e6[_0x18ce('0x35')]=_['intersection'](_0x3885e6['model'],_0x3885e6[_0x18ce('0x33')]);_0x1d6d5f[_0x18ce('0x37')]=_[_0x18ce('0x36')](_0x3885e6[_0x18ce('0x32')],qs['fields'](_0x2a96a7[_0x18ce('0x33')][_0x18ce('0x38')]));_0x1d6d5f[_0x18ce('0x37')]=_0x1d6d5f['attributes']['length']?_0x1d6d5f[_0x18ce('0x37')]:_0x3885e6[_0x18ce('0x32')];if(_0x2a96a7['query'][_0x18ce('0x44')]){_0x1d6d5f[_0x18ce('0x45')]=[{'all':!![]}];}_0x1d6d5f=_[_0x18ce('0x3f')]({},_0x1d6d5f,_0x2a96a7[_0x18ce('0x43')]);return db[_0x18ce('0x2e')][_0x18ce('0x4b')](_0x1d6d5f)[_0x18ce('0x2a')](handleEntityNotFound(_0x33b409,null))['then'](respondWithResult(_0x33b409,null))[_0x18ce('0x48')](handleError(_0x33b409,null));};exports[_0x18ce('0x4c')]=function(_0x476c6a,_0x1e445d){return db[_0x18ce('0x2e')][_0x18ce('0x4c')](_0x476c6a[_0x18ce('0x4d')],{})[_0x18ce('0x2a')](respondWithResult(_0x1e445d,0xc9))[_0x18ce('0x48')](handleError(_0x1e445d,null));};exports[_0x18ce('0x28')]=function(_0x1211d0,_0x3f9960){if(_0x1211d0[_0x18ce('0x4d')]['id']){delete _0x1211d0[_0x18ce('0x4d')]['id'];}return db['Cdr'][_0x18ce('0x4b')]({'where':{'id':_0x1211d0[_0x18ce('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3f9960,null))[_0x18ce('0x2a')](saveUpdates(_0x1211d0['body'],null))[_0x18ce('0x2a')](respondWithResult(_0x3f9960,null))['catch'](handleError(_0x3f9960,null));};exports[_0x18ce('0x29')]=function(_0x188f57,_0x3d5b1b){return db[_0x18ce('0x2e')]['find']({'where':{'id':_0x188f57[_0x18ce('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3d5b1b,null))['then'](removeEntity(_0x3d5b1b,null))[_0x18ce('0x48')](handleError(_0x3d5b1b,null));};exports[_0x18ce('0x4e')]=function(_0x8aa4a7,_0x5f164a){return db['Cdr'][_0x18ce('0x4e')]()[_0x18ce('0x2a')](respondWithResult(_0x5f164a,null))[_0x18ce('0x48')](handleError(_0x5f164a,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 3feac5a..1e81156 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x3bc4f4,_0x1e2b47){var _0x9f4cea=function(_0x4080cb){while(--_0x4080cb){_0x3bc4f4['push'](_0x3bc4f4['shift']());}};_0x9f4cea(++_0x1e2b47);}(_0x7a54,0x106));var _0x47a5=function(_0x39ef4a,_0x5c17f4){_0x39ef4a=_0x39ef4a-0x0;var _0x2ef9b8=_0x7a54[_0x39ef4a];return _0x2ef9b8;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x271a66,_0x232cf3){var _0x500259=function(_0x3f55b1){while(--_0x3f55b1){_0x271a66['push'](_0x271a66['shift']());}};_0x500259(++_0x232cf3);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'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 38fe41d..d3715eb 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 _0x24d6=['error','message','catch','Cdr,\x20%s,\x20%s','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','stringify'];(function(_0x5affa4,_0x4ba102){var _0x4eb0f3=function(_0x274bbb){while(--_0x274bbb){_0x5affa4['push'](_0x5affa4['shift']());}};_0x4eb0f3(++_0x4ba102);}(_0x24d6,0x17e));var _0x624d=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x24d6[_0x580576];return _0x3f55a0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x624d('0x0'));var fs=require('fs');var Redis=require(_0x624d('0x1'));var db=require(_0x624d('0x2'))['db'];var utils=require(_0x624d('0x3'));var logger=require(_0x624d('0x4'))(_0x624d('0x5'));var config=require(_0x624d('0x6'));var jayson=require(_0x624d('0x7'));var client=jayson[_0x624d('0x8')][_0x624d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c8773,_0x58dc93,_0x4d5a48){return new BPromise(function(_0xe56aee,_0x20737d){return client['request'](_0x2c8773,_0x4d5a48)[_0x624d('0xa')](function(_0x55ec28){logger[_0x624d('0xb')]('Cdr,\x20%s,\x20%s',_0x58dc93,_0x624d('0xc'));logger['debug']('Cdr,\x20%s,\x20%s,\x20%s',_0x58dc93,_0x624d('0xc'),JSON[_0x624d('0xd')](_0x55ec28));if(_0x55ec28[_0x624d('0xe')]){if(_0x55ec28[_0x624d('0xe')]['code']===0x1f4){logger[_0x624d('0xe')]('Cdr,\x20%s,\x20%s',_0x58dc93,_0x55ec28[_0x624d('0xe')][_0x624d('0xf')]);return _0x20737d(_0x55ec28[_0x624d('0xe')]['message']);}logger[_0x624d('0xe')]('Cdr,\x20%s,\x20%s',_0x58dc93,_0x55ec28['error'][_0x624d('0xf')]);return _0xe56aee(_0x55ec28[_0x624d('0xe')][_0x624d('0xf')]);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x58dc93,_0x624d('0xc'));_0xe56aee(_0x55ec28['result'][_0x624d('0xf')]);}})[_0x624d('0x10')](function(_0x471e69){logger['error'](_0x624d('0x11'),_0x58dc93,_0x471e69);_0x20737d(_0x471e69);});});} \ No newline at end of file +var _0x454a=['http','request','then','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5ad07c,_0x324dcd){var _0x204bae=function(_0x1245bc){while(--_0x1245bc){_0x5ad07c['push'](_0x5ad07c['shift']());}};_0x204bae(++_0x324dcd);}(_0x454a,0xbb));var _0xa454=function(_0x2ab3b1,_0x1a4a5c){_0x2ab3b1=_0x2ab3b1-0x0;var _0x29ae68=_0x454a[_0x2ab3b1];return _0x29ae68;};'use strict';var _=require(_0xa454('0x0'));var util=require(_0xa454('0x1'));var moment=require(_0xa454('0x2'));var BPromise=require('bluebird');var rs=require(_0xa454('0x3'));var fs=require('fs');var Redis=require(_0xa454('0x4'));var db=require(_0xa454('0x5'))['db'];var utils=require(_0xa454('0x6'));var logger=require(_0xa454('0x7'))(_0xa454('0x8'));var config=require(_0xa454('0x9'));var jayson=require(_0xa454('0xa'));var client=jayson['client'][_0xa454('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4bff92,_0x2455f5,_0x219bbf){return new BPromise(function(_0x4934d0,_0x2e30ee){return client[_0xa454('0xc')](_0x4bff92,_0x219bbf)[_0xa454('0xd')](function(_0xee4f22){logger['info'](_0xa454('0xe'),_0x2455f5,'request\x20sent');logger[_0xa454('0xf')](_0xa454('0x10'),_0x2455f5,_0xa454('0x11'),JSON['stringify'](_0xee4f22));if(_0xee4f22['error']){if(_0xee4f22[_0xa454('0x12')]['code']===0x1f4){logger[_0xa454('0x12')](_0xa454('0xe'),_0x2455f5,_0xee4f22[_0xa454('0x12')][_0xa454('0x13')]);return _0x2e30ee(_0xee4f22['error']['message']);}logger[_0xa454('0x12')](_0xa454('0xe'),_0x2455f5,_0xee4f22[_0xa454('0x12')]['message']);return _0x4934d0(_0xee4f22['error'][_0xa454('0x13')]);}else{logger['info'](_0xa454('0xe'),_0x2455f5,_0xa454('0x11'));_0x4934d0(_0xee4f22[_0xa454('0x14')][_0xa454('0x13')]);}})[_0xa454('0x15')](function(_0xf861ef){logger['error'](_0xa454('0xe'),_0x2455f5,_0xf861ef);_0x2e30ee(_0xf861ef);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 161566d..40a4725 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(_0x1eed52,_0x1bb3c1){var _0x57782a=function(_0x2cb894){while(--_0x2cb894){_0x1eed52['push'](_0x1eed52['shift']());}};_0x57782a(++_0x1bb3c1);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _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(_0x53cf52,_0x3040a3){var _0xe1f7c7=function(_0x54dcf0){while(--_0x54dcf0){_0x53cf52['push'](_0x53cf52['shift']());}};_0xe1f7c7(++_0x3040a3);}(_0xb10b,0x12a));var _0xbb10=function(_0x2e30d8,_0x344b2c){_0x2e30d8=_0x2e30d8-0x0;var _0x347234=_0xb10b[_0x2e30d8];return _0x347234;};'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 254c12b..64c18d6 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 _0x2925=['noop','TEXT','*,*,*,*','exports','STRING'];(function(_0x23d075,_0x341f61){var _0x205e13=function(_0x2246b5){while(--_0x2246b5){_0x23d075['push'](_0x23d075['shift']());}};_0x205e13(++_0x341f61);}(_0x2925,0x1d9));var _0x5292=function(_0x1ebdd0,_0x346a06){_0x1ebdd0=_0x1ebdd0-0x0;var _0x38829e=_0x2925[_0x1ebdd0];return _0x38829e;};'use strict';var Sequelize=require('sequelize');module[_0x5292('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x5292('0x1')],'allowNull':![],'defaultValue':_0x5292('0x2')},'appdata':{'type':Sequelize[_0x5292('0x3')]()},'description':{'type':Sequelize[_0x5292('0x1')]},'interval':{'type':Sequelize[_0x5292('0x1')],'defaultValue':_0x5292('0x4')}}; \ No newline at end of file +var _0xc1e3=['STRING','noop','TEXT','sequelize','INTEGER'];(function(_0x249a86,_0x1a7e3c){var _0x264d34=function(_0x38f8ea){while(--_0x38f8ea){_0x249a86['push'](_0x249a86['shift']());}};_0x264d34(++_0x1a7e3c);}(_0xc1e3,0x148));var _0x3c1e=function(_0x1de6cb,_0x532a6c){_0x1de6cb=_0x1de6cb-0x0;var _0x1dd289=_0xc1e3[_0x1de6cb];return _0x1dd289;};'use strict';var Sequelize=require(_0x3c1e('0x0'));module['exports']={'priority':{'type':Sequelize[_0x3c1e('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x3c1e('0x2')],'allowNull':![],'defaultValue':_0x3c1e('0x3')},'appdata':{'type':Sequelize[_0x3c1e('0x4')]()},'description':{'type':Sequelize[_0x3c1e('0x2')]},'interval':{'type':Sequelize[_0x3c1e('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 5b62ff6..3b8f774 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 _0x4156=['options','find','body','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','stack','name','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','length','includeAll','include','merge'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0x4156,0xf1));var _0x6415=function(_0x55e007,_0xa44bac){_0x55e007=_0x55e007-0x0;var _0xe6c2a=_0x4156[_0x55e007];return _0xe6c2a;};'use strict';var emlformat=require(_0x6415('0x0'));var rimraf=require(_0x6415('0x1'));var zipdir=require(_0x6415('0x2'));var jsonpatch=require(_0x6415('0x3'));var rp=require(_0x6415('0x4'));var moment=require('moment');var BPromise=require(_0x6415('0x5'));var Mustache=require(_0x6415('0x6'));var util=require(_0x6415('0x7'));var path=require(_0x6415('0x8'));var sox=require(_0x6415('0x9'));var csv=require(_0x6415('0xa'));var ejs=require(_0x6415('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6415('0xc'));var squel=require('squel');var crypto=require(_0x6415('0xd'));var jsforce=require(_0x6415('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6415('0xa'));var querystring=require(_0x6415('0xf'));var Papa=require(_0x6415('0x10'));var Redis=require(_0x6415('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6415('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6415('0x13'))(_0x6415('0x14'));var utils=require(_0x6415('0x15'));var config=require(_0x6415('0x16'));var licenseUtil=require(_0x6415('0x17'));var db=require(_0x6415('0x18'))['db'];function respondWithStatusCode(_0x455f44,_0x596b97){_0x596b97=_0x596b97||0xcc;return function(_0x5b3493){if(_0x5b3493){return _0x455f44[_0x6415('0x19')](_0x596b97);}return _0x455f44[_0x6415('0x1a')](_0x596b97)[_0x6415('0x1b')]();};}function respondWithResult(_0xf75bec,_0x21ae74){_0x21ae74=_0x21ae74||0xc8;return function(_0x5b2a26){if(_0x5b2a26){return _0xf75bec['status'](_0x21ae74)[_0x6415('0x1c')](_0x5b2a26);}};}function respondWithFilteredResult(_0x780643,_0x48017d){return function(_0x1d540c){if(_0x1d540c){var _0x41f9b0=typeof _0x48017d['offset']==='undefined'&&typeof _0x48017d[_0x6415('0x1d')]===_0x6415('0x1e');var _0x3f739d=_0x1d540c[_0x6415('0x1f')];var _0x2ef73b=_0x41f9b0?0x0:_0x48017d[_0x6415('0x20')];var _0x2c74c6=_0x41f9b0?_0x1d540c[_0x6415('0x1f')]:_0x48017d[_0x6415('0x20')]+_0x48017d['limit'];var _0x551985;if(_0x2c74c6>=_0x3f739d){_0x2c74c6=_0x3f739d;_0x551985=0xc8;}else{_0x551985=0xce;}_0x780643['status'](_0x551985);return _0x780643[_0x6415('0x21')](_0x6415('0x22'),_0x2ef73b+'-'+_0x2c74c6+'/'+_0x3f739d)[_0x6415('0x1c')](_0x1d540c);}return null;};}function patchUpdates(_0x1e58f2){return function(_0x551632){try{jsonpatch[_0x6415('0x23')](_0x551632,_0x1e58f2,!![]);}catch(_0x3f4400){return BPromise[_0x6415('0x24')](_0x3f4400);}return _0x551632['save']();};}function saveUpdates(_0x287ac9,_0x266f97){return function(_0x7c567f){if(_0x7c567f){return _0x7c567f[_0x6415('0x25')](_0x287ac9)[_0x6415('0x26')](function(_0x3e33d3){return _0x3e33d3;});}return null;};}function removeEntity(_0x339c50,_0x41c266){return function(_0x1496c1){if(_0x1496c1){return _0x1496c1['destroy']()[_0x6415('0x26')](function(){_0x339c50[_0x6415('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15be31,_0x2b202c){return function(_0x2a936f){if(!_0x2a936f){_0x15be31[_0x6415('0x19')](0x194);}return _0x2a936f;};}function handleError(_0x31dabc,_0x5b5f39){_0x5b5f39=_0x5b5f39||0x1f4;return function(_0x30d857){logger['error'](_0x30d857[_0x6415('0x27')]);if(_0x30d857[_0x6415('0x28')]){delete _0x30d857[_0x6415('0x28')];}_0x31dabc['status'](_0x5b5f39)['send'](_0x30d857);};}exports['show']=function(_0x61e827,_0x31f717){var _0x581bc7={'raw':!![],'where':{'id':_0x61e827[_0x6415('0x29')]['id']}},_0x5bf08d={};_0x5bf08d[_0x6415('0x2a')]=_[_0x6415('0x2b')](db[_0x6415('0x2c')][_0x6415('0x2d')]);_0x5bf08d[_0x6415('0x2e')]=_['keys'](_0x61e827[_0x6415('0x2e')]);_0x5bf08d[_0x6415('0x2f')]=_[_0x6415('0x30')](_0x5bf08d[_0x6415('0x2a')],_0x5bf08d['query']);_0x581bc7['attributes']=_['intersection'](_0x5bf08d[_0x6415('0x2a')],qs['fields'](_0x61e827[_0x6415('0x2e')]['fields']));_0x581bc7[_0x6415('0x31')]=_0x581bc7[_0x6415('0x31')][_0x6415('0x32')]?_0x581bc7[_0x6415('0x31')]:_0x5bf08d['model'];if(_0x61e827['query'][_0x6415('0x33')]){_0x581bc7[_0x6415('0x34')]=[{'all':!![]}];}_0x581bc7=_[_0x6415('0x35')]({},_0x581bc7,_0x61e827[_0x6415('0x36')]);return db[_0x6415('0x2c')][_0x6415('0x37')](_0x581bc7)['then'](handleEntityNotFound(_0x31f717,null))[_0x6415('0x26')](respondWithResult(_0x31f717,null))['catch'](handleError(_0x31f717,null));};exports['update']=function(_0x4e07c6,_0x587b47){if(_0x4e07c6[_0x6415('0x38')]['id']){delete _0x4e07c6[_0x6415('0x38')]['id'];}return db[_0x6415('0x2c')]['find']({'where':{'id':_0x4e07c6[_0x6415('0x29')]['id']}})[_0x6415('0x26')](handleEntityNotFound(_0x587b47,null))['then'](saveUpdates(_0x4e07c6[_0x6415('0x38')],null))[_0x6415('0x26')](respondWithResult(_0x587b47,null))[_0x6415('0x39')](handleError(_0x587b47,null));};exports[_0x6415('0x3a')]=function(_0x248a5e,_0x59d828){return db[_0x6415('0x2c')]['find']({'where':{'id':_0x248a5e[_0x6415('0x29')]['id']}})[_0x6415('0x26')](handleEntityNotFound(_0x59d828,null))['then'](removeEntity(_0x59d828,null))[_0x6415('0x39')](handleError(_0x59d828,null));}; \ No newline at end of file +var _0xcbe1=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','set','apply','save','update','then','destroy','error','stack','name','send','show','params','keys','ChatApplication','rawAttributes','query','filters','intersection','model','attributes','fields','length','includeAll','include','find','catch','body','rimraf','bluebird','mustache','path','to-csv','ejs'];(function(_0x2e35a6,_0x5ef737){var _0x450c20=function(_0x4c68cf){while(--_0x4c68cf){_0x2e35a6['push'](_0x2e35a6['shift']());}};_0x450c20(++_0x5ef737);}(_0xcbe1,0x1a2));var _0x1cbe=function(_0x114e6a,_0x3dc9d2){_0x114e6a=_0x114e6a-0x0;var _0x423189=_0xcbe1[_0x114e6a];return _0x423189;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1cbe('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1cbe('0x1'));var Mustache=require(_0x1cbe('0x2'));var util=require('util');var path=require(_0x1cbe('0x3'));var sox=require('sox');var csv=require(_0x1cbe('0x4'));var ejs=require(_0x1cbe('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1cbe('0x6'));var squel=require(_0x1cbe('0x7'));var crypto=require(_0x1cbe('0x8'));var jsforce=require(_0x1cbe('0x9'));var deskjs=require(_0x1cbe('0xa'));var toCsv=require(_0x1cbe('0x4'));var querystring=require(_0x1cbe('0xb'));var Papa=require(_0x1cbe('0xc'));var Redis=require('ioredis');var authService=require(_0x1cbe('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x1cbe('0xe'));var hardwareService=require(_0x1cbe('0xf'));var logger=require(_0x1cbe('0x10'))(_0x1cbe('0x11'));var utils=require('../../config/utils');var config=require(_0x1cbe('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x1cbe('0x13'))['db'];function respondWithStatusCode(_0x15f8a9,_0x4959a8){_0x4959a8=_0x4959a8||0xcc;return function(_0x42da0e){if(_0x42da0e){return _0x15f8a9[_0x1cbe('0x14')](_0x4959a8);}return _0x15f8a9[_0x1cbe('0x15')](_0x4959a8)['end']();};}function respondWithResult(_0x244e61,_0x42a345){_0x42a345=_0x42a345||0xc8;return function(_0x2304c2){if(_0x2304c2){return _0x244e61[_0x1cbe('0x15')](_0x42a345)[_0x1cbe('0x16')](_0x2304c2);}};}function respondWithFilteredResult(_0x14784f,_0x3eb11f){return function(_0x25093a){if(_0x25093a){var _0x109cd7=typeof _0x3eb11f[_0x1cbe('0x17')]==='undefined'&&typeof _0x3eb11f[_0x1cbe('0x18')]===_0x1cbe('0x19');var _0x244a1d=_0x25093a['count'];var _0x1836a7=_0x109cd7?0x0:_0x3eb11f[_0x1cbe('0x17')];var _0x45268b=_0x109cd7?_0x25093a['count']:_0x3eb11f['offset']+_0x3eb11f[_0x1cbe('0x18')];var _0x75e87a;if(_0x45268b>=_0x244a1d){_0x45268b=_0x244a1d;_0x75e87a=0xc8;}else{_0x75e87a=0xce;}_0x14784f[_0x1cbe('0x15')](_0x75e87a);return _0x14784f[_0x1cbe('0x1a')]('Content-Range',_0x1836a7+'-'+_0x45268b+'/'+_0x244a1d)['json'](_0x25093a);}return null;};}function patchUpdates(_0x3f2d7d){return function(_0x3bf29c){try{jsonpatch[_0x1cbe('0x1b')](_0x3bf29c,_0x3f2d7d,!![]);}catch(_0x56f3c6){return BPromise['reject'](_0x56f3c6);}return _0x3bf29c[_0x1cbe('0x1c')]();};}function saveUpdates(_0x4aff8d,_0x33b678){return function(_0x192a76){if(_0x192a76){return _0x192a76[_0x1cbe('0x1d')](_0x4aff8d)[_0x1cbe('0x1e')](function(_0x19b93f){return _0x19b93f;});}return null;};}function removeEntity(_0x1e175b,_0x2aedba){return function(_0x23495c){if(_0x23495c){return _0x23495c[_0x1cbe('0x1f')]()['then'](function(){_0x1e175b[_0x1cbe('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fb6aa,_0x2208bd){return function(_0x384845){if(!_0x384845){_0x1fb6aa['sendStatus'](0x194);}return _0x384845;};}function handleError(_0x26a5b7,_0x17066a){_0x17066a=_0x17066a||0x1f4;return function(_0x1b391d){logger[_0x1cbe('0x20')](_0x1b391d[_0x1cbe('0x21')]);if(_0x1b391d[_0x1cbe('0x22')]){delete _0x1b391d['name'];}_0x26a5b7[_0x1cbe('0x15')](_0x17066a)[_0x1cbe('0x23')](_0x1b391d);};}exports[_0x1cbe('0x24')]=function(_0x5d781d,_0x4c840e){var _0xa30ec5={'raw':!![],'where':{'id':_0x5d781d[_0x1cbe('0x25')]['id']}},_0x52d0d5={};_0x52d0d5['model']=_[_0x1cbe('0x26')](db[_0x1cbe('0x27')][_0x1cbe('0x28')]);_0x52d0d5[_0x1cbe('0x29')]=_['keys'](_0x5d781d[_0x1cbe('0x29')]);_0x52d0d5[_0x1cbe('0x2a')]=_[_0x1cbe('0x2b')](_0x52d0d5[_0x1cbe('0x2c')],_0x52d0d5[_0x1cbe('0x29')]);_0xa30ec5[_0x1cbe('0x2d')]=_['intersection'](_0x52d0d5['model'],qs[_0x1cbe('0x2e')](_0x5d781d['query'][_0x1cbe('0x2e')]));_0xa30ec5[_0x1cbe('0x2d')]=_0xa30ec5['attributes'][_0x1cbe('0x2f')]?_0xa30ec5['attributes']:_0x52d0d5[_0x1cbe('0x2c')];if(_0x5d781d[_0x1cbe('0x29')][_0x1cbe('0x30')]){_0xa30ec5[_0x1cbe('0x31')]=[{'all':!![]}];}_0xa30ec5=_['merge']({},_0xa30ec5,_0x5d781d['options']);return db[_0x1cbe('0x27')][_0x1cbe('0x32')](_0xa30ec5)[_0x1cbe('0x1e')](handleEntityNotFound(_0x4c840e,null))[_0x1cbe('0x1e')](respondWithResult(_0x4c840e,null))[_0x1cbe('0x33')](handleError(_0x4c840e,null));};exports['update']=function(_0x431f13,_0x1602fd){if(_0x431f13['body']['id']){delete _0x431f13[_0x1cbe('0x34')]['id'];}return db[_0x1cbe('0x27')][_0x1cbe('0x32')]({'where':{'id':_0x431f13['params']['id']}})['then'](handleEntityNotFound(_0x1602fd,null))[_0x1cbe('0x1e')](saveUpdates(_0x431f13[_0x1cbe('0x34')],null))[_0x1cbe('0x1e')](respondWithResult(_0x1602fd,null))[_0x1cbe('0x33')](handleError(_0x1602fd,null));};exports[_0x1cbe('0x1f')]=function(_0x42d45b,_0x2bdc30){return db[_0x1cbe('0x27')]['find']({'where':{'id':_0x42d45b[_0x1cbe('0x25')]['id']}})['then'](handleEntityNotFound(_0x2bdc30,null))[_0x1cbe('0x1e')](removeEntity(_0x2bdc30,null))['catch'](handleError(_0x2bdc30,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 622f98a..7ef5011 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 _0xde7f=['rimraf','../../config/environment','./chatApplication.attributes','exports','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','api','bluebird','request-promise','path'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0xde7f,0xa4));var _0xfde7=function(_0x10769a,_0xfd36d2){_0x10769a=_0x10769a-0x0;var _0x176daf=_0xde7f[_0x10769a];return _0x176daf;};'use strict';var _=require(_0xfde7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfde7('0x1'));var moment=require('moment');var BPromise=require(_0xfde7('0x2'));var rp=require(_0xfde7('0x3'));var fs=require('fs');var path=require(_0xfde7('0x4'));var rimraf=require(_0xfde7('0x5'));var config=require(_0xfde7('0x6'));var attributes=require(_0xfde7('0x7'));module[_0xfde7('0x8')]=function(_0x13ffe1,_0x54edd6){return _0x13ffe1['define'](_0xfde7('0x9'),attributes,{'tableName':_0xfde7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfde7('0xb'),'collate':_0xfde7('0xc')});}; \ No newline at end of file +var _0xc7e9=['ChatApplication','chat_applications','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf','exports','define'];(function(_0x82c774,_0x518cd2){var _0x48cfaf=function(_0x1a1f81){while(--_0x1a1f81){_0x82c774['push'](_0x82c774['shift']());}};_0x48cfaf(++_0x518cd2);}(_0xc7e9,0x1ef));var _0x9c7e=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0xc7e9[_0x1a72f3];return _0x57ef47;};'use strict';var _=require(_0x9c7e('0x0'));var util=require(_0x9c7e('0x1'));var logger=require('../../config/logger')(_0x9c7e('0x2'));var moment=require(_0x9c7e('0x3'));var BPromise=require(_0x9c7e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c7e('0x5'));var rimraf=require(_0x9c7e('0x6'));var config=require('../../config/environment');var attributes=require('./chatApplication.attributes');module[_0x9c7e('0x7')]=function(_0x4e4ccc,_0x1e5135){return _0x4e4ccc[_0x9c7e('0x8')](_0x9c7e('0x9'),attributes,{'tableName':_0x9c7e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9c7e('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index f523e4f..0b429d4 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 _0x5780=['../../config/environment','jayson/promise','client','http','request','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc'];(function(_0x5620c1,_0x18a353){var _0x91169c=function(_0x4121c4){while(--_0x4121c4){_0x5620c1['push'](_0x5620c1['shift']());}};_0x91169c(++_0x18a353);}(_0x5780,0x9a));var _0x0578=function(_0x240ddc,_0x13f4b6){_0x240ddc=_0x240ddc-0x0;var _0x35464=_0x5780[_0x240ddc];return _0x35464;};'use strict';var _=require(_0x0578('0x0'));var util=require(_0x0578('0x1'));var moment=require(_0x0578('0x2'));var BPromise=require(_0x0578('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0578('0x4'));var logger=require(_0x0578('0x5'))(_0x0578('0x6'));var config=require(_0x0578('0x7'));var jayson=require(_0x0578('0x8'));var client=jayson[_0x0578('0x9')][_0x0578('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a61c6,_0x3114a1,_0x1ec9ac){return new BPromise(function(_0x21a2fe,_0x534bb3){return client[_0x0578('0xb')](_0x5a61c6,_0x1ec9ac)['then'](function(_0x303ad1){logger[_0x0578('0xc')](_0x0578('0xd'),_0x3114a1,_0x0578('0xe'));logger[_0x0578('0xf')](_0x0578('0x10'),_0x3114a1,_0x0578('0xe'),JSON[_0x0578('0x11')](_0x303ad1));if(_0x303ad1[_0x0578('0x12')]){if(_0x303ad1[_0x0578('0x12')][_0x0578('0x13')]===0x1f4){logger['error'](_0x0578('0xd'),_0x3114a1,_0x303ad1[_0x0578('0x12')][_0x0578('0x14')]);return _0x534bb3(_0x303ad1[_0x0578('0x12')][_0x0578('0x14')]);}logger[_0x0578('0x12')](_0x0578('0xd'),_0x3114a1,_0x303ad1['error']['message']);return _0x21a2fe(_0x303ad1['error'][_0x0578('0x14')]);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x3114a1,_0x0578('0xe'));_0x21a2fe(_0x303ad1[_0x0578('0x15')][_0x0578('0x14')]);}})[_0x0578('0x16')](function(_0x3a2771){logger[_0x0578('0x12')]('ChatApplication,\x20%s,\x20%s',_0x3114a1,_0x3a2771);_0x534bb3(_0x3a2771);});});} \ No newline at end of file +var _0xa2d8=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result'];(function(_0x2b668b,_0x373cd3){var _0x5ac01a=function(_0x1ada5b){while(--_0x1ada5b){_0x2b668b['push'](_0x2b668b['shift']());}};_0x5ac01a(++_0x373cd3);}(_0xa2d8,0x114));var _0x8a2d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa2d8[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x8a2d('0x0'));var util=require(_0x8a2d('0x1'));var moment=require(_0x8a2d('0x2'));var BPromise=require(_0x8a2d('0x3'));var rs=require(_0x8a2d('0x4'));var fs=require('fs');var Redis=require(_0x8a2d('0x5'));var db=require(_0x8a2d('0x6'))['db'];var utils=require(_0x8a2d('0x7'));var logger=require(_0x8a2d('0x8'))('rpc');var config=require(_0x8a2d('0x9'));var jayson=require(_0x8a2d('0xa'));var client=jayson['client'][_0x8a2d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c6f11,_0x5b3fbf,_0x40b18f){return new BPromise(function(_0x292b24,_0x4ad7f9){return client[_0x8a2d('0xc')](_0x5c6f11,_0x40b18f)[_0x8a2d('0xd')](function(_0x2405e8){logger['info'](_0x8a2d('0xe'),_0x5b3fbf,_0x8a2d('0xf'));logger[_0x8a2d('0x10')](_0x8a2d('0x11'),_0x5b3fbf,'request\x20sent',JSON[_0x8a2d('0x12')](_0x2405e8));if(_0x2405e8['error']){if(_0x2405e8['error'][_0x8a2d('0x13')]===0x1f4){logger['error'](_0x8a2d('0xe'),_0x5b3fbf,_0x2405e8['error']['message']);return _0x4ad7f9(_0x2405e8[_0x8a2d('0x14')]['message']);}logger['error']('ChatApplication,\x20%s,\x20%s',_0x5b3fbf,_0x2405e8[_0x8a2d('0x14')][_0x8a2d('0x15')]);return _0x292b24(_0x2405e8[_0x8a2d('0x14')][_0x8a2d('0x15')]);}else{logger[_0x8a2d('0x16')](_0x8a2d('0xe'),_0x5b3fbf,_0x8a2d('0xf'));_0x292b24(_0x2405e8[_0x8a2d('0x17')][_0x8a2d('0x15')]);}})[_0x8a2d('0x18')](function(_0x23fe37){logger[_0x8a2d('0x14')](_0x8a2d('0xe'),_0x5b3fbf,_0x23fe37);_0x4ad7f9(_0x23fe37);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 508e463..a823311 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 _0xd16f=['isAuthenticated','put','/:id','update','delete','multer','util','path','express','Router','fs-extra','../../config/environment','./chatApplication.controller'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xd16f,0x1e6));var _0xfd16=function(_0x1496ec,_0x2f81e3){_0x1496ec=_0x1496ec-0x0;var _0x5e2b99=_0xd16f[_0x1496ec];return _0x5e2b99;};'use strict';var multer=require(_0xfd16('0x0'));var util=require(_0xfd16('0x1'));var path=require(_0xfd16('0x2'));var timeout=require('connect-timeout');var express=require(_0xfd16('0x3'));var router=express[_0xfd16('0x4')]();var fs_extra=require(_0xfd16('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfd16('0x6'));var controller=require(_0xfd16('0x7'));router['get']('/:id',auth[_0xfd16('0x8')](),controller['show']);router[_0xfd16('0x9')](_0xfd16('0xa'),auth[_0xfd16('0x8')](),controller[_0xfd16('0xb')]);router[_0xfd16('0xc')]('/:id',auth[_0xfd16('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0a18=['get','isAuthenticated','show','put','/:id','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x0a18,0xcb));var _0x80a1=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x0a18[_0x4dc7b9];return _0x3ab114;};'use strict';var multer=require(_0x80a1('0x0'));var util=require(_0x80a1('0x1'));var path=require(_0x80a1('0x2'));var timeout=require('connect-timeout');var express=require(_0x80a1('0x3'));var router=express[_0x80a1('0x4')]();var fs_extra=require(_0x80a1('0x5'));var auth=require(_0x80a1('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatApplication.controller');router[_0x80a1('0x7')]('/:id',auth[_0x80a1('0x8')](),controller[_0x80a1('0x9')]);router[_0x80a1('0xa')](_0x80a1('0xb'),auth[_0x80a1('0x8')](),controller[_0x80a1('0xc')]);router[_0x80a1('0xd')]('/:id',auth[_0x80a1('0x8')](),controller[_0x80a1('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 2fa0195..836acd2 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 _0xcc13=['STRING','BOOLEAN'];(function(_0x1acdb0,_0x148326){var _0x45652e=function(_0x556532){while(--_0x556532){_0x1acdb0['push'](_0x1acdb0['shift']());}};_0x45652e(++_0x148326);}(_0xcc13,0x190));var _0x3cc1=function(_0x36b821,_0x386805){_0x36b821=_0x36b821-0x0;var _0x38608e=_0xcc13[_0x36b821];return _0x38608e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3cc1('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x3cc1('0x0')]},'write':{'type':Sequelize[_0x3cc1('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7880=['BOOLEAN','sequelize','STRING'];(function(_0xa7a827,_0x152be9){var _0x4fa7e2=function(_0x29ff4d){while(--_0x29ff4d){_0xa7a827['push'](_0xa7a827['shift']());}};_0x4fa7e2(++_0x152be9);}(_0x7880,0x10f));var _0x0788=function(_0x44a3b0,_0x352810){_0x44a3b0=_0x44a3b0-0x0;var _0x39e6f6=_0x7880[_0x44a3b0];return _0x39e6f6;};'use strict';var Sequelize=require(_0x0788('0x0'));module['exports']={'name':{'type':Sequelize[_0x0788('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x0788('0x1')]},'write':{'type':Sequelize[_0x0788('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 dfe2651..5341ce2 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 _0x325c=['where','pick','VIRTUAL','filter','merge','options','ChatGroup','includeAll','rows','catch','show','find','create','body','params','destroy','describe','getUnread','user','toInteger','addMembers','ids','getMembers','findOne','User','hasOwnProperty','nolimit','removeMembers','ChatInternalMessage','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','./chatGroup.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort'];(function(_0x4c6dbb,_0x228c81){var _0x1deceb=function(_0x550622){while(--_0x550622){_0x4c6dbb['push'](_0x4c6dbb['shift']());}};_0x1deceb(++_0x228c81);}(_0x325c,0xdb));var _0xc325=function(_0x5f03f4,_0x71be0){_0x5f03f4=_0x5f03f4-0x0;var _0x3a4d47=_0x325c[_0x5f03f4];return _0x3a4d47;};'use strict';var emlformat=require(_0xc325('0x0'));var rimraf=require(_0xc325('0x1'));var zipdir=require(_0xc325('0x2'));var jsonpatch=require(_0xc325('0x3'));var rp=require(_0xc325('0x4'));var moment=require('moment');var BPromise=require(_0xc325('0x5'));var Mustache=require('mustache');var util=require(_0xc325('0x6'));var path=require(_0xc325('0x7'));var sox=require(_0xc325('0x8'));var csv=require(_0xc325('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc325('0xa'));var _=require('lodash');var squel=require(_0xc325('0xb'));var crypto=require('crypto');var jsforce=require(_0xc325('0xc'));var deskjs=require(_0xc325('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc325('0xe'));var Papa=require(_0xc325('0xf'));var Redis=require(_0xc325('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc325('0x11'));var as=require(_0xc325('0x12'));var hardwareService=require(_0xc325('0x13'));var logger=require(_0xc325('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xc325('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc325('0x16'))['db'];config['redis']=_[_0xc325('0x17')](config[_0xc325('0x18')],{'host':_0xc325('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc325('0x18')]));require(_0xc325('0x1a'))[_0xc325('0x1b')](socket);function respondWithStatusCode(_0x26cfdc,_0xdfab9f){_0xdfab9f=_0xdfab9f||0xcc;return function(_0x16a5ad){if(_0x16a5ad){return _0x26cfdc[_0xc325('0x1c')](_0xdfab9f);}return _0x26cfdc['status'](_0xdfab9f)[_0xc325('0x1d')]();};}function respondWithResult(_0x100390,_0x655b2f){_0x655b2f=_0x655b2f||0xc8;return function(_0x1c493f){if(_0x1c493f){return _0x100390[_0xc325('0x1e')](_0x655b2f)[_0xc325('0x1f')](_0x1c493f);}};}function respondWithFilteredResult(_0x23a7ae,_0x2df6b7){return function(_0x5a6cf1){if(_0x5a6cf1){var _0x346943=typeof _0x2df6b7[_0xc325('0x20')]==='undefined'&&typeof _0x2df6b7[_0xc325('0x21')]===_0xc325('0x22');var _0x39fac7=_0x5a6cf1[_0xc325('0x23')];var _0x252e8b=_0x346943?0x0:_0x2df6b7[_0xc325('0x20')];var _0x2b24e3=_0x346943?_0x5a6cf1[_0xc325('0x23')]:_0x2df6b7[_0xc325('0x20')]+_0x2df6b7[_0xc325('0x21')];var _0x40cc92;if(_0x2b24e3>=_0x39fac7){_0x2b24e3=_0x39fac7;_0x40cc92=0xc8;}else{_0x40cc92=0xce;}_0x23a7ae[_0xc325('0x1e')](_0x40cc92);return _0x23a7ae[_0xc325('0x24')](_0xc325('0x25'),_0x252e8b+'-'+_0x2b24e3+'/'+_0x39fac7)[_0xc325('0x1f')](_0x5a6cf1);}return null;};}function patchUpdates(_0x4e9073){return function(_0x583e8c){try{jsonpatch['apply'](_0x583e8c,_0x4e9073,!![]);}catch(_0x1f16ac){return BPromise['reject'](_0x1f16ac);}return _0x583e8c['save']();};}function saveUpdates(_0x1efc6e,_0x3218c2){return function(_0x263b3e){if(_0x263b3e){return _0x263b3e[_0xc325('0x26')](_0x1efc6e)[_0xc325('0x27')](function(_0xdc17ca){return _0xdc17ca;});}return null;};}function removeEntity(_0x4a9440,_0x4fb164){return function(_0x678c41){if(_0x678c41){return _0x678c41['destroy']()[_0xc325('0x27')](function(){_0x4a9440[_0xc325('0x1e')](0xcc)[_0xc325('0x1d')]();});}};}function handleEntityNotFound(_0x4849b3,_0x493a8e){return function(_0x5a115a){if(!_0x5a115a){_0x4849b3[_0xc325('0x1c')](0x194);}return _0x5a115a;};}function handleError(_0x3d2011,_0x5a4c45){_0x5a4c45=_0x5a4c45||0x1f4;return function(_0x28bb83){logger[_0xc325('0x28')](_0x28bb83[_0xc325('0x29')]);if(_0x28bb83[_0xc325('0x2a')]){delete _0x28bb83['name'];}_0x3d2011[_0xc325('0x1e')](_0x5a4c45)[_0xc325('0x2b')](_0x28bb83);};}exports[_0xc325('0x2c')]=function(_0x1f37bb,_0xfd0f10){var _0x304976={},_0xb189ba={},_0x29582d={'count':0x0,'rows':[]};var _0x3e4c38=_[_0xc325('0x2d')](db['ChatGroup'][_0xc325('0x2e')],function(_0x5d065a){return{'name':_0x5d065a[_0xc325('0x2f')],'type':_0x5d065a[_0xc325('0x30')][_0xc325('0x31')]};});_0xb189ba[_0xc325('0x32')]=_['map'](_0x3e4c38,_0xc325('0x2a'));_0xb189ba[_0xc325('0x33')]=_[_0xc325('0x34')](_0x1f37bb[_0xc325('0x33')]);_0xb189ba[_0xc325('0x35')]=_[_0xc325('0x36')](_0xb189ba['model'],_0xb189ba[_0xc325('0x33')]);_0x304976['attributes']=_[_0xc325('0x36')](_0xb189ba[_0xc325('0x32')],qs[_0xc325('0x37')](_0x1f37bb[_0xc325('0x33')]['fields']));_0x304976[_0xc325('0x38')]=_0x304976[_0xc325('0x38')][_0xc325('0x39')]?_0x304976['attributes']:_0xb189ba['model'];if(!_0x1f37bb['query']['hasOwnProperty']('nolimit')){_0x304976[_0xc325('0x21')]=qs[_0xc325('0x21')](_0x1f37bb[_0xc325('0x33')]['limit']);_0x304976['offset']=qs[_0xc325('0x20')](_0x1f37bb[_0xc325('0x33')][_0xc325('0x20')]);}_0x304976[_0xc325('0x3a')]=qs['sort'](_0x1f37bb[_0xc325('0x33')][_0xc325('0x3b')]);_0x304976[_0xc325('0x3c')]=qs[_0xc325('0x35')](_[_0xc325('0x3d')](_0x1f37bb[_0xc325('0x33')],_0xb189ba[_0xc325('0x35')]),_0x3e4c38);if(_0x1f37bb[_0xc325('0x33')]['filter']){_0x304976['where']=_['merge'](_0x304976[_0xc325('0x3c')],{'$or':_['map'](_0x3e4c38,function(_0x496257){if(_0x496257[_0xc325('0x30')]!==_0xc325('0x3e')){var _0xbd4301={};_0xbd4301[_0x496257[_0xc325('0x2a')]]={'$like':'%'+_0x1f37bb['query'][_0xc325('0x3f')]+'%'};return _0xbd4301;}})});}_0x304976=_[_0xc325('0x40')]({},_0x304976,_0x1f37bb[_0xc325('0x41')]);var _0x1f23ac={'where':_0x304976[_0xc325('0x3c')]};return db[_0xc325('0x42')][_0xc325('0x23')](_0x1f23ac)[_0xc325('0x27')](function(_0x43c5ab){_0x29582d[_0xc325('0x23')]=_0x43c5ab;if(_0x1f37bb[_0xc325('0x33')][_0xc325('0x43')]){_0x304976['include']=[{'all':!![]}];}return db[_0xc325('0x42')]['findAll'](_0x304976);})[_0xc325('0x27')](function(_0x19f78c){_0x29582d[_0xc325('0x44')]=_0x19f78c;return _0x29582d;})['then'](respondWithFilteredResult(_0xfd0f10,_0x304976))[_0xc325('0x45')](handleError(_0xfd0f10,null));};exports[_0xc325('0x46')]=function(_0x52069b,_0x5742e1){var _0x581098={'raw':!![],'where':{'id':_0x52069b['params']['id']}},_0x4f036d={};_0x4f036d[_0xc325('0x32')]=_[_0xc325('0x34')](db[_0xc325('0x42')][_0xc325('0x2e')]);_0x4f036d[_0xc325('0x33')]=_[_0xc325('0x34')](_0x52069b[_0xc325('0x33')]);_0x4f036d['filters']=_[_0xc325('0x36')](_0x4f036d[_0xc325('0x32')],_0x4f036d[_0xc325('0x33')]);_0x581098[_0xc325('0x38')]=_[_0xc325('0x36')](_0x4f036d[_0xc325('0x32')],qs[_0xc325('0x37')](_0x52069b[_0xc325('0x33')][_0xc325('0x37')]));_0x581098[_0xc325('0x38')]=_0x581098[_0xc325('0x38')][_0xc325('0x39')]?_0x581098[_0xc325('0x38')]:_0x4f036d['model'];if(_0x52069b[_0xc325('0x33')]['includeAll']){_0x581098['include']=[{'all':!![]}];}_0x581098=_['merge']({},_0x581098,_0x52069b[_0xc325('0x41')]);return db[_0xc325('0x42')][_0xc325('0x47')](_0x581098)[_0xc325('0x27')](handleEntityNotFound(_0x5742e1,null))[_0xc325('0x27')](respondWithResult(_0x5742e1,null))[_0xc325('0x45')](handleError(_0x5742e1,null));};exports[_0xc325('0x48')]=function(_0x1aa145,_0x1deffb){return db['ChatGroup'][_0xc325('0x48')](_0x1aa145['body'],{})[_0xc325('0x27')](respondWithResult(_0x1deffb,0xc9))[_0xc325('0x45')](handleError(_0x1deffb,null));};exports[_0xc325('0x26')]=function(_0x4e67f6,_0x422b73){if(_0x4e67f6[_0xc325('0x49')]['id']){delete _0x4e67f6[_0xc325('0x49')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x4e67f6[_0xc325('0x4a')]['id']}})[_0xc325('0x27')](handleEntityNotFound(_0x422b73,null))[_0xc325('0x27')](saveUpdates(_0x4e67f6[_0xc325('0x49')],null))[_0xc325('0x27')](respondWithResult(_0x422b73,null))[_0xc325('0x45')](handleError(_0x422b73,null));};exports[_0xc325('0x4b')]=function(_0x244b64,_0x3d1366){return db[_0xc325('0x42')][_0xc325('0x47')]({'where':{'id':_0x244b64[_0xc325('0x4a')]['id']}})[_0xc325('0x27')](handleEntityNotFound(_0x3d1366,null))[_0xc325('0x27')](removeEntity(_0x3d1366,null))[_0xc325('0x45')](handleError(_0x3d1366,null));};exports[_0xc325('0x4c')]=function(_0x363988,_0x26b877){return db[_0xc325('0x42')][_0xc325('0x4c')]()[_0xc325('0x27')](respondWithResult(_0x26b877,null))[_0xc325('0x45')](handleError(_0x26b877,null));};exports[_0xc325('0x4d')]=function(_0x31fe6f,_0x2a60f9,_0x767a98){return db['ChatInternalMessage'][_0xc325('0x23')]({'where':{'ChatGroupId':_0x31fe6f[_0xc325('0x4a')]['id'],'ToId':_0x31fe6f[_0xc325('0x4e')]['id'],'read':![]}})[_0xc325('0x27')](function(_0x3de0ed){return{'id':_[_0xc325('0x4f')](_0x31fe6f[_0xc325('0x4a')]['id']),'count':_0x3de0ed};})['then'](respondWithResult(_0x2a60f9,null))[_0xc325('0x45')](handleError(_0x2a60f9,null));};exports['addMembers']=function(_0x457823,_0x19cf5e,_0x292e10){return db[_0xc325('0x42')]['find']({'where':{'id':_0x457823[_0xc325('0x4a')]['id']}})[_0xc325('0x27')](handleEntityNotFound(_0x19cf5e,null))[_0xc325('0x27')](function(_0x460a04){if(_0x460a04){return _0x460a04[_0xc325('0x50')](_0x457823[_0xc325('0x49')][_0xc325('0x51')],_['omit'](_0x457823['body'],[_0xc325('0x51'),'id'])||{});}})['then'](respondWithResult(_0x19cf5e,null))[_0xc325('0x45')](handleError(_0x19cf5e,null));};exports[_0xc325('0x52')]=function(_0x523e73,_0x34c8a9,_0xb3dd69){var _0x269039={};var _0x285da4={};var _0x1fc690;var _0x185e0f;return db[_0xc325('0x42')][_0xc325('0x53')]({'where':{'id':_0x523e73[_0xc325('0x4a')]['id']}})[_0xc325('0x27')](handleEntityNotFound(_0x34c8a9,null))[_0xc325('0x27')](function(_0x5c8c35){if(_0x5c8c35){_0x1fc690=_0x5c8c35;_0x285da4[_0xc325('0x32')]=_[_0xc325('0x34')](db[_0xc325('0x54')][_0xc325('0x2e')]);_0x285da4['query']=_[_0xc325('0x34')](_0x523e73[_0xc325('0x33')]);_0x285da4[_0xc325('0x35')]=_[_0xc325('0x36')](_0x285da4['model'],_0x285da4[_0xc325('0x33')]);_0x269039[_0xc325('0x38')]=_['intersection'](_0x285da4[_0xc325('0x32')],qs[_0xc325('0x37')](_0x523e73[_0xc325('0x33')][_0xc325('0x37')]));_0x269039[_0xc325('0x38')]=_0x269039[_0xc325('0x38')][_0xc325('0x39')]?_0x269039['attributes']:_0x285da4[_0xc325('0x32')];_0x269039['order']=qs[_0xc325('0x3b')](_0x523e73[_0xc325('0x33')][_0xc325('0x3b')]);_0x269039[_0xc325('0x3c')]=qs['filters'](_[_0xc325('0x3d')](_0x523e73[_0xc325('0x33')],_0x285da4[_0xc325('0x35')]));if(_0x523e73['query'][_0xc325('0x3f')]){_0x269039[_0xc325('0x3c')]=_[_0xc325('0x40')](_0x269039[_0xc325('0x3c')],{'$or':_[_0xc325('0x2d')](_0x269039['attributes'],function(_0x1aab7b){var _0x488b56={};_0x488b56[_0x1aab7b]={'$like':'%'+_0x523e73[_0xc325('0x33')][_0xc325('0x3f')]+'%'};return _0x488b56;})});}_0x269039=_[_0xc325('0x40')]({},_0x269039,_0x523e73[_0xc325('0x41')]);return _0x1fc690[_0xc325('0x52')](_0x269039);}})[_0xc325('0x27')](function(_0x7225e4){if(_0x7225e4){_0x185e0f=_0x7225e4['length'];if(!_0x523e73['query'][_0xc325('0x55')](_0xc325('0x56'))){_0x269039[_0xc325('0x21')]=qs[_0xc325('0x21')](_0x523e73[_0xc325('0x33')][_0xc325('0x21')]);_0x269039[_0xc325('0x20')]=qs[_0xc325('0x20')](_0x523e73[_0xc325('0x33')]['offset']);}return _0x1fc690[_0xc325('0x52')](_0x269039);}})[_0xc325('0x27')](function(_0x33f710){if(_0x33f710){return _0x33f710?{'count':_0x185e0f,'rows':_0x33f710}:null;}})[_0xc325('0x27')](respondWithResult(_0x34c8a9,null))[_0xc325('0x45')](handleError(_0x34c8a9,null));};exports['removeMembers']=function(_0x130aed,_0x94d139,_0x311e5d){return db['ChatGroup'][_0xc325('0x47')]({'where':{'id':_0x130aed[_0xc325('0x4a')]['id']}})[_0xc325('0x27')](handleEntityNotFound(_0x94d139,null))['then'](function(_0x442571){if(_0x442571){return _0x442571[_0xc325('0x57')](_0x130aed['query']['ids']);}})[_0xc325('0x27')](respondWithStatusCode(_0x94d139,null))[_0xc325('0x45')](handleError(_0x94d139,null));};exports['addMessage']=function(_0x54092a,_0x24d5ef,_0x5b6593){if(_0x54092a[_0xc325('0x49')]['id']){delete _0x54092a['body']['id'];}return db['ChatGroup'][_0xc325('0x47')]({'where':{'id':_0x54092a[_0xc325('0x4a')]['id']}})['then'](handleEntityNotFound(_0x24d5ef,null))['then'](function(_0x525504){if(_0x525504){_0x54092a[_0xc325('0x49')]['ChatGroupId']=_0x525504['id'];return db[_0xc325('0x58')][_0xc325('0x48')](_0x54092a['body']);}})[_0xc325('0x27')](respondWithResult(_0x24d5ef,null))['catch'](handleError(_0x24d5ef,null));};exports[_0xc325('0x59')]=function(_0x2bb21f,_0x4ead27,_0x405e47){var _0x525f85={};var _0x5eec10={};var _0x205440;var _0x5a43c7;return db[_0xc325('0x42')][_0xc325('0x53')]({'where':{'id':_0x2bb21f[_0xc325('0x4a')]['id']}})[_0xc325('0x27')](handleEntityNotFound(_0x4ead27,null))[_0xc325('0x27')](function(_0x2d5bde){if(_0x2d5bde){_0x205440=_0x2d5bde;_0x5eec10['model']=_['keys'](db[_0xc325('0x58')][_0xc325('0x2e')]);_0x5eec10[_0xc325('0x33')]=_[_0xc325('0x34')](_0x2bb21f[_0xc325('0x33')]);_0x5eec10[_0xc325('0x35')]=_[_0xc325('0x36')](_0x5eec10[_0xc325('0x32')],_0x5eec10[_0xc325('0x33')]);_0x525f85[_0xc325('0x38')]=_[_0xc325('0x36')](_0x5eec10[_0xc325('0x32')],qs[_0xc325('0x37')](_0x2bb21f[_0xc325('0x33')][_0xc325('0x37')]));_0x525f85[_0xc325('0x38')]=_0x525f85[_0xc325('0x38')]['length']?_0x525f85[_0xc325('0x38')]:_0x5eec10[_0xc325('0x32')];_0x525f85[_0xc325('0x3a')]=qs[_0xc325('0x3b')](_0x2bb21f[_0xc325('0x33')][_0xc325('0x3b')]);_0x525f85[_0xc325('0x3c')]=qs[_0xc325('0x35')](_[_0xc325('0x3d')](_0x2bb21f[_0xc325('0x33')],_0x5eec10[_0xc325('0x35')]));if(_0x2bb21f[_0xc325('0x33')][_0xc325('0x3f')]){_0x525f85[_0xc325('0x3c')]=_[_0xc325('0x40')](_0x525f85[_0xc325('0x3c')],{'$or':_[_0xc325('0x2d')](_0x525f85[_0xc325('0x38')],function(_0x22f902){var _0x5d55bd={};_0x5d55bd[_0x22f902]={'$like':'%'+_0x2bb21f[_0xc325('0x33')][_0xc325('0x3f')]+'%'};return _0x5d55bd;})});}if(_0x2bb21f[_0xc325('0x33')][_0xc325('0x5a')]){var _0x732538=_0x2bb21f[_0xc325('0x33')][_0xc325('0x5a')]['split'](',');var _0x2ee34b={};_0x2ee34b[_0x732538[0x0]]={'$gte':moment(_0x732538[0x1])[_0xc325('0x5b')](_0xc325('0x5c'))};_0x525f85['where']=_[_0xc325('0x40')](_0x525f85['where'],_0x2ee34b);}_0x525f85=_[_0xc325('0x40')]({},_0x525f85,_0x2bb21f['options']);return _0x205440[_0xc325('0x59')](_0x525f85);}})[_0xc325('0x27')](function(_0x3e6503){if(_0x3e6503){_0x5a43c7=_0x3e6503['length'];if(!_0x2bb21f[_0xc325('0x33')][_0xc325('0x55')](_0xc325('0x56'))){_0x525f85['limit']=qs[_0xc325('0x21')](_0x2bb21f[_0xc325('0x33')][_0xc325('0x21')]);_0x525f85[_0xc325('0x20')]=qs['offset'](_0x2bb21f[_0xc325('0x33')]['offset']);}return _0x205440['getMessages'](_0x525f85);}})[_0xc325('0x27')](function(_0x5a6599){if(_0x5a6599){return _0x5a6599?{'count':_0x5a43c7,'rows':_0x5a6599}:null;}})[_0xc325('0x27')](respondWithResult(_0x4ead27,null))['catch'](handleError(_0x4ead27,null));}; \ No newline at end of file +var _0x893e=['stack','name','send','index','map','ChatGroup','type','key','model','keys','filters','intersection','attributes','query','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','create','body','update','find','describe','user','toInteger','addMembers','ids','getMembers','findOne','User','fields','hasOwnProperty','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','then','sendStatus'];(function(_0x19429a,_0x59c591){var _0x1a3390=function(_0x39f931){while(--_0x39f931){_0x19429a['push'](_0x19429a['shift']());}};_0x1a3390(++_0x59c591);}(_0x893e,0x1b6));var _0xe893=function(_0x50eefa,_0x11f515){_0x50eefa=_0x50eefa-0x0;var _0x27a7db=_0x893e[_0x50eefa];return _0x27a7db;};'use strict';var emlformat=require(_0xe893('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe893('0x1'));var jsonpatch=require(_0xe893('0x2'));var rp=require(_0xe893('0x3'));var moment=require(_0xe893('0x4'));var BPromise=require(_0xe893('0x5'));var Mustache=require(_0xe893('0x6'));var util=require(_0xe893('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xe893('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe893('0x9'));var squel=require(_0xe893('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe893('0x8'));var querystring=require(_0xe893('0xb'));var Papa=require(_0xe893('0xc'));var Redis=require(_0xe893('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xe893('0xe'));var as=require(_0xe893('0xf'));var hardwareService=require(_0xe893('0x10'));var logger=require(_0xe893('0x11'))(_0xe893('0x12'));var utils=require(_0xe893('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xe893('0x14'));var db=require(_0xe893('0x15'))['db'];config[_0xe893('0x16')]=_[_0xe893('0x17')](config[_0xe893('0x16')],{'host':_0xe893('0x18'),'port':0x18eb});var socket=require(_0xe893('0x19'))(new Redis(config[_0xe893('0x16')]));require(_0xe893('0x1a'))['register'](socket);function respondWithStatusCode(_0x4beeab,_0x381953){_0x381953=_0x381953||0xcc;return function(_0x4bdd45){if(_0x4bdd45){return _0x4beeab['sendStatus'](_0x381953);}return _0x4beeab[_0xe893('0x1b')](_0x381953)[_0xe893('0x1c')]();};}function respondWithResult(_0x3f3e78,_0x557e80){_0x557e80=_0x557e80||0xc8;return function(_0x1270fe){if(_0x1270fe){return _0x3f3e78[_0xe893('0x1b')](_0x557e80)[_0xe893('0x1d')](_0x1270fe);}};}function respondWithFilteredResult(_0x488127,_0x5c83d2){return function(_0x711670){if(_0x711670){var _0x5cd25e=typeof _0x5c83d2[_0xe893('0x1e')]==='undefined'&&typeof _0x5c83d2[_0xe893('0x1f')]===_0xe893('0x20');var _0x45f9fc=_0x711670[_0xe893('0x21')];var _0x288c50=_0x5cd25e?0x0:_0x5c83d2['offset'];var _0x2688d4=_0x5cd25e?_0x711670[_0xe893('0x21')]:_0x5c83d2[_0xe893('0x1e')]+_0x5c83d2[_0xe893('0x1f')];var _0x4f3570;if(_0x2688d4>=_0x45f9fc){_0x2688d4=_0x45f9fc;_0x4f3570=0xc8;}else{_0x4f3570=0xce;}_0x488127['status'](_0x4f3570);return _0x488127[_0xe893('0x22')](_0xe893('0x23'),_0x288c50+'-'+_0x2688d4+'/'+_0x45f9fc)[_0xe893('0x1d')](_0x711670);}return null;};}function patchUpdates(_0x9ba058){return function(_0x4e4655){try{jsonpatch[_0xe893('0x24')](_0x4e4655,_0x9ba058,!![]);}catch(_0x3e9b22){return BPromise[_0xe893('0x25')](_0x3e9b22);}return _0x4e4655[_0xe893('0x26')]();};}function saveUpdates(_0x4bf7c6,_0x42ab0c){return function(_0x5a0d3c){if(_0x5a0d3c){return _0x5a0d3c['update'](_0x4bf7c6)['then'](function(_0x9cfd86){return _0x9cfd86;});}return null;};}function removeEntity(_0x53cf56,_0xa25d9b){return function(_0x9f327b){if(_0x9f327b){return _0x9f327b[_0xe893('0x27')]()[_0xe893('0x28')](function(){_0x53cf56[_0xe893('0x1b')](0xcc)[_0xe893('0x1c')]();});}};}function handleEntityNotFound(_0x280cd3,_0x2f402e){return function(_0x243279){if(!_0x243279){_0x280cd3[_0xe893('0x29')](0x194);}return _0x243279;};}function handleError(_0x5d2157,_0x10d9a8){_0x10d9a8=_0x10d9a8||0x1f4;return function(_0x48245a){logger['error'](_0x48245a[_0xe893('0x2a')]);if(_0x48245a[_0xe893('0x2b')]){delete _0x48245a[_0xe893('0x2b')];}_0x5d2157[_0xe893('0x1b')](_0x10d9a8)[_0xe893('0x2c')](_0x48245a);};}exports[_0xe893('0x2d')]=function(_0x142684,_0x589325){var _0x5d9ec1={},_0x5d46d8={},_0x341888={'count':0x0,'rows':[]};var _0x5ec8ce=_[_0xe893('0x2e')](db[_0xe893('0x2f')]['rawAttributes'],function(_0x25aeff){return{'name':_0x25aeff['fieldName'],'type':_0x25aeff[_0xe893('0x30')][_0xe893('0x31')]};});_0x5d46d8[_0xe893('0x32')]=_[_0xe893('0x2e')](_0x5ec8ce,_0xe893('0x2b'));_0x5d46d8['query']=_[_0xe893('0x33')](_0x142684['query']);_0x5d46d8[_0xe893('0x34')]=_[_0xe893('0x35')](_0x5d46d8[_0xe893('0x32')],_0x5d46d8['query']);_0x5d9ec1[_0xe893('0x36')]=_[_0xe893('0x35')](_0x5d46d8[_0xe893('0x32')],qs['fields'](_0x142684[_0xe893('0x37')]['fields']));_0x5d9ec1[_0xe893('0x36')]=_0x5d9ec1[_0xe893('0x36')][_0xe893('0x38')]?_0x5d9ec1[_0xe893('0x36')]:_0x5d46d8[_0xe893('0x32')];if(!_0x142684[_0xe893('0x37')]['hasOwnProperty'](_0xe893('0x39'))){_0x5d9ec1[_0xe893('0x1f')]=qs[_0xe893('0x1f')](_0x142684['query']['limit']);_0x5d9ec1[_0xe893('0x1e')]=qs[_0xe893('0x1e')](_0x142684['query'][_0xe893('0x1e')]);}_0x5d9ec1[_0xe893('0x3a')]=qs[_0xe893('0x3b')](_0x142684[_0xe893('0x37')][_0xe893('0x3b')]);_0x5d9ec1[_0xe893('0x3c')]=qs[_0xe893('0x34')](_[_0xe893('0x3d')](_0x142684[_0xe893('0x37')],_0x5d46d8[_0xe893('0x34')]),_0x5ec8ce);if(_0x142684[_0xe893('0x37')][_0xe893('0x3e')]){_0x5d9ec1[_0xe893('0x3c')]=_[_0xe893('0x3f')](_0x5d9ec1[_0xe893('0x3c')],{'$or':_[_0xe893('0x2e')](_0x5ec8ce,function(_0x2ced2e){if(_0x2ced2e[_0xe893('0x30')]!==_0xe893('0x40')){var _0x39f387={};_0x39f387[_0x2ced2e[_0xe893('0x2b')]]={'$like':'%'+_0x142684[_0xe893('0x37')][_0xe893('0x3e')]+'%'};return _0x39f387;}})});}_0x5d9ec1=_[_0xe893('0x3f')]({},_0x5d9ec1,_0x142684[_0xe893('0x41')]);var _0x53a889={'where':_0x5d9ec1[_0xe893('0x3c')]};return db[_0xe893('0x2f')][_0xe893('0x21')](_0x53a889)[_0xe893('0x28')](function(_0x51d795){_0x341888['count']=_0x51d795;if(_0x142684[_0xe893('0x37')][_0xe893('0x42')]){_0x5d9ec1[_0xe893('0x43')]=[{'all':!![]}];}return db['ChatGroup'][_0xe893('0x44')](_0x5d9ec1);})['then'](function(_0x14ae62){_0x341888[_0xe893('0x45')]=_0x14ae62;return _0x341888;})['then'](respondWithFilteredResult(_0x589325,_0x5d9ec1))[_0xe893('0x46')](handleError(_0x589325,null));};exports['show']=function(_0x3a6caf,_0x5e6157){var _0x86e299={'raw':!![],'where':{'id':_0x3a6caf[_0xe893('0x47')]['id']}},_0x1b04d5={};_0x1b04d5[_0xe893('0x32')]=_[_0xe893('0x33')](db['ChatGroup'][_0xe893('0x48')]);_0x1b04d5[_0xe893('0x37')]=_[_0xe893('0x33')](_0x3a6caf['query']);_0x1b04d5[_0xe893('0x34')]=_[_0xe893('0x35')](_0x1b04d5[_0xe893('0x32')],_0x1b04d5[_0xe893('0x37')]);_0x86e299[_0xe893('0x36')]=_[_0xe893('0x35')](_0x1b04d5[_0xe893('0x32')],qs['fields'](_0x3a6caf[_0xe893('0x37')]['fields']));_0x86e299['attributes']=_0x86e299[_0xe893('0x36')][_0xe893('0x38')]?_0x86e299[_0xe893('0x36')]:_0x1b04d5[_0xe893('0x32')];if(_0x3a6caf[_0xe893('0x37')]['includeAll']){_0x86e299[_0xe893('0x43')]=[{'all':!![]}];}_0x86e299=_[_0xe893('0x3f')]({},_0x86e299,_0x3a6caf[_0xe893('0x41')]);return db['ChatGroup']['find'](_0x86e299)[_0xe893('0x28')](handleEntityNotFound(_0x5e6157,null))[_0xe893('0x28')](respondWithResult(_0x5e6157,null))['catch'](handleError(_0x5e6157,null));};exports['create']=function(_0x4b4728,_0x240c25){return db['ChatGroup'][_0xe893('0x49')](_0x4b4728[_0xe893('0x4a')],{})[_0xe893('0x28')](respondWithResult(_0x240c25,0xc9))[_0xe893('0x46')](handleError(_0x240c25,null));};exports[_0xe893('0x4b')]=function(_0x1ffb66,_0x1df3e6){if(_0x1ffb66[_0xe893('0x4a')]['id']){delete _0x1ffb66['body']['id'];}return db[_0xe893('0x2f')]['find']({'where':{'id':_0x1ffb66[_0xe893('0x47')]['id']}})[_0xe893('0x28')](handleEntityNotFound(_0x1df3e6,null))[_0xe893('0x28')](saveUpdates(_0x1ffb66[_0xe893('0x4a')],null))['then'](respondWithResult(_0x1df3e6,null))[_0xe893('0x46')](handleError(_0x1df3e6,null));};exports[_0xe893('0x27')]=function(_0x34287,_0x5c2194){return db[_0xe893('0x2f')][_0xe893('0x4c')]({'where':{'id':_0x34287['params']['id']}})[_0xe893('0x28')](handleEntityNotFound(_0x5c2194,null))[_0xe893('0x28')](removeEntity(_0x5c2194,null))[_0xe893('0x46')](handleError(_0x5c2194,null));};exports[_0xe893('0x4d')]=function(_0x5ba46e,_0x2670b1){return db[_0xe893('0x2f')][_0xe893('0x4d')]()[_0xe893('0x28')](respondWithResult(_0x2670b1,null))[_0xe893('0x46')](handleError(_0x2670b1,null));};exports['getUnread']=function(_0x1e1b8e,_0x7951a9,_0x4016e0){return db['ChatInternalMessage'][_0xe893('0x21')]({'where':{'ChatGroupId':_0x1e1b8e[_0xe893('0x47')]['id'],'ToId':_0x1e1b8e[_0xe893('0x4e')]['id'],'read':![]}})[_0xe893('0x28')](function(_0x21641b){return{'id':_[_0xe893('0x4f')](_0x1e1b8e[_0xe893('0x47')]['id']),'count':_0x21641b};})['then'](respondWithResult(_0x7951a9,null))['catch'](handleError(_0x7951a9,null));};exports[_0xe893('0x50')]=function(_0x7500b8,_0x5c8af3,_0x2203cf){return db[_0xe893('0x2f')][_0xe893('0x4c')]({'where':{'id':_0x7500b8[_0xe893('0x47')]['id']}})[_0xe893('0x28')](handleEntityNotFound(_0x5c8af3,null))[_0xe893('0x28')](function(_0x5764a8){if(_0x5764a8){return _0x5764a8[_0xe893('0x50')](_0x7500b8['body'][_0xe893('0x51')],_['omit'](_0x7500b8[_0xe893('0x4a')],[_0xe893('0x51'),'id'])||{});}})[_0xe893('0x28')](respondWithResult(_0x5c8af3,null))[_0xe893('0x46')](handleError(_0x5c8af3,null));};exports[_0xe893('0x52')]=function(_0x35b1a6,_0x4903e4,_0x2b3d8a){var _0x40f2f4={};var _0xa91c71={};var _0xcc0c31;var _0x3ac79d;return db['ChatGroup'][_0xe893('0x53')]({'where':{'id':_0x35b1a6[_0xe893('0x47')]['id']}})[_0xe893('0x28')](handleEntityNotFound(_0x4903e4,null))['then'](function(_0x561c4b){if(_0x561c4b){_0xcc0c31=_0x561c4b;_0xa91c71[_0xe893('0x32')]=_[_0xe893('0x33')](db[_0xe893('0x54')][_0xe893('0x48')]);_0xa91c71[_0xe893('0x37')]=_['keys'](_0x35b1a6[_0xe893('0x37')]);_0xa91c71[_0xe893('0x34')]=_[_0xe893('0x35')](_0xa91c71[_0xe893('0x32')],_0xa91c71['query']);_0x40f2f4[_0xe893('0x36')]=_[_0xe893('0x35')](_0xa91c71[_0xe893('0x32')],qs[_0xe893('0x55')](_0x35b1a6[_0xe893('0x37')][_0xe893('0x55')]));_0x40f2f4[_0xe893('0x36')]=_0x40f2f4[_0xe893('0x36')]['length']?_0x40f2f4[_0xe893('0x36')]:_0xa91c71[_0xe893('0x32')];_0x40f2f4[_0xe893('0x3a')]=qs['sort'](_0x35b1a6['query'][_0xe893('0x3b')]);_0x40f2f4[_0xe893('0x3c')]=qs['filters'](_[_0xe893('0x3d')](_0x35b1a6[_0xe893('0x37')],_0xa91c71[_0xe893('0x34')]));if(_0x35b1a6[_0xe893('0x37')][_0xe893('0x3e')]){_0x40f2f4[_0xe893('0x3c')]=_[_0xe893('0x3f')](_0x40f2f4[_0xe893('0x3c')],{'$or':_['map'](_0x40f2f4['attributes'],function(_0x4f3682){var _0x47eb96={};_0x47eb96[_0x4f3682]={'$like':'%'+_0x35b1a6[_0xe893('0x37')][_0xe893('0x3e')]+'%'};return _0x47eb96;})});}_0x40f2f4=_[_0xe893('0x3f')]({},_0x40f2f4,_0x35b1a6[_0xe893('0x41')]);return _0xcc0c31[_0xe893('0x52')](_0x40f2f4);}})[_0xe893('0x28')](function(_0xea3d93){if(_0xea3d93){_0x3ac79d=_0xea3d93[_0xe893('0x38')];if(!_0x35b1a6[_0xe893('0x37')][_0xe893('0x56')](_0xe893('0x39'))){_0x40f2f4[_0xe893('0x1f')]=qs[_0xe893('0x1f')](_0x35b1a6[_0xe893('0x37')][_0xe893('0x1f')]);_0x40f2f4[_0xe893('0x1e')]=qs[_0xe893('0x1e')](_0x35b1a6[_0xe893('0x37')][_0xe893('0x1e')]);}return _0xcc0c31[_0xe893('0x52')](_0x40f2f4);}})['then'](function(_0x12d32c){if(_0x12d32c){return _0x12d32c?{'count':_0x3ac79d,'rows':_0x12d32c}:null;}})[_0xe893('0x28')](respondWithResult(_0x4903e4,null))[_0xe893('0x46')](handleError(_0x4903e4,null));};exports[_0xe893('0x57')]=function(_0x488773,_0x56b05f,_0x319882){return db[_0xe893('0x2f')][_0xe893('0x4c')]({'where':{'id':_0x488773['params']['id']}})['then'](handleEntityNotFound(_0x56b05f,null))[_0xe893('0x28')](function(_0x4aa3c3){if(_0x4aa3c3){return _0x4aa3c3['removeMembers'](_0x488773[_0xe893('0x37')][_0xe893('0x51')]);}})['then'](respondWithStatusCode(_0x56b05f,null))[_0xe893('0x46')](handleError(_0x56b05f,null));};exports[_0xe893('0x58')]=function(_0x20d4e1,_0xc7928e,_0x4aeafb){if(_0x20d4e1[_0xe893('0x4a')]['id']){delete _0x20d4e1[_0xe893('0x4a')]['id'];}return db[_0xe893('0x2f')]['find']({'where':{'id':_0x20d4e1[_0xe893('0x47')]['id']}})[_0xe893('0x28')](handleEntityNotFound(_0xc7928e,null))['then'](function(_0x5ed117){if(_0x5ed117){_0x20d4e1['body'][_0xe893('0x59')]=_0x5ed117['id'];return db[_0xe893('0x5a')][_0xe893('0x49')](_0x20d4e1[_0xe893('0x4a')]);}})[_0xe893('0x28')](respondWithResult(_0xc7928e,null))['catch'](handleError(_0xc7928e,null));};exports[_0xe893('0x5b')]=function(_0x252169,_0x546189,_0x1b62ae){var _0x26274b={};var _0xf36339={};var _0x8dc997;var _0x1f20bd;return db['ChatGroup'][_0xe893('0x53')]({'where':{'id':_0x252169[_0xe893('0x47')]['id']}})[_0xe893('0x28')](handleEntityNotFound(_0x546189,null))[_0xe893('0x28')](function(_0x48e42c){if(_0x48e42c){_0x8dc997=_0x48e42c;_0xf36339[_0xe893('0x32')]=_[_0xe893('0x33')](db[_0xe893('0x5a')]['rawAttributes']);_0xf36339[_0xe893('0x37')]=_['keys'](_0x252169[_0xe893('0x37')]);_0xf36339[_0xe893('0x34')]=_[_0xe893('0x35')](_0xf36339['model'],_0xf36339['query']);_0x26274b['attributes']=_[_0xe893('0x35')](_0xf36339[_0xe893('0x32')],qs[_0xe893('0x55')](_0x252169['query'][_0xe893('0x55')]));_0x26274b[_0xe893('0x36')]=_0x26274b[_0xe893('0x36')][_0xe893('0x38')]?_0x26274b[_0xe893('0x36')]:_0xf36339[_0xe893('0x32')];_0x26274b['order']=qs['sort'](_0x252169[_0xe893('0x37')][_0xe893('0x3b')]);_0x26274b[_0xe893('0x3c')]=qs[_0xe893('0x34')](_[_0xe893('0x3d')](_0x252169[_0xe893('0x37')],_0xf36339[_0xe893('0x34')]));if(_0x252169['query']['filter']){_0x26274b[_0xe893('0x3c')]=_[_0xe893('0x3f')](_0x26274b[_0xe893('0x3c')],{'$or':_['map'](_0x26274b[_0xe893('0x36')],function(_0xa39c2b){var _0x17b8e9={};_0x17b8e9[_0xa39c2b]={'$like':'%'+_0x252169['query'][_0xe893('0x3e')]+'%'};return _0x17b8e9;})});}if(_0x252169[_0xe893('0x37')][_0xe893('0x5c')]){var _0x352c39=_0x252169[_0xe893('0x37')][_0xe893('0x5c')][_0xe893('0x5d')](',');var _0x3f8883={};_0x3f8883[_0x352c39[0x0]]={'$gte':moment(_0x352c39[0x1])[_0xe893('0x5e')](_0xe893('0x5f'))};_0x26274b[_0xe893('0x3c')]=_[_0xe893('0x3f')](_0x26274b['where'],_0x3f8883);}_0x26274b=_[_0xe893('0x3f')]({},_0x26274b,_0x252169[_0xe893('0x41')]);return _0x8dc997['getMessages'](_0x26274b);}})[_0xe893('0x28')](function(_0x195a1d){if(_0x195a1d){_0x1f20bd=_0x195a1d[_0xe893('0x38')];if(!_0x252169['query']['hasOwnProperty'](_0xe893('0x39'))){_0x26274b[_0xe893('0x1f')]=qs['limit'](_0x252169[_0xe893('0x37')][_0xe893('0x1f')]);_0x26274b['offset']=qs[_0xe893('0x1e')](_0x252169[_0xe893('0x37')]['offset']);}return _0x8dc997[_0xe893('0x5b')](_0x26274b);}})[_0xe893('0x28')](function(_0x1da3a7){if(_0x1da3a7){return _0x1da3a7?{'count':_0x1f20bd,'rows':_0x1da3a7}:null;}})[_0xe893('0x28')](respondWithResult(_0x546189,null))[_0xe893('0x46')](handleError(_0x546189,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index a451f73..e9700ea 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 _0x6d3f=['ChatGroup','setMaxListeners','save','update','emit','hook','events','../../mysqldb'];(function(_0x473e31,_0x18eeaf){var _0x5a831f=function(_0x26fbfd){while(--_0x26fbfd){_0x473e31['push'](_0x473e31['shift']());}};_0x5a831f(++_0x18eeaf);}(_0x6d3f,0xe6));var _0xf6d3=function(_0x26d5d5,_0x14084e){_0x26d5d5=_0x26d5d5-0x0;var _0x3a8a8b=_0x6d3f[_0x26d5d5];return _0x3a8a8b;};'use strict';var EventEmitter=require(_0xf6d3('0x0'));var ChatGroup=require(_0xf6d3('0x1'))['db'][_0xf6d3('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xf6d3('0x3')](0x0);var events={'afterCreate':_0xf6d3('0x4'),'afterUpdate':_0xf6d3('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1ae390){return function(_0xcaecfe,_0xa2efe5,_0x4070dd){ChatGroupEvents[_0xf6d3('0x6')](_0x1ae390+':'+_0xcaecfe['id'],_0xcaecfe);ChatGroupEvents[_0xf6d3('0x6')](_0x1ae390,_0xcaecfe);_0x4070dd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0xf6d3('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x3b64=['update','remove','emit','hook','events','../../mysqldb','ChatGroup','setMaxListeners','save'];(function(_0x26cc4d,_0x32f706){var _0x3d52c8=function(_0x3e9e38){while(--_0x3e9e38){_0x26cc4d['push'](_0x26cc4d['shift']());}};_0x3d52c8(++_0x32f706);}(_0x3b64,0x1bd));var _0x43b6=function(_0x5a5534,_0x57e666){_0x5a5534=_0x5a5534-0x0;var _0x298ead=_0x3b64[_0x5a5534];return _0x298ead;};'use strict';var EventEmitter=require(_0x43b6('0x0'));var ChatGroup=require(_0x43b6('0x1'))['db'][_0x43b6('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x43b6('0x3')](0x0);var events={'afterCreate':_0x43b6('0x4'),'afterUpdate':_0x43b6('0x5'),'afterDestroy':_0x43b6('0x6')};function emitEvent(_0x5def73){return function(_0x35953b,_0x5bc35d,_0xd9c446){ChatGroupEvents[_0x43b6('0x7')](_0x5def73+':'+_0x35953b['id'],_0x35953b);ChatGroupEvents[_0x43b6('0x7')](_0x5def73,_0x35953b);_0xd9c446(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x43b6('0x8')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 20cdf6d..5fb5e5b 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 _0x5797=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatGroup.attributes','define','ChatGroup','chat_groups','lodash','util'];(function(_0x380eca,_0x3a1430){var _0x32b500=function(_0x48df42){while(--_0x48df42){_0x380eca['push'](_0x380eca['shift']());}};_0x32b500(++_0x3a1430);}(_0x5797,0x1d2));var _0x7579=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x5797[_0x2070da];return _0x4f9fe1;};'use strict';var _=require(_0x7579('0x0'));var util=require(_0x7579('0x1'));var logger=require(_0x7579('0x2'))(_0x7579('0x3'));var moment=require(_0x7579('0x4'));var BPromise=require(_0x7579('0x5'));var rp=require(_0x7579('0x6'));var fs=require('fs');var path=require(_0x7579('0x7'));var rimraf=require(_0x7579('0x8'));var config=require('../../config/environment');var attributes=require(_0x7579('0x9'));module['exports']=function(_0x152db4,_0xb30bc4){return _0x152db4[_0x7579('0xa')](_0x7579('0xb'),attributes,{'tableName':_0x7579('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x771e=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','chat_groups','lodash'];(function(_0x442c23,_0x2d8c52){var _0x165b59=function(_0x4608b4){while(--_0x4608b4){_0x442c23['push'](_0x442c23['shift']());}};_0x165b59(++_0x2d8c52);}(_0x771e,0x14c));var _0xe771=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x771e[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xe771('0x0'));var util=require('util');var logger=require(_0xe771('0x1'))('api');var moment=require(_0xe771('0x2'));var BPromise=require(_0xe771('0x3'));var rp=require(_0xe771('0x4'));var fs=require('fs');var path=require(_0xe771('0x5'));var rimraf=require('rimraf');var config=require(_0xe771('0x6'));var attributes=require('./chatGroup.attributes');module[_0xe771('0x7')]=function(_0x519b2a,_0x317c38){return _0x519b2a['define']('ChatGroup',attributes,{'tableName':_0xe771('0x8'),'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 fdcbbba..cac9c23 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 _0xb717=['message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x48c6a8,_0x11e119){var _0x23456b=function(_0x1317e9){while(--_0x1317e9){_0x48c6a8['push'](_0x48c6a8['shift']());}};_0x23456b(++_0x11e119);}(_0xb717,0x1b4));var _0x7b71=function(_0x30ac25,_0x3999a9){_0x30ac25=_0x30ac25-0x0;var _0x1f8da3=_0xb717[_0x30ac25];return _0x1f8da3;};'use strict';var _=require(_0x7b71('0x0'));var util=require('util');var moment=require(_0x7b71('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b71('0x2'));var fs=require('fs');var Redis=require(_0x7b71('0x3'));var db=require(_0x7b71('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b71('0x5'))(_0x7b71('0x6'));var config=require(_0x7b71('0x7'));var jayson=require(_0x7b71('0x8'));var client=jayson[_0x7b71('0x9')]['http']({'port':0x232a});config[_0x7b71('0xa')]=_[_0x7b71('0xb')](config[_0x7b71('0xa')],{'host':_0x7b71('0xc'),'port':0x18eb});var socket=require(_0x7b71('0xd'))(new Redis(config['redis']));require(_0x7b71('0xe'))[_0x7b71('0xf')](socket);function respondWithRpcPromise(_0x53857a,_0x1b7a5b,_0x45bbcd){return new BPromise(function(_0x179fab,_0x55c72a){return client[_0x7b71('0x10')](_0x53857a,_0x45bbcd)['then'](function(_0x470f77){logger['info'](_0x7b71('0x11'),_0x1b7a5b,_0x7b71('0x12'));logger[_0x7b71('0x13')](_0x7b71('0x14'),_0x1b7a5b,_0x7b71('0x12'),JSON['stringify'](_0x470f77));if(_0x470f77[_0x7b71('0x15')]){if(_0x470f77['error'][_0x7b71('0x16')]===0x1f4){logger[_0x7b71('0x15')]('ChatGroup,\x20%s,\x20%s',_0x1b7a5b,_0x470f77[_0x7b71('0x15')][_0x7b71('0x17')]);return _0x55c72a(_0x470f77[_0x7b71('0x15')]['message']);}logger['error'](_0x7b71('0x11'),_0x1b7a5b,_0x470f77[_0x7b71('0x15')][_0x7b71('0x17')]);return _0x179fab(_0x470f77[_0x7b71('0x15')]['message']);}else{logger[_0x7b71('0x18')]('ChatGroup,\x20%s,\x20%s',_0x1b7a5b,'request\x20sent');_0x179fab(_0x470f77[_0x7b71('0x19')][_0x7b71('0x17')]);}})[_0x7b71('0x1a')](function(_0x46c47d){logger[_0x7b71('0x15')]('ChatGroup,\x20%s,\x20%s',_0x1b7a5b,_0x46c47d);_0x55c72a(_0x46c47d);});});} \ No newline at end of file +var _0xb38e=['rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x11d553,_0x17e7f4){var _0x374ad5=function(_0x49dd1b){while(--_0x49dd1b){_0x11d553['push'](_0x11d553['shift']());}};_0x374ad5(++_0x17e7f4);}(_0xb38e,0xa7));var _0xeb38=function(_0x48f2a1,_0x41e0ba){_0x48f2a1=_0x48f2a1-0x0;var _0x5414a1=_0xb38e[_0x48f2a1];return _0x5414a1;};'use strict';var _=require(_0xeb38('0x0'));var util=require(_0xeb38('0x1'));var moment=require(_0xeb38('0x2'));var BPromise=require(_0xeb38('0x3'));var rs=require(_0xeb38('0x4'));var fs=require('fs');var Redis=require(_0xeb38('0x5'));var db=require(_0xeb38('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xeb38('0x7'))(_0xeb38('0x8'));var config=require('../../config/environment');var jayson=require(_0xeb38('0x9'));var client=jayson[_0xeb38('0xa')][_0xeb38('0xb')]({'port':0x232a});config[_0xeb38('0xc')]=_['defaults'](config[_0xeb38('0xc')],{'host':_0xeb38('0xd'),'port':0x18eb});var socket=require(_0xeb38('0xe'))(new Redis(config[_0xeb38('0xc')]));require('./chatGroup.socket')[_0xeb38('0xf')](socket);function respondWithRpcPromise(_0x34c438,_0x8a6144,_0xa54e19){return new BPromise(function(_0xfbd120,_0x1542f4){return client[_0xeb38('0x10')](_0x34c438,_0xa54e19)['then'](function(_0x170e47){logger['info'](_0xeb38('0x11'),_0x8a6144,_0xeb38('0x12'));logger['debug'](_0xeb38('0x13'),_0x8a6144,_0xeb38('0x12'),JSON[_0xeb38('0x14')](_0x170e47));if(_0x170e47[_0xeb38('0x15')]){if(_0x170e47[_0xeb38('0x15')][_0xeb38('0x16')]===0x1f4){logger['error'](_0xeb38('0x11'),_0x8a6144,_0x170e47[_0xeb38('0x15')][_0xeb38('0x17')]);return _0x1542f4(_0x170e47[_0xeb38('0x15')][_0xeb38('0x17')]);}logger[_0xeb38('0x15')](_0xeb38('0x11'),_0x8a6144,_0x170e47['error'][_0xeb38('0x17')]);return _0xfbd120(_0x170e47[_0xeb38('0x15')][_0xeb38('0x17')]);}else{logger['info'](_0xeb38('0x11'),_0x8a6144,'request\x20sent');_0xfbd120(_0x170e47['result'][_0xeb38('0x17')]);}})[_0xeb38('0x18')](function(_0x95a29){logger['error']('ChatGroup,\x20%s,\x20%s',_0x8a6144,_0x95a29);_0x1542f4(_0x95a29);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index fcad6c3..93ce986 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 _0xe8da=['length','./chatGroup.events','save','update','emit','removeListener','register'];(function(_0x38a999,_0x50ebc3){var _0x5e7f35=function(_0x5cc0e5){while(--_0x5cc0e5){_0x38a999['push'](_0x38a999['shift']());}};_0x5e7f35(++_0x50ebc3);}(_0xe8da,0xef));var _0xae8d=function(_0x2116f5,_0x327df2){_0x2116f5=_0x2116f5-0x0;var _0x35e37c=_0xe8da[_0x2116f5];return _0x35e37c;};'use strict';var ChatGroupEvents=require(_0xae8d('0x0'));var events=[_0xae8d('0x1'),'remove',_0xae8d('0x2')];function createListener(_0x122666,_0x438812){return function(_0x19bae2){_0x438812[_0xae8d('0x3')](_0x122666,_0x19bae2);};}function removeListener(_0x566055,_0x2bd7f3){return function(){ChatGroupEvents[_0xae8d('0x4')](_0x566055,_0x2bd7f3);};}exports[_0xae8d('0x5')]=function(_0x49bbcd){for(var _0xd1a2cd=0x0,_0x4e4ee0=events[_0xae8d('0x6')];_0xd1a2cd<_0x4e4ee0;_0xd1a2cd++){var _0x1a8af0=events[_0xd1a2cd];var _0x5388a4=createListener('chatGroup:'+_0x1a8af0,_0x49bbcd);ChatGroupEvents['on'](_0x1a8af0,_0x5388a4);}}; \ No newline at end of file +var _0xa850=['length','./chatGroup.events','save','remove','update','emit','removeListener','register'];(function(_0x193e28,_0x3dac1d){var _0x20ef59=function(_0x48047e){while(--_0x48047e){_0x193e28['push'](_0x193e28['shift']());}};_0x20ef59(++_0x3dac1d);}(_0xa850,0xc1));var _0x0a85=function(_0x248dfb,_0x5bd780){_0x248dfb=_0x248dfb-0x0;var _0x168f8f=_0xa850[_0x248dfb];return _0x168f8f;};'use strict';var ChatGroupEvents=require(_0x0a85('0x0'));var events=[_0x0a85('0x1'),_0x0a85('0x2'),_0x0a85('0x3')];function createListener(_0x2dc27a,_0x27ef13){return function(_0x3917f6){_0x27ef13[_0x0a85('0x4')](_0x2dc27a,_0x3917f6);};}function removeListener(_0xb5778e,_0x4c64bc){return function(){ChatGroupEvents[_0x0a85('0x5')](_0xb5778e,_0x4c64bc);};}exports[_0x0a85('0x6')]=function(_0x3e44d0){for(var _0x7ce8a7=0x0,_0x120b8a=events[_0x0a85('0x7')];_0x7ce8a7<_0x120b8a;_0x7ce8a7++){var _0x4826cb=events[_0x7ce8a7];var _0x1e887f=createListener('chatGroup:'+_0x4826cb,_0x3e44d0);ChatGroupEvents['on'](_0x4826cb,_0x1e887f);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 29e73dd..d112d90 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 _0x0f96=['../../components/interaction/service','../../config/environment','./chatGroup.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/unread','getUnread','getMessages','post','/:id/members','addMembers','/:id/messages','addMessage','put','update','delete','destroy','removeMembers','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x306f56,_0x47efc7){var _0x564730=function(_0x9eb039){while(--_0x9eb039){_0x306f56['push'](_0x306f56['shift']());}};_0x564730(++_0x47efc7);}(_0x0f96,0x8e));var _0x60f9=function(_0x3eac71,_0x1169cf){_0x3eac71=_0x3eac71-0x0;var _0x292b16=_0x0f96[_0x3eac71];return _0x292b16;};'use strict';var multer=require(_0x60f9('0x0'));var util=require(_0x60f9('0x1'));var path=require(_0x60f9('0x2'));var timeout=require(_0x60f9('0x3'));var express=require(_0x60f9('0x4'));var router=express[_0x60f9('0x5')]();var fs_extra=require(_0x60f9('0x6'));var auth=require(_0x60f9('0x7'));var interaction=require(_0x60f9('0x8'));var config=require(_0x60f9('0x9'));var controller=require(_0x60f9('0xa'));router[_0x60f9('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x60f9('0xb')](_0x60f9('0xc'),auth[_0x60f9('0xd')](),controller[_0x60f9('0xe')]);router[_0x60f9('0xb')](_0x60f9('0xf'),auth['isAuthenticated'](),controller[_0x60f9('0x10')]);router[_0x60f9('0xb')](_0x60f9('0x11'),auth['isAuthenticated'](),controller[_0x60f9('0x12')]);router[_0x60f9('0xb')]('/:id/members',auth[_0x60f9('0xd')](),controller['getMembers']);router['get']('/:id/messages',auth[_0x60f9('0xd')](),controller[_0x60f9('0x13')]);router[_0x60f9('0x14')]('/',auth[_0x60f9('0xd')](),controller['create']);router[_0x60f9('0x14')](_0x60f9('0x15'),auth['isAuthenticated'](),controller[_0x60f9('0x16')]);router[_0x60f9('0x14')](_0x60f9('0x17'),auth['isAuthenticated'](),controller[_0x60f9('0x18')]);router[_0x60f9('0x19')](_0x60f9('0xf'),auth[_0x60f9('0xd')](),controller[_0x60f9('0x1a')]);router[_0x60f9('0x1b')](_0x60f9('0xf'),auth[_0x60f9('0xd')](),controller[_0x60f9('0x1c')]);router[_0x60f9('0x1b')](_0x60f9('0x15'),auth[_0x60f9('0xd')](),controller[_0x60f9('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x6f1d=['/:id/messages','create','post','/:id/members','addMembers','delete','destroy','removeMembers','exports','multer','path','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/unread','getMembers'];(function(_0x57c02c,_0x52a409){var _0x5c42e9=function(_0x58f289){while(--_0x58f289){_0x57c02c['push'](_0x57c02c['shift']());}};_0x5c42e9(++_0x52a409);}(_0x6f1d,0xd8));var _0xd6f1=function(_0x34362f,_0x57e762){_0x34362f=_0x34362f-0x0;var _0x24c0b6=_0x6f1d[_0x34362f];return _0x24c0b6;};'use strict';var multer=require(_0xd6f1('0x0'));var util=require('util');var path=require(_0xd6f1('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd6f1('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd6f1('0x3'));var config=require(_0xd6f1('0x4'));var controller=require('./chatGroup.controller');router['get']('/',auth[_0xd6f1('0x5')](),controller[_0xd6f1('0x6')]);router['get'](_0xd6f1('0x7'),auth[_0xd6f1('0x5')](),controller[_0xd6f1('0x8')]);router[_0xd6f1('0x9')](_0xd6f1('0xa'),auth[_0xd6f1('0x5')](),controller[_0xd6f1('0xb')]);router['get'](_0xd6f1('0xc'),auth[_0xd6f1('0x5')](),controller['getUnread']);router[_0xd6f1('0x9')]('/:id/members',auth[_0xd6f1('0x5')](),controller[_0xd6f1('0xd')]);router[_0xd6f1('0x9')](_0xd6f1('0xe'),auth[_0xd6f1('0x5')](),controller['getMessages']);router['post']('/',auth[_0xd6f1('0x5')](),controller[_0xd6f1('0xf')]);router[_0xd6f1('0x10')](_0xd6f1('0x11'),auth[_0xd6f1('0x5')](),controller[_0xd6f1('0x12')]);router[_0xd6f1('0x10')](_0xd6f1('0xe'),auth[_0xd6f1('0x5')](),controller['addMessage']);router['put'](_0xd6f1('0xa'),auth[_0xd6f1('0x5')](),controller['update']);router[_0xd6f1('0x13')](_0xd6f1('0xa'),auth[_0xd6f1('0x5')](),controller[_0xd6f1('0x14')]);router[_0xd6f1('0x13')]('/:id/members',auth[_0xd6f1('0x5')](),controller[_0xd6f1('0x15')]);module[_0xd6f1('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 74a9489..63a460c 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 _0x48bc=['BOOLEAN','ENUM','star','thumb','TEXT','STRING','long','DATE','out','sequelize','exports'];(function(_0x1cd43b,_0x2ac627){var _0x21de30=function(_0x375b26){while(--_0x375b26){_0x1cd43b['push'](_0x1cd43b['shift']());}};_0x21de30(++_0x2ac627);}(_0x48bc,0x1b6));var _0xc48b=function(_0x18589b,_0x50ebfb){_0x18589b=_0x18589b-0x0;var _0xef4858=_0x48bc[_0x18589b];return _0xef4858;};'use strict';var Sequelize=require(_0xc48b('0x0'));module[_0xc48b('0x1')]={'closed':{'type':Sequelize[_0xc48b('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xc48b('0x3')](_0xc48b('0x4'),_0xc48b('0x5')),'defaultValue':_0xc48b('0x4')},'ratingMessage':{'type':Sequelize[_0xc48b('0x6')]},'pathTranscript':{'type':Sequelize[_0xc48b('0x6')]},'mailTranscript':{'type':Sequelize[_0xc48b('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xc48b('0x7')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xc48b('0x7')]},'note':{'type':Sequelize[_0xc48b('0x7')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0xc48b('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0xc48b('0x7')]},'deviceModel':{'type':Sequelize[_0xc48b('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0xc48b('0x7')]},'referer':{'type':Sequelize[_0xc48b('0x6')]},'customerIp':{'type':Sequelize[_0xc48b('0x7')]},'formData':{'type':Sequelize[_0xc48b('0x6')](_0xc48b('0x8'))},'read1stAt':{'type':Sequelize[_0xc48b('0x9')]},'lastMsgAt':{'type':Sequelize[_0xc48b('0x9')]},'lastMsgDirection':{'type':Sequelize[_0xc48b('0x3')]('in',_0xc48b('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xc48b('0x7')]},'customerPort':{'type':Sequelize[_0xc48b('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xc48b('0x6')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x1ba2=['sequelize','BOOLEAN','ENUM','star','thumb','TEXT','STRING','DATE','long','out'];(function(_0x4c216c,_0x43f2cd){var _0x10f6de=function(_0x4f62b9){while(--_0x4f62b9){_0x4c216c['push'](_0x4c216c['shift']());}};_0x10f6de(++_0x43f2cd);}(_0x1ba2,0xb4));var _0x21ba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1ba2[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x21ba('0x0'));module['exports']={'closed':{'type':Sequelize[_0x21ba('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x21ba('0x2')](_0x21ba('0x3'),_0x21ba('0x4')),'defaultValue':_0x21ba('0x3')},'ratingMessage':{'type':Sequelize[_0x21ba('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x21ba('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x21ba('0x7')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x21ba('0x6')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x21ba('0x6')]},'browserName':{'type':Sequelize[_0x21ba('0x6')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x21ba('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x21ba('0x6')]},'deviceVendor':{'type':Sequelize[_0x21ba('0x6')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x21ba('0x5')]},'customerIp':{'type':Sequelize[_0x21ba('0x6')]},'formData':{'type':Sequelize[_0x21ba('0x5')](_0x21ba('0x8'))},'read1stAt':{'type':Sequelize[_0x21ba('0x7')]},'lastMsgAt':{'type':Sequelize[_0x21ba('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x21ba('0x2')]('in',_0x21ba('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x21ba('0x6')]},'customerPort':{'type':Sequelize[_0x21ba('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x21ba('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x21ba('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index b8900f1..01476f2 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 _0x66fa=['error','code','message','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','body','contact','agent','interaction','TagIds','Tags','split','forEach','push','map','ChatInteraction','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','field','from','tools_tags','select','u.id','u.fullname','ui.ChatInteractionId','left_join','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','users','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','some','compact','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','DESC','isEmpty','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','all','rows','params','includeAll','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','fullname','email','account','https://api-vidaoo.xcally.com/api/v1/meetings','follow','isNull','metadata','ValidationError','join_url','out','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','attachmentUpload','file','originalname','filename','mimetype','Attachment','attachmentDownload','Unauthorized','ChatOfflineMessageId','root','offline-chat/','join','basename','close','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','CmContact','ContactId','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','direction','MailServerOut','Smtp','service','host','port','secure','auth','pass','\x22%s\x22\x20<%s>','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','ChatMessage','addMessage','omit','ids','getMessages','merge','YYYY-MM-DD\x20HH:mm:ss','options','getMyMessages','include','includeAgent','alias','addTags','setTags','findAll','color','emit','chatInteractionTags:save','removeTags','download','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','createdAt','secret','read','Account','Owner','mkdirSync','Chat','N.A.','closedAt','browserName','osName','customerIp','customerPort','tail','existsSync','createReadStream','createWriteStream','renderFile','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','err','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/export/pdf','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','jayson/promise','client','http','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x42f48d,_0x8d0d10){var _0x103cc9=function(_0x30861c){while(--_0x30861c){_0x42f48d['push'](_0x42f48d['shift']());}};_0x103cc9(++_0x8d0d10);}(_0x66fa,0x117));var _0xa66f=function(_0x5a782d,_0x5d0bee){_0x5a782d=_0x5a782d-0x0;var _0xa4e463=_0x66fa[_0x5a782d];return _0xa4e463;};'use strict';var emlformat=require(_0xa66f('0x0'));var rimraf=require(_0xa66f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa66f('0x2'));var rp=require(_0xa66f('0x3'));var moment=require(_0xa66f('0x4'));var BPromise=require(_0xa66f('0x5'));var Mustache=require(_0xa66f('0x6'));var util=require(_0xa66f('0x7'));var path=require(_0xa66f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa66f('0x9'));var fs=require('fs');var fs_extra=require(_0xa66f('0xa'));var _=require(_0xa66f('0xb'));var squel=require(_0xa66f('0xc'));var crypto=require(_0xa66f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa66f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa66f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa66f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xa66f('0x11'));var hardwareService=require(_0xa66f('0x12'));var logger=require('../../config/logger')(_0xa66f('0x13'));var utils=require('../../config/utils');var config=require(_0xa66f('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xa66f('0x15'))['db'];config[_0xa66f('0x16')]=_[_0xa66f('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa66f('0x18'))(new Redis(config['redis']));require('./chatInteraction.socket')['register'](socket);var jayson=require(_0xa66f('0x19'));var client=jayson[_0xa66f('0x1a')][_0xa66f('0x1b')]({'port':0x232b});var client9004=jayson[_0xa66f('0x1a')][_0xa66f('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x567d4f,_0x5510dc,_0x19b5ac,_0x32d338){return new BPromise(function(_0x295acf,_0x403f4d){var _0x5c67f5=_0x32d338||client;return _0x5c67f5[_0xa66f('0x1c')](_0x567d4f,_0x19b5ac)['then'](function(_0x4a28d4){logger[_0xa66f('0x1d')](_0xa66f('0x1e'),_0x5510dc,_0xa66f('0x1f'));logger[_0xa66f('0x20')](_0xa66f('0x21'),_0x5510dc,_0xa66f('0x1f'),JSON[_0xa66f('0x22')](_0x4a28d4));if(_0x4a28d4[_0xa66f('0x23')]){if(_0x4a28d4[_0xa66f('0x23')][_0xa66f('0x24')]===0x1f4){logger[_0xa66f('0x23')](_0xa66f('0x1e'),_0x5510dc,_0x4a28d4[_0xa66f('0x23')][_0xa66f('0x25')]);return _0x403f4d(_0x4a28d4[_0xa66f('0x23')]['message']);}logger[_0xa66f('0x23')](_0xa66f('0x1e'),_0x5510dc,_0x4a28d4[_0xa66f('0x23')][_0xa66f('0x25')]);return _0x295acf(_0x4a28d4['error'][_0xa66f('0x25')]);}else{logger[_0xa66f('0x1d')](_0xa66f('0x1e'),_0x5510dc,_0xa66f('0x1f'));_0x295acf(_0x4a28d4['result']['message']);}})[_0xa66f('0x26')](function(_0x598942){logger[_0xa66f('0x23')](_0xa66f('0x1e'),_0x5510dc,_0x598942);_0x403f4d(_0x598942);});});}function respondWithStatusCode(_0x384164,_0x57da7f){_0x57da7f=_0x57da7f||0xcc;return function(_0x4683c7){if(_0x4683c7){return _0x384164[_0xa66f('0x27')](_0x57da7f);}return _0x384164[_0xa66f('0x28')](_0x57da7f)[_0xa66f('0x29')]();};}function respondWithResult(_0x17c103,_0x236046){_0x236046=_0x236046||0xc8;return function(_0x1eb86a){if(_0x1eb86a){return _0x17c103[_0xa66f('0x28')](_0x236046)[_0xa66f('0x2a')](_0x1eb86a);}};}function respondWithFilteredResult(_0x117d03,_0x45f71c){return function(_0x63650b){if(_0x63650b){var _0x42b966=typeof _0x45f71c[_0xa66f('0x2b')]==='undefined'&&typeof _0x45f71c['limit']===_0xa66f('0x2c');var _0x27ceae=_0x63650b['count'];var _0x44c79a=_0x42b966?0x0:_0x45f71c[_0xa66f('0x2b')];var _0x4cd7f2=_0x42b966?_0x63650b[_0xa66f('0x2d')]:_0x45f71c[_0xa66f('0x2b')]+_0x45f71c[_0xa66f('0x2e')];var _0x2c2ace;if(_0x4cd7f2>=_0x27ceae){_0x4cd7f2=_0x27ceae;_0x2c2ace=0xc8;}else{_0x2c2ace=0xce;}_0x117d03[_0xa66f('0x28')](_0x2c2ace);return _0x117d03['set'](_0xa66f('0x2f'),_0x44c79a+'-'+_0x4cd7f2+'/'+_0x27ceae)['json'](_0x63650b);}return null;};}function patchUpdates(_0x306b35){return function(_0x35a0a7){try{jsonpatch[_0xa66f('0x30')](_0x35a0a7,_0x306b35,!![]);}catch(_0x486e4e){return BPromise[_0xa66f('0x31')](_0x486e4e);}return _0x35a0a7[_0xa66f('0x32')]();};}function saveUpdates(_0x4f1668,_0x1a5d4a){return function(_0x35a847){if(_0x35a847){return _0x35a847[_0xa66f('0x33')](_0x4f1668)[_0xa66f('0x34')](function(_0x10a782){return _0x10a782;});}return null;};}function removeEntity(_0x2452d2,_0x25c74c){return function(_0x41303c){if(_0x41303c){return _0x41303c[_0xa66f('0x35')]()[_0xa66f('0x34')](function(){_0x2452d2['status'](0xcc)[_0xa66f('0x29')]();});}};}function handleEntityNotFound(_0x5bf736,_0x1c7eda){return function(_0x46f6cc){if(!_0x46f6cc){_0x5bf736[_0xa66f('0x27')](0x194);}return _0x46f6cc;};}function handleError(_0x3b9261,_0x3722d3){_0x3722d3=_0x3722d3||0x1f4;return function(_0x201432){logger[_0xa66f('0x23')](_0x201432[_0xa66f('0x36')]);if(_0x201432['name']){delete _0x201432[_0xa66f('0x37')];}_0x3b9261['status'](_0x3722d3)[_0xa66f('0x38')](_0x201432);};}function getMustacheRender(_0x45eeb8,_0x2ed1fb){return Mustache['render'](_0x45eeb8,_['merge'](_0x2ed1fb[_0xa66f('0x39')],{'contact':_0x2ed1fb[_0xa66f('0x3a')],'message':_0x2ed1fb[_0xa66f('0x25')],'agent':_0x2ed1fb[_0xa66f('0x3b')],'interaction':_0x2ed1fb[_0xa66f('0x3c')],'account':_0x2ed1fb['account']}))||'';}function getInteractionUsers(_0x5cb0a9,_0x49b869){return new BPromise(function(_0x30f7de,_0x4aeeb4){try{if(_0x49b869[_0x5cb0a9['id']]){_0x5cb0a9['Users']=_['map'](_0x49b869[_0x5cb0a9['id']],function(_0x5fdc3e){return{'id':_0x5fdc3e['id'],'fullname':_0x5fdc3e['fullname']};});}}catch(_0x8965d3){_0x4aeeb4(_0x8965d3);}_0x30f7de(_0x5cb0a9);});}function getInteractionTags(_0x17d942,_0x23a546){return new BPromise(function(_0x1647a0,_0xd65c5d){try{if(_0x17d942[_0xa66f('0x3d')]){_0x17d942[_0xa66f('0x3e')]=[];_0x17d942[_0xa66f('0x3d')][_0xa66f('0x3f')](',')[_0xa66f('0x40')](function(_0x3a7929){_0x17d942[_0xa66f('0x3e')][_0xa66f('0x41')](_0x23a546[_0x3a7929]);});}delete _0x17d942[_0xa66f('0x3d')];}catch(_0x4f01b9){_0xd65c5d(_0x4f01b9);}_0x1647a0(_0x17d942);});}function updateChatInteraction(_0x36037c,_0x25c2cb,_0x58c1f2){return new BPromise(function(_0x248587,_0x4b6e6b){return getInteractionUsers(_0x36037c,_0x58c1f2)[_0xa66f('0x34')](function(_0x27adf4){return getInteractionTags(_0x27adf4,_0x25c2cb);})['then'](function(_0x1ddd2f){_0x248587(_0x1ddd2f);})[_0xa66f('0x26')](function(_0x2126e8){_0x4b6e6b(_0x2126e8);});});}exports['index']=function(_0x394b1e,_0x5cdfe2){var _0x276cd5={},_0x33ed23={},_0xb52cc6={'count':0x0,'rows':[]};var _0x3a499e=_[_0xa66f('0x42')](db[_0xa66f('0x43')][_0xa66f('0x44')],function(_0x50cc47){return{'name':_0x50cc47[_0xa66f('0x45')],'type':_0x50cc47[_0xa66f('0x46')][_0xa66f('0x47')]};});_0x33ed23[_0xa66f('0x48')]=_[_0xa66f('0x42')](_0x3a499e,'name');_0x33ed23['query']=_[_0xa66f('0x49')](_0x394b1e[_0xa66f('0x4a')]);_0x33ed23[_0xa66f('0x4b')]=_[_0xa66f('0x4c')](_0x33ed23[_0xa66f('0x48')],_0x33ed23[_0xa66f('0x4a')]);_0x276cd5['attributes']=_[_0xa66f('0x4c')](_0x33ed23[_0xa66f('0x48')],qs[_0xa66f('0x4d')](_0x394b1e['query']['fields']));_0x276cd5[_0xa66f('0x4e')]=_0x276cd5[_0xa66f('0x4e')][_0xa66f('0x4f')]?_0x276cd5['attributes']:_0x33ed23['model'];if(!_0x394b1e['query'][_0xa66f('0x50')](_0xa66f('0x51'))){_0x276cd5[_0xa66f('0x2e')]=qs[_0xa66f('0x2e')](_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x2e')]);_0x276cd5[_0xa66f('0x2b')]=qs[_0xa66f('0x2b')](_0x394b1e['query'][_0xa66f('0x2b')]);}_0x276cd5[_0xa66f('0x52')]=qs[_0xa66f('0x53')](_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x53')]);_0x276cd5[_0xa66f('0x54')]=qs['filters'](_[_0xa66f('0x55')](_0x394b1e[_0xa66f('0x4a')],_0x33ed23[_0xa66f('0x4b')]),_0x3a499e);var _0x13848d=[];var _0x20d6be=squel['select']()[_0xa66f('0x56')]('id')['field'](_0xa66f('0x37'))['field']('color')[_0xa66f('0x57')](_0xa66f('0x58'));var _0x12271d=squel[_0xa66f('0x59')]()[_0xa66f('0x56')](_0xa66f('0x5a'))['field'](_0xa66f('0x5b'))[_0xa66f('0x56')](_0xa66f('0x5c'))[_0xa66f('0x57')]('user_has_chat_interactions','ui')[_0xa66f('0x5d')]('users','u',_0xa66f('0x5e'));var _0x10fc75=squel[_0xa66f('0x59')]()[_0xa66f('0x57')](_0xa66f('0x5f'),'i')[_0xa66f('0x5d')](_0xa66f('0x60'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xa66f('0x5d')](_0xa66f('0x61'),'o',_0xa66f('0x62'))[_0xa66f('0x5d')](_0xa66f('0x63'),'a',_0xa66f('0x64'))[_0xa66f('0x5d')](_0xa66f('0x65'),'me',_0xa66f('0x66'))['left_join']('chat_interaction_has_tags','it',_0xa66f('0x67'))[_0xa66f('0x5d')](_0xa66f('0x58'),'t',_0xa66f('0x68'));var _0x2f1f1e=squel[_0xa66f('0x69')]();var _0x8bea2b=[];var _0x4b10cf=squel[_0xa66f('0x69')]();var _0x11c89e;if(_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x6a')]){_0x11c89e=as['parseSearch'](_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x6a')]);var _0x19ff30=_0x11c89e[_0xa66f('0x6b')];for(var _0x19f4b5=0x0;_0x19f4b5<_0x11c89e[_0xa66f('0x6c')]['length'];_0x19f4b5++){var _0x4b31f7=_0x11c89e[_0xa66f('0x6c')][_0x19f4b5];var _0x31b81b='i';var _0x174aad=_['find'](_0x3a499e,[_0xa66f('0x37'),_0x4b31f7[_0xa66f('0x56')]]);if(!_0x174aad){switch(_0x4b31f7[_0xa66f('0x56')]){case _0xa66f('0x6d'):if(_0x4b31f7[_0xa66f('0x6e')]==0x1){_0x10fc75[_0xa66f('0x6f')]('`'+_0x4b31f7[_0xa66f('0x56')]+_0xa66f('0x70'));}else{_0x10fc75[_0xa66f('0x6f')]('`'+_0x4b31f7['field']+_0xa66f('0x71'));}break;case _0xa66f('0x72'):if(_0x4b31f7[_0xa66f('0x73')]===_0xa66f('0x74')){if(_0x4b31f7[_0xa66f('0x6e')][_0xa66f('0x3f')]('\x20')[_0xa66f('0x4f')]>0x1){_0x2f1f1e[_0x19ff30](_0xa66f('0x75'),qs['getFullTextValue'](_0x4b31f7['value']),null);}else{var _0x46327d='%'+_0x4b31f7[_0xa66f('0x6e')]+'%';_0x2f1f1e[_0x19ff30](_0xa66f('0x76'),_0x46327d,_0x46327d,_0x46327d);}}else{_0x174aad=_[_0xa66f('0x77')](_0x3a499e,[_0xa66f('0x37'),'ContactId']);_0x4b31f7[_0xa66f('0x56')]='ContactId';_0x53b01b=as[_0xa66f('0x78')](_0x31b81b,_0x174aad[_0xa66f('0x46')],_0x4b31f7);_0x2f1f1e[_0x19ff30](_0x53b01b[_0xa66f('0x79')],_0x53b01b[_0xa66f('0x6e')]['start'],_0x53b01b[_0xa66f('0x6e')][_0xa66f('0x29')]);}break;case _0xa66f('0x7a'):var _0x46ea11=_0x4b31f7[_0xa66f('0x6e')][_0xa66f('0x3f')](',')[_0xa66f('0x42')](function(_0x2bdb18){return Number(_0x2bdb18);});_0x46ea11[_0xa66f('0x40')](function(_0x36b92f){_0x4b10cf['or'](_0xa66f('0x7b'),'%,'+_0x36b92f+',%');});_0x8bea2b=_[_0xa66f('0x7c')](_0x8bea2b,_0x46ea11);break;case'User':if(_0x4b31f7[_0xa66f('0x73')]===_0xa66f('0x74')){_0x2f1f1e[_0x19ff30](_0xa66f('0x7d'),'%'+_0x4b31f7[_0xa66f('0x6e')]+'%',null);}else{_0x174aad=_[_0xa66f('0x77')](_0x3a499e,[_0xa66f('0x37'),_0xa66f('0x7e')]);_0x4b31f7[_0xa66f('0x56')]='UserId';_0x53b01b=as[_0xa66f('0x78')](_0x31b81b,_0x174aad[_0xa66f('0x46')],_0x4b31f7);_0x2f1f1e[_0x19ff30](_0x53b01b[_0xa66f('0x79')],_0x53b01b[_0xa66f('0x6e')][_0xa66f('0x7f')],_0x53b01b[_0xa66f('0x6e')][_0xa66f('0x29')]);}break;case _0xa66f('0x39'):_0x53b01b=as['buildExpression']('me',null,_0x4b31f7);_0x2f1f1e[_0x19ff30](_0x53b01b['text'],_0x53b01b[_0xa66f('0x6e')][_0xa66f('0x7f')],_0x53b01b[_0xa66f('0x6e')]['end']);break;}}else{var _0x53b01b=as[_0xa66f('0x78')](_0x31b81b,_0x174aad[_0xa66f('0x46')],_0x4b31f7);_0x2f1f1e[_0x19ff30](_0x53b01b[_0xa66f('0x79')],_0x53b01b[_0xa66f('0x6e')]['start'],_0x53b01b[_0xa66f('0x6e')][_0xa66f('0x29')]);}}}else{var _0x1d4642=_(_0x394b1e[_0xa66f('0x4a')])[_0xa66f('0x49')]()[_0xa66f('0x42')](function(_0x218128){return _[_0xa66f('0x80')](_0x3a499e,['name',_0x218128])?_0x218128:undefined;})[_0xa66f('0x81')]()[_0xa66f('0x6e')]();if(!_['isEmpty'](_0x1d4642)){_0x1d4642['forEach'](function(_0x183155){if(_0x183155===_0xa66f('0x82')){_0x10fc75['where'](_0xa66f('0x83'),[]['concat'](_0x394b1e[_0xa66f('0x4a')][_0x183155]));}else if(_0x183155==='createdAt'){var _0x4feda0=JSON['parse'](_0x394b1e[_0xa66f('0x4a')][_0x183155])[_0xa66f('0x84')];var _0x1f05bb=JSON[_0xa66f('0x85')](_0x394b1e[_0xa66f('0x4a')][_0x183155])[_0xa66f('0x86')];_0x10fc75[_0xa66f('0x54')](_0xa66f('0x87'),_0x4feda0,_0x1f05bb);}else{if(_0x394b1e[_0xa66f('0x4a')][_0x183155]===_0xa66f('0x88')){_0x10fc75[_0xa66f('0x54')]('i.'+_0x183155+_0xa66f('0x89'));}else{_0x10fc75[_0xa66f('0x54')]('i.'+_0x183155+_0xa66f('0x8a'),_0x394b1e[_0xa66f('0x4a')][_0x183155]);}}});}if(_0x394b1e[_0xa66f('0x4a')]['read']){if(_0x394b1e[_0xa66f('0x4a')]['read']==0x1){_0x10fc75[_0xa66f('0x6f')]('`unreadMessages`\x20=\x200');}else{_0x10fc75[_0xa66f('0x6f')](_0xa66f('0x8b'));}}if(_0x394b1e[_0xa66f('0x4a')]['tag']){_0x8bea2b=_['isArray'](_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x8c')])?_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x8c')]:new Array(_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x8c')]);_0x8bea2b[_0xa66f('0x40')](function(_0x578bff){_0x4b10cf['or'](_0xa66f('0x7b'),'%,'+_0x578bff+',%');});}if(_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x8d')]){var _0x4426d2=_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x8d')][_0xa66f('0x8e')]('\x5c','\x5c\x5c')[_0xa66f('0x8e')](/'/g,'\x27\x27');if(qs[_0xa66f('0x8f')](_0x4426d2)){_0x2f1f1e['or'](_0xa66f('0x90'),_0x4426d2+'%');}else{_0x2f1f1e['or'](_0xa66f('0x91'),qs[_0xa66f('0x92')](_0x4426d2))['or'](_0xa66f('0x93'),_0x4426d2+'%');}}}_0x10fc75['where'](_0x2f1f1e);_0x10fc75[_0xa66f('0x94')](_0xa66f('0x95'));var _0x34ebfd={'type':db[_0xa66f('0x96')][_0xa66f('0x97')][_0xa66f('0x98')],'raw':!![]};var _0x3058aa=_0x10fc75[_0xa66f('0x99')]();_0x3058aa[_0xa66f('0x56')]('i.id');_0x3058aa[_0xa66f('0x56')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xa66f('0x6d'));if(_0x276cd5['order']){_0x276cd5[_0xa66f('0x52')]['forEach'](function(_0x298bd8){var _0x5a1750=_0x298bd8[0x0]===_0xa66f('0x9a')?_0x298bd8[0x0]:'i.'+_0x298bd8[0x0];_0x10fc75[_0xa66f('0x52')](_0x5a1750,_0x298bd8[0x1]===_0xa66f('0x9b')?![]:!![]);});}if(!_[_0xa66f('0x9c')](_0x8bea2b)){_0x10fc75[_0xa66f('0x6f')](_0x4b10cf);_0x3058aa[_0xa66f('0x54')]('t.id\x20IN\x20?',_0x8bea2b);}BPromise[_0xa66f('0x9d')]()[_0xa66f('0x34')](function(){if(!_0x11c89e){if(_0x394b1e[_0xa66f('0x4a')]['ChatWebsiteId'])return;_0x3058aa[_0xa66f('0x54')](_0xa66f('0x9e'));_0x10fc75['where'](_0xa66f('0x9e'));return;}if(_0x394b1e[_0xa66f('0x9f')]['role']!=='agent')return;return _0x394b1e[_0xa66f('0x9f')][_0xa66f('0xa0')]({'attributes':['id'],'raw':!![]})[_0xa66f('0x34')](function(_0x2929fe){if(_[_0xa66f('0x9c')](_0x2929fe)){_0x3058aa['where'](_0xa66f('0xa1'));_0x10fc75[_0xa66f('0x54')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x3058aa[_0xa66f('0x54')](_0xa66f('0x83'),_['map'](_0x2929fe,'id'));_0x10fc75[_0xa66f('0x54')](_0xa66f('0x83'),_[_0xa66f('0x42')](_0x2929fe,'id'));}});})[_0xa66f('0x34')](function(){if(_0x394b1e[_0xa66f('0x9f')]['role']===_0xa66f('0x3b')&&!_0x11c89e&&!_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x82')])return[];return db[_0xa66f('0xa2')][_0xa66f('0x4a')](_0x3058aa[_0xa66f('0xa3')](),_0x34ebfd);})['then'](function(_0x2b2c54){_0xb52cc6[_0xa66f('0x2d')]=_0x2b2c54[_0xa66f('0x4f')];if(_0xb52cc6[_0xa66f('0x2d')]===0x0)return[];return db[_0xa66f('0xa2')][_0xa66f('0x4a')](_0x20d6be[_0xa66f('0xa3')](),_0x34ebfd)['then'](function(_0x5ec355){_0x13848d=_[_0xa66f('0xa4')](_0x5ec355,'id');_0x34ebfd=_['merge'](_0x34ebfd,{'model':db[_0xa66f('0x43')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x394b1e[_0xa66f('0x4a')]['fields']){_0x276cd5[_0xa66f('0x4e')][_0xa66f('0x40')](function(_0x3f84f9){_0x10fc75['field']('i.'+_0x3f84f9);});}else{_0x10fc75['field'](_0xa66f('0xa5'),'unreadMessages');_0x10fc75[_0xa66f('0x56')](_0xa66f('0xa6'),_0xa66f('0xa7'));_0x10fc75['field'](_0xa66f('0xa8'),'Account.mandatoryDisposition');_0x10fc75[_0xa66f('0x56')](_0xa66f('0xa9'),_0xa66f('0x9a'));_0x10fc75[_0xa66f('0x56')]('i.*');_0x10fc75[_0xa66f('0x56')](_0xa66f('0xaa'),_0xa66f('0xab'));_0x10fc75[_0xa66f('0x56')](_0xa66f('0xac'),_0xa66f('0xad'));_0x10fc75['field'](_0xa66f('0xae'),_0xa66f('0xaf'));_0x10fc75[_0xa66f('0x56')](_0xa66f('0xb0'),_0xa66f('0xb1'));_0x10fc75['field']('c.mobile',_0xa66f('0xb2'));_0x10fc75[_0xa66f('0x56')](_0xa66f('0xb3'),_0xa66f('0xb4'));_0x10fc75[_0xa66f('0x56')](_0xa66f('0xb5'),_0xa66f('0xb6'));_0x10fc75[_0xa66f('0x56')](_0xa66f('0xb7'),_0xa66f('0xb8'));_0x10fc75[_0xa66f('0x56')](_0xa66f('0xb9'),'TagIds');}if(_0x276cd5[_0xa66f('0x2e')])_0x10fc75[_0xa66f('0x2e')](_0x276cd5['limit']);if(_0x276cd5[_0xa66f('0x2b')])_0x10fc75[_0xa66f('0x2b')](_0x276cd5[_0xa66f('0x2b')]);return db['sequelize']['query'](_0x10fc75[_0xa66f('0xa3')](),_0x34ebfd);})['then'](function(_0x3520e1){if(_0x3520e1[_0xa66f('0x4f')]>0x0)_0x12271d['where'](_0xa66f('0xba'),_[_0xa66f('0x42')](_0x3520e1,'id'));return db['sequelize'][_0xa66f('0x4a')](_0x12271d[_0xa66f('0xa3')](),_0x34ebfd)[_0xa66f('0x34')](function(_0x176b30){var _0x4bc36d=_['groupBy'](_0x176b30,_0xa66f('0xbb'));var _0xdd2d09=[];_0x3520e1[_0xa66f('0x40')](function(_0x1bab2b){_0xdd2d09[_0xa66f('0x41')](updateChatInteraction(_0x1bab2b,_0x13848d,_0x4bc36d));});return BPromise[_0xa66f('0xbc')](_0xdd2d09);});});})[_0xa66f('0x34')](function(_0xac0e98){_0xb52cc6[_0xa66f('0xbd')]=_0xac0e98;return _0xb52cc6;})[_0xa66f('0x34')](respondWithFilteredResult(_0x5cdfe2,_0x276cd5))['catch'](handleError(_0x5cdfe2,null));};exports['show']=function(_0x1d472d,_0x3cbbb6){var _0x3cf40f={'raw':![],'where':{'id':_0x1d472d[_0xa66f('0xbe')]['id']}},_0x4298ca={};_0x4298ca['model']=_[_0xa66f('0x49')](db[_0xa66f('0x43')][_0xa66f('0x44')]);_0x4298ca['query']=_['keys'](_0x1d472d['query']);_0x4298ca[_0xa66f('0x4b')]=_['intersection'](_0x4298ca[_0xa66f('0x48')],_0x4298ca[_0xa66f('0x4a')]);_0x3cf40f[_0xa66f('0x4e')]=_[_0xa66f('0x4c')](_0x4298ca['model'],qs[_0xa66f('0x4d')](_0x1d472d[_0xa66f('0x4a')]['fields']));_0x3cf40f[_0xa66f('0x4e')]=_0x3cf40f[_0xa66f('0x4e')]['length']?_0x3cf40f['attributes']:_0x4298ca[_0xa66f('0x48')];if(_0x1d472d[_0xa66f('0x4a')][_0xa66f('0xbf')]){_0x3cf40f['include']=[{'all':!![]}];}_0x3cf40f=_['merge']({},_0x3cf40f,_0x1d472d['options']);return db['ChatInteraction'][_0xa66f('0x77')](_0x3cf40f)[_0xa66f('0x34')](handleEntityNotFound(_0x3cbbb6,null))[_0xa66f('0x34')](respondWithResult(_0x3cbbb6,null))[_0xa66f('0x26')](handleError(_0x3cbbb6,null));};exports[_0xa66f('0xc0')]=function(_0x46c9b2,_0x580eb7){return db[_0xa66f('0x43')][_0xa66f('0xc0')](_0x46c9b2[_0xa66f('0x39')],{})[_0xa66f('0x34')](respondWithResult(_0x580eb7,0xc9))['catch'](handleError(_0x580eb7,null));};exports['update']=function(_0xd78ede,_0xe11c2d){if(_0xd78ede[_0xa66f('0x39')]['id']){delete _0xd78ede[_0xa66f('0x39')]['id'];}return db[_0xa66f('0x43')][_0xa66f('0x77')]({'where':{'id':_0xd78ede[_0xa66f('0xbe')]['id']}})[_0xa66f('0x34')](handleEntityNotFound(_0xe11c2d,null))[_0xa66f('0x34')](saveUpdates(_0xd78ede[_0xa66f('0x39')],null))[_0xa66f('0x34')](respondWithResult(_0xe11c2d,null))['catch'](handleError(_0xe11c2d,null));};exports[_0xa66f('0x35')]=function(_0x597ae3,_0x1b93e0){return db[_0xa66f('0x43')][_0xa66f('0x77')]({'where':{'id':_0x597ae3[_0xa66f('0xbe')]['id']}})[_0xa66f('0x34')](handleEntityNotFound(_0x1b93e0,null))['then'](removeEntity(_0x1b93e0,null))['catch'](handleError(_0x1b93e0,null));};exports['describe']=function(_0x484c8e,_0x728faa){return db[_0xa66f('0x43')][_0xa66f('0xc1')]()[_0xa66f('0x34')](respondWithResult(_0x728faa,null))['catch'](handleError(_0x728faa,null));};exports[_0xa66f('0xc2')]=function(_0x174510,_0x4f3985){var _0x348e6b=_0x174510[_0xa66f('0xbe')]['id'];var _0x4ed950;var _0xe43d63;var _0x3c2367;return db['ChatInteraction'][_0xa66f('0xc3')]({'where':{'id':_0x348e6b}})[_0xa66f('0x34')](function(_0x32bea5){_0x4ed950=_0x32bea5;return db[_0xa66f('0xc4')][_0xa66f('0xc3')]({'where':{'id':_0x32bea5[_0xa66f('0x82')]},'attributes':['id',_0xa66f('0xc5'),_0xa66f('0xc6'),_0xa66f('0xc7'),_0xa66f('0xc8'),_0xa66f('0xc9')],'raw':!![]});})['then'](function(_0x4c8386){if(_0x4c8386&&_0x4c8386[_0xa66f('0xc5')]&&_0x4c8386[_0xa66f('0xc6')]){_0xe43d63=_0x4c8386;var _0x12278e={'interaction':{'id':_0x348e6b},'agent':{'id':_0x174510['user']['id'],'name':_0x174510['user'][_0xa66f('0x37')],'fullname':_0x174510[_0xa66f('0x9f')][_0xa66f('0xca')],'email':_0x174510[_0xa66f('0x9f')][_0xa66f('0xcb')]},'contact':_0x174510['body'][_0xa66f('0x3a')],'account':_0x174510[_0xa66f('0x39')][_0xa66f('0xcc')]};var _0xfc01d7={'rejectUnauthorized':![],'method':'POST','url':_0xa66f('0xcd'),'headers':{'X-APIKEY':_0x4c8386[_0xa66f('0xc5')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x174510['user'][_0xa66f('0xcb')]],'buttons':null,'topic':_0xe43d63[_0xa66f('0xc7')],'note':_['isNull'](_0xe43d63[_0xa66f('0xc8')])?null:getMustacheRender(_0xe43d63[_0xa66f('0xc8')],_0x12278e),'metadata':null},'redirect':_0xa66f('0xce'),'json':!![]};try{if(!_[_0xa66f('0xcf')](_0xe43d63[_0xa66f('0xc9')])){var _0x3c73cc=getMustacheRender(_0xe43d63[_0xa66f('0xc9')],_0x12278e);var _0x4885bb=JSON['parse'](_0x3c73cc);_0xfc01d7[_0xa66f('0x39')][_0xa66f('0xd0')]=_0x4885bb;}}catch(_0x2e7c26){throw new db[(_0xa66f('0x96'))][(_0xa66f('0xd1'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0xfc01d7);}else{throw new db[(_0xa66f('0x96'))][(_0xa66f('0xd1'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xa66f('0x34')](function(_0x56198a){_0x3c2367=_0x56198a;if(_0x3c2367['id']){var _0x41ef9a={'body':_0x3c2367[_0xa66f('0xd2')],'ChatWebsiteId':_0xe43d63['id'],'ChatInteractionId':_0x4ed950['id'],'direction':_0xa66f('0xd3'),'UserId':_0x174510[_0xa66f('0x9f')]['id']};return db['ChatMessage']['create'](_0x41ef9a,{});}else{throw new db['Sequelize'][(_0xa66f('0xd1'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0xa66f('0x34')](function(){return _0x4ed950['updateAttributes']({'vidaooSessionId':_0x3c2367['id']});})[_0xa66f('0x34')](respondWithResult(_0x4f3985,null))[_0xa66f('0x26')](handleError(_0x4f3985,null));};exports['customUpdate']=function(_0x35a2ce,_0x2d3bca){if(_0x35a2ce[_0xa66f('0x39')]['id']){delete _0x35a2ce[_0xa66f('0x39')]['id'];}return db[_0xa66f('0x43')][_0xa66f('0x77')]({'where':{'id':_0x35a2ce[_0xa66f('0xbe')]['id']},'include':[{'model':db['CmContact'],'as':_0xa66f('0x72')}]})[_0xa66f('0x34')](handleEntityNotFound(_0x2d3bca,null))[_0xa66f('0x34')](saveUpdates(_0x35a2ce[_0xa66f('0x39')],null))[_0xa66f('0x34')](respondWithResult(_0x2d3bca,null))[_0xa66f('0x26')](handleError(_0x2d3bca,null));};exports[_0xa66f('0xd4')]=function(_0x3a2c2c,_0x179953,_0x5dcf9d){if(_0x3a2c2c[_0xa66f('0x39')]['id']){delete _0x3a2c2c['body']['id'];}return db[_0xa66f('0x43')][_0xa66f('0x77')]({'where':{'id':_0x3a2c2c[_0xa66f('0xbe')]['id']}})[_0xa66f('0x34')](function(_0x1f4bc4){if(!_0x1f4bc4){logger['error'](_0xa66f('0xd5'),_0xa66f('0xd4'),0x194,_0xa66f('0xd6'));_0x179953[_0xa66f('0x27')](0x194);}else{if(_0x1f4bc4['UserId']){throw new db['Sequelize']['ValidationError'](_0xa66f('0xd7'));}}return _0x1f4bc4;})[_0xa66f('0x34')](function(_0x4be9ae){if(_0x4be9ae){return _0x4be9ae['update']({'closed':_0x3a2c2c[_0xa66f('0x39')][_0xa66f('0xd8')],'disposition':_0x3a2c2c['body'][_0xa66f('0xd9')]})[_0xa66f('0x34')](function(_0x17dc7d){return _0x17dc7d;});}})[_0xa66f('0x34')](function(_0x551c09){return respondWithRpcPromise('AbandonInteraction','abandon',_0x3a2c2c[_0xa66f('0x39')],client9004);})[_0xa66f('0x34')](respondWithResult(_0x179953,null))[_0xa66f('0x26')](handleError(_0x179953,null));};exports[_0xa66f('0xda')]=function(_0x377764,_0x434764,_0x315b27){_0x377764[_0xa66f('0x39')]['name']=_0x377764[_0xa66f('0xdb')][_0xa66f('0xdc')];_0x377764[_0xa66f('0x39')]['basename']=_0x377764[_0xa66f('0xdb')][_0xa66f('0xdd')];_0x377764[_0xa66f('0x39')]['type']=_0x377764['file'][_0xa66f('0xde')];return db[_0xa66f('0xdf')][_0xa66f('0xc0')](_0x377764[_0xa66f('0x39')])[_0xa66f('0x34')](respondWithResult(_0x434764,0xc9))[_0xa66f('0x26')](handleError(_0x434764,null));};exports[_0xa66f('0xe0')]=function(_0x5c5550,_0x383ce6,_0x4b2702){return db[_0xa66f('0x43')][_0xa66f('0xc3')]({'where':{'id':_0x5c5550[_0xa66f('0xbe')]['id']},'raw':!![]})[_0xa66f('0x34')](handleEntityNotFound(_0x383ce6,null))[_0xa66f('0x34')](function(_0x32f7ab){if(_0x32f7ab){if(_0x32f7ab[_0xa66f('0xd8')]){return _0x383ce6[_0xa66f('0x28')](0x193)[_0xa66f('0x2a')]({'status':0x193,'message':_0xa66f('0xe1')});}return db[_0xa66f('0xdf')][_0xa66f('0xc3')]({'where':{'id':_0x5c5550['query']['attachId']},'raw':!![]})[_0xa66f('0x34')](handleEntityNotFound(_0x383ce6,null));}})[_0xa66f('0x34')](function(_0x29ce7f){if(_0x29ce7f){var _0x1248c9=_0x29ce7f[_0xa66f('0xe2')]!==null;var _0x13948a=path['join'](config[_0xa66f('0xe3')],'server/files/attachments/');if(_0x1248c9){_0x13948a=path['join'](_0x13948a,_0xa66f('0xe4'));}var _0x1ce936=path[_0xa66f('0xe5')](_0x13948a,_0x29ce7f[_0xa66f('0xe6')]);return _0x383ce6['download'](_0x1ce936);}})[_0xa66f('0x26')](handleError(_0x383ce6,null));};exports[_0xa66f('0xe7')]=function(_0x1686df,_0x1889f4){var _0x2a03c8=null;var _0x48b16d=null;var _0x5a05e4=null;var _0x1b78fa=null;if(_0x1686df[_0xa66f('0x39')]['id']){delete _0x1686df[_0xa66f('0x39')]['id'];}if(_0x1686df[_0xa66f('0x39')]['mailTranscript']){_0x1b78fa=path[_0xa66f('0xe5')](config[_0xa66f('0xe3')],_0xa66f('0xe8'),util[_0xa66f('0xe9')](_0xa66f('0xea'),Date[_0xa66f('0xeb')]()));_0x1686df[_0xa66f('0x39')][_0xa66f('0xec')]=_0x1b78fa;}return db['ChatInteraction'][_0xa66f('0x77')]({'where':{'id':_0x1686df[_0xa66f('0xbe')]['id']},'include':[{'model':db['ChatMessage'],'as':_0xa66f('0xed'),'include':[{'model':db[_0xa66f('0xee')],'as':_0xa66f('0xee')}]}]})[_0xa66f('0x34')](handleEntityNotFound(_0x1889f4,null))[_0xa66f('0x34')](saveUpdates(_0x1686df['body'],null))[_0xa66f('0x34')](function(_0x4153a0){if(_0x4153a0){_0x2a03c8=_0x4153a0;return db[_0xa66f('0xc4')][_0xa66f('0x77')]({'where':{'id':_0x2a03c8[_0xa66f('0x82')]}});}})['then'](function(_0x820ac1){if(_0x820ac1){_0x5a05e4=_0x820ac1;return db[_0xa66f('0xef')]['find']({'where':{'id':_0x2a03c8[_0xa66f('0xf0')]}});}})[_0xa66f('0x34')](function(_0x22d154){if(_0x22d154){_0x48b16d=_0x22d154;if(_0x1b78fa){var _0x31959f=null;for(var _0x2d3123=0x1;_0x2d3123<_0x2a03c8['Messages'][_0xa66f('0x4f')];++_0x2d3123){_0x31959f=_0x2a03c8[_0xa66f('0xed')][_0x2d3123];var _0x207ea2=_0x31959f[_0xa66f('0x7e')]?util['format'](_0xa66f('0xf1'),_0x5a05e4[_0xa66f('0xf2')],_0x31959f['UserId']):_0xa66f('0xf3');var _0x19fabd=_0x1686df[_0xa66f('0x39')][_0xa66f('0xf4')]||util['format'](_0xa66f('0xf1'),_0xa66f('0xf5'),_0x31959f['ContactId']);switch(_0x5a05e4[_0xa66f('0xf6')]){case _0xa66f('0xf7'):_0x207ea2=_0x31959f[_0xa66f('0x7e')]?util['format'](_0xa66f('0xf1'),_0x5a05e4[_0xa66f('0xf2')],_0x31959f[_0xa66f('0x7e')]):'System';break;case _0xa66f('0xf8'):_0x207ea2=_0x31959f[_0xa66f('0x7e')]?_0x31959f['User']['alias']||_0x31959f[_0xa66f('0xee')][_0xa66f('0xca')]:'System';break;case _0xa66f('0xf9'):_0x207ea2=_0x31959f[_0xa66f('0x7e')]?_0x31959f[_0xa66f('0xee')][_0xa66f('0xca')]:_0xa66f('0xf3');break;default:_0x207ea2=_0x31959f['UserId']?util[_0xa66f('0xe9')](_0xa66f('0xf1'),_0x5a05e4['agentAlias'],_0x31959f[_0xa66f('0x7e')]):'System';}var _0x506797=util[_0xa66f('0xe9')](_0xa66f('0xfa'),moment(_0x31959f['createdAt'])[_0xa66f('0xe9')]('MM/DD/YYYY\x20HH:mm:ss'),_0x31959f[_0xa66f('0xfb')]==='in'?_0x19fabd:_0x207ea2,_0x31959f[_0xa66f('0x39')]);if(!_0x31959f['secret']){fs['appendFileSync'](_0x1b78fa,_0x506797);}}return db['MailAccount'][_0xa66f('0xc3')]({'where':{'service':!![]},'include':[{'model':db[_0xa66f('0xfc')],'as':_0xa66f('0xfd'),'raw':!![]}]});}}})[_0xa66f('0x34')](function(_0x168d31){if(_0x168d31&&_0x168d31[_0xa66f('0xfd')]&&_0x1686df[_0xa66f('0x39')]){var _0x5a762d={'tls':{'rejectUnauthorized':![]}};if(_0x168d31['Smtp'][_0xa66f('0xfe')]){_0x5a762d[_0xa66f('0xfe')]=_0x168d31[_0xa66f('0xfd')][_0xa66f('0xfe')];}else{_0x5a762d[_0xa66f('0xff')]=_0x168d31[_0xa66f('0xfd')]['host'];_0x5a762d[_0xa66f('0x100')]=_0x168d31[_0xa66f('0xfd')]['port'];_0x5a762d[_0xa66f('0x101')]=_0x168d31['Smtp'][_0xa66f('0x101')];}if(_0x168d31['Smtp']['authentication']){_0x5a762d[_0xa66f('0x102')]={'user':_0x168d31[_0xa66f('0xfd')][_0xa66f('0x9f')],'pass':_0x168d31[_0xa66f('0xfd')][_0xa66f('0x103')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x5a762d,'message':{'from':util[_0xa66f('0xe9')](_0xa66f('0x104'),_0x168d31[_0xa66f('0x37')],_0x168d31['email']||_0x168d31['Smtp']['user']),'to':_0x1686df[_0xa66f('0x39')][_0xa66f('0x105')],'subject':_0xa66f('0x106'),'text':util[_0xa66f('0xe9')](_0xa66f('0x107'),_0x1686df[_0xa66f('0x39')]['mailTranscript']),'attachments':[{'path':_0x1b78fa}]}})[_0xa66f('0x34')](function(){return _0x2a03c8;})[_0xa66f('0x26')](function(_0x3215af){console['error'](_0x3215af);});}else{return _0x2a03c8;}})[_0xa66f('0x34')](respondWithStatusCode(_0x1889f4,0xc8))[_0xa66f('0x26')](handleError(_0x1889f4,null));};exports['addMessage']=function(_0x4e4b66,_0x2aaaab,_0x75d882){return db[_0xa66f('0x108')][_0xa66f('0x77')]({'where':{'id':_0x4e4b66['params']['id']}})[_0xa66f('0x34')](handleEntityNotFound(_0x2aaaab,null))[_0xa66f('0x34')](function(_0x21e1d1){if(_0x21e1d1){return _0x21e1d1[_0xa66f('0x109')](_0x4e4b66[_0xa66f('0x39')]['ids'],_[_0xa66f('0x10a')](_0x4e4b66[_0xa66f('0x39')],[_0xa66f('0x10b'),'id'])||{});}})['then'](respondWithResult(_0x2aaaab,null))[_0xa66f('0x26')](handleError(_0x2aaaab,null));};exports[_0xa66f('0x10c')]=function(_0x53170d,_0x5d1e51,_0x3c3aff){var _0x3fb295={'raw':![],'where':{}};var _0x57c403={};var _0x31832f={'count':0x0,'rows':[]};return db[_0xa66f('0x43')][_0xa66f('0xc3')]({'where':{'id':_0x53170d[_0xa66f('0xbe')]['id']}})['then'](handleEntityNotFound(_0x5d1e51,null))[_0xa66f('0x34')](function(_0x43cc99){if(_0x43cc99){_0x57c403['model']=_[_0xa66f('0x49')](db[_0xa66f('0x108')]['rawAttributes']);_0x57c403['query']=_['keys'](_0x53170d[_0xa66f('0x4a')]);_0x57c403[_0xa66f('0x4b')]=_[_0xa66f('0x4c')](_0x57c403[_0xa66f('0x48')],_0x57c403[_0xa66f('0x4a')]);_0x3fb295['attributes']=_[_0xa66f('0x4c')](_0x57c403[_0xa66f('0x48')],qs['fields'](_0x53170d['query']['fields']));_0x3fb295[_0xa66f('0x4e')]=_0x3fb295[_0xa66f('0x4e')][_0xa66f('0x4f')]?_0x3fb295['attributes']:_0x57c403[_0xa66f('0x48')];if(!_0x53170d[_0xa66f('0x4a')][_0xa66f('0x50')]('nolimit')){_0x3fb295[_0xa66f('0x2e')]=qs[_0xa66f('0x2e')](_0x53170d[_0xa66f('0x4a')]['limit']);_0x3fb295[_0xa66f('0x2b')]=qs[_0xa66f('0x2b')](_0x53170d[_0xa66f('0x4a')][_0xa66f('0x2b')]);}_0x3fb295[_0xa66f('0x52')]=qs[_0xa66f('0x53')](_0x53170d[_0xa66f('0x4a')][_0xa66f('0x53')]);_0x3fb295['where']=qs[_0xa66f('0x4b')](_[_0xa66f('0x55')](_0x53170d[_0xa66f('0x4a')],_0x57c403[_0xa66f('0x4b')]));_0x3fb295[_0xa66f('0x54')][_0xa66f('0xbb')]=_0x43cc99['id'];if(_0x53170d[_0xa66f('0x4a')][_0xa66f('0x8d')]){_0x3fb295[_0xa66f('0x54')]=_[_0xa66f('0x10d')](_0x3fb295[_0xa66f('0x54')],{'$or':_[_0xa66f('0x42')](_0x3fb295[_0xa66f('0x4e')],function(_0x2b9a3c){var _0x1d688a={};_0x1d688a[_0x2b9a3c]={'$like':'%'+_0x53170d[_0xa66f('0x4a')][_0xa66f('0x8d')]+'%'};return _0x1d688a;})});}if(_0x53170d['query'][_0xa66f('0x84')]){var _0x570a01=_0x53170d['query']['$gte'][_0xa66f('0x3f')](',');var _0x35919e={};_0x35919e[_0x570a01[0x0]]={'$gte':moment(_0x570a01[0x1])[_0xa66f('0xe9')](_0xa66f('0x10e'))};_0x3fb295[_0xa66f('0x54')]=_['merge'](_0x3fb295[_0xa66f('0x54')],_0x35919e);}_0x3fb295=_['merge']({},_0x3fb295,_0x53170d[_0xa66f('0x10f')]);return db[_0xa66f('0x108')]['count']({'where':_0x3fb295['where']})[_0xa66f('0x34')](function(_0x3517eb){_0x31832f[_0xa66f('0x2d')]=_0x3517eb;if(_0x53170d[_0xa66f('0x4a')][_0xa66f('0xbf')]){_0x3fb295['include']=[{'all':!![]}];}return db[_0xa66f('0x108')]['findAll'](_0x3fb295);})[_0xa66f('0x34')](function(_0x24c209){_0x31832f[_0xa66f('0xbd')]=_0x24c209;return _0x31832f;});}})[_0xa66f('0x34')](respondWithFilteredResult(_0x5d1e51,_0x3fb295))[_0xa66f('0x26')](handleError(_0x5d1e51,null));};exports[_0xa66f('0x110')]=function(_0x1ef4c2,_0x21ec7f,_0x32b1c1){var _0x4ee9a3={'where':{}},_0x12889f={},_0xc813ad={'count':0x0,'rows':[]};return db[_0xa66f('0x43')]['findOne']({'where':{'id':_0x1ef4c2['params']['id']}})[_0xa66f('0x34')](handleEntityNotFound(_0x21ec7f,null))[_0xa66f('0x34')](function(_0x3a1e4a){if(_0x3a1e4a){_0x12889f['model']=_[_0xa66f('0x49')](db[_0xa66f('0x108')]['rawAttributes']);_0x12889f[_0xa66f('0x4a')]=_[_0xa66f('0x49')](_0x1ef4c2[_0xa66f('0x4a')]);_0x12889f[_0xa66f('0x4b')]=_[_0xa66f('0x4c')](_0x12889f[_0xa66f('0x48')],_0x12889f[_0xa66f('0x4a')]);_0x4ee9a3[_0xa66f('0x4e')]=_[_0xa66f('0x4c')](_0x12889f[_0xa66f('0x48')],qs[_0xa66f('0x4d')](_0x1ef4c2[_0xa66f('0x4a')]['fields']));_0x4ee9a3[_0xa66f('0x4e')]=_0x4ee9a3[_0xa66f('0x4e')][_0xa66f('0x4f')]?_0x4ee9a3[_0xa66f('0x4e')]:_0x12889f['model'];if(!_0x1ef4c2[_0xa66f('0x4a')]['hasOwnProperty'](_0xa66f('0x51'))){_0x4ee9a3[_0xa66f('0x2e')]=qs['limit'](_0x1ef4c2['query'][_0xa66f('0x2e')]);_0x4ee9a3[_0xa66f('0x2b')]=qs[_0xa66f('0x2b')](_0x1ef4c2[_0xa66f('0x4a')][_0xa66f('0x2b')]);}_0x4ee9a3[_0xa66f('0x52')]=qs['sort'](_0x1ef4c2['query']['sort']);_0x4ee9a3[_0xa66f('0x54')]=qs[_0xa66f('0x4b')](_[_0xa66f('0x55')](_0x1ef4c2[_0xa66f('0x4a')],_0x12889f[_0xa66f('0x4b')]));_0x4ee9a3['where'][_0xa66f('0xbb')]=_0x3a1e4a['id'];if(_0x1ef4c2['query'][_0xa66f('0x8d')]){_0x4ee9a3[_0xa66f('0x54')]=_[_0xa66f('0x10d')](_0x4ee9a3['where'],{'$or':_['map'](_0x4ee9a3[_0xa66f('0x4e')],function(_0x2bf349){var _0x211ac6={};_0x211ac6[_0x2bf349]={'$like':'%'+_0x1ef4c2[_0xa66f('0x4a')][_0xa66f('0x8d')]+'%'};return _0x211ac6;})});}_0x4ee9a3[_0xa66f('0x54')]['secret']=![];if(_0x1ef4c2[_0xa66f('0x4a')]['id']){_0x4ee9a3['where']['id']={'$gt':_0x1ef4c2['query']['id']};}_0x4ee9a3=_[_0xa66f('0x10d')]({},_0x4ee9a3,_0x1ef4c2[_0xa66f('0x10f')]);return db[_0xa66f('0x108')]['count']({'where':_0x4ee9a3['where']})['then'](function(_0x533dc1){_0xc813ad[_0xa66f('0x2d')]=_0x533dc1;_0x4ee9a3[_0xa66f('0x111')]=[];if(_0x1ef4c2[_0xa66f('0x4a')][_0xa66f('0x112')]){_0x4ee9a3[_0xa66f('0x111')][_0xa66f('0x41')]({'model':db[_0xa66f('0xee')],'as':_0xa66f('0xee'),'attributes':['id',_0xa66f('0xca'),_0xa66f('0x113')]});}if(_0x1ef4c2[_0xa66f('0x4a')][_0xa66f('0xbf')]){_0x4ee9a3[_0xa66f('0x111')]=[{'all':!![]}];}return db[_0xa66f('0x108')]['findAll'](_0x4ee9a3);})['then'](function(_0x554ba6){_0xc813ad[_0xa66f('0xbd')]=_0x554ba6;return _0xc813ad;});}})[_0xa66f('0x34')](respondWithFilteredResult(_0x21ec7f,_0x4ee9a3))[_0xa66f('0x26')](handleError(_0x21ec7f,null));};exports[_0xa66f('0x114')]=function(_0x1a3bac,_0x44649c,_0x5e4fbc){return db[_0xa66f('0x43')][_0xa66f('0x77')]({'where':{'id':_0x1a3bac[_0xa66f('0xbe')]['id']}})['then'](handleEntityNotFound(_0x44649c,null))[_0xa66f('0x34')](function(_0x1d2967){if(_0x1d2967){return _0x1d2967[_0xa66f('0x115')](_0x1a3bac[_0xa66f('0x39')][_0xa66f('0x10b')],_[_0xa66f('0x10a')](_0x1a3bac[_0xa66f('0x39')],[_0xa66f('0x10b'),'id'])||{})['spread'](function(){return db[_0xa66f('0x7a')][_0xa66f('0x116')]({'attributes':['id','name',_0xa66f('0x117')],'where':{'id':_0x1a3bac[_0xa66f('0x39')][_0xa66f('0x10b')]}});})['then'](function(_0x367549){socket[_0xa66f('0x118')](_0xa66f('0x119'),{'id':Number(_0x1a3bac['params']['id']),'tags':_0x367549||[]});return{'id':Number(_0x1a3bac[_0xa66f('0xbe')]['id']),'tags':_0x367549||[]};});}})[_0xa66f('0x34')](respondWithResult(_0x44649c,null))[_0xa66f('0x26')](handleError(_0x44649c,null));};exports[_0xa66f('0x11a')]=function(_0x4a1613,_0x324b7e,_0x1d3395){return db[_0xa66f('0x43')][_0xa66f('0x77')]({'where':{'id':_0x4a1613[_0xa66f('0xbe')]['id']}})[_0xa66f('0x34')](handleEntityNotFound(_0x324b7e,null))[_0xa66f('0x34')](function(_0x33f1ea){if(_0x33f1ea){return _0x33f1ea[_0xa66f('0x11a')](_0x4a1613[_0xa66f('0x4a')]['ids']);}})[_0xa66f('0x34')](respondWithStatusCode(_0x324b7e,null))['catch'](handleError(_0x324b7e,null));};exports[_0xa66f('0x11b')]=function(_0xd7dccf,_0x2b4238){var _0x321fa1=moment()['unix']()['toString']();var _0x254599=path[_0xa66f('0xe5')](config[_0xa66f('0xe3')],_0xa66f('0x11c'),_0xa66f('0x11d'),_0xa66f('0x11e'));var _0x3b9ff3=path['join'](config[_0xa66f('0xe3')],_0xa66f('0x11c'),'files',_0xa66f('0x11f'));var _0x5206a5=path['join'](_0x254599,_0x321fa1);var _0x6b60bd=util[_0xa66f('0xe9')](_0xa66f('0x120'),_0xd7dccf['params']['id'],_0x321fa1);var _0x3709b6=path['join'](_0x254599,_0x6b60bd);var _0x21bda3=[];_0x21bda3[_0xa66f('0x41')]({'model':db['User'],'as':_0xa66f('0xee'),'attributes':['id',_0xa66f('0xca')],'raw':!![]});_0x21bda3[_0xa66f('0x41')]({'model':db[_0xa66f('0xef')],'as':_0xa66f('0x72'),'attributes':['id',_0xa66f('0x121'),_0xa66f('0x122')],'raw':!![]});if(_0xd7dccf['query'][_0xa66f('0x11f')]){_0x21bda3[_0xa66f('0x41')]({'model':db['Attachment'],'as':_0xa66f('0xdf'),'raw':!![]});}var _0x22e7a6=[{'model':db[_0xa66f('0x108')],'as':_0xa66f('0xed'),'attributes':['id',_0xa66f('0x39'),_0xa66f('0x123'),_0xa66f('0xfb'),_0xa66f('0x124'),_0xa66f('0x125')],'include':_0x21bda3}];_0x22e7a6[_0xa66f('0x41')]({'model':db[_0xa66f('0xc4')],'as':_0xa66f('0x126'),'attributes':['id','name']});_0x22e7a6[_0xa66f('0x41')]({'model':db['User'],'as':_0xa66f('0x127'),'attributes':['id',_0xa66f('0xca')]});return db[_0xa66f('0x43')][_0xa66f('0x77')]({'where':{'id':_0xd7dccf[_0xa66f('0xbe')]['id']},'include':_0x22e7a6})[_0xa66f('0x34')](handleEntityNotFound(_0x2b4238,null))[_0xa66f('0x34')](function(_0x5efd6c){if(_0x5efd6c){var _0x24ee72=_0x5efd6c['get']({'plain':!![]});fs[_0xa66f('0x128')](_0x5206a5);var _0xdbb792={'channel':_0xa66f('0x129'),'account':_0x24ee72['Account'][_0xa66f('0x37')],'agent':_0x24ee72[_0xa66f('0x127')]?_0x24ee72['Owner']['fullname']:_0xa66f('0x12a'),'createdAt':moment(_0x24ee72[_0xa66f('0x123')])[_0xa66f('0xe9')]('YYYY-MM-DD\x20HH:mm:ss')[_0xa66f('0xa3')](),'closedAt':_0x24ee72[_0xa66f('0xd8')]?moment(_0x24ee72[_0xa66f('0x12b')])['format'](_0xa66f('0x10e'))[_0xa66f('0xa3')]():'','disposition':_0x24ee72[_0xa66f('0xd9')],'chatInfo':{'browser':_0x24ee72[_0xa66f('0x12c')],'os':_0x24ee72[_0xa66f('0x12d')],'referer':_0x24ee72['referer'],'customerIp':_0x24ee72[_0xa66f('0x12e')],'customerPort':_0x24ee72[_0xa66f('0x12f')]?_0x24ee72[_0xa66f('0x12f')]:_0xa66f('0x12a')},'messages':_(_0x24ee72[_0xa66f('0xed')])[_0xa66f('0x130')]()['filter']({'secret':![]})[_0xa66f('0x42')](function(_0x31cc20){if(_0x31cc20['Attachment']){var _0x10a611=path[_0xa66f('0xe5')](_0x3b9ff3,_0x31cc20['Attachment'][_0xa66f('0xe6')]);if(fs[_0xa66f('0x131')](_0x10a611)){fs[_0xa66f('0x132')](_0x10a611)['pipe'](fs[_0xa66f('0x133')](path['join'](_0x5206a5,_0x31cc20['Attachment']['basename'])));}}return{'date':moment(_0x31cc20['createdAt'])['format'](_0xa66f('0x10e'))['toString'](),'sender':_0x31cc20[_0xa66f('0xfb')]===_0xa66f('0xd3')?_0x31cc20[_0xa66f('0xee')]?_0x31cc20[_0xa66f('0xee')][_0xa66f('0xca')]:_0xa66f('0xf3'):_0x31cc20[_0xa66f('0x72')][_0xa66f('0x121')]+(_0x31cc20[_0xa66f('0x72')][_0xa66f('0x122')]?'\x20'+_0x31cc20[_0xa66f('0x72')][_0xa66f('0x122')]:''),'body':_0x31cc20[_0xa66f('0xdf')]?_0x31cc20[_0xa66f('0xdf')][_0xa66f('0xe6')]:_0x31cc20[_0xa66f('0x39')],'direction':_0x31cc20[_0xa66f('0xfb')]==='out'?'A':'C','secret':_0x31cc20['secret'],'read':_0x31cc20[_0xa66f('0x125')],'attachment':_0x31cc20[_0xa66f('0xdf')]};})[_0xa66f('0x6e')]()};return ejs[_0xa66f('0x134')](path[_0xa66f('0xe5')](config[_0xa66f('0xe3')],_0xa66f('0x11c'),'views',_0xa66f('0x135')),{'interaction':_0xdbb792})['then'](function(_0x12024d){var _0x4baf59=path[_0xa66f('0xe5')](_0x5206a5,_0xa66f('0x136')+_0x24ee72['id']+'-'+_0x321fa1+'.pdf');var _0x33198c={'path':_0x4baf59,'channel':_0xa66f('0x129'),'interactionId':_0x24ee72['id']};return pdf[_0xa66f('0x137')](_0x12024d,_0x33198c);})[_0xa66f('0x34')](function(){return new BPromise(function(_0x3792b2,_0x5101f8){zipdir(_0x5206a5,{'saveTo':_0x3709b6},function(_0x4ac4b4,_0x171111){if(_0x4ac4b4)return _0x5101f8(_0x4ac4b4);return _0x3792b2(_0x171111);});})[_0xa66f('0x34')](function(){return new BPromise(function(_0x46691d,_0x136518){rimraf(_0x5206a5,function(_0x1404df){if(_0x1404df)_0x136518(_0x1404df);return _0x46691d();});});})[_0xa66f('0x34')](function(){return _0x2b4238[_0xa66f('0x11b')](_0x3709b6,_0x6b60bd,function(_0x58f445){if(_0x58f445){console[_0xa66f('0x138')](_0xa66f('0x139'),_0x58f445);}else{fs['unlinkSync'](_0x3709b6);}});});});}else{return _0x2b4238[_0xa66f('0x27')](0xc8);}})['catch'](handleError(_0x2b4238,null));}; \ No newline at end of file +var _0x9ffd=['MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','agent','getChatWebsites','isEmpty','i.ChatWebsiteId\x20IS\x20NULL','role','sequelize','keyBy','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.ChatInteractionId\x20IN\x20?','groupBy','params','includeAll','find','destroy','describe','createVidaooSession','findOne','ChatWebsite','vidaooNote','vidaooApiKey','vidaooEscalation','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','vidaooMetadata','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','ChatMessage','create','updateAttributes','customUpdate','abandonInteraction,\x20%s,\x20%s,\x20%s','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','abandon','attachmentUpload','file','originalname','basename','filename','Attachment','attachmentDownload','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','%s%d','agentAlias','System','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','addMessage','ids','omit','getMessages','ChatInteractionId','YYYY-MM-DD\x20HH:mm:ss','options','findAll','rows','secret','include','includeAgent','push','setTags','spread','Tag','emit','chatInteractionTags:save','removeTags','unix','tmp','server','files','CmContact','firstName','attachments','Account','Owner','get','mkdirSync','Chat','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','lastName','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','stack','name','render','merge','body','contact','account','Users','fullname','Tags','TagIds','split','forEach','index','ChatInteraction','rawAttributes','fieldName','type','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','select','field','color','from','left_join','u.id\x20=\x20ui.UserId','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','parseSearch','search','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','map','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','compact','ChatWebsiteId','where','i.ChatWebsiteId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x39874a,_0x3e9340){_0x39874a=_0x39874a-0x0;var _0x12a8fe=_0x9ffd[_0x39874a];return _0x12a8fe;};'use strict';var emlformat=require(_0xd9ff('0x0'));var rimraf=require(_0xd9ff('0x1'));var zipdir=require(_0xd9ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9ff('0x3'));var moment=require(_0xd9ff('0x4'));var BPromise=require(_0xd9ff('0x5'));var Mustache=require(_0xd9ff('0x6'));var util=require('util');var path=require(_0xd9ff('0x7'));var sox=require(_0xd9ff('0x8'));var csv=require('to-csv');var ejs=require(_0xd9ff('0x9'));var fs=require('fs');var fs_extra=require(_0xd9ff('0xa'));var _=require(_0xd9ff('0xb'));var squel=require(_0xd9ff('0xc'));var crypto=require(_0xd9ff('0xd'));var jsforce=require(_0xd9ff('0xe'));var deskjs=require(_0xd9ff('0xf'));var toCsv=require(_0xd9ff('0x10'));var querystring=require(_0xd9ff('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd9ff('0x12'));var pdf=require(_0xd9ff('0x13'));var hardwareService=require(_0xd9ff('0x14'));var logger=require(_0xd9ff('0x15'))(_0xd9ff('0x16'));var utils=require(_0xd9ff('0x17'));var config=require(_0xd9ff('0x18'));var licenseUtil=require(_0xd9ff('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xd9ff('0x1a')](config[_0xd9ff('0x1b')],{'host':_0xd9ff('0x1c'),'port':0x18eb});var socket=require(_0xd9ff('0x1d'))(new Redis(config[_0xd9ff('0x1b')]));require('./chatInteraction.socket')[_0xd9ff('0x1e')](socket);var jayson=require(_0xd9ff('0x1f'));var client=jayson['client'][_0xd9ff('0x20')]({'port':0x232b});var client9004=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x547e28,_0x4c5718,_0x271287,_0x4f9d6d){return new BPromise(function(_0x35679e,_0xa30fd2){var _0x39c6ce=_0x4f9d6d||client;return _0x39c6ce[_0xd9ff('0x21')](_0x547e28,_0x271287)[_0xd9ff('0x22')](function(_0x2d4df1){logger[_0xd9ff('0x23')](_0xd9ff('0x24'),_0x4c5718,_0xd9ff('0x25'));logger[_0xd9ff('0x26')](_0xd9ff('0x27'),_0x4c5718,_0xd9ff('0x25'),JSON[_0xd9ff('0x28')](_0x2d4df1));if(_0x2d4df1['error']){if(_0x2d4df1['error'][_0xd9ff('0x29')]===0x1f4){logger[_0xd9ff('0x2a')]('ChatInteraction,\x20%s,\x20%s',_0x4c5718,_0x2d4df1['error']['message']);return _0xa30fd2(_0x2d4df1['error'][_0xd9ff('0x2b')]);}logger['error'](_0xd9ff('0x24'),_0x4c5718,_0x2d4df1[_0xd9ff('0x2a')][_0xd9ff('0x2b')]);return _0x35679e(_0x2d4df1[_0xd9ff('0x2a')][_0xd9ff('0x2b')]);}else{logger[_0xd9ff('0x23')]('ChatInteraction,\x20%s,\x20%s',_0x4c5718,'request\x20sent');_0x35679e(_0x2d4df1[_0xd9ff('0x2c')]['message']);}})[_0xd9ff('0x2d')](function(_0x4d86fe){logger[_0xd9ff('0x2a')]('ChatInteraction,\x20%s,\x20%s',_0x4c5718,_0x4d86fe);_0xa30fd2(_0x4d86fe);});});}function respondWithStatusCode(_0x10cbdd,_0x159e56){_0x159e56=_0x159e56||0xcc;return function(_0x2138b4){if(_0x2138b4){return _0x10cbdd[_0xd9ff('0x2e')](_0x159e56);}return _0x10cbdd['status'](_0x159e56)[_0xd9ff('0x2f')]();};}function respondWithResult(_0xe11f88,_0x1c78c4){_0x1c78c4=_0x1c78c4||0xc8;return function(_0x4390f7){if(_0x4390f7){return _0xe11f88['status'](_0x1c78c4)[_0xd9ff('0x30')](_0x4390f7);}};}function respondWithFilteredResult(_0x3792d9,_0x44b5a7){return function(_0x45fb63){if(_0x45fb63){var _0x263d3a=typeof _0x44b5a7[_0xd9ff('0x31')]===_0xd9ff('0x32')&&typeof _0x44b5a7[_0xd9ff('0x33')]===_0xd9ff('0x32');var _0x5706cf=_0x45fb63[_0xd9ff('0x34')];var _0x4ba2be=_0x263d3a?0x0:_0x44b5a7[_0xd9ff('0x31')];var _0x29c532=_0x263d3a?_0x45fb63[_0xd9ff('0x34')]:_0x44b5a7['offset']+_0x44b5a7[_0xd9ff('0x33')];var _0x3b26da;if(_0x29c532>=_0x5706cf){_0x29c532=_0x5706cf;_0x3b26da=0xc8;}else{_0x3b26da=0xce;}_0x3792d9[_0xd9ff('0x35')](_0x3b26da);return _0x3792d9[_0xd9ff('0x36')]('Content-Range',_0x4ba2be+'-'+_0x29c532+'/'+_0x5706cf)[_0xd9ff('0x30')](_0x45fb63);}return null;};}function patchUpdates(_0x5743de){return function(_0x18c28b){try{jsonpatch[_0xd9ff('0x37')](_0x18c28b,_0x5743de,!![]);}catch(_0x323cb5){return BPromise[_0xd9ff('0x38')](_0x323cb5);}return _0x18c28b[_0xd9ff('0x39')]();};}function saveUpdates(_0xdf3947,_0x2cc2ae){return function(_0x281c7b){if(_0x281c7b){return _0x281c7b[_0xd9ff('0x3a')](_0xdf3947)[_0xd9ff('0x22')](function(_0x4813a5){return _0x4813a5;});}return null;};}function removeEntity(_0x34e9a9,_0x4670e4){return function(_0x66f4d){if(_0x66f4d){return _0x66f4d['destroy']()[_0xd9ff('0x22')](function(){_0x34e9a9[_0xd9ff('0x35')](0xcc)[_0xd9ff('0x2f')]();});}};}function handleEntityNotFound(_0x4ab10f,_0x3d449d){return function(_0x5e3ff9){if(!_0x5e3ff9){_0x4ab10f[_0xd9ff('0x2e')](0x194);}return _0x5e3ff9;};}function handleError(_0x4ae56b,_0x20a021){_0x20a021=_0x20a021||0x1f4;return function(_0x5db498){logger[_0xd9ff('0x2a')](_0x5db498[_0xd9ff('0x3b')]);if(_0x5db498[_0xd9ff('0x3c')]){delete _0x5db498['name'];}_0x4ae56b['status'](_0x20a021)['send'](_0x5db498);};}function getMustacheRender(_0x7ac3d1,_0x30fc5b){return Mustache[_0xd9ff('0x3d')](_0x7ac3d1,_[_0xd9ff('0x3e')](_0x30fc5b[_0xd9ff('0x3f')],{'contact':_0x30fc5b[_0xd9ff('0x40')],'message':_0x30fc5b['message'],'agent':_0x30fc5b['agent'],'interaction':_0x30fc5b['interaction'],'account':_0x30fc5b[_0xd9ff('0x41')]}))||'';}function getInteractionUsers(_0x252edc,_0x918c9a){return new BPromise(function(_0x32adae,_0x56b94d){try{if(_0x918c9a[_0x252edc['id']]){_0x252edc[_0xd9ff('0x42')]=_['map'](_0x918c9a[_0x252edc['id']],function(_0x3cff52){return{'id':_0x3cff52['id'],'fullname':_0x3cff52[_0xd9ff('0x43')]};});}}catch(_0x1bedaf){_0x56b94d(_0x1bedaf);}_0x32adae(_0x252edc);});}function getInteractionTags(_0x169dc7,_0x59fc07){return new BPromise(function(_0x1e34da,_0x2d4d97){try{if(_0x169dc7['TagIds']){_0x169dc7[_0xd9ff('0x44')]=[];_0x169dc7[_0xd9ff('0x45')][_0xd9ff('0x46')](',')[_0xd9ff('0x47')](function(_0x1fe44d){_0x169dc7[_0xd9ff('0x44')]['push'](_0x59fc07[_0x1fe44d]);});}delete _0x169dc7[_0xd9ff('0x45')];}catch(_0x116f28){_0x2d4d97(_0x116f28);}_0x1e34da(_0x169dc7);});}function updateChatInteraction(_0x10533a,_0x39fbbb,_0x472724){return new BPromise(function(_0x52aab8,_0x3178cd){return getInteractionUsers(_0x10533a,_0x472724)[_0xd9ff('0x22')](function(_0xe0bc49){return getInteractionTags(_0xe0bc49,_0x39fbbb);})['then'](function(_0x5d06dd){_0x52aab8(_0x5d06dd);})[_0xd9ff('0x2d')](function(_0x7eb1a){_0x3178cd(_0x7eb1a);});});}exports[_0xd9ff('0x48')]=function(_0x2dfb8f,_0x437561){var _0x30c69d={},_0x564ef4={},_0xd64585={'count':0x0,'rows':[]};var _0x2d3013=_['map'](db[_0xd9ff('0x49')][_0xd9ff('0x4a')],function(_0x13a1ec){return{'name':_0x13a1ec[_0xd9ff('0x4b')],'type':_0x13a1ec[_0xd9ff('0x4c')]['key']};});_0x564ef4['model']=_['map'](_0x2d3013,_0xd9ff('0x3c'));_0x564ef4['query']=_[_0xd9ff('0x4d')](_0x2dfb8f[_0xd9ff('0x4e')]);_0x564ef4[_0xd9ff('0x4f')]=_['intersection'](_0x564ef4[_0xd9ff('0x50')],_0x564ef4[_0xd9ff('0x4e')]);_0x30c69d['attributes']=_[_0xd9ff('0x51')](_0x564ef4[_0xd9ff('0x50')],qs[_0xd9ff('0x52')](_0x2dfb8f[_0xd9ff('0x4e')]['fields']));_0x30c69d[_0xd9ff('0x53')]=_0x30c69d['attributes'][_0xd9ff('0x54')]?_0x30c69d['attributes']:_0x564ef4[_0xd9ff('0x50')];if(!_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x55')](_0xd9ff('0x56'))){_0x30c69d[_0xd9ff('0x33')]=qs['limit'](_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x33')]);_0x30c69d[_0xd9ff('0x31')]=qs[_0xd9ff('0x31')](_0x2dfb8f['query']['offset']);}_0x30c69d['order']=qs[_0xd9ff('0x57')](_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x57')]);_0x30c69d['where']=qs[_0xd9ff('0x4f')](_[_0xd9ff('0x58')](_0x2dfb8f[_0xd9ff('0x4e')],_0x564ef4[_0xd9ff('0x4f')]),_0x2d3013);var _0xfede73=[];var _0x40d391=squel[_0xd9ff('0x59')]()[_0xd9ff('0x5a')]('id')[_0xd9ff('0x5a')](_0xd9ff('0x3c'))[_0xd9ff('0x5a')](_0xd9ff('0x5b'))[_0xd9ff('0x5c')]('tools_tags');var _0x3ed112=squel['select']()[_0xd9ff('0x5a')]('u.id')[_0xd9ff('0x5a')]('u.fullname')[_0xd9ff('0x5a')]('ui.ChatInteractionId')[_0xd9ff('0x5c')]('user_has_chat_interactions','ui')[_0xd9ff('0x5d')]('users','u',_0xd9ff('0x5e'));var _0x5da1a8=squel[_0xd9ff('0x59')]()[_0xd9ff('0x5c')](_0xd9ff('0x5f'),'i')[_0xd9ff('0x5d')]('cm_contacts','c',_0xd9ff('0x60'))[_0xd9ff('0x5d')](_0xd9ff('0x61'),'o','o.id\x20=\x20i.UserId')[_0xd9ff('0x5d')](_0xd9ff('0x62'),'a',_0xd9ff('0x63'))[_0xd9ff('0x5d')](_0xd9ff('0x64'),'me','me.ChatInteractionId\x20=\x20i.id')[_0xd9ff('0x5d')](_0xd9ff('0x65'),'it',_0xd9ff('0x66'))[_0xd9ff('0x5d')](_0xd9ff('0x67'),'t',_0xd9ff('0x68'));var _0x458fd4=squel['expr']();var _0x3be850=[];var _0x11251f=squel['expr']();var _0x1c885f;if(_0x2dfb8f[_0xd9ff('0x4e')]['search']){_0x1c885f=as[_0xd9ff('0x69')](_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x6a')]);var _0x54ea27=_0x1c885f['sqlOperator'];for(var _0x39473e=0x0;_0x39473e<_0x1c885f['conditions'][_0xd9ff('0x54')];_0x39473e++){var _0x1e4d0c=_0x1c885f[_0xd9ff('0x6b')][_0x39473e];var _0x102aea='i';var _0x53a230=_['find'](_0x2d3013,['name',_0x1e4d0c[_0xd9ff('0x5a')]]);if(!_0x53a230){switch(_0x1e4d0c[_0xd9ff('0x5a')]){case _0xd9ff('0x6c'):if(_0x1e4d0c[_0xd9ff('0x6d')]==0x1){_0x5da1a8[_0xd9ff('0x6e')]('`'+_0x1e4d0c['field']+_0xd9ff('0x6f'));}else{_0x5da1a8['having']('`'+_0x1e4d0c[_0xd9ff('0x5a')]+_0xd9ff('0x70'));}break;case _0xd9ff('0x71'):if(_0x1e4d0c[_0xd9ff('0x72')]===_0xd9ff('0x73')){if(_0x1e4d0c[_0xd9ff('0x6d')][_0xd9ff('0x46')]('\x20')[_0xd9ff('0x54')]>0x1){_0x458fd4[_0x54ea27]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd9ff('0x74')](_0x1e4d0c[_0xd9ff('0x6d')]),null);}else{var _0x4f5338='%'+_0x1e4d0c['value']+'%';_0x458fd4[_0x54ea27](_0xd9ff('0x75'),_0x4f5338,_0x4f5338,_0x4f5338);}}else{_0x53a230=_['find'](_0x2d3013,[_0xd9ff('0x3c'),_0xd9ff('0x76')]);_0x1e4d0c['field']=_0xd9ff('0x76');_0x58c9c2=as[_0xd9ff('0x77')](_0x102aea,_0x53a230[_0xd9ff('0x4c')],_0x1e4d0c);_0x458fd4[_0x54ea27](_0x58c9c2[_0xd9ff('0x78')],_0x58c9c2[_0xd9ff('0x6d')]['start'],_0x58c9c2[_0xd9ff('0x6d')]['end']);}break;case'Tag':var _0x3dabb1=_0x1e4d0c[_0xd9ff('0x6d')][_0xd9ff('0x46')](',')[_0xd9ff('0x79')](function(_0x56d822){return Number(_0x56d822);});_0x3dabb1[_0xd9ff('0x47')](function(_0x23b816){_0x11251f['or'](_0xd9ff('0x7a'),'%,'+_0x23b816+',%');});_0x3be850=_[_0xd9ff('0x7b')](_0x3be850,_0x3dabb1);break;case _0xd9ff('0x7c'):if(_0x1e4d0c[_0xd9ff('0x72')]===_0xd9ff('0x73')){_0x458fd4[_0x54ea27](_0xd9ff('0x7d'),'%'+_0x1e4d0c['value']+'%',null);}else{_0x53a230=_['find'](_0x2d3013,['name',_0xd9ff('0x7e')]);_0x1e4d0c[_0xd9ff('0x5a')]='UserId';_0x58c9c2=as[_0xd9ff('0x77')](_0x102aea,_0x53a230[_0xd9ff('0x4c')],_0x1e4d0c);_0x458fd4[_0x54ea27](_0x58c9c2[_0xd9ff('0x78')],_0x58c9c2[_0xd9ff('0x6d')][_0xd9ff('0x7f')],_0x58c9c2[_0xd9ff('0x6d')][_0xd9ff('0x2f')]);}break;case _0xd9ff('0x3f'):_0x58c9c2=as['buildExpression']('me',null,_0x1e4d0c);_0x458fd4[_0x54ea27](_0x58c9c2[_0xd9ff('0x78')],_0x58c9c2[_0xd9ff('0x6d')][_0xd9ff('0x7f')],_0x58c9c2['value'][_0xd9ff('0x2f')]);break;}}else{var _0x58c9c2=as[_0xd9ff('0x77')](_0x102aea,_0x53a230[_0xd9ff('0x4c')],_0x1e4d0c);_0x458fd4[_0x54ea27](_0x58c9c2[_0xd9ff('0x78')],_0x58c9c2['value'][_0xd9ff('0x7f')],_0x58c9c2[_0xd9ff('0x6d')][_0xd9ff('0x2f')]);}}}else{var _0x1cd620=_(_0x2dfb8f['query'])[_0xd9ff('0x4d')]()[_0xd9ff('0x79')](function(_0x1de5c9){return _['some'](_0x2d3013,[_0xd9ff('0x3c'),_0x1de5c9])?_0x1de5c9:undefined;})[_0xd9ff('0x80')]()[_0xd9ff('0x6d')]();if(!_['isEmpty'](_0x1cd620)){_0x1cd620[_0xd9ff('0x47')](function(_0x35926f){if(_0x35926f===_0xd9ff('0x81')){_0x5da1a8[_0xd9ff('0x82')](_0xd9ff('0x83'),[]['concat'](_0x2dfb8f[_0xd9ff('0x4e')][_0x35926f]));}else if(_0x35926f===_0xd9ff('0x84')){var _0x59af0a=JSON[_0xd9ff('0x85')](_0x2dfb8f[_0xd9ff('0x4e')][_0x35926f])[_0xd9ff('0x86')];var _0x5d1973=JSON[_0xd9ff('0x85')](_0x2dfb8f['query'][_0x35926f])[_0xd9ff('0x87')];_0x5da1a8['where'](_0xd9ff('0x88'),_0x59af0a,_0x5d1973);}else{if(_0x2dfb8f[_0xd9ff('0x4e')][_0x35926f]===_0xd9ff('0x89')){_0x5da1a8[_0xd9ff('0x82')]('i.'+_0x35926f+_0xd9ff('0x8a'));}else{_0x5da1a8[_0xd9ff('0x82')]('i.'+_0x35926f+_0xd9ff('0x8b'),_0x2dfb8f[_0xd9ff('0x4e')][_0x35926f]);}}});}if(_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x8c')]){if(_0x2dfb8f['query'][_0xd9ff('0x8c')]==0x1){_0x5da1a8[_0xd9ff('0x6e')](_0xd9ff('0x8d'));}else{_0x5da1a8[_0xd9ff('0x6e')](_0xd9ff('0x8e'));}}if(_0x2dfb8f[_0xd9ff('0x4e')]['tag']){_0x3be850=_['isArray'](_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x8f')])?_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x8f')]:new Array(_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x8f')]);_0x3be850['forEach'](function(_0x1d34a1){_0x11251f['or'](_0xd9ff('0x7a'),'%,'+_0x1d34a1+',%');});}if(_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x90')]){var _0x14c89f=_0x2dfb8f[_0xd9ff('0x4e')]['filter'][_0xd9ff('0x91')]('\x5c','\x5c\x5c')[_0xd9ff('0x91')](/'/g,'\x27\x27');if(qs[_0xd9ff('0x92')](_0x14c89f)){_0x458fd4['or'](_0xd9ff('0x93'),_0x14c89f+'%');}else{_0x458fd4['or'](_0xd9ff('0x94'),qs[_0xd9ff('0x74')](_0x14c89f))['or'](_0xd9ff('0x95'),_0x14c89f+'%');}}}_0x5da1a8[_0xd9ff('0x82')](_0x458fd4);_0x5da1a8['group'](_0xd9ff('0x96'));var _0x4c2ad5={'type':db[_0xd9ff('0x97')][_0xd9ff('0x98')][_0xd9ff('0x99')],'raw':!![]};var _0x2d2d1c=_0x5da1a8[_0xd9ff('0x9a')]();_0x2d2d1c[_0xd9ff('0x5a')](_0xd9ff('0x96'));_0x2d2d1c[_0xd9ff('0x5a')](_0xd9ff('0x9b'),_0xd9ff('0x6c'));if(_0x30c69d[_0xd9ff('0x9c')]){_0x30c69d[_0xd9ff('0x9c')][_0xd9ff('0x47')](function(_0x5d29b9){var _0x4413c4=_0x5d29b9[0x0]===_0xd9ff('0x9d')?_0x5d29b9[0x0]:'i.'+_0x5d29b9[0x0];_0x5da1a8[_0xd9ff('0x9c')](_0x4413c4,_0x5d29b9[0x1]===_0xd9ff('0x9e')?![]:!![]);});}if(!_['isEmpty'](_0x3be850)){_0x5da1a8[_0xd9ff('0x6e')](_0x11251f);_0x2d2d1c[_0xd9ff('0x82')]('t.id\x20IN\x20?',_0x3be850);}BPromise[_0xd9ff('0x9f')]()[_0xd9ff('0x22')](function(){if(!_0x1c885f){if(_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x81')])return;_0x2d2d1c[_0xd9ff('0x82')](_0xd9ff('0xa0'));_0x5da1a8[_0xd9ff('0x82')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x2dfb8f[_0xd9ff('0xa1')]['role']!==_0xd9ff('0xa2'))return;return _0x2dfb8f[_0xd9ff('0xa1')][_0xd9ff('0xa3')]({'attributes':['id'],'raw':!![]})[_0xd9ff('0x22')](function(_0x320adb){if(_[_0xd9ff('0xa4')](_0x320adb)){_0x2d2d1c[_0xd9ff('0x82')](_0xd9ff('0xa5'));_0x5da1a8[_0xd9ff('0x82')](_0xd9ff('0xa5'));}else{_0x2d2d1c[_0xd9ff('0x82')]('i.ChatWebsiteId\x20IN\x20?',_[_0xd9ff('0x79')](_0x320adb,'id'));_0x5da1a8[_0xd9ff('0x82')]('i.ChatWebsiteId\x20IN\x20?',_[_0xd9ff('0x79')](_0x320adb,'id'));}});})[_0xd9ff('0x22')](function(){if(_0x2dfb8f[_0xd9ff('0xa1')][_0xd9ff('0xa6')]===_0xd9ff('0xa2')&&!_0x1c885f&&!_0x2dfb8f[_0xd9ff('0x4e')]['ChatWebsiteId'])return[];return db['sequelize'][_0xd9ff('0x4e')](_0x2d2d1c['toString'](),_0x4c2ad5);})['then'](function(_0x4a55c1){_0xd64585['count']=_0x4a55c1[_0xd9ff('0x54')];if(_0xd64585[_0xd9ff('0x34')]===0x0)return[];return db[_0xd9ff('0xa7')]['query'](_0x40d391['toString'](),_0x4c2ad5)[_0xd9ff('0x22')](function(_0x5e7f52){_0xfede73=_[_0xd9ff('0xa8')](_0x5e7f52,'id');_0x4c2ad5=_['merge'](_0x4c2ad5,{'model':db[_0xd9ff('0x49')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x52')]){_0x30c69d[_0xd9ff('0x53')][_0xd9ff('0x47')](function(_0x4e6dd2){_0x5da1a8['field']('i.'+_0x4e6dd2);});}else{_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0x9b'),_0xd9ff('0x6c'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xa9'),'Account.key');_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xaa'),_0xd9ff('0xab'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xac'),_0xd9ff('0x9d'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xad'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xae'),_0xd9ff('0xaf'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xb0'),'Contact.lastName');_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xb1'),'Contact.email');_0x5da1a8['field'](_0xd9ff('0xb2'),_0xd9ff('0xb3'));_0x5da1a8['field'](_0xd9ff('0xb4'),_0xd9ff('0xb5'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xb6'),_0xd9ff('0xb7'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xb8'),_0xd9ff('0xb9'));_0x5da1a8['field']('o.internal','Owner.internal');_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xba'),_0xd9ff('0x45'));}if(_0x30c69d['limit'])_0x5da1a8[_0xd9ff('0x33')](_0x30c69d[_0xd9ff('0x33')]);if(_0x30c69d[_0xd9ff('0x31')])_0x5da1a8[_0xd9ff('0x31')](_0x30c69d[_0xd9ff('0x31')]);return db[_0xd9ff('0xa7')]['query'](_0x5da1a8[_0xd9ff('0xbb')](),_0x4c2ad5);})['then'](function(_0x5cb3af){if(_0x5cb3af[_0xd9ff('0x54')]>0x0)_0x3ed112[_0xd9ff('0x82')](_0xd9ff('0xbc'),_['map'](_0x5cb3af,'id'));return db[_0xd9ff('0xa7')][_0xd9ff('0x4e')](_0x3ed112['toString'](),_0x4c2ad5)['then'](function(_0x4aa6d5){var _0x11840a=_[_0xd9ff('0xbd')](_0x4aa6d5,'ChatInteractionId');var _0x2871ec=[];_0x5cb3af[_0xd9ff('0x47')](function(_0x16e130){_0x2871ec['push'](updateChatInteraction(_0x16e130,_0xfede73,_0x11840a));});return BPromise['all'](_0x2871ec);});});})['then'](function(_0xdf2e33){_0xd64585['rows']=_0xdf2e33;return _0xd64585;})[_0xd9ff('0x22')](respondWithFilteredResult(_0x437561,_0x30c69d))[_0xd9ff('0x2d')](handleError(_0x437561,null));};exports['show']=function(_0x1b048b,_0x5eeeaf){var _0x3339e5={'raw':![],'where':{'id':_0x1b048b[_0xd9ff('0xbe')]['id']}},_0x1f7d87={};_0x1f7d87['model']=_[_0xd9ff('0x4d')](db['ChatInteraction']['rawAttributes']);_0x1f7d87['query']=_[_0xd9ff('0x4d')](_0x1b048b[_0xd9ff('0x4e')]);_0x1f7d87[_0xd9ff('0x4f')]=_[_0xd9ff('0x51')](_0x1f7d87['model'],_0x1f7d87['query']);_0x3339e5[_0xd9ff('0x53')]=_[_0xd9ff('0x51')](_0x1f7d87[_0xd9ff('0x50')],qs[_0xd9ff('0x52')](_0x1b048b[_0xd9ff('0x4e')]['fields']));_0x3339e5['attributes']=_0x3339e5[_0xd9ff('0x53')][_0xd9ff('0x54')]?_0x3339e5[_0xd9ff('0x53')]:_0x1f7d87[_0xd9ff('0x50')];if(_0x1b048b[_0xd9ff('0x4e')][_0xd9ff('0xbf')]){_0x3339e5['include']=[{'all':!![]}];}_0x3339e5=_[_0xd9ff('0x3e')]({},_0x3339e5,_0x1b048b['options']);return db['ChatInteraction'][_0xd9ff('0xc0')](_0x3339e5)[_0xd9ff('0x22')](handleEntityNotFound(_0x5eeeaf,null))[_0xd9ff('0x22')](respondWithResult(_0x5eeeaf,null))[_0xd9ff('0x2d')](handleError(_0x5eeeaf,null));};exports['create']=function(_0x4e3fdd,_0x2cf8da){return db['ChatInteraction']['create'](_0x4e3fdd[_0xd9ff('0x3f')],{})['then'](respondWithResult(_0x2cf8da,0xc9))[_0xd9ff('0x2d')](handleError(_0x2cf8da,null));};exports['update']=function(_0x327cd8,_0xd95329){if(_0x327cd8[_0xd9ff('0x3f')]['id']){delete _0x327cd8[_0xd9ff('0x3f')]['id'];}return db[_0xd9ff('0x49')][_0xd9ff('0xc0')]({'where':{'id':_0x327cd8[_0xd9ff('0xbe')]['id']}})['then'](handleEntityNotFound(_0xd95329,null))[_0xd9ff('0x22')](saveUpdates(_0x327cd8['body'],null))['then'](respondWithResult(_0xd95329,null))[_0xd9ff('0x2d')](handleError(_0xd95329,null));};exports[_0xd9ff('0xc1')]=function(_0x499869,_0x3c86ac){return db['ChatInteraction']['find']({'where':{'id':_0x499869[_0xd9ff('0xbe')]['id']}})[_0xd9ff('0x22')](handleEntityNotFound(_0x3c86ac,null))[_0xd9ff('0x22')](removeEntity(_0x3c86ac,null))[_0xd9ff('0x2d')](handleError(_0x3c86ac,null));};exports[_0xd9ff('0xc2')]=function(_0x11c84f,_0x2d0261){return db[_0xd9ff('0x49')][_0xd9ff('0xc2')]()[_0xd9ff('0x22')](respondWithResult(_0x2d0261,null))[_0xd9ff('0x2d')](handleError(_0x2d0261,null));};exports[_0xd9ff('0xc3')]=function(_0x73cfcf,_0x538f20){var _0x51feff=_0x73cfcf['params']['id'];var _0x30c62c;var _0x50b6b2;var _0x413aef;return db[_0xd9ff('0x49')][_0xd9ff('0xc4')]({'where':{'id':_0x51feff}})[_0xd9ff('0x22')](function(_0x54c390){_0x30c62c=_0x54c390;return db[_0xd9ff('0xc5')]['findOne']({'where':{'id':_0x54c390[_0xd9ff('0x81')]},'attributes':['id','vidaooApiKey','vidaooEscalation','vidaooTopic',_0xd9ff('0xc6'),'vidaooMetadata'],'raw':!![]});})[_0xd9ff('0x22')](function(_0x54524c){if(_0x54524c&&_0x54524c[_0xd9ff('0xc7')]&&_0x54524c[_0xd9ff('0xc8')]){_0x50b6b2=_0x54524c;var _0x696e18={'interaction':{'id':_0x51feff},'agent':{'id':_0x73cfcf[_0xd9ff('0xa1')]['id'],'name':_0x73cfcf[_0xd9ff('0xa1')][_0xd9ff('0x3c')],'fullname':_0x73cfcf['user']['fullname'],'email':_0x73cfcf[_0xd9ff('0xa1')][_0xd9ff('0xc9')]},'contact':_0x73cfcf[_0xd9ff('0x3f')][_0xd9ff('0x40')],'account':_0x73cfcf[_0xd9ff('0x3f')]['account']};var _0x432854={'rejectUnauthorized':![],'method':_0xd9ff('0xca'),'url':_0xd9ff('0xcb'),'headers':{'X-APIKEY':_0x54524c[_0xd9ff('0xc7')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x73cfcf[_0xd9ff('0xa1')][_0xd9ff('0xc9')]],'buttons':null,'topic':_0x50b6b2['vidaooTopic'],'note':_[_0xd9ff('0xcc')](_0x50b6b2[_0xd9ff('0xc6')])?null:getMustacheRender(_0x50b6b2[_0xd9ff('0xc6')],_0x696e18),'metadata':null},'redirect':_0xd9ff('0xcd'),'json':!![]};try{if(!_[_0xd9ff('0xcc')](_0x50b6b2[_0xd9ff('0xce')])){var _0x1c8e55=getMustacheRender(_0x50b6b2[_0xd9ff('0xce')],_0x696e18);var _0x29fdb8=JSON[_0xd9ff('0x85')](_0x1c8e55);_0x432854[_0xd9ff('0x3f')][_0xd9ff('0xcf')]=_0x29fdb8;}}catch(_0xfc755a){throw new db[(_0xd9ff('0x97'))][(_0xd9ff('0xd0'))](_0xd9ff('0xd1'));}return rp(_0x432854);}else{throw new db[(_0xd9ff('0x97'))][(_0xd9ff('0xd0'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xd9ff('0x22')](function(_0x282183){_0x413aef=_0x282183;if(_0x413aef['id']){var _0x3aba00={'body':_0x413aef[_0xd9ff('0xd2')],'ChatWebsiteId':_0x50b6b2['id'],'ChatInteractionId':_0x30c62c['id'],'direction':_0xd9ff('0xd3'),'UserId':_0x73cfcf[_0xd9ff('0xa1')]['id']};return db[_0xd9ff('0xd4')][_0xd9ff('0xd5')](_0x3aba00,{});}else{throw new db['Sequelize'][(_0xd9ff('0xd0'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0xd9ff('0x22')](function(){return _0x30c62c[_0xd9ff('0xd6')]({'vidaooSessionId':_0x413aef['id']});})[_0xd9ff('0x22')](respondWithResult(_0x538f20,null))[_0xd9ff('0x2d')](handleError(_0x538f20,null));};exports[_0xd9ff('0xd7')]=function(_0x204127,_0xf98666){if(_0x204127['body']['id']){delete _0x204127[_0xd9ff('0x3f')]['id'];}return db[_0xd9ff('0x49')][_0xd9ff('0xc0')]({'where':{'id':_0x204127[_0xd9ff('0xbe')]['id']},'include':[{'model':db['CmContact'],'as':_0xd9ff('0x71')}]})[_0xd9ff('0x22')](handleEntityNotFound(_0xf98666,null))['then'](saveUpdates(_0x204127[_0xd9ff('0x3f')],null))[_0xd9ff('0x22')](respondWithResult(_0xf98666,null))['catch'](handleError(_0xf98666,null));};exports['abandon']=function(_0x5c4138,_0x560ea2,_0x1e6d5a){if(_0x5c4138[_0xd9ff('0x3f')]['id']){delete _0x5c4138[_0xd9ff('0x3f')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x5c4138[_0xd9ff('0xbe')]['id']}})['then'](function(_0x43a941){if(!_0x43a941){logger[_0xd9ff('0x2a')](_0xd9ff('0xd8'),'abandon',0x194,'entity\x20not\x20found');_0x560ea2['sendStatus'](0x194);}else{if(_0x43a941[_0xd9ff('0x7e')]){throw new db[(_0xd9ff('0x97'))]['ValidationError'](_0xd9ff('0xd9'));}}return _0x43a941;})[_0xd9ff('0x22')](function(_0x7efe12){if(_0x7efe12){return _0x7efe12[_0xd9ff('0x3a')]({'closed':_0x5c4138[_0xd9ff('0x3f')][_0xd9ff('0xda')],'disposition':_0x5c4138[_0xd9ff('0x3f')][_0xd9ff('0xdb')]})[_0xd9ff('0x22')](function(_0x3b7aeb){return _0x3b7aeb;});}})[_0xd9ff('0x22')](function(_0x37eb49){return respondWithRpcPromise(_0xd9ff('0xdc'),_0xd9ff('0xdd'),_0x5c4138[_0xd9ff('0x3f')],client9004);})[_0xd9ff('0x22')](respondWithResult(_0x560ea2,null))[_0xd9ff('0x2d')](handleError(_0x560ea2,null));};exports[_0xd9ff('0xde')]=function(_0x3b05c4,_0x32c04e,_0x1bcf8f){_0x3b05c4[_0xd9ff('0x3f')][_0xd9ff('0x3c')]=_0x3b05c4[_0xd9ff('0xdf')][_0xd9ff('0xe0')];_0x3b05c4[_0xd9ff('0x3f')][_0xd9ff('0xe1')]=_0x3b05c4[_0xd9ff('0xdf')][_0xd9ff('0xe2')];_0x3b05c4['body'][_0xd9ff('0x4c')]=_0x3b05c4[_0xd9ff('0xdf')]['mimetype'];return db[_0xd9ff('0xe3')][_0xd9ff('0xd5')](_0x3b05c4[_0xd9ff('0x3f')])[_0xd9ff('0x22')](respondWithResult(_0x32c04e,0xc9))[_0xd9ff('0x2d')](handleError(_0x32c04e,null));};exports[_0xd9ff('0xe4')]=function(_0x5978ad,_0x4ddfe7,_0x30c520){return db['ChatInteraction']['findOne']({'where':{'id':_0x5978ad[_0xd9ff('0xbe')]['id']},'raw':!![]})[_0xd9ff('0x22')](handleEntityNotFound(_0x4ddfe7,null))['then'](function(_0x327362){if(_0x327362){if(_0x327362[_0xd9ff('0xda')]){return _0x4ddfe7[_0xd9ff('0x35')](0x193)[_0xd9ff('0x30')]({'status':0x193,'message':'Unauthorized'});}return db[_0xd9ff('0xe3')][_0xd9ff('0xc4')]({'where':{'id':_0x5978ad['query'][_0xd9ff('0xe5')]},'raw':!![]})[_0xd9ff('0x22')](handleEntityNotFound(_0x4ddfe7,null));}})['then'](function(_0x62f1f3){if(_0x62f1f3){var _0xd188cf=_0x62f1f3[_0xd9ff('0xe6')]!==null;var _0x5b2e9c=path[_0xd9ff('0xe7')](config[_0xd9ff('0xe8')],_0xd9ff('0xe9'));if(_0xd188cf){_0x5b2e9c=path['join'](_0x5b2e9c,_0xd9ff('0xea'));}var _0x53a25a=path[_0xd9ff('0xe7')](_0x5b2e9c,_0x62f1f3[_0xd9ff('0xe1')]);return _0x4ddfe7[_0xd9ff('0xeb')](_0x53a25a);}})[_0xd9ff('0x2d')](handleError(_0x4ddfe7,null));};exports[_0xd9ff('0xec')]=function(_0x10397d,_0x51039f){var _0x37ea50=null;var _0x3cf2ef=null;var _0x171195=null;var _0x24c066=null;if(_0x10397d[_0xd9ff('0x3f')]['id']){delete _0x10397d['body']['id'];}if(_0x10397d[_0xd9ff('0x3f')][_0xd9ff('0xed')]){_0x24c066=path['join'](config[_0xd9ff('0xe8')],_0xd9ff('0xee'),util[_0xd9ff('0xef')](_0xd9ff('0xf0'),Date[_0xd9ff('0xf1')]()));_0x10397d[_0xd9ff('0x3f')][_0xd9ff('0xf2')]=_0x24c066;}return db[_0xd9ff('0x49')][_0xd9ff('0xc0')]({'where':{'id':_0x10397d[_0xd9ff('0xbe')]['id']},'include':[{'model':db[_0xd9ff('0xd4')],'as':_0xd9ff('0xf3'),'include':[{'model':db[_0xd9ff('0x7c')],'as':_0xd9ff('0x7c')}]}]})[_0xd9ff('0x22')](handleEntityNotFound(_0x51039f,null))[_0xd9ff('0x22')](saveUpdates(_0x10397d['body'],null))['then'](function(_0x497e36){if(_0x497e36){_0x37ea50=_0x497e36;return db[_0xd9ff('0xc5')]['find']({'where':{'id':_0x37ea50[_0xd9ff('0x81')]}});}})['then'](function(_0x4d4cc0){if(_0x4d4cc0){_0x171195=_0x4d4cc0;return db['CmContact'][_0xd9ff('0xc0')]({'where':{'id':_0x37ea50['ContactId']}});}})['then'](function(_0x474b4c){if(_0x474b4c){_0x3cf2ef=_0x474b4c;if(_0x24c066){var _0x144cf7=null;for(var _0x9eac7f=0x1;_0x9eac7f<_0x37ea50[_0xd9ff('0xf3')][_0xd9ff('0x54')];++_0x9eac7f){_0x144cf7=_0x37ea50[_0xd9ff('0xf3')][_0x9eac7f];var _0x2450da=_0x144cf7[_0xd9ff('0x7e')]?util[_0xd9ff('0xef')](_0xd9ff('0xf4'),_0x171195[_0xd9ff('0xf5')],_0x144cf7[_0xd9ff('0x7e')]):_0xd9ff('0xf6');var _0x4531bc=_0x10397d['body']['customer']||util[_0xd9ff('0xef')](_0xd9ff('0xf4'),_0xd9ff('0xf7'),_0x144cf7[_0xd9ff('0x76')]);switch(_0x171195[_0xd9ff('0xf8')]){case _0xd9ff('0xf9'):_0x2450da=_0x144cf7[_0xd9ff('0x7e')]?util[_0xd9ff('0xef')]('%s%d',_0x171195[_0xd9ff('0xf5')],_0x144cf7[_0xd9ff('0x7e')]):_0xd9ff('0xf6');break;case _0xd9ff('0xfa'):_0x2450da=_0x144cf7['UserId']?_0x144cf7['User'][_0xd9ff('0xfb')]||_0x144cf7[_0xd9ff('0x7c')]['fullname']:_0xd9ff('0xf6');break;case _0xd9ff('0xfc'):_0x2450da=_0x144cf7['UserId']?_0x144cf7[_0xd9ff('0x7c')][_0xd9ff('0x43')]:_0xd9ff('0xf6');break;default:_0x2450da=_0x144cf7[_0xd9ff('0x7e')]?util[_0xd9ff('0xef')](_0xd9ff('0xf4'),_0x171195[_0xd9ff('0xf5')],_0x144cf7['UserId']):_0xd9ff('0xf6');}var _0x62b518=util[_0xd9ff('0xef')](_0xd9ff('0xfd'),moment(_0x144cf7[_0xd9ff('0x84')])['format'](_0xd9ff('0xfe')),_0x144cf7[_0xd9ff('0xff')]==='in'?_0x4531bc:_0x2450da,_0x144cf7[_0xd9ff('0x3f')]);if(!_0x144cf7['secret']){fs[_0xd9ff('0x100')](_0x24c066,_0x62b518);}}return db[_0xd9ff('0x101')][_0xd9ff('0xc4')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xd9ff('0x102'),'raw':!![]}]});}}})['then'](function(_0x5e07ae){if(_0x5e07ae&&_0x5e07ae['Smtp']&&_0x10397d['body']){var _0x578f41={'tls':{'rejectUnauthorized':![]}};if(_0x5e07ae[_0xd9ff('0x102')][_0xd9ff('0x103')]){_0x578f41['service']=_0x5e07ae[_0xd9ff('0x102')][_0xd9ff('0x103')];}else{_0x578f41[_0xd9ff('0x104')]=_0x5e07ae['Smtp'][_0xd9ff('0x104')];_0x578f41['port']=_0x5e07ae['Smtp'][_0xd9ff('0x105')];_0x578f41[_0xd9ff('0x106')]=_0x5e07ae[_0xd9ff('0x102')]['secure'];}if(_0x5e07ae['Smtp'][_0xd9ff('0x107')]){_0x578f41[_0xd9ff('0x108')]={'user':_0x5e07ae['Smtp'][_0xd9ff('0xa1')],'pass':_0x5e07ae[_0xd9ff('0x102')][_0xd9ff('0x109')]};}return respondWithRpcPromise(_0xd9ff('0x10a'),_0xd9ff('0x10b'),{'account':_0x578f41,'message':{'from':util[_0xd9ff('0xef')](_0xd9ff('0x10c'),_0x5e07ae['name'],_0x5e07ae[_0xd9ff('0xc9')]||_0x5e07ae[_0xd9ff('0x102')]['user']),'to':_0x10397d[_0xd9ff('0x3f')][_0xd9ff('0xed')],'subject':'Mail\x20Transcript','text':util[_0xd9ff('0xef')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x10397d[_0xd9ff('0x3f')][_0xd9ff('0xed')]),'attachments':[{'path':_0x24c066}]}})['then'](function(){return _0x37ea50;})[_0xd9ff('0x2d')](function(_0x4d6172){console[_0xd9ff('0x2a')](_0x4d6172);});}else{return _0x37ea50;}})[_0xd9ff('0x22')](respondWithStatusCode(_0x51039f,0xc8))[_0xd9ff('0x2d')](handleError(_0x51039f,null));};exports[_0xd9ff('0x10d')]=function(_0x6a2524,_0x356583,_0x5c1165){return db['ChatMessage'][_0xd9ff('0xc0')]({'where':{'id':_0x6a2524['params']['id']}})[_0xd9ff('0x22')](handleEntityNotFound(_0x356583,null))[_0xd9ff('0x22')](function(_0x599273){if(_0x599273){return _0x599273['addMessage'](_0x6a2524['body'][_0xd9ff('0x10e')],_[_0xd9ff('0x10f')](_0x6a2524[_0xd9ff('0x3f')],['ids','id'])||{});}})[_0xd9ff('0x22')](respondWithResult(_0x356583,null))[_0xd9ff('0x2d')](handleError(_0x356583,null));};exports[_0xd9ff('0x110')]=function(_0x2832b7,_0x618c47,_0x109140){var _0x278670={'raw':![],'where':{}};var _0x5e064d={};var _0x231b46={'count':0x0,'rows':[]};return db[_0xd9ff('0x49')][_0xd9ff('0xc4')]({'where':{'id':_0x2832b7[_0xd9ff('0xbe')]['id']}})[_0xd9ff('0x22')](handleEntityNotFound(_0x618c47,null))[_0xd9ff('0x22')](function(_0x1802b1){if(_0x1802b1){_0x5e064d[_0xd9ff('0x50')]=_[_0xd9ff('0x4d')](db[_0xd9ff('0xd4')][_0xd9ff('0x4a')]);_0x5e064d['query']=_['keys'](_0x2832b7[_0xd9ff('0x4e')]);_0x5e064d['filters']=_['intersection'](_0x5e064d[_0xd9ff('0x50')],_0x5e064d[_0xd9ff('0x4e')]);_0x278670[_0xd9ff('0x53')]=_[_0xd9ff('0x51')](_0x5e064d[_0xd9ff('0x50')],qs['fields'](_0x2832b7[_0xd9ff('0x4e')]['fields']));_0x278670[_0xd9ff('0x53')]=_0x278670[_0xd9ff('0x53')]['length']?_0x278670[_0xd9ff('0x53')]:_0x5e064d[_0xd9ff('0x50')];if(!_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0x55')](_0xd9ff('0x56'))){_0x278670[_0xd9ff('0x33')]=qs[_0xd9ff('0x33')](_0x2832b7['query'][_0xd9ff('0x33')]);_0x278670[_0xd9ff('0x31')]=qs[_0xd9ff('0x31')](_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0x31')]);}_0x278670[_0xd9ff('0x9c')]=qs['sort'](_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0x57')]);_0x278670[_0xd9ff('0x82')]=qs['filters'](_[_0xd9ff('0x58')](_0x2832b7['query'],_0x5e064d[_0xd9ff('0x4f')]));_0x278670['where'][_0xd9ff('0x111')]=_0x1802b1['id'];if(_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0x90')]){_0x278670['where']=_[_0xd9ff('0x3e')](_0x278670['where'],{'$or':_[_0xd9ff('0x79')](_0x278670[_0xd9ff('0x53')],function(_0x2b2a50){var _0x34f3f0={};_0x34f3f0[_0x2b2a50]={'$like':'%'+_0x2832b7[_0xd9ff('0x4e')]['filter']+'%'};return _0x34f3f0;})});}if(_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0x86')]){var _0x955328=_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0x86')][_0xd9ff('0x46')](',');var _0x5d95b1={};_0x5d95b1[_0x955328[0x0]]={'$gte':moment(_0x955328[0x1])['format'](_0xd9ff('0x112'))};_0x278670[_0xd9ff('0x82')]=_[_0xd9ff('0x3e')](_0x278670[_0xd9ff('0x82')],_0x5d95b1);}_0x278670=_[_0xd9ff('0x3e')]({},_0x278670,_0x2832b7[_0xd9ff('0x113')]);return db[_0xd9ff('0xd4')]['count']({'where':_0x278670[_0xd9ff('0x82')]})[_0xd9ff('0x22')](function(_0x3e90fe){_0x231b46[_0xd9ff('0x34')]=_0x3e90fe;if(_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0xbf')]){_0x278670['include']=[{'all':!![]}];}return db[_0xd9ff('0xd4')][_0xd9ff('0x114')](_0x278670);})[_0xd9ff('0x22')](function(_0x33f933){_0x231b46[_0xd9ff('0x115')]=_0x33f933;return _0x231b46;});}})[_0xd9ff('0x22')](respondWithFilteredResult(_0x618c47,_0x278670))['catch'](handleError(_0x618c47,null));};exports['getMyMessages']=function(_0xf3a93b,_0x473ecf,_0x1213a4){var _0x6f731a={'where':{}},_0x193c57={},_0x4572b2={'count':0x0,'rows':[]};return db[_0xd9ff('0x49')][_0xd9ff('0xc4')]({'where':{'id':_0xf3a93b['params']['id']}})[_0xd9ff('0x22')](handleEntityNotFound(_0x473ecf,null))[_0xd9ff('0x22')](function(_0x4115a3){if(_0x4115a3){_0x193c57[_0xd9ff('0x50')]=_[_0xd9ff('0x4d')](db[_0xd9ff('0xd4')]['rawAttributes']);_0x193c57[_0xd9ff('0x4e')]=_['keys'](_0xf3a93b['query']);_0x193c57[_0xd9ff('0x4f')]=_[_0xd9ff('0x51')](_0x193c57[_0xd9ff('0x50')],_0x193c57[_0xd9ff('0x4e')]);_0x6f731a[_0xd9ff('0x53')]=_[_0xd9ff('0x51')](_0x193c57[_0xd9ff('0x50')],qs[_0xd9ff('0x52')](_0xf3a93b['query'][_0xd9ff('0x52')]));_0x6f731a['attributes']=_0x6f731a[_0xd9ff('0x53')][_0xd9ff('0x54')]?_0x6f731a[_0xd9ff('0x53')]:_0x193c57[_0xd9ff('0x50')];if(!_0xf3a93b['query'][_0xd9ff('0x55')](_0xd9ff('0x56'))){_0x6f731a[_0xd9ff('0x33')]=qs[_0xd9ff('0x33')](_0xf3a93b[_0xd9ff('0x4e')][_0xd9ff('0x33')]);_0x6f731a[_0xd9ff('0x31')]=qs[_0xd9ff('0x31')](_0xf3a93b[_0xd9ff('0x4e')]['offset']);}_0x6f731a[_0xd9ff('0x9c')]=qs['sort'](_0xf3a93b['query'][_0xd9ff('0x57')]);_0x6f731a[_0xd9ff('0x82')]=qs[_0xd9ff('0x4f')](_[_0xd9ff('0x58')](_0xf3a93b[_0xd9ff('0x4e')],_0x193c57[_0xd9ff('0x4f')]));_0x6f731a[_0xd9ff('0x82')][_0xd9ff('0x111')]=_0x4115a3['id'];if(_0xf3a93b[_0xd9ff('0x4e')][_0xd9ff('0x90')]){_0x6f731a[_0xd9ff('0x82')]=_[_0xd9ff('0x3e')](_0x6f731a['where'],{'$or':_[_0xd9ff('0x79')](_0x6f731a['attributes'],function(_0x1bb980){var _0x3ccf5d={};_0x3ccf5d[_0x1bb980]={'$like':'%'+_0xf3a93b['query']['filter']+'%'};return _0x3ccf5d;})});}_0x6f731a[_0xd9ff('0x82')][_0xd9ff('0x116')]=![];if(_0xf3a93b['query']['id']){_0x6f731a[_0xd9ff('0x82')]['id']={'$gt':_0xf3a93b[_0xd9ff('0x4e')]['id']};}_0x6f731a=_['merge']({},_0x6f731a,_0xf3a93b[_0xd9ff('0x113')]);return db['ChatMessage'][_0xd9ff('0x34')]({'where':_0x6f731a[_0xd9ff('0x82')]})[_0xd9ff('0x22')](function(_0x42d9ff){_0x4572b2[_0xd9ff('0x34')]=_0x42d9ff;_0x6f731a[_0xd9ff('0x117')]=[];if(_0xf3a93b[_0xd9ff('0x4e')][_0xd9ff('0x118')]){_0x6f731a[_0xd9ff('0x117')][_0xd9ff('0x119')]({'model':db[_0xd9ff('0x7c')],'as':_0xd9ff('0x7c'),'attributes':['id',_0xd9ff('0x43'),_0xd9ff('0xfb')]});}if(_0xf3a93b['query'][_0xd9ff('0xbf')]){_0x6f731a[_0xd9ff('0x117')]=[{'all':!![]}];}return db[_0xd9ff('0xd4')][_0xd9ff('0x114')](_0x6f731a);})[_0xd9ff('0x22')](function(_0x314f18){_0x4572b2['rows']=_0x314f18;return _0x4572b2;});}})['then'](respondWithFilteredResult(_0x473ecf,_0x6f731a))['catch'](handleError(_0x473ecf,null));};exports['addTags']=function(_0x4699d3,_0x2e91a8,_0x4956b2){return db[_0xd9ff('0x49')][_0xd9ff('0xc0')]({'where':{'id':_0x4699d3[_0xd9ff('0xbe')]['id']}})['then'](handleEntityNotFound(_0x2e91a8,null))['then'](function(_0x217023){if(_0x217023){return _0x217023[_0xd9ff('0x11a')](_0x4699d3['body']['ids'],_['omit'](_0x4699d3['body'],['ids','id'])||{})[_0xd9ff('0x11b')](function(){return db[_0xd9ff('0x11c')][_0xd9ff('0x114')]({'attributes':['id',_0xd9ff('0x3c'),_0xd9ff('0x5b')],'where':{'id':_0x4699d3[_0xd9ff('0x3f')][_0xd9ff('0x10e')]}});})[_0xd9ff('0x22')](function(_0x317f93){socket[_0xd9ff('0x11d')](_0xd9ff('0x11e'),{'id':Number(_0x4699d3[_0xd9ff('0xbe')]['id']),'tags':_0x317f93||[]});return{'id':Number(_0x4699d3[_0xd9ff('0xbe')]['id']),'tags':_0x317f93||[]};});}})[_0xd9ff('0x22')](respondWithResult(_0x2e91a8,null))[_0xd9ff('0x2d')](handleError(_0x2e91a8,null));};exports[_0xd9ff('0x11f')]=function(_0x404baf,_0x5d73cd,_0xdb719b){return db['ChatInteraction'][_0xd9ff('0xc0')]({'where':{'id':_0x404baf['params']['id']}})[_0xd9ff('0x22')](handleEntityNotFound(_0x5d73cd,null))[_0xd9ff('0x22')](function(_0x10935d){if(_0x10935d){return _0x10935d['removeTags'](_0x404baf['query']['ids']);}})['then'](respondWithStatusCode(_0x5d73cd,null))['catch'](handleError(_0x5d73cd,null));};exports[_0xd9ff('0xeb')]=function(_0x2031e9,_0x3b50d9){var _0x410fae=moment()[_0xd9ff('0x120')]()[_0xd9ff('0xbb')]();var _0x494da6=path[_0xd9ff('0xe7')](config[_0xd9ff('0xe8')],'server','files',_0xd9ff('0x121'));var _0x49c9cc=path[_0xd9ff('0xe7')](config['root'],_0xd9ff('0x122'),_0xd9ff('0x123'),'attachments');var _0x378746=path[_0xd9ff('0xe7')](_0x494da6,_0x410fae);var _0x2acbe3=util[_0xd9ff('0xef')]('transcript-%d-%s.zip',_0x2031e9['params']['id'],_0x410fae);var _0x46d12c=path[_0xd9ff('0xe7')](_0x494da6,_0x2acbe3);var _0x54f4aa=[];_0x54f4aa[_0xd9ff('0x119')]({'model':db['User'],'as':_0xd9ff('0x7c'),'attributes':['id',_0xd9ff('0x43')],'raw':!![]});_0x54f4aa[_0xd9ff('0x119')]({'model':db[_0xd9ff('0x124')],'as':_0xd9ff('0x71'),'attributes':['id',_0xd9ff('0x125'),'lastName'],'raw':!![]});if(_0x2031e9['query'][_0xd9ff('0x126')]){_0x54f4aa['push']({'model':db[_0xd9ff('0xe3')],'as':'Attachment','raw':!![]});}var _0xd015e9=[{'model':db[_0xd9ff('0xd4')],'as':_0xd9ff('0xf3'),'attributes':['id','body',_0xd9ff('0x84'),_0xd9ff('0xff'),'secret','read'],'include':_0x54f4aa}];_0xd015e9['push']({'model':db[_0xd9ff('0xc5')],'as':_0xd9ff('0x127'),'attributes':['id',_0xd9ff('0x3c')]});_0xd015e9[_0xd9ff('0x119')]({'model':db[_0xd9ff('0x7c')],'as':_0xd9ff('0x128'),'attributes':['id',_0xd9ff('0x43')]});return db[_0xd9ff('0x49')]['find']({'where':{'id':_0x2031e9[_0xd9ff('0xbe')]['id']},'include':_0xd015e9})[_0xd9ff('0x22')](handleEntityNotFound(_0x3b50d9,null))[_0xd9ff('0x22')](function(_0x1b452e){if(_0x1b452e){var _0x3ab927=_0x1b452e[_0xd9ff('0x129')]({'plain':!![]});fs[_0xd9ff('0x12a')](_0x378746);var _0x2b6e15={'channel':_0xd9ff('0x12b'),'account':_0x3ab927['Account']['name'],'agent':_0x3ab927['Owner']?_0x3ab927[_0xd9ff('0x128')][_0xd9ff('0x43')]:'N.A.','createdAt':moment(_0x3ab927[_0xd9ff('0x84')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xd9ff('0xbb')](),'closedAt':_0x3ab927[_0xd9ff('0xda')]?moment(_0x3ab927[_0xd9ff('0x12c')])[_0xd9ff('0xef')](_0xd9ff('0x112'))[_0xd9ff('0xbb')]():'','disposition':_0x3ab927['disposition'],'chatInfo':{'browser':_0x3ab927[_0xd9ff('0x12d')],'os':_0x3ab927[_0xd9ff('0x12e')],'referer':_0x3ab927[_0xd9ff('0x12f')],'customerIp':_0x3ab927[_0xd9ff('0x130')],'customerPort':_0x3ab927[_0xd9ff('0x131')]?_0x3ab927['customerPort']:'N.A.'},'messages':_(_0x3ab927[_0xd9ff('0xf3')])[_0xd9ff('0x132')]()[_0xd9ff('0x90')]({'secret':![]})[_0xd9ff('0x79')](function(_0x319248){if(_0x319248[_0xd9ff('0xe3')]){var _0x1ea603=path[_0xd9ff('0xe7')](_0x49c9cc,_0x319248[_0xd9ff('0xe3')][_0xd9ff('0xe1')]);if(fs[_0xd9ff('0x133')](_0x1ea603)){fs[_0xd9ff('0x134')](_0x1ea603)[_0xd9ff('0x135')](fs['createWriteStream'](path[_0xd9ff('0xe7')](_0x378746,_0x319248[_0xd9ff('0xe3')][_0xd9ff('0xe1')])));}}return{'date':moment(_0x319248[_0xd9ff('0x84')])[_0xd9ff('0xef')](_0xd9ff('0x112'))[_0xd9ff('0xbb')](),'sender':_0x319248[_0xd9ff('0xff')]===_0xd9ff('0xd3')?_0x319248[_0xd9ff('0x7c')]?_0x319248[_0xd9ff('0x7c')][_0xd9ff('0x43')]:_0xd9ff('0xf6'):_0x319248['Contact'][_0xd9ff('0x125')]+(_0x319248[_0xd9ff('0x71')][_0xd9ff('0x136')]?'\x20'+_0x319248[_0xd9ff('0x71')]['lastName']:''),'body':_0x319248[_0xd9ff('0xe3')]?_0x319248['Attachment']['basename']:_0x319248[_0xd9ff('0x3f')],'direction':_0x319248[_0xd9ff('0xff')]===_0xd9ff('0xd3')?'A':'C','secret':_0x319248[_0xd9ff('0x116')],'read':_0x319248[_0xd9ff('0x8c')],'attachment':_0x319248[_0xd9ff('0xe3')]};})[_0xd9ff('0x6d')]()};return ejs['renderFile'](path[_0xd9ff('0xe7')](config[_0xd9ff('0xe8')],'server',_0xd9ff('0x137'),_0xd9ff('0x138')),{'interaction':_0x2b6e15})[_0xd9ff('0x22')](function(_0xb07a14){var _0x1c419f=path[_0xd9ff('0xe7')](_0x378746,_0xd9ff('0x139')+_0x3ab927['id']+'-'+_0x410fae+_0xd9ff('0x13a'));var _0x3156c8={'path':_0x1c419f,'channel':_0xd9ff('0x12b'),'interactionId':_0x3ab927['id']};return pdf[_0xd9ff('0x13b')](_0xb07a14,_0x3156c8);})['then'](function(){return new BPromise(function(_0x567007,_0x1019f9){zipdir(_0x378746,{'saveTo':_0x46d12c},function(_0x2ab78a,_0x4649d9){if(_0x2ab78a)return _0x1019f9(_0x2ab78a);return _0x567007(_0x4649d9);});})[_0xd9ff('0x22')](function(){return new BPromise(function(_0x166033,_0x3c40e4){rimraf(_0x378746,function(_0x346d93){if(_0x346d93)_0x3c40e4(_0x346d93);return _0x166033();});});})[_0xd9ff('0x22')](function(){return _0x3b50d9['download'](_0x46d12c,_0x2acbe3,function(_0x22680e){if(_0x22680e){console['log'](_0xd9ff('0x13c'),_0x22680e);}else{fs[_0xd9ff('0x13d')](_0x46d12c);}});});});}else{return _0x3b50d9['sendStatus'](0xc8);}})[_0xd9ff('0x2d')](handleError(_0x3b50d9,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 5fc6faa..94ef663 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 _0x915c=['update','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','catch','exports','events','ChatInteraction','../../mysqldb','setMaxListeners','save'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x915c,0xa5));var _0xc915=function(_0x1bfc42,_0x56e7fc){_0x1bfc42=_0x1bfc42-0x0;var _0x3f7592=_0x915c[_0x1bfc42];return _0x3f7592;};'use strict';var EventEmitter=require(_0xc915('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0xc915('0x1')];var ChatMessage=require(_0xc915('0x2'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xc915('0x3')](0x0);var events={'afterCreate':_0xc915('0x4'),'afterUpdate':_0xc915('0x5'),'afterDestroy':_0xc915('0x6')};function emitEvent(_0x20ff5b){return function(_0x449dd9,_0x9feaff,_0x559354){_0x449dd9[_0xc915('0x7')]({'attributes':['id'],'raw':!![]})[_0xc915('0x8')](function(_0x1253f0){_0x449dd9[_0xc915('0x9')](_0xc915('0xa'),_0x1253f0[_0xc915('0xb')](function(_0x27b230){return{'id':_0x27b230['id']};}));return ChatMessage[_0xc915('0xc')]({'where':{'ChatInteractionId':_0x449dd9['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc915('0x8')](function(_0x94a767){_0x449dd9['setDataValue']('unreadMessages',_0x94a767[_0xc915('0xd')]);ChatInteractionEvents[_0xc915('0xe')](_0x20ff5b+':'+_0x449dd9['id'],_0x449dd9);ChatInteractionEvents['emit'](_0x20ff5b,_0x449dd9);_0x559354(null);})[_0xc915('0xf')](_0x559354(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0xc915('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0x6155=['ChatInteraction','ChatMessage','setMaxListeners','save','remove','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x4160e4,_0x14484b){var _0x5cc04e=function(_0x18f387){while(--_0x18f387){_0x4160e4['push'](_0x4160e4['shift']());}};_0x5cc04e(++_0x14484b);}(_0x6155,0xc4));var _0x5615=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x6155[_0x46e363];return _0x3fb059;};'use strict';var EventEmitter=require(_0x5615('0x0'));var ChatInteraction=require(_0x5615('0x1'))['db'][_0x5615('0x2')];var ChatMessage=require(_0x5615('0x1'))['db'][_0x5615('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x5615('0x4')](0x0);var events={'afterCreate':_0x5615('0x5'),'afterUpdate':'update','afterDestroy':_0x5615('0x6')};function emitEvent(_0x176f3b){return function(_0x1cba76,_0x4c8c0c,_0x5d491c){_0x1cba76['getUsers']({'attributes':['id'],'raw':!![]})[_0x5615('0x7')](function(_0x1952e1){_0x1cba76[_0x5615('0x8')]('Users',_0x1952e1[_0x5615('0x9')](function(_0x4398d8){return{'id':_0x4398d8['id']};}));return ChatMessage[_0x5615('0xa')]({'where':{'ChatInteractionId':_0x1cba76['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5615('0x7')](function(_0xda388){_0x1cba76['setDataValue'](_0x5615('0xb'),_0xda388[_0x5615('0xc')]);ChatInteractionEvents['emit'](_0x176f3b+':'+_0x1cba76['id'],_0x1cba76);ChatInteractionEvents[_0x5615('0xd')](_0x176f3b,_0x1cba76);_0x5d491c(null);})[_0x5615('0xe')](_0x5d491c(null));};}for(var e in events){if(events[_0x5615('0xf')](e)){var event=events[e];ChatInteraction[_0x5615('0x10')](e,emitEvent(event));}}module[_0x5615('0x11')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index e221149..af196dc 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 _0x4609=['utf8mb4','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4609,0x199));var _0x9460=function(_0x2b003c,_0x21b39b){_0x2b003c=_0x2b003c-0x0;var _0x3aff56=_0x4609[_0x2b003c];return _0x3aff56;};'use strict';var _=require('lodash');var util=require(_0x9460('0x0'));var logger=require(_0x9460('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9460('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9460('0x3'));var rimraf=require(_0x9460('0x4'));var config=require(_0x9460('0x5'));var attributes=require(_0x9460('0x6'));module[_0x9460('0x7')]=function(_0x558c59,_0x32a5c3){return _0x558c59[_0x9460('0x8')](_0x9460('0x9'),attributes,{'tableName':_0x9460('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5243f7,_0x405e80,_0x3fad96){if(_0x5243f7[_0x9460('0xb')](_0x9460('0xc'))){_0x5243f7[_0x9460('0xd')]=moment()[_0x9460('0xe')](_0x9460('0xf'));}_0x3fad96(null,_0x5243f7);}},'charset':_0x9460('0x10'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb81c=['utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','../../config/environment','exports','chat_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4'];(function(_0x264492,_0x56838b){var _0x2ecbe4=function(_0x3deb03){while(--_0x3deb03){_0x264492['push'](_0x264492['shift']());}};_0x2ecbe4(++_0x56838b);}(_0xb81c,0xd3));var _0xcb81=function(_0x34ebb8,_0x441691){_0x34ebb8=_0x34ebb8-0x0;var _0x3cd254=_0xb81c[_0x34ebb8];return _0x3cd254;};'use strict';var _=require(_0xcb81('0x0'));var util=require(_0xcb81('0x1'));var logger=require(_0xcb81('0x2'))('api');var moment=require(_0xcb81('0x3'));var BPromise=require('bluebird');var rp=require(_0xcb81('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcb81('0x5'));var attributes=require('./chatInteraction.attributes');module[_0xcb81('0x6')]=function(_0x9fb7c7,_0xb6ebd5){return _0x9fb7c7['define']('ChatInteraction',attributes,{'tableName':_0xcb81('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1cc91b,_0xfca7b6,_0x2f4831){if(_0x1cc91b['changed'](_0xcb81('0x8'))){_0x1cc91b[_0xcb81('0x9')]=moment()[_0xcb81('0xa')](_0xcb81('0xb'));}_0x2f4831(null,_0x1cc91b);}},'charset':_0xcb81('0xc'),'collate':_0xcb81('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 99385f2..7cea969 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 _0x771f=['attributes','limit','stringify','AddTagsToChatInteraction','find','body','ids','spread','AddTags','lodash','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','redis','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','options','raw','where'];(function(_0x58dd03,_0x10ad3b){var _0x3d94bb=function(_0x5df1c8){while(--_0x5df1c8){_0x58dd03['push'](_0x58dd03['shift']());}};_0x3d94bb(++_0x10ad3b);}(_0x771f,0x151));var _0xf771=function(_0x1deee5,_0x1d4485){_0x1deee5=_0x1deee5-0x0;var _0x1d6c3a=_0x771f[_0x1deee5];return _0x1d6c3a;};'use strict';var _=require(_0xf771('0x0'));var util=require('util');var moment=require(_0xf771('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf771('0x2'));var db=require(_0xf771('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf771('0x4'));var config=require(_0xf771('0x5'));var jayson=require(_0xf771('0x6'));var client=jayson[_0xf771('0x7')][_0xf771('0x8')]({'port':0x232a});config['redis']=_[_0xf771('0x9')](config['redis'],{'host':_0xf771('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf771('0xb')]));require(_0xf771('0xc'))[_0xf771('0xd')](socket);function respondWithRpcPromise(_0x26c399,_0x5bce59,_0x47a3bb){return new BPromise(function(_0x24d2a5,_0x4f1766){return client[_0xf771('0xe')](_0x26c399,_0x47a3bb)[_0xf771('0xf')](function(_0x314420){logger[_0xf771('0x10')](_0xf771('0x11'),_0x5bce59,_0xf771('0x12'));logger[_0xf771('0x13')](_0xf771('0x14'),_0x5bce59,_0xf771('0x12'),JSON['stringify'](_0x314420));if(_0x314420[_0xf771('0x15')]){if(_0x314420['error'][_0xf771('0x16')]===0x1f4){logger[_0xf771('0x15')](_0xf771('0x11'),_0x5bce59,_0x314420['error']['message']);return _0x4f1766(_0x314420[_0xf771('0x15')][_0xf771('0x17')]);}logger[_0xf771('0x15')](_0xf771('0x11'),_0x5bce59,_0x314420[_0xf771('0x15')][_0xf771('0x17')]);return _0x24d2a5(_0x314420[_0xf771('0x15')][_0xf771('0x17')]);}else{logger['info'](_0xf771('0x11'),_0x5bce59,_0xf771('0x12'));_0x24d2a5(_0x314420[_0xf771('0x18')]['message']);}})[_0xf771('0x19')](function(_0x555e0e){logger[_0xf771('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x5bce59,_0x555e0e);_0x4f1766(_0x555e0e);});});}exports[_0xf771('0x1a')]=function(_0xf2d310){var _0x1aa6d6=this;return new Promise(function(_0x44ea2f,_0xc0942f){return db[_0xf771('0x1b')][_0xf771('0x1c')](_0xf2d310['body'],{'raw':_0xf2d310[_0xf771('0x1d')]?_0xf2d310['options'][_0xf771('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf2d310[_0xf771('0x1d')]?_0xf2d310['options'][_0xf771('0x1f')]||null:null,'attributes':_0xf2d310[_0xf771('0x1d')]?_0xf2d310['options'][_0xf771('0x20')]||null:null,'limit':_0xf2d310[_0xf771('0x1d')]?_0xf2d310[_0xf771('0x1d')][_0xf771('0x21')]||null:null})[_0xf771('0xf')](function(_0xa18258){logger[_0xf771('0x10')](_0xf771('0x1a'),_0xf2d310);logger[_0xf771('0x13')]('UpdateChatInteraction',_0xf2d310,JSON[_0xf771('0x22')](_0xa18258));_0x44ea2f(_0xa18258);})['catch'](function(_0x488015){logger[_0xf771('0x15')]('UpdateChatInteraction',_0x488015['message'],_0xf2d310);_0xc0942f(_0x1aa6d6[_0xf771('0x15')](0x1f4,_0x488015[_0xf771('0x17')]));});});};exports[_0xf771('0x23')]=function(_0x37dbd0){return new Promise(function(_0x47bb1f,_0x118159){return db['ChatInteraction'][_0xf771('0x24')]({'where':_0x37dbd0['options']?_0x37dbd0[_0xf771('0x1d')]['where']||null:null})[_0xf771('0xf')](function(_0x224d09){if(_0x224d09){return _0x224d09['addTags'](_0x37dbd0[_0xf771('0x25')][_0xf771('0x26')],_['omit'](_0x37dbd0['body'],[_0xf771('0x26'),'id'])||{});}})[_0xf771('0x27')](function(_0x33e959){logger[_0xf771('0x10')](_0xf771('0x28'),_0x37dbd0);logger[_0xf771('0x13')](_0xf771('0x28'),_0x37dbd0,JSON['stringify'](_0x33e959));_0x47bb1f(_0x33e959);})[_0xf771('0x19')](function(_0x1c5136){logger[_0xf771('0x15')](_0xf771('0x28'),_0x1c5136['message'],_0x37dbd0);_0x118159(_this[_0xf771('0x15')](0x1f4,_0x1c5136[_0xf771('0x17')]));});});}; \ No newline at end of file +var _0x18f4=['ChatInteraction','where','addTags','body','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','UpdateChatInteraction','update','options','raw','then','stringify','AddTagsToChatInteraction'];(function(_0x340380,_0x4bd2a8){var _0x49ce1c=function(_0x4cb9e2){while(--_0x4cb9e2){_0x340380['push'](_0x340380['shift']());}};_0x49ce1c(++_0x4bd2a8);}(_0x18f4,0x150));var _0x418f=function(_0xf6031,_0x895009){_0xf6031=_0xf6031-0x0;var _0x535425=_0x18f4[_0xf6031];return _0x535425;};'use strict';var _=require(_0x418f('0x0'));var util=require(_0x418f('0x1'));var moment=require('moment');var BPromise=require(_0x418f('0x2'));var rs=require(_0x418f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x418f('0x4'))['db'];var utils=require(_0x418f('0x5'));var logger=require('../../config/logger')(_0x418f('0x6'));var config=require(_0x418f('0x7'));var jayson=require(_0x418f('0x8'));var client=jayson[_0x418f('0x9')]['http']({'port':0x232a});config['redis']=_[_0x418f('0xa')](config[_0x418f('0xb')],{'host':_0x418f('0xc'),'port':0x18eb});var socket=require(_0x418f('0xd'))(new Redis(config[_0x418f('0xb')]));require(_0x418f('0xe'))[_0x418f('0xf')](socket);function respondWithRpcPromise(_0x3b77c3,_0x3a9eab,_0x1eb321){return new BPromise(function(_0x416765,_0x1d43f7){return client[_0x418f('0x10')](_0x3b77c3,_0x1eb321)['then'](function(_0x1c1785){logger[_0x418f('0x11')](_0x418f('0x12'),_0x3a9eab,_0x418f('0x13'));logger[_0x418f('0x14')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x3a9eab,_0x418f('0x13'),JSON['stringify'](_0x1c1785));if(_0x1c1785[_0x418f('0x15')]){if(_0x1c1785[_0x418f('0x15')][_0x418f('0x16')]===0x1f4){logger[_0x418f('0x15')](_0x418f('0x12'),_0x3a9eab,_0x1c1785[_0x418f('0x15')][_0x418f('0x17')]);return _0x1d43f7(_0x1c1785[_0x418f('0x15')][_0x418f('0x17')]);}logger[_0x418f('0x15')](_0x418f('0x12'),_0x3a9eab,_0x1c1785['error']['message']);return _0x416765(_0x1c1785[_0x418f('0x15')][_0x418f('0x17')]);}else{logger[_0x418f('0x11')](_0x418f('0x12'),_0x3a9eab,'request\x20sent');_0x416765(_0x1c1785[_0x418f('0x18')][_0x418f('0x17')]);}})[_0x418f('0x19')](function(_0x365302){logger[_0x418f('0x15')](_0x418f('0x12'),_0x3a9eab,_0x365302);_0x1d43f7(_0x365302);});});}exports[_0x418f('0x1a')]=function(_0x5be689){var _0x390cbf=this;return new Promise(function(_0x51720c,_0x47923b){return db['ChatInteraction'][_0x418f('0x1b')](_0x5be689['body'],{'raw':_0x5be689['options']?_0x5be689[_0x418f('0x1c')][_0x418f('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5be689['options']?_0x5be689[_0x418f('0x1c')]['where']||null:null,'attributes':_0x5be689[_0x418f('0x1c')]?_0x5be689['options']['attributes']||null:null,'limit':_0x5be689['options']?_0x5be689[_0x418f('0x1c')]['limit']||null:null})[_0x418f('0x1e')](function(_0x4894ac){logger['info']('UpdateChatInteraction',_0x5be689);logger[_0x418f('0x14')](_0x418f('0x1a'),_0x5be689,JSON[_0x418f('0x1f')](_0x4894ac));_0x51720c(_0x4894ac);})[_0x418f('0x19')](function(_0x9b68dd){logger[_0x418f('0x15')](_0x418f('0x1a'),_0x9b68dd[_0x418f('0x17')],_0x5be689);_0x47923b(_0x390cbf[_0x418f('0x15')](0x1f4,_0x9b68dd['message']));});});};exports[_0x418f('0x20')]=function(_0x2ce10c){return new Promise(function(_0x2002fb,_0x1aade4){return db[_0x418f('0x21')]['find']({'where':_0x2ce10c[_0x418f('0x1c')]?_0x2ce10c[_0x418f('0x1c')][_0x418f('0x22')]||null:null})[_0x418f('0x1e')](function(_0x171e1c){if(_0x171e1c){return _0x171e1c[_0x418f('0x23')](_0x2ce10c[_0x418f('0x24')][_0x418f('0x25')],_[_0x418f('0x26')](_0x2ce10c[_0x418f('0x24')],[_0x418f('0x25'),'id'])||{});}})[_0x418f('0x27')](function(_0x5974cf){logger[_0x418f('0x11')](_0x418f('0x28'),_0x2ce10c);logger[_0x418f('0x14')](_0x418f('0x28'),_0x2ce10c,JSON[_0x418f('0x1f')](_0x5974cf));_0x2002fb(_0x5974cf);})[_0x418f('0x19')](function(_0x108cce){logger['error'](_0x418f('0x28'),_0x108cce['message'],_0x2ce10c);_0x1aade4(_this[_0x418f('0x15')](0x1f4,_0x108cce[_0x418f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 51a6511..9c1768c 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 _0x7be5=['./chatInteraction.events','remove','emit','register','length','chatInteraction:'];(function(_0x57c5e0,_0x46441f){var _0x512049=function(_0x223209){while(--_0x223209){_0x57c5e0['push'](_0x57c5e0['shift']());}};_0x512049(++_0x46441f);}(_0x7be5,0x11a));var _0x57be=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7be5[_0x321bb2];return _0x9c12ed;};'use strict';var ChatInteractionEvents=require(_0x57be('0x0'));var events=['save',_0x57be('0x1'),'update'];function createListener(_0x4aeabb,_0x42207e){return function(_0x1c51b6){_0x42207e[_0x57be('0x2')](_0x4aeabb,_0x1c51b6);};}function removeListener(_0x23583a,_0x24974a){return function(){ChatInteractionEvents['removeListener'](_0x23583a,_0x24974a);};}exports[_0x57be('0x3')]=function(_0xa9c6da){for(var _0xacf95a=0x0,_0x3bfbd3=events[_0x57be('0x4')];_0xacf95a<_0x3bfbd3;_0xacf95a++){var _0x4184ab=events[_0xacf95a];var _0x1ac835=createListener(_0x57be('0x5')+_0x4184ab,_0xa9c6da);ChatInteractionEvents['on'](_0x4184ab,_0x1ac835);}}; \ No newline at end of file +var _0xe4eb=['chatInteraction:','./chatInteraction.events','save','update','emit','register','length'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xe4eb,0x9b));var _0xbe4e=function(_0xf034a4,_0x522919){_0xf034a4=_0xf034a4-0x0;var _0x37b357=_0xe4eb[_0xf034a4];return _0x37b357;};'use strict';var ChatInteractionEvents=require(_0xbe4e('0x0'));var events=[_0xbe4e('0x1'),'remove',_0xbe4e('0x2')];function createListener(_0x39b18b,_0x14646b){return function(_0x5b63fb){_0x14646b[_0xbe4e('0x3')](_0x39b18b,_0x5b63fb);};}function removeListener(_0x9a14a9,_0x3b2b21){return function(){ChatInteractionEvents['removeListener'](_0x9a14a9,_0x3b2b21);};}exports[_0xbe4e('0x4')]=function(_0x15aa50){for(var _0x2e4bd6=0x0,_0x1e9580=events[_0xbe4e('0x5')];_0x2e4bd6<_0x1e9580;_0x2e4bd6++){var _0x1bffa2=events[_0x2e4bd6];var _0x3ad104=createListener(_0xbe4e('0x6')+_0x1bffa2,_0x15aa50);ChatInteractionEvents['on'](_0x1bffa2,_0x3ad104);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index a22c96a..7286cfa 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 _0x87be=['format','%s-%s','originalname','replace','/:id/attachment_upload','single','attachmentUpload','/:id/messages','addMessage','tracked','chat','chatinteraction:addtags','put','chatinteraction:update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','chatinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','/describe','/:id','isChatInteractionAuthorized','show','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','create','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/'];(function(_0x44b346,_0xeb097d){var _0x1c2f2b=function(_0x4e1f23){while(--_0x4e1f23){_0x44b346['push'](_0x44b346['shift']());}};_0x1c2f2b(++_0xeb097d);}(_0x87be,0x151));var _0xe87b=function(_0x17b9b6,_0xc24214){_0x17b9b6=_0x17b9b6-0x0;var _0x159874=_0x87be[_0x17b9b6];return _0x159874;};'use strict';var multer=require(_0xe87b('0x0'));var util=require(_0xe87b('0x1'));var path=require('path');var timeout=require(_0xe87b('0x2'));var express=require(_0xe87b('0x3'));var router=express[_0xe87b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe87b('0x5'));var controller=require('./chatInteraction.controller');router[_0xe87b('0x6')]('/',auth[_0xe87b('0x7')](),controller[_0xe87b('0x8')]);router[_0xe87b('0x6')](_0xe87b('0x9'),auth[_0xe87b('0x7')](),controller['describe']);router['get'](_0xe87b('0xa'),auth[_0xe87b('0xb')](),controller[_0xe87b('0xc')]);router[_0xe87b('0x6')]('/:id/attachment_download',auth['isChatInteractionAuthorized'](),controller[_0xe87b('0xd')]);router[_0xe87b('0x6')]('/:id/messages',auth[_0xe87b('0x7')](),controller[_0xe87b('0xe')]);router[_0xe87b('0x6')](_0xe87b('0xf'),auth[_0xe87b('0xb')](),controller[_0xe87b('0x10')]);router[_0xe87b('0x6')](_0xe87b('0x11'),auth['isAuthenticated'](),controller[_0xe87b('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe87b('0x13')]);router[_0xe87b('0x14')](_0xe87b('0x15'),auth[_0xe87b('0x7')](),controller[_0xe87b('0x16')]);var upload=multer({'storage':multer[_0xe87b('0x17')]({'destination':function(_0x59568e,_0x788468,_0x397302){_0x397302(null,path[_0xe87b('0x18')](config[_0xe87b('0x19')],_0xe87b('0x1a')));},'filename':function(_0x7b3a5a,_0x151af3,_0x28d37d){_0x28d37d(null,util[_0xe87b('0x1b')](_0xe87b('0x1c'),Date['now'](),_0x151af3[_0xe87b('0x1d')][_0xe87b('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xe87b('0x1f'),upload[_0xe87b('0x20')]('file'),controller[_0xe87b('0x21')]);router['post'](_0xe87b('0x22'),auth['isChatInteractionAuthorized'](),controller[_0xe87b('0x23')]);router['post']('/:id/tags',auth[_0xe87b('0x7')](),interaction[_0xe87b('0x24')](_0xe87b('0x25'),_0xe87b('0x26')),controller['addTags']);router[_0xe87b('0x27')](_0xe87b('0xa'),auth['isAuthenticated'](),interaction[_0xe87b('0x24')](_0xe87b('0x25'),_0xe87b('0x28')),controller['update']);router['put'](_0xe87b('0x29'),controller[_0xe87b('0x2a')]);router[_0xe87b('0x27')](_0xe87b('0x2b'),auth['isChatInteractionAuthorized'](),controller[_0xe87b('0x2c')]);router[_0xe87b('0x27')](_0xe87b('0x2d'),controller[_0xe87b('0x2e')]);router['delete'](_0xe87b('0xa'),auth[_0xe87b('0x7')](),interaction[_0xe87b('0x24')](_0xe87b('0x25'),_0xe87b('0x2f')),controller[_0xe87b('0x30')]);router['delete'](_0xe87b('0x31'),auth[_0xe87b('0x7')](),controller[_0xe87b('0x32')]);module[_0xe87b('0x33')]=router; \ No newline at end of file +var _0xad24=['removeTags','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','get','describe','/:id','show','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/download','download','post','create','/:id/vidaoo','diskStorage','join','root','server/files/attachments/','%s-%s','now','originalname','replace','/:id/attachment_upload','file','attachmentUpload','addMessage','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','delete','chatinteraction:destroy','destroy','/:id/tags'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xad24,0x65));var _0x4ad2=function(_0xf6760f,_0xe9e7a5){_0xf6760f=_0xf6760f-0x0;var _0x19a2b6=_0xad24[_0xf6760f];return _0x19a2b6;};'use strict';var multer=require(_0x4ad2('0x0'));var util=require(_0x4ad2('0x1'));var path=require(_0x4ad2('0x2'));var timeout=require('connect-timeout');var express=require(_0x4ad2('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4ad2('0x4'));var interaction=require(_0x4ad2('0x5'));var config=require(_0x4ad2('0x6'));var controller=require(_0x4ad2('0x7'));router['get']('/',auth[_0x4ad2('0x8')](),controller['index']);router[_0x4ad2('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x4ad2('0xa')]);router[_0x4ad2('0x9')](_0x4ad2('0xb'),auth['isChatInteractionAuthorized'](),controller[_0x4ad2('0xc')]);router['get']('/:id/attachment_download',auth[_0x4ad2('0xd')](),controller[_0x4ad2('0xe')]);router[_0x4ad2('0x9')](_0x4ad2('0xf'),auth[_0x4ad2('0x8')](),controller[_0x4ad2('0x10')]);router[_0x4ad2('0x9')]('/:id/my_messages',auth[_0x4ad2('0xd')](),controller['getMyMessages']);router['get'](_0x4ad2('0x11'),auth[_0x4ad2('0x8')](),controller[_0x4ad2('0x12')]);router[_0x4ad2('0x13')]('/',auth['isAuthenticated'](),controller[_0x4ad2('0x14')]);router[_0x4ad2('0x13')](_0x4ad2('0x15'),auth[_0x4ad2('0x8')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x4ad2('0x16')]({'destination':function(_0x13cbd9,_0x461a28,_0xdd6da0){_0xdd6da0(null,path[_0x4ad2('0x17')](config[_0x4ad2('0x18')],_0x4ad2('0x19')));},'filename':function(_0x244929,_0x535a63,_0x389c07){_0x389c07(null,util['format'](_0x4ad2('0x1a'),Date[_0x4ad2('0x1b')](),_0x535a63[_0x4ad2('0x1c')][_0x4ad2('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x4ad2('0x13')](_0x4ad2('0x1e'),upload['single'](_0x4ad2('0x1f')),controller[_0x4ad2('0x20')]);router[_0x4ad2('0x13')](_0x4ad2('0xf'),auth[_0x4ad2('0xd')](),controller[_0x4ad2('0x21')]);router[_0x4ad2('0x13')]('/:id/tags',auth[_0x4ad2('0x8')](),interaction[_0x4ad2('0x22')](_0x4ad2('0x23'),_0x4ad2('0x24')),controller[_0x4ad2('0x25')]);router[_0x4ad2('0x26')](_0x4ad2('0xb'),auth[_0x4ad2('0x8')](),interaction[_0x4ad2('0x22')](_0x4ad2('0x23'),_0x4ad2('0x27')),controller[_0x4ad2('0x28')]);router[_0x4ad2('0x26')](_0x4ad2('0x29'),controller[_0x4ad2('0x2a')]);router[_0x4ad2('0x26')](_0x4ad2('0x2b'),auth[_0x4ad2('0xd')](),controller[_0x4ad2('0x2c')]);router[_0x4ad2('0x26')]('/:id/close',controller['close']);router[_0x4ad2('0x2d')](_0x4ad2('0xb'),auth[_0x4ad2('0x8')](),interaction[_0x4ad2('0x22')](_0x4ad2('0x23'),_0x4ad2('0x2e')),controller[_0x4ad2('0x2f')]);router[_0x4ad2('0x2d')](_0x4ad2('0x30'),auth[_0x4ad2('0x8')](),controller[_0x4ad2('0x31')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 8c67b06..0086ced 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 _0x261a=['BOOLEAN','INTEGER','sequelize','exports','TEXT'];(function(_0x239cca,_0x4d807b){var _0x57675a=function(_0x161741){while(--_0x161741){_0x239cca['push'](_0x239cca['shift']());}};_0x57675a(++_0x4d807b);}(_0x261a,0x66));var _0xa261=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x261a[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xa261('0x0'));module[_0xa261('0x1')]={'body':{'type':Sequelize[_0xa261('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa261('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xa261('0x4')]}}; \ No newline at end of file +var _0x783f=['TEXT','medium','INTEGER','sequelize'];(function(_0x31fac4,_0x261e72){var _0x189743=function(_0x2a4da1){while(--_0x2a4da1){_0x31fac4['push'](_0x31fac4['shift']());}};_0x189743(++_0x261e72);}(_0x783f,0x1a3));var _0xf783=function(_0x2fd0f6,_0x2176fe){_0x2fd0f6=_0x2fd0f6-0x0;var _0x2d723f=_0x783f[_0x2fd0f6];return _0x2d723f;};'use strict';var Sequelize=require(_0xf783('0x0'));module['exports']={'body':{'type':Sequelize[_0xf783('0x1')](_0xf783('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xf783('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 50b2759..3e57cba 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 _0xa98a=['includeAll','include','findAll','params','options','find','catch','create','body','describe','get','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','userpic','internal','online','lastLoginAt','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','isEmpty','filter','resourceId','push','messages','FromId','ToId','read','all','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','limit','undefined','offset','set','Content-Range','apply','reject','update','then','destroy','name','send','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','merge','VIRTUAL','ChatInternalMessage','count'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0xa98a,0x103));var _0xaa98=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa98a[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xaa98('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaa98('0x1'));var moment=require(_0xaa98('0x2'));var BPromise=require(_0xaa98('0x3'));var Mustache=require(_0xaa98('0x4'));var util=require(_0xaa98('0x5'));var path=require(_0xaa98('0x6'));var sox=require(_0xaa98('0x7'));var csv=require(_0xaa98('0x8'));var ejs=require(_0xaa98('0x9'));var fs=require('fs');var fs_extra=require(_0xaa98('0xa'));var _=require(_0xaa98('0xb'));var squel=require('squel');var crypto=require(_0xaa98('0xc'));var jsforce=require(_0xaa98('0xd'));var deskjs=require(_0xaa98('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xaa98('0xf'));var Redis=require(_0xaa98('0x10'));var authService=require(_0xaa98('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xaa98('0x12'));var hardwareService=require(_0xaa98('0x13'));var logger=require(_0xaa98('0x14'))(_0xaa98('0x15'));var utils=require('../../config/utils');var config=require(_0xaa98('0x16'));var licenseUtil=require(_0xaa98('0x17'));var db=require(_0xaa98('0x18'))['db'];config[_0xaa98('0x19')]=_[_0xaa98('0x1a')](config['redis'],{'host':_0xaa98('0x1b'),'port':0x18eb});var socket=require(_0xaa98('0x1c'))(new Redis(config['redis']));require(_0xaa98('0x1d'))[_0xaa98('0x1e')](socket);function respondWithStatusCode(_0x5e3893,_0x247957){_0x247957=_0x247957||0xcc;return function(_0x3cfda1){if(_0x3cfda1){return _0x5e3893[_0xaa98('0x1f')](_0x247957);}return _0x5e3893[_0xaa98('0x20')](_0x247957)[_0xaa98('0x21')]();};}function respondWithResult(_0x140a20,_0x1ed1b9){_0x1ed1b9=_0x1ed1b9||0xc8;return function(_0x32d535){if(_0x32d535){return _0x140a20[_0xaa98('0x20')](_0x1ed1b9)[_0xaa98('0x22')](_0x32d535);}};}function respondWithFilteredResult(_0x38572c,_0x258178){return function(_0x252a4e){if(_0x252a4e){var _0x3b9e1b=typeof _0x258178['offset']==='undefined'&&typeof _0x258178[_0xaa98('0x23')]===_0xaa98('0x24');var _0x148532=_0x252a4e['count'];var _0x99d02f=_0x3b9e1b?0x0:_0x258178['offset'];var _0x12cb17=_0x3b9e1b?_0x252a4e['count']:_0x258178[_0xaa98('0x25')]+_0x258178['limit'];var _0x481d7b;if(_0x12cb17>=_0x148532){_0x12cb17=_0x148532;_0x481d7b=0xc8;}else{_0x481d7b=0xce;}_0x38572c[_0xaa98('0x20')](_0x481d7b);return _0x38572c[_0xaa98('0x26')](_0xaa98('0x27'),_0x99d02f+'-'+_0x12cb17+'/'+_0x148532)[_0xaa98('0x22')](_0x252a4e);}return null;};}function patchUpdates(_0x1b311d){return function(_0x702bc7){try{jsonpatch[_0xaa98('0x28')](_0x702bc7,_0x1b311d,!![]);}catch(_0x49f76b){return BPromise[_0xaa98('0x29')](_0x49f76b);}return _0x702bc7['save']();};}function saveUpdates(_0x18e1f7,_0x18edf6){return function(_0x188cca){if(_0x188cca){return _0x188cca[_0xaa98('0x2a')](_0x18e1f7)[_0xaa98('0x2b')](function(_0x169e21){return _0x169e21;});}return null;};}function removeEntity(_0xa5446b,_0x50132d){return function(_0xe96d58){if(_0xe96d58){return _0xe96d58[_0xaa98('0x2c')]()[_0xaa98('0x2b')](function(){_0xa5446b[_0xaa98('0x20')](0xcc)[_0xaa98('0x21')]();});}};}function handleEntityNotFound(_0x3795b8,_0x4aa479){return function(_0x5970e3){if(!_0x5970e3){_0x3795b8['sendStatus'](0x194);}return _0x5970e3;};}function handleError(_0x5f3836,_0xb7d4a4){_0xb7d4a4=_0xb7d4a4||0x1f4;return function(_0x4335c4){logger['error'](_0x4335c4['stack']);if(_0x4335c4[_0xaa98('0x2d')]){delete _0x4335c4[_0xaa98('0x2d')];}_0x5f3836[_0xaa98('0x20')](_0xb7d4a4)[_0xaa98('0x2e')](_0x4335c4);};}exports['index']=function(_0x1e748c,_0x5f2bb3){var _0x4ccb9e={},_0x3d5b3a={},_0x47771c={'count':0x0,'rows':[]};var _0x1e2a9a=_[_0xaa98('0x2f')](db['ChatInternalMessage'][_0xaa98('0x30')],function(_0x437017){return{'name':_0x437017[_0xaa98('0x31')],'type':_0x437017[_0xaa98('0x32')][_0xaa98('0x33')]};});_0x3d5b3a['model']=_[_0xaa98('0x2f')](_0x1e2a9a,'name');_0x3d5b3a[_0xaa98('0x34')]=_[_0xaa98('0x35')](_0x1e748c[_0xaa98('0x34')]);_0x3d5b3a['filters']=_[_0xaa98('0x36')](_0x3d5b3a[_0xaa98('0x37')],_0x3d5b3a[_0xaa98('0x34')]);_0x4ccb9e[_0xaa98('0x38')]=_[_0xaa98('0x36')](_0x3d5b3a['model'],qs[_0xaa98('0x39')](_0x1e748c[_0xaa98('0x34')][_0xaa98('0x39')]));_0x4ccb9e[_0xaa98('0x38')]=_0x4ccb9e[_0xaa98('0x38')][_0xaa98('0x3a')]?_0x4ccb9e[_0xaa98('0x38')]:_0x3d5b3a[_0xaa98('0x37')];if(!_0x1e748c['query']['hasOwnProperty'](_0xaa98('0x3b'))){_0x4ccb9e[_0xaa98('0x23')]=qs[_0xaa98('0x23')](_0x1e748c[_0xaa98('0x34')]['limit']);_0x4ccb9e[_0xaa98('0x25')]=qs['offset'](_0x1e748c[_0xaa98('0x34')][_0xaa98('0x25')]);}_0x4ccb9e[_0xaa98('0x3c')]=qs[_0xaa98('0x3d')](_0x1e748c['query'][_0xaa98('0x3d')]);_0x4ccb9e[_0xaa98('0x3e')]=qs[_0xaa98('0x3f')](_['pick'](_0x1e748c[_0xaa98('0x34')],_0x3d5b3a[_0xaa98('0x3f')]),_0x1e2a9a);if(_0x1e748c[_0xaa98('0x34')]['filter']){_0x4ccb9e[_0xaa98('0x3e')]=_[_0xaa98('0x40')](_0x4ccb9e[_0xaa98('0x3e')],{'$or':_[_0xaa98('0x2f')](_0x1e2a9a,function(_0x9476f6){if(_0x9476f6['type']!==_0xaa98('0x41')){var _0x436e8c={};_0x436e8c[_0x9476f6[_0xaa98('0x2d')]]={'$like':'%'+_0x1e748c[_0xaa98('0x34')]['filter']+'%'};return _0x436e8c;}})});}_0x4ccb9e=_['merge']({},_0x4ccb9e,_0x1e748c['options']);var _0x53627a={'where':_0x4ccb9e[_0xaa98('0x3e')]};return db[_0xaa98('0x42')]['count'](_0x53627a)[_0xaa98('0x2b')](function(_0x355f4b){_0x47771c[_0xaa98('0x43')]=_0x355f4b;if(_0x1e748c['query'][_0xaa98('0x44')]){_0x4ccb9e[_0xaa98('0x45')]=[{'all':!![]}];}return db[_0xaa98('0x42')][_0xaa98('0x46')](_0x4ccb9e);})['then'](function(_0x3363b6){_0x47771c['rows']=_0x3363b6;return _0x47771c;})['then'](respondWithFilteredResult(_0x5f2bb3,_0x4ccb9e))['catch'](handleError(_0x5f2bb3,null));};exports['show']=function(_0x538c83,_0x197eaa){var _0x5d93fd={'raw':!![],'where':{'id':_0x538c83[_0xaa98('0x47')]['id']}},_0x3d112d={};_0x3d112d[_0xaa98('0x37')]=_[_0xaa98('0x35')](db[_0xaa98('0x42')][_0xaa98('0x30')]);_0x3d112d[_0xaa98('0x34')]=_[_0xaa98('0x35')](_0x538c83[_0xaa98('0x34')]);_0x3d112d[_0xaa98('0x3f')]=_[_0xaa98('0x36')](_0x3d112d[_0xaa98('0x37')],_0x3d112d[_0xaa98('0x34')]);_0x5d93fd[_0xaa98('0x38')]=_['intersection'](_0x3d112d[_0xaa98('0x37')],qs[_0xaa98('0x39')](_0x538c83[_0xaa98('0x34')]['fields']));_0x5d93fd[_0xaa98('0x38')]=_0x5d93fd[_0xaa98('0x38')]['length']?_0x5d93fd[_0xaa98('0x38')]:_0x3d112d[_0xaa98('0x37')];if(_0x538c83[_0xaa98('0x34')]['includeAll']){_0x5d93fd[_0xaa98('0x45')]=[{'all':!![]}];}_0x5d93fd=_[_0xaa98('0x40')]({},_0x5d93fd,_0x538c83[_0xaa98('0x48')]);return db['ChatInternalMessage'][_0xaa98('0x49')](_0x5d93fd)[_0xaa98('0x2b')](handleEntityNotFound(_0x197eaa,null))['then'](respondWithResult(_0x197eaa,null))[_0xaa98('0x4a')](handleError(_0x197eaa,null));};exports[_0xaa98('0x4b')]=function(_0x2bf1ce,_0x3bc077){return db['ChatInternalMessage'][_0xaa98('0x4b')](_0x2bf1ce[_0xaa98('0x4c')],{})[_0xaa98('0x2b')](respondWithResult(_0x3bc077,0xc9))[_0xaa98('0x4a')](handleError(_0x3bc077,null));};exports[_0xaa98('0x2a')]=function(_0x30e573,_0x13873b){if(_0x30e573[_0xaa98('0x4c')]['id']){delete _0x30e573[_0xaa98('0x4c')]['id'];}return db[_0xaa98('0x42')][_0xaa98('0x49')]({'where':{'id':_0x30e573['params']['id']}})[_0xaa98('0x2b')](handleEntityNotFound(_0x13873b,null))[_0xaa98('0x2b')](saveUpdates(_0x30e573[_0xaa98('0x4c')],null))['then'](respondWithResult(_0x13873b,null))[_0xaa98('0x4a')](handleError(_0x13873b,null));};exports['destroy']=function(_0x46d0cc,_0xab3390){return db[_0xaa98('0x42')][_0xaa98('0x49')]({'where':{'id':_0x46d0cc[_0xaa98('0x47')]['id']}})['then'](handleEntityNotFound(_0xab3390,null))[_0xaa98('0x2b')](removeEntity(_0xab3390,null))[_0xaa98('0x4a')](handleError(_0xab3390,null));};exports[_0xaa98('0x4d')]=function(_0x40857c,_0x34b6f8){return db[_0xaa98('0x42')][_0xaa98('0x4d')]()['then'](respondWithResult(_0x34b6f8,null))[_0xaa98('0x4a')](handleError(_0x34b6f8,null));};function wrapUser(_0x49183b){return function(_0x3c8189){var _0x2c2c25=_0x49183b[_0xaa98('0x4e')]({'plain':!![]});_0x2c2c25['messages']=[];if(_0x3c8189){_0x2c2c25['lastMessageAt']=_0x3c8189[_0xaa98('0x4f')];_0x2c2c25[_0xaa98('0x50')]=_0x3c8189;}else{_0x2c2c25['lastMessageAt']=moment(0x0)['format'](_0xaa98('0x51'));_0x2c2c25[_0xaa98('0x50')]={};}return _0x2c2c25;};}exports[_0xaa98('0x52')]=function(_0x2f8279,_0x3ba7cb,_0x3231ac){var _0x1e589c=[];return db[_0xaa98('0x53')][_0xaa98('0x46')]({'where':{'role':[_0xaa98('0x54'),_0xaa98('0x55'),_0xaa98('0x56')]},'attributes':['id',_0xaa98('0x57'),_0xaa98('0x2d'),'role',_0xaa98('0x58'),_0xaa98('0x59'),_0xaa98('0x5a'),_0xaa98('0x5b'),'allowmessenger','showWebBar'],'order':qs[_0xaa98('0x3d')](_0xaa98('0x5c')),'include':[{'model':db[_0xaa98('0x5d')],'as':_0xaa98('0x5e'),'attributes':['id',_0xaa98('0x2d'),'type'],'through':{'attributes':[]}}]})[_0xaa98('0x2b')](function(_0x3d90be){if(_0x3d90be){var _0x362b41=_0x2f8279['user'][_0xaa98('0x4e')]({'plain':!![]});if(!_0x362b41)throw new Error(_0xaa98('0x5f'));if(_0x362b41[_0xaa98('0x60')]===_0xaa98('0x56')){return db[_0xaa98('0x61')][_0xaa98('0x49')]({'where':{'name':'Agents','userProfileId':_0x362b41[_0xaa98('0x62')]},'raw':!![]})[_0xaa98('0x2b')](function(_0x4cbcc0){if(_0x4cbcc0){if(_0x4cbcc0['autoAssociation']===0x0){return db[_0xaa98('0x63')][_0xaa98('0x46')]({'where':{'sectionId':_0x4cbcc0['id']},'raw':!![]})['then'](function(_0x4a8df3){var _0x3a397a=[];if(_[_0xaa98('0x64')](_0x4a8df3)){_0x3a397a=_[_0xaa98('0x65')](_0x3d90be,function(_0x5c426e){if(_0x5c426e[_0xaa98('0x60')]!=='agent'){return _0x5c426e;}});return _0x3a397a;}else{for(var _0x4e12c8=0x0;_0x4e12c8<_0x3d90be[_0xaa98('0x3a')];_0x4e12c8++){var _0x1bc428=_0x3d90be[_0x4e12c8];if(_0x1bc428[_0xaa98('0x60')]==='agent'){var _0x5147ac=_['find'](_0x4a8df3,function(_0x4eca29){return _0x4eca29[_0xaa98('0x66')]===_0x1bc428['id'];});if(_0x5147ac)_0x3a397a['push'](_0x1bc428);}else{_0x3a397a[_0xaa98('0x67')](_0x1bc428);}}return _0x3a397a;}});}else{return _0x3d90be;}}else{var _0x3cb72d=_['filter'](_0x3d90be,function(_0x45393b){if(_0x45393b[_0xaa98('0x60')]!==_0xaa98('0x54')){return _0x45393b;}});return _0x3cb72d;}});}else{return _0x3d90be;}}})[_0xaa98('0x2b')](function(_0xc410f0){var _0x122b24=[];if(_0xc410f0){_0x1e589c=_0xc410f0;for(var _0x5e38a7=0x0;_0x5e38a7<_0xc410f0['length'];_0x5e38a7+=0x1){_0x1e589c[_0x5e38a7][_0xaa98('0x68')]=[];_0x122b24[_0xaa98('0x67')](db[_0xaa98('0x42')][_0xaa98('0x49')]({'where':{'FromId':[_0x2f8279[_0xaa98('0x56')]['id'],_0xc410f0[_0x5e38a7]['id']],'ToId':[_0x2f8279['user']['id'],_0xc410f0[_0x5e38a7]['id']],'ChatGroupId':null},'attributes':['id',_0xaa98('0x4f'),_0xaa98('0x69'),_0xaa98('0x6a'),_0xaa98('0x6b'),_0xaa98('0x4c')],'order':qs[_0xaa98('0x3d')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xaa98('0x2b')](wrapUser(_0xc410f0[_0x5e38a7])));}return BPromise[_0xaa98('0x6c')](_0x122b24);}return[];})[_0xaa98('0x2b')](function(_0x3c70b9){return{'rows':_0x3c70b9,'count':_0x3c70b9['length']};})[_0xaa98('0x2b')](respondWithResult(_0x3ba7cb,null))[_0xaa98('0x4a')](handleError(_0x3ba7cb,null));}; \ No newline at end of file +var _0x651a=['attributes','fields','length','nolimit','offset','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','describe','get','messages','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','User','agent','admin','user','fullname','role','userpic','internal','lastLoginAt','allowmessenger','-online','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','createdAt','FromId','read','all','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatInternalMessage.socket','register','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','ChatInternalMessage','fieldName','key','model','map','query','filters','intersection'];(function(_0x45aa4e,_0x4c0c61){var _0x38420e=function(_0x50cdc8){while(--_0x50cdc8){_0x45aa4e['push'](_0x45aa4e['shift']());}};_0x38420e(++_0x4c0c61);}(_0x651a,0x1ee));var _0xa651=function(_0x2a87e9,_0x25c03e){_0x2a87e9=_0x2a87e9-0x0;var _0x5de0e6=_0x651a[_0x2a87e9];return _0x5de0e6;};'use strict';var emlformat=require(_0xa651('0x0'));var rimraf=require(_0xa651('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa651('0x2'));var rp=require('request-promise');var moment=require(_0xa651('0x3'));var BPromise=require(_0xa651('0x4'));var Mustache=require(_0xa651('0x5'));var util=require('util');var path=require(_0xa651('0x6'));var sox=require(_0xa651('0x7'));var csv=require(_0xa651('0x8'));var ejs=require(_0xa651('0x9'));var fs=require('fs');var fs_extra=require(_0xa651('0xa'));var _=require(_0xa651('0xb'));var squel=require(_0xa651('0xc'));var crypto=require(_0xa651('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa651('0xe'));var toCsv=require(_0xa651('0x8'));var querystring=require(_0xa651('0xf'));var Papa=require(_0xa651('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa651('0x11'));var as=require(_0xa651('0x12'));var hardwareService=require(_0xa651('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xa651('0x14'));var config=require(_0xa651('0x15'));var licenseUtil=require(_0xa651('0x16'));var db=require(_0xa651('0x17'))['db'];config[_0xa651('0x18')]=_[_0xa651('0x19')](config[_0xa651('0x18')],{'host':_0xa651('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa651('0x1b'))[_0xa651('0x1c')](socket);function respondWithStatusCode(_0x98a95d,_0x30ec80){_0x30ec80=_0x30ec80||0xcc;return function(_0x3c38dd){if(_0x3c38dd){return _0x98a95d[_0xa651('0x1d')](_0x30ec80);}return _0x98a95d[_0xa651('0x1e')](_0x30ec80)[_0xa651('0x1f')]();};}function respondWithResult(_0x1e143a,_0x4be07d){_0x4be07d=_0x4be07d||0xc8;return function(_0x5943bb){if(_0x5943bb){return _0x1e143a['status'](_0x4be07d)[_0xa651('0x20')](_0x5943bb);}};}function respondWithFilteredResult(_0x418336,_0x52cecd){return function(_0xacde6e){if(_0xacde6e){var _0x1d68f8=typeof _0x52cecd['offset']===_0xa651('0x21')&&typeof _0x52cecd[_0xa651('0x22')]===_0xa651('0x21');var _0x4cf22f=_0xacde6e[_0xa651('0x23')];var _0x91f73d=_0x1d68f8?0x0:_0x52cecd['offset'];var _0x56e351=_0x1d68f8?_0xacde6e['count']:_0x52cecd['offset']+_0x52cecd['limit'];var _0x2225fb;if(_0x56e351>=_0x4cf22f){_0x56e351=_0x4cf22f;_0x2225fb=0xc8;}else{_0x2225fb=0xce;}_0x418336['status'](_0x2225fb);return _0x418336[_0xa651('0x24')](_0xa651('0x25'),_0x91f73d+'-'+_0x56e351+'/'+_0x4cf22f)[_0xa651('0x20')](_0xacde6e);}return null;};}function patchUpdates(_0x50e9cd){return function(_0x37c057){try{jsonpatch[_0xa651('0x26')](_0x37c057,_0x50e9cd,!![]);}catch(_0x995b6){return BPromise[_0xa651('0x27')](_0x995b6);}return _0x37c057[_0xa651('0x28')]();};}function saveUpdates(_0x4acdc1,_0x2199b9){return function(_0x2258d8){if(_0x2258d8){return _0x2258d8[_0xa651('0x29')](_0x4acdc1)[_0xa651('0x2a')](function(_0x2b3e22){return _0x2b3e22;});}return null;};}function removeEntity(_0x46cb2d,_0x4068ca){return function(_0x281ff4){if(_0x281ff4){return _0x281ff4[_0xa651('0x2b')]()[_0xa651('0x2a')](function(){_0x46cb2d[_0xa651('0x1e')](0xcc)[_0xa651('0x1f')]();});}};}function handleEntityNotFound(_0xf5d7f0,_0x3f825a){return function(_0x562c23){if(!_0x562c23){_0xf5d7f0['sendStatus'](0x194);}return _0x562c23;};}function handleError(_0x168452,_0x330e6f){_0x330e6f=_0x330e6f||0x1f4;return function(_0x265d16){logger[_0xa651('0x2c')](_0x265d16[_0xa651('0x2d')]);if(_0x265d16[_0xa651('0x2e')]){delete _0x265d16[_0xa651('0x2e')];}_0x168452[_0xa651('0x1e')](_0x330e6f)[_0xa651('0x2f')](_0x265d16);};}exports['index']=function(_0x20133f,_0x576cfe){var _0x1f268a={},_0x22e062={},_0x4a6062={'count':0x0,'rows':[]};var _0x1649f5=_['map'](db[_0xa651('0x30')]['rawAttributes'],function(_0x51cb6e){return{'name':_0x51cb6e[_0xa651('0x31')],'type':_0x51cb6e['type'][_0xa651('0x32')]};});_0x22e062[_0xa651('0x33')]=_[_0xa651('0x34')](_0x1649f5,_0xa651('0x2e'));_0x22e062[_0xa651('0x35')]=_['keys'](_0x20133f[_0xa651('0x35')]);_0x22e062[_0xa651('0x36')]=_[_0xa651('0x37')](_0x22e062[_0xa651('0x33')],_0x22e062[_0xa651('0x35')]);_0x1f268a[_0xa651('0x38')]=_[_0xa651('0x37')](_0x22e062[_0xa651('0x33')],qs[_0xa651('0x39')](_0x20133f['query']['fields']));_0x1f268a[_0xa651('0x38')]=_0x1f268a[_0xa651('0x38')][_0xa651('0x3a')]?_0x1f268a[_0xa651('0x38')]:_0x22e062[_0xa651('0x33')];if(!_0x20133f[_0xa651('0x35')]['hasOwnProperty'](_0xa651('0x3b'))){_0x1f268a['limit']=qs[_0xa651('0x22')](_0x20133f[_0xa651('0x35')][_0xa651('0x22')]);_0x1f268a[_0xa651('0x3c')]=qs[_0xa651('0x3c')](_0x20133f[_0xa651('0x35')][_0xa651('0x3c')]);}_0x1f268a['order']=qs[_0xa651('0x3d')](_0x20133f[_0xa651('0x35')][_0xa651('0x3d')]);_0x1f268a['where']=qs[_0xa651('0x36')](_[_0xa651('0x3e')](_0x20133f['query'],_0x22e062[_0xa651('0x36')]),_0x1649f5);if(_0x20133f['query'][_0xa651('0x3f')]){_0x1f268a['where']=_[_0xa651('0x40')](_0x1f268a[_0xa651('0x41')],{'$or':_['map'](_0x1649f5,function(_0x140917){if(_0x140917[_0xa651('0x42')]!==_0xa651('0x43')){var _0x422047={};_0x422047[_0x140917[_0xa651('0x2e')]]={'$like':'%'+_0x20133f[_0xa651('0x35')][_0xa651('0x3f')]+'%'};return _0x422047;}})});}_0x1f268a=_[_0xa651('0x40')]({},_0x1f268a,_0x20133f[_0xa651('0x44')]);var _0x5e1eaa={'where':_0x1f268a['where']};return db[_0xa651('0x30')][_0xa651('0x23')](_0x5e1eaa)['then'](function(_0x5dbd39){_0x4a6062[_0xa651('0x23')]=_0x5dbd39;if(_0x20133f[_0xa651('0x35')][_0xa651('0x45')]){_0x1f268a['include']=[{'all':!![]}];}return db[_0xa651('0x30')][_0xa651('0x46')](_0x1f268a);})[_0xa651('0x2a')](function(_0x2e719d){_0x4a6062[_0xa651('0x47')]=_0x2e719d;return _0x4a6062;})['then'](respondWithFilteredResult(_0x576cfe,_0x1f268a))[_0xa651('0x48')](handleError(_0x576cfe,null));};exports[_0xa651('0x49')]=function(_0x381934,_0x533607){var _0x15fbc2={'raw':!![],'where':{'id':_0x381934[_0xa651('0x4a')]['id']}},_0x2fb4b7={};_0x2fb4b7['model']=_[_0xa651('0x4b')](db[_0xa651('0x30')][_0xa651('0x4c')]);_0x2fb4b7[_0xa651('0x35')]=_['keys'](_0x381934['query']);_0x2fb4b7[_0xa651('0x36')]=_[_0xa651('0x37')](_0x2fb4b7[_0xa651('0x33')],_0x2fb4b7[_0xa651('0x35')]);_0x15fbc2[_0xa651('0x38')]=_[_0xa651('0x37')](_0x2fb4b7[_0xa651('0x33')],qs[_0xa651('0x39')](_0x381934[_0xa651('0x35')][_0xa651('0x39')]));_0x15fbc2[_0xa651('0x38')]=_0x15fbc2['attributes']['length']?_0x15fbc2[_0xa651('0x38')]:_0x2fb4b7['model'];if(_0x381934[_0xa651('0x35')]['includeAll']){_0x15fbc2['include']=[{'all':!![]}];}_0x15fbc2=_[_0xa651('0x40')]({},_0x15fbc2,_0x381934[_0xa651('0x44')]);return db[_0xa651('0x30')][_0xa651('0x4d')](_0x15fbc2)[_0xa651('0x2a')](handleEntityNotFound(_0x533607,null))[_0xa651('0x2a')](respondWithResult(_0x533607,null))[_0xa651('0x48')](handleError(_0x533607,null));};exports[_0xa651('0x4e')]=function(_0x5e05ae,_0x46351a){return db[_0xa651('0x30')][_0xa651('0x4e')](_0x5e05ae[_0xa651('0x4f')],{})['then'](respondWithResult(_0x46351a,0xc9))[_0xa651('0x48')](handleError(_0x46351a,null));};exports[_0xa651('0x29')]=function(_0x5a3b18,_0x4a420e){if(_0x5a3b18[_0xa651('0x4f')]['id']){delete _0x5a3b18['body']['id'];}return db[_0xa651('0x30')]['find']({'where':{'id':_0x5a3b18['params']['id']}})[_0xa651('0x2a')](handleEntityNotFound(_0x4a420e,null))[_0xa651('0x2a')](saveUpdates(_0x5a3b18['body'],null))[_0xa651('0x2a')](respondWithResult(_0x4a420e,null))[_0xa651('0x48')](handleError(_0x4a420e,null));};exports[_0xa651('0x2b')]=function(_0x1f4977,_0x2cf097){return db['ChatInternalMessage'][_0xa651('0x4d')]({'where':{'id':_0x1f4977[_0xa651('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2cf097,null))[_0xa651('0x2a')](removeEntity(_0x2cf097,null))['catch'](handleError(_0x2cf097,null));};exports[_0xa651('0x50')]=function(_0x1aa091,_0x3ed22c){return db[_0xa651('0x30')]['describe']()[_0xa651('0x2a')](respondWithResult(_0x3ed22c,null))[_0xa651('0x48')](handleError(_0x3ed22c,null));};function wrapUser(_0x5a290d){return function(_0x54a4cb){var _0x3a4d9a=_0x5a290d[_0xa651('0x51')]({'plain':!![]});_0x3a4d9a[_0xa651('0x52')]=[];if(_0x54a4cb){_0x3a4d9a[_0xa651('0x53')]=_0x54a4cb['createdAt'];_0x3a4d9a['lastMessage']=_0x54a4cb;}else{_0x3a4d9a[_0xa651('0x53')]=moment(0x0)[_0xa651('0x54')](_0xa651('0x55'));_0x3a4d9a['lastMessage']={};}return _0x3a4d9a;};}exports['getUsers']=function(_0x40baad,_0x227d6a,_0x466318){var _0x3705cc=[];return db[_0xa651('0x56')][_0xa651('0x46')]({'where':{'role':[_0xa651('0x57'),_0xa651('0x58'),_0xa651('0x59')]},'attributes':['id',_0xa651('0x5a'),'name',_0xa651('0x5b'),_0xa651('0x5c'),_0xa651('0x5d'),'online',_0xa651('0x5e'),_0xa651('0x5f'),'showWebBar'],'order':qs[_0xa651('0x3d')](_0xa651('0x60')),'include':[{'model':db['VoiceQueue'],'as':_0xa651('0x61'),'attributes':['id',_0xa651('0x2e'),_0xa651('0x42')],'through':{'attributes':[]}}]})[_0xa651('0x2a')](function(_0xe4f151){if(_0xe4f151){var _0x46d778=_0x40baad[_0xa651('0x59')][_0xa651('0x51')]({'plain':!![]});if(!_0x46d778)throw new Error(_0xa651('0x62'));if(_0x46d778['role']===_0xa651('0x59')){return db[_0xa651('0x63')][_0xa651('0x4d')]({'where':{'name':'Agents','userProfileId':_0x46d778[_0xa651('0x64')]},'raw':!![]})[_0xa651('0x2a')](function(_0x49ff37){if(_0x49ff37){if(_0x49ff37[_0xa651('0x65')]===0x0){return db[_0xa651('0x66')]['findAll']({'where':{'sectionId':_0x49ff37['id']},'raw':!![]})[_0xa651('0x2a')](function(_0xf34aac){var _0x363a84=[];if(_[_0xa651('0x67')](_0xf34aac)){_0x363a84=_[_0xa651('0x3f')](_0xe4f151,function(_0x4822d0){if(_0x4822d0[_0xa651('0x5b')]!=='agent'){return _0x4822d0;}});return _0x363a84;}else{for(var _0x2758e0=0x0;_0x2758e0<_0xe4f151['length'];_0x2758e0++){var _0x1f63b8=_0xe4f151[_0x2758e0];if(_0x1f63b8[_0xa651('0x5b')]===_0xa651('0x57')){var _0x549403=_['find'](_0xf34aac,function(_0x365b65){return _0x365b65[_0xa651('0x68')]===_0x1f63b8['id'];});if(_0x549403)_0x363a84[_0xa651('0x69')](_0x1f63b8);}else{_0x363a84[_0xa651('0x69')](_0x1f63b8);}}return _0x363a84;}});}else{return _0xe4f151;}}else{var _0x863a64=_[_0xa651('0x3f')](_0xe4f151,function(_0x3182bd){if(_0x3182bd['role']!==_0xa651('0x57')){return _0x3182bd;}});return _0x863a64;}});}else{return _0xe4f151;}}})[_0xa651('0x2a')](function(_0x260f27){var _0x3847a0=[];if(_0x260f27){_0x3705cc=_0x260f27;for(var _0x8e33fe=0x0;_0x8e33fe<_0x260f27['length'];_0x8e33fe+=0x1){_0x3705cc[_0x8e33fe]['messages']=[];_0x3847a0[_0xa651('0x69')](db[_0xa651('0x30')]['find']({'where':{'FromId':[_0x40baad[_0xa651('0x59')]['id'],_0x260f27[_0x8e33fe]['id']],'ToId':[_0x40baad['user']['id'],_0x260f27[_0x8e33fe]['id']],'ChatGroupId':null},'attributes':['id',_0xa651('0x6a'),_0xa651('0x6b'),'ToId',_0xa651('0x6c'),_0xa651('0x4f')],'order':qs[_0xa651('0x3d')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xa651('0x2a')](wrapUser(_0x260f27[_0x8e33fe])));}return BPromise[_0xa651('0x6d')](_0x3847a0);}return[];})[_0xa651('0x2a')](function(_0x61352a){return{'rows':_0x61352a,'count':_0x61352a['length']};})[_0xa651('0x2a')](respondWithResult(_0x227d6a,null))[_0xa651('0x48')](handleError(_0x227d6a,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 1e463f7..0cf0ad0 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 _0x623d=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','update'];(function(_0x2b152a,_0x3dd988){var _0x2ad4c7=function(_0x2fa97c){while(--_0x2fa97c){_0x2b152a['push'](_0x2b152a['shift']());}};_0x2ad4c7(++_0x3dd988);}(_0x623d,0x109));var _0xd623=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x623d[_0x297fd3];return _0x2af381;};'use strict';var EventEmitter=require(_0xd623('0x0'));var ChatInternalMessage=require(_0xd623('0x1'))['db'][_0xd623('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xd623('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd623('0x4'),'afterDestroy':_0xd623('0x5')};function emitEvent(_0x42a6cd){return function(_0x3474cb,_0x468397,_0x233ff4){ChatInternalMessageEvents['emit'](_0x42a6cd+':'+_0x3474cb['id'],_0x3474cb);ChatInternalMessageEvents[_0xd623('0x6')](_0x42a6cd,_0x3474cb);_0x233ff4(null);};}for(var e in events){if(events[_0xd623('0x7')](e)){var event=events[e];ChatInternalMessage[_0xd623('0x8')](e,emitEvent(event));}}module[_0xd623('0x9')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x71f6=['exports','../../mysqldb','setMaxListeners','save','update','emit','hook'];(function(_0x148308,_0x59b441){var _0x2d3675=function(_0x7b3c6a){while(--_0x7b3c6a){_0x148308['push'](_0x148308['shift']());}};_0x2d3675(++_0x59b441);}(_0x71f6,0x1ac));var _0x671f=function(_0x255626,_0x18521f){_0x255626=_0x255626-0x0;var _0x135359=_0x71f6[_0x255626];return _0x135359;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x671f('0x0'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x671f('0x1')](0x0);var events={'afterCreate':_0x671f('0x2'),'afterUpdate':_0x671f('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3b869f){return function(_0x19fefa,_0x43682b,_0x20f576){ChatInternalMessageEvents[_0x671f('0x4')](_0x3b869f+':'+_0x19fefa['id'],_0x19fefa);ChatInternalMessageEvents[_0x671f('0x4')](_0x3b869f,_0x19fefa);_0x20f576(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x671f('0x5')](e,emitEvent(event));}}module[_0x671f('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 cbd4a00..57379d3 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 _0xcc8e=['utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','exports','define','ChatInternalMessage','chat_internal_messages'];(function(_0x4b5187,_0x547048){var _0x4c164f=function(_0x4c666e){while(--_0x4c666e){_0x4b5187['push'](_0x4b5187['shift']());}};_0x4c164f(++_0x547048);}(_0xcc8e,0x16a));var _0xecc8=function(_0x1297e0,_0x1eb8de){_0x1297e0=_0x1297e0-0x0;var _0x12c8b3=_0xcc8e[_0x1297e0];return _0x12c8b3;};'use strict';var _=require(_0xecc8('0x0'));var util=require(_0xecc8('0x1'));var logger=require('../../config/logger')(_0xecc8('0x2'));var moment=require(_0xecc8('0x3'));var BPromise=require(_0xecc8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xecc8('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatInternalMessage.attributes');module[_0xecc8('0x6')]=function(_0x232b0a,_0x412231){return _0x232b0a[_0xecc8('0x7')](_0xecc8('0x8'),attributes,{'tableName':_0xecc8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xecc8('0xa'),'collate':_0xecc8('0xb')});}; \ No newline at end of file +var _0xa030=['api','moment','bluebird','request-promise','path','rimraf','exports','define','chat_internal_messages','utf8mb4','lodash','util','../../config/logger'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xa030,0x169));var _0x0a03=function(_0x116578,_0x337863){_0x116578=_0x116578-0x0;var _0x85a2da=_0xa030[_0x116578];return _0x85a2da;};'use strict';var _=require(_0x0a03('0x0'));var util=require(_0x0a03('0x1'));var logger=require(_0x0a03('0x2'))(_0x0a03('0x3'));var moment=require(_0x0a03('0x4'));var BPromise=require(_0x0a03('0x5'));var rp=require(_0x0a03('0x6'));var fs=require('fs');var path=require(_0x0a03('0x7'));var rimraf=require(_0x0a03('0x8'));var config=require('../../config/environment');var attributes=require('./chatInternalMessage.attributes');module[_0x0a03('0x9')]=function(_0x361eec,_0x4496fc){return _0x361eec[_0x0a03('0xa')]('ChatInternalMessage',attributes,{'tableName':_0x0a03('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0a03('0xc'),'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 6c90e3e..5e25aa5 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 _0x4891=['ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatInternalMessage,\x20%s,\x20%s','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','request\x20sent'];(function(_0x11af2b,_0x41538f){var _0x4a0e43=function(_0x4ae1df){while(--_0x4ae1df){_0x11af2b['push'](_0x11af2b['shift']());}};_0x4a0e43(++_0x41538f);}(_0x4891,0x166));var _0x1489=function(_0x1bbef9,_0x27aafc){_0x1bbef9=_0x1bbef9-0x0;var _0x23c45c=_0x4891[_0x1bbef9];return _0x23c45c;};'use strict';var _=require(_0x1489('0x0'));var util=require(_0x1489('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1489('0x2'));var db=require(_0x1489('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1489('0x4'))('rpc');var config=require(_0x1489('0x5'));var jayson=require(_0x1489('0x6'));var client=jayson[_0x1489('0x7')]['http']({'port':0x232a});config[_0x1489('0x8')]=_['defaults'](config[_0x1489('0x8')],{'host':_0x1489('0x9'),'port':0x18eb});var socket=require(_0x1489('0xa'))(new Redis(config[_0x1489('0x8')]));require(_0x1489('0xb'))[_0x1489('0xc')](socket);function respondWithRpcPromise(_0x109fea,_0x48805c,_0x550283){return new BPromise(function(_0x243644,_0x423118){return client[_0x1489('0xd')](_0x109fea,_0x550283)[_0x1489('0xe')](function(_0x321df5){logger[_0x1489('0xf')]('ChatInternalMessage,\x20%s,\x20%s',_0x48805c,_0x1489('0x10'));logger['debug'](_0x1489('0x11'),_0x48805c,_0x1489('0x10'),JSON[_0x1489('0x12')](_0x321df5));if(_0x321df5[_0x1489('0x13')]){if(_0x321df5[_0x1489('0x13')][_0x1489('0x14')]===0x1f4){logger[_0x1489('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x48805c,_0x321df5['error'][_0x1489('0x15')]);return _0x423118(_0x321df5['error'][_0x1489('0x15')]);}logger[_0x1489('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x48805c,_0x321df5[_0x1489('0x13')][_0x1489('0x15')]);return _0x243644(_0x321df5[_0x1489('0x13')][_0x1489('0x15')]);}else{logger[_0x1489('0xf')](_0x1489('0x16'),_0x48805c,'request\x20sent');_0x243644(_0x321df5[_0x1489('0x17')][_0x1489('0x15')]);}})[_0x1489('0x18')](function(_0x597b4f){logger[_0x1489('0x13')](_0x1489('0x16'),_0x48805c,_0x597b4f);_0x423118(_0x597b4f);});});} \ No newline at end of file +var _0xa62e=['util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./chatInternalMessage.socket','register','request','then','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash'];(function(_0x7578bc,_0x27fe04){var _0x32a1c1=function(_0x470741){while(--_0x470741){_0x7578bc['push'](_0x7578bc['shift']());}};_0x32a1c1(++_0x27fe04);}(_0xa62e,0x128));var _0xea62=function(_0x2575ed,_0x8c52f0){_0x2575ed=_0x2575ed-0x0;var _0x3d11f2=_0xa62e[_0x2575ed];return _0x3d11f2;};'use strict';var _=require(_0xea62('0x0'));var util=require(_0xea62('0x1'));var moment=require(_0xea62('0x2'));var BPromise=require('bluebird');var rs=require(_0xea62('0x3'));var fs=require('fs');var Redis=require(_0xea62('0x4'));var db=require(_0xea62('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xea62('0x6'));var config=require(_0xea62('0x7'));var jayson=require(_0xea62('0x8'));var client=jayson[_0xea62('0x9')][_0xea62('0xa')]({'port':0x232a});config[_0xea62('0xb')]=_['defaults'](config[_0xea62('0xb')],{'host':_0xea62('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xea62('0xd'))[_0xea62('0xe')](socket);function respondWithRpcPromise(_0x15d17c,_0x464c24,_0x48b9a4){return new BPromise(function(_0x18292c,_0x54015b){return client[_0xea62('0xf')](_0x15d17c,_0x48b9a4)[_0xea62('0x10')](function(_0x561b7c){logger['info'](_0xea62('0x11'),_0x464c24,'request\x20sent');logger[_0xea62('0x12')](_0xea62('0x13'),_0x464c24,_0xea62('0x14'),JSON[_0xea62('0x15')](_0x561b7c));if(_0x561b7c[_0xea62('0x16')]){if(_0x561b7c[_0xea62('0x16')]['code']===0x1f4){logger['error'](_0xea62('0x11'),_0x464c24,_0x561b7c[_0xea62('0x16')][_0xea62('0x17')]);return _0x54015b(_0x561b7c['error'][_0xea62('0x17')]);}logger[_0xea62('0x16')](_0xea62('0x11'),_0x464c24,_0x561b7c[_0xea62('0x16')][_0xea62('0x17')]);return _0x18292c(_0x561b7c[_0xea62('0x16')][_0xea62('0x17')]);}else{logger[_0xea62('0x18')](_0xea62('0x11'),_0x464c24,'request\x20sent');_0x18292c(_0x561b7c[_0xea62('0x19')][_0xea62('0x17')]);}})[_0xea62('0x1a')](function(_0x5802a6){logger[_0xea62('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x464c24,_0x5802a6);_0x54015b(_0x5802a6);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 83eff4d..282fda3 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 _0x54dc=['remove','update','removeListener','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x3e5bc8,_0x457d89){var _0xfd84bc=function(_0x1a766c){while(--_0x1a766c){_0x3e5bc8['push'](_0x3e5bc8['shift']());}};_0xfd84bc(++_0x457d89);}(_0x54dc,0x16c));var _0xc54d=function(_0x42b707,_0x22e9c4){_0x42b707=_0x42b707-0x0;var _0x343135=_0x54dc[_0x42b707];return _0x343135;};'use strict';var ChatInternalMessageEvents=require(_0xc54d('0x0'));var events=[_0xc54d('0x1'),_0xc54d('0x2'),_0xc54d('0x3')];function createListener(_0x1eea9a,_0x31ae87){return function(_0x4e7712){_0x31ae87['emit'](_0x1eea9a,_0x4e7712);};}function removeListener(_0x182edd,_0x314d1e){return function(){ChatInternalMessageEvents[_0xc54d('0x4')](_0x182edd,_0x314d1e);};}exports['register']=function(_0x115c51){for(var _0x1ba142=0x0,_0x399a1c=events['length'];_0x1ba142<_0x399a1c;_0x1ba142++){var _0x36d332=events[_0x1ba142];var _0x4189a8=createListener(_0xc54d('0x5')+_0x36d332,_0x115c51);ChatInternalMessageEvents['on'](_0x36d332,_0x4189a8);}}; \ No newline at end of file +var _0xc923=['save','update','removeListener','chatInternalMessage:','./chatInternalMessage.events'];(function(_0x72895a,_0x433607){var _0x5226d5=function(_0x5b7d21){while(--_0x5b7d21){_0x72895a['push'](_0x72895a['shift']());}};_0x5226d5(++_0x433607);}(_0xc923,0x68));var _0x3c92=function(_0x2c43bb,_0x1138d7){_0x2c43bb=_0x2c43bb-0x0;var _0x2a0fd3=_0xc923[_0x2c43bb];return _0x2a0fd3;};'use strict';var ChatInternalMessageEvents=require(_0x3c92('0x0'));var events=[_0x3c92('0x1'),'remove',_0x3c92('0x2')];function createListener(_0x3e412f,_0x5a1d63){return function(_0x38815f){_0x5a1d63['emit'](_0x3e412f,_0x38815f);};}function removeListener(_0xb8733a,_0x82bc56){return function(){ChatInternalMessageEvents[_0x3c92('0x3')](_0xb8733a,_0x82bc56);};}exports['register']=function(_0x1558f7){for(var _0x31a0ac=0x0,_0x15f314=events['length'];_0x31a0ac<_0x15f314;_0x31a0ac++){var _0x5af013=events[_0x31a0ac];var _0x156e12=createListener(_0x3c92('0x4')+_0x5af013,_0x1558f7);ChatInternalMessageEvents['on'](_0x5af013,_0x156e12);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index e9f1754..aee3aa2 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 _0x88f2=['index','/describe','describe','/users','getUsers','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated'];(function(_0x231b2e,_0x2a33f9){var _0x3feb2a=function(_0x5aa472){while(--_0x5aa472){_0x231b2e['push'](_0x231b2e['shift']());}};_0x3feb2a(++_0x2a33f9);}(_0x88f2,0xd5));var _0x288f=function(_0x56ef39,_0x37ecee){_0x56ef39=_0x56ef39-0x0;var _0x2477e6=_0x88f2[_0x56ef39];return _0x2477e6;};'use strict';var multer=require(_0x288f('0x0'));var util=require(_0x288f('0x1'));var path=require(_0x288f('0x2'));var timeout=require(_0x288f('0x3'));var express=require(_0x288f('0x4'));var router=express[_0x288f('0x5')]();var fs_extra=require(_0x288f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x288f('0x7'));var config=require(_0x288f('0x8'));var controller=require(_0x288f('0x9'));router[_0x288f('0xa')]('/',auth[_0x288f('0xb')](),controller[_0x288f('0xc')]);router[_0x288f('0xa')](_0x288f('0xd'),auth[_0x288f('0xb')](),controller[_0x288f('0xe')]);router[_0x288f('0xa')](_0x288f('0xf'),auth[_0x288f('0xb')](),controller[_0x288f('0x10')]);router[_0x288f('0xa')]('/:id',auth[_0x288f('0xb')](),controller['show']);router[_0x288f('0x11')]('/',auth[_0x288f('0xb')](),controller[_0x288f('0x12')]);router[_0x288f('0x13')](_0x288f('0x14'),controller[_0x288f('0x15')]);router[_0x288f('0x16')](_0x288f('0x14'),auth[_0x288f('0xb')](),controller[_0x288f('0x17')]);module[_0x288f('0x18')]=router; \ No newline at end of file +var _0xbc09=['describe','/users','getUsers','/:id','show','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','isAuthenticated','get'];(function(_0x269293,_0x5d02c9){var _0x28a9cf=function(_0x6c0494){while(--_0x6c0494){_0x269293['push'](_0x269293['shift']());}};_0x28a9cf(++_0x5d02c9);}(_0xbc09,0xe7));var _0x9bc0=function(_0x87793c,_0x45f454){_0x87793c=_0x87793c-0x0;var _0x4637b3=_0xbc09[_0x87793c];return _0x4637b3;};'use strict';var multer=require('multer');var util=require(_0x9bc0('0x0'));var path=require(_0x9bc0('0x1'));var timeout=require(_0x9bc0('0x2'));var express=require(_0x9bc0('0x3'));var router=express[_0x9bc0('0x4')]();var fs_extra=require(_0x9bc0('0x5'));var auth=require(_0x9bc0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9bc0('0x7'));var controller=require(_0x9bc0('0x8'));router['get']('/',auth[_0x9bc0('0x9')](),controller['index']);router[_0x9bc0('0xa')]('/describe',auth[_0x9bc0('0x9')](),controller[_0x9bc0('0xb')]);router['get'](_0x9bc0('0xc'),auth['isAuthenticated'](),controller[_0x9bc0('0xd')]);router[_0x9bc0('0xa')](_0x9bc0('0xe'),auth[_0x9bc0('0x9')](),controller[_0x9bc0('0xf')]);router[_0x9bc0('0x10')]('/',auth[_0x9bc0('0x9')](),controller['create']);router[_0x9bc0('0x11')](_0x9bc0('0xe'),controller[_0x9bc0('0x12')]);router[_0x9bc0('0x13')]('/:id',auth[_0x9bc0('0x9')](),controller[_0x9bc0('0x14')]);module[_0x9bc0('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 9481f52..d1e70c6 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 _0x3f72=['sequelize','exports','TEXT','BOOLEAN','ENUM','out','DATE'];(function(_0xc34616,_0x487250){var _0x1221ba=function(_0x531a90){while(--_0x531a90){_0xc34616['push'](_0xc34616['shift']());}};_0x1221ba(++_0x487250);}(_0x3f72,0xaf));var _0x23f7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3f72[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x23f7('0x0'));module[_0x23f7('0x1')]={'body':{'type':Sequelize[_0x23f7('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x23f7('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x23f7('0x4')]('in',_0x23f7('0x5')),'defaultValue':_0x23f7('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x23f7('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x23f7('0x2')]}}; \ No newline at end of file +var _0x082b=['BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT','medium'];(function(_0x3fa285,_0x49e62d){var _0x29bf11=function(_0x224a71){while(--_0x224a71){_0x3fa285['push'](_0x3fa285['shift']());}};_0x29bf11(++_0x49e62d);}(_0x082b,0x1ec));var _0xb082=function(_0x137e81,_0x3541c4){_0x137e81=_0x137e81-0x0;var _0x5f14e1=_0x082b[_0x137e81];return _0x5f14e1;};'use strict';var Sequelize=require(_0xb082('0x0'));module[_0xb082('0x1')]={'body':{'type':Sequelize[_0xb082('0x2')](_0xb082('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xb082('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb082('0x5')]('in','out'),'defaultValue':_0xb082('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xb082('0x7')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xb082('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 06b6842..b5c2335 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 _0x1e42=['QueryTypes','contact','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./chatMessage.socket','register','http','client','request','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','sendStatus','json','offset','undefined','limit','count','status','set','apply','reject','update','destroy','name','index','map','ChatMessage','fieldName','type','keys','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','then','includeAll','include','findAll','rows','show','params','rawAttributes','body','find','describe','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','chat-interactions','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','rejectMessage'];(function(_0x768458,_0x3d0933){var _0x31385c=function(_0xf11dad){while(--_0xf11dad){_0x768458['push'](_0x768458['shift']());}};_0x31385c(++_0x3d0933);}(_0x1e42,0x10c));var _0x21e4=function(_0xcceb55,_0x7bcceb){_0xcceb55=_0xcceb55-0x0;var _0x45e9e6=_0x1e42[_0xcceb55];return _0x45e9e6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x21e4('0x0'));var zipdir=require(_0x21e4('0x1'));var jsonpatch=require(_0x21e4('0x2'));var rp=require(_0x21e4('0x3'));var moment=require(_0x21e4('0x4'));var BPromise=require(_0x21e4('0x5'));var Mustache=require(_0x21e4('0x6'));var util=require(_0x21e4('0x7'));var path=require(_0x21e4('0x8'));var sox=require(_0x21e4('0x9'));var csv=require('to-csv');var ejs=require(_0x21e4('0xa'));var fs=require('fs');var fs_extra=require(_0x21e4('0xb'));var _=require(_0x21e4('0xc'));var squel=require('squel');var crypto=require(_0x21e4('0xd'));var jsforce=require(_0x21e4('0xe'));var deskjs=require(_0x21e4('0xf'));var toCsv=require(_0x21e4('0x10'));var querystring=require(_0x21e4('0x11'));var Papa=require(_0x21e4('0x12'));var Redis=require(_0x21e4('0x13'));var authService=require(_0x21e4('0x14'));var qs=require(_0x21e4('0x15'));var as=require(_0x21e4('0x16'));var hardwareService=require(_0x21e4('0x17'));var logger=require(_0x21e4('0x18'))('api');var utils=require(_0x21e4('0x19'));var config=require(_0x21e4('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x21e4('0x1b'))['db'];config[_0x21e4('0x1c')]=_['defaults'](config['redis'],{'host':_0x21e4('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x21e4('0x1c')]));require(_0x21e4('0x1e'))[_0x21e4('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x21e4('0x20')]({'port':0x232c});var client9002=jayson[_0x21e4('0x21')][_0x21e4('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x4a2827,_0x28ca38,_0x22af7f,_0x352955){return new BPromise(function(_0x1c1ac5,_0x16d505){var _0x5db604=_0x352955||client;return _0x5db604[_0x21e4('0x22')](_0x4a2827,_0x22af7f)['then'](function(_0x576a63){logger[_0x21e4('0x23')](_0x21e4('0x24'),_0x28ca38,'request\x20sent');logger[_0x21e4('0x25')](_0x21e4('0x26'),_0x28ca38,_0x21e4('0x27'),JSON['stringify'](_0x576a63));if(_0x576a63[_0x21e4('0x28')]){if(_0x576a63['error']['code']===0x1f4){logger[_0x21e4('0x28')](_0x21e4('0x24'),_0x28ca38,_0x576a63[_0x21e4('0x28')][_0x21e4('0x29')]);return _0x16d505(_0x576a63[_0x21e4('0x28')][_0x21e4('0x29')]);}logger['error'](_0x21e4('0x24'),_0x28ca38,_0x576a63['error'][_0x21e4('0x29')]);return _0x1c1ac5(_0x576a63[_0x21e4('0x28')][_0x21e4('0x29')]);}else{logger[_0x21e4('0x23')](_0x21e4('0x24'),_0x28ca38,_0x21e4('0x27'));_0x1c1ac5(_0x576a63[_0x21e4('0x2a')]['message']);}})[_0x21e4('0x2b')](function(_0x589c5a){logger[_0x21e4('0x28')](_0x21e4('0x24'),_0x28ca38,_0x589c5a);_0x16d505(_0x589c5a);});});}function respondWithStatusCode(_0x5f1a30,_0x322825){_0x322825=_0x322825||0xcc;return function(_0x5c7519){if(_0x5c7519){return _0x5f1a30[_0x21e4('0x2c')](_0x322825);}return _0x5f1a30['status'](_0x322825)['end']();};}function respondWithResult(_0xf0a96d,_0x193a0a){_0x193a0a=_0x193a0a||0xc8;return function(_0xd44ffe){if(_0xd44ffe){return _0xf0a96d['status'](_0x193a0a)[_0x21e4('0x2d')](_0xd44ffe);}};}function respondWithFilteredResult(_0x14ec1b,_0x168213){return function(_0x5183e3){if(_0x5183e3){var _0x5513af=typeof _0x168213[_0x21e4('0x2e')]===_0x21e4('0x2f')&&typeof _0x168213[_0x21e4('0x30')]===_0x21e4('0x2f');var _0x395caf=_0x5183e3[_0x21e4('0x31')];var _0x524468=_0x5513af?0x0:_0x168213[_0x21e4('0x2e')];var _0x37ce03=_0x5513af?_0x5183e3['count']:_0x168213['offset']+_0x168213['limit'];var _0x48d8c7;if(_0x37ce03>=_0x395caf){_0x37ce03=_0x395caf;_0x48d8c7=0xc8;}else{_0x48d8c7=0xce;}_0x14ec1b[_0x21e4('0x32')](_0x48d8c7);return _0x14ec1b[_0x21e4('0x33')]('Content-Range',_0x524468+'-'+_0x37ce03+'/'+_0x395caf)[_0x21e4('0x2d')](_0x5183e3);}return null;};}function patchUpdates(_0x9a6968){return function(_0x4d0a20){try{jsonpatch[_0x21e4('0x34')](_0x4d0a20,_0x9a6968,!![]);}catch(_0x19d8a7){return BPromise[_0x21e4('0x35')](_0x19d8a7);}return _0x4d0a20['save']();};}function saveUpdates(_0x1d6c05,_0x443958){return function(_0x171c72){if(_0x171c72){return _0x171c72[_0x21e4('0x36')](_0x1d6c05)['then'](function(_0x2d44b0){return _0x2d44b0;});}return null;};}function removeEntity(_0x4eff4e,_0x35817d){return function(_0x6bd0a){if(_0x6bd0a){return _0x6bd0a[_0x21e4('0x37')]()['then'](function(){_0x4eff4e[_0x21e4('0x32')](0xcc)['end']();});}};}function handleEntityNotFound(_0x407b6e,_0x4f23a8){return function(_0x37c70b){if(!_0x37c70b){_0x407b6e['sendStatus'](0x194);}return _0x37c70b;};}function handleError(_0x45183b,_0x332ff1){_0x332ff1=_0x332ff1||0x1f4;return function(_0x2e7064){logger['error'](_0x2e7064['stack']);if(_0x2e7064['name']){delete _0x2e7064[_0x21e4('0x38')];}_0x45183b[_0x21e4('0x32')](_0x332ff1)['send'](_0x2e7064);};}exports[_0x21e4('0x39')]=function(_0x478ae4,_0x260f51){var _0x5041db={},_0x46f6d1={},_0x136745={'count':0x0,'rows':[]};var _0x1237b7=_[_0x21e4('0x3a')](db[_0x21e4('0x3b')]['rawAttributes'],function(_0x450d61){return{'name':_0x450d61[_0x21e4('0x3c')],'type':_0x450d61[_0x21e4('0x3d')]['key']};});_0x46f6d1['model']=_[_0x21e4('0x3a')](_0x1237b7,_0x21e4('0x38'));_0x46f6d1['query']=_[_0x21e4('0x3e')](_0x478ae4[_0x21e4('0x3f')]);_0x46f6d1['filters']=_[_0x21e4('0x40')](_0x46f6d1['model'],_0x46f6d1[_0x21e4('0x3f')]);_0x5041db[_0x21e4('0x41')]=_[_0x21e4('0x40')](_0x46f6d1[_0x21e4('0x42')],qs['fields'](_0x478ae4[_0x21e4('0x3f')][_0x21e4('0x43')]));_0x5041db[_0x21e4('0x41')]=_0x5041db[_0x21e4('0x41')][_0x21e4('0x44')]?_0x5041db['attributes']:_0x46f6d1['model'];if(!_0x478ae4[_0x21e4('0x3f')][_0x21e4('0x45')](_0x21e4('0x46'))){_0x5041db[_0x21e4('0x30')]=qs['limit'](_0x478ae4['query'][_0x21e4('0x30')]);_0x5041db[_0x21e4('0x2e')]=qs['offset'](_0x478ae4[_0x21e4('0x3f')][_0x21e4('0x2e')]);}_0x5041db[_0x21e4('0x47')]=qs[_0x21e4('0x48')](_0x478ae4[_0x21e4('0x3f')][_0x21e4('0x48')]);_0x5041db[_0x21e4('0x49')]=qs[_0x21e4('0x4a')](_[_0x21e4('0x4b')](_0x478ae4[_0x21e4('0x3f')],_0x46f6d1[_0x21e4('0x4a')]),_0x1237b7);if(_0x478ae4[_0x21e4('0x3f')]['filter']){_0x5041db[_0x21e4('0x49')]=_[_0x21e4('0x4c')](_0x5041db[_0x21e4('0x49')],{'$or':_[_0x21e4('0x3a')](_0x1237b7,function(_0x28ad43){if(_0x28ad43[_0x21e4('0x3d')]!==_0x21e4('0x4d')){var _0x2ff756={};_0x2ff756[_0x28ad43[_0x21e4('0x38')]]={'$like':'%'+_0x478ae4[_0x21e4('0x3f')][_0x21e4('0x4e')]+'%'};return _0x2ff756;}})});}_0x5041db=_[_0x21e4('0x4c')]({},_0x5041db,_0x478ae4['options']);var _0x1b75d7={'where':_0x5041db[_0x21e4('0x49')]};return db[_0x21e4('0x3b')][_0x21e4('0x31')](_0x1b75d7)[_0x21e4('0x4f')](function(_0x5a6633){_0x136745[_0x21e4('0x31')]=_0x5a6633;if(_0x478ae4['query'][_0x21e4('0x50')]){_0x5041db[_0x21e4('0x51')]=[{'all':!![]}];}return db[_0x21e4('0x3b')][_0x21e4('0x52')](_0x5041db);})[_0x21e4('0x4f')](function(_0x27f1ca){_0x136745[_0x21e4('0x53')]=_0x27f1ca;return _0x136745;})[_0x21e4('0x4f')](respondWithFilteredResult(_0x260f51,_0x5041db))['catch'](handleError(_0x260f51,null));};exports[_0x21e4('0x54')]=function(_0x16659e,_0x1d69b1){var _0x541e51={'raw':!![],'where':{'id':_0x16659e[_0x21e4('0x55')]['id']}},_0x5b37ed={};_0x5b37ed['model']=_['keys'](db['ChatMessage'][_0x21e4('0x56')]);_0x5b37ed[_0x21e4('0x3f')]=_[_0x21e4('0x3e')](_0x16659e['query']);_0x5b37ed['filters']=_[_0x21e4('0x40')](_0x5b37ed[_0x21e4('0x42')],_0x5b37ed[_0x21e4('0x3f')]);_0x541e51[_0x21e4('0x41')]=_['intersection'](_0x5b37ed[_0x21e4('0x42')],qs['fields'](_0x16659e[_0x21e4('0x3f')][_0x21e4('0x43')]));_0x541e51[_0x21e4('0x41')]=_0x541e51[_0x21e4('0x41')][_0x21e4('0x44')]?_0x541e51['attributes']:_0x5b37ed['model'];if(_0x16659e['query']['includeAll']){_0x541e51['include']=[{'all':!![]}];}_0x541e51=_[_0x21e4('0x4c')]({},_0x541e51,_0x16659e['options']);return db['ChatMessage']['find'](_0x541e51)[_0x21e4('0x4f')](handleEntityNotFound(_0x1d69b1,null))['then'](respondWithResult(_0x1d69b1,null))[_0x21e4('0x2b')](handleError(_0x1d69b1,null));};exports['create']=function(_0x41c2e1,_0x7b114d){return db[_0x21e4('0x3b')]['create'](_0x41c2e1['body'],{})[_0x21e4('0x4f')](respondWithResult(_0x7b114d,0xc9))[_0x21e4('0x2b')](handleError(_0x7b114d,null));};exports[_0x21e4('0x36')]=function(_0x5740f4,_0x433b19){if(_0x5740f4[_0x21e4('0x57')]['id']){delete _0x5740f4[_0x21e4('0x57')]['id'];}return db[_0x21e4('0x3b')]['find']({'where':{'id':_0x5740f4[_0x21e4('0x55')]['id']}})[_0x21e4('0x4f')](handleEntityNotFound(_0x433b19,null))[_0x21e4('0x4f')](saveUpdates(_0x5740f4['body'],null))['then'](respondWithResult(_0x433b19,null))[_0x21e4('0x2b')](handleError(_0x433b19,null));};exports[_0x21e4('0x37')]=function(_0x2b6960,_0x49f092){return db[_0x21e4('0x3b')][_0x21e4('0x58')]({'where':{'id':_0x2b6960[_0x21e4('0x55')]['id']}})[_0x21e4('0x4f')](handleEntityNotFound(_0x49f092,null))[_0x21e4('0x4f')](removeEntity(_0x49f092,null))[_0x21e4('0x2b')](handleError(_0x49f092,null));};exports[_0x21e4('0x59')]=function(_0x2a22e4,_0x341ae8){return db['ChatMessage'][_0x21e4('0x59')]()[_0x21e4('0x4f')](respondWithResult(_0x341ae8,null))['catch'](handleError(_0x341ae8,null));};var interaction_log=require(_0x21e4('0x18'))('chat-interactions');exports[_0x21e4('0x5a')]=function(_0x33f9f1,_0x192f69,_0x4ee2a1){var _0xc58cda={'agent':{},'channel':_0x21e4('0x5b')};if(_0x33f9f1[_0x21e4('0x57')]['id']){delete _0x33f9f1[_0x21e4('0x57')]['id'];}_0x33f9f1[_0x21e4('0x57')][_0x21e4('0x5c')]=!![];_0x33f9f1[_0x21e4('0x57')][_0x21e4('0x5d')]=moment()[_0x21e4('0x5e')](_0x21e4('0x5f'));_0x33f9f1['body']['UserId']=_0x33f9f1[_0x21e4('0x57')][_0x21e4('0x60')]||_0x33f9f1[_0x21e4('0x61')]['id'];_0xc58cda[_0x21e4('0x62')]['id']=_0x33f9f1[_0x21e4('0x57')][_0x21e4('0x60')];return db[_0x21e4('0x3b')][_0x21e4('0x58')]({'where':{'id':_0x33f9f1[_0x21e4('0x55')]['id'],'UserId':null}})[_0x21e4('0x4f')](handleEntityNotFound(_0x192f69,null))[_0x21e4('0x4f')](saveUpdates(_0x33f9f1[_0x21e4('0x57')],null))[_0x21e4('0x4f')](function(_0x1f6594){if(_0x1f6594){_0xc58cda[_0x21e4('0x29')]=_0x1f6594[_0x21e4('0x63')]({'plain':!![]});return db[_0x21e4('0x64')]['find']({'where':{'id':_0x1f6594[_0x21e4('0x65')]}});}return null;})[_0x21e4('0x4f')](handleEntityNotFound(_0x192f69,null))['then'](function(_0x5a71a0){if(_0x5a71a0){return _0x5a71a0[_0x21e4('0x36')]({'UserId':_0x33f9f1[_0x21e4('0x57')][_0x21e4('0x60')],'read1stAt':_[_0x21e4('0x66')](_0x5a71a0[_0x21e4('0x67')])?moment()[_0x21e4('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x39c536){if(_0x39c536){_0xc58cda['interaction']=_0x39c536[_0x21e4('0x63')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x33f9f1[_0x21e4('0x61')]['id'],_0x33f9f1[_0x21e4('0x61')][_0x21e4('0x38')],_0x33f9f1[_0x21e4('0x61')][_0x21e4('0x68')],_0xc58cda[_0x21e4('0x69')]['id'],_0x33f9f1['body']?JSON['stringify'](_0x33f9f1[_0x21e4('0x57')]):_0x21e4('0x6a'));return respondWithRpcPromise(_0x21e4('0x6b'),_0x21e4('0x6c'),_0xc58cda);}return null;})[_0x21e4('0x4f')](function(_0x36e1a4){var _0x5576d1=_0x21e4('0x6d')+_0x36e1a4[_0x21e4('0x29')][_0x21e4('0x6e')];return db[_0x21e4('0x6f')][_0x21e4('0x3f')](_0x5576d1,{'type':db[_0x21e4('0x70')]['QueryTypes'][_0x21e4('0x71')],'raw':!![]})[_0x21e4('0x4f')](function(_0x1ffe14){return _0x1ffe14;});})[_0x21e4('0x4f')](function(_0x2caaeb){if(_0x2caaeb){_0xc58cda[_0x21e4('0x29')]['contact']=_0x2caaeb[0x0];if(!_0x33f9f1['body'][_0x21e4('0x60')])return;return db[_0x21e4('0x72')][_0x21e4('0x58')]({'where':{'id':_0x33f9f1['body']['UserId'],'role':_0x21e4('0x62')},'attributes':['id',_0x21e4('0x38'),_0x21e4('0x73'),_0x21e4('0x74'),_0x21e4('0x75')],'raw':!![]});}return null;})['then'](function(_0xa1aee3){if(!_0xa1aee3)return null;_0xc58cda[_0x21e4('0x29')]['agent']=_0xa1aee3;return _0xc58cda;})['then'](function(_0x53a7aa){if(_0x53a7aa){if(_0x33f9f1[_0x21e4('0x57')][_0x21e4('0x76')]){_0xc58cda[_0x21e4('0x29')]['interface']=util['format'](_0x21e4('0x77'),_0x33f9f1[_0x21e4('0x61')][_0x21e4('0x38')]);_0xc58cda[_0x21e4('0x29')][_0x21e4('0x78')]=_0xc58cda[_0x21e4('0x78')];_0xc58cda['message'][_0x21e4('0x79')]=_0xc58cda[_0x21e4('0x78')];_0xc58cda[_0x21e4('0x29')][_0x21e4('0x7a')]=_0x21e4('0x5a');return respondWithRpcPromise('EventManager',_0x21e4('0x7b'),{'event':_0x21e4('0x7c'),'message':_['merge'](_0xc58cda['message'],JSON[_0x21e4('0x7d')](_0xc58cda[_0x21e4('0x69')][_0x21e4('0x7e')]))},client9002)['then'](function(){return _0xc58cda;});}return _0xc58cda;}return null;})[_0x21e4('0x4f')](respondWithResult(_0x192f69,null))[_0x21e4('0x2b')](handleError(_0x192f69,null));};var interaction_log=require(_0x21e4('0x18'))(_0x21e4('0x7f'));exports['reject']=function(_0x4c33eb,_0x41e572,_0x323c5b){var _0x52e2ad={'agent':{},'channel':_0x21e4('0x5b')};if(_0x4c33eb['body']['id']){delete _0x4c33eb['body']['id'];}_0x4c33eb['body'][_0x21e4('0x60')]=_0x4c33eb[_0x21e4('0x57')][_0x21e4('0x60')]||_0x4c33eb[_0x21e4('0x61')]['id'];_0x52e2ad[_0x21e4('0x62')]['id']=_0x4c33eb['body'][_0x21e4('0x60')];return db[_0x21e4('0x3b')][_0x21e4('0x58')]({'where':{'id':_0x4c33eb[_0x21e4('0x55')]['id'],'UserId':null}})[_0x21e4('0x4f')](handleEntityNotFound(_0x41e572,null))['then'](function(_0x12fad4){if(_0x12fad4){_0x52e2ad[_0x21e4('0x29')]=_0x12fad4[_0x21e4('0x63')]({'plain':!![]});return db['ChatInteraction'][_0x21e4('0x58')]({'where':{'id':_0x12fad4[_0x21e4('0x65')]}});}return null;})[_0x21e4('0x4f')](handleEntityNotFound(_0x41e572,null))[_0x21e4('0x4f')](function(_0x1efd43){if(_0x1efd43){_0x52e2ad[_0x21e4('0x69')]=_0x1efd43[_0x21e4('0x63')]({'plain':!![]});interaction_log[_0x21e4('0x23')](_0x21e4('0x80'),_0x4c33eb[_0x21e4('0x61')]['id'],_0x4c33eb[_0x21e4('0x61')][_0x21e4('0x38')],_0x4c33eb[_0x21e4('0x61')][_0x21e4('0x68')],_0x52e2ad[_0x21e4('0x69')]['id'],_0x4c33eb[_0x21e4('0x57')]?JSON[_0x21e4('0x81')](_0x4c33eb[_0x21e4('0x57')]):_0x21e4('0x6a'));return respondWithRpcPromise('RejectMessage',_0x21e4('0x82'),_0x52e2ad);}return null;})[_0x21e4('0x4f')](function(_0x12fe3c){var _0x5bb018=_0x21e4('0x6d')+_0x12fe3c[_0x21e4('0x29')]['ContactId'];return db['sequelize'][_0x21e4('0x3f')](_0x5bb018,{'type':db['Sequelize'][_0x21e4('0x83')][_0x21e4('0x71')],'raw':!![]})[_0x21e4('0x4f')](function(_0x1d6c92){return _0x1d6c92;});})[_0x21e4('0x4f')](function(_0x2ed983){if(_0x2ed983){_0x52e2ad[_0x21e4('0x29')][_0x21e4('0x84')]=_0x2ed983[0x0];if(!_0x4c33eb[_0x21e4('0x57')][_0x21e4('0x60')])return;return db['User'][_0x21e4('0x58')]({'where':{'id':_0x4c33eb['body'][_0x21e4('0x60')],'role':'agent'},'attributes':['id','name',_0x21e4('0x73'),_0x21e4('0x74'),_0x21e4('0x75')],'raw':!![]});}return null;})[_0x21e4('0x4f')](function(_0x43069b){if(!_0x43069b)return null;_0x52e2ad['message'][_0x21e4('0x62')]=_0x43069b;return _0x52e2ad;})[_0x21e4('0x4f')](function(_0x1faea7){if(_0x1faea7){_0x1faea7['message']['interface']=util[_0x21e4('0x5e')](_0x21e4('0x77'),_0x4c33eb[_0x21e4('0x61')]['name']);_0x1faea7[_0x21e4('0x29')]['channel']=_0x52e2ad[_0x21e4('0x78')];_0x1faea7[_0x21e4('0x29')][_0x21e4('0x79')]=_0x52e2ad[_0x21e4('0x78')];_0x1faea7['message']['event']=_0x21e4('0x35');respondWithRpcPromise(_0x21e4('0x7b'),'EventManager',{'event':'rejectmessage','message':_['merge'](_0x52e2ad[_0x21e4('0x29')],JSON[_0x21e4('0x7d')](_0x52e2ad['interaction']['formData']))},client9002);return _0x52e2ad;}return null;})[_0x21e4('0x4f')](respondWithResult(_0x41e572,null))[_0x21e4('0x2b')](handleError(_0x41e572,null));}; \ No newline at end of file +var _0xc7e3=['end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','stack','name','send','map','ChatMessage','rawAttributes','fieldName','type','query','keys','intersection','attributes','model','nolimit','order','sort','where','pick','filters','filter','merge','options','includeAll','findAll','rows','show','length','include','find','create','body','describe','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','SELECT','contact','User','fullname','email','internal','manual','interface','channel','event','acceptmessage','parse','formData','chat-interactions','chat','params','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','ContactId','sequelize','QueryTypes','SIP/%s','motionChannel','reject','EventManager','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status'];(function(_0x204665,_0x4b7744){var _0x16fa00=function(_0x26f6b8){while(--_0x26f6b8){_0x204665['push'](_0x204665['shift']());}};_0x16fa00(++_0x4b7744);}(_0xc7e3,0xe3));var _0x3c7e=function(_0x3ec432,_0x2e773e){_0x3ec432=_0x3ec432-0x0;var _0x520a5a=_0xc7e3[_0x3ec432];return _0x520a5a;};'use strict';var emlformat=require(_0x3c7e('0x0'));var rimraf=require(_0x3c7e('0x1'));var zipdir=require(_0x3c7e('0x2'));var jsonpatch=require(_0x3c7e('0x3'));var rp=require(_0x3c7e('0x4'));var moment=require(_0x3c7e('0x5'));var BPromise=require(_0x3c7e('0x6'));var Mustache=require(_0x3c7e('0x7'));var util=require(_0x3c7e('0x8'));var path=require(_0x3c7e('0x9'));var sox=require('sox');var csv=require(_0x3c7e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3c7e('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3c7e('0xc'));var jsforce=require(_0x3c7e('0xd'));var deskjs=require(_0x3c7e('0xe'));var toCsv=require(_0x3c7e('0xa'));var querystring=require(_0x3c7e('0xf'));var Papa=require(_0x3c7e('0x10'));var Redis=require('ioredis');var authService=require(_0x3c7e('0x11'));var qs=require(_0x3c7e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c7e('0x13'));var logger=require(_0x3c7e('0x14'))(_0x3c7e('0x15'));var utils=require('../../config/utils');var config=require(_0x3c7e('0x16'));var licenseUtil=require(_0x3c7e('0x17'));var db=require(_0x3c7e('0x18'))['db'];config[_0x3c7e('0x19')]=_[_0x3c7e('0x1a')](config['redis'],{'host':_0x3c7e('0x1b'),'port':0x18eb});var socket=require(_0x3c7e('0x1c'))(new Redis(config[_0x3c7e('0x19')]));require('./chatMessage.socket')['register'](socket);var jayson=require(_0x3c7e('0x1d'));var client=jayson[_0x3c7e('0x1e')][_0x3c7e('0x1f')]({'port':0x232c});var client9002=jayson[_0x3c7e('0x1e')][_0x3c7e('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2dfaa9,_0x5d8b53,_0x50c352,_0x278db2){return new BPromise(function(_0x8f0f83,_0x4dc991){var _0x5b0b62=_0x278db2||client;return _0x5b0b62[_0x3c7e('0x20')](_0x2dfaa9,_0x50c352)[_0x3c7e('0x21')](function(_0x3d7fd4){logger[_0x3c7e('0x22')](_0x3c7e('0x23'),_0x5d8b53,_0x3c7e('0x24'));logger[_0x3c7e('0x25')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x5d8b53,_0x3c7e('0x24'),JSON[_0x3c7e('0x26')](_0x3d7fd4));if(_0x3d7fd4[_0x3c7e('0x27')]){if(_0x3d7fd4[_0x3c7e('0x27')][_0x3c7e('0x28')]===0x1f4){logger[_0x3c7e('0x27')](_0x3c7e('0x23'),_0x5d8b53,_0x3d7fd4[_0x3c7e('0x27')]['message']);return _0x4dc991(_0x3d7fd4[_0x3c7e('0x27')][_0x3c7e('0x29')]);}logger[_0x3c7e('0x27')](_0x3c7e('0x23'),_0x5d8b53,_0x3d7fd4['error'][_0x3c7e('0x29')]);return _0x8f0f83(_0x3d7fd4['error'][_0x3c7e('0x29')]);}else{logger[_0x3c7e('0x22')](_0x3c7e('0x23'),_0x5d8b53,_0x3c7e('0x24'));_0x8f0f83(_0x3d7fd4['result'][_0x3c7e('0x29')]);}})[_0x3c7e('0x2a')](function(_0x2ef267){logger['error'](_0x3c7e('0x23'),_0x5d8b53,_0x2ef267);_0x4dc991(_0x2ef267);});});}function respondWithStatusCode(_0x1345c4,_0x2a9598){_0x2a9598=_0x2a9598||0xcc;return function(_0x28069b){if(_0x28069b){return _0x1345c4[_0x3c7e('0x2b')](_0x2a9598);}return _0x1345c4[_0x3c7e('0x2c')](_0x2a9598)[_0x3c7e('0x2d')]();};}function respondWithResult(_0xa78ede,_0x7455a5){_0x7455a5=_0x7455a5||0xc8;return function(_0x3a1463){if(_0x3a1463){return _0xa78ede[_0x3c7e('0x2c')](_0x7455a5)[_0x3c7e('0x2e')](_0x3a1463);}};}function respondWithFilteredResult(_0x44324c,_0x2ec0ad){return function(_0x167726){if(_0x167726){var _0x7abe0=typeof _0x2ec0ad[_0x3c7e('0x2f')]==='undefined'&&typeof _0x2ec0ad[_0x3c7e('0x30')]===_0x3c7e('0x31');var _0x1da9d2=_0x167726[_0x3c7e('0x32')];var _0x144b00=_0x7abe0?0x0:_0x2ec0ad['offset'];var _0x1a6884=_0x7abe0?_0x167726[_0x3c7e('0x32')]:_0x2ec0ad[_0x3c7e('0x2f')]+_0x2ec0ad[_0x3c7e('0x30')];var _0x509a7a;if(_0x1a6884>=_0x1da9d2){_0x1a6884=_0x1da9d2;_0x509a7a=0xc8;}else{_0x509a7a=0xce;}_0x44324c[_0x3c7e('0x2c')](_0x509a7a);return _0x44324c[_0x3c7e('0x33')](_0x3c7e('0x34'),_0x144b00+'-'+_0x1a6884+'/'+_0x1da9d2)[_0x3c7e('0x2e')](_0x167726);}return null;};}function patchUpdates(_0x16905c){return function(_0x1aae0c){try{jsonpatch[_0x3c7e('0x35')](_0x1aae0c,_0x16905c,!![]);}catch(_0x5e1b0c){return BPromise['reject'](_0x5e1b0c);}return _0x1aae0c[_0x3c7e('0x36')]();};}function saveUpdates(_0xf91945,_0x29445f){return function(_0x16007c){if(_0x16007c){return _0x16007c[_0x3c7e('0x37')](_0xf91945)[_0x3c7e('0x21')](function(_0x3a6ddd){return _0x3a6ddd;});}return null;};}function removeEntity(_0x41ec4f,_0x4aa768){return function(_0x1ea373){if(_0x1ea373){return _0x1ea373[_0x3c7e('0x38')]()[_0x3c7e('0x21')](function(){_0x41ec4f['status'](0xcc)[_0x3c7e('0x2d')]();});}};}function handleEntityNotFound(_0x1dce58,_0x414b1a){return function(_0x5ee8f8){if(!_0x5ee8f8){_0x1dce58[_0x3c7e('0x2b')](0x194);}return _0x5ee8f8;};}function handleError(_0x2e4145,_0x58a6f3){_0x58a6f3=_0x58a6f3||0x1f4;return function(_0x35d5f8){logger[_0x3c7e('0x27')](_0x35d5f8[_0x3c7e('0x39')]);if(_0x35d5f8['name']){delete _0x35d5f8[_0x3c7e('0x3a')];}_0x2e4145['status'](_0x58a6f3)[_0x3c7e('0x3b')](_0x35d5f8);};}exports['index']=function(_0x421d9f,_0x77d83a){var _0x3aa1b1={},_0x5f4e2e={},_0x123462={'count':0x0,'rows':[]};var _0x23bdfa=_[_0x3c7e('0x3c')](db[_0x3c7e('0x3d')][_0x3c7e('0x3e')],function(_0x442e8d){return{'name':_0x442e8d[_0x3c7e('0x3f')],'type':_0x442e8d[_0x3c7e('0x40')]['key']};});_0x5f4e2e['model']=_[_0x3c7e('0x3c')](_0x23bdfa,_0x3c7e('0x3a'));_0x5f4e2e[_0x3c7e('0x41')]=_[_0x3c7e('0x42')](_0x421d9f['query']);_0x5f4e2e['filters']=_[_0x3c7e('0x43')](_0x5f4e2e['model'],_0x5f4e2e[_0x3c7e('0x41')]);_0x3aa1b1[_0x3c7e('0x44')]=_['intersection'](_0x5f4e2e[_0x3c7e('0x45')],qs['fields'](_0x421d9f[_0x3c7e('0x41')]['fields']));_0x3aa1b1[_0x3c7e('0x44')]=_0x3aa1b1['attributes']['length']?_0x3aa1b1[_0x3c7e('0x44')]:_0x5f4e2e[_0x3c7e('0x45')];if(!_0x421d9f[_0x3c7e('0x41')]['hasOwnProperty'](_0x3c7e('0x46'))){_0x3aa1b1[_0x3c7e('0x30')]=qs['limit'](_0x421d9f[_0x3c7e('0x41')]['limit']);_0x3aa1b1['offset']=qs[_0x3c7e('0x2f')](_0x421d9f['query']['offset']);}_0x3aa1b1[_0x3c7e('0x47')]=qs[_0x3c7e('0x48')](_0x421d9f[_0x3c7e('0x41')][_0x3c7e('0x48')]);_0x3aa1b1[_0x3c7e('0x49')]=qs['filters'](_[_0x3c7e('0x4a')](_0x421d9f['query'],_0x5f4e2e[_0x3c7e('0x4b')]),_0x23bdfa);if(_0x421d9f['query'][_0x3c7e('0x4c')]){_0x3aa1b1[_0x3c7e('0x49')]=_[_0x3c7e('0x4d')](_0x3aa1b1[_0x3c7e('0x49')],{'$or':_[_0x3c7e('0x3c')](_0x23bdfa,function(_0x22bf83){if(_0x22bf83[_0x3c7e('0x40')]!=='VIRTUAL'){var _0x49f286={};_0x49f286[_0x22bf83[_0x3c7e('0x3a')]]={'$like':'%'+_0x421d9f[_0x3c7e('0x41')][_0x3c7e('0x4c')]+'%'};return _0x49f286;}})});}_0x3aa1b1=_[_0x3c7e('0x4d')]({},_0x3aa1b1,_0x421d9f[_0x3c7e('0x4e')]);var _0x5f8519={'where':_0x3aa1b1[_0x3c7e('0x49')]};return db[_0x3c7e('0x3d')][_0x3c7e('0x32')](_0x5f8519)[_0x3c7e('0x21')](function(_0x20486d){_0x123462[_0x3c7e('0x32')]=_0x20486d;if(_0x421d9f['query'][_0x3c7e('0x4f')]){_0x3aa1b1['include']=[{'all':!![]}];}return db[_0x3c7e('0x3d')][_0x3c7e('0x50')](_0x3aa1b1);})[_0x3c7e('0x21')](function(_0x4042c4){_0x123462[_0x3c7e('0x51')]=_0x4042c4;return _0x123462;})['then'](respondWithFilteredResult(_0x77d83a,_0x3aa1b1))['catch'](handleError(_0x77d83a,null));};exports[_0x3c7e('0x52')]=function(_0x9dd27a,_0x2b72d3){var _0x346de0={'raw':!![],'where':{'id':_0x9dd27a['params']['id']}},_0x5b4971={};_0x5b4971['model']=_[_0x3c7e('0x42')](db[_0x3c7e('0x3d')]['rawAttributes']);_0x5b4971[_0x3c7e('0x41')]=_['keys'](_0x9dd27a[_0x3c7e('0x41')]);_0x5b4971[_0x3c7e('0x4b')]=_[_0x3c7e('0x43')](_0x5b4971[_0x3c7e('0x45')],_0x5b4971['query']);_0x346de0[_0x3c7e('0x44')]=_[_0x3c7e('0x43')](_0x5b4971[_0x3c7e('0x45')],qs['fields'](_0x9dd27a[_0x3c7e('0x41')]['fields']));_0x346de0[_0x3c7e('0x44')]=_0x346de0['attributes'][_0x3c7e('0x53')]?_0x346de0[_0x3c7e('0x44')]:_0x5b4971[_0x3c7e('0x45')];if(_0x9dd27a[_0x3c7e('0x41')]['includeAll']){_0x346de0[_0x3c7e('0x54')]=[{'all':!![]}];}_0x346de0=_[_0x3c7e('0x4d')]({},_0x346de0,_0x9dd27a[_0x3c7e('0x4e')]);return db[_0x3c7e('0x3d')][_0x3c7e('0x55')](_0x346de0)['then'](handleEntityNotFound(_0x2b72d3,null))[_0x3c7e('0x21')](respondWithResult(_0x2b72d3,null))[_0x3c7e('0x2a')](handleError(_0x2b72d3,null));};exports[_0x3c7e('0x56')]=function(_0x3c61d5,_0x44a4a7){return db['ChatMessage'][_0x3c7e('0x56')](_0x3c61d5[_0x3c7e('0x57')],{})[_0x3c7e('0x21')](respondWithResult(_0x44a4a7,0xc9))[_0x3c7e('0x2a')](handleError(_0x44a4a7,null));};exports[_0x3c7e('0x37')]=function(_0x373067,_0x5969e5){if(_0x373067[_0x3c7e('0x57')]['id']){delete _0x373067[_0x3c7e('0x57')]['id'];}return db['ChatMessage'][_0x3c7e('0x55')]({'where':{'id':_0x373067['params']['id']}})[_0x3c7e('0x21')](handleEntityNotFound(_0x5969e5,null))[_0x3c7e('0x21')](saveUpdates(_0x373067[_0x3c7e('0x57')],null))[_0x3c7e('0x21')](respondWithResult(_0x5969e5,null))[_0x3c7e('0x2a')](handleError(_0x5969e5,null));};exports[_0x3c7e('0x38')]=function(_0x2371e9,_0x5212d3){return db[_0x3c7e('0x3d')][_0x3c7e('0x55')]({'where':{'id':_0x2371e9['params']['id']}})[_0x3c7e('0x21')](handleEntityNotFound(_0x5212d3,null))['then'](removeEntity(_0x5212d3,null))[_0x3c7e('0x2a')](handleError(_0x5212d3,null));};exports[_0x3c7e('0x58')]=function(_0x49c0df,_0x5eaccd){return db[_0x3c7e('0x3d')][_0x3c7e('0x58')]()[_0x3c7e('0x21')](respondWithResult(_0x5eaccd,null))[_0x3c7e('0x2a')](handleError(_0x5eaccd,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0x3c7e('0x59')]=function(_0x1cc5f5,_0x366e3e,_0x326ea4){var _0x4fc38e={'agent':{},'channel':'chat'};if(_0x1cc5f5[_0x3c7e('0x57')]['id']){delete _0x1cc5f5[_0x3c7e('0x57')]['id'];}_0x1cc5f5[_0x3c7e('0x57')][_0x3c7e('0x5a')]=!![];_0x1cc5f5[_0x3c7e('0x57')][_0x3c7e('0x5b')]=moment()[_0x3c7e('0x5c')](_0x3c7e('0x5d'));_0x1cc5f5[_0x3c7e('0x57')][_0x3c7e('0x5e')]=_0x1cc5f5[_0x3c7e('0x57')]['UserId']||_0x1cc5f5[_0x3c7e('0x5f')]['id'];_0x4fc38e[_0x3c7e('0x60')]['id']=_0x1cc5f5[_0x3c7e('0x57')]['UserId'];return db['ChatMessage']['find']({'where':{'id':_0x1cc5f5['params']['id'],'UserId':null}})[_0x3c7e('0x21')](handleEntityNotFound(_0x366e3e,null))[_0x3c7e('0x21')](saveUpdates(_0x1cc5f5[_0x3c7e('0x57')],null))[_0x3c7e('0x21')](function(_0x185156){if(_0x185156){_0x4fc38e[_0x3c7e('0x29')]=_0x185156[_0x3c7e('0x61')]({'plain':!![]});return db['ChatInteraction'][_0x3c7e('0x55')]({'where':{'id':_0x185156[_0x3c7e('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x366e3e,null))[_0x3c7e('0x21')](function(_0xf6309e){if(_0xf6309e){return _0xf6309e[_0x3c7e('0x37')]({'UserId':_0x1cc5f5['body']['UserId'],'read1stAt':_[_0x3c7e('0x63')](_0xf6309e[_0x3c7e('0x64')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x5b4246){if(_0x5b4246){_0x4fc38e[_0x3c7e('0x65')]=_0x5b4246[_0x3c7e('0x61')]({'plain':!![]});interaction_log['info'](_0x3c7e('0x66'),_0x1cc5f5[_0x3c7e('0x5f')]['id'],_0x1cc5f5['user']['name'],_0x1cc5f5[_0x3c7e('0x5f')][_0x3c7e('0x67')],_0x4fc38e[_0x3c7e('0x65')]['id'],_0x1cc5f5[_0x3c7e('0x57')]?JSON[_0x3c7e('0x26')](_0x1cc5f5[_0x3c7e('0x57')]):_0x3c7e('0x68'));return respondWithRpcPromise(_0x3c7e('0x69'),_0x3c7e('0x6a'),_0x4fc38e);}return null;})[_0x3c7e('0x21')](function(_0x13bb05){var _0x38922f=_0x3c7e('0x6b')+_0x13bb05[_0x3c7e('0x29')]['ContactId'];return db['sequelize'][_0x3c7e('0x41')](_0x38922f,{'type':db[_0x3c7e('0x6c')]['QueryTypes'][_0x3c7e('0x6d')],'raw':!![]})[_0x3c7e('0x21')](function(_0x59d09d){return _0x59d09d;});})[_0x3c7e('0x21')](function(_0x42b28e){if(_0x42b28e){_0x4fc38e[_0x3c7e('0x29')][_0x3c7e('0x6e')]=_0x42b28e[0x0];if(!_0x1cc5f5[_0x3c7e('0x57')][_0x3c7e('0x5e')])return;return db[_0x3c7e('0x6f')]['find']({'where':{'id':_0x1cc5f5[_0x3c7e('0x57')][_0x3c7e('0x5e')],'role':'agent'},'attributes':['id','name',_0x3c7e('0x70'),_0x3c7e('0x71'),_0x3c7e('0x72')],'raw':!![]});}return null;})[_0x3c7e('0x21')](function(_0x49d871){if(!_0x49d871)return null;_0x4fc38e[_0x3c7e('0x29')][_0x3c7e('0x60')]=_0x49d871;return _0x4fc38e;})['then'](function(_0x1b369a){if(_0x1b369a){if(_0x1cc5f5[_0x3c7e('0x57')][_0x3c7e('0x73')]){_0x4fc38e['message'][_0x3c7e('0x74')]=util[_0x3c7e('0x5c')]('SIP/%s',_0x1cc5f5['user'][_0x3c7e('0x3a')]);_0x4fc38e[_0x3c7e('0x29')]['channel']=_0x4fc38e[_0x3c7e('0x75')];_0x4fc38e['message']['motionChannel']=_0x4fc38e[_0x3c7e('0x75')];_0x4fc38e['message'][_0x3c7e('0x76')]=_0x3c7e('0x59');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x3c7e('0x77'),'message':_[_0x3c7e('0x4d')](_0x4fc38e[_0x3c7e('0x29')],JSON[_0x3c7e('0x78')](_0x4fc38e[_0x3c7e('0x65')][_0x3c7e('0x79')]))},client9002)[_0x3c7e('0x21')](function(){return _0x4fc38e;});}return _0x4fc38e;}return null;})[_0x3c7e('0x21')](respondWithResult(_0x366e3e,null))['catch'](handleError(_0x366e3e,null));};var interaction_log=require(_0x3c7e('0x14'))(_0x3c7e('0x7a'));exports['reject']=function(_0x428c06,_0x2bd52f,_0x37cb84){var _0x111a40={'agent':{},'channel':_0x3c7e('0x7b')};if(_0x428c06[_0x3c7e('0x57')]['id']){delete _0x428c06[_0x3c7e('0x57')]['id'];}_0x428c06[_0x3c7e('0x57')][_0x3c7e('0x5e')]=_0x428c06[_0x3c7e('0x57')][_0x3c7e('0x5e')]||_0x428c06[_0x3c7e('0x5f')]['id'];_0x111a40['agent']['id']=_0x428c06[_0x3c7e('0x57')][_0x3c7e('0x5e')];return db[_0x3c7e('0x3d')][_0x3c7e('0x55')]({'where':{'id':_0x428c06[_0x3c7e('0x7c')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2bd52f,null))[_0x3c7e('0x21')](function(_0x268756){if(_0x268756){_0x111a40[_0x3c7e('0x29')]=_0x268756[_0x3c7e('0x61')]({'plain':!![]});return db[_0x3c7e('0x7d')][_0x3c7e('0x55')]({'where':{'id':_0x268756['ChatInteractionId']}});}return null;})[_0x3c7e('0x21')](handleEntityNotFound(_0x2bd52f,null))['then'](function(_0x54cd15){if(_0x54cd15){_0x111a40[_0x3c7e('0x65')]=_0x54cd15['get']({'plain':!![]});interaction_log['info'](_0x3c7e('0x7e'),_0x428c06[_0x3c7e('0x5f')]['id'],_0x428c06[_0x3c7e('0x5f')][_0x3c7e('0x3a')],_0x428c06['user'][_0x3c7e('0x67')],_0x111a40[_0x3c7e('0x65')]['id'],_0x428c06[_0x3c7e('0x57')]?JSON[_0x3c7e('0x26')](_0x428c06[_0x3c7e('0x57')]):'null');return respondWithRpcPromise('RejectMessage',_0x3c7e('0x7f'),_0x111a40);}return null;})[_0x3c7e('0x21')](function(_0x1f7fa5){var _0x174988=_0x3c7e('0x6b')+_0x1f7fa5[_0x3c7e('0x29')][_0x3c7e('0x80')];return db[_0x3c7e('0x81')][_0x3c7e('0x41')](_0x174988,{'type':db[_0x3c7e('0x6c')][_0x3c7e('0x82')][_0x3c7e('0x6d')],'raw':!![]})[_0x3c7e('0x21')](function(_0x4574dc){return _0x4574dc;});})['then'](function(_0x48ee11){if(_0x48ee11){_0x111a40['message']['contact']=_0x48ee11[0x0];if(!_0x428c06[_0x3c7e('0x57')]['UserId'])return;return db[_0x3c7e('0x6f')][_0x3c7e('0x55')]({'where':{'id':_0x428c06[_0x3c7e('0x57')][_0x3c7e('0x5e')],'role':_0x3c7e('0x60')},'attributes':['id',_0x3c7e('0x3a'),_0x3c7e('0x70'),_0x3c7e('0x71'),_0x3c7e('0x72')],'raw':!![]});}return null;})[_0x3c7e('0x21')](function(_0x44e227){if(!_0x44e227)return null;_0x111a40[_0x3c7e('0x29')][_0x3c7e('0x60')]=_0x44e227;return _0x111a40;})['then'](function(_0xd60c41){if(_0xd60c41){_0xd60c41[_0x3c7e('0x29')][_0x3c7e('0x74')]=util[_0x3c7e('0x5c')](_0x3c7e('0x83'),_0x428c06['user']['name']);_0xd60c41[_0x3c7e('0x29')][_0x3c7e('0x75')]=_0x111a40[_0x3c7e('0x75')];_0xd60c41['message'][_0x3c7e('0x84')]=_0x111a40[_0x3c7e('0x75')];_0xd60c41[_0x3c7e('0x29')][_0x3c7e('0x76')]=_0x3c7e('0x85');respondWithRpcPromise(_0x3c7e('0x86'),_0x3c7e('0x86'),{'event':_0x3c7e('0x87'),'message':_[_0x3c7e('0x4d')](_0x111a40['message'],JSON[_0x3c7e('0x78')](_0x111a40['interaction'][_0x3c7e('0x79')]))},client9002);return _0x111a40;}return null;})[_0x3c7e('0x21')](respondWithResult(_0x2bd52f,null))[_0x3c7e('0x2a')](handleError(_0x2bd52f,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 8177348..8a52273 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 _0x1838=['../../mysqldb','ChatMessage','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x1838,0x1e0));var _0x8183=function(_0x2d1e29,_0x22f87b){_0x2d1e29=_0x2d1e29-0x0;var _0x238fca=_0x1838[_0x2d1e29];return _0x238fca;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x8183('0x0'))['db'][_0x8183('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8183('0x2'),'afterUpdate':_0x8183('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5f55a5){return function(_0x39abd6,_0x5c26fb,_0xcd7070){ChatMessageEvents[_0x8183('0x4')](_0x5f55a5+':'+_0x39abd6['id'],_0x39abd6);ChatMessageEvents[_0x8183('0x4')](_0x5f55a5,_0x39abd6);_0xcd7070(null);};}for(var e in events){if(events[_0x8183('0x5')](e)){var event=events[e];ChatMessage[_0x8183('0x6')](e,emitEvent(event));}}module[_0x8183('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x6da5=['hasOwnProperty','hook','events','../../mysqldb','ChatMessage','setMaxListeners','save','remove','emit'];(function(_0x2e748c,_0x55ec8e){var _0x37e219=function(_0x38c784){while(--_0x38c784){_0x2e748c['push'](_0x2e748c['shift']());}};_0x37e219(++_0x55ec8e);}(_0x6da5,0x1bb));var _0x56da=function(_0x54bf1d,_0x96319e){_0x54bf1d=_0x54bf1d-0x0;var _0x4e9ae6=_0x6da5[_0x54bf1d];return _0x4e9ae6;};'use strict';var EventEmitter=require(_0x56da('0x0'));var ChatMessage=require(_0x56da('0x1'))['db'][_0x56da('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x56da('0x3')](0x0);var events={'afterCreate':_0x56da('0x4'),'afterUpdate':'update','afterDestroy':_0x56da('0x5')};function emitEvent(_0x2daff2){return function(_0x2ade35,_0x3f057c,_0x398bfb){ChatMessageEvents['emit'](_0x2daff2+':'+_0x2ade35['id'],_0x2ade35);ChatMessageEvents[_0x56da('0x6')](_0x2daff2,_0x2ade35);_0x398bfb(null);};}for(var e in events){if(events[_0x56da('0x7')](e)){var event=events[e];ChatMessage[_0x56da('0x8')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 7591151..3604978 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 _0xdab2=['catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','toLowerCase','direction','out','secret','UserId','ChatInteraction','ChatInteractionId','then','createdAt'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdab2,0x130));var _0x2dab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdab2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2dab('0x0'));var util=require(_0x2dab('0x1'));var logger=require('../../config/logger')(_0x2dab('0x2'));var moment=require(_0x2dab('0x3'));var BPromise=require(_0x2dab('0x4'));var rp=require(_0x2dab('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2dab('0x6'));var config=require(_0x2dab('0x7'));var attributes=require(_0x2dab('0x8'));module[_0x2dab('0x9')]=function(_0x4562bb,_0x1421d5){return _0x4562bb[_0x2dab('0xa')](_0x2dab('0xb'),attributes,{'tableName':_0x2dab('0xc'),'paranoid':![],'indexes':[{'name':_0x2dab('0xd'),'fields':[_0x2dab('0xe')],'type':_0x2dab('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x317c59,_0x533046,_0x596950){var _0x26852f=_0x4562bb[_0x2dab('0x10')];var _0x1e258e=_0x317c59['get']({'plain':!![]});if(_0x1e258e['direction'][_0x2dab('0x11')]()==='in'||_0x1e258e[_0x2dab('0x12')][_0x2dab('0x11')]()===_0x2dab('0x13')&&!_0x1e258e[_0x2dab('0x14')]&&!_['isNil'](_0x1e258e[_0x2dab('0x15')])){_0x26852f[_0x2dab('0x16')]['findOne']({'where':{'id':_0x1e258e[_0x2dab('0x17')]}})[_0x2dab('0x18')](function(_0x1b5161){if(_0x1b5161){_0x1b5161['update']({'lastMsgAt':_0x1e258e[_0x2dab('0x19')],'lastMsgDirection':_0x1e258e[_0x2dab('0x12')]['toLowerCase']()});}})[_0x2dab('0x1a')](function(_0x15a9e7){console[_0x2dab('0x1b')](_0x15a9e7);});}_0x596950();}},'charset':_0x2dab('0x1c'),'collate':_0x2dab('0x1d')});}; \ No newline at end of file +var _0xfe5e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','direction','toLowerCase','out','secret','isNil','ChatInteraction','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x2a4144,_0xdd438f){var _0x26722b=function(_0x1634f3){while(--_0x1634f3){_0x2a4144['push'](_0x2a4144['shift']());}};_0x26722b(++_0xdd438f);}(_0xfe5e,0x186));var _0xefe5=function(_0x340c13,_0x595d66){_0x340c13=_0x340c13-0x0;var _0x5a7d96=_0xfe5e[_0x340c13];return _0x5a7d96;};'use strict';var _=require(_0xefe5('0x0'));var util=require('util');var logger=require(_0xefe5('0x1'))('api');var moment=require(_0xefe5('0x2'));var BPromise=require(_0xefe5('0x3'));var rp=require(_0xefe5('0x4'));var fs=require('fs');var path=require(_0xefe5('0x5'));var rimraf=require(_0xefe5('0x6'));var config=require(_0xefe5('0x7'));var attributes=require(_0xefe5('0x8'));module[_0xefe5('0x9')]=function(_0x3b6107,_0x1f3989){return _0x3b6107[_0xefe5('0xa')](_0xefe5('0xb'),attributes,{'tableName':_0xefe5('0xc'),'paranoid':![],'indexes':[{'name':_0xefe5('0xd'),'fields':[_0xefe5('0xe')],'type':_0xefe5('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a7cad,_0x59a9b0,_0x5372ad){var _0x45ddc6=_0x3b6107['models'];var _0x5bcbfc=_0x5a7cad['get']({'plain':!![]});if(_0x5bcbfc[_0xefe5('0x10')][_0xefe5('0x11')]()==='in'||_0x5bcbfc['direction'][_0xefe5('0x11')]()===_0xefe5('0x12')&&!_0x5bcbfc[_0xefe5('0x13')]&&!_[_0xefe5('0x14')](_0x5bcbfc['UserId'])){_0x45ddc6[_0xefe5('0x15')]['findOne']({'where':{'id':_0x5bcbfc['ChatInteractionId']}})[_0xefe5('0x16')](function(_0x18dc3a){if(_0x18dc3a){_0x18dc3a[_0xefe5('0x17')]({'lastMsgAt':_0x5bcbfc[_0xefe5('0x18')],'lastMsgDirection':_0x5bcbfc[_0xefe5('0x10')][_0xefe5('0x11')]()});}})['catch'](function(_0x2de34e){console[_0xefe5('0x19')](_0x2de34e);});}_0x5372ad();}},'charset':_0xefe5('0x1a'),'collate':_0xefe5('0x1b')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 4ae2ffc..12ccec1 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 _0xfc4f=['create','body','options','raw','then','CreateChatMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','ChatMessage'];(function(_0x22e69a,_0x464f63){var _0x16f52f=function(_0x47918c){while(--_0x47918c){_0x22e69a['push'](_0x22e69a['shift']());}};_0x16f52f(++_0x464f63);}(_0xfc4f,0x192));var _0xffc4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xfc4f[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xffc4('0x0'));var moment=require(_0xffc4('0x1'));var BPromise=require(_0xffc4('0x2'));var rs=require(_0xffc4('0x3'));var fs=require('fs');var Redis=require(_0xffc4('0x4'));var db=require(_0xffc4('0x5'))['db'];var utils=require(_0xffc4('0x6'));var logger=require('../../config/logger')(_0xffc4('0x7'));var config=require(_0xffc4('0x8'));var jayson=require(_0xffc4('0x9'));var client=jayson[_0xffc4('0xa')]['http']({'port':0x232a});config[_0xffc4('0xb')]=_[_0xffc4('0xc')](config['redis'],{'host':_0xffc4('0xd'),'port':0x18eb});var socket=require(_0xffc4('0xe'))(new Redis(config[_0xffc4('0xb')]));require(_0xffc4('0xf'))['register'](socket);function respondWithRpcPromise(_0x22daf5,_0x22d03a,_0x2539cd){return new BPromise(function(_0x1718c3,_0x3705a7){return client[_0xffc4('0x10')](_0x22daf5,_0x2539cd)['then'](function(_0x4136dd){logger[_0xffc4('0x11')](_0xffc4('0x12'),_0x22d03a,_0xffc4('0x13'));logger[_0xffc4('0x14')](_0xffc4('0x15'),_0x22d03a,_0xffc4('0x13'),JSON['stringify'](_0x4136dd));if(_0x4136dd[_0xffc4('0x16')]){if(_0x4136dd[_0xffc4('0x16')]['code']===0x1f4){logger[_0xffc4('0x16')](_0xffc4('0x12'),_0x22d03a,_0x4136dd['error'][_0xffc4('0x17')]);return _0x3705a7(_0x4136dd[_0xffc4('0x16')][_0xffc4('0x17')]);}logger[_0xffc4('0x16')]('ChatMessage,\x20%s,\x20%s',_0x22d03a,_0x4136dd[_0xffc4('0x16')][_0xffc4('0x17')]);return _0x1718c3(_0x4136dd[_0xffc4('0x16')][_0xffc4('0x17')]);}else{logger[_0xffc4('0x11')](_0xffc4('0x12'),_0x22d03a,_0xffc4('0x13'));_0x1718c3(_0x4136dd[_0xffc4('0x18')][_0xffc4('0x17')]);}})[_0xffc4('0x19')](function(_0x51a9ba){logger[_0xffc4('0x16')]('ChatMessage,\x20%s,\x20%s',_0x22d03a,_0x51a9ba);_0x3705a7(_0x51a9ba);});});}exports['CreateChatMessage']=function(_0x6a0096){var _0xd48851=this;return new Promise(function(_0x25b521,_0x5eb1c1){return db[_0xffc4('0x1a')][_0xffc4('0x1b')](_0x6a0096[_0xffc4('0x1c')],{'raw':_0x6a0096[_0xffc4('0x1d')]?_0x6a0096[_0xffc4('0x1d')][_0xffc4('0x1e')]===undefined?!![]:![]:!![]})[_0xffc4('0x1f')](function(_0x5957f2){logger[_0xffc4('0x11')](_0xffc4('0x20'),_0x6a0096);logger[_0xffc4('0x14')](_0xffc4('0x20'),_0x6a0096,JSON['stringify'](_0x5957f2));_0x25b521(_0x5957f2);})['catch'](function(_0x39d808){logger[_0xffc4('0x16')]('CreateChatMessage',_0x39d808[_0xffc4('0x17')],_0x6a0096);_0x5eb1c1(_0xd48851[_0xffc4('0x16')](0x1f4,_0x39d808[_0xffc4('0x17')]));});});}; \ No newline at end of file +var _0xfbbc=['message','result','catch','ChatMessage','create','body','options','raw','info','CreateChatMessage','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','localhost','./chatMessage.socket','register','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x11a0b0,_0x13077c){var _0x1382e6=function(_0x562ed0){while(--_0x562ed0){_0x11a0b0['push'](_0x11a0b0['shift']());}};_0x1382e6(++_0x13077c);}(_0xfbbc,0x86));var _0xcfbb=function(_0x1f3b06,_0xffc69a){_0x1f3b06=_0x1f3b06-0x0;var _0x4f198e=_0xfbbc[_0x1f3b06];return _0x4f198e;};'use strict';var _=require(_0xcfbb('0x0'));var util=require(_0xcfbb('0x1'));var moment=require(_0xcfbb('0x2'));var BPromise=require(_0xcfbb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcfbb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcfbb('0x5'))('rpc');var config=require(_0xcfbb('0x6'));var jayson=require(_0xcfbb('0x7'));var client=jayson['client'][_0xcfbb('0x8')]({'port':0x232a});config['redis']=_[_0xcfbb('0x9')](config[_0xcfbb('0xa')],{'host':_0xcfbb('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcfbb('0xa')]));require(_0xcfbb('0xc'))[_0xcfbb('0xd')](socket);function respondWithRpcPromise(_0x1f08c6,_0x3a0a4a,_0x384e19){return new BPromise(function(_0x4003d4,_0x5ee8c2){return client['request'](_0x1f08c6,_0x384e19)[_0xcfbb('0xe')](function(_0x2ac18e){logger['info'](_0xcfbb('0xf'),_0x3a0a4a,_0xcfbb('0x10'));logger[_0xcfbb('0x11')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x3a0a4a,_0xcfbb('0x10'),JSON[_0xcfbb('0x12')](_0x2ac18e));if(_0x2ac18e[_0xcfbb('0x13')]){if(_0x2ac18e['error'][_0xcfbb('0x14')]===0x1f4){logger[_0xcfbb('0x13')](_0xcfbb('0xf'),_0x3a0a4a,_0x2ac18e[_0xcfbb('0x13')]['message']);return _0x5ee8c2(_0x2ac18e[_0xcfbb('0x13')][_0xcfbb('0x15')]);}logger[_0xcfbb('0x13')]('ChatMessage,\x20%s,\x20%s',_0x3a0a4a,_0x2ac18e[_0xcfbb('0x13')]['message']);return _0x4003d4(_0x2ac18e[_0xcfbb('0x13')]['message']);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x3a0a4a,_0xcfbb('0x10'));_0x4003d4(_0x2ac18e[_0xcfbb('0x16')][_0xcfbb('0x15')]);}})[_0xcfbb('0x17')](function(_0x4183f7){logger['error'](_0xcfbb('0xf'),_0x3a0a4a,_0x4183f7);_0x5ee8c2(_0x4183f7);});});}exports['CreateChatMessage']=function(_0xa4404a){var _0x3d2715=this;return new Promise(function(_0x1322ac,_0x2a63c5){return db[_0xcfbb('0x18')][_0xcfbb('0x19')](_0xa4404a[_0xcfbb('0x1a')],{'raw':_0xa4404a[_0xcfbb('0x1b')]?_0xa4404a[_0xcfbb('0x1b')][_0xcfbb('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x283aed){logger[_0xcfbb('0x1d')](_0xcfbb('0x1e'),_0xa4404a);logger[_0xcfbb('0x11')](_0xcfbb('0x1e'),_0xa4404a,JSON[_0xcfbb('0x12')](_0x283aed));_0x1322ac(_0x283aed);})[_0xcfbb('0x17')](function(_0x20c045){logger[_0xcfbb('0x13')]('CreateChatMessage',_0x20c045['message'],_0xa4404a);_0x2a63c5(_0x3d2715[_0xcfbb('0x13')](0x1f4,_0x20c045[_0xcfbb('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 0275f91..fae2f7a 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 _0x0960=['update','emit','removeListener','register','chatMessage:','./chatMessage.events','save'];(function(_0x44361c,_0x310ea4){var _0x59adb0=function(_0x4d0b42){while(--_0x4d0b42){_0x44361c['push'](_0x44361c['shift']());}};_0x59adb0(++_0x310ea4);}(_0x0960,0xc2));var _0x0096=function(_0x440e0f,_0x47a9c1){_0x440e0f=_0x440e0f-0x0;var _0x216b2b=_0x0960[_0x440e0f];return _0x216b2b;};'use strict';var ChatMessageEvents=require(_0x0096('0x0'));var events=[_0x0096('0x1'),'remove',_0x0096('0x2')];function createListener(_0x1078f3,_0x41a86e){return function(_0x136f7a){_0x41a86e[_0x0096('0x3')](_0x1078f3,_0x136f7a);};}function removeListener(_0xd0d4c6,_0x3ee9fb){return function(){ChatMessageEvents[_0x0096('0x4')](_0xd0d4c6,_0x3ee9fb);};}exports[_0x0096('0x5')]=function(_0x6ea572){for(var _0x59b3cc=0x0,_0x81cc41=events['length'];_0x59b3cc<_0x81cc41;_0x59b3cc++){var _0x1d35f1=events[_0x59b3cc];var _0x44e168=createListener(_0x0096('0x6')+_0x1d35f1,_0x6ea572);ChatMessageEvents['on'](_0x1d35f1,_0x44e168);}}; \ No newline at end of file +var _0x3831=['removeListener','chatMessage:','./chatMessage.events','remove','update'];(function(_0x14bd4e,_0x57d937){var _0x95efc0=function(_0x3ba244){while(--_0x3ba244){_0x14bd4e['push'](_0x14bd4e['shift']());}};_0x95efc0(++_0x57d937);}(_0x3831,0x14c));var _0x1383=function(_0x281e5e,_0xf320e2){_0x281e5e=_0x281e5e-0x0;var _0x5a22d2=_0x3831[_0x281e5e];return _0x5a22d2;};'use strict';var ChatMessageEvents=require(_0x1383('0x0'));var events=['save',_0x1383('0x1'),_0x1383('0x2')];function createListener(_0x3a25fd,_0x15e6b5){return function(_0x391bef){_0x15e6b5['emit'](_0x3a25fd,_0x391bef);};}function removeListener(_0x2fdf72,_0x573874){return function(){ChatMessageEvents[_0x1383('0x3')](_0x2fdf72,_0x573874);};}exports['register']=function(_0x5b64b1){for(var _0x5eb4d8=0x0,_0x45a030=events['length'];_0x5eb4d8<_0x45a030;_0x5eb4d8++){var _0x187027=events[_0x5eb4d8];var _0x1ddd4c=createListener(_0x1383('0x4')+_0x187027,_0x5b64b1);ChatMessageEvents['on'](_0x187027,_0x1ddd4c);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 37403a8..fc00800 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 _0x3749=['delete','destroy','multer','util','connect-timeout','fs-extra','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','/describe','/:id','post','tracked','chat','create','put','update','/:id/accept','/:id/reject','reject'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x3749,0x1d0));var _0x9374=function(_0x3f9d5d,_0x4ee8dd){_0x3f9d5d=_0x3f9d5d-0x0;var _0x1b2cd7=_0x3749[_0x3f9d5d];return _0x1b2cd7;};'use strict';var multer=require(_0x9374('0x0'));var util=require(_0x9374('0x1'));var path=require('path');var timeout=require(_0x9374('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9374('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9374('0x4'));var config=require('../../config/environment');var controller=require(_0x9374('0x5'));router[_0x9374('0x6')]('/',auth[_0x9374('0x7')](),controller['index']);router[_0x9374('0x6')](_0x9374('0x8'),auth[_0x9374('0x7')](),controller['describe']);router[_0x9374('0x6')](_0x9374('0x9'),auth[_0x9374('0x7')](),controller['show']);router[_0x9374('0xa')]('/',auth[_0x9374('0x7')](),interaction[_0x9374('0xb')](_0x9374('0xc'),'chatmessage:create'),controller[_0x9374('0xd')]);router[_0x9374('0xe')](_0x9374('0x9'),controller[_0x9374('0xf')]);router[_0x9374('0xe')](_0x9374('0x10'),auth[_0x9374('0x7')](),controller['accept']);router[_0x9374('0xe')](_0x9374('0x11'),auth[_0x9374('0x7')](),controller[_0x9374('0x12')]);router[_0x9374('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x9374('0x14')]);module['exports']=router; \ No newline at end of file +var _0xb87d=['chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','delete','destroy','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','tracked','chat'];(function(_0x584ef7,_0x53af65){var _0x4fb297=function(_0x4ace4b){while(--_0x4ace4b){_0x584ef7['push'](_0x584ef7['shift']());}};_0x4fb297(++_0x53af65);}(_0xb87d,0x14b));var _0xdb87=function(_0x18b208,_0xc61865){_0x18b208=_0x18b208-0x0;var _0x51c026=_0xb87d[_0x18b208];return _0x51c026;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdb87('0x0'));var timeout=require(_0xdb87('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdb87('0x2'));var auth=require(_0xdb87('0x3'));var interaction=require(_0xdb87('0x4'));var config=require(_0xdb87('0x5'));var controller=require('./chatMessage.controller');router[_0xdb87('0x6')]('/',auth['isAuthenticated'](),controller[_0xdb87('0x7')]);router[_0xdb87('0x6')](_0xdb87('0x8'),auth[_0xdb87('0x9')](),controller[_0xdb87('0xa')]);router[_0xdb87('0x6')](_0xdb87('0xb'),auth[_0xdb87('0x9')](),controller['show']);router['post']('/',auth[_0xdb87('0x9')](),interaction[_0xdb87('0xc')](_0xdb87('0xd'),_0xdb87('0xe')),controller[_0xdb87('0xf')]);router[_0xdb87('0x10')]('/:id',controller[_0xdb87('0x11')]);router['put'](_0xdb87('0x12'),auth['isAuthenticated'](),controller[_0xdb87('0x13')]);router[_0xdb87('0x10')](_0xdb87('0x14'),auth[_0xdb87('0x9')](),controller['reject']);router[_0xdb87('0x15')](_0xdb87('0xb'),auth[_0xdb87('0x9')](),controller[_0xdb87('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 1a3a530..b3fc340 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 _0xa34a=['medium','sequelize','TEXT'];(function(_0x18fa33,_0xe5bc0b){var _0x460cde=function(_0x557af1){while(--_0x557af1){_0x18fa33['push'](_0x18fa33['shift']());}};_0x460cde(++_0xe5bc0b);}(_0xa34a,0xac));var _0xaa34=function(_0x5c26ab,_0x327f54){_0x5c26ab=_0x5c26ab-0x0;var _0x5b64f3=_0xa34a[_0x5c26ab];return _0x5b64f3;};'use strict';var Sequelize=require(_0xaa34('0x0'));module['exports']={'body':{'type':Sequelize[_0xaa34('0x1')](_0xaa34('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0x76b3=['TEXT','sequelize','exports'];(function(_0x27a25c,_0x36f490){var _0x1e8b09=function(_0x43de11){while(--_0x43de11){_0x27a25c['push'](_0x27a25c['shift']());}};_0x1e8b09(++_0x36f490);}(_0x76b3,0x142));var _0x376b=function(_0x27cdf5,_0x46509c){_0x27cdf5=_0x27cdf5-0x0;var _0x530a75=_0x76b3[_0x27cdf5];return _0x530a75;};'use strict';var Sequelize=require(_0x376b('0x0'));module[_0x376b('0x1')]={'body':{'type':Sequelize[_0x376b('0x2')]('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 0756b8d..bd7f0be 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0xf7471d,_0x24bb2b){var _0x3a1ce8=function(_0x42d69d){while(--_0x42d69d){_0xf7471d['push'](_0xf7471d['shift']());}};_0x3a1ce8(++_0x24bb2b);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _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(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0x7a54,0x106));var _0x47a5=function(_0x7811e2,_0x5940bc){_0x7811e2=_0x7811e2-0x0;var _0x5493ec=_0x7a54[_0x7811e2];return _0x5493ec;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 60ad9b3..f403a14 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 _0x243b=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./chatOfflineMessage.attributes','define','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x20def7,_0x2caec4){var _0xdc6a3e=function(_0x274412){while(--_0x274412){_0x20def7['push'](_0x20def7['shift']());}};_0xdc6a3e(++_0x2caec4);}(_0x243b,0xb3));var _0xb243=function(_0x49eb84,_0x20f3a7){_0x49eb84=_0x49eb84-0x0;var _0x3a5733=_0x243b[_0x49eb84];return _0x3a5733;};'use strict';var _=require(_0xb243('0x0'));var util=require(_0xb243('0x1'));var logger=require(_0xb243('0x2'))('api');var moment=require(_0xb243('0x3'));var BPromise=require(_0xb243('0x4'));var rp=require(_0xb243('0x5'));var fs=require('fs');var path=require(_0xb243('0x6'));var rimraf=require('rimraf');var config=require(_0xb243('0x7'));var attributes=require(_0xb243('0x8'));module['exports']=function(_0x3db848,_0x370c1d){return _0x3db848[_0xb243('0x9')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb243('0xa'),'collate':_0xb243('0xb')});}; \ No newline at end of file +var _0x87f6=['bluebird','path','rimraf','./chatOfflineMessage.attributes','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x87f6,0xed));var _0x687f=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x87f6[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x687f('0x0'))(_0x687f('0x1'));var moment=require(_0x687f('0x2'));var BPromise=require(_0x687f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x687f('0x4'));var rimraf=require(_0x687f('0x5'));var config=require('../../config/environment');var attributes=require(_0x687f('0x6'));module['exports']=function(_0x1111d3,_0x213e56){return _0x1111d3[_0x687f('0x7')](_0x687f('0x8'),attributes,{'tableName':_0x687f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x687f('0xa'),'collate':_0x687f('0xb')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 7516954..b51c9f3 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 _0x9de1=['ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatOfflineMessage,\x20%s,\x20%s','message','info','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','request\x20sent','debug'];(function(_0x386525,_0xefae6){var _0x14d015=function(_0x4a45c1){while(--_0x4a45c1){_0x386525['push'](_0x386525['shift']());}};_0x14d015(++_0xefae6);}(_0x9de1,0x1ea));var _0x19de=function(_0x38999c,_0x45edd0){_0x38999c=_0x38999c-0x0;var _0x302301=_0x9de1[_0x38999c];return _0x302301;};'use strict';var _=require(_0x19de('0x0'));var util=require(_0x19de('0x1'));var moment=require('moment');var BPromise=require(_0x19de('0x2'));var rs=require(_0x19de('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x19de('0x4'))['db'];var utils=require(_0x19de('0x5'));var logger=require(_0x19de('0x6'))(_0x19de('0x7'));var config=require('../../config/environment');var jayson=require(_0x19de('0x8'));var client=jayson[_0x19de('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xda6e81,_0x34325d,_0x3588ce){return new BPromise(function(_0xb16bc7,_0xdee01f){return client[_0x19de('0xa')](_0xda6e81,_0x3588ce)[_0x19de('0xb')](function(_0x1acf99){logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x34325d,_0x19de('0xc'));logger[_0x19de('0xd')](_0x19de('0xe'),_0x34325d,_0x19de('0xc'),JSON[_0x19de('0xf')](_0x1acf99));if(_0x1acf99['error']){if(_0x1acf99[_0x19de('0x10')]['code']===0x1f4){logger[_0x19de('0x10')](_0x19de('0x11'),_0x34325d,_0x1acf99[_0x19de('0x10')][_0x19de('0x12')]);return _0xdee01f(_0x1acf99['error']['message']);}logger[_0x19de('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x34325d,_0x1acf99[_0x19de('0x10')][_0x19de('0x12')]);return _0xb16bc7(_0x1acf99[_0x19de('0x10')][_0x19de('0x12')]);}else{logger[_0x19de('0x13')](_0x19de('0x11'),_0x34325d,_0x19de('0xc'));_0xb16bc7(_0x1acf99[_0x19de('0x14')][_0x19de('0x12')]);}})['catch'](function(_0x51a70b){logger['error'](_0x19de('0x11'),_0x34325d,_0x51a70b);_0xdee01f(_0x51a70b);});});} \ No newline at end of file +var _0x8524=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4d8789,_0x3fdff1){var _0x404e41=function(_0x33d5a6){while(--_0x33d5a6){_0x4d8789['push'](_0x4d8789['shift']());}};_0x404e41(++_0x3fdff1);}(_0x8524,0x1d4));var _0x4852=function(_0x39ba93,_0x2b4e10){_0x39ba93=_0x39ba93-0x0;var _0x2986d0=_0x8524[_0x39ba93];return _0x2986d0;};'use strict';var _=require(_0x4852('0x0'));var util=require(_0x4852('0x1'));var moment=require(_0x4852('0x2'));var BPromise=require(_0x4852('0x3'));var rs=require(_0x4852('0x4'));var fs=require('fs');var Redis=require(_0x4852('0x5'));var db=require(_0x4852('0x6'))['db'];var utils=require(_0x4852('0x7'));var logger=require(_0x4852('0x8'))(_0x4852('0x9'));var config=require(_0x4852('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x4852('0xb')][_0x4852('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x936949,_0x2d05cd,_0x44cc6b){return new BPromise(function(_0x1e9273,_0x479d9c){return client[_0x4852('0xd')](_0x936949,_0x44cc6b)[_0x4852('0xe')](function(_0x2973f1){logger[_0x4852('0xf')](_0x4852('0x10'),_0x2d05cd,_0x4852('0x11'));logger[_0x4852('0x12')](_0x4852('0x13'),_0x2d05cd,_0x4852('0x11'),JSON['stringify'](_0x2973f1));if(_0x2973f1['error']){if(_0x2973f1[_0x4852('0x14')][_0x4852('0x15')]===0x1f4){logger[_0x4852('0x14')](_0x4852('0x10'),_0x2d05cd,_0x2973f1[_0x4852('0x14')]['message']);return _0x479d9c(_0x2973f1[_0x4852('0x14')]['message']);}logger[_0x4852('0x14')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2d05cd,_0x2973f1[_0x4852('0x14')][_0x4852('0x16')]);return _0x1e9273(_0x2973f1[_0x4852('0x14')][_0x4852('0x16')]);}else{logger[_0x4852('0xf')](_0x4852('0x10'),_0x2d05cd,_0x4852('0x11'));_0x1e9273(_0x2973f1[_0x4852('0x17')][_0x4852('0x16')]);}})[_0x4852('0x18')](function(_0x12f131){logger[_0x4852('0x14')](_0x4852('0x10'),_0x2d05cd,_0x12f131);_0x479d9c(_0x12f131);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index fc5eea9..fd5876f 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 _0x0a2b=['create','put','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','describe','show','post'];(function(_0x5c1a38,_0x1784a2){var _0x35d5fb=function(_0x2bea10){while(--_0x2bea10){_0x5c1a38['push'](_0x5c1a38['shift']());}};_0x35d5fb(++_0x1784a2);}(_0x0a2b,0x81));var _0xb0a2=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x0a2b[_0x2e4aa2];return _0x5e6092;};'use strict';var multer=require('multer');var util=require(_0xb0a2('0x0'));var path=require(_0xb0a2('0x1'));var timeout=require(_0xb0a2('0x2'));var express=require(_0xb0a2('0x3'));var router=express[_0xb0a2('0x4')]();var fs_extra=require(_0xb0a2('0x5'));var auth=require(_0xb0a2('0x6'));var interaction=require(_0xb0a2('0x7'));var config=require(_0xb0a2('0x8'));var controller=require(_0xb0a2('0x9'));router[_0xb0a2('0xa')]('/',auth[_0xb0a2('0xb')](),controller['index']);router[_0xb0a2('0xa')]('/describe',auth[_0xb0a2('0xb')](),controller[_0xb0a2('0xc')]);router['get']('/:id',auth[_0xb0a2('0xb')](),controller[_0xb0a2('0xd')]);router[_0xb0a2('0xe')]('/',auth[_0xb0a2('0xb')](),controller[_0xb0a2('0xf')]);router[_0xb0a2('0x10')]('/:id',auth[_0xb0a2('0xb')](),controller['update']);router['delete']('/:id',auth[_0xb0a2('0xb')](),controller[_0xb0a2('0x11')]);module['exports']=router; \ No newline at end of file +var _0x126e=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','post','create','put'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0x126e,0x1a6));var _0xe126=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x126e[_0x3ff085];return _0x2b68c3;};'use strict';var multer=require(_0xe126('0x0'));var util=require(_0xe126('0x1'));var path=require(_0xe126('0x2'));var timeout=require(_0xe126('0x3'));var express=require(_0xe126('0x4'));var router=express[_0xe126('0x5')]();var fs_extra=require(_0xe126('0x6'));var auth=require(_0xe126('0x7'));var interaction=require(_0xe126('0x8'));var config=require(_0xe126('0x9'));var controller=require('./chatOfflineMessage.controller');router[_0xe126('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe126('0xa')](_0xe126('0xb'),auth[_0xe126('0xc')](),controller[_0xe126('0xd')]);router[_0xe126('0xa')](_0xe126('0xe'),auth[_0xe126('0xc')](),controller['show']);router[_0xe126('0xf')]('/',auth[_0xe126('0xc')](),controller[_0xe126('0x10')]);router[_0xe126('0x11')](_0xe126('0xe'),auth[_0xe126('0xc')](),controller['update']);router['delete'](_0xe126('0xe'),auth[_0xe126('0xc')](),controller[_0xe126('0x12')]);module[_0xe126('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 2b1697d..8823285 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 _0x3b39=['STRING','ENUM','mouseOver','timeout','INTEGER','sequelize'];(function(_0x12443d,_0x19d2b2){var _0x24d6e0=function(_0x44e06d){while(--_0x44e06d){_0x12443d['push'](_0x12443d['shift']());}};_0x24d6e0(++_0x19d2b2);}(_0x3b39,0x1c1));var _0x93b3=function(_0x1d0cba,_0x2731b1){_0x1d0cba=_0x1d0cba-0x0;var _0xdc3278=_0x3b39[_0x1d0cba];return _0xdc3278;};'use strict';var Sequelize=require(_0x93b3('0x0'));module['exports']={'name':{'type':Sequelize[_0x93b3('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x93b3('0x2')](_0x93b3('0x3'),_0x93b3('0x4')),'defaultValue':_0x93b3('0x3')},'selector':{'type':Sequelize[_0x93b3('0x1')]},'timeout':{'type':Sequelize[_0x93b3('0x5')]}}; \ No newline at end of file +var _0x950d=['mouseOver','timeout','STRING','INTEGER','sequelize','ENUM'];(function(_0x51186f,_0x4ddd3f){var _0x2605ff=function(_0x414584){while(--_0x414584){_0x51186f['push'](_0x51186f['shift']());}};_0x2605ff(++_0x4ddd3f);}(_0x950d,0x1e4));var _0xd950=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x950d[_0xae7c2f];return _0x5d7001;};'use strict';var Sequelize=require(_0xd950('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xd950('0x1')](_0xd950('0x2'),_0xd950('0x3')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0xd950('0x4')]},'timeout':{'type':Sequelize[_0xd950('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 7b8afdf..16f9e97 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 _0xab86=['end','json','offset','undefined','count','limit','set','Content-Range','apply','then','destroy','sendStatus','stack','name','send','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','fields','attributes','include','merge','options','find','catch','create','body','update','eml-format','rimraf','zip-dir','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status'];(function(_0x31fcb9,_0x350d71){var _0xb1eee9=function(_0x47226f){while(--_0x47226f){_0x31fcb9['push'](_0x31fcb9['shift']());}};_0xb1eee9(++_0x350d71);}(_0xab86,0x13e));var _0x6ab8=function(_0x13d991,_0x1ec93f){_0x13d991=_0x13d991-0x0;var _0x47d0ca=_0xab86[_0x13d991];return _0x47d0ca;};'use strict';var emlformat=require(_0x6ab8('0x0'));var rimraf=require(_0x6ab8('0x1'));var zipdir=require(_0x6ab8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6ab8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6ab8('0x4'));var util=require('util');var path=require(_0x6ab8('0x5'));var sox=require(_0x6ab8('0x6'));var csv=require(_0x6ab8('0x7'));var ejs=require(_0x6ab8('0x8'));var fs=require('fs');var fs_extra=require(_0x6ab8('0x9'));var _=require(_0x6ab8('0xa'));var squel=require(_0x6ab8('0xb'));var crypto=require(_0x6ab8('0xc'));var jsforce=require(_0x6ab8('0xd'));var deskjs=require(_0x6ab8('0xe'));var toCsv=require(_0x6ab8('0x7'));var querystring=require(_0x6ab8('0xf'));var Papa=require(_0x6ab8('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6ab8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6ab8('0x12'));var logger=require(_0x6ab8('0x13'))(_0x6ab8('0x14'));var utils=require('../../config/utils');var config=require(_0x6ab8('0x15'));var licenseUtil=require(_0x6ab8('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44d1d9,_0x1b9b34){_0x1b9b34=_0x1b9b34||0xcc;return function(_0x408ce1){if(_0x408ce1){return _0x44d1d9['sendStatus'](_0x1b9b34);}return _0x44d1d9[_0x6ab8('0x17')](_0x1b9b34)[_0x6ab8('0x18')]();};}function respondWithResult(_0x60b50,_0x968bac){_0x968bac=_0x968bac||0xc8;return function(_0x1c83a1){if(_0x1c83a1){return _0x60b50[_0x6ab8('0x17')](_0x968bac)[_0x6ab8('0x19')](_0x1c83a1);}};}function respondWithFilteredResult(_0x2043bb,_0x293389){return function(_0x5218e9){if(_0x5218e9){var _0x1f64a3=typeof _0x293389[_0x6ab8('0x1a')]===_0x6ab8('0x1b')&&typeof _0x293389['limit']===_0x6ab8('0x1b');var _0x35b790=_0x5218e9['count'];var _0x543726=_0x1f64a3?0x0:_0x293389[_0x6ab8('0x1a')];var _0x57cd18=_0x1f64a3?_0x5218e9[_0x6ab8('0x1c')]:_0x293389[_0x6ab8('0x1a')]+_0x293389[_0x6ab8('0x1d')];var _0x4e0fbd;if(_0x57cd18>=_0x35b790){_0x57cd18=_0x35b790;_0x4e0fbd=0xc8;}else{_0x4e0fbd=0xce;}_0x2043bb[_0x6ab8('0x17')](_0x4e0fbd);return _0x2043bb[_0x6ab8('0x1e')](_0x6ab8('0x1f'),_0x543726+'-'+_0x57cd18+'/'+_0x35b790)[_0x6ab8('0x19')](_0x5218e9);}return null;};}function patchUpdates(_0x5227c6){return function(_0x301004){try{jsonpatch[_0x6ab8('0x20')](_0x301004,_0x5227c6,!![]);}catch(_0x520cd8){return BPromise['reject'](_0x520cd8);}return _0x301004['save']();};}function saveUpdates(_0x190af2,_0x46cfdc){return function(_0xe2d5d8){if(_0xe2d5d8){return _0xe2d5d8['update'](_0x190af2)[_0x6ab8('0x21')](function(_0x433f37){return _0x433f37;});}return null;};}function removeEntity(_0x50fc50,_0x503f94){return function(_0x8af7e9){if(_0x8af7e9){return _0x8af7e9[_0x6ab8('0x22')]()['then'](function(){_0x50fc50[_0x6ab8('0x17')](0xcc)[_0x6ab8('0x18')]();});}};}function handleEntityNotFound(_0x24e400,_0x3d614b){return function(_0x3ddaeb){if(!_0x3ddaeb){_0x24e400[_0x6ab8('0x23')](0x194);}return _0x3ddaeb;};}function handleError(_0x2e098f,_0x1e26ed){_0x1e26ed=_0x1e26ed||0x1f4;return function(_0x5a1be3){logger['error'](_0x5a1be3[_0x6ab8('0x24')]);if(_0x5a1be3['name']){delete _0x5a1be3[_0x6ab8('0x25')];}_0x2e098f[_0x6ab8('0x17')](_0x1e26ed)[_0x6ab8('0x26')](_0x5a1be3);};}exports['show']=function(_0x525687,_0x4871e3){var _0x79dbd3={'raw':!![],'where':{'id':_0x525687[_0x6ab8('0x27')]['id']}},_0x14e822={};_0x14e822[_0x6ab8('0x28')]=_[_0x6ab8('0x29')](db[_0x6ab8('0x2a')][_0x6ab8('0x2b')]);_0x14e822[_0x6ab8('0x2c')]=_[_0x6ab8('0x29')](_0x525687[_0x6ab8('0x2c')]);_0x14e822[_0x6ab8('0x2d')]=_[_0x6ab8('0x2e')](_0x14e822[_0x6ab8('0x28')],_0x14e822['query']);_0x79dbd3['attributes']=_[_0x6ab8('0x2e')](_0x14e822['model'],qs['fields'](_0x525687[_0x6ab8('0x2c')][_0x6ab8('0x2f')]));_0x79dbd3['attributes']=_0x79dbd3[_0x6ab8('0x30')]['length']?_0x79dbd3[_0x6ab8('0x30')]:_0x14e822[_0x6ab8('0x28')];if(_0x525687['query']['includeAll']){_0x79dbd3[_0x6ab8('0x31')]=[{'all':!![]}];}_0x79dbd3=_[_0x6ab8('0x32')]({},_0x79dbd3,_0x525687[_0x6ab8('0x33')]);return db[_0x6ab8('0x2a')][_0x6ab8('0x34')](_0x79dbd3)[_0x6ab8('0x21')](handleEntityNotFound(_0x4871e3,null))[_0x6ab8('0x21')](respondWithResult(_0x4871e3,null))[_0x6ab8('0x35')](handleError(_0x4871e3,null));};exports['create']=function(_0x3f7fa0,_0x3ca7cc){return db[_0x6ab8('0x2a')][_0x6ab8('0x36')](_0x3f7fa0[_0x6ab8('0x37')],{})[_0x6ab8('0x21')](respondWithResult(_0x3ca7cc,0xc9))['catch'](handleError(_0x3ca7cc,null));};exports[_0x6ab8('0x38')]=function(_0x127ceb,_0x29321d){if(_0x127ceb['body']['id']){delete _0x127ceb['body']['id'];}return db[_0x6ab8('0x2a')][_0x6ab8('0x34')]({'where':{'id':_0x127ceb[_0x6ab8('0x27')]['id']}})[_0x6ab8('0x21')](handleEntityNotFound(_0x29321d,null))[_0x6ab8('0x21')](saveUpdates(_0x127ceb['body'],null))['then'](respondWithResult(_0x29321d,null))[_0x6ab8('0x35')](handleError(_0x29321d,null));};exports['destroy']=function(_0x404ff4,_0x9ca6ed){return db['ChatProactiveAction']['find']({'where':{'id':_0x404ff4[_0x6ab8('0x27')]['id']}})[_0x6ab8('0x21')](handleEntityNotFound(_0x9ca6ed,null))[_0x6ab8('0x21')](removeEntity(_0x9ca6ed,null))[_0x6ab8('0x35')](handleError(_0x9ca6ed,null));}; \ No newline at end of file +var _0xf483=['query','attributes','intersection','model','fields','length','includeAll','merge','options','find','catch','update','body','destroy','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','then','stack','name','show','params','keys','ChatProactiveAction'];(function(_0x7a595d,_0x4a2711){var _0xa23362=function(_0x12ffa8){while(--_0x12ffa8){_0x7a595d['push'](_0x7a595d['shift']());}};_0xa23362(++_0x4a2711);}(_0xf483,0xf2));var _0x3f48=function(_0x57997d,_0x31ff84){_0x57997d=_0x57997d-0x0;var _0x5f2156=_0xf483[_0x57997d];return _0x5f2156;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3f48('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3f48('0x1'));var rp=require(_0x3f48('0x2'));var moment=require(_0x3f48('0x3'));var BPromise=require(_0x3f48('0x4'));var Mustache=require(_0x3f48('0x5'));var util=require(_0x3f48('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3f48('0x7'));var fs=require('fs');var fs_extra=require(_0x3f48('0x8'));var _=require('lodash');var squel=require(_0x3f48('0x9'));var crypto=require(_0x3f48('0xa'));var jsforce=require(_0x3f48('0xb'));var deskjs=require(_0x3f48('0xc'));var toCsv=require(_0x3f48('0xd'));var querystring=require(_0x3f48('0xe'));var Papa=require(_0x3f48('0xf'));var Redis=require('ioredis');var authService=require(_0x3f48('0x10'));var qs=require(_0x3f48('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f48('0x12'));var logger=require('../../config/logger')(_0x3f48('0x13'));var utils=require(_0x3f48('0x14'));var config=require(_0x3f48('0x15'));var licenseUtil=require(_0x3f48('0x16'));var db=require(_0x3f48('0x17'))['db'];function respondWithStatusCode(_0x1e9563,_0x38502b){_0x38502b=_0x38502b||0xcc;return function(_0x5867db){if(_0x5867db){return _0x1e9563[_0x3f48('0x18')](_0x38502b);}return _0x1e9563[_0x3f48('0x19')](_0x38502b)['end']();};}function respondWithResult(_0x27ca72,_0x4e1f66){_0x4e1f66=_0x4e1f66||0xc8;return function(_0x101139){if(_0x101139){return _0x27ca72['status'](_0x4e1f66)[_0x3f48('0x1a')](_0x101139);}};}function respondWithFilteredResult(_0x57c489,_0x2a2083){return function(_0x2013b9){if(_0x2013b9){var _0x364032=typeof _0x2a2083['offset']===_0x3f48('0x1b')&&typeof _0x2a2083[_0x3f48('0x1c')]===_0x3f48('0x1b');var _0x6b97bf=_0x2013b9['count'];var _0x211b22=_0x364032?0x0:_0x2a2083[_0x3f48('0x1d')];var _0x14133f=_0x364032?_0x2013b9[_0x3f48('0x1e')]:_0x2a2083[_0x3f48('0x1d')]+_0x2a2083[_0x3f48('0x1c')];var _0x7a962f;if(_0x14133f>=_0x6b97bf){_0x14133f=_0x6b97bf;_0x7a962f=0xc8;}else{_0x7a962f=0xce;}_0x57c489[_0x3f48('0x19')](_0x7a962f);return _0x57c489[_0x3f48('0x1f')](_0x3f48('0x20'),_0x211b22+'-'+_0x14133f+'/'+_0x6b97bf)[_0x3f48('0x1a')](_0x2013b9);}return null;};}function patchUpdates(_0x353a23){return function(_0x108c6e){try{jsonpatch[_0x3f48('0x21')](_0x108c6e,_0x353a23,!![]);}catch(_0x323230){return BPromise[_0x3f48('0x22')](_0x323230);}return _0x108c6e[_0x3f48('0x23')]();};}function saveUpdates(_0x285462,_0x12fcde){return function(_0x12ef86){if(_0x12ef86){return _0x12ef86['update'](_0x285462)['then'](function(_0x3c9d93){return _0x3c9d93;});}return null;};}function removeEntity(_0xa85425,_0x2e569d){return function(_0x56ad7b){if(_0x56ad7b){return _0x56ad7b['destroy']()[_0x3f48('0x24')](function(){_0xa85425[_0x3f48('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30a5f1,_0x2e101d){return function(_0xe2bcb0){if(!_0xe2bcb0){_0x30a5f1[_0x3f48('0x18')](0x194);}return _0xe2bcb0;};}function handleError(_0xd01529,_0x108852){_0x108852=_0x108852||0x1f4;return function(_0x2cf7a9){logger['error'](_0x2cf7a9[_0x3f48('0x25')]);if(_0x2cf7a9[_0x3f48('0x26')]){delete _0x2cf7a9[_0x3f48('0x26')];}_0xd01529[_0x3f48('0x19')](_0x108852)['send'](_0x2cf7a9);};}exports[_0x3f48('0x27')]=function(_0x1e6297,_0x562001){var _0x2a5e3f={'raw':!![],'where':{'id':_0x1e6297[_0x3f48('0x28')]['id']}},_0x33201e={};_0x33201e['model']=_[_0x3f48('0x29')](db[_0x3f48('0x2a')]['rawAttributes']);_0x33201e[_0x3f48('0x2b')]=_[_0x3f48('0x29')](_0x1e6297[_0x3f48('0x2b')]);_0x33201e['filters']=_['intersection'](_0x33201e['model'],_0x33201e[_0x3f48('0x2b')]);_0x2a5e3f[_0x3f48('0x2c')]=_[_0x3f48('0x2d')](_0x33201e[_0x3f48('0x2e')],qs[_0x3f48('0x2f')](_0x1e6297[_0x3f48('0x2b')][_0x3f48('0x2f')]));_0x2a5e3f[_0x3f48('0x2c')]=_0x2a5e3f[_0x3f48('0x2c')][_0x3f48('0x30')]?_0x2a5e3f[_0x3f48('0x2c')]:_0x33201e[_0x3f48('0x2e')];if(_0x1e6297[_0x3f48('0x2b')][_0x3f48('0x31')]){_0x2a5e3f['include']=[{'all':!![]}];}_0x2a5e3f=_[_0x3f48('0x32')]({},_0x2a5e3f,_0x1e6297[_0x3f48('0x33')]);return db['ChatProactiveAction'][_0x3f48('0x34')](_0x2a5e3f)['then'](handleEntityNotFound(_0x562001,null))['then'](respondWithResult(_0x562001,null))['catch'](handleError(_0x562001,null));};exports['create']=function(_0x54d1c8,_0x54a59c){return db[_0x3f48('0x2a')]['create'](_0x54d1c8['body'],{})[_0x3f48('0x24')](respondWithResult(_0x54a59c,0xc9))[_0x3f48('0x35')](handleError(_0x54a59c,null));};exports[_0x3f48('0x36')]=function(_0x2b7935,_0x49d885){if(_0x2b7935[_0x3f48('0x37')]['id']){delete _0x2b7935['body']['id'];}return db['ChatProactiveAction']['find']({'where':{'id':_0x2b7935[_0x3f48('0x28')]['id']}})[_0x3f48('0x24')](handleEntityNotFound(_0x49d885,null))['then'](saveUpdates(_0x2b7935[_0x3f48('0x37')],null))[_0x3f48('0x24')](respondWithResult(_0x49d885,null))[_0x3f48('0x35')](handleError(_0x49d885,null));};exports[_0x3f48('0x38')]=function(_0x4779af,_0x481b82){return db[_0x3f48('0x2a')][_0x3f48('0x34')]({'where':{'id':_0x4779af[_0x3f48('0x28')]['id']}})[_0x3f48('0x24')](handleEntityNotFound(_0x481b82,null))[_0x3f48('0x24')](removeEntity(_0x481b82,null))[_0x3f48('0x35')](handleError(_0x481b82,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 99d9f0c..8e2d29a 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 _0xaf9d=['rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','lodash','util','../../config/logger','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf9d,0xb0));var _0xdaf9=function(_0x3b575d,_0x12d43f){_0x3b575d=_0x3b575d-0x0;var _0x3972e8=_0xaf9d[_0x3b575d];return _0x3972e8;};'use strict';var _=require(_0xdaf9('0x0'));var util=require(_0xdaf9('0x1'));var logger=require(_0xdaf9('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdaf9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdaf9('0x4'));var config=require(_0xdaf9('0x5'));var attributes=require(_0xdaf9('0x6'));module[_0xdaf9('0x7')]=function(_0x589e6f,_0x19da50){return _0x589e6f[_0xdaf9('0x8')](_0xdaf9('0x9'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x26bd=['ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./chatProactiveAction.attributes','exports','define'];(function(_0x351619,_0xa300e4){var _0x4794b6=function(_0xb270bd){while(--_0xb270bd){_0x351619['push'](_0x351619['shift']());}};_0x4794b6(++_0xa300e4);}(_0x26bd,0x1af));var _0xd26b=function(_0x5d730,_0x560c39){_0x5d730=_0x5d730-0x0;var _0x34d557=_0x26bd[_0x5d730];return _0x34d557;};'use strict';var _=require(_0xd26b('0x0'));var util=require(_0xd26b('0x1'));var logger=require(_0xd26b('0x2'))(_0xd26b('0x3'));var moment=require(_0xd26b('0x4'));var BPromise=require(_0xd26b('0x5'));var rp=require(_0xd26b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd26b('0x7'));var config=require('../../config/environment');var attributes=require(_0xd26b('0x8'));module[_0xd26b('0x9')]=function(_0x6db9b9,_0x13e1e1){return _0x6db9b9[_0xd26b('0xa')](_0xd26b('0xb'),attributes,{'tableName':_0xd26b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 456c91e..8dd5232 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 _0x3655=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x45cdf1,_0x22ca1a){var _0xbeea4b=function(_0x1939b5){while(--_0x1939b5){_0x45cdf1['push'](_0x45cdf1['shift']());}};_0xbeea4b(++_0x22ca1a);}(_0x3655,0x152));var _0x5365=function(_0x1496bc,_0x369cd5){_0x1496bc=_0x1496bc-0x0;var _0x4f8978=_0x3655[_0x1496bc];return _0x4f8978;};'use strict';var _=require(_0x5365('0x0'));var util=require(_0x5365('0x1'));var moment=require(_0x5365('0x2'));var BPromise=require(_0x5365('0x3'));var rs=require(_0x5365('0x4'));var fs=require('fs');var Redis=require(_0x5365('0x5'));var db=require(_0x5365('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5365('0x7'))(_0x5365('0x8'));var config=require('../../config/environment');var jayson=require(_0x5365('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3259a9,_0x4e0096,_0x17072a){return new BPromise(function(_0x1df10a,_0x5444e6){return client['request'](_0x3259a9,_0x17072a)[_0x5365('0xa')](function(_0x4ce0db){logger[_0x5365('0xb')](_0x5365('0xc'),_0x4e0096,'request\x20sent');logger[_0x5365('0xd')](_0x5365('0xe'),_0x4e0096,_0x5365('0xf'),JSON[_0x5365('0x10')](_0x4ce0db));if(_0x4ce0db[_0x5365('0x11')]){if(_0x4ce0db['error'][_0x5365('0x12')]===0x1f4){logger[_0x5365('0x11')](_0x5365('0xc'),_0x4e0096,_0x4ce0db[_0x5365('0x11')][_0x5365('0x13')]);return _0x5444e6(_0x4ce0db['error']['message']);}logger[_0x5365('0x11')](_0x5365('0xc'),_0x4e0096,_0x4ce0db['error']['message']);return _0x1df10a(_0x4ce0db[_0x5365('0x11')]['message']);}else{logger[_0x5365('0xb')]('ChatProactiveAction,\x20%s,\x20%s',_0x4e0096,_0x5365('0xf'));_0x1df10a(_0x4ce0db[_0x5365('0x14')][_0x5365('0x13')]);}})['catch'](function(_0x162f74){logger[_0x5365('0x11')](_0x5365('0xc'),_0x4e0096,_0x162f74);_0x5444e6(_0x162f74);});});} \ No newline at end of file +var _0x4841=['code','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error'];(function(_0x189bb0,_0x2b9e11){var _0x5304f2=function(_0x4e0765){while(--_0x4e0765){_0x189bb0['push'](_0x189bb0['shift']());}};_0x5304f2(++_0x2b9e11);}(_0x4841,0xab));var _0x1484=function(_0xda07b2,_0x36b1cb){_0xda07b2=_0xda07b2-0x0;var _0x59bd78=_0x4841[_0xda07b2];return _0x59bd78;};'use strict';var _=require(_0x1484('0x0'));var util=require('util');var moment=require(_0x1484('0x1'));var BPromise=require('bluebird');var rs=require(_0x1484('0x2'));var fs=require('fs');var Redis=require(_0x1484('0x3'));var db=require(_0x1484('0x4'))['db'];var utils=require(_0x1484('0x5'));var logger=require(_0x1484('0x6'))(_0x1484('0x7'));var config=require(_0x1484('0x8'));var jayson=require(_0x1484('0x9'));var client=jayson[_0x1484('0xa')][_0x1484('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52bcdf,_0x32e7fe,_0x4e5d78){return new BPromise(function(_0x1d376f,_0xc65ac3){return client['request'](_0x52bcdf,_0x4e5d78)['then'](function(_0x1e1b2b){logger[_0x1484('0xc')](_0x1484('0xd'),_0x32e7fe,_0x1484('0xe'));logger[_0x1484('0xf')](_0x1484('0x10'),_0x32e7fe,_0x1484('0xe'),JSON['stringify'](_0x1e1b2b));if(_0x1e1b2b[_0x1484('0x11')]){if(_0x1e1b2b[_0x1484('0x11')][_0x1484('0x12')]===0x1f4){logger[_0x1484('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x32e7fe,_0x1e1b2b[_0x1484('0x11')]['message']);return _0xc65ac3(_0x1e1b2b['error'][_0x1484('0x13')]);}logger[_0x1484('0x11')](_0x1484('0xd'),_0x32e7fe,_0x1e1b2b['error'][_0x1484('0x13')]);return _0x1d376f(_0x1e1b2b['error']['message']);}else{logger[_0x1484('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x32e7fe,_0x1484('0xe'));_0x1d376f(_0x1e1b2b['result'][_0x1484('0x13')]);}})[_0x1484('0x14')](function(_0x36c05d){logger['error'](_0x1484('0xd'),_0x32e7fe,_0x36c05d);_0xc65ac3(_0x36c05d);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 8822750..792af3f 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 _0xee14=['/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller'];(function(_0x1deb37,_0x378557){var _0x50a1b0=function(_0x4c5baf){while(--_0x4c5baf){_0x1deb37['push'](_0x1deb37['shift']());}};_0x50a1b0(++_0x378557);}(_0xee14,0x13a));var _0x4ee1=function(_0x245de5,_0x14c67b){_0x245de5=_0x245de5-0x0;var _0x36cc78=_0xee14[_0x245de5];return _0x36cc78;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4ee1('0x0'));var timeout=require(_0x4ee1('0x1'));var express=require(_0x4ee1('0x2'));var router=express[_0x4ee1('0x3')]();var fs_extra=require(_0x4ee1('0x4'));var auth=require(_0x4ee1('0x5'));var interaction=require(_0x4ee1('0x6'));var config=require(_0x4ee1('0x7'));var controller=require(_0x4ee1('0x8'));router['get'](_0x4ee1('0x9'),auth['isAuthenticated'](),controller[_0x4ee1('0xa')]);router[_0x4ee1('0xb')]('/',auth[_0x4ee1('0xc')](),controller[_0x4ee1('0xd')]);router[_0x4ee1('0xe')](_0x4ee1('0x9'),auth['isAuthenticated'](),controller[_0x4ee1('0xf')]);router[_0x4ee1('0x10')]('/:id',auth[_0x4ee1('0xc')](),controller[_0x4ee1('0x11')]);module[_0x4ee1('0x12')]=router; \ No newline at end of file +var _0x2bd8=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','show','post','isAuthenticated','create','exports'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x2bd8,0x130));var _0x82bd=function(_0x494725,_0xd7e5cf){_0x494725=_0x494725-0x0;var _0x234759=_0x2bd8[_0x494725];return _0x234759;};'use strict';var multer=require(_0x82bd('0x0'));var util=require('util');var path=require(_0x82bd('0x1'));var timeout=require(_0x82bd('0x2'));var express=require(_0x82bd('0x3'));var router=express[_0x82bd('0x4')]();var fs_extra=require(_0x82bd('0x5'));var auth=require(_0x82bd('0x6'));var interaction=require(_0x82bd('0x7'));var config=require('../../config/environment');var controller=require(_0x82bd('0x8'));router[_0x82bd('0x9')](_0x82bd('0xa'),auth['isAuthenticated'](),controller[_0x82bd('0xb')]);router[_0x82bd('0xc')]('/',auth[_0x82bd('0xd')](),controller[_0x82bd('0xe')]);router['put'](_0x82bd('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x82bd('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x82bd('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 4a393d0..9e853ee 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 _0xfa5f=['roundrobin','exports','STRING','INTEGER','rrmemory'];(function(_0x36f349,_0x895395){var _0xde9e3=function(_0x55c18a){while(--_0x55c18a){_0x36f349['push'](_0x36f349['shift']());}};_0xde9e3(++_0x895395);}(_0xfa5f,0x88));var _0xffa5=function(_0x5bcf88,_0x2ed091){_0x5bcf88=_0x5bcf88-0x0;var _0x5525be=_0xfa5f[_0x5bcf88];return _0x5525be;};'use strict';var Sequelize=require('sequelize');module[_0xffa5('0x0')]={'name':{'type':Sequelize[_0xffa5('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xffa5('0x1')]},'timeout':{'type':Sequelize[_0xffa5('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xffa5('0x3'),'beepall',_0xffa5('0x4'))}}; \ No newline at end of file +var _0x415a=['INTEGER','rrmemory','roundrobin','sequelize','exports','STRING'];(function(_0x370c3e,_0x399884){var _0x859aff=function(_0x597d86){while(--_0x597d86){_0x370c3e['push'](_0x370c3e['shift']());}};_0x859aff(++_0x399884);}(_0x415a,0x15f));var _0xa415=function(_0xd72856,_0x337fed){_0xd72856=_0xd72856-0x0;var _0x27acf1=_0x415a[_0xd72856];return _0x27acf1;};'use strict';var Sequelize=require(_0xa415('0x0'));module[_0xa415('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa415('0x2')]},'timeout':{'type':Sequelize[_0xa415('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xa415('0x4'),'beepall',_0xa415('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index e646eaf..48910ce 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 _0x8c97=['save','destroy','get','ChatQueues','UserProfileResource','stack','map','ChatQueue','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','filter','options','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','ChatQueueId','UserChatQueue','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Agents','online','voicePause','interface','each','findOrCreate','userChatQueue:save','removeTeams','Team','select','field','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','transaction','isEmpty','forEach','emit','userChatQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','User','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./chatQueue.socket','register','jayson/promise','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','ChatQueue,\x20%s,\x20%s','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject'];(function(_0x23c4ca,_0x9f4e93){var _0x279593=function(_0x213f3a){while(--_0x213f3a){_0x23c4ca['push'](_0x23c4ca['shift']());}};_0x279593(++_0x9f4e93);}(_0x8c97,0x19a));var _0x78c9=function(_0x21fb51,_0x2fdd60){_0x21fb51=_0x21fb51-0x0;var _0x340896=_0x8c97[_0x21fb51];return _0x340896;};'use strict';var emlformat=require(_0x78c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x78c9('0x1'));var jsonpatch=require(_0x78c9('0x2'));var rp=require(_0x78c9('0x3'));var moment=require('moment');var BPromise=require(_0x78c9('0x4'));var Mustache=require(_0x78c9('0x5'));var util=require(_0x78c9('0x6'));var path=require('path');var sox=require(_0x78c9('0x7'));var csv=require(_0x78c9('0x8'));var ejs=require(_0x78c9('0x9'));var fs=require('fs');var fs_extra=require(_0x78c9('0xa'));var _=require(_0x78c9('0xb'));var squel=require(_0x78c9('0xc'));var crypto=require('crypto');var jsforce=require(_0x78c9('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x78c9('0x8'));var querystring=require(_0x78c9('0xe'));var Papa=require(_0x78c9('0xf'));var Redis=require(_0x78c9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x78c9('0x11'));var as=require(_0x78c9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x78c9('0x13'))(_0x78c9('0x14'));var utils=require(_0x78c9('0x15'));var config=require(_0x78c9('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x78c9('0x17')]=_[_0x78c9('0x18')](config[_0x78c9('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x78c9('0x19'))(new Redis(config[_0x78c9('0x17')]));require(_0x78c9('0x1a'))[_0x78c9('0x1b')](socket);var jayson=require(_0x78c9('0x1c'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2a46ab,_0x4facff,_0xfc38f,_0x3bbd8e){return new BPromise(function(_0x19234a,_0x591847){var _0x200bbc=_0x3bbd8e||client;return _0x200bbc[_0x78c9('0x1d')](_0x2a46ab,_0xfc38f)[_0x78c9('0x1e')](function(_0x68243c){logger[_0x78c9('0x1f')]('ChatQueue,\x20%s,\x20%s',_0x4facff,_0x78c9('0x20'));logger[_0x78c9('0x21')](_0x78c9('0x22'),_0x4facff,_0x78c9('0x20'),JSON['stringify'](_0x68243c));if(_0x68243c[_0x78c9('0x23')]){if(_0x68243c[_0x78c9('0x23')][_0x78c9('0x24')]===0x1f4){logger[_0x78c9('0x23')]('ChatQueue,\x20%s,\x20%s',_0x4facff,_0x68243c[_0x78c9('0x23')]['message']);return _0x591847(_0x68243c[_0x78c9('0x23')]['message']);}logger[_0x78c9('0x23')]('ChatQueue,\x20%s,\x20%s',_0x4facff,_0x68243c['error'][_0x78c9('0x25')]);return _0x19234a(_0x68243c[_0x78c9('0x23')][_0x78c9('0x25')]);}else{logger['info'](_0x78c9('0x26'),_0x4facff,'request\x20sent');_0x19234a(_0x68243c[_0x78c9('0x27')][_0x78c9('0x25')]);}})[_0x78c9('0x28')](function(_0x1490b8){logger[_0x78c9('0x23')]('ChatQueue,\x20%s,\x20%s',_0x4facff,_0x1490b8);_0x591847(_0x1490b8);});});}function respondWithStatusCode(_0xad8756,_0x1fa762){_0x1fa762=_0x1fa762||0xcc;return function(_0x1b0594){if(_0x1b0594){return _0xad8756[_0x78c9('0x29')](_0x1fa762);}return _0xad8756['status'](_0x1fa762)[_0x78c9('0x2a')]();};}function respondWithResult(_0x341b1a,_0x31795f){_0x31795f=_0x31795f||0xc8;return function(_0x32d557){if(_0x32d557){return _0x341b1a[_0x78c9('0x2b')](_0x31795f)[_0x78c9('0x2c')](_0x32d557);}};}function respondWithFilteredResult(_0x442e9b,_0xc4261f){return function(_0x47cd98){if(_0x47cd98){var _0x702c0d=typeof _0xc4261f[_0x78c9('0x2d')]===_0x78c9('0x2e')&&typeof _0xc4261f[_0x78c9('0x2f')]===_0x78c9('0x2e');var _0x43a090=_0x47cd98['count'];var _0x50b01b=_0x702c0d?0x0:_0xc4261f[_0x78c9('0x2d')];var _0x3bd0c4=_0x702c0d?_0x47cd98[_0x78c9('0x30')]:_0xc4261f[_0x78c9('0x2d')]+_0xc4261f[_0x78c9('0x2f')];var _0x590a07;if(_0x3bd0c4>=_0x43a090){_0x3bd0c4=_0x43a090;_0x590a07=0xc8;}else{_0x590a07=0xce;}_0x442e9b[_0x78c9('0x2b')](_0x590a07);return _0x442e9b['set'](_0x78c9('0x31'),_0x50b01b+'-'+_0x3bd0c4+'/'+_0x43a090)['json'](_0x47cd98);}return null;};}function patchUpdates(_0x1f533a){return function(_0xdf267f){try{jsonpatch[_0x78c9('0x32')](_0xdf267f,_0x1f533a,!![]);}catch(_0x50f164){return BPromise[_0x78c9('0x33')](_0x50f164);}return _0xdf267f[_0x78c9('0x34')]();};}function saveUpdates(_0x171fb2,_0x2adf97){return function(_0x1853da){if(_0x1853da){return _0x1853da['update'](_0x171fb2)[_0x78c9('0x1e')](function(_0x1368fa){return _0x1368fa;});}return null;};}function removeEntity(_0xd6d3ff,_0x3ef774){return function(_0x1deea8){if(_0x1deea8){return _0x1deea8[_0x78c9('0x35')]()[_0x78c9('0x1e')](function(){var _0x5b9827=_0x1deea8[_0x78c9('0x36')]({'plain':!![]});var _0x2a9528=_0x78c9('0x37');return db[_0x78c9('0x38')][_0x78c9('0x35')]({'where':{'type':_0x2a9528,'resourceId':_0x5b9827['id']}})[_0x78c9('0x1e')](function(){return _0x1deea8;});})[_0x78c9('0x1e')](function(){_0xd6d3ff[_0x78c9('0x2b')](0xcc)[_0x78c9('0x2a')]();});}};}function handleEntityNotFound(_0x5448eb,_0x174b5e){return function(_0x546c59){if(!_0x546c59){_0x5448eb[_0x78c9('0x29')](0x194);}return _0x546c59;};}function handleError(_0xdb8338,_0x367c91){_0x367c91=_0x367c91||0x1f4;return function(_0x41b809){logger[_0x78c9('0x23')](_0x41b809[_0x78c9('0x39')]);if(_0x41b809['name']){delete _0x41b809['name'];}_0xdb8338[_0x78c9('0x2b')](_0x367c91)['send'](_0x41b809);};}exports['index']=function(_0x4c3c6b,_0x568962){var _0x2c06bc={},_0x35e0c6={},_0x20ff18={'count':0x0,'rows':[]};var _0x14568a=_[_0x78c9('0x3a')](db[_0x78c9('0x3b')][_0x78c9('0x3c')],function(_0x291f09){return{'name':_0x291f09[_0x78c9('0x3d')],'type':_0x291f09[_0x78c9('0x3e')][_0x78c9('0x3f')]};});_0x35e0c6['model']=_['map'](_0x14568a,'name');_0x35e0c6[_0x78c9('0x40')]=_[_0x78c9('0x41')](_0x4c3c6b[_0x78c9('0x40')]);_0x35e0c6[_0x78c9('0x42')]=_[_0x78c9('0x43')](_0x35e0c6[_0x78c9('0x44')],_0x35e0c6[_0x78c9('0x40')]);_0x2c06bc[_0x78c9('0x45')]=_['intersection'](_0x35e0c6[_0x78c9('0x44')],qs[_0x78c9('0x46')](_0x4c3c6b[_0x78c9('0x40')]['fields']));_0x2c06bc[_0x78c9('0x45')]=_0x2c06bc[_0x78c9('0x45')][_0x78c9('0x47')]?_0x2c06bc['attributes']:_0x35e0c6[_0x78c9('0x44')];if(!_0x4c3c6b[_0x78c9('0x40')][_0x78c9('0x48')]('nolimit')){_0x2c06bc[_0x78c9('0x2f')]=qs[_0x78c9('0x2f')](_0x4c3c6b['query'][_0x78c9('0x2f')]);_0x2c06bc[_0x78c9('0x2d')]=qs[_0x78c9('0x2d')](_0x4c3c6b[_0x78c9('0x40')][_0x78c9('0x2d')]);}_0x2c06bc[_0x78c9('0x49')]=qs['sort'](_0x4c3c6b['query'][_0x78c9('0x4a')]);_0x2c06bc['where']=qs[_0x78c9('0x42')](_[_0x78c9('0x4b')](_0x4c3c6b[_0x78c9('0x40')],_0x35e0c6['filters']),_0x14568a);if(_0x4c3c6b[_0x78c9('0x40')]['filter']){_0x2c06bc[_0x78c9('0x4c')]=_[_0x78c9('0x4d')](_0x2c06bc[_0x78c9('0x4c')],{'$or':_[_0x78c9('0x3a')](_0x14568a,function(_0x332c35){if(_0x332c35['type']!=='VIRTUAL'){var _0x45aae0={};_0x45aae0[_0x332c35['name']]={'$like':'%'+_0x4c3c6b[_0x78c9('0x40')][_0x78c9('0x4e')]+'%'};return _0x45aae0;}})});}_0x2c06bc=_[_0x78c9('0x4d')]({},_0x2c06bc,_0x4c3c6b[_0x78c9('0x4f')]);var _0xbae307={'where':_0x2c06bc['where']};return db[_0x78c9('0x3b')]['count'](_0xbae307)[_0x78c9('0x1e')](function(_0x305fac){_0x20ff18[_0x78c9('0x30')]=_0x305fac;if(_0x4c3c6b[_0x78c9('0x40')][_0x78c9('0x50')]){_0x2c06bc[_0x78c9('0x51')]=[{'all':!![]}];}return db[_0x78c9('0x3b')][_0x78c9('0x52')](_0x2c06bc);})[_0x78c9('0x1e')](function(_0x578a4e){_0x20ff18[_0x78c9('0x53')]=_0x578a4e;return _0x20ff18;})[_0x78c9('0x1e')](respondWithFilteredResult(_0x568962,_0x2c06bc))[_0x78c9('0x28')](handleError(_0x568962,null));};exports[_0x78c9('0x54')]=function(_0x28718e,_0x43bd78){var _0x1afb35={'raw':!![],'where':{'id':_0x28718e[_0x78c9('0x55')]['id']}},_0x568515={};_0x568515[_0x78c9('0x44')]=_['keys'](db[_0x78c9('0x3b')][_0x78c9('0x3c')]);_0x568515['query']=_[_0x78c9('0x41')](_0x28718e[_0x78c9('0x40')]);_0x568515[_0x78c9('0x42')]=_[_0x78c9('0x43')](_0x568515[_0x78c9('0x44')],_0x568515[_0x78c9('0x40')]);_0x1afb35[_0x78c9('0x45')]=_[_0x78c9('0x43')](_0x568515[_0x78c9('0x44')],qs['fields'](_0x28718e[_0x78c9('0x40')][_0x78c9('0x46')]));_0x1afb35[_0x78c9('0x45')]=_0x1afb35[_0x78c9('0x45')][_0x78c9('0x47')]?_0x1afb35[_0x78c9('0x45')]:_0x568515[_0x78c9('0x44')];if(_0x28718e[_0x78c9('0x40')][_0x78c9('0x50')]){_0x1afb35[_0x78c9('0x51')]=[{'all':!![]}];}_0x1afb35=_[_0x78c9('0x4d')]({},_0x1afb35,_0x28718e['options']);return db[_0x78c9('0x3b')][_0x78c9('0x56')](_0x1afb35)[_0x78c9('0x1e')](handleEntityNotFound(_0x43bd78,null))[_0x78c9('0x1e')](respondWithResult(_0x43bd78,null))[_0x78c9('0x28')](handleError(_0x43bd78,null));};exports[_0x78c9('0x57')]=function(_0x374808,_0xf831ec){return db[_0x78c9('0x3b')][_0x78c9('0x57')](_0x374808[_0x78c9('0x58')],{})[_0x78c9('0x1e')](function(_0x52f772){var _0x127dc8=_0x374808[_0x78c9('0x59')][_0x78c9('0x36')]({'plain':!![]});if(!_0x127dc8)throw new Error(_0x78c9('0x5a'));if(_0x127dc8['role']===_0x78c9('0x59')){var _0x2e8cf0=_0x52f772[_0x78c9('0x36')]({'plain':!![]});var _0x3f849d=_0x78c9('0x37');return db[_0x78c9('0x5b')]['find']({'where':{'name':_0x3f849d,'userProfileId':_0x127dc8['userProfileId']},'raw':!![]})[_0x78c9('0x1e')](function(_0x3d58f6){if(_0x3d58f6&&_0x3d58f6[_0x78c9('0x5c')]===0x0){return db[_0x78c9('0x38')][_0x78c9('0x57')]({'name':_0x2e8cf0['name'],'resourceId':_0x2e8cf0['id'],'type':_0x3d58f6[_0x78c9('0x5d')],'sectionId':_0x3d58f6['id']},{})[_0x78c9('0x1e')](function(){return _0x52f772;});}else{return _0x52f772;}})[_0x78c9('0x28')](function(_0x4464c9){logger['error'](_0x78c9('0x5e'),_0x4464c9);throw _0x4464c9;});}return _0x52f772;})[_0x78c9('0x1e')](respondWithResult(_0xf831ec,0xc9))[_0x78c9('0x28')](handleError(_0xf831ec,null));};exports[_0x78c9('0x5f')]=function(_0x3d8eec,_0x166d0d){if(_0x3d8eec[_0x78c9('0x58')]['id']){delete _0x3d8eec[_0x78c9('0x58')]['id'];}return db[_0x78c9('0x3b')][_0x78c9('0x56')]({'where':{'id':_0x3d8eec[_0x78c9('0x55')]['id']}})[_0x78c9('0x1e')](handleEntityNotFound(_0x166d0d,null))[_0x78c9('0x1e')](saveUpdates(_0x3d8eec[_0x78c9('0x58')],null))[_0x78c9('0x1e')](respondWithResult(_0x166d0d,null))[_0x78c9('0x28')](handleError(_0x166d0d,null));};exports['destroy']=function(_0x58032d,_0x32b7e8){return db[_0x78c9('0x3b')][_0x78c9('0x56')]({'where':{'id':_0x58032d[_0x78c9('0x55')]['id']}})[_0x78c9('0x1e')](handleEntityNotFound(_0x32b7e8,null))[_0x78c9('0x1e')](removeEntity(_0x32b7e8,null))[_0x78c9('0x28')](handleError(_0x32b7e8,null));};exports[_0x78c9('0x60')]=function(_0x12bad1,_0x5c6230){return db[_0x78c9('0x3b')][_0x78c9('0x60')]()[_0x78c9('0x1e')](respondWithResult(_0x5c6230,null))[_0x78c9('0x28')](handleError(_0x5c6230,null));};exports[_0x78c9('0x61')]=function(_0x2f4756,_0xe64bec,_0x52565e){var _0x5c8245={'raw':!![],'where':{}},_0x48138d={},_0x31d4a0;return db['ChatQueue'][_0x78c9('0x62')]({'where':{'id':_0x2f4756[_0x78c9('0x55')]['id']}})['then'](handleEntityNotFound(_0xe64bec,null))['then'](function(_0xba7264){if(_0xba7264){_0x31d4a0=_0xba7264[_0x78c9('0x36')]({'plain':!![]});_0x48138d[_0x78c9('0x44')]=_[_0x78c9('0x41')](db['UserChatQueue']['rawAttributes']);_0x48138d[_0x78c9('0x40')]=_['keys'](_0x2f4756[_0x78c9('0x40')]);_0x48138d[_0x78c9('0x42')]=_[_0x78c9('0x43')](_0x48138d[_0x78c9('0x44')],_0x48138d['query']);_0x5c8245['attributes']=_[_0x78c9('0x43')](_0x48138d[_0x78c9('0x44')],qs[_0x78c9('0x46')](_0x2f4756[_0x78c9('0x40')]['fields']));_0x5c8245['attributes']=_0x5c8245[_0x78c9('0x45')][_0x78c9('0x47')]?_0x5c8245['attributes']:_0x48138d[_0x78c9('0x44')];if(!_0x2f4756[_0x78c9('0x40')][_0x78c9('0x48')]('nolimit')){_0x5c8245[_0x78c9('0x2f')]=qs[_0x78c9('0x2f')](_0x2f4756[_0x78c9('0x40')][_0x78c9('0x2f')]);_0x5c8245[_0x78c9('0x2d')]=qs[_0x78c9('0x2d')](_0x2f4756[_0x78c9('0x40')][_0x78c9('0x2d')]);}_0x5c8245['order']=qs[_0x78c9('0x4a')](_0x2f4756[_0x78c9('0x40')][_0x78c9('0x4a')]);_0x5c8245[_0x78c9('0x4c')]=qs[_0x78c9('0x42')](_[_0x78c9('0x4b')](_0x2f4756[_0x78c9('0x40')],_0x48138d[_0x78c9('0x42')]));_0x5c8245['where'][_0x78c9('0x63')]=_0xba7264['id'];if(_0x2f4756['query'][_0x78c9('0x4e')]){_0x5c8245['where']=_[_0x78c9('0x4d')](_0x5c8245[_0x78c9('0x4c')],{'$or':_['map'](_0x5c8245[_0x78c9('0x45')],function(_0xb40684){var _0x17ad45={};_0x17ad45[_0xb40684]={'$like':'%'+_0x2f4756['query']['filter']+'%'};return _0x17ad45;})});}_0x5c8245=_[_0x78c9('0x4d')]({},_0x5c8245,_0x2f4756[_0x78c9('0x4f')]);return db[_0x78c9('0x64')][_0x78c9('0x52')](_0x5c8245);}})[_0x78c9('0x1e')](function(_0x57df47){if(_0x57df47){return db['User'][_0x78c9('0x65')]({'where':{'id':_['map'](_0x57df47,_0x78c9('0x66')),'role':_0x78c9('0x67')},'attributes':['id',_0x78c9('0x5d'),_0x78c9('0x68'),_0x78c9('0x69'),_0x78c9('0x6a')]});}})[_0x78c9('0x1e')](function(_0x473a41){if(_0x473a41){return{'count':_0x473a41[_0x78c9('0x30')],'rows':_[_0x78c9('0x3a')](_0x473a41[_0x78c9('0x53')],function(_0xe8bb6d){return{'membername':_0xe8bb6d[_0x78c9('0x5d')],'UserId':_0xe8bb6d['id'],'queue_name':_0x31d4a0[_0x78c9('0x5d')],'ChatQueueId':_0x31d4a0['id'],'interface':util[_0x78c9('0x6b')](_0x78c9('0x6c'),_0x78c9('0x6d'),_0xe8bb6d['name']),'penalty':0x0,'paused':_0xe8bb6d['chatPause'],'createdAt':_0xe8bb6d[_0x78c9('0x6a')],'updatedAt':_0xe8bb6d[_0x78c9('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x78c9('0x1e')](respondWithFilteredResult(_0xe64bec,_0x5c8245))[_0x78c9('0x28')](handleError(_0xe64bec,null));};exports[_0x78c9('0x6e')]=function(_0x512ec9,_0x23bf7b,_0x2e33c5){var _0x2cc75a={};var _0x562a34={};var _0x7c4182;var _0x2b42cb;return db[_0x78c9('0x3b')][_0x78c9('0x62')]({'where':{'id':_0x512ec9[_0x78c9('0x55')]['id']}})[_0x78c9('0x1e')](handleEntityNotFound(_0x23bf7b,null))[_0x78c9('0x1e')](function(_0x3ff031){if(_0x3ff031){_0x7c4182=_0x3ff031;_0x562a34[_0x78c9('0x44')]=_[_0x78c9('0x41')](db['Team']['rawAttributes']);_0x562a34[_0x78c9('0x40')]=_[_0x78c9('0x41')](_0x512ec9['query']);_0x562a34[_0x78c9('0x42')]=_[_0x78c9('0x43')](_0x562a34[_0x78c9('0x44')],_0x562a34[_0x78c9('0x40')]);_0x2cc75a[_0x78c9('0x45')]=_['intersection'](_0x562a34[_0x78c9('0x44')],qs['fields'](_0x512ec9['query']['fields']));_0x2cc75a[_0x78c9('0x45')]=_0x2cc75a[_0x78c9('0x45')][_0x78c9('0x47')]?_0x2cc75a[_0x78c9('0x45')]:_0x562a34[_0x78c9('0x44')];_0x2cc75a[_0x78c9('0x49')]=qs[_0x78c9('0x4a')](_0x512ec9[_0x78c9('0x40')]['sort']);_0x2cc75a[_0x78c9('0x4c')]=qs[_0x78c9('0x42')](_[_0x78c9('0x4b')](_0x512ec9[_0x78c9('0x40')],_0x562a34[_0x78c9('0x42')]));if(_0x512ec9[_0x78c9('0x40')]['filter']){_0x2cc75a[_0x78c9('0x4c')]=_[_0x78c9('0x4d')](_0x2cc75a[_0x78c9('0x4c')],{'$or':_['map'](_0x2cc75a[_0x78c9('0x45')],function(_0x145d6d){var _0x3dde07={};_0x3dde07[_0x145d6d]={'$like':'%'+_0x512ec9[_0x78c9('0x40')][_0x78c9('0x4e')]+'%'};return _0x3dde07;})});}_0x2cc75a=_[_0x78c9('0x4d')]({},_0x2cc75a,_0x512ec9[_0x78c9('0x4f')]);return _0x7c4182[_0x78c9('0x6e')](_0x2cc75a);}})[_0x78c9('0x1e')](function(_0x45de49){if(_0x45de49){_0x2b42cb=_0x45de49[_0x78c9('0x47')];if(!_0x512ec9[_0x78c9('0x40')]['hasOwnProperty']('nolimit')){_0x2cc75a[_0x78c9('0x2f')]=qs[_0x78c9('0x2f')](_0x512ec9['query'][_0x78c9('0x2f')]);_0x2cc75a[_0x78c9('0x2d')]=qs['offset'](_0x512ec9[_0x78c9('0x40')][_0x78c9('0x2d')]);}return _0x7c4182[_0x78c9('0x6e')](_0x2cc75a);}})['then'](function(_0x55c378){if(_0x55c378){return _0x55c378?{'count':_0x2b42cb,'rows':_0x55c378}:null;}})[_0x78c9('0x1e')](respondWithResult(_0x23bf7b,null))[_0x78c9('0x28')](handleError(_0x23bf7b,null));};exports[_0x78c9('0x6f')]=function(_0x1683e0,_0x120385,_0x4258fe){var _0x5c61c9=_0x1683e0[_0x78c9('0x58')][_0x78c9('0x70')];return db['Team'][_0x78c9('0x52')]({'where':{'id':_0x5c61c9},'attributes':['id'],'include':[{'model':db['User'],'as':_0x78c9('0x71'),'attributes':['id',_0x78c9('0x5d'),_0x78c9('0x72'),_0x78c9('0x73'),_0x78c9('0x74')],'raw':!![]}]})[_0x78c9('0x1e')](function(_0x1b342b){if(_0x1b342b){var _0x3e6a25=_['flatMap'](_0x1b342b,function(_0x2ae828){var _0x1623d6=_0x2ae828[_0x78c9('0x36')]({'plain':!![]});return _0x1623d6['Agents'];});return db[_0x78c9('0x3b')][_0x78c9('0x56')]({'where':{'id':_0x1683e0[_0x78c9('0x55')]['id']}})[_0x78c9('0x1e')](function(_0x3ff5be){return db['sequelize']['transaction'](function(_0x49a1a8){return _0x3ff5be[_0x78c9('0x6f')](_0x5c61c9,{'transaction':_0x49a1a8})[_0x78c9('0x1e')](function(){return BPromise[_0x78c9('0x75')](_0x3e6a25,function(_0xb4b42d){return db[_0x78c9('0x64')][_0x78c9('0x76')]({'where':{'UserId':_0xb4b42d['id'],'ChatQueueId':_0x1683e0[_0x78c9('0x55')]['id']},'transaction':_0x49a1a8});});})['then'](function(){_0x3e6a25['forEach'](function(_0x4c3850){socket['emit'](_0x78c9('0x77'),{'UserId':_0x4c3850['id'],'ChatQueueId':_0x3ff5be['id']});});});});});}})['then'](respondWithStatusCode(_0x120385,null))[_0x78c9('0x28')](handleError(_0x120385,null));};exports[_0x78c9('0x78')]=function(_0x955563,_0x4d625d,_0x1cf7ed){return db[_0x78c9('0x79')][_0x78c9('0x52')]({'where':{'id':_0x955563[_0x78c9('0x40')][_0x78c9('0x70')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4d625d,null))['then'](function(_0x5426d8){var _0xb085ab=_[_0x78c9('0x3a')](_0x5426d8,'id');var _0x2c5c2a=[];var _0x2d9bac=[];var _0x58f6b8=squel[_0x78c9('0x7a')]();_0x58f6b8[_0x78c9('0x7b')]('tq.TeamId')[_0x78c9('0x7c')](_0x78c9('0x7d'),'tq')[_0x78c9('0x7e')](_0x78c9('0x7f'),'ut',_0x78c9('0x80'))[_0x78c9('0x4c')](_0x78c9('0x81'),_0x955563['params']['id']);for(var _0x23cc0b=0x0;_0x23cc0b<_0x5426d8[_0x78c9('0x47')];_0x23cc0b+=0x1){let _0x25d5bb=_0x5426d8[_0x23cc0b];for(var _0x2d1985=0x0;_0x2d1985<_0x25d5bb[_0x78c9('0x71')][_0x78c9('0x47')];_0x2d1985+=0x1){let _0x52b839=_0x25d5bb[_0x78c9('0x71')][_0x2d1985];var _0x13f288=_0x58f6b8[_0x78c9('0x82')]();_0x13f288[_0x78c9('0x4c')](_0x78c9('0x83'),_0x52b839['id']);_0x2d9bac[_0x78c9('0x84')](db[_0x78c9('0x85')][_0x78c9('0x40')](_0x13f288['toString'](),{'type':db['sequelize'][_0x78c9('0x86')][_0x78c9('0x87')]})['then'](function(_0x4039fc){if(_0x4039fc[_0x78c9('0x47')]===0x1){return _0x52b839['id'];}else{var _0x438699=_[_0x78c9('0x88')](_['map'](_0x4039fc,_0x78c9('0x89')),function(_0x228944){return _[_0x78c9('0x8a')](_0xb085ab,_0x228944);});if(_0x438699){return _0x52b839['id'];}}}));}}return BPromise[_0x78c9('0x8b')](_0x2d9bac)[_0x78c9('0x1e')](function(_0x114574){_0x2c5c2a=_(_0x2c5c2a)[_0x78c9('0x8c')](_0x114574)[_0x78c9('0x8d')]()['value']();return db[_0x78c9('0x3b')]['find']({'where':{'id':_0x955563[_0x78c9('0x55')]['id']}})['then'](function(_0x25d7ad){return db[_0x78c9('0x85')][_0x78c9('0x8e')](function(_0xbab405){return _0x25d7ad['removeTeams'](_0x955563[_0x78c9('0x40')][_0x78c9('0x70')],{'transaction':_0xbab405})['then'](function(){if(!_[_0x78c9('0x8f')](_0x2c5c2a)){return _0x25d7ad['removeAgents'](_0x2c5c2a,{'transaction':_0xbab405});}})[_0x78c9('0x1e')](function(){_0x2c5c2a[_0x78c9('0x90')](function(_0x4eb4b0){socket[_0x78c9('0x91')](_0x78c9('0x92'),{'UserId':_0x4eb4b0,'ChatQueueId':_0x25d7ad['id']});});});});});});})['then'](respondWithStatusCode(_0x4d625d,null))[_0x78c9('0x28')](handleError(_0x4d625d,null));};exports['addAgents']=function(_0x56a706,_0x3e437d,_0x18cbfe){return db[_0x78c9('0x3b')][_0x78c9('0x56')]({'where':{'id':_0x56a706[_0x78c9('0x55')]['id']}})[_0x78c9('0x1e')](handleEntityNotFound(_0x3e437d,null))[_0x78c9('0x1e')](function(_0x16bc4e){if(_0x16bc4e){return _0x16bc4e[_0x78c9('0x93')](_0x56a706[_0x78c9('0x58')][_0x78c9('0x70')],_[_0x78c9('0x94')](_0x56a706[_0x78c9('0x58')],[_0x78c9('0x70'),'id'])||{})[_0x78c9('0x95')](function(_0x587cf8){for(var _0x66523e=0x0;_0x66523e<_0x56a706[_0x78c9('0x58')]['ids']['length'];_0x66523e+=0x1){socket[_0x78c9('0x91')](_0x78c9('0x77'),{'UserId':Number(_0x56a706[_0x78c9('0x58')][_0x78c9('0x70')][_0x66523e]),'ChatQueueId':Number(_0x56a706[_0x78c9('0x55')]['id'])});}return _0x587cf8;});}})['then'](respondWithResult(_0x3e437d,null))['catch'](handleError(_0x3e437d,null));};exports[_0x78c9('0x96')]=function(_0x5e13d3,_0xe593eb,_0x3f41c6){return db[_0x78c9('0x3b')][_0x78c9('0x56')]({'where':{'id':_0x5e13d3[_0x78c9('0x55')]['id']}})[_0x78c9('0x1e')](handleEntityNotFound(_0xe593eb,null))[_0x78c9('0x1e')](function(_0x19f2b5){if(_0x19f2b5){return _0x19f2b5[_0x78c9('0x96')](_0x5e13d3[_0x78c9('0x40')]['ids'])[_0x78c9('0x1e')](function(){if(_[_0x78c9('0x97')](_0x5e13d3[_0x78c9('0x40')]['ids'])){for(var _0x756add=0x0;_0x756add<_0x5e13d3[_0x78c9('0x40')]['ids'][_0x78c9('0x47')];_0x756add+=0x1){socket[_0x78c9('0x91')]('userChatQueue:remove',{'UserId':Number(_0x5e13d3[_0x78c9('0x40')][_0x78c9('0x70')][_0x756add]),'ChatQueueId':Number(_0x5e13d3['params']['id'])});}}else{socket[_0x78c9('0x91')](_0x78c9('0x92'),{'UserId':Number(_0x5e13d3[_0x78c9('0x40')][_0x78c9('0x70')]),'ChatQueueId':Number(_0x5e13d3[_0x78c9('0x55')]['id'])});}});}})[_0x78c9('0x1e')](respondWithStatusCode(_0xe593eb,null))[_0x78c9('0x28')](handleError(_0xe593eb,null));};exports[_0x78c9('0x98')]=function(_0x1474a3,_0x37d341,_0x125b69){var _0x149481={};var _0x5083ec={};var _0x4f9fd2;var _0x1df709;return db[_0x78c9('0x3b')][_0x78c9('0x62')]({'where':{'id':_0x1474a3[_0x78c9('0x55')]['id']}})[_0x78c9('0x1e')](handleEntityNotFound(_0x37d341,null))[_0x78c9('0x1e')](function(_0x10414d){if(_0x10414d){_0x4f9fd2=_0x10414d;_0x5083ec[_0x78c9('0x44')]=_[_0x78c9('0x41')](db[_0x78c9('0x99')][_0x78c9('0x3c')]);_0x5083ec[_0x78c9('0x40')]=_[_0x78c9('0x41')](_0x1474a3[_0x78c9('0x40')]);_0x5083ec[_0x78c9('0x42')]=_[_0x78c9('0x43')](_0x5083ec[_0x78c9('0x44')],_0x5083ec[_0x78c9('0x40')]);_0x149481[_0x78c9('0x45')]=_[_0x78c9('0x43')](_0x5083ec[_0x78c9('0x44')],qs['fields'](_0x1474a3[_0x78c9('0x40')][_0x78c9('0x46')]));_0x149481['attributes']=_0x149481[_0x78c9('0x45')]['length']?_0x149481[_0x78c9('0x45')]:_0x5083ec[_0x78c9('0x44')];_0x149481[_0x78c9('0x49')]=qs[_0x78c9('0x4a')](_0x1474a3['query'][_0x78c9('0x4a')]);_0x149481[_0x78c9('0x4c')]=qs[_0x78c9('0x42')](_[_0x78c9('0x4b')](_0x1474a3[_0x78c9('0x40')],_0x5083ec[_0x78c9('0x42')]));if(_0x1474a3[_0x78c9('0x40')][_0x78c9('0x4e')]){_0x149481['where']=_[_0x78c9('0x4d')](_0x149481['where'],{'$or':_[_0x78c9('0x3a')](_0x149481[_0x78c9('0x45')],function(_0xc65269){var _0x348b23={};_0x348b23[_0xc65269]={'$like':'%'+_0x1474a3[_0x78c9('0x40')][_0x78c9('0x4e')]+'%'};return _0x348b23;})});}_0x149481=_['merge']({},_0x149481,_0x1474a3['options']);return _0x4f9fd2[_0x78c9('0x98')](_0x149481);}})[_0x78c9('0x1e')](function(_0x1c37e2){if(_0x1c37e2){_0x1df709=_0x1c37e2['length'];if(!_0x1474a3[_0x78c9('0x40')][_0x78c9('0x48')]('nolimit')){_0x149481[_0x78c9('0x2f')]=qs['limit'](_0x1474a3[_0x78c9('0x40')][_0x78c9('0x2f')]);_0x149481['offset']=qs[_0x78c9('0x2d')](_0x1474a3[_0x78c9('0x40')][_0x78c9('0x2d')]);}return _0x4f9fd2[_0x78c9('0x98')](_0x149481);}})['then'](function(_0x4712f1){if(_0x4712f1){return _0x4712f1?{'count':_0x1df709,'rows':_0x4712f1}:null;}})[_0x78c9('0x1e')](respondWithResult(_0x37d341,null))['catch'](handleError(_0x37d341,null));}; \ No newline at end of file +var _0x18ac=['describe','getMembers','findOne','hasOwnProperty','order','UserChatQueue','findAndCountAll','UserId','agent','updatedAt','format','SIP','createdAt','getTeams','addTeams','ids','Team','online','flatMap','Agents','sequelize','transaction','each','findOrCreate','emit','removeTeams','User','field','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','forEach','addAgents','omit','userChatQueue:save','isArray','userChatQueue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','request','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch','sendStatus','status','end','offset','limit','count','set','Content-Range','reject','update','destroy','then','get','UserProfileResource','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','find','create','body','user','role','ChatQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x117ab9,_0x45c7b6){var _0x258a48=function(_0xe6e07c){while(--_0xe6e07c){_0x117ab9['push'](_0x117ab9['shift']());}};_0x258a48(++_0x45c7b6);}(_0x18ac,0x1f1));var _0xc18a=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x18ac[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0xc18a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc18a('0x1'));var jsonpatch=require(_0xc18a('0x2'));var rp=require(_0xc18a('0x3'));var moment=require('moment');var BPromise=require(_0xc18a('0x4'));var Mustache=require(_0xc18a('0x5'));var util=require(_0xc18a('0x6'));var path=require(_0xc18a('0x7'));var sox=require('sox');var csv=require(_0xc18a('0x8'));var ejs=require(_0xc18a('0x9'));var fs=require('fs');var fs_extra=require(_0xc18a('0xa'));var _=require('lodash');var squel=require(_0xc18a('0xb'));var crypto=require(_0xc18a('0xc'));var jsforce=require(_0xc18a('0xd'));var deskjs=require(_0xc18a('0xe'));var toCsv=require(_0xc18a('0x8'));var querystring=require(_0xc18a('0xf'));var Papa=require(_0xc18a('0x10'));var Redis=require(_0xc18a('0x11'));var authService=require(_0xc18a('0x12'));var qs=require(_0xc18a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc18a('0x14'));var logger=require(_0xc18a('0x15'))(_0xc18a('0x16'));var utils=require(_0xc18a('0x17'));var config=require(_0xc18a('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc18a('0x19'))['db'];config[_0xc18a('0x1a')]=_[_0xc18a('0x1b')](config[_0xc18a('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xc18a('0x1c'))(new Redis(config['redis']));require('./chatQueue.socket')[_0xc18a('0x1d')](socket);var jayson=require(_0xc18a('0x1e'));var client=jayson[_0xc18a('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45e434,_0x828e85,_0x28621e,_0x2e788c){return new BPromise(function(_0x251a6e,_0x5757b0){var _0x2d1e47=_0x2e788c||client;return _0x2d1e47[_0xc18a('0x20')](_0x45e434,_0x28621e)['then'](function(_0x2185b7){logger['info'](_0xc18a('0x21'),_0x828e85,_0xc18a('0x22'));logger[_0xc18a('0x23')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x828e85,_0xc18a('0x22'),JSON[_0xc18a('0x24')](_0x2185b7));if(_0x2185b7[_0xc18a('0x25')]){if(_0x2185b7['error']['code']===0x1f4){logger[_0xc18a('0x25')](_0xc18a('0x21'),_0x828e85,_0x2185b7[_0xc18a('0x25')][_0xc18a('0x26')]);return _0x5757b0(_0x2185b7[_0xc18a('0x25')][_0xc18a('0x26')]);}logger[_0xc18a('0x25')]('ChatQueue,\x20%s,\x20%s',_0x828e85,_0x2185b7['error'][_0xc18a('0x26')]);return _0x251a6e(_0x2185b7[_0xc18a('0x25')][_0xc18a('0x26')]);}else{logger[_0xc18a('0x27')]('ChatQueue,\x20%s,\x20%s',_0x828e85,_0xc18a('0x22'));_0x251a6e(_0x2185b7['result'][_0xc18a('0x26')]);}})[_0xc18a('0x28')](function(_0x27067e){logger[_0xc18a('0x25')](_0xc18a('0x21'),_0x828e85,_0x27067e);_0x5757b0(_0x27067e);});});}function respondWithStatusCode(_0x39ee50,_0x2cc7f0){_0x2cc7f0=_0x2cc7f0||0xcc;return function(_0x3d6422){if(_0x3d6422){return _0x39ee50[_0xc18a('0x29')](_0x2cc7f0);}return _0x39ee50[_0xc18a('0x2a')](_0x2cc7f0)[_0xc18a('0x2b')]();};}function respondWithResult(_0x3fd083,_0x2dab78){_0x2dab78=_0x2dab78||0xc8;return function(_0x1bf8bd){if(_0x1bf8bd){return _0x3fd083['status'](_0x2dab78)['json'](_0x1bf8bd);}};}function respondWithFilteredResult(_0x39f525,_0x403b5b){return function(_0x25b69f){if(_0x25b69f){var _0x1cf78b=typeof _0x403b5b[_0xc18a('0x2c')]==='undefined'&&typeof _0x403b5b[_0xc18a('0x2d')]==='undefined';var _0x318f6d=_0x25b69f[_0xc18a('0x2e')];var _0x1d34c5=_0x1cf78b?0x0:_0x403b5b[_0xc18a('0x2c')];var _0x37b8e4=_0x1cf78b?_0x25b69f[_0xc18a('0x2e')]:_0x403b5b[_0xc18a('0x2c')]+_0x403b5b['limit'];var _0x10aaa4;if(_0x37b8e4>=_0x318f6d){_0x37b8e4=_0x318f6d;_0x10aaa4=0xc8;}else{_0x10aaa4=0xce;}_0x39f525['status'](_0x10aaa4);return _0x39f525[_0xc18a('0x2f')](_0xc18a('0x30'),_0x1d34c5+'-'+_0x37b8e4+'/'+_0x318f6d)['json'](_0x25b69f);}return null;};}function patchUpdates(_0xf1e85e){return function(_0x5047f5){try{jsonpatch['apply'](_0x5047f5,_0xf1e85e,!![]);}catch(_0x3da81a){return BPromise[_0xc18a('0x31')](_0x3da81a);}return _0x5047f5['save']();};}function saveUpdates(_0x2c249a,_0x4b76d9){return function(_0x5e39b4){if(_0x5e39b4){return _0x5e39b4[_0xc18a('0x32')](_0x2c249a)['then'](function(_0x98b006){return _0x98b006;});}return null;};}function removeEntity(_0x3f1ad0,_0x31967f){return function(_0x2880c5){if(_0x2880c5){return _0x2880c5[_0xc18a('0x33')]()[_0xc18a('0x34')](function(){var _0x14a79b=_0x2880c5[_0xc18a('0x35')]({'plain':!![]});var _0x2eb3b2='ChatQueues';return db[_0xc18a('0x36')]['destroy']({'where':{'type':_0x2eb3b2,'resourceId':_0x14a79b['id']}})[_0xc18a('0x34')](function(){return _0x2880c5;});})['then'](function(){_0x3f1ad0[_0xc18a('0x2a')](0xcc)[_0xc18a('0x2b')]();});}};}function handleEntityNotFound(_0x27f41c,_0x36996e){return function(_0x2fe8e6){if(!_0x2fe8e6){_0x27f41c['sendStatus'](0x194);}return _0x2fe8e6;};}function handleError(_0x226230,_0xf2904c){_0xf2904c=_0xf2904c||0x1f4;return function(_0x10c88a){logger['error'](_0x10c88a[_0xc18a('0x37')]);if(_0x10c88a[_0xc18a('0x38')]){delete _0x10c88a[_0xc18a('0x38')];}_0x226230[_0xc18a('0x2a')](_0xf2904c)[_0xc18a('0x39')](_0x10c88a);};}exports[_0xc18a('0x3a')]=function(_0x200484,_0x3a1f00){var _0x487b7b={},_0x2ec37f={},_0x1e561e={'count':0x0,'rows':[]};var _0x3700e6=_[_0xc18a('0x3b')](db[_0xc18a('0x3c')][_0xc18a('0x3d')],function(_0x541a50){return{'name':_0x541a50[_0xc18a('0x3e')],'type':_0x541a50[_0xc18a('0x3f')][_0xc18a('0x40')]};});_0x2ec37f['model']=_[_0xc18a('0x3b')](_0x3700e6,_0xc18a('0x38'));_0x2ec37f[_0xc18a('0x41')]=_[_0xc18a('0x42')](_0x200484['query']);_0x2ec37f[_0xc18a('0x43')]=_[_0xc18a('0x44')](_0x2ec37f[_0xc18a('0x45')],_0x2ec37f[_0xc18a('0x41')]);_0x487b7b[_0xc18a('0x46')]=_[_0xc18a('0x44')](_0x2ec37f[_0xc18a('0x45')],qs['fields'](_0x200484[_0xc18a('0x41')][_0xc18a('0x47')]));_0x487b7b['attributes']=_0x487b7b['attributes'][_0xc18a('0x48')]?_0x487b7b[_0xc18a('0x46')]:_0x2ec37f['model'];if(!_0x200484[_0xc18a('0x41')]['hasOwnProperty'](_0xc18a('0x49'))){_0x487b7b[_0xc18a('0x2d')]=qs['limit'](_0x200484[_0xc18a('0x41')][_0xc18a('0x2d')]);_0x487b7b[_0xc18a('0x2c')]=qs[_0xc18a('0x2c')](_0x200484[_0xc18a('0x41')][_0xc18a('0x2c')]);}_0x487b7b['order']=qs[_0xc18a('0x4a')](_0x200484[_0xc18a('0x41')]['sort']);_0x487b7b[_0xc18a('0x4b')]=qs[_0xc18a('0x43')](_[_0xc18a('0x4c')](_0x200484[_0xc18a('0x41')],_0x2ec37f[_0xc18a('0x43')]),_0x3700e6);if(_0x200484['query'][_0xc18a('0x4d')]){_0x487b7b[_0xc18a('0x4b')]=_[_0xc18a('0x4e')](_0x487b7b[_0xc18a('0x4b')],{'$or':_[_0xc18a('0x3b')](_0x3700e6,function(_0x181769){if(_0x181769[_0xc18a('0x3f')]!=='VIRTUAL'){var _0x560d92={};_0x560d92[_0x181769['name']]={'$like':'%'+_0x200484[_0xc18a('0x41')][_0xc18a('0x4d')]+'%'};return _0x560d92;}})});}_0x487b7b=_[_0xc18a('0x4e')]({},_0x487b7b,_0x200484[_0xc18a('0x4f')]);var _0x149470={'where':_0x487b7b[_0xc18a('0x4b')]};return db[_0xc18a('0x3c')][_0xc18a('0x2e')](_0x149470)[_0xc18a('0x34')](function(_0x4d2459){_0x1e561e[_0xc18a('0x2e')]=_0x4d2459;if(_0x200484['query']['includeAll']){_0x487b7b[_0xc18a('0x50')]=[{'all':!![]}];}return db[_0xc18a('0x3c')][_0xc18a('0x51')](_0x487b7b);})['then'](function(_0x2a20ff){_0x1e561e[_0xc18a('0x52')]=_0x2a20ff;return _0x1e561e;})[_0xc18a('0x34')](respondWithFilteredResult(_0x3a1f00,_0x487b7b))['catch'](handleError(_0x3a1f00,null));};exports[_0xc18a('0x53')]=function(_0x14d365,_0x5f03fc){var _0x51f092={'raw':!![],'where':{'id':_0x14d365[_0xc18a('0x54')]['id']}},_0x5ad1d8={};_0x5ad1d8[_0xc18a('0x45')]=_[_0xc18a('0x42')](db[_0xc18a('0x3c')]['rawAttributes']);_0x5ad1d8[_0xc18a('0x41')]=_[_0xc18a('0x42')](_0x14d365[_0xc18a('0x41')]);_0x5ad1d8[_0xc18a('0x43')]=_[_0xc18a('0x44')](_0x5ad1d8[_0xc18a('0x45')],_0x5ad1d8[_0xc18a('0x41')]);_0x51f092['attributes']=_[_0xc18a('0x44')](_0x5ad1d8[_0xc18a('0x45')],qs[_0xc18a('0x47')](_0x14d365[_0xc18a('0x41')][_0xc18a('0x47')]));_0x51f092[_0xc18a('0x46')]=_0x51f092['attributes'][_0xc18a('0x48')]?_0x51f092[_0xc18a('0x46')]:_0x5ad1d8[_0xc18a('0x45')];if(_0x14d365[_0xc18a('0x41')]['includeAll']){_0x51f092['include']=[{'all':!![]}];}_0x51f092=_[_0xc18a('0x4e')]({},_0x51f092,_0x14d365[_0xc18a('0x4f')]);return db[_0xc18a('0x3c')][_0xc18a('0x55')](_0x51f092)['then'](handleEntityNotFound(_0x5f03fc,null))['then'](respondWithResult(_0x5f03fc,null))['catch'](handleError(_0x5f03fc,null));};exports[_0xc18a('0x56')]=function(_0x1c32c0,_0x533dd5){return db[_0xc18a('0x3c')][_0xc18a('0x56')](_0x1c32c0[_0xc18a('0x57')],{})['then'](function(_0x3a46ec){var _0x105ce0=_0x1c32c0[_0xc18a('0x58')][_0xc18a('0x35')]({'plain':!![]});if(!_0x105ce0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x105ce0[_0xc18a('0x59')]===_0xc18a('0x58')){var _0xe0da19=_0x3a46ec[_0xc18a('0x35')]({'plain':!![]});var _0xaa4314=_0xc18a('0x5a');return db[_0xc18a('0x5b')]['find']({'where':{'name':_0xaa4314,'userProfileId':_0x105ce0[_0xc18a('0x5c')]},'raw':!![]})[_0xc18a('0x34')](function(_0x1f5d43){if(_0x1f5d43&&_0x1f5d43[_0xc18a('0x5d')]===0x0){return db['UserProfileResource'][_0xc18a('0x56')]({'name':_0xe0da19['name'],'resourceId':_0xe0da19['id'],'type':_0x1f5d43[_0xc18a('0x38')],'sectionId':_0x1f5d43['id']},{})['then'](function(){return _0x3a46ec;});}else{return _0x3a46ec;}})[_0xc18a('0x28')](function(_0x22b294){logger[_0xc18a('0x25')](_0xc18a('0x5e'),_0x22b294);throw _0x22b294;});}return _0x3a46ec;})[_0xc18a('0x34')](respondWithResult(_0x533dd5,0xc9))[_0xc18a('0x28')](handleError(_0x533dd5,null));};exports[_0xc18a('0x32')]=function(_0x3b2ed3,_0x25c500){if(_0x3b2ed3[_0xc18a('0x57')]['id']){delete _0x3b2ed3[_0xc18a('0x57')]['id'];}return db[_0xc18a('0x3c')][_0xc18a('0x55')]({'where':{'id':_0x3b2ed3[_0xc18a('0x54')]['id']}})[_0xc18a('0x34')](handleEntityNotFound(_0x25c500,null))['then'](saveUpdates(_0x3b2ed3[_0xc18a('0x57')],null))[_0xc18a('0x34')](respondWithResult(_0x25c500,null))[_0xc18a('0x28')](handleError(_0x25c500,null));};exports[_0xc18a('0x33')]=function(_0xebf0f1,_0x498628){return db['ChatQueue']['find']({'where':{'id':_0xebf0f1[_0xc18a('0x54')]['id']}})[_0xc18a('0x34')](handleEntityNotFound(_0x498628,null))[_0xc18a('0x34')](removeEntity(_0x498628,null))[_0xc18a('0x28')](handleError(_0x498628,null));};exports[_0xc18a('0x5f')]=function(_0x3e1ea6,_0x47ef0f){return db[_0xc18a('0x3c')][_0xc18a('0x5f')]()[_0xc18a('0x34')](respondWithResult(_0x47ef0f,null))['catch'](handleError(_0x47ef0f,null));};exports[_0xc18a('0x60')]=function(_0x1e0cc9,_0x46cc7d,_0x878500){var _0x5da8a4={'raw':!![],'where':{}},_0x580070={},_0x51579b;return db[_0xc18a('0x3c')][_0xc18a('0x61')]({'where':{'id':_0x1e0cc9[_0xc18a('0x54')]['id']}})['then'](handleEntityNotFound(_0x46cc7d,null))[_0xc18a('0x34')](function(_0x14a66c){if(_0x14a66c){_0x51579b=_0x14a66c['get']({'plain':!![]});_0x580070[_0xc18a('0x45')]=_[_0xc18a('0x42')](db['UserChatQueue'][_0xc18a('0x3d')]);_0x580070[_0xc18a('0x41')]=_['keys'](_0x1e0cc9[_0xc18a('0x41')]);_0x580070['filters']=_['intersection'](_0x580070[_0xc18a('0x45')],_0x580070['query']);_0x5da8a4[_0xc18a('0x46')]=_[_0xc18a('0x44')](_0x580070[_0xc18a('0x45')],qs[_0xc18a('0x47')](_0x1e0cc9['query']['fields']));_0x5da8a4[_0xc18a('0x46')]=_0x5da8a4[_0xc18a('0x46')]['length']?_0x5da8a4[_0xc18a('0x46')]:_0x580070[_0xc18a('0x45')];if(!_0x1e0cc9[_0xc18a('0x41')][_0xc18a('0x62')](_0xc18a('0x49'))){_0x5da8a4[_0xc18a('0x2d')]=qs[_0xc18a('0x2d')](_0x1e0cc9[_0xc18a('0x41')]['limit']);_0x5da8a4[_0xc18a('0x2c')]=qs[_0xc18a('0x2c')](_0x1e0cc9['query'][_0xc18a('0x2c')]);}_0x5da8a4[_0xc18a('0x63')]=qs[_0xc18a('0x4a')](_0x1e0cc9['query'][_0xc18a('0x4a')]);_0x5da8a4[_0xc18a('0x4b')]=qs[_0xc18a('0x43')](_[_0xc18a('0x4c')](_0x1e0cc9[_0xc18a('0x41')],_0x580070['filters']));_0x5da8a4[_0xc18a('0x4b')]['ChatQueueId']=_0x14a66c['id'];if(_0x1e0cc9[_0xc18a('0x41')][_0xc18a('0x4d')]){_0x5da8a4[_0xc18a('0x4b')]=_[_0xc18a('0x4e')](_0x5da8a4[_0xc18a('0x4b')],{'$or':_['map'](_0x5da8a4[_0xc18a('0x46')],function(_0x3a921c){var _0x360f56={};_0x360f56[_0x3a921c]={'$like':'%'+_0x1e0cc9['query'][_0xc18a('0x4d')]+'%'};return _0x360f56;})});}_0x5da8a4=_['merge']({},_0x5da8a4,_0x1e0cc9[_0xc18a('0x4f')]);return db[_0xc18a('0x64')][_0xc18a('0x51')](_0x5da8a4);}})['then'](function(_0xedcf58){if(_0xedcf58){return db['User'][_0xc18a('0x65')]({'where':{'id':_[_0xc18a('0x3b')](_0xedcf58,_0xc18a('0x66')),'role':_0xc18a('0x67')},'attributes':['id','name','chatPause',_0xc18a('0x68'),'createdAt']});}})[_0xc18a('0x34')](function(_0x214c4e){if(_0x214c4e){return{'count':_0x214c4e['count'],'rows':_[_0xc18a('0x3b')](_0x214c4e[_0xc18a('0x52')],function(_0xf49886){return{'membername':_0xf49886[_0xc18a('0x38')],'UserId':_0xf49886['id'],'queue_name':_0x51579b[_0xc18a('0x38')],'ChatQueueId':_0x51579b['id'],'interface':util[_0xc18a('0x69')]('%s/%s',_0xc18a('0x6a'),_0xf49886['name']),'penalty':0x0,'paused':_0xf49886['chatPause'],'createdAt':_0xf49886[_0xc18a('0x6b')],'updatedAt':_0xf49886[_0xc18a('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc18a('0x34')](respondWithFilteredResult(_0x46cc7d,_0x5da8a4))[_0xc18a('0x28')](handleError(_0x46cc7d,null));};exports[_0xc18a('0x6c')]=function(_0x3f060d,_0x4588c3,_0x48169a){var _0x2bdcf3={};var _0x2ff530={};var _0x2a554b;var _0x3ac6a9;return db['ChatQueue']['findOne']({'where':{'id':_0x3f060d['params']['id']}})['then'](handleEntityNotFound(_0x4588c3,null))['then'](function(_0x206298){if(_0x206298){_0x2a554b=_0x206298;_0x2ff530[_0xc18a('0x45')]=_[_0xc18a('0x42')](db['Team'][_0xc18a('0x3d')]);_0x2ff530[_0xc18a('0x41')]=_['keys'](_0x3f060d[_0xc18a('0x41')]);_0x2ff530[_0xc18a('0x43')]=_[_0xc18a('0x44')](_0x2ff530[_0xc18a('0x45')],_0x2ff530['query']);_0x2bdcf3[_0xc18a('0x46')]=_['intersection'](_0x2ff530[_0xc18a('0x45')],qs[_0xc18a('0x47')](_0x3f060d[_0xc18a('0x41')][_0xc18a('0x47')]));_0x2bdcf3['attributes']=_0x2bdcf3[_0xc18a('0x46')]['length']?_0x2bdcf3[_0xc18a('0x46')]:_0x2ff530[_0xc18a('0x45')];_0x2bdcf3[_0xc18a('0x63')]=qs[_0xc18a('0x4a')](_0x3f060d['query'][_0xc18a('0x4a')]);_0x2bdcf3[_0xc18a('0x4b')]=qs[_0xc18a('0x43')](_[_0xc18a('0x4c')](_0x3f060d[_0xc18a('0x41')],_0x2ff530['filters']));if(_0x3f060d[_0xc18a('0x41')]['filter']){_0x2bdcf3[_0xc18a('0x4b')]=_['merge'](_0x2bdcf3[_0xc18a('0x4b')],{'$or':_['map'](_0x2bdcf3[_0xc18a('0x46')],function(_0x252fae){var _0x4b1fd0={};_0x4b1fd0[_0x252fae]={'$like':'%'+_0x3f060d[_0xc18a('0x41')][_0xc18a('0x4d')]+'%'};return _0x4b1fd0;})});}_0x2bdcf3=_[_0xc18a('0x4e')]({},_0x2bdcf3,_0x3f060d[_0xc18a('0x4f')]);return _0x2a554b[_0xc18a('0x6c')](_0x2bdcf3);}})['then'](function(_0x5ba05f){if(_0x5ba05f){_0x3ac6a9=_0x5ba05f[_0xc18a('0x48')];if(!_0x3f060d['query'][_0xc18a('0x62')](_0xc18a('0x49'))){_0x2bdcf3['limit']=qs[_0xc18a('0x2d')](_0x3f060d[_0xc18a('0x41')][_0xc18a('0x2d')]);_0x2bdcf3['offset']=qs[_0xc18a('0x2c')](_0x3f060d[_0xc18a('0x41')]['offset']);}return _0x2a554b[_0xc18a('0x6c')](_0x2bdcf3);}})[_0xc18a('0x34')](function(_0x2ee54a){if(_0x2ee54a){return _0x2ee54a?{'count':_0x3ac6a9,'rows':_0x2ee54a}:null;}})[_0xc18a('0x34')](respondWithResult(_0x4588c3,null))['catch'](handleError(_0x4588c3,null));};exports[_0xc18a('0x6d')]=function(_0x526d03,_0x171453,_0x25b07e){var _0x2f4d3b=_0x526d03[_0xc18a('0x57')][_0xc18a('0x6e')];return db[_0xc18a('0x6f')][_0xc18a('0x51')]({'where':{'id':_0x2f4d3b},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xc18a('0x38'),_0xc18a('0x70'),'voicePause','interface'],'raw':!![]}]})[_0xc18a('0x34')](function(_0x3d38bc){if(_0x3d38bc){var _0x312ba0=_[_0xc18a('0x71')](_0x3d38bc,function(_0x31cf57){var _0x2d1782=_0x31cf57[_0xc18a('0x35')]({'plain':!![]});return _0x2d1782[_0xc18a('0x72')];});return db[_0xc18a('0x3c')][_0xc18a('0x55')]({'where':{'id':_0x526d03[_0xc18a('0x54')]['id']}})[_0xc18a('0x34')](function(_0x50107c){return db[_0xc18a('0x73')][_0xc18a('0x74')](function(_0x2d17e7){return _0x50107c[_0xc18a('0x6d')](_0x2f4d3b,{'transaction':_0x2d17e7})[_0xc18a('0x34')](function(){return BPromise[_0xc18a('0x75')](_0x312ba0,function(_0x378c25){return db['UserChatQueue'][_0xc18a('0x76')]({'where':{'UserId':_0x378c25['id'],'ChatQueueId':_0x526d03['params']['id']},'transaction':_0x2d17e7});});})[_0xc18a('0x34')](function(){_0x312ba0['forEach'](function(_0x35e966){socket[_0xc18a('0x77')]('userChatQueue:save',{'UserId':_0x35e966['id'],'ChatQueueId':_0x50107c['id']});});});});});}})[_0xc18a('0x34')](respondWithStatusCode(_0x171453,null))[_0xc18a('0x28')](handleError(_0x171453,null));};exports[_0xc18a('0x78')]=function(_0x52568d,_0x54b1ce,_0x3d3e8e){return db['Team'][_0xc18a('0x51')]({'where':{'id':_0x52568d[_0xc18a('0x41')]['ids']},'attributes':['id'],'include':[{'model':db[_0xc18a('0x79')],'as':_0xc18a('0x72'),'attributes':['id'],'raw':!![]}]})[_0xc18a('0x34')](handleEntityNotFound(_0x54b1ce,null))[_0xc18a('0x34')](function(_0x5094f1){var _0x364c1c=_[_0xc18a('0x3b')](_0x5094f1,'id');var _0x290484=[];var _0x3a9bc5=[];var _0x4cf789=squel['select']();_0x4cf789[_0xc18a('0x7a')]('tq.TeamId')['from'](_0xc18a('0x7b'),'tq')[_0xc18a('0x7c')](_0xc18a('0x7d'),'ut',_0xc18a('0x7e'))['where'](_0xc18a('0x7f'),_0x52568d[_0xc18a('0x54')]['id']);for(var _0x1a096e=0x0;_0x1a096e<_0x5094f1[_0xc18a('0x48')];_0x1a096e+=0x1){let _0x1868dd=_0x5094f1[_0x1a096e];for(var _0x27889b=0x0;_0x27889b<_0x1868dd[_0xc18a('0x72')][_0xc18a('0x48')];_0x27889b+=0x1){let _0x3c3c04=_0x1868dd['Agents'][_0x27889b];var _0x363477=_0x4cf789['clone']();_0x363477[_0xc18a('0x4b')](_0xc18a('0x80'),_0x3c3c04['id']);_0x3a9bc5[_0xc18a('0x81')](db[_0xc18a('0x73')][_0xc18a('0x41')](_0x363477[_0xc18a('0x82')](),{'type':db['sequelize'][_0xc18a('0x83')][_0xc18a('0x84')]})[_0xc18a('0x34')](function(_0x10ca5c){if(_0x10ca5c[_0xc18a('0x48')]===0x1){return _0x3c3c04['id'];}else{var _0x3b2a17=_[_0xc18a('0x85')](_[_0xc18a('0x3b')](_0x10ca5c,_0xc18a('0x86')),function(_0x615a31){return _[_0xc18a('0x87')](_0x364c1c,_0x615a31);});if(_0x3b2a17){return _0x3c3c04['id'];}}}));}}return BPromise['all'](_0x3a9bc5)[_0xc18a('0x34')](function(_0x130efb){_0x290484=_(_0x290484)[_0xc18a('0x88')](_0x130efb)[_0xc18a('0x89')]()[_0xc18a('0x8a')]();return db[_0xc18a('0x3c')][_0xc18a('0x55')]({'where':{'id':_0x52568d[_0xc18a('0x54')]['id']}})[_0xc18a('0x34')](function(_0x372bdb){return db[_0xc18a('0x73')]['transaction'](function(_0x15871b){return _0x372bdb[_0xc18a('0x78')](_0x52568d[_0xc18a('0x41')][_0xc18a('0x6e')],{'transaction':_0x15871b})[_0xc18a('0x34')](function(){if(!_[_0xc18a('0x8b')](_0x290484)){return _0x372bdb[_0xc18a('0x8c')](_0x290484,{'transaction':_0x15871b});}})[_0xc18a('0x34')](function(){_0x290484[_0xc18a('0x8d')](function(_0x43e2e2){socket[_0xc18a('0x77')]('userChatQueue:remove',{'UserId':_0x43e2e2,'ChatQueueId':_0x372bdb['id']});});});});});});})['then'](respondWithStatusCode(_0x54b1ce,null))[_0xc18a('0x28')](handleError(_0x54b1ce,null));};exports[_0xc18a('0x8e')]=function(_0x302117,_0x2ee8c4,_0x53df15){return db[_0xc18a('0x3c')][_0xc18a('0x55')]({'where':{'id':_0x302117[_0xc18a('0x54')]['id']}})[_0xc18a('0x34')](handleEntityNotFound(_0x2ee8c4,null))[_0xc18a('0x34')](function(_0xfc052d){if(_0xfc052d){return _0xfc052d[_0xc18a('0x8e')](_0x302117[_0xc18a('0x57')]['ids'],_[_0xc18a('0x8f')](_0x302117['body'],[_0xc18a('0x6e'),'id'])||{})['spread'](function(_0x47ba23){for(var _0x37707b=0x0;_0x37707b<_0x302117[_0xc18a('0x57')][_0xc18a('0x6e')][_0xc18a('0x48')];_0x37707b+=0x1){socket[_0xc18a('0x77')](_0xc18a('0x90'),{'UserId':Number(_0x302117[_0xc18a('0x57')]['ids'][_0x37707b]),'ChatQueueId':Number(_0x302117[_0xc18a('0x54')]['id'])});}return _0x47ba23;});}})[_0xc18a('0x34')](respondWithResult(_0x2ee8c4,null))[_0xc18a('0x28')](handleError(_0x2ee8c4,null));};exports[_0xc18a('0x8c')]=function(_0x23571d,_0x1e2938,_0x4feb11){return db['ChatQueue'][_0xc18a('0x55')]({'where':{'id':_0x23571d[_0xc18a('0x54')]['id']}})[_0xc18a('0x34')](handleEntityNotFound(_0x1e2938,null))[_0xc18a('0x34')](function(_0x5e621f){if(_0x5e621f){return _0x5e621f[_0xc18a('0x8c')](_0x23571d[_0xc18a('0x41')]['ids'])[_0xc18a('0x34')](function(){if(_[_0xc18a('0x91')](_0x23571d[_0xc18a('0x41')][_0xc18a('0x6e')])){for(var _0x16d8d2=0x0;_0x16d8d2<_0x23571d['query']['ids'][_0xc18a('0x48')];_0x16d8d2+=0x1){socket[_0xc18a('0x77')](_0xc18a('0x92'),{'UserId':Number(_0x23571d[_0xc18a('0x41')][_0xc18a('0x6e')][_0x16d8d2]),'ChatQueueId':Number(_0x23571d[_0xc18a('0x54')]['id'])});}}else{socket['emit'](_0xc18a('0x92'),{'UserId':Number(_0x23571d[_0xc18a('0x41')][_0xc18a('0x6e')]),'ChatQueueId':Number(_0x23571d['params']['id'])});}});}})[_0xc18a('0x34')](respondWithStatusCode(_0x1e2938,null))[_0xc18a('0x28')](handleError(_0x1e2938,null));};exports[_0xc18a('0x93')]=function(_0x541eef,_0x2deb4c,_0x2065a4){var _0x28912f={};var _0x513495={};var _0x38c4ef;var _0x49be50;return db[_0xc18a('0x3c')][_0xc18a('0x61')]({'where':{'id':_0x541eef[_0xc18a('0x54')]['id']}})[_0xc18a('0x34')](handleEntityNotFound(_0x2deb4c,null))['then'](function(_0xdeacc1){if(_0xdeacc1){_0x38c4ef=_0xdeacc1;_0x513495['model']=_['keys'](db[_0xc18a('0x79')][_0xc18a('0x3d')]);_0x513495[_0xc18a('0x41')]=_[_0xc18a('0x42')](_0x541eef[_0xc18a('0x41')]);_0x513495[_0xc18a('0x43')]=_[_0xc18a('0x44')](_0x513495['model'],_0x513495[_0xc18a('0x41')]);_0x28912f[_0xc18a('0x46')]=_[_0xc18a('0x44')](_0x513495[_0xc18a('0x45')],qs[_0xc18a('0x47')](_0x541eef[_0xc18a('0x41')]['fields']));_0x28912f[_0xc18a('0x46')]=_0x28912f['attributes'][_0xc18a('0x48')]?_0x28912f['attributes']:_0x513495['model'];_0x28912f[_0xc18a('0x63')]=qs[_0xc18a('0x4a')](_0x541eef[_0xc18a('0x41')][_0xc18a('0x4a')]);_0x28912f[_0xc18a('0x4b')]=qs[_0xc18a('0x43')](_['pick'](_0x541eef[_0xc18a('0x41')],_0x513495['filters']));if(_0x541eef['query'][_0xc18a('0x4d')]){_0x28912f[_0xc18a('0x4b')]=_[_0xc18a('0x4e')](_0x28912f['where'],{'$or':_['map'](_0x28912f['attributes'],function(_0x71093e){var _0x2d4e85={};_0x2d4e85[_0x71093e]={'$like':'%'+_0x541eef[_0xc18a('0x41')][_0xc18a('0x4d')]+'%'};return _0x2d4e85;})});}_0x28912f=_['merge']({},_0x28912f,_0x541eef['options']);return _0x38c4ef[_0xc18a('0x93')](_0x28912f);}})['then'](function(_0x2ead44){if(_0x2ead44){_0x49be50=_0x2ead44['length'];if(!_0x541eef[_0xc18a('0x41')][_0xc18a('0x62')](_0xc18a('0x49'))){_0x28912f['limit']=qs['limit'](_0x541eef[_0xc18a('0x41')][_0xc18a('0x2d')]);_0x28912f[_0xc18a('0x2c')]=qs['offset'](_0x541eef[_0xc18a('0x41')][_0xc18a('0x2c')]);}return _0x38c4ef[_0xc18a('0x93')](_0x28912f);}})[_0xc18a('0x34')](function(_0x4ac78e){if(_0x4ac78e){return _0x4ac78e?{'count':_0x49be50,'rows':_0x4ac78e}:null;}})[_0xc18a('0x34')](respondWithResult(_0x2deb4c,null))[_0xc18a('0x28')](handleError(_0x2deb4c,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index ec5010a..5f9cbcd 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 _0x9ff2=['save','update','remove','emit','hook','exports','events','../../mysqldb','ChatQueue'];(function(_0x3468a7,_0x277414){var _0x3c567b=function(_0x3ae5e7){while(--_0x3ae5e7){_0x3468a7['push'](_0x3468a7['shift']());}};_0x3c567b(++_0x277414);}(_0x9ff2,0x14a));var _0x29ff=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x9ff2[_0x5c3c0b];return _0x52ecd2;};'use strict';var EventEmitter=require(_0x29ff('0x0'));var ChatQueue=require(_0x29ff('0x1'))['db'][_0x29ff('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x29ff('0x3'),'afterUpdate':_0x29ff('0x4'),'afterDestroy':_0x29ff('0x5')};function emitEvent(_0x5804ba){return function(_0x5b573f,_0x5d681c,_0xee1ae3){ChatQueueEvents[_0x29ff('0x6')](_0x5804ba+':'+_0x5b573f['id'],_0x5b573f);ChatQueueEvents['emit'](_0x5804ba,_0x5b573f);_0xee1ae3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x29ff('0x7')](e,emitEvent(event));}}module[_0x29ff('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0xa4d3=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa4d3,0x1d3));var _0x3a4d=function(_0x32d950,_0xb49e40){_0x32d950=_0x32d950-0x0;var _0x4ce275=_0xa4d3[_0x32d950];return _0x4ce275;};'use strict';var EventEmitter=require(_0x3a4d('0x0'));var ChatQueue=require(_0x3a4d('0x1'))['db'][_0x3a4d('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3a4d('0x3'),'afterUpdate':_0x3a4d('0x4'),'afterDestroy':_0x3a4d('0x5')};function emitEvent(_0x34b3cf){return function(_0x565bd0,_0xd0ad79,_0x2391b0){ChatQueueEvents['emit'](_0x34b3cf+':'+_0x565bd0['id'],_0x565bd0);ChatQueueEvents[_0x3a4d('0x6')](_0x34b3cf,_0x565bd0);_0x2391b0(null);};}for(var e in events){if(events[_0x3a4d('0x7')](e)){var event=events[e];ChatQueue[_0x3a4d('0x8')](e,emitEvent(event));}}module[_0x3a4d('0x9')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index a40f1c0..d667d5a 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 _0x90ae=['ChatQueue','chat_queues','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define'];(function(_0x9d2bdc,_0x4f2b6a){var _0x410615=function(_0x56b661){while(--_0x56b661){_0x9d2bdc['push'](_0x9d2bdc['shift']());}};_0x410615(++_0x4f2b6a);}(_0x90ae,0x106));var _0xe90a=function(_0x3ed4da,_0x2a4fdd){_0x3ed4da=_0x3ed4da-0x0;var _0x5b7f61=_0x90ae[_0x3ed4da];return _0x5b7f61;};'use strict';var _=require('lodash');var util=require(_0xe90a('0x0'));var logger=require(_0xe90a('0x1'))(_0xe90a('0x2'));var moment=require('moment');var BPromise=require(_0xe90a('0x3'));var rp=require(_0xe90a('0x4'));var fs=require('fs');var path=require(_0xe90a('0x5'));var rimraf=require(_0xe90a('0x6'));var config=require(_0xe90a('0x7'));var attributes=require(_0xe90a('0x8'));module[_0xe90a('0x9')]=function(_0xb69bf4,_0x2e6cfd){return _0xb69bf4[_0xe90a('0xa')](_0xe90a('0xb'),attributes,{'tableName':_0xe90a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4dab=['../../config/logger','moment','bluebird','request-promise','path','rimraf','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','util'];(function(_0x7fdad7,_0xe88c38){var _0x26e175=function(_0x49ea5c){while(--_0x49ea5c){_0x7fdad7['push'](_0x7fdad7['shift']());}};_0x26e175(++_0xe88c38);}(_0x4dab,0x1a3));var _0xb4da=function(_0x3b037b,_0x1be37a){_0x3b037b=_0x3b037b-0x0;var _0x4ece31=_0x4dab[_0x3b037b];return _0x4ece31;};'use strict';var _=require('lodash');var util=require(_0xb4da('0x0'));var logger=require(_0xb4da('0x1'))('api');var moment=require(_0xb4da('0x2'));var BPromise=require(_0xb4da('0x3'));var rp=require(_0xb4da('0x4'));var fs=require('fs');var path=require(_0xb4da('0x5'));var rimraf=require(_0xb4da('0x6'));var config=require('../../config/environment');var attributes=require(_0xb4da('0x7'));module[_0xb4da('0x8')]=function(_0x281e76,_0x8bafc7){return _0x281e76[_0xb4da('0x9')](_0xb4da('0xa'),attributes,{'tableName':_0xb4da('0xb'),'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 b1307ff..ae25fa4 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 _0x0419=['socket.io-emitter','./chatQueue.socket','info','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue','ChatQueue','options','raw','limit','include','model','attributes','map','then','ShowChatQueue','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','defaults'];(function(_0x4e1d7d,_0x5a7761){var _0x53f086=function(_0x3bd510){while(--_0x3bd510){_0x4e1d7d['push'](_0x4e1d7d['shift']());}};_0x53f086(++_0x5a7761);}(_0x0419,0x153));var _0x9041=function(_0x39f237,_0x20c4be){_0x39f237=_0x39f237-0x0;var _0x3fb158=_0x0419[_0x39f237];return _0x3fb158;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9041('0x0'));var BPromise=require(_0x9041('0x1'));var rs=require(_0x9041('0x2'));var fs=require('fs');var Redis=require(_0x9041('0x3'));var db=require(_0x9041('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9041('0x5'));var config=require(_0x9041('0x6'));var jayson=require(_0x9041('0x7'));var client=jayson[_0x9041('0x8')]['http']({'port':0x232a});config[_0x9041('0x9')]=_[_0x9041('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9041('0xb'))(new Redis(config[_0x9041('0x9')]));require(_0x9041('0xc'))['register'](socket);function respondWithRpcPromise(_0x33b812,_0x4d0aaf,_0x22487){return new BPromise(function(_0x2964e9,_0x992570){return client['request'](_0x33b812,_0x22487)['then'](function(_0x473271){logger[_0x9041('0xd')]('ChatQueue,\x20%s,\x20%s',_0x4d0aaf,'request\x20sent');logger[_0x9041('0xe')](_0x9041('0xf'),_0x4d0aaf,_0x9041('0x10'),JSON[_0x9041('0x11')](_0x473271));if(_0x473271[_0x9041('0x12')]){if(_0x473271[_0x9041('0x12')][_0x9041('0x13')]===0x1f4){logger[_0x9041('0x12')](_0x9041('0x14'),_0x4d0aaf,_0x473271[_0x9041('0x12')][_0x9041('0x15')]);return _0x992570(_0x473271['error']['message']);}logger['error'](_0x9041('0x14'),_0x4d0aaf,_0x473271[_0x9041('0x12')][_0x9041('0x15')]);return _0x2964e9(_0x473271['error'][_0x9041('0x15')]);}else{logger[_0x9041('0xd')](_0x9041('0x14'),_0x4d0aaf,'request\x20sent');_0x2964e9(_0x473271[_0x9041('0x16')][_0x9041('0x15')]);}})[_0x9041('0x17')](function(_0x36a5c2){logger[_0x9041('0x12')](_0x9041('0x14'),_0x4d0aaf,_0x36a5c2);_0x992570(_0x36a5c2);});});}exports[_0x9041('0x18')]=function(_0x2f52e0){var _0x5cff96=this;return new Promise(function(_0x3d527b,_0xa8ee07){return db[_0x9041('0x19')]['findAll']({'raw':_0x2f52e0[_0x9041('0x1a')]?_0x2f52e0[_0x9041('0x1a')][_0x9041('0x1b')]===undefined?!![]:![]:!![],'where':_0x2f52e0['options']?_0x2f52e0[_0x9041('0x1a')]['where']||null:null,'attributes':_0x2f52e0[_0x9041('0x1a')]?_0x2f52e0[_0x9041('0x1a')]['attributes']||null:null,'limit':_0x2f52e0['options']?_0x2f52e0[_0x9041('0x1a')][_0x9041('0x1c')]||null:null,'include':_0x2f52e0[_0x9041('0x1a')]?_0x2f52e0[_0x9041('0x1a')]['include']?_['map'](_0x2f52e0[_0x9041('0x1a')][_0x9041('0x1d')],function(_0x11401a){return{'model':db[_0x11401a[_0x9041('0x1e')]],'as':_0x11401a['as'],'attributes':_0x11401a[_0x9041('0x1f')],'include':_0x11401a['include']?_[_0x9041('0x20')](_0x11401a[_0x9041('0x1d')],function(_0x57a1db){return{'model':db[_0x57a1db[_0x9041('0x1e')]],'as':_0x57a1db['as'],'attributes':_0x57a1db[_0x9041('0x1f')],'include':_0x57a1db[_0x9041('0x1d')]?_[_0x9041('0x20')](_0x57a1db[_0x9041('0x1d')],function(_0x462620){return{'model':db[_0x462620[_0x9041('0x1e')]],'as':_0x462620['as'],'attributes':_0x462620[_0x9041('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9041('0x21')](function(_0xd3861e){logger[_0x9041('0xd')](_0x9041('0x18'),_0x2f52e0);logger[_0x9041('0xe')](_0x9041('0x18'),_0x2f52e0,JSON[_0x9041('0x11')](_0xd3861e));_0x3d527b(_0xd3861e);})[_0x9041('0x17')](function(_0x4fee5f){logger[_0x9041('0x12')](_0x9041('0x18'),_0x4fee5f[_0x9041('0x15')],_0x2f52e0);_0xa8ee07(_0x5cff96['error'](0x1f4,_0x4fee5f[_0x9041('0x15')]));});});};exports[_0x9041('0x22')]=function(_0x21c3d5){var _0x3c31e8=this;return new Promise(function(_0x2ea40a,_0x3370b0){return db['ChatQueue']['find']({'raw':_0x21c3d5['options']?_0x21c3d5['options'][_0x9041('0x1b')]===undefined?!![]:![]:!![],'where':_0x21c3d5[_0x9041('0x1a')]?_0x21c3d5['options']['where']||null:null,'attributes':_0x21c3d5[_0x9041('0x1a')]?_0x21c3d5[_0x9041('0x1a')][_0x9041('0x1f')]||null:null,'include':_0x21c3d5[_0x9041('0x1a')]?_0x21c3d5[_0x9041('0x1a')][_0x9041('0x1d')]?_['map'](_0x21c3d5['options']['include'],function(_0x152b15){return{'model':db[_0x152b15['model']],'as':_0x152b15['as'],'attributes':_0x152b15['attributes'],'include':_0x152b15[_0x9041('0x1d')]?_[_0x9041('0x20')](_0x152b15[_0x9041('0x1d')],function(_0xc22135){return{'model':db[_0xc22135[_0x9041('0x1e')]],'as':_0xc22135['as'],'attributes':_0xc22135[_0x9041('0x1f')],'include':_0xc22135[_0x9041('0x1d')]?_['map'](_0xc22135[_0x9041('0x1d')],function(_0x23b91e){return{'model':db[_0x23b91e[_0x9041('0x1e')]],'as':_0x23b91e['as'],'attributes':_0x23b91e['attributes']};}):[]};}):[]};}):[]:[]})[_0x9041('0x21')](function(_0xe21f3){logger[_0x9041('0xd')]('ShowChatQueue',_0x21c3d5);logger[_0x9041('0xe')](_0x9041('0x22'),_0x21c3d5,JSON[_0x9041('0x11')](_0xe21f3));_0x2ea40a(_0xe21f3);})['catch'](function(_0x3745c0){logger[_0x9041('0x12')](_0x9041('0x22'),_0x3745c0[_0x9041('0x15')],_0x21c3d5);_0x3370b0(_0x3c31e8[_0x9041('0x12')](0x1f4,_0x3745c0[_0x9041('0x15')]));});});}; \ No newline at end of file +var _0x34b7=['code','message','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowChatQueue','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4204b0,_0xb1d9c4){var _0x2afcce=function(_0x682d04){while(--_0x682d04){_0x4204b0['push'](_0x4204b0['shift']());}};_0x2afcce(++_0xb1d9c4);}(_0x34b7,0x196));var _0x734b=function(_0xc80702,_0x18ef50){_0xc80702=_0xc80702-0x0;var _0x4c4c76=_0x34b7[_0xc80702];return _0x4c4c76;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x734b('0x0'));var BPromise=require(_0x734b('0x1'));var rs=require(_0x734b('0x2'));var fs=require('fs');var Redis=require(_0x734b('0x3'));var db=require(_0x734b('0x4'))['db'];var utils=require(_0x734b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x734b('0x6'));var jayson=require(_0x734b('0x7'));var client=jayson[_0x734b('0x8')][_0x734b('0x9')]({'port':0x232a});config[_0x734b('0xa')]=_[_0x734b('0xb')](config['redis'],{'host':_0x734b('0xc'),'port':0x18eb});var socket=require(_0x734b('0xd'))(new Redis(config['redis']));require('./chatQueue.socket')['register'](socket);function respondWithRpcPromise(_0x19a88e,_0x598dee,_0x43c5e0){return new BPromise(function(_0x333738,_0x2860a2){return client[_0x734b('0xe')](_0x19a88e,_0x43c5e0)[_0x734b('0xf')](function(_0x16e451){logger[_0x734b('0x10')](_0x734b('0x11'),_0x598dee,_0x734b('0x12'));logger[_0x734b('0x13')](_0x734b('0x14'),_0x598dee,_0x734b('0x12'),JSON[_0x734b('0x15')](_0x16e451));if(_0x16e451[_0x734b('0x16')]){if(_0x16e451['error'][_0x734b('0x17')]===0x1f4){logger[_0x734b('0x16')](_0x734b('0x11'),_0x598dee,_0x16e451[_0x734b('0x16')][_0x734b('0x18')]);return _0x2860a2(_0x16e451[_0x734b('0x16')][_0x734b('0x18')]);}logger[_0x734b('0x16')](_0x734b('0x11'),_0x598dee,_0x16e451[_0x734b('0x16')][_0x734b('0x18')]);return _0x333738(_0x16e451['error'][_0x734b('0x18')]);}else{logger[_0x734b('0x10')](_0x734b('0x11'),_0x598dee,_0x734b('0x12'));_0x333738(_0x16e451['result']['message']);}})[_0x734b('0x19')](function(_0x3033cd){logger[_0x734b('0x16')](_0x734b('0x11'),_0x598dee,_0x3033cd);_0x2860a2(_0x3033cd);});});}exports[_0x734b('0x1a')]=function(_0xfe567d){var _0x1c68c4=this;return new Promise(function(_0x6572ee,_0x67eed){return db[_0x734b('0x1b')][_0x734b('0x1c')]({'raw':_0xfe567d[_0x734b('0x1d')]?_0xfe567d[_0x734b('0x1d')][_0x734b('0x1e')]===undefined?!![]:![]:!![],'where':_0xfe567d['options']?_0xfe567d[_0x734b('0x1d')][_0x734b('0x1f')]||null:null,'attributes':_0xfe567d['options']?_0xfe567d[_0x734b('0x1d')][_0x734b('0x20')]||null:null,'limit':_0xfe567d[_0x734b('0x1d')]?_0xfe567d[_0x734b('0x1d')][_0x734b('0x21')]||null:null,'include':_0xfe567d[_0x734b('0x1d')]?_0xfe567d[_0x734b('0x1d')][_0x734b('0x22')]?_[_0x734b('0x23')](_0xfe567d[_0x734b('0x1d')][_0x734b('0x22')],function(_0x148abe){return{'model':db[_0x148abe[_0x734b('0x24')]],'as':_0x148abe['as'],'attributes':_0x148abe['attributes'],'include':_0x148abe['include']?_[_0x734b('0x23')](_0x148abe[_0x734b('0x22')],function(_0x47a0a9){return{'model':db[_0x47a0a9[_0x734b('0x24')]],'as':_0x47a0a9['as'],'attributes':_0x47a0a9[_0x734b('0x20')],'include':_0x47a0a9[_0x734b('0x22')]?_[_0x734b('0x23')](_0x47a0a9[_0x734b('0x22')],function(_0x1b8295){return{'model':db[_0x1b8295[_0x734b('0x24')]],'as':_0x1b8295['as'],'attributes':_0x1b8295['attributes']};}):[]};}):[]};}):[]:[]})[_0x734b('0xf')](function(_0x436efe){logger[_0x734b('0x10')](_0x734b('0x1a'),_0xfe567d);logger[_0x734b('0x13')](_0x734b('0x1a'),_0xfe567d,JSON[_0x734b('0x15')](_0x436efe));_0x6572ee(_0x436efe);})[_0x734b('0x19')](function(_0x371ead){logger[_0x734b('0x16')]('GetChatQueue',_0x371ead[_0x734b('0x18')],_0xfe567d);_0x67eed(_0x1c68c4[_0x734b('0x16')](0x1f4,_0x371ead['message']));});});};exports[_0x734b('0x25')]=function(_0x3cfce2){var _0xf4ef21=this;return new Promise(function(_0x2fe7d5,_0x21cb04){return db[_0x734b('0x1b')][_0x734b('0x26')]({'raw':_0x3cfce2[_0x734b('0x1d')]?_0x3cfce2[_0x734b('0x1d')][_0x734b('0x1e')]===undefined?!![]:![]:!![],'where':_0x3cfce2[_0x734b('0x1d')]?_0x3cfce2[_0x734b('0x1d')][_0x734b('0x1f')]||null:null,'attributes':_0x3cfce2[_0x734b('0x1d')]?_0x3cfce2[_0x734b('0x1d')]['attributes']||null:null,'include':_0x3cfce2[_0x734b('0x1d')]?_0x3cfce2['options'][_0x734b('0x22')]?_[_0x734b('0x23')](_0x3cfce2[_0x734b('0x1d')][_0x734b('0x22')],function(_0x19f94d){return{'model':db[_0x19f94d[_0x734b('0x24')]],'as':_0x19f94d['as'],'attributes':_0x19f94d['attributes'],'include':_0x19f94d['include']?_[_0x734b('0x23')](_0x19f94d['include'],function(_0x3cc627){return{'model':db[_0x3cc627['model']],'as':_0x3cc627['as'],'attributes':_0x3cc627[_0x734b('0x20')],'include':_0x3cc627['include']?_[_0x734b('0x23')](_0x3cc627['include'],function(_0x37d891){return{'model':db[_0x37d891[_0x734b('0x24')]],'as':_0x37d891['as'],'attributes':_0x37d891[_0x734b('0x20')]};}):[]};}):[]};}):[]:[]})[_0x734b('0xf')](function(_0x37876a){logger[_0x734b('0x10')](_0x734b('0x25'),_0x3cfce2);logger['debug'](_0x734b('0x25'),_0x3cfce2,JSON[_0x734b('0x15')](_0x37876a));_0x2fe7d5(_0x37876a);})['catch'](function(_0x3752c5){logger[_0x734b('0x16')](_0x734b('0x25'),_0x3752c5[_0x734b('0x18')],_0x3cfce2);_0x21cb04(_0xf4ef21['error'](0x1f4,_0x3752c5[_0x734b('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 4adac29..c361fd6 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 _0x4b84=['./chatQueue.events','save','emit','length'];(function(_0x44995f,_0x532a52){var _0x4476a2=function(_0x4aa0f6){while(--_0x4aa0f6){_0x44995f['push'](_0x44995f['shift']());}};_0x4476a2(++_0x532a52);}(_0x4b84,0x1cc));var _0x44b8=function(_0x408e38,_0x23cda8){_0x408e38=_0x408e38-0x0;var _0x426b0e=_0x4b84[_0x408e38];return _0x426b0e;};'use strict';var ChatQueueEvents=require(_0x44b8('0x0'));var events=[_0x44b8('0x1'),'remove','update'];function createListener(_0x765943,_0x519db3){return function(_0x4b8ad8){_0x519db3[_0x44b8('0x2')](_0x765943,_0x4b8ad8);};}function removeListener(_0x31282a,_0x39ad16){return function(){ChatQueueEvents['removeListener'](_0x31282a,_0x39ad16);};}exports['register']=function(_0x55f25d){for(var _0x996a8b=0x0,_0x54274b=events[_0x44b8('0x3')];_0x996a8b<_0x54274b;_0x996a8b++){var _0x5947f7=events[_0x996a8b];var _0x3e87c5=createListener('chatQueue:'+_0x5947f7,_0x55f25d);ChatQueueEvents['on'](_0x5947f7,_0x3e87c5);}}; \ No newline at end of file +var _0xe14d=['update','removeListener','register','chatQueue:','./chatQueue.events','save','remove'];(function(_0x4e363a,_0x1d8602){var _0xd1aedd=function(_0x3b5a3a){while(--_0x3b5a3a){_0x4e363a['push'](_0x4e363a['shift']());}};_0xd1aedd(++_0x1d8602);}(_0xe14d,0x1ee));var _0xde14=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0xe14d[_0x13ce0c];return _0x4388fb;};'use strict';var ChatQueueEvents=require(_0xde14('0x0'));var events=[_0xde14('0x1'),_0xde14('0x2'),_0xde14('0x3')];function createListener(_0x48b392,_0x1c5b4){return function(_0x28965b){_0x1c5b4['emit'](_0x48b392,_0x28965b);};}function removeListener(_0x1c3e94,_0x13c24e){return function(){ChatQueueEvents[_0xde14('0x4')](_0x1c3e94,_0x13c24e);};}exports[_0xde14('0x5')]=function(_0x461af3){for(var _0xba1514=0x0,_0x4b1f6b=events['length'];_0xba1514<_0x4b1f6b;_0xba1514++){var _0x1bd49d=events[_0xba1514];var _0x115b7d=createListener(_0xde14('0x6')+_0x1bd49d,_0x461af3);ChatQueueEvents['on'](_0x1bd49d,_0x115b7d);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 8215463..580c045 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 _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','multer','util','path'];(function(_0x30bcf1,_0x30c2db){var _0x150883=function(_0x130930){while(--_0x130930){_0x30bcf1['push'](_0x30bcf1['shift']());}};_0x150883(++_0x30c2db);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/teams',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x14')](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0x19'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x1a')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x1b')]);router[_0x7995('0x1a')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router['delete']('/:id/users',auth[_0x7995('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x2b50be,_0x4e3d61){var _0x212cd4=function(_0x1a7b87){while(--_0x1a7b87){_0x2b50be['push'](_0x2b50be['shift']());}};_0x212cd4(++_0x4e3d61);}(_0xe14b,0x93));var _0xbe14=function(_0x5a4f92,_0x484a7c){_0x5a4f92=_0x5a4f92-0x0;var _0x427813=_0xe14b[_0x5a4f92];return _0x427813;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index b2dc50e..3449c43 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 _0x890f=['DATE','sequelize','exports','STRING'];(function(_0x3e8270,_0x293590){var _0x1ccde9=function(_0x213490){while(--_0x213490){_0x3e8270['push'](_0x3e8270['shift']());}};_0x1ccde9(++_0x293590);}(_0x890f,0x1a1));var _0xf890=function(_0x42225e,_0x1164f2){_0x42225e=_0x42225e-0x0;var _0x2bf9e5=_0x890f[_0x42225e];return _0x2bf9e5;};'use strict';var moment=require('moment');var Sequelize=require(_0xf890('0x0'));module[_0xf890('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xf890('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xf890('0x3')]},'acceptAt':{'type':Sequelize[_0xf890('0x3')]},'exitAt':{'type':Sequelize[_0xf890('0x3')]},'reason':{'type':Sequelize[_0xf890('0x2')]}}; \ No newline at end of file +var _0x77b7=['moment','exports','STRING','DATE'];(function(_0x4879c8,_0x560eba){var _0x56661d=function(_0x5a830b){while(--_0x5a830b){_0x4879c8['push'](_0x4879c8['shift']());}};_0x56661d(++_0x560eba);}(_0x77b7,0x178));var _0x777b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x77b7[_0x14add3];return _0x4a174f;};'use strict';var moment=require(_0x777b('0x0'));var Sequelize=require('sequelize');module[_0x777b('0x1')]={'uniqueid':{'type':Sequelize[_0x777b('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x777b('0x2')]},'joinAt':{'type':Sequelize[_0x777b('0x3')]},'leaveAt':{'type':Sequelize[_0x777b('0x3')]},'acceptAt':{'type':Sequelize[_0x777b('0x3')]},'exitAt':{'type':Sequelize[_0x777b('0x3')]},'reason':{'type':Sequelize[_0x777b('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index bfec721..aebbf4e 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 _0xa24d=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../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','save','update','then','destroy','stack','name','index','map','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','type','ChatQueueReport','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','describe','eml-format'];(function(_0x505bfb,_0xe48938){var _0x3bca12=function(_0x1fb16f){while(--_0x1fb16f){_0x505bfb['push'](_0x505bfb['shift']());}};_0x3bca12(++_0xe48938);}(_0xa24d,0x1c1));var _0xda24=function(_0x1d38e0,_0x23dcaf){_0x1d38e0=_0x1d38e0-0x0;var _0x26e31b=_0xa24d[_0x1d38e0];return _0x26e31b;};'use strict';var emlformat=require(_0xda24('0x0'));var rimraf=require(_0xda24('0x1'));var zipdir=require(_0xda24('0x2'));var jsonpatch=require(_0xda24('0x3'));var rp=require(_0xda24('0x4'));var moment=require(_0xda24('0x5'));var BPromise=require(_0xda24('0x6'));var Mustache=require('mustache');var util=require(_0xda24('0x7'));var path=require(_0xda24('0x8'));var sox=require(_0xda24('0x9'));var csv=require(_0xda24('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xda24('0xb'));var _=require(_0xda24('0xc'));var squel=require('squel');var crypto=require(_0xda24('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xda24('0xe'));var toCsv=require(_0xda24('0xa'));var querystring=require(_0xda24('0xf'));var Papa=require(_0xda24('0x10'));var Redis=require('ioredis');var authService=require(_0xda24('0x11'));var qs=require(_0xda24('0x12'));var as=require(_0xda24('0x13'));var hardwareService=require(_0xda24('0x14'));var logger=require(_0xda24('0x15'))('api');var utils=require(_0xda24('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xda24('0x17'));var db=require(_0xda24('0x18'))['db'];function respondWithStatusCode(_0x519fb9,_0x54b23d){_0x54b23d=_0x54b23d||0xcc;return function(_0x2e3505){if(_0x2e3505){return _0x519fb9[_0xda24('0x19')](_0x54b23d);}return _0x519fb9[_0xda24('0x1a')](_0x54b23d)[_0xda24('0x1b')]();};}function respondWithResult(_0x4f34a4,_0xef067b){_0xef067b=_0xef067b||0xc8;return function(_0x53dadc){if(_0x53dadc){return _0x4f34a4[_0xda24('0x1a')](_0xef067b)[_0xda24('0x1c')](_0x53dadc);}};}function respondWithFilteredResult(_0x57f4d6,_0x547e1c){return function(_0x53749f){if(_0x53749f){var _0x26764=typeof _0x547e1c[_0xda24('0x1d')]===_0xda24('0x1e')&&typeof _0x547e1c[_0xda24('0x1f')]===_0xda24('0x1e');var _0x8f6c65=_0x53749f[_0xda24('0x20')];var _0x847878=_0x26764?0x0:_0x547e1c['offset'];var _0x22b57d=_0x26764?_0x53749f[_0xda24('0x20')]:_0x547e1c['offset']+_0x547e1c[_0xda24('0x1f')];var _0x510b07;if(_0x22b57d>=_0x8f6c65){_0x22b57d=_0x8f6c65;_0x510b07=0xc8;}else{_0x510b07=0xce;}_0x57f4d6['status'](_0x510b07);return _0x57f4d6[_0xda24('0x21')](_0xda24('0x22'),_0x847878+'-'+_0x22b57d+'/'+_0x8f6c65)[_0xda24('0x1c')](_0x53749f);}return null;};}function patchUpdates(_0x46cb50){return function(_0x3cdeb5){try{jsonpatch[_0xda24('0x23')](_0x3cdeb5,_0x46cb50,!![]);}catch(_0xc7fab5){return BPromise['reject'](_0xc7fab5);}return _0x3cdeb5[_0xda24('0x24')]();};}function saveUpdates(_0x5f53a3,_0x232df2){return function(_0x2fdf18){if(_0x2fdf18){return _0x2fdf18[_0xda24('0x25')](_0x5f53a3)[_0xda24('0x26')](function(_0x17c573){return _0x17c573;});}return null;};}function removeEntity(_0x2f9ae2,_0x454d04){return function(_0xd74f8d){if(_0xd74f8d){return _0xd74f8d[_0xda24('0x27')]()[_0xda24('0x26')](function(){_0x2f9ae2[_0xda24('0x1a')](0xcc)[_0xda24('0x1b')]();});}};}function handleEntityNotFound(_0x5edfc0,_0x468647){return function(_0x30e886){if(!_0x30e886){_0x5edfc0[_0xda24('0x19')](0x194);}return _0x30e886;};}function handleError(_0x35ff0f,_0x196304){_0x196304=_0x196304||0x1f4;return function(_0x3f666b){logger['error'](_0x3f666b[_0xda24('0x28')]);if(_0x3f666b['name']){delete _0x3f666b[_0xda24('0x29')];}_0x35ff0f[_0xda24('0x1a')](_0x196304)['send'](_0x3f666b);};}exports[_0xda24('0x2a')]=function(_0xd6d60f,_0x49a311){var _0x40487d={},_0xc98aa2={},_0x9a6911={'count':0x0,'rows':[]};var _0x11ffb5=_[_0xda24('0x2b')](db['ChatQueueReport']['rawAttributes'],function(_0x20f60d){return{'name':_0x20f60d['fieldName'],'type':_0x20f60d['type'][_0xda24('0x2c')]};});_0xc98aa2[_0xda24('0x2d')]=_['map'](_0x11ffb5,'name');_0xc98aa2[_0xda24('0x2e')]=_[_0xda24('0x2f')](_0xd6d60f['query']);_0xc98aa2['filters']=_[_0xda24('0x30')](_0xc98aa2[_0xda24('0x2d')],_0xc98aa2[_0xda24('0x2e')]);_0x40487d[_0xda24('0x31')]=_[_0xda24('0x30')](_0xc98aa2['model'],qs[_0xda24('0x32')](_0xd6d60f[_0xda24('0x2e')][_0xda24('0x32')]));_0x40487d[_0xda24('0x31')]=_0x40487d['attributes'][_0xda24('0x33')]?_0x40487d['attributes']:_0xc98aa2[_0xda24('0x2d')];if(!_0xd6d60f[_0xda24('0x2e')][_0xda24('0x34')](_0xda24('0x35'))){_0x40487d[_0xda24('0x1f')]=qs['limit'](_0xd6d60f[_0xda24('0x2e')][_0xda24('0x1f')]);_0x40487d[_0xda24('0x1d')]=qs[_0xda24('0x1d')](_0xd6d60f[_0xda24('0x2e')]['offset']);}_0x40487d[_0xda24('0x36')]=qs[_0xda24('0x37')](_0xd6d60f['query']['sort']);_0x40487d['where']=qs[_0xda24('0x38')](_[_0xda24('0x39')](_0xd6d60f[_0xda24('0x2e')],_0xc98aa2[_0xda24('0x38')]),_0x11ffb5);if(_0xd6d60f[_0xda24('0x2e')][_0xda24('0x3a')]){_0x40487d['where']=_[_0xda24('0x3b')](_0x40487d[_0xda24('0x3c')],{'$or':_[_0xda24('0x2b')](_0x11ffb5,function(_0x5aa0aa){if(_0x5aa0aa[_0xda24('0x3d')]!=='VIRTUAL'){var _0x25d0cd={};_0x25d0cd[_0x5aa0aa['name']]={'$like':'%'+_0xd6d60f[_0xda24('0x2e')]['filter']+'%'};return _0x25d0cd;}})});}_0x40487d=_[_0xda24('0x3b')]({},_0x40487d,_0xd6d60f['options']);var _0x5e81e8={'where':_0x40487d[_0xda24('0x3c')]};return db[_0xda24('0x3e')][_0xda24('0x20')](_0x5e81e8)[_0xda24('0x26')](function(_0x46c18b){_0x9a6911[_0xda24('0x20')]=_0x46c18b;if(_0xd6d60f[_0xda24('0x2e')]['includeAll']){_0x40487d[_0xda24('0x3f')]=[{'all':!![]}];}return db[_0xda24('0x3e')][_0xda24('0x40')](_0x40487d);})[_0xda24('0x26')](function(_0xe42050){_0x9a6911[_0xda24('0x41')]=_0xe42050;return _0x9a6911;})[_0xda24('0x26')](respondWithFilteredResult(_0x49a311,_0x40487d))[_0xda24('0x42')](handleError(_0x49a311,null));};exports[_0xda24('0x43')]=function(_0x1aa0eb,_0x4aea76){var _0x3e6597={'raw':!![],'where':{'id':_0x1aa0eb[_0xda24('0x44')]['id']}},_0x61f885={};_0x61f885[_0xda24('0x2d')]=_['keys'](db[_0xda24('0x3e')][_0xda24('0x45')]);_0x61f885['query']=_['keys'](_0x1aa0eb['query']);_0x61f885['filters']=_['intersection'](_0x61f885['model'],_0x61f885[_0xda24('0x2e')]);_0x3e6597[_0xda24('0x31')]=_[_0xda24('0x30')](_0x61f885[_0xda24('0x2d')],qs[_0xda24('0x32')](_0x1aa0eb['query'][_0xda24('0x32')]));_0x3e6597[_0xda24('0x31')]=_0x3e6597[_0xda24('0x31')][_0xda24('0x33')]?_0x3e6597['attributes']:_0x61f885[_0xda24('0x2d')];if(_0x1aa0eb[_0xda24('0x2e')][_0xda24('0x46')]){_0x3e6597[_0xda24('0x3f')]=[{'all':!![]}];}_0x3e6597=_[_0xda24('0x3b')]({},_0x3e6597,_0x1aa0eb['options']);return db['ChatQueueReport'][_0xda24('0x47')](_0x3e6597)[_0xda24('0x26')](handleEntityNotFound(_0x4aea76,null))[_0xda24('0x26')](respondWithResult(_0x4aea76,null))[_0xda24('0x42')](handleError(_0x4aea76,null));};exports[_0xda24('0x48')]=function(_0x37a834,_0xcfcbd5){return db['ChatQueueReport'][_0xda24('0x48')](_0x37a834[_0xda24('0x49')],{})['then'](respondWithResult(_0xcfcbd5,0xc9))['catch'](handleError(_0xcfcbd5,null));};exports[_0xda24('0x25')]=function(_0x2eb12b,_0x302e2b){if(_0x2eb12b['body']['id']){delete _0x2eb12b[_0xda24('0x49')]['id'];}return db[_0xda24('0x3e')][_0xda24('0x47')]({'where':{'id':_0x2eb12b['params']['id']}})[_0xda24('0x26')](handleEntityNotFound(_0x302e2b,null))[_0xda24('0x26')](saveUpdates(_0x2eb12b['body'],null))[_0xda24('0x26')](respondWithResult(_0x302e2b,null))[_0xda24('0x42')](handleError(_0x302e2b,null));};exports[_0xda24('0x27')]=function(_0x264eb0,_0x2f87b7){return db['ChatQueueReport'][_0xda24('0x47')]({'where':{'id':_0x264eb0[_0xda24('0x44')]['id']}})[_0xda24('0x26')](handleEntityNotFound(_0x2f87b7,null))[_0xda24('0x26')](removeEntity(_0x2f87b7,null))['catch'](handleError(_0x2f87b7,null));};exports[_0xda24('0x4a')]=function(_0x73a1f3,_0x4de9ad){return db[_0xda24('0x3e')][_0xda24('0x4a')]()['then'](respondWithResult(_0x4de9ad,null))[_0xda24('0x42')](handleError(_0x4de9ad,null));}; \ No newline at end of file +var _0x2d2c=['name','index','map','ChatQueueReport','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','findAll','rows','catch','keys','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','error','stack'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x2d2c,0x1d7));var _0xc2d2=function(_0x23b655,_0x4feb2b){_0x23b655=_0x23b655-0x0;var _0x364b32=_0x2d2c[_0x23b655];return _0x364b32;};'use strict';var emlformat=require(_0xc2d2('0x0'));var rimraf=require(_0xc2d2('0x1'));var zipdir=require(_0xc2d2('0x2'));var jsonpatch=require(_0xc2d2('0x3'));var rp=require(_0xc2d2('0x4'));var moment=require(_0xc2d2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc2d2('0x6'));var util=require('util');var path=require(_0xc2d2('0x7'));var sox=require(_0xc2d2('0x8'));var csv=require(_0xc2d2('0x9'));var ejs=require(_0xc2d2('0xa'));var fs=require('fs');var fs_extra=require(_0xc2d2('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc2d2('0xc'));var jsforce=require(_0xc2d2('0xd'));var deskjs=require(_0xc2d2('0xe'));var toCsv=require(_0xc2d2('0x9'));var querystring=require(_0xc2d2('0xf'));var Papa=require(_0xc2d2('0x10'));var Redis=require(_0xc2d2('0x11'));var authService=require(_0xc2d2('0x12'));var qs=require(_0xc2d2('0x13'));var as=require(_0xc2d2('0x14'));var hardwareService=require(_0xc2d2('0x15'));var logger=require(_0xc2d2('0x16'))('api');var utils=require(_0xc2d2('0x17'));var config=require(_0xc2d2('0x18'));var licenseUtil=require(_0xc2d2('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x273269,_0x738877){_0x738877=_0x738877||0xcc;return function(_0x4c2b12){if(_0x4c2b12){return _0x273269[_0xc2d2('0x1a')](_0x738877);}return _0x273269[_0xc2d2('0x1b')](_0x738877)['end']();};}function respondWithResult(_0xa6f836,_0x4de52a){_0x4de52a=_0x4de52a||0xc8;return function(_0x5a1d24){if(_0x5a1d24){return _0xa6f836[_0xc2d2('0x1b')](_0x4de52a)[_0xc2d2('0x1c')](_0x5a1d24);}};}function respondWithFilteredResult(_0xf6bc66,_0x4006f3){return function(_0x2c42a6){if(_0x2c42a6){var _0x37552b=typeof _0x4006f3[_0xc2d2('0x1d')]===_0xc2d2('0x1e')&&typeof _0x4006f3[_0xc2d2('0x1f')]===_0xc2d2('0x1e');var _0x403d51=_0x2c42a6['count'];var _0x2d4ec4=_0x37552b?0x0:_0x4006f3[_0xc2d2('0x1d')];var _0x34f750=_0x37552b?_0x2c42a6[_0xc2d2('0x20')]:_0x4006f3['offset']+_0x4006f3[_0xc2d2('0x1f')];var _0x18cef7;if(_0x34f750>=_0x403d51){_0x34f750=_0x403d51;_0x18cef7=0xc8;}else{_0x18cef7=0xce;}_0xf6bc66['status'](_0x18cef7);return _0xf6bc66[_0xc2d2('0x21')](_0xc2d2('0x22'),_0x2d4ec4+'-'+_0x34f750+'/'+_0x403d51)[_0xc2d2('0x1c')](_0x2c42a6);}return null;};}function patchUpdates(_0xb14bc3){return function(_0x603323){try{jsonpatch['apply'](_0x603323,_0xb14bc3,!![]);}catch(_0x100d5b){return BPromise[_0xc2d2('0x23')](_0x100d5b);}return _0x603323['save']();};}function saveUpdates(_0x2cac91,_0x4e3cb5){return function(_0x5ecf78){if(_0x5ecf78){return _0x5ecf78['update'](_0x2cac91)[_0xc2d2('0x24')](function(_0x1bdcb5){return _0x1bdcb5;});}return null;};}function removeEntity(_0x7ffb28,_0x4b3449){return function(_0x2dbc46){if(_0x2dbc46){return _0x2dbc46[_0xc2d2('0x25')]()[_0xc2d2('0x24')](function(){_0x7ffb28[_0xc2d2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25b201,_0x25e6af){return function(_0xf2ba15){if(!_0xf2ba15){_0x25b201[_0xc2d2('0x1a')](0x194);}return _0xf2ba15;};}function handleError(_0x1a11d2,_0x1c14e5){_0x1c14e5=_0x1c14e5||0x1f4;return function(_0x49e955){logger[_0xc2d2('0x26')](_0x49e955[_0xc2d2('0x27')]);if(_0x49e955[_0xc2d2('0x28')]){delete _0x49e955[_0xc2d2('0x28')];}_0x1a11d2['status'](_0x1c14e5)['send'](_0x49e955);};}exports[_0xc2d2('0x29')]=function(_0x7b75f4,_0x1f3b66){var _0x21ca37={},_0x402337={},_0x460379={'count':0x0,'rows':[]};var _0x4d4af2=_[_0xc2d2('0x2a')](db[_0xc2d2('0x2b')]['rawAttributes'],function(_0x29cae5){return{'name':_0x29cae5[_0xc2d2('0x2c')],'type':_0x29cae5[_0xc2d2('0x2d')][_0xc2d2('0x2e')]};});_0x402337[_0xc2d2('0x2f')]=_['map'](_0x4d4af2,'name');_0x402337[_0xc2d2('0x30')]=_['keys'](_0x7b75f4[_0xc2d2('0x30')]);_0x402337[_0xc2d2('0x31')]=_[_0xc2d2('0x32')](_0x402337[_0xc2d2('0x2f')],_0x402337[_0xc2d2('0x30')]);_0x21ca37['attributes']=_[_0xc2d2('0x32')](_0x402337[_0xc2d2('0x2f')],qs[_0xc2d2('0x33')](_0x7b75f4[_0xc2d2('0x30')][_0xc2d2('0x33')]));_0x21ca37[_0xc2d2('0x34')]=_0x21ca37['attributes'][_0xc2d2('0x35')]?_0x21ca37[_0xc2d2('0x34')]:_0x402337['model'];if(!_0x7b75f4[_0xc2d2('0x30')]['hasOwnProperty'](_0xc2d2('0x36'))){_0x21ca37[_0xc2d2('0x1f')]=qs[_0xc2d2('0x1f')](_0x7b75f4[_0xc2d2('0x30')][_0xc2d2('0x1f')]);_0x21ca37[_0xc2d2('0x1d')]=qs[_0xc2d2('0x1d')](_0x7b75f4[_0xc2d2('0x30')]['offset']);}_0x21ca37[_0xc2d2('0x37')]=qs[_0xc2d2('0x38')](_0x7b75f4[_0xc2d2('0x30')][_0xc2d2('0x38')]);_0x21ca37['where']=qs[_0xc2d2('0x31')](_[_0xc2d2('0x39')](_0x7b75f4[_0xc2d2('0x30')],_0x402337[_0xc2d2('0x31')]),_0x4d4af2);if(_0x7b75f4['query'][_0xc2d2('0x3a')]){_0x21ca37['where']=_[_0xc2d2('0x3b')](_0x21ca37[_0xc2d2('0x3c')],{'$or':_['map'](_0x4d4af2,function(_0xdbdce0){if(_0xdbdce0[_0xc2d2('0x2d')]!==_0xc2d2('0x3d')){var _0x29d04b={};_0x29d04b[_0xdbdce0[_0xc2d2('0x28')]]={'$like':'%'+_0x7b75f4[_0xc2d2('0x30')][_0xc2d2('0x3a')]+'%'};return _0x29d04b;}})});}_0x21ca37=_[_0xc2d2('0x3b')]({},_0x21ca37,_0x7b75f4[_0xc2d2('0x3e')]);var _0x49d900={'where':_0x21ca37['where']};return db[_0xc2d2('0x2b')][_0xc2d2('0x20')](_0x49d900)['then'](function(_0xfd3ad4){_0x460379[_0xc2d2('0x20')]=_0xfd3ad4;if(_0x7b75f4[_0xc2d2('0x30')]['includeAll']){_0x21ca37['include']=[{'all':!![]}];}return db['ChatQueueReport'][_0xc2d2('0x3f')](_0x21ca37);})[_0xc2d2('0x24')](function(_0x4031d0){_0x460379[_0xc2d2('0x40')]=_0x4031d0;return _0x460379;})['then'](respondWithFilteredResult(_0x1f3b66,_0x21ca37))[_0xc2d2('0x41')](handleError(_0x1f3b66,null));};exports['show']=function(_0x582edb,_0x24544e){var _0x2a987a={'raw':!![],'where':{'id':_0x582edb['params']['id']}},_0x386a39={};_0x386a39[_0xc2d2('0x2f')]=_[_0xc2d2('0x42')](db[_0xc2d2('0x2b')]['rawAttributes']);_0x386a39[_0xc2d2('0x30')]=_['keys'](_0x582edb[_0xc2d2('0x30')]);_0x386a39[_0xc2d2('0x31')]=_[_0xc2d2('0x32')](_0x386a39[_0xc2d2('0x2f')],_0x386a39[_0xc2d2('0x30')]);_0x2a987a[_0xc2d2('0x34')]=_['intersection'](_0x386a39[_0xc2d2('0x2f')],qs['fields'](_0x582edb[_0xc2d2('0x30')][_0xc2d2('0x33')]));_0x2a987a[_0xc2d2('0x34')]=_0x2a987a[_0xc2d2('0x34')][_0xc2d2('0x35')]?_0x2a987a['attributes']:_0x386a39[_0xc2d2('0x2f')];if(_0x582edb[_0xc2d2('0x30')]['includeAll']){_0x2a987a['include']=[{'all':!![]}];}_0x2a987a=_['merge']({},_0x2a987a,_0x582edb['options']);return db[_0xc2d2('0x2b')][_0xc2d2('0x43')](_0x2a987a)[_0xc2d2('0x24')](handleEntityNotFound(_0x24544e,null))[_0xc2d2('0x24')](respondWithResult(_0x24544e,null))[_0xc2d2('0x41')](handleError(_0x24544e,null));};exports[_0xc2d2('0x44')]=function(_0x1146cb,_0x3b795a){return db[_0xc2d2('0x2b')][_0xc2d2('0x44')](_0x1146cb[_0xc2d2('0x45')],{})[_0xc2d2('0x24')](respondWithResult(_0x3b795a,0xc9))['catch'](handleError(_0x3b795a,null));};exports[_0xc2d2('0x46')]=function(_0x4181dc,_0x572764){if(_0x4181dc[_0xc2d2('0x45')]['id']){delete _0x4181dc['body']['id'];}return db[_0xc2d2('0x2b')][_0xc2d2('0x43')]({'where':{'id':_0x4181dc[_0xc2d2('0x47')]['id']}})[_0xc2d2('0x24')](handleEntityNotFound(_0x572764,null))['then'](saveUpdates(_0x4181dc[_0xc2d2('0x45')],null))[_0xc2d2('0x24')](respondWithResult(_0x572764,null))[_0xc2d2('0x41')](handleError(_0x572764,null));};exports[_0xc2d2('0x25')]=function(_0x3b61ef,_0x4765f9){return db[_0xc2d2('0x2b')][_0xc2d2('0x43')]({'where':{'id':_0x3b61ef[_0xc2d2('0x47')]['id']}})['then'](handleEntityNotFound(_0x4765f9,null))['then'](removeEntity(_0x4765f9,null))[_0xc2d2('0x41')](handleError(_0x4765f9,null));};exports[_0xc2d2('0x48')]=function(_0x472299,_0x1827c3){return db[_0xc2d2('0x2b')]['describe']()[_0xc2d2('0x24')](respondWithResult(_0x1827c3,null))[_0xc2d2('0x41')](handleError(_0x1827c3,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 5b7da1e..e0d464a 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(_0x59342a,_0x16827b){var _0x17abc9=function(_0x2f7bfc){while(--_0x2f7bfc){_0x59342a['push'](_0x59342a['shift']());}};_0x17abc9(++_0x16827b);}(_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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x27380a,_0x11b4db){var _0x49557d=function(_0x11984a){while(--_0x11984a){_0x27380a['push'](_0x27380a['shift']());}};_0x49557d(++_0x11b4db);}(_0xe706,0xa3));var _0x6e70=function(_0x16270b,_0x4ff120){_0x16270b=_0x16270b-0x0;var _0x2cd122=_0xe706[_0x16270b];return _0x2cd122;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 3dd3c57..d8b501e 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 _0x988c=['CreateChatQueueReport','ChatQueueReport','create','options','UpdateChatQueueReport','update','body','raw','where','attributes','limit','lodash','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','result','catch'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x988c,0x19e));var _0xc988=function(_0x2e7c21,_0x461843){_0x2e7c21=_0x2e7c21-0x0;var _0x23d22f=_0x988c[_0x2e7c21];return _0x23d22f;};'use strict';var _=require(_0xc988('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc988('0x1'));var fs=require('fs');var Redis=require(_0xc988('0x2'));var db=require(_0xc988('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc988('0x4'));var jayson=require(_0xc988('0x5'));var client=jayson[_0xc988('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26e109,_0x14b586,_0x4e6f38){return new BPromise(function(_0x4e48db,_0x2a96ab){return client[_0xc988('0x7')](_0x26e109,_0x4e6f38)[_0xc988('0x8')](function(_0x271d0f){logger[_0xc988('0x9')]('ChatQueueReport,\x20%s,\x20%s',_0x14b586,_0xc988('0xa'));logger[_0xc988('0xb')](_0xc988('0xc'),_0x14b586,_0xc988('0xa'),JSON[_0xc988('0xd')](_0x271d0f));if(_0x271d0f['error']){if(_0x271d0f[_0xc988('0xe')][_0xc988('0xf')]===0x1f4){logger[_0xc988('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x14b586,_0x271d0f[_0xc988('0xe')]['message']);return _0x2a96ab(_0x271d0f[_0xc988('0xe')]['message']);}logger[_0xc988('0xe')](_0xc988('0x10'),_0x14b586,_0x271d0f[_0xc988('0xe')][_0xc988('0x11')]);return _0x4e48db(_0x271d0f['error'][_0xc988('0x11')]);}else{logger[_0xc988('0x9')](_0xc988('0x10'),_0x14b586,_0xc988('0xa'));_0x4e48db(_0x271d0f[_0xc988('0x12')][_0xc988('0x11')]);}})[_0xc988('0x13')](function(_0x35aebb){logger[_0xc988('0xe')](_0xc988('0x10'),_0x14b586,_0x35aebb);_0x2a96ab(_0x35aebb);});});}exports[_0xc988('0x14')]=function(_0x49738a){var _0x314a24=this;return new Promise(function(_0x23677f,_0x32319c){return db[_0xc988('0x15')][_0xc988('0x16')](_0x49738a['body'],{'raw':_0x49738a['options']?_0x49738a[_0xc988('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xc988('0x8')](function(_0x3cad71){logger['info']('CreateChatQueueReport',_0x49738a);logger[_0xc988('0xb')](_0xc988('0x14'),_0x49738a,JSON[_0xc988('0xd')](_0x3cad71));_0x23677f(_0x3cad71);})['catch'](function(_0xc5754d){logger[_0xc988('0xe')](_0xc988('0x14'),_0xc5754d['message'],_0x49738a);_0x32319c(_0x314a24[_0xc988('0xe')](0x1f4,_0xc5754d[_0xc988('0x11')]));});});};exports[_0xc988('0x18')]=function(_0x5b4555){var _0x5444a5=this;return new Promise(function(_0x343ac3,_0x3ca571){return db[_0xc988('0x15')][_0xc988('0x19')](_0x5b4555[_0xc988('0x1a')],{'raw':_0x5b4555[_0xc988('0x17')]?_0x5b4555[_0xc988('0x17')][_0xc988('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b4555['options']?_0x5b4555[_0xc988('0x17')][_0xc988('0x1c')]||null:null,'attributes':_0x5b4555[_0xc988('0x17')]?_0x5b4555[_0xc988('0x17')][_0xc988('0x1d')]||null:null,'limit':_0x5b4555[_0xc988('0x17')]?_0x5b4555[_0xc988('0x17')][_0xc988('0x1e')]||null:null})['then'](function(_0x2a0d6f){logger[_0xc988('0x9')](_0xc988('0x18'),_0x5b4555);logger[_0xc988('0xb')]('UpdateChatQueueReport',_0x5b4555,JSON['stringify'](_0x2a0d6f));_0x343ac3(_0x2a0d6f);})[_0xc988('0x13')](function(_0x11d51f){logger[_0xc988('0xe')]('UpdateChatQueueReport',_0x11d51f[_0xc988('0x11')],_0x5b4555);_0x3ca571(_0x5444a5[_0xc988('0xe')](0x1f4,_0x11d51f[_0xc988('0x11')]));});});}; \ No newline at end of file +var _0xf93d=['result','CreateChatQueueReport','create','body','options','raw','then','debug','catch','UpdateChatQueueReport','ChatQueueReport','update','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0xf93d,0x11f));var _0xdf93=function(_0x361b2f,_0x4f8972){_0x361b2f=_0x361b2f-0x0;var _0x23b8e5=_0xf93d[_0x361b2f];return _0x23b8e5;};'use strict';var _=require('lodash');var util=require(_0xdf93('0x0'));var moment=require(_0xdf93('0x1'));var BPromise=require(_0xdf93('0x2'));var rs=require(_0xdf93('0x3'));var fs=require('fs');var Redis=require(_0xdf93('0x4'));var db=require(_0xdf93('0x5'))['db'];var utils=require(_0xdf93('0x6'));var logger=require(_0xdf93('0x7'))(_0xdf93('0x8'));var config=require(_0xdf93('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdf93('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d356e,_0x5bde50,_0x3cb77b){return new BPromise(function(_0x3cbd61,_0x5b0828){return client[_0xdf93('0xb')](_0x4d356e,_0x3cb77b)['then'](function(_0x5837e6){logger[_0xdf93('0xc')](_0xdf93('0xd'),_0x5bde50,_0xdf93('0xe'));logger['debug']('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x5bde50,_0xdf93('0xe'),JSON[_0xdf93('0xf')](_0x5837e6));if(_0x5837e6[_0xdf93('0x10')]){if(_0x5837e6[_0xdf93('0x10')][_0xdf93('0x11')]===0x1f4){logger[_0xdf93('0x10')](_0xdf93('0xd'),_0x5bde50,_0x5837e6[_0xdf93('0x10')]['message']);return _0x5b0828(_0x5837e6[_0xdf93('0x10')][_0xdf93('0x12')]);}logger[_0xdf93('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x5bde50,_0x5837e6[_0xdf93('0x10')][_0xdf93('0x12')]);return _0x3cbd61(_0x5837e6['error']['message']);}else{logger[_0xdf93('0xc')](_0xdf93('0xd'),_0x5bde50,_0xdf93('0xe'));_0x3cbd61(_0x5837e6[_0xdf93('0x13')]['message']);}})['catch'](function(_0x541e5e){logger['error'](_0xdf93('0xd'),_0x5bde50,_0x541e5e);_0x5b0828(_0x541e5e);});});}exports[_0xdf93('0x14')]=function(_0x261035){var _0x490824=this;return new Promise(function(_0x44555d,_0x5f149f){return db['ChatQueueReport'][_0xdf93('0x15')](_0x261035[_0xdf93('0x16')],{'raw':_0x261035[_0xdf93('0x17')]?_0x261035['options'][_0xdf93('0x18')]===undefined?!![]:![]:!![]})[_0xdf93('0x19')](function(_0x184201){logger['info'](_0xdf93('0x14'),_0x261035);logger[_0xdf93('0x1a')](_0xdf93('0x14'),_0x261035,JSON[_0xdf93('0xf')](_0x184201));_0x44555d(_0x184201);})[_0xdf93('0x1b')](function(_0x1c4776){logger[_0xdf93('0x10')](_0xdf93('0x14'),_0x1c4776[_0xdf93('0x12')],_0x261035);_0x5f149f(_0x490824['error'](0x1f4,_0x1c4776['message']));});});};exports[_0xdf93('0x1c')]=function(_0x24a136){var _0x420622=this;return new Promise(function(_0x1f2cf0,_0x2528d9){return db[_0xdf93('0x1d')][_0xdf93('0x1e')](_0x24a136[_0xdf93('0x16')],{'raw':_0x24a136['options']?_0x24a136['options'][_0xdf93('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24a136[_0xdf93('0x17')]?_0x24a136[_0xdf93('0x17')][_0xdf93('0x1f')]||null:null,'attributes':_0x24a136[_0xdf93('0x17')]?_0x24a136[_0xdf93('0x17')][_0xdf93('0x20')]||null:null,'limit':_0x24a136[_0xdf93('0x17')]?_0x24a136[_0xdf93('0x17')][_0xdf93('0x21')]||null:null})['then'](function(_0xe3e7b1){logger[_0xdf93('0xc')](_0xdf93('0x1c'),_0x24a136);logger[_0xdf93('0x1a')](_0xdf93('0x1c'),_0x24a136,JSON[_0xdf93('0xf')](_0xe3e7b1));_0x1f2cf0(_0xe3e7b1);})[_0xdf93('0x1b')](function(_0x2d0e05){logger[_0xdf93('0x10')](_0xdf93('0x1c'),_0x2d0e05[_0xdf93('0x12')],_0x24a136);_0x2528d9(_0x420622[_0xdf93('0x10')](0x1f4,_0x2d0e05[_0xdf93('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 396737e..db29750 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 _0xc0a9=['post','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc0a9,0xf8));var _0x9c0a=function(_0x286bfb,_0x46ac3c){_0x286bfb=_0x286bfb-0x0;var _0x52b683=_0xc0a9[_0x286bfb];return _0x52b683;};'use strict';var multer=require(_0x9c0a('0x0'));var util=require(_0x9c0a('0x1'));var path=require(_0x9c0a('0x2'));var timeout=require('connect-timeout');var express=require(_0x9c0a('0x3'));var router=express[_0x9c0a('0x4')]();var fs_extra=require(_0x9c0a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9c0a('0x6'));var config=require(_0x9c0a('0x7'));var controller=require(_0x9c0a('0x8'));router[_0x9c0a('0x9')]('/',auth[_0x9c0a('0xa')](),controller[_0x9c0a('0xb')]);router[_0x9c0a('0x9')](_0x9c0a('0xc'),auth[_0x9c0a('0xa')](),controller[_0x9c0a('0xd')]);router[_0x9c0a('0x9')](_0x9c0a('0xe'),auth[_0x9c0a('0xa')](),controller[_0x9c0a('0xf')]);router[_0x9c0a('0x10')]('/',auth[_0x9c0a('0xa')](),controller['create']);router[_0x9c0a('0x11')](_0x9c0a('0xe'),auth['isAuthenticated'](),controller[_0x9c0a('0x12')]);router[_0x9c0a('0x13')](_0x9c0a('0xe'),auth[_0x9c0a('0xa')](),controller[_0x9c0a('0x14')]);module[_0x9c0a('0x15')]=router; \ No newline at end of file +var _0x0055=['index','describe','/:id','show','post','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated'];(function(_0x5dba16,_0x53efef){var _0x395e95=function(_0x10f469){while(--_0x10f469){_0x5dba16['push'](_0x5dba16['shift']());}};_0x395e95(++_0x53efef);}(_0x0055,0xda));var _0x5005=function(_0x2d1b06,_0x2bedf1){_0x2d1b06=_0x2d1b06-0x0;var _0x4fca05=_0x0055[_0x2d1b06];return _0x4fca05;};'use strict';var multer=require(_0x5005('0x0'));var util=require(_0x5005('0x1'));var path=require(_0x5005('0x2'));var timeout=require(_0x5005('0x3'));var express=require('express');var router=express[_0x5005('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5005('0x5'));var config=require(_0x5005('0x6'));var controller=require(_0x5005('0x7'));router[_0x5005('0x8')]('/',auth[_0x5005('0x9')](),controller[_0x5005('0xa')]);router[_0x5005('0x8')]('/describe',auth[_0x5005('0x9')](),controller[_0x5005('0xb')]);router[_0x5005('0x8')](_0x5005('0xc'),auth[_0x5005('0x9')](),controller[_0x5005('0xd')]);router[_0x5005('0xe')]('/',auth[_0x5005('0x9')](),controller['create']);router[_0x5005('0xf')](_0x5005('0xc'),auth['isAuthenticated'](),controller[_0x5005('0x10')]);router[_0x5005('0x11')](_0x5005('0xc'),auth[_0x5005('0x9')](),controller[_0x5005('0x12')]);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 1989bc0..6befdf6 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x4d521e,_0x58ba39){var _0x3beb42=function(_0x1a7bd2){while(--_0x1a7bd2){_0x4d521e['push'](_0x4d521e['shift']());}};_0x3beb42(++_0x58ba39);}(_0x9bde,0xe1));var _0xe9bd=function(_0x35d5ab,_0x5722a8){_0x35d5ab=_0x35d5ab-0x0;var _0x22b054=_0x9bde[_0x35d5ab];return _0x22b054;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x9bde,0xe1));var _0xe9bd=function(_0x5ec45f,_0x43afd7){_0x5ec45f=_0x5ec45f-0x0;var _0x511659=_0x9bde[_0x5ec45f];return _0x511659;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index a181244..886c483 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 _0x7c53=['request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir'];(function(_0x5cbce6,_0x5492b0){var _0x59732a=function(_0x38bebc){while(--_0x38bebc){_0x5cbce6['push'](_0x5cbce6['shift']());}};_0x59732a(++_0x5492b0);}(_0x7c53,0x1dd));var _0x37c5=function(_0x43419a,_0x5b5768){_0x43419a=_0x43419a-0x0;var _0x493bb9=_0x7c53[_0x43419a];return _0x493bb9;};'use strict';var emlformat=require(_0x37c5('0x0'));var rimraf=require(_0x37c5('0x1'));var zipdir=require(_0x37c5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x37c5('0x3'));var moment=require(_0x37c5('0x4'));var BPromise=require(_0x37c5('0x5'));var Mustache=require(_0x37c5('0x6'));var util=require('util');var path=require('path');var sox=require(_0x37c5('0x7'));var csv=require('to-csv');var ejs=require(_0x37c5('0x8'));var fs=require('fs');var fs_extra=require(_0x37c5('0x9'));var _=require(_0x37c5('0xa'));var squel=require(_0x37c5('0xb'));var crypto=require('crypto');var jsforce=require(_0x37c5('0xc'));var deskjs=require(_0x37c5('0xd'));var toCsv=require(_0x37c5('0xe'));var querystring=require(_0x37c5('0xf'));var Papa=require('papaparse');var Redis=require(_0x37c5('0x10'));var authService=require(_0x37c5('0x11'));var qs=require(_0x37c5('0x12'));var as=require(_0x37c5('0x13'));var hardwareService=require(_0x37c5('0x14'));var logger=require(_0x37c5('0x15'))(_0x37c5('0x16'));var utils=require(_0x37c5('0x17'));var config=require(_0x37c5('0x18'));var licenseUtil=require(_0x37c5('0x19'));var db=require(_0x37c5('0x1a'))['db'];function respondWithStatusCode(_0x1bd6e2,_0x15f458){_0x15f458=_0x15f458||0xcc;return function(_0x17c6a7){if(_0x17c6a7){return _0x1bd6e2[_0x37c5('0x1b')](_0x15f458);}return _0x1bd6e2[_0x37c5('0x1c')](_0x15f458)[_0x37c5('0x1d')]();};}function respondWithResult(_0x1c3aa7,_0x39259c){_0x39259c=_0x39259c||0xc8;return function(_0x1623e8){if(_0x1623e8){return _0x1c3aa7['status'](_0x39259c)[_0x37c5('0x1e')](_0x1623e8);}};}function respondWithFilteredResult(_0xadec39,_0x52f5b2){return function(_0xa3942e){if(_0xa3942e){var _0x31ffd3=typeof _0x52f5b2[_0x37c5('0x1f')]===_0x37c5('0x20')&&typeof _0x52f5b2[_0x37c5('0x21')]==='undefined';var _0x3f258a=_0xa3942e['count'];var _0x2ceefb=_0x31ffd3?0x0:_0x52f5b2[_0x37c5('0x1f')];var _0x256152=_0x31ffd3?_0xa3942e[_0x37c5('0x22')]:_0x52f5b2[_0x37c5('0x1f')]+_0x52f5b2[_0x37c5('0x21')];var _0x16e02c;if(_0x256152>=_0x3f258a){_0x256152=_0x3f258a;_0x16e02c=0xc8;}else{_0x16e02c=0xce;}_0xadec39[_0x37c5('0x1c')](_0x16e02c);return _0xadec39[_0x37c5('0x23')](_0x37c5('0x24'),_0x2ceefb+'-'+_0x256152+'/'+_0x3f258a)[_0x37c5('0x1e')](_0xa3942e);}return null;};}function patchUpdates(_0x57b54e){return function(_0x55fd5f){try{jsonpatch[_0x37c5('0x25')](_0x55fd5f,_0x57b54e,!![]);}catch(_0x35cd83){return BPromise[_0x37c5('0x26')](_0x35cd83);}return _0x55fd5f['save']();};}function saveUpdates(_0x42c9b1,_0x5827b5){return function(_0xeaf79e){if(_0xeaf79e){return _0xeaf79e[_0x37c5('0x27')](_0x42c9b1)[_0x37c5('0x28')](function(_0x14288c){return _0x14288c;});}return null;};}function removeEntity(_0xa2e2e3,_0x4a6b5e){return function(_0x2d5241){if(_0x2d5241){return _0x2d5241['destroy']()[_0x37c5('0x28')](function(){_0xa2e2e3[_0x37c5('0x1c')](0xcc)[_0x37c5('0x1d')]();});}};}function handleEntityNotFound(_0x3a6b7c,_0xdf5738){return function(_0x1808e6){if(!_0x1808e6){_0x3a6b7c[_0x37c5('0x1b')](0x194);}return _0x1808e6;};}function handleError(_0x11252f,_0x2e9546){_0x2e9546=_0x2e9546||0x1f4;return function(_0x240464){logger['error'](_0x240464['stack']);if(_0x240464[_0x37c5('0x29')]){delete _0x240464[_0x37c5('0x29')];}_0x11252f['status'](_0x2e9546)[_0x37c5('0x2a')](_0x240464);};}exports[_0x37c5('0x2b')]=function(_0x3644f7,_0x19f408){var _0x2510aa={},_0x5061ac={},_0x59a246={'count':0x0,'rows':[]};var _0x226bb9=_[_0x37c5('0x2c')](db[_0x37c5('0x2d')][_0x37c5('0x2e')],function(_0xb373ab){return{'name':_0xb373ab[_0x37c5('0x2f')],'type':_0xb373ab['type'][_0x37c5('0x30')]};});_0x5061ac[_0x37c5('0x31')]=_[_0x37c5('0x2c')](_0x226bb9,'name');_0x5061ac[_0x37c5('0x32')]=_[_0x37c5('0x33')](_0x3644f7[_0x37c5('0x32')]);_0x5061ac[_0x37c5('0x34')]=_[_0x37c5('0x35')](_0x5061ac[_0x37c5('0x31')],_0x5061ac[_0x37c5('0x32')]);_0x2510aa['attributes']=_['intersection'](_0x5061ac[_0x37c5('0x31')],qs[_0x37c5('0x36')](_0x3644f7['query']['fields']));_0x2510aa['attributes']=_0x2510aa[_0x37c5('0x37')][_0x37c5('0x38')]?_0x2510aa['attributes']:_0x5061ac[_0x37c5('0x31')];if(!_0x3644f7[_0x37c5('0x32')][_0x37c5('0x39')](_0x37c5('0x3a'))){_0x2510aa[_0x37c5('0x21')]=qs[_0x37c5('0x21')](_0x3644f7[_0x37c5('0x32')][_0x37c5('0x21')]);_0x2510aa['offset']=qs[_0x37c5('0x1f')](_0x3644f7['query'][_0x37c5('0x1f')]);}_0x2510aa[_0x37c5('0x3b')]=qs['sort'](_0x3644f7[_0x37c5('0x32')][_0x37c5('0x3c')]);_0x2510aa['where']=qs[_0x37c5('0x34')](_[_0x37c5('0x3d')](_0x3644f7['query'],_0x5061ac[_0x37c5('0x34')]),_0x226bb9);if(_0x3644f7['query'][_0x37c5('0x3e')]){_0x2510aa[_0x37c5('0x3f')]=_[_0x37c5('0x40')](_0x2510aa[_0x37c5('0x3f')],{'$or':_[_0x37c5('0x2c')](_0x226bb9,function(_0x129bcf){if(_0x129bcf[_0x37c5('0x41')]!==_0x37c5('0x42')){var _0x285b7a={};_0x285b7a[_0x129bcf[_0x37c5('0x29')]]={'$like':'%'+_0x3644f7['query']['filter']+'%'};return _0x285b7a;}})});}_0x2510aa=_[_0x37c5('0x40')]({},_0x2510aa,_0x3644f7[_0x37c5('0x43')]);var _0x1779b2={'where':_0x2510aa[_0x37c5('0x3f')]};return db[_0x37c5('0x2d')][_0x37c5('0x22')](_0x1779b2)['then'](function(_0x2951f4){_0x59a246[_0x37c5('0x22')]=_0x2951f4;if(_0x3644f7[_0x37c5('0x32')][_0x37c5('0x44')]){_0x2510aa[_0x37c5('0x45')]=[{'all':!![]}];}return db[_0x37c5('0x2d')][_0x37c5('0x46')](_0x2510aa);})[_0x37c5('0x28')](function(_0x18d9be){_0x59a246[_0x37c5('0x47')]=_0x18d9be;return _0x59a246;})[_0x37c5('0x28')](respondWithFilteredResult(_0x19f408,_0x2510aa))['catch'](handleError(_0x19f408,null));};exports[_0x37c5('0x48')]=function(_0x5b45d8,_0x100be1){var _0x20f575={'raw':!![],'where':{'id':_0x5b45d8[_0x37c5('0x49')]['id']}},_0x1886d9={};_0x1886d9[_0x37c5('0x31')]=_[_0x37c5('0x33')](db['ChatTransferReport'][_0x37c5('0x2e')]);_0x1886d9[_0x37c5('0x32')]=_[_0x37c5('0x33')](_0x5b45d8['query']);_0x1886d9[_0x37c5('0x34')]=_[_0x37c5('0x35')](_0x1886d9['model'],_0x1886d9['query']);_0x20f575[_0x37c5('0x37')]=_[_0x37c5('0x35')](_0x1886d9[_0x37c5('0x31')],qs['fields'](_0x5b45d8[_0x37c5('0x32')][_0x37c5('0x36')]));_0x20f575[_0x37c5('0x37')]=_0x20f575[_0x37c5('0x37')][_0x37c5('0x38')]?_0x20f575['attributes']:_0x1886d9[_0x37c5('0x31')];if(_0x5b45d8[_0x37c5('0x32')][_0x37c5('0x44')]){_0x20f575[_0x37c5('0x45')]=[{'all':!![]}];}_0x20f575=_[_0x37c5('0x40')]({},_0x20f575,_0x5b45d8['options']);return db['ChatTransferReport'][_0x37c5('0x4a')](_0x20f575)['then'](handleEntityNotFound(_0x100be1,null))[_0x37c5('0x28')](respondWithResult(_0x100be1,null))[_0x37c5('0x4b')](handleError(_0x100be1,null));};exports[_0x37c5('0x4c')]=function(_0x379c05,_0x58a6ab){return db[_0x37c5('0x2d')][_0x37c5('0x4c')](_0x379c05[_0x37c5('0x4d')],{})[_0x37c5('0x28')](respondWithResult(_0x58a6ab,0xc9))[_0x37c5('0x4b')](handleError(_0x58a6ab,null));};exports['update']=function(_0x4990be,_0x389c4d){if(_0x4990be[_0x37c5('0x4d')]['id']){delete _0x4990be[_0x37c5('0x4d')]['id'];}return db[_0x37c5('0x2d')][_0x37c5('0x4a')]({'where':{'id':_0x4990be[_0x37c5('0x49')]['id']}})['then'](handleEntityNotFound(_0x389c4d,null))[_0x37c5('0x28')](saveUpdates(_0x4990be[_0x37c5('0x4d')],null))[_0x37c5('0x28')](respondWithResult(_0x389c4d,null))['catch'](handleError(_0x389c4d,null));};exports[_0x37c5('0x4e')]=function(_0x5c4abe,_0x31065d){return db['ChatTransferReport'][_0x37c5('0x4a')]({'where':{'id':_0x5c4abe[_0x37c5('0x49')]['id']}})[_0x37c5('0x28')](handleEntityNotFound(_0x31065d,null))['then'](removeEntity(_0x31065d,null))[_0x37c5('0x4b')](handleError(_0x31065d,null));};exports[_0x37c5('0x4f')]=function(_0x30a20b,_0x2fd266){return db['ChatTransferReport'][_0x37c5('0x4f')]()[_0x37c5('0x28')](respondWithResult(_0x2fd266,null))[_0x37c5('0x4b')](handleError(_0x2fd266,null));}; \ No newline at end of file +var _0x4e9f=['params','keys','length','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','limit','undefined','count','set','Content-Range','json','apply','save','then','destroy','end','sendStatus','error','name','index','map','ChatTransferReport','rawAttributes','type','model','query','intersection','fields','attributes','hasOwnProperty','offset','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','show'];(function(_0x52723d,_0x204a82){var _0x4c81fa=function(_0x2bff29){while(--_0x2bff29){_0x52723d['push'](_0x52723d['shift']());}};_0x4c81fa(++_0x204a82);}(_0x4e9f,0x16b));var _0xf4e9=function(_0x4e121b,_0x3a821f){_0x4e121b=_0x4e121b-0x0;var _0x518683=_0x4e9f[_0x4e121b];return _0x518683;};'use strict';var emlformat=require(_0xf4e9('0x0'));var rimraf=require(_0xf4e9('0x1'));var zipdir=require(_0xf4e9('0x2'));var jsonpatch=require(_0xf4e9('0x3'));var rp=require(_0xf4e9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf4e9('0x5'));var util=require('util');var path=require(_0xf4e9('0x6'));var sox=require(_0xf4e9('0x7'));var csv=require(_0xf4e9('0x8'));var ejs=require(_0xf4e9('0x9'));var fs=require('fs');var fs_extra=require(_0xf4e9('0xa'));var _=require(_0xf4e9('0xb'));var squel=require(_0xf4e9('0xc'));var crypto=require(_0xf4e9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf4e9('0xe'));var toCsv=require(_0xf4e9('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf4e9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf4e9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf4e9('0x11'));var logger=require(_0xf4e9('0x12'))(_0xf4e9('0x13'));var utils=require(_0xf4e9('0x14'));var config=require(_0xf4e9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf4e9('0x16'))['db'];function respondWithStatusCode(_0x4a6a08,_0x5aa4d7){_0x5aa4d7=_0x5aa4d7||0xcc;return function(_0x6d4b73){if(_0x6d4b73){return _0x4a6a08['sendStatus'](_0x5aa4d7);}return _0x4a6a08[_0xf4e9('0x17')](_0x5aa4d7)['end']();};}function respondWithResult(_0x10b7f9,_0x5135bb){_0x5135bb=_0x5135bb||0xc8;return function(_0x43cf88){if(_0x43cf88){return _0x10b7f9[_0xf4e9('0x17')](_0x5135bb)['json'](_0x43cf88);}};}function respondWithFilteredResult(_0x28b5b8,_0x486380){return function(_0x2908bd){if(_0x2908bd){var _0xcd41b2=typeof _0x486380['offset']==='undefined'&&typeof _0x486380[_0xf4e9('0x18')]===_0xf4e9('0x19');var _0x761b03=_0x2908bd[_0xf4e9('0x1a')];var _0x11c1d2=_0xcd41b2?0x0:_0x486380['offset'];var _0x2ee4ea=_0xcd41b2?_0x2908bd[_0xf4e9('0x1a')]:_0x486380['offset']+_0x486380[_0xf4e9('0x18')];var _0x2526c6;if(_0x2ee4ea>=_0x761b03){_0x2ee4ea=_0x761b03;_0x2526c6=0xc8;}else{_0x2526c6=0xce;}_0x28b5b8[_0xf4e9('0x17')](_0x2526c6);return _0x28b5b8[_0xf4e9('0x1b')](_0xf4e9('0x1c'),_0x11c1d2+'-'+_0x2ee4ea+'/'+_0x761b03)[_0xf4e9('0x1d')](_0x2908bd);}return null;};}function patchUpdates(_0x52f9dc){return function(_0x33f2d8){try{jsonpatch[_0xf4e9('0x1e')](_0x33f2d8,_0x52f9dc,!![]);}catch(_0x2684f0){return BPromise['reject'](_0x2684f0);}return _0x33f2d8[_0xf4e9('0x1f')]();};}function saveUpdates(_0x1355d7,_0x491874){return function(_0x68417c){if(_0x68417c){return _0x68417c['update'](_0x1355d7)[_0xf4e9('0x20')](function(_0x106ca3){return _0x106ca3;});}return null;};}function removeEntity(_0x40a10c,_0x1aed7a){return function(_0x2b3116){if(_0x2b3116){return _0x2b3116[_0xf4e9('0x21')]()[_0xf4e9('0x20')](function(){_0x40a10c[_0xf4e9('0x17')](0xcc)[_0xf4e9('0x22')]();});}};}function handleEntityNotFound(_0x12e95b,_0x5a41cd){return function(_0x3e2121){if(!_0x3e2121){_0x12e95b[_0xf4e9('0x23')](0x194);}return _0x3e2121;};}function handleError(_0x1544b9,_0x34fc0d){_0x34fc0d=_0x34fc0d||0x1f4;return function(_0x2405c0){logger[_0xf4e9('0x24')](_0x2405c0['stack']);if(_0x2405c0['name']){delete _0x2405c0[_0xf4e9('0x25')];}_0x1544b9[_0xf4e9('0x17')](_0x34fc0d)['send'](_0x2405c0);};}exports[_0xf4e9('0x26')]=function(_0x218bf6,_0x41de85){var _0x77d0ff={},_0x48a042={},_0x2449f7={'count':0x0,'rows':[]};var _0x1d8b3b=_[_0xf4e9('0x27')](db[_0xf4e9('0x28')][_0xf4e9('0x29')],function(_0x2d9261){return{'name':_0x2d9261['fieldName'],'type':_0x2d9261[_0xf4e9('0x2a')]['key']};});_0x48a042[_0xf4e9('0x2b')]=_[_0xf4e9('0x27')](_0x1d8b3b,_0xf4e9('0x25'));_0x48a042[_0xf4e9('0x2c')]=_['keys'](_0x218bf6[_0xf4e9('0x2c')]);_0x48a042['filters']=_['intersection'](_0x48a042['model'],_0x48a042[_0xf4e9('0x2c')]);_0x77d0ff['attributes']=_[_0xf4e9('0x2d')](_0x48a042[_0xf4e9('0x2b')],qs[_0xf4e9('0x2e')](_0x218bf6[_0xf4e9('0x2c')][_0xf4e9('0x2e')]));_0x77d0ff[_0xf4e9('0x2f')]=_0x77d0ff['attributes']['length']?_0x77d0ff[_0xf4e9('0x2f')]:_0x48a042[_0xf4e9('0x2b')];if(!_0x218bf6[_0xf4e9('0x2c')][_0xf4e9('0x30')]('nolimit')){_0x77d0ff['limit']=qs['limit'](_0x218bf6[_0xf4e9('0x2c')][_0xf4e9('0x18')]);_0x77d0ff[_0xf4e9('0x31')]=qs[_0xf4e9('0x31')](_0x218bf6[_0xf4e9('0x2c')][_0xf4e9('0x31')]);}_0x77d0ff[_0xf4e9('0x32')]=qs[_0xf4e9('0x33')](_0x218bf6[_0xf4e9('0x2c')]['sort']);_0x77d0ff[_0xf4e9('0x34')]=qs[_0xf4e9('0x35')](_[_0xf4e9('0x36')](_0x218bf6[_0xf4e9('0x2c')],_0x48a042[_0xf4e9('0x35')]),_0x1d8b3b);if(_0x218bf6[_0xf4e9('0x2c')][_0xf4e9('0x37')]){_0x77d0ff[_0xf4e9('0x34')]=_[_0xf4e9('0x38')](_0x77d0ff[_0xf4e9('0x34')],{'$or':_['map'](_0x1d8b3b,function(_0x40ee73){if(_0x40ee73[_0xf4e9('0x2a')]!=='VIRTUAL'){var _0x3d9c86={};_0x3d9c86[_0x40ee73[_0xf4e9('0x25')]]={'$like':'%'+_0x218bf6[_0xf4e9('0x2c')]['filter']+'%'};return _0x3d9c86;}})});}_0x77d0ff=_[_0xf4e9('0x38')]({},_0x77d0ff,_0x218bf6[_0xf4e9('0x39')]);var _0x3ff54f={'where':_0x77d0ff[_0xf4e9('0x34')]};return db[_0xf4e9('0x28')][_0xf4e9('0x1a')](_0x3ff54f)[_0xf4e9('0x20')](function(_0x22790d){_0x2449f7[_0xf4e9('0x1a')]=_0x22790d;if(_0x218bf6[_0xf4e9('0x2c')]['includeAll']){_0x77d0ff[_0xf4e9('0x3a')]=[{'all':!![]}];}return db['ChatTransferReport'][_0xf4e9('0x3b')](_0x77d0ff);})[_0xf4e9('0x20')](function(_0xb63921){_0x2449f7[_0xf4e9('0x3c')]=_0xb63921;return _0x2449f7;})[_0xf4e9('0x20')](respondWithFilteredResult(_0x41de85,_0x77d0ff))[_0xf4e9('0x3d')](handleError(_0x41de85,null));};exports[_0xf4e9('0x3e')]=function(_0x32af0e,_0x10e9cb){var _0x42b91c={'raw':!![],'where':{'id':_0x32af0e[_0xf4e9('0x3f')]['id']}},_0x23ca6={};_0x23ca6[_0xf4e9('0x2b')]=_[_0xf4e9('0x40')](db[_0xf4e9('0x28')][_0xf4e9('0x29')]);_0x23ca6[_0xf4e9('0x2c')]=_[_0xf4e9('0x40')](_0x32af0e[_0xf4e9('0x2c')]);_0x23ca6['filters']=_[_0xf4e9('0x2d')](_0x23ca6['model'],_0x23ca6[_0xf4e9('0x2c')]);_0x42b91c[_0xf4e9('0x2f')]=_[_0xf4e9('0x2d')](_0x23ca6[_0xf4e9('0x2b')],qs['fields'](_0x32af0e[_0xf4e9('0x2c')][_0xf4e9('0x2e')]));_0x42b91c['attributes']=_0x42b91c[_0xf4e9('0x2f')][_0xf4e9('0x41')]?_0x42b91c[_0xf4e9('0x2f')]:_0x23ca6[_0xf4e9('0x2b')];if(_0x32af0e[_0xf4e9('0x2c')]['includeAll']){_0x42b91c[_0xf4e9('0x3a')]=[{'all':!![]}];}_0x42b91c=_[_0xf4e9('0x38')]({},_0x42b91c,_0x32af0e[_0xf4e9('0x39')]);return db[_0xf4e9('0x28')]['find'](_0x42b91c)[_0xf4e9('0x20')](handleEntityNotFound(_0x10e9cb,null))[_0xf4e9('0x20')](respondWithResult(_0x10e9cb,null))[_0xf4e9('0x3d')](handleError(_0x10e9cb,null));};exports[_0xf4e9('0x42')]=function(_0x4b9497,_0x31d08f){return db[_0xf4e9('0x28')][_0xf4e9('0x42')](_0x4b9497[_0xf4e9('0x43')],{})['then'](respondWithResult(_0x31d08f,0xc9))['catch'](handleError(_0x31d08f,null));};exports[_0xf4e9('0x44')]=function(_0x1182e8,_0x5385c3){if(_0x1182e8[_0xf4e9('0x43')]['id']){delete _0x1182e8[_0xf4e9('0x43')]['id'];}return db[_0xf4e9('0x28')][_0xf4e9('0x45')]({'where':{'id':_0x1182e8[_0xf4e9('0x3f')]['id']}})[_0xf4e9('0x20')](handleEntityNotFound(_0x5385c3,null))[_0xf4e9('0x20')](saveUpdates(_0x1182e8[_0xf4e9('0x43')],null))[_0xf4e9('0x20')](respondWithResult(_0x5385c3,null))[_0xf4e9('0x3d')](handleError(_0x5385c3,null));};exports[_0xf4e9('0x21')]=function(_0x4f07c6,_0x4cbae3){return db[_0xf4e9('0x28')][_0xf4e9('0x45')]({'where':{'id':_0x4f07c6[_0xf4e9('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4cbae3,null))[_0xf4e9('0x20')](removeEntity(_0x4cbae3,null))[_0xf4e9('0x3d')](handleError(_0x4cbae3,null));};exports[_0xf4e9('0x46')]=function(_0xc52199,_0x244017){return db[_0xf4e9('0x28')][_0xf4e9('0x46')]()[_0xf4e9('0x20')](respondWithResult(_0x244017,null))[_0xf4e9('0x3d')](handleError(_0x244017,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 309adce..8569435 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 _0xd3bc=['report_chat_transfer','uniqueid','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','define','ChatTransferReport'];(function(_0x5a27e8,_0x492a2f){var _0x4e38f7=function(_0x2a4048){while(--_0x2a4048){_0x5a27e8['push'](_0x5a27e8['shift']());}};_0x4e38f7(++_0x492a2f);}(_0xd3bc,0x9e));var _0xcd3b=function(_0x1f3708,_0x57266e){_0x1f3708=_0x1f3708-0x0;var _0x36f290=_0xd3bc[_0x1f3708];return _0x36f290;};'use strict';var _=require(_0xcd3b('0x0'));var util=require('util');var logger=require(_0xcd3b('0x1'))('api');var moment=require('moment');var BPromise=require(_0xcd3b('0x2'));var rp=require(_0xcd3b('0x3'));var fs=require('fs');var path=require(_0xcd3b('0x4'));var rimraf=require(_0xcd3b('0x5'));var config=require(_0xcd3b('0x6'));var attributes=require(_0xcd3b('0x7'));module['exports']=function(_0x18bd94,_0x422b86){return _0x18bd94[_0xcd3b('0x8')](_0xcd3b('0x9'),attributes,{'tableName':_0xcd3b('0xa'),'paranoid':![],'indexes':[{'name':_0xcd3b('0xb'),'fields':[_0xcd3b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x285f=['./chatTransferReport.attributes','exports','define','report_chat_transfer','uniqueid','util','api','moment','request-promise','../../config/environment'];(function(_0x284f11,_0x3b822a){var _0x3777d3=function(_0x4b29f3){while(--_0x4b29f3){_0x284f11['push'](_0x284f11['shift']());}};_0x3777d3(++_0x3b822a);}(_0x285f,0x195));var _0xf285=function(_0xe5c56d,_0x262b10){_0xe5c56d=_0xe5c56d-0x0;var _0x35d3b8=_0x285f[_0xe5c56d];return _0x35d3b8;};'use strict';var _=require('lodash');var util=require(_0xf285('0x0'));var logger=require('../../config/logger')(_0xf285('0x1'));var moment=require(_0xf285('0x2'));var BPromise=require('bluebird');var rp=require(_0xf285('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf285('0x4'));var attributes=require(_0xf285('0x5'));module[_0xf285('0x6')]=function(_0x2966a0,_0x1c1f03){return _0x2966a0[_0xf285('0x7')]('ChatTransferReport',attributes,{'tableName':_0xf285('0x8'),'paranoid':![],'indexes':[{'name':_0xf285('0x9'),'fields':[_0xf285('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 5d9d41f..cfe58b8 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 _0x4ec6=['error','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0x4ec6,0x1e6));var _0x64ec=function(_0x2d1fe6,_0x280692){_0x2d1fe6=_0x2d1fe6-0x0;var _0x56d315=_0x4ec6[_0x2d1fe6];return _0x56d315;};'use strict';var _=require(_0x64ec('0x0'));var util=require(_0x64ec('0x1'));var moment=require('moment');var BPromise=require(_0x64ec('0x2'));var rs=require(_0x64ec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x64ec('0x4'))['db'];var utils=require(_0x64ec('0x5'));var logger=require(_0x64ec('0x6'))(_0x64ec('0x7'));var config=require('../../config/environment');var jayson=require(_0x64ec('0x8'));var client=jayson[_0x64ec('0x9')][_0x64ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd2aa42,_0x4b3795,_0x198dbe){return new BPromise(function(_0x42d081,_0xbcf74a){return client[_0x64ec('0xb')](_0xd2aa42,_0x198dbe)[_0x64ec('0xc')](function(_0x45dabf){logger[_0x64ec('0xd')](_0x64ec('0xe'),_0x4b3795,_0x64ec('0xf'));logger[_0x64ec('0x10')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x4b3795,_0x64ec('0xf'),JSON[_0x64ec('0x11')](_0x45dabf));if(_0x45dabf[_0x64ec('0x12')]){if(_0x45dabf[_0x64ec('0x12')]['code']===0x1f4){logger['error'](_0x64ec('0xe'),_0x4b3795,_0x45dabf['error'][_0x64ec('0x13')]);return _0xbcf74a(_0x45dabf['error'][_0x64ec('0x13')]);}logger[_0x64ec('0x12')](_0x64ec('0xe'),_0x4b3795,_0x45dabf['error'][_0x64ec('0x13')]);return _0x42d081(_0x45dabf['error']['message']);}else{logger[_0x64ec('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x4b3795,_0x64ec('0xf'));_0x42d081(_0x45dabf['result']['message']);}})[_0x64ec('0x14')](function(_0x504d20){logger[_0x64ec('0x12')](_0x64ec('0xe'),_0x4b3795,_0x504d20);_0xbcf74a(_0x504d20);});});} \ No newline at end of file +var _0x1be4=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x49dd7c,_0x5cbdd7){var _0x565117=function(_0x3ef347){while(--_0x3ef347){_0x49dd7c['push'](_0x49dd7c['shift']());}};_0x565117(++_0x5cbdd7);}(_0x1be4,0x1f2));var _0x41be=function(_0x555c17,_0x2e6c2a){_0x555c17=_0x555c17-0x0;var _0x15a073=_0x1be4[_0x555c17];return _0x15a073;};'use strict';var _=require(_0x41be('0x0'));var util=require(_0x41be('0x1'));var moment=require(_0x41be('0x2'));var BPromise=require(_0x41be('0x3'));var rs=require(_0x41be('0x4'));var fs=require('fs');var Redis=require(_0x41be('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x41be('0x6'));var logger=require(_0x41be('0x7'))(_0x41be('0x8'));var config=require(_0x41be('0x9'));var jayson=require(_0x41be('0xa'));var client=jayson[_0x41be('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x221c36,_0x41fcdb,_0x4b16f9){return new BPromise(function(_0x24b241,_0x4d2398){return client[_0x41be('0xc')](_0x221c36,_0x4b16f9)[_0x41be('0xd')](function(_0x503229){logger[_0x41be('0xe')](_0x41be('0xf'),_0x41fcdb,_0x41be('0x10'));logger[_0x41be('0x11')](_0x41be('0x12'),_0x41fcdb,'request\x20sent',JSON[_0x41be('0x13')](_0x503229));if(_0x503229[_0x41be('0x14')]){if(_0x503229['error'][_0x41be('0x15')]===0x1f4){logger[_0x41be('0x14')](_0x41be('0xf'),_0x41fcdb,_0x503229[_0x41be('0x14')]['message']);return _0x4d2398(_0x503229[_0x41be('0x14')]['message']);}logger[_0x41be('0x14')](_0x41be('0xf'),_0x41fcdb,_0x503229[_0x41be('0x14')][_0x41be('0x16')]);return _0x24b241(_0x503229['error'][_0x41be('0x16')]);}else{logger[_0x41be('0xe')](_0x41be('0xf'),_0x41fcdb,_0x41be('0x10'));_0x24b241(_0x503229[_0x41be('0x17')][_0x41be('0x16')]);}})[_0x41be('0x18')](function(_0x4026ee){logger[_0x41be('0x14')]('ChatTransferReport,\x20%s,\x20%s',_0x41fcdb,_0x4026ee);_0x4d2398(_0x4026ee);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index a961300..0c62bb6 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 _0xe100=['post','create','put','delete','/:id','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x258777,_0x3b6a9e){var _0x541ec9=function(_0x2371d1){while(--_0x2371d1){_0x258777['push'](_0x258777['shift']());}};_0x541ec9(++_0x3b6a9e);}(_0xe100,0x193));var _0x0e10=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe100[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x0e10('0x0'));var util=require(_0x0e10('0x1'));var path=require(_0x0e10('0x2'));var timeout=require('connect-timeout');var express=require(_0x0e10('0x3'));var router=express[_0x0e10('0x4')]();var fs_extra=require(_0x0e10('0x5'));var auth=require(_0x0e10('0x6'));var interaction=require(_0x0e10('0x7'));var config=require(_0x0e10('0x8'));var controller=require(_0x0e10('0x9'));router['get']('/',auth[_0x0e10('0xa')](),controller[_0x0e10('0xb')]);router[_0x0e10('0xc')](_0x0e10('0xd'),auth[_0x0e10('0xa')](),controller[_0x0e10('0xe')]);router[_0x0e10('0xc')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x0e10('0xf')]('/',auth[_0x0e10('0xa')](),controller[_0x0e10('0x10')]);router[_0x0e10('0x11')]('/:id',auth[_0x0e10('0xa')](),controller['update']);router[_0x0e10('0x12')](_0x0e10('0x13'),auth[_0x0e10('0xa')](),controller[_0x0e10('0x14')]);module[_0x0e10('0x15')]=router; \ No newline at end of file +var _0x7323=['/describe','describe','get','show','post','create','delete','/:id','destroy','exports','util','path','connect-timeout','express','fs-extra','../../config/environment','./chatTransferReport.controller','isAuthenticated','index'];(function(_0x21c006,_0x3fc31b){var _0xcf5698=function(_0x4168fb){while(--_0x4168fb){_0x21c006['push'](_0x21c006['shift']());}};_0xcf5698(++_0x3fc31b);}(_0x7323,0x1bf));var _0x3732=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x7323[_0x2bf141];return _0x48277b;};'use strict';var multer=require('multer');var util=require(_0x3732('0x0'));var path=require(_0x3732('0x1'));var timeout=require(_0x3732('0x2'));var express=require(_0x3732('0x3'));var router=express['Router']();var fs_extra=require(_0x3732('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3732('0x5'));var controller=require(_0x3732('0x6'));router['get']('/',auth[_0x3732('0x7')](),controller[_0x3732('0x8')]);router['get'](_0x3732('0x9'),auth['isAuthenticated'](),controller[_0x3732('0xa')]);router[_0x3732('0xb')]('/:id',auth[_0x3732('0x7')](),controller[_0x3732('0xc')]);router[_0x3732('0xd')]('/',auth[_0x3732('0x7')](),controller[_0x3732('0xe')]);router['put']('/:id',auth[_0x3732('0x7')](),controller['update']);router[_0x3732('0xf')](_0x3732('0x10'),auth[_0x3732('0x7')](),controller[_0x3732('0x11')]);module[_0x3732('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 558cdf5..ed031bb 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 _0x1216=['We\x20are\x20here!','Chat','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','ENUM','thumb','stringify','input','name','getDataValue','onlineForm','parse','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','website_alias','bottom_right','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','exports','STRING','address','email','#011F6A','#ffffff','INTEGER','BOOLEAN','rounded','squared'];(function(_0x58b19d,_0x160b9e){var _0x3a77b8=function(_0x2640e9){while(--_0x2640e9){_0x58b19d['push'](_0x58b19d['shift']());}};_0x3a77b8(++_0x160b9e);}(_0x1216,0x1c9));var _0x6121=function(_0x590ef7,_0x175f08){_0x590ef7=_0x590ef7-0x0;var _0x4c2634=_0x1216[_0x590ef7];return _0x4c2634;};'use strict';var Sequelize=require(_0x6121('0x0'));var rs=require('randomstring');module[_0x6121('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x6121('0x2')],'allowNull':![],'unique':_0x6121('0x3')},'description':{'type':Sequelize[_0x6121('0x2')]},'mapKey':{'type':Sequelize[_0x6121('0x2')],'defaultValue':_0x6121('0x4')},'mapKeyOffline':{'type':Sequelize[_0x6121('0x2')],'defaultValue':_0x6121('0x4')},'key':{'type':Sequelize[_0x6121('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x6121('0x2')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x6121('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x6121('0x2')],'allowNull':![],'defaultValue':_0x6121('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x6121('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x6121('0x2')],'allowNull':![],'defaultValue':_0x6121('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x6121('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x6121('0x2')]},'animation':{'type':Sequelize[_0x6121('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x6121('0x9'),_0x6121('0xa')),'defaultValue':_0x6121('0x9')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x6121('0xb')},'start_chat_button':{'type':Sequelize[_0x6121('0x2')],'defaultValue':_0x6121('0xc')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x6121('0x2')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x6121('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x6121('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x6121('0x2')],'defaultValue':_0x6121('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0x6121('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x6121('0xe')]},'closingQuestion':{'type':Sequelize[_0x6121('0x2')],'defaultValue':_0x6121('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x6121('0x2')],'defaultValue':_0x6121('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x6121('0x2')],'defaultValue':_0x6121('0x11')},'noteTitle':{'type':Sequelize[_0x6121('0x2')],'defaultValue':_0x6121('0x12')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6121('0x13')},'closingMessage':{'type':Sequelize[_0x6121('0x2')],'defaultValue':_0x6121('0x14')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x6121('0x15')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x6121('0x16')},'conditionAgreement':{'type':Sequelize[_0x6121('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x6121('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x6121('0x2')],'defaultValue':_0x6121('0x17')},'ratingType':{'type':Sequelize[_0x6121('0x18')]('star',_0x6121('0x19')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x6121('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x6121('0xe')],'defaultValue':function(){return JSON[_0x6121('0x1a')]({'items':[{'type':_0x6121('0x1b'),'variable':null,'config':{'placeholder':_0x6121('0x1c'),'type':'text','required':!![]},'props':{'title':_0x6121('0x1c'),'helpText':''}},{'type':'input','props':{'title':_0x6121('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x6121('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x6121('0x1d')](_0x6121('0x1e'))?JSON[_0x6121('0x1f')](this['getDataValue'](_0x6121('0x1e'))):{};},'set':function(_0x1a48ad){return this['setDataValue'](_0x6121('0x1e'),JSON[_0x6121('0x1a')](_0x1a48ad));}},'offlineForm':{'type':Sequelize[_0x6121('0xe')],'defaultValue':function(){return JSON[_0x6121('0x1a')]({'items':[{'type':'input','props':{'title':_0x6121('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x6121('0x4')},'variable':null},{'type':_0x6121('0x20'),'config':{'placeholder':_0x6121('0x21')},'props':{'title':'Comments','helpText':_0x6121('0x22')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x6121('0x23'))?JSON['parse'](this[_0x6121('0x1d')](_0x6121('0x23'))):{};},'set':function(_0x56b866){return this['setDataValue'](_0x6121('0x23'),JSON[_0x6121('0x1a')](_0x56b866));}},'token':{'type':Sequelize[_0x6121('0x2')],'defaultValue':function(){return rs[_0x6121('0x24')]();}},'autoclose':{'type':Sequelize[_0x6121('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x6121('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x6121('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x6121('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x6121('0x2')],'defaultValue':_0x6121('0x25')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6121('0x26')},'offlineMessageSubject':{'type':Sequelize[_0x6121('0x2')],'defaultValue':_0x6121('0x27')},'offlineMessageBody':{'type':Sequelize[_0x6121('0x2')],'defaultValue':_0x6121('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0x6121('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x6121('0x2')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x6121('0x16')},'sendUnmanaged':{'type':Sequelize[_0x6121('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x6121('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x6121('0xe')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x6121('0xe')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6121('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x6121('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x6121('0x2')],'defaultValue':_0x6121('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0x6121('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x6121('0x2')],'defaultValue':_0x6121('0x2a')},'verticalAlignment':{'type':Sequelize[_0x6121('0x7')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x6121('0x2b')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x6121('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x6121('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x6121('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6121('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x6121('0x2c')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6121('0x7')],'comment':_0x6121('0x2d')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x6121('0x2e'),'set':function(_0x498505){if(!_0x498505)this[_0x6121('0x2f')](_0x6121('0x30'),null);this[_0x6121('0x2f')](_0x6121('0x31'),_0x498505);}},'vidaooEscalation':{'type':Sequelize[_0x6121('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x6121('0x2')],'allowNull':![],'defaultValue':_0x6121('0x32')},'vidaooNote':{'type':Sequelize[_0x6121('0x2')],'defaultValue':function(){return _0x6121('0x33');}},'vidaooMetadata':{'type':Sequelize[_0x6121('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x6121('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x6121('0xe')]}}; \ No newline at end of file +var _0xdba0=['INTEGER','name','text','input','email','getDataValue','onlineForm','parse','setDataValue','stringify','Comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','exports','STRING','address','Agent','#011F6A','#ffffff','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','thumb'];(function(_0x3a0c4f,_0x5dd1a3){var _0x247049=function(_0x144695){while(--_0x144695){_0x3a0c4f['push'](_0x3a0c4f['shift']());}};_0x247049(++_0x5dd1a3);}(_0xdba0,0xe7));var _0x0dba=function(_0x43b584,_0x20a6bd){_0x43b584=_0x43b584-0x0;var _0x48f27b=_0xdba0[_0x43b584];return _0x48f27b;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x0dba('0x0')]={'name':{'type':Sequelize[_0x0dba('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x0dba('0x1')],'allowNull':![],'unique':_0x0dba('0x2')},'description':{'type':Sequelize[_0x0dba('0x1')]},'mapKey':{'type':Sequelize[_0x0dba('0x1')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':'email'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x0dba('0x1')],'defaultValue':_0x0dba('0x3')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x0dba('0x1')],'allowNull':![],'defaultValue':_0x0dba('0x4'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x0dba('0x1')],'allowNull':![],'defaultValue':_0x0dba('0x4'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x0dba('0x1')],'allowNull':![],'defaultValue':_0x0dba('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x0dba('0x1')]},'animation':{'type':Sequelize[_0x0dba('0x6')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x0dba('0x7')](_0x0dba('0x8'),_0x0dba('0x9')),'defaultValue':_0x0dba('0x8')},'header_online':{'type':Sequelize[_0x0dba('0x1')],'defaultValue':_0x0dba('0xa')},'start_chat_button':{'type':Sequelize[_0x0dba('0x1')],'defaultValue':_0x0dba('0xb')},'offline_chat_button':{'type':Sequelize[_0x0dba('0x1')],'defaultValue':_0x0dba('0xc')},'header_offline':{'type':Sequelize[_0x0dba('0x1')],'defaultValue':_0x0dba('0xd')},'download_transcript':{'type':Sequelize[_0x0dba('0x6')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x0dba('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x0dba('0x6')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x0dba('0xf')]},'closingQuestion':{'type':Sequelize[_0x0dba('0x1')],'defaultValue':_0x0dba('0x10')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x0dba('0x1')],'defaultValue':_0x0dba('0x11')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x0dba('0x12')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x0dba('0x13')},'closingMessage':{'type':Sequelize[_0x0dba('0x1')],'defaultValue':_0x0dba('0x14')},'closingMessageButton':{'type':Sequelize[_0x0dba('0x1')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x0dba('0x1')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x0dba('0x6')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x0dba('0x6')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x0dba('0x6')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x0dba('0x6')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x0dba('0x1')],'defaultValue':_0x0dba('0x15')},'ratingType':{'type':Sequelize[_0x0dba('0x7')](_0x0dba('0x16'),_0x0dba('0x17')),'defaultValue':_0x0dba('0x16')},'ratingStarsNumber':{'type':Sequelize[_0x0dba('0x18')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x0dba('0xf')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x0dba('0x19'),'type':_0x0dba('0x1a'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x0dba('0x1b'),'props':{'title':_0x0dba('0x1c'),'helpText':''},'config':{'required':!![],'placeholder':_0x0dba('0x1c'),'type':_0x0dba('0x1c')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x0dba('0x1d')](_0x0dba('0x1e'))?JSON[_0x0dba('0x1f')](this[_0x0dba('0x1d')](_0x0dba('0x1e'))):{};},'set':function(_0x4ce202){return this[_0x0dba('0x20')](_0x0dba('0x1e'),JSON[_0x0dba('0x21')](_0x4ce202));}},'offlineForm':{'type':Sequelize[_0x0dba('0xf')],'defaultValue':function(){return JSON[_0x0dba('0x21')]({'items':[{'type':_0x0dba('0x1b'),'props':{'title':_0x0dba('0x1c'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x0dba('0x1c')},'variable':null},{'type':'textarea','config':{'placeholder':_0x0dba('0x22')},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x0dba('0x1d')](_0x0dba('0x23'))?JSON[_0x0dba('0x1f')](this[_0x0dba('0x1d')](_0x0dba('0x23'))):{};},'set':function(_0x5d719e){return this['setDataValue'](_0x0dba('0x23'),JSON[_0x0dba('0x21')](_0x5d719e));}},'token':{'type':Sequelize[_0x0dba('0x1')],'defaultValue':function(){return rs[_0x0dba('0x24')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x0dba('0x6')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x0dba('0x6')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x0dba('0x1')]},'forwardOffline':{'type':Sequelize[_0x0dba('0x6')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x0dba('0x1')]},'waitingTitle':{'type':Sequelize[_0x0dba('0x1')],'defaultValue':_0x0dba('0x25')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x0dba('0x26')},'offlineMessageSubject':{'type':Sequelize[_0x0dba('0x1')],'defaultValue':_0x0dba('0x27')},'offlineMessageBody':{'type':Sequelize[_0x0dba('0x1')],'defaultValue':_0x0dba('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0x0dba('0x6')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x0dba('0x29')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x0dba('0x1')],'defaultValue':_0x0dba('0xc')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x0dba('0x6')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x0dba('0x6')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x0dba('0x1')]},'notificationTemplate':{'type':Sequelize[_0x0dba('0xf')],'defaultValue':function(){return _0x0dba('0x2a');}},'notificationSound':{'type':Sequelize[_0x0dba('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0dba('0x6')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x0dba('0x6')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x0dba('0x1')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x0dba('0x18')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x0dba('0x2b')},'verticalAlignment':{'type':Sequelize[_0x0dba('0x18')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x0dba('0x1')]},'customerAvatar':{'type':Sequelize[_0x0dba('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x0dba('0x6')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x0dba('0x18')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0dba('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x0dba('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0dba('0x18')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0dba('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0dba('0x18')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x0dba('0x1')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x0dba('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0dba('0x18')],'comment':_0x0dba('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0x0dba('0x6')],'defaultValue':![],'comment':_0x0dba('0x2e'),'set':function(_0xb6db55){if(!_0xb6db55)this[_0x0dba('0x20')](_0x0dba('0x2f'),null);this[_0x0dba('0x20')](_0x0dba('0x30'),_0xb6db55);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x0dba('0x1')],'allowNull':![],'defaultValue':_0x0dba('0x31')},'vidaooNote':{'type':Sequelize[_0x0dba('0x1')],'defaultValue':function(){return _0x0dba('0x32');}},'vidaooMetadata':{'type':Sequelize[_0x0dba('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x0dba('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 0018935..ae2ef36 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 _0x0529=['defaults','contact','customerIp','cf-connecting-ip','first','split','lastName','x-real-port','browser','format','%s\x20%s','version','unknown','device','vendor','%s\x20%s\x20%s','threadId','externalUrl','ChatInteraction','interaction','spread','firstName','messageId','created','autoclose','push','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','offline','files','CompanyId','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','utf8','render','offlineMessageBody','ChatOfflineMessage','mimetype','server','offline-chat','basename','openNewInteraction','Attachment','bulkCreate','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','offlineMessageSubject','MailAccountId','originalname','subjectOffline','mapValues','email','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','nolimit','Contact','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','timezone','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','../../config/license/util','getLicense','virtual','License','increment','all','some','server/files/chat/iframe.ejs','remote','x-forwarded-for','x-real-ip','connection','remoteAddress','referer','replace','alignment','textColor','color_button','backgroundColor','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','ChatProactiveAction','getFields','online','offlineForm','onlineForm','items','fromKey','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','fs-extra','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','./chatWebsite.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','status','end','offset','undefined','limit','count','set','json','update','get','ChatWebsites','UserProfileResource','destroy','sendStatus','stack','name','send','index','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','ChatWebsite','rows','show','params','Pause','keys','find','create','user','UserProfileSection','userProfileId','autoAssociation','body','describe','addDisposition','ChatWebsiteId','Disposition','findAll','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','addLogo','sitepic','file','filename','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','custom','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','isNil','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','setUA','headers','user-agent','getResult','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','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','CmList','Contacts','DESC','ChatApplication','Applications','List','applications','list','orderBy','priority','asc','account'];(function(_0x22844d,_0x1c7353){var _0x3528d0=function(_0x126dcb){while(--_0x126dcb){_0x22844d['push'](_0x22844d['shift']());}};_0x3528d0(++_0x1c7353);}(_0x0529,0x1bd));var _0x9052=function(_0x3f0a31,_0x593f0a){_0x3f0a31=_0x3f0a31-0x0;var _0x330ca9=_0x0529[_0x3f0a31];return _0x330ca9;};'use strict';var BPromise=require(_0x9052('0x0'));var Mustache=require(_0x9052('0x1'));var util=require(_0x9052('0x2'));var path=require(_0x9052('0x3'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9052('0x4'));var _=require('lodash');var querystring=require('querystring');var Redis=require('ioredis');var qs=require(_0x9052('0x5'));var logger=require(_0x9052('0x6'))(_0x9052('0x7'));var config=require('../../config/environment');var db=require(_0x9052('0x8'))['db'];config[_0x9052('0x9')]=_['defaults'](config[_0x9052('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9052('0x9')]));require(_0x9052('0xa'))[_0x9052('0xb')](socket);var jayson=require(_0x9052('0xc'));var client=jayson[_0x9052('0xd')][_0x9052('0xe')]({'port':0x232c});var client9002=jayson[_0x9052('0xd')][_0x9052('0xe')]({'port':0x232a});var client9003=jayson[_0x9052('0xd')][_0x9052('0xe')]({'port':0x232b});var client9001=jayson[_0x9052('0xd')][_0x9052('0xe')]({'port':0x2329});function respondWithRpcPromise(_0x484196,_0x37fb40,_0x5b4c01,_0x3b31bc){return new BPromise(function(_0x252b5c,_0x17bfd9){var _0xc7134=_0x3b31bc||client;return _0xc7134[_0x9052('0xf')](_0x484196,_0x5b4c01)[_0x9052('0x10')](function(_0x46e60f){logger[_0x9052('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x37fb40,_0x9052('0x12'));logger[_0x9052('0x13')](_0x9052('0x14'),_0x37fb40,_0x9052('0x12'),JSON[_0x9052('0x15')](_0x46e60f));if(_0x46e60f[_0x9052('0x16')]){if(_0x46e60f[_0x9052('0x16')][_0x9052('0x17')]===0x1f4){logger[_0x9052('0x16')](_0x9052('0x18'),_0x37fb40,_0x46e60f['error'][_0x9052('0x19')]);return _0x17bfd9(_0x46e60f['error'][_0x9052('0x19')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x37fb40,_0x46e60f[_0x9052('0x16')]['message']);return _0x252b5c(_0x46e60f['error'][_0x9052('0x19')]);}else{logger[_0x9052('0x11')](_0x9052('0x18'),_0x37fb40,'request\x20sent');_0x252b5c(_0x46e60f[_0x9052('0x1a')]['message']);}})[_0x9052('0x1b')](function(_0x5f4262){logger['error'](_0x9052('0x18'),_0x37fb40,_0x5f4262);_0x17bfd9(_0x5f4262);});});}function respondWithStatusCode(_0x15d442,_0x1b17f6){_0x1b17f6=_0x1b17f6||0xcc;return function(_0x1f0313){if(_0x1f0313){return _0x15d442['sendStatus'](_0x1b17f6);}return _0x15d442[_0x9052('0x1c')](_0x1b17f6)[_0x9052('0x1d')]();};}function respondWithResult(_0x31e06f,_0x3a6110){_0x3a6110=_0x3a6110||0xc8;return function(_0x856a04){if(_0x856a04){return _0x31e06f[_0x9052('0x1c')](_0x3a6110)['json'](_0x856a04);}};}function respondWithFilteredResult(_0x232efb,_0x6bc510){return function(_0x4a31ba){if(_0x4a31ba){var _0x2cc00d=typeof _0x6bc510[_0x9052('0x1e')]===_0x9052('0x1f')&&typeof _0x6bc510[_0x9052('0x20')]===_0x9052('0x1f');var _0x1482c3=_0x4a31ba[_0x9052('0x21')];var _0x2be53a=_0x2cc00d?0x0:_0x6bc510[_0x9052('0x1e')];var _0x5de84d=_0x2cc00d?_0x4a31ba['count']:_0x6bc510[_0x9052('0x1e')]+_0x6bc510[_0x9052('0x20')];var _0x4fcf5b;if(_0x5de84d>=_0x1482c3){_0x5de84d=_0x1482c3;_0x4fcf5b=0xc8;}else{_0x4fcf5b=0xce;}_0x232efb[_0x9052('0x1c')](_0x4fcf5b);return _0x232efb[_0x9052('0x22')]('Content-Range',_0x2be53a+'-'+_0x5de84d+'/'+_0x1482c3)[_0x9052('0x23')](_0x4a31ba);}return null;};}function saveUpdates(_0x7fb396){return function(_0x4fbb2d){if(_0x4fbb2d){return _0x4fbb2d[_0x9052('0x24')](_0x7fb396)['then'](function(_0x19098f){return _0x19098f;});}return null;};}function removeEntity(_0x3cfe02){return function(_0x3189c3){if(_0x3189c3){return _0x3189c3['destroy']()['then'](function(){var _0x1a988b=_0x3189c3[_0x9052('0x25')]({'plain':!![]});var _0x58c2b4=_0x9052('0x26');return db[_0x9052('0x27')][_0x9052('0x28')]({'where':{'type':_0x58c2b4,'resourceId':_0x1a988b['id']}})['then'](function(){return _0x3189c3;});})[_0x9052('0x10')](function(){_0x3cfe02[_0x9052('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fd768){return function(_0x2ed5de){if(!_0x2ed5de){_0x4fd768[_0x9052('0x29')](0x194);}return _0x2ed5de;};}function handleError(_0x20d648,_0x7cedb5){_0x7cedb5=_0x7cedb5||0x1f4;return function(_0x18579d){logger[_0x9052('0x16')](_0x18579d[_0x9052('0x2a')]);if(_0x18579d[_0x9052('0x2b')]){delete _0x18579d['name'];}_0x20d648['status'](_0x7cedb5)[_0x9052('0x2c')](_0x18579d);};}exports[_0x9052('0x2d')]=function(_0x580519,_0x135706){var _0x1b0caf={'include':[{'model':db['Pause'],'as':_0x9052('0x2e')}]},_0x4027ac={},_0x9f40a8={'count':0x0,'rows':[]};var _0x59a18f=_[_0x9052('0x2f')](db['ChatWebsite'][_0x9052('0x30')],function(_0x4dc9be){return{'name':_0x4dc9be[_0x9052('0x31')],'type':_0x4dc9be[_0x9052('0x32')]['key']};});_0x4027ac[_0x9052('0x33')]=_[_0x9052('0x2f')](_0x59a18f,_0x9052('0x2b'));_0x4027ac[_0x9052('0x34')]=_['keys'](_0x580519[_0x9052('0x34')]);_0x4027ac[_0x9052('0x35')]=_[_0x9052('0x36')](_0x4027ac[_0x9052('0x33')],_0x4027ac[_0x9052('0x34')]);_0x1b0caf[_0x9052('0x37')]=_[_0x9052('0x36')](_0x4027ac[_0x9052('0x33')],qs[_0x9052('0x38')](_0x580519['query']['fields']));_0x1b0caf[_0x9052('0x37')]=_0x1b0caf[_0x9052('0x37')][_0x9052('0x39')]?_0x1b0caf[_0x9052('0x37')]:_0x4027ac[_0x9052('0x33')];if(!_0x580519[_0x9052('0x34')][_0x9052('0x3a')]('nolimit')){_0x1b0caf['limit']=qs[_0x9052('0x20')](_0x580519['query']['limit']);_0x1b0caf[_0x9052('0x1e')]=qs[_0x9052('0x1e')](_0x580519['query'][_0x9052('0x1e')]);}_0x1b0caf[_0x9052('0x3b')]=qs['sort'](_0x580519[_0x9052('0x34')][_0x9052('0x3c')]);_0x1b0caf['where']=qs[_0x9052('0x35')](_[_0x9052('0x3d')](_0x580519[_0x9052('0x34')],_0x4027ac[_0x9052('0x35')]),_0x59a18f);if(_0x580519[_0x9052('0x34')][_0x9052('0x3e')]){_0x1b0caf[_0x9052('0x3f')]=_[_0x9052('0x40')](_0x1b0caf[_0x9052('0x3f')],{'$or':_[_0x9052('0x2f')](_0x59a18f,function(_0x257868){if(_0x257868[_0x9052('0x32')]!==_0x9052('0x41')){var _0x29e692={};_0x29e692[_0x257868[_0x9052('0x2b')]]={'$like':'%'+_0x580519[_0x9052('0x34')][_0x9052('0x3e')]+'%'};return _0x29e692;}})});}_0x1b0caf=_[_0x9052('0x40')]({},_0x1b0caf,_0x580519[_0x9052('0x42')]);var _0x4a6b56={'where':_0x1b0caf[_0x9052('0x3f')]};return db['ChatWebsite']['count'](_0x4a6b56)[_0x9052('0x10')](function(_0x27abe5){_0x9f40a8[_0x9052('0x21')]=_0x27abe5;if(_0x580519[_0x9052('0x34')][_0x9052('0x43')]){_0x1b0caf[_0x9052('0x44')]=[{'all':!![]}];}return db[_0x9052('0x45')]['findAll'](_0x1b0caf);})['then'](function(_0x4fd7f4){_0x9f40a8[_0x9052('0x46')]=_0x4fd7f4;return _0x9f40a8;})['then'](respondWithFilteredResult(_0x135706,_0x1b0caf))[_0x9052('0x1b')](handleError(_0x135706,null));};exports[_0x9052('0x47')]=function(_0x1ae15e,_0xb6c929){var _0xe5bae1={'raw':![],'where':{'id':_0x1ae15e[_0x9052('0x48')]['id']},'include':[{'model':db[_0x9052('0x49')],'as':_0x9052('0x2e')}]},_0xd30c17={};_0xd30c17[_0x9052('0x33')]=_[_0x9052('0x4a')](db[_0x9052('0x45')][_0x9052('0x30')]);_0xd30c17[_0x9052('0x34')]=_[_0x9052('0x4a')](_0x1ae15e[_0x9052('0x34')]);_0xd30c17['filters']=_[_0x9052('0x36')](_0xd30c17[_0x9052('0x33')],_0xd30c17[_0x9052('0x34')]);_0xe5bae1['attributes']=_[_0x9052('0x36')](_0xd30c17[_0x9052('0x33')],qs['fields'](_0x1ae15e['query'][_0x9052('0x38')]));_0xe5bae1[_0x9052('0x37')]=_0xe5bae1['attributes']['length']?_0xe5bae1[_0x9052('0x37')]:_0xd30c17['model'];if(_0x1ae15e['query']['includeAll']){_0xe5bae1[_0x9052('0x44')]=[{'all':!![]}];}_0xe5bae1=_[_0x9052('0x40')]({},_0xe5bae1,_0x1ae15e[_0x9052('0x42')]);return db[_0x9052('0x45')][_0x9052('0x4b')](_0xe5bae1)[_0x9052('0x10')](handleEntityNotFound(_0xb6c929,null))[_0x9052('0x10')](respondWithResult(_0xb6c929,null))[_0x9052('0x1b')](handleError(_0xb6c929,null));};exports['create']=function(_0x4267b1,_0x41c86e){return db[_0x9052('0x45')][_0x9052('0x4c')](_0x4267b1['body'],{})[_0x9052('0x10')](function(_0x21baef){var _0x1abe59=_0x4267b1[_0x9052('0x4d')][_0x9052('0x25')]({'plain':!![]});if(!_0x1abe59)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1abe59['role']===_0x9052('0x4d')){var _0x41d480=_0x21baef[_0x9052('0x25')]({'plain':!![]});var _0x1e3f09='ChatWebsites';return db[_0x9052('0x4e')][_0x9052('0x4b')]({'where':{'name':_0x1e3f09,'userProfileId':_0x1abe59[_0x9052('0x4f')]},'raw':!![]})[_0x9052('0x10')](function(_0x169484){if(_0x169484&&_0x169484[_0x9052('0x50')]===0x0){return db[_0x9052('0x27')][_0x9052('0x4c')]({'name':_0x41d480[_0x9052('0x2b')],'resourceId':_0x41d480['id'],'type':_0x169484['name'],'sectionId':_0x169484['id']},{})[_0x9052('0x10')](function(){return _0x21baef;});}else{return _0x21baef;}})['catch'](function(_0x447b85){logger[_0x9052('0x16')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x447b85);throw _0x447b85;});}return _0x21baef;})[_0x9052('0x10')](respondWithResult(_0x41c86e,0xc9))[_0x9052('0x1b')](handleError(_0x41c86e,null));};exports['update']=function(_0x5bc591,_0x581978){if(_0x5bc591[_0x9052('0x51')]['id']){delete _0x5bc591['body']['id'];}return db['ChatWebsite'][_0x9052('0x4b')]({'where':{'id':_0x5bc591[_0x9052('0x48')]['id']},'include':[{'model':db[_0x9052('0x49')],'as':_0x9052('0x2e')}]})[_0x9052('0x10')](handleEntityNotFound(_0x581978,null))['then'](saveUpdates(_0x5bc591['body'],null))[_0x9052('0x10')](respondWithResult(_0x581978,null))[_0x9052('0x1b')](handleError(_0x581978,null));};exports['destroy']=function(_0x5821cf,_0x2c3550){return db[_0x9052('0x45')]['find']({'where':{'id':_0x5821cf[_0x9052('0x48')]['id']}})[_0x9052('0x10')](handleEntityNotFound(_0x2c3550,null))[_0x9052('0x10')](removeEntity(_0x2c3550,null))[_0x9052('0x1b')](handleError(_0x2c3550,null));};exports[_0x9052('0x52')]=function(_0x53fc6f,_0x4841c6){return db[_0x9052('0x45')][_0x9052('0x52')]()['then'](respondWithResult(_0x4841c6,null))['catch'](handleError(_0x4841c6,null));};exports[_0x9052('0x53')]=function(_0x4ddea0,_0xa557bf){if(_0x4ddea0[_0x9052('0x51')]['id']){delete _0x4ddea0[_0x9052('0x51')]['id'];}return db['ChatWebsite'][_0x9052('0x4b')]({'where':{'id':_0x4ddea0[_0x9052('0x48')]['id']}})['then'](handleEntityNotFound(_0xa557bf,null))['then'](function(_0x2b88df){if(_0x2b88df){_0x4ddea0[_0x9052('0x51')][_0x9052('0x54')]=_0x2b88df['id'];return db[_0x9052('0x55')][_0x9052('0x4c')](_0x4ddea0[_0x9052('0x51')]);}})[_0x9052('0x10')](respondWithResult(_0xa557bf,null))[_0x9052('0x1b')](handleError(_0xa557bf,null));};exports['getDispositions']=function(_0xa87d46,_0x525254){var _0x14e327={'raw':![],'where':{}};var _0x2389bd={};var _0x35ae68={'count':0x0,'rows':[]};return db[_0x9052('0x45')]['findOne']({'where':{'id':_0xa87d46[_0x9052('0x48')]['id']}})[_0x9052('0x10')](handleEntityNotFound(_0x525254,null))['then'](function(_0x4bd0f9){if(_0x4bd0f9){_0x2389bd['model']=_[_0x9052('0x4a')](db[_0x9052('0x55')][_0x9052('0x30')]);_0x2389bd[_0x9052('0x34')]=_[_0x9052('0x4a')](_0xa87d46[_0x9052('0x34')]);_0x2389bd[_0x9052('0x35')]=_[_0x9052('0x36')](_0x2389bd[_0x9052('0x33')],_0x2389bd[_0x9052('0x34')]);_0x14e327[_0x9052('0x37')]=_[_0x9052('0x36')](_0x2389bd[_0x9052('0x33')],qs['fields'](_0xa87d46['query'][_0x9052('0x38')]));_0x14e327[_0x9052('0x37')]=_0x14e327['attributes']['length']?_0x14e327[_0x9052('0x37')]:_0x2389bd[_0x9052('0x33')];if(!_0xa87d46[_0x9052('0x34')][_0x9052('0x3a')]('nolimit')){_0x14e327[_0x9052('0x20')]=qs[_0x9052('0x20')](_0xa87d46['query'][_0x9052('0x20')]);_0x14e327[_0x9052('0x1e')]=qs['offset'](_0xa87d46['query'][_0x9052('0x1e')]);}_0x14e327[_0x9052('0x3b')]=qs[_0x9052('0x3c')](_0xa87d46['query']['sort']);_0x14e327[_0x9052('0x3f')]=qs[_0x9052('0x35')](_[_0x9052('0x3d')](_0xa87d46['query'],_0x2389bd[_0x9052('0x35')]));_0x14e327[_0x9052('0x3f')][_0x9052('0x54')]=_0x4bd0f9['id'];if(_0xa87d46['query'][_0x9052('0x3e')]){_0x14e327[_0x9052('0x3f')]=_[_0x9052('0x40')](_0x14e327['where'],{'$or':_[_0x9052('0x2f')](_0x14e327['attributes'],function(_0x17e50a){var _0x5b2491={};_0x5b2491[_0x17e50a]={'$like':'%'+_0xa87d46[_0x9052('0x34')]['filter']+'%'};return _0x5b2491;})});}_0x14e327=_['merge']({},_0x14e327,_0xa87d46[_0x9052('0x42')]);return db['Disposition'][_0x9052('0x21')]({'where':_0x14e327[_0x9052('0x3f')]})[_0x9052('0x10')](function(_0x37afb5){_0x35ae68[_0x9052('0x21')]=_0x37afb5;if(_0xa87d46[_0x9052('0x34')][_0x9052('0x43')]){_0x14e327[_0x9052('0x44')]=[{'all':!![]}];}return db['Disposition'][_0x9052('0x56')](_0x14e327);})[_0x9052('0x10')](function(_0x1a2018){_0x35ae68['rows']=_0x1a2018;return _0x35ae68;});}})[_0x9052('0x10')](respondWithFilteredResult(_0x525254,_0x14e327))[_0x9052('0x1b')](handleError(_0x525254,null));};exports['removeDispositions']=function(_0xebc64f,_0x33c694){return db['ChatWebsite'][_0x9052('0x4b')]({'where':{'id':_0xebc64f['params']['id']}})[_0x9052('0x10')](handleEntityNotFound(_0x33c694,null))['then'](function(_0x33bee1){if(_0x33bee1){return _0x33bee1[_0x9052('0x57')](_0xebc64f[_0x9052('0x34')][_0x9052('0x58')]);}})['then'](respondWithStatusCode(_0x33c694,null))[_0x9052('0x1b')](handleError(_0x33c694,null));};exports[_0x9052('0x59')]=function(_0x4fddda,_0x28b9f3){if(_0x4fddda[_0x9052('0x51')]['id']){delete _0x4fddda[_0x9052('0x51')]['id'];}return db[_0x9052('0x45')][_0x9052('0x4b')]({'where':{'id':_0x4fddda['params']['id']}})[_0x9052('0x10')](handleEntityNotFound(_0x28b9f3,null))['then'](function(_0xa213a0){if(_0xa213a0){_0x4fddda[_0x9052('0x51')][_0x9052('0x54')]=_0xa213a0['id'];return db['CannedAnswer'][_0x9052('0x4c')](_0x4fddda['body']);}})[_0x9052('0x10')](respondWithResult(_0x28b9f3,null))['catch'](handleError(_0x28b9f3,null));};exports[_0x9052('0x5a')]=function(_0x537e5d,_0x31607d){var _0x5e801e={'raw':![],'where':{}};var _0x58c840={};var _0x1ed90f={'count':0x0,'rows':[]};return db[_0x9052('0x45')][_0x9052('0x5b')]({'where':{'id':_0x537e5d['params']['id']}})['then'](handleEntityNotFound(_0x31607d,null))[_0x9052('0x10')](function(_0x32c8ae){if(_0x32c8ae){_0x58c840[_0x9052('0x33')]=_[_0x9052('0x4a')](db[_0x9052('0x5c')][_0x9052('0x30')]);_0x58c840[_0x9052('0x34')]=_[_0x9052('0x4a')](_0x537e5d[_0x9052('0x34')]);_0x58c840['filters']=_['intersection'](_0x58c840[_0x9052('0x33')],_0x58c840['query']);_0x5e801e[_0x9052('0x37')]=_[_0x9052('0x36')](_0x58c840[_0x9052('0x33')],qs[_0x9052('0x38')](_0x537e5d[_0x9052('0x34')]['fields']));_0x5e801e[_0x9052('0x37')]=_0x5e801e[_0x9052('0x37')][_0x9052('0x39')]?_0x5e801e[_0x9052('0x37')]:_0x58c840['model'];if(!_0x537e5d[_0x9052('0x34')][_0x9052('0x3a')]('nolimit')){_0x5e801e[_0x9052('0x20')]=qs['limit'](_0x537e5d[_0x9052('0x34')][_0x9052('0x20')]);_0x5e801e[_0x9052('0x1e')]=qs[_0x9052('0x1e')](_0x537e5d[_0x9052('0x34')][_0x9052('0x1e')]);}_0x5e801e[_0x9052('0x3b')]=qs['sort'](_0x537e5d['query'][_0x9052('0x3c')]);_0x5e801e[_0x9052('0x3f')]=qs['filters'](_[_0x9052('0x3d')](_0x537e5d['query'],_0x58c840[_0x9052('0x35')]));_0x5e801e[_0x9052('0x3f')][_0x9052('0x54')]=_0x32c8ae['id'];if(_0x537e5d[_0x9052('0x34')][_0x9052('0x3e')]){_0x5e801e[_0x9052('0x3f')]=_[_0x9052('0x40')](_0x5e801e[_0x9052('0x3f')],{'$or':_[_0x9052('0x2f')](_0x5e801e['attributes'],function(_0x231ab5){var _0x198ee1={};_0x198ee1[_0x231ab5]={'$like':'%'+_0x537e5d[_0x9052('0x34')][_0x9052('0x3e')]+'%'};return _0x198ee1;})});}_0x5e801e=_[_0x9052('0x40')]({},_0x5e801e,_0x537e5d[_0x9052('0x42')]);return db[_0x9052('0x5c')][_0x9052('0x21')]({'where':_0x5e801e[_0x9052('0x3f')]})['then'](function(_0x2d21fa){_0x1ed90f[_0x9052('0x21')]=_0x2d21fa;if(_0x537e5d[_0x9052('0x34')][_0x9052('0x43')]){_0x5e801e[_0x9052('0x44')]=[{'all':!![]}];}return db[_0x9052('0x5c')]['findAll'](_0x5e801e);})[_0x9052('0x10')](function(_0x20ef26){_0x1ed90f['rows']=_0x20ef26;return _0x1ed90f;});}})['then'](respondWithFilteredResult(_0x31607d,_0x5e801e))[_0x9052('0x1b')](handleError(_0x31607d,null));};exports[_0x9052('0x5d')]=function(_0x2084bc,_0x3ffb00){return db[_0x9052('0x45')][_0x9052('0x4b')]({'where':{'id':_0x2084bc['params']['id']}})[_0x9052('0x10')](handleEntityNotFound(_0x3ffb00,null))[_0x9052('0x10')](function(_0x18412d){if(_0x18412d){return _0x18412d[_0x9052('0x5d')](_0x2084bc[_0x9052('0x34')][_0x9052('0x58')]);}})[_0x9052('0x10')](respondWithStatusCode(_0x3ffb00,null))[_0x9052('0x1b')](handleError(_0x3ffb00,null));};exports[_0x9052('0x5e')]=function(_0x1f0d20,_0x1ae958){_0x1f0d20[_0x9052('0x51')][_0x9052('0x5f')]=_0x1f0d20[_0x9052('0x60')][_0x9052('0x61')];return db['ChatWebsite'][_0x9052('0x4b')]({'where':{'id':_0x1f0d20[_0x9052('0x48')]['id']}})[_0x9052('0x10')](handleEntityNotFound(_0x1ae958,null))[_0x9052('0x10')](saveUpdates(_0x1f0d20[_0x9052('0x51')],null))[_0x9052('0x10')](respondWithResult(_0x1ae958,null))[_0x9052('0x1b')](handleError(_0x1ae958,null));};exports['addAvatar']=function(_0x3d09ad,_0x47a360){_0x3d09ad[_0x9052('0x51')]['agentAvatar']=_0x3d09ad['file'][_0x9052('0x61')];return db['ChatWebsite'][_0x9052('0x4b')]({'where':{'id':_0x3d09ad[_0x9052('0x48')]['id']}})[_0x9052('0x10')](handleEntityNotFound(_0x47a360,null))['then'](saveUpdates(_0x3d09ad[_0x9052('0x51')],null))[_0x9052('0x10')](respondWithResult(_0x47a360,null))[_0x9052('0x1b')](handleError(_0x47a360,null));};exports['addCustomerAvatar']=function(_0x2288e2,_0x2f418d){_0x2288e2[_0x9052('0x51')][_0x9052('0x62')]=_0x2288e2['file'][_0x9052('0x61')];return db['ChatWebsite'][_0x9052('0x4b')]({'where':{'id':_0x2288e2[_0x9052('0x48')]['id']}})[_0x9052('0x10')](handleEntityNotFound(_0x2f418d,null))[_0x9052('0x10')](saveUpdates(_0x2288e2['body'],null))[_0x9052('0x10')](respondWithResult(_0x2f418d,null))[_0x9052('0x1b')](handleError(_0x2f418d,null));};exports[_0x9052('0x63')]=function(_0x2cec6e,_0x4fb222){_0x2cec6e['body'][_0x9052('0x64')]=_0x2cec6e['file']['filename'];return db[_0x9052('0x45')]['find']({'where':{'id':_0x2cec6e[_0x9052('0x48')]['id']}})['then'](handleEntityNotFound(_0x4fb222,null))['then'](saveUpdates(_0x2cec6e['body'],null))[_0x9052('0x10')](respondWithResult(_0x4fb222,null))[_0x9052('0x1b')](handleError(_0x4fb222,null));};exports[_0x9052('0x65')]=function(_0x3d61ea,_0x39c876){var _0x463b5e=path[_0x9052('0x66')](config[_0x9052('0x67')],_0x9052('0x68'));var _0xba6b4b={'where':{'id':_0x3d61ea['params']['id']},'attributes':['id',_0x9052('0x5f')],'raw':!![]};var _0x842868=![];return require('../../config/license/util')['getLicense']()[_0x9052('0x10')](function(_0x20f70a){if(_0x20f70a){_0x842868=_0x20f70a[_0x9052('0x69')];}})[_0x9052('0x10')](function(){return db[_0x9052('0x45')][_0x9052('0x4b')](_0xba6b4b);})[_0x9052('0x10')](handleEntityNotFound(_0x39c876,null))[_0x9052('0x10')](function(_0xf31a29){if(_0xf31a29){if(!_['isNil'](_0xf31a29[_0x9052('0x5f')])){if(fs['existsSync'](path[_0x9052('0x66')](config['root'],_0x9052('0x6a'),_0xf31a29['sitepic']))&&_0x842868){_0x463b5e=path['join'](config[_0x9052('0x67')],_0x9052('0x6a'),_0xf31a29[_0x9052('0x5f')]);}}return _0x39c876[_0x9052('0x6b')](_0x463b5e);}})['catch'](handleError(_0x39c876,null));};exports[_0x9052('0x6c')]=function(_0xa50056,_0x412466){var _0x96f7ec=path[_0x9052('0x66')](config[_0x9052('0x67')],_0x9052('0x6d'));var _0xc6f83e={'where':{'id':_0xa50056[_0x9052('0x48')]['id']},'attributes':['id',_0x9052('0x6e')],'raw':!![]};return db['ChatWebsite'][_0x9052('0x4b')](_0xc6f83e)['then'](handleEntityNotFound(_0x412466,null))[_0x9052('0x10')](function(_0x2a6509){if(_0x2a6509){if(!_[_0x9052('0x6f')](_0x2a6509[_0x9052('0x6e')])){if(fs[_0x9052('0x70')](path[_0x9052('0x66')](config[_0x9052('0x67')],_0x9052('0x71'),_0x2a6509[_0x9052('0x6e')]))){_0x96f7ec=path[_0x9052('0x66')](config['root'],_0x9052('0x71'),_0x2a6509['agentAvatar']);}}return _0x412466[_0x9052('0x6b')](_0x96f7ec);}})[_0x9052('0x1b')](handleError(_0x412466,null));};exports[_0x9052('0x72')]=function(_0x753760,_0x28b045){var _0xebed41=path[_0x9052('0x66')](config['root'],_0x9052('0x73'));var _0x54411b={'where':{'id':_0x753760[_0x9052('0x48')]['id']},'attributes':['id','customerAvatar',_0x9052('0x74')],'raw':!![]};return db[_0x9052('0x45')][_0x9052('0x4b')](_0x54411b)['then'](handleEntityNotFound(_0x28b045,null))[_0x9052('0x10')](function(_0x2e990e){if(_0x2e990e){if(!_[_0x9052('0x6f')](_0x2e990e[_0x9052('0x62')])){if(fs['existsSync'](path[_0x9052('0x66')](config['root'],_0x9052('0x71'),_0x2e990e[_0x9052('0x62')]))&&_0x2e990e[_0x9052('0x74')]){_0xebed41=path[_0x9052('0x66')](config['root'],_0x9052('0x71'),_0x2e990e[_0x9052('0x62')]);}}return _0x28b045[_0x9052('0x6b')](_0xebed41);}})[_0x9052('0x1b')](handleError(_0x28b045,null));};exports[_0x9052('0x75')]=function(_0x1482b8,_0x56a431){var _0x363dcc=path[_0x9052('0x66')](config[_0x9052('0x67')],_0x9052('0x76'));var _0x3bd7ed={'where':{'id':_0x1482b8[_0x9052('0x48')]['id']},'attributes':['id',_0x9052('0x64')],'raw':!![]};return db[_0x9052('0x45')][_0x9052('0x4b')](_0x3bd7ed)[_0x9052('0x10')](handleEntityNotFound(_0x56a431,null))[_0x9052('0x10')](function(_0x297047){if(_0x297047){if(!_[_0x9052('0x6f')](_0x297047[_0x9052('0x64')])){if(fs[_0x9052('0x70')](path[_0x9052('0x66')](config[_0x9052('0x67')],_0x9052('0x71'),_0x297047['systemAvatar']))){_0x363dcc=path[_0x9052('0x66')](config[_0x9052('0x67')],_0x9052('0x71'),_0x297047[_0x9052('0x64')]);}}return _0x56a431[_0x9052('0x6b')](_0x363dcc);}})[_0x9052('0x1b')](handleError(_0x56a431,null));};exports[_0x9052('0x77')]=function(_0x3b5718,_0x76e119){var _0x215dd5=require('user-agent-parser');var _0x4c3d03=new _0x215dd5();var _0x32af25=_0x4c3d03[_0x9052('0x78')](_0x3b5718[_0x9052('0x79')][_0x9052('0x7a')])[_0x9052('0x7b')]();var _0x32e3dd={'body':_0x3b5718[_0x9052('0x51')],'channel':'chat'};var _0x36b5e2=[];var _0x312949=[];var _0x668951={};var _0x444228=![];return db[_0x9052('0x7c')][_0x9052('0x52')]()[_0x9052('0x10')](function(_0x427dc4){if(!_0x427dc4){throw new db[(_0x9052('0x7d'))][(_0x9052('0x7e'))](_0x9052('0x7f'));}_0x36b5e2=_[_0x9052('0x80')](_[_0x9052('0x4a')](_0x427dc4),[_0x9052('0x81'),_0x9052('0x82')]);_0x312949=_[_0x9052('0x80')](_[_0x9052('0x4a')](_0x427dc4),['createdAt','updatedAt','CompanyId',_0x9052('0x83')]);if(_0x3b5718[_0x9052('0x51')]['id']){delete _0x3b5718[_0x9052('0x51')]['id'];}if(_[_0x9052('0x6f')](_0x3b5718[_0x9052('0x51')][_0x9052('0x84')])){throw new db[(_0x9052('0x7d'))][(_0x9052('0x7e'))](_0x9052('0x85'));}if(_[_0x9052('0x6f')](_0x3b5718[_0x9052('0x51')][_0x9052('0x51')])||_0x3b5718[_0x9052('0x51')][_0x9052('0x51')]===''){throw new db[(_0x9052('0x7d'))][(_0x9052('0x7e'))](_0x9052('0x86'));}if(_[_0x9052('0x6f')](_0x3b5718['body']['mapKey'])){throw new db['Sequelize'][(_0x9052('0x7e'))](_0x9052('0x87')+_0x312949);}if(!_[_0x9052('0x88')](_0x312949,_0x3b5718[_0x9052('0x51')][_0x9052('0x89')])){throw new db['Sequelize'][(_0x9052('0x7e'))](_0x9052('0x8a')+_0x312949);}_0x668951[_0x3b5718[_0x9052('0x51')][_0x9052('0x89')]]=_0x3b5718[_0x9052('0x51')][_0x9052('0x84')];})['then'](function(){return db['ChatWebsite'][_0x9052('0x4b')]({'where':{'id':_0x3b5718[_0x9052('0x48')]['id']},'include':[{'model':db[_0x9052('0x8b')],'as':'List','include':[{'model':db['CmContact'],'as':_0x9052('0x8c'),'where':_0x668951,'limit':0x1,'order':[[_0x9052('0x82'),_0x9052('0x8d')]]}]},{'model':db[_0x9052('0x8e')],'as':_0x9052('0x8f')}]});})[_0x9052('0x10')](handleEntityNotFound(_0x76e119,null))['then'](function(_0x2a27a9){if(_0x2a27a9&&_0x2a27a9[_0x9052('0x90')]){_0x32e3dd['account']=_0x2a27a9;_0x32e3dd[_0x9052('0x91')]=_0x2a27a9[_0x9052('0x8f')];_0x32e3dd[_0x9052('0x92')]=_0x2a27a9[_0x9052('0x90')];_0x32e3dd['applications']=_[_0x9052('0x93')](_0x32e3dd[_0x9052('0x91')],[_0x9052('0x94')],[_0x9052('0x95')]);if(_0x32e3dd[_0x9052('0x96')][_0x9052('0x8f')]){delete _0x32e3dd['account'][_0x9052('0x8f')];}if(_0x32e3dd[_0x9052('0x96')][_0x9052('0x90')]&&_0x32e3dd[_0x9052('0x96')][_0x9052('0x90')][_0x9052('0x8c')][_0x9052('0x39')]){return _0x32e3dd[_0x9052('0x96')][_0x9052('0x90')]['Contacts'][0x0];}var _0xe210a0=_[_0x9052('0x97')](_0x3b5718['body'],{'firstName':_0x3b5718[_0x9052('0x51')][_0x9052('0x84')],'ListId':_0x2a27a9[_0x9052('0x83')]});_0xe210a0[_0x3b5718[_0x9052('0x51')][_0x9052('0x89')]]=_0x3b5718[_0x9052('0x51')]['from'];return db[_0x9052('0x7c')]['create'](_0xe210a0,{'fields':_0x36b5e2,'raw':!![]});}})[_0x9052('0x10')](handleEntityNotFound(_0x76e119,null))[_0x9052('0x10')](function(_0xf3f697){_0x32e3dd[_0x9052('0x98')]=_0xf3f697;var _0x518450=_0x3b5718[_0x9052('0x51')][_0x9052('0x99')];if(_0x3b5718[_0x9052('0x79')][_0x9052('0x9a')]){_0x518450=_0x3b5718[_0x9052('0x79')][_0x9052('0x9a')];}else if(_0x3b5718[_0x9052('0x79')]['x-forwarded-for']){_0x518450=_[_0x9052('0x9b')](_0x3b5718[_0x9052('0x79')]['x-forwarded-for'][_0x9052('0x9c')](','));}if(_0xf3f697){var _0x3e8af5={'ContactId':_0xf3f697['id'],'ChatWebsiteId':_0x3b5718[_0x9052('0x48')]['id'],'from':(_0xf3f697['firstName']||'')+'\x20'+(_0xf3f697[_0x9052('0x9d')]||''),'customerIp':_0x518450,'customerPort':_0x3b5718[_0x9052('0x79')][_0x9052('0x9e')]?_0x3b5718[_0x9052('0x79')][_0x9052('0x9e')]:null,'referer':_0x3b5718[_0x9052('0x51')]['referer'],'browserName':_0x32af25[_0x9052('0x9f')][_0x9052('0x2b')]&&_0x32af25[_0x9052('0x9f')]['version']?util[_0x9052('0xa0')](_0x9052('0xa1'),_0x32af25['browser'][_0x9052('0x2b')],_0x32af25[_0x9052('0x9f')][_0x9052('0xa2')]):_0x9052('0xa3'),'browserVersion':_0x32af25['browser'][_0x9052('0xa2')]||_0x9052('0xa3'),'osName':util['format'](_0x9052('0xa1'),_0x32af25['os']['name'],_0x32af25['os']['version']),'osVersion':_0x32af25['os'][_0x9052('0xa2')],'deviceModel':_0x32af25[_0x9052('0xa4')]['model']&&_0x32af25['device'][_0x9052('0xa5')]?util['format'](_0x9052('0xa6'),_0x32af25[_0x9052('0xa4')][_0x9052('0x33')],_0x32af25[_0x9052('0xa4')][_0x9052('0xa5')],_0x32af25[_0x9052('0xa4')]['type']):null,'deviceVendor':_0x32af25['device'][_0x9052('0xa5')],'deviceType':_0x32af25['device']['type'],'formData':JSON[_0x9052('0x15')](_0x3b5718[_0x9052('0x51')])};var _0x38de54={'ChatWebsiteId':_0x3b5718['params']['id'],'closed':![]};if(_0x3b5718[_0x9052('0x51')][_0x9052('0xa7')]){_0x38de54['threadId']=_0x3b5718[_0x9052('0x51')][_0x9052('0xa7')];return db['ChatInteraction'][_0x9052('0x4b')]({'where':_0x38de54})['then'](function(_0x360b94){if(_0x360b94){return[_0x360b94,![]];}_0x3e8af5[_0x9052('0xa7')]=_0x3b5718[_0x9052('0x51')][_0x9052('0xa7')];_0x3e8af5['externalUrl']=_0x3b5718[_0x9052('0x51')][_0x9052('0xa8')];return db[_0x9052('0xa9')][_0x9052('0x4c')](_0x3e8af5)['then'](function(_0x3ba578){return[_0x3ba578,!![]];});});}_0x38de54['ContactId']=_0xf3f697['id'];if(_0x3b5718[_0x9052('0x51')][_0x9052('0xaa')]&&_0x3b5718[_0x9052('0x51')][_0x9052('0xaa')]['id']){_0x38de54['id']=_0x3b5718[_0x9052('0x51')][_0x9052('0xaa')]['id'];return db[_0x9052('0xa9')][_0x9052('0x4b')]({'where':_0x38de54})[_0x9052('0x10')](function(_0xddfdd){if(_0xddfdd){return[_0xddfdd,![]];}return db[_0x9052('0xa9')][_0x9052('0x4c')](_0x3e8af5)[_0x9052('0x10')](function(_0x13bcc8){return[_0x13bcc8,!![]];});});}return db[_0x9052('0xa9')][_0x9052('0x4c')](_0x3e8af5)[_0x9052('0x10')](function(_0x282354){return[_0x282354,!![]];});}})[_0x9052('0xab')](function(_0x5ae82c,_0x4a0a76){if(_0x5ae82c){_0x444228=_0x4a0a76;if(!_0x4a0a76){var _0x398893={'from':(_0x32e3dd[_0x9052('0x98')][_0x9052('0xac')]||'')+'\x20'+(_0x32e3dd[_0x9052('0x98')][_0x9052('0x9d')]||'')};if(_0x3b5718[_0x9052('0x51')]['threadId']&&_0x3b5718[_0x9052('0x51')][_0x9052('0xad')]&&_0x3b5718['body'][_0x9052('0xa7')]!=_0x3b5718['body'][_0x9052('0xad')]){_0x398893[_0x9052('0xa7')]=_0x3b5718['body'][_0x9052('0xad')];}return _0x5ae82c[_0x9052('0x24')](_0x398893);}else{return _0x5ae82c;}}})['then'](function(_0x1f847d){_0x32e3dd[_0x9052('0xaa')]=_0x1f847d[_0x9052('0x25')]({'plain':!![]});_0x32e3dd['interaction']['created']=_0x444228;if(_0x32e3dd['interaction'][_0x9052('0xae')]){if(_0x32e3dd[_0x9052('0x96')][_0x9052('0xaf')]){_0x32e3dd['applications'][_0x9052('0xb0')]({'id':0x0,'priority':_0x32e3dd[_0x9052('0x91')][_0x9052('0x39')]+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x9052('0xb1')][_0x9052('0x4c')]({'body':_0x3b5718[_0x9052('0x51')][_0x9052('0x51')],'ChatWebsiteId':_0x3b5718[_0x9052('0x48')]['id'],'ChatInteractionId':_0x1f847d['id'],'direction':'in','ContactId':_0x32e3dd[_0x9052('0x98')]['id'],'AttachmentId':_0x3b5718[_0x9052('0x51')][_0x9052('0xb2')]});})[_0x9052('0x10')](function(_0x5cb116){_0x32e3dd[_0x9052('0x19')]=_0x5cb116;if(_0x32e3dd['interaction'][_0x9052('0xb3')]){return db[_0x9052('0xb4')][_0x9052('0x4b')]({'attributes':['id',_0x9052('0x2b')],'where':{'id':_0x32e3dd[_0x9052('0xaa')]['UserId']}})['then'](function(_0x4f0e99){if(_0x4f0e99){_0x32e3dd['applications'][_0x9052('0xb5')]({'id':0x0,'priority':0x0,'app':_0x9052('0xb6'),'appdata':_0x4f0e99[_0x9052('0x2b')]+','+(_0x32e3dd['account'][_0x9052('0xb7')]||0xa),'interval':_0x9052('0xb8')});_0x32e3dd[_0x9052('0xb9')]=!![];}return respondWithRpcPromise(_0x9052('0xba'),'startRouting',_0x32e3dd);});}return respondWithRpcPromise('Start','startRouting',_0x32e3dd);})[_0x9052('0x10')](function(_0x629e91){respondWithRpcPromise('EventManager','EventManager',{'event':_0x9052('0x77'),'message':_0x629e91},client9002);return _0x629e91;})[_0x9052('0x10')](respondWithResult(_0x76e119,null))['catch'](handleError(_0x76e119,null));};exports[_0x9052('0xbb')]=function(_0x336ce4,_0x154ebb){var _0x379462,_0x4263c1,_0x5290a0;var _0x3a134=[];var _0x3b187e={};var _0x262867=_0x336ce4[_0x9052('0xbc')]||[];var _0x6ded2b=[];var _0x1c4d8e;return db[_0x9052('0x7c')][_0x9052('0x52')]()[_0x9052('0x10')](function(_0x51bd13){if(!_0x51bd13){throw new db[(_0x9052('0x7d'))]['ValidationError']('no\x20available\x20attributes');}_0x3a134=_['difference'](_[_0x9052('0x4a')](_0x51bd13),['createdAt',_0x9052('0x82'),_0x9052('0xbd'),_0x9052('0x83')]);if(_0x336ce4['body']['id']){delete _0x336ce4[_0x9052('0x51')]['id'];}if(_[_0x9052('0x6f')](_0x336ce4[_0x9052('0x51')][_0x9052('0x84')])){throw _0x154ebb['status'](0x1f4)[_0x9052('0x2c')](new db[(_0x9052('0x7d'))]['ValidationError']('from\x20is\x20mandatory'));}if(_[_0x9052('0x6f')](_0x336ce4[_0x9052('0x51')]['body'])||_0x336ce4[_0x9052('0x51')][_0x9052('0x51')]===''){throw _0x154ebb[_0x9052('0x1c')](0x1f4)['send'](new db[(_0x9052('0x7d'))][(_0x9052('0x7e'))](_0x9052('0x86')));}if(_['isNil'](_0x336ce4[_0x9052('0x51')][_0x9052('0xbe')])){throw _0x154ebb['status'](0x1f4)[_0x9052('0x2c')](new db[(_0x9052('0x7d'))][(_0x9052('0x7e'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3a134));}if(!_[_0x9052('0x88')](_0x3a134,_0x336ce4[_0x9052('0x51')][_0x9052('0xbe')])){throw _0x154ebb['status'](0x1f4)[_0x9052('0x2c')](new db[(_0x9052('0x7d'))]['ValidationError'](_0x9052('0xbf')+_0x3a134));}_0x3b187e[_0x336ce4[_0x9052('0x51')]['mapKeyOffline']]=_0x336ce4['body'][_0x9052('0x84')];})[_0x9052('0x10')](function(){return db[_0x9052('0x45')][_0x9052('0x4b')]({'where':{'id':_0x336ce4[_0x9052('0x48')]['id']},'include':[{'model':db[_0x9052('0x8b')],'as':_0x9052('0x90')},{'model':db['MailAccount'],'as':_0x9052('0xc0')}]});})[_0x9052('0x10')](handleEntityNotFound(_0x154ebb,null))[_0x9052('0x10')](function(_0x312894){if(_0x312894&&_0x312894[_0x9052('0x90')]){_0x4263c1=_0x312894;var _0x2bd8e1=_[_0x9052('0x97')](_0x336ce4[_0x9052('0x51')],{'firstName':_0x336ce4[_0x9052('0x51')][_0x9052('0x84')],'phone':_0x336ce4[_0x9052('0x51')][_0x9052('0x84')],'ListId':_0x312894[_0x9052('0x83')]});_0x2bd8e1[_0x336ce4[_0x9052('0x51')][_0x9052('0xbe')]]=_0x336ce4[_0x9052('0x51')]['from'];return db[_0x9052('0x7c')][_0x9052('0xc1')]({'where':_0x3b187e,'defaults':_0x2bd8e1});}})[_0x9052('0xab')](function(_0x11e6a7){if(_0x11e6a7){_0x5290a0=_0x11e6a7;var _0x1279c8=fs['readFileSync'](path[_0x9052('0x66')](config[_0x9052('0x67')],'server/files/templates/chatOfflineMessage.ejs'),_0x9052('0xc2'));var _0x47cbc6=ejs[_0x9052('0xc3')](_0x1279c8,{'body':_['toPairs'](_0x336ce4[_0x9052('0x51')][_0x9052('0x51')]),'bodyTitle':_0x4263c1[_0x9052('0xc4')]});return db[_0x9052('0xc5')][_0x9052('0x4c')]({'body':_0x47cbc6,'ContactId':_0x11e6a7['id'],'ChatWebsiteId':_0x4263c1['id']});}})[_0x9052('0x10')](function(_0x2ed39f){_0x1c4d8e=_0x2ed39f;if(_0x262867[_0x9052('0x39')]){var _0x416ab5=_0x262867[_0x9052('0x2f')](function(_0x251bfb){return{'name':_0x251bfb['originalname'],'basename':_0x251bfb[_0x9052('0x61')],'type':_0x251bfb[_0x9052('0xc6')],'ChatOfflineMessageId':_0x2ed39f['id']};});_0x6ded2b=_0x416ab5[_0x9052('0x2f')](_0x247073=>{var _0x2d50c9={'filename':_0x247073[_0x9052('0x2b')],'path':path['join'](config['root'],_0x9052('0xc7'),'files','attachments',_0x9052('0xc8'),_0x247073[_0x9052('0xc9')])};return _0x2d50c9;});if(!_0x4263c1[_0x9052('0xca')]){return db['sequelize']['transaction'](function(_0x311efb){return db[_0x9052('0xcb')][_0x9052('0xcc')](_0x416ab5,{'transaction':_0x311efb});});}}})['then'](function(){if(_0x1c4d8e){_0x379462=_0x1c4d8e;return db['MailAccount'][_0x9052('0x5b')]({'where':{'active':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]});}})[_0x9052('0x10')](function(_0x140b4e){if(_0x140b4e&&_0x140b4e[_0x9052('0xcd')]&&_0x4263c1[_0x9052('0xce')]&&_0x4263c1[_0x9052('0xcf')]){var _0x5e60b1={'tls':{'rejectUnauthorized':![]}};if(_0x140b4e[_0x9052('0xcd')]['service']){_0x5e60b1[_0x9052('0xd0')]=_0x140b4e[_0x9052('0xcd')]['service'];}else{_0x5e60b1[_0x9052('0xd1')]=_0x140b4e['Smtp'][_0x9052('0xd1')];_0x5e60b1[_0x9052('0xd2')]=_0x140b4e[_0x9052('0xcd')][_0x9052('0xd2')];_0x5e60b1[_0x9052('0xd3')]=_0x140b4e[_0x9052('0xcd')][_0x9052('0xd3')];}if(_0x140b4e['Smtp'][_0x9052('0xd4')]){_0x5e60b1[_0x9052('0xd5')]={'user':_0x140b4e[_0x9052('0xcd')][_0x9052('0x4d')],'pass':_0x140b4e[_0x9052('0xcd')][_0x9052('0xd6')]};}return respondWithRpcPromise(_0x9052('0xd7'),_0x9052('0xd8'),{'account':_0x5e60b1,'message':{'from':util[_0x9052('0xa0')]('\x22%s\x22\x20<%s>',_0x140b4e[_0x9052('0x2b')],_0x140b4e['email']||_0x140b4e[_0x9052('0xcd')][_0x9052('0x4d')]),'to':_0x4263c1[_0x9052('0xcf')],'subject':_0x4263c1[_0x9052('0xd9')],'html':_0x379462['body'],'attachments':_0x6ded2b}},client9003)[_0x9052('0x10')](function(){return _0x379462;})[_0x9052('0x1b')](function(_0x5d8392){console[_0x9052('0x16')](_0x5d8392);});}})[_0x9052('0x10')](function(){if(_0x4263c1&&_0x4263c1[_0x9052('0xca')]&&_0x4263c1[_0x9052('0xda')]){var _0x4dbc00=[];if(_0x262867[_0x9052('0x39')]){_0x4dbc00=_0x262867[_0x9052('0x2f')](function(_0x5da56b){return{'name':_0x5da56b[_0x9052('0xdb')],'basename':_0x5da56b['filename'],'type':_0x5da56b[_0x9052('0xc6')],'ChatOfflineMessageId':_0x1c4d8e['id']};});}var _0x4584c1;if(!_[_0x9052('0x6f')](_0x4263c1[_0x9052('0xdc')])){var _0x55c04a=_[_0x9052('0x2f')](_0x336ce4[_0x9052('0x51')],function(_0x233b6d){return _0x233b6d;});var _0xa42761=_['toPairsIn'](_0x55c04a)[0x0];var _0x5d35b7=_[_0x9052('0xdd')](_0xa42761,function(_0x492c8c){return _0x492c8c;});_0x4584c1=_0x5d35b7[0x1][_0x4263c1[_0x9052('0xdc')]];}var _0x5c4f43={'from':_0x5290a0[_0x9052('0xde')],'firstName':_0x5290a0['firstName'],'lastName':_0x5290a0[_0x9052('0x9d')],'mapKey':_0x9052('0xde'),'message':{'from':_0x5290a0[_0x9052('0xde')],'to':_0x4263c1['MailAccount'][_0x9052('0xde')],'cc':'','subject':_[_0x9052('0x6f')](_0x4584c1)?_0x4263c1[_0x9052('0xd9')]:_0x4584c1,'messageId':'','sentAt':new Date(),'attach':_0x4dbc00[_0x9052('0x39')],'attachments':_0x4dbc00,'originChannel':_0x9052('0xdf'),'ChatWebsiteId':_0x4263c1['id'],'ChatOfflineMessageId':_0x379462['id'],'originTo':_0x4263c1[_0x9052('0xc0')][_0x9052('0xde')]},'body':_0x379462['body']};var _0x492e75={'account':{'id':_0x4263c1[_0x9052('0xda')]},'body':_0x5c4f43,'log':_0x9052('0xe0')};return respondWithRpcPromise(_0x9052('0xe0'),_0x9052('0xe1'),_0x492e75,client9001)[_0x9052('0x10')](function(){return _0x379462;})[_0x9052('0x1b')](function(_0x5911e7){console[_0x9052('0x16')](_0x5911e7);});}return;})[_0x9052('0x10')](function(){if(_0x379462){return _0x379462;}})[_0x9052('0x10')](respondWithResult(_0x154ebb,null))[_0x9052('0x1b')](function(_0x270fae){console[_0x9052('0x16')](_0x9052('0x1b'),_0x270fae);for(var _0x1d3f22 of _0x262867){var _0x31bc31=path[_0x9052('0x66')](config['root'],'server',_0x9052('0xbc'),'attachments',_0x9052('0xc8'),_0x1d3f22[_0x9052('0x61')]);fs_extra[_0x9052('0xe2')](_0x31bc31)[_0x9052('0x1b')](function(_0x2b57a3){console[_0x9052('0x16')](_0x9052('0xe3'),_0x31bc31,_0x2b57a3);});}});};exports['addInteraction']=function(_0x557b87,_0x1eec94){return db[_0x9052('0xa9')][_0x9052('0x4b')]({'where':{'id':_0x557b87[_0x9052('0x48')]['id']}})[_0x9052('0x10')](handleEntityNotFound(_0x1eec94,null))[_0x9052('0x10')](function(_0x2a0aab){if(_0x2a0aab){return _0x2a0aab[_0x9052('0xe4')](_0x557b87[_0x9052('0x51')]['ids'],_[_0x9052('0xe5')](_0x557b87[_0x9052('0x51')],[_0x9052('0x58'),'id'])||{});}})[_0x9052('0x10')](respondWithResult(_0x1eec94,null))['catch'](handleError(_0x1eec94,null));};exports['getInteractions']=function(_0x5110ee,_0x537240){var _0x18083d={'raw':![],'where':{}};var _0x25ec1a={};var _0x3b33da={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x9052('0x5b')]({'where':{'id':_0x5110ee[_0x9052('0x48')]['id']}})[_0x9052('0x10')](handleEntityNotFound(_0x537240,null))[_0x9052('0x10')](function(_0x585e96){if(_0x585e96){_0x25ec1a['model']=_['keys'](db[_0x9052('0xa9')][_0x9052('0x30')]);_0x25ec1a[_0x9052('0x34')]=_['keys'](_0x5110ee[_0x9052('0x34')]);_0x25ec1a[_0x9052('0x35')]=_[_0x9052('0x36')](_0x25ec1a['model'],_0x25ec1a[_0x9052('0x34')]);_0x18083d[_0x9052('0x37')]=_[_0x9052('0x36')](_0x25ec1a[_0x9052('0x33')],qs[_0x9052('0x38')](_0x5110ee['query']['fields']));_0x18083d[_0x9052('0x37')]=_0x18083d['attributes']['length']?_0x18083d[_0x9052('0x37')]:_0x25ec1a[_0x9052('0x33')];if(!_0x5110ee['query']['hasOwnProperty'](_0x9052('0xe6'))){_0x18083d[_0x9052('0x20')]=qs[_0x9052('0x20')](_0x5110ee['query'][_0x9052('0x20')]);_0x18083d[_0x9052('0x1e')]=qs[_0x9052('0x1e')](_0x5110ee[_0x9052('0x34')][_0x9052('0x1e')]);}_0x18083d[_0x9052('0x3b')]=qs[_0x9052('0x3c')](_0x5110ee[_0x9052('0x34')][_0x9052('0x3c')]);_0x18083d[_0x9052('0x3f')]=qs[_0x9052('0x35')](_[_0x9052('0x3d')](_0x5110ee[_0x9052('0x34')],_0x25ec1a['filters']));_0x18083d[_0x9052('0x3f')][_0x9052('0x54')]=_0x585e96['id'];if(_0x5110ee[_0x9052('0x34')][_0x9052('0x3e')]){_0x18083d[_0x9052('0x3f')]=_['merge'](_0x18083d[_0x9052('0x3f')],{'$or':_['map'](_0x18083d[_0x9052('0x37')],function(_0x5d8d83){var _0x2724f6={};_0x2724f6[_0x5d8d83]={'$like':'%'+_0x5110ee[_0x9052('0x34')][_0x9052('0x3e')]+'%'};return _0x2724f6;})});}_0x18083d=_[_0x9052('0x40')]({},_0x18083d,_0x5110ee[_0x9052('0x42')]);return db[_0x9052('0xa9')][_0x9052('0x21')]({'where':_0x18083d['where']})[_0x9052('0x10')](function(_0x2d38e7){_0x3b33da[_0x9052('0x21')]=_0x2d38e7;if(_0x5110ee[_0x9052('0x34')]['includeAll']){_0x18083d[_0x9052('0x44')]=[{'model':db['CmContact'],'as':_0x9052('0xe7'),'required':![]},{'model':db[_0x9052('0xb4')],'as':'Owner','attributes':[_0x9052('0x2b'),_0x9052('0xe8'),_0x9052('0xe9')],'required':![]},{'model':db[_0x9052('0xea')],'as':_0x9052('0xeb'),'attributes':['id',_0x9052('0x2b'),_0x9052('0xec')],'where':_0x5110ee[_0x9052('0x34')][_0x9052('0xed')]?{'id':_0x5110ee[_0x9052('0x34')][_0x9052('0xed')]}:undefined,'required':_0x5110ee[_0x9052('0x34')][_0x9052('0xed')]?!![]:![]}];}return db[_0x9052('0xa9')]['findAll'](_0x18083d);})[_0x9052('0x10')](function(_0x48a490){_0x3b33da[_0x9052('0x46')]=_0x48a490;return _0x3b33da;});}})['then'](respondWithFilteredResult(_0x537240,_0x18083d))[_0x9052('0x1b')](handleError(_0x537240,null));};function iftimePromise(_0x2e1c4e,_0x184706){return respondWithRpcPromise(_0x9052('0xee'),_0x9052('0xef'),{'command':_0x184706['timezone']?util['format'](_0x9052('0xf0'),_0x2e1c4e[_0x9052('0xf1')],_0x184706['timezone']):util[_0x9052('0xa0')](_0x9052('0xf2'),_0x2e1c4e[_0x9052('0xf1')])},client9002)[_0x9052('0x10')](function(_0x3df066){var _0x5d32b4=_0x3df066&&_0x3df066[_0x9052('0xf3')](_0x9052('0xf4'))>=0x0?!![]:![];logger['info'](_0x9052('0xf5'),_0x184706['id'],_0x2e1c4e['id'],_0x2e1c4e[_0x9052('0xf1')],_0x5d32b4?_0x9052('0xf6'):_0x9052('0xf7'),_0x184706['timezone']?_0x184706[_0x9052('0xf8')]:_0x9052('0xf9'));return _0x5d32b4;})[_0x9052('0x1b')](function(_0x5789da){logger['error'](_0x9052('0xf5'),_0x184706['id'],_0x2e1c4e['id'],_0x2e1c4e[_0x9052('0xf1')],util[_0x9052('0xfa')](_0x5789da,{'showHidden':![],'depth':null}),_0x184706['timezone']?_0x184706[_0x9052('0xf8')]:_0x9052('0xf9'));return![];});}exports['getSnippet']=function(_0x7cc975,_0xfa55bd){var _0x1501b4=0x0;var _0x219f9a=0x0;var _0x3d780e=![];var _0xa1b09;var _0x4a2596;return db[_0x9052('0x45')][_0x9052('0x4b')]({'where':{'id':_0x7cc975['params']['id']},'include':[{'model':db[_0x9052('0xfb')],'as':'Interval','include':[{'model':db[_0x9052('0xfb')],'as':_0x9052('0xfc'),'attributes':['id',_0x9052('0xf1')],'raw':!![]}]}]})[_0x9052('0x10')](handleEntityNotFound(_0xfa55bd,null))[_0x9052('0x10')](function(_0x4d193f){if(_0x4d193f){_0xa1b09=_0x4d193f;return _0x4d193f[_0x9052('0xfd')]({'raw':!![]});}})[_0x9052('0x10')](function(_0x23cf4f){if(_0xa1b09){if(_0x23cf4f){_0x4a2596=_0x23cf4f;}}return require(_0x9052('0xfe'))[_0x9052('0xff')]();})[_0x9052('0x10')](function(_0x17562d){if(_0x17562d){_0x219f9a=_0x17562d[_0x9052('0x100')];_0x3d780e=_0x17562d['custom'];}})['then'](function(){return db[_0x9052('0xa9')][_0x9052('0x21')]({'where':{'closed':![]}});})[_0x9052('0x10')](function(_0x4bd124){_0x1501b4=_0x4bd124;if(_0x219f9a&&_0x4bd124>_0x219f9a){return db[_0x9052('0x101')][_0x9052('0x5b')]({'where':{'id':0x1}})['then'](function(_0xe10450){if(_0xe10450){_0xe10450[_0x9052('0x102')]('chatLicenseExceeded');}});}})['then'](function(){if(_0xa1b09['Interval']&&_0xa1b09[_0x9052('0xfb')]['Intervals']){var _0x201d88=[];for(var _0x454580=0x0;_0x454580<_0xa1b09['Interval'][_0x9052('0xfc')][_0x9052('0x39')];_0x454580++){var _0x1c4ba5=_0xa1b09[_0x9052('0xfb')][_0x9052('0xfc')][_0x454580][_0x9052('0x25')]({'plain':!![]});_0x201d88[_0x9052('0xb0')](iftimePromise(_0x1c4ba5,_0xa1b09));}return BPromise[_0x9052('0x103')](_0x201d88)['then'](function(_0x44e8dd){return _[_0x9052('0x104')](_0x44e8dd);});}else{return!![];}})[_0x9052('0x10')](function(_0x5b62b4){var _0x5f1b93=fs['readFileSync'](path[_0x9052('0x66')](config['root'],_0x9052('0x105')),_0x9052('0xc2'));var _0x1185e8={'remote':_0xa1b09[_0x9052('0x106')],'query':querystring['stringify'](_[_0x9052('0x40')](_0xa1b09[_0x9052('0x25')]({'plain':!![]}),{'customerIp':_0x7cc975['headers'][_0x9052('0x107')]||_0x7cc975[_0x9052('0x79')][_0x9052('0x108')]||_0x7cc975[_0x9052('0x109')][_0x9052('0x10a')]||_0x7cc975['ip'],'referer':_0x7cc975[_0x9052('0x79')][_0x9052('0x10b')],'openedInteractions':_0x1501b4,'maxInteractions':_0x219f9a,'virtual':_0x3d780e[_0x9052('0x100')],'online':_0x5b62b4,'custom':_0x3d780e}))[_0x9052('0x10c')](/'/g,'\x5c\x27')};_0xfa55bd[_0x9052('0x2c')](ejs[_0x9052('0xc3')](Mustache['render'](_0x5f1b93,_0x1185e8),{'proactiveActions':_0x4a2596,'alignment':_0xa1b09[_0x9052('0x10d')],'verticalAlignment':_0xa1b09['verticalAlignment'],'div_color':_0xa1b09[_0x9052('0xec')],'text_color':_0xa1b09[_0x9052('0x10e')],'button_color':_0xa1b09[_0x9052('0x10f')],'background_color':_0xa1b09[_0x9052('0x110')]}));})[_0x9052('0x1b')](handleError(_0xfa55bd,null));};exports[_0x9052('0x111')]=function(_0x19c9b5,_0x31a01a){var _0x41800e=_0x19c9b5['params']['id'];var _0x525147=_0x19c9b5[_0x9052('0x51')];var _0x3a8f4b=0xc8;var _0x5cf6e5=null;return db[_0x9052('0x112')][_0x9052('0x113')]({'isolationLevel':db['sequelize'][_0x9052('0x114')][_0x9052('0x115')][_0x9052('0x116')]},function(_0x420e6d){return db[_0x9052('0x45')][_0x9052('0x5b')]({'where':{'id':_0x41800e},'transaction':_0x420e6d})['then'](function(_0x729e4f){if(_0x729e4f){return db[_0x9052('0x8e')]['destroy']({'where':{'ChatWebsiteId':_0x41800e},'transaction':_0x420e6d})[_0x9052('0x10')](function(){var _0x404d19=_[_0x9052('0x2f')](_0x525147,function(_0x11147f){_0x11147f[_0x9052('0x54')]=_0x41800e;return _0x11147f;});return db[_0x9052('0x8e')]['bulkCreate'](_0x404d19,{'transaction':_0x420e6d});});}else{_0x3a8f4b=0x194;_0x5cf6e5=[];}});})[_0x9052('0x10')](function(){if(_0x3a8f4b!==0x194){return db['ChatApplication'][_0x9052('0x117')]({'where':{'ChatWebsiteId':_0x41800e},'order':'priority'})[_0x9052('0x10')](function(_0xc7b6ff){_0x5cf6e5=_0xc7b6ff;});}})[_0x9052('0x1b')](function(_0x3a27d0){_0x3a8f4b=0x1f4;logger[_0x9052('0x16')](_0x3a27d0[_0x9052('0x2a')]);if(_0x3a27d0['name']){delete _0x3a27d0[_0x9052('0x2b')];}_0x5cf6e5=_0x3a27d0;})[_0x9052('0x118')](function(){if(_0x5cf6e5===null){_0x31a01a[_0x9052('0x29')](_0x3a8f4b);}else{if(_0x3a8f4b===0x1f4){_0x31a01a[_0x9052('0x1c')](_0x3a8f4b)[_0x9052('0x2c')](_0x5cf6e5);}else{_0x31a01a[_0x9052('0x1c')](_0x3a8f4b)[_0x9052('0x23')](_0x5cf6e5);}}});};exports[_0x9052('0x119')]=function(_0x10e055,_0x4682df){var _0x34cabc={};var _0x3cd9fa={};var _0x1a9c69;var _0x20f09d;return db['ChatWebsite'][_0x9052('0x5b')]({'where':{'id':_0x10e055[_0x9052('0x48')]['id']}})['then'](handleEntityNotFound(_0x4682df,null))[_0x9052('0x10')](function(_0x1e2dee){if(_0x1e2dee){_0x1a9c69=_0x1e2dee;_0x3cd9fa[_0x9052('0x33')]=_[_0x9052('0x4a')](db[_0x9052('0x8e')][_0x9052('0x30')]);_0x3cd9fa['query']=_[_0x9052('0x4a')](_0x10e055['query']);_0x3cd9fa['filters']=_[_0x9052('0x36')](_0x3cd9fa['model'],_0x3cd9fa[_0x9052('0x34')]);_0x34cabc[_0x9052('0x37')]=_['intersection'](_0x3cd9fa[_0x9052('0x33')],qs[_0x9052('0x38')](_0x10e055[_0x9052('0x34')][_0x9052('0x38')]));_0x34cabc['attributes']=_0x34cabc[_0x9052('0x37')]['length']?_0x34cabc[_0x9052('0x37')]:_0x3cd9fa[_0x9052('0x33')];_0x34cabc[_0x9052('0x3b')]=qs[_0x9052('0x3c')](_0x10e055['query']['sort']);_0x34cabc['where']=qs[_0x9052('0x35')](_[_0x9052('0x3d')](_0x10e055[_0x9052('0x34')],_0x3cd9fa[_0x9052('0x35')]));if(_0x10e055['query'][_0x9052('0x3e')]){_0x34cabc['where']=_[_0x9052('0x40')](_0x34cabc[_0x9052('0x3f')],{'$or':_['map'](_0x34cabc[_0x9052('0x37')],function(_0x2a592d){var _0x415f8e={};_0x415f8e[_0x2a592d]={'$like':'%'+_0x10e055[_0x9052('0x34')][_0x9052('0x3e')]+'%'};return _0x415f8e;})});}_0x34cabc=_['merge']({},_0x34cabc,_0x10e055[_0x9052('0x42')]);return _0x1a9c69[_0x9052('0x119')](_0x34cabc);}})['then'](function(_0x80aade){if(_0x80aade){_0x20f09d=_0x80aade[_0x9052('0x39')];if(!_0x10e055['query']['hasOwnProperty'](_0x9052('0xe6'))){_0x34cabc['limit']=qs[_0x9052('0x20')](_0x10e055[_0x9052('0x34')][_0x9052('0x20')]);_0x34cabc['offset']=qs[_0x9052('0x1e')](_0x10e055[_0x9052('0x34')]['offset']);}return _0x1a9c69[_0x9052('0x119')](_0x34cabc);}})[_0x9052('0x10')](function(_0x5ea77d){if(_0x5ea77d){return _0x5ea77d?{'count':_0x20f09d,'rows':_0x5ea77d}:null;}})['then'](respondWithResult(_0x4682df,null))[_0x9052('0x1b')](handleError(_0x4682df,null));};exports[_0x9052('0x11a')]=function(_0x165085,_0x332a5a){return db['chatProactiveAction'][_0x9052('0x4b')]({'where':{'id':_0x165085[_0x9052('0x48')]['id']}})[_0x9052('0x10')](handleEntityNotFound(_0x332a5a,null))[_0x9052('0x10')](function(_0xe3ebb0){if(_0xe3ebb0){return _0xe3ebb0[_0x9052('0x11a')](_0x165085['body'][_0x9052('0x58')],_['omit'](_0x165085[_0x9052('0x51')],[_0x9052('0x58'),'id'])||{});}})[_0x9052('0x10')](respondWithResult(_0x332a5a,null))[_0x9052('0x1b')](handleError(_0x332a5a,null));};exports[_0x9052('0xfd')]=function(_0x248359,_0xcd6d3b){var _0x18e9b6={};var _0x269e26={};var _0x53a6c4;var _0x2b9660;return db[_0x9052('0x45')][_0x9052('0x5b')]({'where':{'id':_0x248359['params']['id']}})[_0x9052('0x10')](handleEntityNotFound(_0xcd6d3b,null))[_0x9052('0x10')](function(_0x3f2243){if(_0x3f2243){_0x53a6c4=_0x3f2243;_0x269e26[_0x9052('0x33')]=_[_0x9052('0x4a')](db[_0x9052('0x11b')]['rawAttributes']);_0x269e26[_0x9052('0x34')]=_['keys'](_0x248359[_0x9052('0x34')]);_0x269e26[_0x9052('0x35')]=_[_0x9052('0x36')](_0x269e26[_0x9052('0x33')],_0x269e26['query']);_0x18e9b6['attributes']=_[_0x9052('0x36')](_0x269e26['model'],qs[_0x9052('0x38')](_0x248359[_0x9052('0x34')]['fields']));_0x18e9b6[_0x9052('0x37')]=_0x18e9b6[_0x9052('0x37')][_0x9052('0x39')]?_0x18e9b6[_0x9052('0x37')]:_0x269e26[_0x9052('0x33')];_0x18e9b6[_0x9052('0x3b')]=qs[_0x9052('0x3c')](_0x248359['query'][_0x9052('0x3c')]);_0x18e9b6['where']=qs[_0x9052('0x35')](_[_0x9052('0x3d')](_0x248359[_0x9052('0x34')],_0x269e26[_0x9052('0x35')]));if(_0x248359['query']['filter']){_0x18e9b6[_0x9052('0x3f')]=_[_0x9052('0x40')](_0x18e9b6[_0x9052('0x3f')],{'$or':_['map'](_0x18e9b6[_0x9052('0x37')],function(_0x5b959c){var _0x5c4d9d={};_0x5c4d9d[_0x5b959c]={'$like':'%'+_0x248359[_0x9052('0x34')][_0x9052('0x3e')]+'%'};return _0x5c4d9d;})});}_0x18e9b6=_['merge']({},_0x18e9b6,_0x248359[_0x9052('0x42')]);return _0x53a6c4['getProactiveActions'](_0x18e9b6);}})[_0x9052('0x10')](function(_0xd5884a){if(_0xd5884a){_0x2b9660=_0xd5884a[_0x9052('0x39')];if(!_0x248359['query'][_0x9052('0x3a')](_0x9052('0xe6'))){_0x18e9b6[_0x9052('0x20')]=qs[_0x9052('0x20')](_0x248359[_0x9052('0x34')][_0x9052('0x20')]);_0x18e9b6[_0x9052('0x1e')]=qs[_0x9052('0x1e')](_0x248359[_0x9052('0x34')][_0x9052('0x1e')]);}return _0x53a6c4['getProactiveActions'](_0x18e9b6);}})[_0x9052('0x10')](function(_0x104a30){if(_0x104a30){return _0x104a30?{'count':_0x2b9660,'rows':_0x104a30}:null;}})[_0x9052('0x10')](respondWithResult(_0xcd6d3b,null))[_0x9052('0x1b')](handleError(_0xcd6d3b,null));};exports[_0x9052('0x11c')]=function(_0x59c647,_0x140be2){var _0x478c65=_0x59c647[_0x9052('0x34')][_0x9052('0x11d')]==='false'?_0x9052('0x11e'):_0x9052('0x11f');return db[_0x9052('0x45')][_0x9052('0x4b')]({'attributes':['id',_0x478c65],'where':{'id':_0x59c647[_0x9052('0x48')]['id']}})[_0x9052('0x10')](handleEntityNotFound(_0x140be2,null))[_0x9052('0x10')](function(_0x3154ac){if(_0x3154ac){var _0x512522=_0x3154ac[_0x478c65];var _0x3e911f=_0x512522&&_0x512522[_0x9052('0x120')]?_0x512522[_0x9052('0x120')]:[];_0x140be2[_0x9052('0x2c')]({'fromKey':_['isNil'](_0x512522[_0x9052('0x121')])?undefined:_0x512522[_0x9052('0x121')],'count':_0x3e911f[_0x9052('0x39')],'rows':_0x3e911f});}})[_0x9052('0x1b')](handleError(_0x140be2,null));};exports['getOfflineMessages']=function(_0x49ece8,_0x8ebe2c){var _0x5edc49={'raw':![],'where':{}};var _0x111adf={};var _0xbf7e2={'count':0x0,'rows':[]};return db[_0x9052('0x45')][_0x9052('0x5b')]({'where':{'id':_0x49ece8[_0x9052('0x48')]['id']}})[_0x9052('0x10')](handleEntityNotFound(_0x8ebe2c,null))['then'](function(_0x5ef88f){if(_0x5ef88f){_0x111adf['model']=_[_0x9052('0x4a')](db[_0x9052('0xc5')]['rawAttributes']);_0x111adf[_0x9052('0x34')]=_[_0x9052('0x4a')](_0x49ece8[_0x9052('0x34')]);_0x111adf[_0x9052('0x35')]=_['intersection'](_0x111adf[_0x9052('0x33')],_0x111adf[_0x9052('0x34')]);_0x5edc49[_0x9052('0x37')]=_['intersection'](_0x111adf[_0x9052('0x33')],qs[_0x9052('0x38')](_0x49ece8[_0x9052('0x34')]['fields']));_0x5edc49[_0x9052('0x37')]=_0x5edc49[_0x9052('0x37')]['length']?_0x5edc49[_0x9052('0x37')]:_0x111adf['model'];if(!_0x49ece8['query'][_0x9052('0x3a')](_0x9052('0xe6'))){_0x5edc49[_0x9052('0x20')]=qs[_0x9052('0x20')](_0x49ece8[_0x9052('0x34')][_0x9052('0x20')]);_0x5edc49[_0x9052('0x1e')]=qs[_0x9052('0x1e')](_0x49ece8[_0x9052('0x34')][_0x9052('0x1e')]);}_0x5edc49[_0x9052('0x3b')]=qs['sort'](_0x49ece8[_0x9052('0x34')][_0x9052('0x3c')]);_0x5edc49[_0x9052('0x3f')]=qs[_0x9052('0x35')](_[_0x9052('0x3d')](_0x49ece8['query'],_0x111adf[_0x9052('0x35')]));_0x5edc49['where']['ChatWebsiteId']=_0x5ef88f['id'];if(_0x49ece8[_0x9052('0x34')][_0x9052('0x3e')]){_0x5edc49[_0x9052('0x3f')]=_[_0x9052('0x40')](_0x5edc49[_0x9052('0x3f')],{'$or':_[_0x9052('0x2f')](_0x5edc49[_0x9052('0x37')],function(_0x225bfd){var _0x393502={};_0x393502[_0x225bfd]={'$like':'%'+_0x49ece8[_0x9052('0x34')][_0x9052('0x3e')]+'%'};return _0x393502;})});}_0x5edc49=_[_0x9052('0x40')]({},_0x5edc49,_0x49ece8[_0x9052('0x42')]);return db['ChatOfflineMessage']['count']({'where':_0x5edc49[_0x9052('0x3f')]})[_0x9052('0x10')](function(_0x2670dc){_0xbf7e2['count']=_0x2670dc;if(_0x49ece8['query'][_0x9052('0x43')]){_0x5edc49[_0x9052('0x44')]=[{'all':!![]}];}else{_0x5edc49[_0x9052('0x44')]=[{'model':db['CmContact'],'as':_0x9052('0xe7'),'required':![]},{'model':db['Attachment'],'as':_0x9052('0x122'),'required':![]}];}return db['ChatOfflineMessage'][_0x9052('0x56')](_0x5edc49);})[_0x9052('0x10')](function(_0x137412){_0xbf7e2[_0x9052('0x46')]=_0x137412;return _0xbf7e2;});}})[_0x9052('0x10')](respondWithFilteredResult(_0x8ebe2c,_0x5edc49))['catch'](handleError(_0x8ebe2c,null));};exports[_0x9052('0x123')]=function(_0x4d7197,_0x4e89b6){return db[_0x9052('0x45')][_0x9052('0x4b')]({'where':{'id':_0x4d7197[_0x9052('0x48')]['id']}})[_0x9052('0x10')](handleEntityNotFound(_0x4e89b6,null))['then'](function(_0x555ddf){if(_0x555ddf){return _0x555ddf['addAgents'](_0x4d7197[_0x9052('0x51')][_0x9052('0x58')],_['omit'](_0x4d7197[_0x9052('0x51')],[_0x9052('0x58'),'id'])||{})[_0x9052('0xab')](function(_0x15fb69){for(var _0x13d8e1=0x0;_0x13d8e1<_0x4d7197['body'][_0x9052('0x58')]['length'];_0x13d8e1+=0x1){socket[_0x9052('0x124')](_0x9052('0x125'),{'UserId':Number(_0x4d7197[_0x9052('0x51')][_0x9052('0x58')][_0x13d8e1]),'ChatWebsiteId':Number(_0x4d7197[_0x9052('0x48')]['id'])});}return _0x15fb69;});}})[_0x9052('0x10')](respondWithResult(_0x4e89b6,null))[_0x9052('0x1b')](handleError(_0x4e89b6,null));};exports[_0x9052('0x126')]=function(_0x547de7,_0x146d73){return db[_0x9052('0x45')][_0x9052('0x4b')]({'where':{'id':_0x547de7['params']['id']}})[_0x9052('0x10')](handleEntityNotFound(_0x146d73,null))['then'](function(_0x55a36f){if(_0x55a36f){return _0x55a36f[_0x9052('0x126')](_0x547de7[_0x9052('0x34')][_0x9052('0x58')])[_0x9052('0x10')](function(){if(_[_0x9052('0x127')](_0x547de7[_0x9052('0x34')][_0x9052('0x58')])){for(var _0x4e2722=0x0;_0x4e2722<_0x547de7['query'][_0x9052('0x58')][_0x9052('0x39')];_0x4e2722+=0x1){socket[_0x9052('0x124')](_0x9052('0x128'),{'UserId':Number(_0x547de7[_0x9052('0x34')][_0x9052('0x58')][_0x4e2722]),'ChatWebsiteId':Number(_0x547de7[_0x9052('0x48')]['id'])});}}else{socket['emit'](_0x9052('0x128'),{'UserId':Number(_0x547de7[_0x9052('0x34')]['ids']),'ChatWebsiteId':Number(_0x547de7['params']['id'])});}});}})[_0x9052('0x10')](respondWithStatusCode(_0x146d73,null))[_0x9052('0x1b')](handleError(_0x146d73,null));};exports[_0x9052('0x129')]=function(_0x437209,_0xe4dea6){var _0x454805={};var _0x2f0c8c={};var _0x26dcd3;var _0x42a223;return db[_0x9052('0x45')]['findOne']({'where':{'id':_0x437209[_0x9052('0x48')]['id']}})[_0x9052('0x10')](handleEntityNotFound(_0xe4dea6,null))['then'](function(_0x3577c7){if(_0x3577c7){_0x26dcd3=_0x3577c7;_0x2f0c8c[_0x9052('0x33')]=_['keys'](db['User'][_0x9052('0x30')]);_0x2f0c8c[_0x9052('0x34')]=_[_0x9052('0x4a')](_0x437209[_0x9052('0x34')]);_0x2f0c8c['filters']=_[_0x9052('0x36')](_0x2f0c8c[_0x9052('0x33')],_0x2f0c8c[_0x9052('0x34')]);_0x454805[_0x9052('0x37')]=_[_0x9052('0x36')](_0x2f0c8c[_0x9052('0x33')],qs[_0x9052('0x38')](_0x437209[_0x9052('0x34')][_0x9052('0x38')]));_0x454805['attributes']=_0x454805[_0x9052('0x37')]['length']?_0x454805[_0x9052('0x37')]:_0x2f0c8c[_0x9052('0x33')];_0x454805[_0x9052('0x3b')]=qs[_0x9052('0x3c')](_0x437209[_0x9052('0x34')][_0x9052('0x3c')]);_0x454805['where']=qs['filters'](_[_0x9052('0x3d')](_0x437209[_0x9052('0x34')],_0x2f0c8c['filters']));if(_0x437209[_0x9052('0x34')][_0x9052('0x3e')]){_0x454805[_0x9052('0x3f')]=_[_0x9052('0x40')](_0x454805[_0x9052('0x3f')],{'$or':_[_0x9052('0x2f')](_0x454805[_0x9052('0x37')],function(_0x1c41a9){var _0x244216={};_0x244216[_0x1c41a9]={'$like':'%'+_0x437209[_0x9052('0x34')][_0x9052('0x3e')]+'%'};return _0x244216;})});}_0x454805=_[_0x9052('0x40')]({},_0x454805,_0x437209[_0x9052('0x42')]);return _0x26dcd3[_0x9052('0x129')](_0x454805);}})[_0x9052('0x10')](function(_0x4805e0){if(_0x4805e0){_0x42a223=_0x4805e0[_0x9052('0x39')];if(!_0x437209[_0x9052('0x34')][_0x9052('0x3a')](_0x9052('0xe6'))){_0x454805[_0x9052('0x20')]=qs[_0x9052('0x20')](_0x437209[_0x9052('0x34')][_0x9052('0x20')]);_0x454805['offset']=qs['offset'](_0x437209[_0x9052('0x34')]['offset']);}return _0x26dcd3[_0x9052('0x129')](_0x454805);}})['then'](function(_0x5ad324){if(_0x5ad324){return _0x5ad324?{'count':_0x42a223,'rows':_0x5ad324}:null;}})['then'](respondWithResult(_0xe4dea6,null))[_0x9052('0x1b')](handleError(_0xe4dea6,null));}; \ No newline at end of file +var _0x96bb=['customerIp','headers','cf-connecting-ip','x-forwarded-for','first','split','firstName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','type','threadId','ChatInteraction','externalUrl','ContactId','interaction','lastName','messageId','created','autoclose','push','*,*,*,*','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','files','no\x20available\x20attributes','createdAt','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','attachments','basename','openNewInteraction','transaction','MailServerOut','forwardOffline','Smtp','service','host','port','secure','authentication','auth','pass','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','MailAccountId','subjectOffline','toPairsIn','offlineMessageSubject','NotifyMailAccount','offline-chat','Could\x20not\x20remove\x20attachment\x20file','addInteraction','ids','getInteractions','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','ONLINE','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','getProactiveActions','increment','chatLicenseExceeded','Intervals','all','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','virtual','replace','verticalAlignment','textColor','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','bulkCreate','findAndCountAll','priority','getApplications','addProactiveActions','chatProactiveAction','omit','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Contact','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','ejs','lodash','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','status','json','undefined','limit','count','offset','set','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','end','sendStatus','stack','name','send','index','Pause','map','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','ChatWebsite','includeAll','include','findAll','rows','show','rawAttributes','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','mandatoryDispositionPause','describe','addDisposition','ChatWebsiteId','Disposition','findOne','removeDispositions','CannedAnswer','removeAnswers','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','sitepic','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','isNil','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','setUA','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','difference','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','Contacts','Applications','List','account','applications','list','orderBy','asc','contact'];(function(_0x1170a9,_0x4d9a17){var _0x516985=function(_0x359349){while(--_0x359349){_0x1170a9['push'](_0x1170a9['shift']());}};_0x516985(++_0x4d9a17);}(_0x96bb,0x93));var _0xb96b=function(_0x568b73,_0x403347){_0x568b73=_0x568b73-0x0;var _0x2ff268=_0x96bb[_0x568b73];return _0x2ff268;};'use strict';var BPromise=require(_0xb96b('0x0'));var Mustache=require(_0xb96b('0x1'));var util=require(_0xb96b('0x2'));var path=require(_0xb96b('0x3'));var ejs=require(_0xb96b('0x4'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb96b('0x5'));var querystring=require('querystring');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require(_0xb96b('0x6'));var db=require('../../mysqldb')['db'];config[_0xb96b('0x7')]=_[_0xb96b('0x8')](config[_0xb96b('0x7')],{'host':_0xb96b('0x9'),'port':0x18eb});var socket=require(_0xb96b('0xa'))(new Redis(config[_0xb96b('0x7')]));require(_0xb96b('0xb'))[_0xb96b('0xc')](socket);var jayson=require(_0xb96b('0xd'));var client=jayson[_0xb96b('0xe')][_0xb96b('0xf')]({'port':0x232c});var client9002=jayson[_0xb96b('0xe')][_0xb96b('0xf')]({'port':0x232a});var client9003=jayson[_0xb96b('0xe')]['http']({'port':0x232b});var client9001=jayson['client'][_0xb96b('0xf')]({'port':0x2329});function respondWithRpcPromise(_0x451a9f,_0x39bbd7,_0x46ef4f,_0x2b213d){return new BPromise(function(_0x3aab83,_0x390f16){var _0x34bdd9=_0x2b213d||client;return _0x34bdd9['request'](_0x451a9f,_0x46ef4f)[_0xb96b('0x10')](function(_0x8ca70e){logger['info'](_0xb96b('0x11'),_0x39bbd7,_0xb96b('0x12'));logger[_0xb96b('0x13')](_0xb96b('0x14'),_0x39bbd7,_0xb96b('0x12'),JSON[_0xb96b('0x15')](_0x8ca70e));if(_0x8ca70e[_0xb96b('0x16')]){if(_0x8ca70e['error']['code']===0x1f4){logger[_0xb96b('0x16')](_0xb96b('0x11'),_0x39bbd7,_0x8ca70e[_0xb96b('0x16')][_0xb96b('0x17')]);return _0x390f16(_0x8ca70e[_0xb96b('0x16')][_0xb96b('0x17')]);}logger[_0xb96b('0x16')](_0xb96b('0x11'),_0x39bbd7,_0x8ca70e[_0xb96b('0x16')][_0xb96b('0x17')]);return _0x3aab83(_0x8ca70e['error']['message']);}else{logger[_0xb96b('0x18')](_0xb96b('0x11'),_0x39bbd7,_0xb96b('0x12'));_0x3aab83(_0x8ca70e[_0xb96b('0x19')][_0xb96b('0x17')]);}})['catch'](function(_0x1f8736){logger[_0xb96b('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x39bbd7,_0x1f8736);_0x390f16(_0x1f8736);});});}function respondWithStatusCode(_0x3f65e3,_0x3e7827){_0x3e7827=_0x3e7827||0xcc;return function(_0xdaeb03){if(_0xdaeb03){return _0x3f65e3['sendStatus'](_0x3e7827);}return _0x3f65e3[_0xb96b('0x1a')](_0x3e7827)['end']();};}function respondWithResult(_0x2bedb8,_0x15747f){_0x15747f=_0x15747f||0xc8;return function(_0x580b4f){if(_0x580b4f){return _0x2bedb8['status'](_0x15747f)[_0xb96b('0x1b')](_0x580b4f);}};}function respondWithFilteredResult(_0x22af0a,_0x9a0b70){return function(_0x321d95){if(_0x321d95){var _0x1c6f94=typeof _0x9a0b70['offset']===_0xb96b('0x1c')&&typeof _0x9a0b70[_0xb96b('0x1d')]===_0xb96b('0x1c');var _0x47431b=_0x321d95[_0xb96b('0x1e')];var _0x42567c=_0x1c6f94?0x0:_0x9a0b70[_0xb96b('0x1f')];var _0x340344=_0x1c6f94?_0x321d95[_0xb96b('0x1e')]:_0x9a0b70[_0xb96b('0x1f')]+_0x9a0b70['limit'];var _0x572158;if(_0x340344>=_0x47431b){_0x340344=_0x47431b;_0x572158=0xc8;}else{_0x572158=0xce;}_0x22af0a['status'](_0x572158);return _0x22af0a[_0xb96b('0x20')](_0xb96b('0x21'),_0x42567c+'-'+_0x340344+'/'+_0x47431b)['json'](_0x321d95);}return null;};}function saveUpdates(_0x4a455f){return function(_0x5bb419){if(_0x5bb419){return _0x5bb419[_0xb96b('0x22')](_0x4a455f)[_0xb96b('0x10')](function(_0x44fa39){return _0x44fa39;});}return null;};}function removeEntity(_0x2ad318){return function(_0x3baed1){if(_0x3baed1){return _0x3baed1[_0xb96b('0x23')]()[_0xb96b('0x10')](function(){var _0x39615f=_0x3baed1[_0xb96b('0x24')]({'plain':!![]});var _0x4a78ee=_0xb96b('0x25');return db[_0xb96b('0x26')][_0xb96b('0x23')]({'where':{'type':_0x4a78ee,'resourceId':_0x39615f['id']}})['then'](function(){return _0x3baed1;});})[_0xb96b('0x10')](function(){_0x2ad318[_0xb96b('0x1a')](0xcc)[_0xb96b('0x27')]();});}};}function handleEntityNotFound(_0x58d800){return function(_0x19b463){if(!_0x19b463){_0x58d800[_0xb96b('0x28')](0x194);}return _0x19b463;};}function handleError(_0x4903ba,_0xd10e09){_0xd10e09=_0xd10e09||0x1f4;return function(_0xae0dc5){logger[_0xb96b('0x16')](_0xae0dc5[_0xb96b('0x29')]);if(_0xae0dc5['name']){delete _0xae0dc5[_0xb96b('0x2a')];}_0x4903ba[_0xb96b('0x1a')](_0xd10e09)[_0xb96b('0x2b')](_0xae0dc5);};}exports[_0xb96b('0x2c')]=function(_0x156e21,_0x3b5878){var _0x35eba3={'include':[{'model':db[_0xb96b('0x2d')],'as':'mandatoryDispositionPause'}]},_0x262109={},_0x3f3b35={'count':0x0,'rows':[]};var _0x23daf7=_[_0xb96b('0x2e')](db['ChatWebsite']['rawAttributes'],function(_0x4509d5){return{'name':_0x4509d5['fieldName'],'type':_0x4509d5['type'][_0xb96b('0x2f')]};});_0x262109['model']=_[_0xb96b('0x2e')](_0x23daf7,'name');_0x262109[_0xb96b('0x30')]=_[_0xb96b('0x31')](_0x156e21['query']);_0x262109['filters']=_[_0xb96b('0x32')](_0x262109['model'],_0x262109[_0xb96b('0x30')]);_0x35eba3[_0xb96b('0x33')]=_[_0xb96b('0x32')](_0x262109[_0xb96b('0x34')],qs[_0xb96b('0x35')](_0x156e21['query'][_0xb96b('0x35')]));_0x35eba3[_0xb96b('0x33')]=_0x35eba3[_0xb96b('0x33')][_0xb96b('0x36')]?_0x35eba3[_0xb96b('0x33')]:_0x262109[_0xb96b('0x34')];if(!_0x156e21[_0xb96b('0x30')][_0xb96b('0x37')](_0xb96b('0x38'))){_0x35eba3[_0xb96b('0x1d')]=qs['limit'](_0x156e21[_0xb96b('0x30')]['limit']);_0x35eba3[_0xb96b('0x1f')]=qs[_0xb96b('0x1f')](_0x156e21[_0xb96b('0x30')]['offset']);}_0x35eba3[_0xb96b('0x39')]=qs[_0xb96b('0x3a')](_0x156e21[_0xb96b('0x30')][_0xb96b('0x3a')]);_0x35eba3[_0xb96b('0x3b')]=qs[_0xb96b('0x3c')](_[_0xb96b('0x3d')](_0x156e21[_0xb96b('0x30')],_0x262109[_0xb96b('0x3c')]),_0x23daf7);if(_0x156e21[_0xb96b('0x30')][_0xb96b('0x3e')]){_0x35eba3[_0xb96b('0x3b')]=_[_0xb96b('0x3f')](_0x35eba3['where'],{'$or':_[_0xb96b('0x2e')](_0x23daf7,function(_0x4798ac){if(_0x4798ac['type']!==_0xb96b('0x40')){var _0x111157={};_0x111157[_0x4798ac[_0xb96b('0x2a')]]={'$like':'%'+_0x156e21[_0xb96b('0x30')][_0xb96b('0x3e')]+'%'};return _0x111157;}})});}_0x35eba3=_[_0xb96b('0x3f')]({},_0x35eba3,_0x156e21[_0xb96b('0x41')]);var _0x535aa1={'where':_0x35eba3[_0xb96b('0x3b')]};return db[_0xb96b('0x42')][_0xb96b('0x1e')](_0x535aa1)['then'](function(_0x8d30ce){_0x3f3b35[_0xb96b('0x1e')]=_0x8d30ce;if(_0x156e21[_0xb96b('0x30')][_0xb96b('0x43')]){_0x35eba3[_0xb96b('0x44')]=[{'all':!![]}];}return db['ChatWebsite'][_0xb96b('0x45')](_0x35eba3);})[_0xb96b('0x10')](function(_0x469359){_0x3f3b35[_0xb96b('0x46')]=_0x469359;return _0x3f3b35;})[_0xb96b('0x10')](respondWithFilteredResult(_0x3b5878,_0x35eba3))['catch'](handleError(_0x3b5878,null));};exports[_0xb96b('0x47')]=function(_0x590c52,_0x200e8c){var _0x12c784={'raw':![],'where':{'id':_0x590c52['params']['id']},'include':[{'model':db[_0xb96b('0x2d')],'as':'mandatoryDispositionPause'}]},_0xb28f84={};_0xb28f84[_0xb96b('0x34')]=_[_0xb96b('0x31')](db['ChatWebsite'][_0xb96b('0x48')]);_0xb28f84[_0xb96b('0x30')]=_[_0xb96b('0x31')](_0x590c52['query']);_0xb28f84[_0xb96b('0x3c')]=_[_0xb96b('0x32')](_0xb28f84['model'],_0xb28f84[_0xb96b('0x30')]);_0x12c784[_0xb96b('0x33')]=_[_0xb96b('0x32')](_0xb28f84[_0xb96b('0x34')],qs['fields'](_0x590c52[_0xb96b('0x30')][_0xb96b('0x35')]));_0x12c784[_0xb96b('0x33')]=_0x12c784[_0xb96b('0x33')][_0xb96b('0x36')]?_0x12c784[_0xb96b('0x33')]:_0xb28f84['model'];if(_0x590c52[_0xb96b('0x30')][_0xb96b('0x43')]){_0x12c784[_0xb96b('0x44')]=[{'all':!![]}];}_0x12c784=_[_0xb96b('0x3f')]({},_0x12c784,_0x590c52['options']);return db['ChatWebsite'][_0xb96b('0x49')](_0x12c784)[_0xb96b('0x10')](handleEntityNotFound(_0x200e8c,null))[_0xb96b('0x10')](respondWithResult(_0x200e8c,null))[_0xb96b('0x4a')](handleError(_0x200e8c,null));};exports[_0xb96b('0x4b')]=function(_0x50792b,_0x5c00f7){return db[_0xb96b('0x42')][_0xb96b('0x4b')](_0x50792b[_0xb96b('0x4c')],{})[_0xb96b('0x10')](function(_0x7e3639){var _0x26b1d3=_0x50792b[_0xb96b('0x4d')]['get']({'plain':!![]});if(!_0x26b1d3)throw new Error(_0xb96b('0x4e'));if(_0x26b1d3[_0xb96b('0x4f')]===_0xb96b('0x4d')){var _0x8f551b=_0x7e3639['get']({'plain':!![]});var _0x4f9033=_0xb96b('0x25');return db[_0xb96b('0x50')][_0xb96b('0x49')]({'where':{'name':_0x4f9033,'userProfileId':_0x26b1d3['userProfileId']},'raw':!![]})[_0xb96b('0x10')](function(_0x3fb6e8){if(_0x3fb6e8&&_0x3fb6e8[_0xb96b('0x51')]===0x0){return db[_0xb96b('0x26')][_0xb96b('0x4b')]({'name':_0x8f551b[_0xb96b('0x2a')],'resourceId':_0x8f551b['id'],'type':_0x3fb6e8[_0xb96b('0x2a')],'sectionId':_0x3fb6e8['id']},{})['then'](function(){return _0x7e3639;});}else{return _0x7e3639;}})[_0xb96b('0x4a')](function(_0x253f94){logger['error'](_0xb96b('0x52'),_0x253f94);throw _0x253f94;});}return _0x7e3639;})['then'](respondWithResult(_0x5c00f7,0xc9))[_0xb96b('0x4a')](handleError(_0x5c00f7,null));};exports[_0xb96b('0x22')]=function(_0x67009b,_0x274660){if(_0x67009b[_0xb96b('0x4c')]['id']){delete _0x67009b[_0xb96b('0x4c')]['id'];}return db[_0xb96b('0x42')][_0xb96b('0x49')]({'where':{'id':_0x67009b[_0xb96b('0x53')]['id']},'include':[{'model':db[_0xb96b('0x2d')],'as':_0xb96b('0x54')}]})['then'](handleEntityNotFound(_0x274660,null))[_0xb96b('0x10')](saveUpdates(_0x67009b[_0xb96b('0x4c')],null))['then'](respondWithResult(_0x274660,null))[_0xb96b('0x4a')](handleError(_0x274660,null));};exports[_0xb96b('0x23')]=function(_0x22b349,_0x13d1f6){return db[_0xb96b('0x42')][_0xb96b('0x49')]({'where':{'id':_0x22b349['params']['id']}})[_0xb96b('0x10')](handleEntityNotFound(_0x13d1f6,null))[_0xb96b('0x10')](removeEntity(_0x13d1f6,null))['catch'](handleError(_0x13d1f6,null));};exports[_0xb96b('0x55')]=function(_0xdb7f8f,_0x22d69d){return db[_0xb96b('0x42')][_0xb96b('0x55')]()['then'](respondWithResult(_0x22d69d,null))[_0xb96b('0x4a')](handleError(_0x22d69d,null));};exports[_0xb96b('0x56')]=function(_0x19be08,_0x577d22){if(_0x19be08[_0xb96b('0x4c')]['id']){delete _0x19be08['body']['id'];}return db[_0xb96b('0x42')]['find']({'where':{'id':_0x19be08[_0xb96b('0x53')]['id']}})[_0xb96b('0x10')](handleEntityNotFound(_0x577d22,null))[_0xb96b('0x10')](function(_0x506b6f){if(_0x506b6f){_0x19be08['body'][_0xb96b('0x57')]=_0x506b6f['id'];return db[_0xb96b('0x58')][_0xb96b('0x4b')](_0x19be08[_0xb96b('0x4c')]);}})[_0xb96b('0x10')](respondWithResult(_0x577d22,null))[_0xb96b('0x4a')](handleError(_0x577d22,null));};exports['getDispositions']=function(_0x3040e7,_0x575196){var _0x45d3ea={'raw':![],'where':{}};var _0x2d03bb={};var _0x3aab19={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xb96b('0x59')]({'where':{'id':_0x3040e7['params']['id']}})[_0xb96b('0x10')](handleEntityNotFound(_0x575196,null))[_0xb96b('0x10')](function(_0x5f5ced){if(_0x5f5ced){_0x2d03bb['model']=_[_0xb96b('0x31')](db['Disposition']['rawAttributes']);_0x2d03bb['query']=_[_0xb96b('0x31')](_0x3040e7[_0xb96b('0x30')]);_0x2d03bb[_0xb96b('0x3c')]=_[_0xb96b('0x32')](_0x2d03bb['model'],_0x2d03bb[_0xb96b('0x30')]);_0x45d3ea[_0xb96b('0x33')]=_[_0xb96b('0x32')](_0x2d03bb['model'],qs[_0xb96b('0x35')](_0x3040e7[_0xb96b('0x30')][_0xb96b('0x35')]));_0x45d3ea['attributes']=_0x45d3ea[_0xb96b('0x33')][_0xb96b('0x36')]?_0x45d3ea['attributes']:_0x2d03bb[_0xb96b('0x34')];if(!_0x3040e7[_0xb96b('0x30')][_0xb96b('0x37')](_0xb96b('0x38'))){_0x45d3ea[_0xb96b('0x1d')]=qs[_0xb96b('0x1d')](_0x3040e7[_0xb96b('0x30')][_0xb96b('0x1d')]);_0x45d3ea[_0xb96b('0x1f')]=qs[_0xb96b('0x1f')](_0x3040e7[_0xb96b('0x30')]['offset']);}_0x45d3ea['order']=qs[_0xb96b('0x3a')](_0x3040e7[_0xb96b('0x30')][_0xb96b('0x3a')]);_0x45d3ea[_0xb96b('0x3b')]=qs[_0xb96b('0x3c')](_[_0xb96b('0x3d')](_0x3040e7[_0xb96b('0x30')],_0x2d03bb['filters']));_0x45d3ea['where'][_0xb96b('0x57')]=_0x5f5ced['id'];if(_0x3040e7[_0xb96b('0x30')][_0xb96b('0x3e')]){_0x45d3ea['where']=_['merge'](_0x45d3ea[_0xb96b('0x3b')],{'$or':_['map'](_0x45d3ea[_0xb96b('0x33')],function(_0x1ba74a){var _0x2b9604={};_0x2b9604[_0x1ba74a]={'$like':'%'+_0x3040e7[_0xb96b('0x30')]['filter']+'%'};return _0x2b9604;})});}_0x45d3ea=_['merge']({},_0x45d3ea,_0x3040e7[_0xb96b('0x41')]);return db[_0xb96b('0x58')][_0xb96b('0x1e')]({'where':_0x45d3ea['where']})[_0xb96b('0x10')](function(_0xc0919){_0x3aab19[_0xb96b('0x1e')]=_0xc0919;if(_0x3040e7[_0xb96b('0x30')]['includeAll']){_0x45d3ea['include']=[{'all':!![]}];}return db[_0xb96b('0x58')][_0xb96b('0x45')](_0x45d3ea);})[_0xb96b('0x10')](function(_0x327ef5){_0x3aab19['rows']=_0x327ef5;return _0x3aab19;});}})[_0xb96b('0x10')](respondWithFilteredResult(_0x575196,_0x45d3ea))[_0xb96b('0x4a')](handleError(_0x575196,null));};exports[_0xb96b('0x5a')]=function(_0x26cc32,_0x5b53ed){return db['ChatWebsite'][_0xb96b('0x49')]({'where':{'id':_0x26cc32['params']['id']}})['then'](handleEntityNotFound(_0x5b53ed,null))[_0xb96b('0x10')](function(_0x26a0d4){if(_0x26a0d4){return _0x26a0d4[_0xb96b('0x5a')](_0x26cc32[_0xb96b('0x30')]['ids']);}})[_0xb96b('0x10')](respondWithStatusCode(_0x5b53ed,null))[_0xb96b('0x4a')](handleError(_0x5b53ed,null));};exports['addAnswer']=function(_0x31be2c,_0x9e27fd){if(_0x31be2c[_0xb96b('0x4c')]['id']){delete _0x31be2c[_0xb96b('0x4c')]['id'];}return db[_0xb96b('0x42')][_0xb96b('0x49')]({'where':{'id':_0x31be2c['params']['id']}})[_0xb96b('0x10')](handleEntityNotFound(_0x9e27fd,null))[_0xb96b('0x10')](function(_0x1e6721){if(_0x1e6721){_0x31be2c[_0xb96b('0x4c')][_0xb96b('0x57')]=_0x1e6721['id'];return db['CannedAnswer'][_0xb96b('0x4b')](_0x31be2c[_0xb96b('0x4c')]);}})['then'](respondWithResult(_0x9e27fd,null))[_0xb96b('0x4a')](handleError(_0x9e27fd,null));};exports['getAnswers']=function(_0x303f8c,_0x1760ac){var _0x87ba0f={'raw':![],'where':{}};var _0x4bd78e={};var _0x2b367e={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xb96b('0x59')]({'where':{'id':_0x303f8c['params']['id']}})['then'](handleEntityNotFound(_0x1760ac,null))['then'](function(_0x41b3e7){if(_0x41b3e7){_0x4bd78e[_0xb96b('0x34')]=_[_0xb96b('0x31')](db[_0xb96b('0x5b')][_0xb96b('0x48')]);_0x4bd78e[_0xb96b('0x30')]=_[_0xb96b('0x31')](_0x303f8c[_0xb96b('0x30')]);_0x4bd78e[_0xb96b('0x3c')]=_[_0xb96b('0x32')](_0x4bd78e[_0xb96b('0x34')],_0x4bd78e['query']);_0x87ba0f['attributes']=_[_0xb96b('0x32')](_0x4bd78e[_0xb96b('0x34')],qs[_0xb96b('0x35')](_0x303f8c['query'][_0xb96b('0x35')]));_0x87ba0f['attributes']=_0x87ba0f[_0xb96b('0x33')]['length']?_0x87ba0f[_0xb96b('0x33')]:_0x4bd78e[_0xb96b('0x34')];if(!_0x303f8c['query']['hasOwnProperty'](_0xb96b('0x38'))){_0x87ba0f[_0xb96b('0x1d')]=qs[_0xb96b('0x1d')](_0x303f8c[_0xb96b('0x30')][_0xb96b('0x1d')]);_0x87ba0f['offset']=qs[_0xb96b('0x1f')](_0x303f8c[_0xb96b('0x30')][_0xb96b('0x1f')]);}_0x87ba0f[_0xb96b('0x39')]=qs[_0xb96b('0x3a')](_0x303f8c[_0xb96b('0x30')][_0xb96b('0x3a')]);_0x87ba0f[_0xb96b('0x3b')]=qs[_0xb96b('0x3c')](_[_0xb96b('0x3d')](_0x303f8c[_0xb96b('0x30')],_0x4bd78e[_0xb96b('0x3c')]));_0x87ba0f['where']['ChatWebsiteId']=_0x41b3e7['id'];if(_0x303f8c[_0xb96b('0x30')][_0xb96b('0x3e')]){_0x87ba0f[_0xb96b('0x3b')]=_[_0xb96b('0x3f')](_0x87ba0f[_0xb96b('0x3b')],{'$or':_['map'](_0x87ba0f['attributes'],function(_0x240a0c){var _0x13d19a={};_0x13d19a[_0x240a0c]={'$like':'%'+_0x303f8c['query'][_0xb96b('0x3e')]+'%'};return _0x13d19a;})});}_0x87ba0f=_[_0xb96b('0x3f')]({},_0x87ba0f,_0x303f8c[_0xb96b('0x41')]);return db[_0xb96b('0x5b')][_0xb96b('0x1e')]({'where':_0x87ba0f[_0xb96b('0x3b')]})[_0xb96b('0x10')](function(_0x385c54){_0x2b367e[_0xb96b('0x1e')]=_0x385c54;if(_0x303f8c[_0xb96b('0x30')][_0xb96b('0x43')]){_0x87ba0f['include']=[{'all':!![]}];}return db[_0xb96b('0x5b')][_0xb96b('0x45')](_0x87ba0f);})['then'](function(_0xd87e06){_0x2b367e[_0xb96b('0x46')]=_0xd87e06;return _0x2b367e;});}})[_0xb96b('0x10')](respondWithFilteredResult(_0x1760ac,_0x87ba0f))[_0xb96b('0x4a')](handleError(_0x1760ac,null));};exports[_0xb96b('0x5c')]=function(_0x5d5c9d,_0xfad5a){return db[_0xb96b('0x42')]['find']({'where':{'id':_0x5d5c9d['params']['id']}})[_0xb96b('0x10')](handleEntityNotFound(_0xfad5a,null))[_0xb96b('0x10')](function(_0x326dbc){if(_0x326dbc){return _0x326dbc[_0xb96b('0x5c')](_0x5d5c9d['query']['ids']);}})['then'](respondWithStatusCode(_0xfad5a,null))[_0xb96b('0x4a')](handleError(_0xfad5a,null));};exports['addLogo']=function(_0x5bdf18,_0x2c24db){_0x5bdf18[_0xb96b('0x4c')]['sitepic']=_0x5bdf18[_0xb96b('0x5d')][_0xb96b('0x5e')];return db[_0xb96b('0x42')]['find']({'where':{'id':_0x5bdf18[_0xb96b('0x53')]['id']}})[_0xb96b('0x10')](handleEntityNotFound(_0x2c24db,null))['then'](saveUpdates(_0x5bdf18['body'],null))[_0xb96b('0x10')](respondWithResult(_0x2c24db,null))['catch'](handleError(_0x2c24db,null));};exports[_0xb96b('0x5f')]=function(_0x5ee943,_0x564f63){_0x5ee943[_0xb96b('0x4c')][_0xb96b('0x60')]=_0x5ee943[_0xb96b('0x5d')][_0xb96b('0x5e')];return db['ChatWebsite'][_0xb96b('0x49')]({'where':{'id':_0x5ee943[_0xb96b('0x53')]['id']}})[_0xb96b('0x10')](handleEntityNotFound(_0x564f63,null))[_0xb96b('0x10')](saveUpdates(_0x5ee943[_0xb96b('0x4c')],null))[_0xb96b('0x10')](respondWithResult(_0x564f63,null))[_0xb96b('0x4a')](handleError(_0x564f63,null));};exports[_0xb96b('0x61')]=function(_0x164d83,_0x3f864f){_0x164d83[_0xb96b('0x4c')][_0xb96b('0x62')]=_0x164d83[_0xb96b('0x5d')]['filename'];return db[_0xb96b('0x42')][_0xb96b('0x49')]({'where':{'id':_0x164d83[_0xb96b('0x53')]['id']}})[_0xb96b('0x10')](handleEntityNotFound(_0x3f864f,null))[_0xb96b('0x10')](saveUpdates(_0x164d83[_0xb96b('0x4c')],null))['then'](respondWithResult(_0x3f864f,null))[_0xb96b('0x4a')](handleError(_0x3f864f,null));};exports[_0xb96b('0x63')]=function(_0x40a25e,_0x1ddcdb){_0x40a25e['body'][_0xb96b('0x64')]=_0x40a25e[_0xb96b('0x5d')][_0xb96b('0x5e')];return db[_0xb96b('0x42')][_0xb96b('0x49')]({'where':{'id':_0x40a25e['params']['id']}})[_0xb96b('0x10')](handleEntityNotFound(_0x1ddcdb,null))[_0xb96b('0x10')](saveUpdates(_0x40a25e[_0xb96b('0x4c')],null))[_0xb96b('0x10')](respondWithResult(_0x1ddcdb,null))[_0xb96b('0x4a')](handleError(_0x1ddcdb,null));};exports['getLogo']=function(_0x541658,_0x41eb2a){var _0x27418e=path[_0xb96b('0x65')](config[_0xb96b('0x66')],_0xb96b('0x67'));var _0x1b3fe3={'where':{'id':_0x541658[_0xb96b('0x53')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x58bba6=![];return require(_0xb96b('0x68'))[_0xb96b('0x69')]()[_0xb96b('0x10')](function(_0x4b954e){if(_0x4b954e){_0x58bba6=_0x4b954e[_0xb96b('0x6a')];}})[_0xb96b('0x10')](function(){return db[_0xb96b('0x42')][_0xb96b('0x49')](_0x1b3fe3);})['then'](handleEntityNotFound(_0x41eb2a,null))[_0xb96b('0x10')](function(_0x59a69a){if(_0x59a69a){if(!_['isNil'](_0x59a69a[_0xb96b('0x6b')])){if(fs['existsSync'](path[_0xb96b('0x65')](config['root'],_0xb96b('0x6c'),_0x59a69a['sitepic']))&&_0x58bba6){_0x27418e=path[_0xb96b('0x65')](config[_0xb96b('0x66')],_0xb96b('0x6c'),_0x59a69a[_0xb96b('0x6b')]);}}return _0x41eb2a[_0xb96b('0x6d')](_0x27418e);}})[_0xb96b('0x4a')](handleError(_0x41eb2a,null));};exports[_0xb96b('0x6e')]=function(_0x4acb7f,_0x503e89){var _0x440bc1=path[_0xb96b('0x65')](config[_0xb96b('0x66')],_0xb96b('0x6f'));var _0x2e233d={'where':{'id':_0x4acb7f[_0xb96b('0x53')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xb96b('0x42')][_0xb96b('0x49')](_0x2e233d)[_0xb96b('0x10')](handleEntityNotFound(_0x503e89,null))[_0xb96b('0x10')](function(_0x2b7e01){if(_0x2b7e01){if(!_[_0xb96b('0x70')](_0x2b7e01[_0xb96b('0x60')])){if(fs[_0xb96b('0x71')](path['join'](config[_0xb96b('0x66')],_0xb96b('0x72'),_0x2b7e01[_0xb96b('0x60')]))){_0x440bc1=path[_0xb96b('0x65')](config[_0xb96b('0x66')],_0xb96b('0x72'),_0x2b7e01[_0xb96b('0x60')]);}}return _0x503e89[_0xb96b('0x6d')](_0x440bc1);}})['catch'](handleError(_0x503e89,null));};exports[_0xb96b('0x73')]=function(_0xc4b445,_0x4d016c){var _0x5df5f4=path[_0xb96b('0x65')](config[_0xb96b('0x66')],_0xb96b('0x74'));var _0x5f04ab={'where':{'id':_0xc4b445[_0xb96b('0x53')]['id']},'attributes':['id',_0xb96b('0x62'),_0xb96b('0x75')],'raw':!![]};return db[_0xb96b('0x42')][_0xb96b('0x49')](_0x5f04ab)[_0xb96b('0x10')](handleEntityNotFound(_0x4d016c,null))['then'](function(_0x4e7852){if(_0x4e7852){if(!_[_0xb96b('0x70')](_0x4e7852[_0xb96b('0x62')])){if(fs[_0xb96b('0x71')](path[_0xb96b('0x65')](config[_0xb96b('0x66')],_0xb96b('0x72'),_0x4e7852[_0xb96b('0x62')]))&&_0x4e7852[_0xb96b('0x75')]){_0x5df5f4=path['join'](config[_0xb96b('0x66')],_0xb96b('0x72'),_0x4e7852[_0xb96b('0x62')]);}}return _0x4d016c['download'](_0x5df5f4);}})[_0xb96b('0x4a')](handleError(_0x4d016c,null));};exports[_0xb96b('0x76')]=function(_0x4d93e2,_0x4d7e36){var _0x374a91=path[_0xb96b('0x65')](config[_0xb96b('0x66')],_0xb96b('0x77'));var _0x401edb={'where':{'id':_0x4d93e2['params']['id']},'attributes':['id',_0xb96b('0x64')],'raw':!![]};return db[_0xb96b('0x42')][_0xb96b('0x49')](_0x401edb)[_0xb96b('0x10')](handleEntityNotFound(_0x4d7e36,null))['then'](function(_0x5615ec){if(_0x5615ec){if(!_[_0xb96b('0x70')](_0x5615ec[_0xb96b('0x64')])){if(fs[_0xb96b('0x71')](path[_0xb96b('0x65')](config[_0xb96b('0x66')],_0xb96b('0x72'),_0x5615ec['systemAvatar']))){_0x374a91=path[_0xb96b('0x65')](config[_0xb96b('0x66')],_0xb96b('0x72'),_0x5615ec['systemAvatar']);}}return _0x4d7e36[_0xb96b('0x6d')](_0x374a91);}})['catch'](handleError(_0x4d7e36,null));};exports[_0xb96b('0x78')]=function(_0x18d2c0,_0x120fe9){var _0x238a4f=require('user-agent-parser');var _0x59224b=new _0x238a4f();var _0x1ee479=_0x59224b[_0xb96b('0x79')](_0x18d2c0['headers'][_0xb96b('0x7a')])[_0xb96b('0x7b')]();var _0x3c0875={'body':_0x18d2c0[_0xb96b('0x4c')],'channel':_0xb96b('0x7c')};var _0x3e7cf7=[];var _0x1193c1=[];var _0x1b921a={};var _0x3ed93b=![];return db[_0xb96b('0x7d')][_0xb96b('0x55')]()[_0xb96b('0x10')](function(_0xc3bf40){if(!_0xc3bf40){throw new db[(_0xb96b('0x7e'))][(_0xb96b('0x7f'))]('no\x20available\x20attributes');}_0x3e7cf7=_[_0xb96b('0x80')](_[_0xb96b('0x31')](_0xc3bf40),['createdAt',_0xb96b('0x81')]);_0x1193c1=_[_0xb96b('0x80')](_[_0xb96b('0x31')](_0xc3bf40),['createdAt',_0xb96b('0x81'),_0xb96b('0x82'),_0xb96b('0x83')]);if(_0x18d2c0[_0xb96b('0x4c')]['id']){delete _0x18d2c0[_0xb96b('0x4c')]['id'];}if(_[_0xb96b('0x70')](_0x18d2c0[_0xb96b('0x4c')]['from'])){throw new db[(_0xb96b('0x7e'))][(_0xb96b('0x7f'))](_0xb96b('0x84'));}if(_[_0xb96b('0x70')](_0x18d2c0[_0xb96b('0x4c')][_0xb96b('0x4c')])||_0x18d2c0[_0xb96b('0x4c')][_0xb96b('0x4c')]===''){throw new db[(_0xb96b('0x7e'))][(_0xb96b('0x7f'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x18d2c0[_0xb96b('0x4c')][_0xb96b('0x85')])){throw new db[(_0xb96b('0x7e'))]['ValidationError'](_0xb96b('0x86')+_0x1193c1);}if(!_[_0xb96b('0x87')](_0x1193c1,_0x18d2c0[_0xb96b('0x4c')][_0xb96b('0x85')])){throw new db[(_0xb96b('0x7e'))][(_0xb96b('0x7f'))](_0xb96b('0x88')+_0x1193c1);}_0x1b921a[_0x18d2c0['body']['mapKey']]=_0x18d2c0['body'][_0xb96b('0x89')];})[_0xb96b('0x10')](function(){return db[_0xb96b('0x42')][_0xb96b('0x49')]({'where':{'id':_0x18d2c0[_0xb96b('0x53')]['id']},'include':[{'model':db[_0xb96b('0x8a')],'as':'List','include':[{'model':db[_0xb96b('0x7d')],'as':_0xb96b('0x8b'),'where':_0x1b921a,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['ChatApplication'],'as':_0xb96b('0x8c')}]});})['then'](handleEntityNotFound(_0x120fe9,null))[_0xb96b('0x10')](function(_0x5063ca){if(_0x5063ca&&_0x5063ca[_0xb96b('0x8d')]){_0x3c0875[_0xb96b('0x8e')]=_0x5063ca;_0x3c0875[_0xb96b('0x8f')]=_0x5063ca[_0xb96b('0x8c')];_0x3c0875[_0xb96b('0x90')]=_0x5063ca['List'];_0x3c0875[_0xb96b('0x8f')]=_[_0xb96b('0x91')](_0x3c0875[_0xb96b('0x8f')],['priority'],[_0xb96b('0x92')]);if(_0x3c0875['account'][_0xb96b('0x8c')]){delete _0x3c0875['account'][_0xb96b('0x8c')];}if(_0x3c0875[_0xb96b('0x8e')][_0xb96b('0x8d')]&&_0x3c0875['account']['List'][_0xb96b('0x8b')]['length']){return _0x3c0875[_0xb96b('0x8e')][_0xb96b('0x8d')]['Contacts'][0x0];}var _0x3d27a0=_[_0xb96b('0x8')](_0x18d2c0[_0xb96b('0x4c')],{'firstName':_0x18d2c0[_0xb96b('0x4c')][_0xb96b('0x89')],'ListId':_0x5063ca[_0xb96b('0x83')]});_0x3d27a0[_0x18d2c0[_0xb96b('0x4c')][_0xb96b('0x85')]]=_0x18d2c0['body'][_0xb96b('0x89')];return db[_0xb96b('0x7d')][_0xb96b('0x4b')](_0x3d27a0,{'fields':_0x3e7cf7,'raw':!![]});}})[_0xb96b('0x10')](handleEntityNotFound(_0x120fe9,null))[_0xb96b('0x10')](function(_0xc459b4){_0x3c0875[_0xb96b('0x93')]=_0xc459b4;var _0x41db7e=_0x18d2c0[_0xb96b('0x4c')][_0xb96b('0x94')];if(_0x18d2c0[_0xb96b('0x95')][_0xb96b('0x96')]){_0x41db7e=_0x18d2c0['headers'][_0xb96b('0x96')];}else if(_0x18d2c0['headers'][_0xb96b('0x97')]){_0x41db7e=_[_0xb96b('0x98')](_0x18d2c0['headers'][_0xb96b('0x97')][_0xb96b('0x99')](','));}if(_0xc459b4){var _0x1c95ee={'ContactId':_0xc459b4['id'],'ChatWebsiteId':_0x18d2c0[_0xb96b('0x53')]['id'],'from':(_0xc459b4[_0xb96b('0x9a')]||'')+'\x20'+(_0xc459b4['lastName']||''),'customerIp':_0x41db7e,'customerPort':_0x18d2c0[_0xb96b('0x95')][_0xb96b('0x9b')]?_0x18d2c0[_0xb96b('0x95')][_0xb96b('0x9b')]:null,'referer':_0x18d2c0[_0xb96b('0x4c')][_0xb96b('0x9c')],'browserName':_0x1ee479['browser'][_0xb96b('0x2a')]&&_0x1ee479[_0xb96b('0x9d')][_0xb96b('0x9e')]?util[_0xb96b('0x9f')](_0xb96b('0xa0'),_0x1ee479[_0xb96b('0x9d')][_0xb96b('0x2a')],_0x1ee479[_0xb96b('0x9d')]['version']):_0xb96b('0xa1'),'browserVersion':_0x1ee479[_0xb96b('0x9d')][_0xb96b('0x9e')]||'unknown','osName':util[_0xb96b('0x9f')](_0xb96b('0xa0'),_0x1ee479['os'][_0xb96b('0x2a')],_0x1ee479['os'][_0xb96b('0x9e')]),'osVersion':_0x1ee479['os']['version'],'deviceModel':_0x1ee479[_0xb96b('0xa2')][_0xb96b('0x34')]&&_0x1ee479[_0xb96b('0xa2')][_0xb96b('0xa3')]?util['format'](_0xb96b('0xa4'),_0x1ee479['device'][_0xb96b('0x34')],_0x1ee479[_0xb96b('0xa2')][_0xb96b('0xa3')],_0x1ee479[_0xb96b('0xa2')][_0xb96b('0xa5')]):null,'deviceVendor':_0x1ee479['device'][_0xb96b('0xa3')],'deviceType':_0x1ee479['device']['type'],'formData':JSON['stringify'](_0x18d2c0[_0xb96b('0x4c')])};var _0x5cc90e={'ChatWebsiteId':_0x18d2c0[_0xb96b('0x53')]['id'],'closed':![]};if(_0x18d2c0['body']['threadId']){_0x5cc90e[_0xb96b('0xa6')]=_0x18d2c0[_0xb96b('0x4c')]['threadId'];return db[_0xb96b('0xa7')]['find']({'where':_0x5cc90e})['then'](function(_0x513c94){if(_0x513c94){return[_0x513c94,![]];}_0x1c95ee[_0xb96b('0xa6')]=_0x18d2c0[_0xb96b('0x4c')]['threadId'];_0x1c95ee[_0xb96b('0xa8')]=_0x18d2c0['body'][_0xb96b('0xa8')];return db[_0xb96b('0xa7')][_0xb96b('0x4b')](_0x1c95ee)[_0xb96b('0x10')](function(_0x52bcde){return[_0x52bcde,!![]];});});}_0x5cc90e[_0xb96b('0xa9')]=_0xc459b4['id'];if(_0x18d2c0['body']['interaction']&&_0x18d2c0[_0xb96b('0x4c')][_0xb96b('0xaa')]['id']){_0x5cc90e['id']=_0x18d2c0[_0xb96b('0x4c')]['interaction']['id'];return db['ChatInteraction'][_0xb96b('0x49')]({'where':_0x5cc90e})[_0xb96b('0x10')](function(_0x1a5cd4){if(_0x1a5cd4){return[_0x1a5cd4,![]];}return db[_0xb96b('0xa7')][_0xb96b('0x4b')](_0x1c95ee)[_0xb96b('0x10')](function(_0x350da3){return[_0x350da3,!![]];});});}return db[_0xb96b('0xa7')]['create'](_0x1c95ee)['then'](function(_0x4121e9){return[_0x4121e9,!![]];});}})['spread'](function(_0x37d7b0,_0x174887){if(_0x37d7b0){_0x3ed93b=_0x174887;if(!_0x174887){var _0x26560c={'from':(_0x3c0875['contact'][_0xb96b('0x9a')]||'')+'\x20'+(_0x3c0875[_0xb96b('0x93')][_0xb96b('0xab')]||'')};if(_0x18d2c0[_0xb96b('0x4c')][_0xb96b('0xa6')]&&_0x18d2c0[_0xb96b('0x4c')]['messageId']&&_0x18d2c0[_0xb96b('0x4c')][_0xb96b('0xa6')]!=_0x18d2c0['body']['messageId']){_0x26560c[_0xb96b('0xa6')]=_0x18d2c0[_0xb96b('0x4c')][_0xb96b('0xac')];}return _0x37d7b0[_0xb96b('0x22')](_0x26560c);}else{return _0x37d7b0;}}})[_0xb96b('0x10')](function(_0x4259c0){_0x3c0875[_0xb96b('0xaa')]=_0x4259c0[_0xb96b('0x24')]({'plain':!![]});_0x3c0875[_0xb96b('0xaa')]['created']=_0x3ed93b;if(_0x3c0875[_0xb96b('0xaa')][_0xb96b('0xad')]){if(_0x3c0875[_0xb96b('0x8e')][_0xb96b('0xae')]){_0x3c0875[_0xb96b('0x8f')][_0xb96b('0xaf')]({'id':0x0,'priority':_0x3c0875[_0xb96b('0x8f')][_0xb96b('0x36')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xb96b('0xb0')});}}return db['ChatMessage'][_0xb96b('0x4b')]({'body':_0x18d2c0[_0xb96b('0x4c')][_0xb96b('0x4c')],'ChatWebsiteId':_0x18d2c0[_0xb96b('0x53')]['id'],'ChatInteractionId':_0x4259c0['id'],'direction':'in','ContactId':_0x3c0875[_0xb96b('0x93')]['id'],'AttachmentId':_0x18d2c0[_0xb96b('0x4c')]['AttachmentId']});})[_0xb96b('0x10')](function(_0x1dee7e){_0x3c0875[_0xb96b('0x17')]=_0x1dee7e;if(_0x3c0875['interaction'][_0xb96b('0xb1')]){return db[_0xb96b('0xb2')][_0xb96b('0x49')]({'attributes':['id',_0xb96b('0x2a')],'where':{'id':_0x3c0875[_0xb96b('0xaa')][_0xb96b('0xb1')]}})[_0xb96b('0x10')](function(_0x33424e){if(_0x33424e){_0x3c0875[_0xb96b('0x8f')][_0xb96b('0xb3')]({'id':0x0,'priority':0x0,'app':_0xb96b('0xb4'),'appdata':_0x33424e[_0xb96b('0x2a')]+','+(_0x3c0875[_0xb96b('0x8e')][_0xb96b('0xb5')]||0xa),'interval':_0xb96b('0xb0')});_0x3c0875[_0xb96b('0xb6')]=!![];}return respondWithRpcPromise(_0xb96b('0xb7'),_0xb96b('0xb8'),_0x3c0875);});}return respondWithRpcPromise(_0xb96b('0xb7'),_0xb96b('0xb8'),_0x3c0875);})[_0xb96b('0x10')](function(_0x35a07c){respondWithRpcPromise(_0xb96b('0xb9'),_0xb96b('0xb9'),{'event':_0xb96b('0x78'),'message':_0x35a07c},client9002);return _0x35a07c;})['then'](respondWithResult(_0x120fe9,null))[_0xb96b('0x4a')](handleError(_0x120fe9,null));};exports['offline']=function(_0x5d8468,_0x1a02db){var _0x12e9dc,_0x1a7607,_0x5a1495;var _0x34f9d0=[];var _0x2f6af5={};var _0xd8eb74=_0x5d8468[_0xb96b('0xba')]||[];var _0x2c2807=[];var _0x159e0e;return db[_0xb96b('0x7d')][_0xb96b('0x55')]()[_0xb96b('0x10')](function(_0x2867e4){if(!_0x2867e4){throw new db[(_0xb96b('0x7e'))][(_0xb96b('0x7f'))](_0xb96b('0xbb'));}_0x34f9d0=_['difference'](_[_0xb96b('0x31')](_0x2867e4),[_0xb96b('0xbc'),_0xb96b('0x81'),'CompanyId','ListId']);if(_0x5d8468[_0xb96b('0x4c')]['id']){delete _0x5d8468[_0xb96b('0x4c')]['id'];}if(_['isNil'](_0x5d8468[_0xb96b('0x4c')]['from'])){throw _0x1a02db['status'](0x1f4)['send'](new db['Sequelize'][(_0xb96b('0x7f'))](_0xb96b('0x84')));}if(_[_0xb96b('0x70')](_0x5d8468[_0xb96b('0x4c')][_0xb96b('0x4c')])||_0x5d8468[_0xb96b('0x4c')][_0xb96b('0x4c')]===''){throw _0x1a02db[_0xb96b('0x1a')](0x1f4)[_0xb96b('0x2b')](new db[(_0xb96b('0x7e'))][(_0xb96b('0x7f'))](_0xb96b('0xbd')));}if(_[_0xb96b('0x70')](_0x5d8468[_0xb96b('0x4c')][_0xb96b('0xbe')])){throw _0x1a02db[_0xb96b('0x1a')](0x1f4)[_0xb96b('0x2b')](new db[(_0xb96b('0x7e'))][(_0xb96b('0x7f'))](_0xb96b('0xbf')+_0x34f9d0));}if(!_['includes'](_0x34f9d0,_0x5d8468['body'][_0xb96b('0xbe')])){throw _0x1a02db[_0xb96b('0x1a')](0x1f4)[_0xb96b('0x2b')](new db['Sequelize'][(_0xb96b('0x7f'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x34f9d0));}_0x2f6af5[_0x5d8468[_0xb96b('0x4c')][_0xb96b('0xbe')]]=_0x5d8468[_0xb96b('0x4c')][_0xb96b('0x89')];})[_0xb96b('0x10')](function(){return db[_0xb96b('0x42')]['find']({'where':{'id':_0x5d8468[_0xb96b('0x53')]['id']},'include':[{'model':db[_0xb96b('0x8a')],'as':_0xb96b('0x8d')},{'model':db[_0xb96b('0xc0')],'as':'MailAccount'}]});})[_0xb96b('0x10')](handleEntityNotFound(_0x1a02db,null))['then'](function(_0x3c8f9c){if(_0x3c8f9c&&_0x3c8f9c[_0xb96b('0x8d')]){_0x1a7607=_0x3c8f9c;var _0x3056ba=_[_0xb96b('0x8')](_0x5d8468['body'],{'firstName':_0x5d8468[_0xb96b('0x4c')][_0xb96b('0x89')],'phone':_0x5d8468['body'][_0xb96b('0x89')],'ListId':_0x3c8f9c[_0xb96b('0x83')]});_0x3056ba[_0x5d8468[_0xb96b('0x4c')][_0xb96b('0xbe')]]=_0x5d8468[_0xb96b('0x4c')][_0xb96b('0x89')];return db[_0xb96b('0x7d')][_0xb96b('0xc1')]({'where':_0x2f6af5,'defaults':_0x3056ba});}})[_0xb96b('0xc2')](function(_0xfe8430){if(_0xfe8430){_0x5a1495=_0xfe8430;var _0x5b16e6=fs[_0xb96b('0xc3')](path[_0xb96b('0x65')](config[_0xb96b('0x66')],_0xb96b('0xc4')),_0xb96b('0xc5'));var _0x382876=ejs[_0xb96b('0xc6')](_0x5b16e6,{'body':_[_0xb96b('0xc7')](_0x5d8468[_0xb96b('0x4c')][_0xb96b('0x4c')]),'bodyTitle':_0x1a7607[_0xb96b('0xc8')]});return db[_0xb96b('0xc9')][_0xb96b('0x4b')]({'body':_0x382876,'ContactId':_0xfe8430['id'],'ChatWebsiteId':_0x1a7607['id']});}})[_0xb96b('0x10')](function(_0xf26e8d){_0x159e0e=_0xf26e8d;if(_0xd8eb74[_0xb96b('0x36')]){var _0x49ab3e=_0xd8eb74[_0xb96b('0x2e')](function(_0x18c898){return{'name':_0x18c898[_0xb96b('0xca')],'basename':_0x18c898[_0xb96b('0x5e')],'type':_0x18c898[_0xb96b('0xcb')],'ChatOfflineMessageId':_0xf26e8d['id']};});_0x2c2807=_0x49ab3e[_0xb96b('0x2e')](_0x30ff1b=>{var _0x3cf188={'filename':_0x30ff1b['name'],'path':path[_0xb96b('0x65')](config[_0xb96b('0x66')],_0xb96b('0xcc'),_0xb96b('0xba'),_0xb96b('0xcd'),'offline-chat',_0x30ff1b[_0xb96b('0xce')])};return _0x3cf188;});if(!_0x1a7607[_0xb96b('0xcf')]){return db['sequelize'][_0xb96b('0xd0')](function(_0x3117ae){return db['Attachment']['bulkCreate'](_0x49ab3e,{'transaction':_0x3117ae});});}}})[_0xb96b('0x10')](function(){if(_0x159e0e){_0x12e9dc=_0x159e0e;return db['MailAccount'][_0xb96b('0x59')]({'where':{'active':!![]},'include':[{'model':db[_0xb96b('0xd1')],'as':'Smtp','raw':!![]}]});}})[_0xb96b('0x10')](function(_0x29ab06){if(_0x29ab06&&_0x29ab06['Smtp']&&_0x1a7607[_0xb96b('0xd2')]&&_0x1a7607['forwardOfflineAddress']){var _0x3a2c96={'tls':{'rejectUnauthorized':![]}};if(_0x29ab06[_0xb96b('0xd3')][_0xb96b('0xd4')]){_0x3a2c96[_0xb96b('0xd4')]=_0x29ab06[_0xb96b('0xd3')][_0xb96b('0xd4')];}else{_0x3a2c96[_0xb96b('0xd5')]=_0x29ab06['Smtp']['host'];_0x3a2c96[_0xb96b('0xd6')]=_0x29ab06[_0xb96b('0xd3')][_0xb96b('0xd6')];_0x3a2c96[_0xb96b('0xd7')]=_0x29ab06[_0xb96b('0xd3')]['secure'];}if(_0x29ab06[_0xb96b('0xd3')][_0xb96b('0xd8')]){_0x3a2c96[_0xb96b('0xd9')]={'user':_0x29ab06[_0xb96b('0xd3')][_0xb96b('0x4d')],'pass':_0x29ab06[_0xb96b('0xd3')][_0xb96b('0xda')]};}return respondWithRpcPromise('SendMail',_0xb96b('0xdb'),{'account':_0x3a2c96,'message':{'from':util[_0xb96b('0x9f')](_0xb96b('0xdc'),_0x29ab06['name'],_0x29ab06[_0xb96b('0xdd')]||_0x29ab06[_0xb96b('0xd3')]['user']),'to':_0x1a7607[_0xb96b('0xde')],'subject':_0x1a7607['offlineMessageSubject'],'html':_0x12e9dc[_0xb96b('0x4c')],'attachments':_0x2c2807}},client9003)[_0xb96b('0x10')](function(){return _0x12e9dc;})['catch'](function(_0x5c6a2b){console[_0xb96b('0x16')](_0x5c6a2b);});}})[_0xb96b('0x10')](function(){if(_0x1a7607&&_0x1a7607[_0xb96b('0xcf')]&&_0x1a7607[_0xb96b('0xdf')]){var _0x14869d=[];if(_0xd8eb74['length']){_0x14869d=_0xd8eb74[_0xb96b('0x2e')](function(_0x33b196){return{'name':_0x33b196[_0xb96b('0xca')],'basename':_0x33b196['filename'],'type':_0x33b196[_0xb96b('0xcb')],'ChatOfflineMessageId':_0x159e0e['id']};});}var _0x2af217;if(!_[_0xb96b('0x70')](_0x1a7607[_0xb96b('0xe0')])){var _0xfc91c1=_[_0xb96b('0x2e')](_0x5d8468['body'],function(_0x110282){return _0x110282;});var _0x4ea206=_[_0xb96b('0xe1')](_0xfc91c1)[0x0];var _0x3d63a3=_['mapValues'](_0x4ea206,function(_0x57dfef){return _0x57dfef;});_0x2af217=_0x3d63a3[0x1][_0x1a7607[_0xb96b('0xe0')]];}var _0x5afbad={'from':_0x5a1495[_0xb96b('0xdd')],'firstName':_0x5a1495[_0xb96b('0x9a')],'lastName':_0x5a1495[_0xb96b('0xab')],'mapKey':_0xb96b('0xdd'),'message':{'from':_0x5a1495[_0xb96b('0xdd')],'to':_0x1a7607[_0xb96b('0xc0')][_0xb96b('0xdd')],'cc':'','subject':_[_0xb96b('0x70')](_0x2af217)?_0x1a7607[_0xb96b('0xe2')]:_0x2af217,'messageId':'','sentAt':new Date(),'attach':_0x14869d[_0xb96b('0x36')],'attachments':_0x14869d,'originChannel':'Chat','ChatWebsiteId':_0x1a7607['id'],'ChatOfflineMessageId':_0x12e9dc['id'],'originTo':_0x1a7607['MailAccount'][_0xb96b('0xdd')]},'body':_0x12e9dc['body']};var _0x256376={'account':{'id':_0x1a7607['MailAccountId']},'body':_0x5afbad,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0xb96b('0xe3'),'notifyMail',_0x256376,client9001)['then'](function(){return _0x12e9dc;})['catch'](function(_0x1cfee1){console['error'](_0x1cfee1);});}return;})[_0xb96b('0x10')](function(){if(_0x12e9dc){return _0x12e9dc;}})[_0xb96b('0x10')](respondWithResult(_0x1a02db,null))[_0xb96b('0x4a')](function(_0x45c29b){console[_0xb96b('0x16')]('catch',_0x45c29b);for(var _0x4b18f5 of _0xd8eb74){var _0x2e77e4=path[_0xb96b('0x65')](config['root'],_0xb96b('0xcc'),_0xb96b('0xba'),_0xb96b('0xcd'),_0xb96b('0xe4'),_0x4b18f5[_0xb96b('0x5e')]);fs_extra['remove'](_0x2e77e4)['catch'](function(_0xf3023b){console[_0xb96b('0x16')](_0xb96b('0xe5'),_0x2e77e4,_0xf3023b);});}});};exports[_0xb96b('0xe6')]=function(_0x8b68a,_0x14ba47){return db['ChatInteraction'][_0xb96b('0x49')]({'where':{'id':_0x8b68a[_0xb96b('0x53')]['id']}})[_0xb96b('0x10')](handleEntityNotFound(_0x14ba47,null))['then'](function(_0x4d69e6){if(_0x4d69e6){return _0x4d69e6['addInteraction'](_0x8b68a[_0xb96b('0x4c')][_0xb96b('0xe7')],_['omit'](_0x8b68a[_0xb96b('0x4c')],['ids','id'])||{});}})[_0xb96b('0x10')](respondWithResult(_0x14ba47,null))[_0xb96b('0x4a')](handleError(_0x14ba47,null));};exports[_0xb96b('0xe8')]=function(_0xe837fd,_0x4a6724){var _0x386e9c={'raw':![],'where':{}};var _0x32a947={};var _0xb5cce8={'count':0x0,'rows':[]};return db[_0xb96b('0x42')][_0xb96b('0x59')]({'where':{'id':_0xe837fd[_0xb96b('0x53')]['id']}})[_0xb96b('0x10')](handleEntityNotFound(_0x4a6724,null))[_0xb96b('0x10')](function(_0xdaf84f){if(_0xdaf84f){_0x32a947[_0xb96b('0x34')]=_['keys'](db[_0xb96b('0xa7')][_0xb96b('0x48')]);_0x32a947['query']=_[_0xb96b('0x31')](_0xe837fd[_0xb96b('0x30')]);_0x32a947[_0xb96b('0x3c')]=_[_0xb96b('0x32')](_0x32a947[_0xb96b('0x34')],_0x32a947[_0xb96b('0x30')]);_0x386e9c[_0xb96b('0x33')]=_[_0xb96b('0x32')](_0x32a947[_0xb96b('0x34')],qs[_0xb96b('0x35')](_0xe837fd['query'][_0xb96b('0x35')]));_0x386e9c[_0xb96b('0x33')]=_0x386e9c[_0xb96b('0x33')][_0xb96b('0x36')]?_0x386e9c[_0xb96b('0x33')]:_0x32a947['model'];if(!_0xe837fd['query']['hasOwnProperty'](_0xb96b('0x38'))){_0x386e9c[_0xb96b('0x1d')]=qs[_0xb96b('0x1d')](_0xe837fd[_0xb96b('0x30')][_0xb96b('0x1d')]);_0x386e9c[_0xb96b('0x1f')]=qs[_0xb96b('0x1f')](_0xe837fd[_0xb96b('0x30')]['offset']);}_0x386e9c[_0xb96b('0x39')]=qs[_0xb96b('0x3a')](_0xe837fd['query'][_0xb96b('0x3a')]);_0x386e9c[_0xb96b('0x3b')]=qs[_0xb96b('0x3c')](_[_0xb96b('0x3d')](_0xe837fd[_0xb96b('0x30')],_0x32a947['filters']));_0x386e9c[_0xb96b('0x3b')][_0xb96b('0x57')]=_0xdaf84f['id'];if(_0xe837fd[_0xb96b('0x30')][_0xb96b('0x3e')]){_0x386e9c['where']=_[_0xb96b('0x3f')](_0x386e9c[_0xb96b('0x3b')],{'$or':_['map'](_0x386e9c[_0xb96b('0x33')],function(_0x201a1f){var _0x4ff09e={};_0x4ff09e[_0x201a1f]={'$like':'%'+_0xe837fd[_0xb96b('0x30')]['filter']+'%'};return _0x4ff09e;})});}_0x386e9c=_['merge']({},_0x386e9c,_0xe837fd[_0xb96b('0x41')]);return db[_0xb96b('0xa7')][_0xb96b('0x1e')]({'where':_0x386e9c['where']})[_0xb96b('0x10')](function(_0x493fee){_0xb5cce8[_0xb96b('0x1e')]=_0x493fee;if(_0xe837fd[_0xb96b('0x30')]['includeAll']){_0x386e9c[_0xb96b('0x44')]=[{'model':db[_0xb96b('0x7d')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xb96b('0xe9'),'attributes':[_0xb96b('0x2a'),_0xb96b('0xea'),_0xb96b('0xeb')],'required':![]},{'model':db[_0xb96b('0xec')],'as':_0xb96b('0xed'),'attributes':['id',_0xb96b('0x2a'),_0xb96b('0xee')],'where':_0xe837fd[_0xb96b('0x30')][_0xb96b('0xef')]?{'id':_0xe837fd['query'][_0xb96b('0xef')]}:undefined,'required':_0xe837fd[_0xb96b('0x30')][_0xb96b('0xef')]?!![]:![]}];}return db[_0xb96b('0xa7')][_0xb96b('0x45')](_0x386e9c);})[_0xb96b('0x10')](function(_0x5d722f){_0xb5cce8[_0xb96b('0x46')]=_0x5d722f;return _0xb5cce8;});}})[_0xb96b('0x10')](respondWithFilteredResult(_0x4a6724,_0x386e9c))[_0xb96b('0x4a')](handleError(_0x4a6724,null));};function iftimePromise(_0x55b800,_0x5d14d3){return respondWithRpcPromise(_0xb96b('0xf0'),_0xb96b('0xf1'),{'command':_0x5d14d3[_0xb96b('0xf2')]?util['format'](_0xb96b('0xf3'),_0x55b800[_0xb96b('0xf4')],_0x5d14d3['timezone']):util[_0xb96b('0x9f')](_0xb96b('0xf5'),_0x55b800[_0xb96b('0xf4')])},client9002)['then'](function(_0x114962){var _0x2aa99c=_0x114962&&_0x114962[_0xb96b('0xf6')]('true')>=0x0?!![]:![];logger[_0xb96b('0x18')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x5d14d3['id'],_0x55b800['id'],_0x55b800[_0xb96b('0xf4')],_0x2aa99c?_0xb96b('0xf7'):_0xb96b('0xf8'),_0x5d14d3[_0xb96b('0xf2')]?_0x5d14d3[_0xb96b('0xf2')]:_0xb96b('0xf9'));return _0x2aa99c;})[_0xb96b('0x4a')](function(_0xea627f){logger[_0xb96b('0x16')](_0xb96b('0xfa'),_0x5d14d3['id'],_0x55b800['id'],_0x55b800[_0xb96b('0xf4')],util[_0xb96b('0xfb')](_0xea627f,{'showHidden':![],'depth':null}),_0x5d14d3[_0xb96b('0xf2')]?_0x5d14d3['timezone']:_0xb96b('0xf9'));return![];});}exports[_0xb96b('0xf1')]=function(_0x3c69d2,_0x48f30b){var _0x35d769=0x0;var _0x5bdbec=0x0;var _0x1fc2e2=![];var _0x1ae3f0;var _0x549cc7;return db[_0xb96b('0x42')][_0xb96b('0x49')]({'where':{'id':_0x3c69d2[_0xb96b('0x53')]['id']},'include':[{'model':db[_0xb96b('0xfc')],'as':_0xb96b('0xfc'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0xb96b('0xf4')],'raw':!![]}]}]})[_0xb96b('0x10')](handleEntityNotFound(_0x48f30b,null))[_0xb96b('0x10')](function(_0x4b79cd){if(_0x4b79cd){_0x1ae3f0=_0x4b79cd;return _0x4b79cd[_0xb96b('0xfd')]({'raw':!![]});}})[_0xb96b('0x10')](function(_0x30afe3){if(_0x1ae3f0){if(_0x30afe3){_0x549cc7=_0x30afe3;}}return require(_0xb96b('0x68'))[_0xb96b('0x69')]();})[_0xb96b('0x10')](function(_0x45bc8a){if(_0x45bc8a){_0x5bdbec=_0x45bc8a['virtual'];_0x1fc2e2=_0x45bc8a[_0xb96b('0x6a')];}})[_0xb96b('0x10')](function(){return db[_0xb96b('0xa7')][_0xb96b('0x1e')]({'where':{'closed':![]}});})['then'](function(_0x11292a){_0x35d769=_0x11292a;if(_0x5bdbec&&_0x11292a>_0x5bdbec){return db['License'][_0xb96b('0x59')]({'where':{'id':0x1}})[_0xb96b('0x10')](function(_0x323cb6){if(_0x323cb6){_0x323cb6[_0xb96b('0xfe')](_0xb96b('0xff'));}});}})['then'](function(){if(_0x1ae3f0[_0xb96b('0xfc')]&&_0x1ae3f0[_0xb96b('0xfc')][_0xb96b('0x100')]){var _0x252494=[];for(var _0x47792e=0x0;_0x47792e<_0x1ae3f0[_0xb96b('0xfc')][_0xb96b('0x100')][_0xb96b('0x36')];_0x47792e++){var _0x201c72=_0x1ae3f0['Interval'][_0xb96b('0x100')][_0x47792e][_0xb96b('0x24')]({'plain':!![]});_0x252494[_0xb96b('0xaf')](iftimePromise(_0x201c72,_0x1ae3f0));}return BPromise[_0xb96b('0x101')](_0x252494)['then'](function(_0x537cbb){return _['some'](_0x537cbb);});}else{return!![];}})['then'](function(_0x5cd39e){var _0x29c877=fs['readFileSync'](path['join'](config[_0xb96b('0x66')],_0xb96b('0x102')),_0xb96b('0xc5'));var _0x568771={'remote':_0x1ae3f0[_0xb96b('0x103')],'query':querystring[_0xb96b('0x15')](_['merge'](_0x1ae3f0[_0xb96b('0x24')]({'plain':!![]}),{'customerIp':_0x3c69d2[_0xb96b('0x95')][_0xb96b('0x97')]||_0x3c69d2[_0xb96b('0x95')][_0xb96b('0x104')]||_0x3c69d2[_0xb96b('0x105')][_0xb96b('0x106')]||_0x3c69d2['ip'],'referer':_0x3c69d2[_0xb96b('0x95')]['referer'],'openedInteractions':_0x35d769,'maxInteractions':_0x5bdbec,'virtual':_0x1fc2e2[_0xb96b('0x107')],'online':_0x5cd39e,'custom':_0x1fc2e2}))[_0xb96b('0x108')](/'/g,'\x5c\x27')};_0x48f30b[_0xb96b('0x2b')](ejs[_0xb96b('0xc6')](Mustache['render'](_0x29c877,_0x568771),{'proactiveActions':_0x549cc7,'alignment':_0x1ae3f0['alignment'],'verticalAlignment':_0x1ae3f0[_0xb96b('0x109')],'div_color':_0x1ae3f0[_0xb96b('0xee')],'text_color':_0x1ae3f0[_0xb96b('0x10a')],'button_color':_0x1ae3f0['color_button'],'background_color':_0x1ae3f0['backgroundColor']}));})['catch'](handleError(_0x48f30b,null));};exports[_0xb96b('0x10b')]=function(_0x23a72b,_0x12b93c){var _0x314778=_0x23a72b['params']['id'];var _0x50ddbd=_0x23a72b[_0xb96b('0x4c')];var _0x46df6e=0xc8;var _0x1e07f7=null;return db[_0xb96b('0x10c')][_0xb96b('0xd0')]({'isolationLevel':db[_0xb96b('0x10c')]['Transaction'][_0xb96b('0x10d')][_0xb96b('0x10e')]},function(_0x37de11){return db[_0xb96b('0x42')][_0xb96b('0x59')]({'where':{'id':_0x314778},'transaction':_0x37de11})[_0xb96b('0x10')](function(_0xecc770){if(_0xecc770){return db[_0xb96b('0x10f')][_0xb96b('0x23')]({'where':{'ChatWebsiteId':_0x314778},'transaction':_0x37de11})[_0xb96b('0x10')](function(){var _0x4192c8=_['map'](_0x50ddbd,function(_0x36b302){_0x36b302[_0xb96b('0x57')]=_0x314778;return _0x36b302;});return db[_0xb96b('0x10f')][_0xb96b('0x110')](_0x4192c8,{'transaction':_0x37de11});});}else{_0x46df6e=0x194;_0x1e07f7=[];}});})[_0xb96b('0x10')](function(){if(_0x46df6e!==0x194){return db[_0xb96b('0x10f')][_0xb96b('0x111')]({'where':{'ChatWebsiteId':_0x314778},'order':_0xb96b('0x112')})['then'](function(_0x4c8666){_0x1e07f7=_0x4c8666;});}})['catch'](function(_0x74deaf){_0x46df6e=0x1f4;logger[_0xb96b('0x16')](_0x74deaf[_0xb96b('0x29')]);if(_0x74deaf[_0xb96b('0x2a')]){delete _0x74deaf[_0xb96b('0x2a')];}_0x1e07f7=_0x74deaf;})['finally'](function(){if(_0x1e07f7===null){_0x12b93c['sendStatus'](_0x46df6e);}else{if(_0x46df6e===0x1f4){_0x12b93c[_0xb96b('0x1a')](_0x46df6e)[_0xb96b('0x2b')](_0x1e07f7);}else{_0x12b93c[_0xb96b('0x1a')](_0x46df6e)[_0xb96b('0x1b')](_0x1e07f7);}}});};exports['getApplications']=function(_0x480cfa,_0x878ecb){var _0xfc62b3={};var _0x18401b={};var _0x259fee;var _0x5c2861;return db['ChatWebsite'][_0xb96b('0x59')]({'where':{'id':_0x480cfa[_0xb96b('0x53')]['id']}})[_0xb96b('0x10')](handleEntityNotFound(_0x878ecb,null))[_0xb96b('0x10')](function(_0x2069e2){if(_0x2069e2){_0x259fee=_0x2069e2;_0x18401b[_0xb96b('0x34')]=_[_0xb96b('0x31')](db[_0xb96b('0x10f')][_0xb96b('0x48')]);_0x18401b[_0xb96b('0x30')]=_[_0xb96b('0x31')](_0x480cfa['query']);_0x18401b[_0xb96b('0x3c')]=_[_0xb96b('0x32')](_0x18401b[_0xb96b('0x34')],_0x18401b[_0xb96b('0x30')]);_0xfc62b3[_0xb96b('0x33')]=_['intersection'](_0x18401b['model'],qs[_0xb96b('0x35')](_0x480cfa[_0xb96b('0x30')][_0xb96b('0x35')]));_0xfc62b3[_0xb96b('0x33')]=_0xfc62b3[_0xb96b('0x33')]['length']?_0xfc62b3[_0xb96b('0x33')]:_0x18401b[_0xb96b('0x34')];_0xfc62b3[_0xb96b('0x39')]=qs[_0xb96b('0x3a')](_0x480cfa[_0xb96b('0x30')]['sort']);_0xfc62b3[_0xb96b('0x3b')]=qs[_0xb96b('0x3c')](_['pick'](_0x480cfa['query'],_0x18401b['filters']));if(_0x480cfa[_0xb96b('0x30')]['filter']){_0xfc62b3[_0xb96b('0x3b')]=_['merge'](_0xfc62b3[_0xb96b('0x3b')],{'$or':_['map'](_0xfc62b3[_0xb96b('0x33')],function(_0x156747){var _0xf7665d={};_0xf7665d[_0x156747]={'$like':'%'+_0x480cfa['query'][_0xb96b('0x3e')]+'%'};return _0xf7665d;})});}_0xfc62b3=_[_0xb96b('0x3f')]({},_0xfc62b3,_0x480cfa[_0xb96b('0x41')]);return _0x259fee[_0xb96b('0x113')](_0xfc62b3);}})[_0xb96b('0x10')](function(_0x4cad3c){if(_0x4cad3c){_0x5c2861=_0x4cad3c[_0xb96b('0x36')];if(!_0x480cfa[_0xb96b('0x30')]['hasOwnProperty'](_0xb96b('0x38'))){_0xfc62b3[_0xb96b('0x1d')]=qs[_0xb96b('0x1d')](_0x480cfa[_0xb96b('0x30')][_0xb96b('0x1d')]);_0xfc62b3['offset']=qs[_0xb96b('0x1f')](_0x480cfa[_0xb96b('0x30')][_0xb96b('0x1f')]);}return _0x259fee[_0xb96b('0x113')](_0xfc62b3);}})[_0xb96b('0x10')](function(_0x569981){if(_0x569981){return _0x569981?{'count':_0x5c2861,'rows':_0x569981}:null;}})['then'](respondWithResult(_0x878ecb,null))[_0xb96b('0x4a')](handleError(_0x878ecb,null));};exports[_0xb96b('0x114')]=function(_0x2cc62d,_0x417c7b){return db[_0xb96b('0x115')][_0xb96b('0x49')]({'where':{'id':_0x2cc62d[_0xb96b('0x53')]['id']}})[_0xb96b('0x10')](handleEntityNotFound(_0x417c7b,null))[_0xb96b('0x10')](function(_0x2982d1){if(_0x2982d1){return _0x2982d1['addProactiveActions'](_0x2cc62d['body'][_0xb96b('0xe7')],_[_0xb96b('0x116')](_0x2cc62d['body'],['ids','id'])||{});}})[_0xb96b('0x10')](respondWithResult(_0x417c7b,null))[_0xb96b('0x4a')](handleError(_0x417c7b,null));};exports[_0xb96b('0xfd')]=function(_0x4416bc,_0xe9ea28){var _0x444348={};var _0x223c89={};var _0x399dc9;var _0x2dffd9;return db['ChatWebsite'][_0xb96b('0x59')]({'where':{'id':_0x4416bc[_0xb96b('0x53')]['id']}})[_0xb96b('0x10')](handleEntityNotFound(_0xe9ea28,null))[_0xb96b('0x10')](function(_0xf3d056){if(_0xf3d056){_0x399dc9=_0xf3d056;_0x223c89[_0xb96b('0x34')]=_['keys'](db[_0xb96b('0x117')][_0xb96b('0x48')]);_0x223c89[_0xb96b('0x30')]=_[_0xb96b('0x31')](_0x4416bc['query']);_0x223c89['filters']=_[_0xb96b('0x32')](_0x223c89[_0xb96b('0x34')],_0x223c89[_0xb96b('0x30')]);_0x444348[_0xb96b('0x33')]=_[_0xb96b('0x32')](_0x223c89[_0xb96b('0x34')],qs[_0xb96b('0x35')](_0x4416bc['query'][_0xb96b('0x35')]));_0x444348[_0xb96b('0x33')]=_0x444348[_0xb96b('0x33')][_0xb96b('0x36')]?_0x444348[_0xb96b('0x33')]:_0x223c89[_0xb96b('0x34')];_0x444348[_0xb96b('0x39')]=qs['sort'](_0x4416bc[_0xb96b('0x30')][_0xb96b('0x3a')]);_0x444348[_0xb96b('0x3b')]=qs['filters'](_[_0xb96b('0x3d')](_0x4416bc[_0xb96b('0x30')],_0x223c89['filters']));if(_0x4416bc[_0xb96b('0x30')]['filter']){_0x444348[_0xb96b('0x3b')]=_['merge'](_0x444348[_0xb96b('0x3b')],{'$or':_[_0xb96b('0x2e')](_0x444348[_0xb96b('0x33')],function(_0x143cba){var _0x2d85c3={};_0x2d85c3[_0x143cba]={'$like':'%'+_0x4416bc['query'][_0xb96b('0x3e')]+'%'};return _0x2d85c3;})});}_0x444348=_[_0xb96b('0x3f')]({},_0x444348,_0x4416bc[_0xb96b('0x41')]);return _0x399dc9[_0xb96b('0xfd')](_0x444348);}})[_0xb96b('0x10')](function(_0x9e4fc0){if(_0x9e4fc0){_0x2dffd9=_0x9e4fc0[_0xb96b('0x36')];if(!_0x4416bc[_0xb96b('0x30')][_0xb96b('0x37')]('nolimit')){_0x444348[_0xb96b('0x1d')]=qs['limit'](_0x4416bc[_0xb96b('0x30')][_0xb96b('0x1d')]);_0x444348['offset']=qs[_0xb96b('0x1f')](_0x4416bc[_0xb96b('0x30')][_0xb96b('0x1f')]);}return _0x399dc9[_0xb96b('0xfd')](_0x444348);}})['then'](function(_0x27db4c){if(_0x27db4c){return _0x27db4c?{'count':_0x2dffd9,'rows':_0x27db4c}:null;}})[_0xb96b('0x10')](respondWithResult(_0xe9ea28,null))[_0xb96b('0x4a')](handleError(_0xe9ea28,null));};exports[_0xb96b('0x118')]=function(_0xe25152,_0x176660){var _0x125250=_0xe25152[_0xb96b('0x30')]['online']===_0xb96b('0x119')?_0xb96b('0x11a'):_0xb96b('0x11b');return db[_0xb96b('0x42')][_0xb96b('0x49')]({'attributes':['id',_0x125250],'where':{'id':_0xe25152['params']['id']}})[_0xb96b('0x10')](handleEntityNotFound(_0x176660,null))['then'](function(_0x5274d9){if(_0x5274d9){var _0x3ce53e=_0x5274d9[_0x125250];var _0x2073d2=_0x3ce53e&&_0x3ce53e[_0xb96b('0x11c')]?_0x3ce53e[_0xb96b('0x11c')]:[];_0x176660[_0xb96b('0x2b')]({'fromKey':_[_0xb96b('0x70')](_0x3ce53e[_0xb96b('0x11d')])?undefined:_0x3ce53e[_0xb96b('0x11d')],'count':_0x2073d2[_0xb96b('0x36')],'rows':_0x2073d2});}})[_0xb96b('0x4a')](handleError(_0x176660,null));};exports[_0xb96b('0x11e')]=function(_0x42a990,_0x39c85f){var _0x332f85={'raw':![],'where':{}};var _0x204aa9={};var _0x596500={'count':0x0,'rows':[]};return db[_0xb96b('0x42')]['findOne']({'where':{'id':_0x42a990[_0xb96b('0x53')]['id']}})['then'](handleEntityNotFound(_0x39c85f,null))[_0xb96b('0x10')](function(_0x3cd994){if(_0x3cd994){_0x204aa9[_0xb96b('0x34')]=_['keys'](db[_0xb96b('0xc9')]['rawAttributes']);_0x204aa9[_0xb96b('0x30')]=_['keys'](_0x42a990[_0xb96b('0x30')]);_0x204aa9[_0xb96b('0x3c')]=_[_0xb96b('0x32')](_0x204aa9[_0xb96b('0x34')],_0x204aa9[_0xb96b('0x30')]);_0x332f85[_0xb96b('0x33')]=_[_0xb96b('0x32')](_0x204aa9[_0xb96b('0x34')],qs['fields'](_0x42a990[_0xb96b('0x30')][_0xb96b('0x35')]));_0x332f85[_0xb96b('0x33')]=_0x332f85['attributes'][_0xb96b('0x36')]?_0x332f85[_0xb96b('0x33')]:_0x204aa9['model'];if(!_0x42a990[_0xb96b('0x30')]['hasOwnProperty'](_0xb96b('0x38'))){_0x332f85[_0xb96b('0x1d')]=qs[_0xb96b('0x1d')](_0x42a990[_0xb96b('0x30')][_0xb96b('0x1d')]);_0x332f85[_0xb96b('0x1f')]=qs[_0xb96b('0x1f')](_0x42a990[_0xb96b('0x30')][_0xb96b('0x1f')]);}_0x332f85[_0xb96b('0x39')]=qs['sort'](_0x42a990['query'][_0xb96b('0x3a')]);_0x332f85[_0xb96b('0x3b')]=qs[_0xb96b('0x3c')](_['pick'](_0x42a990[_0xb96b('0x30')],_0x204aa9[_0xb96b('0x3c')]));_0x332f85[_0xb96b('0x3b')][_0xb96b('0x57')]=_0x3cd994['id'];if(_0x42a990['query'][_0xb96b('0x3e')]){_0x332f85['where']=_['merge'](_0x332f85['where'],{'$or':_[_0xb96b('0x2e')](_0x332f85[_0xb96b('0x33')],function(_0x3441b7){var _0x503b61={};_0x503b61[_0x3441b7]={'$like':'%'+_0x42a990[_0xb96b('0x30')][_0xb96b('0x3e')]+'%'};return _0x503b61;})});}_0x332f85=_[_0xb96b('0x3f')]({},_0x332f85,_0x42a990[_0xb96b('0x41')]);return db[_0xb96b('0xc9')][_0xb96b('0x1e')]({'where':_0x332f85[_0xb96b('0x3b')]})[_0xb96b('0x10')](function(_0x4cf49a){_0x596500[_0xb96b('0x1e')]=_0x4cf49a;if(_0x42a990[_0xb96b('0x30')][_0xb96b('0x43')]){_0x332f85[_0xb96b('0x44')]=[{'all':!![]}];}else{_0x332f85['include']=[{'model':db[_0xb96b('0x7d')],'as':_0xb96b('0x11f'),'required':![]},{'model':db['Attachment'],'as':_0xb96b('0x120'),'required':![]}];}return db[_0xb96b('0xc9')][_0xb96b('0x45')](_0x332f85);})[_0xb96b('0x10')](function(_0x1740ab){_0x596500[_0xb96b('0x46')]=_0x1740ab;return _0x596500;});}})[_0xb96b('0x10')](respondWithFilteredResult(_0x39c85f,_0x332f85))[_0xb96b('0x4a')](handleError(_0x39c85f,null));};exports['addAgents']=function(_0x277804,_0xfb761c){return db['ChatWebsite'][_0xb96b('0x49')]({'where':{'id':_0x277804[_0xb96b('0x53')]['id']}})[_0xb96b('0x10')](handleEntityNotFound(_0xfb761c,null))[_0xb96b('0x10')](function(_0x209dba){if(_0x209dba){return _0x209dba[_0xb96b('0x121')](_0x277804['body']['ids'],_[_0xb96b('0x116')](_0x277804[_0xb96b('0x4c')],[_0xb96b('0xe7'),'id'])||{})['spread'](function(_0x1c9545){for(var _0x4b2c50=0x0;_0x4b2c50<_0x277804[_0xb96b('0x4c')][_0xb96b('0xe7')][_0xb96b('0x36')];_0x4b2c50+=0x1){socket[_0xb96b('0x122')](_0xb96b('0x123'),{'UserId':Number(_0x277804['body']['ids'][_0x4b2c50]),'ChatWebsiteId':Number(_0x277804[_0xb96b('0x53')]['id'])});}return _0x1c9545;});}})[_0xb96b('0x10')](respondWithResult(_0xfb761c,null))[_0xb96b('0x4a')](handleError(_0xfb761c,null));};exports[_0xb96b('0x124')]=function(_0x172e75,_0x92782b){return db[_0xb96b('0x42')][_0xb96b('0x49')]({'where':{'id':_0x172e75[_0xb96b('0x53')]['id']}})['then'](handleEntityNotFound(_0x92782b,null))[_0xb96b('0x10')](function(_0x404b75){if(_0x404b75){return _0x404b75[_0xb96b('0x124')](_0x172e75[_0xb96b('0x30')][_0xb96b('0xe7')])[_0xb96b('0x10')](function(){if(_['isArray'](_0x172e75[_0xb96b('0x30')][_0xb96b('0xe7')])){for(var _0x1c19ea=0x0;_0x1c19ea<_0x172e75[_0xb96b('0x30')][_0xb96b('0xe7')]['length'];_0x1c19ea+=0x1){socket[_0xb96b('0x122')]('userChatWebsite:remove',{'UserId':Number(_0x172e75['query'][_0xb96b('0xe7')][_0x1c19ea]),'ChatWebsiteId':Number(_0x172e75[_0xb96b('0x53')]['id'])});}}else{socket[_0xb96b('0x122')](_0xb96b('0x125'),{'UserId':Number(_0x172e75['query'][_0xb96b('0xe7')]),'ChatWebsiteId':Number(_0x172e75['params']['id'])});}});}})[_0xb96b('0x10')](respondWithStatusCode(_0x92782b,null))[_0xb96b('0x4a')](handleError(_0x92782b,null));};exports[_0xb96b('0x126')]=function(_0x364639,_0x8e5dda){var _0xd4dace={};var _0x42a7c9={};var _0x321718;var _0x27e8ac;return db['ChatWebsite'][_0xb96b('0x59')]({'where':{'id':_0x364639['params']['id']}})[_0xb96b('0x10')](handleEntityNotFound(_0x8e5dda,null))[_0xb96b('0x10')](function(_0x5cdad9){if(_0x5cdad9){_0x321718=_0x5cdad9;_0x42a7c9[_0xb96b('0x34')]=_[_0xb96b('0x31')](db[_0xb96b('0xb2')][_0xb96b('0x48')]);_0x42a7c9[_0xb96b('0x30')]=_[_0xb96b('0x31')](_0x364639['query']);_0x42a7c9[_0xb96b('0x3c')]=_['intersection'](_0x42a7c9[_0xb96b('0x34')],_0x42a7c9[_0xb96b('0x30')]);_0xd4dace[_0xb96b('0x33')]=_[_0xb96b('0x32')](_0x42a7c9[_0xb96b('0x34')],qs[_0xb96b('0x35')](_0x364639[_0xb96b('0x30')]['fields']));_0xd4dace[_0xb96b('0x33')]=_0xd4dace[_0xb96b('0x33')]['length']?_0xd4dace[_0xb96b('0x33')]:_0x42a7c9[_0xb96b('0x34')];_0xd4dace['order']=qs[_0xb96b('0x3a')](_0x364639['query'][_0xb96b('0x3a')]);_0xd4dace[_0xb96b('0x3b')]=qs['filters'](_[_0xb96b('0x3d')](_0x364639[_0xb96b('0x30')],_0x42a7c9[_0xb96b('0x3c')]));if(_0x364639[_0xb96b('0x30')][_0xb96b('0x3e')]){_0xd4dace['where']=_[_0xb96b('0x3f')](_0xd4dace[_0xb96b('0x3b')],{'$or':_['map'](_0xd4dace[_0xb96b('0x33')],function(_0x10cefd){var _0x24e677={};_0x24e677[_0x10cefd]={'$like':'%'+_0x364639[_0xb96b('0x30')]['filter']+'%'};return _0x24e677;})});}_0xd4dace=_[_0xb96b('0x3f')]({},_0xd4dace,_0x364639['options']);return _0x321718['getAgents'](_0xd4dace);}})[_0xb96b('0x10')](function(_0x970daf){if(_0x970daf){_0x27e8ac=_0x970daf[_0xb96b('0x36')];if(!_0x364639[_0xb96b('0x30')][_0xb96b('0x37')]('nolimit')){_0xd4dace[_0xb96b('0x1d')]=qs['limit'](_0x364639[_0xb96b('0x30')]['limit']);_0xd4dace[_0xb96b('0x1f')]=qs[_0xb96b('0x1f')](_0x364639['query'][_0xb96b('0x1f')]);}return _0x321718['getAgents'](_0xd4dace);}})[_0xb96b('0x10')](function(_0x59e9c5){if(_0x59e9c5){return _0x59e9c5?{'count':_0x27e8ac,'rows':_0x59e9c5}:null;}})[_0xb96b('0x10')](respondWithResult(_0x8e5dda,null))[_0xb96b('0x4a')](handleError(_0x8e5dda,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 96d9ede..495ea5e 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 _0x17ba=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0xf82d0f,_0x59cc40){var _0x5937c5=function(_0x25449d){while(--_0x25449d){_0xf82d0f['push'](_0xf82d0f['shift']());}};_0x5937c5(++_0x59cc40);}(_0x17ba,0xab));var _0xa17b=function(_0x3a076e,_0x2216ed){_0x3a076e=_0x3a076e-0x0;var _0x433648=_0x17ba[_0x3a076e];return _0x433648;};'use strict';var EventEmitter=require(_0xa17b('0x0'));var ChatWebsite=require(_0xa17b('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xa17b('0x2')](0x0);var events={'afterCreate':_0xa17b('0x3'),'afterUpdate':_0xa17b('0x4'),'afterDestroy':_0xa17b('0x5')};function emitEvent(_0x106b5b){return function(_0x38c13c,_0x11d7b7,_0x2f64d0){ChatWebsiteEvents[_0xa17b('0x6')](_0x106b5b+':'+_0x38c13c['id'],_0x38c13c);ChatWebsiteEvents[_0xa17b('0x6')](_0x106b5b,_0x38c13c);_0x2f64d0(null);};}for(var e in events){if(events[_0xa17b('0x7')](e)){var event=events[e];ChatWebsite[_0xa17b('0x8')](e,emitEvent(event));}}module[_0xa17b('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0x31af=['ChatWebsite','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x128bef,_0xc7a0af){var _0x1ba862=function(_0x4858e8){while(--_0x4858e8){_0x128bef['push'](_0x128bef['shift']());}};_0x1ba862(++_0xc7a0af);}(_0x31af,0xde));var _0xf31a=function(_0x456a1,_0x30c640){_0x456a1=_0x456a1-0x0;var _0x10df95=_0x31af[_0x456a1];return _0x10df95;};'use strict';var EventEmitter=require(_0xf31a('0x0'));var ChatWebsite=require(_0xf31a('0x1'))['db'][_0xf31a('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xf31a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3b7976){return function(_0x1853d7,_0x820362,_0x245db8){ChatWebsiteEvents['emit'](_0x3b7976+':'+_0x1853d7['id'],_0x1853d7);ChatWebsiteEvents[_0xf31a('0x4')](_0x3b7976,_0x1853d7);_0x245db8(null);};}for(var e in events){if(events[_0xf31a('0x5')](e)){var event=events[e];ChatWebsite[_0xf31a('0x6')](e,emitEvent(event));}}module[_0xf31a('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 369f268..2f4ee70 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 _0xc066=['bluebird','request-promise','path','../../config/environment','./chatWebsite.attributes','exports','lodash','util','../../config/logger'];(function(_0x60286b,_0x3247c1){var _0x5dff69=function(_0x4ecfcf){while(--_0x4ecfcf){_0x60286b['push'](_0x60286b['shift']());}};_0x5dff69(++_0x3247c1);}(_0xc066,0x7b));var _0x6c06=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc066[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x6c06('0x0'));var util=require(_0x6c06('0x1'));var logger=require(_0x6c06('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6c06('0x3'));var rp=require(_0x6c06('0x4'));var fs=require('fs');var path=require(_0x6c06('0x5'));var rimraf=require('rimraf');var config=require(_0x6c06('0x6'));var attributes=require(_0x6c06('0x7'));module[_0x6c06('0x8')]=function(_0x5d4c97,_0x4854d1){return _0x5d4c97['define']('ChatWebsite',attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2604=['request-promise','path','./chatWebsite.attributes','define','chat_websites','lodash','api','moment','bluebird'];(function(_0x11e30d,_0x5584aa){var _0x2d4e29=function(_0x2486ce){while(--_0x2486ce){_0x11e30d['push'](_0x11e30d['shift']());}};_0x2d4e29(++_0x5584aa);}(_0x2604,0x19a));var _0x4260=function(_0x112a38,_0x147691){_0x112a38=_0x112a38-0x0;var _0x23b207=_0x2604[_0x112a38];return _0x23b207;};'use strict';var _=require(_0x4260('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4260('0x1'));var moment=require(_0x4260('0x2'));var BPromise=require(_0x4260('0x3'));var rp=require(_0x4260('0x4'));var fs=require('fs');var path=require(_0x4260('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4260('0x6'));module['exports']=function(_0x56e70c,_0x266bab){return _0x56e70c[_0x4260('0x7')]('ChatWebsite',attributes,{'tableName':_0x4260('0x8'),'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 2451e25..84fbab3 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 _0x3ab8=['debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s'];(function(_0x15ebad,_0x1ac8e0){var _0x56818d=function(_0x2f468d){while(--_0x2f468d){_0x15ebad['push'](_0x15ebad['shift']());}};_0x56818d(++_0x1ac8e0);}(_0x3ab8,0x8f));var _0x83ab=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x3ab8[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x83ab('0x0'));var util=require(_0x83ab('0x1'));var moment=require('moment');var BPromise=require(_0x83ab('0x2'));var rs=require(_0x83ab('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x83ab('0x4'));var logger=require('../../config/logger')(_0x83ab('0x5'));var config=require(_0x83ab('0x6'));var jayson=require(_0x83ab('0x7'));var client=jayson[_0x83ab('0x8')]['http']({'port':0x232a});config[_0x83ab('0x9')]=_[_0x83ab('0xa')](config['redis'],{'host':_0x83ab('0xb'),'port':0x18eb});var socket=require(_0x83ab('0xc'))(new Redis(config[_0x83ab('0x9')]));require(_0x83ab('0xd'))[_0x83ab('0xe')](socket);function respondWithRpcPromise(_0x11b879,_0x43b1ef,_0x25e2b5){return new BPromise(function(_0x21e0fe,_0x5e9c53){return client[_0x83ab('0xf')](_0x11b879,_0x25e2b5)[_0x83ab('0x10')](function(_0x42b0b4){logger[_0x83ab('0x11')](_0x83ab('0x12'),_0x43b1ef,'request\x20sent');logger[_0x83ab('0x13')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x43b1ef,_0x83ab('0x14'),JSON[_0x83ab('0x15')](_0x42b0b4));if(_0x42b0b4['error']){if(_0x42b0b4[_0x83ab('0x16')][_0x83ab('0x17')]===0x1f4){logger[_0x83ab('0x16')](_0x83ab('0x12'),_0x43b1ef,_0x42b0b4[_0x83ab('0x16')][_0x83ab('0x18')]);return _0x5e9c53(_0x42b0b4[_0x83ab('0x16')][_0x83ab('0x18')]);}logger[_0x83ab('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x43b1ef,_0x42b0b4[_0x83ab('0x16')]['message']);return _0x21e0fe(_0x42b0b4[_0x83ab('0x16')][_0x83ab('0x18')]);}else{logger['info'](_0x83ab('0x12'),_0x43b1ef,_0x83ab('0x14'));_0x21e0fe(_0x42b0b4[_0x83ab('0x19')]['message']);}})[_0x83ab('0x1a')](function(_0x5990d9){logger[_0x83ab('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x43b1ef,_0x5990d9);_0x5e9c53(_0x5990d9);});});} \ No newline at end of file +var _0x4de0=['defaults','localhost','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis'];(function(_0x4beb7a,_0x246983){var _0x50c7dd=function(_0x4c006c){while(--_0x4c006c){_0x4beb7a['push'](_0x4beb7a['shift']());}};_0x50c7dd(++_0x246983);}(_0x4de0,0x7b));var _0x04de=function(_0x25a681,_0x2d5cf5){_0x25a681=_0x25a681-0x0;var _0x2b76bf=_0x4de0[_0x25a681];return _0x2b76bf;};'use strict';var _=require(_0x04de('0x0'));var util=require(_0x04de('0x1'));var moment=require(_0x04de('0x2'));var BPromise=require('bluebird');var rs=require(_0x04de('0x3'));var fs=require('fs');var Redis=require(_0x04de('0x4'));var db=require(_0x04de('0x5'))['db'];var utils=require(_0x04de('0x6'));var logger=require(_0x04de('0x7'))(_0x04de('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x04de('0x9')][_0x04de('0xa')]({'port':0x232a});config[_0x04de('0xb')]=_[_0x04de('0xc')](config[_0x04de('0xb')],{'host':_0x04de('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x04de('0xb')]));require(_0x04de('0xe'))[_0x04de('0xf')](socket);function respondWithRpcPromise(_0x3c11b0,_0x3b76dd,_0x2fcd29){return new BPromise(function(_0x3ab1e0,_0x31b577){return client[_0x04de('0x10')](_0x3c11b0,_0x2fcd29)[_0x04de('0x11')](function(_0x193836){logger[_0x04de('0x12')](_0x04de('0x13'),_0x3b76dd,_0x04de('0x14'));logger[_0x04de('0x15')](_0x04de('0x16'),_0x3b76dd,_0x04de('0x14'),JSON[_0x04de('0x17')](_0x193836));if(_0x193836[_0x04de('0x18')]){if(_0x193836['error']['code']===0x1f4){logger[_0x04de('0x18')](_0x04de('0x13'),_0x3b76dd,_0x193836['error']['message']);return _0x31b577(_0x193836[_0x04de('0x18')]['message']);}logger[_0x04de('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x3b76dd,_0x193836[_0x04de('0x18')]['message']);return _0x3ab1e0(_0x193836[_0x04de('0x18')][_0x04de('0x19')]);}else{logger[_0x04de('0x12')](_0x04de('0x13'),_0x3b76dd,_0x04de('0x14'));_0x3ab1e0(_0x193836[_0x04de('0x1a')]['message']);}})['catch'](function(_0x1900f3){logger['error'](_0x04de('0x13'),_0x3b76dd,_0x1900f3);_0x31b577(_0x1900f3);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index dde5d27..fcd89f7 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 _0xd7b5=['length','chatWebsite:','./chatWebsite.events','remove','update','emit','register'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd7b5,0x6b));var _0x5d7b=function(_0x2a0e90,_0x161a7d){_0x2a0e90=_0x2a0e90-0x0;var _0x229b02=_0xd7b5[_0x2a0e90];return _0x229b02;};'use strict';var ChatWebsiteEvents=require(_0x5d7b('0x0'));var events=['save',_0x5d7b('0x1'),_0x5d7b('0x2')];function createListener(_0x2c2cb9,_0x4cede7){return function(_0x336bc3){_0x4cede7[_0x5d7b('0x3')](_0x2c2cb9,_0x336bc3);};}function removeListener(_0x42489a,_0x36ed59){return function(){ChatWebsiteEvents['removeListener'](_0x42489a,_0x36ed59);};}exports[_0x5d7b('0x4')]=function(_0x36ba6b){for(var _0x47ea54=0x0,_0x5e4398=events[_0x5d7b('0x5')];_0x47ea54<_0x5e4398;_0x47ea54++){var _0x5f2967=events[_0x47ea54];var _0x2cf4d4=createListener(_0x5d7b('0x6')+_0x5f2967,_0x36ba6b);ChatWebsiteEvents['on'](_0x5f2967,_0x2cf4d4);}}; \ No newline at end of file +var _0x5670=['length','./chatWebsite.events','update','emit','register'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x5670,0x8d));var _0x0567=function(_0x2fc7ee,_0x1bb152){_0x2fc7ee=_0x2fc7ee-0x0;var _0x174721=_0x5670[_0x2fc7ee];return _0x174721;};'use strict';var ChatWebsiteEvents=require(_0x0567('0x0'));var events=['save','remove',_0x0567('0x1')];function createListener(_0x2ee9ec,_0x37afb5){return function(_0x1ca03a){_0x37afb5[_0x0567('0x2')](_0x2ee9ec,_0x1ca03a);};}function removeListener(_0x4e6fab,_0x9dc2d2){return function(){ChatWebsiteEvents['removeListener'](_0x4e6fab,_0x9dc2d2);};}exports[_0x0567('0x3')]=function(_0x1df157){for(var _0x5dbe7b=0x0,_0x3138ab=events[_0x0567('0x4')];_0x5dbe7b<_0x3138ab;_0x5dbe7b++){var _0x4509f6=events[_0x5dbe7b];var _0xc15373=createListener('chatWebsite:'+_0x4509f6,_0x1df157);ChatWebsiteEvents['on'](_0x4509f6,_0xc15373);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index cfdb955..e289505 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 _0x69bd=['./chatWebsite.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getSnippet','getApplications','/:id/proactive_actions','/:id/fields','getFields','/:id/offline_messages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','server/files/images/avatars/','addCustomerAvatar','/:id/notify','server/files','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','addApplications','addProactiveActions','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment'];(function(_0x30ab37,_0x467f7b){var _0x55624a=function(_0x52a2ac){while(--_0x52a2ac){_0x30ab37['push'](_0x30ab37['shift']());}};_0x55624a(++_0x467f7b);}(_0x69bd,0x14e));var _0xd69b=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x69bd[_0x4a7631];return _0x1a5a6f;};'use strict';var multer=require('multer');var util=require(_0xd69b('0x0'));var path=require(_0xd69b('0x1'));var timeout=require(_0xd69b('0x2'));var express=require(_0xd69b('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd69b('0x4'));var config=require(_0xd69b('0x5'));var controller=require(_0xd69b('0x6'));router['get']('/',auth[_0xd69b('0x7')](),controller[_0xd69b('0x8')]);router[_0xd69b('0x9')](_0xd69b('0xa'),auth[_0xd69b('0x7')](),controller[_0xd69b('0xb')]);router[_0xd69b('0x9')](_0xd69b('0xc'),auth[_0xd69b('0x7')](),controller[_0xd69b('0xd')]);router[_0xd69b('0x9')](_0xd69b('0xe'),auth[_0xd69b('0x7')](),controller[_0xd69b('0xf')]);router[_0xd69b('0x9')](_0xd69b('0x10'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xd69b('0x9')](_0xd69b('0x11'),controller['getLogo']);router[_0xd69b('0x9')]('/:id/avatar',controller[_0xd69b('0x12')]);router[_0xd69b('0x9')](_0xd69b('0x13'),controller['getCustomerAvatar']);router[_0xd69b('0x9')](_0xd69b('0x14'),controller[_0xd69b('0x15')]);router[_0xd69b('0x9')](_0xd69b('0x16'),auth[_0xd69b('0x7')](),controller['getInteractions']);router[_0xd69b('0x9')]('/:id/snippet',controller[_0xd69b('0x17')]);router[_0xd69b('0x9')]('/:id/applications',auth[_0xd69b('0x7')](),controller[_0xd69b('0x18')]);router['get'](_0xd69b('0x19'),auth['isAuthenticated'](),controller['getProactiveActions']);router['get'](_0xd69b('0x1a'),controller[_0xd69b('0x1b')]);router[_0xd69b('0x9')](_0xd69b('0x1c'),auth[_0xd69b('0x7')](),controller['getOfflineMessages']);router['get'](_0xd69b('0x1d'),auth[_0xd69b('0x7')](),controller[_0xd69b('0x1e')]);router[_0xd69b('0x1f')]('/',auth[_0xd69b('0x7')](),controller[_0xd69b('0x20')]);router[_0xd69b('0x1f')](_0xd69b('0xe'),auth[_0xd69b('0x7')](),controller[_0xd69b('0x21')]);router[_0xd69b('0x1f')](_0xd69b('0x10'),auth[_0xd69b('0x7')](),controller[_0xd69b('0x22')]);var upload=multer({'storage':multer[_0xd69b('0x23')]({'destination':function(_0x10bbaa,_0x22a39d,_0x54f66b){_0x54f66b(null,path[_0xd69b('0x24')](config[_0xd69b('0x25')],_0xd69b('0x26')));},'filename':function(_0x27f3f2,_0x17ab71,_0x388328){_0x388328(null,util[_0xd69b('0x27')](_0xd69b('0x28'),Date[_0xd69b('0x29')](),_0x17ab71[_0xd69b('0x2a')]));}})});router[_0xd69b('0x1f')](_0xd69b('0x11'),upload[_0xd69b('0x2b')](_0xd69b('0x2c')),controller[_0xd69b('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x7cae48,_0x5abf5e,_0x220d62){_0x220d62(null,path[_0xd69b('0x24')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x4622cc,_0x4a6888,_0x2d2c49){_0x2d2c49(null,util[_0xd69b('0x27')](_0xd69b('0x28'),Date[_0xd69b('0x29')](),_0x4a6888[_0xd69b('0x2a')]));}})});router[_0xd69b('0x1f')]('/:id/avatar',upload[_0xd69b('0x2b')]('file'),controller['addAvatar']);var upload=multer({'storage':multer[_0xd69b('0x23')]({'destination':function(_0x3ea48d,_0x4c7be5,_0x9a5680){_0x9a5680(null,path[_0xd69b('0x24')](config[_0xd69b('0x25')],_0xd69b('0x2e')));},'filename':function(_0xeac85d,_0xa386b8,_0x356bc4){_0x356bc4(null,util['format']('%s-%s',Date[_0xd69b('0x29')](),_0xa386b8['originalname']));}})});router[_0xd69b('0x1f')](_0xd69b('0x13'),upload[_0xd69b('0x2b')]('file'),controller[_0xd69b('0x2f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x15a185,_0x4c347d,_0x48fe66){_0x48fe66(null,path[_0xd69b('0x24')](config['root'],_0xd69b('0x2e')));},'filename':function(_0x114336,_0x508c74,_0x5e806e){_0x5e806e(null,util[_0xd69b('0x27')]('%s-%s',Date['now'](),_0x508c74['originalname']));}})});router[_0xd69b('0x1f')](_0xd69b('0x14'),upload[_0xd69b('0x2b')](_0xd69b('0x2c')),controller['addSystemAvatar']);router[_0xd69b('0x1f')](_0xd69b('0x30'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xd69b('0x23')]({'destination':function(_0x533514,_0x5565f6,_0xc2ab8f){const _0x51f1eb=path[_0xd69b('0x24')](config['root'],_0xd69b('0x31'),'attachments',_0xd69b('0x32'));fs_extra[_0xd69b('0x33')](_0x51f1eb,function(){_0xc2ab8f(null,_0x51f1eb);});},'filename':function(_0x5b29c4,_0xd434f6,_0x47b25f){const _0x5180eb=_0xd434f6[_0xd69b('0x2a')][_0xd69b('0x34')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1dc1ca=path[_0xd69b('0x35')](_0x5180eb);const _0xb548fe=Date[_0xd69b('0x29')]()+'-'+_0x5180eb['replace'](_0x1dc1ca,'')+_0x1dc1ca;_0x47b25f(null,_0xb548fe);}})});router['post'](_0xd69b('0x36'),offlineUploadMulter[_0xd69b('0x37')](),controller[_0xd69b('0x38')]);router[_0xd69b('0x1f')](_0xd69b('0x16'),auth[_0xd69b('0x7')](),controller[_0xd69b('0x39')]);router['post']('/:id/applications',auth[_0xd69b('0x7')](),controller[_0xd69b('0x3a')]);router[_0xd69b('0x1f')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0xd69b('0x3b')]);router[_0xd69b('0x1f')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0xd69b('0x3c')]('/:id',auth['isAuthenticated'](),controller[_0xd69b('0x3d')]);router[_0xd69b('0x3e')](_0xd69b('0xc'),auth['isAuthenticated'](),controller[_0xd69b('0x3f')]);router[_0xd69b('0x3e')]('/:id/dispositions',auth[_0xd69b('0x7')](),controller[_0xd69b('0x40')]);router[_0xd69b('0x3e')](_0xd69b('0x10'),auth[_0xd69b('0x7')](),controller[_0xd69b('0x41')]);router[_0xd69b('0x3e')](_0xd69b('0x1d'),auth[_0xd69b('0x7')](),controller[_0xd69b('0x42')]);module[_0xd69b('0x43')]=router; \ No newline at end of file +var _0xda2c=['addInteraction','/:id/applications','addApplications','put','/:id','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','/:id/interactions','/:id/snippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','create','/:id/canned_answers','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','server/files/images/avatars/','post','addCustomerAvatar','/:id/system_avatar','notify','server/files','replace','extname','/:id/offline','offline'];(function(_0x33ed8e,_0x1c42b3){var _0x2c34ec=function(_0x56b57d){while(--_0x56b57d){_0x33ed8e['push'](_0x33ed8e['shift']());}};_0x2c34ec(++_0x1c42b3);}(_0xda2c,0x169));var _0xcda2=function(_0x3418b3,_0x3b8a3f){_0x3418b3=_0x3418b3-0x0;var _0x1c9186=_0xda2c[_0x3418b3];return _0x1c9186;};'use strict';var multer=require(_0xcda2('0x0'));var util=require(_0xcda2('0x1'));var path=require(_0xcda2('0x2'));var timeout=require(_0xcda2('0x3'));var express=require(_0xcda2('0x4'));var router=express['Router']();var fs_extra=require(_0xcda2('0x5'));var auth=require(_0xcda2('0x6'));var interaction=require(_0xcda2('0x7'));var config=require(_0xcda2('0x8'));var controller=require(_0xcda2('0x9'));router[_0xcda2('0xa')]('/',auth[_0xcda2('0xb')](),controller['index']);router[_0xcda2('0xa')](_0xcda2('0xc'),auth[_0xcda2('0xb')](),controller[_0xcda2('0xd')]);router[_0xcda2('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xcda2('0xe')]);router[_0xcda2('0xa')](_0xcda2('0xf'),auth['isAuthenticated'](),controller[_0xcda2('0x10')]);router[_0xcda2('0xa')]('/:id/canned_answers',auth[_0xcda2('0xb')](),controller[_0xcda2('0x11')]);router[_0xcda2('0xa')]('/:id/logo',controller[_0xcda2('0x12')]);router[_0xcda2('0xa')](_0xcda2('0x13'),controller[_0xcda2('0x14')]);router[_0xcda2('0xa')](_0xcda2('0x15'),controller[_0xcda2('0x16')]);router['get']('/:id/system_avatar',controller[_0xcda2('0x17')]);router[_0xcda2('0xa')](_0xcda2('0x18'),auth[_0xcda2('0xb')](),controller['getInteractions']);router[_0xcda2('0xa')](_0xcda2('0x19'),controller['getSnippet']);router[_0xcda2('0xa')]('/:id/applications',auth['isAuthenticated'](),controller[_0xcda2('0x1a')]);router[_0xcda2('0xa')](_0xcda2('0x1b'),auth[_0xcda2('0xb')](),controller[_0xcda2('0x1c')]);router[_0xcda2('0xa')](_0xcda2('0x1d'),controller[_0xcda2('0x1e')]);router[_0xcda2('0xa')](_0xcda2('0x1f'),auth['isAuthenticated'](),controller[_0xcda2('0x20')]);router[_0xcda2('0xa')](_0xcda2('0x21'),auth[_0xcda2('0xb')](),controller[_0xcda2('0x22')]);router['post']('/',auth[_0xcda2('0xb')](),controller[_0xcda2('0x23')]);router['post'](_0xcda2('0xf'),auth[_0xcda2('0xb')](),controller['addDisposition']);router['post'](_0xcda2('0x24'),auth[_0xcda2('0xb')](),controller[_0xcda2('0x25')]);var upload=multer({'storage':multer[_0xcda2('0x26')]({'destination':function(_0x385225,_0x5887e2,_0x2b7dc6){_0x2b7dc6(null,path[_0xcda2('0x27')](config[_0xcda2('0x28')],_0xcda2('0x29')));},'filename':function(_0x17cfd0,_0x5a922e,_0x1f0722){_0x1f0722(null,util[_0xcda2('0x2a')](_0xcda2('0x2b'),Date[_0xcda2('0x2c')](),_0x5a922e[_0xcda2('0x2d')]));}})});router['post']('/:id/logo',upload[_0xcda2('0x2e')](_0xcda2('0x2f')),controller[_0xcda2('0x30')]);var upload=multer({'storage':multer[_0xcda2('0x26')]({'destination':function(_0x3ab7af,_0x10efee,_0x47fb30){_0x47fb30(null,path[_0xcda2('0x27')](config[_0xcda2('0x28')],_0xcda2('0x31')));},'filename':function(_0x4d5bdc,_0x57f20e,_0x5daf5d){_0x5daf5d(null,util['format'](_0xcda2('0x2b'),Date[_0xcda2('0x2c')](),_0x57f20e[_0xcda2('0x2d')]));}})});router['post']('/:id/avatar',upload['single'](_0xcda2('0x2f')),controller['addAvatar']);var upload=multer({'storage':multer[_0xcda2('0x26')]({'destination':function(_0xb22382,_0x2beba4,_0x4353c2){_0x4353c2(null,path['join'](config[_0xcda2('0x28')],'server/files/images/avatars/'));},'filename':function(_0x193821,_0x3eff18,_0x5cb231){_0x5cb231(null,util[_0xcda2('0x2a')](_0xcda2('0x2b'),Date[_0xcda2('0x2c')](),_0x3eff18[_0xcda2('0x2d')]));}})});router[_0xcda2('0x32')]('/:id/customer_avatar',upload[_0xcda2('0x2e')]('file'),controller[_0xcda2('0x33')]);var upload=multer({'storage':multer[_0xcda2('0x26')]({'destination':function(_0x55ead7,_0x5387b6,_0x2c8425){_0x2c8425(null,path[_0xcda2('0x27')](config[_0xcda2('0x28')],_0xcda2('0x31')));},'filename':function(_0x4ba25f,_0x3ba6a5,_0x2edb8c){_0x2edb8c(null,util['format'](_0xcda2('0x2b'),Date['now'](),_0x3ba6a5['originalname']));}})});router[_0xcda2('0x32')](_0xcda2('0x34'),upload[_0xcda2('0x2e')]('file'),controller['addSystemAvatar']);router[_0xcda2('0x32')]('/:id/notify',controller[_0xcda2('0x35')]);const offlineUploadMulter=multer({'storage':multer[_0xcda2('0x26')]({'destination':function(_0x7b6d8f,_0x425f2f,_0x15efe1){const _0x34dc08=path[_0xcda2('0x27')](config['root'],_0xcda2('0x36'),'attachments','offline-chat');fs_extra['ensureDir'](_0x34dc08,function(){_0x15efe1(null,_0x34dc08);});},'filename':function(_0x5f1cfd,_0x3892e6,_0x2ad04a){const _0x174d4e=_0x3892e6[_0xcda2('0x2d')][_0xcda2('0x37')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x405423=path[_0xcda2('0x38')](_0x174d4e);const _0x4e0db9=Date['now']()+'-'+_0x174d4e[_0xcda2('0x37')](_0x405423,'')+_0x405423;_0x2ad04a(null,_0x4e0db9);}})});router['post'](_0xcda2('0x39'),offlineUploadMulter['any'](),controller[_0xcda2('0x3a')]);router[_0xcda2('0x32')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xcda2('0x3b')]);router[_0xcda2('0x32')](_0xcda2('0x3c'),auth[_0xcda2('0xb')](),controller[_0xcda2('0x3d')]);router[_0xcda2('0x32')](_0xcda2('0x1b'),auth[_0xcda2('0xb')](),controller['addProactiveActions']);router[_0xcda2('0x32')](_0xcda2('0x21'),auth[_0xcda2('0xb')](),controller['addAgents']);router[_0xcda2('0x3e')](_0xcda2('0x3f'),auth[_0xcda2('0xb')](),controller['update']);router[_0xcda2('0x40')](_0xcda2('0x3f'),auth[_0xcda2('0xb')](),controller[_0xcda2('0x41')]);router['delete'](_0xcda2('0xf'),auth['isAuthenticated'](),controller[_0xcda2('0x42')]);router[_0xcda2('0x40')](_0xcda2('0x24'),auth[_0xcda2('0xb')](),controller[_0xcda2('0x43')]);router[_0xcda2('0x40')]('/:id/users',auth[_0xcda2('0xb')](),controller[_0xcda2('0x44')]);module[_0xcda2('0x45')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 18a6835..185c07e 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 _0x3831=['AmazonAWS','Google','sequelize','STRING','ENUM'];(function(_0x38c1f8,_0x52803d){var _0x3e8954=function(_0x84a865){while(--_0x84a865){_0x38c1f8['push'](_0x38c1f8['shift']());}};_0x3e8954(++_0x52803d);}(_0x3831,0x14c));var _0x1383=function(_0x29975a,_0x2ca253){_0x29975a=_0x29975a-0x0;var _0x41bcac=_0x3831[_0x29975a];return _0x41bcac;};'use strict';var Sequelize=require(_0x1383('0x0'));module['exports']={'name':{'type':Sequelize[_0x1383('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x1383('0x2')](_0x1383('0x3'),_0x1383('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x1383('0x1')]},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa6bb=['exports','STRING','ENUM','AmazonAWS','Google'];(function(_0x42d516,_0x24b87f){var _0x53b87a=function(_0x14e070){while(--_0x14e070){_0x42d516['push'](_0x42d516['shift']());}};_0x53b87a(++_0x24b87f);}(_0xa6bb,0x12c));var _0xba6b=function(_0x334833,_0x5f58a5){_0x334833=_0x334833-0x0;var _0x70cf60=_0xa6bb[_0x334833];return _0x70cf60;};'use strict';var Sequelize=require('sequelize');module[_0xba6b('0x0')]={'name':{'type':Sequelize[_0xba6b('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xba6b('0x2')](_0xba6b('0x3'),_0xba6b('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 8ac5116..fe169a5 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 _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','CloudProvider','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(_0x932e4c,_0x140353){var _0x5184d4=function(_0x3af828){while(--_0x3af828){_0x932e4c['push'](_0x932e4c['shift']());}};_0x5184d4(++_0x140353);}(_0x2ef3,0xba));var _0x32ef=function(_0x459bb5,_0xc59a0a){_0x459bb5=_0x459bb5-0x0;var _0x19728e=_0x2ef3[_0x459bb5];return _0x19728e;};'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['CloudProvider'][_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['CloudProvider'][_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['CloudProvider']['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 +var _0xdb28=['error','stack','name','send','index','CloudProvider','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus'];(function(_0x32b02a,_0x246a96){var _0x3f20cb=function(_0x2efc95){while(--_0x2efc95){_0x32b02a['push'](_0x32b02a['shift']());}};_0x3f20cb(++_0x246a96);}(_0xdb28,0x106));var _0x8db2=function(_0x455c6f,_0x109cac){_0x455c6f=_0x455c6f-0x0;var _0x41d448=_0xdb28[_0x455c6f];return _0x41d448;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'all':!![]}];}return db[_0x8db2('0x2b')][_0x8db2('0x40')](_0x21bae5);})['then'](function(_0x49a7ae){_0x3124d5[_0x8db2('0x41')]=_0x49a7ae;return _0x3124d5;})['then'](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x42')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x43')]=function(_0x313130,_0x307783){var _0xb4fe2c={'raw':!![],'where':{'id':_0x313130[_0x8db2('0x44')]['id']}},_0x30d606={};_0x30d606['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x45')]);_0x30d606[_0x8db2('0x30')]=_['keys'](_0x313130[_0x8db2('0x30')]);_0x30d606[_0x8db2('0x39')]=_[_0x8db2('0x46')](_0x30d606[_0x8db2('0x32')],_0x30d606['query']);_0xb4fe2c[_0x8db2('0x34')]=_['intersection'](_0x30d606[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x313130[_0x8db2('0x30')]['fields']));_0xb4fe2c['attributes']=_0xb4fe2c[_0x8db2('0x34')]['length']?_0xb4fe2c[_0x8db2('0x34')]:_0x30d606[_0x8db2('0x32')];if(_0x313130[_0x8db2('0x30')][_0x8db2('0x3f')]){_0xb4fe2c[_0x8db2('0x47')]=[{'all':!![]}];}_0xb4fe2c=_[_0x8db2('0x3d')]({},_0xb4fe2c,_0x313130[_0x8db2('0x3e')]);return db[_0x8db2('0x2b')][_0x8db2('0x48')](_0xb4fe2c)[_0x8db2('0x24')](handleEntityNotFound(_0x307783,null))[_0x8db2('0x24')](respondWithResult(_0x307783,null))[_0x8db2('0x42')](handleError(_0x307783,null));};exports['create']=function(_0x449109,_0x2ada52){return db[_0x8db2('0x2b')][_0x8db2('0x49')](_0x449109['body'],{})['then'](respondWithResult(_0x2ada52,0xc9))[_0x8db2('0x42')](handleError(_0x2ada52,null));};exports[_0x8db2('0x23')]=function(_0x164020,_0x4c66e5){if(_0x164020['body']['id']){delete _0x164020['body']['id'];}return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x164020[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x4c66e5,null))[_0x8db2('0x24')](saveUpdates(_0x164020[_0x8db2('0x4a')],null))[_0x8db2('0x24')](respondWithResult(_0x4c66e5,null))['catch'](handleError(_0x4c66e5,null));};exports['destroy']=function(_0x3d29bc,_0x18c6ef){return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x3d29bc[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x18c6ef,null))[_0x8db2('0x24')](removeEntity(_0x18c6ef,null))[_0x8db2('0x42')](handleError(_0x18c6ef,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index c3f463f..137a6a4 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 _0x835f=['rimraf','./cloudProvider.attributes','cloud_providers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2d9fa4,_0x91dcce){var _0x26f5d0=function(_0x5bcb2f){while(--_0x5bcb2f){_0x2d9fa4['push'](_0x2d9fa4['shift']());}};_0x26f5d0(++_0x91dcce);}(_0x835f,0x121));var _0xf835=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x835f[_0x4a7631];return _0x1a5a6f;};'use strict';var _=require(_0xf835('0x0'));var util=require(_0xf835('0x1'));var logger=require(_0xf835('0x2'))(_0xf835('0x3'));var moment=require(_0xf835('0x4'));var BPromise=require(_0xf835('0x5'));var rp=require(_0xf835('0x6'));var fs=require('fs');var path=require(_0xf835('0x7'));var rimraf=require(_0xf835('0x8'));var config=require('../../config/environment');var attributes=require(_0xf835('0x9'));module['exports']=function(_0x44fc71,_0x22ffb5){return _0x44fc71['define']('CloudProvider',attributes,{'tableName':_0xf835('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3cef=['define','lodash','util','../../config/logger','api','moment','path','../../config/environment'];(function(_0x32bdae,_0x20dd64){var _0x5ceb9d=function(_0x4fae45){while(--_0x4fae45){_0x32bdae['push'](_0x32bdae['shift']());}};_0x5ceb9d(++_0x20dd64);}(_0x3cef,0x1a9));var _0xf3ce=function(_0x2e0ac5,_0x58a84c){_0x2e0ac5=_0x2e0ac5-0x0;var _0x12dea5=_0x3cef[_0x2e0ac5];return _0x12dea5;};'use strict';var _=require(_0xf3ce('0x0'));var util=require(_0xf3ce('0x1'));var logger=require(_0xf3ce('0x2'))(_0xf3ce('0x3'));var moment=require(_0xf3ce('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf3ce('0x5'));var rimraf=require('rimraf');var config=require(_0xf3ce('0x6'));var attributes=require('./cloudProvider.attributes');module['exports']=function(_0x21b4d1,_0x62c418){return _0x21b4d1[_0xf3ce('0x7')]('CloudProvider',attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index a5d9087..a58b25a 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 _0x6db4=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird'];(function(_0x48a1ad,_0x2f2934){var _0x21cbc8=function(_0x280916){while(--_0x280916){_0x48a1ad['push'](_0x48a1ad['shift']());}};_0x21cbc8(++_0x2f2934);}(_0x6db4,0x111));var _0x46db=function(_0x4a3434,_0x166642){_0x4a3434=_0x4a3434-0x0;var _0x1ec429=_0x6db4[_0x4a3434];return _0x1ec429;};'use strict';var _=require('lodash');var util=require(_0x46db('0x0'));var moment=require(_0x46db('0x1'));var BPromise=require(_0x46db('0x2'));var rs=require(_0x46db('0x3'));var fs=require('fs');var Redis=require(_0x46db('0x4'));var db=require(_0x46db('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x46db('0x6'))(_0x46db('0x7'));var config=require(_0x46db('0x8'));var jayson=require(_0x46db('0x9'));var client=jayson[_0x46db('0xa')][_0x46db('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23de32,_0x5409cd,_0x3a2dcb){return new BPromise(function(_0x2a597d,_0x27b949){return client[_0x46db('0xc')](_0x23de32,_0x3a2dcb)[_0x46db('0xd')](function(_0x427c62){logger[_0x46db('0xe')](_0x46db('0xf'),_0x5409cd,_0x46db('0x10'));logger[_0x46db('0x11')](_0x46db('0x12'),_0x5409cd,_0x46db('0x10'),JSON['stringify'](_0x427c62));if(_0x427c62[_0x46db('0x13')]){if(_0x427c62[_0x46db('0x13')][_0x46db('0x14')]===0x1f4){logger[_0x46db('0x13')](_0x46db('0xf'),_0x5409cd,_0x427c62[_0x46db('0x13')][_0x46db('0x15')]);return _0x27b949(_0x427c62[_0x46db('0x13')][_0x46db('0x15')]);}logger['error']('CloudProvider,\x20%s,\x20%s',_0x5409cd,_0x427c62['error'][_0x46db('0x15')]);return _0x2a597d(_0x427c62[_0x46db('0x13')]['message']);}else{logger[_0x46db('0xe')]('CloudProvider,\x20%s,\x20%s',_0x5409cd,_0x46db('0x10'));_0x2a597d(_0x427c62['result'][_0x46db('0x15')]);}})[_0x46db('0x16')](function(_0x5a75fb){logger[_0x46db('0x13')](_0x46db('0xf'),_0x5409cd,_0x5a75fb);_0x27b949(_0x5a75fb);});});} \ No newline at end of file +var _0x34bd=['code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2e30b0,_0x3be40e){var _0x5167d4=function(_0x24d1db){while(--_0x24d1db){_0x2e30b0['push'](_0x2e30b0['shift']());}};_0x5167d4(++_0x3be40e);}(_0x34bd,0x1d2));var _0xd34b=function(_0x2af276,_0xb15ec5){_0x2af276=_0x2af276-0x0;var _0x4c586e=_0x34bd[_0x2af276];return _0x4c586e;};'use strict';var _=require(_0xd34b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd34b('0x1'));var rs=require(_0xd34b('0x2'));var fs=require('fs');var Redis=require(_0xd34b('0x3'));var db=require(_0xd34b('0x4'))['db'];var utils=require(_0xd34b('0x5'));var logger=require(_0xd34b('0x6'))(_0xd34b('0x7'));var config=require('../../config/environment');var jayson=require(_0xd34b('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x56e3eb,_0x30d93b,_0x3654a5){return new BPromise(function(_0xf51a08,_0x25bce7){return client[_0xd34b('0x9')](_0x56e3eb,_0x3654a5)[_0xd34b('0xa')](function(_0x738328){logger[_0xd34b('0xb')](_0xd34b('0xc'),_0x30d93b,_0xd34b('0xd'));logger[_0xd34b('0xe')](_0xd34b('0xf'),_0x30d93b,'request\x20sent',JSON[_0xd34b('0x10')](_0x738328));if(_0x738328['error']){if(_0x738328[_0xd34b('0x11')][_0xd34b('0x12')]===0x1f4){logger[_0xd34b('0x11')](_0xd34b('0xc'),_0x30d93b,_0x738328[_0xd34b('0x11')][_0xd34b('0x13')]);return _0x25bce7(_0x738328['error'][_0xd34b('0x13')]);}logger[_0xd34b('0x11')]('CloudProvider,\x20%s,\x20%s',_0x30d93b,_0x738328[_0xd34b('0x11')][_0xd34b('0x13')]);return _0xf51a08(_0x738328[_0xd34b('0x11')]['message']);}else{logger[_0xd34b('0xb')](_0xd34b('0xc'),_0x30d93b,'request\x20sent');_0xf51a08(_0x738328[_0xd34b('0x14')]['message']);}})[_0xd34b('0x15')](function(_0x438b61){logger[_0xd34b('0x11')]('CloudProvider,\x20%s,\x20%s',_0x30d93b,_0x438b61);_0x25bce7(_0x438b61);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 72ab0fc..1e49cb8 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 _0x5a14=['exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','./cloudProvider.controller','get','index','isAuthenticated','show','post','create','put','/:id','update','delete','destroy'];(function(_0x21cd1c,_0x21c2b3){var _0x2c2b6a=function(_0x499978){while(--_0x499978){_0x21cd1c['push'](_0x21cd1c['shift']());}};_0x2c2b6a(++_0x21c2b3);}(_0x5a14,0x73));var _0x45a1=function(_0x18936e,_0x4cab2e){_0x18936e=_0x18936e-0x0;var _0x5d85f2=_0x5a14[_0x18936e];return _0x5d85f2;};'use strict';var multer=require(_0x45a1('0x0'));var util=require(_0x45a1('0x1'));var path=require('path');var timeout=require(_0x45a1('0x2'));var express=require('express');var router=express[_0x45a1('0x3')]();var fs_extra=require(_0x45a1('0x4'));var auth=require(_0x45a1('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x45a1('0x6'));router[_0x45a1('0x7')]('/',auth['isAuthenticated'](),controller[_0x45a1('0x8')]);router[_0x45a1('0x7')]('/:id',auth[_0x45a1('0x9')](),controller[_0x45a1('0xa')]);router[_0x45a1('0xb')]('/',auth['isAuthenticated'](),controller[_0x45a1('0xc')]);router[_0x45a1('0xd')](_0x45a1('0xe'),auth['isAuthenticated'](),controller[_0x45a1('0xf')]);router[_0x45a1('0x10')](_0x45a1('0xe'),auth[_0x45a1('0x9')](),controller[_0x45a1('0x11')]);module[_0x45a1('0x12')]=router; \ No newline at end of file +var _0x8545=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cloudProvider.controller','get','index','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','path','connect-timeout'];(function(_0x1b92a6,_0x14444b){var _0x24be5b=function(_0x3a5fb5){while(--_0x3a5fb5){_0x1b92a6['push'](_0x1b92a6['shift']());}};_0x24be5b(++_0x14444b);}(_0x8545,0xa9));var _0x5854=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x8545[_0x1da527];return _0x40fc7c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5854('0x0'));var timeout=require(_0x5854('0x1'));var express=require(_0x5854('0x2'));var router=express[_0x5854('0x3')]();var fs_extra=require(_0x5854('0x4'));var auth=require(_0x5854('0x5'));var interaction=require(_0x5854('0x6'));var config=require('../../config/environment');var controller=require(_0x5854('0x7'));router[_0x5854('0x8')]('/',auth['isAuthenticated'](),controller[_0x5854('0x9')]);router['get'](_0x5854('0xa'),auth[_0x5854('0xb')](),controller[_0x5854('0xc')]);router[_0x5854('0xd')]('/',auth[_0x5854('0xb')](),controller[_0x5854('0xe')]);router[_0x5854('0xf')](_0x5854('0xa'),auth[_0x5854('0xb')](),controller['update']);router[_0x5854('0x10')](_0x5854('0xa'),auth[_0x5854('0xb')](),controller[_0x5854('0x11')]);module[_0x5854('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index d765688..b99a1aa 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 _0x2da2=['exports','STRING','name'];(function(_0x1dd505,_0x72c2a9){var _0x14104a=function(_0xd44bc5){while(--_0xd44bc5){_0x1dd505['push'](_0x1dd505['shift']());}};_0x14104a(++_0x72c2a9);}(_0x2da2,0x108));var _0x22da=function(_0xa52b25,_0x488427){_0xa52b25=_0xa52b25-0x0;var _0x112a63=_0x2da2[_0xa52b25];return _0x112a63;};'use strict';var Sequelize=require('sequelize');module[_0x22da('0x0')]={'name':{'type':Sequelize[_0x22da('0x1')],'unique':_0x22da('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x22da('0x1')]},'companyId':{'type':Sequelize[_0x22da('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x22da('0x1')]},'fax':{'type':Sequelize[_0x22da('0x1')]},'type':{'type':Sequelize[_0x22da('0x1')]},'street':{'type':Sequelize[_0x22da('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x22da('0x1')]},'country':{'type':Sequelize[_0x22da('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x22da('0x1')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x22da('0x1')]},'sCountry':{'type':Sequelize[_0x22da('0x1')]},'description':{'type':Sequelize[_0x22da('0x1')]}}; \ No newline at end of file +var _0x41d2=['sequelize','exports','STRING','name'];(function(_0x6dd9bb,_0x4eed27){var _0x1ea414=function(_0x35cb90){while(--_0x35cb90){_0x6dd9bb['push'](_0x6dd9bb['shift']());}};_0x1ea414(++_0x4eed27);}(_0x41d2,0x138));var _0x241d=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x41d2[_0x4b2436];return _0x4f5ab2;};'use strict';var Sequelize=require(_0x241d('0x0'));module[_0x241d('0x1')]={'name':{'type':Sequelize[_0x241d('0x2')],'unique':_0x241d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x241d('0x2')]},'companyId':{'type':Sequelize[_0x241d('0x2')]},'website':{'type':Sequelize[_0x241d('0x2')]},'phone':{'type':Sequelize[_0x241d('0x2')]},'fax':{'type':Sequelize[_0x241d('0x2')]},'type':{'type':Sequelize[_0x241d('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x241d('0x2')]},'city':{'type':Sequelize[_0x241d('0x2')]},'country':{'type':Sequelize[_0x241d('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x241d('0x2')]},'sStreet':{'type':Sequelize[_0x241d('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x241d('0x2')]},'sCountry':{'type':Sequelize[_0x241d('0x2')]},'description':{'type':Sequelize[_0x241d('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 2d3703d..ab925ea 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 _0x21e1=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','get','Companies','UserProfileResource','destroy','then','error','stack','name','send','index','CmCompany','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','options','includeAll','findAll','catch','keys','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addContacts','CmContact','ids','getContacts','findOne','sort'];(function(_0x4c2c40,_0x337dcd){var _0xa1e0ac=function(_0x28d215){while(--_0x28d215){_0x4c2c40['push'](_0x4c2c40['shift']());}};_0xa1e0ac(++_0x337dcd);}(_0x21e1,0x9e));var _0x121e=function(_0x27c2f2,_0x256d40){_0x27c2f2=_0x27c2f2-0x0;var _0x3425d6=_0x21e1[_0x27c2f2];return _0x3425d6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x121e('0x0'));var zipdir=require(_0x121e('0x1'));var jsonpatch=require(_0x121e('0x2'));var rp=require(_0x121e('0x3'));var moment=require('moment');var BPromise=require(_0x121e('0x4'));var Mustache=require(_0x121e('0x5'));var util=require('util');var path=require(_0x121e('0x6'));var sox=require(_0x121e('0x7'));var csv=require(_0x121e('0x8'));var ejs=require(_0x121e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x121e('0xa'));var squel=require(_0x121e('0xb'));var crypto=require(_0x121e('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x121e('0xd'));var Redis=require(_0x121e('0xe'));var authService=require(_0x121e('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x121e('0x10'));var hardwareService=require(_0x121e('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x121e('0x12'));var db=require(_0x121e('0x13'))['db'];function respondWithStatusCode(_0x2e225d,_0x15bd2c){_0x15bd2c=_0x15bd2c||0xcc;return function(_0x5d81d1){if(_0x5d81d1){return _0x2e225d[_0x121e('0x14')](_0x15bd2c);}return _0x2e225d[_0x121e('0x15')](_0x15bd2c)[_0x121e('0x16')]();};}function respondWithResult(_0x14e342,_0x5241fa){_0x5241fa=_0x5241fa||0xc8;return function(_0x42ec76){if(_0x42ec76){return _0x14e342[_0x121e('0x15')](_0x5241fa)[_0x121e('0x17')](_0x42ec76);}};}function respondWithFilteredResult(_0x9dbb87,_0x2468c6){return function(_0x417b68){if(_0x417b68){var _0x210ae5=typeof _0x2468c6[_0x121e('0x18')]===_0x121e('0x19')&&typeof _0x2468c6[_0x121e('0x1a')]===_0x121e('0x19');var _0x192b7e=_0x417b68[_0x121e('0x1b')];var _0x2c56b3=_0x210ae5?0x0:_0x2468c6[_0x121e('0x18')];var _0x2ca479=_0x210ae5?_0x417b68[_0x121e('0x1b')]:_0x2468c6[_0x121e('0x18')]+_0x2468c6[_0x121e('0x1a')];var _0x52d9ed;if(_0x2ca479>=_0x192b7e){_0x2ca479=_0x192b7e;_0x52d9ed=0xc8;}else{_0x52d9ed=0xce;}_0x9dbb87[_0x121e('0x15')](_0x52d9ed);return _0x9dbb87[_0x121e('0x1c')](_0x121e('0x1d'),_0x2c56b3+'-'+_0x2ca479+'/'+_0x192b7e)['json'](_0x417b68);}return null;};}function patchUpdates(_0xab268){return function(_0x268457){try{jsonpatch[_0x121e('0x1e')](_0x268457,_0xab268,!![]);}catch(_0x5dca76){return BPromise['reject'](_0x5dca76);}return _0x268457['save']();};}function saveUpdates(_0x598fb4,_0x357110){return function(_0x2d1566){if(_0x2d1566){return _0x2d1566[_0x121e('0x1f')](_0x598fb4)['then'](function(_0x1cd9fd){return _0x1cd9fd;});}return null;};}function removeEntity(_0x8b667f,_0x175cda){return function(_0x21366e){if(_0x21366e){return _0x21366e['destroy']()['then'](function(){var _0x268b14=_0x21366e[_0x121e('0x20')]({'plain':!![]});var _0x998831=_0x121e('0x21');return db[_0x121e('0x22')][_0x121e('0x23')]({'where':{'type':_0x998831,'resourceId':_0x268b14['id']}})[_0x121e('0x24')](function(){return _0x21366e;});})[_0x121e('0x24')](function(){_0x8b667f[_0x121e('0x15')](0xcc)[_0x121e('0x16')]();});}};}function handleEntityNotFound(_0x1b74bd,_0x4d76b7){return function(_0x8a4ab0){if(!_0x8a4ab0){_0x1b74bd['sendStatus'](0x194);}return _0x8a4ab0;};}function handleError(_0x36c305,_0xec36bc){_0xec36bc=_0xec36bc||0x1f4;return function(_0x1d5349){logger[_0x121e('0x25')](_0x1d5349[_0x121e('0x26')]);if(_0x1d5349['name']){delete _0x1d5349[_0x121e('0x27')];}_0x36c305[_0x121e('0x15')](_0xec36bc)[_0x121e('0x28')](_0x1d5349);};}exports[_0x121e('0x29')]=function(_0x5ab5b1,_0x5be233){var _0x306bee={},_0x30c33a={},_0xd58107={'count':0x0,'rows':[]};return db[_0x121e('0x2a')]['describe']()[_0x121e('0x24')](function(_0x28d90b){_0x30c33a[_0x121e('0x2b')]=_['keys'](_0x28d90b);_0x30c33a[_0x121e('0x2c')]=_['keys'](_0x5ab5b1[_0x121e('0x2c')]);_0x30c33a[_0x121e('0x2d')]=_[_0x121e('0x2e')](_0x30c33a[_0x121e('0x2b')],_0x30c33a[_0x121e('0x2c')]);_0x306bee[_0x121e('0x2f')]=_[_0x121e('0x2e')](_0x30c33a['model'],qs[_0x121e('0x30')](_0x5ab5b1['query']['fields']));_0x306bee['attributes']=_0x306bee['attributes'][_0x121e('0x31')]?_0x306bee[_0x121e('0x2f')]:_0x30c33a[_0x121e('0x2b')];if(!_0x5ab5b1['query'][_0x121e('0x32')](_0x121e('0x33'))){_0x306bee[_0x121e('0x1a')]=qs[_0x121e('0x1a')](_0x5ab5b1[_0x121e('0x2c')]['limit']);_0x306bee[_0x121e('0x18')]=qs[_0x121e('0x18')](_0x5ab5b1['query']['offset']);}_0x306bee[_0x121e('0x34')]=qs['sort'](_0x5ab5b1[_0x121e('0x2c')]['sort']);_0x306bee['where']=qs[_0x121e('0x2d')](_[_0x121e('0x35')](_0x5ab5b1[_0x121e('0x2c')],_0x30c33a['filters']),_0x28d90b);if(_0x5ab5b1[_0x121e('0x2c')][_0x121e('0x36')]){_0x306bee[_0x121e('0x37')]=_[_0x121e('0x38')](_0x306bee['where'],{'$or':_['map'](_0x306bee['attributes'],function(_0xc59642){var _0x3e6c86={};_0x3e6c86[_0xc59642]={'$like':'%'+_0x5ab5b1['query'][_0x121e('0x36')]+'%'};return _0x3e6c86;})});}_0x306bee=_[_0x121e('0x38')]({},_0x306bee,_0x5ab5b1[_0x121e('0x39')]);var _0x2406b6={'where':_0x306bee[_0x121e('0x37')]};return db[_0x121e('0x2a')][_0x121e('0x1b')](_0x2406b6)[_0x121e('0x24')](function(_0x48e1af){_0xd58107[_0x121e('0x1b')]=_0x48e1af;if(_0x5ab5b1[_0x121e('0x2c')][_0x121e('0x3a')]){_0x306bee['include']=[{'all':!![]}];}return db['CmCompany'][_0x121e('0x3b')](_0x306bee);})[_0x121e('0x24')](function(_0x1d29c0){_0xd58107['rows']=_0x1d29c0;return _0xd58107;})[_0x121e('0x24')](respondWithFilteredResult(_0x5be233,_0x306bee))[_0x121e('0x3c')](handleError(_0x5be233,null));})[_0x121e('0x3c')](handleError(_0x5be233,null));};exports['show']=function(_0x134814,_0x20d37f){var _0x3e9884={'raw':![],'where':{'id':_0x134814['params']['id']}},_0x148f83={};_0x148f83[_0x121e('0x2b')]=_[_0x121e('0x3d')](db[_0x121e('0x2a')][_0x121e('0x3e')]);_0x148f83[_0x121e('0x2c')]=_[_0x121e('0x3d')](_0x134814[_0x121e('0x2c')]);_0x148f83['filters']=_[_0x121e('0x2e')](_0x148f83[_0x121e('0x2b')],_0x148f83[_0x121e('0x2c')]);_0x3e9884[_0x121e('0x2f')]=_[_0x121e('0x2e')](_0x148f83['model'],qs[_0x121e('0x30')](_0x134814[_0x121e('0x2c')]['fields']));_0x3e9884[_0x121e('0x2f')]=_0x3e9884[_0x121e('0x2f')][_0x121e('0x31')]?_0x3e9884[_0x121e('0x2f')]:_0x148f83[_0x121e('0x2b')];if(_0x134814[_0x121e('0x2c')][_0x121e('0x3a')]){_0x3e9884['include']=[{'all':!![]}];}_0x3e9884=_[_0x121e('0x38')]({},_0x3e9884,_0x134814[_0x121e('0x39')]);return db[_0x121e('0x2a')][_0x121e('0x3f')](_0x3e9884)['then'](handleEntityNotFound(_0x20d37f,null))['then'](respondWithResult(_0x20d37f,null))[_0x121e('0x3c')](handleError(_0x20d37f,null));};exports[_0x121e('0x40')]=function(_0x3d6a7b,_0x2c33d5){return db[_0x121e('0x2a')][_0x121e('0x40')](_0x3d6a7b['body'],{})[_0x121e('0x24')](function(_0x2bd298){var _0x4d56d8=_0x3d6a7b[_0x121e('0x41')]['get']({'plain':!![]});if(!_0x4d56d8)throw new Error(_0x121e('0x42'));if(_0x4d56d8[_0x121e('0x43')]==='user'){var _0x29f31c=_0x2bd298[_0x121e('0x20')]({'plain':!![]});var _0x5e7eec=_0x121e('0x21');return db[_0x121e('0x44')][_0x121e('0x3f')]({'where':{'name':_0x5e7eec,'userProfileId':_0x4d56d8['userProfileId']},'raw':!![]})[_0x121e('0x24')](function(_0x375de1){if(_0x375de1&&_0x375de1[_0x121e('0x45')]===0x0){return db[_0x121e('0x22')][_0x121e('0x40')]({'name':_0x29f31c[_0x121e('0x27')],'resourceId':_0x29f31c['id'],'type':_0x375de1['name'],'sectionId':_0x375de1['id']},{})[_0x121e('0x24')](function(){return _0x2bd298;});}else{return _0x2bd298;}})[_0x121e('0x3c')](function(_0x243f12){logger[_0x121e('0x25')](_0x121e('0x46'),_0x243f12);throw _0x243f12;});}return _0x2bd298;})[_0x121e('0x24')](respondWithResult(_0x2c33d5,0xc9))[_0x121e('0x3c')](handleError(_0x2c33d5,null));};exports['update']=function(_0x4f6d9c,_0x57a7ce){if(_0x4f6d9c[_0x121e('0x47')]['id']){delete _0x4f6d9c[_0x121e('0x47')]['id'];}return db['CmCompany']['find']({'where':{'id':_0x4f6d9c[_0x121e('0x48')]['id']}})[_0x121e('0x24')](handleEntityNotFound(_0x57a7ce,null))[_0x121e('0x24')](saveUpdates(_0x4f6d9c[_0x121e('0x47')],null))['then'](respondWithResult(_0x57a7ce,null))[_0x121e('0x3c')](handleError(_0x57a7ce,null));};exports[_0x121e('0x23')]=function(_0x5c73fc,_0x2b3de5){return db[_0x121e('0x2a')][_0x121e('0x3f')]({'where':{'id':_0x5c73fc[_0x121e('0x48')]['id']}})[_0x121e('0x24')](handleEntityNotFound(_0x2b3de5,null))[_0x121e('0x24')](removeEntity(_0x2b3de5,null))[_0x121e('0x3c')](handleError(_0x2b3de5,null));};exports['describe']=function(_0x338cb2,_0x531c65){return db[_0x121e('0x2a')]['describe']()[_0x121e('0x24')](respondWithResult(_0x531c65,null))[_0x121e('0x3c')](handleError(_0x531c65,null));};exports[_0x121e('0x49')]=function(_0x1ad829,_0x4ffbbd,_0x504d88){return db[_0x121e('0x4a')][_0x121e('0x3f')]({'where':{'id':_0x1ad829[_0x121e('0x48')]['id']}})[_0x121e('0x24')](handleEntityNotFound(_0x4ffbbd,null))[_0x121e('0x24')](function(_0x55cb5e){if(_0x55cb5e){return _0x55cb5e[_0x121e('0x49')](_0x1ad829[_0x121e('0x47')][_0x121e('0x4b')],_['omit'](_0x1ad829[_0x121e('0x47')],[_0x121e('0x4b'),'id'])||{});}})[_0x121e('0x24')](respondWithResult(_0x4ffbbd,null))[_0x121e('0x3c')](handleError(_0x4ffbbd,null));};exports[_0x121e('0x4c')]=function(_0x4947db,_0x3e820d,_0x3e323c){var _0x5081a5={};var _0x3afe4a={};var _0x3e0e99;var _0x44260c;return db['CmCompany'][_0x121e('0x4d')]({'where':{'id':_0x4947db[_0x121e('0x48')]['id']}})[_0x121e('0x24')](handleEntityNotFound(_0x3e820d,null))[_0x121e('0x24')](function(_0x46dfe6){if(_0x46dfe6){_0x3e0e99=_0x46dfe6;_0x3afe4a[_0x121e('0x2b')]=_['keys'](db['CmContact']['rawAttributes']);_0x3afe4a['query']=_['keys'](_0x4947db[_0x121e('0x2c')]);_0x3afe4a[_0x121e('0x2d')]=_[_0x121e('0x2e')](_0x3afe4a[_0x121e('0x2b')],_0x3afe4a[_0x121e('0x2c')]);_0x5081a5['attributes']=_[_0x121e('0x2e')](_0x3afe4a[_0x121e('0x2b')],qs[_0x121e('0x30')](_0x4947db[_0x121e('0x2c')][_0x121e('0x30')]));_0x5081a5[_0x121e('0x2f')]=_0x5081a5[_0x121e('0x2f')]['length']?_0x5081a5[_0x121e('0x2f')]:_0x3afe4a['model'];_0x5081a5['order']=qs['sort'](_0x4947db[_0x121e('0x2c')][_0x121e('0x4e')]);_0x5081a5[_0x121e('0x37')]=qs['filters'](_[_0x121e('0x35')](_0x4947db[_0x121e('0x2c')],_0x3afe4a[_0x121e('0x2d')]));if(_0x4947db[_0x121e('0x2c')][_0x121e('0x36')]){_0x5081a5['where']=_['merge'](_0x5081a5[_0x121e('0x37')],{'$or':_['map'](_0x5081a5[_0x121e('0x2f')],function(_0x4fe72e){var _0x5f44e3={};_0x5f44e3[_0x4fe72e]={'$like':'%'+_0x4947db['query'][_0x121e('0x36')]+'%'};return _0x5f44e3;})});}_0x5081a5=_[_0x121e('0x38')]({},_0x5081a5,_0x4947db['options']);return _0x3e0e99[_0x121e('0x4c')](_0x5081a5);}})[_0x121e('0x24')](function(_0x287dc3){if(_0x287dc3){_0x44260c=_0x287dc3['length'];if(!_0x4947db[_0x121e('0x2c')][_0x121e('0x32')](_0x121e('0x33'))){_0x5081a5[_0x121e('0x1a')]=qs['limit'](_0x4947db[_0x121e('0x2c')][_0x121e('0x1a')]);_0x5081a5[_0x121e('0x18')]=qs[_0x121e('0x18')](_0x4947db['query'][_0x121e('0x18')]);}return _0x3e0e99[_0x121e('0x4c')](_0x5081a5);}})[_0x121e('0x24')](function(_0x220fdf){if(_0x220fdf){return _0x220fdf?{'count':_0x44260c,'rows':_0x220fdf}:null;}})['then'](respondWithResult(_0x3e820d,null))[_0x121e('0x3c')](handleError(_0x3e820d,null));}; \ No newline at end of file +var _0x6862=['../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','Companies','UserProfileResource','sendStatus','error','stack','name','send','CmCompany','describe','keys','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','merge','map','options','includeAll','catch','params','include','find','create','body','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','findOne','rawAttributes','where','getContacts','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x6862,0x13a));var _0x2686=function(_0x48f4ed,_0x2d10c5){_0x48f4ed=_0x48f4ed-0x0;var _0x766915=_0x6862[_0x48f4ed];return _0x766915;};'use strict';var emlformat=require(_0x2686('0x0'));var rimraf=require(_0x2686('0x1'));var zipdir=require(_0x2686('0x2'));var jsonpatch=require(_0x2686('0x3'));var rp=require(_0x2686('0x4'));var moment=require(_0x2686('0x5'));var BPromise=require(_0x2686('0x6'));var Mustache=require('mustache');var util=require(_0x2686('0x7'));var path=require('path');var sox=require(_0x2686('0x8'));var csv=require('to-csv');var ejs=require(_0x2686('0x9'));var fs=require('fs');var fs_extra=require(_0x2686('0xa'));var _=require(_0x2686('0xb'));var squel=require('squel');var crypto=require(_0x2686('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2686('0xd'));var toCsv=require(_0x2686('0xe'));var querystring=require(_0x2686('0xf'));var Papa=require(_0x2686('0x10'));var Redis=require('ioredis');var authService=require(_0x2686('0x11'));var qs=require(_0x2686('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2686('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x2686('0x14'));var config=require(_0x2686('0x15'));var licenseUtil=require(_0x2686('0x16'));var db=require(_0x2686('0x17'))['db'];function respondWithStatusCode(_0x972e46,_0x36f553){_0x36f553=_0x36f553||0xcc;return function(_0x11c0d7){if(_0x11c0d7){return _0x972e46['sendStatus'](_0x36f553);}return _0x972e46[_0x2686('0x18')](_0x36f553)[_0x2686('0x19')]();};}function respondWithResult(_0x1e5fb8,_0x358c77){_0x358c77=_0x358c77||0xc8;return function(_0x2690fe){if(_0x2690fe){return _0x1e5fb8['status'](_0x358c77)[_0x2686('0x1a')](_0x2690fe);}};}function respondWithFilteredResult(_0x42e11a,_0x3019eb){return function(_0x96fe0b){if(_0x96fe0b){var _0x5d74b6=typeof _0x3019eb[_0x2686('0x1b')]===_0x2686('0x1c')&&typeof _0x3019eb[_0x2686('0x1d')]===_0x2686('0x1c');var _0x4aeb62=_0x96fe0b[_0x2686('0x1e')];var _0x6e3f5e=_0x5d74b6?0x0:_0x3019eb[_0x2686('0x1b')];var _0x5c5e8b=_0x5d74b6?_0x96fe0b[_0x2686('0x1e')]:_0x3019eb[_0x2686('0x1b')]+_0x3019eb[_0x2686('0x1d')];var _0x1e653d;if(_0x5c5e8b>=_0x4aeb62){_0x5c5e8b=_0x4aeb62;_0x1e653d=0xc8;}else{_0x1e653d=0xce;}_0x42e11a[_0x2686('0x18')](_0x1e653d);return _0x42e11a[_0x2686('0x1f')](_0x2686('0x20'),_0x6e3f5e+'-'+_0x5c5e8b+'/'+_0x4aeb62)[_0x2686('0x1a')](_0x96fe0b);}return null;};}function patchUpdates(_0x395666){return function(_0x190b2a){try{jsonpatch[_0x2686('0x21')](_0x190b2a,_0x395666,!![]);}catch(_0x467db9){return BPromise['reject'](_0x467db9);}return _0x190b2a[_0x2686('0x22')]();};}function saveUpdates(_0x299a1f,_0x2cd18a){return function(_0x5a987d){if(_0x5a987d){return _0x5a987d[_0x2686('0x23')](_0x299a1f)[_0x2686('0x24')](function(_0x40ea2d){return _0x40ea2d;});}return null;};}function removeEntity(_0x28622e,_0x4af4fe){return function(_0x45570d){if(_0x45570d){return _0x45570d[_0x2686('0x25')]()[_0x2686('0x24')](function(){var _0x18aaef=_0x45570d[_0x2686('0x26')]({'plain':!![]});var _0x27c5ce=_0x2686('0x27');return db[_0x2686('0x28')][_0x2686('0x25')]({'where':{'type':_0x27c5ce,'resourceId':_0x18aaef['id']}})[_0x2686('0x24')](function(){return _0x45570d;});})[_0x2686('0x24')](function(){_0x28622e['status'](0xcc)[_0x2686('0x19')]();});}};}function handleEntityNotFound(_0x371ff3,_0x4abd0f){return function(_0x18a4fc){if(!_0x18a4fc){_0x371ff3[_0x2686('0x29')](0x194);}return _0x18a4fc;};}function handleError(_0x3c9db4,_0x181b61){_0x181b61=_0x181b61||0x1f4;return function(_0x41b664){logger[_0x2686('0x2a')](_0x41b664[_0x2686('0x2b')]);if(_0x41b664['name']){delete _0x41b664[_0x2686('0x2c')];}_0x3c9db4[_0x2686('0x18')](_0x181b61)[_0x2686('0x2d')](_0x41b664);};}exports['index']=function(_0x2e8cb4,_0x3b9334){var _0x132ee7={},_0x59e5cc={},_0x558c89={'count':0x0,'rows':[]};return db[_0x2686('0x2e')][_0x2686('0x2f')]()[_0x2686('0x24')](function(_0x5ce91e){_0x59e5cc['model']=_[_0x2686('0x30')](_0x5ce91e);_0x59e5cc[_0x2686('0x31')]=_[_0x2686('0x30')](_0x2e8cb4['query']);_0x59e5cc[_0x2686('0x32')]=_['intersection'](_0x59e5cc[_0x2686('0x33')],_0x59e5cc['query']);_0x132ee7[_0x2686('0x34')]=_[_0x2686('0x35')](_0x59e5cc['model'],qs['fields'](_0x2e8cb4['query'][_0x2686('0x36')]));_0x132ee7[_0x2686('0x34')]=_0x132ee7[_0x2686('0x34')][_0x2686('0x37')]?_0x132ee7[_0x2686('0x34')]:_0x59e5cc['model'];if(!_0x2e8cb4[_0x2686('0x31')]['hasOwnProperty'](_0x2686('0x38'))){_0x132ee7[_0x2686('0x1d')]=qs[_0x2686('0x1d')](_0x2e8cb4[_0x2686('0x31')][_0x2686('0x1d')]);_0x132ee7[_0x2686('0x1b')]=qs['offset'](_0x2e8cb4[_0x2686('0x31')][_0x2686('0x1b')]);}_0x132ee7[_0x2686('0x39')]=qs[_0x2686('0x3a')](_0x2e8cb4[_0x2686('0x31')][_0x2686('0x3a')]);_0x132ee7['where']=qs['filters'](_[_0x2686('0x3b')](_0x2e8cb4[_0x2686('0x31')],_0x59e5cc[_0x2686('0x32')]),_0x5ce91e);if(_0x2e8cb4[_0x2686('0x31')][_0x2686('0x3c')]){_0x132ee7['where']=_[_0x2686('0x3d')](_0x132ee7['where'],{'$or':_[_0x2686('0x3e')](_0x132ee7['attributes'],function(_0x1af4ae){var _0x355fa4={};_0x355fa4[_0x1af4ae]={'$like':'%'+_0x2e8cb4[_0x2686('0x31')]['filter']+'%'};return _0x355fa4;})});}_0x132ee7=_['merge']({},_0x132ee7,_0x2e8cb4[_0x2686('0x3f')]);var _0x2a605e={'where':_0x132ee7['where']};return db['CmCompany'][_0x2686('0x1e')](_0x2a605e)[_0x2686('0x24')](function(_0xfe8b8b){_0x558c89[_0x2686('0x1e')]=_0xfe8b8b;if(_0x2e8cb4['query'][_0x2686('0x40')]){_0x132ee7['include']=[{'all':!![]}];}return db[_0x2686('0x2e')]['findAll'](_0x132ee7);})[_0x2686('0x24')](function(_0xfd62cd){_0x558c89['rows']=_0xfd62cd;return _0x558c89;})['then'](respondWithFilteredResult(_0x3b9334,_0x132ee7))[_0x2686('0x41')](handleError(_0x3b9334,null));})['catch'](handleError(_0x3b9334,null));};exports['show']=function(_0x242b53,_0x349f83){var _0x570f8e={'raw':![],'where':{'id':_0x242b53[_0x2686('0x42')]['id']}},_0x4eae82={};_0x4eae82[_0x2686('0x33')]=_[_0x2686('0x30')](db[_0x2686('0x2e')]['rawAttributes']);_0x4eae82[_0x2686('0x31')]=_[_0x2686('0x30')](_0x242b53[_0x2686('0x31')]);_0x4eae82[_0x2686('0x32')]=_[_0x2686('0x35')](_0x4eae82[_0x2686('0x33')],_0x4eae82[_0x2686('0x31')]);_0x570f8e['attributes']=_[_0x2686('0x35')](_0x4eae82[_0x2686('0x33')],qs[_0x2686('0x36')](_0x242b53[_0x2686('0x31')]['fields']));_0x570f8e[_0x2686('0x34')]=_0x570f8e['attributes'][_0x2686('0x37')]?_0x570f8e[_0x2686('0x34')]:_0x4eae82[_0x2686('0x33')];if(_0x242b53[_0x2686('0x31')]['includeAll']){_0x570f8e[_0x2686('0x43')]=[{'all':!![]}];}_0x570f8e=_['merge']({},_0x570f8e,_0x242b53['options']);return db[_0x2686('0x2e')][_0x2686('0x44')](_0x570f8e)['then'](handleEntityNotFound(_0x349f83,null))[_0x2686('0x24')](respondWithResult(_0x349f83,null))[_0x2686('0x41')](handleError(_0x349f83,null));};exports['create']=function(_0x7439e9,_0x2c4fd1){return db[_0x2686('0x2e')][_0x2686('0x45')](_0x7439e9[_0x2686('0x46')],{})[_0x2686('0x24')](function(_0x59dca4){var _0x44dc04=_0x7439e9[_0x2686('0x47')][_0x2686('0x26')]({'plain':!![]});if(!_0x44dc04)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x44dc04['role']==='user'){var _0x140bbc=_0x59dca4[_0x2686('0x26')]({'plain':!![]});var _0x237fad=_0x2686('0x27');return db[_0x2686('0x48')][_0x2686('0x44')]({'where':{'name':_0x237fad,'userProfileId':_0x44dc04['userProfileId']},'raw':!![]})['then'](function(_0x2d1ab5){if(_0x2d1ab5&&_0x2d1ab5[_0x2686('0x49')]===0x0){return db[_0x2686('0x28')][_0x2686('0x45')]({'name':_0x140bbc[_0x2686('0x2c')],'resourceId':_0x140bbc['id'],'type':_0x2d1ab5[_0x2686('0x2c')],'sectionId':_0x2d1ab5['id']},{})[_0x2686('0x24')](function(){return _0x59dca4;});}else{return _0x59dca4;}})['catch'](function(_0x48df80){logger[_0x2686('0x2a')](_0x2686('0x4a'),_0x48df80);throw _0x48df80;});}return _0x59dca4;})[_0x2686('0x24')](respondWithResult(_0x2c4fd1,0xc9))['catch'](handleError(_0x2c4fd1,null));};exports[_0x2686('0x23')]=function(_0x2e49b9,_0x1efdf7){if(_0x2e49b9[_0x2686('0x46')]['id']){delete _0x2e49b9['body']['id'];}return db['CmCompany'][_0x2686('0x44')]({'where':{'id':_0x2e49b9['params']['id']}})[_0x2686('0x24')](handleEntityNotFound(_0x1efdf7,null))[_0x2686('0x24')](saveUpdates(_0x2e49b9[_0x2686('0x46')],null))[_0x2686('0x24')](respondWithResult(_0x1efdf7,null))[_0x2686('0x41')](handleError(_0x1efdf7,null));};exports['destroy']=function(_0x2b4cae,_0x1c38e3){return db[_0x2686('0x2e')][_0x2686('0x44')]({'where':{'id':_0x2b4cae[_0x2686('0x42')]['id']}})[_0x2686('0x24')](handleEntityNotFound(_0x1c38e3,null))[_0x2686('0x24')](removeEntity(_0x1c38e3,null))[_0x2686('0x41')](handleError(_0x1c38e3,null));};exports[_0x2686('0x2f')]=function(_0xdfd617,_0x5e522f){return db[_0x2686('0x2e')]['describe']()['then'](respondWithResult(_0x5e522f,null))['catch'](handleError(_0x5e522f,null));};exports[_0x2686('0x4b')]=function(_0xbf4b5,_0x15fd43,_0x48e907){return db[_0x2686('0x4c')][_0x2686('0x44')]({'where':{'id':_0xbf4b5[_0x2686('0x42')]['id']}})[_0x2686('0x24')](handleEntityNotFound(_0x15fd43,null))[_0x2686('0x24')](function(_0x4b9f5d){if(_0x4b9f5d){return _0x4b9f5d[_0x2686('0x4b')](_0xbf4b5[_0x2686('0x46')]['ids'],_['omit'](_0xbf4b5[_0x2686('0x46')],[_0x2686('0x4d'),'id'])||{});}})[_0x2686('0x24')](respondWithResult(_0x15fd43,null))[_0x2686('0x41')](handleError(_0x15fd43,null));};exports['getContacts']=function(_0x5e5de3,_0x1f340a,_0x174859){var _0x2d1891={};var _0x19355c={};var _0x59f283;var _0x379ffd;return db['CmCompany'][_0x2686('0x4e')]({'where':{'id':_0x5e5de3['params']['id']}})[_0x2686('0x24')](handleEntityNotFound(_0x1f340a,null))[_0x2686('0x24')](function(_0x5dea00){if(_0x5dea00){_0x59f283=_0x5dea00;_0x19355c[_0x2686('0x33')]=_[_0x2686('0x30')](db['CmContact'][_0x2686('0x4f')]);_0x19355c['query']=_['keys'](_0x5e5de3[_0x2686('0x31')]);_0x19355c['filters']=_[_0x2686('0x35')](_0x19355c['model'],_0x19355c[_0x2686('0x31')]);_0x2d1891[_0x2686('0x34')]=_['intersection'](_0x19355c['model'],qs[_0x2686('0x36')](_0x5e5de3[_0x2686('0x31')][_0x2686('0x36')]));_0x2d1891['attributes']=_0x2d1891[_0x2686('0x34')][_0x2686('0x37')]?_0x2d1891[_0x2686('0x34')]:_0x19355c[_0x2686('0x33')];_0x2d1891[_0x2686('0x39')]=qs[_0x2686('0x3a')](_0x5e5de3[_0x2686('0x31')][_0x2686('0x3a')]);_0x2d1891[_0x2686('0x50')]=qs['filters'](_[_0x2686('0x3b')](_0x5e5de3[_0x2686('0x31')],_0x19355c[_0x2686('0x32')]));if(_0x5e5de3['query'][_0x2686('0x3c')]){_0x2d1891[_0x2686('0x50')]=_['merge'](_0x2d1891[_0x2686('0x50')],{'$or':_[_0x2686('0x3e')](_0x2d1891['attributes'],function(_0x4f46e1){var _0x1b5b20={};_0x1b5b20[_0x4f46e1]={'$like':'%'+_0x5e5de3[_0x2686('0x31')][_0x2686('0x3c')]+'%'};return _0x1b5b20;})});}_0x2d1891=_['merge']({},_0x2d1891,_0x5e5de3[_0x2686('0x3f')]);return _0x59f283[_0x2686('0x51')](_0x2d1891);}})[_0x2686('0x24')](function(_0x1f694f){if(_0x1f694f){_0x379ffd=_0x1f694f[_0x2686('0x37')];if(!_0x5e5de3[_0x2686('0x31')][_0x2686('0x52')](_0x2686('0x38'))){_0x2d1891['limit']=qs[_0x2686('0x1d')](_0x5e5de3['query'][_0x2686('0x1d')]);_0x2d1891['offset']=qs['offset'](_0x5e5de3[_0x2686('0x31')]['offset']);}return _0x59f283[_0x2686('0x51')](_0x2d1891);}})['then'](function(_0xbdba89){if(_0xbdba89){return _0xbdba89?{'count':_0x379ffd,'rows':_0xbdba89}:null;}})[_0x2686('0x24')](respondWithResult(_0x1f340a,null))['catch'](handleError(_0x1f340a,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 5ad2c34..ecc8586 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 _0x221f=['exports','define','CmCompany','cm_companies','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./cmCompany.attributes'];(function(_0x1f8af6,_0x53d3d4){var _0x571552=function(_0x23b4cb){while(--_0x23b4cb){_0x1f8af6['push'](_0x1f8af6['shift']());}};_0x571552(++_0x53d3d4);}(_0x221f,0x6c));var _0xf221=function(_0xe7d07d,_0x52e4e3){_0xe7d07d=_0xe7d07d-0x0;var _0x229e46=_0x221f[_0xe7d07d];return _0x229e46;};'use strict';var _=require(_0xf221('0x0'));var util=require(_0xf221('0x1'));var logger=require(_0xf221('0x2'))(_0xf221('0x3'));var moment=require('moment');var BPromise=require(_0xf221('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf221('0x5'));var rimraf=require(_0xf221('0x6'));var config=require(_0xf221('0x7'));var attributes=require(_0xf221('0x8'));module[_0xf221('0x9')]=function(_0x3c1d27,_0x470e3e){return _0x3c1d27[_0xf221('0xa')](_0xf221('0xb'),attributes,{'tableName':_0xf221('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9dc1=['cm_companies','lodash','util','../../config/logger','request-promise','path','../../config/environment','./cmCompany.attributes','exports','define'];(function(_0x5d3feb,_0x17eeb9){var _0x59d181=function(_0x119238){while(--_0x119238){_0x5d3feb['push'](_0x5d3feb['shift']());}};_0x59d181(++_0x17eeb9);}(_0x9dc1,0xc9));var _0x19dc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9dc1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x19dc('0x0'));var util=require(_0x19dc('0x1'));var logger=require(_0x19dc('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x19dc('0x3'));var fs=require('fs');var path=require(_0x19dc('0x4'));var rimraf=require('rimraf');var config=require(_0x19dc('0x5'));var attributes=require(_0x19dc('0x6'));module[_0x19dc('0x7')]=function(_0x1af49b,_0x384ad5){return _0x1af49b[_0x19dc('0x8')]('CmCompany',attributes,{'tableName':_0x19dc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 8ac0c9f..8c16ae3 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 _0x0495=['info','CmCompany,\x20%s,\x20%s','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x5a27e8,_0x492a2f){var _0x4e38f7=function(_0x2a4048){while(--_0x2a4048){_0x5a27e8['push'](_0x5a27e8['shift']());}};_0x4e38f7(++_0x492a2f);}(_0x0495,0x16f));var _0x5049=function(_0x2180eb,_0x1f17dd){_0x2180eb=_0x2180eb-0x0;var _0x2dcbdd=_0x0495[_0x2180eb];return _0x2dcbdd;};'use strict';var _=require(_0x5049('0x0'));var util=require('util');var moment=require(_0x5049('0x1'));var BPromise=require(_0x5049('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5049('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5049('0x4'))(_0x5049('0x5'));var config=require(_0x5049('0x6'));var jayson=require(_0x5049('0x7'));var client=jayson[_0x5049('0x8')][_0x5049('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ad12e,_0x5ab252,_0x1978a5){return new BPromise(function(_0x218a57,_0x25aa9d){return client['request'](_0x4ad12e,_0x1978a5)[_0x5049('0xa')](function(_0x386207){logger[_0x5049('0xb')](_0x5049('0xc'),_0x5ab252,'request\x20sent');logger['debug'](_0x5049('0xd'),_0x5ab252,_0x5049('0xe'),JSON[_0x5049('0xf')](_0x386207));if(_0x386207[_0x5049('0x10')]){if(_0x386207[_0x5049('0x10')][_0x5049('0x11')]===0x1f4){logger[_0x5049('0x10')](_0x5049('0xc'),_0x5ab252,_0x386207[_0x5049('0x10')]['message']);return _0x25aa9d(_0x386207['error']['message']);}logger[_0x5049('0x10')](_0x5049('0xc'),_0x5ab252,_0x386207[_0x5049('0x10')][_0x5049('0x12')]);return _0x218a57(_0x386207['error'][_0x5049('0x12')]);}else{logger[_0x5049('0xb')]('CmCompany,\x20%s,\x20%s',_0x5ab252,'request\x20sent');_0x218a57(_0x386207[_0x5049('0x13')]['message']);}})[_0x5049('0x14')](function(_0x1c05aa){logger[_0x5049('0x10')]('CmCompany,\x20%s,\x20%s',_0x5ab252,_0x1c05aa);_0x25aa9d(_0x1c05aa);});});} \ No newline at end of file +var _0x5079=['catch','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5079,0x1ef));var _0x9507=function(_0x1fd5eb,_0x235203){_0x1fd5eb=_0x1fd5eb-0x0;var _0x102365=_0x5079[_0x1fd5eb];return _0x102365;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9507('0x0'));var BPromise=require('bluebird');var rs=require(_0x9507('0x1'));var fs=require('fs');var Redis=require(_0x9507('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x9507('0x3'));var logger=require(_0x9507('0x4'))('rpc');var config=require(_0x9507('0x5'));var jayson=require(_0x9507('0x6'));var client=jayson[_0x9507('0x7')][_0x9507('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x326745,_0x5bc32d,_0x1af99f){return new BPromise(function(_0x415c2c,_0x1fcebd){return client[_0x9507('0x9')](_0x326745,_0x1af99f)['then'](function(_0x30b7b9){logger[_0x9507('0xa')](_0x9507('0xb'),_0x5bc32d,_0x9507('0xc'));logger[_0x9507('0xd')](_0x9507('0xe'),_0x5bc32d,'request\x20sent',JSON['stringify'](_0x30b7b9));if(_0x30b7b9[_0x9507('0xf')]){if(_0x30b7b9[_0x9507('0xf')][_0x9507('0x10')]===0x1f4){logger[_0x9507('0xf')](_0x9507('0xb'),_0x5bc32d,_0x30b7b9['error'][_0x9507('0x11')]);return _0x1fcebd(_0x30b7b9[_0x9507('0xf')][_0x9507('0x11')]);}logger[_0x9507('0xf')](_0x9507('0xb'),_0x5bc32d,_0x30b7b9['error'][_0x9507('0x11')]);return _0x415c2c(_0x30b7b9[_0x9507('0xf')][_0x9507('0x11')]);}else{logger[_0x9507('0xa')](_0x9507('0xb'),_0x5bc32d,_0x9507('0xc'));_0x415c2c(_0x30b7b9['result'][_0x9507('0x11')]);}})[_0x9507('0x12')](function(_0x157f2e){logger[_0x9507('0xf')](_0x9507('0xb'),_0x5bc32d,_0x157f2e);_0x1fcebd(_0x157f2e);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 2440d77..aab4719 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 _0x311d=['get','isAuthenticated','index','/describe','describe','/:id','show','getContacts','post','create','addContacts','update','delete','destroy','exports','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCompany.controller'];(function(_0x521ec1,_0x21951d){var _0x22aba7=function(_0x43bafe){while(--_0x43bafe){_0x521ec1['push'](_0x521ec1['shift']());}};_0x22aba7(++_0x21951d);}(_0x311d,0x120));var _0xd311=function(_0x4dbb3c,_0x9767a9){_0x4dbb3c=_0x4dbb3c-0x0;var _0x4feeff=_0x311d[_0x4dbb3c];return _0x4feeff;};'use strict';var multer=require(_0xd311('0x0'));var util=require(_0xd311('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xd311('0x2'));var auth=require(_0xd311('0x3'));var interaction=require(_0xd311('0x4'));var config=require('../../config/environment');var controller=require(_0xd311('0x5'));router[_0xd311('0x6')]('/',auth[_0xd311('0x7')](),controller[_0xd311('0x8')]);router[_0xd311('0x6')](_0xd311('0x9'),auth[_0xd311('0x7')](),controller[_0xd311('0xa')]);router['get'](_0xd311('0xb'),auth[_0xd311('0x7')](),controller[_0xd311('0xc')]);router[_0xd311('0x6')]('/:id/contacts',auth[_0xd311('0x7')](),controller[_0xd311('0xd')]);router[_0xd311('0xe')]('/',auth[_0xd311('0x7')](),controller[_0xd311('0xf')]);router['post']('/:id/contacts',auth[_0xd311('0x7')](),controller[_0xd311('0x10')]);router['put'](_0xd311('0xb'),auth[_0xd311('0x7')](),controller[_0xd311('0x11')]);router[_0xd311('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xd311('0x13')]);module[_0xd311('0x14')]=router; \ No newline at end of file +var _0x6e0c=['/:id/contacts','getContacts','create','addContacts','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','/describe','/:id','show'];(function(_0x9eeac9,_0x1ee22d){var _0x357669=function(_0x1aa5fe){while(--_0x1aa5fe){_0x9eeac9['push'](_0x9eeac9['shift']());}};_0x357669(++_0x1ee22d);}(_0x6e0c,0x1a6));var _0xc6e0=function(_0x542e14,_0x5dfd4b){_0x542e14=_0x542e14-0x0;var _0xe3bbb=_0x6e0c[_0x542e14];return _0xe3bbb;};'use strict';var multer=require(_0xc6e0('0x0'));var util=require(_0xc6e0('0x1'));var path=require(_0xc6e0('0x2'));var timeout=require(_0xc6e0('0x3'));var express=require(_0xc6e0('0x4'));var router=express['Router']();var fs_extra=require(_0xc6e0('0x5'));var auth=require(_0xc6e0('0x6'));var interaction=require(_0xc6e0('0x7'));var config=require(_0xc6e0('0x8'));var controller=require(_0xc6e0('0x9'));router[_0xc6e0('0xa')]('/',auth[_0xc6e0('0xb')](),controller['index']);router['get'](_0xc6e0('0xc'),auth[_0xc6e0('0xb')](),controller['describe']);router[_0xc6e0('0xa')](_0xc6e0('0xd'),auth[_0xc6e0('0xb')](),controller[_0xc6e0('0xe')]);router[_0xc6e0('0xa')](_0xc6e0('0xf'),auth[_0xc6e0('0xb')](),controller[_0xc6e0('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc6e0('0x11')]);router['post'](_0xc6e0('0xf'),auth['isAuthenticated'](),controller[_0xc6e0('0x12')]);router[_0xc6e0('0x13')](_0xc6e0('0xd'),auth[_0xc6e0('0xb')](),controller[_0xc6e0('0x14')]);router[_0xc6e0('0x15')](_0xc6e0('0xd'),auth['isAuthenticated'](),controller[_0xc6e0('0x16')]);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 453d0a7..b62dc5f 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 _0x2438=['sequelize','exports','STRING','TEXT','INTEGER','lodash'];(function(_0x40d60f,_0x396a00){var _0xa52e4=function(_0x1f8bf5){while(--_0x1f8bf5){_0x40d60f['push'](_0x40d60f['shift']());}};_0xa52e4(++_0x396a00);}(_0x2438,0x1c7));var _0x8243=function(_0x65f140,_0x45cbc7){_0x65f140=_0x65f140-0x0;var _0x18fbda=_0x2438[_0x65f140];return _0x18fbda;};'use strict';var _=require(_0x8243('0x0'));var Sequelize=require(_0x8243('0x1'));module[_0x8243('0x2')]={'firstName':{'type':Sequelize[_0x8243('0x3')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x8243('0x3')]},'city':{'type':Sequelize[_0x8243('0x3')]},'country':{'type':Sequelize[_0x8243('0x3')]},'dateOfBirth':{'type':Sequelize[_0x8243('0x3')]},'description':{'type':Sequelize[_0x8243('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x8243('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x8243('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x8243('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x8243('0x3')]},'telegram':{'type':Sequelize[_0x8243('0x3')]},'UserId':{'type':Sequelize[_0x8243('0x5')]},'priority':{'type':Sequelize[_0x8243('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x103e=['STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize','exports'];(function(_0xdba5f4,_0x226baa){var _0x497bdf=function(_0x2ef7d9){while(--_0x2ef7d9){_0xdba5f4['push'](_0xdba5f4['shift']());}};_0x497bdf(++_0x226baa);}(_0x103e,0x1c8));var _0xe103=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x103e[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xe103('0x0'));var Sequelize=require(_0xe103('0x1'));module[_0xe103('0x2')]={'firstName':{'type':Sequelize[_0xe103('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xe103('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xe103('0x3')]},'country':{'type':Sequelize[_0xe103('0x3')]},'dateOfBirth':{'type':Sequelize[_0xe103('0x3')]},'description':{'type':Sequelize[_0xe103('0x4')]},'phone':{'type':Sequelize[_0xe103('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xe103('0x3')]},'email':{'type':Sequelize[_0xe103('0x3')]},'url':{'type':Sequelize[_0xe103('0x3')]},'facebook':{'type':Sequelize[_0xe103('0x3')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xe103('0x3')]},'line':{'type':Sequelize[_0xe103('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0xe103('0x3')]},'UserId':{'type':Sequelize[_0xe103('0x5')]},'priority':{'type':Sequelize[_0xe103('0x5')](0x2)[_0xe103('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xe103('0x7')],'defaultValue':Sequelize[_0xe103('0x8')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 32b9db1..851a47b 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 _0xa2ea=['ChatOfflineMessage','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','VoiceCallReport','FaxQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','bulkCreate','each','duplicates','$or','spread','show','Tag','omit','cf_%d','$and','format','table','id\x20=\x20?','toParam','values','phone','rawAttributes','pick','options','setTags','ContactId','includeAll','include','getHopperHistories','getHopperFinals','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','child_process','../../components/import/cm/csv','File\x20uploaded\x20correctly!','pid','createReadStream','parse','meta','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','mail','chat','sms','openchannel','fax','whatsapp','-createdAt','channel','includes','toLowerCase','range','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20createdAt\x20filter','voice','uniqueid','destination','note','createdAt','UserId','startCase','Website','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','Owner','fullname','browserName','customerIp','osName','ratingMessage','ratingType','subject','threadId','findAndCountAll','flatten','sortBy','reverse','slice','moment','bluebird','util','path','lodash','squel','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','redis','defaults','./cmContact.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','sendStatus','error','stack','name','send','index','CmContact','describe','then','keys','length','startsWith','push','CmCustomField','findOne','trimStart','cf_','all','fieldType','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','select','field','color','tools_tags','from','cm_contacts','left_join','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','sqlOperator','conditions','find','map','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','and','uc.UserId\x20=\x20?','value','dateOfBirth','datetime','castTo','DATE','buildExpression','type','text','filter','isNil','Contact','forEach','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','replace','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','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','SELECT','clone','order','DESC','isEmpty','having','user','role','some','User','getLists','c.ListId\x20IS\x20NULL','agent','sequelize','toString','merge','c.firstName','c.lastName','c.phone','c.fax','c.email','c.ListId','c.createdAt','c.deletedAt','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','params','columnName','displayName','findAll','alias','body','get','mergeWith','isArray','tags','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage'];(function(_0x228641,_0x25d636){var _0x5d5d78=function(_0x4d5c6c){while(--_0x4d5c6c){_0x228641['push'](_0x228641['shift']());}};_0x5d5d78(++_0x25d636);}(_0xa2ea,0x180));var _0xaa2e=function(_0xce2ee4,_0x3fe1e1){_0xce2ee4=_0xce2ee4-0x0;var _0x3fd000=_0xa2ea[_0xce2ee4];return _0x3fd000;};'use strict';var moment=require(_0xaa2e('0x0'));var BPromise=require(_0xaa2e('0x1'));var util=require(_0xaa2e('0x2'));var path=require(_0xaa2e('0x3'));var fs=require('fs');var _=require(_0xaa2e('0x4'));var squel=require(_0xaa2e('0x5'));var Papa=require('papaparse');var Redis=require(_0xaa2e('0x6'));var qs=require(_0xaa2e('0x7'));var as=require(_0xaa2e('0x8'));var logger=require(_0xaa2e('0x9'))(_0xaa2e('0xa'));var config=require('../../config/environment');var db=require(_0xaa2e('0xb'))['db'];config[_0xaa2e('0xc')]=_[_0xaa2e('0xd')](config[_0xaa2e('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaa2e('0xc')]));require(_0xaa2e('0xe'))[_0xaa2e('0xf')](socket);function respondWithResult(_0xb3c5ac,_0x3c7315){_0x3c7315=_0x3c7315||0xc8;return function(_0x34efdd){if(_0x34efdd){return _0xb3c5ac[_0xaa2e('0x10')](_0x3c7315)[_0xaa2e('0x11')](_0x34efdd);}};}function respondWithFilteredResult(_0x4e9c22,_0x48558b){return function(_0x17c059){if(_0x17c059){var _0x4d1870=typeof _0x48558b[_0xaa2e('0x12')]===_0xaa2e('0x13')&&typeof _0x48558b[_0xaa2e('0x14')]===_0xaa2e('0x13');var _0xe5e1b7=_0x17c059['count'];var _0x32b31d=_0x4d1870?0x0:_0x48558b[_0xaa2e('0x12')];var _0x460292=_0x4d1870?_0x17c059[_0xaa2e('0x15')]:_0x48558b[_0xaa2e('0x12')]+_0x48558b[_0xaa2e('0x14')];var _0x583601;if(_0x460292>=_0xe5e1b7){_0x460292=_0xe5e1b7;_0x583601=0xc8;}else{_0x583601=0xce;}_0x4e9c22[_0xaa2e('0x10')](_0x583601);return _0x4e9c22[_0xaa2e('0x16')](_0xaa2e('0x17'),_0x32b31d+'-'+_0x460292+'/'+_0xe5e1b7)[_0xaa2e('0x11')](_0x17c059);}return null;};}function saveUpdates(_0x4b81b3){return function(_0x8704ab){if(_0x8704ab){return _0x8704ab[_0xaa2e('0x18')](_0x4b81b3)['then'](function(_0x599905){return _0x599905;});}return null;};}function removeEntity(_0x58a09a){return function(_0x399b2f){if(_0x399b2f){return _0x399b2f[_0xaa2e('0x19')]()['then'](function(){_0x58a09a[_0xaa2e('0x10')](0xcc)[_0xaa2e('0x1a')]();});}};}function handleEntityNotFound(_0x585560){return function(_0x2e62c8){if(!_0x2e62c8){_0x585560[_0xaa2e('0x1b')](0x194);}return _0x2e62c8;};}function handleError(_0x3334dd,_0x271290){_0x271290=_0x271290||0x1f4;return function(_0x549427){logger[_0xaa2e('0x1c')](_0x549427[_0xaa2e('0x1d')]);if(_0x549427['name']){delete _0x549427[_0xaa2e('0x1e')];}_0x3334dd['status'](_0x271290)[_0xaa2e('0x1f')](_0x549427);};}exports[_0xaa2e('0x20')]=function(_0x23fe74,_0x3c6e07){var _0x154464={},_0x3b8f9e={},_0x16d1cb={'count':0x0,'rows':[]};return db[_0xaa2e('0x21')][_0xaa2e('0x22')]()[_0xaa2e('0x23')](function(_0x2b18ad){var _0x9d6228=[];for(var _0x494b1e=0x0;_0x494b1e0x1){_0x1958c3['or'](_0xaa2e('0x62'),qs['getFullTextValue'](_0xdf79eb),null);}else{if(qs[_0xaa2e('0x63')](_0xdf79eb)){_0x1958c3['or'](_0xaa2e('0x64'),_0xdf79eb+'%');_0x1958c3['or'](_0xaa2e('0x65'),_0xdf79eb+'%');_0x1958c3['or'](_0xaa2e('0x66'),_0xdf79eb+'%');_0x1958c3['or'](_0xaa2e('0x67'),_0xdf79eb+'%');}else if(qs[_0xaa2e('0x68')](_0xdf79eb)){_0x1958c3['or']('c.email\x20LIKE\x20?',_0xdf79eb+'%');}else{_0x1958c3['or'](_0xaa2e('0x69'),'%'+_0xdf79eb+'%');_0x1958c3['or'](_0xaa2e('0x6a'),'%'+_0xdf79eb+'%');_0x1958c3['or'](_0xaa2e('0x6b'),'%'+_0xdf79eb+'%');}}}}_0x2f64d0['where'](_0x1958c3);_0x2f64d0[_0xaa2e('0x6c')](_0xaa2e('0x6d'));var _0x485e18={'type':db[_0xaa2e('0x6e')][_0xaa2e('0x6f')][_0xaa2e('0x70')],'raw':!![]};var _0x261f4c=_0x2f64d0[_0xaa2e('0x71')]()[_0xaa2e('0x39')]('c.id');if(_0x154464[_0xaa2e('0x72')]){_0x154464['order'][_0xaa2e('0x59')](function(_0x51f957){_0x2f64d0[_0xaa2e('0x72')]('c.'+_0x51f957[0x0],_0x51f957[0x1]===_0xaa2e('0x73')?![]:!![]);});}if(!_[_0xaa2e('0x74')](_0x38f078)){_0x2f64d0[_0xaa2e('0x75')](_0x43427b);_0x261f4c[_0xaa2e('0x36')]('t.id\x20IN\x20?',_0x38f078);}BPromise['resolve']()[_0xaa2e('0x23')](function(){if(!_0x450dbb)return;if(_0x23fe74[_0xaa2e('0x76')][_0xaa2e('0x77')]!=='agent')return;if(!_[_0xaa2e('0x78')](_0x450dbb['conditions'],['field',_0xaa2e('0x79')])){return _0x23fe74[_0xaa2e('0x76')][_0xaa2e('0x7a')]({'attributes':['id'],'raw':!![]})[_0xaa2e('0x23')](function(_0x5f2eaa){if(_['isEmpty'](_0x5f2eaa)){_0x261f4c[_0xaa2e('0x36')](_0xaa2e('0x7b'));_0x2f64d0[_0xaa2e('0x36')](_0xaa2e('0x7b'));}else{_0x261f4c['where'](_0xaa2e('0x5b'),_[_0xaa2e('0x49')](_0x5f2eaa,'id'));_0x2f64d0[_0xaa2e('0x36')](_0xaa2e('0x5b'),_[_0xaa2e('0x49')](_0x5f2eaa,'id'));}});}})[_0xaa2e('0x23')](function(){if(_0x23fe74[_0xaa2e('0x76')]['role']===_0xaa2e('0x7c')&&!_0x450dbb&&!_0x23fe74[_0xaa2e('0x2f')][_0xaa2e('0x5a')])return[];return db[_0xaa2e('0x7d')][_0xaa2e('0x2f')](_0x261f4c[_0xaa2e('0x7e')](),_0x485e18);})[_0xaa2e('0x23')](function(_0x36d18a){_0x16d1cb[_0xaa2e('0x15')]=_0x36d18a[_0xaa2e('0x25')];if(_0x16d1cb[_0xaa2e('0x15')]===0x0)return[];return db[_0xaa2e('0x7d')]['query'](_0x393019[_0xaa2e('0x7e')](),_0x485e18)[_0xaa2e('0x23')](function(_0x5d19d7){_0x2f87db=_['keyBy'](_0x5d19d7,'id');_0x485e18=_[_0xaa2e('0x7f')](_0x485e18,{'model':db[_0xaa2e('0x21')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x23fe74[_0xaa2e('0x2f')][_0xaa2e('0x32')]){_0x154464[_0xaa2e('0x31')][_0xaa2e('0x59')](function(_0x41eda5){_0x2f64d0[_0xaa2e('0x39')]('c.'+_0x41eda5);});}else{_0x2f64d0[_0xaa2e('0x39')](_0xaa2e('0x6d'));_0x2f64d0[_0xaa2e('0x39')](_0xaa2e('0x80'));_0x2f64d0[_0xaa2e('0x39')](_0xaa2e('0x81'));_0x2f64d0[_0xaa2e('0x39')](_0xaa2e('0x82'));_0x2f64d0[_0xaa2e('0x39')]('c.mobile');_0x2f64d0[_0xaa2e('0x39')](_0xaa2e('0x83'));_0x2f64d0['field'](_0xaa2e('0x84'));_0x2f64d0[_0xaa2e('0x39')](_0xaa2e('0x85'));_0x2f64d0[_0xaa2e('0x39')](_0xaa2e('0x86'));_0x2f64d0['field'](_0xaa2e('0x87'));_0x2f64d0[_0xaa2e('0x39')]('c.CompanyId');_0x2f64d0[_0xaa2e('0x39')](_0xaa2e('0x88'),_0xaa2e('0x89'));}if(_0x154464[_0xaa2e('0x14')])_0x2f64d0[_0xaa2e('0x14')](_0x154464['limit']);if(_0x154464[_0xaa2e('0x12')])_0x2f64d0[_0xaa2e('0x12')](_0x154464[_0xaa2e('0x12')]);return db['sequelize'][_0xaa2e('0x2f')](_0x2f64d0[_0xaa2e('0x7e')](),_0x485e18);});})[_0xaa2e('0x23')](function(_0x32c32d){_0x32c32d[_0xaa2e('0x59')](function(_0x265e86){if(_0x265e86[_0xaa2e('0x89')]){_0x265e86[_0xaa2e('0x8a')]=[];_0x265e86[_0xaa2e('0x89')][_0xaa2e('0x61')](',')[_0xaa2e('0x59')](function(_0x276ec3){_0x265e86['Tags'][_0xaa2e('0x27')](_0x2f87db[_0x276ec3]);});}delete _0x265e86[_0xaa2e('0x89')];});_0x16d1cb[_0xaa2e('0x8b')]=_0x32c32d;return _0x16d1cb;})['then'](respondWithFilteredResult(_0x3c6e07,_0x154464));})[_0xaa2e('0x8c')](handleError(_0x3c6e07,null));};exports[_0xaa2e('0x19')]=function(_0x1ff225,_0x3ee0c0){return db[_0xaa2e('0x21')][_0xaa2e('0x48')]({'where':{'id':_0x1ff225[_0xaa2e('0x8d')]['id']}})[_0xaa2e('0x23')](handleEntityNotFound(_0x3ee0c0,null))[_0xaa2e('0x23')](removeEntity(_0x3ee0c0,null))[_0xaa2e('0x8c')](handleError(_0x3ee0c0,null));};exports['describe']=function(_0x578c73,_0x2747ce){return db[_0xaa2e('0x21')][_0xaa2e('0x22')]()[_0xaa2e('0x23')](function(_0x4da960){delete _0x4da960['tags'];for(var _0x185727=0x0;_0x185727=_0x507ad5){_0x28725d=_0x507ad5;_0x22dcce=0xc8;}else{_0x22dcce=0xce;}_0x5107b0['status'](_0x22dcce);return _0x5107b0['set'](_0x8a0b('0x15'),_0x2cfc5b+'-'+_0x28725d+'/'+_0x507ad5)[_0x8a0b('0x16')](_0x2c976c);}return null;};}function saveUpdates(_0x19cf84){return function(_0x1aa1a1){if(_0x1aa1a1){return _0x1aa1a1[_0x8a0b('0x17')](_0x19cf84)[_0x8a0b('0x18')](function(_0x12379b){return _0x12379b;});}return null;};}function removeEntity(_0x4f0ebb){return function(_0x34f958){if(_0x34f958){return _0x34f958[_0x8a0b('0x19')]()['then'](function(){_0x4f0ebb[_0x8a0b('0x11')](0xcc)[_0x8a0b('0x1a')]();});}};}function handleEntityNotFound(_0x40564d){return function(_0x11b14a){if(!_0x11b14a){_0x40564d[_0x8a0b('0x1b')](0x194);}return _0x11b14a;};}function handleError(_0x4a7d27,_0x5b4828){_0x5b4828=_0x5b4828||0x1f4;return function(_0x26cbf2){logger[_0x8a0b('0x1c')](_0x26cbf2[_0x8a0b('0x1d')]);if(_0x26cbf2[_0x8a0b('0x1e')]){delete _0x26cbf2['name'];}_0x4a7d27['status'](_0x5b4828)[_0x8a0b('0x1f')](_0x26cbf2);};}exports[_0x8a0b('0x20')]=function(_0x2476e3,_0xbe0852){var _0x3ea926={},_0x3388f1={},_0x33ad8e={'count':0x0,'rows':[]};return db['CmContact']['describe']()[_0x8a0b('0x18')](function(_0x1b1354){var _0xa233e9=[];for(var _0x28daa3=0x0;_0x28daa30x1){_0x537130['or'](_0x8a0b('0x60'),qs['getFullTextValue'](_0x59ca96),null);}else{if(qs['isNumeric'](_0x59ca96)){_0x537130['or'](_0x8a0b('0x61'),_0x59ca96+'%');_0x537130['or']('c.phone\x20LIKE\x20?',_0x59ca96+'%');_0x537130['or'](_0x8a0b('0x62'),_0x59ca96+'%');_0x537130['or']('c.fax\x20LIKE\x20?',_0x59ca96+'%');}else if(qs[_0x8a0b('0x63')](_0x59ca96)){_0x537130['or'](_0x8a0b('0x64'),_0x59ca96+'%');}else{_0x537130['or']('c.firstName\x20LIKE\x20?','%'+_0x59ca96+'%');_0x537130['or'](_0x8a0b('0x65'),'%'+_0x59ca96+'%');_0x537130['or']('c.email\x20LIKE\x20?','%'+_0x59ca96+'%');}}}}_0x4d17fa[_0x8a0b('0x32')](_0x537130);_0x4d17fa['group']('c.id');var _0x5250d3={'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]};var _0x58c75f=_0x4d17fa['clone']()[_0x8a0b('0x35')](_0x8a0b('0x66'));if(_0x3ea926['order']){_0x3ea926[_0x8a0b('0x30')][_0x8a0b('0x59')](function(_0x31269f){_0x4d17fa[_0x8a0b('0x30')]('c.'+_0x31269f[0x0],_0x31269f[0x1]===_0x8a0b('0x67')?![]:!![]);});}if(!_[_0x8a0b('0x58')](_0xcf56dc)){_0x4d17fa[_0x8a0b('0x68')](_0x29a380);_0x58c75f['where'](_0x8a0b('0x69'),_0xcf56dc);}BPromise[_0x8a0b('0x6a')]()[_0x8a0b('0x18')](function(){if(!_0x52013d)return;if(_0x2476e3[_0x8a0b('0x6b')][_0x8a0b('0x6c')]!=='agent')return;if(!_[_0x8a0b('0x6d')](_0x52013d[_0x8a0b('0x43')],['field',_0x8a0b('0x4a')])){return _0x2476e3['user'][_0x8a0b('0x6e')]({'attributes':['id'],'raw':!![]})[_0x8a0b('0x18')](function(_0x141b63){if(_[_0x8a0b('0x58')](_0x141b63)){_0x58c75f[_0x8a0b('0x32')]('c.ListId\x20IS\x20NULL');_0x4d17fa[_0x8a0b('0x32')](_0x8a0b('0x6f'));}else{_0x58c75f[_0x8a0b('0x32')](_0x8a0b('0x5b'),_[_0x8a0b('0x47')](_0x141b63,'id'));_0x4d17fa['where'](_0x8a0b('0x5b'),_[_0x8a0b('0x47')](_0x141b63,'id'));}});}})[_0x8a0b('0x18')](function(){if(_0x2476e3[_0x8a0b('0x6b')][_0x8a0b('0x6c')]===_0x8a0b('0x70')&&!_0x52013d&&!_0x2476e3[_0x8a0b('0x2a')][_0x8a0b('0x5a')])return[];return db['sequelize'][_0x8a0b('0x2a')](_0x58c75f['toString'](),_0x5250d3);})['then'](function(_0x30d5ed){_0x33ad8e[_0x8a0b('0x13')]=_0x30d5ed[_0x8a0b('0x22')];if(_0x33ad8e[_0x8a0b('0x13')]===0x0)return[];return db[_0x8a0b('0x71')][_0x8a0b('0x2a')](_0x781b8a[_0x8a0b('0x72')](),_0x5250d3)['then'](function(_0x506fb8){_0x313862=_['keyBy'](_0x506fb8,'id');_0x5250d3=_['merge'](_0x5250d3,{'model':db[_0x8a0b('0x73')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2476e3[_0x8a0b('0x2a')][_0x8a0b('0x2d')]){_0x3ea926[_0x8a0b('0x2e')][_0x8a0b('0x59')](function(_0x4818c6){_0x4d17fa['field']('c.'+_0x4818c6);});}else{_0x4d17fa[_0x8a0b('0x35')](_0x8a0b('0x66'));_0x4d17fa['field'](_0x8a0b('0x74'));_0x4d17fa['field'](_0x8a0b('0x75'));_0x4d17fa['field']('c.phone');_0x4d17fa[_0x8a0b('0x35')](_0x8a0b('0x76'));_0x4d17fa[_0x8a0b('0x35')](_0x8a0b('0x77'));_0x4d17fa['field'](_0x8a0b('0x78'));_0x4d17fa['field'](_0x8a0b('0x79'));_0x4d17fa['field'](_0x8a0b('0x7a'));_0x4d17fa[_0x8a0b('0x35')]('c.deletedAt');_0x4d17fa['field'](_0x8a0b('0x7b'));_0x4d17fa[_0x8a0b('0x35')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x8a0b('0x7c'));}if(_0x3ea926[_0x8a0b('0x12')])_0x4d17fa[_0x8a0b('0x12')](_0x3ea926['limit']);if(_0x3ea926[_0x8a0b('0x14')])_0x4d17fa['offset'](_0x3ea926[_0x8a0b('0x14')]);return db[_0x8a0b('0x71')][_0x8a0b('0x2a')](_0x4d17fa['toString'](),_0x5250d3);});})[_0x8a0b('0x18')](function(_0x50ea81){_0x50ea81[_0x8a0b('0x59')](function(_0x9f9cf0){if(_0x9f9cf0[_0x8a0b('0x7c')]){_0x9f9cf0[_0x8a0b('0x7d')]=[];_0x9f9cf0['TagIds'][_0x8a0b('0x5f')](',')[_0x8a0b('0x59')](function(_0x4ff506){_0x9f9cf0['Tags']['push'](_0x313862[_0x4ff506]);});}delete _0x9f9cf0[_0x8a0b('0x7c')];});_0x33ad8e['rows']=_0x50ea81;return _0x33ad8e;})['then'](respondWithFilteredResult(_0xbe0852,_0x3ea926));})[_0x8a0b('0x7e')](handleError(_0xbe0852,null));};exports[_0x8a0b('0x19')]=function(_0x28b86d,_0x4a8ffc){return db[_0x8a0b('0x73')][_0x8a0b('0x44')]({'where':{'id':_0x28b86d[_0x8a0b('0x7f')]['id']}})['then'](handleEntityNotFound(_0x4a8ffc,null))[_0x8a0b('0x18')](removeEntity(_0x4a8ffc,null))['catch'](handleError(_0x4a8ffc,null));};exports['describe']=function(_0x1931c1,_0x2f7bb4){return db[_0x8a0b('0x73')]['describe']()[_0x8a0b('0x18')](function(_0x483dd6){delete _0x483dd6[_0x8a0b('0x80')];for(var _0x5b8d3b=0x0;_0x5b8d3b{}\s\\|]/g,'-');_0x7f1e3a(null,util[_0xd552('0x23')](_0xd552('0x24'),path[_0xd552('0x25')](_0x28611c[_0xd552('0x21')],path[_0xd552('0x26')](_0x28611c['originalname'])),Date[_0xd552('0x27')](),path[_0xd552('0x26')](_0x28611c[_0xd552('0x21')])));}})});router[_0xd552('0x18')]('/csv',upload['single'](_0xd552('0x28')),controller[_0xd552('0x29')]);var upload=multer({'storage':multer[_0xd552('0x1d')]({'destination':function(_0x5874dc,_0x42effb,_0x470d75){_0x470d75(null,path['join'](config['root'],'server/files/tmp'));},'filename':function(_0x2f1d8d,_0x2fae59,_0x53840d){_0x2fae59[_0xd552('0x21')]=_0x2fae59['originalname'][_0xd552('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x53840d(null,util[_0xd552('0x23')](_0xd552('0x24'),path[_0xd552('0x25')](_0x2fae59[_0xd552('0x21')],path['extname'](_0x2fae59[_0xd552('0x21')])),Date[_0xd552('0x27')](),path[_0xd552('0x26')](_0x2fae59['originalname'])));}})});router[_0xd552('0x18')](_0xd552('0x2a'),upload[_0xd552('0x2b')]('file'),controller[_0xd552('0x2c')]);router[_0xd552('0x18')]('/upload/:id',auth[_0xd552('0x8')](),controller['import']);router['put'](_0xd552('0x2d'),auth[_0xd552('0x8')](),controller[_0xd552('0x2e')]);router[_0xd552('0x2f')](_0xd552('0x2d'),auth[_0xd552('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6b36=['%s-%s%s','basename','extname','now','single','uploadCsv','/upload','file','upload','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','./cmContact.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/tags','getTags','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','/merge','merge','post','create','bulkCreate','setTags','diskStorage','join','root','server/files/tmp','originalname','replace','format'];(function(_0x12ca16,_0x281fd9){var _0x56fb78=function(_0x3479b2){while(--_0x3479b2){_0x12ca16['push'](_0x12ca16['shift']());}};_0x56fb78(++_0x281fd9);}(_0x6b36,0x12d));var _0x66b3=function(_0x2842fd,_0x3363a0){_0x2842fd=_0x2842fd-0x0;var _0x202a6d=_0x6b36[_0x2842fd];return _0x202a6d;};'use strict';var multer=require(_0x66b3('0x0'));var util=require('util');var path=require(_0x66b3('0x1'));var timeout=require(_0x66b3('0x2'));var express=require(_0x66b3('0x3'));var router=express['Router']();var fs_extra=require(_0x66b3('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x66b3('0x5'));router[_0x66b3('0x6')]('/',auth[_0x66b3('0x7')](),controller[_0x66b3('0x8')]);router[_0x66b3('0x6')](_0x66b3('0x9'),auth[_0x66b3('0x7')](),controller['describe']);router['get'](_0x66b3('0xa'),auth[_0x66b3('0x7')](),controller[_0x66b3('0xb')]);router['get'](_0x66b3('0xc'),auth[_0x66b3('0x7')](),controller[_0x66b3('0xd')]);router['get'](_0x66b3('0xe'),auth[_0x66b3('0x7')](),controller['getHoppers']);router[_0x66b3('0x6')](_0x66b3('0xf'),auth['isAuthenticated'](),controller[_0x66b3('0x10')]);router['get'](_0x66b3('0x11'),auth[_0x66b3('0x7')](),controller[_0x66b3('0x12')]);router[_0x66b3('0x6')](_0x66b3('0x13'),auth[_0x66b3('0x7')](),controller[_0x66b3('0x14')]);router[_0x66b3('0x6')](_0x66b3('0x15'),auth[_0x66b3('0x7')](),controller['getJourney']);router['post'](_0x66b3('0x16'),auth['isAuthenticated'](),controller[_0x66b3('0x17')]);router[_0x66b3('0x18')]('/',auth[_0x66b3('0x7')](),controller[_0x66b3('0x19')]);router[_0x66b3('0x18')]('/create_many',auth[_0x66b3('0x7')](),controller[_0x66b3('0x1a')]);router[_0x66b3('0x18')](_0x66b3('0xc'),auth[_0x66b3('0x7')](),controller[_0x66b3('0x1b')]);var upload=multer({'storage':multer[_0x66b3('0x1c')]({'destination':function(_0x28d63a,_0x1b1c4f,_0x184c1e){_0x184c1e(null,path[_0x66b3('0x1d')](config[_0x66b3('0x1e')],_0x66b3('0x1f')));},'filename':function(_0x1b40f0,_0x52a403,_0xb86fca){_0x52a403[_0x66b3('0x20')]=_0x52a403[_0x66b3('0x20')][_0x66b3('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xb86fca(null,util[_0x66b3('0x22')](_0x66b3('0x23'),path[_0x66b3('0x24')](_0x52a403[_0x66b3('0x20')],path[_0x66b3('0x25')](_0x52a403[_0x66b3('0x20')])),Date[_0x66b3('0x26')](),path[_0x66b3('0x25')](_0x52a403[_0x66b3('0x20')])));}})});router['post']('/csv',upload[_0x66b3('0x27')]('file'),controller[_0x66b3('0x28')]);var upload=multer({'storage':multer[_0x66b3('0x1c')]({'destination':function(_0x251ce5,_0x375650,_0x265f57){_0x265f57(null,path[_0x66b3('0x1d')](config[_0x66b3('0x1e')],'server/files/tmp'));},'filename':function(_0x4b3e03,_0x4c610f,_0x3dba40){_0x4c610f[_0x66b3('0x20')]=_0x4c610f['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3dba40(null,util[_0x66b3('0x22')](_0x66b3('0x23'),path[_0x66b3('0x24')](_0x4c610f['originalname'],path[_0x66b3('0x25')](_0x4c610f[_0x66b3('0x20')])),Date[_0x66b3('0x26')](),path[_0x66b3('0x25')](_0x4c610f[_0x66b3('0x20')])));}})});router['post'](_0x66b3('0x29'),upload['single'](_0x66b3('0x2a')),controller[_0x66b3('0x2b')]);router[_0x66b3('0x18')]('/upload/:id',auth[_0x66b3('0x7')](),controller['import']);router['put'](_0x66b3('0xa'),auth['isAuthenticated'](),controller[_0x66b3('0x2c')]);router[_0x66b3('0x2d')](_0x66b3('0xa'),auth[_0x66b3('0x7')](),controller[_0x66b3('0x2e')]);module[_0x66b3('0x2f')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 064c2a9..bbf4665 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 _0x6cf0=['values','isArray','setDataValue','BOOLEAN','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','TEXT','type','select'];(function(_0x548607,_0x40b0fa){var _0x42f095=function(_0x199e32){while(--_0x199e32){_0x548607['push'](_0x548607['shift']());}};_0x42f095(++_0x40b0fa);}(_0x6cf0,0xe6));var _0x06cf=function(_0x1964f1,_0x5bb78e){_0x1964f1=_0x1964f1-0x0;var _0x57bd50=_0x6cf0[_0x1964f1];return _0x57bd50;};'use strict';var Sequelize=require(_0x06cf('0x0'));var _=require(_0x06cf('0x1'));module[_0x06cf('0x2')]={'name':{'type':Sequelize[_0x06cf('0x3')],'get':function(_0x21d49c){return this[_0x06cf('0x4')](_0x06cf('0x5'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x2213fe){this['setDataValue']('alias',_0x2213fe?_0x2213fe:this[_0x06cf('0x4')]('name'));}},'type':{'type':Sequelize[_0x06cf('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x06cf('0x7')]('long'),'get':function(){if(this[_0x06cf('0x4')](_0x06cf('0x8'))===_0x06cf('0x9')){return JSON['parse'](this['getDataValue'](_0x06cf('0xa')));}else{return this[_0x06cf('0x4')](_0x06cf('0xa'));}},'set':function(_0x4484f0){if(Array[_0x06cf('0xb')](_0x4484f0)){this['setDataValue']('values',JSON['stringify'](_0x4484f0));}else{this[_0x06cf('0xc')](_0x06cf('0xa'),_0x4484f0);}}},'required':{'type':Sequelize[_0x06cf('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x06cf('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x06cf('0xe'))}}; \ No newline at end of file +var _0x902b=['getDataValue','alias','STRING','setDataValue','name','TEXT','select','parse','values','isArray','stringify','BOOLEAN','voice','sequelize','lodash'];(function(_0x3c3218,_0x2d23f6){var _0x5682a7=function(_0x429183){while(--_0x429183){_0x3c3218['push'](_0x3c3218['shift']());}};_0x5682a7(++_0x2d23f6);}(_0x902b,0xee));var _0xb902=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x902b[_0x173441];return _0x2423a8;};'use strict';var Sequelize=require(_0xb902('0x0'));var _=require(_0xb902('0x1'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x4bae9f){return this[_0xb902('0x2')](_0xb902('0x3'));}},'alias':{'type':Sequelize[_0xb902('0x4')],'allowNull':![],'set':function(_0x535b32){this[_0xb902('0x5')](_0xb902('0x3'),_0x535b32?_0x535b32:this[_0xb902('0x2')](_0xb902('0x6')));}},'type':{'type':Sequelize[_0xb902('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0xb902('0x7')]('long'),'get':function(){if(this['getDataValue']('type')===_0xb902('0x8')){return JSON[_0xb902('0x9')](this[_0xb902('0x2')](_0xb902('0xa')));}else{return this[_0xb902('0x2')](_0xb902('0xa'));}},'set':function(_0x3091a4){if(Array[_0xb902('0xb')](_0x3091a4)){this[_0xb902('0x5')](_0xb902('0xa'),JSON[_0xb902('0xc')](_0x3091a4));}else{this['setDataValue'](_0xb902('0xa'),_0x3091a4);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xb902('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0xb902('0xe'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 1a65feb..c1c224e 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 _0xc307=['destroy','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','differenceBy','map','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','CmCustomField','includeAll','rows','show','params','include','options','catch','body','find','create','sequelize','transaction','Sequelize','TEXT','text','number','switch','BOOLEAN','defaultValue','addColumn','cf_%d','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','apply','update','then'];(function(_0xca9130,_0x2ba075){var _0x1f69e7=function(_0x333821){while(--_0x333821){_0xca9130['push'](_0xca9130['shift']());}};_0x1f69e7(++_0x2ba075);}(_0xc307,0x187));var _0x7c30=function(_0x464a79,_0x364eed){_0x464a79=_0x464a79-0x0;var _0x2919c8=_0xc307[_0x464a79];return _0x2919c8;};'use strict';var emlformat=require(_0x7c30('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7c30('0x1'));var jsonpatch=require(_0x7c30('0x2'));var rp=require(_0x7c30('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7c30('0x4'));var util=require('util');var path=require(_0x7c30('0x5'));var sox=require(_0x7c30('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7c30('0x7'));var _=require(_0x7c30('0x8'));var squel=require(_0x7c30('0x9'));var crypto=require(_0x7c30('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7c30('0xb'));var toCsv=require(_0x7c30('0xc'));var querystring=require(_0x7c30('0xd'));var Papa=require(_0x7c30('0xe'));var Redis=require('ioredis');var authService=require(_0x7c30('0xf'));var qs=require(_0x7c30('0x10'));var as=require(_0x7c30('0x11'));var hardwareService=require(_0x7c30('0x12'));var logger=require('../../config/logger')(_0x7c30('0x13'));var utils=require(_0x7c30('0x14'));var config=require(_0x7c30('0x15'));var licenseUtil=require(_0x7c30('0x16'));var db=require(_0x7c30('0x17'))['db'];function respondWithStatusCode(_0x386b27,_0x47e8cc){_0x47e8cc=_0x47e8cc||0xcc;return function(_0x2482e0){if(_0x2482e0){return _0x386b27[_0x7c30('0x18')](_0x47e8cc);}return _0x386b27[_0x7c30('0x19')](_0x47e8cc)['end']();};}function respondWithResult(_0x51e681,_0x1cb6f1){_0x1cb6f1=_0x1cb6f1||0xc8;return function(_0x590599){if(_0x590599){return _0x51e681[_0x7c30('0x19')](_0x1cb6f1)[_0x7c30('0x1a')](_0x590599);}};}function respondWithFilteredResult(_0x3c0c40,_0x1ed10d){return function(_0x20d8e6){if(_0x20d8e6){var _0x5e7037=typeof _0x1ed10d[_0x7c30('0x1b')]==='undefined'&&typeof _0x1ed10d[_0x7c30('0x1c')]===_0x7c30('0x1d');var _0x4e4d3a=_0x20d8e6[_0x7c30('0x1e')];var _0x28d860=_0x5e7037?0x0:_0x1ed10d[_0x7c30('0x1b')];var _0x1be897=_0x5e7037?_0x20d8e6[_0x7c30('0x1e')]:_0x1ed10d[_0x7c30('0x1b')]+_0x1ed10d['limit'];var _0x5a64d7;if(_0x1be897>=_0x4e4d3a){_0x1be897=_0x4e4d3a;_0x5a64d7=0xc8;}else{_0x5a64d7=0xce;}_0x3c0c40['status'](_0x5a64d7);return _0x3c0c40['set']('Content-Range',_0x28d860+'-'+_0x1be897+'/'+_0x4e4d3a)[_0x7c30('0x1a')](_0x20d8e6);}return null;};}function patchUpdates(_0x1532ac){return function(_0x30bf21){try{jsonpatch[_0x7c30('0x1f')](_0x30bf21,_0x1532ac,!![]);}catch(_0x43a8dc){return BPromise['reject'](_0x43a8dc);}return _0x30bf21['save']();};}function saveUpdates(_0x468431,_0x449f64){return function(_0x293f07){if(_0x293f07){return _0x293f07[_0x7c30('0x20')](_0x468431)[_0x7c30('0x21')](function(_0x44cf7b){return _0x44cf7b;});}return null;};}function removeEntity(_0x419abe,_0x2f9d9d){return function(_0x11c842){if(_0x11c842){return _0x11c842[_0x7c30('0x22')]()['then'](function(){_0x419abe['status'](0xcc)[_0x7c30('0x23')]();});}};}function handleEntityNotFound(_0x46e8fe,_0x2abbc1){return function(_0x115947){if(!_0x115947){_0x46e8fe[_0x7c30('0x18')](0x194);}return _0x115947;};}function handleError(_0xa68cc0,_0x4c26dc){_0x4c26dc=_0x4c26dc||0x1f4;return function(_0x2232f7){logger[_0x7c30('0x24')](_0x2232f7[_0x7c30('0x25')]);if(_0x2232f7[_0x7c30('0x26')]){delete _0x2232f7[_0x7c30('0x26')];}_0xa68cc0[_0x7c30('0x19')](_0x4c26dc)[_0x7c30('0x27')](_0x2232f7);};}exports[_0x7c30('0x28')]=function(_0x404058,_0x321c7a){var _0x5bdb8b={},_0x32cba5={},_0x27d0e0={'count':0x0,'rows':[]};var _0x371abb=_['map'](db['CmCustomField'][_0x7c30('0x29')],function(_0x318e90){return{'name':_0x318e90[_0x7c30('0x2a')],'type':_0x318e90[_0x7c30('0x2b')][_0x7c30('0x2c')]};});_0x32cba5['model']=_[_0x7c30('0x2d')](_[_0x7c30('0x2e')](_0x371abb,_0x7c30('0x26')),[_0x7c30('0x26')]);_0x32cba5[_0x7c30('0x2f')]=_[_0x7c30('0x30')](_0x404058['query']);_0x32cba5['filters']=_['intersection'](_0x32cba5[_0x7c30('0x31')],_0x32cba5[_0x7c30('0x2f')]);_0x5bdb8b['attributes']=_[_0x7c30('0x32')](_0x32cba5['model'],qs[_0x7c30('0x33')](_0x404058['query'][_0x7c30('0x33')]));_0x5bdb8b['attributes']=_0x5bdb8b[_0x7c30('0x34')][_0x7c30('0x35')]?_0x5bdb8b[_0x7c30('0x34')]:_0x32cba5[_0x7c30('0x31')];if(!_0x404058['query'][_0x7c30('0x36')](_0x7c30('0x37'))){_0x5bdb8b[_0x7c30('0x1c')]=qs[_0x7c30('0x1c')](_0x404058[_0x7c30('0x2f')][_0x7c30('0x1c')]);_0x5bdb8b[_0x7c30('0x1b')]=qs[_0x7c30('0x1b')](_0x404058[_0x7c30('0x2f')][_0x7c30('0x1b')]);}_0x5bdb8b[_0x7c30('0x38')]=qs[_0x7c30('0x39')](_0x404058[_0x7c30('0x2f')][_0x7c30('0x39')]);_0x5bdb8b[_0x7c30('0x3a')]=qs['filters'](_['pick'](_0x404058[_0x7c30('0x2f')],_0x32cba5[_0x7c30('0x3b')]),_0x371abb);if(_0x404058['query'][_0x7c30('0x3c')]){_0x5bdb8b[_0x7c30('0x3a')]=_[_0x7c30('0x3d')](_0x5bdb8b['where'],{'$or':_[_0x7c30('0x2e')](_0x371abb,function(_0x43b642){if(_0x43b642[_0x7c30('0x2b')]!==_0x7c30('0x3e')){var _0x36d29b={};_0x36d29b[_0x43b642[_0x7c30('0x26')]]={'$like':'%'+_0x404058['query'][_0x7c30('0x3c')]+'%'};return _0x36d29b;}})});}_0x5bdb8b=_[_0x7c30('0x3d')]({},_0x5bdb8b,_0x404058['options']);var _0x4d1627={'where':_0x5bdb8b[_0x7c30('0x3a')]};return db[_0x7c30('0x3f')][_0x7c30('0x1e')](_0x4d1627)[_0x7c30('0x21')](function(_0x34f9b8){_0x27d0e0['count']=_0x34f9b8;if(_0x404058[_0x7c30('0x2f')][_0x7c30('0x40')]){_0x5bdb8b['include']=[{'all':!![]}];}return db[_0x7c30('0x3f')]['findAll'](_0x5bdb8b);})['then'](function(_0x5b23e8){_0x27d0e0[_0x7c30('0x41')]=_0x5b23e8;return _0x27d0e0;})[_0x7c30('0x21')](respondWithFilteredResult(_0x321c7a,_0x5bdb8b))['catch'](handleError(_0x321c7a,null));};exports[_0x7c30('0x42')]=function(_0x55c5d9,_0x34bbc0){var _0x1df436={'raw':!![],'where':{'id':_0x55c5d9[_0x7c30('0x43')]['id']}},_0x48a89e={};_0x48a89e[_0x7c30('0x31')]=_[_0x7c30('0x30')](db[_0x7c30('0x3f')][_0x7c30('0x29')]);_0x48a89e['query']=_[_0x7c30('0x30')](_0x55c5d9['query']);_0x48a89e[_0x7c30('0x3b')]=_[_0x7c30('0x32')](_0x48a89e[_0x7c30('0x31')],_0x48a89e[_0x7c30('0x2f')]);_0x1df436['attributes']=_[_0x7c30('0x32')](_0x48a89e[_0x7c30('0x31')],qs[_0x7c30('0x33')](_0x55c5d9['query']['fields']));_0x1df436[_0x7c30('0x34')]=_0x1df436[_0x7c30('0x34')][_0x7c30('0x35')]?_0x1df436['attributes']:_0x48a89e[_0x7c30('0x31')];if(_0x55c5d9[_0x7c30('0x2f')][_0x7c30('0x40')]){_0x1df436[_0x7c30('0x44')]=[{'all':!![]}];}_0x1df436=_[_0x7c30('0x3d')]({},_0x1df436,_0x55c5d9[_0x7c30('0x45')]);return db[_0x7c30('0x3f')]['find'](_0x1df436)['then'](handleEntityNotFound(_0x34bbc0,null))[_0x7c30('0x21')](respondWithResult(_0x34bbc0,null))[_0x7c30('0x46')](handleError(_0x34bbc0,null));};exports[_0x7c30('0x20')]=function(_0x5013c6,_0x4af21a){if(_0x5013c6[_0x7c30('0x47')]['id']){delete _0x5013c6[_0x7c30('0x47')]['id'];}return db['CmCustomField'][_0x7c30('0x48')]({'where':{'id':_0x5013c6['params']['id']}})[_0x7c30('0x21')](handleEntityNotFound(_0x4af21a,null))['then'](saveUpdates(_0x5013c6[_0x7c30('0x47')],null))[_0x7c30('0x21')](respondWithResult(_0x4af21a,null))[_0x7c30('0x46')](handleError(_0x4af21a,null));};exports[_0x7c30('0x22')]=function(_0x3ff5bc,_0x56a6bf){return db[_0x7c30('0x3f')][_0x7c30('0x48')]({'where':{'id':_0x3ff5bc[_0x7c30('0x43')]['id']}})[_0x7c30('0x21')](handleEntityNotFound(_0x56a6bf,null))[_0x7c30('0x21')](removeEntity(_0x56a6bf,null))[_0x7c30('0x46')](handleError(_0x56a6bf,null));};exports[_0x7c30('0x49')]=function(_0xdae192,_0x3ad57e){var _0xca568c;return db[_0x7c30('0x4a')][_0x7c30('0x4b')](function(_0x2a26d3){return db[_0x7c30('0x3f')]['create'](_0xdae192['body'],{'transaction':_0x2a26d3})[_0x7c30('0x21')](function(_0x2d2e27){_0xca568c=_0x2d2e27;var _0x22e353={'type':db[_0x7c30('0x4c')][_0x7c30('0x4d')],'transaction':_0x2a26d3};switch(_0xdae192['body'][_0x7c30('0x2b')]){case _0x7c30('0x4e'):_0x22e353['type']=db[_0x7c30('0x4c')][_0x7c30('0x4d')];break;case _0x7c30('0x4f'):_0x22e353[_0x7c30('0x2b')]=db[_0x7c30('0x4c')]['INTEGER'];break;case _0x7c30('0x50'):_0x22e353[_0x7c30('0x2b')]=db[_0x7c30('0x4c')][_0x7c30('0x51')];_0x22e353[_0x7c30('0x52')]=![];break;default:}return db[_0x7c30('0x4a')]['queryInterface'][_0x7c30('0x53')]('cm_contacts',util['format'](_0x7c30('0x54'),_0xca568c['id']),_0x22e353);})[_0x7c30('0x21')](function(){return _0xca568c;});})[_0x7c30('0x21')](respondWithResult(_0x3ad57e,0xc9))['catch'](handleError(_0x3ad57e,null));}; \ No newline at end of file +var _0x3114=['api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','destroy','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','include','findAll','then','rows','catch','show','params','update','body','find','create','transaction','Sequelize','TEXT','number','INTEGER','switch','queryInterface','addColumn','cm_contacts','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x4b8be7,_0x4b565c){var _0x58ffee=function(_0x1c35a0){while(--_0x1c35a0){_0x4b8be7['push'](_0x4b8be7['shift']());}};_0x58ffee(++_0x4b565c);}(_0x3114,0x142));var _0x4311=function(_0x8eb9d,_0x320ee6){_0x8eb9d=_0x8eb9d-0x0;var _0x28c28=_0x3114[_0x8eb9d];return _0x28c28;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4311('0x0'));var zipdir=require(_0x4311('0x1'));var jsonpatch=require(_0x4311('0x2'));var rp=require(_0x4311('0x3'));var moment=require('moment');var BPromise=require(_0x4311('0x4'));var Mustache=require(_0x4311('0x5'));var util=require(_0x4311('0x6'));var path=require(_0x4311('0x7'));var sox=require(_0x4311('0x8'));var csv=require(_0x4311('0x9'));var ejs=require(_0x4311('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4311('0xb'));var crypto=require(_0x4311('0xc'));var jsforce=require(_0x4311('0xd'));var deskjs=require(_0x4311('0xe'));var toCsv=require(_0x4311('0x9'));var querystring=require(_0x4311('0xf'));var Papa=require(_0x4311('0x10'));var Redis=require(_0x4311('0x11'));var authService=require(_0x4311('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4311('0x13'));var hardwareService=require(_0x4311('0x14'));var logger=require(_0x4311('0x15'))(_0x4311('0x16'));var utils=require('../../config/utils');var config=require(_0x4311('0x17'));var licenseUtil=require(_0x4311('0x18'));var db=require(_0x4311('0x19'))['db'];function respondWithStatusCode(_0x375744,_0x4a45e7){_0x4a45e7=_0x4a45e7||0xcc;return function(_0x716684){if(_0x716684){return _0x375744['sendStatus'](_0x4a45e7);}return _0x375744[_0x4311('0x1a')](_0x4a45e7)[_0x4311('0x1b')]();};}function respondWithResult(_0x331f34,_0x39bc55){_0x39bc55=_0x39bc55||0xc8;return function(_0x961260){if(_0x961260){return _0x331f34[_0x4311('0x1a')](_0x39bc55)[_0x4311('0x1c')](_0x961260);}};}function respondWithFilteredResult(_0x2478bb,_0xd48f4a){return function(_0x66def8){if(_0x66def8){var _0x254723=typeof _0xd48f4a[_0x4311('0x1d')]===_0x4311('0x1e')&&typeof _0xd48f4a['limit']===_0x4311('0x1e');var _0x414787=_0x66def8[_0x4311('0x1f')];var _0x2204de=_0x254723?0x0:_0xd48f4a[_0x4311('0x1d')];var _0x3b24e9=_0x254723?_0x66def8[_0x4311('0x1f')]:_0xd48f4a[_0x4311('0x1d')]+_0xd48f4a[_0x4311('0x20')];var _0x25abeb;if(_0x3b24e9>=_0x414787){_0x3b24e9=_0x414787;_0x25abeb=0xc8;}else{_0x25abeb=0xce;}_0x2478bb['status'](_0x25abeb);return _0x2478bb[_0x4311('0x21')](_0x4311('0x22'),_0x2204de+'-'+_0x3b24e9+'/'+_0x414787)[_0x4311('0x1c')](_0x66def8);}return null;};}function patchUpdates(_0x5e311d){return function(_0x260a16){try{jsonpatch[_0x4311('0x23')](_0x260a16,_0x5e311d,!![]);}catch(_0x511783){return BPromise[_0x4311('0x24')](_0x511783);}return _0x260a16['save']();};}function saveUpdates(_0x4e7e6e,_0x143f84){return function(_0x425939){if(_0x425939){return _0x425939['update'](_0x4e7e6e)['then'](function(_0x373cf2){return _0x373cf2;});}return null;};}function removeEntity(_0x25d3d5,_0x455cf6){return function(_0x2beaf5){if(_0x2beaf5){return _0x2beaf5[_0x4311('0x25')]()['then'](function(){_0x25d3d5[_0x4311('0x1a')](0xcc)[_0x4311('0x1b')]();});}};}function handleEntityNotFound(_0x11d16f,_0x3559ee){return function(_0x51bb3c){if(!_0x51bb3c){_0x11d16f['sendStatus'](0x194);}return _0x51bb3c;};}function handleError(_0x2a8e0c,_0x848dbb){_0x848dbb=_0x848dbb||0x1f4;return function(_0x3eed22){logger[_0x4311('0x26')](_0x3eed22[_0x4311('0x27')]);if(_0x3eed22['name']){delete _0x3eed22[_0x4311('0x28')];}_0x2a8e0c[_0x4311('0x1a')](_0x848dbb)[_0x4311('0x29')](_0x3eed22);};}exports[_0x4311('0x2a')]=function(_0x2132f2,_0x248e22){var _0x14c6ec={},_0x4ff3cb={},_0x448598={'count':0x0,'rows':[]};var _0x2e20f8=_[_0x4311('0x2b')](db[_0x4311('0x2c')][_0x4311('0x2d')],function(_0x2837ff){return{'name':_0x2837ff[_0x4311('0x2e')],'type':_0x2837ff[_0x4311('0x2f')][_0x4311('0x30')]};});_0x4ff3cb[_0x4311('0x31')]=_[_0x4311('0x32')](_['map'](_0x2e20f8,'name'),[_0x4311('0x28')]);_0x4ff3cb[_0x4311('0x33')]=_[_0x4311('0x34')](_0x2132f2['query']);_0x4ff3cb[_0x4311('0x35')]=_['intersection'](_0x4ff3cb['model'],_0x4ff3cb['query']);_0x14c6ec['attributes']=_[_0x4311('0x36')](_0x4ff3cb[_0x4311('0x31')],qs['fields'](_0x2132f2[_0x4311('0x33')][_0x4311('0x37')]));_0x14c6ec[_0x4311('0x38')]=_0x14c6ec[_0x4311('0x38')][_0x4311('0x39')]?_0x14c6ec[_0x4311('0x38')]:_0x4ff3cb[_0x4311('0x31')];if(!_0x2132f2[_0x4311('0x33')][_0x4311('0x3a')](_0x4311('0x3b'))){_0x14c6ec[_0x4311('0x20')]=qs[_0x4311('0x20')](_0x2132f2['query']['limit']);_0x14c6ec[_0x4311('0x1d')]=qs['offset'](_0x2132f2[_0x4311('0x33')][_0x4311('0x1d')]);}_0x14c6ec['order']=qs['sort'](_0x2132f2[_0x4311('0x33')]['sort']);_0x14c6ec[_0x4311('0x3c')]=qs['filters'](_[_0x4311('0x3d')](_0x2132f2[_0x4311('0x33')],_0x4ff3cb[_0x4311('0x35')]),_0x2e20f8);if(_0x2132f2['query'][_0x4311('0x3e')]){_0x14c6ec[_0x4311('0x3c')]=_[_0x4311('0x3f')](_0x14c6ec[_0x4311('0x3c')],{'$or':_[_0x4311('0x2b')](_0x2e20f8,function(_0x54bcf5){if(_0x54bcf5[_0x4311('0x2f')]!==_0x4311('0x40')){var _0x6210ca={};_0x6210ca[_0x54bcf5[_0x4311('0x28')]]={'$like':'%'+_0x2132f2['query'][_0x4311('0x3e')]+'%'};return _0x6210ca;}})});}_0x14c6ec=_[_0x4311('0x3f')]({},_0x14c6ec,_0x2132f2[_0x4311('0x41')]);var _0x41279b={'where':_0x14c6ec[_0x4311('0x3c')]};return db['CmCustomField'][_0x4311('0x1f')](_0x41279b)['then'](function(_0x4a5d0e){_0x448598['count']=_0x4a5d0e;if(_0x2132f2['query']['includeAll']){_0x14c6ec[_0x4311('0x42')]=[{'all':!![]}];}return db['CmCustomField'][_0x4311('0x43')](_0x14c6ec);})[_0x4311('0x44')](function(_0xf482ef){_0x448598[_0x4311('0x45')]=_0xf482ef;return _0x448598;})['then'](respondWithFilteredResult(_0x248e22,_0x14c6ec))[_0x4311('0x46')](handleError(_0x248e22,null));};exports[_0x4311('0x47')]=function(_0xa58a09,_0x35b767){var _0x2ea44d={'raw':!![],'where':{'id':_0xa58a09[_0x4311('0x48')]['id']}},_0x1fe3c0={};_0x1fe3c0[_0x4311('0x31')]=_[_0x4311('0x34')](db[_0x4311('0x2c')][_0x4311('0x2d')]);_0x1fe3c0[_0x4311('0x33')]=_['keys'](_0xa58a09[_0x4311('0x33')]);_0x1fe3c0[_0x4311('0x35')]=_[_0x4311('0x36')](_0x1fe3c0[_0x4311('0x31')],_0x1fe3c0[_0x4311('0x33')]);_0x2ea44d['attributes']=_[_0x4311('0x36')](_0x1fe3c0[_0x4311('0x31')],qs[_0x4311('0x37')](_0xa58a09['query'][_0x4311('0x37')]));_0x2ea44d['attributes']=_0x2ea44d['attributes']['length']?_0x2ea44d[_0x4311('0x38')]:_0x1fe3c0[_0x4311('0x31')];if(_0xa58a09[_0x4311('0x33')]['includeAll']){_0x2ea44d[_0x4311('0x42')]=[{'all':!![]}];}_0x2ea44d=_['merge']({},_0x2ea44d,_0xa58a09[_0x4311('0x41')]);return db['CmCustomField']['find'](_0x2ea44d)[_0x4311('0x44')](handleEntityNotFound(_0x35b767,null))[_0x4311('0x44')](respondWithResult(_0x35b767,null))[_0x4311('0x46')](handleError(_0x35b767,null));};exports[_0x4311('0x49')]=function(_0x17e5e4,_0x5d3ca3){if(_0x17e5e4[_0x4311('0x4a')]['id']){delete _0x17e5e4[_0x4311('0x4a')]['id'];}return db[_0x4311('0x2c')][_0x4311('0x4b')]({'where':{'id':_0x17e5e4[_0x4311('0x48')]['id']}})[_0x4311('0x44')](handleEntityNotFound(_0x5d3ca3,null))[_0x4311('0x44')](saveUpdates(_0x17e5e4['body'],null))[_0x4311('0x44')](respondWithResult(_0x5d3ca3,null))['catch'](handleError(_0x5d3ca3,null));};exports[_0x4311('0x25')]=function(_0xf9302c,_0x2f75b9){return db[_0x4311('0x2c')][_0x4311('0x4b')]({'where':{'id':_0xf9302c[_0x4311('0x48')]['id']}})[_0x4311('0x44')](handleEntityNotFound(_0x2f75b9,null))[_0x4311('0x44')](removeEntity(_0x2f75b9,null))[_0x4311('0x46')](handleError(_0x2f75b9,null));};exports[_0x4311('0x4c')]=function(_0x425c00,_0x5cea0a){var _0x5b3b44;return db['sequelize'][_0x4311('0x4d')](function(_0xc2413b){return db[_0x4311('0x2c')]['create'](_0x425c00[_0x4311('0x4a')],{'transaction':_0xc2413b})[_0x4311('0x44')](function(_0x21ce4f){_0x5b3b44=_0x21ce4f;var _0x4cddbc={'type':db[_0x4311('0x4e')][_0x4311('0x4f')],'transaction':_0xc2413b};switch(_0x425c00[_0x4311('0x4a')][_0x4311('0x2f')]){case'text':_0x4cddbc[_0x4311('0x2f')]=db[_0x4311('0x4e')]['TEXT'];break;case _0x4311('0x50'):_0x4cddbc['type']=db[_0x4311('0x4e')][_0x4311('0x51')];break;case _0x4311('0x52'):_0x4cddbc[_0x4311('0x2f')]=db[_0x4311('0x4e')]['BOOLEAN'];_0x4cddbc['defaultValue']=![];break;default:}return db['sequelize'][_0x4311('0x53')][_0x4311('0x54')](_0x4311('0x55'),util['format']('cf_%d',_0x5b3b44['id']),_0x4cddbc);})[_0x4311('0x44')](function(){return _0x5b3b44;});})['then'](respondWithResult(_0x5cea0a,0xc9))[_0x4311('0x46')](handleError(_0x5cea0a,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index ade0ef7..1225694 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 _0x3e81=['../../config/logger','api','moment','request-promise','path','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','util'];(function(_0x225cfd,_0xb10c62){var _0x1ad768=function(_0x1b4f04){while(--_0x1b4f04){_0x225cfd['push'](_0x225cfd['shift']());}};_0x1ad768(++_0xb10c62);}(_0x3e81,0x107));var _0x13e8=function(_0x4fe3eb,_0x49d94e){_0x4fe3eb=_0x4fe3eb-0x0;var _0x27a8ff=_0x3e81[_0x4fe3eb];return _0x27a8ff;};'use strict';var _=require('lodash');var util=require(_0x13e8('0x0'));var logger=require(_0x13e8('0x1'))(_0x13e8('0x2'));var moment=require(_0x13e8('0x3'));var BPromise=require('bluebird');var rp=require(_0x13e8('0x4'));var fs=require('fs');var path=require(_0x13e8('0x5'));var rimraf=require('rimraf');var config=require(_0x13e8('0x6'));var attributes=require(_0x13e8('0x7'));module[_0x13e8('0x8')]=function(_0x566b37,_0x1a5023){return _0x566b37[_0x13e8('0x9')](_0x13e8('0xa'),attributes,{'tableName':_0x13e8('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e9c=['path','rimraf','exports','define','cm_custom_fields','lodash','api','moment','bluebird'];(function(_0x212efd,_0x494011){var _0x596365=function(_0x1aeb84){while(--_0x1aeb84){_0x212efd['push'](_0x212efd['shift']());}};_0x596365(++_0x494011);}(_0x7e9c,0x95));var _0xc7e9=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x7e9c[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0xc7e9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc7e9('0x1'));var moment=require(_0xc7e9('0x2'));var BPromise=require(_0xc7e9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc7e9('0x4'));var rimraf=require(_0xc7e9('0x5'));var config=require('../../config/environment');var attributes=require('./cmCustomField.attributes');module[_0xc7e9('0x6')]=function(_0x1cb744,_0x5a4779){return _0x1cb744[_0xc7e9('0x7')]('CmCustomField',attributes,{'tableName':_0xc7e9('0x8'),'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 f4f9056..76c71a6 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 _0x8c9a=['../../config/environment','jayson/promise','client','http','then','info','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','catch','moment','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x55e881,_0x1ecb11){var _0x3d71b1=function(_0x241d11){while(--_0x241d11){_0x55e881['push'](_0x55e881['shift']());}};_0x3d71b1(++_0x1ecb11);}(_0x8c9a,0x1e9));var _0xa8c9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8c9a[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa8c9('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa8c9('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xa8c9('0x2'));var logger=require(_0xa8c9('0x3'))(_0xa8c9('0x4'));var config=require(_0xa8c9('0x5'));var jayson=require(_0xa8c9('0x6'));var client=jayson[_0xa8c9('0x7')][_0xa8c9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1eb30e,_0x153cc6,_0x4ebf45){return new BPromise(function(_0x194499,_0x1945de){return client['request'](_0x1eb30e,_0x4ebf45)[_0xa8c9('0x9')](function(_0x265960){logger[_0xa8c9('0xa')]('CmCustomField,\x20%s,\x20%s',_0x153cc6,_0xa8c9('0xb'));logger['debug'](_0xa8c9('0xc'),_0x153cc6,_0xa8c9('0xb'),JSON[_0xa8c9('0xd')](_0x265960));if(_0x265960[_0xa8c9('0xe')]){if(_0x265960[_0xa8c9('0xe')][_0xa8c9('0xf')]===0x1f4){logger[_0xa8c9('0xe')](_0xa8c9('0x10'),_0x153cc6,_0x265960[_0xa8c9('0xe')][_0xa8c9('0x11')]);return _0x1945de(_0x265960['error'][_0xa8c9('0x11')]);}logger['error'](_0xa8c9('0x10'),_0x153cc6,_0x265960[_0xa8c9('0xe')][_0xa8c9('0x11')]);return _0x194499(_0x265960['error']['message']);}else{logger[_0xa8c9('0xa')](_0xa8c9('0x10'),_0x153cc6,_0xa8c9('0xb'));_0x194499(_0x265960['result'][_0xa8c9('0x11')]);}})[_0xa8c9('0x12')](function(_0x1ed7fe){logger['error'](_0xa8c9('0x10'),_0x153cc6,_0x1ed7fe);_0x1945de(_0x1ed7fe);});});} \ No newline at end of file +var _0x5ff0=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x3adec3,_0x32c463){var _0xc01b43=function(_0x52fa1f){while(--_0x52fa1f){_0x3adec3['push'](_0x3adec3['shift']());}};_0xc01b43(++_0x32c463);}(_0x5ff0,0x1f4));var _0x05ff=function(_0xd29b04,_0x72455c){_0xd29b04=_0xd29b04-0x0;var _0x3ae5bd=_0x5ff0[_0xd29b04];return _0x3ae5bd;};'use strict';var _=require(_0x05ff('0x0'));var util=require(_0x05ff('0x1'));var moment=require(_0x05ff('0x2'));var BPromise=require(_0x05ff('0x3'));var rs=require(_0x05ff('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05ff('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x05ff('0x6'))(_0x05ff('0x7'));var config=require(_0x05ff('0x8'));var jayson=require(_0x05ff('0x9'));var client=jayson['client'][_0x05ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24ee3f,_0x466928,_0x53d1f3){return new BPromise(function(_0x1763a0,_0x1d884b){return client[_0x05ff('0xb')](_0x24ee3f,_0x53d1f3)[_0x05ff('0xc')](function(_0x2026f9){logger[_0x05ff('0xd')](_0x05ff('0xe'),_0x466928,_0x05ff('0xf'));logger[_0x05ff('0x10')](_0x05ff('0x11'),_0x466928,'request\x20sent',JSON[_0x05ff('0x12')](_0x2026f9));if(_0x2026f9[_0x05ff('0x13')]){if(_0x2026f9['error']['code']===0x1f4){logger[_0x05ff('0x13')](_0x05ff('0xe'),_0x466928,_0x2026f9[_0x05ff('0x13')][_0x05ff('0x14')]);return _0x1d884b(_0x2026f9[_0x05ff('0x13')][_0x05ff('0x14')]);}logger[_0x05ff('0x13')](_0x05ff('0xe'),_0x466928,_0x2026f9[_0x05ff('0x13')][_0x05ff('0x14')]);return _0x1763a0(_0x2026f9[_0x05ff('0x13')]['message']);}else{logger[_0x05ff('0xd')](_0x05ff('0xe'),_0x466928,'request\x20sent');_0x1763a0(_0x2026f9[_0x05ff('0x15')][_0x05ff('0x14')]);}})[_0x05ff('0x16')](function(_0x1c937b){logger[_0x05ff('0x13')](_0x05ff('0xe'),_0x466928,_0x1c937b);_0x1d884b(_0x1c937b);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index e8d1611..75f3e65 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 _0x88c6=['../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra'];(function(_0x164af1,_0x3cf772){var _0x5d81a2=function(_0xa57547){while(--_0xa57547){_0x164af1['push'](_0x164af1['shift']());}};_0x5d81a2(++_0x3cf772);}(_0x88c6,0x163));var _0x688c=function(_0x55c307,_0x22b2ce){_0x55c307=_0x55c307-0x0;var _0xcca0a9=_0x88c6[_0x55c307];return _0xcca0a9;};'use strict';var multer=require(_0x688c('0x0'));var util=require(_0x688c('0x1'));var path=require(_0x688c('0x2'));var timeout=require(_0x688c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x688c('0x4'));var auth=require(_0x688c('0x5'));var interaction=require(_0x688c('0x6'));var config=require('../../config/environment');var controller=require(_0x688c('0x7'));router[_0x688c('0x8')]('/',auth[_0x688c('0x9')](),controller[_0x688c('0xa')]);router[_0x688c('0x8')](_0x688c('0xb'),auth['isAuthenticated'](),controller[_0x688c('0xc')]);router[_0x688c('0xd')]('/',auth[_0x688c('0x9')](),controller['create']);router[_0x688c('0xe')](_0x688c('0xb'),auth[_0x688c('0x9')](),controller['update']);router[_0x688c('0xf')](_0x688c('0xb'),auth['isAuthenticated'](),controller[_0x688c('0x10')]);module[_0x688c('0x11')]=router; \ No newline at end of file +var _0x5fed=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x5fed,0xed));var _0xd5fe=function(_0x12b683,_0x124186){_0x12b683=_0x12b683-0x0;var _0xfb150b=_0x5fed[_0x12b683];return _0xfb150b;};'use strict';var multer=require(_0xd5fe('0x0'));var util=require(_0xd5fe('0x1'));var path=require(_0xd5fe('0x2'));var timeout=require(_0xd5fe('0x3'));var express=require(_0xd5fe('0x4'));var router=express[_0xd5fe('0x5')]();var fs_extra=require(_0xd5fe('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd5fe('0x7'));var config=require(_0xd5fe('0x8'));var controller=require('./cmCustomField.controller');router[_0xd5fe('0x9')]('/',auth[_0xd5fe('0xa')](),controller[_0xd5fe('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xd5fe('0xc')]);router[_0xd5fe('0xd')]('/',auth['isAuthenticated'](),controller[_0xd5fe('0xe')]);router[_0xd5fe('0xf')](_0xd5fe('0x10'),auth['isAuthenticated'](),controller[_0xd5fe('0x11')]);router[_0xd5fe('0x12')](_0xd5fe('0x10'),auth[_0xd5fe('0xa')](),controller[_0xd5fe('0x13')]);module[_0xd5fe('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 98e5a2c..acc7efe 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 _0xa1ee=['BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','UNSIGNED','contactListQueue','sequelize','exports'];(function(_0x1e12d8,_0x1ca1a4){var _0x4bf10e=function(_0x1bd7c1){while(--_0x1bd7c1){_0x1e12d8['push'](_0x1e12d8['shift']());}};_0x4bf10e(++_0x1ca1a4);}(_0xa1ee,0xcd));var _0xea1e=function(_0x5a187b,_0x1f64fe){_0x5a187b=_0x5a187b-0x0;var _0x14d601=_0xa1ee[_0x5a187b];return _0x14d601;};'use strict';var moment=require('moment');var Sequelize=require(_0xea1e('0x0'));module[_0xea1e('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0xea1e('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xea1e('0x3')],'defaultValue':moment()['format'](_0xea1e('0x4'))},'countbusyretry':{'type':Sequelize[_0xea1e('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xea1e('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xea1e('0x6')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xea1e('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xea1e('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xea1e('0x5')],'unique':_0xea1e('0x8')},'ListId':{'type':Sequelize[_0xea1e('0x5')],'unique':_0xea1e('0x8')},'UserId':{'type':Sequelize[_0xea1e('0x5')]},'VoiceQueueId':{'type':Sequelize[_0xea1e('0x5')],'unique':_0xea1e('0x8')},'CampaignId':{'type':Sequelize[_0xea1e('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xea1e('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xea1e('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xea1e('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xea1e('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc207=['BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','STRING'];(function(_0xfc30db,_0x42fffd){var _0x419a8d=function(_0x505ea0){while(--_0x505ea0){_0xfc30db['push'](_0xfc30db['shift']());}};_0x419a8d(++_0x42fffd);}(_0xc207,0x1ad));var _0x7c20=function(_0x20be28,_0x24b925){_0x20be28=_0x20be28-0x0;var _0x8ab067=_0xc207[_0x20be28];return _0x8ab067;};'use strict';var moment=require(_0x7c20('0x0'));var Sequelize=require(_0x7c20('0x1'));module['exports']={'phone':{'type':Sequelize[_0x7c20('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x7c20('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x7c20('0x4')](_0x7c20('0x5'))},'countbusyretry':{'type':Sequelize[_0x7c20('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7c20('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7c20('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x7c20('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7c20('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x7c20('0x6')](0x2)[_0x7c20('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x7c20('0x6')],'unique':_0x7c20('0x8')},'ListId':{'type':Sequelize[_0x7c20('0x6')],'unique':_0x7c20('0x8')},'UserId':{'type':Sequelize[_0x7c20('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x7c20('0x6')],'unique':_0x7c20('0x8')},'CampaignId':{'type':Sequelize[_0x7c20('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x7c20('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7c20('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index ec8136f..a3e5e30 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 _0x3bc8=['sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','catch','create','body','update','describe','params','destroy','VoiceQueueId','CampaignId','VoiceQueue','find','omit','dataValues','createdAt','state','deleted','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','ivr','CmContact','ContactId','firstName','isNil','calleridname','lastName','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','format','value','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','UPDATE','Contact','CmCompany','dialActive','isNumber','getOpenContacts','entity\x20not\x20found','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','end','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','query','keys','filters','model','concat','$and','$or','$gt','$lt','$lte','$ne','$not','$between','$notIn','$notLike','$notILike','$overlap','$contains','$contained','$any','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x21a57e,_0x327c43){var _0x510922=function(_0x5b4063){while(--_0x5b4063){_0x21a57e['push'](_0x21a57e['shift']());}};_0x510922(++_0x327c43);}(_0x3bc8,0x1f3));var _0x83bc=function(_0x5d990e,_0x4ba9f5){_0x5d990e=_0x5d990e-0x0;var _0x36c763=_0x3bc8[_0x5d990e];return _0x36c763;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x83bc('0x0'));var zipdir=require(_0x83bc('0x1'));var jsonpatch=require(_0x83bc('0x2'));var rp=require('request-promise');var moment=require(_0x83bc('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x83bc('0x4'));var path=require(_0x83bc('0x5'));var sox=require(_0x83bc('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x83bc('0x7'));var _=require('lodash');var squel=require(_0x83bc('0x8'));var crypto=require('crypto');var jsforce=require(_0x83bc('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x83bc('0xa'));var Papa=require(_0x83bc('0xb'));var Redis=require('ioredis');var authService=require(_0x83bc('0xc'));var qs=require(_0x83bc('0xd'));var as=require(_0x83bc('0xe'));var hardwareService=require(_0x83bc('0xf'));var logger=require('../../config/logger')(_0x83bc('0x10'));var utils=require(_0x83bc('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x83bc('0x12'));var db=require(_0x83bc('0x13'))['db'];function respondWithStatusCode(_0x3064c7,_0x470e3b){_0x470e3b=_0x470e3b||0xcc;return function(_0x179165){if(_0x179165){return _0x3064c7[_0x83bc('0x14')](_0x470e3b);}return _0x3064c7[_0x83bc('0x15')](_0x470e3b)['end']();};}function respondWithResult(_0x3b3d20,_0xd0ccc7){_0xd0ccc7=_0xd0ccc7||0xc8;return function(_0x2477e3){if(_0x2477e3){return _0x3b3d20[_0x83bc('0x15')](_0xd0ccc7)[_0x83bc('0x16')](_0x2477e3);}};}function respondWithFilteredResult(_0x267183,_0x1a7260){return function(_0x272798){if(_0x272798){var _0x26bec5=typeof _0x1a7260['offset']===_0x83bc('0x17')&&typeof _0x1a7260[_0x83bc('0x18')]===_0x83bc('0x17');var _0xaf5c7e=_0x272798[_0x83bc('0x19')];var _0x1b9955=_0x26bec5?0x0:_0x1a7260[_0x83bc('0x1a')];var _0x3eb1c0=_0x26bec5?_0x272798[_0x83bc('0x19')]:_0x1a7260[_0x83bc('0x1a')]+_0x1a7260[_0x83bc('0x18')];var _0x274454;if(_0x3eb1c0>=_0xaf5c7e){_0x3eb1c0=_0xaf5c7e;_0x274454=0xc8;}else{_0x274454=0xce;}_0x267183['status'](_0x274454);return _0x267183[_0x83bc('0x1b')](_0x83bc('0x1c'),_0x1b9955+'-'+_0x3eb1c0+'/'+_0xaf5c7e)[_0x83bc('0x16')](_0x272798);}return null;};}function patchUpdates(_0x4b8813){return function(_0x2c187d){try{jsonpatch[_0x83bc('0x1d')](_0x2c187d,_0x4b8813,!![]);}catch(_0x327c36){return BPromise[_0x83bc('0x1e')](_0x327c36);}return _0x2c187d[_0x83bc('0x1f')]();};}function saveUpdates(_0x37a226,_0x4f3409){return function(_0x50c2fc){if(_0x50c2fc){return _0x50c2fc['update'](_0x37a226)[_0x83bc('0x20')](function(_0x14db2d){return _0x14db2d;});}return null;};}function removeEntity(_0x354f42,_0x3123a1){return function(_0x32b308){if(_0x32b308){return _0x32b308['destroy']()[_0x83bc('0x20')](function(){_0x354f42['status'](0xcc)[_0x83bc('0x21')]();});}};}function handleEntityNotFound(_0x564703,_0x19993b){return function(_0x59f635){if(!_0x59f635){_0x564703[_0x83bc('0x14')](0x194);}return _0x59f635;};}function handleError(_0x1fb7ec,_0xdb4ff2){_0xdb4ff2=_0xdb4ff2||0x1f4;return function(_0x4e6ce2){logger['error'](_0x4e6ce2['stack']);if(_0x4e6ce2[_0x83bc('0x22')]){delete _0x4e6ce2['name'];}_0x1fb7ec['status'](_0xdb4ff2)[_0x83bc('0x23')](_0x4e6ce2);};}exports[_0x83bc('0x24')]=function(_0x3962a6,_0x596b14){var _0x51825={},_0x40f740={},_0x2d0506={'count':0x0,'rows':[]};var _0x54b48e=_[_0x83bc('0x25')](db[_0x83bc('0x26')][_0x83bc('0x27')],function(_0x55b38a){return{'name':_0x55b38a[_0x83bc('0x28')],'type':_0x55b38a[_0x83bc('0x29')][_0x83bc('0x2a')]};});_0x40f740['model']=_[_0x83bc('0x25')](_0x54b48e,'name');_0x40f740[_0x83bc('0x2b')]=_[_0x83bc('0x2c')](_0x3962a6['query']);_0x40f740[_0x83bc('0x2d')]=_['intersection'](_0x40f740[_0x83bc('0x2e')],_0x40f740[_0x83bc('0x2b')]);_0x40f740[_0x83bc('0x2d')]=_[_0x83bc('0x2f')](_0x40f740[_0x83bc('0x2d')],[_0x83bc('0x30'),_0x83bc('0x31'),_0x83bc('0x32'),'$gte',_0x83bc('0x33'),_0x83bc('0x34'),_0x83bc('0x35'),'$eq',_0x83bc('0x36'),_0x83bc('0x37'),'$notBetween','$in',_0x83bc('0x38'),'$like',_0x83bc('0x39'),'$iLike',_0x83bc('0x3a'),'$like',_0x83bc('0x3b'),_0x83bc('0x3c'),_0x83bc('0x3d'),_0x83bc('0x3e')]);_0x51825[_0x83bc('0x3f')]=_[_0x83bc('0x40')](_0x40f740['model'],qs['fields'](_0x3962a6[_0x83bc('0x2b')][_0x83bc('0x41')]));_0x51825[_0x83bc('0x3f')]=_0x51825[_0x83bc('0x3f')][_0x83bc('0x42')]?_0x51825[_0x83bc('0x3f')]:_0x40f740[_0x83bc('0x2e')];if(!_0x3962a6[_0x83bc('0x2b')][_0x83bc('0x43')](_0x83bc('0x44'))){_0x51825[_0x83bc('0x18')]=qs['limit'](_0x3962a6[_0x83bc('0x2b')][_0x83bc('0x18')]);_0x51825[_0x83bc('0x1a')]=qs['offset'](_0x3962a6[_0x83bc('0x2b')][_0x83bc('0x1a')]);}_0x51825['order']=qs[_0x83bc('0x45')](_0x3962a6['query'][_0x83bc('0x45')]);_0x51825[_0x83bc('0x46')]=qs[_0x83bc('0x2d')](_[_0x83bc('0x47')](_0x3962a6['query'],_0x40f740[_0x83bc('0x2d')]),_0x54b48e);if(_0x3962a6[_0x83bc('0x2b')][_0x83bc('0x48')]){_0x51825[_0x83bc('0x46')]=_[_0x83bc('0x49')](_0x51825[_0x83bc('0x46')],{'$or':_[_0x83bc('0x25')](_0x54b48e,function(_0x3c1fb5){if(_0x3c1fb5[_0x83bc('0x29')]!==_0x83bc('0x4a')){var _0x496ad8={};_0x496ad8[_0x3c1fb5[_0x83bc('0x22')]]={'$like':'%'+_0x3962a6['query'][_0x83bc('0x48')]+'%'};return _0x496ad8;}})});}_0x51825=_[_0x83bc('0x49')]({},_0x51825,_0x3962a6[_0x83bc('0x4b')]);var _0x454d75={'where':_0x51825['where']};return db['CmHopper'][_0x83bc('0x19')](_0x454d75)[_0x83bc('0x20')](function(_0x3592e3){_0x2d0506[_0x83bc('0x19')]=_0x3592e3;if(_0x3962a6[_0x83bc('0x2b')][_0x83bc('0x4c')]){_0x51825[_0x83bc('0x4d')]=[{'all':!![]}];}return db[_0x83bc('0x26')][_0x83bc('0x4e')](_0x51825);})[_0x83bc('0x20')](function(_0x4abc69){_0x2d0506[_0x83bc('0x4f')]=_0x4abc69;return _0x2d0506;})[_0x83bc('0x20')](respondWithFilteredResult(_0x596b14,_0x51825))['catch'](handleError(_0x596b14,null));};exports[_0x83bc('0x50')]=function(_0x5ab223,_0x122995){var _0x5a0ce0={'raw':!![],'where':{'id':_0x5ab223['params']['id']}},_0x5d7e2e={};_0x5d7e2e[_0x83bc('0x2e')]=_['keys'](db[_0x83bc('0x26')][_0x83bc('0x27')]);_0x5d7e2e['query']=_[_0x83bc('0x2c')](_0x5ab223[_0x83bc('0x2b')]);_0x5d7e2e[_0x83bc('0x2d')]=_[_0x83bc('0x40')](_0x5d7e2e[_0x83bc('0x2e')],_0x5d7e2e['query']);_0x5a0ce0[_0x83bc('0x3f')]=_[_0x83bc('0x40')](_0x5d7e2e['model'],qs[_0x83bc('0x41')](_0x5ab223[_0x83bc('0x2b')][_0x83bc('0x41')]));_0x5a0ce0['attributes']=_0x5a0ce0[_0x83bc('0x3f')][_0x83bc('0x42')]?_0x5a0ce0[_0x83bc('0x3f')]:_0x5d7e2e[_0x83bc('0x2e')];if(_0x5ab223[_0x83bc('0x2b')][_0x83bc('0x4c')]){_0x5a0ce0[_0x83bc('0x4d')]=[{'all':!![]}];}_0x5a0ce0=_[_0x83bc('0x49')]({},_0x5a0ce0,_0x5ab223[_0x83bc('0x4b')]);return db['CmHopper']['find'](_0x5a0ce0)[_0x83bc('0x20')](handleEntityNotFound(_0x122995,null))[_0x83bc('0x20')](respondWithResult(_0x122995,null))[_0x83bc('0x51')](handleError(_0x122995,null));};exports['create']=function(_0x4d30d4,_0x50da51){return db[_0x83bc('0x26')][_0x83bc('0x52')](_0x4d30d4[_0x83bc('0x53')],{})[_0x83bc('0x20')](respondWithResult(_0x50da51,0xc9))['catch'](handleError(_0x50da51,null));};exports[_0x83bc('0x54')]=function(_0x398ee1,_0x2f744c){if(_0x398ee1[_0x83bc('0x53')]['id']){delete _0x398ee1['body']['id'];}return db[_0x83bc('0x26')]['find']({'where':{'id':_0x398ee1['params']['id']}})[_0x83bc('0x20')](handleEntityNotFound(_0x2f744c,null))[_0x83bc('0x20')](saveUpdates(_0x398ee1['body'],null))['then'](respondWithResult(_0x2f744c,null))['catch'](handleError(_0x2f744c,null));};exports[_0x83bc('0x55')]=function(_0x160855,_0x391cbe){return db[_0x83bc('0x26')]['describe']()[_0x83bc('0x20')](respondWithResult(_0x391cbe,null))[_0x83bc('0x51')](handleError(_0x391cbe,null));};exports['destroy']=function(_0x545751,_0x2dc9eb){var _0x3ea710;return db[_0x83bc('0x26')]['find']({'where':{'id':_0x545751[_0x83bc('0x56')]['id']}})[_0x83bc('0x20')](handleEntityNotFound(_0x2dc9eb,null))[_0x83bc('0x20')](function(_0x46391c){if(_0x46391c){return _0x46391c[_0x83bc('0x57')]()[_0x83bc('0x20')](function(_0x46e239){return _0x46e239;});}})['then'](function(_0x1c548a){_0x3ea710=_0x1c548a;if(_0x1c548a){if(_0x1c548a[_0x83bc('0x58')]||_0x1c548a[_0x83bc('0x59')]){return db[_0x1c548a['VoiceQueueId']?_0x83bc('0x5a'):'Campaign'][_0x83bc('0x5b')]({'where':{'id':_0x1c548a[_0x83bc('0x58')]?_0x1c548a[_0x83bc('0x58')]:_0x1c548a[_0x83bc('0x59')]},'attributes':['id','name'],'raw':!![]});}}})[_0x83bc('0x20')](function(_0x2607f3){var _0x406a16={};if(_0x2607f3){_[_0x83bc('0x49')](_0x406a16,_[_0x83bc('0x5c')](_0x3ea710[_0x83bc('0x5d')],[_0x83bc('0x5e'),'updatedAt','id']));_0x406a16[_0x83bc('0x5f')]=0x15;_0x406a16['statedesc']=_0x83bc('0x60');_0x406a16['campaign']=_0x2607f3[_0x83bc('0x22')];_0x406a16['membername']=_0x545751[_0x83bc('0x61')][_0x83bc('0x22')];_0x406a16[_0x83bc('0x62')]=_0x545751[_0x83bc('0x61')]['id'];_0x406a16[_0x83bc('0x60')]=!![];_0x406a16[_0x83bc('0x63')]=moment()['format'](_0x83bc('0x64'));_0x406a16[_0x83bc('0x65')]=_0x3ea710[_0x83bc('0x66')];_0x406a16['campaigntype']=_0x3ea710['VoiceQueueId']?_0x83bc('0x67'):_0x83bc('0x68');return db[_0x83bc('0x69')][_0x83bc('0x5b')]({'where':{'id':_0x406a16[_0x83bc('0x6a')]},'attributes':[_0x83bc('0x6b'),'lastName']})['then'](function(_0x81b4c0){if(!_['isNil'](_0x2dc9eb)&&!_[_0x83bc('0x6c')](_0x81b4c0[_0x83bc('0x6b')])){_0x406a16[_0x83bc('0x6d')]=_0x81b4c0[_0x83bc('0x6b')];if(!_['isNil'](_0x81b4c0[_0x83bc('0x6e')])){_0x406a16[_0x83bc('0x6d')]+='\x20'+_0x81b4c0['lastName'];}}})[_0x83bc('0x6f')](function(){return db[_0x83bc('0x70')][_0x83bc('0x52')](_0x406a16);});}})['then'](function(){return _0x2dc9eb[_0x83bc('0x15')](0xcc)[_0x83bc('0x21')]();})[_0x83bc('0x51')](handleError(_0x2dc9eb,null));};exports[_0x83bc('0x71')]=function(_0x472416,_0x49c3e4,_0x5ab950){var _0x193356=[];return db[_0x83bc('0x69')]['describe']()[_0x83bc('0x20')](function(_0x4c131c){_0x193356=_['keys'](_0x4c131c);return _0x472416[_0x83bc('0x61')][_0x83bc('0x72')]({'where':{'type':_0x83bc('0x73'),'dialActive':!![],'dialMethod':_0x83bc('0x74')},'attributes':['id',_0x83bc('0x75'),_0x83bc('0x76')],'raw':!![]});})['then'](function(_0x2de942){if(_0x2de942&&_0x2de942[_0x83bc('0x42')]){return db[_0x83bc('0x77')][_0x83bc('0x78')](function(_0x53e5d1){var _0x3c4349={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x83bc('0x79')](_0x83bc('0x64'))},'VoiceQueueId':{'$in':_[_0x83bc('0x25')](_0x2de942,'id')},'$or':[{'UserId':null},{'UserId':_0x472416[_0x83bc('0x61')]['id']}]};var _0x228cf7={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x2de942)[_0x83bc('0x48')]([_0x83bc('0x76'),0x0])[_0x83bc('0x25')]('id')[_0x83bc('0x7a')]()},'$or':[{'UserId':null},{'UserId':_0x472416[_0x83bc('0x61')]['id']}]};var _0x47f8ca={'$or':[_0x3c4349,_0x228cf7]};var _0x42f9b5=[];if(_0x472416[_0x83bc('0x53')]['direction']&&_0x472416['body'][_0x83bc('0x7b')]===_0x83bc('0x7c')){if(!_[_0x83bc('0x7d')](_0x472416['body'][_0x83bc('0x7e')])){_0x47f8ca['id']={'$in':_0x472416['body'][_0x83bc('0x7e')]};}_0x42f9b5=[[_0x83bc('0x7f'),_0x83bc('0x80')],['scheduledAt',_0x2de942[0x0][_0x83bc('0x75')]==='ASC'?_0x83bc('0x81'):_0x83bc('0x80')],db[_0x83bc('0x77')][_0x83bc('0x82')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id','DESC']];}else{if(!_['isEmpty'](_0x472416[_0x83bc('0x53')][_0x83bc('0x7e')])){_0x47f8ca['id']={'$notIn':_0x472416[_0x83bc('0x53')][_0x83bc('0x7e')]};}_0x42f9b5=[[_0x83bc('0x7f'),'DESC'],['scheduledAt',_0x2de942[0x0]['dialOrderByScheduledAt']],db[_0x83bc('0x77')][_0x83bc('0x82')](_0x83bc('0x83')),['id',_0x83bc('0x80')]];}return db['CmHopper'][_0x83bc('0x84')]({'attributes':['id',_0x83bc('0x85'),_0x83bc('0x86')],'where':_0x47f8ca,'order':_0x42f9b5,'transaction':_0x53e5d1,'lock':_0x53e5d1['LOCK'][_0x83bc('0x87')],'include':[{'model':db[_0x83bc('0x69')],'as':_0x83bc('0x88'),'attributes':_0x193356,'include':[{'model':db[_0x83bc('0x89')],'as':'Company','attributes':['id',_0x83bc('0x22')]}]},{'model':db['CmList'],'as':'List','attributes':['id',_0x83bc('0x22')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id','name',_0x83bc('0x8a')]}]})[_0x83bc('0x20')](function(_0x35ac26){if(_0x35ac26){return _0x35ac26[_0x83bc('0x54')]({'UserId':_0x472416['user']['id']},{'transaction':_0x53e5d1});}});});}})['then'](handleEntityNotFound(_0x49c3e4,null))[_0x83bc('0x20')](respondWithResult(_0x49c3e4,null))['catch'](handleError(_0x49c3e4,null));};exports['getOpenContacts']=function(_0x177e58,_0x1f261f,_0x35ab1f){return _0x177e58['user'][_0x83bc('0x72')]({'where':{'type':_0x83bc('0x73'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x83bc('0x20')](function(_0x1b6dcc){if(_0x1b6dcc&&_0x1b6dcc[_0x83bc('0x42')]){return db[_0x83bc('0x26')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x83bc('0x79')](_0x83bc('0x64'))},'VoiceQueueId':{'$in':_[_0x83bc('0x25')](_0x1b6dcc,'id')},'$or':[{'UserId':null},{'UserId':_0x177e58['user']['id']}]}});}return 0x0;})[_0x83bc('0x20')](function(_0x191b23){if(!_[_0x83bc('0x6c')](_0x191b23)&&_[_0x83bc('0x8b')](_0x191b23)){return _0x1f261f[_0x83bc('0x15')](0xc8)['json']({'contacts':_0x191b23});}else{logger['error']('CmHopper,\x20%s,\x20%s,\x20%s',_0x83bc('0x8c'),0x194,_0x83bc('0x8d'));_0x1f261f['sendStatus'](0x194);}})[_0x83bc('0x51')](handleError(_0x1f261f,null));}; \ No newline at end of file +var _0xe14d=['preview','dialPreviewAutoRecallMe','sequelize','format','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','priority','dialOrderByScheduledAt','scheduledat','recallme','LOCK','UPDATE','Contact','Company','CmList','VoiceQueue','Queue','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','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','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','model','query','filters','intersection','concat','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','options','include','findAll','rows','catch','keys','includeAll','find','create','body','describe','params','VoiceQueueId','Campaign','CampaignId','omit','dataValues','updatedAt','state','statedesc','campaign','membername','user','UserId','deleted','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','CmContact','getVoiceQueues'];(function(_0x12c7c7,_0x4e0831){var _0x28cfb4=function(_0x46f2f2){while(--_0x46f2f2){_0x12c7c7['push'](_0x12c7c7['shift']());}};_0x28cfb4(++_0x4e0831);}(_0xe14d,0x1ee));var _0xde14=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0xe14d[_0x288f5e];return _0x476cc9;};'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'];function respondWithStatusCode(_0x34e28f,_0x29e3ca){_0x29e3ca=_0x29e3ca||0xcc;return function(_0x105f96){if(_0x105f96){return _0x34e28f[_0xde14('0x1b')](_0x29e3ca);}return _0x34e28f[_0xde14('0x1c')](_0x29e3ca)[_0xde14('0x1d')]();};}function respondWithResult(_0x1489e9,_0x54c58b){_0x54c58b=_0x54c58b||0xc8;return function(_0x584959){if(_0x584959){return _0x1489e9[_0xde14('0x1c')](_0x54c58b)[_0xde14('0x1e')](_0x584959);}};}function respondWithFilteredResult(_0x26c1ec,_0x4c86ff){return function(_0x16aa55){if(_0x16aa55){var _0x31adb3=typeof _0x4c86ff[_0xde14('0x1f')]===_0xde14('0x20')&&typeof _0x4c86ff[_0xde14('0x21')]===_0xde14('0x20');var _0x29e243=_0x16aa55[_0xde14('0x22')];var _0x3cc317=_0x31adb3?0x0:_0x4c86ff[_0xde14('0x1f')];var _0x590a8b=_0x31adb3?_0x16aa55[_0xde14('0x22')]:_0x4c86ff[_0xde14('0x1f')]+_0x4c86ff[_0xde14('0x21')];var _0x44ce4c;if(_0x590a8b>=_0x29e243){_0x590a8b=_0x29e243;_0x44ce4c=0xc8;}else{_0x44ce4c=0xce;}_0x26c1ec['status'](_0x44ce4c);return _0x26c1ec[_0xde14('0x23')]('Content-Range',_0x3cc317+'-'+_0x590a8b+'/'+_0x29e243)[_0xde14('0x1e')](_0x16aa55);}return null;};}function patchUpdates(_0x4c24a8){return function(_0xa50687){try{jsonpatch[_0xde14('0x24')](_0xa50687,_0x4c24a8,!![]);}catch(_0x51ee8d){return BPromise[_0xde14('0x25')](_0x51ee8d);}return _0xa50687[_0xde14('0x26')]();};}function saveUpdates(_0x11a4d9,_0x40b648){return function(_0x2dd9e7){if(_0x2dd9e7){return _0x2dd9e7[_0xde14('0x27')](_0x11a4d9)[_0xde14('0x28')](function(_0x475f2f){return _0x475f2f;});}return null;};}function removeEntity(_0xbaa078,_0x8f8033){return function(_0x5ae4c1){if(_0x5ae4c1){return _0x5ae4c1[_0xde14('0x29')]()[_0xde14('0x28')](function(){_0xbaa078[_0xde14('0x1c')](0xcc)[_0xde14('0x1d')]();});}};}function handleEntityNotFound(_0x1bb7be,_0x21ef15){return function(_0x310d75){if(!_0x310d75){_0x1bb7be[_0xde14('0x1b')](0x194);}return _0x310d75;};}function handleError(_0x1618e1,_0x350a78){_0x350a78=_0x350a78||0x1f4;return function(_0x4eff65){logger[_0xde14('0x2a')](_0x4eff65[_0xde14('0x2b')]);if(_0x4eff65[_0xde14('0x2c')]){delete _0x4eff65[_0xde14('0x2c')];}_0x1618e1['status'](_0x350a78)[_0xde14('0x2d')](_0x4eff65);};}exports[_0xde14('0x2e')]=function(_0x30c4a8,_0x553cab){var _0x4655fb={},_0x582537={},_0x2760f9={'count':0x0,'rows':[]};var _0x361b2c=_[_0xde14('0x2f')](db[_0xde14('0x30')][_0xde14('0x31')],function(_0x237d3f){return{'name':_0x237d3f[_0xde14('0x32')],'type':_0x237d3f[_0xde14('0x33')]['key']};});_0x582537[_0xde14('0x34')]=_[_0xde14('0x2f')](_0x361b2c,'name');_0x582537[_0xde14('0x35')]=_['keys'](_0x30c4a8[_0xde14('0x35')]);_0x582537[_0xde14('0x36')]=_[_0xde14('0x37')](_0x582537[_0xde14('0x34')],_0x582537[_0xde14('0x35')]);_0x582537['filters']=_[_0xde14('0x38')](_0x582537[_0xde14('0x36')],['$and',_0xde14('0x39'),_0xde14('0x3a'),_0xde14('0x3b'),_0xde14('0x3c'),_0xde14('0x3d'),_0xde14('0x3e'),_0xde14('0x3f'),_0xde14('0x40'),_0xde14('0x41'),'$notBetween','$in',_0xde14('0x42'),_0xde14('0x43'),_0xde14('0x44'),_0xde14('0x45'),_0xde14('0x46'),_0xde14('0x43'),_0xde14('0x47'),_0xde14('0x48'),_0xde14('0x49'),'$any']);_0x4655fb[_0xde14('0x4a')]=_['intersection'](_0x582537['model'],qs['fields'](_0x30c4a8[_0xde14('0x35')][_0xde14('0x4b')]));_0x4655fb[_0xde14('0x4a')]=_0x4655fb[_0xde14('0x4a')][_0xde14('0x4c')]?_0x4655fb[_0xde14('0x4a')]:_0x582537[_0xde14('0x34')];if(!_0x30c4a8[_0xde14('0x35')]['hasOwnProperty'](_0xde14('0x4d'))){_0x4655fb[_0xde14('0x21')]=qs[_0xde14('0x21')](_0x30c4a8[_0xde14('0x35')][_0xde14('0x21')]);_0x4655fb[_0xde14('0x1f')]=qs[_0xde14('0x1f')](_0x30c4a8[_0xde14('0x35')]['offset']);}_0x4655fb[_0xde14('0x4e')]=qs[_0xde14('0x4f')](_0x30c4a8[_0xde14('0x35')][_0xde14('0x4f')]);_0x4655fb['where']=qs['filters'](_[_0xde14('0x50')](_0x30c4a8[_0xde14('0x35')],_0x582537[_0xde14('0x36')]),_0x361b2c);if(_0x30c4a8[_0xde14('0x35')][_0xde14('0x51')]){_0x4655fb['where']=_[_0xde14('0x52')](_0x4655fb[_0xde14('0x53')],{'$or':_[_0xde14('0x2f')](_0x361b2c,function(_0x595fd5){if(_0x595fd5[_0xde14('0x33')]!=='VIRTUAL'){var _0x46ac22={};_0x46ac22[_0x595fd5['name']]={'$like':'%'+_0x30c4a8[_0xde14('0x35')][_0xde14('0x51')]+'%'};return _0x46ac22;}})});}_0x4655fb=_[_0xde14('0x52')]({},_0x4655fb,_0x30c4a8[_0xde14('0x54')]);var _0x44bf69={'where':_0x4655fb[_0xde14('0x53')]};return db[_0xde14('0x30')][_0xde14('0x22')](_0x44bf69)['then'](function(_0x46067d){_0x2760f9['count']=_0x46067d;if(_0x30c4a8[_0xde14('0x35')]['includeAll']){_0x4655fb[_0xde14('0x55')]=[{'all':!![]}];}return db[_0xde14('0x30')][_0xde14('0x56')](_0x4655fb);})[_0xde14('0x28')](function(_0x40e7ae){_0x2760f9[_0xde14('0x57')]=_0x40e7ae;return _0x2760f9;})[_0xde14('0x28')](respondWithFilteredResult(_0x553cab,_0x4655fb))[_0xde14('0x58')](handleError(_0x553cab,null));};exports['show']=function(_0x15859c,_0xe3669c){var _0x220ca7={'raw':!![],'where':{'id':_0x15859c['params']['id']}},_0x4b1ef7={};_0x4b1ef7[_0xde14('0x34')]=_[_0xde14('0x59')](db[_0xde14('0x30')][_0xde14('0x31')]);_0x4b1ef7[_0xde14('0x35')]=_[_0xde14('0x59')](_0x15859c['query']);_0x4b1ef7[_0xde14('0x36')]=_['intersection'](_0x4b1ef7[_0xde14('0x34')],_0x4b1ef7[_0xde14('0x35')]);_0x220ca7['attributes']=_[_0xde14('0x37')](_0x4b1ef7[_0xde14('0x34')],qs[_0xde14('0x4b')](_0x15859c[_0xde14('0x35')][_0xde14('0x4b')]));_0x220ca7[_0xde14('0x4a')]=_0x220ca7[_0xde14('0x4a')]['length']?_0x220ca7[_0xde14('0x4a')]:_0x4b1ef7['model'];if(_0x15859c[_0xde14('0x35')][_0xde14('0x5a')]){_0x220ca7[_0xde14('0x55')]=[{'all':!![]}];}_0x220ca7=_[_0xde14('0x52')]({},_0x220ca7,_0x15859c[_0xde14('0x54')]);return db[_0xde14('0x30')][_0xde14('0x5b')](_0x220ca7)[_0xde14('0x28')](handleEntityNotFound(_0xe3669c,null))[_0xde14('0x28')](respondWithResult(_0xe3669c,null))[_0xde14('0x58')](handleError(_0xe3669c,null));};exports['create']=function(_0xd37eb6,_0x1688c6){return db[_0xde14('0x30')][_0xde14('0x5c')](_0xd37eb6[_0xde14('0x5d')],{})['then'](respondWithResult(_0x1688c6,0xc9))[_0xde14('0x58')](handleError(_0x1688c6,null));};exports['update']=function(_0x2297af,_0x31e7a6){if(_0x2297af[_0xde14('0x5d')]['id']){delete _0x2297af[_0xde14('0x5d')]['id'];}return db[_0xde14('0x30')]['find']({'where':{'id':_0x2297af['params']['id']}})[_0xde14('0x28')](handleEntityNotFound(_0x31e7a6,null))['then'](saveUpdates(_0x2297af[_0xde14('0x5d')],null))[_0xde14('0x28')](respondWithResult(_0x31e7a6,null))[_0xde14('0x58')](handleError(_0x31e7a6,null));};exports[_0xde14('0x5e')]=function(_0x345d08,_0x1ed775){return db[_0xde14('0x30')][_0xde14('0x5e')]()[_0xde14('0x28')](respondWithResult(_0x1ed775,null))['catch'](handleError(_0x1ed775,null));};exports[_0xde14('0x29')]=function(_0x2c972b,_0x1ea6d2){var _0x21d226;return db[_0xde14('0x30')]['find']({'where':{'id':_0x2c972b[_0xde14('0x5f')]['id']}})['then'](handleEntityNotFound(_0x1ea6d2,null))[_0xde14('0x28')](function(_0x27fb42){if(_0x27fb42){return _0x27fb42[_0xde14('0x29')]()[_0xde14('0x28')](function(_0x32d48f){return _0x32d48f;});}})[_0xde14('0x28')](function(_0x27ab1a){_0x21d226=_0x27ab1a;if(_0x27ab1a){if(_0x27ab1a[_0xde14('0x60')]||_0x27ab1a['CampaignId']){return db[_0x27ab1a['VoiceQueueId']?'VoiceQueue':_0xde14('0x61')]['find']({'where':{'id':_0x27ab1a['VoiceQueueId']?_0x27ab1a[_0xde14('0x60')]:_0x27ab1a[_0xde14('0x62')]},'attributes':['id',_0xde14('0x2c')],'raw':!![]});}}})[_0xde14('0x28')](function(_0x1de7ef){var _0x70b4f1={};if(_0x1de7ef){_[_0xde14('0x52')](_0x70b4f1,_[_0xde14('0x63')](_0x21d226[_0xde14('0x64')],['createdAt',_0xde14('0x65'),'id']));_0x70b4f1[_0xde14('0x66')]=0x15;_0x70b4f1[_0xde14('0x67')]='deleted';_0x70b4f1[_0xde14('0x68')]=_0x1de7ef['name'];_0x70b4f1[_0xde14('0x69')]=_0x2c972b[_0xde14('0x6a')][_0xde14('0x2c')];_0x70b4f1[_0xde14('0x6b')]=_0x2c972b[_0xde14('0x6a')]['id'];_0x70b4f1[_0xde14('0x6c')]=!![];_0x70b4f1[_0xde14('0x6d')]=moment()['format'](_0xde14('0x6e'));_0x70b4f1[_0xde14('0x6f')]=_0x21d226[_0xde14('0x70')];_0x70b4f1[_0xde14('0x71')]=_0x21d226[_0xde14('0x60')]?_0xde14('0x72'):_0xde14('0x73');return db['CmContact']['find']({'where':{'id':_0x70b4f1[_0xde14('0x74')]},'attributes':[_0xde14('0x75'),_0xde14('0x76')]})['then'](function(_0x100111){if(!_[_0xde14('0x77')](_0x1ea6d2)&&!_[_0xde14('0x77')](_0x100111[_0xde14('0x75')])){_0x70b4f1['calleridname']=_0x100111['firstName'];if(!_[_0xde14('0x77')](_0x100111[_0xde14('0x76')])){_0x70b4f1[_0xde14('0x78')]+='\x20'+_0x100111[_0xde14('0x76')];}}})[_0xde14('0x79')](function(){return db[_0xde14('0x7a')][_0xde14('0x5c')](_0x70b4f1);});}})[_0xde14('0x28')](function(){return _0x1ea6d2[_0xde14('0x1c')](0xcc)[_0xde14('0x1d')]();})[_0xde14('0x58')](handleError(_0x1ea6d2,null));};exports[_0xde14('0x7b')]=function(_0x1ff577,_0x42329a,_0x6a641f){var _0x280e61=[];return db[_0xde14('0x7c')][_0xde14('0x5e')]()[_0xde14('0x28')](function(_0x1b5d70){_0x280e61=_[_0xde14('0x59')](_0x1b5d70);return _0x1ff577[_0xde14('0x6a')][_0xde14('0x7d')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xde14('0x7e')},'attributes':['id','dialOrderByScheduledAt',_0xde14('0x7f')],'raw':!![]});})['then'](function(_0x3bbbab){if(_0x3bbbab&&_0x3bbbab[_0xde14('0x4c')]){return db[_0xde14('0x80')]['transaction'](function(_0x5e16e2){var _0x23d3e1={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xde14('0x81')](_0xde14('0x6e'))},'VoiceQueueId':{'$in':_[_0xde14('0x2f')](_0x3bbbab,'id')},'$or':[{'UserId':null},{'UserId':_0x1ff577['user']['id']}]};var _0x162f3b={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x3bbbab)[_0xde14('0x51')]([_0xde14('0x7f'),0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x1ff577['user']['id']}]};var _0x58ccb4={'$or':[_0x23d3e1,_0x162f3b]};var _0x24b354=[];if(_0x1ff577[_0xde14('0x5d')][_0xde14('0x82')]&&_0x1ff577['body'][_0xde14('0x82')]===_0xde14('0x83')){if(!_[_0xde14('0x84')](_0x1ff577[_0xde14('0x5d')][_0xde14('0x85')])){_0x58ccb4['id']={'$in':_0x1ff577[_0xde14('0x5d')]['hopperIds']};}_0x24b354=[['priority',_0xde14('0x86')],[_0xde14('0x87'),_0x3bbbab[0x0]['dialOrderByScheduledAt']===_0xde14('0x86')?_0xde14('0x88'):_0xde14('0x86')],db[_0xde14('0x80')][_0xde14('0x89')](_0xde14('0x8a')),['id',_0xde14('0x88')]];}else{if(!_['isEmpty'](_0x1ff577['body']['hopperIds'])){_0x58ccb4['id']={'$notIn':_0x1ff577['body'][_0xde14('0x85')]};}_0x24b354=[[_0xde14('0x8b'),'DESC'],['scheduledAt',_0x3bbbab[0x0][_0xde14('0x8c')]],db[_0xde14('0x80')][_0xde14('0x89')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0xde14('0x86')]];}return db[_0xde14('0x30')]['findOne']({'attributes':['id',_0xde14('0x8d'),_0xde14('0x8e')],'where':_0x58ccb4,'order':_0x24b354,'transaction':_0x5e16e2,'lock':_0x5e16e2[_0xde14('0x8f')][_0xde14('0x90')],'include':[{'model':db['CmContact'],'as':_0xde14('0x91'),'attributes':_0x280e61,'include':[{'model':db['CmCompany'],'as':_0xde14('0x92'),'attributes':['id',_0xde14('0x2c')]}]},{'model':db[_0xde14('0x93')],'as':'List','attributes':['id',_0xde14('0x2c')]},{'model':db[_0xde14('0x94')],'as':_0xde14('0x95'),'attributes':['id',_0xde14('0x2c'),_0xde14('0x96')]}]})['then'](function(_0x53433d){if(_0x53433d){return _0x53433d[_0xde14('0x27')]({'UserId':_0x1ff577[_0xde14('0x6a')]['id']},{'transaction':_0x5e16e2});}});});}})[_0xde14('0x28')](handleEntityNotFound(_0x42329a,null))['then'](respondWithResult(_0x42329a,null))[_0xde14('0x58')](handleError(_0x42329a,null));};exports[_0xde14('0x97')]=function(_0x43cc47,_0x85f5d5,_0x27f2ba){return _0x43cc47[_0xde14('0x6a')][_0xde14('0x7d')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xde14('0x7e')},'attributes':['id'],'raw':!![]})[_0xde14('0x28')](function(_0x8aad40){if(_0x8aad40&&_0x8aad40[_0xde14('0x4c')]){return db[_0xde14('0x30')][_0xde14('0x22')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xde14('0x81')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xde14('0x2f')](_0x8aad40,'id')},'$or':[{'UserId':null},{'UserId':_0x43cc47[_0xde14('0x6a')]['id']}]}});}return 0x0;})['then'](function(_0x4543f1){if(!_['isNil'](_0x4543f1)&&_[_0xde14('0x98')](_0x4543f1)){return _0x85f5d5['status'](0xc8)[_0xde14('0x1e')]({'contacts':_0x4543f1});}else{logger[_0xde14('0x2a')](_0xde14('0x99'),_0xde14('0x97'),0x194,_0xde14('0x9a'));_0x85f5d5[_0xde14('0x1b')](0x194);}})['catch'](handleError(_0x85f5d5,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 396aba2..7314214 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 _0x31f0=['priority','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./cmHopper.attributes','define','cm_hopper','scheduledat','phone'];(function(_0x41bdc3,_0xcdf7cc){var _0x2ffa61=function(_0x5232bd){while(--_0x5232bd){_0x41bdc3['push'](_0x41bdc3['shift']());}};_0x2ffa61(++_0xcdf7cc);}(_0x31f0,0xb7));var _0x031f=function(_0x113ced,_0x20161a){_0x113ced=_0x113ced-0x0;var _0x2da4a2=_0x31f0[_0x113ced];return _0x2da4a2;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var logger=require(_0x031f('0x1'))('api');var moment=require(_0x031f('0x2'));var BPromise=require(_0x031f('0x3'));var rp=require(_0x031f('0x4'));var fs=require('fs');var path=require(_0x031f('0x5'));var rimraf=require('rimraf');var config=require(_0x031f('0x6'));var attributes=require(_0x031f('0x7'));module['exports']=function(_0x4c0f94,_0x56328c){return _0x4c0f94[_0x031f('0x8')]('CmHopper',attributes,{'tableName':_0x031f('0x9'),'paranoid':![],'indexes':[{'name':_0x031f('0xa'),'fields':[_0x031f('0xa')]},{'name':_0x031f('0xb'),'fields':['phone']},{'name':_0x031f('0xc'),'fields':[_0x031f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4c60=['../../config/logger','api','bluebird','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4c60,0xc1));var _0x04c6=function(_0x2c4536,_0x3ebdd5){_0x2c4536=_0x2c4536-0x0;var _0x51bf10=_0x4c60[_0x2c4536];return _0x51bf10;};'use strict';var _=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var logger=require(_0x04c6('0x2'))(_0x04c6('0x3'));var moment=require('moment');var BPromise=require(_0x04c6('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(_0x04c6('0x5'));module[_0x04c6('0x6')]=function(_0x2054da,_0x12bd5d){return _0x2054da[_0x04c6('0x7')](_0x04c6('0x8'),attributes,{'tableName':_0x04c6('0x9'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x04c6('0xa')]},{'name':_0x04c6('0xb'),'fields':[_0x04c6('0xb')]},{'name':_0x04c6('0xc'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 6bde222..d11f2f9 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 _0xbdfa=['catch','GetCmHopper','CmHopper','findAll','options','attributes','limit','map','include','model','ShowCmHopper','find','raw','where','CreateCmHopper','body','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','DestroyCmHopper','CmContact','transaction','order','UPDATE','keys','User','Agent','name','voicePause','length','UserId','push','includes','update','all','GetContactDialer','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','active','MoveContactManagedDialer','sequelize','CmHopperFinal','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','literal','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','describe','LOCK','ResetActiveCalls','lodash','util','moment','randomstring','ioredis','../../mysqldb','jayson/promise','client','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x206b45,_0x1d388a){var _0xdc38fe=function(_0x5debf9){while(--_0x5debf9){_0x206b45['push'](_0x206b45['shift']());}};_0xdc38fe(++_0x1d388a);}(_0xbdfa,0x1e5));var _0xabdf=function(_0x59859d,_0x3e84aa){_0x59859d=_0x59859d-0x0;var _0x18a612=_0xbdfa[_0x59859d];return _0x18a612;};'use strict';var _=require(_0xabdf('0x0'));var util=require(_0xabdf('0x1'));var moment=require(_0xabdf('0x2'));var BPromise=require('bluebird');var rs=require(_0xabdf('0x3'));var fs=require('fs');var Redis=require(_0xabdf('0x4'));var db=require(_0xabdf('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xabdf('0x6'));var client=jayson[_0xabdf('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41100f,_0x36d9de,_0x221075){return new BPromise(function(_0x2e50e0,_0x31bdff){return client[_0xabdf('0x8')](_0x41100f,_0x221075)[_0xabdf('0x9')](function(_0x486414){logger[_0xabdf('0xa')](_0xabdf('0xb'),_0x36d9de,_0xabdf('0xc'));logger[_0xabdf('0xd')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x36d9de,_0xabdf('0xc'),JSON[_0xabdf('0xe')](_0x486414));if(_0x486414[_0xabdf('0xf')]){if(_0x486414[_0xabdf('0xf')][_0xabdf('0x10')]===0x1f4){logger[_0xabdf('0xf')](_0xabdf('0xb'),_0x36d9de,_0x486414[_0xabdf('0xf')][_0xabdf('0x11')]);return _0x31bdff(_0x486414[_0xabdf('0xf')][_0xabdf('0x11')]);}logger['error'](_0xabdf('0xb'),_0x36d9de,_0x486414[_0xabdf('0xf')][_0xabdf('0x11')]);return _0x2e50e0(_0x486414[_0xabdf('0xf')]['message']);}else{logger[_0xabdf('0xa')](_0xabdf('0xb'),_0x36d9de,_0xabdf('0xc'));_0x2e50e0(_0x486414[_0xabdf('0x12')][_0xabdf('0x11')]);}})[_0xabdf('0x13')](function(_0x564a2f){logger[_0xabdf('0xf')](_0xabdf('0xb'),_0x36d9de,_0x564a2f);_0x31bdff(_0x564a2f);});});}exports[_0xabdf('0x14')]=function(_0x5cb260){var _0x3b1540=this;return new Promise(function(_0x5e441c,_0x5f0153){return db[_0xabdf('0x15')][_0xabdf('0x16')]({'raw':_0x5cb260[_0xabdf('0x17')]?_0x5cb260[_0xabdf('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5cb260[_0xabdf('0x17')]?_0x5cb260['options']['where']||null:null,'attributes':_0x5cb260['options']?_0x5cb260[_0xabdf('0x17')][_0xabdf('0x18')]||null:null,'limit':_0x5cb260[_0xabdf('0x17')]?_0x5cb260['options'][_0xabdf('0x19')]||null:null,'include':_0x5cb260[_0xabdf('0x17')]?_0x5cb260[_0xabdf('0x17')]['include']?_[_0xabdf('0x1a')](_0x5cb260[_0xabdf('0x17')][_0xabdf('0x1b')],function(_0x403078){return{'model':db[_0x403078[_0xabdf('0x1c')]],'as':_0x403078['as'],'attributes':_0x403078[_0xabdf('0x18')],'include':_0x403078[_0xabdf('0x1b')]?_[_0xabdf('0x1a')](_0x403078['include'],function(_0x18dbc2){return{'model':db[_0x18dbc2['model']],'as':_0x18dbc2['as'],'attributes':_0x18dbc2['attributes'],'include':_0x18dbc2['include']?_[_0xabdf('0x1a')](_0x18dbc2['include'],function(_0x501583){return{'model':db[_0x501583[_0xabdf('0x1c')]],'as':_0x501583['as'],'attributes':_0x501583['attributes']};}):[]};}):[]};}):[]:[]})[_0xabdf('0x9')](function(_0x4e3246){logger[_0xabdf('0xa')]('GetCmHopper',_0x5cb260);logger['debug'](_0xabdf('0x14'),_0x5cb260,JSON['stringify'](_0x4e3246));_0x5e441c(_0x4e3246);})[_0xabdf('0x13')](function(_0x204a07){logger['error'](_0xabdf('0x14'),_0x204a07[_0xabdf('0x11')],_0x5cb260);_0x5f0153(_0x3b1540[_0xabdf('0xf')](0x1f4,_0x204a07[_0xabdf('0x11')]));});});};exports[_0xabdf('0x1d')]=function(_0x366be4){var _0x7d6769=this;return new Promise(function(_0x3cd5bb,_0x127461){return db['CmHopper'][_0xabdf('0x1e')]({'raw':_0x366be4[_0xabdf('0x17')]?_0x366be4[_0xabdf('0x17')][_0xabdf('0x1f')]===undefined?!![]:![]:!![],'where':_0x366be4[_0xabdf('0x17')]?_0x366be4[_0xabdf('0x17')][_0xabdf('0x20')]||null:null,'attributes':_0x366be4['options']?_0x366be4['options']['attributes']||null:null,'include':_0x366be4[_0xabdf('0x17')]?_0x366be4[_0xabdf('0x17')]['include']?_[_0xabdf('0x1a')](_0x366be4['options'][_0xabdf('0x1b')],function(_0x2a06b9){return{'model':db[_0x2a06b9['model']],'as':_0x2a06b9['as'],'attributes':_0x2a06b9['attributes'],'include':_0x2a06b9[_0xabdf('0x1b')]?_[_0xabdf('0x1a')](_0x2a06b9['include'],function(_0x3d9893){return{'model':db[_0x3d9893[_0xabdf('0x1c')]],'as':_0x3d9893['as'],'attributes':_0x3d9893[_0xabdf('0x18')],'include':_0x3d9893[_0xabdf('0x1b')]?_[_0xabdf('0x1a')](_0x3d9893['include'],function(_0x45adae){return{'model':db[_0x45adae[_0xabdf('0x1c')]],'as':_0x45adae['as'],'attributes':_0x45adae[_0xabdf('0x18')]};}):[]};}):[]};}):[]:[]})[_0xabdf('0x9')](function(_0x4c3451){logger[_0xabdf('0xa')](_0xabdf('0x1d'),_0x366be4);logger['debug'](_0xabdf('0x1d'),_0x366be4,JSON['stringify'](_0x4c3451));_0x3cd5bb(_0x4c3451);})[_0xabdf('0x13')](function(_0x4c0690){logger[_0xabdf('0xf')]('ShowCmHopper',_0x4c0690[_0xabdf('0x11')],_0x366be4);_0x127461(_0x7d6769[_0xabdf('0xf')](0x1f4,_0x4c0690[_0xabdf('0x11')]));});});};exports[_0xabdf('0x21')]=function(_0x59ba7f){var _0xa85b9c=this;return new Promise(function(_0x15805d,_0x9438ed){return db['CmHopper']['create'](_0x59ba7f[_0xabdf('0x22')],{'raw':_0x59ba7f[_0xabdf('0x17')]?_0x59ba7f[_0xabdf('0x17')][_0xabdf('0x1f')]===undefined?!![]:![]:!![]})[_0xabdf('0x9')](function(_0xc66efa){logger['info'](_0xabdf('0x21'),_0x59ba7f);logger['debug']('CreateCmHopper',_0x59ba7f,JSON[_0xabdf('0xe')](_0xc66efa));_0x15805d(_0xc66efa);})['catch'](function(_0x4ea63f){logger[_0xabdf('0xf')](_0xabdf('0x21'),_0x4ea63f['message'],_0x59ba7f);_0x9438ed(_0xa85b9c[_0xabdf('0xf')](0x1f4,_0x4ea63f[_0xabdf('0x11')]));});});};exports[_0xabdf('0x23')]=function(_0x3f854a){var _0x1c8e4f=this;return new Promise(function(_0x53248b,_0x5f110f){return db['CmHopper']['update'](_0x3f854a['body'],{'raw':_0x3f854a[_0xabdf('0x17')]?_0x3f854a[_0xabdf('0x17')][_0xabdf('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f854a['options']?_0x3f854a[_0xabdf('0x17')][_0xabdf('0x20')]||null:null,'attributes':_0x3f854a[_0xabdf('0x17')]?_0x3f854a[_0xabdf('0x17')][_0xabdf('0x18')]||null:null,'limit':_0x3f854a['options']?_0x3f854a[_0xabdf('0x17')][_0xabdf('0x19')]||null:null})[_0xabdf('0x9')](function(_0x72047a){logger[_0xabdf('0xa')](_0xabdf('0x23'),_0x3f854a);logger['info'](_0xabdf('0x24'),JSON[_0xabdf('0xe')](_0x3f854a[_0xabdf('0x17')][_0xabdf('0x20')]),_0x3f854a['body']['active']);logger[_0xabdf('0xd')]('UpdateCmHopper',_0x3f854a,JSON[_0xabdf('0xe')](_0x72047a));_0x53248b(_0x72047a);})[_0xabdf('0x13')](function(_0x463939){logger['error'](_0xabdf('0x23'),_0x463939['message'],_0x3f854a);_0x5f110f(_0x1c8e4f[_0xabdf('0xf')](0x1f4,_0x463939[_0xabdf('0x11')]));});});};exports['DestroyCmHopper']=function(_0x26f508){var _0x3d17fc=this;return new Promise(function(_0x13dcc9,_0x18566d){return db[_0xabdf('0x15')]['destroy']({'where':_0x26f508[_0xabdf('0x17')]?_0x26f508['options'][_0xabdf('0x20')]||null:null})[_0xabdf('0x9')](function(_0x4f8b33){logger[_0xabdf('0xa')](_0xabdf('0x25'),_0x26f508);logger['debug']('DestroyCmHopper',_0x26f508,JSON[_0xabdf('0xe')](_0x4f8b33));_0x13dcc9(_0x4f8b33);})[_0xabdf('0x13')](function(_0x15adb7){logger[_0xabdf('0xf')]('DestroyCmHopper',_0x15adb7[_0xabdf('0x11')],_0x26f508);_0x18566d(_0x3d17fc[_0xabdf('0xf')](0x1f4,_0x15adb7[_0xabdf('0x11')]));});});};exports['GetContactDialer']=function(_0x3b6429){var _0x5c588f=this;return new Promise(function(_0x53545c,_0x4bf5be){return db[_0xabdf('0x26')]['describe']()['then'](function(_0x35068d){return db['sequelize'][_0xabdf('0x27')](function(_0x206b16){return db[_0xabdf('0x15')][_0xabdf('0x16')]({'where':_0x3b6429[_0xabdf('0x17')]?_0x3b6429[_0xabdf('0x17')][_0xabdf('0x20')]||null:null,'attributes':_0x3b6429['options']?_0x3b6429['options'][_0xabdf('0x18')]||null:null,'limit':_0x3b6429[_0xabdf('0x17')]?_0x3b6429[_0xabdf('0x17')][_0xabdf('0x19')]||null:null,'order':_0x3b6429['options']?_0x3b6429[_0xabdf('0x17')][_0xabdf('0x28')]||null:null,'transaction':_0x206b16,'lock':_0x206b16['LOCK'][_0xabdf('0x29')],'include':[{'model':db[_0xabdf('0x26')],'as':'Contact','attributes':_[_0xabdf('0x2a')](_0x35068d)},{'model':db[_0xabdf('0x2b')],'as':_0xabdf('0x2c'),'attributes':['id',_0xabdf('0x2d'),_0xabdf('0x2e')]}]})[_0xabdf('0x9')](function(_0x331498){var _0x5e7b9c=[];var _0xc036bb=[];for(var _0x2a6ff4=0x0;_0x2a6ff4<_0x331498[_0xabdf('0x2f')];_0x2a6ff4+=0x1){var _0x343168=_0x331498[_0x2a6ff4][_0xabdf('0x30')];if(_0x343168===null){_0x5e7b9c[_0xabdf('0x31')](_0x331498[_0x2a6ff4]['update'](_0x3b6429[_0xabdf('0x22')],{'transaction':_0x206b16}));}else if(!_0xc036bb[_0xabdf('0x32')](_0x343168)){_0xc036bb[_0xabdf('0x31')](_0x343168);_0x5e7b9c['push'](_0x331498[_0x2a6ff4][_0xabdf('0x33')](_0x3b6429[_0xabdf('0x22')],{'transaction':_0x206b16}));}}return BPromise[_0xabdf('0x34')](_0x5e7b9c);});})[_0xabdf('0x9')](function(_0x282915){logger[_0xabdf('0xa')](_0xabdf('0x35'),_0x3b6429);if(_0x282915[_0xabdf('0x2f')]>0x0){logger[_0xabdf('0xa')](_0xabdf('0x36'),_0x282915[0x0][_0xabdf('0x37')]['id'],_0x282915[0x0][_0xabdf('0x37')]['ContactId'],_0x282915[0x0][_0xabdf('0x37')][_0xabdf('0x38')]);}logger['debug'](_0xabdf('0x35'),_0x3b6429,JSON[_0xabdf('0xe')](_0x282915));_0x53545c(_0x282915);})['catch'](function(_0xe95abc){logger[_0xabdf('0xf')](_0xabdf('0x35'),_0xe95abc[_0xabdf('0x11')],_0x3b6429);_0x4bf5be(_0x5c588f[_0xabdf('0xf')](0x1f4,_0xe95abc[_0xabdf('0x11')]));});});});};exports[_0xabdf('0x39')]=function(_0x130465){var _0x38e56e=this;return new Promise(function(_0x37a65a,_0x3f76ab){return db[_0xabdf('0x3a')]['transaction'](function(_0x3f8151){return db[_0xabdf('0x3b')][_0xabdf('0x3c')](_0x130465[_0xabdf('0x22')],{'raw':_0x130465[_0xabdf('0x17')]?_0x130465[_0xabdf('0x17')][_0xabdf('0x1f')]===undefined?!![]:![]:!![],'transaction':_0x3f8151})[_0xabdf('0x9')](function(){logger['info'](_0xabdf('0x3d'),JSON[_0xabdf('0xe')](_0x130465[_0xabdf('0x17')][_0xabdf('0x20')]),_0x130465[_0xabdf('0x17')]['where'][_0xabdf('0x38')]);return db[_0xabdf('0x15')]['destroy']({'where':_0x130465[_0xabdf('0x17')]?_0x130465[_0xabdf('0x17')]['where']||null:null,'transaction':_0x3f8151});});})['then'](function(_0x41dd52){logger['info'](_0xabdf('0x39'),_0x130465);logger[_0xabdf('0xd')](_0xabdf('0x39'),_0x130465,JSON[_0xabdf('0xe')](_0x41dd52));_0x37a65a(_0x41dd52);})[_0xabdf('0x13')](function(_0x3d3f8c){logger[_0xabdf('0xf')](_0xabdf('0x39'),_0x3d3f8c['message'],_0x130465);_0x3f76ab(_0x38e56e['error'](0x1f4,_0x3d3f8c[_0xabdf('0x11')]));});});};exports[_0xabdf('0x3e')]=function(_0x5755dd){var _0x15e519=this;return new Promise(function(_0x28bd02,_0x591730){return db['CmHopper'][_0xabdf('0x16')]({'raw':_0x5755dd[_0xabdf('0x17')]?_0x5755dd[_0xabdf('0x17')][_0xabdf('0x1f')]===undefined?!![]:![]:!![],'where':_0x5755dd[_0xabdf('0x17')]?_0x5755dd['options'][_0xabdf('0x20')]||null:null,'attributes':[[db[_0xabdf('0x3a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xabdf('0x3a')][_0xabdf('0x3f')]('`scheduledat`\x20>=\x20'+util[_0xabdf('0x40')](_0xabdf('0x41'),moment()[_0xabdf('0x40')](_0xabdf('0x42')))+'\x20,\x201,\x20null'))),_0xabdf('0x43')]]})['then'](function(_0x5533fd){logger['info']('CountReScheduled',_0x5755dd);logger[_0xabdf('0xd')](_0xabdf('0x3e'),_0x5755dd,JSON[_0xabdf('0xe')](_0x5533fd));_0x28bd02(_0x5533fd);})[_0xabdf('0x13')](function(_0x4e0a9c){logger[_0xabdf('0xf')](_0xabdf('0x3e'),_0x4e0a9c['message'],_0x5755dd);_0x591730(_0x15e519[_0xabdf('0xf')](0x1f4,_0x4e0a9c['message']));});});};exports[_0xabdf('0x44')]=function(_0x1d9d67){var _0x2a5f58=this;return new Promise(function(_0x1eab8e,_0x10062c){return db[_0xabdf('0x26')][_0xabdf('0x45')]()[_0xabdf('0x9')](function(_0x82182d){return db['sequelize'][_0xabdf('0x27')](function(_0x596f80){return db[_0xabdf('0x15')]['findAll']({'where':_0x1d9d67['options']?_0x1d9d67[_0xabdf('0x17')][_0xabdf('0x20')]||null:null,'attributes':_0x1d9d67[_0xabdf('0x17')]?_0x1d9d67[_0xabdf('0x17')][_0xabdf('0x18')]||null:null,'limit':0x1,'order':_0x1d9d67[_0xabdf('0x17')]?_0x1d9d67[_0xabdf('0x17')]['order']||null:null,'group':db[_0xabdf('0x15')][_0xabdf('0x30')],'transaction':_0x596f80,'lock':_0x596f80[_0xabdf('0x46')]['UPDATE'],'include':_0x1d9d67[_0xabdf('0x17')]?_0x1d9d67[_0xabdf('0x17')][_0xabdf('0x1b')]?_[_0xabdf('0x1a')](_0x1d9d67[_0xabdf('0x17')]['include'],function(_0x4627ad){return{'model':db[_0x4627ad['model']],'as':_0x4627ad['as'],'attributes':_0x4627ad[_0xabdf('0x18')],'include':_0x4627ad['include']?_[_0xabdf('0x1a')](_0x4627ad[_0xabdf('0x1b')],function(_0x41e5cb){return{'model':db[_0x41e5cb[_0xabdf('0x1c')]],'as':_0x41e5cb['as'],'attributes':_0x41e5cb['attributes'],'include':_0x41e5cb[_0xabdf('0x1b')]?_[_0xabdf('0x1a')](_0x41e5cb[_0xabdf('0x1b')],function(_0x2f3584){return{'model':db[_0x2f3584[_0xabdf('0x1c')]],'as':_0x2f3584['as'],'attributes':_0x2f3584[_0xabdf('0x18')]};}):[]};}):[]};}):[]:[]})[_0xabdf('0x9')](function(_0x57d34d){var _0x4b2631=[];for(var _0x3afab4=0x0;_0x3afab4<_0x57d34d[_0xabdf('0x2f')];_0x3afab4+=0x1){_0x4b2631[_0xabdf('0x31')](_0x57d34d[_0x3afab4][_0xabdf('0x33')](_0x1d9d67[_0xabdf('0x22')],{'transaction':_0x596f80}));}return BPromise[_0xabdf('0x34')](_0x4b2631);});})[_0xabdf('0x9')](function(_0x3604b0){logger[_0xabdf('0xa')]('GetContactRecallMe',_0x1d9d67);logger[_0xabdf('0xd')](_0xabdf('0x44'),_0x1d9d67,JSON['stringify'](_0x3604b0));_0x1eab8e(_0x3604b0);})['catch'](function(_0x1de90f){logger[_0xabdf('0xf')]('GetContactRecallMe',_0x1de90f[_0xabdf('0x11')],_0x1d9d67);_0x10062c(_0x2a5f58['error'](0x1f4,_0x1de90f[_0xabdf('0x11')]));});});});};exports['GetCmHopperPreview']=function(_0x3d3146){var _0x2cad4d=this;return new Promise(function(_0x11f24b,_0xbf27dc){db[_0xabdf('0x26')][_0xabdf('0x45')]()[_0xabdf('0x9')](function(_0x801a8d){return db[_0xabdf('0x15')][_0xabdf('0x16')]({'raw':_0x3d3146[_0xabdf('0x17')]?_0x3d3146[_0xabdf('0x17')][_0xabdf('0x1f')]===undefined?!![]:![]:!![],'where':_0x3d3146['options']?_0x3d3146[_0xabdf('0x17')][_0xabdf('0x20')]||null:null,'attributes':_0x3d3146[_0xabdf('0x17')]?_0x3d3146[_0xabdf('0x17')][_0xabdf('0x18')]||null:null,'limit':_0x3d3146[_0xabdf('0x17')]?_0x3d3146['options']['limit']||null:null,'include':_0x3d3146[_0xabdf('0x17')]?_0x3d3146[_0xabdf('0x17')][_0xabdf('0x1b')]?_[_0xabdf('0x1a')](_0x3d3146[_0xabdf('0x17')][_0xabdf('0x1b')],function(_0x1b3f1c){return{'model':db[_0x1b3f1c['model']],'as':_0x1b3f1c['as'],'attributes':_0x1b3f1c['as']==='Contact'?_[_0xabdf('0x2a')](_0x801a8d):_0x1b3f1c['attributes'],'include':_0x1b3f1c[_0xabdf('0x1b')]?_[_0xabdf('0x1a')](_0x1b3f1c[_0xabdf('0x1b')],function(_0x50283f){return{'model':db[_0x50283f['model']],'as':_0x50283f['as'],'attributes':_0x50283f[_0xabdf('0x18')],'include':_0x50283f['include']?_[_0xabdf('0x1a')](_0x50283f[_0xabdf('0x1b')],function(_0x113868){return{'model':db[_0x113868[_0xabdf('0x1c')]],'as':_0x113868['as'],'attributes':_0x113868[_0xabdf('0x18')]};}):[]};}):[]};}):[]:[]})[_0xabdf('0x9')](function(_0x18903c){logger[_0xabdf('0xa')](_0xabdf('0x14'),_0x3d3146);logger[_0xabdf('0xd')](_0xabdf('0x14'),_0x3d3146,JSON[_0xabdf('0xe')](_0x18903c));_0x11f24b(_0x18903c);})['catch'](function(_0x525138){logger[_0xabdf('0xf')](_0xabdf('0x14'),_0x525138['message'],_0x3d3146);_0xbf27dc(_0x2cad4d['error'](0x1f4,_0x525138[_0xabdf('0x11')]));});});});};exports[_0xabdf('0x47')]=function(_0x30d872){var _0x214a58=this;return new Promise(function(_0x2b22a9,_0x2fb737){return db[_0xabdf('0x3a')][_0xabdf('0x27')](function(_0x582788){return db[_0xabdf('0x15')]['update']({'active':![]},{'where':{},'transaction':_0x582788})[_0xabdf('0x9')](function(_0x3d4da6){logger[_0xabdf('0xa')](_0xabdf('0x47'),_0x30d872);logger[_0xabdf('0xd')](_0xabdf('0x47'),_0x30d872,JSON['stringify'](_0x3d4da6));_0x2b22a9(_0x3d4da6);})['catch'](function(_0x5a0fda){logger['error']('ResetActiveCalls',_0x5a0fda[_0xabdf('0x11')],_0x30d872);_0x2fb737(_0x214a58[_0xabdf('0xf')](0x1f4,_0x5a0fda['message']));});});});}; \ No newline at end of file +var _0x692f=['map','model','catch','ShowCmHopper','CmHopper','then','CreateCmHopper','create','body','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','where','DestroyCmHopper','destroy','CmContact','describe','sequelize','transaction','findAll','order','LOCK','UPDATE','Contact','keys','User','Agent','name','length','UserId','includes','push','all','GetContactDialer','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','active','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','GetContactRecallMe','ResetActiveCalls','update','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','GetCmHopper','options','raw','attributes','limit','include'];(function(_0x582ccd,_0xa9ab43){var _0x11545d=function(_0x4010fa){while(--_0x4010fa){_0x582ccd['push'](_0x582ccd['shift']());}};_0x11545d(++_0xa9ab43);}(_0x692f,0x10f));var _0xf692=function(_0x1c4951,_0x2038ee){_0x1c4951=_0x1c4951-0x0;var _0x345e1b=_0x692f[_0x1c4951];return _0x345e1b;};'use strict';var _=require(_0xf692('0x0'));var util=require(_0xf692('0x1'));var moment=require('moment');var BPromise=require(_0xf692('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf692('0x3'))['db'];var utils=require(_0xf692('0x4'));var logger=require(_0xf692('0x5'))('rpc');var config=require(_0xf692('0x6'));var jayson=require(_0xf692('0x7'));var client=jayson[_0xf692('0x8')][_0xf692('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40ebb3,_0x460467,_0x360844){return new BPromise(function(_0x4e646a,_0x1d0b3b){return client[_0xf692('0xa')](_0x40ebb3,_0x360844)['then'](function(_0x1f2017){logger[_0xf692('0xb')](_0xf692('0xc'),_0x460467,_0xf692('0xd'));logger[_0xf692('0xe')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x460467,_0xf692('0xd'),JSON[_0xf692('0xf')](_0x1f2017));if(_0x1f2017[_0xf692('0x10')]){if(_0x1f2017[_0xf692('0x10')]['code']===0x1f4){logger[_0xf692('0x10')]('CmHopper,\x20%s,\x20%s',_0x460467,_0x1f2017[_0xf692('0x10')][_0xf692('0x11')]);return _0x1d0b3b(_0x1f2017[_0xf692('0x10')][_0xf692('0x11')]);}logger[_0xf692('0x10')](_0xf692('0xc'),_0x460467,_0x1f2017['error'][_0xf692('0x11')]);return _0x4e646a(_0x1f2017[_0xf692('0x10')][_0xf692('0x11')]);}else{logger[_0xf692('0xb')]('CmHopper,\x20%s,\x20%s',_0x460467,_0xf692('0xd'));_0x4e646a(_0x1f2017[_0xf692('0x12')]['message']);}})['catch'](function(_0x336032){logger['error']('CmHopper,\x20%s,\x20%s',_0x460467,_0x336032);_0x1d0b3b(_0x336032);});});}exports[_0xf692('0x13')]=function(_0x58fc31){var _0x5cfa43=this;return new Promise(function(_0x18e881,_0x325912){return db['CmHopper']['findAll']({'raw':_0x58fc31[_0xf692('0x14')]?_0x58fc31['options'][_0xf692('0x15')]===undefined?!![]:![]:!![],'where':_0x58fc31['options']?_0x58fc31[_0xf692('0x14')]['where']||null:null,'attributes':_0x58fc31[_0xf692('0x14')]?_0x58fc31['options'][_0xf692('0x16')]||null:null,'limit':_0x58fc31[_0xf692('0x14')]?_0x58fc31[_0xf692('0x14')][_0xf692('0x17')]||null:null,'include':_0x58fc31['options']?_0x58fc31['options'][_0xf692('0x18')]?_[_0xf692('0x19')](_0x58fc31[_0xf692('0x14')]['include'],function(_0x29dc55){return{'model':db[_0x29dc55['model']],'as':_0x29dc55['as'],'attributes':_0x29dc55[_0xf692('0x16')],'include':_0x29dc55[_0xf692('0x18')]?_[_0xf692('0x19')](_0x29dc55['include'],function(_0x479a0e){return{'model':db[_0x479a0e[_0xf692('0x1a')]],'as':_0x479a0e['as'],'attributes':_0x479a0e[_0xf692('0x16')],'include':_0x479a0e[_0xf692('0x18')]?_[_0xf692('0x19')](_0x479a0e[_0xf692('0x18')],function(_0xe10066){return{'model':db[_0xe10066['model']],'as':_0xe10066['as'],'attributes':_0xe10066[_0xf692('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x335d4e){logger[_0xf692('0xb')](_0xf692('0x13'),_0x58fc31);logger[_0xf692('0xe')](_0xf692('0x13'),_0x58fc31,JSON[_0xf692('0xf')](_0x335d4e));_0x18e881(_0x335d4e);})[_0xf692('0x1b')](function(_0x5d2f34){logger['error'](_0xf692('0x13'),_0x5d2f34[_0xf692('0x11')],_0x58fc31);_0x325912(_0x5cfa43[_0xf692('0x10')](0x1f4,_0x5d2f34[_0xf692('0x11')]));});});};exports[_0xf692('0x1c')]=function(_0x9b754c){var _0x4cee39=this;return new Promise(function(_0x41c2a7,_0x40ef7a){return db[_0xf692('0x1d')]['find']({'raw':_0x9b754c[_0xf692('0x14')]?_0x9b754c['options'][_0xf692('0x15')]===undefined?!![]:![]:!![],'where':_0x9b754c[_0xf692('0x14')]?_0x9b754c[_0xf692('0x14')]['where']||null:null,'attributes':_0x9b754c[_0xf692('0x14')]?_0x9b754c[_0xf692('0x14')]['attributes']||null:null,'include':_0x9b754c[_0xf692('0x14')]?_0x9b754c[_0xf692('0x14')][_0xf692('0x18')]?_['map'](_0x9b754c[_0xf692('0x14')]['include'],function(_0x197645){return{'model':db[_0x197645[_0xf692('0x1a')]],'as':_0x197645['as'],'attributes':_0x197645['attributes'],'include':_0x197645[_0xf692('0x18')]?_[_0xf692('0x19')](_0x197645[_0xf692('0x18')],function(_0x4797c5){return{'model':db[_0x4797c5['model']],'as':_0x4797c5['as'],'attributes':_0x4797c5['attributes'],'include':_0x4797c5[_0xf692('0x18')]?_[_0xf692('0x19')](_0x4797c5[_0xf692('0x18')],function(_0x986ed7){return{'model':db[_0x986ed7[_0xf692('0x1a')]],'as':_0x986ed7['as'],'attributes':_0x986ed7[_0xf692('0x16')]};}):[]};}):[]};}):[]:[]})[_0xf692('0x1e')](function(_0x39c911){logger[_0xf692('0xb')](_0xf692('0x1c'),_0x9b754c);logger[_0xf692('0xe')](_0xf692('0x1c'),_0x9b754c,JSON[_0xf692('0xf')](_0x39c911));_0x41c2a7(_0x39c911);})[_0xf692('0x1b')](function(_0x3817ac){logger[_0xf692('0x10')](_0xf692('0x1c'),_0x3817ac[_0xf692('0x11')],_0x9b754c);_0x40ef7a(_0x4cee39[_0xf692('0x10')](0x1f4,_0x3817ac[_0xf692('0x11')]));});});};exports[_0xf692('0x1f')]=function(_0x2b5f1c){var _0x50340a=this;return new Promise(function(_0x30da1f,_0x494ad3){return db['CmHopper'][_0xf692('0x20')](_0x2b5f1c[_0xf692('0x21')],{'raw':_0x2b5f1c[_0xf692('0x14')]?_0x2b5f1c[_0xf692('0x14')][_0xf692('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x58f80c){logger[_0xf692('0xb')]('CreateCmHopper',_0x2b5f1c);logger[_0xf692('0xe')](_0xf692('0x1f'),_0x2b5f1c,JSON[_0xf692('0xf')](_0x58f80c));_0x30da1f(_0x58f80c);})[_0xf692('0x1b')](function(_0xa818b){logger[_0xf692('0x10')](_0xf692('0x1f'),_0xa818b[_0xf692('0x11')],_0x2b5f1c);_0x494ad3(_0x50340a[_0xf692('0x10')](0x1f4,_0xa818b[_0xf692('0x11')]));});});};exports[_0xf692('0x22')]=function(_0x4c241b){var _0x5a4c35=this;return new Promise(function(_0x580bec,_0x55e84b){return db[_0xf692('0x1d')]['update'](_0x4c241b[_0xf692('0x21')],{'raw':_0x4c241b[_0xf692('0x14')]?_0x4c241b['options'][_0xf692('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c241b[_0xf692('0x14')]?_0x4c241b[_0xf692('0x14')]['where']||null:null,'attributes':_0x4c241b[_0xf692('0x14')]?_0x4c241b[_0xf692('0x14')][_0xf692('0x16')]||null:null,'limit':_0x4c241b[_0xf692('0x14')]?_0x4c241b[_0xf692('0x14')][_0xf692('0x17')]||null:null})['then'](function(_0x3c28f6){logger[_0xf692('0xb')]('UpdateCmHopper',_0x4c241b);logger['info'](_0xf692('0x23'),JSON[_0xf692('0xf')](_0x4c241b[_0xf692('0x14')][_0xf692('0x24')]),_0x4c241b['body']['active']);logger[_0xf692('0xe')]('UpdateCmHopper',_0x4c241b,JSON[_0xf692('0xf')](_0x3c28f6));_0x580bec(_0x3c28f6);})[_0xf692('0x1b')](function(_0x2b9050){logger[_0xf692('0x10')](_0xf692('0x22'),_0x2b9050[_0xf692('0x11')],_0x4c241b);_0x55e84b(_0x5a4c35['error'](0x1f4,_0x2b9050[_0xf692('0x11')]));});});};exports[_0xf692('0x25')]=function(_0x425706){var _0x249ee3=this;return new Promise(function(_0x360d07,_0x30d8df){return db[_0xf692('0x1d')][_0xf692('0x26')]({'where':_0x425706['options']?_0x425706[_0xf692('0x14')][_0xf692('0x24')]||null:null})[_0xf692('0x1e')](function(_0x4504a5){logger[_0xf692('0xb')](_0xf692('0x25'),_0x425706);logger[_0xf692('0xe')]('DestroyCmHopper',_0x425706,JSON[_0xf692('0xf')](_0x4504a5));_0x360d07(_0x4504a5);})[_0xf692('0x1b')](function(_0xaa23ce){logger['error'](_0xf692('0x25'),_0xaa23ce['message'],_0x425706);_0x30d8df(_0x249ee3[_0xf692('0x10')](0x1f4,_0xaa23ce[_0xf692('0x11')]));});});};exports['GetContactDialer']=function(_0x53917a){var _0x349e62=this;return new Promise(function(_0x12a4a6,_0x2e5c60){return db[_0xf692('0x27')][_0xf692('0x28')]()['then'](function(_0x5dd1a2){return db[_0xf692('0x29')][_0xf692('0x2a')](function(_0x3a64ec){return db[_0xf692('0x1d')][_0xf692('0x2b')]({'where':_0x53917a[_0xf692('0x14')]?_0x53917a[_0xf692('0x14')][_0xf692('0x24')]||null:null,'attributes':_0x53917a[_0xf692('0x14')]?_0x53917a['options'][_0xf692('0x16')]||null:null,'limit':_0x53917a[_0xf692('0x14')]?_0x53917a[_0xf692('0x14')]['limit']||null:null,'order':_0x53917a[_0xf692('0x14')]?_0x53917a[_0xf692('0x14')][_0xf692('0x2c')]||null:null,'transaction':_0x3a64ec,'lock':_0x3a64ec[_0xf692('0x2d')][_0xf692('0x2e')],'include':[{'model':db[_0xf692('0x27')],'as':_0xf692('0x2f'),'attributes':_[_0xf692('0x30')](_0x5dd1a2)},{'model':db[_0xf692('0x31')],'as':_0xf692('0x32'),'attributes':['id',_0xf692('0x33'),'voicePause']}]})[_0xf692('0x1e')](function(_0x395809){var _0x39a08d=[];var _0x3b2170=[];for(var _0x173648=0x0;_0x173648<_0x395809[_0xf692('0x34')];_0x173648+=0x1){var _0x58456d=_0x395809[_0x173648][_0xf692('0x35')];if(_0x58456d===null){_0x39a08d['push'](_0x395809[_0x173648]['update'](_0x53917a[_0xf692('0x21')],{'transaction':_0x3a64ec}));}else if(!_0x3b2170[_0xf692('0x36')](_0x58456d)){_0x3b2170[_0xf692('0x37')](_0x58456d);_0x39a08d[_0xf692('0x37')](_0x395809[_0x173648]['update'](_0x53917a[_0xf692('0x21')],{'transaction':_0x3a64ec}));}}return BPromise[_0xf692('0x38')](_0x39a08d);});})[_0xf692('0x1e')](function(_0x4c111c){logger[_0xf692('0xb')](_0xf692('0x39'),_0x53917a);if(_0x4c111c['length']>0x0){logger['info'](_0xf692('0x3a'),_0x4c111c[0x0][_0xf692('0x3b')]['id'],_0x4c111c[0x0]['dataValues'][_0xf692('0x3c')],_0x4c111c[0x0][_0xf692('0x3b')][_0xf692('0x3d')]);}logger[_0xf692('0xe')](_0xf692('0x39'),_0x53917a,JSON[_0xf692('0xf')](_0x4c111c));_0x12a4a6(_0x4c111c);})[_0xf692('0x1b')](function(_0x38be42){logger['error'](_0xf692('0x39'),_0x38be42['message'],_0x53917a);_0x2e5c60(_0x349e62[_0xf692('0x10')](0x1f4,_0x38be42[_0xf692('0x11')]));});});});};exports[_0xf692('0x3e')]=function(_0x53064c){var _0x4b96c7=this;return new Promise(function(_0x3515de,_0x1753c6){return db['sequelize'][_0xf692('0x2a')](function(_0x5ddaf){return db[_0xf692('0x3f')][_0xf692('0x20')](_0x53064c['body'],{'raw':_0x53064c[_0xf692('0x14')]?_0x53064c['options'][_0xf692('0x15')]===undefined?!![]:![]:!![],'transaction':_0x5ddaf})['then'](function(){logger[_0xf692('0xb')](_0xf692('0x40'),JSON[_0xf692('0xf')](_0x53064c[_0xf692('0x14')]['where']),_0x53064c[_0xf692('0x14')][_0xf692('0x24')]['active']);return db['CmHopper']['destroy']({'where':_0x53064c['options']?_0x53064c[_0xf692('0x14')][_0xf692('0x24')]||null:null,'transaction':_0x5ddaf});});})['then'](function(_0x2fb8f6){logger[_0xf692('0xb')]('MoveContactManagedDialer',_0x53064c);logger[_0xf692('0xe')]('MoveContactManagedDialer',_0x53064c,JSON[_0xf692('0xf')](_0x2fb8f6));_0x3515de(_0x2fb8f6);})['catch'](function(_0x5037c9){logger['error']('MoveContactManagedDialer',_0x5037c9['message'],_0x53064c);_0x1753c6(_0x4b96c7[_0xf692('0x10')](0x1f4,_0x5037c9['message']));});});};exports[_0xf692('0x41')]=function(_0x2ae5cd){var _0x28800e=this;return new Promise(function(_0x590425,_0x40ed2c){return db[_0xf692('0x1d')][_0xf692('0x2b')]({'raw':_0x2ae5cd[_0xf692('0x14')]?_0x2ae5cd[_0xf692('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x2ae5cd['options']?_0x2ae5cd[_0xf692('0x14')][_0xf692('0x24')]||null:null,'attributes':[[db[_0xf692('0x29')]['fn'](_0xf692('0x42'),db[_0xf692('0x29')]['fn']('IF',db[_0xf692('0x29')][_0xf692('0x43')]('`scheduledat`\x20>=\x20'+util[_0xf692('0x44')](_0xf692('0x45'),moment()[_0xf692('0x44')](_0xf692('0x46')))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})[_0xf692('0x1e')](function(_0x417b7d){logger[_0xf692('0xb')]('CountReScheduled',_0x2ae5cd);logger['debug']('CountReScheduled',_0x2ae5cd,JSON['stringify'](_0x417b7d));_0x590425(_0x417b7d);})[_0xf692('0x1b')](function(_0x3bedfc){logger[_0xf692('0x10')](_0xf692('0x41'),_0x3bedfc[_0xf692('0x11')],_0x2ae5cd);_0x40ed2c(_0x28800e[_0xf692('0x10')](0x1f4,_0x3bedfc[_0xf692('0x11')]));});});};exports[_0xf692('0x47')]=function(_0x59510d){var _0x1b3b50=this;return new Promise(function(_0x40b1a5,_0x5caaa2){return db[_0xf692('0x27')][_0xf692('0x28')]()[_0xf692('0x1e')](function(_0x433259){return db['sequelize'][_0xf692('0x2a')](function(_0x550344){return db[_0xf692('0x1d')][_0xf692('0x2b')]({'where':_0x59510d[_0xf692('0x14')]?_0x59510d[_0xf692('0x14')][_0xf692('0x24')]||null:null,'attributes':_0x59510d[_0xf692('0x14')]?_0x59510d['options'][_0xf692('0x16')]||null:null,'limit':0x1,'order':_0x59510d[_0xf692('0x14')]?_0x59510d['options'][_0xf692('0x2c')]||null:null,'group':db[_0xf692('0x1d')]['UserId'],'transaction':_0x550344,'lock':_0x550344['LOCK']['UPDATE'],'include':_0x59510d[_0xf692('0x14')]?_0x59510d[_0xf692('0x14')]['include']?_['map'](_0x59510d[_0xf692('0x14')][_0xf692('0x18')],function(_0x57df90){return{'model':db[_0x57df90[_0xf692('0x1a')]],'as':_0x57df90['as'],'attributes':_0x57df90[_0xf692('0x16')],'include':_0x57df90[_0xf692('0x18')]?_[_0xf692('0x19')](_0x57df90['include'],function(_0x307f7b){return{'model':db[_0x307f7b[_0xf692('0x1a')]],'as':_0x307f7b['as'],'attributes':_0x307f7b['attributes'],'include':_0x307f7b['include']?_[_0xf692('0x19')](_0x307f7b[_0xf692('0x18')],function(_0x409d08){return{'model':db[_0x409d08[_0xf692('0x1a')]],'as':_0x409d08['as'],'attributes':_0x409d08[_0xf692('0x16')]};}):[]};}):[]};}):[]:[]})[_0xf692('0x1e')](function(_0x25ea97){var _0x1e5c45=[];for(var _0x420524=0x0;_0x420524<_0x25ea97['length'];_0x420524+=0x1){_0x1e5c45[_0xf692('0x37')](_0x25ea97[_0x420524]['update'](_0x59510d['body'],{'transaction':_0x550344}));}return BPromise[_0xf692('0x38')](_0x1e5c45);});})[_0xf692('0x1e')](function(_0x587abe){logger[_0xf692('0xb')]('GetContactRecallMe',_0x59510d);logger['debug'](_0xf692('0x47'),_0x59510d,JSON[_0xf692('0xf')](_0x587abe));_0x40b1a5(_0x587abe);})[_0xf692('0x1b')](function(_0x1ebff3){logger[_0xf692('0x10')](_0xf692('0x47'),_0x1ebff3[_0xf692('0x11')],_0x59510d);_0x5caaa2(_0x1b3b50[_0xf692('0x10')](0x1f4,_0x1ebff3[_0xf692('0x11')]));});});});};exports['GetCmHopperPreview']=function(_0x26acc1){var _0x2fdf6=this;return new Promise(function(_0x4cf942,_0x135fee){db[_0xf692('0x27')][_0xf692('0x28')]()['then'](function(_0x139abd){return db[_0xf692('0x1d')][_0xf692('0x2b')]({'raw':_0x26acc1[_0xf692('0x14')]?_0x26acc1['options']['raw']===undefined?!![]:![]:!![],'where':_0x26acc1[_0xf692('0x14')]?_0x26acc1[_0xf692('0x14')]['where']||null:null,'attributes':_0x26acc1[_0xf692('0x14')]?_0x26acc1[_0xf692('0x14')][_0xf692('0x16')]||null:null,'limit':_0x26acc1[_0xf692('0x14')]?_0x26acc1[_0xf692('0x14')][_0xf692('0x17')]||null:null,'include':_0x26acc1[_0xf692('0x14')]?_0x26acc1[_0xf692('0x14')][_0xf692('0x18')]?_['map'](_0x26acc1[_0xf692('0x14')][_0xf692('0x18')],function(_0x3044e4){return{'model':db[_0x3044e4['model']],'as':_0x3044e4['as'],'attributes':_0x3044e4['as']==='Contact'?_[_0xf692('0x30')](_0x139abd):_0x3044e4[_0xf692('0x16')],'include':_0x3044e4[_0xf692('0x18')]?_[_0xf692('0x19')](_0x3044e4[_0xf692('0x18')],function(_0x1b6e58){return{'model':db[_0x1b6e58[_0xf692('0x1a')]],'as':_0x1b6e58['as'],'attributes':_0x1b6e58['attributes'],'include':_0x1b6e58[_0xf692('0x18')]?_[_0xf692('0x19')](_0x1b6e58[_0xf692('0x18')],function(_0x2bf41e){return{'model':db[_0x2bf41e[_0xf692('0x1a')]],'as':_0x2bf41e['as'],'attributes':_0x2bf41e[_0xf692('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d5da7){logger[_0xf692('0xb')]('GetCmHopper',_0x26acc1);logger[_0xf692('0xe')](_0xf692('0x13'),_0x26acc1,JSON['stringify'](_0x4d5da7));_0x4cf942(_0x4d5da7);})['catch'](function(_0xe8f1b2){logger[_0xf692('0x10')](_0xf692('0x13'),_0xe8f1b2['message'],_0x26acc1);_0x135fee(_0x2fdf6[_0xf692('0x10')](0x1f4,_0xe8f1b2[_0xf692('0x11')]));});});});};exports[_0xf692('0x48')]=function(_0x34fd4f){var _0x3d556f=this;return new Promise(function(_0x10a6e7,_0x2507f3){return db[_0xf692('0x29')]['transaction'](function(_0x318cca){return db[_0xf692('0x1d')][_0xf692('0x49')]({'active':![]},{'where':{},'transaction':_0x318cca})[_0xf692('0x1e')](function(_0x362659){logger[_0xf692('0xb')](_0xf692('0x48'),_0x34fd4f);logger['debug'](_0xf692('0x48'),_0x34fd4f,JSON[_0xf692('0xf')](_0x362659));_0x10a6e7(_0x362659);})[_0xf692('0x1b')](function(_0x4d59af){logger[_0xf692('0x10')](_0xf692('0x48'),_0x4d59af[_0xf692('0x11')],_0x34fd4f);_0x2507f3(_0x3d556f[_0xf692('0x10')](0x1f4,_0x4d59af[_0xf692('0x11')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index d12307d..14cc02a 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 _0x8325=['post','create','getPreview','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','/:id'];(function(_0x10f446,_0x4017e6){var _0x226f6d=function(_0x11a7e9){while(--_0x11a7e9){_0x10f446['push'](_0x10f446['shift']());}};_0x226f6d(++_0x4017e6);}(_0x8325,0x67));var _0x5832=function(_0x456b1d,_0x4d4ad7){_0x456b1d=_0x456b1d-0x0;var _0x37fe85=_0x8325[_0x456b1d];return _0x37fe85;};'use strict';var multer=require('multer');var util=require(_0x5832('0x0'));var path=require(_0x5832('0x1'));var timeout=require(_0x5832('0x2'));var express=require(_0x5832('0x3'));var router=express[_0x5832('0x4')]();var fs_extra=require(_0x5832('0x5'));var auth=require(_0x5832('0x6'));var interaction=require(_0x5832('0x7'));var config=require(_0x5832('0x8'));var controller=require(_0x5832('0x9'));router[_0x5832('0xa')]('/',auth[_0x5832('0xb')](),controller[_0x5832('0xc')]);router['get'](_0x5832('0xd'),auth[_0x5832('0xb')](),controller[_0x5832('0xe')]);router[_0x5832('0xa')](_0x5832('0xf'),auth[_0x5832('0xb')](),controller['getOpenContacts']);router[_0x5832('0xa')](_0x5832('0x10'),auth[_0x5832('0xb')](),controller['show']);router[_0x5832('0x11')]('/',auth['isAuthenticated'](),controller[_0x5832('0x12')]);router['post']('/preview',auth[_0x5832('0xb')](),controller[_0x5832('0x13')]);router[_0x5832('0x14')](_0x5832('0x10'),auth[_0x5832('0xb')](),controller['update']);router[_0x5832('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x5832('0x16')]);module[_0x5832('0x17')]=router; \ No newline at end of file +var _0x3123=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','index','isAuthenticated','describe','/opencontacts','getOpenContacts','/:id','create','/preview','getPreview','put','update'];(function(_0x309515,_0x55f470){var _0x51f8bd=function(_0x4cd1ee){while(--_0x4cd1ee){_0x309515['push'](_0x309515['shift']());}};_0x51f8bd(++_0x55f470);}(_0x3123,0xc3));var _0x3312=function(_0x305abc,_0x41da61){_0x305abc=_0x305abc-0x0;var _0x2fa55c=_0x3123[_0x305abc];return _0x2fa55c;};'use strict';var multer=require(_0x3312('0x0'));var util=require('util');var path=require(_0x3312('0x1'));var timeout=require(_0x3312('0x2'));var express=require(_0x3312('0x3'));var router=express[_0x3312('0x4')]();var fs_extra=require(_0x3312('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3312('0x6'));var config=require(_0x3312('0x7'));var controller=require(_0x3312('0x8'));router[_0x3312('0x9')]('/',auth['isAuthenticated'](),controller[_0x3312('0xa')]);router[_0x3312('0x9')]('/describe',auth[_0x3312('0xb')](),controller[_0x3312('0xc')]);router['get'](_0x3312('0xd'),auth[_0x3312('0xb')](),controller[_0x3312('0xe')]);router[_0x3312('0x9')](_0x3312('0xf'),auth[_0x3312('0xb')](),controller['show']);router['post']('/',auth[_0x3312('0xb')](),controller[_0x3312('0x10')]);router['post'](_0x3312('0x11'),auth[_0x3312('0xb')](),controller[_0x3312('0x12')]);router[_0x3312('0x13')](_0x3312('0xf'),auth[_0x3312('0xb')](),controller[_0x3312('0x14')]);router[_0x3312('0x15')]('/:id',auth[_0x3312('0xb')](),controller[_0x3312('0x16')]);module[_0x3312('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 5eb15eb..13c2861 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 _0x4753=['moment','sequelize','exports','INTEGER','contactListQueue'];(function(_0x5f3de3,_0x40f0f5){var _0x287e0d=function(_0x3189dc){while(--_0x3189dc){_0x5f3de3['push'](_0x5f3de3['shift']());}};_0x287e0d(++_0x40f0f5);}(_0x4753,0x1f4));var _0x3475=function(_0x4c7541,_0x39763a){_0x4c7541=_0x4c7541-0x0;var _0x13be07=_0x4753[_0x4c7541];return _0x13be07;};'use strict';var moment=require(_0x3475('0x0'));var Sequelize=require(_0x3475('0x1'));module[_0x3475('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x3475('0x3')],'unique':_0x3475('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x3475('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x2706=['STRING','INTEGER','contactListQueue','sequelize','exports'];(function(_0x340380,_0x4bd2a8){var _0x49ce1c=function(_0x4cb9e2){while(--_0x4cb9e2){_0x340380['push'](_0x340380['shift']());}};_0x49ce1c(++_0x4bd2a8);}(_0x2706,0x107));var _0x6270=function(_0x5c94ec,_0x45d06e){_0x5c94ec=_0x5c94ec-0x0;var _0x16b3a8=_0x2706[_0x5c94ec];return _0x16b3a8;};'use strict';var moment=require('moment');var Sequelize=require(_0x6270('0x0'));module[_0x6270('0x1')]={'phone':{'type':Sequelize[_0x6270('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x6270('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x6270('0x3')],'unique':_0x6270('0x4')},'VoiceQueueId':{'type':Sequelize[_0x6270('0x3')],'unique':_0x6270('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 94a478c..48edc53 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 _0x9068=['request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','error','stack','name','send','map','CmHopperBlack','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','body','describe','eml-format','fast-json-patch'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x9068,0x16b));var _0x8906=function(_0x5e9461,_0x4462a3){_0x5e9461=_0x5e9461-0x0;var _0x432c4a=_0x9068[_0x5e9461];return _0x432c4a;};'use strict';var emlformat=require(_0x8906('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8906('0x1'));var rp=require(_0x8906('0x2'));var moment=require(_0x8906('0x3'));var BPromise=require(_0x8906('0x4'));var Mustache=require(_0x8906('0x5'));var util=require(_0x8906('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x8906('0x7'));var ejs=require(_0x8906('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8906('0x9'));var squel=require(_0x8906('0xa'));var crypto=require('crypto');var jsforce=require(_0x8906('0xb'));var deskjs=require(_0x8906('0xc'));var toCsv=require(_0x8906('0x7'));var querystring=require(_0x8906('0xd'));var Papa=require('papaparse');var Redis=require(_0x8906('0xe'));var authService=require(_0x8906('0xf'));var qs=require(_0x8906('0x10'));var as=require(_0x8906('0x11'));var hardwareService=require(_0x8906('0x12'));var logger=require(_0x8906('0x13'))(_0x8906('0x14'));var utils=require('../../config/utils');var config=require(_0x8906('0x15'));var licenseUtil=require(_0x8906('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x352f51,_0x38e8ae){_0x38e8ae=_0x38e8ae||0xcc;return function(_0x1116a7){if(_0x1116a7){return _0x352f51[_0x8906('0x17')](_0x38e8ae);}return _0x352f51[_0x8906('0x18')](_0x38e8ae)[_0x8906('0x19')]();};}function respondWithResult(_0x9c3638,_0x115f48){_0x115f48=_0x115f48||0xc8;return function(_0x312e9e){if(_0x312e9e){return _0x9c3638[_0x8906('0x18')](_0x115f48)[_0x8906('0x1a')](_0x312e9e);}};}function respondWithFilteredResult(_0x575c19,_0x1c33ab){return function(_0x465442){if(_0x465442){var _0x1d339a=typeof _0x1c33ab[_0x8906('0x1b')]===_0x8906('0x1c')&&typeof _0x1c33ab['limit']===_0x8906('0x1c');var _0x2bdfe2=_0x465442['count'];var _0x37a8c6=_0x1d339a?0x0:_0x1c33ab[_0x8906('0x1b')];var _0x2c6ccd=_0x1d339a?_0x465442[_0x8906('0x1d')]:_0x1c33ab[_0x8906('0x1b')]+_0x1c33ab[_0x8906('0x1e')];var _0x4227ef;if(_0x2c6ccd>=_0x2bdfe2){_0x2c6ccd=_0x2bdfe2;_0x4227ef=0xc8;}else{_0x4227ef=0xce;}_0x575c19['status'](_0x4227ef);return _0x575c19[_0x8906('0x1f')](_0x8906('0x20'),_0x37a8c6+'-'+_0x2c6ccd+'/'+_0x2bdfe2)[_0x8906('0x1a')](_0x465442);}return null;};}function patchUpdates(_0x49ea17){return function(_0xfae9f1){try{jsonpatch[_0x8906('0x21')](_0xfae9f1,_0x49ea17,!![]);}catch(_0xca9d1d){return BPromise['reject'](_0xca9d1d);}return _0xfae9f1['save']();};}function saveUpdates(_0x1247da,_0x42ddbf){return function(_0x51130f){if(_0x51130f){return _0x51130f[_0x8906('0x22')](_0x1247da)[_0x8906('0x23')](function(_0x1b5186){return _0x1b5186;});}return null;};}function removeEntity(_0x203e8a,_0x513949){return function(_0xe11c4c){if(_0xe11c4c){return _0xe11c4c['destroy']()[_0x8906('0x23')](function(){_0x203e8a[_0x8906('0x18')](0xcc)[_0x8906('0x19')]();});}};}function handleEntityNotFound(_0x28cfbc,_0x24102f){return function(_0x11966e){if(!_0x11966e){_0x28cfbc[_0x8906('0x17')](0x194);}return _0x11966e;};}function handleError(_0x373d4f,_0x13e321){_0x13e321=_0x13e321||0x1f4;return function(_0x5a066d){logger[_0x8906('0x24')](_0x5a066d[_0x8906('0x25')]);if(_0x5a066d['name']){delete _0x5a066d[_0x8906('0x26')];}_0x373d4f['status'](_0x13e321)[_0x8906('0x27')](_0x5a066d);};}exports['index']=function(_0x5259f8,_0x1ecbd7){var _0x51da11={},_0x4a9e8e={},_0x36dc0f={'count':0x0,'rows':[]};var _0x2876a8=_[_0x8906('0x28')](db[_0x8906('0x29')]['rawAttributes'],function(_0x2d853c){return{'name':_0x2d853c['fieldName'],'type':_0x2d853c[_0x8906('0x2a')][_0x8906('0x2b')]};});_0x4a9e8e[_0x8906('0x2c')]=_[_0x8906('0x28')](_0x2876a8,'name');_0x4a9e8e[_0x8906('0x2d')]=_[_0x8906('0x2e')](_0x5259f8[_0x8906('0x2d')]);_0x4a9e8e[_0x8906('0x2f')]=_[_0x8906('0x30')](_0x4a9e8e['model'],_0x4a9e8e[_0x8906('0x2d')]);_0x51da11['attributes']=_['intersection'](_0x4a9e8e[_0x8906('0x2c')],qs['fields'](_0x5259f8[_0x8906('0x2d')][_0x8906('0x31')]));_0x51da11['attributes']=_0x51da11[_0x8906('0x32')]['length']?_0x51da11[_0x8906('0x32')]:_0x4a9e8e[_0x8906('0x2c')];if(!_0x5259f8['query'][_0x8906('0x33')](_0x8906('0x34'))){_0x51da11[_0x8906('0x1e')]=qs[_0x8906('0x1e')](_0x5259f8['query']['limit']);_0x51da11[_0x8906('0x1b')]=qs[_0x8906('0x1b')](_0x5259f8[_0x8906('0x2d')][_0x8906('0x1b')]);}_0x51da11[_0x8906('0x35')]=qs[_0x8906('0x36')](_0x5259f8[_0x8906('0x2d')][_0x8906('0x36')]);_0x51da11[_0x8906('0x37')]=qs[_0x8906('0x2f')](_[_0x8906('0x38')](_0x5259f8['query'],_0x4a9e8e[_0x8906('0x2f')]),_0x2876a8);if(_0x5259f8['query'][_0x8906('0x39')]){_0x51da11['where']=_[_0x8906('0x3a')](_0x51da11['where'],{'$or':_[_0x8906('0x28')](_0x2876a8,function(_0x172d31){if(_0x172d31[_0x8906('0x2a')]!==_0x8906('0x3b')){var _0x36aa83={};_0x36aa83[_0x172d31[_0x8906('0x26')]]={'$like':'%'+_0x5259f8[_0x8906('0x2d')][_0x8906('0x39')]+'%'};return _0x36aa83;}})});}_0x51da11=_[_0x8906('0x3a')]({},_0x51da11,_0x5259f8[_0x8906('0x3c')]);var _0x23e92a={'where':_0x51da11['where']};return db[_0x8906('0x29')][_0x8906('0x1d')](_0x23e92a)[_0x8906('0x23')](function(_0x37f6c7){_0x36dc0f[_0x8906('0x1d')]=_0x37f6c7;if(_0x5259f8['query'][_0x8906('0x3d')]){_0x51da11[_0x8906('0x3e')]=[{'all':!![]}];}return db[_0x8906('0x29')][_0x8906('0x3f')](_0x51da11);})[_0x8906('0x23')](function(_0x11d4c4){_0x36dc0f[_0x8906('0x40')]=_0x11d4c4;return _0x36dc0f;})[_0x8906('0x23')](respondWithFilteredResult(_0x1ecbd7,_0x51da11))[_0x8906('0x41')](handleError(_0x1ecbd7,null));};exports[_0x8906('0x42')]=function(_0x2aa1be,_0x1b125b){var _0xcfe322={'raw':!![],'where':{'id':_0x2aa1be[_0x8906('0x43')]['id']}},_0x2cd37b={};_0x2cd37b[_0x8906('0x2c')]=_[_0x8906('0x2e')](db[_0x8906('0x29')][_0x8906('0x44')]);_0x2cd37b[_0x8906('0x2d')]=_['keys'](_0x2aa1be[_0x8906('0x2d')]);_0x2cd37b['filters']=_[_0x8906('0x30')](_0x2cd37b['model'],_0x2cd37b[_0x8906('0x2d')]);_0xcfe322['attributes']=_[_0x8906('0x30')](_0x2cd37b['model'],qs['fields'](_0x2aa1be[_0x8906('0x2d')][_0x8906('0x31')]));_0xcfe322['attributes']=_0xcfe322['attributes'][_0x8906('0x45')]?_0xcfe322[_0x8906('0x32')]:_0x2cd37b[_0x8906('0x2c')];if(_0x2aa1be['query']['includeAll']){_0xcfe322[_0x8906('0x3e')]=[{'all':!![]}];}_0xcfe322=_[_0x8906('0x3a')]({},_0xcfe322,_0x2aa1be[_0x8906('0x3c')]);return db[_0x8906('0x29')][_0x8906('0x46')](_0xcfe322)[_0x8906('0x23')](handleEntityNotFound(_0x1b125b,null))[_0x8906('0x23')](respondWithResult(_0x1b125b,null))[_0x8906('0x41')](handleError(_0x1b125b,null));};exports[_0x8906('0x22')]=function(_0xa26625,_0x8d2dc3){if(_0xa26625[_0x8906('0x47')]['id']){delete _0xa26625[_0x8906('0x47')]['id'];}return db[_0x8906('0x29')][_0x8906('0x46')]({'where':{'id':_0xa26625[_0x8906('0x43')]['id']}})[_0x8906('0x23')](handleEntityNotFound(_0x8d2dc3,null))[_0x8906('0x23')](saveUpdates(_0xa26625[_0x8906('0x47')],null))[_0x8906('0x23')](respondWithResult(_0x8d2dc3,null))[_0x8906('0x41')](handleError(_0x8d2dc3,null));};exports['destroy']=function(_0x5eb4c4,_0x219490){return db[_0x8906('0x29')][_0x8906('0x46')]({'where':{'id':_0x5eb4c4[_0x8906('0x43')]['id']}})[_0x8906('0x23')](handleEntityNotFound(_0x219490,null))[_0x8906('0x23')](removeEntity(_0x219490,null))['catch'](handleError(_0x219490,null));};exports[_0x8906('0x48')]=function(_0x397445,_0x487dbe){return db['CmHopperBlack'][_0x8906('0x48')]()[_0x8906('0x23')](respondWithResult(_0x487dbe,null))[_0x8906('0x41')](handleError(_0x487dbe,null));}; \ No newline at end of file +var _0x93ef=['key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','CmHopperBlack','findAll','catch','find','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','type'];(function(_0x131545,_0x1849fe){var _0xb88554=function(_0xa4908){while(--_0xa4908){_0x131545['push'](_0x131545['shift']());}};_0xb88554(++_0x1849fe);}(_0x93ef,0x192));var _0xf93e=function(_0x19c0d9,_0x30fcec){_0x19c0d9=_0x19c0d9-0x0;var _0x4bafb4=_0x93ef[_0x19c0d9];return _0x4bafb4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf93e('0x0'));var zipdir=require(_0xf93e('0x1'));var jsonpatch=require(_0xf93e('0x2'));var rp=require(_0xf93e('0x3'));var moment=require(_0xf93e('0x4'));var BPromise=require(_0xf93e('0x5'));var Mustache=require(_0xf93e('0x6'));var util=require(_0xf93e('0x7'));var path=require(_0xf93e('0x8'));var sox=require(_0xf93e('0x9'));var csv=require(_0xf93e('0xa'));var ejs=require(_0xf93e('0xb'));var fs=require('fs');var fs_extra=require(_0xf93e('0xc'));var _=require(_0xf93e('0xd'));var squel=require('squel');var crypto=require(_0xf93e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf93e('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf93e('0x10'));var Papa=require(_0xf93e('0x11'));var Redis=require(_0xf93e('0x12'));var authService=require(_0xf93e('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf93e('0x14'));var logger=require(_0xf93e('0x15'))('api');var utils=require(_0xf93e('0x16'));var config=require(_0xf93e('0x17'));var licenseUtil=require(_0xf93e('0x18'));var db=require(_0xf93e('0x19'))['db'];function respondWithStatusCode(_0x4e0d5d,_0x5ca418){_0x5ca418=_0x5ca418||0xcc;return function(_0x575ae9){if(_0x575ae9){return _0x4e0d5d[_0xf93e('0x1a')](_0x5ca418);}return _0x4e0d5d[_0xf93e('0x1b')](_0x5ca418)[_0xf93e('0x1c')]();};}function respondWithResult(_0x35d323,_0x2c5a2c){_0x2c5a2c=_0x2c5a2c||0xc8;return function(_0x1d5e2d){if(_0x1d5e2d){return _0x35d323[_0xf93e('0x1b')](_0x2c5a2c)[_0xf93e('0x1d')](_0x1d5e2d);}};}function respondWithFilteredResult(_0x35e0df,_0x11e2d1){return function(_0x3693db){if(_0x3693db){var _0x18bb75=typeof _0x11e2d1[_0xf93e('0x1e')]===_0xf93e('0x1f')&&typeof _0x11e2d1[_0xf93e('0x20')]==='undefined';var _0x6b4404=_0x3693db[_0xf93e('0x21')];var _0x3acf0d=_0x18bb75?0x0:_0x11e2d1[_0xf93e('0x1e')];var _0x329e06=_0x18bb75?_0x3693db[_0xf93e('0x21')]:_0x11e2d1[_0xf93e('0x1e')]+_0x11e2d1[_0xf93e('0x20')];var _0x30a458;if(_0x329e06>=_0x6b4404){_0x329e06=_0x6b4404;_0x30a458=0xc8;}else{_0x30a458=0xce;}_0x35e0df[_0xf93e('0x1b')](_0x30a458);return _0x35e0df[_0xf93e('0x22')]('Content-Range',_0x3acf0d+'-'+_0x329e06+'/'+_0x6b4404)[_0xf93e('0x1d')](_0x3693db);}return null;};}function patchUpdates(_0x549456){return function(_0x42083c){try{jsonpatch[_0xf93e('0x23')](_0x42083c,_0x549456,!![]);}catch(_0x32b1f2){return BPromise[_0xf93e('0x24')](_0x32b1f2);}return _0x42083c[_0xf93e('0x25')]();};}function saveUpdates(_0x48d578,_0x110a6f){return function(_0x36a955){if(_0x36a955){return _0x36a955[_0xf93e('0x26')](_0x48d578)[_0xf93e('0x27')](function(_0xc7dcad){return _0xc7dcad;});}return null;};}function removeEntity(_0x3909e5,_0xc93583){return function(_0x4488f6){if(_0x4488f6){return _0x4488f6[_0xf93e('0x28')]()['then'](function(){_0x3909e5[_0xf93e('0x1b')](0xcc)[_0xf93e('0x1c')]();});}};}function handleEntityNotFound(_0x229f16,_0x3409b6){return function(_0x2aaff4){if(!_0x2aaff4){_0x229f16[_0xf93e('0x1a')](0x194);}return _0x2aaff4;};}function handleError(_0x2ba0e7,_0x50b1c8){_0x50b1c8=_0x50b1c8||0x1f4;return function(_0x2fe47e){logger['error'](_0x2fe47e[_0xf93e('0x29')]);if(_0x2fe47e[_0xf93e('0x2a')]){delete _0x2fe47e['name'];}_0x2ba0e7[_0xf93e('0x1b')](_0x50b1c8)['send'](_0x2fe47e);};}exports[_0xf93e('0x2b')]=function(_0x3b2b3b,_0x2f145d){var _0x5a79e3={},_0x515a3d={},_0x55a488={'count':0x0,'rows':[]};var _0x354a97=_[_0xf93e('0x2c')](db['CmHopperBlack'][_0xf93e('0x2d')],function(_0x5f4b62){return{'name':_0x5f4b62[_0xf93e('0x2e')],'type':_0x5f4b62[_0xf93e('0x2f')][_0xf93e('0x30')]};});_0x515a3d['model']=_[_0xf93e('0x2c')](_0x354a97,_0xf93e('0x2a'));_0x515a3d[_0xf93e('0x31')]=_[_0xf93e('0x32')](_0x3b2b3b[_0xf93e('0x31')]);_0x515a3d[_0xf93e('0x33')]=_[_0xf93e('0x34')](_0x515a3d[_0xf93e('0x35')],_0x515a3d[_0xf93e('0x31')]);_0x5a79e3[_0xf93e('0x36')]=_[_0xf93e('0x34')](_0x515a3d[_0xf93e('0x35')],qs[_0xf93e('0x37')](_0x3b2b3b[_0xf93e('0x31')][_0xf93e('0x37')]));_0x5a79e3['attributes']=_0x5a79e3[_0xf93e('0x36')][_0xf93e('0x38')]?_0x5a79e3['attributes']:_0x515a3d[_0xf93e('0x35')];if(!_0x3b2b3b[_0xf93e('0x31')][_0xf93e('0x39')](_0xf93e('0x3a'))){_0x5a79e3[_0xf93e('0x20')]=qs[_0xf93e('0x20')](_0x3b2b3b[_0xf93e('0x31')][_0xf93e('0x20')]);_0x5a79e3[_0xf93e('0x1e')]=qs['offset'](_0x3b2b3b['query']['offset']);}_0x5a79e3[_0xf93e('0x3b')]=qs[_0xf93e('0x3c')](_0x3b2b3b[_0xf93e('0x31')][_0xf93e('0x3c')]);_0x5a79e3[_0xf93e('0x3d')]=qs[_0xf93e('0x33')](_['pick'](_0x3b2b3b[_0xf93e('0x31')],_0x515a3d['filters']),_0x354a97);if(_0x3b2b3b[_0xf93e('0x31')][_0xf93e('0x3e')]){_0x5a79e3['where']=_[_0xf93e('0x3f')](_0x5a79e3[_0xf93e('0x3d')],{'$or':_[_0xf93e('0x2c')](_0x354a97,function(_0x272a07){if(_0x272a07[_0xf93e('0x2f')]!==_0xf93e('0x40')){var _0x48b23d={};_0x48b23d[_0x272a07[_0xf93e('0x2a')]]={'$like':'%'+_0x3b2b3b['query'][_0xf93e('0x3e')]+'%'};return _0x48b23d;}})});}_0x5a79e3=_['merge']({},_0x5a79e3,_0x3b2b3b[_0xf93e('0x41')]);var _0x4dee81={'where':_0x5a79e3[_0xf93e('0x3d')]};return db['CmHopperBlack'][_0xf93e('0x21')](_0x4dee81)['then'](function(_0x540376){_0x55a488[_0xf93e('0x21')]=_0x540376;if(_0x3b2b3b[_0xf93e('0x31')][_0xf93e('0x42')]){_0x5a79e3[_0xf93e('0x43')]=[{'all':!![]}];}return db[_0xf93e('0x44')][_0xf93e('0x45')](_0x5a79e3);})['then'](function(_0x30d04e){_0x55a488['rows']=_0x30d04e;return _0x55a488;})[_0xf93e('0x27')](respondWithFilteredResult(_0x2f145d,_0x5a79e3))[_0xf93e('0x46')](handleError(_0x2f145d,null));};exports['show']=function(_0x304c79,_0x35eced){var _0x4eccf9={'raw':!![],'where':{'id':_0x304c79['params']['id']}},_0x44d0ef={};_0x44d0ef[_0xf93e('0x35')]=_[_0xf93e('0x32')](db[_0xf93e('0x44')][_0xf93e('0x2d')]);_0x44d0ef[_0xf93e('0x31')]=_[_0xf93e('0x32')](_0x304c79[_0xf93e('0x31')]);_0x44d0ef[_0xf93e('0x33')]=_[_0xf93e('0x34')](_0x44d0ef[_0xf93e('0x35')],_0x44d0ef[_0xf93e('0x31')]);_0x4eccf9[_0xf93e('0x36')]=_[_0xf93e('0x34')](_0x44d0ef['model'],qs['fields'](_0x304c79[_0xf93e('0x31')][_0xf93e('0x37')]));_0x4eccf9[_0xf93e('0x36')]=_0x4eccf9[_0xf93e('0x36')][_0xf93e('0x38')]?_0x4eccf9['attributes']:_0x44d0ef[_0xf93e('0x35')];if(_0x304c79['query'][_0xf93e('0x42')]){_0x4eccf9['include']=[{'all':!![]}];}_0x4eccf9=_[_0xf93e('0x3f')]({},_0x4eccf9,_0x304c79[_0xf93e('0x41')]);return db['CmHopperBlack'][_0xf93e('0x47')](_0x4eccf9)[_0xf93e('0x27')](handleEntityNotFound(_0x35eced,null))['then'](respondWithResult(_0x35eced,null))[_0xf93e('0x46')](handleError(_0x35eced,null));};exports[_0xf93e('0x26')]=function(_0x331dc2,_0x5b64c2){if(_0x331dc2['body']['id']){delete _0x331dc2[_0xf93e('0x48')]['id'];}return db[_0xf93e('0x44')][_0xf93e('0x47')]({'where':{'id':_0x331dc2[_0xf93e('0x49')]['id']}})[_0xf93e('0x27')](handleEntityNotFound(_0x5b64c2,null))[_0xf93e('0x27')](saveUpdates(_0x331dc2[_0xf93e('0x48')],null))[_0xf93e('0x27')](respondWithResult(_0x5b64c2,null))[_0xf93e('0x46')](handleError(_0x5b64c2,null));};exports[_0xf93e('0x28')]=function(_0x41d37f,_0x4f2135){return db[_0xf93e('0x44')]['find']({'where':{'id':_0x41d37f[_0xf93e('0x49')]['id']}})[_0xf93e('0x27')](handleEntityNotFound(_0x4f2135,null))[_0xf93e('0x27')](removeEntity(_0x4f2135,null))['catch'](handleError(_0x4f2135,null));};exports[_0xf93e('0x4a')]=function(_0x16cc5b,_0x5b061f){return db[_0xf93e('0x44')][_0xf93e('0x4a')]()['then'](respondWithResult(_0x5b061f,null))[_0xf93e('0x46')](handleError(_0x5b061f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 9c1c260..db056ba 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 _0x1a17=['rimraf','./cmHopperBlack.attributes','CmHopperBlack','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x22d667,_0x4ab6f6){var _0xc8eba0=function(_0x217df2){while(--_0x217df2){_0x22d667['push'](_0x22d667['shift']());}};_0xc8eba0(++_0x4ab6f6);}(_0x1a17,0x1f2));var _0x71a1=function(_0x49a3b7,_0x5d2586){_0x49a3b7=_0x49a3b7-0x0;var _0x569e43=_0x1a17[_0x49a3b7];return _0x569e43;};'use strict';var _=require('lodash');var util=require(_0x71a1('0x0'));var logger=require(_0x71a1('0x1'))(_0x71a1('0x2'));var moment=require(_0x71a1('0x3'));var BPromise=require(_0x71a1('0x4'));var rp=require(_0x71a1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x71a1('0x6'));var config=require('../../config/environment');var attributes=require(_0x71a1('0x7'));module['exports']=function(_0x3716ff,_0x1d078c){return _0x3716ff['define'](_0x71a1('0x8'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde76=['exports','define','CmHopperBlack','cm_hopper_black','lodash','util','api','path','rimraf','../../config/environment'];(function(_0x38847f,_0x320e81){var _0x36e9cb=function(_0x2c3e3a){while(--_0x2c3e3a){_0x38847f['push'](_0x38847f['shift']());}};_0x36e9cb(++_0x320e81);}(_0xde76,0x144));var _0x6de7=function(_0x16aaf4,_0x2b7413){_0x16aaf4=_0x16aaf4-0x0;var _0x3c958e=_0xde76[_0x16aaf4];return _0x3c958e;};'use strict';var _=require(_0x6de7('0x0'));var util=require(_0x6de7('0x1'));var logger=require('../../config/logger')(_0x6de7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6de7('0x3'));var rimraf=require(_0x6de7('0x4'));var config=require(_0x6de7('0x5'));var attributes=require('./cmHopperBlack.attributes');module[_0x6de7('0x6')]=function(_0x4fcc80,_0x3856ad){return _0x4fcc80[_0x6de7('0x7')](_0x6de7('0x8'),attributes,{'tableName':_0x6de7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 00a36ab..060d3b1 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 _0x1906=['then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCmHopperBlack','CmHopperBlack','options','raw','where','limit','include','map','attributes','model','catch','UpdateCmHopperBlack','body','DestroyCmHopperBlack','destroy','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x1906,0x124));var _0x6190=function(_0x4b5c91,_0x73283d){_0x4b5c91=_0x4b5c91-0x0;var _0x596f37=_0x1906[_0x4b5c91];return _0x596f37;};'use strict';var _=require(_0x6190('0x0'));var util=require('util');var moment=require(_0x6190('0x1'));var BPromise=require('bluebird');var rs=require(_0x6190('0x2'));var fs=require('fs');var Redis=require(_0x6190('0x3'));var db=require(_0x6190('0x4'))['db'];var utils=require(_0x6190('0x5'));var logger=require(_0x6190('0x6'))(_0x6190('0x7'));var config=require(_0x6190('0x8'));var jayson=require(_0x6190('0x9'));var client=jayson['client'][_0x6190('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8bf8aa,_0x54f20a,_0x2680bd){return new BPromise(function(_0x2f7d9e,_0x84a866){return client[_0x6190('0xb')](_0x8bf8aa,_0x2680bd)[_0x6190('0xc')](function(_0x4ae438){logger[_0x6190('0xd')](_0x6190('0xe'),_0x54f20a,_0x6190('0xf'));logger[_0x6190('0x10')](_0x6190('0x11'),_0x54f20a,_0x6190('0xf'),JSON[_0x6190('0x12')](_0x4ae438));if(_0x4ae438[_0x6190('0x13')]){if(_0x4ae438['error'][_0x6190('0x14')]===0x1f4){logger['error'](_0x6190('0xe'),_0x54f20a,_0x4ae438[_0x6190('0x13')]['message']);return _0x84a866(_0x4ae438[_0x6190('0x13')][_0x6190('0x15')]);}logger[_0x6190('0x13')]('CmHopperBlack,\x20%s,\x20%s',_0x54f20a,_0x4ae438[_0x6190('0x13')]['message']);return _0x2f7d9e(_0x4ae438[_0x6190('0x13')][_0x6190('0x15')]);}else{logger[_0x6190('0xd')](_0x6190('0xe'),_0x54f20a,_0x6190('0xf'));_0x2f7d9e(_0x4ae438[_0x6190('0x16')][_0x6190('0x15')]);}})['catch'](function(_0x3ae306){logger['error'](_0x6190('0xe'),_0x54f20a,_0x3ae306);_0x84a866(_0x3ae306);});});}exports[_0x6190('0x17')]=function(_0x41e085){var _0x37481d=this;return new Promise(function(_0x2deefd,_0x2e3077){return db[_0x6190('0x18')]['findAll']({'raw':_0x41e085['options']?_0x41e085[_0x6190('0x19')][_0x6190('0x1a')]===undefined?!![]:![]:!![],'where':_0x41e085['options']?_0x41e085[_0x6190('0x19')][_0x6190('0x1b')]||null:null,'attributes':_0x41e085['options']?_0x41e085[_0x6190('0x19')]['attributes']||null:null,'limit':_0x41e085[_0x6190('0x19')]?_0x41e085[_0x6190('0x19')][_0x6190('0x1c')]||null:null,'include':_0x41e085[_0x6190('0x19')]?_0x41e085[_0x6190('0x19')][_0x6190('0x1d')]?_[_0x6190('0x1e')](_0x41e085[_0x6190('0x19')]['include'],function(_0x47d85e){return{'model':db[_0x47d85e['model']],'as':_0x47d85e['as'],'attributes':_0x47d85e[_0x6190('0x1f')],'include':_0x47d85e[_0x6190('0x1d')]?_[_0x6190('0x1e')](_0x47d85e[_0x6190('0x1d')],function(_0x3c9c30){return{'model':db[_0x3c9c30[_0x6190('0x20')]],'as':_0x3c9c30['as'],'attributes':_0x3c9c30[_0x6190('0x1f')],'include':_0x3c9c30[_0x6190('0x1d')]?_[_0x6190('0x1e')](_0x3c9c30['include'],function(_0x60ca63){return{'model':db[_0x60ca63['model']],'as':_0x60ca63['as'],'attributes':_0x60ca63[_0x6190('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6190('0xc')](function(_0x3116f9){logger[_0x6190('0xd')](_0x6190('0x17'),_0x41e085);logger[_0x6190('0x10')](_0x6190('0x17'),_0x41e085,JSON[_0x6190('0x12')](_0x3116f9));_0x2deefd(_0x3116f9);})[_0x6190('0x21')](function(_0x7d5077){logger[_0x6190('0x13')](_0x6190('0x17'),_0x7d5077[_0x6190('0x15')],_0x41e085);_0x2e3077(_0x37481d['error'](0x1f4,_0x7d5077[_0x6190('0x15')]));});});};exports[_0x6190('0x22')]=function(_0x3cfd86){var _0x11a5a9=this;return new Promise(function(_0x1e6a62,_0x4cd663){return db['CmHopperBlack']['update'](_0x3cfd86[_0x6190('0x23')],{'raw':_0x3cfd86['options']?_0x3cfd86[_0x6190('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cfd86[_0x6190('0x19')]?_0x3cfd86[_0x6190('0x19')][_0x6190('0x1b')]||null:null,'attributes':_0x3cfd86[_0x6190('0x19')]?_0x3cfd86[_0x6190('0x19')][_0x6190('0x1f')]||null:null,'limit':_0x3cfd86['options']?_0x3cfd86['options']['limit']||null:null})[_0x6190('0xc')](function(_0x600de4){logger['info'](_0x6190('0x22'),_0x3cfd86);logger['debug'](_0x6190('0x22'),_0x3cfd86,JSON[_0x6190('0x12')](_0x600de4));_0x1e6a62(_0x600de4);})[_0x6190('0x21')](function(_0x29350b){logger[_0x6190('0x13')](_0x6190('0x22'),_0x29350b[_0x6190('0x15')],_0x3cfd86);_0x4cd663(_0x11a5a9[_0x6190('0x13')](0x1f4,_0x29350b[_0x6190('0x15')]));});});};exports[_0x6190('0x24')]=function(_0x59301b){var _0x33d7ef=this;return new Promise(function(_0x542e45,_0x5cc99e){return db['CmHopperBlack'][_0x6190('0x25')]({'where':_0x59301b[_0x6190('0x19')]?_0x59301b['options']['where']||null:null})['then'](function(_0x1c4c5b){logger[_0x6190('0xd')](_0x6190('0x24'),_0x59301b);logger[_0x6190('0x10')](_0x6190('0x24'),_0x59301b,JSON[_0x6190('0x12')](_0x1c4c5b));_0x542e45(_0x1c4c5b);})['catch'](function(_0x27dc4a){logger['error'](_0x6190('0x24'),_0x27dc4a['message'],_0x59301b);_0x5cc99e(_0x33d7ef[_0x6190('0x13')](0x1f4,_0x27dc4a['message']));});});}; \ No newline at end of file +var _0x42dc=['UpdateCmHopperBlack','body','raw','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','where','attributes','limit','include','model','map'];(function(_0x3d4234,_0x247d7f){var _0x4cac3b=function(_0x2536b9){while(--_0x2536b9){_0x3d4234['push'](_0x3d4234['shift']());}};_0x4cac3b(++_0x247d7f);}(_0x42dc,0xa5));var _0xc42d=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x42dc[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xc42d('0x0'));var util=require(_0xc42d('0x1'));var moment=require(_0xc42d('0x2'));var BPromise=require(_0xc42d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc42d('0x4'));var db=require(_0xc42d('0x5'))['db'];var utils=require(_0xc42d('0x6'));var logger=require(_0xc42d('0x7'))(_0xc42d('0x8'));var config=require('../../config/environment');var jayson=require(_0xc42d('0x9'));var client=jayson[_0xc42d('0xa')][_0xc42d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42092e,_0x3f55a9,_0x5dde92){return new BPromise(function(_0x2ba7ba,_0x441fba){return client[_0xc42d('0xc')](_0x42092e,_0x5dde92)[_0xc42d('0xd')](function(_0x17dfe7){logger['info'](_0xc42d('0xe'),_0x3f55a9,_0xc42d('0xf'));logger[_0xc42d('0x10')](_0xc42d('0x11'),_0x3f55a9,_0xc42d('0xf'),JSON[_0xc42d('0x12')](_0x17dfe7));if(_0x17dfe7[_0xc42d('0x13')]){if(_0x17dfe7[_0xc42d('0x13')][_0xc42d('0x14')]===0x1f4){logger[_0xc42d('0x13')](_0xc42d('0xe'),_0x3f55a9,_0x17dfe7['error'][_0xc42d('0x15')]);return _0x441fba(_0x17dfe7[_0xc42d('0x13')][_0xc42d('0x15')]);}logger[_0xc42d('0x13')](_0xc42d('0xe'),_0x3f55a9,_0x17dfe7[_0xc42d('0x13')]['message']);return _0x2ba7ba(_0x17dfe7[_0xc42d('0x13')]['message']);}else{logger[_0xc42d('0x16')](_0xc42d('0xe'),_0x3f55a9,_0xc42d('0xf'));_0x2ba7ba(_0x17dfe7[_0xc42d('0x17')]['message']);}})[_0xc42d('0x18')](function(_0x2dfba2){logger['error'](_0xc42d('0xe'),_0x3f55a9,_0x2dfba2);_0x441fba(_0x2dfba2);});});}exports[_0xc42d('0x19')]=function(_0x143f11){var _0x42fc5b=this;return new Promise(function(_0x44cb18,_0x570c3e){return db[_0xc42d('0x1a')][_0xc42d('0x1b')]({'raw':_0x143f11['options']?_0x143f11[_0xc42d('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x143f11['options']?_0x143f11[_0xc42d('0x1c')][_0xc42d('0x1d')]||null:null,'attributes':_0x143f11['options']?_0x143f11['options'][_0xc42d('0x1e')]||null:null,'limit':_0x143f11[_0xc42d('0x1c')]?_0x143f11['options'][_0xc42d('0x1f')]||null:null,'include':_0x143f11[_0xc42d('0x1c')]?_0x143f11[_0xc42d('0x1c')][_0xc42d('0x20')]?_['map'](_0x143f11[_0xc42d('0x1c')][_0xc42d('0x20')],function(_0x30816d){return{'model':db[_0x30816d[_0xc42d('0x21')]],'as':_0x30816d['as'],'attributes':_0x30816d['attributes'],'include':_0x30816d['include']?_[_0xc42d('0x22')](_0x30816d[_0xc42d('0x20')],function(_0x4b6645){return{'model':db[_0x4b6645[_0xc42d('0x21')]],'as':_0x4b6645['as'],'attributes':_0x4b6645['attributes'],'include':_0x4b6645[_0xc42d('0x20')]?_[_0xc42d('0x22')](_0x4b6645[_0xc42d('0x20')],function(_0x47e476){return{'model':db[_0x47e476['model']],'as':_0x47e476['as'],'attributes':_0x47e476[_0xc42d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc42d('0xd')](function(_0x395735){logger[_0xc42d('0x16')](_0xc42d('0x19'),_0x143f11);logger['debug'](_0xc42d('0x19'),_0x143f11,JSON['stringify'](_0x395735));_0x44cb18(_0x395735);})[_0xc42d('0x18')](function(_0x575e15){logger[_0xc42d('0x13')](_0xc42d('0x19'),_0x575e15[_0xc42d('0x15')],_0x143f11);_0x570c3e(_0x42fc5b['error'](0x1f4,_0x575e15[_0xc42d('0x15')]));});});};exports[_0xc42d('0x23')]=function(_0x2cbd4b){var _0x273aaf=this;return new Promise(function(_0x3ef19b,_0x15de96){return db[_0xc42d('0x1a')]['update'](_0x2cbd4b[_0xc42d('0x24')],{'raw':_0x2cbd4b[_0xc42d('0x1c')]?_0x2cbd4b[_0xc42d('0x1c')][_0xc42d('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2cbd4b[_0xc42d('0x1c')]?_0x2cbd4b[_0xc42d('0x1c')]['where']||null:null,'attributes':_0x2cbd4b[_0xc42d('0x1c')]?_0x2cbd4b[_0xc42d('0x1c')][_0xc42d('0x1e')]||null:null,'limit':_0x2cbd4b[_0xc42d('0x1c')]?_0x2cbd4b[_0xc42d('0x1c')][_0xc42d('0x1f')]||null:null})[_0xc42d('0xd')](function(_0x33ad87){logger[_0xc42d('0x16')](_0xc42d('0x23'),_0x2cbd4b);logger[_0xc42d('0x10')](_0xc42d('0x23'),_0x2cbd4b,JSON[_0xc42d('0x12')](_0x33ad87));_0x3ef19b(_0x33ad87);})[_0xc42d('0x18')](function(_0x3ec8db){logger[_0xc42d('0x13')](_0xc42d('0x23'),_0x3ec8db[_0xc42d('0x15')],_0x2cbd4b);_0x15de96(_0x273aaf[_0xc42d('0x13')](0x1f4,_0x3ec8db[_0xc42d('0x15')]));});});};exports[_0xc42d('0x26')]=function(_0x269bf8){var _0x36603d=this;return new Promise(function(_0x1d5b82,_0xae607d){return db[_0xc42d('0x1a')][_0xc42d('0x27')]({'where':_0x269bf8[_0xc42d('0x1c')]?_0x269bf8['options'][_0xc42d('0x1d')]||null:null})[_0xc42d('0xd')](function(_0x25a5cc){logger['info'](_0xc42d('0x26'),_0x269bf8);logger[_0xc42d('0x10')](_0xc42d('0x26'),_0x269bf8,JSON['stringify'](_0x25a5cc));_0x1d5b82(_0x25a5cc);})['catch'](function(_0x4180d6){logger[_0xc42d('0x13')](_0xc42d('0x26'),_0x4180d6['message'],_0x269bf8);_0xae607d(_0x36603d[_0xc42d('0x13')](0x1f4,_0x4180d6[_0xc42d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 78ebcd2..ed0bdb4 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 _0x7a54=['./cmHopperBlack.controller','get','index','/describe','isAuthenticated','put','/:id','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x48020,_0x2aae5c){var _0x12d307=function(_0x5ee146){while(--_0x5ee146){_0x48020['push'](_0x48020['shift']());}};_0x12d307(++_0x2aae5c);}(_0x7a54,0x106));var _0x47a5=function(_0x1a5834,_0x4a0dce){_0x1a5834=_0x1a5834-0x0;var _0x1d7ec5=_0x7a54[_0x1a5834];return _0x1d7ec5;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0xd')](_0x47a5('0xe'),auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router['delete']('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x10')]);module[_0x47a5('0x11')]=router; \ No newline at end of file +var _0x31f0=['fs-extra','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','describe','/:id','show','put','update','delete','exports','multer','path','express','Router'];(function(_0x58a975,_0x4f7451){var _0x47f055=function(_0x4f57e1){while(--_0x4f57e1){_0x58a975['push'](_0x58a975['shift']());}};_0x47f055(++_0x4f7451);}(_0x31f0,0xb7));var _0x031f=function(_0x4af826,_0x256a74){_0x4af826=_0x4af826-0x0;var _0x1c2a7b=_0x31f0[_0x4af826];return _0x1c2a7b;};'use strict';var multer=require(_0x031f('0x0'));var util=require('util');var path=require(_0x031f('0x1'));var timeout=require('connect-timeout');var express=require(_0x031f('0x2'));var router=express[_0x031f('0x3')]();var fs_extra=require(_0x031f('0x4'));var auth=require(_0x031f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x031f('0x6'));var controller=require(_0x031f('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x031f('0x8')]('/describe',auth[_0x031f('0x9')](),controller[_0x031f('0xa')]);router[_0x031f('0x8')](_0x031f('0xb'),auth['isAuthenticated'](),controller[_0x031f('0xc')]);router[_0x031f('0xd')](_0x031f('0xb'),auth[_0x031f('0x9')](),controller[_0x031f('0xe')]);router[_0x031f('0xf')](_0x031f('0xb'),auth[_0x031f('0x9')](),controller['destroy']);module[_0x031f('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 913980c..8359e90 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 _0x024e=['DATE','getDataValue','setDataValue','followuptime','seconds','dispositionat','BOOLEAN','moment','exports','INTEGER','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x024e,0xe3));var _0xe024=function(_0x257b0e,_0x563d7e){_0x257b0e=_0x257b0e-0x0;var _0x27ac2a=_0x024e[_0x257b0e];return _0x27ac2a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe024('0x0'));module[_0xe024('0x1')]={'state':{'type':Sequelize[_0xe024('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xe024('0x3')]},'scheduledat':{'type':Sequelize[_0xe024('0x4')]},'countbusyretry':{'type':Sequelize[_0xe024('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe024('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe024('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xe024('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xe024('0x3')]},'originatecalleridname':{'type':Sequelize[_0xe024('0x3')]},'calleridnum':{'type':Sequelize[_0xe024('0x3')]},'calleridname':{'type':Sequelize[_0xe024('0x3')]},'starttime':{'type':Sequelize[_0xe024('0x4')]},'responsetime':{'type':Sequelize[_0xe024('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xe024('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xe024('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe024('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xe024('0x3')]},'campaign':{'type':Sequelize[_0xe024('0x3')]},'campaigntype':{'type':Sequelize[_0xe024('0x3')]},'membername':{'type':Sequelize[_0xe024('0x3')]},'reason':{'type':Sequelize[_0xe024('0x3')]},'disposition':{'type':Sequelize[_0xe024('0x3')]},'secondDisposition':{'type':Sequelize[_0xe024('0x3')]},'thirdDisposition':{'type':Sequelize[_0xe024('0x3')]},'dispositionat':{'type':Sequelize[_0xe024('0x4')],'set':function(_0x386256){var _0x51642a=this[_0xe024('0x5')]('endtime');if(_0x51642a&&_0x386256){this[_0xe024('0x6')](_0xe024('0x7'),moment(_0x386256)['diff'](moment(_0x51642a),_0xe024('0x8')));}return this[_0xe024('0x6')](_0xe024('0x9'),_0x386256);}},'amd':{'type':Sequelize[_0xe024('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0xe024('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xe024('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xe024('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xe024('0x4')]},'callback':{'type':Sequelize[_0xe024('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe024('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xe024('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xe024('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xe024('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe024('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xea26=['seconds','setDataValue','dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','endtime','followuptime','diff'];(function(_0x4ed7b1,_0x321543){var _0x5dfe21=function(_0x4b1d59){while(--_0x4b1d59){_0x4ed7b1['push'](_0x4ed7b1['shift']());}};_0x5dfe21(++_0x321543);}(_0xea26,0x170));var _0x6ea2=function(_0x264528,_0x3a18d7){_0x264528=_0x264528-0x0;var _0x3bac1d=_0xea26[_0x264528];return _0x3bac1d;};'use strict';var Sequelize=require(_0x6ea2('0x0'));var moment=require(_0x6ea2('0x1'));module[_0x6ea2('0x2')]={'state':{'type':Sequelize[_0x6ea2('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x6ea2('0x4')]},'scheduledat':{'type':Sequelize[_0x6ea2('0x5')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6ea2('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6ea2('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x6ea2('0x4')]},'originatecalleridname':{'type':Sequelize[_0x6ea2('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6ea2('0x4')]},'starttime':{'type':Sequelize[_0x6ea2('0x5')]},'responsetime':{'type':Sequelize[_0x6ea2('0x5')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x6ea2('0x5')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x6ea2('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6ea2('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6ea2('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6ea2('0x4')]},'campaign':{'type':Sequelize[_0x6ea2('0x4')]},'campaigntype':{'type':Sequelize[_0x6ea2('0x4')]},'membername':{'type':Sequelize[_0x6ea2('0x4')]},'reason':{'type':Sequelize[_0x6ea2('0x4')]},'disposition':{'type':Sequelize[_0x6ea2('0x4')]},'secondDisposition':{'type':Sequelize[_0x6ea2('0x4')]},'thirdDisposition':{'type':Sequelize[_0x6ea2('0x4')]},'dispositionat':{'type':Sequelize[_0x6ea2('0x5')],'set':function(_0x184943){var _0x6e5d00=this['getDataValue'](_0x6ea2('0x6'));if(_0x6e5d00&&_0x184943){this['setDataValue'](_0x6ea2('0x7'),moment(_0x184943)[_0x6ea2('0x8')](moment(_0x6e5d00),_0x6ea2('0x9')));}return this[_0x6ea2('0xa')](_0x6ea2('0xb'),_0x184943);}},'amd':{'type':Sequelize[_0x6ea2('0xc')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x6ea2('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x6ea2('0x5')]},'callback':{'type':Sequelize[_0x6ea2('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x6ea2('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x6ea2('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x6ea2('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6ea2('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6ea2('0x3')],'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 34eaa6f..ded4497 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 _0x4888=['ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','NOW()','from','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','find','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','cm_hopper_final','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','apply','reject','save','then','sendStatus','error','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','CmHopperFinal','includeAll','include','rows','catch','params','options','describe','update','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','COUNT','sequelize','literal','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','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','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','dropContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','createdAt','updatedAt','select','field','ANY_VALUE(ContactId)','ContactId'];(function(_0x4e90e3,_0x570a1d){var _0x295e5b=function(_0x754043){while(--_0x754043){_0x4e90e3['push'](_0x4e90e3['shift']());}};_0x295e5b(++_0x570a1d);}(_0x4888,0x198));var _0x8488=function(_0x292f93,_0x2c6e8e){_0x292f93=_0x292f93-0x0;var _0x5a94b1=_0x4888[_0x292f93];return _0x5a94b1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8488('0x0'));var zipdir=require(_0x8488('0x1'));var jsonpatch=require(_0x8488('0x2'));var rp=require(_0x8488('0x3'));var moment=require(_0x8488('0x4'));var BPromise=require(_0x8488('0x5'));var Mustache=require(_0x8488('0x6'));var util=require('util');var path=require(_0x8488('0x7'));var sox=require(_0x8488('0x8'));var csv=require(_0x8488('0x9'));var ejs=require(_0x8488('0xa'));var fs=require('fs');var fs_extra=require(_0x8488('0xb'));var _=require(_0x8488('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8488('0x9'));var querystring=require(_0x8488('0xd'));var Papa=require('papaparse');var Redis=require(_0x8488('0xe'));var authService=require(_0x8488('0xf'));var qs=require(_0x8488('0x10'));var as=require(_0x8488('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8488('0x12'))(_0x8488('0x13'));var utils=require(_0x8488('0x14'));var config=require(_0x8488('0x15'));var licenseUtil=require(_0x8488('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14462e,_0x3d1f7a){_0x3d1f7a=_0x3d1f7a||0xcc;return function(_0x58f83d){if(_0x58f83d){return _0x14462e['sendStatus'](_0x3d1f7a);}return _0x14462e[_0x8488('0x17')](_0x3d1f7a)['end']();};}function respondWithResult(_0x214083,_0x4e94fc){_0x4e94fc=_0x4e94fc||0xc8;return function(_0x5161a3){if(_0x5161a3){return _0x214083[_0x8488('0x17')](_0x4e94fc)[_0x8488('0x18')](_0x5161a3);}};}function respondWithFilteredResult(_0x5700b,_0x2bcb7c){return function(_0x3b3cfa){if(_0x3b3cfa){var _0x8d3b3d=typeof _0x2bcb7c[_0x8488('0x19')]==='undefined'&&typeof _0x2bcb7c[_0x8488('0x1a')]===_0x8488('0x1b');var _0x3edfe4=_0x3b3cfa[_0x8488('0x1c')];var _0x60ae2f=_0x8d3b3d?0x0:_0x2bcb7c[_0x8488('0x19')];var _0x1aedb1=_0x8d3b3d?_0x3b3cfa[_0x8488('0x1c')]:_0x2bcb7c[_0x8488('0x19')]+_0x2bcb7c[_0x8488('0x1a')];var _0x10bfd6;if(_0x1aedb1>=_0x3edfe4){_0x1aedb1=_0x3edfe4;_0x10bfd6=0xc8;}else{_0x10bfd6=0xce;}_0x5700b[_0x8488('0x17')](_0x10bfd6);return _0x5700b[_0x8488('0x1d')]('Content-Range',_0x60ae2f+'-'+_0x1aedb1+'/'+_0x3edfe4)['json'](_0x3b3cfa);}return null;};}function patchUpdates(_0x340d6b){return function(_0x12d40f){try{jsonpatch[_0x8488('0x1e')](_0x12d40f,_0x340d6b,!![]);}catch(_0x3c9fc2){return BPromise[_0x8488('0x1f')](_0x3c9fc2);}return _0x12d40f[_0x8488('0x20')]();};}function saveUpdates(_0x43b672,_0x3c078c){return function(_0x39dd43){if(_0x39dd43){return _0x39dd43['update'](_0x43b672)[_0x8488('0x21')](function(_0x4e07e1){return _0x4e07e1;});}return null;};}function removeEntity(_0x140b0b,_0x1361a6){return function(_0x290b33){if(_0x290b33){return _0x290b33['destroy']()['then'](function(){_0x140b0b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x472624,_0x51fe30){return function(_0x58057a){if(!_0x58057a){_0x472624[_0x8488('0x22')](0x194);}return _0x58057a;};}function handleError(_0x2f350a,_0x2b3c97){_0x2b3c97=_0x2b3c97||0x1f4;return function(_0x6ebee0){logger[_0x8488('0x23')](_0x6ebee0['stack']);if(_0x6ebee0[_0x8488('0x24')]){delete _0x6ebee0[_0x8488('0x24')];}_0x2f350a[_0x8488('0x17')](_0x2b3c97)[_0x8488('0x25')](_0x6ebee0);};}exports[_0x8488('0x26')]=function(_0x27f5cf,_0x2c15ff){var _0x296b6c={},_0x368f9c={},_0x1d9317={'count':0x0,'rows':[]};var _0x888b24=_['map'](db['CmHopperFinal']['rawAttributes'],function(_0x292fe8){return{'name':_0x292fe8[_0x8488('0x27')],'type':_0x292fe8[_0x8488('0x28')][_0x8488('0x29')]};});_0x368f9c[_0x8488('0x2a')]=_[_0x8488('0x2b')](_0x888b24,'name');_0x368f9c[_0x8488('0x2c')]=_[_0x8488('0x2d')](_0x27f5cf[_0x8488('0x2c')]);_0x368f9c[_0x8488('0x2e')]=_[_0x8488('0x2f')](_0x368f9c['model'],_0x368f9c[_0x8488('0x2c')]);_0x296b6c[_0x8488('0x30')]=_['intersection'](_0x368f9c[_0x8488('0x2a')],qs[_0x8488('0x31')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x31')]));_0x296b6c[_0x8488('0x30')]=_0x296b6c['attributes'][_0x8488('0x32')]?_0x296b6c[_0x8488('0x30')]:_0x368f9c[_0x8488('0x2a')];if(!_0x27f5cf['query'][_0x8488('0x33')]('nolimit')){_0x296b6c[_0x8488('0x1a')]=qs[_0x8488('0x1a')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x1a')]);_0x296b6c['offset']=qs[_0x8488('0x19')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x19')]);}_0x296b6c['order']=qs[_0x8488('0x34')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x34')]);_0x296b6c[_0x8488('0x35')]=qs[_0x8488('0x2e')](_[_0x8488('0x36')](_0x27f5cf[_0x8488('0x2c')],_0x368f9c[_0x8488('0x2e')]),_0x888b24);if(_0x27f5cf[_0x8488('0x2c')][_0x8488('0x37')]){_0x296b6c[_0x8488('0x35')]=_['merge'](_0x296b6c['where'],{'$or':_[_0x8488('0x2b')](_0x888b24,function(_0x36c17a){if(_0x36c17a[_0x8488('0x28')]!==_0x8488('0x38')){var _0x2d9fa1={};_0x2d9fa1[_0x36c17a[_0x8488('0x24')]]={'$like':'%'+_0x27f5cf[_0x8488('0x2c')][_0x8488('0x37')]+'%'};return _0x2d9fa1;}})});}_0x296b6c=_[_0x8488('0x39')]({},_0x296b6c,_0x27f5cf['options']);var _0xf5a0a0={'where':_0x296b6c[_0x8488('0x35')]};return db[_0x8488('0x3a')]['count'](_0xf5a0a0)[_0x8488('0x21')](function(_0xa50c4b){_0x1d9317[_0x8488('0x1c')]=_0xa50c4b;if(_0x27f5cf[_0x8488('0x2c')][_0x8488('0x3b')]){_0x296b6c[_0x8488('0x3c')]=[{'all':!![]}];}return db[_0x8488('0x3a')]['findAll'](_0x296b6c);})[_0x8488('0x21')](function(_0x1c33a1){_0x1d9317[_0x8488('0x3d')]=_0x1c33a1;return _0x1d9317;})['then'](respondWithFilteredResult(_0x2c15ff,_0x296b6c))[_0x8488('0x3e')](handleError(_0x2c15ff,null));};exports['show']=function(_0x40ee7e,_0x34b11b){var _0x5cbd11={'raw':!![],'where':{'id':_0x40ee7e[_0x8488('0x3f')]['id']}},_0x22a3f3={};_0x22a3f3[_0x8488('0x2a')]=_[_0x8488('0x2d')](db[_0x8488('0x3a')]['rawAttributes']);_0x22a3f3[_0x8488('0x2c')]=_['keys'](_0x40ee7e[_0x8488('0x2c')]);_0x22a3f3[_0x8488('0x2e')]=_[_0x8488('0x2f')](_0x22a3f3[_0x8488('0x2a')],_0x22a3f3[_0x8488('0x2c')]);_0x5cbd11[_0x8488('0x30')]=_[_0x8488('0x2f')](_0x22a3f3[_0x8488('0x2a')],qs[_0x8488('0x31')](_0x40ee7e[_0x8488('0x2c')][_0x8488('0x31')]));_0x5cbd11[_0x8488('0x30')]=_0x5cbd11[_0x8488('0x30')][_0x8488('0x32')]?_0x5cbd11[_0x8488('0x30')]:_0x22a3f3[_0x8488('0x2a')];if(_0x40ee7e[_0x8488('0x2c')]['includeAll']){_0x5cbd11[_0x8488('0x3c')]=[{'all':!![]}];}_0x5cbd11=_[_0x8488('0x39')]({},_0x5cbd11,_0x40ee7e[_0x8488('0x40')]);return db[_0x8488('0x3a')]['find'](_0x5cbd11)[_0x8488('0x21')](handleEntityNotFound(_0x34b11b,null))[_0x8488('0x21')](respondWithResult(_0x34b11b,null))[_0x8488('0x3e')](handleError(_0x34b11b,null));};exports[_0x8488('0x41')]=function(_0x52042c,_0x1f0516){return db[_0x8488('0x3a')][_0x8488('0x41')]()[_0x8488('0x21')](respondWithResult(_0x1f0516,null))[_0x8488('0x3e')](handleError(_0x1f0516,null));};exports[_0x8488('0x42')]=function(_0x886a9e,_0x299d8e){if(_0x886a9e[_0x8488('0x43')][_0x8488('0x44')]){delete _0x886a9e[_0x8488('0x43')][_0x8488('0x44')];}return db[_0x8488('0x3a')]['find']({'where':{'uniqueid':_0x886a9e['params']['id']}})[_0x8488('0x21')](handleEntityNotFound(_0x299d8e,null))[_0x8488('0x21')](saveUpdates(_0x886a9e[_0x8488('0x43')],null))[_0x8488('0x21')](respondWithResult(_0x299d8e,null))[_0x8488('0x3e')](handleError(_0x299d8e,null));};exports[_0x8488('0x45')]=function(_0x25f2dc,_0x27dfd2,_0x24fa20){return db['CmHopperFinal'][_0x8488('0x46')]({'raw':![],'where':{'VoiceQueueId':_0x25f2dc[_0x8488('0x3f')]['id']},'attributes':[[db['sequelize']['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')]('`state`\x20=\x200,\x201,\x20null'))),_0x8488('0x4a')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')](_0x8488('0x4b')))),_0x8488('0x4c')],[db['sequelize']['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db['sequelize'][_0x8488('0x49')]('`state`\x20=\x205,\x201,\x20null'))),_0x8488('0x4d')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')]('`state`\x20=\x208,\x201,\x20null'))),_0x8488('0x4e')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')]['literal'](_0x8488('0x4f')))),'dropContacts'],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')](_0x8488('0x50')))),_0x8488('0x51')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db[_0x8488('0x48')]['literal'](_0x8488('0x52')))),_0x8488('0x53')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')]['literal'](_0x8488('0x54')))),'answeringMachine']]})[_0x8488('0x21')](handleEntityNotFound(_0x27dfd2,null))[_0x8488('0x21')](respondWithResult(_0x27dfd2,null))[_0x8488('0x3e')](handleError(_0x27dfd2,null));};exports[_0x8488('0x55')]=function(_0x1971f3,_0x24ba2d,_0x4facfb){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x1971f3[_0x8488('0x3f')]['id']},'attributes':[[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')](_0x8488('0x56')))),_0x8488('0x4a')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')](_0x8488('0x4b')))),'noAnswerContacts'],[db['sequelize']['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')]('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db['sequelize'][_0x8488('0x49')](_0x8488('0x57')))),_0x8488('0x4e')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x8488('0x58')],[db[_0x8488('0x48')]['fn']('COUNT',db[_0x8488('0x48')]['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')](_0x8488('0x50')))),_0x8488('0x51')],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db['sequelize']['fn']('IF',db[_0x8488('0x48')][_0x8488('0x49')]('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0x8488('0x48')]['fn'](_0x8488('0x47'),db[_0x8488('0x48')]['fn']('IF',db['sequelize'][_0x8488('0x49')](_0x8488('0x54')))),'answeringMachine']]})[_0x8488('0x21')](handleEntityNotFound(_0x24ba2d,null))['then'](respondWithResult(_0x24ba2d,null))[_0x8488('0x3e')](handleError(_0x24ba2d,null));};exports[_0x8488('0x59')]=function(_0x44a50b,_0x5815cb,_0xbee86e){return db[_0x8488('0x5a')]['find']({'where':{'id':_0x44a50b['params']['id']}})[_0x8488('0x21')](handleEntityNotFound(_0x5815cb,null))[_0x8488('0x21')](function(_0xfedfd2){var _0x3ab1b6;if(_0xfedfd2){_0x3ab1b6=squel[_0x8488('0x5b')]()[_0x8488('0x5c')](_0x8488('0x5d'))[_0x8488('0x5e')]([_0x8488('0x5f'),_0x8488('0x60'),'ContactId',_0x8488('0x61'),'VoiceQueueId',_0x8488('0x62'),_0x8488('0x63')],squel[_0x8488('0x64')]()[_0x8488('0x65')]('ANY_VALUE(calleridnum)',_0x8488('0x5f'))[_0x8488('0x65')]('NOW()',_0x8488('0x60'))['field'](_0x8488('0x66'),_0x8488('0x67'))[_0x8488('0x65')](_0x8488('0x68'),_0x8488('0x61'))[_0x8488('0x65')](_0x8488('0x69'),_0x8488('0x6a'))['field'](_0x8488('0x6b'),'createdAt')['field'](_0x8488('0x6b'),_0x8488('0x63'))[_0x8488('0x6c')]('cm_hopper_final')['where'](_0x8488('0x6d'),_0x44a50b[_0x8488('0x3f')]['id']['toString']())[_0x8488('0x35')](_0x8488('0x6e'),_0x44a50b[_0x8488('0x43')][_0x8488('0x6f')][_0x8488('0x70')]())[_0x8488('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x8488('0x35')](_0x8488('0x71'),squel[_0x8488('0x64')]()['field'](_0x8488('0x5f'))[_0x8488('0x6c')](_0x8488('0x5d'))['where'](_0x8488('0x6d'),_0x44a50b[_0x8488('0x3f')]['id']['toString']()))['where'](_0x8488('0x71'),squel[_0x8488('0x64')]()['field'](_0x8488('0x72'))[_0x8488('0x6c')]('cm_hopper_final')['where'](_0x8488('0x6d'),_0x44a50b['params']['id'][_0x8488('0x70')]())[_0x8488('0x35')](_0x8488('0x73')))[_0x8488('0x74')]('ContactId'))[_0x8488('0x70')]();return db['sequelize'][_0x8488('0x2c')](_0x3ab1b6);}return[];})['then'](respondWithResult(_0x5815cb,null))[_0x8488('0x3e')](handleError(_0x5815cb,null));};exports[_0x8488('0x75')]=function(_0x267401,_0x1e635a,_0x31ab35){return db[_0x8488('0x76')][_0x8488('0x77')]({'where':{'id':_0x267401[_0x8488('0x3f')]['id']}})[_0x8488('0x21')](handleEntityNotFound(_0x1e635a,null))[_0x8488('0x21')](function(_0xce1d1a){var _0xc9c221;if(_0xce1d1a){_0xc9c221=squel[_0x8488('0x5b')]()[_0x8488('0x5c')]('cm_hopper')[_0x8488('0x5e')]([_0x8488('0x5f'),'scheduledAt',_0x8488('0x67'),_0x8488('0x61'),_0x8488('0x78'),_0x8488('0x62'),_0x8488('0x63')],squel[_0x8488('0x64')]()[_0x8488('0x65')](_0x8488('0x79'),_0x8488('0x5f'))[_0x8488('0x65')](_0x8488('0x6b'),'scheduledAt')[_0x8488('0x65')](_0x8488('0x66'),'ContactId')[_0x8488('0x65')](_0x8488('0x68'),_0x8488('0x61'))[_0x8488('0x65')](_0x8488('0x7a'),'CampaignId')['field'](_0x8488('0x6b'),_0x8488('0x62'))[_0x8488('0x65')](_0x8488('0x6b'),_0x8488('0x63'))[_0x8488('0x6c')](_0x8488('0x7b'))[_0x8488('0x35')](_0x8488('0x7c'),_0x267401[_0x8488('0x3f')]['id'][_0x8488('0x70')]())[_0x8488('0x35')](_0x8488('0x6e'),_0x267401[_0x8488('0x43')][_0x8488('0x6f')]['toString']())[_0x8488('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')['where'](_0x8488('0x71'),squel[_0x8488('0x64')]()[_0x8488('0x65')](_0x8488('0x5f'))[_0x8488('0x6c')](_0x8488('0x5d'))[_0x8488('0x35')](_0x8488('0x7c'),_0x267401[_0x8488('0x3f')]['id'][_0x8488('0x70')]()))['where'](_0x8488('0x71'),squel[_0x8488('0x64')]()[_0x8488('0x65')](_0x8488('0x72'))[_0x8488('0x6c')](_0x8488('0x7b'))['where'](_0x8488('0x7c'),_0x267401['params']['id'][_0x8488('0x70')]())[_0x8488('0x35')]('state\x20=\x204'))['group'](_0x8488('0x67')))[_0x8488('0x70')]();return db[_0x8488('0x48')][_0x8488('0x2c')](_0xc9c221);}return[];})[_0x8488('0x21')](respondWithResult(_0x1e635a,null))['catch'](handleError(_0x1e635a,null));};exports[_0x8488('0x7d')]=function(_0x19c5c6,_0x50f773,_0x52c750){return db[_0x8488('0x7e')][_0x8488('0x7f')]({'where':{'VoiceQueueId':_0x19c5c6[_0x8488('0x43')]['VoiceQueueId'],'CampaignId':_0x19c5c6['body'][_0x8488('0x78')],'ContactId':_0x19c5c6[_0x8488('0x43')][_0x8488('0x67')]}})['then'](handleEntityNotFound(_0x50f773,null))[_0x8488('0x21')](function(_0x1e4e51){if(_0x1e4e51){return _0x1e4e51;}return null;})[_0x8488('0x21')](respondWithResult(_0x50f773,null))[_0x8488('0x3e')](handleError(_0x50f773,null));}; \ No newline at end of file +var _0x1967=['sendStatus','end','json','offset','undefined','limit','count','set','apply','save','update','then','status','error','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','CmHopperFinal','includeAll','include','findAll','rows','show','params','fields','options','find','catch','describe','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','from','toString','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','into','CampaignId','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','cm_hopper_final','CampaignId\x20=\x20?','state','calleridnum','group','checkContactHopper','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x33b4d3,_0x3ddc19){var _0x1503e4=function(_0x16310e){while(--_0x16310e){_0x33b4d3['push'](_0x33b4d3['shift']());}};_0x1503e4(++_0x3ddc19);}(_0x1967,0x173));var _0x7196=function(_0xb60a00,_0x1ead2b){_0xb60a00=_0xb60a00-0x0;var _0x5847d8=_0x1967[_0xb60a00];return _0x5847d8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7196('0x0'));var zipdir=require(_0x7196('0x1'));var jsonpatch=require(_0x7196('0x2'));var rp=require(_0x7196('0x3'));var moment=require(_0x7196('0x4'));var BPromise=require(_0x7196('0x5'));var Mustache=require(_0x7196('0x6'));var util=require(_0x7196('0x7'));var path=require(_0x7196('0x8'));var sox=require(_0x7196('0x9'));var csv=require('to-csv');var ejs=require(_0x7196('0xa'));var fs=require('fs');var fs_extra=require(_0x7196('0xb'));var _=require(_0x7196('0xc'));var squel=require(_0x7196('0xd'));var crypto=require(_0x7196('0xe'));var jsforce=require(_0x7196('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7196('0x10'));var querystring=require(_0x7196('0x11'));var Papa=require(_0x7196('0x12'));var Redis=require(_0x7196('0x13'));var authService=require(_0x7196('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7196('0x15'));var logger=require(_0x7196('0x16'))(_0x7196('0x17'));var utils=require(_0x7196('0x18'));var config=require(_0x7196('0x19'));var licenseUtil=require(_0x7196('0x1a'));var db=require(_0x7196('0x1b'))['db'];function respondWithStatusCode(_0x325641,_0x24f1c3){_0x24f1c3=_0x24f1c3||0xcc;return function(_0xba707b){if(_0xba707b){return _0x325641[_0x7196('0x1c')](_0x24f1c3);}return _0x325641['status'](_0x24f1c3)[_0x7196('0x1d')]();};}function respondWithResult(_0x3feccd,_0x3545aa){_0x3545aa=_0x3545aa||0xc8;return function(_0xf098c1){if(_0xf098c1){return _0x3feccd['status'](_0x3545aa)[_0x7196('0x1e')](_0xf098c1);}};}function respondWithFilteredResult(_0x539414,_0xe32933){return function(_0x2590a6){if(_0x2590a6){var _0xf7e97=typeof _0xe32933[_0x7196('0x1f')]===_0x7196('0x20')&&typeof _0xe32933[_0x7196('0x21')]===_0x7196('0x20');var _0x1ed296=_0x2590a6[_0x7196('0x22')];var _0x32fe2b=_0xf7e97?0x0:_0xe32933[_0x7196('0x1f')];var _0x5b716a=_0xf7e97?_0x2590a6['count']:_0xe32933[_0x7196('0x1f')]+_0xe32933[_0x7196('0x21')];var _0x40418d;if(_0x5b716a>=_0x1ed296){_0x5b716a=_0x1ed296;_0x40418d=0xc8;}else{_0x40418d=0xce;}_0x539414['status'](_0x40418d);return _0x539414[_0x7196('0x23')]('Content-Range',_0x32fe2b+'-'+_0x5b716a+'/'+_0x1ed296)['json'](_0x2590a6);}return null;};}function patchUpdates(_0x296e07){return function(_0x627223){try{jsonpatch[_0x7196('0x24')](_0x627223,_0x296e07,!![]);}catch(_0x4ddf78){return BPromise['reject'](_0x4ddf78);}return _0x627223[_0x7196('0x25')]();};}function saveUpdates(_0x3cd8ff,_0x598a26){return function(_0x18649b){if(_0x18649b){return _0x18649b[_0x7196('0x26')](_0x3cd8ff)[_0x7196('0x27')](function(_0x18d389){return _0x18d389;});}return null;};}function removeEntity(_0x38b3d6,_0x549f34){return function(_0x3f8178){if(_0x3f8178){return _0x3f8178['destroy']()[_0x7196('0x27')](function(){_0x38b3d6[_0x7196('0x28')](0xcc)[_0x7196('0x1d')]();});}};}function handleEntityNotFound(_0xa69810,_0x70aa65){return function(_0x43f6a2){if(!_0x43f6a2){_0xa69810['sendStatus'](0x194);}return _0x43f6a2;};}function handleError(_0x57c404,_0x1482e5){_0x1482e5=_0x1482e5||0x1f4;return function(_0x2d284f){logger[_0x7196('0x29')](_0x2d284f['stack']);if(_0x2d284f['name']){delete _0x2d284f[_0x7196('0x2a')];}_0x57c404[_0x7196('0x28')](_0x1482e5)[_0x7196('0x2b')](_0x2d284f);};}exports['index']=function(_0x35eef9,_0x4ecea1){var _0x4fd339={},_0x59d79d={},_0x30151f={'count':0x0,'rows':[]};var _0x985727=_[_0x7196('0x2c')](db['CmHopperFinal'][_0x7196('0x2d')],function(_0x45d567){return{'name':_0x45d567[_0x7196('0x2e')],'type':_0x45d567[_0x7196('0x2f')]['key']};});_0x59d79d[_0x7196('0x30')]=_[_0x7196('0x2c')](_0x985727,_0x7196('0x2a'));_0x59d79d[_0x7196('0x31')]=_[_0x7196('0x32')](_0x35eef9[_0x7196('0x31')]);_0x59d79d[_0x7196('0x33')]=_[_0x7196('0x34')](_0x59d79d[_0x7196('0x30')],_0x59d79d[_0x7196('0x31')]);_0x4fd339[_0x7196('0x35')]=_['intersection'](_0x59d79d[_0x7196('0x30')],qs['fields'](_0x35eef9[_0x7196('0x31')]['fields']));_0x4fd339[_0x7196('0x35')]=_0x4fd339[_0x7196('0x35')]['length']?_0x4fd339[_0x7196('0x35')]:_0x59d79d[_0x7196('0x30')];if(!_0x35eef9[_0x7196('0x31')][_0x7196('0x36')](_0x7196('0x37'))){_0x4fd339['limit']=qs[_0x7196('0x21')](_0x35eef9[_0x7196('0x31')][_0x7196('0x21')]);_0x4fd339[_0x7196('0x1f')]=qs[_0x7196('0x1f')](_0x35eef9[_0x7196('0x31')]['offset']);}_0x4fd339[_0x7196('0x38')]=qs[_0x7196('0x39')](_0x35eef9[_0x7196('0x31')]['sort']);_0x4fd339[_0x7196('0x3a')]=qs[_0x7196('0x33')](_[_0x7196('0x3b')](_0x35eef9[_0x7196('0x31')],_0x59d79d[_0x7196('0x33')]),_0x985727);if(_0x35eef9[_0x7196('0x31')][_0x7196('0x3c')]){_0x4fd339[_0x7196('0x3a')]=_[_0x7196('0x3d')](_0x4fd339[_0x7196('0x3a')],{'$or':_['map'](_0x985727,function(_0x257754){if(_0x257754[_0x7196('0x2f')]!=='VIRTUAL'){var _0x186efe={};_0x186efe[_0x257754['name']]={'$like':'%'+_0x35eef9['query'][_0x7196('0x3c')]+'%'};return _0x186efe;}})});}_0x4fd339=_[_0x7196('0x3d')]({},_0x4fd339,_0x35eef9['options']);var _0x587f6f={'where':_0x4fd339[_0x7196('0x3a')]};return db[_0x7196('0x3e')][_0x7196('0x22')](_0x587f6f)['then'](function(_0x36a990){_0x30151f[_0x7196('0x22')]=_0x36a990;if(_0x35eef9[_0x7196('0x31')][_0x7196('0x3f')]){_0x4fd339[_0x7196('0x40')]=[{'all':!![]}];}return db[_0x7196('0x3e')][_0x7196('0x41')](_0x4fd339);})[_0x7196('0x27')](function(_0x5cd903){_0x30151f[_0x7196('0x42')]=_0x5cd903;return _0x30151f;})[_0x7196('0x27')](respondWithFilteredResult(_0x4ecea1,_0x4fd339))['catch'](handleError(_0x4ecea1,null));};exports[_0x7196('0x43')]=function(_0x43d4c0,_0x48178f){var _0x471915={'raw':!![],'where':{'id':_0x43d4c0[_0x7196('0x44')]['id']}},_0x471bb2={};_0x471bb2['model']=_[_0x7196('0x32')](db[_0x7196('0x3e')]['rawAttributes']);_0x471bb2[_0x7196('0x31')]=_[_0x7196('0x32')](_0x43d4c0['query']);_0x471bb2[_0x7196('0x33')]=_['intersection'](_0x471bb2['model'],_0x471bb2['query']);_0x471915['attributes']=_['intersection'](_0x471bb2[_0x7196('0x30')],qs['fields'](_0x43d4c0[_0x7196('0x31')][_0x7196('0x45')]));_0x471915[_0x7196('0x35')]=_0x471915[_0x7196('0x35')]['length']?_0x471915[_0x7196('0x35')]:_0x471bb2['model'];if(_0x43d4c0[_0x7196('0x31')][_0x7196('0x3f')]){_0x471915[_0x7196('0x40')]=[{'all':!![]}];}_0x471915=_['merge']({},_0x471915,_0x43d4c0[_0x7196('0x46')]);return db[_0x7196('0x3e')][_0x7196('0x47')](_0x471915)['then'](handleEntityNotFound(_0x48178f,null))['then'](respondWithResult(_0x48178f,null))[_0x7196('0x48')](handleError(_0x48178f,null));};exports['describe']=function(_0x29c7e8,_0x582884){return db['CmHopperFinal'][_0x7196('0x49')]()['then'](respondWithResult(_0x582884,null))['catch'](handleError(_0x582884,null));};exports['update']=function(_0x2299e2,_0x5052ee){if(_0x2299e2['body'][_0x7196('0x4a')]){delete _0x2299e2[_0x7196('0x4b')][_0x7196('0x4a')];}return db[_0x7196('0x3e')]['find']({'where':{'uniqueid':_0x2299e2[_0x7196('0x44')]['id']}})['then'](handleEntityNotFound(_0x5052ee,null))[_0x7196('0x27')](saveUpdates(_0x2299e2[_0x7196('0x4b')],null))['then'](respondWithResult(_0x5052ee,null))[_0x7196('0x48')](handleError(_0x5052ee,null));};exports[_0x7196('0x4c')]=function(_0x3fe092,_0x4fa18f,_0x317ab6){return db['CmHopperFinal'][_0x7196('0x41')]({'raw':![],'where':{'VoiceQueueId':_0x3fe092[_0x7196('0x44')]['id']},'attributes':[[db[_0x7196('0x4d')]['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')](_0x7196('0x50')))),'noSuchContacts'],[db['sequelize']['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')]('`state`\x20=\x203,\x201,\x20null'))),_0x7196('0x51')],[db[_0x7196('0x4d')]['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')](_0x7196('0x52')))),_0x7196('0x53')],[db[_0x7196('0x4d')]['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db['sequelize'][_0x7196('0x4f')](_0x7196('0x54')))),_0x7196('0x55')],[db['sequelize']['fn'](_0x7196('0x4e'),db['sequelize']['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')](_0x7196('0x56')))),_0x7196('0x57')],[db[_0x7196('0x4d')]['fn']('COUNT',db[_0x7196('0x4d')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x7196('0x58')],[db[_0x7196('0x4d')]['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')](_0x7196('0x59')))),'reCallContacts'],[db[_0x7196('0x4d')]['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0x7196('0x27')](handleEntityNotFound(_0x4fa18f,null))[_0x7196('0x27')](respondWithResult(_0x4fa18f,null))[_0x7196('0x48')](handleError(_0x4fa18f,null));};exports[_0x7196('0x5a')]=function(_0x14cb38,_0x43b9ac,_0xe3fb61){return db[_0x7196('0x3e')][_0x7196('0x41')]({'raw':![],'where':{'CampaignId':_0x14cb38[_0x7196('0x44')]['id']},'attributes':[[db[_0x7196('0x4d')]['fn']('COUNT',db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')](_0x7196('0x50')))),'noSuchContacts'],[db[_0x7196('0x4d')]['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')](_0x7196('0x5b')))),_0x7196('0x51')],[db['sequelize']['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')]('`state`\x20=\x205,\x201,\x20null'))),_0x7196('0x53')],[db[_0x7196('0x4d')]['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')](_0x7196('0x54')))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db[_0x7196('0x4d')]['fn']('IF',db['sequelize'][_0x7196('0x4f')](_0x7196('0x56')))),_0x7196('0x57')],[db[_0x7196('0x4d')]['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')](_0x7196('0x5c')))),'abandonedContacts'],[db['sequelize']['fn'](_0x7196('0x4e'),db[_0x7196('0x4d')]['fn']('IF',db[_0x7196('0x4d')][_0x7196('0x4f')](_0x7196('0x59')))),_0x7196('0x5d')],[db[_0x7196('0x4d')]['fn'](_0x7196('0x4e'),db['sequelize']['fn']('IF',db['sequelize'][_0x7196('0x4f')]('`state`\x20=\x2019,\x201,\x20null'))),_0x7196('0x5e')]]})['then'](handleEntityNotFound(_0x43b9ac,null))[_0x7196('0x27')](respondWithResult(_0x43b9ac,null))[_0x7196('0x48')](handleError(_0x43b9ac,null));};exports[_0x7196('0x5f')]=function(_0x267903,_0x5ab6ae,_0x5a786a){return db[_0x7196('0x60')]['find']({'where':{'id':_0x267903[_0x7196('0x44')]['id']}})[_0x7196('0x27')](handleEntityNotFound(_0x5ab6ae,null))[_0x7196('0x27')](function(_0x38c1b3){var _0xd4c784;if(_0x38c1b3){_0xd4c784=squel[_0x7196('0x61')]()['into'](_0x7196('0x62'))[_0x7196('0x63')]([_0x7196('0x64'),_0x7196('0x65'),_0x7196('0x66'),_0x7196('0x67'),_0x7196('0x68'),_0x7196('0x69'),_0x7196('0x6a')],squel[_0x7196('0x6b')]()[_0x7196('0x6c')](_0x7196('0x6d'),'phone')[_0x7196('0x6c')](_0x7196('0x6e'),'scheduledAt')['field'](_0x7196('0x6f'),_0x7196('0x66'))[_0x7196('0x6c')]('ANY_VALUE(ListId)',_0x7196('0x67'))['field'](_0x7196('0x70'),_0x7196('0x68'))['field'](_0x7196('0x6e'),'createdAt')['field'](_0x7196('0x6e'),_0x7196('0x6a'))[_0x7196('0x71')]('cm_hopper_final')[_0x7196('0x3a')]('VoiceQueueId\x20=\x20?',_0x267903[_0x7196('0x44')]['id'][_0x7196('0x72')]())[_0x7196('0x3a')](_0x7196('0x73'),_0x267903[_0x7196('0x4b')]['state'][_0x7196('0x72')]())[_0x7196('0x3a')](_0x7196('0x74'))[_0x7196('0x3a')](_0x7196('0x75'),squel[_0x7196('0x6b')]()[_0x7196('0x6c')](_0x7196('0x64'))['from'](_0x7196('0x62'))[_0x7196('0x3a')](_0x7196('0x76'),_0x267903[_0x7196('0x44')]['id']['toString']()))[_0x7196('0x3a')](_0x7196('0x75'),squel['select']()[_0x7196('0x6c')]('calleridnum')[_0x7196('0x71')]('cm_hopper_final')[_0x7196('0x3a')](_0x7196('0x76'),_0x267903['params']['id'][_0x7196('0x72')]())[_0x7196('0x3a')](_0x7196('0x77')))['group']('ContactId'))[_0x7196('0x72')]();return db['sequelize']['query'](_0xd4c784);}return[];})[_0x7196('0x27')](respondWithResult(_0x5ab6ae,null))[_0x7196('0x48')](handleError(_0x5ab6ae,null));};exports[_0x7196('0x78')]=function(_0x509c4a,_0x35c5b3,_0x59370b){return db[_0x7196('0x79')][_0x7196('0x47')]({'where':{'id':_0x509c4a[_0x7196('0x44')]['id']}})[_0x7196('0x27')](handleEntityNotFound(_0x35c5b3,null))[_0x7196('0x27')](function(_0x8673e){var _0x32ba47;if(_0x8673e){_0x32ba47=squel[_0x7196('0x61')]()[_0x7196('0x7a')]('cm_hopper')['fromQuery']([_0x7196('0x64'),'scheduledAt','ContactId',_0x7196('0x67'),_0x7196('0x7b'),_0x7196('0x69'),_0x7196('0x6a')],squel['select']()['field'](_0x7196('0x6d'),_0x7196('0x64'))[_0x7196('0x6c')](_0x7196('0x6e'),'scheduledAt')[_0x7196('0x6c')]('ANY_VALUE(ContactId)','ContactId')[_0x7196('0x6c')](_0x7196('0x7c'),_0x7196('0x67'))['field'](_0x7196('0x7d'),_0x7196('0x7b'))[_0x7196('0x6c')](_0x7196('0x6e'),_0x7196('0x69'))[_0x7196('0x6c')](_0x7196('0x6e'),_0x7196('0x6a'))['from'](_0x7196('0x7e'))[_0x7196('0x3a')](_0x7196('0x7f'),_0x509c4a[_0x7196('0x44')]['id'][_0x7196('0x72')]())['where'](_0x7196('0x73'),_0x509c4a[_0x7196('0x4b')][_0x7196('0x80')]['toString']())[_0x7196('0x3a')]('calleridnum\x20IS\x20NOT\x20NULL')['where'](_0x7196('0x75'),squel[_0x7196('0x6b')]()['field'](_0x7196('0x64'))[_0x7196('0x71')]('cm_hopper')[_0x7196('0x3a')](_0x7196('0x7f'),_0x509c4a[_0x7196('0x44')]['id'][_0x7196('0x72')]()))[_0x7196('0x3a')](_0x7196('0x75'),squel['select']()[_0x7196('0x6c')](_0x7196('0x81'))[_0x7196('0x71')]('cm_hopper_final')['where']('CampaignId\x20=\x20?',_0x509c4a[_0x7196('0x44')]['id'][_0x7196('0x72')]())[_0x7196('0x3a')]('state\x20=\x204'))[_0x7196('0x82')]('ContactId'))[_0x7196('0x72')]();return db['sequelize'][_0x7196('0x31')](_0x32ba47);}return[];})[_0x7196('0x27')](respondWithResult(_0x35c5b3,null))[_0x7196('0x48')](handleError(_0x35c5b3,null));};exports[_0x7196('0x83')]=function(_0x37290e,_0x10b628,_0x43e7d5){return db['CmHopper'][_0x7196('0x84')]({'where':{'VoiceQueueId':_0x37290e['body']['VoiceQueueId'],'CampaignId':_0x37290e['body']['CampaignId'],'ContactId':_0x37290e['body'][_0x7196('0x66')]}})[_0x7196('0x27')](handleEntityNotFound(_0x10b628,null))[_0x7196('0x27')](function(_0x5bab25){if(_0x5bab25){return _0x5bab25;}return null;})[_0x7196('0x27')](respondWithResult(_0x10b628,null))['catch'](handleError(_0x10b628,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 65e4d9a..8d2594d 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 _0x56f4=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x56f4,0x109));var _0x456f=function(_0x5dc240,_0x5ce6c5){_0x5dc240=_0x5dc240-0x0;var _0x5c89c5=_0x56f4[_0x5dc240];return _0x5c89c5;};'use strict';var _=require(_0x456f('0x0'));var util=require(_0x456f('0x1'));var logger=require(_0x456f('0x2'))('api');var moment=require(_0x456f('0x3'));var BPromise=require(_0x456f('0x4'));var rp=require(_0x456f('0x5'));var fs=require('fs');var path=require(_0x456f('0x6'));var rimraf=require(_0x456f('0x7'));var config=require(_0x456f('0x8'));var attributes=require('./cmHopperFinal.attributes');module['exports']=function(_0x56a50a,_0x4f729f){return _0x56a50a[_0x456f('0x9')](_0x456f('0xa'),attributes,{'tableName':_0x456f('0xb'),'paranoid':![],'indexes':[{'name':_0x456f('0xc'),'fields':[_0x456f('0xc')]},{'name':_0x456f('0xd'),'fields':[_0x456f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd423=['moment','request-promise','path','rimraf','./cmHopperFinal.attributes','exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api'];(function(_0x40c8f6,_0xb0abb){var _0x67b544=function(_0x5feb9c){while(--_0x5feb9c){_0x40c8f6['push'](_0x40c8f6['shift']());}};_0x67b544(++_0xb0abb);}(_0xd423,0x1d8));var _0x3d42=function(_0x2d15a5,_0xa395ab){_0x2d15a5=_0x2d15a5-0x0;var _0x2d11a1=_0xd423[_0x2d15a5];return _0x2d11a1;};'use strict';var _=require(_0x3d42('0x0'));var util=require(_0x3d42('0x1'));var logger=require(_0x3d42('0x2'))(_0x3d42('0x3'));var moment=require(_0x3d42('0x4'));var BPromise=require('bluebird');var rp=require(_0x3d42('0x5'));var fs=require('fs');var path=require(_0x3d42('0x6'));var rimraf=require(_0x3d42('0x7'));var config=require('../../config/environment');var attributes=require(_0x3d42('0x8'));module[_0x3d42('0x9')]=function(_0xc40f5,_0x3329b2){return _0xc40f5['define'](_0x3d42('0xa'),attributes,{'tableName':_0x3d42('0xb'),'paranoid':![],'indexes':[{'name':_0x3d42('0xc'),'fields':[_0x3d42('0xc')]},{'name':_0x3d42('0xd'),'fields':[_0x3d42('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 598b86e..863be20 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x1bae9a,_0x5acb3f){var _0x528008=function(_0x247f51){while(--_0x247f51){_0x1bae9a['push'](_0x1bae9a['shift']());}};_0x528008(++_0x5acb3f);}(_0xb10b,0x12a));var _0xbb10=function(_0x512eb0,_0x27edfe){_0x512eb0=_0x512eb0-0x0;var _0x1378fe=_0xb10b[_0x512eb0];return _0x1378fe;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x7547d9,_0x35e138){var _0x5397d9=function(_0x4b6def){while(--_0x4b6def){_0x7547d9['push'](_0x7547d9['shift']());}};_0x5397d9(++_0x35e138);}(_0xb10b,0x12a));var _0xbb10=function(_0x52980f,_0x47b3b0){_0x52980f=_0x52980f-0x0;var _0x1f52a1=_0xb10b[_0x52980f];return _0x1f52a1;};'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 e63416f..02dfa46 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 _0x0942=['update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','get','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','isAuthenticated','countContactsIvrCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put'];(function(_0x21ce4a,_0x49f756){var _0x93ca77=function(_0x365a9a){while(--_0x365a9a){_0x21ce4a['push'](_0x21ce4a['shift']());}};_0x93ca77(++_0x49f756);}(_0x0942,0x11a));var _0x2094=function(_0x143529,_0x50da59){_0x143529=_0x143529-0x0;var _0x2113d1=_0x0942[_0x143529];return _0x2113d1;};'use strict';var multer=require('multer');var util=require(_0x2094('0x0'));var path=require(_0x2094('0x1'));var timeout=require(_0x2094('0x2'));var express=require(_0x2094('0x3'));var router=express[_0x2094('0x4')]();var fs_extra=require(_0x2094('0x5'));var auth=require(_0x2094('0x6'));var interaction=require(_0x2094('0x7'));var config=require('../../config/environment');var controller=require(_0x2094('0x8'));router[_0x2094('0x9')]('/',auth['isAuthenticated'](),controller[_0x2094('0xa')]);router[_0x2094('0x9')](_0x2094('0xb'),auth['isAuthenticated'](),controller[_0x2094('0xc')]);router[_0x2094('0x9')](_0x2094('0xd'),auth['isAuthenticated'](),controller[_0x2094('0xe')]);router[_0x2094('0x9')](_0x2094('0xf'),auth['isAuthenticated'](),controller[_0x2094('0x10')]);router[_0x2094('0x9')](_0x2094('0x11'),auth[_0x2094('0x12')](),controller[_0x2094('0x13')]);router[_0x2094('0x14')]('/voice/queue/moveContacts/:id',auth[_0x2094('0x12')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x2094('0x14')](_0x2094('0x15'),auth[_0x2094('0x12')](),controller[_0x2094('0x16')]);router['post'](_0x2094('0x17'),auth['isAuthenticated'](),controller[_0x2094('0x18')]);router[_0x2094('0x19')]('/:id',auth[_0x2094('0x12')](),controller[_0x2094('0x1a')]);module[_0x2094('0x1b')]=router; \ No newline at end of file +var _0xb4e2=['post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id'];(function(_0x9d7049,_0x32c4dd){var _0x104f10=function(_0x195b66){while(--_0x195b66){_0x9d7049['push'](_0x9d7049['shift']());}};_0x104f10(++_0x32c4dd);}(_0xb4e2,0x1aa));var _0x2b4e=function(_0x5a902b,_0x42502a){_0x5a902b=_0x5a902b-0x0;var _0x5c9e24=_0xb4e2[_0x5a902b];return _0x5c9e24;};'use strict';var multer=require(_0x2b4e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2b4e('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2b4e('0x2'));var interaction=require(_0x2b4e('0x3'));var config=require(_0x2b4e('0x4'));var controller=require(_0x2b4e('0x5'));router[_0x2b4e('0x6')]('/',auth[_0x2b4e('0x7')](),controller[_0x2b4e('0x8')]);router['get'](_0x2b4e('0x9'),auth[_0x2b4e('0x7')](),controller[_0x2b4e('0xa')]);router[_0x2b4e('0x6')](_0x2b4e('0xb'),auth[_0x2b4e('0x7')](),controller[_0x2b4e('0xc')]);router[_0x2b4e('0x6')](_0x2b4e('0xd'),auth[_0x2b4e('0x7')](),controller[_0x2b4e('0xe')]);router[_0x2b4e('0x6')](_0x2b4e('0xf'),auth[_0x2b4e('0x7')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x2b4e('0x10')](_0x2b4e('0x11'),auth[_0x2b4e('0x7')](),controller[_0x2b4e('0x12')]);router['post'](_0x2b4e('0x13'),auth['isAuthenticated'](),controller[_0x2b4e('0x14')]);router[_0x2b4e('0x10')](_0x2b4e('0x15'),auth[_0x2b4e('0x7')](),controller[_0x2b4e('0x16')]);router[_0x2b4e('0x17')]('/:id',auth[_0x2b4e('0x7')](),controller[_0x2b4e('0x18')]);module[_0x2b4e('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 94f8277..bc12ae7 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 _0x9d25=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x53c113,_0x4d37d8){var _0x51fe0d=function(_0x5ec6a5){while(--_0x5ec6a5){_0x53c113['push'](_0x53c113['shift']());}};_0x51fe0d(++_0x4d37d8);}(_0x9d25,0x160));var _0x59d2=function(_0x283248,_0x69553f){_0x283248=_0x283248-0x0;var _0x5c19fb=_0x9d25[_0x283248];return _0x5c19fb;};'use strict';var Sequelize=require(_0x59d2('0x0'));module[_0x59d2('0x1')]={'state':{'type':Sequelize[_0x59d2('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x59d2('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x59d2('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x59d2('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x59d2('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x59d2('0x3')]},'originatecalleridname':{'type':Sequelize[_0x59d2('0x3')]},'calleridnum':{'type':Sequelize[_0x59d2('0x3')]},'calleridname':{'type':Sequelize[_0x59d2('0x3')]},'starttime':{'type':Sequelize[_0x59d2('0x4')]},'responsetime':{'type':Sequelize[_0x59d2('0x4')]},'answertime':{'type':Sequelize[_0x59d2('0x4')]},'droptime':{'type':Sequelize[_0x59d2('0x4')]},'endtime':{'type':Sequelize[_0x59d2('0x4')]},'ringtime':{'type':Sequelize[_0x59d2('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x59d2('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x59d2('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x59d2('0x3')]},'campaign':{'type':Sequelize[_0x59d2('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x59d2('0x3')]},'reason':{'type':Sequelize[_0x59d2('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x59d2('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x59d2('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x59d2('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x59d2('0x4')]},'recallme':{'type':Sequelize[_0x59d2('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x59d2('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x59d2('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x59d2('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x59d2('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x75aa=['STRING','DATE','BOOLEAN','exports','INTEGER'];(function(_0x24493e,_0x578854){var _0x5c444f=function(_0x386c9b){while(--_0x386c9b){_0x24493e['push'](_0x24493e['shift']());}};_0x5c444f(++_0x578854);}(_0x75aa,0xfd));var _0xa75a=function(_0x165d16,_0xa62398){_0x165d16=_0x165d16-0x0;var _0x1e85e5=_0x75aa[_0x165d16];return _0x1e85e5;};'use strict';var Sequelize=require('sequelize');module[_0xa75a('0x0')]={'state':{'type':Sequelize[_0xa75a('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xa75a('0x2')]},'scheduledat':{'type':Sequelize[_0xa75a('0x3')]},'countbusyretry':{'type':Sequelize[_0xa75a('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa75a('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xa75a('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xa75a('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xa75a('0x2')]},'originatecalleridname':{'type':Sequelize[_0xa75a('0x2')]},'calleridnum':{'type':Sequelize[_0xa75a('0x2')]},'calleridname':{'type':Sequelize[_0xa75a('0x2')]},'starttime':{'type':Sequelize[_0xa75a('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xa75a('0x3')]},'droptime':{'type':Sequelize[_0xa75a('0x3')]},'endtime':{'type':Sequelize[_0xa75a('0x3')]},'ringtime':{'type':Sequelize[_0xa75a('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xa75a('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xa75a('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xa75a('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xa75a('0x2')]},'campaign':{'type':Sequelize[_0xa75a('0x2')]},'campaigntype':{'type':Sequelize[_0xa75a('0x2')]},'membername':{'type':Sequelize[_0xa75a('0x2')]},'reason':{'type':Sequelize[_0xa75a('0x2')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xa75a('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xa75a('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa75a('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa75a('0x3')]},'recallme':{'type':Sequelize[_0xa75a('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xa75a('0x3')]},'edited':{'type':Sequelize[_0xa75a('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xa75a('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa75a('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa75a('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa75a('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index c829935..e054187 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 _0xf481=['error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','catch','create','body','describe','find','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','update','then','destroy'];(function(_0x443a06,_0x5bafca){var _0xa1fb2b=function(_0x141ddd){while(--_0x141ddd){_0x443a06['push'](_0x443a06['shift']());}};_0xa1fb2b(++_0x5bafca);}(_0xf481,0x1f1));var _0x1f48=function(_0x3dd8dd,_0x369f8e){_0x3dd8dd=_0x3dd8dd-0x0;var _0x33e300=_0xf481[_0x3dd8dd];return _0x33e300;};'use strict';var emlformat=require(_0x1f48('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1f48('0x1'));var jsonpatch=require(_0x1f48('0x2'));var rp=require('request-promise');var moment=require(_0x1f48('0x3'));var BPromise=require(_0x1f48('0x4'));var Mustache=require('mustache');var util=require(_0x1f48('0x5'));var path=require(_0x1f48('0x6'));var sox=require('sox');var csv=require(_0x1f48('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1f48('0x8'));var _=require(_0x1f48('0x9'));var squel=require('squel');var crypto=require(_0x1f48('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1f48('0xb'));var toCsv=require(_0x1f48('0x7'));var querystring=require(_0x1f48('0xc'));var Papa=require('papaparse');var Redis=require(_0x1f48('0xd'));var authService=require(_0x1f48('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x1f48('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x1f48('0x10'));var licenseUtil=require(_0x1f48('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f1cde,_0x123a46){_0x123a46=_0x123a46||0xcc;return function(_0x3b3fdc){if(_0x3b3fdc){return _0x5f1cde[_0x1f48('0x12')](_0x123a46);}return _0x5f1cde[_0x1f48('0x13')](_0x123a46)[_0x1f48('0x14')]();};}function respondWithResult(_0x276b1f,_0xd2de60){_0xd2de60=_0xd2de60||0xc8;return function(_0x438207){if(_0x438207){return _0x276b1f['status'](_0xd2de60)[_0x1f48('0x15')](_0x438207);}};}function respondWithFilteredResult(_0x40b945,_0x202b69){return function(_0x53a019){if(_0x53a019){var _0x58bf9d=typeof _0x202b69['offset']===_0x1f48('0x16')&&typeof _0x202b69[_0x1f48('0x17')]==='undefined';var _0x50a3c6=_0x53a019[_0x1f48('0x18')];var _0x3f1a8f=_0x58bf9d?0x0:_0x202b69[_0x1f48('0x19')];var _0x241347=_0x58bf9d?_0x53a019['count']:_0x202b69[_0x1f48('0x19')]+_0x202b69[_0x1f48('0x17')];var _0x545efd;if(_0x241347>=_0x50a3c6){_0x241347=_0x50a3c6;_0x545efd=0xc8;}else{_0x545efd=0xce;}_0x40b945['status'](_0x545efd);return _0x40b945['set'](_0x1f48('0x1a'),_0x3f1a8f+'-'+_0x241347+'/'+_0x50a3c6)[_0x1f48('0x15')](_0x53a019);}return null;};}function patchUpdates(_0x321095){return function(_0x3795c7){try{jsonpatch[_0x1f48('0x1b')](_0x3795c7,_0x321095,!![]);}catch(_0x51a26d){return BPromise['reject'](_0x51a26d);}return _0x3795c7['save']();};}function saveUpdates(_0x4ff3e6,_0x7db0d5){return function(_0x15b433){if(_0x15b433){return _0x15b433[_0x1f48('0x1c')](_0x4ff3e6)[_0x1f48('0x1d')](function(_0x4a6b3c){return _0x4a6b3c;});}return null;};}function removeEntity(_0x32bcff,_0x376856){return function(_0x2e8d46){if(_0x2e8d46){return _0x2e8d46[_0x1f48('0x1e')]()[_0x1f48('0x1d')](function(){_0x32bcff[_0x1f48('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1eb5ca,_0x8ed6f8){return function(_0x346469){if(!_0x346469){_0x1eb5ca[_0x1f48('0x12')](0x194);}return _0x346469;};}function handleError(_0x11e5b6,_0x506521){_0x506521=_0x506521||0x1f4;return function(_0x16b7cd){logger[_0x1f48('0x1f')](_0x16b7cd[_0x1f48('0x20')]);if(_0x16b7cd['name']){delete _0x16b7cd[_0x1f48('0x21')];}_0x11e5b6[_0x1f48('0x13')](_0x506521)[_0x1f48('0x22')](_0x16b7cd);};}exports[_0x1f48('0x23')]=function(_0xc1f877,_0x1960d2){var _0x213765={},_0x4d7f03={},_0x2a6fa1={'count':0x0,'rows':[]};var _0x16f36f=_[_0x1f48('0x24')](db[_0x1f48('0x25')][_0x1f48('0x26')],function(_0x106e54){return{'name':_0x106e54[_0x1f48('0x27')],'type':_0x106e54['type'][_0x1f48('0x28')]};});_0x4d7f03[_0x1f48('0x29')]=_[_0x1f48('0x24')](_0x16f36f,'name');_0x4d7f03[_0x1f48('0x2a')]=_[_0x1f48('0x2b')](_0xc1f877[_0x1f48('0x2a')]);_0x4d7f03[_0x1f48('0x2c')]=_['intersection'](_0x4d7f03[_0x1f48('0x29')],_0x4d7f03[_0x1f48('0x2a')]);_0x213765[_0x1f48('0x2d')]=_[_0x1f48('0x2e')](_0x4d7f03['model'],qs[_0x1f48('0x2f')](_0xc1f877[_0x1f48('0x2a')]['fields']));_0x213765['attributes']=_0x213765[_0x1f48('0x2d')][_0x1f48('0x30')]?_0x213765[_0x1f48('0x2d')]:_0x4d7f03[_0x1f48('0x29')];if(!_0xc1f877[_0x1f48('0x2a')][_0x1f48('0x31')](_0x1f48('0x32'))){_0x213765[_0x1f48('0x17')]=qs['limit'](_0xc1f877[_0x1f48('0x2a')][_0x1f48('0x17')]);_0x213765[_0x1f48('0x19')]=qs[_0x1f48('0x19')](_0xc1f877[_0x1f48('0x2a')][_0x1f48('0x19')]);}_0x213765[_0x1f48('0x33')]=qs[_0x1f48('0x34')](_0xc1f877[_0x1f48('0x2a')][_0x1f48('0x34')]);_0x213765[_0x1f48('0x35')]=qs[_0x1f48('0x2c')](_['pick'](_0xc1f877[_0x1f48('0x2a')],_0x4d7f03['filters']),_0x16f36f);if(_0xc1f877[_0x1f48('0x2a')][_0x1f48('0x36')]){_0x213765['where']=_[_0x1f48('0x37')](_0x213765['where'],{'$or':_[_0x1f48('0x24')](_0x16f36f,function(_0x45db12){if(_0x45db12['type']!=='VIRTUAL'){var _0x56217b={};_0x56217b[_0x45db12['name']]={'$like':'%'+_0xc1f877[_0x1f48('0x2a')][_0x1f48('0x36')]+'%'};return _0x56217b;}})});}_0x213765=_['merge']({},_0x213765,_0xc1f877[_0x1f48('0x38')]);var _0xdd1286={'where':_0x213765[_0x1f48('0x35')]};return db[_0x1f48('0x25')][_0x1f48('0x18')](_0xdd1286)[_0x1f48('0x1d')](function(_0x482e6a){_0x2a6fa1[_0x1f48('0x18')]=_0x482e6a;if(_0xc1f877[_0x1f48('0x2a')][_0x1f48('0x39')]){_0x213765[_0x1f48('0x3a')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x1f48('0x3b')](_0x213765);})['then'](function(_0x18c734){_0x2a6fa1['rows']=_0x18c734;return _0x2a6fa1;})[_0x1f48('0x1d')](respondWithFilteredResult(_0x1960d2,_0x213765))['catch'](handleError(_0x1960d2,null));};exports['show']=function(_0x52cfa3,_0x3eaa32){var _0x320449={'raw':!![],'where':{'id':_0x52cfa3['params']['id']}},_0x2ca41d={};_0x2ca41d[_0x1f48('0x29')]=_[_0x1f48('0x2b')](db[_0x1f48('0x25')]['rawAttributes']);_0x2ca41d[_0x1f48('0x2a')]=_[_0x1f48('0x2b')](_0x52cfa3[_0x1f48('0x2a')]);_0x2ca41d[_0x1f48('0x2c')]=_[_0x1f48('0x2e')](_0x2ca41d['model'],_0x2ca41d[_0x1f48('0x2a')]);_0x320449['attributes']=_[_0x1f48('0x2e')](_0x2ca41d[_0x1f48('0x29')],qs[_0x1f48('0x2f')](_0x52cfa3[_0x1f48('0x2a')][_0x1f48('0x2f')]));_0x320449[_0x1f48('0x2d')]=_0x320449[_0x1f48('0x2d')]['length']?_0x320449[_0x1f48('0x2d')]:_0x2ca41d[_0x1f48('0x29')];if(_0x52cfa3[_0x1f48('0x2a')][_0x1f48('0x39')]){_0x320449[_0x1f48('0x3a')]=[{'all':!![]}];}_0x320449=_[_0x1f48('0x37')]({},_0x320449,_0x52cfa3['options']);return db[_0x1f48('0x25')]['find'](_0x320449)[_0x1f48('0x1d')](handleEntityNotFound(_0x3eaa32,null))[_0x1f48('0x1d')](respondWithResult(_0x3eaa32,null))[_0x1f48('0x3c')](handleError(_0x3eaa32,null));};exports['create']=function(_0xe33773,_0x5dae77){return db['CmHopperHistory'][_0x1f48('0x3d')](_0xe33773[_0x1f48('0x3e')],{})[_0x1f48('0x1d')](respondWithResult(_0x5dae77,0xc9))['catch'](handleError(_0x5dae77,null));};exports[_0x1f48('0x3f')]=function(_0x46000e,_0x364a5a){return db[_0x1f48('0x25')][_0x1f48('0x3f')]()['then'](respondWithResult(_0x364a5a,null))[_0x1f48('0x3c')](handleError(_0x364a5a,null));};exports[_0x1f48('0x1c')]=function(_0x5349c4,_0x35e39d){if(_0x5349c4[_0x1f48('0x3e')]['uniqueid']){delete _0x5349c4['body']['uniqueid'];}return db[_0x1f48('0x25')][_0x1f48('0x40')]({'where':{'uniqueid':_0x5349c4[_0x1f48('0x41')]['id']}})[_0x1f48('0x1d')](handleEntityNotFound(_0x35e39d,null))[_0x1f48('0x1d')](saveUpdates(_0x5349c4['body'],null))[_0x1f48('0x1d')](respondWithResult(_0x35e39d,null))['catch'](handleError(_0x35e39d,null));}; \ No newline at end of file +var _0xe611=['type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','create','body','uniqueid','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','end','sendStatus','error','name','map','CmHopperHistory','rawAttributes','fieldName'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe611,0x15a));var _0x1e61=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xe611[_0x565c49];return _0x20ca34;};'use strict';var emlformat=require(_0x1e61('0x0'));var rimraf=require(_0x1e61('0x1'));var zipdir=require(_0x1e61('0x2'));var jsonpatch=require(_0x1e61('0x3'));var rp=require(_0x1e61('0x4'));var moment=require(_0x1e61('0x5'));var BPromise=require(_0x1e61('0x6'));var Mustache=require(_0x1e61('0x7'));var util=require(_0x1e61('0x8'));var path=require('path');var sox=require(_0x1e61('0x9'));var csv=require(_0x1e61('0xa'));var ejs=require(_0x1e61('0xb'));var fs=require('fs');var fs_extra=require(_0x1e61('0xc'));var _=require(_0x1e61('0xd'));var squel=require(_0x1e61('0xe'));var crypto=require(_0x1e61('0xf'));var jsforce=require(_0x1e61('0x10'));var deskjs=require(_0x1e61('0x11'));var toCsv=require('to-csv');var querystring=require(_0x1e61('0x12'));var Papa=require(_0x1e61('0x13'));var Redis=require(_0x1e61('0x14'));var authService=require(_0x1e61('0x15'));var qs=require(_0x1e61('0x16'));var as=require(_0x1e61('0x17'));var hardwareService=require(_0x1e61('0x18'));var logger=require('../../config/logger')(_0x1e61('0x19'));var utils=require('../../config/utils');var config=require(_0x1e61('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x1e61('0x1b'))['db'];function respondWithStatusCode(_0xe04460,_0x3d8398){_0x3d8398=_0x3d8398||0xcc;return function(_0x580ad7){if(_0x580ad7){return _0xe04460['sendStatus'](_0x3d8398);}return _0xe04460[_0x1e61('0x1c')](_0x3d8398)['end']();};}function respondWithResult(_0x45053f,_0x710be5){_0x710be5=_0x710be5||0xc8;return function(_0x2dac26){if(_0x2dac26){return _0x45053f['status'](_0x710be5)[_0x1e61('0x1d')](_0x2dac26);}};}function respondWithFilteredResult(_0x9c6093,_0x138c16){return function(_0x31b77b){if(_0x31b77b){var _0x14a64a=typeof _0x138c16['offset']===_0x1e61('0x1e')&&typeof _0x138c16[_0x1e61('0x1f')]==='undefined';var _0x51376a=_0x31b77b['count'];var _0x1d1d28=_0x14a64a?0x0:_0x138c16[_0x1e61('0x20')];var _0x96932c=_0x14a64a?_0x31b77b[_0x1e61('0x21')]:_0x138c16[_0x1e61('0x20')]+_0x138c16['limit'];var _0x19f94f;if(_0x96932c>=_0x51376a){_0x96932c=_0x51376a;_0x19f94f=0xc8;}else{_0x19f94f=0xce;}_0x9c6093[_0x1e61('0x1c')](_0x19f94f);return _0x9c6093[_0x1e61('0x22')](_0x1e61('0x23'),_0x1d1d28+'-'+_0x96932c+'/'+_0x51376a)[_0x1e61('0x1d')](_0x31b77b);}return null;};}function patchUpdates(_0x230861){return function(_0x1258b3){try{jsonpatch[_0x1e61('0x24')](_0x1258b3,_0x230861,!![]);}catch(_0x610213){return BPromise[_0x1e61('0x25')](_0x610213);}return _0x1258b3[_0x1e61('0x26')]();};}function saveUpdates(_0x488294,_0x5412f7){return function(_0x124295){if(_0x124295){return _0x124295[_0x1e61('0x27')](_0x488294)[_0x1e61('0x28')](function(_0x549de2){return _0x549de2;});}return null;};}function removeEntity(_0x14319d,_0x297b4f){return function(_0x9bd841){if(_0x9bd841){return _0x9bd841['destroy']()[_0x1e61('0x28')](function(){_0x14319d['status'](0xcc)[_0x1e61('0x29')]();});}};}function handleEntityNotFound(_0x1141f2,_0x4b4eba){return function(_0x530cbd){if(!_0x530cbd){_0x1141f2[_0x1e61('0x2a')](0x194);}return _0x530cbd;};}function handleError(_0x11cc62,_0x452886){_0x452886=_0x452886||0x1f4;return function(_0x4d583d){logger[_0x1e61('0x2b')](_0x4d583d['stack']);if(_0x4d583d[_0x1e61('0x2c')]){delete _0x4d583d[_0x1e61('0x2c')];}_0x11cc62['status'](_0x452886)['send'](_0x4d583d);};}exports['index']=function(_0x53ee2e,_0x55b0ba){var _0x47d6d6={},_0x45adc8={},_0x51add9={'count':0x0,'rows':[]};var _0x2d0880=_[_0x1e61('0x2d')](db[_0x1e61('0x2e')][_0x1e61('0x2f')],function(_0x559b9a){return{'name':_0x559b9a[_0x1e61('0x30')],'type':_0x559b9a[_0x1e61('0x31')][_0x1e61('0x32')]};});_0x45adc8[_0x1e61('0x33')]=_[_0x1e61('0x2d')](_0x2d0880,'name');_0x45adc8[_0x1e61('0x34')]=_[_0x1e61('0x35')](_0x53ee2e[_0x1e61('0x34')]);_0x45adc8['filters']=_['intersection'](_0x45adc8[_0x1e61('0x33')],_0x45adc8[_0x1e61('0x34')]);_0x47d6d6[_0x1e61('0x36')]=_[_0x1e61('0x37')](_0x45adc8[_0x1e61('0x33')],qs[_0x1e61('0x38')](_0x53ee2e[_0x1e61('0x34')]['fields']));_0x47d6d6['attributes']=_0x47d6d6['attributes'][_0x1e61('0x39')]?_0x47d6d6['attributes']:_0x45adc8[_0x1e61('0x33')];if(!_0x53ee2e[_0x1e61('0x34')][_0x1e61('0x3a')](_0x1e61('0x3b'))){_0x47d6d6[_0x1e61('0x1f')]=qs[_0x1e61('0x1f')](_0x53ee2e['query'][_0x1e61('0x1f')]);_0x47d6d6[_0x1e61('0x20')]=qs[_0x1e61('0x20')](_0x53ee2e[_0x1e61('0x34')][_0x1e61('0x20')]);}_0x47d6d6[_0x1e61('0x3c')]=qs['sort'](_0x53ee2e['query'][_0x1e61('0x3d')]);_0x47d6d6[_0x1e61('0x3e')]=qs[_0x1e61('0x3f')](_[_0x1e61('0x40')](_0x53ee2e[_0x1e61('0x34')],_0x45adc8['filters']),_0x2d0880);if(_0x53ee2e[_0x1e61('0x34')][_0x1e61('0x41')]){_0x47d6d6[_0x1e61('0x3e')]=_[_0x1e61('0x42')](_0x47d6d6[_0x1e61('0x3e')],{'$or':_[_0x1e61('0x2d')](_0x2d0880,function(_0x1efd3e){if(_0x1efd3e[_0x1e61('0x31')]!==_0x1e61('0x43')){var _0x1d7cd5={};_0x1d7cd5[_0x1efd3e[_0x1e61('0x2c')]]={'$like':'%'+_0x53ee2e['query']['filter']+'%'};return _0x1d7cd5;}})});}_0x47d6d6=_['merge']({},_0x47d6d6,_0x53ee2e[_0x1e61('0x44')]);var _0x24852c={'where':_0x47d6d6[_0x1e61('0x3e')]};return db['CmHopperHistory']['count'](_0x24852c)['then'](function(_0x481afe){_0x51add9[_0x1e61('0x21')]=_0x481afe;if(_0x53ee2e[_0x1e61('0x34')][_0x1e61('0x45')]){_0x47d6d6['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x1e61('0x46')](_0x47d6d6);})[_0x1e61('0x28')](function(_0x347c2d){_0x51add9[_0x1e61('0x47')]=_0x347c2d;return _0x51add9;})[_0x1e61('0x28')](respondWithFilteredResult(_0x55b0ba,_0x47d6d6))[_0x1e61('0x48')](handleError(_0x55b0ba,null));};exports[_0x1e61('0x49')]=function(_0x2800ff,_0xe26481){var _0x39179c={'raw':!![],'where':{'id':_0x2800ff[_0x1e61('0x4a')]['id']}},_0x12c379={};_0x12c379[_0x1e61('0x33')]=_[_0x1e61('0x35')](db[_0x1e61('0x2e')][_0x1e61('0x2f')]);_0x12c379[_0x1e61('0x34')]=_[_0x1e61('0x35')](_0x2800ff[_0x1e61('0x34')]);_0x12c379['filters']=_[_0x1e61('0x37')](_0x12c379[_0x1e61('0x33')],_0x12c379[_0x1e61('0x34')]);_0x39179c[_0x1e61('0x36')]=_['intersection'](_0x12c379[_0x1e61('0x33')],qs[_0x1e61('0x38')](_0x2800ff[_0x1e61('0x34')][_0x1e61('0x38')]));_0x39179c[_0x1e61('0x36')]=_0x39179c[_0x1e61('0x36')][_0x1e61('0x39')]?_0x39179c[_0x1e61('0x36')]:_0x12c379[_0x1e61('0x33')];if(_0x2800ff[_0x1e61('0x34')][_0x1e61('0x45')]){_0x39179c['include']=[{'all':!![]}];}_0x39179c=_[_0x1e61('0x42')]({},_0x39179c,_0x2800ff['options']);return db[_0x1e61('0x2e')][_0x1e61('0x4b')](_0x39179c)[_0x1e61('0x28')](handleEntityNotFound(_0xe26481,null))[_0x1e61('0x28')](respondWithResult(_0xe26481,null))[_0x1e61('0x48')](handleError(_0xe26481,null));};exports['create']=function(_0x7e96ed,_0x1d364f){return db[_0x1e61('0x2e')][_0x1e61('0x4c')](_0x7e96ed[_0x1e61('0x4d')],{})[_0x1e61('0x28')](respondWithResult(_0x1d364f,0xc9))[_0x1e61('0x48')](handleError(_0x1d364f,null));};exports['describe']=function(_0x17be28,_0x3f6f93){return db[_0x1e61('0x2e')]['describe']()[_0x1e61('0x28')](respondWithResult(_0x3f6f93,null))[_0x1e61('0x48')](handleError(_0x3f6f93,null));};exports[_0x1e61('0x27')]=function(_0x517a89,_0x53f2a7){if(_0x517a89[_0x1e61('0x4d')][_0x1e61('0x4e')]){delete _0x517a89[_0x1e61('0x4d')]['uniqueid'];}return db[_0x1e61('0x2e')][_0x1e61('0x4b')]({'where':{'uniqueid':_0x517a89[_0x1e61('0x4a')]['id']}})[_0x1e61('0x28')](handleEntityNotFound(_0x53f2a7,null))['then'](saveUpdates(_0x517a89[_0x1e61('0x4d')],null))[_0x1e61('0x28')](respondWithResult(_0x53f2a7,null))[_0x1e61('0x48')](handleError(_0x53f2a7,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 543b2f1..95410bd 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 _0x6c45=['uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime'];(function(_0x243092,_0x2b2a3a){var _0x228392=function(_0x5752a2){while(--_0x5752a2){_0x243092['push'](_0x243092['shift']());}};_0x228392(++_0x2b2a3a);}(_0x6c45,0xb1));var _0x56c4=function(_0x31cb37,_0x28159a){_0x31cb37=_0x31cb37-0x0;var _0x293886=_0x6c45[_0x31cb37];return _0x293886;};'use strict';var _=require(_0x56c4('0x0'));var util=require(_0x56c4('0x1'));var logger=require('../../config/logger')(_0x56c4('0x2'));var moment=require(_0x56c4('0x3'));var BPromise=require(_0x56c4('0x4'));var rp=require(_0x56c4('0x5'));var fs=require('fs');var path=require(_0x56c4('0x6'));var rimraf=require(_0x56c4('0x7'));var config=require(_0x56c4('0x8'));var attributes=require(_0x56c4('0x9'));module[_0x56c4('0xa')]=function(_0x3cc49e,_0x1fcb9e){return _0x3cc49e[_0x56c4('0xb')](_0x56c4('0xc'),attributes,{'tableName':_0x56c4('0xd'),'paranoid':![],'indexes':[{'name':_0x56c4('0xe'),'fields':[_0x56c4('0xe')]},{'name':_0x56c4('0xf'),'fields':[_0x56c4('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6e1c=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','CmHopperHistory','cm_hopper_history','endtime','uniqueid'];(function(_0x53fd63,_0x1eb308){var _0x30b547=function(_0x2dda0c){while(--_0x2dda0c){_0x53fd63['push'](_0x53fd63['shift']());}};_0x30b547(++_0x1eb308);}(_0x6e1c,0xb6));var _0xc6e1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6e1c[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc6e1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc6e1('0x1'));var moment=require(_0xc6e1('0x2'));var BPromise=require(_0xc6e1('0x3'));var rp=require(_0xc6e1('0x4'));var fs=require('fs');var path=require(_0xc6e1('0x5'));var rimraf=require(_0xc6e1('0x6'));var config=require(_0xc6e1('0x7'));var attributes=require(_0xc6e1('0x8'));module[_0xc6e1('0x9')]=function(_0x3e2d6c,_0x468a80){return _0x3e2d6c['define'](_0xc6e1('0xa'),attributes,{'tableName':_0xc6e1('0xb'),'paranoid':![],'indexes':[{'name':_0xc6e1('0xc'),'fields':[_0xc6e1('0xc')]},{'name':_0xc6e1('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 6c690a4..c929669 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 _0xcf4c=['where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','catch','AvgHandleTime','findAll','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory'];(function(_0x466b7c,_0xa417b0){var _0x56b31d=function(_0x1b7d7c){while(--_0x1b7d7c){_0x466b7c['push'](_0x466b7c['shift']());}};_0x56b31d(++_0xa417b0);}(_0xcf4c,0x19a));var _0xccf4=function(_0x145239,_0x590102){_0x145239=_0x145239-0x0;var _0x4df6f0=_0xcf4c[_0x145239];return _0x4df6f0;};'use strict';var _=require(_0xccf4('0x0'));var util=require(_0xccf4('0x1'));var moment=require(_0xccf4('0x2'));var BPromise=require('bluebird');var rs=require(_0xccf4('0x3'));var fs=require('fs');var Redis=require(_0xccf4('0x4'));var db=require(_0xccf4('0x5'))['db'];var utils=require(_0xccf4('0x6'));var logger=require(_0xccf4('0x7'))(_0xccf4('0x8'));var config=require(_0xccf4('0x9'));var jayson=require(_0xccf4('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x82c875,_0x55c93c,_0x494d1b){return new BPromise(function(_0xc21f7e,_0x5207ad){return client[_0xccf4('0xb')](_0x82c875,_0x494d1b)[_0xccf4('0xc')](function(_0x567a56){logger[_0xccf4('0xd')](_0xccf4('0xe'),_0x55c93c,_0xccf4('0xf'));logger[_0xccf4('0x10')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x55c93c,_0xccf4('0xf'),JSON[_0xccf4('0x11')](_0x567a56));if(_0x567a56['error']){if(_0x567a56[_0xccf4('0x12')][_0xccf4('0x13')]===0x1f4){logger[_0xccf4('0x12')](_0xccf4('0xe'),_0x55c93c,_0x567a56['error'][_0xccf4('0x14')]);return _0x5207ad(_0x567a56[_0xccf4('0x12')][_0xccf4('0x14')]);}logger['error'](_0xccf4('0xe'),_0x55c93c,_0x567a56['error'][_0xccf4('0x14')]);return _0xc21f7e(_0x567a56[_0xccf4('0x12')][_0xccf4('0x14')]);}else{logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x55c93c,_0xccf4('0xf'));_0xc21f7e(_0x567a56[_0xccf4('0x15')][_0xccf4('0x14')]);}})['catch'](function(_0x495b86){logger['error'](_0xccf4('0xe'),_0x55c93c,_0x495b86);_0x5207ad(_0x495b86);});});}exports[_0xccf4('0x16')]=function(_0x5dd7f9){var _0x204b51=this;return new Promise(function(_0x2fe5f2,_0x2bbf71){return db[_0xccf4('0x17')][_0xccf4('0x18')](_0x5dd7f9[_0xccf4('0x19')],{'raw':_0x5dd7f9[_0xccf4('0x1a')]?_0x5dd7f9[_0xccf4('0x1a')][_0xccf4('0x1b')]===undefined?!![]:![]:!![]})[_0xccf4('0xc')](function(_0x25f2ca){logger[_0xccf4('0xd')](_0xccf4('0x16'),_0x5dd7f9);logger[_0xccf4('0x10')](_0xccf4('0x16'),_0x5dd7f9,JSON[_0xccf4('0x11')](_0x25f2ca));_0x2fe5f2(_0x25f2ca);})[_0xccf4('0x1c')](function(_0x4aa05b){logger[_0xccf4('0x12')](_0xccf4('0x16'),_0x4aa05b[_0xccf4('0x14')],_0x5dd7f9);_0x2bbf71(_0x204b51[_0xccf4('0x12')](0x1f4,_0x4aa05b[_0xccf4('0x14')]));});});};exports[_0xccf4('0x1d')]=function(_0x4e9dac){var _0x13bd14=this;return new Promise(function(_0x3a08ab,_0x3f39a4){return db[_0xccf4('0x17')][_0xccf4('0x1e')]({'raw':_0x4e9dac[_0xccf4('0x1a')]?_0x4e9dac['options'][_0xccf4('0x1b')]===undefined?!![]:![]:!![],'where':_0x4e9dac[_0xccf4('0x1a')]?_0x4e9dac[_0xccf4('0x1a')]['where']||null:null,'attributes':[[db[_0xccf4('0x1f')]['fn'](_0xccf4('0x20'),db[_0xccf4('0x1f')][_0xccf4('0x21')]('id')),_0xccf4('0x22')],[db[_0xccf4('0x1f')]['fn'](_0xccf4('0x20'),db[_0xccf4('0x1f')]['fn']('IF',db[_0xccf4('0x1f')][_0xccf4('0x23')](_0xccf4('0x24')))),_0xccf4('0x25')],[db[_0xccf4('0x1f')]['fn'](_0xccf4('0x20'),db[_0xccf4('0x1f')]['fn']('IF',db[_0xccf4('0x1f')][_0xccf4('0x23')](_0xccf4('0x26')))),_0xccf4('0x27')],[db[_0xccf4('0x1f')]['fn'](_0xccf4('0x20'),db[_0xccf4('0x1f')]['fn']('IF',db['sequelize'][_0xccf4('0x23')]('`state`\x20=\x2011,\x201,\x20null'))),_0xccf4('0x28')],[db[_0xccf4('0x1f')]['fn'](_0xccf4('0x29'),db['sequelize']['fn']('IF',db[_0xccf4('0x1f')][_0xccf4('0x23')](_0xccf4('0x2a')))),'predictiveIntervalAvgHoldtime'],[db[_0xccf4('0x1f')]['fn']('AVG',db[_0xccf4('0x1f')]['fn']('IF',db[_0xccf4('0x1f')][_0xccf4('0x23')](_0xccf4('0x2b')))),_0xccf4('0x2c')]]})[_0xccf4('0xc')](function(_0x21c2f9){logger[_0xccf4('0xd')](_0xccf4('0x1d'),_0x4e9dac);logger[_0xccf4('0x10')](_0xccf4('0x1d'),_0x4e9dac,JSON[_0xccf4('0x11')](_0x21c2f9));_0x3a08ab(_0x21c2f9);})['catch'](function(_0x21aa52){logger['error'](_0xccf4('0x1d'),_0x21aa52['message'],_0x4e9dac);_0x3f39a4(_0x13bd14[_0xccf4('0x12')](0x1f4,_0x21aa52[_0xccf4('0x14')]));});});};exports[_0xccf4('0x2d')]=function(_0x1beb6f){var _0x167992=this;return new Promise(function(_0x405af7,_0x57973a){return db[_0xccf4('0x17')][_0xccf4('0x1e')]({'raw':_0x1beb6f[_0xccf4('0x1a')]?_0x1beb6f[_0xccf4('0x1a')][_0xccf4('0x1b')]===undefined?!![]:![]:!![],'where':_0x1beb6f[_0xccf4('0x1a')]?_0x1beb6f[_0xccf4('0x1a')][_0xccf4('0x2e')]||null:null,'attributes':[[_0xccf4('0x2f'),_0xccf4('0x30')],[db['sequelize']['fn'](_0xccf4('0x20'),db['sequelize']['fn']('IF',db[_0xccf4('0x1f')][_0xccf4('0x23')](_0xccf4('0x31')))),_0xccf4('0x32')],[db[_0xccf4('0x1f')]['fn']('COUNT',db[_0xccf4('0x1f')]['fn']('IF',db['sequelize']['literal'](_0xccf4('0x33')))),_0xccf4('0x34')],[db[_0xccf4('0x1f')]['fn'](_0xccf4('0x20'),db[_0xccf4('0x1f')]['fn']('IF',db[_0xccf4('0x1f')][_0xccf4('0x23')](_0xccf4('0x24')))),'outboundAnswerCallsDay'],[db[_0xccf4('0x1f')]['fn'](_0xccf4('0x20'),db[_0xccf4('0x1f')]['fn']('IF',db['sequelize'][_0xccf4('0x23')](_0xccf4('0x35')))),_0xccf4('0x36')],[db['sequelize']['fn'](_0xccf4('0x20'),db[_0xccf4('0x1f')]['fn']('IF',db['sequelize'][_0xccf4('0x23')](_0xccf4('0x37')))),_0xccf4('0x38')],[db['sequelize']['fn'](_0xccf4('0x20'),db[_0xccf4('0x1f')]['fn']('IF',db[_0xccf4('0x1f')][_0xccf4('0x23')](_0xccf4('0x39')))),_0xccf4('0x3a')],[db[_0xccf4('0x1f')]['fn']('COUNT',db[_0xccf4('0x1f')]['fn']('IF',db[_0xccf4('0x1f')][_0xccf4('0x23')](_0xccf4('0x3b')))),_0xccf4('0x3c')],[db['sequelize']['fn'](_0xccf4('0x20'),db[_0xccf4('0x1f')]['fn']('IF',db[_0xccf4('0x1f')]['literal'](_0xccf4('0x3d')))),_0xccf4('0x3e')],[db['sequelize']['fn'](_0xccf4('0x20'),db[_0xccf4('0x1f')]['fn']('IF',db['sequelize'][_0xccf4('0x23')]('`state`\x20=\x2013,\x201,\x20null'))),_0xccf4('0x3f')],[db[_0xccf4('0x1f')]['fn'](_0xccf4('0x20'),db['sequelize']['fn']('IF',db[_0xccf4('0x1f')][_0xccf4('0x23')](_0xccf4('0x40')))),_0xccf4('0x41')],[db['sequelize']['fn'](_0xccf4('0x20'),db[_0xccf4('0x1f')]['fn']('IF',db[_0xccf4('0x1f')][_0xccf4('0x23')](_0xccf4('0x42')))),_0xccf4('0x43')],[db[_0xccf4('0x1f')]['fn'](_0xccf4('0x20'),db[_0xccf4('0x1f')]['fn']('IF',db[_0xccf4('0x1f')][_0xccf4('0x23')](_0xccf4('0x44')))),_0xccf4('0x45')],[db[_0xccf4('0x1f')]['fn'](_0xccf4('0x20'),db[_0xccf4('0x1f')]['fn']('IF',db[_0xccf4('0x1f')][_0xccf4('0x23')](_0xccf4('0x46')))),_0xccf4('0x43')],[db[_0xccf4('0x1f')]['fn'](_0xccf4('0x20'),db[_0xccf4('0x1f')]['fn']('IF',db[_0xccf4('0x1f')][_0xccf4('0x23')](_0xccf4('0x47')))),_0xccf4('0x48')]],'group':[_0xccf4('0x2f')]})[_0xccf4('0xc')](function(_0x4d8b00){logger[_0xccf4('0xd')]('GetVoiceQueueHopperHistory',_0x1beb6f);logger[_0xccf4('0x10')](_0xccf4('0x2d'),_0x1beb6f,JSON[_0xccf4('0x11')](_0x4d8b00));_0x405af7(_0x4d8b00);})[_0xccf4('0x1c')](function(_0x3f0949){logger[_0xccf4('0x12')](_0xccf4('0x2d'),_0x3f0949[_0xccf4('0x14')],_0x1beb6f);_0x57973a(_0x167992[_0xccf4('0x12')](0x1f4,_0x3f0949['message']));});});};exports[_0xccf4('0x49')]=function(_0x4efc4a){var _0x4735d6=this;return new Promise(function(_0x2a6081,_0x42b648){return db[_0xccf4('0x17')][_0xccf4('0x1e')]({'raw':_0x4efc4a['options']?_0x4efc4a['options'][_0xccf4('0x1b')]===undefined?!![]:![]:!![],'where':_0x4efc4a[_0xccf4('0x1a')]?_0x4efc4a[_0xccf4('0x1a')][_0xccf4('0x2e')]||null:null,'attributes':[[_0xccf4('0x2f'),'name'],[db[_0xccf4('0x1f')]['fn'](_0xccf4('0x20'),db[_0xccf4('0x1f')]['col']('id')),_0xccf4('0x4a')],[db[_0xccf4('0x1f')]['fn']('COUNT',db[_0xccf4('0x1f')]['fn']('IF',db[_0xccf4('0x1f')][_0xccf4('0x23')](_0xccf4('0x24')))),_0xccf4('0x4b')]],'group':['campaign']})['then'](function(_0x3bdc22){logger[_0xccf4('0xd')](_0xccf4('0x49'),_0x4efc4a);logger[_0xccf4('0x10')](_0xccf4('0x49'),_0x4efc4a,JSON[_0xccf4('0x11')](_0x3bdc22));_0x2a6081(_0x3bdc22);})[_0xccf4('0x1c')](function(_0x470f32){logger[_0xccf4('0x12')](_0xccf4('0x49'),_0x470f32['message'],_0x4efc4a);_0x42b648(_0x4735d6[_0xccf4('0x12')](0x1f4,_0x470f32['message']));});});}; \ No newline at end of file +var _0x63e4=['outboundRejectCallsDay','outboundReCallsDay','stringify','GetCampaignHopperHistory','findAll','ivrTotalCallsDays','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','create','body','options','raw','AvgHandleTime','CmHopperHistory','col','sequelize','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','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','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null'];(function(_0x3f4dd9,_0xe0b819){var _0x31c54a=function(_0x25e6c6){while(--_0x25e6c6){_0x3f4dd9['push'](_0x3f4dd9['shift']());}};_0x31c54a(++_0xe0b819);}(_0x63e4,0x12a));var _0x463e=function(_0x4af629,_0x52bc11){_0x4af629=_0x4af629-0x0;var _0x4fca7e=_0x63e4[_0x4af629];return _0x4fca7e;};'use strict';var _=require(_0x463e('0x0'));var util=require(_0x463e('0x1'));var moment=require(_0x463e('0x2'));var BPromise=require(_0x463e('0x3'));var rs=require(_0x463e('0x4'));var fs=require('fs');var Redis=require(_0x463e('0x5'));var db=require(_0x463e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x463e('0x7'))(_0x463e('0x8'));var config=require(_0x463e('0x9'));var jayson=require(_0x463e('0xa'));var client=jayson[_0x463e('0xb')][_0x463e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x703906,_0x273c7a,_0x3a5492){return new BPromise(function(_0x6d5e93,_0x441fed){return client[_0x463e('0xd')](_0x703906,_0x3a5492)[_0x463e('0xe')](function(_0x33e94f){logger[_0x463e('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x273c7a,_0x463e('0x10'));logger[_0x463e('0x11')](_0x463e('0x12'),_0x273c7a,_0x463e('0x10'),JSON['stringify'](_0x33e94f));if(_0x33e94f[_0x463e('0x13')]){if(_0x33e94f[_0x463e('0x13')]['code']===0x1f4){logger[_0x463e('0x13')](_0x463e('0x14'),_0x273c7a,_0x33e94f[_0x463e('0x13')][_0x463e('0x15')]);return _0x441fed(_0x33e94f['error'][_0x463e('0x15')]);}logger[_0x463e('0x13')](_0x463e('0x14'),_0x273c7a,_0x33e94f[_0x463e('0x13')]['message']);return _0x6d5e93(_0x33e94f[_0x463e('0x13')][_0x463e('0x15')]);}else{logger[_0x463e('0xf')](_0x463e('0x14'),_0x273c7a,_0x463e('0x10'));_0x6d5e93(_0x33e94f[_0x463e('0x16')][_0x463e('0x15')]);}})[_0x463e('0x17')](function(_0x1b29ad){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x273c7a,_0x1b29ad);_0x441fed(_0x1b29ad);});});}exports[_0x463e('0x18')]=function(_0x12d637){var _0x292639=this;return new Promise(function(_0x52789a,_0x7390d5){return db['CmHopperHistory'][_0x463e('0x19')](_0x12d637[_0x463e('0x1a')],{'raw':_0x12d637[_0x463e('0x1b')]?_0x12d637[_0x463e('0x1b')][_0x463e('0x1c')]===undefined?!![]:![]:!![]})[_0x463e('0xe')](function(_0x1b196b){logger[_0x463e('0xf')](_0x463e('0x18'),_0x12d637);logger['debug']('CreateCmHopperHistory',_0x12d637,JSON['stringify'](_0x1b196b));_0x52789a(_0x1b196b);})[_0x463e('0x17')](function(_0x402c74){logger['error'](_0x463e('0x18'),_0x402c74[_0x463e('0x15')],_0x12d637);_0x7390d5(_0x292639['error'](0x1f4,_0x402c74[_0x463e('0x15')]));});});};exports[_0x463e('0x1d')]=function(_0x3f001d){var _0x44d4ec=this;return new Promise(function(_0x77473b,_0x4726a5){return db[_0x463e('0x1e')]['findAll']({'raw':_0x3f001d[_0x463e('0x1b')]?_0x3f001d['options'][_0x463e('0x1c')]===undefined?!![]:![]:!![],'where':_0x3f001d['options']?_0x3f001d[_0x463e('0x1b')]['where']||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize'][_0x463e('0x1f')]('id')),'predictiveIntervalTotalCalls'],[db[_0x463e('0x20')]['fn'](_0x463e('0x21'),db[_0x463e('0x20')]['fn']('IF',db[_0x463e('0x20')][_0x463e('0x22')](_0x463e('0x23')))),_0x463e('0x24')],[db['sequelize']['fn'](_0x463e('0x21'),db[_0x463e('0x20')]['fn']('IF',db[_0x463e('0x20')][_0x463e('0x22')](_0x463e('0x25')))),_0x463e('0x26')],[db[_0x463e('0x20')]['fn']('COUNT',db[_0x463e('0x20')]['fn']('IF',db[_0x463e('0x20')][_0x463e('0x22')](_0x463e('0x27')))),_0x463e('0x28')],[db[_0x463e('0x20')]['fn'](_0x463e('0x29'),db[_0x463e('0x20')]['fn']('IF',db[_0x463e('0x20')][_0x463e('0x22')](_0x463e('0x2a')))),_0x463e('0x2b')],[db[_0x463e('0x20')]['fn'](_0x463e('0x29'),db[_0x463e('0x20')]['fn']('IF',db[_0x463e('0x20')][_0x463e('0x22')](_0x463e('0x2c')))),_0x463e('0x2d')]]})[_0x463e('0xe')](function(_0x547615){logger['info'](_0x463e('0x1d'),_0x3f001d);logger['debug'](_0x463e('0x1d'),_0x3f001d,JSON['stringify'](_0x547615));_0x77473b(_0x547615);})[_0x463e('0x17')](function(_0x494ce3){logger[_0x463e('0x13')](_0x463e('0x1d'),_0x494ce3[_0x463e('0x15')],_0x3f001d);_0x4726a5(_0x44d4ec['error'](0x1f4,_0x494ce3[_0x463e('0x15')]));});});};exports[_0x463e('0x2e')]=function(_0x10795f){var _0x23ac94=this;return new Promise(function(_0x5e1f8c,_0x1f9f75){return db[_0x463e('0x1e')]['findAll']({'raw':_0x10795f[_0x463e('0x1b')]?_0x10795f[_0x463e('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x10795f[_0x463e('0x1b')]?_0x10795f[_0x463e('0x1b')]['where']||null:null,'attributes':[[_0x463e('0x2f'),_0x463e('0x30')],[db[_0x463e('0x20')]['fn'](_0x463e('0x21'),db['sequelize']['fn']('IF',db[_0x463e('0x20')][_0x463e('0x22')](_0x463e('0x31')))),_0x463e('0x32')],[db[_0x463e('0x20')]['fn'](_0x463e('0x21'),db[_0x463e('0x20')]['fn']('IF',db['sequelize']['literal'](_0x463e('0x33')))),_0x463e('0x34')],[db[_0x463e('0x20')]['fn'](_0x463e('0x21'),db[_0x463e('0x20')]['fn']('IF',db[_0x463e('0x20')][_0x463e('0x22')]('`state`\x20=\x204,\x201,\x20null'))),_0x463e('0x35')],[db[_0x463e('0x20')]['fn'](_0x463e('0x21'),db[_0x463e('0x20')]['fn']('IF',db[_0x463e('0x20')][_0x463e('0x22')](_0x463e('0x36')))),'outboundBusyCallsDay'],[db[_0x463e('0x20')]['fn'](_0x463e('0x21'),db[_0x463e('0x20')]['fn']('IF',db[_0x463e('0x20')][_0x463e('0x22')](_0x463e('0x37')))),_0x463e('0x38')],[db[_0x463e('0x20')]['fn'](_0x463e('0x21'),db[_0x463e('0x20')]['fn']('IF',db[_0x463e('0x20')][_0x463e('0x22')](_0x463e('0x39')))),_0x463e('0x3a')],[db['sequelize']['fn']('COUNT',db[_0x463e('0x20')]['fn']('IF',db[_0x463e('0x20')][_0x463e('0x22')](_0x463e('0x3b')))),_0x463e('0x3c')],[db[_0x463e('0x20')]['fn'](_0x463e('0x21'),db['sequelize']['fn']('IF',db['sequelize'][_0x463e('0x22')](_0x463e('0x3d')))),_0x463e('0x3e')],[db[_0x463e('0x20')]['fn']('COUNT',db[_0x463e('0x20')]['fn']('IF',db[_0x463e('0x20')][_0x463e('0x22')]('`state`\x20=\x2013,\x201,\x20null'))),_0x463e('0x3f')],[db[_0x463e('0x20')]['fn'](_0x463e('0x21'),db['sequelize']['fn']('IF',db[_0x463e('0x20')][_0x463e('0x22')](_0x463e('0x40')))),_0x463e('0x41')],[db[_0x463e('0x20')]['fn'](_0x463e('0x21'),db[_0x463e('0x20')]['fn']('IF',db[_0x463e('0x20')][_0x463e('0x22')](_0x463e('0x42')))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0x463e('0x21'),db[_0x463e('0x20')]['fn']('IF',db[_0x463e('0x20')][_0x463e('0x22')]('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db[_0x463e('0x20')]['fn'](_0x463e('0x21'),db[_0x463e('0x20')]['fn']('IF',db['sequelize'][_0x463e('0x22')]('`state`\x20=\x2020,\x201,\x20null'))),_0x463e('0x43')],[db['sequelize']['fn']('COUNT',db[_0x463e('0x20')]['fn']('IF',db[_0x463e('0x20')][_0x463e('0x22')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x463e('0x44')]],'group':[_0x463e('0x2f')]})[_0x463e('0xe')](function(_0x33f6ad){logger[_0x463e('0xf')](_0x463e('0x2e'),_0x10795f);logger[_0x463e('0x11')](_0x463e('0x2e'),_0x10795f,JSON[_0x463e('0x45')](_0x33f6ad));_0x5e1f8c(_0x33f6ad);})[_0x463e('0x17')](function(_0x4fa09e){logger[_0x463e('0x13')]('GetVoiceQueueHopperHistory',_0x4fa09e[_0x463e('0x15')],_0x10795f);_0x1f9f75(_0x23ac94[_0x463e('0x13')](0x1f4,_0x4fa09e[_0x463e('0x15')]));});});};exports[_0x463e('0x46')]=function(_0x5eb382){var _0x1c184b=this;return new Promise(function(_0x46f223,_0x352021){return db[_0x463e('0x1e')][_0x463e('0x47')]({'raw':_0x5eb382[_0x463e('0x1b')]?_0x5eb382[_0x463e('0x1b')][_0x463e('0x1c')]===undefined?!![]:![]:!![],'where':_0x5eb382[_0x463e('0x1b')]?_0x5eb382[_0x463e('0x1b')]['where']||null:null,'attributes':[[_0x463e('0x2f'),_0x463e('0x30')],[db[_0x463e('0x20')]['fn'](_0x463e('0x21'),db['sequelize'][_0x463e('0x1f')]('id')),_0x463e('0x48')],[db[_0x463e('0x20')]['fn'](_0x463e('0x21'),db[_0x463e('0x20')]['fn']('IF',db[_0x463e('0x20')][_0x463e('0x22')](_0x463e('0x23')))),'ivrAnswerCallsDay']],'group':['campaign']})[_0x463e('0xe')](function(_0x3e64c1){logger['info'](_0x463e('0x46'),_0x5eb382);logger[_0x463e('0x11')](_0x463e('0x46'),_0x5eb382,JSON[_0x463e('0x45')](_0x3e64c1));_0x46f223(_0x3e64c1);})['catch'](function(_0x35c0ea){logger['error'](_0x463e('0x46'),_0x35c0ea[_0x463e('0x15')],_0x5eb382);_0x352021(_0x1c184b[_0x463e('0x13')](0x1f4,_0x35c0ea[_0x463e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 3f1ad64..3a9f64d 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 _0xbed1=['create','/:id','update','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','post'];(function(_0x49dc0e,_0x1846c7){var _0x2d4930=function(_0x33eb70){while(--_0x33eb70){_0x49dc0e['push'](_0x49dc0e['shift']());}};_0x2d4930(++_0x1846c7);}(_0xbed1,0x183));var _0x1bed=function(_0x13992d,_0x3029ea){_0x13992d=_0x13992d-0x0;var _0x3d15bf=_0xbed1[_0x13992d];return _0x3d15bf;};'use strict';var multer=require(_0x1bed('0x0'));var util=require('util');var path=require(_0x1bed('0x1'));var timeout=require(_0x1bed('0x2'));var express=require(_0x1bed('0x3'));var router=express['Router']();var fs_extra=require(_0x1bed('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1bed('0x5'));var config=require(_0x1bed('0x6'));var controller=require('./cmHopperHistory.controller');router[_0x1bed('0x7')]('/',auth[_0x1bed('0x8')](),controller[_0x1bed('0x9')]);router[_0x1bed('0x7')](_0x1bed('0xa'),auth['isAuthenticated'](),controller[_0x1bed('0xb')]);router[_0x1bed('0x7')]('/:id',auth[_0x1bed('0x8')](),controller['show']);router[_0x1bed('0xc')]('/',auth[_0x1bed('0x8')](),controller[_0x1bed('0xd')]);router['put'](_0x1bed('0xe'),auth[_0x1bed('0x8')](),controller[_0x1bed('0xf')]);module['exports']=router; \ No newline at end of file +var _0x3548=['util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','describe','/:id','post','create','multer'];(function(_0x1034bb,_0x4e20b3){var _0x453fdb=function(_0x455356){while(--_0x455356){_0x1034bb['push'](_0x1034bb['shift']());}};_0x453fdb(++_0x4e20b3);}(_0x3548,0x13a));var _0x8354=function(_0x4deca9,_0x470246){_0x4deca9=_0x4deca9-0x0;var _0x534fe2=_0x3548[_0x4deca9];return _0x534fe2;};'use strict';var multer=require(_0x8354('0x0'));var util=require(_0x8354('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8354('0x2'));var router=express[_0x8354('0x3')]();var fs_extra=require(_0x8354('0x4'));var auth=require(_0x8354('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8354('0x6'));var controller=require(_0x8354('0x7'));router[_0x8354('0x8')]('/',auth[_0x8354('0x9')](),controller[_0x8354('0xa')]);router[_0x8354('0x8')]('/describe',auth[_0x8354('0x9')](),controller[_0x8354('0xb')]);router[_0x8354('0x8')](_0x8354('0xc'),auth[_0x8354('0x9')](),controller['show']);router[_0x8354('0xd')]('/',auth[_0x8354('0x9')](),controller[_0x8354('0xe')]);router['put'](_0x8354('0xc'),auth[_0x8354('0x9')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 11a9164..95ca432 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 _0xfa2b=['exports','STRING','name','sequelize'];(function(_0x2b3979,_0x47bc1a){var _0x5e1317=function(_0x46cd68){while(--_0x46cd68){_0x2b3979['push'](_0x2b3979['shift']());}};_0x5e1317(++_0x47bc1a);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x37583a,_0x38ff18){_0x37583a=_0x37583a-0x0;var _0x7c9ff5=_0xfa2b[_0x37583a];return _0x7c9ff5;};'use strict';var Sequelize=require(_0xbfa2('0x0'));module[_0xbfa2('0x1')]={'name':{'type':Sequelize[_0xbfa2('0x2')],'unique':_0xbfa2('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xbfa2('0x2')]},'dialPrefix':{'type':Sequelize[_0xbfa2('0x2')]}}; \ No newline at end of file +var _0x6b4e=['exports'];(function(_0x26979c,_0x19c70d){var _0x1931d5=function(_0x309a47){while(--_0x309a47){_0x26979c['push'](_0x26979c['shift']());}};_0x1931d5(++_0x19c70d);}(_0x6b4e,0x1a8));var _0xe6b4=function(_0x57fe4d,_0x557ea7){_0x57fe4d=_0x57fe4d-0x0;var _0x3c1011=_0x6b4e[_0x57fe4d];return _0x3c1011;};'use strict';var Sequelize=require('sequelize');module[_0xe6b4('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 6649f5d..267624a 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 _0x2f4e=['message','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','cf_%d','raw','getContactsCsv','format','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','Content-type','download','addCustomField','sequelize','transaction','CmCustomField','addCustomFields','TEXT','text','Sequelize','number','INTEGER','BOOLEAN','defaultValue','queryInterface','cf_%s','findAndCountAll','addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','get','Lists','error','name','send','index','map','CmList','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','addDisposition','ListId','getDispositions','findOne','Disposition','removeDispositions','ids','addContacts','CmContact','isArray','tags','push','each','success','dataValues','errors'];(function(_0x31eb67,_0x9bc8c0){var _0x2a8cb8=function(_0xac1c5d){while(--_0xac1c5d){_0x31eb67['push'](_0x31eb67['shift']());}};_0x2a8cb8(++_0x9bc8c0);}(_0x2f4e,0x1d0));var _0xe2f4=function(_0x2b76cc,_0x84b7a5){_0x2b76cc=_0x2b76cc-0x0;var _0x3d476f=_0x2f4e[_0x2b76cc];return _0x3d476f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe2f4('0x0'));var zipdir=require(_0xe2f4('0x1'));var jsonpatch=require(_0xe2f4('0x2'));var rp=require('request-promise');var moment=require(_0xe2f4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe2f4('0x4'));var util=require(_0xe2f4('0x5'));var path=require('path');var sox=require(_0xe2f4('0x6'));var csv=require(_0xe2f4('0x7'));var ejs=require(_0xe2f4('0x8'));var fs=require('fs');var fs_extra=require(_0xe2f4('0x9'));var _=require(_0xe2f4('0xa'));var squel=require(_0xe2f4('0xb'));var crypto=require(_0xe2f4('0xc'));var jsforce=require(_0xe2f4('0xd'));var deskjs=require(_0xe2f4('0xe'));var toCsv=require(_0xe2f4('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe2f4('0xf'));var authService=require(_0xe2f4('0x10'));var qs=require(_0xe2f4('0x11'));var as=require(_0xe2f4('0x12'));var hardwareService=require(_0xe2f4('0x13'));var logger=require('../../config/logger')(_0xe2f4('0x14'));var utils=require(_0xe2f4('0x15'));var config=require(_0xe2f4('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe2f4('0x17'))['db'];config[_0xe2f4('0x18')]=_[_0xe2f4('0x19')](config[_0xe2f4('0x18')],{'host':_0xe2f4('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe2f4('0x1b'))[_0xe2f4('0x1c')](socket);function respondWithStatusCode(_0x7a077e,_0x589d06){_0x589d06=_0x589d06||0xcc;return function(_0x135626){if(_0x135626){return _0x7a077e[_0xe2f4('0x1d')](_0x589d06);}return _0x7a077e[_0xe2f4('0x1e')](_0x589d06)[_0xe2f4('0x1f')]();};}function respondWithResult(_0x2b810c,_0x3f90c3){_0x3f90c3=_0x3f90c3||0xc8;return function(_0x5cc103){if(_0x5cc103){return _0x2b810c[_0xe2f4('0x1e')](_0x3f90c3)[_0xe2f4('0x20')](_0x5cc103);}};}function respondWithFilteredResult(_0x323731,_0x38cd8d){return function(_0x423a5f){if(_0x423a5f){var _0x1f09ea=typeof _0x38cd8d[_0xe2f4('0x21')]===_0xe2f4('0x22')&&typeof _0x38cd8d[_0xe2f4('0x23')]===_0xe2f4('0x22');var _0x170953=_0x423a5f[_0xe2f4('0x24')];var _0x341db4=_0x1f09ea?0x0:_0x38cd8d[_0xe2f4('0x21')];var _0x2080d2=_0x1f09ea?_0x423a5f[_0xe2f4('0x24')]:_0x38cd8d[_0xe2f4('0x21')]+_0x38cd8d['limit'];var _0x2854c1;if(_0x2080d2>=_0x170953){_0x2080d2=_0x170953;_0x2854c1=0xc8;}else{_0x2854c1=0xce;}_0x323731[_0xe2f4('0x1e')](_0x2854c1);return _0x323731[_0xe2f4('0x25')](_0xe2f4('0x26'),_0x341db4+'-'+_0x2080d2+'/'+_0x170953)['json'](_0x423a5f);}return null;};}function patchUpdates(_0x3ad3b1){return function(_0x19eff2){try{jsonpatch['apply'](_0x19eff2,_0x3ad3b1,!![]);}catch(_0x25b9c2){return BPromise[_0xe2f4('0x27')](_0x25b9c2);}return _0x19eff2['save']();};}function saveUpdates(_0x4584a2,_0x42e700){return function(_0xef29c2){if(_0xef29c2){return _0xef29c2[_0xe2f4('0x28')](_0x4584a2)[_0xe2f4('0x29')](function(_0x2c7675){return _0x2c7675;});}return null;};}function removeEntity(_0x4002a1,_0x44c4b3){return function(_0xc74e59){if(_0xc74e59){return _0xc74e59['destroy']()[_0xe2f4('0x29')](function(){var _0x5233ad=_0xc74e59[_0xe2f4('0x2a')]({'plain':!![]});var _0x227658=_0xe2f4('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x227658,'resourceId':_0x5233ad['id']}})[_0xe2f4('0x29')](function(){return _0xc74e59;});})[_0xe2f4('0x29')](function(){_0x4002a1['status'](0xcc)[_0xe2f4('0x1f')]();});}};}function handleEntityNotFound(_0x2b3436,_0x34ed55){return function(_0x27e7c1){if(!_0x27e7c1){_0x2b3436[_0xe2f4('0x1d')](0x194);}return _0x27e7c1;};}function handleError(_0x4ffdf4,_0x5be3ce){_0x5be3ce=_0x5be3ce||0x1f4;return function(_0x31ab28){logger[_0xe2f4('0x2c')](_0x31ab28['stack']);if(_0x31ab28[_0xe2f4('0x2d')]){delete _0x31ab28[_0xe2f4('0x2d')];}_0x4ffdf4['status'](_0x5be3ce)[_0xe2f4('0x2e')](_0x31ab28);};}exports[_0xe2f4('0x2f')]=function(_0x8ba3a5,_0x1c5ac8){var _0x393f90={},_0x4fba9e={},_0xdca63b={'count':0x0,'rows':[]};var _0x5d5d66=_[_0xe2f4('0x30')](db[_0xe2f4('0x31')]['rawAttributes'],function(_0x2db826){return{'name':_0x2db826[_0xe2f4('0x32')],'type':_0x2db826[_0xe2f4('0x33')]['key']};});_0x4fba9e[_0xe2f4('0x34')]=_[_0xe2f4('0x30')](_0x5d5d66,_0xe2f4('0x2d'));_0x4fba9e[_0xe2f4('0x35')]=_[_0xe2f4('0x36')](_0x8ba3a5['query']);_0x4fba9e[_0xe2f4('0x37')]=_[_0xe2f4('0x38')](_0x4fba9e['model'],_0x4fba9e[_0xe2f4('0x35')]);_0x393f90[_0xe2f4('0x39')]=_['intersection'](_0x4fba9e['model'],qs[_0xe2f4('0x3a')](_0x8ba3a5[_0xe2f4('0x35')][_0xe2f4('0x3a')]));_0x393f90[_0xe2f4('0x39')]=_0x393f90[_0xe2f4('0x39')][_0xe2f4('0x3b')]?_0x393f90[_0xe2f4('0x39')]:_0x4fba9e[_0xe2f4('0x34')];if(!_0x8ba3a5[_0xe2f4('0x35')][_0xe2f4('0x3c')](_0xe2f4('0x3d'))){_0x393f90[_0xe2f4('0x23')]=qs[_0xe2f4('0x23')](_0x8ba3a5[_0xe2f4('0x35')]['limit']);_0x393f90[_0xe2f4('0x21')]=qs[_0xe2f4('0x21')](_0x8ba3a5[_0xe2f4('0x35')][_0xe2f4('0x21')]);}_0x393f90[_0xe2f4('0x3e')]=qs[_0xe2f4('0x3f')](_0x8ba3a5[_0xe2f4('0x35')][_0xe2f4('0x3f')]);_0x393f90[_0xe2f4('0x40')]=qs['filters'](_[_0xe2f4('0x41')](_0x8ba3a5[_0xe2f4('0x35')],_0x4fba9e[_0xe2f4('0x37')]),_0x5d5d66);if(_0x8ba3a5[_0xe2f4('0x35')][_0xe2f4('0x42')]){_0x393f90[_0xe2f4('0x40')]=_['merge'](_0x393f90[_0xe2f4('0x40')],{'$or':_[_0xe2f4('0x30')](_0x5d5d66,function(_0x161406){if(_0x161406[_0xe2f4('0x33')]!==_0xe2f4('0x43')){var _0x507173={};_0x507173[_0x161406[_0xe2f4('0x2d')]]={'$like':'%'+_0x8ba3a5[_0xe2f4('0x35')][_0xe2f4('0x42')]+'%'};return _0x507173;}})});}_0x393f90=_[_0xe2f4('0x44')]({},_0x393f90,_0x8ba3a5['options']);var _0x34e00f={'where':_0x393f90[_0xe2f4('0x40')]};return db[_0xe2f4('0x31')][_0xe2f4('0x24')](_0x34e00f)[_0xe2f4('0x29')](function(_0x210458){_0xdca63b[_0xe2f4('0x24')]=_0x210458;if(_0x8ba3a5[_0xe2f4('0x35')][_0xe2f4('0x45')]){_0x393f90[_0xe2f4('0x46')]=[{'all':!![]}];}return db['CmList'][_0xe2f4('0x47')](_0x393f90);})[_0xe2f4('0x29')](function(_0x1ac1fa){_0xdca63b[_0xe2f4('0x48')]=_0x1ac1fa;return _0xdca63b;})['then'](respondWithFilteredResult(_0x1c5ac8,_0x393f90))[_0xe2f4('0x49')](handleError(_0x1c5ac8,null));};exports[_0xe2f4('0x4a')]=function(_0x4c4701,_0x2cdefe){var _0x30702b={'raw':![],'where':{'id':_0x4c4701[_0xe2f4('0x4b')]['id']}},_0x298763={};_0x298763[_0xe2f4('0x34')]=_[_0xe2f4('0x36')](db[_0xe2f4('0x31')][_0xe2f4('0x4c')]);_0x298763[_0xe2f4('0x35')]=_[_0xe2f4('0x36')](_0x4c4701[_0xe2f4('0x35')]);_0x298763[_0xe2f4('0x37')]=_[_0xe2f4('0x38')](_0x298763['model'],_0x298763['query']);_0x30702b[_0xe2f4('0x39')]=_[_0xe2f4('0x38')](_0x298763[_0xe2f4('0x34')],qs[_0xe2f4('0x3a')](_0x4c4701[_0xe2f4('0x35')]['fields']));_0x30702b[_0xe2f4('0x39')]=_0x30702b[_0xe2f4('0x39')][_0xe2f4('0x3b')]?_0x30702b[_0xe2f4('0x39')]:_0x298763[_0xe2f4('0x34')];if(_0x4c4701['query']['includeAll']){_0x30702b[_0xe2f4('0x46')]=[{'all':!![]}];}_0x30702b=_[_0xe2f4('0x44')]({},_0x30702b,_0x4c4701[_0xe2f4('0x4d')]);return db[_0xe2f4('0x31')][_0xe2f4('0x4e')](_0x30702b)[_0xe2f4('0x29')](handleEntityNotFound(_0x2cdefe,null))[_0xe2f4('0x29')](respondWithResult(_0x2cdefe,null))[_0xe2f4('0x49')](handleError(_0x2cdefe,null));};exports['create']=function(_0x29b98a,_0x3024bb){return db['CmList'][_0xe2f4('0x4f')](_0x29b98a[_0xe2f4('0x50')],{})[_0xe2f4('0x29')](function(_0x5b9681){var _0x306468=_0x29b98a[_0xe2f4('0x51')][_0xe2f4('0x2a')]({'plain':!![]});if(!_0x306468)throw new Error(_0xe2f4('0x52'));if(_0x306468[_0xe2f4('0x53')]===_0xe2f4('0x51')){var _0x529acd=_0x5b9681[_0xe2f4('0x2a')]({'plain':!![]});var _0x21df66=_0xe2f4('0x2b');return db[_0xe2f4('0x54')][_0xe2f4('0x4e')]({'where':{'name':_0x21df66,'userProfileId':_0x306468['userProfileId']},'raw':!![]})[_0xe2f4('0x29')](function(_0x147386){if(_0x147386&&_0x147386['autoAssociation']===0x0){return db['UserProfileResource'][_0xe2f4('0x4f')]({'name':_0x529acd[_0xe2f4('0x2d')],'resourceId':_0x529acd['id'],'type':_0x147386[_0xe2f4('0x2d')],'sectionId':_0x147386['id']},{})[_0xe2f4('0x29')](function(){return _0x5b9681;});}else{return _0x5b9681;}})['catch'](function(_0x4bf4bf){logger[_0xe2f4('0x2c')](_0xe2f4('0x55'),_0x4bf4bf);throw _0x4bf4bf;});}return _0x5b9681;})[_0xe2f4('0x29')](respondWithResult(_0x3024bb,0xc9))['catch'](handleError(_0x3024bb,null));};exports[_0xe2f4('0x28')]=function(_0x2cd347,_0x5181d6){if(_0x2cd347[_0xe2f4('0x50')]['id']){delete _0x2cd347[_0xe2f4('0x50')]['id'];}return db[_0xe2f4('0x31')][_0xe2f4('0x4e')]({'where':{'id':_0x2cd347[_0xe2f4('0x4b')]['id']}})[_0xe2f4('0x29')](handleEntityNotFound(_0x5181d6,null))[_0xe2f4('0x29')](saveUpdates(_0x2cd347['body'],null))['then'](respondWithResult(_0x5181d6,null))[_0xe2f4('0x49')](handleError(_0x5181d6,null));};exports[_0xe2f4('0x56')]=function(_0x4d4e06,_0x19c672){return db['CmList'][_0xe2f4('0x4e')]({'where':{'id':_0x4d4e06['params']['id']}})[_0xe2f4('0x29')](handleEntityNotFound(_0x19c672,null))[_0xe2f4('0x29')](removeEntity(_0x19c672,null))['catch'](handleError(_0x19c672,null));};exports['describe']=function(_0x16298d,_0x151d5a){return db['CmList'][_0xe2f4('0x57')]()[_0xe2f4('0x29')](respondWithResult(_0x151d5a,null))['catch'](handleError(_0x151d5a,null));};exports[_0xe2f4('0x58')]=function(_0xb5308,_0x2bd469,_0x567b82){if(_0xb5308[_0xe2f4('0x50')]['id']){delete _0xb5308[_0xe2f4('0x50')]['id'];}return db[_0xe2f4('0x31')]['find']({'where':{'id':_0xb5308[_0xe2f4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2bd469,null))[_0xe2f4('0x29')](function(_0x4cca67){if(_0x4cca67){_0xb5308[_0xe2f4('0x50')][_0xe2f4('0x59')]=_0x4cca67['id'];return db['Disposition'][_0xe2f4('0x4f')](_0xb5308[_0xe2f4('0x50')]);}})[_0xe2f4('0x29')](respondWithResult(_0x2bd469,null))['catch'](handleError(_0x2bd469,null));};exports[_0xe2f4('0x5a')]=function(_0x325058,_0xc64c5a,_0x3e06ed){var _0x32c311={'raw':![],'where':{}};var _0x59aa11={};var _0x488ce6={'count':0x0,'rows':[]};return db[_0xe2f4('0x31')][_0xe2f4('0x5b')]({'where':{'id':_0x325058[_0xe2f4('0x4b')]['id']}})[_0xe2f4('0x29')](handleEntityNotFound(_0xc64c5a,null))['then'](function(_0x1e51cc){if(_0x1e51cc){_0x59aa11[_0xe2f4('0x34')]=_[_0xe2f4('0x36')](db[_0xe2f4('0x5c')]['rawAttributes']);_0x59aa11[_0xe2f4('0x35')]=_[_0xe2f4('0x36')](_0x325058['query']);_0x59aa11['filters']=_['intersection'](_0x59aa11['model'],_0x59aa11[_0xe2f4('0x35')]);_0x32c311['attributes']=_[_0xe2f4('0x38')](_0x59aa11[_0xe2f4('0x34')],qs[_0xe2f4('0x3a')](_0x325058['query'][_0xe2f4('0x3a')]));_0x32c311['attributes']=_0x32c311[_0xe2f4('0x39')][_0xe2f4('0x3b')]?_0x32c311[_0xe2f4('0x39')]:_0x59aa11[_0xe2f4('0x34')];if(!_0x325058[_0xe2f4('0x35')][_0xe2f4('0x3c')](_0xe2f4('0x3d'))){_0x32c311['limit']=qs[_0xe2f4('0x23')](_0x325058['query']['limit']);_0x32c311[_0xe2f4('0x21')]=qs[_0xe2f4('0x21')](_0x325058[_0xe2f4('0x35')][_0xe2f4('0x21')]);}_0x32c311[_0xe2f4('0x3e')]=qs[_0xe2f4('0x3f')](_0x325058[_0xe2f4('0x35')][_0xe2f4('0x3f')]);_0x32c311['where']=qs[_0xe2f4('0x37')](_[_0xe2f4('0x41')](_0x325058['query'],_0x59aa11[_0xe2f4('0x37')]));_0x32c311[_0xe2f4('0x40')][_0xe2f4('0x59')]=_0x1e51cc['id'];if(_0x325058[_0xe2f4('0x35')][_0xe2f4('0x42')]){_0x32c311[_0xe2f4('0x40')]=_[_0xe2f4('0x44')](_0x32c311[_0xe2f4('0x40')],{'$or':_[_0xe2f4('0x30')](_0x32c311[_0xe2f4('0x39')],function(_0x240c31){var _0x511ddc={};_0x511ddc[_0x240c31]={'$like':'%'+_0x325058[_0xe2f4('0x35')]['filter']+'%'};return _0x511ddc;})});}_0x32c311=_['merge']({},_0x32c311,_0x325058[_0xe2f4('0x4d')]);return db[_0xe2f4('0x5c')][_0xe2f4('0x24')]({'where':_0x32c311['where']})[_0xe2f4('0x29')](function(_0x51112f){_0x488ce6['count']=_0x51112f;if(_0x325058[_0xe2f4('0x35')]['includeAll']){_0x32c311[_0xe2f4('0x46')]=[{'all':!![]}];}return db[_0xe2f4('0x5c')][_0xe2f4('0x47')](_0x32c311);})[_0xe2f4('0x29')](function(_0x5ecda9){_0x488ce6['rows']=_0x5ecda9;return _0x488ce6;});}})[_0xe2f4('0x29')](respondWithFilteredResult(_0xc64c5a,_0x32c311))[_0xe2f4('0x49')](handleError(_0xc64c5a,null));};exports[_0xe2f4('0x5d')]=function(_0x5a9e98,_0xefb1df,_0x35159c){return db[_0xe2f4('0x31')]['find']({'where':{'id':_0x5a9e98[_0xe2f4('0x4b')]['id']}})['then'](handleEntityNotFound(_0xefb1df,null))[_0xe2f4('0x29')](function(_0x176f5e){if(_0x176f5e){return _0x176f5e[_0xe2f4('0x5d')](_0x5a9e98[_0xe2f4('0x35')][_0xe2f4('0x5e')]);}})[_0xe2f4('0x29')](respondWithStatusCode(_0xefb1df,null))[_0xe2f4('0x49')](handleError(_0xefb1df,null));};exports[_0xe2f4('0x5f')]=function(_0x2250b0,_0x56dfc7,_0x2e1dd8){return db[_0xe2f4('0x31')][_0xe2f4('0x4e')]({'where':{'id':_0x2250b0['params']['id']}})['then'](handleEntityNotFound(_0x56dfc7,null))['then'](function(_0x1c878d){if(_0x1c878d){var _0x22e486=[];var _0x5061f9={'success':[],'errors':[]};return db[_0xe2f4('0x60')][_0xe2f4('0x57')]()['then'](function(_0x56ad6e){if(_0x2250b0[_0xe2f4('0x50')]['tags']&&_[_0xe2f4('0x61')](_0x2250b0[_0xe2f4('0x50')]['tags'])){if(_0x2250b0[_0xe2f4('0x50')][_0xe2f4('0x62')]['length']){_0x2250b0['body'][_0xe2f4('0x62')]=_0x2250b0[_0xe2f4('0x50')]['tags']['join'](';')+';';}else{_0x2250b0['body'][_0xe2f4('0x62')]=null;}}else{_0x2250b0['body'][_0xe2f4('0x62')]=null;}if(_0x2250b0[_0xe2f4('0x50')]&&_[_0xe2f4('0x61')](_0x2250b0[_0xe2f4('0x50')])){for(var _0x2b6190=0x0;_0x2b6190<_0x2250b0['body'][_0xe2f4('0x3b')];_0x2b6190+=0x1){_0x2250b0[_0xe2f4('0x50')][_0x2b6190][_0xe2f4('0x59')]=_0x2250b0[_0xe2f4('0x4b')]['id'];_0x22e486[_0xe2f4('0x63')](_0x2250b0[_0xe2f4('0x50')][_0x2b6190]);}return BPromise[_0xe2f4('0x64')](_0x22e486,function(_0x1b90da){return db[_0xe2f4('0x60')][_0xe2f4('0x4f')](_['omit'](_0x1b90da,['ids','id'])||{},{'fields':_['keys'](_0x56ad6e),'raw':!![]})['then'](function(_0x548b19){_0x5061f9[_0xe2f4('0x65')]['push'](_0x548b19[_0xe2f4('0x66')]);})['catch'](function(_0xcb2643){_0x5061f9[_0xe2f4('0x67')][_0xe2f4('0x63')]({'data':_0x1b90da,'error':_0xcb2643[_0xe2f4('0x68')]});});})[_0xe2f4('0x29')](function(_0x951486){return _0x5061f9;})[_0xe2f4('0x49')](function(_0x41c175){return _0x41c175;});}else{_0x56dfc7[_0xe2f4('0x1e')](0x190)[_0xe2f4('0x20')]({'message':_0xe2f4('0x69')});}});}})['then'](respondWithResult(_0x56dfc7,null))[_0xe2f4('0x49')](handleError(_0x56dfc7,null));};exports[_0xe2f4('0x6a')]=function(_0x1bd351,_0x37d453,_0x28bc33){var _0x1c84a9;return db[_0xe2f4('0x31')][_0xe2f4('0x4e')]({'where':{'id':_0x1bd351['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0xe2f4('0x6b')}]})[_0xe2f4('0x29')](handleEntityNotFound(_0x37d453,null))[_0xe2f4('0x29')](function(_0x496ef5){if(_0x496ef5){_0x1c84a9=_0x496ef5;return db[_0xe2f4('0x60')][_0xe2f4('0x4c')];}})[_0xe2f4('0x29')](function(_0x158d72){if(_0x158d72){var _0x89982={};var _0x214433={};_0x214433[_0xe2f4('0x34')]=_[_0xe2f4('0x6c')](_[_0xe2f4('0x36')](_0x158d72),_[_0xe2f4('0x30')](_0x1c84a9['CustomFields'],function(_0x35d65b){return util['format'](_0xe2f4('0x6d'),_0x35d65b['id']);}));_0x214433[_0xe2f4('0x35')]=_['keys'](_0x1bd351['query']);_0x214433['filters']=_['intersection'](_0x214433['model'],_0x214433[_0xe2f4('0x35')]);_0x89982[_0xe2f4('0x39')]=_[_0xe2f4('0x38')](_0x214433[_0xe2f4('0x34')],qs[_0xe2f4('0x3a')](_0x1bd351[_0xe2f4('0x35')]['fields']));_0x89982[_0xe2f4('0x39')]=_0x89982['attributes'][_0xe2f4('0x3b')]?_0x89982['attributes']:_0x214433[_0xe2f4('0x34')];if(!_0x1bd351[_0xe2f4('0x35')][_0xe2f4('0x3c')](_0xe2f4('0x3d'))){_0x89982[_0xe2f4('0x23')]=qs[_0xe2f4('0x23')](_0x1bd351['query']['limit']);_0x89982[_0xe2f4('0x21')]=qs[_0xe2f4('0x21')](_0x1bd351['query'][_0xe2f4('0x21')]);}_0x89982[_0xe2f4('0x3e')]=qs[_0xe2f4('0x3f')](_0x1bd351['query'][_0xe2f4('0x3f')]);_0x89982[_0xe2f4('0x40')]=qs[_0xe2f4('0x37')](_[_0xe2f4('0x41')](_0x1bd351['query'],_0x214433[_0xe2f4('0x37')]));_0x89982[_0xe2f4('0x6e')]=!![];if(_0x1bd351[_0xe2f4('0x35')][_0xe2f4('0x42')]){_0x89982['where']=_['merge'](_0x89982[_0xe2f4('0x40')],{'$or':_['map'](_0x89982[_0xe2f4('0x39')],function(_0x291bb9){var _0x663e02={};_0x663e02[_0x291bb9]={'$like':'%'+_0x1bd351['query']['filter']+'%'};return _0x663e02;})});}_0x89982=_[_0xe2f4('0x44')]({},_0x89982,_0x1bd351['options']);return _0x1c84a9['getContacts'](_0x89982);}})[_0xe2f4('0x29')](respondWithResult(_0x37d453,null))['catch'](handleError(_0x37d453,null));};exports[_0xe2f4('0x6f')]=function(_0x4d21c0,_0x267bf3,_0x11b2f6){var _0x2de86b;return db['CmList']['find']({'where':{'id':_0x4d21c0[_0xe2f4('0x4b')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xe2f4('0x6b')}]})['then'](handleEntityNotFound(_0x267bf3,null))['then'](function(_0x4e8b18){if(_0x4e8b18){_0x2de86b=_0x4e8b18;return db[_0xe2f4('0x60')][_0xe2f4('0x4c')];}})[_0xe2f4('0x29')](function(_0x4b53e2){if(_0x4b53e2){var _0x18bf13={};var _0xf2e6ce={};_0xf2e6ce['model']=_[_0xe2f4('0x6c')](_[_0xe2f4('0x36')](_0x4b53e2),_[_0xe2f4('0x30')](_0x2de86b[_0xe2f4('0x6b')],function(_0x345474){return util[_0xe2f4('0x70')](_0xe2f4('0x6d'),_0x345474['id']);}));_0xf2e6ce[_0xe2f4('0x35')]=_[_0xe2f4('0x36')](_0x4d21c0[_0xe2f4('0x35')]);_0xf2e6ce['filters']=_['intersection'](_0xf2e6ce[_0xe2f4('0x34')],_0xf2e6ce[_0xe2f4('0x35')]);_0x18bf13[_0xe2f4('0x39')]=_[_0xe2f4('0x38')](_0xf2e6ce[_0xe2f4('0x34')],qs[_0xe2f4('0x3a')](_0x4d21c0[_0xe2f4('0x35')][_0xe2f4('0x3a')]));_0x18bf13[_0xe2f4('0x39')]=_0x18bf13[_0xe2f4('0x39')][_0xe2f4('0x3b')]?_0x18bf13['attributes']:_0xf2e6ce[_0xe2f4('0x34')];if(!_0x4d21c0[_0xe2f4('0x35')][_0xe2f4('0x3c')](_0xe2f4('0x3d'))){_0x18bf13[_0xe2f4('0x23')]=qs['limit'](_0x4d21c0[_0xe2f4('0x35')]['limit']);_0x18bf13[_0xe2f4('0x21')]=qs[_0xe2f4('0x21')](_0x4d21c0[_0xe2f4('0x35')][_0xe2f4('0x21')]);}_0x18bf13['order']=qs['sort'](_0x4d21c0[_0xe2f4('0x35')][_0xe2f4('0x3f')]);_0x18bf13[_0xe2f4('0x40')]=qs[_0xe2f4('0x37')](_['pick'](_0x4d21c0[_0xe2f4('0x35')],_0xf2e6ce[_0xe2f4('0x37')]));_0x18bf13[_0xe2f4('0x6e')]=!![];if(_0x4d21c0[_0xe2f4('0x35')]['filter']){_0x18bf13[_0xe2f4('0x40')]=_[_0xe2f4('0x44')](_0x18bf13[_0xe2f4('0x40')],{'$or':_['map'](_0x18bf13[_0xe2f4('0x39')],function(_0x422b18){var _0x7623da={};_0x7623da[_0x422b18]={'$like':'%'+_0x4d21c0[_0xe2f4('0x35')][_0xe2f4('0x42')]+'%'};return _0x7623da;})});}_0x18bf13=_[_0xe2f4('0x44')]({},_0x18bf13,_0x4d21c0['options']);return _0x2de86b['getContacts'](_0x18bf13);}})[_0xe2f4('0x29')](function(_0x5ea322){if(!_['isEmpty'](_0x5ea322)){var _0x545fe4=toCsv(_0x5ea322);var _0x570701=Date[_0xe2f4('0x71')]();fs[_0xe2f4('0x72')](util['format'](_0xe2f4('0x73'),_0x2de86b['id'],_0x570701),_0x545fe4);_0x267bf3[_0xe2f4('0x74')](_0xe2f4('0x75'),'attachment;\x20filename='+util[_0xe2f4('0x70')]('list_%d_%s.csv',_0x2de86b['id'],_0x570701));_0x267bf3[_0xe2f4('0x74')](_0xe2f4('0x76'),'text/csv');return _0x267bf3[_0xe2f4('0x77')](util[_0xe2f4('0x70')]('/tmp/list_%d_%s.csv',_0x2de86b['id'],_0x570701));}else{return _0x267bf3[_0xe2f4('0x1d')](0xcc);}})[_0xe2f4('0x49')](handleError(_0x267bf3,null));};exports[_0xe2f4('0x78')]=function(_0x4f4b75,_0x451258,_0x5242cf){var _0x3202e7;delete _0x4f4b75[_0xe2f4('0x50')]['id'];return db['CmList'][_0xe2f4('0x5b')]({'where':{'id':_0x4f4b75[_0xe2f4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x451258,null))['then'](function(_0x1d897a){if(_0x1d897a){return db[_0xe2f4('0x79')][_0xe2f4('0x7a')](function(_0x4cbaa6){return db[_0xe2f4('0x7b')][_0xe2f4('0x4f')](_0x4f4b75[_0xe2f4('0x50')],{'transaction':_0x4cbaa6})[_0xe2f4('0x29')](function(_0xc8ea3f){_0x3202e7=_0xc8ea3f;return _0x1d897a[_0xe2f4('0x7c')](_0xc8ea3f,{'transaction':_0x4cbaa6});})['then'](function(){var _0x37c212={'type':db['Sequelize'][_0xe2f4('0x7d')],'transaction':_0x4cbaa6};switch(_0x4f4b75[_0xe2f4('0x50')]['type']){case _0xe2f4('0x7e'):_0x37c212['type']=db[_0xe2f4('0x7f')][_0xe2f4('0x7d')];break;case _0xe2f4('0x80'):_0x37c212[_0xe2f4('0x33')]=db[_0xe2f4('0x7f')][_0xe2f4('0x81')];break;case'switch':_0x37c212[_0xe2f4('0x33')]=db[_0xe2f4('0x7f')][_0xe2f4('0x82')];_0x37c212[_0xe2f4('0x83')]=![];break;default:}return db[_0xe2f4('0x79')][_0xe2f4('0x84')]['addColumn']('cm_contacts',util[_0xe2f4('0x70')](_0xe2f4('0x85'),_0x3202e7['id']),_0x37c212);})[_0xe2f4('0x29')](function(){return _0x3202e7;});});}})[_0xe2f4('0x29')](respondWithResult(_0x451258,null))[_0xe2f4('0x49')](handleError(_0x451258,null));};exports['getCustomFields']=function(_0x36e741,_0x4378fb,_0x4be4a0){var _0x474a03={};var _0xf91ee2={};var _0x4dd6c8;var _0x84e620;return db['CmList'][_0xe2f4('0x5b')]({'where':{'id':_0x36e741[_0xe2f4('0x4b')]['id']}})[_0xe2f4('0x29')](handleEntityNotFound(_0x4378fb,null))[_0xe2f4('0x29')](function(_0x17ba5e){if(_0x17ba5e){_0x4dd6c8=_0x17ba5e;_0xf91ee2[_0xe2f4('0x34')]=_['keys'](db[_0xe2f4('0x7b')][_0xe2f4('0x4c')]);_0xf91ee2[_0xe2f4('0x35')]=_[_0xe2f4('0x36')](_0x36e741[_0xe2f4('0x35')]);_0xf91ee2['filters']=_[_0xe2f4('0x38')](_0xf91ee2['model'],_0xf91ee2[_0xe2f4('0x35')]);_0x474a03[_0xe2f4('0x39')]=_[_0xe2f4('0x38')](_0xf91ee2[_0xe2f4('0x34')],qs[_0xe2f4('0x3a')](_0x36e741[_0xe2f4('0x35')][_0xe2f4('0x3a')]));_0x474a03[_0xe2f4('0x39')]=_0x474a03[_0xe2f4('0x39')][_0xe2f4('0x3b')]?_0x474a03['attributes']:_0xf91ee2[_0xe2f4('0x34')];_0x474a03[_0xe2f4('0x3e')]=qs['sort'](_0x36e741[_0xe2f4('0x35')]['sort']);_0x474a03[_0xe2f4('0x40')]=qs[_0xe2f4('0x37')](_[_0xe2f4('0x41')](_0x36e741[_0xe2f4('0x35')],_0xf91ee2[_0xe2f4('0x37')]));_0x474a03[_0xe2f4('0x40')]=_[_0xe2f4('0x44')](_0x474a03[_0xe2f4('0x40')],{'$or':[{'ListId':_0x17ba5e['id']},{'ListId':null}]});if(_0x36e741[_0xe2f4('0x35')][_0xe2f4('0x42')]){_0x474a03['where']=_[_0xe2f4('0x44')](_0x474a03[_0xe2f4('0x40')],{'$or':_[_0xe2f4('0x30')](_0x474a03[_0xe2f4('0x39')],function(_0x15faab){var _0x27de17={};_0x27de17[_0x15faab]={'$like':'%'+_0x36e741[_0xe2f4('0x35')][_0xe2f4('0x42')]+'%'};return _0x27de17;})});}_0x474a03=_[_0xe2f4('0x44')]({},_0x474a03,_0x36e741[_0xe2f4('0x4d')]);return db[_0xe2f4('0x7b')][_0xe2f4('0x86')](_0x474a03);}})['then'](respondWithResult(_0x4378fb,null))[_0xe2f4('0x49')](handleError(_0x4378fb,null));};exports[_0xe2f4('0x87')]=function(_0x4d8ce0,_0x33ce6e,_0x2107d5){return db['CmList'][_0xe2f4('0x4e')]({'where':{'id':_0x4d8ce0['params']['id']}})[_0xe2f4('0x29')](handleEntityNotFound(_0x33ce6e,null))[_0xe2f4('0x29')](function(_0x39efa4){if(_0x39efa4){return _0x39efa4[_0xe2f4('0x87')](_0x4d8ce0[_0xe2f4('0x50')]['ids'],_['omit'](_0x4d8ce0[_0xe2f4('0x50')],['ids','id'])||{})[_0xe2f4('0x88')](function(_0x1533c0){for(var _0x2a5695=0x0;_0x2a5695<_0x4d8ce0[_0xe2f4('0x50')][_0xe2f4('0x5e')][_0xe2f4('0x3b')];_0x2a5695+=0x1){socket['emit'](_0xe2f4('0x89'),{'UserId':Number(_0x4d8ce0[_0xe2f4('0x50')]['ids'][_0x2a5695]),'CmListId':Number(_0x4d8ce0['params']['id'])});}return _0x1533c0;});}})[_0xe2f4('0x29')](respondWithResult(_0x33ce6e,null))[_0xe2f4('0x49')](handleError(_0x33ce6e,null));};exports[_0xe2f4('0x8a')]=function(_0x4172cc,_0x259896,_0xf85c11){return db['CmList'][_0xe2f4('0x4e')]({'where':{'id':_0x4172cc[_0xe2f4('0x4b')]['id']}})[_0xe2f4('0x29')](handleEntityNotFound(_0x259896,null))['then'](function(_0x312899){if(_0x312899){return _0x312899['removeAgents'](_0x4172cc['query']['ids'])[_0xe2f4('0x29')](function(){if(_[_0xe2f4('0x61')](_0x4172cc[_0xe2f4('0x35')][_0xe2f4('0x5e')])){for(var _0x22ccca=0x0;_0x22ccca<_0x4172cc['query'][_0xe2f4('0x5e')][_0xe2f4('0x3b')];_0x22ccca+=0x1){socket[_0xe2f4('0x8b')](_0xe2f4('0x8c'),{'UserId':Number(_0x4172cc[_0xe2f4('0x35')][_0xe2f4('0x5e')][_0x22ccca]),'CmListId':Number(_0x4172cc[_0xe2f4('0x4b')]['id'])});}}else{socket['emit'](_0xe2f4('0x8c'),{'UserId':Number(_0x4172cc['query'][_0xe2f4('0x5e')]),'CmListId':Number(_0x4172cc[_0xe2f4('0x4b')]['id'])});}});}})[_0xe2f4('0x29')](respondWithStatusCode(_0x259896,null))['catch'](handleError(_0x259896,null));};exports['getAgents']=function(_0x305a23,_0x3e0711,_0x930ec4){var _0x4677a7={};var _0xd372a3={};var _0x1c9ecc;var _0x6b2b56;return db['CmList'][_0xe2f4('0x5b')]({'where':{'id':_0x305a23[_0xe2f4('0x4b')]['id']}})[_0xe2f4('0x29')](handleEntityNotFound(_0x3e0711,null))[_0xe2f4('0x29')](function(_0x4c1039){if(_0x4c1039){_0x1c9ecc=_0x4c1039;_0xd372a3['model']=_[_0xe2f4('0x36')](db['User'][_0xe2f4('0x4c')]);_0xd372a3[_0xe2f4('0x35')]=_[_0xe2f4('0x36')](_0x305a23[_0xe2f4('0x35')]);_0xd372a3['filters']=_[_0xe2f4('0x38')](_0xd372a3[_0xe2f4('0x34')],_0xd372a3[_0xe2f4('0x35')]);_0x4677a7[_0xe2f4('0x39')]=_['intersection'](_0xd372a3[_0xe2f4('0x34')],qs[_0xe2f4('0x3a')](_0x305a23['query']['fields']));_0x4677a7[_0xe2f4('0x39')]=_0x4677a7[_0xe2f4('0x39')]['length']?_0x4677a7[_0xe2f4('0x39')]:_0xd372a3['model'];_0x4677a7[_0xe2f4('0x3e')]=qs[_0xe2f4('0x3f')](_0x305a23[_0xe2f4('0x35')][_0xe2f4('0x3f')]);_0x4677a7[_0xe2f4('0x40')]=qs[_0xe2f4('0x37')](_[_0xe2f4('0x41')](_0x305a23['query'],_0xd372a3[_0xe2f4('0x37')]));if(_0x305a23[_0xe2f4('0x35')]['filter']){_0x4677a7[_0xe2f4('0x40')]=_[_0xe2f4('0x44')](_0x4677a7[_0xe2f4('0x40')],{'$or':_[_0xe2f4('0x30')](_0x4677a7[_0xe2f4('0x39')],function(_0xb53e5c){var _0x1acf8e={};_0x1acf8e[_0xb53e5c]={'$like':'%'+_0x305a23[_0xe2f4('0x35')][_0xe2f4('0x42')]+'%'};return _0x1acf8e;})});}_0x4677a7=_['merge']({},_0x4677a7,_0x305a23[_0xe2f4('0x4d')]);return _0x1c9ecc[_0xe2f4('0x8d')](_0x4677a7);}})[_0xe2f4('0x29')](function(_0xc58e91){if(_0xc58e91){_0x6b2b56=_0xc58e91[_0xe2f4('0x3b')];if(!_0x305a23[_0xe2f4('0x35')][_0xe2f4('0x3c')](_0xe2f4('0x3d'))){_0x4677a7[_0xe2f4('0x23')]=qs[_0xe2f4('0x23')](_0x305a23[_0xe2f4('0x35')][_0xe2f4('0x23')]);_0x4677a7[_0xe2f4('0x21')]=qs[_0xe2f4('0x21')](_0x305a23['query'][_0xe2f4('0x21')]);}return _0x1c9ecc[_0xe2f4('0x8d')](_0x4677a7);}})[_0xe2f4('0x29')](function(_0x3d415f){if(_0x3d415f){return _0x3d415f?{'count':_0x6b2b56,'rows':_0x3d415f}:null;}})[_0xe2f4('0x29')](respondWithResult(_0x3e0711,null))[_0xe2f4('0x49')](handleError(_0x3e0711,null));}; \ No newline at end of file +var _0xee68=['ids','errors','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','format','cf_%d','raw','getContactsCsv','CmCustomField','isEmpty','now','/tmp/list_%d_%s.csv','setHeader','Content-type','download','addCustomField','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','addAgents','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','get','Lists','UserProfileResource','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','CmList','include','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','getDispositions','findOne','Disposition','order','removeDispositions','addContacts','CmContact','tags','isArray','join','push','omit'];(function(_0x2a8e30,_0x11009f){var _0x4f84be=function(_0x45acc7){while(--_0x45acc7){_0x2a8e30['push'](_0x2a8e30['shift']());}};_0x4f84be(++_0x11009f);}(_0xee68,0x150));var _0x8ee6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xee68[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0x8ee6('0x0'));var rimraf=require(_0x8ee6('0x1'));var zipdir=require(_0x8ee6('0x2'));var jsonpatch=require(_0x8ee6('0x3'));var rp=require(_0x8ee6('0x4'));var moment=require(_0x8ee6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8ee6('0x6'));var util=require(_0x8ee6('0x7'));var path=require(_0x8ee6('0x8'));var sox=require(_0x8ee6('0x9'));var csv=require(_0x8ee6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ee6('0xb'));var _=require(_0x8ee6('0xc'));var squel=require(_0x8ee6('0xd'));var crypto=require('crypto');var jsforce=require(_0x8ee6('0xe'));var deskjs=require(_0x8ee6('0xf'));var toCsv=require(_0x8ee6('0xa'));var querystring=require(_0x8ee6('0x10'));var Papa=require(_0x8ee6('0x11'));var Redis=require(_0x8ee6('0x12'));var authService=require(_0x8ee6('0x13'));var qs=require(_0x8ee6('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8ee6('0x15'));var logger=require(_0x8ee6('0x16'))(_0x8ee6('0x17'));var utils=require(_0x8ee6('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8ee6('0x19'));var db=require(_0x8ee6('0x1a'))['db'];config[_0x8ee6('0x1b')]=_[_0x8ee6('0x1c')](config[_0x8ee6('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x8ee6('0x1d'))(new Redis(config['redis']));require(_0x8ee6('0x1e'))[_0x8ee6('0x1f')](socket);function respondWithStatusCode(_0x101d0a,_0x407f66){_0x407f66=_0x407f66||0xcc;return function(_0x11daa5){if(_0x11daa5){return _0x101d0a[_0x8ee6('0x20')](_0x407f66);}return _0x101d0a[_0x8ee6('0x21')](_0x407f66)[_0x8ee6('0x22')]();};}function respondWithResult(_0xbfee8f,_0x54254a){_0x54254a=_0x54254a||0xc8;return function(_0x2a2444){if(_0x2a2444){return _0xbfee8f[_0x8ee6('0x21')](_0x54254a)[_0x8ee6('0x23')](_0x2a2444);}};}function respondWithFilteredResult(_0x5af861,_0x3613be){return function(_0x318db8){if(_0x318db8){var _0xce7155=typeof _0x3613be[_0x8ee6('0x24')]==='undefined'&&typeof _0x3613be['limit']===_0x8ee6('0x25');var _0x13ce27=_0x318db8[_0x8ee6('0x26')];var _0x46c0ee=_0xce7155?0x0:_0x3613be[_0x8ee6('0x24')];var _0x1941d3=_0xce7155?_0x318db8[_0x8ee6('0x26')]:_0x3613be[_0x8ee6('0x24')]+_0x3613be[_0x8ee6('0x27')];var _0x2d9ae2;if(_0x1941d3>=_0x13ce27){_0x1941d3=_0x13ce27;_0x2d9ae2=0xc8;}else{_0x2d9ae2=0xce;}_0x5af861[_0x8ee6('0x21')](_0x2d9ae2);return _0x5af861[_0x8ee6('0x28')](_0x8ee6('0x29'),_0x46c0ee+'-'+_0x1941d3+'/'+_0x13ce27)[_0x8ee6('0x23')](_0x318db8);}return null;};}function patchUpdates(_0x542b1a){return function(_0x216d84){try{jsonpatch[_0x8ee6('0x2a')](_0x216d84,_0x542b1a,!![]);}catch(_0x5ea78e){return BPromise['reject'](_0x5ea78e);}return _0x216d84[_0x8ee6('0x2b')]();};}function saveUpdates(_0x25ace0,_0x3ec681){return function(_0x577f1c){if(_0x577f1c){return _0x577f1c[_0x8ee6('0x2c')](_0x25ace0)[_0x8ee6('0x2d')](function(_0x4b7a21){return _0x4b7a21;});}return null;};}function removeEntity(_0x25f002,_0x80d34){return function(_0x1c3256){if(_0x1c3256){return _0x1c3256['destroy']()['then'](function(){var _0x52cd22=_0x1c3256[_0x8ee6('0x2e')]({'plain':!![]});var _0x1f7c2d=_0x8ee6('0x2f');return db[_0x8ee6('0x30')][_0x8ee6('0x31')]({'where':{'type':_0x1f7c2d,'resourceId':_0x52cd22['id']}})['then'](function(){return _0x1c3256;});})['then'](function(){_0x25f002[_0x8ee6('0x21')](0xcc)[_0x8ee6('0x22')]();});}};}function handleEntityNotFound(_0x538932,_0xca9931){return function(_0x547fd5){if(!_0x547fd5){_0x538932[_0x8ee6('0x20')](0x194);}return _0x547fd5;};}function handleError(_0x1f4eb6,_0x2ce665){_0x2ce665=_0x2ce665||0x1f4;return function(_0x4455b0){logger[_0x8ee6('0x32')](_0x4455b0[_0x8ee6('0x33')]);if(_0x4455b0[_0x8ee6('0x34')]){delete _0x4455b0['name'];}_0x1f4eb6['status'](_0x2ce665)[_0x8ee6('0x35')](_0x4455b0);};}exports['index']=function(_0x525294,_0x124a59){var _0x50b1f2={},_0x39cc26={},_0xf5c997={'count':0x0,'rows':[]};var _0xee2fb3=_[_0x8ee6('0x36')](db['CmList'][_0x8ee6('0x37')],function(_0x1cc956){return{'name':_0x1cc956[_0x8ee6('0x38')],'type':_0x1cc956[_0x8ee6('0x39')][_0x8ee6('0x3a')]};});_0x39cc26[_0x8ee6('0x3b')]=_[_0x8ee6('0x36')](_0xee2fb3,'name');_0x39cc26['query']=_[_0x8ee6('0x3c')](_0x525294[_0x8ee6('0x3d')]);_0x39cc26[_0x8ee6('0x3e')]=_[_0x8ee6('0x3f')](_0x39cc26['model'],_0x39cc26['query']);_0x50b1f2[_0x8ee6('0x40')]=_[_0x8ee6('0x3f')](_0x39cc26['model'],qs[_0x8ee6('0x41')](_0x525294['query'][_0x8ee6('0x41')]));_0x50b1f2[_0x8ee6('0x40')]=_0x50b1f2[_0x8ee6('0x40')][_0x8ee6('0x42')]?_0x50b1f2[_0x8ee6('0x40')]:_0x39cc26[_0x8ee6('0x3b')];if(!_0x525294[_0x8ee6('0x3d')][_0x8ee6('0x43')](_0x8ee6('0x44'))){_0x50b1f2[_0x8ee6('0x27')]=qs[_0x8ee6('0x27')](_0x525294[_0x8ee6('0x3d')][_0x8ee6('0x27')]);_0x50b1f2['offset']=qs[_0x8ee6('0x24')](_0x525294['query'][_0x8ee6('0x24')]);}_0x50b1f2['order']=qs[_0x8ee6('0x45')](_0x525294['query'][_0x8ee6('0x45')]);_0x50b1f2[_0x8ee6('0x46')]=qs['filters'](_[_0x8ee6('0x47')](_0x525294['query'],_0x39cc26['filters']),_0xee2fb3);if(_0x525294['query'][_0x8ee6('0x48')]){_0x50b1f2[_0x8ee6('0x46')]=_[_0x8ee6('0x49')](_0x50b1f2[_0x8ee6('0x46')],{'$or':_[_0x8ee6('0x36')](_0xee2fb3,function(_0xe4753d){if(_0xe4753d[_0x8ee6('0x39')]!==_0x8ee6('0x4a')){var _0x2238e1={};_0x2238e1[_0xe4753d['name']]={'$like':'%'+_0x525294[_0x8ee6('0x3d')][_0x8ee6('0x48')]+'%'};return _0x2238e1;}})});}_0x50b1f2=_[_0x8ee6('0x49')]({},_0x50b1f2,_0x525294[_0x8ee6('0x4b')]);var _0x5ef68b={'where':_0x50b1f2[_0x8ee6('0x46')]};return db['CmList'][_0x8ee6('0x26')](_0x5ef68b)[_0x8ee6('0x2d')](function(_0x870af6){_0xf5c997[_0x8ee6('0x26')]=_0x870af6;if(_0x525294[_0x8ee6('0x3d')][_0x8ee6('0x4c')]){_0x50b1f2['include']=[{'all':!![]}];}return db['CmList'][_0x8ee6('0x4d')](_0x50b1f2);})[_0x8ee6('0x2d')](function(_0xbbe0a0){_0xf5c997[_0x8ee6('0x4e')]=_0xbbe0a0;return _0xf5c997;})[_0x8ee6('0x2d')](respondWithFilteredResult(_0x124a59,_0x50b1f2))[_0x8ee6('0x4f')](handleError(_0x124a59,null));};exports[_0x8ee6('0x50')]=function(_0x34417d,_0x7238c3){var _0xa45296={'raw':![],'where':{'id':_0x34417d[_0x8ee6('0x51')]['id']}},_0x41e313={};_0x41e313[_0x8ee6('0x3b')]=_[_0x8ee6('0x3c')](db[_0x8ee6('0x52')]['rawAttributes']);_0x41e313[_0x8ee6('0x3d')]=_[_0x8ee6('0x3c')](_0x34417d[_0x8ee6('0x3d')]);_0x41e313[_0x8ee6('0x3e')]=_['intersection'](_0x41e313['model'],_0x41e313['query']);_0xa45296[_0x8ee6('0x40')]=_[_0x8ee6('0x3f')](_0x41e313[_0x8ee6('0x3b')],qs[_0x8ee6('0x41')](_0x34417d['query'][_0x8ee6('0x41')]));_0xa45296[_0x8ee6('0x40')]=_0xa45296[_0x8ee6('0x40')][_0x8ee6('0x42')]?_0xa45296[_0x8ee6('0x40')]:_0x41e313[_0x8ee6('0x3b')];if(_0x34417d[_0x8ee6('0x3d')]['includeAll']){_0xa45296[_0x8ee6('0x53')]=[{'all':!![]}];}_0xa45296=_[_0x8ee6('0x49')]({},_0xa45296,_0x34417d['options']);return db[_0x8ee6('0x52')][_0x8ee6('0x54')](_0xa45296)[_0x8ee6('0x2d')](handleEntityNotFound(_0x7238c3,null))[_0x8ee6('0x2d')](respondWithResult(_0x7238c3,null))[_0x8ee6('0x4f')](handleError(_0x7238c3,null));};exports[_0x8ee6('0x55')]=function(_0x4f51ee,_0x523a26){return db['CmList'][_0x8ee6('0x55')](_0x4f51ee[_0x8ee6('0x56')],{})[_0x8ee6('0x2d')](function(_0x2662f4){var _0x59afd8=_0x4f51ee['user'][_0x8ee6('0x2e')]({'plain':!![]});if(!_0x59afd8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x59afd8[_0x8ee6('0x57')]===_0x8ee6('0x58')){var _0x1f3b19=_0x2662f4[_0x8ee6('0x2e')]({'plain':!![]});var _0x456832=_0x8ee6('0x2f');return db[_0x8ee6('0x59')][_0x8ee6('0x54')]({'where':{'name':_0x456832,'userProfileId':_0x59afd8[_0x8ee6('0x5a')]},'raw':!![]})[_0x8ee6('0x2d')](function(_0x3e9d6d){if(_0x3e9d6d&&_0x3e9d6d[_0x8ee6('0x5b')]===0x0){return db['UserProfileResource']['create']({'name':_0x1f3b19[_0x8ee6('0x34')],'resourceId':_0x1f3b19['id'],'type':_0x3e9d6d[_0x8ee6('0x34')],'sectionId':_0x3e9d6d['id']},{})[_0x8ee6('0x2d')](function(){return _0x2662f4;});}else{return _0x2662f4;}})[_0x8ee6('0x4f')](function(_0x996df9){logger['error'](_0x8ee6('0x5c'),_0x996df9);throw _0x996df9;});}return _0x2662f4;})['then'](respondWithResult(_0x523a26,0xc9))[_0x8ee6('0x4f')](handleError(_0x523a26,null));};exports['update']=function(_0x5710f5,_0x48a170){if(_0x5710f5[_0x8ee6('0x56')]['id']){delete _0x5710f5['body']['id'];}return db[_0x8ee6('0x52')][_0x8ee6('0x54')]({'where':{'id':_0x5710f5[_0x8ee6('0x51')]['id']}})['then'](handleEntityNotFound(_0x48a170,null))[_0x8ee6('0x2d')](saveUpdates(_0x5710f5[_0x8ee6('0x56')],null))[_0x8ee6('0x2d')](respondWithResult(_0x48a170,null))[_0x8ee6('0x4f')](handleError(_0x48a170,null));};exports[_0x8ee6('0x31')]=function(_0x50c925,_0x5d6d06){return db[_0x8ee6('0x52')][_0x8ee6('0x54')]({'where':{'id':_0x50c925[_0x8ee6('0x51')]['id']}})[_0x8ee6('0x2d')](handleEntityNotFound(_0x5d6d06,null))[_0x8ee6('0x2d')](removeEntity(_0x5d6d06,null))[_0x8ee6('0x4f')](handleError(_0x5d6d06,null));};exports[_0x8ee6('0x5d')]=function(_0x373413,_0x240f67){return db[_0x8ee6('0x52')]['describe']()[_0x8ee6('0x2d')](respondWithResult(_0x240f67,null))[_0x8ee6('0x4f')](handleError(_0x240f67,null));};exports[_0x8ee6('0x5e')]=function(_0x387a97,_0x5ef44e,_0x8d6dfb){if(_0x387a97[_0x8ee6('0x56')]['id']){delete _0x387a97['body']['id'];}return db[_0x8ee6('0x52')][_0x8ee6('0x54')]({'where':{'id':_0x387a97['params']['id']}})[_0x8ee6('0x2d')](handleEntityNotFound(_0x5ef44e,null))['then'](function(_0x38ef18){if(_0x38ef18){_0x387a97[_0x8ee6('0x56')][_0x8ee6('0x5f')]=_0x38ef18['id'];return db['Disposition'][_0x8ee6('0x55')](_0x387a97[_0x8ee6('0x56')]);}})[_0x8ee6('0x2d')](respondWithResult(_0x5ef44e,null))[_0x8ee6('0x4f')](handleError(_0x5ef44e,null));};exports[_0x8ee6('0x60')]=function(_0xbffcc7,_0x19acc6,_0x3dcd9d){var _0x195a2e={'raw':![],'where':{}};var _0xf5e0f0={};var _0x531680={'count':0x0,'rows':[]};return db[_0x8ee6('0x52')][_0x8ee6('0x61')]({'where':{'id':_0xbffcc7[_0x8ee6('0x51')]['id']}})[_0x8ee6('0x2d')](handleEntityNotFound(_0x19acc6,null))[_0x8ee6('0x2d')](function(_0x565731){if(_0x565731){_0xf5e0f0[_0x8ee6('0x3b')]=_[_0x8ee6('0x3c')](db[_0x8ee6('0x62')][_0x8ee6('0x37')]);_0xf5e0f0[_0x8ee6('0x3d')]=_[_0x8ee6('0x3c')](_0xbffcc7[_0x8ee6('0x3d')]);_0xf5e0f0[_0x8ee6('0x3e')]=_[_0x8ee6('0x3f')](_0xf5e0f0[_0x8ee6('0x3b')],_0xf5e0f0[_0x8ee6('0x3d')]);_0x195a2e[_0x8ee6('0x40')]=_[_0x8ee6('0x3f')](_0xf5e0f0['model'],qs[_0x8ee6('0x41')](_0xbffcc7[_0x8ee6('0x3d')][_0x8ee6('0x41')]));_0x195a2e[_0x8ee6('0x40')]=_0x195a2e[_0x8ee6('0x40')][_0x8ee6('0x42')]?_0x195a2e[_0x8ee6('0x40')]:_0xf5e0f0[_0x8ee6('0x3b')];if(!_0xbffcc7[_0x8ee6('0x3d')]['hasOwnProperty']('nolimit')){_0x195a2e[_0x8ee6('0x27')]=qs[_0x8ee6('0x27')](_0xbffcc7['query'][_0x8ee6('0x27')]);_0x195a2e['offset']=qs['offset'](_0xbffcc7[_0x8ee6('0x3d')]['offset']);}_0x195a2e[_0x8ee6('0x63')]=qs[_0x8ee6('0x45')](_0xbffcc7['query'][_0x8ee6('0x45')]);_0x195a2e[_0x8ee6('0x46')]=qs[_0x8ee6('0x3e')](_[_0x8ee6('0x47')](_0xbffcc7['query'],_0xf5e0f0['filters']));_0x195a2e[_0x8ee6('0x46')][_0x8ee6('0x5f')]=_0x565731['id'];if(_0xbffcc7['query'][_0x8ee6('0x48')]){_0x195a2e[_0x8ee6('0x46')]=_['merge'](_0x195a2e[_0x8ee6('0x46')],{'$or':_[_0x8ee6('0x36')](_0x195a2e[_0x8ee6('0x40')],function(_0x33c0b0){var _0xc4ab7c={};_0xc4ab7c[_0x33c0b0]={'$like':'%'+_0xbffcc7[_0x8ee6('0x3d')][_0x8ee6('0x48')]+'%'};return _0xc4ab7c;})});}_0x195a2e=_['merge']({},_0x195a2e,_0xbffcc7['options']);return db[_0x8ee6('0x62')]['count']({'where':_0x195a2e[_0x8ee6('0x46')]})[_0x8ee6('0x2d')](function(_0x392f13){_0x531680['count']=_0x392f13;if(_0xbffcc7[_0x8ee6('0x3d')][_0x8ee6('0x4c')]){_0x195a2e['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x195a2e);})[_0x8ee6('0x2d')](function(_0x3eecb7){_0x531680[_0x8ee6('0x4e')]=_0x3eecb7;return _0x531680;});}})[_0x8ee6('0x2d')](respondWithFilteredResult(_0x19acc6,_0x195a2e))[_0x8ee6('0x4f')](handleError(_0x19acc6,null));};exports[_0x8ee6('0x64')]=function(_0x3d7ca8,_0x311fdf,_0x5e76f4){return db[_0x8ee6('0x52')][_0x8ee6('0x54')]({'where':{'id':_0x3d7ca8[_0x8ee6('0x51')]['id']}})[_0x8ee6('0x2d')](handleEntityNotFound(_0x311fdf,null))['then'](function(_0x35badb){if(_0x35badb){return _0x35badb['removeDispositions'](_0x3d7ca8['query']['ids']);}})[_0x8ee6('0x2d')](respondWithStatusCode(_0x311fdf,null))[_0x8ee6('0x4f')](handleError(_0x311fdf,null));};exports[_0x8ee6('0x65')]=function(_0x57a046,_0x3ebb66,_0xa46a62){return db[_0x8ee6('0x52')][_0x8ee6('0x54')]({'where':{'id':_0x57a046[_0x8ee6('0x51')]['id']}})[_0x8ee6('0x2d')](handleEntityNotFound(_0x3ebb66,null))[_0x8ee6('0x2d')](function(_0x344ded){if(_0x344ded){var _0x5ebc80=[];var _0x137f7d={'success':[],'errors':[]};return db[_0x8ee6('0x66')][_0x8ee6('0x5d')]()[_0x8ee6('0x2d')](function(_0x32f5b4){if(_0x57a046[_0x8ee6('0x56')][_0x8ee6('0x67')]&&_[_0x8ee6('0x68')](_0x57a046[_0x8ee6('0x56')][_0x8ee6('0x67')])){if(_0x57a046[_0x8ee6('0x56')][_0x8ee6('0x67')][_0x8ee6('0x42')]){_0x57a046[_0x8ee6('0x56')]['tags']=_0x57a046['body'][_0x8ee6('0x67')][_0x8ee6('0x69')](';')+';';}else{_0x57a046[_0x8ee6('0x56')][_0x8ee6('0x67')]=null;}}else{_0x57a046[_0x8ee6('0x56')]['tags']=null;}if(_0x57a046['body']&&_[_0x8ee6('0x68')](_0x57a046['body'])){for(var _0x2befc0=0x0;_0x2befc0<_0x57a046[_0x8ee6('0x56')][_0x8ee6('0x42')];_0x2befc0+=0x1){_0x57a046[_0x8ee6('0x56')][_0x2befc0][_0x8ee6('0x5f')]=_0x57a046[_0x8ee6('0x51')]['id'];_0x5ebc80[_0x8ee6('0x6a')](_0x57a046['body'][_0x2befc0]);}return BPromise['each'](_0x5ebc80,function(_0x110d0e){return db[_0x8ee6('0x66')][_0x8ee6('0x55')](_[_0x8ee6('0x6b')](_0x110d0e,[_0x8ee6('0x6c'),'id'])||{},{'fields':_['keys'](_0x32f5b4),'raw':!![]})[_0x8ee6('0x2d')](function(_0x40a82a){_0x137f7d['success'][_0x8ee6('0x6a')](_0x40a82a['dataValues']);})[_0x8ee6('0x4f')](function(_0xcc7400){_0x137f7d[_0x8ee6('0x6d')][_0x8ee6('0x6a')]({'data':_0x110d0e,'error':_0xcc7400['message']});});})[_0x8ee6('0x2d')](function(_0xe1188e){return _0x137f7d;})[_0x8ee6('0x4f')](function(_0x2f8335){return _0x2f8335;});}else{_0x3ebb66['status'](0x190)[_0x8ee6('0x23')]({'message':_0x8ee6('0x6e')});}});}})['then'](respondWithResult(_0x3ebb66,null))['catch'](handleError(_0x3ebb66,null));};exports[_0x8ee6('0x6f')]=function(_0x5e0851,_0xeb8d02,_0x4932ba){var _0x3e1aa8;return db[_0x8ee6('0x52')][_0x8ee6('0x54')]({'where':{'id':_0x5e0851[_0x8ee6('0x51')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x8ee6('0x70')}]})[_0x8ee6('0x2d')](handleEntityNotFound(_0xeb8d02,null))['then'](function(_0x5ca38e){if(_0x5ca38e){_0x3e1aa8=_0x5ca38e;return db[_0x8ee6('0x66')][_0x8ee6('0x37')];}})[_0x8ee6('0x2d')](function(_0x4a4c40){if(_0x4a4c40){var _0x4cb724={};var _0x2f29b9={};_0x2f29b9[_0x8ee6('0x3b')]=_[_0x8ee6('0x71')](_[_0x8ee6('0x3c')](_0x4a4c40),_[_0x8ee6('0x36')](_0x3e1aa8[_0x8ee6('0x70')],function(_0x53e671){return util[_0x8ee6('0x72')](_0x8ee6('0x73'),_0x53e671['id']);}));_0x2f29b9[_0x8ee6('0x3d')]=_[_0x8ee6('0x3c')](_0x5e0851['query']);_0x2f29b9[_0x8ee6('0x3e')]=_[_0x8ee6('0x3f')](_0x2f29b9[_0x8ee6('0x3b')],_0x2f29b9[_0x8ee6('0x3d')]);_0x4cb724[_0x8ee6('0x40')]=_[_0x8ee6('0x3f')](_0x2f29b9[_0x8ee6('0x3b')],qs['fields'](_0x5e0851[_0x8ee6('0x3d')]['fields']));_0x4cb724[_0x8ee6('0x40')]=_0x4cb724[_0x8ee6('0x40')][_0x8ee6('0x42')]?_0x4cb724[_0x8ee6('0x40')]:_0x2f29b9[_0x8ee6('0x3b')];if(!_0x5e0851['query'][_0x8ee6('0x43')]('nolimit')){_0x4cb724[_0x8ee6('0x27')]=qs[_0x8ee6('0x27')](_0x5e0851[_0x8ee6('0x3d')][_0x8ee6('0x27')]);_0x4cb724[_0x8ee6('0x24')]=qs[_0x8ee6('0x24')](_0x5e0851['query']['offset']);}_0x4cb724[_0x8ee6('0x63')]=qs['sort'](_0x5e0851[_0x8ee6('0x3d')][_0x8ee6('0x45')]);_0x4cb724[_0x8ee6('0x46')]=qs[_0x8ee6('0x3e')](_['pick'](_0x5e0851[_0x8ee6('0x3d')],_0x2f29b9[_0x8ee6('0x3e')]));_0x4cb724[_0x8ee6('0x74')]=!![];if(_0x5e0851[_0x8ee6('0x3d')]['filter']){_0x4cb724[_0x8ee6('0x46')]=_[_0x8ee6('0x49')](_0x4cb724[_0x8ee6('0x46')],{'$or':_[_0x8ee6('0x36')](_0x4cb724[_0x8ee6('0x40')],function(_0x207ec6){var _0x28d740={};_0x28d740[_0x207ec6]={'$like':'%'+_0x5e0851[_0x8ee6('0x3d')][_0x8ee6('0x48')]+'%'};return _0x28d740;})});}_0x4cb724=_['merge']({},_0x4cb724,_0x5e0851[_0x8ee6('0x4b')]);return _0x3e1aa8[_0x8ee6('0x6f')](_0x4cb724);}})[_0x8ee6('0x2d')](respondWithResult(_0xeb8d02,null))[_0x8ee6('0x4f')](handleError(_0xeb8d02,null));};exports[_0x8ee6('0x75')]=function(_0x1d9e51,_0x44fda7,_0x3a0a96){var _0x23bac2;return db['CmList'][_0x8ee6('0x54')]({'where':{'id':_0x1d9e51[_0x8ee6('0x51')]['id']},'include':[{'model':db[_0x8ee6('0x76')],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x44fda7,null))[_0x8ee6('0x2d')](function(_0x12671f){if(_0x12671f){_0x23bac2=_0x12671f;return db[_0x8ee6('0x66')][_0x8ee6('0x37')];}})['then'](function(_0x358997){if(_0x358997){var _0x107e81={};var _0x235a56={};_0x235a56[_0x8ee6('0x3b')]=_[_0x8ee6('0x71')](_['keys'](_0x358997),_['map'](_0x23bac2['CustomFields'],function(_0x1f8154){return util[_0x8ee6('0x72')]('cf_%d',_0x1f8154['id']);}));_0x235a56['query']=_[_0x8ee6('0x3c')](_0x1d9e51[_0x8ee6('0x3d')]);_0x235a56['filters']=_[_0x8ee6('0x3f')](_0x235a56[_0x8ee6('0x3b')],_0x235a56['query']);_0x107e81[_0x8ee6('0x40')]=_[_0x8ee6('0x3f')](_0x235a56['model'],qs[_0x8ee6('0x41')](_0x1d9e51[_0x8ee6('0x3d')][_0x8ee6('0x41')]));_0x107e81[_0x8ee6('0x40')]=_0x107e81[_0x8ee6('0x40')][_0x8ee6('0x42')]?_0x107e81[_0x8ee6('0x40')]:_0x235a56['model'];if(!_0x1d9e51['query']['hasOwnProperty'](_0x8ee6('0x44'))){_0x107e81['limit']=qs[_0x8ee6('0x27')](_0x1d9e51['query'][_0x8ee6('0x27')]);_0x107e81[_0x8ee6('0x24')]=qs[_0x8ee6('0x24')](_0x1d9e51['query']['offset']);}_0x107e81[_0x8ee6('0x63')]=qs['sort'](_0x1d9e51[_0x8ee6('0x3d')][_0x8ee6('0x45')]);_0x107e81[_0x8ee6('0x46')]=qs[_0x8ee6('0x3e')](_[_0x8ee6('0x47')](_0x1d9e51[_0x8ee6('0x3d')],_0x235a56[_0x8ee6('0x3e')]));_0x107e81[_0x8ee6('0x74')]=!![];if(_0x1d9e51[_0x8ee6('0x3d')][_0x8ee6('0x48')]){_0x107e81[_0x8ee6('0x46')]=_[_0x8ee6('0x49')](_0x107e81[_0x8ee6('0x46')],{'$or':_[_0x8ee6('0x36')](_0x107e81[_0x8ee6('0x40')],function(_0x2fdfac){var _0x5dc711={};_0x5dc711[_0x2fdfac]={'$like':'%'+_0x1d9e51['query'][_0x8ee6('0x48')]+'%'};return _0x5dc711;})});}_0x107e81=_[_0x8ee6('0x49')]({},_0x107e81,_0x1d9e51[_0x8ee6('0x4b')]);return _0x23bac2[_0x8ee6('0x6f')](_0x107e81);}})[_0x8ee6('0x2d')](function(_0x44dfef){if(!_[_0x8ee6('0x77')](_0x44dfef)){var _0x1997bb=toCsv(_0x44dfef);var _0x59f056=Date[_0x8ee6('0x78')]();fs['writeFileSync'](util[_0x8ee6('0x72')](_0x8ee6('0x79'),_0x23bac2['id'],_0x59f056),_0x1997bb);_0x44fda7[_0x8ee6('0x7a')]('Content-disposition','attachment;\x20filename='+util[_0x8ee6('0x72')]('list_%d_%s.csv',_0x23bac2['id'],_0x59f056));_0x44fda7[_0x8ee6('0x7a')](_0x8ee6('0x7b'),'text/csv');return _0x44fda7[_0x8ee6('0x7c')](util[_0x8ee6('0x72')]('/tmp/list_%d_%s.csv',_0x23bac2['id'],_0x59f056));}else{return _0x44fda7[_0x8ee6('0x20')](0xcc);}})[_0x8ee6('0x4f')](handleError(_0x44fda7,null));};exports[_0x8ee6('0x7d')]=function(_0x27e4a4,_0x347faa,_0x5186de){var _0x1acf13;delete _0x27e4a4['body']['id'];return db[_0x8ee6('0x52')]['findOne']({'where':{'id':_0x27e4a4[_0x8ee6('0x51')]['id']}})[_0x8ee6('0x2d')](handleEntityNotFound(_0x347faa,null))[_0x8ee6('0x2d')](function(_0x11f0a2){if(_0x11f0a2){return db['sequelize'][_0x8ee6('0x7e')](function(_0x284ed1){return db[_0x8ee6('0x76')][_0x8ee6('0x55')](_0x27e4a4[_0x8ee6('0x56')],{'transaction':_0x284ed1})[_0x8ee6('0x2d')](function(_0x4926ba){_0x1acf13=_0x4926ba;return _0x11f0a2['addCustomFields'](_0x4926ba,{'transaction':_0x284ed1});})['then'](function(){var _0x266877={'type':db[_0x8ee6('0x7f')][_0x8ee6('0x80')],'transaction':_0x284ed1};switch(_0x27e4a4[_0x8ee6('0x56')][_0x8ee6('0x39')]){case _0x8ee6('0x81'):_0x266877[_0x8ee6('0x39')]=db[_0x8ee6('0x7f')][_0x8ee6('0x80')];break;case _0x8ee6('0x82'):_0x266877[_0x8ee6('0x39')]=db[_0x8ee6('0x7f')][_0x8ee6('0x83')];break;case _0x8ee6('0x84'):_0x266877[_0x8ee6('0x39')]=db[_0x8ee6('0x7f')][_0x8ee6('0x85')];_0x266877[_0x8ee6('0x86')]=![];break;default:}return db[_0x8ee6('0x87')][_0x8ee6('0x88')][_0x8ee6('0x89')](_0x8ee6('0x8a'),util[_0x8ee6('0x72')](_0x8ee6('0x8b'),_0x1acf13['id']),_0x266877);})['then'](function(){return _0x1acf13;});});}})['then'](respondWithResult(_0x347faa,null))['catch'](handleError(_0x347faa,null));};exports[_0x8ee6('0x8c')]=function(_0x125bc6,_0x32330f,_0x26bab7){var _0xa15f61={};var _0x1a861c={};var _0x3f93f8;var _0xd482dc;return db[_0x8ee6('0x52')][_0x8ee6('0x61')]({'where':{'id':_0x125bc6['params']['id']}})[_0x8ee6('0x2d')](handleEntityNotFound(_0x32330f,null))[_0x8ee6('0x2d')](function(_0x2e0a55){if(_0x2e0a55){_0x3f93f8=_0x2e0a55;_0x1a861c[_0x8ee6('0x3b')]=_['keys'](db[_0x8ee6('0x76')]['rawAttributes']);_0x1a861c[_0x8ee6('0x3d')]=_[_0x8ee6('0x3c')](_0x125bc6['query']);_0x1a861c[_0x8ee6('0x3e')]=_['intersection'](_0x1a861c['model'],_0x1a861c[_0x8ee6('0x3d')]);_0xa15f61[_0x8ee6('0x40')]=_[_0x8ee6('0x3f')](_0x1a861c['model'],qs[_0x8ee6('0x41')](_0x125bc6[_0x8ee6('0x3d')][_0x8ee6('0x41')]));_0xa15f61[_0x8ee6('0x40')]=_0xa15f61[_0x8ee6('0x40')][_0x8ee6('0x42')]?_0xa15f61[_0x8ee6('0x40')]:_0x1a861c[_0x8ee6('0x3b')];_0xa15f61[_0x8ee6('0x63')]=qs[_0x8ee6('0x45')](_0x125bc6[_0x8ee6('0x3d')][_0x8ee6('0x45')]);_0xa15f61['where']=qs[_0x8ee6('0x3e')](_['pick'](_0x125bc6[_0x8ee6('0x3d')],_0x1a861c['filters']));_0xa15f61[_0x8ee6('0x46')]=_[_0x8ee6('0x49')](_0xa15f61[_0x8ee6('0x46')],{'$or':[{'ListId':_0x2e0a55['id']},{'ListId':null}]});if(_0x125bc6['query'][_0x8ee6('0x48')]){_0xa15f61[_0x8ee6('0x46')]=_[_0x8ee6('0x49')](_0xa15f61['where'],{'$or':_[_0x8ee6('0x36')](_0xa15f61[_0x8ee6('0x40')],function(_0x1cfdaa){var _0x576aad={};_0x576aad[_0x1cfdaa]={'$like':'%'+_0x125bc6[_0x8ee6('0x3d')][_0x8ee6('0x48')]+'%'};return _0x576aad;})});}_0xa15f61=_[_0x8ee6('0x49')]({},_0xa15f61,_0x125bc6[_0x8ee6('0x4b')]);return db['CmCustomField']['findAndCountAll'](_0xa15f61);}})[_0x8ee6('0x2d')](respondWithResult(_0x32330f,null))['catch'](handleError(_0x32330f,null));};exports[_0x8ee6('0x8d')]=function(_0x37b501,_0x373346,_0x525f0b){return db[_0x8ee6('0x52')][_0x8ee6('0x54')]({'where':{'id':_0x37b501[_0x8ee6('0x51')]['id']}})[_0x8ee6('0x2d')](handleEntityNotFound(_0x373346,null))[_0x8ee6('0x2d')](function(_0x398214){if(_0x398214){return _0x398214[_0x8ee6('0x8d')](_0x37b501['body'][_0x8ee6('0x6c')],_['omit'](_0x37b501[_0x8ee6('0x56')],[_0x8ee6('0x6c'),'id'])||{})['spread'](function(_0x4ce48e){for(var _0x55a468=0x0;_0x55a468<_0x37b501[_0x8ee6('0x56')][_0x8ee6('0x6c')][_0x8ee6('0x42')];_0x55a468+=0x1){socket['emit'](_0x8ee6('0x8e'),{'UserId':Number(_0x37b501[_0x8ee6('0x56')][_0x8ee6('0x6c')][_0x55a468]),'CmListId':Number(_0x37b501[_0x8ee6('0x51')]['id'])});}return _0x4ce48e;});}})[_0x8ee6('0x2d')](respondWithResult(_0x373346,null))[_0x8ee6('0x4f')](handleError(_0x373346,null));};exports[_0x8ee6('0x8f')]=function(_0x114612,_0xf4e184,_0x698335){return db[_0x8ee6('0x52')]['find']({'where':{'id':_0x114612[_0x8ee6('0x51')]['id']}})['then'](handleEntityNotFound(_0xf4e184,null))['then'](function(_0x42441e){if(_0x42441e){return _0x42441e['removeAgents'](_0x114612[_0x8ee6('0x3d')][_0x8ee6('0x6c')])[_0x8ee6('0x2d')](function(){if(_[_0x8ee6('0x68')](_0x114612[_0x8ee6('0x3d')][_0x8ee6('0x6c')])){for(var _0x5f5863=0x0;_0x5f5863<_0x114612[_0x8ee6('0x3d')][_0x8ee6('0x6c')][_0x8ee6('0x42')];_0x5f5863+=0x1){socket[_0x8ee6('0x90')](_0x8ee6('0x91'),{'UserId':Number(_0x114612[_0x8ee6('0x3d')][_0x8ee6('0x6c')][_0x5f5863]),'CmListId':Number(_0x114612['params']['id'])});}}else{socket[_0x8ee6('0x90')](_0x8ee6('0x91'),{'UserId':Number(_0x114612['query'][_0x8ee6('0x6c')]),'CmListId':Number(_0x114612[_0x8ee6('0x51')]['id'])});}});}})[_0x8ee6('0x2d')](respondWithStatusCode(_0xf4e184,null))['catch'](handleError(_0xf4e184,null));};exports[_0x8ee6('0x92')]=function(_0x3f112,_0x38b219,_0x2542cb){var _0x266b3c={};var _0x1507e4={};var _0x5f4ae4;var _0xbd64ce;return db[_0x8ee6('0x52')][_0x8ee6('0x61')]({'where':{'id':_0x3f112['params']['id']}})[_0x8ee6('0x2d')](handleEntityNotFound(_0x38b219,null))[_0x8ee6('0x2d')](function(_0x4b0a7f){if(_0x4b0a7f){_0x5f4ae4=_0x4b0a7f;_0x1507e4[_0x8ee6('0x3b')]=_['keys'](db[_0x8ee6('0x93')][_0x8ee6('0x37')]);_0x1507e4[_0x8ee6('0x3d')]=_[_0x8ee6('0x3c')](_0x3f112[_0x8ee6('0x3d')]);_0x1507e4['filters']=_[_0x8ee6('0x3f')](_0x1507e4[_0x8ee6('0x3b')],_0x1507e4[_0x8ee6('0x3d')]);_0x266b3c['attributes']=_[_0x8ee6('0x3f')](_0x1507e4[_0x8ee6('0x3b')],qs[_0x8ee6('0x41')](_0x3f112[_0x8ee6('0x3d')][_0x8ee6('0x41')]));_0x266b3c[_0x8ee6('0x40')]=_0x266b3c[_0x8ee6('0x40')][_0x8ee6('0x42')]?_0x266b3c[_0x8ee6('0x40')]:_0x1507e4['model'];_0x266b3c[_0x8ee6('0x63')]=qs[_0x8ee6('0x45')](_0x3f112[_0x8ee6('0x3d')][_0x8ee6('0x45')]);_0x266b3c[_0x8ee6('0x46')]=qs[_0x8ee6('0x3e')](_[_0x8ee6('0x47')](_0x3f112[_0x8ee6('0x3d')],_0x1507e4['filters']));if(_0x3f112[_0x8ee6('0x3d')][_0x8ee6('0x48')]){_0x266b3c[_0x8ee6('0x46')]=_['merge'](_0x266b3c[_0x8ee6('0x46')],{'$or':_[_0x8ee6('0x36')](_0x266b3c['attributes'],function(_0x556ae6){var _0x463dd3={};_0x463dd3[_0x556ae6]={'$like':'%'+_0x3f112[_0x8ee6('0x3d')]['filter']+'%'};return _0x463dd3;})});}_0x266b3c=_[_0x8ee6('0x49')]({},_0x266b3c,_0x3f112['options']);return _0x5f4ae4['getAgents'](_0x266b3c);}})[_0x8ee6('0x2d')](function(_0x44d4c2){if(_0x44d4c2){_0xbd64ce=_0x44d4c2[_0x8ee6('0x42')];if(!_0x3f112[_0x8ee6('0x3d')][_0x8ee6('0x43')]('nolimit')){_0x266b3c['limit']=qs[_0x8ee6('0x27')](_0x3f112[_0x8ee6('0x3d')]['limit']);_0x266b3c[_0x8ee6('0x24')]=qs[_0x8ee6('0x24')](_0x3f112[_0x8ee6('0x3d')]['offset']);}return _0x5f4ae4['getAgents'](_0x266b3c);}})[_0x8ee6('0x2d')](function(_0x1df10b){if(_0x1df10b){return _0x1df10b?{'count':_0xbd64ce,'rows':_0x1df10b}:null;}})['then'](respondWithResult(_0x38b219,null))[_0x8ee6('0x4f')](handleError(_0x38b219,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 8cac9f1..8fcd506 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe14b,0x93));var _0xbe14=function(_0x8e28e2,_0x4d4858){_0x8e28e2=_0x8e28e2-0x0;var _0x104d65=_0xe14b[_0x8e28e2];return _0x104d65;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file +var _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x387c55,_0x45e10f){_0x387c55=_0x387c55-0x0;var _0x13dd65=_0x3e74[_0x387c55];return _0x13dd65;};'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 diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index ebc88bb..b999c56 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 _0x6324=['define','cm_lists','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','exports'];(function(_0x192d55,_0x7c9ee4){var _0x1ea8ac=function(_0x3e9053){while(--_0x3e9053){_0x192d55['push'](_0x192d55['shift']());}};_0x1ea8ac(++_0x7c9ee4);}(_0x6324,0x142));var _0x4632=function(_0x3aeae6,_0x201d94){_0x3aeae6=_0x3aeae6-0x0;var _0xc3594=_0x6324[_0x3aeae6];return _0xc3594;};'use strict';var _=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var logger=require(_0x4632('0x2'))(_0x4632('0x3'));var moment=require('moment');var BPromise=require(_0x4632('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4632('0x5'));var rimraf=require('rimraf');var config=require(_0x4632('0x6'));var attributes=require('./cmList.attributes');module[_0x4632('0x7')]=function(_0x24aba6,_0x1f3077){return _0x24aba6[_0x4632('0x8')]('CmList',attributes,{'tableName':_0x4632('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ff3=['cm_lists','util','api','bluebird','request-promise','path','rimraf','./cmList.attributes','exports','define'];(function(_0x1fb8c6,_0x5a18cd){var _0x5740d4=function(_0xb623a4){while(--_0xb623a4){_0x1fb8c6['push'](_0x1fb8c6['shift']());}};_0x5740d4(++_0x5a18cd);}(_0x5ff3,0x17d));var _0x35ff=function(_0x9edcdc,_0x4f0dc8){_0x9edcdc=_0x9edcdc-0x0;var _0x424768=_0x5ff3[_0x9edcdc];return _0x424768;};'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 diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 92e9513..3b25a8f 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 _0x88e8=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','./cmList.socket','register','request','then','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','code','CmList,\x20%s,\x20%s','message','result','bluebird'];(function(_0x10cccd,_0x4bada9){var _0x57a069=function(_0xee392e){while(--_0xee392e){_0x10cccd['push'](_0x10cccd['shift']());}};_0x57a069(++_0x4bada9);}(_0x88e8,0x1d3));var _0x888e=function(_0x325654,_0x4e6fe1){_0x325654=_0x325654-0x0;var _0x994fc7=_0x88e8[_0x325654];return _0x994fc7;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x888e('0x0'));var rs=require(_0x888e('0x1'));var fs=require('fs');var Redis=require(_0x888e('0x2'));var db=require(_0x888e('0x3'))['db'];var utils=require(_0x888e('0x4'));var logger=require(_0x888e('0x5'))(_0x888e('0x6'));var config=require('../../config/environment');var jayson=require(_0x888e('0x7'));var client=jayson[_0x888e('0x8')][_0x888e('0x9')]({'port':0x232a});config['redis']=_[_0x888e('0xa')](config[_0x888e('0xb')],{'host':_0x888e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x888e('0xb')]));require(_0x888e('0xd'))[_0x888e('0xe')](socket);function respondWithRpcPromise(_0x3be6ab,_0x4cddc2,_0xe853b5){return new BPromise(function(_0x3cd5fd,_0x1d1dec){return client[_0x888e('0xf')](_0x3be6ab,_0xe853b5)[_0x888e('0x10')](function(_0x299278){logger[_0x888e('0x11')]('CmList,\x20%s,\x20%s',_0x4cddc2,_0x888e('0x12'));logger[_0x888e('0x13')](_0x888e('0x14'),_0x4cddc2,'request\x20sent',JSON['stringify'](_0x299278));if(_0x299278[_0x888e('0x15')]){if(_0x299278[_0x888e('0x15')][_0x888e('0x16')]===0x1f4){logger['error'](_0x888e('0x17'),_0x4cddc2,_0x299278[_0x888e('0x15')][_0x888e('0x18')]);return _0x1d1dec(_0x299278['error'][_0x888e('0x18')]);}logger['error'](_0x888e('0x17'),_0x4cddc2,_0x299278[_0x888e('0x15')][_0x888e('0x18')]);return _0x3cd5fd(_0x299278['error'][_0x888e('0x18')]);}else{logger[_0x888e('0x11')]('CmList,\x20%s,\x20%s',_0x4cddc2,_0x888e('0x12'));_0x3cd5fd(_0x299278[_0x888e('0x19')][_0x888e('0x18')]);}})['catch'](function(_0x2486b8){logger[_0x888e('0x15')](_0x888e('0x17'),_0x4cddc2,_0x2486b8);_0x1d1dec(_0x2486b8);});});} \ No newline at end of file +var _0xfef3=['defaults','localhost','socket.io-emitter','redis','./cmList.socket','request','then','info','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','CmList,\x20%s,\x20%s','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x495d33,_0xef4b0b){var _0x2434aa=function(_0x109b8f){while(--_0x109b8f){_0x495d33['push'](_0x495d33['shift']());}};_0x2434aa(++_0xef4b0b);}(_0xfef3,0x1b0));var _0x3fef=function(_0x5bd626,_0xdbf46d){_0x5bd626=_0x5bd626-0x0;var _0x2661ca=_0xfef3[_0x5bd626];return _0x2661ca;};'use strict';var _=require(_0x3fef('0x0'));var util=require(_0x3fef('0x1'));var moment=require('moment');var BPromise=require(_0x3fef('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3fef('0x3'))['db'];var utils=require(_0x3fef('0x4'));var logger=require(_0x3fef('0x5'))(_0x3fef('0x6'));var config=require(_0x3fef('0x7'));var jayson=require(_0x3fef('0x8'));var client=jayson[_0x3fef('0x9')]['http']({'port':0x232a});config['redis']=_[_0x3fef('0xa')](config['redis'],{'host':_0x3fef('0xb'),'port':0x18eb});var socket=require(_0x3fef('0xc'))(new Redis(config[_0x3fef('0xd')]));require(_0x3fef('0xe'))['register'](socket);function respondWithRpcPromise(_0x12ebb4,_0x536f17,_0x2bdcd3){return new BPromise(function(_0x2c37f1,_0x5d2e37){return client[_0x3fef('0xf')](_0x12ebb4,_0x2bdcd3)[_0x3fef('0x10')](function(_0x4e2bc9){logger[_0x3fef('0x11')]('CmList,\x20%s,\x20%s',_0x536f17,'request\x20sent');logger[_0x3fef('0x12')](_0x3fef('0x13'),_0x536f17,_0x3fef('0x14'),JSON[_0x3fef('0x15')](_0x4e2bc9));if(_0x4e2bc9[_0x3fef('0x16')]){if(_0x4e2bc9[_0x3fef('0x16')][_0x3fef('0x17')]===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x536f17,_0x4e2bc9[_0x3fef('0x16')][_0x3fef('0x18')]);return _0x5d2e37(_0x4e2bc9[_0x3fef('0x16')][_0x3fef('0x18')]);}logger[_0x3fef('0x16')](_0x3fef('0x19'),_0x536f17,_0x4e2bc9[_0x3fef('0x16')][_0x3fef('0x18')]);return _0x2c37f1(_0x4e2bc9[_0x3fef('0x16')][_0x3fef('0x18')]);}else{logger[_0x3fef('0x11')]('CmList,\x20%s,\x20%s',_0x536f17,_0x3fef('0x14'));_0x2c37f1(_0x4e2bc9['result']['message']);}})['catch'](function(_0x246f99){logger['error']('CmList,\x20%s,\x20%s',_0x536f17,_0x246f99);_0x5d2e37(_0x246f99);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 085fd13..d1de5c4 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 _0x32b6=['remove','emit','removeListener','length','cmList:','./cmList.events','save'];(function(_0x297b5f,_0x2c2d5e){var _0xbdf50e=function(_0x15d71c){while(--_0x15d71c){_0x297b5f['push'](_0x297b5f['shift']());}};_0xbdf50e(++_0x2c2d5e);}(_0x32b6,0x10f));var _0x632b=function(_0x4e5936,_0x235168){_0x4e5936=_0x4e5936-0x0;var _0x44448c=_0x32b6[_0x4e5936];return _0x44448c;};'use strict';var CmListEvents=require(_0x632b('0x0'));var events=[_0x632b('0x1'),_0x632b('0x2'),'update'];function createListener(_0x18aa39,_0x103eac){return function(_0x58adb3){_0x103eac[_0x632b('0x3')](_0x18aa39,_0x58adb3);};}function removeListener(_0x537628,_0x174696){return function(){CmListEvents[_0x632b('0x4')](_0x537628,_0x174696);};}exports['register']=function(_0x2e6d3f){for(var _0x2c07f3=0x0,_0xc7a3e=events[_0x632b('0x5')];_0x2c07f3<_0xc7a3e;_0x2c07f3++){var _0xdcde8d=events[_0x2c07f3];var _0x7b6ab1=createListener(_0x632b('0x6')+_0xdcde8d,_0x2e6d3f);CmListEvents['on'](_0xdcde8d,_0x7b6ab1);}}; \ No newline at end of file +var _0x68b6=['register','length','cmList:','./cmList.events','save','remove','update','emit'];(function(_0x219bb8,_0x32f510){var _0x8f8340=function(_0xec2c6a){while(--_0xec2c6a){_0x219bb8['push'](_0x219bb8['shift']());}};_0x8f8340(++_0x32f510);}(_0x68b6,0x1a3));var _0x668b=function(_0x1ac98a,_0x4630fb){_0x1ac98a=_0x1ac98a-0x0;var _0x2e5937=_0x68b6[_0x1ac98a];return _0x2e5937;};'use strict';var CmListEvents=require(_0x668b('0x0'));var events=[_0x668b('0x1'),_0x668b('0x2'),_0x668b('0x3')];function createListener(_0x2fb5eb,_0x591e39){return function(_0x50ddd6){_0x591e39[_0x668b('0x4')](_0x2fb5eb,_0x50ddd6);};}function removeListener(_0x5acf01,_0x366654){return function(){CmListEvents['removeListener'](_0x5acf01,_0x366654);};}exports[_0x668b('0x5')]=function(_0x5e06fa){for(var _0x3b7f69=0x0,_0x48f5b3=events[_0x668b('0x6')];_0x3b7f69<_0x48f5b3;_0x3b7f69++){var _0x4601b1=events[_0x3b7f69];var _0x1391fc=createListener(_0x668b('0x7')+_0x4601b1,_0x5e06fa);CmListEvents['on'](_0x4601b1,_0x1391fc);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 3dc4c4a..3f75deb 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 _0x9e29=['express','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','getCustomFields','/:id/users','post','addDisposition','addCustomField','addAgents','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x247fe8,_0x482226){var _0x2285eb=function(_0x242c87){while(--_0x242c87){_0x247fe8['push'](_0x247fe8['shift']());}};_0x2285eb(++_0x482226);}(_0x9e29,0xf4));var _0x99e2=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x9e29[_0x500419];return _0x241c1a;};'use strict';var multer=require(_0x99e2('0x0'));var util=require(_0x99e2('0x1'));var path=require(_0x99e2('0x2'));var timeout=require(_0x99e2('0x3'));var express=require(_0x99e2('0x4'));var router=express[_0x99e2('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x99e2('0x6'));var config=require(_0x99e2('0x7'));var controller=require(_0x99e2('0x8'));router[_0x99e2('0x9')]('/',auth[_0x99e2('0xa')](),controller[_0x99e2('0xb')]);router[_0x99e2('0x9')](_0x99e2('0xc'),auth[_0x99e2('0xa')](),controller[_0x99e2('0xd')]);router[_0x99e2('0x9')](_0x99e2('0xe'),auth[_0x99e2('0xa')](),controller[_0x99e2('0xf')]);router[_0x99e2('0x9')](_0x99e2('0x10'),auth['isAuthenticated'](),controller[_0x99e2('0x11')]);router[_0x99e2('0x9')](_0x99e2('0x12'),auth['isAuthenticated'](),controller['getContacts']);router[_0x99e2('0x9')](_0x99e2('0x13'),auth[_0x99e2('0xa')](),controller[_0x99e2('0x14')]);router[_0x99e2('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0x99e2('0x15')]);router[_0x99e2('0x9')](_0x99e2('0x16'),auth['isAuthenticated'](),controller['getAgents']);router[_0x99e2('0x17')]('/',auth['isAuthenticated'](),controller['create']);router[_0x99e2('0x17')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x99e2('0x18')]);router[_0x99e2('0x17')](_0x99e2('0x12'),auth[_0x99e2('0xa')](),controller['addContacts']);router[_0x99e2('0x17')]('/:id/fields',auth[_0x99e2('0xa')](),controller[_0x99e2('0x19')]);router[_0x99e2('0x17')](_0x99e2('0x16'),auth[_0x99e2('0xa')](),controller[_0x99e2('0x1a')]);router[_0x99e2('0x1b')](_0x99e2('0xe'),auth[_0x99e2('0xa')](),controller[_0x99e2('0x1c')]);router[_0x99e2('0x1d')](_0x99e2('0xe'),auth[_0x99e2('0xa')](),controller['destroy']);router[_0x99e2('0x1d')](_0x99e2('0x10'),auth[_0x99e2('0xa')](),controller['removeDispositions']);router[_0x99e2('0x1d')](_0x99e2('0x16'),auth[_0x99e2('0xa')](),controller['removeAgents']);module[_0x99e2('0x1e')]=router; \ No newline at end of file +var _0x2c50=['index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addContacts','addCustomField','update','delete','removeDispositions','removeAgents','exports','multer','path','express','Router','../../components/auth/service','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x58400b,_0x59baef){var _0x5b0030=function(_0x1ab73e){while(--_0x1ab73e){_0x58400b['push'](_0x58400b['shift']());}};_0x5b0030(++_0x59baef);}(_0x2c50,0x1e6));var _0x02c5=function(_0x4191bc,_0x3096c5){_0x4191bc=_0x4191bc-0x0;var _0x1ffd4e=_0x2c50[_0x4191bc];return _0x1ffd4e;};'use strict';var multer=require(_0x02c5('0x0'));var util=require('util');var path=require(_0x02c5('0x1'));var timeout=require('connect-timeout');var express=require(_0x02c5('0x2'));var router=express[_0x02c5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x02c5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x02c5('0x5'));var controller=require(_0x02c5('0x6'));router[_0x02c5('0x7')]('/',auth[_0x02c5('0x8')](),controller[_0x02c5('0x9')]);router[_0x02c5('0x7')](_0x02c5('0xa'),auth[_0x02c5('0x8')](),controller['describe']);router['get'](_0x02c5('0xb'),auth[_0x02c5('0x8')](),controller[_0x02c5('0xc')]);router[_0x02c5('0x7')](_0x02c5('0xd'),auth[_0x02c5('0x8')](),controller[_0x02c5('0xe')]);router[_0x02c5('0x7')](_0x02c5('0xf'),auth[_0x02c5('0x8')](),controller[_0x02c5('0x10')]);router[_0x02c5('0x7')](_0x02c5('0x11'),auth[_0x02c5('0x8')](),controller[_0x02c5('0x12')]);router[_0x02c5('0x7')](_0x02c5('0x13'),auth['isAuthenticated'](),controller[_0x02c5('0x14')]);router[_0x02c5('0x7')](_0x02c5('0x15'),auth[_0x02c5('0x8')](),controller[_0x02c5('0x16')]);router[_0x02c5('0x17')]('/',auth[_0x02c5('0x8')](),controller[_0x02c5('0x18')]);router[_0x02c5('0x17')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x02c5('0x19')]);router[_0x02c5('0x17')](_0x02c5('0xf'),auth[_0x02c5('0x8')](),controller[_0x02c5('0x1a')]);router[_0x02c5('0x17')](_0x02c5('0x13'),auth[_0x02c5('0x8')](),controller[_0x02c5('0x1b')]);router[_0x02c5('0x17')](_0x02c5('0x15'),auth[_0x02c5('0x8')](),controller['addAgents']);router['put']('/:id',auth[_0x02c5('0x8')](),controller[_0x02c5('0x1c')]);router[_0x02c5('0x1d')](_0x02c5('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0x02c5('0x1d')](_0x02c5('0xd'),auth[_0x02c5('0x8')](),controller[_0x02c5('0x1e')]);router[_0x02c5('0x1d')]('/:id/users',auth['isAuthenticated'](),controller[_0x02c5('0x1f')]);module[_0x02c5('0x20')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 848c70d..2322a0e 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 _0x219f=['exports','VIRTUAL','field','STRING','sequelize'];(function(_0x1b0f73,_0x562ee4){var _0x13e0e1=function(_0x1151e1){while(--_0x1151e1){_0x1b0f73['push'](_0x1b0f73['shift']());}};_0x13e0e1(++_0x562ee4);}(_0x219f,0xc2));var _0xf219=function(_0xfb0087,_0x148b31){_0xfb0087=_0xfb0087-0x0;var _0x22fd7a=_0x219f[_0xfb0087];return _0x22fd7a;};'use strict';var Sequelize=require(_0xf219('0x0'));module[_0xf219('0x1')]={'name':{'type':Sequelize[_0xf219('0x2')],'get':function(_0x555760){return this['getDataValue'](_0xf219('0x3'));}},'field':{'type':Sequelize[_0xf219('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xf219('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xf219('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xfe4a=['sequelize','exports','VIRTUAL','getDataValue','field','STRING'];(function(_0x1577bd,_0x298b5b){var _0x232bc1=function(_0x54cd81){while(--_0x54cd81){_0x1577bd['push'](_0x1577bd['shift']());}};_0x232bc1(++_0x298b5b);}(_0xfe4a,0xfc));var _0xafe4=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xfe4a[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require(_0xafe4('0x0'));module[_0xafe4('0x1')]={'name':{'type':Sequelize[_0xafe4('0x2')],'get':function(_0x27c76b){return this[_0xafe4('0x3')](_0xafe4('0x4'));}},'field':{'type':Sequelize[_0xafe4('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0xafe4('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0xafe4('0x5')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index cb50f05..2eb6e33 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x58b9fd,_0x353100){var _0x4dad91=function(_0x593929){while(--_0x593929){_0x58b9fd['push'](_0x58b9fd['shift']());}};_0x4dad91(++_0x353100);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _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(_0x197487,_0x5834b6){var _0x39b429=function(_0x27d50e){while(--_0x27d50e){_0x197487['push'](_0x197487['shift']());}};_0x39b429(++_0x5834b6);}(_0x7a54,0x106));var _0x47a5=function(_0xea9e40,_0xd1809a){_0xea9e40=_0xea9e40-0x0;var _0x16f01e=_0x7a54[_0xea9e40];return _0x16f01e;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index a63074e..4121385 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 _0xd63c=['rimraf','../../config/environment','./condition.attributes','define','Condition','tools_conditions','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x43b616,_0xb842c){var _0xc188db=function(_0x2faaf5){while(--_0x2faaf5){_0x43b616['push'](_0x43b616['shift']());}};_0xc188db(++_0xb842c);}(_0xd63c,0x13e));var _0xcd63=function(_0x182f0f,_0xfd5bb7){_0x182f0f=_0x182f0f-0x0;var _0xb571cf=_0xd63c[_0x182f0f];return _0xb571cf;};'use strict';var _=require(_0xcd63('0x0'));var util=require(_0xcd63('0x1'));var logger=require(_0xcd63('0x2'))(_0xcd63('0x3'));var moment=require(_0xcd63('0x4'));var BPromise=require('bluebird');var rp=require(_0xcd63('0x5'));var fs=require('fs');var path=require(_0xcd63('0x6'));var rimraf=require(_0xcd63('0x7'));var config=require(_0xcd63('0x8'));var attributes=require(_0xcd63('0x9'));module['exports']=function(_0x4f85c5,_0x211b84){return _0x4f85c5[_0xcd63('0xa')](_0xcd63('0xb'),attributes,{'tableName':_0xcd63('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d6c=['path','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','lodash','util','api','moment','bluebird','request-promise'];(function(_0x50adbe,_0x59c5ff){var _0x2e47e1=function(_0x36f2d7){while(--_0x36f2d7){_0x50adbe['push'](_0x50adbe['shift']());}};_0x2e47e1(++_0x59c5ff);}(_0x1d6c,0x14a));var _0xc1d6=function(_0x179431,_0x351754){_0x179431=_0x179431-0x0;var _0x56d6dc=_0x1d6c[_0x179431];return _0x56d6dc;};'use strict';var _=require(_0xc1d6('0x0'));var util=require(_0xc1d6('0x1'));var logger=require('../../config/logger')(_0xc1d6('0x2'));var moment=require(_0xc1d6('0x3'));var BPromise=require(_0xc1d6('0x4'));var rp=require(_0xc1d6('0x5'));var fs=require('fs');var path=require(_0xc1d6('0x6'));var rimraf=require(_0xc1d6('0x7'));var config=require(_0xc1d6('0x8'));var attributes=require(_0xc1d6('0x9'));module[_0xc1d6('0xa')]=function(_0xf3c670,_0x3f92e3){return _0xf3c670[_0xc1d6('0xb')](_0xc1d6('0xc'),attributes,{'tableName':_0xc1d6('0xd'),'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 a73e18c..0e72272 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 _0xb71a=['Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent'];(function(_0x3948d6,_0x193434){var _0x5da084=function(_0x2fd552){while(--_0x2fd552){_0x3948d6['push'](_0x3948d6['shift']());}};_0x5da084(++_0x193434);}(_0xb71a,0x18d));var _0xab71=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xb71a[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xab71('0x0'));var util=require('util');var moment=require(_0xab71('0x1'));var BPromise=require(_0xab71('0x2'));var rs=require(_0xab71('0x3'));var fs=require('fs');var Redis=require(_0xab71('0x4'));var db=require(_0xab71('0x5'))['db'];var utils=require(_0xab71('0x6'));var logger=require(_0xab71('0x7'))(_0xab71('0x8'));var config=require('../../config/environment');var jayson=require(_0xab71('0x9'));var client=jayson[_0xab71('0xa')][_0xab71('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x565976,_0x450451,_0x12a50e){return new BPromise(function(_0x334809,_0x7bc04b){return client[_0xab71('0xc')](_0x565976,_0x12a50e)[_0xab71('0xd')](function(_0x5978d2){logger[_0xab71('0xe')](_0xab71('0xf'),_0x450451,_0xab71('0x10'));logger['debug'](_0xab71('0x11'),_0x450451,_0xab71('0x10'),JSON[_0xab71('0x12')](_0x5978d2));if(_0x5978d2['error']){if(_0x5978d2[_0xab71('0x13')][_0xab71('0x14')]===0x1f4){logger[_0xab71('0x13')]('Condition,\x20%s,\x20%s',_0x450451,_0x5978d2[_0xab71('0x13')][_0xab71('0x15')]);return _0x7bc04b(_0x5978d2[_0xab71('0x13')][_0xab71('0x15')]);}logger['error']('Condition,\x20%s,\x20%s',_0x450451,_0x5978d2[_0xab71('0x13')][_0xab71('0x15')]);return _0x334809(_0x5978d2[_0xab71('0x13')][_0xab71('0x15')]);}else{logger['info'](_0xab71('0xf'),_0x450451,_0xab71('0x10'));_0x334809(_0x5978d2['result']['message']);}})[_0xab71('0x16')](function(_0x1c0f74){logger[_0xab71('0x13')](_0xab71('0xf'),_0x450451,_0x1c0f74);_0x7bc04b(_0x1c0f74);});});} \ No newline at end of file +var _0x5ea4=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','Condition,\x20%s,\x20%s','request\x20sent','error','code','message','result'];(function(_0x8ea6db,_0x569d8b){var _0x54fc88=function(_0x18cb7f){while(--_0x18cb7f){_0x8ea6db['push'](_0x8ea6db['shift']());}};_0x54fc88(++_0x569d8b);}(_0x5ea4,0x6a));var _0x45ea=function(_0x45e738,_0x2972e6){_0x45e738=_0x45e738-0x0;var _0x32eb45=_0x5ea4[_0x45e738];return _0x32eb45;};'use strict';var _=require(_0x45ea('0x0'));var util=require(_0x45ea('0x1'));var moment=require(_0x45ea('0x2'));var BPromise=require('bluebird');var rs=require(_0x45ea('0x3'));var fs=require('fs');var Redis=require(_0x45ea('0x4'));var db=require(_0x45ea('0x5'))['db'];var utils=require(_0x45ea('0x6'));var logger=require(_0x45ea('0x7'))(_0x45ea('0x8'));var config=require(_0x45ea('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x45ea('0xa')][_0x45ea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ae718,_0x112a58,_0x3bc7ce){return new BPromise(function(_0x31c450,_0x2857bd){return client['request'](_0x5ae718,_0x3bc7ce)[_0x45ea('0xc')](function(_0x297083){logger[_0x45ea('0xd')](_0x45ea('0xe'),_0x112a58,_0x45ea('0xf'));logger['debug']('Condition,\x20%s,\x20%s,\x20%s',_0x112a58,_0x45ea('0xf'),JSON['stringify'](_0x297083));if(_0x297083[_0x45ea('0x10')]){if(_0x297083[_0x45ea('0x10')][_0x45ea('0x11')]===0x1f4){logger[_0x45ea('0x10')](_0x45ea('0xe'),_0x112a58,_0x297083[_0x45ea('0x10')]['message']);return _0x2857bd(_0x297083[_0x45ea('0x10')][_0x45ea('0x12')]);}logger[_0x45ea('0x10')]('Condition,\x20%s,\x20%s',_0x112a58,_0x297083[_0x45ea('0x10')]['message']);return _0x31c450(_0x297083[_0x45ea('0x10')][_0x45ea('0x12')]);}else{logger[_0x45ea('0xd')](_0x45ea('0xe'),_0x112a58,_0x45ea('0xf'));_0x31c450(_0x297083[_0x45ea('0x13')][_0x45ea('0x12')]);}})[_0x45ea('0x14')](function(_0x5386dc){logger['error'](_0x45ea('0xe'),_0x112a58,_0x5386dc);_0x2857bd(_0x5386dc);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index bc8b41b..fa66d0a 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 _0x95c1=['put','/:id','update','delete','isAuthenticated','destroy','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller'];(function(_0x3b7a0c,_0xf1a4c2){var _0x3bb70f=function(_0x248b52){while(--_0x248b52){_0x3b7a0c['push'](_0x3b7a0c['shift']());}};_0x3bb70f(++_0xf1a4c2);}(_0x95c1,0xd8));var _0x195c=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x95c1[_0x4dc7b9];return _0x3ab114;};'use strict';var multer=require(_0x195c('0x0'));var util=require(_0x195c('0x1'));var path=require(_0x195c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x195c('0x3'));var auth=require(_0x195c('0x4'));var interaction=require(_0x195c('0x5'));var config=require(_0x195c('0x6'));var controller=require(_0x195c('0x7'));router[_0x195c('0x8')](_0x195c('0x9'),auth['isAuthenticated'](),controller[_0x195c('0xa')]);router[_0x195c('0xb')]('/:id',auth[_0x195c('0xc')](),controller[_0x195c('0xd')]);module['exports']=router; \ No newline at end of file +var _0x0f6d=['express','fs-extra','../../components/auth/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0xf5ebad,_0x59f2a0){var _0x15cc20=function(_0x1aa6e0){while(--_0x1aa6e0){_0xf5ebad['push'](_0xf5ebad['shift']());}};_0x15cc20(++_0x59f2a0);}(_0x0f6d,0x6c));var _0xd0f6=function(_0x413aac,_0x5e2430){_0x413aac=_0x413aac-0x0;var _0x569b11=_0x0f6d[_0x413aac];return _0x569b11;};'use strict';var multer=require(_0xd0f6('0x0'));var util=require(_0xd0f6('0x1'));var path=require(_0xd0f6('0x2'));var timeout=require(_0xd0f6('0x3'));var express=require(_0xd0f6('0x4'));var router=express['Router']();var fs_extra=require(_0xd0f6('0x5'));var auth=require(_0xd0f6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd0f6('0x7'));var controller=require(_0xd0f6('0x8'));router[_0xd0f6('0x9')](_0xd0f6('0xa'),auth[_0xd0f6('0xb')](),controller[_0xd0f6('0xc')]);router[_0xd0f6('0xd')](_0xd0f6('0xa'),auth[_0xd0f6('0xb')](),controller[_0xd0f6('0xe')]);module[_0xd0f6('0xf')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 5f9f99c..fd42c47 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x2c2bde,_0x485853){var _0x1c7fb7=function(_0x23d83e){while(--_0x23d83e){_0x2c2bde['push'](_0x2c2bde['shift']());}};_0x1c7fb7(++_0x485853);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x25dad8,_0x2a0997){var _0xbe36db=function(_0x13cd47){while(--_0x13cd47){_0x25dad8['push'](_0x25dad8['shift']());}};_0xbe36db(++_0x2a0997);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index b17ab15..c57bc77 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 _0x199e=['save','then','destroy','CustomDashboards','UserProfileResource','error','stack','name','send','index','Dashboard','fieldName','key','map','query','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','includeAll','include','findAll','catch','show','keys','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','options','omit','createdAt','updatedAt','role','userProfileId','update','params','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','rawAttributes','pick','nolimit','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject'];(function(_0x31f4d5,_0x4e1fd4){var _0x96555b=function(_0xf35362){while(--_0xf35362){_0x31f4d5['push'](_0x31f4d5['shift']());}};_0x96555b(++_0x4e1fd4);}(_0x199e,0xd8));var _0xe199=function(_0x4aba15,_0x4e90aa){_0x4aba15=_0x4aba15-0x0;var _0x1c8122=_0x199e[_0x4aba15];return _0x1c8122;};'use strict';var emlformat=require(_0xe199('0x0'));var rimraf=require(_0xe199('0x1'));var zipdir=require(_0xe199('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe199('0x3'));var moment=require('moment');var BPromise=require(_0xe199('0x4'));var Mustache=require(_0xe199('0x5'));var util=require(_0xe199('0x6'));var path=require(_0xe199('0x7'));var sox=require(_0xe199('0x8'));var csv=require(_0xe199('0x9'));var ejs=require(_0xe199('0xa'));var fs=require('fs');var fs_extra=require(_0xe199('0xb'));var _=require(_0xe199('0xc'));var squel=require(_0xe199('0xd'));var crypto=require(_0xe199('0xe'));var jsforce=require(_0xe199('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xe199('0x9'));var querystring=require(_0xe199('0x10'));var Papa=require('papaparse');var Redis=require(_0xe199('0x11'));var authService=require(_0xe199('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe199('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe199('0x14'));var config=require(_0xe199('0x15'));var licenseUtil=require(_0xe199('0x16'));var db=require(_0xe199('0x17'))['db'];config[_0xe199('0x18')]=_[_0xe199('0x19')](config['redis'],{'host':_0xe199('0x1a'),'port':0x18eb});var socket=require(_0xe199('0x1b'))(new Redis(config[_0xe199('0x18')]));require(_0xe199('0x1c'))[_0xe199('0x1d')](socket);function respondWithStatusCode(_0x45f3a2,_0x4dd30a){_0x4dd30a=_0x4dd30a||0xcc;return function(_0x12ab39){if(_0x12ab39){return _0x45f3a2[_0xe199('0x1e')](_0x4dd30a);}return _0x45f3a2[_0xe199('0x1f')](_0x4dd30a)[_0xe199('0x20')]();};}function respondWithResult(_0x5db980,_0x1d6f9e){_0x1d6f9e=_0x1d6f9e||0xc8;return function(_0x4212cb){if(_0x4212cb){return _0x5db980[_0xe199('0x1f')](_0x1d6f9e)[_0xe199('0x21')](_0x4212cb);}};}function respondWithFilteredResult(_0x54dd09,_0x461c2f){return function(_0x56303a){if(_0x56303a){var _0x29b0e8=typeof _0x461c2f['offset']===_0xe199('0x22')&&typeof _0x461c2f[_0xe199('0x23')]===_0xe199('0x22');var _0x1471e9=_0x56303a['count'];var _0x5121a4=_0x29b0e8?0x0:_0x461c2f[_0xe199('0x24')];var _0x27d267=_0x29b0e8?_0x56303a[_0xe199('0x25')]:_0x461c2f[_0xe199('0x24')]+_0x461c2f[_0xe199('0x23')];var _0xe83d4c;if(_0x27d267>=_0x1471e9){_0x27d267=_0x1471e9;_0xe83d4c=0xc8;}else{_0xe83d4c=0xce;}_0x54dd09[_0xe199('0x1f')](_0xe83d4c);return _0x54dd09[_0xe199('0x26')](_0xe199('0x27'),_0x5121a4+'-'+_0x27d267+'/'+_0x1471e9)['json'](_0x56303a);}return null;};}function patchUpdates(_0x3a5edd){return function(_0x4c7ac8){try{jsonpatch[_0xe199('0x28')](_0x4c7ac8,_0x3a5edd,!![]);}catch(_0x38b958){return BPromise[_0xe199('0x29')](_0x38b958);}return _0x4c7ac8[_0xe199('0x2a')]();};}function saveUpdates(_0x240903,_0x4ef281){return function(_0x14893d){if(_0x14893d){return _0x14893d['update'](_0x240903)[_0xe199('0x2b')](function(_0x4d59df){return _0x4d59df;});}return null;};}function removeEntity(_0x5b64ae,_0x11d4e8){return function(_0x2da0b2){if(_0x2da0b2){return _0x2da0b2[_0xe199('0x2c')]()[_0xe199('0x2b')](function(){var _0x345cee=_0x2da0b2['get']({'plain':!![]});var _0x5228e6=_0xe199('0x2d');return db[_0xe199('0x2e')][_0xe199('0x2c')]({'where':{'type':_0x5228e6,'resourceId':_0x345cee['id']}})['then'](function(){return _0x2da0b2;});})[_0xe199('0x2b')](function(){_0x5b64ae['status'](0xcc)[_0xe199('0x20')]();});}};}function handleEntityNotFound(_0x3cc452,_0x379a21){return function(_0x11c53e){if(!_0x11c53e){_0x3cc452['sendStatus'](0x194);}return _0x11c53e;};}function handleError(_0x2a3596,_0x3bd7b2){_0x3bd7b2=_0x3bd7b2||0x1f4;return function(_0x319c24){logger[_0xe199('0x2f')](_0x319c24[_0xe199('0x30')]);if(_0x319c24[_0xe199('0x31')]){delete _0x319c24[_0xe199('0x31')];}_0x2a3596[_0xe199('0x1f')](_0x3bd7b2)[_0xe199('0x32')](_0x319c24);};}exports[_0xe199('0x33')]=function(_0x55806d,_0x15f816){var _0x23be89={},_0x396c81={},_0x251c88={'count':0x0,'rows':[]};var _0x4e7477=_['map'](db[_0xe199('0x34')]['rawAttributes'],function(_0x31d3d1){return{'name':_0x31d3d1[_0xe199('0x35')],'type':_0x31d3d1['type'][_0xe199('0x36')]};});_0x396c81['model']=_[_0xe199('0x37')](_0x4e7477,_0xe199('0x31'));_0x396c81[_0xe199('0x38')]=_['keys'](_0x55806d[_0xe199('0x38')]);_0x396c81['filters']=_[_0xe199('0x39')](_0x396c81[_0xe199('0x3a')],_0x396c81['query']);_0x23be89['attributes']=_[_0xe199('0x39')](_0x396c81[_0xe199('0x3a')],qs[_0xe199('0x3b')](_0x55806d['query']['fields']));_0x23be89[_0xe199('0x3c')]=_0x23be89[_0xe199('0x3c')][_0xe199('0x3d')]?_0x23be89[_0xe199('0x3c')]:_0x396c81[_0xe199('0x3a')];if(!_0x55806d[_0xe199('0x38')][_0xe199('0x3e')]('nolimit')){_0x23be89[_0xe199('0x23')]=qs[_0xe199('0x23')](_0x55806d[_0xe199('0x38')][_0xe199('0x23')]);_0x23be89[_0xe199('0x24')]=qs[_0xe199('0x24')](_0x55806d[_0xe199('0x38')][_0xe199('0x24')]);}_0x23be89[_0xe199('0x3f')]=qs[_0xe199('0x40')](_0x55806d[_0xe199('0x38')]['sort']);_0x23be89[_0xe199('0x41')]=qs[_0xe199('0x42')](_['pick'](_0x55806d['query'],_0x396c81[_0xe199('0x42')]),_0x4e7477);if(_0x55806d['query'][_0xe199('0x43')]){_0x23be89['where']=_[_0xe199('0x44')](_0x23be89[_0xe199('0x41')],{'$or':_[_0xe199('0x37')](_0x4e7477,function(_0x57e18a){if(_0x57e18a[_0xe199('0x45')]!==_0xe199('0x46')){var _0x126907={};_0x126907[_0x57e18a[_0xe199('0x31')]]={'$like':'%'+_0x55806d[_0xe199('0x38')][_0xe199('0x43')]+'%'};return _0x126907;}})});}_0x23be89=_[_0xe199('0x44')]({},_0x23be89,_0x55806d['options']);var _0x61d3f4={'where':_0x23be89[_0xe199('0x41')]};return db[_0xe199('0x34')][_0xe199('0x25')](_0x61d3f4)[_0xe199('0x2b')](function(_0x381a0){_0x251c88[_0xe199('0x25')]=_0x381a0;if(_0x55806d[_0xe199('0x38')][_0xe199('0x47')]){_0x23be89[_0xe199('0x48')]=[{'all':!![]}];}return db[_0xe199('0x34')][_0xe199('0x49')](_0x23be89);})['then'](function(_0xa4840a){_0x251c88['rows']=_0xa4840a;return _0x251c88;})[_0xe199('0x2b')](respondWithFilteredResult(_0x15f816,_0x23be89))[_0xe199('0x4a')](handleError(_0x15f816,null));};exports[_0xe199('0x4b')]=function(_0x514f7c,_0x1218fb){var _0x18e59b={'raw':![],'where':{'id':_0x514f7c['params']['id']}},_0xdae242={};_0xdae242['model']=_[_0xe199('0x4c')](db['Dashboard']['rawAttributes']);_0xdae242[_0xe199('0x38')]=_[_0xe199('0x4c')](_0x514f7c[_0xe199('0x38')]);_0xdae242[_0xe199('0x42')]=_[_0xe199('0x39')](_0xdae242[_0xe199('0x3a')],_0xdae242['query']);_0x18e59b[_0xe199('0x3c')]=_['intersection'](_0xdae242[_0xe199('0x3a')],qs[_0xe199('0x3b')](_0x514f7c[_0xe199('0x38')]['fields']));_0x18e59b[_0xe199('0x3c')]=_0x18e59b[_0xe199('0x3c')][_0xe199('0x3d')]?_0x18e59b['attributes']:_0xdae242[_0xe199('0x3a')];if(_0x514f7c[_0xe199('0x38')]['includeAll']){_0x18e59b[_0xe199('0x48')]=[{'all':!![]}];}_0x18e59b=_[_0xe199('0x44')]({},_0x18e59b,_0x514f7c['options']);return db['Dashboard'][_0xe199('0x4d')](_0x18e59b)[_0xe199('0x2b')](handleEntityNotFound(_0x1218fb,null))[_0xe199('0x2b')](respondWithResult(_0x1218fb,null))[_0xe199('0x4a')](handleError(_0x1218fb,null));};exports['create']=function(_0x55a1e3,_0x23268f){return db[_0xe199('0x34')]['create'](_0x55a1e3[_0xe199('0x4e')],{})[_0xe199('0x2b')](function(_0x26ff51){var _0x140e4c=_0x55a1e3[_0xe199('0x4f')][_0xe199('0x50')]({'plain':!![]});if(!_0x140e4c)throw new Error(_0xe199('0x51'));if(_0x140e4c['role']===_0xe199('0x4f')){var _0x336e5c=_0x26ff51[_0xe199('0x50')]({'plain':!![]});var _0x5d7afa=_0xe199('0x2d');return db[_0xe199('0x52')]['find']({'where':{'name':_0x5d7afa,'userProfileId':_0x140e4c['userProfileId']},'raw':!![]})[_0xe199('0x2b')](function(_0x4d4c07){if(_0x4d4c07&&_0x4d4c07[_0xe199('0x53')]===0x0){return db[_0xe199('0x2e')][_0xe199('0x54')]({'name':_0x336e5c[_0xe199('0x31')],'resourceId':_0x336e5c['id'],'type':_0x4d4c07['name'],'sectionId':_0x4d4c07['id']},{})[_0xe199('0x2b')](function(){return _0x26ff51;});}else{return _0x26ff51;}})[_0xe199('0x4a')](function(_0x73b6f){logger[_0xe199('0x2f')](_0xe199('0x55'),_0x73b6f);throw _0x73b6f;});}return _0x26ff51;})[_0xe199('0x2b')](respondWithResult(_0x23268f,0xc9))[_0xe199('0x4a')](handleError(_0x23268f,null));};exports[_0xe199('0x56')]=function(_0x4128fe,_0x1634d1){var _0x483eae={'where':{'id':_0x4128fe['params']['id']}},_0x4e8178={};_0x4e8178['model']=_['keys'](db[_0xe199('0x34')]['rawAttributes']);_0x483eae[_0xe199('0x3c')]=_[_0xe199('0x39')](_0x4e8178[_0xe199('0x3a')],qs['fields'](_0x4128fe[_0xe199('0x38')][_0xe199('0x3b')]));_0x483eae[_0xe199('0x3c')]=_0x483eae['attributes'][_0xe199('0x3d')]?_0x483eae[_0xe199('0x3c')]:_0x4e8178[_0xe199('0x3a')];if(_0x4128fe[_0xe199('0x38')][_0xe199('0x47')]){_0x483eae['include']=[{'all':!![]}];}_0x483eae=_['merge']({},_0x483eae,_0x4128fe[_0xe199('0x57')]);return db['Dashboard'][_0xe199('0x4d')](_0x483eae)[_0xe199('0x2b')](handleEntityNotFound(_0x1634d1,null))[_0xe199('0x2b')](function(_0x411dca){if(_0x411dca){var _0x31f7ea=_0x411dca[_0xe199('0x50')]({'plain':!![]});_0x31f7ea=qs[_0xe199('0x58')](_0x31f7ea,['id',_0xe199('0x59'),'updatedAt']);_0x4128fe[_0xe199('0x4e')]=_[_0xe199('0x58')](_0x4128fe[_0xe199('0x4e')],['id',_0xe199('0x59'),_0xe199('0x5a')]);return db[_0xe199('0x34')]['create'](_[_0xe199('0x44')](_0x31f7ea,_0x4128fe[_0xe199('0x4e')]),{'include':_0x4128fe[_0xe199('0x38')][_0xe199('0x47')]?[{'all':!![]}]:undefined})[_0xe199('0x2b')](function(_0x5ddd26){var _0x51a623=_0x4128fe[_0xe199('0x4f')]['get']({'plain':!![]});if(!_0x51a623)throw new Error(_0xe199('0x51'));if(_0x51a623[_0xe199('0x5b')]===_0xe199('0x4f')){var _0x3c61ff=_0x5ddd26[_0xe199('0x50')]({'plain':!![]});var _0x1acb79='CustomDashboards';return db[_0xe199('0x52')][_0xe199('0x4d')]({'where':{'name':_0x1acb79,'userProfileId':_0x51a623[_0xe199('0x5c')]},'raw':!![]})[_0xe199('0x2b')](function(_0x3f0b35){if(_0x3f0b35&&_0x3f0b35['autoAssociation']===0x0){return db[_0xe199('0x2e')]['create']({'name':_0x3c61ff[_0xe199('0x31')],'resourceId':_0x3c61ff['id'],'type':_0x3f0b35[_0xe199('0x31')],'sectionId':_0x3f0b35['id']},{})[_0xe199('0x2b')](function(){return _0x5ddd26;});}else{return _0x5ddd26;}})[_0xe199('0x4a')](function(_0x47a9da){logger[_0xe199('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x47a9da);throw _0x47a9da;});}return _0x5ddd26;});}})[_0xe199('0x2b')](respondWithResult(_0x1634d1,0xc9))[_0xe199('0x4a')](handleError(_0x1634d1,null));};exports[_0xe199('0x5d')]=function(_0x5533e5,_0x5e6c12){if(_0x5533e5[_0xe199('0x4e')]['id']){delete _0x5533e5[_0xe199('0x4e')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x5533e5[_0xe199('0x5e')]['id']}})[_0xe199('0x2b')](handleEntityNotFound(_0x5e6c12,null))[_0xe199('0x2b')](saveUpdates(_0x5533e5[_0xe199('0x4e')],null))[_0xe199('0x2b')](respondWithResult(_0x5e6c12,null))['catch'](handleError(_0x5e6c12,null));};exports[_0xe199('0x2c')]=function(_0x1480ee,_0x51bdc3){return db[_0xe199('0x34')][_0xe199('0x4d')]({'where':{'id':_0x1480ee['params']['id']}})[_0xe199('0x2b')](handleEntityNotFound(_0x51bdc3,null))[_0xe199('0x2b')](removeEntity(_0x51bdc3,null))[_0xe199('0x4a')](handleError(_0x51bdc3,null));};function widgetAttributes(_0x590ad1){try{switch(_0x590ad1[_0xe199('0x45')]){case _0xe199('0x5f'):return[{'name':_0xe199('0x60'),'value':_0x590ad1[_0xe199('0x60')]||(_0x590ad1[_0xe199('0x61')]&&_0x590ad1[_0xe199('0x61')][0x0]?_0x590ad1['attrs'][0x0][_0xe199('0x62')]:undefined)||_0xe199('0x63')}];case'custom':return[{'name':_0xe199('0x64'),'value':_0x590ad1[_0xe199('0x64')]||(_0x590ad1[_0xe199('0x61')]&&_0x590ad1[_0xe199('0x61')][0x0]?_0x590ad1[_0xe199('0x61')][0x0][_0xe199('0x62')]:undefined)||''}];case _0xe199('0x65'):return[{'name':_0xe199('0x66'),'value':_0x590ad1['attrHourFormat']||(_0x590ad1['attrs']&&_0x590ad1[_0xe199('0x61')][0x0]?_0x590ad1[_0xe199('0x61')][0x0][_0xe199('0x62')]:undefined)||_0xe199('0x67')},{'name':_0xe199('0x68'),'value':_0x590ad1[_0xe199('0x68')]||(_0x590ad1[_0xe199('0x61')]&&_0x590ad1['attrs'][0x1]?_0x590ad1[_0xe199('0x61')][0x1][_0xe199('0x62')]:undefined)||_0xe199('0x69')},{'name':_0xe199('0x6a'),'value':_0x590ad1[_0xe199('0x6a')]||(_0x590ad1[_0xe199('0x61')]&&_0x590ad1[_0xe199('0x61')][0x2]?_0x590ad1[_0xe199('0x61')][0x2][_0xe199('0x62')]:undefined)||0xc}];case _0xe199('0x6b'):return[{'name':_0xe199('0x6c'),'value':_0x590ad1[_0xe199('0x6c')]||(_0x590ad1[_0xe199('0x61')]&&_0x590ad1[_0xe199('0x61')][0x0]?_0x590ad1[_0xe199('0x61')][0x0][_0xe199('0x62')]:undefined)||_0xe199('0x6d')},{'name':_0xe199('0x6e'),'value':_0x590ad1['attrVoiceQueues']||(_0x590ad1['attrs']&&_0x590ad1[_0xe199('0x61')][0x1]?_0x590ad1[_0xe199('0x61')][0x1][_0xe199('0x62')]:undefined)||[]},{'name':'attrFontSize','value':_0x590ad1['attrFontSize']||(_0x590ad1[_0xe199('0x61')]&&_0x590ad1[_0xe199('0x61')][0x2]?_0x590ad1[_0xe199('0x61')][0x2]['value']:undefined)||0x14}];case _0xe199('0x6f'):case'pie-chart':return[{'name':'attrSerie1','value':_0x590ad1[_0xe199('0x70')]||(_0x590ad1[_0xe199('0x61')]&&_0x590ad1[_0xe199('0x61')][0x0]?_0x590ad1[_0xe199('0x61')][0x0][_0xe199('0x62')]:undefined)||_0xe199('0x6d')},{'name':_0xe199('0x71'),'value':_0x590ad1['attrSerie2']||(_0x590ad1[_0xe199('0x61')]&&_0x590ad1[_0xe199('0x61')][0x1]?_0x590ad1[_0xe199('0x61')][0x1][_0xe199('0x62')]:undefined)||null},{'name':_0xe199('0x72'),'value':_0x590ad1[_0xe199('0x72')]||(_0x590ad1['attrs']&&_0x590ad1[_0xe199('0x61')][0x2]?_0x590ad1['attrs'][0x2]['value']:undefined)||null},{'name':_0xe199('0x6e'),'value':_0x590ad1[_0xe199('0x6e')]||(_0x590ad1['attrs']&&_0x590ad1[_0xe199('0x61')][0x3]?_0x590ad1[_0xe199('0x61')][0x3][_0xe199('0x62')]:undefined)||[]}];case _0xe199('0x73'):return[{'name':_0xe199('0x74'),'type':_0x590ad1[_0xe199('0x75')]||(_0x590ad1[_0xe199('0x61')]&&_0x590ad1[_0xe199('0x61')][0x0]?_0x590ad1[_0xe199('0x61')][0x0][_0xe199('0x45')]:undefined)||null,'value':_0x590ad1[_0xe199('0x74')]||(_0x590ad1[_0xe199('0x61')]&&_0x590ad1[_0xe199('0x61')][0x0]?_0x590ad1[_0xe199('0x61')][0x0][_0xe199('0x62')]:undefined)||null},{'name':'attrRefresh','value':_0x590ad1[_0xe199('0x76')]||(_0x590ad1[_0xe199('0x61')]&&_0x590ad1[_0xe199('0x61')][0x1]?_0x590ad1[_0xe199('0x61')][0x1][_0xe199('0x62')]:undefined)||0x0}];default:return[];}}catch(_0x1f1d99){logger['error'](_0xe199('0x77'),JSON[_0xe199('0x78')](_0x1f1d99));return[];}}exports[_0xe199('0x79')]=function(_0x145fec,_0x511189,_0x3cb38d){if(_0x145fec['body']['id']){delete _0x145fec['body']['id'];}return db[_0xe199('0x34')][_0xe199('0x4d')]({'where':{'id':_0x145fec[_0xe199('0x5e')]['id']}})['then'](handleEntityNotFound(_0x511189,null))[_0xe199('0x2b')](function(_0x583819){if(_0x583819){_0x145fec[_0xe199('0x4e')][_0xe199('0x7a')]=_0x583819['id'];_0x145fec['body'][_0xe199('0x61')]=widgetAttributes(_0x145fec['body']);return db[_0xe199('0x7b')][_0xe199('0x54')](_0x145fec[_0xe199('0x4e')]);}})[_0xe199('0x2b')](respondWithResult(_0x511189,null))['catch'](handleError(_0x511189,null));};exports[_0xe199('0x7c')]=function(_0x198bd2,_0x12834c,_0x449a0b){var _0x21339a={};var _0x4d64b4={};var _0xb58c2f;var _0x23efa2;return db['Dashboard'][_0xe199('0x7d')]({'where':{'id':_0x198bd2[_0xe199('0x5e')]['id']}})[_0xe199('0x2b')](handleEntityNotFound(_0x12834c,null))['then'](function(_0x5c1197){if(_0x5c1197){_0xb58c2f=_0x5c1197;_0x4d64b4[_0xe199('0x3a')]=_['keys'](db[_0xe199('0x7b')][_0xe199('0x7e')]);_0x4d64b4[_0xe199('0x38')]=_[_0xe199('0x4c')](_0x198bd2['query']);_0x4d64b4[_0xe199('0x42')]=_[_0xe199('0x39')](_0x4d64b4['model'],_0x4d64b4[_0xe199('0x38')]);_0x21339a[_0xe199('0x3c')]=_[_0xe199('0x39')](_0x4d64b4[_0xe199('0x3a')],qs[_0xe199('0x3b')](_0x198bd2[_0xe199('0x38')][_0xe199('0x3b')]));_0x21339a[_0xe199('0x3c')]=_0x21339a[_0xe199('0x3c')]['length']?_0x21339a['attributes']:_0x4d64b4[_0xe199('0x3a')];_0x21339a[_0xe199('0x3f')]=qs[_0xe199('0x40')](_0x198bd2['query'][_0xe199('0x40')]);_0x21339a[_0xe199('0x41')]=qs['filters'](_[_0xe199('0x7f')](_0x198bd2[_0xe199('0x38')],_0x4d64b4[_0xe199('0x42')]));if(_0x198bd2[_0xe199('0x38')][_0xe199('0x43')]){_0x21339a[_0xe199('0x41')]=_[_0xe199('0x44')](_0x21339a[_0xe199('0x41')],{'$or':_['map'](_0x21339a['attributes'],function(_0x3f2189){var _0x12b3df={};_0x12b3df[_0x3f2189]={'$like':'%'+_0x198bd2[_0xe199('0x38')][_0xe199('0x43')]+'%'};return _0x12b3df;})});}_0x21339a=_['merge']({},_0x21339a,_0x198bd2[_0xe199('0x57')]);return _0xb58c2f[_0xe199('0x7c')](_0x21339a);}})[_0xe199('0x2b')](function(_0x13b96b){if(_0x13b96b){_0x23efa2=_0x13b96b[_0xe199('0x3d')];if(!_0x198bd2['query']['hasOwnProperty'](_0xe199('0x80'))){_0x21339a[_0xe199('0x23')]=qs[_0xe199('0x23')](_0x198bd2['query']['limit']);_0x21339a[_0xe199('0x24')]=qs[_0xe199('0x24')](_0x198bd2[_0xe199('0x38')][_0xe199('0x24')]);}return _0xb58c2f[_0xe199('0x7c')](_0x21339a);}})['then'](function(_0x1c369f){if(_0x1c369f){return _0x1c369f?{'count':_0x23efa2,'rows':_0x1c369f}:null;}})[_0xe199('0x2b')](respondWithResult(_0x12834c,null))[_0xe199('0x4a')](handleError(_0x12834c,null));}; \ No newline at end of file +var _0x809c=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','get','CustomDashboards','UserProfileResource','stack','send','index','map','Dashboard','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','catch','params','rawAttributes','includeAll','include','options','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','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','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','stringify','addItem','DashboardItem','getItems','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse'];(function(_0x5515a7,_0x2c4af1){var _0x43f4bf=function(_0x3d519d){while(--_0x3d519d){_0x5515a7['push'](_0x5515a7['shift']());}};_0x43f4bf(++_0x2c4af1);}(_0x809c,0x161));var _0xc809=function(_0xd6db6f,_0x261ecf){_0xd6db6f=_0xd6db6f-0x0;var _0x203141=_0x809c[_0xd6db6f];return _0x203141;};'use strict';var emlformat=require(_0xc809('0x0'));var rimraf=require(_0xc809('0x1'));var zipdir=require(_0xc809('0x2'));var jsonpatch=require(_0xc809('0x3'));var rp=require(_0xc809('0x4'));var moment=require(_0xc809('0x5'));var BPromise=require(_0xc809('0x6'));var Mustache=require(_0xc809('0x7'));var util=require(_0xc809('0x8'));var path=require(_0xc809('0x9'));var sox=require(_0xc809('0xa'));var csv=require(_0xc809('0xb'));var ejs=require(_0xc809('0xc'));var fs=require('fs');var fs_extra=require(_0xc809('0xd'));var _=require(_0xc809('0xe'));var squel=require(_0xc809('0xf'));var crypto=require(_0xc809('0x10'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc809('0xb'));var querystring=require(_0xc809('0x11'));var Papa=require(_0xc809('0x12'));var Redis=require(_0xc809('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xc809('0x14'));var as=require(_0xc809('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc809('0x16'))(_0xc809('0x17'));var utils=require(_0xc809('0x18'));var config=require(_0xc809('0x19'));var licenseUtil=require(_0xc809('0x1a'));var db=require('../../mysqldb')['db'];config[_0xc809('0x1b')]=_['defaults'](config[_0xc809('0x1b')],{'host':_0xc809('0x1c'),'port':0x18eb});var socket=require(_0xc809('0x1d'))(new Redis(config[_0xc809('0x1b')]));require(_0xc809('0x1e'))[_0xc809('0x1f')](socket);function respondWithStatusCode(_0x36b5c6,_0x1b25d2){_0x1b25d2=_0x1b25d2||0xcc;return function(_0x375b55){if(_0x375b55){return _0x36b5c6[_0xc809('0x20')](_0x1b25d2);}return _0x36b5c6['status'](_0x1b25d2)['end']();};}function respondWithResult(_0x147052,_0x1f35e5){_0x1f35e5=_0x1f35e5||0xc8;return function(_0x3a3a56){if(_0x3a3a56){return _0x147052[_0xc809('0x21')](_0x1f35e5)[_0xc809('0x22')](_0x3a3a56);}};}function respondWithFilteredResult(_0x9cfbe8,_0x4b95c3){return function(_0x320bc6){if(_0x320bc6){var _0x18da45=typeof _0x4b95c3['offset']===_0xc809('0x23')&&typeof _0x4b95c3[_0xc809('0x24')]===_0xc809('0x23');var _0x5b2a1d=_0x320bc6[_0xc809('0x25')];var _0x19637e=_0x18da45?0x0:_0x4b95c3[_0xc809('0x26')];var _0x9fa65e=_0x18da45?_0x320bc6[_0xc809('0x25')]:_0x4b95c3[_0xc809('0x26')]+_0x4b95c3['limit'];var _0x311b42;if(_0x9fa65e>=_0x5b2a1d){_0x9fa65e=_0x5b2a1d;_0x311b42=0xc8;}else{_0x311b42=0xce;}_0x9cfbe8[_0xc809('0x21')](_0x311b42);return _0x9cfbe8[_0xc809('0x27')]('Content-Range',_0x19637e+'-'+_0x9fa65e+'/'+_0x5b2a1d)[_0xc809('0x22')](_0x320bc6);}return null;};}function patchUpdates(_0x20ac94){return function(_0x1e37c5){try{jsonpatch[_0xc809('0x28')](_0x1e37c5,_0x20ac94,!![]);}catch(_0x238be7){return BPromise['reject'](_0x238be7);}return _0x1e37c5[_0xc809('0x29')]();};}function saveUpdates(_0x46520a,_0x2e7ee8){return function(_0x3855b0){if(_0x3855b0){return _0x3855b0[_0xc809('0x2a')](_0x46520a)[_0xc809('0x2b')](function(_0x88faa1){return _0x88faa1;});}return null;};}function removeEntity(_0x3dea40,_0x37a4c9){return function(_0x46c9fd){if(_0x46c9fd){return _0x46c9fd[_0xc809('0x2c')]()['then'](function(){var _0x2a1b35=_0x46c9fd[_0xc809('0x2d')]({'plain':!![]});var _0xb39e32=_0xc809('0x2e');return db[_0xc809('0x2f')]['destroy']({'where':{'type':_0xb39e32,'resourceId':_0x2a1b35['id']}})[_0xc809('0x2b')](function(){return _0x46c9fd;});})[_0xc809('0x2b')](function(){_0x3dea40[_0xc809('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bbec1,_0x258a29){return function(_0x57e264){if(!_0x57e264){_0x5bbec1[_0xc809('0x20')](0x194);}return _0x57e264;};}function handleError(_0x5917b1,_0x1681c0){_0x1681c0=_0x1681c0||0x1f4;return function(_0x387d96){logger['error'](_0x387d96[_0xc809('0x30')]);if(_0x387d96['name']){delete _0x387d96['name'];}_0x5917b1['status'](_0x1681c0)[_0xc809('0x31')](_0x387d96);};}exports[_0xc809('0x32')]=function(_0x32b5e2,_0x33afa7){var _0x310031={},_0x309d56={},_0xd241d1={'count':0x0,'rows':[]};var _0x3b47c1=_[_0xc809('0x33')](db[_0xc809('0x34')]['rawAttributes'],function(_0x21032b){return{'name':_0x21032b['fieldName'],'type':_0x21032b[_0xc809('0x35')][_0xc809('0x36')]};});_0x309d56[_0xc809('0x37')]=_[_0xc809('0x33')](_0x3b47c1,_0xc809('0x38'));_0x309d56[_0xc809('0x39')]=_[_0xc809('0x3a')](_0x32b5e2[_0xc809('0x39')]);_0x309d56[_0xc809('0x3b')]=_['intersection'](_0x309d56[_0xc809('0x37')],_0x309d56[_0xc809('0x39')]);_0x310031['attributes']=_[_0xc809('0x3c')](_0x309d56[_0xc809('0x37')],qs['fields'](_0x32b5e2[_0xc809('0x39')][_0xc809('0x3d')]));_0x310031[_0xc809('0x3e')]=_0x310031[_0xc809('0x3e')][_0xc809('0x3f')]?_0x310031['attributes']:_0x309d56[_0xc809('0x37')];if(!_0x32b5e2[_0xc809('0x39')][_0xc809('0x40')](_0xc809('0x41'))){_0x310031[_0xc809('0x24')]=qs[_0xc809('0x24')](_0x32b5e2['query']['limit']);_0x310031[_0xc809('0x26')]=qs['offset'](_0x32b5e2[_0xc809('0x39')][_0xc809('0x26')]);}_0x310031[_0xc809('0x42')]=qs[_0xc809('0x43')](_0x32b5e2[_0xc809('0x39')][_0xc809('0x43')]);_0x310031[_0xc809('0x44')]=qs[_0xc809('0x3b')](_[_0xc809('0x45')](_0x32b5e2[_0xc809('0x39')],_0x309d56[_0xc809('0x3b')]),_0x3b47c1);if(_0x32b5e2['query'][_0xc809('0x46')]){_0x310031[_0xc809('0x44')]=_[_0xc809('0x47')](_0x310031[_0xc809('0x44')],{'$or':_[_0xc809('0x33')](_0x3b47c1,function(_0x272228){if(_0x272228[_0xc809('0x35')]!==_0xc809('0x48')){var _0x5e3308={};_0x5e3308[_0x272228['name']]={'$like':'%'+_0x32b5e2[_0xc809('0x39')][_0xc809('0x46')]+'%'};return _0x5e3308;}})});}_0x310031=_[_0xc809('0x47')]({},_0x310031,_0x32b5e2['options']);var _0x43f8bf={'where':_0x310031[_0xc809('0x44')]};return db[_0xc809('0x34')][_0xc809('0x25')](_0x43f8bf)[_0xc809('0x2b')](function(_0x607391){_0xd241d1[_0xc809('0x25')]=_0x607391;if(_0x32b5e2['query']['includeAll']){_0x310031['include']=[{'all':!![]}];}return db['Dashboard'][_0xc809('0x49')](_0x310031);})['then'](function(_0x23ca11){_0xd241d1[_0xc809('0x4a')]=_0x23ca11;return _0xd241d1;})['then'](respondWithFilteredResult(_0x33afa7,_0x310031))[_0xc809('0x4b')](handleError(_0x33afa7,null));};exports['show']=function(_0x1234d4,_0x10f2d8){var _0x5d0ce6={'raw':![],'where':{'id':_0x1234d4[_0xc809('0x4c')]['id']}},_0x5bc4d0={};_0x5bc4d0[_0xc809('0x37')]=_[_0xc809('0x3a')](db[_0xc809('0x34')][_0xc809('0x4d')]);_0x5bc4d0[_0xc809('0x39')]=_[_0xc809('0x3a')](_0x1234d4['query']);_0x5bc4d0[_0xc809('0x3b')]=_[_0xc809('0x3c')](_0x5bc4d0[_0xc809('0x37')],_0x5bc4d0[_0xc809('0x39')]);_0x5d0ce6[_0xc809('0x3e')]=_['intersection'](_0x5bc4d0[_0xc809('0x37')],qs[_0xc809('0x3d')](_0x1234d4[_0xc809('0x39')]['fields']));_0x5d0ce6[_0xc809('0x3e')]=_0x5d0ce6[_0xc809('0x3e')][_0xc809('0x3f')]?_0x5d0ce6[_0xc809('0x3e')]:_0x5bc4d0[_0xc809('0x37')];if(_0x1234d4[_0xc809('0x39')][_0xc809('0x4e')]){_0x5d0ce6[_0xc809('0x4f')]=[{'all':!![]}];}_0x5d0ce6=_[_0xc809('0x47')]({},_0x5d0ce6,_0x1234d4[_0xc809('0x50')]);return db[_0xc809('0x34')][_0xc809('0x51')](_0x5d0ce6)[_0xc809('0x2b')](handleEntityNotFound(_0x10f2d8,null))[_0xc809('0x2b')](respondWithResult(_0x10f2d8,null))[_0xc809('0x4b')](handleError(_0x10f2d8,null));};exports[_0xc809('0x52')]=function(_0x5dfb08,_0x5a597c){return db[_0xc809('0x34')][_0xc809('0x52')](_0x5dfb08['body'],{})['then'](function(_0x5df006){var _0x13db64=_0x5dfb08[_0xc809('0x53')][_0xc809('0x2d')]({'plain':!![]});if(!_0x13db64)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x13db64[_0xc809('0x54')]===_0xc809('0x53')){var _0x3288d5=_0x5df006[_0xc809('0x2d')]({'plain':!![]});var _0x1ec44a=_0xc809('0x2e');return db[_0xc809('0x55')][_0xc809('0x51')]({'where':{'name':_0x1ec44a,'userProfileId':_0x13db64[_0xc809('0x56')]},'raw':!![]})[_0xc809('0x2b')](function(_0x31c191){if(_0x31c191&&_0x31c191[_0xc809('0x57')]===0x0){return db[_0xc809('0x2f')][_0xc809('0x52')]({'name':_0x3288d5['name'],'resourceId':_0x3288d5['id'],'type':_0x31c191[_0xc809('0x38')],'sectionId':_0x31c191['id']},{})['then'](function(){return _0x5df006;});}else{return _0x5df006;}})[_0xc809('0x4b')](function(_0x5a1bdd){logger[_0xc809('0x58')](_0xc809('0x59'),_0x5a1bdd);throw _0x5a1bdd;});}return _0x5df006;})[_0xc809('0x2b')](respondWithResult(_0x5a597c,0xc9))[_0xc809('0x4b')](handleError(_0x5a597c,null));};exports[_0xc809('0x5a')]=function(_0x397e0b,_0x16acbc){var _0xa0bfe6={'where':{'id':_0x397e0b[_0xc809('0x4c')]['id']}},_0x53e6ac={};_0x53e6ac['model']=_['keys'](db[_0xc809('0x34')][_0xc809('0x4d')]);_0xa0bfe6[_0xc809('0x3e')]=_['intersection'](_0x53e6ac[_0xc809('0x37')],qs[_0xc809('0x3d')](_0x397e0b[_0xc809('0x39')][_0xc809('0x3d')]));_0xa0bfe6[_0xc809('0x3e')]=_0xa0bfe6[_0xc809('0x3e')]['length']?_0xa0bfe6[_0xc809('0x3e')]:_0x53e6ac['model'];if(_0x397e0b[_0xc809('0x39')][_0xc809('0x4e')]){_0xa0bfe6[_0xc809('0x4f')]=[{'all':!![]}];}_0xa0bfe6=_[_0xc809('0x47')]({},_0xa0bfe6,_0x397e0b['options']);return db[_0xc809('0x34')][_0xc809('0x51')](_0xa0bfe6)[_0xc809('0x2b')](handleEntityNotFound(_0x16acbc,null))[_0xc809('0x2b')](function(_0x126631){if(_0x126631){var _0x15802a=_0x126631['get']({'plain':!![]});_0x15802a=qs[_0xc809('0x5b')](_0x15802a,['id',_0xc809('0x5c'),_0xc809('0x5d')]);_0x397e0b[_0xc809('0x5e')]=_[_0xc809('0x5b')](_0x397e0b[_0xc809('0x5e')],['id','createdAt',_0xc809('0x5d')]);return db[_0xc809('0x34')][_0xc809('0x52')](_[_0xc809('0x47')](_0x15802a,_0x397e0b[_0xc809('0x5e')]),{'include':_0x397e0b[_0xc809('0x39')]['includeAll']?[{'all':!![]}]:undefined})[_0xc809('0x2b')](function(_0x35182f){var _0x49cdcd=_0x397e0b[_0xc809('0x53')][_0xc809('0x2d')]({'plain':!![]});if(!_0x49cdcd)throw new Error(_0xc809('0x5f'));if(_0x49cdcd['role']===_0xc809('0x53')){var _0x439fac=_0x35182f[_0xc809('0x2d')]({'plain':!![]});var _0x2ea458='CustomDashboards';return db[_0xc809('0x55')][_0xc809('0x51')]({'where':{'name':_0x2ea458,'userProfileId':_0x49cdcd['userProfileId']},'raw':!![]})[_0xc809('0x2b')](function(_0x36b251){if(_0x36b251&&_0x36b251['autoAssociation']===0x0){return db[_0xc809('0x2f')][_0xc809('0x52')]({'name':_0x439fac[_0xc809('0x38')],'resourceId':_0x439fac['id'],'type':_0x36b251['name'],'sectionId':_0x36b251['id']},{})[_0xc809('0x2b')](function(){return _0x35182f;});}else{return _0x35182f;}})[_0xc809('0x4b')](function(_0x25ce3c){logger[_0xc809('0x58')](_0xc809('0x59'),_0x25ce3c);throw _0x25ce3c;});}return _0x35182f;});}})[_0xc809('0x2b')](respondWithResult(_0x16acbc,0xc9))[_0xc809('0x4b')](handleError(_0x16acbc,null));};exports[_0xc809('0x2a')]=function(_0x17b94d,_0x4471d3){if(_0x17b94d[_0xc809('0x5e')]['id']){delete _0x17b94d['body']['id'];}return db[_0xc809('0x34')][_0xc809('0x51')]({'where':{'id':_0x17b94d[_0xc809('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4471d3,null))[_0xc809('0x2b')](saveUpdates(_0x17b94d[_0xc809('0x5e')],null))[_0xc809('0x2b')](respondWithResult(_0x4471d3,null))[_0xc809('0x4b')](handleError(_0x4471d3,null));};exports[_0xc809('0x2c')]=function(_0x57180a,_0x74bec7){return db[_0xc809('0x34')]['find']({'where':{'id':_0x57180a[_0xc809('0x4c')]['id']}})[_0xc809('0x2b')](handleEntityNotFound(_0x74bec7,null))[_0xc809('0x2b')](removeEntity(_0x74bec7,null))[_0xc809('0x4b')](handleError(_0x74bec7,null));};function widgetAttributes(_0x5434db){try{switch(_0x5434db['type']){case'iframe':return[{'name':_0xc809('0x60'),'value':_0x5434db[_0xc809('0x60')]||(_0x5434db[_0xc809('0x61')]&&_0x5434db[_0xc809('0x61')][0x0]?_0x5434db['attrs'][0x0][_0xc809('0x62')]:undefined)||_0xc809('0x63')}];case _0xc809('0x64'):return[{'name':_0xc809('0x65'),'value':_0x5434db[_0xc809('0x65')]||(_0x5434db[_0xc809('0x61')]&&_0x5434db[_0xc809('0x61')][0x0]?_0x5434db['attrs'][0x0][_0xc809('0x62')]:undefined)||''}];case _0xc809('0x66'):return[{'name':'attrHourFormat','value':_0x5434db[_0xc809('0x67')]||(_0x5434db[_0xc809('0x61')]&&_0x5434db['attrs'][0x0]?_0x5434db[_0xc809('0x61')][0x0][_0xc809('0x62')]:undefined)||_0xc809('0x68')},{'name':_0xc809('0x69'),'value':_0x5434db[_0xc809('0x69')]||(_0x5434db['attrs']&&_0x5434db[_0xc809('0x61')][0x1]?_0x5434db[_0xc809('0x61')][0x1][_0xc809('0x62')]:undefined)||_0xc809('0x6a')},{'name':_0xc809('0x6b'),'value':_0x5434db[_0xc809('0x6b')]||(_0x5434db[_0xc809('0x61')]&&_0x5434db[_0xc809('0x61')][0x2]?_0x5434db[_0xc809('0x61')][0x2]['value']:undefined)||0xc}];case _0xc809('0x6c'):return[{'name':_0xc809('0x6d'),'value':_0x5434db[_0xc809('0x6d')]||(_0x5434db[_0xc809('0x61')]&&_0x5434db[_0xc809('0x61')][0x0]?_0x5434db[_0xc809('0x61')][0x0]['value']:undefined)||_0xc809('0x6e')},{'name':'attrVoiceQueues','value':_0x5434db[_0xc809('0x6f')]||(_0x5434db['attrs']&&_0x5434db[_0xc809('0x61')][0x1]?_0x5434db[_0xc809('0x61')][0x1]['value']:undefined)||[]},{'name':_0xc809('0x6b'),'value':_0x5434db[_0xc809('0x6b')]||(_0x5434db[_0xc809('0x61')]&&_0x5434db['attrs'][0x2]?_0x5434db['attrs'][0x2][_0xc809('0x62')]:undefined)||0x14}];case _0xc809('0x70'):case _0xc809('0x71'):return[{'name':_0xc809('0x72'),'value':_0x5434db[_0xc809('0x72')]||(_0x5434db['attrs']&&_0x5434db['attrs'][0x0]?_0x5434db[_0xc809('0x61')][0x0]['value']:undefined)||'total'},{'name':'attrSerie2','value':_0x5434db[_0xc809('0x73')]||(_0x5434db[_0xc809('0x61')]&&_0x5434db['attrs'][0x1]?_0x5434db[_0xc809('0x61')][0x1][_0xc809('0x62')]:undefined)||null},{'name':_0xc809('0x74'),'value':_0x5434db[_0xc809('0x74')]||(_0x5434db['attrs']&&_0x5434db['attrs'][0x2]?_0x5434db[_0xc809('0x61')][0x2][_0xc809('0x62')]:undefined)||null},{'name':_0xc809('0x6f'),'value':_0x5434db[_0xc809('0x6f')]||(_0x5434db[_0xc809('0x61')]&&_0x5434db[_0xc809('0x61')][0x3]?_0x5434db[_0xc809('0x61')][0x3]['value']:undefined)||[]}];case _0xc809('0x75'):return[{'name':'attrReport','type':_0x5434db['reportType']||(_0x5434db[_0xc809('0x61')]&&_0x5434db[_0xc809('0x61')][0x0]?_0x5434db[_0xc809('0x61')][0x0]['type']:undefined)||null,'value':_0x5434db[_0xc809('0x76')]||(_0x5434db['attrs']&&_0x5434db['attrs'][0x0]?_0x5434db[_0xc809('0x61')][0x0][_0xc809('0x62')]:undefined)||null},{'name':_0xc809('0x77'),'value':_0x5434db[_0xc809('0x77')]||(_0x5434db[_0xc809('0x61')]&&_0x5434db[_0xc809('0x61')][0x1]?_0x5434db['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x41884b){logger[_0xc809('0x58')]('widgetAttributes:\x20%s',JSON[_0xc809('0x78')](_0x41884b));return[];}}exports[_0xc809('0x79')]=function(_0x5988a5,_0x1544ec,_0x3f31f8){if(_0x5988a5[_0xc809('0x5e')]['id']){delete _0x5988a5[_0xc809('0x5e')]['id'];}return db[_0xc809('0x34')][_0xc809('0x51')]({'where':{'id':_0x5988a5['params']['id']}})[_0xc809('0x2b')](handleEntityNotFound(_0x1544ec,null))[_0xc809('0x2b')](function(_0x255188){if(_0x255188){_0x5988a5['body']['DashboardId']=_0x255188['id'];_0x5988a5['body'][_0xc809('0x61')]=widgetAttributes(_0x5988a5[_0xc809('0x5e')]);return db[_0xc809('0x7a')]['create'](_0x5988a5[_0xc809('0x5e')]);}})[_0xc809('0x2b')](respondWithResult(_0x1544ec,null))[_0xc809('0x4b')](handleError(_0x1544ec,null));};exports[_0xc809('0x7b')]=function(_0x1b0897,_0x4506f6,_0x22713a){var _0x25fd0d={};var _0x33ae02={};var _0x10ed6f;var _0x505434;return db['Dashboard']['findOne']({'where':{'id':_0x1b0897[_0xc809('0x4c')]['id']}})[_0xc809('0x2b')](handleEntityNotFound(_0x4506f6,null))[_0xc809('0x2b')](function(_0x4f7fe4){if(_0x4f7fe4){_0x10ed6f=_0x4f7fe4;_0x33ae02[_0xc809('0x37')]=_[_0xc809('0x3a')](db[_0xc809('0x7a')][_0xc809('0x4d')]);_0x33ae02[_0xc809('0x39')]=_[_0xc809('0x3a')](_0x1b0897[_0xc809('0x39')]);_0x33ae02[_0xc809('0x3b')]=_[_0xc809('0x3c')](_0x33ae02[_0xc809('0x37')],_0x33ae02[_0xc809('0x39')]);_0x25fd0d[_0xc809('0x3e')]=_['intersection'](_0x33ae02[_0xc809('0x37')],qs['fields'](_0x1b0897['query'][_0xc809('0x3d')]));_0x25fd0d[_0xc809('0x3e')]=_0x25fd0d[_0xc809('0x3e')][_0xc809('0x3f')]?_0x25fd0d[_0xc809('0x3e')]:_0x33ae02[_0xc809('0x37')];_0x25fd0d[_0xc809('0x42')]=qs['sort'](_0x1b0897[_0xc809('0x39')][_0xc809('0x43')]);_0x25fd0d[_0xc809('0x44')]=qs[_0xc809('0x3b')](_[_0xc809('0x45')](_0x1b0897['query'],_0x33ae02[_0xc809('0x3b')]));if(_0x1b0897['query'][_0xc809('0x46')]){_0x25fd0d[_0xc809('0x44')]=_[_0xc809('0x47')](_0x25fd0d['where'],{'$or':_['map'](_0x25fd0d[_0xc809('0x3e')],function(_0x2cdc21){var _0x2d906e={};_0x2d906e[_0x2cdc21]={'$like':'%'+_0x1b0897[_0xc809('0x39')]['filter']+'%'};return _0x2d906e;})});}_0x25fd0d=_[_0xc809('0x47')]({},_0x25fd0d,_0x1b0897['options']);return _0x10ed6f[_0xc809('0x7b')](_0x25fd0d);}})[_0xc809('0x2b')](function(_0xd769cc){if(_0xd769cc){_0x505434=_0xd769cc[_0xc809('0x3f')];if(!_0x1b0897[_0xc809('0x39')][_0xc809('0x40')](_0xc809('0x41'))){_0x25fd0d[_0xc809('0x24')]=qs[_0xc809('0x24')](_0x1b0897[_0xc809('0x39')][_0xc809('0x24')]);_0x25fd0d[_0xc809('0x26')]=qs[_0xc809('0x26')](_0x1b0897['query'][_0xc809('0x26')]);}return _0x10ed6f[_0xc809('0x7b')](_0x25fd0d);}})[_0xc809('0x2b')](function(_0x555b19){if(_0x555b19){return _0x555b19?{'count':_0x505434,'rows':_0x555b19}:null;}})[_0xc809('0x2b')](respondWithResult(_0x4506f6,null))[_0xc809('0x4b')](handleError(_0x4506f6,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 1d2bd4f..5c0619a 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 _0x5557=['hook','exports','events','Dashboard','save','update','emit','hasOwnProperty'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5557,0x1ba));var _0x7555=function(_0x4e536b,_0x4719dc){_0x4e536b=_0x4e536b-0x0;var _0x15d06e=_0x5557[_0x4e536b];return _0x15d06e;};'use strict';var EventEmitter=require(_0x7555('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x7555('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7555('0x2'),'afterUpdate':_0x7555('0x3'),'afterDestroy':'remove'};function emitEvent(_0x150e74){return function(_0x5dd156,_0x2d0ded,_0x4679ca){DashboardEvents[_0x7555('0x4')](_0x150e74+':'+_0x5dd156['id'],_0x5dd156);DashboardEvents[_0x7555('0x4')](_0x150e74,_0x5dd156);_0x4679ca(null);};}for(var e in events){if(events[_0x7555('0x5')](e)){var event=events[e];Dashboard[_0x7555('0x6')](e,emitEvent(event));}}module[_0x7555('0x7')]=DashboardEvents; \ No newline at end of file +var _0xc22d=['events','Dashboard','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x30819e,_0x442419){var _0x1d1492=function(_0x19120e){while(--_0x19120e){_0x30819e['push'](_0x30819e['shift']());}};_0x1d1492(++_0x442419);}(_0xc22d,0xa8));var _0xdc22=function(_0x5844ca,_0x4ea469){_0x5844ca=_0x5844ca-0x0;var _0x14e4c8=_0xc22d[_0x5844ca];return _0x14e4c8;};'use strict';var EventEmitter=require(_0xdc22('0x0'));var Dashboard=require('../../mysqldb')['db'][_0xdc22('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdc22('0x2'),'afterUpdate':'update','afterDestroy':_0xdc22('0x3')};function emitEvent(_0xc3f9c8){return function(_0x49383c,_0x517716,_0x44e3e2){DashboardEvents[_0xdc22('0x4')](_0xc3f9c8+':'+_0x49383c['id'],_0x49383c);DashboardEvents[_0xdc22('0x4')](_0xc3f9c8,_0x49383c);_0x44e3e2(null);};}for(var e in events){if(events[_0xdc22('0x5')](e)){var event=events[e];Dashboard[_0xdc22('0x6')](e,emitEvent(event));}}module[_0xdc22('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 4e2f102..92c05ec 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 _0xe74c=['exports','define','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x32729c,_0xf5afd8){var _0x482cfd=function(_0x231471){while(--_0x231471){_0x32729c['push'](_0x32729c['shift']());}};_0x482cfd(++_0xf5afd8);}(_0xe74c,0xf2));var _0xce74=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xe74c[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0xce74('0x0'));var util=require(_0xce74('0x1'));var logger=require(_0xce74('0x2'))(_0xce74('0x3'));var moment=require('moment');var BPromise=require(_0xce74('0x4'));var rp=require(_0xce74('0x5'));var fs=require('fs');var path=require(_0xce74('0x6'));var rimraf=require(_0xce74('0x7'));var config=require('../../config/environment');var attributes=require('./dashboard.attributes');module[_0xce74('0x8')]=function(_0x2b83cc,_0x5cbde5){return _0x2b83cc[_0xce74('0x9')]('Dashboard',attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd04=['moment','bluebird','path','rimraf','../../config/environment','./dashboard.attributes','exports','Dashboard','lodash','../../config/logger','api'];(function(_0xa28795,_0x472cf){var _0x4df4b4=function(_0x24b508){while(--_0x24b508){_0xa28795['push'](_0xa28795['shift']());}};_0x4df4b4(++_0x472cf);}(_0xcd04,0x110));var _0x4cd0=function(_0x5b0753,_0x1f2ac8){_0x5b0753=_0x5b0753-0x0;var _0x203533=_0xcd04[_0x5b0753];return _0x203533;};'use strict';var _=require(_0x4cd0('0x0'));var util=require('util');var logger=require(_0x4cd0('0x1'))(_0x4cd0('0x2'));var moment=require(_0x4cd0('0x3'));var BPromise=require(_0x4cd0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4cd0('0x5'));var rimraf=require(_0x4cd0('0x6'));var config=require(_0x4cd0('0x7'));var attributes=require(_0x4cd0('0x8'));module[_0x4cd0('0x9')]=function(_0x50d7cb,_0x506788){return _0x50d7cb['define'](_0x4cd0('0xa'),attributes,{'tableName':'dashboards','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 693d4f8..4dcbbc5 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 _0xbda1=['debug','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','redis','localhost','socket.io-emitter','./dashboard.socket','register','request','then','Dashboard,\x20%s,\x20%s','request\x20sent'];(function(_0x102941,_0x3673e3){var _0x3bbe17=function(_0x514396){while(--_0x514396){_0x102941['push'](_0x102941['shift']());}};_0x3bbe17(++_0x3673e3);}(_0xbda1,0x133));var _0x1bda=function(_0x282b49,_0x4bb118){_0x282b49=_0x282b49-0x0;var _0x1e4746=_0xbda1[_0x282b49];return _0x1e4746;};'use strict';var _=require('lodash');var util=require(_0x1bda('0x0'));var moment=require(_0x1bda('0x1'));var BPromise=require(_0x1bda('0x2'));var rs=require(_0x1bda('0x3'));var fs=require('fs');var Redis=require(_0x1bda('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1bda('0x5'));var logger=require(_0x1bda('0x6'))('rpc');var config=require(_0x1bda('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1bda('0x8')]['http']({'port':0x232a});config[_0x1bda('0x9')]=_['defaults'](config[_0x1bda('0x9')],{'host':_0x1bda('0xa'),'port':0x18eb});var socket=require(_0x1bda('0xb'))(new Redis(config[_0x1bda('0x9')]));require(_0x1bda('0xc'))[_0x1bda('0xd')](socket);function respondWithRpcPromise(_0x59ba1b,_0x500687,_0x522d68){return new BPromise(function(_0x1bc96a,_0x49e3f0){return client[_0x1bda('0xe')](_0x59ba1b,_0x522d68)[_0x1bda('0xf')](function(_0x264459){logger['info'](_0x1bda('0x10'),_0x500687,_0x1bda('0x11'));logger[_0x1bda('0x12')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x500687,_0x1bda('0x11'),JSON[_0x1bda('0x13')](_0x264459));if(_0x264459[_0x1bda('0x14')]){if(_0x264459[_0x1bda('0x14')][_0x1bda('0x15')]===0x1f4){logger[_0x1bda('0x14')](_0x1bda('0x10'),_0x500687,_0x264459['error'][_0x1bda('0x16')]);return _0x49e3f0(_0x264459[_0x1bda('0x14')][_0x1bda('0x16')]);}logger[_0x1bda('0x14')]('Dashboard,\x20%s,\x20%s',_0x500687,_0x264459[_0x1bda('0x14')]['message']);return _0x1bc96a(_0x264459[_0x1bda('0x14')][_0x1bda('0x16')]);}else{logger['info'](_0x1bda('0x10'),_0x500687,_0x1bda('0x11'));_0x1bc96a(_0x264459[_0x1bda('0x17')][_0x1bda('0x16')]);}})[_0x1bda('0x18')](function(_0x33e129){logger[_0x1bda('0x14')]('Dashboard,\x20%s,\x20%s',_0x500687,_0x33e129);_0x49e3f0(_0x33e129);});});} \ No newline at end of file +var _0x8089=['../../config/environment','jayson/promise','client','redis','defaults','localhost','./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x568f6a,_0x23f870){var _0x1b6117=function(_0x4b5177){while(--_0x4b5177){_0x568f6a['push'](_0x568f6a['shift']());}};_0x1b6117(++_0x23f870);}(_0x8089,0x1c2));var _0x9808=function(_0xf61220,_0x68af27){_0xf61220=_0xf61220-0x0;var _0x24da8a=_0x8089[_0xf61220];return _0x24da8a;};'use strict';var _=require(_0x9808('0x0'));var util=require(_0x9808('0x1'));var moment=require(_0x9808('0x2'));var BPromise=require(_0x9808('0x3'));var rs=require(_0x9808('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9808('0x5'))['db'];var utils=require(_0x9808('0x6'));var logger=require(_0x9808('0x7'))(_0x9808('0x8'));var config=require(_0x9808('0x9'));var jayson=require(_0x9808('0xa'));var client=jayson[_0x9808('0xb')]['http']({'port':0x232a});config[_0x9808('0xc')]=_[_0x9808('0xd')](config['redis'],{'host':_0x9808('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9808('0xc')]));require(_0x9808('0xf'))['register'](socket);function respondWithRpcPromise(_0x1aa057,_0x5b8cbe,_0x3d52f9){return new BPromise(function(_0x353488,_0x50f17b){return client[_0x9808('0x10')](_0x1aa057,_0x3d52f9)[_0x9808('0x11')](function(_0x10195a){logger[_0x9808('0x12')](_0x9808('0x13'),_0x5b8cbe,_0x9808('0x14'));logger[_0x9808('0x15')](_0x9808('0x16'),_0x5b8cbe,_0x9808('0x14'),JSON[_0x9808('0x17')](_0x10195a));if(_0x10195a[_0x9808('0x18')]){if(_0x10195a[_0x9808('0x18')]['code']===0x1f4){logger[_0x9808('0x18')](_0x9808('0x13'),_0x5b8cbe,_0x10195a[_0x9808('0x18')][_0x9808('0x19')]);return _0x50f17b(_0x10195a['error'][_0x9808('0x19')]);}logger[_0x9808('0x18')](_0x9808('0x13'),_0x5b8cbe,_0x10195a[_0x9808('0x18')]['message']);return _0x353488(_0x10195a[_0x9808('0x18')][_0x9808('0x19')]);}else{logger['info'](_0x9808('0x13'),_0x5b8cbe,'request\x20sent');_0x353488(_0x10195a['result'][_0x9808('0x19')]);}})[_0x9808('0x1a')](function(_0x284ae8){logger[_0x9808('0x18')](_0x9808('0x13'),_0x5b8cbe,_0x284ae8);_0x50f17b(_0x284ae8);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 72cc244..b3cc38c 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 _0xd242=['register','./dashboard.events','save','remove','update','removeListener'];(function(_0x48084f,_0x2d1e50){var _0x215480=function(_0x3662ef){while(--_0x3662ef){_0x48084f['push'](_0x48084f['shift']());}};_0x215480(++_0x2d1e50);}(_0xd242,0x8b));var _0x2d24=function(_0x5782a3,_0x2d54f3){_0x5782a3=_0x5782a3-0x0;var _0x5dcae1=_0xd242[_0x5782a3];return _0x5dcae1;};'use strict';var DashboardEvents=require(_0x2d24('0x0'));var events=[_0x2d24('0x1'),_0x2d24('0x2'),_0x2d24('0x3')];function createListener(_0x42d7c0,_0x7abadc){return function(_0x5a0def){_0x7abadc['emit'](_0x42d7c0,_0x5a0def);};}function removeListener(_0x154271,_0x334621){return function(){DashboardEvents[_0x2d24('0x4')](_0x154271,_0x334621);};}exports[_0x2d24('0x5')]=function(_0x5b84c0){for(var _0x53c0a6=0x0,_0x56786a=events['length'];_0x53c0a6<_0x56786a;_0x53c0a6++){var _0xeba684=events[_0x53c0a6];var _0x450390=createListener('dashboard:'+_0xeba684,_0x5b84c0);DashboardEvents['on'](_0xeba684,_0x450390);}}; \ No newline at end of file +var _0x3cb6=['remove','update','removeListener','register','length','dashboard:','./dashboard.events'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x3cb6,0x148));var _0x63cb=function(_0x8e47d6,_0x5dd331){_0x8e47d6=_0x8e47d6-0x0;var _0x161a7c=_0x3cb6[_0x8e47d6];return _0x161a7c;};'use strict';var DashboardEvents=require(_0x63cb('0x0'));var events=['save',_0x63cb('0x1'),_0x63cb('0x2')];function createListener(_0x1eb77a,_0x282cf2){return function(_0x41416a){_0x282cf2['emit'](_0x1eb77a,_0x41416a);};}function removeListener(_0x5114f2,_0x4367a7){return function(){DashboardEvents[_0x63cb('0x3')](_0x5114f2,_0x4367a7);};}exports[_0x63cb('0x4')]=function(_0x7557dd){for(var _0x2871fc=0x0,_0x4763d1=events[_0x63cb('0x5')];_0x2871fc<_0x4763d1;_0x2871fc++){var _0x149fd1=events[_0x2871fc];var _0x50625e=createListener(_0x63cb('0x6')+_0x149fd1,_0x7557dd);DashboardEvents['on'](_0x149fd1,_0x50625e);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 9bf2580..5c6d9a8 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 _0xb854=['put','update','delete','destroy','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','getItems','create','post','/:id/clone','/:id/items','addItem'];(function(_0x16024e,_0x403f12){var _0x252d3e=function(_0x8a699d){while(--_0x8a699d){_0x16024e['push'](_0x16024e['shift']());}};_0x252d3e(++_0x403f12);}(_0xb854,0x1a3));var _0x4b85=function(_0x51747d,_0x33e1bf){_0x51747d=_0x51747d-0x0;var _0x2f374d=_0xb854[_0x51747d];return _0x2f374d;};'use strict';var multer=require(_0x4b85('0x0'));var util=require('util');var path=require(_0x4b85('0x1'));var timeout=require('connect-timeout');var express=require(_0x4b85('0x2'));var router=express[_0x4b85('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4b85('0x4'));var config=require(_0x4b85('0x5'));var controller=require(_0x4b85('0x6'));router[_0x4b85('0x7')]('/',auth[_0x4b85('0x8')](),controller[_0x4b85('0x9')]);router[_0x4b85('0x7')](_0x4b85('0xa'),auth[_0x4b85('0x8')](),controller[_0x4b85('0xb')]);router['get']('/:id/items',auth[_0x4b85('0x8')](),controller[_0x4b85('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4b85('0xd')]);router[_0x4b85('0xe')](_0x4b85('0xf'),auth[_0x4b85('0x8')](),controller['clone']);router[_0x4b85('0xe')](_0x4b85('0x10'),auth[_0x4b85('0x8')](),controller[_0x4b85('0x11')]);router[_0x4b85('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x4b85('0x13')]);router[_0x4b85('0x14')](_0x4b85('0xa'),auth['isAuthenticated'](),controller[_0x4b85('0x15')]);module[_0x4b85('0x16')]=router; \ No newline at end of file +var _0x56ee=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','/:id','show','/:id/items','post','/:id/clone','clone','addItem','destroy','exports','multer'];(function(_0x9b6a52,_0x3cb0ab){var _0x5c5c6f=function(_0x439987){while(--_0x439987){_0x9b6a52['push'](_0x9b6a52['shift']());}};_0x5c5c6f(++_0x3cb0ab);}(_0x56ee,0x168));var _0xe56e=function(_0x3ef4f1,_0x5f0f9b){_0x3ef4f1=_0x3ef4f1-0x0;var _0x69953c=_0x56ee[_0x3ef4f1];return _0x69953c;};'use strict';var multer=require(_0xe56e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe56e('0x1'));var express=require(_0xe56e('0x2'));var router=express[_0xe56e('0x3')]();var fs_extra=require(_0xe56e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe56e('0x5'));var config=require(_0xe56e('0x6'));var controller=require(_0xe56e('0x7'));router[_0xe56e('0x8')]('/',auth[_0xe56e('0x9')](),controller['index']);router['get'](_0xe56e('0xa'),auth[_0xe56e('0x9')](),controller[_0xe56e('0xb')]);router[_0xe56e('0x8')](_0xe56e('0xc'),auth[_0xe56e('0x9')](),controller['getItems']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xe56e('0xd')](_0xe56e('0xe'),auth['isAuthenticated'](),controller[_0xe56e('0xf')]);router[_0xe56e('0xd')](_0xe56e('0xc'),auth[_0xe56e('0x9')](),controller[_0xe56e('0x10')]);router['put'](_0xe56e('0xa'),auth[_0xe56e('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe56e('0x11')]);module[_0xe56e('0x12')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 0633efc..1acbe86 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 _0x1623=['attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','exports','STRING','TEXT','long'];(function(_0x1b92a6,_0x14444b){var _0x24be5b=function(_0x3a5fb5){while(--_0x3a5fb5){_0x1b92a6['push'](_0x1b92a6['shift']());}};_0x24be5b(++_0x14444b);}(_0x1623,0xab));var _0x3162=function(_0x2dbd07,_0xccfdd0){_0x2dbd07=_0x2dbd07-0x0;var _0xea9f56=_0x1623[_0x2dbd07];return _0xea9f56;};'use strict';var Sequelize=require(_0x3162('0x0'));var squel=require('squel');var _=require('lodash');module[_0x3162('0x1')]={'title':{'type':Sequelize[_0x3162('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3162('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x3162('0x3')](_0x3162('0x4')),'get':function(){try{return JSON['parse'](this['getDataValue'](_0x3162('0x5')));}catch(_0x4b77c4){return[];}},'set':function(_0x1b55f2){try{this[_0x3162('0x6')]('attrs',JSON[_0x3162('0x7')](_0x1b55f2));}catch(_0x2dc07e){this[_0x3162('0x6')](_0x3162('0x5'),JSON[_0x3162('0x7')]([]));}}},'sizeX':{'type':Sequelize[_0x3162('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x3162('0x8')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x3162('0x8')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3162('0x9'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x3162('0x2')],'allowNull':![],'defaultValue':_0x3162('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x3162('0x2')]},'titleFontSize':{'type':Sequelize[_0x3162('0x8')],'defaultValue':0xc}}; \ No newline at end of file +var _0x4819=['long','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff','#2196f3','squel','lodash','exports','STRING','TEXT'];(function(_0x1bf2af,_0x4072bd){var _0x54957e=function(_0x5aa2d0){while(--_0x5aa2d0){_0x1bf2af['push'](_0x1bf2af['shift']());}};_0x54957e(++_0x4072bd);}(_0x4819,0xcd));var _0x9481=function(_0x3250f7,_0x1c2afc){_0x3250f7=_0x3250f7-0x0;var _0xdb6ac4=_0x4819[_0x3250f7];return _0xdb6ac4;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x9481('0x0'));var _=require(_0x9481('0x1'));module[_0x9481('0x2')]={'title':{'type':Sequelize[_0x9481('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x9481('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x9481('0x4')](_0x9481('0x5')),'get':function(){try{return JSON[_0x9481('0x6')](this[_0x9481('0x7')](_0x9481('0x8')));}catch(_0x5ac51c){return[];}},'set':function(_0x4d9e3a){try{this['setDataValue']('attrs',JSON[_0x9481('0x9')](_0x4d9e3a));}catch(_0x6c6a08){this[_0x9481('0xa')](_0x9481('0x8'),JSON[_0x9481('0x9')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x9481('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x9481('0xb')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9481('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x9481('0x3')],'allowNull':![],'defaultValue':_0x9481('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x9481('0x3')]},'titleFontSize':{'type':Sequelize[_0x9481('0xb')],'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 eea2275..7e463e2 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 _0xccd7=['type','iframe','attrUrl','attrs','value','attrPath','clock','attrHourFormat','HH:mm:ss','0.00','attrFontSize','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','widgetAttributes:\x20%s','stringify','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./dashboardItem.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','show','params','model','rawAttributes','keys','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','DashboardItem','catch','find'];(function(_0x1c5206,_0x1cfa0f){var _0x1ce95e=function(_0x54ed27){while(--_0x54ed27){_0x1c5206['push'](_0x1c5206['shift']());}};_0x1ce95e(++_0x1cfa0f);}(_0xccd7,0x75));var _0x7ccd=function(_0x240261,_0x4fe66c){_0x240261=_0x240261-0x0;var _0x45c332=_0xccd7[_0x240261];return _0x45c332;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7ccd('0x0'));var zipdir=require(_0x7ccd('0x1'));var jsonpatch=require(_0x7ccd('0x2'));var rp=require(_0x7ccd('0x3'));var moment=require(_0x7ccd('0x4'));var BPromise=require(_0x7ccd('0x5'));var Mustache=require(_0x7ccd('0x6'));var util=require(_0x7ccd('0x7'));var path=require('path');var sox=require(_0x7ccd('0x8'));var csv=require('to-csv');var ejs=require(_0x7ccd('0x9'));var fs=require('fs');var fs_extra=require(_0x7ccd('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7ccd('0xb'));var deskjs=require(_0x7ccd('0xc'));var toCsv=require(_0x7ccd('0xd'));var querystring=require(_0x7ccd('0xe'));var Papa=require(_0x7ccd('0xf'));var Redis=require(_0x7ccd('0x10'));var authService=require(_0x7ccd('0x11'));var qs=require(_0x7ccd('0x12'));var as=require(_0x7ccd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7ccd('0x14'))(_0x7ccd('0x15'));var utils=require(_0x7ccd('0x16'));var config=require(_0x7ccd('0x17'));var licenseUtil=require(_0x7ccd('0x18'));var db=require(_0x7ccd('0x19'))['db'];config['redis']=_[_0x7ccd('0x1a')](config[_0x7ccd('0x1b')],{'host':_0x7ccd('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7ccd('0x1b')]));require(_0x7ccd('0x1d'))[_0x7ccd('0x1e')](socket);function respondWithStatusCode(_0x420af8,_0x9012c2){_0x9012c2=_0x9012c2||0xcc;return function(_0x535997){if(_0x535997){return _0x420af8[_0x7ccd('0x1f')](_0x9012c2);}return _0x420af8[_0x7ccd('0x20')](_0x9012c2)[_0x7ccd('0x21')]();};}function respondWithResult(_0x552757,_0x4ce678){_0x4ce678=_0x4ce678||0xc8;return function(_0x25b6af){if(_0x25b6af){return _0x552757[_0x7ccd('0x20')](_0x4ce678)[_0x7ccd('0x22')](_0x25b6af);}};}function respondWithFilteredResult(_0x225321,_0x14141c){return function(_0x1d307c){if(_0x1d307c){var _0x4a0d97=typeof _0x14141c[_0x7ccd('0x23')]===_0x7ccd('0x24')&&typeof _0x14141c[_0x7ccd('0x25')]==='undefined';var _0x1f913b=_0x1d307c['count'];var _0x502c29=_0x4a0d97?0x0:_0x14141c[_0x7ccd('0x23')];var _0x51dd56=_0x4a0d97?_0x1d307c[_0x7ccd('0x26')]:_0x14141c[_0x7ccd('0x23')]+_0x14141c[_0x7ccd('0x25')];var _0x4928bd;if(_0x51dd56>=_0x1f913b){_0x51dd56=_0x1f913b;_0x4928bd=0xc8;}else{_0x4928bd=0xce;}_0x225321[_0x7ccd('0x20')](_0x4928bd);return _0x225321['set'](_0x7ccd('0x27'),_0x502c29+'-'+_0x51dd56+'/'+_0x1f913b)['json'](_0x1d307c);}return null;};}function patchUpdates(_0x4f1d88){return function(_0x4057e4){try{jsonpatch[_0x7ccd('0x28')](_0x4057e4,_0x4f1d88,!![]);}catch(_0x5293e6){return BPromise[_0x7ccd('0x29')](_0x5293e6);}return _0x4057e4[_0x7ccd('0x2a')]();};}function saveUpdates(_0xa9edc2,_0x389ed6){return function(_0x11232a){if(_0x11232a){return _0x11232a[_0x7ccd('0x2b')](_0xa9edc2)[_0x7ccd('0x2c')](function(_0x2cf31){return _0x2cf31;});}return null;};}function removeEntity(_0x24dbb0,_0x148480){return function(_0x20bab0){if(_0x20bab0){return _0x20bab0[_0x7ccd('0x2d')]()[_0x7ccd('0x2c')](function(){_0x24dbb0['status'](0xcc)[_0x7ccd('0x21')]();});}};}function handleEntityNotFound(_0x3aeb50,_0x7467de){return function(_0x4976ef){if(!_0x4976ef){_0x3aeb50[_0x7ccd('0x1f')](0x194);}return _0x4976ef;};}function handleError(_0x2fafc0,_0x593f24){_0x593f24=_0x593f24||0x1f4;return function(_0x191b4b){logger[_0x7ccd('0x2e')](_0x191b4b[_0x7ccd('0x2f')]);if(_0x191b4b['name']){delete _0x191b4b['name'];}_0x2fafc0[_0x7ccd('0x20')](_0x593f24)[_0x7ccd('0x30')](_0x191b4b);};}exports[_0x7ccd('0x31')]=function(_0x13f4a6,_0x59468c){var _0xa2ca28={'raw':![],'where':{'id':_0x13f4a6[_0x7ccd('0x32')]['id']}},_0x28f3db={};_0x28f3db[_0x7ccd('0x33')]=_['keys'](db['DashboardItem'][_0x7ccd('0x34')]);_0x28f3db['query']=_[_0x7ccd('0x35')](_0x13f4a6[_0x7ccd('0x36')]);_0x28f3db[_0x7ccd('0x37')]=_['intersection'](_0x28f3db[_0x7ccd('0x33')],_0x28f3db[_0x7ccd('0x36')]);_0xa2ca28[_0x7ccd('0x38')]=_[_0x7ccd('0x39')](_0x28f3db[_0x7ccd('0x33')],qs[_0x7ccd('0x3a')](_0x13f4a6[_0x7ccd('0x36')][_0x7ccd('0x3a')]));_0xa2ca28[_0x7ccd('0x38')]=_0xa2ca28[_0x7ccd('0x38')][_0x7ccd('0x3b')]?_0xa2ca28[_0x7ccd('0x38')]:_0x28f3db['model'];if(_0x13f4a6[_0x7ccd('0x36')][_0x7ccd('0x3c')]){_0xa2ca28[_0x7ccd('0x3d')]=[{'all':!![]}];}_0xa2ca28=_[_0x7ccd('0x3e')]({},_0xa2ca28,_0x13f4a6[_0x7ccd('0x3f')]);return db[_0x7ccd('0x40')]['find'](_0xa2ca28)[_0x7ccd('0x2c')](handleEntityNotFound(_0x59468c,null))[_0x7ccd('0x2c')](respondWithResult(_0x59468c,null))[_0x7ccd('0x41')](handleError(_0x59468c,null));};exports[_0x7ccd('0x2d')]=function(_0x3cd293,_0x171600){return db[_0x7ccd('0x40')][_0x7ccd('0x42')]({'where':{'id':_0x3cd293[_0x7ccd('0x32')]['id']}})[_0x7ccd('0x2c')](handleEntityNotFound(_0x171600,null))[_0x7ccd('0x2c')](removeEntity(_0x171600,null))[_0x7ccd('0x41')](handleError(_0x171600,null));};function widgetAttributes(_0x73cc0d){try{switch(_0x73cc0d[_0x7ccd('0x43')]){case _0x7ccd('0x44'):return[{'name':_0x7ccd('0x45'),'value':_0x73cc0d[_0x7ccd('0x45')]||(_0x73cc0d[_0x7ccd('0x46')]&&_0x73cc0d[_0x7ccd('0x46')][0x0]?_0x73cc0d[_0x7ccd('0x46')][0x0][_0x7ccd('0x47')]:undefined)||'https://'}];case'custom':return[{'name':_0x7ccd('0x48'),'value':_0x73cc0d['attrPath']||(_0x73cc0d[_0x7ccd('0x46')]&&_0x73cc0d[_0x7ccd('0x46')][0x0]?_0x73cc0d[_0x7ccd('0x46')][0x0][_0x7ccd('0x47')]:undefined)||''}];case _0x7ccd('0x49'):return[{'name':_0x7ccd('0x4a'),'value':_0x73cc0d[_0x7ccd('0x4a')]||(_0x73cc0d[_0x7ccd('0x46')]&&_0x73cc0d[_0x7ccd('0x46')][0x0]?_0x73cc0d[_0x7ccd('0x46')][0x0][_0x7ccd('0x47')]:undefined)||_0x7ccd('0x4b')},{'name':'attrTimezone','value':_0x73cc0d['attrTimezone']||(_0x73cc0d[_0x7ccd('0x46')]&&_0x73cc0d['attrs'][0x1]?_0x73cc0d[_0x7ccd('0x46')][0x1]['value']:undefined)||_0x7ccd('0x4c')},{'name':_0x7ccd('0x4d'),'value':_0x73cc0d['attrFontSize']||(_0x73cc0d['attrs']&&_0x73cc0d[_0x7ccd('0x46')][0x2]?_0x73cc0d[_0x7ccd('0x46')][0x2][_0x7ccd('0x47')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x73cc0d['attrMetric']||(_0x73cc0d['attrs']&&_0x73cc0d[_0x7ccd('0x46')][0x0]?_0x73cc0d[_0x7ccd('0x46')][0x0]['value']:undefined)||_0x7ccd('0x4e')},{'name':_0x7ccd('0x4f'),'value':_0x73cc0d[_0x7ccd('0x4f')]||(_0x73cc0d['attrs']&&_0x73cc0d[_0x7ccd('0x46')][0x1]?_0x73cc0d[_0x7ccd('0x46')][0x1][_0x7ccd('0x47')]:undefined)||[]},{'name':_0x7ccd('0x4d'),'value':_0x73cc0d[_0x7ccd('0x4d')]||(_0x73cc0d[_0x7ccd('0x46')]&&_0x73cc0d[_0x7ccd('0x46')][0x2]?_0x73cc0d[_0x7ccd('0x46')][0x2][_0x7ccd('0x47')]:undefined)||0x14}];case _0x7ccd('0x50'):case _0x7ccd('0x51'):return[{'name':'attrSerie1','value':_0x73cc0d[_0x7ccd('0x52')]||(_0x73cc0d[_0x7ccd('0x46')]&&_0x73cc0d['attrs'][0x0]?_0x73cc0d['attrs'][0x0][_0x7ccd('0x47')]:undefined)||'total'},{'name':_0x7ccd('0x53'),'value':_0x73cc0d['attrSerie2']||(_0x73cc0d[_0x7ccd('0x46')]&&_0x73cc0d[_0x7ccd('0x46')][0x1]?_0x73cc0d[_0x7ccd('0x46')][0x1][_0x7ccd('0x47')]:undefined)||null},{'name':_0x7ccd('0x54'),'value':_0x73cc0d['attrSerie3']||(_0x73cc0d[_0x7ccd('0x46')]&&_0x73cc0d[_0x7ccd('0x46')][0x2]?_0x73cc0d[_0x7ccd('0x46')][0x2][_0x7ccd('0x47')]:undefined)||null},{'name':_0x7ccd('0x4f'),'value':_0x73cc0d[_0x7ccd('0x4f')]||(_0x73cc0d['attrs']&&_0x73cc0d[_0x7ccd('0x46')][0x3]?_0x73cc0d[_0x7ccd('0x46')][0x3][_0x7ccd('0x47')]:undefined)||[]}];case _0x7ccd('0x55'):return[{'name':_0x7ccd('0x56'),'type':_0x73cc0d[_0x7ccd('0x57')]||(_0x73cc0d['attrs']&&_0x73cc0d[_0x7ccd('0x46')][0x0]?_0x73cc0d[_0x7ccd('0x46')][0x0][_0x7ccd('0x43')]:undefined)||null,'value':_0x73cc0d[_0x7ccd('0x56')]||(_0x73cc0d['attrs']&&_0x73cc0d[_0x7ccd('0x46')][0x0]?_0x73cc0d[_0x7ccd('0x46')][0x0][_0x7ccd('0x47')]:undefined)||null},{'name':'attrRefresh','value':_0x73cc0d['attrRefresh']||(_0x73cc0d['attrs']&&_0x73cc0d[_0x7ccd('0x46')][0x1]?_0x73cc0d[_0x7ccd('0x46')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x17651a){logger[_0x7ccd('0x2e')](_0x7ccd('0x58'),JSON[_0x7ccd('0x59')](_0x17651a));return[];}}exports[_0x7ccd('0x5a')]=function(_0x2f4411,_0x58c45a){if(_0x2f4411[_0x7ccd('0x5b')]){_0x2f4411['body'][_0x7ccd('0x46')]=widgetAttributes(_0x2f4411[_0x7ccd('0x5b')]);}return db['DashboardItem'][_0x7ccd('0x5a')](_0x2f4411['body'],{})[_0x7ccd('0x2c')](respondWithResult(_0x58c45a,0xc9))['catch'](handleError(_0x58c45a,null));};exports[_0x7ccd('0x2b')]=function(_0x3cefa7,_0x73001f){if(_0x3cefa7[_0x7ccd('0x5b')]['id']){delete _0x3cefa7[_0x7ccd('0x5b')]['id'];}_0x3cefa7[_0x7ccd('0x5b')][_0x7ccd('0x46')]=widgetAttributes(_0x3cefa7[_0x7ccd('0x5b')]);return db[_0x7ccd('0x40')][_0x7ccd('0x42')]({'where':{'id':_0x3cefa7[_0x7ccd('0x32')]['id']}})[_0x7ccd('0x2c')](handleEntityNotFound(_0x73001f,null))[_0x7ccd('0x2c')](saveUpdates(_0x3cefa7[_0x7ccd('0x5b')],null))[_0x7ccd('0x2c')](respondWithResult(_0x73001f,null))[_0x7ccd('0x41')](handleError(_0x73001f,null));}; \ No newline at end of file +var _0x1c85=['sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','error','name','send','show','params','keys','DashboardItem','query','intersection','model','attributes','fields','length','includeAll','include','options','find','destroy','catch','type','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','stringify','create','body','eml-format','rimraf','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x14a7c8,_0x2d3dc0){var _0x47da08=function(_0x573e64){while(--_0x573e64){_0x14a7c8['push'](_0x14a7c8['shift']());}};_0x47da08(++_0x2d3dc0);}(_0x1c85,0x18b));var _0x51c8=function(_0x4df58b,_0xec7edb){_0x4df58b=_0x4df58b-0x0;var _0x4546e1=_0x1c85[_0x4df58b];return _0x4546e1;};'use strict';var emlformat=require(_0x51c8('0x0'));var rimraf=require(_0x51c8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x51c8('0x2'));var moment=require(_0x51c8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x51c8('0x4'));var util=require('util');var path=require('path');var sox=require(_0x51c8('0x5'));var csv=require(_0x51c8('0x6'));var ejs=require(_0x51c8('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x51c8('0x8'));var squel=require(_0x51c8('0x9'));var crypto=require(_0x51c8('0xa'));var jsforce=require(_0x51c8('0xb'));var deskjs=require(_0x51c8('0xc'));var toCsv=require(_0x51c8('0x6'));var querystring=require(_0x51c8('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x51c8('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x51c8('0xf'));var logger=require(_0x51c8('0x10'))(_0x51c8('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x51c8('0x12'));var db=require(_0x51c8('0x13'))['db'];config[_0x51c8('0x14')]=_[_0x51c8('0x15')](config['redis'],{'host':_0x51c8('0x16'),'port':0x18eb});var socket=require(_0x51c8('0x17'))(new Redis(config[_0x51c8('0x14')]));require('./dashboardItem.socket')[_0x51c8('0x18')](socket);function respondWithStatusCode(_0x5d17e7,_0x2c0039){_0x2c0039=_0x2c0039||0xcc;return function(_0x3780f9){if(_0x3780f9){return _0x5d17e7[_0x51c8('0x19')](_0x2c0039);}return _0x5d17e7[_0x51c8('0x1a')](_0x2c0039)[_0x51c8('0x1b')]();};}function respondWithResult(_0x42c05e,_0xfb312){_0xfb312=_0xfb312||0xc8;return function(_0x339840){if(_0x339840){return _0x42c05e[_0x51c8('0x1a')](_0xfb312)[_0x51c8('0x1c')](_0x339840);}};}function respondWithFilteredResult(_0x3bfa24,_0x57fea6){return function(_0x33b074){if(_0x33b074){var _0x2c86b1=typeof _0x57fea6['offset']===_0x51c8('0x1d')&&typeof _0x57fea6['limit']===_0x51c8('0x1d');var _0x295972=_0x33b074[_0x51c8('0x1e')];var _0x2a044b=_0x2c86b1?0x0:_0x57fea6[_0x51c8('0x1f')];var _0x4eec4f=_0x2c86b1?_0x33b074['count']:_0x57fea6[_0x51c8('0x1f')]+_0x57fea6[_0x51c8('0x20')];var _0x4a20c2;if(_0x4eec4f>=_0x295972){_0x4eec4f=_0x295972;_0x4a20c2=0xc8;}else{_0x4a20c2=0xce;}_0x3bfa24[_0x51c8('0x1a')](_0x4a20c2);return _0x3bfa24[_0x51c8('0x21')](_0x51c8('0x22'),_0x2a044b+'-'+_0x4eec4f+'/'+_0x295972)['json'](_0x33b074);}return null;};}function patchUpdates(_0x38fd0e){return function(_0x251710){try{jsonpatch[_0x51c8('0x23')](_0x251710,_0x38fd0e,!![]);}catch(_0x1bd17b){return BPromise['reject'](_0x1bd17b);}return _0x251710[_0x51c8('0x24')]();};}function saveUpdates(_0x5394a4,_0x1c42f6){return function(_0x4843a7){if(_0x4843a7){return _0x4843a7[_0x51c8('0x25')](_0x5394a4)[_0x51c8('0x26')](function(_0x1162bf){return _0x1162bf;});}return null;};}function removeEntity(_0x392c34,_0x377544){return function(_0xc59cba){if(_0xc59cba){return _0xc59cba['destroy']()['then'](function(){_0x392c34['status'](0xcc)[_0x51c8('0x1b')]();});}};}function handleEntityNotFound(_0x495644,_0x25c9f6){return function(_0xf090ca){if(!_0xf090ca){_0x495644[_0x51c8('0x19')](0x194);}return _0xf090ca;};}function handleError(_0x48d8e5,_0x171d9e){_0x171d9e=_0x171d9e||0x1f4;return function(_0x3c8e93){logger[_0x51c8('0x27')](_0x3c8e93['stack']);if(_0x3c8e93['name']){delete _0x3c8e93[_0x51c8('0x28')];}_0x48d8e5['status'](_0x171d9e)[_0x51c8('0x29')](_0x3c8e93);};}exports[_0x51c8('0x2a')]=function(_0x47a37a,_0x5c7bdb){var _0x4cfcea={'raw':![],'where':{'id':_0x47a37a[_0x51c8('0x2b')]['id']}},_0x3f9180={};_0x3f9180['model']=_[_0x51c8('0x2c')](db[_0x51c8('0x2d')]['rawAttributes']);_0x3f9180['query']=_[_0x51c8('0x2c')](_0x47a37a[_0x51c8('0x2e')]);_0x3f9180['filters']=_[_0x51c8('0x2f')](_0x3f9180[_0x51c8('0x30')],_0x3f9180['query']);_0x4cfcea[_0x51c8('0x31')]=_['intersection'](_0x3f9180[_0x51c8('0x30')],qs[_0x51c8('0x32')](_0x47a37a[_0x51c8('0x2e')][_0x51c8('0x32')]));_0x4cfcea['attributes']=_0x4cfcea[_0x51c8('0x31')][_0x51c8('0x33')]?_0x4cfcea[_0x51c8('0x31')]:_0x3f9180[_0x51c8('0x30')];if(_0x47a37a[_0x51c8('0x2e')][_0x51c8('0x34')]){_0x4cfcea[_0x51c8('0x35')]=[{'all':!![]}];}_0x4cfcea=_['merge']({},_0x4cfcea,_0x47a37a[_0x51c8('0x36')]);return db[_0x51c8('0x2d')][_0x51c8('0x37')](_0x4cfcea)[_0x51c8('0x26')](handleEntityNotFound(_0x5c7bdb,null))[_0x51c8('0x26')](respondWithResult(_0x5c7bdb,null))['catch'](handleError(_0x5c7bdb,null));};exports[_0x51c8('0x38')]=function(_0x23efa8,_0xe920c9){return db['DashboardItem'][_0x51c8('0x37')]({'where':{'id':_0x23efa8['params']['id']}})[_0x51c8('0x26')](handleEntityNotFound(_0xe920c9,null))[_0x51c8('0x26')](removeEntity(_0xe920c9,null))[_0x51c8('0x39')](handleError(_0xe920c9,null));};function widgetAttributes(_0x45baf3){try{switch(_0x45baf3[_0x51c8('0x3a')]){case'iframe':return[{'name':_0x51c8('0x3b'),'value':_0x45baf3[_0x51c8('0x3b')]||(_0x45baf3[_0x51c8('0x3c')]&&_0x45baf3[_0x51c8('0x3c')][0x0]?_0x45baf3[_0x51c8('0x3c')][0x0][_0x51c8('0x3d')]:undefined)||_0x51c8('0x3e')}];case'custom':return[{'name':'attrPath','value':_0x45baf3[_0x51c8('0x3f')]||(_0x45baf3[_0x51c8('0x3c')]&&_0x45baf3[_0x51c8('0x3c')][0x0]?_0x45baf3[_0x51c8('0x3c')][0x0]['value']:undefined)||''}];case _0x51c8('0x40'):return[{'name':_0x51c8('0x41'),'value':_0x45baf3[_0x51c8('0x41')]||(_0x45baf3[_0x51c8('0x3c')]&&_0x45baf3['attrs'][0x0]?_0x45baf3[_0x51c8('0x3c')][0x0][_0x51c8('0x3d')]:undefined)||_0x51c8('0x42')},{'name':_0x51c8('0x43'),'value':_0x45baf3[_0x51c8('0x43')]||(_0x45baf3[_0x51c8('0x3c')]&&_0x45baf3[_0x51c8('0x3c')][0x1]?_0x45baf3['attrs'][0x1][_0x51c8('0x3d')]:undefined)||_0x51c8('0x44')},{'name':_0x51c8('0x45'),'value':_0x45baf3[_0x51c8('0x45')]||(_0x45baf3['attrs']&&_0x45baf3[_0x51c8('0x3c')][0x2]?_0x45baf3['attrs'][0x2][_0x51c8('0x3d')]:undefined)||0xc}];case _0x51c8('0x46'):return[{'name':_0x51c8('0x47'),'value':_0x45baf3[_0x51c8('0x47')]||(_0x45baf3[_0x51c8('0x3c')]&&_0x45baf3[_0x51c8('0x3c')][0x0]?_0x45baf3[_0x51c8('0x3c')][0x0][_0x51c8('0x3d')]:undefined)||'total'},{'name':_0x51c8('0x48'),'value':_0x45baf3[_0x51c8('0x48')]||(_0x45baf3[_0x51c8('0x3c')]&&_0x45baf3[_0x51c8('0x3c')][0x1]?_0x45baf3[_0x51c8('0x3c')][0x1][_0x51c8('0x3d')]:undefined)||[]},{'name':'attrFontSize','value':_0x45baf3[_0x51c8('0x45')]||(_0x45baf3[_0x51c8('0x3c')]&&_0x45baf3['attrs'][0x2]?_0x45baf3[_0x51c8('0x3c')][0x2][_0x51c8('0x3d')]:undefined)||0x14}];case _0x51c8('0x49'):case'pie-chart':return[{'name':'attrSerie1','value':_0x45baf3[_0x51c8('0x4a')]||(_0x45baf3[_0x51c8('0x3c')]&&_0x45baf3[_0x51c8('0x3c')][0x0]?_0x45baf3[_0x51c8('0x3c')][0x0][_0x51c8('0x3d')]:undefined)||_0x51c8('0x4b')},{'name':_0x51c8('0x4c'),'value':_0x45baf3[_0x51c8('0x4c')]||(_0x45baf3[_0x51c8('0x3c')]&&_0x45baf3['attrs'][0x1]?_0x45baf3[_0x51c8('0x3c')][0x1][_0x51c8('0x3d')]:undefined)||null},{'name':_0x51c8('0x4d'),'value':_0x45baf3[_0x51c8('0x4d')]||(_0x45baf3['attrs']&&_0x45baf3[_0x51c8('0x3c')][0x2]?_0x45baf3[_0x51c8('0x3c')][0x2][_0x51c8('0x3d')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x45baf3['attrVoiceQueues']||(_0x45baf3[_0x51c8('0x3c')]&&_0x45baf3[_0x51c8('0x3c')][0x3]?_0x45baf3[_0x51c8('0x3c')][0x3]['value']:undefined)||[]}];case _0x51c8('0x4e'):return[{'name':_0x51c8('0x4f'),'type':_0x45baf3['reportType']||(_0x45baf3[_0x51c8('0x3c')]&&_0x45baf3[_0x51c8('0x3c')][0x0]?_0x45baf3[_0x51c8('0x3c')][0x0][_0x51c8('0x3a')]:undefined)||null,'value':_0x45baf3[_0x51c8('0x4f')]||(_0x45baf3[_0x51c8('0x3c')]&&_0x45baf3[_0x51c8('0x3c')][0x0]?_0x45baf3[_0x51c8('0x3c')][0x0][_0x51c8('0x3d')]:undefined)||null},{'name':_0x51c8('0x50'),'value':_0x45baf3[_0x51c8('0x50')]||(_0x45baf3['attrs']&&_0x45baf3[_0x51c8('0x3c')][0x1]?_0x45baf3[_0x51c8('0x3c')][0x1][_0x51c8('0x3d')]:undefined)||0x0}];default:return[];}}catch(_0x3b242b){logger['error']('widgetAttributes:\x20%s',JSON[_0x51c8('0x51')](_0x3b242b));return[];}}exports[_0x51c8('0x52')]=function(_0x3c2ebd,_0x4fff02){if(_0x3c2ebd[_0x51c8('0x53')]){_0x3c2ebd[_0x51c8('0x53')][_0x51c8('0x3c')]=widgetAttributes(_0x3c2ebd['body']);}return db[_0x51c8('0x2d')][_0x51c8('0x52')](_0x3c2ebd[_0x51c8('0x53')],{})[_0x51c8('0x26')](respondWithResult(_0x4fff02,0xc9))[_0x51c8('0x39')](handleError(_0x4fff02,null));};exports[_0x51c8('0x25')]=function(_0x345684,_0xb6dbea){if(_0x345684['body']['id']){delete _0x345684[_0x51c8('0x53')]['id'];}_0x345684[_0x51c8('0x53')][_0x51c8('0x3c')]=widgetAttributes(_0x345684[_0x51c8('0x53')]);return db[_0x51c8('0x2d')]['find']({'where':{'id':_0x345684[_0x51c8('0x2b')]['id']}})[_0x51c8('0x26')](handleEntityNotFound(_0xb6dbea,null))[_0x51c8('0x26')](saveUpdates(_0x345684[_0x51c8('0x53')],null))[_0x51c8('0x26')](respondWithResult(_0xb6dbea,null))[_0x51c8('0x39')](handleError(_0xb6dbea,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 847c2d3..9fbed71 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 _0x5d70=['save','update','remove','emit','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners'];(function(_0x53b124,_0x2d4095){var _0x4740ea=function(_0x4c4b1a){while(--_0x4c4b1a){_0x53b124['push'](_0x53b124['shift']());}};_0x4740ea(++_0x2d4095);}(_0x5d70,0xc4));var _0x05d7=function(_0x123fb2,_0x10ebc7){_0x123fb2=_0x123fb2-0x0;var _0x35d94b=_0x5d70[_0x123fb2];return _0x35d94b;};'use strict';var EventEmitter=require(_0x05d7('0x0'));var DashboardItem=require(_0x05d7('0x1'))['db'][_0x05d7('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x05d7('0x3')](0x0);var events={'afterCreate':_0x05d7('0x4'),'afterUpdate':_0x05d7('0x5'),'afterDestroy':_0x05d7('0x6')};function emitEvent(_0x121752){return function(_0x3ba8f1,_0x45dac1,_0x5527b2){DashboardItemEvents[_0x05d7('0x7')](_0x121752+':'+_0x3ba8f1['id'],_0x3ba8f1);DashboardItemEvents['emit'](_0x121752,_0x3ba8f1);_0x5527b2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x05d7('0x8')](e,emitEvent(event));}}module[_0x05d7('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0x6c62=['remove','emit','hasOwnProperty','hook','exports','events','DashboardItem','setMaxListeners','save','update'];(function(_0x13caea,_0x45481c){var _0x20b784=function(_0x3125c4){while(--_0x3125c4){_0x13caea['push'](_0x13caea['shift']());}};_0x20b784(++_0x45481c);}(_0x6c62,0x195));var _0x26c6=function(_0x278f93,_0x5d74c6){_0x278f93=_0x278f93-0x0;var _0x47d224=_0x6c62[_0x278f93];return _0x47d224;};'use strict';var EventEmitter=require(_0x26c6('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x26c6('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x26c6('0x2')](0x0);var events={'afterCreate':_0x26c6('0x3'),'afterUpdate':_0x26c6('0x4'),'afterDestroy':_0x26c6('0x5')};function emitEvent(_0x1685d9){return function(_0x265a4c,_0x32b518,_0x5b8750){DashboardItemEvents[_0x26c6('0x6')](_0x1685d9+':'+_0x265a4c['id'],_0x265a4c);DashboardItemEvents[_0x26c6('0x6')](_0x1685d9,_0x265a4c);_0x5b8750(null);};}for(var e in events){if(events[_0x26c6('0x7')](e)){var event=events[e];DashboardItem[_0x26c6('0x8')](e,emitEvent(event));}}module[_0x26c6('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index fd4c8f6..baba657 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 _0x5137=['api','bluebird','request-promise','rimraf','../../config/environment','./dashboardItem.attributes','exports','lodash','../../config/logger'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x5137,0x1c9));var _0x7513=function(_0x3020e2,_0x310f30){_0x3020e2=_0x3020e2-0x0;var _0x425ef8=_0x5137[_0x3020e2];return _0x425ef8;};'use strict';var _=require(_0x7513('0x0'));var util=require('util');var logger=require(_0x7513('0x1'))(_0x7513('0x2'));var moment=require('moment');var BPromise=require(_0x7513('0x3'));var rp=require(_0x7513('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7513('0x5'));var config=require(_0x7513('0x6'));var attributes=require(_0x7513('0x7'));module[_0x7513('0x8')]=function(_0xe53634,_0xefb353){return _0xe53634['define']('DashboardItem',attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe299=['define','DashboardItem','dashboard_items','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports'];(function(_0xe775be,_0x4822af){var _0x49e73c=function(_0x225efd){while(--_0x225efd){_0xe775be['push'](_0xe775be['shift']());}};_0x49e73c(++_0x4822af);}(_0xe299,0x16f));var _0x9e29=function(_0x9f35e7,_0x2095dd){_0x9f35e7=_0x9f35e7-0x0;var _0x3d7c68=_0xe299[_0x9f35e7];return _0x3d7c68;};'use strict';var _=require(_0x9e29('0x0'));var util=require(_0x9e29('0x1'));var logger=require(_0x9e29('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9e29('0x3'));var rp=require(_0x9e29('0x4'));var fs=require('fs');var path=require(_0x9e29('0x5'));var rimraf=require(_0x9e29('0x6'));var config=require(_0x9e29('0x7'));var attributes=require(_0x9e29('0x8'));module[_0x9e29('0x9')]=function(_0x56f89b,_0x458ae0){return _0x56f89b[_0x9e29('0xa')](_0x9e29('0xb'),attributes,{'tableName':_0x9e29('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 11f6f40..78c71a8 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 _0x2ebd=['rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xad334a,_0x530784){var _0x208392=function(_0x4a1cc8){while(--_0x4a1cc8){_0xad334a['push'](_0xad334a['shift']());}};_0x208392(++_0x530784);}(_0x2ebd,0xd1));var _0xd2eb=function(_0x4989d0,_0x46492b){_0x4989d0=_0x4989d0-0x0;var _0x2dddfa=_0x2ebd[_0x4989d0];return _0x2dddfa;};'use strict';var _=require(_0xd2eb('0x0'));var util=require(_0xd2eb('0x1'));var moment=require(_0xd2eb('0x2'));var BPromise=require('bluebird');var rs=require(_0xd2eb('0x3'));var fs=require('fs');var Redis=require(_0xd2eb('0x4'));var db=require(_0xd2eb('0x5'))['db'];var utils=require(_0xd2eb('0x6'));var logger=require('../../config/logger')(_0xd2eb('0x7'));var config=require(_0xd2eb('0x8'));var jayson=require(_0xd2eb('0x9'));var client=jayson[_0xd2eb('0xa')]['http']({'port':0x232a});config['redis']=_[_0xd2eb('0xb')](config[_0xd2eb('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xd2eb('0xd'))(new Redis(config[_0xd2eb('0xc')]));require(_0xd2eb('0xe'))[_0xd2eb('0xf')](socket);function respondWithRpcPromise(_0x42688c,_0x164c87,_0x5b11bf){return new BPromise(function(_0x57bb43,_0x3ce13d){return client[_0xd2eb('0x10')](_0x42688c,_0x5b11bf)[_0xd2eb('0x11')](function(_0x44dab3){logger[_0xd2eb('0x12')](_0xd2eb('0x13'),_0x164c87,_0xd2eb('0x14'));logger['debug'](_0xd2eb('0x15'),_0x164c87,_0xd2eb('0x14'),JSON[_0xd2eb('0x16')](_0x44dab3));if(_0x44dab3['error']){if(_0x44dab3[_0xd2eb('0x17')]['code']===0x1f4){logger[_0xd2eb('0x17')](_0xd2eb('0x13'),_0x164c87,_0x44dab3[_0xd2eb('0x17')][_0xd2eb('0x18')]);return _0x3ce13d(_0x44dab3['error'][_0xd2eb('0x18')]);}logger[_0xd2eb('0x17')]('DashboardItem,\x20%s,\x20%s',_0x164c87,_0x44dab3[_0xd2eb('0x17')]['message']);return _0x57bb43(_0x44dab3['error']['message']);}else{logger[_0xd2eb('0x12')]('DashboardItem,\x20%s,\x20%s',_0x164c87,'request\x20sent');_0x57bb43(_0x44dab3[_0xd2eb('0x19')][_0xd2eb('0x18')]);}})[_0xd2eb('0x1a')](function(_0x516c55){logger[_0xd2eb('0x17')](_0xd2eb('0x13'),_0x164c87,_0x516c55);_0x3ce13d(_0x516c55);});});} \ No newline at end of file +var _0xf3f8=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./dashboardItem.socket','register','request\x20sent','error','code','DashboardItem,\x20%s,\x20%s','message','info','result','lodash'];(function(_0x558e48,_0x338922){var _0x4b912e=function(_0x3636db){while(--_0x3636db){_0x558e48['push'](_0x558e48['shift']());}};_0x4b912e(++_0x338922);}(_0xf3f8,0xf1));var _0x8f3f=function(_0x25e741,_0x53ec1d){_0x25e741=_0x25e741-0x0;var _0x1b4a42=_0xf3f8[_0x25e741];return _0x1b4a42;};'use strict';var _=require(_0x8f3f('0x0'));var util=require(_0x8f3f('0x1'));var moment=require('moment');var BPromise=require(_0x8f3f('0x2'));var rs=require(_0x8f3f('0x3'));var fs=require('fs');var Redis=require(_0x8f3f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8f3f('0x5'));var logger=require(_0x8f3f('0x6'))(_0x8f3f('0x7'));var config=require(_0x8f3f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8f3f('0x9')][_0x8f3f('0xa')]({'port':0x232a});config[_0x8f3f('0xb')]=_['defaults'](config[_0x8f3f('0xb')],{'host':_0x8f3f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8f3f('0xb')]));require(_0x8f3f('0xd'))[_0x8f3f('0xe')](socket);function respondWithRpcPromise(_0x4a89be,_0x354148,_0x1b8e89){return new BPromise(function(_0x1662ff,_0x102677){return client['request'](_0x4a89be,_0x1b8e89)['then'](function(_0x342789){logger['info']('DashboardItem,\x20%s,\x20%s',_0x354148,'request\x20sent');logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0x354148,_0x8f3f('0xf'),JSON['stringify'](_0x342789));if(_0x342789[_0x8f3f('0x10')]){if(_0x342789[_0x8f3f('0x10')][_0x8f3f('0x11')]===0x1f4){logger[_0x8f3f('0x10')](_0x8f3f('0x12'),_0x354148,_0x342789['error'][_0x8f3f('0x13')]);return _0x102677(_0x342789[_0x8f3f('0x10')][_0x8f3f('0x13')]);}logger[_0x8f3f('0x10')](_0x8f3f('0x12'),_0x354148,_0x342789[_0x8f3f('0x10')]['message']);return _0x1662ff(_0x342789[_0x8f3f('0x10')]['message']);}else{logger[_0x8f3f('0x14')](_0x8f3f('0x12'),_0x354148,_0x8f3f('0xf'));_0x1662ff(_0x342789[_0x8f3f('0x15')]['message']);}})['catch'](function(_0x2477a6){logger[_0x8f3f('0x10')](_0x8f3f('0x12'),_0x354148,_0x2477a6);_0x102677(_0x2477a6);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 31a0c54..8b62225 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 _0xa5fd=['emit','register','length','dashboardItem:','./dashboardItem.events','save','remove'];(function(_0x16c57c,_0x366660){var _0x551b63=function(_0x17af5f){while(--_0x17af5f){_0x16c57c['push'](_0x16c57c['shift']());}};_0x551b63(++_0x366660);}(_0xa5fd,0xf9));var _0xda5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5fd[_0x3dd15e];return _0x231fd0;};'use strict';var DashboardItemEvents=require(_0xda5f('0x0'));var events=[_0xda5f('0x1'),_0xda5f('0x2'),'update'];function createListener(_0x197f4b,_0x2069f9){return function(_0xac8d1f){_0x2069f9[_0xda5f('0x3')](_0x197f4b,_0xac8d1f);};}function removeListener(_0x28fe67,_0x4282f0){return function(){DashboardItemEvents['removeListener'](_0x28fe67,_0x4282f0);};}exports[_0xda5f('0x4')]=function(_0x156b5f){for(var _0x3c86bd=0x0,_0x10f2b4=events[_0xda5f('0x5')];_0x3c86bd<_0x10f2b4;_0x3c86bd++){var _0x526d10=events[_0x3c86bd];var _0x21bf5a=createListener(_0xda5f('0x6')+_0x526d10,_0x156b5f);DashboardItemEvents['on'](_0x526d10,_0x21bf5a);}}; \ No newline at end of file +var _0x7dbf=['./dashboardItem.events','save','remove','emit','removeListener','register','length','dashboardItem:'];(function(_0x5f5862,_0xd1c9d2){var _0x4a83df=function(_0x59250a){while(--_0x59250a){_0x5f5862['push'](_0x5f5862['shift']());}};_0x4a83df(++_0xd1c9d2);}(_0x7dbf,0xd0));var _0xf7db=function(_0x305b55,_0x991130){_0x305b55=_0x305b55-0x0;var _0x45b3e7=_0x7dbf[_0x305b55];return _0x45b3e7;};'use strict';var DashboardItemEvents=require(_0xf7db('0x0'));var events=[_0xf7db('0x1'),_0xf7db('0x2'),'update'];function createListener(_0x19234e,_0x43abb2){return function(_0x2cbd8e){_0x43abb2[_0xf7db('0x3')](_0x19234e,_0x2cbd8e);};}function removeListener(_0x10259d,_0x1ed21b){return function(){DashboardItemEvents[_0xf7db('0x4')](_0x10259d,_0x1ed21b);};}exports[_0xf7db('0x5')]=function(_0x165a26){for(var _0x5ebe84=0x0,_0x2bbebb=events[_0xf7db('0x6')];_0x5ebe84<_0x2bbebb;_0x5ebe84++){var _0x103db5=events[_0x5ebe84];var _0x176e41=createListener(_0xf7db('0x7')+_0x103db5,_0x165a26);DashboardItemEvents['on'](_0x103db5,_0x176e41);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index c0dcc0b..4c47e6a 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 _0xf29d=['update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','/:id','isAuthenticated','show','post','create','put'];(function(_0x5d2ac7,_0x43c25d){var _0xe67b36=function(_0x24ef78){while(--_0x24ef78){_0x5d2ac7['push'](_0x5d2ac7['shift']());}};_0xe67b36(++_0x43c25d);}(_0xf29d,0x114));var _0xdf29=function(_0x3acb0e,_0x169cdc){_0x3acb0e=_0x3acb0e-0x0;var _0x57af73=_0xf29d[_0x3acb0e];return _0x57af73;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdf29('0x0'));var timeout=require(_0xdf29('0x1'));var express=require(_0xdf29('0x2'));var router=express[_0xdf29('0x3')]();var fs_extra=require(_0xdf29('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdf29('0x5'));var config=require('../../config/environment');var controller=require('./dashboardItem.controller');router['get'](_0xdf29('0x6'),auth[_0xdf29('0x7')](),controller[_0xdf29('0x8')]);router[_0xdf29('0x9')]('/',auth[_0xdf29('0x7')](),controller[_0xdf29('0xa')]);router[_0xdf29('0xb')](_0xdf29('0x6'),auth[_0xdf29('0x7')](),controller[_0xdf29('0xc')]);router[_0xdf29('0xd')](_0xdf29('0x6'),auth[_0xdf29('0x7')](),controller[_0xdf29('0xe')]);module[_0xdf29('0xf')]=router; \ No newline at end of file +var _0xa61c=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa61c,0x160));var _0xca61=function(_0x3682b3,_0x5a604d){_0x3682b3=_0x3682b3-0x0;var _0x472b5d=_0xa61c[_0x3682b3];return _0x472b5d;};'use strict';var multer=require(_0xca61('0x0'));var util=require(_0xca61('0x1'));var path=require(_0xca61('0x2'));var timeout=require(_0xca61('0x3'));var express=require(_0xca61('0x4'));var router=express[_0xca61('0x5')]();var fs_extra=require(_0xca61('0x6'));var auth=require(_0xca61('0x7'));var interaction=require(_0xca61('0x8'));var config=require(_0xca61('0x9'));var controller=require(_0xca61('0xa'));router[_0xca61('0xb')](_0xca61('0xc'),auth[_0xca61('0xd')](),controller[_0xca61('0xe')]);router[_0xca61('0xf')]('/',auth[_0xca61('0xd')](),controller[_0xca61('0x10')]);router[_0xca61('0x11')](_0xca61('0xc'),auth['isAuthenticated'](),controller[_0xca61('0x12')]);router[_0xca61('0x13')]('/:id',auth[_0xca61('0xd')](),controller[_0xca61('0x14')]);module[_0xca61('0x15')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 05e4612..3a9e5a3 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 _0x533d=['third','STRING','exports','ENUM','first'];(function(_0x3ca4df,_0x14ec3a){var _0x28e66d=function(_0x2b0dfa){while(--_0x2b0dfa){_0x3ca4df['push'](_0x3ca4df['shift']());}};_0x28e66d(++_0x14ec3a);}(_0x533d,0x1f1));var _0xd533=function(_0xe6631b,_0x1e57d2){_0xe6631b=_0xe6631b-0x0;var _0x4fffe2=_0x533d[_0xe6631b];return _0x4fffe2;};'use strict';var Sequelize=require('sequelize');module[_0xd533('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0xd533('0x1')](_0xd533('0x2'),'second',_0xd533('0x3')),'allowNull':![],'defaultValue':_0xd533('0x2')},'description':{'type':Sequelize[_0xd533('0x4')]}}; \ No newline at end of file +var _0xe7fa=['STRING','ENUM','second','sequelize'];(function(_0x23c791,_0xa8bee3){var _0x57b777=function(_0x25f8c4){while(--_0x25f8c4){_0x23c791['push'](_0x23c791['shift']());}};_0x57b777(++_0xa8bee3);}(_0xe7fa,0x9b));var _0xae7f=function(_0x1f7f61,_0x441512){_0x1f7f61=_0x1f7f61-0x0;var _0x1db8d1=_0xe7fa[_0x1f7f61];return _0x1db8d1;};'use strict';var Sequelize=require(_0xae7f('0x0'));module['exports']={'name':{'type':Sequelize[_0xae7f('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0xae7f('0x2')]('first',_0xae7f('0x3'),'third'),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0xae7f('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 976aa36..b49c4da 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 _0xe774=['fs-extra','lodash','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','Dispositions','UserProfileResource','stack','name','index','map','Disposition','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','nolimit','where','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','length','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','error','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs'];(function(_0x5993bc,_0x3adcca){var _0x2869d0=function(_0x266ebb){while(--_0x266ebb){_0x5993bc['push'](_0x5993bc['shift']());}};_0x2869d0(++_0x3adcca);}(_0xe774,0x135));var _0x4e77=function(_0x19bc53,_0x6c2ab3){_0x19bc53=_0x19bc53-0x0;var _0x26ff1d=_0xe774[_0x19bc53];return _0x26ff1d;};'use strict';var emlformat=require(_0x4e77('0x0'));var rimraf=require(_0x4e77('0x1'));var zipdir=require(_0x4e77('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4e77('0x3'));var moment=require(_0x4e77('0x4'));var BPromise=require(_0x4e77('0x5'));var Mustache=require(_0x4e77('0x6'));var util=require(_0x4e77('0x7'));var path=require(_0x4e77('0x8'));var sox=require(_0x4e77('0x9'));var csv=require('to-csv');var ejs=require(_0x4e77('0xa'));var fs=require('fs');var fs_extra=require(_0x4e77('0xb'));var _=require(_0x4e77('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4e77('0xd'));var deskjs=require(_0x4e77('0xe'));var toCsv=require(_0x4e77('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4e77('0x10'));var authService=require(_0x4e77('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4e77('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x4e77('0x13'));var config=require(_0x4e77('0x14'));var licenseUtil=require(_0x4e77('0x15'));var db=require(_0x4e77('0x16'))['db'];function respondWithStatusCode(_0x250d1e,_0x2e2798){_0x2e2798=_0x2e2798||0xcc;return function(_0x55ae46){if(_0x55ae46){return _0x250d1e[_0x4e77('0x17')](_0x2e2798);}return _0x250d1e[_0x4e77('0x18')](_0x2e2798)[_0x4e77('0x19')]();};}function respondWithResult(_0x2a6f09,_0x111b31){_0x111b31=_0x111b31||0xc8;return function(_0x3accd9){if(_0x3accd9){return _0x2a6f09[_0x4e77('0x18')](_0x111b31)[_0x4e77('0x1a')](_0x3accd9);}};}function respondWithFilteredResult(_0x400ce2,_0x7be91b){return function(_0x417b48){if(_0x417b48){var _0x566493=typeof _0x7be91b[_0x4e77('0x1b')]===_0x4e77('0x1c')&&typeof _0x7be91b['limit']===_0x4e77('0x1c');var _0x104462=_0x417b48[_0x4e77('0x1d')];var _0x458162=_0x566493?0x0:_0x7be91b['offset'];var _0x24ebb9=_0x566493?_0x417b48['count']:_0x7be91b[_0x4e77('0x1b')]+_0x7be91b[_0x4e77('0x1e')];var _0x28c837;if(_0x24ebb9>=_0x104462){_0x24ebb9=_0x104462;_0x28c837=0xc8;}else{_0x28c837=0xce;}_0x400ce2[_0x4e77('0x18')](_0x28c837);return _0x400ce2[_0x4e77('0x1f')](_0x4e77('0x20'),_0x458162+'-'+_0x24ebb9+'/'+_0x104462)[_0x4e77('0x1a')](_0x417b48);}return null;};}function patchUpdates(_0xd68760){return function(_0x5f18b3){try{jsonpatch[_0x4e77('0x21')](_0x5f18b3,_0xd68760,!![]);}catch(_0x6f80c5){return BPromise[_0x4e77('0x22')](_0x6f80c5);}return _0x5f18b3[_0x4e77('0x23')]();};}function saveUpdates(_0x4a5040,_0x9cec1){return function(_0x2bcef1){if(_0x2bcef1){return _0x2bcef1['update'](_0x4a5040)[_0x4e77('0x24')](function(_0xd794b3){return _0xd794b3;});}return null;};}function removeEntity(_0x643888,_0x24d9c5){return function(_0xc2778d){if(_0xc2778d){return _0xc2778d[_0x4e77('0x25')]()[_0x4e77('0x24')](function(){var _0x11f1ef=_0xc2778d['get']({'plain':!![]});var _0x4957a0=_0x4e77('0x26');return db[_0x4e77('0x27')][_0x4e77('0x25')]({'where':{'type':_0x4957a0,'resourceId':_0x11f1ef['id']}})['then'](function(){return _0xc2778d;});})[_0x4e77('0x24')](function(){_0x643888['status'](0xcc)[_0x4e77('0x19')]();});}};}function handleEntityNotFound(_0x52012a,_0x4bacd9){return function(_0xa67aca){if(!_0xa67aca){_0x52012a[_0x4e77('0x17')](0x194);}return _0xa67aca;};}function handleError(_0x76a51e,_0x25e86f){_0x25e86f=_0x25e86f||0x1f4;return function(_0x4a32d8){logger['error'](_0x4a32d8[_0x4e77('0x28')]);if(_0x4a32d8[_0x4e77('0x29')]){delete _0x4a32d8[_0x4e77('0x29')];}_0x76a51e[_0x4e77('0x18')](_0x25e86f)['send'](_0x4a32d8);};}exports[_0x4e77('0x2a')]=function(_0x70e920,_0x46a0b5){var _0x5a5b49={},_0x14dcb5={},_0x523fe5={'count':0x0,'rows':[]};var _0x56d10b=_[_0x4e77('0x2b')](db[_0x4e77('0x2c')][_0x4e77('0x2d')],function(_0x2f1fb8){return{'name':_0x2f1fb8[_0x4e77('0x2e')],'type':_0x2f1fb8[_0x4e77('0x2f')][_0x4e77('0x30')]};});_0x14dcb5['model']=_[_0x4e77('0x2b')](_0x56d10b,_0x4e77('0x29'));_0x14dcb5[_0x4e77('0x31')]=_[_0x4e77('0x32')](_0x70e920[_0x4e77('0x31')]);_0x14dcb5[_0x4e77('0x33')]=_[_0x4e77('0x34')](_0x14dcb5['model'],_0x14dcb5[_0x4e77('0x31')]);_0x5a5b49['attributes']=_[_0x4e77('0x34')](_0x14dcb5[_0x4e77('0x35')],qs[_0x4e77('0x36')](_0x70e920[_0x4e77('0x31')][_0x4e77('0x36')]));_0x5a5b49[_0x4e77('0x37')]=_0x5a5b49['attributes']['length']?_0x5a5b49['attributes']:_0x14dcb5[_0x4e77('0x35')];if(!_0x70e920['query']['hasOwnProperty'](_0x4e77('0x38'))){_0x5a5b49['limit']=qs[_0x4e77('0x1e')](_0x70e920['query'][_0x4e77('0x1e')]);_0x5a5b49[_0x4e77('0x1b')]=qs[_0x4e77('0x1b')](_0x70e920[_0x4e77('0x31')][_0x4e77('0x1b')]);}_0x5a5b49['order']=qs['sort'](_0x70e920[_0x4e77('0x31')]['sort']);_0x5a5b49['where']=qs[_0x4e77('0x33')](_['pick'](_0x70e920[_0x4e77('0x31')],_0x14dcb5[_0x4e77('0x33')]),_0x56d10b);if(_0x70e920[_0x4e77('0x31')]['filter']){_0x5a5b49[_0x4e77('0x39')]=_[_0x4e77('0x3a')](_0x5a5b49[_0x4e77('0x39')],{'$or':_[_0x4e77('0x2b')](_0x56d10b,function(_0x2c14b1){if(_0x2c14b1[_0x4e77('0x2f')]!==_0x4e77('0x3b')){var _0x15b81a={};_0x15b81a[_0x2c14b1[_0x4e77('0x29')]]={'$like':'%'+_0x70e920[_0x4e77('0x31')][_0x4e77('0x3c')]+'%'};return _0x15b81a;}})});}_0x5a5b49=_[_0x4e77('0x3a')]({},_0x5a5b49,_0x70e920[_0x4e77('0x3d')]);var _0x374e6={'where':_0x5a5b49[_0x4e77('0x39')]};return db[_0x4e77('0x2c')][_0x4e77('0x1d')](_0x374e6)[_0x4e77('0x24')](function(_0x5e849c){_0x523fe5[_0x4e77('0x1d')]=_0x5e849c;if(_0x70e920[_0x4e77('0x31')][_0x4e77('0x3e')]){_0x5a5b49[_0x4e77('0x3f')]=[{'all':!![]}];}return db[_0x4e77('0x2c')]['findAll'](_0x5a5b49);})['then'](function(_0x1b435b){_0x523fe5[_0x4e77('0x40')]=_0x1b435b;return _0x523fe5;})[_0x4e77('0x24')](respondWithFilteredResult(_0x46a0b5,_0x5a5b49))['catch'](handleError(_0x46a0b5,null));};exports[_0x4e77('0x41')]=function(_0x44dda4,_0x106a98){var _0x3e57cb={'raw':!![],'where':{'id':_0x44dda4[_0x4e77('0x42')]['id']}},_0x6ebaa6={};_0x6ebaa6[_0x4e77('0x35')]=_[_0x4e77('0x32')](db[_0x4e77('0x2c')][_0x4e77('0x2d')]);_0x6ebaa6[_0x4e77('0x31')]=_['keys'](_0x44dda4[_0x4e77('0x31')]);_0x6ebaa6['filters']=_['intersection'](_0x6ebaa6[_0x4e77('0x35')],_0x6ebaa6[_0x4e77('0x31')]);_0x3e57cb['attributes']=_[_0x4e77('0x34')](_0x6ebaa6[_0x4e77('0x35')],qs[_0x4e77('0x36')](_0x44dda4['query'][_0x4e77('0x36')]));_0x3e57cb[_0x4e77('0x37')]=_0x3e57cb[_0x4e77('0x37')][_0x4e77('0x43')]?_0x3e57cb['attributes']:_0x6ebaa6[_0x4e77('0x35')];if(_0x44dda4[_0x4e77('0x31')][_0x4e77('0x3e')]){_0x3e57cb[_0x4e77('0x3f')]=[{'all':!![]}];}_0x3e57cb=_[_0x4e77('0x3a')]({},_0x3e57cb,_0x44dda4[_0x4e77('0x3d')]);return db[_0x4e77('0x2c')]['find'](_0x3e57cb)[_0x4e77('0x24')](handleEntityNotFound(_0x106a98,null))[_0x4e77('0x24')](respondWithResult(_0x106a98,null))[_0x4e77('0x44')](handleError(_0x106a98,null));};exports[_0x4e77('0x45')]=function(_0x4b58fc,_0x4943b9){return db[_0x4e77('0x2c')]['create'](_0x4b58fc[_0x4e77('0x46')],{})['then'](function(_0x48367b){var _0x44c746=_0x4b58fc['user'][_0x4e77('0x47')]({'plain':!![]});if(!_0x44c746)throw new Error(_0x4e77('0x48'));if(_0x44c746[_0x4e77('0x49')]===_0x4e77('0x4a')){var _0x11a6f8=_0x48367b[_0x4e77('0x47')]({'plain':!![]});var _0xb7fd3d=_0x4e77('0x26');return db[_0x4e77('0x4b')][_0x4e77('0x4c')]({'where':{'name':_0xb7fd3d,'userProfileId':_0x44c746[_0x4e77('0x4d')]},'raw':!![]})['then'](function(_0x258fba){if(_0x258fba&&_0x258fba['autoAssociation']===0x0){return db[_0x4e77('0x27')][_0x4e77('0x45')]({'name':_0x11a6f8[_0x4e77('0x29')],'resourceId':_0x11a6f8['id'],'type':_0x258fba[_0x4e77('0x29')],'sectionId':_0x258fba['id']},{})[_0x4e77('0x24')](function(){return _0x48367b;});}else{return _0x48367b;}})['catch'](function(_0x3a5b5c){logger[_0x4e77('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a5b5c);throw _0x3a5b5c;});}return _0x48367b;})[_0x4e77('0x24')](respondWithResult(_0x4943b9,0xc9))[_0x4e77('0x44')](handleError(_0x4943b9,null));};exports[_0x4e77('0x4f')]=function(_0x1fe6f2,_0x3cdcd8){if(_0x1fe6f2[_0x4e77('0x46')]['id']){delete _0x1fe6f2['body']['id'];}return db[_0x4e77('0x2c')][_0x4e77('0x4c')]({'where':{'id':_0x1fe6f2[_0x4e77('0x42')]['id']}})['then'](handleEntityNotFound(_0x3cdcd8,null))['then'](saveUpdates(_0x1fe6f2['body'],null))[_0x4e77('0x24')](respondWithResult(_0x3cdcd8,null))[_0x4e77('0x44')](handleError(_0x3cdcd8,null));};exports['destroy']=function(_0x2e4295,_0x2536a9){return db[_0x4e77('0x2c')]['find']({'where':{'id':_0x2e4295[_0x4e77('0x42')]['id']}})['then'](handleEntityNotFound(_0x2536a9,null))[_0x4e77('0x24')](removeEntity(_0x2536a9,null))[_0x4e77('0x44')](handleError(_0x2536a9,null));}; \ No newline at end of file +var _0x3dd6=['UserProfileResource','stack','send','index','map','Disposition','fieldName','type','model','name','query','filters','attributes','fields','length','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','intersection','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../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','limit','set','apply','save','update','then','get','Dispositions'];(function(_0x10e7f7,_0x3fb7a6){var _0x12760c=function(_0x40edc5){while(--_0x40edc5){_0x10e7f7['push'](_0x10e7f7['shift']());}};_0x12760c(++_0x3fb7a6);}(_0x3dd6,0xcf));var _0x63dd=function(_0x7c13ed,_0x4d9dd5){_0x7c13ed=_0x7c13ed-0x0;var _0x4cad66=_0x3dd6[_0x7c13ed];return _0x4cad66;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x63dd('0x0'));var rp=require(_0x63dd('0x1'));var moment=require(_0x63dd('0x2'));var BPromise=require(_0x63dd('0x3'));var Mustache=require(_0x63dd('0x4'));var util=require(_0x63dd('0x5'));var path=require('path');var sox=require(_0x63dd('0x6'));var csv=require('to-csv');var ejs=require(_0x63dd('0x7'));var fs=require('fs');var fs_extra=require(_0x63dd('0x8'));var _=require(_0x63dd('0x9'));var squel=require(_0x63dd('0xa'));var crypto=require(_0x63dd('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x63dd('0xc'));var toCsv=require(_0x63dd('0xd'));var querystring=require(_0x63dd('0xe'));var Papa=require(_0x63dd('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x63dd('0x10'));var as=require(_0x63dd('0x11'));var hardwareService=require(_0x63dd('0x12'));var logger=require(_0x63dd('0x13'))(_0x63dd('0x14'));var utils=require('../../config/utils');var config=require(_0x63dd('0x15'));var licenseUtil=require(_0x63dd('0x16'));var db=require(_0x63dd('0x17'))['db'];function respondWithStatusCode(_0x35ba9e,_0x5a75b1){_0x5a75b1=_0x5a75b1||0xcc;return function(_0x4a842d){if(_0x4a842d){return _0x35ba9e[_0x63dd('0x18')](_0x5a75b1);}return _0x35ba9e[_0x63dd('0x19')](_0x5a75b1)[_0x63dd('0x1a')]();};}function respondWithResult(_0x313f45,_0x3a0981){_0x3a0981=_0x3a0981||0xc8;return function(_0x56c030){if(_0x56c030){return _0x313f45['status'](_0x3a0981)[_0x63dd('0x1b')](_0x56c030);}};}function respondWithFilteredResult(_0xa6ffcf,_0x2bb9f6){return function(_0x4d6623){if(_0x4d6623){var _0x4144eb=typeof _0x2bb9f6[_0x63dd('0x1c')]===_0x63dd('0x1d')&&typeof _0x2bb9f6['limit']===_0x63dd('0x1d');var _0x368f85=_0x4d6623[_0x63dd('0x1e')];var _0xaf3376=_0x4144eb?0x0:_0x2bb9f6[_0x63dd('0x1c')];var _0x19f8db=_0x4144eb?_0x4d6623[_0x63dd('0x1e')]:_0x2bb9f6[_0x63dd('0x1c')]+_0x2bb9f6[_0x63dd('0x1f')];var _0x8f2691;if(_0x19f8db>=_0x368f85){_0x19f8db=_0x368f85;_0x8f2691=0xc8;}else{_0x8f2691=0xce;}_0xa6ffcf[_0x63dd('0x19')](_0x8f2691);return _0xa6ffcf[_0x63dd('0x20')]('Content-Range',_0xaf3376+'-'+_0x19f8db+'/'+_0x368f85)[_0x63dd('0x1b')](_0x4d6623);}return null;};}function patchUpdates(_0x596046){return function(_0x466dac){try{jsonpatch[_0x63dd('0x21')](_0x466dac,_0x596046,!![]);}catch(_0x22ad3d){return BPromise['reject'](_0x22ad3d);}return _0x466dac[_0x63dd('0x22')]();};}function saveUpdates(_0x38bd01,_0x4a1622){return function(_0x887c58){if(_0x887c58){return _0x887c58[_0x63dd('0x23')](_0x38bd01)[_0x63dd('0x24')](function(_0xf8bc2){return _0xf8bc2;});}return null;};}function removeEntity(_0x3fd7ec,_0x379338){return function(_0x4b2451){if(_0x4b2451){return _0x4b2451['destroy']()['then'](function(){var _0x340725=_0x4b2451[_0x63dd('0x25')]({'plain':!![]});var _0x540a9f=_0x63dd('0x26');return db[_0x63dd('0x27')]['destroy']({'where':{'type':_0x540a9f,'resourceId':_0x340725['id']}})[_0x63dd('0x24')](function(){return _0x4b2451;});})[_0x63dd('0x24')](function(){_0x3fd7ec['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2417f0,_0x474f3e){return function(_0x105618){if(!_0x105618){_0x2417f0[_0x63dd('0x18')](0x194);}return _0x105618;};}function handleError(_0x15a13d,_0x47aa25){_0x47aa25=_0x47aa25||0x1f4;return function(_0x7ca662){logger['error'](_0x7ca662[_0x63dd('0x28')]);if(_0x7ca662['name']){delete _0x7ca662['name'];}_0x15a13d[_0x63dd('0x19')](_0x47aa25)[_0x63dd('0x29')](_0x7ca662);};}exports[_0x63dd('0x2a')]=function(_0x3da8d5,_0x2734c9){var _0x452daf={},_0x5525fd={},_0x5b1ed6={'count':0x0,'rows':[]};var _0x539428=_[_0x63dd('0x2b')](db[_0x63dd('0x2c')]['rawAttributes'],function(_0x14be75){return{'name':_0x14be75[_0x63dd('0x2d')],'type':_0x14be75[_0x63dd('0x2e')]['key']};});_0x5525fd[_0x63dd('0x2f')]=_[_0x63dd('0x2b')](_0x539428,_0x63dd('0x30'));_0x5525fd[_0x63dd('0x31')]=_['keys'](_0x3da8d5['query']);_0x5525fd[_0x63dd('0x32')]=_['intersection'](_0x5525fd[_0x63dd('0x2f')],_0x5525fd[_0x63dd('0x31')]);_0x452daf[_0x63dd('0x33')]=_['intersection'](_0x5525fd[_0x63dd('0x2f')],qs[_0x63dd('0x34')](_0x3da8d5[_0x63dd('0x31')]['fields']));_0x452daf[_0x63dd('0x33')]=_0x452daf[_0x63dd('0x33')][_0x63dd('0x35')]?_0x452daf[_0x63dd('0x33')]:_0x5525fd[_0x63dd('0x2f')];if(!_0x3da8d5[_0x63dd('0x31')]['hasOwnProperty']('nolimit')){_0x452daf[_0x63dd('0x1f')]=qs[_0x63dd('0x1f')](_0x3da8d5[_0x63dd('0x31')]['limit']);_0x452daf['offset']=qs['offset'](_0x3da8d5[_0x63dd('0x31')][_0x63dd('0x1c')]);}_0x452daf[_0x63dd('0x36')]=qs[_0x63dd('0x37')](_0x3da8d5[_0x63dd('0x31')][_0x63dd('0x37')]);_0x452daf['where']=qs[_0x63dd('0x32')](_['pick'](_0x3da8d5[_0x63dd('0x31')],_0x5525fd[_0x63dd('0x32')]),_0x539428);if(_0x3da8d5[_0x63dd('0x31')][_0x63dd('0x38')]){_0x452daf[_0x63dd('0x39')]=_['merge'](_0x452daf['where'],{'$or':_[_0x63dd('0x2b')](_0x539428,function(_0x2aca73){if(_0x2aca73['type']!==_0x63dd('0x3a')){var _0x227eb8={};_0x227eb8[_0x2aca73[_0x63dd('0x30')]]={'$like':'%'+_0x3da8d5[_0x63dd('0x31')][_0x63dd('0x38')]+'%'};return _0x227eb8;}})});}_0x452daf=_[_0x63dd('0x3b')]({},_0x452daf,_0x3da8d5[_0x63dd('0x3c')]);var _0x475964={'where':_0x452daf['where']};return db[_0x63dd('0x2c')][_0x63dd('0x1e')](_0x475964)[_0x63dd('0x24')](function(_0x5e6f53){_0x5b1ed6[_0x63dd('0x1e')]=_0x5e6f53;if(_0x3da8d5[_0x63dd('0x31')][_0x63dd('0x3d')]){_0x452daf[_0x63dd('0x3e')]=[{'all':!![]}];}return db[_0x63dd('0x2c')][_0x63dd('0x3f')](_0x452daf);})[_0x63dd('0x24')](function(_0x55dc09){_0x5b1ed6[_0x63dd('0x40')]=_0x55dc09;return _0x5b1ed6;})[_0x63dd('0x24')](respondWithFilteredResult(_0x2734c9,_0x452daf))['catch'](handleError(_0x2734c9,null));};exports[_0x63dd('0x41')]=function(_0x1ebd3d,_0x3d7793){var _0x1349cd={'raw':!![],'where':{'id':_0x1ebd3d[_0x63dd('0x42')]['id']}},_0x46c0e2={};_0x46c0e2[_0x63dd('0x2f')]=_[_0x63dd('0x43')](db[_0x63dd('0x2c')][_0x63dd('0x44')]);_0x46c0e2['query']=_[_0x63dd('0x43')](_0x1ebd3d[_0x63dd('0x31')]);_0x46c0e2[_0x63dd('0x32')]=_['intersection'](_0x46c0e2[_0x63dd('0x2f')],_0x46c0e2['query']);_0x1349cd[_0x63dd('0x33')]=_[_0x63dd('0x45')](_0x46c0e2[_0x63dd('0x2f')],qs[_0x63dd('0x34')](_0x1ebd3d[_0x63dd('0x31')][_0x63dd('0x34')]));_0x1349cd[_0x63dd('0x33')]=_0x1349cd[_0x63dd('0x33')][_0x63dd('0x35')]?_0x1349cd[_0x63dd('0x33')]:_0x46c0e2['model'];if(_0x1ebd3d['query']['includeAll']){_0x1349cd['include']=[{'all':!![]}];}_0x1349cd=_[_0x63dd('0x3b')]({},_0x1349cd,_0x1ebd3d[_0x63dd('0x3c')]);return db[_0x63dd('0x2c')][_0x63dd('0x46')](_0x1349cd)['then'](handleEntityNotFound(_0x3d7793,null))[_0x63dd('0x24')](respondWithResult(_0x3d7793,null))[_0x63dd('0x47')](handleError(_0x3d7793,null));};exports[_0x63dd('0x48')]=function(_0x53c856,_0x18b40e){return db['Disposition'][_0x63dd('0x48')](_0x53c856[_0x63dd('0x49')],{})[_0x63dd('0x24')](function(_0xd379d3){var _0x2d009c=_0x53c856[_0x63dd('0x4a')][_0x63dd('0x25')]({'plain':!![]});if(!_0x2d009c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d009c[_0x63dd('0x4b')]===_0x63dd('0x4a')){var _0x5b9014=_0xd379d3[_0x63dd('0x25')]({'plain':!![]});var _0x78b332='Dispositions';return db[_0x63dd('0x4c')]['find']({'where':{'name':_0x78b332,'userProfileId':_0x2d009c[_0x63dd('0x4d')]},'raw':!![]})[_0x63dd('0x24')](function(_0x51cf0e){if(_0x51cf0e&&_0x51cf0e[_0x63dd('0x4e')]===0x0){return db[_0x63dd('0x27')][_0x63dd('0x48')]({'name':_0x5b9014[_0x63dd('0x30')],'resourceId':_0x5b9014['id'],'type':_0x51cf0e[_0x63dd('0x30')],'sectionId':_0x51cf0e['id']},{})[_0x63dd('0x24')](function(){return _0xd379d3;});}else{return _0xd379d3;}})['catch'](function(_0x2d6046){logger[_0x63dd('0x4f')](_0x63dd('0x50'),_0x2d6046);throw _0x2d6046;});}return _0xd379d3;})['then'](respondWithResult(_0x18b40e,0xc9))['catch'](handleError(_0x18b40e,null));};exports[_0x63dd('0x23')]=function(_0x4bd1e8,_0x1897c0){if(_0x4bd1e8[_0x63dd('0x49')]['id']){delete _0x4bd1e8[_0x63dd('0x49')]['id'];}return db[_0x63dd('0x2c')]['find']({'where':{'id':_0x4bd1e8[_0x63dd('0x42')]['id']}})['then'](handleEntityNotFound(_0x1897c0,null))[_0x63dd('0x24')](saveUpdates(_0x4bd1e8['body'],null))[_0x63dd('0x24')](respondWithResult(_0x1897c0,null))[_0x63dd('0x47')](handleError(_0x1897c0,null));};exports[_0x63dd('0x51')]=function(_0x4e35c1,_0x2abf47){return db[_0x63dd('0x2c')][_0x63dd('0x46')]({'where':{'id':_0x4e35c1['params']['id']}})[_0x63dd('0x24')](handleEntityNotFound(_0x2abf47,null))[_0x63dd('0x24')](removeEntity(_0x2abf47,null))[_0x63dd('0x47')](handleError(_0x2abf47,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index c5d9a51..eebecbe 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 _0x36cc=['name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','name_fax','FaxAccountId','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./disposition.attributes','exports','tools_dispositions','name','ListId'];(function(_0x4da9c0,_0x40e9ff){var _0x70005e=function(_0x2ab2f7){while(--_0x2ab2f7){_0x4da9c0['push'](_0x4da9c0['shift']());}};_0x70005e(++_0x40e9ff);}(_0x36cc,0x1d6));var _0xc36c=function(_0x50303e,_0x3a18d6){_0x50303e=_0x50303e-0x0;var _0xc35f3a=_0x36cc[_0x50303e];return _0xc35f3a;};'use strict';var _=require(_0xc36c('0x0'));var util=require(_0xc36c('0x1'));var logger=require(_0xc36c('0x2'))(_0xc36c('0x3'));var moment=require(_0xc36c('0x4'));var BPromise=require('bluebird');var rp=require(_0xc36c('0x5'));var fs=require('fs');var path=require(_0xc36c('0x6'));var rimraf=require(_0xc36c('0x7'));var config=require('../../config/environment');var attributes=require(_0xc36c('0x8'));module[_0xc36c('0x9')]=function(_0x3c2f5b,_0x331e4a){return _0x3c2f5b['define']('Disposition',attributes,{'tableName':_0xc36c('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xc36c('0xb'),_0xc36c('0xc')]},{'unique':!![],'name':_0xc36c('0xd'),'fields':['name',_0xc36c('0xe')]},{'unique':!![],'name':_0xc36c('0xf'),'fields':[_0xc36c('0xb'),_0xc36c('0x10')]},{'unique':!![],'name':_0xc36c('0x11'),'fields':[_0xc36c('0xb'),'SmsAccountId']},{'unique':!![],'name':_0xc36c('0x12'),'fields':[_0xc36c('0xb'),_0xc36c('0x13')]},{'unique':!![],'name':'name_openchannel','fields':[_0xc36c('0xb'),_0xc36c('0x14')]},{'unique':!![],'name':_0xc36c('0x15'),'fields':['name',_0xc36c('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbb76=['ChatWebsiteId','name_mail','MailAccountId','name_sms','name','SmsAccountId','name_fax','FaxAccountId','name_openchannel','name_whatsapp','WhatsappAccountId','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','name_voice','ListId'];(function(_0x137d1d,_0x35c663){var _0x485108=function(_0x108a2a){while(--_0x108a2a){_0x137d1d['push'](_0x137d1d['shift']());}};_0x485108(++_0x35c663);}(_0xbb76,0x1b4));var _0x6bb7=function(_0x32e4de,_0x7da1c5){_0x32e4de=_0x32e4de-0x0;var _0x51ba2a=_0xbb76[_0x32e4de];return _0x51ba2a;};'use strict';var _=require(_0x6bb7('0x0'));var util=require(_0x6bb7('0x1'));var logger=require('../../config/logger')(_0x6bb7('0x2'));var moment=require(_0x6bb7('0x3'));var BPromise=require(_0x6bb7('0x4'));var rp=require(_0x6bb7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6bb7('0x6'));var config=require(_0x6bb7('0x7'));var attributes=require(_0x6bb7('0x8'));module[_0x6bb7('0x9')]=function(_0x44d6df,_0x3a1756){return _0x44d6df[_0x6bb7('0xa')](_0x6bb7('0xb'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x6bb7('0xc'),'fields':['name',_0x6bb7('0xd')]},{'unique':!![],'name':'name_chat','fields':['name',_0x6bb7('0xe')]},{'unique':!![],'name':_0x6bb7('0xf'),'fields':['name',_0x6bb7('0x10')]},{'unique':!![],'name':_0x6bb7('0x11'),'fields':[_0x6bb7('0x12'),_0x6bb7('0x13')]},{'unique':!![],'name':_0x6bb7('0x14'),'fields':['name',_0x6bb7('0x15')]},{'unique':!![],'name':_0x6bb7('0x16'),'fields':[_0x6bb7('0x12'),'OpenchannelAccountId']},{'unique':!![],'name':_0x6bb7('0x17'),'fields':['name',_0x6bb7('0x18')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 64a8cb3..02ad6cb 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(_0x296796,_0x2e1cee){var _0x40dcb5=function(_0x198fd0){while(--_0x198fd0){_0x296796['push'](_0x296796['shift']());}};_0x40dcb5(++_0x2e1cee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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(_0x4ce032,_0x436cad){var _0x47591e=function(_0x4d5839){while(--_0x4d5839){_0x4ce032['push'](_0x4ce032['shift']());}};_0x47591e(++_0x436cad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index e1b2c2b..234b3f2 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 _0xdafd=['show','create','put','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id'];(function(_0x2be1d6,_0x6ee010){var _0xea43e4=function(_0x2390be){while(--_0x2390be){_0x2be1d6['push'](_0x2be1d6['shift']());}};_0xea43e4(++_0x6ee010);}(_0xdafd,0x1e1));var _0xddaf=function(_0x2a78f8,_0x2d4c2f){_0x2a78f8=_0x2a78f8-0x0;var _0x272457=_0xdafd[_0x2a78f8];return _0x272457;};'use strict';var multer=require(_0xddaf('0x0'));var util=require(_0xddaf('0x1'));var path=require(_0xddaf('0x2'));var timeout=require(_0xddaf('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xddaf('0x4'));var auth=require(_0xddaf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xddaf('0x6'));var controller=require(_0xddaf('0x7'));router[_0xddaf('0x8')]('/',auth[_0xddaf('0x9')](),controller[_0xddaf('0xa')]);router[_0xddaf('0x8')](_0xddaf('0xb'),auth[_0xddaf('0x9')](),controller[_0xddaf('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xddaf('0xd')]);router[_0xddaf('0xe')](_0xddaf('0xb'),auth[_0xddaf('0x9')](),controller['update']);router[_0xddaf('0xf')](_0xddaf('0xb'),auth[_0xddaf('0x9')](),controller[_0xddaf('0x10')]);module['exports']=router; \ No newline at end of file +var _0x97b1=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','post','isAuthenticated','put','delete','destroy','exports','multer'];(function(_0xcfb35b,_0x503651){var _0x3a5518=function(_0x440d6d){while(--_0x440d6d){_0xcfb35b['push'](_0xcfb35b['shift']());}};_0x3a5518(++_0x503651);}(_0x97b1,0x6b));var _0x197b=function(_0x4cc492,_0x162c85){_0x4cc492=_0x4cc492-0x0;var _0x1f36b9=_0x97b1[_0x4cc492];return _0x1f36b9;};'use strict';var multer=require(_0x197b('0x0'));var util=require(_0x197b('0x1'));var path=require(_0x197b('0x2'));var timeout=require(_0x197b('0x3'));var express=require('express');var router=express[_0x197b('0x4')]();var fs_extra=require(_0x197b('0x5'));var auth=require(_0x197b('0x6'));var interaction=require(_0x197b('0x7'));var config=require(_0x197b('0x8'));var controller=require('./disposition.controller');router[_0x197b('0x9')]('/',auth['isAuthenticated'](),controller[_0x197b('0xa')]);router[_0x197b('0x9')](_0x197b('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x197b('0xc')]('/',auth[_0x197b('0xd')](),controller['create']);router[_0x197b('0xe')](_0x197b('0xb'),auth[_0x197b('0xd')](),controller['update']);router[_0x197b('0xf')](_0x197b('0xb'),auth[_0x197b('0xd')](),controller[_0x197b('0x10')]);module[_0x197b('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 3550342..32f2054 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 _0x407f=['14400','v17,v27,v29','INTEGER','DADHI','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000'];(function(_0x23222c,_0x5d51b2){var _0x3c20f1=function(_0x16068f){while(--_0x16068f){_0x23222c['push'](_0x23222c['shift']());}};_0x3c20f1(++_0x5d51b2);}(_0x407f,0x8a));var _0xf407=function(_0x43b1e4,_0x53fd36){_0x43b1e4=_0x43b1e4-0x0;var _0xfb9e75=_0x407f[_0x43b1e4];return _0xfb9e75;};'use strict';var Sequelize=require(_0xf407('0x0'));module[_0xf407('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf407('0x2')]},'ecm':{'type':Sequelize[_0xf407('0x3')](_0xf407('0x4'),'no'),'defaultValue':_0xf407('0x4')},'headerinfo':{'type':Sequelize[_0xf407('0x2')],'defaultValue':_0xf407('0x5')},'localstationid':{'type':Sequelize[_0xf407('0x2')],'unique':_0xf407('0x6')},'minrate':{'type':Sequelize[_0xf407('0x3')](_0xf407('0x7'),_0xf407('0x8'),_0xf407('0x9'),_0xf407('0xa'),_0xf407('0xb'),_0xf407('0xc')),'defaultValue':_0xf407('0x8')},'maxrate':{'type':Sequelize[_0xf407('0x3')](_0xf407('0x7'),_0xf407('0x8'),_0xf407('0x9'),_0xf407('0xa'),_0xf407('0xb'),_0xf407('0xc')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0xf407('0x2')],'defaultValue':_0xf407('0xd')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xf407('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xf407('0x3')]('SIP','IAX',_0xf407('0xf'),'KHOMP'),'defaultValue':_0xf407('0x10')},'key':{'type':Sequelize[_0xf407('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xf407('0x11')],'defaultValue':function(){return _0xf407('0x12');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf407('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf407('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf407('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf407('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf407('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xf407('0x14')},'mandatoryDisposition':{'type':Sequelize[_0xf407('0x13')],'defaultValue':![],'comment':_0xf407('0x15'),'set':function(_0x5415f5){if(!_0x5415f5)this[_0xf407('0x16')](_0xf407('0x17'),null);this[_0xf407('0x16')](_0xf407('0x18'),_0x5415f5);}}}; \ No newline at end of file +var _0x396d=['yes','xCALLY\x20Motion\x20Fax','localstationid','2400','9600','12000','4800','7200','14400','INTEGER','SIP','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x396d,0x6f));var _0xd396=function(_0x1631e3,_0xc68170){_0x1631e3=_0x1631e3-0x0;var _0x2e9a1a=_0x396d[_0x1631e3];return _0x2e9a1a;};'use strict';var Sequelize=require(_0xd396('0x0'));module[_0xd396('0x1')]={'name':{'type':Sequelize[_0xd396('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd396('0x2')]},'ecm':{'type':Sequelize[_0xd396('0x3')](_0xd396('0x4'),'no'),'defaultValue':_0xd396('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0xd396('0x5')},'localstationid':{'type':Sequelize[_0xd396('0x2')],'unique':_0xd396('0x6')},'minrate':{'type':Sequelize['ENUM'](_0xd396('0x7'),'4800','7200',_0xd396('0x8'),_0xd396('0x9'),'14400'),'defaultValue':_0xd396('0xa')},'maxrate':{'type':Sequelize[_0xd396('0x3')](_0xd396('0x7'),_0xd396('0xa'),_0xd396('0xb'),_0xd396('0x8'),_0xd396('0x9'),'14400'),'defaultValue':_0xd396('0xc')},'modem':{'type':Sequelize[_0xd396('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0xd396('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xd396('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xd396('0x3')](_0xd396('0xe'),'IAX',_0xd396('0xf'),_0xd396('0x10')),'defaultValue':'SIP'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xd396('0x11')],'defaultValue':function(){return _0xd396('0x12');}},'notificationSound':{'type':Sequelize[_0xd396('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd396('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd396('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd396('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd396('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd396('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd396('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd396('0xd')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xd396('0x13')],'defaultValue':![],'comment':_0xd396('0x14'),'set':function(_0x420395){if(!_0x420395)this[_0xd396('0x15')]('mandatoryDispositionPauseId',null);this[_0xd396('0x15')](_0xd396('0x16'),_0x420395);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 9499208..f89112a 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 _0x1fc4=['CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','CmContact','defaults','filename','Messages','Contact\x20not\x20found','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','removeAgents','userFaxAccount:remove','getAgents','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','register','jayson/promise','client','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','json','offset','undefined','count','limit','status','Content-Range','reject','save','update','get','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','FaxAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','order','removeAnswers','FaxInteraction','addInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tag','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','exten','localstationid','app','system','Fax\x20Extension','appdata','push','Answer','Set','ecm','gateway','faxdetect','maxrate','minrate','t38timeout','FAXOPT(','ReceiveFax','addAccountApplications','updateAccountApplications','VoiceExtension','tech','createdAt','updatedAt','TrunkId','ListId','findById','FaxMessage','$gte','split','format','List','Contacts','DESC','attachments','join','server/files/attachments','basename'];(function(_0x312835,_0xff273e){var _0x1da8b9=function(_0x193c4){while(--_0x193c4){_0x312835['push'](_0x312835['shift']());}};_0x1da8b9(++_0xff273e);}(_0x1fc4,0xd3));var _0x41fc=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x1fc4[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0x41fc('0x0'));var rimraf=require(_0x41fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x41fc('0x2'));var moment=require(_0x41fc('0x3'));var BPromise=require(_0x41fc('0x4'));var Mustache=require(_0x41fc('0x5'));var util=require(_0x41fc('0x6'));var path=require(_0x41fc('0x7'));var sox=require(_0x41fc('0x8'));var csv=require(_0x41fc('0x9'));var ejs=require(_0x41fc('0xa'));var fs=require('fs');var fs_extra=require(_0x41fc('0xb'));var _=require('lodash');var squel=require(_0x41fc('0xc'));var crypto=require('crypto');var jsforce=require(_0x41fc('0xd'));var deskjs=require(_0x41fc('0xe'));var toCsv=require(_0x41fc('0x9'));var querystring=require(_0x41fc('0xf'));var Papa=require('papaparse');var Redis=require(_0x41fc('0x10'));var authService=require(_0x41fc('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x41fc('0x12'));var hardwareService=require(_0x41fc('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x41fc('0x14'));var config=require(_0x41fc('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x41fc('0x16'))['db'];config[_0x41fc('0x17')]=_['defaults'](config[_0x41fc('0x17')],{'host':_0x41fc('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x41fc('0x17')]));require('./faxAccount.socket')[_0x41fc('0x19')](socket);var jayson=require(_0x41fc('0x1a'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x41fc('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22ccff,_0x52b02a,_0x17cfd3,_0x3fe436){return new BPromise(function(_0x47e2f4,_0x17f302){var _0x53df80=_0x3fe436||client;return _0x53df80['request'](_0x22ccff,_0x17cfd3)[_0x41fc('0x1c')](function(_0x175ef1){logger[_0x41fc('0x1d')](_0x41fc('0x1e'),_0x52b02a,_0x41fc('0x1f'));logger[_0x41fc('0x20')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x52b02a,_0x41fc('0x1f'),JSON[_0x41fc('0x21')](_0x175ef1));if(_0x175ef1['error']){if(_0x175ef1[_0x41fc('0x22')][_0x41fc('0x23')]===0x1f4){logger[_0x41fc('0x22')]('FaxAccount,\x20%s,\x20%s',_0x52b02a,_0x175ef1[_0x41fc('0x22')][_0x41fc('0x24')]);return _0x17f302(_0x175ef1[_0x41fc('0x22')][_0x41fc('0x24')]);}logger['error'](_0x41fc('0x1e'),_0x52b02a,_0x175ef1[_0x41fc('0x22')][_0x41fc('0x24')]);return _0x47e2f4(_0x175ef1['error'][_0x41fc('0x24')]);}else{logger['info'](_0x41fc('0x1e'),_0x52b02a,_0x41fc('0x1f'));_0x47e2f4(_0x175ef1[_0x41fc('0x25')][_0x41fc('0x24')]);}})[_0x41fc('0x26')](function(_0x29effe){logger[_0x41fc('0x22')]('FaxAccount,\x20%s,\x20%s',_0x52b02a,_0x29effe);_0x17f302(_0x29effe);});});}function respondWithStatusCode(_0x272ca1,_0x10ea28){_0x10ea28=_0x10ea28||0xcc;return function(_0x1dbb09){if(_0x1dbb09){return _0x272ca1[_0x41fc('0x27')](_0x10ea28);}return _0x272ca1['status'](_0x10ea28)[_0x41fc('0x28')]();};}function respondWithResult(_0x109043,_0x486a0f){_0x486a0f=_0x486a0f||0xc8;return function(_0x44be2a){if(_0x44be2a){return _0x109043['status'](_0x486a0f)[_0x41fc('0x29')](_0x44be2a);}};}function respondWithFilteredResult(_0x496403,_0x18b6d2){return function(_0x521652){if(_0x521652){var _0x48b901=typeof _0x18b6d2[_0x41fc('0x2a')]===_0x41fc('0x2b')&&typeof _0x18b6d2['limit']===_0x41fc('0x2b');var _0x176979=_0x521652[_0x41fc('0x2c')];var _0xcb072d=_0x48b901?0x0:_0x18b6d2['offset'];var _0x42f3ba=_0x48b901?_0x521652[_0x41fc('0x2c')]:_0x18b6d2[_0x41fc('0x2a')]+_0x18b6d2[_0x41fc('0x2d')];var _0x28c46b;if(_0x42f3ba>=_0x176979){_0x42f3ba=_0x176979;_0x28c46b=0xc8;}else{_0x28c46b=0xce;}_0x496403[_0x41fc('0x2e')](_0x28c46b);return _0x496403['set'](_0x41fc('0x2f'),_0xcb072d+'-'+_0x42f3ba+'/'+_0x176979)[_0x41fc('0x29')](_0x521652);}return null;};}function patchUpdates(_0x41e587){return function(_0x427779){try{jsonpatch['apply'](_0x427779,_0x41e587,!![]);}catch(_0x31a841){return BPromise[_0x41fc('0x30')](_0x31a841);}return _0x427779[_0x41fc('0x31')]();};}function saveUpdates(_0x45896f,_0x403f53){return function(_0x332df4){if(_0x332df4){return _0x332df4[_0x41fc('0x32')](_0x45896f)[_0x41fc('0x1c')](function(_0x5f0a8b){return _0x5f0a8b;});}return null;};}function removeEntity(_0x2b9e94,_0x31f47d){return function(_0x54621b){if(_0x54621b){return _0x54621b['destroy']()['then'](function(){var _0x49c17c=_0x54621b[_0x41fc('0x33')]({'plain':!![]});var _0x5ba0ce='FaxAccounts';return db[_0x41fc('0x34')][_0x41fc('0x35')]({'where':{'type':_0x5ba0ce,'resourceId':_0x49c17c['id']}})['then'](function(){return _0x54621b;});})['then'](function(){_0x2b9e94['status'](0xcc)[_0x41fc('0x28')]();});}};}function handleEntityNotFound(_0x1371e4,_0x5cedcb){return function(_0x16cb8d){if(!_0x16cb8d){_0x1371e4[_0x41fc('0x27')](0x194);}return _0x16cb8d;};}function handleError(_0x363fce,_0xd1e45){_0xd1e45=_0xd1e45||0x1f4;return function(_0x459d69){logger[_0x41fc('0x22')](_0x459d69[_0x41fc('0x36')]);if(_0x459d69[_0x41fc('0x37')]){delete _0x459d69[_0x41fc('0x37')];}_0x363fce[_0x41fc('0x2e')](_0xd1e45)[_0x41fc('0x38')](_0x459d69);};}exports[_0x41fc('0x39')]=function(_0x374da1,_0x390d91){var _0x4b2575={'include':[{'model':db[_0x41fc('0x3a')],'as':_0x41fc('0x3b')}]},_0x55eebb={},_0xa267aa={'count':0x0,'rows':[]};var _0x2e9a9a=_[_0x41fc('0x3c')](db[_0x41fc('0x3d')][_0x41fc('0x3e')],function(_0x2ed761){return{'name':_0x2ed761[_0x41fc('0x3f')],'type':_0x2ed761['type'][_0x41fc('0x40')]};});_0x55eebb[_0x41fc('0x41')]=_[_0x41fc('0x3c')](_0x2e9a9a,_0x41fc('0x37'));_0x55eebb[_0x41fc('0x42')]=_[_0x41fc('0x43')](_0x374da1[_0x41fc('0x42')]);_0x55eebb[_0x41fc('0x44')]=_[_0x41fc('0x45')](_0x55eebb['model'],_0x55eebb[_0x41fc('0x42')]);_0x4b2575['attributes']=_['intersection'](_0x55eebb[_0x41fc('0x41')],qs[_0x41fc('0x46')](_0x374da1[_0x41fc('0x42')][_0x41fc('0x46')]));_0x4b2575[_0x41fc('0x47')]=_0x4b2575[_0x41fc('0x47')][_0x41fc('0x48')]?_0x4b2575['attributes']:_0x55eebb['model'];if(!_0x374da1[_0x41fc('0x42')]['hasOwnProperty'](_0x41fc('0x49'))){_0x4b2575[_0x41fc('0x2d')]=qs['limit'](_0x374da1['query'][_0x41fc('0x2d')]);_0x4b2575[_0x41fc('0x2a')]=qs['offset'](_0x374da1[_0x41fc('0x42')][_0x41fc('0x2a')]);}_0x4b2575['order']=qs[_0x41fc('0x4a')](_0x374da1[_0x41fc('0x42')][_0x41fc('0x4a')]);_0x4b2575[_0x41fc('0x4b')]=qs['filters'](_[_0x41fc('0x4c')](_0x374da1[_0x41fc('0x42')],_0x55eebb[_0x41fc('0x44')]),_0x2e9a9a);if(_0x374da1[_0x41fc('0x42')]['filter']){_0x4b2575[_0x41fc('0x4b')]=_[_0x41fc('0x4d')](_0x4b2575[_0x41fc('0x4b')],{'$or':_[_0x41fc('0x3c')](_0x2e9a9a,function(_0x2adccd){if(_0x2adccd[_0x41fc('0x4e')]!=='VIRTUAL'){var _0x4ba04b={};_0x4ba04b[_0x2adccd[_0x41fc('0x37')]]={'$like':'%'+_0x374da1[_0x41fc('0x42')][_0x41fc('0x4f')]+'%'};return _0x4ba04b;}})});}_0x4b2575=_[_0x41fc('0x4d')]({},_0x4b2575,_0x374da1[_0x41fc('0x50')]);var _0x4e6e12={'where':_0x4b2575[_0x41fc('0x4b')]};return db[_0x41fc('0x3d')]['count'](_0x4e6e12)[_0x41fc('0x1c')](function(_0x10865a){_0xa267aa['count']=_0x10865a;if(_0x374da1[_0x41fc('0x42')][_0x41fc('0x51')]){_0x4b2575[_0x41fc('0x52')]=[{'all':!![]}];}return db['FaxAccount'][_0x41fc('0x53')](_0x4b2575);})['then'](function(_0x5d957d){_0xa267aa[_0x41fc('0x54')]=_0x5d957d;return _0xa267aa;})[_0x41fc('0x1c')](respondWithFilteredResult(_0x390d91,_0x4b2575))[_0x41fc('0x26')](handleError(_0x390d91,null));};exports[_0x41fc('0x55')]=function(_0x3a4688,_0x4adfbe){var _0x398956={'raw':![],'where':{'id':_0x3a4688[_0x41fc('0x56')]['id']},'include':[{'model':db[_0x41fc('0x3a')],'as':_0x41fc('0x3b')}]},_0x52e013={};_0x52e013[_0x41fc('0x41')]=_[_0x41fc('0x43')](db['FaxAccount'][_0x41fc('0x3e')]);_0x52e013['query']=_[_0x41fc('0x43')](_0x3a4688[_0x41fc('0x42')]);_0x52e013[_0x41fc('0x44')]=_['intersection'](_0x52e013[_0x41fc('0x41')],_0x52e013[_0x41fc('0x42')]);_0x398956[_0x41fc('0x47')]=_[_0x41fc('0x45')](_0x52e013[_0x41fc('0x41')],qs[_0x41fc('0x46')](_0x3a4688[_0x41fc('0x42')][_0x41fc('0x46')]));_0x398956[_0x41fc('0x47')]=_0x398956['attributes'][_0x41fc('0x48')]?_0x398956[_0x41fc('0x47')]:_0x52e013[_0x41fc('0x41')];if(_0x3a4688[_0x41fc('0x42')][_0x41fc('0x51')]){_0x398956['include']=[{'all':!![]}];}_0x398956=_[_0x41fc('0x4d')]({},_0x398956,_0x3a4688[_0x41fc('0x50')]);return db[_0x41fc('0x3d')][_0x41fc('0x57')](_0x398956)['then'](handleEntityNotFound(_0x4adfbe,null))[_0x41fc('0x1c')](respondWithResult(_0x4adfbe,null))[_0x41fc('0x26')](handleError(_0x4adfbe,null));};exports[_0x41fc('0x58')]=function(_0x2a6d74,_0x25a4ed){return db[_0x41fc('0x3d')][_0x41fc('0x58')](_0x2a6d74[_0x41fc('0x59')],{})[_0x41fc('0x1c')](function(_0x76554b){var _0x47b6e4=_0x2a6d74[_0x41fc('0x5a')][_0x41fc('0x33')]({'plain':!![]});if(!_0x47b6e4)throw new Error(_0x41fc('0x5b'));if(_0x47b6e4[_0x41fc('0x5c')]==='user'){var _0xc32ad=_0x76554b[_0x41fc('0x33')]({'plain':!![]});var _0x324a79=_0x41fc('0x5d');return db[_0x41fc('0x5e')]['find']({'where':{'name':_0x324a79,'userProfileId':_0x47b6e4[_0x41fc('0x5f')]},'raw':!![]})['then'](function(_0x211b6a){if(_0x211b6a&&_0x211b6a[_0x41fc('0x60')]===0x0){return db[_0x41fc('0x34')]['create']({'name':_0xc32ad['name'],'resourceId':_0xc32ad['id'],'type':_0x211b6a[_0x41fc('0x37')],'sectionId':_0x211b6a['id']},{})[_0x41fc('0x1c')](function(){return _0x76554b;});}else{return _0x76554b;}})[_0x41fc('0x26')](function(_0x1e677a){logger['error'](_0x41fc('0x61'),_0x1e677a);throw _0x1e677a;});}return _0x76554b;})[_0x41fc('0x1c')](respondWithResult(_0x25a4ed,0xc9))[_0x41fc('0x26')](handleError(_0x25a4ed,null));};exports['update']=function(_0x4ce206,_0x2a5a26){if(_0x4ce206[_0x41fc('0x59')]['id']){delete _0x4ce206[_0x41fc('0x59')]['id'];}return db[_0x41fc('0x3d')][_0x41fc('0x57')]({'where':{'id':_0x4ce206[_0x41fc('0x56')]['id']},'include':[{'model':db[_0x41fc('0x3a')],'as':_0x41fc('0x3b')}]})[_0x41fc('0x1c')](handleEntityNotFound(_0x2a5a26,null))[_0x41fc('0x1c')](saveUpdates(_0x4ce206['body'],null))[_0x41fc('0x1c')](respondWithResult(_0x2a5a26,null))[_0x41fc('0x26')](handleError(_0x2a5a26,null));};exports['destroy']=function(_0x494dc4,_0x2afdd0){return db[_0x41fc('0x3d')][_0x41fc('0x57')]({'where':{'id':_0x494dc4[_0x41fc('0x56')]['id']}})[_0x41fc('0x1c')](handleEntityNotFound(_0x2afdd0,null))[_0x41fc('0x1c')](removeEntity(_0x2afdd0,null))[_0x41fc('0x26')](handleError(_0x2afdd0,null));};exports[_0x41fc('0x62')]=function(_0x2d6415,_0x5e6e48){return db['FaxAccount'][_0x41fc('0x62')]()['then'](respondWithResult(_0x5e6e48,null))['catch'](handleError(_0x5e6e48,null));};exports['addDisposition']=function(_0x1352fc,_0x4669b8,_0x1ae428){if(_0x1352fc[_0x41fc('0x59')]['id']){delete _0x1352fc[_0x41fc('0x59')]['id'];}return db[_0x41fc('0x3d')][_0x41fc('0x57')]({'where':{'id':_0x1352fc[_0x41fc('0x56')]['id']}})['then'](handleEntityNotFound(_0x4669b8,null))[_0x41fc('0x1c')](function(_0x3f076c){if(_0x3f076c){_0x1352fc[_0x41fc('0x59')][_0x41fc('0x63')]=_0x3f076c['id'];return db[_0x41fc('0x64')][_0x41fc('0x58')](_0x1352fc[_0x41fc('0x59')]);}})[_0x41fc('0x1c')](respondWithResult(_0x4669b8,null))[_0x41fc('0x26')](handleError(_0x4669b8,null));};exports[_0x41fc('0x65')]=function(_0x480ddb,_0x2ac7af,_0x35e066){var _0x39a6fb={'raw':![],'where':{}};var _0x42d566={};var _0x4ba71b={'count':0x0,'rows':[]};return db[_0x41fc('0x3d')][_0x41fc('0x66')]({'where':{'id':_0x480ddb[_0x41fc('0x56')]['id']}})[_0x41fc('0x1c')](handleEntityNotFound(_0x2ac7af,null))[_0x41fc('0x1c')](function(_0x10cf88){if(_0x10cf88){_0x42d566[_0x41fc('0x41')]=_['keys'](db['Disposition'][_0x41fc('0x3e')]);_0x42d566[_0x41fc('0x42')]=_['keys'](_0x480ddb[_0x41fc('0x42')]);_0x42d566['filters']=_[_0x41fc('0x45')](_0x42d566['model'],_0x42d566[_0x41fc('0x42')]);_0x39a6fb['attributes']=_[_0x41fc('0x45')](_0x42d566['model'],qs['fields'](_0x480ddb[_0x41fc('0x42')][_0x41fc('0x46')]));_0x39a6fb[_0x41fc('0x47')]=_0x39a6fb['attributes'][_0x41fc('0x48')]?_0x39a6fb[_0x41fc('0x47')]:_0x42d566[_0x41fc('0x41')];if(!_0x480ddb[_0x41fc('0x42')]['hasOwnProperty'](_0x41fc('0x49'))){_0x39a6fb['limit']=qs[_0x41fc('0x2d')](_0x480ddb[_0x41fc('0x42')]['limit']);_0x39a6fb[_0x41fc('0x2a')]=qs[_0x41fc('0x2a')](_0x480ddb[_0x41fc('0x42')]['offset']);}_0x39a6fb['order']=qs['sort'](_0x480ddb['query'][_0x41fc('0x4a')]);_0x39a6fb[_0x41fc('0x4b')]=qs[_0x41fc('0x44')](_['pick'](_0x480ddb[_0x41fc('0x42')],_0x42d566[_0x41fc('0x44')]));_0x39a6fb[_0x41fc('0x4b')][_0x41fc('0x63')]=_0x10cf88['id'];if(_0x480ddb[_0x41fc('0x42')][_0x41fc('0x4f')]){_0x39a6fb['where']=_[_0x41fc('0x4d')](_0x39a6fb[_0x41fc('0x4b')],{'$or':_[_0x41fc('0x3c')](_0x39a6fb[_0x41fc('0x47')],function(_0x1990cf){var _0x5cbb80={};_0x5cbb80[_0x1990cf]={'$like':'%'+_0x480ddb[_0x41fc('0x42')][_0x41fc('0x4f')]+'%'};return _0x5cbb80;})});}_0x39a6fb=_[_0x41fc('0x4d')]({},_0x39a6fb,_0x480ddb[_0x41fc('0x50')]);return db[_0x41fc('0x64')][_0x41fc('0x2c')]({'where':_0x39a6fb[_0x41fc('0x4b')]})[_0x41fc('0x1c')](function(_0x21b9c2){_0x4ba71b['count']=_0x21b9c2;if(_0x480ddb['query'][_0x41fc('0x51')]){_0x39a6fb[_0x41fc('0x52')]=[{'all':!![]}];}return db[_0x41fc('0x64')][_0x41fc('0x53')](_0x39a6fb);})[_0x41fc('0x1c')](function(_0x20df13){_0x4ba71b[_0x41fc('0x54')]=_0x20df13;return _0x4ba71b;});}})[_0x41fc('0x1c')](respondWithFilteredResult(_0x2ac7af,_0x39a6fb))[_0x41fc('0x26')](handleError(_0x2ac7af,null));};exports[_0x41fc('0x67')]=function(_0x2d44d3,_0x2290e5,_0x4b9a26){return db[_0x41fc('0x3d')][_0x41fc('0x57')]({'where':{'id':_0x2d44d3[_0x41fc('0x56')]['id']}})['then'](handleEntityNotFound(_0x2290e5,null))[_0x41fc('0x1c')](function(_0xd1d84e){if(_0xd1d84e){return _0xd1d84e[_0x41fc('0x67')](_0x2d44d3[_0x41fc('0x42')][_0x41fc('0x68')]);}})[_0x41fc('0x1c')](respondWithStatusCode(_0x2290e5,null))[_0x41fc('0x26')](handleError(_0x2290e5,null));};exports[_0x41fc('0x69')]=function(_0x467f4f,_0x2b635c,_0x284704){if(_0x467f4f[_0x41fc('0x59')]['id']){delete _0x467f4f['body']['id'];}return db[_0x41fc('0x3d')][_0x41fc('0x57')]({'where':{'id':_0x467f4f[_0x41fc('0x56')]['id']}})[_0x41fc('0x1c')](handleEntityNotFound(_0x2b635c,null))['then'](function(_0xf4ad45){if(_0xf4ad45){_0x467f4f[_0x41fc('0x59')]['FaxAccountId']=_0xf4ad45['id'];return db[_0x41fc('0x6a')][_0x41fc('0x58')](_0x467f4f[_0x41fc('0x59')]);}})[_0x41fc('0x1c')](respondWithResult(_0x2b635c,null))[_0x41fc('0x26')](handleError(_0x2b635c,null));};exports[_0x41fc('0x6b')]=function(_0x1f5fe8,_0x5d609d,_0x58fb57){var _0x296973={'raw':![],'where':{}};var _0x565e2b={};var _0x492815={'count':0x0,'rows':[]};return db[_0x41fc('0x3d')][_0x41fc('0x66')]({'where':{'id':_0x1f5fe8['params']['id']}})[_0x41fc('0x1c')](handleEntityNotFound(_0x5d609d,null))[_0x41fc('0x1c')](function(_0x3b673a){if(_0x3b673a){_0x565e2b['model']=_[_0x41fc('0x43')](db[_0x41fc('0x6a')][_0x41fc('0x3e')]);_0x565e2b[_0x41fc('0x42')]=_[_0x41fc('0x43')](_0x1f5fe8[_0x41fc('0x42')]);_0x565e2b['filters']=_[_0x41fc('0x45')](_0x565e2b[_0x41fc('0x41')],_0x565e2b[_0x41fc('0x42')]);_0x296973[_0x41fc('0x47')]=_[_0x41fc('0x45')](_0x565e2b[_0x41fc('0x41')],qs['fields'](_0x1f5fe8[_0x41fc('0x42')]['fields']));_0x296973['attributes']=_0x296973[_0x41fc('0x47')]['length']?_0x296973['attributes']:_0x565e2b[_0x41fc('0x41')];if(!_0x1f5fe8[_0x41fc('0x42')][_0x41fc('0x6c')](_0x41fc('0x49'))){_0x296973[_0x41fc('0x2d')]=qs[_0x41fc('0x2d')](_0x1f5fe8[_0x41fc('0x42')]['limit']);_0x296973[_0x41fc('0x2a')]=qs[_0x41fc('0x2a')](_0x1f5fe8[_0x41fc('0x42')]['offset']);}_0x296973[_0x41fc('0x6d')]=qs[_0x41fc('0x4a')](_0x1f5fe8['query'][_0x41fc('0x4a')]);_0x296973[_0x41fc('0x4b')]=qs[_0x41fc('0x44')](_['pick'](_0x1f5fe8[_0x41fc('0x42')],_0x565e2b['filters']));_0x296973[_0x41fc('0x4b')][_0x41fc('0x63')]=_0x3b673a['id'];if(_0x1f5fe8[_0x41fc('0x42')][_0x41fc('0x4f')]){_0x296973[_0x41fc('0x4b')]=_['merge'](_0x296973[_0x41fc('0x4b')],{'$or':_['map'](_0x296973['attributes'],function(_0x51ff56){var _0x181226={};_0x181226[_0x51ff56]={'$like':'%'+_0x1f5fe8[_0x41fc('0x42')]['filter']+'%'};return _0x181226;})});}_0x296973=_[_0x41fc('0x4d')]({},_0x296973,_0x1f5fe8[_0x41fc('0x50')]);return db[_0x41fc('0x6a')][_0x41fc('0x2c')]({'where':_0x296973['where']})[_0x41fc('0x1c')](function(_0xb17a57){_0x492815[_0x41fc('0x2c')]=_0xb17a57;if(_0x1f5fe8[_0x41fc('0x42')][_0x41fc('0x51')]){_0x296973['include']=[{'all':!![]}];}return db[_0x41fc('0x6a')][_0x41fc('0x53')](_0x296973);})['then'](function(_0x4c7cd3){_0x492815[_0x41fc('0x54')]=_0x4c7cd3;return _0x492815;});}})[_0x41fc('0x1c')](respondWithFilteredResult(_0x5d609d,_0x296973))[_0x41fc('0x26')](handleError(_0x5d609d,null));};exports[_0x41fc('0x6e')]=function(_0x2e35e2,_0x283063,_0x455d60){return db[_0x41fc('0x3d')][_0x41fc('0x57')]({'where':{'id':_0x2e35e2['params']['id']}})[_0x41fc('0x1c')](handleEntityNotFound(_0x283063,null))[_0x41fc('0x1c')](function(_0x277ebf){if(_0x277ebf){return _0x277ebf[_0x41fc('0x6e')](_0x2e35e2['query'][_0x41fc('0x68')]);}})[_0x41fc('0x1c')](respondWithStatusCode(_0x283063,null))[_0x41fc('0x26')](handleError(_0x283063,null));};exports['addInteraction']=function(_0x1b52dd,_0x4375c1,_0x43bad6){return db[_0x41fc('0x6f')][_0x41fc('0x57')]({'where':{'id':_0x1b52dd[_0x41fc('0x56')]['id']}})[_0x41fc('0x1c')](handleEntityNotFound(_0x4375c1,null))['then'](function(_0x562fb1){if(_0x562fb1){return _0x562fb1[_0x41fc('0x70')](_0x1b52dd[_0x41fc('0x59')][_0x41fc('0x68')],_[_0x41fc('0x71')](_0x1b52dd[_0x41fc('0x59')],[_0x41fc('0x68'),'id'])||{});}})[_0x41fc('0x1c')](respondWithResult(_0x4375c1,null))[_0x41fc('0x26')](handleError(_0x4375c1,null));};exports[_0x41fc('0x72')]=function(_0x52f6f8,_0x19f6cf,_0x332d39){var _0x1c42d9={'raw':![],'where':{}};var _0x44b2f2={};var _0xabde66={'count':0x0,'rows':[]};return db[_0x41fc('0x3d')]['findOne']({'where':{'id':_0x52f6f8[_0x41fc('0x56')]['id']}})[_0x41fc('0x1c')](handleEntityNotFound(_0x19f6cf,null))['then'](function(_0x3522da){if(_0x3522da){_0x44b2f2[_0x41fc('0x41')]=_[_0x41fc('0x43')](db[_0x41fc('0x6f')][_0x41fc('0x3e')]);_0x44b2f2[_0x41fc('0x42')]=_['keys'](_0x52f6f8[_0x41fc('0x42')]);_0x44b2f2[_0x41fc('0x44')]=_[_0x41fc('0x45')](_0x44b2f2[_0x41fc('0x41')],_0x44b2f2[_0x41fc('0x42')]);_0x1c42d9[_0x41fc('0x47')]=_[_0x41fc('0x45')](_0x44b2f2[_0x41fc('0x41')],qs[_0x41fc('0x46')](_0x52f6f8[_0x41fc('0x42')]['fields']));_0x1c42d9[_0x41fc('0x47')]=_0x1c42d9[_0x41fc('0x47')][_0x41fc('0x48')]?_0x1c42d9[_0x41fc('0x47')]:_0x44b2f2[_0x41fc('0x41')];if(!_0x52f6f8['query'][_0x41fc('0x6c')](_0x41fc('0x49'))){_0x1c42d9[_0x41fc('0x2d')]=qs[_0x41fc('0x2d')](_0x52f6f8['query']['limit']);_0x1c42d9['offset']=qs[_0x41fc('0x2a')](_0x52f6f8['query'][_0x41fc('0x2a')]);}_0x1c42d9[_0x41fc('0x6d')]=qs[_0x41fc('0x4a')](_0x52f6f8['query']['sort']);_0x1c42d9['where']=qs[_0x41fc('0x44')](_['pick'](_0x52f6f8[_0x41fc('0x42')],_0x44b2f2[_0x41fc('0x44')]));_0x1c42d9['where'][_0x41fc('0x63')]=_0x3522da['id'];if(_0x52f6f8[_0x41fc('0x42')][_0x41fc('0x4f')]){_0x1c42d9[_0x41fc('0x4b')]=_[_0x41fc('0x4d')](_0x1c42d9['where'],{'$or':_[_0x41fc('0x3c')](_0x1c42d9[_0x41fc('0x47')],function(_0x48791d){var _0x506611={};_0x506611[_0x48791d]={'$like':'%'+_0x52f6f8[_0x41fc('0x42')][_0x41fc('0x4f')]+'%'};return _0x506611;})});}_0x1c42d9=_[_0x41fc('0x4d')]({},_0x1c42d9,_0x52f6f8[_0x41fc('0x50')]);return db['FaxInteraction'][_0x41fc('0x2c')]({'where':_0x1c42d9['where']})[_0x41fc('0x1c')](function(_0xfac038){_0xabde66[_0x41fc('0x2c')]=_0xfac038;if(_0x52f6f8[_0x41fc('0x42')][_0x41fc('0x51')]){_0x1c42d9[_0x41fc('0x52')]=[{'model':db['CmContact'],'as':_0x41fc('0x73'),'required':![]},{'model':db[_0x41fc('0x74')],'as':_0x41fc('0x75'),'attributes':[_0x41fc('0x37'),_0x41fc('0x76'),_0x41fc('0x77')],'required':![]},{'model':db[_0x41fc('0x78')],'as':'Tags','attributes':['id','name','color'],'where':_0x52f6f8[_0x41fc('0x42')]['tag']?{'id':_0x52f6f8[_0x41fc('0x42')]['tag']}:undefined,'required':_0x52f6f8[_0x41fc('0x42')]['tag']?!![]:![]}];}return db[_0x41fc('0x6f')]['findAll'](_0x1c42d9);})['then'](function(_0x5a3519){_0xabde66[_0x41fc('0x54')]=_0x5a3519;return _0xabde66;});}})[_0x41fc('0x1c')](respondWithFilteredResult(_0x19f6cf,_0x1c42d9))[_0x41fc('0x26')](handleError(_0x19f6cf,null));};exports[_0x41fc('0x79')]=function(_0x333bf3,_0x198814){var _0x378b70=_0x333bf3[_0x41fc('0x56')]['id'];var _0x1a8163=_0x333bf3[_0x41fc('0x59')];var _0x4d5423=0xc8;var _0x2086b3=null;return db[_0x41fc('0x7a')][_0x41fc('0x7b')]({'isolationLevel':db[_0x41fc('0x7a')][_0x41fc('0x7c')]['ISOLATION_LEVELS'][_0x41fc('0x7d')]},function(_0x3bf2f3){return db[_0x41fc('0x3d')][_0x41fc('0x66')]({'where':{'id':_0x378b70},'transaction':_0x3bf2f3})[_0x41fc('0x1c')](function(_0x107b58){if(_0x107b58){return db[_0x41fc('0x7e')][_0x41fc('0x35')]({'where':{'FaxAccountId':_0x378b70},'transaction':_0x3bf2f3})['then'](function(){var _0x32b61d=_['map'](_0x1a8163,function(_0x2af449){_0x2af449[_0x41fc('0x63')]=_0x378b70;return _0x2af449;});return db[_0x41fc('0x7e')][_0x41fc('0x7f')](_0x32b61d,{'transaction':_0x3bf2f3});});}else{_0x4d5423=0x194;_0x2086b3=[];}});})[_0x41fc('0x1c')](function(){if(_0x4d5423!==0x194){return db['FaxApplication'][_0x41fc('0x80')]({'where':{'FaxAccountId':_0x378b70},'order':_0x41fc('0x81')})[_0x41fc('0x1c')](function(_0x1beb66){_0x2086b3=_0x1beb66;});}})[_0x41fc('0x26')](function(_0x2b5619){_0x4d5423=0x1f4;logger['error'](_0x2b5619[_0x41fc('0x36')]);if(_0x2b5619['name']){delete _0x2b5619[_0x41fc('0x37')];}_0x2086b3=_0x2b5619;})[_0x41fc('0x82')](function(){if(_0x2086b3===null){_0x198814[_0x41fc('0x27')](_0x4d5423);}else{if(_0x4d5423===0x1f4){_0x198814[_0x41fc('0x2e')](_0x4d5423)['send'](_0x2086b3);}else{_0x198814[_0x41fc('0x2e')](_0x4d5423)[_0x41fc('0x29')](_0x2086b3);}}});};exports[_0x41fc('0x83')]=function(_0x33876e,_0x332f50,_0x140fbe){var _0x36a8ef={};var _0x14bcab={};var _0x2c52b0;var _0x5dbf27;return db[_0x41fc('0x3d')][_0x41fc('0x66')]({'where':{'id':_0x33876e[_0x41fc('0x56')]['id']}})['then'](handleEntityNotFound(_0x332f50,null))[_0x41fc('0x1c')](function(_0x56d3b6){if(_0x56d3b6){_0x2c52b0=_0x56d3b6;_0x14bcab['model']=_[_0x41fc('0x43')](db['FaxApplication'][_0x41fc('0x3e')]);_0x14bcab[_0x41fc('0x42')]=_[_0x41fc('0x43')](_0x33876e[_0x41fc('0x42')]);_0x14bcab[_0x41fc('0x44')]=_[_0x41fc('0x45')](_0x14bcab[_0x41fc('0x41')],_0x14bcab['query']);_0x36a8ef[_0x41fc('0x47')]=_[_0x41fc('0x45')](_0x14bcab[_0x41fc('0x41')],qs[_0x41fc('0x46')](_0x33876e[_0x41fc('0x42')][_0x41fc('0x46')]));_0x36a8ef['attributes']=_0x36a8ef[_0x41fc('0x47')]['length']?_0x36a8ef[_0x41fc('0x47')]:_0x14bcab[_0x41fc('0x41')];_0x36a8ef[_0x41fc('0x6d')]=qs[_0x41fc('0x4a')](_0x33876e[_0x41fc('0x42')][_0x41fc('0x4a')]);_0x36a8ef['where']=qs[_0x41fc('0x44')](_[_0x41fc('0x4c')](_0x33876e['query'],_0x14bcab[_0x41fc('0x44')]));if(_0x33876e[_0x41fc('0x42')][_0x41fc('0x4f')]){_0x36a8ef[_0x41fc('0x4b')]=_[_0x41fc('0x4d')](_0x36a8ef['where'],{'$or':_['map'](_0x36a8ef[_0x41fc('0x47')],function(_0x1d2f42){var _0x16baa8={};_0x16baa8[_0x1d2f42]={'$like':'%'+_0x33876e['query'][_0x41fc('0x4f')]+'%'};return _0x16baa8;})});}_0x36a8ef=_[_0x41fc('0x4d')]({},_0x36a8ef,_0x33876e[_0x41fc('0x50')]);return _0x2c52b0['getApplications'](_0x36a8ef);}})['then'](function(_0x1cc47e){if(_0x1cc47e){_0x5dbf27=_0x1cc47e[_0x41fc('0x48')];if(!_0x33876e[_0x41fc('0x42')][_0x41fc('0x6c')]('nolimit')){_0x36a8ef[_0x41fc('0x2d')]=qs[_0x41fc('0x2d')](_0x33876e['query'][_0x41fc('0x2d')]);_0x36a8ef[_0x41fc('0x2a')]=qs[_0x41fc('0x2a')](_0x33876e[_0x41fc('0x42')]['offset']);}return _0x2c52b0[_0x41fc('0x83')](_0x36a8ef);}})[_0x41fc('0x1c')](function(_0x460ac1){if(_0x460ac1){return _0x460ac1?{'count':_0x5dbf27,'rows':_0x460ac1}:null;}})['then'](respondWithResult(_0x332f50,null))['catch'](handleError(_0x332f50,null));};function Extension(_0xc4b44b,_0xa3a7b3,_0x56cfd1,_0xc339e0){this['context']='from-voip-provider';this[_0x41fc('0x84')]=_0xc4b44b[_0x41fc('0x85')];this[_0x41fc('0x86')]=_0xc339e0;this[_0x41fc('0x4e')]=_0x41fc('0x87');this['description']=_0x41fc('0x88');this[_0x41fc('0x63')]=_0xc4b44b['id'];this[_0x41fc('0x81')]=_0xa3a7b3;this[_0x41fc('0x89')]=_0x56cfd1;}function createExtensionsReciveFax(_0x147a73){var _0x4401d1=0x1;var _0x51df29=[];_0x51df29[_0x41fc('0x8a')](new Extension(_0x147a73,_0x4401d1,'',_0x41fc('0x8b')));_0x4401d1+=0x1;_0x51df29[_0x41fc('0x8a')](new Extension(_0x147a73,_0x4401d1,'CDR(type)=inbound-fax',_0x41fc('0x8c')));_0x4401d1+=0x1;for(var _0x435648 in _0x147a73){if(_0x147a73['hasOwnProperty'](_0x435648)&&(_0x435648===_0x41fc('0x8d')||_0x435648==='localstationid'||_0x435648===_0x41fc('0x8e')||_0x435648===_0x41fc('0x8f')||_0x435648==='headerinfo'||_0x435648===_0x41fc('0x90')||_0x435648===_0x41fc('0x91')||_0x435648==='modem'||_0x435648===_0x41fc('0x92'))){_0x51df29[_0x41fc('0x8a')](new Extension(_0x147a73,_0x4401d1,_0x41fc('0x93')+_0x435648+')='+_0x147a73[_0x435648],'Set'));_0x4401d1+=0x1;}}_0x51df29['push'](new Extension(_0x147a73,_0x4401d1,'6','Wait'));_0x4401d1+=0x1;_0x51df29['push'](new Extension(_0x147a73,_0x4401d1,'/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',_0x41fc('0x94')));_0x4401d1=0x0;return _0x51df29;}exports[_0x41fc('0x95')]=function(_0x2c1cd9,_0x5bd595,_0x5bc493){var _0x3b978c;return db[_0x41fc('0x7a')]['transaction'](function(_0x5c2f7d){return db['FaxAccount'][_0x41fc('0x58')](_0x2c1cd9[_0x41fc('0x59')],{'transaction':_0x5c2f7d})[_0x41fc('0x1c')](function(_0x5e416e){_0x3b978c=_0x5e416e['get']({'plain':!![]});return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_0x3b978c),{'transaction':_0x5c2f7d});});})[_0x41fc('0x1c')](function(){return _0x3b978c;})['then'](respondWithResult(_0x5bd595,null))[_0x41fc('0x26')](handleError(_0x5bd595,null));};exports[_0x41fc('0x96')]=function(_0x1ff1e5,_0x3987d5,_0x4f1b99){var _0x48135a;return db[_0x41fc('0x7a')][_0x41fc('0x7b')](function(_0x1d2a5d){return db['FaxAccount'][_0x41fc('0x32')](_0x1ff1e5[_0x41fc('0x59')],{'where':{'id':_0x1ff1e5[_0x41fc('0x59')]['id']},'transaction':_0x1d2a5d})['then'](function(_0x230f92){return db['VoiceExtension'][_0x41fc('0x35')]({'where':{'FaxAccountId':_0x1ff1e5[_0x41fc('0x59')]['id']},'transaction':_0x1d2a5d})[_0x41fc('0x1c')](function(_0x248514){return db[_0x41fc('0x97')][_0x41fc('0x7f')](createExtensionsReciveFax(_[_0x41fc('0x71')](_0x1ff1e5['body'],[_0x41fc('0x98'),_0x41fc('0x40'),_0x41fc('0x99'),_0x41fc('0x9a'),_0x41fc('0x9b'),_0x41fc('0x9c')])),{'transaction':_0x1d2a5d});});});})['then'](function(){return db[_0x41fc('0x3d')][_0x41fc('0x9d')](_0x1ff1e5['body']['id']);})['then'](respondWithResult(_0x3987d5,null))[_0x41fc('0x26')](handleError(_0x3987d5,null));};exports['getMessages']=function(_0x40e6d1,_0x46583f,_0x587110){var _0x258855={'raw':!![],'where':{}};var _0xc306ed={};var _0x28a559={'count':0x0,'rows':[]};return db['FaxAccount'][_0x41fc('0x66')]({'where':{'id':_0x40e6d1['params']['id']}})[_0x41fc('0x1c')](handleEntityNotFound(_0x46583f,null))[_0x41fc('0x1c')](function(_0x3041a0){if(_0x3041a0){_0xc306ed[_0x41fc('0x41')]=_[_0x41fc('0x43')](db[_0x41fc('0x9e')][_0x41fc('0x3e')]);_0xc306ed['query']=_[_0x41fc('0x43')](_0x40e6d1[_0x41fc('0x42')]);_0xc306ed[_0x41fc('0x44')]=_[_0x41fc('0x45')](_0xc306ed[_0x41fc('0x41')],_0xc306ed['query']);_0x258855[_0x41fc('0x47')]=_[_0x41fc('0x45')](_0xc306ed[_0x41fc('0x41')],qs[_0x41fc('0x46')](_0x40e6d1[_0x41fc('0x42')][_0x41fc('0x46')]));_0x258855[_0x41fc('0x47')]=_0x258855[_0x41fc('0x47')]['length']?_0x258855[_0x41fc('0x47')]:_0xc306ed[_0x41fc('0x41')];if(!_0x40e6d1[_0x41fc('0x42')][_0x41fc('0x6c')](_0x41fc('0x49'))){_0x258855[_0x41fc('0x2d')]=qs[_0x41fc('0x2d')](_0x40e6d1[_0x41fc('0x42')][_0x41fc('0x2d')]);_0x258855[_0x41fc('0x2a')]=qs[_0x41fc('0x2a')](_0x40e6d1['query'][_0x41fc('0x2a')]);}_0x258855['order']=qs['sort'](_0x40e6d1[_0x41fc('0x42')][_0x41fc('0x4a')]);_0x258855[_0x41fc('0x4b')]=qs[_0x41fc('0x44')](_['pick'](_0x40e6d1[_0x41fc('0x42')],_0xc306ed['filters']));_0x258855['where']['FaxAccountId']=_0x3041a0['id'];if(_0x40e6d1[_0x41fc('0x42')][_0x41fc('0x4f')]){_0x258855[_0x41fc('0x4b')]=_[_0x41fc('0x4d')](_0x258855[_0x41fc('0x4b')],{'$or':_['map'](_0x258855['attributes'],function(_0x21c5f1){var _0x509f42={};_0x509f42[_0x21c5f1]={'$like':'%'+_0x40e6d1['query'][_0x41fc('0x4f')]+'%'};return _0x509f42;})});}if(_0x40e6d1[_0x41fc('0x42')][_0x41fc('0x9f')]){var _0x281e20=_0x40e6d1['query'][_0x41fc('0x9f')][_0x41fc('0xa0')](',');var _0x3b2ff2={};_0x3b2ff2[_0x281e20[0x0]]={'$gte':moment(_0x281e20[0x1])[_0x41fc('0xa1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x258855[_0x41fc('0x4b')]=_['merge'](_0x258855[_0x41fc('0x4b')],_0x3b2ff2);}_0x258855=_[_0x41fc('0x4d')]({},_0x258855,_0x40e6d1['options']);return db[_0x41fc('0x9e')][_0x41fc('0x2c')]({'where':_0x258855[_0x41fc('0x4b')]})['then'](function(_0x2b7ea2){_0x28a559[_0x41fc('0x2c')]=_0x2b7ea2;if(_0x40e6d1['query'][_0x41fc('0x51')]){_0x258855[_0x41fc('0x52')]=[{'all':!![]}];}return db[_0x41fc('0x9e')][_0x41fc('0x53')](_0x258855);})[_0x41fc('0x1c')](function(_0xe75ea1){_0x28a559[_0x41fc('0x54')]=_0xe75ea1;return _0x28a559;});}})['then'](respondWithFilteredResult(_0x46583f,_0x258855))['catch'](handleError(_0x46583f,null));};exports[_0x41fc('0x38')]=function(_0x5eb4a1,_0x39df3e,_0x591f2b){var _0x1fbd35,_0xdec5a9={},_0x47a334;if(_0x5eb4a1['body']['to']){_0x47a334=_0x5eb4a1['body']['to'][0x0];}return db[_0x41fc('0x3d')][_0x41fc('0x57')]({'where':{'id':_0x5eb4a1['params']['id']},'include':[{'model':db['CmList'],'as':_0x41fc('0xa2'),'include':[{'model':db['CmContact'],'as':_0x41fc('0xa3'),'where':{'fax':_0x47a334},'limit':0x1,'order':[['updatedAt',_0x41fc('0xa4')]]}]}]})[_0x41fc('0x1c')](handleEntityNotFound(_0x39df3e,null))[_0x41fc('0x1c')](function(_0x1d3974){_0x1fbd35=_0x1d3974;if(_0x5eb4a1[_0x41fc('0x59')]['attachments']&&_0x5eb4a1['body'][_0x41fc('0xa5')][_0x41fc('0x48')]){for(var _0x3dd5ab=0x0;_0x3dd5ab<_0x5eb4a1['body'][_0x41fc('0xa5')]['length'];_0x3dd5ab+=0x1){_0x5eb4a1['body']['attachments'][_0x3dd5ab]={'filename':_0x5eb4a1[_0x41fc('0x59')]['attachments'][_0x3dd5ab][_0x41fc('0x37')],'id':_0x5eb4a1['body'][_0x41fc('0xa5')][_0x3dd5ab]['id'],'path':path[_0x41fc('0xa6')](config['root'],_0x41fc('0xa7'),_0x5eb4a1['body'][_0x41fc('0xa5')][_0x3dd5ab][_0x41fc('0xa8')])};}}return respondWithRpcPromise('CheckAfterSend',_0x41fc('0xa9'),{'FaxAccountId':_[_0x41fc('0xaa')](_0x5eb4a1[_0x41fc('0x56')]['id'])?undefined:_0x5eb4a1[_0x41fc('0x56')]['id'],'path':_[_0x41fc('0xaa')](_0x5eb4a1[_0x41fc('0x59')][_0x41fc('0xa5')][0x0][_0x41fc('0x7')])?undefined:_0x5eb4a1['body'][_0x41fc('0xa5')][0x0][_0x41fc('0x7')],'fax':_['isNil'](_0x5eb4a1[_0x41fc('0x59')]['to'][0x0])?undefined:_0x5eb4a1[_0x41fc('0x59')]['to'][0x0]},client9002);})[_0x41fc('0x1c')](function(){if(_0x1fbd35){if(_[_0x41fc('0xaa')](_0x5eb4a1[_0x41fc('0x59')][_0x41fc('0xab')])){_0x5eb4a1['body'][_0x41fc('0xab')]=util[_0x41fc('0xa1')](_0x41fc('0xac'),_0x1fbd35[_0x41fc('0x37')],_0x1fbd35[_0x41fc('0xad')]);}if(_0x1fbd35['List']){if(_0x1fbd35['List'][_0x41fc('0xa3')]['length']){return _0x1fbd35[_0x41fc('0xa2')]['Contacts'][0x0];}else{return db[_0x41fc('0xae')][_0x41fc('0x58')](_[_0x41fc('0xaf')](_0x5eb4a1[_0x41fc('0x59')],{'firstName':_0x5eb4a1['body']['to'][0x0],'phone':_0x5eb4a1['body']['to'][0x0],'fax':_0x5eb4a1['body']['to'][0x0],'ListId':_0x1fbd35[_0x41fc('0x9c')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x41fc('0x1c')](function(_0x172e50){if(_0x172e50){return db['FaxInteraction']['find']({'where':{'ContactId':_0x172e50['id'],'closed':![],'FaxAccountId':_0x1fbd35['id']}})[_0x41fc('0x1c')](function(_0x4bf668){if(_0x4bf668){return[_0x4bf668,![]];}return db[_0x41fc('0x6f')][_0x41fc('0x58')]({'UserId':_0x5eb4a1[_0x41fc('0x5a')]['id'],'ContactId':_0x172e50['id'],'FaxAccountId':_0x1fbd35['id'],'fax':_0x5eb4a1[_0x41fc('0x59')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x41fc('0x4d')](_0x5eb4a1[_0x41fc('0x59')],{'read':![],'body':_0x5eb4a1[_0x41fc('0x59')][_0x41fc('0xa5')][0x0][_0x41fc('0xb0')],'FaxAccountId':_0x1fbd35['id'],'UserId':_0x5eb4a1['user']['id'],'ContactId':_0x172e50['id'],'AttachmentId':_0x5eb4a1[_0x41fc('0x59')][_0x41fc('0xa5')][0x0]['id']})]},{'include':[{'model':db[_0x41fc('0x9e')],'as':_0x41fc('0xb1')}]})[_0x41fc('0x1c')](function(_0x136de8){return[_0x136de8,!![]];});});}else{throw new Error(_0x41fc('0xb2'));}})['spread'](function(_0x3baf2c,_0x48ed44){if(_0x48ed44){return _0x3baf2c;}return db[_0x41fc('0x9e')][_0x41fc('0x58')]({'direction':_0x41fc('0xb3'),'read':![],'body':_0x5eb4a1[_0x41fc('0x59')][_0x41fc('0xa5')][0x0]['filename'],'FaxAccountId':_0x1fbd35['id'],'FaxInteractionId':_0x3baf2c['id'],'UserId':_0x5eb4a1[_0x41fc('0x5a')]['id'],'ContactId':_0x3baf2c[_0x41fc('0xb4')],'AttachmentId':_0x5eb4a1[_0x41fc('0x59')]['attachments'][0x0]['id']})[_0x41fc('0x1c')](function(_0x150e36){_0x3baf2c['dataValues'][_0x41fc('0xb1')]=[];_0x3baf2c[_0x41fc('0xb5')][_0x41fc('0xb1')][_0x41fc('0x8a')](_0x150e36[_0x41fc('0xb5')]);return _0x3baf2c;});})[_0x41fc('0x1c')](function(_0x848ea){respondWithRpcPromise(_0x41fc('0xb6'),_0x41fc('0xb6'),{'FaxAccountId':_[_0x41fc('0xaa')](_0x5eb4a1[_0x41fc('0x56')]['id'])?undefined:_0x5eb4a1[_0x41fc('0x56')]['id'],'path':_[_0x41fc('0xaa')](_0x5eb4a1['body'][_0x41fc('0xa5')][0x0]['path'])?undefined:_0x5eb4a1[_0x41fc('0x59')][_0x41fc('0xa5')][0x0][_0x41fc('0x7')],'fax':_['isNil'](_0x5eb4a1['body']['to'][0x0])?undefined:_0x5eb4a1[_0x41fc('0x59')]['to'][0x0],'AttachmentId':_0x5eb4a1['body'][_0x41fc('0xa5')][0x0]['id']},client9002)[_0x41fc('0x1c')](function(_0x423db7){logger[_0x41fc('0x1d')](_0x41fc('0xb7'),_0x423db7);})['catch'](function(_0x23ef9c){logger[_0x41fc('0x1d')](_0x41fc('0xb7'),_0x23ef9c);});return _0x848ea;})[_0x41fc('0x1c')](respondWithResult(_0x39df3e,null))[_0x41fc('0x26')](handleError(_0x39df3e,null));};exports[_0x41fc('0xb8')]=function(_0x3e37aa,_0x5ec7c5,_0x19313c){return db['FaxAccount'][_0x41fc('0x57')]({'where':{'id':_0x3e37aa[_0x41fc('0x56')]['id']}})[_0x41fc('0x1c')](handleEntityNotFound(_0x5ec7c5,null))[_0x41fc('0x1c')](function(_0x5577c0){if(_0x5577c0){return _0x5577c0['addAgents'](_0x3e37aa[_0x41fc('0x59')][_0x41fc('0x68')],_['omit'](_0x3e37aa['body'],[_0x41fc('0x68'),'id'])||{})[_0x41fc('0xb9')](function(_0x255924){for(var _0x42c147=0x0;_0x42c147<_0x3e37aa[_0x41fc('0x59')][_0x41fc('0x68')][_0x41fc('0x48')];_0x42c147+=0x1){socket[_0x41fc('0xba')]('userFaxAccount:save',{'UserId':Number(_0x3e37aa['body']['ids'][_0x42c147]),'FaxAccountId':Number(_0x3e37aa[_0x41fc('0x56')]['id'])});}return _0x255924;});}})[_0x41fc('0x1c')](respondWithResult(_0x5ec7c5,null))[_0x41fc('0x26')](handleError(_0x5ec7c5,null));};exports['removeAgents']=function(_0x448580,_0x43bf1a,_0x28c11f){return db[_0x41fc('0x3d')][_0x41fc('0x57')]({'where':{'id':_0x448580['params']['id']}})[_0x41fc('0x1c')](handleEntityNotFound(_0x43bf1a,null))[_0x41fc('0x1c')](function(_0x4b4aa4){if(_0x4b4aa4){return _0x4b4aa4[_0x41fc('0xbb')](_0x448580[_0x41fc('0x42')][_0x41fc('0x68')])[_0x41fc('0x1c')](function(){if(_['isArray'](_0x448580[_0x41fc('0x42')]['ids'])){for(var _0x4d6733=0x0;_0x4d6733<_0x448580[_0x41fc('0x42')][_0x41fc('0x68')]['length'];_0x4d6733+=0x1){socket['emit'](_0x41fc('0xbc'),{'UserId':Number(_0x448580['query'][_0x41fc('0x68')][_0x4d6733]),'FaxAccountId':Number(_0x448580[_0x41fc('0x56')]['id'])});}}else{socket[_0x41fc('0xba')](_0x41fc('0xbc'),{'UserId':Number(_0x448580[_0x41fc('0x42')][_0x41fc('0x68')]),'FaxAccountId':Number(_0x448580[_0x41fc('0x56')]['id'])});}});}})[_0x41fc('0x1c')](respondWithStatusCode(_0x43bf1a,null))[_0x41fc('0x26')](handleError(_0x43bf1a,null));};exports[_0x41fc('0xbd')]=function(_0x1ac709,_0x4029a2,_0x581122){var _0x223d49={};var _0x15837e={};var _0x37dcf8;var _0x280d74;return db[_0x41fc('0x3d')]['findOne']({'where':{'id':_0x1ac709['params']['id']}})['then'](handleEntityNotFound(_0x4029a2,null))[_0x41fc('0x1c')](function(_0x2002e2){if(_0x2002e2){_0x37dcf8=_0x2002e2;_0x15837e[_0x41fc('0x41')]=_['keys'](db['User'][_0x41fc('0x3e')]);_0x15837e[_0x41fc('0x42')]=_[_0x41fc('0x43')](_0x1ac709['query']);_0x15837e[_0x41fc('0x44')]=_[_0x41fc('0x45')](_0x15837e[_0x41fc('0x41')],_0x15837e['query']);_0x223d49[_0x41fc('0x47')]=_[_0x41fc('0x45')](_0x15837e['model'],qs[_0x41fc('0x46')](_0x1ac709[_0x41fc('0x42')][_0x41fc('0x46')]));_0x223d49['attributes']=_0x223d49[_0x41fc('0x47')][_0x41fc('0x48')]?_0x223d49['attributes']:_0x15837e['model'];_0x223d49['order']=qs['sort'](_0x1ac709[_0x41fc('0x42')]['sort']);_0x223d49[_0x41fc('0x4b')]=qs['filters'](_[_0x41fc('0x4c')](_0x1ac709[_0x41fc('0x42')],_0x15837e[_0x41fc('0x44')]));if(_0x1ac709[_0x41fc('0x42')]['filter']){_0x223d49[_0x41fc('0x4b')]=_[_0x41fc('0x4d')](_0x223d49[_0x41fc('0x4b')],{'$or':_['map'](_0x223d49[_0x41fc('0x47')],function(_0x57ac83){var _0x40c2cc={};_0x40c2cc[_0x57ac83]={'$like':'%'+_0x1ac709[_0x41fc('0x42')][_0x41fc('0x4f')]+'%'};return _0x40c2cc;})});}_0x223d49=_['merge']({},_0x223d49,_0x1ac709[_0x41fc('0x50')]);return _0x37dcf8['getAgents'](_0x223d49);}})[_0x41fc('0x1c')](function(_0x3bdb60){if(_0x3bdb60){_0x280d74=_0x3bdb60[_0x41fc('0x48')];if(!_0x1ac709['query'][_0x41fc('0x6c')](_0x41fc('0x49'))){_0x223d49['limit']=qs[_0x41fc('0x2d')](_0x1ac709['query'][_0x41fc('0x2d')]);_0x223d49[_0x41fc('0x2a')]=qs['offset'](_0x1ac709[_0x41fc('0x42')][_0x41fc('0x2a')]);}return _0x37dcf8['getAgents'](_0x223d49);}})[_0x41fc('0x1c')](function(_0x211d78){if(_0x211d78){return _0x211d78?{'count':_0x280d74,'rows':_0x211d78}:null;}})[_0x41fc('0x1c')](respondWithResult(_0x4029a2,null))[_0x41fc('0x26')](handleError(_0x4029a2,null));}; \ No newline at end of file +var _0x443b=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxAccount.socket','register','client','http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','json','offset','undefined','count','limit','status','set','apply','save','update','destroy','get','FaxAccounts','end','stack','name','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','params','length','includeAll','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','Disposition','getDispositions','order','FaxAccountId','removeDispositions','ids','CannedAnswer','getAnswers','pick','options','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','findOne','CmContact','Owner','fullname','internal','Tags','tag','addApplications','sequelize','Transaction','FaxApplication','bulkCreate','findAndCountAll','priority','send','getApplications','context','from-voip-provider','localstationid','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','faxdetect','headerinfo','minrate','modem','t38timeout','FAXOPT(','Wait','ReceiveFax','addAccountApplications','transaction','VoiceExtension','tech','key','TrunkId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','Contacts','DESC','attachments','join','root','server/files/attachments','basename','isNil','path','from','List','ListId','List\x20not\x20found','out','filename','Contact\x20not\x20found','spread','ContactId','Messages','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','User','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x55d58f,_0x2bea83){var _0x1ad6e6=function(_0x31447e){while(--_0x31447e){_0x55d58f['push'](_0x55d58f['shift']());}};_0x1ad6e6(++_0x2bea83);}(_0x443b,0x16d));var _0xb443=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x443b[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb443('0x0'));var zipdir=require(_0xb443('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb443('0x2'));var moment=require(_0xb443('0x3'));var BPromise=require(_0xb443('0x4'));var Mustache=require(_0xb443('0x5'));var util=require(_0xb443('0x6'));var path=require('path');var sox=require(_0xb443('0x7'));var csv=require(_0xb443('0x8'));var ejs=require(_0xb443('0x9'));var fs=require('fs');var fs_extra=require(_0xb443('0xa'));var _=require(_0xb443('0xb'));var squel=require(_0xb443('0xc'));var crypto=require(_0xb443('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb443('0xe'));var toCsv=require(_0xb443('0x8'));var querystring=require(_0xb443('0xf'));var Papa=require(_0xb443('0x10'));var Redis=require(_0xb443('0x11'));var authService=require(_0xb443('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb443('0x13'));var hardwareService=require(_0xb443('0x14'));var logger=require(_0xb443('0x15'))(_0xb443('0x16'));var utils=require(_0xb443('0x17'));var config=require(_0xb443('0x18'));var licenseUtil=require(_0xb443('0x19'));var db=require(_0xb443('0x1a'))['db'];config[_0xb443('0x1b')]=_['defaults'](config['redis'],{'host':_0xb443('0x1c'),'port':0x18eb});var socket=require(_0xb443('0x1d'))(new Redis(config[_0xb443('0x1b')]));require(_0xb443('0x1e'))[_0xb443('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0xb443('0x20')]['http']({'port':0x232c});var client9002=jayson[_0xb443('0x20')][_0xb443('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x1c6814,_0x4af414,_0x5d4870,_0x399eaa){return new BPromise(function(_0x55f6fb,_0x410075){var _0x4b503d=_0x399eaa||client;return _0x4b503d['request'](_0x1c6814,_0x5d4870)[_0xb443('0x22')](function(_0xd6a835){logger[_0xb443('0x23')](_0xb443('0x24'),_0x4af414,_0xb443('0x25'));logger[_0xb443('0x26')](_0xb443('0x27'),_0x4af414,_0xb443('0x25'),JSON[_0xb443('0x28')](_0xd6a835));if(_0xd6a835[_0xb443('0x29')]){if(_0xd6a835[_0xb443('0x29')][_0xb443('0x2a')]===0x1f4){logger[_0xb443('0x29')](_0xb443('0x24'),_0x4af414,_0xd6a835['error'][_0xb443('0x2b')]);return _0x410075(_0xd6a835['error'][_0xb443('0x2b')]);}logger[_0xb443('0x29')](_0xb443('0x24'),_0x4af414,_0xd6a835[_0xb443('0x29')][_0xb443('0x2b')]);return _0x55f6fb(_0xd6a835[_0xb443('0x29')][_0xb443('0x2b')]);}else{logger[_0xb443('0x23')](_0xb443('0x24'),_0x4af414,_0xb443('0x25'));_0x55f6fb(_0xd6a835['result']['message']);}})['catch'](function(_0x2774a9){logger[_0xb443('0x29')](_0xb443('0x24'),_0x4af414,_0x2774a9);_0x410075(_0x2774a9);});});}function respondWithStatusCode(_0x1a449a,_0x58c3a5){_0x58c3a5=_0x58c3a5||0xcc;return function(_0xe3d0b9){if(_0xe3d0b9){return _0x1a449a['sendStatus'](_0x58c3a5);}return _0x1a449a['status'](_0x58c3a5)['end']();};}function respondWithResult(_0x59cc7c,_0x42b2b5){_0x42b2b5=_0x42b2b5||0xc8;return function(_0x5f48d9){if(_0x5f48d9){return _0x59cc7c['status'](_0x42b2b5)[_0xb443('0x2c')](_0x5f48d9);}};}function respondWithFilteredResult(_0x5a5ccf,_0x1f1f69){return function(_0x3ebea3){if(_0x3ebea3){var _0x493bcf=typeof _0x1f1f69[_0xb443('0x2d')]==='undefined'&&typeof _0x1f1f69['limit']===_0xb443('0x2e');var _0x271e47=_0x3ebea3[_0xb443('0x2f')];var _0x267da3=_0x493bcf?0x0:_0x1f1f69[_0xb443('0x2d')];var _0x3675fa=_0x493bcf?_0x3ebea3['count']:_0x1f1f69['offset']+_0x1f1f69[_0xb443('0x30')];var _0xe9ba78;if(_0x3675fa>=_0x271e47){_0x3675fa=_0x271e47;_0xe9ba78=0xc8;}else{_0xe9ba78=0xce;}_0x5a5ccf[_0xb443('0x31')](_0xe9ba78);return _0x5a5ccf[_0xb443('0x32')]('Content-Range',_0x267da3+'-'+_0x3675fa+'/'+_0x271e47)[_0xb443('0x2c')](_0x3ebea3);}return null;};}function patchUpdates(_0xafd759){return function(_0x3f9850){try{jsonpatch[_0xb443('0x33')](_0x3f9850,_0xafd759,!![]);}catch(_0x56526a){return BPromise['reject'](_0x56526a);}return _0x3f9850[_0xb443('0x34')]();};}function saveUpdates(_0x5dd8da,_0xd1c80c){return function(_0x4f3cc0){if(_0x4f3cc0){return _0x4f3cc0[_0xb443('0x35')](_0x5dd8da)[_0xb443('0x22')](function(_0x4be868){return _0x4be868;});}return null;};}function removeEntity(_0x12a7ce,_0x4203ed){return function(_0x183a47){if(_0x183a47){return _0x183a47[_0xb443('0x36')]()[_0xb443('0x22')](function(){var _0x6b4912=_0x183a47[_0xb443('0x37')]({'plain':!![]});var _0x220f1e=_0xb443('0x38');return db['UserProfileResource'][_0xb443('0x36')]({'where':{'type':_0x220f1e,'resourceId':_0x6b4912['id']}})['then'](function(){return _0x183a47;});})[_0xb443('0x22')](function(){_0x12a7ce[_0xb443('0x31')](0xcc)[_0xb443('0x39')]();});}};}function handleEntityNotFound(_0x648fb8,_0x2683a9){return function(_0x3c15d4){if(!_0x3c15d4){_0x648fb8['sendStatus'](0x194);}return _0x3c15d4;};}function handleError(_0x286b86,_0x22a0bc){_0x22a0bc=_0x22a0bc||0x1f4;return function(_0x1be614){logger['error'](_0x1be614[_0xb443('0x3a')]);if(_0x1be614['name']){delete _0x1be614[_0xb443('0x3b')];}_0x286b86[_0xb443('0x31')](_0x22a0bc)['send'](_0x1be614);};}exports[_0xb443('0x3c')]=function(_0x1a1c18,_0x51957b){var _0x30efac={'include':[{'model':db[_0xb443('0x3d')],'as':_0xb443('0x3e')}]},_0x51202b={},_0x3671c1={'count':0x0,'rows':[]};var _0x28ca6b=_[_0xb443('0x3f')](db[_0xb443('0x40')][_0xb443('0x41')],function(_0x27cad9){return{'name':_0x27cad9[_0xb443('0x42')],'type':_0x27cad9[_0xb443('0x43')]['key']};});_0x51202b[_0xb443('0x44')]=_[_0xb443('0x3f')](_0x28ca6b,'name');_0x51202b[_0xb443('0x45')]=_[_0xb443('0x46')](_0x1a1c18[_0xb443('0x45')]);_0x51202b[_0xb443('0x47')]=_[_0xb443('0x48')](_0x51202b[_0xb443('0x44')],_0x51202b[_0xb443('0x45')]);_0x30efac[_0xb443('0x49')]=_['intersection'](_0x51202b[_0xb443('0x44')],qs[_0xb443('0x4a')](_0x1a1c18['query'][_0xb443('0x4a')]));_0x30efac[_0xb443('0x49')]=_0x30efac[_0xb443('0x49')]['length']?_0x30efac[_0xb443('0x49')]:_0x51202b[_0xb443('0x44')];if(!_0x1a1c18[_0xb443('0x45')][_0xb443('0x4b')](_0xb443('0x4c'))){_0x30efac[_0xb443('0x30')]=qs[_0xb443('0x30')](_0x1a1c18[_0xb443('0x45')]['limit']);_0x30efac[_0xb443('0x2d')]=qs[_0xb443('0x2d')](_0x1a1c18['query'][_0xb443('0x2d')]);}_0x30efac['order']=qs[_0xb443('0x4d')](_0x1a1c18[_0xb443('0x45')]['sort']);_0x30efac['where']=qs[_0xb443('0x47')](_['pick'](_0x1a1c18[_0xb443('0x45')],_0x51202b[_0xb443('0x47')]),_0x28ca6b);if(_0x1a1c18[_0xb443('0x45')][_0xb443('0x4e')]){_0x30efac[_0xb443('0x4f')]=_[_0xb443('0x50')](_0x30efac[_0xb443('0x4f')],{'$or':_[_0xb443('0x3f')](_0x28ca6b,function(_0x235666){if(_0x235666[_0xb443('0x43')]!==_0xb443('0x51')){var _0x23f717={};_0x23f717[_0x235666[_0xb443('0x3b')]]={'$like':'%'+_0x1a1c18['query']['filter']+'%'};return _0x23f717;}})});}_0x30efac=_[_0xb443('0x50')]({},_0x30efac,_0x1a1c18['options']);var _0x58aa23={'where':_0x30efac[_0xb443('0x4f')]};return db['FaxAccount'][_0xb443('0x2f')](_0x58aa23)[_0xb443('0x22')](function(_0x59e0d5){_0x3671c1[_0xb443('0x2f')]=_0x59e0d5;if(_0x1a1c18[_0xb443('0x45')]['includeAll']){_0x30efac[_0xb443('0x52')]=[{'all':!![]}];}return db['FaxAccount'][_0xb443('0x53')](_0x30efac);})[_0xb443('0x22')](function(_0x137634){_0x3671c1[_0xb443('0x54')]=_0x137634;return _0x3671c1;})[_0xb443('0x22')](respondWithFilteredResult(_0x51957b,_0x30efac))[_0xb443('0x55')](handleError(_0x51957b,null));};exports[_0xb443('0x56')]=function(_0x5be8e6,_0x1688f6){var _0x3bbac4={'raw':![],'where':{'id':_0x5be8e6[_0xb443('0x57')]['id']},'include':[{'model':db[_0xb443('0x3d')],'as':_0xb443('0x3e')}]},_0x3d2482={};_0x3d2482[_0xb443('0x44')]=_[_0xb443('0x46')](db[_0xb443('0x40')]['rawAttributes']);_0x3d2482['query']=_[_0xb443('0x46')](_0x5be8e6[_0xb443('0x45')]);_0x3d2482[_0xb443('0x47')]=_[_0xb443('0x48')](_0x3d2482['model'],_0x3d2482[_0xb443('0x45')]);_0x3bbac4[_0xb443('0x49')]=_[_0xb443('0x48')](_0x3d2482[_0xb443('0x44')],qs[_0xb443('0x4a')](_0x5be8e6[_0xb443('0x45')][_0xb443('0x4a')]));_0x3bbac4[_0xb443('0x49')]=_0x3bbac4[_0xb443('0x49')][_0xb443('0x58')]?_0x3bbac4[_0xb443('0x49')]:_0x3d2482['model'];if(_0x5be8e6[_0xb443('0x45')][_0xb443('0x59')]){_0x3bbac4[_0xb443('0x52')]=[{'all':!![]}];}_0x3bbac4=_[_0xb443('0x50')]({},_0x3bbac4,_0x5be8e6['options']);return db[_0xb443('0x40')][_0xb443('0x5a')](_0x3bbac4)[_0xb443('0x22')](handleEntityNotFound(_0x1688f6,null))[_0xb443('0x22')](respondWithResult(_0x1688f6,null))['catch'](handleError(_0x1688f6,null));};exports['create']=function(_0x1f8baa,_0x3499bc){return db[_0xb443('0x40')]['create'](_0x1f8baa[_0xb443('0x5b')],{})['then'](function(_0x289fcc){var _0x4901b2=_0x1f8baa[_0xb443('0x5c')][_0xb443('0x37')]({'plain':!![]});if(!_0x4901b2)throw new Error(_0xb443('0x5d'));if(_0x4901b2[_0xb443('0x5e')]===_0xb443('0x5c')){var _0x27dd52=_0x289fcc[_0xb443('0x37')]({'plain':!![]});var _0x3dff92=_0xb443('0x38');return db['UserProfileSection'][_0xb443('0x5a')]({'where':{'name':_0x3dff92,'userProfileId':_0x4901b2[_0xb443('0x5f')]},'raw':!![]})[_0xb443('0x22')](function(_0x1d9868){if(_0x1d9868&&_0x1d9868['autoAssociation']===0x0){return db[_0xb443('0x60')][_0xb443('0x61')]({'name':_0x27dd52[_0xb443('0x3b')],'resourceId':_0x27dd52['id'],'type':_0x1d9868[_0xb443('0x3b')],'sectionId':_0x1d9868['id']},{})[_0xb443('0x22')](function(){return _0x289fcc;});}else{return _0x289fcc;}})[_0xb443('0x55')](function(_0x221b23){logger[_0xb443('0x29')](_0xb443('0x62'),_0x221b23);throw _0x221b23;});}return _0x289fcc;})[_0xb443('0x22')](respondWithResult(_0x3499bc,0xc9))[_0xb443('0x55')](handleError(_0x3499bc,null));};exports['update']=function(_0x387a06,_0x59d9e6){if(_0x387a06[_0xb443('0x5b')]['id']){delete _0x387a06['body']['id'];}return db[_0xb443('0x40')][_0xb443('0x5a')]({'where':{'id':_0x387a06[_0xb443('0x57')]['id']},'include':[{'model':db[_0xb443('0x3d')],'as':_0xb443('0x3e')}]})[_0xb443('0x22')](handleEntityNotFound(_0x59d9e6,null))[_0xb443('0x22')](saveUpdates(_0x387a06[_0xb443('0x5b')],null))['then'](respondWithResult(_0x59d9e6,null))[_0xb443('0x55')](handleError(_0x59d9e6,null));};exports[_0xb443('0x36')]=function(_0x40ab37,_0x5cad75){return db['FaxAccount']['find']({'where':{'id':_0x40ab37[_0xb443('0x57')]['id']}})['then'](handleEntityNotFound(_0x5cad75,null))[_0xb443('0x22')](removeEntity(_0x5cad75,null))[_0xb443('0x55')](handleError(_0x5cad75,null));};exports[_0xb443('0x63')]=function(_0x5f1c65,_0x5e5c47){return db['FaxAccount'][_0xb443('0x63')]()['then'](respondWithResult(_0x5e5c47,null))[_0xb443('0x55')](handleError(_0x5e5c47,null));};exports['addDisposition']=function(_0x3dd79c,_0x2c9717,_0xb7f57e){if(_0x3dd79c['body']['id']){delete _0x3dd79c[_0xb443('0x5b')]['id'];}return db[_0xb443('0x40')][_0xb443('0x5a')]({'where':{'id':_0x3dd79c[_0xb443('0x57')]['id']}})[_0xb443('0x22')](handleEntityNotFound(_0x2c9717,null))[_0xb443('0x22')](function(_0x2bfa60){if(_0x2bfa60){_0x3dd79c['body']['FaxAccountId']=_0x2bfa60['id'];return db[_0xb443('0x64')][_0xb443('0x61')](_0x3dd79c[_0xb443('0x5b')]);}})[_0xb443('0x22')](respondWithResult(_0x2c9717,null))[_0xb443('0x55')](handleError(_0x2c9717,null));};exports[_0xb443('0x65')]=function(_0x330661,_0x1e4cee,_0x338af9){var _0x11e599={'raw':![],'where':{}};var _0x262b2b={};var _0x4663d6={'count':0x0,'rows':[]};return db[_0xb443('0x40')]['findOne']({'where':{'id':_0x330661['params']['id']}})[_0xb443('0x22')](handleEntityNotFound(_0x1e4cee,null))[_0xb443('0x22')](function(_0x193f37){if(_0x193f37){_0x262b2b[_0xb443('0x44')]=_[_0xb443('0x46')](db['Disposition']['rawAttributes']);_0x262b2b[_0xb443('0x45')]=_[_0xb443('0x46')](_0x330661['query']);_0x262b2b[_0xb443('0x47')]=_[_0xb443('0x48')](_0x262b2b['model'],_0x262b2b[_0xb443('0x45')]);_0x11e599[_0xb443('0x49')]=_['intersection'](_0x262b2b['model'],qs['fields'](_0x330661[_0xb443('0x45')][_0xb443('0x4a')]));_0x11e599['attributes']=_0x11e599[_0xb443('0x49')][_0xb443('0x58')]?_0x11e599['attributes']:_0x262b2b['model'];if(!_0x330661['query'][_0xb443('0x4b')](_0xb443('0x4c'))){_0x11e599[_0xb443('0x30')]=qs[_0xb443('0x30')](_0x330661[_0xb443('0x45')][_0xb443('0x30')]);_0x11e599[_0xb443('0x2d')]=qs[_0xb443('0x2d')](_0x330661[_0xb443('0x45')][_0xb443('0x2d')]);}_0x11e599[_0xb443('0x66')]=qs[_0xb443('0x4d')](_0x330661[_0xb443('0x45')][_0xb443('0x4d')]);_0x11e599['where']=qs[_0xb443('0x47')](_['pick'](_0x330661['query'],_0x262b2b[_0xb443('0x47')]));_0x11e599['where'][_0xb443('0x67')]=_0x193f37['id'];if(_0x330661[_0xb443('0x45')]['filter']){_0x11e599[_0xb443('0x4f')]=_['merge'](_0x11e599[_0xb443('0x4f')],{'$or':_[_0xb443('0x3f')](_0x11e599[_0xb443('0x49')],function(_0x273d15){var _0x5e1df0={};_0x5e1df0[_0x273d15]={'$like':'%'+_0x330661['query']['filter']+'%'};return _0x5e1df0;})});}_0x11e599=_[_0xb443('0x50')]({},_0x11e599,_0x330661['options']);return db['Disposition'][_0xb443('0x2f')]({'where':_0x11e599[_0xb443('0x4f')]})['then'](function(_0x1deaed){_0x4663d6['count']=_0x1deaed;if(_0x330661[_0xb443('0x45')][_0xb443('0x59')]){_0x11e599[_0xb443('0x52')]=[{'all':!![]}];}return db[_0xb443('0x64')][_0xb443('0x53')](_0x11e599);})[_0xb443('0x22')](function(_0x399e39){_0x4663d6[_0xb443('0x54')]=_0x399e39;return _0x4663d6;});}})[_0xb443('0x22')](respondWithFilteredResult(_0x1e4cee,_0x11e599))['catch'](handleError(_0x1e4cee,null));};exports[_0xb443('0x68')]=function(_0x10b980,_0x12d5e8,_0x5d9019){return db[_0xb443('0x40')][_0xb443('0x5a')]({'where':{'id':_0x10b980[_0xb443('0x57')]['id']}})['then'](handleEntityNotFound(_0x12d5e8,null))['then'](function(_0x13c918){if(_0x13c918){return _0x13c918['removeDispositions'](_0x10b980[_0xb443('0x45')][_0xb443('0x69')]);}})[_0xb443('0x22')](respondWithStatusCode(_0x12d5e8,null))[_0xb443('0x55')](handleError(_0x12d5e8,null));};exports['addAnswer']=function(_0x476147,_0x3585df,_0x18c583){if(_0x476147[_0xb443('0x5b')]['id']){delete _0x476147[_0xb443('0x5b')]['id'];}return db[_0xb443('0x40')]['find']({'where':{'id':_0x476147[_0xb443('0x57')]['id']}})[_0xb443('0x22')](handleEntityNotFound(_0x3585df,null))[_0xb443('0x22')](function(_0x50b802){if(_0x50b802){_0x476147[_0xb443('0x5b')][_0xb443('0x67')]=_0x50b802['id'];return db[_0xb443('0x6a')][_0xb443('0x61')](_0x476147[_0xb443('0x5b')]);}})[_0xb443('0x22')](respondWithResult(_0x3585df,null))[_0xb443('0x55')](handleError(_0x3585df,null));};exports[_0xb443('0x6b')]=function(_0x2cd8a9,_0x1f3f2d,_0x36c11b){var _0x27279d={'raw':![],'where':{}};var _0x380c15={};var _0xc50dae={'count':0x0,'rows':[]};return db[_0xb443('0x40')]['findOne']({'where':{'id':_0x2cd8a9[_0xb443('0x57')]['id']}})[_0xb443('0x22')](handleEntityNotFound(_0x1f3f2d,null))['then'](function(_0x262315){if(_0x262315){_0x380c15[_0xb443('0x44')]=_['keys'](db[_0xb443('0x6a')][_0xb443('0x41')]);_0x380c15['query']=_['keys'](_0x2cd8a9[_0xb443('0x45')]);_0x380c15[_0xb443('0x47')]=_[_0xb443('0x48')](_0x380c15[_0xb443('0x44')],_0x380c15[_0xb443('0x45')]);_0x27279d[_0xb443('0x49')]=_['intersection'](_0x380c15[_0xb443('0x44')],qs['fields'](_0x2cd8a9[_0xb443('0x45')][_0xb443('0x4a')]));_0x27279d['attributes']=_0x27279d[_0xb443('0x49')][_0xb443('0x58')]?_0x27279d[_0xb443('0x49')]:_0x380c15[_0xb443('0x44')];if(!_0x2cd8a9[_0xb443('0x45')]['hasOwnProperty']('nolimit')){_0x27279d[_0xb443('0x30')]=qs['limit'](_0x2cd8a9[_0xb443('0x45')][_0xb443('0x30')]);_0x27279d[_0xb443('0x2d')]=qs[_0xb443('0x2d')](_0x2cd8a9[_0xb443('0x45')]['offset']);}_0x27279d[_0xb443('0x66')]=qs[_0xb443('0x4d')](_0x2cd8a9[_0xb443('0x45')][_0xb443('0x4d')]);_0x27279d[_0xb443('0x4f')]=qs['filters'](_[_0xb443('0x6c')](_0x2cd8a9[_0xb443('0x45')],_0x380c15[_0xb443('0x47')]));_0x27279d[_0xb443('0x4f')][_0xb443('0x67')]=_0x262315['id'];if(_0x2cd8a9['query'][_0xb443('0x4e')]){_0x27279d[_0xb443('0x4f')]=_[_0xb443('0x50')](_0x27279d['where'],{'$or':_[_0xb443('0x3f')](_0x27279d[_0xb443('0x49')],function(_0x4487dc){var _0x2c2710={};_0x2c2710[_0x4487dc]={'$like':'%'+_0x2cd8a9['query'][_0xb443('0x4e')]+'%'};return _0x2c2710;})});}_0x27279d=_[_0xb443('0x50')]({},_0x27279d,_0x2cd8a9[_0xb443('0x6d')]);return db['CannedAnswer'][_0xb443('0x2f')]({'where':_0x27279d[_0xb443('0x4f')]})['then'](function(_0x3c5403){_0xc50dae['count']=_0x3c5403;if(_0x2cd8a9['query'][_0xb443('0x59')]){_0x27279d[_0xb443('0x52')]=[{'all':!![]}];}return db[_0xb443('0x6a')][_0xb443('0x53')](_0x27279d);})['then'](function(_0x448291){_0xc50dae[_0xb443('0x54')]=_0x448291;return _0xc50dae;});}})[_0xb443('0x22')](respondWithFilteredResult(_0x1f3f2d,_0x27279d))['catch'](handleError(_0x1f3f2d,null));};exports[_0xb443('0x6e')]=function(_0x1969b5,_0x2f942a,_0x55875a){return db['FaxAccount'][_0xb443('0x5a')]({'where':{'id':_0x1969b5[_0xb443('0x57')]['id']}})[_0xb443('0x22')](handleEntityNotFound(_0x2f942a,null))['then'](function(_0x112e07){if(_0x112e07){return _0x112e07[_0xb443('0x6e')](_0x1969b5[_0xb443('0x45')][_0xb443('0x69')]);}})[_0xb443('0x22')](respondWithStatusCode(_0x2f942a,null))[_0xb443('0x55')](handleError(_0x2f942a,null));};exports[_0xb443('0x6f')]=function(_0x87f7ac,_0x1271cf,_0x3d25c2){return db[_0xb443('0x70')]['find']({'where':{'id':_0x87f7ac['params']['id']}})[_0xb443('0x22')](handleEntityNotFound(_0x1271cf,null))[_0xb443('0x22')](function(_0x253fe3){if(_0x253fe3){return _0x253fe3['addInteraction'](_0x87f7ac[_0xb443('0x5b')]['ids'],_[_0xb443('0x71')](_0x87f7ac['body'],['ids','id'])||{});}})[_0xb443('0x22')](respondWithResult(_0x1271cf,null))['catch'](handleError(_0x1271cf,null));};exports[_0xb443('0x72')]=function(_0x190707,_0x206ba6,_0x3ac462){var _0x1973df={'raw':![],'where':{}};var _0x4f8dc6={};var _0x30b753={'count':0x0,'rows':[]};return db[_0xb443('0x40')][_0xb443('0x73')]({'where':{'id':_0x190707[_0xb443('0x57')]['id']}})['then'](handleEntityNotFound(_0x206ba6,null))[_0xb443('0x22')](function(_0x212c89){if(_0x212c89){_0x4f8dc6['model']=_[_0xb443('0x46')](db[_0xb443('0x70')][_0xb443('0x41')]);_0x4f8dc6['query']=_[_0xb443('0x46')](_0x190707[_0xb443('0x45')]);_0x4f8dc6['filters']=_[_0xb443('0x48')](_0x4f8dc6[_0xb443('0x44')],_0x4f8dc6[_0xb443('0x45')]);_0x1973df[_0xb443('0x49')]=_[_0xb443('0x48')](_0x4f8dc6['model'],qs[_0xb443('0x4a')](_0x190707[_0xb443('0x45')][_0xb443('0x4a')]));_0x1973df[_0xb443('0x49')]=_0x1973df[_0xb443('0x49')]['length']?_0x1973df[_0xb443('0x49')]:_0x4f8dc6[_0xb443('0x44')];if(!_0x190707[_0xb443('0x45')][_0xb443('0x4b')](_0xb443('0x4c'))){_0x1973df[_0xb443('0x30')]=qs[_0xb443('0x30')](_0x190707[_0xb443('0x45')][_0xb443('0x30')]);_0x1973df[_0xb443('0x2d')]=qs[_0xb443('0x2d')](_0x190707[_0xb443('0x45')]['offset']);}_0x1973df[_0xb443('0x66')]=qs[_0xb443('0x4d')](_0x190707[_0xb443('0x45')][_0xb443('0x4d')]);_0x1973df[_0xb443('0x4f')]=qs[_0xb443('0x47')](_['pick'](_0x190707[_0xb443('0x45')],_0x4f8dc6['filters']));_0x1973df[_0xb443('0x4f')][_0xb443('0x67')]=_0x212c89['id'];if(_0x190707['query'][_0xb443('0x4e')]){_0x1973df[_0xb443('0x4f')]=_[_0xb443('0x50')](_0x1973df[_0xb443('0x4f')],{'$or':_[_0xb443('0x3f')](_0x1973df[_0xb443('0x49')],function(_0x671e24){var _0x96445={};_0x96445[_0x671e24]={'$like':'%'+_0x190707[_0xb443('0x45')][_0xb443('0x4e')]+'%'};return _0x96445;})});}_0x1973df=_[_0xb443('0x50')]({},_0x1973df,_0x190707[_0xb443('0x6d')]);return db['FaxInteraction'][_0xb443('0x2f')]({'where':_0x1973df[_0xb443('0x4f')]})[_0xb443('0x22')](function(_0x17fb24){_0x30b753[_0xb443('0x2f')]=_0x17fb24;if(_0x190707[_0xb443('0x45')]['includeAll']){_0x1973df[_0xb443('0x52')]=[{'model':db[_0xb443('0x74')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xb443('0x75'),'attributes':[_0xb443('0x3b'),_0xb443('0x76'),_0xb443('0x77')],'required':![]},{'model':db['Tag'],'as':_0xb443('0x78'),'attributes':['id','name','color'],'where':_0x190707[_0xb443('0x45')]['tag']?{'id':_0x190707[_0xb443('0x45')]['tag']}:undefined,'required':_0x190707[_0xb443('0x45')][_0xb443('0x79')]?!![]:![]}];}return db['FaxInteraction'][_0xb443('0x53')](_0x1973df);})['then'](function(_0x51b6a6){_0x30b753[_0xb443('0x54')]=_0x51b6a6;return _0x30b753;});}})[_0xb443('0x22')](respondWithFilteredResult(_0x206ba6,_0x1973df))['catch'](handleError(_0x206ba6,null));};exports[_0xb443('0x7a')]=function(_0xf8a28d,_0x20dc40){var _0x4779c3=_0xf8a28d[_0xb443('0x57')]['id'];var _0x7fcd60=_0xf8a28d['body'];var _0x396c0a=0xc8;var _0x2d9f26=null;return db[_0xb443('0x7b')]['transaction']({'isolationLevel':db[_0xb443('0x7b')][_0xb443('0x7c')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x1121ca){return db[_0xb443('0x40')][_0xb443('0x73')]({'where':{'id':_0x4779c3},'transaction':_0x1121ca})['then'](function(_0x8e07e2){if(_0x8e07e2){return db['FaxApplication']['destroy']({'where':{'FaxAccountId':_0x4779c3},'transaction':_0x1121ca})[_0xb443('0x22')](function(){var _0x16501d=_['map'](_0x7fcd60,function(_0xd76105){_0xd76105[_0xb443('0x67')]=_0x4779c3;return _0xd76105;});return db[_0xb443('0x7d')][_0xb443('0x7e')](_0x16501d,{'transaction':_0x1121ca});});}else{_0x396c0a=0x194;_0x2d9f26=[];}});})[_0xb443('0x22')](function(){if(_0x396c0a!==0x194){return db['FaxApplication'][_0xb443('0x7f')]({'where':{'FaxAccountId':_0x4779c3},'order':_0xb443('0x80')})['then'](function(_0x483100){_0x2d9f26=_0x483100;});}})['catch'](function(_0x583861){_0x396c0a=0x1f4;logger['error'](_0x583861[_0xb443('0x3a')]);if(_0x583861[_0xb443('0x3b')]){delete _0x583861[_0xb443('0x3b')];}_0x2d9f26=_0x583861;})['finally'](function(){if(_0x2d9f26===null){_0x20dc40['sendStatus'](_0x396c0a);}else{if(_0x396c0a===0x1f4){_0x20dc40[_0xb443('0x31')](_0x396c0a)[_0xb443('0x81')](_0x2d9f26);}else{_0x20dc40['status'](_0x396c0a)[_0xb443('0x2c')](_0x2d9f26);}}});};exports[_0xb443('0x82')]=function(_0x21da50,_0x1de0d8,_0x266f20){var _0x55f7f7={};var _0xffdb0f={};var _0x59bccc;var _0x1fb811;return db[_0xb443('0x40')]['findOne']({'where':{'id':_0x21da50['params']['id']}})['then'](handleEntityNotFound(_0x1de0d8,null))[_0xb443('0x22')](function(_0x2384c7){if(_0x2384c7){_0x59bccc=_0x2384c7;_0xffdb0f['model']=_[_0xb443('0x46')](db['FaxApplication'][_0xb443('0x41')]);_0xffdb0f['query']=_[_0xb443('0x46')](_0x21da50[_0xb443('0x45')]);_0xffdb0f[_0xb443('0x47')]=_['intersection'](_0xffdb0f[_0xb443('0x44')],_0xffdb0f[_0xb443('0x45')]);_0x55f7f7[_0xb443('0x49')]=_[_0xb443('0x48')](_0xffdb0f[_0xb443('0x44')],qs[_0xb443('0x4a')](_0x21da50[_0xb443('0x45')]['fields']));_0x55f7f7[_0xb443('0x49')]=_0x55f7f7['attributes'][_0xb443('0x58')]?_0x55f7f7['attributes']:_0xffdb0f['model'];_0x55f7f7[_0xb443('0x66')]=qs[_0xb443('0x4d')](_0x21da50[_0xb443('0x45')][_0xb443('0x4d')]);_0x55f7f7[_0xb443('0x4f')]=qs['filters'](_[_0xb443('0x6c')](_0x21da50[_0xb443('0x45')],_0xffdb0f[_0xb443('0x47')]));if(_0x21da50['query'][_0xb443('0x4e')]){_0x55f7f7[_0xb443('0x4f')]=_[_0xb443('0x50')](_0x55f7f7['where'],{'$or':_[_0xb443('0x3f')](_0x55f7f7['attributes'],function(_0x2dcf9f){var _0x467d97={};_0x467d97[_0x2dcf9f]={'$like':'%'+_0x21da50[_0xb443('0x45')][_0xb443('0x4e')]+'%'};return _0x467d97;})});}_0x55f7f7=_['merge']({},_0x55f7f7,_0x21da50['options']);return _0x59bccc[_0xb443('0x82')](_0x55f7f7);}})[_0xb443('0x22')](function(_0x3eac3e){if(_0x3eac3e){_0x1fb811=_0x3eac3e[_0xb443('0x58')];if(!_0x21da50[_0xb443('0x45')][_0xb443('0x4b')](_0xb443('0x4c'))){_0x55f7f7[_0xb443('0x30')]=qs[_0xb443('0x30')](_0x21da50[_0xb443('0x45')]['limit']);_0x55f7f7[_0xb443('0x2d')]=qs['offset'](_0x21da50[_0xb443('0x45')][_0xb443('0x2d')]);}return _0x59bccc['getApplications'](_0x55f7f7);}})[_0xb443('0x22')](function(_0x1eca0f){if(_0x1eca0f){return _0x1eca0f?{'count':_0x1fb811,'rows':_0x1eca0f}:null;}})[_0xb443('0x22')](respondWithResult(_0x1de0d8,null))[_0xb443('0x55')](handleError(_0x1de0d8,null));};function Extension(_0x37a0c7,_0x11d331,_0x3ec61c,_0x5365b6){this[_0xb443('0x83')]=_0xb443('0x84');this['exten']=_0x37a0c7[_0xb443('0x85')];this['app']=_0x5365b6;this[_0xb443('0x43')]='system';this[_0xb443('0x86')]=_0xb443('0x87');this[_0xb443('0x67')]=_0x37a0c7['id'];this['priority']=_0x11d331;this[_0xb443('0x88')]=_0x3ec61c;}function createExtensionsReciveFax(_0x1b0998){var _0x24f581=0x1;var _0x55be62=[];_0x55be62[_0xb443('0x89')](new Extension(_0x1b0998,_0x24f581,'',_0xb443('0x8a')));_0x24f581+=0x1;_0x55be62[_0xb443('0x89')](new Extension(_0x1b0998,_0x24f581,_0xb443('0x8b'),_0xb443('0x8c')));_0x24f581+=0x1;for(var _0x26dbb8 in _0x1b0998){if(_0x1b0998[_0xb443('0x4b')](_0x26dbb8)&&(_0x26dbb8==='ecm'||_0x26dbb8===_0xb443('0x85')||_0x26dbb8==='gateway'||_0x26dbb8===_0xb443('0x8d')||_0x26dbb8===_0xb443('0x8e')||_0x26dbb8==='maxrate'||_0x26dbb8===_0xb443('0x8f')||_0x26dbb8===_0xb443('0x90')||_0x26dbb8===_0xb443('0x91'))){_0x55be62[_0xb443('0x89')](new Extension(_0x1b0998,_0x24f581,_0xb443('0x92')+_0x26dbb8+')='+_0x1b0998[_0x26dbb8],'Set'));_0x24f581+=0x1;}}_0x55be62[_0xb443('0x89')](new Extension(_0x1b0998,_0x24f581,'6',_0xb443('0x93')));_0x24f581+=0x1;_0x55be62['push'](new Extension(_0x1b0998,_0x24f581,'/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',_0xb443('0x94')));_0x24f581=0x0;return _0x55be62;}exports[_0xb443('0x95')]=function(_0x1f6129,_0x3ecb79,_0x27667b){var _0xb5cd30;return db[_0xb443('0x7b')][_0xb443('0x96')](function(_0x41e19e){return db[_0xb443('0x40')][_0xb443('0x61')](_0x1f6129[_0xb443('0x5b')],{'transaction':_0x41e19e})[_0xb443('0x22')](function(_0x427449){_0xb5cd30=_0x427449[_0xb443('0x37')]({'plain':!![]});return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_0xb5cd30),{'transaction':_0x41e19e});});})[_0xb443('0x22')](function(){return _0xb5cd30;})[_0xb443('0x22')](respondWithResult(_0x3ecb79,null))['catch'](handleError(_0x3ecb79,null));};exports['updateAccountApplications']=function(_0x232ce8,_0x597068,_0x119f0a){var _0x3fdf10;return db[_0xb443('0x7b')][_0xb443('0x96')](function(_0x1abca0){return db['FaxAccount']['update'](_0x232ce8[_0xb443('0x5b')],{'where':{'id':_0x232ce8[_0xb443('0x5b')]['id']},'transaction':_0x1abca0})[_0xb443('0x22')](function(_0x550842){return db[_0xb443('0x97')][_0xb443('0x36')]({'where':{'FaxAccountId':_0x232ce8['body']['id']},'transaction':_0x1abca0})[_0xb443('0x22')](function(_0x56323f){return db[_0xb443('0x97')]['bulkCreate'](createExtensionsReciveFax(_[_0xb443('0x71')](_0x232ce8['body'],[_0xb443('0x98'),_0xb443('0x99'),'createdAt','updatedAt',_0xb443('0x9a'),'ListId'])),{'transaction':_0x1abca0});});});})[_0xb443('0x22')](function(){return db[_0xb443('0x40')][_0xb443('0x9b')](_0x232ce8[_0xb443('0x5b')]['id']);})[_0xb443('0x22')](respondWithResult(_0x597068,null))[_0xb443('0x55')](handleError(_0x597068,null));};exports[_0xb443('0x9c')]=function(_0x59524e,_0x2dc252,_0x156a2d){var _0x2ed081={'raw':!![],'where':{}};var _0x49f057={};var _0x3f0bcd={'count':0x0,'rows':[]};return db[_0xb443('0x40')][_0xb443('0x73')]({'where':{'id':_0x59524e['params']['id']}})[_0xb443('0x22')](handleEntityNotFound(_0x2dc252,null))[_0xb443('0x22')](function(_0x3dc8fe){if(_0x3dc8fe){_0x49f057[_0xb443('0x44')]=_[_0xb443('0x46')](db[_0xb443('0x9d')][_0xb443('0x41')]);_0x49f057['query']=_[_0xb443('0x46')](_0x59524e[_0xb443('0x45')]);_0x49f057[_0xb443('0x47')]=_[_0xb443('0x48')](_0x49f057[_0xb443('0x44')],_0x49f057['query']);_0x2ed081[_0xb443('0x49')]=_[_0xb443('0x48')](_0x49f057['model'],qs['fields'](_0x59524e[_0xb443('0x45')][_0xb443('0x4a')]));_0x2ed081[_0xb443('0x49')]=_0x2ed081[_0xb443('0x49')]['length']?_0x2ed081[_0xb443('0x49')]:_0x49f057['model'];if(!_0x59524e[_0xb443('0x45')][_0xb443('0x4b')](_0xb443('0x4c'))){_0x2ed081[_0xb443('0x30')]=qs[_0xb443('0x30')](_0x59524e[_0xb443('0x45')]['limit']);_0x2ed081['offset']=qs['offset'](_0x59524e[_0xb443('0x45')]['offset']);}_0x2ed081[_0xb443('0x66')]=qs[_0xb443('0x4d')](_0x59524e[_0xb443('0x45')][_0xb443('0x4d')]);_0x2ed081['where']=qs[_0xb443('0x47')](_[_0xb443('0x6c')](_0x59524e[_0xb443('0x45')],_0x49f057[_0xb443('0x47')]));_0x2ed081['where']['FaxAccountId']=_0x3dc8fe['id'];if(_0x59524e[_0xb443('0x45')]['filter']){_0x2ed081[_0xb443('0x4f')]=_[_0xb443('0x50')](_0x2ed081[_0xb443('0x4f')],{'$or':_[_0xb443('0x3f')](_0x2ed081['attributes'],function(_0x37d6ae){var _0x4bdc9a={};_0x4bdc9a[_0x37d6ae]={'$like':'%'+_0x59524e[_0xb443('0x45')][_0xb443('0x4e')]+'%'};return _0x4bdc9a;})});}if(_0x59524e[_0xb443('0x45')]['$gte']){var _0x21a336=_0x59524e[_0xb443('0x45')][_0xb443('0x9e')][_0xb443('0x9f')](',');var _0x1bbce9={};_0x1bbce9[_0x21a336[0x0]]={'$gte':moment(_0x21a336[0x1])[_0xb443('0xa0')](_0xb443('0xa1'))};_0x2ed081[_0xb443('0x4f')]=_[_0xb443('0x50')](_0x2ed081[_0xb443('0x4f')],_0x1bbce9);}_0x2ed081=_['merge']({},_0x2ed081,_0x59524e['options']);return db['FaxMessage']['count']({'where':_0x2ed081[_0xb443('0x4f')]})['then'](function(_0x426017){_0x3f0bcd['count']=_0x426017;if(_0x59524e[_0xb443('0x45')]['includeAll']){_0x2ed081['include']=[{'all':!![]}];}return db[_0xb443('0x9d')][_0xb443('0x53')](_0x2ed081);})[_0xb443('0x22')](function(_0x14f0a3){_0x3f0bcd[_0xb443('0x54')]=_0x14f0a3;return _0x3f0bcd;});}})[_0xb443('0x22')](respondWithFilteredResult(_0x2dc252,_0x2ed081))[_0xb443('0x55')](handleError(_0x2dc252,null));};exports[_0xb443('0x81')]=function(_0x404f79,_0x330055,_0x2f5709){var _0x292b39,_0x2ec336={},_0x301d5c;if(_0x404f79[_0xb443('0x5b')]['to']){_0x301d5c=_0x404f79[_0xb443('0x5b')]['to'][0x0];}return db[_0xb443('0x40')][_0xb443('0x5a')]({'where':{'id':_0x404f79[_0xb443('0x57')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xb443('0x74')],'as':_0xb443('0xa2'),'where':{'fax':_0x301d5c},'limit':0x1,'order':[['updatedAt',_0xb443('0xa3')]]}]}]})['then'](handleEntityNotFound(_0x330055,null))[_0xb443('0x22')](function(_0xdeb5f){_0x292b39=_0xdeb5f;if(_0x404f79[_0xb443('0x5b')]['attachments']&&_0x404f79[_0xb443('0x5b')]['attachments'][_0xb443('0x58')]){for(var _0x4e6993=0x0;_0x4e6993<_0x404f79[_0xb443('0x5b')][_0xb443('0xa4')][_0xb443('0x58')];_0x4e6993+=0x1){_0x404f79[_0xb443('0x5b')][_0xb443('0xa4')][_0x4e6993]={'filename':_0x404f79[_0xb443('0x5b')][_0xb443('0xa4')][_0x4e6993][_0xb443('0x3b')],'id':_0x404f79[_0xb443('0x5b')][_0xb443('0xa4')][_0x4e6993]['id'],'path':path[_0xb443('0xa5')](config[_0xb443('0xa6')],_0xb443('0xa7'),_0x404f79['body']['attachments'][_0x4e6993][_0xb443('0xa8')])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_[_0xb443('0xa9')](_0x404f79[_0xb443('0x57')]['id'])?undefined:_0x404f79[_0xb443('0x57')]['id'],'path':_[_0xb443('0xa9')](_0x404f79['body'][_0xb443('0xa4')][0x0][_0xb443('0xaa')])?undefined:_0x404f79[_0xb443('0x5b')]['attachments'][0x0]['path'],'fax':_['isNil'](_0x404f79[_0xb443('0x5b')]['to'][0x0])?undefined:_0x404f79['body']['to'][0x0]},client9002);})['then'](function(){if(_0x292b39){if(_[_0xb443('0xa9')](_0x404f79[_0xb443('0x5b')][_0xb443('0xab')])){_0x404f79[_0xb443('0x5b')][_0xb443('0xab')]=util[_0xb443('0xa0')]('\x22%s\x22\x20<%s>',_0x292b39['name'],_0x292b39['fax']);}if(_0x292b39[_0xb443('0xac')]){if(_0x292b39[_0xb443('0xac')][_0xb443('0xa2')]['length']){return _0x292b39[_0xb443('0xac')]['Contacts'][0x0];}else{return db[_0xb443('0x74')][_0xb443('0x61')](_['defaults'](_0x404f79[_0xb443('0x5b')],{'firstName':_0x404f79[_0xb443('0x5b')]['to'][0x0],'phone':_0x404f79['body']['to'][0x0],'fax':_0x404f79[_0xb443('0x5b')]['to'][0x0],'ListId':_0x292b39[_0xb443('0xad')]}));}}else{throw new Error(_0xb443('0xae'));}}else{throw new Error('Send\x20Fax\x20failed');}})['then'](function(_0x1102d9){if(_0x1102d9){return db[_0xb443('0x70')]['find']({'where':{'ContactId':_0x1102d9['id'],'closed':![],'FaxAccountId':_0x292b39['id']}})[_0xb443('0x22')](function(_0x21663a){if(_0x21663a){return[_0x21663a,![]];}return db[_0xb443('0x70')][_0xb443('0x61')]({'UserId':_0x404f79[_0xb443('0x5c')]['id'],'ContactId':_0x1102d9['id'],'FaxAccountId':_0x292b39['id'],'fax':_0x404f79[_0xb443('0x5b')]['to'][0x0],'firstMsgDirection':_0xb443('0xaf'),'Messages':[_[_0xb443('0x50')](_0x404f79['body'],{'read':![],'body':_0x404f79[_0xb443('0x5b')][_0xb443('0xa4')][0x0][_0xb443('0xb0')],'FaxAccountId':_0x292b39['id'],'UserId':_0x404f79[_0xb443('0x5c')]['id'],'ContactId':_0x1102d9['id'],'AttachmentId':_0x404f79[_0xb443('0x5b')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0xb443('0x9d')],'as':'Messages'}]})[_0xb443('0x22')](function(_0x20eba7){return[_0x20eba7,!![]];});});}else{throw new Error(_0xb443('0xb1'));}})[_0xb443('0xb2')](function(_0x51fddd,_0x1d3568){if(_0x1d3568){return _0x51fddd;}return db['FaxMessage'][_0xb443('0x61')]({'direction':_0xb443('0xaf'),'read':![],'body':_0x404f79[_0xb443('0x5b')]['attachments'][0x0]['filename'],'FaxAccountId':_0x292b39['id'],'FaxInteractionId':_0x51fddd['id'],'UserId':_0x404f79['user']['id'],'ContactId':_0x51fddd[_0xb443('0xb3')],'AttachmentId':_0x404f79[_0xb443('0x5b')][_0xb443('0xa4')][0x0]['id']})[_0xb443('0x22')](function(_0x41111d){_0x51fddd['dataValues'][_0xb443('0xb4')]=[];_0x51fddd[_0xb443('0xb5')][_0xb443('0xb4')][_0xb443('0x89')](_0x41111d[_0xb443('0xb5')]);return _0x51fddd;});})[_0xb443('0x22')](function(_0x1046dd){respondWithRpcPromise(_0xb443('0xb6'),'SendFax',{'FaxAccountId':_[_0xb443('0xa9')](_0x404f79[_0xb443('0x57')]['id'])?undefined:_0x404f79['params']['id'],'path':_[_0xb443('0xa9')](_0x404f79['body'][_0xb443('0xa4')][0x0]['path'])?undefined:_0x404f79[_0xb443('0x5b')]['attachments'][0x0][_0xb443('0xaa')],'fax':_[_0xb443('0xa9')](_0x404f79['body']['to'][0x0])?undefined:_0x404f79[_0xb443('0x5b')]['to'][0x0],'AttachmentId':_0x404f79['body'][_0xb443('0xa4')][0x0]['id']},client9002)[_0xb443('0x22')](function(_0x288937){logger['info'](_0xb443('0xb7'),_0x288937);})[_0xb443('0x55')](function(_0x744e97){logger[_0xb443('0x23')](_0xb443('0xb7'),_0x744e97);});return _0x1046dd;})['then'](respondWithResult(_0x330055,null))['catch'](handleError(_0x330055,null));};exports['addAgents']=function(_0x3313c9,_0x502035,_0x474239){return db['FaxAccount'][_0xb443('0x5a')]({'where':{'id':_0x3313c9['params']['id']}})[_0xb443('0x22')](handleEntityNotFound(_0x502035,null))[_0xb443('0x22')](function(_0x51418b){if(_0x51418b){return _0x51418b[_0xb443('0xb8')](_0x3313c9[_0xb443('0x5b')][_0xb443('0x69')],_[_0xb443('0x71')](_0x3313c9[_0xb443('0x5b')],[_0xb443('0x69'),'id'])||{})[_0xb443('0xb2')](function(_0x25f37d){for(var _0x136fbd=0x0;_0x136fbd<_0x3313c9['body'][_0xb443('0x69')]['length'];_0x136fbd+=0x1){socket['emit'](_0xb443('0xb9'),{'UserId':Number(_0x3313c9[_0xb443('0x5b')][_0xb443('0x69')][_0x136fbd]),'FaxAccountId':Number(_0x3313c9['params']['id'])});}return _0x25f37d;});}})[_0xb443('0x22')](respondWithResult(_0x502035,null))[_0xb443('0x55')](handleError(_0x502035,null));};exports[_0xb443('0xba')]=function(_0x5e3068,_0x5323e2,_0x18b916){return db['FaxAccount'][_0xb443('0x5a')]({'where':{'id':_0x5e3068[_0xb443('0x57')]['id']}})['then'](handleEntityNotFound(_0x5323e2,null))[_0xb443('0x22')](function(_0x2ef741){if(_0x2ef741){return _0x2ef741[_0xb443('0xba')](_0x5e3068[_0xb443('0x45')][_0xb443('0x69')])[_0xb443('0x22')](function(){if(_[_0xb443('0xbb')](_0x5e3068[_0xb443('0x45')][_0xb443('0x69')])){for(var _0x36ea07=0x0;_0x36ea07<_0x5e3068[_0xb443('0x45')]['ids'][_0xb443('0x58')];_0x36ea07+=0x1){socket[_0xb443('0xbc')](_0xb443('0xbd'),{'UserId':Number(_0x5e3068[_0xb443('0x45')][_0xb443('0x69')][_0x36ea07]),'FaxAccountId':Number(_0x5e3068['params']['id'])});}}else{socket[_0xb443('0xbc')](_0xb443('0xbd'),{'UserId':Number(_0x5e3068[_0xb443('0x45')][_0xb443('0x69')]),'FaxAccountId':Number(_0x5e3068[_0xb443('0x57')]['id'])});}});}})[_0xb443('0x22')](respondWithStatusCode(_0x5323e2,null))['catch'](handleError(_0x5323e2,null));};exports[_0xb443('0xbe')]=function(_0x3e9454,_0x328dc3,_0x35dd6d){var _0x17722b={};var _0x16ac5f={};var _0x39250d;var _0x21ee52;return db['FaxAccount'][_0xb443('0x73')]({'where':{'id':_0x3e9454[_0xb443('0x57')]['id']}})['then'](handleEntityNotFound(_0x328dc3,null))['then'](function(_0x28f7ec){if(_0x28f7ec){_0x39250d=_0x28f7ec;_0x16ac5f[_0xb443('0x44')]=_['keys'](db[_0xb443('0xbf')][_0xb443('0x41')]);_0x16ac5f[_0xb443('0x45')]=_[_0xb443('0x46')](_0x3e9454[_0xb443('0x45')]);_0x16ac5f[_0xb443('0x47')]=_['intersection'](_0x16ac5f[_0xb443('0x44')],_0x16ac5f[_0xb443('0x45')]);_0x17722b['attributes']=_[_0xb443('0x48')](_0x16ac5f['model'],qs['fields'](_0x3e9454['query'][_0xb443('0x4a')]));_0x17722b[_0xb443('0x49')]=_0x17722b[_0xb443('0x49')][_0xb443('0x58')]?_0x17722b[_0xb443('0x49')]:_0x16ac5f[_0xb443('0x44')];_0x17722b[_0xb443('0x66')]=qs['sort'](_0x3e9454[_0xb443('0x45')][_0xb443('0x4d')]);_0x17722b[_0xb443('0x4f')]=qs[_0xb443('0x47')](_[_0xb443('0x6c')](_0x3e9454['query'],_0x16ac5f[_0xb443('0x47')]));if(_0x3e9454['query'][_0xb443('0x4e')]){_0x17722b['where']=_[_0xb443('0x50')](_0x17722b[_0xb443('0x4f')],{'$or':_[_0xb443('0x3f')](_0x17722b['attributes'],function(_0x24d7ae){var _0x26cf60={};_0x26cf60[_0x24d7ae]={'$like':'%'+_0x3e9454[_0xb443('0x45')][_0xb443('0x4e')]+'%'};return _0x26cf60;})});}_0x17722b=_[_0xb443('0x50')]({},_0x17722b,_0x3e9454[_0xb443('0x6d')]);return _0x39250d[_0xb443('0xbe')](_0x17722b);}})[_0xb443('0x22')](function(_0x3b963e){if(_0x3b963e){_0x21ee52=_0x3b963e['length'];if(!_0x3e9454[_0xb443('0x45')][_0xb443('0x4b')](_0xb443('0x4c'))){_0x17722b[_0xb443('0x30')]=qs[_0xb443('0x30')](_0x3e9454[_0xb443('0x45')][_0xb443('0x30')]);_0x17722b[_0xb443('0x2d')]=qs[_0xb443('0x2d')](_0x3e9454['query'][_0xb443('0x2d')]);}return _0x39250d[_0xb443('0xbe')](_0x17722b);}})[_0xb443('0x22')](function(_0x34520d){if(_0x34520d){return _0x34520d?{'count':_0x21ee52,'rows':_0x34520d}:null;}})[_0xb443('0x22')](respondWithResult(_0x328dc3,null))[_0xb443('0x55')](handleError(_0x328dc3,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index a006e3a..b836beb 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 _0x685b=['hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x2a982b,_0x16346d){var _0x19ce44=function(_0x1ba6e8){while(--_0x1ba6e8){_0x2a982b['push'](_0x2a982b['shift']());}};_0x19ce44(++_0x16346d);}(_0x685b,0x199));var _0xb685=function(_0x324496,_0x3a4cdd){_0x324496=_0x324496-0x0;var _0x899545=_0x685b[_0x324496];return _0x899545;};'use strict';var EventEmitter=require(_0xb685('0x0'));var FaxAccount=require(_0xb685('0x1'))['db'][_0xb685('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xb685('0x3')](0x0);var events={'afterCreate':_0xb685('0x4'),'afterUpdate':_0xb685('0x5'),'afterDestroy':_0xb685('0x6')};function emitEvent(_0x5a8e85){return function(_0x4e6ff5,_0xc83e32,_0x45e901){FaxAccountEvents[_0xb685('0x7')](_0x5a8e85+':'+_0x4e6ff5['id'],_0x4e6ff5);FaxAccountEvents[_0xb685('0x7')](_0x5a8e85,_0x4e6ff5);_0x45e901(null);};}for(var e in events){if(events[_0xb685('0x8')](e)){var event=events[e];FaxAccount[_0xb685('0x9')](e,emitEvent(event));}}module[_0xb685('0xa')]=FaxAccountEvents; \ No newline at end of file +var _0x62a4=['update','remove','exports','../../mysqldb','FaxAccount','setMaxListeners','save'];(function(_0x513a86,_0x45f924){var _0xb3a480=function(_0x13dab7){while(--_0x13dab7){_0x513a86['push'](_0x513a86['shift']());}};_0xb3a480(++_0x45f924);}(_0x62a4,0x88));var _0x462a=function(_0x161757,_0x2f29af){_0x161757=_0x161757-0x0;var _0x4a6adc=_0x62a4[_0x161757];return _0x4a6adc;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x462a('0x0'))['db'][_0x462a('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x462a('0x2')](0x0);var events={'afterCreate':_0x462a('0x3'),'afterUpdate':_0x462a('0x4'),'afterDestroy':_0x462a('0x5')};function emitEvent(_0x532675){return function(_0x324694,_0xd88445,_0x4130c8){FaxAccountEvents['emit'](_0x532675+':'+_0x324694['id'],_0x324694);FaxAccountEvents['emit'](_0x532675,_0x324694);_0x4130c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x462a('0x6')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 4f97ee6..e5b3c97 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 _0xf7cd=['fax_accounts','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./faxAccount.attributes','exports'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0xf7cd,0x169));var _0xdf7c=function(_0x40b20a,_0x2f2302){_0x40b20a=_0x40b20a-0x0;var _0x168d95=_0xf7cd[_0x40b20a];return _0x168d95;};'use strict';var _=require('lodash');var util=require(_0xdf7c('0x0'));var logger=require(_0xdf7c('0x1'))(_0xdf7c('0x2'));var moment=require('moment');var BPromise=require(_0xdf7c('0x3'));var rp=require(_0xdf7c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdf7c('0x5'));var attributes=require(_0xdf7c('0x6'));module[_0xdf7c('0x7')]=function(_0x1ebde3,_0x3169ab){return _0x1ebde3['define']('FaxAccount',attributes,{'tableName':_0xdf7c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7381=['rimraf','../../config/environment','define','fax_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7381,0x19b));var _0x1738=function(_0x26da89,_0x264785){_0x26da89=_0x26da89-0x0;var _0xc95b7b=_0x7381[_0x26da89];return _0xc95b7b;};'use strict';var _=require(_0x1738('0x0'));var util=require(_0x1738('0x1'));var logger=require(_0x1738('0x2'))('api');var moment=require(_0x1738('0x3'));var BPromise=require(_0x1738('0x4'));var rp=require(_0x1738('0x5'));var fs=require('fs');var path=require(_0x1738('0x6'));var rimraf=require(_0x1738('0x7'));var config=require(_0x1738('0x8'));var attributes=require('./faxAccount.attributes');module['exports']=function(_0x370ac9,_0x81f9c9){return _0x370ac9[_0x1738('0x9')]('FaxAccount',attributes,{'tableName':_0x1738('0xa'),'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 0b69edb..262d775 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 _0xc95d=['describe','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','from','Sequelize','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','applications','orderBy','priority','asc','length','create','contact','fax','FaxInteraction','Contact\x20not\x20found','push','close','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','GetFaxAccount','FaxAccount','findAll','options','where','attributes','limit','include','model','map','NotifyFaxAccount','body','CmContact'];(function(_0x5dde91,_0x5006bd){var _0x2aea84=function(_0x14c95b){while(--_0x14c95b){_0x5dde91['push'](_0x5dde91['shift']());}};_0x2aea84(++_0x5006bd);}(_0xc95d,0x14b));var _0xdc95=function(_0x3b2aeb,_0x31372c){_0x3b2aeb=_0x3b2aeb-0x0;var _0x19fb1e=_0xc95d[_0x3b2aeb];return _0x19fb1e;};'use strict';var _=require(_0xdc95('0x0'));var util=require(_0xdc95('0x1'));var moment=require(_0xdc95('0x2'));var BPromise=require(_0xdc95('0x3'));var rs=require(_0xdc95('0x4'));var fs=require('fs');var Redis=require(_0xdc95('0x5'));var db=require(_0xdc95('0x6'))['db'];var utils=require(_0xdc95('0x7'));var logger=require(_0xdc95('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdc95('0x9'));var client=jayson[_0xdc95('0xa')][_0xdc95('0xb')]({'port':0x232c});config[_0xdc95('0xc')]=_[_0xdc95('0xd')](config[_0xdc95('0xc')],{'host':_0xdc95('0xe'),'port':0x18eb});var socket=require(_0xdc95('0xf'))(new Redis(config[_0xdc95('0xc')]));require('./faxAccount.socket')[_0xdc95('0x10')](socket);function respondWithRpcPromise(_0x22a237,_0x462536,_0x221441){return new BPromise(function(_0x34a7de,_0x2c4f1e){return client[_0xdc95('0x11')](_0x22a237,_0x221441)[_0xdc95('0x12')](function(_0x354eb8){logger['info'](_0xdc95('0x13'),_0x462536,_0xdc95('0x14'));logger[_0xdc95('0x15')](_0xdc95('0x16'),_0x462536,'request\x20sent',JSON['stringify'](_0x354eb8));if(_0x354eb8[_0xdc95('0x17')]){if(_0x354eb8[_0xdc95('0x17')][_0xdc95('0x18')]===0x1f4){logger['error'](_0xdc95('0x13'),_0x462536,_0x354eb8[_0xdc95('0x17')][_0xdc95('0x19')]);return _0x2c4f1e(_0x354eb8['error']['message']);}logger[_0xdc95('0x17')](_0xdc95('0x13'),_0x462536,_0x354eb8[_0xdc95('0x17')][_0xdc95('0x19')]);return _0x34a7de(_0x354eb8[_0xdc95('0x17')]['message']);}else{logger[_0xdc95('0x1a')](_0xdc95('0x13'),_0x462536,_0xdc95('0x14'));_0x34a7de(_0x354eb8['result'][_0xdc95('0x19')]);}})[_0xdc95('0x1b')](function(_0x1b03ed){logger[_0xdc95('0x17')](_0xdc95('0x13'),_0x462536,_0x1b03ed);_0x2c4f1e(_0x1b03ed);});});}exports[_0xdc95('0x1c')]=function(_0x32d4fc){var _0x57976=this;return new Promise(function(_0x4867d0,_0x4b7641){return db[_0xdc95('0x1d')][_0xdc95('0x1e')]({'raw':_0x32d4fc['options']?_0x32d4fc[_0xdc95('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x32d4fc[_0xdc95('0x1f')]?_0x32d4fc[_0xdc95('0x1f')][_0xdc95('0x20')]||null:null,'attributes':_0x32d4fc[_0xdc95('0x1f')]?_0x32d4fc['options'][_0xdc95('0x21')]||null:null,'limit':_0x32d4fc[_0xdc95('0x1f')]?_0x32d4fc[_0xdc95('0x1f')][_0xdc95('0x22')]||null:null,'include':_0x32d4fc[_0xdc95('0x1f')]?_0x32d4fc[_0xdc95('0x1f')][_0xdc95('0x23')]?_['map'](_0x32d4fc[_0xdc95('0x1f')][_0xdc95('0x23')],function(_0x589cb4){return{'model':db[_0x589cb4[_0xdc95('0x24')]],'as':_0x589cb4['as'],'attributes':_0x589cb4[_0xdc95('0x21')],'include':_0x589cb4['include']?_[_0xdc95('0x25')](_0x589cb4[_0xdc95('0x23')],function(_0x47e74e){return{'model':db[_0x47e74e[_0xdc95('0x24')]],'as':_0x47e74e['as'],'attributes':_0x47e74e['attributes'],'include':_0x47e74e[_0xdc95('0x23')]?_['map'](_0x47e74e[_0xdc95('0x23')],function(_0x36f962){return{'model':db[_0x36f962[_0xdc95('0x24')]],'as':_0x36f962['as'],'attributes':_0x36f962['attributes']};}):[]};}):[]};}):[]:[]})[_0xdc95('0x12')](function(_0x2fd501){logger[_0xdc95('0x1a')](_0xdc95('0x1c'),_0x32d4fc);logger['debug'](_0xdc95('0x1c'),_0x32d4fc,JSON['stringify'](_0x2fd501));_0x4867d0(_0x2fd501);})[_0xdc95('0x1b')](function(_0x1808f8){logger[_0xdc95('0x17')](_0xdc95('0x1c'),_0x1808f8[_0xdc95('0x19')],_0x32d4fc);_0x4b7641(_0x57976[_0xdc95('0x17')](0x1f4,_0x1808f8[_0xdc95('0x19')]));});});};exports[_0xdc95('0x26')]=function(_0x17f958,_0x3968db,_0xff51bf){var _0x57aa0b=this;return new Promise(function(_0x1739ea,_0x2d71b1){var _0x5e2d72={'body':_0x17f958[_0xdc95('0x27')],'channel':'fax'};var _0xdc8f5c=[];var _0x4f0abf=[];var _0x100d5b={};return db[_0xdc95('0x28')][_0xdc95('0x29')]()[_0xdc95('0x12')](function(_0x16d110){if(!_0x16d110){throw new db['Sequelize'][(_0xdc95('0x2a'))](_0xdc95('0x2b'));}_0xdc8f5c=_[_0xdc95('0x2c')](_[_0xdc95('0x2d')](_0x16d110),[_0xdc95('0x2e'),_0xdc95('0x2f')]);_0x4f0abf=_[_0xdc95('0x2c')](_[_0xdc95('0x2d')](_0x16d110),['createdAt','updatedAt',_0xdc95('0x30'),_0xdc95('0x31')]);if(_0x17f958[_0xdc95('0x27')]['id']){delete _0x17f958[_0xdc95('0x27')]['id'];}if(_['isNil'](_0x17f958['body'][_0xdc95('0x32')])){throw new db[(_0xdc95('0x33'))][(_0xdc95('0x2a'))](_0xdc95('0x34'));}if(_[_0xdc95('0x35')](_0x17f958[_0xdc95('0x27')][_0xdc95('0x27')])||_0x17f958[_0xdc95('0x27')]['body']===''){throw new db['Sequelize'][(_0xdc95('0x2a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xdc95('0x35')](_0x17f958[_0xdc95('0x27')][_0xdc95('0x36')])){throw new db[(_0xdc95('0x33'))][(_0xdc95('0x2a'))](_0xdc95('0x37')+_0x4f0abf);}if(!_[_0xdc95('0x38')](_0x4f0abf,_0x17f958['body']['mapKey'])){throw new db[(_0xdc95('0x33'))][(_0xdc95('0x2a'))](_0xdc95('0x39')+_0x4f0abf);}_0x100d5b[_0x17f958[_0xdc95('0x27')][_0xdc95('0x36')]]=_0x17f958[_0xdc95('0x27')][_0xdc95('0x32')];})['then'](function(){return db[_0xdc95('0x1d')][_0xdc95('0x3a')]({'where':{'id':_0x17f958[_0xdc95('0x3b')]['id']},'include':[{'model':db[_0xdc95('0x3c')],'as':_0xdc95('0x3d'),'include':[{'model':db[_0xdc95('0x28')],'as':_0xdc95('0x3e'),'where':_0x100d5b,'limit':0x1,'order':[[_0xdc95('0x2f'),_0xdc95('0x3f')]]}]},{'model':db[_0xdc95('0x40')],'as':_0xdc95('0x41')}]});})[_0xdc95('0x12')](function(_0x1419d9){if(_0x1419d9&&_0x1419d9[_0xdc95('0x3d')]){var _0x349cee=_0x1419d9[_0xdc95('0x42')]({'plain':!![]});_0x5e2d72[_0xdc95('0x3b')]=_0x349cee;_0x5e2d72[_0xdc95('0x43')]=_0x349cee[_0xdc95('0x41')];_0x5e2d72['list']=_0x349cee[_0xdc95('0x3d')];_0x5e2d72[_0xdc95('0x43')]=_[_0xdc95('0x44')](_0x5e2d72[_0xdc95('0x43')],[_0xdc95('0x45')],[_0xdc95('0x46')]);if(_0x5e2d72[_0xdc95('0x3b')][_0xdc95('0x41')]){delete _0x5e2d72[_0xdc95('0x3b')][_0xdc95('0x41')];}if(_0x5e2d72[_0xdc95('0x3b')]['List']&&_0x5e2d72[_0xdc95('0x3b')]['List'][_0xdc95('0x3e')][_0xdc95('0x47')]){return _0x5e2d72[_0xdc95('0x3b')][_0xdc95('0x3d')]['Contacts'][0x0];}var _0x2c6d6f=_[_0xdc95('0xd')](_0x17f958[_0xdc95('0x27')],{'firstName':_0x17f958[_0xdc95('0x27')][_0xdc95('0x32')],'ListId':_0x349cee[_0xdc95('0x31')]});_0x2c6d6f[_0x17f958[_0xdc95('0x27')][_0xdc95('0x36')]]=_0x17f958['body']['from'];return db['CmContact'][_0xdc95('0x48')](_0x2c6d6f,{'fields':_0xdc8f5c,'raw':!![]});}})[_0xdc95('0x12')](function(_0x2d969d){_0x5e2d72[_0xdc95('0x49')]=_0x2d969d;if(_0x2d969d){var _0xbeded0={'ContactId':_0x2d969d['id'],'FaxAccountId':_0x17f958[_0xdc95('0x3b')]['id'],'fax':_0x2d969d[_0xdc95('0x4a')]};return db[_0xdc95('0x4b')]['find']({'where':{'ContactId':_0x2d969d['id'],'closed':![],'FaxAccountId':_0x17f958[_0xdc95('0x3b')]['id']}})[_0xdc95('0x12')](function(_0x3f7957){if(_0x3f7957){return[_0x3f7957,![]];}return db[_0xdc95('0x4b')][_0xdc95('0x48')](_0xbeded0)[_0xdc95('0x12')](function(_0x128be1){return[_0x128be1,!![]];});});}else{throw new Error(_0xdc95('0x4c'));}})['spread'](function(_0x195bff,_0x182fb5){var _0x1b9893=_0x195bff[_0xdc95('0x42')]({'plain':!![]});if(_0x182fb5){if(_0x5e2d72[_0xdc95('0x3b')]['autoclose']){_0x5e2d72[_0xdc95('0x43')][_0xdc95('0x4d')]({'id':0x0,'priority':_0x5e2d72[_0xdc95('0x43')][_0xdc95('0x47')]+0x1,'app':_0xdc95('0x4e'),'appdata':'unmanaged','interval':_0xdc95('0x4f')});}_0x1b9893[_0xdc95('0x50')]=!![];}else{_0x1b9893[_0xdc95('0x50')]=![];}_0x5e2d72[_0xdc95('0x51')]=_0x1b9893;return db[_0xdc95('0x52')][_0xdc95('0x48')]({'body':_0x17f958[_0xdc95('0x27')][_0xdc95('0x27')],'FaxAccountId':_0x17f958[_0xdc95('0x3b')]['id'],'FaxInteractionId':_0x195bff['id'],'direction':'in','ContactId':_0x195bff[_0xdc95('0x53')],'AttachmentId':_0x17f958[_0xdc95('0x27')][_0xdc95('0x54')]});})[_0xdc95('0x12')](function(_0x5da8cd){_0x5e2d72['message']=_0x5da8cd;if(_0x5e2d72[_0xdc95('0x51')][_0xdc95('0x55')]){return db[_0xdc95('0x56')][_0xdc95('0x3a')]({'attributes':['id',_0xdc95('0x57')],'where':{'id':_0x5e2d72['interaction'][_0xdc95('0x55')]}})[_0xdc95('0x12')](function(_0x5e986d){if(_0x5e986d){_0x5e2d72['applications'][_0xdc95('0x58')]({'id':0x0,'priority':0x0,'app':_0xdc95('0x59'),'appdata':_0x5e986d[_0xdc95('0x57')]+','+(_0x5e2d72[_0xdc95('0x3b')][_0xdc95('0x5a')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xdc95('0x5b'),'startRouting',_0x5e2d72);});}return respondWithRpcPromise('Start',_0xdc95('0x5c'),_0x5e2d72);})['then'](function(_0x2079cb){_0x1739ea(_0x2079cb);})[_0xdc95('0x1b')](function(_0x4fba40){_0x2d71b1(_0x57aa0b['error'](0x1f4,_0x4fba40[_0xdc95('0x19')]));});});}; \ No newline at end of file +var _0x6cd6=['FaxInteraction','spread','autoclose','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','waitForTheAssignedAgent','Start','startRouting','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','body','fax','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','CmContact','Contacts','DESC','FaxApplication','Applications','get','list','applications','orderBy','asc','length','ListId','create','contact'];(function(_0x3ed148,_0x5d4692){var _0x2ff43a=function(_0x5a474e){while(--_0x5a474e){_0x3ed148['push'](_0x3ed148['shift']());}};_0x2ff43a(++_0x5d4692);}(_0x6cd6,0x16b));var _0x66cd=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x6cd6[_0x4e676e];return _0x336a3c;};'use strict';var _=require('lodash');var util=require(_0x66cd('0x0'));var moment=require(_0x66cd('0x1'));var BPromise=require(_0x66cd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x66cd('0x3'));var db=require(_0x66cd('0x4'))['db'];var utils=require(_0x66cd('0x5'));var logger=require('../../config/logger')(_0x66cd('0x6'));var config=require(_0x66cd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x66cd('0x8')][_0x66cd('0x9')]({'port':0x232c});config[_0x66cd('0xa')]=_[_0x66cd('0xb')](config[_0x66cd('0xa')],{'host':_0x66cd('0xc'),'port':0x18eb});var socket=require(_0x66cd('0xd'))(new Redis(config[_0x66cd('0xa')]));require(_0x66cd('0xe'))['register'](socket);function respondWithRpcPromise(_0x38f746,_0x2fd283,_0x5738f7){return new BPromise(function(_0x4fd832,_0x1b37db){return client['request'](_0x38f746,_0x5738f7)[_0x66cd('0xf')](function(_0x128b29){logger[_0x66cd('0x10')](_0x66cd('0x11'),_0x2fd283,_0x66cd('0x12'));logger[_0x66cd('0x13')](_0x66cd('0x14'),_0x2fd283,_0x66cd('0x12'),JSON[_0x66cd('0x15')](_0x128b29));if(_0x128b29['error']){if(_0x128b29[_0x66cd('0x16')][_0x66cd('0x17')]===0x1f4){logger[_0x66cd('0x16')]('FaxAccount,\x20%s,\x20%s',_0x2fd283,_0x128b29[_0x66cd('0x16')][_0x66cd('0x18')]);return _0x1b37db(_0x128b29['error'][_0x66cd('0x18')]);}logger[_0x66cd('0x16')](_0x66cd('0x11'),_0x2fd283,_0x128b29[_0x66cd('0x16')][_0x66cd('0x18')]);return _0x4fd832(_0x128b29[_0x66cd('0x16')][_0x66cd('0x18')]);}else{logger['info'](_0x66cd('0x11'),_0x2fd283,_0x66cd('0x12'));_0x4fd832(_0x128b29[_0x66cd('0x19')][_0x66cd('0x18')]);}})[_0x66cd('0x1a')](function(_0x14ec59){logger[_0x66cd('0x16')]('FaxAccount,\x20%s,\x20%s',_0x2fd283,_0x14ec59);_0x1b37db(_0x14ec59);});});}exports[_0x66cd('0x1b')]=function(_0x46a568){var _0x355559=this;return new Promise(function(_0x29d5d9,_0x294b44){return db[_0x66cd('0x1c')][_0x66cd('0x1d')]({'raw':_0x46a568[_0x66cd('0x1e')]?_0x46a568[_0x66cd('0x1e')][_0x66cd('0x1f')]===undefined?!![]:![]:!![],'where':_0x46a568['options']?_0x46a568[_0x66cd('0x1e')][_0x66cd('0x20')]||null:null,'attributes':_0x46a568[_0x66cd('0x1e')]?_0x46a568[_0x66cd('0x1e')][_0x66cd('0x21')]||null:null,'limit':_0x46a568[_0x66cd('0x1e')]?_0x46a568[_0x66cd('0x1e')][_0x66cd('0x22')]||null:null,'include':_0x46a568[_0x66cd('0x1e')]?_0x46a568[_0x66cd('0x1e')][_0x66cd('0x23')]?_[_0x66cd('0x24')](_0x46a568[_0x66cd('0x1e')][_0x66cd('0x23')],function(_0x54fab5){return{'model':db[_0x54fab5[_0x66cd('0x25')]],'as':_0x54fab5['as'],'attributes':_0x54fab5['attributes'],'include':_0x54fab5[_0x66cd('0x23')]?_[_0x66cd('0x24')](_0x54fab5[_0x66cd('0x23')],function(_0x4fda84){return{'model':db[_0x4fda84['model']],'as':_0x4fda84['as'],'attributes':_0x4fda84['attributes'],'include':_0x4fda84[_0x66cd('0x23')]?_[_0x66cd('0x24')](_0x4fda84['include'],function(_0x42ae7e){return{'model':db[_0x42ae7e[_0x66cd('0x25')]],'as':_0x42ae7e['as'],'attributes':_0x42ae7e[_0x66cd('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3fef9a){logger[_0x66cd('0x10')](_0x66cd('0x1b'),_0x46a568);logger[_0x66cd('0x13')](_0x66cd('0x1b'),_0x46a568,JSON[_0x66cd('0x15')](_0x3fef9a));_0x29d5d9(_0x3fef9a);})[_0x66cd('0x1a')](function(_0x1237fa){logger[_0x66cd('0x16')]('GetFaxAccount',_0x1237fa['message'],_0x46a568);_0x294b44(_0x355559['error'](0x1f4,_0x1237fa[_0x66cd('0x18')]));});});};exports['NotifyFaxAccount']=function(_0x20f9ba,_0x25e963,_0x4e757b){var _0x46c15f=this;return new Promise(function(_0x1f1f31,_0x2d2e85){var _0x3c1e06={'body':_0x20f9ba[_0x66cd('0x26')],'channel':_0x66cd('0x27')};var _0xc42450=[];var _0xab4a7c=[];var _0x431e6b={};return db['CmContact'][_0x66cd('0x28')]()[_0x66cd('0xf')](function(_0x251118){if(!_0x251118){throw new db[(_0x66cd('0x29'))][(_0x66cd('0x2a'))](_0x66cd('0x2b'));}_0xc42450=_[_0x66cd('0x2c')](_[_0x66cd('0x2d')](_0x251118),[_0x66cd('0x2e'),_0x66cd('0x2f')]);_0xab4a7c=_[_0x66cd('0x2c')](_['keys'](_0x251118),[_0x66cd('0x2e'),'updatedAt','CompanyId','ListId']);if(_0x20f9ba[_0x66cd('0x26')]['id']){delete _0x20f9ba[_0x66cd('0x26')]['id'];}if(_[_0x66cd('0x30')](_0x20f9ba[_0x66cd('0x26')][_0x66cd('0x31')])){throw new db['Sequelize'][(_0x66cd('0x2a'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x20f9ba[_0x66cd('0x26')][_0x66cd('0x26')])||_0x20f9ba[_0x66cd('0x26')][_0x66cd('0x26')]===''){throw new db[(_0x66cd('0x29'))][(_0x66cd('0x2a'))](_0x66cd('0x32'));}if(_[_0x66cd('0x30')](_0x20f9ba['body'][_0x66cd('0x33')])){throw new db[(_0x66cd('0x29'))][(_0x66cd('0x2a'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xab4a7c);}if(!_[_0x66cd('0x34')](_0xab4a7c,_0x20f9ba[_0x66cd('0x26')][_0x66cd('0x33')])){throw new db[(_0x66cd('0x29'))]['ValidationError'](_0x66cd('0x35')+_0xab4a7c);}_0x431e6b[_0x20f9ba[_0x66cd('0x26')][_0x66cd('0x33')]]=_0x20f9ba[_0x66cd('0x26')][_0x66cd('0x31')];})['then'](function(){return db[_0x66cd('0x1c')][_0x66cd('0x36')]({'where':{'id':_0x20f9ba[_0x66cd('0x37')]['id']},'include':[{'model':db[_0x66cd('0x38')],'as':_0x66cd('0x39'),'include':[{'model':db[_0x66cd('0x3a')],'as':_0x66cd('0x3b'),'where':_0x431e6b,'limit':0x1,'order':[[_0x66cd('0x2f'),_0x66cd('0x3c')]]}]},{'model':db[_0x66cd('0x3d')],'as':_0x66cd('0x3e')}]});})[_0x66cd('0xf')](function(_0x2e34cd){if(_0x2e34cd&&_0x2e34cd[_0x66cd('0x39')]){var _0x636b3d=_0x2e34cd[_0x66cd('0x3f')]({'plain':!![]});_0x3c1e06['account']=_0x636b3d;_0x3c1e06['applications']=_0x636b3d[_0x66cd('0x3e')];_0x3c1e06[_0x66cd('0x40')]=_0x636b3d['List'];_0x3c1e06[_0x66cd('0x41')]=_[_0x66cd('0x42')](_0x3c1e06['applications'],['priority'],[_0x66cd('0x43')]);if(_0x3c1e06[_0x66cd('0x37')][_0x66cd('0x3e')]){delete _0x3c1e06[_0x66cd('0x37')][_0x66cd('0x3e')];}if(_0x3c1e06[_0x66cd('0x37')][_0x66cd('0x39')]&&_0x3c1e06[_0x66cd('0x37')]['List'][_0x66cd('0x3b')][_0x66cd('0x44')]){return _0x3c1e06['account'][_0x66cd('0x39')][_0x66cd('0x3b')][0x0];}var _0x5d355e=_[_0x66cd('0xb')](_0x20f9ba[_0x66cd('0x26')],{'firstName':_0x20f9ba[_0x66cd('0x26')][_0x66cd('0x31')],'ListId':_0x636b3d[_0x66cd('0x45')]});_0x5d355e[_0x20f9ba[_0x66cd('0x26')][_0x66cd('0x33')]]=_0x20f9ba['body'][_0x66cd('0x31')];return db[_0x66cd('0x3a')][_0x66cd('0x46')](_0x5d355e,{'fields':_0xc42450,'raw':!![]});}})[_0x66cd('0xf')](function(_0x33b07d){_0x3c1e06[_0x66cd('0x47')]=_0x33b07d;if(_0x33b07d){var _0x1eeb69={'ContactId':_0x33b07d['id'],'FaxAccountId':_0x20f9ba[_0x66cd('0x37')]['id'],'fax':_0x33b07d[_0x66cd('0x27')]};return db[_0x66cd('0x48')][_0x66cd('0x36')]({'where':{'ContactId':_0x33b07d['id'],'closed':![],'FaxAccountId':_0x20f9ba[_0x66cd('0x37')]['id']}})[_0x66cd('0xf')](function(_0xe57b50){if(_0xe57b50){return[_0xe57b50,![]];}return db[_0x66cd('0x48')][_0x66cd('0x46')](_0x1eeb69)['then'](function(_0x1adda9){return[_0x1adda9,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x66cd('0x49')](function(_0x44a81e,_0x462019){var _0x423409=_0x44a81e[_0x66cd('0x3f')]({'plain':!![]});if(_0x462019){if(_0x3c1e06[_0x66cd('0x37')][_0x66cd('0x4a')]){_0x3c1e06[_0x66cd('0x41')]['push']({'id':0x0,'priority':_0x3c1e06[_0x66cd('0x41')][_0x66cd('0x44')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x66cd('0x4b')});}_0x423409[_0x66cd('0x4c')]=!![];}else{_0x423409[_0x66cd('0x4c')]=![];}_0x3c1e06[_0x66cd('0x4d')]=_0x423409;return db[_0x66cd('0x4e')][_0x66cd('0x46')]({'body':_0x20f9ba['body'][_0x66cd('0x26')],'FaxAccountId':_0x20f9ba[_0x66cd('0x37')]['id'],'FaxInteractionId':_0x44a81e['id'],'direction':'in','ContactId':_0x44a81e[_0x66cd('0x4f')],'AttachmentId':_0x20f9ba[_0x66cd('0x26')][_0x66cd('0x50')]});})[_0x66cd('0xf')](function(_0x440f04){_0x3c1e06[_0x66cd('0x18')]=_0x440f04;if(_0x3c1e06[_0x66cd('0x4d')][_0x66cd('0x51')]){return db[_0x66cd('0x52')]['find']({'attributes':['id',_0x66cd('0x53')],'where':{'id':_0x3c1e06['interaction'][_0x66cd('0x51')]}})[_0x66cd('0xf')](function(_0x630c60){if(_0x630c60){_0x3c1e06[_0x66cd('0x41')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x630c60[_0x66cd('0x53')]+','+(_0x3c1e06[_0x66cd('0x37')][_0x66cd('0x54')]||0xa),'interval':_0x66cd('0x4b')});}return respondWithRpcPromise(_0x66cd('0x55'),_0x66cd('0x56'),_0x3c1e06);});}return respondWithRpcPromise(_0x66cd('0x55'),'startRouting',_0x3c1e06);})[_0x66cd('0xf')](function(_0x735211){_0x1f1f31(_0x735211);})[_0x66cd('0x1a')](function(_0x3b4504){_0x2d2e85(_0x46c15f[_0x66cd('0x16')](0x1f4,_0x3b4504[_0x66cd('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index f78f249..8d08739 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 _0x3f28=['removeListener','register','length','./faxAccount.events','update'];(function(_0x559fe0,_0x17649e){var _0xb1fae5=function(_0x296844){while(--_0x296844){_0x559fe0['push'](_0x559fe0['shift']());}};_0xb1fae5(++_0x17649e);}(_0x3f28,0x157));var _0x83f2=function(_0x20a6fd,_0x3d9778){_0x20a6fd=_0x20a6fd-0x0;var _0x1e4c08=_0x3f28[_0x20a6fd];return _0x1e4c08;};'use strict';var FaxAccountEvents=require(_0x83f2('0x0'));var events=['save','remove',_0x83f2('0x1')];function createListener(_0x2cfe82,_0x3a6532){return function(_0x5ad5ae){_0x3a6532['emit'](_0x2cfe82,_0x5ad5ae);};}function removeListener(_0x3f39d6,_0x59f9b8){return function(){FaxAccountEvents[_0x83f2('0x2')](_0x3f39d6,_0x59f9b8);};}exports[_0x83f2('0x3')]=function(_0x3a5960){for(var _0x597b1d=0x0,_0x3a211c=events[_0x83f2('0x4')];_0x597b1d<_0x3a211c;_0x597b1d++){var _0x76ba23=events[_0x597b1d];var _0x451b1a=createListener('faxAccount:'+_0x76ba23,_0x3a5960);FaxAccountEvents['on'](_0x76ba23,_0x451b1a);}}; \ No newline at end of file +var _0x14e4=['register','length','./faxAccount.events','save','update','emit','removeListener'];(function(_0x3b1354,_0x3a6d84){var _0x33cbb0=function(_0x49fe02){while(--_0x49fe02){_0x3b1354['push'](_0x3b1354['shift']());}};_0x33cbb0(++_0x3a6d84);}(_0x14e4,0xe2));var _0x414e=function(_0x3e2e8a,_0x3ddcdb){_0x3e2e8a=_0x3e2e8a-0x0;var _0x43c7dc=_0x14e4[_0x3e2e8a];return _0x43c7dc;};'use strict';var FaxAccountEvents=require(_0x414e('0x0'));var events=[_0x414e('0x1'),'remove',_0x414e('0x2')];function createListener(_0x9de1ef,_0x2f01bb){return function(_0x360315){_0x2f01bb[_0x414e('0x3')](_0x9de1ef,_0x360315);};}function removeListener(_0x4e0005,_0x33a169){return function(){FaxAccountEvents[_0x414e('0x4')](_0x4e0005,_0x33a169);};}exports[_0x414e('0x5')]=function(_0x339b96){for(var _0x4c557e=0x0,_0x4799fc=events[_0x414e('0x6')];_0x4c557e<_0x4799fc;_0x4c557e++){var _0x4ebe4d=events[_0x4c557e];var _0x19b2c7=createListener('faxAccount:'+_0x4ebe4d,_0x339b96);FaxAccountEvents['on'](_0x4ebe4d,_0x19b2c7);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index e593d92..3b7bb34 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x50fcb7,_0x2f214c){var _0x424472=function(_0x96da0){while(--_0x96da0){_0x50fcb7['push'](_0x50fcb7['shift']());}};_0x424472(++_0x2f214c);}(_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/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x5af449,_0x18474b){var _0x45de40=function(_0x3d1df1){while(--_0x3d1df1){_0x5af449['push'](_0x5af449['shift']());}};_0x45de40(++_0x18474b);}(_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['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index c85daa5..cd7410e 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 _0xdc7b=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x2abd62,_0x36911e){var _0x1c41af=function(_0x431f8f){while(--_0x431f8f){_0x2abd62['push'](_0x2abd62['shift']());}};_0x1c41af(++_0x36911e);}(_0xdc7b,0x1b2));var _0xbdc7=function(_0x5c2817,_0x3a6b53){_0x5c2817=_0x5c2817-0x0;var _0x363a37=_0xdc7b[_0x5c2817];return _0x363a37;};'use strict';var Sequelize=require(_0xbdc7('0x0'));module[_0xbdc7('0x1')]={'priority':{'type':Sequelize[_0xbdc7('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xbdc7('0x3')],'allowNull':![],'defaultValue':_0xbdc7('0x4')},'appdata':{'type':Sequelize[_0xbdc7('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xbdc7('0x3')],'defaultValue':_0xbdc7('0x6')}}; \ No newline at end of file +var _0xd983=['noop','TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0x4f4db0,_0x3378cb){var _0x41cfb9=function(_0x2ea3f){while(--_0x2ea3f){_0x4f4db0['push'](_0x4f4db0['shift']());}};_0x41cfb9(++_0x3378cb);}(_0xd983,0x183));var _0x3d98=function(_0x590fea,_0x481130){_0x590fea=_0x590fea-0x0;var _0x5a9dbf=_0xd983[_0x590fea];return _0x5a9dbf;};'use strict';var Sequelize=require('sequelize');module[_0x3d98('0x0')]={'priority':{'type':Sequelize[_0x3d98('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x3d98('0x2')],'allowNull':![],'defaultValue':_0x3d98('0x3')},'appdata':{'type':Sequelize[_0x3d98('0x4')]()},'description':{'type':Sequelize[_0x3d98('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x3d98('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index ebb9288..ad774bf 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 _0x4e08=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','reject','update','then','sendStatus','error','name','map','type','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','FaxApplication','includeAll','include','findAll','catch','show','keys','options','find','create','body','params'];(function(_0x35206c,_0x1fab51){var _0x5460cc=function(_0x262eb7){while(--_0x262eb7){_0x35206c['push'](_0x35206c['shift']());}};_0x5460cc(++_0x1fab51);}(_0x4e08,0x120));var _0x84e0=function(_0x3856aa,_0x2980a9){_0x3856aa=_0x3856aa-0x0;var _0x38db06=_0x4e08[_0x3856aa];return _0x38db06;};'use strict';var emlformat=require(_0x84e0('0x0'));var rimraf=require(_0x84e0('0x1'));var zipdir=require(_0x84e0('0x2'));var jsonpatch=require(_0x84e0('0x3'));var rp=require(_0x84e0('0x4'));var moment=require(_0x84e0('0x5'));var BPromise=require(_0x84e0('0x6'));var Mustache=require(_0x84e0('0x7'));var util=require(_0x84e0('0x8'));var path=require(_0x84e0('0x9'));var sox=require(_0x84e0('0xa'));var csv=require('to-csv');var ejs=require(_0x84e0('0xb'));var fs=require('fs');var fs_extra=require(_0x84e0('0xc'));var _=require('lodash');var squel=require(_0x84e0('0xd'));var crypto=require(_0x84e0('0xe'));var jsforce=require(_0x84e0('0xf'));var deskjs=require(_0x84e0('0x10'));var toCsv=require('to-csv');var querystring=require(_0x84e0('0x11'));var Papa=require(_0x84e0('0x12'));var Redis=require('ioredis');var authService=require(_0x84e0('0x13'));var qs=require(_0x84e0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x84e0('0x15'));var logger=require(_0x84e0('0x16'))(_0x84e0('0x17'));var utils=require(_0x84e0('0x18'));var config=require(_0x84e0('0x19'));var licenseUtil=require(_0x84e0('0x1a'));var db=require(_0x84e0('0x1b'))['db'];function respondWithStatusCode(_0xff710b,_0x4e99b0){_0x4e99b0=_0x4e99b0||0xcc;return function(_0x3b5214){if(_0x3b5214){return _0xff710b['sendStatus'](_0x4e99b0);}return _0xff710b[_0x84e0('0x1c')](_0x4e99b0)[_0x84e0('0x1d')]();};}function respondWithResult(_0x611ed1,_0x835e6f){_0x835e6f=_0x835e6f||0xc8;return function(_0x178e16){if(_0x178e16){return _0x611ed1[_0x84e0('0x1c')](_0x835e6f)[_0x84e0('0x1e')](_0x178e16);}};}function respondWithFilteredResult(_0xbe5275,_0x45f7a2){return function(_0x53d632){if(_0x53d632){var _0x1ca4a2=typeof _0x45f7a2[_0x84e0('0x1f')]===_0x84e0('0x20')&&typeof _0x45f7a2['limit']==='undefined';var _0x3f8183=_0x53d632[_0x84e0('0x21')];var _0x348585=_0x1ca4a2?0x0:_0x45f7a2[_0x84e0('0x1f')];var _0x348aff=_0x1ca4a2?_0x53d632[_0x84e0('0x21')]:_0x45f7a2[_0x84e0('0x1f')]+_0x45f7a2['limit'];var _0x3209a2;if(_0x348aff>=_0x3f8183){_0x348aff=_0x3f8183;_0x3209a2=0xc8;}else{_0x3209a2=0xce;}_0xbe5275[_0x84e0('0x1c')](_0x3209a2);return _0xbe5275[_0x84e0('0x22')]('Content-Range',_0x348585+'-'+_0x348aff+'/'+_0x3f8183)[_0x84e0('0x1e')](_0x53d632);}return null;};}function patchUpdates(_0x578eb8){return function(_0x111e67){try{jsonpatch['apply'](_0x111e67,_0x578eb8,!![]);}catch(_0x2eb80b){return BPromise[_0x84e0('0x23')](_0x2eb80b);}return _0x111e67['save']();};}function saveUpdates(_0x566570,_0x4a3da9){return function(_0x2e7891){if(_0x2e7891){return _0x2e7891[_0x84e0('0x24')](_0x566570)['then'](function(_0x374a0a){return _0x374a0a;});}return null;};}function removeEntity(_0x80f6ed,_0x4c6d06){return function(_0x283ba9){if(_0x283ba9){return _0x283ba9['destroy']()[_0x84e0('0x25')](function(){_0x80f6ed[_0x84e0('0x1c')](0xcc)[_0x84e0('0x1d')]();});}};}function handleEntityNotFound(_0x22328b,_0x5924c6){return function(_0x2a87a5){if(!_0x2a87a5){_0x22328b[_0x84e0('0x26')](0x194);}return _0x2a87a5;};}function handleError(_0x370432,_0x1a100f){_0x1a100f=_0x1a100f||0x1f4;return function(_0x444e5c){logger[_0x84e0('0x27')](_0x444e5c['stack']);if(_0x444e5c['name']){delete _0x444e5c[_0x84e0('0x28')];}_0x370432[_0x84e0('0x1c')](_0x1a100f)['send'](_0x444e5c);};}exports['index']=function(_0x3f11d2,_0x7e3671){var _0xd4ce8={},_0x2a7de1={},_0x40fa10={'count':0x0,'rows':[]};var _0x482596=_[_0x84e0('0x29')](db['FaxApplication']['rawAttributes'],function(_0x15b4ed){return{'name':_0x15b4ed['fieldName'],'type':_0x15b4ed[_0x84e0('0x2a')]['key']};});_0x2a7de1['model']=_[_0x84e0('0x29')](_0x482596,'name');_0x2a7de1[_0x84e0('0x2b')]=_['keys'](_0x3f11d2['query']);_0x2a7de1['filters']=_['intersection'](_0x2a7de1[_0x84e0('0x2c')],_0x2a7de1[_0x84e0('0x2b')]);_0xd4ce8[_0x84e0('0x2d')]=_[_0x84e0('0x2e')](_0x2a7de1[_0x84e0('0x2c')],qs[_0x84e0('0x2f')](_0x3f11d2[_0x84e0('0x2b')][_0x84e0('0x2f')]));_0xd4ce8[_0x84e0('0x2d')]=_0xd4ce8[_0x84e0('0x2d')][_0x84e0('0x30')]?_0xd4ce8[_0x84e0('0x2d')]:_0x2a7de1['model'];if(!_0x3f11d2['query'][_0x84e0('0x31')](_0x84e0('0x32'))){_0xd4ce8[_0x84e0('0x33')]=qs[_0x84e0('0x33')](_0x3f11d2[_0x84e0('0x2b')]['limit']);_0xd4ce8[_0x84e0('0x1f')]=qs[_0x84e0('0x1f')](_0x3f11d2[_0x84e0('0x2b')][_0x84e0('0x1f')]);}_0xd4ce8[_0x84e0('0x34')]=qs[_0x84e0('0x35')](_0x3f11d2['query']['sort']);_0xd4ce8[_0x84e0('0x36')]=qs[_0x84e0('0x37')](_[_0x84e0('0x38')](_0x3f11d2[_0x84e0('0x2b')],_0x2a7de1[_0x84e0('0x37')]),_0x482596);if(_0x3f11d2[_0x84e0('0x2b')][_0x84e0('0x39')]){_0xd4ce8[_0x84e0('0x36')]=_[_0x84e0('0x3a')](_0xd4ce8[_0x84e0('0x36')],{'$or':_[_0x84e0('0x29')](_0x482596,function(_0x59354a){if(_0x59354a[_0x84e0('0x2a')]!==_0x84e0('0x3b')){var _0x37dc2d={};_0x37dc2d[_0x59354a[_0x84e0('0x28')]]={'$like':'%'+_0x3f11d2['query'][_0x84e0('0x39')]+'%'};return _0x37dc2d;}})});}_0xd4ce8=_['merge']({},_0xd4ce8,_0x3f11d2['options']);var _0x567402={'where':_0xd4ce8[_0x84e0('0x36')]};return db[_0x84e0('0x3c')][_0x84e0('0x21')](_0x567402)[_0x84e0('0x25')](function(_0x4586ef){_0x40fa10[_0x84e0('0x21')]=_0x4586ef;if(_0x3f11d2['query'][_0x84e0('0x3d')]){_0xd4ce8[_0x84e0('0x3e')]=[{'all':!![]}];}return db[_0x84e0('0x3c')][_0x84e0('0x3f')](_0xd4ce8);})['then'](function(_0x219745){_0x40fa10['rows']=_0x219745;return _0x40fa10;})[_0x84e0('0x25')](respondWithFilteredResult(_0x7e3671,_0xd4ce8))[_0x84e0('0x40')](handleError(_0x7e3671,null));};exports[_0x84e0('0x41')]=function(_0x3cdb94,_0x82fd79){var _0x3dfb00={'raw':!![],'where':{'id':_0x3cdb94['params']['id']}},_0x2c0841={};_0x2c0841[_0x84e0('0x2c')]=_[_0x84e0('0x42')](db['FaxApplication']['rawAttributes']);_0x2c0841[_0x84e0('0x2b')]=_['keys'](_0x3cdb94[_0x84e0('0x2b')]);_0x2c0841[_0x84e0('0x37')]=_[_0x84e0('0x2e')](_0x2c0841[_0x84e0('0x2c')],_0x2c0841[_0x84e0('0x2b')]);_0x3dfb00[_0x84e0('0x2d')]=_[_0x84e0('0x2e')](_0x2c0841[_0x84e0('0x2c')],qs[_0x84e0('0x2f')](_0x3cdb94[_0x84e0('0x2b')][_0x84e0('0x2f')]));_0x3dfb00[_0x84e0('0x2d')]=_0x3dfb00[_0x84e0('0x2d')]['length']?_0x3dfb00['attributes']:_0x2c0841[_0x84e0('0x2c')];if(_0x3cdb94[_0x84e0('0x2b')][_0x84e0('0x3d')]){_0x3dfb00[_0x84e0('0x3e')]=[{'all':!![]}];}_0x3dfb00=_['merge']({},_0x3dfb00,_0x3cdb94[_0x84e0('0x43')]);return db[_0x84e0('0x3c')][_0x84e0('0x44')](_0x3dfb00)['then'](handleEntityNotFound(_0x82fd79,null))['then'](respondWithResult(_0x82fd79,null))['catch'](handleError(_0x82fd79,null));};exports[_0x84e0('0x45')]=function(_0x4b7453,_0xbb9eda){return db[_0x84e0('0x3c')][_0x84e0('0x45')](_0x4b7453[_0x84e0('0x46')],{})['then'](respondWithResult(_0xbb9eda,0xc9))[_0x84e0('0x40')](handleError(_0xbb9eda,null));};exports['update']=function(_0x39f14f,_0x2db4ab){if(_0x39f14f[_0x84e0('0x46')]['id']){delete _0x39f14f[_0x84e0('0x46')]['id'];}return db[_0x84e0('0x3c')]['find']({'where':{'id':_0x39f14f[_0x84e0('0x47')]['id']}})[_0x84e0('0x25')](handleEntityNotFound(_0x2db4ab,null))[_0x84e0('0x25')](saveUpdates(_0x39f14f[_0x84e0('0x46')],null))[_0x84e0('0x25')](respondWithResult(_0x2db4ab,null))['catch'](handleError(_0x2db4ab,null));};exports['destroy']=function(_0x16491e,_0x4ca177){return db[_0x84e0('0x3c')][_0x84e0('0x44')]({'where':{'id':_0x16491e[_0x84e0('0x47')]['id']}})['then'](handleEntityNotFound(_0x4ca177,null))[_0x84e0('0x25')](removeEntity(_0x4ca177,null))[_0x84e0('0x40')](handleError(_0x4ca177,null));}; \ No newline at end of file +var _0x9513=['name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','FaxApplication','include','findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','rimraf','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack'];(function(_0x36b400,_0x277ec5){var _0x4d47bf=function(_0x55372b){while(--_0x55372b){_0x36b400['push'](_0x36b400['shift']());}};_0x4d47bf(++_0x277ec5);}(_0x9513,0xbe));var _0x3951=function(_0x56aaeb,_0x20414a){_0x56aaeb=_0x56aaeb-0x0;var _0x54ea63=_0x9513[_0x56aaeb];return _0x54ea63;};'use strict';var emlformat=require(_0x3951('0x0'));var rimraf=require(_0x3951('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3951('0x2'));var BPromise=require(_0x3951('0x3'));var Mustache=require(_0x3951('0x4'));var util=require(_0x3951('0x5'));var path=require(_0x3951('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3951('0x7'));var _=require(_0x3951('0x8'));var squel=require(_0x3951('0x9'));var crypto=require(_0x3951('0xa'));var jsforce=require(_0x3951('0xb'));var deskjs=require(_0x3951('0xc'));var toCsv=require(_0x3951('0xd'));var querystring=require(_0x3951('0xe'));var Papa=require(_0x3951('0xf'));var Redis=require(_0x3951('0x10'));var authService=require(_0x3951('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3951('0x12'));var hardwareService=require(_0x3951('0x13'));var logger=require(_0x3951('0x14'))(_0x3951('0x15'));var utils=require(_0x3951('0x16'));var config=require(_0x3951('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f4247,_0x35e26a){_0x35e26a=_0x35e26a||0xcc;return function(_0x5423a9){if(_0x5423a9){return _0x1f4247['sendStatus'](_0x35e26a);}return _0x1f4247[_0x3951('0x18')](_0x35e26a)[_0x3951('0x19')]();};}function respondWithResult(_0x8cf84b,_0x2177f5){_0x2177f5=_0x2177f5||0xc8;return function(_0x190060){if(_0x190060){return _0x8cf84b[_0x3951('0x18')](_0x2177f5)['json'](_0x190060);}};}function respondWithFilteredResult(_0x5b3868,_0x257cb3){return function(_0x180400){if(_0x180400){var _0x1e629e=typeof _0x257cb3[_0x3951('0x1a')]===_0x3951('0x1b')&&typeof _0x257cb3[_0x3951('0x1c')]===_0x3951('0x1b');var _0x21fb67=_0x180400[_0x3951('0x1d')];var _0x513741=_0x1e629e?0x0:_0x257cb3['offset'];var _0x24f6dd=_0x1e629e?_0x180400[_0x3951('0x1d')]:_0x257cb3[_0x3951('0x1a')]+_0x257cb3['limit'];var _0x4b2cc0;if(_0x24f6dd>=_0x21fb67){_0x24f6dd=_0x21fb67;_0x4b2cc0=0xc8;}else{_0x4b2cc0=0xce;}_0x5b3868[_0x3951('0x18')](_0x4b2cc0);return _0x5b3868['set'](_0x3951('0x1e'),_0x513741+'-'+_0x24f6dd+'/'+_0x21fb67)[_0x3951('0x1f')](_0x180400);}return null;};}function patchUpdates(_0x5bbe62){return function(_0x43ce53){try{jsonpatch[_0x3951('0x20')](_0x43ce53,_0x5bbe62,!![]);}catch(_0x483b82){return BPromise[_0x3951('0x21')](_0x483b82);}return _0x43ce53[_0x3951('0x22')]();};}function saveUpdates(_0x229bc7,_0x14805d){return function(_0x47e493){if(_0x47e493){return _0x47e493[_0x3951('0x23')](_0x229bc7)[_0x3951('0x24')](function(_0x24c04e){return _0x24c04e;});}return null;};}function removeEntity(_0x520c03,_0x1de94c){return function(_0x51eaeb){if(_0x51eaeb){return _0x51eaeb[_0x3951('0x25')]()[_0x3951('0x24')](function(){_0x520c03[_0x3951('0x18')](0xcc)[_0x3951('0x19')]();});}};}function handleEntityNotFound(_0x2f7c4f,_0x2eef98){return function(_0x46052c){if(!_0x46052c){_0x2f7c4f[_0x3951('0x26')](0x194);}return _0x46052c;};}function handleError(_0xad16,_0x488361){_0x488361=_0x488361||0x1f4;return function(_0x16d9d0){logger[_0x3951('0x27')](_0x16d9d0[_0x3951('0x28')]);if(_0x16d9d0[_0x3951('0x29')]){delete _0x16d9d0[_0x3951('0x29')];}_0xad16[_0x3951('0x18')](_0x488361)[_0x3951('0x2a')](_0x16d9d0);};}exports[_0x3951('0x2b')]=function(_0x139e4e,_0x239b86){var _0x349941={},_0x54e244={},_0x2f824d={'count':0x0,'rows':[]};var _0x20988a=_[_0x3951('0x2c')](db['FaxApplication'][_0x3951('0x2d')],function(_0x2c486c){return{'name':_0x2c486c['fieldName'],'type':_0x2c486c[_0x3951('0x2e')][_0x3951('0x2f')]};});_0x54e244[_0x3951('0x30')]=_['map'](_0x20988a,_0x3951('0x29'));_0x54e244[_0x3951('0x31')]=_[_0x3951('0x32')](_0x139e4e[_0x3951('0x31')]);_0x54e244[_0x3951('0x33')]=_[_0x3951('0x34')](_0x54e244['model'],_0x54e244[_0x3951('0x31')]);_0x349941[_0x3951('0x35')]=_['intersection'](_0x54e244[_0x3951('0x30')],qs[_0x3951('0x36')](_0x139e4e[_0x3951('0x31')]['fields']));_0x349941['attributes']=_0x349941[_0x3951('0x35')][_0x3951('0x37')]?_0x349941['attributes']:_0x54e244[_0x3951('0x30')];if(!_0x139e4e[_0x3951('0x31')][_0x3951('0x38')](_0x3951('0x39'))){_0x349941[_0x3951('0x1c')]=qs[_0x3951('0x1c')](_0x139e4e[_0x3951('0x31')][_0x3951('0x1c')]);_0x349941['offset']=qs[_0x3951('0x1a')](_0x139e4e[_0x3951('0x31')][_0x3951('0x1a')]);}_0x349941[_0x3951('0x3a')]=qs[_0x3951('0x3b')](_0x139e4e[_0x3951('0x31')]['sort']);_0x349941[_0x3951('0x3c')]=qs['filters'](_[_0x3951('0x3d')](_0x139e4e[_0x3951('0x31')],_0x54e244[_0x3951('0x33')]),_0x20988a);if(_0x139e4e[_0x3951('0x31')][_0x3951('0x3e')]){_0x349941[_0x3951('0x3c')]=_['merge'](_0x349941[_0x3951('0x3c')],{'$or':_[_0x3951('0x2c')](_0x20988a,function(_0x95c3ac){if(_0x95c3ac[_0x3951('0x2e')]!==_0x3951('0x3f')){var _0x3d3784={};_0x3d3784[_0x95c3ac[_0x3951('0x29')]]={'$like':'%'+_0x139e4e[_0x3951('0x31')][_0x3951('0x3e')]+'%'};return _0x3d3784;}})});}_0x349941=_[_0x3951('0x40')]({},_0x349941,_0x139e4e[_0x3951('0x41')]);var _0x1a361f={'where':_0x349941[_0x3951('0x3c')]};return db[_0x3951('0x42')]['count'](_0x1a361f)[_0x3951('0x24')](function(_0x4f7529){_0x2f824d['count']=_0x4f7529;if(_0x139e4e[_0x3951('0x31')]['includeAll']){_0x349941[_0x3951('0x43')]=[{'all':!![]}];}return db[_0x3951('0x42')][_0x3951('0x44')](_0x349941);})[_0x3951('0x24')](function(_0x2cc2f9){_0x2f824d[_0x3951('0x45')]=_0x2cc2f9;return _0x2f824d;})['then'](respondWithFilteredResult(_0x239b86,_0x349941))[_0x3951('0x46')](handleError(_0x239b86,null));};exports[_0x3951('0x47')]=function(_0x41053a,_0x149fe5){var _0x86fb89={'raw':!![],'where':{'id':_0x41053a[_0x3951('0x48')]['id']}},_0x492e6e={};_0x492e6e[_0x3951('0x30')]=_[_0x3951('0x32')](db['FaxApplication'][_0x3951('0x2d')]);_0x492e6e['query']=_[_0x3951('0x32')](_0x41053a[_0x3951('0x31')]);_0x492e6e[_0x3951('0x33')]=_[_0x3951('0x34')](_0x492e6e[_0x3951('0x30')],_0x492e6e[_0x3951('0x31')]);_0x86fb89[_0x3951('0x35')]=_[_0x3951('0x34')](_0x492e6e[_0x3951('0x30')],qs[_0x3951('0x36')](_0x41053a[_0x3951('0x31')][_0x3951('0x36')]));_0x86fb89[_0x3951('0x35')]=_0x86fb89[_0x3951('0x35')]['length']?_0x86fb89[_0x3951('0x35')]:_0x492e6e[_0x3951('0x30')];if(_0x41053a['query'][_0x3951('0x49')]){_0x86fb89['include']=[{'all':!![]}];}_0x86fb89=_[_0x3951('0x40')]({},_0x86fb89,_0x41053a[_0x3951('0x41')]);return db[_0x3951('0x42')][_0x3951('0x4a')](_0x86fb89)[_0x3951('0x24')](handleEntityNotFound(_0x149fe5,null))[_0x3951('0x24')](respondWithResult(_0x149fe5,null))['catch'](handleError(_0x149fe5,null));};exports[_0x3951('0x4b')]=function(_0xef9db0,_0x570321){return db['FaxApplication']['create'](_0xef9db0[_0x3951('0x4c')],{})[_0x3951('0x24')](respondWithResult(_0x570321,0xc9))['catch'](handleError(_0x570321,null));};exports[_0x3951('0x23')]=function(_0x19b301,_0xd6cf26){if(_0x19b301[_0x3951('0x4c')]['id']){delete _0x19b301[_0x3951('0x4c')]['id'];}return db[_0x3951('0x42')][_0x3951('0x4a')]({'where':{'id':_0x19b301[_0x3951('0x48')]['id']}})[_0x3951('0x24')](handleEntityNotFound(_0xd6cf26,null))[_0x3951('0x24')](saveUpdates(_0x19b301[_0x3951('0x4c')],null))[_0x3951('0x24')](respondWithResult(_0xd6cf26,null))[_0x3951('0x46')](handleError(_0xd6cf26,null));};exports[_0x3951('0x25')]=function(_0x2718b3,_0x29d123){return db[_0x3951('0x42')][_0x3951('0x4a')]({'where':{'id':_0x2718b3[_0x3951('0x48')]['id']}})[_0x3951('0x24')](handleEntityNotFound(_0x29d123,null))[_0x3951('0x24')](removeEntity(_0x29d123,null))[_0x3951('0x46')](handleError(_0x29d123,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 32c3e00..b401d66 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 _0x5099=['fax_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxApplication.attributes','exports','define','FaxApplication'];(function(_0x4aadb2,_0x46be05){var _0x43785c=function(_0x6fa6d){while(--_0x6fa6d){_0x4aadb2['push'](_0x4aadb2['shift']());}};_0x43785c(++_0x46be05);}(_0x5099,0x101));var _0x9509=function(_0x21a359,_0x4d8f55){_0x21a359=_0x21a359-0x0;var _0x375ce9=_0x5099[_0x21a359];return _0x375ce9;};'use strict';var _=require(_0x9509('0x0'));var util=require(_0x9509('0x1'));var logger=require(_0x9509('0x2'))(_0x9509('0x3'));var moment=require(_0x9509('0x4'));var BPromise=require(_0x9509('0x5'));var rp=require(_0x9509('0x6'));var fs=require('fs');var path=require(_0x9509('0x7'));var rimraf=require(_0x9509('0x8'));var config=require('../../config/environment');var attributes=require(_0x9509('0x9'));module[_0x9509('0xa')]=function(_0x78a93,_0x16c3bf){return _0x78a93[_0x9509('0xb')](_0x9509('0xc'),attributes,{'tableName':_0x9509('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9509('0xe')});}; \ No newline at end of file +var _0xbbd7=['fax_applications','utf8mb4_unicode_ci','lodash','util','api','moment','rimraf','../../config/environment','./faxApplication.attributes','define'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xbbd7,0x138));var _0x7bbd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbd7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7bbd('0x0'));var util=require(_0x7bbd('0x1'));var logger=require('../../config/logger')(_0x7bbd('0x2'));var moment=require(_0x7bbd('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7bbd('0x4'));var config=require(_0x7bbd('0x5'));var attributes=require(_0x7bbd('0x6'));module['exports']=function(_0x34a299,_0x5ece2a){return _0x34a299[_0x7bbd('0x7')]('FaxApplication',attributes,{'tableName':_0x7bbd('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7bbd('0x9')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 54c48e2..893023c 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 _0x3261=['client','http','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','message','FaxApplication','update','body','options','where','attributes','limit','then','UpdateFaxApplication','stringify','catch','util','moment','bluebird','../../config/utils','rpc','../../config/environment'];(function(_0x377926,_0xf3a11){var _0x287f93=function(_0xa50454){while(--_0xa50454){_0x377926['push'](_0x377926['shift']());}};_0x287f93(++_0xf3a11);}(_0x3261,0x7c));var _0x1326=function(_0x591327,_0x551718){_0x591327=_0x591327-0x0;var _0x43a675=_0x3261[_0x591327];return _0x43a675;};'use strict';var _=require('lodash');var util=require(_0x1326('0x0'));var moment=require(_0x1326('0x1'));var BPromise=require(_0x1326('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1326('0x3'));var logger=require('../../config/logger')(_0x1326('0x4'));var config=require(_0x1326('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x1326('0x6')][_0x1326('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5f2d95,_0x573dd1,_0x5b3123){return new BPromise(function(_0x4d6db8,_0x52de16){return client['request'](_0x5f2d95,_0x5b3123)['then'](function(_0x52a527){logger[_0x1326('0x8')](_0x1326('0x9'),_0x573dd1,_0x1326('0xa'));logger[_0x1326('0xb')](_0x1326('0xc'),_0x573dd1,_0x1326('0xa'),JSON['stringify'](_0x52a527));if(_0x52a527[_0x1326('0xd')]){if(_0x52a527[_0x1326('0xd')]['code']===0x1f4){logger[_0x1326('0xd')](_0x1326('0x9'),_0x573dd1,_0x52a527[_0x1326('0xd')]['message']);return _0x52de16(_0x52a527['error']['message']);}logger[_0x1326('0xd')](_0x1326('0x9'),_0x573dd1,_0x52a527[_0x1326('0xd')][_0x1326('0xe')]);return _0x4d6db8(_0x52a527['error']['message']);}else{logger[_0x1326('0x8')]('FaxApplication,\x20%s,\x20%s',_0x573dd1,'request\x20sent');_0x4d6db8(_0x52a527['result']['message']);}})['catch'](function(_0x1c7b3f){logger[_0x1326('0xd')](_0x1326('0x9'),_0x573dd1,_0x1c7b3f);_0x52de16(_0x1c7b3f);});});}exports['UpdateFaxApplication']=function(_0x49bfda){var _0x234af1=this;return new Promise(function(_0x39dbe1,_0x3fb09a){return db[_0x1326('0xf')][_0x1326('0x10')](_0x49bfda[_0x1326('0x11')],{'raw':_0x49bfda[_0x1326('0x12')]?_0x49bfda[_0x1326('0x12')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49bfda[_0x1326('0x12')]?_0x49bfda[_0x1326('0x12')][_0x1326('0x13')]||null:null,'attributes':_0x49bfda[_0x1326('0x12')]?_0x49bfda[_0x1326('0x12')][_0x1326('0x14')]||null:null,'limit':_0x49bfda['options']?_0x49bfda[_0x1326('0x12')][_0x1326('0x15')]||null:null})[_0x1326('0x16')](function(_0x4cfe58){logger['info'](_0x1326('0x17'),_0x49bfda);logger['debug'](_0x1326('0x17'),_0x49bfda,JSON[_0x1326('0x18')](_0x4cfe58));_0x39dbe1(_0x4cfe58);})[_0x1326('0x19')](function(_0x234b15){logger['error']('UpdateFaxApplication',_0x234b15[_0x1326('0xe')],_0x49bfda);_0x3fb09a(_0x234af1[_0x1326('0xd')](0x1f4,_0x234b15[_0x1326('0xe')]));});});}; \ No newline at end of file +var _0xb5f4=['debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','attributes','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x29e857,_0x52d046){var _0x43ad98=function(_0x5f1ab4){while(--_0x5f1ab4){_0x29e857['push'](_0x29e857['shift']());}};_0x43ad98(++_0x52d046);}(_0xb5f4,0x1c2));var _0x4b5f=function(_0x3584a7,_0x403176){_0x3584a7=_0x3584a7-0x0;var _0x3f575d=_0xb5f4[_0x3584a7];return _0x3f575d;};'use strict';var _=require(_0x4b5f('0x0'));var util=require(_0x4b5f('0x1'));var moment=require('moment');var BPromise=require(_0x4b5f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b5f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4b5f('0x4'))(_0x4b5f('0x5'));var config=require(_0x4b5f('0x6'));var jayson=require(_0x4b5f('0x7'));var client=jayson[_0x4b5f('0x8')][_0x4b5f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47f958,_0x5074e0,_0x4d1ded){return new BPromise(function(_0x47c2e2,_0x319e98){return client['request'](_0x47f958,_0x4d1ded)[_0x4b5f('0xa')](function(_0x587acd){logger[_0x4b5f('0xb')](_0x4b5f('0xc'),_0x5074e0,_0x4b5f('0xd'));logger[_0x4b5f('0xe')](_0x4b5f('0xf'),_0x5074e0,_0x4b5f('0xd'),JSON[_0x4b5f('0x10')](_0x587acd));if(_0x587acd[_0x4b5f('0x11')]){if(_0x587acd[_0x4b5f('0x11')][_0x4b5f('0x12')]===0x1f4){logger[_0x4b5f('0x11')](_0x4b5f('0xc'),_0x5074e0,_0x587acd[_0x4b5f('0x11')][_0x4b5f('0x13')]);return _0x319e98(_0x587acd['error'][_0x4b5f('0x13')]);}logger[_0x4b5f('0x11')]('FaxApplication,\x20%s,\x20%s',_0x5074e0,_0x587acd['error'][_0x4b5f('0x13')]);return _0x47c2e2(_0x587acd['error'][_0x4b5f('0x13')]);}else{logger[_0x4b5f('0xb')](_0x4b5f('0xc'),_0x5074e0,_0x4b5f('0xd'));_0x47c2e2(_0x587acd[_0x4b5f('0x14')][_0x4b5f('0x13')]);}})[_0x4b5f('0x15')](function(_0x593882){logger['error']('FaxApplication,\x20%s,\x20%s',_0x5074e0,_0x593882);_0x319e98(_0x593882);});});}exports[_0x4b5f('0x16')]=function(_0x332150){var _0x5bb3de=this;return new Promise(function(_0x53929b,_0x2aab09){return db[_0x4b5f('0x17')][_0x4b5f('0x18')](_0x332150[_0x4b5f('0x19')],{'raw':_0x332150['options']?_0x332150[_0x4b5f('0x1a')][_0x4b5f('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x332150[_0x4b5f('0x1a')]?_0x332150[_0x4b5f('0x1a')]['where']||null:null,'attributes':_0x332150[_0x4b5f('0x1a')]?_0x332150[_0x4b5f('0x1a')][_0x4b5f('0x1c')]||null:null,'limit':_0x332150[_0x4b5f('0x1a')]?_0x332150[_0x4b5f('0x1a')]['limit']||null:null})['then'](function(_0xe8a055){logger[_0x4b5f('0xb')](_0x4b5f('0x16'),_0x332150);logger[_0x4b5f('0xe')]('UpdateFaxApplication',_0x332150,JSON['stringify'](_0xe8a055));_0x53929b(_0xe8a055);})[_0x4b5f('0x15')](function(_0x5eeed6){logger[_0x4b5f('0x11')]('UpdateFaxApplication',_0x5eeed6[_0x4b5f('0x13')],_0x332150);_0x2aab09(_0x5bb3de[_0x4b5f('0x11')](0x1f4,_0x5eeed6[_0x4b5f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 1c1b50b..63cff8a 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 _0xf4f4=['../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x351848,_0x348c3d){var _0x20864b=function(_0x1ecb9a){while(--_0x1ecb9a){_0x351848['push'](_0x351848['shift']());}};_0x20864b(++_0x348c3d);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x228f13,_0x550e4a){_0x228f13=_0x228f13-0x0;var _0x2921f0=_0xf4f4[_0x228f13];return _0x2921f0;};'use strict';var multer=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var path=require('path');var timeout=require(_0x4f4f('0x2'));var express=require(_0x4f4f('0x3'));var router=express[_0x4f4f('0x4')]();var fs_extra=require(_0x4f4f('0x5'));var auth=require(_0x4f4f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4f4f('0x7'));var controller=require('./faxApplication.controller');router[_0x4f4f('0x8')]('/',auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xa')]);router[_0x4f4f('0x8')](_0x4f4f('0xb'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xc')]);router[_0x4f4f('0xd')]('/',auth['isAuthenticated'](),controller[_0x4f4f('0xe')]);router[_0x4f4f('0xf')](_0x4f4f('0xb'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x10')]);router[_0x4f4f('0x11')](_0x4f4f('0xb'),auth[_0x4f4f('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x955f=['path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports','multer','util'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x955f,0x1eb));var _0xf955=function(_0x5c06c3,_0x1f403f){_0x5c06c3=_0x5c06c3-0x0;var _0x20645a=_0x955f[_0x5c06c3];return _0x20645a;};'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 diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 993e99f..d0d6cd5 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 _0x7f0f=['DATE','ENUM','out','sequelize','BOOLEAN','STRING'];(function(_0x35efe0,_0x25266f){var _0x45ea82=function(_0x463a96){while(--_0x463a96){_0x35efe0['push'](_0x35efe0['shift']());}};_0x45ea82(++_0x25266f);}(_0x7f0f,0x75));var _0xf7f0=function(_0x4376b3,_0x44b199){_0x4376b3=_0x4376b3-0x0;var _0x325b3b=_0x7f0f[_0x4376b3];return _0x325b3b;};'use strict';var Sequelize=require(_0xf7f0('0x0'));module['exports']={'closed':{'type':Sequelize[_0xf7f0('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xf7f0('0x2')]},'secondDisposition':{'type':Sequelize[_0xf7f0('0x2')]},'thirdDisposition':{'type':Sequelize[_0xf7f0('0x2')]},'note':{'type':Sequelize[_0xf7f0('0x2')]},'read1stAt':{'type':Sequelize[_0xf7f0('0x3')]},'fax':{'type':Sequelize[_0xf7f0('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xf7f0('0x4')]('in',_0xf7f0('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf7f0('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xf7f0('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xfdd2=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x4c81f4,_0x3ad90a){var _0x212ffa=function(_0x1e6ed2){while(--_0x1e6ed2){_0x4c81f4['push'](_0x4c81f4['shift']());}};_0x212ffa(++_0x3ad90a);}(_0xfdd2,0x1d5));var _0x2fdd=function(_0x197837,_0x439ae2){_0x197837=_0x197837-0x0;var _0x3eed5f=_0xfdd2[_0x197837];return _0x3eed5f;};'use strict';var Sequelize=require(_0x2fdd('0x0'));module[_0x2fdd('0x1')]={'closed':{'type':Sequelize[_0x2fdd('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2fdd('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x2fdd('0x4')]},'thirdDisposition':{'type':Sequelize[_0x2fdd('0x4')]},'note':{'type':Sequelize[_0x2fdd('0x4')]},'read1stAt':{'type':Sequelize[_0x2fdd('0x3')]},'fax':{'type':Sequelize[_0x2fdd('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x2fdd('0x5')]('in',_0x2fdd('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2fdd('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x2fdd('0x5')]('in',_0x2fdd('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index ab5d461..1f1595e 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 _0xde42=['getMessages','findOne','FaxMessage','pick','format','options','setTags','spread','findAll','faxInteractionTags:save','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','createdAt','get','Messages','basename','existsSync','createReadStream','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','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','api','../../config/utils','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','Users','map','fullname','TagIds','Tags','forEach','push','catch','index','FaxInteraction','rawAttributes','fieldName','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','fax_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','keys','some','compact','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','SELECT','clone','i.id','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','agent','getFaxAccounts','isEmpty','i.FaxAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','params','includeAll','include','create','body','describe','addMessage','ids','omit'];(function(_0x238b61,_0xb94d00){var _0x519752=function(_0x19a3a1){while(--_0x19a3a1){_0x238b61['push'](_0x238b61['shift']());}};_0x519752(++_0xb94d00);}(_0xde42,0x1c7));var _0x2de4=function(_0x527fd7,_0x15af06){_0x527fd7=_0x527fd7-0x0;var _0x3ca79b=_0xde42[_0x527fd7];return _0x3ca79b;};'use strict';var emlformat=require(_0x2de4('0x0'));var rimraf=require(_0x2de4('0x1'));var zipdir=require(_0x2de4('0x2'));var jsonpatch=require(_0x2de4('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2de4('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x2de4('0x5'));var ejs=require(_0x2de4('0x6'));var fs=require('fs');var fs_extra=require(_0x2de4('0x7'));var _=require(_0x2de4('0x8'));var squel=require(_0x2de4('0x9'));var crypto=require(_0x2de4('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2de4('0xb'));var toCsv=require('to-csv');var querystring=require(_0x2de4('0xc'));var Papa=require(_0x2de4('0xd'));var Redis=require(_0x2de4('0xe'));var authService=require(_0x2de4('0xf'));var qs=require(_0x2de4('0x10'));var as=require(_0x2de4('0x11'));var hardwareService=require(_0x2de4('0x12'));var logger=require('../../config/logger')(_0x2de4('0x13'));var utils=require(_0x2de4('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x2de4('0x15')](config[_0x2de4('0x16')],{'host':_0x2de4('0x17'),'port':0x18eb});var socket=require(_0x2de4('0x18'))(new Redis(config[_0x2de4('0x16')]));require(_0x2de4('0x19'))[_0x2de4('0x1a')](socket);function respondWithStatusCode(_0x4d2bcf,_0x266fce){_0x266fce=_0x266fce||0xcc;return function(_0x30b212){if(_0x30b212){return _0x4d2bcf[_0x2de4('0x1b')](_0x266fce);}return _0x4d2bcf[_0x2de4('0x1c')](_0x266fce)[_0x2de4('0x1d')]();};}function respondWithResult(_0x426afb,_0x511d47){_0x511d47=_0x511d47||0xc8;return function(_0x3fa349){if(_0x3fa349){return _0x426afb['status'](_0x511d47)[_0x2de4('0x1e')](_0x3fa349);}};}function respondWithFilteredResult(_0x1a0c15,_0x152f33){return function(_0x3be0e2){if(_0x3be0e2){var _0x5664c0=typeof _0x152f33[_0x2de4('0x1f')]===_0x2de4('0x20')&&typeof _0x152f33[_0x2de4('0x21')]===_0x2de4('0x20');var _0x3b1c84=_0x3be0e2[_0x2de4('0x22')];var _0x214155=_0x5664c0?0x0:_0x152f33['offset'];var _0x5d093d=_0x5664c0?_0x3be0e2['count']:_0x152f33[_0x2de4('0x1f')]+_0x152f33['limit'];var _0x2990bb;if(_0x5d093d>=_0x3b1c84){_0x5d093d=_0x3b1c84;_0x2990bb=0xc8;}else{_0x2990bb=0xce;}_0x1a0c15[_0x2de4('0x1c')](_0x2990bb);return _0x1a0c15[_0x2de4('0x23')](_0x2de4('0x24'),_0x214155+'-'+_0x5d093d+'/'+_0x3b1c84)[_0x2de4('0x1e')](_0x3be0e2);}return null;};}function patchUpdates(_0x4bf5f3){return function(_0x544732){try{jsonpatch[_0x2de4('0x25')](_0x544732,_0x4bf5f3,!![]);}catch(_0x3916ab){return BPromise['reject'](_0x3916ab);}return _0x544732[_0x2de4('0x26')]();};}function saveUpdates(_0x570e78,_0x198def){return function(_0x5c9b97){if(_0x5c9b97){return _0x5c9b97[_0x2de4('0x27')](_0x570e78)[_0x2de4('0x28')](function(_0x524c66){return _0x524c66;});}return null;};}function removeEntity(_0x4853a3,_0x277442){return function(_0x373ec7){if(_0x373ec7){return _0x373ec7[_0x2de4('0x29')]()[_0x2de4('0x28')](function(){_0x4853a3['status'](0xcc)[_0x2de4('0x1d')]();});}};}function handleEntityNotFound(_0x5d23ef,_0x18acbe){return function(_0x21148e){if(!_0x21148e){_0x5d23ef['sendStatus'](0x194);}return _0x21148e;};}function handleError(_0x39abf5,_0x5336f8){_0x5336f8=_0x5336f8||0x1f4;return function(_0x294475){logger['error'](_0x294475[_0x2de4('0x2a')]);if(_0x294475[_0x2de4('0x2b')]){delete _0x294475[_0x2de4('0x2b')];}_0x39abf5[_0x2de4('0x1c')](_0x5336f8)[_0x2de4('0x2c')](_0x294475);};}function getInteractionUsers(_0x19d416,_0x3c53da){return new BPromise(function(_0x17191e,_0x589bce){try{if(_0x3c53da[_0x19d416['id']]){_0x19d416[_0x2de4('0x2d')]=_[_0x2de4('0x2e')](_0x3c53da[_0x19d416['id']],function(_0x26755e){return{'id':_0x26755e['id'],'fullname':_0x26755e[_0x2de4('0x2f')]};});}}catch(_0x33e5b3){_0x589bce(_0x33e5b3);}_0x17191e(_0x19d416);});}function getInteractionTags(_0x24325d,_0x36005f){return new BPromise(function(_0x5e78e7,_0xa183f6){try{if(_0x24325d[_0x2de4('0x30')]){_0x24325d[_0x2de4('0x31')]=[];_0x24325d['TagIds']['split'](',')[_0x2de4('0x32')](function(_0x2eb8c1){_0x24325d[_0x2de4('0x31')][_0x2de4('0x33')](_0x36005f[_0x2eb8c1]);});}delete _0x24325d[_0x2de4('0x30')];}catch(_0x175b7b){_0xa183f6(_0x175b7b);}_0x5e78e7(_0x24325d);});}function updateFaxInteraction(_0x34ee06,_0x125429,_0x503a3e){return new BPromise(function(_0x235661,_0x554ef2){return getInteractionUsers(_0x34ee06,_0x503a3e)[_0x2de4('0x28')](function(_0x99ccfe){return getInteractionTags(_0x99ccfe,_0x125429);})[_0x2de4('0x28')](function(_0x296e91){_0x235661(_0x296e91);})[_0x2de4('0x34')](function(_0x5b3cd6){_0x554ef2(_0x5b3cd6);});});}exports[_0x2de4('0x35')]=function(_0x40d299,_0x433b3b){var _0x36f8fa={},_0x2480c3={},_0x46b784={'count':0x0,'rows':[]};var _0xa6dcbb=_[_0x2de4('0x2e')](db[_0x2de4('0x36')][_0x2de4('0x37')],function(_0x4697fc){return{'name':_0x4697fc[_0x2de4('0x38')],'type':_0x4697fc[_0x2de4('0x39')]['key']};});_0x2480c3['model']=_[_0x2de4('0x2e')](_0xa6dcbb,_0x2de4('0x2b'));_0x2480c3[_0x2de4('0x3a')]=_['keys'](_0x40d299[_0x2de4('0x3a')]);_0x2480c3[_0x2de4('0x3b')]=_[_0x2de4('0x3c')](_0x2480c3['model'],_0x2480c3[_0x2de4('0x3a')]);_0x36f8fa['attributes']=_[_0x2de4('0x3c')](_0x2480c3[_0x2de4('0x3d')],qs[_0x2de4('0x3e')](_0x40d299[_0x2de4('0x3a')]['fields']));_0x36f8fa[_0x2de4('0x3f')]=_0x36f8fa[_0x2de4('0x3f')][_0x2de4('0x40')]?_0x36f8fa[_0x2de4('0x3f')]:_0x2480c3[_0x2de4('0x3d')];if(!_0x40d299[_0x2de4('0x3a')][_0x2de4('0x41')](_0x2de4('0x42'))){_0x36f8fa[_0x2de4('0x21')]=qs[_0x2de4('0x21')](_0x40d299['query'][_0x2de4('0x21')]);_0x36f8fa['offset']=qs[_0x2de4('0x1f')](_0x40d299[_0x2de4('0x3a')][_0x2de4('0x1f')]);}_0x36f8fa['order']=qs['sort'](_0x40d299[_0x2de4('0x3a')][_0x2de4('0x43')]);_0x36f8fa[_0x2de4('0x44')]=qs[_0x2de4('0x3b')](_['pick'](_0x40d299[_0x2de4('0x3a')],_0x2480c3[_0x2de4('0x3b')]),_0xa6dcbb);var _0x1ab139=[];var _0x37cb38=squel['select']()[_0x2de4('0x45')]('id')['field'](_0x2de4('0x2b'))[_0x2de4('0x45')](_0x2de4('0x46'))[_0x2de4('0x47')](_0x2de4('0x48'));var _0x459808=squel['select']()[_0x2de4('0x45')](_0x2de4('0x49'))[_0x2de4('0x45')](_0x2de4('0x4a'))[_0x2de4('0x45')](_0x2de4('0x4b'))[_0x2de4('0x47')](_0x2de4('0x4c'),'ui')[_0x2de4('0x4d')](_0x2de4('0x4e'),'u',_0x2de4('0x4f'));var _0x53f546=squel[_0x2de4('0x50')]()[_0x2de4('0x47')](_0x2de4('0x51'),'i')[_0x2de4('0x4d')]('cm_contacts','c',_0x2de4('0x52'))[_0x2de4('0x4d')](_0x2de4('0x4e'),'o',_0x2de4('0x53'))[_0x2de4('0x4d')]('fax_accounts','a',_0x2de4('0x54'))[_0x2de4('0x4d')](_0x2de4('0x55'),'me',_0x2de4('0x56'))[_0x2de4('0x4d')](_0x2de4('0x57'),'it','it.FaxInteractionId\x20=\x20i.id')[_0x2de4('0x4d')]('tools_tags','t',_0x2de4('0x58'));var _0x4242ae=squel[_0x2de4('0x59')]();var _0x1d6aca=[];var _0x3c61f8=squel[_0x2de4('0x59')]();var _0x4690fb;if(_0x40d299[_0x2de4('0x3a')][_0x2de4('0x5a')]){_0x4690fb=as[_0x2de4('0x5b')](_0x40d299[_0x2de4('0x3a')][_0x2de4('0x5a')]);var _0x226f13=_0x4690fb['sqlOperator'];for(var _0xa11249=0x0;_0xa11249<_0x4690fb['conditions']['length'];_0xa11249++){var _0x308be5=_0x4690fb[_0x2de4('0x5c')][_0xa11249];var _0x1c58ea='i';var _0x42a290=_[_0x2de4('0x5d')](_0xa6dcbb,['name',_0x308be5[_0x2de4('0x45')]]);if(!_0x42a290){switch(_0x308be5[_0x2de4('0x45')]){case _0x2de4('0x5e'):if(_0x308be5[_0x2de4('0x5f')]==0x1){_0x53f546[_0x2de4('0x60')]('`'+_0x308be5[_0x2de4('0x45')]+_0x2de4('0x61'));}else{_0x53f546[_0x2de4('0x60')]('`'+_0x308be5['field']+'`\x20>\x200');}break;case _0x2de4('0x62'):if(_0x308be5[_0x2de4('0x63')]===_0x2de4('0x64')){if(_0x308be5['value']['split']('\x20')['length']>0x1){_0x4242ae[_0x226f13](_0x2de4('0x65'),qs['getFullTextValue'](_0x308be5[_0x2de4('0x5f')]),null);}else{var _0x513d4e='%'+_0x308be5[_0x2de4('0x5f')]+'%';_0x4242ae[_0x226f13](_0x2de4('0x66'),_0x513d4e,_0x513d4e,_0x513d4e);}}else{_0x42a290=_['find'](_0xa6dcbb,[_0x2de4('0x2b'),_0x2de4('0x67')]);_0x308be5[_0x2de4('0x45')]=_0x2de4('0x67');_0x37d72d=as[_0x2de4('0x68')](_0x1c58ea,_0x42a290[_0x2de4('0x39')],_0x308be5);_0x4242ae[_0x226f13](_0x37d72d[_0x2de4('0x69')],_0x37d72d['value'][_0x2de4('0x6a')],_0x37d72d[_0x2de4('0x5f')][_0x2de4('0x1d')]);}break;case _0x2de4('0x6b'):var _0x16ebb0=_0x308be5[_0x2de4('0x5f')][_0x2de4('0x6c')](',')[_0x2de4('0x2e')](function(_0x464aa4){return Number(_0x464aa4);});_0x16ebb0[_0x2de4('0x32')](function(_0x523a46){_0x3c61f8['or'](_0x2de4('0x6d'),'%,'+_0x523a46+',%');});_0x1d6aca=_[_0x2de4('0x6e')](_0x1d6aca,_0x16ebb0);break;case _0x2de4('0x6f'):if(_0x308be5['operator']===_0x2de4('0x64')){_0x4242ae[_0x226f13]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x308be5[_0x2de4('0x5f')]+'%',null);}else{_0x42a290=_[_0x2de4('0x5d')](_0xa6dcbb,[_0x2de4('0x2b'),'UserId']);_0x308be5[_0x2de4('0x45')]=_0x2de4('0x70');_0x37d72d=as[_0x2de4('0x68')](_0x1c58ea,_0x42a290[_0x2de4('0x39')],_0x308be5);_0x4242ae[_0x226f13](_0x37d72d['text'],_0x37d72d[_0x2de4('0x5f')][_0x2de4('0x6a')],_0x37d72d[_0x2de4('0x5f')][_0x2de4('0x1d')]);}break;case'body':_0x37d72d=as[_0x2de4('0x68')]('me',null,_0x308be5);_0x4242ae[_0x226f13](_0x37d72d[_0x2de4('0x69')],_0x37d72d[_0x2de4('0x5f')][_0x2de4('0x6a')],_0x37d72d[_0x2de4('0x5f')][_0x2de4('0x1d')]);break;}}else{var _0x37d72d=as[_0x2de4('0x68')](_0x1c58ea,_0x42a290[_0x2de4('0x39')],_0x308be5);_0x4242ae[_0x226f13](_0x37d72d['text'],_0x37d72d[_0x2de4('0x5f')]['start'],_0x37d72d[_0x2de4('0x5f')][_0x2de4('0x1d')]);}}}else{var _0x51e44e=_(_0x40d299['query'])[_0x2de4('0x71')]()[_0x2de4('0x2e')](function(_0x1d03dd){return _[_0x2de4('0x72')](_0xa6dcbb,[_0x2de4('0x2b'),_0x1d03dd])?_0x1d03dd:undefined;})[_0x2de4('0x73')]()[_0x2de4('0x5f')]();if(!_['isEmpty'](_0x51e44e)){_0x51e44e['forEach'](function(_0x25651c){if(_0x25651c===_0x2de4('0x74')){_0x53f546[_0x2de4('0x44')](_0x2de4('0x75'),[][_0x2de4('0x76')](_0x40d299[_0x2de4('0x3a')][_0x25651c]));}else if(_0x25651c==='createdAt'){var _0x1584f6=JSON[_0x2de4('0x77')](_0x40d299['query'][_0x25651c])[_0x2de4('0x78')];var _0x56e66e=JSON[_0x2de4('0x77')](_0x40d299[_0x2de4('0x3a')][_0x25651c])['$lte'];_0x53f546[_0x2de4('0x44')](_0x2de4('0x79'),_0x1584f6,_0x56e66e);}else{if(_0x40d299[_0x2de4('0x3a')][_0x25651c]===_0x2de4('0x7a')){_0x53f546[_0x2de4('0x44')]('i.'+_0x25651c+_0x2de4('0x7b'));}else{_0x53f546['where']('i.'+_0x25651c+_0x2de4('0x7c'),_0x40d299[_0x2de4('0x3a')][_0x25651c]);}}});}if(_0x40d299[_0x2de4('0x3a')]['read']){if(_0x40d299[_0x2de4('0x3a')][_0x2de4('0x7d')]==0x1){_0x53f546[_0x2de4('0x60')]('`unreadMessages`\x20=\x200');}else{_0x53f546['having'](_0x2de4('0x7e'));}}if(_0x40d299[_0x2de4('0x3a')][_0x2de4('0x7f')]){_0x1d6aca=_[_0x2de4('0x80')](_0x40d299[_0x2de4('0x3a')][_0x2de4('0x7f')])?_0x40d299[_0x2de4('0x3a')][_0x2de4('0x7f')]:new Array(_0x40d299[_0x2de4('0x3a')]['tag']);_0x1d6aca['forEach'](function(_0x17a282){_0x3c61f8['or'](_0x2de4('0x6d'),'%,'+_0x17a282+',%');});}if(_0x40d299[_0x2de4('0x3a')][_0x2de4('0x81')]){var _0x11f901=_0x40d299[_0x2de4('0x3a')][_0x2de4('0x81')][_0x2de4('0x82')]('\x5c','\x5c\x5c')[_0x2de4('0x82')](/'/g,'\x27\x27');if(qs[_0x2de4('0x83')](_0x11f901)){_0x4242ae['or']('i.id\x20LIKE\x20?',_0x11f901+'%')['or']('i.fax\x20LIKE\x20?',_0x11f901+'%');}_0x4242ae['or'](_0x2de4('0x84'),_0x11f901+'%');}}_0x53f546[_0x2de4('0x44')](_0x4242ae);_0x53f546[_0x2de4('0x85')]('i.id');var _0x2d569f={'type':db['Sequelize'][_0x2de4('0x86')][_0x2de4('0x87')],'raw':!![]};var _0x50e991=_0x53f546[_0x2de4('0x88')]();_0x50e991[_0x2de4('0x45')](_0x2de4('0x89'));_0x50e991[_0x2de4('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x36f8fa[_0x2de4('0x8a')]){_0x36f8fa['order'][_0x2de4('0x32')](function(_0x28ed0a){var _0xac4525=_0x28ed0a[0x0]===_0x2de4('0x8b')?_0x28ed0a[0x0]:'i.'+_0x28ed0a[0x0];_0x53f546[_0x2de4('0x8a')](_0xac4525,_0x28ed0a[0x1]===_0x2de4('0x8c')?![]:!![]);});}if(!_['isEmpty'](_0x1d6aca)){_0x53f546[_0x2de4('0x60')](_0x3c61f8);_0x50e991['where'](_0x2de4('0x8d'),_0x1d6aca);}BPromise[_0x2de4('0x8e')]()[_0x2de4('0x28')](function(){if(!_0x4690fb){if(_0x40d299['query'][_0x2de4('0x74')])return;_0x50e991[_0x2de4('0x44')](_0x2de4('0x8f'));_0x53f546[_0x2de4('0x44')](_0x2de4('0x8f'));return;}if(_0x40d299[_0x2de4('0x90')]['role']!==_0x2de4('0x91'))return;return _0x40d299[_0x2de4('0x90')][_0x2de4('0x92')]({'attributes':['id'],'raw':!![]})[_0x2de4('0x28')](function(_0x13d63a){if(_[_0x2de4('0x93')](_0x13d63a)){_0x50e991[_0x2de4('0x44')](_0x2de4('0x94'));_0x53f546[_0x2de4('0x44')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x50e991['where'](_0x2de4('0x75'),_['map'](_0x13d63a,'id'));_0x53f546[_0x2de4('0x44')](_0x2de4('0x75'),_[_0x2de4('0x2e')](_0x13d63a,'id'));}});})[_0x2de4('0x28')](function(){if(_0x40d299[_0x2de4('0x90')][_0x2de4('0x95')]==='agent'&&!_0x4690fb&&!_0x40d299[_0x2de4('0x3a')][_0x2de4('0x74')])return[];return db[_0x2de4('0x96')][_0x2de4('0x3a')](_0x50e991[_0x2de4('0x97')](),_0x2d569f);})[_0x2de4('0x28')](function(_0x7473e2){_0x46b784[_0x2de4('0x22')]=_0x7473e2[_0x2de4('0x40')];if(_0x46b784[_0x2de4('0x22')]===0x0)return[];return db[_0x2de4('0x96')][_0x2de4('0x3a')](_0x37cb38[_0x2de4('0x97')](),_0x2d569f)['then'](function(_0x59ca85){_0x1ab139=_[_0x2de4('0x98')](_0x59ca85,'id');_0x2d569f=_[_0x2de4('0x99')](_0x2d569f,{'model':db[_0x2de4('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x40d299[_0x2de4('0x3a')][_0x2de4('0x3e')]){_0x36f8fa[_0x2de4('0x3f')]['forEach'](function(_0x2006f9){_0x53f546['field']('i.'+_0x2006f9);});}else{_0x53f546['field'](_0x2de4('0x9a'),_0x2de4('0x5e'));_0x53f546[_0x2de4('0x45')](_0x2de4('0x9b'),_0x2de4('0x9c'));_0x53f546[_0x2de4('0x45')]('a.mandatoryDisposition',_0x2de4('0x9d'));_0x53f546[_0x2de4('0x45')]('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',_0x2de4('0x8b'));_0x53f546[_0x2de4('0x45')]('i.*');_0x53f546[_0x2de4('0x45')](_0x2de4('0x9e'),_0x2de4('0x9f'));_0x53f546[_0x2de4('0x45')](_0x2de4('0xa0'),_0x2de4('0xa1'));_0x53f546[_0x2de4('0x45')]('c.email',_0x2de4('0xa2'));_0x53f546[_0x2de4('0x45')](_0x2de4('0xa3'),_0x2de4('0xa4'));_0x53f546['field'](_0x2de4('0xa5'),_0x2de4('0xa6'));_0x53f546[_0x2de4('0x45')](_0x2de4('0xa7'),_0x2de4('0xa8'));_0x53f546['field']('o.fullname','Owner.fullname');_0x53f546[_0x2de4('0x45')]('o.internal','Owner.internal');_0x53f546[_0x2de4('0x45')](_0x2de4('0xa9'),_0x2de4('0x30'));}if(_0x36f8fa[_0x2de4('0x21')])_0x53f546[_0x2de4('0x21')](_0x36f8fa[_0x2de4('0x21')]);if(_0x36f8fa['offset'])_0x53f546['offset'](_0x36f8fa['offset']);return db[_0x2de4('0x96')][_0x2de4('0x3a')](_0x53f546[_0x2de4('0x97')](),_0x2d569f);})[_0x2de4('0x28')](function(_0x1fa698){if(_0x1fa698[_0x2de4('0x40')]>0x0)_0x459808[_0x2de4('0x44')](_0x2de4('0xaa'),_['map'](_0x1fa698,'id'));return db[_0x2de4('0x96')]['query'](_0x459808['toString'](),_0x2d569f)[_0x2de4('0x28')](function(_0x48cf9f){var _0x3a4b68=_[_0x2de4('0xab')](_0x48cf9f,_0x2de4('0xac'));var _0x40165f=[];_0x1fa698['forEach'](function(_0x34db49){_0x40165f[_0x2de4('0x33')](updateFaxInteraction(_0x34db49,_0x1ab139,_0x3a4b68));});return BPromise[_0x2de4('0xad')](_0x40165f);});});})[_0x2de4('0x28')](function(_0x15016b){_0x46b784[_0x2de4('0xae')]=_0x15016b;return _0x46b784;})['then'](respondWithFilteredResult(_0x433b3b,_0x36f8fa))[_0x2de4('0x34')](handleError(_0x433b3b,null));};exports['show']=function(_0x35bf4f,_0x57a531){var _0x57a96b={'raw':![],'where':{'id':_0x35bf4f[_0x2de4('0xaf')]['id']}},_0x215493={};_0x215493[_0x2de4('0x3d')]=_[_0x2de4('0x71')](db[_0x2de4('0x36')]['rawAttributes']);_0x215493[_0x2de4('0x3a')]=_['keys'](_0x35bf4f[_0x2de4('0x3a')]);_0x215493[_0x2de4('0x3b')]=_[_0x2de4('0x3c')](_0x215493[_0x2de4('0x3d')],_0x215493[_0x2de4('0x3a')]);_0x57a96b[_0x2de4('0x3f')]=_[_0x2de4('0x3c')](_0x215493['model'],qs[_0x2de4('0x3e')](_0x35bf4f[_0x2de4('0x3a')][_0x2de4('0x3e')]));_0x57a96b[_0x2de4('0x3f')]=_0x57a96b[_0x2de4('0x3f')][_0x2de4('0x40')]?_0x57a96b['attributes']:_0x215493[_0x2de4('0x3d')];if(_0x35bf4f['query'][_0x2de4('0xb0')]){_0x57a96b[_0x2de4('0xb1')]=[{'all':!![]}];}_0x57a96b=_['merge']({},_0x57a96b,_0x35bf4f['options']);return db[_0x2de4('0x36')][_0x2de4('0x5d')](_0x57a96b)[_0x2de4('0x28')](handleEntityNotFound(_0x57a531,null))[_0x2de4('0x28')](respondWithResult(_0x57a531,null))[_0x2de4('0x34')](handleError(_0x57a531,null));};exports['create']=function(_0x357964,_0x5d3623){return db[_0x2de4('0x36')][_0x2de4('0xb2')](_0x357964[_0x2de4('0xb3')],{})[_0x2de4('0x28')](respondWithResult(_0x5d3623,0xc9))[_0x2de4('0x34')](handleError(_0x5d3623,null));};exports[_0x2de4('0x27')]=function(_0x5aba00,_0x33277f){if(_0x5aba00[_0x2de4('0xb3')]['id']){delete _0x5aba00['body']['id'];}return db[_0x2de4('0x36')][_0x2de4('0x5d')]({'where':{'id':_0x5aba00['params']['id']}})[_0x2de4('0x28')](handleEntityNotFound(_0x33277f,null))[_0x2de4('0x28')](saveUpdates(_0x5aba00['body'],null))[_0x2de4('0x28')](respondWithResult(_0x33277f,null))[_0x2de4('0x34')](handleError(_0x33277f,null));};exports[_0x2de4('0x29')]=function(_0x2725bd,_0xf150d8){return db['FaxInteraction'][_0x2de4('0x5d')]({'where':{'id':_0x2725bd[_0x2de4('0xaf')]['id']}})[_0x2de4('0x28')](handleEntityNotFound(_0xf150d8,null))['then'](removeEntity(_0xf150d8,null))[_0x2de4('0x34')](handleError(_0xf150d8,null));};exports[_0x2de4('0xb4')]=function(_0x19d2d3,_0x20411c){return db[_0x2de4('0x36')]['describe']()[_0x2de4('0x28')](respondWithResult(_0x20411c,null))[_0x2de4('0x34')](handleError(_0x20411c,null));};exports[_0x2de4('0xb5')]=function(_0x1088fc,_0x571b71,_0x3338df){return db['FaxMessage']['find']({'where':{'id':_0x1088fc['params']['id']}})['then'](handleEntityNotFound(_0x571b71,null))[_0x2de4('0x28')](function(_0x133f00){if(_0x133f00){return _0x133f00[_0x2de4('0xb5')](_0x1088fc['body'][_0x2de4('0xb6')],_[_0x2de4('0xb7')](_0x1088fc['body'],[_0x2de4('0xb6'),'id'])||{});}})[_0x2de4('0x28')](respondWithResult(_0x571b71,null))[_0x2de4('0x34')](handleError(_0x571b71,null));};exports[_0x2de4('0xb8')]=function(_0x431ed2,_0x3e81d8,_0x2f3819){var _0x2b5250={'raw':![],'where':{}};var _0x5099b4={};var _0x4b61a3={'count':0x0,'rows':[]};return db[_0x2de4('0x36')][_0x2de4('0xb9')]({'where':{'id':_0x431ed2['params']['id']}})[_0x2de4('0x28')](handleEntityNotFound(_0x3e81d8,null))[_0x2de4('0x28')](function(_0x168151){if(_0x168151){_0x5099b4['model']=_[_0x2de4('0x71')](db[_0x2de4('0xba')][_0x2de4('0x37')]);_0x5099b4[_0x2de4('0x3a')]=_['keys'](_0x431ed2['query']);_0x5099b4[_0x2de4('0x3b')]=_['intersection'](_0x5099b4[_0x2de4('0x3d')],_0x5099b4['query']);_0x2b5250[_0x2de4('0x3f')]=_[_0x2de4('0x3c')](_0x5099b4[_0x2de4('0x3d')],qs['fields'](_0x431ed2[_0x2de4('0x3a')][_0x2de4('0x3e')]));_0x2b5250[_0x2de4('0x3f')]=_0x2b5250['attributes'][_0x2de4('0x40')]?_0x2b5250[_0x2de4('0x3f')]:_0x5099b4['model'];if(!_0x431ed2[_0x2de4('0x3a')][_0x2de4('0x41')](_0x2de4('0x42'))){_0x2b5250[_0x2de4('0x21')]=qs['limit'](_0x431ed2[_0x2de4('0x3a')][_0x2de4('0x21')]);_0x2b5250[_0x2de4('0x1f')]=qs[_0x2de4('0x1f')](_0x431ed2['query']['offset']);}_0x2b5250[_0x2de4('0x8a')]=qs['sort'](_0x431ed2['query'][_0x2de4('0x43')]);_0x2b5250[_0x2de4('0x44')]=qs[_0x2de4('0x3b')](_[_0x2de4('0xbb')](_0x431ed2['query'],_0x5099b4[_0x2de4('0x3b')]));_0x2b5250['where']['FaxInteractionId']=_0x168151['id'];if(_0x431ed2[_0x2de4('0x3a')][_0x2de4('0x81')]){_0x2b5250[_0x2de4('0x44')]=_[_0x2de4('0x99')](_0x2b5250[_0x2de4('0x44')],{'$or':_[_0x2de4('0x2e')](_0x2b5250[_0x2de4('0x3f')],function(_0xe743e7){var _0x49f8b7={};_0x49f8b7[_0xe743e7]={'$like':'%'+_0x431ed2[_0x2de4('0x3a')][_0x2de4('0x81')]+'%'};return _0x49f8b7;})});}if(_0x431ed2[_0x2de4('0x3a')][_0x2de4('0x78')]){var _0x50007e=_0x431ed2['query'][_0x2de4('0x78')][_0x2de4('0x6c')](',');var _0x453523={};_0x453523[_0x50007e[0x0]]={'$gte':moment(_0x50007e[0x1])[_0x2de4('0xbc')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2b5250[_0x2de4('0x44')]=_[_0x2de4('0x99')](_0x2b5250[_0x2de4('0x44')],_0x453523);}_0x2b5250=_[_0x2de4('0x99')]({},_0x2b5250,_0x431ed2[_0x2de4('0xbd')]);return db[_0x2de4('0xba')][_0x2de4('0x22')]({'where':_0x2b5250[_0x2de4('0x44')]})[_0x2de4('0x28')](function(_0x4a726d){_0x4b61a3['count']=_0x4a726d;if(_0x431ed2[_0x2de4('0x3a')][_0x2de4('0xb0')]){_0x2b5250[_0x2de4('0xb1')]=[{'all':!![]}];}return db[_0x2de4('0xba')]['findAll'](_0x2b5250);})[_0x2de4('0x28')](function(_0x378975){_0x4b61a3[_0x2de4('0xae')]=_0x378975;return _0x4b61a3;});}})[_0x2de4('0x28')](respondWithFilteredResult(_0x3e81d8,_0x2b5250))[_0x2de4('0x34')](handleError(_0x3e81d8,null));};exports['addTags']=function(_0x3bc7fa,_0x18380b,_0x57b76c){return db[_0x2de4('0x36')][_0x2de4('0x5d')]({'where':{'id':_0x3bc7fa[_0x2de4('0xaf')]['id']}})[_0x2de4('0x28')](handleEntityNotFound(_0x18380b,null))[_0x2de4('0x28')](function(_0x431d0d){if(_0x431d0d){return _0x431d0d[_0x2de4('0xbe')](_0x3bc7fa[_0x2de4('0xb3')][_0x2de4('0xb6')],_[_0x2de4('0xb7')](_0x3bc7fa[_0x2de4('0xb3')],[_0x2de4('0xb6'),'id'])||{})[_0x2de4('0xbf')](function(){return db[_0x2de4('0x6b')][_0x2de4('0xc0')]({'attributes':['id','name',_0x2de4('0x46')],'where':{'id':_0x3bc7fa[_0x2de4('0xb3')][_0x2de4('0xb6')]}});})['then'](function(_0x289f20){socket['emit'](_0x2de4('0xc1'),{'id':Number(_0x3bc7fa['params']['id']),'tags':_0x289f20||[]});return{'id':Number(_0x3bc7fa[_0x2de4('0xaf')]['id']),'tags':_0x289f20||[]};});}})[_0x2de4('0x28')](respondWithResult(_0x18380b,null))['catch'](handleError(_0x18380b,null));};exports[_0x2de4('0xc2')]=function(_0x3f7654,_0x51b9fe,_0x50fe8a){return db[_0x2de4('0x36')][_0x2de4('0x5d')]({'where':{'id':_0x3f7654[_0x2de4('0xaf')]['id']}})['then'](handleEntityNotFound(_0x51b9fe,null))['then'](function(_0x34838d){if(_0x34838d){return _0x34838d[_0x2de4('0xc2')](_0x3f7654['query']['ids']);}})[_0x2de4('0x28')](respondWithStatusCode(_0x51b9fe,null))[_0x2de4('0x34')](handleError(_0x51b9fe,null));};exports[_0x2de4('0xc3')]=function(_0x35e8f0,_0x2e85c5){var _0x41de4c=moment()['unix']()['toString']();var _0x539ebf=path[_0x2de4('0xc4')](config[_0x2de4('0xc5')],_0x2de4('0xc6'),_0x2de4('0xc7'),_0x2de4('0xc8'));var _0x16560b=path['join'](config[_0x2de4('0xc5')],_0x2de4('0xc6'),_0x2de4('0xc7'),_0x2de4('0xc9'));var _0x21e8f0=path[_0x2de4('0xc4')](_0x539ebf,_0x41de4c);var _0xc7f95b=util[_0x2de4('0xbc')](_0x2de4('0xca'),_0x35e8f0[_0x2de4('0xaf')]['id'],_0x41de4c);var _0x1e21c9=path[_0x2de4('0xc4')](_0x539ebf,_0xc7f95b);var _0x445d6b=[];_0x445d6b[_0x2de4('0x33')]({'model':db[_0x2de4('0xcb')],'as':_0x2de4('0xcb'),'raw':!![]});var _0x539d23=[{'model':db[_0x2de4('0xba')],'as':'Messages','attributes':['id','body',_0x2de4('0xcc')],'include':_0x445d6b}];return db[_0x2de4('0x36')][_0x2de4('0x5d')]({'where':{'id':_0x35e8f0[_0x2de4('0xaf')]['id']},'include':_0x539d23})['then'](handleEntityNotFound(_0x2e85c5,null))[_0x2de4('0x28')](function(_0x16300a){if(_0x16300a&&_0x16300a['Messages']){var _0x103dc1=_0x16300a[_0x2de4('0xcd')]({'plain':!![]});fs['mkdirSync'](_0x21e8f0);for(var _0x4a48ad=0x0;_0x4a48ad<_0x103dc1[_0x2de4('0xce')][_0x2de4('0x40')];_0x4a48ad++){var _0x19b20b=_0x103dc1[_0x2de4('0xce')][_0x4a48ad][_0x2de4('0xcb')];if(_0x19b20b){var _0xe8eed3=path['join'](_0x16560b,_0x19b20b[_0x2de4('0xcf')]);if(fs[_0x2de4('0xd0')](_0xe8eed3)){fs[_0x2de4('0xd1')](_0xe8eed3)['pipe'](fs['createWriteStream'](path['join'](_0x21e8f0,_0x19b20b[_0x2de4('0xcf')])));}}}return BPromise[_0x2de4('0x8e')]()[_0x2de4('0x28')](function(){return new BPromise(function(_0x3cd357,_0x2e2e07){zipdir(_0x21e8f0,{'saveTo':_0x1e21c9},function(_0x5d608e,_0x20bbe0){if(_0x5d608e)return _0x2e2e07(_0x5d608e);return _0x3cd357(_0x20bbe0);});})[_0x2de4('0x28')](function(){return new BPromise(function(_0x5921a8,_0x15b18a){rimraf(_0x21e8f0,function(_0x1c892f){if(_0x1c892f)_0x15b18a(_0x1c892f);return _0x5921a8();});});})[_0x2de4('0x28')](function(){return _0x2e85c5['download'](_0x1e21c9,_0xc7f95b,function(_0x1779f7){if(_0x1779f7){console[_0x2de4('0xd2')](_0x2de4('0xd3'),_0x1779f7);}else{fs[_0x2de4('0xd4')](_0x1e21c9);}});});});}else{return _0x2e85c5[_0x2de4('0x1b')](0xc8);}})[_0x2de4('0x34')](handleError(_0x2e85c5,null));}; \ No newline at end of file +var _0x8e41=['start','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','createdAt','$gte','parse','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','agent','toString','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','push','show','FaxInteraction','rawAttributes','includeAll','include','options','create','params','destroy','describe','addMessage','FaxMessage','omit','ids','findOne','hasOwnProperty','nolimit','FaxInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','emit','faxInteractionTags:save','removeTags','unix','join','root','server','files','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','createReadStream','createWriteStream','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./faxInteraction.socket','register','sendStatus','status','end','limit','offset','count','set','Content-Range','json','apply','reject','update','name','Users','fullname','Tags','TagIds','forEach','then','catch','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','$substring','value','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','find','ContactId','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','text','body'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8e41,0x6c));var _0x18e4=function(_0x2b84c8,_0x183d8e){_0x2b84c8=_0x2b84c8-0x0;var _0x5cea29=_0x8e41[_0x2b84c8];return _0x5cea29;};'use strict';var emlformat=require(_0x18e4('0x0'));var rimraf=require(_0x18e4('0x1'));var zipdir=require(_0x18e4('0x2'));var jsonpatch=require(_0x18e4('0x3'));var rp=require(_0x18e4('0x4'));var moment=require(_0x18e4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x18e4('0x6'));var util=require(_0x18e4('0x7'));var path=require(_0x18e4('0x8'));var sox=require(_0x18e4('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x18e4('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x18e4('0xb'));var toCsv=require(_0x18e4('0xc'));var querystring=require(_0x18e4('0xd'));var Papa=require(_0x18e4('0xe'));var Redis=require(_0x18e4('0xf'));var authService=require(_0x18e4('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x18e4('0x11'));var logger=require(_0x18e4('0x12'))(_0x18e4('0x13'));var utils=require('../../config/utils');var config=require(_0x18e4('0x14'));var licenseUtil=require(_0x18e4('0x15'));var db=require(_0x18e4('0x16'))['db'];config[_0x18e4('0x17')]=_['defaults'](config[_0x18e4('0x17')],{'host':_0x18e4('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x18e4('0x17')]));require(_0x18e4('0x19'))[_0x18e4('0x1a')](socket);function respondWithStatusCode(_0x12c5d7,_0x322233){_0x322233=_0x322233||0xcc;return function(_0x48ee84){if(_0x48ee84){return _0x12c5d7[_0x18e4('0x1b')](_0x322233);}return _0x12c5d7[_0x18e4('0x1c')](_0x322233)[_0x18e4('0x1d')]();};}function respondWithResult(_0x2f147c,_0x134a40){_0x134a40=_0x134a40||0xc8;return function(_0x5e8ee8){if(_0x5e8ee8){return _0x2f147c['status'](_0x134a40)['json'](_0x5e8ee8);}};}function respondWithFilteredResult(_0x5d3fef,_0xa971b3){return function(_0x2fa4cf){if(_0x2fa4cf){var _0x3d5712=typeof _0xa971b3['offset']==='undefined'&&typeof _0xa971b3[_0x18e4('0x1e')]==='undefined';var _0x2b6acd=_0x2fa4cf['count'];var _0x42b2ee=_0x3d5712?0x0:_0xa971b3[_0x18e4('0x1f')];var _0x29ade0=_0x3d5712?_0x2fa4cf[_0x18e4('0x20')]:_0xa971b3[_0x18e4('0x1f')]+_0xa971b3[_0x18e4('0x1e')];var _0x7dd04;if(_0x29ade0>=_0x2b6acd){_0x29ade0=_0x2b6acd;_0x7dd04=0xc8;}else{_0x7dd04=0xce;}_0x5d3fef['status'](_0x7dd04);return _0x5d3fef[_0x18e4('0x21')](_0x18e4('0x22'),_0x42b2ee+'-'+_0x29ade0+'/'+_0x2b6acd)[_0x18e4('0x23')](_0x2fa4cf);}return null;};}function patchUpdates(_0x9cbf57){return function(_0x17c58b){try{jsonpatch[_0x18e4('0x24')](_0x17c58b,_0x9cbf57,!![]);}catch(_0x39f81c){return BPromise[_0x18e4('0x25')](_0x39f81c);}return _0x17c58b['save']();};}function saveUpdates(_0x3ce79e,_0x38c0df){return function(_0x6f71a9){if(_0x6f71a9){return _0x6f71a9[_0x18e4('0x26')](_0x3ce79e)['then'](function(_0x5da1ba){return _0x5da1ba;});}return null;};}function removeEntity(_0x3a1414,_0x831909){return function(_0x240c79){if(_0x240c79){return _0x240c79['destroy']()['then'](function(){_0x3a1414[_0x18e4('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x518027,_0x204b7b){return function(_0x47061e){if(!_0x47061e){_0x518027['sendStatus'](0x194);}return _0x47061e;};}function handleError(_0x4cad7c,_0x25b7f5){_0x25b7f5=_0x25b7f5||0x1f4;return function(_0x5a46b5){logger['error'](_0x5a46b5['stack']);if(_0x5a46b5[_0x18e4('0x27')]){delete _0x5a46b5['name'];}_0x4cad7c['status'](_0x25b7f5)['send'](_0x5a46b5);};}function getInteractionUsers(_0x1913c8,_0x60c150){return new BPromise(function(_0x4cddea,_0x5e002c){try{if(_0x60c150[_0x1913c8['id']]){_0x1913c8[_0x18e4('0x28')]=_['map'](_0x60c150[_0x1913c8['id']],function(_0x3e4fa6){return{'id':_0x3e4fa6['id'],'fullname':_0x3e4fa6[_0x18e4('0x29')]};});}}catch(_0x2ba70a){_0x5e002c(_0x2ba70a);}_0x4cddea(_0x1913c8);});}function getInteractionTags(_0x460a2f,_0x137429){return new BPromise(function(_0x82d9ce,_0x948a45){try{if(_0x460a2f['TagIds']){_0x460a2f[_0x18e4('0x2a')]=[];_0x460a2f[_0x18e4('0x2b')]['split'](',')[_0x18e4('0x2c')](function(_0x145294){_0x460a2f['Tags']['push'](_0x137429[_0x145294]);});}delete _0x460a2f['TagIds'];}catch(_0x25f893){_0x948a45(_0x25f893);}_0x82d9ce(_0x460a2f);});}function updateFaxInteraction(_0x679633,_0x2bf67e,_0x856805){return new BPromise(function(_0x2fa487,_0x260b0b){return getInteractionUsers(_0x679633,_0x856805)['then'](function(_0x1ac4ae){return getInteractionTags(_0x1ac4ae,_0x2bf67e);})[_0x18e4('0x2d')](function(_0x305903){_0x2fa487(_0x305903);})[_0x18e4('0x2e')](function(_0x52e3dc){_0x260b0b(_0x52e3dc);});});}exports['index']=function(_0x49fca5,_0x494eba){var _0x1212a2={},_0xcb39c6={},_0x2fed4c={'count':0x0,'rows':[]};var _0x348a89=_[_0x18e4('0x2f')](db['FaxInteraction']['rawAttributes'],function(_0x4e016f){return{'name':_0x4e016f[_0x18e4('0x30')],'type':_0x4e016f[_0x18e4('0x31')][_0x18e4('0x32')]};});_0xcb39c6[_0x18e4('0x33')]=_[_0x18e4('0x2f')](_0x348a89,'name');_0xcb39c6[_0x18e4('0x34')]=_[_0x18e4('0x35')](_0x49fca5['query']);_0xcb39c6[_0x18e4('0x36')]=_[_0x18e4('0x37')](_0xcb39c6[_0x18e4('0x33')],_0xcb39c6['query']);_0x1212a2[_0x18e4('0x38')]=_[_0x18e4('0x37')](_0xcb39c6[_0x18e4('0x33')],qs[_0x18e4('0x39')](_0x49fca5[_0x18e4('0x34')][_0x18e4('0x39')]));_0x1212a2[_0x18e4('0x38')]=_0x1212a2[_0x18e4('0x38')][_0x18e4('0x3a')]?_0x1212a2['attributes']:_0xcb39c6[_0x18e4('0x33')];if(!_0x49fca5['query']['hasOwnProperty']('nolimit')){_0x1212a2[_0x18e4('0x1e')]=qs[_0x18e4('0x1e')](_0x49fca5['query'][_0x18e4('0x1e')]);_0x1212a2[_0x18e4('0x1f')]=qs[_0x18e4('0x1f')](_0x49fca5[_0x18e4('0x34')]['offset']);}_0x1212a2[_0x18e4('0x3b')]=qs[_0x18e4('0x3c')](_0x49fca5[_0x18e4('0x34')]['sort']);_0x1212a2['where']=qs[_0x18e4('0x36')](_[_0x18e4('0x3d')](_0x49fca5['query'],_0xcb39c6[_0x18e4('0x36')]),_0x348a89);var _0x169808=[];var _0x259617=squel[_0x18e4('0x3e')]()[_0x18e4('0x3f')]('id')['field'](_0x18e4('0x27'))[_0x18e4('0x3f')](_0x18e4('0x40'))[_0x18e4('0x41')](_0x18e4('0x42'));var _0xd84c97=squel[_0x18e4('0x3e')]()[_0x18e4('0x3f')](_0x18e4('0x43'))[_0x18e4('0x3f')](_0x18e4('0x44'))[_0x18e4('0x3f')](_0x18e4('0x45'))['from'](_0x18e4('0x46'),'ui')[_0x18e4('0x47')](_0x18e4('0x48'),'u',_0x18e4('0x49'));var _0xfd8610=squel[_0x18e4('0x3e')]()[_0x18e4('0x41')](_0x18e4('0x4a'),'i')['left_join'](_0x18e4('0x4b'),'c',_0x18e4('0x4c'))[_0x18e4('0x47')](_0x18e4('0x48'),'o',_0x18e4('0x4d'))[_0x18e4('0x47')]('fax_accounts','a','a.id\x20=\x20i.FaxAccountId')['left_join'](_0x18e4('0x4e'),'me',_0x18e4('0x4f'))[_0x18e4('0x47')](_0x18e4('0x50'),'it','it.FaxInteractionId\x20=\x20i.id')['left_join']('tools_tags','t',_0x18e4('0x51'));var _0x3c32ae=squel[_0x18e4('0x52')]();var _0x42a459=[];var _0x44e693=squel['expr']();var _0x2b8f37;if(_0x49fca5[_0x18e4('0x34')][_0x18e4('0x53')]){_0x2b8f37=as[_0x18e4('0x54')](_0x49fca5[_0x18e4('0x34')][_0x18e4('0x53')]);var _0x527b17=_0x2b8f37['sqlOperator'];for(var _0x545835=0x0;_0x545835<_0x2b8f37[_0x18e4('0x55')][_0x18e4('0x3a')];_0x545835++){var _0x5986e4=_0x2b8f37['conditions'][_0x545835];var _0x54fd9d='i';var _0x3042d5=_['find'](_0x348a89,[_0x18e4('0x27'),_0x5986e4[_0x18e4('0x3f')]]);if(!_0x3042d5){switch(_0x5986e4[_0x18e4('0x3f')]){case _0x18e4('0x56'):if(_0x5986e4['value']==0x1){_0xfd8610[_0x18e4('0x57')]('`'+_0x5986e4[_0x18e4('0x3f')]+_0x18e4('0x58'));}else{_0xfd8610[_0x18e4('0x57')]('`'+_0x5986e4['field']+_0x18e4('0x59'));}break;case _0x18e4('0x5a'):if(_0x5986e4['operator']===_0x18e4('0x5b')){if(_0x5986e4[_0x18e4('0x5c')][_0x18e4('0x5d')]('\x20')[_0x18e4('0x3a')]>0x1){_0x3c32ae[_0x527b17](_0x18e4('0x5e'),qs['getFullTextValue'](_0x5986e4['value']),null);}else{var _0xc95efa='%'+_0x5986e4[_0x18e4('0x5c')]+'%';_0x3c32ae[_0x527b17]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0xc95efa,_0xc95efa,_0xc95efa);}}else{_0x3042d5=_[_0x18e4('0x5f')](_0x348a89,[_0x18e4('0x27'),_0x18e4('0x60')]);_0x5986e4[_0x18e4('0x3f')]='ContactId';_0x4eabd5=as['buildExpression'](_0x54fd9d,_0x3042d5[_0x18e4('0x31')],_0x5986e4);_0x3c32ae[_0x527b17](_0x4eabd5['text'],_0x4eabd5[_0x18e4('0x5c')]['start'],_0x4eabd5[_0x18e4('0x5c')]['end']);}break;case _0x18e4('0x61'):var _0x4babff=_0x5986e4[_0x18e4('0x5c')][_0x18e4('0x5d')](',')[_0x18e4('0x2f')](function(_0x3e437e){return Number(_0x3e437e);});_0x4babff['forEach'](function(_0xb28334){_0x44e693['or'](_0x18e4('0x62'),'%,'+_0xb28334+',%');});_0x42a459=_['union'](_0x42a459,_0x4babff);break;case _0x18e4('0x63'):if(_0x5986e4[_0x18e4('0x64')]===_0x18e4('0x5b')){_0x3c32ae[_0x527b17](_0x18e4('0x65'),'%'+_0x5986e4[_0x18e4('0x5c')]+'%',null);}else{_0x3042d5=_[_0x18e4('0x5f')](_0x348a89,['name',_0x18e4('0x66')]);_0x5986e4[_0x18e4('0x3f')]=_0x18e4('0x66');_0x4eabd5=as[_0x18e4('0x67')](_0x54fd9d,_0x3042d5[_0x18e4('0x31')],_0x5986e4);_0x3c32ae[_0x527b17](_0x4eabd5[_0x18e4('0x68')],_0x4eabd5[_0x18e4('0x5c')]['start'],_0x4eabd5[_0x18e4('0x5c')][_0x18e4('0x1d')]);}break;case _0x18e4('0x69'):_0x4eabd5=as['buildExpression']('me',null,_0x5986e4);_0x3c32ae[_0x527b17](_0x4eabd5[_0x18e4('0x68')],_0x4eabd5[_0x18e4('0x5c')][_0x18e4('0x6a')],_0x4eabd5[_0x18e4('0x5c')][_0x18e4('0x1d')]);break;}}else{var _0x4eabd5=as[_0x18e4('0x67')](_0x54fd9d,_0x3042d5[_0x18e4('0x31')],_0x5986e4);_0x3c32ae[_0x527b17](_0x4eabd5['text'],_0x4eabd5['value'][_0x18e4('0x6a')],_0x4eabd5[_0x18e4('0x5c')][_0x18e4('0x1d')]);}}}else{var _0x21b4a6=_(_0x49fca5['query'])[_0x18e4('0x35')]()[_0x18e4('0x2f')](function(_0x3158e6){return _['some'](_0x348a89,[_0x18e4('0x27'),_0x3158e6])?_0x3158e6:undefined;})[_0x18e4('0x6b')]()['value']();if(!_[_0x18e4('0x6c')](_0x21b4a6)){_0x21b4a6['forEach'](function(_0x1b3cde){if(_0x1b3cde===_0x18e4('0x6d')){_0xfd8610['where'](_0x18e4('0x6e'),[]['concat'](_0x49fca5[_0x18e4('0x34')][_0x1b3cde]));}else if(_0x1b3cde===_0x18e4('0x6f')){var _0x71e4db=JSON['parse'](_0x49fca5[_0x18e4('0x34')][_0x1b3cde])[_0x18e4('0x70')];var _0x498207=JSON[_0x18e4('0x71')](_0x49fca5[_0x18e4('0x34')][_0x1b3cde])[_0x18e4('0x72')];_0xfd8610[_0x18e4('0x73')](_0x18e4('0x74'),_0x71e4db,_0x498207);}else{if(_0x49fca5[_0x18e4('0x34')][_0x1b3cde]===_0x18e4('0x75')){_0xfd8610[_0x18e4('0x73')]('i.'+_0x1b3cde+_0x18e4('0x76'));}else{_0xfd8610[_0x18e4('0x73')]('i.'+_0x1b3cde+_0x18e4('0x77'),_0x49fca5[_0x18e4('0x34')][_0x1b3cde]);}}});}if(_0x49fca5[_0x18e4('0x34')][_0x18e4('0x78')]){if(_0x49fca5[_0x18e4('0x34')]['read']==0x1){_0xfd8610['having'](_0x18e4('0x79'));}else{_0xfd8610[_0x18e4('0x57')](_0x18e4('0x7a'));}}if(_0x49fca5[_0x18e4('0x34')][_0x18e4('0x7b')]){_0x42a459=_['isArray'](_0x49fca5[_0x18e4('0x34')][_0x18e4('0x7b')])?_0x49fca5[_0x18e4('0x34')][_0x18e4('0x7b')]:new Array(_0x49fca5[_0x18e4('0x34')][_0x18e4('0x7b')]);_0x42a459[_0x18e4('0x2c')](function(_0x214b40){_0x44e693['or'](_0x18e4('0x62'),'%,'+_0x214b40+',%');});}if(_0x49fca5[_0x18e4('0x34')][_0x18e4('0x7c')]){var _0x5f57df=_0x49fca5[_0x18e4('0x34')][_0x18e4('0x7c')][_0x18e4('0x7d')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x18e4('0x7e')](_0x5f57df)){_0x3c32ae['or']('i.id\x20LIKE\x20?',_0x5f57df+'%')['or'](_0x18e4('0x7f'),_0x5f57df+'%');}_0x3c32ae['or'](_0x18e4('0x80'),_0x5f57df+'%');}}_0xfd8610[_0x18e4('0x73')](_0x3c32ae);_0xfd8610[_0x18e4('0x81')](_0x18e4('0x82'));var _0x3c0d19={'type':db[_0x18e4('0x83')]['QueryTypes'][_0x18e4('0x84')],'raw':!![]};var _0x1495d8=_0xfd8610[_0x18e4('0x85')]();_0x1495d8[_0x18e4('0x3f')](_0x18e4('0x82'));_0x1495d8[_0x18e4('0x3f')](_0x18e4('0x86'),_0x18e4('0x56'));if(_0x1212a2[_0x18e4('0x3b')]){_0x1212a2[_0x18e4('0x3b')][_0x18e4('0x2c')](function(_0x40127b){var _0x62a8f=_0x40127b[0x0]===_0x18e4('0x87')?_0x40127b[0x0]:'i.'+_0x40127b[0x0];_0xfd8610['order'](_0x62a8f,_0x40127b[0x1]===_0x18e4('0x88')?![]:!![]);});}if(!_[_0x18e4('0x6c')](_0x42a459)){_0xfd8610[_0x18e4('0x57')](_0x44e693);_0x1495d8[_0x18e4('0x73')](_0x18e4('0x89'),_0x42a459);}BPromise[_0x18e4('0x8a')]()[_0x18e4('0x2d')](function(){if(!_0x2b8f37){if(_0x49fca5[_0x18e4('0x34')][_0x18e4('0x6d')])return;_0x1495d8['where'](_0x18e4('0x8b'));_0xfd8610[_0x18e4('0x73')](_0x18e4('0x8b'));return;}if(_0x49fca5[_0x18e4('0x8c')][_0x18e4('0x8d')]!=='agent')return;return _0x49fca5['user'][_0x18e4('0x8e')]({'attributes':['id'],'raw':!![]})['then'](function(_0x34f7b9){if(_[_0x18e4('0x6c')](_0x34f7b9)){_0x1495d8[_0x18e4('0x73')](_0x18e4('0x8f'));_0xfd8610[_0x18e4('0x73')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x1495d8[_0x18e4('0x73')](_0x18e4('0x6e'),_[_0x18e4('0x2f')](_0x34f7b9,'id'));_0xfd8610['where']('i.FaxAccountId\x20IN\x20?',_[_0x18e4('0x2f')](_0x34f7b9,'id'));}});})[_0x18e4('0x2d')](function(){if(_0x49fca5[_0x18e4('0x8c')][_0x18e4('0x8d')]===_0x18e4('0x90')&&!_0x2b8f37&&!_0x49fca5[_0x18e4('0x34')][_0x18e4('0x6d')])return[];return db['sequelize'][_0x18e4('0x34')](_0x1495d8['toString'](),_0x3c0d19);})['then'](function(_0x436bee){_0x2fed4c[_0x18e4('0x20')]=_0x436bee[_0x18e4('0x3a')];if(_0x2fed4c[_0x18e4('0x20')]===0x0)return[];return db['sequelize'][_0x18e4('0x34')](_0x259617[_0x18e4('0x91')](),_0x3c0d19)['then'](function(_0x13affc){_0x169808=_[_0x18e4('0x92')](_0x13affc,'id');_0x3c0d19=_[_0x18e4('0x93')](_0x3c0d19,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x49fca5[_0x18e4('0x34')]['fields']){_0x1212a2[_0x18e4('0x38')][_0x18e4('0x2c')](function(_0x37560c){_0xfd8610['field']('i.'+_0x37560c);});}else{_0xfd8610[_0x18e4('0x3f')](_0x18e4('0x86'),_0x18e4('0x56'));_0xfd8610[_0x18e4('0x3f')](_0x18e4('0x94'),_0x18e4('0x95'));_0xfd8610['field']('a.mandatoryDisposition',_0x18e4('0x96'));_0xfd8610['field']('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',_0x18e4('0x87'));_0xfd8610[_0x18e4('0x3f')](_0x18e4('0x97'));_0xfd8610[_0x18e4('0x3f')](_0x18e4('0x98'),_0x18e4('0x99'));_0xfd8610['field'](_0x18e4('0x9a'),'Contact.lastName');_0xfd8610[_0x18e4('0x3f')]('c.email',_0x18e4('0x9b'));_0xfd8610[_0x18e4('0x3f')](_0x18e4('0x9c'),_0x18e4('0x9d'));_0xfd8610['field'](_0x18e4('0x9e'),_0x18e4('0x9f'));_0xfd8610[_0x18e4('0x3f')](_0x18e4('0xa0'),_0x18e4('0xa1'));_0xfd8610['field'](_0x18e4('0xa2'),_0x18e4('0xa3'));_0xfd8610['field']('o.internal',_0x18e4('0xa4'));_0xfd8610['field'](_0x18e4('0xa5'),_0x18e4('0x2b'));}if(_0x1212a2[_0x18e4('0x1e')])_0xfd8610[_0x18e4('0x1e')](_0x1212a2[_0x18e4('0x1e')]);if(_0x1212a2[_0x18e4('0x1f')])_0xfd8610['offset'](_0x1212a2[_0x18e4('0x1f')]);return db['sequelize'][_0x18e4('0x34')](_0xfd8610[_0x18e4('0x91')](),_0x3c0d19);})[_0x18e4('0x2d')](function(_0x419154){if(_0x419154[_0x18e4('0x3a')]>0x0)_0xd84c97[_0x18e4('0x73')](_0x18e4('0xa6'),_[_0x18e4('0x2f')](_0x419154,'id'));return db['sequelize'][_0x18e4('0x34')](_0xd84c97[_0x18e4('0x91')](),_0x3c0d19)[_0x18e4('0x2d')](function(_0x255345){var _0x1bcc89=_[_0x18e4('0xa7')](_0x255345,'FaxInteractionId');var _0x386cea=[];_0x419154[_0x18e4('0x2c')](function(_0x3b0ae3){_0x386cea[_0x18e4('0xa8')](updateFaxInteraction(_0x3b0ae3,_0x169808,_0x1bcc89));});return BPromise['all'](_0x386cea);});});})[_0x18e4('0x2d')](function(_0x3551c6){_0x2fed4c['rows']=_0x3551c6;return _0x2fed4c;})[_0x18e4('0x2d')](respondWithFilteredResult(_0x494eba,_0x1212a2))[_0x18e4('0x2e')](handleError(_0x494eba,null));};exports[_0x18e4('0xa9')]=function(_0x4da4b0,_0x288daa){var _0x181198={'raw':![],'where':{'id':_0x4da4b0['params']['id']}},_0x2d39f3={};_0x2d39f3['model']=_[_0x18e4('0x35')](db[_0x18e4('0xaa')][_0x18e4('0xab')]);_0x2d39f3[_0x18e4('0x34')]=_[_0x18e4('0x35')](_0x4da4b0[_0x18e4('0x34')]);_0x2d39f3['filters']=_[_0x18e4('0x37')](_0x2d39f3[_0x18e4('0x33')],_0x2d39f3[_0x18e4('0x34')]);_0x181198[_0x18e4('0x38')]=_[_0x18e4('0x37')](_0x2d39f3[_0x18e4('0x33')],qs['fields'](_0x4da4b0['query'][_0x18e4('0x39')]));_0x181198['attributes']=_0x181198[_0x18e4('0x38')][_0x18e4('0x3a')]?_0x181198[_0x18e4('0x38')]:_0x2d39f3[_0x18e4('0x33')];if(_0x4da4b0[_0x18e4('0x34')][_0x18e4('0xac')]){_0x181198[_0x18e4('0xad')]=[{'all':!![]}];}_0x181198=_['merge']({},_0x181198,_0x4da4b0[_0x18e4('0xae')]);return db[_0x18e4('0xaa')]['find'](_0x181198)[_0x18e4('0x2d')](handleEntityNotFound(_0x288daa,null))['then'](respondWithResult(_0x288daa,null))['catch'](handleError(_0x288daa,null));};exports[_0x18e4('0xaf')]=function(_0x5449b6,_0x469b10){return db['FaxInteraction'][_0x18e4('0xaf')](_0x5449b6[_0x18e4('0x69')],{})[_0x18e4('0x2d')](respondWithResult(_0x469b10,0xc9))[_0x18e4('0x2e')](handleError(_0x469b10,null));};exports[_0x18e4('0x26')]=function(_0x22d55e,_0x52520a){if(_0x22d55e[_0x18e4('0x69')]['id']){delete _0x22d55e[_0x18e4('0x69')]['id'];}return db[_0x18e4('0xaa')][_0x18e4('0x5f')]({'where':{'id':_0x22d55e[_0x18e4('0xb0')]['id']}})[_0x18e4('0x2d')](handleEntityNotFound(_0x52520a,null))['then'](saveUpdates(_0x22d55e['body'],null))[_0x18e4('0x2d')](respondWithResult(_0x52520a,null))[_0x18e4('0x2e')](handleError(_0x52520a,null));};exports[_0x18e4('0xb1')]=function(_0x84d114,_0x5c442b){return db[_0x18e4('0xaa')][_0x18e4('0x5f')]({'where':{'id':_0x84d114[_0x18e4('0xb0')]['id']}})['then'](handleEntityNotFound(_0x5c442b,null))[_0x18e4('0x2d')](removeEntity(_0x5c442b,null))[_0x18e4('0x2e')](handleError(_0x5c442b,null));};exports[_0x18e4('0xb2')]=function(_0x1ddcfd,_0x275c91){return db[_0x18e4('0xaa')][_0x18e4('0xb2')]()[_0x18e4('0x2d')](respondWithResult(_0x275c91,null))[_0x18e4('0x2e')](handleError(_0x275c91,null));};exports[_0x18e4('0xb3')]=function(_0x1fe2f4,_0x2fe8e8,_0xa646b3){return db[_0x18e4('0xb4')][_0x18e4('0x5f')]({'where':{'id':_0x1fe2f4[_0x18e4('0xb0')]['id']}})['then'](handleEntityNotFound(_0x2fe8e8,null))[_0x18e4('0x2d')](function(_0x2ad1e9){if(_0x2ad1e9){return _0x2ad1e9[_0x18e4('0xb3')](_0x1fe2f4['body']['ids'],_[_0x18e4('0xb5')](_0x1fe2f4['body'],[_0x18e4('0xb6'),'id'])||{});}})[_0x18e4('0x2d')](respondWithResult(_0x2fe8e8,null))[_0x18e4('0x2e')](handleError(_0x2fe8e8,null));};exports['getMessages']=function(_0x30bd25,_0x3e6abb,_0x5c37cd){var _0x2c1f14={'raw':![],'where':{}};var _0x1dc59d={};var _0xaffe6f={'count':0x0,'rows':[]};return db[_0x18e4('0xaa')][_0x18e4('0xb7')]({'where':{'id':_0x30bd25[_0x18e4('0xb0')]['id']}})[_0x18e4('0x2d')](handleEntityNotFound(_0x3e6abb,null))[_0x18e4('0x2d')](function(_0x2e2927){if(_0x2e2927){_0x1dc59d[_0x18e4('0x33')]=_[_0x18e4('0x35')](db[_0x18e4('0xb4')][_0x18e4('0xab')]);_0x1dc59d[_0x18e4('0x34')]=_[_0x18e4('0x35')](_0x30bd25[_0x18e4('0x34')]);_0x1dc59d[_0x18e4('0x36')]=_[_0x18e4('0x37')](_0x1dc59d[_0x18e4('0x33')],_0x1dc59d[_0x18e4('0x34')]);_0x2c1f14[_0x18e4('0x38')]=_[_0x18e4('0x37')](_0x1dc59d['model'],qs['fields'](_0x30bd25[_0x18e4('0x34')][_0x18e4('0x39')]));_0x2c1f14[_0x18e4('0x38')]=_0x2c1f14[_0x18e4('0x38')][_0x18e4('0x3a')]?_0x2c1f14[_0x18e4('0x38')]:_0x1dc59d[_0x18e4('0x33')];if(!_0x30bd25[_0x18e4('0x34')][_0x18e4('0xb8')](_0x18e4('0xb9'))){_0x2c1f14[_0x18e4('0x1e')]=qs[_0x18e4('0x1e')](_0x30bd25[_0x18e4('0x34')][_0x18e4('0x1e')]);_0x2c1f14['offset']=qs[_0x18e4('0x1f')](_0x30bd25[_0x18e4('0x34')][_0x18e4('0x1f')]);}_0x2c1f14[_0x18e4('0x3b')]=qs[_0x18e4('0x3c')](_0x30bd25[_0x18e4('0x34')]['sort']);_0x2c1f14[_0x18e4('0x73')]=qs[_0x18e4('0x36')](_[_0x18e4('0x3d')](_0x30bd25[_0x18e4('0x34')],_0x1dc59d[_0x18e4('0x36')]));_0x2c1f14[_0x18e4('0x73')][_0x18e4('0xba')]=_0x2e2927['id'];if(_0x30bd25[_0x18e4('0x34')]['filter']){_0x2c1f14['where']=_['merge'](_0x2c1f14[_0x18e4('0x73')],{'$or':_[_0x18e4('0x2f')](_0x2c1f14[_0x18e4('0x38')],function(_0x226445){var _0x480f38={};_0x480f38[_0x226445]={'$like':'%'+_0x30bd25[_0x18e4('0x34')][_0x18e4('0x7c')]+'%'};return _0x480f38;})});}if(_0x30bd25[_0x18e4('0x34')][_0x18e4('0x70')]){var _0xa8b85d=_0x30bd25[_0x18e4('0x34')][_0x18e4('0x70')][_0x18e4('0x5d')](',');var _0x337810={};_0x337810[_0xa8b85d[0x0]]={'$gte':moment(_0xa8b85d[0x1])[_0x18e4('0xbb')](_0x18e4('0xbc'))};_0x2c1f14[_0x18e4('0x73')]=_[_0x18e4('0x93')](_0x2c1f14[_0x18e4('0x73')],_0x337810);}_0x2c1f14=_['merge']({},_0x2c1f14,_0x30bd25[_0x18e4('0xae')]);return db[_0x18e4('0xb4')]['count']({'where':_0x2c1f14[_0x18e4('0x73')]})[_0x18e4('0x2d')](function(_0x4d8b1e){_0xaffe6f[_0x18e4('0x20')]=_0x4d8b1e;if(_0x30bd25['query']['includeAll']){_0x2c1f14['include']=[{'all':!![]}];}return db[_0x18e4('0xb4')][_0x18e4('0xbd')](_0x2c1f14);})[_0x18e4('0x2d')](function(_0x4d19bf){_0xaffe6f[_0x18e4('0xbe')]=_0x4d19bf;return _0xaffe6f;});}})[_0x18e4('0x2d')](respondWithFilteredResult(_0x3e6abb,_0x2c1f14))[_0x18e4('0x2e')](handleError(_0x3e6abb,null));};exports[_0x18e4('0xbf')]=function(_0x108c47,_0x464e04,_0x214f1f){return db[_0x18e4('0xaa')]['find']({'where':{'id':_0x108c47['params']['id']}})[_0x18e4('0x2d')](handleEntityNotFound(_0x464e04,null))['then'](function(_0x292206){if(_0x292206){return _0x292206[_0x18e4('0xc0')](_0x108c47['body'][_0x18e4('0xb6')],_['omit'](_0x108c47[_0x18e4('0x69')],['ids','id'])||{})[_0x18e4('0xc1')](function(){return db[_0x18e4('0x61')][_0x18e4('0xbd')]({'attributes':['id',_0x18e4('0x27'),_0x18e4('0x40')],'where':{'id':_0x108c47[_0x18e4('0x69')][_0x18e4('0xb6')]}});})['then'](function(_0x285d94){socket[_0x18e4('0xc2')](_0x18e4('0xc3'),{'id':Number(_0x108c47[_0x18e4('0xb0')]['id']),'tags':_0x285d94||[]});return{'id':Number(_0x108c47[_0x18e4('0xb0')]['id']),'tags':_0x285d94||[]};});}})[_0x18e4('0x2d')](respondWithResult(_0x464e04,null))['catch'](handleError(_0x464e04,null));};exports[_0x18e4('0xc4')]=function(_0x3e0cfe,_0x5a22ac,_0xce066){return db['FaxInteraction'][_0x18e4('0x5f')]({'where':{'id':_0x3e0cfe[_0x18e4('0xb0')]['id']}})[_0x18e4('0x2d')](handleEntityNotFound(_0x5a22ac,null))[_0x18e4('0x2d')](function(_0x5ac759){if(_0x5ac759){return _0x5ac759[_0x18e4('0xc4')](_0x3e0cfe[_0x18e4('0x34')][_0x18e4('0xb6')]);}})['then'](respondWithStatusCode(_0x5a22ac,null))[_0x18e4('0x2e')](handleError(_0x5a22ac,null));};exports['download']=function(_0x17ac54,_0x26f760){var _0x139c8e=moment()[_0x18e4('0xc5')]()[_0x18e4('0x91')]();var _0x59255e=path[_0x18e4('0xc6')](config[_0x18e4('0xc7')],_0x18e4('0xc8'),_0x18e4('0xc9'),'tmp');var _0x181ff4=path[_0x18e4('0xc6')](config['root'],_0x18e4('0xc8'),_0x18e4('0xc9'),_0x18e4('0xca'));var _0x54976f=path[_0x18e4('0xc6')](_0x59255e,_0x139c8e);var _0x3076a0=util[_0x18e4('0xbb')](_0x18e4('0xcb'),_0x17ac54[_0x18e4('0xb0')]['id'],_0x139c8e);var _0x5243af=path['join'](_0x59255e,_0x3076a0);var _0x48f8bd=[];_0x48f8bd['push']({'model':db['Attachment'],'as':_0x18e4('0xcc'),'raw':!![]});var _0xc65299=[{'model':db[_0x18e4('0xb4')],'as':_0x18e4('0xcd'),'attributes':['id',_0x18e4('0x69'),_0x18e4('0x6f')],'include':_0x48f8bd}];return db[_0x18e4('0xaa')][_0x18e4('0x5f')]({'where':{'id':_0x17ac54[_0x18e4('0xb0')]['id']},'include':_0xc65299})[_0x18e4('0x2d')](handleEntityNotFound(_0x26f760,null))[_0x18e4('0x2d')](function(_0x32e320){if(_0x32e320&&_0x32e320[_0x18e4('0xcd')]){var _0x11a7eb=_0x32e320[_0x18e4('0xce')]({'plain':!![]});fs[_0x18e4('0xcf')](_0x54976f);for(var _0x3b4547=0x0;_0x3b4547<_0x11a7eb[_0x18e4('0xcd')][_0x18e4('0x3a')];_0x3b4547++){var _0x19daff=_0x11a7eb[_0x18e4('0xcd')][_0x3b4547][_0x18e4('0xcc')];if(_0x19daff){var _0x4d3f0e=path[_0x18e4('0xc6')](_0x181ff4,_0x19daff[_0x18e4('0xd0')]);if(fs['existsSync'](_0x4d3f0e)){fs[_0x18e4('0xd1')](_0x4d3f0e)['pipe'](fs[_0x18e4('0xd2')](path[_0x18e4('0xc6')](_0x54976f,_0x19daff[_0x18e4('0xd0')])));}}}return BPromise[_0x18e4('0x8a')]()['then'](function(){return new BPromise(function(_0x18c2ed,_0x1ce81a){zipdir(_0x54976f,{'saveTo':_0x5243af},function(_0x418ad4,_0x13575a){if(_0x418ad4)return _0x1ce81a(_0x418ad4);return _0x18c2ed(_0x13575a);});})[_0x18e4('0x2d')](function(){return new BPromise(function(_0xbe6364,_0x513057){rimraf(_0x54976f,function(_0x34171e){if(_0x34171e)_0x513057(_0x34171e);return _0xbe6364();});});})[_0x18e4('0x2d')](function(){return _0x26f760['download'](_0x5243af,_0x3076a0,function(_0x14a0ce){if(_0x14a0ce){console[_0x18e4('0xd3')](_0x18e4('0xd4'),_0x14a0ce);}else{fs[_0x18e4('0xd5')](_0x5243af);}});});});}else{return _0x26f760['sendStatus'](0xc8);}})[_0x18e4('0x2e')](handleError(_0x26f760,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index babc8d5..2686e1c 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 _0x3768=['FaxInteraction','FaxMessage','setMaxListeners','save','update','getUsers','then','Users','setDataValue','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x4d2993,_0x1c9473){var _0x427374=function(_0x149dfd){while(--_0x149dfd){_0x4d2993['push'](_0x4d2993['shift']());}};_0x427374(++_0x1c9473);}(_0x3768,0xb2));var _0x8376=function(_0x404957,_0x5192a4){_0x404957=_0x404957-0x0;var _0x4e0365=_0x3768[_0x404957];return _0x4e0365;};'use strict';var EventEmitter=require(_0x8376('0x0'));var FaxInteraction=require(_0x8376('0x1'))['db'][_0x8376('0x2')];var FaxMessage=require(_0x8376('0x1'))['db'][_0x8376('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x8376('0x4')](0x0);var events={'afterCreate':_0x8376('0x5'),'afterUpdate':_0x8376('0x6'),'afterDestroy':'remove'};function emitEvent(_0xada9cc){return function(_0x578f45,_0x325bf1,_0x50c9a9){_0x578f45[_0x8376('0x7')]({'attributes':['id'],'raw':!![]})[_0x8376('0x8')](function(_0x23f973){_0x578f45['setDataValue'](_0x8376('0x9'),_0x23f973['map'](function(_0xdc35cb){return{'id':_0xdc35cb['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x578f45['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8376('0x8')](function(_0x154130){_0x578f45[_0x8376('0xa')]('unreadMessages',_0x154130['length']);FaxInteractionEvents['emit'](_0xada9cc+':'+_0x578f45['id'],_0x578f45);FaxInteractionEvents['emit'](_0xada9cc,_0x578f45);_0x50c9a9(null);})[_0x8376('0xb')](_0x50c9a9(null));};}for(var e in events){if(events[_0x8376('0xc')](e)){var event=events[e];FaxInteraction[_0x8376('0xd')](e,emitEvent(event));}}module[_0x8376('0xe')]=FaxInteractionEvents; \ No newline at end of file +var _0x34e0=['setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','FaxInteraction','FaxMessage','save','update','remove','getUsers','then'];(function(_0xbf41f2,_0x371b05){var _0x1eeba6=function(_0x3b50f3){while(--_0x3b50f3){_0xbf41f2['push'](_0xbf41f2['shift']());}};_0x1eeba6(++_0x371b05);}(_0x34e0,0x12a));var _0x034e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x34e0[_0x37bd26];return _0xe83dc4;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x034e('0x0'))['db'][_0x034e('0x1')];var FaxMessage=require(_0x034e('0x0'))['db'][_0x034e('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x034e('0x3'),'afterUpdate':_0x034e('0x4'),'afterDestroy':_0x034e('0x5')};function emitEvent(_0x4a6975){return function(_0x100cf6,_0x115cdf,_0x4104b4){_0x100cf6[_0x034e('0x6')]({'attributes':['id'],'raw':!![]})[_0x034e('0x7')](function(_0x28df88){_0x100cf6[_0x034e('0x8')](_0x034e('0x9'),_0x28df88['map'](function(_0x21086f){return{'id':_0x21086f['id']};}));return FaxMessage[_0x034e('0xa')]({'where':{'FaxInteractionId':_0x100cf6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x034e('0x7')](function(_0x2d66d5){_0x100cf6[_0x034e('0x8')](_0x034e('0xb'),_0x2d66d5[_0x034e('0xc')]);FaxInteractionEvents[_0x034e('0xd')](_0x4a6975+':'+_0x100cf6['id'],_0x100cf6);FaxInteractionEvents[_0x034e('0xd')](_0x4a6975,_0x100cf6);_0x4104b4(null);})[_0x034e('0xe')](_0x4104b4(null));};}for(var e in events){if(events[_0x034e('0xf')](e)){var event=events[e];FaxInteraction[_0x034e('0x10')](e,emitEvent(event));}}module[_0x034e('0x11')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 7eee55b..cc6c9ec 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 _0xc15b=['request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','closed','closedAt','lodash','moment','bluebird'];(function(_0x3709cd,_0x4a3d2a){var _0x320fd7=function(_0xc4ae65){while(--_0xc4ae65){_0x3709cd['push'](_0x3709cd['shift']());}};_0x320fd7(++_0x4a3d2a);}(_0xc15b,0x159));var _0xbc15=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0xc15b[_0x2d89ce];return _0x3fad10;};'use strict';var _=require(_0xbc15('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xbc15('0x1'));var BPromise=require(_0xbc15('0x2'));var rp=require(_0xbc15('0x3'));var fs=require('fs');var path=require(_0xbc15('0x4'));var rimraf=require(_0xbc15('0x5'));var config=require(_0xbc15('0x6'));var attributes=require(_0xbc15('0x7'));module[_0xbc15('0x8')]=function(_0x437c7e,_0x4b0b70){return _0x437c7e[_0xbc15('0x9')]('FaxInteraction',attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1490d4,_0x1ca450,_0x40db8b){if(_0x1490d4['changed'](_0xbc15('0xa'))){_0x1490d4[_0xbc15('0xb')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x40db8b(null,_0x1490d4);}}});}; \ No newline at end of file +var _0x726f=['request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','FaxInteraction','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2b49bc,_0x47b636){var _0x43cc65=function(_0x236ec3){while(--_0x236ec3){_0x2b49bc['push'](_0x2b49bc['shift']());}};_0x43cc65(++_0x47b636);}(_0x726f,0x1ca));var _0xf726=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x726f[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xf726('0x0'));var util=require(_0xf726('0x1'));var logger=require(_0xf726('0x2'))(_0xf726('0x3'));var moment=require(_0xf726('0x4'));var BPromise=require(_0xf726('0x5'));var rp=require(_0xf726('0x6'));var fs=require('fs');var path=require(_0xf726('0x7'));var rimraf=require(_0xf726('0x8'));var config=require(_0xf726('0x9'));var attributes=require(_0xf726('0xa'));module['exports']=function(_0x5446bd,_0x1ecf4c){return _0x5446bd['define'](_0xf726('0xb'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x524fd0,_0x19bfec,_0x7edb51){if(_0x524fd0[_0xf726('0xc')]('closed')){_0x524fd0[_0xf726('0xd')]=moment()[_0xf726('0xe')](_0xf726('0xf'));}_0x7edb51(null,_0x524fd0);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index fd4580c..c6cdfe7 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 _0x0b94=['limit','info','UpdateFaxInteraction','stringify','catch','AddTagsToFaxInteraction','find','where','addTags','ids','spread','AddTags','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','./faxInteraction.socket','request','then','FaxInteraction,\x20%s,\x20%s','debug','request\x20sent','error','message','result','FaxInteraction','body','options','raw','attributes'];(function(_0x476f24,_0xf60f9d){var _0x4e216e=function(_0x21e4f7){while(--_0x21e4f7){_0x476f24['push'](_0x476f24['shift']());}};_0x4e216e(++_0xf60f9d);}(_0x0b94,0xa0));var _0x40b9=function(_0x370436,_0x2df1c5){_0x370436=_0x370436-0x0;var _0x299602=_0x0b94[_0x370436];return _0x299602;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x40b9('0x0'));var rs=require(_0x40b9('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x40b9('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x40b9('0x3'))(_0x40b9('0x4'));var config=require(_0x40b9('0x5'));var jayson=require(_0x40b9('0x6'));var client=jayson[_0x40b9('0x7')]['http']({'port':0x232a});config['redis']=_[_0x40b9('0x8')](config[_0x40b9('0x9')],{'host':_0x40b9('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x40b9('0x9')]));require(_0x40b9('0xb'))['register'](socket);function respondWithRpcPromise(_0x303bae,_0x17d2e6,_0x15b9e9){return new BPromise(function(_0x14ccc5,_0xa8f476){return client[_0x40b9('0xc')](_0x303bae,_0x15b9e9)[_0x40b9('0xd')](function(_0xea251a){logger['info'](_0x40b9('0xe'),_0x17d2e6,'request\x20sent');logger[_0x40b9('0xf')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x17d2e6,_0x40b9('0x10'),JSON['stringify'](_0xea251a));if(_0xea251a[_0x40b9('0x11')]){if(_0xea251a[_0x40b9('0x11')]['code']===0x1f4){logger[_0x40b9('0x11')](_0x40b9('0xe'),_0x17d2e6,_0xea251a[_0x40b9('0x11')][_0x40b9('0x12')]);return _0xa8f476(_0xea251a[_0x40b9('0x11')][_0x40b9('0x12')]);}logger[_0x40b9('0x11')](_0x40b9('0xe'),_0x17d2e6,_0xea251a[_0x40b9('0x11')][_0x40b9('0x12')]);return _0x14ccc5(_0xea251a[_0x40b9('0x11')][_0x40b9('0x12')]);}else{logger['info'](_0x40b9('0xe'),_0x17d2e6,'request\x20sent');_0x14ccc5(_0xea251a[_0x40b9('0x13')][_0x40b9('0x12')]);}})['catch'](function(_0x5982c3){logger['error'](_0x40b9('0xe'),_0x17d2e6,_0x5982c3);_0xa8f476(_0x5982c3);});});}exports['UpdateFaxInteraction']=function(_0xe01cf9){var _0x4cd7b7=this;return new Promise(function(_0x3f0598,_0x4c3990){return db[_0x40b9('0x14')]['update'](_0xe01cf9[_0x40b9('0x15')],{'raw':_0xe01cf9[_0x40b9('0x16')]?_0xe01cf9['options'][_0x40b9('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe01cf9[_0x40b9('0x16')]?_0xe01cf9['options']['where']||null:null,'attributes':_0xe01cf9[_0x40b9('0x16')]?_0xe01cf9['options'][_0x40b9('0x18')]||null:null,'limit':_0xe01cf9[_0x40b9('0x16')]?_0xe01cf9[_0x40b9('0x16')][_0x40b9('0x19')]||null:null})[_0x40b9('0xd')](function(_0x480b22){logger[_0x40b9('0x1a')](_0x40b9('0x1b'),_0xe01cf9);logger[_0x40b9('0xf')](_0x40b9('0x1b'),_0xe01cf9,JSON[_0x40b9('0x1c')](_0x480b22));_0x3f0598(_0x480b22);})[_0x40b9('0x1d')](function(_0x299921){logger[_0x40b9('0x11')](_0x40b9('0x1b'),_0x299921[_0x40b9('0x12')],_0xe01cf9);_0x4c3990(_0x4cd7b7['error'](0x1f4,_0x299921[_0x40b9('0x12')]));});});};exports[_0x40b9('0x1e')]=function(_0x480349){return new Promise(function(_0x4e2142,_0x157402){return db[_0x40b9('0x14')][_0x40b9('0x1f')]({'where':_0x480349[_0x40b9('0x16')]?_0x480349[_0x40b9('0x16')][_0x40b9('0x20')]||null:null})[_0x40b9('0xd')](function(_0x527a95){if(_0x527a95){return _0x527a95[_0x40b9('0x21')](_0x480349[_0x40b9('0x15')][_0x40b9('0x22')],_['omit'](_0x480349[_0x40b9('0x15')],['ids','id'])||{});}})[_0x40b9('0x23')](function(_0x14a30e){logger['info']('AddTags',_0x480349);logger[_0x40b9('0xf')](_0x40b9('0x24'),_0x480349,JSON[_0x40b9('0x1c')](_0x14a30e));_0x4e2142(_0x14a30e);})[_0x40b9('0x1d')](function(_0x3e916f){logger[_0x40b9('0x11')](_0x40b9('0x24'),_0x3e916f[_0x40b9('0x12')],_0x480349);_0x157402(_this[_0x40b9('0x11')](0x1f4,_0x3e916f[_0x40b9('0x12')]));});});}; \ No newline at end of file +var _0xf682=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./faxInteraction.socket','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','update','options','raw','where','attributes','limit','UpdateFaxInteraction','AddTagsToFaxInteraction','FaxInteraction','find','addTags','ids','omit','body','spread','AddTags','util','bluebird','randomstring'];(function(_0x2991d8,_0x3cd07f){var _0x2c1363=function(_0x596712){while(--_0x596712){_0x2991d8['push'](_0x2991d8['shift']());}};_0x2c1363(++_0x3cd07f);}(_0xf682,0xa5));var _0x2f68=function(_0x1d045c,_0x3497ef){_0x1d045c=_0x1d045c-0x0;var _0x52ce43=_0xf682[_0x1d045c];return _0x52ce43;};'use strict';var _=require('lodash');var util=require(_0x2f68('0x0'));var moment=require('moment');var BPromise=require(_0x2f68('0x1'));var rs=require(_0x2f68('0x2'));var fs=require('fs');var Redis=require(_0x2f68('0x3'));var db=require(_0x2f68('0x4'))['db'];var utils=require(_0x2f68('0x5'));var logger=require(_0x2f68('0x6'))(_0x2f68('0x7'));var config=require(_0x2f68('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2f68('0x9')][_0x2f68('0xa')]({'port':0x232a});config[_0x2f68('0xb')]=_[_0x2f68('0xc')](config[_0x2f68('0xb')],{'host':_0x2f68('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2f68('0xe'))['register'](socket);function respondWithRpcPromise(_0x564669,_0x3ad57c,_0x2333ef){return new BPromise(function(_0x3d2986,_0x5a16a9){return client[_0x2f68('0xf')](_0x564669,_0x2333ef)[_0x2f68('0x10')](function(_0x5ea673){logger[_0x2f68('0x11')](_0x2f68('0x12'),_0x3ad57c,_0x2f68('0x13'));logger[_0x2f68('0x14')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x3ad57c,_0x2f68('0x13'),JSON[_0x2f68('0x15')](_0x5ea673));if(_0x5ea673['error']){if(_0x5ea673[_0x2f68('0x16')][_0x2f68('0x17')]===0x1f4){logger[_0x2f68('0x16')](_0x2f68('0x12'),_0x3ad57c,_0x5ea673['error'][_0x2f68('0x18')]);return _0x5a16a9(_0x5ea673[_0x2f68('0x16')][_0x2f68('0x18')]);}logger['error']('FaxInteraction,\x20%s,\x20%s',_0x3ad57c,_0x5ea673[_0x2f68('0x16')][_0x2f68('0x18')]);return _0x3d2986(_0x5ea673[_0x2f68('0x16')][_0x2f68('0x18')]);}else{logger[_0x2f68('0x11')](_0x2f68('0x12'),_0x3ad57c,_0x2f68('0x13'));_0x3d2986(_0x5ea673['result'][_0x2f68('0x18')]);}})[_0x2f68('0x19')](function(_0x553fd7){logger[_0x2f68('0x16')](_0x2f68('0x12'),_0x3ad57c,_0x553fd7);_0x5a16a9(_0x553fd7);});});}exports['UpdateFaxInteraction']=function(_0x10bb6b){var _0x18aaa8=this;return new Promise(function(_0x5b8d95,_0x28562e){return db['FaxInteraction'][_0x2f68('0x1a')](_0x10bb6b['body'],{'raw':_0x10bb6b[_0x2f68('0x1b')]?_0x10bb6b[_0x2f68('0x1b')][_0x2f68('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10bb6b[_0x2f68('0x1b')]?_0x10bb6b['options'][_0x2f68('0x1d')]||null:null,'attributes':_0x10bb6b[_0x2f68('0x1b')]?_0x10bb6b[_0x2f68('0x1b')][_0x2f68('0x1e')]||null:null,'limit':_0x10bb6b[_0x2f68('0x1b')]?_0x10bb6b[_0x2f68('0x1b')][_0x2f68('0x1f')]||null:null})[_0x2f68('0x10')](function(_0x2f3566){logger[_0x2f68('0x11')](_0x2f68('0x20'),_0x10bb6b);logger[_0x2f68('0x14')](_0x2f68('0x20'),_0x10bb6b,JSON[_0x2f68('0x15')](_0x2f3566));_0x5b8d95(_0x2f3566);})[_0x2f68('0x19')](function(_0x296772){logger[_0x2f68('0x16')]('UpdateFaxInteraction',_0x296772[_0x2f68('0x18')],_0x10bb6b);_0x28562e(_0x18aaa8['error'](0x1f4,_0x296772[_0x2f68('0x18')]));});});};exports[_0x2f68('0x21')]=function(_0x55d6fc){return new Promise(function(_0x4c5316,_0x13d94c){return db[_0x2f68('0x22')][_0x2f68('0x23')]({'where':_0x55d6fc[_0x2f68('0x1b')]?_0x55d6fc[_0x2f68('0x1b')]['where']||null:null})['then'](function(_0x431461){if(_0x431461){return _0x431461[_0x2f68('0x24')](_0x55d6fc['body'][_0x2f68('0x25')],_[_0x2f68('0x26')](_0x55d6fc[_0x2f68('0x27')],['ids','id'])||{});}})[_0x2f68('0x28')](function(_0x40375c){logger['info'](_0x2f68('0x29'),_0x55d6fc);logger[_0x2f68('0x14')](_0x2f68('0x29'),_0x55d6fc,JSON[_0x2f68('0x15')](_0x40375c));_0x4c5316(_0x40375c);})['catch'](function(_0x4b34dd){logger[_0x2f68('0x16')](_0x2f68('0x29'),_0x4b34dd[_0x2f68('0x18')],_0x55d6fc);_0x13d94c(_this[_0x2f68('0x16')](0x1f4,_0x4b34dd['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 7f0e392..4e3edab 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 _0xef6a=['faxInteraction:','./faxInteraction.events','emit','removeListener','register','length'];(function(_0x3c9acc,_0x5482b5){var _0x55b5b9=function(_0x2965d0){while(--_0x2965d0){_0x3c9acc['push'](_0x3c9acc['shift']());}};_0x55b5b9(++_0x5482b5);}(_0xef6a,0xbb));var _0xaef6=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xef6a[_0x53ccf2];return _0x5a2964;};'use strict';var FaxInteractionEvents=require(_0xaef6('0x0'));var events=['save','remove','update'];function createListener(_0x19e2c6,_0x38a1be){return function(_0x14a067){_0x38a1be[_0xaef6('0x1')](_0x19e2c6,_0x14a067);};}function removeListener(_0x28ab96,_0x47ab68){return function(){FaxInteractionEvents[_0xaef6('0x2')](_0x28ab96,_0x47ab68);};}exports[_0xaef6('0x3')]=function(_0x1b7528){for(var _0x241ab2=0x0,_0xa1dcc=events[_0xaef6('0x4')];_0x241ab2<_0xa1dcc;_0x241ab2++){var _0x2f821a=events[_0x241ab2];var _0x36569a=createListener(_0xaef6('0x5')+_0x2f821a,_0x1b7528);FaxInteractionEvents['on'](_0x2f821a,_0x36569a);}}; \ No newline at end of file +var _0xfc42=['faxInteraction:','remove','emit','removeListener'];(function(_0x478c8a,_0x9afc92){var _0x3b6b3e=function(_0x37634e){while(--_0x37634e){_0x478c8a['push'](_0x478c8a['shift']());}};_0x3b6b3e(++_0x9afc92);}(_0xfc42,0x199));var _0x2fc4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfc42[_0x20a584];return _0x4b41a8;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save',_0x2fc4('0x0'),'update'];function createListener(_0x5e03ca,_0x2b10bb){return function(_0x37c67d){_0x2b10bb[_0x2fc4('0x1')](_0x5e03ca,_0x37c67d);};}function removeListener(_0x24bc9b,_0x988ea0){return function(){FaxInteractionEvents[_0x2fc4('0x2')](_0x24bc9b,_0x988ea0);};}exports['register']=function(_0x501a66){for(var _0x477fd4=0x0,_0x5711a8=events['length'];_0x477fd4<_0x5711a8;_0x477fd4++){var _0x3f0568=events[_0x477fd4];var _0x41b9a4=createListener(_0x2fc4('0x3')+_0x3f0568,_0x501a66);FaxInteractionEvents['on'](_0x3f0568,_0x41b9a4);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index a3a453e..2e26368 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 _0x8811=['/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','faxinteraction:addtags','put','/:id','fax','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','isAuthenticated','index','get','/describe','show'];(function(_0x4bab23,_0x252745){var _0xc1776e=function(_0x59c760){while(--_0x59c760){_0x4bab23['push'](_0x4bab23['shift']());}};_0xc1776e(++_0x252745);}(_0x8811,0x73));var _0x1881=function(_0x563104,_0x351039){_0x563104=_0x563104-0x0;var _0x5638cd=_0x8811[_0x563104];return _0x5638cd;};'use strict';var multer=require(_0x1881('0x0'));var util=require(_0x1881('0x1'));var path=require(_0x1881('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1881('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1881('0x4'));var interaction=require(_0x1881('0x5'));var config=require(_0x1881('0x6'));var controller=require(_0x1881('0x7'));router['get']('/',auth[_0x1881('0x8')](),controller[_0x1881('0x9')]);router[_0x1881('0xa')](_0x1881('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x1881('0xa')]('/:id',auth[_0x1881('0x8')](),controller[_0x1881('0xc')]);router[_0x1881('0xa')](_0x1881('0xd'),auth[_0x1881('0x8')](),controller[_0x1881('0xe')]);router[_0x1881('0xa')](_0x1881('0xf'),auth[_0x1881('0x8')](),controller[_0x1881('0x10')]);router['post']('/',auth[_0x1881('0x8')](),controller[_0x1881('0x11')]);router[_0x1881('0x12')](_0x1881('0xd'),auth[_0x1881('0x8')](),controller[_0x1881('0x13')]);router[_0x1881('0x12')](_0x1881('0x14'),auth[_0x1881('0x8')](),interaction[_0x1881('0x15')]('fax',_0x1881('0x16')),controller['addTags']);router[_0x1881('0x17')](_0x1881('0x18'),auth[_0x1881('0x8')](),interaction[_0x1881('0x15')](_0x1881('0x19'),'faxinteraction:update'),controller[_0x1881('0x1a')]);router[_0x1881('0x1b')]('/:id',auth[_0x1881('0x8')](),interaction[_0x1881('0x15')](_0x1881('0x19'),_0x1881('0x1c')),controller[_0x1881('0x1d')]);router[_0x1881('0x1b')](_0x1881('0x14'),auth[_0x1881('0x8')](),controller[_0x1881('0x1e')]);module[_0x1881('0x1f')]=router; \ No newline at end of file +var _0x6935=['/describe','describe','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','faxinteraction:addtags','put','/:id','tracked','delete','fax','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','isAuthenticated','index','get'];(function(_0x59118c,_0x440948){var _0x3b5f36=function(_0x4b74c5){while(--_0x4b74c5){_0x59118c['push'](_0x59118c['shift']());}};_0x3b5f36(++_0x440948);}(_0x6935,0x1c5));var _0x5693=function(_0x96198e,_0x49070b){_0x96198e=_0x96198e-0x0;var _0x564cb6=_0x6935[_0x96198e];return _0x564cb6;};'use strict';var multer=require(_0x5693('0x0'));var util=require(_0x5693('0x1'));var path=require(_0x5693('0x2'));var timeout=require(_0x5693('0x3'));var express=require('express');var router=express[_0x5693('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5693('0x5'));var interaction=require(_0x5693('0x6'));var config=require(_0x5693('0x7'));var controller=require(_0x5693('0x8'));router['get']('/',auth[_0x5693('0x9')](),controller[_0x5693('0xa')]);router[_0x5693('0xb')](_0x5693('0xc'),auth[_0x5693('0x9')](),controller[_0x5693('0xd')]);router['get']('/:id',auth[_0x5693('0x9')](),controller['show']);router[_0x5693('0xb')](_0x5693('0xe'),auth[_0x5693('0x9')](),controller[_0x5693('0xf')]);router[_0x5693('0xb')](_0x5693('0x10'),auth[_0x5693('0x9')](),controller['download']);router[_0x5693('0x11')]('/',auth[_0x5693('0x9')](),controller[_0x5693('0x12')]);router['post'](_0x5693('0xe'),auth[_0x5693('0x9')](),controller[_0x5693('0x13')]);router[_0x5693('0x11')](_0x5693('0x14'),auth['isAuthenticated'](),interaction['tracked']('fax',_0x5693('0x15')),controller['addTags']);router[_0x5693('0x16')](_0x5693('0x17'),auth[_0x5693('0x9')](),interaction[_0x5693('0x18')]('fax','faxinteraction:update'),controller['update']);router[_0x5693('0x19')](_0x5693('0x17'),auth[_0x5693('0x9')](),interaction[_0x5693('0x18')](_0x5693('0x1a'),_0x5693('0x1b')),controller[_0x5693('0x1c')]);router[_0x5693('0x19')](_0x5693('0x14'),auth['isAuthenticated'](),controller[_0x5693('0x1d')]);module[_0x5693('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 589c258..0b59a84 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 _0xd52a=['medium','BOOLEAN','ENUM','out','TEXT','DATE','exports'];(function(_0x518b4f,_0x22ae83){var _0x4d454d=function(_0x437a14){while(--_0x437a14){_0x518b4f['push'](_0x518b4f['shift']());}};_0x4d454d(++_0x22ae83);}(_0xd52a,0xca));var _0xad52=function(_0xc4b8cb,_0x5da66f){_0xc4b8cb=_0xc4b8cb-0x0;var _0x3a37c1=_0xd52a[_0xc4b8cb];return _0x3a37c1;};'use strict';var Sequelize=require('sequelize');module[_0xad52('0x0')]={'body':{'type':Sequelize['TEXT'](_0xad52('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xad52('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xad52('0x3')]('in','out'),'defaultValue':_0xad52('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xad52('0x5')],'defaultValue':null},'readAt':{'type':Sequelize[_0xad52('0x6')]}}; \ No newline at end of file +var _0xc18a=['DATE','sequelize','exports','TEXT','medium','ENUM','out'];(function(_0x1b217b,_0x162f31){var _0x261bc7=function(_0x5a8010){while(--_0x5a8010){_0x1b217b['push'](_0x1b217b['shift']());}};_0x261bc7(++_0x162f31);}(_0xc18a,0x1cf));var _0xac18=function(_0x110cdc,_0x245a35){_0x110cdc=_0x110cdc-0x0;var _0x4ed9e7=_0xc18a[_0x110cdc];return _0x4ed9e7;};'use strict';var Sequelize=require(_0xac18('0x0'));module[_0xac18('0x1')]={'body':{'type':Sequelize[_0xac18('0x2')](_0xac18('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xac18('0x4')]('in',_0xac18('0x5')),'defaultValue':_0xac18('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xac18('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xac18('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 52a5a9a..6458974 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 _0x4834=['params','keys','find','body','catch','describe','fax-interactions','accept','fax','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','FaxInteraction','FaxInteractionId','read1stAt','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','rejectMessage','User','fullname','email','event','rejectmessage','create','findOne','ContactId','isNil','Attachment','SendFax','download','join','root','server','attachments','basename','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','FaxMessage','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','options','include','findAll','show'];(function(_0x5b8b2a,_0x4610d5){var _0x22ea6e=function(_0x39dfb5){while(--_0x39dfb5){_0x5b8b2a['push'](_0x5b8b2a['shift']());}};_0x22ea6e(++_0x4610d5);}(_0x4834,0xc6));var _0x4483=function(_0x2440ce,_0x3261ab){_0x2440ce=_0x2440ce-0x0;var _0x5938f6=_0x4834[_0x2440ce];return _0x5938f6;};'use strict';var emlformat=require(_0x4483('0x0'));var rimraf=require(_0x4483('0x1'));var zipdir=require(_0x4483('0x2'));var jsonpatch=require(_0x4483('0x3'));var rp=require(_0x4483('0x4'));var moment=require(_0x4483('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4483('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4483('0x7'));var csv=require('to-csv');var ejs=require(_0x4483('0x8'));var fs=require('fs');var fs_extra=require(_0x4483('0x9'));var _=require(_0x4483('0xa'));var squel=require(_0x4483('0xb'));var crypto=require(_0x4483('0xc'));var jsforce=require(_0x4483('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4483('0xe'));var querystring=require('querystring');var Papa=require(_0x4483('0xf'));var Redis=require(_0x4483('0x10'));var authService=require(_0x4483('0x11'));var qs=require(_0x4483('0x12'));var as=require(_0x4483('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4483('0x14'))(_0x4483('0x15'));var utils=require(_0x4483('0x16'));var config=require(_0x4483('0x17'));var licenseUtil=require(_0x4483('0x18'));var db=require('../../mysqldb')['db'];config[_0x4483('0x19')]=_['defaults'](config[_0x4483('0x19')],{'host':_0x4483('0x1a'),'port':0x18eb});var socket=require(_0x4483('0x1b'))(new Redis(config[_0x4483('0x19')]));require(_0x4483('0x1c'))[_0x4483('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4483('0x1e')][_0x4483('0x1f')]({'port':0x232c});var client9002=jayson[_0x4483('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bc471,_0x206d01,_0x3831d2,_0x5636c7){return new BPromise(function(_0x273707,_0x3a2a8d){var _0x1b5b86=_0x5636c7||client;return _0x1b5b86[_0x4483('0x20')](_0x1bc471,_0x3831d2)[_0x4483('0x21')](function(_0x34e17e){logger[_0x4483('0x22')](_0x4483('0x23'),_0x206d01,_0x4483('0x24'));logger[_0x4483('0x25')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x206d01,_0x4483('0x24'),JSON['stringify'](_0x34e17e));if(_0x34e17e['error']){if(_0x34e17e[_0x4483('0x26')][_0x4483('0x27')]===0x1f4){logger['error'](_0x4483('0x23'),_0x206d01,_0x34e17e[_0x4483('0x26')][_0x4483('0x28')]);return _0x3a2a8d(_0x34e17e[_0x4483('0x26')][_0x4483('0x28')]);}logger[_0x4483('0x26')](_0x4483('0x23'),_0x206d01,_0x34e17e['error'][_0x4483('0x28')]);return _0x273707(_0x34e17e[_0x4483('0x26')][_0x4483('0x28')]);}else{logger[_0x4483('0x22')](_0x4483('0x23'),_0x206d01,'request\x20sent');_0x273707(_0x34e17e[_0x4483('0x29')][_0x4483('0x28')]);}})['catch'](function(_0x28c879){logger['error']('FaxMessage,\x20%s,\x20%s',_0x206d01,_0x28c879);_0x3a2a8d(_0x28c879);});});}function respondWithStatusCode(_0x32b9be,_0x46f442){_0x46f442=_0x46f442||0xcc;return function(_0x347f88){if(_0x347f88){return _0x32b9be[_0x4483('0x2a')](_0x46f442);}return _0x32b9be[_0x4483('0x2b')](_0x46f442)[_0x4483('0x2c')]();};}function respondWithResult(_0x583e94,_0x3547c9){_0x3547c9=_0x3547c9||0xc8;return function(_0xb329fa){if(_0xb329fa){return _0x583e94[_0x4483('0x2b')](_0x3547c9)[_0x4483('0x2d')](_0xb329fa);}};}function respondWithFilteredResult(_0x1b7fb1,_0x36e497){return function(_0x588357){if(_0x588357){var _0xf630b8=typeof _0x36e497['offset']===_0x4483('0x2e')&&typeof _0x36e497['limit']===_0x4483('0x2e');var _0x459a8a=_0x588357[_0x4483('0x2f')];var _0x15c703=_0xf630b8?0x0:_0x36e497[_0x4483('0x30')];var _0x5c4fcc=_0xf630b8?_0x588357[_0x4483('0x2f')]:_0x36e497[_0x4483('0x30')]+_0x36e497['limit'];var _0x4a9fe7;if(_0x5c4fcc>=_0x459a8a){_0x5c4fcc=_0x459a8a;_0x4a9fe7=0xc8;}else{_0x4a9fe7=0xce;}_0x1b7fb1[_0x4483('0x2b')](_0x4a9fe7);return _0x1b7fb1[_0x4483('0x31')](_0x4483('0x32'),_0x15c703+'-'+_0x5c4fcc+'/'+_0x459a8a)[_0x4483('0x2d')](_0x588357);}return null;};}function patchUpdates(_0x28ec7c){return function(_0x9c9d23){try{jsonpatch[_0x4483('0x33')](_0x9c9d23,_0x28ec7c,!![]);}catch(_0x5ef8c5){return BPromise[_0x4483('0x34')](_0x5ef8c5);}return _0x9c9d23[_0x4483('0x35')]();};}function saveUpdates(_0x282c59,_0xc99b5){return function(_0x1b2e03){if(_0x1b2e03){return _0x1b2e03[_0x4483('0x36')](_0x282c59)[_0x4483('0x21')](function(_0x41fda3){return _0x41fda3;});}return null;};}function removeEntity(_0x3c883a,_0x280e23){return function(_0x458f37){if(_0x458f37){return _0x458f37[_0x4483('0x37')]()['then'](function(){_0x3c883a['status'](0xcc)[_0x4483('0x2c')]();});}};}function handleEntityNotFound(_0x17d10b,_0x5738a9){return function(_0x36fed2){if(!_0x36fed2){_0x17d10b[_0x4483('0x2a')](0x194);}return _0x36fed2;};}function handleError(_0x4b7138,_0x208093){_0x208093=_0x208093||0x1f4;return function(_0x322987){logger[_0x4483('0x26')](_0x322987[_0x4483('0x38')]);if(_0x322987['name']){delete _0x322987[_0x4483('0x39')];}_0x4b7138['status'](_0x208093)[_0x4483('0x3a')](_0x322987);};}exports[_0x4483('0x3b')]=function(_0x2d0604,_0x1ef41c){var _0x4be5d8={},_0x564216={},_0x434db2={'count':0x0,'rows':[]};var _0x9fb4b9=_['map'](db[_0x4483('0x3c')][_0x4483('0x3d')],function(_0x378599){return{'name':_0x378599[_0x4483('0x3e')],'type':_0x378599[_0x4483('0x3f')][_0x4483('0x40')]};});_0x564216[_0x4483('0x41')]=_[_0x4483('0x42')](_0x9fb4b9,_0x4483('0x39'));_0x564216[_0x4483('0x43')]=_['keys'](_0x2d0604['query']);_0x564216[_0x4483('0x44')]=_[_0x4483('0x45')](_0x564216[_0x4483('0x41')],_0x564216[_0x4483('0x43')]);_0x4be5d8[_0x4483('0x46')]=_[_0x4483('0x45')](_0x564216[_0x4483('0x41')],qs[_0x4483('0x47')](_0x2d0604[_0x4483('0x43')]['fields']));_0x4be5d8[_0x4483('0x46')]=_0x4be5d8[_0x4483('0x46')][_0x4483('0x48')]?_0x4be5d8['attributes']:_0x564216[_0x4483('0x41')];if(!_0x2d0604['query'][_0x4483('0x49')](_0x4483('0x4a'))){_0x4be5d8['limit']=qs[_0x4483('0x4b')](_0x2d0604[_0x4483('0x43')][_0x4483('0x4b')]);_0x4be5d8[_0x4483('0x30')]=qs['offset'](_0x2d0604[_0x4483('0x43')][_0x4483('0x30')]);}_0x4be5d8[_0x4483('0x4c')]=qs['sort'](_0x2d0604[_0x4483('0x43')][_0x4483('0x4d')]);_0x4be5d8['where']=qs['filters'](_[_0x4483('0x4e')](_0x2d0604[_0x4483('0x43')],_0x564216['filters']),_0x9fb4b9);if(_0x2d0604[_0x4483('0x43')][_0x4483('0x4f')]){_0x4be5d8[_0x4483('0x50')]=_['merge'](_0x4be5d8[_0x4483('0x50')],{'$or':_[_0x4483('0x42')](_0x9fb4b9,function(_0x5ac55f){if(_0x5ac55f['type']!=='VIRTUAL'){var _0xfd3135={};_0xfd3135[_0x5ac55f[_0x4483('0x39')]]={'$like':'%'+_0x2d0604[_0x4483('0x43')][_0x4483('0x4f')]+'%'};return _0xfd3135;}})});}_0x4be5d8=_[_0x4483('0x51')]({},_0x4be5d8,_0x2d0604[_0x4483('0x52')]);var _0xc3c30={'where':_0x4be5d8[_0x4483('0x50')]};return db['FaxMessage'][_0x4483('0x2f')](_0xc3c30)[_0x4483('0x21')](function(_0x3ab061){_0x434db2[_0x4483('0x2f')]=_0x3ab061;if(_0x2d0604['query']['includeAll']){_0x4be5d8[_0x4483('0x53')]=[{'all':!![]}];}return db[_0x4483('0x3c')][_0x4483('0x54')](_0x4be5d8);})['then'](function(_0x4572a3){_0x434db2['rows']=_0x4572a3;return _0x434db2;})['then'](respondWithFilteredResult(_0x1ef41c,_0x4be5d8))['catch'](handleError(_0x1ef41c,null));};exports[_0x4483('0x55')]=function(_0x23b7a1,_0x17ca72){var _0x237924={'raw':!![],'where':{'id':_0x23b7a1[_0x4483('0x56')]['id']}},_0x52dfef={};_0x52dfef[_0x4483('0x41')]=_[_0x4483('0x57')](db[_0x4483('0x3c')][_0x4483('0x3d')]);_0x52dfef['query']=_[_0x4483('0x57')](_0x23b7a1[_0x4483('0x43')]);_0x52dfef[_0x4483('0x44')]=_[_0x4483('0x45')](_0x52dfef[_0x4483('0x41')],_0x52dfef[_0x4483('0x43')]);_0x237924['attributes']=_[_0x4483('0x45')](_0x52dfef[_0x4483('0x41')],qs['fields'](_0x23b7a1['query']['fields']));_0x237924['attributes']=_0x237924[_0x4483('0x46')][_0x4483('0x48')]?_0x237924[_0x4483('0x46')]:_0x52dfef[_0x4483('0x41')];if(_0x23b7a1[_0x4483('0x43')]['includeAll']){_0x237924['include']=[{'all':!![]}];}_0x237924=_['merge']({},_0x237924,_0x23b7a1[_0x4483('0x52')]);return db['FaxMessage'][_0x4483('0x58')](_0x237924)[_0x4483('0x21')](handleEntityNotFound(_0x17ca72,null))[_0x4483('0x21')](respondWithResult(_0x17ca72,null))['catch'](handleError(_0x17ca72,null));};exports['update']=function(_0x53d43e,_0x4d63c4){if(_0x53d43e[_0x4483('0x59')]['id']){delete _0x53d43e['body']['id'];}return db[_0x4483('0x3c')][_0x4483('0x58')]({'where':{'id':_0x53d43e[_0x4483('0x56')]['id']}})[_0x4483('0x21')](handleEntityNotFound(_0x4d63c4,null))[_0x4483('0x21')](saveUpdates(_0x53d43e['body'],null))[_0x4483('0x21')](respondWithResult(_0x4d63c4,null))[_0x4483('0x5a')](handleError(_0x4d63c4,null));};exports[_0x4483('0x37')]=function(_0x1e86e0,_0x27fbf2){return db[_0x4483('0x3c')][_0x4483('0x58')]({'where':{'id':_0x1e86e0[_0x4483('0x56')]['id']}})[_0x4483('0x21')](handleEntityNotFound(_0x27fbf2,null))[_0x4483('0x21')](removeEntity(_0x27fbf2,null))[_0x4483('0x5a')](handleError(_0x27fbf2,null));};exports[_0x4483('0x5b')]=function(_0x2b607d,_0x36de87){return db[_0x4483('0x3c')][_0x4483('0x5b')]()['then'](respondWithResult(_0x36de87,null))[_0x4483('0x5a')](handleError(_0x36de87,null));};var interaction_log=require(_0x4483('0x14'))(_0x4483('0x5c'));exports[_0x4483('0x5d')]=function(_0x2d0db9,_0x1ae896,_0x1910df){var _0x309dfe={'agent':{},'channel':_0x4483('0x5e')};if(_0x2d0db9['body']['id']){delete _0x2d0db9[_0x4483('0x59')]['id'];}_0x2d0db9[_0x4483('0x59')]['read']=!![];_0x2d0db9['body']['readAt']=moment()[_0x4483('0x5f')](_0x4483('0x60'));_0x2d0db9[_0x4483('0x59')][_0x4483('0x61')]=_0x2d0db9['body'][_0x4483('0x61')]||_0x2d0db9[_0x4483('0x62')]['id'];_0x309dfe[_0x4483('0x63')]['id']=_0x2d0db9[_0x4483('0x59')][_0x4483('0x61')];return db[_0x4483('0x3c')][_0x4483('0x58')]({'where':{'id':_0x2d0db9['params']['id'],'UserId':null}})[_0x4483('0x21')](handleEntityNotFound(_0x1ae896,null))[_0x4483('0x21')](saveUpdates(_0x2d0db9[_0x4483('0x59')],null))[_0x4483('0x21')](function(_0x242271){if(_0x242271){_0x309dfe['message']=_0x242271['get']({'plain':!![]});return db[_0x4483('0x64')][_0x4483('0x58')]({'where':{'id':_0x242271[_0x4483('0x65')]}});}return null;})[_0x4483('0x21')](handleEntityNotFound(_0x1ae896,null))['then'](function(_0x734e59){if(_0x734e59){return _0x734e59['update']({'UserId':_0x2d0db9[_0x4483('0x59')]['UserId'],'read1stAt':_['isNil'](_0x734e59[_0x4483('0x66')])?moment()[_0x4483('0x5f')](_0x4483('0x60')):undefined});}return null;})[_0x4483('0x21')](function(_0x5da2a4){if(_0x5da2a4){_0x309dfe[_0x4483('0x67')]=_0x5da2a4[_0x4483('0x68')]({'plain':!![]});interaction_log[_0x4483('0x22')](_0x4483('0x69'),_0x2d0db9['user']['id'],_0x2d0db9['user']['name'],_0x2d0db9[_0x4483('0x62')][_0x4483('0x6a')],_0x309dfe[_0x4483('0x67')]['id'],_0x2d0db9['body']?JSON['stringify'](_0x2d0db9[_0x4483('0x59')]):'null');return respondWithRpcPromise(_0x4483('0x6b'),'acceptMessage',_0x309dfe);}return null;})['then'](function(_0x9bd9c6){var _0x245a71=_0x4483('0x6c')+_0x9bd9c6[_0x4483('0x28')]['ContactId'];return db[_0x4483('0x6d')][_0x4483('0x43')](_0x245a71,{'type':db[_0x4483('0x6e')][_0x4483('0x6f')][_0x4483('0x70')],'raw':!![]})['then'](function(_0x587e0b){return _0x587e0b;});})[_0x4483('0x21')](function(_0x113934){if(_0x113934){_0x309dfe['message'][_0x4483('0x71')]=_0x113934[0x0];if(!_0x2d0db9[_0x4483('0x59')][_0x4483('0x61')])return;return db['User'][_0x4483('0x58')]({'where':{'id':_0x2d0db9[_0x4483('0x59')][_0x4483('0x61')],'role':_0x4483('0x63')},'attributes':['id',_0x4483('0x39'),'fullname','email',_0x4483('0x72')],'raw':!![]});}return null;})[_0x4483('0x21')](function(_0x469617){if(!_0x469617)return null;_0x309dfe['message'][_0x4483('0x63')]=_0x469617;return _0x309dfe;})[_0x4483('0x21')](function(_0x19873f){if(_0x19873f){if(_0x2d0db9[_0x4483('0x59')][_0x4483('0x73')]){_0x309dfe[_0x4483('0x28')][_0x4483('0x74')]=util[_0x4483('0x5f')](_0x4483('0x75'),_0x2d0db9[_0x4483('0x62')]['name']);_0x309dfe[_0x4483('0x28')][_0x4483('0x76')]=_0x309dfe['channel'];_0x309dfe['message'][_0x4483('0x77')]=_0x309dfe[_0x4483('0x76')];_0x309dfe[_0x4483('0x28')]['event']=_0x4483('0x5d');return respondWithRpcPromise(_0x4483('0x78'),_0x4483('0x78'),{'event':'acceptmessage','message':_0x309dfe[_0x4483('0x28')]},client9002)[_0x4483('0x21')](function(){return _0x309dfe;});}return _0x309dfe;}return null;})['then'](respondWithResult(_0x1ae896,null))[_0x4483('0x5a')](handleError(_0x1ae896,null));};var interaction_log=require(_0x4483('0x14'))(_0x4483('0x5c'));exports[_0x4483('0x34')]=function(_0x56d6a1,_0xcf9e32,_0x364536){var _0x41f9d3={'agent':{},'channel':_0x4483('0x5e')};if(_0x56d6a1[_0x4483('0x59')]['id']){delete _0x56d6a1[_0x4483('0x59')]['id'];}_0x56d6a1[_0x4483('0x59')][_0x4483('0x61')]=_0x56d6a1[_0x4483('0x59')][_0x4483('0x61')]||_0x56d6a1[_0x4483('0x62')]['id'];_0x41f9d3[_0x4483('0x63')]['id']=_0x56d6a1[_0x4483('0x59')][_0x4483('0x61')];return db[_0x4483('0x3c')][_0x4483('0x58')]({'where':{'id':_0x56d6a1['params']['id'],'UserId':null}})[_0x4483('0x21')](handleEntityNotFound(_0xcf9e32,null))[_0x4483('0x21')](function(_0x353c3e){if(_0x353c3e){_0x41f9d3[_0x4483('0x28')]=_0x353c3e[_0x4483('0x68')]({'plain':!![]});return db[_0x4483('0x64')][_0x4483('0x58')]({'where':{'id':_0x353c3e[_0x4483('0x65')]}});}return null;})[_0x4483('0x21')](handleEntityNotFound(_0xcf9e32,null))[_0x4483('0x21')](function(_0x3d9349){if(_0x3d9349){_0x41f9d3[_0x4483('0x67')]=_0x3d9349[_0x4483('0x68')]({'plain':!![]});interaction_log['info'](_0x4483('0x79'),_0x56d6a1[_0x4483('0x62')]['id'],_0x56d6a1[_0x4483('0x62')][_0x4483('0x39')],_0x56d6a1[_0x4483('0x62')][_0x4483('0x6a')],_0x41f9d3['interaction']['id'],_0x56d6a1[_0x4483('0x59')]?JSON[_0x4483('0x7a')](_0x56d6a1[_0x4483('0x59')]):_0x4483('0x7b'));return respondWithRpcPromise('RejectMessage',_0x4483('0x7c'),_0x41f9d3);}return null;})[_0x4483('0x21')](function(_0x9cf131){var _0x2a511e=_0x4483('0x6c')+_0x9cf131[_0x4483('0x28')]['ContactId'];return db[_0x4483('0x6d')][_0x4483('0x43')](_0x2a511e,{'type':db['Sequelize'][_0x4483('0x6f')]['SELECT'],'raw':!![]})[_0x4483('0x21')](function(_0x18e8f6){return _0x18e8f6;});})[_0x4483('0x21')](function(_0x1e25c8){if(_0x1e25c8){_0x41f9d3[_0x4483('0x28')][_0x4483('0x71')]=_0x1e25c8[0x0];if(!_0x56d6a1[_0x4483('0x59')][_0x4483('0x61')])return;return db[_0x4483('0x7d')][_0x4483('0x58')]({'where':{'id':_0x56d6a1[_0x4483('0x59')][_0x4483('0x61')],'role':'agent'},'attributes':['id',_0x4483('0x39'),_0x4483('0x7e'),_0x4483('0x7f'),_0x4483('0x72')],'raw':!![]});}return null;})[_0x4483('0x21')](function(_0xb63901){if(!_0xb63901)return null;_0x41f9d3[_0x4483('0x28')][_0x4483('0x63')]=_0xb63901;return _0x41f9d3;})[_0x4483('0x21')](function(_0x5ca062){if(_0x5ca062){_0x5ca062['message']['interface']=util[_0x4483('0x5f')](_0x4483('0x75'),_0x56d6a1['user'][_0x4483('0x39')]);_0x5ca062['message'][_0x4483('0x76')]=_0x41f9d3[_0x4483('0x76')];_0x5ca062[_0x4483('0x28')][_0x4483('0x77')]=_0x41f9d3['channel'];_0x5ca062[_0x4483('0x28')][_0x4483('0x80')]=_0x4483('0x34');respondWithRpcPromise('EventManager','EventManager',{'event':_0x4483('0x81'),'message':_0x5ca062[_0x4483('0x28')]},client9002);return _0x41f9d3;}return null;})[_0x4483('0x21')](respondWithResult(_0xcf9e32,null))[_0x4483('0x5a')](handleError(_0xcf9e32,null));};exports[_0x4483('0x82')]=function(_0x88a7f5,_0x37219c){var _0x4d559d;return db[_0x4483('0x3c')]['create'](_0x88a7f5[_0x4483('0x59')],{})[_0x4483('0x21')](function(_0x195cbb){_0x4d559d=_0x195cbb;return db['CmContact'][_0x4483('0x83')]({'where':{'id':_0x4d559d[_0x4483('0x84')]}});})[_0x4483('0x21')](function(_0x4f8c64){if(_[_0x4483('0x85')](_0x4f8c64)){return;}else{_0x4d559d[_0x4483('0x5e')]=_0x4f8c64[_0x4483('0x5e')];return db[_0x4483('0x86')][_0x4483('0x83')]({'where':{'id':_0x4d559d['AttachmentId']}});}})[_0x4483('0x21')](function(_0x490795){return respondWithRpcPromise(_0x4483('0x87'),_0x4483('0x87'),{'FaxAccountId':_[_0x4483('0x85')](_0x88a7f5[_0x4483('0x59')])?undefined:_0x88a7f5['body']['FaxAccountId'],'path':_['isNil'](_0x490795)?undefined:util[_0x4483('0x5f')]('/var/opt/motion2/server/files/attachments/%s',_0x490795['basename']),'fax':_[_0x4483('0x85')](_0x4d559d[_0x4483('0x5e')])?undefined:_0x4d559d['fax'],'AttachmentId':_0x4d559d['AttachmentId']},client9002);})['then'](respondWithResult(_0x37219c,0xc9))[_0x4483('0x5a')](handleError(_0x37219c,null));};exports[_0x4483('0x88')]=function(_0x2674ce,_0x2ae969){var _0x1b4e5f=path[_0x4483('0x89')](config[_0x4483('0x8a')],_0x4483('0x8b'),'files',_0x4483('0x8c'));return db['FaxMessage'][_0x4483('0x58')]({'where':{'id':_0x2674ce[_0x4483('0x56')]['id']},'include':[{'model':db['Attachment'],'as':_0x4483('0x86')}]})[_0x4483('0x21')](handleEntityNotFound(_0x2ae969,null))['then'](function(_0x17fe48){if(_0x17fe48){return _0x2ae969['download'](path['join'](_0x1b4e5f,_0x17fe48['Attachment'][_0x4483('0x8d')]));}})[_0x4483('0x5a')](handleError(_0x2ae969,null));}; \ No newline at end of file +var _0x3134=['to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','show','params','body','find','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','update','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','RejectMessage','rejectMessage','SELECT','User','rejectmessage','create','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','join','root','attachments','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path'];(function(_0x35bb1c,_0x2a7365){var _0x1a29cd=function(_0x6a314c){while(--_0x6a314c){_0x35bb1c['push'](_0x35bb1c['shift']());}};_0x1a29cd(++_0x2a7365);}(_0x3134,0x1b0));var _0x4313=function(_0x3d8dcc,_0x3b5fc5){_0x3d8dcc=_0x3d8dcc-0x0;var _0xc6c107=_0x3134[_0x3d8dcc];return _0xc6c107;};'use strict';var emlformat=require(_0x4313('0x0'));var rimraf=require(_0x4313('0x1'));var zipdir=require(_0x4313('0x2'));var jsonpatch=require(_0x4313('0x3'));var rp=require(_0x4313('0x4'));var moment=require(_0x4313('0x5'));var BPromise=require(_0x4313('0x6'));var Mustache=require(_0x4313('0x7'));var util=require('util');var path=require(_0x4313('0x8'));var sox=require('sox');var csv=require(_0x4313('0x9'));var ejs=require(_0x4313('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4313('0xb'));var squel=require(_0x4313('0xc'));var crypto=require(_0x4313('0xd'));var jsforce=require(_0x4313('0xe'));var deskjs=require(_0x4313('0xf'));var toCsv=require(_0x4313('0x9'));var querystring=require(_0x4313('0x10'));var Papa=require(_0x4313('0x11'));var Redis=require(_0x4313('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4313('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4313('0x14'));var logger=require(_0x4313('0x15'))(_0x4313('0x16'));var utils=require('../../config/utils');var config=require(_0x4313('0x17'));var licenseUtil=require(_0x4313('0x18'));var db=require(_0x4313('0x19'))['db'];config[_0x4313('0x1a')]=_['defaults'](config[_0x4313('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x4313('0x1b'))(new Redis(config[_0x4313('0x1a')]));require(_0x4313('0x1c'))[_0x4313('0x1d')](socket);var jayson=require(_0x4313('0x1e'));var client=jayson[_0x4313('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x4313('0x1f')][_0x4313('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x282f98,_0x5bb7d2,_0x3e94ae,_0x2382f1){return new BPromise(function(_0x6e4f9b,_0x11c95f){var _0x30dd06=_0x2382f1||client;return _0x30dd06[_0x4313('0x21')](_0x282f98,_0x3e94ae)['then'](function(_0x5857c3){logger[_0x4313('0x22')](_0x4313('0x23'),_0x5bb7d2,_0x4313('0x24'));logger[_0x4313('0x25')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x5bb7d2,'request\x20sent',JSON[_0x4313('0x26')](_0x5857c3));if(_0x5857c3['error']){if(_0x5857c3[_0x4313('0x27')][_0x4313('0x28')]===0x1f4){logger[_0x4313('0x27')]('FaxMessage,\x20%s,\x20%s',_0x5bb7d2,_0x5857c3[_0x4313('0x27')]['message']);return _0x11c95f(_0x5857c3[_0x4313('0x27')][_0x4313('0x29')]);}logger[_0x4313('0x27')](_0x4313('0x23'),_0x5bb7d2,_0x5857c3['error'][_0x4313('0x29')]);return _0x6e4f9b(_0x5857c3[_0x4313('0x27')]['message']);}else{logger[_0x4313('0x22')]('FaxMessage,\x20%s,\x20%s',_0x5bb7d2,_0x4313('0x24'));_0x6e4f9b(_0x5857c3[_0x4313('0x2a')][_0x4313('0x29')]);}})[_0x4313('0x2b')](function(_0x301790){logger[_0x4313('0x27')](_0x4313('0x23'),_0x5bb7d2,_0x301790);_0x11c95f(_0x301790);});});}function respondWithStatusCode(_0x1e551d,_0x34d64){_0x34d64=_0x34d64||0xcc;return function(_0x59864b){if(_0x59864b){return _0x1e551d[_0x4313('0x2c')](_0x34d64);}return _0x1e551d['status'](_0x34d64)[_0x4313('0x2d')]();};}function respondWithResult(_0x779c33,_0x3bd38a){_0x3bd38a=_0x3bd38a||0xc8;return function(_0x1625ea){if(_0x1625ea){return _0x779c33[_0x4313('0x2e')](_0x3bd38a)[_0x4313('0x2f')](_0x1625ea);}};}function respondWithFilteredResult(_0x4b2d34,_0x434280){return function(_0x1b4de0){if(_0x1b4de0){var _0x4f5e78=typeof _0x434280[_0x4313('0x30')]===_0x4313('0x31')&&typeof _0x434280[_0x4313('0x32')]===_0x4313('0x31');var _0x2b0b9a=_0x1b4de0[_0x4313('0x33')];var _0x2f7b8f=_0x4f5e78?0x0:_0x434280[_0x4313('0x30')];var _0x35fed2=_0x4f5e78?_0x1b4de0[_0x4313('0x33')]:_0x434280[_0x4313('0x30')]+_0x434280[_0x4313('0x32')];var _0xbbfff5;if(_0x35fed2>=_0x2b0b9a){_0x35fed2=_0x2b0b9a;_0xbbfff5=0xc8;}else{_0xbbfff5=0xce;}_0x4b2d34[_0x4313('0x2e')](_0xbbfff5);return _0x4b2d34[_0x4313('0x34')](_0x4313('0x35'),_0x2f7b8f+'-'+_0x35fed2+'/'+_0x2b0b9a)['json'](_0x1b4de0);}return null;};}function patchUpdates(_0x1a239a){return function(_0x4b22d6){try{jsonpatch[_0x4313('0x36')](_0x4b22d6,_0x1a239a,!![]);}catch(_0xe4a7b6){return BPromise[_0x4313('0x37')](_0xe4a7b6);}return _0x4b22d6['save']();};}function saveUpdates(_0x29e82a,_0x22a715){return function(_0x299927){if(_0x299927){return _0x299927['update'](_0x29e82a)[_0x4313('0x38')](function(_0x552c04){return _0x552c04;});}return null;};}function removeEntity(_0x7e1ae4,_0x125a9a){return function(_0xb61139){if(_0xb61139){return _0xb61139[_0x4313('0x39')]()[_0x4313('0x38')](function(){_0x7e1ae4[_0x4313('0x2e')](0xcc)[_0x4313('0x2d')]();});}};}function handleEntityNotFound(_0x339369,_0x3d0c08){return function(_0x189a8a){if(!_0x189a8a){_0x339369[_0x4313('0x2c')](0x194);}return _0x189a8a;};}function handleError(_0x4c664e,_0xf6c219){_0xf6c219=_0xf6c219||0x1f4;return function(_0x1e1cdd){logger[_0x4313('0x27')](_0x1e1cdd['stack']);if(_0x1e1cdd[_0x4313('0x3a')]){delete _0x1e1cdd[_0x4313('0x3a')];}_0x4c664e[_0x4313('0x2e')](_0xf6c219)[_0x4313('0x3b')](_0x1e1cdd);};}exports[_0x4313('0x3c')]=function(_0x34c59e,_0x11d6a0){var _0x5af028={},_0x2a52aa={},_0x443f74={'count':0x0,'rows':[]};var _0x4a3970=_[_0x4313('0x3d')](db[_0x4313('0x3e')][_0x4313('0x3f')],function(_0x2c1291){return{'name':_0x2c1291[_0x4313('0x40')],'type':_0x2c1291[_0x4313('0x41')][_0x4313('0x42')]};});_0x2a52aa['model']=_[_0x4313('0x3d')](_0x4a3970,_0x4313('0x3a'));_0x2a52aa['query']=_[_0x4313('0x43')](_0x34c59e[_0x4313('0x44')]);_0x2a52aa[_0x4313('0x45')]=_[_0x4313('0x46')](_0x2a52aa[_0x4313('0x47')],_0x2a52aa[_0x4313('0x44')]);_0x5af028[_0x4313('0x48')]=_[_0x4313('0x46')](_0x2a52aa[_0x4313('0x47')],qs[_0x4313('0x49')](_0x34c59e[_0x4313('0x44')][_0x4313('0x49')]));_0x5af028['attributes']=_0x5af028[_0x4313('0x48')][_0x4313('0x4a')]?_0x5af028['attributes']:_0x2a52aa[_0x4313('0x47')];if(!_0x34c59e[_0x4313('0x44')]['hasOwnProperty'](_0x4313('0x4b'))){_0x5af028[_0x4313('0x32')]=qs['limit'](_0x34c59e['query'][_0x4313('0x32')]);_0x5af028[_0x4313('0x30')]=qs['offset'](_0x34c59e[_0x4313('0x44')][_0x4313('0x30')]);}_0x5af028[_0x4313('0x4c')]=qs[_0x4313('0x4d')](_0x34c59e[_0x4313('0x44')][_0x4313('0x4d')]);_0x5af028['where']=qs['filters'](_[_0x4313('0x4e')](_0x34c59e[_0x4313('0x44')],_0x2a52aa[_0x4313('0x45')]),_0x4a3970);if(_0x34c59e[_0x4313('0x44')]['filter']){_0x5af028[_0x4313('0x4f')]=_['merge'](_0x5af028[_0x4313('0x4f')],{'$or':_[_0x4313('0x3d')](_0x4a3970,function(_0x394aff){if(_0x394aff[_0x4313('0x41')]!==_0x4313('0x50')){var _0x2ff0b1={};_0x2ff0b1[_0x394aff[_0x4313('0x3a')]]={'$like':'%'+_0x34c59e[_0x4313('0x44')][_0x4313('0x51')]+'%'};return _0x2ff0b1;}})});}_0x5af028=_[_0x4313('0x52')]({},_0x5af028,_0x34c59e[_0x4313('0x53')]);var _0x3faca2={'where':_0x5af028[_0x4313('0x4f')]};return db[_0x4313('0x3e')]['count'](_0x3faca2)['then'](function(_0x5cb1d8){_0x443f74['count']=_0x5cb1d8;if(_0x34c59e['query'][_0x4313('0x54')]){_0x5af028[_0x4313('0x55')]=[{'all':!![]}];}return db[_0x4313('0x3e')][_0x4313('0x56')](_0x5af028);})[_0x4313('0x38')](function(_0x731ff0){_0x443f74['rows']=_0x731ff0;return _0x443f74;})[_0x4313('0x38')](respondWithFilteredResult(_0x11d6a0,_0x5af028))[_0x4313('0x2b')](handleError(_0x11d6a0,null));};exports[_0x4313('0x57')]=function(_0x1a4277,_0x2889ec){var _0x52a8c3={'raw':!![],'where':{'id':_0x1a4277[_0x4313('0x58')]['id']}},_0x3fdea1={};_0x3fdea1[_0x4313('0x47')]=_[_0x4313('0x43')](db[_0x4313('0x3e')]['rawAttributes']);_0x3fdea1['query']=_[_0x4313('0x43')](_0x1a4277['query']);_0x3fdea1[_0x4313('0x45')]=_[_0x4313('0x46')](_0x3fdea1[_0x4313('0x47')],_0x3fdea1[_0x4313('0x44')]);_0x52a8c3[_0x4313('0x48')]=_[_0x4313('0x46')](_0x3fdea1[_0x4313('0x47')],qs[_0x4313('0x49')](_0x1a4277['query'][_0x4313('0x49')]));_0x52a8c3[_0x4313('0x48')]=_0x52a8c3[_0x4313('0x48')][_0x4313('0x4a')]?_0x52a8c3['attributes']:_0x3fdea1[_0x4313('0x47')];if(_0x1a4277[_0x4313('0x44')][_0x4313('0x54')]){_0x52a8c3[_0x4313('0x55')]=[{'all':!![]}];}_0x52a8c3=_[_0x4313('0x52')]({},_0x52a8c3,_0x1a4277['options']);return db[_0x4313('0x3e')]['find'](_0x52a8c3)[_0x4313('0x38')](handleEntityNotFound(_0x2889ec,null))['then'](respondWithResult(_0x2889ec,null))['catch'](handleError(_0x2889ec,null));};exports['update']=function(_0x935cc0,_0x17a72b){if(_0x935cc0['body']['id']){delete _0x935cc0[_0x4313('0x59')]['id'];}return db['FaxMessage'][_0x4313('0x5a')]({'where':{'id':_0x935cc0[_0x4313('0x58')]['id']}})[_0x4313('0x38')](handleEntityNotFound(_0x17a72b,null))[_0x4313('0x38')](saveUpdates(_0x935cc0['body'],null))['then'](respondWithResult(_0x17a72b,null))[_0x4313('0x2b')](handleError(_0x17a72b,null));};exports[_0x4313('0x39')]=function(_0x1b4ff1,_0x3a3632){return db[_0x4313('0x3e')][_0x4313('0x5a')]({'where':{'id':_0x1b4ff1[_0x4313('0x58')]['id']}})['then'](handleEntityNotFound(_0x3a3632,null))[_0x4313('0x38')](removeEntity(_0x3a3632,null))['catch'](handleError(_0x3a3632,null));};exports[_0x4313('0x5b')]=function(_0x5e9232,_0x95717e){return db[_0x4313('0x3e')][_0x4313('0x5b')]()[_0x4313('0x38')](respondWithResult(_0x95717e,null))[_0x4313('0x2b')](handleError(_0x95717e,null));};var interaction_log=require('../../config/logger')(_0x4313('0x5c'));exports[_0x4313('0x5d')]=function(_0x503012,_0x2ca6fd,_0x4b3b23){var _0xd091b4={'agent':{},'channel':_0x4313('0x5e')};if(_0x503012[_0x4313('0x59')]['id']){delete _0x503012['body']['id'];}_0x503012[_0x4313('0x59')][_0x4313('0x5f')]=!![];_0x503012[_0x4313('0x59')][_0x4313('0x60')]=moment()[_0x4313('0x61')](_0x4313('0x62'));_0x503012[_0x4313('0x59')]['UserId']=_0x503012[_0x4313('0x59')][_0x4313('0x63')]||_0x503012[_0x4313('0x64')]['id'];_0xd091b4[_0x4313('0x65')]['id']=_0x503012['body']['UserId'];return db[_0x4313('0x3e')][_0x4313('0x5a')]({'where':{'id':_0x503012[_0x4313('0x58')]['id'],'UserId':null}})[_0x4313('0x38')](handleEntityNotFound(_0x2ca6fd,null))[_0x4313('0x38')](saveUpdates(_0x503012[_0x4313('0x59')],null))[_0x4313('0x38')](function(_0x515573){if(_0x515573){_0xd091b4[_0x4313('0x29')]=_0x515573[_0x4313('0x66')]({'plain':!![]});return db[_0x4313('0x67')]['find']({'where':{'id':_0x515573[_0x4313('0x68')]}});}return null;})[_0x4313('0x38')](handleEntityNotFound(_0x2ca6fd,null))[_0x4313('0x38')](function(_0x13a32a){if(_0x13a32a){return _0x13a32a[_0x4313('0x69')]({'UserId':_0x503012['body']['UserId'],'read1stAt':_[_0x4313('0x6a')](_0x13a32a[_0x4313('0x6b')])?moment()[_0x4313('0x61')](_0x4313('0x62')):undefined});}return null;})[_0x4313('0x38')](function(_0x1fe530){if(_0x1fe530){_0xd091b4[_0x4313('0x6c')]=_0x1fe530['get']({'plain':!![]});interaction_log['info'](_0x4313('0x6d'),_0x503012[_0x4313('0x64')]['id'],_0x503012['user'][_0x4313('0x3a')],_0x503012[_0x4313('0x64')][_0x4313('0x6e')],_0xd091b4[_0x4313('0x6c')]['id'],_0x503012[_0x4313('0x59')]?JSON[_0x4313('0x26')](_0x503012[_0x4313('0x59')]):_0x4313('0x6f'));return respondWithRpcPromise(_0x4313('0x70'),_0x4313('0x71'),_0xd091b4);}return null;})[_0x4313('0x38')](function(_0x206eee){var _0x2f4af8=_0x4313('0x72')+_0x206eee[_0x4313('0x29')][_0x4313('0x73')];return db[_0x4313('0x74')]['query'](_0x2f4af8,{'type':db[_0x4313('0x75')][_0x4313('0x76')]['SELECT'],'raw':!![]})[_0x4313('0x38')](function(_0x2ecd8e){return _0x2ecd8e;});})[_0x4313('0x38')](function(_0x2b4b95){if(_0x2b4b95){_0xd091b4[_0x4313('0x29')][_0x4313('0x77')]=_0x2b4b95[0x0];if(!_0x503012[_0x4313('0x59')]['UserId'])return;return db['User'][_0x4313('0x5a')]({'where':{'id':_0x503012[_0x4313('0x59')][_0x4313('0x63')],'role':_0x4313('0x65')},'attributes':['id','name',_0x4313('0x78'),_0x4313('0x79'),_0x4313('0x7a')],'raw':!![]});}return null;})[_0x4313('0x38')](function(_0x17baed){if(!_0x17baed)return null;_0xd091b4['message'][_0x4313('0x65')]=_0x17baed;return _0xd091b4;})[_0x4313('0x38')](function(_0x87fb06){if(_0x87fb06){if(_0x503012[_0x4313('0x59')][_0x4313('0x7b')]){_0xd091b4[_0x4313('0x29')][_0x4313('0x7c')]=util[_0x4313('0x61')](_0x4313('0x7d'),_0x503012[_0x4313('0x64')]['name']);_0xd091b4['message']['channel']=_0xd091b4[_0x4313('0x7e')];_0xd091b4['message'][_0x4313('0x7f')]=_0xd091b4[_0x4313('0x7e')];_0xd091b4['message'][_0x4313('0x80')]=_0x4313('0x5d');return respondWithRpcPromise(_0x4313('0x81'),_0x4313('0x81'),{'event':_0x4313('0x82'),'message':_0xd091b4[_0x4313('0x29')]},client9002)[_0x4313('0x38')](function(){return _0xd091b4;});}return _0xd091b4;}return null;})[_0x4313('0x38')](respondWithResult(_0x2ca6fd,null))[_0x4313('0x2b')](handleError(_0x2ca6fd,null));};var interaction_log=require('../../config/logger')(_0x4313('0x5c'));exports[_0x4313('0x37')]=function(_0x2ec9c1,_0x1989b8,_0x204f98){var _0x1534f8={'agent':{},'channel':_0x4313('0x5e')};if(_0x2ec9c1[_0x4313('0x59')]['id']){delete _0x2ec9c1['body']['id'];}_0x2ec9c1[_0x4313('0x59')]['UserId']=_0x2ec9c1[_0x4313('0x59')][_0x4313('0x63')]||_0x2ec9c1[_0x4313('0x64')]['id'];_0x1534f8[_0x4313('0x65')]['id']=_0x2ec9c1[_0x4313('0x59')]['UserId'];return db[_0x4313('0x3e')][_0x4313('0x5a')]({'where':{'id':_0x2ec9c1[_0x4313('0x58')]['id'],'UserId':null}})[_0x4313('0x38')](handleEntityNotFound(_0x1989b8,null))['then'](function(_0x2221dd){if(_0x2221dd){_0x1534f8['message']=_0x2221dd[_0x4313('0x66')]({'plain':!![]});return db[_0x4313('0x67')][_0x4313('0x5a')]({'where':{'id':_0x2221dd[_0x4313('0x68')]}});}return null;})[_0x4313('0x38')](handleEntityNotFound(_0x1989b8,null))['then'](function(_0x26bd50){if(_0x26bd50){_0x1534f8['interaction']=_0x26bd50[_0x4313('0x66')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2ec9c1[_0x4313('0x64')]['id'],_0x2ec9c1[_0x4313('0x64')]['name'],_0x2ec9c1['user'][_0x4313('0x6e')],_0x1534f8[_0x4313('0x6c')]['id'],_0x2ec9c1['body']?JSON['stringify'](_0x2ec9c1[_0x4313('0x59')]):_0x4313('0x6f'));return respondWithRpcPromise(_0x4313('0x83'),_0x4313('0x84'),_0x1534f8);}return null;})['then'](function(_0x14f6c9){var _0x13e926=_0x4313('0x72')+_0x14f6c9['message']['ContactId'];return db[_0x4313('0x74')][_0x4313('0x44')](_0x13e926,{'type':db[_0x4313('0x75')][_0x4313('0x76')][_0x4313('0x85')],'raw':!![]})['then'](function(_0x154be8){return _0x154be8;});})[_0x4313('0x38')](function(_0x4de8a3){if(_0x4de8a3){_0x1534f8[_0x4313('0x29')]['contact']=_0x4de8a3[0x0];if(!_0x2ec9c1[_0x4313('0x59')][_0x4313('0x63')])return;return db[_0x4313('0x86')][_0x4313('0x5a')]({'where':{'id':_0x2ec9c1['body']['UserId'],'role':'agent'},'attributes':['id',_0x4313('0x3a'),'fullname',_0x4313('0x79'),_0x4313('0x7a')],'raw':!![]});}return null;})[_0x4313('0x38')](function(_0x4e2ce0){if(!_0x4e2ce0)return null;_0x1534f8['message'][_0x4313('0x65')]=_0x4e2ce0;return _0x1534f8;})[_0x4313('0x38')](function(_0x3bb988){if(_0x3bb988){_0x3bb988[_0x4313('0x29')][_0x4313('0x7c')]=util['format'](_0x4313('0x7d'),_0x2ec9c1['user']['name']);_0x3bb988[_0x4313('0x29')][_0x4313('0x7e')]=_0x1534f8['channel'];_0x3bb988[_0x4313('0x29')][_0x4313('0x7f')]=_0x1534f8[_0x4313('0x7e')];_0x3bb988[_0x4313('0x29')][_0x4313('0x80')]='reject';respondWithRpcPromise(_0x4313('0x81'),_0x4313('0x81'),{'event':_0x4313('0x87'),'message':_0x3bb988[_0x4313('0x29')]},client9002);return _0x1534f8;}return null;})[_0x4313('0x38')](respondWithResult(_0x1989b8,null))[_0x4313('0x2b')](handleError(_0x1989b8,null));};exports[_0x4313('0x88')]=function(_0x57d6a1,_0x9620da){var _0x152d1a;return db[_0x4313('0x3e')][_0x4313('0x88')](_0x57d6a1[_0x4313('0x59')],{})[_0x4313('0x38')](function(_0x2523c3){_0x152d1a=_0x2523c3;return db['CmContact']['findOne']({'where':{'id':_0x152d1a['ContactId']}});})[_0x4313('0x38')](function(_0x1c1548){if(_[_0x4313('0x6a')](_0x1c1548)){return;}else{_0x152d1a[_0x4313('0x5e')]=_0x1c1548[_0x4313('0x5e')];return db[_0x4313('0x89')][_0x4313('0x8a')]({'where':{'id':_0x152d1a[_0x4313('0x8b')]}});}})[_0x4313('0x38')](function(_0x12b6bf){return respondWithRpcPromise(_0x4313('0x8c'),_0x4313('0x8c'),{'FaxAccountId':_[_0x4313('0x6a')](_0x57d6a1[_0x4313('0x59')])?undefined:_0x57d6a1[_0x4313('0x59')][_0x4313('0x8d')],'path':_[_0x4313('0x6a')](_0x12b6bf)?undefined:util[_0x4313('0x61')](_0x4313('0x8e'),_0x12b6bf[_0x4313('0x8f')]),'fax':_[_0x4313('0x6a')](_0x152d1a[_0x4313('0x5e')])?undefined:_0x152d1a['fax'],'AttachmentId':_0x152d1a['AttachmentId']},client9002);})[_0x4313('0x38')](respondWithResult(_0x9620da,0xc9))['catch'](handleError(_0x9620da,null));};exports['download']=function(_0x321d57,_0x57a3e4){var _0x43841e=path[_0x4313('0x90')](config[_0x4313('0x91')],'server','files',_0x4313('0x92'));return db[_0x4313('0x3e')][_0x4313('0x5a')]({'where':{'id':_0x321d57[_0x4313('0x58')]['id']},'include':[{'model':db[_0x4313('0x89')],'as':'Attachment'}]})[_0x4313('0x38')](handleEntityNotFound(_0x57a3e4,null))[_0x4313('0x38')](function(_0x249b34){if(_0x249b34){return _0x57a3e4['download'](path[_0x4313('0x90')](_0x43841e,_0x249b34[_0x4313('0x89')][_0x4313('0x8f')]));}})['catch'](handleError(_0x57a3e4,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index b8fe6c9..066d460 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 _0x28b1=['FaxMessage','save','update','remove','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x1f8a44,_0x458b19){var _0x1e26ea=function(_0x4e5b31){while(--_0x4e5b31){_0x1f8a44['push'](_0x1f8a44['shift']());}};_0x1e26ea(++_0x458b19);}(_0x28b1,0x1d6));var _0x128b=function(_0x9b9fb0,_0x58a33e){_0x9b9fb0=_0x9b9fb0-0x0;var _0x5b4f02=_0x28b1[_0x9b9fb0];return _0x5b4f02;};'use strict';var EventEmitter=require(_0x128b('0x0'));var FaxMessage=require(_0x128b('0x1'))['db'][_0x128b('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x128b('0x3'),'afterUpdate':_0x128b('0x4'),'afterDestroy':_0x128b('0x5')};function emitEvent(_0x6c4acf){return function(_0x4dc0ce,_0x58f0cb,_0x40ee56){FaxMessageEvents['emit'](_0x6c4acf+':'+_0x4dc0ce['id'],_0x4dc0ce);FaxMessageEvents['emit'](_0x6c4acf,_0x4dc0ce);_0x40ee56(null);};}for(var e in events){if(events[_0x128b('0x6')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x128b('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x3f8a=['../../mysqldb','FaxMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3e5a76,_0x1e2316){var _0x2b9bc6=function(_0x1218e3){while(--_0x1218e3){_0x3e5a76['push'](_0x3e5a76['shift']());}};_0x2b9bc6(++_0x1e2316);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0xa61a4f,_0x325edf){_0xa61a4f=_0xa61a4f-0x0;var _0x4f2ba0=_0x3f8a[_0xa61a4f];return _0x4f2ba0;};'use strict';var EventEmitter=require(_0xa3f8('0x0'));var FaxMessage=require(_0xa3f8('0x1'))['db'][_0xa3f8('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xa3f8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa3f8('0x4'),'afterDestroy':_0xa3f8('0x5')};function emitEvent(_0x928738){return function(_0x15b6aa,_0x2553fd,_0x2847b4){FaxMessageEvents[_0xa3f8('0x6')](_0x928738+':'+_0x15b6aa['id'],_0x15b6aa);FaxMessageEvents[_0xa3f8('0x6')](_0x928738,_0x15b6aa);_0x2847b4(null);};}for(var e in events){if(events[_0xa3f8('0x7')](e)){var event=events[e];FaxMessage[_0xa3f8('0x8')](e,emitEvent(event));}}module[_0xa3f8('0x9')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 82882f5..8ec263a 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 _0x2c0a=['isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret'];(function(_0x500812,_0x296a3c){var _0x4add02=function(_0x33c252){while(--_0x33c252){_0x500812['push'](_0x500812['shift']());}};_0x4add02(++_0x296a3c);}(_0x2c0a,0xa6));var _0xa2c0=function(_0x284506,_0x191316){_0x284506=_0x284506-0x0;var _0x1e9ee5=_0x2c0a[_0x284506];return _0x1e9ee5;};'use strict';var _=require(_0xa2c0('0x0'));var util=require(_0xa2c0('0x1'));var logger=require('../../config/logger')(_0xa2c0('0x2'));var moment=require(_0xa2c0('0x3'));var BPromise=require(_0xa2c0('0x4'));var rp=require(_0xa2c0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa2c0('0x6'));var attributes=require(_0xa2c0('0x7'));module[_0xa2c0('0x8')]=function(_0x248688,_0x1ff016){return _0x248688[_0xa2c0('0x9')](_0xa2c0('0xa'),attributes,{'tableName':_0xa2c0('0xb'),'paranoid':![],'indexes':[{'name':_0xa2c0('0xc'),'fields':['body'],'type':_0xa2c0('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x17c91c,_0x3671b8,_0x178c43){var _0x53f359=_0x248688[_0xa2c0('0xe')];var _0x3f7e3e=_0x17c91c[_0xa2c0('0xf')]({'plain':!![]});if(_0x3f7e3e[_0xa2c0('0x10')][_0xa2c0('0x11')]()==='in'||_0x3f7e3e[_0xa2c0('0x10')][_0xa2c0('0x11')]()===_0xa2c0('0x12')&&!_0x3f7e3e[_0xa2c0('0x13')]&&!_[_0xa2c0('0x14')](_0x3f7e3e[_0xa2c0('0x15')])){_0x53f359[_0xa2c0('0x16')][_0xa2c0('0x17')]({'where':{'id':_0x3f7e3e[_0xa2c0('0x18')]}})[_0xa2c0('0x19')](function(_0x25b716){if(_0x25b716){_0x25b716[_0xa2c0('0x1a')]({'lastMsgAt':_0x3f7e3e[_0xa2c0('0x1b')],'lastMsgDirection':_0x3f7e3e[_0xa2c0('0x10')]['toLowerCase']()});}})[_0xa2c0('0x1c')](function(_0x4b388b){console['error'](_0x4b388b);});}_0x178c43();}},'charset':_0xa2c0('0x1d'),'collate':_0xa2c0('0x1e')});}; \ No newline at end of file +var _0xf365=['./faxMessage.attributes','exports','define','fti_fax_messages','body','FULLTEXT','toLowerCase','direction','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','error','util','../../config/logger','moment','request-promise','rimraf'];(function(_0x3407d0,_0x3d7d02){var _0x292678=function(_0x4a66b2){while(--_0x4a66b2){_0x3407d0['push'](_0x3407d0['shift']());}};_0x292678(++_0x3d7d02);}(_0xf365,0x1b0));var _0x5f36=function(_0x2f0244,_0x5c752b){_0x2f0244=_0x2f0244-0x0;var _0x1699a1=_0xf365[_0x2f0244];return _0x1699a1;};'use strict';var _=require('lodash');var util=require(_0x5f36('0x0'));var logger=require(_0x5f36('0x1'))('api');var moment=require(_0x5f36('0x2'));var BPromise=require('bluebird');var rp=require(_0x5f36('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5f36('0x4'));var config=require('../../config/environment');var attributes=require(_0x5f36('0x5'));module[_0x5f36('0x6')]=function(_0x1bf69f,_0x12f21d){return _0x1bf69f[_0x5f36('0x7')]('FaxMessage',attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x5f36('0x8'),'fields':[_0x5f36('0x9')],'type':_0x5f36('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x28c666,_0x523e25,_0x1aaef2){var _0xaf38e0=_0x1bf69f['models'];var _0x3231bb=_0x28c666['get']({'plain':!![]});if(_0x3231bb['direction'][_0x5f36('0xb')]()==='in'||_0x3231bb[_0x5f36('0xc')]['toLowerCase']()===_0x5f36('0xd')&&!_0x3231bb[_0x5f36('0xe')]&&!_[_0x5f36('0xf')](_0x3231bb[_0x5f36('0x10')])){_0xaf38e0[_0x5f36('0x11')][_0x5f36('0x12')]({'where':{'id':_0x3231bb[_0x5f36('0x13')]}})[_0x5f36('0x14')](function(_0x380d6d){if(_0x380d6d){_0x380d6d[_0x5f36('0x15')]({'lastMsgAt':_0x3231bb['createdAt'],'lastMsgDirection':_0x3231bb[_0x5f36('0xc')]['toLowerCase']()});}})['catch'](function(_0x41c803){console[_0x5f36('0x16')](_0x41c803);});}_0x1aaef2();}},'charset':'utf8mb4','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 e8eee00..5d790d1 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 _0xac31=['attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','UpdateFaxMessage','update','where'];(function(_0x373d66,_0x147386){var _0x551c90=function(_0x30dbfb){while(--_0x30dbfb){_0x373d66['push'](_0x373d66['shift']());}};_0x551c90(++_0x147386);}(_0xac31,0xca));var _0x1ac3=function(_0x26fa41,_0x18cd8d){_0x26fa41=_0x26fa41-0x0;var _0x18bdbd=_0xac31[_0x26fa41];return _0x18bdbd;};'use strict';var _=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var moment=require(_0x1ac3('0x2'));var BPromise=require(_0x1ac3('0x3'));var rs=require(_0x1ac3('0x4'));var fs=require('fs');var Redis=require(_0x1ac3('0x5'));var db=require(_0x1ac3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ac3('0x7'))(_0x1ac3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1ac3('0x9')][_0x1ac3('0xa')]({'port':0x232a});config[_0x1ac3('0xb')]=_[_0x1ac3('0xc')](config[_0x1ac3('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x1ac3('0xd'))(new Redis(config['redis']));require(_0x1ac3('0xe'))[_0x1ac3('0xf')](socket);function respondWithRpcPromise(_0x344674,_0x53500b,_0xa26c88){return new BPromise(function(_0x1e2642,_0x3e835b){return client[_0x1ac3('0x10')](_0x344674,_0xa26c88)[_0x1ac3('0x11')](function(_0x422d19){logger['info'](_0x1ac3('0x12'),_0x53500b,_0x1ac3('0x13'));logger[_0x1ac3('0x14')](_0x1ac3('0x15'),_0x53500b,'request\x20sent',JSON[_0x1ac3('0x16')](_0x422d19));if(_0x422d19[_0x1ac3('0x17')]){if(_0x422d19[_0x1ac3('0x17')][_0x1ac3('0x18')]===0x1f4){logger['error'](_0x1ac3('0x12'),_0x53500b,_0x422d19[_0x1ac3('0x17')]['message']);return _0x3e835b(_0x422d19[_0x1ac3('0x17')][_0x1ac3('0x19')]);}logger[_0x1ac3('0x17')]('FaxMessage,\x20%s,\x20%s',_0x53500b,_0x422d19[_0x1ac3('0x17')][_0x1ac3('0x19')]);return _0x1e2642(_0x422d19[_0x1ac3('0x17')]['message']);}else{logger[_0x1ac3('0x1a')]('FaxMessage,\x20%s,\x20%s',_0x53500b,_0x1ac3('0x13'));_0x1e2642(_0x422d19[_0x1ac3('0x1b')][_0x1ac3('0x19')]);}})[_0x1ac3('0x1c')](function(_0x18b985){logger['error'](_0x1ac3('0x12'),_0x53500b,_0x18b985);_0x3e835b(_0x18b985);});});}exports[_0x1ac3('0x1d')]=function(_0x296abf){var _0x257f60=this;return new Promise(function(_0x5f1918,_0x48d18a){return db[_0x1ac3('0x1e')][_0x1ac3('0x1f')](_0x296abf[_0x1ac3('0x20')],{'raw':_0x296abf[_0x1ac3('0x21')]?_0x296abf[_0x1ac3('0x21')][_0x1ac3('0x22')]===undefined?!![]:![]:!![]})[_0x1ac3('0x11')](function(_0x10912a){logger[_0x1ac3('0x1a')]('CreateFaxMessage',_0x296abf);logger[_0x1ac3('0x14')](_0x1ac3('0x1d'),_0x296abf,JSON['stringify'](_0x10912a));_0x5f1918(_0x10912a);})[_0x1ac3('0x1c')](function(_0x10f30c){logger['error'](_0x1ac3('0x1d'),_0x10f30c[_0x1ac3('0x19')],_0x296abf);_0x48d18a(_0x257f60[_0x1ac3('0x17')](0x1f4,_0x10f30c[_0x1ac3('0x19')]));});});};exports[_0x1ac3('0x23')]=function(_0x565a0f){var _0x5a2ab2=this;return new Promise(function(_0x503a64,_0x528807){return db['FaxMessage'][_0x1ac3('0x24')](_0x565a0f['body'],{'raw':_0x565a0f[_0x1ac3('0x21')]?_0x565a0f[_0x1ac3('0x21')][_0x1ac3('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x565a0f[_0x1ac3('0x21')]?_0x565a0f['options'][_0x1ac3('0x25')]||null:null,'attributes':_0x565a0f['options']?_0x565a0f[_0x1ac3('0x21')][_0x1ac3('0x26')]||null:null,'limit':_0x565a0f[_0x1ac3('0x21')]?_0x565a0f[_0x1ac3('0x21')][_0x1ac3('0x27')]||null:null})[_0x1ac3('0x11')](function(_0x9c17c2){logger['info'](_0x1ac3('0x23'),_0x565a0f);logger[_0x1ac3('0x14')](_0x1ac3('0x23'),_0x565a0f,JSON[_0x1ac3('0x16')](_0x9c17c2));_0x503a64(_0x9c17c2);})['catch'](function(_0x3591a9){logger[_0x1ac3('0x17')](_0x1ac3('0x23'),_0x3591a9[_0x1ac3('0x19')],_0x565a0f);_0x528807(_0x5a2ab2[_0x1ac3('0x17')](0x1f4,_0x3591a9['message']));});});}; \ No newline at end of file +var _0x4b84=['CreateFaxMessage','FaxMessage','create','body','options','raw','stringify','UpdateFaxMessage','attributes','catch','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','http','defaults','localhost','./faxMessage.socket','register','request','then','info','request\x20sent','debug','error','message','FaxMessage,\x20%s,\x20%s','result'];(function(_0x2ea9b4,_0x1c52e6){var _0x451cde=function(_0x4c736f){while(--_0x4c736f){_0x2ea9b4['push'](_0x2ea9b4['shift']());}};_0x451cde(++_0x1c52e6);}(_0x4b84,0x1cc));var _0x44b8=function(_0x912d27,_0x28e0e3){_0x912d27=_0x912d27-0x0;var _0x31b918=_0x4b84[_0x912d27];return _0x31b918;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});config['redis']=_[_0x44b8('0x7')](config['redis'],{'host':_0x44b8('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x44b8('0x9'))[_0x44b8('0xa')](socket);function respondWithRpcPromise(_0x30ebc3,_0x48a371,_0xc650ec){return new BPromise(function(_0x2cc74b,_0x4315f6){return client[_0x44b8('0xb')](_0x30ebc3,_0xc650ec)[_0x44b8('0xc')](function(_0x37e471){logger[_0x44b8('0xd')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x44b8('0xe'));logger[_0x44b8('0xf')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x48a371,_0x44b8('0xe'),JSON['stringify'](_0x37e471));if(_0x37e471[_0x44b8('0x10')]){if(_0x37e471[_0x44b8('0x10')]['code']===0x1f4){logger[_0x44b8('0x10')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x37e471['error'][_0x44b8('0x11')]);return _0x4315f6(_0x37e471[_0x44b8('0x10')][_0x44b8('0x11')]);}logger[_0x44b8('0x10')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x37e471['error']['message']);return _0x2cc74b(_0x37e471[_0x44b8('0x10')]['message']);}else{logger[_0x44b8('0xd')](_0x44b8('0x12'),_0x48a371,'request\x20sent');_0x2cc74b(_0x37e471[_0x44b8('0x13')][_0x44b8('0x11')]);}})['catch'](function(_0x89bc30){logger[_0x44b8('0x10')]('FaxMessage,\x20%s,\x20%s',_0x48a371,_0x89bc30);_0x4315f6(_0x89bc30);});});}exports[_0x44b8('0x14')]=function(_0x8b4301){var _0xebfe79=this;return new Promise(function(_0x235bdc,_0x102ef9){return db[_0x44b8('0x15')][_0x44b8('0x16')](_0x8b4301[_0x44b8('0x17')],{'raw':_0x8b4301[_0x44b8('0x18')]?_0x8b4301[_0x44b8('0x18')][_0x44b8('0x19')]===undefined?!![]:![]:!![]})[_0x44b8('0xc')](function(_0x48327e){logger[_0x44b8('0xd')](_0x44b8('0x14'),_0x8b4301);logger[_0x44b8('0xf')](_0x44b8('0x14'),_0x8b4301,JSON[_0x44b8('0x1a')](_0x48327e));_0x235bdc(_0x48327e);})['catch'](function(_0x402497){logger['error'](_0x44b8('0x14'),_0x402497[_0x44b8('0x11')],_0x8b4301);_0x102ef9(_0xebfe79[_0x44b8('0x10')](0x1f4,_0x402497[_0x44b8('0x11')]));});});};exports[_0x44b8('0x1b')]=function(_0x59acbc){var _0x474f01=this;return new Promise(function(_0x502acf,_0x41d673){return db[_0x44b8('0x15')]['update'](_0x59acbc[_0x44b8('0x17')],{'raw':_0x59acbc[_0x44b8('0x18')]?_0x59acbc[_0x44b8('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59acbc[_0x44b8('0x18')]?_0x59acbc[_0x44b8('0x18')]['where']||null:null,'attributes':_0x59acbc[_0x44b8('0x18')]?_0x59acbc['options'][_0x44b8('0x1c')]||null:null,'limit':_0x59acbc['options']?_0x59acbc['options']['limit']||null:null})[_0x44b8('0xc')](function(_0x29b18d){logger[_0x44b8('0xd')](_0x44b8('0x1b'),_0x59acbc);logger[_0x44b8('0xf')](_0x44b8('0x1b'),_0x59acbc,JSON[_0x44b8('0x1a')](_0x29b18d));_0x502acf(_0x29b18d);})[_0x44b8('0x1d')](function(_0xd1d320){logger[_0x44b8('0x10')](_0x44b8('0x1b'),_0xd1d320[_0x44b8('0x11')],_0x59acbc);_0x41d673(_0x474f01[_0x44b8('0x10')](0x1f4,_0xd1d320['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index a48b149..c454c41 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 _0x62a8=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x62a8,0x93));var _0x862a=function(_0x223d6d,_0x513180){_0x223d6d=_0x223d6d-0x0;var _0x1bcb04=_0x62a8[_0x223d6d];return _0x1bcb04;};'use strict';var FaxMessageEvents=require(_0x862a('0x0'));var events=[_0x862a('0x1'),_0x862a('0x2'),_0x862a('0x3')];function createListener(_0x5a5c90,_0x23f3b6){return function(_0x43adba){_0x23f3b6[_0x862a('0x4')](_0x5a5c90,_0x43adba);};}function removeListener(_0x4d635b,_0x2d1fa5){return function(){FaxMessageEvents[_0x862a('0x5')](_0x4d635b,_0x2d1fa5);};}exports[_0x862a('0x6')]=function(_0x2c3679){for(var _0x4aea24=0x0,_0x5f29bd=events[_0x862a('0x7')];_0x4aea24<_0x5f29bd;_0x4aea24++){var _0x1dc2c3=events[_0x4aea24];var _0x55731c=createListener(_0x862a('0x8')+_0x1dc2c3,_0x2c3679);FaxMessageEvents['on'](_0x1dc2c3,_0x55731c);}}; \ No newline at end of file +var _0x7923=['remove','update','emit','removeListener','register','length','faxMessage:','./faxMessage.events','save'];(function(_0x2e2f84,_0x24e46f){var _0x448191=function(_0x336e06){while(--_0x336e06){_0x2e2f84['push'](_0x2e2f84['shift']());}};_0x448191(++_0x24e46f);}(_0x7923,0x97));var _0x3792=function(_0x465dc6,_0x3d19bd){_0x465dc6=_0x465dc6-0x0;var _0x22b665=_0x7923[_0x465dc6];return _0x22b665;};'use strict';var FaxMessageEvents=require(_0x3792('0x0'));var events=[_0x3792('0x1'),_0x3792('0x2'),_0x3792('0x3')];function createListener(_0x3176e0,_0x22a86a){return function(_0x5cff3a){_0x22a86a[_0x3792('0x4')](_0x3176e0,_0x5cff3a);};}function removeListener(_0x14c77d,_0x568d9d){return function(){FaxMessageEvents[_0x3792('0x5')](_0x14c77d,_0x568d9d);};}exports[_0x3792('0x6')]=function(_0x41b002){for(var _0x731101=0x0,_0x24845c=events[_0x3792('0x7')];_0x731101<_0x24845c;_0x731101++){var _0x4eba2a=events[_0x731101];var _0x2a8d27=createListener(_0x3792('0x8')+_0x4eba2a,_0x41b002);FaxMessageEvents['on'](_0x4eba2a,_0x2a8d27);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 85a5679..4966552 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 _0xd3d1=['put','update','accept','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','download','post','tracked','fax','faxmessage:create','create'];(function(_0xaf5b83,_0x3ac943){var _0x32433b=function(_0x366018){while(--_0x366018){_0xaf5b83['push'](_0xaf5b83['shift']());}};_0x32433b(++_0x3ac943);}(_0xd3d1,0x172));var _0x1d3d=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xd3d1[_0x4c12ec];return _0x3ae42c;};'use strict';var multer=require(_0x1d3d('0x0'));var util=require(_0x1d3d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1d3d('0x2'));var router=express[_0x1d3d('0x3')]();var fs_extra=require(_0x1d3d('0x4'));var auth=require(_0x1d3d('0x5'));var interaction=require(_0x1d3d('0x6'));var config=require(_0x1d3d('0x7'));var controller=require(_0x1d3d('0x8'));router[_0x1d3d('0x9')]('/',auth[_0x1d3d('0xa')](),controller[_0x1d3d('0xb')]);router[_0x1d3d('0x9')](_0x1d3d('0xc'),auth[_0x1d3d('0xa')](),controller[_0x1d3d('0xd')]);router[_0x1d3d('0x9')](_0x1d3d('0xe'),auth[_0x1d3d('0xa')](),controller['show']);router[_0x1d3d('0x9')](_0x1d3d('0xf'),auth[_0x1d3d('0xa')](),controller[_0x1d3d('0x10')]);router[_0x1d3d('0x11')]('/',auth[_0x1d3d('0xa')](),interaction[_0x1d3d('0x12')](_0x1d3d('0x13'),_0x1d3d('0x14')),controller[_0x1d3d('0x15')]);router[_0x1d3d('0x16')]('/:id',auth[_0x1d3d('0xa')](),controller[_0x1d3d('0x17')]);router['put']('/:id/accept',auth[_0x1d3d('0xa')](),controller[_0x1d3d('0x18')]);router[_0x1d3d('0x16')]('/:id/reject',auth[_0x1d3d('0xa')](),controller['reject']);router[_0x1d3d('0x19')](_0x1d3d('0xe'),auth[_0x1d3d('0xa')](),controller[_0x1d3d('0x1a')]);module[_0x1d3d('0x1b')]=router; \ No newline at end of file +var _0xd404=['/:id','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','describe'];(function(_0x12781a,_0x5566e0){var _0x5276ce=function(_0xbfd105){while(--_0xbfd105){_0x12781a['push'](_0x12781a['shift']());}};_0x5276ce(++_0x5566e0);}(_0xd404,0x15b));var _0x4d40=function(_0x5dbd65,_0xdf28af){_0x5dbd65=_0x5dbd65-0x0;var _0x1cb5ee=_0xd404[_0x5dbd65];return _0x1cb5ee;};'use strict';var multer=require(_0x4d40('0x0'));var util=require(_0x4d40('0x1'));var path=require('path');var timeout=require(_0x4d40('0x2'));var express=require(_0x4d40('0x3'));var router=express['Router']();var fs_extra=require(_0x4d40('0x4'));var auth=require(_0x4d40('0x5'));var interaction=require(_0x4d40('0x6'));var config=require(_0x4d40('0x7'));var controller=require(_0x4d40('0x8'));router[_0x4d40('0x9')]('/',auth[_0x4d40('0xa')](),controller[_0x4d40('0xb')]);router[_0x4d40('0x9')]('/describe',auth[_0x4d40('0xa')](),controller[_0x4d40('0xc')]);router['get'](_0x4d40('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x4d40('0x9')](_0x4d40('0xe'),auth[_0x4d40('0xa')](),controller[_0x4d40('0xf')]);router[_0x4d40('0x10')]('/',auth[_0x4d40('0xa')](),interaction[_0x4d40('0x11')](_0x4d40('0x12'),_0x4d40('0x13')),controller[_0x4d40('0x14')]);router[_0x4d40('0x15')](_0x4d40('0xd'),auth[_0x4d40('0xa')](),controller[_0x4d40('0x16')]);router['put'](_0x4d40('0x17'),auth[_0x4d40('0xa')](),controller[_0x4d40('0x18')]);router[_0x4d40('0x15')](_0x4d40('0x19'),auth['isAuthenticated'](),controller[_0x4d40('0x1a')]);router[_0x4d40('0x1b')](_0x4d40('0xd'),auth[_0x4d40('0xa')](),controller[_0x4d40('0x1c')]);module[_0x4d40('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index eb36ce2..456b39e 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 _0x97a1=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','STRING'];(function(_0x47a4ae,_0x471b22){var _0x1fc269=function(_0x21ddc4){while(--_0x21ddc4){_0x47a4ae['push'](_0x47a4ae['shift']());}};_0x1fc269(++_0x471b22);}(_0x97a1,0x1e6));var _0x197a=function(_0x1f55cb,_0x35b298){_0x1f55cb=_0x1f55cb-0x0;var _0x3b53a0=_0x97a1[_0x1f55cb];return _0x3b53a0;};'use strict';var Sequelize=require(_0x197a('0x0'));module['exports']={'name':{'type':Sequelize[_0x197a('0x1')],'unique':_0x197a('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x197a('0x1')]},'timeout':{'type':Sequelize[_0x197a('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x197a('0x4')](_0x197a('0x5'),_0x197a('0x6'),_0x197a('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x197a('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8868=['beepall','INTEGER','sequelize','exports','STRING','name'];(function(_0xedea6a,_0x4db04c){var _0x20f70e=function(_0x5b472d){while(--_0x5b472d){_0xedea6a['push'](_0xedea6a['shift']());}};_0x20f70e(++_0x4db04c);}(_0x8868,0x1ac));var _0x8886=function(_0x5bfeb1,_0x4da634){_0x5bfeb1=_0x5bfeb1-0x0;var _0x17512a=_0x8868[_0x5bfeb1];return _0x17512a;};'use strict';var Sequelize=require(_0x8886('0x0'));module[_0x8886('0x1')]={'name':{'type':Sequelize[_0x8886('0x2')],'unique':_0x8886('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8886('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x8886('0x4'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x8886('0x5')],'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 13be9e2..f9b7889 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 _0x7cab=['ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','TeamId','includes','compact','removeTeams','ids','removeAgents','userFaxQueue:remove','addAgents','omit','isArray','getAgents','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','error','stack','name','send','index','FaxQueue','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','merge','where','options','count','findAll','rows','catch','params','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','User','findAndCountAll','agent','faxPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','transaction','findOrCreate','forEach','emit','userFaxQueue:save','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x7cab,0x9d));var _0xb7ca=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x7cab[_0x20a558];return _0x53d3f7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb7ca('0x0'));var zipdir=require(_0xb7ca('0x1'));var jsonpatch=require(_0xb7ca('0x2'));var rp=require('request-promise');var moment=require(_0xb7ca('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb7ca('0x4'));var util=require(_0xb7ca('0x5'));var path=require(_0xb7ca('0x6'));var sox=require(_0xb7ca('0x7'));var csv=require(_0xb7ca('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb7ca('0x9'));var _=require('lodash');var squel=require(_0xb7ca('0xa'));var crypto=require(_0xb7ca('0xb'));var jsforce=require(_0xb7ca('0xc'));var deskjs=require(_0xb7ca('0xd'));var toCsv=require(_0xb7ca('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb7ca('0xe'));var authService=require(_0xb7ca('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xb7ca('0x10'));var hardwareService=require(_0xb7ca('0x11'));var logger=require(_0xb7ca('0x12'))(_0xb7ca('0x13'));var utils=require(_0xb7ca('0x14'));var config=require(_0xb7ca('0x15'));var licenseUtil=require(_0xb7ca('0x16'));var db=require('../../mysqldb')['db'];config[_0xb7ca('0x17')]=_['defaults'](config['redis'],{'host':_0xb7ca('0x18'),'port':0x18eb});var socket=require(_0xb7ca('0x19'))(new Redis(config[_0xb7ca('0x17')]));require(_0xb7ca('0x1a'))[_0xb7ca('0x1b')](socket);function respondWithStatusCode(_0x1de9e9,_0x5242a3){_0x5242a3=_0x5242a3||0xcc;return function(_0x5d8510){if(_0x5d8510){return _0x1de9e9[_0xb7ca('0x1c')](_0x5242a3);}return _0x1de9e9[_0xb7ca('0x1d')](_0x5242a3)['end']();};}function respondWithResult(_0x5e4cb5,_0x4a09ae){_0x4a09ae=_0x4a09ae||0xc8;return function(_0x311185){if(_0x311185){return _0x5e4cb5['status'](_0x4a09ae)[_0xb7ca('0x1e')](_0x311185);}};}function respondWithFilteredResult(_0x3eb7be,_0x41ee09){return function(_0xf8d6a1){if(_0xf8d6a1){var _0x5de650=typeof _0x41ee09[_0xb7ca('0x1f')]===_0xb7ca('0x20')&&typeof _0x41ee09[_0xb7ca('0x21')]===_0xb7ca('0x20');var _0x41b85c=_0xf8d6a1['count'];var _0x376ca2=_0x5de650?0x0:_0x41ee09['offset'];var _0x48582d=_0x5de650?_0xf8d6a1['count']:_0x41ee09[_0xb7ca('0x1f')]+_0x41ee09[_0xb7ca('0x21')];var _0x3903e2;if(_0x48582d>=_0x41b85c){_0x48582d=_0x41b85c;_0x3903e2=0xc8;}else{_0x3903e2=0xce;}_0x3eb7be['status'](_0x3903e2);return _0x3eb7be[_0xb7ca('0x22')](_0xb7ca('0x23'),_0x376ca2+'-'+_0x48582d+'/'+_0x41b85c)[_0xb7ca('0x1e')](_0xf8d6a1);}return null;};}function patchUpdates(_0x4c0b7d){return function(_0x5a2ca2){try{jsonpatch[_0xb7ca('0x24')](_0x5a2ca2,_0x4c0b7d,!![]);}catch(_0x320085){return BPromise[_0xb7ca('0x25')](_0x320085);}return _0x5a2ca2[_0xb7ca('0x26')]();};}function saveUpdates(_0x144d1a,_0x434c5e){return function(_0x52f9c8){if(_0x52f9c8){return _0x52f9c8[_0xb7ca('0x27')](_0x144d1a)['then'](function(_0x5d528c){return _0x5d528c;});}return null;};}function removeEntity(_0x5153a9,_0x4c15fb){return function(_0x36655f){if(_0x36655f){return _0x36655f[_0xb7ca('0x28')]()[_0xb7ca('0x29')](function(){var _0x98d15b=_0x36655f[_0xb7ca('0x2a')]({'plain':!![]});var _0x266aae='FaxQueues';return db['UserProfileResource'][_0xb7ca('0x28')]({'where':{'type':_0x266aae,'resourceId':_0x98d15b['id']}})[_0xb7ca('0x29')](function(){return _0x36655f;});})[_0xb7ca('0x29')](function(){_0x5153a9[_0xb7ca('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a40af,_0x3a6d67){return function(_0x18d494){if(!_0x18d494){_0x3a40af[_0xb7ca('0x1c')](0x194);}return _0x18d494;};}function handleError(_0x54cd2c,_0x236a71){_0x236a71=_0x236a71||0x1f4;return function(_0x404541){logger[_0xb7ca('0x2b')](_0x404541[_0xb7ca('0x2c')]);if(_0x404541['name']){delete _0x404541[_0xb7ca('0x2d')];}_0x54cd2c[_0xb7ca('0x1d')](_0x236a71)[_0xb7ca('0x2e')](_0x404541);};}exports[_0xb7ca('0x2f')]=function(_0x37f2fd,_0x24dd4c){var _0x109112={},_0x9d0914={},_0x213518={'count':0x0,'rows':[]};var _0x2b861b=_['map'](db[_0xb7ca('0x30')][_0xb7ca('0x31')],function(_0x5230cf){return{'name':_0x5230cf['fieldName'],'type':_0x5230cf[_0xb7ca('0x32')][_0xb7ca('0x33')]};});_0x9d0914[_0xb7ca('0x34')]=_[_0xb7ca('0x35')](_0x2b861b,_0xb7ca('0x2d'));_0x9d0914[_0xb7ca('0x36')]=_[_0xb7ca('0x37')](_0x37f2fd[_0xb7ca('0x36')]);_0x9d0914[_0xb7ca('0x38')]=_[_0xb7ca('0x39')](_0x9d0914[_0xb7ca('0x34')],_0x9d0914[_0xb7ca('0x36')]);_0x109112['attributes']=_[_0xb7ca('0x39')](_0x9d0914[_0xb7ca('0x34')],qs['fields'](_0x37f2fd[_0xb7ca('0x36')][_0xb7ca('0x3a')]));_0x109112[_0xb7ca('0x3b')]=_0x109112[_0xb7ca('0x3b')][_0xb7ca('0x3c')]?_0x109112[_0xb7ca('0x3b')]:_0x9d0914[_0xb7ca('0x34')];if(!_0x37f2fd['query']['hasOwnProperty'](_0xb7ca('0x3d'))){_0x109112['limit']=qs['limit'](_0x37f2fd[_0xb7ca('0x36')][_0xb7ca('0x21')]);_0x109112[_0xb7ca('0x1f')]=qs[_0xb7ca('0x1f')](_0x37f2fd[_0xb7ca('0x36')]['offset']);}_0x109112[_0xb7ca('0x3e')]=qs['sort'](_0x37f2fd[_0xb7ca('0x36')][_0xb7ca('0x3f')]);_0x109112['where']=qs[_0xb7ca('0x38')](_[_0xb7ca('0x40')](_0x37f2fd['query'],_0x9d0914['filters']),_0x2b861b);if(_0x37f2fd[_0xb7ca('0x36')][_0xb7ca('0x41')]){_0x109112['where']=_[_0xb7ca('0x42')](_0x109112[_0xb7ca('0x43')],{'$or':_[_0xb7ca('0x35')](_0x2b861b,function(_0x2efe09){if(_0x2efe09[_0xb7ca('0x32')]!=='VIRTUAL'){var _0x5b1625={};_0x5b1625[_0x2efe09['name']]={'$like':'%'+_0x37f2fd[_0xb7ca('0x36')]['filter']+'%'};return _0x5b1625;}})});}_0x109112=_['merge']({},_0x109112,_0x37f2fd[_0xb7ca('0x44')]);var _0x165562={'where':_0x109112['where']};return db[_0xb7ca('0x30')][_0xb7ca('0x45')](_0x165562)[_0xb7ca('0x29')](function(_0x4858fd){_0x213518[_0xb7ca('0x45')]=_0x4858fd;if(_0x37f2fd[_0xb7ca('0x36')]['includeAll']){_0x109112['include']=[{'all':!![]}];}return db['FaxQueue'][_0xb7ca('0x46')](_0x109112);})[_0xb7ca('0x29')](function(_0x3fbe38){_0x213518[_0xb7ca('0x47')]=_0x3fbe38;return _0x213518;})[_0xb7ca('0x29')](respondWithFilteredResult(_0x24dd4c,_0x109112))[_0xb7ca('0x48')](handleError(_0x24dd4c,null));};exports['show']=function(_0x3a1981,_0x122806){var _0x3424d4={'raw':!![],'where':{'id':_0x3a1981[_0xb7ca('0x49')]['id']}},_0x4128c4={};_0x4128c4[_0xb7ca('0x34')]=_['keys'](db[_0xb7ca('0x30')][_0xb7ca('0x31')]);_0x4128c4[_0xb7ca('0x36')]=_[_0xb7ca('0x37')](_0x3a1981[_0xb7ca('0x36')]);_0x4128c4[_0xb7ca('0x38')]=_['intersection'](_0x4128c4[_0xb7ca('0x34')],_0x4128c4[_0xb7ca('0x36')]);_0x3424d4['attributes']=_[_0xb7ca('0x39')](_0x4128c4['model'],qs[_0xb7ca('0x3a')](_0x3a1981['query'][_0xb7ca('0x3a')]));_0x3424d4['attributes']=_0x3424d4[_0xb7ca('0x3b')][_0xb7ca('0x3c')]?_0x3424d4[_0xb7ca('0x3b')]:_0x4128c4[_0xb7ca('0x34')];if(_0x3a1981[_0xb7ca('0x36')][_0xb7ca('0x4a')]){_0x3424d4[_0xb7ca('0x4b')]=[{'all':!![]}];}_0x3424d4=_[_0xb7ca('0x42')]({},_0x3424d4,_0x3a1981[_0xb7ca('0x44')]);return db['FaxQueue'][_0xb7ca('0x4c')](_0x3424d4)[_0xb7ca('0x29')](handleEntityNotFound(_0x122806,null))[_0xb7ca('0x29')](respondWithResult(_0x122806,null))[_0xb7ca('0x48')](handleError(_0x122806,null));};exports['create']=function(_0x54c4c7,_0x5dd532){return db['FaxQueue'][_0xb7ca('0x4d')](_0x54c4c7[_0xb7ca('0x4e')],{})['then'](function(_0x3dc80b){var _0x2c1725=_0x54c4c7['user'][_0xb7ca('0x2a')]({'plain':!![]});if(!_0x2c1725)throw new Error(_0xb7ca('0x4f'));if(_0x2c1725[_0xb7ca('0x50')]==='user'){var _0x291d0f=_0x3dc80b[_0xb7ca('0x2a')]({'plain':!![]});var _0x953e7d='FaxQueues';return db['UserProfileSection']['find']({'where':{'name':_0x953e7d,'userProfileId':_0x2c1725[_0xb7ca('0x51')]},'raw':!![]})[_0xb7ca('0x29')](function(_0x5c983d){if(_0x5c983d&&_0x5c983d[_0xb7ca('0x52')]===0x0){return db[_0xb7ca('0x53')][_0xb7ca('0x4d')]({'name':_0x291d0f['name'],'resourceId':_0x291d0f['id'],'type':_0x5c983d[_0xb7ca('0x2d')],'sectionId':_0x5c983d['id']},{})[_0xb7ca('0x29')](function(){return _0x3dc80b;});}else{return _0x3dc80b;}})[_0xb7ca('0x48')](function(_0x3e4559){logger[_0xb7ca('0x2b')](_0xb7ca('0x54'),_0x3e4559);throw _0x3e4559;});}return _0x3dc80b;})[_0xb7ca('0x29')](respondWithResult(_0x5dd532,0xc9))['catch'](handleError(_0x5dd532,null));};exports[_0xb7ca('0x27')]=function(_0x231a08,_0x867f9a){if(_0x231a08[_0xb7ca('0x4e')]['id']){delete _0x231a08['body']['id'];}return db[_0xb7ca('0x30')][_0xb7ca('0x4c')]({'where':{'id':_0x231a08['params']['id']}})['then'](handleEntityNotFound(_0x867f9a,null))[_0xb7ca('0x29')](saveUpdates(_0x231a08['body'],null))[_0xb7ca('0x29')](respondWithResult(_0x867f9a,null))[_0xb7ca('0x48')](handleError(_0x867f9a,null));};exports[_0xb7ca('0x28')]=function(_0x19f033,_0x2624d9){return db[_0xb7ca('0x30')][_0xb7ca('0x4c')]({'where':{'id':_0x19f033[_0xb7ca('0x49')]['id']}})['then'](handleEntityNotFound(_0x2624d9,null))['then'](removeEntity(_0x2624d9,null))[_0xb7ca('0x48')](handleError(_0x2624d9,null));};exports[_0xb7ca('0x55')]=function(_0x149580,_0x3b8efc){return db[_0xb7ca('0x30')][_0xb7ca('0x55')]()[_0xb7ca('0x29')](respondWithResult(_0x3b8efc,null))[_0xb7ca('0x48')](handleError(_0x3b8efc,null));};exports[_0xb7ca('0x56')]=function(_0x1bd9a6,_0x33f2e1,_0x4aa476){var _0xbcf816={'raw':!![],'where':{}},_0x40c56e={},_0x5630b7;return db[_0xb7ca('0x30')][_0xb7ca('0x57')]({'where':{'id':_0x1bd9a6[_0xb7ca('0x49')]['id']}})[_0xb7ca('0x29')](handleEntityNotFound(_0x33f2e1,null))['then'](function(_0xd7b86b){if(_0xd7b86b){_0x5630b7=_0xd7b86b[_0xb7ca('0x2a')]({'plain':!![]});_0x40c56e[_0xb7ca('0x34')]=_[_0xb7ca('0x37')](db[_0xb7ca('0x58')]['rawAttributes']);_0x40c56e[_0xb7ca('0x36')]=_[_0xb7ca('0x37')](_0x1bd9a6[_0xb7ca('0x36')]);_0x40c56e[_0xb7ca('0x38')]=_[_0xb7ca('0x39')](_0x40c56e[_0xb7ca('0x34')],_0x40c56e[_0xb7ca('0x36')]);_0xbcf816[_0xb7ca('0x3b')]=_[_0xb7ca('0x39')](_0x40c56e[_0xb7ca('0x34')],qs[_0xb7ca('0x3a')](_0x1bd9a6[_0xb7ca('0x36')]['fields']));_0xbcf816[_0xb7ca('0x3b')]=_0xbcf816[_0xb7ca('0x3b')][_0xb7ca('0x3c')]?_0xbcf816[_0xb7ca('0x3b')]:_0x40c56e['model'];if(!_0x1bd9a6[_0xb7ca('0x36')][_0xb7ca('0x59')](_0xb7ca('0x3d'))){_0xbcf816[_0xb7ca('0x21')]=qs[_0xb7ca('0x21')](_0x1bd9a6[_0xb7ca('0x36')][_0xb7ca('0x21')]);_0xbcf816[_0xb7ca('0x1f')]=qs['offset'](_0x1bd9a6[_0xb7ca('0x36')][_0xb7ca('0x1f')]);}_0xbcf816[_0xb7ca('0x3e')]=qs['sort'](_0x1bd9a6[_0xb7ca('0x36')][_0xb7ca('0x3f')]);_0xbcf816[_0xb7ca('0x43')]=qs[_0xb7ca('0x38')](_[_0xb7ca('0x40')](_0x1bd9a6[_0xb7ca('0x36')],_0x40c56e['filters']));_0xbcf816[_0xb7ca('0x43')]['FaxQueueId']=_0xd7b86b['id'];if(_0x1bd9a6[_0xb7ca('0x36')]['filter']){_0xbcf816['where']=_['merge'](_0xbcf816[_0xb7ca('0x43')],{'$or':_[_0xb7ca('0x35')](_0xbcf816[_0xb7ca('0x3b')],function(_0x4d0c4c){var _0x1491d7={};_0x1491d7[_0x4d0c4c]={'$like':'%'+_0x1bd9a6[_0xb7ca('0x36')][_0xb7ca('0x41')]+'%'};return _0x1491d7;})});}_0xbcf816=_[_0xb7ca('0x42')]({},_0xbcf816,_0x1bd9a6[_0xb7ca('0x44')]);return db[_0xb7ca('0x58')][_0xb7ca('0x46')](_0xbcf816);}})[_0xb7ca('0x29')](function(_0x5d1881){if(_0x5d1881){return db[_0xb7ca('0x5a')][_0xb7ca('0x5b')]({'where':{'id':_['map'](_0x5d1881,'UserId'),'role':_0xb7ca('0x5c')},'attributes':['id',_0xb7ca('0x2d'),_0xb7ca('0x5d'),'updatedAt',_0xb7ca('0x5e')]});}})[_0xb7ca('0x29')](function(_0x3b5994){if(_0x3b5994){return{'count':_0x3b5994[_0xb7ca('0x45')],'rows':_[_0xb7ca('0x35')](_0x3b5994[_0xb7ca('0x47')],function(_0xa0f4cc){return{'membername':_0xa0f4cc[_0xb7ca('0x2d')],'UserId':_0xa0f4cc['id'],'queue_name':_0x5630b7[_0xb7ca('0x2d')],'FaxQueueId':_0x5630b7['id'],'interface':util[_0xb7ca('0x5f')](_0xb7ca('0x60'),_0xb7ca('0x61'),_0xa0f4cc[_0xb7ca('0x2d')]),'penalty':0x0,'paused':_0xa0f4cc[_0xb7ca('0x5d')],'createdAt':_0xa0f4cc[_0xb7ca('0x5e')],'updatedAt':_0xa0f4cc[_0xb7ca('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb7ca('0x29')](respondWithFilteredResult(_0x33f2e1,_0xbcf816))[_0xb7ca('0x48')](handleError(_0x33f2e1,null));};exports[_0xb7ca('0x63')]=function(_0x397104,_0x1f31b3,_0x32e3d7){var _0x5c7e78={};var _0x24831f={};var _0x5b5a69;var _0x552451;return db[_0xb7ca('0x30')][_0xb7ca('0x57')]({'where':{'id':_0x397104[_0xb7ca('0x49')]['id']}})[_0xb7ca('0x29')](handleEntityNotFound(_0x1f31b3,null))[_0xb7ca('0x29')](function(_0x28da86){if(_0x28da86){_0x5b5a69=_0x28da86;_0x24831f['model']=_['keys'](db[_0xb7ca('0x64')]['rawAttributes']);_0x24831f[_0xb7ca('0x36')]=_['keys'](_0x397104['query']);_0x24831f[_0xb7ca('0x38')]=_['intersection'](_0x24831f[_0xb7ca('0x34')],_0x24831f[_0xb7ca('0x36')]);_0x5c7e78[_0xb7ca('0x3b')]=_['intersection'](_0x24831f[_0xb7ca('0x34')],qs[_0xb7ca('0x3a')](_0x397104[_0xb7ca('0x36')][_0xb7ca('0x3a')]));_0x5c7e78[_0xb7ca('0x3b')]=_0x5c7e78[_0xb7ca('0x3b')][_0xb7ca('0x3c')]?_0x5c7e78[_0xb7ca('0x3b')]:_0x24831f[_0xb7ca('0x34')];_0x5c7e78[_0xb7ca('0x3e')]=qs['sort'](_0x397104[_0xb7ca('0x36')][_0xb7ca('0x3f')]);_0x5c7e78[_0xb7ca('0x43')]=qs[_0xb7ca('0x38')](_['pick'](_0x397104[_0xb7ca('0x36')],_0x24831f[_0xb7ca('0x38')]));if(_0x397104[_0xb7ca('0x36')]['filter']){_0x5c7e78[_0xb7ca('0x43')]=_[_0xb7ca('0x42')](_0x5c7e78[_0xb7ca('0x43')],{'$or':_[_0xb7ca('0x35')](_0x5c7e78['attributes'],function(_0xaed428){var _0x19d20b={};_0x19d20b[_0xaed428]={'$like':'%'+_0x397104[_0xb7ca('0x36')][_0xb7ca('0x41')]+'%'};return _0x19d20b;})});}_0x5c7e78=_['merge']({},_0x5c7e78,_0x397104[_0xb7ca('0x44')]);return _0x5b5a69[_0xb7ca('0x63')](_0x5c7e78);}})[_0xb7ca('0x29')](function(_0x526f67){if(_0x526f67){_0x552451=_0x526f67[_0xb7ca('0x3c')];if(!_0x397104[_0xb7ca('0x36')]['hasOwnProperty'](_0xb7ca('0x3d'))){_0x5c7e78[_0xb7ca('0x21')]=qs[_0xb7ca('0x21')](_0x397104[_0xb7ca('0x36')][_0xb7ca('0x21')]);_0x5c7e78[_0xb7ca('0x1f')]=qs[_0xb7ca('0x1f')](_0x397104[_0xb7ca('0x36')]['offset']);}return _0x5b5a69['getTeams'](_0x5c7e78);}})[_0xb7ca('0x29')](function(_0x5c30ca){if(_0x5c30ca){return _0x5c30ca?{'count':_0x552451,'rows':_0x5c30ca}:null;}})[_0xb7ca('0x29')](respondWithResult(_0x1f31b3,null))[_0xb7ca('0x48')](handleError(_0x1f31b3,null));};exports[_0xb7ca('0x65')]=function(_0x56ee33,_0x15d480,_0x4c050f){var _0x2378b9=_0x56ee33['body']['ids'];return db['Team'][_0xb7ca('0x46')]({'where':{'id':_0x2378b9},'attributes':['id'],'include':[{'model':db[_0xb7ca('0x5a')],'as':_0xb7ca('0x66'),'attributes':['id',_0xb7ca('0x2d'),_0xb7ca('0x67'),_0xb7ca('0x68'),_0xb7ca('0x69')],'raw':!![]}]})[_0xb7ca('0x29')](function(_0x30d973){if(_0x30d973){var _0x1d734d=_[_0xb7ca('0x6a')](_0x30d973,function(_0xaa9c9f){var _0x50f366=_0xaa9c9f[_0xb7ca('0x2a')]({'plain':!![]});return _0x50f366[_0xb7ca('0x66')];});return db[_0xb7ca('0x30')][_0xb7ca('0x4c')]({'where':{'id':_0x56ee33[_0xb7ca('0x49')]['id']}})[_0xb7ca('0x29')](function(_0x3d88dd){return db['sequelize'][_0xb7ca('0x6b')](function(_0x2e45ee){return _0x3d88dd[_0xb7ca('0x65')](_0x2378b9,{'transaction':_0x2e45ee})[_0xb7ca('0x29')](function(){return BPromise['each'](_0x1d734d,function(_0x5eabad){return db['UserFaxQueue'][_0xb7ca('0x6c')]({'where':{'UserId':_0x5eabad['id'],'FaxQueueId':_0x56ee33[_0xb7ca('0x49')]['id']},'transaction':_0x2e45ee});});})[_0xb7ca('0x29')](function(){_0x1d734d[_0xb7ca('0x6d')](function(_0x5a5959){socket[_0xb7ca('0x6e')](_0xb7ca('0x6f'),{'UserId':_0x5a5959['id'],'FaxQueueId':_0x3d88dd['id']});});});});});}})[_0xb7ca('0x29')](respondWithStatusCode(_0x15d480,null))['catch'](handleError(_0x15d480,null));};exports['removeTeams']=function(_0x41c7b7,_0x2e4874,_0x344c12){return db[_0xb7ca('0x64')][_0xb7ca('0x46')]({'where':{'id':_0x41c7b7[_0xb7ca('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0xb7ca('0x5a')],'as':_0xb7ca('0x66'),'attributes':['id'],'raw':!![]}]})[_0xb7ca('0x29')](handleEntityNotFound(_0x2e4874,null))[_0xb7ca('0x29')](function(_0x14be25){var _0x1f1a60=_['map'](_0x14be25,'id');var _0x228035=[];var _0x259a41=[];var _0x32fc4d=squel['select']();_0x32fc4d[_0xb7ca('0x70')](_0xb7ca('0x71'))[_0xb7ca('0x72')](_0xb7ca('0x73'),'tq')[_0xb7ca('0x74')](_0xb7ca('0x75'),'ut',_0xb7ca('0x76'))[_0xb7ca('0x43')](_0xb7ca('0x77'),_0x41c7b7['params']['id']);for(var _0x48344b=0x0;_0x48344b<_0x14be25['length'];_0x48344b+=0x1){let _0x51058b=_0x14be25[_0x48344b];for(var _0x97fbc3=0x0;_0x97fbc3<_0x51058b['Agents']['length'];_0x97fbc3+=0x1){let _0x38d763=_0x51058b['Agents'][_0x97fbc3];var _0x352a28=_0x32fc4d[_0xb7ca('0x78')]();_0x352a28[_0xb7ca('0x43')](_0xb7ca('0x79'),_0x38d763['id']);_0x259a41[_0xb7ca('0x7a')](db['sequelize']['query'](_0x352a28[_0xb7ca('0x7b')](),{'type':db[_0xb7ca('0x7c')][_0xb7ca('0x7d')][_0xb7ca('0x7e')]})[_0xb7ca('0x29')](function(_0x4d04c0){if(_0x4d04c0[_0xb7ca('0x3c')]===0x1){return _0x38d763['id'];}else{var _0x156cdb=_[_0xb7ca('0x7f')](_[_0xb7ca('0x35')](_0x4d04c0,_0xb7ca('0x80')),function(_0x279e48){return _[_0xb7ca('0x81')](_0x1f1a60,_0x279e48);});if(_0x156cdb){return _0x38d763['id'];}}}));}}return BPromise['all'](_0x259a41)['then'](function(_0x1d941f){_0x228035=_(_0x228035)['union'](_0x1d941f)[_0xb7ca('0x82')]()['value']();return db['FaxQueue'][_0xb7ca('0x4c')]({'where':{'id':_0x41c7b7[_0xb7ca('0x49')]['id']}})['then'](function(_0x5e9f20){return db[_0xb7ca('0x7c')]['transaction'](function(_0x145cb2){return _0x5e9f20[_0xb7ca('0x83')](_0x41c7b7[_0xb7ca('0x36')][_0xb7ca('0x84')],{'transaction':_0x145cb2})[_0xb7ca('0x29')](function(){if(!_['isEmpty'](_0x228035)){return _0x5e9f20[_0xb7ca('0x85')](_0x228035,{'transaction':_0x145cb2});}})['then'](function(){_0x228035['forEach'](function(_0x4ae116){socket[_0xb7ca('0x6e')](_0xb7ca('0x86'),{'UserId':_0x4ae116,'FaxQueueId':_0x5e9f20['id']});});});});});});})[_0xb7ca('0x29')](respondWithStatusCode(_0x2e4874,null))[_0xb7ca('0x48')](handleError(_0x2e4874,null));};exports[_0xb7ca('0x87')]=function(_0x296e8c,_0x2a3a82,_0x55da84){return db[_0xb7ca('0x30')][_0xb7ca('0x4c')]({'where':{'id':_0x296e8c[_0xb7ca('0x49')]['id']}})[_0xb7ca('0x29')](handleEntityNotFound(_0x2a3a82,null))[_0xb7ca('0x29')](function(_0x3f1099){if(_0x3f1099){return _0x3f1099[_0xb7ca('0x87')](_0x296e8c['body']['ids'],_[_0xb7ca('0x88')](_0x296e8c['body'],[_0xb7ca('0x84'),'id'])||{})['spread'](function(_0xba3208){for(var _0xd18c8f=0x0;_0xd18c8f<_0x296e8c['body'][_0xb7ca('0x84')][_0xb7ca('0x3c')];_0xd18c8f+=0x1){socket[_0xb7ca('0x6e')](_0xb7ca('0x6f'),{'UserId':Number(_0x296e8c[_0xb7ca('0x4e')][_0xb7ca('0x84')][_0xd18c8f]),'FaxQueueId':Number(_0x296e8c['params']['id'])});}return _0xba3208;});}})[_0xb7ca('0x29')](respondWithResult(_0x2a3a82,null))['catch'](handleError(_0x2a3a82,null));};exports[_0xb7ca('0x85')]=function(_0x2d4adc,_0x46669e,_0x4c9146){return db['FaxQueue'][_0xb7ca('0x4c')]({'where':{'id':_0x2d4adc['params']['id']}})[_0xb7ca('0x29')](handleEntityNotFound(_0x46669e,null))[_0xb7ca('0x29')](function(_0x2fa91a){if(_0x2fa91a){return _0x2fa91a[_0xb7ca('0x85')](_0x2d4adc['query']['ids'])[_0xb7ca('0x29')](function(){if(_[_0xb7ca('0x89')](_0x2d4adc[_0xb7ca('0x36')][_0xb7ca('0x84')])){for(var _0x290a22=0x0;_0x290a22<_0x2d4adc[_0xb7ca('0x36')][_0xb7ca('0x84')][_0xb7ca('0x3c')];_0x290a22+=0x1){socket[_0xb7ca('0x6e')]('userFaxQueue:remove',{'UserId':Number(_0x2d4adc[_0xb7ca('0x36')][_0xb7ca('0x84')][_0x290a22]),'FaxQueueId':Number(_0x2d4adc[_0xb7ca('0x49')]['id'])});}}else{socket[_0xb7ca('0x6e')](_0xb7ca('0x86'),{'UserId':Number(_0x2d4adc[_0xb7ca('0x36')][_0xb7ca('0x84')]),'FaxQueueId':Number(_0x2d4adc['params']['id'])});}});}})[_0xb7ca('0x29')](respondWithStatusCode(_0x46669e,null))[_0xb7ca('0x48')](handleError(_0x46669e,null));};exports['getAgents']=function(_0x2584d7,_0x2bbafe,_0xee65f8){var _0x4692c1={};var _0x2f5d24={};var _0x265280;var _0x472b3c;return db[_0xb7ca('0x30')][_0xb7ca('0x57')]({'where':{'id':_0x2584d7[_0xb7ca('0x49')]['id']}})[_0xb7ca('0x29')](handleEntityNotFound(_0x2bbafe,null))[_0xb7ca('0x29')](function(_0x1354b2){if(_0x1354b2){_0x265280=_0x1354b2;_0x2f5d24[_0xb7ca('0x34')]=_[_0xb7ca('0x37')](db[_0xb7ca('0x5a')][_0xb7ca('0x31')]);_0x2f5d24['query']=_[_0xb7ca('0x37')](_0x2584d7[_0xb7ca('0x36')]);_0x2f5d24[_0xb7ca('0x38')]=_[_0xb7ca('0x39')](_0x2f5d24['model'],_0x2f5d24[_0xb7ca('0x36')]);_0x4692c1[_0xb7ca('0x3b')]=_[_0xb7ca('0x39')](_0x2f5d24[_0xb7ca('0x34')],qs[_0xb7ca('0x3a')](_0x2584d7[_0xb7ca('0x36')][_0xb7ca('0x3a')]));_0x4692c1['attributes']=_0x4692c1[_0xb7ca('0x3b')][_0xb7ca('0x3c')]?_0x4692c1['attributes']:_0x2f5d24[_0xb7ca('0x34')];_0x4692c1[_0xb7ca('0x3e')]=qs[_0xb7ca('0x3f')](_0x2584d7[_0xb7ca('0x36')]['sort']);_0x4692c1[_0xb7ca('0x43')]=qs['filters'](_[_0xb7ca('0x40')](_0x2584d7[_0xb7ca('0x36')],_0x2f5d24[_0xb7ca('0x38')]));if(_0x2584d7[_0xb7ca('0x36')][_0xb7ca('0x41')]){_0x4692c1['where']=_['merge'](_0x4692c1[_0xb7ca('0x43')],{'$or':_[_0xb7ca('0x35')](_0x4692c1[_0xb7ca('0x3b')],function(_0x2ad1fc){var _0xfeea8={};_0xfeea8[_0x2ad1fc]={'$like':'%'+_0x2584d7[_0xb7ca('0x36')][_0xb7ca('0x41')]+'%'};return _0xfeea8;})});}_0x4692c1=_[_0xb7ca('0x42')]({},_0x4692c1,_0x2584d7['options']);return _0x265280['getAgents'](_0x4692c1);}})[_0xb7ca('0x29')](function(_0x3e945c){if(_0x3e945c){_0x472b3c=_0x3e945c[_0xb7ca('0x3c')];if(!_0x2584d7[_0xb7ca('0x36')][_0xb7ca('0x59')]('nolimit')){_0x4692c1['limit']=qs[_0xb7ca('0x21')](_0x2584d7[_0xb7ca('0x36')][_0xb7ca('0x21')]);_0x4692c1['offset']=qs['offset'](_0x2584d7['query'][_0xb7ca('0x1f')]);}return _0x265280[_0xb7ca('0x8a')](_0x4692c1);}})['then'](function(_0xc490fc){if(_0xc490fc){return _0xc490fc?{'count':_0x472b3c,'rows':_0xc490fc}:null;}})[_0xb7ca('0x29')](respondWithResult(_0x2bbafe,null))[_0xb7ca('0x48')](handleError(_0x2bbafe,null));}; \ No newline at end of file +var _0x95e7=['%s/%s','faxPause','getTeams','Team','addTeams','ids','online','voicePause','interface','flatMap','sequelize','transaction','forEach','userFaxQueue:save','Agents','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','toString','TeamId','all','union','compact','value','emit','addAgents','omit','removeAgents','isArray','userFaxQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','crypto','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','get','FaxQueues','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','nolimit','sort','filter','where','merge','type','VIRTUAL','options','FaxQueue','findAll','rows','catch','show','params','fields','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','order','pick','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x95e7,0x137));var _0x795e=function(_0x2e97f1,_0x52b24f){_0x2e97f1=_0x2e97f1-0x0;var _0x230279=_0x95e7[_0x2e97f1];return _0x230279;};'use strict';var emlformat=require(_0x795e('0x0'));var rimraf=require(_0x795e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x795e('0x2'));var rp=require(_0x795e('0x3'));var moment=require(_0x795e('0x4'));var BPromise=require(_0x795e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x795e('0x6'));var sox=require(_0x795e('0x7'));var csv=require(_0x795e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x795e('0x9'));var _=require(_0x795e('0xa'));var squel=require('squel');var crypto=require(_0x795e('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x795e('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x795e('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x795e('0xe'));var hardwareService=require(_0x795e('0xf'));var logger=require(_0x795e('0x10'))(_0x795e('0x11'));var utils=require(_0x795e('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x795e('0x13'))['db'];config[_0x795e('0x14')]=_[_0x795e('0x15')](config['redis'],{'host':_0x795e('0x16'),'port':0x18eb});var socket=require(_0x795e('0x17'))(new Redis(config[_0x795e('0x14')]));require('./faxQueue.socket')[_0x795e('0x18')](socket);function respondWithStatusCode(_0x550b0d,_0x5f02a2){_0x5f02a2=_0x5f02a2||0xcc;return function(_0x5d01d6){if(_0x5d01d6){return _0x550b0d['sendStatus'](_0x5f02a2);}return _0x550b0d[_0x795e('0x19')](_0x5f02a2)[_0x795e('0x1a')]();};}function respondWithResult(_0x13ba79,_0x38e1c4){_0x38e1c4=_0x38e1c4||0xc8;return function(_0xdfe019){if(_0xdfe019){return _0x13ba79[_0x795e('0x19')](_0x38e1c4)[_0x795e('0x1b')](_0xdfe019);}};}function respondWithFilteredResult(_0x3a97e2,_0x5e2b47){return function(_0x228732){if(_0x228732){var _0x7b40cf=typeof _0x5e2b47[_0x795e('0x1c')]==='undefined'&&typeof _0x5e2b47[_0x795e('0x1d')]==='undefined';var _0x282133=_0x228732[_0x795e('0x1e')];var _0x54004b=_0x7b40cf?0x0:_0x5e2b47[_0x795e('0x1c')];var _0x938ae2=_0x7b40cf?_0x228732['count']:_0x5e2b47[_0x795e('0x1c')]+_0x5e2b47[_0x795e('0x1d')];var _0x172f1d;if(_0x938ae2>=_0x282133){_0x938ae2=_0x282133;_0x172f1d=0xc8;}else{_0x172f1d=0xce;}_0x3a97e2['status'](_0x172f1d);return _0x3a97e2[_0x795e('0x1f')](_0x795e('0x20'),_0x54004b+'-'+_0x938ae2+'/'+_0x282133)[_0x795e('0x1b')](_0x228732);}return null;};}function patchUpdates(_0x4ee5b1){return function(_0x2a6b7b){try{jsonpatch['apply'](_0x2a6b7b,_0x4ee5b1,!![]);}catch(_0x5f1e26){return BPromise[_0x795e('0x21')](_0x5f1e26);}return _0x2a6b7b[_0x795e('0x22')]();};}function saveUpdates(_0x570965,_0x59561d){return function(_0x2cfea0){if(_0x2cfea0){return _0x2cfea0[_0x795e('0x23')](_0x570965)[_0x795e('0x24')](function(_0xef65a4){return _0xef65a4;});}return null;};}function removeEntity(_0x398b69,_0x40b3ea){return function(_0x37a188){if(_0x37a188){return _0x37a188[_0x795e('0x25')]()[_0x795e('0x24')](function(){var _0x5b3e31=_0x37a188[_0x795e('0x26')]({'plain':!![]});var _0x5dc148=_0x795e('0x27');return db['UserProfileResource'][_0x795e('0x25')]({'where':{'type':_0x5dc148,'resourceId':_0x5b3e31['id']}})['then'](function(){return _0x37a188;});})[_0x795e('0x24')](function(){_0x398b69['status'](0xcc)[_0x795e('0x1a')]();});}};}function handleEntityNotFound(_0x30c89a,_0x241784){return function(_0x414366){if(!_0x414366){_0x30c89a[_0x795e('0x28')](0x194);}return _0x414366;};}function handleError(_0x501523,_0x206200){_0x206200=_0x206200||0x1f4;return function(_0x2faa78){logger[_0x795e('0x29')](_0x2faa78[_0x795e('0x2a')]);if(_0x2faa78[_0x795e('0x2b')]){delete _0x2faa78['name'];}_0x501523[_0x795e('0x19')](_0x206200)[_0x795e('0x2c')](_0x2faa78);};}exports[_0x795e('0x2d')]=function(_0x4dbb49,_0x21affc){var _0x4915d6={},_0x339de7={},_0x3a4956={'count':0x0,'rows':[]};var _0x57c524=_[_0x795e('0x2e')](db['FaxQueue'][_0x795e('0x2f')],function(_0x2eddd7){return{'name':_0x2eddd7[_0x795e('0x30')],'type':_0x2eddd7['type'][_0x795e('0x31')]};});_0x339de7[_0x795e('0x32')]=_[_0x795e('0x2e')](_0x57c524,_0x795e('0x2b'));_0x339de7[_0x795e('0x33')]=_[_0x795e('0x34')](_0x4dbb49[_0x795e('0x33')]);_0x339de7[_0x795e('0x35')]=_[_0x795e('0x36')](_0x339de7[_0x795e('0x32')],_0x339de7[_0x795e('0x33')]);_0x4915d6[_0x795e('0x37')]=_[_0x795e('0x36')](_0x339de7[_0x795e('0x32')],qs['fields'](_0x4dbb49[_0x795e('0x33')]['fields']));_0x4915d6['attributes']=_0x4915d6[_0x795e('0x37')][_0x795e('0x38')]?_0x4915d6['attributes']:_0x339de7[_0x795e('0x32')];if(!_0x4dbb49[_0x795e('0x33')]['hasOwnProperty'](_0x795e('0x39'))){_0x4915d6[_0x795e('0x1d')]=qs[_0x795e('0x1d')](_0x4dbb49[_0x795e('0x33')][_0x795e('0x1d')]);_0x4915d6['offset']=qs[_0x795e('0x1c')](_0x4dbb49[_0x795e('0x33')][_0x795e('0x1c')]);}_0x4915d6['order']=qs[_0x795e('0x3a')](_0x4dbb49['query'][_0x795e('0x3a')]);_0x4915d6['where']=qs[_0x795e('0x35')](_['pick'](_0x4dbb49[_0x795e('0x33')],_0x339de7[_0x795e('0x35')]),_0x57c524);if(_0x4dbb49['query'][_0x795e('0x3b')]){_0x4915d6[_0x795e('0x3c')]=_[_0x795e('0x3d')](_0x4915d6[_0x795e('0x3c')],{'$or':_[_0x795e('0x2e')](_0x57c524,function(_0x165e10){if(_0x165e10[_0x795e('0x3e')]!==_0x795e('0x3f')){var _0x1916ad={};_0x1916ad[_0x165e10['name']]={'$like':'%'+_0x4dbb49['query'][_0x795e('0x3b')]+'%'};return _0x1916ad;}})});}_0x4915d6=_[_0x795e('0x3d')]({},_0x4915d6,_0x4dbb49[_0x795e('0x40')]);var _0x31584e={'where':_0x4915d6[_0x795e('0x3c')]};return db[_0x795e('0x41')][_0x795e('0x1e')](_0x31584e)[_0x795e('0x24')](function(_0x4cd2c1){_0x3a4956[_0x795e('0x1e')]=_0x4cd2c1;if(_0x4dbb49[_0x795e('0x33')]['includeAll']){_0x4915d6['include']=[{'all':!![]}];}return db[_0x795e('0x41')][_0x795e('0x42')](_0x4915d6);})['then'](function(_0x23bbaf){_0x3a4956[_0x795e('0x43')]=_0x23bbaf;return _0x3a4956;})[_0x795e('0x24')](respondWithFilteredResult(_0x21affc,_0x4915d6))[_0x795e('0x44')](handleError(_0x21affc,null));};exports[_0x795e('0x45')]=function(_0x21ccbb,_0x179454){var _0x363a88={'raw':!![],'where':{'id':_0x21ccbb[_0x795e('0x46')]['id']}},_0x58c7c0={};_0x58c7c0[_0x795e('0x32')]=_['keys'](db[_0x795e('0x41')][_0x795e('0x2f')]);_0x58c7c0[_0x795e('0x33')]=_[_0x795e('0x34')](_0x21ccbb[_0x795e('0x33')]);_0x58c7c0[_0x795e('0x35')]=_[_0x795e('0x36')](_0x58c7c0[_0x795e('0x32')],_0x58c7c0[_0x795e('0x33')]);_0x363a88['attributes']=_[_0x795e('0x36')](_0x58c7c0[_0x795e('0x32')],qs[_0x795e('0x47')](_0x21ccbb[_0x795e('0x33')][_0x795e('0x47')]));_0x363a88[_0x795e('0x37')]=_0x363a88[_0x795e('0x37')][_0x795e('0x38')]?_0x363a88['attributes']:_0x58c7c0[_0x795e('0x32')];if(_0x21ccbb[_0x795e('0x33')][_0x795e('0x48')]){_0x363a88['include']=[{'all':!![]}];}_0x363a88=_['merge']({},_0x363a88,_0x21ccbb[_0x795e('0x40')]);return db['FaxQueue'][_0x795e('0x49')](_0x363a88)[_0x795e('0x24')](handleEntityNotFound(_0x179454,null))[_0x795e('0x24')](respondWithResult(_0x179454,null))['catch'](handleError(_0x179454,null));};exports[_0x795e('0x4a')]=function(_0x37d3ee,_0x482617){return db[_0x795e('0x41')][_0x795e('0x4a')](_0x37d3ee[_0x795e('0x4b')],{})[_0x795e('0x24')](function(_0xc42b85){var _0x4c4dc1=_0x37d3ee[_0x795e('0x4c')][_0x795e('0x26')]({'plain':!![]});if(!_0x4c4dc1)throw new Error(_0x795e('0x4d'));if(_0x4c4dc1['role']===_0x795e('0x4c')){var _0x22cd3b=_0xc42b85['get']({'plain':!![]});var _0x419025='FaxQueues';return db[_0x795e('0x4e')][_0x795e('0x49')]({'where':{'name':_0x419025,'userProfileId':_0x4c4dc1[_0x795e('0x4f')]},'raw':!![]})[_0x795e('0x24')](function(_0xc8b3e6){if(_0xc8b3e6&&_0xc8b3e6[_0x795e('0x50')]===0x0){return db[_0x795e('0x51')][_0x795e('0x4a')]({'name':_0x22cd3b[_0x795e('0x2b')],'resourceId':_0x22cd3b['id'],'type':_0xc8b3e6[_0x795e('0x2b')],'sectionId':_0xc8b3e6['id']},{})['then'](function(){return _0xc42b85;});}else{return _0xc42b85;}})[_0x795e('0x44')](function(_0x2ea814){logger[_0x795e('0x29')](_0x795e('0x52'),_0x2ea814);throw _0x2ea814;});}return _0xc42b85;})[_0x795e('0x24')](respondWithResult(_0x482617,0xc9))['catch'](handleError(_0x482617,null));};exports[_0x795e('0x23')]=function(_0x16cbab,_0x271717){if(_0x16cbab[_0x795e('0x4b')]['id']){delete _0x16cbab[_0x795e('0x4b')]['id'];}return db[_0x795e('0x41')][_0x795e('0x49')]({'where':{'id':_0x16cbab[_0x795e('0x46')]['id']}})[_0x795e('0x24')](handleEntityNotFound(_0x271717,null))['then'](saveUpdates(_0x16cbab['body'],null))[_0x795e('0x24')](respondWithResult(_0x271717,null))[_0x795e('0x44')](handleError(_0x271717,null));};exports[_0x795e('0x25')]=function(_0x46aac3,_0x3bf42d){return db['FaxQueue']['find']({'where':{'id':_0x46aac3[_0x795e('0x46')]['id']}})['then'](handleEntityNotFound(_0x3bf42d,null))[_0x795e('0x24')](removeEntity(_0x3bf42d,null))['catch'](handleError(_0x3bf42d,null));};exports[_0x795e('0x53')]=function(_0x4c7d36,_0x304c6b){return db[_0x795e('0x41')]['describe']()[_0x795e('0x24')](respondWithResult(_0x304c6b,null))[_0x795e('0x44')](handleError(_0x304c6b,null));};exports[_0x795e('0x54')]=function(_0x4a742d,_0x1feca5,_0x4ea54f){var _0x299ed7={'raw':!![],'where':{}},_0x1bb2fb={},_0x1546da;return db[_0x795e('0x41')][_0x795e('0x55')]({'where':{'id':_0x4a742d[_0x795e('0x46')]['id']}})[_0x795e('0x24')](handleEntityNotFound(_0x1feca5,null))[_0x795e('0x24')](function(_0x6d795e){if(_0x6d795e){_0x1546da=_0x6d795e[_0x795e('0x26')]({'plain':!![]});_0x1bb2fb[_0x795e('0x32')]=_[_0x795e('0x34')](db[_0x795e('0x56')][_0x795e('0x2f')]);_0x1bb2fb[_0x795e('0x33')]=_[_0x795e('0x34')](_0x4a742d[_0x795e('0x33')]);_0x1bb2fb[_0x795e('0x35')]=_[_0x795e('0x36')](_0x1bb2fb['model'],_0x1bb2fb[_0x795e('0x33')]);_0x299ed7[_0x795e('0x37')]=_[_0x795e('0x36')](_0x1bb2fb[_0x795e('0x32')],qs['fields'](_0x4a742d[_0x795e('0x33')][_0x795e('0x47')]));_0x299ed7[_0x795e('0x37')]=_0x299ed7[_0x795e('0x37')][_0x795e('0x38')]?_0x299ed7[_0x795e('0x37')]:_0x1bb2fb[_0x795e('0x32')];if(!_0x4a742d[_0x795e('0x33')][_0x795e('0x57')](_0x795e('0x39'))){_0x299ed7[_0x795e('0x1d')]=qs[_0x795e('0x1d')](_0x4a742d[_0x795e('0x33')][_0x795e('0x1d')]);_0x299ed7[_0x795e('0x1c')]=qs[_0x795e('0x1c')](_0x4a742d[_0x795e('0x33')]['offset']);}_0x299ed7[_0x795e('0x58')]=qs[_0x795e('0x3a')](_0x4a742d['query']['sort']);_0x299ed7[_0x795e('0x3c')]=qs[_0x795e('0x35')](_[_0x795e('0x59')](_0x4a742d['query'],_0x1bb2fb[_0x795e('0x35')]));_0x299ed7['where']['FaxQueueId']=_0x6d795e['id'];if(_0x4a742d[_0x795e('0x33')][_0x795e('0x3b')]){_0x299ed7[_0x795e('0x3c')]=_[_0x795e('0x3d')](_0x299ed7[_0x795e('0x3c')],{'$or':_['map'](_0x299ed7[_0x795e('0x37')],function(_0x533b2c){var _0x532a8b={};_0x532a8b[_0x533b2c]={'$like':'%'+_0x4a742d[_0x795e('0x33')]['filter']+'%'};return _0x532a8b;})});}_0x299ed7=_[_0x795e('0x3d')]({},_0x299ed7,_0x4a742d[_0x795e('0x40')]);return db[_0x795e('0x56')][_0x795e('0x42')](_0x299ed7);}})[_0x795e('0x24')](function(_0x83d9c0){if(_0x83d9c0){return db[_0x795e('0x5a')][_0x795e('0x5b')]({'where':{'id':_[_0x795e('0x2e')](_0x83d9c0,_0x795e('0x5c')),'role':_0x795e('0x5d')},'attributes':['id',_0x795e('0x2b'),'faxPause',_0x795e('0x5e'),_0x795e('0x5f')]});}})[_0x795e('0x24')](function(_0x358f04){if(_0x358f04){return{'count':_0x358f04[_0x795e('0x1e')],'rows':_[_0x795e('0x2e')](_0x358f04[_0x795e('0x43')],function(_0x16cfdf){return{'membername':_0x16cfdf[_0x795e('0x2b')],'UserId':_0x16cfdf['id'],'queue_name':_0x1546da[_0x795e('0x2b')],'FaxQueueId':_0x1546da['id'],'interface':util[_0x795e('0x60')](_0x795e('0x61'),'SIP',_0x16cfdf[_0x795e('0x2b')]),'penalty':0x0,'paused':_0x16cfdf[_0x795e('0x62')],'createdAt':_0x16cfdf['createdAt'],'updatedAt':_0x16cfdf[_0x795e('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x795e('0x24')](respondWithFilteredResult(_0x1feca5,_0x299ed7))['catch'](handleError(_0x1feca5,null));};exports[_0x795e('0x63')]=function(_0x22ac82,_0x5a6208,_0x151094){var _0x15ead8={};var _0x345c8e={};var _0x1542de;var _0x3a3911;return db['FaxQueue'][_0x795e('0x55')]({'where':{'id':_0x22ac82[_0x795e('0x46')]['id']}})[_0x795e('0x24')](handleEntityNotFound(_0x5a6208,null))[_0x795e('0x24')](function(_0x76df1a){if(_0x76df1a){_0x1542de=_0x76df1a;_0x345c8e[_0x795e('0x32')]=_[_0x795e('0x34')](db[_0x795e('0x64')][_0x795e('0x2f')]);_0x345c8e[_0x795e('0x33')]=_['keys'](_0x22ac82['query']);_0x345c8e['filters']=_[_0x795e('0x36')](_0x345c8e['model'],_0x345c8e['query']);_0x15ead8[_0x795e('0x37')]=_['intersection'](_0x345c8e[_0x795e('0x32')],qs[_0x795e('0x47')](_0x22ac82['query'][_0x795e('0x47')]));_0x15ead8[_0x795e('0x37')]=_0x15ead8[_0x795e('0x37')][_0x795e('0x38')]?_0x15ead8['attributes']:_0x345c8e['model'];_0x15ead8[_0x795e('0x58')]=qs[_0x795e('0x3a')](_0x22ac82[_0x795e('0x33')][_0x795e('0x3a')]);_0x15ead8[_0x795e('0x3c')]=qs[_0x795e('0x35')](_[_0x795e('0x59')](_0x22ac82['query'],_0x345c8e[_0x795e('0x35')]));if(_0x22ac82[_0x795e('0x33')][_0x795e('0x3b')]){_0x15ead8[_0x795e('0x3c')]=_[_0x795e('0x3d')](_0x15ead8[_0x795e('0x3c')],{'$or':_['map'](_0x15ead8[_0x795e('0x37')],function(_0x9252d0){var _0x3740c9={};_0x3740c9[_0x9252d0]={'$like':'%'+_0x22ac82[_0x795e('0x33')]['filter']+'%'};return _0x3740c9;})});}_0x15ead8=_[_0x795e('0x3d')]({},_0x15ead8,_0x22ac82[_0x795e('0x40')]);return _0x1542de[_0x795e('0x63')](_0x15ead8);}})[_0x795e('0x24')](function(_0x47f711){if(_0x47f711){_0x3a3911=_0x47f711[_0x795e('0x38')];if(!_0x22ac82[_0x795e('0x33')][_0x795e('0x57')]('nolimit')){_0x15ead8[_0x795e('0x1d')]=qs[_0x795e('0x1d')](_0x22ac82[_0x795e('0x33')][_0x795e('0x1d')]);_0x15ead8[_0x795e('0x1c')]=qs['offset'](_0x22ac82[_0x795e('0x33')][_0x795e('0x1c')]);}return _0x1542de[_0x795e('0x63')](_0x15ead8);}})[_0x795e('0x24')](function(_0x4d1d31){if(_0x4d1d31){return _0x4d1d31?{'count':_0x3a3911,'rows':_0x4d1d31}:null;}})['then'](respondWithResult(_0x5a6208,null))[_0x795e('0x44')](handleError(_0x5a6208,null));};exports[_0x795e('0x65')]=function(_0x1d494e,_0x2d0a62,_0x3f6d7d){var _0x5b8dbe=_0x1d494e[_0x795e('0x4b')][_0x795e('0x66')];return db[_0x795e('0x64')]['findAll']({'where':{'id':_0x5b8dbe},'attributes':['id'],'include':[{'model':db[_0x795e('0x5a')],'as':'Agents','attributes':['id','name',_0x795e('0x67'),_0x795e('0x68'),_0x795e('0x69')],'raw':!![]}]})[_0x795e('0x24')](function(_0x515528){if(_0x515528){var _0x1c9340=_[_0x795e('0x6a')](_0x515528,function(_0x543949){var _0x238821=_0x543949['get']({'plain':!![]});return _0x238821['Agents'];});return db[_0x795e('0x41')][_0x795e('0x49')]({'where':{'id':_0x1d494e[_0x795e('0x46')]['id']}})[_0x795e('0x24')](function(_0x3737fa){return db[_0x795e('0x6b')][_0x795e('0x6c')](function(_0x1712ed){return _0x3737fa[_0x795e('0x65')](_0x5b8dbe,{'transaction':_0x1712ed})[_0x795e('0x24')](function(){return BPromise['each'](_0x1c9340,function(_0x133900){return db[_0x795e('0x56')]['findOrCreate']({'where':{'UserId':_0x133900['id'],'FaxQueueId':_0x1d494e[_0x795e('0x46')]['id']},'transaction':_0x1712ed});});})['then'](function(){_0x1c9340[_0x795e('0x6d')](function(_0xa69358){socket['emit'](_0x795e('0x6e'),{'UserId':_0xa69358['id'],'FaxQueueId':_0x3737fa['id']});});});});});}})[_0x795e('0x24')](respondWithStatusCode(_0x2d0a62,null))['catch'](handleError(_0x2d0a62,null));};exports['removeTeams']=function(_0x576fbc,_0x4b185a,_0xf6dd26){return db[_0x795e('0x64')][_0x795e('0x42')]({'where':{'id':_0x576fbc[_0x795e('0x33')][_0x795e('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x795e('0x6f'),'attributes':['id'],'raw':!![]}]})[_0x795e('0x24')](handleEntityNotFound(_0x4b185a,null))[_0x795e('0x24')](function(_0x11ba1f){var _0x91549c=_['map'](_0x11ba1f,'id');var _0x1e1d37=[];var _0x3189b6=[];var _0x3bcc8e=squel[_0x795e('0x70')]();_0x3bcc8e[_0x795e('0x71')](_0x795e('0x72'))[_0x795e('0x73')](_0x795e('0x74'),'tq')[_0x795e('0x75')](_0x795e('0x76'),'ut',_0x795e('0x77'))[_0x795e('0x3c')](_0x795e('0x78'),_0x576fbc[_0x795e('0x46')]['id']);for(var _0x40d196=0x0;_0x40d196<_0x11ba1f[_0x795e('0x38')];_0x40d196+=0x1){let _0x190f76=_0x11ba1f[_0x40d196];for(var _0x3d649e=0x0;_0x3d649e<_0x190f76['Agents'][_0x795e('0x38')];_0x3d649e+=0x1){let _0x1d4b44=_0x190f76['Agents'][_0x3d649e];var _0xd0c610=_0x3bcc8e[_0x795e('0x79')]();_0xd0c610[_0x795e('0x3c')]('ut.UserId\x20=\x20?',_0x1d4b44['id']);_0x3189b6[_0x795e('0x7a')](db['sequelize'][_0x795e('0x33')](_0xd0c610[_0x795e('0x7b')](),{'type':db[_0x795e('0x6b')]['QueryTypes']['SELECT']})[_0x795e('0x24')](function(_0x2a3454){if(_0x2a3454[_0x795e('0x38')]===0x1){return _0x1d4b44['id'];}else{var _0x1853fd=_['every'](_[_0x795e('0x2e')](_0x2a3454,_0x795e('0x7c')),function(_0x1d14e4){return _['includes'](_0x91549c,_0x1d14e4);});if(_0x1853fd){return _0x1d4b44['id'];}}}));}}return BPromise[_0x795e('0x7d')](_0x3189b6)['then'](function(_0x24b479){_0x1e1d37=_(_0x1e1d37)[_0x795e('0x7e')](_0x24b479)[_0x795e('0x7f')]()[_0x795e('0x80')]();return db['FaxQueue'][_0x795e('0x49')]({'where':{'id':_0x576fbc[_0x795e('0x46')]['id']}})[_0x795e('0x24')](function(_0x2de2d2){return db[_0x795e('0x6b')][_0x795e('0x6c')](function(_0x34c3b1){return _0x2de2d2['removeTeams'](_0x576fbc[_0x795e('0x33')][_0x795e('0x66')],{'transaction':_0x34c3b1})[_0x795e('0x24')](function(){if(!_['isEmpty'](_0x1e1d37)){return _0x2de2d2['removeAgents'](_0x1e1d37,{'transaction':_0x34c3b1});}})[_0x795e('0x24')](function(){_0x1e1d37[_0x795e('0x6d')](function(_0x45402f){socket[_0x795e('0x81')]('userFaxQueue:remove',{'UserId':_0x45402f,'FaxQueueId':_0x2de2d2['id']});});});});});});})[_0x795e('0x24')](respondWithStatusCode(_0x4b185a,null))[_0x795e('0x44')](handleError(_0x4b185a,null));};exports[_0x795e('0x82')]=function(_0x3a7ddb,_0x24df2a,_0x5b1c51){return db[_0x795e('0x41')][_0x795e('0x49')]({'where':{'id':_0x3a7ddb[_0x795e('0x46')]['id']}})[_0x795e('0x24')](handleEntityNotFound(_0x24df2a,null))[_0x795e('0x24')](function(_0x304213){if(_0x304213){return _0x304213[_0x795e('0x82')](_0x3a7ddb[_0x795e('0x4b')][_0x795e('0x66')],_[_0x795e('0x83')](_0x3a7ddb[_0x795e('0x4b')],['ids','id'])||{})['spread'](function(_0x3374a8){for(var _0x2d62e1=0x0;_0x2d62e1<_0x3a7ddb[_0x795e('0x4b')]['ids'][_0x795e('0x38')];_0x2d62e1+=0x1){socket[_0x795e('0x81')](_0x795e('0x6e'),{'UserId':Number(_0x3a7ddb[_0x795e('0x4b')]['ids'][_0x2d62e1]),'FaxQueueId':Number(_0x3a7ddb['params']['id'])});}return _0x3374a8;});}})['then'](respondWithResult(_0x24df2a,null))[_0x795e('0x44')](handleError(_0x24df2a,null));};exports[_0x795e('0x84')]=function(_0x5dfb7f,_0x230809,_0x5c804b){return db[_0x795e('0x41')][_0x795e('0x49')]({'where':{'id':_0x5dfb7f[_0x795e('0x46')]['id']}})['then'](handleEntityNotFound(_0x230809,null))['then'](function(_0x440a55){if(_0x440a55){return _0x440a55[_0x795e('0x84')](_0x5dfb7f[_0x795e('0x33')]['ids'])[_0x795e('0x24')](function(){if(_[_0x795e('0x85')](_0x5dfb7f[_0x795e('0x33')][_0x795e('0x66')])){for(var _0xe4a705=0x0;_0xe4a705<_0x5dfb7f[_0x795e('0x33')][_0x795e('0x66')]['length'];_0xe4a705+=0x1){socket[_0x795e('0x81')](_0x795e('0x86'),{'UserId':Number(_0x5dfb7f[_0x795e('0x33')]['ids'][_0xe4a705]),'FaxQueueId':Number(_0x5dfb7f[_0x795e('0x46')]['id'])});}}else{socket[_0x795e('0x81')](_0x795e('0x86'),{'UserId':Number(_0x5dfb7f[_0x795e('0x33')][_0x795e('0x66')]),'FaxQueueId':Number(_0x5dfb7f[_0x795e('0x46')]['id'])});}});}})['then'](respondWithStatusCode(_0x230809,null))['catch'](handleError(_0x230809,null));};exports[_0x795e('0x87')]=function(_0x3f6762,_0x3d4999,_0x289971){var _0x18d1ae={};var _0x2ce155={};var _0x185c83;var _0x22bfbd;return db[_0x795e('0x41')]['findOne']({'where':{'id':_0x3f6762[_0x795e('0x46')]['id']}})[_0x795e('0x24')](handleEntityNotFound(_0x3d4999,null))[_0x795e('0x24')](function(_0x55a2a6){if(_0x55a2a6){_0x185c83=_0x55a2a6;_0x2ce155[_0x795e('0x32')]=_['keys'](db[_0x795e('0x5a')][_0x795e('0x2f')]);_0x2ce155['query']=_[_0x795e('0x34')](_0x3f6762['query']);_0x2ce155[_0x795e('0x35')]=_[_0x795e('0x36')](_0x2ce155[_0x795e('0x32')],_0x2ce155[_0x795e('0x33')]);_0x18d1ae[_0x795e('0x37')]=_[_0x795e('0x36')](_0x2ce155[_0x795e('0x32')],qs['fields'](_0x3f6762['query'][_0x795e('0x47')]));_0x18d1ae[_0x795e('0x37')]=_0x18d1ae[_0x795e('0x37')][_0x795e('0x38')]?_0x18d1ae[_0x795e('0x37')]:_0x2ce155[_0x795e('0x32')];_0x18d1ae[_0x795e('0x58')]=qs['sort'](_0x3f6762[_0x795e('0x33')]['sort']);_0x18d1ae['where']=qs[_0x795e('0x35')](_[_0x795e('0x59')](_0x3f6762[_0x795e('0x33')],_0x2ce155[_0x795e('0x35')]));if(_0x3f6762[_0x795e('0x33')]['filter']){_0x18d1ae[_0x795e('0x3c')]=_[_0x795e('0x3d')](_0x18d1ae['where'],{'$or':_['map'](_0x18d1ae['attributes'],function(_0x678ea4){var _0x7b17a2={};_0x7b17a2[_0x678ea4]={'$like':'%'+_0x3f6762[_0x795e('0x33')][_0x795e('0x3b')]+'%'};return _0x7b17a2;})});}_0x18d1ae=_['merge']({},_0x18d1ae,_0x3f6762[_0x795e('0x40')]);return _0x185c83[_0x795e('0x87')](_0x18d1ae);}})[_0x795e('0x24')](function(_0x3cfd3c){if(_0x3cfd3c){_0x22bfbd=_0x3cfd3c[_0x795e('0x38')];if(!_0x3f6762[_0x795e('0x33')][_0x795e('0x57')](_0x795e('0x39'))){_0x18d1ae['limit']=qs['limit'](_0x3f6762['query'][_0x795e('0x1d')]);_0x18d1ae['offset']=qs['offset'](_0x3f6762[_0x795e('0x33')][_0x795e('0x1c')]);}return _0x185c83[_0x795e('0x87')](_0x18d1ae);}})[_0x795e('0x24')](function(_0x4daa4c){if(_0x4daa4c){return _0x4daa4c?{'count':_0x22bfbd,'rows':_0x4daa4c}:null;}})['then'](respondWithResult(_0x3d4999,null))[_0x795e('0x44')](handleError(_0x3d4999,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 7461d47..1560a23 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 _0x97fa=['remove','emit','hasOwnProperty','exports','events','FaxQueue','setMaxListeners'];(function(_0x43c920,_0x19b4eb){var _0x1c7cb6=function(_0x556815){while(--_0x556815){_0x43c920['push'](_0x43c920['shift']());}};_0x1c7cb6(++_0x19b4eb);}(_0x97fa,0x1bd));var _0xa97f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x97fa[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xa97f('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0xa97f('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xa97f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa97f('0x3')};function emitEvent(_0x2200db){return function(_0x1e7c78,_0xc8d666,_0x26f046){FaxQueueEvents[_0xa97f('0x4')](_0x2200db+':'+_0x1e7c78['id'],_0x1e7c78);FaxQueueEvents[_0xa97f('0x4')](_0x2200db,_0x1e7c78);_0x26f046(null);};}for(var e in events){if(events[_0xa97f('0x5')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xa97f('0x6')]=FaxQueueEvents; \ No newline at end of file +var _0x5556=['events','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2239d4,_0x387000){var _0x12da04=function(_0x1bfd42){while(--_0x1bfd42){_0x2239d4['push'](_0x2239d4['shift']());}};_0x12da04(++_0x387000);}(_0x5556,0x1ce));var _0x6555=function(_0x4f7ca7,_0x5099e7){_0x4f7ca7=_0x4f7ca7-0x0;var _0x55f6b0=_0x5556[_0x4f7ca7];return _0x55f6b0;};'use strict';var EventEmitter=require(_0x6555('0x0'));var FaxQueue=require(_0x6555('0x1'))['db'][_0x6555('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x6555('0x3')](0x0);var events={'afterCreate':_0x6555('0x4'),'afterUpdate':_0x6555('0x5'),'afterDestroy':_0x6555('0x6')};function emitEvent(_0x202a08){return function(_0x346369,_0x16f000,_0x6148f8){FaxQueueEvents[_0x6555('0x7')](_0x202a08+':'+_0x346369['id'],_0x346369);FaxQueueEvents[_0x6555('0x7')](_0x202a08,_0x346369);_0x6148f8(null);};}for(var e in events){if(events[_0x6555('0x8')](e)){var event=events[e];FaxQueue[_0x6555('0x9')](e,emitEvent(event));}}module[_0x6555('0xa')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 5c8e76e..c7630bc 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 _0xb701=['rimraf','./faxQueue.attributes','exports','define','FaxQueue','lodash','util','../../config/logger','moment','bluebird'];(function(_0x4828b1,_0x5c8cf3){var _0x1fec1b=function(_0x3f2e5a){while(--_0x3f2e5a){_0x4828b1['push'](_0x4828b1['shift']());}};_0x1fec1b(++_0x5c8cf3);}(_0xb701,0x1a9));var _0x1b70=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xb701[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x1b70('0x0'));var util=require(_0x1b70('0x1'));var logger=require(_0x1b70('0x2'))('api');var moment=require(_0x1b70('0x3'));var BPromise=require(_0x1b70('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b70('0x5'));var config=require('../../config/environment');var attributes=require(_0x1b70('0x6'));module[_0x1b70('0x7')]=function(_0x5a3115,_0x1b215c){return _0x5a3115[_0x1b70('0x8')](_0x1b70('0x9'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa1a=['rimraf','../../config/environment','./faxQueue.attributes','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x8cb724,_0x5e78d5){var _0x348d6f=function(_0x7b70ea){while(--_0x7b70ea){_0x8cb724['push'](_0x8cb724['shift']());}};_0x348d6f(++_0x5e78d5);}(_0xaa1a,0x17f));var _0xaaa1=function(_0x325501,_0x5242f6){_0x325501=_0x325501-0x0;var _0x2c1626=_0xaa1a[_0x325501];return _0x2c1626;};'use strict';var _=require(_0xaaa1('0x0'));var util=require(_0xaaa1('0x1'));var logger=require(_0xaaa1('0x2'))('api');var moment=require(_0xaaa1('0x3'));var BPromise=require(_0xaaa1('0x4'));var rp=require(_0xaaa1('0x5'));var fs=require('fs');var path=require(_0xaaa1('0x6'));var rimraf=require(_0xaaa1('0x7'));var config=require(_0xaaa1('0x8'));var attributes=require(_0xaaa1('0x9'));module['exports']=function(_0x31fc48,_0x5527a6){return _0x31fc48['define']('FaxQueue',attributes,{'tableName':'fax_queues','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 a919335..8a3163b 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 _0x6a6a=['http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','where','attributes','limit','include','model','map','ShowFaxQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x11a06e,_0x596882){var _0x4c9e6c=function(_0x21b2e3){while(--_0x21b2e3){_0x11a06e['push'](_0x11a06e['shift']());}};_0x4c9e6c(++_0x596882);}(_0x6a6a,0x74));var _0xa6a6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6a6a[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xa6a6('0x0'));var util=require(_0xa6a6('0x1'));var moment=require(_0xa6a6('0x2'));var BPromise=require(_0xa6a6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa6a6('0x4'));var db=require(_0xa6a6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa6a6('0x6'))(_0xa6a6('0x7'));var config=require(_0xa6a6('0x8'));var jayson=require(_0xa6a6('0x9'));var client=jayson['client'][_0xa6a6('0xa')]({'port':0x232a});config[_0xa6a6('0xb')]=_[_0xa6a6('0xc')](config['redis'],{'host':_0xa6a6('0xd'),'port':0x18eb});var socket=require(_0xa6a6('0xe'))(new Redis(config[_0xa6a6('0xb')]));require(_0xa6a6('0xf'))[_0xa6a6('0x10')](socket);function respondWithRpcPromise(_0x116b3f,_0x5d863b,_0x477220){return new BPromise(function(_0x842dc6,_0x16eb3c){return client[_0xa6a6('0x11')](_0x116b3f,_0x477220)[_0xa6a6('0x12')](function(_0x2297b3){logger[_0xa6a6('0x13')]('FaxQueue,\x20%s,\x20%s',_0x5d863b,_0xa6a6('0x14'));logger[_0xa6a6('0x15')](_0xa6a6('0x16'),_0x5d863b,_0xa6a6('0x14'),JSON[_0xa6a6('0x17')](_0x2297b3));if(_0x2297b3[_0xa6a6('0x18')]){if(_0x2297b3[_0xa6a6('0x18')][_0xa6a6('0x19')]===0x1f4){logger[_0xa6a6('0x18')](_0xa6a6('0x1a'),_0x5d863b,_0x2297b3[_0xa6a6('0x18')][_0xa6a6('0x1b')]);return _0x16eb3c(_0x2297b3[_0xa6a6('0x18')][_0xa6a6('0x1b')]);}logger['error'](_0xa6a6('0x1a'),_0x5d863b,_0x2297b3[_0xa6a6('0x18')][_0xa6a6('0x1b')]);return _0x842dc6(_0x2297b3[_0xa6a6('0x18')][_0xa6a6('0x1b')]);}else{logger[_0xa6a6('0x13')](_0xa6a6('0x1a'),_0x5d863b,_0xa6a6('0x14'));_0x842dc6(_0x2297b3[_0xa6a6('0x1c')][_0xa6a6('0x1b')]);}})[_0xa6a6('0x1d')](function(_0x2ec425){logger['error'](_0xa6a6('0x1a'),_0x5d863b,_0x2ec425);_0x16eb3c(_0x2ec425);});});}exports[_0xa6a6('0x1e')]=function(_0x1bb4ab){var _0x3fd835=this;return new Promise(function(_0x548a43,_0x30fdc1){return db[_0xa6a6('0x1f')][_0xa6a6('0x20')]({'raw':_0x1bb4ab[_0xa6a6('0x21')]?_0x1bb4ab[_0xa6a6('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x1bb4ab['options']?_0x1bb4ab['options'][_0xa6a6('0x22')]||null:null,'attributes':_0x1bb4ab[_0xa6a6('0x21')]?_0x1bb4ab['options'][_0xa6a6('0x23')]||null:null,'limit':_0x1bb4ab[_0xa6a6('0x21')]?_0x1bb4ab[_0xa6a6('0x21')][_0xa6a6('0x24')]||null:null,'include':_0x1bb4ab[_0xa6a6('0x21')]?_0x1bb4ab['options'][_0xa6a6('0x25')]?_['map'](_0x1bb4ab[_0xa6a6('0x21')][_0xa6a6('0x25')],function(_0x309098){return{'model':db[_0x309098[_0xa6a6('0x26')]],'as':_0x309098['as'],'attributes':_0x309098[_0xa6a6('0x23')],'include':_0x309098['include']?_['map'](_0x309098[_0xa6a6('0x25')],function(_0x3bd394){return{'model':db[_0x3bd394[_0xa6a6('0x26')]],'as':_0x3bd394['as'],'attributes':_0x3bd394[_0xa6a6('0x23')],'include':_0x3bd394[_0xa6a6('0x25')]?_[_0xa6a6('0x27')](_0x3bd394[_0xa6a6('0x25')],function(_0x1bef36){return{'model':db[_0x1bef36[_0xa6a6('0x26')]],'as':_0x1bef36['as'],'attributes':_0x1bef36[_0xa6a6('0x23')]};}):[]};}):[]};}):[]:[]})[_0xa6a6('0x12')](function(_0xace328){logger['info'](_0xa6a6('0x1e'),_0x1bb4ab);logger['debug']('GetFaxQueue',_0x1bb4ab,JSON[_0xa6a6('0x17')](_0xace328));_0x548a43(_0xace328);})[_0xa6a6('0x1d')](function(_0x120648){logger['error']('GetFaxQueue',_0x120648[_0xa6a6('0x1b')],_0x1bb4ab);_0x30fdc1(_0x3fd835[_0xa6a6('0x18')](0x1f4,_0x120648[_0xa6a6('0x1b')]));});});};exports[_0xa6a6('0x28')]=function(_0x487b3e){var _0x33a99e=this;return new Promise(function(_0x387e54,_0x1da6b6){return db['FaxQueue'][_0xa6a6('0x29')]({'raw':_0x487b3e[_0xa6a6('0x21')]?_0x487b3e[_0xa6a6('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x487b3e[_0xa6a6('0x21')]?_0x487b3e[_0xa6a6('0x21')][_0xa6a6('0x22')]||null:null,'attributes':_0x487b3e[_0xa6a6('0x21')]?_0x487b3e[_0xa6a6('0x21')]['attributes']||null:null,'include':_0x487b3e[_0xa6a6('0x21')]?_0x487b3e[_0xa6a6('0x21')][_0xa6a6('0x25')]?_[_0xa6a6('0x27')](_0x487b3e[_0xa6a6('0x21')][_0xa6a6('0x25')],function(_0x433b1b){return{'model':db[_0x433b1b['model']],'as':_0x433b1b['as'],'attributes':_0x433b1b[_0xa6a6('0x23')],'include':_0x433b1b[_0xa6a6('0x25')]?_[_0xa6a6('0x27')](_0x433b1b[_0xa6a6('0x25')],function(_0x196f75){return{'model':db[_0x196f75['model']],'as':_0x196f75['as'],'attributes':_0x196f75[_0xa6a6('0x23')],'include':_0x196f75[_0xa6a6('0x25')]?_['map'](_0x196f75[_0xa6a6('0x25')],function(_0x4609f3){return{'model':db[_0x4609f3[_0xa6a6('0x26')]],'as':_0x4609f3['as'],'attributes':_0x4609f3[_0xa6a6('0x23')]};}):[]};}):[]};}):[]:[]})[_0xa6a6('0x12')](function(_0x1834f7){logger[_0xa6a6('0x13')]('ShowFaxQueue',_0x487b3e);logger['debug'](_0xa6a6('0x28'),_0x487b3e,JSON[_0xa6a6('0x17')](_0x1834f7));_0x387e54(_0x1834f7);})[_0xa6a6('0x1d')](function(_0x4c9b70){logger[_0xa6a6('0x18')](_0xa6a6('0x28'),_0x4c9b70[_0xa6a6('0x1b')],_0x487b3e);_0x1da6b6(_0x33a99e[_0xa6a6('0x18')](0x1f4,_0x4c9b70[_0xa6a6('0x1b')]));});});}; \ No newline at end of file +var _0xbcf0=['ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','socket.io-emitter','./faxQueue.socket','request','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','catch','FaxQueue','findAll','options','where','attributes','limit','include','map','model','then','GetFaxQueue','raw','ShowFaxQueue','lodash','util','moment','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbcf0,0x19d));var _0x0bcf=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0xbcf0[_0x5d80de];return _0x1c7556;};'use strict';var _=require(_0x0bcf('0x0'));var util=require(_0x0bcf('0x1'));var moment=require(_0x0bcf('0x2'));var BPromise=require(_0x0bcf('0x3'));var rs=require(_0x0bcf('0x4'));var fs=require('fs');var Redis=require(_0x0bcf('0x5'));var db=require(_0x0bcf('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0bcf('0x7'));var config=require(_0x0bcf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0bcf('0x9')][_0x0bcf('0xa')]({'port':0x232a});config[_0x0bcf('0xb')]=_['defaults'](config[_0x0bcf('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x0bcf('0xc'))(new Redis(config[_0x0bcf('0xb')]));require(_0x0bcf('0xd'))['register'](socket);function respondWithRpcPromise(_0xafa0e8,_0x264778,_0xd9c848){return new BPromise(function(_0x47aada,_0x306257){return client[_0x0bcf('0xe')](_0xafa0e8,_0xd9c848)['then'](function(_0x4649b6){logger[_0x0bcf('0xf')]('FaxQueue,\x20%s,\x20%s',_0x264778,_0x0bcf('0x10'));logger[_0x0bcf('0x11')](_0x0bcf('0x12'),_0x264778,'request\x20sent',JSON[_0x0bcf('0x13')](_0x4649b6));if(_0x4649b6[_0x0bcf('0x14')]){if(_0x4649b6[_0x0bcf('0x14')][_0x0bcf('0x15')]===0x1f4){logger['error'](_0x0bcf('0x16'),_0x264778,_0x4649b6[_0x0bcf('0x14')][_0x0bcf('0x17')]);return _0x306257(_0x4649b6[_0x0bcf('0x14')][_0x0bcf('0x17')]);}logger['error']('FaxQueue,\x20%s,\x20%s',_0x264778,_0x4649b6[_0x0bcf('0x14')]['message']);return _0x47aada(_0x4649b6['error'][_0x0bcf('0x17')]);}else{logger['info'](_0x0bcf('0x16'),_0x264778,_0x0bcf('0x10'));_0x47aada(_0x4649b6['result'][_0x0bcf('0x17')]);}})[_0x0bcf('0x18')](function(_0x547eaf){logger['error'](_0x0bcf('0x16'),_0x264778,_0x547eaf);_0x306257(_0x547eaf);});});}exports['GetFaxQueue']=function(_0xc29c80){var _0x48f733=this;return new Promise(function(_0x489b65,_0xe6daba){return db[_0x0bcf('0x19')][_0x0bcf('0x1a')]({'raw':_0xc29c80[_0x0bcf('0x1b')]?_0xc29c80[_0x0bcf('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0xc29c80['options']?_0xc29c80[_0x0bcf('0x1b')][_0x0bcf('0x1c')]||null:null,'attributes':_0xc29c80[_0x0bcf('0x1b')]?_0xc29c80['options'][_0x0bcf('0x1d')]||null:null,'limit':_0xc29c80[_0x0bcf('0x1b')]?_0xc29c80['options'][_0x0bcf('0x1e')]||null:null,'include':_0xc29c80[_0x0bcf('0x1b')]?_0xc29c80[_0x0bcf('0x1b')][_0x0bcf('0x1f')]?_[_0x0bcf('0x20')](_0xc29c80[_0x0bcf('0x1b')][_0x0bcf('0x1f')],function(_0x37bd04){return{'model':db[_0x37bd04[_0x0bcf('0x21')]],'as':_0x37bd04['as'],'attributes':_0x37bd04['attributes'],'include':_0x37bd04[_0x0bcf('0x1f')]?_[_0x0bcf('0x20')](_0x37bd04[_0x0bcf('0x1f')],function(_0x130493){return{'model':db[_0x130493[_0x0bcf('0x21')]],'as':_0x130493['as'],'attributes':_0x130493[_0x0bcf('0x1d')],'include':_0x130493[_0x0bcf('0x1f')]?_['map'](_0x130493[_0x0bcf('0x1f')],function(_0x1a714b){return{'model':db[_0x1a714b[_0x0bcf('0x21')]],'as':_0x1a714b['as'],'attributes':_0x1a714b['attributes']};}):[]};}):[]};}):[]:[]})[_0x0bcf('0x22')](function(_0x439ab3){logger[_0x0bcf('0xf')]('GetFaxQueue',_0xc29c80);logger[_0x0bcf('0x11')]('GetFaxQueue',_0xc29c80,JSON[_0x0bcf('0x13')](_0x439ab3));_0x489b65(_0x439ab3);})['catch'](function(_0x1cad98){logger[_0x0bcf('0x14')](_0x0bcf('0x23'),_0x1cad98[_0x0bcf('0x17')],_0xc29c80);_0xe6daba(_0x48f733[_0x0bcf('0x14')](0x1f4,_0x1cad98[_0x0bcf('0x17')]));});});};exports['ShowFaxQueue']=function(_0x2bbfcd){var _0xd24c17=this;return new Promise(function(_0x1255ba,_0x5a40af){return db['FaxQueue']['find']({'raw':_0x2bbfcd['options']?_0x2bbfcd[_0x0bcf('0x1b')][_0x0bcf('0x24')]===undefined?!![]:![]:!![],'where':_0x2bbfcd['options']?_0x2bbfcd[_0x0bcf('0x1b')][_0x0bcf('0x1c')]||null:null,'attributes':_0x2bbfcd['options']?_0x2bbfcd['options']['attributes']||null:null,'include':_0x2bbfcd[_0x0bcf('0x1b')]?_0x2bbfcd['options'][_0x0bcf('0x1f')]?_[_0x0bcf('0x20')](_0x2bbfcd[_0x0bcf('0x1b')][_0x0bcf('0x1f')],function(_0x121ae2){return{'model':db[_0x121ae2[_0x0bcf('0x21')]],'as':_0x121ae2['as'],'attributes':_0x121ae2[_0x0bcf('0x1d')],'include':_0x121ae2[_0x0bcf('0x1f')]?_[_0x0bcf('0x20')](_0x121ae2['include'],function(_0x50afbe){return{'model':db[_0x50afbe[_0x0bcf('0x21')]],'as':_0x50afbe['as'],'attributes':_0x50afbe[_0x0bcf('0x1d')],'include':_0x50afbe[_0x0bcf('0x1f')]?_['map'](_0x50afbe[_0x0bcf('0x1f')],function(_0x4c1c2e){return{'model':db[_0x4c1c2e[_0x0bcf('0x21')]],'as':_0x4c1c2e['as'],'attributes':_0x4c1c2e[_0x0bcf('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0bcf('0x22')](function(_0x1f6d95){logger['info'](_0x0bcf('0x25'),_0x2bbfcd);logger[_0x0bcf('0x11')](_0x0bcf('0x25'),_0x2bbfcd,JSON[_0x0bcf('0x13')](_0x1f6d95));_0x1255ba(_0x1f6d95);})[_0x0bcf('0x18')](function(_0x1b8fec){logger[_0x0bcf('0x14')](_0x0bcf('0x25'),_0x1b8fec[_0x0bcf('0x17')],_0x2bbfcd);_0x5a40af(_0xd24c17[_0x0bcf('0x14')](0x1f4,_0x1b8fec['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 479a26b..3f65d1e 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 _0xa2c5=['emit','register','save','remove','update'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa2c5,0x7a));var _0x5a2c=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0xa2c5[_0xac151d];return _0x111dba;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x5a2c('0x0'),_0x5a2c('0x1'),_0x5a2c('0x2')];function createListener(_0x650de5,_0x56a201){return function(_0x3eb4cc){_0x56a201[_0x5a2c('0x3')](_0x650de5,_0x3eb4cc);};}function removeListener(_0x5b9b16,_0x26cfec){return function(){FaxQueueEvents['removeListener'](_0x5b9b16,_0x26cfec);};}exports[_0x5a2c('0x4')]=function(_0x42a5c7){for(var _0xf13236=0x0,_0x5e43dc=events['length'];_0xf13236<_0x5e43dc;_0xf13236++){var _0x929717=events[_0xf13236];var _0x82ba11=createListener('faxQueue:'+_0x929717,_0x42a5c7);FaxQueueEvents['on'](_0x929717,_0x82ba11);}}; \ No newline at end of file +var _0x1bb2=['update','emit','removeListener','save','remove'];(function(_0x26018c,_0x3c0903){var _0x1efc45=function(_0x3d952f){while(--_0x3d952f){_0x26018c['push'](_0x26018c['shift']());}};_0x1efc45(++_0x3c0903);}(_0x1bb2,0xc6));var _0x21bb=function(_0x48598c,_0x433e13){_0x48598c=_0x48598c-0x0;var _0xddd81b=_0x1bb2[_0x48598c];return _0xddd81b;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x21bb('0x0'),_0x21bb('0x1'),_0x21bb('0x2')];function createListener(_0x5def2f,_0x21b4e0){return function(_0x147b34){_0x21b4e0[_0x21bb('0x3')](_0x5def2f,_0x147b34);};}function removeListener(_0x11917b,_0x178d58){return function(){FaxQueueEvents[_0x21bb('0x4')](_0x11917b,_0x178d58);};}exports['register']=function(_0x1fd5f8){for(var _0x287e51=0x0,_0x31114a=events['length'];_0x287e51<_0x31114a;_0x287e51++){var _0x5ad94a=events[_0x287e51];var _0x13021a=createListener('faxQueue:'+_0x5ad94a,_0x1fd5f8);FaxQueueEvents['on'](_0x5ad94a,_0x13021a);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index c46200c..100c3d8 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 _0x9536=['put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents'];(function(_0x36d674,_0x4af6b0){var _0x2d91df=function(_0x4ba058){while(--_0x4ba058){_0x36d674['push'](_0x36d674['shift']());}};_0x2d91df(++_0x4af6b0);}(_0x9536,0x179));var _0x6953=function(_0x622035,_0x1a4b91){_0x622035=_0x622035-0x0;var _0x326cf2=_0x9536[_0x622035];return _0x326cf2;};'use strict';var multer=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var path=require(_0x6953('0x2'));var timeout=require(_0x6953('0x3'));var express=require('express');var router=express[_0x6953('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6953('0x5'));var interaction=require(_0x6953('0x6'));var config=require(_0x6953('0x7'));var controller=require(_0x6953('0x8'));router[_0x6953('0x9')]('/',auth['isAuthenticated'](),controller[_0x6953('0xa')]);router[_0x6953('0x9')](_0x6953('0xb'),auth[_0x6953('0xc')](),controller[_0x6953('0xd')]);router['get'](_0x6953('0xe'),auth[_0x6953('0xc')](),controller[_0x6953('0xf')]);router['get'](_0x6953('0x10'),auth[_0x6953('0xc')](),controller[_0x6953('0x11')]);router[_0x6953('0x9')](_0x6953('0x12'),auth[_0x6953('0xc')](),controller[_0x6953('0x13')]);router[_0x6953('0x9')](_0x6953('0x14'),auth['isAuthenticated'](),controller[_0x6953('0x15')]);router['post']('/',auth[_0x6953('0xc')](),controller[_0x6953('0x16')]);router[_0x6953('0x17')](_0x6953('0x12'),auth[_0x6953('0xc')](),controller[_0x6953('0x18')]);router[_0x6953('0x17')](_0x6953('0x14'),auth[_0x6953('0xc')](),controller[_0x6953('0x19')]);router[_0x6953('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x6953('0x1b')]);router[_0x6953('0x1c')](_0x6953('0xe'),auth[_0x6953('0xc')](),controller['destroy']);router[_0x6953('0x1c')](_0x6953('0x12'),auth['isAuthenticated'](),controller[_0x6953('0x1d')]);router[_0x6953('0x1c')](_0x6953('0x14'),auth[_0x6953('0xc')](),controller[_0x6953('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x82d8=['update','delete','destroy','removeAgents','exports','multer','path','Router','../../components/auth/service','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put'];(function(_0x3a2f50,_0x5980b1){var _0x44d001=function(_0x46833e){while(--_0x46833e){_0x3a2f50['push'](_0x3a2f50['shift']());}};_0x44d001(++_0x5980b1);}(_0x82d8,0xff));var _0x882d=function(_0x5c97c7,_0x592e32){_0x5c97c7=_0x5c97c7-0x0;var _0x23ecd3=_0x82d8[_0x5c97c7];return _0x23ecd3;};'use strict';var multer=require(_0x882d('0x0'));var util=require('util');var path=require(_0x882d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x882d('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x882d('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x882d('0x4'));router[_0x882d('0x5')]('/',auth[_0x882d('0x6')](),controller[_0x882d('0x7')]);router[_0x882d('0x5')](_0x882d('0x8'),auth[_0x882d('0x6')](),controller['describe']);router[_0x882d('0x5')](_0x882d('0x9'),auth[_0x882d('0x6')](),controller['show']);router[_0x882d('0x5')](_0x882d('0xa'),auth['isAuthenticated'](),controller[_0x882d('0xb')]);router[_0x882d('0x5')](_0x882d('0xc'),auth['isAuthenticated'](),controller[_0x882d('0xd')]);router[_0x882d('0x5')](_0x882d('0xe'),auth[_0x882d('0x6')](),controller[_0x882d('0xf')]);router[_0x882d('0x10')]('/',auth[_0x882d('0x6')](),controller['create']);router['post'](_0x882d('0xc'),auth[_0x882d('0x6')](),controller[_0x882d('0x11')]);router[_0x882d('0x10')](_0x882d('0xe'),auth['isAuthenticated'](),controller[_0x882d('0x12')]);router[_0x882d('0x13')](_0x882d('0x9'),auth[_0x882d('0x6')](),controller[_0x882d('0x14')]);router[_0x882d('0x15')](_0x882d('0x9'),auth[_0x882d('0x6')](),controller[_0x882d('0x16')]);router['delete']('/:id/teams',auth[_0x882d('0x6')](),controller['removeTeams']);router[_0x882d('0x15')]('/:id/users',auth[_0x882d('0x6')](),controller[_0x882d('0x17')]);module[_0x882d('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 16368c2..4910629 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 _0x32c8=['moment','sequelize','STRING','DATE'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x32c8,0x17c));var _0x832c=function(_0x9f5d30,_0x27f581){_0x9f5d30=_0x9f5d30-0x0;var _0x5f4407=_0x32c8[_0x9f5d30];return _0x5f4407;};'use strict';var moment=require(_0x832c('0x0'));var Sequelize=require(_0x832c('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x832c('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x832c('0x3')]},'leaveAt':{'type':Sequelize[_0x832c('0x3')]},'acceptAt':{'type':Sequelize[_0x832c('0x3')]},'exitAt':{'type':Sequelize[_0x832c('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6439=['moment','STRING','DATE'];(function(_0x5c672c,_0x5f4b3e){var _0x233554=function(_0x386d67){while(--_0x386d67){_0x5c672c['push'](_0x5c672c['shift']());}};_0x233554(++_0x5f4b3e);}(_0x6439,0x1ce));var _0x9643=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0x6439[_0xef8146];return _0x5a6cb0;};'use strict';var moment=require(_0x9643('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x9643('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x9643('0x1')]},'joinAt':{'type':Sequelize[_0x9643('0x2')]},'leaveAt':{'type':Sequelize[_0x9643('0x2')]},'acceptAt':{'type':Sequelize[_0x9643('0x2')]},'exitAt':{'type':Sequelize[_0x9643('0x2')]},'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 8efd6e7..d800be7 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 _0xd1d4=['pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','create','body','describe','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','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','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','FaxQueueReport','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x4fc8ba,_0x25b882){var _0x3891b0=function(_0x4dbc0c){while(--_0x4dbc0c){_0x4fc8ba['push'](_0x4fc8ba['shift']());}};_0x3891b0(++_0x25b882);}(_0xd1d4,0xfb));var _0x4d1d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd1d4[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x4d1d('0x0'));var rimraf=require(_0x4d1d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d1d('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4d1d('0x3'));var Mustache=require(_0x4d1d('0x4'));var util=require(_0x4d1d('0x5'));var path=require(_0x4d1d('0x6'));var sox=require(_0x4d1d('0x7'));var csv=require(_0x4d1d('0x8'));var ejs=require(_0x4d1d('0x9'));var fs=require('fs');var fs_extra=require(_0x4d1d('0xa'));var _=require(_0x4d1d('0xb'));var squel=require(_0x4d1d('0xc'));var crypto=require(_0x4d1d('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4d1d('0x8'));var querystring=require(_0x4d1d('0xe'));var Papa=require('papaparse');var Redis=require(_0x4d1d('0xf'));var authService=require(_0x4d1d('0x10'));var qs=require(_0x4d1d('0x11'));var as=require(_0x4d1d('0x12'));var hardwareService=require(_0x4d1d('0x13'));var logger=require(_0x4d1d('0x14'))(_0x4d1d('0x15'));var utils=require(_0x4d1d('0x16'));var config=require(_0x4d1d('0x17'));var licenseUtil=require(_0x4d1d('0x18'));var db=require(_0x4d1d('0x19'))['db'];function respondWithStatusCode(_0xf8e311,_0x11115c){_0x11115c=_0x11115c||0xcc;return function(_0x515e43){if(_0x515e43){return _0xf8e311[_0x4d1d('0x1a')](_0x11115c);}return _0xf8e311[_0x4d1d('0x1b')](_0x11115c)[_0x4d1d('0x1c')]();};}function respondWithResult(_0x377ff7,_0x4fabbc){_0x4fabbc=_0x4fabbc||0xc8;return function(_0x58c1c0){if(_0x58c1c0){return _0x377ff7[_0x4d1d('0x1b')](_0x4fabbc)[_0x4d1d('0x1d')](_0x58c1c0);}};}function respondWithFilteredResult(_0x1db7a6,_0x569809){return function(_0x42ac80){if(_0x42ac80){var _0x460b3a=typeof _0x569809[_0x4d1d('0x1e')]===_0x4d1d('0x1f')&&typeof _0x569809['limit']==='undefined';var _0x4cec61=_0x42ac80[_0x4d1d('0x20')];var _0x83eb5a=_0x460b3a?0x0:_0x569809[_0x4d1d('0x1e')];var _0x38d465=_0x460b3a?_0x42ac80[_0x4d1d('0x20')]:_0x569809['offset']+_0x569809[_0x4d1d('0x21')];var _0x405dcd;if(_0x38d465>=_0x4cec61){_0x38d465=_0x4cec61;_0x405dcd=0xc8;}else{_0x405dcd=0xce;}_0x1db7a6[_0x4d1d('0x1b')](_0x405dcd);return _0x1db7a6[_0x4d1d('0x22')](_0x4d1d('0x23'),_0x83eb5a+'-'+_0x38d465+'/'+_0x4cec61)[_0x4d1d('0x1d')](_0x42ac80);}return null;};}function patchUpdates(_0x1a5dae){return function(_0x5a325c){try{jsonpatch[_0x4d1d('0x24')](_0x5a325c,_0x1a5dae,!![]);}catch(_0x4fcb5b){return BPromise[_0x4d1d('0x25')](_0x4fcb5b);}return _0x5a325c[_0x4d1d('0x26')]();};}function saveUpdates(_0x356d6f,_0xf1c555){return function(_0x2557b1){if(_0x2557b1){return _0x2557b1[_0x4d1d('0x27')](_0x356d6f)[_0x4d1d('0x28')](function(_0x4e4b7a){return _0x4e4b7a;});}return null;};}function removeEntity(_0x410916,_0x43d108){return function(_0x207472){if(_0x207472){return _0x207472[_0x4d1d('0x29')]()[_0x4d1d('0x28')](function(){_0x410916['status'](0xcc)[_0x4d1d('0x1c')]();});}};}function handleEntityNotFound(_0x45b17c,_0x33f17e){return function(_0x2a49a8){if(!_0x2a49a8){_0x45b17c[_0x4d1d('0x1a')](0x194);}return _0x2a49a8;};}function handleError(_0x5cf5f3,_0x30aa34){_0x30aa34=_0x30aa34||0x1f4;return function(_0x58ac25){logger[_0x4d1d('0x2a')](_0x58ac25[_0x4d1d('0x2b')]);if(_0x58ac25[_0x4d1d('0x2c')]){delete _0x58ac25[_0x4d1d('0x2c')];}_0x5cf5f3[_0x4d1d('0x1b')](_0x30aa34)[_0x4d1d('0x2d')](_0x58ac25);};}exports['index']=function(_0x666c88,_0x322e0f){var _0x276762={},_0x558888={},_0x3c84b9={'count':0x0,'rows':[]};var _0x380e9b=_['map'](db[_0x4d1d('0x2e')][_0x4d1d('0x2f')],function(_0x3bd19b){return{'name':_0x3bd19b[_0x4d1d('0x30')],'type':_0x3bd19b[_0x4d1d('0x31')][_0x4d1d('0x32')]};});_0x558888[_0x4d1d('0x33')]=_[_0x4d1d('0x34')](_0x380e9b,'name');_0x558888['query']=_[_0x4d1d('0x35')](_0x666c88[_0x4d1d('0x36')]);_0x558888['filters']=_[_0x4d1d('0x37')](_0x558888['model'],_0x558888['query']);_0x276762[_0x4d1d('0x38')]=_['intersection'](_0x558888[_0x4d1d('0x33')],qs['fields'](_0x666c88['query'][_0x4d1d('0x39')]));_0x276762[_0x4d1d('0x38')]=_0x276762[_0x4d1d('0x38')][_0x4d1d('0x3a')]?_0x276762['attributes']:_0x558888['model'];if(!_0x666c88[_0x4d1d('0x36')][_0x4d1d('0x3b')](_0x4d1d('0x3c'))){_0x276762[_0x4d1d('0x21')]=qs[_0x4d1d('0x21')](_0x666c88[_0x4d1d('0x36')]['limit']);_0x276762[_0x4d1d('0x1e')]=qs[_0x4d1d('0x1e')](_0x666c88[_0x4d1d('0x36')][_0x4d1d('0x1e')]);}_0x276762[_0x4d1d('0x3d')]=qs[_0x4d1d('0x3e')](_0x666c88['query'][_0x4d1d('0x3e')]);_0x276762[_0x4d1d('0x3f')]=qs[_0x4d1d('0x40')](_[_0x4d1d('0x41')](_0x666c88['query'],_0x558888[_0x4d1d('0x40')]),_0x380e9b);if(_0x666c88[_0x4d1d('0x36')]['filter']){_0x276762['where']=_[_0x4d1d('0x42')](_0x276762[_0x4d1d('0x3f')],{'$or':_['map'](_0x380e9b,function(_0x2ea2e3){if(_0x2ea2e3[_0x4d1d('0x31')]!==_0x4d1d('0x43')){var _0x3afac4={};_0x3afac4[_0x2ea2e3[_0x4d1d('0x2c')]]={'$like':'%'+_0x666c88[_0x4d1d('0x36')][_0x4d1d('0x44')]+'%'};return _0x3afac4;}})});}_0x276762=_[_0x4d1d('0x42')]({},_0x276762,_0x666c88[_0x4d1d('0x45')]);var _0x249ecc={'where':_0x276762[_0x4d1d('0x3f')]};return db['FaxQueueReport'][_0x4d1d('0x20')](_0x249ecc)[_0x4d1d('0x28')](function(_0x44e773){_0x3c84b9['count']=_0x44e773;if(_0x666c88[_0x4d1d('0x36')][_0x4d1d('0x46')]){_0x276762[_0x4d1d('0x47')]=[{'all':!![]}];}return db[_0x4d1d('0x2e')][_0x4d1d('0x48')](_0x276762);})[_0x4d1d('0x28')](function(_0x5c8a9b){_0x3c84b9[_0x4d1d('0x49')]=_0x5c8a9b;return _0x3c84b9;})[_0x4d1d('0x28')](respondWithFilteredResult(_0x322e0f,_0x276762))[_0x4d1d('0x4a')](handleError(_0x322e0f,null));};exports['show']=function(_0x4bce4e,_0x70394d){var _0x50b4d9={'raw':!![],'where':{'id':_0x4bce4e[_0x4d1d('0x4b')]['id']}},_0x8bd0b6={};_0x8bd0b6['model']=_['keys'](db[_0x4d1d('0x2e')][_0x4d1d('0x2f')]);_0x8bd0b6[_0x4d1d('0x36')]=_[_0x4d1d('0x35')](_0x4bce4e[_0x4d1d('0x36')]);_0x8bd0b6['filters']=_[_0x4d1d('0x37')](_0x8bd0b6[_0x4d1d('0x33')],_0x8bd0b6[_0x4d1d('0x36')]);_0x50b4d9[_0x4d1d('0x38')]=_['intersection'](_0x8bd0b6[_0x4d1d('0x33')],qs[_0x4d1d('0x39')](_0x4bce4e[_0x4d1d('0x36')][_0x4d1d('0x39')]));_0x50b4d9[_0x4d1d('0x38')]=_0x50b4d9[_0x4d1d('0x38')]['length']?_0x50b4d9[_0x4d1d('0x38')]:_0x8bd0b6[_0x4d1d('0x33')];if(_0x4bce4e[_0x4d1d('0x36')][_0x4d1d('0x46')]){_0x50b4d9[_0x4d1d('0x47')]=[{'all':!![]}];}_0x50b4d9=_[_0x4d1d('0x42')]({},_0x50b4d9,_0x4bce4e[_0x4d1d('0x45')]);return db[_0x4d1d('0x2e')]['find'](_0x50b4d9)[_0x4d1d('0x28')](handleEntityNotFound(_0x70394d,null))['then'](respondWithResult(_0x70394d,null))[_0x4d1d('0x4a')](handleError(_0x70394d,null));};exports[_0x4d1d('0x4c')]=function(_0x385d38,_0x5e2915){return db['FaxQueueReport'][_0x4d1d('0x4c')](_0x385d38[_0x4d1d('0x4d')],{})['then'](respondWithResult(_0x5e2915,0xc9))[_0x4d1d('0x4a')](handleError(_0x5e2915,null));};exports[_0x4d1d('0x27')]=function(_0x143e13,_0x4719da){if(_0x143e13[_0x4d1d('0x4d')]['id']){delete _0x143e13['body']['id'];}return db[_0x4d1d('0x2e')]['find']({'where':{'id':_0x143e13['params']['id']}})[_0x4d1d('0x28')](handleEntityNotFound(_0x4719da,null))[_0x4d1d('0x28')](saveUpdates(_0x143e13[_0x4d1d('0x4d')],null))[_0x4d1d('0x28')](respondWithResult(_0x4719da,null))[_0x4d1d('0x4a')](handleError(_0x4719da,null));};exports[_0x4d1d('0x29')]=function(_0x47d4b1,_0x2f9da0){return db[_0x4d1d('0x2e')]['find']({'where':{'id':_0x47d4b1[_0x4d1d('0x4b')]['id']}})[_0x4d1d('0x28')](handleEntityNotFound(_0x2f9da0,null))[_0x4d1d('0x28')](removeEntity(_0x2f9da0,null))[_0x4d1d('0x4a')](handleError(_0x2f9da0,null));};exports['describe']=function(_0x30378f,_0xfeca9e){return db[_0x4d1d('0x2e')][_0x4d1d('0x4e')]()[_0x4d1d('0x28')](respondWithResult(_0xfeca9e,null))[_0x4d1d('0x4a')](handleError(_0xfeca9e,null));}; \ No newline at end of file +var _0x01d3=['path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','index','FaxQueueReport','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','type','VIRTUAL','include','rows','catch','show','params','includeAll','options','create','body','find','describe','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x381ad2,_0x5e5445){var _0x19d67e=function(_0x1c0893){while(--_0x1c0893){_0x381ad2['push'](_0x381ad2['shift']());}};_0x19d67e(++_0x5e5445);}(_0x01d3,0xdb));var _0x301d=function(_0x41d364,_0xdfdc1a){_0x41d364=_0x41d364-0x0;var _0x5ace98=_0x01d3[_0x41d364];return _0x5ace98;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x301d('0x0'));var jsonpatch=require(_0x301d('0x1'));var rp=require(_0x301d('0x2'));var moment=require('moment');var BPromise=require(_0x301d('0x3'));var Mustache=require(_0x301d('0x4'));var util=require(_0x301d('0x5'));var path=require(_0x301d('0x6'));var sox=require(_0x301d('0x7'));var csv=require('to-csv');var ejs=require(_0x301d('0x8'));var fs=require('fs');var fs_extra=require(_0x301d('0x9'));var _=require(_0x301d('0xa'));var squel=require(_0x301d('0xb'));var crypto=require(_0x301d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x301d('0xd'));var toCsv=require(_0x301d('0xe'));var querystring=require(_0x301d('0xf'));var Papa=require(_0x301d('0x10'));var Redis=require(_0x301d('0x11'));var authService=require(_0x301d('0x12'));var qs=require(_0x301d('0x13'));var as=require(_0x301d('0x14'));var hardwareService=require(_0x301d('0x15'));var logger=require('../../config/logger')(_0x301d('0x16'));var utils=require(_0x301d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x301d('0x18'));var db=require(_0x301d('0x19'))['db'];function respondWithStatusCode(_0x2eb3af,_0x53bfe2){_0x53bfe2=_0x53bfe2||0xcc;return function(_0x496f0c){if(_0x496f0c){return _0x2eb3af[_0x301d('0x1a')](_0x53bfe2);}return _0x2eb3af[_0x301d('0x1b')](_0x53bfe2)[_0x301d('0x1c')]();};}function respondWithResult(_0x377c7f,_0x11bacf){_0x11bacf=_0x11bacf||0xc8;return function(_0x5bdd8a){if(_0x5bdd8a){return _0x377c7f[_0x301d('0x1b')](_0x11bacf)['json'](_0x5bdd8a);}};}function respondWithFilteredResult(_0x1d4fb4,_0xc35239){return function(_0x4fd833){if(_0x4fd833){var _0x10d277=typeof _0xc35239[_0x301d('0x1d')]===_0x301d('0x1e')&&typeof _0xc35239[_0x301d('0x1f')]===_0x301d('0x1e');var _0x1c409b=_0x4fd833[_0x301d('0x20')];var _0x2c7afb=_0x10d277?0x0:_0xc35239[_0x301d('0x1d')];var _0x3a2ad2=_0x10d277?_0x4fd833[_0x301d('0x20')]:_0xc35239[_0x301d('0x1d')]+_0xc35239[_0x301d('0x1f')];var _0x3d75e5;if(_0x3a2ad2>=_0x1c409b){_0x3a2ad2=_0x1c409b;_0x3d75e5=0xc8;}else{_0x3d75e5=0xce;}_0x1d4fb4[_0x301d('0x1b')](_0x3d75e5);return _0x1d4fb4['set']('Content-Range',_0x2c7afb+'-'+_0x3a2ad2+'/'+_0x1c409b)['json'](_0x4fd833);}return null;};}function patchUpdates(_0x31c94e){return function(_0x17ee2a){try{jsonpatch[_0x301d('0x21')](_0x17ee2a,_0x31c94e,!![]);}catch(_0x4d8006){return BPromise[_0x301d('0x22')](_0x4d8006);}return _0x17ee2a[_0x301d('0x23')]();};}function saveUpdates(_0x5b6631,_0x485f96){return function(_0x292c89){if(_0x292c89){return _0x292c89[_0x301d('0x24')](_0x5b6631)[_0x301d('0x25')](function(_0x3fa47d){return _0x3fa47d;});}return null;};}function removeEntity(_0x549e57,_0x1119da){return function(_0x2491b8){if(_0x2491b8){return _0x2491b8[_0x301d('0x26')]()[_0x301d('0x25')](function(){_0x549e57[_0x301d('0x1b')](0xcc)[_0x301d('0x1c')]();});}};}function handleEntityNotFound(_0x4fae3d,_0x470b7a){return function(_0xb315b6){if(!_0xb315b6){_0x4fae3d[_0x301d('0x1a')](0x194);}return _0xb315b6;};}function handleError(_0x2f7092,_0x31ce2c){_0x31ce2c=_0x31ce2c||0x1f4;return function(_0x23c934){logger[_0x301d('0x27')](_0x23c934[_0x301d('0x28')]);if(_0x23c934['name']){delete _0x23c934[_0x301d('0x29')];}_0x2f7092['status'](_0x31ce2c)['send'](_0x23c934);};}exports[_0x301d('0x2a')]=function(_0x52eb42,_0x326722){var _0x119143={},_0x362c68={},_0x46127a={'count':0x0,'rows':[]};var _0xb6a139=_['map'](db[_0x301d('0x2b')][_0x301d('0x2c')],function(_0x2385ef){return{'name':_0x2385ef[_0x301d('0x2d')],'type':_0x2385ef['type']['key']};});_0x362c68['model']=_['map'](_0xb6a139,_0x301d('0x29'));_0x362c68[_0x301d('0x2e')]=_[_0x301d('0x2f')](_0x52eb42[_0x301d('0x2e')]);_0x362c68[_0x301d('0x30')]=_[_0x301d('0x31')](_0x362c68[_0x301d('0x32')],_0x362c68[_0x301d('0x2e')]);_0x119143[_0x301d('0x33')]=_[_0x301d('0x31')](_0x362c68['model'],qs[_0x301d('0x34')](_0x52eb42[_0x301d('0x2e')][_0x301d('0x34')]));_0x119143[_0x301d('0x33')]=_0x119143[_0x301d('0x33')][_0x301d('0x35')]?_0x119143[_0x301d('0x33')]:_0x362c68[_0x301d('0x32')];if(!_0x52eb42[_0x301d('0x2e')][_0x301d('0x36')]('nolimit')){_0x119143['limit']=qs[_0x301d('0x1f')](_0x52eb42[_0x301d('0x2e')][_0x301d('0x1f')]);_0x119143[_0x301d('0x1d')]=qs[_0x301d('0x1d')](_0x52eb42['query'][_0x301d('0x1d')]);}_0x119143[_0x301d('0x37')]=qs[_0x301d('0x38')](_0x52eb42['query'][_0x301d('0x38')]);_0x119143['where']=qs[_0x301d('0x30')](_[_0x301d('0x39')](_0x52eb42[_0x301d('0x2e')],_0x362c68[_0x301d('0x30')]),_0xb6a139);if(_0x52eb42[_0x301d('0x2e')][_0x301d('0x3a')]){_0x119143[_0x301d('0x3b')]=_[_0x301d('0x3c')](_0x119143['where'],{'$or':_[_0x301d('0x3d')](_0xb6a139,function(_0x2a1459){if(_0x2a1459[_0x301d('0x3e')]!==_0x301d('0x3f')){var _0xc4e7ff={};_0xc4e7ff[_0x2a1459['name']]={'$like':'%'+_0x52eb42['query']['filter']+'%'};return _0xc4e7ff;}})});}_0x119143=_[_0x301d('0x3c')]({},_0x119143,_0x52eb42['options']);var _0x35047e={'where':_0x119143[_0x301d('0x3b')]};return db[_0x301d('0x2b')][_0x301d('0x20')](_0x35047e)[_0x301d('0x25')](function(_0x5ee9cc){_0x46127a[_0x301d('0x20')]=_0x5ee9cc;if(_0x52eb42['query']['includeAll']){_0x119143[_0x301d('0x40')]=[{'all':!![]}];}return db['FaxQueueReport']['findAll'](_0x119143);})[_0x301d('0x25')](function(_0x168211){_0x46127a[_0x301d('0x41')]=_0x168211;return _0x46127a;})[_0x301d('0x25')](respondWithFilteredResult(_0x326722,_0x119143))[_0x301d('0x42')](handleError(_0x326722,null));};exports[_0x301d('0x43')]=function(_0x499ca8,_0x16a7ca){var _0x29ef1d={'raw':!![],'where':{'id':_0x499ca8[_0x301d('0x44')]['id']}},_0x3dd5f5={};_0x3dd5f5[_0x301d('0x32')]=_[_0x301d('0x2f')](db[_0x301d('0x2b')]['rawAttributes']);_0x3dd5f5[_0x301d('0x2e')]=_['keys'](_0x499ca8['query']);_0x3dd5f5[_0x301d('0x30')]=_[_0x301d('0x31')](_0x3dd5f5['model'],_0x3dd5f5[_0x301d('0x2e')]);_0x29ef1d[_0x301d('0x33')]=_['intersection'](_0x3dd5f5['model'],qs[_0x301d('0x34')](_0x499ca8[_0x301d('0x2e')][_0x301d('0x34')]));_0x29ef1d['attributes']=_0x29ef1d['attributes'][_0x301d('0x35')]?_0x29ef1d[_0x301d('0x33')]:_0x3dd5f5[_0x301d('0x32')];if(_0x499ca8[_0x301d('0x2e')][_0x301d('0x45')]){_0x29ef1d['include']=[{'all':!![]}];}_0x29ef1d=_[_0x301d('0x3c')]({},_0x29ef1d,_0x499ca8[_0x301d('0x46')]);return db[_0x301d('0x2b')]['find'](_0x29ef1d)[_0x301d('0x25')](handleEntityNotFound(_0x16a7ca,null))[_0x301d('0x25')](respondWithResult(_0x16a7ca,null))[_0x301d('0x42')](handleError(_0x16a7ca,null));};exports[_0x301d('0x47')]=function(_0x54cce3,_0x2c1fc8){return db['FaxQueueReport'][_0x301d('0x47')](_0x54cce3['body'],{})[_0x301d('0x25')](respondWithResult(_0x2c1fc8,0xc9))[_0x301d('0x42')](handleError(_0x2c1fc8,null));};exports[_0x301d('0x24')]=function(_0x155912,_0x2ed897){if(_0x155912[_0x301d('0x48')]['id']){delete _0x155912[_0x301d('0x48')]['id'];}return db[_0x301d('0x2b')][_0x301d('0x49')]({'where':{'id':_0x155912['params']['id']}})[_0x301d('0x25')](handleEntityNotFound(_0x2ed897,null))[_0x301d('0x25')](saveUpdates(_0x155912[_0x301d('0x48')],null))[_0x301d('0x25')](respondWithResult(_0x2ed897,null))['catch'](handleError(_0x2ed897,null));};exports[_0x301d('0x26')]=function(_0x5c1d19,_0x59d4f4){return db['FaxQueueReport'][_0x301d('0x49')]({'where':{'id':_0x5c1d19['params']['id']}})['then'](handleEntityNotFound(_0x59d4f4,null))[_0x301d('0x25')](removeEntity(_0x59d4f4,null))[_0x301d('0x42')](handleError(_0x59d4f4,null));};exports[_0x301d('0x4a')]=function(_0x29cb7b,_0x243cb2){return db[_0x301d('0x2b')][_0x301d('0x4a')]()[_0x301d('0x25')](respondWithResult(_0x243cb2,null))[_0x301d('0x42')](handleError(_0x243cb2,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 73ae6e1..d8e40ed 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 _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash'];(function(_0x47bfb8,_0x5f2de8){var _0x4c53e7=function(_0x3eecaa){while(--_0x3eecaa){_0x47bfb8['push'](_0x47bfb8['shift']());}};_0x4c53e7(++_0x5f2de8);}(_0x326f,0xd1));var _0xf326=function(_0x482a86,_0x445cdc){_0x482a86=_0x482a86-0x0;var _0x21dcc9=_0x326f[_0x482a86];return _0x21dcc9;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./faxQueueReport.attributes','exports','define','report_fax_queue','uniqueid','lodash'];(function(_0x2f0851,_0x514094){var _0x392239=function(_0x5c5394){while(--_0x5c5394){_0x2f0851['push'](_0x2f0851['shift']());}};_0x392239(++_0x514094);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3725ee,_0x543bd9){_0x3725ee=_0x3725ee-0x0;var _0x399c71=_0x5fc3[_0x3725ee];return _0x399c71;};'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 3677429..6d7632c 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 _0xfc24=['message','info','catch','CreateFaxQueueReport','FaxQueueReport','create','options','raw','stringify','UpdateFaxQueueReport','update','body','where','attributes','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error'];(function(_0xf39b7d,_0x4a9dc2){var _0x29e7de=function(_0x5a5584){while(--_0x5a5584){_0xf39b7d['push'](_0xf39b7d['shift']());}};_0x29e7de(++_0x4a9dc2);}(_0xfc24,0x1ae));var _0x4fc2=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0xfc24[_0x26f702];return _0x11417d;};'use strict';var _=require(_0x4fc2('0x0'));var util=require('util');var moment=require(_0x4fc2('0x1'));var BPromise=require(_0x4fc2('0x2'));var rs=require(_0x4fc2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4fc2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4fc2('0x5'))(_0x4fc2('0x6'));var config=require(_0x4fc2('0x7'));var jayson=require(_0x4fc2('0x8'));var client=jayson[_0x4fc2('0x9')][_0x4fc2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c811f,_0x48656b,_0x429bcf){return new BPromise(function(_0x2cbf32,_0x5949b6){return client[_0x4fc2('0xb')](_0x2c811f,_0x429bcf)[_0x4fc2('0xc')](function(_0x759391){logger['info'](_0x4fc2('0xd'),_0x48656b,_0x4fc2('0xe'));logger[_0x4fc2('0xf')](_0x4fc2('0x10'),_0x48656b,_0x4fc2('0xe'),JSON['stringify'](_0x759391));if(_0x759391[_0x4fc2('0x11')]){if(_0x759391[_0x4fc2('0x11')]['code']===0x1f4){logger['error'](_0x4fc2('0xd'),_0x48656b,_0x759391[_0x4fc2('0x11')]['message']);return _0x5949b6(_0x759391[_0x4fc2('0x11')][_0x4fc2('0x12')]);}logger[_0x4fc2('0x11')](_0x4fc2('0xd'),_0x48656b,_0x759391['error'][_0x4fc2('0x12')]);return _0x2cbf32(_0x759391[_0x4fc2('0x11')][_0x4fc2('0x12')]);}else{logger[_0x4fc2('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x48656b,_0x4fc2('0xe'));_0x2cbf32(_0x759391['result']['message']);}})[_0x4fc2('0x14')](function(_0x5282fc){logger[_0x4fc2('0x11')](_0x4fc2('0xd'),_0x48656b,_0x5282fc);_0x5949b6(_0x5282fc);});});}exports[_0x4fc2('0x15')]=function(_0x1cd79e){var _0xe80e52=this;return new Promise(function(_0x212a65,_0x543e80){return db[_0x4fc2('0x16')][_0x4fc2('0x17')](_0x1cd79e['body'],{'raw':_0x1cd79e[_0x4fc2('0x18')]?_0x1cd79e['options'][_0x4fc2('0x19')]===undefined?!![]:![]:!![]})[_0x4fc2('0xc')](function(_0x21e463){logger[_0x4fc2('0x13')](_0x4fc2('0x15'),_0x1cd79e);logger[_0x4fc2('0xf')](_0x4fc2('0x15'),_0x1cd79e,JSON[_0x4fc2('0x1a')](_0x21e463));_0x212a65(_0x21e463);})['catch'](function(_0x37d15a){logger[_0x4fc2('0x11')](_0x4fc2('0x15'),_0x37d15a['message'],_0x1cd79e);_0x543e80(_0xe80e52['error'](0x1f4,_0x37d15a[_0x4fc2('0x12')]));});});};exports[_0x4fc2('0x1b')]=function(_0x4a1b04){var _0x3da715=this;return new Promise(function(_0x4762ad,_0x2ff97e){return db[_0x4fc2('0x16')][_0x4fc2('0x1c')](_0x4a1b04[_0x4fc2('0x1d')],{'raw':_0x4a1b04[_0x4fc2('0x18')]?_0x4a1b04['options'][_0x4fc2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a1b04[_0x4fc2('0x18')]?_0x4a1b04[_0x4fc2('0x18')][_0x4fc2('0x1e')]||null:null,'attributes':_0x4a1b04[_0x4fc2('0x18')]?_0x4a1b04['options'][_0x4fc2('0x1f')]||null:null,'limit':_0x4a1b04[_0x4fc2('0x18')]?_0x4a1b04[_0x4fc2('0x18')]['limit']||null:null})[_0x4fc2('0xc')](function(_0x2c57e0){logger[_0x4fc2('0x13')](_0x4fc2('0x1b'),_0x4a1b04);logger['debug'](_0x4fc2('0x1b'),_0x4a1b04,JSON[_0x4fc2('0x1a')](_0x2c57e0));_0x4762ad(_0x2c57e0);})[_0x4fc2('0x14')](function(_0x1a9bdb){logger[_0x4fc2('0x11')](_0x4fc2('0x1b'),_0x1a9bdb[_0x4fc2('0x12')],_0x4a1b04);_0x2ff97e(_0x3da715[_0x4fc2('0x11')](0x1f4,_0x1a9bdb[_0x4fc2('0x12')]));});});}; \ No newline at end of file +var _0x3e5c=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','FaxQueueReport,\x20%s,\x20%s','error','message','info','FaxQueueReport','create','body','options','raw','then','CreateFaxQueueReport','debug','stringify','catch','UpdateFaxQueueReport','where','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x4d3d19,_0x5e8ce0){var _0x1ee18d=function(_0x219126){while(--_0x219126){_0x4d3d19['push'](_0x4d3d19['shift']());}};_0x1ee18d(++_0x5e8ce0);}(_0x3e5c,0x1ba));var _0xc3e5=function(_0x36ff21,_0x44a40f){_0x36ff21=_0x36ff21-0x0;var _0x5b6daa=_0x3e5c[_0x36ff21];return _0x5b6daa;};'use strict';var _=require(_0xc3e5('0x0'));var util=require(_0xc3e5('0x1'));var moment=require(_0xc3e5('0x2'));var BPromise=require('bluebird');var rs=require(_0xc3e5('0x3'));var fs=require('fs');var Redis=require(_0xc3e5('0x4'));var db=require(_0xc3e5('0x5'))['db'];var utils=require(_0xc3e5('0x6'));var logger=require(_0xc3e5('0x7'))('rpc');var config=require(_0xc3e5('0x8'));var jayson=require(_0xc3e5('0x9'));var client=jayson[_0xc3e5('0xa')][_0xc3e5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x693ea9,_0xc66493,_0x117624){return new BPromise(function(_0x59642e,_0x4c0d7a){return client[_0xc3e5('0xc')](_0x693ea9,_0x117624)['then'](function(_0x460fa2){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0xc66493,_0xc3e5('0xd'));logger['debug'](_0xc3e5('0xe'),_0xc66493,_0xc3e5('0xd'),JSON['stringify'](_0x460fa2));if(_0x460fa2['error']){if(_0x460fa2['error']['code']===0x1f4){logger['error'](_0xc3e5('0xf'),_0xc66493,_0x460fa2[_0xc3e5('0x10')][_0xc3e5('0x11')]);return _0x4c0d7a(_0x460fa2['error']['message']);}logger[_0xc3e5('0x10')](_0xc3e5('0xf'),_0xc66493,_0x460fa2[_0xc3e5('0x10')][_0xc3e5('0x11')]);return _0x59642e(_0x460fa2['error'][_0xc3e5('0x11')]);}else{logger[_0xc3e5('0x12')](_0xc3e5('0xf'),_0xc66493,'request\x20sent');_0x59642e(_0x460fa2['result']['message']);}})['catch'](function(_0x31deda){logger[_0xc3e5('0x10')](_0xc3e5('0xf'),_0xc66493,_0x31deda);_0x4c0d7a(_0x31deda);});});}exports['CreateFaxQueueReport']=function(_0xe393bc){var _0x5526d0=this;return new Promise(function(_0x497f39,_0x288c1f){return db[_0xc3e5('0x13')][_0xc3e5('0x14')](_0xe393bc[_0xc3e5('0x15')],{'raw':_0xe393bc['options']?_0xe393bc[_0xc3e5('0x16')][_0xc3e5('0x17')]===undefined?!![]:![]:!![]})[_0xc3e5('0x18')](function(_0x8935ab){logger[_0xc3e5('0x12')](_0xc3e5('0x19'),_0xe393bc);logger[_0xc3e5('0x1a')](_0xc3e5('0x19'),_0xe393bc,JSON[_0xc3e5('0x1b')](_0x8935ab));_0x497f39(_0x8935ab);})[_0xc3e5('0x1c')](function(_0x13b02d){logger[_0xc3e5('0x10')](_0xc3e5('0x19'),_0x13b02d['message'],_0xe393bc);_0x288c1f(_0x5526d0['error'](0x1f4,_0x13b02d['message']));});});};exports[_0xc3e5('0x1d')]=function(_0x4a39a7){var _0x4eaa27=this;return new Promise(function(_0x46ab64,_0x19ca2f){return db[_0xc3e5('0x13')]['update'](_0x4a39a7[_0xc3e5('0x15')],{'raw':_0x4a39a7[_0xc3e5('0x16')]?_0x4a39a7[_0xc3e5('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a39a7[_0xc3e5('0x16')]?_0x4a39a7[_0xc3e5('0x16')][_0xc3e5('0x1e')]||null:null,'attributes':_0x4a39a7['options']?_0x4a39a7['options']['attributes']||null:null,'limit':_0x4a39a7[_0xc3e5('0x16')]?_0x4a39a7['options'][_0xc3e5('0x1f')]||null:null})[_0xc3e5('0x18')](function(_0x851c36){logger[_0xc3e5('0x12')](_0xc3e5('0x1d'),_0x4a39a7);logger[_0xc3e5('0x1a')](_0xc3e5('0x1d'),_0x4a39a7,JSON['stringify'](_0x851c36));_0x46ab64(_0x851c36);})[_0xc3e5('0x1c')](function(_0x2159f3){logger[_0xc3e5('0x10')]('UpdateFaxQueueReport',_0x2159f3[_0xc3e5('0x11')],_0x4a39a7);_0x19ca2f(_0x4eaa27['error'](0x1f4,_0x2159f3['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index a59a728..9600051 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 _0x96c3=['../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/describe','describe','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x96c3,0x176));var _0x396c=function(_0x3410c2,_0x56d6a1){_0x3410c2=_0x3410c2-0x0;var _0x12240d=_0x96c3[_0x3410c2];return _0x12240d;};'use strict';var multer=require('multer');var util=require(_0x396c('0x0'));var path=require(_0x396c('0x1'));var timeout=require(_0x396c('0x2'));var express=require(_0x396c('0x3'));var router=express[_0x396c('0x4')]();var fs_extra=require(_0x396c('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x396c('0x6'));var controller=require(_0x396c('0x7'));router[_0x396c('0x8')]('/',auth[_0x396c('0x9')](),controller['index']);router[_0x396c('0x8')](_0x396c('0xa'),auth[_0x396c('0x9')](),controller[_0x396c('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x396c('0xc')]('/',auth[_0x396c('0x9')](),controller[_0x396c('0xd')]);router[_0x396c('0xe')](_0x396c('0xf'),auth[_0x396c('0x9')](),controller[_0x396c('0x10')]);router[_0x396c('0x11')]('/:id',auth[_0x396c('0x9')](),controller[_0x396c('0x12')]);module[_0x396c('0x13')]=router; \ No newline at end of file +var _0x78c1=['/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/describe','describe'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x78c1,0x1eb));var _0x178c=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x78c1[_0x4e676e];return _0x336a3c;};'use strict';var multer=require(_0x178c('0x0'));var util=require(_0x178c('0x1'));var path=require('path');var timeout=require(_0x178c('0x2'));var express=require(_0x178c('0x3'));var router=express[_0x178c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x178c('0x5'));var interaction=require(_0x178c('0x6'));var config=require(_0x178c('0x7'));var controller=require(_0x178c('0x8'));router[_0x178c('0x9')]('/',auth[_0x178c('0xa')](),controller['index']);router[_0x178c('0x9')](_0x178c('0xb'),auth[_0x178c('0xa')](),controller[_0x178c('0xc')]);router[_0x178c('0x9')](_0x178c('0xd'),auth['isAuthenticated'](),controller[_0x178c('0xe')]);router[_0x178c('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x178c('0x10')]('/:id',auth[_0x178c('0xa')](),controller[_0x178c('0x11')]);router[_0x178c('0x12')](_0x178c('0xd'),auth['isAuthenticated'](),controller[_0x178c('0x13')]);module[_0x178c('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 88947bf..ebc78e5 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x2a4877,_0x4bf8e9){var _0x217666=function(_0x720efe){while(--_0x720efe){_0x2a4877['push'](_0x2a4877['shift']());}};_0x217666(++_0x4bf8e9);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x29311d,_0x3f9e23){_0x29311d=_0x29311d-0x0;var _0xa29b8f=_0xf3cd[_0x29311d];return _0xa29b8f;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0xb43b,0x1b2));var _0xbb43=function(_0x238f7f,_0x4467bf){_0x238f7f=_0x238f7f-0x0;var _0x3eaf05=_0xb43b[_0x238f7f];return _0x3eaf05;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 9ed9a2d..4ce3293 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 _0x99ac=['json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','name','index','FaxTransferReport','type','key','query','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','map','merge','options','include','findAll','rows','show','keys','rawAttributes','includeAll','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x70c8c3,_0x5eface){var _0x551a55=function(_0x2d825b){while(--_0x2d825b){_0x70c8c3['push'](_0x70c8c3['shift']());}};_0x551a55(++_0x5eface);}(_0x99ac,0x75));var _0xc99a=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x99ac[_0x45b034];return _0x509cb0;};'use strict';var emlformat=require(_0xc99a('0x0'));var rimraf=require(_0xc99a('0x1'));var zipdir=require(_0xc99a('0x2'));var jsonpatch=require(_0xc99a('0x3'));var rp=require(_0xc99a('0x4'));var moment=require(_0xc99a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc99a('0x6'));var ejs=require(_0xc99a('0x7'));var fs=require('fs');var fs_extra=require(_0xc99a('0x8'));var _=require('lodash');var squel=require(_0xc99a('0x9'));var crypto=require('crypto');var jsforce=require(_0xc99a('0xa'));var deskjs=require(_0xc99a('0xb'));var toCsv=require(_0xc99a('0x6'));var querystring=require(_0xc99a('0xc'));var Papa=require(_0xc99a('0xd'));var Redis=require(_0xc99a('0xe'));var authService=require(_0xc99a('0xf'));var qs=require(_0xc99a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc99a('0x11'));var logger=require(_0xc99a('0x12'))(_0xc99a('0x13'));var utils=require(_0xc99a('0x14'));var config=require(_0xc99a('0x15'));var licenseUtil=require(_0xc99a('0x16'));var db=require(_0xc99a('0x17'))['db'];function respondWithStatusCode(_0xfd3333,_0x196e20){_0x196e20=_0x196e20||0xcc;return function(_0x382757){if(_0x382757){return _0xfd3333[_0xc99a('0x18')](_0x196e20);}return _0xfd3333[_0xc99a('0x19')](_0x196e20)[_0xc99a('0x1a')]();};}function respondWithResult(_0x903819,_0x15342e){_0x15342e=_0x15342e||0xc8;return function(_0x3b101d){if(_0x3b101d){return _0x903819[_0xc99a('0x19')](_0x15342e)[_0xc99a('0x1b')](_0x3b101d);}};}function respondWithFilteredResult(_0x19b21b,_0x3ff7c0){return function(_0x558276){if(_0x558276){var _0x372eaa=typeof _0x3ff7c0[_0xc99a('0x1c')]===_0xc99a('0x1d')&&typeof _0x3ff7c0[_0xc99a('0x1e')]===_0xc99a('0x1d');var _0x3710de=_0x558276[_0xc99a('0x1f')];var _0x50bf00=_0x372eaa?0x0:_0x3ff7c0['offset'];var _0x342771=_0x372eaa?_0x558276['count']:_0x3ff7c0[_0xc99a('0x1c')]+_0x3ff7c0[_0xc99a('0x1e')];var _0x403d58;if(_0x342771>=_0x3710de){_0x342771=_0x3710de;_0x403d58=0xc8;}else{_0x403d58=0xce;}_0x19b21b[_0xc99a('0x19')](_0x403d58);return _0x19b21b[_0xc99a('0x20')]('Content-Range',_0x50bf00+'-'+_0x342771+'/'+_0x3710de)[_0xc99a('0x1b')](_0x558276);}return null;};}function patchUpdates(_0x1ccb8e){return function(_0x539f63){try{jsonpatch['apply'](_0x539f63,_0x1ccb8e,!![]);}catch(_0x540f63){return BPromise[_0xc99a('0x21')](_0x540f63);}return _0x539f63[_0xc99a('0x22')]();};}function saveUpdates(_0x2ac966,_0x25570c){return function(_0x486148){if(_0x486148){return _0x486148[_0xc99a('0x23')](_0x2ac966)[_0xc99a('0x24')](function(_0x50f409){return _0x50f409;});}return null;};}function removeEntity(_0x372ec1,_0x6af2a5){return function(_0x30356e){if(_0x30356e){return _0x30356e[_0xc99a('0x25')]()[_0xc99a('0x24')](function(){_0x372ec1[_0xc99a('0x19')](0xcc)[_0xc99a('0x1a')]();});}};}function handleEntityNotFound(_0x1e8425,_0xd9c83d){return function(_0x40fec6){if(!_0x40fec6){_0x1e8425['sendStatus'](0x194);}return _0x40fec6;};}function handleError(_0x31cffd,_0x121b5d){_0x121b5d=_0x121b5d||0x1f4;return function(_0x283d4e){logger[_0xc99a('0x26')](_0x283d4e['stack']);if(_0x283d4e['name']){delete _0x283d4e[_0xc99a('0x27')];}_0x31cffd[_0xc99a('0x19')](_0x121b5d)['send'](_0x283d4e);};}exports[_0xc99a('0x28')]=function(_0x1db384,_0x32861a){var _0xdfc565={},_0x5be439={},_0x5b15e7={'count':0x0,'rows':[]};var _0x500255=_['map'](db[_0xc99a('0x29')]['rawAttributes'],function(_0x2bc227){return{'name':_0x2bc227['fieldName'],'type':_0x2bc227[_0xc99a('0x2a')][_0xc99a('0x2b')]};});_0x5be439['model']=_['map'](_0x500255,'name');_0x5be439[_0xc99a('0x2c')]=_['keys'](_0x1db384[_0xc99a('0x2c')]);_0x5be439[_0xc99a('0x2d')]=_['intersection'](_0x5be439[_0xc99a('0x2e')],_0x5be439[_0xc99a('0x2c')]);_0xdfc565['attributes']=_[_0xc99a('0x2f')](_0x5be439['model'],qs['fields'](_0x1db384[_0xc99a('0x2c')][_0xc99a('0x30')]));_0xdfc565[_0xc99a('0x31')]=_0xdfc565[_0xc99a('0x31')]['length']?_0xdfc565['attributes']:_0x5be439[_0xc99a('0x2e')];if(!_0x1db384[_0xc99a('0x2c')][_0xc99a('0x32')](_0xc99a('0x33'))){_0xdfc565[_0xc99a('0x1e')]=qs[_0xc99a('0x1e')](_0x1db384[_0xc99a('0x2c')][_0xc99a('0x1e')]);_0xdfc565[_0xc99a('0x1c')]=qs[_0xc99a('0x1c')](_0x1db384[_0xc99a('0x2c')][_0xc99a('0x1c')]);}_0xdfc565[_0xc99a('0x34')]=qs[_0xc99a('0x35')](_0x1db384[_0xc99a('0x2c')][_0xc99a('0x35')]);_0xdfc565['where']=qs[_0xc99a('0x2d')](_[_0xc99a('0x36')](_0x1db384['query'],_0x5be439[_0xc99a('0x2d')]),_0x500255);if(_0x1db384[_0xc99a('0x2c')]['filter']){_0xdfc565[_0xc99a('0x37')]=_['merge'](_0xdfc565['where'],{'$or':_[_0xc99a('0x38')](_0x500255,function(_0x1ef710){if(_0x1ef710[_0xc99a('0x2a')]!=='VIRTUAL'){var _0x17dd88={};_0x17dd88[_0x1ef710[_0xc99a('0x27')]]={'$like':'%'+_0x1db384[_0xc99a('0x2c')]['filter']+'%'};return _0x17dd88;}})});}_0xdfc565=_[_0xc99a('0x39')]({},_0xdfc565,_0x1db384[_0xc99a('0x3a')]);var _0x491693={'where':_0xdfc565[_0xc99a('0x37')]};return db['FaxTransferReport'][_0xc99a('0x1f')](_0x491693)['then'](function(_0x2fe5c6){_0x5b15e7[_0xc99a('0x1f')]=_0x2fe5c6;if(_0x1db384[_0xc99a('0x2c')]['includeAll']){_0xdfc565[_0xc99a('0x3b')]=[{'all':!![]}];}return db[_0xc99a('0x29')][_0xc99a('0x3c')](_0xdfc565);})['then'](function(_0x77b8ba){_0x5b15e7[_0xc99a('0x3d')]=_0x77b8ba;return _0x5b15e7;})[_0xc99a('0x24')](respondWithFilteredResult(_0x32861a,_0xdfc565))['catch'](handleError(_0x32861a,null));};exports[_0xc99a('0x3e')]=function(_0x1f9822,_0x3cd39e){var _0x3ade25={'raw':!![],'where':{'id':_0x1f9822['params']['id']}},_0x38dc52={};_0x38dc52['model']=_[_0xc99a('0x3f')](db[_0xc99a('0x29')][_0xc99a('0x40')]);_0x38dc52[_0xc99a('0x2c')]=_[_0xc99a('0x3f')](_0x1f9822[_0xc99a('0x2c')]);_0x38dc52[_0xc99a('0x2d')]=_['intersection'](_0x38dc52[_0xc99a('0x2e')],_0x38dc52['query']);_0x3ade25[_0xc99a('0x31')]=_[_0xc99a('0x2f')](_0x38dc52['model'],qs[_0xc99a('0x30')](_0x1f9822[_0xc99a('0x2c')][_0xc99a('0x30')]));_0x3ade25[_0xc99a('0x31')]=_0x3ade25[_0xc99a('0x31')]['length']?_0x3ade25[_0xc99a('0x31')]:_0x38dc52[_0xc99a('0x2e')];if(_0x1f9822[_0xc99a('0x2c')][_0xc99a('0x41')]){_0x3ade25['include']=[{'all':!![]}];}_0x3ade25=_['merge']({},_0x3ade25,_0x1f9822[_0xc99a('0x3a')]);return db[_0xc99a('0x29')][_0xc99a('0x42')](_0x3ade25)[_0xc99a('0x24')](handleEntityNotFound(_0x3cd39e,null))[_0xc99a('0x24')](respondWithResult(_0x3cd39e,null))[_0xc99a('0x43')](handleError(_0x3cd39e,null));};exports[_0xc99a('0x44')]=function(_0x3bf9bd,_0x1e61d5){return db[_0xc99a('0x29')][_0xc99a('0x44')](_0x3bf9bd[_0xc99a('0x45')],{})[_0xc99a('0x24')](respondWithResult(_0x1e61d5,0xc9))[_0xc99a('0x43')](handleError(_0x1e61d5,null));};exports[_0xc99a('0x23')]=function(_0x5c3ea0,_0x24fb8e){if(_0x5c3ea0[_0xc99a('0x45')]['id']){delete _0x5c3ea0[_0xc99a('0x45')]['id'];}return db[_0xc99a('0x29')][_0xc99a('0x42')]({'where':{'id':_0x5c3ea0[_0xc99a('0x46')]['id']}})[_0xc99a('0x24')](handleEntityNotFound(_0x24fb8e,null))[_0xc99a('0x24')](saveUpdates(_0x5c3ea0[_0xc99a('0x45')],null))[_0xc99a('0x24')](respondWithResult(_0x24fb8e,null))[_0xc99a('0x43')](handleError(_0x24fb8e,null));};exports[_0xc99a('0x25')]=function(_0x18495b,_0x3b24d5){return db[_0xc99a('0x29')][_0xc99a('0x42')]({'where':{'id':_0x18495b[_0xc99a('0x46')]['id']}})[_0xc99a('0x24')](handleEntityNotFound(_0x3b24d5,null))[_0xc99a('0x24')](removeEntity(_0x3b24d5,null))['catch'](handleError(_0x3b24d5,null));};exports[_0xc99a('0x47')]=function(_0x4bdc41,_0x2473a2){return db[_0xc99a('0x29')][_0xc99a('0x47')]()[_0xc99a('0x24')](respondWithResult(_0x2473a2,null))['catch'](handleError(_0x2473a2,null));}; \ No newline at end of file +var _0xbe8c=['findAll','rows','catch','show','length','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','then','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x53158d,_0x238839){var _0x114fc6=function(_0x556a6d){while(--_0x556a6d){_0x53158d['push'](_0x53158d['shift']());}};_0x114fc6(++_0x238839);}(_0xbe8c,0x9e));var _0xcbe8=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xbe8c[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0xcbe8('0x0'));var rimraf=require(_0xcbe8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcbe8('0x2'));var rp=require(_0xcbe8('0x3'));var moment=require(_0xcbe8('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xcbe8('0x5'));var sox=require(_0xcbe8('0x6'));var csv=require(_0xcbe8('0x7'));var ejs=require(_0xcbe8('0x8'));var fs=require('fs');var fs_extra=require(_0xcbe8('0x9'));var _=require(_0xcbe8('0xa'));var squel=require('squel');var crypto=require(_0xcbe8('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xcbe8('0xc'));var toCsv=require(_0xcbe8('0x7'));var querystring=require(_0xcbe8('0xd'));var Papa=require(_0xcbe8('0xe'));var Redis=require(_0xcbe8('0xf'));var authService=require(_0xcbe8('0x10'));var qs=require(_0xcbe8('0x11'));var as=require(_0xcbe8('0x12'));var hardwareService=require(_0xcbe8('0x13'));var logger=require('../../config/logger')(_0xcbe8('0x14'));var utils=require(_0xcbe8('0x15'));var config=require(_0xcbe8('0x16'));var licenseUtil=require(_0xcbe8('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54a8f3,_0x25db9a){_0x25db9a=_0x25db9a||0xcc;return function(_0x514e49){if(_0x514e49){return _0x54a8f3[_0xcbe8('0x18')](_0x25db9a);}return _0x54a8f3[_0xcbe8('0x19')](_0x25db9a)[_0xcbe8('0x1a')]();};}function respondWithResult(_0x3a2aec,_0x14c9cd){_0x14c9cd=_0x14c9cd||0xc8;return function(_0x515f2f){if(_0x515f2f){return _0x3a2aec['status'](_0x14c9cd)[_0xcbe8('0x1b')](_0x515f2f);}};}function respondWithFilteredResult(_0xb82948,_0x53a41e){return function(_0x30c4ec){if(_0x30c4ec){var _0x366dd9=typeof _0x53a41e[_0xcbe8('0x1c')]===_0xcbe8('0x1d')&&typeof _0x53a41e[_0xcbe8('0x1e')]===_0xcbe8('0x1d');var _0x36d0f6=_0x30c4ec['count'];var _0x23b3a6=_0x366dd9?0x0:_0x53a41e[_0xcbe8('0x1c')];var _0x32231a=_0x366dd9?_0x30c4ec[_0xcbe8('0x1f')]:_0x53a41e[_0xcbe8('0x1c')]+_0x53a41e[_0xcbe8('0x1e')];var _0x2589b6;if(_0x32231a>=_0x36d0f6){_0x32231a=_0x36d0f6;_0x2589b6=0xc8;}else{_0x2589b6=0xce;}_0xb82948[_0xcbe8('0x19')](_0x2589b6);return _0xb82948[_0xcbe8('0x20')](_0xcbe8('0x21'),_0x23b3a6+'-'+_0x32231a+'/'+_0x36d0f6)[_0xcbe8('0x1b')](_0x30c4ec);}return null;};}function patchUpdates(_0x1d343a){return function(_0x2dfc2b){try{jsonpatch['apply'](_0x2dfc2b,_0x1d343a,!![]);}catch(_0x4b44f5){return BPromise[_0xcbe8('0x22')](_0x4b44f5);}return _0x2dfc2b['save']();};}function saveUpdates(_0x244b55,_0x320ceb){return function(_0x3aac1d){if(_0x3aac1d){return _0x3aac1d[_0xcbe8('0x23')](_0x244b55)['then'](function(_0x3f6763){return _0x3f6763;});}return null;};}function removeEntity(_0x3d3cf6,_0x1a47a7){return function(_0x1a2d57){if(_0x1a2d57){return _0x1a2d57[_0xcbe8('0x24')]()[_0xcbe8('0x25')](function(){_0x3d3cf6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x47a7b4,_0x35a28d){return function(_0x293427){if(!_0x293427){_0x47a7b4[_0xcbe8('0x18')](0x194);}return _0x293427;};}function handleError(_0x63af00,_0x58824e){_0x58824e=_0x58824e||0x1f4;return function(_0x364de2){logger['error'](_0x364de2[_0xcbe8('0x26')]);if(_0x364de2[_0xcbe8('0x27')]){delete _0x364de2[_0xcbe8('0x27')];}_0x63af00['status'](_0x58824e)[_0xcbe8('0x28')](_0x364de2);};}exports[_0xcbe8('0x29')]=function(_0x37a221,_0x47c219){var _0x1999f1={},_0x58fb65={},_0x2aade6={'count':0x0,'rows':[]};var _0x16caba=_[_0xcbe8('0x2a')](db[_0xcbe8('0x2b')][_0xcbe8('0x2c')],function(_0x192d99){return{'name':_0x192d99[_0xcbe8('0x2d')],'type':_0x192d99[_0xcbe8('0x2e')][_0xcbe8('0x2f')]};});_0x58fb65[_0xcbe8('0x30')]=_[_0xcbe8('0x2a')](_0x16caba,'name');_0x58fb65['query']=_[_0xcbe8('0x31')](_0x37a221[_0xcbe8('0x32')]);_0x58fb65[_0xcbe8('0x33')]=_[_0xcbe8('0x34')](_0x58fb65[_0xcbe8('0x30')],_0x58fb65[_0xcbe8('0x32')]);_0x1999f1[_0xcbe8('0x35')]=_[_0xcbe8('0x34')](_0x58fb65[_0xcbe8('0x30')],qs[_0xcbe8('0x36')](_0x37a221[_0xcbe8('0x32')][_0xcbe8('0x36')]));_0x1999f1[_0xcbe8('0x35')]=_0x1999f1[_0xcbe8('0x35')]['length']?_0x1999f1[_0xcbe8('0x35')]:_0x58fb65[_0xcbe8('0x30')];if(!_0x37a221[_0xcbe8('0x32')]['hasOwnProperty']('nolimit')){_0x1999f1[_0xcbe8('0x1e')]=qs[_0xcbe8('0x1e')](_0x37a221['query'][_0xcbe8('0x1e')]);_0x1999f1[_0xcbe8('0x1c')]=qs[_0xcbe8('0x1c')](_0x37a221['query']['offset']);}_0x1999f1[_0xcbe8('0x37')]=qs[_0xcbe8('0x38')](_0x37a221['query'][_0xcbe8('0x38')]);_0x1999f1[_0xcbe8('0x39')]=qs[_0xcbe8('0x33')](_[_0xcbe8('0x3a')](_0x37a221[_0xcbe8('0x32')],_0x58fb65[_0xcbe8('0x33')]),_0x16caba);if(_0x37a221[_0xcbe8('0x32')][_0xcbe8('0x3b')]){_0x1999f1[_0xcbe8('0x39')]=_[_0xcbe8('0x3c')](_0x1999f1[_0xcbe8('0x39')],{'$or':_['map'](_0x16caba,function(_0x37eb0c){if(_0x37eb0c['type']!==_0xcbe8('0x3d')){var _0x115da4={};_0x115da4[_0x37eb0c[_0xcbe8('0x27')]]={'$like':'%'+_0x37a221['query'][_0xcbe8('0x3b')]+'%'};return _0x115da4;}})});}_0x1999f1=_[_0xcbe8('0x3c')]({},_0x1999f1,_0x37a221[_0xcbe8('0x3e')]);var _0x7ae3b9={'where':_0x1999f1['where']};return db[_0xcbe8('0x2b')][_0xcbe8('0x1f')](_0x7ae3b9)[_0xcbe8('0x25')](function(_0x36f388){_0x2aade6[_0xcbe8('0x1f')]=_0x36f388;if(_0x37a221[_0xcbe8('0x32')][_0xcbe8('0x3f')]){_0x1999f1['include']=[{'all':!![]}];}return db[_0xcbe8('0x2b')][_0xcbe8('0x40')](_0x1999f1);})[_0xcbe8('0x25')](function(_0x416576){_0x2aade6[_0xcbe8('0x41')]=_0x416576;return _0x2aade6;})[_0xcbe8('0x25')](respondWithFilteredResult(_0x47c219,_0x1999f1))[_0xcbe8('0x42')](handleError(_0x47c219,null));};exports[_0xcbe8('0x43')]=function(_0x1d4ce5,_0xb5b0e){var _0xdc82fc={'raw':!![],'where':{'id':_0x1d4ce5['params']['id']}},_0x14f8a3={};_0x14f8a3[_0xcbe8('0x30')]=_[_0xcbe8('0x31')](db['FaxTransferReport']['rawAttributes']);_0x14f8a3[_0xcbe8('0x32')]=_['keys'](_0x1d4ce5[_0xcbe8('0x32')]);_0x14f8a3['filters']=_[_0xcbe8('0x34')](_0x14f8a3[_0xcbe8('0x30')],_0x14f8a3[_0xcbe8('0x32')]);_0xdc82fc[_0xcbe8('0x35')]=_[_0xcbe8('0x34')](_0x14f8a3[_0xcbe8('0x30')],qs[_0xcbe8('0x36')](_0x1d4ce5[_0xcbe8('0x32')][_0xcbe8('0x36')]));_0xdc82fc['attributes']=_0xdc82fc[_0xcbe8('0x35')][_0xcbe8('0x44')]?_0xdc82fc[_0xcbe8('0x35')]:_0x14f8a3[_0xcbe8('0x30')];if(_0x1d4ce5[_0xcbe8('0x32')][_0xcbe8('0x3f')]){_0xdc82fc['include']=[{'all':!![]}];}_0xdc82fc=_[_0xcbe8('0x3c')]({},_0xdc82fc,_0x1d4ce5[_0xcbe8('0x3e')]);return db[_0xcbe8('0x2b')][_0xcbe8('0x45')](_0xdc82fc)[_0xcbe8('0x25')](handleEntityNotFound(_0xb5b0e,null))[_0xcbe8('0x25')](respondWithResult(_0xb5b0e,null))[_0xcbe8('0x42')](handleError(_0xb5b0e,null));};exports[_0xcbe8('0x46')]=function(_0x32d8b3,_0x150380){return db[_0xcbe8('0x2b')][_0xcbe8('0x46')](_0x32d8b3['body'],{})['then'](respondWithResult(_0x150380,0xc9))['catch'](handleError(_0x150380,null));};exports[_0xcbe8('0x23')]=function(_0x13cfb9,_0x5766bf){if(_0x13cfb9[_0xcbe8('0x47')]['id']){delete _0x13cfb9[_0xcbe8('0x47')]['id'];}return db[_0xcbe8('0x2b')][_0xcbe8('0x45')]({'where':{'id':_0x13cfb9['params']['id']}})[_0xcbe8('0x25')](handleEntityNotFound(_0x5766bf,null))['then'](saveUpdates(_0x13cfb9[_0xcbe8('0x47')],null))[_0xcbe8('0x25')](respondWithResult(_0x5766bf,null))[_0xcbe8('0x42')](handleError(_0x5766bf,null));};exports[_0xcbe8('0x24')]=function(_0x4ce817,_0x1eb09f){return db[_0xcbe8('0x2b')][_0xcbe8('0x45')]({'where':{'id':_0x4ce817[_0xcbe8('0x48')]['id']}})[_0xcbe8('0x25')](handleEntityNotFound(_0x1eb09f,null))[_0xcbe8('0x25')](removeEntity(_0x1eb09f,null))['catch'](handleError(_0x1eb09f,null));};exports['describe']=function(_0x866963,_0x4cab62){return db[_0xcbe8('0x2b')][_0xcbe8('0x49')]()['then'](respondWithResult(_0x4cab62,null))[_0xcbe8('0x42')](handleError(_0x4cab62,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 40bda60..b3a71df 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 _0x2739=['moment','path','rimraf','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash'];(function(_0x4eae87,_0x2f46ce){var _0x4f8c9e=function(_0x55db90){while(--_0x55db90){_0x4eae87['push'](_0x4eae87['shift']());}};_0x4f8c9e(++_0x2f46ce);}(_0x2739,0x8b));var _0x9273=function(_0x351ae7,_0x1853cc){_0x351ae7=_0x351ae7-0x0;var _0x435af0=_0x2739[_0x351ae7];return _0x435af0;};'use strict';var _=require(_0x9273('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x9273('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9273('0x2'));var rimraf=require(_0x9273('0x3'));var config=require('../../config/environment');var attributes=require(_0x9273('0x4'));module[_0x9273('0x5')]=function(_0x35bb0a,_0x37e8c6){return _0x35bb0a[_0x9273('0x6')](_0x9273('0x7'),attributes,{'tableName':_0x9273('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9273('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf7fb=['moment','bluebird','path','../../config/environment','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','api'];(function(_0x40ebff,_0x1dd15e){var _0x40122a=function(_0xae6174){while(--_0xae6174){_0x40ebff['push'](_0x40ebff['shift']());}};_0x40122a(++_0x1dd15e);}(_0xf7fb,0x1cc));var _0xbf7f=function(_0xbc1e88,_0x521f1e){_0xbc1e88=_0xbc1e88-0x0;var _0x4a51c7=_0xf7fb[_0xbc1e88];return _0x4a51c7;};'use strict';var _=require(_0xbf7f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbf7f('0x1'));var moment=require(_0xbf7f('0x2'));var BPromise=require(_0xbf7f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf7f('0x4'));var rimraf=require('rimraf');var config=require(_0xbf7f('0x5'));var attributes=require('./faxTransferReport.attributes');module[_0xbf7f('0x6')]=function(_0x1b00b5,_0x492c34){return _0x1b00b5[_0xbf7f('0x7')](_0xbf7f('0x8'),attributes,{'tableName':_0xbf7f('0x9'),'paranoid':![],'indexes':[{'name':_0xbf7f('0xa'),'fields':[_0xbf7f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index ca5778c..147df40 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 _0x78d3=['error','FaxTransferReport,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x134557,_0x19ea33){var _0x1ab4eb=function(_0x39231d){while(--_0x39231d){_0x134557['push'](_0x134557['shift']());}};_0x1ab4eb(++_0x19ea33);}(_0x78d3,0xc3));var _0x378d=function(_0x3046bb,_0x569f17){_0x3046bb=_0x3046bb-0x0;var _0x2402dc=_0x78d3[_0x3046bb];return _0x2402dc;};'use strict';var _=require(_0x378d('0x0'));var util=require('util');var moment=require(_0x378d('0x1'));var BPromise=require(_0x378d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x378d('0x3'));var db=require(_0x378d('0x4'))['db'];var utils=require(_0x378d('0x5'));var logger=require(_0x378d('0x6'))(_0x378d('0x7'));var config=require(_0x378d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x378d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x560431,_0x573eb6,_0x110ade){return new BPromise(function(_0x48d7a1,_0x5b78c6){return client['request'](_0x560431,_0x110ade)[_0x378d('0xa')](function(_0x2868a5){logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x573eb6,_0x378d('0xb'));logger[_0x378d('0xc')](_0x378d('0xd'),_0x573eb6,_0x378d('0xb'),JSON[_0x378d('0xe')](_0x2868a5));if(_0x2868a5['error']){if(_0x2868a5[_0x378d('0xf')]['code']===0x1f4){logger[_0x378d('0xf')](_0x378d('0x10'),_0x573eb6,_0x2868a5[_0x378d('0xf')][_0x378d('0x11')]);return _0x5b78c6(_0x2868a5[_0x378d('0xf')]['message']);}logger[_0x378d('0xf')](_0x378d('0x10'),_0x573eb6,_0x2868a5['error'][_0x378d('0x11')]);return _0x48d7a1(_0x2868a5['error'][_0x378d('0x11')]);}else{logger[_0x378d('0x12')](_0x378d('0x10'),_0x573eb6,'request\x20sent');_0x48d7a1(_0x2868a5[_0x378d('0x13')][_0x378d('0x11')]);}})[_0x378d('0x14')](function(_0x5a0e22){logger[_0x378d('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x573eb6,_0x5a0e22);_0x5b78c6(_0x5a0e22);});});} \ No newline at end of file +var _0xe317=['then','info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','request'];(function(_0x3c25da,_0x1bc538){var _0x21a1a0=function(_0x3bb8d1){while(--_0x3bb8d1){_0x3c25da['push'](_0x3c25da['shift']());}};_0x21a1a0(++_0x1bc538);}(_0xe317,0xe7));var _0x7e31=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xe317[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x7e31('0x0'));var util=require(_0x7e31('0x1'));var moment=require(_0x7e31('0x2'));var BPromise=require(_0x7e31('0x3'));var rs=require(_0x7e31('0x4'));var fs=require('fs');var Redis=require(_0x7e31('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7e31('0x6'));var logger=require(_0x7e31('0x7'))(_0x7e31('0x8'));var config=require(_0x7e31('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2d1083,_0x4371fb,_0x337f14){return new BPromise(function(_0x14f678,_0x3b5185){return client[_0x7e31('0xa')](_0x2d1083,_0x337f14)[_0x7e31('0xb')](function(_0x14fd18){logger[_0x7e31('0xc')](_0x7e31('0xd'),_0x4371fb,'request\x20sent');logger[_0x7e31('0xe')](_0x7e31('0xf'),_0x4371fb,_0x7e31('0x10'),JSON[_0x7e31('0x11')](_0x14fd18));if(_0x14fd18['error']){if(_0x14fd18['error'][_0x7e31('0x12')]===0x1f4){logger[_0x7e31('0x13')](_0x7e31('0xd'),_0x4371fb,_0x14fd18['error'][_0x7e31('0x14')]);return _0x3b5185(_0x14fd18[_0x7e31('0x13')][_0x7e31('0x14')]);}logger[_0x7e31('0x13')](_0x7e31('0xd'),_0x4371fb,_0x14fd18[_0x7e31('0x13')]['message']);return _0x14f678(_0x14fd18[_0x7e31('0x13')][_0x7e31('0x14')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x4371fb,'request\x20sent');_0x14f678(_0x14fd18['result'][_0x7e31('0x14')]);}})[_0x7e31('0x15')](function(_0x500c16){logger[_0x7e31('0x13')](_0x7e31('0xd'),_0x4371fb,_0x500c16);_0x3b5185(_0x500c16);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 2301811..eb97bd1 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 _0xf223=['put','update','exports','multer','path','connect-timeout','Router','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create'];(function(_0x346e23,_0x1defdd){var _0x8cb436=function(_0x370ece){while(--_0x370ece){_0x346e23['push'](_0x346e23['shift']());}};_0x8cb436(++_0x1defdd);}(_0xf223,0x1ac));var _0x3f22=function(_0x71b675,_0x4a2b8a){_0x71b675=_0x71b675-0x0;var _0x1ce6cf=_0xf223[_0x71b675];return _0x1ce6cf;};'use strict';var multer=require(_0x3f22('0x0'));var util=require('util');var path=require(_0x3f22('0x1'));var timeout=require(_0x3f22('0x2'));var express=require('express');var router=express[_0x3f22('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3f22('0x4'));var controller=require(_0x3f22('0x5'));router[_0x3f22('0x6')]('/',auth[_0x3f22('0x7')](),controller[_0x3f22('0x8')]);router[_0x3f22('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x3f22('0x9')]);router['get'](_0x3f22('0xa'),auth['isAuthenticated'](),controller[_0x3f22('0xb')]);router[_0x3f22('0xc')]('/',auth[_0x3f22('0x7')](),controller[_0x3f22('0xd')]);router[_0x3f22('0xe')](_0x3f22('0xa'),auth[_0x3f22('0x7')](),controller[_0x3f22('0xf')]);router['delete'](_0x3f22('0xa'),auth[_0x3f22('0x7')](),controller['destroy']);module[_0x3f22('0x10')]=router; \ No newline at end of file +var _0xd3aa=['Router','fs-extra','../../components/auth/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','multer','connect-timeout','express'];(function(_0x47e1b3,_0x4b152){var _0x20fe19=function(_0x1ce9f3){while(--_0x1ce9f3){_0x47e1b3['push'](_0x47e1b3['shift']());}};_0x20fe19(++_0x4b152);}(_0xd3aa,0x140));var _0xad3a=function(_0x258fb0,_0x5362dc){_0x258fb0=_0x258fb0-0x0;var _0x4d1afe=_0xd3aa[_0x258fb0];return _0x4d1afe;};'use strict';var multer=require(_0xad3a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xad3a('0x1'));var express=require(_0xad3a('0x2'));var router=express[_0xad3a('0x3')]();var fs_extra=require(_0xad3a('0x4'));var auth=require(_0xad3a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xad3a('0x6'));var controller=require(_0xad3a('0x7'));router[_0xad3a('0x8')]('/',auth[_0xad3a('0x9')](),controller['index']);router['get']('/describe',auth[_0xad3a('0x9')](),controller[_0xad3a('0xa')]);router['get'](_0xad3a('0xb'),auth['isAuthenticated'](),controller[_0xad3a('0xc')]);router[_0xad3a('0xd')]('/',auth[_0xad3a('0x9')](),controller[_0xad3a('0xe')]);router[_0xad3a('0xf')]('/:id',auth[_0xad3a('0x9')](),controller[_0xad3a('0x10')]);router[_0xad3a('0x11')](_0xad3a('0xb'),auth[_0xad3a('0x9')](),controller[_0xad3a('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 3909a07..34e2063 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 _0xc35f=['getConfigurations','/:id/fields','getFields','create','post','/:id/configurations','put','update','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','/:id','isAuthenticated','show'];(function(_0x3384a7,_0x374ae8){var _0x3e5147=function(_0x3040e9){while(--_0x3040e9){_0x3384a7['push'](_0x3384a7['shift']());}};_0x3e5147(++_0x374ae8);}(_0xc35f,0x65));var _0xfc35=function(_0x160582,_0x451d94){_0x160582=_0x160582-0x0;var _0x4cf348=_0xc35f[_0x160582];return _0x4cf348;};'use strict';var multer=require(_0xfc35('0x0'));var util=require(_0xfc35('0x1'));var path=require(_0xfc35('0x2'));var timeout=require('connect-timeout');var express=require(_0xfc35('0x3'));var router=express[_0xfc35('0x4')]();var fs_extra=require(_0xfc35('0x5'));var auth=require(_0xfc35('0x6'));var interaction=require(_0xfc35('0x7'));var config=require(_0xfc35('0x8'));var controller=require(_0xfc35('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xfc35('0xa')](_0xfc35('0xb'),auth[_0xfc35('0xc')](),controller[_0xfc35('0xd')]);router[_0xfc35('0xa')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xfc35('0xe')]);router['get'](_0xfc35('0xf'),auth[_0xfc35('0xc')](),controller[_0xfc35('0x10')]);router['post']('/',auth[_0xfc35('0xc')](),controller[_0xfc35('0x11')]);router[_0xfc35('0x12')](_0xfc35('0x13'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xfc35('0x14')](_0xfc35('0xb'),auth[_0xfc35('0xc')](),controller[_0xfc35('0x15')]);router['delete'](_0xfc35('0xb'),auth[_0xfc35('0xc')](),controller[_0xfc35('0x16')]);module['exports']=router; \ No newline at end of file +var _0x77d0=['get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x30cd7e,_0x4db10a){var _0x462a02=function(_0x157d81){while(--_0x157d81){_0x30cd7e['push'](_0x30cd7e['shift']());}};_0x462a02(++_0x4db10a);}(_0x77d0,0x12d));var _0x077d=function(_0x504f9d,_0x309195){_0x504f9d=_0x504f9d-0x0;var _0x30c273=_0x77d0[_0x504f9d];return _0x30c273;};'use strict';var multer=require(_0x077d('0x0'));var util=require(_0x077d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x077d('0x2'));var auth=require(_0x077d('0x3'));var interaction=require(_0x077d('0x4'));var config=require('../../config/environment');var controller=require('./intDeskAccount.controller');router[_0x077d('0x5')]('/',auth[_0x077d('0x6')](),controller['index']);router[_0x077d('0x5')](_0x077d('0x7'),auth['isAuthenticated'](),controller[_0x077d('0x8')]);router['get'](_0x077d('0x9'),auth[_0x077d('0x6')](),controller[_0x077d('0xa')]);router[_0x077d('0x5')](_0x077d('0xb'),auth[_0x077d('0x6')](),controller[_0x077d('0xc')]);router[_0x077d('0xd')]('/',auth[_0x077d('0x6')](),controller['create']);router[_0x077d('0xd')](_0x077d('0x9'),auth['isAuthenticated'](),controller[_0x077d('0xe')]);router[_0x077d('0xf')](_0x077d('0x7'),auth[_0x077d('0x6')](),controller[_0x077d('0x10')]);router[_0x077d('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 59addd9..e803700 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 _0x423e=['ENUM','basic','newTab','integrationTab','sequelize','exports','STRING'];(function(_0x26bec8,_0x2cca48){var _0x4a5d80=function(_0x3f819d){while(--_0x3f819d){_0x26bec8['push'](_0x26bec8['shift']());}};_0x4a5d80(++_0x2cca48);}(_0x423e,0xf2));var _0xe423=function(_0x3c54d3,_0x9719e3){_0x3c54d3=_0x3c54d3-0x0;var _0xd67c8f=_0x423e[_0x3c54d3];return _0xd67c8f;};'use strict';var Sequelize=require(_0xe423('0x0'));module[_0xe423('0x1')]={'name':{'type':Sequelize[_0xe423('0x2')]},'description':{'type':Sequelize[_0xe423('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xe423('0x2')]},'authType':{'type':Sequelize[_0xe423('0x3')](_0xe423('0x4')),'defaultValue':_0xe423('0x4')},'password':{'type':Sequelize[_0xe423('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xe423('0x2')]},'token':{'type':Sequelize[_0xe423('0x2')]},'tokenSecret':{'type':Sequelize[_0xe423('0x2')]},'serverUrl':{'type':Sequelize[_0xe423('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe423('0x3')]('integrationTab',_0xe423('0x5')),'defaultValue':_0xe423('0x6')}}; \ No newline at end of file +var _0xbacd=['exports','STRING','basic','ENUM','integrationTab'];(function(_0x404dc4,_0x13cc13){var _0x574739=function(_0x29e484){while(--_0x29e484){_0x404dc4['push'](_0x404dc4['shift']());}};_0x574739(++_0x13cc13);}(_0xbacd,0x159));var _0xdbac=function(_0x33171d,_0x2ee14c){_0x33171d=_0x33171d-0x0;var _0x5c3c83=_0xbacd[_0x33171d];return _0x5c3c83;};'use strict';var Sequelize=require('sequelize');module[_0xdbac('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdbac('0x1')]},'username':{'type':Sequelize[_0xdbac('0x1')]},'remoteUri':{'type':Sequelize[_0xdbac('0x1')]},'authType':{'type':Sequelize['ENUM'](_0xdbac('0x2')),'defaultValue':'basic'},'password':{'type':Sequelize[_0xdbac('0x1')]},'consumerKey':{'type':Sequelize[_0xdbac('0x1')]},'consumerSecret':{'type':Sequelize[_0xdbac('0x1')]},'token':{'type':Sequelize[_0xdbac('0x1')]},'tokenSecret':{'type':Sequelize[_0xdbac('0x1')]},'serverUrl':{'type':Sequelize[_0xdbac('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xdbac('0x3')](_0xdbac('0x4'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 882fa43..2768e79 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 _0x663c=['lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','%s:%s','password','toString','concat','_embedded','entries','active','label','test','statusCode','stringify','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','DeskAccount','fieldName','type','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','filter','merge','VIRTUAL','where','includeAll','include','findAll','rows','catch','show','rawAttributes','fields','options','find','create','body','params','getConfigurations','DeskConfiguration','pick','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','consumerKey','token','tokenSecret','slice','substring'];(function(_0x1a0322,_0x2802d4){var _0x391779=function(_0x3d3c7c){while(--_0x3d3c7c){_0x1a0322['push'](_0x1a0322['shift']());}};_0x391779(++_0x2802d4);}(_0x663c,0xf5));var _0xc663=function(_0x3f6bcf,_0x531e79){_0x3f6bcf=_0x3f6bcf-0x0;var _0x1c5350=_0x663c[_0x3f6bcf];return _0x1c5350;};'use strict';var emlformat=require(_0xc663('0x0'));var rimraf=require(_0xc663('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc663('0x2'));var rp=require(_0xc663('0x3'));var moment=require(_0xc663('0x4'));var BPromise=require(_0xc663('0x5'));var Mustache=require(_0xc663('0x6'));var util=require('util');var path=require(_0xc663('0x7'));var sox=require(_0xc663('0x8'));var csv=require(_0xc663('0x9'));var ejs=require(_0xc663('0xa'));var fs=require('fs');var fs_extra=require(_0xc663('0xb'));var _=require(_0xc663('0xc'));var squel=require(_0xc663('0xd'));var crypto=require(_0xc663('0xe'));var jsforce=require(_0xc663('0xf'));var deskjs=require(_0xc663('0x10'));var toCsv=require(_0xc663('0x9'));var querystring=require('querystring');var Papa=require(_0xc663('0x11'));var Redis=require(_0xc663('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc663('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc663('0x14'));var logger=require(_0xc663('0x15'))('api');var utils=require(_0xc663('0x16'));var config=require(_0xc663('0x17'));var licenseUtil=require(_0xc663('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0xc663('0x19'));function respondWithStatusCode(_0x4ff0b9,_0x867d68){_0x867d68=_0x867d68||0xcc;return function(_0x15b399){if(_0x15b399){return _0x4ff0b9['sendStatus'](_0x867d68);}return _0x4ff0b9[_0xc663('0x1a')](_0x867d68)[_0xc663('0x1b')]();};}function respondWithResult(_0x57cacd,_0x54a9ab){_0x54a9ab=_0x54a9ab||0xc8;return function(_0x284a5e){if(_0x284a5e){return _0x57cacd['status'](_0x54a9ab)[_0xc663('0x1c')](_0x284a5e);}};}function respondWithFilteredResult(_0x2c58b8,_0x2532a7){return function(_0x17436b){if(_0x17436b){var _0x4affd4=typeof _0x2532a7[_0xc663('0x1d')]===_0xc663('0x1e')&&typeof _0x2532a7['limit']==='undefined';var _0x12a20b=_0x17436b[_0xc663('0x1f')];var _0x1722b9=_0x4affd4?0x0:_0x2532a7[_0xc663('0x1d')];var _0xceb0c9=_0x4affd4?_0x17436b[_0xc663('0x1f')]:_0x2532a7[_0xc663('0x1d')]+_0x2532a7[_0xc663('0x20')];var _0x48514a;if(_0xceb0c9>=_0x12a20b){_0xceb0c9=_0x12a20b;_0x48514a=0xc8;}else{_0x48514a=0xce;}_0x2c58b8[_0xc663('0x1a')](_0x48514a);return _0x2c58b8['set'](_0xc663('0x21'),_0x1722b9+'-'+_0xceb0c9+'/'+_0x12a20b)[_0xc663('0x1c')](_0x17436b);}return null;};}function patchUpdates(_0x1205d2){return function(_0x33350b){try{jsonpatch[_0xc663('0x22')](_0x33350b,_0x1205d2,!![]);}catch(_0x146a8e){return BPromise[_0xc663('0x23')](_0x146a8e);}return _0x33350b['save']();};}function saveUpdates(_0x4a0356,_0x336ef4){return function(_0x3fee1f){if(_0x3fee1f){return _0x3fee1f[_0xc663('0x24')](_0x4a0356)[_0xc663('0x25')](function(_0x1d7813){return _0x1d7813;});}return null;};}function removeEntity(_0x5b6a71,_0x5e3c17){return function(_0xe670f9){if(_0xe670f9){return _0xe670f9[_0xc663('0x26')]()[_0xc663('0x25')](function(){_0x5b6a71[_0xc663('0x1a')](0xcc)[_0xc663('0x1b')]();});}};}function handleEntityNotFound(_0x419b2f,_0x591afe){return function(_0x5e3c4a){if(!_0x5e3c4a){_0x419b2f['sendStatus'](0x194);}return _0x5e3c4a;};}function handleError(_0x354ec3,_0x3090bc){_0x3090bc=_0x3090bc||0x1f4;return function(_0x5e20b7){logger[_0xc663('0x27')](_0x5e20b7[_0xc663('0x28')]);if(_0x5e20b7[_0xc663('0x29')]){delete _0x5e20b7['name'];}_0x354ec3[_0xc663('0x1a')](_0x3090bc)['send'](_0x5e20b7);};}exports[_0xc663('0x2a')]=function(_0x3a33f2,_0x58da86){var _0x323712={},_0x5bf383={},_0x1f5b22={'count':0x0,'rows':[]};var _0x3378d9=_[_0xc663('0x2b')](db[_0xc663('0x2c')]['rawAttributes'],function(_0x1c764f){return{'name':_0x1c764f[_0xc663('0x2d')],'type':_0x1c764f[_0xc663('0x2e')]['key']};});_0x5bf383[_0xc663('0x2f')]=_[_0xc663('0x2b')](_0x3378d9,_0xc663('0x29'));_0x5bf383['query']=_[_0xc663('0x30')](_0x3a33f2[_0xc663('0x31')]);_0x5bf383[_0xc663('0x32')]=_[_0xc663('0x33')](_0x5bf383[_0xc663('0x2f')],_0x5bf383['query']);_0x323712[_0xc663('0x34')]=_[_0xc663('0x33')](_0x5bf383[_0xc663('0x2f')],qs['fields'](_0x3a33f2['query']['fields']));_0x323712[_0xc663('0x34')]=_0x323712[_0xc663('0x34')][_0xc663('0x35')]?_0x323712[_0xc663('0x34')]:_0x5bf383['model'];if(!_0x3a33f2['query'][_0xc663('0x36')]('nolimit')){_0x323712[_0xc663('0x20')]=qs[_0xc663('0x20')](_0x3a33f2[_0xc663('0x31')][_0xc663('0x20')]);_0x323712['offset']=qs[_0xc663('0x1d')](_0x3a33f2[_0xc663('0x31')][_0xc663('0x1d')]);}_0x323712[_0xc663('0x37')]=qs[_0xc663('0x38')](_0x3a33f2[_0xc663('0x31')]['sort']);_0x323712['where']=qs[_0xc663('0x32')](_['pick'](_0x3a33f2[_0xc663('0x31')],_0x5bf383[_0xc663('0x32')]),_0x3378d9);if(_0x3a33f2[_0xc663('0x31')][_0xc663('0x39')]){_0x323712['where']=_[_0xc663('0x3a')](_0x323712['where'],{'$or':_[_0xc663('0x2b')](_0x3378d9,function(_0x24eaf9){if(_0x24eaf9[_0xc663('0x2e')]!==_0xc663('0x3b')){var _0x7fea98={};_0x7fea98[_0x24eaf9[_0xc663('0x29')]]={'$like':'%'+_0x3a33f2[_0xc663('0x31')][_0xc663('0x39')]+'%'};return _0x7fea98;}})});}_0x323712=_[_0xc663('0x3a')]({},_0x323712,_0x3a33f2['options']);var _0x504375={'where':_0x323712[_0xc663('0x3c')]};return db[_0xc663('0x2c')][_0xc663('0x1f')](_0x504375)[_0xc663('0x25')](function(_0x3bbfa8){_0x1f5b22[_0xc663('0x1f')]=_0x3bbfa8;if(_0x3a33f2[_0xc663('0x31')][_0xc663('0x3d')]){_0x323712[_0xc663('0x3e')]=[{'all':!![]}];}return db[_0xc663('0x2c')][_0xc663('0x3f')](_0x323712);})['then'](function(_0x45d6c0){_0x1f5b22[_0xc663('0x40')]=_0x45d6c0;return _0x1f5b22;})[_0xc663('0x25')](respondWithFilteredResult(_0x58da86,_0x323712))[_0xc663('0x41')](handleError(_0x58da86,null));};exports[_0xc663('0x42')]=function(_0x4ed276,_0x39c0d2){var _0x4627a0={'raw':![],'where':{'id':_0x4ed276['params']['id']}},_0x10830d={};_0x10830d[_0xc663('0x2f')]=_['keys'](db[_0xc663('0x2c')][_0xc663('0x43')]);_0x10830d['query']=_[_0xc663('0x30')](_0x4ed276[_0xc663('0x31')]);_0x10830d[_0xc663('0x32')]=_[_0xc663('0x33')](_0x10830d[_0xc663('0x2f')],_0x10830d['query']);_0x4627a0[_0xc663('0x34')]=_['intersection'](_0x10830d[_0xc663('0x2f')],qs[_0xc663('0x44')](_0x4ed276['query'][_0xc663('0x44')]));_0x4627a0['attributes']=_0x4627a0[_0xc663('0x34')]['length']?_0x4627a0[_0xc663('0x34')]:_0x10830d[_0xc663('0x2f')];if(_0x4ed276['query'][_0xc663('0x3d')]){_0x4627a0[_0xc663('0x3e')]=[{'all':!![]}];}_0x4627a0=_[_0xc663('0x3a')]({},_0x4627a0,_0x4ed276[_0xc663('0x45')]);return db['DeskAccount'][_0xc663('0x46')](_0x4627a0)[_0xc663('0x25')](handleEntityNotFound(_0x39c0d2,null))['then'](respondWithResult(_0x39c0d2,null))['catch'](handleError(_0x39c0d2,null));};exports[_0xc663('0x47')]=function(_0x76df04,_0x1d79c6){return db[_0xc663('0x2c')][_0xc663('0x47')](_0x76df04['body'],{})[_0xc663('0x25')](respondWithResult(_0x1d79c6,0xc9))['catch'](handleError(_0x1d79c6,null));};exports[_0xc663('0x24')]=function(_0x4515a3,_0x34da01){if(_0x4515a3[_0xc663('0x48')]['id']){delete _0x4515a3[_0xc663('0x48')]['id'];}return db[_0xc663('0x2c')][_0xc663('0x46')]({'where':{'id':_0x4515a3[_0xc663('0x49')]['id']}})['then'](handleEntityNotFound(_0x34da01,null))['then'](saveUpdates(_0x4515a3[_0xc663('0x48')],null))[_0xc663('0x25')](respondWithResult(_0x34da01,null))[_0xc663('0x41')](handleError(_0x34da01,null));};exports[_0xc663('0x26')]=function(_0x5eb6fb,_0x5420a2){return db[_0xc663('0x2c')][_0xc663('0x46')]({'where':{'id':_0x5eb6fb['params']['id']}})['then'](handleEntityNotFound(_0x5420a2,null))['then'](removeEntity(_0x5420a2,null))[_0xc663('0x41')](handleError(_0x5420a2,null));};exports[_0xc663('0x4a')]=function(_0x111fda,_0x30358b,_0x1b64c7){var _0x22dc44={};var _0x1bfddb={};var _0x1f6746;var _0x4c4112;return db['DeskAccount']['findOne']({'where':{'id':_0x111fda['params']['id']}})[_0xc663('0x25')](handleEntityNotFound(_0x30358b,null))[_0xc663('0x25')](function(_0x1d1136){if(_0x1d1136){_0x1f6746=_0x1d1136;_0x1bfddb[_0xc663('0x2f')]=_['keys'](db[_0xc663('0x4b')][_0xc663('0x43')]);_0x1bfddb[_0xc663('0x31')]=_['keys'](_0x111fda[_0xc663('0x31')]);_0x1bfddb[_0xc663('0x32')]=_[_0xc663('0x33')](_0x1bfddb['model'],_0x1bfddb[_0xc663('0x31')]);_0x22dc44[_0xc663('0x34')]=_[_0xc663('0x33')](_0x1bfddb[_0xc663('0x2f')],qs[_0xc663('0x44')](_0x111fda[_0xc663('0x31')][_0xc663('0x44')]));_0x22dc44[_0xc663('0x34')]=_0x22dc44[_0xc663('0x34')][_0xc663('0x35')]?_0x22dc44[_0xc663('0x34')]:_0x1bfddb[_0xc663('0x2f')];_0x22dc44[_0xc663('0x37')]=qs[_0xc663('0x38')](_0x111fda[_0xc663('0x31')][_0xc663('0x38')]);_0x22dc44[_0xc663('0x3c')]=qs[_0xc663('0x32')](_[_0xc663('0x4c')](_0x111fda[_0xc663('0x31')],_0x1bfddb[_0xc663('0x32')]));if(_0x111fda[_0xc663('0x31')][_0xc663('0x39')]){_0x22dc44[_0xc663('0x3c')]=_[_0xc663('0x3a')](_0x22dc44[_0xc663('0x3c')],{'$or':_[_0xc663('0x2b')](_0x22dc44[_0xc663('0x34')],function(_0x54d03a){var _0x24592d={};_0x24592d[_0x54d03a]={'$like':'%'+_0x111fda['query'][_0xc663('0x39')]+'%'};return _0x24592d;})});}_0x22dc44=_[_0xc663('0x3a')]({},_0x22dc44,_0x111fda[_0xc663('0x45')]);return _0x1f6746[_0xc663('0x4a')](_0x22dc44);}})[_0xc663('0x25')](function(_0x3a3ded){if(_0x3a3ded){_0x4c4112=_0x3a3ded[_0xc663('0x35')];if(!_0x111fda[_0xc663('0x31')]['hasOwnProperty']('nolimit')){_0x22dc44['limit']=qs[_0xc663('0x20')](_0x111fda[_0xc663('0x31')][_0xc663('0x20')]);_0x22dc44['offset']=qs['offset'](_0x111fda[_0xc663('0x31')][_0xc663('0x1d')]);}return _0x1f6746[_0xc663('0x4a')](_0x22dc44);}})[_0xc663('0x25')](function(_0x56da0e){if(_0x56da0e){return _0x56da0e?{'count':_0x4c4112,'rows':_0x56da0e}:null;}})[_0xc663('0x25')](respondWithResult(_0x30358b,null))[_0xc663('0x41')](handleError(_0x30358b,null));};exports['addConfiguration']=function(_0x3df73d,_0x57778a,_0x4860ce){if(_0x3df73d['body']['id']){delete _0x3df73d[_0xc663('0x48')]['id'];}return db[_0xc663('0x2c')][_0xc663('0x4d')]({'where':{'id':_0x3df73d[_0xc663('0x49')]['id']}})[_0xc663('0x25')](handleEntityNotFound(_0x57778a,null))[_0xc663('0x25')](function(_0x54bf35){if(_0x54bf35){_0x3df73d['body']['AccountId']=_0x54bf35['id'];_0x3df73d[_0xc663('0x48')][_0xc663('0x4e')]=integrations[_0xc663('0x4f')](_0x3df73d[_0xc663('0x48')][_0xc663('0x50')],_0x3df73d[_0xc663('0x48')][_0xc663('0x2e')]);_0x3df73d[_0xc663('0x48')][_0xc663('0x51')]=integrations[_0xc663('0x52')](_0x3df73d[_0xc663('0x48')][_0xc663('0x50')],_0x3df73d['body'][_0xc663('0x2e')]);return db[_0xc663('0x4b')][_0xc663('0x47')](_0x3df73d[_0xc663('0x48')],{'include':[{'model':db[_0xc663('0x53')],'as':_0xc663('0x4e')},{'model':db[_0xc663('0x53')],'as':'Descriptions'}]});}return null;})[_0xc663('0x25')](respondWithResult(_0x57778a,null))[_0xc663('0x41')](handleError(_0x57778a,null));};exports[_0xc663('0x54')]=function(_0x25677d,_0x3d83d4,_0x304bb3){var _0x2751c6=[{'name':_0xc663('0x55'),'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 _0xbcd7d2='';return db[_0xc663('0x2c')][_0xc663('0x4d')]({'where':{'id':_0x25677d[_0xc663('0x49')]['id']},'attributes':['id',_0xc663('0x56'),_0xc663('0x57'),_0xc663('0x58'),'password',_0xc663('0x59'),'consumerSecret',_0xc663('0x5a'),_0xc663('0x5b')]})[_0xc663('0x25')](handleEntityNotFound(_0x3d83d4,null))[_0xc663('0x25')](function(_0x4bcaae){if(_0x4bcaae){_0xbcd7d2=_0x4bcaae[_0xc663('0x56')];var _0x2824be=_0xbcd7d2[_0xc663('0x5c')](-0x1);if(_0x2824be==='/'){_0xbcd7d2=_0xbcd7d2[_0xc663('0x5d')](0x0,_0xbcd7d2[_0xc663('0x5e')](_0x2824be));}var _0x14df1f={'method':_0xc663('0x5f'),'uri':util[_0xc663('0x60')](_0xc663('0x61'),_0xbcd7d2),'headers':{'Content-Type':_0xc663('0x62'),'Accept':_0xc663('0x62')},'json':!![]};if(_0x4bcaae[_0xc663('0x57')]===_0xc663('0x63')){_0x14df1f[_0xc663('0x64')][_0xc663('0x65')]=util[_0xc663('0x60')]('Basic\x20%s',new Buffer(util['format'](_0xc663('0x66'),_0x4bcaae[_0xc663('0x58')],_0x4bcaae[_0xc663('0x67')]))[_0xc663('0x68')]('base64'));}return rp(_0x14df1f)[_0xc663('0x25')](function(_0x27042a){return _0x2751c6[_0xc663('0x69')](_[_0xc663('0x2b')](_0x27042a[_0xc663('0x6a')][_0xc663('0x6b')],function(_0x3a7107){return{'id':_0x3a7107[_0xc663('0x29')],'name':_0x3a7107[_0xc663('0x29')],'type':_0x3a7107[_0xc663('0x2e')],'active':_0x3a7107[_0xc663('0x6c')],'label':_0x3a7107[_0xc663('0x6d')],'custom':!![]};}));});}})['then'](function(_0x5a37e1){return{'count':_0x5a37e1[_0xc663('0x35')],'rows':_0x5a37e1};})[_0xc663('0x25')](respondWithResult(_0x3d83d4,null))['catch'](function(_0x53ab49){var _0x2e925b=_0x25677d['query'][_0xc663('0x6e')]?0x1f4:_0x53ab49[_0xc663('0x6f')]||0x1f4;logger[_0xc663('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0xc663('0x54'),_0x2e925b,JSON[_0xc663('0x70')](_0x53ab49));delete _0x53ab49[_0xc663('0x29')];if(_0x2e925b===0x191){_0x2e925b=0x190;}_0x3d83d4['status'](_0x2e925b)['send'](_0x25677d[_0xc663('0x31')][_0xc663('0x6e')]?{'message':'Wrong\x20credentials','statusCode':_0x53ab49[_0xc663('0x6f')]}:_0x53ab49);});}; \ No newline at end of file +var _0x6dcf=['slice','substring','lastIndexOf','GET','format','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','password','base64','concat','entries','test','error','stringify','send','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','limit','undefined','count','json','reject','save','update','then','sendStatus','name','index','DeskAccount','rawAttributes','type','model','map','keys','query','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','params','intersection','options','find','catch','body','destroy','getConfigurations','findOne','DeskConfiguration','hasOwnProperty','addConfiguration','AccountId','channel','Descriptions','create','DeskField','Subjects','getFields','priority','remoteUri','authType','username','consumerKey','consumerSecret','token','tokenSecret'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x6dcf,0x82));var _0xf6dc=function(_0xa7777d,_0x2045ce){_0xa7777d=_0xa7777d-0x0;var _0x53c35f=_0x6dcf[_0xa7777d];return _0x53c35f;};'use strict';var emlformat=require(_0xf6dc('0x0'));var rimraf=require(_0xf6dc('0x1'));var zipdir=require(_0xf6dc('0x2'));var jsonpatch=require(_0xf6dc('0x3'));var rp=require(_0xf6dc('0x4'));var moment=require(_0xf6dc('0x5'));var BPromise=require(_0xf6dc('0x6'));var Mustache=require(_0xf6dc('0x7'));var util=require(_0xf6dc('0x8'));var path=require(_0xf6dc('0x9'));var sox=require(_0xf6dc('0xa'));var csv=require(_0xf6dc('0xb'));var ejs=require(_0xf6dc('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf6dc('0xd'));var squel=require(_0xf6dc('0xe'));var crypto=require(_0xf6dc('0xf'));var jsforce=require(_0xf6dc('0x10'));var deskjs=require(_0xf6dc('0x11'));var toCsv=require('to-csv');var querystring=require(_0xf6dc('0x12'));var Papa=require(_0xf6dc('0x13'));var Redis=require(_0xf6dc('0x14'));var authService=require(_0xf6dc('0x15'));var qs=require(_0xf6dc('0x16'));var as=require(_0xf6dc('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf6dc('0x18'));var config=require(_0xf6dc('0x19'));var licenseUtil=require(_0xf6dc('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x43fd82,_0x317539){_0x317539=_0x317539||0xcc;return function(_0x312acf){if(_0x312acf){return _0x43fd82['sendStatus'](_0x317539);}return _0x43fd82[_0xf6dc('0x1b')](_0x317539)[_0xf6dc('0x1c')]();};}function respondWithResult(_0x5d7e9b,_0x15243c){_0x15243c=_0x15243c||0xc8;return function(_0x3a708a){if(_0x3a708a){return _0x5d7e9b[_0xf6dc('0x1b')](_0x15243c)['json'](_0x3a708a);}};}function respondWithFilteredResult(_0x1e44cd,_0x1766ba){return function(_0xe2127c){if(_0xe2127c){var _0x314cf2=typeof _0x1766ba[_0xf6dc('0x1d')]==='undefined'&&typeof _0x1766ba[_0xf6dc('0x1e')]===_0xf6dc('0x1f');var _0x4656ba=_0xe2127c[_0xf6dc('0x20')];var _0x2313ac=_0x314cf2?0x0:_0x1766ba[_0xf6dc('0x1d')];var _0x1079e7=_0x314cf2?_0xe2127c[_0xf6dc('0x20')]:_0x1766ba[_0xf6dc('0x1d')]+_0x1766ba['limit'];var _0x286c86;if(_0x1079e7>=_0x4656ba){_0x1079e7=_0x4656ba;_0x286c86=0xc8;}else{_0x286c86=0xce;}_0x1e44cd[_0xf6dc('0x1b')](_0x286c86);return _0x1e44cd['set']('Content-Range',_0x2313ac+'-'+_0x1079e7+'/'+_0x4656ba)[_0xf6dc('0x21')](_0xe2127c);}return null;};}function patchUpdates(_0x18ffe9){return function(_0x40d2e2){try{jsonpatch['apply'](_0x40d2e2,_0x18ffe9,!![]);}catch(_0x4efd67){return BPromise[_0xf6dc('0x22')](_0x4efd67);}return _0x40d2e2[_0xf6dc('0x23')]();};}function saveUpdates(_0x3d7787,_0x21e08a){return function(_0x16bbf8){if(_0x16bbf8){return _0x16bbf8[_0xf6dc('0x24')](_0x3d7787)[_0xf6dc('0x25')](function(_0x4c9a68){return _0x4c9a68;});}return null;};}function removeEntity(_0x4f0dad,_0x1b9238){return function(_0x59fbe9){if(_0x59fbe9){return _0x59fbe9['destroy']()[_0xf6dc('0x25')](function(){_0x4f0dad[_0xf6dc('0x1b')](0xcc)[_0xf6dc('0x1c')]();});}};}function handleEntityNotFound(_0x145158,_0x5940ce){return function(_0xde14a){if(!_0xde14a){_0x145158[_0xf6dc('0x26')](0x194);}return _0xde14a;};}function handleError(_0x488912,_0x4ade0d){_0x4ade0d=_0x4ade0d||0x1f4;return function(_0x5103ad){logger['error'](_0x5103ad['stack']);if(_0x5103ad[_0xf6dc('0x27')]){delete _0x5103ad[_0xf6dc('0x27')];}_0x488912[_0xf6dc('0x1b')](_0x4ade0d)['send'](_0x5103ad);};}exports[_0xf6dc('0x28')]=function(_0xdb2d3b,_0x5238c8){var _0x29ab24={},_0x2180b2={},_0x10e7e8={'count':0x0,'rows':[]};var _0x978df4=_['map'](db[_0xf6dc('0x29')][_0xf6dc('0x2a')],function(_0x490a0d){return{'name':_0x490a0d['fieldName'],'type':_0x490a0d[_0xf6dc('0x2b')]['key']};});_0x2180b2[_0xf6dc('0x2c')]=_[_0xf6dc('0x2d')](_0x978df4,_0xf6dc('0x27'));_0x2180b2['query']=_[_0xf6dc('0x2e')](_0xdb2d3b[_0xf6dc('0x2f')]);_0x2180b2[_0xf6dc('0x30')]=_['intersection'](_0x2180b2[_0xf6dc('0x2c')],_0x2180b2[_0xf6dc('0x2f')]);_0x29ab24[_0xf6dc('0x31')]=_['intersection'](_0x2180b2[_0xf6dc('0x2c')],qs[_0xf6dc('0x32')](_0xdb2d3b[_0xf6dc('0x2f')][_0xf6dc('0x32')]));_0x29ab24[_0xf6dc('0x31')]=_0x29ab24[_0xf6dc('0x31')][_0xf6dc('0x33')]?_0x29ab24['attributes']:_0x2180b2['model'];if(!_0xdb2d3b[_0xf6dc('0x2f')]['hasOwnProperty'](_0xf6dc('0x34'))){_0x29ab24[_0xf6dc('0x1e')]=qs['limit'](_0xdb2d3b[_0xf6dc('0x2f')][_0xf6dc('0x1e')]);_0x29ab24[_0xf6dc('0x1d')]=qs[_0xf6dc('0x1d')](_0xdb2d3b[_0xf6dc('0x2f')]['offset']);}_0x29ab24[_0xf6dc('0x35')]=qs[_0xf6dc('0x36')](_0xdb2d3b[_0xf6dc('0x2f')][_0xf6dc('0x36')]);_0x29ab24[_0xf6dc('0x37')]=qs[_0xf6dc('0x30')](_[_0xf6dc('0x38')](_0xdb2d3b[_0xf6dc('0x2f')],_0x2180b2[_0xf6dc('0x30')]),_0x978df4);if(_0xdb2d3b[_0xf6dc('0x2f')][_0xf6dc('0x39')]){_0x29ab24[_0xf6dc('0x37')]=_['merge'](_0x29ab24[_0xf6dc('0x37')],{'$or':_[_0xf6dc('0x2d')](_0x978df4,function(_0x3d6222){if(_0x3d6222['type']!=='VIRTUAL'){var _0x1a887a={};_0x1a887a[_0x3d6222[_0xf6dc('0x27')]]={'$like':'%'+_0xdb2d3b[_0xf6dc('0x2f')][_0xf6dc('0x39')]+'%'};return _0x1a887a;}})});}_0x29ab24=_[_0xf6dc('0x3a')]({},_0x29ab24,_0xdb2d3b['options']);var _0x28ad77={'where':_0x29ab24[_0xf6dc('0x37')]};return db['DeskAccount'][_0xf6dc('0x20')](_0x28ad77)['then'](function(_0x9f64ef){_0x10e7e8[_0xf6dc('0x20')]=_0x9f64ef;if(_0xdb2d3b['query'][_0xf6dc('0x3b')]){_0x29ab24[_0xf6dc('0x3c')]=[{'all':!![]}];}return db[_0xf6dc('0x29')][_0xf6dc('0x3d')](_0x29ab24);})[_0xf6dc('0x25')](function(_0x5ba013){_0x10e7e8[_0xf6dc('0x3e')]=_0x5ba013;return _0x10e7e8;})[_0xf6dc('0x25')](respondWithFilteredResult(_0x5238c8,_0x29ab24))['catch'](handleError(_0x5238c8,null));};exports['show']=function(_0xe68644,_0x579922){var _0x2e09d6={'raw':![],'where':{'id':_0xe68644[_0xf6dc('0x3f')]['id']}},_0x978269={};_0x978269[_0xf6dc('0x2c')]=_[_0xf6dc('0x2e')](db[_0xf6dc('0x29')][_0xf6dc('0x2a')]);_0x978269[_0xf6dc('0x2f')]=_[_0xf6dc('0x2e')](_0xe68644[_0xf6dc('0x2f')]);_0x978269[_0xf6dc('0x30')]=_['intersection'](_0x978269[_0xf6dc('0x2c')],_0x978269[_0xf6dc('0x2f')]);_0x2e09d6['attributes']=_[_0xf6dc('0x40')](_0x978269[_0xf6dc('0x2c')],qs['fields'](_0xe68644[_0xf6dc('0x2f')][_0xf6dc('0x32')]));_0x2e09d6[_0xf6dc('0x31')]=_0x2e09d6[_0xf6dc('0x31')][_0xf6dc('0x33')]?_0x2e09d6[_0xf6dc('0x31')]:_0x978269[_0xf6dc('0x2c')];if(_0xe68644['query']['includeAll']){_0x2e09d6[_0xf6dc('0x3c')]=[{'all':!![]}];}_0x2e09d6=_[_0xf6dc('0x3a')]({},_0x2e09d6,_0xe68644[_0xf6dc('0x41')]);return db[_0xf6dc('0x29')][_0xf6dc('0x42')](_0x2e09d6)['then'](handleEntityNotFound(_0x579922,null))[_0xf6dc('0x25')](respondWithResult(_0x579922,null))[_0xf6dc('0x43')](handleError(_0x579922,null));};exports['create']=function(_0x5c0e98,_0x4a3624){return db['DeskAccount']['create'](_0x5c0e98[_0xf6dc('0x44')],{})[_0xf6dc('0x25')](respondWithResult(_0x4a3624,0xc9))['catch'](handleError(_0x4a3624,null));};exports[_0xf6dc('0x24')]=function(_0x535851,_0x70d6ae){if(_0x535851['body']['id']){delete _0x535851['body']['id'];}return db['DeskAccount'][_0xf6dc('0x42')]({'where':{'id':_0x535851['params']['id']}})[_0xf6dc('0x25')](handleEntityNotFound(_0x70d6ae,null))[_0xf6dc('0x25')](saveUpdates(_0x535851[_0xf6dc('0x44')],null))[_0xf6dc('0x25')](respondWithResult(_0x70d6ae,null))['catch'](handleError(_0x70d6ae,null));};exports[_0xf6dc('0x45')]=function(_0x1883a8,_0x1747cd){return db[_0xf6dc('0x29')]['find']({'where':{'id':_0x1883a8['params']['id']}})[_0xf6dc('0x25')](handleEntityNotFound(_0x1747cd,null))[_0xf6dc('0x25')](removeEntity(_0x1747cd,null))[_0xf6dc('0x43')](handleError(_0x1747cd,null));};exports[_0xf6dc('0x46')]=function(_0x4a257d,_0x595b74,_0x1282fd){var _0x12a481={};var _0x5d4a31={};var _0x431132;var _0x244ff5;return db[_0xf6dc('0x29')][_0xf6dc('0x47')]({'where':{'id':_0x4a257d[_0xf6dc('0x3f')]['id']}})[_0xf6dc('0x25')](handleEntityNotFound(_0x595b74,null))['then'](function(_0x3c113e){if(_0x3c113e){_0x431132=_0x3c113e;_0x5d4a31['model']=_[_0xf6dc('0x2e')](db[_0xf6dc('0x48')]['rawAttributes']);_0x5d4a31[_0xf6dc('0x2f')]=_[_0xf6dc('0x2e')](_0x4a257d['query']);_0x5d4a31[_0xf6dc('0x30')]=_[_0xf6dc('0x40')](_0x5d4a31[_0xf6dc('0x2c')],_0x5d4a31[_0xf6dc('0x2f')]);_0x12a481[_0xf6dc('0x31')]=_[_0xf6dc('0x40')](_0x5d4a31[_0xf6dc('0x2c')],qs[_0xf6dc('0x32')](_0x4a257d['query'][_0xf6dc('0x32')]));_0x12a481[_0xf6dc('0x31')]=_0x12a481[_0xf6dc('0x31')][_0xf6dc('0x33')]?_0x12a481['attributes']:_0x5d4a31[_0xf6dc('0x2c')];_0x12a481[_0xf6dc('0x35')]=qs['sort'](_0x4a257d[_0xf6dc('0x2f')][_0xf6dc('0x36')]);_0x12a481['where']=qs['filters'](_['pick'](_0x4a257d['query'],_0x5d4a31[_0xf6dc('0x30')]));if(_0x4a257d[_0xf6dc('0x2f')][_0xf6dc('0x39')]){_0x12a481[_0xf6dc('0x37')]=_['merge'](_0x12a481[_0xf6dc('0x37')],{'$or':_['map'](_0x12a481[_0xf6dc('0x31')],function(_0x89c7c6){var _0x419d51={};_0x419d51[_0x89c7c6]={'$like':'%'+_0x4a257d[_0xf6dc('0x2f')]['filter']+'%'};return _0x419d51;})});}_0x12a481=_[_0xf6dc('0x3a')]({},_0x12a481,_0x4a257d[_0xf6dc('0x41')]);return _0x431132[_0xf6dc('0x46')](_0x12a481);}})['then'](function(_0x35ce8b){if(_0x35ce8b){_0x244ff5=_0x35ce8b[_0xf6dc('0x33')];if(!_0x4a257d[_0xf6dc('0x2f')][_0xf6dc('0x49')](_0xf6dc('0x34'))){_0x12a481[_0xf6dc('0x1e')]=qs[_0xf6dc('0x1e')](_0x4a257d[_0xf6dc('0x2f')][_0xf6dc('0x1e')]);_0x12a481['offset']=qs['offset'](_0x4a257d[_0xf6dc('0x2f')][_0xf6dc('0x1d')]);}return _0x431132[_0xf6dc('0x46')](_0x12a481);}})['then'](function(_0x25d3ac){if(_0x25d3ac){return _0x25d3ac?{'count':_0x244ff5,'rows':_0x25d3ac}:null;}})[_0xf6dc('0x25')](respondWithResult(_0x595b74,null))[_0xf6dc('0x43')](handleError(_0x595b74,null));};exports[_0xf6dc('0x4a')]=function(_0x4c7af8,_0x199156,_0x5135e7){if(_0x4c7af8['body']['id']){delete _0x4c7af8[_0xf6dc('0x44')]['id'];}return db[_0xf6dc('0x29')]['findOne']({'where':{'id':_0x4c7af8[_0xf6dc('0x3f')]['id']}})[_0xf6dc('0x25')](handleEntityNotFound(_0x199156,null))[_0xf6dc('0x25')](function(_0x452999){if(_0x452999){_0x4c7af8[_0xf6dc('0x44')][_0xf6dc('0x4b')]=_0x452999['id'];_0x4c7af8[_0xf6dc('0x44')]['Subjects']=integrations['getSubjects'](_0x4c7af8['body'][_0xf6dc('0x4c')],_0x4c7af8[_0xf6dc('0x44')][_0xf6dc('0x2b')]);_0x4c7af8[_0xf6dc('0x44')][_0xf6dc('0x4d')]=integrations['getDescriptions'](_0x4c7af8[_0xf6dc('0x44')][_0xf6dc('0x4c')],_0x4c7af8[_0xf6dc('0x44')][_0xf6dc('0x2b')]);return db[_0xf6dc('0x48')][_0xf6dc('0x4e')](_0x4c7af8[_0xf6dc('0x44')],{'include':[{'model':db[_0xf6dc('0x4f')],'as':_0xf6dc('0x50')},{'model':db[_0xf6dc('0x4f')],'as':_0xf6dc('0x4d')}]});}return null;})[_0xf6dc('0x25')](respondWithResult(_0x199156,null))[_0xf6dc('0x43')](handleError(_0x199156,null));};exports[_0xf6dc('0x51')]=function(_0x224b73,_0x128f7d,_0x251b41){var _0x534ab1=[{'name':'priority','label':_0xf6dc('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 _0x3f1228='';return db['DeskAccount'][_0xf6dc('0x47')]({'where':{'id':_0x224b73[_0xf6dc('0x3f')]['id']},'attributes':['id',_0xf6dc('0x53'),_0xf6dc('0x54'),_0xf6dc('0x55'),'password',_0xf6dc('0x56'),_0xf6dc('0x57'),_0xf6dc('0x58'),_0xf6dc('0x59')]})['then'](handleEntityNotFound(_0x128f7d,null))[_0xf6dc('0x25')](function(_0x4a466a){if(_0x4a466a){_0x3f1228=_0x4a466a[_0xf6dc('0x53')];var _0x297a2f=_0x3f1228[_0xf6dc('0x5a')](-0x1);if(_0x297a2f==='/'){_0x3f1228=_0x3f1228[_0xf6dc('0x5b')](0x0,_0x3f1228[_0xf6dc('0x5c')](_0x297a2f));}var _0x40cc5e={'method':_0xf6dc('0x5d'),'uri':util[_0xf6dc('0x5e')]('%s/custom_fields',_0x3f1228),'headers':{'Content-Type':'application/json','Accept':_0xf6dc('0x5f')},'json':!![]};if(_0x4a466a['authType']===_0xf6dc('0x60')){_0x40cc5e[_0xf6dc('0x61')][_0xf6dc('0x62')]=util[_0xf6dc('0x5e')](_0xf6dc('0x63'),new Buffer(util[_0xf6dc('0x5e')](_0xf6dc('0x64'),_0x4a466a[_0xf6dc('0x55')],_0x4a466a[_0xf6dc('0x65')]))['toString'](_0xf6dc('0x66')));}return rp(_0x40cc5e)[_0xf6dc('0x25')](function(_0x4a598e){return _0x534ab1[_0xf6dc('0x67')](_[_0xf6dc('0x2d')](_0x4a598e['_embedded'][_0xf6dc('0x68')],function(_0x383fa6){return{'id':_0x383fa6[_0xf6dc('0x27')],'name':_0x383fa6[_0xf6dc('0x27')],'type':_0x383fa6[_0xf6dc('0x2b')],'active':_0x383fa6['active'],'label':_0x383fa6['label'],'custom':!![]};}));});}})['then'](function(_0x46828a){return{'count':_0x46828a[_0xf6dc('0x33')],'rows':_0x46828a};})[_0xf6dc('0x25')](respondWithResult(_0x128f7d,null))[_0xf6dc('0x43')](function(_0x57926d){var _0x55a7ae=_0x224b73[_0xf6dc('0x2f')][_0xf6dc('0x69')]?0x1f4:_0x57926d['statusCode']||0x1f4;logger[_0xf6dc('0x6a')]('getFields,\x20%s,\x20%s,\x20%s',_0xf6dc('0x51'),_0x55a7ae,JSON[_0xf6dc('0x6b')](_0x57926d));delete _0x57926d[_0xf6dc('0x27')];if(_0x55a7ae===0x191){_0x55a7ae=0x190;}_0x128f7d[_0xf6dc('0x1b')](_0x55a7ae)[_0xf6dc('0x6c')](_0x224b73['query'][_0xf6dc('0x69')]?{'message':'Wrong\x20credentials','statusCode':_0x57926d[_0xf6dc('0x6d')]}:_0x57926d);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 5671ff4..6decdd9 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 _0x4baa=['request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','lodash','util','bluebird'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x4baa,0x11d));var _0xa4ba=function(_0x4580d4,_0xb4514f){_0x4580d4=_0x4580d4-0x0;var _0x48ce72=_0x4baa[_0x4580d4];return _0x48ce72;};'use strict';var _=require(_0xa4ba('0x0'));var util=require(_0xa4ba('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa4ba('0x2'));var rp=require(_0xa4ba('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa4ba('0x4'));var config=require(_0xa4ba('0x5'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0xa4ba('0x6'));module[_0xa4ba('0x7')]=function(_0x1c2979,_0xf76658){return _0x1c2979[_0xa4ba('0x8')]('DeskAccount',attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x915f=['util','../../config/logger','api','bluebird','request-promise','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','exports','int_desk_accounts'];(function(_0x5268d0,_0x4168da){var _0x1aa9d9=function(_0x28ff22){while(--_0x28ff22){_0x5268d0['push'](_0x5268d0['shift']());}};_0x1aa9d9(++_0x4168da);}(_0x915f,0xdc));var _0xf915=function(_0x2c89d9,_0x13320f){_0x2c89d9=_0x2c89d9-0x0;var _0x17e988=_0x915f[_0x2c89d9];return _0x17e988;};'use strict';var _=require('lodash');var util=require(_0xf915('0x0'));var logger=require(_0xf915('0x1'))(_0xf915('0x2'));var moment=require('moment');var BPromise=require(_0xf915('0x3'));var rp=require(_0xf915('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf915('0x5'));var config=require('../../config/environment');var attributes=require(_0xf915('0x6'));var integrations=require(_0xf915('0x7'));module[_0xf915('0x8')]=function(_0x134d73,_0x52855e){return _0x134d73['define']('DeskAccount',attributes,{'tableName':_0xf915('0x9'),'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 e96f0a9..b7e2082 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 _0x601c=['stringify','ShowDeskAccount','then','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','DeskAccount,\x20%s,\x20%s','message','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetDeskAccount'];(function(_0x5bb8e0,_0x3f4030){var _0x254f79=function(_0x198e95){while(--_0x198e95){_0x5bb8e0['push'](_0x5bb8e0['shift']());}};_0x254f79(++_0x3f4030);}(_0x601c,0x94));var _0xc601=function(_0x2a58e0,_0x12e0db){_0x2a58e0=_0x2a58e0-0x0;var _0x8d3424=_0x601c[_0x2a58e0];return _0x8d3424;};'use strict';var _=require(_0xc601('0x0'));var util=require(_0xc601('0x1'));var moment=require('moment');var BPromise=require(_0xc601('0x2'));var rs=require(_0xc601('0x3'));var fs=require('fs');var Redis=require(_0xc601('0x4'));var db=require(_0xc601('0x5'))['db'];var utils=require(_0xc601('0x6'));var logger=require(_0xc601('0x7'))('rpc');var config=require(_0xc601('0x8'));var jayson=require(_0xc601('0x9'));var client=jayson[_0xc601('0xa')][_0xc601('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d3e58,_0xd46df5,_0xc64dc9){return new BPromise(function(_0x49e44e,_0x4d1f92){return client[_0xc601('0xc')](_0x2d3e58,_0xc64dc9)['then'](function(_0x2ba1c5){logger[_0xc601('0xd')]('DeskAccount,\x20%s,\x20%s',_0xd46df5,_0xc601('0xe'));logger[_0xc601('0xf')](_0xc601('0x10'),_0xd46df5,_0xc601('0xe'),JSON['stringify'](_0x2ba1c5));if(_0x2ba1c5[_0xc601('0x11')]){if(_0x2ba1c5[_0xc601('0x11')][_0xc601('0x12')]===0x1f4){logger['error'](_0xc601('0x13'),_0xd46df5,_0x2ba1c5[_0xc601('0x11')][_0xc601('0x14')]);return _0x4d1f92(_0x2ba1c5[_0xc601('0x11')][_0xc601('0x14')]);}logger['error'](_0xc601('0x13'),_0xd46df5,_0x2ba1c5[_0xc601('0x11')][_0xc601('0x14')]);return _0x49e44e(_0x2ba1c5['error'][_0xc601('0x14')]);}else{logger['info'](_0xc601('0x13'),_0xd46df5,_0xc601('0xe'));_0x49e44e(_0x2ba1c5['result'][_0xc601('0x14')]);}})['catch'](function(_0x9d94e5){logger[_0xc601('0x11')](_0xc601('0x13'),_0xd46df5,_0x9d94e5);_0x4d1f92(_0x9d94e5);});});}exports['GetDeskAccount']=function(_0x14eb52){var _0x309074=this;return new Promise(function(_0x4ecec2,_0x1f23e4){return db[_0xc601('0x15')][_0xc601('0x16')]({'raw':_0x14eb52[_0xc601('0x17')]?_0x14eb52[_0xc601('0x17')][_0xc601('0x18')]===undefined?!![]:![]:!![],'where':_0x14eb52[_0xc601('0x17')]?_0x14eb52[_0xc601('0x17')][_0xc601('0x19')]||null:null,'attributes':_0x14eb52[_0xc601('0x17')]?_0x14eb52[_0xc601('0x17')][_0xc601('0x1a')]||null:null,'limit':_0x14eb52[_0xc601('0x17')]?_0x14eb52['options'][_0xc601('0x1b')]||null:null,'include':_0x14eb52[_0xc601('0x17')]?_0x14eb52[_0xc601('0x17')][_0xc601('0x1c')]?_[_0xc601('0x1d')](_0x14eb52[_0xc601('0x17')]['include'],function(_0x1a7857){return{'model':db[_0x1a7857[_0xc601('0x1e')]],'as':_0x1a7857['as'],'attributes':_0x1a7857['attributes'],'include':_0x1a7857[_0xc601('0x1c')]?_['map'](_0x1a7857[_0xc601('0x1c')],function(_0x328dfe){return{'model':db[_0x328dfe[_0xc601('0x1e')]],'as':_0x328dfe['as'],'attributes':_0x328dfe[_0xc601('0x1a')],'include':_0x328dfe['include']?_['map'](_0x328dfe['include'],function(_0x3b10d4){return{'model':db[_0x3b10d4[_0xc601('0x1e')]],'as':_0x3b10d4['as'],'attributes':_0x3b10d4[_0xc601('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d4a3f){logger[_0xc601('0xd')]('GetDeskAccount',_0x14eb52);logger['debug'](_0xc601('0x1f'),_0x14eb52,JSON[_0xc601('0x20')](_0x1d4a3f));_0x4ecec2(_0x1d4a3f);})['catch'](function(_0x125038){logger['error'](_0xc601('0x1f'),_0x125038['message'],_0x14eb52);_0x1f23e4(_0x309074['error'](0x1f4,_0x125038[_0xc601('0x14')]));});});};exports[_0xc601('0x21')]=function(_0x5a74ec){var _0x104d45=this;return new Promise(function(_0x382bb1,_0x5c9876){return db[_0xc601('0x15')]['find']({'raw':_0x5a74ec[_0xc601('0x17')]?_0x5a74ec['options'][_0xc601('0x18')]===undefined?!![]:![]:!![],'where':_0x5a74ec[_0xc601('0x17')]?_0x5a74ec['options']['where']||null:null,'attributes':_0x5a74ec[_0xc601('0x17')]?_0x5a74ec[_0xc601('0x17')]['attributes']||null:null,'include':_0x5a74ec['options']?_0x5a74ec['options'][_0xc601('0x1c')]?_[_0xc601('0x1d')](_0x5a74ec[_0xc601('0x17')][_0xc601('0x1c')],function(_0x55918f){return{'model':db[_0x55918f['model']],'as':_0x55918f['as'],'attributes':_0x55918f[_0xc601('0x1a')],'include':_0x55918f['include']?_['map'](_0x55918f['include'],function(_0x4132d5){return{'model':db[_0x4132d5[_0xc601('0x1e')]],'as':_0x4132d5['as'],'attributes':_0x4132d5['attributes'],'include':_0x4132d5[_0xc601('0x1c')]?_[_0xc601('0x1d')](_0x4132d5[_0xc601('0x1c')],function(_0xc4e2b4){return{'model':db[_0xc4e2b4[_0xc601('0x1e')]],'as':_0xc4e2b4['as'],'attributes':_0xc4e2b4[_0xc601('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc601('0x22')](function(_0x3fbc95){logger['info']('ShowDeskAccount',_0x5a74ec);logger[_0xc601('0xf')](_0xc601('0x21'),_0x5a74ec,JSON[_0xc601('0x20')](_0x3fbc95));_0x382bb1(_0x3fbc95);})[_0xc601('0x23')](function(_0x11a58f){logger[_0xc601('0x11')](_0xc601('0x21'),_0x11a58f['message'],_0x5a74ec);_0x5c9876(_0x104d45[_0xc601('0x11')](0x1f4,_0x11a58f[_0xc601('0x14')]));});});}; \ No newline at end of file +var _0xb44a=['catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowDeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','DeskAccount,\x20%s,\x20%s','message','info','result'];(function(_0x1daf0f,_0x4cb452){var _0x3b013b=function(_0x7c61a1){while(--_0x7c61a1){_0x1daf0f['push'](_0x1daf0f['shift']());}};_0x3b013b(++_0x4cb452);}(_0xb44a,0x1e2));var _0xab44=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xb44a[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0xab44('0x0'));var util=require(_0xab44('0x1'));var moment=require(_0xab44('0x2'));var BPromise=require(_0xab44('0x3'));var rs=require(_0xab44('0x4'));var fs=require('fs');var Redis=require(_0xab44('0x5'));var db=require(_0xab44('0x6'))['db'];var utils=require(_0xab44('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xab44('0x8'));var jayson=require(_0xab44('0x9'));var client=jayson[_0xab44('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x279051,_0x314879,_0x2f225d){return new BPromise(function(_0x335185,_0x4f0110){return client[_0xab44('0xb')](_0x279051,_0x2f225d)[_0xab44('0xc')](function(_0x26c8da){logger['info']('DeskAccount,\x20%s,\x20%s',_0x314879,_0xab44('0xd'));logger[_0xab44('0xe')](_0xab44('0xf'),_0x314879,_0xab44('0xd'),JSON[_0xab44('0x10')](_0x26c8da));if(_0x26c8da[_0xab44('0x11')]){if(_0x26c8da[_0xab44('0x11')]['code']===0x1f4){logger[_0xab44('0x11')](_0xab44('0x12'),_0x314879,_0x26c8da[_0xab44('0x11')][_0xab44('0x13')]);return _0x4f0110(_0x26c8da[_0xab44('0x11')][_0xab44('0x13')]);}logger[_0xab44('0x11')](_0xab44('0x12'),_0x314879,_0x26c8da[_0xab44('0x11')][_0xab44('0x13')]);return _0x335185(_0x26c8da[_0xab44('0x11')][_0xab44('0x13')]);}else{logger[_0xab44('0x14')](_0xab44('0x12'),_0x314879,_0xab44('0xd'));_0x335185(_0x26c8da[_0xab44('0x15')][_0xab44('0x13')]);}})[_0xab44('0x16')](function(_0x358f37){logger[_0xab44('0x11')](_0xab44('0x12'),_0x314879,_0x358f37);_0x4f0110(_0x358f37);});});}exports[_0xab44('0x17')]=function(_0x384352){var _0x57b757=this;return new Promise(function(_0x20fa08,_0x2a3b4b){return db[_0xab44('0x18')][_0xab44('0x19')]({'raw':_0x384352['options']?_0x384352[_0xab44('0x1a')][_0xab44('0x1b')]===undefined?!![]:![]:!![],'where':_0x384352[_0xab44('0x1a')]?_0x384352[_0xab44('0x1a')][_0xab44('0x1c')]||null:null,'attributes':_0x384352[_0xab44('0x1a')]?_0x384352[_0xab44('0x1a')][_0xab44('0x1d')]||null:null,'limit':_0x384352[_0xab44('0x1a')]?_0x384352[_0xab44('0x1a')][_0xab44('0x1e')]||null:null,'include':_0x384352[_0xab44('0x1a')]?_0x384352['options'][_0xab44('0x1f')]?_[_0xab44('0x20')](_0x384352['options']['include'],function(_0x423f5b){return{'model':db[_0x423f5b[_0xab44('0x21')]],'as':_0x423f5b['as'],'attributes':_0x423f5b[_0xab44('0x1d')],'include':_0x423f5b[_0xab44('0x1f')]?_[_0xab44('0x20')](_0x423f5b[_0xab44('0x1f')],function(_0x2e80f5){return{'model':db[_0x2e80f5[_0xab44('0x21')]],'as':_0x2e80f5['as'],'attributes':_0x2e80f5['attributes'],'include':_0x2e80f5['include']?_[_0xab44('0x20')](_0x2e80f5[_0xab44('0x1f')],function(_0x1fdb95){return{'model':db[_0x1fdb95[_0xab44('0x21')]],'as':_0x1fdb95['as'],'attributes':_0x1fdb95[_0xab44('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xab44('0xc')](function(_0x50eeca){logger[_0xab44('0x14')](_0xab44('0x17'),_0x384352);logger[_0xab44('0xe')](_0xab44('0x17'),_0x384352,JSON[_0xab44('0x10')](_0x50eeca));_0x20fa08(_0x50eeca);})[_0xab44('0x16')](function(_0x1380a0){logger[_0xab44('0x11')](_0xab44('0x17'),_0x1380a0[_0xab44('0x13')],_0x384352);_0x2a3b4b(_0x57b757[_0xab44('0x11')](0x1f4,_0x1380a0[_0xab44('0x13')]));});});};exports[_0xab44('0x22')]=function(_0x4a4890){var _0xd49bc4=this;return new Promise(function(_0x1229c5,_0x3e965f){return db[_0xab44('0x18')][_0xab44('0x23')]({'raw':_0x4a4890[_0xab44('0x1a')]?_0x4a4890[_0xab44('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4a4890[_0xab44('0x1a')]?_0x4a4890[_0xab44('0x1a')][_0xab44('0x1c')]||null:null,'attributes':_0x4a4890[_0xab44('0x1a')]?_0x4a4890[_0xab44('0x1a')][_0xab44('0x1d')]||null:null,'include':_0x4a4890['options']?_0x4a4890[_0xab44('0x1a')][_0xab44('0x1f')]?_[_0xab44('0x20')](_0x4a4890[_0xab44('0x1a')]['include'],function(_0x1840b5){return{'model':db[_0x1840b5['model']],'as':_0x1840b5['as'],'attributes':_0x1840b5[_0xab44('0x1d')],'include':_0x1840b5[_0xab44('0x1f')]?_[_0xab44('0x20')](_0x1840b5[_0xab44('0x1f')],function(_0x24dac1){return{'model':db[_0x24dac1['model']],'as':_0x24dac1['as'],'attributes':_0x24dac1[_0xab44('0x1d')],'include':_0x24dac1[_0xab44('0x1f')]?_['map'](_0x24dac1[_0xab44('0x1f')],function(_0x23be12){return{'model':db[_0x23be12['model']],'as':_0x23be12['as'],'attributes':_0x23be12[_0xab44('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xab44('0xc')](function(_0x45e1f8){logger[_0xab44('0x14')](_0xab44('0x22'),_0x4a4890);logger[_0xab44('0xe')](_0xab44('0x22'),_0x4a4890,JSON[_0xab44('0x10')](_0x45e1f8));_0x1229c5(_0x45e1f8);})[_0xab44('0x16')](function(_0x43ace0){logger['error'](_0xab44('0x22'),_0x43ace0[_0xab44('0x13')],_0x4a4890);_0x3e965f(_0xd49bc4['error'](0x1f4,_0x43ace0['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 4499107..6a894bd 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 _0x34e8=['../../config/environment','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x42c154,_0x405ce9){var _0x543d14=function(_0x208054){while(--_0x208054){_0x42c154['push'](_0x42c154['shift']());}};_0x543d14(++_0x405ce9);}(_0x34e8,0x12c));var _0x834e=function(_0x47c938,_0x24330e){_0x47c938=_0x47c938-0x0;var _0x3fd333=_0x34e8[_0x47c938];return _0x3fd333;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0xa')](_0x834e('0x11'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0xa')](_0x834e('0x13'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);router[_0x834e('0xa')](_0x834e('0x15'),auth['isAuthenticated'](),controller[_0x834e('0x16')]);router[_0x834e('0x17')]('/',auth['isAuthenticated'](),controller[_0x834e('0x18')]);router[_0x834e('0x17')](_0x834e('0x15'),auth[_0x834e('0xd')](),controller['setTags']);router[_0x834e('0x19')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x1a')]);router['delete'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller['destroy']);module[_0x834e('0x1b')]=router; \ No newline at end of file +var _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x193454,_0x3ada46){var _0x444eb5=function(_0x26a701){while(--_0x26a701){_0x193454['push'](_0x193454['shift']());}};_0x444eb5(++_0x3ada46);}(_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/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index d86bdba..7b80f84 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 _0xd3ba=['STRING','exports'];(function(_0x441fab,_0x2a5ac4){var _0x53297f=function(_0x483a9a){while(--_0x483a9a){_0x441fab['push'](_0x441fab['shift']());}};_0x53297f(++_0x2a5ac4);}(_0xd3ba,0x1cf));var _0xad3b=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0xd3ba[_0x4d8ed9];return _0x1e2140;};'use strict';var Sequelize=require('sequelize');module[_0xad3b('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xad3b('0x1')]}}; \ No newline at end of file +var _0x8f19=['sequelize','exports','STRING'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8f19,0x1ce));var _0x98f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8f19[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x98f1('0x0'));module[_0x98f1('0x1')]={'name':{'type':Sequelize[_0x98f1('0x2')]},'description':{'type':Sequelize[_0x98f1('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 3234aac..d6b275a 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 _0x14b6=['getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','update','then','error','name','send','index','map','DeskConfiguration','rawAttributes','type','key','model','query','filters','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','intersection','length','include','find','create','body','destroy','params'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x14b6,0x148));var _0x614b=function(_0x24f395,_0x2414b4){_0x24f395=_0x24f395-0x0;var _0x386ac7=_0x14b6[_0x24f395];return _0x386ac7;};'use strict';var emlformat=require(_0x614b('0x0'));var rimraf=require(_0x614b('0x1'));var zipdir=require(_0x614b('0x2'));var jsonpatch=require(_0x614b('0x3'));var rp=require(_0x614b('0x4'));var moment=require(_0x614b('0x5'));var BPromise=require(_0x614b('0x6'));var Mustache=require('mustache');var util=require(_0x614b('0x7'));var path=require(_0x614b('0x8'));var sox=require(_0x614b('0x9'));var csv=require(_0x614b('0xa'));var ejs=require(_0x614b('0xb'));var fs=require('fs');var fs_extra=require(_0x614b('0xc'));var _=require(_0x614b('0xd'));var squel=require('squel');var crypto=require(_0x614b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x614b('0xf'));var toCsv=require(_0x614b('0xa'));var querystring=require(_0x614b('0x10'));var Papa=require('papaparse');var Redis=require(_0x614b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x614b('0x12'));var as=require(_0x614b('0x13'));var hardwareService=require(_0x614b('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x614b('0x15'));var config=require(_0x614b('0x16'));var licenseUtil=require(_0x614b('0x17'));var db=require(_0x614b('0x18'))['db'];function respondWithStatusCode(_0xb7aa92,_0x45329e){_0x45329e=_0x45329e||0xcc;return function(_0x4ac1f2){if(_0x4ac1f2){return _0xb7aa92['sendStatus'](_0x45329e);}return _0xb7aa92[_0x614b('0x19')](_0x45329e)[_0x614b('0x1a')]();};}function respondWithResult(_0x45b287,_0x395f92){_0x395f92=_0x395f92||0xc8;return function(_0x1b441e){if(_0x1b441e){return _0x45b287['status'](_0x395f92)[_0x614b('0x1b')](_0x1b441e);}};}function respondWithFilteredResult(_0x2ef620,_0x288159){return function(_0x2a1d7e){if(_0x2a1d7e){var _0x5385c4=typeof _0x288159[_0x614b('0x1c')]===_0x614b('0x1d')&&typeof _0x288159['limit']==='undefined';var _0x1cb6ad=_0x2a1d7e[_0x614b('0x1e')];var _0x164d5e=_0x5385c4?0x0:_0x288159[_0x614b('0x1c')];var _0x26e7ee=_0x5385c4?_0x2a1d7e[_0x614b('0x1e')]:_0x288159['offset']+_0x288159['limit'];var _0x302965;if(_0x26e7ee>=_0x1cb6ad){_0x26e7ee=_0x1cb6ad;_0x302965=0xc8;}else{_0x302965=0xce;}_0x2ef620[_0x614b('0x19')](_0x302965);return _0x2ef620['set']('Content-Range',_0x164d5e+'-'+_0x26e7ee+'/'+_0x1cb6ad)['json'](_0x2a1d7e);}return null;};}function patchUpdates(_0x1f6678){return function(_0x2ce403){try{jsonpatch['apply'](_0x2ce403,_0x1f6678,!![]);}catch(_0x36a866){return BPromise['reject'](_0x36a866);}return _0x2ce403['save']();};}function saveUpdates(_0x37237c,_0x5e60c2){return function(_0x4097de){if(_0x4097de){return _0x4097de[_0x614b('0x1f')](_0x37237c)[_0x614b('0x20')](function(_0x702ebf){return _0x702ebf;});}return null;};}function removeEntity(_0x14a97b,_0x35e86c){return function(_0x24cb81){if(_0x24cb81){return _0x24cb81['destroy']()['then'](function(){_0x14a97b['status'](0xcc)[_0x614b('0x1a')]();});}};}function handleEntityNotFound(_0x5292ed,_0x395e04){return function(_0x296e9e){if(!_0x296e9e){_0x5292ed['sendStatus'](0x194);}return _0x296e9e;};}function handleError(_0x5264e,_0x232213){_0x232213=_0x232213||0x1f4;return function(_0x39889a){logger[_0x614b('0x21')](_0x39889a['stack']);if(_0x39889a[_0x614b('0x22')]){delete _0x39889a[_0x614b('0x22')];}_0x5264e[_0x614b('0x19')](_0x232213)[_0x614b('0x23')](_0x39889a);};}exports[_0x614b('0x24')]=function(_0x2fc9d7,_0x45cf60){var _0x426fb2={},_0x30745f={},_0x51347d={'count':0x0,'rows':[]};var _0x3f2fe8=_[_0x614b('0x25')](db[_0x614b('0x26')][_0x614b('0x27')],function(_0x20ae1e){return{'name':_0x20ae1e['fieldName'],'type':_0x20ae1e[_0x614b('0x28')][_0x614b('0x29')]};});_0x30745f[_0x614b('0x2a')]=_[_0x614b('0x25')](_0x3f2fe8,_0x614b('0x22'));_0x30745f[_0x614b('0x2b')]=_['keys'](_0x2fc9d7['query']);_0x30745f[_0x614b('0x2c')]=_['intersection'](_0x30745f[_0x614b('0x2a')],_0x30745f['query']);_0x426fb2[_0x614b('0x2d')]=_['intersection'](_0x30745f[_0x614b('0x2a')],qs[_0x614b('0x2e')](_0x2fc9d7['query'][_0x614b('0x2e')]));_0x426fb2['attributes']=_0x426fb2[_0x614b('0x2d')]['length']?_0x426fb2[_0x614b('0x2d')]:_0x30745f[_0x614b('0x2a')];if(!_0x2fc9d7[_0x614b('0x2b')][_0x614b('0x2f')](_0x614b('0x30'))){_0x426fb2['limit']=qs[_0x614b('0x31')](_0x2fc9d7[_0x614b('0x2b')]['limit']);_0x426fb2[_0x614b('0x1c')]=qs[_0x614b('0x1c')](_0x2fc9d7[_0x614b('0x2b')]['offset']);}_0x426fb2[_0x614b('0x32')]=qs[_0x614b('0x33')](_0x2fc9d7[_0x614b('0x2b')][_0x614b('0x33')]);_0x426fb2[_0x614b('0x34')]=qs[_0x614b('0x2c')](_[_0x614b('0x35')](_0x2fc9d7[_0x614b('0x2b')],_0x30745f[_0x614b('0x2c')]),_0x3f2fe8);if(_0x2fc9d7[_0x614b('0x2b')][_0x614b('0x36')]){_0x426fb2[_0x614b('0x34')]=_[_0x614b('0x37')](_0x426fb2[_0x614b('0x34')],{'$or':_[_0x614b('0x25')](_0x3f2fe8,function(_0x53a437){if(_0x53a437[_0x614b('0x28')]!==_0x614b('0x38')){var _0x5b3712={};_0x5b3712[_0x53a437[_0x614b('0x22')]]={'$like':'%'+_0x2fc9d7[_0x614b('0x2b')][_0x614b('0x36')]+'%'};return _0x5b3712;}})});}_0x426fb2=_[_0x614b('0x37')]({},_0x426fb2,_0x2fc9d7[_0x614b('0x39')]);var _0x555bf0={'where':_0x426fb2['where']};return db[_0x614b('0x26')][_0x614b('0x1e')](_0x555bf0)[_0x614b('0x20')](function(_0x53793e){_0x51347d['count']=_0x53793e;if(_0x2fc9d7[_0x614b('0x2b')][_0x614b('0x3a')]){_0x426fb2['include']=[{'all':!![]}];}return db[_0x614b('0x26')][_0x614b('0x3b')](_0x426fb2);})[_0x614b('0x20')](function(_0x4c2020){_0x51347d[_0x614b('0x3c')]=_0x4c2020;return _0x51347d;})[_0x614b('0x20')](respondWithFilteredResult(_0x45cf60,_0x426fb2))[_0x614b('0x3d')](handleError(_0x45cf60,null));};exports[_0x614b('0x3e')]=function(_0xdc0a89,_0x360f8d){var _0x5ad129={'raw':![],'where':{'id':_0xdc0a89['params']['id']}},_0x537819={};_0x537819[_0x614b('0x2a')]=_['keys'](db[_0x614b('0x26')][_0x614b('0x27')]);_0x537819['query']=_[_0x614b('0x3f')](_0xdc0a89[_0x614b('0x2b')]);_0x537819[_0x614b('0x2c')]=_[_0x614b('0x40')](_0x537819['model'],_0x537819[_0x614b('0x2b')]);_0x5ad129['attributes']=_[_0x614b('0x40')](_0x537819[_0x614b('0x2a')],qs[_0x614b('0x2e')](_0xdc0a89[_0x614b('0x2b')]['fields']));_0x5ad129[_0x614b('0x2d')]=_0x5ad129[_0x614b('0x2d')][_0x614b('0x41')]?_0x5ad129[_0x614b('0x2d')]:_0x537819[_0x614b('0x2a')];if(_0xdc0a89['query']['includeAll']){_0x5ad129[_0x614b('0x42')]=[{'all':!![]}];}_0x5ad129=_[_0x614b('0x37')]({},_0x5ad129,_0xdc0a89['options']);return db[_0x614b('0x26')][_0x614b('0x43')](_0x5ad129)[_0x614b('0x20')](handleEntityNotFound(_0x360f8d,null))['then'](respondWithResult(_0x360f8d,null))[_0x614b('0x3d')](handleError(_0x360f8d,null));};exports[_0x614b('0x44')]=function(_0x2bbaa7,_0x5bcfa1){return db[_0x614b('0x26')][_0x614b('0x44')](_0x2bbaa7[_0x614b('0x45')],{})['then'](respondWithResult(_0x5bcfa1,0xc9))[_0x614b('0x3d')](handleError(_0x5bcfa1,null));};exports[_0x614b('0x1f')]=function(_0x592047,_0x3d336b){if(_0x592047['body']['id']){delete _0x592047['body']['id'];}return db[_0x614b('0x26')]['find']({'where':{'id':_0x592047['params']['id']}})[_0x614b('0x20')](handleEntityNotFound(_0x3d336b,null))[_0x614b('0x20')](saveUpdates(_0x592047[_0x614b('0x45')],null))[_0x614b('0x20')](respondWithResult(_0x3d336b,null))['catch'](handleError(_0x3d336b,null));};exports[_0x614b('0x46')]=function(_0x797fe5,_0x454773){return db[_0x614b('0x26')][_0x614b('0x43')]({'where':{'id':_0x797fe5[_0x614b('0x47')]['id']}})[_0x614b('0x20')](handleEntityNotFound(_0x454773,null))[_0x614b('0x20')](removeEntity(_0x454773,null))[_0x614b('0x3d')](handleError(_0x454773,null));};exports[_0x614b('0x48')]=function(_0x5256a9,_0x447305,_0x2b2224){var _0x2df0bd={};var _0x387a28={};var _0x146a1c;var _0x48a816;return db[_0x614b('0x26')][_0x614b('0x49')]({'where':{'id':_0x5256a9[_0x614b('0x47')]['id']}})[_0x614b('0x20')](handleEntityNotFound(_0x447305,null))['then'](function(_0xeb4599){if(_0xeb4599){_0x146a1c=_0xeb4599;_0x387a28[_0x614b('0x2a')]=_[_0x614b('0x3f')](db[_0x614b('0x4a')][_0x614b('0x27')]);_0x387a28['query']=_[_0x614b('0x3f')](_0x5256a9[_0x614b('0x2b')]);_0x387a28[_0x614b('0x2c')]=_[_0x614b('0x40')](_0x387a28[_0x614b('0x2a')],_0x387a28[_0x614b('0x2b')]);_0x2df0bd['attributes']=_['intersection'](_0x387a28['model'],qs[_0x614b('0x2e')](_0x5256a9[_0x614b('0x2b')][_0x614b('0x2e')]));_0x2df0bd['attributes']=_0x2df0bd[_0x614b('0x2d')][_0x614b('0x41')]?_0x2df0bd[_0x614b('0x2d')]:_0x387a28[_0x614b('0x2a')];_0x2df0bd[_0x614b('0x32')]=qs['sort'](_0x5256a9[_0x614b('0x2b')][_0x614b('0x33')]);_0x2df0bd['where']=qs[_0x614b('0x2c')](_[_0x614b('0x35')](_0x5256a9[_0x614b('0x2b')],_0x387a28[_0x614b('0x2c')]));if(_0x5256a9['query'][_0x614b('0x36')]){_0x2df0bd[_0x614b('0x34')]=_[_0x614b('0x37')](_0x2df0bd[_0x614b('0x34')],{'$or':_[_0x614b('0x25')](_0x2df0bd[_0x614b('0x2d')],function(_0x491410){var _0x59979c={};_0x59979c[_0x491410]={'$like':'%'+_0x5256a9['query'][_0x614b('0x36')]+'%'};return _0x59979c;})});}_0x2df0bd=_[_0x614b('0x37')]({},_0x2df0bd,_0x5256a9[_0x614b('0x39')]);return _0x146a1c[_0x614b('0x48')](_0x2df0bd);}})['then'](function(_0x108d54){if(_0x108d54){_0x48a816=_0x108d54[_0x614b('0x41')];if(!_0x5256a9['query'][_0x614b('0x2f')](_0x614b('0x30'))){_0x2df0bd[_0x614b('0x31')]=qs['limit'](_0x5256a9[_0x614b('0x2b')][_0x614b('0x31')]);_0x2df0bd[_0x614b('0x1c')]=qs[_0x614b('0x1c')](_0x5256a9[_0x614b('0x2b')][_0x614b('0x1c')]);}return _0x146a1c[_0x614b('0x48')](_0x2df0bd);}})[_0x614b('0x20')](function(_0x2d3480){if(_0x2d3480){return _0x2d3480?{'count':_0x48a816,'rows':_0x2d3480}:null;}})[_0x614b('0x20')](respondWithResult(_0x447305,null))[_0x614b('0x3d')](handleError(_0x447305,null));};exports[_0x614b('0x4b')]=function(_0x50047f,_0x214b8b,_0x524318){var _0xf5c662={};var _0x13ad4e={};var _0x3e562f;var _0x1cfaf1;return db[_0x614b('0x26')][_0x614b('0x49')]({'where':{'id':_0x50047f[_0x614b('0x47')]['id']}})['then'](handleEntityNotFound(_0x214b8b,null))[_0x614b('0x20')](function(_0x1417fb){if(_0x1417fb){_0x3e562f=_0x1417fb;_0x13ad4e[_0x614b('0x2a')]=_[_0x614b('0x3f')](db['DeskField'][_0x614b('0x27')]);_0x13ad4e[_0x614b('0x2b')]=_['keys'](_0x50047f[_0x614b('0x2b')]);_0x13ad4e[_0x614b('0x2c')]=_[_0x614b('0x40')](_0x13ad4e[_0x614b('0x2a')],_0x13ad4e[_0x614b('0x2b')]);_0xf5c662[_0x614b('0x2d')]=_[_0x614b('0x40')](_0x13ad4e[_0x614b('0x2a')],qs[_0x614b('0x2e')](_0x50047f[_0x614b('0x2b')][_0x614b('0x2e')]));_0xf5c662[_0x614b('0x2d')]=_0xf5c662[_0x614b('0x2d')][_0x614b('0x41')]?_0xf5c662[_0x614b('0x2d')]:_0x13ad4e[_0x614b('0x2a')];_0xf5c662[_0x614b('0x32')]=qs[_0x614b('0x33')](_0x50047f[_0x614b('0x2b')][_0x614b('0x33')]);_0xf5c662[_0x614b('0x34')]=qs[_0x614b('0x2c')](_['pick'](_0x50047f[_0x614b('0x2b')],_0x13ad4e[_0x614b('0x2c')]));if(_0x50047f[_0x614b('0x2b')][_0x614b('0x36')]){_0xf5c662['where']=_['merge'](_0xf5c662[_0x614b('0x34')],{'$or':_[_0x614b('0x25')](_0xf5c662[_0x614b('0x2d')],function(_0x458e08){var _0x135b4f={};_0x135b4f[_0x458e08]={'$like':'%'+_0x50047f[_0x614b('0x2b')]['filter']+'%'};return _0x135b4f;})});}_0xf5c662=_[_0x614b('0x37')]({},_0xf5c662,_0x50047f[_0x614b('0x39')]);return _0x3e562f[_0x614b('0x4b')](_0xf5c662);}})[_0x614b('0x20')](function(_0x4f1d45){if(_0x4f1d45){_0x1cfaf1=_0x4f1d45[_0x614b('0x41')];if(!_0x50047f[_0x614b('0x2b')][_0x614b('0x2f')](_0x614b('0x30'))){_0xf5c662['limit']=qs['limit'](_0x50047f[_0x614b('0x2b')][_0x614b('0x31')]);_0xf5c662[_0x614b('0x1c')]=qs['offset'](_0x50047f[_0x614b('0x2b')]['offset']);}return _0x3e562f[_0x614b('0x4b')](_0xf5c662);}})[_0x614b('0x20')](function(_0x11dda8){if(_0x11dda8){return _0x11dda8?{'count':_0x1cfaf1,'rows':_0x11dda8}:null;}})[_0x614b('0x20')](respondWithResult(_0x214b8b,null))[_0x614b('0x3d')](handleError(_0x214b8b,null));};exports[_0x614b('0x4c')]=function(_0x22f144,_0x3dcad5,_0xe49719){var _0x848d10={};var _0x407734={};var _0x4bf91b;var _0x2dbd36;return db[_0x614b('0x26')][_0x614b('0x49')]({'where':{'id':_0x22f144[_0x614b('0x47')]['id']}})['then'](handleEntityNotFound(_0x3dcad5,null))[_0x614b('0x20')](function(_0xd8f4e3){if(_0xd8f4e3){_0x4bf91b=_0xd8f4e3;_0x407734[_0x614b('0x2a')]=_['keys'](db[_0x614b('0x4a')][_0x614b('0x27')]);_0x407734['query']=_[_0x614b('0x3f')](_0x22f144[_0x614b('0x2b')]);_0x407734['filters']=_['intersection'](_0x407734[_0x614b('0x2a')],_0x407734[_0x614b('0x2b')]);_0x848d10[_0x614b('0x2d')]=_[_0x614b('0x40')](_0x407734[_0x614b('0x2a')],qs[_0x614b('0x2e')](_0x22f144[_0x614b('0x2b')]['fields']));_0x848d10['attributes']=_0x848d10[_0x614b('0x2d')][_0x614b('0x41')]?_0x848d10[_0x614b('0x2d')]:_0x407734[_0x614b('0x2a')];_0x848d10[_0x614b('0x32')]=qs[_0x614b('0x33')](_0x22f144[_0x614b('0x2b')]['sort']);_0x848d10['where']=qs[_0x614b('0x2c')](_[_0x614b('0x35')](_0x22f144['query'],_0x407734[_0x614b('0x2c')]));if(_0x22f144[_0x614b('0x2b')][_0x614b('0x36')]){_0x848d10['where']=_[_0x614b('0x37')](_0x848d10['where'],{'$or':_['map'](_0x848d10[_0x614b('0x2d')],function(_0x3521a1){var _0x515b92={};_0x515b92[_0x3521a1]={'$like':'%'+_0x22f144['query'][_0x614b('0x36')]+'%'};return _0x515b92;})});}_0x848d10=_[_0x614b('0x37')]({},_0x848d10,_0x22f144[_0x614b('0x39')]);return _0x4bf91b['getDescriptions'](_0x848d10);}})[_0x614b('0x20')](function(_0x152c94){if(_0x152c94){_0x2dbd36=_0x152c94['length'];if(!_0x22f144[_0x614b('0x2b')][_0x614b('0x2f')](_0x614b('0x30'))){_0x848d10['limit']=qs[_0x614b('0x31')](_0x22f144['query'][_0x614b('0x31')]);_0x848d10[_0x614b('0x1c')]=qs[_0x614b('0x1c')](_0x22f144[_0x614b('0x2b')][_0x614b('0x1c')]);}return _0x4bf91b[_0x614b('0x4c')](_0x848d10);}})[_0x614b('0x20')](function(_0x288c91){if(_0x288c91){return _0x288c91?{'count':_0x2dbd36,'rows':_0x288c91}:null;}})[_0x614b('0x20')](respondWithResult(_0x3dcad5,null))[_0x614b('0x3d')](handleError(_0x3dcad5,null));};exports[_0x614b('0x4d')]=function(_0x4bbf7c,_0x2880e5,_0x2fdef8){var _0x5d482f={};var _0x2b3c3d={};var _0x2218c5;var _0x2619c9;return db[_0x614b('0x26')]['findOne']({'where':{'id':_0x4bbf7c[_0x614b('0x47')]['id']}})['then'](handleEntityNotFound(_0x2880e5,null))[_0x614b('0x20')](function(_0xacc8bb){if(_0xacc8bb){_0x2218c5=_0xacc8bb;_0x2b3c3d[_0x614b('0x2a')]=_['keys'](db[_0x614b('0x4e')][_0x614b('0x27')]);_0x2b3c3d[_0x614b('0x2b')]=_[_0x614b('0x3f')](_0x4bbf7c[_0x614b('0x2b')]);_0x2b3c3d[_0x614b('0x2c')]=_['intersection'](_0x2b3c3d[_0x614b('0x2a')],_0x2b3c3d['query']);_0x5d482f[_0x614b('0x2d')]=_['intersection'](_0x2b3c3d[_0x614b('0x2a')],qs['fields'](_0x4bbf7c[_0x614b('0x2b')][_0x614b('0x2e')]));_0x5d482f[_0x614b('0x2d')]=_0x5d482f['attributes'][_0x614b('0x41')]?_0x5d482f['attributes']:_0x2b3c3d[_0x614b('0x2a')];_0x5d482f['order']=qs[_0x614b('0x33')](_0x4bbf7c['query']['sort']);_0x5d482f[_0x614b('0x34')]=qs[_0x614b('0x2c')](_[_0x614b('0x35')](_0x4bbf7c[_0x614b('0x2b')],_0x2b3c3d[_0x614b('0x2c')]));if(_0x4bbf7c['query']['filter']){_0x5d482f['where']=_[_0x614b('0x37')](_0x5d482f['where'],{'$or':_['map'](_0x5d482f[_0x614b('0x2d')],function(_0x529e6d){var _0x3a6f9c={};_0x3a6f9c[_0x529e6d]={'$like':'%'+_0x4bbf7c[_0x614b('0x2b')][_0x614b('0x36')]+'%'};return _0x3a6f9c;})});}_0x5d482f=_['merge']({},_0x5d482f,_0x4bbf7c[_0x614b('0x39')]);return _0x2218c5['getTags'](_0x5d482f);}})[_0x614b('0x20')](function(_0x47ddc8){if(_0x47ddc8){_0x2619c9=_0x47ddc8[_0x614b('0x41')];if(!_0x4bbf7c['query']['hasOwnProperty'](_0x614b('0x30'))){_0x5d482f[_0x614b('0x31')]=qs[_0x614b('0x31')](_0x4bbf7c[_0x614b('0x2b')][_0x614b('0x31')]);_0x5d482f[_0x614b('0x1c')]=qs[_0x614b('0x1c')](_0x4bbf7c[_0x614b('0x2b')][_0x614b('0x1c')]);}return _0x2218c5['getTags'](_0x5d482f);}})['then'](function(_0x14ed00){if(_0x14ed00){return _0x14ed00?{'count':_0x2619c9,'rows':_0x14ed00}:null;}})[_0x614b('0x20')](respondWithResult(_0x2880e5,null))[_0x614b('0x3d')](handleError(_0x2880e5,null));};exports[_0x614b('0x4f')]=function(_0x2dc7d1,_0x39490d,_0x2df3e9){if(_0x2dc7d1[_0x614b('0x45')]['id']){delete _0x2dc7d1['body']['id'];}return db['DeskConfiguration']['findOne']({'where':{'id':_0x2dc7d1[_0x614b('0x47')]['id']}})[_0x614b('0x20')](handleEntityNotFound(_0x39490d,null))[_0x614b('0x20')](function(_0x20b2b5){if(_0x20b2b5){return _0x20b2b5[_0x614b('0x4f')](_0x2dc7d1[_0x614b('0x45')]['ids']||[]);}return null;})[_0x614b('0x20')](respondWithResult(_0x39490d,null))['catch'](handleError(_0x39490d,null));}; \ No newline at end of file +var _0xa5f9=['catch','show','params','keys','rawAttributes','include','create','body','find','getFields','DeskField','order','getSubjects','getDescriptions','getTags','Tag','setTags','findOne','eml-format','zip-dir','fast-json-patch','mustache','util','sox','to-csv','fs-extra','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','DeskConfiguration','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll'];(function(_0x596f85,_0x587203){var _0x276aa1=function(_0x20fdf8){while(--_0x20fdf8){_0x596f85['push'](_0x596f85['shift']());}};_0x276aa1(++_0x587203);}(_0xa5f9,0x102));var _0x9a5f=function(_0x142b75,_0x1d632f){_0x142b75=_0x142b75-0x0;var _0x4d8bb2=_0xa5f9[_0x142b75];return _0x4d8bb2;};'use strict';var emlformat=require(_0x9a5f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9a5f('0x1'));var jsonpatch=require(_0x9a5f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9a5f('0x3'));var util=require(_0x9a5f('0x4'));var path=require('path');var sox=require(_0x9a5f('0x5'));var csv=require(_0x9a5f('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9a5f('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9a5f('0x8'));var jsforce=require(_0x9a5f('0x9'));var deskjs=require(_0x9a5f('0xa'));var toCsv=require(_0x9a5f('0x6'));var querystring=require('querystring');var Papa=require(_0x9a5f('0xb'));var Redis=require('ioredis');var authService=require(_0x9a5f('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x9a5f('0xd'));var hardwareService=require(_0x9a5f('0xe'));var logger=require(_0x9a5f('0xf'))(_0x9a5f('0x10'));var utils=require(_0x9a5f('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x9a5f('0x12'));var db=require(_0x9a5f('0x13'))['db'];function respondWithStatusCode(_0x4a2e0,_0xdbf679){_0xdbf679=_0xdbf679||0xcc;return function(_0x24f2c9){if(_0x24f2c9){return _0x4a2e0['sendStatus'](_0xdbf679);}return _0x4a2e0[_0x9a5f('0x14')](_0xdbf679)['end']();};}function respondWithResult(_0x23bd10,_0x401edf){_0x401edf=_0x401edf||0xc8;return function(_0x3347bd){if(_0x3347bd){return _0x23bd10[_0x9a5f('0x14')](_0x401edf)['json'](_0x3347bd);}};}function respondWithFilteredResult(_0x1a37d1,_0xe0ac4a){return function(_0x213143){if(_0x213143){var _0x249e5f=typeof _0xe0ac4a[_0x9a5f('0x15')]===_0x9a5f('0x16')&&typeof _0xe0ac4a[_0x9a5f('0x17')]===_0x9a5f('0x16');var _0x26b280=_0x213143[_0x9a5f('0x18')];var _0x244c86=_0x249e5f?0x0:_0xe0ac4a[_0x9a5f('0x15')];var _0x18e561=_0x249e5f?_0x213143['count']:_0xe0ac4a[_0x9a5f('0x15')]+_0xe0ac4a['limit'];var _0x49bfc1;if(_0x18e561>=_0x26b280){_0x18e561=_0x26b280;_0x49bfc1=0xc8;}else{_0x49bfc1=0xce;}_0x1a37d1[_0x9a5f('0x14')](_0x49bfc1);return _0x1a37d1[_0x9a5f('0x19')]('Content-Range',_0x244c86+'-'+_0x18e561+'/'+_0x26b280)[_0x9a5f('0x1a')](_0x213143);}return null;};}function patchUpdates(_0x26e090){return function(_0x1a6087){try{jsonpatch[_0x9a5f('0x1b')](_0x1a6087,_0x26e090,!![]);}catch(_0x15e0d8){return BPromise[_0x9a5f('0x1c')](_0x15e0d8);}return _0x1a6087[_0x9a5f('0x1d')]();};}function saveUpdates(_0x5d7de5,_0x1521e3){return function(_0x3d4119){if(_0x3d4119){return _0x3d4119[_0x9a5f('0x1e')](_0x5d7de5)[_0x9a5f('0x1f')](function(_0x519319){return _0x519319;});}return null;};}function removeEntity(_0x4ec8d7,_0x264185){return function(_0x4e6482){if(_0x4e6482){return _0x4e6482[_0x9a5f('0x20')]()[_0x9a5f('0x1f')](function(){_0x4ec8d7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x558235,_0x5202a1){return function(_0x12076b){if(!_0x12076b){_0x558235[_0x9a5f('0x21')](0x194);}return _0x12076b;};}function handleError(_0x544636,_0x206584){_0x206584=_0x206584||0x1f4;return function(_0xa0e3ff){logger[_0x9a5f('0x22')](_0xa0e3ff[_0x9a5f('0x23')]);if(_0xa0e3ff[_0x9a5f('0x24')]){delete _0xa0e3ff['name'];}_0x544636['status'](_0x206584)[_0x9a5f('0x25')](_0xa0e3ff);};}exports[_0x9a5f('0x26')]=function(_0x1e0268,_0x40143f){var _0x2d4ce9={},_0x167eec={},_0x2023cc={'count':0x0,'rows':[]};var _0xfb8dc2=_[_0x9a5f('0x27')](db[_0x9a5f('0x28')]['rawAttributes'],function(_0x44b72c){return{'name':_0x44b72c[_0x9a5f('0x29')],'type':_0x44b72c[_0x9a5f('0x2a')][_0x9a5f('0x2b')]};});_0x167eec[_0x9a5f('0x2c')]=_['map'](_0xfb8dc2,_0x9a5f('0x24'));_0x167eec[_0x9a5f('0x2d')]=_['keys'](_0x1e0268['query']);_0x167eec[_0x9a5f('0x2e')]=_[_0x9a5f('0x2f')](_0x167eec[_0x9a5f('0x2c')],_0x167eec[_0x9a5f('0x2d')]);_0x2d4ce9[_0x9a5f('0x30')]=_['intersection'](_0x167eec[_0x9a5f('0x2c')],qs[_0x9a5f('0x31')](_0x1e0268[_0x9a5f('0x2d')][_0x9a5f('0x31')]));_0x2d4ce9[_0x9a5f('0x30')]=_0x2d4ce9[_0x9a5f('0x30')][_0x9a5f('0x32')]?_0x2d4ce9[_0x9a5f('0x30')]:_0x167eec['model'];if(!_0x1e0268[_0x9a5f('0x2d')][_0x9a5f('0x33')](_0x9a5f('0x34'))){_0x2d4ce9[_0x9a5f('0x17')]=qs[_0x9a5f('0x17')](_0x1e0268[_0x9a5f('0x2d')][_0x9a5f('0x17')]);_0x2d4ce9[_0x9a5f('0x15')]=qs[_0x9a5f('0x15')](_0x1e0268[_0x9a5f('0x2d')][_0x9a5f('0x15')]);}_0x2d4ce9['order']=qs['sort'](_0x1e0268[_0x9a5f('0x2d')][_0x9a5f('0x35')]);_0x2d4ce9['where']=qs[_0x9a5f('0x2e')](_[_0x9a5f('0x36')](_0x1e0268['query'],_0x167eec['filters']),_0xfb8dc2);if(_0x1e0268['query'][_0x9a5f('0x37')]){_0x2d4ce9[_0x9a5f('0x38')]=_['merge'](_0x2d4ce9[_0x9a5f('0x38')],{'$or':_['map'](_0xfb8dc2,function(_0x49acd5){if(_0x49acd5[_0x9a5f('0x2a')]!==_0x9a5f('0x39')){var _0x4316e1={};_0x4316e1[_0x49acd5[_0x9a5f('0x24')]]={'$like':'%'+_0x1e0268[_0x9a5f('0x2d')]['filter']+'%'};return _0x4316e1;}})});}_0x2d4ce9=_[_0x9a5f('0x3a')]({},_0x2d4ce9,_0x1e0268[_0x9a5f('0x3b')]);var _0x570702={'where':_0x2d4ce9[_0x9a5f('0x38')]};return db[_0x9a5f('0x28')][_0x9a5f('0x18')](_0x570702)[_0x9a5f('0x1f')](function(_0x3da33c){_0x2023cc[_0x9a5f('0x18')]=_0x3da33c;if(_0x1e0268[_0x9a5f('0x2d')][_0x9a5f('0x3c')]){_0x2d4ce9['include']=[{'all':!![]}];}return db[_0x9a5f('0x28')][_0x9a5f('0x3d')](_0x2d4ce9);})[_0x9a5f('0x1f')](function(_0x130436){_0x2023cc['rows']=_0x130436;return _0x2023cc;})[_0x9a5f('0x1f')](respondWithFilteredResult(_0x40143f,_0x2d4ce9))[_0x9a5f('0x3e')](handleError(_0x40143f,null));};exports[_0x9a5f('0x3f')]=function(_0x192a28,_0x4e6537){var _0x256eef={'raw':![],'where':{'id':_0x192a28[_0x9a5f('0x40')]['id']}},_0x445044={};_0x445044[_0x9a5f('0x2c')]=_[_0x9a5f('0x41')](db['DeskConfiguration'][_0x9a5f('0x42')]);_0x445044[_0x9a5f('0x2d')]=_['keys'](_0x192a28['query']);_0x445044[_0x9a5f('0x2e')]=_[_0x9a5f('0x2f')](_0x445044['model'],_0x445044[_0x9a5f('0x2d')]);_0x256eef['attributes']=_[_0x9a5f('0x2f')](_0x445044[_0x9a5f('0x2c')],qs[_0x9a5f('0x31')](_0x192a28[_0x9a5f('0x2d')]['fields']));_0x256eef[_0x9a5f('0x30')]=_0x256eef[_0x9a5f('0x30')][_0x9a5f('0x32')]?_0x256eef['attributes']:_0x445044[_0x9a5f('0x2c')];if(_0x192a28[_0x9a5f('0x2d')][_0x9a5f('0x3c')]){_0x256eef[_0x9a5f('0x43')]=[{'all':!![]}];}_0x256eef=_[_0x9a5f('0x3a')]({},_0x256eef,_0x192a28[_0x9a5f('0x3b')]);return db['DeskConfiguration']['find'](_0x256eef)[_0x9a5f('0x1f')](handleEntityNotFound(_0x4e6537,null))[_0x9a5f('0x1f')](respondWithResult(_0x4e6537,null))['catch'](handleError(_0x4e6537,null));};exports['create']=function(_0x849718,_0x4dd2fe){return db[_0x9a5f('0x28')][_0x9a5f('0x44')](_0x849718['body'],{})['then'](respondWithResult(_0x4dd2fe,0xc9))['catch'](handleError(_0x4dd2fe,null));};exports[_0x9a5f('0x1e')]=function(_0x315ebf,_0x4936f5){if(_0x315ebf[_0x9a5f('0x45')]['id']){delete _0x315ebf[_0x9a5f('0x45')]['id'];}return db['DeskConfiguration'][_0x9a5f('0x46')]({'where':{'id':_0x315ebf[_0x9a5f('0x40')]['id']}})[_0x9a5f('0x1f')](handleEntityNotFound(_0x4936f5,null))[_0x9a5f('0x1f')](saveUpdates(_0x315ebf['body'],null))[_0x9a5f('0x1f')](respondWithResult(_0x4936f5,null))['catch'](handleError(_0x4936f5,null));};exports[_0x9a5f('0x20')]=function(_0x10ea1d,_0x1865ca){return db[_0x9a5f('0x28')]['find']({'where':{'id':_0x10ea1d[_0x9a5f('0x40')]['id']}})[_0x9a5f('0x1f')](handleEntityNotFound(_0x1865ca,null))[_0x9a5f('0x1f')](removeEntity(_0x1865ca,null))[_0x9a5f('0x3e')](handleError(_0x1865ca,null));};exports[_0x9a5f('0x47')]=function(_0x60ab6e,_0x265b52,_0x5ad9e9){var _0x750c98={};var _0x39176a={};var _0x44f600;var _0x593721;return db[_0x9a5f('0x28')]['findOne']({'where':{'id':_0x60ab6e[_0x9a5f('0x40')]['id']}})[_0x9a5f('0x1f')](handleEntityNotFound(_0x265b52,null))[_0x9a5f('0x1f')](function(_0x56047f){if(_0x56047f){_0x44f600=_0x56047f;_0x39176a['model']=_[_0x9a5f('0x41')](db[_0x9a5f('0x48')]['rawAttributes']);_0x39176a[_0x9a5f('0x2d')]=_[_0x9a5f('0x41')](_0x60ab6e[_0x9a5f('0x2d')]);_0x39176a['filters']=_[_0x9a5f('0x2f')](_0x39176a['model'],_0x39176a['query']);_0x750c98[_0x9a5f('0x30')]=_[_0x9a5f('0x2f')](_0x39176a['model'],qs[_0x9a5f('0x31')](_0x60ab6e[_0x9a5f('0x2d')]['fields']));_0x750c98[_0x9a5f('0x30')]=_0x750c98['attributes'][_0x9a5f('0x32')]?_0x750c98[_0x9a5f('0x30')]:_0x39176a['model'];_0x750c98['order']=qs[_0x9a5f('0x35')](_0x60ab6e[_0x9a5f('0x2d')][_0x9a5f('0x35')]);_0x750c98[_0x9a5f('0x38')]=qs[_0x9a5f('0x2e')](_[_0x9a5f('0x36')](_0x60ab6e['query'],_0x39176a[_0x9a5f('0x2e')]));if(_0x60ab6e[_0x9a5f('0x2d')][_0x9a5f('0x37')]){_0x750c98[_0x9a5f('0x38')]=_[_0x9a5f('0x3a')](_0x750c98[_0x9a5f('0x38')],{'$or':_[_0x9a5f('0x27')](_0x750c98[_0x9a5f('0x30')],function(_0x108745){var _0x146841={};_0x146841[_0x108745]={'$like':'%'+_0x60ab6e[_0x9a5f('0x2d')][_0x9a5f('0x37')]+'%'};return _0x146841;})});}_0x750c98=_[_0x9a5f('0x3a')]({},_0x750c98,_0x60ab6e[_0x9a5f('0x3b')]);return _0x44f600[_0x9a5f('0x47')](_0x750c98);}})[_0x9a5f('0x1f')](function(_0x1e79fb){if(_0x1e79fb){_0x593721=_0x1e79fb[_0x9a5f('0x32')];if(!_0x60ab6e[_0x9a5f('0x2d')][_0x9a5f('0x33')](_0x9a5f('0x34'))){_0x750c98[_0x9a5f('0x17')]=qs[_0x9a5f('0x17')](_0x60ab6e[_0x9a5f('0x2d')][_0x9a5f('0x17')]);_0x750c98[_0x9a5f('0x15')]=qs['offset'](_0x60ab6e['query'][_0x9a5f('0x15')]);}return _0x44f600[_0x9a5f('0x47')](_0x750c98);}})[_0x9a5f('0x1f')](function(_0x5cb424){if(_0x5cb424){return _0x5cb424?{'count':_0x593721,'rows':_0x5cb424}:null;}})[_0x9a5f('0x1f')](respondWithResult(_0x265b52,null))['catch'](handleError(_0x265b52,null));};exports['getSubjects']=function(_0x345914,_0x340530,_0x19020e){var _0x4b9812={};var _0x26c316={};var _0x7e5e1;var _0x362c7f;return db['DeskConfiguration']['findOne']({'where':{'id':_0x345914[_0x9a5f('0x40')]['id']}})[_0x9a5f('0x1f')](handleEntityNotFound(_0x340530,null))['then'](function(_0x423c12){if(_0x423c12){_0x7e5e1=_0x423c12;_0x26c316[_0x9a5f('0x2c')]=_[_0x9a5f('0x41')](db['DeskField'][_0x9a5f('0x42')]);_0x26c316[_0x9a5f('0x2d')]=_[_0x9a5f('0x41')](_0x345914['query']);_0x26c316[_0x9a5f('0x2e')]=_[_0x9a5f('0x2f')](_0x26c316[_0x9a5f('0x2c')],_0x26c316[_0x9a5f('0x2d')]);_0x4b9812[_0x9a5f('0x30')]=_[_0x9a5f('0x2f')](_0x26c316[_0x9a5f('0x2c')],qs[_0x9a5f('0x31')](_0x345914[_0x9a5f('0x2d')][_0x9a5f('0x31')]));_0x4b9812[_0x9a5f('0x30')]=_0x4b9812[_0x9a5f('0x30')]['length']?_0x4b9812[_0x9a5f('0x30')]:_0x26c316[_0x9a5f('0x2c')];_0x4b9812[_0x9a5f('0x49')]=qs[_0x9a5f('0x35')](_0x345914[_0x9a5f('0x2d')]['sort']);_0x4b9812[_0x9a5f('0x38')]=qs[_0x9a5f('0x2e')](_[_0x9a5f('0x36')](_0x345914[_0x9a5f('0x2d')],_0x26c316[_0x9a5f('0x2e')]));if(_0x345914['query'][_0x9a5f('0x37')]){_0x4b9812[_0x9a5f('0x38')]=_[_0x9a5f('0x3a')](_0x4b9812[_0x9a5f('0x38')],{'$or':_[_0x9a5f('0x27')](_0x4b9812[_0x9a5f('0x30')],function(_0x55ce25){var _0x2451ae={};_0x2451ae[_0x55ce25]={'$like':'%'+_0x345914[_0x9a5f('0x2d')]['filter']+'%'};return _0x2451ae;})});}_0x4b9812=_['merge']({},_0x4b9812,_0x345914[_0x9a5f('0x3b')]);return _0x7e5e1[_0x9a5f('0x4a')](_0x4b9812);}})['then'](function(_0x303c7b){if(_0x303c7b){_0x362c7f=_0x303c7b[_0x9a5f('0x32')];if(!_0x345914[_0x9a5f('0x2d')][_0x9a5f('0x33')]('nolimit')){_0x4b9812[_0x9a5f('0x17')]=qs[_0x9a5f('0x17')](_0x345914['query'][_0x9a5f('0x17')]);_0x4b9812[_0x9a5f('0x15')]=qs[_0x9a5f('0x15')](_0x345914['query']['offset']);}return _0x7e5e1['getSubjects'](_0x4b9812);}})[_0x9a5f('0x1f')](function(_0x31807d){if(_0x31807d){return _0x31807d?{'count':_0x362c7f,'rows':_0x31807d}:null;}})[_0x9a5f('0x1f')](respondWithResult(_0x340530,null))[_0x9a5f('0x3e')](handleError(_0x340530,null));};exports[_0x9a5f('0x4b')]=function(_0x3785ef,_0x389ad6,_0x580ff4){var _0x55fbed={};var _0x5e176f={};var _0x271fff;var _0x262373;return db['DeskConfiguration']['findOne']({'where':{'id':_0x3785ef['params']['id']}})['then'](handleEntityNotFound(_0x389ad6,null))[_0x9a5f('0x1f')](function(_0x4d99cf){if(_0x4d99cf){_0x271fff=_0x4d99cf;_0x5e176f[_0x9a5f('0x2c')]=_[_0x9a5f('0x41')](db['DeskField']['rawAttributes']);_0x5e176f['query']=_[_0x9a5f('0x41')](_0x3785ef[_0x9a5f('0x2d')]);_0x5e176f[_0x9a5f('0x2e')]=_[_0x9a5f('0x2f')](_0x5e176f[_0x9a5f('0x2c')],_0x5e176f[_0x9a5f('0x2d')]);_0x55fbed[_0x9a5f('0x30')]=_[_0x9a5f('0x2f')](_0x5e176f['model'],qs[_0x9a5f('0x31')](_0x3785ef[_0x9a5f('0x2d')][_0x9a5f('0x31')]));_0x55fbed[_0x9a5f('0x30')]=_0x55fbed[_0x9a5f('0x30')][_0x9a5f('0x32')]?_0x55fbed[_0x9a5f('0x30')]:_0x5e176f[_0x9a5f('0x2c')];_0x55fbed[_0x9a5f('0x49')]=qs['sort'](_0x3785ef['query']['sort']);_0x55fbed[_0x9a5f('0x38')]=qs[_0x9a5f('0x2e')](_['pick'](_0x3785ef['query'],_0x5e176f[_0x9a5f('0x2e')]));if(_0x3785ef['query'][_0x9a5f('0x37')]){_0x55fbed[_0x9a5f('0x38')]=_['merge'](_0x55fbed[_0x9a5f('0x38')],{'$or':_[_0x9a5f('0x27')](_0x55fbed['attributes'],function(_0x229646){var _0x5312f5={};_0x5312f5[_0x229646]={'$like':'%'+_0x3785ef[_0x9a5f('0x2d')][_0x9a5f('0x37')]+'%'};return _0x5312f5;})});}_0x55fbed=_[_0x9a5f('0x3a')]({},_0x55fbed,_0x3785ef[_0x9a5f('0x3b')]);return _0x271fff[_0x9a5f('0x4b')](_0x55fbed);}})[_0x9a5f('0x1f')](function(_0x7ecad5){if(_0x7ecad5){_0x262373=_0x7ecad5[_0x9a5f('0x32')];if(!_0x3785ef[_0x9a5f('0x2d')]['hasOwnProperty'](_0x9a5f('0x34'))){_0x55fbed[_0x9a5f('0x17')]=qs[_0x9a5f('0x17')](_0x3785ef[_0x9a5f('0x2d')]['limit']);_0x55fbed['offset']=qs[_0x9a5f('0x15')](_0x3785ef[_0x9a5f('0x2d')][_0x9a5f('0x15')]);}return _0x271fff[_0x9a5f('0x4b')](_0x55fbed);}})[_0x9a5f('0x1f')](function(_0x196644){if(_0x196644){return _0x196644?{'count':_0x262373,'rows':_0x196644}:null;}})[_0x9a5f('0x1f')](respondWithResult(_0x389ad6,null))[_0x9a5f('0x3e')](handleError(_0x389ad6,null));};exports[_0x9a5f('0x4c')]=function(_0x407f03,_0x4036aa,_0x5bdc23){var _0x1195e2={};var _0x3df66a={};var _0x32c851;var _0x140124;return db[_0x9a5f('0x28')]['findOne']({'where':{'id':_0x407f03[_0x9a5f('0x40')]['id']}})[_0x9a5f('0x1f')](handleEntityNotFound(_0x4036aa,null))[_0x9a5f('0x1f')](function(_0x23d2f0){if(_0x23d2f0){_0x32c851=_0x23d2f0;_0x3df66a['model']=_[_0x9a5f('0x41')](db[_0x9a5f('0x4d')][_0x9a5f('0x42')]);_0x3df66a['query']=_[_0x9a5f('0x41')](_0x407f03[_0x9a5f('0x2d')]);_0x3df66a[_0x9a5f('0x2e')]=_[_0x9a5f('0x2f')](_0x3df66a[_0x9a5f('0x2c')],_0x3df66a[_0x9a5f('0x2d')]);_0x1195e2[_0x9a5f('0x30')]=_[_0x9a5f('0x2f')](_0x3df66a[_0x9a5f('0x2c')],qs['fields'](_0x407f03[_0x9a5f('0x2d')][_0x9a5f('0x31')]));_0x1195e2[_0x9a5f('0x30')]=_0x1195e2['attributes'][_0x9a5f('0x32')]?_0x1195e2[_0x9a5f('0x30')]:_0x3df66a['model'];_0x1195e2[_0x9a5f('0x49')]=qs['sort'](_0x407f03[_0x9a5f('0x2d')][_0x9a5f('0x35')]);_0x1195e2['where']=qs[_0x9a5f('0x2e')](_[_0x9a5f('0x36')](_0x407f03[_0x9a5f('0x2d')],_0x3df66a['filters']));if(_0x407f03[_0x9a5f('0x2d')][_0x9a5f('0x37')]){_0x1195e2[_0x9a5f('0x38')]=_[_0x9a5f('0x3a')](_0x1195e2[_0x9a5f('0x38')],{'$or':_[_0x9a5f('0x27')](_0x1195e2[_0x9a5f('0x30')],function(_0x5f197e){var _0x4b56ac={};_0x4b56ac[_0x5f197e]={'$like':'%'+_0x407f03['query'][_0x9a5f('0x37')]+'%'};return _0x4b56ac;})});}_0x1195e2=_['merge']({},_0x1195e2,_0x407f03[_0x9a5f('0x3b')]);return _0x32c851[_0x9a5f('0x4c')](_0x1195e2);}})[_0x9a5f('0x1f')](function(_0x3f6d7b){if(_0x3f6d7b){_0x140124=_0x3f6d7b[_0x9a5f('0x32')];if(!_0x407f03[_0x9a5f('0x2d')]['hasOwnProperty']('nolimit')){_0x1195e2[_0x9a5f('0x17')]=qs[_0x9a5f('0x17')](_0x407f03[_0x9a5f('0x2d')][_0x9a5f('0x17')]);_0x1195e2[_0x9a5f('0x15')]=qs['offset'](_0x407f03[_0x9a5f('0x2d')][_0x9a5f('0x15')]);}return _0x32c851[_0x9a5f('0x4c')](_0x1195e2);}})[_0x9a5f('0x1f')](function(_0x4e6c43){if(_0x4e6c43){return _0x4e6c43?{'count':_0x140124,'rows':_0x4e6c43}:null;}})['then'](respondWithResult(_0x4036aa,null))[_0x9a5f('0x3e')](handleError(_0x4036aa,null));};exports[_0x9a5f('0x4e')]=function(_0x59e61d,_0x101c53,_0x5198f7){if(_0x59e61d[_0x9a5f('0x45')]['id']){delete _0x59e61d[_0x9a5f('0x45')]['id'];}return db['DeskConfiguration'][_0x9a5f('0x4f')]({'where':{'id':_0x59e61d[_0x9a5f('0x40')]['id']}})[_0x9a5f('0x1f')](handleEntityNotFound(_0x101c53,null))[_0x9a5f('0x1f')](function(_0x153687){if(_0x153687){return _0x153687[_0x9a5f('0x4e')](_0x59e61d[_0x9a5f('0x45')]['ids']||[]);}return null;})[_0x9a5f('0x1f')](respondWithResult(_0x101c53,null))[_0x9a5f('0x3e')](handleError(_0x101c53,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 2a85c6d..0c7d2ae 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 _0x0820=['bluebird','request-promise','path','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','lodash','util','api','moment'];(function(_0x1e2bf0,_0x1a4080){var _0x5cc1fc=function(_0x53aa17){while(--_0x53aa17){_0x1e2bf0['push'](_0x1e2bf0['shift']());}};_0x5cc1fc(++_0x1a4080);}(_0x0820,0x1b8));var _0x0082=function(_0x3b2e58,_0x387532){_0x3b2e58=_0x3b2e58-0x0;var _0x454aa7=_0x0820[_0x3b2e58];return _0x454aa7;};'use strict';var _=require(_0x0082('0x0'));var util=require(_0x0082('0x1'));var logger=require('../../config/logger')(_0x0082('0x2'));var moment=require(_0x0082('0x3'));var BPromise=require(_0x0082('0x4'));var rp=require(_0x0082('0x5'));var fs=require('fs');var path=require(_0x0082('0x6'));var rimraf=require('rimraf');var config=require(_0x0082('0x7'));var attributes=require(_0x0082('0x8'));module[_0x0082('0x9')]=function(_0x4ee49f,_0x388f54){return _0x4ee49f[_0x0082('0xa')](_0x0082('0xb'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c7d=['moment','request-promise','rimraf','./intDeskConfiguration.attributes','exports','int_desk_configurations','util','../../config/logger','api'];(function(_0x521155,_0x33a9d3){var _0x4e525c=function(_0x2cec08){while(--_0x2cec08){_0x521155['push'](_0x521155['shift']());}};_0x4e525c(++_0x33a9d3);}(_0x6c7d,0xf9));var _0xd6c7=function(_0x431f82,_0x1f4d0d){_0x431f82=_0x431f82-0x0;var _0x31cd63=_0x6c7d[_0x431f82];return _0x31cd63;};'use strict';var _=require('lodash');var util=require(_0xd6c7('0x0'));var logger=require(_0xd6c7('0x1'))(_0xd6c7('0x2'));var moment=require(_0xd6c7('0x3'));var BPromise=require('bluebird');var rp=require(_0xd6c7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd6c7('0x5'));var config=require('../../config/environment');var attributes=require(_0xd6c7('0x6'));module[_0xd6c7('0x7')]=function(_0x1f4f07,_0x4a081e){return _0x1f4f07['define']('DeskConfiguration',attributes,{'tableName':_0xd6c7('0x8'),'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 6009af0..04d37e7 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 _0x955f=['DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','http','request','then','info'];(function(_0x39cbfb,_0x27053a){var _0x417b69=function(_0x49cc49){while(--_0x49cc49){_0x39cbfb['push'](_0x39cbfb['shift']());}};_0x417b69(++_0x27053a);}(_0x955f,0x1eb));var _0xf955=function(_0xed280c,_0x5ee20b){_0xed280c=_0xed280c-0x0;var _0x44f021=_0x955f[_0xed280c];return _0x44f021;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var moment=require(_0xf955('0x2'));var BPromise=require(_0xf955('0x3'));var rs=require(_0xf955('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf955('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf955('0x6'));var config=require('../../config/environment');var jayson=require(_0xf955('0x7'));var client=jayson[_0xf955('0x8')][_0xf955('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59d5b3,_0x18432f,_0x20c096){return new BPromise(function(_0x4f58fb,_0x254b38){return client[_0xf955('0xa')](_0x59d5b3,_0x20c096)[_0xf955('0xb')](function(_0x38b190){logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,_0xf955('0xe'));logger['debug'](_0xf955('0xf'),_0x18432f,'request\x20sent',JSON[_0xf955('0x10')](_0x38b190));if(_0x38b190[_0xf955('0x11')]){if(_0x38b190[_0xf955('0x11')]['code']===0x1f4){logger[_0xf955('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x18432f,_0x38b190[_0xf955('0x11')]['message']);return _0x254b38(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);return _0x4f58fb(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}else{logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,'request\x20sent');_0x4f58fb(_0x38b190[_0xf955('0x13')]['message']);}})[_0xf955('0x14')](function(_0x3a814f){logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x3a814f);_0x254b38(_0x3a814f);});});} \ No newline at end of file +var _0x928c=['catch','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x4dfec4,_0x49a6cb){var _0x1f7ba8=function(_0x40184b){while(--_0x40184b){_0x4dfec4['push'](_0x4dfec4['shift']());}};_0x1f7ba8(++_0x49a6cb);}(_0x928c,0x157));var _0xc928=function(_0x59291b,_0x5e7125){_0x59291b=_0x59291b-0x0;var _0x3ff71e=_0x928c[_0x59291b];return _0x3ff71e;};'use strict';var _=require(_0xc928('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc928('0x1'));var rs=require(_0xc928('0x2'));var fs=require('fs');var Redis=require(_0xc928('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc928('0x4'));var logger=require('../../config/logger')(_0xc928('0x5'));var config=require('../../config/environment');var jayson=require(_0xc928('0x6'));var client=jayson[_0xc928('0x7')][_0xc928('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3c61c1,_0x41f542,_0x111004){return new BPromise(function(_0x19ec0a,_0x37a526){return client[_0xc928('0x9')](_0x3c61c1,_0x111004)['then'](function(_0x470b11){logger[_0xc928('0xa')](_0xc928('0xb'),_0x41f542,_0xc928('0xc'));logger[_0xc928('0xd')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x41f542,_0xc928('0xc'),JSON[_0xc928('0xe')](_0x470b11));if(_0x470b11[_0xc928('0xf')]){if(_0x470b11['error'][_0xc928('0x10')]===0x1f4){logger[_0xc928('0xf')](_0xc928('0xb'),_0x41f542,_0x470b11['error'][_0xc928('0x11')]);return _0x37a526(_0x470b11['error'][_0xc928('0x11')]);}logger['error'](_0xc928('0xb'),_0x41f542,_0x470b11['error'][_0xc928('0x11')]);return _0x19ec0a(_0x470b11[_0xc928('0xf')]['message']);}else{logger[_0xc928('0xa')](_0xc928('0xb'),_0x41f542,'request\x20sent');_0x19ec0a(_0x470b11['result']['message']);}})[_0xc928('0x12')](function(_0x1e0f0e){logger['error'](_0xc928('0xb'),_0x41f542,_0x1e0f0e);_0x37a526(_0x1e0f0e);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 27a3507..88aa421 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 _0xb08b=['path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskField.controller','get','index','isAuthenticated','show','create','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0xdad237,_0x361a1d){var _0x15c575=function(_0x8db2f6){while(--_0x8db2f6){_0xdad237['push'](_0xdad237['shift']());}};_0x15c575(++_0x361a1d);}(_0xb08b,0x116));var _0xbb08=function(_0xf9192,_0x4df8c5){_0xf9192=_0xf9192-0x0;var _0x35ed5b=_0xb08b[_0xf9192];return _0x35ed5b;};'use strict';var multer=require(_0xbb08('0x0'));var util=require(_0xbb08('0x1'));var path=require(_0xbb08('0x2'));var timeout=require('connect-timeout');var express=require(_0xbb08('0x3'));var router=express[_0xbb08('0x4')]();var fs_extra=require(_0xbb08('0x5'));var auth=require(_0xbb08('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbb08('0x7'));var controller=require(_0xbb08('0x8'));router[_0xbb08('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb08('0xa')]);router[_0xbb08('0x9')]('/:id',auth[_0xbb08('0xb')](),controller[_0xbb08('0xc')]);router['post']('/',auth[_0xbb08('0xb')](),controller[_0xbb08('0xd')]);router[_0xbb08('0xe')](_0xbb08('0xf'),auth[_0xbb08('0xb')](),controller[_0xbb08('0x10')]);router[_0xbb08('0x11')](_0xbb08('0xf'),auth[_0xbb08('0xb')](),controller[_0xbb08('0x12')]);module[_0xbb08('0x13')]=router; \ No newline at end of file +var _0x20d9=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','index','get','/:id','isAuthenticated','show','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x22468d,_0x2c865d){var _0x4338e9=function(_0x691843){while(--_0x691843){_0x22468d['push'](_0x22468d['shift']());}};_0x4338e9(++_0x2c865d);}(_0x20d9,0xcc));var _0x920d=function(_0x47c663,_0xb2d8ab){_0x47c663=_0x47c663-0x0;var _0x29a8f1=_0x20d9[_0x47c663];return _0x29a8f1;};'use strict';var multer=require('multer');var util=require(_0x920d('0x0'));var path=require(_0x920d('0x1'));var timeout=require(_0x920d('0x2'));var express=require(_0x920d('0x3'));var router=express[_0x920d('0x4')]();var fs_extra=require(_0x920d('0x5'));var auth=require(_0x920d('0x6'));var interaction=require(_0x920d('0x7'));var config=require(_0x920d('0x8'));var controller=require(_0x920d('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x920d('0xa')]);router[_0x920d('0xb')](_0x920d('0xc'),auth[_0x920d('0xd')](),controller[_0x920d('0xe')]);router[_0x920d('0xf')]('/',auth['isAuthenticated'](),controller[_0x920d('0x10')]);router[_0x920d('0x11')]('/:id',auth[_0x920d('0xd')](),controller[_0x920d('0x12')]);router[_0x920d('0x13')](_0x920d('0xc'),auth[_0x920d('0xd')](),controller['destroy']);module[_0x920d('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 45b9de6..ca3a87e 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 _0x0bea=['STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','picklist'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x0bea,0x108));var _0xa0be=function(_0x56503a,_0x1c4b81){_0x56503a=_0x56503a-0x0;var _0x52e0d4=_0x0bea[_0x56503a];return _0x52e0d4;};'use strict';var Sequelize=require(_0xa0be('0x0'));module[_0xa0be('0x1')]={'type':{'type':Sequelize['ENUM'](_0xa0be('0x2'),_0xa0be('0x3'),_0xa0be('0x4'),'keyValue',_0xa0be('0x5')),'defaultValue':_0xa0be('0x2')},'content':{'type':Sequelize[_0xa0be('0x6')]},'key':{'type':Sequelize[_0xa0be('0x6')]},'keyType':{'type':Sequelize[_0xa0be('0x7')](_0xa0be('0x2'),_0xa0be('0x3'),_0xa0be('0x4'))},'keyContent':{'type':Sequelize[_0xa0be('0x6')]},'idField':{'type':Sequelize[_0xa0be('0x6')]},'nameField':{'type':Sequelize[_0xa0be('0x6')]},'customField':{'type':Sequelize[_0xa0be('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc2b4=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x337261,_0x1182a7){var _0x2639a1=function(_0x3b83c1){while(--_0x3b83c1){_0x337261['push'](_0x337261['shift']());}};_0x2639a1(++_0x1182a7);}(_0xc2b4,0x1cb));var _0x4c2b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc2b4[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x4c2b('0x0'));module[_0x4c2b('0x1')]={'type':{'type':Sequelize[_0x4c2b('0x2')](_0x4c2b('0x3'),_0x4c2b('0x4'),_0x4c2b('0x5'),_0x4c2b('0x6'),_0x4c2b('0x7')),'defaultValue':_0x4c2b('0x3')},'content':{'type':Sequelize[_0x4c2b('0x8')]},'key':{'type':Sequelize[_0x4c2b('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x4c2b('0x3'),_0x4c2b('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x4c2b('0x8')]},'idField':{'type':Sequelize[_0x4c2b('0x8')]},'nameField':{'type':Sequelize[_0x4c2b('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4c2b('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 1c5028c..d4e523b 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 _0xb9e3=['rows','catch','show','params','keys','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','offset','set','apply','reject','save','then','destroy','error','stack','name','send','DeskField','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include'];(function(_0x26b7a6,_0x4f58d1){var _0x20c444=function(_0x30c704){while(--_0x30c704){_0x26b7a6['push'](_0x26b7a6['shift']());}};_0x20c444(++_0x4f58d1);}(_0xb9e3,0xdc));var _0x3b9e=function(_0x4063a4,_0x19d730){_0x4063a4=_0x4063a4-0x0;var _0x17908d=_0xb9e3[_0x4063a4];return _0x17908d;};'use strict';var emlformat=require(_0x3b9e('0x0'));var rimraf=require(_0x3b9e('0x1'));var zipdir=require(_0x3b9e('0x2'));var jsonpatch=require(_0x3b9e('0x3'));var rp=require(_0x3b9e('0x4'));var moment=require('moment');var BPromise=require(_0x3b9e('0x5'));var Mustache=require(_0x3b9e('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3b9e('0x7'));var fs=require('fs');var fs_extra=require(_0x3b9e('0x8'));var _=require('lodash');var squel=require(_0x3b9e('0x9'));var crypto=require(_0x3b9e('0xa'));var jsforce=require(_0x3b9e('0xb'));var deskjs=require(_0x3b9e('0xc'));var toCsv=require(_0x3b9e('0xd'));var querystring=require(_0x3b9e('0xe'));var Papa=require('papaparse');var Redis=require(_0x3b9e('0xf'));var authService=require(_0x3b9e('0x10'));var qs=require(_0x3b9e('0x11'));var as=require(_0x3b9e('0x12'));var hardwareService=require(_0x3b9e('0x13'));var logger=require('../../config/logger')(_0x3b9e('0x14'));var utils=require(_0x3b9e('0x15'));var config=require(_0x3b9e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3b9e('0x17'))['db'];function respondWithStatusCode(_0x1cd6bc,_0x31cbf3){_0x31cbf3=_0x31cbf3||0xcc;return function(_0x32aa24){if(_0x32aa24){return _0x1cd6bc[_0x3b9e('0x18')](_0x31cbf3);}return _0x1cd6bc[_0x3b9e('0x19')](_0x31cbf3)['end']();};}function respondWithResult(_0x1c5c69,_0x3188b4){_0x3188b4=_0x3188b4||0xc8;return function(_0xf4afac){if(_0xf4afac){return _0x1c5c69[_0x3b9e('0x19')](_0x3188b4)[_0x3b9e('0x1a')](_0xf4afac);}};}function respondWithFilteredResult(_0x2c4d75,_0x366f9a){return function(_0x1336f0){if(_0x1336f0){var _0x5f50d1=typeof _0x366f9a['offset']===_0x3b9e('0x1b')&&typeof _0x366f9a[_0x3b9e('0x1c')]===_0x3b9e('0x1b');var _0x1ec65e=_0x1336f0['count'];var _0x24984b=_0x5f50d1?0x0:_0x366f9a['offset'];var _0x21fb05=_0x5f50d1?_0x1336f0['count']:_0x366f9a[_0x3b9e('0x1d')]+_0x366f9a[_0x3b9e('0x1c')];var _0x30f9cc;if(_0x21fb05>=_0x1ec65e){_0x21fb05=_0x1ec65e;_0x30f9cc=0xc8;}else{_0x30f9cc=0xce;}_0x2c4d75['status'](_0x30f9cc);return _0x2c4d75[_0x3b9e('0x1e')]('Content-Range',_0x24984b+'-'+_0x21fb05+'/'+_0x1ec65e)[_0x3b9e('0x1a')](_0x1336f0);}return null;};}function patchUpdates(_0x29b958){return function(_0xf12d62){try{jsonpatch[_0x3b9e('0x1f')](_0xf12d62,_0x29b958,!![]);}catch(_0x183ab9){return BPromise[_0x3b9e('0x20')](_0x183ab9);}return _0xf12d62[_0x3b9e('0x21')]();};}function saveUpdates(_0xe9b77e,_0x43baa7){return function(_0xc10506){if(_0xc10506){return _0xc10506['update'](_0xe9b77e)[_0x3b9e('0x22')](function(_0x49b1f1){return _0x49b1f1;});}return null;};}function removeEntity(_0x3f935b,_0x18720e){return function(_0x53707c){if(_0x53707c){return _0x53707c[_0x3b9e('0x23')]()[_0x3b9e('0x22')](function(){_0x3f935b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xc078cc,_0x6b3d25){return function(_0x49e15e){if(!_0x49e15e){_0xc078cc['sendStatus'](0x194);}return _0x49e15e;};}function handleError(_0x368ff7,_0x500e8d){_0x500e8d=_0x500e8d||0x1f4;return function(_0x38d238){logger[_0x3b9e('0x24')](_0x38d238[_0x3b9e('0x25')]);if(_0x38d238[_0x3b9e('0x26')]){delete _0x38d238[_0x3b9e('0x26')];}_0x368ff7['status'](_0x500e8d)[_0x3b9e('0x27')](_0x38d238);};}exports['index']=function(_0x555f15,_0x131181){var _0x313be6={},_0x18c9dc={},_0x4552ba={'count':0x0,'rows':[]};var _0x358c55=_['map'](db[_0x3b9e('0x28')][_0x3b9e('0x29')],function(_0x443afd){return{'name':_0x443afd[_0x3b9e('0x2a')],'type':_0x443afd[_0x3b9e('0x2b')][_0x3b9e('0x2c')]};});_0x18c9dc[_0x3b9e('0x2d')]=_[_0x3b9e('0x2e')](_0x358c55,_0x3b9e('0x26'));_0x18c9dc[_0x3b9e('0x2f')]=_['keys'](_0x555f15[_0x3b9e('0x2f')]);_0x18c9dc[_0x3b9e('0x30')]=_['intersection'](_0x18c9dc[_0x3b9e('0x2d')],_0x18c9dc[_0x3b9e('0x2f')]);_0x313be6[_0x3b9e('0x31')]=_['intersection'](_0x18c9dc[_0x3b9e('0x2d')],qs['fields'](_0x555f15[_0x3b9e('0x2f')][_0x3b9e('0x32')]));_0x313be6[_0x3b9e('0x31')]=_0x313be6[_0x3b9e('0x31')][_0x3b9e('0x33')]?_0x313be6[_0x3b9e('0x31')]:_0x18c9dc[_0x3b9e('0x2d')];if(!_0x555f15[_0x3b9e('0x2f')][_0x3b9e('0x34')](_0x3b9e('0x35'))){_0x313be6['limit']=qs[_0x3b9e('0x1c')](_0x555f15['query'][_0x3b9e('0x1c')]);_0x313be6['offset']=qs[_0x3b9e('0x1d')](_0x555f15[_0x3b9e('0x2f')][_0x3b9e('0x1d')]);}_0x313be6[_0x3b9e('0x36')]=qs[_0x3b9e('0x37')](_0x555f15[_0x3b9e('0x2f')][_0x3b9e('0x37')]);_0x313be6[_0x3b9e('0x38')]=qs['filters'](_['pick'](_0x555f15[_0x3b9e('0x2f')],_0x18c9dc[_0x3b9e('0x30')]),_0x358c55);if(_0x555f15[_0x3b9e('0x2f')][_0x3b9e('0x39')]){_0x313be6['where']=_[_0x3b9e('0x3a')](_0x313be6[_0x3b9e('0x38')],{'$or':_[_0x3b9e('0x2e')](_0x358c55,function(_0x170e7c){if(_0x170e7c[_0x3b9e('0x2b')]!==_0x3b9e('0x3b')){var _0x2c4823={};_0x2c4823[_0x170e7c['name']]={'$like':'%'+_0x555f15[_0x3b9e('0x2f')][_0x3b9e('0x39')]+'%'};return _0x2c4823;}})});}_0x313be6=_[_0x3b9e('0x3a')]({},_0x313be6,_0x555f15[_0x3b9e('0x3c')]);var _0x17fae2={'where':_0x313be6[_0x3b9e('0x38')]};return db[_0x3b9e('0x28')][_0x3b9e('0x3d')](_0x17fae2)['then'](function(_0x2a9c73){_0x4552ba[_0x3b9e('0x3d')]=_0x2a9c73;if(_0x555f15[_0x3b9e('0x2f')][_0x3b9e('0x3e')]){_0x313be6[_0x3b9e('0x3f')]=[{'all':!![]}];}return db[_0x3b9e('0x28')]['findAll'](_0x313be6);})[_0x3b9e('0x22')](function(_0x596c86){_0x4552ba[_0x3b9e('0x40')]=_0x596c86;return _0x4552ba;})['then'](respondWithFilteredResult(_0x131181,_0x313be6))[_0x3b9e('0x41')](handleError(_0x131181,null));};exports[_0x3b9e('0x42')]=function(_0xcd8ca7,_0x2a93ef){var _0x3ca523={'raw':!![],'where':{'id':_0xcd8ca7[_0x3b9e('0x43')]['id']}},_0x2a33d6={};_0x2a33d6[_0x3b9e('0x2d')]=_[_0x3b9e('0x44')](db[_0x3b9e('0x28')][_0x3b9e('0x29')]);_0x2a33d6[_0x3b9e('0x2f')]=_[_0x3b9e('0x44')](_0xcd8ca7[_0x3b9e('0x2f')]);_0x2a33d6[_0x3b9e('0x30')]=_['intersection'](_0x2a33d6[_0x3b9e('0x2d')],_0x2a33d6[_0x3b9e('0x2f')]);_0x3ca523[_0x3b9e('0x31')]=_['intersection'](_0x2a33d6[_0x3b9e('0x2d')],qs[_0x3b9e('0x32')](_0xcd8ca7[_0x3b9e('0x2f')][_0x3b9e('0x32')]));_0x3ca523[_0x3b9e('0x31')]=_0x3ca523['attributes'][_0x3b9e('0x33')]?_0x3ca523[_0x3b9e('0x31')]:_0x2a33d6[_0x3b9e('0x2d')];if(_0xcd8ca7['query']['includeAll']){_0x3ca523[_0x3b9e('0x3f')]=[{'all':!![]}];}_0x3ca523=_[_0x3b9e('0x3a')]({},_0x3ca523,_0xcd8ca7[_0x3b9e('0x3c')]);return db[_0x3b9e('0x28')]['find'](_0x3ca523)[_0x3b9e('0x22')](handleEntityNotFound(_0x2a93ef,null))[_0x3b9e('0x22')](respondWithResult(_0x2a93ef,null))[_0x3b9e('0x41')](handleError(_0x2a93ef,null));};exports[_0x3b9e('0x45')]=function(_0x2fd720,_0x10a52d){return db[_0x3b9e('0x28')][_0x3b9e('0x45')](_0x2fd720[_0x3b9e('0x46')],{})[_0x3b9e('0x22')](respondWithResult(_0x10a52d,0xc9))['catch'](handleError(_0x10a52d,null));};exports['update']=function(_0x2159c1,_0x5f1920){if(_0x2159c1[_0x3b9e('0x46')]['id']){delete _0x2159c1['body']['id'];}return db[_0x3b9e('0x28')]['find']({'where':{'id':_0x2159c1[_0x3b9e('0x43')]['id']}})[_0x3b9e('0x22')](handleEntityNotFound(_0x5f1920,null))[_0x3b9e('0x22')](saveUpdates(_0x2159c1['body'],null))['then'](respondWithResult(_0x5f1920,null))['catch'](handleError(_0x5f1920,null));};exports[_0x3b9e('0x23')]=function(_0x377b45,_0x582d2){return db[_0x3b9e('0x28')]['find']({'where':{'id':_0x377b45[_0x3b9e('0x43')]['id']}})[_0x3b9e('0x22')](handleEntityNotFound(_0x582d2,null))[_0x3b9e('0x22')](removeEntity(_0x582d2,null))[_0x3b9e('0x41')](handleError(_0x582d2,null));}; \ No newline at end of file +var _0x16a7=['filter','merge','options','where','count','include','rows','catch','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','status','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','DeskField','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x16a7,0xa5));var _0x716a=function(_0x167044,_0x2832d8){_0x167044=_0x167044-0x0;var _0x1c17bc=_0x16a7[_0x167044];return _0x1c17bc;};'use strict';var emlformat=require(_0x716a('0x0'));var rimraf=require(_0x716a('0x1'));var zipdir=require(_0x716a('0x2'));var jsonpatch=require(_0x716a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x716a('0x4'));var Mustache=require(_0x716a('0x5'));var util=require('util');var path=require(_0x716a('0x6'));var sox=require(_0x716a('0x7'));var csv=require(_0x716a('0x8'));var ejs=require(_0x716a('0x9'));var fs=require('fs');var fs_extra=require(_0x716a('0xa'));var _=require('lodash');var squel=require(_0x716a('0xb'));var crypto=require(_0x716a('0xc'));var jsforce=require(_0x716a('0xd'));var deskjs=require(_0x716a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x716a('0xf'));var Papa=require(_0x716a('0x10'));var Redis=require(_0x716a('0x11'));var authService=require(_0x716a('0x12'));var qs=require(_0x716a('0x13'));var as=require(_0x716a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x716a('0x15'))(_0x716a('0x16'));var utils=require(_0x716a('0x17'));var config=require(_0x716a('0x18'));var licenseUtil=require(_0x716a('0x19'));var db=require(_0x716a('0x1a'))['db'];function respondWithStatusCode(_0x341c18,_0x59ebf1){_0x59ebf1=_0x59ebf1||0xcc;return function(_0xdab1a5){if(_0xdab1a5){return _0x341c18[_0x716a('0x1b')](_0x59ebf1);}return _0x341c18['status'](_0x59ebf1)[_0x716a('0x1c')]();};}function respondWithResult(_0x5e75c8,_0x3f629f){_0x3f629f=_0x3f629f||0xc8;return function(_0x153da9){if(_0x153da9){return _0x5e75c8['status'](_0x3f629f)[_0x716a('0x1d')](_0x153da9);}};}function respondWithFilteredResult(_0x3096fe,_0x3a9793){return function(_0x34860f){if(_0x34860f){var _0x2f31b2=typeof _0x3a9793[_0x716a('0x1e')]===_0x716a('0x1f')&&typeof _0x3a9793['limit']===_0x716a('0x1f');var _0x2ad622=_0x34860f['count'];var _0x3776d3=_0x2f31b2?0x0:_0x3a9793['offset'];var _0x3fb152=_0x2f31b2?_0x34860f['count']:_0x3a9793[_0x716a('0x1e')]+_0x3a9793[_0x716a('0x20')];var _0x58c183;if(_0x3fb152>=_0x2ad622){_0x3fb152=_0x2ad622;_0x58c183=0xc8;}else{_0x58c183=0xce;}_0x3096fe[_0x716a('0x21')](_0x58c183);return _0x3096fe['set'](_0x716a('0x22'),_0x3776d3+'-'+_0x3fb152+'/'+_0x2ad622)[_0x716a('0x1d')](_0x34860f);}return null;};}function patchUpdates(_0x43fcd7){return function(_0x32e549){try{jsonpatch[_0x716a('0x23')](_0x32e549,_0x43fcd7,!![]);}catch(_0x1e1e0e){return BPromise[_0x716a('0x24')](_0x1e1e0e);}return _0x32e549[_0x716a('0x25')]();};}function saveUpdates(_0x309779,_0x31219d){return function(_0x427265){if(_0x427265){return _0x427265[_0x716a('0x26')](_0x309779)[_0x716a('0x27')](function(_0x2b878d){return _0x2b878d;});}return null;};}function removeEntity(_0x44093c,_0x3f8160){return function(_0x45ed14){if(_0x45ed14){return _0x45ed14[_0x716a('0x28')]()[_0x716a('0x27')](function(){_0x44093c[_0x716a('0x21')](0xcc)[_0x716a('0x1c')]();});}};}function handleEntityNotFound(_0x3217e4,_0x2e4adb){return function(_0x2c5892){if(!_0x2c5892){_0x3217e4[_0x716a('0x1b')](0x194);}return _0x2c5892;};}function handleError(_0x584549,_0x1d5957){_0x1d5957=_0x1d5957||0x1f4;return function(_0x409564){logger[_0x716a('0x29')](_0x409564[_0x716a('0x2a')]);if(_0x409564[_0x716a('0x2b')]){delete _0x409564[_0x716a('0x2b')];}_0x584549[_0x716a('0x21')](_0x1d5957)['send'](_0x409564);};}exports[_0x716a('0x2c')]=function(_0x3b3406,_0x2302dc){var _0xb06d2={},_0x34462e={},_0x56ebb4={'count':0x0,'rows':[]};var _0x3b4051=_[_0x716a('0x2d')](db[_0x716a('0x2e')][_0x716a('0x2f')],function(_0x1c947f){return{'name':_0x1c947f[_0x716a('0x30')],'type':_0x1c947f[_0x716a('0x31')][_0x716a('0x32')]};});_0x34462e[_0x716a('0x33')]=_[_0x716a('0x2d')](_0x3b4051,'name');_0x34462e[_0x716a('0x34')]=_['keys'](_0x3b3406[_0x716a('0x34')]);_0x34462e['filters']=_[_0x716a('0x35')](_0x34462e[_0x716a('0x33')],_0x34462e[_0x716a('0x34')]);_0xb06d2['attributes']=_['intersection'](_0x34462e[_0x716a('0x33')],qs[_0x716a('0x36')](_0x3b3406[_0x716a('0x34')][_0x716a('0x36')]));_0xb06d2['attributes']=_0xb06d2[_0x716a('0x37')][_0x716a('0x38')]?_0xb06d2[_0x716a('0x37')]:_0x34462e[_0x716a('0x33')];if(!_0x3b3406[_0x716a('0x34')][_0x716a('0x39')](_0x716a('0x3a'))){_0xb06d2[_0x716a('0x20')]=qs[_0x716a('0x20')](_0x3b3406[_0x716a('0x34')][_0x716a('0x20')]);_0xb06d2[_0x716a('0x1e')]=qs[_0x716a('0x1e')](_0x3b3406['query'][_0x716a('0x1e')]);}_0xb06d2[_0x716a('0x3b')]=qs[_0x716a('0x3c')](_0x3b3406[_0x716a('0x34')][_0x716a('0x3c')]);_0xb06d2['where']=qs[_0x716a('0x3d')](_[_0x716a('0x3e')](_0x3b3406['query'],_0x34462e['filters']),_0x3b4051);if(_0x3b3406[_0x716a('0x34')][_0x716a('0x3f')]){_0xb06d2['where']=_[_0x716a('0x40')](_0xb06d2['where'],{'$or':_[_0x716a('0x2d')](_0x3b4051,function(_0x4a55f3){if(_0x4a55f3[_0x716a('0x31')]!=='VIRTUAL'){var _0x4c5472={};_0x4c5472[_0x4a55f3['name']]={'$like':'%'+_0x3b3406[_0x716a('0x34')][_0x716a('0x3f')]+'%'};return _0x4c5472;}})});}_0xb06d2=_[_0x716a('0x40')]({},_0xb06d2,_0x3b3406[_0x716a('0x41')]);var _0x5265a8={'where':_0xb06d2[_0x716a('0x42')]};return db[_0x716a('0x2e')]['count'](_0x5265a8)[_0x716a('0x27')](function(_0x50bc02){_0x56ebb4[_0x716a('0x43')]=_0x50bc02;if(_0x3b3406[_0x716a('0x34')]['includeAll']){_0xb06d2[_0x716a('0x44')]=[{'all':!![]}];}return db[_0x716a('0x2e')]['findAll'](_0xb06d2);})['then'](function(_0xa32b5a){_0x56ebb4[_0x716a('0x45')]=_0xa32b5a;return _0x56ebb4;})[_0x716a('0x27')](respondWithFilteredResult(_0x2302dc,_0xb06d2))[_0x716a('0x46')](handleError(_0x2302dc,null));};exports['show']=function(_0x261334,_0x2d2ef9){var _0x196a99={'raw':!![],'where':{'id':_0x261334[_0x716a('0x47')]['id']}},_0x4dcce9={};_0x4dcce9['model']=_[_0x716a('0x48')](db['DeskField'][_0x716a('0x2f')]);_0x4dcce9[_0x716a('0x34')]=_[_0x716a('0x48')](_0x261334['query']);_0x4dcce9[_0x716a('0x3d')]=_['intersection'](_0x4dcce9['model'],_0x4dcce9[_0x716a('0x34')]);_0x196a99[_0x716a('0x37')]=_[_0x716a('0x35')](_0x4dcce9[_0x716a('0x33')],qs['fields'](_0x261334[_0x716a('0x34')]['fields']));_0x196a99[_0x716a('0x37')]=_0x196a99['attributes'][_0x716a('0x38')]?_0x196a99[_0x716a('0x37')]:_0x4dcce9[_0x716a('0x33')];if(_0x261334[_0x716a('0x34')]['includeAll']){_0x196a99[_0x716a('0x44')]=[{'all':!![]}];}_0x196a99=_[_0x716a('0x40')]({},_0x196a99,_0x261334[_0x716a('0x41')]);return db[_0x716a('0x2e')][_0x716a('0x49')](_0x196a99)[_0x716a('0x27')](handleEntityNotFound(_0x2d2ef9,null))[_0x716a('0x27')](respondWithResult(_0x2d2ef9,null))['catch'](handleError(_0x2d2ef9,null));};exports[_0x716a('0x4a')]=function(_0xb8edbe,_0x5c81ca){return db['DeskField'][_0x716a('0x4a')](_0xb8edbe[_0x716a('0x4b')],{})['then'](respondWithResult(_0x5c81ca,0xc9))[_0x716a('0x46')](handleError(_0x5c81ca,null));};exports['update']=function(_0x3360e2,_0x5c1e25){if(_0x3360e2[_0x716a('0x4b')]['id']){delete _0x3360e2['body']['id'];}return db['DeskField'][_0x716a('0x49')]({'where':{'id':_0x3360e2['params']['id']}})['then'](handleEntityNotFound(_0x5c1e25,null))[_0x716a('0x27')](saveUpdates(_0x3360e2[_0x716a('0x4b')],null))[_0x716a('0x27')](respondWithResult(_0x5c1e25,null))[_0x716a('0x46')](handleError(_0x5c1e25,null));};exports[_0x716a('0x28')]=function(_0x2023f9,_0x56b27a){return db[_0x716a('0x2e')][_0x716a('0x49')]({'where':{'id':_0x2023f9[_0x716a('0x47')]['id']}})[_0x716a('0x27')](handleEntityNotFound(_0x56b27a,null))[_0x716a('0x27')](removeEntity(_0x56b27a,null))[_0x716a('0x46')](handleError(_0x56b27a,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index d20186f..a5f197c 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 _0xcfdf=['path','rimraf','define','int_desk_fields','desk_unique_index','idField','lodash'];(function(_0x449c2c,_0x1ee518){var _0x88e8a0=function(_0x63b244){while(--_0x63b244){_0x449c2c['push'](_0x449c2c['shift']());}};_0x88e8a0(++_0x1ee518);}(_0xcfdf,0x1e9));var _0xfcfd=function(_0x15cca8,_0x4fe600){_0x15cca8=_0x15cca8-0x0;var _0x4edc9c=_0xcfdf[_0x15cca8];return _0x4edc9c;};'use strict';var _=require(_0xfcfd('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfcfd('0x1'));var rimraf=require(_0xfcfd('0x2'));var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module['exports']=function(_0x2ec3b2,_0x47d8d7){return _0x2ec3b2[_0xfcfd('0x3')]('DeskField',attributes,{'tableName':_0xfcfd('0x4'),'paranoid':![],'indexes':[{'name':_0xfcfd('0x5'),'fields':[_0xfcfd('0x6'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0605=['util','../../config/logger','api','moment','request-promise','./intDeskField.attributes','DeskField','desk_unique_index','idField','FieldId','lodash'];(function(_0x92f772,_0x4eee07){var _0x437a18=function(_0xd41225){while(--_0xd41225){_0x92f772['push'](_0x92f772['shift']());}};_0x437a18(++_0x4eee07);}(_0x0605,0x1d8));var _0x5060=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x0605[_0x487b0c];return _0x1adbdc;};'use strict';var _=require(_0x5060('0x0'));var util=require(_0x5060('0x1'));var logger=require(_0x5060('0x2'))(_0x5060('0x3'));var moment=require(_0x5060('0x4'));var BPromise=require('bluebird');var rp=require(_0x5060('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5060('0x6'));module['exports']=function(_0x444d60,_0x41d946){return _0x444d60['define'](_0x5060('0x7'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x5060('0x8'),'fields':[_0x5060('0x9'),_0x5060('0xa')],'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 df4badc..15853fe 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 _0x4ffc=['rpc','jayson/promise','client','http','then','DeskField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','ioredis','../../config/utils'];(function(_0x40ece6,_0x4fd49a){var _0x1a3b51=function(_0x50e0ad){while(--_0x50e0ad){_0x40ece6['push'](_0x40ece6['shift']());}};_0x1a3b51(++_0x4fd49a);}(_0x4ffc,0xe6));var _0xc4ff=function(_0x14f9b1,_0x3d6eeb){_0x14f9b1=_0x14f9b1-0x0;var _0x4bd14b=_0x4ffc[_0x14f9b1];return _0x4bd14b;};'use strict';var _=require(_0xc4ff('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc4ff('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc4ff('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc4ff('0x3'));var logger=require('../../config/logger')(_0xc4ff('0x4'));var config=require('../../config/environment');var jayson=require(_0xc4ff('0x5'));var client=jayson[_0xc4ff('0x6')][_0xc4ff('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5b6e75,_0x25ef8c,_0x1b492a){return new BPromise(function(_0x559430,_0xc6db17){return client['request'](_0x5b6e75,_0x1b492a)[_0xc4ff('0x8')](function(_0x2ac869){logger['info'](_0xc4ff('0x9'),_0x25ef8c,'request\x20sent');logger[_0xc4ff('0xa')]('DeskField,\x20%s,\x20%s,\x20%s',_0x25ef8c,_0xc4ff('0xb'),JSON[_0xc4ff('0xc')](_0x2ac869));if(_0x2ac869[_0xc4ff('0xd')]){if(_0x2ac869['error'][_0xc4ff('0xe')]===0x1f4){logger[_0xc4ff('0xd')](_0xc4ff('0x9'),_0x25ef8c,_0x2ac869[_0xc4ff('0xd')][_0xc4ff('0xf')]);return _0xc6db17(_0x2ac869['error'][_0xc4ff('0xf')]);}logger[_0xc4ff('0xd')](_0xc4ff('0x9'),_0x25ef8c,_0x2ac869[_0xc4ff('0xd')][_0xc4ff('0xf')]);return _0x559430(_0x2ac869['error']['message']);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x25ef8c,'request\x20sent');_0x559430(_0x2ac869[_0xc4ff('0x10')][_0xc4ff('0xf')]);}})[_0xc4ff('0x11')](function(_0x3e65f8){logger[_0xc4ff('0xd')](_0xc4ff('0x9'),_0x25ef8c,_0x3e65f8);_0xc6db17(_0x3e65f8);});});} \ No newline at end of file +var _0x43df=['request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x2aaeac,_0x30bda5){var _0x757741=function(_0x5893d2){while(--_0x5893d2){_0x2aaeac['push'](_0x2aaeac['shift']());}};_0x757741(++_0x30bda5);}(_0x43df,0xe5));var _0xf43d=function(_0x4b487d,_0x5d066e){_0x4b487d=_0x4b487d-0x0;var _0x13a2d3=_0x43df[_0x4b487d];return _0x13a2d3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf43d('0x0'));var BPromise=require(_0xf43d('0x1'));var rs=require(_0xf43d('0x2'));var fs=require('fs');var Redis=require(_0xf43d('0x3'));var db=require(_0xf43d('0x4'))['db'];var utils=require(_0xf43d('0x5'));var logger=require(_0xf43d('0x6'))(_0xf43d('0x7'));var config=require(_0xf43d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf43d('0x9')][_0xf43d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5cf606,_0x191886,_0x2ac062){return new BPromise(function(_0x2200b4,_0x18a61a){return client[_0xf43d('0xb')](_0x5cf606,_0x2ac062)[_0xf43d('0xc')](function(_0x2d4d44){logger[_0xf43d('0xd')](_0xf43d('0xe'),_0x191886,_0xf43d('0xf'));logger[_0xf43d('0x10')](_0xf43d('0x11'),_0x191886,_0xf43d('0xf'),JSON[_0xf43d('0x12')](_0x2d4d44));if(_0x2d4d44[_0xf43d('0x13')]){if(_0x2d4d44[_0xf43d('0x13')][_0xf43d('0x14')]===0x1f4){logger[_0xf43d('0x13')]('DeskField,\x20%s,\x20%s',_0x191886,_0x2d4d44['error'][_0xf43d('0x15')]);return _0x18a61a(_0x2d4d44[_0xf43d('0x13')][_0xf43d('0x15')]);}logger[_0xf43d('0x13')](_0xf43d('0xe'),_0x191886,_0x2d4d44[_0xf43d('0x13')][_0xf43d('0x15')]);return _0x2200b4(_0x2d4d44[_0xf43d('0x13')]['message']);}else{logger[_0xf43d('0xd')]('DeskField,\x20%s,\x20%s',_0x191886,_0xf43d('0xf'));_0x2200b4(_0x2d4d44[_0xf43d('0x16')]['message']);}})[_0xf43d('0x17')](function(_0x1656ce){logger['error'](_0xf43d('0xe'),_0x191886,_0x1656ce);_0x18a61a(_0x1656ce);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 3d512be..123f00d 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 _0x1328=['./intDynamics365Account.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','update','/:id','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x1328,0x1ad));var _0x8132=function(_0x22e47a,_0x4ea10c){_0x22e47a=_0x22e47a-0x0;var _0x15a12a=_0x1328[_0x22e47a];return _0x15a12a;};'use strict';var multer=require(_0x8132('0x0'));var util=require(_0x8132('0x1'));var path=require(_0x8132('0x2'));var timeout=require('connect-timeout');var express=require(_0x8132('0x3'));var router=express[_0x8132('0x4')]();var fs_extra=require(_0x8132('0x5'));var auth=require(_0x8132('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8132('0x7'));var controller=require(_0x8132('0x8'));router[_0x8132('0x9')]('/',auth[_0x8132('0xa')](),controller[_0x8132('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8132('0xc')]);router[_0x8132('0x9')](_0x8132('0xd'),auth['isAuthenticated'](),controller[_0x8132('0xe')]);router[_0x8132('0x9')](_0x8132('0xf'),auth['isAuthenticated'](),controller[_0x8132('0x10')]);router[_0x8132('0x11')]('/',auth[_0x8132('0xa')](),controller['create']);router[_0x8132('0x11')](_0x8132('0xd'),auth[_0x8132('0xa')](),controller['addConfiguration']);router[_0x8132('0x12')]('/:id',auth[_0x8132('0xa')](),controller[_0x8132('0x13')]);router['delete'](_0x8132('0x14'),auth[_0x8132('0xa')](),controller[_0x8132('0x15')]);module[_0x8132('0x16')]=router; \ No newline at end of file +var _0x707f=['getFields','post','create','/:id/configurations','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id','show'];(function(_0x14d966,_0x31bfbd){var _0x46ef0c=function(_0x248b78){while(--_0x248b78){_0x14d966['push'](_0x14d966['shift']());}};_0x46ef0c(++_0x31bfbd);}(_0x707f,0x87));var _0xf707=function(_0x223ebb,_0x30c9e0){_0x223ebb=_0x223ebb-0x0;var _0x943971=_0x707f[_0x223ebb];return _0x943971;};'use strict';var multer=require(_0xf707('0x0'));var util=require(_0xf707('0x1'));var path=require(_0xf707('0x2'));var timeout=require(_0xf707('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf707('0x4'));var interaction=require(_0xf707('0x5'));var config=require(_0xf707('0x6'));var controller=require(_0xf707('0x7'));router[_0xf707('0x8')]('/',auth[_0xf707('0x9')](),controller['index']);router[_0xf707('0x8')](_0xf707('0xa'),auth[_0xf707('0x9')](),controller[_0xf707('0xb')]);router[_0xf707('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0xf707('0x8')]('/:id/fields',auth[_0xf707('0x9')](),controller[_0xf707('0xc')]);router[_0xf707('0xd')]('/',auth[_0xf707('0x9')](),controller[_0xf707('0xe')]);router[_0xf707('0xd')](_0xf707('0xf'),auth[_0xf707('0x9')](),controller[_0xf707('0x10')]);router[_0xf707('0x11')](_0xf707('0xa'),auth[_0xf707('0x9')](),controller['update']);router[_0xf707('0x12')]('/:id',auth[_0xf707('0x9')](),controller[_0xf707('0x13')]);module[_0xf707('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index ef9e419..28454df 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 _0xaad5=['sequelize','exports','STRING'];(function(_0x6c0123,_0x4c8d3b){var _0x5a87d2=function(_0x1ff614){while(--_0x1ff614){_0x6c0123['push'](_0x6c0123['shift']());}};_0x5a87d2(++_0x4c8d3b);}(_0xaad5,0x177));var _0x5aad=function(_0x270adf,_0x1daaa3){_0x270adf=_0x270adf-0x0;var _0x29eda9=_0xaad5[_0x270adf];return _0x29eda9;};'use strict';var Sequelize=require(_0x5aad('0x0'));module[_0x5aad('0x1')]={'name':{'type':Sequelize[_0x5aad('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5aad('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x5aad('0x2')]},'serverUrl':{'type':Sequelize[_0x5aad('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5aad('0x2')]}}; \ No newline at end of file +var _0xe34c=['STRING','sequelize','exports'];(function(_0x3d2717,_0x55a57b){var _0x3a54ef=function(_0xff28dd){while(--_0xff28dd){_0x3d2717['push'](_0x3d2717['shift']());}};_0x3a54ef(++_0x55a57b);}(_0xe34c,0x1cc));var _0xce34=function(_0x573f08,_0x12a271){_0x573f08=_0x573f08-0x0;var _0xca7986=_0xe34c[_0x573f08];return _0xca7986;};'use strict';var Sequelize=require(_0xce34('0x0'));module[_0xce34('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xce34('0x2')]},'password':{'type':Sequelize[_0xce34('0x2')]},'remoteUri':{'type':Sequelize[_0xce34('0x2')]},'tenantId':{'type':Sequelize[_0xce34('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xce34('0x2')]},'serverUrl':{'type':Sequelize[_0xce34('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index c898f52..75d248f 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 _0xbc17=['TrueOption','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','limit','count','set','Content-Range','json','apply','reject','save','destroy','then','error','stack','name','send','map','Dynamics365Account','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','length','find','create','body','update','params','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Field','Subjects','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','entitlementidname','entityimage_timestamp','escalatedon','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','username','remoteUri','tenantId','clientSecret','slice','substring','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','clientId','password','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','MetadataId','isNil','BooleanAttributeMetadata','all','DoubleAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','push','concat','test','statusCode','EntityDefinitions(',')/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'];(function(_0x354e9d,_0x297682){var _0x56711d=function(_0x6ae780){while(--_0x6ae780){_0x354e9d['push'](_0x354e9d['shift']());}};_0x56711d(++_0x297682);}(_0xbc17,0x1ab));var _0x7bc1=function(_0x123831,_0x8fe1d6){_0x123831=_0x123831-0x0;var _0x47455b=_0xbc17[_0x123831];return _0x47455b;};'use strict';var emlformat=require(_0x7bc1('0x0'));var rimraf=require(_0x7bc1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7bc1('0x2'));var rp=require(_0x7bc1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7bc1('0x4'));var util=require(_0x7bc1('0x5'));var path=require('path');var sox=require(_0x7bc1('0x6'));var csv=require('to-csv');var ejs=require(_0x7bc1('0x7'));var fs=require('fs');var fs_extra=require(_0x7bc1('0x8'));var _=require(_0x7bc1('0x9'));var squel=require(_0x7bc1('0xa'));var crypto=require(_0x7bc1('0xb'));var jsforce=require(_0x7bc1('0xc'));var deskjs=require(_0x7bc1('0xd'));var toCsv=require(_0x7bc1('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7bc1('0xf'));var authService=require(_0x7bc1('0x10'));var qs=require(_0x7bc1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7bc1('0x12'));var logger=require(_0x7bc1('0x13'))(_0x7bc1('0x14'));var utils=require(_0x7bc1('0x15'));var config=require(_0x7bc1('0x16'));var licenseUtil=require(_0x7bc1('0x17'));var db=require(_0x7bc1('0x18'))['db'];var integrations=require(_0x7bc1('0x19'));function respondWithStatusCode(_0x604f31,_0x54db30){_0x54db30=_0x54db30||0xcc;return function(_0x1297a6){if(_0x1297a6){return _0x604f31[_0x7bc1('0x1a')](_0x54db30);}return _0x604f31['status'](_0x54db30)[_0x7bc1('0x1b')]();};}function respondWithResult(_0x370c8b,_0x4bb73b){_0x4bb73b=_0x4bb73b||0xc8;return function(_0xe90437){if(_0xe90437){return _0x370c8b[_0x7bc1('0x1c')](_0x4bb73b)['json'](_0xe90437);}};}function respondWithFilteredResult(_0x10f5a9,_0x26c89e){return function(_0x1eaf32){if(_0x1eaf32){var _0x3aadaf=typeof _0x26c89e[_0x7bc1('0x1d')]==='undefined'&&typeof _0x26c89e[_0x7bc1('0x1e')]==='undefined';var _0x15b118=_0x1eaf32[_0x7bc1('0x1f')];var _0xdf994=_0x3aadaf?0x0:_0x26c89e[_0x7bc1('0x1d')];var _0x20ce32=_0x3aadaf?_0x1eaf32[_0x7bc1('0x1f')]:_0x26c89e[_0x7bc1('0x1d')]+_0x26c89e[_0x7bc1('0x1e')];var _0x4e49d0;if(_0x20ce32>=_0x15b118){_0x20ce32=_0x15b118;_0x4e49d0=0xc8;}else{_0x4e49d0=0xce;}_0x10f5a9[_0x7bc1('0x1c')](_0x4e49d0);return _0x10f5a9[_0x7bc1('0x20')](_0x7bc1('0x21'),_0xdf994+'-'+_0x20ce32+'/'+_0x15b118)[_0x7bc1('0x22')](_0x1eaf32);}return null;};}function patchUpdates(_0x1d6674){return function(_0x4a0b93){try{jsonpatch[_0x7bc1('0x23')](_0x4a0b93,_0x1d6674,!![]);}catch(_0x5b63f8){return BPromise[_0x7bc1('0x24')](_0x5b63f8);}return _0x4a0b93[_0x7bc1('0x25')]();};}function saveUpdates(_0x3136aa,_0x162efe){return function(_0x24bb15){if(_0x24bb15){return _0x24bb15['update'](_0x3136aa)['then'](function(_0xb8a427){return _0xb8a427;});}return null;};}function removeEntity(_0x306db7,_0x48b09e){return function(_0x4ef200){if(_0x4ef200){return _0x4ef200[_0x7bc1('0x26')]()[_0x7bc1('0x27')](function(){_0x306db7['status'](0xcc)[_0x7bc1('0x1b')]();});}};}function handleEntityNotFound(_0x12ec4b,_0x1e68c3){return function(_0x468d5b){if(!_0x468d5b){_0x12ec4b[_0x7bc1('0x1a')](0x194);}return _0x468d5b;};}function handleError(_0x2c8a0d,_0x25d3a9){_0x25d3a9=_0x25d3a9||0x1f4;return function(_0x35ae7a){logger[_0x7bc1('0x28')](_0x35ae7a[_0x7bc1('0x29')]);if(_0x35ae7a[_0x7bc1('0x2a')]){delete _0x35ae7a[_0x7bc1('0x2a')];}_0x2c8a0d[_0x7bc1('0x1c')](_0x25d3a9)[_0x7bc1('0x2b')](_0x35ae7a);};}exports['index']=function(_0x1927ce,_0xc2cd8b){var _0x26bf05={},_0xc4f3ab={},_0x6614c={'count':0x0,'rows':[]};var _0x101c38=_[_0x7bc1('0x2c')](db[_0x7bc1('0x2d')][_0x7bc1('0x2e')],function(_0x1352c2){return{'name':_0x1352c2[_0x7bc1('0x2f')],'type':_0x1352c2[_0x7bc1('0x30')]['key']};});_0xc4f3ab[_0x7bc1('0x31')]=_[_0x7bc1('0x2c')](_0x101c38,_0x7bc1('0x2a'));_0xc4f3ab[_0x7bc1('0x32')]=_[_0x7bc1('0x33')](_0x1927ce[_0x7bc1('0x32')]);_0xc4f3ab[_0x7bc1('0x34')]=_['intersection'](_0xc4f3ab[_0x7bc1('0x31')],_0xc4f3ab[_0x7bc1('0x32')]);_0x26bf05[_0x7bc1('0x35')]=_[_0x7bc1('0x36')](_0xc4f3ab['model'],qs[_0x7bc1('0x37')](_0x1927ce[_0x7bc1('0x32')]['fields']));_0x26bf05[_0x7bc1('0x35')]=_0x26bf05['attributes']['length']?_0x26bf05[_0x7bc1('0x35')]:_0xc4f3ab[_0x7bc1('0x31')];if(!_0x1927ce[_0x7bc1('0x32')][_0x7bc1('0x38')](_0x7bc1('0x39'))){_0x26bf05['limit']=qs[_0x7bc1('0x1e')](_0x1927ce[_0x7bc1('0x32')]['limit']);_0x26bf05['offset']=qs[_0x7bc1('0x1d')](_0x1927ce['query'][_0x7bc1('0x1d')]);}_0x26bf05[_0x7bc1('0x3a')]=qs[_0x7bc1('0x3b')](_0x1927ce[_0x7bc1('0x32')][_0x7bc1('0x3b')]);_0x26bf05[_0x7bc1('0x3c')]=qs[_0x7bc1('0x34')](_[_0x7bc1('0x3d')](_0x1927ce[_0x7bc1('0x32')],_0xc4f3ab[_0x7bc1('0x34')]),_0x101c38);if(_0x1927ce[_0x7bc1('0x32')][_0x7bc1('0x3e')]){_0x26bf05[_0x7bc1('0x3c')]=_[_0x7bc1('0x3f')](_0x26bf05[_0x7bc1('0x3c')],{'$or':_[_0x7bc1('0x2c')](_0x101c38,function(_0x10fbc6){if(_0x10fbc6[_0x7bc1('0x30')]!==_0x7bc1('0x40')){var _0x5dbe0f={};_0x5dbe0f[_0x10fbc6[_0x7bc1('0x2a')]]={'$like':'%'+_0x1927ce[_0x7bc1('0x32')][_0x7bc1('0x3e')]+'%'};return _0x5dbe0f;}})});}_0x26bf05=_['merge']({},_0x26bf05,_0x1927ce['options']);var _0x1ece5f={'where':_0x26bf05['where']};return db['Dynamics365Account']['count'](_0x1ece5f)['then'](function(_0x13026c){_0x6614c[_0x7bc1('0x1f')]=_0x13026c;if(_0x1927ce[_0x7bc1('0x32')][_0x7bc1('0x41')]){_0x26bf05[_0x7bc1('0x42')]=[{'all':!![]}];}return db[_0x7bc1('0x2d')][_0x7bc1('0x43')](_0x26bf05);})['then'](function(_0x8aaf8c){_0x6614c[_0x7bc1('0x44')]=_0x8aaf8c;return _0x6614c;})[_0x7bc1('0x27')](respondWithFilteredResult(_0xc2cd8b,_0x26bf05))[_0x7bc1('0x45')](handleError(_0xc2cd8b,null));};exports[_0x7bc1('0x46')]=function(_0x14aff2,_0xc75850){var _0x2f1e76={'raw':![],'where':{'id':_0x14aff2['params']['id']}},_0x45d694={};_0x45d694[_0x7bc1('0x31')]=_[_0x7bc1('0x33')](db[_0x7bc1('0x2d')][_0x7bc1('0x2e')]);_0x45d694[_0x7bc1('0x32')]=_[_0x7bc1('0x33')](_0x14aff2[_0x7bc1('0x32')]);_0x45d694['filters']=_[_0x7bc1('0x36')](_0x45d694['model'],_0x45d694[_0x7bc1('0x32')]);_0x2f1e76['attributes']=_[_0x7bc1('0x36')](_0x45d694[_0x7bc1('0x31')],qs[_0x7bc1('0x37')](_0x14aff2[_0x7bc1('0x32')][_0x7bc1('0x37')]));_0x2f1e76['attributes']=_0x2f1e76[_0x7bc1('0x35')][_0x7bc1('0x47')]?_0x2f1e76[_0x7bc1('0x35')]:_0x45d694[_0x7bc1('0x31')];if(_0x14aff2[_0x7bc1('0x32')]['includeAll']){_0x2f1e76[_0x7bc1('0x42')]=[{'all':!![]}];}_0x2f1e76=_[_0x7bc1('0x3f')]({},_0x2f1e76,_0x14aff2['options']);return db[_0x7bc1('0x2d')][_0x7bc1('0x48')](_0x2f1e76)[_0x7bc1('0x27')](handleEntityNotFound(_0xc75850,null))['then'](respondWithResult(_0xc75850,null))[_0x7bc1('0x45')](handleError(_0xc75850,null));};exports[_0x7bc1('0x49')]=function(_0x4c34e7,_0x3464b2){return db['Dynamics365Account']['create'](_0x4c34e7[_0x7bc1('0x4a')],{})[_0x7bc1('0x27')](respondWithResult(_0x3464b2,0xc9))[_0x7bc1('0x45')](handleError(_0x3464b2,null));};exports[_0x7bc1('0x4b')]=function(_0x42680f,_0x4dd6fb){if(_0x42680f[_0x7bc1('0x4a')]['id']){delete _0x42680f[_0x7bc1('0x4a')]['id'];}return db[_0x7bc1('0x2d')][_0x7bc1('0x48')]({'where':{'id':_0x42680f[_0x7bc1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4dd6fb,null))[_0x7bc1('0x27')](saveUpdates(_0x42680f['body'],null))[_0x7bc1('0x27')](respondWithResult(_0x4dd6fb,null))[_0x7bc1('0x45')](handleError(_0x4dd6fb,null));};exports[_0x7bc1('0x26')]=function(_0x40508e,_0x4f597f){return db[_0x7bc1('0x2d')][_0x7bc1('0x48')]({'where':{'id':_0x40508e[_0x7bc1('0x4c')]['id']}})[_0x7bc1('0x27')](handleEntityNotFound(_0x4f597f,null))[_0x7bc1('0x27')](removeEntity(_0x4f597f,null))['catch'](handleError(_0x4f597f,null));};exports[_0x7bc1('0x4d')]=function(_0x1808c9,_0x3c29fa,_0x5370b0){var _0x5c8006={};var _0x5ed489={};var _0xa228;var _0x2bb944;return db[_0x7bc1('0x2d')][_0x7bc1('0x4e')]({'where':{'id':_0x1808c9[_0x7bc1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3c29fa,null))['then'](function(_0x389a27){if(_0x389a27){_0xa228=_0x389a27;_0x5ed489['model']=_[_0x7bc1('0x33')](db[_0x7bc1('0x4f')][_0x7bc1('0x2e')]);_0x5ed489[_0x7bc1('0x32')]=_[_0x7bc1('0x33')](_0x1808c9[_0x7bc1('0x32')]);_0x5ed489[_0x7bc1('0x34')]=_[_0x7bc1('0x36')](_0x5ed489[_0x7bc1('0x31')],_0x5ed489[_0x7bc1('0x32')]);_0x5c8006[_0x7bc1('0x35')]=_['intersection'](_0x5ed489[_0x7bc1('0x31')],qs[_0x7bc1('0x37')](_0x1808c9[_0x7bc1('0x32')][_0x7bc1('0x37')]));_0x5c8006[_0x7bc1('0x35')]=_0x5c8006[_0x7bc1('0x35')][_0x7bc1('0x47')]?_0x5c8006[_0x7bc1('0x35')]:_0x5ed489['model'];_0x5c8006[_0x7bc1('0x3a')]=qs[_0x7bc1('0x3b')](_0x1808c9[_0x7bc1('0x32')]['sort']);_0x5c8006['where']=qs[_0x7bc1('0x34')](_[_0x7bc1('0x3d')](_0x1808c9[_0x7bc1('0x32')],_0x5ed489['filters']));if(_0x1808c9[_0x7bc1('0x32')][_0x7bc1('0x3e')]){_0x5c8006['where']=_[_0x7bc1('0x3f')](_0x5c8006[_0x7bc1('0x3c')],{'$or':_['map'](_0x5c8006[_0x7bc1('0x35')],function(_0x3de640){var _0x527b89={};_0x527b89[_0x3de640]={'$like':'%'+_0x1808c9[_0x7bc1('0x32')]['filter']+'%'};return _0x527b89;})});}_0x5c8006=_[_0x7bc1('0x3f')]({},_0x5c8006,_0x1808c9['options']);return _0xa228['getConfigurations'](_0x5c8006);}})['then'](function(_0xb4a763){if(_0xb4a763){_0x2bb944=_0xb4a763[_0x7bc1('0x47')];if(!_0x1808c9[_0x7bc1('0x32')][_0x7bc1('0x38')]('nolimit')){_0x5c8006[_0x7bc1('0x1e')]=qs[_0x7bc1('0x1e')](_0x1808c9['query'][_0x7bc1('0x1e')]);_0x5c8006[_0x7bc1('0x1d')]=qs[_0x7bc1('0x1d')](_0x1808c9[_0x7bc1('0x32')][_0x7bc1('0x1d')]);}return _0xa228[_0x7bc1('0x4d')](_0x5c8006);}})[_0x7bc1('0x27')](function(_0x4338cb){if(_0x4338cb){return _0x4338cb?{'count':_0x2bb944,'rows':_0x4338cb}:null;}})['then'](respondWithResult(_0x3c29fa,null))[_0x7bc1('0x45')](handleError(_0x3c29fa,null));};exports[_0x7bc1('0x50')]=function(_0x502456,_0x14fb76,_0x2cd588){if(_0x502456[_0x7bc1('0x4a')]['id']){delete _0x502456['body']['id'];}return db['Dynamics365Account'][_0x7bc1('0x4e')]({'where':{'id':_0x502456[_0x7bc1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x14fb76,null))[_0x7bc1('0x27')](function(_0x418f06){if(_0x418f06){_0x502456[_0x7bc1('0x4a')][_0x7bc1('0x51')]=_0x418f06['id'];_0x502456['body']['Subjects']=integrations[_0x7bc1('0x52')](_0x502456[_0x7bc1('0x4a')]['channel'],_0x502456[_0x7bc1('0x4a')]['type']);_0x502456[_0x7bc1('0x4a')][_0x7bc1('0x53')]=integrations[_0x7bc1('0x54')](_0x502456[_0x7bc1('0x4a')][_0x7bc1('0x55')],_0x502456['body']['type']);return db[_0x7bc1('0x4f')][_0x7bc1('0x49')](_0x502456[_0x7bc1('0x4a')],{'include':[{'model':db[_0x7bc1('0x56')],'as':_0x7bc1('0x57')},{'model':db['Dynamics365Field'],'as':_0x7bc1('0x53')}]});}return null;})[_0x7bc1('0x27')](respondWithResult(_0x14fb76,null))[_0x7bc1('0x45')](handleError(_0x14fb76,null));};exports[_0x7bc1('0x58')]=function(_0x1a8c34,_0x45ceff,_0x520d05){var _0xee7d25=_0x1a8c34['query'][_0x7bc1('0x59')];var _0x580fb7=_0xee7d25===_0x7bc1('0x5a')?_0x7bc1('0x5b'):_0x7bc1('0x5c');var _0x387716='';var _0x587882='';var _0x1ec9c8='';var _0x42dacf='';var _0x31d837='';var _0x193e12='';var _0x447170='';var _0x257471='';var _0x1e0e19=[_0x7bc1('0x5d'),_0x7bc1('0x5e'),_0x7bc1('0x5f'),_0x7bc1('0x60'),_0x7bc1('0x61'),_0x7bc1('0x62'),'phonenumber',_0x7bc1('0x63'),_0x7bc1('0x64'),_0x7bc1('0x65')];var _0x12475a=[_0x7bc1('0x66'),_0x7bc1('0x67'),_0x7bc1('0x68'),_0x7bc1('0x69'),_0x7bc1('0x6a'),'contactidyominame',_0x7bc1('0x6b'),_0x7bc1('0x6c'),_0x7bc1('0x6d'),_0x7bc1('0x6e'),'createdbyname',_0x7bc1('0x6f'),_0x7bc1('0x70'),_0x7bc1('0x71'),_0x7bc1('0x72'),_0x7bc1('0x73'),'customeridtype',_0x7bc1('0x74'),'emailaddress',_0x7bc1('0x75'),_0x7bc1('0x76'),'entityimage_url',_0x7bc1('0x77'),'exchangerate',_0x7bc1('0x78'),'followupby',_0x7bc1('0x79'),_0x7bc1('0x7a'),_0x7bc1('0x7b'),'lastonholdtime','masteridname',_0x7bc1('0x7c'),_0x7bc1('0x7d'),_0x7bc1('0x7e'),_0x7bc1('0x7f'),_0x7bc1('0x80'),_0x7bc1('0x81'),'modifiedonbehalfbyyominame','msdyn_incidenttypename',_0x7bc1('0x82'),_0x7bc1('0x83'),_0x7bc1('0x84'),_0x7bc1('0x85'),_0x7bc1('0x86'),'owneridtype',_0x7bc1('0x87'),_0x7bc1('0x88'),_0x7bc1('0x89'),_0x7bc1('0x8a'),_0x7bc1('0x8b'),_0x7bc1('0x8c'),_0x7bc1('0x8d'),_0x7bc1('0x8e'),_0x7bc1('0x8f'),_0x7bc1('0x90'),_0x7bc1('0x91'),_0x7bc1('0x92'),'sentimentvalue',_0x7bc1('0x93'),_0x7bc1('0x94'),'socialprofileidname','statecode',_0x7bc1('0x95'),'subjectidname',_0x7bc1('0x96'),_0x7bc1('0x97'),_0x7bc1('0x98'),_0x7bc1('0x99'),_0x7bc1('0x9a'),_0x7bc1('0x9b')];var _0x22b51b=_0x1e0e19['concat'](_0x12475a);return db[_0x7bc1('0x2d')]['findOne']({'where':{'id':_0x1a8c34[_0x7bc1('0x4c')]['id']},'attributes':['id',_0x7bc1('0x9c'),'password',_0x7bc1('0x9d'),_0x7bc1('0x9e'),'clientId',_0x7bc1('0x9f')]})[_0x7bc1('0x27')](handleEntityNotFound(_0x45ceff,null))[_0x7bc1('0x27')](function(_0x534d15){if(_0x534d15){_0x257471=_0x534d15['remoteUri'];var _0x131f33=_0x257471[_0x7bc1('0xa0')](-0x1);if(_0x131f33==='/'){_0x257471=_0x257471[_0x7bc1('0xa1')](0x0,_0x257471['lastIndexOf'](_0x131f33));}_0x447170=util['format'](_0x7bc1('0xa2'),_0x257471);var _0x29a158={'method':_0x7bc1('0xa3'),'uri':_0x7bc1('0xa4')+_0x534d15[_0x7bc1('0x9e')]+'/oauth2/token','form':{'client_id':_0x534d15[_0x7bc1('0xa5')],'resource':_0x257471,'username':_0x534d15[_0x7bc1('0x9c')],'password':_0x534d15[_0x7bc1('0xa6')],'grant_type':'password','client_secret':_0x534d15[_0x7bc1('0x9f')]},'json':!![]};return rp(_0x29a158);}})[_0x7bc1('0x27')](function(_0x211da6){_0x193e12=_0x211da6[_0x7bc1('0xa7')];var _0x285bc1={'method':_0x7bc1('0xa8'),'uri':encodeURI(_0x447170+_0x7bc1('0xa9')+_0x580fb7+'\x27'),'headers':{'Authorization':_0x7bc1('0xaa')+_0x193e12,'If-None-Match':null,'OData-Version':_0x7bc1('0xab')},'json':!![]};return rp(_0x285bc1);})['then'](function(_0x2bd1f9){var _0x4ab290=_0x2bd1f9[_0x7bc1('0xac')][0x0];var _0x5d27b1=_0x4ab290['MetadataId'];var _0x2895d2={'method':_0x7bc1('0xa8'),'uri':_0x447170+'EntityDefinitions('+_0x5d27b1+_0x7bc1('0xad'),'headers':{'Authorization':_0x7bc1('0xaa')+_0x193e12,'If-None-Match':null,'OData-Version':_0x7bc1('0xab')},'json':!![]};return rp(_0x2895d2);})[_0x7bc1('0x27')](function(_0x34a332){_0x387716=_0x34a332;_0x587882=_0x387716[_0x7bc1('0xae')];_0x587882=_[_0x7bc1('0xaf')](_0x587882,function(_0xdae693){return!_0x22b51b[_0x7bc1('0xb0')](_0xdae693[_0x7bc1('0xb1')]);});var _0x2f44b4=[];var _0x287a38=[];_0x587882[_0x7bc1('0xb2')](function(_0xefc6d7){if(_0xefc6d7[_0x7bc1('0xb3')]){var _0x4cae1f=_0xefc6d7[_0x7bc1('0xb3')][_0x7bc1('0xa1')](_0xefc6d7['@odata.type']['lastIndexOf']('.')+0x1);if(_0x4cae1f===_0x7bc1('0xb4')){_0x2f44b4['push'](getSelectList(_0x447170,_0xee7d25,_0x287a38,_0x387716['MetadataId'],_0xefc6d7[_0x7bc1('0xb5')],_0x193e12));}}});return Promise['all'](_0x2f44b4);})['then'](function(_0x5a2b38){_0x1ec9c8=_0x5a2b38[0x0];var _0x458590=[];var _0x24a067=[];_0x587882['forEach'](function(_0x2d2dcc){if(!_[_0x7bc1('0xb6')](_0x2d2dcc[_0x7bc1('0xb3')])){var _0x215f95=_0x2d2dcc[_0x7bc1('0xb3')][_0x7bc1('0xa1')](_0x2d2dcc[_0x7bc1('0xb3')]['lastIndexOf']('.')+0x1);if(_0x215f95===_0x7bc1('0xb7')){_0x458590['push'](getBooleanList(_0x447170,_0xee7d25,_0x24a067,_0x387716['MetadataId'],_0x2d2dcc[_0x7bc1('0xb5')],_0x193e12));}}});return Promise[_0x7bc1('0xb8')](_0x458590);})['then'](function(_0x8b54ab){_0x42dacf=_0x8b54ab[0x0];var _0x533681=[];var _0x2a34eb=[];_0x587882[_0x7bc1('0xb2')](function(_0x3b6d93){if(_0x3b6d93['@odata.type']){var _0x250926=_0x3b6d93[_0x7bc1('0xb3')][_0x7bc1('0xa1')](_0x3b6d93['@odata.type']['lastIndexOf']('.')+0x1);if(_0x250926==='StringAttributeMetadata'||_0x250926===_0x7bc1('0xb9')||_0x250926==='BigIntAttributeMetadata'||_0x250926==='IntegerAttributeMetadata'||_0x250926===_0x7bc1('0xba')||_0x250926===_0x7bc1('0xbb')||_0x250926===_0x7bc1('0xbc')||_0x250926===_0x7bc1('0xbd')||_0x250926===_0x7bc1('0xbe')||_0x250926===_0x7bc1('0xbf')){_0x533681[_0x7bc1('0xc0')](getInputList(_0x447170,_0xee7d25,_0x250926,_0x2a34eb,_0x387716[_0x7bc1('0xb5')],_0x3b6d93[_0x7bc1('0xb5')],_0x193e12));}}});return Promise[_0x7bc1('0xb8')](_0x533681);})[_0x7bc1('0x27')](function(_0x9bc85f){_0x31d837=_0x9bc85f[0x0];var _0x1a230b=_0x1ec9c8[_0x7bc1('0xc1')](_0x42dacf)['concat'](_0x31d837);var _0x3689bc={'count':_0x1a230b[_0x7bc1('0x47')],'rows':_0x1a230b};return _0x3689bc;})['then'](respondWithResult(_0x45ceff,null))['catch'](function(_0x2aefd0){var _0x4cd654=_0x1a8c34[_0x7bc1('0x32')][_0x7bc1('0xc2')]?0x1f4:_0x2aefd0['statusCode']||0x1f4;logger[_0x7bc1('0x28')](_0x2aefd0['stack']);delete _0x2aefd0[_0x7bc1('0x2a')];if(_0x4cd654===0x191){_0x4cd654=0x190;}_0x45ceff[_0x7bc1('0x1c')](_0x4cd654)['send'](_0x1a8c34['query'][_0x7bc1('0xc2')]?{'message':'Wrong\x20credentials','statusCode':_0x2aefd0[_0x7bc1('0xc3')]}:_0x2aefd0);});};function getSelectList(_0x472414,_0x2cfb03,_0x4c268e,_0x22e2b8,_0x584b9a,_0x16f198){var _0x45c964={'method':_0x7bc1('0xa8'),'uri':_0x472414+_0x7bc1('0xc4')+_0x22e2b8+_0x7bc1('0xc5')+_0x584b9a+_0x7bc1('0xc6')+_0x7bc1('0xc7'),'headers':{'Authorization':_0x7bc1('0xaa')+_0x16f198,'If-None-Match':null,'OData-Version':_0x7bc1('0xab')},'json':!![]};return rp(_0x45c964)[_0x7bc1('0x27')](function(_0xa82558){var _0x1f48de=[];var _0x4b11c8=_0xa82558['OptionSet'][_0x7bc1('0xc8')];_0x4b11c8[_0x7bc1('0xb2')](function(_0x479e11){_0x1f48de[_0x7bc1('0xc0')]({'name':_0x479e11['Label'][_0x7bc1('0xc9')][_0x7bc1('0xca')],'value':String(_0x479e11['Value'])});});var _0x17371b={'id':_0x2cfb03+'_'+_0xa82558[_0x7bc1('0xb1')],'name':_0xa82558[_0x7bc1('0xcb')]['UserLocalizedLabel'][_0x7bc1('0xca')],'custom':![],'options':_0x1f48de};_0x4c268e['push'](_0x17371b);return _0x4c268e;});}function getBooleanList(_0x46735f,_0x505eca,_0x192557,_0x42a62e,_0x23e55c,_0x598279){var _0x377856={'method':_0x7bc1('0xa8'),'uri':_0x46735f+_0x7bc1('0xc4')+_0x42a62e+_0x7bc1('0xc5')+_0x23e55c+_0x7bc1('0xcc'),'headers':{'Authorization':_0x7bc1('0xaa')+_0x598279,'If-None-Match':null,'OData-Version':_0x7bc1('0xab')},'json':!![]};return rp(_0x377856)['then'](function(_0x5730a0){var _0x58f1f8=[];_0x58f1f8[_0x7bc1('0xc0')]({'name':_0x5730a0[_0x7bc1('0xcd')][_0x7bc1('0xce')][_0x7bc1('0xca')][_0x7bc1('0xc9')][_0x7bc1('0xca')],'value':'true'},{'name':_0x5730a0[_0x7bc1('0xcd')][_0x7bc1('0xcf')][_0x7bc1('0xca')][_0x7bc1('0xc9')][_0x7bc1('0xca')],'value':_0x7bc1('0xd0')});var _0x3fb92b={'id':_0x505eca+'_'+_0x5730a0[_0x7bc1('0xb1')],'name':_0x5730a0['DisplayName']['UserLocalizedLabel'][_0x7bc1('0xca')],'custom':![],'options':_0x58f1f8};_0x192557[_0x7bc1('0xc0')](_0x3fb92b);return _0x192557;});}function getInputList(_0x4c8449,_0x48e675,_0x3c192f,_0x4fa56a,_0xc0bb50,_0x3883d4,_0x53730d){var _0x42760c={'method':'GET','uri':_0x4c8449+_0x7bc1('0xc4')+_0xc0bb50+_0x7bc1('0xc5')+_0x3883d4+_0x7bc1('0xd1')+_0x3c192f+_0x7bc1('0xd2'),'headers':{'Authorization':_0x7bc1('0xaa')+_0x53730d,'If-None-Match':null,'OData-Version':_0x7bc1('0xab')},'json':!![]};return rp(_0x42760c)[_0x7bc1('0x27')](function(_0x4ce8d4){var _0x31f722={'id':_0x48e675+'_'+_0x4ce8d4['LogicalName'],'name':_0x4ce8d4[_0x7bc1('0xcb')][_0x7bc1('0xc9')]?_0x4ce8d4[_0x7bc1('0xcb')][_0x7bc1('0xc9')][_0x7bc1('0xca')]:_0x4ce8d4[_0x7bc1('0xb1')],'custom':![],'options':[]};_0x4fa56a[_0x7bc1('0xc0')](_0x31f722);return _0x4fa56a;});} \ No newline at end of file +var _0x238f=['then','destroy','error','stack','name','send','index','map','Dynamics365Account','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','where','options','includeAll','show','params','rawAttributes','include','find','catch','create','body','getConfigurations','findOne','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','Subjects','Dynamics365Field','getFields','ticketType','incident','title','customerid','ownerid','caseorigincode','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','prioritycodename','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','subjectidname','ticketnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','remoteUri','tenantId','clientId','clientSecret','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','https://login.microsoftonline.com/','/oauth2/token','password','access_token','GET','Bearer\x20','4.0','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','LogicalName','@odata.type','PicklistAttributeMetadata','push','all','forEach','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','test','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Label','Value','DisplayName','UserLocalizedLabel','OptionSet','TrueOption','true','FalseOption',')/Microsoft.Dynamics.CRM.','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update'];(function(_0x33b31e,_0x37d7ab){var _0x39d4d9=function(_0x250a3e){while(--_0x250a3e){_0x33b31e['push'](_0x33b31e['shift']());}};_0x39d4d9(++_0x37d7ab);}(_0x238f,0xa5));var _0xf238=function(_0x3ffa96,_0x553b48){_0x3ffa96=_0x3ffa96-0x0;var _0x18534c=_0x238f[_0x3ffa96];return _0x18534c;};'use strict';var emlformat=require(_0xf238('0x0'));var rimraf=require(_0xf238('0x1'));var zipdir=require(_0xf238('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf238('0x3'));var moment=require(_0xf238('0x4'));var BPromise=require(_0xf238('0x5'));var Mustache=require(_0xf238('0x6'));var util=require(_0xf238('0x7'));var path=require(_0xf238('0x8'));var sox=require('sox');var csv=require(_0xf238('0x9'));var ejs=require(_0xf238('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf238('0xb'));var crypto=require('crypto');var jsforce=require(_0xf238('0xc'));var deskjs=require(_0xf238('0xd'));var toCsv=require(_0xf238('0x9'));var querystring=require(_0xf238('0xe'));var Papa=require('papaparse');var Redis=require(_0xf238('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf238('0x10'));var as=require(_0xf238('0x11'));var hardwareService=require(_0xf238('0x12'));var logger=require(_0xf238('0x13'))(_0xf238('0x14'));var utils=require(_0xf238('0x15'));var config=require(_0xf238('0x16'));var licenseUtil=require(_0xf238('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xf238('0x18'));function respondWithStatusCode(_0x2235d4,_0x2a1df3){_0x2a1df3=_0x2a1df3||0xcc;return function(_0x5b3de3){if(_0x5b3de3){return _0x2235d4[_0xf238('0x19')](_0x2a1df3);}return _0x2235d4[_0xf238('0x1a')](_0x2a1df3)[_0xf238('0x1b')]();};}function respondWithResult(_0xc5b447,_0x14d20c){_0x14d20c=_0x14d20c||0xc8;return function(_0x57d638){if(_0x57d638){return _0xc5b447[_0xf238('0x1a')](_0x14d20c)['json'](_0x57d638);}};}function respondWithFilteredResult(_0x5451f6,_0x26e66a){return function(_0x3b7eeb){if(_0x3b7eeb){var _0x8b3218=typeof _0x26e66a[_0xf238('0x1c')]===_0xf238('0x1d')&&typeof _0x26e66a[_0xf238('0x1e')]==='undefined';var _0xfae73d=_0x3b7eeb[_0xf238('0x1f')];var _0x42f740=_0x8b3218?0x0:_0x26e66a[_0xf238('0x1c')];var _0x4d913a=_0x8b3218?_0x3b7eeb[_0xf238('0x1f')]:_0x26e66a[_0xf238('0x1c')]+_0x26e66a[_0xf238('0x1e')];var _0x3f2c91;if(_0x4d913a>=_0xfae73d){_0x4d913a=_0xfae73d;_0x3f2c91=0xc8;}else{_0x3f2c91=0xce;}_0x5451f6[_0xf238('0x1a')](_0x3f2c91);return _0x5451f6[_0xf238('0x20')](_0xf238('0x21'),_0x42f740+'-'+_0x4d913a+'/'+_0xfae73d)[_0xf238('0x22')](_0x3b7eeb);}return null;};}function patchUpdates(_0x37ca09){return function(_0x289cca){try{jsonpatch[_0xf238('0x23')](_0x289cca,_0x37ca09,!![]);}catch(_0x46600f){return BPromise[_0xf238('0x24')](_0x46600f);}return _0x289cca[_0xf238('0x25')]();};}function saveUpdates(_0x37553d,_0x136d2d){return function(_0x222a50){if(_0x222a50){return _0x222a50[_0xf238('0x26')](_0x37553d)[_0xf238('0x27')](function(_0x2b1ed7){return _0x2b1ed7;});}return null;};}function removeEntity(_0xbb1c0c,_0xd93105){return function(_0x5c0070){if(_0x5c0070){return _0x5c0070[_0xf238('0x28')]()[_0xf238('0x27')](function(){_0xbb1c0c[_0xf238('0x1a')](0xcc)[_0xf238('0x1b')]();});}};}function handleEntityNotFound(_0xf26e92,_0x57ef55){return function(_0x1b12fd){if(!_0x1b12fd){_0xf26e92[_0xf238('0x19')](0x194);}return _0x1b12fd;};}function handleError(_0x17c8c7,_0x5c6952){_0x5c6952=_0x5c6952||0x1f4;return function(_0x98bc8d){logger[_0xf238('0x29')](_0x98bc8d[_0xf238('0x2a')]);if(_0x98bc8d[_0xf238('0x2b')]){delete _0x98bc8d[_0xf238('0x2b')];}_0x17c8c7[_0xf238('0x1a')](_0x5c6952)[_0xf238('0x2c')](_0x98bc8d);};}exports[_0xf238('0x2d')]=function(_0x414538,_0x3b3675){var _0x3738a9={},_0x5eacb8={},_0x506d22={'count':0x0,'rows':[]};var _0x5a1132=_[_0xf238('0x2e')](db[_0xf238('0x2f')]['rawAttributes'],function(_0x597a4b){return{'name':_0x597a4b['fieldName'],'type':_0x597a4b[_0xf238('0x30')][_0xf238('0x31')]};});_0x5eacb8[_0xf238('0x32')]=_[_0xf238('0x2e')](_0x5a1132,'name');_0x5eacb8[_0xf238('0x33')]=_[_0xf238('0x34')](_0x414538[_0xf238('0x33')]);_0x5eacb8[_0xf238('0x35')]=_[_0xf238('0x36')](_0x5eacb8[_0xf238('0x32')],_0x5eacb8['query']);_0x3738a9['attributes']=_[_0xf238('0x36')](_0x5eacb8[_0xf238('0x32')],qs[_0xf238('0x37')](_0x414538[_0xf238('0x33')][_0xf238('0x37')]));_0x3738a9[_0xf238('0x38')]=_0x3738a9['attributes'][_0xf238('0x39')]?_0x3738a9[_0xf238('0x38')]:_0x5eacb8['model'];if(!_0x414538[_0xf238('0x33')][_0xf238('0x3a')]('nolimit')){_0x3738a9[_0xf238('0x1e')]=qs[_0xf238('0x1e')](_0x414538[_0xf238('0x33')]['limit']);_0x3738a9[_0xf238('0x1c')]=qs[_0xf238('0x1c')](_0x414538[_0xf238('0x33')][_0xf238('0x1c')]);}_0x3738a9[_0xf238('0x3b')]=qs[_0xf238('0x3c')](_0x414538[_0xf238('0x33')][_0xf238('0x3c')]);_0x3738a9['where']=qs['filters'](_[_0xf238('0x3d')](_0x414538[_0xf238('0x33')],_0x5eacb8[_0xf238('0x35')]),_0x5a1132);if(_0x414538['query'][_0xf238('0x3e')]){_0x3738a9['where']=_[_0xf238('0x3f')](_0x3738a9[_0xf238('0x40')],{'$or':_['map'](_0x5a1132,function(_0x3420e7){if(_0x3420e7[_0xf238('0x30')]!=='VIRTUAL'){var _0x460688={};_0x460688[_0x3420e7['name']]={'$like':'%'+_0x414538['query']['filter']+'%'};return _0x460688;}})});}_0x3738a9=_['merge']({},_0x3738a9,_0x414538[_0xf238('0x41')]);var _0x35535f={'where':_0x3738a9[_0xf238('0x40')]};return db[_0xf238('0x2f')][_0xf238('0x1f')](_0x35535f)['then'](function(_0x518de0){_0x506d22['count']=_0x518de0;if(_0x414538[_0xf238('0x33')][_0xf238('0x42')]){_0x3738a9['include']=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0x3738a9);})[_0xf238('0x27')](function(_0x256d2e){_0x506d22['rows']=_0x256d2e;return _0x506d22;})[_0xf238('0x27')](respondWithFilteredResult(_0x3b3675,_0x3738a9))['catch'](handleError(_0x3b3675,null));};exports[_0xf238('0x43')]=function(_0x28c8fd,_0x5cf728){var _0x3f1fec={'raw':![],'where':{'id':_0x28c8fd[_0xf238('0x44')]['id']}},_0x13ec3b={};_0x13ec3b[_0xf238('0x32')]=_[_0xf238('0x34')](db[_0xf238('0x2f')][_0xf238('0x45')]);_0x13ec3b[_0xf238('0x33')]=_[_0xf238('0x34')](_0x28c8fd[_0xf238('0x33')]);_0x13ec3b[_0xf238('0x35')]=_[_0xf238('0x36')](_0x13ec3b[_0xf238('0x32')],_0x13ec3b[_0xf238('0x33')]);_0x3f1fec[_0xf238('0x38')]=_[_0xf238('0x36')](_0x13ec3b['model'],qs[_0xf238('0x37')](_0x28c8fd[_0xf238('0x33')][_0xf238('0x37')]));_0x3f1fec[_0xf238('0x38')]=_0x3f1fec[_0xf238('0x38')][_0xf238('0x39')]?_0x3f1fec[_0xf238('0x38')]:_0x13ec3b['model'];if(_0x28c8fd[_0xf238('0x33')]['includeAll']){_0x3f1fec[_0xf238('0x46')]=[{'all':!![]}];}_0x3f1fec=_['merge']({},_0x3f1fec,_0x28c8fd[_0xf238('0x41')]);return db[_0xf238('0x2f')][_0xf238('0x47')](_0x3f1fec)[_0xf238('0x27')](handleEntityNotFound(_0x5cf728,null))[_0xf238('0x27')](respondWithResult(_0x5cf728,null))[_0xf238('0x48')](handleError(_0x5cf728,null));};exports[_0xf238('0x49')]=function(_0x497b87,_0x6a99d5){return db[_0xf238('0x2f')][_0xf238('0x49')](_0x497b87[_0xf238('0x4a')],{})['then'](respondWithResult(_0x6a99d5,0xc9))[_0xf238('0x48')](handleError(_0x6a99d5,null));};exports[_0xf238('0x26')]=function(_0x2ee461,_0x2180bd){if(_0x2ee461[_0xf238('0x4a')]['id']){delete _0x2ee461['body']['id'];}return db[_0xf238('0x2f')][_0xf238('0x47')]({'where':{'id':_0x2ee461[_0xf238('0x44')]['id']}})[_0xf238('0x27')](handleEntityNotFound(_0x2180bd,null))[_0xf238('0x27')](saveUpdates(_0x2ee461[_0xf238('0x4a')],null))[_0xf238('0x27')](respondWithResult(_0x2180bd,null))[_0xf238('0x48')](handleError(_0x2180bd,null));};exports[_0xf238('0x28')]=function(_0x195b00,_0x5a4cf0){return db[_0xf238('0x2f')][_0xf238('0x47')]({'where':{'id':_0x195b00[_0xf238('0x44')]['id']}})['then'](handleEntityNotFound(_0x5a4cf0,null))[_0xf238('0x27')](removeEntity(_0x5a4cf0,null))[_0xf238('0x48')](handleError(_0x5a4cf0,null));};exports[_0xf238('0x4b')]=function(_0x37452c,_0x3fb56d,_0x1d9393){var _0x438c95={};var _0x941067={};var _0x290d70;var _0x112346;return db[_0xf238('0x2f')][_0xf238('0x4c')]({'where':{'id':_0x37452c[_0xf238('0x44')]['id']}})[_0xf238('0x27')](handleEntityNotFound(_0x3fb56d,null))[_0xf238('0x27')](function(_0x308375){if(_0x308375){_0x290d70=_0x308375;_0x941067['model']=_['keys'](db['Dynamics365Configuration']['rawAttributes']);_0x941067[_0xf238('0x33')]=_[_0xf238('0x34')](_0x37452c[_0xf238('0x33')]);_0x941067[_0xf238('0x35')]=_[_0xf238('0x36')](_0x941067[_0xf238('0x32')],_0x941067['query']);_0x438c95[_0xf238('0x38')]=_[_0xf238('0x36')](_0x941067['model'],qs[_0xf238('0x37')](_0x37452c[_0xf238('0x33')]['fields']));_0x438c95['attributes']=_0x438c95[_0xf238('0x38')][_0xf238('0x39')]?_0x438c95['attributes']:_0x941067['model'];_0x438c95[_0xf238('0x3b')]=qs[_0xf238('0x3c')](_0x37452c[_0xf238('0x33')][_0xf238('0x3c')]);_0x438c95[_0xf238('0x40')]=qs[_0xf238('0x35')](_[_0xf238('0x3d')](_0x37452c[_0xf238('0x33')],_0x941067['filters']));if(_0x37452c[_0xf238('0x33')]['filter']){_0x438c95[_0xf238('0x40')]=_['merge'](_0x438c95[_0xf238('0x40')],{'$or':_[_0xf238('0x2e')](_0x438c95[_0xf238('0x38')],function(_0x19fc28){var _0x327d3={};_0x327d3[_0x19fc28]={'$like':'%'+_0x37452c[_0xf238('0x33')][_0xf238('0x3e')]+'%'};return _0x327d3;})});}_0x438c95=_[_0xf238('0x3f')]({},_0x438c95,_0x37452c[_0xf238('0x41')]);return _0x290d70[_0xf238('0x4b')](_0x438c95);}})[_0xf238('0x27')](function(_0x186abc){if(_0x186abc){_0x112346=_0x186abc[_0xf238('0x39')];if(!_0x37452c['query']['hasOwnProperty'](_0xf238('0x4d'))){_0x438c95['limit']=qs['limit'](_0x37452c[_0xf238('0x33')]['limit']);_0x438c95[_0xf238('0x1c')]=qs[_0xf238('0x1c')](_0x37452c['query'][_0xf238('0x1c')]);}return _0x290d70[_0xf238('0x4b')](_0x438c95);}})[_0xf238('0x27')](function(_0x375516){if(_0x375516){return _0x375516?{'count':_0x112346,'rows':_0x375516}:null;}})['then'](respondWithResult(_0x3fb56d,null))[_0xf238('0x48')](handleError(_0x3fb56d,null));};exports[_0xf238('0x4e')]=function(_0x446ba9,_0x28c95e,_0x150f02){if(_0x446ba9[_0xf238('0x4a')]['id']){delete _0x446ba9[_0xf238('0x4a')]['id'];}return db['Dynamics365Account'][_0xf238('0x4c')]({'where':{'id':_0x446ba9[_0xf238('0x44')]['id']}})[_0xf238('0x27')](handleEntityNotFound(_0x28c95e,null))[_0xf238('0x27')](function(_0x22976f){if(_0x22976f){_0x446ba9[_0xf238('0x4a')][_0xf238('0x4f')]=_0x22976f['id'];_0x446ba9['body']['Subjects']=integrations[_0xf238('0x50')](_0x446ba9[_0xf238('0x4a')][_0xf238('0x51')],_0x446ba9['body'][_0xf238('0x30')]);_0x446ba9[_0xf238('0x4a')][_0xf238('0x52')]=integrations[_0xf238('0x53')](_0x446ba9[_0xf238('0x4a')][_0xf238('0x51')],_0x446ba9[_0xf238('0x4a')][_0xf238('0x30')]);return db['Dynamics365Configuration'][_0xf238('0x49')](_0x446ba9[_0xf238('0x4a')],{'include':[{'model':db['Dynamics365Field'],'as':_0xf238('0x54')},{'model':db[_0xf238('0x55')],'as':_0xf238('0x52')}]});}return null;})[_0xf238('0x27')](respondWithResult(_0x28c95e,null))[_0xf238('0x48')](handleError(_0x28c95e,null));};exports[_0xf238('0x56')]=function(_0x562be5,_0x228dc0,_0x36f204){var _0x2e9341=_0x562be5[_0xf238('0x33')][_0xf238('0x57')];var _0xb92df5=_0x2e9341===_0xf238('0x58')?'Incident':'PhoneCall';var _0x2f3116='';var _0x39eb37='';var _0xb3e18e='';var _0x591d09='';var _0x25b439='';var _0x582fc7='';var _0x523491='';var _0x5d71e6='';var _0x44a186=[_0xf238('0x59'),'description',_0xf238('0x5a'),_0xf238('0x5b'),_0xf238('0x5c'),'subject','phonenumber','regardingobjectid',_0xf238('0x5d'),'phonecall_activity_parties'];var _0x34fed3=[_0xf238('0x5e'),_0xf238('0x5f'),_0xf238('0x60'),_0xf238('0x61'),'contactidname',_0xf238('0x62'),_0xf238('0x63'),_0xf238('0x64'),_0xf238('0x65'),_0xf238('0x66'),_0xf238('0x67'),_0xf238('0x68'),'createdon',_0xf238('0x69'),'createdonbehalfbyyominame',_0xf238('0x6a'),_0xf238('0x6b'),_0xf238('0x6c'),_0xf238('0x6d'),_0xf238('0x6e'),_0xf238('0x6f'),_0xf238('0x70'),_0xf238('0x71'),'exchangerate',_0xf238('0x72'),_0xf238('0x73'),_0xf238('0x74'),_0xf238('0x75'),_0xf238('0x76'),_0xf238('0x77'),'masteridname',_0xf238('0x78'),_0xf238('0x79'),'modifiedbyname',_0xf238('0x7a'),_0xf238('0x7b'),_0xf238('0x7c'),_0xf238('0x7d'),_0xf238('0x7e'),_0xf238('0x7f'),_0xf238('0x80'),'onholdtime',_0xf238('0x81'),_0xf238('0x82'),_0xf238('0x83'),_0xf238('0x84'),_0xf238('0x85'),'primarycontactidname','primarycontactidyominame',_0xf238('0x86'),'productidname',_0xf238('0x87'),_0xf238('0x88'),_0xf238('0x89'),_0xf238('0x8a'),_0xf238('0x8b'),_0xf238('0x8c'),_0xf238('0x8d'),_0xf238('0x8e'),_0xf238('0x8f'),_0xf238('0x90'),'statecode',_0xf238('0x91'),_0xf238('0x92'),_0xf238('0x93'),'timezoneruleversionnumber','transactioncurrencyidname',_0xf238('0x94'),_0xf238('0x95'),_0xf238('0x96')];var _0x250a9a=_0x44a186[_0xf238('0x97')](_0x34fed3);return db[_0xf238('0x2f')][_0xf238('0x4c')]({'where':{'id':_0x562be5[_0xf238('0x44')]['id']},'attributes':['id',_0xf238('0x98'),'password',_0xf238('0x99'),_0xf238('0x9a'),_0xf238('0x9b'),_0xf238('0x9c')]})[_0xf238('0x27')](handleEntityNotFound(_0x228dc0,null))[_0xf238('0x27')](function(_0x5c3c01){if(_0x5c3c01){_0x5d71e6=_0x5c3c01['remoteUri'];var _0x38fc19=_0x5d71e6[_0xf238('0x9d')](-0x1);if(_0x38fc19==='/'){_0x5d71e6=_0x5d71e6[_0xf238('0x9e')](0x0,_0x5d71e6[_0xf238('0x9f')](_0x38fc19));}_0x523491=util[_0xf238('0xa0')](_0xf238('0xa1'),_0x5d71e6);var _0x41ac1d={'method':'POST','uri':_0xf238('0xa2')+_0x5c3c01[_0xf238('0x9a')]+_0xf238('0xa3'),'form':{'client_id':_0x5c3c01[_0xf238('0x9b')],'resource':_0x5d71e6,'username':_0x5c3c01['username'],'password':_0x5c3c01['password'],'grant_type':_0xf238('0xa4'),'client_secret':_0x5c3c01['clientSecret']},'json':!![]};return rp(_0x41ac1d);}})[_0xf238('0x27')](function(_0x155374){_0x582fc7=_0x155374[_0xf238('0xa5')];var _0x2cd5e1={'method':_0xf238('0xa6'),'uri':encodeURI(_0x523491+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0xb92df5+'\x27'),'headers':{'Authorization':_0xf238('0xa7')+_0x582fc7,'If-None-Match':null,'OData-Version':_0xf238('0xa8')},'json':!![]};return rp(_0x2cd5e1);})[_0xf238('0x27')](function(_0x5f14b1){var _0x73386e=_0x5f14b1['value'][0x0];var _0x417d26=_0x73386e[_0xf238('0xa9')];var _0x26741d={'method':'GET','uri':_0x523491+_0xf238('0xaa')+_0x417d26+_0xf238('0xab'),'headers':{'Authorization':'Bearer\x20'+_0x582fc7,'If-None-Match':null,'OData-Version':_0xf238('0xa8')},'json':!![]};return rp(_0x26741d);})['then'](function(_0xa917b2){_0x2f3116=_0xa917b2;_0x39eb37=_0x2f3116[_0xf238('0xac')];_0x39eb37=_['remove'](_0x39eb37,function(_0x52187e){return!_0x250a9a['includes'](_0x52187e[_0xf238('0xad')]);});var _0x4e64de=[];var _0x4d59fd=[];_0x39eb37['forEach'](function(_0x5ec9d5){if(_0x5ec9d5['@odata.type']){var _0x5160f6=_0x5ec9d5[_0xf238('0xae')]['substring'](_0x5ec9d5['@odata.type']['lastIndexOf']('.')+0x1);if(_0x5160f6===_0xf238('0xaf')){_0x4e64de[_0xf238('0xb0')](getSelectList(_0x523491,_0x2e9341,_0x4d59fd,_0x2f3116[_0xf238('0xa9')],_0x5ec9d5[_0xf238('0xa9')],_0x582fc7));}}});return Promise[_0xf238('0xb1')](_0x4e64de);})[_0xf238('0x27')](function(_0x1e4101){_0xb3e18e=_0x1e4101[0x0];var _0xc603d9=[];var _0x32cba8=[];_0x39eb37[_0xf238('0xb2')](function(_0x512346){if(!_['isNil'](_0x512346[_0xf238('0xae')])){var _0x1bcec5=_0x512346['@odata.type'][_0xf238('0x9e')](_0x512346[_0xf238('0xae')][_0xf238('0x9f')]('.')+0x1);if(_0x1bcec5===_0xf238('0xb3')){_0xc603d9[_0xf238('0xb0')](getBooleanList(_0x523491,_0x2e9341,_0x32cba8,_0x2f3116[_0xf238('0xa9')],_0x512346[_0xf238('0xa9')],_0x582fc7));}}});return Promise[_0xf238('0xb1')](_0xc603d9);})[_0xf238('0x27')](function(_0x13bc76){_0x591d09=_0x13bc76[0x0];var _0x392436=[];var _0x1a8264=[];_0x39eb37['forEach'](function(_0x53558b){if(_0x53558b[_0xf238('0xae')]){var _0x378c44=_0x53558b[_0xf238('0xae')][_0xf238('0x9e')](_0x53558b['@odata.type'][_0xf238('0x9f')]('.')+0x1);if(_0x378c44===_0xf238('0xb4')||_0x378c44===_0xf238('0xb5')||_0x378c44===_0xf238('0xb6')||_0x378c44===_0xf238('0xb7')||_0x378c44==='MemoAttributeMetadata'||_0x378c44===_0xf238('0xb8')||_0x378c44===_0xf238('0xb9')||_0x378c44===_0xf238('0xba')||_0x378c44===_0xf238('0xbb')||_0x378c44===_0xf238('0xbc')){_0x392436['push'](getInputList(_0x523491,_0x2e9341,_0x378c44,_0x1a8264,_0x2f3116[_0xf238('0xa9')],_0x53558b[_0xf238('0xa9')],_0x582fc7));}}});return Promise[_0xf238('0xb1')](_0x392436);})[_0xf238('0x27')](function(_0x360cfe){_0x25b439=_0x360cfe[0x0];var _0x53fcae=_0xb3e18e[_0xf238('0x97')](_0x591d09)[_0xf238('0x97')](_0x25b439);var _0x20c4e6={'count':_0x53fcae[_0xf238('0x39')],'rows':_0x53fcae};return _0x20c4e6;})[_0xf238('0x27')](respondWithResult(_0x228dc0,null))[_0xf238('0x48')](function(_0x54d954){var _0x5e06b1=_0x562be5[_0xf238('0x33')]['test']?0x1f4:_0x54d954[_0xf238('0xbd')]||0x1f4;logger[_0xf238('0x29')](_0x54d954[_0xf238('0x2a')]);delete _0x54d954['name'];if(_0x5e06b1===0x191){_0x5e06b1=0x190;}_0x228dc0[_0xf238('0x1a')](_0x5e06b1)[_0xf238('0x2c')](_0x562be5[_0xf238('0x33')][_0xf238('0xbe')]?{'message':_0xf238('0xbf'),'statusCode':_0x54d954['statusCode']}:_0x54d954);});};function getSelectList(_0x9aec0b,_0x300da4,_0x1e593e,_0x3f389c,_0x7465d6,_0x296e67){var _0x4da295={'method':_0xf238('0xa6'),'uri':_0x9aec0b+_0xf238('0xaa')+_0x3f389c+_0xf238('0xc0')+_0x7465d6+_0xf238('0xc1')+_0xf238('0xc2'),'headers':{'Authorization':_0xf238('0xa7')+_0x296e67,'If-None-Match':null,'OData-Version':_0xf238('0xa8')},'json':!![]};return rp(_0x4da295)['then'](function(_0x19adfe){var _0x4f0d11=[];var _0x5909e8=_0x19adfe['OptionSet']['Options'];_0x5909e8[_0xf238('0xb2')](function(_0x1f2bda){_0x4f0d11['push']({'name':_0x1f2bda[_0xf238('0xc3')]['UserLocalizedLabel'][_0xf238('0xc3')],'value':String(_0x1f2bda[_0xf238('0xc4')])});});var _0x1a3960={'id':_0x300da4+'_'+_0x19adfe[_0xf238('0xad')],'name':_0x19adfe[_0xf238('0xc5')][_0xf238('0xc6')][_0xf238('0xc3')],'custom':![],'options':_0x4f0d11};_0x1e593e['push'](_0x1a3960);return _0x1e593e;});}function getBooleanList(_0x1d7fa0,_0x1433dc,_0x594a98,_0x804cc4,_0x93fed2,_0x1cc37e){var _0x50edc8={'method':'GET','uri':_0x1d7fa0+_0xf238('0xaa')+_0x804cc4+_0xf238('0xc0')+_0x93fed2+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xf238('0xa7')+_0x1cc37e,'If-None-Match':null,'OData-Version':_0xf238('0xa8')},'json':!![]};return rp(_0x50edc8)[_0xf238('0x27')](function(_0x5101ce){var _0xcb3cbd=[];_0xcb3cbd[_0xf238('0xb0')]({'name':_0x5101ce[_0xf238('0xc7')][_0xf238('0xc8')][_0xf238('0xc3')][_0xf238('0xc6')][_0xf238('0xc3')],'value':_0xf238('0xc9')},{'name':_0x5101ce['OptionSet'][_0xf238('0xca')]['Label'][_0xf238('0xc6')][_0xf238('0xc3')],'value':'false'});var _0x103e52={'id':_0x1433dc+'_'+_0x5101ce[_0xf238('0xad')],'name':_0x5101ce[_0xf238('0xc5')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0xcb3cbd};_0x594a98[_0xf238('0xb0')](_0x103e52);return _0x594a98;});}function getInputList(_0x3085eb,_0x19bc67,_0x1d6001,_0x55d95f,_0x396fb4,_0x35f8ca,_0xd541b){var _0x10a5b0={'method':_0xf238('0xa6'),'uri':_0x3085eb+'EntityDefinitions('+_0x396fb4+_0xf238('0xc0')+_0x35f8ca+_0xf238('0xcb')+_0x1d6001+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xf238('0xa7')+_0xd541b,'If-None-Match':null,'OData-Version':_0xf238('0xa8')},'json':!![]};return rp(_0x10a5b0)[_0xf238('0x27')](function(_0x391cfa){var _0x2c68b2={'id':_0x19bc67+'_'+_0x391cfa[_0xf238('0xad')],'name':_0x391cfa[_0xf238('0xc5')][_0xf238('0xc6')]?_0x391cfa[_0xf238('0xc5')][_0xf238('0xc6')][_0xf238('0xc3')]:_0x391cfa[_0xf238('0xad')],'custom':![],'options':[]};_0x55d95f['push'](_0x2c68b2);return _0x55d95f;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 8ede4dd..3e28114 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 _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x49053e,_0x25c375){var _0x52f4c8=function(_0x4fc3a5){while(--_0x4fc3a5){_0x49053e['push'](_0x49053e['shift']());}};_0x52f4c8(++_0x25c375);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xb7e7[_0x1f9f37];return _0x21c080;};'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 +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x37ee65,_0x14f835){var _0x1c0757=function(_0x56d139){while(--_0x56d139){_0x37ee65['push'](_0x37ee65['shift']());}};_0x1c0757(++_0x14f835);}(_0xe706,0xa3));var _0x6e70=function(_0x2ee974,_0x1cceb5){_0x2ee974=_0x2ee974-0x0;var _0x20c5fb=_0xe706[_0x2ee974];return _0x20c5fb;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index bdfd8a8..aaaed9b 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 _0xdfcc=['where','attributes','limit','map','include','model','ShowDynamics365Account','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','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','catch','GetDynamics365Account','Dynamics365Account','findAll','options'];(function(_0x5027b1,_0x1409a5){var _0x4a46cf=function(_0x121920){while(--_0x121920){_0x5027b1['push'](_0x5027b1['shift']());}};_0x4a46cf(++_0x1409a5);}(_0xdfcc,0x185));var _0xcdfc=function(_0x1e9e56,_0x34a74a){_0x1e9e56=_0x1e9e56-0x0;var _0x5d5e2e=_0xdfcc[_0x1e9e56];return _0x5d5e2e;};'use strict';var _=require(_0xcdfc('0x0'));var util=require(_0xcdfc('0x1'));var moment=require(_0xcdfc('0x2'));var BPromise=require(_0xcdfc('0x3'));var rs=require(_0xcdfc('0x4'));var fs=require('fs');var Redis=require(_0xcdfc('0x5'));var db=require(_0xcdfc('0x6'))['db'];var utils=require(_0xcdfc('0x7'));var logger=require('../../config/logger')(_0xcdfc('0x8'));var config=require(_0xcdfc('0x9'));var jayson=require(_0xcdfc('0xa'));var client=jayson[_0xcdfc('0xb')][_0xcdfc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a4270,_0x190c46,_0x34f4e5){return new BPromise(function(_0x73743b,_0x286801){return client['request'](_0x5a4270,_0x34f4e5)[_0xcdfc('0xd')](function(_0x46ca09){logger[_0xcdfc('0xe')](_0xcdfc('0xf'),_0x190c46,_0xcdfc('0x10'));logger[_0xcdfc('0x11')](_0xcdfc('0x12'),_0x190c46,_0xcdfc('0x10'),JSON[_0xcdfc('0x13')](_0x46ca09));if(_0x46ca09[_0xcdfc('0x14')]){if(_0x46ca09[_0xcdfc('0x14')][_0xcdfc('0x15')]===0x1f4){logger[_0xcdfc('0x14')](_0xcdfc('0xf'),_0x190c46,_0x46ca09[_0xcdfc('0x14')][_0xcdfc('0x16')]);return _0x286801(_0x46ca09['error'][_0xcdfc('0x16')]);}logger[_0xcdfc('0x14')](_0xcdfc('0xf'),_0x190c46,_0x46ca09[_0xcdfc('0x14')][_0xcdfc('0x16')]);return _0x73743b(_0x46ca09['error'][_0xcdfc('0x16')]);}else{logger[_0xcdfc('0xe')](_0xcdfc('0xf'),_0x190c46,_0xcdfc('0x10'));_0x73743b(_0x46ca09[_0xcdfc('0x17')]['message']);}})[_0xcdfc('0x18')](function(_0x3d3f99){logger[_0xcdfc('0x14')](_0xcdfc('0xf'),_0x190c46,_0x3d3f99);_0x286801(_0x3d3f99);});});}exports[_0xcdfc('0x19')]=function(_0x392ec3){var _0x2883ea=this;return new Promise(function(_0x5ec5ed,_0x309095){return db[_0xcdfc('0x1a')][_0xcdfc('0x1b')]({'raw':_0x392ec3[_0xcdfc('0x1c')]?_0x392ec3[_0xcdfc('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x392ec3[_0xcdfc('0x1c')]?_0x392ec3[_0xcdfc('0x1c')][_0xcdfc('0x1d')]||null:null,'attributes':_0x392ec3[_0xcdfc('0x1c')]?_0x392ec3['options'][_0xcdfc('0x1e')]||null:null,'limit':_0x392ec3[_0xcdfc('0x1c')]?_0x392ec3[_0xcdfc('0x1c')][_0xcdfc('0x1f')]||null:null,'include':_0x392ec3[_0xcdfc('0x1c')]?_0x392ec3[_0xcdfc('0x1c')]['include']?_[_0xcdfc('0x20')](_0x392ec3['options'][_0xcdfc('0x21')],function(_0xf5d934){return{'model':db[_0xf5d934['model']],'as':_0xf5d934['as'],'attributes':_0xf5d934['attributes'],'include':_0xf5d934[_0xcdfc('0x21')]?_['map'](_0xf5d934[_0xcdfc('0x21')],function(_0x3a8344){return{'model':db[_0x3a8344[_0xcdfc('0x22')]],'as':_0x3a8344['as'],'attributes':_0x3a8344[_0xcdfc('0x1e')],'include':_0x3a8344['include']?_[_0xcdfc('0x20')](_0x3a8344['include'],function(_0x543f5e){return{'model':db[_0x543f5e[_0xcdfc('0x22')]],'as':_0x543f5e['as'],'attributes':_0x543f5e[_0xcdfc('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xcdfc('0xd')](function(_0x252dfe){logger['info']('GetDynamics365Account',_0x392ec3);logger[_0xcdfc('0x11')](_0xcdfc('0x19'),_0x392ec3,JSON[_0xcdfc('0x13')](_0x252dfe));_0x5ec5ed(_0x252dfe);})[_0xcdfc('0x18')](function(_0x4f2a16){logger[_0xcdfc('0x14')]('GetDynamics365Account',_0x4f2a16[_0xcdfc('0x16')],_0x392ec3);_0x309095(_0x2883ea['error'](0x1f4,_0x4f2a16[_0xcdfc('0x16')]));});});};exports[_0xcdfc('0x23')]=function(_0x44468a){var _0x3be6bb=this;return new Promise(function(_0x37d9cd,_0x48c0a9){return db['Dynamics365Account'][_0xcdfc('0x24')]({'raw':_0x44468a[_0xcdfc('0x1c')]?_0x44468a[_0xcdfc('0x1c')][_0xcdfc('0x25')]===undefined?!![]:![]:!![],'where':_0x44468a[_0xcdfc('0x1c')]?_0x44468a['options'][_0xcdfc('0x1d')]||null:null,'attributes':_0x44468a[_0xcdfc('0x1c')]?_0x44468a[_0xcdfc('0x1c')][_0xcdfc('0x1e')]||null:null,'include':_0x44468a[_0xcdfc('0x1c')]?_0x44468a['options'][_0xcdfc('0x21')]?_['map'](_0x44468a['options'][_0xcdfc('0x21')],function(_0x44711d){return{'model':db[_0x44711d[_0xcdfc('0x22')]],'as':_0x44711d['as'],'attributes':_0x44711d[_0xcdfc('0x1e')],'include':_0x44711d[_0xcdfc('0x21')]?_[_0xcdfc('0x20')](_0x44711d[_0xcdfc('0x21')],function(_0x4bbfc4){return{'model':db[_0x4bbfc4[_0xcdfc('0x22')]],'as':_0x4bbfc4['as'],'attributes':_0x4bbfc4[_0xcdfc('0x1e')],'include':_0x4bbfc4[_0xcdfc('0x21')]?_[_0xcdfc('0x20')](_0x4bbfc4[_0xcdfc('0x21')],function(_0x3f1cf4){return{'model':db[_0x3f1cf4['model']],'as':_0x3f1cf4['as'],'attributes':_0x3f1cf4['attributes']};}):[]};}):[]};}):[]:[]})[_0xcdfc('0xd')](function(_0x4d7f0f){logger['info'](_0xcdfc('0x23'),_0x44468a);logger[_0xcdfc('0x11')](_0xcdfc('0x23'),_0x44468a,JSON['stringify'](_0x4d7f0f));_0x37d9cd(_0x4d7f0f);})[_0xcdfc('0x18')](function(_0x46eb31){logger[_0xcdfc('0x14')](_0xcdfc('0x23'),_0x46eb31[_0xcdfc('0x16')],_0x44468a);_0x48c0a9(_0x3be6bb[_0xcdfc('0x14')](0x1f4,_0x46eb31[_0xcdfc('0x16')]));});});}; \ No newline at end of file +var _0xe5ea=['include','model','map','GetDynamics365Account','debug','ShowDynamics365Account','find','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Dynamics365Account,\x20%s,\x20%s','message','result','catch','Dynamics365Account','findAll','options','raw','where','attributes','limit'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0xe5ea,0x17d));var _0xae5e=function(_0x1650f6,_0x1c0557){_0x1650f6=_0x1650f6-0x0;var _0xdd36f0=_0xe5ea[_0x1650f6];return _0xdd36f0;};'use strict';var _=require(_0xae5e('0x0'));var util=require('util');var moment=require(_0xae5e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xae5e('0x2'));var db=require(_0xae5e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xae5e('0x4'))(_0xae5e('0x5'));var config=require(_0xae5e('0x6'));var jayson=require(_0xae5e('0x7'));var client=jayson['client'][_0xae5e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4fe1e7,_0x4cd5ea,_0x26c2ac){return new BPromise(function(_0x6b4e2a,_0x5f0a3f){return client[_0xae5e('0x9')](_0x4fe1e7,_0x26c2ac)[_0xae5e('0xa')](function(_0x19705c){logger[_0xae5e('0xb')]('Dynamics365Account,\x20%s,\x20%s',_0x4cd5ea,'request\x20sent');logger['debug'](_0xae5e('0xc'),_0x4cd5ea,_0xae5e('0xd'),JSON[_0xae5e('0xe')](_0x19705c));if(_0x19705c[_0xae5e('0xf')]){if(_0x19705c['error']['code']===0x1f4){logger['error'](_0xae5e('0x10'),_0x4cd5ea,_0x19705c[_0xae5e('0xf')][_0xae5e('0x11')]);return _0x5f0a3f(_0x19705c[_0xae5e('0xf')][_0xae5e('0x11')]);}logger['error'](_0xae5e('0x10'),_0x4cd5ea,_0x19705c['error'][_0xae5e('0x11')]);return _0x6b4e2a(_0x19705c['error'][_0xae5e('0x11')]);}else{logger[_0xae5e('0xb')](_0xae5e('0x10'),_0x4cd5ea,_0xae5e('0xd'));_0x6b4e2a(_0x19705c[_0xae5e('0x12')][_0xae5e('0x11')]);}})[_0xae5e('0x13')](function(_0x4148a1){logger[_0xae5e('0xf')](_0xae5e('0x10'),_0x4cd5ea,_0x4148a1);_0x5f0a3f(_0x4148a1);});});}exports['GetDynamics365Account']=function(_0x32fc85){var _0x379d8e=this;return new Promise(function(_0x4e2510,_0x240d97){return db[_0xae5e('0x14')][_0xae5e('0x15')]({'raw':_0x32fc85[_0xae5e('0x16')]?_0x32fc85['options'][_0xae5e('0x17')]===undefined?!![]:![]:!![],'where':_0x32fc85[_0xae5e('0x16')]?_0x32fc85[_0xae5e('0x16')][_0xae5e('0x18')]||null:null,'attributes':_0x32fc85[_0xae5e('0x16')]?_0x32fc85[_0xae5e('0x16')][_0xae5e('0x19')]||null:null,'limit':_0x32fc85[_0xae5e('0x16')]?_0x32fc85[_0xae5e('0x16')][_0xae5e('0x1a')]||null:null,'include':_0x32fc85['options']?_0x32fc85[_0xae5e('0x16')][_0xae5e('0x1b')]?_['map'](_0x32fc85[_0xae5e('0x16')][_0xae5e('0x1b')],function(_0x5d0b18){return{'model':db[_0x5d0b18[_0xae5e('0x1c')]],'as':_0x5d0b18['as'],'attributes':_0x5d0b18[_0xae5e('0x19')],'include':_0x5d0b18[_0xae5e('0x1b')]?_[_0xae5e('0x1d')](_0x5d0b18[_0xae5e('0x1b')],function(_0x2c4550){return{'model':db[_0x2c4550[_0xae5e('0x1c')]],'as':_0x2c4550['as'],'attributes':_0x2c4550[_0xae5e('0x19')],'include':_0x2c4550[_0xae5e('0x1b')]?_['map'](_0x2c4550[_0xae5e('0x1b')],function(_0x1efca2){return{'model':db[_0x1efca2[_0xae5e('0x1c')]],'as':_0x1efca2['as'],'attributes':_0x1efca2[_0xae5e('0x19')]};}):[]};}):[]};}):[]:[]})[_0xae5e('0xa')](function(_0x2c4102){logger[_0xae5e('0xb')](_0xae5e('0x1e'),_0x32fc85);logger[_0xae5e('0x1f')](_0xae5e('0x1e'),_0x32fc85,JSON[_0xae5e('0xe')](_0x2c4102));_0x4e2510(_0x2c4102);})[_0xae5e('0x13')](function(_0x4219cd){logger[_0xae5e('0xf')](_0xae5e('0x1e'),_0x4219cd[_0xae5e('0x11')],_0x32fc85);_0x240d97(_0x379d8e[_0xae5e('0xf')](0x1f4,_0x4219cd['message']));});});};exports[_0xae5e('0x20')]=function(_0x5787d2){var _0x2c4695=this;return new Promise(function(_0x53332c,_0x5de588){return db[_0xae5e('0x14')][_0xae5e('0x21')]({'raw':_0x5787d2['options']?_0x5787d2['options'][_0xae5e('0x17')]===undefined?!![]:![]:!![],'where':_0x5787d2[_0xae5e('0x16')]?_0x5787d2[_0xae5e('0x16')][_0xae5e('0x18')]||null:null,'attributes':_0x5787d2[_0xae5e('0x16')]?_0x5787d2[_0xae5e('0x16')][_0xae5e('0x19')]||null:null,'include':_0x5787d2[_0xae5e('0x16')]?_0x5787d2['options']['include']?_[_0xae5e('0x1d')](_0x5787d2[_0xae5e('0x16')]['include'],function(_0x254719){return{'model':db[_0x254719[_0xae5e('0x1c')]],'as':_0x254719['as'],'attributes':_0x254719[_0xae5e('0x19')],'include':_0x254719['include']?_['map'](_0x254719[_0xae5e('0x1b')],function(_0x58388e){return{'model':db[_0x58388e[_0xae5e('0x1c')]],'as':_0x58388e['as'],'attributes':_0x58388e[_0xae5e('0x19')],'include':_0x58388e[_0xae5e('0x1b')]?_[_0xae5e('0x1d')](_0x58388e[_0xae5e('0x1b')],function(_0x8f757d){return{'model':db[_0x8f757d['model']],'as':_0x8f757d['as'],'attributes':_0x8f757d[_0xae5e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x24061c){logger['info'](_0xae5e('0x20'),_0x5787d2);logger['debug'](_0xae5e('0x20'),_0x5787d2,JSON[_0xae5e('0xe')](_0x24061c));_0x53332c(_0x24061c);})['catch'](function(_0x3a88c3){logger[_0xae5e('0xf')](_0xae5e('0x20'),_0x3a88c3[_0xae5e('0x11')],_0x5787d2);_0x5de588(_0x2c4695[_0xae5e('0xf')](0x1f4,_0x3a88c3['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 6c020ab..a631cc4 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 _0x80e0=['post','put','/:id','delete','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Configuration.controller','get','isAuthenticated','getFields','/:id/subjects','/:id/descriptions','getDescriptions'];(function(_0x396772,_0x1d24c4){var _0x4f3c81=function(_0x59a271){while(--_0x59a271){_0x396772['push'](_0x396772['shift']());}};_0x4f3c81(++_0x1d24c4);}(_0x80e0,0x9d));var _0x080e=function(_0x3d336f,_0x1ea87d){_0x3d336f=_0x3d336f-0x0;var _0x50cc1d=_0x80e0[_0x3d336f];return _0x50cc1d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x080e('0x0'));var timeout=require(_0x080e('0x1'));var express=require(_0x080e('0x2'));var router=express['Router']();var fs_extra=require(_0x080e('0x3'));var auth=require(_0x080e('0x4'));var interaction=require(_0x080e('0x5'));var config=require('../../config/environment');var controller=require(_0x080e('0x6'));router[_0x080e('0x7')]('/',auth[_0x080e('0x8')](),controller['index']);router['get']('/:id',auth[_0x080e('0x8')](),controller['show']);router[_0x080e('0x7')]('/:id/fields',auth[_0x080e('0x8')](),controller[_0x080e('0x9')]);router[_0x080e('0x7')](_0x080e('0xa'),auth[_0x080e('0x8')](),controller['getSubjects']);router['get'](_0x080e('0xb'),auth[_0x080e('0x8')](),controller[_0x080e('0xc')]);router[_0x080e('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x080e('0xe')](_0x080e('0xf'),auth[_0x080e('0x8')](),controller['update']);router[_0x080e('0x10')](_0x080e('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc933=['index','/:id','show','get','/:id/fields','getFields','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated'];(function(_0x2fe689,_0x5794e5){var _0x35ea44=function(_0x51b9d6){while(--_0x51b9d6){_0x2fe689['push'](_0x2fe689['shift']());}};_0x35ea44(++_0x5794e5);}(_0xc933,0xf9));var _0x3c93=function(_0x16ccc8,_0x555631){_0x16ccc8=_0x16ccc8-0x0;var _0x4325db=_0xc933[_0x16ccc8];return _0x4325db;};'use strict';var multer=require(_0x3c93('0x0'));var util=require(_0x3c93('0x1'));var path=require(_0x3c93('0x2'));var timeout=require(_0x3c93('0x3'));var express=require(_0x3c93('0x4'));var router=express['Router']();var fs_extra=require(_0x3c93('0x5'));var auth=require(_0x3c93('0x6'));var interaction=require(_0x3c93('0x7'));var config=require(_0x3c93('0x8'));var controller=require(_0x3c93('0x9'));router['get']('/',auth[_0x3c93('0xa')](),controller[_0x3c93('0xb')]);router['get'](_0x3c93('0xc'),auth['isAuthenticated'](),controller[_0x3c93('0xd')]);router[_0x3c93('0xe')](_0x3c93('0xf'),auth[_0x3c93('0xa')](),controller[_0x3c93('0x10')]);router[_0x3c93('0xe')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x3c93('0xe')](_0x3c93('0x11'),auth[_0x3c93('0xa')](),controller[_0x3c93('0x12')]);router[_0x3c93('0x13')]('/',auth[_0x3c93('0xa')](),controller[_0x3c93('0x14')]);router[_0x3c93('0x15')](_0x3c93('0xc'),auth[_0x3c93('0xa')](),controller[_0x3c93('0x16')]);router[_0x3c93('0x17')](_0x3c93('0xc'),auth[_0x3c93('0xa')](),controller[_0x3c93('0x18')]);module[_0x3c93('0x19')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 2cf2430..0044aab 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 _0x27c1=['sequelize','exports','STRING','ENUM','incident'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x27c1,0x78));var _0x127c=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x27c1[_0x45d55e];return _0x29812a;};'use strict';var Sequelize=require(_0x127c('0x0'));module[_0x127c('0x1')]={'name':{'type':Sequelize[_0x127c('0x2')]},'description':{'type':Sequelize[_0x127c('0x2')]},'ticketType':{'type':Sequelize[_0x127c('0x3')](_0x127c('0x4'),'phonecall'),'defaultValue':_0x127c('0x4')}}; \ No newline at end of file +var _0x01e9=['STRING','ENUM','phonecall','exports'];(function(_0x4b40ae,_0x479eac){var _0x101668=function(_0x1bc8b8){while(--_0x1bc8b8){_0x4b40ae['push'](_0x4b40ae['shift']());}};_0x101668(++_0x479eac);}(_0x01e9,0x1eb));var _0x901e=function(_0x5a8047,_0x5cec69){_0x5a8047=_0x5a8047-0x0;var _0x2a89fb=_0x01e9[_0x5a8047];return _0x2a89fb;};'use strict';var Sequelize=require('sequelize');module[_0x901e('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x901e('0x1')]},'ticketType':{'type':Sequelize[_0x901e('0x2')]('incident',_0x901e('0x3')),'defaultValue':'incident'}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 2167c8c..378ef1c 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 _0x41e5=['end','json','limit','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','Dynamics365Configuration','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','count','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','getFields','Dynamics365Field','rawAttributes','getSubjects','hasOwnProperty','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x382602,_0x5e9d2d){var _0x14dda6=function(_0xf65c39){while(--_0xf65c39){_0x382602['push'](_0x382602['shift']());}};_0x14dda6(++_0x5e9d2d);}(_0x41e5,0xda));var _0x541e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41e5[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x541e('0x0'));var rimraf=require(_0x541e('0x1'));var zipdir=require(_0x541e('0x2'));var jsonpatch=require(_0x541e('0x3'));var rp=require(_0x541e('0x4'));var moment=require(_0x541e('0x5'));var BPromise=require(_0x541e('0x6'));var Mustache=require(_0x541e('0x7'));var util=require(_0x541e('0x8'));var path=require(_0x541e('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x541e('0xa'));var fs=require('fs');var fs_extra=require(_0x541e('0xb'));var _=require('lodash');var squel=require(_0x541e('0xc'));var crypto=require('crypto');var jsforce=require(_0x541e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x541e('0xe'));var querystring=require(_0x541e('0xf'));var Papa=require(_0x541e('0x10'));var Redis=require(_0x541e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x541e('0x12'));var as=require(_0x541e('0x13'));var hardwareService=require(_0x541e('0x14'));var logger=require(_0x541e('0x15'))(_0x541e('0x16'));var utils=require(_0x541e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x541e('0x18'));var db=require(_0x541e('0x19'))['db'];function respondWithStatusCode(_0x1735cd,_0x18ccc5){_0x18ccc5=_0x18ccc5||0xcc;return function(_0x563648){if(_0x563648){return _0x1735cd[_0x541e('0x1a')](_0x18ccc5);}return _0x1735cd[_0x541e('0x1b')](_0x18ccc5)[_0x541e('0x1c')]();};}function respondWithResult(_0x5e0399,_0x10342b){_0x10342b=_0x10342b||0xc8;return function(_0x367f75){if(_0x367f75){return _0x5e0399[_0x541e('0x1b')](_0x10342b)[_0x541e('0x1d')](_0x367f75);}};}function respondWithFilteredResult(_0x552118,_0x50a47f){return function(_0x54af35){if(_0x54af35){var _0x1a2f43=typeof _0x50a47f['offset']==='undefined'&&typeof _0x50a47f[_0x541e('0x1e')]==='undefined';var _0x30d386=_0x54af35['count'];var _0x243830=_0x1a2f43?0x0:_0x50a47f[_0x541e('0x1f')];var _0x43886c=_0x1a2f43?_0x54af35['count']:_0x50a47f['offset']+_0x50a47f[_0x541e('0x1e')];var _0x2aa1e6;if(_0x43886c>=_0x30d386){_0x43886c=_0x30d386;_0x2aa1e6=0xc8;}else{_0x2aa1e6=0xce;}_0x552118[_0x541e('0x1b')](_0x2aa1e6);return _0x552118[_0x541e('0x20')](_0x541e('0x21'),_0x243830+'-'+_0x43886c+'/'+_0x30d386)[_0x541e('0x1d')](_0x54af35);}return null;};}function patchUpdates(_0x8e3df9){return function(_0x4dc606){try{jsonpatch[_0x541e('0x22')](_0x4dc606,_0x8e3df9,!![]);}catch(_0x25cdd0){return BPromise[_0x541e('0x23')](_0x25cdd0);}return _0x4dc606[_0x541e('0x24')]();};}function saveUpdates(_0x10988a,_0x4911db){return function(_0xf549d8){if(_0xf549d8){return _0xf549d8[_0x541e('0x25')](_0x10988a)['then'](function(_0x1b6a00){return _0x1b6a00;});}return null;};}function removeEntity(_0x368e61,_0x3d93ac){return function(_0x1af326){if(_0x1af326){return _0x1af326[_0x541e('0x26')]()[_0x541e('0x27')](function(){_0x368e61['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x14a44,_0x5758a7){return function(_0x37be4e){if(!_0x37be4e){_0x14a44[_0x541e('0x1a')](0x194);}return _0x37be4e;};}function handleError(_0xb307fe,_0x12b3f9){_0x12b3f9=_0x12b3f9||0x1f4;return function(_0xb38559){logger[_0x541e('0x28')](_0xb38559[_0x541e('0x29')]);if(_0xb38559[_0x541e('0x2a')]){delete _0xb38559[_0x541e('0x2a')];}_0xb307fe[_0x541e('0x1b')](_0x12b3f9)[_0x541e('0x2b')](_0xb38559);};}exports['index']=function(_0x356f9f,_0x4c6e0d){var _0x30fca4={},_0x4d7361={},_0x1d7471={'count':0x0,'rows':[]};var _0x2e134d=_[_0x541e('0x2c')](db[_0x541e('0x2d')]['rawAttributes'],function(_0x30f2a5){return{'name':_0x30f2a5[_0x541e('0x2e')],'type':_0x30f2a5[_0x541e('0x2f')]['key']};});_0x4d7361[_0x541e('0x30')]=_[_0x541e('0x2c')](_0x2e134d,_0x541e('0x2a'));_0x4d7361['query']=_[_0x541e('0x31')](_0x356f9f['query']);_0x4d7361[_0x541e('0x32')]=_[_0x541e('0x33')](_0x4d7361[_0x541e('0x30')],_0x4d7361[_0x541e('0x34')]);_0x30fca4[_0x541e('0x35')]=_['intersection'](_0x4d7361['model'],qs['fields'](_0x356f9f[_0x541e('0x34')][_0x541e('0x36')]));_0x30fca4[_0x541e('0x35')]=_0x30fca4[_0x541e('0x35')][_0x541e('0x37')]?_0x30fca4[_0x541e('0x35')]:_0x4d7361[_0x541e('0x30')];if(!_0x356f9f[_0x541e('0x34')]['hasOwnProperty'](_0x541e('0x38'))){_0x30fca4[_0x541e('0x1e')]=qs['limit'](_0x356f9f[_0x541e('0x34')][_0x541e('0x1e')]);_0x30fca4[_0x541e('0x1f')]=qs[_0x541e('0x1f')](_0x356f9f['query'][_0x541e('0x1f')]);}_0x30fca4[_0x541e('0x39')]=qs['sort'](_0x356f9f[_0x541e('0x34')][_0x541e('0x3a')]);_0x30fca4[_0x541e('0x3b')]=qs[_0x541e('0x32')](_[_0x541e('0x3c')](_0x356f9f[_0x541e('0x34')],_0x4d7361[_0x541e('0x32')]),_0x2e134d);if(_0x356f9f['query'][_0x541e('0x3d')]){_0x30fca4[_0x541e('0x3b')]=_[_0x541e('0x3e')](_0x30fca4[_0x541e('0x3b')],{'$or':_[_0x541e('0x2c')](_0x2e134d,function(_0x30b2e3){if(_0x30b2e3['type']!=='VIRTUAL'){var _0x2115a6={};_0x2115a6[_0x30b2e3[_0x541e('0x2a')]]={'$like':'%'+_0x356f9f['query'][_0x541e('0x3d')]+'%'};return _0x2115a6;}})});}_0x30fca4=_[_0x541e('0x3e')]({},_0x30fca4,_0x356f9f['options']);var _0x558093={'where':_0x30fca4[_0x541e('0x3b')]};return db[_0x541e('0x2d')][_0x541e('0x3f')](_0x558093)[_0x541e('0x27')](function(_0x3cbbdf){_0x1d7471[_0x541e('0x3f')]=_0x3cbbdf;if(_0x356f9f['query'][_0x541e('0x40')]){_0x30fca4[_0x541e('0x41')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x541e('0x42')](_0x30fca4);})['then'](function(_0x28d00b){_0x1d7471[_0x541e('0x43')]=_0x28d00b;return _0x1d7471;})[_0x541e('0x27')](respondWithFilteredResult(_0x4c6e0d,_0x30fca4))[_0x541e('0x44')](handleError(_0x4c6e0d,null));};exports[_0x541e('0x45')]=function(_0x15aad6,_0x709406){var _0x18dc1c={'raw':![],'where':{'id':_0x15aad6[_0x541e('0x46')]['id']}},_0x507956={};_0x507956[_0x541e('0x30')]=_[_0x541e('0x31')](db[_0x541e('0x2d')]['rawAttributes']);_0x507956['query']=_[_0x541e('0x31')](_0x15aad6[_0x541e('0x34')]);_0x507956[_0x541e('0x32')]=_[_0x541e('0x33')](_0x507956[_0x541e('0x30')],_0x507956[_0x541e('0x34')]);_0x18dc1c[_0x541e('0x35')]=_[_0x541e('0x33')](_0x507956[_0x541e('0x30')],qs[_0x541e('0x36')](_0x15aad6[_0x541e('0x34')][_0x541e('0x36')]));_0x18dc1c[_0x541e('0x35')]=_0x18dc1c[_0x541e('0x35')]['length']?_0x18dc1c[_0x541e('0x35')]:_0x507956[_0x541e('0x30')];if(_0x15aad6['query'][_0x541e('0x40')]){_0x18dc1c[_0x541e('0x41')]=[{'all':!![]}];}_0x18dc1c=_[_0x541e('0x3e')]({},_0x18dc1c,_0x15aad6[_0x541e('0x47')]);return db[_0x541e('0x2d')][_0x541e('0x48')](_0x18dc1c)['then'](handleEntityNotFound(_0x709406,null))[_0x541e('0x27')](respondWithResult(_0x709406,null))[_0x541e('0x44')](handleError(_0x709406,null));};exports[_0x541e('0x49')]=function(_0x568c7a,_0x368326){return db[_0x541e('0x2d')]['create'](_0x568c7a[_0x541e('0x4a')],{})['then'](respondWithResult(_0x368326,0xc9))[_0x541e('0x44')](handleError(_0x368326,null));};exports['update']=function(_0x106f2a,_0x36e1eb){if(_0x106f2a[_0x541e('0x4a')]['id']){delete _0x106f2a['body']['id'];}return db[_0x541e('0x2d')][_0x541e('0x48')]({'where':{'id':_0x106f2a[_0x541e('0x46')]['id']}})[_0x541e('0x27')](handleEntityNotFound(_0x36e1eb,null))[_0x541e('0x27')](saveUpdates(_0x106f2a['body'],null))['then'](respondWithResult(_0x36e1eb,null))[_0x541e('0x44')](handleError(_0x36e1eb,null));};exports['destroy']=function(_0x5bac28,_0x3ce2ab){return db[_0x541e('0x2d')]['find']({'where':{'id':_0x5bac28[_0x541e('0x46')]['id']}})[_0x541e('0x27')](handleEntityNotFound(_0x3ce2ab,null))['then'](removeEntity(_0x3ce2ab,null))[_0x541e('0x44')](handleError(_0x3ce2ab,null));};exports[_0x541e('0x4b')]=function(_0x57358f,_0x5e7c75,_0x25fced){var _0x417332={};var _0x3256b0={};var _0x1ae953;var _0x7e5a20;return db[_0x541e('0x2d')]['findOne']({'where':{'id':_0x57358f[_0x541e('0x46')]['id']}})[_0x541e('0x27')](handleEntityNotFound(_0x5e7c75,null))[_0x541e('0x27')](function(_0x4f3115){if(_0x4f3115){_0x1ae953=_0x4f3115;_0x3256b0[_0x541e('0x30')]=_[_0x541e('0x31')](db[_0x541e('0x4c')][_0x541e('0x4d')]);_0x3256b0[_0x541e('0x34')]=_['keys'](_0x57358f[_0x541e('0x34')]);_0x3256b0['filters']=_[_0x541e('0x33')](_0x3256b0['model'],_0x3256b0['query']);_0x417332[_0x541e('0x35')]=_[_0x541e('0x33')](_0x3256b0[_0x541e('0x30')],qs[_0x541e('0x36')](_0x57358f[_0x541e('0x34')][_0x541e('0x36')]));_0x417332['attributes']=_0x417332[_0x541e('0x35')][_0x541e('0x37')]?_0x417332['attributes']:_0x3256b0['model'];_0x417332[_0x541e('0x39')]=qs[_0x541e('0x3a')](_0x57358f[_0x541e('0x34')][_0x541e('0x3a')]);_0x417332['where']=qs[_0x541e('0x32')](_[_0x541e('0x3c')](_0x57358f[_0x541e('0x34')],_0x3256b0[_0x541e('0x32')]));if(_0x57358f['query'][_0x541e('0x3d')]){_0x417332[_0x541e('0x3b')]=_[_0x541e('0x3e')](_0x417332[_0x541e('0x3b')],{'$or':_[_0x541e('0x2c')](_0x417332[_0x541e('0x35')],function(_0x1f6fa7){var _0x35a78b={};_0x35a78b[_0x1f6fa7]={'$like':'%'+_0x57358f['query'][_0x541e('0x3d')]+'%'};return _0x35a78b;})});}_0x417332=_[_0x541e('0x3e')]({},_0x417332,_0x57358f[_0x541e('0x47')]);return _0x1ae953['getFields'](_0x417332);}})[_0x541e('0x27')](function(_0xba499c){if(_0xba499c){_0x7e5a20=_0xba499c[_0x541e('0x37')];if(!_0x57358f[_0x541e('0x34')]['hasOwnProperty'](_0x541e('0x38'))){_0x417332[_0x541e('0x1e')]=qs[_0x541e('0x1e')](_0x57358f[_0x541e('0x34')]['limit']);_0x417332['offset']=qs[_0x541e('0x1f')](_0x57358f[_0x541e('0x34')][_0x541e('0x1f')]);}return _0x1ae953[_0x541e('0x4b')](_0x417332);}})['then'](function(_0x1d1273){if(_0x1d1273){return _0x1d1273?{'count':_0x7e5a20,'rows':_0x1d1273}:null;}})['then'](respondWithResult(_0x5e7c75,null))[_0x541e('0x44')](handleError(_0x5e7c75,null));};exports[_0x541e('0x4e')]=function(_0x12e3c9,_0x5e8c47,_0x3cd44f){var _0x41ca50={};var _0x1b4296={};var _0x16c44b;var _0x361440;return db[_0x541e('0x2d')]['findOne']({'where':{'id':_0x12e3c9['params']['id']}})[_0x541e('0x27')](handleEntityNotFound(_0x5e8c47,null))[_0x541e('0x27')](function(_0x3de206){if(_0x3de206){_0x16c44b=_0x3de206;_0x1b4296['model']=_['keys'](db[_0x541e('0x4c')][_0x541e('0x4d')]);_0x1b4296['query']=_[_0x541e('0x31')](_0x12e3c9[_0x541e('0x34')]);_0x1b4296['filters']=_[_0x541e('0x33')](_0x1b4296[_0x541e('0x30')],_0x1b4296['query']);_0x41ca50[_0x541e('0x35')]=_['intersection'](_0x1b4296[_0x541e('0x30')],qs[_0x541e('0x36')](_0x12e3c9[_0x541e('0x34')]['fields']));_0x41ca50['attributes']=_0x41ca50[_0x541e('0x35')][_0x541e('0x37')]?_0x41ca50['attributes']:_0x1b4296[_0x541e('0x30')];_0x41ca50[_0x541e('0x39')]=qs[_0x541e('0x3a')](_0x12e3c9[_0x541e('0x34')][_0x541e('0x3a')]);_0x41ca50[_0x541e('0x3b')]=qs[_0x541e('0x32')](_[_0x541e('0x3c')](_0x12e3c9[_0x541e('0x34')],_0x1b4296['filters']));if(_0x12e3c9[_0x541e('0x34')][_0x541e('0x3d')]){_0x41ca50['where']=_[_0x541e('0x3e')](_0x41ca50['where'],{'$or':_[_0x541e('0x2c')](_0x41ca50[_0x541e('0x35')],function(_0x580a19){var _0x605e85={};_0x605e85[_0x580a19]={'$like':'%'+_0x12e3c9[_0x541e('0x34')][_0x541e('0x3d')]+'%'};return _0x605e85;})});}_0x41ca50=_[_0x541e('0x3e')]({},_0x41ca50,_0x12e3c9[_0x541e('0x47')]);return _0x16c44b[_0x541e('0x4e')](_0x41ca50);}})['then'](function(_0x426d63){if(_0x426d63){_0x361440=_0x426d63[_0x541e('0x37')];if(!_0x12e3c9['query'][_0x541e('0x4f')](_0x541e('0x38'))){_0x41ca50[_0x541e('0x1e')]=qs[_0x541e('0x1e')](_0x12e3c9[_0x541e('0x34')][_0x541e('0x1e')]);_0x41ca50[_0x541e('0x1f')]=qs[_0x541e('0x1f')](_0x12e3c9[_0x541e('0x34')][_0x541e('0x1f')]);}return _0x16c44b[_0x541e('0x4e')](_0x41ca50);}})[_0x541e('0x27')](function(_0x4dc229){if(_0x4dc229){return _0x4dc229?{'count':_0x361440,'rows':_0x4dc229}:null;}})[_0x541e('0x27')](respondWithResult(_0x5e8c47,null))[_0x541e('0x44')](handleError(_0x5e8c47,null));};exports['getDescriptions']=function(_0x5dbf91,_0x2815d6,_0x53a0b9){var _0x1d8312={};var _0x5014c7={};var _0x44f79d;var _0x292169;return db[_0x541e('0x2d')][_0x541e('0x50')]({'where':{'id':_0x5dbf91[_0x541e('0x46')]['id']}})['then'](handleEntityNotFound(_0x2815d6,null))[_0x541e('0x27')](function(_0x4920fc){if(_0x4920fc){_0x44f79d=_0x4920fc;_0x5014c7['model']=_[_0x541e('0x31')](db['Dynamics365Field'][_0x541e('0x4d')]);_0x5014c7[_0x541e('0x34')]=_['keys'](_0x5dbf91['query']);_0x5014c7['filters']=_[_0x541e('0x33')](_0x5014c7[_0x541e('0x30')],_0x5014c7[_0x541e('0x34')]);_0x1d8312[_0x541e('0x35')]=_['intersection'](_0x5014c7[_0x541e('0x30')],qs[_0x541e('0x36')](_0x5dbf91[_0x541e('0x34')][_0x541e('0x36')]));_0x1d8312[_0x541e('0x35')]=_0x1d8312[_0x541e('0x35')]['length']?_0x1d8312[_0x541e('0x35')]:_0x5014c7[_0x541e('0x30')];_0x1d8312[_0x541e('0x39')]=qs['sort'](_0x5dbf91[_0x541e('0x34')][_0x541e('0x3a')]);_0x1d8312[_0x541e('0x3b')]=qs['filters'](_['pick'](_0x5dbf91[_0x541e('0x34')],_0x5014c7['filters']));if(_0x5dbf91[_0x541e('0x34')][_0x541e('0x3d')]){_0x1d8312[_0x541e('0x3b')]=_[_0x541e('0x3e')](_0x1d8312[_0x541e('0x3b')],{'$or':_[_0x541e('0x2c')](_0x1d8312[_0x541e('0x35')],function(_0x5bc0bb){var _0x46fb0e={};_0x46fb0e[_0x5bc0bb]={'$like':'%'+_0x5dbf91[_0x541e('0x34')][_0x541e('0x3d')]+'%'};return _0x46fb0e;})});}_0x1d8312=_['merge']({},_0x1d8312,_0x5dbf91['options']);return _0x44f79d[_0x541e('0x51')](_0x1d8312);}})['then'](function(_0x4ad637){if(_0x4ad637){_0x292169=_0x4ad637[_0x541e('0x37')];if(!_0x5dbf91[_0x541e('0x34')][_0x541e('0x4f')](_0x541e('0x38'))){_0x1d8312[_0x541e('0x1e')]=qs[_0x541e('0x1e')](_0x5dbf91[_0x541e('0x34')][_0x541e('0x1e')]);_0x1d8312[_0x541e('0x1f')]=qs['offset'](_0x5dbf91[_0x541e('0x34')]['offset']);}return _0x44f79d[_0x541e('0x51')](_0x1d8312);}})['then'](function(_0x2a46c8){if(_0x2a46c8){return _0x2a46c8?{'count':_0x292169,'rows':_0x2a46c8}:null;}})[_0x541e('0x27')](respondWithResult(_0x2815d6,null))['catch'](handleError(_0x2815d6,null));}; \ No newline at end of file +var _0x6852=['sendStatus','status','end','json','offset','undefined','limit','count','set','apply','update','error','stack','send','rawAttributes','fieldName','key','model','map','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','type','VIRTUAL','merge','options','Dynamics365Configuration','then','includeAll','include','rows','catch','show','params','length','find','create','body','destroy','getFields','findOne','filters','sort','Dynamics365Field','getSubjects','getDescriptions','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x31b39a,_0xcc93f9){var _0x4a3935=function(_0x4e9dfc){while(--_0x4e9dfc){_0x31b39a['push'](_0x31b39a['shift']());}};_0x4a3935(++_0xcc93f9);}(_0x6852,0xd4));var _0x2685=function(_0x58f046,_0x3272f0){_0x58f046=_0x58f046-0x0;var _0x3ad45c=_0x6852[_0x58f046];return _0x3ad45c;};'use strict';var emlformat=require(_0x2685('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2685('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2685('0x2'));var moment=require(_0x2685('0x3'));var BPromise=require(_0x2685('0x4'));var Mustache=require(_0x2685('0x5'));var util=require(_0x2685('0x6'));var path=require(_0x2685('0x7'));var sox=require(_0x2685('0x8'));var csv=require(_0x2685('0x9'));var ejs=require(_0x2685('0xa'));var fs=require('fs');var fs_extra=require(_0x2685('0xb'));var _=require(_0x2685('0xc'));var squel=require(_0x2685('0xd'));var crypto=require('crypto');var jsforce=require(_0x2685('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2685('0x9'));var querystring=require(_0x2685('0xf'));var Papa=require('papaparse');var Redis=require(_0x2685('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2685('0x11'));var as=require(_0x2685('0x12'));var hardwareService=require(_0x2685('0x13'));var logger=require(_0x2685('0x14'))(_0x2685('0x15'));var utils=require(_0x2685('0x16'));var config=require(_0x2685('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x2685('0x18'))['db'];function respondWithStatusCode(_0x45b140,_0x97ea4){_0x97ea4=_0x97ea4||0xcc;return function(_0xdf2f15){if(_0xdf2f15){return _0x45b140[_0x2685('0x19')](_0x97ea4);}return _0x45b140[_0x2685('0x1a')](_0x97ea4)[_0x2685('0x1b')]();};}function respondWithResult(_0x3d5c94,_0x4ba9cd){_0x4ba9cd=_0x4ba9cd||0xc8;return function(_0x51a5e5){if(_0x51a5e5){return _0x3d5c94[_0x2685('0x1a')](_0x4ba9cd)[_0x2685('0x1c')](_0x51a5e5);}};}function respondWithFilteredResult(_0x101db3,_0x5c558b){return function(_0x91af80){if(_0x91af80){var _0xb8dd24=typeof _0x5c558b[_0x2685('0x1d')]===_0x2685('0x1e')&&typeof _0x5c558b[_0x2685('0x1f')]==='undefined';var _0x1d7723=_0x91af80[_0x2685('0x20')];var _0x46bec8=_0xb8dd24?0x0:_0x5c558b[_0x2685('0x1d')];var _0x2c6d32=_0xb8dd24?_0x91af80[_0x2685('0x20')]:_0x5c558b[_0x2685('0x1d')]+_0x5c558b[_0x2685('0x1f')];var _0x57bcbf;if(_0x2c6d32>=_0x1d7723){_0x2c6d32=_0x1d7723;_0x57bcbf=0xc8;}else{_0x57bcbf=0xce;}_0x101db3['status'](_0x57bcbf);return _0x101db3[_0x2685('0x21')]('Content-Range',_0x46bec8+'-'+_0x2c6d32+'/'+_0x1d7723)[_0x2685('0x1c')](_0x91af80);}return null;};}function patchUpdates(_0x1e2815){return function(_0x47f7c9){try{jsonpatch[_0x2685('0x22')](_0x47f7c9,_0x1e2815,!![]);}catch(_0x8ee41f){return BPromise['reject'](_0x8ee41f);}return _0x47f7c9['save']();};}function saveUpdates(_0x283b2e,_0x71ec0e){return function(_0xb738f2){if(_0xb738f2){return _0xb738f2[_0x2685('0x23')](_0x283b2e)['then'](function(_0x38879e){return _0x38879e;});}return null;};}function removeEntity(_0x19dc96,_0x3e3d67){return function(_0x160b02){if(_0x160b02){return _0x160b02['destroy']()['then'](function(){_0x19dc96[_0x2685('0x1a')](0xcc)[_0x2685('0x1b')]();});}};}function handleEntityNotFound(_0x1de531,_0x5c686b){return function(_0xf6220){if(!_0xf6220){_0x1de531[_0x2685('0x19')](0x194);}return _0xf6220;};}function handleError(_0x44c302,_0x881ad){_0x881ad=_0x881ad||0x1f4;return function(_0x4d3f98){logger[_0x2685('0x24')](_0x4d3f98[_0x2685('0x25')]);if(_0x4d3f98['name']){delete _0x4d3f98['name'];}_0x44c302[_0x2685('0x1a')](_0x881ad)[_0x2685('0x26')](_0x4d3f98);};}exports['index']=function(_0x4a9eb2,_0x1bf7d2){var _0x2b7e32={},_0x251f0e={},_0x2264b4={'count':0x0,'rows':[]};var _0x16e3e1=_['map'](db['Dynamics365Configuration'][_0x2685('0x27')],function(_0x72282c){return{'name':_0x72282c[_0x2685('0x28')],'type':_0x72282c['type'][_0x2685('0x29')]};});_0x251f0e[_0x2685('0x2a')]=_[_0x2685('0x2b')](_0x16e3e1,'name');_0x251f0e['query']=_[_0x2685('0x2c')](_0x4a9eb2['query']);_0x251f0e['filters']=_[_0x2685('0x2d')](_0x251f0e['model'],_0x251f0e[_0x2685('0x2e')]);_0x2b7e32[_0x2685('0x2f')]=_[_0x2685('0x2d')](_0x251f0e[_0x2685('0x2a')],qs[_0x2685('0x30')](_0x4a9eb2['query']['fields']));_0x2b7e32[_0x2685('0x2f')]=_0x2b7e32['attributes']['length']?_0x2b7e32[_0x2685('0x2f')]:_0x251f0e[_0x2685('0x2a')];if(!_0x4a9eb2[_0x2685('0x2e')][_0x2685('0x31')](_0x2685('0x32'))){_0x2b7e32[_0x2685('0x1f')]=qs[_0x2685('0x1f')](_0x4a9eb2[_0x2685('0x2e')][_0x2685('0x1f')]);_0x2b7e32[_0x2685('0x1d')]=qs[_0x2685('0x1d')](_0x4a9eb2[_0x2685('0x2e')][_0x2685('0x1d')]);}_0x2b7e32[_0x2685('0x33')]=qs['sort'](_0x4a9eb2[_0x2685('0x2e')]['sort']);_0x2b7e32[_0x2685('0x34')]=qs['filters'](_[_0x2685('0x35')](_0x4a9eb2[_0x2685('0x2e')],_0x251f0e['filters']),_0x16e3e1);if(_0x4a9eb2['query'][_0x2685('0x36')]){_0x2b7e32[_0x2685('0x34')]=_['merge'](_0x2b7e32['where'],{'$or':_[_0x2685('0x2b')](_0x16e3e1,function(_0x36007d){if(_0x36007d[_0x2685('0x37')]!==_0x2685('0x38')){var _0x501443={};_0x501443[_0x36007d['name']]={'$like':'%'+_0x4a9eb2[_0x2685('0x2e')]['filter']+'%'};return _0x501443;}})});}_0x2b7e32=_[_0x2685('0x39')]({},_0x2b7e32,_0x4a9eb2[_0x2685('0x3a')]);var _0x52bbcf={'where':_0x2b7e32[_0x2685('0x34')]};return db[_0x2685('0x3b')]['count'](_0x52bbcf)[_0x2685('0x3c')](function(_0x4b6a0a){_0x2264b4[_0x2685('0x20')]=_0x4b6a0a;if(_0x4a9eb2[_0x2685('0x2e')][_0x2685('0x3d')]){_0x2b7e32[_0x2685('0x3e')]=[{'all':!![]}];}return db[_0x2685('0x3b')]['findAll'](_0x2b7e32);})[_0x2685('0x3c')](function(_0x47469e){_0x2264b4[_0x2685('0x3f')]=_0x47469e;return _0x2264b4;})[_0x2685('0x3c')](respondWithFilteredResult(_0x1bf7d2,_0x2b7e32))[_0x2685('0x40')](handleError(_0x1bf7d2,null));};exports[_0x2685('0x41')]=function(_0x1069c5,_0x588e90){var _0x151726={'raw':![],'where':{'id':_0x1069c5[_0x2685('0x42')]['id']}},_0x53bdd4={};_0x53bdd4[_0x2685('0x2a')]=_['keys'](db[_0x2685('0x3b')][_0x2685('0x27')]);_0x53bdd4[_0x2685('0x2e')]=_[_0x2685('0x2c')](_0x1069c5['query']);_0x53bdd4['filters']=_['intersection'](_0x53bdd4[_0x2685('0x2a')],_0x53bdd4[_0x2685('0x2e')]);_0x151726[_0x2685('0x2f')]=_[_0x2685('0x2d')](_0x53bdd4[_0x2685('0x2a')],qs[_0x2685('0x30')](_0x1069c5['query'][_0x2685('0x30')]));_0x151726['attributes']=_0x151726['attributes'][_0x2685('0x43')]?_0x151726['attributes']:_0x53bdd4[_0x2685('0x2a')];if(_0x1069c5['query'][_0x2685('0x3d')]){_0x151726[_0x2685('0x3e')]=[{'all':!![]}];}_0x151726=_[_0x2685('0x39')]({},_0x151726,_0x1069c5['options']);return db[_0x2685('0x3b')][_0x2685('0x44')](_0x151726)['then'](handleEntityNotFound(_0x588e90,null))[_0x2685('0x3c')](respondWithResult(_0x588e90,null))['catch'](handleError(_0x588e90,null));};exports[_0x2685('0x45')]=function(_0x30580c,_0x1a6055){return db[_0x2685('0x3b')][_0x2685('0x45')](_0x30580c[_0x2685('0x46')],{})['then'](respondWithResult(_0x1a6055,0xc9))[_0x2685('0x40')](handleError(_0x1a6055,null));};exports[_0x2685('0x23')]=function(_0x4ccf93,_0x43ca0b){if(_0x4ccf93[_0x2685('0x46')]['id']){delete _0x4ccf93[_0x2685('0x46')]['id'];}return db[_0x2685('0x3b')][_0x2685('0x44')]({'where':{'id':_0x4ccf93[_0x2685('0x42')]['id']}})[_0x2685('0x3c')](handleEntityNotFound(_0x43ca0b,null))[_0x2685('0x3c')](saveUpdates(_0x4ccf93[_0x2685('0x46')],null))[_0x2685('0x3c')](respondWithResult(_0x43ca0b,null))[_0x2685('0x40')](handleError(_0x43ca0b,null));};exports[_0x2685('0x47')]=function(_0x366d83,_0x48eb51){return db['Dynamics365Configuration']['find']({'where':{'id':_0x366d83[_0x2685('0x42')]['id']}})['then'](handleEntityNotFound(_0x48eb51,null))[_0x2685('0x3c')](removeEntity(_0x48eb51,null))[_0x2685('0x40')](handleError(_0x48eb51,null));};exports[_0x2685('0x48')]=function(_0x6eeb23,_0x43a139,_0xb7c9c2){var _0x3a1d13={};var _0x5100d9={};var _0x3ae475;var _0x15c5b3;return db[_0x2685('0x3b')][_0x2685('0x49')]({'where':{'id':_0x6eeb23[_0x2685('0x42')]['id']}})[_0x2685('0x3c')](handleEntityNotFound(_0x43a139,null))[_0x2685('0x3c')](function(_0x13b877){if(_0x13b877){_0x3ae475=_0x13b877;_0x5100d9[_0x2685('0x2a')]=_[_0x2685('0x2c')](db['Dynamics365Field'][_0x2685('0x27')]);_0x5100d9[_0x2685('0x2e')]=_[_0x2685('0x2c')](_0x6eeb23['query']);_0x5100d9[_0x2685('0x4a')]=_['intersection'](_0x5100d9[_0x2685('0x2a')],_0x5100d9[_0x2685('0x2e')]);_0x3a1d13[_0x2685('0x2f')]=_[_0x2685('0x2d')](_0x5100d9[_0x2685('0x2a')],qs[_0x2685('0x30')](_0x6eeb23[_0x2685('0x2e')]['fields']));_0x3a1d13[_0x2685('0x2f')]=_0x3a1d13[_0x2685('0x2f')][_0x2685('0x43')]?_0x3a1d13['attributes']:_0x5100d9[_0x2685('0x2a')];_0x3a1d13[_0x2685('0x33')]=qs[_0x2685('0x4b')](_0x6eeb23[_0x2685('0x2e')][_0x2685('0x4b')]);_0x3a1d13['where']=qs[_0x2685('0x4a')](_['pick'](_0x6eeb23[_0x2685('0x2e')],_0x5100d9[_0x2685('0x4a')]));if(_0x6eeb23[_0x2685('0x2e')][_0x2685('0x36')]){_0x3a1d13[_0x2685('0x34')]=_[_0x2685('0x39')](_0x3a1d13[_0x2685('0x34')],{'$or':_[_0x2685('0x2b')](_0x3a1d13[_0x2685('0x2f')],function(_0x145937){var _0x5a8f64={};_0x5a8f64[_0x145937]={'$like':'%'+_0x6eeb23[_0x2685('0x2e')][_0x2685('0x36')]+'%'};return _0x5a8f64;})});}_0x3a1d13=_['merge']({},_0x3a1d13,_0x6eeb23[_0x2685('0x3a')]);return _0x3ae475[_0x2685('0x48')](_0x3a1d13);}})[_0x2685('0x3c')](function(_0x190b10){if(_0x190b10){_0x15c5b3=_0x190b10['length'];if(!_0x6eeb23[_0x2685('0x2e')][_0x2685('0x31')](_0x2685('0x32'))){_0x3a1d13[_0x2685('0x1f')]=qs[_0x2685('0x1f')](_0x6eeb23[_0x2685('0x2e')][_0x2685('0x1f')]);_0x3a1d13[_0x2685('0x1d')]=qs[_0x2685('0x1d')](_0x6eeb23[_0x2685('0x2e')][_0x2685('0x1d')]);}return _0x3ae475['getFields'](_0x3a1d13);}})[_0x2685('0x3c')](function(_0x31bb6e){if(_0x31bb6e){return _0x31bb6e?{'count':_0x15c5b3,'rows':_0x31bb6e}:null;}})[_0x2685('0x3c')](respondWithResult(_0x43a139,null))[_0x2685('0x40')](handleError(_0x43a139,null));};exports['getSubjects']=function(_0x573d86,_0x7fe272,_0x27a442){var _0x13efef={};var _0x4b328a={};var _0x5e1e01;var _0x4cf69b;return db[_0x2685('0x3b')][_0x2685('0x49')]({'where':{'id':_0x573d86[_0x2685('0x42')]['id']}})[_0x2685('0x3c')](handleEntityNotFound(_0x7fe272,null))[_0x2685('0x3c')](function(_0x1954e3){if(_0x1954e3){_0x5e1e01=_0x1954e3;_0x4b328a[_0x2685('0x2a')]=_[_0x2685('0x2c')](db[_0x2685('0x4c')][_0x2685('0x27')]);_0x4b328a[_0x2685('0x2e')]=_[_0x2685('0x2c')](_0x573d86[_0x2685('0x2e')]);_0x4b328a['filters']=_[_0x2685('0x2d')](_0x4b328a['model'],_0x4b328a[_0x2685('0x2e')]);_0x13efef['attributes']=_[_0x2685('0x2d')](_0x4b328a['model'],qs[_0x2685('0x30')](_0x573d86['query'][_0x2685('0x30')]));_0x13efef['attributes']=_0x13efef['attributes'][_0x2685('0x43')]?_0x13efef['attributes']:_0x4b328a[_0x2685('0x2a')];_0x13efef[_0x2685('0x33')]=qs['sort'](_0x573d86[_0x2685('0x2e')][_0x2685('0x4b')]);_0x13efef[_0x2685('0x34')]=qs[_0x2685('0x4a')](_[_0x2685('0x35')](_0x573d86[_0x2685('0x2e')],_0x4b328a[_0x2685('0x4a')]));if(_0x573d86[_0x2685('0x2e')][_0x2685('0x36')]){_0x13efef[_0x2685('0x34')]=_[_0x2685('0x39')](_0x13efef['where'],{'$or':_[_0x2685('0x2b')](_0x13efef[_0x2685('0x2f')],function(_0x5beffa){var _0x2743e8={};_0x2743e8[_0x5beffa]={'$like':'%'+_0x573d86[_0x2685('0x2e')][_0x2685('0x36')]+'%'};return _0x2743e8;})});}_0x13efef=_[_0x2685('0x39')]({},_0x13efef,_0x573d86[_0x2685('0x3a')]);return _0x5e1e01[_0x2685('0x4d')](_0x13efef);}})[_0x2685('0x3c')](function(_0x21855a){if(_0x21855a){_0x4cf69b=_0x21855a[_0x2685('0x43')];if(!_0x573d86[_0x2685('0x2e')][_0x2685('0x31')](_0x2685('0x32'))){_0x13efef[_0x2685('0x1f')]=qs[_0x2685('0x1f')](_0x573d86[_0x2685('0x2e')][_0x2685('0x1f')]);_0x13efef[_0x2685('0x1d')]=qs[_0x2685('0x1d')](_0x573d86['query']['offset']);}return _0x5e1e01[_0x2685('0x4d')](_0x13efef);}})['then'](function(_0x2f8871){if(_0x2f8871){return _0x2f8871?{'count':_0x4cf69b,'rows':_0x2f8871}:null;}})['then'](respondWithResult(_0x7fe272,null))['catch'](handleError(_0x7fe272,null));};exports['getDescriptions']=function(_0x4516bf,_0x3c0a0e,_0x4cff8d){var _0x4a83b2={};var _0x387e6d={};var _0x28221f;var _0x34faf0;return db[_0x2685('0x3b')][_0x2685('0x49')]({'where':{'id':_0x4516bf['params']['id']}})[_0x2685('0x3c')](handleEntityNotFound(_0x3c0a0e,null))[_0x2685('0x3c')](function(_0x17475c){if(_0x17475c){_0x28221f=_0x17475c;_0x387e6d[_0x2685('0x2a')]=_['keys'](db['Dynamics365Field'][_0x2685('0x27')]);_0x387e6d[_0x2685('0x2e')]=_[_0x2685('0x2c')](_0x4516bf[_0x2685('0x2e')]);_0x387e6d['filters']=_['intersection'](_0x387e6d[_0x2685('0x2a')],_0x387e6d[_0x2685('0x2e')]);_0x4a83b2[_0x2685('0x2f')]=_[_0x2685('0x2d')](_0x387e6d[_0x2685('0x2a')],qs['fields'](_0x4516bf[_0x2685('0x2e')][_0x2685('0x30')]));_0x4a83b2[_0x2685('0x2f')]=_0x4a83b2[_0x2685('0x2f')]['length']?_0x4a83b2['attributes']:_0x387e6d[_0x2685('0x2a')];_0x4a83b2[_0x2685('0x33')]=qs[_0x2685('0x4b')](_0x4516bf[_0x2685('0x2e')][_0x2685('0x4b')]);_0x4a83b2[_0x2685('0x34')]=qs['filters'](_[_0x2685('0x35')](_0x4516bf[_0x2685('0x2e')],_0x387e6d[_0x2685('0x4a')]));if(_0x4516bf['query'][_0x2685('0x36')]){_0x4a83b2[_0x2685('0x34')]=_['merge'](_0x4a83b2[_0x2685('0x34')],{'$or':_['map'](_0x4a83b2['attributes'],function(_0x18ddcd){var _0x21e3ef={};_0x21e3ef[_0x18ddcd]={'$like':'%'+_0x4516bf['query'][_0x2685('0x36')]+'%'};return _0x21e3ef;})});}_0x4a83b2=_['merge']({},_0x4a83b2,_0x4516bf[_0x2685('0x3a')]);return _0x28221f['getDescriptions'](_0x4a83b2);}})[_0x2685('0x3c')](function(_0x176dc5){if(_0x176dc5){_0x34faf0=_0x176dc5[_0x2685('0x43')];if(!_0x4516bf[_0x2685('0x2e')][_0x2685('0x31')](_0x2685('0x32'))){_0x4a83b2[_0x2685('0x1f')]=qs['limit'](_0x4516bf[_0x2685('0x2e')][_0x2685('0x1f')]);_0x4a83b2['offset']=qs[_0x2685('0x1d')](_0x4516bf[_0x2685('0x2e')]['offset']);}return _0x28221f[_0x2685('0x4e')](_0x4a83b2);}})[_0x2685('0x3c')](function(_0x10e09f){if(_0x10e09f){return _0x10e09f?{'count':_0x34faf0,'rows':_0x10e09f}:null;}})['then'](respondWithResult(_0x3c0a0e,null))[_0x2685('0x40')](handleError(_0x3c0a0e,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 1fa2533..ae9c658 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 _0xa41a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','int_dynamics365_configurations','lodash','util','api'];(function(_0x45739d,_0x2de7df){var _0x2247df=function(_0x1ffdf3){while(--_0x1ffdf3){_0x45739d['push'](_0x45739d['shift']());}};_0x2247df(++_0x2de7df);}(_0xa41a,0x6b));var _0xaa41=function(_0x241c47,_0x17b6f4){_0x241c47=_0x241c47-0x0;var _0x361b5a=_0xa41a[_0x241c47];return _0x361b5a;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var logger=require('../../config/logger')(_0xaa41('0x2'));var moment=require(_0xaa41('0x3'));var BPromise=require(_0xaa41('0x4'));var rp=require(_0xaa41('0x5'));var fs=require('fs');var path=require(_0xaa41('0x6'));var rimraf=require(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var attributes=require(_0xaa41('0x9'));module['exports']=function(_0x2122a0,_0x1ec9d4){return _0x2122a0['define']('Dynamics365Configuration',attributes,{'tableName':_0xaa41('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb821=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util','../../config/logger','bluebird'];(function(_0x4d62a2,_0x50e7fd){var _0x2bb49d=function(_0x50cf88){while(--_0x50cf88){_0x4d62a2['push'](_0x4d62a2['shift']());}};_0x2bb49d(++_0x50e7fd);}(_0xb821,0xa7));var _0x1b82=function(_0x46470c,_0x31243d){_0x46470c=_0x46470c-0x0;var _0x2d9258=_0xb821[_0x46470c];return _0x2d9258;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b82('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var attributes=require(_0x1b82('0x5'));module[_0x1b82('0x6')]=function(_0x597ca7,_0x3e27c4){return _0x597ca7[_0x1b82('0x7')](_0x1b82('0x8'),attributes,{'tableName':_0x1b82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 9cd4342..6669c8c 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 _0x3853=['error','code','message','catch','util','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5eb182,_0x118510){var _0xa99c78=function(_0x24d504){while(--_0x24d504){_0x5eb182['push'](_0x5eb182['shift']());}};_0xa99c78(++_0x118510);}(_0x3853,0x12a));var _0x3385=function(_0x2cf3c4,_0x476354){_0x2cf3c4=_0x2cf3c4-0x0;var _0x4c898f=_0x3853[_0x2cf3c4];return _0x4c898f;};'use strict';var _=require('lodash');var util=require(_0x3385('0x0'));var moment=require('moment');var BPromise=require(_0x3385('0x1'));var rs=require(_0x3385('0x2'));var fs=require('fs');var Redis=require(_0x3385('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3385('0x4'));var config=require(_0x3385('0x5'));var jayson=require(_0x3385('0x6'));var client=jayson[_0x3385('0x7')][_0x3385('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x107be2,_0x409cc7,_0x58c0d1){return new BPromise(function(_0x571bc5,_0x275f70){return client[_0x3385('0x9')](_0x107be2,_0x58c0d1)[_0x3385('0xa')](function(_0xe7d190){logger[_0x3385('0xb')](_0x3385('0xc'),_0x409cc7,'request\x20sent');logger[_0x3385('0xd')](_0x3385('0xe'),_0x409cc7,_0x3385('0xf'),JSON[_0x3385('0x10')](_0xe7d190));if(_0xe7d190['error']){if(_0xe7d190[_0x3385('0x11')][_0x3385('0x12')]===0x1f4){logger[_0x3385('0x11')](_0x3385('0xc'),_0x409cc7,_0xe7d190['error'][_0x3385('0x13')]);return _0x275f70(_0xe7d190['error']['message']);}logger[_0x3385('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x409cc7,_0xe7d190[_0x3385('0x11')][_0x3385('0x13')]);return _0x571bc5(_0xe7d190[_0x3385('0x11')]['message']);}else{logger[_0x3385('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0x409cc7,_0x3385('0xf'));_0x571bc5(_0xe7d190['result'][_0x3385('0x13')]);}})[_0x3385('0x14')](function(_0x898065){logger[_0x3385('0x11')](_0x3385('0xc'),_0x409cc7,_0x898065);_0x275f70(_0x898065);});});} \ No newline at end of file +var _0xf1d8=['request\x20sent','debug','stringify','error','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','info','Dynamics365Configuration,\x20%s,\x20%s'];(function(_0x4b2a2c,_0x4051ed){var _0x9146f4=function(_0x3a2772){while(--_0x3a2772){_0x4b2a2c['push'](_0x4b2a2c['shift']());}};_0x9146f4(++_0x4051ed);}(_0xf1d8,0x180));var _0x8f1d=function(_0x43d16c,_0x2b5447){_0x43d16c=_0x43d16c-0x0;var _0x208cce=_0xf1d8[_0x43d16c];return _0x208cce;};'use strict';var _=require('lodash');var util=require(_0x8f1d('0x0'));var moment=require(_0x8f1d('0x1'));var BPromise=require(_0x8f1d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8f1d('0x3'));var db=require(_0x8f1d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8f1d('0x5'))('rpc');var config=require(_0x8f1d('0x6'));var jayson=require(_0x8f1d('0x7'));var client=jayson['client'][_0x8f1d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4f29f2,_0x38efc1,_0x414c26){return new BPromise(function(_0x50a755,_0x2aa4e9){return client[_0x8f1d('0x9')](_0x4f29f2,_0x414c26)['then'](function(_0x6f13be){logger[_0x8f1d('0xa')](_0x8f1d('0xb'),_0x38efc1,_0x8f1d('0xc'));logger[_0x8f1d('0xd')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x38efc1,'request\x20sent',JSON[_0x8f1d('0xe')](_0x6f13be));if(_0x6f13be[_0x8f1d('0xf')]){if(_0x6f13be['error']['code']===0x1f4){logger['error'](_0x8f1d('0xb'),_0x38efc1,_0x6f13be['error'][_0x8f1d('0x10')]);return _0x2aa4e9(_0x6f13be['error'][_0x8f1d('0x10')]);}logger[_0x8f1d('0xf')](_0x8f1d('0xb'),_0x38efc1,_0x6f13be['error']['message']);return _0x50a755(_0x6f13be[_0x8f1d('0xf')][_0x8f1d('0x10')]);}else{logger[_0x8f1d('0xa')](_0x8f1d('0xb'),_0x38efc1,_0x8f1d('0xc'));_0x50a755(_0x6f13be['result'][_0x8f1d('0x10')]);}})[_0x8f1d('0x11')](function(_0x4556f3){logger[_0x8f1d('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x38efc1,_0x4556f3);_0x2aa4e9(_0x4556f3);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 5608524..3cf63ae 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 _0x7c2f=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','create','delete','destroy','exports','multer','util'];(function(_0x3f5619,_0x3de345){var _0x5428cb=function(_0x3819aa){while(--_0x3819aa){_0x3f5619['push'](_0x3f5619['shift']());}};_0x5428cb(++_0x3de345);}(_0x7c2f,0x18e));var _0xf7c2=function(_0x3d4a1b,_0x198962){_0x3d4a1b=_0x3d4a1b-0x0;var _0x2ed213=_0x7c2f[_0x3d4a1b];return _0x2ed213;};'use strict';var multer=require(_0xf7c2('0x0'));var util=require(_0xf7c2('0x1'));var path=require(_0xf7c2('0x2'));var timeout=require(_0xf7c2('0x3'));var express=require(_0xf7c2('0x4'));var router=express[_0xf7c2('0x5')]();var fs_extra=require(_0xf7c2('0x6'));var auth=require(_0xf7c2('0x7'));var interaction=require(_0xf7c2('0x8'));var config=require('../../config/environment');var controller=require(_0xf7c2('0x9'));router[_0xf7c2('0xa')]('/',auth[_0xf7c2('0xb')](),controller[_0xf7c2('0xc')]);router['get'](_0xf7c2('0xd'),auth['isAuthenticated'](),controller[_0xf7c2('0xe')]);router[_0xf7c2('0xf')]('/',auth[_0xf7c2('0xb')](),controller[_0xf7c2('0x10')]);router['put'](_0xf7c2('0xd'),auth[_0xf7c2('0xb')](),controller['update']);router[_0xf7c2('0x11')](_0xf7c2('0xd'),auth[_0xf7c2('0xb')](),controller[_0xf7c2('0x12')]);module[_0xf7c2('0x13')]=router; \ No newline at end of file +var _0x4ad0=['express','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x1bff41,_0x386880){var _0x4db66b=function(_0x5aa7b6){while(--_0x5aa7b6){_0x1bff41['push'](_0x1bff41['shift']());}};_0x4db66b(++_0x386880);}(_0x4ad0,0xc2));var _0x04ad=function(_0x124921,_0x36596b){_0x124921=_0x124921-0x0;var _0x2fd6a9=_0x4ad0[_0x124921];return _0x2fd6a9;};'use strict';var multer=require(_0x04ad('0x0'));var util=require(_0x04ad('0x1'));var path=require(_0x04ad('0x2'));var timeout=require(_0x04ad('0x3'));var express=require(_0x04ad('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x04ad('0x5'));var config=require(_0x04ad('0x6'));var controller=require(_0x04ad('0x7'));router[_0x04ad('0x8')]('/',auth[_0x04ad('0x9')](),controller[_0x04ad('0xa')]);router[_0x04ad('0x8')]('/:id',auth[_0x04ad('0x9')](),controller[_0x04ad('0xb')]);router[_0x04ad('0xc')]('/',auth[_0x04ad('0x9')](),controller['create']);router[_0x04ad('0xd')](_0x04ad('0xe'),auth[_0x04ad('0x9')](),controller[_0x04ad('0xf')]);router[_0x04ad('0x10')]('/:id',auth[_0x04ad('0x9')](),controller['destroy']);module[_0x04ad('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 29861e8..db1c1d4 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 _0xa52b=['keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x413b45,_0x282bb0){var _0x3ea265=function(_0x512a6f){while(--_0x512a6f){_0x413b45['push'](_0x413b45['shift']());}};_0x3ea265(++_0x282bb0);}(_0xa52b,0x1e9));var _0xba52=function(_0x4f51da,_0x3c7442){_0x4f51da=_0x4f51da-0x0;var _0x2d8c69=_0xa52b[_0x4f51da];return _0x2d8c69;};'use strict';var Sequelize=require(_0xba52('0x0'));module[_0xba52('0x1')]={'type':{'type':Sequelize[_0xba52('0x2')](_0xba52('0x3'),_0xba52('0x4'),_0xba52('0x5'),_0xba52('0x6'),_0xba52('0x7')),'defaultValue':_0xba52('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xba52('0x8')]},'keyType':{'type':Sequelize[_0xba52('0x2')](_0xba52('0x3'),_0xba52('0x4'),_0xba52('0x5'))},'keyContent':{'type':Sequelize[_0xba52('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xba52('0x8')]}}; \ No newline at end of file +var _0x1ae4=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x49d0b0,_0x3faeb4){var _0x2dd6d3=function(_0x2b97ed){while(--_0x2b97ed){_0x49d0b0['push'](_0x49d0b0['shift']());}};_0x2dd6d3(++_0x3faeb4);}(_0x1ae4,0x19b));var _0x41ae=function(_0xe7d0aa,_0x123763){_0xe7d0aa=_0xe7d0aa-0x0;var _0x3f0e40=_0x1ae4[_0xe7d0aa];return _0x3f0e40;};'use strict';var Sequelize=require(_0x41ae('0x0'));module[_0x41ae('0x1')]={'type':{'type':Sequelize[_0x41ae('0x2')](_0x41ae('0x3'),_0x41ae('0x4'),_0x41ae('0x5'),_0x41ae('0x6'),'picklist'),'defaultValue':_0x41ae('0x3')},'content':{'type':Sequelize[_0x41ae('0x7')]},'key':{'type':Sequelize[_0x41ae('0x7')]},'keyType':{'type':Sequelize[_0x41ae('0x2')](_0x41ae('0x3'),_0x41ae('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x41ae('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x41ae('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index e7ba4b9..32a5d1a 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 _0xdbc0=['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','count','limit','set','reject','save','then','destroy','error','stack','name','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','update','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce'];(function(_0x25e78f,_0x1a678e){var _0x21d3ea=function(_0x16fc99){while(--_0x16fc99){_0x25e78f['push'](_0x25e78f['shift']());}};_0x21d3ea(++_0x1a678e);}(_0xdbc0,0x15f));var _0x0dbc=function(_0x2dffff,_0x2ae95a){_0x2dffff=_0x2dffff-0x0;var _0x452114=_0xdbc0[_0x2dffff];return _0x452114;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0dbc('0x0'));var jsonpatch=require(_0x0dbc('0x1'));var rp=require('request-promise');var moment=require(_0x0dbc('0x2'));var BPromise=require(_0x0dbc('0x3'));var Mustache=require(_0x0dbc('0x4'));var util=require(_0x0dbc('0x5'));var path=require(_0x0dbc('0x6'));var sox=require(_0x0dbc('0x7'));var csv=require(_0x0dbc('0x8'));var ejs=require(_0x0dbc('0x9'));var fs=require('fs');var fs_extra=require(_0x0dbc('0xa'));var _=require('lodash');var squel=require(_0x0dbc('0xb'));var crypto=require(_0x0dbc('0xc'));var jsforce=require(_0x0dbc('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0dbc('0x8'));var querystring=require(_0x0dbc('0xe'));var Papa=require(_0x0dbc('0xf'));var Redis=require(_0x0dbc('0x10'));var authService=require(_0x0dbc('0x11'));var qs=require(_0x0dbc('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0dbc('0x13'));var logger=require(_0x0dbc('0x14'))(_0x0dbc('0x15'));var utils=require(_0x0dbc('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0dbc('0x17'));var db=require(_0x0dbc('0x18'))['db'];function respondWithStatusCode(_0x5df41c,_0x5806bf){_0x5806bf=_0x5806bf||0xcc;return function(_0x18ac55){if(_0x18ac55){return _0x5df41c[_0x0dbc('0x19')](_0x5806bf);}return _0x5df41c[_0x0dbc('0x1a')](_0x5806bf)[_0x0dbc('0x1b')]();};}function respondWithResult(_0x2409c1,_0x586fdf){_0x586fdf=_0x586fdf||0xc8;return function(_0x17898d){if(_0x17898d){return _0x2409c1[_0x0dbc('0x1a')](_0x586fdf)[_0x0dbc('0x1c')](_0x17898d);}};}function respondWithFilteredResult(_0x5d9b7b,_0x3f5a73){return function(_0xeda680){if(_0xeda680){var _0x3b0d25=typeof _0x3f5a73[_0x0dbc('0x1d')]==='undefined'&&typeof _0x3f5a73['limit']==='undefined';var _0x3c1102=_0xeda680['count'];var _0x169c1a=_0x3b0d25?0x0:_0x3f5a73['offset'];var _0x5a127e=_0x3b0d25?_0xeda680[_0x0dbc('0x1e')]:_0x3f5a73['offset']+_0x3f5a73[_0x0dbc('0x1f')];var _0x148890;if(_0x5a127e>=_0x3c1102){_0x5a127e=_0x3c1102;_0x148890=0xc8;}else{_0x148890=0xce;}_0x5d9b7b[_0x0dbc('0x1a')](_0x148890);return _0x5d9b7b[_0x0dbc('0x20')]('Content-Range',_0x169c1a+'-'+_0x5a127e+'/'+_0x3c1102)[_0x0dbc('0x1c')](_0xeda680);}return null;};}function patchUpdates(_0x2202c9){return function(_0x26cace){try{jsonpatch['apply'](_0x26cace,_0x2202c9,!![]);}catch(_0x4e7fea){return BPromise[_0x0dbc('0x21')](_0x4e7fea);}return _0x26cace[_0x0dbc('0x22')]();};}function saveUpdates(_0x59c3d0,_0x5a37b7){return function(_0x2a8885){if(_0x2a8885){return _0x2a8885['update'](_0x59c3d0)[_0x0dbc('0x23')](function(_0x1f72c9){return _0x1f72c9;});}return null;};}function removeEntity(_0x38e784,_0x4f76b8){return function(_0x26ece3){if(_0x26ece3){return _0x26ece3[_0x0dbc('0x24')]()['then'](function(){_0x38e784['status'](0xcc)[_0x0dbc('0x1b')]();});}};}function handleEntityNotFound(_0x28e455,_0xcc6f65){return function(_0x516958){if(!_0x516958){_0x28e455['sendStatus'](0x194);}return _0x516958;};}function handleError(_0x133dc4,_0x550ba9){_0x550ba9=_0x550ba9||0x1f4;return function(_0x41459e){logger[_0x0dbc('0x25')](_0x41459e[_0x0dbc('0x26')]);if(_0x41459e['name']){delete _0x41459e[_0x0dbc('0x27')];}_0x133dc4[_0x0dbc('0x1a')](_0x550ba9)['send'](_0x41459e);};}exports['index']=function(_0x4155a2,_0x22aad9){var _0x5f3bb4={},_0x3e3f21={},_0x5e63d3={'count':0x0,'rows':[]};var _0x6ecfc=_[_0x0dbc('0x28')](db[_0x0dbc('0x29')][_0x0dbc('0x2a')],function(_0xb23043){return{'name':_0xb23043[_0x0dbc('0x2b')],'type':_0xb23043[_0x0dbc('0x2c')][_0x0dbc('0x2d')]};});_0x3e3f21[_0x0dbc('0x2e')]=_[_0x0dbc('0x28')](_0x6ecfc,_0x0dbc('0x27'));_0x3e3f21['query']=_[_0x0dbc('0x2f')](_0x4155a2[_0x0dbc('0x30')]);_0x3e3f21[_0x0dbc('0x31')]=_[_0x0dbc('0x32')](_0x3e3f21['model'],_0x3e3f21['query']);_0x5f3bb4[_0x0dbc('0x33')]=_[_0x0dbc('0x32')](_0x3e3f21[_0x0dbc('0x2e')],qs['fields'](_0x4155a2[_0x0dbc('0x30')][_0x0dbc('0x34')]));_0x5f3bb4[_0x0dbc('0x33')]=_0x5f3bb4[_0x0dbc('0x33')][_0x0dbc('0x35')]?_0x5f3bb4['attributes']:_0x3e3f21[_0x0dbc('0x2e')];if(!_0x4155a2[_0x0dbc('0x30')][_0x0dbc('0x36')]('nolimit')){_0x5f3bb4[_0x0dbc('0x1f')]=qs[_0x0dbc('0x1f')](_0x4155a2[_0x0dbc('0x30')][_0x0dbc('0x1f')]);_0x5f3bb4['offset']=qs[_0x0dbc('0x1d')](_0x4155a2[_0x0dbc('0x30')][_0x0dbc('0x1d')]);}_0x5f3bb4[_0x0dbc('0x37')]=qs[_0x0dbc('0x38')](_0x4155a2['query'][_0x0dbc('0x38')]);_0x5f3bb4['where']=qs[_0x0dbc('0x31')](_[_0x0dbc('0x39')](_0x4155a2[_0x0dbc('0x30')],_0x3e3f21[_0x0dbc('0x31')]),_0x6ecfc);if(_0x4155a2[_0x0dbc('0x30')][_0x0dbc('0x3a')]){_0x5f3bb4[_0x0dbc('0x3b')]=_['merge'](_0x5f3bb4[_0x0dbc('0x3b')],{'$or':_[_0x0dbc('0x28')](_0x6ecfc,function(_0x3ae801){if(_0x3ae801[_0x0dbc('0x2c')]!=='VIRTUAL'){var _0x3a04af={};_0x3a04af[_0x3ae801[_0x0dbc('0x27')]]={'$like':'%'+_0x4155a2[_0x0dbc('0x30')][_0x0dbc('0x3a')]+'%'};return _0x3a04af;}})});}_0x5f3bb4=_[_0x0dbc('0x3c')]({},_0x5f3bb4,_0x4155a2['options']);var _0x5a89de={'where':_0x5f3bb4[_0x0dbc('0x3b')]};return db[_0x0dbc('0x29')][_0x0dbc('0x1e')](_0x5a89de)[_0x0dbc('0x23')](function(_0x45464c){_0x5e63d3[_0x0dbc('0x1e')]=_0x45464c;if(_0x4155a2[_0x0dbc('0x30')][_0x0dbc('0x3d')]){_0x5f3bb4[_0x0dbc('0x3e')]=[{'all':!![]}];}return db[_0x0dbc('0x29')][_0x0dbc('0x3f')](_0x5f3bb4);})[_0x0dbc('0x23')](function(_0x3072a8){_0x5e63d3[_0x0dbc('0x40')]=_0x3072a8;return _0x5e63d3;})[_0x0dbc('0x23')](respondWithFilteredResult(_0x22aad9,_0x5f3bb4))['catch'](handleError(_0x22aad9,null));};exports[_0x0dbc('0x41')]=function(_0xce626b,_0x30158b){var _0x3f3bfb={'raw':!![],'where':{'id':_0xce626b[_0x0dbc('0x42')]['id']}},_0x27d414={};_0x27d414[_0x0dbc('0x2e')]=_['keys'](db[_0x0dbc('0x29')]['rawAttributes']);_0x27d414[_0x0dbc('0x30')]=_[_0x0dbc('0x2f')](_0xce626b[_0x0dbc('0x30')]);_0x27d414[_0x0dbc('0x31')]=_[_0x0dbc('0x32')](_0x27d414[_0x0dbc('0x2e')],_0x27d414[_0x0dbc('0x30')]);_0x3f3bfb[_0x0dbc('0x33')]=_[_0x0dbc('0x32')](_0x27d414['model'],qs[_0x0dbc('0x34')](_0xce626b[_0x0dbc('0x30')][_0x0dbc('0x34')]));_0x3f3bfb[_0x0dbc('0x33')]=_0x3f3bfb[_0x0dbc('0x33')][_0x0dbc('0x35')]?_0x3f3bfb[_0x0dbc('0x33')]:_0x27d414[_0x0dbc('0x2e')];if(_0xce626b['query'][_0x0dbc('0x3d')]){_0x3f3bfb[_0x0dbc('0x3e')]=[{'all':!![]}];}_0x3f3bfb=_[_0x0dbc('0x3c')]({},_0x3f3bfb,_0xce626b[_0x0dbc('0x43')]);return db[_0x0dbc('0x29')][_0x0dbc('0x44')](_0x3f3bfb)[_0x0dbc('0x23')](handleEntityNotFound(_0x30158b,null))['then'](respondWithResult(_0x30158b,null))[_0x0dbc('0x45')](handleError(_0x30158b,null));};exports[_0x0dbc('0x46')]=function(_0x441349,_0xcfe6a8){return db[_0x0dbc('0x29')][_0x0dbc('0x46')](_0x441349[_0x0dbc('0x47')],{})[_0x0dbc('0x23')](respondWithResult(_0xcfe6a8,0xc9))[_0x0dbc('0x45')](handleError(_0xcfe6a8,null));};exports[_0x0dbc('0x48')]=function(_0x35c95b,_0x27ab0f){if(_0x35c95b[_0x0dbc('0x47')]['id']){delete _0x35c95b[_0x0dbc('0x47')]['id'];}return db['Dynamics365Field']['find']({'where':{'id':_0x35c95b[_0x0dbc('0x42')]['id']}})[_0x0dbc('0x23')](handleEntityNotFound(_0x27ab0f,null))[_0x0dbc('0x23')](saveUpdates(_0x35c95b['body'],null))['then'](respondWithResult(_0x27ab0f,null))[_0x0dbc('0x45')](handleError(_0x27ab0f,null));};exports[_0x0dbc('0x24')]=function(_0x250735,_0x2b138d){return db['Dynamics365Field'][_0x0dbc('0x44')]({'where':{'id':_0x250735[_0x0dbc('0x42')]['id']}})['then'](handleEntityNotFound(_0x2b138d,null))[_0x0dbc('0x23')](removeEntity(_0x2b138d,null))[_0x0dbc('0x45')](handleError(_0x2b138d,null));}; \ No newline at end of file +var _0xdcf8=['util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0xa80d06,_0x555696){var _0x5e8a1d=function(_0x124797){while(--_0x124797){_0xa80d06['push'](_0xa80d06['shift']());}};_0x5e8a1d(++_0x555696);}(_0xdcf8,0xe3));var _0x8dcf=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xdcf8[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0x8dcf('0x0'));var rimraf=require(_0x8dcf('0x1'));var zipdir=require(_0x8dcf('0x2'));var jsonpatch=require(_0x8dcf('0x3'));var rp=require(_0x8dcf('0x4'));var moment=require(_0x8dcf('0x5'));var BPromise=require(_0x8dcf('0x6'));var Mustache=require('mustache');var util=require(_0x8dcf('0x7'));var path=require('path');var sox=require(_0x8dcf('0x8'));var csv=require(_0x8dcf('0x9'));var ejs=require(_0x8dcf('0xa'));var fs=require('fs');var fs_extra=require(_0x8dcf('0xb'));var _=require('lodash');var squel=require(_0x8dcf('0xc'));var crypto=require(_0x8dcf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8dcf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8dcf('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8dcf('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8dcf('0x11'));var hardwareService=require(_0x8dcf('0x12'));var logger=require(_0x8dcf('0x13'))(_0x8dcf('0x14'));var utils=require(_0x8dcf('0x15'));var config=require(_0x8dcf('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8dcf('0x17'))['db'];function respondWithStatusCode(_0x36f26d,_0x5cf180){_0x5cf180=_0x5cf180||0xcc;return function(_0x182c21){if(_0x182c21){return _0x36f26d[_0x8dcf('0x18')](_0x5cf180);}return _0x36f26d['status'](_0x5cf180)[_0x8dcf('0x19')]();};}function respondWithResult(_0xa15bca,_0x42011d){_0x42011d=_0x42011d||0xc8;return function(_0x39e2a9){if(_0x39e2a9){return _0xa15bca[_0x8dcf('0x1a')](_0x42011d)[_0x8dcf('0x1b')](_0x39e2a9);}};}function respondWithFilteredResult(_0x43d7a7,_0x189950){return function(_0x25a5e8){if(_0x25a5e8){var _0x44fccf=typeof _0x189950[_0x8dcf('0x1c')]===_0x8dcf('0x1d')&&typeof _0x189950[_0x8dcf('0x1e')]===_0x8dcf('0x1d');var _0x33a97c=_0x25a5e8[_0x8dcf('0x1f')];var _0xc37df4=_0x44fccf?0x0:_0x189950['offset'];var _0x115fca=_0x44fccf?_0x25a5e8[_0x8dcf('0x1f')]:_0x189950[_0x8dcf('0x1c')]+_0x189950[_0x8dcf('0x1e')];var _0x24e605;if(_0x115fca>=_0x33a97c){_0x115fca=_0x33a97c;_0x24e605=0xc8;}else{_0x24e605=0xce;}_0x43d7a7[_0x8dcf('0x1a')](_0x24e605);return _0x43d7a7[_0x8dcf('0x20')](_0x8dcf('0x21'),_0xc37df4+'-'+_0x115fca+'/'+_0x33a97c)['json'](_0x25a5e8);}return null;};}function patchUpdates(_0x7b77b0){return function(_0x2551bb){try{jsonpatch[_0x8dcf('0x22')](_0x2551bb,_0x7b77b0,!![]);}catch(_0x2a255a){return BPromise[_0x8dcf('0x23')](_0x2a255a);}return _0x2551bb[_0x8dcf('0x24')]();};}function saveUpdates(_0x45f9f2,_0x12d23d){return function(_0x1d3e2d){if(_0x1d3e2d){return _0x1d3e2d[_0x8dcf('0x25')](_0x45f9f2)[_0x8dcf('0x26')](function(_0x3066ff){return _0x3066ff;});}return null;};}function removeEntity(_0x170ab4,_0xbd2aa9){return function(_0x643b17){if(_0x643b17){return _0x643b17[_0x8dcf('0x27')]()['then'](function(){_0x170ab4[_0x8dcf('0x1a')](0xcc)[_0x8dcf('0x19')]();});}};}function handleEntityNotFound(_0x2779d8,_0x2fd9a6){return function(_0x5e880c){if(!_0x5e880c){_0x2779d8[_0x8dcf('0x18')](0x194);}return _0x5e880c;};}function handleError(_0x58e06f,_0x2a96a9){_0x2a96a9=_0x2a96a9||0x1f4;return function(_0x355a91){logger[_0x8dcf('0x28')](_0x355a91[_0x8dcf('0x29')]);if(_0x355a91[_0x8dcf('0x2a')]){delete _0x355a91[_0x8dcf('0x2a')];}_0x58e06f[_0x8dcf('0x1a')](_0x2a96a9)[_0x8dcf('0x2b')](_0x355a91);};}exports['index']=function(_0x36b66d,_0x2287bb){var _0x18a414={},_0x28feff={},_0x1ff9d3={'count':0x0,'rows':[]};var _0x5b07df=_[_0x8dcf('0x2c')](db[_0x8dcf('0x2d')][_0x8dcf('0x2e')],function(_0x59805a){return{'name':_0x59805a[_0x8dcf('0x2f')],'type':_0x59805a[_0x8dcf('0x30')][_0x8dcf('0x31')]};});_0x28feff[_0x8dcf('0x32')]=_[_0x8dcf('0x2c')](_0x5b07df,_0x8dcf('0x2a'));_0x28feff[_0x8dcf('0x33')]=_[_0x8dcf('0x34')](_0x36b66d['query']);_0x28feff[_0x8dcf('0x35')]=_[_0x8dcf('0x36')](_0x28feff[_0x8dcf('0x32')],_0x28feff[_0x8dcf('0x33')]);_0x18a414[_0x8dcf('0x37')]=_[_0x8dcf('0x36')](_0x28feff[_0x8dcf('0x32')],qs[_0x8dcf('0x38')](_0x36b66d[_0x8dcf('0x33')]['fields']));_0x18a414[_0x8dcf('0x37')]=_0x18a414[_0x8dcf('0x37')][_0x8dcf('0x39')]?_0x18a414['attributes']:_0x28feff['model'];if(!_0x36b66d[_0x8dcf('0x33')][_0x8dcf('0x3a')](_0x8dcf('0x3b'))){_0x18a414['limit']=qs['limit'](_0x36b66d[_0x8dcf('0x33')][_0x8dcf('0x1e')]);_0x18a414[_0x8dcf('0x1c')]=qs[_0x8dcf('0x1c')](_0x36b66d[_0x8dcf('0x33')][_0x8dcf('0x1c')]);}_0x18a414[_0x8dcf('0x3c')]=qs[_0x8dcf('0x3d')](_0x36b66d['query']['sort']);_0x18a414['where']=qs[_0x8dcf('0x35')](_[_0x8dcf('0x3e')](_0x36b66d[_0x8dcf('0x33')],_0x28feff['filters']),_0x5b07df);if(_0x36b66d[_0x8dcf('0x33')][_0x8dcf('0x3f')]){_0x18a414[_0x8dcf('0x40')]=_[_0x8dcf('0x41')](_0x18a414[_0x8dcf('0x40')],{'$or':_[_0x8dcf('0x2c')](_0x5b07df,function(_0x108409){if(_0x108409[_0x8dcf('0x30')]!==_0x8dcf('0x42')){var _0x40fd5f={};_0x40fd5f[_0x108409['name']]={'$like':'%'+_0x36b66d['query'][_0x8dcf('0x3f')]+'%'};return _0x40fd5f;}})});}_0x18a414=_[_0x8dcf('0x41')]({},_0x18a414,_0x36b66d[_0x8dcf('0x43')]);var _0x3e7dca={'where':_0x18a414[_0x8dcf('0x40')]};return db[_0x8dcf('0x2d')]['count'](_0x3e7dca)[_0x8dcf('0x26')](function(_0x2ee746){_0x1ff9d3['count']=_0x2ee746;if(_0x36b66d[_0x8dcf('0x33')][_0x8dcf('0x44')]){_0x18a414[_0x8dcf('0x45')]=[{'all':!![]}];}return db[_0x8dcf('0x2d')][_0x8dcf('0x46')](_0x18a414);})['then'](function(_0x318eac){_0x1ff9d3[_0x8dcf('0x47')]=_0x318eac;return _0x1ff9d3;})[_0x8dcf('0x26')](respondWithFilteredResult(_0x2287bb,_0x18a414))[_0x8dcf('0x48')](handleError(_0x2287bb,null));};exports[_0x8dcf('0x49')]=function(_0x2a83b9,_0x3c08cc){var _0xc8b11b={'raw':!![],'where':{'id':_0x2a83b9[_0x8dcf('0x4a')]['id']}},_0x438d46={};_0x438d46[_0x8dcf('0x32')]=_[_0x8dcf('0x34')](db['Dynamics365Field'][_0x8dcf('0x2e')]);_0x438d46[_0x8dcf('0x33')]=_[_0x8dcf('0x34')](_0x2a83b9['query']);_0x438d46['filters']=_[_0x8dcf('0x36')](_0x438d46[_0x8dcf('0x32')],_0x438d46[_0x8dcf('0x33')]);_0xc8b11b['attributes']=_[_0x8dcf('0x36')](_0x438d46[_0x8dcf('0x32')],qs[_0x8dcf('0x38')](_0x2a83b9[_0x8dcf('0x33')][_0x8dcf('0x38')]));_0xc8b11b[_0x8dcf('0x37')]=_0xc8b11b[_0x8dcf('0x37')][_0x8dcf('0x39')]?_0xc8b11b[_0x8dcf('0x37')]:_0x438d46[_0x8dcf('0x32')];if(_0x2a83b9[_0x8dcf('0x33')][_0x8dcf('0x44')]){_0xc8b11b[_0x8dcf('0x45')]=[{'all':!![]}];}_0xc8b11b=_[_0x8dcf('0x41')]({},_0xc8b11b,_0x2a83b9[_0x8dcf('0x43')]);return db[_0x8dcf('0x2d')][_0x8dcf('0x4b')](_0xc8b11b)[_0x8dcf('0x26')](handleEntityNotFound(_0x3c08cc,null))[_0x8dcf('0x26')](respondWithResult(_0x3c08cc,null))[_0x8dcf('0x48')](handleError(_0x3c08cc,null));};exports[_0x8dcf('0x4c')]=function(_0x260f85,_0x547c98){return db[_0x8dcf('0x2d')][_0x8dcf('0x4c')](_0x260f85['body'],{})[_0x8dcf('0x26')](respondWithResult(_0x547c98,0xc9))[_0x8dcf('0x48')](handleError(_0x547c98,null));};exports[_0x8dcf('0x25')]=function(_0x1831cb,_0x5c13aa){if(_0x1831cb[_0x8dcf('0x4d')]['id']){delete _0x1831cb[_0x8dcf('0x4d')]['id'];}return db[_0x8dcf('0x2d')][_0x8dcf('0x4b')]({'where':{'id':_0x1831cb['params']['id']}})[_0x8dcf('0x26')](handleEntityNotFound(_0x5c13aa,null))[_0x8dcf('0x26')](saveUpdates(_0x1831cb[_0x8dcf('0x4d')],null))[_0x8dcf('0x26')](respondWithResult(_0x5c13aa,null))[_0x8dcf('0x48')](handleError(_0x5c13aa,null));};exports['destroy']=function(_0x24f85c,_0x933f30){return db[_0x8dcf('0x2d')][_0x8dcf('0x4b')]({'where':{'id':_0x24f85c[_0x8dcf('0x4a')]['id']}})[_0x8dcf('0x26')](handleEntityNotFound(_0x933f30,null))[_0x8dcf('0x26')](removeEntity(_0x933f30,null))[_0x8dcf('0x48')](handleError(_0x933f30,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index c3affd9..b55ea6b 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 _0x19a8=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','dynamics365_unique_index','lodash'];(function(_0xee2ea6,_0xd39723){var _0x5a449d=function(_0x1d5575){while(--_0x1d5575){_0xee2ea6['push'](_0xee2ea6['shift']());}};_0x5a449d(++_0xd39723);}(_0x19a8,0x81));var _0x819a=function(_0x1e21e8,_0x1f3894){_0x1e21e8=_0x1e21e8-0x0;var _0x4191d3=_0x19a8[_0x1e21e8];return _0x4191d3;};'use strict';var _=require(_0x819a('0x0'));var util=require('util');var logger=require(_0x819a('0x1'))(_0x819a('0x2'));var moment=require(_0x819a('0x3'));var BPromise=require(_0x819a('0x4'));var rp=require(_0x819a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x819a('0x6'));var config=require(_0x819a('0x7'));var attributes=require(_0x819a('0x8'));module[_0x819a('0x9')]=function(_0x699672,_0x5a0e4d){return _0x699672[_0x819a('0xa')](_0x819a('0xb'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x819a('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb4af=['rimraf','../../config/environment','./intDynamics365Field.attributes','define','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','util','../../config/logger','moment','path'];(function(_0x4e2240,_0xac55e5){var _0x35f114=function(_0x4c037f){while(--_0x4c037f){_0x4e2240['push'](_0x4e2240['shift']());}};_0x35f114(++_0xac55e5);}(_0xb4af,0xbc));var _0xfb4a=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xb4af[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0xfb4a('0x0'));var logger=require(_0xfb4a('0x1'))('api');var moment=require(_0xfb4a('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfb4a('0x3'));var rimraf=require(_0xfb4a('0x4'));var config=require(_0xfb4a('0x5'));var attributes=require(_0xfb4a('0x6'));module['exports']=function(_0x3375d0,_0x505e64){return _0x3375d0[_0xfb4a('0x7')]('Dynamics365Field',attributes,{'tableName':_0xfb4a('0x8'),'paranoid':![],'indexes':[{'name':_0xfb4a('0x9'),'fields':[_0xfb4a('0xa'),_0xfb4a('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index afe3d5d..3ec4fd9 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 _0x0a17=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xc81f5f,_0x181205){var _0x4410dc=function(_0x3cf9a5){while(--_0x3cf9a5){_0xc81f5f['push'](_0xc81f5f['shift']());}};_0x4410dc(++_0x181205);}(_0x0a17,0xca));var _0x70a1=function(_0x5b168a,_0x396949){_0x5b168a=_0x5b168a-0x0;var _0x30e146=_0x0a17[_0x5b168a];return _0x30e146;};'use strict';var _=require(_0x70a1('0x0'));var util=require(_0x70a1('0x1'));var moment=require(_0x70a1('0x2'));var BPromise=require(_0x70a1('0x3'));var rs=require(_0x70a1('0x4'));var fs=require('fs');var Redis=require(_0x70a1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x70a1('0x6'));var logger=require(_0x70a1('0x7'))(_0x70a1('0x8'));var config=require('../../config/environment');var jayson=require(_0x70a1('0x9'));var client=jayson[_0x70a1('0xa')][_0x70a1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8fbc71,_0x1c1a4,_0x6b6cac){return new BPromise(function(_0x3078f5,_0x348dd5){return client[_0x70a1('0xc')](_0x8fbc71,_0x6b6cac)[_0x70a1('0xd')](function(_0x1aeaf8){logger[_0x70a1('0xe')](_0x70a1('0xf'),_0x1c1a4,_0x70a1('0x10'));logger[_0x70a1('0x11')](_0x70a1('0x12'),_0x1c1a4,_0x70a1('0x10'),JSON[_0x70a1('0x13')](_0x1aeaf8));if(_0x1aeaf8[_0x70a1('0x14')]){if(_0x1aeaf8[_0x70a1('0x14')][_0x70a1('0x15')]===0x1f4){logger[_0x70a1('0x14')](_0x70a1('0xf'),_0x1c1a4,_0x1aeaf8[_0x70a1('0x14')][_0x70a1('0x16')]);return _0x348dd5(_0x1aeaf8[_0x70a1('0x14')][_0x70a1('0x16')]);}logger['error'](_0x70a1('0xf'),_0x1c1a4,_0x1aeaf8[_0x70a1('0x14')]['message']);return _0x3078f5(_0x1aeaf8[_0x70a1('0x14')][_0x70a1('0x16')]);}else{logger[_0x70a1('0xe')](_0x70a1('0xf'),_0x1c1a4,_0x70a1('0x10'));_0x3078f5(_0x1aeaf8[_0x70a1('0x17')][_0x70a1('0x16')]);}})[_0x70a1('0x18')](function(_0x8e114e){logger[_0x70a1('0x14')](_0x70a1('0xf'),_0x1c1a4,_0x8e114e);_0x348dd5(_0x8e114e);});});} \ No newline at end of file +var _0xe059=['jayson/promise','client','http','request','then','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0xa7acd9,_0x491264){var _0x492857=function(_0x140e6c){while(--_0x140e6c){_0xa7acd9['push'](_0xa7acd9['shift']());}};_0x492857(++_0x491264);}(_0xe059,0x177));var _0x9e05=function(_0x3505fe,_0x423e13){_0x3505fe=_0x3505fe-0x0;var _0x11e7ce=_0xe059[_0x3505fe];return _0x11e7ce;};'use strict';var _=require(_0x9e05('0x0'));var util=require(_0x9e05('0x1'));var moment=require(_0x9e05('0x2'));var BPromise=require(_0x9e05('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e05('0x4'));var db=require(_0x9e05('0x5'))['db'];var utils=require(_0x9e05('0x6'));var logger=require('../../config/logger')(_0x9e05('0x7'));var config=require(_0x9e05('0x8'));var jayson=require(_0x9e05('0x9'));var client=jayson[_0x9e05('0xa')][_0x9e05('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xfbcfe7,_0x3eff77,_0x22bd97){return new BPromise(function(_0x1727b6,_0x3ef1ef){return client[_0x9e05('0xc')](_0xfbcfe7,_0x22bd97)[_0x9e05('0xd')](function(_0x2b2e31){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x3eff77,'request\x20sent');logger[_0x9e05('0xe')](_0x9e05('0xf'),_0x3eff77,_0x9e05('0x10'),JSON[_0x9e05('0x11')](_0x2b2e31));if(_0x2b2e31[_0x9e05('0x12')]){if(_0x2b2e31[_0x9e05('0x12')][_0x9e05('0x13')]===0x1f4){logger['error'](_0x9e05('0x14'),_0x3eff77,_0x2b2e31[_0x9e05('0x12')]['message']);return _0x3ef1ef(_0x2b2e31[_0x9e05('0x12')][_0x9e05('0x15')]);}logger[_0x9e05('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x3eff77,_0x2b2e31[_0x9e05('0x12')]['message']);return _0x1727b6(_0x2b2e31['error'][_0x9e05('0x15')]);}else{logger[_0x9e05('0x16')](_0x9e05('0x14'),_0x3eff77,_0x9e05('0x10'));_0x1727b6(_0x2b2e31['result'][_0x9e05('0x15')]);}})[_0x9e05('0x17')](function(_0x18f576){logger[_0x9e05('0x12')](_0x9e05('0x14'),_0x3eff77,_0x18f576);_0x3ef1ef(_0x18f576);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 24a1284..1989798 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 _0xe03a=['multer','util','path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy','exports'];(function(_0xaa833d,_0x3e7f43){var _0x243c3f=function(_0x2ac323){while(--_0x2ac323){_0xaa833d['push'](_0xaa833d['shift']());}};_0x243c3f(++_0x3e7f43);}(_0xe03a,0x159));var _0xae03=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe03a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xae03('0x0'));var util=require(_0xae03('0x1'));var path=require(_0xae03('0x2'));var timeout=require('connect-timeout');var express=require(_0xae03('0x3'));var router=express[_0xae03('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xae03('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xae03('0x6'));var controller=require('./intFreshdeskAccount.controller');router[_0xae03('0x7')]('/',auth[_0xae03('0x8')](),controller[_0xae03('0x9')]);router[_0xae03('0x7')](_0xae03('0xa'),auth[_0xae03('0x8')](),controller[_0xae03('0xb')]);router[_0xae03('0x7')](_0xae03('0xc'),auth[_0xae03('0x8')](),controller[_0xae03('0xd')]);router[_0xae03('0x7')](_0xae03('0xe'),auth[_0xae03('0x8')](),controller[_0xae03('0xf')]);router[_0xae03('0x10')]('/',auth['isAuthenticated'](),controller[_0xae03('0x11')]);router[_0xae03('0x10')]('/:id/configurations',auth[_0xae03('0x8')](),controller[_0xae03('0x12')]);router['put'](_0xae03('0xa'),auth[_0xae03('0x8')](),controller[_0xae03('0x13')]);router[_0xae03('0x14')](_0xae03('0xa'),auth[_0xae03('0x8')](),controller[_0xae03('0x15')]);module[_0xae03('0x16')]=router; \ No newline at end of file +var _0xcce8=['express','Router','fs-extra','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','create','post','addConfiguration','put','delete','destroy','multer','util','path','connect-timeout'];(function(_0x102249,_0x4c8b65){var _0x54b2cb=function(_0x4b09bc){while(--_0x4b09bc){_0x102249['push'](_0x102249['shift']());}};_0x54b2cb(++_0x4c8b65);}(_0xcce8,0x100));var _0x8cce=function(_0x47b345,_0x41530e){_0x47b345=_0x47b345-0x0;var _0x2982d9=_0xcce8[_0x47b345];return _0x2982d9;};'use strict';var multer=require(_0x8cce('0x0'));var util=require(_0x8cce('0x1'));var path=require(_0x8cce('0x2'));var timeout=require(_0x8cce('0x3'));var express=require(_0x8cce('0x4'));var router=express[_0x8cce('0x5')]();var fs_extra=require(_0x8cce('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8cce('0x7'));var controller=require(_0x8cce('0x8'));router[_0x8cce('0x9')]('/',auth[_0x8cce('0xa')](),controller['index']);router[_0x8cce('0x9')](_0x8cce('0xb'),auth[_0x8cce('0xa')](),controller[_0x8cce('0xc')]);router['get'](_0x8cce('0xd'),auth[_0x8cce('0xa')](),controller['getConfigurations']);router[_0x8cce('0x9')]('/:id/fields',auth[_0x8cce('0xa')](),controller['getFields']);router['post']('/',auth[_0x8cce('0xa')](),controller[_0x8cce('0xe')]);router[_0x8cce('0xf')](_0x8cce('0xd'),auth[_0x8cce('0xa')](),controller[_0x8cce('0x10')]);router[_0x8cce('0x11')](_0x8cce('0xb'),auth[_0x8cce('0xa')](),controller['update']);router[_0x8cce('0x12')](_0x8cce('0xb'),auth[_0x8cce('0xa')](),controller[_0x8cce('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 2c47ba2..f325dcc 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 _0x6a95=['exports','STRING','username','sequelize'];(function(_0x354164,_0x4c30de){var _0x5db9a8=function(_0x319b08){while(--_0x319b08){_0x354164['push'](_0x354164['shift']());}};_0x5db9a8(++_0x4c30de);}(_0x6a95,0x1db));var _0x56a9=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x6a95[_0x4fc9e6];return _0x551d28;};'use strict';var Sequelize=require(_0x56a9('0x0'));module[_0x56a9('0x1')]={'name':{'type':Sequelize[_0x56a9('0x2')]},'description':{'type':Sequelize[_0x56a9('0x2')]},'username':{'type':Sequelize[_0x56a9('0x2')],'unique':_0x56a9('0x3')},'apiKey':{'type':Sequelize[_0x56a9('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x56a9('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x8e3f=['STRING','username','remoteUri','sequelize','exports'];(function(_0xe5443f,_0x2ea4fe){var _0x1d3fa2=function(_0x3fa290){while(--_0x3fa290){_0xe5443f['push'](_0xe5443f['shift']());}};_0x1d3fa2(++_0x2ea4fe);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8e3f[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0xf8e3('0x0'));module[_0xf8e3('0x1')]={'name':{'type':Sequelize[_0xf8e3('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf8e3('0x2')],'unique':_0xf8e3('0x3')},'apiKey':{'type':Sequelize[_0xf8e3('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xf8e3('0x4')},'serverUrl':{'type':Sequelize[_0xf8e3('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 3b0ad38..fe99e92 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 _0x5088=['includeAll','findAll','catch','show','params','include','create','body','find','findOne','FreshdeskConfiguration','length','pick','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','Subjects','remoteUri','lastIndexOf','GET','format','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','toString','requester','subject','agent','description','priority','group','source','company','remove','includes','custom_text','label','default','choices','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','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','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','filter','where','merge','options','FreshdeskAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5088,0xa9));var _0x8508=function(_0x7be910,_0x2b381b){_0x7be910=_0x7be910-0x0;var _0x496ddf=_0x5088[_0x7be910];return _0x496ddf;};'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'];var integrations=require(_0x8508('0x19'));function respondWithStatusCode(_0x129d4c,_0x2a6969){_0x2a6969=_0x2a6969||0xcc;return function(_0x4a6157){if(_0x4a6157){return _0x129d4c[_0x8508('0x1a')](_0x2a6969);}return _0x129d4c[_0x8508('0x1b')](_0x2a6969)[_0x8508('0x1c')]();};}function respondWithResult(_0x431b14,_0x4c4bf9){_0x4c4bf9=_0x4c4bf9||0xc8;return function(_0x318bad){if(_0x318bad){return _0x431b14[_0x8508('0x1b')](_0x4c4bf9)['json'](_0x318bad);}};}function respondWithFilteredResult(_0x34da29,_0x4f81c7){return function(_0xe8daa7){if(_0xe8daa7){var _0x1a67a6=typeof _0x4f81c7[_0x8508('0x1d')]===_0x8508('0x1e')&&typeof _0x4f81c7[_0x8508('0x1f')]==='undefined';var _0x1884d4=_0xe8daa7[_0x8508('0x20')];var _0x4e5dd6=_0x1a67a6?0x0:_0x4f81c7['offset'];var _0xa16f92=_0x1a67a6?_0xe8daa7['count']:_0x4f81c7[_0x8508('0x1d')]+_0x4f81c7[_0x8508('0x1f')];var _0x237b09;if(_0xa16f92>=_0x1884d4){_0xa16f92=_0x1884d4;_0x237b09=0xc8;}else{_0x237b09=0xce;}_0x34da29['status'](_0x237b09);return _0x34da29[_0x8508('0x21')](_0x8508('0x22'),_0x4e5dd6+'-'+_0xa16f92+'/'+_0x1884d4)[_0x8508('0x23')](_0xe8daa7);}return null;};}function patchUpdates(_0x1da402){return function(_0x38e8f0){try{jsonpatch[_0x8508('0x24')](_0x38e8f0,_0x1da402,!![]);}catch(_0x87e3f){return BPromise[_0x8508('0x25')](_0x87e3f);}return _0x38e8f0[_0x8508('0x26')]();};}function saveUpdates(_0x34ee74,_0x455594){return function(_0x4e9610){if(_0x4e9610){return _0x4e9610[_0x8508('0x27')](_0x34ee74)[_0x8508('0x28')](function(_0x43fa1b){return _0x43fa1b;});}return null;};}function removeEntity(_0x5874b2,_0x1efffd){return function(_0x17d458){if(_0x17d458){return _0x17d458[_0x8508('0x29')]()['then'](function(){_0x5874b2[_0x8508('0x1b')](0xcc)[_0x8508('0x1c')]();});}};}function handleEntityNotFound(_0x373c86,_0x2ccf2d){return function(_0x575191){if(!_0x575191){_0x373c86['sendStatus'](0x194);}return _0x575191;};}function handleError(_0x3dcdff,_0x4d872c){_0x4d872c=_0x4d872c||0x1f4;return function(_0x3b43f7){logger['error'](_0x3b43f7[_0x8508('0x2a')]);if(_0x3b43f7[_0x8508('0x2b')]){delete _0x3b43f7[_0x8508('0x2b')];}_0x3dcdff[_0x8508('0x1b')](_0x4d872c)['send'](_0x3b43f7);};}exports[_0x8508('0x2c')]=function(_0x3d0d71,_0x473363){var _0x4e51db={},_0x68f48c={},_0x4f9cbf={'count':0x0,'rows':[]};var _0x22d664=_[_0x8508('0x2d')](db['FreshdeskAccount'][_0x8508('0x2e')],function(_0x5e6fd9){return{'name':_0x5e6fd9['fieldName'],'type':_0x5e6fd9[_0x8508('0x2f')]['key']};});_0x68f48c[_0x8508('0x30')]=_[_0x8508('0x2d')](_0x22d664,'name');_0x68f48c[_0x8508('0x31')]=_[_0x8508('0x32')](_0x3d0d71[_0x8508('0x31')]);_0x68f48c[_0x8508('0x33')]=_[_0x8508('0x34')](_0x68f48c['model'],_0x68f48c[_0x8508('0x31')]);_0x4e51db[_0x8508('0x35')]=_[_0x8508('0x34')](_0x68f48c['model'],qs[_0x8508('0x36')](_0x3d0d71[_0x8508('0x31')][_0x8508('0x36')]));_0x4e51db[_0x8508('0x35')]=_0x4e51db['attributes']['length']?_0x4e51db[_0x8508('0x35')]:_0x68f48c[_0x8508('0x30')];if(!_0x3d0d71[_0x8508('0x31')]['hasOwnProperty'](_0x8508('0x37'))){_0x4e51db[_0x8508('0x1f')]=qs[_0x8508('0x1f')](_0x3d0d71['query']['limit']);_0x4e51db[_0x8508('0x1d')]=qs['offset'](_0x3d0d71['query'][_0x8508('0x1d')]);}_0x4e51db[_0x8508('0x38')]=qs[_0x8508('0x39')](_0x3d0d71[_0x8508('0x31')][_0x8508('0x39')]);_0x4e51db['where']=qs[_0x8508('0x33')](_['pick'](_0x3d0d71['query'],_0x68f48c[_0x8508('0x33')]),_0x22d664);if(_0x3d0d71[_0x8508('0x31')][_0x8508('0x3a')]){_0x4e51db[_0x8508('0x3b')]=_[_0x8508('0x3c')](_0x4e51db[_0x8508('0x3b')],{'$or':_['map'](_0x22d664,function(_0x5a79b4){if(_0x5a79b4[_0x8508('0x2f')]!=='VIRTUAL'){var _0x6a170={};_0x6a170[_0x5a79b4[_0x8508('0x2b')]]={'$like':'%'+_0x3d0d71[_0x8508('0x31')][_0x8508('0x3a')]+'%'};return _0x6a170;}})});}_0x4e51db=_[_0x8508('0x3c')]({},_0x4e51db,_0x3d0d71[_0x8508('0x3d')]);var _0xf2ea9f={'where':_0x4e51db[_0x8508('0x3b')]};return db[_0x8508('0x3e')][_0x8508('0x20')](_0xf2ea9f)[_0x8508('0x28')](function(_0x42e016){_0x4f9cbf[_0x8508('0x20')]=_0x42e016;if(_0x3d0d71[_0x8508('0x31')][_0x8508('0x3f')]){_0x4e51db['include']=[{'all':!![]}];}return db[_0x8508('0x3e')][_0x8508('0x40')](_0x4e51db);})[_0x8508('0x28')](function(_0xadbdc9){_0x4f9cbf['rows']=_0xadbdc9;return _0x4f9cbf;})['then'](respondWithFilteredResult(_0x473363,_0x4e51db))[_0x8508('0x41')](handleError(_0x473363,null));};exports[_0x8508('0x42')]=function(_0x1b8fe7,_0x491559){var _0x48adef={'raw':![],'where':{'id':_0x1b8fe7[_0x8508('0x43')]['id']}},_0x344520={};_0x344520[_0x8508('0x30')]=_['keys'](db['FreshdeskAccount'][_0x8508('0x2e')]);_0x344520[_0x8508('0x31')]=_[_0x8508('0x32')](_0x1b8fe7['query']);_0x344520[_0x8508('0x33')]=_[_0x8508('0x34')](_0x344520[_0x8508('0x30')],_0x344520[_0x8508('0x31')]);_0x48adef[_0x8508('0x35')]=_[_0x8508('0x34')](_0x344520[_0x8508('0x30')],qs['fields'](_0x1b8fe7[_0x8508('0x31')][_0x8508('0x36')]));_0x48adef['attributes']=_0x48adef[_0x8508('0x35')]['length']?_0x48adef[_0x8508('0x35')]:_0x344520[_0x8508('0x30')];if(_0x1b8fe7[_0x8508('0x31')][_0x8508('0x3f')]){_0x48adef[_0x8508('0x44')]=[{'all':!![]}];}_0x48adef=_[_0x8508('0x3c')]({},_0x48adef,_0x1b8fe7[_0x8508('0x3d')]);return db[_0x8508('0x3e')]['find'](_0x48adef)[_0x8508('0x28')](handleEntityNotFound(_0x491559,null))[_0x8508('0x28')](respondWithResult(_0x491559,null))[_0x8508('0x41')](handleError(_0x491559,null));};exports['create']=function(_0x3a1907,_0x5b8e41){return db[_0x8508('0x3e')][_0x8508('0x45')](_0x3a1907[_0x8508('0x46')],{})[_0x8508('0x28')](respondWithResult(_0x5b8e41,0xc9))['catch'](handleError(_0x5b8e41,null));};exports['update']=function(_0x2a8094,_0x773872){if(_0x2a8094[_0x8508('0x46')]['id']){delete _0x2a8094['body']['id'];}return db[_0x8508('0x3e')][_0x8508('0x47')]({'where':{'id':_0x2a8094['params']['id']}})[_0x8508('0x28')](handleEntityNotFound(_0x773872,null))['then'](saveUpdates(_0x2a8094[_0x8508('0x46')],null))[_0x8508('0x28')](respondWithResult(_0x773872,null))[_0x8508('0x41')](handleError(_0x773872,null));};exports[_0x8508('0x29')]=function(_0x2bbbd8,_0x4ce943){return db[_0x8508('0x3e')][_0x8508('0x47')]({'where':{'id':_0x2bbbd8[_0x8508('0x43')]['id']}})[_0x8508('0x28')](handleEntityNotFound(_0x4ce943,null))[_0x8508('0x28')](removeEntity(_0x4ce943,null))[_0x8508('0x41')](handleError(_0x4ce943,null));};exports['getConfigurations']=function(_0x3597b6,_0x27ce59,_0x3c48ac){var _0x33eaa0={};var _0x4ec8ce={};var _0x158057;var _0x5538bc;return db[_0x8508('0x3e')][_0x8508('0x48')]({'where':{'id':_0x3597b6[_0x8508('0x43')]['id']}})[_0x8508('0x28')](handleEntityNotFound(_0x27ce59,null))[_0x8508('0x28')](function(_0x74b6d7){if(_0x74b6d7){_0x158057=_0x74b6d7;_0x4ec8ce[_0x8508('0x30')]=_[_0x8508('0x32')](db[_0x8508('0x49')][_0x8508('0x2e')]);_0x4ec8ce[_0x8508('0x31')]=_[_0x8508('0x32')](_0x3597b6[_0x8508('0x31')]);_0x4ec8ce[_0x8508('0x33')]=_[_0x8508('0x34')](_0x4ec8ce[_0x8508('0x30')],_0x4ec8ce['query']);_0x33eaa0[_0x8508('0x35')]=_[_0x8508('0x34')](_0x4ec8ce[_0x8508('0x30')],qs[_0x8508('0x36')](_0x3597b6[_0x8508('0x31')]['fields']));_0x33eaa0[_0x8508('0x35')]=_0x33eaa0[_0x8508('0x35')][_0x8508('0x4a')]?_0x33eaa0[_0x8508('0x35')]:_0x4ec8ce[_0x8508('0x30')];_0x33eaa0[_0x8508('0x38')]=qs['sort'](_0x3597b6[_0x8508('0x31')][_0x8508('0x39')]);_0x33eaa0[_0x8508('0x3b')]=qs[_0x8508('0x33')](_[_0x8508('0x4b')](_0x3597b6[_0x8508('0x31')],_0x4ec8ce[_0x8508('0x33')]));if(_0x3597b6['query'][_0x8508('0x3a')]){_0x33eaa0[_0x8508('0x3b')]=_[_0x8508('0x3c')](_0x33eaa0[_0x8508('0x3b')],{'$or':_[_0x8508('0x2d')](_0x33eaa0['attributes'],function(_0x3b7f87){var _0x2405bc={};_0x2405bc[_0x3b7f87]={'$like':'%'+_0x3597b6[_0x8508('0x31')][_0x8508('0x3a')]+'%'};return _0x2405bc;})});}_0x33eaa0=_[_0x8508('0x3c')]({},_0x33eaa0,_0x3597b6[_0x8508('0x3d')]);return _0x158057[_0x8508('0x4c')](_0x33eaa0);}})['then'](function(_0x59db60){if(_0x59db60){_0x5538bc=_0x59db60[_0x8508('0x4a')];if(!_0x3597b6['query']['hasOwnProperty']('nolimit')){_0x33eaa0[_0x8508('0x1f')]=qs['limit'](_0x3597b6[_0x8508('0x31')][_0x8508('0x1f')]);_0x33eaa0[_0x8508('0x1d')]=qs['offset'](_0x3597b6[_0x8508('0x31')][_0x8508('0x1d')]);}return _0x158057[_0x8508('0x4c')](_0x33eaa0);}})['then'](function(_0x4cd10a){if(_0x4cd10a){return _0x4cd10a?{'count':_0x5538bc,'rows':_0x4cd10a}:null;}})[_0x8508('0x28')](respondWithResult(_0x27ce59,null))[_0x8508('0x41')](handleError(_0x27ce59,null));};exports[_0x8508('0x4d')]=function(_0x5559ab,_0x4fc9da,_0x105369){if(_0x5559ab[_0x8508('0x46')]['id']){delete _0x5559ab['body']['id'];}return db['FreshdeskAccount'][_0x8508('0x48')]({'where':{'id':_0x5559ab['params']['id']}})[_0x8508('0x28')](handleEntityNotFound(_0x4fc9da,null))[_0x8508('0x28')](function(_0x2d8714){if(_0x2d8714){_0x5559ab[_0x8508('0x46')][_0x8508('0x4e')]=_0x2d8714['id'];_0x5559ab[_0x8508('0x46')]['Subjects']=integrations[_0x8508('0x4f')](_0x5559ab[_0x8508('0x46')][_0x8508('0x50')],_0x5559ab['body'][_0x8508('0x2f')]);_0x5559ab[_0x8508('0x46')][_0x8508('0x51')]=integrations[_0x8508('0x52')](_0x5559ab[_0x8508('0x46')][_0x8508('0x50')],_0x5559ab['body'][_0x8508('0x2f')]);return db[_0x8508('0x49')][_0x8508('0x45')](_0x5559ab[_0x8508('0x46')],{'include':[{'model':db[_0x8508('0x53')],'as':_0x8508('0x54')},{'model':db[_0x8508('0x53')],'as':_0x8508('0x51')}]});}return null;})[_0x8508('0x28')](respondWithResult(_0x4fc9da,null))[_0x8508('0x41')](handleError(_0x4fc9da,null));};exports['getFields']=function(_0x360944,_0x5217f9,_0x601eb0){var _0x168eac='';return db[_0x8508('0x3e')][_0x8508('0x48')]({'where':{'id':_0x360944[_0x8508('0x43')]['id']},'attributes':['id',_0x8508('0x55'),'apiKey']})['then'](handleEntityNotFound(_0x5217f9,null))[_0x8508('0x28')](function(_0x4faa1c){if(_0x4faa1c){_0x168eac=_0x4faa1c['remoteUri'];var _0x47c04e=_0x168eac['slice'](-0x1);if(_0x47c04e==='/'){_0x168eac=_0x168eac['substring'](0x0,_0x168eac[_0x8508('0x56')](_0x47c04e));}return rp({'method':_0x8508('0x57'),'uri':util[_0x8508('0x58')]('%s/%s',_0x168eac,_0x8508('0x59')),'headers':{'Authorization':util[_0x8508('0x58')](_0x8508('0x5a'),new Buffer(util['format'](_0x8508('0x5b'),_0x4faa1c[_0x8508('0x5c')]))[_0x8508('0x5d')]('base64'))},'json':!![]});}})[_0x8508('0x28')](function(_0x2e77b2){if(_0x2e77b2){var _0x22eabf=[_0x8508('0x5e'),_0x8508('0x5f'),_0x8508('0x60'),_0x8508('0x61'),_0x8508('0x1b'),_0x8508('0x62'),_0x8508('0x63'),_0x8508('0x64'),'ticket_type',_0x8508('0x63'),_0x8508('0x65')];_[_0x8508('0x66')](_0x2e77b2,function(_0x31f73a){return _0x22eabf[_0x8508('0x67')](_0x31f73a['name'])||!_0x31f73a['default']&&_0x31f73a[_0x8508('0x2f')]!==_0x8508('0x68')&&_0x31f73a[_0x8508('0x2f')]!=='custom_dropdown';});return{'count':_0x2e77b2[_0x8508('0x4a')],'rows':_[_0x8508('0x2d')](_0x2e77b2,function(_0x468132){return{'id':_0x468132[_0x8508('0x2b')],'name':_0x468132[_0x8508('0x69')],'custom':!_0x468132[_0x8508('0x6a')],'options':_0x468132[_0x8508('0x6b')]?_['map'](_0x468132[_0x8508('0x6b')],function(_0x22a57a){return{'name':_[_0x8508('0x6c')](_0x22a57a),'value':_0x22a57a};}):[]};})};}})['then'](respondWithResult(_0x5217f9,null))[_0x8508('0x41')](function(_0x92efab){var _0x570f25=_0x360944[_0x8508('0x31')][_0x8508('0x6d')]?0x1f4:_0x92efab[_0x8508('0x6e')]||0x1f4;logger[_0x8508('0x6f')](_0x8508('0x70'),'getFields',_0x570f25,JSON[_0x8508('0x71')](_0x92efab));delete _0x92efab[_0x8508('0x2b')];if(_0x570f25===0x191){_0x570f25=0x190;}_0x5217f9[_0x8508('0x1b')](_0x570f25)[_0x8508('0x72')](_0x360944[_0x8508('0x31')][_0x8508('0x6d')]?{'message':_0x8508('0x73'),'statusCode':_0x92efab[_0x8508('0x6e')]}:_0x92efab);});}; \ No newline at end of file +var _0x477a=['getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','slice','substring','GET','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','%s:X','apiKey','toString','base64','requester','agent','priority','group','source','remove','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','error','name','send','index','map','FreshdeskAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x477a,0x1e2));var _0xa477=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x477a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa477('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa477('0x1'));var jsonpatch=require(_0xa477('0x2'));var rp=require('request-promise');var moment=require(_0xa477('0x3'));var BPromise=require(_0xa477('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa477('0x5'));var sox=require(_0xa477('0x6'));var csv=require('to-csv');var ejs=require(_0xa477('0x7'));var fs=require('fs');var fs_extra=require(_0xa477('0x8'));var _=require(_0xa477('0x9'));var squel=require(_0xa477('0xa'));var crypto=require(_0xa477('0xb'));var jsforce=require(_0xa477('0xc'));var deskjs=require(_0xa477('0xd'));var toCsv=require(_0xa477('0xe'));var querystring=require(_0xa477('0xf'));var Papa=require('papaparse');var Redis=require(_0xa477('0x10'));var authService=require(_0xa477('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa477('0x12'));var config=require(_0xa477('0x13'));var licenseUtil=require(_0xa477('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa477('0x15'));function respondWithStatusCode(_0x3d2a17,_0x70e1c1){_0x70e1c1=_0x70e1c1||0xcc;return function(_0x5e09ef){if(_0x5e09ef){return _0x3d2a17[_0xa477('0x16')](_0x70e1c1);}return _0x3d2a17[_0xa477('0x17')](_0x70e1c1)[_0xa477('0x18')]();};}function respondWithResult(_0x185c76,_0xe878a){_0xe878a=_0xe878a||0xc8;return function(_0x484706){if(_0x484706){return _0x185c76[_0xa477('0x17')](_0xe878a)[_0xa477('0x19')](_0x484706);}};}function respondWithFilteredResult(_0xa607d0,_0x45ecc1){return function(_0x22a156){if(_0x22a156){var _0x1659cb=typeof _0x45ecc1[_0xa477('0x1a')]===_0xa477('0x1b')&&typeof _0x45ecc1[_0xa477('0x1c')]===_0xa477('0x1b');var _0xc21f88=_0x22a156[_0xa477('0x1d')];var _0xd9cdae=_0x1659cb?0x0:_0x45ecc1['offset'];var _0x6d645=_0x1659cb?_0x22a156[_0xa477('0x1d')]:_0x45ecc1[_0xa477('0x1a')]+_0x45ecc1[_0xa477('0x1c')];var _0x4596bd;if(_0x6d645>=_0xc21f88){_0x6d645=_0xc21f88;_0x4596bd=0xc8;}else{_0x4596bd=0xce;}_0xa607d0[_0xa477('0x17')](_0x4596bd);return _0xa607d0[_0xa477('0x1e')](_0xa477('0x1f'),_0xd9cdae+'-'+_0x6d645+'/'+_0xc21f88)['json'](_0x22a156);}return null;};}function patchUpdates(_0x434ef1){return function(_0x240956){try{jsonpatch[_0xa477('0x20')](_0x240956,_0x434ef1,!![]);}catch(_0x5ed526){return BPromise['reject'](_0x5ed526);}return _0x240956['save']();};}function saveUpdates(_0x14d01e,_0x2debae){return function(_0x571501){if(_0x571501){return _0x571501[_0xa477('0x21')](_0x14d01e)['then'](function(_0x5b6e98){return _0x5b6e98;});}return null;};}function removeEntity(_0x7aa4ac,_0x166694){return function(_0x1bb568){if(_0x1bb568){return _0x1bb568[_0xa477('0x22')]()[_0xa477('0x23')](function(){_0x7aa4ac[_0xa477('0x17')](0xcc)[_0xa477('0x18')]();});}};}function handleEntityNotFound(_0x48209e,_0x3cafd9){return function(_0x1e444e){if(!_0x1e444e){_0x48209e[_0xa477('0x16')](0x194);}return _0x1e444e;};}function handleError(_0x236416,_0x18e8c3){_0x18e8c3=_0x18e8c3||0x1f4;return function(_0x27ec39){logger[_0xa477('0x24')](_0x27ec39['stack']);if(_0x27ec39[_0xa477('0x25')]){delete _0x27ec39[_0xa477('0x25')];}_0x236416[_0xa477('0x17')](_0x18e8c3)[_0xa477('0x26')](_0x27ec39);};}exports[_0xa477('0x27')]=function(_0xdb15a9,_0x14b0e8){var _0x5aed5d={},_0x169089={},_0x5819c8={'count':0x0,'rows':[]};var _0x599371=_[_0xa477('0x28')](db[_0xa477('0x29')]['rawAttributes'],function(_0x15e476){return{'name':_0x15e476[_0xa477('0x2a')],'type':_0x15e476[_0xa477('0x2b')][_0xa477('0x2c')]};});_0x169089[_0xa477('0x2d')]=_[_0xa477('0x28')](_0x599371,_0xa477('0x25'));_0x169089[_0xa477('0x2e')]=_[_0xa477('0x2f')](_0xdb15a9[_0xa477('0x2e')]);_0x169089[_0xa477('0x30')]=_[_0xa477('0x31')](_0x169089[_0xa477('0x2d')],_0x169089['query']);_0x5aed5d[_0xa477('0x32')]=_[_0xa477('0x31')](_0x169089[_0xa477('0x2d')],qs[_0xa477('0x33')](_0xdb15a9[_0xa477('0x2e')][_0xa477('0x33')]));_0x5aed5d[_0xa477('0x32')]=_0x5aed5d[_0xa477('0x32')]['length']?_0x5aed5d[_0xa477('0x32')]:_0x169089[_0xa477('0x2d')];if(!_0xdb15a9[_0xa477('0x2e')][_0xa477('0x34')](_0xa477('0x35'))){_0x5aed5d[_0xa477('0x1c')]=qs[_0xa477('0x1c')](_0xdb15a9[_0xa477('0x2e')][_0xa477('0x1c')]);_0x5aed5d[_0xa477('0x1a')]=qs[_0xa477('0x1a')](_0xdb15a9[_0xa477('0x2e')][_0xa477('0x1a')]);}_0x5aed5d[_0xa477('0x36')]=qs[_0xa477('0x37')](_0xdb15a9[_0xa477('0x2e')][_0xa477('0x37')]);_0x5aed5d[_0xa477('0x38')]=qs[_0xa477('0x30')](_['pick'](_0xdb15a9[_0xa477('0x2e')],_0x169089[_0xa477('0x30')]),_0x599371);if(_0xdb15a9[_0xa477('0x2e')][_0xa477('0x39')]){_0x5aed5d[_0xa477('0x38')]=_[_0xa477('0x3a')](_0x5aed5d['where'],{'$or':_['map'](_0x599371,function(_0x3065e7){if(_0x3065e7[_0xa477('0x2b')]!==_0xa477('0x3b')){var _0x764cef={};_0x764cef[_0x3065e7['name']]={'$like':'%'+_0xdb15a9['query'][_0xa477('0x39')]+'%'};return _0x764cef;}})});}_0x5aed5d=_[_0xa477('0x3a')]({},_0x5aed5d,_0xdb15a9[_0xa477('0x3c')]);var _0x3db1a6={'where':_0x5aed5d[_0xa477('0x38')]};return db[_0xa477('0x29')][_0xa477('0x1d')](_0x3db1a6)[_0xa477('0x23')](function(_0x365f1a){_0x5819c8['count']=_0x365f1a;if(_0xdb15a9[_0xa477('0x2e')][_0xa477('0x3d')]){_0x5aed5d[_0xa477('0x3e')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0xa477('0x3f')](_0x5aed5d);})['then'](function(_0x3d9ba0){_0x5819c8[_0xa477('0x40')]=_0x3d9ba0;return _0x5819c8;})['then'](respondWithFilteredResult(_0x14b0e8,_0x5aed5d))[_0xa477('0x41')](handleError(_0x14b0e8,null));};exports[_0xa477('0x42')]=function(_0x5c1e58,_0x240ad9){var _0x37f18c={'raw':![],'where':{'id':_0x5c1e58[_0xa477('0x43')]['id']}},_0x289080={};_0x289080[_0xa477('0x2d')]=_[_0xa477('0x2f')](db[_0xa477('0x29')][_0xa477('0x44')]);_0x289080[_0xa477('0x2e')]=_[_0xa477('0x2f')](_0x5c1e58['query']);_0x289080[_0xa477('0x30')]=_[_0xa477('0x31')](_0x289080[_0xa477('0x2d')],_0x289080[_0xa477('0x2e')]);_0x37f18c[_0xa477('0x32')]=_['intersection'](_0x289080[_0xa477('0x2d')],qs['fields'](_0x5c1e58[_0xa477('0x2e')][_0xa477('0x33')]));_0x37f18c[_0xa477('0x32')]=_0x37f18c['attributes'][_0xa477('0x45')]?_0x37f18c[_0xa477('0x32')]:_0x289080[_0xa477('0x2d')];if(_0x5c1e58[_0xa477('0x2e')][_0xa477('0x3d')]){_0x37f18c[_0xa477('0x3e')]=[{'all':!![]}];}_0x37f18c=_[_0xa477('0x3a')]({},_0x37f18c,_0x5c1e58[_0xa477('0x3c')]);return db[_0xa477('0x29')][_0xa477('0x46')](_0x37f18c)[_0xa477('0x23')](handleEntityNotFound(_0x240ad9,null))['then'](respondWithResult(_0x240ad9,null))[_0xa477('0x41')](handleError(_0x240ad9,null));};exports[_0xa477('0x47')]=function(_0xeacd33,_0x545410){return db[_0xa477('0x29')][_0xa477('0x47')](_0xeacd33['body'],{})[_0xa477('0x23')](respondWithResult(_0x545410,0xc9))[_0xa477('0x41')](handleError(_0x545410,null));};exports[_0xa477('0x21')]=function(_0x543a19,_0xcb8c41){if(_0x543a19['body']['id']){delete _0x543a19[_0xa477('0x48')]['id'];}return db['FreshdeskAccount'][_0xa477('0x46')]({'where':{'id':_0x543a19[_0xa477('0x43')]['id']}})[_0xa477('0x23')](handleEntityNotFound(_0xcb8c41,null))[_0xa477('0x23')](saveUpdates(_0x543a19['body'],null))[_0xa477('0x23')](respondWithResult(_0xcb8c41,null))[_0xa477('0x41')](handleError(_0xcb8c41,null));};exports[_0xa477('0x22')]=function(_0x59b17a,_0x4fb38b){return db[_0xa477('0x29')][_0xa477('0x46')]({'where':{'id':_0x59b17a[_0xa477('0x43')]['id']}})[_0xa477('0x23')](handleEntityNotFound(_0x4fb38b,null))[_0xa477('0x23')](removeEntity(_0x4fb38b,null))[_0xa477('0x41')](handleError(_0x4fb38b,null));};exports[_0xa477('0x49')]=function(_0x3f03c0,_0x596eb5,_0x53e55e){var _0x4052e0={};var _0x16f491={};var _0x2c1d27;var _0xadf7b9;return db[_0xa477('0x29')][_0xa477('0x4a')]({'where':{'id':_0x3f03c0['params']['id']}})[_0xa477('0x23')](handleEntityNotFound(_0x596eb5,null))[_0xa477('0x23')](function(_0x219417){if(_0x219417){_0x2c1d27=_0x219417;_0x16f491[_0xa477('0x2d')]=_[_0xa477('0x2f')](db[_0xa477('0x4b')][_0xa477('0x44')]);_0x16f491['query']=_['keys'](_0x3f03c0[_0xa477('0x2e')]);_0x16f491[_0xa477('0x30')]=_[_0xa477('0x31')](_0x16f491['model'],_0x16f491[_0xa477('0x2e')]);_0x4052e0[_0xa477('0x32')]=_[_0xa477('0x31')](_0x16f491['model'],qs[_0xa477('0x33')](_0x3f03c0[_0xa477('0x2e')][_0xa477('0x33')]));_0x4052e0[_0xa477('0x32')]=_0x4052e0[_0xa477('0x32')][_0xa477('0x45')]?_0x4052e0[_0xa477('0x32')]:_0x16f491[_0xa477('0x2d')];_0x4052e0['order']=qs['sort'](_0x3f03c0[_0xa477('0x2e')][_0xa477('0x37')]);_0x4052e0[_0xa477('0x38')]=qs[_0xa477('0x30')](_['pick'](_0x3f03c0['query'],_0x16f491[_0xa477('0x30')]));if(_0x3f03c0[_0xa477('0x2e')][_0xa477('0x39')]){_0x4052e0[_0xa477('0x38')]=_['merge'](_0x4052e0[_0xa477('0x38')],{'$or':_['map'](_0x4052e0['attributes'],function(_0x460ccf){var _0x2e20ca={};_0x2e20ca[_0x460ccf]={'$like':'%'+_0x3f03c0[_0xa477('0x2e')]['filter']+'%'};return _0x2e20ca;})});}_0x4052e0=_[_0xa477('0x3a')]({},_0x4052e0,_0x3f03c0['options']);return _0x2c1d27[_0xa477('0x49')](_0x4052e0);}})['then'](function(_0x1a0b6b){if(_0x1a0b6b){_0xadf7b9=_0x1a0b6b[_0xa477('0x45')];if(!_0x3f03c0[_0xa477('0x2e')]['hasOwnProperty'](_0xa477('0x35'))){_0x4052e0[_0xa477('0x1c')]=qs[_0xa477('0x1c')](_0x3f03c0[_0xa477('0x2e')][_0xa477('0x1c')]);_0x4052e0[_0xa477('0x1a')]=qs[_0xa477('0x1a')](_0x3f03c0[_0xa477('0x2e')]['offset']);}return _0x2c1d27[_0xa477('0x49')](_0x4052e0);}})[_0xa477('0x23')](function(_0x31cde3){if(_0x31cde3){return _0x31cde3?{'count':_0xadf7b9,'rows':_0x31cde3}:null;}})[_0xa477('0x23')](respondWithResult(_0x596eb5,null))['catch'](handleError(_0x596eb5,null));};exports[_0xa477('0x4c')]=function(_0x5a4eb2,_0x48189b,_0x3df3bf){if(_0x5a4eb2[_0xa477('0x48')]['id']){delete _0x5a4eb2['body']['id'];}return db[_0xa477('0x29')][_0xa477('0x4a')]({'where':{'id':_0x5a4eb2[_0xa477('0x43')]['id']}})['then'](handleEntityNotFound(_0x48189b,null))[_0xa477('0x23')](function(_0x578d64){if(_0x578d64){_0x5a4eb2[_0xa477('0x48')][_0xa477('0x4d')]=_0x578d64['id'];_0x5a4eb2[_0xa477('0x48')][_0xa477('0x4e')]=integrations[_0xa477('0x4f')](_0x5a4eb2['body']['channel'],_0x5a4eb2[_0xa477('0x48')][_0xa477('0x2b')]);_0x5a4eb2[_0xa477('0x48')]['Descriptions']=integrations[_0xa477('0x50')](_0x5a4eb2['body']['channel'],_0x5a4eb2[_0xa477('0x48')]['type']);return db['FreshdeskConfiguration']['create'](_0x5a4eb2[_0xa477('0x48')],{'include':[{'model':db[_0xa477('0x51')],'as':_0xa477('0x4e')},{'model':db[_0xa477('0x51')],'as':_0xa477('0x52')}]});}return null;})[_0xa477('0x23')](respondWithResult(_0x48189b,null))['catch'](handleError(_0x48189b,null));};exports[_0xa477('0x53')]=function(_0x3378a1,_0x1254fd,_0x4eb045){var _0x2b9139='';return db[_0xa477('0x29')][_0xa477('0x4a')]({'where':{'id':_0x3378a1['params']['id']},'attributes':['id','remoteUri','apiKey']})['then'](handleEntityNotFound(_0x1254fd,null))[_0xa477('0x23')](function(_0x452834){if(_0x452834){_0x2b9139=_0x452834[_0xa477('0x54')];var _0x1a48a4=_0x2b9139[_0xa477('0x55')](-0x1);if(_0x1a48a4==='/'){_0x2b9139=_0x2b9139[_0xa477('0x56')](0x0,_0x2b9139['lastIndexOf'](_0x1a48a4));}return rp({'method':_0xa477('0x57'),'uri':util['format'](_0xa477('0x58'),_0x2b9139,_0xa477('0x59')),'headers':{'Authorization':util[_0xa477('0x5a')](_0xa477('0x5b'),new Buffer(util[_0xa477('0x5a')](_0xa477('0x5c'),_0x452834[_0xa477('0x5d')]))[_0xa477('0x5e')](_0xa477('0x5f')))},'json':!![]});}})['then'](function(_0x16fcec){if(_0x16fcec){var _0x47be0a=[_0xa477('0x60'),'subject',_0xa477('0x61'),'description',_0xa477('0x17'),_0xa477('0x62'),_0xa477('0x63'),_0xa477('0x64'),'ticket_type',_0xa477('0x63'),'company'];_[_0xa477('0x65')](_0x16fcec,function(_0x3c8b35){return _0x47be0a['includes'](_0x3c8b35[_0xa477('0x25')])||!_0x3c8b35[_0xa477('0x66')]&&_0x3c8b35[_0xa477('0x2b')]!==_0xa477('0x67')&&_0x3c8b35['type']!==_0xa477('0x68');});return{'count':_0x16fcec[_0xa477('0x45')],'rows':_[_0xa477('0x28')](_0x16fcec,function(_0x4596ce){return{'id':_0x4596ce[_0xa477('0x25')],'name':_0x4596ce[_0xa477('0x69')],'custom':!_0x4596ce[_0xa477('0x66')],'options':_0x4596ce['choices']?_[_0xa477('0x28')](_0x4596ce[_0xa477('0x6a')],function(_0x7a28a7){return{'name':_[_0xa477('0x6b')](_0x7a28a7),'value':_0x7a28a7};}):[]};})};}})['then'](respondWithResult(_0x1254fd,null))[_0xa477('0x41')](function(_0x23dd79){var _0xa25710=_0x3378a1[_0xa477('0x2e')][_0xa477('0x6c')]?0x1f4:_0x23dd79[_0xa477('0x6d')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xa477('0x53'),_0xa25710,JSON['stringify'](_0x23dd79));delete _0x23dd79['name'];if(_0xa25710===0x191){_0xa25710=0x190;}_0x1254fd[_0xa477('0x17')](_0xa25710)[_0xa477('0x26')](_0x3378a1[_0xa477('0x2e')][_0xa477('0x6c')]?{'message':_0xa477('0x6e'),'statusCode':_0x23dd79[_0xa477('0x6d')]}:_0x23dd79);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 4f39616..0a5b031 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 _0x0943=['int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount'];(function(_0xa19cbd,_0x33d3f4){var _0x247cb0=function(_0x117823){while(--_0x117823){_0xa19cbd['push'](_0xa19cbd['shift']());}};_0x247cb0(++_0x33d3f4);}(_0x0943,0xa9));var _0x3094=function(_0xe8107,_0x11ffeb){_0xe8107=_0xe8107-0x0;var _0x43e8cf=_0x0943[_0xe8107];return _0x43e8cf;};'use strict';var _=require(_0x3094('0x0'));var util=require(_0x3094('0x1'));var logger=require(_0x3094('0x2'))(_0x3094('0x3'));var moment=require(_0x3094('0x4'));var BPromise=require(_0x3094('0x5'));var rp=require(_0x3094('0x6'));var fs=require('fs');var path=require(_0x3094('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3094('0x8'));var integrations=require(_0x3094('0x9'));module[_0x3094('0xa')]=function(_0x1aaac2,_0x79b6be){return _0x1aaac2[_0x3094('0xb')](_0x3094('0xc'),attributes,{'tableName':_0x3094('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf079=['define','FreshdeskAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0xc8a11,_0x347a33){var _0x55a500=function(_0x288d05){while(--_0x288d05){_0xc8a11['push'](_0xc8a11['shift']());}};_0x55a500(++_0x347a33);}(_0xf079,0xb6));var _0x9f07=function(_0x1107bd,_0x54b545){_0x1107bd=_0x1107bd-0x0;var _0x7bd4c=_0xf079[_0x1107bd];return _0x7bd4c;};'use strict';var _=require(_0x9f07('0x0'));var util=require(_0x9f07('0x1'));var logger=require(_0x9f07('0x2'))(_0x9f07('0x3'));var moment=require(_0x9f07('0x4'));var BPromise=require(_0x9f07('0x5'));var rp=require(_0x9f07('0x6'));var fs=require('fs');var path=require(_0x9f07('0x7'));var rimraf=require(_0x9f07('0x8'));var config=require(_0x9f07('0x9'));var attributes=require(_0x9f07('0xa'));var integrations=require(_0x9f07('0xb'));module[_0x9f07('0xc')]=function(_0x1d3bc2,_0x417502){return _0x1d3bc2[_0x9f07('0xd')](_0x9f07('0xe'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index fbce093..c8e39e6 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 _0xdd86=['options','where','attributes','limit','include','map','model','ShowFreshdeskAccount','raw','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetFreshdeskAccount','FreshdeskAccount'];(function(_0x1a07ef,_0x57325f){var _0x5b4edb=function(_0x1eee30){while(--_0x1eee30){_0x1a07ef['push'](_0x1a07ef['shift']());}};_0x5b4edb(++_0x57325f);}(_0xdd86,0x15d));var _0x6dd8=function(_0x82b064,_0x4f1d65){_0x82b064=_0x82b064-0x0;var _0x1b1f81=_0xdd86[_0x82b064];return _0x1b1f81;};'use strict';var _=require(_0x6dd8('0x0'));var util=require(_0x6dd8('0x1'));var moment=require(_0x6dd8('0x2'));var BPromise=require('bluebird');var rs=require(_0x6dd8('0x3'));var fs=require('fs');var Redis=require(_0x6dd8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6dd8('0x5'));var logger=require(_0x6dd8('0x6'))(_0x6dd8('0x7'));var config=require(_0x6dd8('0x8'));var jayson=require(_0x6dd8('0x9'));var client=jayson['client'][_0x6dd8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ef54d,_0x153d35,_0x3aaf14){return new BPromise(function(_0x3e139f,_0x40a062){return client[_0x6dd8('0xb')](_0x2ef54d,_0x3aaf14)[_0x6dd8('0xc')](function(_0x5de94c){logger['info'](_0x6dd8('0xd'),_0x153d35,_0x6dd8('0xe'));logger[_0x6dd8('0xf')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x153d35,'request\x20sent',JSON[_0x6dd8('0x10')](_0x5de94c));if(_0x5de94c[_0x6dd8('0x11')]){if(_0x5de94c[_0x6dd8('0x11')][_0x6dd8('0x12')]===0x1f4){logger[_0x6dd8('0x11')](_0x6dd8('0xd'),_0x153d35,_0x5de94c[_0x6dd8('0x11')][_0x6dd8('0x13')]);return _0x40a062(_0x5de94c['error'][_0x6dd8('0x13')]);}logger[_0x6dd8('0x11')](_0x6dd8('0xd'),_0x153d35,_0x5de94c[_0x6dd8('0x11')][_0x6dd8('0x13')]);return _0x3e139f(_0x5de94c[_0x6dd8('0x11')][_0x6dd8('0x13')]);}else{logger[_0x6dd8('0x14')]('FreshdeskAccount,\x20%s,\x20%s',_0x153d35,_0x6dd8('0xe'));_0x3e139f(_0x5de94c[_0x6dd8('0x15')]['message']);}})[_0x6dd8('0x16')](function(_0x4e4f65){logger[_0x6dd8('0x11')](_0x6dd8('0xd'),_0x153d35,_0x4e4f65);_0x40a062(_0x4e4f65);});});}exports[_0x6dd8('0x17')]=function(_0x4e2ba4){var _0x1b6162=this;return new Promise(function(_0x5b8ff8,_0x12384f){return db[_0x6dd8('0x18')]['findAll']({'raw':_0x4e2ba4['options']?_0x4e2ba4[_0x6dd8('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4e2ba4[_0x6dd8('0x19')]?_0x4e2ba4[_0x6dd8('0x19')][_0x6dd8('0x1a')]||null:null,'attributes':_0x4e2ba4[_0x6dd8('0x19')]?_0x4e2ba4[_0x6dd8('0x19')][_0x6dd8('0x1b')]||null:null,'limit':_0x4e2ba4[_0x6dd8('0x19')]?_0x4e2ba4[_0x6dd8('0x19')][_0x6dd8('0x1c')]||null:null,'include':_0x4e2ba4[_0x6dd8('0x19')]?_0x4e2ba4['options'][_0x6dd8('0x1d')]?_[_0x6dd8('0x1e')](_0x4e2ba4[_0x6dd8('0x19')][_0x6dd8('0x1d')],function(_0x377be1){return{'model':db[_0x377be1[_0x6dd8('0x1f')]],'as':_0x377be1['as'],'attributes':_0x377be1[_0x6dd8('0x1b')],'include':_0x377be1[_0x6dd8('0x1d')]?_[_0x6dd8('0x1e')](_0x377be1['include'],function(_0x37223f){return{'model':db[_0x37223f[_0x6dd8('0x1f')]],'as':_0x37223f['as'],'attributes':_0x37223f[_0x6dd8('0x1b')],'include':_0x37223f['include']?_[_0x6dd8('0x1e')](_0x37223f[_0x6dd8('0x1d')],function(_0xe2bead){return{'model':db[_0xe2bead[_0x6dd8('0x1f')]],'as':_0xe2bead['as'],'attributes':_0xe2bead['attributes']};}):[]};}):[]};}):[]:[]})[_0x6dd8('0xc')](function(_0x52602a){logger['info']('GetFreshdeskAccount',_0x4e2ba4);logger['debug']('GetFreshdeskAccount',_0x4e2ba4,JSON[_0x6dd8('0x10')](_0x52602a));_0x5b8ff8(_0x52602a);})['catch'](function(_0x330144){logger[_0x6dd8('0x11')](_0x6dd8('0x17'),_0x330144['message'],_0x4e2ba4);_0x12384f(_0x1b6162[_0x6dd8('0x11')](0x1f4,_0x330144[_0x6dd8('0x13')]));});});};exports[_0x6dd8('0x20')]=function(_0x104057){var _0x10034e=this;return new Promise(function(_0x1a8cc1,_0x170b84){return db[_0x6dd8('0x18')]['find']({'raw':_0x104057['options']?_0x104057['options'][_0x6dd8('0x21')]===undefined?!![]:![]:!![],'where':_0x104057[_0x6dd8('0x19')]?_0x104057[_0x6dd8('0x19')][_0x6dd8('0x1a')]||null:null,'attributes':_0x104057[_0x6dd8('0x19')]?_0x104057[_0x6dd8('0x19')][_0x6dd8('0x1b')]||null:null,'include':_0x104057[_0x6dd8('0x19')]?_0x104057[_0x6dd8('0x19')]['include']?_['map'](_0x104057[_0x6dd8('0x19')]['include'],function(_0x489cc4){return{'model':db[_0x489cc4[_0x6dd8('0x1f')]],'as':_0x489cc4['as'],'attributes':_0x489cc4[_0x6dd8('0x1b')],'include':_0x489cc4[_0x6dd8('0x1d')]?_[_0x6dd8('0x1e')](_0x489cc4['include'],function(_0x47ea36){return{'model':db[_0x47ea36[_0x6dd8('0x1f')]],'as':_0x47ea36['as'],'attributes':_0x47ea36[_0x6dd8('0x1b')],'include':_0x47ea36[_0x6dd8('0x1d')]?_[_0x6dd8('0x1e')](_0x47ea36[_0x6dd8('0x1d')],function(_0x2bca9b){return{'model':db[_0x2bca9b['model']],'as':_0x2bca9b['as'],'attributes':_0x2bca9b[_0x6dd8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6dd8('0xc')](function(_0x74f9d0){logger[_0x6dd8('0x14')](_0x6dd8('0x20'),_0x104057);logger[_0x6dd8('0xf')](_0x6dd8('0x20'),_0x104057,JSON[_0x6dd8('0x10')](_0x74f9d0));_0x1a8cc1(_0x74f9d0);})['catch'](function(_0x52ae17){logger[_0x6dd8('0x11')](_0x6dd8('0x20'),_0x52ae17[_0x6dd8('0x13')],_0x104057);_0x170b84(_0x10034e['error'](0x1f4,_0x52ae17[_0x6dd8('0x13')]));});});}; \ No newline at end of file +var _0xbde3=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','attributes','limit','include','map','model','ShowFreshdeskAccount','find','where','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x38e7f0,_0x2df6e3){var _0x4899f1=function(_0x577a1c){while(--_0x577a1c){_0x38e7f0['push'](_0x38e7f0['shift']());}};_0x4899f1(++_0x2df6e3);}(_0xbde3,0xf6));var _0x3bde=function(_0x59f5fe,_0x4524ed){_0x59f5fe=_0x59f5fe-0x0;var _0x398bd2=_0xbde3[_0x59f5fe];return _0x398bd2;};'use strict';var _=require(_0x3bde('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3bde('0x1'));var rs=require(_0x3bde('0x2'));var fs=require('fs');var Redis=require(_0x3bde('0x3'));var db=require(_0x3bde('0x4'))['db'];var utils=require(_0x3bde('0x5'));var logger=require(_0x3bde('0x6'))(_0x3bde('0x7'));var config=require(_0x3bde('0x8'));var jayson=require(_0x3bde('0x9'));var client=jayson[_0x3bde('0xa')][_0x3bde('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e1445,_0x9245a1,_0x567143){return new BPromise(function(_0x262094,_0x3a3e5f){return client[_0x3bde('0xc')](_0x1e1445,_0x567143)['then'](function(_0x30225c){logger[_0x3bde('0xd')](_0x3bde('0xe'),_0x9245a1,_0x3bde('0xf'));logger[_0x3bde('0x10')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x9245a1,_0x3bde('0xf'),JSON[_0x3bde('0x11')](_0x30225c));if(_0x30225c[_0x3bde('0x12')]){if(_0x30225c[_0x3bde('0x12')][_0x3bde('0x13')]===0x1f4){logger[_0x3bde('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x9245a1,_0x30225c[_0x3bde('0x12')]['message']);return _0x3a3e5f(_0x30225c[_0x3bde('0x12')]['message']);}logger[_0x3bde('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x9245a1,_0x30225c['error']['message']);return _0x262094(_0x30225c[_0x3bde('0x12')][_0x3bde('0x14')]);}else{logger[_0x3bde('0xd')](_0x3bde('0xe'),_0x9245a1,_0x3bde('0xf'));_0x262094(_0x30225c[_0x3bde('0x15')][_0x3bde('0x14')]);}})[_0x3bde('0x16')](function(_0x54d0ee){logger[_0x3bde('0x12')](_0x3bde('0xe'),_0x9245a1,_0x54d0ee);_0x3a3e5f(_0x54d0ee);});});}exports[_0x3bde('0x17')]=function(_0x47fe9e){var _0x10ecf1=this;return new Promise(function(_0x240b17,_0x59e538){return db[_0x3bde('0x18')][_0x3bde('0x19')]({'raw':_0x47fe9e[_0x3bde('0x1a')]?_0x47fe9e[_0x3bde('0x1a')][_0x3bde('0x1b')]===undefined?!![]:![]:!![],'where':_0x47fe9e['options']?_0x47fe9e[_0x3bde('0x1a')]['where']||null:null,'attributes':_0x47fe9e[_0x3bde('0x1a')]?_0x47fe9e['options'][_0x3bde('0x1c')]||null:null,'limit':_0x47fe9e[_0x3bde('0x1a')]?_0x47fe9e[_0x3bde('0x1a')][_0x3bde('0x1d')]||null:null,'include':_0x47fe9e[_0x3bde('0x1a')]?_0x47fe9e['options'][_0x3bde('0x1e')]?_[_0x3bde('0x1f')](_0x47fe9e[_0x3bde('0x1a')][_0x3bde('0x1e')],function(_0x3e0b4e){return{'model':db[_0x3e0b4e[_0x3bde('0x20')]],'as':_0x3e0b4e['as'],'attributes':_0x3e0b4e['attributes'],'include':_0x3e0b4e[_0x3bde('0x1e')]?_[_0x3bde('0x1f')](_0x3e0b4e['include'],function(_0x140f81){return{'model':db[_0x140f81['model']],'as':_0x140f81['as'],'attributes':_0x140f81[_0x3bde('0x1c')],'include':_0x140f81[_0x3bde('0x1e')]?_[_0x3bde('0x1f')](_0x140f81[_0x3bde('0x1e')],function(_0x378172){return{'model':db[_0x378172['model']],'as':_0x378172['as'],'attributes':_0x378172[_0x3bde('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x375406){logger[_0x3bde('0xd')](_0x3bde('0x17'),_0x47fe9e);logger['debug'](_0x3bde('0x17'),_0x47fe9e,JSON[_0x3bde('0x11')](_0x375406));_0x240b17(_0x375406);})[_0x3bde('0x16')](function(_0x1f212b){logger[_0x3bde('0x12')](_0x3bde('0x17'),_0x1f212b[_0x3bde('0x14')],_0x47fe9e);_0x59e538(_0x10ecf1['error'](0x1f4,_0x1f212b[_0x3bde('0x14')]));});});};exports[_0x3bde('0x21')]=function(_0x22ab6a){var _0x50d3f1=this;return new Promise(function(_0x18d82b,_0x367036){return db[_0x3bde('0x18')][_0x3bde('0x22')]({'raw':_0x22ab6a['options']?_0x22ab6a[_0x3bde('0x1a')][_0x3bde('0x1b')]===undefined?!![]:![]:!![],'where':_0x22ab6a['options']?_0x22ab6a[_0x3bde('0x1a')][_0x3bde('0x23')]||null:null,'attributes':_0x22ab6a[_0x3bde('0x1a')]?_0x22ab6a[_0x3bde('0x1a')][_0x3bde('0x1c')]||null:null,'include':_0x22ab6a[_0x3bde('0x1a')]?_0x22ab6a[_0x3bde('0x1a')][_0x3bde('0x1e')]?_['map'](_0x22ab6a[_0x3bde('0x1a')][_0x3bde('0x1e')],function(_0x4d51b8){return{'model':db[_0x4d51b8[_0x3bde('0x20')]],'as':_0x4d51b8['as'],'attributes':_0x4d51b8[_0x3bde('0x1c')],'include':_0x4d51b8['include']?_[_0x3bde('0x1f')](_0x4d51b8[_0x3bde('0x1e')],function(_0x2a0422){return{'model':db[_0x2a0422[_0x3bde('0x20')]],'as':_0x2a0422['as'],'attributes':_0x2a0422[_0x3bde('0x1c')],'include':_0x2a0422[_0x3bde('0x1e')]?_[_0x3bde('0x1f')](_0x2a0422['include'],function(_0x3a37dc){return{'model':db[_0x3a37dc[_0x3bde('0x20')]],'as':_0x3a37dc['as'],'attributes':_0x3a37dc['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d1e9f){logger['info']('ShowFreshdeskAccount',_0x22ab6a);logger[_0x3bde('0x10')](_0x3bde('0x21'),_0x22ab6a,JSON[_0x3bde('0x11')](_0x4d1e9f));_0x18d82b(_0x4d1e9f);})['catch'](function(_0x546836){logger[_0x3bde('0x12')](_0x3bde('0x21'),_0x546836[_0x3bde('0x14')],_0x22ab6a);_0x367036(_0x50d3f1[_0x3bde('0x12')](0x1f4,_0x546836[_0x3bde('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 8159600..d8409a0 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 _0x8fd8=['get','isAuthenticated','index','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','getTags','post','setTags','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x14ace9,_0x25e941){var _0x3a5913=function(_0x2ab6f4){while(--_0x2ab6f4){_0x14ace9['push'](_0x14ace9['shift']());}};_0x3a5913(++_0x25e941);}(_0x8fd8,0x147));var _0x88fd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8fd8[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x88fd('0x0'));var util=require(_0x88fd('0x1'));var path=require(_0x88fd('0x2'));var timeout=require(_0x88fd('0x3'));var express=require(_0x88fd('0x4'));var router=express[_0x88fd('0x5')]();var fs_extra=require(_0x88fd('0x6'));var auth=require(_0x88fd('0x7'));var interaction=require(_0x88fd('0x8'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router[_0x88fd('0x9')]('/',auth[_0x88fd('0xa')](),controller[_0x88fd('0xb')]);router[_0x88fd('0x9')]('/:id',auth[_0x88fd('0xa')](),controller['show']);router[_0x88fd('0x9')](_0x88fd('0xc'),auth['isAuthenticated'](),controller[_0x88fd('0xd')]);router['get'](_0x88fd('0xe'),auth[_0x88fd('0xa')](),controller['getSubjects']);router[_0x88fd('0x9')](_0x88fd('0xf'),auth['isAuthenticated'](),controller[_0x88fd('0x10')]);router[_0x88fd('0x9')]('/:id/tags',auth[_0x88fd('0xa')](),controller[_0x88fd('0x11')]);router[_0x88fd('0x12')]('/',auth[_0x88fd('0xa')](),controller['create']);router[_0x88fd('0x12')]('/:id/tags',auth[_0x88fd('0xa')](),controller[_0x88fd('0x13')]);router['put']('/:id',auth[_0x88fd('0xa')](),controller['update']);router[_0x88fd('0x14')](_0x88fd('0x15'),auth['isAuthenticated'](),controller[_0x88fd('0x16')]);module[_0x88fd('0x17')]=router; \ No newline at end of file +var _0x7727=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getDescriptions','/:id/tags','post','create','delete','destroy','exports'];(function(_0x47c0c1,_0x2fd98f){var _0x48e551=function(_0x7d272f){while(--_0x7d272f){_0x47c0c1['push'](_0x47c0c1['shift']());}};_0x48e551(++_0x2fd98f);}(_0x7727,0x1cc));var _0x7772=function(_0x4b92f0,_0x5255d3){_0x4b92f0=_0x4b92f0-0x0;var _0x1626a3=_0x7727[_0x4b92f0];return _0x1626a3;};'use strict';var multer=require('multer');var util=require(_0x7772('0x0'));var path=require(_0x7772('0x1'));var timeout=require(_0x7772('0x2'));var express=require(_0x7772('0x3'));var router=express[_0x7772('0x4')]();var fs_extra=require(_0x7772('0x5'));var auth=require(_0x7772('0x6'));var interaction=require(_0x7772('0x7'));var config=require('../../config/environment');var controller=require(_0x7772('0x8'));router[_0x7772('0x9')]('/',auth[_0x7772('0xa')](),controller[_0x7772('0xb')]);router[_0x7772('0x9')](_0x7772('0xc'),auth[_0x7772('0xa')](),controller[_0x7772('0xd')]);router[_0x7772('0x9')]('/:id/fields',auth[_0x7772('0xa')](),controller[_0x7772('0xe')]);router[_0x7772('0x9')](_0x7772('0xf'),auth[_0x7772('0xa')](),controller['getSubjects']);router[_0x7772('0x9')]('/:id/descriptions',auth[_0x7772('0xa')](),controller[_0x7772('0x10')]);router['get'](_0x7772('0x11'),auth['isAuthenticated'](),controller['getTags']);router[_0x7772('0x12')]('/',auth[_0x7772('0xa')](),controller[_0x7772('0x13')]);router[_0x7772('0x12')]('/:id/tags',auth[_0x7772('0xa')](),controller['setTags']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x7772('0x14')](_0x7772('0xc'),auth[_0x7772('0xa')](),controller[_0x7772('0x15')]);module[_0x7772('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index cc7b3bf..1f7ee9a 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 _0xf911=['sequelize','exports','STRING'];(function(_0x4f4c84,_0x25ed17){var _0x5f03c4=function(_0x1a063e){while(--_0x1a063e){_0x4f4c84['push'](_0x4f4c84['shift']());}};_0x5f03c4(++_0x25ed17);}(_0xf911,0x1ef));var _0x1f91=function(_0xfc4cd8,_0x25007c){_0xfc4cd8=_0xfc4cd8-0x0;var _0x110fc0=_0xf911[_0xfc4cd8];return _0x110fc0;};'use strict';var Sequelize=require(_0x1f91('0x0'));module[_0x1f91('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1f91('0x2')]}}; \ No newline at end of file +var _0x2071=['STRING'];(function(_0x1bfe82,_0x3e3bbd){var _0x2b7723=function(_0x49e9f4){while(--_0x49e9f4){_0x1bfe82['push'](_0x1bfe82['shift']());}};_0x2b7723(++_0x3e3bbd);}(_0x2071,0x1d9));var _0x1207=function(_0x39b316,_0x3def1e){_0x39b316=_0x39b316-0x0;var _0x182ab1=_0x2071[_0x39b316];return _0x182ab1;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1207('0x0')]},'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 1b899fc..704ee26 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 _0x09d8=['rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','catch','show','params','intersection','options','find','create','body','update','getFields','findOne','order','map','getSubjects','FreshdeskField','getDescriptions','getTags','setTags','ids','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','save','then','destroy','error','stack','name','send','index','FreshdeskConfiguration'];(function(_0x4badf7,_0x4204b2){var _0x119084=function(_0x3f22d4){while(--_0x3f22d4){_0x4badf7['push'](_0x4badf7['shift']());}};_0x119084(++_0x4204b2);}(_0x09d8,0x115));var _0x809d=function(_0x489d5c,_0x3beb3b){_0x489d5c=_0x489d5c-0x0;var _0xcd7e2a=_0x09d8[_0x489d5c];return _0xcd7e2a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x809d('0x0'));var zipdir=require(_0x809d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x809d('0x2'));var moment=require(_0x809d('0x3'));var BPromise=require(_0x809d('0x4'));var Mustache=require('mustache');var util=require(_0x809d('0x5'));var path=require(_0x809d('0x6'));var sox=require(_0x809d('0x7'));var csv=require(_0x809d('0x8'));var ejs=require(_0x809d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x809d('0xa'));var squel=require(_0x809d('0xb'));var crypto=require('crypto');var jsforce=require(_0x809d('0xc'));var deskjs=require(_0x809d('0xd'));var toCsv=require(_0x809d('0x8'));var querystring=require(_0x809d('0xe'));var Papa=require(_0x809d('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x809d('0x10'));var as=require(_0x809d('0x11'));var hardwareService=require(_0x809d('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x809d('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x809d('0x14'))['db'];function respondWithStatusCode(_0x2bd2dd,_0x4348fb){_0x4348fb=_0x4348fb||0xcc;return function(_0x181a76){if(_0x181a76){return _0x2bd2dd[_0x809d('0x15')](_0x4348fb);}return _0x2bd2dd[_0x809d('0x16')](_0x4348fb)[_0x809d('0x17')]();};}function respondWithResult(_0x57fce7,_0x5c5dfb){_0x5c5dfb=_0x5c5dfb||0xc8;return function(_0x55fa61){if(_0x55fa61){return _0x57fce7[_0x809d('0x16')](_0x5c5dfb)[_0x809d('0x18')](_0x55fa61);}};}function respondWithFilteredResult(_0x7719e1,_0x29a4eb){return function(_0x4ec5c4){if(_0x4ec5c4){var _0x1293d2=typeof _0x29a4eb['offset']===_0x809d('0x19')&&typeof _0x29a4eb[_0x809d('0x1a')]===_0x809d('0x19');var _0x160581=_0x4ec5c4[_0x809d('0x1b')];var _0x18dd7c=_0x1293d2?0x0:_0x29a4eb[_0x809d('0x1c')];var _0x32c963=_0x1293d2?_0x4ec5c4['count']:_0x29a4eb[_0x809d('0x1c')]+_0x29a4eb[_0x809d('0x1a')];var _0x26be92;if(_0x32c963>=_0x160581){_0x32c963=_0x160581;_0x26be92=0xc8;}else{_0x26be92=0xce;}_0x7719e1[_0x809d('0x16')](_0x26be92);return _0x7719e1[_0x809d('0x1d')]('Content-Range',_0x18dd7c+'-'+_0x32c963+'/'+_0x160581)[_0x809d('0x18')](_0x4ec5c4);}return null;};}function patchUpdates(_0x555dbf){return function(_0x4e67a9){try{jsonpatch['apply'](_0x4e67a9,_0x555dbf,!![]);}catch(_0x34ebf2){return BPromise['reject'](_0x34ebf2);}return _0x4e67a9[_0x809d('0x1e')]();};}function saveUpdates(_0x9e6dea,_0x313c07){return function(_0x2e7468){if(_0x2e7468){return _0x2e7468['update'](_0x9e6dea)[_0x809d('0x1f')](function(_0x3ee845){return _0x3ee845;});}return null;};}function removeEntity(_0x409155,_0x25fffc){return function(_0x41833f){if(_0x41833f){return _0x41833f[_0x809d('0x20')]()[_0x809d('0x1f')](function(){_0x409155[_0x809d('0x16')](0xcc)[_0x809d('0x17')]();});}};}function handleEntityNotFound(_0xce4d11,_0x141f9c){return function(_0xf1425f){if(!_0xf1425f){_0xce4d11['sendStatus'](0x194);}return _0xf1425f;};}function handleError(_0x57562b,_0x2b0a1d){_0x2b0a1d=_0x2b0a1d||0x1f4;return function(_0x2d0ee0){logger[_0x809d('0x21')](_0x2d0ee0[_0x809d('0x22')]);if(_0x2d0ee0[_0x809d('0x23')]){delete _0x2d0ee0[_0x809d('0x23')];}_0x57562b[_0x809d('0x16')](_0x2b0a1d)[_0x809d('0x24')](_0x2d0ee0);};}exports[_0x809d('0x25')]=function(_0x55aa93,_0x21c29f){var _0x1e4c48={},_0x5a654c={},_0x4acc95={'count':0x0,'rows':[]};var _0x4dab81=_['map'](db[_0x809d('0x26')][_0x809d('0x27')],function(_0x5ddfc2){return{'name':_0x5ddfc2[_0x809d('0x28')],'type':_0x5ddfc2[_0x809d('0x29')][_0x809d('0x2a')]};});_0x5a654c[_0x809d('0x2b')]=_['map'](_0x4dab81,_0x809d('0x23'));_0x5a654c[_0x809d('0x2c')]=_[_0x809d('0x2d')](_0x55aa93['query']);_0x5a654c[_0x809d('0x2e')]=_['intersection'](_0x5a654c['model'],_0x5a654c[_0x809d('0x2c')]);_0x1e4c48[_0x809d('0x2f')]=_['intersection'](_0x5a654c[_0x809d('0x2b')],qs['fields'](_0x55aa93[_0x809d('0x2c')][_0x809d('0x30')]));_0x1e4c48[_0x809d('0x2f')]=_0x1e4c48[_0x809d('0x2f')][_0x809d('0x31')]?_0x1e4c48[_0x809d('0x2f')]:_0x5a654c[_0x809d('0x2b')];if(!_0x55aa93[_0x809d('0x2c')][_0x809d('0x32')](_0x809d('0x33'))){_0x1e4c48['limit']=qs[_0x809d('0x1a')](_0x55aa93[_0x809d('0x2c')][_0x809d('0x1a')]);_0x1e4c48[_0x809d('0x1c')]=qs[_0x809d('0x1c')](_0x55aa93[_0x809d('0x2c')][_0x809d('0x1c')]);}_0x1e4c48['order']=qs[_0x809d('0x34')](_0x55aa93[_0x809d('0x2c')][_0x809d('0x34')]);_0x1e4c48[_0x809d('0x35')]=qs[_0x809d('0x2e')](_[_0x809d('0x36')](_0x55aa93[_0x809d('0x2c')],_0x5a654c[_0x809d('0x2e')]),_0x4dab81);if(_0x55aa93[_0x809d('0x2c')][_0x809d('0x37')]){_0x1e4c48['where']=_[_0x809d('0x38')](_0x1e4c48['where'],{'$or':_['map'](_0x4dab81,function(_0x13da57){if(_0x13da57[_0x809d('0x29')]!==_0x809d('0x39')){var _0x431e4d={};_0x431e4d[_0x13da57[_0x809d('0x23')]]={'$like':'%'+_0x55aa93[_0x809d('0x2c')]['filter']+'%'};return _0x431e4d;}})});}_0x1e4c48=_['merge']({},_0x1e4c48,_0x55aa93['options']);var _0x1fa16e={'where':_0x1e4c48[_0x809d('0x35')]};return db[_0x809d('0x26')][_0x809d('0x1b')](_0x1fa16e)['then'](function(_0x134ed4){_0x4acc95[_0x809d('0x1b')]=_0x134ed4;if(_0x55aa93[_0x809d('0x2c')][_0x809d('0x3a')]){_0x1e4c48[_0x809d('0x3b')]=[{'all':!![]}];}return db[_0x809d('0x26')]['findAll'](_0x1e4c48);})['then'](function(_0x40a0fa){_0x4acc95['rows']=_0x40a0fa;return _0x4acc95;})['then'](respondWithFilteredResult(_0x21c29f,_0x1e4c48))[_0x809d('0x3c')](handleError(_0x21c29f,null));};exports[_0x809d('0x3d')]=function(_0xf485e9,_0x4d08c9){var _0x3a1fd8={'raw':![],'where':{'id':_0xf485e9[_0x809d('0x3e')]['id']}},_0x28b615={};_0x28b615['model']=_['keys'](db[_0x809d('0x26')][_0x809d('0x27')]);_0x28b615['query']=_[_0x809d('0x2d')](_0xf485e9['query']);_0x28b615[_0x809d('0x2e')]=_[_0x809d('0x3f')](_0x28b615[_0x809d('0x2b')],_0x28b615['query']);_0x3a1fd8[_0x809d('0x2f')]=_[_0x809d('0x3f')](_0x28b615['model'],qs['fields'](_0xf485e9['query'][_0x809d('0x30')]));_0x3a1fd8[_0x809d('0x2f')]=_0x3a1fd8[_0x809d('0x2f')]['length']?_0x3a1fd8[_0x809d('0x2f')]:_0x28b615[_0x809d('0x2b')];if(_0xf485e9[_0x809d('0x2c')][_0x809d('0x3a')]){_0x3a1fd8['include']=[{'all':!![]}];}_0x3a1fd8=_[_0x809d('0x38')]({},_0x3a1fd8,_0xf485e9[_0x809d('0x40')]);return db['FreshdeskConfiguration'][_0x809d('0x41')](_0x3a1fd8)['then'](handleEntityNotFound(_0x4d08c9,null))[_0x809d('0x1f')](respondWithResult(_0x4d08c9,null))['catch'](handleError(_0x4d08c9,null));};exports[_0x809d('0x42')]=function(_0x1089d8,_0x3dfe99){return db[_0x809d('0x26')][_0x809d('0x42')](_0x1089d8[_0x809d('0x43')],{})[_0x809d('0x1f')](respondWithResult(_0x3dfe99,0xc9))[_0x809d('0x3c')](handleError(_0x3dfe99,null));};exports[_0x809d('0x44')]=function(_0x618b4b,_0x29794d){if(_0x618b4b['body']['id']){delete _0x618b4b[_0x809d('0x43')]['id'];}return db[_0x809d('0x26')][_0x809d('0x41')]({'where':{'id':_0x618b4b[_0x809d('0x3e')]['id']}})['then'](handleEntityNotFound(_0x29794d,null))[_0x809d('0x1f')](saveUpdates(_0x618b4b[_0x809d('0x43')],null))['then'](respondWithResult(_0x29794d,null))[_0x809d('0x3c')](handleError(_0x29794d,null));};exports['destroy']=function(_0x381871,_0x27e255){return db[_0x809d('0x26')][_0x809d('0x41')]({'where':{'id':_0x381871[_0x809d('0x3e')]['id']}})[_0x809d('0x1f')](handleEntityNotFound(_0x27e255,null))[_0x809d('0x1f')](removeEntity(_0x27e255,null))[_0x809d('0x3c')](handleError(_0x27e255,null));};exports[_0x809d('0x45')]=function(_0xfb90a,_0x344bdf,_0xbd4854){var _0x414d9f={};var _0x246a7e={};var _0x6fabad;var _0x1bc76e;return db['FreshdeskConfiguration'][_0x809d('0x46')]({'where':{'id':_0xfb90a[_0x809d('0x3e')]['id']}})['then'](handleEntityNotFound(_0x344bdf,null))[_0x809d('0x1f')](function(_0x5582e7){if(_0x5582e7){_0x6fabad=_0x5582e7;_0x246a7e['model']=_[_0x809d('0x2d')](db['FreshdeskField'][_0x809d('0x27')]);_0x246a7e[_0x809d('0x2c')]=_[_0x809d('0x2d')](_0xfb90a['query']);_0x246a7e[_0x809d('0x2e')]=_[_0x809d('0x3f')](_0x246a7e['model'],_0x246a7e[_0x809d('0x2c')]);_0x414d9f[_0x809d('0x2f')]=_['intersection'](_0x246a7e[_0x809d('0x2b')],qs[_0x809d('0x30')](_0xfb90a['query'][_0x809d('0x30')]));_0x414d9f[_0x809d('0x2f')]=_0x414d9f[_0x809d('0x2f')]['length']?_0x414d9f['attributes']:_0x246a7e[_0x809d('0x2b')];_0x414d9f[_0x809d('0x47')]=qs[_0x809d('0x34')](_0xfb90a[_0x809d('0x2c')][_0x809d('0x34')]);_0x414d9f[_0x809d('0x35')]=qs[_0x809d('0x2e')](_['pick'](_0xfb90a['query'],_0x246a7e[_0x809d('0x2e')]));if(_0xfb90a[_0x809d('0x2c')][_0x809d('0x37')]){_0x414d9f[_0x809d('0x35')]=_[_0x809d('0x38')](_0x414d9f['where'],{'$or':_[_0x809d('0x48')](_0x414d9f['attributes'],function(_0x572d24){var _0x595cfc={};_0x595cfc[_0x572d24]={'$like':'%'+_0xfb90a['query'][_0x809d('0x37')]+'%'};return _0x595cfc;})});}_0x414d9f=_[_0x809d('0x38')]({},_0x414d9f,_0xfb90a[_0x809d('0x40')]);return _0x6fabad[_0x809d('0x45')](_0x414d9f);}})[_0x809d('0x1f')](function(_0x2ff67f){if(_0x2ff67f){_0x1bc76e=_0x2ff67f[_0x809d('0x31')];if(!_0xfb90a[_0x809d('0x2c')][_0x809d('0x32')](_0x809d('0x33'))){_0x414d9f[_0x809d('0x1a')]=qs[_0x809d('0x1a')](_0xfb90a[_0x809d('0x2c')][_0x809d('0x1a')]);_0x414d9f[_0x809d('0x1c')]=qs[_0x809d('0x1c')](_0xfb90a[_0x809d('0x2c')][_0x809d('0x1c')]);}return _0x6fabad[_0x809d('0x45')](_0x414d9f);}})[_0x809d('0x1f')](function(_0x2f3176){if(_0x2f3176){return _0x2f3176?{'count':_0x1bc76e,'rows':_0x2f3176}:null;}})[_0x809d('0x1f')](respondWithResult(_0x344bdf,null))[_0x809d('0x3c')](handleError(_0x344bdf,null));};exports[_0x809d('0x49')]=function(_0x232c72,_0xd5a194,_0x1a2e92){var _0x4ff6a3={};var _0x38fba4={};var _0xc560ee;var _0x378f16;return db[_0x809d('0x26')]['findOne']({'where':{'id':_0x232c72['params']['id']}})[_0x809d('0x1f')](handleEntityNotFound(_0xd5a194,null))[_0x809d('0x1f')](function(_0x5bf431){if(_0x5bf431){_0xc560ee=_0x5bf431;_0x38fba4[_0x809d('0x2b')]=_[_0x809d('0x2d')](db[_0x809d('0x4a')][_0x809d('0x27')]);_0x38fba4[_0x809d('0x2c')]=_[_0x809d('0x2d')](_0x232c72[_0x809d('0x2c')]);_0x38fba4[_0x809d('0x2e')]=_['intersection'](_0x38fba4[_0x809d('0x2b')],_0x38fba4[_0x809d('0x2c')]);_0x4ff6a3[_0x809d('0x2f')]=_['intersection'](_0x38fba4['model'],qs[_0x809d('0x30')](_0x232c72[_0x809d('0x2c')][_0x809d('0x30')]));_0x4ff6a3[_0x809d('0x2f')]=_0x4ff6a3[_0x809d('0x2f')]['length']?_0x4ff6a3['attributes']:_0x38fba4[_0x809d('0x2b')];_0x4ff6a3[_0x809d('0x47')]=qs[_0x809d('0x34')](_0x232c72[_0x809d('0x2c')]['sort']);_0x4ff6a3[_0x809d('0x35')]=qs[_0x809d('0x2e')](_['pick'](_0x232c72[_0x809d('0x2c')],_0x38fba4[_0x809d('0x2e')]));if(_0x232c72['query'][_0x809d('0x37')]){_0x4ff6a3[_0x809d('0x35')]=_[_0x809d('0x38')](_0x4ff6a3[_0x809d('0x35')],{'$or':_[_0x809d('0x48')](_0x4ff6a3['attributes'],function(_0x594726){var _0x1da3f2={};_0x1da3f2[_0x594726]={'$like':'%'+_0x232c72[_0x809d('0x2c')][_0x809d('0x37')]+'%'};return _0x1da3f2;})});}_0x4ff6a3=_['merge']({},_0x4ff6a3,_0x232c72[_0x809d('0x40')]);return _0xc560ee['getSubjects'](_0x4ff6a3);}})['then'](function(_0x4816fe){if(_0x4816fe){_0x378f16=_0x4816fe[_0x809d('0x31')];if(!_0x232c72[_0x809d('0x2c')]['hasOwnProperty'](_0x809d('0x33'))){_0x4ff6a3[_0x809d('0x1a')]=qs['limit'](_0x232c72[_0x809d('0x2c')][_0x809d('0x1a')]);_0x4ff6a3[_0x809d('0x1c')]=qs[_0x809d('0x1c')](_0x232c72[_0x809d('0x2c')][_0x809d('0x1c')]);}return _0xc560ee[_0x809d('0x49')](_0x4ff6a3);}})['then'](function(_0x434274){if(_0x434274){return _0x434274?{'count':_0x378f16,'rows':_0x434274}:null;}})[_0x809d('0x1f')](respondWithResult(_0xd5a194,null))[_0x809d('0x3c')](handleError(_0xd5a194,null));};exports[_0x809d('0x4b')]=function(_0x53320f,_0x120e3a,_0x54a00d){var _0x45c683={};var _0x36324c={};var _0x5a72ae;var _0x3da133;return db[_0x809d('0x26')][_0x809d('0x46')]({'where':{'id':_0x53320f[_0x809d('0x3e')]['id']}})[_0x809d('0x1f')](handleEntityNotFound(_0x120e3a,null))[_0x809d('0x1f')](function(_0x85d1f8){if(_0x85d1f8){_0x5a72ae=_0x85d1f8;_0x36324c[_0x809d('0x2b')]=_['keys'](db[_0x809d('0x4a')][_0x809d('0x27')]);_0x36324c[_0x809d('0x2c')]=_[_0x809d('0x2d')](_0x53320f[_0x809d('0x2c')]);_0x36324c['filters']=_[_0x809d('0x3f')](_0x36324c[_0x809d('0x2b')],_0x36324c['query']);_0x45c683[_0x809d('0x2f')]=_[_0x809d('0x3f')](_0x36324c['model'],qs[_0x809d('0x30')](_0x53320f[_0x809d('0x2c')][_0x809d('0x30')]));_0x45c683[_0x809d('0x2f')]=_0x45c683['attributes']['length']?_0x45c683[_0x809d('0x2f')]:_0x36324c[_0x809d('0x2b')];_0x45c683['order']=qs[_0x809d('0x34')](_0x53320f[_0x809d('0x2c')]['sort']);_0x45c683[_0x809d('0x35')]=qs[_0x809d('0x2e')](_[_0x809d('0x36')](_0x53320f['query'],_0x36324c[_0x809d('0x2e')]));if(_0x53320f[_0x809d('0x2c')][_0x809d('0x37')]){_0x45c683[_0x809d('0x35')]=_['merge'](_0x45c683[_0x809d('0x35')],{'$or':_[_0x809d('0x48')](_0x45c683['attributes'],function(_0x3a8633){var _0x16c0c8={};_0x16c0c8[_0x3a8633]={'$like':'%'+_0x53320f[_0x809d('0x2c')]['filter']+'%'};return _0x16c0c8;})});}_0x45c683=_[_0x809d('0x38')]({},_0x45c683,_0x53320f[_0x809d('0x40')]);return _0x5a72ae[_0x809d('0x4b')](_0x45c683);}})[_0x809d('0x1f')](function(_0x40593f){if(_0x40593f){_0x3da133=_0x40593f['length'];if(!_0x53320f[_0x809d('0x2c')]['hasOwnProperty'](_0x809d('0x33'))){_0x45c683[_0x809d('0x1a')]=qs[_0x809d('0x1a')](_0x53320f[_0x809d('0x2c')][_0x809d('0x1a')]);_0x45c683[_0x809d('0x1c')]=qs[_0x809d('0x1c')](_0x53320f[_0x809d('0x2c')][_0x809d('0x1c')]);}return _0x5a72ae[_0x809d('0x4b')](_0x45c683);}})[_0x809d('0x1f')](function(_0x7c63e){if(_0x7c63e){return _0x7c63e?{'count':_0x3da133,'rows':_0x7c63e}:null;}})[_0x809d('0x1f')](respondWithResult(_0x120e3a,null))[_0x809d('0x3c')](handleError(_0x120e3a,null));};exports[_0x809d('0x4c')]=function(_0x55be92,_0x341519,_0xc4c622){var _0x449d00={};var _0x496ca8={};var _0x311068;var _0x5ed1b9;return db['FreshdeskConfiguration'][_0x809d('0x46')]({'where':{'id':_0x55be92[_0x809d('0x3e')]['id']}})[_0x809d('0x1f')](handleEntityNotFound(_0x341519,null))[_0x809d('0x1f')](function(_0x906556){if(_0x906556){_0x311068=_0x906556;_0x496ca8[_0x809d('0x2b')]=_['keys'](db['Tag'][_0x809d('0x27')]);_0x496ca8['query']=_['keys'](_0x55be92[_0x809d('0x2c')]);_0x496ca8[_0x809d('0x2e')]=_[_0x809d('0x3f')](_0x496ca8[_0x809d('0x2b')],_0x496ca8[_0x809d('0x2c')]);_0x449d00['attributes']=_['intersection'](_0x496ca8[_0x809d('0x2b')],qs[_0x809d('0x30')](_0x55be92['query']['fields']));_0x449d00['attributes']=_0x449d00[_0x809d('0x2f')][_0x809d('0x31')]?_0x449d00[_0x809d('0x2f')]:_0x496ca8[_0x809d('0x2b')];_0x449d00['order']=qs['sort'](_0x55be92[_0x809d('0x2c')][_0x809d('0x34')]);_0x449d00['where']=qs['filters'](_['pick'](_0x55be92[_0x809d('0x2c')],_0x496ca8['filters']));if(_0x55be92[_0x809d('0x2c')][_0x809d('0x37')]){_0x449d00[_0x809d('0x35')]=_['merge'](_0x449d00[_0x809d('0x35')],{'$or':_[_0x809d('0x48')](_0x449d00[_0x809d('0x2f')],function(_0x2e929b){var _0x183fd3={};_0x183fd3[_0x2e929b]={'$like':'%'+_0x55be92[_0x809d('0x2c')][_0x809d('0x37')]+'%'};return _0x183fd3;})});}_0x449d00=_[_0x809d('0x38')]({},_0x449d00,_0x55be92[_0x809d('0x40')]);return _0x311068[_0x809d('0x4c')](_0x449d00);}})['then'](function(_0x255f2){if(_0x255f2){_0x5ed1b9=_0x255f2['length'];if(!_0x55be92['query'][_0x809d('0x32')](_0x809d('0x33'))){_0x449d00[_0x809d('0x1a')]=qs[_0x809d('0x1a')](_0x55be92['query']['limit']);_0x449d00['offset']=qs['offset'](_0x55be92[_0x809d('0x2c')]['offset']);}return _0x311068[_0x809d('0x4c')](_0x449d00);}})[_0x809d('0x1f')](function(_0x130e5f){if(_0x130e5f){return _0x130e5f?{'count':_0x5ed1b9,'rows':_0x130e5f}:null;}})[_0x809d('0x1f')](respondWithResult(_0x341519,null))[_0x809d('0x3c')](handleError(_0x341519,null));};exports[_0x809d('0x4d')]=function(_0x54ca17,_0x4ff15f,_0x537a37){if(_0x54ca17[_0x809d('0x43')]['id']){delete _0x54ca17[_0x809d('0x43')]['id'];}return db[_0x809d('0x26')]['findOne']({'where':{'id':_0x54ca17[_0x809d('0x3e')]['id']}})[_0x809d('0x1f')](handleEntityNotFound(_0x4ff15f,null))[_0x809d('0x1f')](function(_0x9e6efc){if(_0x9e6efc){return _0x9e6efc['setTags'](_0x54ca17[_0x809d('0x43')][_0x809d('0x4e')]||[]);}return null;})[_0x809d('0x1f')](respondWithResult(_0x4ff15f,null))[_0x809d('0x3c')](handleError(_0x4ff15f,null));}; \ No newline at end of file +var _0x3f61=['stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','pick','merge','where','VIRTUAL','filter','includeAll','findAll','rows','catch','include','find','create','body','params','getFields','FreshdeskField','sort','options','hasOwnProperty','getSubjects','nolimit','findOne','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','error'];(function(_0x1ae163,_0x55affc){var _0x9c8466=function(_0xf3e81){while(--_0xf3e81){_0x1ae163['push'](_0x1ae163['shift']());}};_0x9c8466(++_0x55affc);}(_0x3f61,0x18a));var _0x13f6=function(_0x2ad70c,_0x202ce3){_0x2ad70c=_0x2ad70c-0x0;var _0x368863=_0x3f61[_0x2ad70c];return _0x368863;};'use strict';var emlformat=require(_0x13f6('0x0'));var rimraf=require(_0x13f6('0x1'));var zipdir=require(_0x13f6('0x2'));var jsonpatch=require(_0x13f6('0x3'));var rp=require('request-promise');var moment=require(_0x13f6('0x4'));var BPromise=require(_0x13f6('0x5'));var Mustache=require(_0x13f6('0x6'));var util=require('util');var path=require(_0x13f6('0x7'));var sox=require(_0x13f6('0x8'));var csv=require('to-csv');var ejs=require(_0x13f6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x13f6('0xa'));var squel=require(_0x13f6('0xb'));var crypto=require('crypto');var jsforce=require(_0x13f6('0xc'));var deskjs=require(_0x13f6('0xd'));var toCsv=require(_0x13f6('0xe'));var querystring=require(_0x13f6('0xf'));var Papa=require(_0x13f6('0x10'));var Redis=require(_0x13f6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x13f6('0x12'));var as=require(_0x13f6('0x13'));var hardwareService=require(_0x13f6('0x14'));var logger=require(_0x13f6('0x15'))(_0x13f6('0x16'));var utils=require('../../config/utils');var config=require(_0x13f6('0x17'));var licenseUtil=require(_0x13f6('0x18'));var db=require(_0x13f6('0x19'))['db'];function respondWithStatusCode(_0x3376cf,_0x4f097b){_0x4f097b=_0x4f097b||0xcc;return function(_0x109a08){if(_0x109a08){return _0x3376cf[_0x13f6('0x1a')](_0x4f097b);}return _0x3376cf['status'](_0x4f097b)[_0x13f6('0x1b')]();};}function respondWithResult(_0x20cb30,_0x5030e5){_0x5030e5=_0x5030e5||0xc8;return function(_0x55ee8a){if(_0x55ee8a){return _0x20cb30[_0x13f6('0x1c')](_0x5030e5)[_0x13f6('0x1d')](_0x55ee8a);}};}function respondWithFilteredResult(_0x5a4e78,_0x58288b){return function(_0x5e0ec3){if(_0x5e0ec3){var _0x6cee14=typeof _0x58288b['offset']===_0x13f6('0x1e')&&typeof _0x58288b[_0x13f6('0x1f')]===_0x13f6('0x1e');var _0x4333af=_0x5e0ec3[_0x13f6('0x20')];var _0x82e68b=_0x6cee14?0x0:_0x58288b[_0x13f6('0x21')];var _0x4b2a14=_0x6cee14?_0x5e0ec3[_0x13f6('0x20')]:_0x58288b['offset']+_0x58288b[_0x13f6('0x1f')];var _0x39dedd;if(_0x4b2a14>=_0x4333af){_0x4b2a14=_0x4333af;_0x39dedd=0xc8;}else{_0x39dedd=0xce;}_0x5a4e78[_0x13f6('0x1c')](_0x39dedd);return _0x5a4e78[_0x13f6('0x22')]('Content-Range',_0x82e68b+'-'+_0x4b2a14+'/'+_0x4333af)[_0x13f6('0x1d')](_0x5e0ec3);}return null;};}function patchUpdates(_0x35c842){return function(_0x46a70c){try{jsonpatch[_0x13f6('0x23')](_0x46a70c,_0x35c842,!![]);}catch(_0x2da303){return BPromise['reject'](_0x2da303);}return _0x46a70c[_0x13f6('0x24')]();};}function saveUpdates(_0x47b3a1,_0x545005){return function(_0x2ae013){if(_0x2ae013){return _0x2ae013[_0x13f6('0x25')](_0x47b3a1)[_0x13f6('0x26')](function(_0x2f3d23){return _0x2f3d23;});}return null;};}function removeEntity(_0xaa93ef,_0x52c08c){return function(_0x5adb39){if(_0x5adb39){return _0x5adb39[_0x13f6('0x27')]()['then'](function(){_0xaa93ef[_0x13f6('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a9ae4,_0x12b347){return function(_0x1db8bb){if(!_0x1db8bb){_0x3a9ae4[_0x13f6('0x1a')](0x194);}return _0x1db8bb;};}function handleError(_0x1fd2ac,_0x374f30){_0x374f30=_0x374f30||0x1f4;return function(_0x1a7736){logger[_0x13f6('0x28')](_0x1a7736[_0x13f6('0x29')]);if(_0x1a7736[_0x13f6('0x2a')]){delete _0x1a7736['name'];}_0x1fd2ac[_0x13f6('0x1c')](_0x374f30)[_0x13f6('0x2b')](_0x1a7736);};}exports[_0x13f6('0x2c')]=function(_0x544e34,_0x5ae0e3){var _0x416ab8={},_0x32da2e={},_0x1791c5={'count':0x0,'rows':[]};var _0x389ed0=_[_0x13f6('0x2d')](db[_0x13f6('0x2e')][_0x13f6('0x2f')],function(_0x373752){return{'name':_0x373752[_0x13f6('0x30')],'type':_0x373752[_0x13f6('0x31')][_0x13f6('0x32')]};});_0x32da2e[_0x13f6('0x33')]=_['map'](_0x389ed0,_0x13f6('0x2a'));_0x32da2e[_0x13f6('0x34')]=_[_0x13f6('0x35')](_0x544e34[_0x13f6('0x34')]);_0x32da2e[_0x13f6('0x36')]=_[_0x13f6('0x37')](_0x32da2e[_0x13f6('0x33')],_0x32da2e[_0x13f6('0x34')]);_0x416ab8[_0x13f6('0x38')]=_[_0x13f6('0x37')](_0x32da2e[_0x13f6('0x33')],qs[_0x13f6('0x39')](_0x544e34[_0x13f6('0x34')]['fields']));_0x416ab8[_0x13f6('0x38')]=_0x416ab8[_0x13f6('0x38')][_0x13f6('0x3a')]?_0x416ab8[_0x13f6('0x38')]:_0x32da2e[_0x13f6('0x33')];if(!_0x544e34['query']['hasOwnProperty']('nolimit')){_0x416ab8[_0x13f6('0x1f')]=qs['limit'](_0x544e34['query'][_0x13f6('0x1f')]);_0x416ab8[_0x13f6('0x21')]=qs[_0x13f6('0x21')](_0x544e34[_0x13f6('0x34')][_0x13f6('0x21')]);}_0x416ab8[_0x13f6('0x3b')]=qs['sort'](_0x544e34[_0x13f6('0x34')]['sort']);_0x416ab8['where']=qs[_0x13f6('0x36')](_[_0x13f6('0x3c')](_0x544e34['query'],_0x32da2e[_0x13f6('0x36')]),_0x389ed0);if(_0x544e34[_0x13f6('0x34')]['filter']){_0x416ab8['where']=_[_0x13f6('0x3d')](_0x416ab8[_0x13f6('0x3e')],{'$or':_[_0x13f6('0x2d')](_0x389ed0,function(_0xf149e6){if(_0xf149e6[_0x13f6('0x31')]!==_0x13f6('0x3f')){var _0x398549={};_0x398549[_0xf149e6[_0x13f6('0x2a')]]={'$like':'%'+_0x544e34[_0x13f6('0x34')][_0x13f6('0x40')]+'%'};return _0x398549;}})});}_0x416ab8=_[_0x13f6('0x3d')]({},_0x416ab8,_0x544e34['options']);var _0x4f4a64={'where':_0x416ab8[_0x13f6('0x3e')]};return db[_0x13f6('0x2e')][_0x13f6('0x20')](_0x4f4a64)['then'](function(_0xe401cd){_0x1791c5[_0x13f6('0x20')]=_0xe401cd;if(_0x544e34[_0x13f6('0x34')][_0x13f6('0x41')]){_0x416ab8['include']=[{'all':!![]}];}return db[_0x13f6('0x2e')][_0x13f6('0x42')](_0x416ab8);})['then'](function(_0x2d4e5d){_0x1791c5[_0x13f6('0x43')]=_0x2d4e5d;return _0x1791c5;})['then'](respondWithFilteredResult(_0x5ae0e3,_0x416ab8))[_0x13f6('0x44')](handleError(_0x5ae0e3,null));};exports['show']=function(_0xe560c3,_0x30ea1c){var _0x521763={'raw':![],'where':{'id':_0xe560c3['params']['id']}},_0x356279={};_0x356279[_0x13f6('0x33')]=_[_0x13f6('0x35')](db['FreshdeskConfiguration'][_0x13f6('0x2f')]);_0x356279[_0x13f6('0x34')]=_[_0x13f6('0x35')](_0xe560c3['query']);_0x356279[_0x13f6('0x36')]=_['intersection'](_0x356279['model'],_0x356279[_0x13f6('0x34')]);_0x521763[_0x13f6('0x38')]=_['intersection'](_0x356279[_0x13f6('0x33')],qs['fields'](_0xe560c3['query']['fields']));_0x521763[_0x13f6('0x38')]=_0x521763[_0x13f6('0x38')][_0x13f6('0x3a')]?_0x521763[_0x13f6('0x38')]:_0x356279[_0x13f6('0x33')];if(_0xe560c3[_0x13f6('0x34')]['includeAll']){_0x521763[_0x13f6('0x45')]=[{'all':!![]}];}_0x521763=_[_0x13f6('0x3d')]({},_0x521763,_0xe560c3['options']);return db[_0x13f6('0x2e')][_0x13f6('0x46')](_0x521763)[_0x13f6('0x26')](handleEntityNotFound(_0x30ea1c,null))[_0x13f6('0x26')](respondWithResult(_0x30ea1c,null))[_0x13f6('0x44')](handleError(_0x30ea1c,null));};exports[_0x13f6('0x47')]=function(_0x390710,_0x38a4bc){return db[_0x13f6('0x2e')]['create'](_0x390710[_0x13f6('0x48')],{})['then'](respondWithResult(_0x38a4bc,0xc9))[_0x13f6('0x44')](handleError(_0x38a4bc,null));};exports[_0x13f6('0x25')]=function(_0x57c80c,_0x209bdc){if(_0x57c80c[_0x13f6('0x48')]['id']){delete _0x57c80c[_0x13f6('0x48')]['id'];}return db[_0x13f6('0x2e')][_0x13f6('0x46')]({'where':{'id':_0x57c80c['params']['id']}})[_0x13f6('0x26')](handleEntityNotFound(_0x209bdc,null))['then'](saveUpdates(_0x57c80c['body'],null))[_0x13f6('0x26')](respondWithResult(_0x209bdc,null))[_0x13f6('0x44')](handleError(_0x209bdc,null));};exports[_0x13f6('0x27')]=function(_0x162a0f,_0x2f49af){return db[_0x13f6('0x2e')][_0x13f6('0x46')]({'where':{'id':_0x162a0f[_0x13f6('0x49')]['id']}})[_0x13f6('0x26')](handleEntityNotFound(_0x2f49af,null))[_0x13f6('0x26')](removeEntity(_0x2f49af,null))[_0x13f6('0x44')](handleError(_0x2f49af,null));};exports[_0x13f6('0x4a')]=function(_0x1d4e4d,_0x3eb4ad,_0x19ab44){var _0x319ec8={};var _0x2e33ee={};var _0x23c4a8;var _0x13edf7;return db[_0x13f6('0x2e')]['findOne']({'where':{'id':_0x1d4e4d[_0x13f6('0x49')]['id']}})[_0x13f6('0x26')](handleEntityNotFound(_0x3eb4ad,null))[_0x13f6('0x26')](function(_0x4c4507){if(_0x4c4507){_0x23c4a8=_0x4c4507;_0x2e33ee[_0x13f6('0x33')]=_[_0x13f6('0x35')](db[_0x13f6('0x4b')][_0x13f6('0x2f')]);_0x2e33ee[_0x13f6('0x34')]=_['keys'](_0x1d4e4d[_0x13f6('0x34')]);_0x2e33ee[_0x13f6('0x36')]=_[_0x13f6('0x37')](_0x2e33ee['model'],_0x2e33ee['query']);_0x319ec8[_0x13f6('0x38')]=_['intersection'](_0x2e33ee[_0x13f6('0x33')],qs['fields'](_0x1d4e4d['query'][_0x13f6('0x39')]));_0x319ec8[_0x13f6('0x38')]=_0x319ec8[_0x13f6('0x38')][_0x13f6('0x3a')]?_0x319ec8[_0x13f6('0x38')]:_0x2e33ee[_0x13f6('0x33')];_0x319ec8[_0x13f6('0x3b')]=qs[_0x13f6('0x4c')](_0x1d4e4d[_0x13f6('0x34')][_0x13f6('0x4c')]);_0x319ec8[_0x13f6('0x3e')]=qs['filters'](_[_0x13f6('0x3c')](_0x1d4e4d['query'],_0x2e33ee['filters']));if(_0x1d4e4d['query'][_0x13f6('0x40')]){_0x319ec8[_0x13f6('0x3e')]=_[_0x13f6('0x3d')](_0x319ec8[_0x13f6('0x3e')],{'$or':_[_0x13f6('0x2d')](_0x319ec8[_0x13f6('0x38')],function(_0x38b821){var _0x311c6b={};_0x311c6b[_0x38b821]={'$like':'%'+_0x1d4e4d[_0x13f6('0x34')]['filter']+'%'};return _0x311c6b;})});}_0x319ec8=_[_0x13f6('0x3d')]({},_0x319ec8,_0x1d4e4d[_0x13f6('0x4d')]);return _0x23c4a8[_0x13f6('0x4a')](_0x319ec8);}})[_0x13f6('0x26')](function(_0x289312){if(_0x289312){_0x13edf7=_0x289312['length'];if(!_0x1d4e4d['query'][_0x13f6('0x4e')]('nolimit')){_0x319ec8['limit']=qs[_0x13f6('0x1f')](_0x1d4e4d['query'][_0x13f6('0x1f')]);_0x319ec8[_0x13f6('0x21')]=qs['offset'](_0x1d4e4d[_0x13f6('0x34')][_0x13f6('0x21')]);}return _0x23c4a8[_0x13f6('0x4a')](_0x319ec8);}})[_0x13f6('0x26')](function(_0x51c3c7){if(_0x51c3c7){return _0x51c3c7?{'count':_0x13edf7,'rows':_0x51c3c7}:null;}})[_0x13f6('0x26')](respondWithResult(_0x3eb4ad,null))[_0x13f6('0x44')](handleError(_0x3eb4ad,null));};exports['getSubjects']=function(_0x5d8cc0,_0x121fba,_0x801254){var _0x1e887d={};var _0x509d69={};var _0x1e21a4;var _0x38db3f;return db[_0x13f6('0x2e')]['findOne']({'where':{'id':_0x5d8cc0['params']['id']}})[_0x13f6('0x26')](handleEntityNotFound(_0x121fba,null))[_0x13f6('0x26')](function(_0x51ce3a){if(_0x51ce3a){_0x1e21a4=_0x51ce3a;_0x509d69['model']=_[_0x13f6('0x35')](db[_0x13f6('0x4b')][_0x13f6('0x2f')]);_0x509d69[_0x13f6('0x34')]=_[_0x13f6('0x35')](_0x5d8cc0[_0x13f6('0x34')]);_0x509d69[_0x13f6('0x36')]=_['intersection'](_0x509d69[_0x13f6('0x33')],_0x509d69['query']);_0x1e887d[_0x13f6('0x38')]=_['intersection'](_0x509d69[_0x13f6('0x33')],qs[_0x13f6('0x39')](_0x5d8cc0[_0x13f6('0x34')][_0x13f6('0x39')]));_0x1e887d[_0x13f6('0x38')]=_0x1e887d[_0x13f6('0x38')][_0x13f6('0x3a')]?_0x1e887d[_0x13f6('0x38')]:_0x509d69[_0x13f6('0x33')];_0x1e887d['order']=qs[_0x13f6('0x4c')](_0x5d8cc0['query']['sort']);_0x1e887d[_0x13f6('0x3e')]=qs[_0x13f6('0x36')](_['pick'](_0x5d8cc0[_0x13f6('0x34')],_0x509d69[_0x13f6('0x36')]));if(_0x5d8cc0[_0x13f6('0x34')][_0x13f6('0x40')]){_0x1e887d[_0x13f6('0x3e')]=_['merge'](_0x1e887d[_0x13f6('0x3e')],{'$or':_[_0x13f6('0x2d')](_0x1e887d[_0x13f6('0x38')],function(_0x56c505){var _0x10d02a={};_0x10d02a[_0x56c505]={'$like':'%'+_0x5d8cc0[_0x13f6('0x34')]['filter']+'%'};return _0x10d02a;})});}_0x1e887d=_[_0x13f6('0x3d')]({},_0x1e887d,_0x5d8cc0[_0x13f6('0x4d')]);return _0x1e21a4[_0x13f6('0x4f')](_0x1e887d);}})[_0x13f6('0x26')](function(_0x2fe7d1){if(_0x2fe7d1){_0x38db3f=_0x2fe7d1[_0x13f6('0x3a')];if(!_0x5d8cc0['query'][_0x13f6('0x4e')](_0x13f6('0x50'))){_0x1e887d[_0x13f6('0x1f')]=qs[_0x13f6('0x1f')](_0x5d8cc0['query'][_0x13f6('0x1f')]);_0x1e887d[_0x13f6('0x21')]=qs[_0x13f6('0x21')](_0x5d8cc0[_0x13f6('0x34')][_0x13f6('0x21')]);}return _0x1e21a4[_0x13f6('0x4f')](_0x1e887d);}})['then'](function(_0x203c7a){if(_0x203c7a){return _0x203c7a?{'count':_0x38db3f,'rows':_0x203c7a}:null;}})['then'](respondWithResult(_0x121fba,null))[_0x13f6('0x44')](handleError(_0x121fba,null));};exports['getDescriptions']=function(_0x58ad87,_0x31a55c,_0x43c5f3){var _0x785109={};var _0x457479={};var _0xfa268e;var _0x2f4958;return db['FreshdeskConfiguration'][_0x13f6('0x51')]({'where':{'id':_0x58ad87['params']['id']}})['then'](handleEntityNotFound(_0x31a55c,null))['then'](function(_0x1d463d){if(_0x1d463d){_0xfa268e=_0x1d463d;_0x457479[_0x13f6('0x33')]=_['keys'](db[_0x13f6('0x4b')][_0x13f6('0x2f')]);_0x457479[_0x13f6('0x34')]=_[_0x13f6('0x35')](_0x58ad87[_0x13f6('0x34')]);_0x457479[_0x13f6('0x36')]=_[_0x13f6('0x37')](_0x457479['model'],_0x457479['query']);_0x785109['attributes']=_['intersection'](_0x457479[_0x13f6('0x33')],qs[_0x13f6('0x39')](_0x58ad87['query'][_0x13f6('0x39')]));_0x785109[_0x13f6('0x38')]=_0x785109[_0x13f6('0x38')][_0x13f6('0x3a')]?_0x785109[_0x13f6('0x38')]:_0x457479[_0x13f6('0x33')];_0x785109['order']=qs[_0x13f6('0x4c')](_0x58ad87[_0x13f6('0x34')][_0x13f6('0x4c')]);_0x785109[_0x13f6('0x3e')]=qs[_0x13f6('0x36')](_[_0x13f6('0x3c')](_0x58ad87['query'],_0x457479[_0x13f6('0x36')]));if(_0x58ad87['query']['filter']){_0x785109[_0x13f6('0x3e')]=_[_0x13f6('0x3d')](_0x785109[_0x13f6('0x3e')],{'$or':_[_0x13f6('0x2d')](_0x785109[_0x13f6('0x38')],function(_0x1c11e2){var _0x8e206e={};_0x8e206e[_0x1c11e2]={'$like':'%'+_0x58ad87[_0x13f6('0x34')][_0x13f6('0x40')]+'%'};return _0x8e206e;})});}_0x785109=_[_0x13f6('0x3d')]({},_0x785109,_0x58ad87[_0x13f6('0x4d')]);return _0xfa268e['getDescriptions'](_0x785109);}})[_0x13f6('0x26')](function(_0x3b162e){if(_0x3b162e){_0x2f4958=_0x3b162e[_0x13f6('0x3a')];if(!_0x58ad87[_0x13f6('0x34')]['hasOwnProperty'](_0x13f6('0x50'))){_0x785109[_0x13f6('0x1f')]=qs[_0x13f6('0x1f')](_0x58ad87[_0x13f6('0x34')][_0x13f6('0x1f')]);_0x785109['offset']=qs[_0x13f6('0x21')](_0x58ad87[_0x13f6('0x34')][_0x13f6('0x21')]);}return _0xfa268e[_0x13f6('0x52')](_0x785109);}})['then'](function(_0x45a4a1){if(_0x45a4a1){return _0x45a4a1?{'count':_0x2f4958,'rows':_0x45a4a1}:null;}})[_0x13f6('0x26')](respondWithResult(_0x31a55c,null))[_0x13f6('0x44')](handleError(_0x31a55c,null));};exports['getTags']=function(_0x28f17a,_0x4f0052,_0x115a78){var _0x40ab7d={};var _0x35b395={};var _0xf77fc8;var _0x31d287;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x28f17a[_0x13f6('0x49')]['id']}})['then'](handleEntityNotFound(_0x4f0052,null))[_0x13f6('0x26')](function(_0x5620e){if(_0x5620e){_0xf77fc8=_0x5620e;_0x35b395['model']=_['keys'](db[_0x13f6('0x53')]['rawAttributes']);_0x35b395[_0x13f6('0x34')]=_[_0x13f6('0x35')](_0x28f17a[_0x13f6('0x34')]);_0x35b395[_0x13f6('0x36')]=_['intersection'](_0x35b395[_0x13f6('0x33')],_0x35b395['query']);_0x40ab7d['attributes']=_[_0x13f6('0x37')](_0x35b395[_0x13f6('0x33')],qs[_0x13f6('0x39')](_0x28f17a[_0x13f6('0x34')]['fields']));_0x40ab7d['attributes']=_0x40ab7d['attributes'][_0x13f6('0x3a')]?_0x40ab7d['attributes']:_0x35b395[_0x13f6('0x33')];_0x40ab7d[_0x13f6('0x3b')]=qs[_0x13f6('0x4c')](_0x28f17a['query']['sort']);_0x40ab7d[_0x13f6('0x3e')]=qs[_0x13f6('0x36')](_[_0x13f6('0x3c')](_0x28f17a[_0x13f6('0x34')],_0x35b395[_0x13f6('0x36')]));if(_0x28f17a[_0x13f6('0x34')][_0x13f6('0x40')]){_0x40ab7d['where']=_['merge'](_0x40ab7d[_0x13f6('0x3e')],{'$or':_[_0x13f6('0x2d')](_0x40ab7d[_0x13f6('0x38')],function(_0x474338){var _0x51400c={};_0x51400c[_0x474338]={'$like':'%'+_0x28f17a[_0x13f6('0x34')]['filter']+'%'};return _0x51400c;})});}_0x40ab7d=_[_0x13f6('0x3d')]({},_0x40ab7d,_0x28f17a['options']);return _0xf77fc8[_0x13f6('0x54')](_0x40ab7d);}})['then'](function(_0x57fca3){if(_0x57fca3){_0x31d287=_0x57fca3['length'];if(!_0x28f17a['query'][_0x13f6('0x4e')]('nolimit')){_0x40ab7d[_0x13f6('0x1f')]=qs[_0x13f6('0x1f')](_0x28f17a[_0x13f6('0x34')][_0x13f6('0x1f')]);_0x40ab7d[_0x13f6('0x21')]=qs[_0x13f6('0x21')](_0x28f17a['query']['offset']);}return _0xf77fc8[_0x13f6('0x54')](_0x40ab7d);}})['then'](function(_0x5a9635){if(_0x5a9635){return _0x5a9635?{'count':_0x31d287,'rows':_0x5a9635}:null;}})[_0x13f6('0x26')](respondWithResult(_0x4f0052,null))[_0x13f6('0x44')](handleError(_0x4f0052,null));};exports['setTags']=function(_0x51dabc,_0xfd3d39,_0x27f233){if(_0x51dabc[_0x13f6('0x48')]['id']){delete _0x51dabc[_0x13f6('0x48')]['id'];}return db[_0x13f6('0x2e')]['findOne']({'where':{'id':_0x51dabc[_0x13f6('0x49')]['id']}})[_0x13f6('0x26')](handleEntityNotFound(_0xfd3d39,null))[_0x13f6('0x26')](function(_0x2a5b17){if(_0x2a5b17){return _0x2a5b17[_0x13f6('0x55')](_0x51dabc[_0x13f6('0x48')][_0x13f6('0x56')]||[]);}return null;})['then'](respondWithResult(_0xfd3d39,null))[_0x13f6('0x44')](handleError(_0xfd3d39,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 797e839..45ee85b 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 _0x8854=['exports','define','int_freshdesk_configurations','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0x334e97,_0x3fefaa){var _0x42e74d=function(_0x382363){while(--_0x382363){_0x334e97['push'](_0x334e97['shift']());}};_0x42e74d(++_0x3fefaa);}(_0x8854,0x1e7));var _0x4885=function(_0x30094f,_0x4f1ec4){_0x30094f=_0x30094f-0x0;var _0x11fa2a=_0x8854[_0x30094f];return _0x11fa2a;};'use strict';var _=require(_0x4885('0x0'));var util=require('util');var logger=require(_0x4885('0x1'))(_0x4885('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4885('0x3'));var fs=require('fs');var path=require(_0x4885('0x4'));var rimraf=require(_0x4885('0x5'));var config=require(_0x4885('0x6'));var attributes=require(_0x4885('0x7'));module[_0x4885('0x8')]=function(_0x39b21e,_0x3c373d){return _0x39b21e[_0x4885('0x9')]('FreshdeskConfiguration',attributes,{'tableName':_0x4885('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e62=['bluebird','path','rimraf','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','moment'];(function(_0x5c47d8,_0x47eff2){var _0x5988c7=function(_0x4eb1db){while(--_0x4eb1db){_0x5c47d8['push'](_0x5c47d8['shift']());}};_0x5988c7(++_0x47eff2);}(_0x3e62,0x80));var _0x23e6=function(_0x5393d3,_0x5929ca){_0x5393d3=_0x5393d3-0x0;var _0x14182e=_0x3e62[_0x5393d3];return _0x14182e;};'use strict';var _=require(_0x23e6('0x0'));var util=require(_0x23e6('0x1'));var logger=require(_0x23e6('0x2'))('api');var moment=require(_0x23e6('0x3'));var BPromise=require(_0x23e6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x23e6('0x5'));var rimraf=require(_0x23e6('0x6'));var config=require('../../config/environment');var attributes=require(_0x23e6('0x7'));module['exports']=function(_0x3fc9d3,_0x4eb014){return _0x3fc9d3[_0x23e6('0x8')](_0x23e6('0x9'),attributes,{'tableName':_0x23e6('0xa'),'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 fccb587..bde67df 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 _0x28bd=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1c4f20,_0x266ec5){var _0x23c80d=function(_0x7b7256){while(--_0x7b7256){_0x1c4f20['push'](_0x1c4f20['shift']());}};_0x23c80d(++_0x266ec5);}(_0x28bd,0xf7));var _0xd28b=function(_0x195601,_0xdae54f){_0x195601=_0x195601-0x0;var _0x5263d6=_0x28bd[_0x195601];return _0x5263d6;};'use strict';var _=require('lodash');var util=require(_0xd28b('0x0'));var moment=require(_0xd28b('0x1'));var BPromise=require(_0xd28b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd28b('0x3'))['db'];var utils=require(_0xd28b('0x4'));var logger=require(_0xd28b('0x5'))(_0xd28b('0x6'));var config=require(_0xd28b('0x7'));var jayson=require(_0xd28b('0x8'));var client=jayson[_0xd28b('0x9')][_0xd28b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x426978,_0x2bb46c,_0x448be6){return new BPromise(function(_0x3bad66,_0x563859){return client[_0xd28b('0xb')](_0x426978,_0x448be6)[_0xd28b('0xc')](function(_0x58c446){logger[_0xd28b('0xd')](_0xd28b('0xe'),_0x2bb46c,'request\x20sent');logger[_0xd28b('0xf')](_0xd28b('0x10'),_0x2bb46c,_0xd28b('0x11'),JSON[_0xd28b('0x12')](_0x58c446));if(_0x58c446[_0xd28b('0x13')]){if(_0x58c446[_0xd28b('0x13')]['code']===0x1f4){logger[_0xd28b('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2bb46c,_0x58c446[_0xd28b('0x13')][_0xd28b('0x14')]);return _0x563859(_0x58c446[_0xd28b('0x13')][_0xd28b('0x14')]);}logger[_0xd28b('0x13')](_0xd28b('0xe'),_0x2bb46c,_0x58c446[_0xd28b('0x13')][_0xd28b('0x14')]);return _0x3bad66(_0x58c446['error'][_0xd28b('0x14')]);}else{logger[_0xd28b('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2bb46c,_0xd28b('0x11'));_0x3bad66(_0x58c446[_0xd28b('0x15')][_0xd28b('0x14')]);}})[_0xd28b('0x16')](function(_0x2f2ce3){logger[_0xd28b('0x13')](_0xd28b('0xe'),_0x2bb46c,_0x2f2ce3);_0x563859(_0x2f2ce3);});});} \ No newline at end of file +var _0x9539=['FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','../../config/utils','rpc','client','request','then','info'];(function(_0x80d733,_0x266211){var _0x435868=function(_0x2ae0f0){while(--_0x2ae0f0){_0x80d733['push'](_0x80d733['shift']());}};_0x435868(++_0x266211);}(_0x9539,0xaa));var _0x9953=function(_0x661651,_0x43fb9c){_0x661651=_0x661651-0x0;var _0x24b6f0=_0x9539[_0x661651];return _0x24b6f0;};'use strict';var _=require('lodash');var util=require(_0x9953('0x0'));var moment=require(_0x9953('0x1'));var BPromise=require(_0x9953('0x2'));var rs=require(_0x9953('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9953('0x4'));var logger=require('../../config/logger')(_0x9953('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9953('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17eea1,_0xd70532,_0x24965d){return new BPromise(function(_0x419314,_0x5f9dcb){return client[_0x9953('0x7')](_0x17eea1,_0x24965d)[_0x9953('0x8')](function(_0xd3ab04){logger[_0x9953('0x9')](_0x9953('0xa'),_0xd70532,'request\x20sent');logger[_0x9953('0xb')](_0x9953('0xc'),_0xd70532,'request\x20sent',JSON['stringify'](_0xd3ab04));if(_0xd3ab04[_0x9953('0xd')]){if(_0xd3ab04[_0x9953('0xd')][_0x9953('0xe')]===0x1f4){logger[_0x9953('0xd')](_0x9953('0xa'),_0xd70532,_0xd3ab04[_0x9953('0xd')]['message']);return _0x5f9dcb(_0xd3ab04['error'][_0x9953('0xf')]);}logger[_0x9953('0xd')](_0x9953('0xa'),_0xd70532,_0xd3ab04['error']['message']);return _0x419314(_0xd3ab04[_0x9953('0xd')][_0x9953('0xf')]);}else{logger[_0x9953('0x9')](_0x9953('0xa'),_0xd70532,'request\x20sent');_0x419314(_0xd3ab04[_0x9953('0x10')][_0x9953('0xf')]);}})[_0x9953('0x11')](function(_0xed09a1){logger[_0x9953('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xd70532,_0xed09a1);_0x5f9dcb(_0xed09a1);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index d3d1c1b..9fa65d2 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 _0xbdfd=['delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xbdfd,0x1e3));var _0xdbdf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbdfd[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0xdbdf('0x0'));var path=require(_0xdbdf('0x1'));var timeout=require('connect-timeout');var express=require(_0xdbdf('0x2'));var router=express[_0xdbdf('0x3')]();var fs_extra=require(_0xdbdf('0x4'));var auth=require(_0xdbdf('0x5'));var interaction=require(_0xdbdf('0x6'));var config=require(_0xdbdf('0x7'));var controller=require('./intFreshdeskField.controller');router[_0xdbdf('0x8')]('/',auth[_0xdbdf('0x9')](),controller[_0xdbdf('0xa')]);router['get'](_0xdbdf('0xb'),auth[_0xdbdf('0x9')](),controller[_0xdbdf('0xc')]);router[_0xdbdf('0xd')]('/',auth[_0xdbdf('0x9')](),controller[_0xdbdf('0xe')]);router[_0xdbdf('0xf')](_0xdbdf('0xb'),auth[_0xdbdf('0x9')](),controller[_0xdbdf('0x10')]);router[_0xdbdf('0x11')](_0xdbdf('0xb'),auth[_0xdbdf('0x9')](),controller[_0xdbdf('0x12')]);module[_0xdbdf('0x13')]=router; \ No newline at end of file +var _0x87bf=['put','update','delete','destroy','exports','multer','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','post'];(function(_0x30a86f,_0x4a925c){var _0x35d0e2=function(_0x563a5d){while(--_0x563a5d){_0x30a86f['push'](_0x30a86f['shift']());}};_0x35d0e2(++_0x4a925c);}(_0x87bf,0x1e1));var _0xf87b=function(_0x3dac28,_0x345de7){_0x3dac28=_0x3dac28-0x0;var _0x139e69=_0x87bf[_0x3dac28];return _0x139e69;};'use strict';var multer=require(_0xf87b('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf87b('0x1'));var router=express[_0xf87b('0x2')]();var fs_extra=require(_0xf87b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf87b('0x4'));var config=require(_0xf87b('0x5'));var controller=require(_0xf87b('0x6'));router[_0xf87b('0x7')]('/',auth[_0xf87b('0x8')](),controller[_0xf87b('0x9')]);router[_0xf87b('0x7')](_0xf87b('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xf87b('0xb')]('/',auth[_0xf87b('0x8')](),controller['create']);router[_0xf87b('0xc')](_0xf87b('0xa'),auth['isAuthenticated'](),controller[_0xf87b('0xd')]);router[_0xf87b('0xe')]('/:id',auth[_0xf87b('0x8')](),controller[_0xf87b('0xf')]);module[_0xf87b('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 03490a2..852e604 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 _0xd689=['sequelize','ENUM','string','customVariable','keyValue','picklist','variable','STRING','BOOLEAN'];(function(_0x18920e,_0x40637c){var _0x5b7eb8=function(_0x49e67e){while(--_0x49e67e){_0x18920e['push'](_0x18920e['shift']());}};_0x5b7eb8(++_0x40637c);}(_0xd689,0xfc));var _0x9d68=function(_0x167a71,_0x68d27d){_0x167a71=_0x167a71-0x0;var _0x3778c5=_0xd689[_0x167a71];return _0x3778c5;};'use strict';var Sequelize=require(_0x9d68('0x0'));module['exports']={'type':{'type':Sequelize[_0x9d68('0x1')](_0x9d68('0x2'),'variable',_0x9d68('0x3'),_0x9d68('0x4'),_0x9d68('0x5')),'defaultValue':_0x9d68('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9d68('0x1')](_0x9d68('0x2'),_0x9d68('0x6'),_0x9d68('0x3'))},'keyContent':{'type':Sequelize[_0x9d68('0x7')]},'idField':{'type':Sequelize[_0x9d68('0x7')]},'nameField':{'type':Sequelize[_0x9d68('0x7')]},'customField':{'type':Sequelize[_0x9d68('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9d68('0x7')]}}; \ No newline at end of file +var _0x23ee=['exports','string','variable','customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize'];(function(_0x5c431d,_0x303e10){var _0x2e5734=function(_0x56368d){while(--_0x56368d){_0x5c431d['push'](_0x5c431d['shift']());}};_0x2e5734(++_0x303e10);}(_0x23ee,0x153));var _0xe23e=function(_0xc8db6b,_0x320abd){_0xc8db6b=_0xc8db6b-0x0;var _0x12cb81=_0x23ee[_0xc8db6b];return _0x12cb81;};'use strict';var Sequelize=require(_0xe23e('0x0'));module[_0xe23e('0x1')]={'type':{'type':Sequelize['ENUM'](_0xe23e('0x2'),_0xe23e('0x3'),_0xe23e('0x4'),_0xe23e('0x5'),_0xe23e('0x6')),'defaultValue':_0xe23e('0x2')},'content':{'type':Sequelize[_0xe23e('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe23e('0x8')](_0xe23e('0x2'),'variable',_0xe23e('0x4'))},'keyContent':{'type':Sequelize[_0xe23e('0x7')]},'idField':{'type':Sequelize[_0xe23e('0x7')]},'nameField':{'type':Sequelize[_0xe23e('0x7')]},'customField':{'type':Sequelize[_0xe23e('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe23e('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index c2bfceb..21b0cc2 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 _0x3c81=['apply','reject','save','update','then','destroy','end','error','name','send','map','FreshdeskField','fieldName','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','type','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3c81,0x102));var _0x13c8=function(_0x25ffc9,_0x20b246){_0x25ffc9=_0x25ffc9-0x0;var _0x546e50=_0x3c81[_0x25ffc9];return _0x546e50;};'use strict';var emlformat=require(_0x13c8('0x0'));var rimraf=require(_0x13c8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x13c8('0x2'));var rp=require(_0x13c8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x13c8('0x4'));var sox=require(_0x13c8('0x5'));var csv=require(_0x13c8('0x6'));var ejs=require(_0x13c8('0x7'));var fs=require('fs');var fs_extra=require(_0x13c8('0x8'));var _=require(_0x13c8('0x9'));var squel=require(_0x13c8('0xa'));var crypto=require('crypto');var jsforce=require(_0x13c8('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x13c8('0x6'));var querystring=require(_0x13c8('0xc'));var Papa=require(_0x13c8('0xd'));var Redis=require(_0x13c8('0xe'));var authService=require(_0x13c8('0xf'));var qs=require(_0x13c8('0x10'));var as=require(_0x13c8('0x11'));var hardwareService=require(_0x13c8('0x12'));var logger=require(_0x13c8('0x13'))(_0x13c8('0x14'));var utils=require(_0x13c8('0x15'));var config=require(_0x13c8('0x16'));var licenseUtil=require(_0x13c8('0x17'));var db=require(_0x13c8('0x18'))['db'];function respondWithStatusCode(_0x5ab91d,_0x21442d){_0x21442d=_0x21442d||0xcc;return function(_0x7b6da8){if(_0x7b6da8){return _0x5ab91d[_0x13c8('0x19')](_0x21442d);}return _0x5ab91d[_0x13c8('0x1a')](_0x21442d)['end']();};}function respondWithResult(_0x42955d,_0x515681){_0x515681=_0x515681||0xc8;return function(_0x4d7a88){if(_0x4d7a88){return _0x42955d['status'](_0x515681)[_0x13c8('0x1b')](_0x4d7a88);}};}function respondWithFilteredResult(_0x5e0e06,_0x337397){return function(_0x17a3c1){if(_0x17a3c1){var _0x23f64e=typeof _0x337397[_0x13c8('0x1c')]==='undefined'&&typeof _0x337397[_0x13c8('0x1d')]===_0x13c8('0x1e');var _0x31ae02=_0x17a3c1[_0x13c8('0x1f')];var _0xce1ad2=_0x23f64e?0x0:_0x337397[_0x13c8('0x1c')];var _0x346417=_0x23f64e?_0x17a3c1[_0x13c8('0x1f')]:_0x337397[_0x13c8('0x1c')]+_0x337397[_0x13c8('0x1d')];var _0xe9386a;if(_0x346417>=_0x31ae02){_0x346417=_0x31ae02;_0xe9386a=0xc8;}else{_0xe9386a=0xce;}_0x5e0e06['status'](_0xe9386a);return _0x5e0e06[_0x13c8('0x20')](_0x13c8('0x21'),_0xce1ad2+'-'+_0x346417+'/'+_0x31ae02)[_0x13c8('0x1b')](_0x17a3c1);}return null;};}function patchUpdates(_0x313ea3){return function(_0x513085){try{jsonpatch[_0x13c8('0x22')](_0x513085,_0x313ea3,!![]);}catch(_0x3c4603){return BPromise[_0x13c8('0x23')](_0x3c4603);}return _0x513085[_0x13c8('0x24')]();};}function saveUpdates(_0x436d5d,_0x2fc123){return function(_0x5ab47f){if(_0x5ab47f){return _0x5ab47f[_0x13c8('0x25')](_0x436d5d)[_0x13c8('0x26')](function(_0x315d6c){return _0x315d6c;});}return null;};}function removeEntity(_0xcf41d2,_0x577df6){return function(_0x1770e5){if(_0x1770e5){return _0x1770e5[_0x13c8('0x27')]()['then'](function(){_0xcf41d2['status'](0xcc)[_0x13c8('0x28')]();});}};}function handleEntityNotFound(_0x4aff35,_0x47e8ae){return function(_0x5ad0dc){if(!_0x5ad0dc){_0x4aff35[_0x13c8('0x19')](0x194);}return _0x5ad0dc;};}function handleError(_0xc7f1b6,_0x53ada9){_0x53ada9=_0x53ada9||0x1f4;return function(_0x4df077){logger[_0x13c8('0x29')](_0x4df077['stack']);if(_0x4df077['name']){delete _0x4df077[_0x13c8('0x2a')];}_0xc7f1b6[_0x13c8('0x1a')](_0x53ada9)[_0x13c8('0x2b')](_0x4df077);};}exports['index']=function(_0x5ef2f7,_0x277a89){var _0x1071a0={},_0x399840={},_0x441182={'count':0x0,'rows':[]};var _0x138017=_[_0x13c8('0x2c')](db[_0x13c8('0x2d')]['rawAttributes'],function(_0x109cb8){return{'name':_0x109cb8[_0x13c8('0x2e')],'type':_0x109cb8['type']['key']};});_0x399840[_0x13c8('0x2f')]=_[_0x13c8('0x2c')](_0x138017,'name');_0x399840[_0x13c8('0x30')]=_[_0x13c8('0x31')](_0x5ef2f7['query']);_0x399840[_0x13c8('0x32')]=_[_0x13c8('0x33')](_0x399840[_0x13c8('0x2f')],_0x399840[_0x13c8('0x30')]);_0x1071a0[_0x13c8('0x34')]=_[_0x13c8('0x33')](_0x399840[_0x13c8('0x2f')],qs[_0x13c8('0x35')](_0x5ef2f7['query']['fields']));_0x1071a0[_0x13c8('0x34')]=_0x1071a0[_0x13c8('0x34')]['length']?_0x1071a0[_0x13c8('0x34')]:_0x399840['model'];if(!_0x5ef2f7[_0x13c8('0x30')]['hasOwnProperty'](_0x13c8('0x36'))){_0x1071a0[_0x13c8('0x1d')]=qs[_0x13c8('0x1d')](_0x5ef2f7[_0x13c8('0x30')][_0x13c8('0x1d')]);_0x1071a0[_0x13c8('0x1c')]=qs[_0x13c8('0x1c')](_0x5ef2f7['query'][_0x13c8('0x1c')]);}_0x1071a0[_0x13c8('0x37')]=qs['sort'](_0x5ef2f7[_0x13c8('0x30')][_0x13c8('0x38')]);_0x1071a0[_0x13c8('0x39')]=qs['filters'](_['pick'](_0x5ef2f7['query'],_0x399840[_0x13c8('0x32')]),_0x138017);if(_0x5ef2f7[_0x13c8('0x30')][_0x13c8('0x3a')]){_0x1071a0[_0x13c8('0x39')]=_[_0x13c8('0x3b')](_0x1071a0[_0x13c8('0x39')],{'$or':_[_0x13c8('0x2c')](_0x138017,function(_0xe19858){if(_0xe19858[_0x13c8('0x3c')]!=='VIRTUAL'){var _0x5b2a28={};_0x5b2a28[_0xe19858[_0x13c8('0x2a')]]={'$like':'%'+_0x5ef2f7[_0x13c8('0x30')][_0x13c8('0x3a')]+'%'};return _0x5b2a28;}})});}_0x1071a0=_[_0x13c8('0x3b')]({},_0x1071a0,_0x5ef2f7['options']);var _0x35e1e7={'where':_0x1071a0['where']};return db[_0x13c8('0x2d')][_0x13c8('0x1f')](_0x35e1e7)[_0x13c8('0x26')](function(_0x1cd02c){_0x441182[_0x13c8('0x1f')]=_0x1cd02c;if(_0x5ef2f7[_0x13c8('0x30')][_0x13c8('0x3d')]){_0x1071a0[_0x13c8('0x3e')]=[{'all':!![]}];}return db[_0x13c8('0x2d')][_0x13c8('0x3f')](_0x1071a0);})[_0x13c8('0x26')](function(_0x416169){_0x441182[_0x13c8('0x40')]=_0x416169;return _0x441182;})[_0x13c8('0x26')](respondWithFilteredResult(_0x277a89,_0x1071a0))[_0x13c8('0x41')](handleError(_0x277a89,null));};exports[_0x13c8('0x42')]=function(_0x1b2ada,_0x1505fb){var _0xc5eb86={'raw':!![],'where':{'id':_0x1b2ada[_0x13c8('0x43')]['id']}},_0x1cff99={};_0x1cff99[_0x13c8('0x2f')]=_[_0x13c8('0x31')](db[_0x13c8('0x2d')][_0x13c8('0x44')]);_0x1cff99['query']=_[_0x13c8('0x31')](_0x1b2ada[_0x13c8('0x30')]);_0x1cff99[_0x13c8('0x32')]=_[_0x13c8('0x33')](_0x1cff99[_0x13c8('0x2f')],_0x1cff99['query']);_0xc5eb86['attributes']=_[_0x13c8('0x33')](_0x1cff99[_0x13c8('0x2f')],qs[_0x13c8('0x35')](_0x1b2ada['query']['fields']));_0xc5eb86['attributes']=_0xc5eb86[_0x13c8('0x34')]['length']?_0xc5eb86[_0x13c8('0x34')]:_0x1cff99['model'];if(_0x1b2ada[_0x13c8('0x30')][_0x13c8('0x3d')]){_0xc5eb86[_0x13c8('0x3e')]=[{'all':!![]}];}_0xc5eb86=_[_0x13c8('0x3b')]({},_0xc5eb86,_0x1b2ada[_0x13c8('0x45')]);return db[_0x13c8('0x2d')]['find'](_0xc5eb86)[_0x13c8('0x26')](handleEntityNotFound(_0x1505fb,null))[_0x13c8('0x26')](respondWithResult(_0x1505fb,null))['catch'](handleError(_0x1505fb,null));};exports[_0x13c8('0x46')]=function(_0x26155d,_0x2e925f){return db[_0x13c8('0x2d')][_0x13c8('0x46')](_0x26155d['body'],{})[_0x13c8('0x26')](respondWithResult(_0x2e925f,0xc9))[_0x13c8('0x41')](handleError(_0x2e925f,null));};exports[_0x13c8('0x25')]=function(_0x38418b,_0x185d18){if(_0x38418b['body']['id']){delete _0x38418b[_0x13c8('0x47')]['id'];}return db[_0x13c8('0x2d')][_0x13c8('0x48')]({'where':{'id':_0x38418b[_0x13c8('0x43')]['id']}})[_0x13c8('0x26')](handleEntityNotFound(_0x185d18,null))[_0x13c8('0x26')](saveUpdates(_0x38418b[_0x13c8('0x47')],null))[_0x13c8('0x26')](respondWithResult(_0x185d18,null))[_0x13c8('0x41')](handleError(_0x185d18,null));};exports[_0x13c8('0x27')]=function(_0x266f4e,_0x5e1fe5){return db[_0x13c8('0x2d')][_0x13c8('0x48')]({'where':{'id':_0x266f4e[_0x13c8('0x43')]['id']}})[_0x13c8('0x26')](handleEntityNotFound(_0x5e1fe5,null))[_0x13c8('0x26')](removeEntity(_0x5e1fe5,null))[_0x13c8('0x41')](handleError(_0x5e1fe5,null));}; \ No newline at end of file +var _0xf403=['error','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','catch','show','params','intersection','include','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','update','then','destroy'];(function(_0x1a8f86,_0x5ed9c4){var _0x20d876=function(_0x596e1b){while(--_0x596e1b){_0x1a8f86['push'](_0x1a8f86['shift']());}};_0x20d876(++_0x5ed9c4);}(_0xf403,0x1d3));var _0x3f40=function(_0x36975f,_0xe8e6d7){_0x36975f=_0x36975f-0x0;var _0x1c18ea=_0xf403[_0x36975f];return _0x1c18ea;};'use strict';var emlformat=require(_0x3f40('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3f40('0x1'));var jsonpatch=require(_0x3f40('0x2'));var rp=require(_0x3f40('0x3'));var moment=require(_0x3f40('0x4'));var BPromise=require(_0x3f40('0x5'));var Mustache=require(_0x3f40('0x6'));var util=require(_0x3f40('0x7'));var path=require(_0x3f40('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3f40('0x9'));var fs=require('fs');var fs_extra=require(_0x3f40('0xa'));var _=require(_0x3f40('0xb'));var squel=require(_0x3f40('0xc'));var crypto=require('crypto');var jsforce=require(_0x3f40('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3f40('0xe'));var Papa=require(_0x3f40('0xf'));var Redis=require(_0x3f40('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3f40('0x11'));var hardwareService=require(_0x3f40('0x12'));var logger=require(_0x3f40('0x13'))('api');var utils=require(_0x3f40('0x14'));var config=require(_0x3f40('0x15'));var licenseUtil=require(_0x3f40('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x332635,_0x509c02){_0x509c02=_0x509c02||0xcc;return function(_0x116460){if(_0x116460){return _0x332635[_0x3f40('0x17')](_0x509c02);}return _0x332635[_0x3f40('0x18')](_0x509c02)[_0x3f40('0x19')]();};}function respondWithResult(_0x569c6e,_0x2b2bfe){_0x2b2bfe=_0x2b2bfe||0xc8;return function(_0x308e97){if(_0x308e97){return _0x569c6e[_0x3f40('0x18')](_0x2b2bfe)[_0x3f40('0x1a')](_0x308e97);}};}function respondWithFilteredResult(_0x232241,_0x4e28b9){return function(_0x2e51ed){if(_0x2e51ed){var _0x3d11c9=typeof _0x4e28b9['offset']==='undefined'&&typeof _0x4e28b9['limit']===_0x3f40('0x1b');var _0x13b950=_0x2e51ed[_0x3f40('0x1c')];var _0x131e55=_0x3d11c9?0x0:_0x4e28b9[_0x3f40('0x1d')];var _0x5b4ebc=_0x3d11c9?_0x2e51ed[_0x3f40('0x1c')]:_0x4e28b9[_0x3f40('0x1d')]+_0x4e28b9[_0x3f40('0x1e')];var _0x29405a;if(_0x5b4ebc>=_0x13b950){_0x5b4ebc=_0x13b950;_0x29405a=0xc8;}else{_0x29405a=0xce;}_0x232241[_0x3f40('0x18')](_0x29405a);return _0x232241['set'](_0x3f40('0x1f'),_0x131e55+'-'+_0x5b4ebc+'/'+_0x13b950)['json'](_0x2e51ed);}return null;};}function patchUpdates(_0x12aabf){return function(_0x32b945){try{jsonpatch[_0x3f40('0x20')](_0x32b945,_0x12aabf,!![]);}catch(_0x113293){return BPromise[_0x3f40('0x21')](_0x113293);}return _0x32b945['save']();};}function saveUpdates(_0x27f5a5,_0x379b4e){return function(_0x117823){if(_0x117823){return _0x117823[_0x3f40('0x22')](_0x27f5a5)[_0x3f40('0x23')](function(_0xa1f39d){return _0xa1f39d;});}return null;};}function removeEntity(_0x4e1f47,_0x31fc91){return function(_0x59eb32){if(_0x59eb32){return _0x59eb32[_0x3f40('0x24')]()['then'](function(){_0x4e1f47[_0x3f40('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37b47e,_0x5ae235){return function(_0x4b206b){if(!_0x4b206b){_0x37b47e['sendStatus'](0x194);}return _0x4b206b;};}function handleError(_0x30a945,_0x26e46b){_0x26e46b=_0x26e46b||0x1f4;return function(_0x140044){logger[_0x3f40('0x25')](_0x140044['stack']);if(_0x140044[_0x3f40('0x26')]){delete _0x140044['name'];}_0x30a945[_0x3f40('0x18')](_0x26e46b)[_0x3f40('0x27')](_0x140044);};}exports[_0x3f40('0x28')]=function(_0x5e0f25,_0x287632){var _0x4b5ef7={},_0x1cab5c={},_0x5b9079={'count':0x0,'rows':[]};var _0x49057b=_[_0x3f40('0x29')](db[_0x3f40('0x2a')][_0x3f40('0x2b')],function(_0xb23186){return{'name':_0xb23186[_0x3f40('0x2c')],'type':_0xb23186[_0x3f40('0x2d')][_0x3f40('0x2e')]};});_0x1cab5c[_0x3f40('0x2f')]=_['map'](_0x49057b,_0x3f40('0x26'));_0x1cab5c[_0x3f40('0x30')]=_[_0x3f40('0x31')](_0x5e0f25[_0x3f40('0x30')]);_0x1cab5c[_0x3f40('0x32')]=_['intersection'](_0x1cab5c[_0x3f40('0x2f')],_0x1cab5c[_0x3f40('0x30')]);_0x4b5ef7[_0x3f40('0x33')]=_['intersection'](_0x1cab5c[_0x3f40('0x2f')],qs[_0x3f40('0x34')](_0x5e0f25[_0x3f40('0x30')][_0x3f40('0x34')]));_0x4b5ef7[_0x3f40('0x33')]=_0x4b5ef7[_0x3f40('0x33')][_0x3f40('0x35')]?_0x4b5ef7[_0x3f40('0x33')]:_0x1cab5c[_0x3f40('0x2f')];if(!_0x5e0f25[_0x3f40('0x30')][_0x3f40('0x36')](_0x3f40('0x37'))){_0x4b5ef7[_0x3f40('0x1e')]=qs[_0x3f40('0x1e')](_0x5e0f25[_0x3f40('0x30')][_0x3f40('0x1e')]);_0x4b5ef7[_0x3f40('0x1d')]=qs[_0x3f40('0x1d')](_0x5e0f25[_0x3f40('0x30')][_0x3f40('0x1d')]);}_0x4b5ef7[_0x3f40('0x38')]=qs[_0x3f40('0x39')](_0x5e0f25[_0x3f40('0x30')][_0x3f40('0x39')]);_0x4b5ef7[_0x3f40('0x3a')]=qs[_0x3f40('0x32')](_[_0x3f40('0x3b')](_0x5e0f25[_0x3f40('0x30')],_0x1cab5c[_0x3f40('0x32')]),_0x49057b);if(_0x5e0f25[_0x3f40('0x30')]['filter']){_0x4b5ef7['where']=_[_0x3f40('0x3c')](_0x4b5ef7[_0x3f40('0x3a')],{'$or':_[_0x3f40('0x29')](_0x49057b,function(_0x4778ec){if(_0x4778ec[_0x3f40('0x2d')]!==_0x3f40('0x3d')){var _0x1ffa33={};_0x1ffa33[_0x4778ec['name']]={'$like':'%'+_0x5e0f25[_0x3f40('0x30')]['filter']+'%'};return _0x1ffa33;}})});}_0x4b5ef7=_[_0x3f40('0x3c')]({},_0x4b5ef7,_0x5e0f25[_0x3f40('0x3e')]);var _0xec24e4={'where':_0x4b5ef7['where']};return db[_0x3f40('0x2a')][_0x3f40('0x1c')](_0xec24e4)['then'](function(_0x1eb15c){_0x5b9079[_0x3f40('0x1c')]=_0x1eb15c;if(_0x5e0f25['query'][_0x3f40('0x3f')]){_0x4b5ef7['include']=[{'all':!![]}];}return db[_0x3f40('0x2a')]['findAll'](_0x4b5ef7);})['then'](function(_0x8e89a){_0x5b9079['rows']=_0x8e89a;return _0x5b9079;})[_0x3f40('0x23')](respondWithFilteredResult(_0x287632,_0x4b5ef7))[_0x3f40('0x40')](handleError(_0x287632,null));};exports[_0x3f40('0x41')]=function(_0x460237,_0x48b65e){var _0x237c91={'raw':!![],'where':{'id':_0x460237[_0x3f40('0x42')]['id']}},_0x5b0eaa={};_0x5b0eaa[_0x3f40('0x2f')]=_[_0x3f40('0x31')](db['FreshdeskField']['rawAttributes']);_0x5b0eaa[_0x3f40('0x30')]=_[_0x3f40('0x31')](_0x460237[_0x3f40('0x30')]);_0x5b0eaa[_0x3f40('0x32')]=_[_0x3f40('0x43')](_0x5b0eaa[_0x3f40('0x2f')],_0x5b0eaa[_0x3f40('0x30')]);_0x237c91[_0x3f40('0x33')]=_['intersection'](_0x5b0eaa[_0x3f40('0x2f')],qs['fields'](_0x460237['query'][_0x3f40('0x34')]));_0x237c91[_0x3f40('0x33')]=_0x237c91[_0x3f40('0x33')][_0x3f40('0x35')]?_0x237c91[_0x3f40('0x33')]:_0x5b0eaa[_0x3f40('0x2f')];if(_0x460237[_0x3f40('0x30')][_0x3f40('0x3f')]){_0x237c91[_0x3f40('0x44')]=[{'all':!![]}];}_0x237c91=_[_0x3f40('0x3c')]({},_0x237c91,_0x460237[_0x3f40('0x3e')]);return db[_0x3f40('0x2a')][_0x3f40('0x45')](_0x237c91)[_0x3f40('0x23')](handleEntityNotFound(_0x48b65e,null))['then'](respondWithResult(_0x48b65e,null))[_0x3f40('0x40')](handleError(_0x48b65e,null));};exports['create']=function(_0x2c1fa2,_0x2f16d6){return db['FreshdeskField'][_0x3f40('0x46')](_0x2c1fa2[_0x3f40('0x47')],{})[_0x3f40('0x23')](respondWithResult(_0x2f16d6,0xc9))[_0x3f40('0x40')](handleError(_0x2f16d6,null));};exports[_0x3f40('0x22')]=function(_0x268ae4,_0x851bfc){if(_0x268ae4[_0x3f40('0x47')]['id']){delete _0x268ae4[_0x3f40('0x47')]['id'];}return db[_0x3f40('0x2a')][_0x3f40('0x45')]({'where':{'id':_0x268ae4[_0x3f40('0x42')]['id']}})[_0x3f40('0x23')](handleEntityNotFound(_0x851bfc,null))[_0x3f40('0x23')](saveUpdates(_0x268ae4[_0x3f40('0x47')],null))[_0x3f40('0x23')](respondWithResult(_0x851bfc,null))[_0x3f40('0x40')](handleError(_0x851bfc,null));};exports[_0x3f40('0x24')]=function(_0x32bd05,_0x2d7e66){return db[_0x3f40('0x2a')]['find']({'where':{'id':_0x32bd05[_0x3f40('0x42')]['id']}})[_0x3f40('0x23')](handleEntityNotFound(_0x2d7e66,null))[_0x3f40('0x23')](removeEntity(_0x2d7e66,null))[_0x3f40('0x40')](handleError(_0x2d7e66,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index d0a520a..68354e8 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 _0x9975=['exports','define','FreshdeskField','int_freshdesk_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./intFreshdeskField.attributes'];(function(_0x1ba47c,_0x3445d0){var _0xa2f088=function(_0x22938b){while(--_0x22938b){_0x1ba47c['push'](_0x1ba47c['shift']());}};_0xa2f088(++_0x3445d0);}(_0x9975,0xf6));var _0x5997=function(_0x5b1c32,_0x4673d4){_0x5b1c32=_0x5b1c32-0x0;var _0x16316b=_0x9975[_0x5b1c32];return _0x16316b;};'use strict';var _=require(_0x5997('0x0'));var util=require(_0x5997('0x1'));var logger=require(_0x5997('0x2'))(_0x5997('0x3'));var moment=require(_0x5997('0x4'));var BPromise=require(_0x5997('0x5'));var rp=require(_0x5997('0x6'));var fs=require('fs');var path=require(_0x5997('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5997('0x8'));module[_0x5997('0x9')]=function(_0x11a007,_0x44950b){return _0x11a007[_0x5997('0xa')](_0x5997('0xb'),attributes,{'tableName':_0x5997('0xc'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x5997('0xd'),_0x5997('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x77ec=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util'];(function(_0x21e3e4,_0x2f28a0){var _0x32589c=function(_0x4acbcc){while(--_0x4acbcc){_0x21e3e4['push'](_0x21e3e4['shift']());}};_0x32589c(++_0x2f28a0);}(_0x77ec,0x1cf));var _0xc77e=function(_0x3b7b54,_0x3bd3b6){_0x3b7b54=_0x3b7b54-0x0;var _0x2568c6=_0x77ec[_0x3b7b54];return _0x2568c6;};'use strict';var _=require(_0xc77e('0x0'));var util=require(_0xc77e('0x1'));var logger=require(_0xc77e('0x2'))(_0xc77e('0x3'));var moment=require(_0xc77e('0x4'));var BPromise=require(_0xc77e('0x5'));var rp=require(_0xc77e('0x6'));var fs=require('fs');var path=require(_0xc77e('0x7'));var rimraf=require(_0xc77e('0x8'));var config=require(_0xc77e('0x9'));var attributes=require('./intFreshdeskField.attributes');module['exports']=function(_0x2e5108,_0x420d94){return _0x2e5108['define'](_0xc77e('0xa'),attributes,{'tableName':_0xc77e('0xb'),'paranoid':![],'indexes':[{'name':_0xc77e('0xc'),'fields':[_0xc77e('0xd'),_0xc77e('0xe')],'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 20c0980..efe9f49 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 _0xa60f=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','result','message','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x3f7bbe,_0x30e013){var _0x2e0545=function(_0x4686a9){while(--_0x4686a9){_0x3f7bbe['push'](_0x3f7bbe['shift']());}};_0x2e0545(++_0x30e013);}(_0xa60f,0x153));var _0xfa60=function(_0x10d2af,_0x47c53d){_0x10d2af=_0x10d2af-0x0;var _0x223208=_0xa60f[_0x10d2af];return _0x223208;};'use strict';var _=require(_0xfa60('0x0'));var util=require(_0xfa60('0x1'));var moment=require(_0xfa60('0x2'));var BPromise=require(_0xfa60('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa60('0x4'));var db=require(_0xfa60('0x5'))['db'];var utils=require(_0xfa60('0x6'));var logger=require(_0xfa60('0x7'))(_0xfa60('0x8'));var config=require(_0xfa60('0x9'));var jayson=require(_0xfa60('0xa'));var client=jayson[_0xfa60('0xb')][_0xfa60('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1e8517,_0x476205,_0x13d47f){return new BPromise(function(_0x2d11f9,_0x4caa42){return client[_0xfa60('0xd')](_0x1e8517,_0x13d47f)['then'](function(_0x440be6){logger[_0xfa60('0xe')](_0xfa60('0xf'),_0x476205,_0xfa60('0x10'));logger[_0xfa60('0x11')](_0xfa60('0x12'),_0x476205,_0xfa60('0x10'),JSON[_0xfa60('0x13')](_0x440be6));if(_0x440be6[_0xfa60('0x14')]){if(_0x440be6[_0xfa60('0x14')]['code']===0x1f4){logger[_0xfa60('0x14')](_0xfa60('0xf'),_0x476205,_0x440be6['error']['message']);return _0x4caa42(_0x440be6['error']['message']);}logger[_0xfa60('0x14')](_0xfa60('0xf'),_0x476205,_0x440be6[_0xfa60('0x14')]['message']);return _0x2d11f9(_0x440be6[_0xfa60('0x14')]['message']);}else{logger[_0xfa60('0xe')]('FreshdeskField,\x20%s,\x20%s',_0x476205,'request\x20sent');_0x2d11f9(_0x440be6[_0xfa60('0x15')][_0xfa60('0x16')]);}})['catch'](function(_0x37af04){logger[_0xfa60('0x14')]('FreshdeskField,\x20%s,\x20%s',_0x476205,_0x37af04);_0x4caa42(_0x37af04);});});} \ No newline at end of file +var _0x9837=['error','message','FreshdeskField,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','stringify'];(function(_0x5808f6,_0x3eb582){var _0x308aef=function(_0x2116fb){while(--_0x2116fb){_0x5808f6['push'](_0x5808f6['shift']());}};_0x308aef(++_0x3eb582);}(_0x9837,0x1d3));var _0x7983=function(_0x3952f8,_0x38ce07){_0x3952f8=_0x3952f8-0x0;var _0x3d57c0=_0x9837[_0x3952f8];return _0x3d57c0;};'use strict';var _=require(_0x7983('0x0'));var util=require(_0x7983('0x1'));var moment=require(_0x7983('0x2'));var BPromise=require(_0x7983('0x3'));var rs=require(_0x7983('0x4'));var fs=require('fs');var Redis=require(_0x7983('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7983('0x6'));var logger=require(_0x7983('0x7'))(_0x7983('0x8'));var config=require(_0x7983('0x9'));var jayson=require(_0x7983('0xa'));var client=jayson[_0x7983('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c1e35,_0x294679,_0x75a6b6){return new BPromise(function(_0x11eb88,_0x2bae02){return client['request'](_0x5c1e35,_0x75a6b6)[_0x7983('0xc')](function(_0x49db28){logger[_0x7983('0xd')]('FreshdeskField,\x20%s,\x20%s',_0x294679,_0x7983('0xe'));logger[_0x7983('0xf')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x294679,_0x7983('0xe'),JSON[_0x7983('0x10')](_0x49db28));if(_0x49db28[_0x7983('0x11')]){if(_0x49db28[_0x7983('0x11')]['code']===0x1f4){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x294679,_0x49db28[_0x7983('0x11')][_0x7983('0x12')]);return _0x2bae02(_0x49db28[_0x7983('0x11')][_0x7983('0x12')]);}logger[_0x7983('0x11')](_0x7983('0x13'),_0x294679,_0x49db28[_0x7983('0x11')]['message']);return _0x11eb88(_0x49db28[_0x7983('0x11')][_0x7983('0x12')]);}else{logger[_0x7983('0xd')]('FreshdeskField,\x20%s,\x20%s',_0x294679,_0x7983('0xe'));_0x11eb88(_0x49db28[_0x7983('0x14')]['message']);}})[_0x7983('0x15')](function(_0x3d672e){logger['error'](_0x7983('0x13'),_0x294679,_0x3d672e);_0x2bae02(_0x3d672e);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 535eafc..4da74b0 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 _0xa571=['/:id','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','index'];(function(_0x2b1905,_0x3848fd){var _0x3dab44=function(_0x1a5b53){while(--_0x1a5b53){_0x2b1905['push'](_0x2b1905['shift']());}};_0x3dab44(++_0x3848fd);}(_0xa571,0x107));var _0x1a57=function(_0x290a56,_0x28a02a){_0x290a56=_0x290a56-0x0;var _0x56e834=_0xa571[_0x290a56];return _0x56e834;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var fs_extra=require(_0x1a57('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a57('0x6'));var controller=require('./intFreshsalesAccount.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0x7')](_0x1a57('0xb'),auth[_0x1a57('0x8')](),controller['getConfigurations']);router[_0x1a57('0x7')](_0x1a57('0xc'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0xe')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0xf')]);router[_0x1a57('0xe')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x1a57('0x10')]);router[_0x1a57('0x11')](_0x1a57('0xa'),auth['isAuthenticated'](),controller[_0x1a57('0x12')]);router[_0x1a57('0x13')]('/:id',auth[_0x1a57('0x8')](),controller['destroy']);module[_0x1a57('0x14')]=router; \ No newline at end of file +var _0xb9be=['isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x2eab77,_0x4d6f2e){var _0x127541=function(_0x23e4b2){while(--_0x23e4b2){_0x2eab77['push'](_0x2eab77['shift']());}};_0x127541(++_0x4d6f2e);}(_0xb9be,0xc5));var _0xeb9b=function(_0x40911a,_0x55ec99){_0x40911a=_0x40911a-0x0;var _0x27e8e3=_0xb9be[_0x40911a];return _0x27e8e3;};'use strict';var multer=require(_0xeb9b('0x0'));var util=require(_0xeb9b('0x1'));var path=require(_0xeb9b('0x2'));var timeout=require(_0xeb9b('0x3'));var express=require(_0xeb9b('0x4'));var router=express[_0xeb9b('0x5')]();var fs_extra=require(_0xeb9b('0x6'));var auth=require(_0xeb9b('0x7'));var interaction=require(_0xeb9b('0x8'));var config=require('../../config/environment');var controller=require('./intFreshsalesAccount.controller');router[_0xeb9b('0x9')]('/',auth[_0xeb9b('0xa')](),controller[_0xeb9b('0xb')]);router['get'](_0xeb9b('0xc'),auth[_0xeb9b('0xa')](),controller[_0xeb9b('0xd')]);router[_0xeb9b('0x9')](_0xeb9b('0xe'),auth[_0xeb9b('0xa')](),controller[_0xeb9b('0xf')]);router[_0xeb9b('0x9')](_0xeb9b('0x10'),auth['isAuthenticated'](),controller[_0xeb9b('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xeb9b('0x12')]);router[_0xeb9b('0x13')]('/:id/configurations',auth[_0xeb9b('0xa')](),controller[_0xeb9b('0x14')]);router[_0xeb9b('0x15')](_0xeb9b('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xeb9b('0xc'),auth[_0xeb9b('0xa')](),controller[_0xeb9b('0x16')]);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 cb20cdf..e713677 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 _0x4e2e=['username','remoteUri','exports','STRING'];(function(_0x5e325f,_0x5d9f8d){var _0x30034e=function(_0x2f7ac5){while(--_0x2f7ac5){_0x5e325f['push'](_0x5e325f['shift']());}};_0x30034e(++_0x5d9f8d);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x1ff297,_0x13b56c){_0x1ff297=_0x1ff297-0x0;var _0x3c4bd9=_0x4e2e[_0x1ff297];return _0x3c4bd9;};'use strict';var Sequelize=require('sequelize');module[_0xe4e2('0x0')]={'name':{'type':Sequelize[_0xe4e2('0x1')]},'description':{'type':Sequelize[_0xe4e2('0x1')]},'username':{'type':Sequelize[_0xe4e2('0x1')],'unique':_0xe4e2('0x2')},'apiKey':{'type':Sequelize[_0xe4e2('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xe4e2('0x3')},'serverUrl':{'type':Sequelize[_0xe4e2('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x781d=['sequelize','exports','STRING','username','remoteUri'];(function(_0x2a3746,_0x4a8a46){var _0x1d7e9a=function(_0x110fdd){while(--_0x110fdd){_0x2a3746['push'](_0x2a3746['shift']());}};_0x1d7e9a(++_0x4a8a46);}(_0x781d,0x14a));var _0xd781=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x781d[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0xd781('0x0'));module[_0xd781('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd781('0x2')],'unique':_0xd781('0x3')},'apiKey':{'type':Sequelize[_0xd781('0x2')]},'remoteUri':{'type':Sequelize[_0xd781('0x2')],'unique':_0xd781('0x4')},'serverUrl':{'type':Sequelize[_0xd781('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 90c3b9b..369016e 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 _0x7028=['catch','show','params','find','create','update','body','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','apiKey','users','email','test','stringify','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshsalesAccount','includeAll','include','rows'];(function(_0x2d7e8d,_0x48a966){var _0x51a106=function(_0x23eac1){while(--_0x23eac1){_0x2d7e8d['push'](_0x2d7e8d['shift']());}};_0x51a106(++_0x48a966);}(_0x7028,0x8e));var _0x8702=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x7028[_0xae7c2f];return _0x5d7001;};'use strict';var emlformat=require(_0x8702('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8702('0x1'));var jsonpatch=require(_0x8702('0x2'));var rp=require(_0x8702('0x3'));var moment=require(_0x8702('0x4'));var BPromise=require(_0x8702('0x5'));var Mustache=require(_0x8702('0x6'));var util=require(_0x8702('0x7'));var path=require(_0x8702('0x8'));var sox=require('sox');var csv=require(_0x8702('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8702('0xa'));var squel=require(_0x8702('0xb'));var crypto=require(_0x8702('0xc'));var jsforce=require(_0x8702('0xd'));var deskjs=require(_0x8702('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8702('0xf'));var Papa=require('papaparse');var Redis=require(_0x8702('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8702('0x11'));var as=require(_0x8702('0x12'));var hardwareService=require(_0x8702('0x13'));var logger=require(_0x8702('0x14'))(_0x8702('0x15'));var utils=require(_0x8702('0x16'));var config=require(_0x8702('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8702('0x18'))['db'];var integrations=require(_0x8702('0x19'));function respondWithStatusCode(_0x498c7d,_0x19dbd5){_0x19dbd5=_0x19dbd5||0xcc;return function(_0x25dcd7){if(_0x25dcd7){return _0x498c7d[_0x8702('0x1a')](_0x19dbd5);}return _0x498c7d['status'](_0x19dbd5)[_0x8702('0x1b')]();};}function respondWithResult(_0x49c12d,_0x5a35cb){_0x5a35cb=_0x5a35cb||0xc8;return function(_0x406873){if(_0x406873){return _0x49c12d[_0x8702('0x1c')](_0x5a35cb)[_0x8702('0x1d')](_0x406873);}};}function respondWithFilteredResult(_0x2238e2,_0x645a3c){return function(_0x4e998b){if(_0x4e998b){var _0x408341=typeof _0x645a3c[_0x8702('0x1e')]===_0x8702('0x1f')&&typeof _0x645a3c[_0x8702('0x20')]===_0x8702('0x1f');var _0x1adb8d=_0x4e998b['count'];var _0x2daf32=_0x408341?0x0:_0x645a3c[_0x8702('0x1e')];var _0x2da594=_0x408341?_0x4e998b[_0x8702('0x21')]:_0x645a3c[_0x8702('0x1e')]+_0x645a3c[_0x8702('0x20')];var _0x51c021;if(_0x2da594>=_0x1adb8d){_0x2da594=_0x1adb8d;_0x51c021=0xc8;}else{_0x51c021=0xce;}_0x2238e2[_0x8702('0x1c')](_0x51c021);return _0x2238e2[_0x8702('0x22')](_0x8702('0x23'),_0x2daf32+'-'+_0x2da594+'/'+_0x1adb8d)[_0x8702('0x1d')](_0x4e998b);}return null;};}function patchUpdates(_0x3fba46){return function(_0x5bcca0){try{jsonpatch[_0x8702('0x24')](_0x5bcca0,_0x3fba46,!![]);}catch(_0x3ff327){return BPromise['reject'](_0x3ff327);}return _0x5bcca0[_0x8702('0x25')]();};}function saveUpdates(_0x1c3dd8,_0x57fb2a){return function(_0x2f3f09){if(_0x2f3f09){return _0x2f3f09['update'](_0x1c3dd8)[_0x8702('0x26')](function(_0x461eae){return _0x461eae;});}return null;};}function removeEntity(_0x3259b0,_0x252391){return function(_0x28685e){if(_0x28685e){return _0x28685e[_0x8702('0x27')]()[_0x8702('0x26')](function(){_0x3259b0['status'](0xcc)[_0x8702('0x1b')]();});}};}function handleEntityNotFound(_0x46a79d,_0x25b1f4){return function(_0x2b34d0){if(!_0x2b34d0){_0x46a79d['sendStatus'](0x194);}return _0x2b34d0;};}function handleError(_0x11e437,_0x14655a){_0x14655a=_0x14655a||0x1f4;return function(_0x2fdb38){logger[_0x8702('0x28')](_0x2fdb38[_0x8702('0x29')]);if(_0x2fdb38['name']){delete _0x2fdb38[_0x8702('0x2a')];}_0x11e437[_0x8702('0x1c')](_0x14655a)[_0x8702('0x2b')](_0x2fdb38);};}exports[_0x8702('0x2c')]=function(_0x586b41,_0x10f87f){var _0x16c59a={},_0x528796={},_0x36e703={'count':0x0,'rows':[]};var _0x4899d0=_[_0x8702('0x2d')](db['FreshsalesAccount'][_0x8702('0x2e')],function(_0x4ca706){return{'name':_0x4ca706[_0x8702('0x2f')],'type':_0x4ca706['type']['key']};});_0x528796[_0x8702('0x30')]=_[_0x8702('0x2d')](_0x4899d0,_0x8702('0x2a'));_0x528796[_0x8702('0x31')]=_[_0x8702('0x32')](_0x586b41['query']);_0x528796[_0x8702('0x33')]=_[_0x8702('0x34')](_0x528796[_0x8702('0x30')],_0x528796['query']);_0x16c59a[_0x8702('0x35')]=_[_0x8702('0x34')](_0x528796[_0x8702('0x30')],qs[_0x8702('0x36')](_0x586b41['query']['fields']));_0x16c59a[_0x8702('0x35')]=_0x16c59a[_0x8702('0x35')][_0x8702('0x37')]?_0x16c59a[_0x8702('0x35')]:_0x528796[_0x8702('0x30')];if(!_0x586b41[_0x8702('0x31')][_0x8702('0x38')](_0x8702('0x39'))){_0x16c59a[_0x8702('0x20')]=qs[_0x8702('0x20')](_0x586b41[_0x8702('0x31')][_0x8702('0x20')]);_0x16c59a[_0x8702('0x1e')]=qs[_0x8702('0x1e')](_0x586b41[_0x8702('0x31')][_0x8702('0x1e')]);}_0x16c59a[_0x8702('0x3a')]=qs[_0x8702('0x3b')](_0x586b41[_0x8702('0x31')][_0x8702('0x3b')]);_0x16c59a[_0x8702('0x3c')]=qs[_0x8702('0x33')](_[_0x8702('0x3d')](_0x586b41['query'],_0x528796[_0x8702('0x33')]),_0x4899d0);if(_0x586b41[_0x8702('0x31')][_0x8702('0x3e')]){_0x16c59a['where']=_[_0x8702('0x3f')](_0x16c59a[_0x8702('0x3c')],{'$or':_[_0x8702('0x2d')](_0x4899d0,function(_0x3f2008){if(_0x3f2008['type']!==_0x8702('0x40')){var _0x527b29={};_0x527b29[_0x3f2008[_0x8702('0x2a')]]={'$like':'%'+_0x586b41[_0x8702('0x31')]['filter']+'%'};return _0x527b29;}})});}_0x16c59a=_[_0x8702('0x3f')]({},_0x16c59a,_0x586b41[_0x8702('0x41')]);var _0x5e1daa={'where':_0x16c59a[_0x8702('0x3c')]};return db[_0x8702('0x42')][_0x8702('0x21')](_0x5e1daa)['then'](function(_0x542254){_0x36e703[_0x8702('0x21')]=_0x542254;if(_0x586b41[_0x8702('0x31')][_0x8702('0x43')]){_0x16c59a[_0x8702('0x44')]=[{'all':!![]}];}return db[_0x8702('0x42')]['findAll'](_0x16c59a);})[_0x8702('0x26')](function(_0x53267a){_0x36e703[_0x8702('0x45')]=_0x53267a;return _0x36e703;})[_0x8702('0x26')](respondWithFilteredResult(_0x10f87f,_0x16c59a))[_0x8702('0x46')](handleError(_0x10f87f,null));};exports[_0x8702('0x47')]=function(_0x264579,_0x39548e){var _0x886d09={'raw':![],'where':{'id':_0x264579[_0x8702('0x48')]['id']}},_0x567c7f={};_0x567c7f[_0x8702('0x30')]=_[_0x8702('0x32')](db['FreshsalesAccount'][_0x8702('0x2e')]);_0x567c7f[_0x8702('0x31')]=_[_0x8702('0x32')](_0x264579[_0x8702('0x31')]);_0x567c7f[_0x8702('0x33')]=_[_0x8702('0x34')](_0x567c7f['model'],_0x567c7f[_0x8702('0x31')]);_0x886d09[_0x8702('0x35')]=_['intersection'](_0x567c7f['model'],qs[_0x8702('0x36')](_0x264579[_0x8702('0x31')]['fields']));_0x886d09[_0x8702('0x35')]=_0x886d09[_0x8702('0x35')][_0x8702('0x37')]?_0x886d09[_0x8702('0x35')]:_0x567c7f[_0x8702('0x30')];if(_0x264579[_0x8702('0x31')][_0x8702('0x43')]){_0x886d09[_0x8702('0x44')]=[{'all':!![]}];}_0x886d09=_[_0x8702('0x3f')]({},_0x886d09,_0x264579['options']);return db[_0x8702('0x42')][_0x8702('0x49')](_0x886d09)['then'](handleEntityNotFound(_0x39548e,null))[_0x8702('0x26')](respondWithResult(_0x39548e,null))[_0x8702('0x46')](handleError(_0x39548e,null));};exports[_0x8702('0x4a')]=function(_0x595367,_0xaf0851){return db[_0x8702('0x42')]['create'](_0x595367['body'],{})[_0x8702('0x26')](respondWithResult(_0xaf0851,0xc9))[_0x8702('0x46')](handleError(_0xaf0851,null));};exports[_0x8702('0x4b')]=function(_0x3de2ee,_0xa0a18b){if(_0x3de2ee[_0x8702('0x4c')]['id']){delete _0x3de2ee[_0x8702('0x4c')]['id'];}return db[_0x8702('0x42')]['find']({'where':{'id':_0x3de2ee[_0x8702('0x48')]['id']}})[_0x8702('0x26')](handleEntityNotFound(_0xa0a18b,null))[_0x8702('0x26')](saveUpdates(_0x3de2ee[_0x8702('0x4c')],null))[_0x8702('0x26')](respondWithResult(_0xa0a18b,null))[_0x8702('0x46')](handleError(_0xa0a18b,null));};exports[_0x8702('0x27')]=function(_0x197a80,_0x23db99){return db[_0x8702('0x42')][_0x8702('0x49')]({'where':{'id':_0x197a80[_0x8702('0x48')]['id']}})['then'](handleEntityNotFound(_0x23db99,null))['then'](removeEntity(_0x23db99,null))[_0x8702('0x46')](handleError(_0x23db99,null));};exports[_0x8702('0x4d')]=function(_0x25aa28,_0xf31cef,_0x1dcef2){var _0x1ece5b={};var _0x240722={};var _0x2216e5;var _0x7fbe91;return db['FreshsalesAccount'][_0x8702('0x4e')]({'where':{'id':_0x25aa28['params']['id']}})[_0x8702('0x26')](handleEntityNotFound(_0xf31cef,null))[_0x8702('0x26')](function(_0x1790e1){if(_0x1790e1){_0x2216e5=_0x1790e1;_0x240722[_0x8702('0x30')]=_['keys'](db[_0x8702('0x4f')][_0x8702('0x2e')]);_0x240722[_0x8702('0x31')]=_[_0x8702('0x32')](_0x25aa28[_0x8702('0x31')]);_0x240722[_0x8702('0x33')]=_[_0x8702('0x34')](_0x240722[_0x8702('0x30')],_0x240722['query']);_0x1ece5b[_0x8702('0x35')]=_[_0x8702('0x34')](_0x240722[_0x8702('0x30')],qs[_0x8702('0x36')](_0x25aa28['query']['fields']));_0x1ece5b[_0x8702('0x35')]=_0x1ece5b[_0x8702('0x35')][_0x8702('0x37')]?_0x1ece5b['attributes']:_0x240722[_0x8702('0x30')];_0x1ece5b[_0x8702('0x3a')]=qs[_0x8702('0x3b')](_0x25aa28[_0x8702('0x31')][_0x8702('0x3b')]);_0x1ece5b[_0x8702('0x3c')]=qs[_0x8702('0x33')](_[_0x8702('0x3d')](_0x25aa28[_0x8702('0x31')],_0x240722[_0x8702('0x33')]));if(_0x25aa28[_0x8702('0x31')][_0x8702('0x3e')]){_0x1ece5b[_0x8702('0x3c')]=_[_0x8702('0x3f')](_0x1ece5b[_0x8702('0x3c')],{'$or':_[_0x8702('0x2d')](_0x1ece5b['attributes'],function(_0x5d153e){var _0x34a07d={};_0x34a07d[_0x5d153e]={'$like':'%'+_0x25aa28[_0x8702('0x31')][_0x8702('0x3e')]+'%'};return _0x34a07d;})});}_0x1ece5b=_[_0x8702('0x3f')]({},_0x1ece5b,_0x25aa28[_0x8702('0x41')]);return _0x2216e5[_0x8702('0x4d')](_0x1ece5b);}})[_0x8702('0x26')](function(_0x50b528){if(_0x50b528){_0x7fbe91=_0x50b528[_0x8702('0x37')];if(!_0x25aa28['query'][_0x8702('0x38')]('nolimit')){_0x1ece5b[_0x8702('0x20')]=qs['limit'](_0x25aa28[_0x8702('0x31')]['limit']);_0x1ece5b[_0x8702('0x1e')]=qs['offset'](_0x25aa28['query'][_0x8702('0x1e')]);}return _0x2216e5[_0x8702('0x4d')](_0x1ece5b);}})[_0x8702('0x26')](function(_0x3df6fd){if(_0x3df6fd){return _0x3df6fd?{'count':_0x7fbe91,'rows':_0x3df6fd}:null;}})[_0x8702('0x26')](respondWithResult(_0xf31cef,null))[_0x8702('0x46')](handleError(_0xf31cef,null));};exports[_0x8702('0x50')]=function(_0x33ff78,_0xe3700c,_0xbca419){if(_0x33ff78[_0x8702('0x4c')]['id']){delete _0x33ff78[_0x8702('0x4c')]['id'];}return db['FreshsalesAccount'][_0x8702('0x4e')]({'where':{'id':_0x33ff78['params']['id']}})[_0x8702('0x26')](handleEntityNotFound(_0xe3700c,null))['then'](function(_0x46cd51){if(_0x46cd51){_0x33ff78[_0x8702('0x4c')][_0x8702('0x51')]=_0x46cd51['id'];_0x33ff78[_0x8702('0x4c')][_0x8702('0x52')]=integrations[_0x8702('0x53')](_0x33ff78[_0x8702('0x4c')][_0x8702('0x54')],_0x33ff78[_0x8702('0x4c')][_0x8702('0x55')]);_0x33ff78['body'][_0x8702('0x56')]=integrations[_0x8702('0x57')](_0x33ff78[_0x8702('0x4c')][_0x8702('0x54')],_0x33ff78[_0x8702('0x4c')][_0x8702('0x55')]);return db[_0x8702('0x4f')]['create'](_0x33ff78['body'],{'include':[{'model':db[_0x8702('0x58')],'as':_0x8702('0x52')},{'model':db[_0x8702('0x58')],'as':_0x8702('0x56')}]});}return null;})['then'](respondWithResult(_0xe3700c,null))['catch'](handleError(_0xe3700c,null));};exports[_0x8702('0x59')]=function(_0x5e1ef8,_0x335dbd,_0x293081){var _0x38d355='';var _0x2728ba='';return db[_0x8702('0x42')][_0x8702('0x4e')]({'where':{'id':_0x5e1ef8[_0x8702('0x48')]['id']},'attributes':['id','username','remoteUri','apiKey']})[_0x8702('0x26')](handleEntityNotFound(_0x335dbd,null))[_0x8702('0x26')](function(_0x557344){if(_0x557344){_0x2728ba=_0x557344[_0x8702('0x5a')];_0x38d355=_0x557344['remoteUri'];var _0x1e23c5=_0x557344[_0x8702('0x5b')]['slice'](-0x1);if(_0x1e23c5==='/'){_0x38d355=_0x38d355[_0x8702('0x5c')](0x0,_0x38d355[_0x8702('0x5d')](_0x1e23c5));}return rp({'method':_0x8702('0x5e'),'uri':util[_0x8702('0x5f')](_0x8702('0x60'),_0x38d355,_0x8702('0x61')),'headers':{'Authorization':_0x8702('0x62')+_0x557344[_0x8702('0x63')]},'json':!![]});}})[_0x8702('0x26')](function(_0x3b25ab){if(_0x3b25ab){var _0x4c9163=_0x3b25ab[_0x8702('0x64')];var _0xdbd1fc=![];var _0x283dee=null;for(_0x283dee=0x0;_0x283dee<_0x4c9163[_0x8702('0x37')];_0x283dee++){if(_0x4c9163[_0x283dee][_0x8702('0x65')]===_0x2728ba){_0xdbd1fc=!![];}}if(_0xdbd1fc){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x8702('0x26')](respondWithResult(_0x335dbd,null))[_0x8702('0x46')](function(_0x164965){var _0x5b7472=_0x5e1ef8['query'][_0x8702('0x66')]?0x1f4:_0x164965['statusCode']||0x1f4;logger[_0x8702('0x28')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x5b7472,JSON[_0x8702('0x67')](_0x164965));delete _0x164965['name'];if(_0x5b7472===0x191){_0x5b7472=0x190;}_0x335dbd[_0x8702('0x1c')](_0x5b7472)[_0x8702('0x2b')](_0x5e1ef8['query']['test']?{'message':_0x8702('0x68'),'statusCode':_0x164965[_0x8702('0x69')]}:_0x164965);});}; \ No newline at end of file +var _0xd3ad=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','name','send','index','FreshsalesAccount','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','findAll','rows','show','params','keys','include','catch','create','body','find','getConfigurations','findOne','filter','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesConfiguration','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','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/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd3ad,0xba));var _0xdd3a=function(_0x5844a3,_0x304446){_0x5844a3=_0x5844a3-0x0;var _0x45c45e=_0xd3ad[_0x5844a3];return _0x45c45e;};'use strict';var emlformat=require(_0xdd3a('0x0'));var rimraf=require(_0xdd3a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdd3a('0x2'));var rp=require(_0xdd3a('0x3'));var moment=require(_0xdd3a('0x4'));var BPromise=require(_0xdd3a('0x5'));var Mustache=require(_0xdd3a('0x6'));var util=require(_0xdd3a('0x7'));var path=require(_0xdd3a('0x8'));var sox=require(_0xdd3a('0x9'));var csv=require(_0xdd3a('0xa'));var ejs=require(_0xdd3a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdd3a('0xc'));var squel=require(_0xdd3a('0xd'));var crypto=require(_0xdd3a('0xe'));var jsforce=require(_0xdd3a('0xf'));var deskjs=require(_0xdd3a('0x10'));var toCsv=require(_0xdd3a('0xa'));var querystring=require('querystring');var Papa=require(_0xdd3a('0x11'));var Redis=require(_0xdd3a('0x12'));var authService=require(_0xdd3a('0x13'));var qs=require(_0xdd3a('0x14'));var as=require(_0xdd3a('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdd3a('0x16'))(_0xdd3a('0x17'));var utils=require('../../config/utils');var config=require(_0xdd3a('0x18'));var licenseUtil=require(_0xdd3a('0x19'));var db=require(_0xdd3a('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5d5c96,_0x372d18){_0x372d18=_0x372d18||0xcc;return function(_0x17c469){if(_0x17c469){return _0x5d5c96[_0xdd3a('0x1b')](_0x372d18);}return _0x5d5c96[_0xdd3a('0x1c')](_0x372d18)[_0xdd3a('0x1d')]();};}function respondWithResult(_0x2e28ed,_0x5843c4){_0x5843c4=_0x5843c4||0xc8;return function(_0x5c72c6){if(_0x5c72c6){return _0x2e28ed[_0xdd3a('0x1c')](_0x5843c4)[_0xdd3a('0x1e')](_0x5c72c6);}};}function respondWithFilteredResult(_0x249f25,_0x1d6f44){return function(_0x1baac6){if(_0x1baac6){var _0x5d7db4=typeof _0x1d6f44[_0xdd3a('0x1f')]===_0xdd3a('0x20')&&typeof _0x1d6f44[_0xdd3a('0x21')]===_0xdd3a('0x20');var _0x315d27=_0x1baac6['count'];var _0x24a6cc=_0x5d7db4?0x0:_0x1d6f44[_0xdd3a('0x1f')];var _0x5d75d5=_0x5d7db4?_0x1baac6[_0xdd3a('0x22')]:_0x1d6f44['offset']+_0x1d6f44['limit'];var _0x4b4365;if(_0x5d75d5>=_0x315d27){_0x5d75d5=_0x315d27;_0x4b4365=0xc8;}else{_0x4b4365=0xce;}_0x249f25[_0xdd3a('0x1c')](_0x4b4365);return _0x249f25[_0xdd3a('0x23')](_0xdd3a('0x24'),_0x24a6cc+'-'+_0x5d75d5+'/'+_0x315d27)[_0xdd3a('0x1e')](_0x1baac6);}return null;};}function patchUpdates(_0x167477){return function(_0xc31442){try{jsonpatch[_0xdd3a('0x25')](_0xc31442,_0x167477,!![]);}catch(_0x44ca22){return BPromise['reject'](_0x44ca22);}return _0xc31442[_0xdd3a('0x26')]();};}function saveUpdates(_0x3c6677,_0x44f2c2){return function(_0x4fdc6b){if(_0x4fdc6b){return _0x4fdc6b[_0xdd3a('0x27')](_0x3c6677)[_0xdd3a('0x28')](function(_0x26ba39){return _0x26ba39;});}return null;};}function removeEntity(_0x546616,_0x49ffb0){return function(_0x5751f4){if(_0x5751f4){return _0x5751f4[_0xdd3a('0x29')]()[_0xdd3a('0x28')](function(){_0x546616[_0xdd3a('0x1c')](0xcc)[_0xdd3a('0x1d')]();});}};}function handleEntityNotFound(_0x163956,_0x42e175){return function(_0x2c8b){if(!_0x2c8b){_0x163956[_0xdd3a('0x1b')](0x194);}return _0x2c8b;};}function handleError(_0x1c8fdd,_0x2a2c5f){_0x2a2c5f=_0x2a2c5f||0x1f4;return function(_0xc7aad7){logger['error'](_0xc7aad7['stack']);if(_0xc7aad7[_0xdd3a('0x2a')]){delete _0xc7aad7['name'];}_0x1c8fdd['status'](_0x2a2c5f)[_0xdd3a('0x2b')](_0xc7aad7);};}exports[_0xdd3a('0x2c')]=function(_0x395fa7,_0x356c29){var _0x37e2b4={},_0x5101e4={},_0x3529b8={'count':0x0,'rows':[]};var _0x31940d=_['map'](db[_0xdd3a('0x2d')][_0xdd3a('0x2e')],function(_0x27b0e5){return{'name':_0x27b0e5[_0xdd3a('0x2f')],'type':_0x27b0e5[_0xdd3a('0x30')]['key']};});_0x5101e4[_0xdd3a('0x31')]=_[_0xdd3a('0x32')](_0x31940d,'name');_0x5101e4[_0xdd3a('0x33')]=_['keys'](_0x395fa7[_0xdd3a('0x33')]);_0x5101e4[_0xdd3a('0x34')]=_[_0xdd3a('0x35')](_0x5101e4[_0xdd3a('0x31')],_0x5101e4[_0xdd3a('0x33')]);_0x37e2b4[_0xdd3a('0x36')]=_[_0xdd3a('0x35')](_0x5101e4[_0xdd3a('0x31')],qs[_0xdd3a('0x37')](_0x395fa7[_0xdd3a('0x33')][_0xdd3a('0x37')]));_0x37e2b4[_0xdd3a('0x36')]=_0x37e2b4['attributes'][_0xdd3a('0x38')]?_0x37e2b4['attributes']:_0x5101e4['model'];if(!_0x395fa7['query'][_0xdd3a('0x39')](_0xdd3a('0x3a'))){_0x37e2b4[_0xdd3a('0x21')]=qs[_0xdd3a('0x21')](_0x395fa7[_0xdd3a('0x33')][_0xdd3a('0x21')]);_0x37e2b4[_0xdd3a('0x1f')]=qs[_0xdd3a('0x1f')](_0x395fa7[_0xdd3a('0x33')]['offset']);}_0x37e2b4[_0xdd3a('0x3b')]=qs[_0xdd3a('0x3c')](_0x395fa7[_0xdd3a('0x33')][_0xdd3a('0x3c')]);_0x37e2b4[_0xdd3a('0x3d')]=qs[_0xdd3a('0x34')](_[_0xdd3a('0x3e')](_0x395fa7[_0xdd3a('0x33')],_0x5101e4['filters']),_0x31940d);if(_0x395fa7[_0xdd3a('0x33')]['filter']){_0x37e2b4[_0xdd3a('0x3d')]=_[_0xdd3a('0x3f')](_0x37e2b4[_0xdd3a('0x3d')],{'$or':_['map'](_0x31940d,function(_0x42a7c3){if(_0x42a7c3['type']!==_0xdd3a('0x40')){var _0x199164={};_0x199164[_0x42a7c3[_0xdd3a('0x2a')]]={'$like':'%'+_0x395fa7[_0xdd3a('0x33')]['filter']+'%'};return _0x199164;}})});}_0x37e2b4=_[_0xdd3a('0x3f')]({},_0x37e2b4,_0x395fa7[_0xdd3a('0x41')]);var _0x1c9f4e={'where':_0x37e2b4[_0xdd3a('0x3d')]};return db[_0xdd3a('0x2d')][_0xdd3a('0x22')](_0x1c9f4e)['then'](function(_0x396c31){_0x3529b8['count']=_0x396c31;if(_0x395fa7[_0xdd3a('0x33')]['includeAll']){_0x37e2b4['include']=[{'all':!![]}];}return db[_0xdd3a('0x2d')][_0xdd3a('0x42')](_0x37e2b4);})[_0xdd3a('0x28')](function(_0x2d9614){_0x3529b8[_0xdd3a('0x43')]=_0x2d9614;return _0x3529b8;})['then'](respondWithFilteredResult(_0x356c29,_0x37e2b4))['catch'](handleError(_0x356c29,null));};exports[_0xdd3a('0x44')]=function(_0x53fbba,_0x104486){var _0x294e48={'raw':![],'where':{'id':_0x53fbba[_0xdd3a('0x45')]['id']}},_0x3ccd01={};_0x3ccd01['model']=_[_0xdd3a('0x46')](db[_0xdd3a('0x2d')]['rawAttributes']);_0x3ccd01[_0xdd3a('0x33')]=_[_0xdd3a('0x46')](_0x53fbba['query']);_0x3ccd01[_0xdd3a('0x34')]=_[_0xdd3a('0x35')](_0x3ccd01[_0xdd3a('0x31')],_0x3ccd01[_0xdd3a('0x33')]);_0x294e48[_0xdd3a('0x36')]=_[_0xdd3a('0x35')](_0x3ccd01[_0xdd3a('0x31')],qs[_0xdd3a('0x37')](_0x53fbba['query']['fields']));_0x294e48['attributes']=_0x294e48[_0xdd3a('0x36')]['length']?_0x294e48[_0xdd3a('0x36')]:_0x3ccd01[_0xdd3a('0x31')];if(_0x53fbba[_0xdd3a('0x33')]['includeAll']){_0x294e48[_0xdd3a('0x47')]=[{'all':!![]}];}_0x294e48=_[_0xdd3a('0x3f')]({},_0x294e48,_0x53fbba[_0xdd3a('0x41')]);return db[_0xdd3a('0x2d')]['find'](_0x294e48)[_0xdd3a('0x28')](handleEntityNotFound(_0x104486,null))[_0xdd3a('0x28')](respondWithResult(_0x104486,null))[_0xdd3a('0x48')](handleError(_0x104486,null));};exports[_0xdd3a('0x49')]=function(_0x2fde01,_0x4f00c9){return db[_0xdd3a('0x2d')]['create'](_0x2fde01['body'],{})[_0xdd3a('0x28')](respondWithResult(_0x4f00c9,0xc9))[_0xdd3a('0x48')](handleError(_0x4f00c9,null));};exports[_0xdd3a('0x27')]=function(_0x4c9854,_0xab81a4){if(_0x4c9854[_0xdd3a('0x4a')]['id']){delete _0x4c9854[_0xdd3a('0x4a')]['id'];}return db[_0xdd3a('0x2d')][_0xdd3a('0x4b')]({'where':{'id':_0x4c9854[_0xdd3a('0x45')]['id']}})['then'](handleEntityNotFound(_0xab81a4,null))[_0xdd3a('0x28')](saveUpdates(_0x4c9854['body'],null))[_0xdd3a('0x28')](respondWithResult(_0xab81a4,null))[_0xdd3a('0x48')](handleError(_0xab81a4,null));};exports[_0xdd3a('0x29')]=function(_0xa7a29,_0x5cd333){return db[_0xdd3a('0x2d')][_0xdd3a('0x4b')]({'where':{'id':_0xa7a29['params']['id']}})[_0xdd3a('0x28')](handleEntityNotFound(_0x5cd333,null))[_0xdd3a('0x28')](removeEntity(_0x5cd333,null))['catch'](handleError(_0x5cd333,null));};exports[_0xdd3a('0x4c')]=function(_0x158d2f,_0x44c5d9,_0x2a8870){var _0x38c574={};var _0x3f1922={};var _0x42ee71;var _0x136194;return db[_0xdd3a('0x2d')][_0xdd3a('0x4d')]({'where':{'id':_0x158d2f['params']['id']}})[_0xdd3a('0x28')](handleEntityNotFound(_0x44c5d9,null))[_0xdd3a('0x28')](function(_0x51b1c8){if(_0x51b1c8){_0x42ee71=_0x51b1c8;_0x3f1922[_0xdd3a('0x31')]=_[_0xdd3a('0x46')](db['FreshsalesConfiguration'][_0xdd3a('0x2e')]);_0x3f1922[_0xdd3a('0x33')]=_['keys'](_0x158d2f[_0xdd3a('0x33')]);_0x3f1922[_0xdd3a('0x34')]=_[_0xdd3a('0x35')](_0x3f1922['model'],_0x3f1922['query']);_0x38c574[_0xdd3a('0x36')]=_[_0xdd3a('0x35')](_0x3f1922[_0xdd3a('0x31')],qs[_0xdd3a('0x37')](_0x158d2f[_0xdd3a('0x33')][_0xdd3a('0x37')]));_0x38c574[_0xdd3a('0x36')]=_0x38c574[_0xdd3a('0x36')][_0xdd3a('0x38')]?_0x38c574[_0xdd3a('0x36')]:_0x3f1922[_0xdd3a('0x31')];_0x38c574[_0xdd3a('0x3b')]=qs[_0xdd3a('0x3c')](_0x158d2f[_0xdd3a('0x33')][_0xdd3a('0x3c')]);_0x38c574[_0xdd3a('0x3d')]=qs[_0xdd3a('0x34')](_[_0xdd3a('0x3e')](_0x158d2f['query'],_0x3f1922[_0xdd3a('0x34')]));if(_0x158d2f[_0xdd3a('0x33')][_0xdd3a('0x4e')]){_0x38c574[_0xdd3a('0x3d')]=_[_0xdd3a('0x3f')](_0x38c574[_0xdd3a('0x3d')],{'$or':_['map'](_0x38c574[_0xdd3a('0x36')],function(_0x1e0e7c){var _0xbff8ba={};_0xbff8ba[_0x1e0e7c]={'$like':'%'+_0x158d2f[_0xdd3a('0x33')][_0xdd3a('0x4e')]+'%'};return _0xbff8ba;})});}_0x38c574=_['merge']({},_0x38c574,_0x158d2f[_0xdd3a('0x41')]);return _0x42ee71[_0xdd3a('0x4c')](_0x38c574);}})[_0xdd3a('0x28')](function(_0x2c0967){if(_0x2c0967){_0x136194=_0x2c0967[_0xdd3a('0x38')];if(!_0x158d2f[_0xdd3a('0x33')]['hasOwnProperty'](_0xdd3a('0x3a'))){_0x38c574[_0xdd3a('0x21')]=qs[_0xdd3a('0x21')](_0x158d2f[_0xdd3a('0x33')][_0xdd3a('0x21')]);_0x38c574['offset']=qs[_0xdd3a('0x1f')](_0x158d2f[_0xdd3a('0x33')][_0xdd3a('0x1f')]);}return _0x42ee71[_0xdd3a('0x4c')](_0x38c574);}})['then'](function(_0x44b136){if(_0x44b136){return _0x44b136?{'count':_0x136194,'rows':_0x44b136}:null;}})['then'](respondWithResult(_0x44c5d9,null))[_0xdd3a('0x48')](handleError(_0x44c5d9,null));};exports[_0xdd3a('0x4f')]=function(_0x46b3a5,_0x30c972,_0x232f9e){if(_0x46b3a5['body']['id']){delete _0x46b3a5[_0xdd3a('0x4a')]['id'];}return db[_0xdd3a('0x2d')]['findOne']({'where':{'id':_0x46b3a5['params']['id']}})[_0xdd3a('0x28')](handleEntityNotFound(_0x30c972,null))[_0xdd3a('0x28')](function(_0x2ad41b){if(_0x2ad41b){_0x46b3a5[_0xdd3a('0x4a')][_0xdd3a('0x50')]=_0x2ad41b['id'];_0x46b3a5[_0xdd3a('0x4a')][_0xdd3a('0x51')]=integrations[_0xdd3a('0x52')](_0x46b3a5['body'][_0xdd3a('0x53')],_0x46b3a5[_0xdd3a('0x4a')][_0xdd3a('0x30')]);_0x46b3a5[_0xdd3a('0x4a')][_0xdd3a('0x54')]=integrations[_0xdd3a('0x55')](_0x46b3a5[_0xdd3a('0x4a')][_0xdd3a('0x53')],_0x46b3a5[_0xdd3a('0x4a')]['type']);return db[_0xdd3a('0x56')][_0xdd3a('0x49')](_0x46b3a5[_0xdd3a('0x4a')],{'include':[{'model':db[_0xdd3a('0x57')],'as':_0xdd3a('0x51')},{'model':db[_0xdd3a('0x57')],'as':_0xdd3a('0x54')}]});}return null;})[_0xdd3a('0x28')](respondWithResult(_0x30c972,null))[_0xdd3a('0x48')](handleError(_0x30c972,null));};exports[_0xdd3a('0x58')]=function(_0x377edd,_0x257ee8,_0x549ea6){var _0x5d52fd='';var _0xbfd18c='';return db[_0xdd3a('0x2d')][_0xdd3a('0x4d')]({'where':{'id':_0x377edd[_0xdd3a('0x45')]['id']},'attributes':['id',_0xdd3a('0x59'),_0xdd3a('0x5a'),_0xdd3a('0x5b')]})[_0xdd3a('0x28')](handleEntityNotFound(_0x257ee8,null))[_0xdd3a('0x28')](function(_0x38ff3b){if(_0x38ff3b){_0xbfd18c=_0x38ff3b[_0xdd3a('0x59')];_0x5d52fd=_0x38ff3b[_0xdd3a('0x5a')];var _0x12faca=_0x38ff3b[_0xdd3a('0x5a')][_0xdd3a('0x5c')](-0x1);if(_0x12faca==='/'){_0x5d52fd=_0x5d52fd[_0xdd3a('0x5d')](0x0,_0x5d52fd[_0xdd3a('0x5e')](_0x12faca));}return rp({'method':_0xdd3a('0x5f'),'uri':util[_0xdd3a('0x60')]('%s%s',_0x5d52fd,_0xdd3a('0x61')),'headers':{'Authorization':_0xdd3a('0x62')+_0x38ff3b[_0xdd3a('0x5b')]},'json':!![]});}})[_0xdd3a('0x28')](function(_0x48bdd5){if(_0x48bdd5){var _0x861445=_0x48bdd5[_0xdd3a('0x63')];var _0x49f512=![];var _0x1cec58=null;for(_0x1cec58=0x0;_0x1cec58<_0x861445['length'];_0x1cec58++){if(_0x861445[_0x1cec58]['email']===_0xbfd18c){_0x49f512=!![];}}if(_0x49f512){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xdd3a('0x64')});}}})['then'](respondWithResult(_0x257ee8,null))[_0xdd3a('0x48')](function(_0x5ac55c){var _0x418214=_0x377edd['query'][_0xdd3a('0x65')]?0x1f4:_0x5ac55c[_0xdd3a('0x66')]||0x1f4;logger[_0xdd3a('0x67')](_0xdd3a('0x68'),_0xdd3a('0x58'),_0x418214,JSON[_0xdd3a('0x69')](_0x5ac55c));delete _0x5ac55c[_0xdd3a('0x2a')];if(_0x418214===0x191){_0x418214=0x190;}_0x257ee8[_0xdd3a('0x1c')](_0x418214)[_0xdd3a('0x2b')](_0x377edd[_0xdd3a('0x33')][_0xdd3a('0x65')]?{'message':_0xdd3a('0x6a'),'statusCode':_0x5ac55c[_0xdd3a('0x66')]}:_0x5ac55c);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index a44e126..f776a01 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 _0x5430=['../../components/integrations/configuration','exports','define','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x301c34,_0x15701e){var _0x1a8c5a=function(_0x297b4f){while(--_0x297b4f){_0x301c34['push'](_0x301c34['shift']());}};_0x1a8c5a(++_0x15701e);}(_0x5430,0x10c));var _0x0543=function(_0x33fb8e,_0x5cf33d){_0x33fb8e=_0x33fb8e-0x0;var _0x464146=_0x5430[_0x33fb8e];return _0x464146;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var logger=require(_0x0543('0x2'))(_0x0543('0x3'));var moment=require(_0x0543('0x4'));var BPromise=require(_0x0543('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0543('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x0543('0x7'));module[_0x0543('0x8')]=function(_0x9754ba,_0x319568){return _0x9754ba[_0x0543('0x9')]('FreshsalesAccount',attributes,{'tableName':_0x0543('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7096=['rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','util','api','bluebird','request-promise','path'];(function(_0x503566,_0x394643){var _0x24bd7d=function(_0xcaed6b){while(--_0xcaed6b){_0x503566['push'](_0x503566['shift']());}};_0x24bd7d(++_0x394643);}(_0x7096,0x10c));var _0x6709=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x7096[_0x13e741];return _0x3f8bb3;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var logger=require('../../config/logger')(_0x6709('0x1'));var moment=require('moment');var BPromise=require(_0x6709('0x2'));var rp=require(_0x6709('0x3'));var fs=require('fs');var path=require(_0x6709('0x4'));var rimraf=require(_0x6709('0x5'));var config=require(_0x6709('0x6'));var attributes=require(_0x6709('0x7'));var integrations=require(_0x6709('0x8'));module[_0x6709('0x9')]=function(_0xa35832,_0x3e2223){return _0xa35832[_0x6709('0xa')](_0x6709('0xb'),attributes,{'tableName':_0x6709('0xc'),'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 811ad6f..46aea31 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 _0x0295=['find','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','FreshsalesAccount','findAll','options','raw','where','include','map','model','attributes','GetFreshsalesAccount','ShowFreshsalesAccount'];(function(_0x476705,_0x1bc7b4){var _0x189062=function(_0x2f4324){while(--_0x2f4324){_0x476705['push'](_0x476705['shift']());}};_0x189062(++_0x1bc7b4);}(_0x0295,0x1f0));var _0x5029=function(_0x56eb89,_0xa70f63){_0x56eb89=_0x56eb89-0x0;var _0x237f9d=_0x0295[_0x56eb89];return _0x237f9d;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('FreshsalesAccount,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});}exports['GetFreshsalesAccount']=function(_0x1ed567){var _0x31a155=this;return new Promise(function(_0x35de81,_0x4902f3){return db[_0x5029('0x15')][_0x5029('0x16')]({'raw':_0x1ed567[_0x5029('0x17')]?_0x1ed567['options'][_0x5029('0x18')]===undefined?!![]:![]:!![],'where':_0x1ed567['options']?_0x1ed567[_0x5029('0x17')][_0x5029('0x19')]||null:null,'attributes':_0x1ed567[_0x5029('0x17')]?_0x1ed567[_0x5029('0x17')]['attributes']||null:null,'limit':_0x1ed567['options']?_0x1ed567[_0x5029('0x17')]['limit']||null:null,'include':_0x1ed567[_0x5029('0x17')]?_0x1ed567[_0x5029('0x17')][_0x5029('0x1a')]?_[_0x5029('0x1b')](_0x1ed567[_0x5029('0x17')][_0x5029('0x1a')],function(_0x125c26){return{'model':db[_0x125c26[_0x5029('0x1c')]],'as':_0x125c26['as'],'attributes':_0x125c26[_0x5029('0x1d')],'include':_0x125c26['include']?_['map'](_0x125c26['include'],function(_0x588d90){return{'model':db[_0x588d90[_0x5029('0x1c')]],'as':_0x588d90['as'],'attributes':_0x588d90['attributes'],'include':_0x588d90['include']?_[_0x5029('0x1b')](_0x588d90[_0x5029('0x1a')],function(_0x36d810){return{'model':db[_0x36d810['model']],'as':_0x36d810['as'],'attributes':_0x36d810[_0x5029('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5029('0xa')](function(_0x5e45c4){logger[_0x5029('0xb')](_0x5029('0x1e'),_0x1ed567);logger[_0x5029('0xd')]('GetFreshsalesAccount',_0x1ed567,JSON[_0x5029('0xf')](_0x5e45c4));_0x35de81(_0x5e45c4);})[_0x5029('0x14')](function(_0xe5313e){logger['error'](_0x5029('0x1e'),_0xe5313e[_0x5029('0x12')],_0x1ed567);_0x4902f3(_0x31a155['error'](0x1f4,_0xe5313e[_0x5029('0x12')]));});});};exports[_0x5029('0x1f')]=function(_0x4434ff){var _0x1c3dd9=this;return new Promise(function(_0x196830,_0x2a1ed6){return db[_0x5029('0x15')][_0x5029('0x20')]({'raw':_0x4434ff[_0x5029('0x17')]?_0x4434ff[_0x5029('0x17')][_0x5029('0x18')]===undefined?!![]:![]:!![],'where':_0x4434ff[_0x5029('0x17')]?_0x4434ff['options'][_0x5029('0x19')]||null:null,'attributes':_0x4434ff['options']?_0x4434ff[_0x5029('0x17')]['attributes']||null:null,'include':_0x4434ff['options']?_0x4434ff[_0x5029('0x17')][_0x5029('0x1a')]?_[_0x5029('0x1b')](_0x4434ff['options'][_0x5029('0x1a')],function(_0x15d882){return{'model':db[_0x15d882[_0x5029('0x1c')]],'as':_0x15d882['as'],'attributes':_0x15d882[_0x5029('0x1d')],'include':_0x15d882[_0x5029('0x1a')]?_[_0x5029('0x1b')](_0x15d882[_0x5029('0x1a')],function(_0x22205e){return{'model':db[_0x22205e[_0x5029('0x1c')]],'as':_0x22205e['as'],'attributes':_0x22205e['attributes'],'include':_0x22205e[_0x5029('0x1a')]?_[_0x5029('0x1b')](_0x22205e[_0x5029('0x1a')],function(_0x1b3817){return{'model':db[_0x1b3817['model']],'as':_0x1b3817['as'],'attributes':_0x1b3817[_0x5029('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5029('0xa')](function(_0x3e2d88){logger['info']('ShowFreshsalesAccount',_0x4434ff);logger[_0x5029('0xd')](_0x5029('0x1f'),_0x4434ff,JSON['stringify'](_0x3e2d88));_0x196830(_0x3e2d88);})['catch'](function(_0x9656f2){logger[_0x5029('0x10')](_0x5029('0x1f'),_0x9656f2[_0x5029('0x12')],_0x4434ff);_0x2a1ed6(_0x1c3dd9[_0x5029('0x10')](0x1f4,_0x9656f2[_0x5029('0x12')]));});});}; \ No newline at end of file +var _0x781d=['model','map','GetFreshsalesAccount','find','ShowFreshsalesAccount','stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','FreshsalesAccount','findAll','options','where','attributes','limit','include'];(function(_0x500785,_0x15e5ff){var _0x1f8bcc=function(_0x406983){while(--_0x406983){_0x500785['push'](_0x500785['shift']());}};_0x1f8bcc(++_0x15e5ff);}(_0x781d,0x14a));var _0xd781=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x781d[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd781('0x2'));var fs=require('fs');var Redis=require(_0xd781('0x3'));var db=require(_0xd781('0x4'))['db'];var utils=require(_0xd781('0x5'));var logger=require(_0xd781('0x6'))(_0xd781('0x7'));var config=require(_0xd781('0x8'));var jayson=require(_0xd781('0x9'));var client=jayson[_0xd781('0xa')][_0xd781('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a07f0,_0x133509,_0x1a242d){return new BPromise(function(_0x50610d,_0x248172){return client['request'](_0x5a07f0,_0x1a242d)[_0xd781('0xc')](function(_0x5c18c8){logger[_0xd781('0xd')](_0xd781('0xe'),_0x133509,'request\x20sent');logger[_0xd781('0xf')](_0xd781('0x10'),_0x133509,'request\x20sent',JSON['stringify'](_0x5c18c8));if(_0x5c18c8[_0xd781('0x11')]){if(_0x5c18c8[_0xd781('0x11')][_0xd781('0x12')]===0x1f4){logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x5c18c8[_0xd781('0x11')][_0xd781('0x13')]);return _0x248172(_0x5c18c8[_0xd781('0x11')][_0xd781('0x13')]);}logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x5c18c8['error'][_0xd781('0x13')]);return _0x50610d(_0x5c18c8[_0xd781('0x11')]['message']);}else{logger[_0xd781('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x133509,_0xd781('0x14'));_0x50610d(_0x5c18c8[_0xd781('0x15')][_0xd781('0x13')]);}})[_0xd781('0x16')](function(_0x42a9c1){logger[_0xd781('0x11')](_0xd781('0xe'),_0x133509,_0x42a9c1);_0x248172(_0x42a9c1);});});}exports['GetFreshsalesAccount']=function(_0x1407fc){var _0x3f2922=this;return new Promise(function(_0x395d9c,_0x2f1273){return db[_0xd781('0x17')][_0xd781('0x18')]({'raw':_0x1407fc[_0xd781('0x19')]?_0x1407fc[_0xd781('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1407fc[_0xd781('0x19')]?_0x1407fc[_0xd781('0x19')][_0xd781('0x1a')]||null:null,'attributes':_0x1407fc[_0xd781('0x19')]?_0x1407fc[_0xd781('0x19')][_0xd781('0x1b')]||null:null,'limit':_0x1407fc[_0xd781('0x19')]?_0x1407fc['options'][_0xd781('0x1c')]||null:null,'include':_0x1407fc['options']?_0x1407fc['options'][_0xd781('0x1d')]?_['map'](_0x1407fc[_0xd781('0x19')][_0xd781('0x1d')],function(_0x395087){return{'model':db[_0x395087[_0xd781('0x1e')]],'as':_0x395087['as'],'attributes':_0x395087[_0xd781('0x1b')],'include':_0x395087[_0xd781('0x1d')]?_[_0xd781('0x1f')](_0x395087[_0xd781('0x1d')],function(_0x10940b){return{'model':db[_0x10940b['model']],'as':_0x10940b['as'],'attributes':_0x10940b['attributes'],'include':_0x10940b[_0xd781('0x1d')]?_[_0xd781('0x1f')](_0x10940b[_0xd781('0x1d')],function(_0x57b41e){return{'model':db[_0x57b41e[_0xd781('0x1e')]],'as':_0x57b41e['as'],'attributes':_0x57b41e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1e29c8){logger['info'](_0xd781('0x20'),_0x1407fc);logger[_0xd781('0xf')]('GetFreshsalesAccount',_0x1407fc,JSON['stringify'](_0x1e29c8));_0x395d9c(_0x1e29c8);})[_0xd781('0x16')](function(_0x5b0464){logger[_0xd781('0x11')]('GetFreshsalesAccount',_0x5b0464[_0xd781('0x13')],_0x1407fc);_0x2f1273(_0x3f2922[_0xd781('0x11')](0x1f4,_0x5b0464['message']));});});};exports['ShowFreshsalesAccount']=function(_0x432d14){var _0x29e81a=this;return new Promise(function(_0x1c7d83,_0x5a389c){return db['FreshsalesAccount'][_0xd781('0x21')]({'raw':_0x432d14[_0xd781('0x19')]?_0x432d14[_0xd781('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x432d14['options']?_0x432d14[_0xd781('0x19')][_0xd781('0x1a')]||null:null,'attributes':_0x432d14['options']?_0x432d14[_0xd781('0x19')][_0xd781('0x1b')]||null:null,'include':_0x432d14['options']?_0x432d14[_0xd781('0x19')][_0xd781('0x1d')]?_[_0xd781('0x1f')](_0x432d14[_0xd781('0x19')]['include'],function(_0x23dffb){return{'model':db[_0x23dffb[_0xd781('0x1e')]],'as':_0x23dffb['as'],'attributes':_0x23dffb[_0xd781('0x1b')],'include':_0x23dffb[_0xd781('0x1d')]?_['map'](_0x23dffb[_0xd781('0x1d')],function(_0x3f20e2){return{'model':db[_0x3f20e2['model']],'as':_0x3f20e2['as'],'attributes':_0x3f20e2[_0xd781('0x1b')],'include':_0x3f20e2['include']?_[_0xd781('0x1f')](_0x3f20e2[_0xd781('0x1d')],function(_0x57fdb6){return{'model':db[_0x57fdb6[_0xd781('0x1e')]],'as':_0x57fdb6['as'],'attributes':_0x57fdb6[_0xd781('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a29b7){logger['info'](_0xd781('0x22'),_0x432d14);logger[_0xd781('0xf')]('ShowFreshsalesAccount',_0x432d14,JSON[_0xd781('0x23')](_0x2a29b7));_0x1c7d83(_0x2a29b7);})[_0xd781('0x16')](function(_0x5651de){logger[_0xd781('0x11')](_0xd781('0x22'),_0x5651de[_0xd781('0x13')],_0x432d14);_0x5a389c(_0x29e81a['error'](0x1f4,_0x5651de[_0xd781('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 1499984..e22a650 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 _0x6881=['/:id/subjects','getSubjects','/:id/fields','getFields','put','update','destroy','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show'];(function(_0x467cb0,_0x303070){var _0x2153f7=function(_0x51775a){while(--_0x51775a){_0x467cb0['push'](_0x467cb0['shift']());}};_0x2153f7(++_0x303070);}(_0x6881,0xd8));var _0x1688=function(_0x23f8d3,_0x5408a4){_0x23f8d3=_0x23f8d3-0x0;var _0x45456d=_0x6881[_0x23f8d3];return _0x45456d;};'use strict';var multer=require('multer');var util=require(_0x1688('0x0'));var path=require(_0x1688('0x1'));var timeout=require(_0x1688('0x2'));var express=require('express');var router=express[_0x1688('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1688('0x4'));var config=require(_0x1688('0x5'));var controller=require(_0x1688('0x6'));router[_0x1688('0x7')]('/',auth[_0x1688('0x8')](),controller[_0x1688('0x9')]);router[_0x1688('0x7')](_0x1688('0xa'),auth[_0x1688('0x8')](),controller[_0x1688('0xb')]);router['get'](_0x1688('0xc'),auth[_0x1688('0x8')](),controller[_0x1688('0xd')]);router['get']('/:id/descriptions',auth[_0x1688('0x8')](),controller['getDescriptions']);router[_0x1688('0x7')](_0x1688('0xe'),auth[_0x1688('0x8')](),controller[_0x1688('0xf')]);router['post']('/',auth[_0x1688('0x8')](),controller['create']);router[_0x1688('0x10')]('/:id',auth[_0x1688('0x8')](),controller[_0x1688('0x11')]);router['delete'](_0x1688('0xa'),auth[_0x1688('0x8')](),controller[_0x1688('0x12')]);module['exports']=router; \ No newline at end of file +var _0x9cc4=['getFields','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','index','/:id','/:id/subjects','/:id/descriptions','isAuthenticated','getDescriptions','/:id/fields'];(function(_0x9fb081,_0x48f480){var _0x43f8b0=function(_0x418570){while(--_0x418570){_0x9fb081['push'](_0x9fb081['shift']());}};_0x43f8b0(++_0x48f480);}(_0x9cc4,0x126));var _0x49cc=function(_0x319f7a,_0x2dd107){_0x319f7a=_0x319f7a-0x0;var _0x55839e=_0x9cc4[_0x319f7a];return _0x55839e;};'use strict';var multer=require(_0x49cc('0x0'));var util=require(_0x49cc('0x1'));var path=require('path');var timeout=require(_0x49cc('0x2'));var express=require(_0x49cc('0x3'));var router=express[_0x49cc('0x4')]();var fs_extra=require(_0x49cc('0x5'));var auth=require(_0x49cc('0x6'));var interaction=require(_0x49cc('0x7'));var config=require(_0x49cc('0x8'));var controller=require(_0x49cc('0x9'));router[_0x49cc('0xa')]('/',auth['isAuthenticated'](),controller[_0x49cc('0xb')]);router[_0x49cc('0xa')](_0x49cc('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x49cc('0xa')](_0x49cc('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x49cc('0xa')](_0x49cc('0xe'),auth[_0x49cc('0xf')](),controller[_0x49cc('0x10')]);router[_0x49cc('0xa')](_0x49cc('0x11'),auth[_0x49cc('0xf')](),controller[_0x49cc('0x12')]);router[_0x49cc('0x13')]('/',auth[_0x49cc('0xf')](),controller[_0x49cc('0x14')]);router[_0x49cc('0x15')](_0x49cc('0xc'),auth['isAuthenticated'](),controller[_0x49cc('0x16')]);router[_0x49cc('0x17')](_0x49cc('0xc'),auth[_0x49cc('0xf')](),controller[_0x49cc('0x18')]);module[_0x49cc('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index adfa87b..0c03a5d 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 _0xc147=['STRING','exports'];(function(_0x40670e,_0x269e03){var _0x410f4d=function(_0x179a79){while(--_0x179a79){_0x40670e['push'](_0x40670e['shift']());}};_0x410f4d(++_0x269e03);}(_0xc147,0x133));var _0x7c14=function(_0x2a5052,_0x9f5550){_0x2a5052=_0x2a5052-0x0;var _0x545e9d=_0xc147[_0x2a5052];return _0x545e9d;};'use strict';var Sequelize=require('sequelize');module[_0x7c14('0x0')]={'name':{'type':Sequelize[_0x7c14('0x1')]},'description':{'type':Sequelize[_0x7c14('0x1')]}}; \ No newline at end of file +var _0x0f93=['sequelize','exports','STRING'];(function(_0x5724cd,_0x30ecd8){var _0x4ac317=function(_0x316b14){while(--_0x316b14){_0x5724cd['push'](_0x5724cd['shift']());}};_0x4ac317(++_0x30ecd8);}(_0x0f93,0x117));var _0x30f9=function(_0x285fe3,_0x147a1e){_0x285fe3=_0x285fe3-0x0;var _0x588ba8=_0x0f93[_0x285fe3];return _0x588ba8;};'use strict';var Sequelize=require(_0x30f9('0x0'));module[_0x30f9('0x1')]={'name':{'type':Sequelize[_0x30f9('0x2')]},'description':{'type':Sequelize[_0x30f9('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 9940b64..b6cf738 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 _0x15a2=['attributes','intersection','model','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','catch','create','body','update','find','getSubjects','FreshsalesField','hasOwnProperty','getDescriptions','findOne','getFields','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','reject','save','then','destroy','error','stack','name','index','map','FreshsalesConfiguration','fieldName','key','query','keys'];(function(_0x24de9f,_0x228cac){var _0x1de54b=function(_0x1e92c9){while(--_0x1e92c9){_0x24de9f['push'](_0x24de9f['shift']());}};_0x1de54b(++_0x228cac);}(_0x15a2,0xc2));var _0x215a=function(_0x168114,_0x54c2d9){_0x168114=_0x168114-0x0;var _0x21d911=_0x15a2[_0x168114];return _0x21d911;};'use strict';var emlformat=require(_0x215a('0x0'));var rimraf=require(_0x215a('0x1'));var zipdir=require(_0x215a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x215a('0x3'));var moment=require(_0x215a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x215a('0x5'));var util=require(_0x215a('0x6'));var path=require(_0x215a('0x7'));var sox=require(_0x215a('0x8'));var csv=require(_0x215a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x215a('0xa'));var _=require(_0x215a('0xb'));var squel=require(_0x215a('0xc'));var crypto=require(_0x215a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x215a('0xe'));var toCsv=require(_0x215a('0x9'));var querystring=require('querystring');var Papa=require(_0x215a('0xf'));var Redis=require(_0x215a('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x215a('0x11'));var hardwareService=require(_0x215a('0x12'));var logger=require(_0x215a('0x13'))(_0x215a('0x14'));var utils=require(_0x215a('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c6714,_0x5d045f){_0x5d045f=_0x5d045f||0xcc;return function(_0x3402a6){if(_0x3402a6){return _0x3c6714[_0x215a('0x16')](_0x5d045f);}return _0x3c6714[_0x215a('0x17')](_0x5d045f)[_0x215a('0x18')]();};}function respondWithResult(_0x2bed0c,_0x166b49){_0x166b49=_0x166b49||0xc8;return function(_0x1f9055){if(_0x1f9055){return _0x2bed0c[_0x215a('0x17')](_0x166b49)[_0x215a('0x19')](_0x1f9055);}};}function respondWithFilteredResult(_0x3594b4,_0x50f22d){return function(_0x5c5326){if(_0x5c5326){var _0x4c76c7=typeof _0x50f22d['offset']===_0x215a('0x1a')&&typeof _0x50f22d['limit']===_0x215a('0x1a');var _0x35b91e=_0x5c5326[_0x215a('0x1b')];var _0x18a46c=_0x4c76c7?0x0:_0x50f22d[_0x215a('0x1c')];var _0x3d1adb=_0x4c76c7?_0x5c5326[_0x215a('0x1b')]:_0x50f22d[_0x215a('0x1c')]+_0x50f22d[_0x215a('0x1d')];var _0x43cac2;if(_0x3d1adb>=_0x35b91e){_0x3d1adb=_0x35b91e;_0x43cac2=0xc8;}else{_0x43cac2=0xce;}_0x3594b4['status'](_0x43cac2);return _0x3594b4[_0x215a('0x1e')]('Content-Range',_0x18a46c+'-'+_0x3d1adb+'/'+_0x35b91e)[_0x215a('0x19')](_0x5c5326);}return null;};}function patchUpdates(_0xa82f79){return function(_0x239e9b){try{jsonpatch[_0x215a('0x1f')](_0x239e9b,_0xa82f79,!![]);}catch(_0x4f87a7){return BPromise[_0x215a('0x20')](_0x4f87a7);}return _0x239e9b[_0x215a('0x21')]();};}function saveUpdates(_0x18b4a1,_0x11140c){return function(_0x340968){if(_0x340968){return _0x340968['update'](_0x18b4a1)[_0x215a('0x22')](function(_0x24251c){return _0x24251c;});}return null;};}function removeEntity(_0x10dbfa,_0x3eb50d){return function(_0x1520d5){if(_0x1520d5){return _0x1520d5[_0x215a('0x23')]()[_0x215a('0x22')](function(){_0x10dbfa[_0x215a('0x17')](0xcc)[_0x215a('0x18')]();});}};}function handleEntityNotFound(_0x4caa06,_0x334860){return function(_0x2e70ad){if(!_0x2e70ad){_0x4caa06[_0x215a('0x16')](0x194);}return _0x2e70ad;};}function handleError(_0xde4b4e,_0x494300){_0x494300=_0x494300||0x1f4;return function(_0x1ec27b){logger[_0x215a('0x24')](_0x1ec27b[_0x215a('0x25')]);if(_0x1ec27b[_0x215a('0x26')]){delete _0x1ec27b[_0x215a('0x26')];}_0xde4b4e[_0x215a('0x17')](_0x494300)['send'](_0x1ec27b);};}exports[_0x215a('0x27')]=function(_0x367d18,_0x2703d9){var _0x12746c={},_0x37c073={},_0x53caac={'count':0x0,'rows':[]};var _0x229753=_[_0x215a('0x28')](db[_0x215a('0x29')]['rawAttributes'],function(_0x3795fe){return{'name':_0x3795fe[_0x215a('0x2a')],'type':_0x3795fe['type'][_0x215a('0x2b')]};});_0x37c073['model']=_['map'](_0x229753,_0x215a('0x26'));_0x37c073[_0x215a('0x2c')]=_[_0x215a('0x2d')](_0x367d18['query']);_0x37c073['filters']=_['intersection'](_0x37c073['model'],_0x37c073[_0x215a('0x2c')]);_0x12746c[_0x215a('0x2e')]=_[_0x215a('0x2f')](_0x37c073[_0x215a('0x30')],qs[_0x215a('0x31')](_0x367d18['query'][_0x215a('0x31')]));_0x12746c[_0x215a('0x2e')]=_0x12746c[_0x215a('0x2e')][_0x215a('0x32')]?_0x12746c[_0x215a('0x2e')]:_0x37c073[_0x215a('0x30')];if(!_0x367d18['query']['hasOwnProperty'](_0x215a('0x33'))){_0x12746c[_0x215a('0x1d')]=qs[_0x215a('0x1d')](_0x367d18[_0x215a('0x2c')][_0x215a('0x1d')]);_0x12746c[_0x215a('0x1c')]=qs[_0x215a('0x1c')](_0x367d18['query'][_0x215a('0x1c')]);}_0x12746c[_0x215a('0x34')]=qs[_0x215a('0x35')](_0x367d18[_0x215a('0x2c')][_0x215a('0x35')]);_0x12746c[_0x215a('0x36')]=qs[_0x215a('0x37')](_[_0x215a('0x38')](_0x367d18[_0x215a('0x2c')],_0x37c073[_0x215a('0x37')]),_0x229753);if(_0x367d18[_0x215a('0x2c')][_0x215a('0x39')]){_0x12746c['where']=_[_0x215a('0x3a')](_0x12746c[_0x215a('0x36')],{'$or':_['map'](_0x229753,function(_0x4b59da){if(_0x4b59da[_0x215a('0x3b')]!==_0x215a('0x3c')){var _0x1e08d5={};_0x1e08d5[_0x4b59da[_0x215a('0x26')]]={'$like':'%'+_0x367d18[_0x215a('0x2c')][_0x215a('0x39')]+'%'};return _0x1e08d5;}})});}_0x12746c=_['merge']({},_0x12746c,_0x367d18[_0x215a('0x3d')]);var _0x174232={'where':_0x12746c[_0x215a('0x36')]};return db[_0x215a('0x29')][_0x215a('0x1b')](_0x174232)[_0x215a('0x22')](function(_0x99a416){_0x53caac[_0x215a('0x1b')]=_0x99a416;if(_0x367d18['query']['includeAll']){_0x12746c[_0x215a('0x3e')]=[{'all':!![]}];}return db[_0x215a('0x29')][_0x215a('0x3f')](_0x12746c);})[_0x215a('0x22')](function(_0x44d669){_0x53caac[_0x215a('0x40')]=_0x44d669;return _0x53caac;})['then'](respondWithFilteredResult(_0x2703d9,_0x12746c))['catch'](handleError(_0x2703d9,null));};exports[_0x215a('0x41')]=function(_0x2f86c7,_0x578246){var _0xa96e38={'raw':![],'where':{'id':_0x2f86c7[_0x215a('0x42')]['id']}},_0x4cbf87={};_0x4cbf87[_0x215a('0x30')]=_[_0x215a('0x2d')](db['FreshsalesConfiguration'][_0x215a('0x43')]);_0x4cbf87[_0x215a('0x2c')]=_[_0x215a('0x2d')](_0x2f86c7[_0x215a('0x2c')]);_0x4cbf87['filters']=_[_0x215a('0x2f')](_0x4cbf87[_0x215a('0x30')],_0x4cbf87[_0x215a('0x2c')]);_0xa96e38[_0x215a('0x2e')]=_[_0x215a('0x2f')](_0x4cbf87[_0x215a('0x30')],qs['fields'](_0x2f86c7['query'][_0x215a('0x31')]));_0xa96e38[_0x215a('0x2e')]=_0xa96e38['attributes']['length']?_0xa96e38[_0x215a('0x2e')]:_0x4cbf87[_0x215a('0x30')];if(_0x2f86c7['query'][_0x215a('0x44')]){_0xa96e38[_0x215a('0x3e')]=[{'all':!![]}];}_0xa96e38=_[_0x215a('0x3a')]({},_0xa96e38,_0x2f86c7[_0x215a('0x3d')]);return db[_0x215a('0x29')]['find'](_0xa96e38)['then'](handleEntityNotFound(_0x578246,null))[_0x215a('0x22')](respondWithResult(_0x578246,null))[_0x215a('0x45')](handleError(_0x578246,null));};exports[_0x215a('0x46')]=function(_0x59b44d,_0x10de58){return db['FreshsalesConfiguration'][_0x215a('0x46')](_0x59b44d[_0x215a('0x47')],{})[_0x215a('0x22')](respondWithResult(_0x10de58,0xc9))['catch'](handleError(_0x10de58,null));};exports[_0x215a('0x48')]=function(_0x35a412,_0x281938){if(_0x35a412['body']['id']){delete _0x35a412[_0x215a('0x47')]['id'];}return db[_0x215a('0x29')][_0x215a('0x49')]({'where':{'id':_0x35a412['params']['id']}})[_0x215a('0x22')](handleEntityNotFound(_0x281938,null))[_0x215a('0x22')](saveUpdates(_0x35a412['body'],null))[_0x215a('0x22')](respondWithResult(_0x281938,null))[_0x215a('0x45')](handleError(_0x281938,null));};exports[_0x215a('0x23')]=function(_0xf456a7,_0x2d38e0){return db['FreshsalesConfiguration'][_0x215a('0x49')]({'where':{'id':_0xf456a7[_0x215a('0x42')]['id']}})['then'](handleEntityNotFound(_0x2d38e0,null))[_0x215a('0x22')](removeEntity(_0x2d38e0,null))[_0x215a('0x45')](handleError(_0x2d38e0,null));};exports[_0x215a('0x4a')]=function(_0x43031d,_0x15a162,_0x3a9f66){var _0x58a957={};var _0x2187fd={};var _0xc257;var _0x4e2d11;return db[_0x215a('0x29')]['findOne']({'where':{'id':_0x43031d[_0x215a('0x42')]['id']}})[_0x215a('0x22')](handleEntityNotFound(_0x15a162,null))['then'](function(_0x178e49){if(_0x178e49){_0xc257=_0x178e49;_0x2187fd[_0x215a('0x30')]=_[_0x215a('0x2d')](db[_0x215a('0x4b')][_0x215a('0x43')]);_0x2187fd[_0x215a('0x2c')]=_[_0x215a('0x2d')](_0x43031d[_0x215a('0x2c')]);_0x2187fd['filters']=_[_0x215a('0x2f')](_0x2187fd[_0x215a('0x30')],_0x2187fd[_0x215a('0x2c')]);_0x58a957[_0x215a('0x2e')]=_[_0x215a('0x2f')](_0x2187fd['model'],qs[_0x215a('0x31')](_0x43031d[_0x215a('0x2c')][_0x215a('0x31')]));_0x58a957[_0x215a('0x2e')]=_0x58a957['attributes'][_0x215a('0x32')]?_0x58a957[_0x215a('0x2e')]:_0x2187fd[_0x215a('0x30')];_0x58a957['order']=qs[_0x215a('0x35')](_0x43031d[_0x215a('0x2c')]['sort']);_0x58a957[_0x215a('0x36')]=qs['filters'](_[_0x215a('0x38')](_0x43031d[_0x215a('0x2c')],_0x2187fd[_0x215a('0x37')]));if(_0x43031d[_0x215a('0x2c')]['filter']){_0x58a957['where']=_['merge'](_0x58a957[_0x215a('0x36')],{'$or':_[_0x215a('0x28')](_0x58a957[_0x215a('0x2e')],function(_0x504d01){var _0x1f8da7={};_0x1f8da7[_0x504d01]={'$like':'%'+_0x43031d[_0x215a('0x2c')][_0x215a('0x39')]+'%'};return _0x1f8da7;})});}_0x58a957=_[_0x215a('0x3a')]({},_0x58a957,_0x43031d[_0x215a('0x3d')]);return _0xc257[_0x215a('0x4a')](_0x58a957);}})[_0x215a('0x22')](function(_0xb07c19){if(_0xb07c19){_0x4e2d11=_0xb07c19[_0x215a('0x32')];if(!_0x43031d[_0x215a('0x2c')][_0x215a('0x4c')](_0x215a('0x33'))){_0x58a957[_0x215a('0x1d')]=qs[_0x215a('0x1d')](_0x43031d[_0x215a('0x2c')][_0x215a('0x1d')]);_0x58a957[_0x215a('0x1c')]=qs[_0x215a('0x1c')](_0x43031d[_0x215a('0x2c')][_0x215a('0x1c')]);}return _0xc257['getSubjects'](_0x58a957);}})[_0x215a('0x22')](function(_0x347762){if(_0x347762){return _0x347762?{'count':_0x4e2d11,'rows':_0x347762}:null;}})[_0x215a('0x22')](respondWithResult(_0x15a162,null))['catch'](handleError(_0x15a162,null));};exports['getDescriptions']=function(_0x5a6f19,_0xa663a9,_0x444337){var _0x425753={};var _0x52e7f5={};var _0x2eaeee;var _0x3f49b1;return db[_0x215a('0x29')]['findOne']({'where':{'id':_0x5a6f19['params']['id']}})[_0x215a('0x22')](handleEntityNotFound(_0xa663a9,null))[_0x215a('0x22')](function(_0x432be){if(_0x432be){_0x2eaeee=_0x432be;_0x52e7f5[_0x215a('0x30')]=_[_0x215a('0x2d')](db[_0x215a('0x4b')]['rawAttributes']);_0x52e7f5[_0x215a('0x2c')]=_[_0x215a('0x2d')](_0x5a6f19[_0x215a('0x2c')]);_0x52e7f5[_0x215a('0x37')]=_[_0x215a('0x2f')](_0x52e7f5[_0x215a('0x30')],_0x52e7f5['query']);_0x425753['attributes']=_[_0x215a('0x2f')](_0x52e7f5[_0x215a('0x30')],qs[_0x215a('0x31')](_0x5a6f19[_0x215a('0x2c')][_0x215a('0x31')]));_0x425753[_0x215a('0x2e')]=_0x425753[_0x215a('0x2e')][_0x215a('0x32')]?_0x425753['attributes']:_0x52e7f5['model'];_0x425753[_0x215a('0x34')]=qs[_0x215a('0x35')](_0x5a6f19[_0x215a('0x2c')][_0x215a('0x35')]);_0x425753[_0x215a('0x36')]=qs['filters'](_['pick'](_0x5a6f19['query'],_0x52e7f5[_0x215a('0x37')]));if(_0x5a6f19['query'][_0x215a('0x39')]){_0x425753[_0x215a('0x36')]=_[_0x215a('0x3a')](_0x425753[_0x215a('0x36')],{'$or':_['map'](_0x425753[_0x215a('0x2e')],function(_0x1e9a71){var _0x5663c7={};_0x5663c7[_0x1e9a71]={'$like':'%'+_0x5a6f19[_0x215a('0x2c')]['filter']+'%'};return _0x5663c7;})});}_0x425753=_[_0x215a('0x3a')]({},_0x425753,_0x5a6f19[_0x215a('0x3d')]);return _0x2eaeee[_0x215a('0x4d')](_0x425753);}})['then'](function(_0x12ba81){if(_0x12ba81){_0x3f49b1=_0x12ba81[_0x215a('0x32')];if(!_0x5a6f19['query'][_0x215a('0x4c')](_0x215a('0x33'))){_0x425753[_0x215a('0x1d')]=qs['limit'](_0x5a6f19[_0x215a('0x2c')][_0x215a('0x1d')]);_0x425753[_0x215a('0x1c')]=qs[_0x215a('0x1c')](_0x5a6f19[_0x215a('0x2c')]['offset']);}return _0x2eaeee['getDescriptions'](_0x425753);}})['then'](function(_0x3b65a0){if(_0x3b65a0){return _0x3b65a0?{'count':_0x3f49b1,'rows':_0x3b65a0}:null;}})[_0x215a('0x22')](respondWithResult(_0xa663a9,null))['catch'](handleError(_0xa663a9,null));};exports['getFields']=function(_0x43c2fe,_0x1b66d4,_0x1adf77){var _0x4e7b89={};var _0x104ccd={};var _0x32093d;var _0x36ba1b;return db[_0x215a('0x29')][_0x215a('0x4e')]({'where':{'id':_0x43c2fe[_0x215a('0x42')]['id']}})[_0x215a('0x22')](handleEntityNotFound(_0x1b66d4,null))[_0x215a('0x22')](function(_0x4543d9){if(_0x4543d9){_0x32093d=_0x4543d9;_0x104ccd[_0x215a('0x30')]=_[_0x215a('0x2d')](db[_0x215a('0x4b')][_0x215a('0x43')]);_0x104ccd['query']=_[_0x215a('0x2d')](_0x43c2fe[_0x215a('0x2c')]);_0x104ccd[_0x215a('0x37')]=_[_0x215a('0x2f')](_0x104ccd[_0x215a('0x30')],_0x104ccd[_0x215a('0x2c')]);_0x4e7b89['attributes']=_[_0x215a('0x2f')](_0x104ccd[_0x215a('0x30')],qs['fields'](_0x43c2fe[_0x215a('0x2c')][_0x215a('0x31')]));_0x4e7b89[_0x215a('0x2e')]=_0x4e7b89['attributes'][_0x215a('0x32')]?_0x4e7b89[_0x215a('0x2e')]:_0x104ccd[_0x215a('0x30')];_0x4e7b89['order']=qs[_0x215a('0x35')](_0x43c2fe[_0x215a('0x2c')]['sort']);_0x4e7b89[_0x215a('0x36')]=qs[_0x215a('0x37')](_[_0x215a('0x38')](_0x43c2fe[_0x215a('0x2c')],_0x104ccd[_0x215a('0x37')]));if(_0x43c2fe[_0x215a('0x2c')][_0x215a('0x39')]){_0x4e7b89[_0x215a('0x36')]=_[_0x215a('0x3a')](_0x4e7b89['where'],{'$or':_[_0x215a('0x28')](_0x4e7b89[_0x215a('0x2e')],function(_0x36f52e){var _0x16e841={};_0x16e841[_0x36f52e]={'$like':'%'+_0x43c2fe[_0x215a('0x2c')][_0x215a('0x39')]+'%'};return _0x16e841;})});}_0x4e7b89=_[_0x215a('0x3a')]({},_0x4e7b89,_0x43c2fe[_0x215a('0x3d')]);return _0x32093d[_0x215a('0x4f')](_0x4e7b89);}})[_0x215a('0x22')](function(_0xbc1a69){if(_0xbc1a69){_0x36ba1b=_0xbc1a69['length'];if(!_0x43c2fe[_0x215a('0x2c')][_0x215a('0x4c')](_0x215a('0x33'))){_0x4e7b89[_0x215a('0x1d')]=qs[_0x215a('0x1d')](_0x43c2fe[_0x215a('0x2c')][_0x215a('0x1d')]);_0x4e7b89['offset']=qs[_0x215a('0x1c')](_0x43c2fe[_0x215a('0x2c')][_0x215a('0x1c')]);}return _0x32093d[_0x215a('0x4f')](_0x4e7b89);}})[_0x215a('0x22')](function(_0x59ecc6){if(_0x59ecc6){return _0x59ecc6?{'count':_0x36ba1b,'rows':_0x59ecc6}:null;}})[_0x215a('0x22')](respondWithResult(_0x1b66d4,null))[_0x215a('0x45')](handleError(_0x1b66d4,null));}; \ No newline at end of file +var _0xd8fb=['undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','FreshsalesConfiguration','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','includeAll','include','findAll','rows','catch','show','params','keys','length','options','find','body','getSubjects','findOne','FreshsalesField','getDescriptions','getFields','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit'];(function(_0x19dcc3,_0x58651a){var _0x24d519=function(_0x2ef672){while(--_0x2ef672){_0x19dcc3['push'](_0x19dcc3['shift']());}};_0x24d519(++_0x58651a);}(_0xd8fb,0x171));var _0xbd8f=function(_0x27f9c9,_0x31ae7c){_0x27f9c9=_0x27f9c9-0x0;var _0x2b1a13=_0xd8fb[_0x27f9c9];return _0x2b1a13;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbd8f('0x0'));var jsonpatch=require(_0xbd8f('0x1'));var rp=require(_0xbd8f('0x2'));var moment=require(_0xbd8f('0x3'));var BPromise=require(_0xbd8f('0x4'));var Mustache=require(_0xbd8f('0x5'));var util=require('util');var path=require(_0xbd8f('0x6'));var sox=require(_0xbd8f('0x7'));var csv=require(_0xbd8f('0x8'));var ejs=require(_0xbd8f('0x9'));var fs=require('fs');var fs_extra=require(_0xbd8f('0xa'));var _=require('lodash');var squel=require(_0xbd8f('0xb'));var crypto=require(_0xbd8f('0xc'));var jsforce=require(_0xbd8f('0xd'));var deskjs=require(_0xbd8f('0xe'));var toCsv=require(_0xbd8f('0x8'));var querystring=require('querystring');var Papa=require(_0xbd8f('0xf'));var Redis=require(_0xbd8f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbd8f('0x11'));var as=require(_0xbd8f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbd8f('0x13'))(_0xbd8f('0x14'));var utils=require(_0xbd8f('0x15'));var config=require(_0xbd8f('0x16'));var licenseUtil=require(_0xbd8f('0x17'));var db=require(_0xbd8f('0x18'))['db'];function respondWithStatusCode(_0x132892,_0x291d4b){_0x291d4b=_0x291d4b||0xcc;return function(_0x3d96fd){if(_0x3d96fd){return _0x132892[_0xbd8f('0x19')](_0x291d4b);}return _0x132892['status'](_0x291d4b)[_0xbd8f('0x1a')]();};}function respondWithResult(_0x2655ab,_0x22259f){_0x22259f=_0x22259f||0xc8;return function(_0x4a8b8c){if(_0x4a8b8c){return _0x2655ab[_0xbd8f('0x1b')](_0x22259f)[_0xbd8f('0x1c')](_0x4a8b8c);}};}function respondWithFilteredResult(_0x3c7c30,_0xb290df){return function(_0x23d510){if(_0x23d510){var _0x2d1ef1=typeof _0xb290df[_0xbd8f('0x1d')]==='undefined'&&typeof _0xb290df[_0xbd8f('0x1e')]===_0xbd8f('0x1f');var _0x5b935b=_0x23d510[_0xbd8f('0x20')];var _0x559bb6=_0x2d1ef1?0x0:_0xb290df[_0xbd8f('0x1d')];var _0x248caa=_0x2d1ef1?_0x23d510['count']:_0xb290df[_0xbd8f('0x1d')]+_0xb290df[_0xbd8f('0x1e')];var _0x358468;if(_0x248caa>=_0x5b935b){_0x248caa=_0x5b935b;_0x358468=0xc8;}else{_0x358468=0xce;}_0x3c7c30[_0xbd8f('0x1b')](_0x358468);return _0x3c7c30[_0xbd8f('0x21')](_0xbd8f('0x22'),_0x559bb6+'-'+_0x248caa+'/'+_0x5b935b)['json'](_0x23d510);}return null;};}function patchUpdates(_0x1b085c){return function(_0x268ee6){try{jsonpatch[_0xbd8f('0x23')](_0x268ee6,_0x1b085c,!![]);}catch(_0x17d94e){return BPromise[_0xbd8f('0x24')](_0x17d94e);}return _0x268ee6[_0xbd8f('0x25')]();};}function saveUpdates(_0x24f9fb,_0x349baf){return function(_0x41cbd5){if(_0x41cbd5){return _0x41cbd5[_0xbd8f('0x26')](_0x24f9fb)[_0xbd8f('0x27')](function(_0x1ce8fe){return _0x1ce8fe;});}return null;};}function removeEntity(_0xc576ea,_0x2b8723){return function(_0x4f8057){if(_0x4f8057){return _0x4f8057[_0xbd8f('0x28')]()[_0xbd8f('0x27')](function(){_0xc576ea[_0xbd8f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f10c8,_0xc6493a){return function(_0x5a3787){if(!_0x5a3787){_0x5f10c8['sendStatus'](0x194);}return _0x5a3787;};}function handleError(_0x42e11c,_0x589b32){_0x589b32=_0x589b32||0x1f4;return function(_0x55779d){logger[_0xbd8f('0x29')](_0x55779d['stack']);if(_0x55779d[_0xbd8f('0x2a')]){delete _0x55779d[_0xbd8f('0x2a')];}_0x42e11c[_0xbd8f('0x1b')](_0x589b32)[_0xbd8f('0x2b')](_0x55779d);};}exports['index']=function(_0x5b90b4,_0x330abc){var _0x88a2f6={},_0x78491d={},_0x1394c2={'count':0x0,'rows':[]};var _0x1e96eb=_[_0xbd8f('0x2c')](db[_0xbd8f('0x2d')][_0xbd8f('0x2e')],function(_0x32a2ea){return{'name':_0x32a2ea[_0xbd8f('0x2f')],'type':_0x32a2ea[_0xbd8f('0x30')]['key']};});_0x78491d[_0xbd8f('0x31')]=_[_0xbd8f('0x2c')](_0x1e96eb,'name');_0x78491d[_0xbd8f('0x32')]=_['keys'](_0x5b90b4['query']);_0x78491d['filters']=_[_0xbd8f('0x33')](_0x78491d['model'],_0x78491d[_0xbd8f('0x32')]);_0x88a2f6[_0xbd8f('0x34')]=_[_0xbd8f('0x33')](_0x78491d[_0xbd8f('0x31')],qs[_0xbd8f('0x35')](_0x5b90b4[_0xbd8f('0x32')][_0xbd8f('0x35')]));_0x88a2f6[_0xbd8f('0x34')]=_0x88a2f6['attributes']['length']?_0x88a2f6[_0xbd8f('0x34')]:_0x78491d[_0xbd8f('0x31')];if(!_0x5b90b4[_0xbd8f('0x32')][_0xbd8f('0x36')](_0xbd8f('0x37'))){_0x88a2f6[_0xbd8f('0x1e')]=qs[_0xbd8f('0x1e')](_0x5b90b4[_0xbd8f('0x32')][_0xbd8f('0x1e')]);_0x88a2f6[_0xbd8f('0x1d')]=qs[_0xbd8f('0x1d')](_0x5b90b4['query'][_0xbd8f('0x1d')]);}_0x88a2f6[_0xbd8f('0x38')]=qs[_0xbd8f('0x39')](_0x5b90b4[_0xbd8f('0x32')]['sort']);_0x88a2f6['where']=qs[_0xbd8f('0x3a')](_[_0xbd8f('0x3b')](_0x5b90b4[_0xbd8f('0x32')],_0x78491d[_0xbd8f('0x3a')]),_0x1e96eb);if(_0x5b90b4[_0xbd8f('0x32')][_0xbd8f('0x3c')]){_0x88a2f6[_0xbd8f('0x3d')]=_['merge'](_0x88a2f6[_0xbd8f('0x3d')],{'$or':_[_0xbd8f('0x2c')](_0x1e96eb,function(_0x3c99dc){if(_0x3c99dc[_0xbd8f('0x30')]!=='VIRTUAL'){var _0x4642ca={};_0x4642ca[_0x3c99dc['name']]={'$like':'%'+_0x5b90b4[_0xbd8f('0x32')]['filter']+'%'};return _0x4642ca;}})});}_0x88a2f6=_[_0xbd8f('0x3e')]({},_0x88a2f6,_0x5b90b4['options']);var _0xf95d44={'where':_0x88a2f6[_0xbd8f('0x3d')]};return db[_0xbd8f('0x2d')]['count'](_0xf95d44)[_0xbd8f('0x27')](function(_0x198dc5){_0x1394c2[_0xbd8f('0x20')]=_0x198dc5;if(_0x5b90b4['query'][_0xbd8f('0x3f')]){_0x88a2f6[_0xbd8f('0x40')]=[{'all':!![]}];}return db[_0xbd8f('0x2d')][_0xbd8f('0x41')](_0x88a2f6);})[_0xbd8f('0x27')](function(_0x2fa467){_0x1394c2[_0xbd8f('0x42')]=_0x2fa467;return _0x1394c2;})[_0xbd8f('0x27')](respondWithFilteredResult(_0x330abc,_0x88a2f6))[_0xbd8f('0x43')](handleError(_0x330abc,null));};exports[_0xbd8f('0x44')]=function(_0x45422e,_0x2c99a4){var _0x35c31e={'raw':![],'where':{'id':_0x45422e[_0xbd8f('0x45')]['id']}},_0x36c4dd={};_0x36c4dd[_0xbd8f('0x31')]=_[_0xbd8f('0x46')](db[_0xbd8f('0x2d')][_0xbd8f('0x2e')]);_0x36c4dd[_0xbd8f('0x32')]=_['keys'](_0x45422e[_0xbd8f('0x32')]);_0x36c4dd[_0xbd8f('0x3a')]=_['intersection'](_0x36c4dd[_0xbd8f('0x31')],_0x36c4dd['query']);_0x35c31e[_0xbd8f('0x34')]=_['intersection'](_0x36c4dd[_0xbd8f('0x31')],qs['fields'](_0x45422e['query'][_0xbd8f('0x35')]));_0x35c31e[_0xbd8f('0x34')]=_0x35c31e['attributes'][_0xbd8f('0x47')]?_0x35c31e[_0xbd8f('0x34')]:_0x36c4dd[_0xbd8f('0x31')];if(_0x45422e[_0xbd8f('0x32')][_0xbd8f('0x3f')]){_0x35c31e[_0xbd8f('0x40')]=[{'all':!![]}];}_0x35c31e=_[_0xbd8f('0x3e')]({},_0x35c31e,_0x45422e[_0xbd8f('0x48')]);return db[_0xbd8f('0x2d')][_0xbd8f('0x49')](_0x35c31e)[_0xbd8f('0x27')](handleEntityNotFound(_0x2c99a4,null))[_0xbd8f('0x27')](respondWithResult(_0x2c99a4,null))['catch'](handleError(_0x2c99a4,null));};exports['create']=function(_0x584831,_0x14e4eb){return db[_0xbd8f('0x2d')]['create'](_0x584831['body'],{})[_0xbd8f('0x27')](respondWithResult(_0x14e4eb,0xc9))[_0xbd8f('0x43')](handleError(_0x14e4eb,null));};exports[_0xbd8f('0x26')]=function(_0x372357,_0x3670b9){if(_0x372357[_0xbd8f('0x4a')]['id']){delete _0x372357['body']['id'];}return db[_0xbd8f('0x2d')][_0xbd8f('0x49')]({'where':{'id':_0x372357['params']['id']}})[_0xbd8f('0x27')](handleEntityNotFound(_0x3670b9,null))[_0xbd8f('0x27')](saveUpdates(_0x372357[_0xbd8f('0x4a')],null))[_0xbd8f('0x27')](respondWithResult(_0x3670b9,null))[_0xbd8f('0x43')](handleError(_0x3670b9,null));};exports['destroy']=function(_0x2dfe15,_0x2f05d8){return db['FreshsalesConfiguration']['find']({'where':{'id':_0x2dfe15['params']['id']}})[_0xbd8f('0x27')](handleEntityNotFound(_0x2f05d8,null))[_0xbd8f('0x27')](removeEntity(_0x2f05d8,null))[_0xbd8f('0x43')](handleError(_0x2f05d8,null));};exports[_0xbd8f('0x4b')]=function(_0x5d7b63,_0x44d7d4,_0x35ec86){var _0x296294={};var _0x2cee62={};var _0x5ccdba;var _0xace15f;return db[_0xbd8f('0x2d')][_0xbd8f('0x4c')]({'where':{'id':_0x5d7b63[_0xbd8f('0x45')]['id']}})[_0xbd8f('0x27')](handleEntityNotFound(_0x44d7d4,null))['then'](function(_0x1e7436){if(_0x1e7436){_0x5ccdba=_0x1e7436;_0x2cee62[_0xbd8f('0x31')]=_['keys'](db[_0xbd8f('0x4d')][_0xbd8f('0x2e')]);_0x2cee62[_0xbd8f('0x32')]=_[_0xbd8f('0x46')](_0x5d7b63[_0xbd8f('0x32')]);_0x2cee62[_0xbd8f('0x3a')]=_['intersection'](_0x2cee62[_0xbd8f('0x31')],_0x2cee62[_0xbd8f('0x32')]);_0x296294[_0xbd8f('0x34')]=_[_0xbd8f('0x33')](_0x2cee62[_0xbd8f('0x31')],qs[_0xbd8f('0x35')](_0x5d7b63['query'][_0xbd8f('0x35')]));_0x296294[_0xbd8f('0x34')]=_0x296294[_0xbd8f('0x34')][_0xbd8f('0x47')]?_0x296294[_0xbd8f('0x34')]:_0x2cee62['model'];_0x296294[_0xbd8f('0x38')]=qs['sort'](_0x5d7b63['query'][_0xbd8f('0x39')]);_0x296294[_0xbd8f('0x3d')]=qs['filters'](_[_0xbd8f('0x3b')](_0x5d7b63[_0xbd8f('0x32')],_0x2cee62[_0xbd8f('0x3a')]));if(_0x5d7b63[_0xbd8f('0x32')][_0xbd8f('0x3c')]){_0x296294[_0xbd8f('0x3d')]=_['merge'](_0x296294[_0xbd8f('0x3d')],{'$or':_['map'](_0x296294['attributes'],function(_0x58ebc0){var _0x4f6e29={};_0x4f6e29[_0x58ebc0]={'$like':'%'+_0x5d7b63[_0xbd8f('0x32')][_0xbd8f('0x3c')]+'%'};return _0x4f6e29;})});}_0x296294=_['merge']({},_0x296294,_0x5d7b63[_0xbd8f('0x48')]);return _0x5ccdba['getSubjects'](_0x296294);}})['then'](function(_0x3bd4e5){if(_0x3bd4e5){_0xace15f=_0x3bd4e5[_0xbd8f('0x47')];if(!_0x5d7b63[_0xbd8f('0x32')][_0xbd8f('0x36')](_0xbd8f('0x37'))){_0x296294[_0xbd8f('0x1e')]=qs[_0xbd8f('0x1e')](_0x5d7b63[_0xbd8f('0x32')][_0xbd8f('0x1e')]);_0x296294['offset']=qs['offset'](_0x5d7b63['query'][_0xbd8f('0x1d')]);}return _0x5ccdba[_0xbd8f('0x4b')](_0x296294);}})[_0xbd8f('0x27')](function(_0x21aec3){if(_0x21aec3){return _0x21aec3?{'count':_0xace15f,'rows':_0x21aec3}:null;}})['then'](respondWithResult(_0x44d7d4,null))[_0xbd8f('0x43')](handleError(_0x44d7d4,null));};exports[_0xbd8f('0x4e')]=function(_0x155078,_0x58f5f3,_0x1a908c){var _0x1cb0d5={};var _0x2fe2be={};var _0x54d60c;var _0x24aa8d;return db[_0xbd8f('0x2d')][_0xbd8f('0x4c')]({'where':{'id':_0x155078['params']['id']}})[_0xbd8f('0x27')](handleEntityNotFound(_0x58f5f3,null))['then'](function(_0x2cb768){if(_0x2cb768){_0x54d60c=_0x2cb768;_0x2fe2be[_0xbd8f('0x31')]=_[_0xbd8f('0x46')](db['FreshsalesField'][_0xbd8f('0x2e')]);_0x2fe2be[_0xbd8f('0x32')]=_[_0xbd8f('0x46')](_0x155078['query']);_0x2fe2be[_0xbd8f('0x3a')]=_[_0xbd8f('0x33')](_0x2fe2be['model'],_0x2fe2be['query']);_0x1cb0d5[_0xbd8f('0x34')]=_['intersection'](_0x2fe2be[_0xbd8f('0x31')],qs[_0xbd8f('0x35')](_0x155078[_0xbd8f('0x32')][_0xbd8f('0x35')]));_0x1cb0d5['attributes']=_0x1cb0d5[_0xbd8f('0x34')]['length']?_0x1cb0d5[_0xbd8f('0x34')]:_0x2fe2be[_0xbd8f('0x31')];_0x1cb0d5[_0xbd8f('0x38')]=qs[_0xbd8f('0x39')](_0x155078[_0xbd8f('0x32')][_0xbd8f('0x39')]);_0x1cb0d5[_0xbd8f('0x3d')]=qs[_0xbd8f('0x3a')](_[_0xbd8f('0x3b')](_0x155078['query'],_0x2fe2be[_0xbd8f('0x3a')]));if(_0x155078[_0xbd8f('0x32')][_0xbd8f('0x3c')]){_0x1cb0d5[_0xbd8f('0x3d')]=_['merge'](_0x1cb0d5[_0xbd8f('0x3d')],{'$or':_[_0xbd8f('0x2c')](_0x1cb0d5[_0xbd8f('0x34')],function(_0x1f6e2e){var _0xae8348={};_0xae8348[_0x1f6e2e]={'$like':'%'+_0x155078[_0xbd8f('0x32')][_0xbd8f('0x3c')]+'%'};return _0xae8348;})});}_0x1cb0d5=_['merge']({},_0x1cb0d5,_0x155078['options']);return _0x54d60c[_0xbd8f('0x4e')](_0x1cb0d5);}})[_0xbd8f('0x27')](function(_0x18c104){if(_0x18c104){_0x24aa8d=_0x18c104[_0xbd8f('0x47')];if(!_0x155078[_0xbd8f('0x32')][_0xbd8f('0x36')]('nolimit')){_0x1cb0d5[_0xbd8f('0x1e')]=qs[_0xbd8f('0x1e')](_0x155078[_0xbd8f('0x32')][_0xbd8f('0x1e')]);_0x1cb0d5[_0xbd8f('0x1d')]=qs[_0xbd8f('0x1d')](_0x155078[_0xbd8f('0x32')][_0xbd8f('0x1d')]);}return _0x54d60c[_0xbd8f('0x4e')](_0x1cb0d5);}})[_0xbd8f('0x27')](function(_0x3c619b){if(_0x3c619b){return _0x3c619b?{'count':_0x24aa8d,'rows':_0x3c619b}:null;}})[_0xbd8f('0x27')](respondWithResult(_0x58f5f3,null))['catch'](handleError(_0x58f5f3,null));};exports[_0xbd8f('0x4f')]=function(_0x312d93,_0x46051a,_0x2a6f97){var _0x974132={};var _0x220616={};var _0x206b53;var _0x49e853;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x312d93[_0xbd8f('0x45')]['id']}})[_0xbd8f('0x27')](handleEntityNotFound(_0x46051a,null))[_0xbd8f('0x27')](function(_0x520116){if(_0x520116){_0x206b53=_0x520116;_0x220616['model']=_[_0xbd8f('0x46')](db[_0xbd8f('0x4d')]['rawAttributes']);_0x220616[_0xbd8f('0x32')]=_[_0xbd8f('0x46')](_0x312d93[_0xbd8f('0x32')]);_0x220616[_0xbd8f('0x3a')]=_[_0xbd8f('0x33')](_0x220616[_0xbd8f('0x31')],_0x220616[_0xbd8f('0x32')]);_0x974132[_0xbd8f('0x34')]=_[_0xbd8f('0x33')](_0x220616[_0xbd8f('0x31')],qs[_0xbd8f('0x35')](_0x312d93[_0xbd8f('0x32')]['fields']));_0x974132[_0xbd8f('0x34')]=_0x974132[_0xbd8f('0x34')]['length']?_0x974132[_0xbd8f('0x34')]:_0x220616['model'];_0x974132[_0xbd8f('0x38')]=qs[_0xbd8f('0x39')](_0x312d93['query'][_0xbd8f('0x39')]);_0x974132[_0xbd8f('0x3d')]=qs[_0xbd8f('0x3a')](_[_0xbd8f('0x3b')](_0x312d93[_0xbd8f('0x32')],_0x220616['filters']));if(_0x312d93['query'][_0xbd8f('0x3c')]){_0x974132[_0xbd8f('0x3d')]=_['merge'](_0x974132['where'],{'$or':_['map'](_0x974132['attributes'],function(_0x5874f9){var _0x2e8fbb={};_0x2e8fbb[_0x5874f9]={'$like':'%'+_0x312d93[_0xbd8f('0x32')]['filter']+'%'};return _0x2e8fbb;})});}_0x974132=_['merge']({},_0x974132,_0x312d93[_0xbd8f('0x48')]);return _0x206b53['getFields'](_0x974132);}})['then'](function(_0x566972){if(_0x566972){_0x49e853=_0x566972[_0xbd8f('0x47')];if(!_0x312d93[_0xbd8f('0x32')][_0xbd8f('0x36')](_0xbd8f('0x37'))){_0x974132['limit']=qs[_0xbd8f('0x1e')](_0x312d93[_0xbd8f('0x32')][_0xbd8f('0x1e')]);_0x974132[_0xbd8f('0x1d')]=qs[_0xbd8f('0x1d')](_0x312d93[_0xbd8f('0x32')]['offset']);}return _0x206b53['getFields'](_0x974132);}})['then'](function(_0xf79e9f){if(_0xf79e9f){return _0xf79e9f?{'count':_0x49e853,'rows':_0xf79e9f}:null;}})[_0xbd8f('0x27')](respondWithResult(_0x46051a,null))[_0xbd8f('0x43')](handleError(_0x46051a,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 5aef791..f1c34d1 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 _0x50d0=['rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x358ee6,_0x5e0a5f){var _0x4e7e89=function(_0x9f3cdd){while(--_0x9f3cdd){_0x358ee6['push'](_0x358ee6['shift']());}};_0x4e7e89(++_0x5e0a5f);}(_0x50d0,0x18e));var _0x050d=function(_0x57ffeb,_0xe1382e){_0x57ffeb=_0x57ffeb-0x0;var _0xd42031=_0x50d0[_0x57ffeb];return _0xd42031;};'use strict';var _=require(_0x050d('0x0'));var util=require(_0x050d('0x1'));var logger=require(_0x050d('0x2'))(_0x050d('0x3'));var moment=require(_0x050d('0x4'));var BPromise=require(_0x050d('0x5'));var rp=require(_0x050d('0x6'));var fs=require('fs');var path=require(_0x050d('0x7'));var rimraf=require(_0x050d('0x8'));var config=require(_0x050d('0x9'));var attributes=require(_0x050d('0xa'));module[_0x050d('0xb')]=function(_0x2de260,_0x16dcbe){return _0x2de260[_0x050d('0xc')](_0x050d('0xd'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd30a=['api','moment','bluebird','request-promise','path','lodash','util','../../config/logger'];(function(_0x154029,_0x377c35){var _0x211022=function(_0xc732b3){while(--_0xc732b3){_0x154029['push'](_0x154029['shift']());}};_0x211022(++_0x377c35);}(_0xd30a,0x1d5));var _0xad30=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xd30a[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0xad30('0x0'));var util=require(_0xad30('0x1'));var logger=require(_0xad30('0x2'))(_0xad30('0x3'));var moment=require(_0xad30('0x4'));var BPromise=require(_0xad30('0x5'));var rp=require(_0xad30('0x6'));var fs=require('fs');var path=require(_0xad30('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0x82ec3d,_0x302c96){return _0x82ec3d['define']('FreshsalesConfiguration',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 9477482..59a8a3f 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 _0xec38=['then','info','FreshsalesConfiguration,\x20%s,\x20%s','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x3c97e3,_0x321677){var _0x9bb0ed=function(_0x3a0cb6){while(--_0x3a0cb6){_0x3c97e3['push'](_0x3c97e3['shift']());}};_0x9bb0ed(++_0x321677);}(_0xec38,0x137));var _0x8ec3=function(_0x42e75c,_0x136223){_0x42e75c=_0x42e75c-0x0;var _0x42b0b8=_0xec38[_0x42e75c];return _0x42b0b8;};'use strict';var _=require(_0x8ec3('0x0'));var util=require(_0x8ec3('0x1'));var moment=require(_0x8ec3('0x2'));var BPromise=require(_0x8ec3('0x3'));var rs=require(_0x8ec3('0x4'));var fs=require('fs');var Redis=require(_0x8ec3('0x5'));var db=require(_0x8ec3('0x6'))['db'];var utils=require(_0x8ec3('0x7'));var logger=require(_0x8ec3('0x8'))(_0x8ec3('0x9'));var config=require(_0x8ec3('0xa'));var jayson=require(_0x8ec3('0xb'));var client=jayson[_0x8ec3('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38d0aa,_0x52be75,_0x30d4ea){return new BPromise(function(_0x4df36a,_0x2b691c){return client[_0x8ec3('0xd')](_0x38d0aa,_0x30d4ea)[_0x8ec3('0xe')](function(_0x432210){logger[_0x8ec3('0xf')](_0x8ec3('0x10'),_0x52be75,'request\x20sent');logger['debug'](_0x8ec3('0x11'),_0x52be75,'request\x20sent',JSON[_0x8ec3('0x12')](_0x432210));if(_0x432210[_0x8ec3('0x13')]){if(_0x432210['error'][_0x8ec3('0x14')]===0x1f4){logger[_0x8ec3('0x13')](_0x8ec3('0x10'),_0x52be75,_0x432210['error']['message']);return _0x2b691c(_0x432210[_0x8ec3('0x13')]['message']);}logger[_0x8ec3('0x13')](_0x8ec3('0x10'),_0x52be75,_0x432210[_0x8ec3('0x13')][_0x8ec3('0x15')]);return _0x4df36a(_0x432210[_0x8ec3('0x13')][_0x8ec3('0x15')]);}else{logger['info'](_0x8ec3('0x10'),_0x52be75,_0x8ec3('0x16'));_0x4df36a(_0x432210[_0x8ec3('0x17')][_0x8ec3('0x15')]);}})[_0x8ec3('0x18')](function(_0x362688){logger[_0x8ec3('0x13')](_0x8ec3('0x10'),_0x52be75,_0x362688);_0x2b691c(_0x362688);});});} \ No newline at end of file +var _0xb397=['FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x459423,_0x3416a8){var _0x42ed14=function(_0x1d4f69){while(--_0x1d4f69){_0x459423['push'](_0x459423['shift']());}};_0x42ed14(++_0x3416a8);}(_0xb397,0xc0));var _0x7b39=function(_0x3a7313,_0x1ea6ac){_0x3a7313=_0x3a7313-0x0;var _0x4153c2=_0xb397[_0x3a7313];return _0x4153c2;};'use strict';var _=require(_0x7b39('0x0'));var util=require(_0x7b39('0x1'));var moment=require(_0x7b39('0x2'));var BPromise=require(_0x7b39('0x3'));var rs=require(_0x7b39('0x4'));var fs=require('fs');var Redis=require(_0x7b39('0x5'));var db=require(_0x7b39('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b39('0x7'))(_0x7b39('0x8'));var config=require(_0x7b39('0x9'));var jayson=require(_0x7b39('0xa'));var client=jayson[_0x7b39('0xb')][_0x7b39('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x75126b,_0x2e6e4d,_0x131af8){return new BPromise(function(_0x538a26,_0x45328a){return client[_0x7b39('0xd')](_0x75126b,_0x131af8)['then'](function(_0x4c9dac){logger[_0x7b39('0xe')](_0x7b39('0xf'),_0x2e6e4d,_0x7b39('0x10'));logger[_0x7b39('0x11')](_0x7b39('0x12'),_0x2e6e4d,'request\x20sent',JSON['stringify'](_0x4c9dac));if(_0x4c9dac[_0x7b39('0x13')]){if(_0x4c9dac[_0x7b39('0x13')]['code']===0x1f4){logger[_0x7b39('0x13')](_0x7b39('0xf'),_0x2e6e4d,_0x4c9dac[_0x7b39('0x13')][_0x7b39('0x14')]);return _0x45328a(_0x4c9dac[_0x7b39('0x13')]['message']);}logger[_0x7b39('0x13')](_0x7b39('0xf'),_0x2e6e4d,_0x4c9dac[_0x7b39('0x13')][_0x7b39('0x14')]);return _0x538a26(_0x4c9dac[_0x7b39('0x13')][_0x7b39('0x14')]);}else{logger[_0x7b39('0xe')](_0x7b39('0xf'),_0x2e6e4d,_0x7b39('0x10'));_0x538a26(_0x4c9dac[_0x7b39('0x15')][_0x7b39('0x14')]);}})[_0x7b39('0x16')](function(_0x4f69a0){logger[_0x7b39('0x13')](_0x7b39('0xf'),_0x2e6e4d,_0x4f69a0);_0x45328a(_0x4f69a0);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index d9a0b76..7f5b402 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 _0x057a=['destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','index','get','/:id','isAuthenticated','show','post','create','put','update','delete'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x057a,0x1a6));var _0xa057=function(_0x55c8e6,_0x41fbfa){_0x55c8e6=_0x55c8e6-0x0;var _0x37c08b=_0x057a[_0x55c8e6];return _0x37c08b;};'use strict';var multer=require(_0xa057('0x0'));var util=require(_0xa057('0x1'));var path=require(_0xa057('0x2'));var timeout=require('connect-timeout');var express=require(_0xa057('0x3'));var router=express['Router']();var fs_extra=require(_0xa057('0x4'));var auth=require(_0xa057('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa057('0x6'));var controller=require(_0xa057('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xa057('0x8')]);router[_0xa057('0x9')](_0xa057('0xa'),auth[_0xa057('0xb')](),controller[_0xa057('0xc')]);router[_0xa057('0xd')]('/',auth[_0xa057('0xb')](),controller[_0xa057('0xe')]);router[_0xa057('0xf')](_0xa057('0xa'),auth[_0xa057('0xb')](),controller[_0xa057('0x10')]);router[_0xa057('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xa057('0x12')]);module[_0xa057('0x13')]=router; \ No newline at end of file +var _0xbec5=['/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','index'];(function(_0x376f50,_0x1b6855){var _0x1c5f2e=function(_0x50adf8){while(--_0x50adf8){_0x376f50['push'](_0x376f50['shift']());}};_0x1c5f2e(++_0x1b6855);}(_0xbec5,0xe5));var _0x5bec=function(_0x42bafd,_0x3f0fe3){_0x42bafd=_0x42bafd-0x0;var _0x2ed705=_0xbec5[_0x42bafd];return _0x2ed705;};'use strict';var multer=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var path=require('path');var timeout=require(_0x5bec('0x2'));var express=require(_0x5bec('0x3'));var router=express[_0x5bec('0x4')]();var fs_extra=require(_0x5bec('0x5'));var auth=require(_0x5bec('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5bec('0x7'));var controller=require(_0x5bec('0x8'));router[_0x5bec('0x9')]('/',auth['isAuthenticated'](),controller[_0x5bec('0xa')]);router[_0x5bec('0x9')](_0x5bec('0xb'),auth[_0x5bec('0xc')](),controller[_0x5bec('0xd')]);router[_0x5bec('0xe')]('/',auth[_0x5bec('0xc')](),controller[_0x5bec('0xf')]);router['put'](_0x5bec('0xb'),auth['isAuthenticated'](),controller[_0x5bec('0x10')]);router[_0x5bec('0x11')](_0x5bec('0xb'),auth['isAuthenticated'](),controller[_0x5bec('0x12')]);module[_0x5bec('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 64c3e34..80a38e2 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 _0xa39a=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x122d9f,_0x2c9e5b){var _0x41a09e=function(_0x3d9564){while(--_0x3d9564){_0x122d9f['push'](_0x122d9f['shift']());}};_0x41a09e(++_0x2c9e5b);}(_0xa39a,0x156));var _0xaa39=function(_0xdf6d69,_0x24994f){_0xdf6d69=_0xdf6d69-0x0;var _0x4e5d80=_0xa39a[_0xdf6d69];return _0x4e5d80;};'use strict';var Sequelize=require(_0xaa39('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xaa39('0x1'),_0xaa39('0x2'),_0xaa39('0x3'),_0xaa39('0x4'),'picklist'),'defaultValue':_0xaa39('0x1')},'content':{'type':Sequelize[_0xaa39('0x5')]},'key':{'type':Sequelize[_0xaa39('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xaa39('0x1'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xaa39('0x5')]},'idField':{'type':Sequelize[_0xaa39('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xaa39('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd9b1=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM'];(function(_0x292423,_0x1759b7){var _0x2801cb=function(_0x23c821){while(--_0x23c821){_0x292423['push'](_0x292423['shift']());}};_0x2801cb(++_0x1759b7);}(_0xd9b1,0x1ed));var _0x1d9b=function(_0x273034,_0x44374a){_0x273034=_0x273034-0x0;var _0x4275d1=_0xd9b1[_0x273034];return _0x4275d1;};'use strict';var Sequelize=require('sequelize');module[_0x1d9b('0x0')]={'type':{'type':Sequelize[_0x1d9b('0x1')](_0x1d9b('0x2'),_0x1d9b('0x3'),_0x1d9b('0x4'),_0x1d9b('0x5'),_0x1d9b('0x6')),'defaultValue':_0x1d9b('0x2')},'content':{'type':Sequelize[_0x1d9b('0x7')]},'key':{'type':Sequelize[_0x1d9b('0x7')]},'keyType':{'type':Sequelize[_0x1d9b('0x1')](_0x1d9b('0x2'),_0x1d9b('0x3'),_0x1d9b('0x4'))},'keyContent':{'type':Sequelize[_0x1d9b('0x7')]},'idField':{'type':Sequelize[_0x1d9b('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1d9b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 5e126ae..d1e23e2 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 _0x4fd1=['limit','count','set','Content-Range','apply','reject','save','update','then','status','end','error','stack','name','send','index','map','FreshsalesField','rawAttributes','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','where','merge','type','filter','options','includeAll','show','params','include','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','sendStatus','json','offset','undefined'];(function(_0x40c9ff,_0x4d28fa){var _0x476aff=function(_0x2ab791){while(--_0x2ab791){_0x40c9ff['push'](_0x40c9ff['shift']());}};_0x476aff(++_0x4d28fa);}(_0x4fd1,0x77));var _0x14fd=function(_0x4aab5a,_0x3397e6){_0x4aab5a=_0x4aab5a-0x0;var _0x5c5dc9=_0x4fd1[_0x4aab5a];return _0x5c5dc9;};'use strict';var emlformat=require(_0x14fd('0x0'));var rimraf=require(_0x14fd('0x1'));var zipdir=require(_0x14fd('0x2'));var jsonpatch=require(_0x14fd('0x3'));var rp=require(_0x14fd('0x4'));var moment=require(_0x14fd('0x5'));var BPromise=require(_0x14fd('0x6'));var Mustache=require(_0x14fd('0x7'));var util=require(_0x14fd('0x8'));var path=require(_0x14fd('0x9'));var sox=require(_0x14fd('0xa'));var csv=require(_0x14fd('0xb'));var ejs=require(_0x14fd('0xc'));var fs=require('fs');var fs_extra=require(_0x14fd('0xd'));var _=require(_0x14fd('0xe'));var squel=require(_0x14fd('0xf'));var crypto=require(_0x14fd('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x14fd('0x11'));var toCsv=require(_0x14fd('0xb'));var querystring=require(_0x14fd('0x12'));var Papa=require(_0x14fd('0x13'));var Redis=require(_0x14fd('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x14fd('0x15'));var as=require(_0x14fd('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x14fd('0x17'));var licenseUtil=require(_0x14fd('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bcd1a,_0x33ba43){_0x33ba43=_0x33ba43||0xcc;return function(_0x41bad1){if(_0x41bad1){return _0x4bcd1a[_0x14fd('0x19')](_0x33ba43);}return _0x4bcd1a['status'](_0x33ba43)['end']();};}function respondWithResult(_0x449345,_0x21bd16){_0x21bd16=_0x21bd16||0xc8;return function(_0x204404){if(_0x204404){return _0x449345['status'](_0x21bd16)[_0x14fd('0x1a')](_0x204404);}};}function respondWithFilteredResult(_0x1fe3d7,_0x595859){return function(_0x3d007f){if(_0x3d007f){var _0x1162b4=typeof _0x595859[_0x14fd('0x1b')]===_0x14fd('0x1c')&&typeof _0x595859[_0x14fd('0x1d')]==='undefined';var _0x10cef0=_0x3d007f[_0x14fd('0x1e')];var _0x22d7b0=_0x1162b4?0x0:_0x595859[_0x14fd('0x1b')];var _0x1d7839=_0x1162b4?_0x3d007f[_0x14fd('0x1e')]:_0x595859[_0x14fd('0x1b')]+_0x595859[_0x14fd('0x1d')];var _0x2c4807;if(_0x1d7839>=_0x10cef0){_0x1d7839=_0x10cef0;_0x2c4807=0xc8;}else{_0x2c4807=0xce;}_0x1fe3d7['status'](_0x2c4807);return _0x1fe3d7[_0x14fd('0x1f')](_0x14fd('0x20'),_0x22d7b0+'-'+_0x1d7839+'/'+_0x10cef0)[_0x14fd('0x1a')](_0x3d007f);}return null;};}function patchUpdates(_0x15a2a0){return function(_0x5215d1){try{jsonpatch[_0x14fd('0x21')](_0x5215d1,_0x15a2a0,!![]);}catch(_0x1fe05d){return BPromise[_0x14fd('0x22')](_0x1fe05d);}return _0x5215d1[_0x14fd('0x23')]();};}function saveUpdates(_0x346ccd,_0x49cc92){return function(_0x281def){if(_0x281def){return _0x281def[_0x14fd('0x24')](_0x346ccd)['then'](function(_0x3359d3){return _0x3359d3;});}return null;};}function removeEntity(_0x27dfa8,_0x5377fc){return function(_0x2ae337){if(_0x2ae337){return _0x2ae337['destroy']()[_0x14fd('0x25')](function(){_0x27dfa8[_0x14fd('0x26')](0xcc)[_0x14fd('0x27')]();});}};}function handleEntityNotFound(_0x3eba3f,_0x4347ca){return function(_0x1b1265){if(!_0x1b1265){_0x3eba3f['sendStatus'](0x194);}return _0x1b1265;};}function handleError(_0x49ec58,_0x26a48c){_0x26a48c=_0x26a48c||0x1f4;return function(_0x1db3b9){logger[_0x14fd('0x28')](_0x1db3b9[_0x14fd('0x29')]);if(_0x1db3b9['name']){delete _0x1db3b9[_0x14fd('0x2a')];}_0x49ec58[_0x14fd('0x26')](_0x26a48c)[_0x14fd('0x2b')](_0x1db3b9);};}exports[_0x14fd('0x2c')]=function(_0x497671,_0x44118c){var _0x1b60cc={},_0x476e5f={},_0x52368d={'count':0x0,'rows':[]};var _0x1cfaac=_[_0x14fd('0x2d')](db[_0x14fd('0x2e')][_0x14fd('0x2f')],function(_0x40b209){return{'name':_0x40b209['fieldName'],'type':_0x40b209['type']['key']};});_0x476e5f[_0x14fd('0x30')]=_[_0x14fd('0x2d')](_0x1cfaac,_0x14fd('0x2a'));_0x476e5f[_0x14fd('0x31')]=_[_0x14fd('0x32')](_0x497671[_0x14fd('0x31')]);_0x476e5f['filters']=_[_0x14fd('0x33')](_0x476e5f[_0x14fd('0x30')],_0x476e5f[_0x14fd('0x31')]);_0x1b60cc[_0x14fd('0x34')]=_['intersection'](_0x476e5f[_0x14fd('0x30')],qs[_0x14fd('0x35')](_0x497671[_0x14fd('0x31')][_0x14fd('0x35')]));_0x1b60cc[_0x14fd('0x34')]=_0x1b60cc['attributes'][_0x14fd('0x36')]?_0x1b60cc['attributes']:_0x476e5f[_0x14fd('0x30')];if(!_0x497671['query'][_0x14fd('0x37')]('nolimit')){_0x1b60cc[_0x14fd('0x1d')]=qs[_0x14fd('0x1d')](_0x497671[_0x14fd('0x31')][_0x14fd('0x1d')]);_0x1b60cc[_0x14fd('0x1b')]=qs[_0x14fd('0x1b')](_0x497671['query'][_0x14fd('0x1b')]);}_0x1b60cc[_0x14fd('0x38')]=qs[_0x14fd('0x39')](_0x497671[_0x14fd('0x31')]['sort']);_0x1b60cc['where']=qs[_0x14fd('0x3a')](_[_0x14fd('0x3b')](_0x497671[_0x14fd('0x31')],_0x476e5f[_0x14fd('0x3a')]),_0x1cfaac);if(_0x497671[_0x14fd('0x31')]['filter']){_0x1b60cc[_0x14fd('0x3c')]=_[_0x14fd('0x3d')](_0x1b60cc[_0x14fd('0x3c')],{'$or':_[_0x14fd('0x2d')](_0x1cfaac,function(_0x1c4bb2){if(_0x1c4bb2[_0x14fd('0x3e')]!=='VIRTUAL'){var _0xbfbd0f={};_0xbfbd0f[_0x1c4bb2[_0x14fd('0x2a')]]={'$like':'%'+_0x497671['query'][_0x14fd('0x3f')]+'%'};return _0xbfbd0f;}})});}_0x1b60cc=_['merge']({},_0x1b60cc,_0x497671[_0x14fd('0x40')]);var _0x19c256={'where':_0x1b60cc['where']};return db[_0x14fd('0x2e')][_0x14fd('0x1e')](_0x19c256)[_0x14fd('0x25')](function(_0x35ca15){_0x52368d['count']=_0x35ca15;if(_0x497671[_0x14fd('0x31')][_0x14fd('0x41')]){_0x1b60cc['include']=[{'all':!![]}];}return db[_0x14fd('0x2e')]['findAll'](_0x1b60cc);})['then'](function(_0x4af716){_0x52368d['rows']=_0x4af716;return _0x52368d;})[_0x14fd('0x25')](respondWithFilteredResult(_0x44118c,_0x1b60cc))['catch'](handleError(_0x44118c,null));};exports[_0x14fd('0x42')]=function(_0x359624,_0xdef7f0){var _0x403138={'raw':!![],'where':{'id':_0x359624[_0x14fd('0x43')]['id']}},_0x152a08={};_0x152a08[_0x14fd('0x30')]=_[_0x14fd('0x32')](db[_0x14fd('0x2e')][_0x14fd('0x2f')]);_0x152a08[_0x14fd('0x31')]=_[_0x14fd('0x32')](_0x359624[_0x14fd('0x31')]);_0x152a08['filters']=_[_0x14fd('0x33')](_0x152a08[_0x14fd('0x30')],_0x152a08[_0x14fd('0x31')]);_0x403138[_0x14fd('0x34')]=_[_0x14fd('0x33')](_0x152a08[_0x14fd('0x30')],qs[_0x14fd('0x35')](_0x359624['query'][_0x14fd('0x35')]));_0x403138[_0x14fd('0x34')]=_0x403138[_0x14fd('0x34')]['length']?_0x403138[_0x14fd('0x34')]:_0x152a08[_0x14fd('0x30')];if(_0x359624['query'][_0x14fd('0x41')]){_0x403138[_0x14fd('0x44')]=[{'all':!![]}];}_0x403138=_[_0x14fd('0x3d')]({},_0x403138,_0x359624['options']);return db['FreshsalesField'][_0x14fd('0x45')](_0x403138)[_0x14fd('0x25')](handleEntityNotFound(_0xdef7f0,null))[_0x14fd('0x25')](respondWithResult(_0xdef7f0,null))[_0x14fd('0x46')](handleError(_0xdef7f0,null));};exports[_0x14fd('0x47')]=function(_0x2b7b39,_0x491bea){return db[_0x14fd('0x2e')][_0x14fd('0x47')](_0x2b7b39[_0x14fd('0x48')],{})[_0x14fd('0x25')](respondWithResult(_0x491bea,0xc9))[_0x14fd('0x46')](handleError(_0x491bea,null));};exports['update']=function(_0x33d656,_0x438ee3){if(_0x33d656[_0x14fd('0x48')]['id']){delete _0x33d656[_0x14fd('0x48')]['id'];}return db[_0x14fd('0x2e')][_0x14fd('0x45')]({'where':{'id':_0x33d656[_0x14fd('0x43')]['id']}})[_0x14fd('0x25')](handleEntityNotFound(_0x438ee3,null))[_0x14fd('0x25')](saveUpdates(_0x33d656[_0x14fd('0x48')],null))[_0x14fd('0x25')](respondWithResult(_0x438ee3,null))[_0x14fd('0x46')](handleError(_0x438ee3,null));};exports[_0x14fd('0x49')]=function(_0x353221,_0x23783e){return db['FreshsalesField']['find']({'where':{'id':_0x353221['params']['id']}})['then'](handleEntityNotFound(_0x23783e,null))[_0x14fd('0x25')](removeEntity(_0x23783e,null))['catch'](handleError(_0x23783e,null));}; \ No newline at end of file +var _0x0d7e=['mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','limit','undefined','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','FreshsalesField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x145f1a,_0x53bb2d){var _0x23370f=function(_0x5755b0){while(--_0x5755b0){_0x145f1a['push'](_0x145f1a['shift']());}};_0x23370f(++_0x53bb2d);}(_0x0d7e,0x97));var _0xe0d7=function(_0x3a8517,_0x2b5a1d){_0x3a8517=_0x3a8517-0x0;var _0x43ff0e=_0x0d7e[_0x3a8517];return _0x43ff0e;};'use strict';var emlformat=require(_0xe0d7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0d7('0x1'));var jsonpatch=require(_0xe0d7('0x2'));var rp=require(_0xe0d7('0x3'));var moment=require(_0xe0d7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe0d7('0x5'));var util=require('util');var path=require(_0xe0d7('0x6'));var sox=require(_0xe0d7('0x7'));var csv=require('to-csv');var ejs=require(_0xe0d7('0x8'));var fs=require('fs');var fs_extra=require(_0xe0d7('0x9'));var _=require(_0xe0d7('0xa'));var squel=require(_0xe0d7('0xb'));var crypto=require(_0xe0d7('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe0d7('0xd'));var toCsv=require(_0xe0d7('0xe'));var querystring=require(_0xe0d7('0xf'));var Papa=require(_0xe0d7('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe0d7('0x11'));var as=require(_0xe0d7('0x12'));var hardwareService=require(_0xe0d7('0x13'));var logger=require(_0xe0d7('0x14'))('api');var utils=require(_0xe0d7('0x15'));var config=require(_0xe0d7('0x16'));var licenseUtil=require(_0xe0d7('0x17'));var db=require(_0xe0d7('0x18'))['db'];function respondWithStatusCode(_0x19aa02,_0x13acae){_0x13acae=_0x13acae||0xcc;return function(_0x39032c){if(_0x39032c){return _0x19aa02[_0xe0d7('0x19')](_0x13acae);}return _0x19aa02['status'](_0x13acae)[_0xe0d7('0x1a')]();};}function respondWithResult(_0x2c8966,_0x269a26){_0x269a26=_0x269a26||0xc8;return function(_0x3648cf){if(_0x3648cf){return _0x2c8966['status'](_0x269a26)[_0xe0d7('0x1b')](_0x3648cf);}};}function respondWithFilteredResult(_0x359484,_0x365766){return function(_0x34451f){if(_0x34451f){var _0x25f3a1=typeof _0x365766['offset']==='undefined'&&typeof _0x365766[_0xe0d7('0x1c')]===_0xe0d7('0x1d');var _0x2ec616=_0x34451f[_0xe0d7('0x1e')];var _0x3bb982=_0x25f3a1?0x0:_0x365766[_0xe0d7('0x1f')];var _0x2f8084=_0x25f3a1?_0x34451f['count']:_0x365766[_0xe0d7('0x1f')]+_0x365766[_0xe0d7('0x1c')];var _0x2d8c8d;if(_0x2f8084>=_0x2ec616){_0x2f8084=_0x2ec616;_0x2d8c8d=0xc8;}else{_0x2d8c8d=0xce;}_0x359484[_0xe0d7('0x20')](_0x2d8c8d);return _0x359484[_0xe0d7('0x21')](_0xe0d7('0x22'),_0x3bb982+'-'+_0x2f8084+'/'+_0x2ec616)['json'](_0x34451f);}return null;};}function patchUpdates(_0x494b03){return function(_0x1409b3){try{jsonpatch[_0xe0d7('0x23')](_0x1409b3,_0x494b03,!![]);}catch(_0x44f2d4){return BPromise[_0xe0d7('0x24')](_0x44f2d4);}return _0x1409b3[_0xe0d7('0x25')]();};}function saveUpdates(_0xd02f9a,_0x3e7aca){return function(_0x5bd9e5){if(_0x5bd9e5){return _0x5bd9e5[_0xe0d7('0x26')](_0xd02f9a)[_0xe0d7('0x27')](function(_0x10f5ab){return _0x10f5ab;});}return null;};}function removeEntity(_0x2ce3e7,_0x1e440c){return function(_0x2e6796){if(_0x2e6796){return _0x2e6796[_0xe0d7('0x28')]()['then'](function(){_0x2ce3e7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ebcbb,_0x121696){return function(_0x5c790e){if(!_0x5c790e){_0x3ebcbb['sendStatus'](0x194);}return _0x5c790e;};}function handleError(_0x30a007,_0x14dd56){_0x14dd56=_0x14dd56||0x1f4;return function(_0xb94172){logger[_0xe0d7('0x29')](_0xb94172['stack']);if(_0xb94172[_0xe0d7('0x2a')]){delete _0xb94172['name'];}_0x30a007[_0xe0d7('0x20')](_0x14dd56)[_0xe0d7('0x2b')](_0xb94172);};}exports[_0xe0d7('0x2c')]=function(_0x5839ee,_0x57b7cb){var _0x405b6c={},_0x2b27a5={},_0x3c4195={'count':0x0,'rows':[]};var _0x32b670=_[_0xe0d7('0x2d')](db[_0xe0d7('0x2e')][_0xe0d7('0x2f')],function(_0x5398dd){return{'name':_0x5398dd[_0xe0d7('0x30')],'type':_0x5398dd['type'][_0xe0d7('0x31')]};});_0x2b27a5[_0xe0d7('0x32')]=_['map'](_0x32b670,_0xe0d7('0x2a'));_0x2b27a5[_0xe0d7('0x33')]=_[_0xe0d7('0x34')](_0x5839ee[_0xe0d7('0x33')]);_0x2b27a5[_0xe0d7('0x35')]=_[_0xe0d7('0x36')](_0x2b27a5['model'],_0x2b27a5[_0xe0d7('0x33')]);_0x405b6c[_0xe0d7('0x37')]=_['intersection'](_0x2b27a5[_0xe0d7('0x32')],qs[_0xe0d7('0x38')](_0x5839ee[_0xe0d7('0x33')][_0xe0d7('0x38')]));_0x405b6c['attributes']=_0x405b6c[_0xe0d7('0x37')]['length']?_0x405b6c[_0xe0d7('0x37')]:_0x2b27a5['model'];if(!_0x5839ee[_0xe0d7('0x33')][_0xe0d7('0x39')](_0xe0d7('0x3a'))){_0x405b6c[_0xe0d7('0x1c')]=qs[_0xe0d7('0x1c')](_0x5839ee[_0xe0d7('0x33')][_0xe0d7('0x1c')]);_0x405b6c[_0xe0d7('0x1f')]=qs[_0xe0d7('0x1f')](_0x5839ee[_0xe0d7('0x33')][_0xe0d7('0x1f')]);}_0x405b6c[_0xe0d7('0x3b')]=qs[_0xe0d7('0x3c')](_0x5839ee[_0xe0d7('0x33')][_0xe0d7('0x3c')]);_0x405b6c[_0xe0d7('0x3d')]=qs[_0xe0d7('0x35')](_['pick'](_0x5839ee[_0xe0d7('0x33')],_0x2b27a5['filters']),_0x32b670);if(_0x5839ee[_0xe0d7('0x33')][_0xe0d7('0x3e')]){_0x405b6c[_0xe0d7('0x3d')]=_[_0xe0d7('0x3f')](_0x405b6c[_0xe0d7('0x3d')],{'$or':_['map'](_0x32b670,function(_0xc1137d){if(_0xc1137d[_0xe0d7('0x40')]!==_0xe0d7('0x41')){var _0x13206b={};_0x13206b[_0xc1137d['name']]={'$like':'%'+_0x5839ee[_0xe0d7('0x33')][_0xe0d7('0x3e')]+'%'};return _0x13206b;}})});}_0x405b6c=_[_0xe0d7('0x3f')]({},_0x405b6c,_0x5839ee[_0xe0d7('0x42')]);var _0x592a0c={'where':_0x405b6c[_0xe0d7('0x3d')]};return db['FreshsalesField'][_0xe0d7('0x1e')](_0x592a0c)['then'](function(_0xf436c1){_0x3c4195[_0xe0d7('0x1e')]=_0xf436c1;if(_0x5839ee[_0xe0d7('0x33')][_0xe0d7('0x43')]){_0x405b6c[_0xe0d7('0x44')]=[{'all':!![]}];}return db[_0xe0d7('0x2e')][_0xe0d7('0x45')](_0x405b6c);})['then'](function(_0x170b48){_0x3c4195[_0xe0d7('0x46')]=_0x170b48;return _0x3c4195;})[_0xe0d7('0x27')](respondWithFilteredResult(_0x57b7cb,_0x405b6c))[_0xe0d7('0x47')](handleError(_0x57b7cb,null));};exports[_0xe0d7('0x48')]=function(_0x1c2cdd,_0x24cf4c){var _0x4df4b7={'raw':!![],'where':{'id':_0x1c2cdd[_0xe0d7('0x49')]['id']}},_0x1aa405={};_0x1aa405[_0xe0d7('0x32')]=_[_0xe0d7('0x34')](db[_0xe0d7('0x2e')][_0xe0d7('0x2f')]);_0x1aa405['query']=_[_0xe0d7('0x34')](_0x1c2cdd[_0xe0d7('0x33')]);_0x1aa405[_0xe0d7('0x35')]=_['intersection'](_0x1aa405['model'],_0x1aa405[_0xe0d7('0x33')]);_0x4df4b7[_0xe0d7('0x37')]=_[_0xe0d7('0x36')](_0x1aa405[_0xe0d7('0x32')],qs['fields'](_0x1c2cdd['query'][_0xe0d7('0x38')]));_0x4df4b7[_0xe0d7('0x37')]=_0x4df4b7[_0xe0d7('0x37')][_0xe0d7('0x4a')]?_0x4df4b7[_0xe0d7('0x37')]:_0x1aa405[_0xe0d7('0x32')];if(_0x1c2cdd[_0xe0d7('0x33')][_0xe0d7('0x43')]){_0x4df4b7[_0xe0d7('0x44')]=[{'all':!![]}];}_0x4df4b7=_['merge']({},_0x4df4b7,_0x1c2cdd['options']);return db[_0xe0d7('0x2e')][_0xe0d7('0x4b')](_0x4df4b7)[_0xe0d7('0x27')](handleEntityNotFound(_0x24cf4c,null))['then'](respondWithResult(_0x24cf4c,null))[_0xe0d7('0x47')](handleError(_0x24cf4c,null));};exports[_0xe0d7('0x4c')]=function(_0x56f6f5,_0x10917a){return db[_0xe0d7('0x2e')][_0xe0d7('0x4c')](_0x56f6f5['body'],{})[_0xe0d7('0x27')](respondWithResult(_0x10917a,0xc9))[_0xe0d7('0x47')](handleError(_0x10917a,null));};exports[_0xe0d7('0x26')]=function(_0xf7f9b2,_0x5b4429){if(_0xf7f9b2[_0xe0d7('0x4d')]['id']){delete _0xf7f9b2[_0xe0d7('0x4d')]['id'];}return db[_0xe0d7('0x2e')]['find']({'where':{'id':_0xf7f9b2[_0xe0d7('0x49')]['id']}})[_0xe0d7('0x27')](handleEntityNotFound(_0x5b4429,null))[_0xe0d7('0x27')](saveUpdates(_0xf7f9b2['body'],null))[_0xe0d7('0x27')](respondWithResult(_0x5b4429,null))[_0xe0d7('0x47')](handleError(_0x5b4429,null));};exports[_0xe0d7('0x28')]=function(_0x42a8cf,_0x3d03c2){return db[_0xe0d7('0x2e')][_0xe0d7('0x4b')]({'where':{'id':_0x42a8cf['params']['id']}})[_0xe0d7('0x27')](handleEntityNotFound(_0x3d03c2,null))['then'](removeEntity(_0x3d03c2,null))[_0xe0d7('0x47')](handleError(_0x3d03c2,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index e04ceb9..1d0e256 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 _0x419f=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','FieldId','lodash'];(function(_0x512f8c,_0x3545c1){var _0x2099f8=function(_0x5293eb){while(--_0x5293eb){_0x512f8c['push'](_0x512f8c['shift']());}};_0x2099f8(++_0x3545c1);}(_0x419f,0x176));var _0xf419=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x419f[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0xf419('0x0'));var util=require(_0xf419('0x1'));var logger=require(_0xf419('0x2'))(_0xf419('0x3'));var moment=require(_0xf419('0x4'));var BPromise=require(_0xf419('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf419('0x6'));var rimraf=require('rimraf');var config=require(_0xf419('0x7'));var attributes=require(_0xf419('0x8'));module[_0xf419('0x9')]=function(_0x38f2fa,_0x2d8430){return _0x38f2fa[_0xf419('0xa')](_0xf419('0xb'),attributes,{'tableName':_0xf419('0xc'),'paranoid':![],'indexes':[{'name':_0xf419('0xd'),'fields':['idField',_0xf419('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x341c=['rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','FieldId','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x341c,0xcc));var _0xc341=function(_0x161cb1,_0x7930a){_0x161cb1=_0x161cb1-0x0;var _0x36dd92=_0x341c[_0x161cb1];return _0x36dd92;};'use strict';var _=require(_0xc341('0x0'));var util=require('util');var logger=require(_0xc341('0x1'))('api');var moment=require(_0xc341('0x2'));var BPromise=require(_0xc341('0x3'));var rp=require(_0xc341('0x4'));var fs=require('fs');var path=require(_0xc341('0x5'));var rimraf=require(_0xc341('0x6'));var config=require(_0xc341('0x7'));var attributes=require(_0xc341('0x8'));module[_0xc341('0x9')]=function(_0x5226bd,_0xf9fe84){return _0x5226bd[_0xc341('0xa')](_0xc341('0xb'),attributes,{'tableName':_0xc341('0xc'),'paranoid':![],'indexes':[{'name':_0xc341('0xd'),'fields':['idField',_0xc341('0xe')],'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 ce29bbb..edbc721 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 _0xba34=['../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc'];(function(_0x182c04,_0xd4902e){var _0x2d032f=function(_0x116e24){while(--_0x116e24){_0x182c04['push'](_0x182c04['shift']());}};_0x2d032f(++_0xd4902e);}(_0xba34,0x119));var _0x4ba3=function(_0x333a1f,_0x447832){_0x333a1f=_0x333a1f-0x0;var _0x16471f=_0xba34[_0x333a1f];return _0x16471f;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var BPromise=require(_0x4ba3('0x3'));var rs=require(_0x4ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba3('0x5'))(_0x4ba3('0x6'));var config=require(_0x4ba3('0x7'));var jayson=require(_0x4ba3('0x8'));var client=jayson[_0x4ba3('0x9')][_0x4ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe5f99a,_0x585f2d,_0x6254fb){return new BPromise(function(_0x368eee,_0x2df7f3){return client[_0x4ba3('0xb')](_0xe5f99a,_0x6254fb)[_0x4ba3('0xc')](function(_0xcf1ec3){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0x585f2d,'request\x20sent',JSON[_0x4ba3('0x12')](_0xcf1ec3));if(_0xcf1ec3[_0x4ba3('0x13')]){if(_0xcf1ec3['error'][_0x4ba3('0x14')]===0x1f4){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3['error'][_0x4ba3('0x15')]);return _0x2df7f3(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}logger[_0x4ba3('0x13')](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);return _0x368eee(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}else{logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));_0x368eee(_0xcf1ec3[_0x4ba3('0x16')][_0x4ba3('0x15')]);}})[_0x4ba3('0x17')](function(_0x1b7776){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0x1b7776);_0x2df7f3(_0x1b7776);});});} \ No newline at end of file +var _0xeff8=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash'];(function(_0xd14e26,_0x182735){var _0x15e428=function(_0x4aa194){while(--_0x4aa194){_0xd14e26['push'](_0xd14e26['shift']());}};_0x15e428(++_0x182735);}(_0xeff8,0x186));var _0x8eff=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xeff8[_0x173441];return _0x2423a8;};'use strict';var _=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var moment=require('moment');var BPromise=require(_0x8eff('0x2'));var rs=require(_0x8eff('0x3'));var fs=require('fs');var Redis=require(_0x8eff('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8eff('0x5'));var logger=require(_0x8eff('0x6'))(_0x8eff('0x7'));var config=require(_0x8eff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8eff('0x9')][_0x8eff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3409bc,_0x323b2,_0x491f01){return new BPromise(function(_0x3fb9ee,_0x19557f){return client[_0x8eff('0xb')](_0x3409bc,_0x491f01)[_0x8eff('0xc')](function(_0x5bd403){logger['info'](_0x8eff('0xd'),_0x323b2,_0x8eff('0xe'));logger[_0x8eff('0xf')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x323b2,_0x8eff('0xe'),JSON[_0x8eff('0x10')](_0x5bd403));if(_0x5bd403['error']){if(_0x5bd403[_0x8eff('0x11')][_0x8eff('0x12')]===0x1f4){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x323b2,_0x5bd403[_0x8eff('0x11')][_0x8eff('0x13')]);return _0x19557f(_0x5bd403[_0x8eff('0x11')][_0x8eff('0x13')]);}logger[_0x8eff('0x11')]('FreshsalesField,\x20%s,\x20%s',_0x323b2,_0x5bd403[_0x8eff('0x11')][_0x8eff('0x13')]);return _0x3fb9ee(_0x5bd403[_0x8eff('0x11')][_0x8eff('0x13')]);}else{logger[_0x8eff('0x14')](_0x8eff('0xd'),_0x323b2,_0x8eff('0xe'));_0x3fb9ee(_0x5bd403[_0x8eff('0x15')][_0x8eff('0x13')]);}})[_0x8eff('0x16')](function(_0x137344){logger['error'](_0x8eff('0xd'),_0x323b2,_0x137344);_0x19557f(_0x137344);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index eba248f..f3fae6a 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(_0x45e6e7,_0xd948ce){var _0x2756d8=function(_0x60a82e){while(--_0x60a82e){_0x45e6e7['push'](_0x45e6e7['shift']());}};_0x2756d8(++_0xd948ce);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x401790,_0x1af7a6){var _0x2e80dd=function(_0x156b38){while(--_0x156b38){_0x401790['push'](_0x401790['shift']());}};_0x2e80dd(++_0x1af7a6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 084ff78..6f35fc9 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 _0xafa7=['ENUM','integrationTab','newTab','sequelize','exports','STRING','username'];(function(_0x2730ad,_0x4d247d){var _0x1d4363=function(_0x17c180){while(--_0x17c180){_0x2730ad['push'](_0x2730ad['shift']());}};_0x1d4363(++_0x4d247d);}(_0xafa7,0x122));var _0x7afa=function(_0xb7a459,_0xc13228){_0xb7a459=_0xb7a459-0x0;var _0x104ab5=_0xafa7[_0xb7a459];return _0x104ab5;};'use strict';var Sequelize=require(_0x7afa('0x0'));module[_0x7afa('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7afa('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x7afa('0x3')},'remoteUri':{'type':Sequelize[_0x7afa('0x2')]},'password':{'type':Sequelize[_0x7afa('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x7afa('0x2')]},'serverUrl':{'type':Sequelize[_0x7afa('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7afa('0x4')](_0x7afa('0x5'),_0x7afa('0x6')),'defaultValue':_0x7afa('0x5')}}; \ No newline at end of file +var _0x1131=['integrationTab','newTab','sequelize','exports','STRING','ENUM'];(function(_0x4f7987,_0x3af1f3){var _0x1becb2=function(_0x541562){while(--_0x541562){_0x4f7987['push'](_0x4f7987['shift']());}};_0x1becb2(++_0x3af1f3);}(_0x1131,0x1c4));var _0x1113=function(_0x77a170,_0x2ddfd8){_0x77a170=_0x77a170-0x0;var _0x1db33f=_0x1131[_0x77a170];return _0x1db33f;};'use strict';var Sequelize=require(_0x1113('0x0'));module[_0x1113('0x1')]={'name':{'type':Sequelize[_0x1113('0x2')]},'description':{'type':Sequelize[_0x1113('0x2')]},'username':{'type':Sequelize[_0x1113('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize[_0x1113('0x2')]},'password':{'type':Sequelize[_0x1113('0x2')]},'clientId':{'type':Sequelize[_0x1113('0x2')]},'clientSecret':{'type':Sequelize[_0x1113('0x2')]},'securityToken':{'type':Sequelize[_0x1113('0x2')]},'serverUrl':{'type':Sequelize[_0x1113('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1113('0x3')](_0x1113('0x4'),_0x1113('0x5')),'defaultValue':_0x1113('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 07eeadc..66c263b 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 _0x70f2=['includeAll','include','findAll','catch','show','params','rawAttributes','create','body','find','destroy','getConfigurations','findOne','SalesforceConfiguration','filter','AccountId','getSubjects','channel','SalesforceField','Subjects','Descriptions','getFields','Task','remoteUri','clientSecret','password','securityToken','Connection','clientId','username','concat','isNil','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','picklist','boolean','email','textarea','phone','includes','custom','picklistValues','label','value','True','true','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','error','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','SalesforceAccount','then'];(function(_0x4b2a5c,_0x29b5eb){var _0xed6e3c=function(_0x476514){while(--_0x476514){_0x4b2a5c['push'](_0x4b2a5c['shift']());}};_0xed6e3c(++_0x29b5eb);}(_0x70f2,0xb1));var _0x270f=function(_0x4157cd,_0x587a21){_0x4157cd=_0x4157cd-0x0;var _0x214363=_0x70f2[_0x4157cd];return _0x214363;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x270f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x270f('0x1'));var moment=require('moment');var BPromise=require(_0x270f('0x2'));var Mustache=require(_0x270f('0x3'));var util=require('util');var path=require(_0x270f('0x4'));var sox=require(_0x270f('0x5'));var csv=require(_0x270f('0x6'));var ejs=require(_0x270f('0x7'));var fs=require('fs');var fs_extra=require(_0x270f('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x270f('0x9'));var Papa=require(_0x270f('0xa'));var Redis=require('ioredis');var authService=require(_0x270f('0xb'));var qs=require(_0x270f('0xc'));var as=require(_0x270f('0xd'));var hardwareService=require(_0x270f('0xe'));var logger=require('../../config/logger')(_0x270f('0xf'));var utils=require(_0x270f('0x10'));var config=require(_0x270f('0x11'));var licenseUtil=require(_0x270f('0x12'));var db=require(_0x270f('0x13'))['db'];var integrations=require(_0x270f('0x14'));function respondWithStatusCode(_0x401ed7,_0x39b2bc){_0x39b2bc=_0x39b2bc||0xcc;return function(_0xab11b2){if(_0xab11b2){return _0x401ed7[_0x270f('0x15')](_0x39b2bc);}return _0x401ed7[_0x270f('0x16')](_0x39b2bc)[_0x270f('0x17')]();};}function respondWithResult(_0x36115b,_0x3c055d){_0x3c055d=_0x3c055d||0xc8;return function(_0x5ee017){if(_0x5ee017){return _0x36115b[_0x270f('0x16')](_0x3c055d)[_0x270f('0x18')](_0x5ee017);}};}function respondWithFilteredResult(_0x282e88,_0x1608f5){return function(_0x2f5601){if(_0x2f5601){var _0x5b04de=typeof _0x1608f5[_0x270f('0x19')]===_0x270f('0x1a')&&typeof _0x1608f5[_0x270f('0x1b')]==='undefined';var _0x443cce=_0x2f5601[_0x270f('0x1c')];var _0x4761c5=_0x5b04de?0x0:_0x1608f5[_0x270f('0x19')];var _0x790529=_0x5b04de?_0x2f5601[_0x270f('0x1c')]:_0x1608f5[_0x270f('0x19')]+_0x1608f5[_0x270f('0x1b')];var _0x1091a1;if(_0x790529>=_0x443cce){_0x790529=_0x443cce;_0x1091a1=0xc8;}else{_0x1091a1=0xce;}_0x282e88[_0x270f('0x16')](_0x1091a1);return _0x282e88[_0x270f('0x1d')]('Content-Range',_0x4761c5+'-'+_0x790529+'/'+_0x443cce)[_0x270f('0x18')](_0x2f5601);}return null;};}function patchUpdates(_0x158b3e){return function(_0x2280dc){try{jsonpatch['apply'](_0x2280dc,_0x158b3e,!![]);}catch(_0x16449b){return BPromise[_0x270f('0x1e')](_0x16449b);}return _0x2280dc[_0x270f('0x1f')]();};}function saveUpdates(_0xb2f41,_0x7d9e7d){return function(_0x39ab39){if(_0x39ab39){return _0x39ab39[_0x270f('0x20')](_0xb2f41)['then'](function(_0x3ef96e){return _0x3ef96e;});}return null;};}function removeEntity(_0x2c72d2,_0x2b9bdf){return function(_0x50f766){if(_0x50f766){return _0x50f766['destroy']()['then'](function(){_0x2c72d2[_0x270f('0x16')](0xcc)[_0x270f('0x17')]();});}};}function handleEntityNotFound(_0x4cfa57,_0x3fc489){return function(_0x39fd42){if(!_0x39fd42){_0x4cfa57[_0x270f('0x15')](0x194);}return _0x39fd42;};}function handleError(_0x2fe3af,_0x332304){_0x332304=_0x332304||0x1f4;return function(_0x4f343d){logger[_0x270f('0x21')](_0x4f343d['stack']);if(_0x4f343d[_0x270f('0x22')]){delete _0x4f343d[_0x270f('0x22')];}_0x2fe3af['status'](_0x332304)[_0x270f('0x23')](_0x4f343d);};}exports[_0x270f('0x24')]=function(_0x1442a3,_0x202cf0){var _0x41ad81={},_0x537573={},_0x132130={'count':0x0,'rows':[]};var _0x4fd90f=_[_0x270f('0x25')](db['SalesforceAccount']['rawAttributes'],function(_0x1898d6){return{'name':_0x1898d6[_0x270f('0x26')],'type':_0x1898d6[_0x270f('0x27')][_0x270f('0x28')]};});_0x537573[_0x270f('0x29')]=_[_0x270f('0x25')](_0x4fd90f,_0x270f('0x22'));_0x537573[_0x270f('0x2a')]=_[_0x270f('0x2b')](_0x1442a3[_0x270f('0x2a')]);_0x537573[_0x270f('0x2c')]=_[_0x270f('0x2d')](_0x537573['model'],_0x537573[_0x270f('0x2a')]);_0x41ad81[_0x270f('0x2e')]=_[_0x270f('0x2d')](_0x537573[_0x270f('0x29')],qs[_0x270f('0x2f')](_0x1442a3[_0x270f('0x2a')][_0x270f('0x2f')]));_0x41ad81[_0x270f('0x2e')]=_0x41ad81[_0x270f('0x2e')][_0x270f('0x30')]?_0x41ad81['attributes']:_0x537573[_0x270f('0x29')];if(!_0x1442a3[_0x270f('0x2a')][_0x270f('0x31')](_0x270f('0x32'))){_0x41ad81[_0x270f('0x1b')]=qs[_0x270f('0x1b')](_0x1442a3[_0x270f('0x2a')][_0x270f('0x1b')]);_0x41ad81[_0x270f('0x19')]=qs['offset'](_0x1442a3['query'][_0x270f('0x19')]);}_0x41ad81[_0x270f('0x33')]=qs[_0x270f('0x34')](_0x1442a3['query'][_0x270f('0x34')]);_0x41ad81[_0x270f('0x35')]=qs[_0x270f('0x2c')](_[_0x270f('0x36')](_0x1442a3[_0x270f('0x2a')],_0x537573[_0x270f('0x2c')]),_0x4fd90f);if(_0x1442a3['query']['filter']){_0x41ad81[_0x270f('0x35')]=_[_0x270f('0x37')](_0x41ad81['where'],{'$or':_[_0x270f('0x25')](_0x4fd90f,function(_0x17f2f1){if(_0x17f2f1[_0x270f('0x27')]!=='VIRTUAL'){var _0x29278a={};_0x29278a[_0x17f2f1[_0x270f('0x22')]]={'$like':'%'+_0x1442a3['query']['filter']+'%'};return _0x29278a;}})});}_0x41ad81=_['merge']({},_0x41ad81,_0x1442a3[_0x270f('0x38')]);var _0x488c0f={'where':_0x41ad81['where']};return db[_0x270f('0x39')]['count'](_0x488c0f)[_0x270f('0x3a')](function(_0x2e5e86){_0x132130[_0x270f('0x1c')]=_0x2e5e86;if(_0x1442a3['query'][_0x270f('0x3b')]){_0x41ad81[_0x270f('0x3c')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x270f('0x3d')](_0x41ad81);})[_0x270f('0x3a')](function(_0xeda4b5){_0x132130['rows']=_0xeda4b5;return _0x132130;})[_0x270f('0x3a')](respondWithFilteredResult(_0x202cf0,_0x41ad81))[_0x270f('0x3e')](handleError(_0x202cf0,null));};exports[_0x270f('0x3f')]=function(_0x50d8bf,_0x443afc){var _0x452a8a={'raw':![],'where':{'id':_0x50d8bf[_0x270f('0x40')]['id']}},_0x4219c4={};_0x4219c4[_0x270f('0x29')]=_[_0x270f('0x2b')](db['SalesforceAccount'][_0x270f('0x41')]);_0x4219c4[_0x270f('0x2a')]=_[_0x270f('0x2b')](_0x50d8bf['query']);_0x4219c4[_0x270f('0x2c')]=_['intersection'](_0x4219c4[_0x270f('0x29')],_0x4219c4[_0x270f('0x2a')]);_0x452a8a[_0x270f('0x2e')]=_[_0x270f('0x2d')](_0x4219c4[_0x270f('0x29')],qs[_0x270f('0x2f')](_0x50d8bf[_0x270f('0x2a')][_0x270f('0x2f')]));_0x452a8a[_0x270f('0x2e')]=_0x452a8a['attributes'][_0x270f('0x30')]?_0x452a8a[_0x270f('0x2e')]:_0x4219c4[_0x270f('0x29')];if(_0x50d8bf['query'][_0x270f('0x3b')]){_0x452a8a[_0x270f('0x3c')]=[{'all':!![]}];}_0x452a8a=_['merge']({},_0x452a8a,_0x50d8bf['options']);return db[_0x270f('0x39')]['find'](_0x452a8a)[_0x270f('0x3a')](handleEntityNotFound(_0x443afc,null))[_0x270f('0x3a')](respondWithResult(_0x443afc,null))['catch'](handleError(_0x443afc,null));};exports[_0x270f('0x42')]=function(_0x2250dd,_0x2e8648){return db[_0x270f('0x39')][_0x270f('0x42')](_0x2250dd[_0x270f('0x43')],{})[_0x270f('0x3a')](respondWithResult(_0x2e8648,0xc9))[_0x270f('0x3e')](handleError(_0x2e8648,null));};exports['update']=function(_0xbb2c3f,_0x251861){if(_0xbb2c3f[_0x270f('0x43')]['id']){delete _0xbb2c3f[_0x270f('0x43')]['id'];}return db[_0x270f('0x39')][_0x270f('0x44')]({'where':{'id':_0xbb2c3f[_0x270f('0x40')]['id']}})[_0x270f('0x3a')](handleEntityNotFound(_0x251861,null))[_0x270f('0x3a')](saveUpdates(_0xbb2c3f[_0x270f('0x43')],null))[_0x270f('0x3a')](respondWithResult(_0x251861,null))[_0x270f('0x3e')](handleError(_0x251861,null));};exports[_0x270f('0x45')]=function(_0x671328,_0x221ea2){return db[_0x270f('0x39')]['find']({'where':{'id':_0x671328[_0x270f('0x40')]['id']}})[_0x270f('0x3a')](handleEntityNotFound(_0x221ea2,null))['then'](removeEntity(_0x221ea2,null))[_0x270f('0x3e')](handleError(_0x221ea2,null));};exports[_0x270f('0x46')]=function(_0x5d6cb0,_0x209794,_0x436b3d){var _0x29ed20={};var _0xc5a455={};var _0xb2f698;var _0x4d840e;return db[_0x270f('0x39')][_0x270f('0x47')]({'where':{'id':_0x5d6cb0[_0x270f('0x40')]['id']}})[_0x270f('0x3a')](handleEntityNotFound(_0x209794,null))[_0x270f('0x3a')](function(_0x396284){if(_0x396284){_0xb2f698=_0x396284;_0xc5a455[_0x270f('0x29')]=_[_0x270f('0x2b')](db[_0x270f('0x48')][_0x270f('0x41')]);_0xc5a455['query']=_[_0x270f('0x2b')](_0x5d6cb0[_0x270f('0x2a')]);_0xc5a455[_0x270f('0x2c')]=_[_0x270f('0x2d')](_0xc5a455[_0x270f('0x29')],_0xc5a455['query']);_0x29ed20[_0x270f('0x2e')]=_[_0x270f('0x2d')](_0xc5a455[_0x270f('0x29')],qs['fields'](_0x5d6cb0[_0x270f('0x2a')][_0x270f('0x2f')]));_0x29ed20['attributes']=_0x29ed20[_0x270f('0x2e')][_0x270f('0x30')]?_0x29ed20[_0x270f('0x2e')]:_0xc5a455[_0x270f('0x29')];_0x29ed20[_0x270f('0x33')]=qs['sort'](_0x5d6cb0[_0x270f('0x2a')][_0x270f('0x34')]);_0x29ed20[_0x270f('0x35')]=qs['filters'](_[_0x270f('0x36')](_0x5d6cb0[_0x270f('0x2a')],_0xc5a455[_0x270f('0x2c')]));if(_0x5d6cb0[_0x270f('0x2a')][_0x270f('0x49')]){_0x29ed20[_0x270f('0x35')]=_[_0x270f('0x37')](_0x29ed20['where'],{'$or':_['map'](_0x29ed20[_0x270f('0x2e')],function(_0x1e8e95){var _0x3e427a={};_0x3e427a[_0x1e8e95]={'$like':'%'+_0x5d6cb0[_0x270f('0x2a')][_0x270f('0x49')]+'%'};return _0x3e427a;})});}_0x29ed20=_[_0x270f('0x37')]({},_0x29ed20,_0x5d6cb0[_0x270f('0x38')]);return _0xb2f698[_0x270f('0x46')](_0x29ed20);}})[_0x270f('0x3a')](function(_0x42a982){if(_0x42a982){_0x4d840e=_0x42a982[_0x270f('0x30')];if(!_0x5d6cb0[_0x270f('0x2a')]['hasOwnProperty']('nolimit')){_0x29ed20[_0x270f('0x1b')]=qs[_0x270f('0x1b')](_0x5d6cb0[_0x270f('0x2a')][_0x270f('0x1b')]);_0x29ed20[_0x270f('0x19')]=qs[_0x270f('0x19')](_0x5d6cb0[_0x270f('0x2a')][_0x270f('0x19')]);}return _0xb2f698[_0x270f('0x46')](_0x29ed20);}})[_0x270f('0x3a')](function(_0x380137){if(_0x380137){return _0x380137?{'count':_0x4d840e,'rows':_0x380137}:null;}})[_0x270f('0x3a')](respondWithResult(_0x209794,null))['catch'](handleError(_0x209794,null));};exports['addConfiguration']=function(_0x41b1bb,_0x202caf,_0x1abedf){if(_0x41b1bb[_0x270f('0x43')]['id']){delete _0x41b1bb[_0x270f('0x43')]['id'];}return db[_0x270f('0x39')][_0x270f('0x47')]({'where':{'id':_0x41b1bb[_0x270f('0x40')]['id']}})[_0x270f('0x3a')](handleEntityNotFound(_0x202caf,null))['then'](function(_0x10841b){if(_0x10841b){_0x41b1bb[_0x270f('0x43')][_0x270f('0x4a')]=_0x10841b['id'];_0x41b1bb[_0x270f('0x43')]['Subjects']=integrations[_0x270f('0x4b')](_0x41b1bb['body'][_0x270f('0x4c')],_0x41b1bb[_0x270f('0x43')][_0x270f('0x27')]);_0x41b1bb['body']['Descriptions']=integrations['getDescriptions'](_0x41b1bb['body'][_0x270f('0x4c')],_0x41b1bb[_0x270f('0x43')][_0x270f('0x27')]);return db['SalesforceConfiguration'][_0x270f('0x42')](_0x41b1bb[_0x270f('0x43')],{'include':[{'model':db[_0x270f('0x4d')],'as':_0x270f('0x4e')},{'model':db[_0x270f('0x4d')],'as':_0x270f('0x4f')}]});}return null;})[_0x270f('0x3a')](respondWithResult(_0x202caf,null))['catch'](handleError(_0x202caf,null));};exports[_0x270f('0x50')]=function(_0x37eaf5,_0x487e11,_0x3ef64f){var _0x1359c2;var _0x42828e='';var _0x25c6e9=_0x270f('0x51');return db[_0x270f('0x39')][_0x270f('0x47')]({'where':{'id':_0x37eaf5[_0x270f('0x40')]['id']},'attributes':['id',_0x270f('0x52'),'clientId',_0x270f('0x53'),'username',_0x270f('0x54'),_0x270f('0x55')]})[_0x270f('0x3a')](handleEntityNotFound(_0x487e11,null))[_0x270f('0x3a')](function(_0x39a28f){if(_0x39a28f){_0x42828e=_0x39a28f[_0x270f('0x52')];var _0x1df22c=_0x42828e['slice'](-0x1);if(_0x1df22c==='/'){_0x42828e=_0x42828e['substring'](0x0,_0x42828e['lastIndexOf'](_0x1df22c));}_0x1359c2=new jsforce[(_0x270f('0x56'))]({'oauth2':{'loginUrl':_0x42828e,'clientId':_0x39a28f[_0x270f('0x57')],'clientSecret':_0x39a28f['clientSecret']}});return _0x1359c2['login'](_0x39a28f[_0x270f('0x58')],_0x39a28f[_0x270f('0x54')][_0x270f('0x59')](_0x39a28f[_0x270f('0x55')]));}})[_0x270f('0x3a')](function(_0x5e24d0){if(_0x5e24d0){if(!_[_0x270f('0x5a')](_0x37eaf5[_0x270f('0x2a')]['ticketType'])){_0x25c6e9=_0x37eaf5[_0x270f('0x2a')]['ticketType'];}return _0x1359c2[_0x270f('0x5b')](_0x25c6e9)[_0x270f('0x5c')]();}})[_0x270f('0x3a')](function(_0x38a62e){var _0xeddc39=[_0x270f('0x5d'),_0x270f('0x5e'),_0x270f('0x5f'),_0x270f('0x60'),_0x270f('0x61'),_0x270f('0x62')];var _0x37cd37=[_0x270f('0x63'),'int',_0x270f('0x64'),_0x270f('0x65'),_0x270f('0x66'),_0x270f('0x67'),_0x270f('0x68')];if(_0x38a62e){_['remove'](_0x38a62e[_0x270f('0x2f')],function(_0x49f5b4){return _0xeddc39['includes'](_0x49f5b4['name'])||!_0x37cd37[_0x270f('0x69')](_0x49f5b4[_0x270f('0x27')]);});return{'count':_0x38a62e['fields'][_0x270f('0x30')],'rows':_[_0x270f('0x25')](_0x38a62e[_0x270f('0x2f')],function(_0xbca6ba){return{'id':_0xbca6ba[_0x270f('0x22')],'name':_0xbca6ba['label'],'custom':_0xbca6ba[_0x270f('0x6a')],'options':_0xbca6ba[_0x270f('0x6b')]['length']>0x0?_[_0x270f('0x25')](_0xbca6ba['picklistValues'],function(_0x326d5e){return{'name':_0x326d5e[_0x270f('0x6c')],'value':_0x326d5e[_0x270f('0x6d')]};}):_0xbca6ba[_0x270f('0x27')]==_0x270f('0x65')?[{'name':_0x270f('0x6e'),'value':_0x270f('0x6f')},{'name':'False','value':_0x270f('0x70')}]:[]};})};}})['then'](respondWithResult(_0x487e11,null))[_0x270f('0x3e')](function(_0x2cff08){var _0x11787f=_0x37eaf5['query'][_0x270f('0x71')]?0x1f4:_0x2cff08[_0x270f('0x72')]||0x1f4;logger[_0x270f('0x21')](_0x270f('0x73'),_0x270f('0x50'),_0x11787f,JSON[_0x270f('0x74')](_0x2cff08));delete _0x2cff08[_0x270f('0x22')];if(_0x11787f===0x191){_0x11787f=0x190;}_0x487e11[_0x270f('0x16')](_0x11787f)[_0x270f('0x23')](_0x37eaf5[_0x270f('0x2a')][_0x270f('0x71')]?{'message':_0x270f('0x75'),'statusCode':_0x2cff08['statusCode']}:_0x2cff08);});}; \ No newline at end of file +var _0x9ef8=['rows','catch','params','keys','create','body','find','getConfigurations','SalesforceConfiguration','pick','hasOwnProperty','addConfiguration','findOne','getSubjects','channel','Descriptions','SalesforceField','Subjects','remoteUri','clientId','username','password','slice','lastIndexOf','clientSecret','securityToken','isNil','sobject','describe','OwnerId','IsRecurrence','Subject','Description','string','picklist','boolean','textarea','phone','remove','includes','label','picklistValues','value','True','False','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','undefined','count','offset','limit','set','json','apply','reject','save','update','destroy','then','stack','name','send','index','SalesforceAccount','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','fields','attributes','length','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll'];(function(_0x4d885a,_0x57fb79){var _0x3b43fd=function(_0x3136c1){while(--_0x3136c1){_0x4d885a['push'](_0x4d885a['shift']());}};_0x3b43fd(++_0x57fb79);}(_0x9ef8,0xa5));var _0x89ef=function(_0x254081,_0x20731a){_0x254081=_0x254081-0x0;var _0x5d1e2a=_0x9ef8[_0x254081];return _0x5d1e2a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x89ef('0x0'));var rp=require('request-promise');var moment=require(_0x89ef('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x89ef('0x2'));var util=require(_0x89ef('0x3'));var path=require(_0x89ef('0x4'));var sox=require(_0x89ef('0x5'));var csv=require('to-csv');var ejs=require(_0x89ef('0x6'));var fs=require('fs');var fs_extra=require(_0x89ef('0x7'));var _=require(_0x89ef('0x8'));var squel=require(_0x89ef('0x9'));var crypto=require(_0x89ef('0xa'));var jsforce=require(_0x89ef('0xb'));var deskjs=require(_0x89ef('0xc'));var toCsv=require(_0x89ef('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x89ef('0xe'));var authService=require(_0x89ef('0xf'));var qs=require(_0x89ef('0x10'));var as=require(_0x89ef('0x11'));var hardwareService=require(_0x89ef('0x12'));var logger=require(_0x89ef('0x13'))(_0x89ef('0x14'));var utils=require(_0x89ef('0x15'));var config=require(_0x89ef('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x89ef('0x17'))['db'];var integrations=require(_0x89ef('0x18'));function respondWithStatusCode(_0x2b4795,_0x45e8fd){_0x45e8fd=_0x45e8fd||0xcc;return function(_0x423ea1){if(_0x423ea1){return _0x2b4795[_0x89ef('0x19')](_0x45e8fd);}return _0x2b4795['status'](_0x45e8fd)[_0x89ef('0x1a')]();};}function respondWithResult(_0x428c94,_0x1e304e){_0x1e304e=_0x1e304e||0xc8;return function(_0x35397c){if(_0x35397c){return _0x428c94[_0x89ef('0x1b')](_0x1e304e)['json'](_0x35397c);}};}function respondWithFilteredResult(_0x2a3c7a,_0x361376){return function(_0x5f1a79){if(_0x5f1a79){var _0x32514e=typeof _0x361376['offset']===_0x89ef('0x1c')&&typeof _0x361376['limit']===_0x89ef('0x1c');var _0x5cae28=_0x5f1a79[_0x89ef('0x1d')];var _0x42f34a=_0x32514e?0x0:_0x361376['offset'];var _0x27fe64=_0x32514e?_0x5f1a79[_0x89ef('0x1d')]:_0x361376[_0x89ef('0x1e')]+_0x361376[_0x89ef('0x1f')];var _0x46df40;if(_0x27fe64>=_0x5cae28){_0x27fe64=_0x5cae28;_0x46df40=0xc8;}else{_0x46df40=0xce;}_0x2a3c7a[_0x89ef('0x1b')](_0x46df40);return _0x2a3c7a[_0x89ef('0x20')]('Content-Range',_0x42f34a+'-'+_0x27fe64+'/'+_0x5cae28)[_0x89ef('0x21')](_0x5f1a79);}return null;};}function patchUpdates(_0x48167e){return function(_0x376c60){try{jsonpatch[_0x89ef('0x22')](_0x376c60,_0x48167e,!![]);}catch(_0x58e2cd){return BPromise[_0x89ef('0x23')](_0x58e2cd);}return _0x376c60[_0x89ef('0x24')]();};}function saveUpdates(_0x1ab6f3,_0x2b76b6){return function(_0x1ea5c5){if(_0x1ea5c5){return _0x1ea5c5[_0x89ef('0x25')](_0x1ab6f3)['then'](function(_0x597b4d){return _0x597b4d;});}return null;};}function removeEntity(_0x396332,_0x4711ef){return function(_0x4e76da){if(_0x4e76da){return _0x4e76da[_0x89ef('0x26')]()[_0x89ef('0x27')](function(){_0x396332[_0x89ef('0x1b')](0xcc)[_0x89ef('0x1a')]();});}};}function handleEntityNotFound(_0x6308e3,_0x4abb5a){return function(_0x51e468){if(!_0x51e468){_0x6308e3[_0x89ef('0x19')](0x194);}return _0x51e468;};}function handleError(_0x5f45c9,_0x413699){_0x413699=_0x413699||0x1f4;return function(_0x4b2d95){logger['error'](_0x4b2d95[_0x89ef('0x28')]);if(_0x4b2d95[_0x89ef('0x29')]){delete _0x4b2d95[_0x89ef('0x29')];}_0x5f45c9['status'](_0x413699)[_0x89ef('0x2a')](_0x4b2d95);};}exports[_0x89ef('0x2b')]=function(_0x22f6b6,_0x3f6203){var _0x5e41ee={},_0x1bd396={},_0xcb8cdd={'count':0x0,'rows':[]};var _0xd88a93=_['map'](db[_0x89ef('0x2c')][_0x89ef('0x2d')],function(_0x3f4a6a){return{'name':_0x3f4a6a[_0x89ef('0x2e')],'type':_0x3f4a6a[_0x89ef('0x2f')][_0x89ef('0x30')]};});_0x1bd396['model']=_[_0x89ef('0x31')](_0xd88a93,_0x89ef('0x29'));_0x1bd396[_0x89ef('0x32')]=_['keys'](_0x22f6b6['query']);_0x1bd396[_0x89ef('0x33')]=_[_0x89ef('0x34')](_0x1bd396['model'],_0x1bd396[_0x89ef('0x32')]);_0x5e41ee['attributes']=_[_0x89ef('0x34')](_0x1bd396[_0x89ef('0x35')],qs[_0x89ef('0x36')](_0x22f6b6[_0x89ef('0x32')][_0x89ef('0x36')]));_0x5e41ee[_0x89ef('0x37')]=_0x5e41ee[_0x89ef('0x37')][_0x89ef('0x38')]?_0x5e41ee[_0x89ef('0x37')]:_0x1bd396[_0x89ef('0x35')];if(!_0x22f6b6['query']['hasOwnProperty']('nolimit')){_0x5e41ee[_0x89ef('0x1f')]=qs['limit'](_0x22f6b6[_0x89ef('0x32')][_0x89ef('0x1f')]);_0x5e41ee[_0x89ef('0x1e')]=qs[_0x89ef('0x1e')](_0x22f6b6['query'][_0x89ef('0x1e')]);}_0x5e41ee[_0x89ef('0x39')]=qs[_0x89ef('0x3a')](_0x22f6b6[_0x89ef('0x32')][_0x89ef('0x3a')]);_0x5e41ee[_0x89ef('0x3b')]=qs[_0x89ef('0x33')](_['pick'](_0x22f6b6[_0x89ef('0x32')],_0x1bd396['filters']),_0xd88a93);if(_0x22f6b6[_0x89ef('0x32')][_0x89ef('0x3c')]){_0x5e41ee['where']=_['merge'](_0x5e41ee[_0x89ef('0x3b')],{'$or':_[_0x89ef('0x31')](_0xd88a93,function(_0x52d881){if(_0x52d881[_0x89ef('0x2f')]!==_0x89ef('0x3d')){var _0x31ec1f={};_0x31ec1f[_0x52d881[_0x89ef('0x29')]]={'$like':'%'+_0x22f6b6['query'][_0x89ef('0x3c')]+'%'};return _0x31ec1f;}})});}_0x5e41ee=_[_0x89ef('0x3e')]({},_0x5e41ee,_0x22f6b6[_0x89ef('0x3f')]);var _0x4179b8={'where':_0x5e41ee['where']};return db[_0x89ef('0x2c')][_0x89ef('0x1d')](_0x4179b8)[_0x89ef('0x27')](function(_0x250dc6){_0xcb8cdd['count']=_0x250dc6;if(_0x22f6b6[_0x89ef('0x32')][_0x89ef('0x40')]){_0x5e41ee[_0x89ef('0x41')]=[{'all':!![]}];}return db[_0x89ef('0x2c')][_0x89ef('0x42')](_0x5e41ee);})[_0x89ef('0x27')](function(_0x58da06){_0xcb8cdd[_0x89ef('0x43')]=_0x58da06;return _0xcb8cdd;})[_0x89ef('0x27')](respondWithFilteredResult(_0x3f6203,_0x5e41ee))[_0x89ef('0x44')](handleError(_0x3f6203,null));};exports['show']=function(_0x39d434,_0x2ba209){var _0x18deca={'raw':![],'where':{'id':_0x39d434[_0x89ef('0x45')]['id']}},_0x1be49c={};_0x1be49c[_0x89ef('0x35')]=_[_0x89ef('0x46')](db['SalesforceAccount'][_0x89ef('0x2d')]);_0x1be49c['query']=_[_0x89ef('0x46')](_0x39d434[_0x89ef('0x32')]);_0x1be49c[_0x89ef('0x33')]=_[_0x89ef('0x34')](_0x1be49c['model'],_0x1be49c[_0x89ef('0x32')]);_0x18deca[_0x89ef('0x37')]=_[_0x89ef('0x34')](_0x1be49c[_0x89ef('0x35')],qs[_0x89ef('0x36')](_0x39d434[_0x89ef('0x32')][_0x89ef('0x36')]));_0x18deca['attributes']=_0x18deca[_0x89ef('0x37')]['length']?_0x18deca[_0x89ef('0x37')]:_0x1be49c[_0x89ef('0x35')];if(_0x39d434[_0x89ef('0x32')][_0x89ef('0x40')]){_0x18deca[_0x89ef('0x41')]=[{'all':!![]}];}_0x18deca=_[_0x89ef('0x3e')]({},_0x18deca,_0x39d434[_0x89ef('0x3f')]);return db['SalesforceAccount']['find'](_0x18deca)['then'](handleEntityNotFound(_0x2ba209,null))[_0x89ef('0x27')](respondWithResult(_0x2ba209,null))[_0x89ef('0x44')](handleError(_0x2ba209,null));};exports['create']=function(_0x2fd8f5,_0x28ea0a){return db[_0x89ef('0x2c')][_0x89ef('0x47')](_0x2fd8f5[_0x89ef('0x48')],{})[_0x89ef('0x27')](respondWithResult(_0x28ea0a,0xc9))[_0x89ef('0x44')](handleError(_0x28ea0a,null));};exports['update']=function(_0x51e354,_0x565ce0){if(_0x51e354['body']['id']){delete _0x51e354[_0x89ef('0x48')]['id'];}return db['SalesforceAccount'][_0x89ef('0x49')]({'where':{'id':_0x51e354[_0x89ef('0x45')]['id']}})['then'](handleEntityNotFound(_0x565ce0,null))[_0x89ef('0x27')](saveUpdates(_0x51e354[_0x89ef('0x48')],null))['then'](respondWithResult(_0x565ce0,null))[_0x89ef('0x44')](handleError(_0x565ce0,null));};exports[_0x89ef('0x26')]=function(_0xc64ca8,_0x3a0b1f){return db[_0x89ef('0x2c')]['find']({'where':{'id':_0xc64ca8[_0x89ef('0x45')]['id']}})[_0x89ef('0x27')](handleEntityNotFound(_0x3a0b1f,null))[_0x89ef('0x27')](removeEntity(_0x3a0b1f,null))[_0x89ef('0x44')](handleError(_0x3a0b1f,null));};exports[_0x89ef('0x4a')]=function(_0x443ac8,_0x1b33ac,_0x3274a1){var _0x1d94d6={};var _0x3a21d1={};var _0x47e437;var _0x4d6853;return db[_0x89ef('0x2c')]['findOne']({'where':{'id':_0x443ac8['params']['id']}})[_0x89ef('0x27')](handleEntityNotFound(_0x1b33ac,null))['then'](function(_0x583bf2){if(_0x583bf2){_0x47e437=_0x583bf2;_0x3a21d1['model']=_[_0x89ef('0x46')](db[_0x89ef('0x4b')][_0x89ef('0x2d')]);_0x3a21d1[_0x89ef('0x32')]=_[_0x89ef('0x46')](_0x443ac8[_0x89ef('0x32')]);_0x3a21d1[_0x89ef('0x33')]=_[_0x89ef('0x34')](_0x3a21d1['model'],_0x3a21d1[_0x89ef('0x32')]);_0x1d94d6[_0x89ef('0x37')]=_[_0x89ef('0x34')](_0x3a21d1[_0x89ef('0x35')],qs[_0x89ef('0x36')](_0x443ac8[_0x89ef('0x32')]['fields']));_0x1d94d6[_0x89ef('0x37')]=_0x1d94d6[_0x89ef('0x37')][_0x89ef('0x38')]?_0x1d94d6['attributes']:_0x3a21d1[_0x89ef('0x35')];_0x1d94d6['order']=qs[_0x89ef('0x3a')](_0x443ac8[_0x89ef('0x32')][_0x89ef('0x3a')]);_0x1d94d6[_0x89ef('0x3b')]=qs[_0x89ef('0x33')](_[_0x89ef('0x4c')](_0x443ac8['query'],_0x3a21d1[_0x89ef('0x33')]));if(_0x443ac8[_0x89ef('0x32')][_0x89ef('0x3c')]){_0x1d94d6[_0x89ef('0x3b')]=_[_0x89ef('0x3e')](_0x1d94d6[_0x89ef('0x3b')],{'$or':_[_0x89ef('0x31')](_0x1d94d6[_0x89ef('0x37')],function(_0x1c8038){var _0x31afc7={};_0x31afc7[_0x1c8038]={'$like':'%'+_0x443ac8[_0x89ef('0x32')][_0x89ef('0x3c')]+'%'};return _0x31afc7;})});}_0x1d94d6=_[_0x89ef('0x3e')]({},_0x1d94d6,_0x443ac8[_0x89ef('0x3f')]);return _0x47e437[_0x89ef('0x4a')](_0x1d94d6);}})[_0x89ef('0x27')](function(_0xba5e5a){if(_0xba5e5a){_0x4d6853=_0xba5e5a[_0x89ef('0x38')];if(!_0x443ac8[_0x89ef('0x32')][_0x89ef('0x4d')]('nolimit')){_0x1d94d6[_0x89ef('0x1f')]=qs[_0x89ef('0x1f')](_0x443ac8['query'][_0x89ef('0x1f')]);_0x1d94d6[_0x89ef('0x1e')]=qs[_0x89ef('0x1e')](_0x443ac8[_0x89ef('0x32')][_0x89ef('0x1e')]);}return _0x47e437['getConfigurations'](_0x1d94d6);}})[_0x89ef('0x27')](function(_0x2ddc42){if(_0x2ddc42){return _0x2ddc42?{'count':_0x4d6853,'rows':_0x2ddc42}:null;}})['then'](respondWithResult(_0x1b33ac,null))[_0x89ef('0x44')](handleError(_0x1b33ac,null));};exports[_0x89ef('0x4e')]=function(_0xc65703,_0x1432a8,_0x17b4fa){if(_0xc65703[_0x89ef('0x48')]['id']){delete _0xc65703['body']['id'];}return db['SalesforceAccount'][_0x89ef('0x4f')]({'where':{'id':_0xc65703[_0x89ef('0x45')]['id']}})[_0x89ef('0x27')](handleEntityNotFound(_0x1432a8,null))[_0x89ef('0x27')](function(_0x155ae9){if(_0x155ae9){_0xc65703[_0x89ef('0x48')]['AccountId']=_0x155ae9['id'];_0xc65703[_0x89ef('0x48')]['Subjects']=integrations[_0x89ef('0x50')](_0xc65703[_0x89ef('0x48')][_0x89ef('0x51')],_0xc65703[_0x89ef('0x48')][_0x89ef('0x2f')]);_0xc65703[_0x89ef('0x48')][_0x89ef('0x52')]=integrations['getDescriptions'](_0xc65703[_0x89ef('0x48')][_0x89ef('0x51')],_0xc65703[_0x89ef('0x48')]['type']);return db[_0x89ef('0x4b')]['create'](_0xc65703['body'],{'include':[{'model':db[_0x89ef('0x53')],'as':_0x89ef('0x54')},{'model':db[_0x89ef('0x53')],'as':_0x89ef('0x52')}]});}return null;})[_0x89ef('0x27')](respondWithResult(_0x1432a8,null))[_0x89ef('0x44')](handleError(_0x1432a8,null));};exports['getFields']=function(_0x8adf24,_0x2463c3,_0x38d697){var _0x25511a;var _0x157383='';var _0x4a8446='Task';return db[_0x89ef('0x2c')]['findOne']({'where':{'id':_0x8adf24[_0x89ef('0x45')]['id']},'attributes':['id',_0x89ef('0x55'),_0x89ef('0x56'),'clientSecret',_0x89ef('0x57'),_0x89ef('0x58'),'securityToken']})['then'](handleEntityNotFound(_0x2463c3,null))[_0x89ef('0x27')](function(_0xdab80c){if(_0xdab80c){_0x157383=_0xdab80c['remoteUri'];var _0x5853ff=_0x157383[_0x89ef('0x59')](-0x1);if(_0x5853ff==='/'){_0x157383=_0x157383['substring'](0x0,_0x157383[_0x89ef('0x5a')](_0x5853ff));}_0x25511a=new jsforce['Connection']({'oauth2':{'loginUrl':_0x157383,'clientId':_0xdab80c[_0x89ef('0x56')],'clientSecret':_0xdab80c[_0x89ef('0x5b')]}});return _0x25511a['login'](_0xdab80c[_0x89ef('0x57')],_0xdab80c[_0x89ef('0x58')]['concat'](_0xdab80c[_0x89ef('0x5c')]));}})[_0x89ef('0x27')](function(_0xb230d5){if(_0xb230d5){if(!_[_0x89ef('0x5d')](_0x8adf24[_0x89ef('0x32')]['ticketType'])){_0x4a8446=_0x8adf24[_0x89ef('0x32')]['ticketType'];}return _0x25511a[_0x89ef('0x5e')](_0x4a8446)[_0x89ef('0x5f')]();}})[_0x89ef('0x27')](function(_0x56c28a){var _0x3dcb33=[_0x89ef('0x60'),'ActivityDate','IsReminderSet',_0x89ef('0x61'),_0x89ef('0x62'),_0x89ef('0x63')];var _0x22efc6=[_0x89ef('0x64'),'int',_0x89ef('0x65'),_0x89ef('0x66'),'email',_0x89ef('0x67'),_0x89ef('0x68')];if(_0x56c28a){_[_0x89ef('0x69')](_0x56c28a[_0x89ef('0x36')],function(_0x577a11){return _0x3dcb33[_0x89ef('0x6a')](_0x577a11[_0x89ef('0x29')])||!_0x22efc6['includes'](_0x577a11[_0x89ef('0x2f')]);});return{'count':_0x56c28a[_0x89ef('0x36')][_0x89ef('0x38')],'rows':_[_0x89ef('0x31')](_0x56c28a[_0x89ef('0x36')],function(_0x4faec7){return{'id':_0x4faec7[_0x89ef('0x29')],'name':_0x4faec7[_0x89ef('0x6b')],'custom':_0x4faec7['custom'],'options':_0x4faec7[_0x89ef('0x6c')]['length']>0x0?_[_0x89ef('0x31')](_0x4faec7[_0x89ef('0x6c')],function(_0x31b2a1){return{'name':_0x31b2a1[_0x89ef('0x6b')],'value':_0x31b2a1[_0x89ef('0x6d')]};}):_0x4faec7['type']==_0x89ef('0x66')?[{'name':_0x89ef('0x6e'),'value':'true'},{'name':_0x89ef('0x6f'),'value':'false'}]:[]};})};}})[_0x89ef('0x27')](respondWithResult(_0x2463c3,null))['catch'](function(_0x310ee4){var _0x37bd6d=_0x8adf24[_0x89ef('0x32')][_0x89ef('0x70')]?0x1f4:_0x310ee4[_0x89ef('0x71')]||0x1f4;logger[_0x89ef('0x72')](_0x89ef('0x73'),'getFields',_0x37bd6d,JSON['stringify'](_0x310ee4));delete _0x310ee4['name'];if(_0x37bd6d===0x191){_0x37bd6d=0x190;}_0x2463c3[_0x89ef('0x1b')](_0x37bd6d)[_0x89ef('0x2a')](_0x8adf24[_0x89ef('0x32')][_0x89ef('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x310ee4[_0x89ef('0x71')]}:_0x310ee4);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 4d85a98..d978702 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 _0x67f8=['api','bluebird','request-promise','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger'];(function(_0x295788,_0x35065e){var _0x460314=function(_0x5c9c4f){while(--_0x5c9c4f){_0x295788['push'](_0x295788['shift']());}};_0x460314(++_0x35065e);}(_0x67f8,0x105));var _0x867f=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x67f8[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x867f('0x0'));var util=require(_0x867f('0x1'));var logger=require(_0x867f('0x2'))(_0x867f('0x3'));var moment=require('moment');var BPromise=require(_0x867f('0x4'));var rp=require(_0x867f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x867f('0x6'));var config=require('../../config/environment');var attributes=require(_0x867f('0x7'));var integrations=require(_0x867f('0x8'));module['exports']=function(_0x547c7d,_0x19f2d9){return _0x547c7d[_0x867f('0x9')](_0x867f('0xa'),attributes,{'tableName':_0x867f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2dd2=['../../components/integrations/configuration','define','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x327143,_0x37aa94){var _0x5c7789=function(_0x163e25){while(--_0x163e25){_0x327143['push'](_0x327143['shift']());}};_0x5c7789(++_0x37aa94);}(_0x2dd2,0x89));var _0x22dd=function(_0xc0f8a4,_0x590a5f){_0xc0f8a4=_0xc0f8a4-0x0;var _0x358cad=_0x2dd2[_0xc0f8a4];return _0x358cad;};'use strict';var _=require(_0x22dd('0x0'));var util=require('util');var logger=require(_0x22dd('0x1'))('api');var moment=require(_0x22dd('0x2'));var BPromise=require(_0x22dd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x22dd('0x4'));var rimraf=require(_0x22dd('0x5'));var config=require(_0x22dd('0x6'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x22dd('0x7'));module['exports']=function(_0x18623c,_0x462fdd){return _0x18623c[_0x22dd('0x8')]('SalesforceAccount',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 74d49cc..230f2e7 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 _0x4137=['stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','GetSalesforceAccount','findAll','options','raw','where','attributes','limit','include','model','map','then','catch','ShowSalesforceAccount','SalesforceAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s'];(function(_0x253fd9,_0x3500f4){var _0x495424=function(_0x578942){while(--_0x578942){_0x253fd9['push'](_0x253fd9['shift']());}};_0x495424(++_0x3500f4);}(_0x4137,0xf8));var _0x7413=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x4137[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});}exports[_0x7413('0x17')]=function(_0x19157f){var _0x12a01e=this;return new Promise(function(_0x2a3417,_0x26dafe){return db['SalesforceAccount'][_0x7413('0x18')]({'raw':_0x19157f[_0x7413('0x19')]?_0x19157f[_0x7413('0x19')][_0x7413('0x1a')]===undefined?!![]:![]:!![],'where':_0x19157f['options']?_0x19157f[_0x7413('0x19')][_0x7413('0x1b')]||null:null,'attributes':_0x19157f[_0x7413('0x19')]?_0x19157f[_0x7413('0x19')][_0x7413('0x1c')]||null:null,'limit':_0x19157f[_0x7413('0x19')]?_0x19157f[_0x7413('0x19')][_0x7413('0x1d')]||null:null,'include':_0x19157f['options']?_0x19157f['options'][_0x7413('0x1e')]?_['map'](_0x19157f[_0x7413('0x19')][_0x7413('0x1e')],function(_0x3b0c81){return{'model':db[_0x3b0c81[_0x7413('0x1f')]],'as':_0x3b0c81['as'],'attributes':_0x3b0c81[_0x7413('0x1c')],'include':_0x3b0c81[_0x7413('0x1e')]?_[_0x7413('0x20')](_0x3b0c81[_0x7413('0x1e')],function(_0x1d455b){return{'model':db[_0x1d455b['model']],'as':_0x1d455b['as'],'attributes':_0x1d455b['attributes'],'include':_0x1d455b[_0x7413('0x1e')]?_['map'](_0x1d455b[_0x7413('0x1e')],function(_0x71cbb4){return{'model':db[_0x71cbb4[_0x7413('0x1f')]],'as':_0x71cbb4['as'],'attributes':_0x71cbb4['attributes']};}):[]};}):[]};}):[]:[]})[_0x7413('0x21')](function(_0x896552){logger[_0x7413('0xe')](_0x7413('0x17'),_0x19157f);logger[_0x7413('0x10')](_0x7413('0x17'),_0x19157f,JSON['stringify'](_0x896552));_0x2a3417(_0x896552);})[_0x7413('0x22')](function(_0x4ed662){logger[_0x7413('0x13')](_0x7413('0x17'),_0x4ed662[_0x7413('0x16')],_0x19157f);_0x26dafe(_0x12a01e[_0x7413('0x13')](0x1f4,_0x4ed662[_0x7413('0x16')]));});});};exports[_0x7413('0x23')]=function(_0x5bb3ea){var _0x1ffb6f=this;return new Promise(function(_0x17c342,_0x39db32){return db[_0x7413('0x24')][_0x7413('0x25')]({'raw':_0x5bb3ea[_0x7413('0x19')]?_0x5bb3ea[_0x7413('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5bb3ea[_0x7413('0x19')]?_0x5bb3ea[_0x7413('0x19')][_0x7413('0x1b')]||null:null,'attributes':_0x5bb3ea[_0x7413('0x19')]?_0x5bb3ea[_0x7413('0x19')]['attributes']||null:null,'include':_0x5bb3ea[_0x7413('0x19')]?_0x5bb3ea['options'][_0x7413('0x1e')]?_[_0x7413('0x20')](_0x5bb3ea[_0x7413('0x19')]['include'],function(_0xe6b096){return{'model':db[_0xe6b096['model']],'as':_0xe6b096['as'],'attributes':_0xe6b096[_0x7413('0x1c')],'include':_0xe6b096[_0x7413('0x1e')]?_['map'](_0xe6b096['include'],function(_0x440bfe){return{'model':db[_0x440bfe[_0x7413('0x1f')]],'as':_0x440bfe['as'],'attributes':_0x440bfe[_0x7413('0x1c')],'include':_0x440bfe['include']?_['map'](_0x440bfe[_0x7413('0x1e')],function(_0x5a92ab){return{'model':db[_0x5a92ab['model']],'as':_0x5a92ab['as'],'attributes':_0x5a92ab[_0x7413('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ad12d){logger[_0x7413('0xe')](_0x7413('0x23'),_0x5bb3ea);logger[_0x7413('0x10')](_0x7413('0x23'),_0x5bb3ea,JSON['stringify'](_0x3ad12d));_0x17c342(_0x3ad12d);})[_0x7413('0x22')](function(_0x8dc047){logger[_0x7413('0x13')](_0x7413('0x23'),_0x8dc047[_0x7413('0x16')],_0x5bb3ea);_0x39db32(_0x1ffb6f[_0x7413('0x13')](0x1f4,_0x8dc047[_0x7413('0x16')]));});});}; \ No newline at end of file +var _0x3c55=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetSalesforceAccount','SalesforceAccount','findAll','options','attributes','limit','include','model','map','then','catch','raw','where','ShowSalesforceAccount','lodash','util','moment','bluebird','../../config/utils'];(function(_0x395518,_0x50794d){var _0x13706e=function(_0x2beba3){while(--_0x2beba3){_0x395518['push'](_0x395518['shift']());}};_0x13706e(++_0x50794d);}(_0x3c55,0x163));var _0x53c5=function(_0x4c7fc8,_0x41d13a){_0x4c7fc8=_0x4c7fc8-0x0;var _0x4fc0a9=_0x3c55[_0x4c7fc8];return _0x4fc0a9;};'use strict';var _=require(_0x53c5('0x0'));var util=require(_0x53c5('0x1'));var moment=require(_0x53c5('0x2'));var BPromise=require(_0x53c5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x53c5('0x4'));var logger=require(_0x53c5('0x5'))(_0x53c5('0x6'));var config=require(_0x53c5('0x7'));var jayson=require(_0x53c5('0x8'));var client=jayson[_0x53c5('0x9')][_0x53c5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51ca8c,_0x3d58a,_0x19d49a){return new BPromise(function(_0x314420,_0xa14518){return client[_0x53c5('0xb')](_0x51ca8c,_0x19d49a)['then'](function(_0x466ca0){logger[_0x53c5('0xc')](_0x53c5('0xd'),_0x3d58a,_0x53c5('0xe'));logger[_0x53c5('0xf')](_0x53c5('0x10'),_0x3d58a,'request\x20sent',JSON[_0x53c5('0x11')](_0x466ca0));if(_0x466ca0[_0x53c5('0x12')]){if(_0x466ca0[_0x53c5('0x12')][_0x53c5('0x13')]===0x1f4){logger[_0x53c5('0x12')](_0x53c5('0xd'),_0x3d58a,_0x466ca0[_0x53c5('0x12')][_0x53c5('0x14')]);return _0xa14518(_0x466ca0['error'][_0x53c5('0x14')]);}logger[_0x53c5('0x12')](_0x53c5('0xd'),_0x3d58a,_0x466ca0['error'][_0x53c5('0x14')]);return _0x314420(_0x466ca0[_0x53c5('0x12')]['message']);}else{logger[_0x53c5('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x3d58a,'request\x20sent');_0x314420(_0x466ca0[_0x53c5('0x15')][_0x53c5('0x14')]);}})['catch'](function(_0x565558){logger[_0x53c5('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x3d58a,_0x565558);_0xa14518(_0x565558);});});}exports[_0x53c5('0x16')]=function(_0x214be6){var _0xcfe80=this;return new Promise(function(_0x17ddd6,_0x31bf9d){return db[_0x53c5('0x17')][_0x53c5('0x18')]({'raw':_0x214be6[_0x53c5('0x19')]?_0x214be6['options']['raw']===undefined?!![]:![]:!![],'where':_0x214be6[_0x53c5('0x19')]?_0x214be6[_0x53c5('0x19')]['where']||null:null,'attributes':_0x214be6['options']?_0x214be6[_0x53c5('0x19')][_0x53c5('0x1a')]||null:null,'limit':_0x214be6['options']?_0x214be6['options'][_0x53c5('0x1b')]||null:null,'include':_0x214be6[_0x53c5('0x19')]?_0x214be6['options']['include']?_['map'](_0x214be6['options'][_0x53c5('0x1c')],function(_0xcd277d){return{'model':db[_0xcd277d[_0x53c5('0x1d')]],'as':_0xcd277d['as'],'attributes':_0xcd277d[_0x53c5('0x1a')],'include':_0xcd277d[_0x53c5('0x1c')]?_[_0x53c5('0x1e')](_0xcd277d[_0x53c5('0x1c')],function(_0x40eee7){return{'model':db[_0x40eee7[_0x53c5('0x1d')]],'as':_0x40eee7['as'],'attributes':_0x40eee7[_0x53c5('0x1a')],'include':_0x40eee7['include']?_[_0x53c5('0x1e')](_0x40eee7['include'],function(_0x1a9dbc){return{'model':db[_0x1a9dbc[_0x53c5('0x1d')]],'as':_0x1a9dbc['as'],'attributes':_0x1a9dbc[_0x53c5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x53c5('0x1f')](function(_0x209277){logger[_0x53c5('0xc')](_0x53c5('0x16'),_0x214be6);logger[_0x53c5('0xf')]('GetSalesforceAccount',_0x214be6,JSON[_0x53c5('0x11')](_0x209277));_0x17ddd6(_0x209277);})[_0x53c5('0x20')](function(_0x508b1b){logger[_0x53c5('0x12')]('GetSalesforceAccount',_0x508b1b[_0x53c5('0x14')],_0x214be6);_0x31bf9d(_0xcfe80[_0x53c5('0x12')](0x1f4,_0x508b1b[_0x53c5('0x14')]));});});};exports['ShowSalesforceAccount']=function(_0x1c3d94){var _0x49297b=this;return new Promise(function(_0x5680cc,_0x35da40){return db['SalesforceAccount']['find']({'raw':_0x1c3d94[_0x53c5('0x19')]?_0x1c3d94[_0x53c5('0x19')][_0x53c5('0x21')]===undefined?!![]:![]:!![],'where':_0x1c3d94[_0x53c5('0x19')]?_0x1c3d94[_0x53c5('0x19')][_0x53c5('0x22')]||null:null,'attributes':_0x1c3d94['options']?_0x1c3d94['options'][_0x53c5('0x1a')]||null:null,'include':_0x1c3d94[_0x53c5('0x19')]?_0x1c3d94[_0x53c5('0x19')][_0x53c5('0x1c')]?_[_0x53c5('0x1e')](_0x1c3d94['options']['include'],function(_0x4d1c93){return{'model':db[_0x4d1c93[_0x53c5('0x1d')]],'as':_0x4d1c93['as'],'attributes':_0x4d1c93['attributes'],'include':_0x4d1c93[_0x53c5('0x1c')]?_[_0x53c5('0x1e')](_0x4d1c93[_0x53c5('0x1c')],function(_0x357f59){return{'model':db[_0x357f59['model']],'as':_0x357f59['as'],'attributes':_0x357f59[_0x53c5('0x1a')],'include':_0x357f59[_0x53c5('0x1c')]?_['map'](_0x357f59[_0x53c5('0x1c')],function(_0x4301bd){return{'model':db[_0x4301bd[_0x53c5('0x1d')]],'as':_0x4301bd['as'],'attributes':_0x4301bd[_0x53c5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x55a06d){logger[_0x53c5('0xc')]('ShowSalesforceAccount',_0x1c3d94);logger[_0x53c5('0xf')](_0x53c5('0x23'),_0x1c3d94,JSON['stringify'](_0x55a06d));_0x5680cc(_0x55a06d);})['catch'](function(_0x5692b3){logger[_0x53c5('0x12')]('ShowSalesforceAccount',_0x5692b3['message'],_0x1c3d94);_0x35da40(_0x49297b[_0x53c5('0x12')](0x1f4,_0x5692b3[_0x53c5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 012586b..94b796f 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 _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x29f9fc,_0xe19878){var _0x53df10=function(_0x4d8a55){while(--_0x4d8a55){_0x29f9fc['push'](_0x29f9fc['shift']());}};_0x53df10(++_0xe19878);}(_0x5f2f,0x73));var _0xf5f2=function(_0x31f7e3,_0x236b6e){_0x31f7e3=_0x31f7e3-0x0;var _0x1414e9=_0x5f2f[_0x31f7e3];return _0x1414e9;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file +var _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x5d6edc,_0x3a314c){var _0x223b1c=function(_0xee9d6e){while(--_0xee9d6e){_0x5d6edc['push'](_0x5d6edc['shift']());}};_0x223b1c(++_0x3a314c);}(_0x2ef3,0xba));var _0x32ef=function(_0x25c5f4,_0x5ac98f){_0x25c5f4=_0x25c5f4-0x0;var _0x125c20=_0x2ef3[_0x25c5f4];return _0x125c20;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index d19f69b..0982e92 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 _0x4d37=['nothing','account','sequelize','exports','STRING','ENUM','Case','Task','contact_lead','contact','lead','account_contact_lead'];(function(_0x3155c4,_0x67295b){var _0x53d2c8=function(_0x23bbca){while(--_0x23bbca){_0x3155c4['push'](_0x3155c4['shift']());}};_0x53d2c8(++_0x67295b);}(_0x4d37,0xe6));var _0x74d3=function(_0xac56ce,_0xb73e4){_0xac56ce=_0xac56ce-0x0;var _0x5105e1=_0x4d37[_0xac56ce];return _0x5105e1;};'use strict';var Sequelize=require(_0x74d3('0x0'));module[_0x74d3('0x1')]={'name':{'type':Sequelize[_0x74d3('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x74d3('0x3')]('Task',_0x74d3('0x4')),'defaultValue':_0x74d3('0x5')},'moduleSearch':{'type':Sequelize[_0x74d3('0x3')](_0x74d3('0x6'),_0x74d3('0x7'),_0x74d3('0x8'),_0x74d3('0x9'),'account'),'defaultValue':_0x74d3('0x6')},'moduleCreate':{'type':Sequelize[_0x74d3('0x3')](_0x74d3('0xa'),_0x74d3('0x7'),'lead',_0x74d3('0xb')),'defaultValue':_0x74d3('0x8')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0x74d3('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x74d3('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7bda=['ENUM','Task','Case','contact_lead','lead','account_contact_lead','account','nothing','contact','sequelize','exports','STRING'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x7bda,0x171));var _0xa7bd=function(_0x57d1ed,_0x3b65af){_0x57d1ed=_0x57d1ed-0x0;var _0x3c8375=_0x7bda[_0x57d1ed];return _0x3c8375;};'use strict';var Sequelize=require(_0xa7bd('0x0'));module[_0xa7bd('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa7bd('0x2')]},'ticketType':{'type':Sequelize[_0xa7bd('0x3')](_0xa7bd('0x4'),_0xa7bd('0x5')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xa7bd('0x3')](_0xa7bd('0x6'),'contact',_0xa7bd('0x7'),_0xa7bd('0x8'),_0xa7bd('0x9')),'defaultValue':_0xa7bd('0x6')},'moduleCreate':{'type':Sequelize[_0xa7bd('0x3')](_0xa7bd('0xa'),_0xa7bd('0xb'),_0xa7bd('0x7'),_0xa7bd('0x9')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0xa7bd('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xa7bd('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xa7bd('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xa7bd('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 202df92..65a1860 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 _0x7abb=['findOne','SalesforceField','filter','getFields','getSubjects','getDescriptions','eml-format','fast-json-patch','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','status','undefined','limit','count','offset','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body'];(function(_0x20237d,_0x506c3d){var _0x5a5b92=function(_0xdca92d){while(--_0xdca92d){_0x20237d['push'](_0x20237d['shift']());}};_0x5a5b92(++_0x506c3d);}(_0x7abb,0xea));var _0xb7ab=function(_0x13a8b9,_0xd4f9a5){_0x13a8b9=_0x13a8b9-0x0;var _0x3e27a1=_0x7abb[_0x13a8b9];return _0x3e27a1;};'use strict';var emlformat=require(_0xb7ab('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb7ab('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb7ab('0x2'));var Mustache=require(_0xb7ab('0x3'));var util=require(_0xb7ab('0x4'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb7ab('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb7ab('0x6'));var squel=require(_0xb7ab('0x7'));var crypto=require(_0xb7ab('0x8'));var jsforce=require(_0xb7ab('0x9'));var deskjs=require(_0xb7ab('0xa'));var toCsv=require(_0xb7ab('0xb'));var querystring=require(_0xb7ab('0xc'));var Papa=require(_0xb7ab('0xd'));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(_0xb7ab('0xe'));var logger=require(_0xb7ab('0xf'))(_0xb7ab('0x10'));var utils=require('../../config/utils');var config=require(_0xb7ab('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37038e,_0x406eec){_0x406eec=_0x406eec||0xcc;return function(_0x3c71f1){if(_0x3c71f1){return _0x37038e[_0xb7ab('0x12')](_0x406eec);}return _0x37038e['status'](_0x406eec)[_0xb7ab('0x13')]();};}function respondWithResult(_0x1a4ff5,_0x4030d6){_0x4030d6=_0x4030d6||0xc8;return function(_0x1551f9){if(_0x1551f9){return _0x1a4ff5[_0xb7ab('0x14')](_0x4030d6)['json'](_0x1551f9);}};}function respondWithFilteredResult(_0xbe6998,_0x283d6f){return function(_0xa84c9a){if(_0xa84c9a){var _0xc14cba=typeof _0x283d6f['offset']===_0xb7ab('0x15')&&typeof _0x283d6f[_0xb7ab('0x16')]==='undefined';var _0x2f685=_0xa84c9a[_0xb7ab('0x17')];var _0x11ab5d=_0xc14cba?0x0:_0x283d6f[_0xb7ab('0x18')];var _0x5ced64=_0xc14cba?_0xa84c9a[_0xb7ab('0x17')]:_0x283d6f[_0xb7ab('0x18')]+_0x283d6f[_0xb7ab('0x16')];var _0x4d0b86;if(_0x5ced64>=_0x2f685){_0x5ced64=_0x2f685;_0x4d0b86=0xc8;}else{_0x4d0b86=0xce;}_0xbe6998['status'](_0x4d0b86);return _0xbe6998[_0xb7ab('0x19')]('Content-Range',_0x11ab5d+'-'+_0x5ced64+'/'+_0x2f685)[_0xb7ab('0x1a')](_0xa84c9a);}return null;};}function patchUpdates(_0x45e8b4){return function(_0x4e403e){try{jsonpatch[_0xb7ab('0x1b')](_0x4e403e,_0x45e8b4,!![]);}catch(_0x281978){return BPromise[_0xb7ab('0x1c')](_0x281978);}return _0x4e403e[_0xb7ab('0x1d')]();};}function saveUpdates(_0x4e55c8,_0x307e99){return function(_0x1e1cf7){if(_0x1e1cf7){return _0x1e1cf7[_0xb7ab('0x1e')](_0x4e55c8)[_0xb7ab('0x1f')](function(_0x2a7517){return _0x2a7517;});}return null;};}function removeEntity(_0x3f3e8e,_0x2186dd){return function(_0x1c64e2){if(_0x1c64e2){return _0x1c64e2[_0xb7ab('0x20')]()['then'](function(){_0x3f3e8e[_0xb7ab('0x14')](0xcc)[_0xb7ab('0x13')]();});}};}function handleEntityNotFound(_0x32627e,_0x20d3ae){return function(_0x2ca84f){if(!_0x2ca84f){_0x32627e[_0xb7ab('0x12')](0x194);}return _0x2ca84f;};}function handleError(_0x2941a0,_0x115f32){_0x115f32=_0x115f32||0x1f4;return function(_0x5dcae4){logger[_0xb7ab('0x21')](_0x5dcae4[_0xb7ab('0x22')]);if(_0x5dcae4[_0xb7ab('0x23')]){delete _0x5dcae4[_0xb7ab('0x23')];}_0x2941a0[_0xb7ab('0x14')](_0x115f32)[_0xb7ab('0x24')](_0x5dcae4);};}exports[_0xb7ab('0x25')]=function(_0x135d8f,_0x1f4095){var _0x341e00={},_0x4f09d2={},_0x430ee9={'count':0x0,'rows':[]};var _0x1590b4=_[_0xb7ab('0x26')](db[_0xb7ab('0x27')][_0xb7ab('0x28')],function(_0x20fef4){return{'name':_0x20fef4[_0xb7ab('0x29')],'type':_0x20fef4[_0xb7ab('0x2a')][_0xb7ab('0x2b')]};});_0x4f09d2[_0xb7ab('0x2c')]=_['map'](_0x1590b4,_0xb7ab('0x23'));_0x4f09d2[_0xb7ab('0x2d')]=_[_0xb7ab('0x2e')](_0x135d8f[_0xb7ab('0x2d')]);_0x4f09d2[_0xb7ab('0x2f')]=_['intersection'](_0x4f09d2[_0xb7ab('0x2c')],_0x4f09d2['query']);_0x341e00['attributes']=_[_0xb7ab('0x30')](_0x4f09d2[_0xb7ab('0x2c')],qs['fields'](_0x135d8f[_0xb7ab('0x2d')][_0xb7ab('0x31')]));_0x341e00['attributes']=_0x341e00[_0xb7ab('0x32')][_0xb7ab('0x33')]?_0x341e00[_0xb7ab('0x32')]:_0x4f09d2[_0xb7ab('0x2c')];if(!_0x135d8f['query'][_0xb7ab('0x34')](_0xb7ab('0x35'))){_0x341e00[_0xb7ab('0x16')]=qs['limit'](_0x135d8f[_0xb7ab('0x2d')][_0xb7ab('0x16')]);_0x341e00['offset']=qs[_0xb7ab('0x18')](_0x135d8f['query'][_0xb7ab('0x18')]);}_0x341e00[_0xb7ab('0x36')]=qs[_0xb7ab('0x37')](_0x135d8f[_0xb7ab('0x2d')][_0xb7ab('0x37')]);_0x341e00[_0xb7ab('0x38')]=qs[_0xb7ab('0x2f')](_[_0xb7ab('0x39')](_0x135d8f[_0xb7ab('0x2d')],_0x4f09d2[_0xb7ab('0x2f')]),_0x1590b4);if(_0x135d8f[_0xb7ab('0x2d')]['filter']){_0x341e00['where']=_[_0xb7ab('0x3a')](_0x341e00[_0xb7ab('0x38')],{'$or':_[_0xb7ab('0x26')](_0x1590b4,function(_0x55049b){if(_0x55049b[_0xb7ab('0x2a')]!==_0xb7ab('0x3b')){var _0x4b5043={};_0x4b5043[_0x55049b[_0xb7ab('0x23')]]={'$like':'%'+_0x135d8f[_0xb7ab('0x2d')]['filter']+'%'};return _0x4b5043;}})});}_0x341e00=_[_0xb7ab('0x3a')]({},_0x341e00,_0x135d8f[_0xb7ab('0x3c')]);var _0x543596={'where':_0x341e00[_0xb7ab('0x38')]};return db[_0xb7ab('0x27')][_0xb7ab('0x17')](_0x543596)[_0xb7ab('0x1f')](function(_0x32cc3d){_0x430ee9[_0xb7ab('0x17')]=_0x32cc3d;if(_0x135d8f[_0xb7ab('0x2d')][_0xb7ab('0x3d')]){_0x341e00['include']=[{'all':!![]}];}return db[_0xb7ab('0x27')][_0xb7ab('0x3e')](_0x341e00);})[_0xb7ab('0x1f')](function(_0x126b63){_0x430ee9[_0xb7ab('0x3f')]=_0x126b63;return _0x430ee9;})[_0xb7ab('0x1f')](respondWithFilteredResult(_0x1f4095,_0x341e00))[_0xb7ab('0x40')](handleError(_0x1f4095,null));};exports['show']=function(_0xf98ea6,_0x1470c1){var _0x10c34c={'raw':![],'where':{'id':_0xf98ea6[_0xb7ab('0x41')]['id']}},_0x5244d4={};_0x5244d4[_0xb7ab('0x2c')]=_[_0xb7ab('0x2e')](db[_0xb7ab('0x27')][_0xb7ab('0x28')]);_0x5244d4[_0xb7ab('0x2d')]=_[_0xb7ab('0x2e')](_0xf98ea6['query']);_0x5244d4[_0xb7ab('0x2f')]=_[_0xb7ab('0x30')](_0x5244d4[_0xb7ab('0x2c')],_0x5244d4['query']);_0x10c34c[_0xb7ab('0x32')]=_[_0xb7ab('0x30')](_0x5244d4[_0xb7ab('0x2c')],qs[_0xb7ab('0x31')](_0xf98ea6[_0xb7ab('0x2d')][_0xb7ab('0x31')]));_0x10c34c['attributes']=_0x10c34c[_0xb7ab('0x32')][_0xb7ab('0x33')]?_0x10c34c[_0xb7ab('0x32')]:_0x5244d4[_0xb7ab('0x2c')];if(_0xf98ea6['query'][_0xb7ab('0x3d')]){_0x10c34c[_0xb7ab('0x42')]=[{'all':!![]}];}_0x10c34c=_[_0xb7ab('0x3a')]({},_0x10c34c,_0xf98ea6[_0xb7ab('0x3c')]);return db[_0xb7ab('0x27')][_0xb7ab('0x43')](_0x10c34c)[_0xb7ab('0x1f')](handleEntityNotFound(_0x1470c1,null))[_0xb7ab('0x1f')](respondWithResult(_0x1470c1,null))[_0xb7ab('0x40')](handleError(_0x1470c1,null));};exports[_0xb7ab('0x44')]=function(_0x40a09e,_0x3f9c71){return db['SalesforceConfiguration'][_0xb7ab('0x44')](_0x40a09e[_0xb7ab('0x45')],{})['then'](respondWithResult(_0x3f9c71,0xc9))[_0xb7ab('0x40')](handleError(_0x3f9c71,null));};exports['update']=function(_0x3a4e61,_0x4db2ba){if(_0x3a4e61['body']['id']){delete _0x3a4e61[_0xb7ab('0x45')]['id'];}return db['SalesforceConfiguration'][_0xb7ab('0x43')]({'where':{'id':_0x3a4e61[_0xb7ab('0x41')]['id']}})[_0xb7ab('0x1f')](handleEntityNotFound(_0x4db2ba,null))[_0xb7ab('0x1f')](saveUpdates(_0x3a4e61[_0xb7ab('0x45')],null))['then'](respondWithResult(_0x4db2ba,null))['catch'](handleError(_0x4db2ba,null));};exports[_0xb7ab('0x20')]=function(_0xf41a4c,_0x7156a7){return db['SalesforceConfiguration'][_0xb7ab('0x43')]({'where':{'id':_0xf41a4c[_0xb7ab('0x41')]['id']}})[_0xb7ab('0x1f')](handleEntityNotFound(_0x7156a7,null))['then'](removeEntity(_0x7156a7,null))['catch'](handleError(_0x7156a7,null));};exports['getFields']=function(_0x1062fe,_0x4bdfb3,_0x5b9e1b){var _0x4baaa9={};var _0x49cef6={};var _0x48827f;var _0x45c851;return db['SalesforceConfiguration'][_0xb7ab('0x46')]({'where':{'id':_0x1062fe[_0xb7ab('0x41')]['id']}})[_0xb7ab('0x1f')](handleEntityNotFound(_0x4bdfb3,null))[_0xb7ab('0x1f')](function(_0x1c21a1){if(_0x1c21a1){_0x48827f=_0x1c21a1;_0x49cef6['model']=_['keys'](db[_0xb7ab('0x47')][_0xb7ab('0x28')]);_0x49cef6[_0xb7ab('0x2d')]=_[_0xb7ab('0x2e')](_0x1062fe[_0xb7ab('0x2d')]);_0x49cef6[_0xb7ab('0x2f')]=_[_0xb7ab('0x30')](_0x49cef6[_0xb7ab('0x2c')],_0x49cef6[_0xb7ab('0x2d')]);_0x4baaa9[_0xb7ab('0x32')]=_['intersection'](_0x49cef6['model'],qs[_0xb7ab('0x31')](_0x1062fe[_0xb7ab('0x2d')][_0xb7ab('0x31')]));_0x4baaa9[_0xb7ab('0x32')]=_0x4baaa9['attributes']['length']?_0x4baaa9[_0xb7ab('0x32')]:_0x49cef6[_0xb7ab('0x2c')];_0x4baaa9[_0xb7ab('0x36')]=qs[_0xb7ab('0x37')](_0x1062fe[_0xb7ab('0x2d')]['sort']);_0x4baaa9[_0xb7ab('0x38')]=qs[_0xb7ab('0x2f')](_[_0xb7ab('0x39')](_0x1062fe[_0xb7ab('0x2d')],_0x49cef6[_0xb7ab('0x2f')]));if(_0x1062fe[_0xb7ab('0x2d')][_0xb7ab('0x48')]){_0x4baaa9[_0xb7ab('0x38')]=_[_0xb7ab('0x3a')](_0x4baaa9[_0xb7ab('0x38')],{'$or':_[_0xb7ab('0x26')](_0x4baaa9[_0xb7ab('0x32')],function(_0x363c4a){var _0x41a902={};_0x41a902[_0x363c4a]={'$like':'%'+_0x1062fe[_0xb7ab('0x2d')]['filter']+'%'};return _0x41a902;})});}_0x4baaa9=_[_0xb7ab('0x3a')]({},_0x4baaa9,_0x1062fe[_0xb7ab('0x3c')]);return _0x48827f[_0xb7ab('0x49')](_0x4baaa9);}})[_0xb7ab('0x1f')](function(_0x3ee9d0){if(_0x3ee9d0){_0x45c851=_0x3ee9d0[_0xb7ab('0x33')];if(!_0x1062fe[_0xb7ab('0x2d')][_0xb7ab('0x34')](_0xb7ab('0x35'))){_0x4baaa9['limit']=qs[_0xb7ab('0x16')](_0x1062fe[_0xb7ab('0x2d')][_0xb7ab('0x16')]);_0x4baaa9[_0xb7ab('0x18')]=qs[_0xb7ab('0x18')](_0x1062fe[_0xb7ab('0x2d')]['offset']);}return _0x48827f[_0xb7ab('0x49')](_0x4baaa9);}})[_0xb7ab('0x1f')](function(_0x536f26){if(_0x536f26){return _0x536f26?{'count':_0x45c851,'rows':_0x536f26}:null;}})[_0xb7ab('0x1f')](respondWithResult(_0x4bdfb3,null))['catch'](handleError(_0x4bdfb3,null));};exports[_0xb7ab('0x4a')]=function(_0x1f3c33,_0x5c8171,_0x5d273c){var _0x3cb23d={};var _0x320b69={};var _0x4d8391;var _0x1942fe;return db[_0xb7ab('0x27')][_0xb7ab('0x46')]({'where':{'id':_0x1f3c33[_0xb7ab('0x41')]['id']}})['then'](handleEntityNotFound(_0x5c8171,null))[_0xb7ab('0x1f')](function(_0x17460c){if(_0x17460c){_0x4d8391=_0x17460c;_0x320b69[_0xb7ab('0x2c')]=_[_0xb7ab('0x2e')](db[_0xb7ab('0x47')][_0xb7ab('0x28')]);_0x320b69['query']=_[_0xb7ab('0x2e')](_0x1f3c33[_0xb7ab('0x2d')]);_0x320b69['filters']=_[_0xb7ab('0x30')](_0x320b69[_0xb7ab('0x2c')],_0x320b69[_0xb7ab('0x2d')]);_0x3cb23d['attributes']=_[_0xb7ab('0x30')](_0x320b69[_0xb7ab('0x2c')],qs[_0xb7ab('0x31')](_0x1f3c33['query'][_0xb7ab('0x31')]));_0x3cb23d[_0xb7ab('0x32')]=_0x3cb23d[_0xb7ab('0x32')][_0xb7ab('0x33')]?_0x3cb23d['attributes']:_0x320b69[_0xb7ab('0x2c')];_0x3cb23d[_0xb7ab('0x36')]=qs[_0xb7ab('0x37')](_0x1f3c33['query'][_0xb7ab('0x37')]);_0x3cb23d[_0xb7ab('0x38')]=qs['filters'](_[_0xb7ab('0x39')](_0x1f3c33[_0xb7ab('0x2d')],_0x320b69[_0xb7ab('0x2f')]));if(_0x1f3c33[_0xb7ab('0x2d')][_0xb7ab('0x48')]){_0x3cb23d[_0xb7ab('0x38')]=_['merge'](_0x3cb23d['where'],{'$or':_[_0xb7ab('0x26')](_0x3cb23d[_0xb7ab('0x32')],function(_0x53bc2c){var _0x45d4c5={};_0x45d4c5[_0x53bc2c]={'$like':'%'+_0x1f3c33['query'][_0xb7ab('0x48')]+'%'};return _0x45d4c5;})});}_0x3cb23d=_['merge']({},_0x3cb23d,_0x1f3c33[_0xb7ab('0x3c')]);return _0x4d8391['getSubjects'](_0x3cb23d);}})[_0xb7ab('0x1f')](function(_0x447739){if(_0x447739){_0x1942fe=_0x447739[_0xb7ab('0x33')];if(!_0x1f3c33[_0xb7ab('0x2d')]['hasOwnProperty'](_0xb7ab('0x35'))){_0x3cb23d[_0xb7ab('0x16')]=qs[_0xb7ab('0x16')](_0x1f3c33[_0xb7ab('0x2d')]['limit']);_0x3cb23d[_0xb7ab('0x18')]=qs[_0xb7ab('0x18')](_0x1f3c33[_0xb7ab('0x2d')][_0xb7ab('0x18')]);}return _0x4d8391[_0xb7ab('0x4a')](_0x3cb23d);}})[_0xb7ab('0x1f')](function(_0x2d38c8){if(_0x2d38c8){return _0x2d38c8?{'count':_0x1942fe,'rows':_0x2d38c8}:null;}})['then'](respondWithResult(_0x5c8171,null))['catch'](handleError(_0x5c8171,null));};exports[_0xb7ab('0x4b')]=function(_0x4209ec,_0x2f27bd,_0x38441d){var _0x12e157={};var _0x3437f1={};var _0x8c2e83;var _0x2f6021;return db[_0xb7ab('0x27')][_0xb7ab('0x46')]({'where':{'id':_0x4209ec[_0xb7ab('0x41')]['id']}})['then'](handleEntityNotFound(_0x2f27bd,null))[_0xb7ab('0x1f')](function(_0x259956){if(_0x259956){_0x8c2e83=_0x259956;_0x3437f1[_0xb7ab('0x2c')]=_[_0xb7ab('0x2e')](db['SalesforceField'][_0xb7ab('0x28')]);_0x3437f1[_0xb7ab('0x2d')]=_['keys'](_0x4209ec[_0xb7ab('0x2d')]);_0x3437f1[_0xb7ab('0x2f')]=_[_0xb7ab('0x30')](_0x3437f1[_0xb7ab('0x2c')],_0x3437f1[_0xb7ab('0x2d')]);_0x12e157[_0xb7ab('0x32')]=_['intersection'](_0x3437f1[_0xb7ab('0x2c')],qs['fields'](_0x4209ec[_0xb7ab('0x2d')][_0xb7ab('0x31')]));_0x12e157[_0xb7ab('0x32')]=_0x12e157[_0xb7ab('0x32')][_0xb7ab('0x33')]?_0x12e157[_0xb7ab('0x32')]:_0x3437f1[_0xb7ab('0x2c')];_0x12e157['order']=qs[_0xb7ab('0x37')](_0x4209ec['query'][_0xb7ab('0x37')]);_0x12e157[_0xb7ab('0x38')]=qs['filters'](_[_0xb7ab('0x39')](_0x4209ec[_0xb7ab('0x2d')],_0x3437f1[_0xb7ab('0x2f')]));if(_0x4209ec[_0xb7ab('0x2d')][_0xb7ab('0x48')]){_0x12e157[_0xb7ab('0x38')]=_[_0xb7ab('0x3a')](_0x12e157[_0xb7ab('0x38')],{'$or':_[_0xb7ab('0x26')](_0x12e157[_0xb7ab('0x32')],function(_0x57e583){var _0x4169fd={};_0x4169fd[_0x57e583]={'$like':'%'+_0x4209ec[_0xb7ab('0x2d')]['filter']+'%'};return _0x4169fd;})});}_0x12e157=_['merge']({},_0x12e157,_0x4209ec[_0xb7ab('0x3c')]);return _0x8c2e83['getDescriptions'](_0x12e157);}})[_0xb7ab('0x1f')](function(_0x425575){if(_0x425575){_0x2f6021=_0x425575[_0xb7ab('0x33')];if(!_0x4209ec[_0xb7ab('0x2d')][_0xb7ab('0x34')](_0xb7ab('0x35'))){_0x12e157[_0xb7ab('0x16')]=qs[_0xb7ab('0x16')](_0x4209ec[_0xb7ab('0x2d')][_0xb7ab('0x16')]);_0x12e157['offset']=qs[_0xb7ab('0x18')](_0x4209ec['query'][_0xb7ab('0x18')]);}return _0x8c2e83['getDescriptions'](_0x12e157);}})[_0xb7ab('0x1f')](function(_0x31e3a3){if(_0x31e3a3){return _0x31e3a3?{'count':_0x2f6021,'rows':_0x31e3a3}:null;}})['then'](respondWithResult(_0x2f27bd,null))[_0xb7ab('0x40')](handleError(_0x2f27bd,null));}; \ No newline at end of file +var _0x25b2=['../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','SalesforceConfiguration','then','include','findAll','params','includeAll','find','create','body','catch','getFields','SalesforceField','hasOwnProperty','getSubjects','findOne','getDescriptions','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0xd566fe,_0x36cba1){var _0x41d3e4=function(_0x31e983){while(--_0x31e983){_0xd566fe['push'](_0xd566fe['shift']());}};_0x41d3e4(++_0x36cba1);}(_0x25b2,0x12e));var _0x225b=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x25b2[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x225b('0x0'));var jsonpatch=require(_0x225b('0x1'));var rp=require(_0x225b('0x2'));var moment=require(_0x225b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x225b('0x4'));var util=require(_0x225b('0x5'));var path=require(_0x225b('0x6'));var sox=require(_0x225b('0x7'));var csv=require(_0x225b('0x8'));var ejs=require(_0x225b('0x9'));var fs=require('fs');var fs_extra=require(_0x225b('0xa'));var _=require(_0x225b('0xb'));var squel=require('squel');var crypto=require(_0x225b('0xc'));var jsforce=require(_0x225b('0xd'));var deskjs=require(_0x225b('0xe'));var toCsv=require(_0x225b('0x8'));var querystring=require(_0x225b('0xf'));var Papa=require(_0x225b('0x10'));var Redis=require(_0x225b('0x11'));var authService=require(_0x225b('0x12'));var qs=require(_0x225b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x225b('0x14'));var logger=require(_0x225b('0x15'))('api');var utils=require(_0x225b('0x16'));var config=require(_0x225b('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x424f15,_0x5c8976){_0x5c8976=_0x5c8976||0xcc;return function(_0x5b1a36){if(_0x5b1a36){return _0x424f15[_0x225b('0x18')](_0x5c8976);}return _0x424f15[_0x225b('0x19')](_0x5c8976)[_0x225b('0x1a')]();};}function respondWithResult(_0x4bb2c5,_0x986b2d){_0x986b2d=_0x986b2d||0xc8;return function(_0xcb87de){if(_0xcb87de){return _0x4bb2c5['status'](_0x986b2d)['json'](_0xcb87de);}};}function respondWithFilteredResult(_0x38009b,_0x518697){return function(_0x133658){if(_0x133658){var _0x53cd9a=typeof _0x518697[_0x225b('0x1b')]===_0x225b('0x1c')&&typeof _0x518697['limit']===_0x225b('0x1c');var _0x32be6b=_0x133658[_0x225b('0x1d')];var _0x26085f=_0x53cd9a?0x0:_0x518697[_0x225b('0x1b')];var _0x3d8b20=_0x53cd9a?_0x133658['count']:_0x518697[_0x225b('0x1b')]+_0x518697[_0x225b('0x1e')];var _0x1b6ebd;if(_0x3d8b20>=_0x32be6b){_0x3d8b20=_0x32be6b;_0x1b6ebd=0xc8;}else{_0x1b6ebd=0xce;}_0x38009b[_0x225b('0x19')](_0x1b6ebd);return _0x38009b[_0x225b('0x1f')](_0x225b('0x20'),_0x26085f+'-'+_0x3d8b20+'/'+_0x32be6b)[_0x225b('0x21')](_0x133658);}return null;};}function patchUpdates(_0x23f3bb){return function(_0x323815){try{jsonpatch[_0x225b('0x22')](_0x323815,_0x23f3bb,!![]);}catch(_0x1bbc41){return BPromise['reject'](_0x1bbc41);}return _0x323815[_0x225b('0x23')]();};}function saveUpdates(_0x2074da,_0x2a977e){return function(_0x41b772){if(_0x41b772){return _0x41b772[_0x225b('0x24')](_0x2074da)['then'](function(_0x2cefd9){return _0x2cefd9;});}return null;};}function removeEntity(_0x89639,_0x56611f){return function(_0x3d078f){if(_0x3d078f){return _0x3d078f[_0x225b('0x25')]()['then'](function(){_0x89639[_0x225b('0x19')](0xcc)[_0x225b('0x1a')]();});}};}function handleEntityNotFound(_0x468525,_0xc1b507){return function(_0x5e9205){if(!_0x5e9205){_0x468525[_0x225b('0x18')](0x194);}return _0x5e9205;};}function handleError(_0x5259f7,_0x1faeba){_0x1faeba=_0x1faeba||0x1f4;return function(_0x85b682){logger[_0x225b('0x26')](_0x85b682[_0x225b('0x27')]);if(_0x85b682[_0x225b('0x28')]){delete _0x85b682[_0x225b('0x28')];}_0x5259f7['status'](_0x1faeba)[_0x225b('0x29')](_0x85b682);};}exports[_0x225b('0x2a')]=function(_0x29a46d,_0x2d4529){var _0x2ae085={},_0xc5021d={},_0x566792={'count':0x0,'rows':[]};var _0x2b0109=_[_0x225b('0x2b')](db['SalesforceConfiguration'][_0x225b('0x2c')],function(_0x8bb534){return{'name':_0x8bb534[_0x225b('0x2d')],'type':_0x8bb534[_0x225b('0x2e')][_0x225b('0x2f')]};});_0xc5021d[_0x225b('0x30')]=_[_0x225b('0x2b')](_0x2b0109,_0x225b('0x28'));_0xc5021d['query']=_[_0x225b('0x31')](_0x29a46d[_0x225b('0x32')]);_0xc5021d[_0x225b('0x33')]=_[_0x225b('0x34')](_0xc5021d[_0x225b('0x30')],_0xc5021d['query']);_0x2ae085[_0x225b('0x35')]=_[_0x225b('0x34')](_0xc5021d[_0x225b('0x30')],qs[_0x225b('0x36')](_0x29a46d[_0x225b('0x32')][_0x225b('0x36')]));_0x2ae085[_0x225b('0x35')]=_0x2ae085[_0x225b('0x35')][_0x225b('0x37')]?_0x2ae085['attributes']:_0xc5021d[_0x225b('0x30')];if(!_0x29a46d['query']['hasOwnProperty'](_0x225b('0x38'))){_0x2ae085['limit']=qs['limit'](_0x29a46d[_0x225b('0x32')][_0x225b('0x1e')]);_0x2ae085[_0x225b('0x1b')]=qs['offset'](_0x29a46d[_0x225b('0x32')][_0x225b('0x1b')]);}_0x2ae085[_0x225b('0x39')]=qs['sort'](_0x29a46d[_0x225b('0x32')][_0x225b('0x3a')]);_0x2ae085['where']=qs['filters'](_[_0x225b('0x3b')](_0x29a46d[_0x225b('0x32')],_0xc5021d[_0x225b('0x33')]),_0x2b0109);if(_0x29a46d[_0x225b('0x32')][_0x225b('0x3c')]){_0x2ae085['where']=_['merge'](_0x2ae085[_0x225b('0x3d')],{'$or':_[_0x225b('0x2b')](_0x2b0109,function(_0x576cb4){if(_0x576cb4[_0x225b('0x2e')]!==_0x225b('0x3e')){var _0x19be0e={};_0x19be0e[_0x576cb4[_0x225b('0x28')]]={'$like':'%'+_0x29a46d[_0x225b('0x32')][_0x225b('0x3c')]+'%'};return _0x19be0e;}})});}_0x2ae085=_[_0x225b('0x3f')]({},_0x2ae085,_0x29a46d[_0x225b('0x40')]);var _0x3ca5c2={'where':_0x2ae085[_0x225b('0x3d')]};return db[_0x225b('0x41')]['count'](_0x3ca5c2)[_0x225b('0x42')](function(_0x801bef){_0x566792['count']=_0x801bef;if(_0x29a46d['query']['includeAll']){_0x2ae085[_0x225b('0x43')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x225b('0x44')](_0x2ae085);})[_0x225b('0x42')](function(_0x47c11e){_0x566792['rows']=_0x47c11e;return _0x566792;})[_0x225b('0x42')](respondWithFilteredResult(_0x2d4529,_0x2ae085))['catch'](handleError(_0x2d4529,null));};exports['show']=function(_0x2c1451,_0x112fe6){var _0x48c8e6={'raw':![],'where':{'id':_0x2c1451[_0x225b('0x45')]['id']}},_0x194d66={};_0x194d66[_0x225b('0x30')]=_[_0x225b('0x31')](db[_0x225b('0x41')]['rawAttributes']);_0x194d66[_0x225b('0x32')]=_[_0x225b('0x31')](_0x2c1451[_0x225b('0x32')]);_0x194d66[_0x225b('0x33')]=_['intersection'](_0x194d66[_0x225b('0x30')],_0x194d66[_0x225b('0x32')]);_0x48c8e6[_0x225b('0x35')]=_[_0x225b('0x34')](_0x194d66['model'],qs['fields'](_0x2c1451[_0x225b('0x32')][_0x225b('0x36')]));_0x48c8e6[_0x225b('0x35')]=_0x48c8e6[_0x225b('0x35')][_0x225b('0x37')]?_0x48c8e6[_0x225b('0x35')]:_0x194d66[_0x225b('0x30')];if(_0x2c1451[_0x225b('0x32')][_0x225b('0x46')]){_0x48c8e6[_0x225b('0x43')]=[{'all':!![]}];}_0x48c8e6=_[_0x225b('0x3f')]({},_0x48c8e6,_0x2c1451[_0x225b('0x40')]);return db[_0x225b('0x41')][_0x225b('0x47')](_0x48c8e6)[_0x225b('0x42')](handleEntityNotFound(_0x112fe6,null))[_0x225b('0x42')](respondWithResult(_0x112fe6,null))['catch'](handleError(_0x112fe6,null));};exports[_0x225b('0x48')]=function(_0x2b2add,_0x28c2ba){return db['SalesforceConfiguration'][_0x225b('0x48')](_0x2b2add[_0x225b('0x49')],{})['then'](respondWithResult(_0x28c2ba,0xc9))[_0x225b('0x4a')](handleError(_0x28c2ba,null));};exports[_0x225b('0x24')]=function(_0x305f72,_0x468d12){if(_0x305f72[_0x225b('0x49')]['id']){delete _0x305f72[_0x225b('0x49')]['id'];}return db[_0x225b('0x41')][_0x225b('0x47')]({'where':{'id':_0x305f72['params']['id']}})[_0x225b('0x42')](handleEntityNotFound(_0x468d12,null))[_0x225b('0x42')](saveUpdates(_0x305f72[_0x225b('0x49')],null))[_0x225b('0x42')](respondWithResult(_0x468d12,null))[_0x225b('0x4a')](handleError(_0x468d12,null));};exports[_0x225b('0x25')]=function(_0x81f2bb,_0x6c3532){return db['SalesforceConfiguration'][_0x225b('0x47')]({'where':{'id':_0x81f2bb[_0x225b('0x45')]['id']}})[_0x225b('0x42')](handleEntityNotFound(_0x6c3532,null))[_0x225b('0x42')](removeEntity(_0x6c3532,null))[_0x225b('0x4a')](handleError(_0x6c3532,null));};exports[_0x225b('0x4b')]=function(_0x509993,_0x16bc42,_0x55b91d){var _0xf90886={};var _0x37ab61={};var _0x2475f1;var _0x26bb1d;return db[_0x225b('0x41')]['findOne']({'where':{'id':_0x509993['params']['id']}})[_0x225b('0x42')](handleEntityNotFound(_0x16bc42,null))[_0x225b('0x42')](function(_0x423645){if(_0x423645){_0x2475f1=_0x423645;_0x37ab61[_0x225b('0x30')]=_[_0x225b('0x31')](db[_0x225b('0x4c')]['rawAttributes']);_0x37ab61[_0x225b('0x32')]=_[_0x225b('0x31')](_0x509993[_0x225b('0x32')]);_0x37ab61[_0x225b('0x33')]=_[_0x225b('0x34')](_0x37ab61[_0x225b('0x30')],_0x37ab61['query']);_0xf90886['attributes']=_[_0x225b('0x34')](_0x37ab61[_0x225b('0x30')],qs[_0x225b('0x36')](_0x509993['query'][_0x225b('0x36')]));_0xf90886['attributes']=_0xf90886[_0x225b('0x35')][_0x225b('0x37')]?_0xf90886[_0x225b('0x35')]:_0x37ab61[_0x225b('0x30')];_0xf90886[_0x225b('0x39')]=qs[_0x225b('0x3a')](_0x509993[_0x225b('0x32')][_0x225b('0x3a')]);_0xf90886[_0x225b('0x3d')]=qs[_0x225b('0x33')](_['pick'](_0x509993[_0x225b('0x32')],_0x37ab61['filters']));if(_0x509993['query'][_0x225b('0x3c')]){_0xf90886[_0x225b('0x3d')]=_['merge'](_0xf90886[_0x225b('0x3d')],{'$or':_[_0x225b('0x2b')](_0xf90886[_0x225b('0x35')],function(_0x369d44){var _0x5d1103={};_0x5d1103[_0x369d44]={'$like':'%'+_0x509993[_0x225b('0x32')][_0x225b('0x3c')]+'%'};return _0x5d1103;})});}_0xf90886=_[_0x225b('0x3f')]({},_0xf90886,_0x509993['options']);return _0x2475f1[_0x225b('0x4b')](_0xf90886);}})['then'](function(_0x4bf010){if(_0x4bf010){_0x26bb1d=_0x4bf010[_0x225b('0x37')];if(!_0x509993[_0x225b('0x32')][_0x225b('0x4d')]('nolimit')){_0xf90886[_0x225b('0x1e')]=qs[_0x225b('0x1e')](_0x509993[_0x225b('0x32')][_0x225b('0x1e')]);_0xf90886[_0x225b('0x1b')]=qs[_0x225b('0x1b')](_0x509993[_0x225b('0x32')]['offset']);}return _0x2475f1[_0x225b('0x4b')](_0xf90886);}})['then'](function(_0x3ed0ee){if(_0x3ed0ee){return _0x3ed0ee?{'count':_0x26bb1d,'rows':_0x3ed0ee}:null;}})['then'](respondWithResult(_0x16bc42,null))[_0x225b('0x4a')](handleError(_0x16bc42,null));};exports[_0x225b('0x4e')]=function(_0x4c8a23,_0x1b9a3e,_0x54bcbd){var _0xb4865c={};var _0x30f6e8={};var _0x42dffe;var _0xf61755;return db[_0x225b('0x41')][_0x225b('0x4f')]({'where':{'id':_0x4c8a23[_0x225b('0x45')]['id']}})[_0x225b('0x42')](handleEntityNotFound(_0x1b9a3e,null))[_0x225b('0x42')](function(_0x5172e5){if(_0x5172e5){_0x42dffe=_0x5172e5;_0x30f6e8[_0x225b('0x30')]=_[_0x225b('0x31')](db['SalesforceField'][_0x225b('0x2c')]);_0x30f6e8[_0x225b('0x32')]=_[_0x225b('0x31')](_0x4c8a23['query']);_0x30f6e8['filters']=_[_0x225b('0x34')](_0x30f6e8['model'],_0x30f6e8['query']);_0xb4865c['attributes']=_[_0x225b('0x34')](_0x30f6e8[_0x225b('0x30')],qs[_0x225b('0x36')](_0x4c8a23['query'][_0x225b('0x36')]));_0xb4865c[_0x225b('0x35')]=_0xb4865c['attributes'][_0x225b('0x37')]?_0xb4865c[_0x225b('0x35')]:_0x30f6e8[_0x225b('0x30')];_0xb4865c['order']=qs[_0x225b('0x3a')](_0x4c8a23[_0x225b('0x32')]['sort']);_0xb4865c['where']=qs[_0x225b('0x33')](_[_0x225b('0x3b')](_0x4c8a23['query'],_0x30f6e8['filters']));if(_0x4c8a23['query'][_0x225b('0x3c')]){_0xb4865c[_0x225b('0x3d')]=_[_0x225b('0x3f')](_0xb4865c[_0x225b('0x3d')],{'$or':_[_0x225b('0x2b')](_0xb4865c[_0x225b('0x35')],function(_0x165c21){var _0x2cb933={};_0x2cb933[_0x165c21]={'$like':'%'+_0x4c8a23['query']['filter']+'%'};return _0x2cb933;})});}_0xb4865c=_[_0x225b('0x3f')]({},_0xb4865c,_0x4c8a23[_0x225b('0x40')]);return _0x42dffe[_0x225b('0x4e')](_0xb4865c);}})[_0x225b('0x42')](function(_0x19a1b0){if(_0x19a1b0){_0xf61755=_0x19a1b0[_0x225b('0x37')];if(!_0x4c8a23[_0x225b('0x32')][_0x225b('0x4d')]('nolimit')){_0xb4865c[_0x225b('0x1e')]=qs['limit'](_0x4c8a23[_0x225b('0x32')]['limit']);_0xb4865c['offset']=qs['offset'](_0x4c8a23['query'][_0x225b('0x1b')]);}return _0x42dffe[_0x225b('0x4e')](_0xb4865c);}})['then'](function(_0x2c6951){if(_0x2c6951){return _0x2c6951?{'count':_0xf61755,'rows':_0x2c6951}:null;}})[_0x225b('0x42')](respondWithResult(_0x1b9a3e,null))[_0x225b('0x4a')](handleError(_0x1b9a3e,null));};exports['getDescriptions']=function(_0x156ac6,_0x35bebc,_0x4eb32a){var _0x3a8eed={};var _0x2dc6bd={};var _0x316a9c;var _0x56f5f4;return db[_0x225b('0x41')][_0x225b('0x4f')]({'where':{'id':_0x156ac6['params']['id']}})[_0x225b('0x42')](handleEntityNotFound(_0x35bebc,null))[_0x225b('0x42')](function(_0x45ab1a){if(_0x45ab1a){_0x316a9c=_0x45ab1a;_0x2dc6bd[_0x225b('0x30')]=_[_0x225b('0x31')](db[_0x225b('0x4c')][_0x225b('0x2c')]);_0x2dc6bd[_0x225b('0x32')]=_[_0x225b('0x31')](_0x156ac6['query']);_0x2dc6bd[_0x225b('0x33')]=_[_0x225b('0x34')](_0x2dc6bd[_0x225b('0x30')],_0x2dc6bd['query']);_0x3a8eed['attributes']=_['intersection'](_0x2dc6bd[_0x225b('0x30')],qs[_0x225b('0x36')](_0x156ac6[_0x225b('0x32')][_0x225b('0x36')]));_0x3a8eed[_0x225b('0x35')]=_0x3a8eed[_0x225b('0x35')][_0x225b('0x37')]?_0x3a8eed[_0x225b('0x35')]:_0x2dc6bd[_0x225b('0x30')];_0x3a8eed[_0x225b('0x39')]=qs['sort'](_0x156ac6['query'][_0x225b('0x3a')]);_0x3a8eed[_0x225b('0x3d')]=qs[_0x225b('0x33')](_[_0x225b('0x3b')](_0x156ac6[_0x225b('0x32')],_0x2dc6bd[_0x225b('0x33')]));if(_0x156ac6[_0x225b('0x32')]['filter']){_0x3a8eed[_0x225b('0x3d')]=_[_0x225b('0x3f')](_0x3a8eed[_0x225b('0x3d')],{'$or':_[_0x225b('0x2b')](_0x3a8eed[_0x225b('0x35')],function(_0x3670a9){var _0xf2cd7={};_0xf2cd7[_0x3670a9]={'$like':'%'+_0x156ac6[_0x225b('0x32')][_0x225b('0x3c')]+'%'};return _0xf2cd7;})});}_0x3a8eed=_['merge']({},_0x3a8eed,_0x156ac6['options']);return _0x316a9c[_0x225b('0x50')](_0x3a8eed);}})['then'](function(_0x2ecbcc){if(_0x2ecbcc){_0x56f5f4=_0x2ecbcc[_0x225b('0x37')];if(!_0x156ac6[_0x225b('0x32')][_0x225b('0x4d')](_0x225b('0x38'))){_0x3a8eed[_0x225b('0x1e')]=qs[_0x225b('0x1e')](_0x156ac6['query'][_0x225b('0x1e')]);_0x3a8eed[_0x225b('0x1b')]=qs[_0x225b('0x1b')](_0x156ac6[_0x225b('0x32')][_0x225b('0x1b')]);}return _0x316a9c[_0x225b('0x50')](_0x3a8eed);}})[_0x225b('0x42')](function(_0x55ff94){if(_0x55ff94){return _0x55ff94?{'count':_0x56f5f4,'rows':_0x55ff94}:null;}})[_0x225b('0x42')](respondWithResult(_0x35bebc,null))['catch'](handleError(_0x35bebc,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index f044c22..c7daacb 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 _0xba2c=['SalesforceConfiguration','int_salesforce_configurations','util','api','moment','request-promise','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports'];(function(_0xea81a1,_0xb28e9e){var _0x2cd030=function(_0x3f8ea5){while(--_0x3f8ea5){_0xea81a1['push'](_0xea81a1['shift']());}};_0x2cd030(++_0xb28e9e);}(_0xba2c,0x14c));var _0xcba2=function(_0x3a1f89,_0x26c689){_0x3a1f89=_0x3a1f89-0x0;var _0x581bc0=_0xba2c[_0x3a1f89];return _0x581bc0;};'use strict';var _=require('lodash');var util=require(_0xcba2('0x0'));var logger=require('../../config/logger')(_0xcba2('0x1'));var moment=require(_0xcba2('0x2'));var BPromise=require('bluebird');var rp=require(_0xcba2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcba2('0x4'));var config=require(_0xcba2('0x5'));var attributes=require(_0xcba2('0x6'));module[_0xcba2('0x7')]=function(_0x2032bd,_0x510c7f){return _0x2032bd['define'](_0xcba2('0x8'),attributes,{'tableName':_0xcba2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9be0=['path','rimraf','../../config/environment','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x54b48c,_0x4b29ce){var _0x43f074=function(_0x4d0a6d){while(--_0x4d0a6d){_0x54b48c['push'](_0x54b48c['shift']());}};_0x43f074(++_0x4b29ce);}(_0x9be0,0x157));var _0x09be=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x9be0[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x09be('0x0'));var util=require(_0x09be('0x1'));var logger=require(_0x09be('0x2'))(_0x09be('0x3'));var moment=require(_0x09be('0x4'));var BPromise=require(_0x09be('0x5'));var rp=require(_0x09be('0x6'));var fs=require('fs');var path=require(_0x09be('0x7'));var rimraf=require(_0x09be('0x8'));var config=require(_0x09be('0x9'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x09be('0xa')]=function(_0x3691cf,_0x2c7940){return _0x3691cf[_0x09be('0xb')](_0x09be('0xc'),attributes,{'tableName':_0x09be('0xd'),'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 988715e..87f2a64 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 _0x6933=['../../config/logger','rpc','http','request','then','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','message','SalesforceConfiguration,\x20%s,\x20%s','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x6933,0x6c));var _0x3693=function(_0x34919b,_0x1e409a){_0x34919b=_0x34919b-0x0;var _0x505b56=_0x6933[_0x34919b];return _0x505b56;};'use strict';var _=require(_0x3693('0x0'));var util=require(_0x3693('0x1'));var moment=require('moment');var BPromise=require(_0x3693('0x2'));var rs=require(_0x3693('0x3'));var fs=require('fs');var Redis=require(_0x3693('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3693('0x5'));var logger=require(_0x3693('0x6'))(_0x3693('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x3693('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x478679,_0x59ac73,_0x3b6083){return new BPromise(function(_0xbdb3df,_0x309d52){return client[_0x3693('0x9')](_0x478679,_0x3b6083)[_0x3693('0xa')](function(_0x17d243){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x59ac73,_0x3693('0xb'));logger['debug'](_0x3693('0xc'),_0x59ac73,_0x3693('0xb'),JSON['stringify'](_0x17d243));if(_0x17d243['error']){if(_0x17d243[_0x3693('0xd')]['code']===0x1f4){logger[_0x3693('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x59ac73,_0x17d243[_0x3693('0xd')][_0x3693('0xe')]);return _0x309d52(_0x17d243[_0x3693('0xd')][_0x3693('0xe')]);}logger[_0x3693('0xd')](_0x3693('0xf'),_0x59ac73,_0x17d243[_0x3693('0xd')][_0x3693('0xe')]);return _0xbdb3df(_0x17d243[_0x3693('0xd')][_0x3693('0xe')]);}else{logger[_0x3693('0x10')](_0x3693('0xf'),_0x59ac73,_0x3693('0xb'));_0xbdb3df(_0x17d243[_0x3693('0x11')]['message']);}})[_0x3693('0x12')](function(_0x31c3df){logger[_0x3693('0xd')](_0x3693('0xf'),_0x59ac73,_0x31c3df);_0x309d52(_0x31c3df);});});} \ No newline at end of file +var _0xb2a7=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','util','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb2a7,0xa5));var _0x7b2a=function(_0x156914,_0x271849){_0x156914=_0x156914-0x0;var _0x4c2321=_0xb2a7[_0x156914];return _0x4c2321;};'use strict';var _=require(_0x7b2a('0x0'));var util=require(_0x7b2a('0x1'));var moment=require(_0x7b2a('0x2'));var BPromise=require(_0x7b2a('0x3'));var rs=require(_0x7b2a('0x4'));var fs=require('fs');var Redis=require(_0x7b2a('0x5'));var db=require(_0x7b2a('0x6'))['db'];var utils=require(_0x7b2a('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x7b2a('0x8'));var jayson=require(_0x7b2a('0x9'));var client=jayson['client'][_0x7b2a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a7a1f,_0x12dd17,_0x162a1b){return new BPromise(function(_0xd5b020,_0x48b23c){return client[_0x7b2a('0xb')](_0x2a7a1f,_0x162a1b)[_0x7b2a('0xc')](function(_0x490231){logger[_0x7b2a('0xd')](_0x7b2a('0xe'),_0x12dd17,'request\x20sent');logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x12dd17,'request\x20sent',JSON['stringify'](_0x490231));if(_0x490231[_0x7b2a('0xf')]){if(_0x490231[_0x7b2a('0xf')][_0x7b2a('0x10')]===0x1f4){logger[_0x7b2a('0xf')](_0x7b2a('0xe'),_0x12dd17,_0x490231[_0x7b2a('0xf')][_0x7b2a('0x11')]);return _0x48b23c(_0x490231[_0x7b2a('0xf')]['message']);}logger[_0x7b2a('0xf')](_0x7b2a('0xe'),_0x12dd17,_0x490231[_0x7b2a('0xf')][_0x7b2a('0x11')]);return _0xd5b020(_0x490231[_0x7b2a('0xf')]['message']);}else{logger[_0x7b2a('0xd')](_0x7b2a('0xe'),_0x12dd17,_0x7b2a('0x12'));_0xd5b020(_0x490231[_0x7b2a('0x13')][_0x7b2a('0x11')]);}})[_0x7b2a('0x14')](function(_0x25b5d1){logger[_0x7b2a('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x12dd17,_0x25b5d1);_0x48b23c(_0x25b5d1);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 58bc974..2ba10ce 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 _0x88e4=['index','show','post','/:id','update','delete','destroy','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated'];(function(_0x31ddf9,_0x559392){var _0x3c4fc1=function(_0x1c2c8e){while(--_0x1c2c8e){_0x31ddf9['push'](_0x31ddf9['shift']());}};_0x3c4fc1(++_0x559392);}(_0x88e4,0x1d3));var _0x488e=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x88e4[_0x32f7d7];return _0x133d09;};'use strict';var multer=require('multer');var util=require(_0x488e('0x0'));var path=require(_0x488e('0x1'));var timeout=require('connect-timeout');var express=require(_0x488e('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x488e('0x3'));var interaction=require(_0x488e('0x4'));var config=require(_0x488e('0x5'));var controller=require(_0x488e('0x6'));router[_0x488e('0x7')]('/',auth[_0x488e('0x8')](),controller[_0x488e('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x488e('0xa')]);router[_0x488e('0xb')]('/',auth[_0x488e('0x8')](),controller['create']);router['put'](_0x488e('0xc'),auth[_0x488e('0x8')](),controller[_0x488e('0xd')]);router[_0x488e('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x488e('0xf')]);module[_0x488e('0x10')]=router; \ No newline at end of file +var _0x044c=['create','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','post'];(function(_0x13f9c3,_0x2036c0){var _0x22185a=function(_0x36a7e6){while(--_0x36a7e6){_0x13f9c3['push'](_0x13f9c3['shift']());}};_0x22185a(++_0x2036c0);}(_0x044c,0x158));var _0xc044=function(_0x53de0f,_0x3ce637){_0x53de0f=_0x53de0f-0x0;var _0x5ae1be=_0x044c[_0x53de0f];return _0x5ae1be;};'use strict';var multer=require(_0xc044('0x0'));var util=require(_0xc044('0x1'));var path=require(_0xc044('0x2'));var timeout=require('connect-timeout');var express=require(_0xc044('0x3'));var router=express[_0xc044('0x4')]();var fs_extra=require(_0xc044('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc044('0x6'));var controller=require(_0xc044('0x7'));router[_0xc044('0x8')]('/',auth[_0xc044('0x9')](),controller[_0xc044('0xa')]);router[_0xc044('0x8')](_0xc044('0xb'),auth[_0xc044('0x9')](),controller['show']);router[_0xc044('0xc')]('/',auth[_0xc044('0x9')](),controller[_0xc044('0xd')]);router['put'](_0xc044('0xb'),auth[_0xc044('0x9')](),controller['update']);router[_0xc044('0xe')](_0xc044('0xb'),auth[_0xc044('0x9')](),controller[_0xc044('0xf')]);module[_0xc044('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index d126e27..ffd47ea 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 _0xcb42=['customVariable','STRING','ENUM','sequelize','exports','string','variable'];(function(_0x25e934,_0x4757dd){var _0x162c25=function(_0x5c8c4e){while(--_0x5c8c4e){_0x25e934['push'](_0x25e934['shift']());}};_0x162c25(++_0x4757dd);}(_0xcb42,0x1a0));var _0x2cb4=function(_0x81119e,_0x1789cc){_0x81119e=_0x81119e-0x0;var _0x26bc19=_0xcb42[_0x81119e];return _0x26bc19;};'use strict';var Sequelize=require(_0x2cb4('0x0'));module[_0x2cb4('0x1')]={'type':{'type':Sequelize['ENUM'](_0x2cb4('0x2'),_0x2cb4('0x3'),_0x2cb4('0x4'),'keyValue','picklist'),'defaultValue':_0x2cb4('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2cb4('0x5')]},'keyType':{'type':Sequelize[_0x2cb4('0x6')](_0x2cb4('0x2'),_0x2cb4('0x3'),_0x2cb4('0x4'))},'keyContent':{'type':Sequelize[_0x2cb4('0x5')]},'idField':{'type':Sequelize[_0x2cb4('0x5')]},'variableName':{'type':Sequelize[_0x2cb4('0x5')]}}; \ No newline at end of file +var _0x33bf=['STRING','string','exports','ENUM','variable','customVariable','keyValue','picklist'];(function(_0x1f2768,_0x3a9c1b){var _0x383ed6=function(_0x5ae3c6){while(--_0x5ae3c6){_0x1f2768['push'](_0x1f2768['shift']());}};_0x383ed6(++_0x3a9c1b);}(_0x33bf,0x17a));var _0xf33b=function(_0x45d1fd,_0x463212){_0x45d1fd=_0x45d1fd-0x0;var _0xd0e542=_0x33bf[_0x45d1fd];return _0xd0e542;};'use strict';var Sequelize=require('sequelize');module[_0xf33b('0x0')]={'type':{'type':Sequelize[_0xf33b('0x1')]('string',_0xf33b('0x2'),_0xf33b('0x3'),_0xf33b('0x4'),_0xf33b('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xf33b('0x6')]},'key':{'type':Sequelize[_0xf33b('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xf33b('0x7'),_0xf33b('0x2'),_0xf33b('0x3'))},'keyContent':{'type':Sequelize[_0xf33b('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0xf33b('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 303e60b..bdf3203 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 _0x43c4=['key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','error','stack','name','send','index','map','SalesforceField','type'];(function(_0x2a2c13,_0x223fa9){var _0x2b6f56=function(_0xda9cd0){while(--_0xda9cd0){_0x2a2c13['push'](_0x2a2c13['shift']());}};_0x2b6f56(++_0x223fa9);}(_0x43c4,0xf7));var _0x443c=function(_0x19ad0d,_0x3c233d){_0x19ad0d=_0x19ad0d-0x0;var _0x2e6508=_0x43c4[_0x19ad0d];return _0x2e6508;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x443c('0x0'));var zipdir=require(_0x443c('0x1'));var jsonpatch=require(_0x443c('0x2'));var rp=require(_0x443c('0x3'));var moment=require(_0x443c('0x4'));var BPromise=require(_0x443c('0x5'));var Mustache=require(_0x443c('0x6'));var util=require(_0x443c('0x7'));var path=require(_0x443c('0x8'));var sox=require('sox');var csv=require(_0x443c('0x9'));var ejs=require(_0x443c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x443c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x443c('0xc'));var deskjs=require(_0x443c('0xd'));var toCsv=require(_0x443c('0x9'));var querystring=require(_0x443c('0xe'));var Papa=require('papaparse');var Redis=require(_0x443c('0xf'));var authService=require(_0x443c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x443c('0x11'));var hardwareService=require(_0x443c('0x12'));var logger=require(_0x443c('0x13'))(_0x443c('0x14'));var utils=require(_0x443c('0x15'));var config=require(_0x443c('0x16'));var licenseUtil=require(_0x443c('0x17'));var db=require(_0x443c('0x18'))['db'];function respondWithStatusCode(_0x4a6524,_0x313d5a){_0x313d5a=_0x313d5a||0xcc;return function(_0x5175a1){if(_0x5175a1){return _0x4a6524[_0x443c('0x19')](_0x313d5a);}return _0x4a6524[_0x443c('0x1a')](_0x313d5a)[_0x443c('0x1b')]();};}function respondWithResult(_0x117012,_0x2868ce){_0x2868ce=_0x2868ce||0xc8;return function(_0x170552){if(_0x170552){return _0x117012['status'](_0x2868ce)[_0x443c('0x1c')](_0x170552);}};}function respondWithFilteredResult(_0x397105,_0x1c654e){return function(_0xd4a257){if(_0xd4a257){var _0x271a35=typeof _0x1c654e[_0x443c('0x1d')]===_0x443c('0x1e')&&typeof _0x1c654e[_0x443c('0x1f')]===_0x443c('0x1e');var _0x3338fe=_0xd4a257[_0x443c('0x20')];var _0x4e2662=_0x271a35?0x0:_0x1c654e['offset'];var _0x244de7=_0x271a35?_0xd4a257['count']:_0x1c654e[_0x443c('0x1d')]+_0x1c654e[_0x443c('0x1f')];var _0x12fb18;if(_0x244de7>=_0x3338fe){_0x244de7=_0x3338fe;_0x12fb18=0xc8;}else{_0x12fb18=0xce;}_0x397105[_0x443c('0x1a')](_0x12fb18);return _0x397105[_0x443c('0x21')](_0x443c('0x22'),_0x4e2662+'-'+_0x244de7+'/'+_0x3338fe)[_0x443c('0x1c')](_0xd4a257);}return null;};}function patchUpdates(_0x106eda){return function(_0x24041b){try{jsonpatch['apply'](_0x24041b,_0x106eda,!![]);}catch(_0x565528){return BPromise['reject'](_0x565528);}return _0x24041b['save']();};}function saveUpdates(_0x3c55bd,_0x2ed9a5){return function(_0x10a860){if(_0x10a860){return _0x10a860['update'](_0x3c55bd)[_0x443c('0x23')](function(_0x5bf90d){return _0x5bf90d;});}return null;};}function removeEntity(_0x314e99,_0x114b97){return function(_0x1c8f01){if(_0x1c8f01){return _0x1c8f01[_0x443c('0x24')]()[_0x443c('0x23')](function(){_0x314e99[_0x443c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x102ccb,_0x4a74a9){return function(_0xce2868){if(!_0xce2868){_0x102ccb[_0x443c('0x19')](0x194);}return _0xce2868;};}function handleError(_0x3031b3,_0x16bf56){_0x16bf56=_0x16bf56||0x1f4;return function(_0x285c74){logger[_0x443c('0x25')](_0x285c74[_0x443c('0x26')]);if(_0x285c74[_0x443c('0x27')]){delete _0x285c74[_0x443c('0x27')];}_0x3031b3['status'](_0x16bf56)[_0x443c('0x28')](_0x285c74);};}exports[_0x443c('0x29')]=function(_0x3c4a8f,_0x12f2f3){var _0x1a209d={},_0x1a3547={},_0x1c863c={'count':0x0,'rows':[]};var _0x42c4b2=_[_0x443c('0x2a')](db[_0x443c('0x2b')]['rawAttributes'],function(_0x25a9d9){return{'name':_0x25a9d9['fieldName'],'type':_0x25a9d9[_0x443c('0x2c')][_0x443c('0x2d')]};});_0x1a3547['model']=_[_0x443c('0x2a')](_0x42c4b2,_0x443c('0x27'));_0x1a3547[_0x443c('0x2e')]=_[_0x443c('0x2f')](_0x3c4a8f[_0x443c('0x2e')]);_0x1a3547[_0x443c('0x30')]=_['intersection'](_0x1a3547[_0x443c('0x31')],_0x1a3547['query']);_0x1a209d[_0x443c('0x32')]=_[_0x443c('0x33')](_0x1a3547[_0x443c('0x31')],qs[_0x443c('0x34')](_0x3c4a8f[_0x443c('0x2e')][_0x443c('0x34')]));_0x1a209d[_0x443c('0x32')]=_0x1a209d[_0x443c('0x32')]['length']?_0x1a209d[_0x443c('0x32')]:_0x1a3547[_0x443c('0x31')];if(!_0x3c4a8f[_0x443c('0x2e')][_0x443c('0x35')](_0x443c('0x36'))){_0x1a209d[_0x443c('0x1f')]=qs[_0x443c('0x1f')](_0x3c4a8f[_0x443c('0x2e')][_0x443c('0x1f')]);_0x1a209d[_0x443c('0x1d')]=qs[_0x443c('0x1d')](_0x3c4a8f[_0x443c('0x2e')]['offset']);}_0x1a209d[_0x443c('0x37')]=qs[_0x443c('0x38')](_0x3c4a8f['query'][_0x443c('0x38')]);_0x1a209d['where']=qs[_0x443c('0x30')](_[_0x443c('0x39')](_0x3c4a8f['query'],_0x1a3547[_0x443c('0x30')]),_0x42c4b2);if(_0x3c4a8f[_0x443c('0x2e')]['filter']){_0x1a209d[_0x443c('0x3a')]=_[_0x443c('0x3b')](_0x1a209d[_0x443c('0x3a')],{'$or':_[_0x443c('0x2a')](_0x42c4b2,function(_0x961bfd){if(_0x961bfd[_0x443c('0x2c')]!==_0x443c('0x3c')){var _0x68bffc={};_0x68bffc[_0x961bfd[_0x443c('0x27')]]={'$like':'%'+_0x3c4a8f[_0x443c('0x2e')]['filter']+'%'};return _0x68bffc;}})});}_0x1a209d=_[_0x443c('0x3b')]({},_0x1a209d,_0x3c4a8f[_0x443c('0x3d')]);var _0x5d18e6={'where':_0x1a209d[_0x443c('0x3a')]};return db['SalesforceField']['count'](_0x5d18e6)[_0x443c('0x23')](function(_0x31c608){_0x1c863c['count']=_0x31c608;if(_0x3c4a8f['query'][_0x443c('0x3e')]){_0x1a209d[_0x443c('0x3f')]=[{'all':!![]}];}return db[_0x443c('0x2b')][_0x443c('0x40')](_0x1a209d);})['then'](function(_0x38dda7){_0x1c863c[_0x443c('0x41')]=_0x38dda7;return _0x1c863c;})['then'](respondWithFilteredResult(_0x12f2f3,_0x1a209d))[_0x443c('0x42')](handleError(_0x12f2f3,null));};exports[_0x443c('0x43')]=function(_0xbc998b,_0x4220c2){var _0x11ad8b={'raw':!![],'where':{'id':_0xbc998b[_0x443c('0x44')]['id']}},_0x2c778b={};_0x2c778b[_0x443c('0x31')]=_[_0x443c('0x2f')](db['SalesforceField'][_0x443c('0x45')]);_0x2c778b[_0x443c('0x2e')]=_[_0x443c('0x2f')](_0xbc998b[_0x443c('0x2e')]);_0x2c778b['filters']=_['intersection'](_0x2c778b['model'],_0x2c778b['query']);_0x11ad8b[_0x443c('0x32')]=_[_0x443c('0x33')](_0x2c778b[_0x443c('0x31')],qs[_0x443c('0x34')](_0xbc998b[_0x443c('0x2e')][_0x443c('0x34')]));_0x11ad8b[_0x443c('0x32')]=_0x11ad8b[_0x443c('0x32')]['length']?_0x11ad8b['attributes']:_0x2c778b[_0x443c('0x31')];if(_0xbc998b[_0x443c('0x2e')][_0x443c('0x3e')]){_0x11ad8b['include']=[{'all':!![]}];}_0x11ad8b=_[_0x443c('0x3b')]({},_0x11ad8b,_0xbc998b[_0x443c('0x3d')]);return db[_0x443c('0x2b')][_0x443c('0x46')](_0x11ad8b)[_0x443c('0x23')](handleEntityNotFound(_0x4220c2,null))[_0x443c('0x23')](respondWithResult(_0x4220c2,null))['catch'](handleError(_0x4220c2,null));};exports[_0x443c('0x47')]=function(_0x23b19c,_0x310baf){return db[_0x443c('0x2b')]['create'](_0x23b19c['body'],{})[_0x443c('0x23')](respondWithResult(_0x310baf,0xc9))[_0x443c('0x42')](handleError(_0x310baf,null));};exports['update']=function(_0x4bd43b,_0x1796aa){if(_0x4bd43b[_0x443c('0x48')]['id']){delete _0x4bd43b[_0x443c('0x48')]['id'];}return db[_0x443c('0x2b')][_0x443c('0x46')]({'where':{'id':_0x4bd43b[_0x443c('0x44')]['id']}})['then'](handleEntityNotFound(_0x1796aa,null))[_0x443c('0x23')](saveUpdates(_0x4bd43b[_0x443c('0x48')],null))[_0x443c('0x23')](respondWithResult(_0x1796aa,null))[_0x443c('0x42')](handleError(_0x1796aa,null));};exports[_0x443c('0x24')]=function(_0x2a49f4,_0x277b0b){return db['SalesforceField'][_0x443c('0x46')]({'where':{'id':_0x2a49f4[_0x443c('0x44')]['id']}})[_0x443c('0x23')](handleEntityNotFound(_0x277b0b,null))[_0x443c('0x23')](removeEntity(_0x277b0b,null))[_0x443c('0x42')](handleError(_0x277b0b,null));}; \ No newline at end of file +var _0x9a76=['params','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','SalesforceField','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','options','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9a76,0x131));var _0x69a7=function(_0x1d5f26,_0x1005d6){_0x1d5f26=_0x1d5f26-0x0;var _0x220487=_0x9a76[_0x1d5f26];return _0x220487;};'use strict';var emlformat=require(_0x69a7('0x0'));var rimraf=require(_0x69a7('0x1'));var zipdir=require(_0x69a7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x69a7('0x3'));var BPromise=require(_0x69a7('0x4'));var Mustache=require(_0x69a7('0x5'));var util=require(_0x69a7('0x6'));var path=require('path');var sox=require(_0x69a7('0x7'));var csv=require(_0x69a7('0x8'));var ejs=require(_0x69a7('0x9'));var fs=require('fs');var fs_extra=require(_0x69a7('0xa'));var _=require('lodash');var squel=require(_0x69a7('0xb'));var crypto=require(_0x69a7('0xc'));var jsforce=require(_0x69a7('0xd'));var deskjs=require(_0x69a7('0xe'));var toCsv=require('to-csv');var querystring=require(_0x69a7('0xf'));var Papa=require(_0x69a7('0x10'));var Redis=require(_0x69a7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x69a7('0x12'));var as=require(_0x69a7('0x13'));var hardwareService=require(_0x69a7('0x14'));var logger=require('../../config/logger')(_0x69a7('0x15'));var utils=require(_0x69a7('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x69a7('0x17'));var db=require(_0x69a7('0x18'))['db'];function respondWithStatusCode(_0x4491b0,_0x274c7a){_0x274c7a=_0x274c7a||0xcc;return function(_0x5e2a0f){if(_0x5e2a0f){return _0x4491b0['sendStatus'](_0x274c7a);}return _0x4491b0[_0x69a7('0x19')](_0x274c7a)[_0x69a7('0x1a')]();};}function respondWithResult(_0x1a4ca6,_0x397ead){_0x397ead=_0x397ead||0xc8;return function(_0x2f205e){if(_0x2f205e){return _0x1a4ca6[_0x69a7('0x19')](_0x397ead)[_0x69a7('0x1b')](_0x2f205e);}};}function respondWithFilteredResult(_0x200b28,_0x42bec8){return function(_0x58886c){if(_0x58886c){var _0x3e65a9=typeof _0x42bec8[_0x69a7('0x1c')]===_0x69a7('0x1d')&&typeof _0x42bec8[_0x69a7('0x1e')]===_0x69a7('0x1d');var _0x26989a=_0x58886c[_0x69a7('0x1f')];var _0x2996c9=_0x3e65a9?0x0:_0x42bec8['offset'];var _0x3aa2b7=_0x3e65a9?_0x58886c[_0x69a7('0x1f')]:_0x42bec8[_0x69a7('0x1c')]+_0x42bec8['limit'];var _0x331541;if(_0x3aa2b7>=_0x26989a){_0x3aa2b7=_0x26989a;_0x331541=0xc8;}else{_0x331541=0xce;}_0x200b28['status'](_0x331541);return _0x200b28[_0x69a7('0x20')](_0x69a7('0x21'),_0x2996c9+'-'+_0x3aa2b7+'/'+_0x26989a)[_0x69a7('0x1b')](_0x58886c);}return null;};}function patchUpdates(_0x18ce7b){return function(_0x1e20fa){try{jsonpatch[_0x69a7('0x22')](_0x1e20fa,_0x18ce7b,!![]);}catch(_0x5d6d8f){return BPromise[_0x69a7('0x23')](_0x5d6d8f);}return _0x1e20fa[_0x69a7('0x24')]();};}function saveUpdates(_0xa9115d,_0x468abb){return function(_0x5f3fda){if(_0x5f3fda){return _0x5f3fda[_0x69a7('0x25')](_0xa9115d)[_0x69a7('0x26')](function(_0xc7e32d){return _0xc7e32d;});}return null;};}function removeEntity(_0x1b8d56,_0x3f863e){return function(_0xf2ad32){if(_0xf2ad32){return _0xf2ad32['destroy']()['then'](function(){_0x1b8d56[_0x69a7('0x19')](0xcc)[_0x69a7('0x1a')]();});}};}function handleEntityNotFound(_0x2bdcc8,_0x3436d6){return function(_0x4f05c9){if(!_0x4f05c9){_0x2bdcc8['sendStatus'](0x194);}return _0x4f05c9;};}function handleError(_0x19a652,_0x554d89){_0x554d89=_0x554d89||0x1f4;return function(_0x5708d4){logger[_0x69a7('0x27')](_0x5708d4[_0x69a7('0x28')]);if(_0x5708d4[_0x69a7('0x29')]){delete _0x5708d4[_0x69a7('0x29')];}_0x19a652[_0x69a7('0x19')](_0x554d89)[_0x69a7('0x2a')](_0x5708d4);};}exports[_0x69a7('0x2b')]=function(_0x5482b1,_0x58a96c){var _0x1eb449={},_0x3c9e08={},_0x50b99c={'count':0x0,'rows':[]};var _0x3e02d1=_[_0x69a7('0x2c')](db[_0x69a7('0x2d')]['rawAttributes'],function(_0x5c4d43){return{'name':_0x5c4d43[_0x69a7('0x2e')],'type':_0x5c4d43['type'][_0x69a7('0x2f')]};});_0x3c9e08['model']=_['map'](_0x3e02d1,_0x69a7('0x29'));_0x3c9e08[_0x69a7('0x30')]=_[_0x69a7('0x31')](_0x5482b1[_0x69a7('0x30')]);_0x3c9e08[_0x69a7('0x32')]=_[_0x69a7('0x33')](_0x3c9e08[_0x69a7('0x34')],_0x3c9e08['query']);_0x1eb449['attributes']=_['intersection'](_0x3c9e08[_0x69a7('0x34')],qs[_0x69a7('0x35')](_0x5482b1[_0x69a7('0x30')][_0x69a7('0x35')]));_0x1eb449[_0x69a7('0x36')]=_0x1eb449['attributes'][_0x69a7('0x37')]?_0x1eb449[_0x69a7('0x36')]:_0x3c9e08[_0x69a7('0x34')];if(!_0x5482b1[_0x69a7('0x30')][_0x69a7('0x38')](_0x69a7('0x39'))){_0x1eb449['limit']=qs[_0x69a7('0x1e')](_0x5482b1['query'][_0x69a7('0x1e')]);_0x1eb449['offset']=qs['offset'](_0x5482b1[_0x69a7('0x30')][_0x69a7('0x1c')]);}_0x1eb449[_0x69a7('0x3a')]=qs[_0x69a7('0x3b')](_0x5482b1[_0x69a7('0x30')][_0x69a7('0x3b')]);_0x1eb449['where']=qs[_0x69a7('0x32')](_[_0x69a7('0x3c')](_0x5482b1[_0x69a7('0x30')],_0x3c9e08[_0x69a7('0x32')]),_0x3e02d1);if(_0x5482b1[_0x69a7('0x30')][_0x69a7('0x3d')]){_0x1eb449[_0x69a7('0x3e')]=_['merge'](_0x1eb449[_0x69a7('0x3e')],{'$or':_[_0x69a7('0x2c')](_0x3e02d1,function(_0x346801){if(_0x346801[_0x69a7('0x3f')]!=='VIRTUAL'){var _0x499a92={};_0x499a92[_0x346801[_0x69a7('0x29')]]={'$like':'%'+_0x5482b1[_0x69a7('0x30')][_0x69a7('0x3d')]+'%'};return _0x499a92;}})});}_0x1eb449=_['merge']({},_0x1eb449,_0x5482b1[_0x69a7('0x40')]);var _0x43bbcc={'where':_0x1eb449[_0x69a7('0x3e')]};return db[_0x69a7('0x2d')][_0x69a7('0x1f')](_0x43bbcc)['then'](function(_0x1b0297){_0x50b99c[_0x69a7('0x1f')]=_0x1b0297;if(_0x5482b1['query'][_0x69a7('0x41')]){_0x1eb449[_0x69a7('0x42')]=[{'all':!![]}];}return db[_0x69a7('0x2d')][_0x69a7('0x43')](_0x1eb449);})[_0x69a7('0x26')](function(_0x3334a9){_0x50b99c[_0x69a7('0x44')]=_0x3334a9;return _0x50b99c;})['then'](respondWithFilteredResult(_0x58a96c,_0x1eb449))[_0x69a7('0x45')](handleError(_0x58a96c,null));};exports[_0x69a7('0x46')]=function(_0x2020f1,_0x3d6b2e){var _0x2872e3={'raw':!![],'where':{'id':_0x2020f1['params']['id']}},_0x1d065e={};_0x1d065e[_0x69a7('0x34')]=_[_0x69a7('0x31')](db[_0x69a7('0x2d')][_0x69a7('0x47')]);_0x1d065e[_0x69a7('0x30')]=_[_0x69a7('0x31')](_0x2020f1['query']);_0x1d065e[_0x69a7('0x32')]=_[_0x69a7('0x33')](_0x1d065e['model'],_0x1d065e[_0x69a7('0x30')]);_0x2872e3[_0x69a7('0x36')]=_[_0x69a7('0x33')](_0x1d065e['model'],qs['fields'](_0x2020f1[_0x69a7('0x30')][_0x69a7('0x35')]));_0x2872e3[_0x69a7('0x36')]=_0x2872e3[_0x69a7('0x36')][_0x69a7('0x37')]?_0x2872e3[_0x69a7('0x36')]:_0x1d065e[_0x69a7('0x34')];if(_0x2020f1[_0x69a7('0x30')]['includeAll']){_0x2872e3[_0x69a7('0x42')]=[{'all':!![]}];}_0x2872e3=_['merge']({},_0x2872e3,_0x2020f1[_0x69a7('0x40')]);return db[_0x69a7('0x2d')]['find'](_0x2872e3)[_0x69a7('0x26')](handleEntityNotFound(_0x3d6b2e,null))[_0x69a7('0x26')](respondWithResult(_0x3d6b2e,null))[_0x69a7('0x45')](handleError(_0x3d6b2e,null));};exports[_0x69a7('0x48')]=function(_0x11ee27,_0x543c3f){return db[_0x69a7('0x2d')][_0x69a7('0x48')](_0x11ee27['body'],{})[_0x69a7('0x26')](respondWithResult(_0x543c3f,0xc9))[_0x69a7('0x45')](handleError(_0x543c3f,null));};exports[_0x69a7('0x25')]=function(_0x459db8,_0x13d5c3){if(_0x459db8['body']['id']){delete _0x459db8[_0x69a7('0x49')]['id'];}return db[_0x69a7('0x2d')][_0x69a7('0x4a')]({'where':{'id':_0x459db8[_0x69a7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x13d5c3,null))[_0x69a7('0x26')](saveUpdates(_0x459db8[_0x69a7('0x49')],null))[_0x69a7('0x26')](respondWithResult(_0x13d5c3,null))[_0x69a7('0x45')](handleError(_0x13d5c3,null));};exports['destroy']=function(_0x148f42,_0x3d2011){return db[_0x69a7('0x2d')][_0x69a7('0x4a')]({'where':{'id':_0x148f42[_0x69a7('0x4b')]['id']}})[_0x69a7('0x26')](handleEntityNotFound(_0x3d2011,null))[_0x69a7('0x26')](removeEntity(_0x3d2011,null))[_0x69a7('0x45')](handleError(_0x3d2011,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index d80c4f4..53e8ad4 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 _0x3d64=['request-promise','rimraf','../../config/environment','SalesforceField','salesforce_unique_index','idField','FieldId','lodash','../../config/logger','moment'];(function(_0x4dd479,_0x26d87a){var _0x1b6807=function(_0x2bec19){while(--_0x2bec19){_0x4dd479['push'](_0x4dd479['shift']());}};_0x1b6807(++_0x26d87a);}(_0x3d64,0xbb));var _0x43d6=function(_0x10fa9c,_0xda0e2a){_0x10fa9c=_0x10fa9c-0x0;var _0x45950e=_0x3d64[_0x10fa9c];return _0x45950e;};'use strict';var _=require(_0x43d6('0x0'));var util=require('util');var logger=require(_0x43d6('0x1'))('api');var moment=require(_0x43d6('0x2'));var BPromise=require('bluebird');var rp=require(_0x43d6('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x43d6('0x4'));var config=require(_0x43d6('0x5'));var attributes=require('./intSalesforceField.attributes');module['exports']=function(_0x1bf07e,_0x562be){return _0x1bf07e['define'](_0x43d6('0x6'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x43d6('0x7'),'fields':[_0x43d6('0x8'),_0x43d6('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8090=['exports','define','int_salesforce_fields','salesforce_unique_index','idField','../../config/logger','bluebird','path','rimraf','../../config/environment','./intSalesforceField.attributes'];(function(_0x50e30b,_0x216368){var _0x4b7300=function(_0x8f06d7){while(--_0x8f06d7){_0x50e30b['push'](_0x50e30b['shift']());}};_0x4b7300(++_0x216368);}(_0x8090,0x170));var _0x0809=function(_0x324661,_0x3fb798){_0x324661=_0x324661-0x0;var _0x135bed=_0x8090[_0x324661];return _0x135bed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0809('0x0'))('api');var moment=require('moment');var BPromise=require(_0x0809('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0809('0x2'));var rimraf=require(_0x0809('0x3'));var config=require(_0x0809('0x4'));var attributes=require(_0x0809('0x5'));module[_0x0809('0x6')]=function(_0x4ee376,_0x1a7b8f){return _0x4ee376[_0x0809('0x7')]('SalesforceField',attributes,{'tableName':_0x0809('0x8'),'paranoid':![],'indexes':[{'name':_0x0809('0x9'),'fields':[_0x0809('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 3b5c08a..00c185e 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 _0x3062=['SalesforceField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x3062,0x133));var _0x2306=function(_0x11fbaa,_0x52dc16){_0x11fbaa=_0x11fbaa-0x0;var _0x1831fd=_0x3062[_0x11fbaa];return _0x1831fd;};'use strict';var _=require(_0x2306('0x0'));var util=require(_0x2306('0x1'));var moment=require(_0x2306('0x2'));var BPromise=require(_0x2306('0x3'));var rs=require(_0x2306('0x4'));var fs=require('fs');var Redis=require(_0x2306('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2306('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x2306('0x7'));var jayson=require(_0x2306('0x8'));var client=jayson[_0x2306('0x9')][_0x2306('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x145289,_0x36d083,_0x3fb786){return new BPromise(function(_0x8fa97e,_0x40796c){return client['request'](_0x145289,_0x3fb786)[_0x2306('0xb')](function(_0x1ab386){logger[_0x2306('0xc')](_0x2306('0xd'),_0x36d083,_0x2306('0xe'));logger['debug']('SalesforceField,\x20%s,\x20%s,\x20%s',_0x36d083,_0x2306('0xe'),JSON[_0x2306('0xf')](_0x1ab386));if(_0x1ab386[_0x2306('0x10')]){if(_0x1ab386[_0x2306('0x10')][_0x2306('0x11')]===0x1f4){logger['error'](_0x2306('0xd'),_0x36d083,_0x1ab386[_0x2306('0x10')][_0x2306('0x12')]);return _0x40796c(_0x1ab386[_0x2306('0x10')]['message']);}logger[_0x2306('0x10')](_0x2306('0xd'),_0x36d083,_0x1ab386[_0x2306('0x10')][_0x2306('0x12')]);return _0x8fa97e(_0x1ab386[_0x2306('0x10')][_0x2306('0x12')]);}else{logger[_0x2306('0xc')](_0x2306('0xd'),_0x36d083,_0x2306('0xe'));_0x8fa97e(_0x1ab386['result'][_0x2306('0x12')]);}})[_0x2306('0x13')](function(_0x207996){logger[_0x2306('0x10')](_0x2306('0xd'),_0x36d083,_0x207996);_0x40796c(_0x207996);});});} \ No newline at end of file +var _0xfc30=['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','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x475305,_0x23e228){var _0x26f630=function(_0xbc220b){while(--_0xbc220b){_0x475305['push'](_0x475305['shift']());}};_0x26f630(++_0x23e228);}(_0xfc30,0x19a));var _0x0fc3=function(_0x2170e4,_0x5b969e){_0x2170e4=_0x2170e4-0x0;var _0xec86f5=_0xfc30[_0x2170e4];return _0xec86f5;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0fc3('0x0'));var fs=require('fs');var Redis=require(_0x0fc3('0x1'));var db=require(_0x0fc3('0x2'))['db'];var utils=require(_0x0fc3('0x3'));var logger=require(_0x0fc3('0x4'))(_0x0fc3('0x5'));var config=require(_0x0fc3('0x6'));var jayson=require(_0x0fc3('0x7'));var client=jayson[_0x0fc3('0x8')][_0x0fc3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x77a5e8,_0x1af933,_0x34956b){return new BPromise(function(_0x28edb9,_0xd05ede){return client[_0x0fc3('0xa')](_0x77a5e8,_0x34956b)[_0x0fc3('0xb')](function(_0x36071b){logger[_0x0fc3('0xc')](_0x0fc3('0xd'),_0x1af933,_0x0fc3('0xe'));logger[_0x0fc3('0xf')](_0x0fc3('0x10'),_0x1af933,'request\x20sent',JSON[_0x0fc3('0x11')](_0x36071b));if(_0x36071b[_0x0fc3('0x12')]){if(_0x36071b[_0x0fc3('0x12')][_0x0fc3('0x13')]===0x1f4){logger[_0x0fc3('0x12')](_0x0fc3('0xd'),_0x1af933,_0x36071b[_0x0fc3('0x12')]['message']);return _0xd05ede(_0x36071b[_0x0fc3('0x12')][_0x0fc3('0x14')]);}logger[_0x0fc3('0x12')](_0x0fc3('0xd'),_0x1af933,_0x36071b['error'][_0x0fc3('0x14')]);return _0x28edb9(_0x36071b[_0x0fc3('0x12')]['message']);}else{logger['info'](_0x0fc3('0xd'),_0x1af933,'request\x20sent');_0x28edb9(_0x36071b['result'][_0x0fc3('0x14')]);}})[_0x0fc3('0x15')](function(_0x455c50){logger['error'](_0x0fc3('0xd'),_0x1af933,_0x455c50);_0xd05ede(_0x455c50);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 4ae8ef6..cb17b81 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 _0x067d=['Router','fs-extra','../../components/auth/service','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x162a95,_0x9dfb1f){var _0x54cd40=function(_0x249ed1){while(--_0x249ed1){_0x162a95['push'](_0x162a95['shift']());}};_0x54cd40(++_0x9dfb1f);}(_0x067d,0x1db));var _0xd067=function(_0xfadccd,_0x290136){_0xfadccd=_0xfadccd-0x0;var _0x482ac4=_0x067d[_0xfadccd];return _0x482ac4;};'use strict';var multer=require(_0xd067('0x0'));var util=require(_0xd067('0x1'));var path=require(_0xd067('0x2'));var timeout=require(_0xd067('0x3'));var express=require(_0xd067('0x4'));var router=express[_0xd067('0x5')]();var fs_extra=require(_0xd067('0x6'));var auth=require(_0xd067('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd067('0x8'));router[_0xd067('0x9')]('/',auth[_0xd067('0xa')](),controller[_0xd067('0xb')]);router['get'](_0xd067('0xc'),auth[_0xd067('0xa')](),controller[_0xd067('0xd')]);router[_0xd067('0x9')](_0xd067('0xe'),auth[_0xd067('0xa')](),controller[_0xd067('0xf')]);router['get'](_0xd067('0x10'),auth[_0xd067('0xa')](),controller[_0xd067('0x11')]);router[_0xd067('0x12')]('/',auth[_0xd067('0xa')](),controller['create']);router[_0xd067('0x12')](_0xd067('0xe'),auth[_0xd067('0xa')](),controller[_0xd067('0x13')]);router[_0xd067('0x14')](_0xd067('0xc'),auth[_0xd067('0xa')](),controller[_0xd067('0x15')]);router[_0xd067('0x16')](_0xd067('0xc'),auth[_0xd067('0xa')](),controller['destroy']);module[_0xd067('0x17')]=router; \ No newline at end of file +var _0x2318=['destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','index','show','/:id/configurations','get','/:id/fields','getFields','create','post','addConfiguration','put','/:id','update'];(function(_0x5d8a95,_0x3fb670){var _0x2aa1fc=function(_0x20d270){while(--_0x20d270){_0x5d8a95['push'](_0x5d8a95['shift']());}};_0x2aa1fc(++_0x3fb670);}(_0x2318,0x115));var _0x8231=function(_0x45e35d,_0x30a52a){_0x45e35d=_0x45e35d-0x0;var _0x41ea02=_0x2318[_0x45e35d];return _0x41ea02;};'use strict';var multer=require('multer');var util=require(_0x8231('0x0'));var path=require(_0x8231('0x1'));var timeout=require(_0x8231('0x2'));var express=require('express');var router=express[_0x8231('0x3')]();var fs_extra=require(_0x8231('0x4'));var auth=require(_0x8231('0x5'));var interaction=require(_0x8231('0x6'));var config=require(_0x8231('0x7'));var controller=require(_0x8231('0x8'));router['get']('/',auth[_0x8231('0x9')](),controller[_0x8231('0xa')]);router['get']('/:id',auth[_0x8231('0x9')](),controller[_0x8231('0xb')]);router['get'](_0x8231('0xc'),auth[_0x8231('0x9')](),controller['getConfigurations']);router[_0x8231('0xd')](_0x8231('0xe'),auth[_0x8231('0x9')](),controller[_0x8231('0xf')]);router['post']('/',auth[_0x8231('0x9')](),controller[_0x8231('0x10')]);router[_0x8231('0x11')](_0x8231('0xc'),auth['isAuthenticated'](),controller[_0x8231('0x12')]);router[_0x8231('0x13')](_0x8231('0x14'),auth[_0x8231('0x9')](),controller[_0x8231('0x15')]);router['delete'](_0x8231('0x14'),auth[_0x8231('0x9')](),controller[_0x8231('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index c787adb..267501d 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 _0xed10=['exports','STRING','username','sequelize'];(function(_0x8ca7a3,_0x3b62fd){var _0xfb38ef=function(_0xe9a8b0){while(--_0xe9a8b0){_0x8ca7a3['push'](_0x8ca7a3['shift']());}};_0xfb38ef(++_0x3b62fd);}(_0xed10,0x1e3));var _0x0ed1=function(_0x23e5ce,_0x57584d){_0x23e5ce=_0x23e5ce-0x0;var _0x2ce19b=_0xed10[_0x23e5ce];return _0x2ce19b;};'use strict';var Sequelize=require(_0x0ed1('0x0'));module[_0x0ed1('0x1')]={'name':{'type':Sequelize[_0x0ed1('0x2')]},'description':{'type':Sequelize[_0x0ed1('0x2')]},'username':{'type':Sequelize[_0x0ed1('0x2')],'unique':_0x0ed1('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x0ed1('0x2')]},'remoteUri':{'type':Sequelize[_0x0ed1('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x0ed1('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5df3=['remoteUri','sequelize','exports','STRING','username'];(function(_0x43cd50,_0x1ed1c){var _0x8a2f83=function(_0xcf4ec6){while(--_0xcf4ec6){_0x43cd50['push'](_0x43cd50['shift']());}};_0x8a2f83(++_0x1ed1c);}(_0x5df3,0x15f));var _0x35df=function(_0x54b56d,_0x43cee0){_0x54b56d=_0x54b56d-0x0;var _0x29e581=_0x5df3[_0x54b56d];return _0x29e581;};'use strict';var Sequelize=require(_0x35df('0x0'));module[_0x35df('0x1')]={'name':{'type':Sequelize[_0x35df('0x2')]},'description':{'type':Sequelize[_0x35df('0x2')]},'username':{'type':Sequelize[_0x35df('0x2')],'unique':_0x35df('0x3')},'password':{'type':Sequelize[_0x35df('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x35df('0x2')],'unique':_0x35df('0x4')},'serverUrl':{'type':Sequelize[_0x35df('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 64344b7..f4b7390 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 _0x395c=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','rawAttributes','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','ServicenowAccount','rows','catch','show','params','find','create','body','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','channel','type','Descriptions','getDescriptions','ServicenowField','Subjects','getFields','knowledge','subcategory','close_code','severity','parent','caused_by','watch_list','upon_reject','child_incidents','approval_history','number','opened_by','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','delivery_plan','business_service','sys_domain_path','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','notify','sys_class_name','close_notes','follow_up','parent_incident','sys_id','contact_type','incident_state','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','comments_and_work_notes','due_date','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','category','password','remoteUri','serverUrl','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','username','GET','incident?sysparm_display_value=all','result','log','remove','includes','forEach','internalType','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','true','False','sys_choice?sysparm_query=name=incident^element=','inactive','false','label','value','zip-dir','request-promise'];(function(_0x26371f,_0x3529d6){var _0x7bf77f=function(_0xaaf7ec){while(--_0xaaf7ec){_0x26371f['push'](_0x26371f['shift']());}};_0x7bf77f(++_0x3529d6);}(_0x395c,0x16c));var _0xc395=function(_0x30ee23,_0x264229){_0x30ee23=_0x30ee23-0x0;var _0x23f637=_0x395c[_0x30ee23];return _0x23f637;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc395('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc395('0x1'));var moment=require(_0xc395('0x2'));var BPromise=require(_0xc395('0x3'));var Mustache=require(_0xc395('0x4'));var util=require(_0xc395('0x5'));var path=require(_0xc395('0x6'));var sox=require(_0xc395('0x7'));var csv=require(_0xc395('0x8'));var ejs=require(_0xc395('0x9'));var fs=require('fs');var fs_extra=require(_0xc395('0xa'));var _=require(_0xc395('0xb'));var squel=require(_0xc395('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc395('0x8'));var querystring=require(_0xc395('0xd'));var Papa=require(_0xc395('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc395('0xf'));var as=require(_0xc395('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc395('0x11'))(_0xc395('0x12'));var utils=require(_0xc395('0x13'));var config=require(_0xc395('0x14'));var licenseUtil=require(_0xc395('0x15'));var db=require(_0xc395('0x16'))['db'];var integrations=require(_0xc395('0x17'));function respondWithStatusCode(_0x515693,_0x5cf9c6){_0x5cf9c6=_0x5cf9c6||0xcc;return function(_0x5d5af9){if(_0x5d5af9){return _0x515693[_0xc395('0x18')](_0x5cf9c6);}return _0x515693[_0xc395('0x19')](_0x5cf9c6)[_0xc395('0x1a')]();};}function respondWithResult(_0x4e5a35,_0x5c2723){_0x5c2723=_0x5c2723||0xc8;return function(_0x4b7b5f){if(_0x4b7b5f){return _0x4e5a35['status'](_0x5c2723)[_0xc395('0x1b')](_0x4b7b5f);}};}function respondWithFilteredResult(_0x3b536f,_0x16d65e){return function(_0x2b0d47){if(_0x2b0d47){var _0x2d81db=typeof _0x16d65e['offset']==='undefined'&&typeof _0x16d65e[_0xc395('0x1c')]==='undefined';var _0x494303=_0x2b0d47[_0xc395('0x1d')];var _0x5626f1=_0x2d81db?0x0:_0x16d65e[_0xc395('0x1e')];var _0x4b26c4=_0x2d81db?_0x2b0d47[_0xc395('0x1d')]:_0x16d65e[_0xc395('0x1e')]+_0x16d65e[_0xc395('0x1c')];var _0x4a1723;if(_0x4b26c4>=_0x494303){_0x4b26c4=_0x494303;_0x4a1723=0xc8;}else{_0x4a1723=0xce;}_0x3b536f[_0xc395('0x19')](_0x4a1723);return _0x3b536f[_0xc395('0x1f')](_0xc395('0x20'),_0x5626f1+'-'+_0x4b26c4+'/'+_0x494303)['json'](_0x2b0d47);}return null;};}function patchUpdates(_0x5e4831){return function(_0x5ce486){try{jsonpatch[_0xc395('0x21')](_0x5ce486,_0x5e4831,!![]);}catch(_0x36b812){return BPromise['reject'](_0x36b812);}return _0x5ce486[_0xc395('0x22')]();};}function saveUpdates(_0x44fb93,_0x4ee612){return function(_0x15f331){if(_0x15f331){return _0x15f331[_0xc395('0x23')](_0x44fb93)[_0xc395('0x24')](function(_0x4aac57){return _0x4aac57;});}return null;};}function removeEntity(_0x1f3589,_0x40d9f3){return function(_0x384fb7){if(_0x384fb7){return _0x384fb7[_0xc395('0x25')]()[_0xc395('0x24')](function(){_0x1f3589[_0xc395('0x19')](0xcc)[_0xc395('0x1a')]();});}};}function handleEntityNotFound(_0x35eb2a,_0x4ca163){return function(_0x2a598b){if(!_0x2a598b){_0x35eb2a[_0xc395('0x18')](0x194);}return _0x2a598b;};}function handleError(_0x51e118,_0x47f57a){_0x47f57a=_0x47f57a||0x1f4;return function(_0x139543){logger[_0xc395('0x26')](_0x139543[_0xc395('0x27')]);if(_0x139543['name']){delete _0x139543[_0xc395('0x28')];}_0x51e118[_0xc395('0x19')](_0x47f57a)[_0xc395('0x29')](_0x139543);};}exports[_0xc395('0x2a')]=function(_0x424eb0,_0x586e9c){var _0x222512={},_0x23d6d4={},_0x9ca6ff={'count':0x0,'rows':[]};var _0x442921=_['map'](db['ServicenowAccount'][_0xc395('0x2b')],function(_0x55cbf7){return{'name':_0x55cbf7['fieldName'],'type':_0x55cbf7['type']['key']};});_0x23d6d4['model']=_[_0xc395('0x2c')](_0x442921,_0xc395('0x28'));_0x23d6d4['query']=_[_0xc395('0x2d')](_0x424eb0[_0xc395('0x2e')]);_0x23d6d4[_0xc395('0x2f')]=_[_0xc395('0x30')](_0x23d6d4[_0xc395('0x31')],_0x23d6d4[_0xc395('0x2e')]);_0x222512[_0xc395('0x32')]=_[_0xc395('0x30')](_0x23d6d4[_0xc395('0x31')],qs[_0xc395('0x33')](_0x424eb0[_0xc395('0x2e')][_0xc395('0x33')]));_0x222512[_0xc395('0x32')]=_0x222512[_0xc395('0x32')][_0xc395('0x34')]?_0x222512[_0xc395('0x32')]:_0x23d6d4[_0xc395('0x31')];if(!_0x424eb0[_0xc395('0x2e')][_0xc395('0x35')](_0xc395('0x36'))){_0x222512['limit']=qs[_0xc395('0x1c')](_0x424eb0['query'][_0xc395('0x1c')]);_0x222512['offset']=qs[_0xc395('0x1e')](_0x424eb0['query']['offset']);}_0x222512[_0xc395('0x37')]=qs[_0xc395('0x38')](_0x424eb0[_0xc395('0x2e')][_0xc395('0x38')]);_0x222512[_0xc395('0x39')]=qs[_0xc395('0x2f')](_[_0xc395('0x3a')](_0x424eb0[_0xc395('0x2e')],_0x23d6d4[_0xc395('0x2f')]),_0x442921);if(_0x424eb0[_0xc395('0x2e')][_0xc395('0x3b')]){_0x222512[_0xc395('0x39')]=_[_0xc395('0x3c')](_0x222512[_0xc395('0x39')],{'$or':_['map'](_0x442921,function(_0x588b1c){if(_0x588b1c['type']!==_0xc395('0x3d')){var _0x48af7e={};_0x48af7e[_0x588b1c[_0xc395('0x28')]]={'$like':'%'+_0x424eb0[_0xc395('0x2e')][_0xc395('0x3b')]+'%'};return _0x48af7e;}})});}_0x222512=_[_0xc395('0x3c')]({},_0x222512,_0x424eb0[_0xc395('0x3e')]);var _0x5be6df={'where':_0x222512[_0xc395('0x39')]};return db['ServicenowAccount'][_0xc395('0x1d')](_0x5be6df)['then'](function(_0x13ce3b){_0x9ca6ff[_0xc395('0x1d')]=_0x13ce3b;if(_0x424eb0['query']['includeAll']){_0x222512[_0xc395('0x3f')]=[{'all':!![]}];}return db[_0xc395('0x40')]['findAll'](_0x222512);})[_0xc395('0x24')](function(_0x4122a2){_0x9ca6ff[_0xc395('0x41')]=_0x4122a2;return _0x9ca6ff;})[_0xc395('0x24')](respondWithFilteredResult(_0x586e9c,_0x222512))[_0xc395('0x42')](handleError(_0x586e9c,null));};exports[_0xc395('0x43')]=function(_0x15fb16,_0x3e5fab){var _0x540188={'raw':![],'where':{'id':_0x15fb16[_0xc395('0x44')]['id']}},_0xca590a={};_0xca590a['model']=_['keys'](db[_0xc395('0x40')]['rawAttributes']);_0xca590a['query']=_[_0xc395('0x2d')](_0x15fb16[_0xc395('0x2e')]);_0xca590a[_0xc395('0x2f')]=_['intersection'](_0xca590a[_0xc395('0x31')],_0xca590a[_0xc395('0x2e')]);_0x540188['attributes']=_[_0xc395('0x30')](_0xca590a[_0xc395('0x31')],qs['fields'](_0x15fb16[_0xc395('0x2e')][_0xc395('0x33')]));_0x540188['attributes']=_0x540188['attributes'][_0xc395('0x34')]?_0x540188['attributes']:_0xca590a['model'];if(_0x15fb16['query']['includeAll']){_0x540188[_0xc395('0x3f')]=[{'all':!![]}];}_0x540188=_[_0xc395('0x3c')]({},_0x540188,_0x15fb16[_0xc395('0x3e')]);return db[_0xc395('0x40')][_0xc395('0x45')](_0x540188)[_0xc395('0x24')](handleEntityNotFound(_0x3e5fab,null))['then'](respondWithResult(_0x3e5fab,null))[_0xc395('0x42')](handleError(_0x3e5fab,null));};exports[_0xc395('0x46')]=function(_0x36fd32,_0x24a5c6){return db[_0xc395('0x40')][_0xc395('0x46')](_0x36fd32[_0xc395('0x47')],{})[_0xc395('0x24')](respondWithResult(_0x24a5c6,0xc9))['catch'](handleError(_0x24a5c6,null));};exports['update']=function(_0x226669,_0x7dac19){if(_0x226669[_0xc395('0x47')]['id']){delete _0x226669[_0xc395('0x47')]['id'];}return db['ServicenowAccount'][_0xc395('0x45')]({'where':{'id':_0x226669[_0xc395('0x44')]['id']}})['then'](handleEntityNotFound(_0x7dac19,null))[_0xc395('0x24')](saveUpdates(_0x226669['body'],null))[_0xc395('0x24')](respondWithResult(_0x7dac19,null))[_0xc395('0x42')](handleError(_0x7dac19,null));};exports[_0xc395('0x25')]=function(_0x22708e,_0x48ea45){return db[_0xc395('0x40')][_0xc395('0x45')]({'where':{'id':_0x22708e['params']['id']}})[_0xc395('0x24')](handleEntityNotFound(_0x48ea45,null))[_0xc395('0x24')](removeEntity(_0x48ea45,null))['catch'](handleError(_0x48ea45,null));};exports[_0xc395('0x48')]=function(_0x446b2b,_0x3476c3,_0x226c0d){var _0x10d73c={};var _0x5506a0={};var _0x3a711b;var _0xbadc29;return db['ServicenowAccount'][_0xc395('0x49')]({'where':{'id':_0x446b2b['params']['id']}})[_0xc395('0x24')](handleEntityNotFound(_0x3476c3,null))[_0xc395('0x24')](function(_0x5763bb){if(_0x5763bb){_0x3a711b=_0x5763bb;_0x5506a0[_0xc395('0x31')]=_['keys'](db[_0xc395('0x4a')][_0xc395('0x2b')]);_0x5506a0['query']=_['keys'](_0x446b2b['query']);_0x5506a0[_0xc395('0x2f')]=_[_0xc395('0x30')](_0x5506a0[_0xc395('0x31')],_0x5506a0[_0xc395('0x2e')]);_0x10d73c[_0xc395('0x32')]=_[_0xc395('0x30')](_0x5506a0['model'],qs[_0xc395('0x33')](_0x446b2b['query']['fields']));_0x10d73c[_0xc395('0x32')]=_0x10d73c[_0xc395('0x32')][_0xc395('0x34')]?_0x10d73c['attributes']:_0x5506a0[_0xc395('0x31')];_0x10d73c['order']=qs[_0xc395('0x38')](_0x446b2b[_0xc395('0x2e')]['sort']);_0x10d73c[_0xc395('0x39')]=qs['filters'](_[_0xc395('0x3a')](_0x446b2b[_0xc395('0x2e')],_0x5506a0[_0xc395('0x2f')]));if(_0x446b2b[_0xc395('0x2e')][_0xc395('0x3b')]){_0x10d73c[_0xc395('0x39')]=_[_0xc395('0x3c')](_0x10d73c[_0xc395('0x39')],{'$or':_[_0xc395('0x2c')](_0x10d73c[_0xc395('0x32')],function(_0x49fb2f){var _0x31ec93={};_0x31ec93[_0x49fb2f]={'$like':'%'+_0x446b2b[_0xc395('0x2e')][_0xc395('0x3b')]+'%'};return _0x31ec93;})});}_0x10d73c=_['merge']({},_0x10d73c,_0x446b2b[_0xc395('0x3e')]);return _0x3a711b[_0xc395('0x48')](_0x10d73c);}})['then'](function(_0x38ace5){if(_0x38ace5){_0xbadc29=_0x38ace5[_0xc395('0x34')];if(!_0x446b2b[_0xc395('0x2e')][_0xc395('0x35')](_0xc395('0x36'))){_0x10d73c[_0xc395('0x1c')]=qs[_0xc395('0x1c')](_0x446b2b['query'][_0xc395('0x1c')]);_0x10d73c[_0xc395('0x1e')]=qs['offset'](_0x446b2b[_0xc395('0x2e')][_0xc395('0x1e')]);}return _0x3a711b[_0xc395('0x48')](_0x10d73c);}})[_0xc395('0x24')](function(_0x58535b){if(_0x58535b){return _0x58535b?{'count':_0xbadc29,'rows':_0x58535b}:null;}})[_0xc395('0x24')](respondWithResult(_0x3476c3,null))[_0xc395('0x42')](handleError(_0x3476c3,null));};exports[_0xc395('0x4b')]=function(_0x4ce243,_0x46bf17,_0x587c28){if(_0x4ce243[_0xc395('0x47')]['id']){delete _0x4ce243[_0xc395('0x47')]['id'];}return db[_0xc395('0x40')][_0xc395('0x49')]({'where':{'id':_0x4ce243[_0xc395('0x44')]['id']}})['then'](handleEntityNotFound(_0x46bf17,null))['then'](function(_0x3b1952){if(_0x3b1952){_0x4ce243[_0xc395('0x47')][_0xc395('0x4c')]=_0x3b1952['id'];_0x4ce243[_0xc395('0x47')]['Subjects']=integrations['getSubjects'](_0x4ce243[_0xc395('0x47')][_0xc395('0x4d')],_0x4ce243[_0xc395('0x47')][_0xc395('0x4e')]);_0x4ce243[_0xc395('0x47')][_0xc395('0x4f')]=integrations[_0xc395('0x50')](_0x4ce243[_0xc395('0x47')][_0xc395('0x4d')],_0x4ce243[_0xc395('0x47')]['type']);return db[_0xc395('0x4a')][_0xc395('0x46')](_0x4ce243['body'],{'include':[{'model':db[_0xc395('0x51')],'as':_0xc395('0x52')},{'model':db[_0xc395('0x51')],'as':_0xc395('0x4f')}]});}return null;})[_0xc395('0x24')](respondWithResult(_0x46bf17,null))['catch'](handleError(_0x46bf17,null));};exports[_0xc395('0x53')]=function(_0xdf2f24,_0x19c03f,_0x3c3dbb){var _0x51ed75=['made_sla','hold_reason',_0xc395('0x54'),_0xc395('0x55'),_0xc395('0x56'),'notify','incident_state',_0xc395('0x57'),'category'];var _0x30c8e7=[_0xc395('0x58'),'made_sla',_0xc395('0x59'),_0xc395('0x5a'),_0xc395('0x5b'),'sys_updated_on',_0xc395('0x5c'),'hold_reason',_0xc395('0x5d'),_0xc395('0x5e'),'resolved_by','sys_updated_by',_0xc395('0x5f'),'user_input',_0xc395('0x60'),_0xc395('0x61'),_0xc395('0x62'),_0xc395('0x63'),'knowledge',_0xc395('0x37'),_0xc395('0x64'),_0xc395('0x65'),'cmdb_ci',_0xc395('0x66'),'impact','active','work_notes_list',_0xc395('0x67'),'priority',_0xc395('0x68'),'rfc','time_worked',_0xc395('0x69'),_0xc395('0x6a'),_0xc395('0x6b'),_0xc395('0x6c'),_0xc395('0x6d'),_0xc395('0x6e'),_0xc395('0x6f'),_0xc395('0x70'),'approval_set',_0xc395('0x55'),'work_notes',_0xc395('0x71'),_0xc395('0x56'),_0xc395('0x72'),_0xc395('0x73'),_0xc395('0x74'),_0xc395('0x75'),_0xc395('0x76'),_0xc395('0x77'),_0xc395('0x78'),_0xc395('0x79'),_0xc395('0x7a'),_0xc395('0x7b'),_0xc395('0x7c'),'closed_by',_0xc395('0x7d'),_0xc395('0x7e'),_0xc395('0x7f'),_0xc395('0x80'),'reopened_by',_0xc395('0x81'),_0xc395('0x82'),_0xc395('0x83'),_0xc395('0x84'),_0xc395('0x85'),_0xc395('0x86'),_0xc395('0x87'),_0xc395('0x57'),_0xc395('0x88'),_0xc395('0x89'),'approval',_0xc395('0x8a'),_0xc395('0x8b'),'sys_mod_count',_0xc395('0x8c'),_0xc395('0x8d'),_0xc395('0x8e'),_0xc395('0x8f'),_0xc395('0x90'),_0xc395('0x91'),_0xc395('0x92')];var _0x6e5dfe='';var _0x349225='';var _0x3e44cb=[];var _0x5d9545='';var _0x6e3f02='';var _0x38056f=[];var _0x112ebc='';var _0xed98cc='';var _0x2544ab={};var _0x120647='';return db[_0xc395('0x40')][_0xc395('0x49')]({'where':{'id':_0xdf2f24[_0xc395('0x44')]['id']},'attributes':['id','username',_0xc395('0x93'),'email',_0xc395('0x94'),_0xc395('0x95')]})['then'](handleEntityNotFound(_0x19c03f,null))['then'](function(_0x36856e){if(_0x36856e){_0x120647=_0x36856e['remoteUri'];var _0x37ea76=_0x120647[_0xc395('0x96')](-0x1);if(_0x37ea76==='/'){_0x120647=_0x120647[_0xc395('0x97')](0x0,_0x120647[_0xc395('0x98')](_0x37ea76));}_0xed98cc=util['format'](_0xc395('0x99'),_0x120647);_0x112ebc=util[_0xc395('0x9a')](_0xc395('0x9b'),_0x120647);_0x2544ab={'user':_0x36856e[_0xc395('0x9c')],'pass':_0x36856e[_0xc395('0x93')]};var _0x2a2698={'method':_0xc395('0x9d'),'uri':_0xed98cc+_0xc395('0x9e'),'auth':_0x2544ab,'json':!![]};return rp(_0x2a2698);}})['then'](function(_0x3c90d3){if(_0x3c90d3[_0xc395('0x9f')]['length']>0x0){_0x6e5dfe=_0x3c90d3[_0xc395('0x9f')];}console[_0xc395('0xa0')]('incident\x20table\x20objects',_0x6e5dfe);_0x38056f=[];_0x349225=Object['assign']([],_0x6e5dfe);_[_0xc395('0xa1')](_0x349225,function(_0x21e90a){return!_0x51ed75[_0xc395('0xa2')](_0x21e90a[_0xc395('0x28')]);});_0x349225[_0xc395('0xa3')](function(_0x17e4c3){var _0x21c378=createFieldObject(_0x112ebc,_0x2544ab,_0x17e4c3[_0xc395('0xa4')],_0x17e4c3[_0xc395('0x28')],_0x17e4c3['label'],![]);_0x38056f[_0xc395('0xa5')](_0x21c378);});return Promise[_0xc395('0xa6')](_0x38056f);})[_0xc395('0x24')](function(_0x300f9e){_0x3e44cb=_0x300f9e;_0x5d9545=Object['assign']([],_0x6e5dfe);console[_0xc395('0xa0')](_0xc395('0xa7'),_0x6e5dfe);_['remove'](_0x5d9545,function(_0x15fb6c){return _0x30c8e7['includes'](_0x15fb6c[_0xc395('0x28')]);});console[_0xc395('0xa0')](_0xc395('0xa8'),_0x5d9545);_0x38056f=[];_0x5d9545[_0xc395('0xa3')](function(_0x5043d6){var _0x19208a=createFieldObject(_0x112ebc,_0x2544ab,_0x5043d6['internalType'],_0x5043d6[_0xc395('0x28')],_0x5043d6['label'],!![]);_0x38056f[_0xc395('0xa5')](_0x19208a);});return Promise[_0xc395('0xa6')](_0x38056f);})['then'](function(_0x5d3f4f){_0x6e3f02=_0x5d3f4f;var _0xae6e64=_0x3e44cb[_0xc395('0xa9')](_0x6e3f02);return{'count':_0xae6e64['length'],'rows':_0xae6e64};})[_0xc395('0x24')](respondWithResult(_0x19c03f,null))[_0xc395('0x42')](function(_0xc27e50){console[_0xc395('0xa0')](_0xc395('0xaa')+_0xc27e50);var _0x5a9a58=_0xdf2f24[_0xc395('0x2e')][_0xc395('0xab')]?0x1f4:_0xc27e50[_0xc395('0xac')]||0x1f4;logger[_0xc395('0x26')](_0xc27e50['stack']);delete _0xc27e50[_0xc395('0x28')];if(_0x5a9a58===0x191){_0x5a9a58=0x190;}_0x19c03f[_0xc395('0x19')](_0x5a9a58)['send'](_0xdf2f24[_0xc395('0x2e')]['test']?{'message':_0xc395('0xad'),'statusCode':_0xc27e50['statusCode']}:_0xc27e50);});};function createFieldObject(_0x4778ff,_0x75274,_0x384b99,_0x4d9845,_0x1540dc,_0x35aff8){return new Promise(function(_0x360977,_0xd4498a){var _0x226c68={'id':_0x4d9845,'name':_0x1540dc,'custom':_0x35aff8};if(_0x384b99===_0xc395('0xae')){_0x226c68['options']=[{'name':_0xc395('0xaf'),'value':_0xc395('0xb0')},{'name':_0xc395('0xb1'),'value':'false'}];_0x360977(_0x226c68);}else{var _0x379c29={'method':_0xc395('0x9d'),'uri':_0x4778ff+_0xc395('0xb2')+_0x4d9845,'auth':_0x75274,'json':!![]};return rp(_0x379c29)['then'](function(_0x5da646){var _0xecfa61=[];if(_0x5da646[_0xc395('0x9f')][_0xc395('0x34')]>0x0){_0x5da646[_0xc395('0x9f')]['forEach'](function(_0x25a739){if(_0x25a739[_0xc395('0xb3')]===_0xc395('0xb4')){var _0x47c87b={'name':_0x25a739[_0xc395('0xb5')],'value':_0x25a739[_0xc395('0xb6')]};_0xecfa61['push'](_0x47c87b);}});}_0x226c68[_0xc395('0x3e')]=_0xecfa61;if(_0x226c68[_0xc395('0x3e')][_0xc395('0x34')]>0x0){_0x360977(_0x226c68);}else{if(_0x35aff8==![]){_0x360977();}else{_0x360977(_0x226c68);}}});}});} \ No newline at end of file +var _0xb6ed=['crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','send','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','getConfigurations','ServicenowConfiguration','hasOwnProperty','nolimit','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','Subjects','getFields','made_sla','knowledge','subcategory','notify','incident_state','severity','category','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','active','work_notes_list','business_service','sys_domain_path','rfc','time_worked','expected_start','opened_at','group_list','reopened_time','resolved_at','caller_id','close_code','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','calendar_duration','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','problem_id','company','reassignment_count','activity_due','comments','sla_due','approval','comments_and_work_notes','due_date','reopen_count','sys_tags','escalation','upon_approval','location','username','password','remoteUri','substring','format','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','result','log','remove','includes','forEach','label','all','assign','push','concat','ServiceNow\x20error:\x20','statusCode','stack','test','Wrong\x20credentials','True','False','false','inactive','value','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs'];(function(_0x4fbb15,_0x21be0c){var _0x436338=function(_0x3b5a05){while(--_0x3b5a05){_0x4fbb15['push'](_0x4fbb15['shift']());}};_0x436338(++_0x21be0c);}(_0xb6ed,0xa4));var _0xdb6e=function(_0x2a1e07,_0x4520c2){_0x2a1e07=_0x2a1e07-0x0;var _0x120d5f=_0xb6ed[_0x2a1e07];return _0x120d5f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdb6e('0x0'));var rp=require(_0xdb6e('0x1'));var moment=require('moment');var BPromise=require(_0xdb6e('0x2'));var Mustache=require('mustache');var util=require(_0xdb6e('0x3'));var path=require(_0xdb6e('0x4'));var sox=require(_0xdb6e('0x5'));var csv=require(_0xdb6e('0x6'));var ejs=require(_0xdb6e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xdb6e('0x8'));var jsforce=require(_0xdb6e('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdb6e('0xa'));var Papa=require(_0xdb6e('0xb'));var Redis=require(_0xdb6e('0xc'));var authService=require(_0xdb6e('0xd'));var qs=require(_0xdb6e('0xe'));var as=require(_0xdb6e('0xf'));var hardwareService=require(_0xdb6e('0x10'));var logger=require('../../config/logger')(_0xdb6e('0x11'));var utils=require(_0xdb6e('0x12'));var config=require(_0xdb6e('0x13'));var licenseUtil=require(_0xdb6e('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0xdb6e('0x15'));function respondWithStatusCode(_0x24d9e4,_0x4985b2){_0x4985b2=_0x4985b2||0xcc;return function(_0x38d692){if(_0x38d692){return _0x24d9e4[_0xdb6e('0x16')](_0x4985b2);}return _0x24d9e4[_0xdb6e('0x17')](_0x4985b2)['end']();};}function respondWithResult(_0x5e157b,_0x3ba494){_0x3ba494=_0x3ba494||0xc8;return function(_0x415104){if(_0x415104){return _0x5e157b[_0xdb6e('0x17')](_0x3ba494)[_0xdb6e('0x18')](_0x415104);}};}function respondWithFilteredResult(_0x20636c,_0x33d99b){return function(_0x4d89bb){if(_0x4d89bb){var _0x178575=typeof _0x33d99b[_0xdb6e('0x19')]===_0xdb6e('0x1a')&&typeof _0x33d99b[_0xdb6e('0x1b')]===_0xdb6e('0x1a');var _0x210acb=_0x4d89bb[_0xdb6e('0x1c')];var _0x4dddd7=_0x178575?0x0:_0x33d99b[_0xdb6e('0x19')];var _0x17f607=_0x178575?_0x4d89bb[_0xdb6e('0x1c')]:_0x33d99b['offset']+_0x33d99b[_0xdb6e('0x1b')];var _0x4309de;if(_0x17f607>=_0x210acb){_0x17f607=_0x210acb;_0x4309de=0xc8;}else{_0x4309de=0xce;}_0x20636c[_0xdb6e('0x17')](_0x4309de);return _0x20636c[_0xdb6e('0x1d')](_0xdb6e('0x1e'),_0x4dddd7+'-'+_0x17f607+'/'+_0x210acb)[_0xdb6e('0x18')](_0x4d89bb);}return null;};}function patchUpdates(_0x2c659a){return function(_0x1d1fef){try{jsonpatch[_0xdb6e('0x1f')](_0x1d1fef,_0x2c659a,!![]);}catch(_0x4bc15d){return BPromise[_0xdb6e('0x20')](_0x4bc15d);}return _0x1d1fef['save']();};}function saveUpdates(_0x174f47,_0x87c5c0){return function(_0x307cd5){if(_0x307cd5){return _0x307cd5['update'](_0x174f47)[_0xdb6e('0x21')](function(_0x59c1ab){return _0x59c1ab;});}return null;};}function removeEntity(_0x3fa047,_0x240afb){return function(_0x2ef8a9){if(_0x2ef8a9){return _0x2ef8a9[_0xdb6e('0x22')]()[_0xdb6e('0x21')](function(){_0x3fa047[_0xdb6e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42b1f0,_0x26ca1f){return function(_0x164d05){if(!_0x164d05){_0x42b1f0[_0xdb6e('0x16')](0x194);}return _0x164d05;};}function handleError(_0x11faf3,_0x17e2a8){_0x17e2a8=_0x17e2a8||0x1f4;return function(_0x1c055b){logger[_0xdb6e('0x23')](_0x1c055b['stack']);if(_0x1c055b['name']){delete _0x1c055b['name'];}_0x11faf3['status'](_0x17e2a8)[_0xdb6e('0x24')](_0x1c055b);};}exports['index']=function(_0x2ae156,_0x3574e3){var _0xdd925b={},_0x24fae5={},_0x3f2f0d={'count':0x0,'rows':[]};var _0x57bcb9=_[_0xdb6e('0x25')](db[_0xdb6e('0x26')][_0xdb6e('0x27')],function(_0x1b72ef){return{'name':_0x1b72ef[_0xdb6e('0x28')],'type':_0x1b72ef[_0xdb6e('0x29')][_0xdb6e('0x2a')]};});_0x24fae5[_0xdb6e('0x2b')]=_[_0xdb6e('0x25')](_0x57bcb9,_0xdb6e('0x2c'));_0x24fae5[_0xdb6e('0x2d')]=_[_0xdb6e('0x2e')](_0x2ae156[_0xdb6e('0x2d')]);_0x24fae5[_0xdb6e('0x2f')]=_[_0xdb6e('0x30')](_0x24fae5[_0xdb6e('0x2b')],_0x24fae5[_0xdb6e('0x2d')]);_0xdd925b[_0xdb6e('0x31')]=_[_0xdb6e('0x30')](_0x24fae5[_0xdb6e('0x2b')],qs[_0xdb6e('0x32')](_0x2ae156['query'][_0xdb6e('0x32')]));_0xdd925b[_0xdb6e('0x31')]=_0xdd925b['attributes'][_0xdb6e('0x33')]?_0xdd925b[_0xdb6e('0x31')]:_0x24fae5[_0xdb6e('0x2b')];if(!_0x2ae156[_0xdb6e('0x2d')]['hasOwnProperty']('nolimit')){_0xdd925b['limit']=qs[_0xdb6e('0x1b')](_0x2ae156[_0xdb6e('0x2d')][_0xdb6e('0x1b')]);_0xdd925b['offset']=qs[_0xdb6e('0x19')](_0x2ae156[_0xdb6e('0x2d')][_0xdb6e('0x19')]);}_0xdd925b[_0xdb6e('0x34')]=qs[_0xdb6e('0x35')](_0x2ae156[_0xdb6e('0x2d')][_0xdb6e('0x35')]);_0xdd925b[_0xdb6e('0x36')]=qs['filters'](_[_0xdb6e('0x37')](_0x2ae156[_0xdb6e('0x2d')],_0x24fae5[_0xdb6e('0x2f')]),_0x57bcb9);if(_0x2ae156['query'][_0xdb6e('0x38')]){_0xdd925b[_0xdb6e('0x36')]=_[_0xdb6e('0x39')](_0xdd925b[_0xdb6e('0x36')],{'$or':_[_0xdb6e('0x25')](_0x57bcb9,function(_0x2d2719){if(_0x2d2719[_0xdb6e('0x29')]!=='VIRTUAL'){var _0x5ac088={};_0x5ac088[_0x2d2719['name']]={'$like':'%'+_0x2ae156['query'][_0xdb6e('0x38')]+'%'};return _0x5ac088;}})});}_0xdd925b=_['merge']({},_0xdd925b,_0x2ae156[_0xdb6e('0x3a')]);var _0x1c19e5={'where':_0xdd925b[_0xdb6e('0x36')]};return db[_0xdb6e('0x26')]['count'](_0x1c19e5)['then'](function(_0x2ecf64){_0x3f2f0d[_0xdb6e('0x1c')]=_0x2ecf64;if(_0x2ae156[_0xdb6e('0x2d')][_0xdb6e('0x3b')]){_0xdd925b[_0xdb6e('0x3c')]=[{'all':!![]}];}return db[_0xdb6e('0x26')][_0xdb6e('0x3d')](_0xdd925b);})[_0xdb6e('0x21')](function(_0x320a4f){_0x3f2f0d[_0xdb6e('0x3e')]=_0x320a4f;return _0x3f2f0d;})['then'](respondWithFilteredResult(_0x3574e3,_0xdd925b))[_0xdb6e('0x3f')](handleError(_0x3574e3,null));};exports[_0xdb6e('0x40')]=function(_0x1c227f,_0x1cb499){var _0x3a962c={'raw':![],'where':{'id':_0x1c227f[_0xdb6e('0x41')]['id']}},_0x5cb4c5={};_0x5cb4c5[_0xdb6e('0x2b')]=_['keys'](db[_0xdb6e('0x26')][_0xdb6e('0x27')]);_0x5cb4c5[_0xdb6e('0x2d')]=_['keys'](_0x1c227f['query']);_0x5cb4c5['filters']=_[_0xdb6e('0x30')](_0x5cb4c5[_0xdb6e('0x2b')],_0x5cb4c5[_0xdb6e('0x2d')]);_0x3a962c[_0xdb6e('0x31')]=_[_0xdb6e('0x30')](_0x5cb4c5[_0xdb6e('0x2b')],qs['fields'](_0x1c227f['query'][_0xdb6e('0x32')]));_0x3a962c['attributes']=_0x3a962c[_0xdb6e('0x31')]['length']?_0x3a962c['attributes']:_0x5cb4c5[_0xdb6e('0x2b')];if(_0x1c227f[_0xdb6e('0x2d')][_0xdb6e('0x3b')]){_0x3a962c[_0xdb6e('0x3c')]=[{'all':!![]}];}_0x3a962c=_[_0xdb6e('0x39')]({},_0x3a962c,_0x1c227f[_0xdb6e('0x3a')]);return db[_0xdb6e('0x26')][_0xdb6e('0x42')](_0x3a962c)[_0xdb6e('0x21')](handleEntityNotFound(_0x1cb499,null))[_0xdb6e('0x21')](respondWithResult(_0x1cb499,null))[_0xdb6e('0x3f')](handleError(_0x1cb499,null));};exports['create']=function(_0x4f08a4,_0x35bc80){return db[_0xdb6e('0x26')][_0xdb6e('0x43')](_0x4f08a4[_0xdb6e('0x44')],{})[_0xdb6e('0x21')](respondWithResult(_0x35bc80,0xc9))[_0xdb6e('0x3f')](handleError(_0x35bc80,null));};exports[_0xdb6e('0x45')]=function(_0x374bb8,_0x19c812){if(_0x374bb8['body']['id']){delete _0x374bb8[_0xdb6e('0x44')]['id'];}return db[_0xdb6e('0x26')]['find']({'where':{'id':_0x374bb8[_0xdb6e('0x41')]['id']}})['then'](handleEntityNotFound(_0x19c812,null))[_0xdb6e('0x21')](saveUpdates(_0x374bb8[_0xdb6e('0x44')],null))['then'](respondWithResult(_0x19c812,null))['catch'](handleError(_0x19c812,null));};exports[_0xdb6e('0x22')]=function(_0x949e5,_0xc71db){return db[_0xdb6e('0x26')][_0xdb6e('0x42')]({'where':{'id':_0x949e5['params']['id']}})['then'](handleEntityNotFound(_0xc71db,null))[_0xdb6e('0x21')](removeEntity(_0xc71db,null))[_0xdb6e('0x3f')](handleError(_0xc71db,null));};exports[_0xdb6e('0x46')]=function(_0x1135f4,_0xa58a42,_0x5cb7d6){var _0x57b4c2={};var _0xb2f03b={};var _0x381b52;var _0x59862d;return db[_0xdb6e('0x26')]['findOne']({'where':{'id':_0x1135f4[_0xdb6e('0x41')]['id']}})[_0xdb6e('0x21')](handleEntityNotFound(_0xa58a42,null))[_0xdb6e('0x21')](function(_0x43b43a){if(_0x43b43a){_0x381b52=_0x43b43a;_0xb2f03b[_0xdb6e('0x2b')]=_[_0xdb6e('0x2e')](db[_0xdb6e('0x47')][_0xdb6e('0x27')]);_0xb2f03b[_0xdb6e('0x2d')]=_['keys'](_0x1135f4[_0xdb6e('0x2d')]);_0xb2f03b[_0xdb6e('0x2f')]=_[_0xdb6e('0x30')](_0xb2f03b['model'],_0xb2f03b[_0xdb6e('0x2d')]);_0x57b4c2[_0xdb6e('0x31')]=_[_0xdb6e('0x30')](_0xb2f03b[_0xdb6e('0x2b')],qs[_0xdb6e('0x32')](_0x1135f4['query'][_0xdb6e('0x32')]));_0x57b4c2['attributes']=_0x57b4c2[_0xdb6e('0x31')][_0xdb6e('0x33')]?_0x57b4c2[_0xdb6e('0x31')]:_0xb2f03b[_0xdb6e('0x2b')];_0x57b4c2[_0xdb6e('0x34')]=qs[_0xdb6e('0x35')](_0x1135f4[_0xdb6e('0x2d')][_0xdb6e('0x35')]);_0x57b4c2[_0xdb6e('0x36')]=qs[_0xdb6e('0x2f')](_[_0xdb6e('0x37')](_0x1135f4[_0xdb6e('0x2d')],_0xb2f03b[_0xdb6e('0x2f')]));if(_0x1135f4['query'][_0xdb6e('0x38')]){_0x57b4c2[_0xdb6e('0x36')]=_[_0xdb6e('0x39')](_0x57b4c2['where'],{'$or':_[_0xdb6e('0x25')](_0x57b4c2[_0xdb6e('0x31')],function(_0x1ef463){var _0x26ec44={};_0x26ec44[_0x1ef463]={'$like':'%'+_0x1135f4[_0xdb6e('0x2d')][_0xdb6e('0x38')]+'%'};return _0x26ec44;})});}_0x57b4c2=_[_0xdb6e('0x39')]({},_0x57b4c2,_0x1135f4[_0xdb6e('0x3a')]);return _0x381b52[_0xdb6e('0x46')](_0x57b4c2);}})['then'](function(_0x265052){if(_0x265052){_0x59862d=_0x265052['length'];if(!_0x1135f4[_0xdb6e('0x2d')][_0xdb6e('0x48')](_0xdb6e('0x49'))){_0x57b4c2[_0xdb6e('0x1b')]=qs['limit'](_0x1135f4[_0xdb6e('0x2d')][_0xdb6e('0x1b')]);_0x57b4c2[_0xdb6e('0x19')]=qs[_0xdb6e('0x19')](_0x1135f4[_0xdb6e('0x2d')][_0xdb6e('0x19')]);}return _0x381b52[_0xdb6e('0x46')](_0x57b4c2);}})[_0xdb6e('0x21')](function(_0x13316d){if(_0x13316d){return _0x13316d?{'count':_0x59862d,'rows':_0x13316d}:null;}})[_0xdb6e('0x21')](respondWithResult(_0xa58a42,null))[_0xdb6e('0x3f')](handleError(_0xa58a42,null));};exports[_0xdb6e('0x4a')]=function(_0x4bb36d,_0x127a51,_0x25a02d){if(_0x4bb36d[_0xdb6e('0x44')]['id']){delete _0x4bb36d[_0xdb6e('0x44')]['id'];}return db[_0xdb6e('0x26')]['findOne']({'where':{'id':_0x4bb36d[_0xdb6e('0x41')]['id']}})['then'](handleEntityNotFound(_0x127a51,null))[_0xdb6e('0x21')](function(_0x2ded6a){if(_0x2ded6a){_0x4bb36d[_0xdb6e('0x44')]['AccountId']=_0x2ded6a['id'];_0x4bb36d[_0xdb6e('0x44')]['Subjects']=integrations[_0xdb6e('0x4b')](_0x4bb36d['body'][_0xdb6e('0x4c')],_0x4bb36d[_0xdb6e('0x44')]['type']);_0x4bb36d[_0xdb6e('0x44')][_0xdb6e('0x4d')]=integrations[_0xdb6e('0x4e')](_0x4bb36d[_0xdb6e('0x44')][_0xdb6e('0x4c')],_0x4bb36d[_0xdb6e('0x44')][_0xdb6e('0x29')]);return db[_0xdb6e('0x47')]['create'](_0x4bb36d[_0xdb6e('0x44')],{'include':[{'model':db[_0xdb6e('0x4f')],'as':_0xdb6e('0x50')},{'model':db[_0xdb6e('0x4f')],'as':'Descriptions'}]});}return null;})[_0xdb6e('0x21')](respondWithResult(_0x127a51,null))[_0xdb6e('0x3f')](handleError(_0x127a51,null));};exports[_0xdb6e('0x51')]=function(_0x37d9dc,_0x134340,_0x251ec0){var _0x3cd5ac=[_0xdb6e('0x52'),'hold_reason',_0xdb6e('0x53'),_0xdb6e('0x54'),'close_code',_0xdb6e('0x55'),_0xdb6e('0x56'),_0xdb6e('0x57'),_0xdb6e('0x58')];var _0x51f9d9=['parent','made_sla','caused_by','watch_list','upon_reject',_0xdb6e('0x59'),_0xdb6e('0x5a'),'hold_reason',_0xdb6e('0x5b'),_0xdb6e('0x5c'),_0xdb6e('0x5d'),_0xdb6e('0x5e'),_0xdb6e('0x5f'),_0xdb6e('0x60'),_0xdb6e('0x61'),_0xdb6e('0x62'),_0xdb6e('0x63'),_0xdb6e('0x64'),_0xdb6e('0x53'),_0xdb6e('0x34'),_0xdb6e('0x65'),_0xdb6e('0x66'),_0xdb6e('0x67'),_0xdb6e('0x68'),'impact',_0xdb6e('0x69'),_0xdb6e('0x6a'),_0xdb6e('0x6b'),'priority',_0xdb6e('0x6c'),_0xdb6e('0x6d'),_0xdb6e('0x6e'),_0xdb6e('0x6f'),_0xdb6e('0x70'),'business_duration',_0xdb6e('0x71'),'work_end',_0xdb6e('0x72'),_0xdb6e('0x73'),_0xdb6e('0x74'),'approval_set',_0xdb6e('0x54'),'work_notes','short_description',_0xdb6e('0x75'),_0xdb6e('0x76'),_0xdb6e('0x77'),_0xdb6e('0x78'),_0xdb6e('0x79'),'business_stc',_0xdb6e('0x7a'),'description',_0xdb6e('0x7b'),_0xdb6e('0x55'),'sys_class_name',_0xdb6e('0x7c'),_0xdb6e('0x7d'),_0xdb6e('0x7e'),_0xdb6e('0x7f'),_0xdb6e('0x80'),_0xdb6e('0x81'),'reopened_by','incident_state','urgency',_0xdb6e('0x82'),_0xdb6e('0x83'),_0xdb6e('0x84'),_0xdb6e('0x85'),'assigned_to',_0xdb6e('0x57'),_0xdb6e('0x86'),_0xdb6e('0x87'),_0xdb6e('0x88'),_0xdb6e('0x89'),_0xdb6e('0x8a'),'sys_mod_count',_0xdb6e('0x8b'),_0xdb6e('0x8c'),_0xdb6e('0x8d'),_0xdb6e('0x8e'),'correlation_id',_0xdb6e('0x8f'),_0xdb6e('0x58')];var _0x90c810='';var _0x4d01af='';var _0x51079a=[];var _0x556d45='';var _0xc223ed='';var _0x542e74=[];var _0x50e5e8='';var _0x212017='';var _0x53ceeb={};var _0x19393f='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x37d9dc[_0xdb6e('0x41')]['id']},'attributes':['id',_0xdb6e('0x90'),_0xdb6e('0x91'),'email',_0xdb6e('0x92'),'serverUrl']})[_0xdb6e('0x21')](handleEntityNotFound(_0x134340,null))[_0xdb6e('0x21')](function(_0x3d9b72){if(_0x3d9b72){_0x19393f=_0x3d9b72[_0xdb6e('0x92')];var _0x48f388=_0x19393f['slice'](-0x1);if(_0x48f388==='/'){_0x19393f=_0x19393f[_0xdb6e('0x93')](0x0,_0x19393f['lastIndexOf'](_0x48f388));}_0x212017=util[_0xdb6e('0x94')](_0xdb6e('0x95'),_0x19393f);_0x50e5e8=util[_0xdb6e('0x94')]('%s/api/now/table/',_0x19393f);_0x53ceeb={'user':_0x3d9b72['username'],'pass':_0x3d9b72['password']};var _0x5be353={'method':_0xdb6e('0x96'),'uri':_0x212017+_0xdb6e('0x97'),'auth':_0x53ceeb,'json':!![]};return rp(_0x5be353);}})['then'](function(_0x9cdbb7){if(_0x9cdbb7['result'][_0xdb6e('0x33')]>0x0){_0x90c810=_0x9cdbb7[_0xdb6e('0x98')];}console[_0xdb6e('0x99')]('incident\x20table\x20objects',_0x90c810);_0x542e74=[];_0x4d01af=Object['assign']([],_0x90c810);_[_0xdb6e('0x9a')](_0x4d01af,function(_0x512afe){return!_0x3cd5ac[_0xdb6e('0x9b')](_0x512afe['name']);});_0x4d01af[_0xdb6e('0x9c')](function(_0x49aeb4){var _0x4e4a57=createFieldObject(_0x50e5e8,_0x53ceeb,_0x49aeb4['internalType'],_0x49aeb4[_0xdb6e('0x2c')],_0x49aeb4[_0xdb6e('0x9d')],![]);_0x542e74['push'](_0x4e4a57);});return Promise[_0xdb6e('0x9e')](_0x542e74);})[_0xdb6e('0x21')](function(_0x2000e8){_0x51079a=_0x2000e8;_0x556d45=Object[_0xdb6e('0x9f')]([],_0x90c810);console[_0xdb6e('0x99')]('TCL:\x20_object',_0x90c810);_[_0xdb6e('0x9a')](_0x556d45,function(_0x589c50){return _0x51f9d9[_0xdb6e('0x9b')](_0x589c50[_0xdb6e('0x2c')]);});console['log']('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x556d45);_0x542e74=[];_0x556d45[_0xdb6e('0x9c')](function(_0x25a22f){var _0x1b8dbd=createFieldObject(_0x50e5e8,_0x53ceeb,_0x25a22f['internalType'],_0x25a22f[_0xdb6e('0x2c')],_0x25a22f['label'],!![]);_0x542e74[_0xdb6e('0xa0')](_0x1b8dbd);});return Promise[_0xdb6e('0x9e')](_0x542e74);})[_0xdb6e('0x21')](function(_0x208fee){_0xc223ed=_0x208fee;var _0x3b2844=_0x51079a[_0xdb6e('0xa1')](_0xc223ed);return{'count':_0x3b2844[_0xdb6e('0x33')],'rows':_0x3b2844};})[_0xdb6e('0x21')](respondWithResult(_0x134340,null))['catch'](function(_0x33c0c7){console['log'](_0xdb6e('0xa2')+_0x33c0c7);var _0x1359d5=_0x37d9dc[_0xdb6e('0x2d')]['test']?0x1f4:_0x33c0c7[_0xdb6e('0xa3')]||0x1f4;logger[_0xdb6e('0x23')](_0x33c0c7[_0xdb6e('0xa4')]);delete _0x33c0c7[_0xdb6e('0x2c')];if(_0x1359d5===0x191){_0x1359d5=0x190;}_0x134340[_0xdb6e('0x17')](_0x1359d5)[_0xdb6e('0x24')](_0x37d9dc['query'][_0xdb6e('0xa5')]?{'message':_0xdb6e('0xa6'),'statusCode':_0x33c0c7['statusCode']}:_0x33c0c7);});};function createFieldObject(_0x30d8fa,_0x27bd40,_0x3afac6,_0x4cc31f,_0x3b5545,_0x4a8a79){return new Promise(function(_0x227a01,_0x39908a){var _0x4fcb26={'id':_0x4cc31f,'name':_0x3b5545,'custom':_0x4a8a79};if(_0x3afac6==='boolean'){_0x4fcb26['options']=[{'name':_0xdb6e('0xa7'),'value':'true'},{'name':_0xdb6e('0xa8'),'value':_0xdb6e('0xa9')}];_0x227a01(_0x4fcb26);}else{var _0x553a7b={'method':_0xdb6e('0x96'),'uri':_0x30d8fa+'sys_choice?sysparm_query=name=incident^element='+_0x4cc31f,'auth':_0x27bd40,'json':!![]};return rp(_0x553a7b)[_0xdb6e('0x21')](function(_0x8f704f){var _0x5d572e=[];if(_0x8f704f[_0xdb6e('0x98')]['length']>0x0){_0x8f704f['result']['forEach'](function(_0x540acb){if(_0x540acb[_0xdb6e('0xaa')]===_0xdb6e('0xa9')){var _0x3d4c85={'name':_0x540acb[_0xdb6e('0x9d')],'value':_0x540acb[_0xdb6e('0xab')]};_0x5d572e[_0xdb6e('0xa0')](_0x3d4c85);}});}_0x4fcb26[_0xdb6e('0x3a')]=_0x5d572e;if(_0x4fcb26[_0xdb6e('0x3a')]['length']>0x0){_0x227a01(_0x4fcb26);}else{if(_0x4a8a79==![]){_0x227a01();}else{_0x227a01(_0x4fcb26);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 906e609..4500213 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 _0x3eea=['bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','../../config/logger','api','moment'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x2e0486,_0x53cba3){_0x2e0486=_0x2e0486-0x0;var _0x5a10ba=_0x3eea[_0x2e0486];return _0x5a10ba;};'use strict';var _=require(_0xa3ee('0x0'));var util=require('util');var logger=require(_0xa3ee('0x1'))(_0xa3ee('0x2'));var moment=require(_0xa3ee('0x3'));var BPromise=require(_0xa3ee('0x4'));var rp=require(_0xa3ee('0x5'));var fs=require('fs');var path=require(_0xa3ee('0x6'));var rimraf=require(_0xa3ee('0x7'));var config=require(_0xa3ee('0x8'));var attributes=require(_0xa3ee('0x9'));var integrations=require(_0xa3ee('0xa'));module[_0xa3ee('0xb')]=function(_0x5776bb,_0x538bf9){return _0x5776bb[_0xa3ee('0xc')]('ServicenowAccount',attributes,{'tableName':_0xa3ee('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['api','moment','bluebird','request-promise','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger'];(function(_0x559b90,_0x2595e0){var _0x4c4ad2=function(_0x1a40bd){while(--_0x1a40bd){_0x559b90['push'](_0x559b90['shift']());}};_0x4c4ad2(++_0x2595e0);}(_0x7217,0x19e));var _0x7721=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x7217[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));var integrations=require(_0x7721('0x8'));module[_0x7721('0x9')]=function(_0xb239e0,_0xf7ff37){return _0xb239e0[_0x7721('0xa')](_0x7721('0xb'),attributes,{'tableName':_0x7721('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 2d9eb3c..f4dfe90 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 _0x7716=['map','include','model','ShowServicenowAccount','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit'];(function(_0x4aede2,_0x2960d6){var _0xf38bd1=function(_0x25d102){while(--_0x25d102){_0x4aede2['push'](_0x4aede2['shift']());}};_0xf38bd1(++_0x2960d6);}(_0x7716,0x6a));var _0x6771=function(_0x1ae8ab,_0x6e5c2a){_0x1ae8ab=_0x1ae8ab-0x0;var _0x1ad705=_0x7716[_0x1ae8ab];return _0x1ad705;};'use strict';var _=require(_0x6771('0x0'));var util=require('util');var moment=require(_0x6771('0x1'));var BPromise=require(_0x6771('0x2'));var rs=require(_0x6771('0x3'));var fs=require('fs');var Redis=require(_0x6771('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6771('0x5'));var logger=require(_0x6771('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6771('0x7'));var client=jayson[_0x6771('0x8')][_0x6771('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x514dd2,_0x64edd9,_0x4a2d1d){return new BPromise(function(_0x41c880,_0x1be9a1){return client['request'](_0x514dd2,_0x4a2d1d)[_0x6771('0xa')](function(_0x298b6b){logger[_0x6771('0xb')]('ServicenowAccount,\x20%s,\x20%s',_0x64edd9,'request\x20sent');logger[_0x6771('0xc')](_0x6771('0xd'),_0x64edd9,_0x6771('0xe'),JSON[_0x6771('0xf')](_0x298b6b));if(_0x298b6b[_0x6771('0x10')]){if(_0x298b6b['error'][_0x6771('0x11')]===0x1f4){logger['error'](_0x6771('0x12'),_0x64edd9,_0x298b6b[_0x6771('0x10')][_0x6771('0x13')]);return _0x1be9a1(_0x298b6b[_0x6771('0x10')][_0x6771('0x13')]);}logger[_0x6771('0x10')](_0x6771('0x12'),_0x64edd9,_0x298b6b[_0x6771('0x10')][_0x6771('0x13')]);return _0x41c880(_0x298b6b['error'][_0x6771('0x13')]);}else{logger[_0x6771('0xb')](_0x6771('0x12'),_0x64edd9,_0x6771('0xe'));_0x41c880(_0x298b6b[_0x6771('0x14')][_0x6771('0x13')]);}})[_0x6771('0x15')](function(_0x35ade2){logger[_0x6771('0x10')](_0x6771('0x12'),_0x64edd9,_0x35ade2);_0x1be9a1(_0x35ade2);});});}exports[_0x6771('0x16')]=function(_0x46f6ee){var _0x1eb837=this;return new Promise(function(_0x24336d,_0x2b9b83){return db[_0x6771('0x17')][_0x6771('0x18')]({'raw':_0x46f6ee[_0x6771('0x19')]?_0x46f6ee[_0x6771('0x19')][_0x6771('0x1a')]===undefined?!![]:![]:!![],'where':_0x46f6ee[_0x6771('0x19')]?_0x46f6ee[_0x6771('0x19')][_0x6771('0x1b')]||null:null,'attributes':_0x46f6ee[_0x6771('0x19')]?_0x46f6ee[_0x6771('0x19')][_0x6771('0x1c')]||null:null,'limit':_0x46f6ee[_0x6771('0x19')]?_0x46f6ee[_0x6771('0x19')][_0x6771('0x1d')]||null:null,'include':_0x46f6ee[_0x6771('0x19')]?_0x46f6ee[_0x6771('0x19')]['include']?_[_0x6771('0x1e')](_0x46f6ee['options'][_0x6771('0x1f')],function(_0x296db3){return{'model':db[_0x296db3[_0x6771('0x20')]],'as':_0x296db3['as'],'attributes':_0x296db3['attributes'],'include':_0x296db3[_0x6771('0x1f')]?_['map'](_0x296db3[_0x6771('0x1f')],function(_0x52dffb){return{'model':db[_0x52dffb[_0x6771('0x20')]],'as':_0x52dffb['as'],'attributes':_0x52dffb['attributes'],'include':_0x52dffb[_0x6771('0x1f')]?_[_0x6771('0x1e')](_0x52dffb['include'],function(_0x35c6ff){return{'model':db[_0x35c6ff['model']],'as':_0x35c6ff['as'],'attributes':_0x35c6ff[_0x6771('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32280f){logger['info'](_0x6771('0x16'),_0x46f6ee);logger['debug'](_0x6771('0x16'),_0x46f6ee,JSON[_0x6771('0xf')](_0x32280f));_0x24336d(_0x32280f);})[_0x6771('0x15')](function(_0x381dfe){logger['error'](_0x6771('0x16'),_0x381dfe[_0x6771('0x13')],_0x46f6ee);_0x2b9b83(_0x1eb837[_0x6771('0x10')](0x1f4,_0x381dfe['message']));});});};exports[_0x6771('0x21')]=function(_0x396c38){var _0x449ebb=this;return new Promise(function(_0x219bf8,_0x30cde8){return db[_0x6771('0x17')]['find']({'raw':_0x396c38['options']?_0x396c38[_0x6771('0x19')][_0x6771('0x1a')]===undefined?!![]:![]:!![],'where':_0x396c38['options']?_0x396c38[_0x6771('0x19')]['where']||null:null,'attributes':_0x396c38[_0x6771('0x19')]?_0x396c38[_0x6771('0x19')][_0x6771('0x1c')]||null:null,'include':_0x396c38[_0x6771('0x19')]?_0x396c38[_0x6771('0x19')][_0x6771('0x1f')]?_[_0x6771('0x1e')](_0x396c38[_0x6771('0x19')][_0x6771('0x1f')],function(_0x469c72){return{'model':db[_0x469c72[_0x6771('0x20')]],'as':_0x469c72['as'],'attributes':_0x469c72[_0x6771('0x1c')],'include':_0x469c72[_0x6771('0x1f')]?_[_0x6771('0x1e')](_0x469c72[_0x6771('0x1f')],function(_0x2d8983){return{'model':db[_0x2d8983[_0x6771('0x20')]],'as':_0x2d8983['as'],'attributes':_0x2d8983[_0x6771('0x1c')],'include':_0x2d8983['include']?_[_0x6771('0x1e')](_0x2d8983['include'],function(_0x1786ad){return{'model':db[_0x1786ad[_0x6771('0x20')]],'as':_0x1786ad['as'],'attributes':_0x1786ad['attributes']};}):[]};}):[]};}):[]:[]})[_0x6771('0xa')](function(_0x31b973){logger['info']('ShowServicenowAccount',_0x396c38);logger[_0x6771('0xc')](_0x6771('0x21'),_0x396c38,JSON[_0x6771('0xf')](_0x31b973));_0x219bf8(_0x31b973);})['catch'](function(_0x48d163){logger['error'](_0x6771('0x21'),_0x48d163[_0x6771('0x13')],_0x396c38);_0x30cde8(_0x449ebb['error'](0x1f4,_0x48d163[_0x6771('0x13')]));});});}; \ No newline at end of file +var _0xb072=['limit','include','map','model','attributes','ShowServicenowAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xb072,0x139));var _0x2b07=function(_0x4fde27,_0x353703){_0x4fde27=_0x4fde27-0x0;var _0x14b773=_0xb072[_0x4fde27];return _0x14b773;};'use strict';var _=require(_0x2b07('0x0'));var util=require(_0x2b07('0x1'));var moment=require('moment');var BPromise=require(_0x2b07('0x2'));var rs=require(_0x2b07('0x3'));var fs=require('fs');var Redis=require(_0x2b07('0x4'));var db=require(_0x2b07('0x5'))['db'];var utils=require(_0x2b07('0x6'));var logger=require(_0x2b07('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2b07('0x8')][_0x2b07('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4cbc6b,_0x2e9626,_0x4e801f){return new BPromise(function(_0x8e938c,_0x532497){return client[_0x2b07('0xa')](_0x4cbc6b,_0x4e801f)[_0x2b07('0xb')](function(_0x6becc6){logger[_0x2b07('0xc')](_0x2b07('0xd'),_0x2e9626,'request\x20sent');logger[_0x2b07('0xe')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x2e9626,_0x2b07('0xf'),JSON[_0x2b07('0x10')](_0x6becc6));if(_0x6becc6['error']){if(_0x6becc6[_0x2b07('0x11')][_0x2b07('0x12')]===0x1f4){logger[_0x2b07('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x2e9626,_0x6becc6['error'][_0x2b07('0x13')]);return _0x532497(_0x6becc6[_0x2b07('0x11')]['message']);}logger[_0x2b07('0x11')](_0x2b07('0xd'),_0x2e9626,_0x6becc6[_0x2b07('0x11')][_0x2b07('0x13')]);return _0x8e938c(_0x6becc6[_0x2b07('0x11')]['message']);}else{logger[_0x2b07('0xc')](_0x2b07('0xd'),_0x2e9626,'request\x20sent');_0x8e938c(_0x6becc6['result'][_0x2b07('0x13')]);}})[_0x2b07('0x14')](function(_0x340982){logger[_0x2b07('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x2e9626,_0x340982);_0x532497(_0x340982);});});}exports[_0x2b07('0x15')]=function(_0xb9a8ff){var _0x118677=this;return new Promise(function(_0x5783ac,_0x5de169){return db[_0x2b07('0x16')][_0x2b07('0x17')]({'raw':_0xb9a8ff['options']?_0xb9a8ff[_0x2b07('0x18')][_0x2b07('0x19')]===undefined?!![]:![]:!![],'where':_0xb9a8ff[_0x2b07('0x18')]?_0xb9a8ff[_0x2b07('0x18')][_0x2b07('0x1a')]||null:null,'attributes':_0xb9a8ff[_0x2b07('0x18')]?_0xb9a8ff[_0x2b07('0x18')]['attributes']||null:null,'limit':_0xb9a8ff[_0x2b07('0x18')]?_0xb9a8ff[_0x2b07('0x18')][_0x2b07('0x1b')]||null:null,'include':_0xb9a8ff[_0x2b07('0x18')]?_0xb9a8ff['options'][_0x2b07('0x1c')]?_[_0x2b07('0x1d')](_0xb9a8ff[_0x2b07('0x18')][_0x2b07('0x1c')],function(_0x311735){return{'model':db[_0x311735[_0x2b07('0x1e')]],'as':_0x311735['as'],'attributes':_0x311735['attributes'],'include':_0x311735[_0x2b07('0x1c')]?_[_0x2b07('0x1d')](_0x311735['include'],function(_0x89ae70){return{'model':db[_0x89ae70[_0x2b07('0x1e')]],'as':_0x89ae70['as'],'attributes':_0x89ae70[_0x2b07('0x1f')],'include':_0x89ae70['include']?_[_0x2b07('0x1d')](_0x89ae70[_0x2b07('0x1c')],function(_0x100f0b){return{'model':db[_0x100f0b[_0x2b07('0x1e')]],'as':_0x100f0b['as'],'attributes':_0x100f0b[_0x2b07('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2b07('0xb')](function(_0x3231f5){logger['info'](_0x2b07('0x15'),_0xb9a8ff);logger['debug'](_0x2b07('0x15'),_0xb9a8ff,JSON[_0x2b07('0x10')](_0x3231f5));_0x5783ac(_0x3231f5);})[_0x2b07('0x14')](function(_0x2ad420){logger[_0x2b07('0x11')](_0x2b07('0x15'),_0x2ad420['message'],_0xb9a8ff);_0x5de169(_0x118677['error'](0x1f4,_0x2ad420[_0x2b07('0x13')]));});});};exports[_0x2b07('0x20')]=function(_0x38b76c){var _0x9a6a9e=this;return new Promise(function(_0xdea355,_0x4d6fbd){return db['ServicenowAccount'][_0x2b07('0x21')]({'raw':_0x38b76c[_0x2b07('0x18')]?_0x38b76c[_0x2b07('0x18')][_0x2b07('0x19')]===undefined?!![]:![]:!![],'where':_0x38b76c['options']?_0x38b76c[_0x2b07('0x18')][_0x2b07('0x1a')]||null:null,'attributes':_0x38b76c['options']?_0x38b76c[_0x2b07('0x18')]['attributes']||null:null,'include':_0x38b76c[_0x2b07('0x18')]?_0x38b76c[_0x2b07('0x18')][_0x2b07('0x1c')]?_[_0x2b07('0x1d')](_0x38b76c[_0x2b07('0x18')][_0x2b07('0x1c')],function(_0x2f848c){return{'model':db[_0x2f848c[_0x2b07('0x1e')]],'as':_0x2f848c['as'],'attributes':_0x2f848c[_0x2b07('0x1f')],'include':_0x2f848c[_0x2b07('0x1c')]?_['map'](_0x2f848c[_0x2b07('0x1c')],function(_0x4d3cda){return{'model':db[_0x4d3cda['model']],'as':_0x4d3cda['as'],'attributes':_0x4d3cda[_0x2b07('0x1f')],'include':_0x4d3cda[_0x2b07('0x1c')]?_[_0x2b07('0x1d')](_0x4d3cda[_0x2b07('0x1c')],function(_0x1a1a30){return{'model':db[_0x1a1a30[_0x2b07('0x1e')]],'as':_0x1a1a30['as'],'attributes':_0x1a1a30[_0x2b07('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x244610){logger[_0x2b07('0xc')]('ShowServicenowAccount',_0x38b76c);logger[_0x2b07('0xe')](_0x2b07('0x20'),_0x38b76c,JSON[_0x2b07('0x10')](_0x244610));_0xdea355(_0x244610);})[_0x2b07('0x14')](function(_0x471622){logger[_0x2b07('0x11')](_0x2b07('0x20'),_0x471622[_0x2b07('0x13')],_0x38b76c);_0x4d6fbd(_0x9a6a9e[_0x2b07('0x11')](0x1f4,_0x471622[_0x2b07('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index e7b1258..7f6df71 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 _0x29b7=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','/:id','show','getFields','getSubjects','/:id/descriptions','put','update','delete','destroy','exports','multer','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x29b7,0x1b5));var _0x729b=function(_0x3c437d,_0x500e32){_0x3c437d=_0x3c437d-0x0;var _0x286dd4=_0x29b7[_0x3c437d];return _0x286dd4;};'use strict';var multer=require(_0x729b('0x0'));var util=require(_0x729b('0x1'));var path=require(_0x729b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x729b('0x3')]();var fs_extra=require(_0x729b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x729b('0x5'));var config=require(_0x729b('0x6'));var controller=require(_0x729b('0x7'));router[_0x729b('0x8')]('/',auth[_0x729b('0x9')](),controller['index']);router[_0x729b('0x8')](_0x729b('0xa'),auth[_0x729b('0x9')](),controller[_0x729b('0xb')]);router[_0x729b('0x8')]('/:id/fields',auth[_0x729b('0x9')](),controller[_0x729b('0xc')]);router[_0x729b('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x729b('0xd')]);router[_0x729b('0x8')](_0x729b('0xe'),auth[_0x729b('0x9')](),controller['getDescriptions']);router['post']('/',auth[_0x729b('0x9')](),controller['create']);router[_0x729b('0xf')](_0x729b('0xa'),auth[_0x729b('0x9')](),controller[_0x729b('0x10')]);router[_0x729b('0x11')](_0x729b('0xa'),auth['isAuthenticated'](),controller[_0x729b('0x12')]);module[_0x729b('0x13')]=router; \ No newline at end of file +var _0x2dbe=['exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','put','update','delete'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2dbe,0xfe));var _0xe2db=function(_0x22a833,_0x23bcb9){_0x22a833=_0x22a833-0x0;var _0x44b0ce=_0x2dbe[_0x22a833];return _0x44b0ce;};'use strict';var multer=require(_0xe2db('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe2db('0x1'));var express=require(_0xe2db('0x2'));var router=express[_0xe2db('0x3')]();var fs_extra=require(_0xe2db('0x4'));var auth=require(_0xe2db('0x5'));var interaction=require(_0xe2db('0x6'));var config=require(_0xe2db('0x7'));var controller=require(_0xe2db('0x8'));router[_0xe2db('0x9')]('/',auth[_0xe2db('0xa')](),controller[_0xe2db('0xb')]);router['get'](_0xe2db('0xc'),auth[_0xe2db('0xa')](),controller[_0xe2db('0xd')]);router[_0xe2db('0x9')](_0xe2db('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0xe2db('0x9')](_0xe2db('0xf'),auth[_0xe2db('0xa')](),controller['getSubjects']);router[_0xe2db('0x9')](_0xe2db('0x10'),auth[_0xe2db('0xa')](),controller[_0xe2db('0x11')]);router[_0xe2db('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe2db('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xe2db('0x14')]);router[_0xe2db('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xe2db('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 227aae2..bc446e9 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 _0x6b60=['exports','STRING'];(function(_0x2b2580,_0x5ac3f2){var _0x50c840=function(_0x2af697){while(--_0x2af697){_0x2b2580['push'](_0x2b2580['shift']());}};_0x50c840(++_0x5ac3f2);}(_0x6b60,0x130));var _0x06b6=function(_0x4eb6ec,_0x7f2520){_0x4eb6ec=_0x4eb6ec-0x0;var _0x58881b=_0x6b60[_0x4eb6ec];return _0x58881b;};'use strict';var Sequelize=require('sequelize');module[_0x06b6('0x0')]={'name':{'type':Sequelize[_0x06b6('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xba51=['sequelize','exports','STRING'];(function(_0x48999d,_0x1e02cb){var _0x1ad0d1=function(_0x3f974e){while(--_0x3f974e){_0x48999d['push'](_0x48999d['shift']());}};_0x1ad0d1(++_0x1e02cb);}(_0xba51,0xab));var _0x1ba5=function(_0x50f851,_0xfc6206){_0x50f851=_0x50f851-0x0;var _0x276568=_0xba51[_0x50f851];return _0x276568;};'use strict';var Sequelize=require(_0x1ba5('0x0'));module[_0x1ba5('0x1')]={'name':{'type':Sequelize[_0x1ba5('0x2')]},'description':{'type':Sequelize[_0x1ba5('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index f51edc3..b893299 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 _0x3b3f=['send','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map','includeAll','include','findAll','rows','catch','params','length','options','find','create','body','getFields','findOne','ServicenowField','getSubjects','pick','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','name'];(function(_0xef6891,_0x5ed2bc){var _0xc8794d=function(_0xf711cb){while(--_0xf711cb){_0xef6891['push'](_0xef6891['shift']());}};_0xc8794d(++_0x5ed2bc);}(_0x3b3f,0x77));var _0xf3b3=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3b3f[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0xf3b3('0x0'));var rimraf=require(_0xf3b3('0x1'));var zipdir=require(_0xf3b3('0x2'));var jsonpatch=require(_0xf3b3('0x3'));var rp=require(_0xf3b3('0x4'));var moment=require('moment');var BPromise=require(_0xf3b3('0x5'));var Mustache=require(_0xf3b3('0x6'));var util=require(_0xf3b3('0x7'));var path=require(_0xf3b3('0x8'));var sox=require(_0xf3b3('0x9'));var csv=require(_0xf3b3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf3b3('0xb'));var squel=require(_0xf3b3('0xc'));var crypto=require(_0xf3b3('0xd'));var jsforce=require(_0xf3b3('0xe'));var deskjs=require(_0xf3b3('0xf'));var toCsv=require(_0xf3b3('0xa'));var querystring=require(_0xf3b3('0x10'));var Papa=require('papaparse');var Redis=require(_0xf3b3('0x11'));var authService=require(_0xf3b3('0x12'));var qs=require(_0xf3b3('0x13'));var as=require(_0xf3b3('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf3b3('0x15'))(_0xf3b3('0x16'));var utils=require(_0xf3b3('0x17'));var config=require(_0xf3b3('0x18'));var licenseUtil=require(_0xf3b3('0x19'));var db=require(_0xf3b3('0x1a'))['db'];function respondWithStatusCode(_0x2e7ae1,_0x40054b){_0x40054b=_0x40054b||0xcc;return function(_0x1b5791){if(_0x1b5791){return _0x2e7ae1[_0xf3b3('0x1b')](_0x40054b);}return _0x2e7ae1[_0xf3b3('0x1c')](_0x40054b)[_0xf3b3('0x1d')]();};}function respondWithResult(_0x157363,_0x5a9fb9){_0x5a9fb9=_0x5a9fb9||0xc8;return function(_0x2564d1){if(_0x2564d1){return _0x157363['status'](_0x5a9fb9)[_0xf3b3('0x1e')](_0x2564d1);}};}function respondWithFilteredResult(_0x2a3d9b,_0x35507b){return function(_0x332135){if(_0x332135){var _0x356588=typeof _0x35507b[_0xf3b3('0x1f')]===_0xf3b3('0x20')&&typeof _0x35507b[_0xf3b3('0x21')]===_0xf3b3('0x20');var _0x86e754=_0x332135[_0xf3b3('0x22')];var _0x5126df=_0x356588?0x0:_0x35507b['offset'];var _0x3c8dc0=_0x356588?_0x332135[_0xf3b3('0x22')]:_0x35507b[_0xf3b3('0x1f')]+_0x35507b[_0xf3b3('0x21')];var _0x5d236b;if(_0x3c8dc0>=_0x86e754){_0x3c8dc0=_0x86e754;_0x5d236b=0xc8;}else{_0x5d236b=0xce;}_0x2a3d9b[_0xf3b3('0x1c')](_0x5d236b);return _0x2a3d9b[_0xf3b3('0x23')](_0xf3b3('0x24'),_0x5126df+'-'+_0x3c8dc0+'/'+_0x86e754)[_0xf3b3('0x1e')](_0x332135);}return null;};}function patchUpdates(_0x9df84c){return function(_0x55f716){try{jsonpatch['apply'](_0x55f716,_0x9df84c,!![]);}catch(_0x47a5b2){return BPromise[_0xf3b3('0x25')](_0x47a5b2);}return _0x55f716[_0xf3b3('0x26')]();};}function saveUpdates(_0x30ee44,_0x161b7f){return function(_0x1ff22d){if(_0x1ff22d){return _0x1ff22d[_0xf3b3('0x27')](_0x30ee44)[_0xf3b3('0x28')](function(_0x4e428b){return _0x4e428b;});}return null;};}function removeEntity(_0x23233a,_0x11d153){return function(_0x2de0f6){if(_0x2de0f6){return _0x2de0f6['destroy']()['then'](function(){_0x23233a[_0xf3b3('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x438f3e,_0x2710bd){return function(_0x3494d3){if(!_0x3494d3){_0x438f3e[_0xf3b3('0x1b')](0x194);}return _0x3494d3;};}function handleError(_0x1a65ef,_0x4f2dcf){_0x4f2dcf=_0x4f2dcf||0x1f4;return function(_0x526987){logger[_0xf3b3('0x29')](_0x526987['stack']);if(_0x526987[_0xf3b3('0x2a')]){delete _0x526987[_0xf3b3('0x2a')];}_0x1a65ef[_0xf3b3('0x1c')](_0x4f2dcf)[_0xf3b3('0x2b')](_0x526987);};}exports['index']=function(_0x36e3c0,_0x448cb5){var _0x404adb={},_0x24335d={},_0x487bfe={'count':0x0,'rows':[]};var _0xdd8995=_['map'](db[_0xf3b3('0x2c')][_0xf3b3('0x2d')],function(_0x1a6a6b){return{'name':_0x1a6a6b[_0xf3b3('0x2e')],'type':_0x1a6a6b[_0xf3b3('0x2f')][_0xf3b3('0x30')]};});_0x24335d[_0xf3b3('0x31')]=_['map'](_0xdd8995,_0xf3b3('0x2a'));_0x24335d[_0xf3b3('0x32')]=_[_0xf3b3('0x33')](_0x36e3c0[_0xf3b3('0x32')]);_0x24335d['filters']=_[_0xf3b3('0x34')](_0x24335d['model'],_0x24335d[_0xf3b3('0x32')]);_0x404adb[_0xf3b3('0x35')]=_[_0xf3b3('0x34')](_0x24335d[_0xf3b3('0x31')],qs[_0xf3b3('0x36')](_0x36e3c0['query']['fields']));_0x404adb[_0xf3b3('0x35')]=_0x404adb['attributes']['length']?_0x404adb['attributes']:_0x24335d['model'];if(!_0x36e3c0[_0xf3b3('0x32')][_0xf3b3('0x37')](_0xf3b3('0x38'))){_0x404adb[_0xf3b3('0x21')]=qs[_0xf3b3('0x21')](_0x36e3c0[_0xf3b3('0x32')][_0xf3b3('0x21')]);_0x404adb[_0xf3b3('0x1f')]=qs[_0xf3b3('0x1f')](_0x36e3c0[_0xf3b3('0x32')][_0xf3b3('0x1f')]);}_0x404adb[_0xf3b3('0x39')]=qs[_0xf3b3('0x3a')](_0x36e3c0[_0xf3b3('0x32')][_0xf3b3('0x3a')]);_0x404adb[_0xf3b3('0x3b')]=qs[_0xf3b3('0x3c')](_['pick'](_0x36e3c0['query'],_0x24335d[_0xf3b3('0x3c')]),_0xdd8995);if(_0x36e3c0[_0xf3b3('0x32')][_0xf3b3('0x3d')]){_0x404adb['where']=_[_0xf3b3('0x3e')](_0x404adb[_0xf3b3('0x3b')],{'$or':_[_0xf3b3('0x3f')](_0xdd8995,function(_0x53fb87){if(_0x53fb87[_0xf3b3('0x2f')]!=='VIRTUAL'){var _0x3e39e5={};_0x3e39e5[_0x53fb87[_0xf3b3('0x2a')]]={'$like':'%'+_0x36e3c0[_0xf3b3('0x32')]['filter']+'%'};return _0x3e39e5;}})});}_0x404adb=_['merge']({},_0x404adb,_0x36e3c0['options']);var _0x940530={'where':_0x404adb[_0xf3b3('0x3b')]};return db[_0xf3b3('0x2c')][_0xf3b3('0x22')](_0x940530)[_0xf3b3('0x28')](function(_0x23d73){_0x487bfe[_0xf3b3('0x22')]=_0x23d73;if(_0x36e3c0[_0xf3b3('0x32')][_0xf3b3('0x40')]){_0x404adb[_0xf3b3('0x41')]=[{'all':!![]}];}return db[_0xf3b3('0x2c')][_0xf3b3('0x42')](_0x404adb);})[_0xf3b3('0x28')](function(_0xf1a73){_0x487bfe[_0xf3b3('0x43')]=_0xf1a73;return _0x487bfe;})[_0xf3b3('0x28')](respondWithFilteredResult(_0x448cb5,_0x404adb))[_0xf3b3('0x44')](handleError(_0x448cb5,null));};exports['show']=function(_0x212f4b,_0xb36f8e){var _0x28f41f={'raw':![],'where':{'id':_0x212f4b[_0xf3b3('0x45')]['id']}},_0x2b865c={};_0x2b865c[_0xf3b3('0x31')]=_[_0xf3b3('0x33')](db[_0xf3b3('0x2c')][_0xf3b3('0x2d')]);_0x2b865c['query']=_['keys'](_0x212f4b[_0xf3b3('0x32')]);_0x2b865c[_0xf3b3('0x3c')]=_[_0xf3b3('0x34')](_0x2b865c[_0xf3b3('0x31')],_0x2b865c[_0xf3b3('0x32')]);_0x28f41f[_0xf3b3('0x35')]=_[_0xf3b3('0x34')](_0x2b865c[_0xf3b3('0x31')],qs[_0xf3b3('0x36')](_0x212f4b['query'][_0xf3b3('0x36')]));_0x28f41f[_0xf3b3('0x35')]=_0x28f41f['attributes'][_0xf3b3('0x46')]?_0x28f41f[_0xf3b3('0x35')]:_0x2b865c['model'];if(_0x212f4b[_0xf3b3('0x32')][_0xf3b3('0x40')]){_0x28f41f[_0xf3b3('0x41')]=[{'all':!![]}];}_0x28f41f=_[_0xf3b3('0x3e')]({},_0x28f41f,_0x212f4b[_0xf3b3('0x47')]);return db['ServicenowConfiguration'][_0xf3b3('0x48')](_0x28f41f)['then'](handleEntityNotFound(_0xb36f8e,null))[_0xf3b3('0x28')](respondWithResult(_0xb36f8e,null))[_0xf3b3('0x44')](handleError(_0xb36f8e,null));};exports[_0xf3b3('0x49')]=function(_0x1a85d,_0x2b638b){return db[_0xf3b3('0x2c')][_0xf3b3('0x49')](_0x1a85d[_0xf3b3('0x4a')],{})['then'](respondWithResult(_0x2b638b,0xc9))['catch'](handleError(_0x2b638b,null));};exports[_0xf3b3('0x27')]=function(_0x3a67b3,_0x5ec6c3){if(_0x3a67b3[_0xf3b3('0x4a')]['id']){delete _0x3a67b3['body']['id'];}return db[_0xf3b3('0x2c')][_0xf3b3('0x48')]({'where':{'id':_0x3a67b3[_0xf3b3('0x45')]['id']}})['then'](handleEntityNotFound(_0x5ec6c3,null))[_0xf3b3('0x28')](saveUpdates(_0x3a67b3[_0xf3b3('0x4a')],null))[_0xf3b3('0x28')](respondWithResult(_0x5ec6c3,null))[_0xf3b3('0x44')](handleError(_0x5ec6c3,null));};exports['destroy']=function(_0x33bb85,_0x186220){return db['ServicenowConfiguration'][_0xf3b3('0x48')]({'where':{'id':_0x33bb85[_0xf3b3('0x45')]['id']}})[_0xf3b3('0x28')](handleEntityNotFound(_0x186220,null))[_0xf3b3('0x28')](removeEntity(_0x186220,null))[_0xf3b3('0x44')](handleError(_0x186220,null));};exports[_0xf3b3('0x4b')]=function(_0xd13ae6,_0x24b765,_0x24bba2){var _0xff288a={};var _0x4bc9d3={};var _0xed5b42;var _0x25393c;return db[_0xf3b3('0x2c')][_0xf3b3('0x4c')]({'where':{'id':_0xd13ae6[_0xf3b3('0x45')]['id']}})['then'](handleEntityNotFound(_0x24b765,null))[_0xf3b3('0x28')](function(_0x35cad2){if(_0x35cad2){_0xed5b42=_0x35cad2;_0x4bc9d3['model']=_[_0xf3b3('0x33')](db[_0xf3b3('0x4d')][_0xf3b3('0x2d')]);_0x4bc9d3[_0xf3b3('0x32')]=_[_0xf3b3('0x33')](_0xd13ae6[_0xf3b3('0x32')]);_0x4bc9d3[_0xf3b3('0x3c')]=_[_0xf3b3('0x34')](_0x4bc9d3[_0xf3b3('0x31')],_0x4bc9d3[_0xf3b3('0x32')]);_0xff288a[_0xf3b3('0x35')]=_[_0xf3b3('0x34')](_0x4bc9d3[_0xf3b3('0x31')],qs[_0xf3b3('0x36')](_0xd13ae6[_0xf3b3('0x32')][_0xf3b3('0x36')]));_0xff288a[_0xf3b3('0x35')]=_0xff288a['attributes'][_0xf3b3('0x46')]?_0xff288a[_0xf3b3('0x35')]:_0x4bc9d3[_0xf3b3('0x31')];_0xff288a[_0xf3b3('0x39')]=qs[_0xf3b3('0x3a')](_0xd13ae6['query'][_0xf3b3('0x3a')]);_0xff288a[_0xf3b3('0x3b')]=qs[_0xf3b3('0x3c')](_['pick'](_0xd13ae6['query'],_0x4bc9d3[_0xf3b3('0x3c')]));if(_0xd13ae6[_0xf3b3('0x32')][_0xf3b3('0x3d')]){_0xff288a['where']=_[_0xf3b3('0x3e')](_0xff288a['where'],{'$or':_[_0xf3b3('0x3f')](_0xff288a[_0xf3b3('0x35')],function(_0x5b6557){var _0x2a8f30={};_0x2a8f30[_0x5b6557]={'$like':'%'+_0xd13ae6[_0xf3b3('0x32')][_0xf3b3('0x3d')]+'%'};return _0x2a8f30;})});}_0xff288a=_[_0xf3b3('0x3e')]({},_0xff288a,_0xd13ae6[_0xf3b3('0x47')]);return _0xed5b42[_0xf3b3('0x4b')](_0xff288a);}})['then'](function(_0x4becb6){if(_0x4becb6){_0x25393c=_0x4becb6[_0xf3b3('0x46')];if(!_0xd13ae6['query'][_0xf3b3('0x37')](_0xf3b3('0x38'))){_0xff288a[_0xf3b3('0x21')]=qs['limit'](_0xd13ae6[_0xf3b3('0x32')][_0xf3b3('0x21')]);_0xff288a[_0xf3b3('0x1f')]=qs[_0xf3b3('0x1f')](_0xd13ae6['query']['offset']);}return _0xed5b42[_0xf3b3('0x4b')](_0xff288a);}})[_0xf3b3('0x28')](function(_0x17d091){if(_0x17d091){return _0x17d091?{'count':_0x25393c,'rows':_0x17d091}:null;}})[_0xf3b3('0x28')](respondWithResult(_0x24b765,null))[_0xf3b3('0x44')](handleError(_0x24b765,null));};exports[_0xf3b3('0x4e')]=function(_0x901106,_0x59c085,_0x23b9bc){var _0x1e0489={};var _0xe19117={};var _0xe470c3;var _0x8c0a13;return db[_0xf3b3('0x2c')][_0xf3b3('0x4c')]({'where':{'id':_0x901106['params']['id']}})[_0xf3b3('0x28')](handleEntityNotFound(_0x59c085,null))[_0xf3b3('0x28')](function(_0x5c85e6){if(_0x5c85e6){_0xe470c3=_0x5c85e6;_0xe19117[_0xf3b3('0x31')]=_['keys'](db[_0xf3b3('0x4d')][_0xf3b3('0x2d')]);_0xe19117[_0xf3b3('0x32')]=_[_0xf3b3('0x33')](_0x901106[_0xf3b3('0x32')]);_0xe19117[_0xf3b3('0x3c')]=_[_0xf3b3('0x34')](_0xe19117[_0xf3b3('0x31')],_0xe19117[_0xf3b3('0x32')]);_0x1e0489[_0xf3b3('0x35')]=_[_0xf3b3('0x34')](_0xe19117[_0xf3b3('0x31')],qs[_0xf3b3('0x36')](_0x901106['query'][_0xf3b3('0x36')]));_0x1e0489[_0xf3b3('0x35')]=_0x1e0489[_0xf3b3('0x35')][_0xf3b3('0x46')]?_0x1e0489['attributes']:_0xe19117[_0xf3b3('0x31')];_0x1e0489[_0xf3b3('0x39')]=qs['sort'](_0x901106[_0xf3b3('0x32')][_0xf3b3('0x3a')]);_0x1e0489[_0xf3b3('0x3b')]=qs['filters'](_[_0xf3b3('0x4f')](_0x901106[_0xf3b3('0x32')],_0xe19117[_0xf3b3('0x3c')]));if(_0x901106[_0xf3b3('0x32')]['filter']){_0x1e0489[_0xf3b3('0x3b')]=_[_0xf3b3('0x3e')](_0x1e0489[_0xf3b3('0x3b')],{'$or':_[_0xf3b3('0x3f')](_0x1e0489[_0xf3b3('0x35')],function(_0x5b9113){var _0x32d268={};_0x32d268[_0x5b9113]={'$like':'%'+_0x901106[_0xf3b3('0x32')][_0xf3b3('0x3d')]+'%'};return _0x32d268;})});}_0x1e0489=_[_0xf3b3('0x3e')]({},_0x1e0489,_0x901106['options']);return _0xe470c3[_0xf3b3('0x4e')](_0x1e0489);}})['then'](function(_0x377954){if(_0x377954){_0x8c0a13=_0x377954[_0xf3b3('0x46')];if(!_0x901106[_0xf3b3('0x32')][_0xf3b3('0x37')](_0xf3b3('0x38'))){_0x1e0489['limit']=qs[_0xf3b3('0x21')](_0x901106['query'][_0xf3b3('0x21')]);_0x1e0489[_0xf3b3('0x1f')]=qs['offset'](_0x901106[_0xf3b3('0x32')][_0xf3b3('0x1f')]);}return _0xe470c3[_0xf3b3('0x4e')](_0x1e0489);}})[_0xf3b3('0x28')](function(_0x287688){if(_0x287688){return _0x287688?{'count':_0x8c0a13,'rows':_0x287688}:null;}})['then'](respondWithResult(_0x59c085,null))['catch'](handleError(_0x59c085,null));};exports[_0xf3b3('0x50')]=function(_0x573006,_0x4ee2e4,_0x233e41){var _0x247628={};var _0x5a3db6={};var _0x825691;var _0x5ed96d;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x573006[_0xf3b3('0x45')]['id']}})[_0xf3b3('0x28')](handleEntityNotFound(_0x4ee2e4,null))[_0xf3b3('0x28')](function(_0xca02ec){if(_0xca02ec){_0x825691=_0xca02ec;_0x5a3db6['model']=_[_0xf3b3('0x33')](db[_0xf3b3('0x4d')][_0xf3b3('0x2d')]);_0x5a3db6[_0xf3b3('0x32')]=_[_0xf3b3('0x33')](_0x573006['query']);_0x5a3db6[_0xf3b3('0x3c')]=_[_0xf3b3('0x34')](_0x5a3db6['model'],_0x5a3db6['query']);_0x247628[_0xf3b3('0x35')]=_['intersection'](_0x5a3db6[_0xf3b3('0x31')],qs['fields'](_0x573006['query'][_0xf3b3('0x36')]));_0x247628[_0xf3b3('0x35')]=_0x247628['attributes'][_0xf3b3('0x46')]?_0x247628[_0xf3b3('0x35')]:_0x5a3db6[_0xf3b3('0x31')];_0x247628[_0xf3b3('0x39')]=qs['sort'](_0x573006['query']['sort']);_0x247628[_0xf3b3('0x3b')]=qs['filters'](_['pick'](_0x573006['query'],_0x5a3db6[_0xf3b3('0x3c')]));if(_0x573006[_0xf3b3('0x32')][_0xf3b3('0x3d')]){_0x247628[_0xf3b3('0x3b')]=_[_0xf3b3('0x3e')](_0x247628['where'],{'$or':_['map'](_0x247628[_0xf3b3('0x35')],function(_0x17eb52){var _0x586cad={};_0x586cad[_0x17eb52]={'$like':'%'+_0x573006[_0xf3b3('0x32')]['filter']+'%'};return _0x586cad;})});}_0x247628=_[_0xf3b3('0x3e')]({},_0x247628,_0x573006[_0xf3b3('0x47')]);return _0x825691['getDescriptions'](_0x247628);}})['then'](function(_0x51dac8){if(_0x51dac8){_0x5ed96d=_0x51dac8['length'];if(!_0x573006[_0xf3b3('0x32')][_0xf3b3('0x37')](_0xf3b3('0x38'))){_0x247628[_0xf3b3('0x21')]=qs['limit'](_0x573006[_0xf3b3('0x32')][_0xf3b3('0x21')]);_0x247628[_0xf3b3('0x1f')]=qs[_0xf3b3('0x1f')](_0x573006[_0xf3b3('0x32')][_0xf3b3('0x1f')]);}return _0x825691[_0xf3b3('0x50')](_0x247628);}})[_0xf3b3('0x28')](function(_0x422440){if(_0x422440){return _0x422440?{'count':_0x5ed96d,'rows':_0x422440}:null;}})[_0xf3b3('0x28')](respondWithResult(_0x4ee2e4,null))[_0xf3b3('0x44')](handleError(_0x4ee2e4,null));}; \ No newline at end of file +var _0xe259=['model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','find','catch','create','body','getFields','findOne','ServicenowField','nolimit','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','update','then','end','error','stack','name','map','ServicenowConfiguration','rawAttributes','type','key','query','keys','filters','intersection','attributes'];(function(_0x3550b4,_0x59b309){var _0x237bca=function(_0x9624f9){while(--_0x9624f9){_0x3550b4['push'](_0x3550b4['shift']());}};_0x237bca(++_0x59b309);}(_0xe259,0x1dc));var _0x9e25=function(_0x4bf143,_0x58b36d){_0x4bf143=_0x4bf143-0x0;var _0x33c4d2=_0xe259[_0x4bf143];return _0x33c4d2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9e25('0x0'));var zipdir=require(_0x9e25('0x1'));var jsonpatch=require(_0x9e25('0x2'));var rp=require(_0x9e25('0x3'));var moment=require(_0x9e25('0x4'));var BPromise=require(_0x9e25('0x5'));var Mustache=require(_0x9e25('0x6'));var util=require(_0x9e25('0x7'));var path=require(_0x9e25('0x8'));var sox=require(_0x9e25('0x9'));var csv=require(_0x9e25('0xa'));var ejs=require(_0x9e25('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9e25('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9e25('0xd'));var deskjs=require(_0x9e25('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9e25('0xf'));var Redis=require(_0x9e25('0x10'));var authService=require(_0x9e25('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9e25('0x12'));var logger=require(_0x9e25('0x13'))(_0x9e25('0x14'));var utils=require(_0x9e25('0x15'));var config=require(_0x9e25('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9e25('0x17'))['db'];function respondWithStatusCode(_0x148876,_0x5ad561){_0x5ad561=_0x5ad561||0xcc;return function(_0xbfc338){if(_0xbfc338){return _0x148876[_0x9e25('0x18')](_0x5ad561);}return _0x148876[_0x9e25('0x19')](_0x5ad561)['end']();};}function respondWithResult(_0x485318,_0x2cf0be){_0x2cf0be=_0x2cf0be||0xc8;return function(_0x5952c1){if(_0x5952c1){return _0x485318[_0x9e25('0x19')](_0x2cf0be)[_0x9e25('0x1a')](_0x5952c1);}};}function respondWithFilteredResult(_0x145fc6,_0x5b5ce5){return function(_0x533823){if(_0x533823){var _0x59b724=typeof _0x5b5ce5[_0x9e25('0x1b')]===_0x9e25('0x1c')&&typeof _0x5b5ce5['limit']===_0x9e25('0x1c');var _0x21b22d=_0x533823[_0x9e25('0x1d')];var _0xf70835=_0x59b724?0x0:_0x5b5ce5[_0x9e25('0x1b')];var _0x2b9d58=_0x59b724?_0x533823[_0x9e25('0x1d')]:_0x5b5ce5[_0x9e25('0x1b')]+_0x5b5ce5[_0x9e25('0x1e')];var _0x5b0e47;if(_0x2b9d58>=_0x21b22d){_0x2b9d58=_0x21b22d;_0x5b0e47=0xc8;}else{_0x5b0e47=0xce;}_0x145fc6[_0x9e25('0x19')](_0x5b0e47);return _0x145fc6[_0x9e25('0x1f')]('Content-Range',_0xf70835+'-'+_0x2b9d58+'/'+_0x21b22d)['json'](_0x533823);}return null;};}function patchUpdates(_0x5c1e62){return function(_0x497b07){try{jsonpatch[_0x9e25('0x20')](_0x497b07,_0x5c1e62,!![]);}catch(_0x46f893){return BPromise['reject'](_0x46f893);}return _0x497b07['save']();};}function saveUpdates(_0x45b496,_0x2d51d0){return function(_0x59afba){if(_0x59afba){return _0x59afba[_0x9e25('0x21')](_0x45b496)['then'](function(_0x12da9c){return _0x12da9c;});}return null;};}function removeEntity(_0x187132,_0x392a80){return function(_0x5e05d9){if(_0x5e05d9){return _0x5e05d9['destroy']()[_0x9e25('0x22')](function(){_0x187132[_0x9e25('0x19')](0xcc)[_0x9e25('0x23')]();});}};}function handleEntityNotFound(_0x3e3834,_0x3ce314){return function(_0x445eb4){if(!_0x445eb4){_0x3e3834[_0x9e25('0x18')](0x194);}return _0x445eb4;};}function handleError(_0x4cb06d,_0x5176b5){_0x5176b5=_0x5176b5||0x1f4;return function(_0x4d77c5){logger[_0x9e25('0x24')](_0x4d77c5[_0x9e25('0x25')]);if(_0x4d77c5[_0x9e25('0x26')]){delete _0x4d77c5[_0x9e25('0x26')];}_0x4cb06d[_0x9e25('0x19')](_0x5176b5)['send'](_0x4d77c5);};}exports['index']=function(_0x33718d,_0x484c0e){var _0x467c04={},_0x2ade66={},_0x366932={'count':0x0,'rows':[]};var _0x80b17c=_[_0x9e25('0x27')](db[_0x9e25('0x28')][_0x9e25('0x29')],function(_0x1e5529){return{'name':_0x1e5529['fieldName'],'type':_0x1e5529[_0x9e25('0x2a')][_0x9e25('0x2b')]};});_0x2ade66['model']=_[_0x9e25('0x27')](_0x80b17c,_0x9e25('0x26'));_0x2ade66[_0x9e25('0x2c')]=_[_0x9e25('0x2d')](_0x33718d[_0x9e25('0x2c')]);_0x2ade66[_0x9e25('0x2e')]=_[_0x9e25('0x2f')](_0x2ade66['model'],_0x2ade66[_0x9e25('0x2c')]);_0x467c04[_0x9e25('0x30')]=_['intersection'](_0x2ade66[_0x9e25('0x31')],qs[_0x9e25('0x32')](_0x33718d[_0x9e25('0x2c')][_0x9e25('0x32')]));_0x467c04[_0x9e25('0x30')]=_0x467c04['attributes'][_0x9e25('0x33')]?_0x467c04[_0x9e25('0x30')]:_0x2ade66['model'];if(!_0x33718d[_0x9e25('0x2c')][_0x9e25('0x34')]('nolimit')){_0x467c04[_0x9e25('0x1e')]=qs[_0x9e25('0x1e')](_0x33718d[_0x9e25('0x2c')][_0x9e25('0x1e')]);_0x467c04[_0x9e25('0x1b')]=qs[_0x9e25('0x1b')](_0x33718d[_0x9e25('0x2c')][_0x9e25('0x1b')]);}_0x467c04[_0x9e25('0x35')]=qs[_0x9e25('0x36')](_0x33718d['query'][_0x9e25('0x36')]);_0x467c04[_0x9e25('0x37')]=qs[_0x9e25('0x2e')](_[_0x9e25('0x38')](_0x33718d[_0x9e25('0x2c')],_0x2ade66[_0x9e25('0x2e')]),_0x80b17c);if(_0x33718d[_0x9e25('0x2c')][_0x9e25('0x39')]){_0x467c04[_0x9e25('0x37')]=_[_0x9e25('0x3a')](_0x467c04[_0x9e25('0x37')],{'$or':_[_0x9e25('0x27')](_0x80b17c,function(_0x140d1d){if(_0x140d1d['type']!==_0x9e25('0x3b')){var _0x1bdf23={};_0x1bdf23[_0x140d1d[_0x9e25('0x26')]]={'$like':'%'+_0x33718d['query'][_0x9e25('0x39')]+'%'};return _0x1bdf23;}})});}_0x467c04=_[_0x9e25('0x3a')]({},_0x467c04,_0x33718d[_0x9e25('0x3c')]);var _0x326be7={'where':_0x467c04[_0x9e25('0x37')]};return db[_0x9e25('0x28')][_0x9e25('0x1d')](_0x326be7)[_0x9e25('0x22')](function(_0x53fe82){_0x366932['count']=_0x53fe82;if(_0x33718d['query']['includeAll']){_0x467c04['include']=[{'all':!![]}];}return db[_0x9e25('0x28')][_0x9e25('0x3d')](_0x467c04);})[_0x9e25('0x22')](function(_0x535a0c){_0x366932[_0x9e25('0x3e')]=_0x535a0c;return _0x366932;})[_0x9e25('0x22')](respondWithFilteredResult(_0x484c0e,_0x467c04))['catch'](handleError(_0x484c0e,null));};exports[_0x9e25('0x3f')]=function(_0x448a57,_0x38ebc7){var _0x3a015b={'raw':![],'where':{'id':_0x448a57[_0x9e25('0x40')]['id']}},_0xc202c5={};_0xc202c5['model']=_[_0x9e25('0x2d')](db[_0x9e25('0x28')][_0x9e25('0x29')]);_0xc202c5['query']=_[_0x9e25('0x2d')](_0x448a57['query']);_0xc202c5['filters']=_[_0x9e25('0x2f')](_0xc202c5[_0x9e25('0x31')],_0xc202c5['query']);_0x3a015b['attributes']=_[_0x9e25('0x2f')](_0xc202c5[_0x9e25('0x31')],qs[_0x9e25('0x32')](_0x448a57['query'][_0x9e25('0x32')]));_0x3a015b[_0x9e25('0x30')]=_0x3a015b[_0x9e25('0x30')][_0x9e25('0x33')]?_0x3a015b[_0x9e25('0x30')]:_0xc202c5[_0x9e25('0x31')];if(_0x448a57[_0x9e25('0x2c')]['includeAll']){_0x3a015b['include']=[{'all':!![]}];}_0x3a015b=_[_0x9e25('0x3a')]({},_0x3a015b,_0x448a57[_0x9e25('0x3c')]);return db[_0x9e25('0x28')][_0x9e25('0x41')](_0x3a015b)[_0x9e25('0x22')](handleEntityNotFound(_0x38ebc7,null))[_0x9e25('0x22')](respondWithResult(_0x38ebc7,null))[_0x9e25('0x42')](handleError(_0x38ebc7,null));};exports[_0x9e25('0x43')]=function(_0x221983,_0x4e43e2){return db[_0x9e25('0x28')][_0x9e25('0x43')](_0x221983[_0x9e25('0x44')],{})['then'](respondWithResult(_0x4e43e2,0xc9))['catch'](handleError(_0x4e43e2,null));};exports['update']=function(_0x3ddf8d,_0x176b97){if(_0x3ddf8d['body']['id']){delete _0x3ddf8d[_0x9e25('0x44')]['id'];}return db[_0x9e25('0x28')]['find']({'where':{'id':_0x3ddf8d[_0x9e25('0x40')]['id']}})[_0x9e25('0x22')](handleEntityNotFound(_0x176b97,null))['then'](saveUpdates(_0x3ddf8d['body'],null))['then'](respondWithResult(_0x176b97,null))[_0x9e25('0x42')](handleError(_0x176b97,null));};exports['destroy']=function(_0x35aaf4,_0x1d492a){return db[_0x9e25('0x28')][_0x9e25('0x41')]({'where':{'id':_0x35aaf4['params']['id']}})['then'](handleEntityNotFound(_0x1d492a,null))['then'](removeEntity(_0x1d492a,null))[_0x9e25('0x42')](handleError(_0x1d492a,null));};exports[_0x9e25('0x45')]=function(_0x256f04,_0x532905,_0x439f3d){var _0x4f00cc={};var _0x4fdbdf={};var _0x2803b9;var _0x331a32;return db[_0x9e25('0x28')][_0x9e25('0x46')]({'where':{'id':_0x256f04[_0x9e25('0x40')]['id']}})[_0x9e25('0x22')](handleEntityNotFound(_0x532905,null))[_0x9e25('0x22')](function(_0x442792){if(_0x442792){_0x2803b9=_0x442792;_0x4fdbdf[_0x9e25('0x31')]=_['keys'](db[_0x9e25('0x47')]['rawAttributes']);_0x4fdbdf[_0x9e25('0x2c')]=_['keys'](_0x256f04['query']);_0x4fdbdf['filters']=_[_0x9e25('0x2f')](_0x4fdbdf[_0x9e25('0x31')],_0x4fdbdf[_0x9e25('0x2c')]);_0x4f00cc[_0x9e25('0x30')]=_[_0x9e25('0x2f')](_0x4fdbdf[_0x9e25('0x31')],qs[_0x9e25('0x32')](_0x256f04[_0x9e25('0x2c')][_0x9e25('0x32')]));_0x4f00cc[_0x9e25('0x30')]=_0x4f00cc[_0x9e25('0x30')][_0x9e25('0x33')]?_0x4f00cc[_0x9e25('0x30')]:_0x4fdbdf['model'];_0x4f00cc[_0x9e25('0x35')]=qs[_0x9e25('0x36')](_0x256f04[_0x9e25('0x2c')][_0x9e25('0x36')]);_0x4f00cc[_0x9e25('0x37')]=qs[_0x9e25('0x2e')](_[_0x9e25('0x38')](_0x256f04[_0x9e25('0x2c')],_0x4fdbdf[_0x9e25('0x2e')]));if(_0x256f04['query'][_0x9e25('0x39')]){_0x4f00cc['where']=_[_0x9e25('0x3a')](_0x4f00cc['where'],{'$or':_[_0x9e25('0x27')](_0x4f00cc[_0x9e25('0x30')],function(_0x508653){var _0x563f51={};_0x563f51[_0x508653]={'$like':'%'+_0x256f04[_0x9e25('0x2c')]['filter']+'%'};return _0x563f51;})});}_0x4f00cc=_[_0x9e25('0x3a')]({},_0x4f00cc,_0x256f04['options']);return _0x2803b9['getFields'](_0x4f00cc);}})[_0x9e25('0x22')](function(_0x58d764){if(_0x58d764){_0x331a32=_0x58d764[_0x9e25('0x33')];if(!_0x256f04[_0x9e25('0x2c')][_0x9e25('0x34')](_0x9e25('0x48'))){_0x4f00cc['limit']=qs[_0x9e25('0x1e')](_0x256f04[_0x9e25('0x2c')][_0x9e25('0x1e')]);_0x4f00cc[_0x9e25('0x1b')]=qs['offset'](_0x256f04[_0x9e25('0x2c')][_0x9e25('0x1b')]);}return _0x2803b9[_0x9e25('0x45')](_0x4f00cc);}})['then'](function(_0x25a9a0){if(_0x25a9a0){return _0x25a9a0?{'count':_0x331a32,'rows':_0x25a9a0}:null;}})[_0x9e25('0x22')](respondWithResult(_0x532905,null))['catch'](handleError(_0x532905,null));};exports['getSubjects']=function(_0xb98121,_0x3bcaa3,_0x3592fd){var _0x5be49d={};var _0x4819e8={};var _0x564316;var _0xa20a48;return db[_0x9e25('0x28')][_0x9e25('0x46')]({'where':{'id':_0xb98121[_0x9e25('0x40')]['id']}})[_0x9e25('0x22')](handleEntityNotFound(_0x3bcaa3,null))[_0x9e25('0x22')](function(_0x1718dc){if(_0x1718dc){_0x564316=_0x1718dc;_0x4819e8[_0x9e25('0x31')]=_[_0x9e25('0x2d')](db[_0x9e25('0x47')]['rawAttributes']);_0x4819e8[_0x9e25('0x2c')]=_[_0x9e25('0x2d')](_0xb98121[_0x9e25('0x2c')]);_0x4819e8[_0x9e25('0x2e')]=_[_0x9e25('0x2f')](_0x4819e8['model'],_0x4819e8[_0x9e25('0x2c')]);_0x5be49d[_0x9e25('0x30')]=_[_0x9e25('0x2f')](_0x4819e8[_0x9e25('0x31')],qs[_0x9e25('0x32')](_0xb98121[_0x9e25('0x2c')][_0x9e25('0x32')]));_0x5be49d[_0x9e25('0x30')]=_0x5be49d['attributes'][_0x9e25('0x33')]?_0x5be49d['attributes']:_0x4819e8[_0x9e25('0x31')];_0x5be49d[_0x9e25('0x35')]=qs[_0x9e25('0x36')](_0xb98121[_0x9e25('0x2c')][_0x9e25('0x36')]);_0x5be49d[_0x9e25('0x37')]=qs[_0x9e25('0x2e')](_[_0x9e25('0x38')](_0xb98121[_0x9e25('0x2c')],_0x4819e8['filters']));if(_0xb98121[_0x9e25('0x2c')][_0x9e25('0x39')]){_0x5be49d['where']=_['merge'](_0x5be49d[_0x9e25('0x37')],{'$or':_['map'](_0x5be49d[_0x9e25('0x30')],function(_0x4c8904){var _0x343c49={};_0x343c49[_0x4c8904]={'$like':'%'+_0xb98121[_0x9e25('0x2c')][_0x9e25('0x39')]+'%'};return _0x343c49;})});}_0x5be49d=_[_0x9e25('0x3a')]({},_0x5be49d,_0xb98121[_0x9e25('0x3c')]);return _0x564316[_0x9e25('0x49')](_0x5be49d);}})[_0x9e25('0x22')](function(_0x44fa83){if(_0x44fa83){_0xa20a48=_0x44fa83[_0x9e25('0x33')];if(!_0xb98121[_0x9e25('0x2c')][_0x9e25('0x34')]('nolimit')){_0x5be49d[_0x9e25('0x1e')]=qs['limit'](_0xb98121[_0x9e25('0x2c')][_0x9e25('0x1e')]);_0x5be49d[_0x9e25('0x1b')]=qs[_0x9e25('0x1b')](_0xb98121['query'][_0x9e25('0x1b')]);}return _0x564316['getSubjects'](_0x5be49d);}})[_0x9e25('0x22')](function(_0xb70b13){if(_0xb70b13){return _0xb70b13?{'count':_0xa20a48,'rows':_0xb70b13}:null;}})[_0x9e25('0x22')](respondWithResult(_0x3bcaa3,null))['catch'](handleError(_0x3bcaa3,null));};exports['getDescriptions']=function(_0x15207a,_0x2e74a9,_0x900615){var _0xf80b1e={};var _0x410f38={};var _0x8b216d;var _0x509edd;return db[_0x9e25('0x28')][_0x9e25('0x46')]({'where':{'id':_0x15207a[_0x9e25('0x40')]['id']}})[_0x9e25('0x22')](handleEntityNotFound(_0x2e74a9,null))['then'](function(_0x238283){if(_0x238283){_0x8b216d=_0x238283;_0x410f38[_0x9e25('0x31')]=_[_0x9e25('0x2d')](db[_0x9e25('0x47')]['rawAttributes']);_0x410f38[_0x9e25('0x2c')]=_[_0x9e25('0x2d')](_0x15207a[_0x9e25('0x2c')]);_0x410f38[_0x9e25('0x2e')]=_[_0x9e25('0x2f')](_0x410f38['model'],_0x410f38[_0x9e25('0x2c')]);_0xf80b1e[_0x9e25('0x30')]=_[_0x9e25('0x2f')](_0x410f38['model'],qs[_0x9e25('0x32')](_0x15207a[_0x9e25('0x2c')][_0x9e25('0x32')]));_0xf80b1e[_0x9e25('0x30')]=_0xf80b1e[_0x9e25('0x30')][_0x9e25('0x33')]?_0xf80b1e['attributes']:_0x410f38[_0x9e25('0x31')];_0xf80b1e['order']=qs['sort'](_0x15207a[_0x9e25('0x2c')]['sort']);_0xf80b1e[_0x9e25('0x37')]=qs[_0x9e25('0x2e')](_['pick'](_0x15207a[_0x9e25('0x2c')],_0x410f38[_0x9e25('0x2e')]));if(_0x15207a[_0x9e25('0x2c')][_0x9e25('0x39')]){_0xf80b1e[_0x9e25('0x37')]=_[_0x9e25('0x3a')](_0xf80b1e[_0x9e25('0x37')],{'$or':_[_0x9e25('0x27')](_0xf80b1e[_0x9e25('0x30')],function(_0x1f5cf6){var _0x2fccf3={};_0x2fccf3[_0x1f5cf6]={'$like':'%'+_0x15207a[_0x9e25('0x2c')]['filter']+'%'};return _0x2fccf3;})});}_0xf80b1e=_[_0x9e25('0x3a')]({},_0xf80b1e,_0x15207a[_0x9e25('0x3c')]);return _0x8b216d[_0x9e25('0x4a')](_0xf80b1e);}})[_0x9e25('0x22')](function(_0x31bb2d){if(_0x31bb2d){_0x509edd=_0x31bb2d[_0x9e25('0x33')];if(!_0x15207a[_0x9e25('0x2c')][_0x9e25('0x34')](_0x9e25('0x48'))){_0xf80b1e[_0x9e25('0x1e')]=qs['limit'](_0x15207a[_0x9e25('0x2c')][_0x9e25('0x1e')]);_0xf80b1e[_0x9e25('0x1b')]=qs[_0x9e25('0x1b')](_0x15207a['query'][_0x9e25('0x1b')]);}return _0x8b216d[_0x9e25('0x4a')](_0xf80b1e);}})[_0x9e25('0x22')](function(_0x2c46c5){if(_0x2c46c5){return _0x2c46c5?{'count':_0x509edd,'rows':_0x2c46c5}:null;}})[_0x9e25('0x22')](respondWithResult(_0x2e74a9,null))[_0x9e25('0x42')](handleError(_0x2e74a9,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index d688f47..e56bfd9 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 _0x6f59=['../../config/environment','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5221f7,_0x2e9c16){var _0x356616=function(_0x30ae6e){while(--_0x30ae6e){_0x5221f7['push'](_0x5221f7['shift']());}};_0x356616(++_0x2e9c16);}(_0x6f59,0x1be));var _0x96f5=function(_0x460cf9,_0x33b105){_0x460cf9=_0x460cf9-0x0;var _0x2999fb=_0x6f59[_0x460cf9];return _0x2999fb;};'use strict';var _=require(_0x96f5('0x0'));var util=require(_0x96f5('0x1'));var logger=require(_0x96f5('0x2'))(_0x96f5('0x3'));var moment=require(_0x96f5('0x4'));var BPromise=require(_0x96f5('0x5'));var rp=require(_0x96f5('0x6'));var fs=require('fs');var path=require(_0x96f5('0x7'));var rimraf=require(_0x96f5('0x8'));var config=require(_0x96f5('0x9'));var attributes=require(_0x96f5('0xa'));module[_0x96f5('0xb')]=function(_0x598154,_0xf6cd7d){return _0x598154['define'](_0x96f5('0xc'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x57ef=['api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','util','../../config/logger'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x57ef,0xdb));var _0xf57e=function(_0x154743,_0x32e3c6){_0x154743=_0x154743-0x0;var _0x4f0421=_0x57ef[_0x154743];return _0x4f0421;};'use strict';var _=require('lodash');var util=require(_0xf57e('0x0'));var logger=require(_0xf57e('0x1'))(_0xf57e('0x2'));var moment=require(_0xf57e('0x3'));var BPromise=require(_0xf57e('0x4'));var rp=require(_0xf57e('0x5'));var fs=require('fs');var path=require(_0xf57e('0x6'));var rimraf=require('rimraf');var config=require(_0xf57e('0x7'));var attributes=require(_0xf57e('0x8'));module[_0xf57e('0x9')]=function(_0xf9d112,_0x31d997){return _0xf9d112[_0xf57e('0xa')](_0xf57e('0xb'),attributes,{'tableName':_0xf57e('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 d72a0ba..3bb9a6d 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 _0x4093=['debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x349367,_0x1cede2){var _0x14179b=function(_0x38a191){while(--_0x38a191){_0x349367['push'](_0x349367['shift']());}};_0x14179b(++_0x1cede2);}(_0x4093,0x18d));var _0x3409=function(_0x214378,_0x1dc43c){_0x214378=_0x214378-0x0;var _0x4a0e60=_0x4093[_0x214378];return _0x4a0e60;};'use strict';var _=require(_0x3409('0x0'));var util=require(_0x3409('0x1'));var moment=require(_0x3409('0x2'));var BPromise=require(_0x3409('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3409('0x4'));var db=require(_0x3409('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3409('0x6'))(_0x3409('0x7'));var config=require(_0x3409('0x8'));var jayson=require(_0x3409('0x9'));var client=jayson[_0x3409('0xa')][_0x3409('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16447a,_0x3075e1,_0x49e717){return new BPromise(function(_0x5dfcce,_0x218d6b){return client[_0x3409('0xc')](_0x16447a,_0x49e717)[_0x3409('0xd')](function(_0x20e9ae){logger[_0x3409('0xe')](_0x3409('0xf'),_0x3075e1,_0x3409('0x10'));logger[_0x3409('0x11')](_0x3409('0x12'),_0x3075e1,_0x3409('0x10'),JSON[_0x3409('0x13')](_0x20e9ae));if(_0x20e9ae[_0x3409('0x14')]){if(_0x20e9ae['error'][_0x3409('0x15')]===0x1f4){logger[_0x3409('0x14')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3075e1,_0x20e9ae[_0x3409('0x14')][_0x3409('0x16')]);return _0x218d6b(_0x20e9ae['error'][_0x3409('0x16')]);}logger[_0x3409('0x14')](_0x3409('0xf'),_0x3075e1,_0x20e9ae[_0x3409('0x14')][_0x3409('0x16')]);return _0x5dfcce(_0x20e9ae[_0x3409('0x14')]['message']);}else{logger[_0x3409('0xe')](_0x3409('0xf'),_0x3075e1,_0x3409('0x10'));_0x5dfcce(_0x20e9ae['result'][_0x3409('0x16')]);}})['catch'](function(_0x413b09){logger[_0x3409('0x14')](_0x3409('0xf'),_0x3075e1,_0x413b09);_0x218d6b(_0x413b09);});});} \ No newline at end of file +var _0x81c6=['stringify','code','error','message','info','result','catch','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x81c6,0x1d5));var _0x681c=function(_0x202962,_0x4baf03){_0x202962=_0x202962-0x0;var _0x4896a0=_0x81c6[_0x202962];return _0x4896a0;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x681c('0x1'));var db=require(_0x681c('0x2'))['db'];var utils=require(_0x681c('0x3'));var logger=require('../../config/logger')(_0x681c('0x4'));var config=require(_0x681c('0x5'));var jayson=require(_0x681c('0x6'));var client=jayson[_0x681c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45331,_0xdc57a5,_0x5624d7){return new BPromise(function(_0x5b5f22,_0x1750e2){return client[_0x681c('0x8')](_0x45331,_0x5624d7)[_0x681c('0x9')](function(_0x5de78e){logger['info'](_0x681c('0xa'),_0xdc57a5,'request\x20sent');logger[_0x681c('0xb')](_0x681c('0xc'),_0xdc57a5,_0x681c('0xd'),JSON[_0x681c('0xe')](_0x5de78e));if(_0x5de78e['error']){if(_0x5de78e['error'][_0x681c('0xf')]===0x1f4){logger[_0x681c('0x10')](_0x681c('0xa'),_0xdc57a5,_0x5de78e['error'][_0x681c('0x11')]);return _0x1750e2(_0x5de78e['error'][_0x681c('0x11')]);}logger['error'](_0x681c('0xa'),_0xdc57a5,_0x5de78e[_0x681c('0x10')][_0x681c('0x11')]);return _0x5b5f22(_0x5de78e[_0x681c('0x10')][_0x681c('0x11')]);}else{logger[_0x681c('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0xdc57a5,_0x681c('0xd'));_0x5b5f22(_0x5de78e[_0x681c('0x13')][_0x681c('0x11')]);}})[_0x681c('0x14')](function(_0x2fce11){logger[_0x681c('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0xdc57a5,_0x2fce11);_0x1750e2(_0x2fce11);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 559e806..1a124bf 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 _0xa619=['post','create','put','delete','exports','multer','util','path','express','../../components/auth/service','./intServicenowField.controller','get','index','/:id','isAuthenticated','show'];(function(_0xd12f6e,_0x4b3232){var _0x24f1ab=function(_0x127ec3){while(--_0x127ec3){_0xd12f6e['push'](_0xd12f6e['shift']());}};_0x24f1ab(++_0x4b3232);}(_0xa619,0xa5));var _0x9a61=function(_0x2ad89b,_0x5bc1e0){_0x2ad89b=_0x2ad89b-0x0;var _0x5dcd53=_0xa619[_0x2ad89b];return _0x5dcd53;};'use strict';var multer=require(_0x9a61('0x0'));var util=require(_0x9a61('0x1'));var path=require(_0x9a61('0x2'));var timeout=require('connect-timeout');var express=require(_0x9a61('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9a61('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9a61('0x5'));router[_0x9a61('0x6')]('/',auth['isAuthenticated'](),controller[_0x9a61('0x7')]);router[_0x9a61('0x6')](_0x9a61('0x8'),auth[_0x9a61('0x9')](),controller[_0x9a61('0xa')]);router[_0x9a61('0xb')]('/',auth['isAuthenticated'](),controller[_0x9a61('0xc')]);router[_0x9a61('0xd')](_0x9a61('0x8'),auth[_0x9a61('0x9')](),controller['update']);router[_0x9a61('0xe')](_0x9a61('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x9a61('0xf')]=router; \ No newline at end of file +var _0x61ef=['isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../config/environment'];(function(_0x195586,_0x1a047d){var _0x39c422=function(_0x30223f){while(--_0x30223f){_0x195586['push'](_0x195586['shift']());}};_0x39c422(++_0x1a047d);}(_0x61ef,0x66));var _0xf61e=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x61ef[_0x344a3f];return _0x264712;};'use strict';var multer=require(_0xf61e('0x0'));var util=require(_0xf61e('0x1'));var path=require(_0xf61e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf61e('0x3')]();var fs_extra=require(_0xf61e('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf61e('0x5'));var controller=require('./intServicenowField.controller');router['get']('/',auth[_0xf61e('0x6')](),controller[_0xf61e('0x7')]);router[_0xf61e('0x8')](_0xf61e('0x9'),auth[_0xf61e('0x6')](),controller[_0xf61e('0xa')]);router[_0xf61e('0xb')]('/',auth[_0xf61e('0x6')](),controller[_0xf61e('0xc')]);router[_0xf61e('0xd')](_0xf61e('0x9'),auth[_0xf61e('0x6')](),controller[_0xf61e('0xe')]);router[_0xf61e('0xf')](_0xf61e('0x9'),auth[_0xf61e('0x6')](),controller[_0xf61e('0x10')]);module[_0xf61e('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 707ea7f..6e37d87 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 _0x8fc7=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','picklist'];(function(_0xdb06a7,_0x235ea2){var _0xf60ee0=function(_0x5b7aae){while(--_0x5b7aae){_0xdb06a7['push'](_0xdb06a7['shift']());}};_0xf60ee0(++_0x235ea2);}(_0x8fc7,0x18e));var _0x78fc=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x8fc7[_0x36ed3c];return _0x52a2e0;};'use strict';var Sequelize=require(_0x78fc('0x0'));module[_0x78fc('0x1')]={'type':{'type':Sequelize[_0x78fc('0x2')](_0x78fc('0x3'),_0x78fc('0x4'),_0x78fc('0x5'),'keyValue',_0x78fc('0x6')),'defaultValue':_0x78fc('0x3')},'content':{'type':Sequelize[_0x78fc('0x7')]},'key':{'type':Sequelize[_0x78fc('0x7')]},'keyType':{'type':Sequelize[_0x78fc('0x2')](_0x78fc('0x3'),'variable',_0x78fc('0x5'))},'keyContent':{'type':Sequelize[_0x78fc('0x7')]},'idField':{'type':Sequelize[_0x78fc('0x7')]},'nameField':{'type':Sequelize[_0x78fc('0x7')]},'customField':{'type':Sequelize[_0x78fc('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x78fc('0x7')]}}; \ No newline at end of file +var _0x2a92=['customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x2a92,0x79));var _0x22a9=function(_0x18f396,_0x174d17){_0x18f396=_0x18f396-0x0;var _0x3ba532=_0x2a92[_0x18f396];return _0x3ba532;};'use strict';var Sequelize=require(_0x22a9('0x0'));module[_0x22a9('0x1')]={'type':{'type':Sequelize[_0x22a9('0x2')](_0x22a9('0x3'),_0x22a9('0x4'),_0x22a9('0x5'),_0x22a9('0x6'),_0x22a9('0x7')),'defaultValue':_0x22a9('0x3')},'content':{'type':Sequelize[_0x22a9('0x8')]},'key':{'type':Sequelize[_0x22a9('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x22a9('0x3'),_0x22a9('0x4'),_0x22a9('0x5'))},'keyContent':{'type':Sequelize[_0x22a9('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x22a9('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index af26afe..cff47b4 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 _0xf0d1=['model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','VIRTUAL','include','ServicenowField','findAll','rows','catch','params','intersection','options','find','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','rawAttributes','fieldName','type','key'];(function(_0x13ff2e,_0x6d2f8c){var _0x41830b=function(_0x3ca664){while(--_0x3ca664){_0x13ff2e['push'](_0x13ff2e['shift']());}};_0x41830b(++_0x6d2f8c);}(_0xf0d1,0xfa));var _0x1f0d=function(_0x55af41,_0x52c155){_0x55af41=_0x55af41-0x0;var _0x2e6598=_0xf0d1[_0x55af41];return _0x2e6598;};'use strict';var emlformat=require(_0x1f0d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1f0d('0x1'));var jsonpatch=require(_0x1f0d('0x2'));var rp=require(_0x1f0d('0x3'));var moment=require(_0x1f0d('0x4'));var BPromise=require(_0x1f0d('0x5'));var Mustache=require(_0x1f0d('0x6'));var util=require(_0x1f0d('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x1f0d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1f0d('0x9'));var _=require(_0x1f0d('0xa'));var squel=require(_0x1f0d('0xb'));var crypto=require('crypto');var jsforce=require(_0x1f0d('0xc'));var deskjs=require(_0x1f0d('0xd'));var toCsv=require(_0x1f0d('0x8'));var querystring=require('querystring');var Papa=require(_0x1f0d('0xe'));var Redis=require(_0x1f0d('0xf'));var authService=require(_0x1f0d('0x10'));var qs=require(_0x1f0d('0x11'));var as=require(_0x1f0d('0x12'));var hardwareService=require(_0x1f0d('0x13'));var logger=require(_0x1f0d('0x14'))(_0x1f0d('0x15'));var utils=require(_0x1f0d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1f0d('0x17'));var db=require(_0x1f0d('0x18'))['db'];function respondWithStatusCode(_0x443c75,_0x1d4de4){_0x1d4de4=_0x1d4de4||0xcc;return function(_0x7eb4c2){if(_0x7eb4c2){return _0x443c75[_0x1f0d('0x19')](_0x1d4de4);}return _0x443c75[_0x1f0d('0x1a')](_0x1d4de4)['end']();};}function respondWithResult(_0x35562a,_0x2a4dd5){_0x2a4dd5=_0x2a4dd5||0xc8;return function(_0x473c69){if(_0x473c69){return _0x35562a[_0x1f0d('0x1a')](_0x2a4dd5)[_0x1f0d('0x1b')](_0x473c69);}};}function respondWithFilteredResult(_0x5ea4b3,_0x1cfd34){return function(_0x443dbe){if(_0x443dbe){var _0x13cca2=typeof _0x1cfd34[_0x1f0d('0x1c')]==='undefined'&&typeof _0x1cfd34[_0x1f0d('0x1d')]==='undefined';var _0x2c4b4a=_0x443dbe[_0x1f0d('0x1e')];var _0x44643a=_0x13cca2?0x0:_0x1cfd34['offset'];var _0x22ad86=_0x13cca2?_0x443dbe[_0x1f0d('0x1e')]:_0x1cfd34[_0x1f0d('0x1c')]+_0x1cfd34[_0x1f0d('0x1d')];var _0x41ba24;if(_0x22ad86>=_0x2c4b4a){_0x22ad86=_0x2c4b4a;_0x41ba24=0xc8;}else{_0x41ba24=0xce;}_0x5ea4b3['status'](_0x41ba24);return _0x5ea4b3[_0x1f0d('0x1f')](_0x1f0d('0x20'),_0x44643a+'-'+_0x22ad86+'/'+_0x2c4b4a)['json'](_0x443dbe);}return null;};}function patchUpdates(_0x530777){return function(_0x2ff3ca){try{jsonpatch[_0x1f0d('0x21')](_0x2ff3ca,_0x530777,!![]);}catch(_0x18997f){return BPromise[_0x1f0d('0x22')](_0x18997f);}return _0x2ff3ca[_0x1f0d('0x23')]();};}function saveUpdates(_0x291268,_0x56805f){return function(_0xd94799){if(_0xd94799){return _0xd94799['update'](_0x291268)[_0x1f0d('0x24')](function(_0x524b43){return _0x524b43;});}return null;};}function removeEntity(_0x519900,_0x270f8b){return function(_0x2f9a0d){if(_0x2f9a0d){return _0x2f9a0d[_0x1f0d('0x25')]()[_0x1f0d('0x24')](function(){_0x519900[_0x1f0d('0x1a')](0xcc)[_0x1f0d('0x26')]();});}};}function handleEntityNotFound(_0x55fa08,_0xf353af){return function(_0x38a1dc){if(!_0x38a1dc){_0x55fa08[_0x1f0d('0x19')](0x194);}return _0x38a1dc;};}function handleError(_0x2b771e,_0x2c21dd){_0x2c21dd=_0x2c21dd||0x1f4;return function(_0x2bc4b4){logger[_0x1f0d('0x27')](_0x2bc4b4['stack']);if(_0x2bc4b4[_0x1f0d('0x28')]){delete _0x2bc4b4[_0x1f0d('0x28')];}_0x2b771e['status'](_0x2c21dd)[_0x1f0d('0x29')](_0x2bc4b4);};}exports['index']=function(_0x182e29,_0x289bb6){var _0x1cbe06={},_0x2195f4={},_0x3c4f1e={'count':0x0,'rows':[]};var _0x3a29e9=_['map'](db['ServicenowField'][_0x1f0d('0x2a')],function(_0x3c2843){return{'name':_0x3c2843[_0x1f0d('0x2b')],'type':_0x3c2843[_0x1f0d('0x2c')][_0x1f0d('0x2d')]};});_0x2195f4[_0x1f0d('0x2e')]=_['map'](_0x3a29e9,'name');_0x2195f4[_0x1f0d('0x2f')]=_[_0x1f0d('0x30')](_0x182e29['query']);_0x2195f4[_0x1f0d('0x31')]=_['intersection'](_0x2195f4[_0x1f0d('0x2e')],_0x2195f4['query']);_0x1cbe06[_0x1f0d('0x32')]=_['intersection'](_0x2195f4[_0x1f0d('0x2e')],qs[_0x1f0d('0x33')](_0x182e29[_0x1f0d('0x2f')][_0x1f0d('0x33')]));_0x1cbe06[_0x1f0d('0x32')]=_0x1cbe06['attributes'][_0x1f0d('0x34')]?_0x1cbe06['attributes']:_0x2195f4[_0x1f0d('0x2e')];if(!_0x182e29[_0x1f0d('0x2f')][_0x1f0d('0x35')](_0x1f0d('0x36'))){_0x1cbe06[_0x1f0d('0x1d')]=qs[_0x1f0d('0x1d')](_0x182e29[_0x1f0d('0x2f')]['limit']);_0x1cbe06[_0x1f0d('0x1c')]=qs[_0x1f0d('0x1c')](_0x182e29[_0x1f0d('0x2f')]['offset']);}_0x1cbe06['order']=qs[_0x1f0d('0x37')](_0x182e29['query'][_0x1f0d('0x37')]);_0x1cbe06['where']=qs['filters'](_[_0x1f0d('0x38')](_0x182e29[_0x1f0d('0x2f')],_0x2195f4[_0x1f0d('0x31')]),_0x3a29e9);if(_0x182e29[_0x1f0d('0x2f')][_0x1f0d('0x39')]){_0x1cbe06[_0x1f0d('0x3a')]=_[_0x1f0d('0x3b')](_0x1cbe06[_0x1f0d('0x3a')],{'$or':_[_0x1f0d('0x3c')](_0x3a29e9,function(_0x10d681){if(_0x10d681[_0x1f0d('0x2c')]!==_0x1f0d('0x3d')){var _0x226cd6={};_0x226cd6[_0x10d681[_0x1f0d('0x28')]]={'$like':'%'+_0x182e29[_0x1f0d('0x2f')]['filter']+'%'};return _0x226cd6;}})});}_0x1cbe06=_[_0x1f0d('0x3b')]({},_0x1cbe06,_0x182e29['options']);var _0x5b0717={'where':_0x1cbe06[_0x1f0d('0x3a')]};return db['ServicenowField']['count'](_0x5b0717)[_0x1f0d('0x24')](function(_0x14fd76){_0x3c4f1e[_0x1f0d('0x1e')]=_0x14fd76;if(_0x182e29[_0x1f0d('0x2f')]['includeAll']){_0x1cbe06[_0x1f0d('0x3e')]=[{'all':!![]}];}return db[_0x1f0d('0x3f')][_0x1f0d('0x40')](_0x1cbe06);})[_0x1f0d('0x24')](function(_0x267bcd){_0x3c4f1e[_0x1f0d('0x41')]=_0x267bcd;return _0x3c4f1e;})[_0x1f0d('0x24')](respondWithFilteredResult(_0x289bb6,_0x1cbe06))[_0x1f0d('0x42')](handleError(_0x289bb6,null));};exports['show']=function(_0x17d3d1,_0x556241){var _0x2a28e1={'raw':!![],'where':{'id':_0x17d3d1[_0x1f0d('0x43')]['id']}},_0x5f9218={};_0x5f9218[_0x1f0d('0x2e')]=_['keys'](db[_0x1f0d('0x3f')][_0x1f0d('0x2a')]);_0x5f9218[_0x1f0d('0x2f')]=_[_0x1f0d('0x30')](_0x17d3d1[_0x1f0d('0x2f')]);_0x5f9218['filters']=_['intersection'](_0x5f9218[_0x1f0d('0x2e')],_0x5f9218[_0x1f0d('0x2f')]);_0x2a28e1[_0x1f0d('0x32')]=_[_0x1f0d('0x44')](_0x5f9218['model'],qs[_0x1f0d('0x33')](_0x17d3d1[_0x1f0d('0x2f')][_0x1f0d('0x33')]));_0x2a28e1[_0x1f0d('0x32')]=_0x2a28e1[_0x1f0d('0x32')][_0x1f0d('0x34')]?_0x2a28e1[_0x1f0d('0x32')]:_0x5f9218[_0x1f0d('0x2e')];if(_0x17d3d1[_0x1f0d('0x2f')]['includeAll']){_0x2a28e1[_0x1f0d('0x3e')]=[{'all':!![]}];}_0x2a28e1=_[_0x1f0d('0x3b')]({},_0x2a28e1,_0x17d3d1[_0x1f0d('0x45')]);return db[_0x1f0d('0x3f')][_0x1f0d('0x46')](_0x2a28e1)[_0x1f0d('0x24')](handleEntityNotFound(_0x556241,null))[_0x1f0d('0x24')](respondWithResult(_0x556241,null))[_0x1f0d('0x42')](handleError(_0x556241,null));};exports[_0x1f0d('0x47')]=function(_0x5a70b4,_0x17e94a){return db[_0x1f0d('0x3f')][_0x1f0d('0x47')](_0x5a70b4[_0x1f0d('0x48')],{})[_0x1f0d('0x24')](respondWithResult(_0x17e94a,0xc9))[_0x1f0d('0x42')](handleError(_0x17e94a,null));};exports[_0x1f0d('0x49')]=function(_0x337c11,_0x19b51e){if(_0x337c11['body']['id']){delete _0x337c11[_0x1f0d('0x48')]['id'];}return db[_0x1f0d('0x3f')][_0x1f0d('0x46')]({'where':{'id':_0x337c11[_0x1f0d('0x43')]['id']}})[_0x1f0d('0x24')](handleEntityNotFound(_0x19b51e,null))['then'](saveUpdates(_0x337c11[_0x1f0d('0x48')],null))[_0x1f0d('0x24')](respondWithResult(_0x19b51e,null))[_0x1f0d('0x42')](handleError(_0x19b51e,null));};exports[_0x1f0d('0x25')]=function(_0x28bc96,_0x48e3f6){return db[_0x1f0d('0x3f')]['find']({'where':{'id':_0x28bc96[_0x1f0d('0x43')]['id']}})[_0x1f0d('0x24')](handleEntityNotFound(_0x48e3f6,null))[_0x1f0d('0x24')](removeEntity(_0x48e3f6,null))[_0x1f0d('0x42')](handleError(_0x48e3f6,null));}; \ No newline at end of file +var _0x7d1b=['ServicenowField','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','type','options','where','includeAll','include','catch','show','find','create','body','update','params','eml-format','rimraf','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then','destroy','sendStatus','name','send','index'];(function(_0x1b77ad,_0x4c1541){var _0x401c6a=function(_0x3ca538){while(--_0x3ca538){_0x1b77ad['push'](_0x1b77ad['shift']());}};_0x401c6a(++_0x4c1541);}(_0x7d1b,0xac));var _0xb7d1=function(_0x405289,_0x1ffd6a){_0x405289=_0x405289-0x0;var _0x29ef29=_0x7d1b[_0x405289];return _0x29ef29;};'use strict';var emlformat=require(_0xb7d1('0x0'));var rimraf=require(_0xb7d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb7d1('0x2'));var moment=require(_0xb7d1('0x3'));var BPromise=require(_0xb7d1('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb7d1('0x5'));var sox=require('sox');var csv=require(_0xb7d1('0x6'));var ejs=require(_0xb7d1('0x7'));var fs=require('fs');var fs_extra=require(_0xb7d1('0x8'));var _=require(_0xb7d1('0x9'));var squel=require(_0xb7d1('0xa'));var crypto=require('crypto');var jsforce=require(_0xb7d1('0xb'));var deskjs=require(_0xb7d1('0xc'));var toCsv=require(_0xb7d1('0x6'));var querystring=require(_0xb7d1('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb7d1('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xb7d1('0xf'));var hardwareService=require(_0xb7d1('0x10'));var logger=require('../../config/logger')(_0xb7d1('0x11'));var utils=require(_0xb7d1('0x12'));var config=require(_0xb7d1('0x13'));var licenseUtil=require(_0xb7d1('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4460f3,_0x2c7ab4){_0x2c7ab4=_0x2c7ab4||0xcc;return function(_0x2ffac4){if(_0x2ffac4){return _0x4460f3['sendStatus'](_0x2c7ab4);}return _0x4460f3['status'](_0x2c7ab4)[_0xb7d1('0x15')]();};}function respondWithResult(_0x3678cc,_0x5ea13c){_0x5ea13c=_0x5ea13c||0xc8;return function(_0x466c62){if(_0x466c62){return _0x3678cc[_0xb7d1('0x16')](_0x5ea13c)[_0xb7d1('0x17')](_0x466c62);}};}function respondWithFilteredResult(_0xa8574d,_0x488423){return function(_0x942dee){if(_0x942dee){var _0x29950c=typeof _0x488423['offset']===_0xb7d1('0x18')&&typeof _0x488423[_0xb7d1('0x19')]==='undefined';var _0x36b6bd=_0x942dee[_0xb7d1('0x1a')];var _0x1366d3=_0x29950c?0x0:_0x488423[_0xb7d1('0x1b')];var _0x3d43c7=_0x29950c?_0x942dee['count']:_0x488423[_0xb7d1('0x1b')]+_0x488423['limit'];var _0x5d879e;if(_0x3d43c7>=_0x36b6bd){_0x3d43c7=_0x36b6bd;_0x5d879e=0xc8;}else{_0x5d879e=0xce;}_0xa8574d['status'](_0x5d879e);return _0xa8574d[_0xb7d1('0x1c')](_0xb7d1('0x1d'),_0x1366d3+'-'+_0x3d43c7+'/'+_0x36b6bd)[_0xb7d1('0x17')](_0x942dee);}return null;};}function patchUpdates(_0x3f9304){return function(_0x336973){try{jsonpatch[_0xb7d1('0x1e')](_0x336973,_0x3f9304,!![]);}catch(_0xd571bd){return BPromise[_0xb7d1('0x1f')](_0xd571bd);}return _0x336973['save']();};}function saveUpdates(_0x4f60c5,_0x317d03){return function(_0x139c8a){if(_0x139c8a){return _0x139c8a['update'](_0x4f60c5)[_0xb7d1('0x20')](function(_0x4f3748){return _0x4f3748;});}return null;};}function removeEntity(_0xbcbea,_0x1dc0f8){return function(_0x545ae7){if(_0x545ae7){return _0x545ae7[_0xb7d1('0x21')]()['then'](function(){_0xbcbea[_0xb7d1('0x16')](0xcc)[_0xb7d1('0x15')]();});}};}function handleEntityNotFound(_0x5c83d0,_0x1af3cc){return function(_0x2ade30){if(!_0x2ade30){_0x5c83d0[_0xb7d1('0x22')](0x194);}return _0x2ade30;};}function handleError(_0x3d9cc0,_0x479819){_0x479819=_0x479819||0x1f4;return function(_0x1604de){logger['error'](_0x1604de['stack']);if(_0x1604de['name']){delete _0x1604de[_0xb7d1('0x23')];}_0x3d9cc0[_0xb7d1('0x16')](_0x479819)[_0xb7d1('0x24')](_0x1604de);};}exports[_0xb7d1('0x25')]=function(_0x52f59b,_0x4ee41a){var _0x470de3={},_0x14e9fe={},_0x349367={'count':0x0,'rows':[]};var _0x44bd5c=_['map'](db[_0xb7d1('0x26')][_0xb7d1('0x27')],function(_0x3a6d79){return{'name':_0x3a6d79[_0xb7d1('0x28')],'type':_0x3a6d79['type'][_0xb7d1('0x29')]};});_0x14e9fe['model']=_[_0xb7d1('0x2a')](_0x44bd5c,_0xb7d1('0x23'));_0x14e9fe[_0xb7d1('0x2b')]=_[_0xb7d1('0x2c')](_0x52f59b[_0xb7d1('0x2b')]);_0x14e9fe[_0xb7d1('0x2d')]=_[_0xb7d1('0x2e')](_0x14e9fe['model'],_0x14e9fe[_0xb7d1('0x2b')]);_0x470de3['attributes']=_['intersection'](_0x14e9fe[_0xb7d1('0x2f')],qs[_0xb7d1('0x30')](_0x52f59b[_0xb7d1('0x2b')][_0xb7d1('0x30')]));_0x470de3[_0xb7d1('0x31')]=_0x470de3[_0xb7d1('0x31')][_0xb7d1('0x32')]?_0x470de3[_0xb7d1('0x31')]:_0x14e9fe[_0xb7d1('0x2f')];if(!_0x52f59b['query'][_0xb7d1('0x33')](_0xb7d1('0x34'))){_0x470de3[_0xb7d1('0x19')]=qs['limit'](_0x52f59b['query'][_0xb7d1('0x19')]);_0x470de3[_0xb7d1('0x1b')]=qs['offset'](_0x52f59b[_0xb7d1('0x2b')][_0xb7d1('0x1b')]);}_0x470de3[_0xb7d1('0x35')]=qs[_0xb7d1('0x36')](_0x52f59b[_0xb7d1('0x2b')][_0xb7d1('0x36')]);_0x470de3['where']=qs['filters'](_[_0xb7d1('0x37')](_0x52f59b[_0xb7d1('0x2b')],_0x14e9fe[_0xb7d1('0x2d')]),_0x44bd5c);if(_0x52f59b[_0xb7d1('0x2b')][_0xb7d1('0x38')]){_0x470de3['where']=_[_0xb7d1('0x39')](_0x470de3['where'],{'$or':_[_0xb7d1('0x2a')](_0x44bd5c,function(_0x540fd7){if(_0x540fd7[_0xb7d1('0x3a')]!=='VIRTUAL'){var _0x10810b={};_0x10810b[_0x540fd7[_0xb7d1('0x23')]]={'$like':'%'+_0x52f59b['query']['filter']+'%'};return _0x10810b;}})});}_0x470de3=_[_0xb7d1('0x39')]({},_0x470de3,_0x52f59b[_0xb7d1('0x3b')]);var _0x62f4d8={'where':_0x470de3[_0xb7d1('0x3c')]};return db[_0xb7d1('0x26')][_0xb7d1('0x1a')](_0x62f4d8)[_0xb7d1('0x20')](function(_0x3a7e63){_0x349367[_0xb7d1('0x1a')]=_0x3a7e63;if(_0x52f59b[_0xb7d1('0x2b')][_0xb7d1('0x3d')]){_0x470de3[_0xb7d1('0x3e')]=[{'all':!![]}];}return db[_0xb7d1('0x26')]['findAll'](_0x470de3);})[_0xb7d1('0x20')](function(_0x3eb59f){_0x349367['rows']=_0x3eb59f;return _0x349367;})[_0xb7d1('0x20')](respondWithFilteredResult(_0x4ee41a,_0x470de3))[_0xb7d1('0x3f')](handleError(_0x4ee41a,null));};exports[_0xb7d1('0x40')]=function(_0x2ae6dc,_0x520ff7){var _0x3dc0c8={'raw':!![],'where':{'id':_0x2ae6dc['params']['id']}},_0x8e6aed={};_0x8e6aed[_0xb7d1('0x2f')]=_[_0xb7d1('0x2c')](db[_0xb7d1('0x26')]['rawAttributes']);_0x8e6aed[_0xb7d1('0x2b')]=_[_0xb7d1('0x2c')](_0x2ae6dc[_0xb7d1('0x2b')]);_0x8e6aed['filters']=_[_0xb7d1('0x2e')](_0x8e6aed['model'],_0x8e6aed[_0xb7d1('0x2b')]);_0x3dc0c8[_0xb7d1('0x31')]=_['intersection'](_0x8e6aed['model'],qs[_0xb7d1('0x30')](_0x2ae6dc[_0xb7d1('0x2b')]['fields']));_0x3dc0c8[_0xb7d1('0x31')]=_0x3dc0c8[_0xb7d1('0x31')][_0xb7d1('0x32')]?_0x3dc0c8[_0xb7d1('0x31')]:_0x8e6aed['model'];if(_0x2ae6dc['query']['includeAll']){_0x3dc0c8[_0xb7d1('0x3e')]=[{'all':!![]}];}_0x3dc0c8=_['merge']({},_0x3dc0c8,_0x2ae6dc['options']);return db['ServicenowField'][_0xb7d1('0x41')](_0x3dc0c8)[_0xb7d1('0x20')](handleEntityNotFound(_0x520ff7,null))['then'](respondWithResult(_0x520ff7,null))[_0xb7d1('0x3f')](handleError(_0x520ff7,null));};exports[_0xb7d1('0x42')]=function(_0x555a68,_0x3aefba){return db[_0xb7d1('0x26')][_0xb7d1('0x42')](_0x555a68[_0xb7d1('0x43')],{})[_0xb7d1('0x20')](respondWithResult(_0x3aefba,0xc9))[_0xb7d1('0x3f')](handleError(_0x3aefba,null));};exports[_0xb7d1('0x44')]=function(_0x1b54b8,_0x31bbbd){if(_0x1b54b8[_0xb7d1('0x43')]['id']){delete _0x1b54b8['body']['id'];}return db[_0xb7d1('0x26')][_0xb7d1('0x41')]({'where':{'id':_0x1b54b8[_0xb7d1('0x45')]['id']}})[_0xb7d1('0x20')](handleEntityNotFound(_0x31bbbd,null))[_0xb7d1('0x20')](saveUpdates(_0x1b54b8[_0xb7d1('0x43')],null))[_0xb7d1('0x20')](respondWithResult(_0x31bbbd,null))[_0xb7d1('0x3f')](handleError(_0x31bbbd,null));};exports[_0xb7d1('0x21')]=function(_0x2a70ab,_0x26fccc){return db[_0xb7d1('0x26')]['find']({'where':{'id':_0x2a70ab[_0xb7d1('0x45')]['id']}})['then'](handleEntityNotFound(_0x26fccc,null))[_0xb7d1('0x20')](removeEntity(_0x26fccc,null))[_0xb7d1('0x3f')](handleError(_0x26fccc,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 9cd7890..e1b7bb4 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 _0x54a9=['./intServicenowField.attributes','exports','define','ServicenowField','servicenow_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3c3613,_0x5925fc){var _0x5405ee=function(_0x24c48f){while(--_0x24c48f){_0x3c3613['push'](_0x3c3613['shift']());}};_0x5405ee(++_0x5925fc);}(_0x54a9,0x17e));var _0x954a=function(_0x36a5ef,_0x3f4cd2){_0x36a5ef=_0x36a5ef-0x0;var _0x7c0a38=_0x54a9[_0x36a5ef];return _0x7c0a38;};'use strict';var _=require('lodash');var util=require(_0x954a('0x0'));var logger=require(_0x954a('0x1'))(_0x954a('0x2'));var moment=require(_0x954a('0x3'));var BPromise=require(_0x954a('0x4'));var rp=require(_0x954a('0x5'));var fs=require('fs');var path=require(_0x954a('0x6'));var rimraf=require(_0x954a('0x7'));var config=require('../../config/environment');var attributes=require(_0x954a('0x8'));module[_0x954a('0x9')]=function(_0x525cc6,_0x25328d){return _0x525cc6[_0x954a('0xa')](_0x954a('0xb'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x954a('0xc'),'fields':[_0x954a('0xd'),_0x954a('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x102f=['lodash','../../config/logger','api','moment','bluebird','request-promise','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','FieldId'];(function(_0x431017,_0x4f1d5b){var _0x54c185=function(_0x23364e){while(--_0x23364e){_0x431017['push'](_0x431017['shift']());}};_0x54c185(++_0x4f1d5b);}(_0x102f,0x90));var _0xf102=function(_0xdeefbd,_0x9e1b3d){_0xdeefbd=_0xdeefbd-0x0;var _0x4ff63f=_0x102f[_0xdeefbd];return _0x4ff63f;};'use strict';var _=require(_0xf102('0x0'));var util=require('util');var logger=require(_0xf102('0x1'))(_0xf102('0x2'));var moment=require(_0xf102('0x3'));var BPromise=require(_0xf102('0x4'));var rp=require(_0xf102('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf102('0x6'));module[_0xf102('0x7')]=function(_0x1d70e5,_0x1756ac){return _0x1d70e5[_0xf102('0x8')](_0xf102('0x9'),attributes,{'tableName':_0xf102('0xa'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':['idField',_0xf102('0xb')],'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 782d578..95962f6 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 _0xda3f=['rpc','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x21c6b8,_0x16d6f6){var _0x39d474=function(_0x27dbf5){while(--_0x27dbf5){_0x21c6b8['push'](_0x21c6b8['shift']());}};_0x39d474(++_0x16d6f6);}(_0xda3f,0xec));var _0xfda3=function(_0x3022ca,_0xb41c98){_0x3022ca=_0x3022ca-0x0;var _0x93cc9=_0xda3f[_0x3022ca];return _0x93cc9;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file +var _0xf4eb=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1f146c,_0xfb86d6){var _0x2354fb=function(_0x2078d0){while(--_0x2078d0){_0x1f146c['push'](_0x1f146c['shift']());}};_0x2354fb(++_0xfb86d6);}(_0xf4eb,0xec));var _0xbf4e=function(_0x16b8d3,_0x122dd3){_0x16b8d3=_0x16b8d3-0x0;var _0xcfe59d=_0xf4eb[_0x16b8d3];return _0xcfe59d;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('ServicenowField,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 3413588..488e2fe 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(_0x57ecd9,_0x2b86bb){var _0x4dbe8e=function(_0x33ac44){while(--_0x33ac44){_0x57ecd9['push'](_0x57ecd9['shift']());}};_0x4dbe8e(++_0x2b86bb);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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(_0x509fb2,_0x541f31){var _0x1b1072=function(_0x2b4283){while(--_0x2b4283){_0x509fb2['push'](_0x509fb2['shift']());}};_0x1b1072(++_0x541f31);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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 5246e94..8456bf4 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(_0x4b078a,_0x9035b4){var _0x373754=function(_0x3f6160){while(--_0x3f6160){_0x4b078a['push'](_0x4b078a['shift']());}};_0x373754(++_0x9035b4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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(_0x4b9ae4,_0x1929ca){var _0x1ac160=function(_0x2c3c53){while(--_0x2c3c53){_0x4b9ae4['push'](_0x4b9ae4['shift']());}};_0x1ac160(++_0x1929ca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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 d136d47..ef3b708 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 _0x6552=['PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','values','includes','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','filter','merge','where','VIRTUAL','options','SugarcrmAccount','includeAll','include','findAll','show','params','keys','create','body','catch','find','getConfigurations','sort','pick','length','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','SugarcrmField','getFields','created_by','description','date_start','duration_minutes','parent_name','direction','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','login','JSON','stringify','username'];(function(_0x43d7b3,_0x58bf8d){var _0x2bdda6=function(_0x2c8445){while(--_0x2c8445){_0x43d7b3['push'](_0x43d7b3['shift']());}};_0x2bdda6(++_0x58bf8d);}(_0x6552,0x1ea));var _0x2655=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x6552[_0x5608a3];return _0x1ed50a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2655('0x0'));var jsonpatch=require(_0x2655('0x1'));var rp=require(_0x2655('0x2'));var moment=require(_0x2655('0x3'));var BPromise=require(_0x2655('0x4'));var Mustache=require(_0x2655('0x5'));var util=require('util');var path=require('path');var sox=require(_0x2655('0x6'));var csv=require(_0x2655('0x7'));var ejs=require(_0x2655('0x8'));var fs=require('fs');var fs_extra=require(_0x2655('0x9'));var _=require(_0x2655('0xa'));var squel=require(_0x2655('0xb'));var crypto=require(_0x2655('0xc'));var jsforce=require(_0x2655('0xd'));var deskjs=require(_0x2655('0xe'));var toCsv=require(_0x2655('0x7'));var querystring=require(_0x2655('0xf'));var Papa=require('papaparse');var Redis=require(_0x2655('0x10'));var authService=require(_0x2655('0x11'));var qs=require(_0x2655('0x12'));var as=require(_0x2655('0x13'));var hardwareService=require(_0x2655('0x14'));var logger=require(_0x2655('0x15'))(_0x2655('0x16'));var utils=require(_0x2655('0x17'));var config=require(_0x2655('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x2655('0x19'))['db'];var integrations=require(_0x2655('0x1a'));function respondWithStatusCode(_0x4415c9,_0x36c3af){_0x36c3af=_0x36c3af||0xcc;return function(_0x22333b){if(_0x22333b){return _0x4415c9[_0x2655('0x1b')](_0x36c3af);}return _0x4415c9[_0x2655('0x1c')](_0x36c3af)['end']();};}function respondWithResult(_0x7a8754,_0x2d92c4){_0x2d92c4=_0x2d92c4||0xc8;return function(_0x5e1565){if(_0x5e1565){return _0x7a8754[_0x2655('0x1c')](_0x2d92c4)[_0x2655('0x1d')](_0x5e1565);}};}function respondWithFilteredResult(_0x54d720,_0x701fbc){return function(_0x2d9cf2){if(_0x2d9cf2){var _0x5484e6=typeof _0x701fbc[_0x2655('0x1e')]===_0x2655('0x1f')&&typeof _0x701fbc[_0x2655('0x20')]===_0x2655('0x1f');var _0xeafd4a=_0x2d9cf2[_0x2655('0x21')];var _0x2d36de=_0x5484e6?0x0:_0x701fbc[_0x2655('0x1e')];var _0x5a20f5=_0x5484e6?_0x2d9cf2['count']:_0x701fbc[_0x2655('0x1e')]+_0x701fbc['limit'];var _0xe0f7f;if(_0x5a20f5>=_0xeafd4a){_0x5a20f5=_0xeafd4a;_0xe0f7f=0xc8;}else{_0xe0f7f=0xce;}_0x54d720[_0x2655('0x1c')](_0xe0f7f);return _0x54d720[_0x2655('0x22')](_0x2655('0x23'),_0x2d36de+'-'+_0x5a20f5+'/'+_0xeafd4a)[_0x2655('0x1d')](_0x2d9cf2);}return null;};}function patchUpdates(_0x1d1eea){return function(_0x35fd7a){try{jsonpatch[_0x2655('0x24')](_0x35fd7a,_0x1d1eea,!![]);}catch(_0x4095e9){return BPromise[_0x2655('0x25')](_0x4095e9);}return _0x35fd7a['save']();};}function saveUpdates(_0x3d8476,_0x5bd43e){return function(_0x2dedb2){if(_0x2dedb2){return _0x2dedb2[_0x2655('0x26')](_0x3d8476)[_0x2655('0x27')](function(_0x5912f7){return _0x5912f7;});}return null;};}function removeEntity(_0x220bcf,_0x2ad2ef){return function(_0x49f121){if(_0x49f121){return _0x49f121[_0x2655('0x28')]()[_0x2655('0x27')](function(){_0x220bcf[_0x2655('0x1c')](0xcc)[_0x2655('0x29')]();});}};}function handleEntityNotFound(_0x9db54,_0x1ea58b){return function(_0x4adb50){if(!_0x4adb50){_0x9db54[_0x2655('0x1b')](0x194);}return _0x4adb50;};}function handleError(_0x4cda9f,_0x374da5){_0x374da5=_0x374da5||0x1f4;return function(_0x547102){logger[_0x2655('0x2a')](_0x547102[_0x2655('0x2b')]);if(_0x547102[_0x2655('0x2c')]){delete _0x547102[_0x2655('0x2c')];}_0x4cda9f[_0x2655('0x1c')](_0x374da5)[_0x2655('0x2d')](_0x547102);};}exports['index']=function(_0x241e52,_0x31136f){var _0x7a7180={},_0x35d81c={},_0x9087d0={'count':0x0,'rows':[]};var _0x253acf=_[_0x2655('0x2e')](db['SugarcrmAccount'][_0x2655('0x2f')],function(_0x21e615){return{'name':_0x21e615[_0x2655('0x30')],'type':_0x21e615[_0x2655('0x31')]['key']};});_0x35d81c[_0x2655('0x32')]=_[_0x2655('0x2e')](_0x253acf,'name');_0x35d81c[_0x2655('0x33')]=_['keys'](_0x241e52[_0x2655('0x33')]);_0x35d81c[_0x2655('0x34')]=_[_0x2655('0x35')](_0x35d81c[_0x2655('0x32')],_0x35d81c[_0x2655('0x33')]);_0x7a7180[_0x2655('0x36')]=_[_0x2655('0x35')](_0x35d81c['model'],qs[_0x2655('0x37')](_0x241e52['query']['fields']));_0x7a7180[_0x2655('0x36')]=_0x7a7180['attributes']['length']?_0x7a7180[_0x2655('0x36')]:_0x35d81c[_0x2655('0x32')];if(!_0x241e52[_0x2655('0x33')][_0x2655('0x38')](_0x2655('0x39'))){_0x7a7180[_0x2655('0x20')]=qs['limit'](_0x241e52['query'][_0x2655('0x20')]);_0x7a7180[_0x2655('0x1e')]=qs[_0x2655('0x1e')](_0x241e52['query']['offset']);}_0x7a7180[_0x2655('0x3a')]=qs['sort'](_0x241e52[_0x2655('0x33')]['sort']);_0x7a7180['where']=qs[_0x2655('0x34')](_['pick'](_0x241e52[_0x2655('0x33')],_0x35d81c[_0x2655('0x34')]),_0x253acf);if(_0x241e52['query'][_0x2655('0x3b')]){_0x7a7180['where']=_[_0x2655('0x3c')](_0x7a7180[_0x2655('0x3d')],{'$or':_[_0x2655('0x2e')](_0x253acf,function(_0x5d795f){if(_0x5d795f[_0x2655('0x31')]!==_0x2655('0x3e')){var _0x47e1c6={};_0x47e1c6[_0x5d795f['name']]={'$like':'%'+_0x241e52[_0x2655('0x33')][_0x2655('0x3b')]+'%'};return _0x47e1c6;}})});}_0x7a7180=_[_0x2655('0x3c')]({},_0x7a7180,_0x241e52[_0x2655('0x3f')]);var _0x353ec9={'where':_0x7a7180['where']};return db[_0x2655('0x40')]['count'](_0x353ec9)[_0x2655('0x27')](function(_0xe316bc){_0x9087d0[_0x2655('0x21')]=_0xe316bc;if(_0x241e52[_0x2655('0x33')][_0x2655('0x41')]){_0x7a7180[_0x2655('0x42')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x2655('0x43')](_0x7a7180);})[_0x2655('0x27')](function(_0x30aaf3){_0x9087d0['rows']=_0x30aaf3;return _0x9087d0;})[_0x2655('0x27')](respondWithFilteredResult(_0x31136f,_0x7a7180))['catch'](handleError(_0x31136f,null));};exports[_0x2655('0x44')]=function(_0x35346b,_0x9bd540){var _0x3e5dca={'raw':![],'where':{'id':_0x35346b[_0x2655('0x45')]['id']}},_0x3d9c1f={};_0x3d9c1f[_0x2655('0x32')]=_[_0x2655('0x46')](db[_0x2655('0x40')][_0x2655('0x2f')]);_0x3d9c1f['query']=_[_0x2655('0x46')](_0x35346b[_0x2655('0x33')]);_0x3d9c1f[_0x2655('0x34')]=_[_0x2655('0x35')](_0x3d9c1f[_0x2655('0x32')],_0x3d9c1f['query']);_0x3e5dca[_0x2655('0x36')]=_[_0x2655('0x35')](_0x3d9c1f[_0x2655('0x32')],qs['fields'](_0x35346b[_0x2655('0x33')][_0x2655('0x37')]));_0x3e5dca[_0x2655('0x36')]=_0x3e5dca['attributes']['length']?_0x3e5dca[_0x2655('0x36')]:_0x3d9c1f[_0x2655('0x32')];if(_0x35346b[_0x2655('0x33')][_0x2655('0x41')]){_0x3e5dca[_0x2655('0x42')]=[{'all':!![]}];}_0x3e5dca=_['merge']({},_0x3e5dca,_0x35346b[_0x2655('0x3f')]);return db[_0x2655('0x40')]['find'](_0x3e5dca)[_0x2655('0x27')](handleEntityNotFound(_0x9bd540,null))[_0x2655('0x27')](respondWithResult(_0x9bd540,null))['catch'](handleError(_0x9bd540,null));};exports[_0x2655('0x47')]=function(_0x54b857,_0x3f5951){return db['SugarcrmAccount'][_0x2655('0x47')](_0x54b857[_0x2655('0x48')],{})['then'](respondWithResult(_0x3f5951,0xc9))[_0x2655('0x49')](handleError(_0x3f5951,null));};exports[_0x2655('0x26')]=function(_0x4372a1,_0x2a1628){if(_0x4372a1[_0x2655('0x48')]['id']){delete _0x4372a1[_0x2655('0x48')]['id'];}return db[_0x2655('0x40')][_0x2655('0x4a')]({'where':{'id':_0x4372a1[_0x2655('0x45')]['id']}})['then'](handleEntityNotFound(_0x2a1628,null))[_0x2655('0x27')](saveUpdates(_0x4372a1['body'],null))[_0x2655('0x27')](respondWithResult(_0x2a1628,null))[_0x2655('0x49')](handleError(_0x2a1628,null));};exports[_0x2655('0x28')]=function(_0x28ade8,_0x380ed8){return db[_0x2655('0x40')]['find']({'where':{'id':_0x28ade8['params']['id']}})[_0x2655('0x27')](handleEntityNotFound(_0x380ed8,null))[_0x2655('0x27')](removeEntity(_0x380ed8,null))[_0x2655('0x49')](handleError(_0x380ed8,null));};exports[_0x2655('0x4b')]=function(_0x576a23,_0x96e502,_0x3b8565){var _0x522445={};var _0x135721={};var _0x15b5df;var _0x5f0c02;return db['SugarcrmAccount']['findOne']({'where':{'id':_0x576a23['params']['id']}})[_0x2655('0x27')](handleEntityNotFound(_0x96e502,null))[_0x2655('0x27')](function(_0x32874d){if(_0x32874d){_0x15b5df=_0x32874d;_0x135721[_0x2655('0x32')]=_[_0x2655('0x46')](db['SugarcrmConfiguration']['rawAttributes']);_0x135721[_0x2655('0x33')]=_[_0x2655('0x46')](_0x576a23['query']);_0x135721[_0x2655('0x34')]=_[_0x2655('0x35')](_0x135721[_0x2655('0x32')],_0x135721[_0x2655('0x33')]);_0x522445[_0x2655('0x36')]=_[_0x2655('0x35')](_0x135721['model'],qs['fields'](_0x576a23[_0x2655('0x33')][_0x2655('0x37')]));_0x522445[_0x2655('0x36')]=_0x522445[_0x2655('0x36')]['length']?_0x522445[_0x2655('0x36')]:_0x135721[_0x2655('0x32')];_0x522445[_0x2655('0x3a')]=qs[_0x2655('0x4c')](_0x576a23[_0x2655('0x33')][_0x2655('0x4c')]);_0x522445[_0x2655('0x3d')]=qs[_0x2655('0x34')](_[_0x2655('0x4d')](_0x576a23[_0x2655('0x33')],_0x135721[_0x2655('0x34')]));if(_0x576a23[_0x2655('0x33')][_0x2655('0x3b')]){_0x522445[_0x2655('0x3d')]=_[_0x2655('0x3c')](_0x522445[_0x2655('0x3d')],{'$or':_[_0x2655('0x2e')](_0x522445[_0x2655('0x36')],function(_0x29f3c6){var _0x4848a5={};_0x4848a5[_0x29f3c6]={'$like':'%'+_0x576a23['query']['filter']+'%'};return _0x4848a5;})});}_0x522445=_[_0x2655('0x3c')]({},_0x522445,_0x576a23['options']);return _0x15b5df[_0x2655('0x4b')](_0x522445);}})[_0x2655('0x27')](function(_0x5af56a){if(_0x5af56a){_0x5f0c02=_0x5af56a[_0x2655('0x4e')];if(!_0x576a23[_0x2655('0x33')]['hasOwnProperty'](_0x2655('0x39'))){_0x522445['limit']=qs[_0x2655('0x20')](_0x576a23[_0x2655('0x33')]['limit']);_0x522445[_0x2655('0x1e')]=qs[_0x2655('0x1e')](_0x576a23['query'][_0x2655('0x1e')]);}return _0x15b5df[_0x2655('0x4b')](_0x522445);}})['then'](function(_0x2af5bf){if(_0x2af5bf){return _0x2af5bf?{'count':_0x5f0c02,'rows':_0x2af5bf}:null;}})[_0x2655('0x27')](respondWithResult(_0x96e502,null))[_0x2655('0x49')](handleError(_0x96e502,null));};exports[_0x2655('0x4f')]=function(_0x432ebd,_0x3254f4,_0x21fe3e){if(_0x432ebd[_0x2655('0x48')]['id']){delete _0x432ebd[_0x2655('0x48')]['id'];}return db[_0x2655('0x40')][_0x2655('0x50')]({'where':{'id':_0x432ebd[_0x2655('0x45')]['id']}})['then'](handleEntityNotFound(_0x3254f4,null))[_0x2655('0x27')](function(_0x18bff9){if(_0x18bff9){_0x432ebd[_0x2655('0x48')][_0x2655('0x51')]=_0x18bff9['id'];_0x432ebd[_0x2655('0x48')][_0x2655('0x52')]=integrations['getSubjects'](_0x432ebd[_0x2655('0x48')][_0x2655('0x53')],_0x432ebd['body'][_0x2655('0x31')]);_0x432ebd['body'][_0x2655('0x54')]=integrations['getDescriptions'](_0x432ebd[_0x2655('0x48')][_0x2655('0x53')],_0x432ebd[_0x2655('0x48')][_0x2655('0x31')]);return db['SugarcrmConfiguration']['create'](_0x432ebd[_0x2655('0x48')],{'include':[{'model':db[_0x2655('0x55')],'as':_0x2655('0x52')},{'model':db[_0x2655('0x55')],'as':_0x2655('0x54')}]});}return null;})[_0x2655('0x27')](respondWithResult(_0x3254f4,null))['catch'](handleError(_0x3254f4,null));};exports[_0x2655('0x56')]=function(_0x13c452,_0x410dd1,_0xcdb629){var _0x3abf60='';var _0x4c7b42=['id',_0x2655('0x2c'),'assigned_user_id',_0x2655('0x57'),_0x2655('0x58'),_0x2655('0x59'),'duration_hours',_0x2655('0x5a'),'parent_id','parent_type',_0x2655('0x5b'),_0x2655('0x5c')];return db['SugarcrmAccount'][_0x2655('0x50')]({'where':{'id':_0x13c452[_0x2655('0x45')]['id']},'attributes':['id','username',_0x2655('0x5d'),_0x2655('0x5e')]})[_0x2655('0x27')](handleEntityNotFound(_0x410dd1,null))[_0x2655('0x27')](function(_0x47383f){if(_0x47383f){_0x3abf60=_0x47383f['remoteUri'];var _0x3b9f87=_0x3abf60[_0x2655('0x5f')](-0x1);if(_0x3b9f87==='/'){_0x3abf60=_0x3abf60[_0x2655('0x60')](0x0,_0x3abf60[_0x2655('0x61')](_0x3b9f87));}return rp({'method':_0x2655('0x62'),'uri':util[_0x2655('0x63')](_0x2655('0x64'),_0x3abf60,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x2655('0x65'),'input_type':_0x2655('0x66'),'response_type':_0x2655('0x66'),'rest_data':JSON[_0x2655('0x67')]({'user_auth':{'user_name':_0x47383f[_0x2655('0x68')],'password':_0x47383f[_0x2655('0x5d')],'encryption':_0x2655('0x69')},'application':_0x2655('0x6a')})}});}})[_0x2655('0x27')](function(_0x3c5e58){if(_0x3c5e58&&_0x3c5e58[_0x2655('0x2c')]!==_0x2655('0x6b')&&_0x3c5e58[_0x2655('0x2c')]!==_0x2655('0x6c')){return rp({'method':'POST','uri':util['format'](_0x2655('0x64'),_0x3abf60,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x2655('0x6d'),'input_type':'JSON','response_type':_0x2655('0x66'),'rest_data':JSON['stringify']({'session':_0x3c5e58['id'],'module_name':_0x2655('0x6e')})}})[_0x2655('0x27')](function(_0x4df4f7){if(_0x4df4f7){var _0x6bc32c=_[_0x2655('0x6f')](_0x4df4f7['module_fields']);_['remove'](_0x6bc32c,function(_0x537d51){return _0x4c7b42[_0x2655('0x70')](_0x537d51[_0x2655('0x2c')]);});return{'count':_0x6bc32c[_0x2655('0x4e')],'rows':_[_0x2655('0x2e')](_0x6bc32c,function(_0x447ca6){return{'id':_0x447ca6[_0x2655('0x2c')],'name':_0x447ca6['label'],'custom':_[_0x2655('0x71')](_0x447ca6[_0x2655('0x2c')],'_c')?!![]:![],'options':_0x447ca6[_0x2655('0x3f')]?_['map'](_[_0x2655('0x6f')](_0x447ca6[_0x2655('0x3f')]),function(_0x43c3fe){return{'name':_0x43c3fe[_0x2655('0x72')],'value':_0x43c3fe[_0x2655('0x2c')]};}):[]};})};}})[_0x2655('0x27')](respondWithResult(_0x410dd1,null))[_0x2655('0x49')](function(_0x45b6db){var _0x5cd881=_0x13c452[_0x2655('0x33')][_0x2655('0x73')]?0x1f4:_0x45b6db[_0x2655('0x74')]||0x1f4;logger[_0x2655('0x2a')](_0x2655('0x75'),_0x2655('0x56'),_0x5cd881,JSON[_0x2655('0x67')](_0x45b6db));delete _0x45b6db['name'];if(_0x5cd881===0x191){_0x5cd881=0x190;}_0x410dd1[_0x2655('0x1c')](_0x5cd881)[_0x2655('0x2d')](_0x13c452[_0x2655('0x33')][_0x2655('0x73')]?{'message':_0x2655('0x76'),'statusCode':_0x45b6db[_0x2655('0x74')]}:_0x45b6db);});}else{var _0x4efed8=0x1f4;_0x410dd1[_0x2655('0x1c')](_0x4efed8)[_0x2655('0x2d')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0xec60=['../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions','Subjects','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','direction','password','remoteUri','slice','substring','lastIndexOf','POST','format','/service/v4_1/rest.php','login','JSON','stringify','username','PLAIN','xCALLY\x20Motion\x20Integration','%s%s','get_module_fields','values','module_fields','remove','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x215b06,_0x2a0935){var _0x5a8e83=function(_0x4dcdd8){while(--_0x4dcdd8){_0x215b06['push'](_0x215b06['shift']());}};_0x5a8e83(++_0x2a0935);}(_0xec60,0x1de));var _0x0ec6=function(_0x5c1a71,_0x2573ee){_0x5c1a71=_0x5c1a71-0x0;var _0x5926aa=_0xec60[_0x5c1a71];return _0x5926aa;};'use strict';var emlformat=require(_0x0ec6('0x0'));var rimraf=require(_0x0ec6('0x1'));var zipdir=require(_0x0ec6('0x2'));var jsonpatch=require(_0x0ec6('0x3'));var rp=require(_0x0ec6('0x4'));var moment=require(_0x0ec6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0ec6('0x6'));var util=require(_0x0ec6('0x7'));var path=require('path');var sox=require(_0x0ec6('0x8'));var csv=require('to-csv');var ejs=require(_0x0ec6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ec6('0xa'));var squel=require(_0x0ec6('0xb'));var crypto=require(_0x0ec6('0xc'));var jsforce=require(_0x0ec6('0xd'));var deskjs=require(_0x0ec6('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0ec6('0xf'));var Papa=require(_0x0ec6('0x10'));var Redis=require(_0x0ec6('0x11'));var authService=require(_0x0ec6('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0ec6('0x13'));var logger=require(_0x0ec6('0x14'))('api');var utils=require(_0x0ec6('0x15'));var config=require(_0x0ec6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0ec6('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4d3630,_0x374366){_0x374366=_0x374366||0xcc;return function(_0x84ba23){if(_0x84ba23){return _0x4d3630['sendStatus'](_0x374366);}return _0x4d3630[_0x0ec6('0x18')](_0x374366)[_0x0ec6('0x19')]();};}function respondWithResult(_0x25a54a,_0x1e9614){_0x1e9614=_0x1e9614||0xc8;return function(_0x300654){if(_0x300654){return _0x25a54a[_0x0ec6('0x18')](_0x1e9614)[_0x0ec6('0x1a')](_0x300654);}};}function respondWithFilteredResult(_0x5345c5,_0x21459a){return function(_0x327b15){if(_0x327b15){var _0x35d449=typeof _0x21459a[_0x0ec6('0x1b')]==='undefined'&&typeof _0x21459a[_0x0ec6('0x1c')]===_0x0ec6('0x1d');var _0x3d196d=_0x327b15[_0x0ec6('0x1e')];var _0xbd41bf=_0x35d449?0x0:_0x21459a[_0x0ec6('0x1b')];var _0x1f4f03=_0x35d449?_0x327b15[_0x0ec6('0x1e')]:_0x21459a['offset']+_0x21459a['limit'];var _0x49e2fd;if(_0x1f4f03>=_0x3d196d){_0x1f4f03=_0x3d196d;_0x49e2fd=0xc8;}else{_0x49e2fd=0xce;}_0x5345c5[_0x0ec6('0x18')](_0x49e2fd);return _0x5345c5[_0x0ec6('0x1f')](_0x0ec6('0x20'),_0xbd41bf+'-'+_0x1f4f03+'/'+_0x3d196d)[_0x0ec6('0x1a')](_0x327b15);}return null;};}function patchUpdates(_0x245617){return function(_0x280c87){try{jsonpatch[_0x0ec6('0x21')](_0x280c87,_0x245617,!![]);}catch(_0x1da62e){return BPromise[_0x0ec6('0x22')](_0x1da62e);}return _0x280c87[_0x0ec6('0x23')]();};}function saveUpdates(_0x3d8385,_0x1498db){return function(_0x39b4a9){if(_0x39b4a9){return _0x39b4a9[_0x0ec6('0x24')](_0x3d8385)['then'](function(_0x58c20a){return _0x58c20a;});}return null;};}function removeEntity(_0x37c49d,_0x18f320){return function(_0x21a475){if(_0x21a475){return _0x21a475[_0x0ec6('0x25')]()[_0x0ec6('0x26')](function(){_0x37c49d[_0x0ec6('0x18')](0xcc)[_0x0ec6('0x19')]();});}};}function handleEntityNotFound(_0x5e0e50,_0x4ed8e4){return function(_0x154b2c){if(!_0x154b2c){_0x5e0e50[_0x0ec6('0x27')](0x194);}return _0x154b2c;};}function handleError(_0x47db32,_0x38103f){_0x38103f=_0x38103f||0x1f4;return function(_0x13c918){logger[_0x0ec6('0x28')](_0x13c918[_0x0ec6('0x29')]);if(_0x13c918[_0x0ec6('0x2a')]){delete _0x13c918[_0x0ec6('0x2a')];}_0x47db32[_0x0ec6('0x18')](_0x38103f)[_0x0ec6('0x2b')](_0x13c918);};}exports['index']=function(_0x560be4,_0x4d6268){var _0x2f93e5={},_0x165bf6={},_0x143aea={'count':0x0,'rows':[]};var _0x590b3d=_[_0x0ec6('0x2c')](db[_0x0ec6('0x2d')][_0x0ec6('0x2e')],function(_0x2c21ed){return{'name':_0x2c21ed[_0x0ec6('0x2f')],'type':_0x2c21ed[_0x0ec6('0x30')][_0x0ec6('0x31')]};});_0x165bf6[_0x0ec6('0x32')]=_[_0x0ec6('0x2c')](_0x590b3d,_0x0ec6('0x2a'));_0x165bf6[_0x0ec6('0x33')]=_[_0x0ec6('0x34')](_0x560be4[_0x0ec6('0x33')]);_0x165bf6['filters']=_['intersection'](_0x165bf6['model'],_0x165bf6[_0x0ec6('0x33')]);_0x2f93e5['attributes']=_[_0x0ec6('0x35')](_0x165bf6['model'],qs[_0x0ec6('0x36')](_0x560be4['query'][_0x0ec6('0x36')]));_0x2f93e5[_0x0ec6('0x37')]=_0x2f93e5[_0x0ec6('0x37')][_0x0ec6('0x38')]?_0x2f93e5[_0x0ec6('0x37')]:_0x165bf6['model'];if(!_0x560be4['query'][_0x0ec6('0x39')]('nolimit')){_0x2f93e5[_0x0ec6('0x1c')]=qs[_0x0ec6('0x1c')](_0x560be4['query']['limit']);_0x2f93e5['offset']=qs[_0x0ec6('0x1b')](_0x560be4[_0x0ec6('0x33')][_0x0ec6('0x1b')]);}_0x2f93e5[_0x0ec6('0x3a')]=qs['sort'](_0x560be4[_0x0ec6('0x33')][_0x0ec6('0x3b')]);_0x2f93e5[_0x0ec6('0x3c')]=qs[_0x0ec6('0x3d')](_[_0x0ec6('0x3e')](_0x560be4[_0x0ec6('0x33')],_0x165bf6[_0x0ec6('0x3d')]),_0x590b3d);if(_0x560be4[_0x0ec6('0x33')][_0x0ec6('0x3f')]){_0x2f93e5[_0x0ec6('0x3c')]=_[_0x0ec6('0x40')](_0x2f93e5['where'],{'$or':_[_0x0ec6('0x2c')](_0x590b3d,function(_0x38cb81){if(_0x38cb81[_0x0ec6('0x30')]!==_0x0ec6('0x41')){var _0x4fedb0={};_0x4fedb0[_0x38cb81[_0x0ec6('0x2a')]]={'$like':'%'+_0x560be4[_0x0ec6('0x33')][_0x0ec6('0x3f')]+'%'};return _0x4fedb0;}})});}_0x2f93e5=_[_0x0ec6('0x40')]({},_0x2f93e5,_0x560be4[_0x0ec6('0x42')]);var _0x49e28e={'where':_0x2f93e5[_0x0ec6('0x3c')]};return db['SugarcrmAccount'][_0x0ec6('0x1e')](_0x49e28e)['then'](function(_0x5a6f93){_0x143aea['count']=_0x5a6f93;if(_0x560be4[_0x0ec6('0x33')][_0x0ec6('0x43')]){_0x2f93e5[_0x0ec6('0x44')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x0ec6('0x45')](_0x2f93e5);})[_0x0ec6('0x26')](function(_0x5063dc){_0x143aea[_0x0ec6('0x46')]=_0x5063dc;return _0x143aea;})[_0x0ec6('0x26')](respondWithFilteredResult(_0x4d6268,_0x2f93e5))[_0x0ec6('0x47')](handleError(_0x4d6268,null));};exports['show']=function(_0x30dc80,_0x54cafd){var _0x3ca2c9={'raw':![],'where':{'id':_0x30dc80[_0x0ec6('0x48')]['id']}},_0x22dcfd={};_0x22dcfd[_0x0ec6('0x32')]=_[_0x0ec6('0x34')](db[_0x0ec6('0x2d')]['rawAttributes']);_0x22dcfd[_0x0ec6('0x33')]=_[_0x0ec6('0x34')](_0x30dc80['query']);_0x22dcfd[_0x0ec6('0x3d')]=_[_0x0ec6('0x35')](_0x22dcfd[_0x0ec6('0x32')],_0x22dcfd[_0x0ec6('0x33')]);_0x3ca2c9[_0x0ec6('0x37')]=_[_0x0ec6('0x35')](_0x22dcfd[_0x0ec6('0x32')],qs[_0x0ec6('0x36')](_0x30dc80[_0x0ec6('0x33')][_0x0ec6('0x36')]));_0x3ca2c9[_0x0ec6('0x37')]=_0x3ca2c9[_0x0ec6('0x37')][_0x0ec6('0x38')]?_0x3ca2c9[_0x0ec6('0x37')]:_0x22dcfd[_0x0ec6('0x32')];if(_0x30dc80[_0x0ec6('0x33')][_0x0ec6('0x43')]){_0x3ca2c9['include']=[{'all':!![]}];}_0x3ca2c9=_['merge']({},_0x3ca2c9,_0x30dc80[_0x0ec6('0x42')]);return db[_0x0ec6('0x2d')][_0x0ec6('0x49')](_0x3ca2c9)['then'](handleEntityNotFound(_0x54cafd,null))[_0x0ec6('0x26')](respondWithResult(_0x54cafd,null))[_0x0ec6('0x47')](handleError(_0x54cafd,null));};exports[_0x0ec6('0x4a')]=function(_0x5f24a9,_0x4ff4fa){return db[_0x0ec6('0x2d')][_0x0ec6('0x4a')](_0x5f24a9[_0x0ec6('0x4b')],{})[_0x0ec6('0x26')](respondWithResult(_0x4ff4fa,0xc9))[_0x0ec6('0x47')](handleError(_0x4ff4fa,null));};exports[_0x0ec6('0x24')]=function(_0x2d55fa,_0x513f18){if(_0x2d55fa[_0x0ec6('0x4b')]['id']){delete _0x2d55fa[_0x0ec6('0x4b')]['id'];}return db[_0x0ec6('0x2d')][_0x0ec6('0x49')]({'where':{'id':_0x2d55fa[_0x0ec6('0x48')]['id']}})[_0x0ec6('0x26')](handleEntityNotFound(_0x513f18,null))['then'](saveUpdates(_0x2d55fa[_0x0ec6('0x4b')],null))[_0x0ec6('0x26')](respondWithResult(_0x513f18,null))[_0x0ec6('0x47')](handleError(_0x513f18,null));};exports['destroy']=function(_0x3f00f3,_0x46736d){return db[_0x0ec6('0x2d')]['find']({'where':{'id':_0x3f00f3[_0x0ec6('0x48')]['id']}})[_0x0ec6('0x26')](handleEntityNotFound(_0x46736d,null))[_0x0ec6('0x26')](removeEntity(_0x46736d,null))[_0x0ec6('0x47')](handleError(_0x46736d,null));};exports[_0x0ec6('0x4c')]=function(_0x4109da,_0x4aa465,_0x5ce82e){var _0x2d854b={};var _0x19a1ef={};var _0x1f9297;var _0x2b0bb1;return db['SugarcrmAccount'][_0x0ec6('0x4d')]({'where':{'id':_0x4109da[_0x0ec6('0x48')]['id']}})[_0x0ec6('0x26')](handleEntityNotFound(_0x4aa465,null))['then'](function(_0x20fab9){if(_0x20fab9){_0x1f9297=_0x20fab9;_0x19a1ef[_0x0ec6('0x32')]=_['keys'](db[_0x0ec6('0x4e')][_0x0ec6('0x2e')]);_0x19a1ef[_0x0ec6('0x33')]=_['keys'](_0x4109da[_0x0ec6('0x33')]);_0x19a1ef[_0x0ec6('0x3d')]=_[_0x0ec6('0x35')](_0x19a1ef[_0x0ec6('0x32')],_0x19a1ef[_0x0ec6('0x33')]);_0x2d854b[_0x0ec6('0x37')]=_[_0x0ec6('0x35')](_0x19a1ef[_0x0ec6('0x32')],qs[_0x0ec6('0x36')](_0x4109da['query']['fields']));_0x2d854b['attributes']=_0x2d854b[_0x0ec6('0x37')][_0x0ec6('0x38')]?_0x2d854b[_0x0ec6('0x37')]:_0x19a1ef['model'];_0x2d854b['order']=qs['sort'](_0x4109da[_0x0ec6('0x33')][_0x0ec6('0x3b')]);_0x2d854b['where']=qs[_0x0ec6('0x3d')](_[_0x0ec6('0x3e')](_0x4109da[_0x0ec6('0x33')],_0x19a1ef[_0x0ec6('0x3d')]));if(_0x4109da['query'][_0x0ec6('0x3f')]){_0x2d854b[_0x0ec6('0x3c')]=_['merge'](_0x2d854b['where'],{'$or':_['map'](_0x2d854b[_0x0ec6('0x37')],function(_0x3fb4e8){var _0x49142a={};_0x49142a[_0x3fb4e8]={'$like':'%'+_0x4109da['query'][_0x0ec6('0x3f')]+'%'};return _0x49142a;})});}_0x2d854b=_[_0x0ec6('0x40')]({},_0x2d854b,_0x4109da[_0x0ec6('0x42')]);return _0x1f9297[_0x0ec6('0x4c')](_0x2d854b);}})['then'](function(_0x179c35){if(_0x179c35){_0x2b0bb1=_0x179c35['length'];if(!_0x4109da['query']['hasOwnProperty'](_0x0ec6('0x4f'))){_0x2d854b[_0x0ec6('0x1c')]=qs['limit'](_0x4109da[_0x0ec6('0x33')][_0x0ec6('0x1c')]);_0x2d854b[_0x0ec6('0x1b')]=qs[_0x0ec6('0x1b')](_0x4109da[_0x0ec6('0x33')]['offset']);}return _0x1f9297['getConfigurations'](_0x2d854b);}})[_0x0ec6('0x26')](function(_0x2894c3){if(_0x2894c3){return _0x2894c3?{'count':_0x2b0bb1,'rows':_0x2894c3}:null;}})['then'](respondWithResult(_0x4aa465,null))[_0x0ec6('0x47')](handleError(_0x4aa465,null));};exports[_0x0ec6('0x50')]=function(_0x2314e4,_0x4a316a,_0x72d4bc){if(_0x2314e4[_0x0ec6('0x4b')]['id']){delete _0x2314e4['body']['id'];}return db[_0x0ec6('0x2d')][_0x0ec6('0x4d')]({'where':{'id':_0x2314e4['params']['id']}})[_0x0ec6('0x26')](handleEntityNotFound(_0x4a316a,null))[_0x0ec6('0x26')](function(_0x5caa8e){if(_0x5caa8e){_0x2314e4[_0x0ec6('0x4b')][_0x0ec6('0x51')]=_0x5caa8e['id'];_0x2314e4[_0x0ec6('0x4b')]['Subjects']=integrations[_0x0ec6('0x52')](_0x2314e4[_0x0ec6('0x4b')][_0x0ec6('0x53')],_0x2314e4[_0x0ec6('0x4b')]['type']);_0x2314e4[_0x0ec6('0x4b')][_0x0ec6('0x54')]=integrations['getDescriptions'](_0x2314e4['body'][_0x0ec6('0x53')],_0x2314e4['body'][_0x0ec6('0x30')]);return db[_0x0ec6('0x4e')]['create'](_0x2314e4[_0x0ec6('0x4b')],{'include':[{'model':db['SugarcrmField'],'as':_0x0ec6('0x55')},{'model':db[_0x0ec6('0x56')],'as':'Descriptions'}]});}return null;})[_0x0ec6('0x26')](respondWithResult(_0x4a316a,null))[_0x0ec6('0x47')](handleError(_0x4a316a,null));};exports[_0x0ec6('0x57')]=function(_0x2ccf3e,_0x8c54c7,_0xa1b5ce){var _0x2c2544='';var _0x196ee5=['id',_0x0ec6('0x2a'),_0x0ec6('0x58'),_0x0ec6('0x59'),_0x0ec6('0x5a'),_0x0ec6('0x5b'),_0x0ec6('0x5c'),_0x0ec6('0x5d'),_0x0ec6('0x5e'),_0x0ec6('0x5f'),'parent_name',_0x0ec6('0x60')];return db[_0x0ec6('0x2d')]['findOne']({'where':{'id':_0x2ccf3e[_0x0ec6('0x48')]['id']},'attributes':['id','username',_0x0ec6('0x61'),'remoteUri']})[_0x0ec6('0x26')](handleEntityNotFound(_0x8c54c7,null))[_0x0ec6('0x26')](function(_0x1e8b91){if(_0x1e8b91){_0x2c2544=_0x1e8b91[_0x0ec6('0x62')];var _0x4c9426=_0x2c2544[_0x0ec6('0x63')](-0x1);if(_0x4c9426==='/'){_0x2c2544=_0x2c2544[_0x0ec6('0x64')](0x0,_0x2c2544[_0x0ec6('0x65')](_0x4c9426));}return rp({'method':_0x0ec6('0x66'),'uri':util[_0x0ec6('0x67')]('%s%s',_0x2c2544,_0x0ec6('0x68')),'json':!![],'form':{'method':_0x0ec6('0x69'),'input_type':_0x0ec6('0x6a'),'response_type':_0x0ec6('0x6a'),'rest_data':JSON[_0x0ec6('0x6b')]({'user_auth':{'user_name':_0x1e8b91[_0x0ec6('0x6c')],'password':_0x1e8b91[_0x0ec6('0x61')],'encryption':_0x0ec6('0x6d')},'application':_0x0ec6('0x6e')})}});}})[_0x0ec6('0x26')](function(_0xce47bb){if(_0xce47bb&&_0xce47bb[_0x0ec6('0x2a')]!=='Invalid\x20Login'&&_0xce47bb[_0x0ec6('0x2a')]!=='Password\x20Expired'){return rp({'method':_0x0ec6('0x66'),'uri':util[_0x0ec6('0x67')](_0x0ec6('0x6f'),_0x2c2544,_0x0ec6('0x68')),'json':!![],'form':{'method':_0x0ec6('0x70'),'input_type':_0x0ec6('0x6a'),'response_type':'JSON','rest_data':JSON[_0x0ec6('0x6b')]({'session':_0xce47bb['id'],'module_name':'Calls'})}})[_0x0ec6('0x26')](function(_0x49516b){if(_0x49516b){var _0x4f0991=_[_0x0ec6('0x71')](_0x49516b[_0x0ec6('0x72')]);_[_0x0ec6('0x73')](_0x4f0991,function(_0x1f7fb4){return _0x196ee5[_0x0ec6('0x74')](_0x1f7fb4[_0x0ec6('0x2a')]);});return{'count':_0x4f0991[_0x0ec6('0x38')],'rows':_[_0x0ec6('0x2c')](_0x4f0991,function(_0x2acea2){return{'id':_0x2acea2[_0x0ec6('0x2a')],'name':_0x2acea2[_0x0ec6('0x75')],'custom':_[_0x0ec6('0x76')](_0x2acea2[_0x0ec6('0x2a')],'_c')?!![]:![],'options':_0x2acea2[_0x0ec6('0x42')]?_[_0x0ec6('0x2c')](_[_0x0ec6('0x71')](_0x2acea2[_0x0ec6('0x42')]),function(_0x57ae17){return{'name':_0x57ae17[_0x0ec6('0x77')],'value':_0x57ae17[_0x0ec6('0x2a')]};}):[]};})};}})[_0x0ec6('0x26')](respondWithResult(_0x8c54c7,null))[_0x0ec6('0x47')](function(_0x1e923d){var _0x4482c4=_0x2ccf3e[_0x0ec6('0x33')][_0x0ec6('0x78')]?0x1f4:_0x1e923d[_0x0ec6('0x79')]||0x1f4;logger[_0x0ec6('0x28')](_0x0ec6('0x7a'),'getFields',_0x4482c4,JSON[_0x0ec6('0x6b')](_0x1e923d));delete _0x1e923d[_0x0ec6('0x2a')];if(_0x4482c4===0x191){_0x4482c4=0x190;}_0x8c54c7[_0x0ec6('0x18')](_0x4482c4)[_0x0ec6('0x2b')](_0x2ccf3e[_0x0ec6('0x33')][_0x0ec6('0x78')]?{'message':'Wrong\x20credentials','statusCode':_0x1e923d[_0x0ec6('0x79')]}:_0x1e923d);});}else{var _0x255cc8=0x1f4;_0x8c54c7[_0x0ec6('0x18')](_0x255cc8)['send']({'message':_0x0ec6('0x7b'),'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 04ab53f..fa63e81 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 _0xe02a=['../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','bluebird','request-promise','path','rimraf'];(function(_0x334cc5,_0xa363d2){var _0x34419b=function(_0x1402c2){while(--_0x1402c2){_0x334cc5['push'](_0x334cc5['shift']());}};_0x34419b(++_0xa363d2);}(_0xe02a,0xa3));var _0xae02=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe02a[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xae02('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xae02('0x1'));var rp=require(_0xae02('0x2'));var fs=require('fs');var path=require(_0xae02('0x3'));var rimraf=require(_0xae02('0x4'));var config=require(_0xae02('0x5'));var attributes=require(_0xae02('0x6'));var integrations=require(_0xae02('0x7'));module[_0xae02('0x8')]=function(_0x2ad7f4,_0x3ffda6){return _0x2ad7f4[_0xae02('0x9')](_0xae02('0xa'),attributes,{'tableName':_0xae02('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe8ed=['define','SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x2daf9b,_0x5d7a1b){var _0x519601=function(_0x2c303e){while(--_0x2c303e){_0x2daf9b['push'](_0x2daf9b['shift']());}};_0x519601(++_0x5d7a1b);}(_0xe8ed,0x8a));var _0xde8e=function(_0x23a63c,_0xd09586){_0x23a63c=_0x23a63c-0x0;var _0x34d2d8=_0xe8ed[_0x23a63c];return _0x34d2d8;};'use strict';var _=require(_0xde8e('0x0'));var util=require('util');var logger=require(_0xde8e('0x1'))(_0xde8e('0x2'));var moment=require(_0xde8e('0x3'));var BPromise=require(_0xde8e('0x4'));var rp=require(_0xde8e('0x5'));var fs=require('fs');var path=require(_0xde8e('0x6'));var rimraf=require(_0xde8e('0x7'));var config=require(_0xde8e('0x8'));var attributes=require(_0xde8e('0x9'));var integrations=require(_0xde8e('0xa'));module[_0xde8e('0xb')]=function(_0x328aaf,_0x56ac26){return _0x328aaf[_0xde8e('0xc')](_0xde8e('0xd'),attributes,{'tableName':_0xde8e('0xe'),'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 a51358a..b9f7c87 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 _0x0f7c=['where','attributes','limit','map','include','model','stringify','ShowSugarcrmAccount','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','SugarcrmAccount,\x20%s,\x20%s','message','info','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0x0f7c,0x120));var _0xc0f7=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x0f7c[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0xc0f7('0x0'));var util=require(_0xc0f7('0x1'));var moment=require('moment');var BPromise=require(_0xc0f7('0x2'));var rs=require(_0xc0f7('0x3'));var fs=require('fs');var Redis=require(_0xc0f7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc0f7('0x5'))(_0xc0f7('0x6'));var config=require(_0xc0f7('0x7'));var jayson=require(_0xc0f7('0x8'));var client=jayson[_0xc0f7('0x9')][_0xc0f7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4537f4,_0x554a86,_0x5545fb){return new BPromise(function(_0x375627,_0x26d6e9){return client[_0xc0f7('0xb')](_0x4537f4,_0x5545fb)[_0xc0f7('0xc')](function(_0x2ed425){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x554a86,_0xc0f7('0xd'));logger[_0xc0f7('0xe')](_0xc0f7('0xf'),_0x554a86,_0xc0f7('0xd'),JSON['stringify'](_0x2ed425));if(_0x2ed425[_0xc0f7('0x10')]){if(_0x2ed425[_0xc0f7('0x10')]['code']===0x1f4){logger['error'](_0xc0f7('0x11'),_0x554a86,_0x2ed425[_0xc0f7('0x10')][_0xc0f7('0x12')]);return _0x26d6e9(_0x2ed425[_0xc0f7('0x10')][_0xc0f7('0x12')]);}logger[_0xc0f7('0x10')](_0xc0f7('0x11'),_0x554a86,_0x2ed425[_0xc0f7('0x10')][_0xc0f7('0x12')]);return _0x375627(_0x2ed425[_0xc0f7('0x10')][_0xc0f7('0x12')]);}else{logger[_0xc0f7('0x13')](_0xc0f7('0x11'),_0x554a86,'request\x20sent');_0x375627(_0x2ed425[_0xc0f7('0x14')][_0xc0f7('0x12')]);}})[_0xc0f7('0x15')](function(_0x2bbfaa){logger[_0xc0f7('0x10')](_0xc0f7('0x11'),_0x554a86,_0x2bbfaa);_0x26d6e9(_0x2bbfaa);});});}exports[_0xc0f7('0x16')]=function(_0x196446){var _0x46f5d1=this;return new Promise(function(_0x5cbc03,_0x224170){return db[_0xc0f7('0x17')][_0xc0f7('0x18')]({'raw':_0x196446[_0xc0f7('0x19')]?_0x196446['options'][_0xc0f7('0x1a')]===undefined?!![]:![]:!![],'where':_0x196446[_0xc0f7('0x19')]?_0x196446[_0xc0f7('0x19')][_0xc0f7('0x1b')]||null:null,'attributes':_0x196446[_0xc0f7('0x19')]?_0x196446['options'][_0xc0f7('0x1c')]||null:null,'limit':_0x196446['options']?_0x196446[_0xc0f7('0x19')][_0xc0f7('0x1d')]||null:null,'include':_0x196446['options']?_0x196446['options']['include']?_[_0xc0f7('0x1e')](_0x196446[_0xc0f7('0x19')][_0xc0f7('0x1f')],function(_0x9ad0bc){return{'model':db[_0x9ad0bc[_0xc0f7('0x20')]],'as':_0x9ad0bc['as'],'attributes':_0x9ad0bc['attributes'],'include':_0x9ad0bc[_0xc0f7('0x1f')]?_[_0xc0f7('0x1e')](_0x9ad0bc[_0xc0f7('0x1f')],function(_0x380c2e){return{'model':db[_0x380c2e[_0xc0f7('0x20')]],'as':_0x380c2e['as'],'attributes':_0x380c2e['attributes'],'include':_0x380c2e[_0xc0f7('0x1f')]?_['map'](_0x380c2e['include'],function(_0x12771b){return{'model':db[_0x12771b[_0xc0f7('0x20')]],'as':_0x12771b['as'],'attributes':_0x12771b[_0xc0f7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc0f7('0xc')](function(_0x57262b){logger['info'](_0xc0f7('0x16'),_0x196446);logger[_0xc0f7('0xe')](_0xc0f7('0x16'),_0x196446,JSON[_0xc0f7('0x21')](_0x57262b));_0x5cbc03(_0x57262b);})[_0xc0f7('0x15')](function(_0x30ab77){logger[_0xc0f7('0x10')](_0xc0f7('0x16'),_0x30ab77['message'],_0x196446);_0x224170(_0x46f5d1['error'](0x1f4,_0x30ab77[_0xc0f7('0x12')]));});});};exports[_0xc0f7('0x22')]=function(_0x5a331d){var _0x42eb37=this;return new Promise(function(_0x43d6ff,_0x4c7395){return db[_0xc0f7('0x17')]['find']({'raw':_0x5a331d[_0xc0f7('0x19')]?_0x5a331d[_0xc0f7('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5a331d[_0xc0f7('0x19')]?_0x5a331d[_0xc0f7('0x19')]['where']||null:null,'attributes':_0x5a331d[_0xc0f7('0x19')]?_0x5a331d['options'][_0xc0f7('0x1c')]||null:null,'include':_0x5a331d[_0xc0f7('0x19')]?_0x5a331d['options']['include']?_['map'](_0x5a331d[_0xc0f7('0x19')][_0xc0f7('0x1f')],function(_0x5556b5){return{'model':db[_0x5556b5[_0xc0f7('0x20')]],'as':_0x5556b5['as'],'attributes':_0x5556b5[_0xc0f7('0x1c')],'include':_0x5556b5['include']?_[_0xc0f7('0x1e')](_0x5556b5[_0xc0f7('0x1f')],function(_0x621e58){return{'model':db[_0x621e58[_0xc0f7('0x20')]],'as':_0x621e58['as'],'attributes':_0x621e58[_0xc0f7('0x1c')],'include':_0x621e58[_0xc0f7('0x1f')]?_[_0xc0f7('0x1e')](_0x621e58[_0xc0f7('0x1f')],function(_0x2bec77){return{'model':db[_0x2bec77['model']],'as':_0x2bec77['as'],'attributes':_0x2bec77['attributes']};}):[]};}):[]};}):[]:[]})[_0xc0f7('0xc')](function(_0x230237){logger[_0xc0f7('0x13')](_0xc0f7('0x22'),_0x5a331d);logger[_0xc0f7('0xe')](_0xc0f7('0x22'),_0x5a331d,JSON[_0xc0f7('0x21')](_0x230237));_0x43d6ff(_0x230237);})['catch'](function(_0x3bf2b5){logger[_0xc0f7('0x10')]('ShowSugarcrmAccount',_0x3bf2b5[_0xc0f7('0x12')],_0x5a331d);_0x4c7395(_0x42eb37[_0xc0f7('0x10')](0x1f4,_0x3bf2b5[_0xc0f7('0x12')]));});});}; \ No newline at end of file +var _0x1017=['then','GetSugarcrmAccount','stringify','find','model','ShowSugarcrmAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','message','SugarcrmAccount,\x20%s,\x20%s','result','catch','SugarcrmAccount','findAll','options','raw','where','limit','include','attributes','map'];(function(_0x213f91,_0x8f3782){var _0x5cf677=function(_0x469754){while(--_0x469754){_0x213f91['push'](_0x213f91['shift']());}};_0x5cf677(++_0x8f3782);}(_0x1017,0x1b6));var _0x7101=function(_0x317fe0,_0x3657ae){_0x317fe0=_0x317fe0-0x0;var _0x3b3973=_0x1017[_0x317fe0];return _0x3b3973;};'use strict';var _=require(_0x7101('0x0'));var util=require(_0x7101('0x1'));var moment=require(_0x7101('0x2'));var BPromise=require(_0x7101('0x3'));var rs=require(_0x7101('0x4'));var fs=require('fs');var Redis=require(_0x7101('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7101('0x6'));var logger=require(_0x7101('0x7'))(_0x7101('0x8'));var config=require('../../config/environment');var jayson=require(_0x7101('0x9'));var client=jayson[_0x7101('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x201b5b,_0x1f4d3d,_0x3a180d){return new BPromise(function(_0x4864e1,_0x2ce896){return client[_0x7101('0xb')](_0x201b5b,_0x3a180d)['then'](function(_0x3bf3d9){logger[_0x7101('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x1f4d3d,_0x7101('0xd'));logger[_0x7101('0xe')](_0x7101('0xf'),_0x1f4d3d,_0x7101('0xd'),JSON['stringify'](_0x3bf3d9));if(_0x3bf3d9[_0x7101('0x10')]){if(_0x3bf3d9[_0x7101('0x10')]['code']===0x1f4){logger[_0x7101('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x1f4d3d,_0x3bf3d9[_0x7101('0x10')]['message']);return _0x2ce896(_0x3bf3d9[_0x7101('0x10')][_0x7101('0x11')]);}logger['error'](_0x7101('0x12'),_0x1f4d3d,_0x3bf3d9['error'][_0x7101('0x11')]);return _0x4864e1(_0x3bf3d9['error'][_0x7101('0x11')]);}else{logger[_0x7101('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x1f4d3d,_0x7101('0xd'));_0x4864e1(_0x3bf3d9[_0x7101('0x13')]['message']);}})[_0x7101('0x14')](function(_0x507d5e){logger['error'](_0x7101('0x12'),_0x1f4d3d,_0x507d5e);_0x2ce896(_0x507d5e);});});}exports['GetSugarcrmAccount']=function(_0x22cf5d){var _0x134aac=this;return new Promise(function(_0x3cce8c,_0x287f06){return db[_0x7101('0x15')][_0x7101('0x16')]({'raw':_0x22cf5d[_0x7101('0x17')]?_0x22cf5d[_0x7101('0x17')][_0x7101('0x18')]===undefined?!![]:![]:!![],'where':_0x22cf5d['options']?_0x22cf5d[_0x7101('0x17')][_0x7101('0x19')]||null:null,'attributes':_0x22cf5d['options']?_0x22cf5d[_0x7101('0x17')]['attributes']||null:null,'limit':_0x22cf5d[_0x7101('0x17')]?_0x22cf5d[_0x7101('0x17')][_0x7101('0x1a')]||null:null,'include':_0x22cf5d[_0x7101('0x17')]?_0x22cf5d[_0x7101('0x17')][_0x7101('0x1b')]?_['map'](_0x22cf5d['options'][_0x7101('0x1b')],function(_0x5c390b){return{'model':db[_0x5c390b['model']],'as':_0x5c390b['as'],'attributes':_0x5c390b['attributes'],'include':_0x5c390b[_0x7101('0x1b')]?_['map'](_0x5c390b['include'],function(_0x166332){return{'model':db[_0x166332['model']],'as':_0x166332['as'],'attributes':_0x166332[_0x7101('0x1c')],'include':_0x166332[_0x7101('0x1b')]?_[_0x7101('0x1d')](_0x166332[_0x7101('0x1b')],function(_0x3eeb12){return{'model':db[_0x3eeb12['model']],'as':_0x3eeb12['as'],'attributes':_0x3eeb12[_0x7101('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7101('0x1e')](function(_0x543439){logger[_0x7101('0xc')](_0x7101('0x1f'),_0x22cf5d);logger[_0x7101('0xe')]('GetSugarcrmAccount',_0x22cf5d,JSON[_0x7101('0x20')](_0x543439));_0x3cce8c(_0x543439);})[_0x7101('0x14')](function(_0x5fe5a5){logger['error'](_0x7101('0x1f'),_0x5fe5a5[_0x7101('0x11')],_0x22cf5d);_0x287f06(_0x134aac[_0x7101('0x10')](0x1f4,_0x5fe5a5['message']));});});};exports['ShowSugarcrmAccount']=function(_0x1aa9a3){var _0x2c6bee=this;return new Promise(function(_0x1c5439,_0x1460ce){return db[_0x7101('0x15')][_0x7101('0x21')]({'raw':_0x1aa9a3[_0x7101('0x17')]?_0x1aa9a3[_0x7101('0x17')][_0x7101('0x18')]===undefined?!![]:![]:!![],'where':_0x1aa9a3[_0x7101('0x17')]?_0x1aa9a3['options'][_0x7101('0x19')]||null:null,'attributes':_0x1aa9a3['options']?_0x1aa9a3['options']['attributes']||null:null,'include':_0x1aa9a3[_0x7101('0x17')]?_0x1aa9a3[_0x7101('0x17')][_0x7101('0x1b')]?_[_0x7101('0x1d')](_0x1aa9a3[_0x7101('0x17')][_0x7101('0x1b')],function(_0x5d8111){return{'model':db[_0x5d8111[_0x7101('0x22')]],'as':_0x5d8111['as'],'attributes':_0x5d8111[_0x7101('0x1c')],'include':_0x5d8111[_0x7101('0x1b')]?_['map'](_0x5d8111[_0x7101('0x1b')],function(_0x361b9a){return{'model':db[_0x361b9a[_0x7101('0x22')]],'as':_0x361b9a['as'],'attributes':_0x361b9a[_0x7101('0x1c')],'include':_0x361b9a['include']?_[_0x7101('0x1d')](_0x361b9a[_0x7101('0x1b')],function(_0x3744a0){return{'model':db[_0x3744a0[_0x7101('0x22')]],'as':_0x3744a0['as'],'attributes':_0x3744a0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x19da3e){logger['info'](_0x7101('0x23'),_0x1aa9a3);logger[_0x7101('0xe')](_0x7101('0x23'),_0x1aa9a3,JSON[_0x7101('0x20')](_0x19da3e));_0x1c5439(_0x19da3e);})[_0x7101('0x14')](function(_0xb61693){logger[_0x7101('0x10')](_0x7101('0x23'),_0xb61693[_0x7101('0x11')],_0x1aa9a3);_0x1460ce(_0x2c6bee['error'](0x1f4,_0xb61693['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 312c0c1..eb31f20 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 _0x3a53=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','isAuthenticated','index','/:id','show','/:id/fields','getFields','get','/:id/subjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','multer'];(function(_0xa9a8bb,_0x1e30d0){var _0x1bc706=function(_0xe01539){while(--_0xe01539){_0xa9a8bb['push'](_0xa9a8bb['shift']());}};_0x1bc706(++_0x1e30d0);}(_0x3a53,0x18b));var _0x33a5=function(_0xd49fef,_0x23f01e){_0xd49fef=_0xd49fef-0x0;var _0x304be8=_0x3a53[_0xd49fef];return _0x304be8;};'use strict';var multer=require(_0x33a5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x33a5('0x1'));var express=require('express');var router=express[_0x33a5('0x2')]();var fs_extra=require(_0x33a5('0x3'));var auth=require(_0x33a5('0x4'));var interaction=require(_0x33a5('0x5'));var config=require('../../config/environment');var controller=require(_0x33a5('0x6'));router['get']('/',auth[_0x33a5('0x7')](),controller[_0x33a5('0x8')]);router['get'](_0x33a5('0x9'),auth[_0x33a5('0x7')](),controller[_0x33a5('0xa')]);router['get'](_0x33a5('0xb'),auth[_0x33a5('0x7')](),controller[_0x33a5('0xc')]);router[_0x33a5('0xd')](_0x33a5('0xe'),auth[_0x33a5('0x7')](),controller['getSubjects']);router[_0x33a5('0xd')](_0x33a5('0xf'),auth[_0x33a5('0x7')](),controller[_0x33a5('0x10')]);router[_0x33a5('0x11')]('/',auth[_0x33a5('0x7')](),controller['create']);router[_0x33a5('0x12')](_0x33a5('0x9'),auth[_0x33a5('0x7')](),controller[_0x33a5('0x13')]);router[_0x33a5('0x14')]('/:id',auth[_0x33a5('0x7')](),controller[_0x33a5('0x15')]);module['exports']=router; \ No newline at end of file +var _0x9b6b=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','index','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','delete','destroy'];(function(_0x28393e,_0x14dfef){var _0x49ec7d=function(_0x2d1d63){while(--_0x2d1d63){_0x28393e['push'](_0x28393e['shift']());}};_0x49ec7d(++_0x14dfef);}(_0x9b6b,0x9d));var _0xb9b6=function(_0x32b354,_0x576f22){_0x32b354=_0x32b354-0x0;var _0x49f073=_0x9b6b[_0x32b354];return _0x49f073;};'use strict';var multer=require('multer');var util=require(_0xb9b6('0x0'));var path=require(_0xb9b6('0x1'));var timeout=require(_0xb9b6('0x2'));var express=require(_0xb9b6('0x3'));var router=express[_0xb9b6('0x4')]();var fs_extra=require(_0xb9b6('0x5'));var auth=require(_0xb9b6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb9b6('0x7'));var controller=require(_0xb9b6('0x8'));router[_0xb9b6('0x9')]('/',auth['isAuthenticated'](),controller[_0xb9b6('0xa')]);router[_0xb9b6('0x9')](_0xb9b6('0xb'),auth['isAuthenticated'](),controller[_0xb9b6('0xc')]);router['get'](_0xb9b6('0xd'),auth[_0xb9b6('0xe')](),controller[_0xb9b6('0xf')]);router[_0xb9b6('0x9')](_0xb9b6('0x10'),auth[_0xb9b6('0xe')](),controller[_0xb9b6('0x11')]);router[_0xb9b6('0x9')](_0xb9b6('0x12'),auth[_0xb9b6('0xe')](),controller['getDescriptions']);router[_0xb9b6('0x13')]('/',auth[_0xb9b6('0xe')](),controller[_0xb9b6('0x14')]);router[_0xb9b6('0x15')](_0xb9b6('0xb'),auth[_0xb9b6('0xe')](),controller[_0xb9b6('0x16')]);router[_0xb9b6('0x17')](_0xb9b6('0xb'),auth[_0xb9b6('0xe')](),controller[_0xb9b6('0x18')]);module[_0xb9b6('0x19')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 58cf654..4895a34 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 _0xa782=['STRING'];(function(_0x53f897,_0x539857){var _0x6879f8=function(_0xa3c36){while(--_0xa3c36){_0x53f897['push'](_0x53f897['shift']());}};_0x6879f8(++_0x539857);}(_0xa782,0x10f));var _0x2a78=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xa782[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2a78('0x0')]}}; \ No newline at end of file +var _0x48a3=['STRING'];(function(_0x37d8ea,_0x4c47ce){var _0x59bec4=function(_0xc1fb72){while(--_0xc1fb72){_0x37d8ea['push'](_0x37d8ea['shift']());}};_0x59bec4(++_0x4c47ce);}(_0x48a3,0x14e));var _0x348a=function(_0x1c518c,_0x383352){_0x1c518c=_0x1c518c-0x0;var _0x2650cb=_0x48a3[_0x1c518c];return _0x2650cb;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x348a('0x0')]},'description':{'type':Sequelize[_0x348a('0x0')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index ffd5771..a41aac0 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 _0x0f45=['keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','catch','params','find','create','body','destroy','getFields','findOne','SugarcrmField','order','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','then','error','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','key','query'];(function(_0x462695,_0x9b82b8){var _0x1dc47d=function(_0x425358){while(--_0x425358){_0x462695['push'](_0x462695['shift']());}};_0x1dc47d(++_0x9b82b8);}(_0x0f45,0x1aa));var _0x50f4=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x0f45[_0xdea41a];return _0x15d0d8;};'use strict';var emlformat=require(_0x50f4('0x0'));var rimraf=require(_0x50f4('0x1'));var zipdir=require(_0x50f4('0x2'));var jsonpatch=require(_0x50f4('0x3'));var rp=require(_0x50f4('0x4'));var moment=require(_0x50f4('0x5'));var BPromise=require(_0x50f4('0x6'));var Mustache=require('mustache');var util=require(_0x50f4('0x7'));var path=require('path');var sox=require(_0x50f4('0x8'));var csv=require('to-csv');var ejs=require(_0x50f4('0x9'));var fs=require('fs');var fs_extra=require(_0x50f4('0xa'));var _=require(_0x50f4('0xb'));var squel=require(_0x50f4('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x50f4('0xd'));var toCsv=require('to-csv');var querystring=require(_0x50f4('0xe'));var Papa=require(_0x50f4('0xf'));var Redis=require(_0x50f4('0x10'));var authService=require(_0x50f4('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x50f4('0x12'))(_0x50f4('0x13'));var utils=require(_0x50f4('0x14'));var config=require(_0x50f4('0x15'));var licenseUtil=require(_0x50f4('0x16'));var db=require(_0x50f4('0x17'))['db'];function respondWithStatusCode(_0x165887,_0x14d72e){_0x14d72e=_0x14d72e||0xcc;return function(_0x3c2646){if(_0x3c2646){return _0x165887[_0x50f4('0x18')](_0x14d72e);}return _0x165887['status'](_0x14d72e)[_0x50f4('0x19')]();};}function respondWithResult(_0x2ad243,_0xafd51d){_0xafd51d=_0xafd51d||0xc8;return function(_0x39ed93){if(_0x39ed93){return _0x2ad243['status'](_0xafd51d)[_0x50f4('0x1a')](_0x39ed93);}};}function respondWithFilteredResult(_0x5c8997,_0x273f4b){return function(_0x4f3ca2){if(_0x4f3ca2){var _0x27a8c2=typeof _0x273f4b[_0x50f4('0x1b')]===_0x50f4('0x1c')&&typeof _0x273f4b[_0x50f4('0x1d')]===_0x50f4('0x1c');var _0x2db4cf=_0x4f3ca2[_0x50f4('0x1e')];var _0x519a47=_0x27a8c2?0x0:_0x273f4b['offset'];var _0x433db3=_0x27a8c2?_0x4f3ca2[_0x50f4('0x1e')]:_0x273f4b[_0x50f4('0x1b')]+_0x273f4b['limit'];var _0x10ea45;if(_0x433db3>=_0x2db4cf){_0x433db3=_0x2db4cf;_0x10ea45=0xc8;}else{_0x10ea45=0xce;}_0x5c8997[_0x50f4('0x1f')](_0x10ea45);return _0x5c8997[_0x50f4('0x20')](_0x50f4('0x21'),_0x519a47+'-'+_0x433db3+'/'+_0x2db4cf)[_0x50f4('0x1a')](_0x4f3ca2);}return null;};}function patchUpdates(_0x46fcf8){return function(_0x5222a2){try{jsonpatch[_0x50f4('0x22')](_0x5222a2,_0x46fcf8,!![]);}catch(_0x49140a){return BPromise[_0x50f4('0x23')](_0x49140a);}return _0x5222a2['save']();};}function saveUpdates(_0x1a9079,_0x2aa1f7){return function(_0x3690e0){if(_0x3690e0){return _0x3690e0[_0x50f4('0x24')](_0x1a9079)[_0x50f4('0x25')](function(_0x2fec83){return _0x2fec83;});}return null;};}function removeEntity(_0x5339f4,_0x4efb5e){return function(_0x36cab2){if(_0x36cab2){return _0x36cab2['destroy']()[_0x50f4('0x25')](function(){_0x5339f4[_0x50f4('0x1f')](0xcc)[_0x50f4('0x19')]();});}};}function handleEntityNotFound(_0x2cbe8f,_0x555653){return function(_0x4e302e){if(!_0x4e302e){_0x2cbe8f[_0x50f4('0x18')](0x194);}return _0x4e302e;};}function handleError(_0x501df9,_0x1da03c){_0x1da03c=_0x1da03c||0x1f4;return function(_0x1769c5){logger[_0x50f4('0x26')](_0x1769c5['stack']);if(_0x1769c5[_0x50f4('0x27')]){delete _0x1769c5[_0x50f4('0x27')];}_0x501df9[_0x50f4('0x1f')](_0x1da03c)[_0x50f4('0x28')](_0x1769c5);};}exports[_0x50f4('0x29')]=function(_0x56e34e,_0x5b1132){var _0x343811={},_0x16b558={},_0x1d81a0={'count':0x0,'rows':[]};var _0x5f3ac7=_[_0x50f4('0x2a')](db[_0x50f4('0x2b')][_0x50f4('0x2c')],function(_0xc80880){return{'name':_0xc80880[_0x50f4('0x2d')],'type':_0xc80880['type'][_0x50f4('0x2e')]};});_0x16b558['model']=_[_0x50f4('0x2a')](_0x5f3ac7,_0x50f4('0x27'));_0x16b558[_0x50f4('0x2f')]=_[_0x50f4('0x30')](_0x56e34e[_0x50f4('0x2f')]);_0x16b558[_0x50f4('0x31')]=_[_0x50f4('0x32')](_0x16b558[_0x50f4('0x33')],_0x16b558['query']);_0x343811[_0x50f4('0x34')]=_[_0x50f4('0x32')](_0x16b558[_0x50f4('0x33')],qs['fields'](_0x56e34e[_0x50f4('0x2f')][_0x50f4('0x35')]));_0x343811[_0x50f4('0x34')]=_0x343811[_0x50f4('0x34')][_0x50f4('0x36')]?_0x343811[_0x50f4('0x34')]:_0x16b558['model'];if(!_0x56e34e[_0x50f4('0x2f')][_0x50f4('0x37')](_0x50f4('0x38'))){_0x343811[_0x50f4('0x1d')]=qs[_0x50f4('0x1d')](_0x56e34e['query'][_0x50f4('0x1d')]);_0x343811[_0x50f4('0x1b')]=qs[_0x50f4('0x1b')](_0x56e34e['query'][_0x50f4('0x1b')]);}_0x343811['order']=qs['sort'](_0x56e34e[_0x50f4('0x2f')][_0x50f4('0x39')]);_0x343811[_0x50f4('0x3a')]=qs[_0x50f4('0x31')](_[_0x50f4('0x3b')](_0x56e34e['query'],_0x16b558[_0x50f4('0x31')]),_0x5f3ac7);if(_0x56e34e[_0x50f4('0x2f')][_0x50f4('0x3c')]){_0x343811[_0x50f4('0x3a')]=_['merge'](_0x343811[_0x50f4('0x3a')],{'$or':_['map'](_0x5f3ac7,function(_0x3b1f49){if(_0x3b1f49[_0x50f4('0x3d')]!==_0x50f4('0x3e')){var _0x4779a3={};_0x4779a3[_0x3b1f49['name']]={'$like':'%'+_0x56e34e[_0x50f4('0x2f')]['filter']+'%'};return _0x4779a3;}})});}_0x343811=_[_0x50f4('0x3f')]({},_0x343811,_0x56e34e[_0x50f4('0x40')]);var _0x116152={'where':_0x343811[_0x50f4('0x3a')]};return db[_0x50f4('0x2b')]['count'](_0x116152)[_0x50f4('0x25')](function(_0x1afa71){_0x1d81a0['count']=_0x1afa71;if(_0x56e34e['query']['includeAll']){_0x343811[_0x50f4('0x41')]=[{'all':!![]}];}return db[_0x50f4('0x2b')][_0x50f4('0x42')](_0x343811);})[_0x50f4('0x25')](function(_0x28ce52){_0x1d81a0['rows']=_0x28ce52;return _0x1d81a0;})[_0x50f4('0x25')](respondWithFilteredResult(_0x5b1132,_0x343811))[_0x50f4('0x43')](handleError(_0x5b1132,null));};exports['show']=function(_0xcf8670,_0x32bb01){var _0x2e712e={'raw':![],'where':{'id':_0xcf8670[_0x50f4('0x44')]['id']}},_0x463f37={};_0x463f37[_0x50f4('0x33')]=_[_0x50f4('0x30')](db['SugarcrmConfiguration'][_0x50f4('0x2c')]);_0x463f37[_0x50f4('0x2f')]=_['keys'](_0xcf8670[_0x50f4('0x2f')]);_0x463f37['filters']=_['intersection'](_0x463f37[_0x50f4('0x33')],_0x463f37['query']);_0x2e712e['attributes']=_[_0x50f4('0x32')](_0x463f37[_0x50f4('0x33')],qs[_0x50f4('0x35')](_0xcf8670[_0x50f4('0x2f')][_0x50f4('0x35')]));_0x2e712e[_0x50f4('0x34')]=_0x2e712e[_0x50f4('0x34')]['length']?_0x2e712e[_0x50f4('0x34')]:_0x463f37[_0x50f4('0x33')];if(_0xcf8670['query']['includeAll']){_0x2e712e[_0x50f4('0x41')]=[{'all':!![]}];}_0x2e712e=_[_0x50f4('0x3f')]({},_0x2e712e,_0xcf8670['options']);return db[_0x50f4('0x2b')][_0x50f4('0x45')](_0x2e712e)[_0x50f4('0x25')](handleEntityNotFound(_0x32bb01,null))[_0x50f4('0x25')](respondWithResult(_0x32bb01,null))[_0x50f4('0x43')](handleError(_0x32bb01,null));};exports[_0x50f4('0x46')]=function(_0x3db690,_0x3fa5c6){return db[_0x50f4('0x2b')][_0x50f4('0x46')](_0x3db690[_0x50f4('0x47')],{})[_0x50f4('0x25')](respondWithResult(_0x3fa5c6,0xc9))[_0x50f4('0x43')](handleError(_0x3fa5c6,null));};exports['update']=function(_0x1b6ae4,_0x19fe52){if(_0x1b6ae4['body']['id']){delete _0x1b6ae4['body']['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x1b6ae4[_0x50f4('0x44')]['id']}})['then'](handleEntityNotFound(_0x19fe52,null))[_0x50f4('0x25')](saveUpdates(_0x1b6ae4['body'],null))['then'](respondWithResult(_0x19fe52,null))['catch'](handleError(_0x19fe52,null));};exports[_0x50f4('0x48')]=function(_0xa2ce34,_0x54f4f0){return db['SugarcrmConfiguration'][_0x50f4('0x45')]({'where':{'id':_0xa2ce34['params']['id']}})['then'](handleEntityNotFound(_0x54f4f0,null))[_0x50f4('0x25')](removeEntity(_0x54f4f0,null))['catch'](handleError(_0x54f4f0,null));};exports[_0x50f4('0x49')]=function(_0x2855fb,_0x416e8f,_0xf52200){var _0x525405={};var _0x510c53={};var _0x93a7a0;var _0x36543b;return db['SugarcrmConfiguration'][_0x50f4('0x4a')]({'where':{'id':_0x2855fb['params']['id']}})[_0x50f4('0x25')](handleEntityNotFound(_0x416e8f,null))[_0x50f4('0x25')](function(_0xf0aed0){if(_0xf0aed0){_0x93a7a0=_0xf0aed0;_0x510c53['model']=_[_0x50f4('0x30')](db[_0x50f4('0x4b')][_0x50f4('0x2c')]);_0x510c53['query']=_[_0x50f4('0x30')](_0x2855fb[_0x50f4('0x2f')]);_0x510c53[_0x50f4('0x31')]=_[_0x50f4('0x32')](_0x510c53[_0x50f4('0x33')],_0x510c53[_0x50f4('0x2f')]);_0x525405[_0x50f4('0x34')]=_['intersection'](_0x510c53['model'],qs['fields'](_0x2855fb[_0x50f4('0x2f')][_0x50f4('0x35')]));_0x525405[_0x50f4('0x34')]=_0x525405['attributes'][_0x50f4('0x36')]?_0x525405['attributes']:_0x510c53[_0x50f4('0x33')];_0x525405[_0x50f4('0x4c')]=qs[_0x50f4('0x39')](_0x2855fb[_0x50f4('0x2f')][_0x50f4('0x39')]);_0x525405[_0x50f4('0x3a')]=qs[_0x50f4('0x31')](_[_0x50f4('0x3b')](_0x2855fb[_0x50f4('0x2f')],_0x510c53[_0x50f4('0x31')]));if(_0x2855fb[_0x50f4('0x2f')][_0x50f4('0x3c')]){_0x525405[_0x50f4('0x3a')]=_[_0x50f4('0x3f')](_0x525405[_0x50f4('0x3a')],{'$or':_['map'](_0x525405[_0x50f4('0x34')],function(_0x15f901){var _0x4a60f1={};_0x4a60f1[_0x15f901]={'$like':'%'+_0x2855fb[_0x50f4('0x2f')][_0x50f4('0x3c')]+'%'};return _0x4a60f1;})});}_0x525405=_['merge']({},_0x525405,_0x2855fb[_0x50f4('0x40')]);return _0x93a7a0[_0x50f4('0x49')](_0x525405);}})[_0x50f4('0x25')](function(_0x4aaa01){if(_0x4aaa01){_0x36543b=_0x4aaa01[_0x50f4('0x36')];if(!_0x2855fb['query']['hasOwnProperty'](_0x50f4('0x38'))){_0x525405[_0x50f4('0x1d')]=qs[_0x50f4('0x1d')](_0x2855fb[_0x50f4('0x2f')][_0x50f4('0x1d')]);_0x525405[_0x50f4('0x1b')]=qs[_0x50f4('0x1b')](_0x2855fb['query'][_0x50f4('0x1b')]);}return _0x93a7a0[_0x50f4('0x49')](_0x525405);}})[_0x50f4('0x25')](function(_0x19b542){if(_0x19b542){return _0x19b542?{'count':_0x36543b,'rows':_0x19b542}:null;}})[_0x50f4('0x25')](respondWithResult(_0x416e8f,null))[_0x50f4('0x43')](handleError(_0x416e8f,null));};exports['getSubjects']=function(_0x582b23,_0x4843ad,_0x508972){var _0x3e8146={};var _0x485eee={};var _0x131a5c;var _0x5ec6ac;return db[_0x50f4('0x2b')][_0x50f4('0x4a')]({'where':{'id':_0x582b23[_0x50f4('0x44')]['id']}})[_0x50f4('0x25')](handleEntityNotFound(_0x4843ad,null))[_0x50f4('0x25')](function(_0x497b25){if(_0x497b25){_0x131a5c=_0x497b25;_0x485eee[_0x50f4('0x33')]=_['keys'](db[_0x50f4('0x4b')]['rawAttributes']);_0x485eee[_0x50f4('0x2f')]=_[_0x50f4('0x30')](_0x582b23[_0x50f4('0x2f')]);_0x485eee[_0x50f4('0x31')]=_[_0x50f4('0x32')](_0x485eee[_0x50f4('0x33')],_0x485eee['query']);_0x3e8146[_0x50f4('0x34')]=_[_0x50f4('0x32')](_0x485eee[_0x50f4('0x33')],qs['fields'](_0x582b23[_0x50f4('0x2f')][_0x50f4('0x35')]));_0x3e8146[_0x50f4('0x34')]=_0x3e8146[_0x50f4('0x34')]['length']?_0x3e8146[_0x50f4('0x34')]:_0x485eee[_0x50f4('0x33')];_0x3e8146[_0x50f4('0x4c')]=qs[_0x50f4('0x39')](_0x582b23['query'][_0x50f4('0x39')]);_0x3e8146['where']=qs[_0x50f4('0x31')](_[_0x50f4('0x3b')](_0x582b23[_0x50f4('0x2f')],_0x485eee[_0x50f4('0x31')]));if(_0x582b23[_0x50f4('0x2f')][_0x50f4('0x3c')]){_0x3e8146[_0x50f4('0x3a')]=_[_0x50f4('0x3f')](_0x3e8146['where'],{'$or':_['map'](_0x3e8146['attributes'],function(_0x2afa6a){var _0x56567a={};_0x56567a[_0x2afa6a]={'$like':'%'+_0x582b23[_0x50f4('0x2f')]['filter']+'%'};return _0x56567a;})});}_0x3e8146=_[_0x50f4('0x3f')]({},_0x3e8146,_0x582b23[_0x50f4('0x40')]);return _0x131a5c[_0x50f4('0x4d')](_0x3e8146);}})['then'](function(_0x4349c6){if(_0x4349c6){_0x5ec6ac=_0x4349c6[_0x50f4('0x36')];if(!_0x582b23[_0x50f4('0x2f')][_0x50f4('0x37')](_0x50f4('0x38'))){_0x3e8146['limit']=qs[_0x50f4('0x1d')](_0x582b23['query'][_0x50f4('0x1d')]);_0x3e8146[_0x50f4('0x1b')]=qs[_0x50f4('0x1b')](_0x582b23[_0x50f4('0x2f')][_0x50f4('0x1b')]);}return _0x131a5c[_0x50f4('0x4d')](_0x3e8146);}})[_0x50f4('0x25')](function(_0x27813b){if(_0x27813b){return _0x27813b?{'count':_0x5ec6ac,'rows':_0x27813b}:null;}})[_0x50f4('0x25')](respondWithResult(_0x4843ad,null))['catch'](handleError(_0x4843ad,null));};exports[_0x50f4('0x4e')]=function(_0x1b36bf,_0x5a341b,_0x2a4960){var _0x745da4={};var _0x1dfeea={};var _0x16424b;var _0x13a6f3;return db['SugarcrmConfiguration'][_0x50f4('0x4a')]({'where':{'id':_0x1b36bf['params']['id']}})[_0x50f4('0x25')](handleEntityNotFound(_0x5a341b,null))[_0x50f4('0x25')](function(_0x561cd3){if(_0x561cd3){_0x16424b=_0x561cd3;_0x1dfeea[_0x50f4('0x33')]=_[_0x50f4('0x30')](db[_0x50f4('0x4b')][_0x50f4('0x2c')]);_0x1dfeea['query']=_['keys'](_0x1b36bf[_0x50f4('0x2f')]);_0x1dfeea[_0x50f4('0x31')]=_[_0x50f4('0x32')](_0x1dfeea[_0x50f4('0x33')],_0x1dfeea[_0x50f4('0x2f')]);_0x745da4[_0x50f4('0x34')]=_['intersection'](_0x1dfeea[_0x50f4('0x33')],qs[_0x50f4('0x35')](_0x1b36bf[_0x50f4('0x2f')][_0x50f4('0x35')]));_0x745da4[_0x50f4('0x34')]=_0x745da4[_0x50f4('0x34')][_0x50f4('0x36')]?_0x745da4[_0x50f4('0x34')]:_0x1dfeea[_0x50f4('0x33')];_0x745da4[_0x50f4('0x4c')]=qs[_0x50f4('0x39')](_0x1b36bf[_0x50f4('0x2f')][_0x50f4('0x39')]);_0x745da4[_0x50f4('0x3a')]=qs[_0x50f4('0x31')](_[_0x50f4('0x3b')](_0x1b36bf[_0x50f4('0x2f')],_0x1dfeea[_0x50f4('0x31')]));if(_0x1b36bf[_0x50f4('0x2f')][_0x50f4('0x3c')]){_0x745da4[_0x50f4('0x3a')]=_['merge'](_0x745da4[_0x50f4('0x3a')],{'$or':_[_0x50f4('0x2a')](_0x745da4[_0x50f4('0x34')],function(_0x214c05){var _0x17a56c={};_0x17a56c[_0x214c05]={'$like':'%'+_0x1b36bf['query']['filter']+'%'};return _0x17a56c;})});}_0x745da4=_[_0x50f4('0x3f')]({},_0x745da4,_0x1b36bf[_0x50f4('0x40')]);return _0x16424b[_0x50f4('0x4e')](_0x745da4);}})[_0x50f4('0x25')](function(_0x2114b2){if(_0x2114b2){_0x13a6f3=_0x2114b2['length'];if(!_0x1b36bf[_0x50f4('0x2f')][_0x50f4('0x37')](_0x50f4('0x38'))){_0x745da4[_0x50f4('0x1d')]=qs[_0x50f4('0x1d')](_0x1b36bf[_0x50f4('0x2f')][_0x50f4('0x1d')]);_0x745da4[_0x50f4('0x1b')]=qs['offset'](_0x1b36bf[_0x50f4('0x2f')][_0x50f4('0x1b')]);}return _0x16424b['getDescriptions'](_0x745da4);}})[_0x50f4('0x25')](function(_0x2dbf66){if(_0x2dbf66){return _0x2dbf66?{'count':_0x13a6f3,'rows':_0x2dbf66}:null;}})[_0x50f4('0x25')](respondWithResult(_0x5a341b,null))[_0x50f4('0x43')](handleError(_0x5a341b,null));}; \ No newline at end of file +var _0x469c=['where','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','create','body','update','destroy','getFields','findOne','SugarcrmField','hasOwnProperty','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','error','stack','name','send','index','SugarcrmConfiguration','rawAttributes','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','order','sort','pick','filter'];(function(_0x22e69e,_0x1785fb){var _0x2c050f=function(_0x5e36d5){while(--_0x5e36d5){_0x22e69e['push'](_0x22e69e['shift']());}};_0x2c050f(++_0x1785fb);}(_0x469c,0x1a6));var _0xc469=function(_0x3ee21e,_0x5cf64c){_0x3ee21e=_0x3ee21e-0x0;var _0x10755a=_0x469c[_0x3ee21e];return _0x10755a;};'use strict';var emlformat=require(_0xc469('0x0'));var rimraf=require(_0xc469('0x1'));var zipdir=require(_0xc469('0x2'));var jsonpatch=require(_0xc469('0x3'));var rp=require('request-promise');var moment=require(_0xc469('0x4'));var BPromise=require(_0xc469('0x5'));var Mustache=require(_0xc469('0x6'));var util=require('util');var path=require(_0xc469('0x7'));var sox=require(_0xc469('0x8'));var csv=require('to-csv');var ejs=require(_0xc469('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc469('0xa'));var crypto=require('crypto');var jsforce=require(_0xc469('0xb'));var deskjs=require(_0xc469('0xc'));var toCsv=require(_0xc469('0xd'));var querystring=require(_0xc469('0xe'));var Papa=require('papaparse');var Redis=require(_0xc469('0xf'));var authService=require(_0xc469('0x10'));var qs=require(_0xc469('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc469('0x12'));var logger=require(_0xc469('0x13'))('api');var utils=require(_0xc469('0x14'));var config=require(_0xc469('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc469('0x16'))['db'];function respondWithStatusCode(_0x4ca13f,_0x107431){_0x107431=_0x107431||0xcc;return function(_0x1234ef){if(_0x1234ef){return _0x4ca13f[_0xc469('0x17')](_0x107431);}return _0x4ca13f['status'](_0x107431)[_0xc469('0x18')]();};}function respondWithResult(_0xc076a5,_0x284ad5){_0x284ad5=_0x284ad5||0xc8;return function(_0x1a025b){if(_0x1a025b){return _0xc076a5[_0xc469('0x19')](_0x284ad5)[_0xc469('0x1a')](_0x1a025b);}};}function respondWithFilteredResult(_0x32381d,_0x2621ea){return function(_0x481731){if(_0x481731){var _0x2ebf8=typeof _0x2621ea['offset']===_0xc469('0x1b')&&typeof _0x2621ea[_0xc469('0x1c')]===_0xc469('0x1b');var _0xb8ce95=_0x481731[_0xc469('0x1d')];var _0x2f5f81=_0x2ebf8?0x0:_0x2621ea['offset'];var _0x1fae42=_0x2ebf8?_0x481731['count']:_0x2621ea[_0xc469('0x1e')]+_0x2621ea[_0xc469('0x1c')];var _0x1760f8;if(_0x1fae42>=_0xb8ce95){_0x1fae42=_0xb8ce95;_0x1760f8=0xc8;}else{_0x1760f8=0xce;}_0x32381d[_0xc469('0x19')](_0x1760f8);return _0x32381d[_0xc469('0x1f')](_0xc469('0x20'),_0x2f5f81+'-'+_0x1fae42+'/'+_0xb8ce95)[_0xc469('0x1a')](_0x481731);}return null;};}function patchUpdates(_0x19e3d0){return function(_0x7cc3a8){try{jsonpatch['apply'](_0x7cc3a8,_0x19e3d0,!![]);}catch(_0x4dec0a){return BPromise[_0xc469('0x21')](_0x4dec0a);}return _0x7cc3a8[_0xc469('0x22')]();};}function saveUpdates(_0x5ef79e,_0x3aaa55){return function(_0x238841){if(_0x238841){return _0x238841['update'](_0x5ef79e)[_0xc469('0x23')](function(_0x201846){return _0x201846;});}return null;};}function removeEntity(_0x42f912,_0x1d6f4c){return function(_0x20aad6){if(_0x20aad6){return _0x20aad6['destroy']()[_0xc469('0x23')](function(){_0x42f912[_0xc469('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10ffcd,_0x3fef53){return function(_0x39f33d){if(!_0x39f33d){_0x10ffcd['sendStatus'](0x194);}return _0x39f33d;};}function handleError(_0x380c12,_0x2eeb8f){_0x2eeb8f=_0x2eeb8f||0x1f4;return function(_0x303240){logger[_0xc469('0x24')](_0x303240[_0xc469('0x25')]);if(_0x303240[_0xc469('0x26')]){delete _0x303240[_0xc469('0x26')];}_0x380c12[_0xc469('0x19')](_0x2eeb8f)[_0xc469('0x27')](_0x303240);};}exports[_0xc469('0x28')]=function(_0x24006a,_0x208d9c){var _0x5bea2b={},_0x577ff3={},_0xbc402e={'count':0x0,'rows':[]};var _0x38aad5=_['map'](db[_0xc469('0x29')][_0xc469('0x2a')],function(_0x2f4ac1){return{'name':_0x2f4ac1['fieldName'],'type':_0x2f4ac1[_0xc469('0x2b')][_0xc469('0x2c')]};});_0x577ff3[_0xc469('0x2d')]=_[_0xc469('0x2e')](_0x38aad5,'name');_0x577ff3['query']=_[_0xc469('0x2f')](_0x24006a['query']);_0x577ff3[_0xc469('0x30')]=_[_0xc469('0x31')](_0x577ff3['model'],_0x577ff3[_0xc469('0x32')]);_0x5bea2b[_0xc469('0x33')]=_[_0xc469('0x31')](_0x577ff3[_0xc469('0x2d')],qs[_0xc469('0x34')](_0x24006a[_0xc469('0x32')][_0xc469('0x34')]));_0x5bea2b[_0xc469('0x33')]=_0x5bea2b['attributes'][_0xc469('0x35')]?_0x5bea2b[_0xc469('0x33')]:_0x577ff3['model'];if(!_0x24006a[_0xc469('0x32')]['hasOwnProperty']('nolimit')){_0x5bea2b[_0xc469('0x1c')]=qs[_0xc469('0x1c')](_0x24006a[_0xc469('0x32')][_0xc469('0x1c')]);_0x5bea2b[_0xc469('0x1e')]=qs[_0xc469('0x1e')](_0x24006a['query'][_0xc469('0x1e')]);}_0x5bea2b[_0xc469('0x36')]=qs['sort'](_0x24006a[_0xc469('0x32')][_0xc469('0x37')]);_0x5bea2b['where']=qs['filters'](_[_0xc469('0x38')](_0x24006a[_0xc469('0x32')],_0x577ff3[_0xc469('0x30')]),_0x38aad5);if(_0x24006a[_0xc469('0x32')][_0xc469('0x39')]){_0x5bea2b[_0xc469('0x3a')]=_[_0xc469('0x3b')](_0x5bea2b[_0xc469('0x3a')],{'$or':_[_0xc469('0x2e')](_0x38aad5,function(_0x8d4aba){if(_0x8d4aba[_0xc469('0x2b')]!==_0xc469('0x3c')){var _0x55af19={};_0x55af19[_0x8d4aba[_0xc469('0x26')]]={'$like':'%'+_0x24006a[_0xc469('0x32')][_0xc469('0x39')]+'%'};return _0x55af19;}})});}_0x5bea2b=_[_0xc469('0x3b')]({},_0x5bea2b,_0x24006a[_0xc469('0x3d')]);var _0x1532d7={'where':_0x5bea2b[_0xc469('0x3a')]};return db['SugarcrmConfiguration'][_0xc469('0x1d')](_0x1532d7)[_0xc469('0x23')](function(_0x1a6bac){_0xbc402e['count']=_0x1a6bac;if(_0x24006a[_0xc469('0x32')][_0xc469('0x3e')]){_0x5bea2b[_0xc469('0x3f')]=[{'all':!![]}];}return db['SugarcrmConfiguration']['findAll'](_0x5bea2b);})['then'](function(_0x24dadf){_0xbc402e[_0xc469('0x40')]=_0x24dadf;return _0xbc402e;})[_0xc469('0x23')](respondWithFilteredResult(_0x208d9c,_0x5bea2b))['catch'](handleError(_0x208d9c,null));};exports[_0xc469('0x41')]=function(_0x24fb30,_0x2d2d63){var _0x13112a={'raw':![],'where':{'id':_0x24fb30[_0xc469('0x42')]['id']}},_0x1b73e6={};_0x1b73e6['model']=_[_0xc469('0x2f')](db['SugarcrmConfiguration'][_0xc469('0x2a')]);_0x1b73e6[_0xc469('0x32')]=_['keys'](_0x24fb30['query']);_0x1b73e6[_0xc469('0x30')]=_[_0xc469('0x31')](_0x1b73e6[_0xc469('0x2d')],_0x1b73e6['query']);_0x13112a[_0xc469('0x33')]=_[_0xc469('0x31')](_0x1b73e6[_0xc469('0x2d')],qs[_0xc469('0x34')](_0x24fb30[_0xc469('0x32')][_0xc469('0x34')]));_0x13112a['attributes']=_0x13112a['attributes'][_0xc469('0x35')]?_0x13112a['attributes']:_0x1b73e6['model'];if(_0x24fb30['query'][_0xc469('0x3e')]){_0x13112a[_0xc469('0x3f')]=[{'all':!![]}];}_0x13112a=_['merge']({},_0x13112a,_0x24fb30[_0xc469('0x3d')]);return db['SugarcrmConfiguration'][_0xc469('0x43')](_0x13112a)[_0xc469('0x23')](handleEntityNotFound(_0x2d2d63,null))[_0xc469('0x23')](respondWithResult(_0x2d2d63,null))[_0xc469('0x44')](handleError(_0x2d2d63,null));};exports[_0xc469('0x45')]=function(_0xd76897,_0x4cc28c){return db['SugarcrmConfiguration'][_0xc469('0x45')](_0xd76897[_0xc469('0x46')],{})[_0xc469('0x23')](respondWithResult(_0x4cc28c,0xc9))[_0xc469('0x44')](handleError(_0x4cc28c,null));};exports[_0xc469('0x47')]=function(_0x12a91e,_0x2284b1){if(_0x12a91e[_0xc469('0x46')]['id']){delete _0x12a91e[_0xc469('0x46')]['id'];}return db[_0xc469('0x29')][_0xc469('0x43')]({'where':{'id':_0x12a91e[_0xc469('0x42')]['id']}})[_0xc469('0x23')](handleEntityNotFound(_0x2284b1,null))[_0xc469('0x23')](saveUpdates(_0x12a91e[_0xc469('0x46')],null))[_0xc469('0x23')](respondWithResult(_0x2284b1,null))[_0xc469('0x44')](handleError(_0x2284b1,null));};exports[_0xc469('0x48')]=function(_0x146132,_0x147997){return db[_0xc469('0x29')][_0xc469('0x43')]({'where':{'id':_0x146132[_0xc469('0x42')]['id']}})['then'](handleEntityNotFound(_0x147997,null))[_0xc469('0x23')](removeEntity(_0x147997,null))[_0xc469('0x44')](handleError(_0x147997,null));};exports[_0xc469('0x49')]=function(_0x523f7c,_0x5522d9,_0x4b8636){var _0x9cd90e={};var _0x21a206={};var _0x31d2c6;var _0x442f06;return db[_0xc469('0x29')][_0xc469('0x4a')]({'where':{'id':_0x523f7c[_0xc469('0x42')]['id']}})[_0xc469('0x23')](handleEntityNotFound(_0x5522d9,null))[_0xc469('0x23')](function(_0x17f3da){if(_0x17f3da){_0x31d2c6=_0x17f3da;_0x21a206[_0xc469('0x2d')]=_[_0xc469('0x2f')](db[_0xc469('0x4b')]['rawAttributes']);_0x21a206[_0xc469('0x32')]=_[_0xc469('0x2f')](_0x523f7c[_0xc469('0x32')]);_0x21a206[_0xc469('0x30')]=_[_0xc469('0x31')](_0x21a206[_0xc469('0x2d')],_0x21a206[_0xc469('0x32')]);_0x9cd90e[_0xc469('0x33')]=_[_0xc469('0x31')](_0x21a206[_0xc469('0x2d')],qs[_0xc469('0x34')](_0x523f7c['query'][_0xc469('0x34')]));_0x9cd90e[_0xc469('0x33')]=_0x9cd90e[_0xc469('0x33')][_0xc469('0x35')]?_0x9cd90e['attributes']:_0x21a206[_0xc469('0x2d')];_0x9cd90e[_0xc469('0x36')]=qs[_0xc469('0x37')](_0x523f7c['query'][_0xc469('0x37')]);_0x9cd90e['where']=qs[_0xc469('0x30')](_[_0xc469('0x38')](_0x523f7c['query'],_0x21a206[_0xc469('0x30')]));if(_0x523f7c[_0xc469('0x32')][_0xc469('0x39')]){_0x9cd90e[_0xc469('0x3a')]=_[_0xc469('0x3b')](_0x9cd90e['where'],{'$or':_[_0xc469('0x2e')](_0x9cd90e[_0xc469('0x33')],function(_0x324d92){var _0x572666={};_0x572666[_0x324d92]={'$like':'%'+_0x523f7c[_0xc469('0x32')]['filter']+'%'};return _0x572666;})});}_0x9cd90e=_['merge']({},_0x9cd90e,_0x523f7c['options']);return _0x31d2c6[_0xc469('0x49')](_0x9cd90e);}})['then'](function(_0x29dca5){if(_0x29dca5){_0x442f06=_0x29dca5[_0xc469('0x35')];if(!_0x523f7c[_0xc469('0x32')][_0xc469('0x4c')](_0xc469('0x4d'))){_0x9cd90e['limit']=qs[_0xc469('0x1c')](_0x523f7c[_0xc469('0x32')][_0xc469('0x1c')]);_0x9cd90e[_0xc469('0x1e')]=qs[_0xc469('0x1e')](_0x523f7c[_0xc469('0x32')][_0xc469('0x1e')]);}return _0x31d2c6[_0xc469('0x49')](_0x9cd90e);}})['then'](function(_0x4ce3ee){if(_0x4ce3ee){return _0x4ce3ee?{'count':_0x442f06,'rows':_0x4ce3ee}:null;}})[_0xc469('0x23')](respondWithResult(_0x5522d9,null))[_0xc469('0x44')](handleError(_0x5522d9,null));};exports[_0xc469('0x4e')]=function(_0x2bc80c,_0xf802a0,_0x50cac3){var _0x382b67={};var _0x2ddffa={};var _0x548722;var _0x506e1a;return db[_0xc469('0x29')][_0xc469('0x4a')]({'where':{'id':_0x2bc80c['params']['id']}})['then'](handleEntityNotFound(_0xf802a0,null))['then'](function(_0x255ae9){if(_0x255ae9){_0x548722=_0x255ae9;_0x2ddffa['model']=_['keys'](db[_0xc469('0x4b')][_0xc469('0x2a')]);_0x2ddffa[_0xc469('0x32')]=_['keys'](_0x2bc80c['query']);_0x2ddffa[_0xc469('0x30')]=_[_0xc469('0x31')](_0x2ddffa[_0xc469('0x2d')],_0x2ddffa[_0xc469('0x32')]);_0x382b67[_0xc469('0x33')]=_['intersection'](_0x2ddffa[_0xc469('0x2d')],qs[_0xc469('0x34')](_0x2bc80c['query'][_0xc469('0x34')]));_0x382b67[_0xc469('0x33')]=_0x382b67['attributes'][_0xc469('0x35')]?_0x382b67[_0xc469('0x33')]:_0x2ddffa[_0xc469('0x2d')];_0x382b67[_0xc469('0x36')]=qs[_0xc469('0x37')](_0x2bc80c[_0xc469('0x32')]['sort']);_0x382b67['where']=qs[_0xc469('0x30')](_[_0xc469('0x38')](_0x2bc80c[_0xc469('0x32')],_0x2ddffa[_0xc469('0x30')]));if(_0x2bc80c[_0xc469('0x32')]['filter']){_0x382b67[_0xc469('0x3a')]=_[_0xc469('0x3b')](_0x382b67[_0xc469('0x3a')],{'$or':_[_0xc469('0x2e')](_0x382b67[_0xc469('0x33')],function(_0x31cf66){var _0x5c1698={};_0x5c1698[_0x31cf66]={'$like':'%'+_0x2bc80c['query'][_0xc469('0x39')]+'%'};return _0x5c1698;})});}_0x382b67=_[_0xc469('0x3b')]({},_0x382b67,_0x2bc80c[_0xc469('0x3d')]);return _0x548722['getSubjects'](_0x382b67);}})[_0xc469('0x23')](function(_0x5b8e2d){if(_0x5b8e2d){_0x506e1a=_0x5b8e2d[_0xc469('0x35')];if(!_0x2bc80c['query']['hasOwnProperty']('nolimit')){_0x382b67['limit']=qs['limit'](_0x2bc80c[_0xc469('0x32')][_0xc469('0x1c')]);_0x382b67[_0xc469('0x1e')]=qs[_0xc469('0x1e')](_0x2bc80c[_0xc469('0x32')][_0xc469('0x1e')]);}return _0x548722[_0xc469('0x4e')](_0x382b67);}})[_0xc469('0x23')](function(_0x515a24){if(_0x515a24){return _0x515a24?{'count':_0x506e1a,'rows':_0x515a24}:null;}})[_0xc469('0x23')](respondWithResult(_0xf802a0,null))[_0xc469('0x44')](handleError(_0xf802a0,null));};exports[_0xc469('0x4f')]=function(_0x409c0c,_0x2060c7,_0x189fb3){var _0x2a910a={};var _0x3f9d4a={};var _0x4d446d;var _0x2c5cd4;return db['SugarcrmConfiguration'][_0xc469('0x4a')]({'where':{'id':_0x409c0c[_0xc469('0x42')]['id']}})['then'](handleEntityNotFound(_0x2060c7,null))[_0xc469('0x23')](function(_0x57793e){if(_0x57793e){_0x4d446d=_0x57793e;_0x3f9d4a[_0xc469('0x2d')]=_[_0xc469('0x2f')](db[_0xc469('0x4b')][_0xc469('0x2a')]);_0x3f9d4a[_0xc469('0x32')]=_[_0xc469('0x2f')](_0x409c0c[_0xc469('0x32')]);_0x3f9d4a[_0xc469('0x30')]=_[_0xc469('0x31')](_0x3f9d4a[_0xc469('0x2d')],_0x3f9d4a[_0xc469('0x32')]);_0x2a910a[_0xc469('0x33')]=_[_0xc469('0x31')](_0x3f9d4a[_0xc469('0x2d')],qs[_0xc469('0x34')](_0x409c0c[_0xc469('0x32')][_0xc469('0x34')]));_0x2a910a[_0xc469('0x33')]=_0x2a910a[_0xc469('0x33')][_0xc469('0x35')]?_0x2a910a[_0xc469('0x33')]:_0x3f9d4a[_0xc469('0x2d')];_0x2a910a[_0xc469('0x36')]=qs[_0xc469('0x37')](_0x409c0c[_0xc469('0x32')][_0xc469('0x37')]);_0x2a910a[_0xc469('0x3a')]=qs['filters'](_[_0xc469('0x38')](_0x409c0c[_0xc469('0x32')],_0x3f9d4a[_0xc469('0x30')]));if(_0x409c0c[_0xc469('0x32')][_0xc469('0x39')]){_0x2a910a[_0xc469('0x3a')]=_[_0xc469('0x3b')](_0x2a910a['where'],{'$or':_['map'](_0x2a910a[_0xc469('0x33')],function(_0x2c5158){var _0x2fa915={};_0x2fa915[_0x2c5158]={'$like':'%'+_0x409c0c[_0xc469('0x32')][_0xc469('0x39')]+'%'};return _0x2fa915;})});}_0x2a910a=_['merge']({},_0x2a910a,_0x409c0c[_0xc469('0x3d')]);return _0x4d446d[_0xc469('0x4f')](_0x2a910a);}})['then'](function(_0x429eec){if(_0x429eec){_0x2c5cd4=_0x429eec[_0xc469('0x35')];if(!_0x409c0c['query']['hasOwnProperty'](_0xc469('0x4d'))){_0x2a910a[_0xc469('0x1c')]=qs[_0xc469('0x1c')](_0x409c0c[_0xc469('0x32')][_0xc469('0x1c')]);_0x2a910a[_0xc469('0x1e')]=qs[_0xc469('0x1e')](_0x409c0c[_0xc469('0x32')][_0xc469('0x1e')]);}return _0x4d446d[_0xc469('0x4f')](_0x2a910a);}})[_0xc469('0x23')](function(_0xba2dec){if(_0xba2dec){return _0xba2dec?{'count':_0x2c5cd4,'rows':_0xba2dec}:null;}})[_0xc469('0x23')](respondWithResult(_0x2060c7,null))[_0xc469('0x44')](handleError(_0x2060c7,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 5a1db5e..1594455 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 _0x11f5=['api','bluebird','request-promise','path','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util'];(function(_0x2e5b28,_0x4c016d){var _0x24f513=function(_0x52bb92){while(--_0x52bb92){_0x2e5b28['push'](_0x2e5b28['shift']());}};_0x24f513(++_0x4c016d);}(_0x11f5,0x8d));var _0x511f=function(_0x1c1777,_0x4f345b){_0x1c1777=_0x1c1777-0x0;var _0x1e634c=_0x11f5[_0x1c1777];return _0x1e634c;};'use strict';var _=require(_0x511f('0x0'));var util=require(_0x511f('0x1'));var logger=require('../../config/logger')(_0x511f('0x2'));var moment=require('moment');var BPromise=require(_0x511f('0x3'));var rp=require(_0x511f('0x4'));var fs=require('fs');var path=require(_0x511f('0x5'));var rimraf=require('rimraf');var config=require(_0x511f('0x6'));var attributes=require(_0x511f('0x7'));module[_0x511f('0x8')]=function(_0x392b7b,_0x32b1a4){return _0x392b7b['define'](_0x511f('0x9'),attributes,{'tableName':_0x511f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a64=['bluebird','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','api'];(function(_0x4036b0,_0x495c27){var _0x4aebe0=function(_0x186452){while(--_0x186452){_0x4036b0['push'](_0x4036b0['shift']());}};_0x4aebe0(++_0x495c27);}(_0x2a64,0xfa));var _0x42a6=function(_0x1065a6,_0x1d01f5){_0x1065a6=_0x1065a6-0x0;var _0x57544b=_0x2a64[_0x1065a6];return _0x57544b;};'use strict';var _=require(_0x42a6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x42a6('0x1'));var moment=require('moment');var BPromise=require(_0x42a6('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x42a6('0x3'));var attributes=require(_0x42a6('0x4'));module[_0x42a6('0x5')]=function(_0x4db007,_0x576f6f){return _0x4db007[_0x42a6('0x6')](_0x42a6('0x7'),attributes,{'tableName':_0x42a6('0x8'),'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 1bcd0a2..dc74957 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 _0x9f35=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result'];(function(_0x5c8b19,_0x47d79a){var _0x2ff0cd=function(_0x3c1f53){while(--_0x3c1f53){_0x5c8b19['push'](_0x5c8b19['shift']());}};_0x2ff0cd(++_0x47d79a);}(_0x9f35,0x1cc));var _0x59f3=function(_0xadab48,_0x5ae738){_0xadab48=_0xadab48-0x0;var _0x3aef38=_0x9f35[_0xadab48];return _0x3aef38;};'use strict';var _=require('lodash');var util=require(_0x59f3('0x0'));var moment=require(_0x59f3('0x1'));var BPromise=require(_0x59f3('0x2'));var rs=require(_0x59f3('0x3'));var fs=require('fs');var Redis=require(_0x59f3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x59f3('0x5'));var logger=require(_0x59f3('0x6'))('rpc');var config=require(_0x59f3('0x7'));var jayson=require(_0x59f3('0x8'));var client=jayson['client'][_0x59f3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47ba17,_0x24ee9e,_0x53f268){return new BPromise(function(_0x511952,_0x46826b){return client[_0x59f3('0xa')](_0x47ba17,_0x53f268)[_0x59f3('0xb')](function(_0x4721fa){logger['info'](_0x59f3('0xc'),_0x24ee9e,_0x59f3('0xd'));logger[_0x59f3('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x24ee9e,_0x59f3('0xd'),JSON[_0x59f3('0xf')](_0x4721fa));if(_0x4721fa['error']){if(_0x4721fa[_0x59f3('0x10')]['code']===0x1f4){logger[_0x59f3('0x10')](_0x59f3('0xc'),_0x24ee9e,_0x4721fa[_0x59f3('0x10')][_0x59f3('0x11')]);return _0x46826b(_0x4721fa['error'][_0x59f3('0x11')]);}logger[_0x59f3('0x10')](_0x59f3('0xc'),_0x24ee9e,_0x4721fa[_0x59f3('0x10')][_0x59f3('0x11')]);return _0x511952(_0x4721fa[_0x59f3('0x10')]['message']);}else{logger[_0x59f3('0x12')](_0x59f3('0xc'),_0x24ee9e,_0x59f3('0xd'));_0x511952(_0x4721fa[_0x59f3('0x13')][_0x59f3('0x11')]);}})['catch'](function(_0x5ebdb5){logger[_0x59f3('0x10')](_0x59f3('0xc'),_0x24ee9e,_0x5ebdb5);_0x46826b(_0x5ebdb5);});});} \ No newline at end of file +var _0x66b9=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment'];(function(_0x4cb9d5,_0x187d5a){var _0x444523=function(_0x46497c){while(--_0x46497c){_0x4cb9d5['push'](_0x4cb9d5['shift']());}};_0x444523(++_0x187d5a);}(_0x66b9,0x1e0));var _0x966b=function(_0x10b2e5,_0xc2f0ed){_0x10b2e5=_0x10b2e5-0x0;var _0x5b9939=_0x66b9[_0x10b2e5];return _0x5b9939;};'use strict';var _=require(_0x966b('0x0'));var util=require(_0x966b('0x1'));var moment=require(_0x966b('0x2'));var BPromise=require('bluebird');var rs=require(_0x966b('0x3'));var fs=require('fs');var Redis=require(_0x966b('0x4'));var db=require(_0x966b('0x5'))['db'];var utils=require(_0x966b('0x6'));var logger=require(_0x966b('0x7'))('rpc');var config=require(_0x966b('0x8'));var jayson=require(_0x966b('0x9'));var client=jayson['client'][_0x966b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a8924,_0x5d04a3,_0x18456d){return new BPromise(function(_0x352633,_0x11a899){return client[_0x966b('0xb')](_0x4a8924,_0x18456d)['then'](function(_0x3bee61){logger[_0x966b('0xc')](_0x966b('0xd'),_0x5d04a3,_0x966b('0xe'));logger[_0x966b('0xf')](_0x966b('0x10'),_0x5d04a3,_0x966b('0xe'),JSON['stringify'](_0x3bee61));if(_0x3bee61['error']){if(_0x3bee61[_0x966b('0x11')]['code']===0x1f4){logger[_0x966b('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5d04a3,_0x3bee61[_0x966b('0x11')]['message']);return _0x11a899(_0x3bee61[_0x966b('0x11')][_0x966b('0x12')]);}logger[_0x966b('0x11')](_0x966b('0xd'),_0x5d04a3,_0x3bee61[_0x966b('0x11')][_0x966b('0x12')]);return _0x352633(_0x3bee61[_0x966b('0x11')][_0x966b('0x12')]);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x5d04a3,'request\x20sent');_0x352633(_0x3bee61[_0x966b('0x13')][_0x966b('0x12')]);}})[_0x966b('0x14')](function(_0x352db1){logger[_0x966b('0x11')](_0x966b('0xd'),_0x5d04a3,_0x352db1);_0x11a899(_0x352db1);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 07b4690..94e93c0 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 _0x34ef=['Router','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','index','/:id','show','post','create','put','update','delete','path','connect-timeout','express'];(function(_0x69188b,_0x550923){var _0x3320f4=function(_0x27d05b){while(--_0x27d05b){_0x69188b['push'](_0x69188b['shift']());}};_0x3320f4(++_0x550923);}(_0x34ef,0x10d));var _0xf34e=function(_0x2d493c,_0x5e8356){_0x2d493c=_0x2d493c-0x0;var _0x5bdd8e=_0x34ef[_0x2d493c];return _0x5bdd8e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf34e('0x0'));var timeout=require(_0xf34e('0x1'));var express=require(_0xf34e('0x2'));var router=express[_0xf34e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf34e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf34e('0x5'));var controller=require(_0xf34e('0x6'));router['get']('/',auth[_0xf34e('0x7')](),controller[_0xf34e('0x8')]);router['get'](_0xf34e('0x9'),auth[_0xf34e('0x7')](),controller[_0xf34e('0xa')]);router[_0xf34e('0xb')]('/',auth[_0xf34e('0x7')](),controller[_0xf34e('0xc')]);router[_0xf34e('0xd')](_0xf34e('0x9'),auth[_0xf34e('0x7')](),controller[_0xf34e('0xe')]);router[_0xf34e('0xf')](_0xf34e('0x9'),auth[_0xf34e('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x653a=['../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/auth/service'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0x653a,0x67));var _0xa653=function(_0x3b6f7e,_0x2c6e88){_0x3b6f7e=_0x3b6f7e-0x0;var _0xa6608=_0x653a[_0x3b6f7e];return _0xa6608;};'use strict';var multer=require(_0xa653('0x0'));var util=require(_0xa653('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa653('0x2'));var router=express['Router']();var fs_extra=require(_0xa653('0x3'));var auth=require(_0xa653('0x4'));var interaction=require(_0xa653('0x5'));var config=require('../../config/environment');var controller=require(_0xa653('0x6'));router[_0xa653('0x7')]('/',auth[_0xa653('0x8')](),controller[_0xa653('0x9')]);router[_0xa653('0x7')]('/:id',auth[_0xa653('0x8')](),controller['show']);router[_0xa653('0xa')]('/',auth[_0xa653('0x8')](),controller[_0xa653('0xb')]);router[_0xa653('0xc')](_0xa653('0xd'),auth[_0xa653('0x8')](),controller[_0xa653('0xe')]);router[_0xa653('0xf')](_0xa653('0xd'),auth[_0xa653('0x8')](),controller[_0xa653('0x10')]);module[_0xa653('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 0ba3896..5c93b17 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 _0xbb67=['ENUM','customVariable','picklist','string','STRING','variable','BOOLEAN','sequelize','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xbb67,0x181));var _0x7bb6=function(_0x3ca104,_0x23eda6){_0x3ca104=_0x3ca104-0x0;var _0xfe2db3=_0xbb67[_0x3ca104];return _0xfe2db3;};'use strict';var Sequelize=require(_0x7bb6('0x0'));module[_0x7bb6('0x1')]={'type':{'type':Sequelize[_0x7bb6('0x2')]('string','variable',_0x7bb6('0x3'),'keyValue',_0x7bb6('0x4')),'defaultValue':_0x7bb6('0x5')},'content':{'type':Sequelize[_0x7bb6('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x7bb6('0x2')](_0x7bb6('0x5'),_0x7bb6('0x7'),_0x7bb6('0x3'))},'keyContent':{'type':Sequelize[_0x7bb6('0x6')]},'idField':{'type':Sequelize[_0x7bb6('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x7bb6('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7bb6('0x6')]}}; \ No newline at end of file +var _0x4324=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0xf9a6cf,_0x11870e){var _0x59e2bc=function(_0x1cd606){while(--_0x1cd606){_0xf9a6cf['push'](_0xf9a6cf['shift']());}};_0x59e2bc(++_0x11870e);}(_0x4324,0x198));var _0x4432=function(_0x5d4f12,_0x11e67c){_0x5d4f12=_0x5d4f12-0x0;var _0x4eb577=_0x4324[_0x5d4f12];return _0x4eb577;};'use strict';var Sequelize=require(_0x4432('0x0'));module[_0x4432('0x1')]={'type':{'type':Sequelize[_0x4432('0x2')](_0x4432('0x3'),_0x4432('0x4'),_0x4432('0x5'),_0x4432('0x6'),_0x4432('0x7')),'defaultValue':_0x4432('0x3')},'content':{'type':Sequelize[_0x4432('0x8')]},'key':{'type':Sequelize[_0x4432('0x8')]},'keyType':{'type':Sequelize[_0x4432('0x2')](_0x4432('0x3'),_0x4432('0x4'),_0x4432('0x5'))},'keyContent':{'type':Sequelize[_0x4432('0x8')]},'idField':{'type':Sequelize[_0x4432('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x4432('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4432('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 713313a..4e65ccb 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 _0x57b7=['findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','offset','limit','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','SugarcrmField','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x57b7,0x9e));var _0x757b=function(_0x2ad11d,_0x5a63eb){_0x2ad11d=_0x2ad11d-0x0;var _0x37141f=_0x57b7[_0x2ad11d];return _0x37141f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x757b('0x0'));var jsonpatch=require(_0x757b('0x1'));var rp=require(_0x757b('0x2'));var moment=require(_0x757b('0x3'));var BPromise=require(_0x757b('0x4'));var Mustache=require(_0x757b('0x5'));var util=require(_0x757b('0x6'));var path=require(_0x757b('0x7'));var sox=require(_0x757b('0x8'));var csv=require(_0x757b('0x9'));var ejs=require(_0x757b('0xa'));var fs=require('fs');var fs_extra=require(_0x757b('0xb'));var _=require(_0x757b('0xc'));var squel=require(_0x757b('0xd'));var crypto=require('crypto');var jsforce=require(_0x757b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x757b('0x9'));var querystring=require('querystring');var Papa=require(_0x757b('0xf'));var Redis=require(_0x757b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x757b('0x11'));var as=require(_0x757b('0x12'));var hardwareService=require(_0x757b('0x13'));var logger=require('../../config/logger')(_0x757b('0x14'));var utils=require(_0x757b('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x757b('0x16'))['db'];function respondWithStatusCode(_0x3da24e,_0x24c8ef){_0x24c8ef=_0x24c8ef||0xcc;return function(_0x315182){if(_0x315182){return _0x3da24e['sendStatus'](_0x24c8ef);}return _0x3da24e[_0x757b('0x17')](_0x24c8ef)[_0x757b('0x18')]();};}function respondWithResult(_0x29f9c5,_0x373984){_0x373984=_0x373984||0xc8;return function(_0x1c92c7){if(_0x1c92c7){return _0x29f9c5[_0x757b('0x17')](_0x373984)['json'](_0x1c92c7);}};}function respondWithFilteredResult(_0x30f987,_0x4da447){return function(_0x579139){if(_0x579139){var _0x1ef57f=typeof _0x4da447[_0x757b('0x19')]==='undefined'&&typeof _0x4da447[_0x757b('0x1a')]===_0x757b('0x1b');var _0x31e7c8=_0x579139[_0x757b('0x1c')];var _0x9c8e18=_0x1ef57f?0x0:_0x4da447['offset'];var _0x425a44=_0x1ef57f?_0x579139[_0x757b('0x1c')]:_0x4da447[_0x757b('0x19')]+_0x4da447[_0x757b('0x1a')];var _0x466dac;if(_0x425a44>=_0x31e7c8){_0x425a44=_0x31e7c8;_0x466dac=0xc8;}else{_0x466dac=0xce;}_0x30f987[_0x757b('0x17')](_0x466dac);return _0x30f987['set'](_0x757b('0x1d'),_0x9c8e18+'-'+_0x425a44+'/'+_0x31e7c8)[_0x757b('0x1e')](_0x579139);}return null;};}function patchUpdates(_0x423e38){return function(_0x34ce43){try{jsonpatch[_0x757b('0x1f')](_0x34ce43,_0x423e38,!![]);}catch(_0x18ddcd){return BPromise[_0x757b('0x20')](_0x18ddcd);}return _0x34ce43[_0x757b('0x21')]();};}function saveUpdates(_0x2733e3,_0x1ccc09){return function(_0x567767){if(_0x567767){return _0x567767[_0x757b('0x22')](_0x2733e3)[_0x757b('0x23')](function(_0x551cee){return _0x551cee;});}return null;};}function removeEntity(_0xa6f20e,_0x28a933){return function(_0x1387c3){if(_0x1387c3){return _0x1387c3[_0x757b('0x24')]()[_0x757b('0x23')](function(){_0xa6f20e[_0x757b('0x17')](0xcc)[_0x757b('0x18')]();});}};}function handleEntityNotFound(_0x54c152,_0x12f338){return function(_0x1c67ed){if(!_0x1c67ed){_0x54c152[_0x757b('0x25')](0x194);}return _0x1c67ed;};}function handleError(_0x3d092f,_0x2600c4){_0x2600c4=_0x2600c4||0x1f4;return function(_0xbc7d10){logger[_0x757b('0x26')](_0xbc7d10[_0x757b('0x27')]);if(_0xbc7d10['name']){delete _0xbc7d10[_0x757b('0x28')];}_0x3d092f[_0x757b('0x17')](_0x2600c4)['send'](_0xbc7d10);};}exports[_0x757b('0x29')]=function(_0x12c243,_0xe44c63){var _0x2e56a0={},_0x32f68a={},_0x4f178c={'count':0x0,'rows':[]};var _0x253737=_[_0x757b('0x2a')](db[_0x757b('0x2b')]['rawAttributes'],function(_0xf447e){return{'name':_0xf447e[_0x757b('0x2c')],'type':_0xf447e[_0x757b('0x2d')][_0x757b('0x2e')]};});_0x32f68a[_0x757b('0x2f')]=_['map'](_0x253737,'name');_0x32f68a[_0x757b('0x30')]=_['keys'](_0x12c243[_0x757b('0x30')]);_0x32f68a[_0x757b('0x31')]=_[_0x757b('0x32')](_0x32f68a[_0x757b('0x2f')],_0x32f68a[_0x757b('0x30')]);_0x2e56a0[_0x757b('0x33')]=_[_0x757b('0x32')](_0x32f68a['model'],qs['fields'](_0x12c243[_0x757b('0x30')][_0x757b('0x34')]));_0x2e56a0[_0x757b('0x33')]=_0x2e56a0[_0x757b('0x33')][_0x757b('0x35')]?_0x2e56a0[_0x757b('0x33')]:_0x32f68a[_0x757b('0x2f')];if(!_0x12c243[_0x757b('0x30')][_0x757b('0x36')]('nolimit')){_0x2e56a0[_0x757b('0x1a')]=qs[_0x757b('0x1a')](_0x12c243[_0x757b('0x30')]['limit']);_0x2e56a0[_0x757b('0x19')]=qs[_0x757b('0x19')](_0x12c243[_0x757b('0x30')][_0x757b('0x19')]);}_0x2e56a0[_0x757b('0x37')]=qs['sort'](_0x12c243[_0x757b('0x30')][_0x757b('0x38')]);_0x2e56a0[_0x757b('0x39')]=qs[_0x757b('0x31')](_[_0x757b('0x3a')](_0x12c243[_0x757b('0x30')],_0x32f68a[_0x757b('0x31')]),_0x253737);if(_0x12c243['query'][_0x757b('0x3b')]){_0x2e56a0[_0x757b('0x39')]=_[_0x757b('0x3c')](_0x2e56a0['where'],{'$or':_[_0x757b('0x2a')](_0x253737,function(_0x1cd0a3){if(_0x1cd0a3['type']!==_0x757b('0x3d')){var _0x968593={};_0x968593[_0x1cd0a3[_0x757b('0x28')]]={'$like':'%'+_0x12c243[_0x757b('0x30')][_0x757b('0x3b')]+'%'};return _0x968593;}})});}_0x2e56a0=_[_0x757b('0x3c')]({},_0x2e56a0,_0x12c243[_0x757b('0x3e')]);var _0x4207e1={'where':_0x2e56a0[_0x757b('0x39')]};return db[_0x757b('0x2b')][_0x757b('0x1c')](_0x4207e1)[_0x757b('0x23')](function(_0x674b47){_0x4f178c[_0x757b('0x1c')]=_0x674b47;if(_0x12c243['query'][_0x757b('0x3f')]){_0x2e56a0['include']=[{'all':!![]}];}return db['SugarcrmField'][_0x757b('0x40')](_0x2e56a0);})[_0x757b('0x23')](function(_0x125262){_0x4f178c[_0x757b('0x41')]=_0x125262;return _0x4f178c;})[_0x757b('0x23')](respondWithFilteredResult(_0xe44c63,_0x2e56a0))[_0x757b('0x42')](handleError(_0xe44c63,null));};exports[_0x757b('0x43')]=function(_0x23be4d,_0x41504c){var _0x576291={'raw':!![],'where':{'id':_0x23be4d[_0x757b('0x44')]['id']}},_0x1b8b58={};_0x1b8b58[_0x757b('0x2f')]=_[_0x757b('0x45')](db[_0x757b('0x2b')][_0x757b('0x46')]);_0x1b8b58[_0x757b('0x30')]=_[_0x757b('0x45')](_0x23be4d[_0x757b('0x30')]);_0x1b8b58['filters']=_[_0x757b('0x32')](_0x1b8b58[_0x757b('0x2f')],_0x1b8b58[_0x757b('0x30')]);_0x576291['attributes']=_[_0x757b('0x32')](_0x1b8b58[_0x757b('0x2f')],qs[_0x757b('0x34')](_0x23be4d['query'][_0x757b('0x34')]));_0x576291[_0x757b('0x33')]=_0x576291[_0x757b('0x33')][_0x757b('0x35')]?_0x576291[_0x757b('0x33')]:_0x1b8b58[_0x757b('0x2f')];if(_0x23be4d[_0x757b('0x30')][_0x757b('0x3f')]){_0x576291['include']=[{'all':!![]}];}_0x576291=_[_0x757b('0x3c')]({},_0x576291,_0x23be4d[_0x757b('0x3e')]);return db['SugarcrmField'][_0x757b('0x47')](_0x576291)[_0x757b('0x23')](handleEntityNotFound(_0x41504c,null))[_0x757b('0x23')](respondWithResult(_0x41504c,null))[_0x757b('0x42')](handleError(_0x41504c,null));};exports[_0x757b('0x48')]=function(_0x5863ca,_0x2d9758){return db['SugarcrmField'][_0x757b('0x48')](_0x5863ca['body'],{})['then'](respondWithResult(_0x2d9758,0xc9))[_0x757b('0x42')](handleError(_0x2d9758,null));};exports['update']=function(_0x4f5e3a,_0x15b4df){if(_0x4f5e3a['body']['id']){delete _0x4f5e3a[_0x757b('0x49')]['id'];}return db[_0x757b('0x2b')]['find']({'where':{'id':_0x4f5e3a[_0x757b('0x44')]['id']}})[_0x757b('0x23')](handleEntityNotFound(_0x15b4df,null))[_0x757b('0x23')](saveUpdates(_0x4f5e3a[_0x757b('0x49')],null))[_0x757b('0x23')](respondWithResult(_0x15b4df,null))[_0x757b('0x42')](handleError(_0x15b4df,null));};exports[_0x757b('0x24')]=function(_0x235124,_0x18a8f8){return db[_0x757b('0x2b')][_0x757b('0x47')]({'where':{'id':_0x235124[_0x757b('0x44')]['id']}})[_0x757b('0x23')](handleEntityNotFound(_0x18a8f8,null))[_0x757b('0x23')](removeEntity(_0x18a8f8,null))[_0x757b('0x42')](handleError(_0x18a8f8,null));}; \ No newline at end of file +var _0x3738=['find','create','body','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','name','send','index','map','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','SugarcrmField','include','findAll','rows','catch','show','params','filters','length'];(function(_0x1443d5,_0x21f839){var _0x3f8e34=function(_0x5e1263){while(--_0x5e1263){_0x1443d5['push'](_0x1443d5['shift']());}};_0x3f8e34(++_0x21f839);}(_0x3738,0xdb));var _0x8373=function(_0xee18e4,_0x1835eb){_0xee18e4=_0xee18e4-0x0;var _0x5993a8=_0x3738[_0xee18e4];return _0x5993a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8373('0x0'));var zipdir=require(_0x8373('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8373('0x2'));var moment=require('moment');var BPromise=require(_0x8373('0x3'));var Mustache=require(_0x8373('0x4'));var util=require('util');var path=require(_0x8373('0x5'));var sox=require(_0x8373('0x6'));var csv=require('to-csv');var ejs=require(_0x8373('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8373('0x8'));var squel=require(_0x8373('0x9'));var crypto=require(_0x8373('0xa'));var jsforce=require(_0x8373('0xb'));var deskjs=require(_0x8373('0xc'));var toCsv=require(_0x8373('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8373('0xe'));var authService=require(_0x8373('0xf'));var qs=require(_0x8373('0x10'));var as=require(_0x8373('0x11'));var hardwareService=require(_0x8373('0x12'));var logger=require(_0x8373('0x13'))(_0x8373('0x14'));var utils=require(_0x8373('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8373('0x16'));var db=require(_0x8373('0x17'))['db'];function respondWithStatusCode(_0x2bcb0a,_0x5def00){_0x5def00=_0x5def00||0xcc;return function(_0x4ce38f){if(_0x4ce38f){return _0x2bcb0a[_0x8373('0x18')](_0x5def00);}return _0x2bcb0a[_0x8373('0x19')](_0x5def00)[_0x8373('0x1a')]();};}function respondWithResult(_0x1693c3,_0x1cc7d9){_0x1cc7d9=_0x1cc7d9||0xc8;return function(_0x27262f){if(_0x27262f){return _0x1693c3[_0x8373('0x19')](_0x1cc7d9)[_0x8373('0x1b')](_0x27262f);}};}function respondWithFilteredResult(_0x17cc07,_0x4c033b){return function(_0x39ceb0){if(_0x39ceb0){var _0x582121=typeof _0x4c033b[_0x8373('0x1c')]==='undefined'&&typeof _0x4c033b[_0x8373('0x1d')]===_0x8373('0x1e');var _0x3c562e=_0x39ceb0[_0x8373('0x1f')];var _0xbc9362=_0x582121?0x0:_0x4c033b[_0x8373('0x1c')];var _0x4e237e=_0x582121?_0x39ceb0['count']:_0x4c033b[_0x8373('0x1c')]+_0x4c033b[_0x8373('0x1d')];var _0x39117f;if(_0x4e237e>=_0x3c562e){_0x4e237e=_0x3c562e;_0x39117f=0xc8;}else{_0x39117f=0xce;}_0x17cc07[_0x8373('0x19')](_0x39117f);return _0x17cc07[_0x8373('0x20')](_0x8373('0x21'),_0xbc9362+'-'+_0x4e237e+'/'+_0x3c562e)[_0x8373('0x1b')](_0x39ceb0);}return null;};}function patchUpdates(_0x4c8b92){return function(_0x51bc8d){try{jsonpatch[_0x8373('0x22')](_0x51bc8d,_0x4c8b92,!![]);}catch(_0x2141c6){return BPromise[_0x8373('0x23')](_0x2141c6);}return _0x51bc8d['save']();};}function saveUpdates(_0x25f625,_0x1e8d87){return function(_0x34d5ac){if(_0x34d5ac){return _0x34d5ac[_0x8373('0x24')](_0x25f625)[_0x8373('0x25')](function(_0x5b966a){return _0x5b966a;});}return null;};}function removeEntity(_0x40319d,_0x407b15){return function(_0x142128){if(_0x142128){return _0x142128[_0x8373('0x26')]()[_0x8373('0x25')](function(){_0x40319d[_0x8373('0x19')](0xcc)[_0x8373('0x1a')]();});}};}function handleEntityNotFound(_0x3389de,_0x34641a){return function(_0x34f4cf){if(!_0x34f4cf){_0x3389de[_0x8373('0x18')](0x194);}return _0x34f4cf;};}function handleError(_0x2d63cd,_0x5f0e09){_0x5f0e09=_0x5f0e09||0x1f4;return function(_0x4acc4d){logger['error'](_0x4acc4d['stack']);if(_0x4acc4d[_0x8373('0x27')]){delete _0x4acc4d[_0x8373('0x27')];}_0x2d63cd[_0x8373('0x19')](_0x5f0e09)[_0x8373('0x28')](_0x4acc4d);};}exports[_0x8373('0x29')]=function(_0x4771c0,_0x1c6fab){var _0x28e0ae={},_0x5553cf={},_0xf135ce={'count':0x0,'rows':[]};var _0x4f2b9c=_[_0x8373('0x2a')](db['SugarcrmField'][_0x8373('0x2b')],function(_0x32b083){return{'name':_0x32b083[_0x8373('0x2c')],'type':_0x32b083[_0x8373('0x2d')]['key']};});_0x5553cf['model']=_[_0x8373('0x2a')](_0x4f2b9c,'name');_0x5553cf[_0x8373('0x2e')]=_[_0x8373('0x2f')](_0x4771c0[_0x8373('0x2e')]);_0x5553cf['filters']=_[_0x8373('0x30')](_0x5553cf[_0x8373('0x31')],_0x5553cf[_0x8373('0x2e')]);_0x28e0ae[_0x8373('0x32')]=_['intersection'](_0x5553cf[_0x8373('0x31')],qs[_0x8373('0x33')](_0x4771c0['query'][_0x8373('0x33')]));_0x28e0ae[_0x8373('0x32')]=_0x28e0ae[_0x8373('0x32')]['length']?_0x28e0ae['attributes']:_0x5553cf['model'];if(!_0x4771c0[_0x8373('0x2e')][_0x8373('0x34')]('nolimit')){_0x28e0ae['limit']=qs['limit'](_0x4771c0['query'][_0x8373('0x1d')]);_0x28e0ae['offset']=qs[_0x8373('0x1c')](_0x4771c0[_0x8373('0x2e')]['offset']);}_0x28e0ae[_0x8373('0x35')]=qs['sort'](_0x4771c0[_0x8373('0x2e')][_0x8373('0x36')]);_0x28e0ae[_0x8373('0x37')]=qs['filters'](_[_0x8373('0x38')](_0x4771c0['query'],_0x5553cf['filters']),_0x4f2b9c);if(_0x4771c0[_0x8373('0x2e')][_0x8373('0x39')]){_0x28e0ae[_0x8373('0x37')]=_[_0x8373('0x3a')](_0x28e0ae['where'],{'$or':_[_0x8373('0x2a')](_0x4f2b9c,function(_0x5e3955){if(_0x5e3955[_0x8373('0x2d')]!=='VIRTUAL'){var _0x520f50={};_0x520f50[_0x5e3955['name']]={'$like':'%'+_0x4771c0[_0x8373('0x2e')][_0x8373('0x39')]+'%'};return _0x520f50;}})});}_0x28e0ae=_[_0x8373('0x3a')]({},_0x28e0ae,_0x4771c0[_0x8373('0x3b')]);var _0x354b2e={'where':_0x28e0ae['where']};return db[_0x8373('0x3c')][_0x8373('0x1f')](_0x354b2e)[_0x8373('0x25')](function(_0xf371a2){_0xf135ce[_0x8373('0x1f')]=_0xf371a2;if(_0x4771c0[_0x8373('0x2e')]['includeAll']){_0x28e0ae[_0x8373('0x3d')]=[{'all':!![]}];}return db[_0x8373('0x3c')][_0x8373('0x3e')](_0x28e0ae);})['then'](function(_0x337da8){_0xf135ce[_0x8373('0x3f')]=_0x337da8;return _0xf135ce;})[_0x8373('0x25')](respondWithFilteredResult(_0x1c6fab,_0x28e0ae))[_0x8373('0x40')](handleError(_0x1c6fab,null));};exports[_0x8373('0x41')]=function(_0x1cb4aa,_0x2188b3){var _0x339417={'raw':!![],'where':{'id':_0x1cb4aa[_0x8373('0x42')]['id']}},_0x3599c4={};_0x3599c4[_0x8373('0x31')]=_[_0x8373('0x2f')](db[_0x8373('0x3c')][_0x8373('0x2b')]);_0x3599c4[_0x8373('0x2e')]=_[_0x8373('0x2f')](_0x1cb4aa[_0x8373('0x2e')]);_0x3599c4[_0x8373('0x43')]=_[_0x8373('0x30')](_0x3599c4['model'],_0x3599c4[_0x8373('0x2e')]);_0x339417[_0x8373('0x32')]=_['intersection'](_0x3599c4[_0x8373('0x31')],qs[_0x8373('0x33')](_0x1cb4aa[_0x8373('0x2e')]['fields']));_0x339417[_0x8373('0x32')]=_0x339417[_0x8373('0x32')][_0x8373('0x44')]?_0x339417[_0x8373('0x32')]:_0x3599c4[_0x8373('0x31')];if(_0x1cb4aa[_0x8373('0x2e')]['includeAll']){_0x339417[_0x8373('0x3d')]=[{'all':!![]}];}_0x339417=_[_0x8373('0x3a')]({},_0x339417,_0x1cb4aa[_0x8373('0x3b')]);return db['SugarcrmField'][_0x8373('0x45')](_0x339417)[_0x8373('0x25')](handleEntityNotFound(_0x2188b3,null))[_0x8373('0x25')](respondWithResult(_0x2188b3,null))[_0x8373('0x40')](handleError(_0x2188b3,null));};exports[_0x8373('0x46')]=function(_0x29a8b6,_0x46ab37){return db[_0x8373('0x3c')][_0x8373('0x46')](_0x29a8b6['body'],{})[_0x8373('0x25')](respondWithResult(_0x46ab37,0xc9))[_0x8373('0x40')](handleError(_0x46ab37,null));};exports[_0x8373('0x24')]=function(_0x2996ac,_0x463fed){if(_0x2996ac[_0x8373('0x47')]['id']){delete _0x2996ac[_0x8373('0x47')]['id'];}return db['SugarcrmField'][_0x8373('0x45')]({'where':{'id':_0x2996ac[_0x8373('0x42')]['id']}})[_0x8373('0x25')](handleEntityNotFound(_0x463fed,null))[_0x8373('0x25')](saveUpdates(_0x2996ac[_0x8373('0x47')],null))['then'](respondWithResult(_0x463fed,null))[_0x8373('0x40')](handleError(_0x463fed,null));};exports[_0x8373('0x26')]=function(_0x2f2c78,_0x55e4b0){return db[_0x8373('0x3c')][_0x8373('0x45')]({'where':{'id':_0x2f2c78[_0x8373('0x42')]['id']}})[_0x8373('0x25')](handleEntityNotFound(_0x55e4b0,null))['then'](removeEntity(_0x55e4b0,null))['catch'](handleError(_0x55e4b0,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 92c58fc..ee7f2ab 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 _0x9284=['rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5d7c9f,_0x3fa808){var _0x22f332=function(_0x8b0aeb){while(--_0x8b0aeb){_0x5d7c9f['push'](_0x5d7c9f['shift']());}};_0x22f332(++_0x3fa808);}(_0x9284,0x169));var _0x4928=function(_0x2deb66,_0xa97e73){_0x2deb66=_0x2deb66-0x0;var _0x441599=_0x9284[_0x2deb66];return _0x441599;};'use strict';var _=require(_0x4928('0x0'));var util=require(_0x4928('0x1'));var logger=require(_0x4928('0x2'))(_0x4928('0x3'));var moment=require('moment');var BPromise=require(_0x4928('0x4'));var rp=require(_0x4928('0x5'));var fs=require('fs');var path=require(_0x4928('0x6'));var rimraf=require(_0x4928('0x7'));var config=require(_0x4928('0x8'));var attributes=require(_0x4928('0x9'));module[_0x4928('0xa')]=function(_0x597e3e,_0x4c654e){return _0x597e3e[_0x4928('0xb')](_0x4928('0xc'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x4928('0xd'),'fields':[_0x4928('0xe'),_0x4928('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd866=['request-promise','path','../../config/environment','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','lodash','util','../../config/logger','bluebird'];(function(_0x237c45,_0x55cf99){var _0x2942f6=function(_0x45a615){while(--_0x45a615){_0x237c45['push'](_0x237c45['shift']());}};_0x2942f6(++_0x55cf99);}(_0xd866,0x71));var _0x6d86=function(_0x6266e6,_0x1cfc62){_0x6266e6=_0x6266e6-0x0;var _0xa813d3=_0xd866[_0x6266e6];return _0xa813d3;};'use strict';var _=require(_0x6d86('0x0'));var util=require(_0x6d86('0x1'));var logger=require(_0x6d86('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6d86('0x3'));var rp=require(_0x6d86('0x4'));var fs=require('fs');var path=require(_0x6d86('0x5'));var rimraf=require('rimraf');var config=require(_0x6d86('0x6'));var attributes=require('./intSugarcrmField.attributes');module[_0x6d86('0x7')]=function(_0x363d54,_0x1b18b7){return _0x363d54[_0x6d86('0x8')](_0x6d86('0x9'),attributes,{'tableName':_0x6d86('0xa'),'paranoid':![],'indexes':[{'name':_0x6d86('0xb'),'fields':['idField',_0x6d86('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 0006502..a0d5eb4 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 _0x47f8=['SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x367816,_0x35633c){var _0x2cdde2=function(_0x153253){while(--_0x153253){_0x367816['push'](_0x367816['shift']());}};_0x2cdde2(++_0x35633c);}(_0x47f8,0xef));var _0x847f=function(_0x3d2e68,_0x4f2cd2){_0x3d2e68=_0x3d2e68-0x0;var _0x5c8905=_0x47f8[_0x3d2e68];return _0x5c8905;};'use strict';var _=require(_0x847f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x847f('0x1'));var rs=require(_0x847f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x847f('0x3'));var logger=require(_0x847f('0x4'))(_0x847f('0x5'));var config=require(_0x847f('0x6'));var jayson=require(_0x847f('0x7'));var client=jayson[_0x847f('0x8')][_0x847f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x542c1a,_0x7f6d50,_0x4f6bfa){return new BPromise(function(_0x3228cf,_0x1ddeef){return client[_0x847f('0xa')](_0x542c1a,_0x4f6bfa)[_0x847f('0xb')](function(_0x1cb2cb){logger[_0x847f('0xc')](_0x847f('0xd'),_0x7f6d50,_0x847f('0xe'));logger[_0x847f('0xf')](_0x847f('0x10'),_0x7f6d50,_0x847f('0xe'),JSON[_0x847f('0x11')](_0x1cb2cb));if(_0x1cb2cb['error']){if(_0x1cb2cb['error']['code']===0x1f4){logger[_0x847f('0x12')](_0x847f('0xd'),_0x7f6d50,_0x1cb2cb[_0x847f('0x12')][_0x847f('0x13')]);return _0x1ddeef(_0x1cb2cb[_0x847f('0x12')][_0x847f('0x13')]);}logger[_0x847f('0x12')](_0x847f('0xd'),_0x7f6d50,_0x1cb2cb[_0x847f('0x12')][_0x847f('0x13')]);return _0x3228cf(_0x1cb2cb[_0x847f('0x12')][_0x847f('0x13')]);}else{logger[_0x847f('0xc')](_0x847f('0xd'),_0x7f6d50,_0x847f('0xe'));_0x3228cf(_0x1cb2cb[_0x847f('0x14')][_0x847f('0x13')]);}})['catch'](function(_0x4b10a8){logger['error'](_0x847f('0xd'),_0x7f6d50,_0x4b10a8);_0x1ddeef(_0x4b10a8);});});} \ No newline at end of file +var _0x05c2=['SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent'];(function(_0x5eb3c1,_0x2d0bab){var _0xfafed=function(_0x5ec542){while(--_0x5ec542){_0x5eb3c1['push'](_0x5eb3c1['shift']());}};_0xfafed(++_0x2d0bab);}(_0x05c2,0x191));var _0x205c=function(_0x42ede2,_0x37ed04){_0x42ede2=_0x42ede2-0x0;var _0xb7e04d=_0x05c2[_0x42ede2];return _0xb7e04d;};'use strict';var _=require(_0x205c('0x0'));var util=require(_0x205c('0x1'));var moment=require(_0x205c('0x2'));var BPromise=require(_0x205c('0x3'));var rs=require(_0x205c('0x4'));var fs=require('fs');var Redis=require(_0x205c('0x5'));var db=require(_0x205c('0x6'))['db'];var utils=require(_0x205c('0x7'));var logger=require(_0x205c('0x8'))(_0x205c('0x9'));var config=require(_0x205c('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x205c('0xb')][_0x205c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x46da36,_0x5a6de9,_0x1567d3){return new BPromise(function(_0x100d2c,_0x5779c8){return client['request'](_0x46da36,_0x1567d3)[_0x205c('0xd')](function(_0x2d19f1){logger[_0x205c('0xe')](_0x205c('0xf'),_0x5a6de9,_0x205c('0x10'));logger['debug'](_0x205c('0x11'),_0x5a6de9,_0x205c('0x10'),JSON['stringify'](_0x2d19f1));if(_0x2d19f1[_0x205c('0x12')]){if(_0x2d19f1['error'][_0x205c('0x13')]===0x1f4){logger[_0x205c('0x12')](_0x205c('0xf'),_0x5a6de9,_0x2d19f1[_0x205c('0x12')][_0x205c('0x14')]);return _0x5779c8(_0x2d19f1[_0x205c('0x12')][_0x205c('0x14')]);}logger[_0x205c('0x12')](_0x205c('0xf'),_0x5a6de9,_0x2d19f1['error'][_0x205c('0x14')]);return _0x100d2c(_0x2d19f1[_0x205c('0x12')][_0x205c('0x14')]);}else{logger['info'](_0x205c('0xf'),_0x5a6de9,_0x205c('0x10'));_0x100d2c(_0x2d19f1[_0x205c('0x15')]['message']);}})['catch'](function(_0x3f6247){logger[_0x205c('0x12')](_0x205c('0xf'),_0x5a6de9,_0x3f6247);_0x5779c8(_0x3f6247);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 70cb93b..154a038 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 _0xb91a=['post','create','/:id/configurations','addConfiguration','put','update','delete','/:id','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields','getFields'];(function(_0xfe3ced,_0x4b75ee){var _0x39f591=function(_0x4ab355){while(--_0x4ab355){_0xfe3ced['push'](_0xfe3ced['shift']());}};_0x39f591(++_0x4b75ee);}(_0xb91a,0xf4));var _0xab91=function(_0x3e8aae,_0x1c7636){_0x3e8aae=_0x3e8aae-0x0;var _0x4cf8df=_0xb91a[_0x3e8aae];return _0x4cf8df;};'use strict';var multer=require(_0xab91('0x0'));var util=require(_0xab91('0x1'));var path=require(_0xab91('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xab91('0x3')]();var fs_extra=require(_0xab91('0x4'));var auth=require(_0xab91('0x5'));var interaction=require(_0xab91('0x6'));var config=require(_0xab91('0x7'));var controller=require(_0xab91('0x8'));router[_0xab91('0x9')]('/',auth[_0xab91('0xa')](),controller[_0xab91('0xb')]);router[_0xab91('0x9')]('/:id',auth[_0xab91('0xa')](),controller[_0xab91('0xc')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0xab91('0xd')]);router[_0xab91('0x9')](_0xab91('0xe'),auth[_0xab91('0xa')](),controller[_0xab91('0xf')]);router[_0xab91('0x10')]('/',auth[_0xab91('0xa')](),controller[_0xab91('0x11')]);router[_0xab91('0x10')](_0xab91('0x12'),auth[_0xab91('0xa')](),controller[_0xab91('0x13')]);router[_0xab91('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xab91('0x15')]);router[_0xab91('0x16')](_0xab91('0x17'),auth[_0xab91('0xa')](),controller[_0xab91('0x18')]);module[_0xab91('0x19')]=router; \ No newline at end of file +var _0xf555=['addConfiguration','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','/:id/fields','getFields','create'];(function(_0x45ee63,_0xa4a9e3){var _0x162f86=function(_0x464165){while(--_0x464165){_0x45ee63['push'](_0x45ee63['shift']());}};_0x162f86(++_0xa4a9e3);}(_0xf555,0x97));var _0x5f55=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf555[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x5f55('0x0'));var util=require(_0x5f55('0x1'));var path=require('path');var timeout=require(_0x5f55('0x2'));var express=require('express');var router=express[_0x5f55('0x3')]();var fs_extra=require(_0x5f55('0x4'));var auth=require(_0x5f55('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5f55('0x6'));var controller=require(_0x5f55('0x7'));router['get']('/',auth[_0x5f55('0x8')](),controller[_0x5f55('0x9')]);router[_0x5f55('0xa')](_0x5f55('0xb'),auth[_0x5f55('0x8')](),controller[_0x5f55('0xc')]);router[_0x5f55('0xa')](_0x5f55('0xd'),auth[_0x5f55('0x8')](),controller['getConfigurations']);router[_0x5f55('0xa')](_0x5f55('0xe'),auth[_0x5f55('0x8')](),controller[_0x5f55('0xf')]);router['post']('/',auth[_0x5f55('0x8')](),controller[_0x5f55('0x10')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x5f55('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x5f55('0x12')](_0x5f55('0xb'),auth[_0x5f55('0x8')](),controller[_0x5f55('0x13')]);module[_0x5f55('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 2fab131..cb2c007 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 _0xea35=['HelpDesk','sequelize','exports','STRING'];(function(_0x2cb633,_0x5caee0){var _0x4b1a20=function(_0x4ea50f){while(--_0x4ea50f){_0x2cb633['push'](_0x2cb633['shift']());}};_0x4b1a20(++_0x5caee0);}(_0xea35,0xbd));var _0x5ea3=function(_0x194eba,_0x2d3927){_0x194eba=_0x194eba-0x0;var _0x1a2495=_0xea35[_0x194eba];return _0x1a2495;};'use strict';var Sequelize=require(_0x5ea3('0x0'));module[_0x5ea3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x5ea3('0x2')]},'username':{'type':Sequelize[_0x5ea3('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x5ea3('0x2')],'allowNull':![],'defaultValue':_0x5ea3('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x5ea3('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x5ea3('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xef82=['sequelize','STRING','HelpDesk'];(function(_0x201f06,_0x5a80b8){var _0x33b9f1=function(_0x76ba3e){while(--_0x76ba3e){_0x201f06['push'](_0x201f06['shift']());}};_0x33b9f1(++_0x5a80b8);}(_0xef82,0x1c5));var _0x2ef8=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xef82[_0x2112d4];return _0x434972;};'use strict';var Sequelize=require(_0x2ef8('0x0'));module['exports']={'name':{'type':Sequelize[_0x2ef8('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x2ef8('0x1')]},'username':{'type':Sequelize[_0x2ef8('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x2ef8('0x1')],'allowNull':![],'defaultValue':_0x2ef8('0x2')},'remoteUri':{'type':Sequelize[_0x2ef8('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x2ef8('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x2ef8('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 1f573cc..e893ae6 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 _0xbc8f=['apply','save','update','destroy','then','name','send','index','fieldName','type','key','model','map','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VtigerAccount','count','include','findAll','rawAttributes','includeAll','find','catch','create','body','params','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','VtigerField','Subjects','getFields','username','description','moduleName','remoteUri','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','success','POST','login','result','token','describe','sessionName','owner','remove','includes','editable','false','startsWith','cf_','picklist','picklistValues','label','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','fast-json-patch','bluebird','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range'];(function(_0x353445,_0x485d25){var _0x18717b=function(_0x5d77af){while(--_0x5d77af){_0x353445['push'](_0x353445['shift']());}};_0x18717b(++_0x485d25);}(_0xbc8f,0x146));var _0xfbc8=function(_0x340a9e,_0x2ef9a1){_0x340a9e=_0x340a9e-0x0;var _0xd65e2a=_0xbc8f[_0x340a9e];return _0xd65e2a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfbc8('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfbc8('0x1'));var Mustache=require('mustache');var util=require(_0xfbc8('0x2'));var path=require(_0xfbc8('0x3'));var sox=require(_0xfbc8('0x4'));var csv=require(_0xfbc8('0x5'));var ejs=require(_0xfbc8('0x6'));var fs=require('fs');var fs_extra=require(_0xfbc8('0x7'));var _=require(_0xfbc8('0x8'));var squel=require(_0xfbc8('0x9'));var crypto=require('crypto');var jsforce=require(_0xfbc8('0xa'));var deskjs=require(_0xfbc8('0xb'));var toCsv=require(_0xfbc8('0x5'));var querystring=require(_0xfbc8('0xc'));var Papa=require(_0xfbc8('0xd'));var Redis=require(_0xfbc8('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xfbc8('0xf'));var as=require(_0xfbc8('0x10'));var hardwareService=require(_0xfbc8('0x11'));var logger=require(_0xfbc8('0x12'))(_0xfbc8('0x13'));var utils=require(_0xfbc8('0x14'));var config=require(_0xfbc8('0x15'));var licenseUtil=require(_0xfbc8('0x16'));var db=require(_0xfbc8('0x17'))['db'];var integrations=require(_0xfbc8('0x18'));function respondWithStatusCode(_0x5aaebf,_0x5985b8){_0x5985b8=_0x5985b8||0xcc;return function(_0x5812e3){if(_0x5812e3){return _0x5aaebf[_0xfbc8('0x19')](_0x5985b8);}return _0x5aaebf[_0xfbc8('0x1a')](_0x5985b8)[_0xfbc8('0x1b')]();};}function respondWithResult(_0x4700ec,_0x30dc55){_0x30dc55=_0x30dc55||0xc8;return function(_0x442e6b){if(_0x442e6b){return _0x4700ec['status'](_0x30dc55)[_0xfbc8('0x1c')](_0x442e6b);}};}function respondWithFilteredResult(_0x3b59a6,_0x561377){return function(_0x54a652){if(_0x54a652){var _0x11da70=typeof _0x561377[_0xfbc8('0x1d')]===_0xfbc8('0x1e')&&typeof _0x561377[_0xfbc8('0x1f')]===_0xfbc8('0x1e');var _0x812533=_0x54a652['count'];var _0x56b178=_0x11da70?0x0:_0x561377[_0xfbc8('0x1d')];var _0x150834=_0x11da70?_0x54a652['count']:_0x561377[_0xfbc8('0x1d')]+_0x561377[_0xfbc8('0x1f')];var _0x4d7d4d;if(_0x150834>=_0x812533){_0x150834=_0x812533;_0x4d7d4d=0xc8;}else{_0x4d7d4d=0xce;}_0x3b59a6[_0xfbc8('0x1a')](_0x4d7d4d);return _0x3b59a6[_0xfbc8('0x20')](_0xfbc8('0x21'),_0x56b178+'-'+_0x150834+'/'+_0x812533)['json'](_0x54a652);}return null;};}function patchUpdates(_0x17d1a0){return function(_0x44f500){try{jsonpatch[_0xfbc8('0x22')](_0x44f500,_0x17d1a0,!![]);}catch(_0x5621b3){return BPromise['reject'](_0x5621b3);}return _0x44f500[_0xfbc8('0x23')]();};}function saveUpdates(_0x3df9ee,_0x9137b0){return function(_0x3811d4){if(_0x3811d4){return _0x3811d4[_0xfbc8('0x24')](_0x3df9ee)['then'](function(_0x56c16d){return _0x56c16d;});}return null;};}function removeEntity(_0x27ec54,_0x5a855e){return function(_0xd55bd4){if(_0xd55bd4){return _0xd55bd4[_0xfbc8('0x25')]()[_0xfbc8('0x26')](function(){_0x27ec54[_0xfbc8('0x1a')](0xcc)[_0xfbc8('0x1b')]();});}};}function handleEntityNotFound(_0x324e39,_0x12ab46){return function(_0x4e4327){if(!_0x4e4327){_0x324e39['sendStatus'](0x194);}return _0x4e4327;};}function handleError(_0x26e93d,_0x3d7c5f){_0x3d7c5f=_0x3d7c5f||0x1f4;return function(_0x43b6ed){logger['error'](_0x43b6ed['stack']);if(_0x43b6ed['name']){delete _0x43b6ed[_0xfbc8('0x27')];}_0x26e93d[_0xfbc8('0x1a')](_0x3d7c5f)[_0xfbc8('0x28')](_0x43b6ed);};}exports[_0xfbc8('0x29')]=function(_0x5cf056,_0x7ed6d6){var _0x5601df={},_0x553bfb={},_0x18976b={'count':0x0,'rows':[]};var _0x3e8482=_['map'](db['VtigerAccount']['rawAttributes'],function(_0x1b17d7){return{'name':_0x1b17d7[_0xfbc8('0x2a')],'type':_0x1b17d7[_0xfbc8('0x2b')][_0xfbc8('0x2c')]};});_0x553bfb[_0xfbc8('0x2d')]=_[_0xfbc8('0x2e')](_0x3e8482,'name');_0x553bfb['query']=_[_0xfbc8('0x2f')](_0x5cf056[_0xfbc8('0x30')]);_0x553bfb[_0xfbc8('0x31')]=_[_0xfbc8('0x32')](_0x553bfb['model'],_0x553bfb[_0xfbc8('0x30')]);_0x5601df['attributes']=_[_0xfbc8('0x32')](_0x553bfb[_0xfbc8('0x2d')],qs[_0xfbc8('0x33')](_0x5cf056['query'][_0xfbc8('0x33')]));_0x5601df['attributes']=_0x5601df['attributes'][_0xfbc8('0x34')]?_0x5601df[_0xfbc8('0x35')]:_0x553bfb[_0xfbc8('0x2d')];if(!_0x5cf056[_0xfbc8('0x30')][_0xfbc8('0x36')](_0xfbc8('0x37'))){_0x5601df[_0xfbc8('0x1f')]=qs['limit'](_0x5cf056[_0xfbc8('0x30')]['limit']);_0x5601df[_0xfbc8('0x1d')]=qs[_0xfbc8('0x1d')](_0x5cf056['query'][_0xfbc8('0x1d')]);}_0x5601df[_0xfbc8('0x38')]=qs[_0xfbc8('0x39')](_0x5cf056[_0xfbc8('0x30')][_0xfbc8('0x39')]);_0x5601df[_0xfbc8('0x3a')]=qs['filters'](_[_0xfbc8('0x3b')](_0x5cf056[_0xfbc8('0x30')],_0x553bfb[_0xfbc8('0x31')]),_0x3e8482);if(_0x5cf056[_0xfbc8('0x30')][_0xfbc8('0x3c')]){_0x5601df[_0xfbc8('0x3a')]=_[_0xfbc8('0x3d')](_0x5601df['where'],{'$or':_[_0xfbc8('0x2e')](_0x3e8482,function(_0x69c857){if(_0x69c857[_0xfbc8('0x2b')]!==_0xfbc8('0x3e')){var _0x5b3941={};_0x5b3941[_0x69c857[_0xfbc8('0x27')]]={'$like':'%'+_0x5cf056['query'][_0xfbc8('0x3c')]+'%'};return _0x5b3941;}})});}_0x5601df=_['merge']({},_0x5601df,_0x5cf056[_0xfbc8('0x3f')]);var _0x284170={'where':_0x5601df['where']};return db[_0xfbc8('0x40')][_0xfbc8('0x41')](_0x284170)[_0xfbc8('0x26')](function(_0x3a0535){_0x18976b[_0xfbc8('0x41')]=_0x3a0535;if(_0x5cf056[_0xfbc8('0x30')]['includeAll']){_0x5601df[_0xfbc8('0x42')]=[{'all':!![]}];}return db[_0xfbc8('0x40')][_0xfbc8('0x43')](_0x5601df);})[_0xfbc8('0x26')](function(_0x310c4a){_0x18976b['rows']=_0x310c4a;return _0x18976b;})[_0xfbc8('0x26')](respondWithFilteredResult(_0x7ed6d6,_0x5601df))['catch'](handleError(_0x7ed6d6,null));};exports['show']=function(_0x3a4ea8,_0xb2b674){var _0x3aadaf={'raw':![],'where':{'id':_0x3a4ea8['params']['id']}},_0x35751c={};_0x35751c['model']=_[_0xfbc8('0x2f')](db[_0xfbc8('0x40')][_0xfbc8('0x44')]);_0x35751c['query']=_[_0xfbc8('0x2f')](_0x3a4ea8['query']);_0x35751c[_0xfbc8('0x31')]=_[_0xfbc8('0x32')](_0x35751c[_0xfbc8('0x2d')],_0x35751c[_0xfbc8('0x30')]);_0x3aadaf[_0xfbc8('0x35')]=_['intersection'](_0x35751c[_0xfbc8('0x2d')],qs[_0xfbc8('0x33')](_0x3a4ea8[_0xfbc8('0x30')][_0xfbc8('0x33')]));_0x3aadaf[_0xfbc8('0x35')]=_0x3aadaf[_0xfbc8('0x35')]['length']?_0x3aadaf[_0xfbc8('0x35')]:_0x35751c[_0xfbc8('0x2d')];if(_0x3a4ea8['query'][_0xfbc8('0x45')]){_0x3aadaf[_0xfbc8('0x42')]=[{'all':!![]}];}_0x3aadaf=_['merge']({},_0x3aadaf,_0x3a4ea8[_0xfbc8('0x3f')]);return db[_0xfbc8('0x40')][_0xfbc8('0x46')](_0x3aadaf)[_0xfbc8('0x26')](handleEntityNotFound(_0xb2b674,null))[_0xfbc8('0x26')](respondWithResult(_0xb2b674,null))[_0xfbc8('0x47')](handleError(_0xb2b674,null));};exports[_0xfbc8('0x48')]=function(_0x4122c0,_0x5cf2c4){return db['VtigerAccount'][_0xfbc8('0x48')](_0x4122c0[_0xfbc8('0x49')],{})[_0xfbc8('0x26')](respondWithResult(_0x5cf2c4,0xc9))[_0xfbc8('0x47')](handleError(_0x5cf2c4,null));};exports[_0xfbc8('0x24')]=function(_0x9835ff,_0x45482a){if(_0x9835ff[_0xfbc8('0x49')]['id']){delete _0x9835ff[_0xfbc8('0x49')]['id'];}return db['VtigerAccount'][_0xfbc8('0x46')]({'where':{'id':_0x9835ff[_0xfbc8('0x4a')]['id']}})[_0xfbc8('0x26')](handleEntityNotFound(_0x45482a,null))['then'](saveUpdates(_0x9835ff[_0xfbc8('0x49')],null))[_0xfbc8('0x26')](respondWithResult(_0x45482a,null))[_0xfbc8('0x47')](handleError(_0x45482a,null));};exports[_0xfbc8('0x25')]=function(_0x8f47a1,_0xe285f2){return db[_0xfbc8('0x40')][_0xfbc8('0x46')]({'where':{'id':_0x8f47a1[_0xfbc8('0x4a')]['id']}})[_0xfbc8('0x26')](handleEntityNotFound(_0xe285f2,null))[_0xfbc8('0x26')](removeEntity(_0xe285f2,null))[_0xfbc8('0x47')](handleError(_0xe285f2,null));};exports[_0xfbc8('0x4b')]=function(_0x3546c0,_0x23712b,_0x10a6aa){var _0x10f52b={};var _0x124778={};var _0x3ede2c;var _0x4962cb;return db[_0xfbc8('0x40')][_0xfbc8('0x4c')]({'where':{'id':_0x3546c0[_0xfbc8('0x4a')]['id']}})[_0xfbc8('0x26')](handleEntityNotFound(_0x23712b,null))[_0xfbc8('0x26')](function(_0xd8aa75){if(_0xd8aa75){_0x3ede2c=_0xd8aa75;_0x124778['model']=_[_0xfbc8('0x2f')](db[_0xfbc8('0x4d')][_0xfbc8('0x44')]);_0x124778['query']=_[_0xfbc8('0x2f')](_0x3546c0[_0xfbc8('0x30')]);_0x124778[_0xfbc8('0x31')]=_[_0xfbc8('0x32')](_0x124778[_0xfbc8('0x2d')],_0x124778['query']);_0x10f52b[_0xfbc8('0x35')]=_['intersection'](_0x124778[_0xfbc8('0x2d')],qs['fields'](_0x3546c0[_0xfbc8('0x30')][_0xfbc8('0x33')]));_0x10f52b['attributes']=_0x10f52b[_0xfbc8('0x35')][_0xfbc8('0x34')]?_0x10f52b['attributes']:_0x124778[_0xfbc8('0x2d')];_0x10f52b[_0xfbc8('0x38')]=qs[_0xfbc8('0x39')](_0x3546c0[_0xfbc8('0x30')]['sort']);_0x10f52b['where']=qs[_0xfbc8('0x31')](_['pick'](_0x3546c0[_0xfbc8('0x30')],_0x124778[_0xfbc8('0x31')]));if(_0x3546c0[_0xfbc8('0x30')][_0xfbc8('0x3c')]){_0x10f52b[_0xfbc8('0x3a')]=_[_0xfbc8('0x3d')](_0x10f52b['where'],{'$or':_['map'](_0x10f52b[_0xfbc8('0x35')],function(_0x26bd22){var _0x11919b={};_0x11919b[_0x26bd22]={'$like':'%'+_0x3546c0[_0xfbc8('0x30')][_0xfbc8('0x3c')]+'%'};return _0x11919b;})});}_0x10f52b=_[_0xfbc8('0x3d')]({},_0x10f52b,_0x3546c0[_0xfbc8('0x3f')]);return _0x3ede2c[_0xfbc8('0x4b')](_0x10f52b);}})[_0xfbc8('0x26')](function(_0x1b4904){if(_0x1b4904){_0x4962cb=_0x1b4904[_0xfbc8('0x34')];if(!_0x3546c0[_0xfbc8('0x30')][_0xfbc8('0x36')](_0xfbc8('0x37'))){_0x10f52b[_0xfbc8('0x1f')]=qs[_0xfbc8('0x1f')](_0x3546c0[_0xfbc8('0x30')][_0xfbc8('0x1f')]);_0x10f52b['offset']=qs[_0xfbc8('0x1d')](_0x3546c0[_0xfbc8('0x30')][_0xfbc8('0x1d')]);}return _0x3ede2c[_0xfbc8('0x4b')](_0x10f52b);}})[_0xfbc8('0x26')](function(_0xad61b0){if(_0xad61b0){return _0xad61b0?{'count':_0x4962cb,'rows':_0xad61b0}:null;}})[_0xfbc8('0x26')](respondWithResult(_0x23712b,null))['catch'](handleError(_0x23712b,null));};exports[_0xfbc8('0x4e')]=function(_0x1f23e0,_0x212d2e,_0x59d7d1){if(_0x1f23e0[_0xfbc8('0x49')]['id']){delete _0x1f23e0[_0xfbc8('0x49')]['id'];}return db[_0xfbc8('0x40')][_0xfbc8('0x4c')]({'where':{'id':_0x1f23e0[_0xfbc8('0x4a')]['id']}})[_0xfbc8('0x26')](handleEntityNotFound(_0x212d2e,null))['then'](function(_0x3a90f9){if(_0x3a90f9){_0x1f23e0[_0xfbc8('0x49')][_0xfbc8('0x4f')]=_0x3a90f9['id'];_0x1f23e0[_0xfbc8('0x49')]['Subjects']=integrations[_0xfbc8('0x50')](_0x1f23e0[_0xfbc8('0x49')][_0xfbc8('0x51')],_0x1f23e0['body'][_0xfbc8('0x2b')]);_0x1f23e0['body'][_0xfbc8('0x52')]=integrations[_0xfbc8('0x53')](_0x1f23e0[_0xfbc8('0x49')][_0xfbc8('0x51')],_0x1f23e0[_0xfbc8('0x49')][_0xfbc8('0x2b')]);return db[_0xfbc8('0x4d')]['create'](_0x1f23e0[_0xfbc8('0x49')],{'include':[{'model':db[_0xfbc8('0x54')],'as':_0xfbc8('0x55')},{'model':db[_0xfbc8('0x54')],'as':'Descriptions'}]});}return null;})[_0xfbc8('0x26')](respondWithResult(_0x212d2e,null))[_0xfbc8('0x47')](handleError(_0x212d2e,null));};var md5=require('md5');exports[_0xfbc8('0x56')]=function(_0x9d86f7,_0x3c6360,_0x12ddf6){var _0x2c8611=null;var _0x17e706=null;var _0x22c962=null;var _0x35b246=null;var _0x4cd508='';return db[_0xfbc8('0x40')][_0xfbc8('0x4c')]({'where':{'id':_0x9d86f7[_0xfbc8('0x4a')]['id']},'attributes':['id',_0xfbc8('0x27'),_0xfbc8('0x57'),_0xfbc8('0x58'),_0xfbc8('0x59'),_0xfbc8('0x5a'),'serverUrl','accessKey']})[_0xfbc8('0x26')](handleEntityNotFound(_0x3c6360,null))[_0xfbc8('0x26')](function(_0x2cf065){if(_0x2cf065){_0x2c8611=_0x2cf065[_0xfbc8('0x57')];_0x17e706=_0x2cf065[_0xfbc8('0x5b')];_0x22c962=_0x2cf065['moduleName'];_0x4cd508=_0x2cf065['remoteUri'];var _0xa1f06f=_0x4cd508[_0xfbc8('0x5c')](-0x1);if(_0xa1f06f==='/'){_0x4cd508=_0x4cd508[_0xfbc8('0x5d')](0x0,_0x4cd508[_0xfbc8('0x5e')](_0xa1f06f));}_0x35b246=util[_0xfbc8('0x5f')](_0xfbc8('0x60'),_0x4cd508);var _0x510a6c={'method':'GET','uri':_0x35b246,'qs':{'operation':'getchallenge','username':_0x2cf065[_0xfbc8('0x57')]},'json':!![]};return rp(_0x510a6c);}})[_0xfbc8('0x26')](function(_0x1d50a2){if(_0x1d50a2[_0xfbc8('0x61')]){var _0x5be186={'method':_0xfbc8('0x62'),'uri':_0x35b246,'form':{'operation':_0xfbc8('0x63'),'username':_0x2c8611,'accessKey':md5(_0x1d50a2[_0xfbc8('0x64')][_0xfbc8('0x65')]+_0x17e706)},'json':!![]};return rp(_0x5be186);}})['then'](function(_0x5087d5){if(_0x5087d5['success']){var _0x325b39={'method':'GET','uri':_0x35b246,'qs':{'operation':_0xfbc8('0x66'),'username':_0x2c8611,'sessionName':_0x5087d5[_0xfbc8('0x64')][_0xfbc8('0x67')],'elementType':_0x22c962},'json':!![]};return rp(_0x325b39);}})[_0xfbc8('0x26')](function(_0x53a963){if(_0x53a963['success']){var _0x418848=['autogenerated','reference',_0xfbc8('0x68')];_[_0xfbc8('0x69')](_0x53a963[_0xfbc8('0x64')][_0xfbc8('0x33')],function(_0x5b8472){return _0x418848[_0xfbc8('0x6a')](_0x5b8472[_0xfbc8('0x2b')][_0xfbc8('0x27')]);});_[_0xfbc8('0x69')](_0x53a963[_0xfbc8('0x64')][_0xfbc8('0x33')],function(_0x2eb6b4){return _0x2eb6b4[_0xfbc8('0x6b')]===_0xfbc8('0x6c');});return{'count':_0x53a963[_0xfbc8('0x64')][_0xfbc8('0x33')][_0xfbc8('0x34')],'rows':_[_0xfbc8('0x2e')](_0x53a963[_0xfbc8('0x64')]['fields'],function(_0x18e767){return{'id':_0x18e767[_0xfbc8('0x27')],'name':_0x18e767['label'],'custom':_[_0xfbc8('0x6d')](_0x18e767[_0xfbc8('0x27')],_0xfbc8('0x6e'))?!![]:![],'options':_0x18e767[_0xfbc8('0x2b')]['name']===_0xfbc8('0x6f')&&_0x18e767[_0xfbc8('0x2b')]['picklistValues'][_0xfbc8('0x34')]>0x0?_[_0xfbc8('0x2e')](_0x18e767[_0xfbc8('0x2b')][_0xfbc8('0x70')],function(_0x426224){return{'name':_0x426224[_0xfbc8('0x71')],'value':_0x426224['value']};}):[]};})};}})[_0xfbc8('0x26')](respondWithResult(_0x3c6360,null))[_0xfbc8('0x47')](function(_0x3dddf4){console['log'](_0xfbc8('0x72')+_0x3dddf4);var _0x4a6bd2=_0x9d86f7[_0xfbc8('0x30')][_0xfbc8('0x73')]?0x1f4:_0x3dddf4[_0xfbc8('0x74')]||0x1f4;logger['error'](_0xfbc8('0x75'),_0xfbc8('0x56'),_0x4a6bd2,JSON[_0xfbc8('0x76')](_0x3dddf4));delete _0x3dddf4['name'];if(_0x4a6bd2===0x191){_0x4a6bd2=0x190;}_0x3c6360['status'](_0x4a6bd2)['send'](_0x9d86f7[_0xfbc8('0x30')]['test']?{'message':_0xfbc8('0x77'),'statusCode':_0x3dddf4['statusCode']}:_0x3dddf4);});}; \ No newline at end of file +var _0x1f1a=['VtigerField','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','%s/webservice.php','GET','getchallenge','success','login','result','token','describe','sessionName','reference','owner','remove','includes','editable','label','startsWith','cf_','picklist','picklistValues','value','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','destroy','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions'];(function(_0x2d33c7,_0x20e736){var _0x3f5a29=function(_0x41f9fb){while(--_0x41f9fb){_0x2d33c7['push'](_0x2d33c7['shift']());}};_0x3f5a29(++_0x20e736);}(_0x1f1a,0x98));var _0xa1f1=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x1f1a[_0x2a6809];return _0x11c371;};'use strict';var emlformat=require(_0xa1f1('0x0'));var rimraf=require(_0xa1f1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa1f1('0x2'));var moment=require(_0xa1f1('0x3'));var BPromise=require(_0xa1f1('0x4'));var Mustache=require(_0xa1f1('0x5'));var util=require(_0xa1f1('0x6'));var path=require(_0xa1f1('0x7'));var sox=require(_0xa1f1('0x8'));var csv=require('to-csv');var ejs=require(_0xa1f1('0x9'));var fs=require('fs');var fs_extra=require(_0xa1f1('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa1f1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa1f1('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa1f1('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa1f1('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa1f1('0xf'));var logger=require(_0xa1f1('0x10'))(_0xa1f1('0x11'));var utils=require(_0xa1f1('0x12'));var config=require(_0xa1f1('0x13'));var licenseUtil=require(_0xa1f1('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa1f1('0x15'));function respondWithStatusCode(_0x1f6ab3,_0x41b60d){_0x41b60d=_0x41b60d||0xcc;return function(_0x1c0429){if(_0x1c0429){return _0x1f6ab3[_0xa1f1('0x16')](_0x41b60d);}return _0x1f6ab3[_0xa1f1('0x17')](_0x41b60d)[_0xa1f1('0x18')]();};}function respondWithResult(_0x2435ce,_0x4af7d1){_0x4af7d1=_0x4af7d1||0xc8;return function(_0x238a53){if(_0x238a53){return _0x2435ce[_0xa1f1('0x17')](_0x4af7d1)[_0xa1f1('0x19')](_0x238a53);}};}function respondWithFilteredResult(_0x3e51c3,_0x3acf54){return function(_0x409f8b){if(_0x409f8b){var _0x5c7e1e=typeof _0x3acf54[_0xa1f1('0x1a')]===_0xa1f1('0x1b')&&typeof _0x3acf54[_0xa1f1('0x1c')]==='undefined';var _0x295bd8=_0x409f8b['count'];var _0x587037=_0x5c7e1e?0x0:_0x3acf54[_0xa1f1('0x1a')];var _0x4ab080=_0x5c7e1e?_0x409f8b[_0xa1f1('0x1d')]:_0x3acf54[_0xa1f1('0x1a')]+_0x3acf54[_0xa1f1('0x1c')];var _0x42255c;if(_0x4ab080>=_0x295bd8){_0x4ab080=_0x295bd8;_0x42255c=0xc8;}else{_0x42255c=0xce;}_0x3e51c3[_0xa1f1('0x17')](_0x42255c);return _0x3e51c3[_0xa1f1('0x1e')](_0xa1f1('0x1f'),_0x587037+'-'+_0x4ab080+'/'+_0x295bd8)['json'](_0x409f8b);}return null;};}function patchUpdates(_0x4c3db1){return function(_0x556025){try{jsonpatch[_0xa1f1('0x20')](_0x556025,_0x4c3db1,!![]);}catch(_0x41689b){return BPromise[_0xa1f1('0x21')](_0x41689b);}return _0x556025[_0xa1f1('0x22')]();};}function saveUpdates(_0x25a031,_0x1960f1){return function(_0xb827b7){if(_0xb827b7){return _0xb827b7[_0xa1f1('0x23')](_0x25a031)[_0xa1f1('0x24')](function(_0x55f45f){return _0x55f45f;});}return null;};}function removeEntity(_0x2ffbc5,_0x1478a3){return function(_0x18a7b4){if(_0x18a7b4){return _0x18a7b4['destroy']()[_0xa1f1('0x24')](function(){_0x2ffbc5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b6a5f,_0x5b279c){return function(_0xeebbdb){if(!_0xeebbdb){_0x4b6a5f[_0xa1f1('0x16')](0x194);}return _0xeebbdb;};}function handleError(_0x1f51b5,_0x3227cc){_0x3227cc=_0x3227cc||0x1f4;return function(_0x385ac6){logger['error'](_0x385ac6['stack']);if(_0x385ac6[_0xa1f1('0x25')]){delete _0x385ac6[_0xa1f1('0x25')];}_0x1f51b5[_0xa1f1('0x17')](_0x3227cc)[_0xa1f1('0x26')](_0x385ac6);};}exports[_0xa1f1('0x27')]=function(_0x16ab74,_0x266719){var _0x39e56f={},_0x55b9f8={},_0xa89f0d={'count':0x0,'rows':[]};var _0x155cea=_[_0xa1f1('0x28')](db[_0xa1f1('0x29')][_0xa1f1('0x2a')],function(_0x5d543d){return{'name':_0x5d543d[_0xa1f1('0x2b')],'type':_0x5d543d[_0xa1f1('0x2c')]['key']};});_0x55b9f8[_0xa1f1('0x2d')]=_['map'](_0x155cea,_0xa1f1('0x25'));_0x55b9f8[_0xa1f1('0x2e')]=_[_0xa1f1('0x2f')](_0x16ab74[_0xa1f1('0x2e')]);_0x55b9f8[_0xa1f1('0x30')]=_[_0xa1f1('0x31')](_0x55b9f8[_0xa1f1('0x2d')],_0x55b9f8[_0xa1f1('0x2e')]);_0x39e56f[_0xa1f1('0x32')]=_[_0xa1f1('0x31')](_0x55b9f8[_0xa1f1('0x2d')],qs[_0xa1f1('0x33')](_0x16ab74[_0xa1f1('0x2e')][_0xa1f1('0x33')]));_0x39e56f[_0xa1f1('0x32')]=_0x39e56f['attributes'][_0xa1f1('0x34')]?_0x39e56f['attributes']:_0x55b9f8[_0xa1f1('0x2d')];if(!_0x16ab74['query'][_0xa1f1('0x35')](_0xa1f1('0x36'))){_0x39e56f[_0xa1f1('0x1c')]=qs[_0xa1f1('0x1c')](_0x16ab74[_0xa1f1('0x2e')]['limit']);_0x39e56f['offset']=qs[_0xa1f1('0x1a')](_0x16ab74[_0xa1f1('0x2e')][_0xa1f1('0x1a')]);}_0x39e56f[_0xa1f1('0x37')]=qs[_0xa1f1('0x38')](_0x16ab74['query'][_0xa1f1('0x38')]);_0x39e56f['where']=qs['filters'](_[_0xa1f1('0x39')](_0x16ab74['query'],_0x55b9f8[_0xa1f1('0x30')]),_0x155cea);if(_0x16ab74[_0xa1f1('0x2e')][_0xa1f1('0x3a')]){_0x39e56f[_0xa1f1('0x3b')]=_[_0xa1f1('0x3c')](_0x39e56f[_0xa1f1('0x3b')],{'$or':_[_0xa1f1('0x28')](_0x155cea,function(_0x4f4aaf){if(_0x4f4aaf['type']!==_0xa1f1('0x3d')){var _0x150911={};_0x150911[_0x4f4aaf[_0xa1f1('0x25')]]={'$like':'%'+_0x16ab74[_0xa1f1('0x2e')][_0xa1f1('0x3a')]+'%'};return _0x150911;}})});}_0x39e56f=_[_0xa1f1('0x3c')]({},_0x39e56f,_0x16ab74[_0xa1f1('0x3e')]);var _0x2dbd93={'where':_0x39e56f[_0xa1f1('0x3b')]};return db[_0xa1f1('0x29')][_0xa1f1('0x1d')](_0x2dbd93)[_0xa1f1('0x24')](function(_0x2f7d72){_0xa89f0d['count']=_0x2f7d72;if(_0x16ab74[_0xa1f1('0x2e')]['includeAll']){_0x39e56f[_0xa1f1('0x3f')]=[{'all':!![]}];}return db[_0xa1f1('0x29')][_0xa1f1('0x40')](_0x39e56f);})[_0xa1f1('0x24')](function(_0xee21c4){_0xa89f0d['rows']=_0xee21c4;return _0xa89f0d;})[_0xa1f1('0x24')](respondWithFilteredResult(_0x266719,_0x39e56f))[_0xa1f1('0x41')](handleError(_0x266719,null));};exports[_0xa1f1('0x42')]=function(_0x52a226,_0x4a4a65){var _0x1c069={'raw':![],'where':{'id':_0x52a226[_0xa1f1('0x43')]['id']}},_0x29e1eb={};_0x29e1eb['model']=_[_0xa1f1('0x2f')](db[_0xa1f1('0x29')][_0xa1f1('0x2a')]);_0x29e1eb[_0xa1f1('0x2e')]=_[_0xa1f1('0x2f')](_0x52a226[_0xa1f1('0x2e')]);_0x29e1eb[_0xa1f1('0x30')]=_['intersection'](_0x29e1eb[_0xa1f1('0x2d')],_0x29e1eb[_0xa1f1('0x2e')]);_0x1c069[_0xa1f1('0x32')]=_[_0xa1f1('0x31')](_0x29e1eb[_0xa1f1('0x2d')],qs[_0xa1f1('0x33')](_0x52a226[_0xa1f1('0x2e')]['fields']));_0x1c069['attributes']=_0x1c069['attributes'][_0xa1f1('0x34')]?_0x1c069['attributes']:_0x29e1eb['model'];if(_0x52a226[_0xa1f1('0x2e')][_0xa1f1('0x44')]){_0x1c069['include']=[{'all':!![]}];}_0x1c069=_['merge']({},_0x1c069,_0x52a226[_0xa1f1('0x3e')]);return db[_0xa1f1('0x29')][_0xa1f1('0x45')](_0x1c069)[_0xa1f1('0x24')](handleEntityNotFound(_0x4a4a65,null))['then'](respondWithResult(_0x4a4a65,null))[_0xa1f1('0x41')](handleError(_0x4a4a65,null));};exports[_0xa1f1('0x46')]=function(_0x103a3a,_0x1f20c0){return db['VtigerAccount']['create'](_0x103a3a[_0xa1f1('0x47')],{})[_0xa1f1('0x24')](respondWithResult(_0x1f20c0,0xc9))[_0xa1f1('0x41')](handleError(_0x1f20c0,null));};exports[_0xa1f1('0x23')]=function(_0x30e9e5,_0x51b08c){if(_0x30e9e5[_0xa1f1('0x47')]['id']){delete _0x30e9e5[_0xa1f1('0x47')]['id'];}return db[_0xa1f1('0x29')][_0xa1f1('0x45')]({'where':{'id':_0x30e9e5[_0xa1f1('0x43')]['id']}})[_0xa1f1('0x24')](handleEntityNotFound(_0x51b08c,null))[_0xa1f1('0x24')](saveUpdates(_0x30e9e5['body'],null))[_0xa1f1('0x24')](respondWithResult(_0x51b08c,null))[_0xa1f1('0x41')](handleError(_0x51b08c,null));};exports[_0xa1f1('0x48')]=function(_0x5b30ff,_0x46ba4d){return db[_0xa1f1('0x29')][_0xa1f1('0x45')]({'where':{'id':_0x5b30ff[_0xa1f1('0x43')]['id']}})['then'](handleEntityNotFound(_0x46ba4d,null))[_0xa1f1('0x24')](removeEntity(_0x46ba4d,null))[_0xa1f1('0x41')](handleError(_0x46ba4d,null));};exports[_0xa1f1('0x49')]=function(_0x57819a,_0x3af2f7,_0x31391e){var _0x3cee1f={};var _0xa69977={};var _0xd5880d;var _0x16733e;return db[_0xa1f1('0x29')][_0xa1f1('0x4a')]({'where':{'id':_0x57819a[_0xa1f1('0x43')]['id']}})[_0xa1f1('0x24')](handleEntityNotFound(_0x3af2f7,null))[_0xa1f1('0x24')](function(_0x28cb7f){if(_0x28cb7f){_0xd5880d=_0x28cb7f;_0xa69977['model']=_[_0xa1f1('0x2f')](db[_0xa1f1('0x4b')][_0xa1f1('0x2a')]);_0xa69977[_0xa1f1('0x2e')]=_[_0xa1f1('0x2f')](_0x57819a[_0xa1f1('0x2e')]);_0xa69977[_0xa1f1('0x30')]=_[_0xa1f1('0x31')](_0xa69977[_0xa1f1('0x2d')],_0xa69977[_0xa1f1('0x2e')]);_0x3cee1f[_0xa1f1('0x32')]=_[_0xa1f1('0x31')](_0xa69977[_0xa1f1('0x2d')],qs[_0xa1f1('0x33')](_0x57819a['query'][_0xa1f1('0x33')]));_0x3cee1f[_0xa1f1('0x32')]=_0x3cee1f[_0xa1f1('0x32')]['length']?_0x3cee1f[_0xa1f1('0x32')]:_0xa69977[_0xa1f1('0x2d')];_0x3cee1f[_0xa1f1('0x37')]=qs[_0xa1f1('0x38')](_0x57819a['query'][_0xa1f1('0x38')]);_0x3cee1f[_0xa1f1('0x3b')]=qs['filters'](_['pick'](_0x57819a[_0xa1f1('0x2e')],_0xa69977[_0xa1f1('0x30')]));if(_0x57819a[_0xa1f1('0x2e')][_0xa1f1('0x3a')]){_0x3cee1f[_0xa1f1('0x3b')]=_[_0xa1f1('0x3c')](_0x3cee1f[_0xa1f1('0x3b')],{'$or':_[_0xa1f1('0x28')](_0x3cee1f[_0xa1f1('0x32')],function(_0x308bb8){var _0x5d8451={};_0x5d8451[_0x308bb8]={'$like':'%'+_0x57819a[_0xa1f1('0x2e')][_0xa1f1('0x3a')]+'%'};return _0x5d8451;})});}_0x3cee1f=_['merge']({},_0x3cee1f,_0x57819a['options']);return _0xd5880d[_0xa1f1('0x49')](_0x3cee1f);}})['then'](function(_0x54ef96){if(_0x54ef96){_0x16733e=_0x54ef96['length'];if(!_0x57819a[_0xa1f1('0x2e')][_0xa1f1('0x35')](_0xa1f1('0x36'))){_0x3cee1f[_0xa1f1('0x1c')]=qs[_0xa1f1('0x1c')](_0x57819a[_0xa1f1('0x2e')]['limit']);_0x3cee1f[_0xa1f1('0x1a')]=qs['offset'](_0x57819a[_0xa1f1('0x2e')]['offset']);}return _0xd5880d['getConfigurations'](_0x3cee1f);}})[_0xa1f1('0x24')](function(_0x282589){if(_0x282589){return _0x282589?{'count':_0x16733e,'rows':_0x282589}:null;}})[_0xa1f1('0x24')](respondWithResult(_0x3af2f7,null))[_0xa1f1('0x41')](handleError(_0x3af2f7,null));};exports[_0xa1f1('0x4c')]=function(_0x5df7ec,_0x563c0a,_0x16eeae){if(_0x5df7ec[_0xa1f1('0x47')]['id']){delete _0x5df7ec[_0xa1f1('0x47')]['id'];}return db[_0xa1f1('0x29')][_0xa1f1('0x4a')]({'where':{'id':_0x5df7ec[_0xa1f1('0x43')]['id']}})[_0xa1f1('0x24')](handleEntityNotFound(_0x563c0a,null))[_0xa1f1('0x24')](function(_0x1ff43d){if(_0x1ff43d){_0x5df7ec[_0xa1f1('0x47')][_0xa1f1('0x4d')]=_0x1ff43d['id'];_0x5df7ec['body'][_0xa1f1('0x4e')]=integrations['getSubjects'](_0x5df7ec[_0xa1f1('0x47')][_0xa1f1('0x4f')],_0x5df7ec['body'][_0xa1f1('0x2c')]);_0x5df7ec['body'][_0xa1f1('0x50')]=integrations[_0xa1f1('0x51')](_0x5df7ec['body']['channel'],_0x5df7ec['body'][_0xa1f1('0x2c')]);return db[_0xa1f1('0x4b')][_0xa1f1('0x46')](_0x5df7ec[_0xa1f1('0x47')],{'include':[{'model':db[_0xa1f1('0x52')],'as':_0xa1f1('0x4e')},{'model':db['VtigerField'],'as':_0xa1f1('0x50')}]});}return null;})[_0xa1f1('0x24')](respondWithResult(_0x563c0a,null))[_0xa1f1('0x41')](handleError(_0x563c0a,null));};var md5=require('md5');exports['getFields']=function(_0x156afb,_0x18728a,_0x4d358b){var _0x55ab77=null;var _0x116ef1=null;var _0x5d4e58=null;var _0x5440ed=null;var _0x38d421='';return db['VtigerAccount'][_0xa1f1('0x4a')]({'where':{'id':_0x156afb['params']['id']},'attributes':['id',_0xa1f1('0x25'),_0xa1f1('0x53'),_0xa1f1('0x54'),_0xa1f1('0x55'),_0xa1f1('0x56'),_0xa1f1('0x57'),_0xa1f1('0x58')]})['then'](handleEntityNotFound(_0x18728a,null))[_0xa1f1('0x24')](function(_0x4e9ecc){if(_0x4e9ecc){_0x55ab77=_0x4e9ecc[_0xa1f1('0x53')];_0x116ef1=_0x4e9ecc[_0xa1f1('0x58')];_0x5d4e58=_0x4e9ecc[_0xa1f1('0x55')];_0x38d421=_0x4e9ecc[_0xa1f1('0x56')];var _0x168fe5=_0x38d421[_0xa1f1('0x59')](-0x1);if(_0x168fe5==='/'){_0x38d421=_0x38d421[_0xa1f1('0x5a')](0x0,_0x38d421[_0xa1f1('0x5b')](_0x168fe5));}_0x5440ed=util['format'](_0xa1f1('0x5c'),_0x38d421);var _0x28b36c={'method':_0xa1f1('0x5d'),'uri':_0x5440ed,'qs':{'operation':_0xa1f1('0x5e'),'username':_0x4e9ecc[_0xa1f1('0x53')]},'json':!![]};return rp(_0x28b36c);}})[_0xa1f1('0x24')](function(_0x5a9fff){if(_0x5a9fff[_0xa1f1('0x5f')]){var _0x496a39={'method':'POST','uri':_0x5440ed,'form':{'operation':_0xa1f1('0x60'),'username':_0x55ab77,'accessKey':md5(_0x5a9fff[_0xa1f1('0x61')][_0xa1f1('0x62')]+_0x116ef1)},'json':!![]};return rp(_0x496a39);}})['then'](function(_0x1c1520){if(_0x1c1520[_0xa1f1('0x5f')]){var _0xa1ce5e={'method':'GET','uri':_0x5440ed,'qs':{'operation':_0xa1f1('0x63'),'username':_0x55ab77,'sessionName':_0x1c1520[_0xa1f1('0x61')][_0xa1f1('0x64')],'elementType':_0x5d4e58},'json':!![]};return rp(_0xa1ce5e);}})['then'](function(_0x1d8988){if(_0x1d8988[_0xa1f1('0x5f')]){var _0x65452b=['autogenerated',_0xa1f1('0x65'),_0xa1f1('0x66')];_[_0xa1f1('0x67')](_0x1d8988['result'][_0xa1f1('0x33')],function(_0x44e656){return _0x65452b[_0xa1f1('0x68')](_0x44e656['type']['name']);});_[_0xa1f1('0x67')](_0x1d8988[_0xa1f1('0x61')][_0xa1f1('0x33')],function(_0x4d25bc){return _0x4d25bc[_0xa1f1('0x69')]==='false';});return{'count':_0x1d8988[_0xa1f1('0x61')][_0xa1f1('0x33')][_0xa1f1('0x34')],'rows':_[_0xa1f1('0x28')](_0x1d8988[_0xa1f1('0x61')][_0xa1f1('0x33')],function(_0x1dc1db){return{'id':_0x1dc1db[_0xa1f1('0x25')],'name':_0x1dc1db[_0xa1f1('0x6a')],'custom':_[_0xa1f1('0x6b')](_0x1dc1db['name'],_0xa1f1('0x6c'))?!![]:![],'options':_0x1dc1db['type'][_0xa1f1('0x25')]===_0xa1f1('0x6d')&&_0x1dc1db[_0xa1f1('0x2c')][_0xa1f1('0x6e')][_0xa1f1('0x34')]>0x0?_[_0xa1f1('0x28')](_0x1dc1db[_0xa1f1('0x2c')][_0xa1f1('0x6e')],function(_0x48855d){return{'name':_0x48855d[_0xa1f1('0x6a')],'value':_0x48855d[_0xa1f1('0x6f')]};}):[]};})};}})['then'](respondWithResult(_0x18728a,null))[_0xa1f1('0x41')](function(_0x2da0ae){console['log'](_0xa1f1('0x70')+_0x2da0ae);var _0x10f46a=_0x156afb[_0xa1f1('0x2e')]['test']?0x1f4:_0x2da0ae[_0xa1f1('0x71')]||0x1f4;logger['error'](_0xa1f1('0x72'),_0xa1f1('0x73'),_0x10f46a,JSON['stringify'](_0x2da0ae));delete _0x2da0ae[_0xa1f1('0x25')];if(_0x10f46a===0x191){_0x10f46a=0x190;}_0x18728a[_0xa1f1('0x17')](_0x10f46a)['send'](_0x156afb['query']['test']?{'message':_0xa1f1('0x74'),'statusCode':_0x2da0ae[_0xa1f1('0x71')]}:_0x2da0ae);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 66f2145..2f776e9 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 _0xa23d=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','lodash','util'];(function(_0x2ab20b,_0x382162){var _0x27f7f2=function(_0x3c2201){while(--_0x3c2201){_0x2ab20b['push'](_0x2ab20b['shift']());}};_0x27f7f2(++_0x382162);}(_0xa23d,0x6e));var _0xda23=function(_0x4ea941,_0x2932a8){_0x4ea941=_0x4ea941-0x0;var _0xeb6ee4=_0xa23d[_0x4ea941];return _0xeb6ee4;};'use strict';var _=require(_0xda23('0x0'));var util=require(_0xda23('0x1'));var logger=require(_0xda23('0x2'))('api');var moment=require(_0xda23('0x3'));var BPromise=require(_0xda23('0x4'));var rp=require(_0xda23('0x5'));var fs=require('fs');var path=require(_0xda23('0x6'));var rimraf=require(_0xda23('0x7'));var config=require(_0xda23('0x8'));var attributes=require(_0xda23('0x9'));var integrations=require(_0xda23('0xa'));module[_0xda23('0xb')]=function(_0x56ff87,_0x58fc5b){return _0x56ff87[_0xda23('0xc')](_0xda23('0xd'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c5e=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util'];(function(_0x546357,_0x20a92e){var _0x1d7109=function(_0x4abfc2){while(--_0x4abfc2){_0x546357['push'](_0x546357['shift']());}};_0x1d7109(++_0x20a92e);}(_0x2c5e,0x139));var _0xe2c5=function(_0x27a5b8,_0x10b486){_0x27a5b8=_0x27a5b8-0x0;var _0x31d17e=_0x2c5e[_0x27a5b8];return _0x31d17e;};'use strict';var _=require(_0xe2c5('0x0'));var util=require(_0xe2c5('0x1'));var logger=require(_0xe2c5('0x2'))(_0xe2c5('0x3'));var moment=require(_0xe2c5('0x4'));var BPromise=require(_0xe2c5('0x5'));var rp=require(_0xe2c5('0x6'));var fs=require('fs');var path=require(_0xe2c5('0x7'));var rimraf=require('rimraf');var config=require(_0xe2c5('0x8'));var attributes=require(_0xe2c5('0x9'));var integrations=require(_0xe2c5('0xa'));module[_0xe2c5('0xb')]=function(_0xfd433,_0x172933){return _0xfd433[_0xe2c5('0xc')](_0xe2c5('0xd'),attributes,{'tableName':_0xe2c5('0xe'),'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 03023d9..697163c 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 _0x97c1=['error','message','result','catch','VtigerAccount','findAll','options','raw','attributes','limit','include','map','model','then','GetVtigerAccount','debug','find','where','ShowVtigerAccount','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2e87f2,_0x22af37){var _0x17979a=function(_0x247c15){while(--_0x247c15){_0x2e87f2['push'](_0x2e87f2['shift']());}};_0x17979a(++_0x22af37);}(_0x97c1,0xdf));var _0x197c=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x97c1[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x197c('0x0'));var util=require(_0x197c('0x1'));var moment=require('moment');var BPromise=require(_0x197c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x197c('0x3'))['db'];var utils=require(_0x197c('0x4'));var logger=require(_0x197c('0x5'))(_0x197c('0x6'));var config=require(_0x197c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x197c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x437214,_0x60fab2,_0xfcee35){return new BPromise(function(_0x5cf5cb,_0x5d42c5){return client[_0x197c('0x9')](_0x437214,_0xfcee35)['then'](function(_0x339fab){logger[_0x197c('0xa')](_0x197c('0xb'),_0x60fab2,_0x197c('0xc'));logger['debug'](_0x197c('0xd'),_0x60fab2,_0x197c('0xc'),JSON[_0x197c('0xe')](_0x339fab));if(_0x339fab[_0x197c('0xf')]){if(_0x339fab[_0x197c('0xf')]['code']===0x1f4){logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x339fab[_0x197c('0xf')][_0x197c('0x10')]);return _0x5d42c5(_0x339fab['error'][_0x197c('0x10')]);}logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x339fab[_0x197c('0xf')][_0x197c('0x10')]);return _0x5cf5cb(_0x339fab[_0x197c('0xf')]['message']);}else{logger['info'](_0x197c('0xb'),_0x60fab2,_0x197c('0xc'));_0x5cf5cb(_0x339fab[_0x197c('0x11')][_0x197c('0x10')]);}})[_0x197c('0x12')](function(_0x7e302f){logger[_0x197c('0xf')](_0x197c('0xb'),_0x60fab2,_0x7e302f);_0x5d42c5(_0x7e302f);});});}exports['GetVtigerAccount']=function(_0x372311){var _0x47aaa9=this;return new Promise(function(_0x50ac52,_0x1725d9){return db[_0x197c('0x13')][_0x197c('0x14')]({'raw':_0x372311[_0x197c('0x15')]?_0x372311['options'][_0x197c('0x16')]===undefined?!![]:![]:!![],'where':_0x372311[_0x197c('0x15')]?_0x372311[_0x197c('0x15')]['where']||null:null,'attributes':_0x372311[_0x197c('0x15')]?_0x372311[_0x197c('0x15')][_0x197c('0x17')]||null:null,'limit':_0x372311[_0x197c('0x15')]?_0x372311[_0x197c('0x15')][_0x197c('0x18')]||null:null,'include':_0x372311[_0x197c('0x15')]?_0x372311[_0x197c('0x15')][_0x197c('0x19')]?_[_0x197c('0x1a')](_0x372311[_0x197c('0x15')][_0x197c('0x19')],function(_0x174942){return{'model':db[_0x174942[_0x197c('0x1b')]],'as':_0x174942['as'],'attributes':_0x174942[_0x197c('0x17')],'include':_0x174942[_0x197c('0x19')]?_['map'](_0x174942[_0x197c('0x19')],function(_0x2911dd){return{'model':db[_0x2911dd[_0x197c('0x1b')]],'as':_0x2911dd['as'],'attributes':_0x2911dd['attributes'],'include':_0x2911dd[_0x197c('0x19')]?_[_0x197c('0x1a')](_0x2911dd['include'],function(_0x5e7bc9){return{'model':db[_0x5e7bc9[_0x197c('0x1b')]],'as':_0x5e7bc9['as'],'attributes':_0x5e7bc9['attributes']};}):[]};}):[]};}):[]:[]})[_0x197c('0x1c')](function(_0x14b0aa){logger[_0x197c('0xa')](_0x197c('0x1d'),_0x372311);logger[_0x197c('0x1e')](_0x197c('0x1d'),_0x372311,JSON[_0x197c('0xe')](_0x14b0aa));_0x50ac52(_0x14b0aa);})[_0x197c('0x12')](function(_0x4422d1){logger['error']('GetVtigerAccount',_0x4422d1['message'],_0x372311);_0x1725d9(_0x47aaa9['error'](0x1f4,_0x4422d1[_0x197c('0x10')]));});});};exports['ShowVtigerAccount']=function(_0x252cde){var _0x35dbf3=this;return new Promise(function(_0x58bc60,_0x422ac6){return db['VtigerAccount'][_0x197c('0x1f')]({'raw':_0x252cde[_0x197c('0x15')]?_0x252cde[_0x197c('0x15')][_0x197c('0x16')]===undefined?!![]:![]:!![],'where':_0x252cde[_0x197c('0x15')]?_0x252cde[_0x197c('0x15')][_0x197c('0x20')]||null:null,'attributes':_0x252cde[_0x197c('0x15')]?_0x252cde[_0x197c('0x15')]['attributes']||null:null,'include':_0x252cde['options']?_0x252cde[_0x197c('0x15')][_0x197c('0x19')]?_[_0x197c('0x1a')](_0x252cde[_0x197c('0x15')][_0x197c('0x19')],function(_0x1cb7e8){return{'model':db[_0x1cb7e8[_0x197c('0x1b')]],'as':_0x1cb7e8['as'],'attributes':_0x1cb7e8['attributes'],'include':_0x1cb7e8['include']?_[_0x197c('0x1a')](_0x1cb7e8[_0x197c('0x19')],function(_0x4d085b){return{'model':db[_0x4d085b['model']],'as':_0x4d085b['as'],'attributes':_0x4d085b[_0x197c('0x17')],'include':_0x4d085b[_0x197c('0x19')]?_[_0x197c('0x1a')](_0x4d085b[_0x197c('0x19')],function(_0x45095c){return{'model':db[_0x45095c[_0x197c('0x1b')]],'as':_0x45095c['as'],'attributes':_0x45095c[_0x197c('0x17')]};}):[]};}):[]};}):[]:[]})[_0x197c('0x1c')](function(_0x44ce68){logger['info'](_0x197c('0x21'),_0x252cde);logger[_0x197c('0x1e')](_0x197c('0x21'),_0x252cde,JSON[_0x197c('0xe')](_0x44ce68));_0x58bc60(_0x44ce68);})[_0x197c('0x12')](function(_0x151e2f){logger['error'](_0x197c('0x21'),_0x151e2f[_0x197c('0x10')],_0x252cde);_0x422ac6(_0x35dbf3[_0x197c('0xf')](0x1f4,_0x151e2f['message']));});});}; \ No newline at end of file +var _0x69d3=['debug','stringify','error','code','message','result','catch','VtigerAccount','options','raw','attributes','limit','include','model','map','then','GetVtigerAccount','ShowVtigerAccount','find','where','lodash','util','moment','randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x42e752,_0x1db51a){var _0x261222=function(_0x3de59e){while(--_0x3de59e){_0x42e752['push'](_0x42e752['shift']());}};_0x261222(++_0x1db51a);}(_0x69d3,0xda));var _0x369d=function(_0xd04fc2,_0x425c17){_0xd04fc2=_0xd04fc2-0x0;var _0x2e65e3=_0x69d3[_0xd04fc2];return _0x2e65e3;};'use strict';var _=require(_0x369d('0x0'));var util=require(_0x369d('0x1'));var moment=require(_0x369d('0x2'));var BPromise=require('bluebird');var rs=require(_0x369d('0x3'));var fs=require('fs');var Redis=require(_0x369d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x369d('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x369d('0x6'));var client=jayson[_0x369d('0x7')][_0x369d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x424d8c,_0x1bd94c,_0x186302){return new BPromise(function(_0x3adb26,_0x2ac0ec){return client[_0x369d('0x9')](_0x424d8c,_0x186302)['then'](function(_0x5d2ded){logger[_0x369d('0xa')](_0x369d('0xb'),_0x1bd94c,_0x369d('0xc'));logger[_0x369d('0xd')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x1bd94c,'request\x20sent',JSON[_0x369d('0xe')](_0x5d2ded));if(_0x5d2ded[_0x369d('0xf')]){if(_0x5d2ded[_0x369d('0xf')][_0x369d('0x10')]===0x1f4){logger[_0x369d('0xf')](_0x369d('0xb'),_0x1bd94c,_0x5d2ded['error'][_0x369d('0x11')]);return _0x2ac0ec(_0x5d2ded[_0x369d('0xf')][_0x369d('0x11')]);}logger[_0x369d('0xf')](_0x369d('0xb'),_0x1bd94c,_0x5d2ded['error']['message']);return _0x3adb26(_0x5d2ded['error'][_0x369d('0x11')]);}else{logger[_0x369d('0xa')](_0x369d('0xb'),_0x1bd94c,'request\x20sent');_0x3adb26(_0x5d2ded[_0x369d('0x12')][_0x369d('0x11')]);}})[_0x369d('0x13')](function(_0x4e234e){logger[_0x369d('0xf')](_0x369d('0xb'),_0x1bd94c,_0x4e234e);_0x2ac0ec(_0x4e234e);});});}exports['GetVtigerAccount']=function(_0x572513){var _0x597b67=this;return new Promise(function(_0x2946be,_0x4494b3){return db[_0x369d('0x14')]['findAll']({'raw':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')][_0x369d('0x16')]===undefined?!![]:![]:!![],'where':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')]['where']||null:null,'attributes':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')][_0x369d('0x17')]||null:null,'limit':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')][_0x369d('0x18')]||null:null,'include':_0x572513[_0x369d('0x15')]?_0x572513[_0x369d('0x15')]['include']?_['map'](_0x572513[_0x369d('0x15')][_0x369d('0x19')],function(_0xf7bc3a){return{'model':db[_0xf7bc3a[_0x369d('0x1a')]],'as':_0xf7bc3a['as'],'attributes':_0xf7bc3a[_0x369d('0x17')],'include':_0xf7bc3a[_0x369d('0x19')]?_[_0x369d('0x1b')](_0xf7bc3a['include'],function(_0x4dfe83){return{'model':db[_0x4dfe83[_0x369d('0x1a')]],'as':_0x4dfe83['as'],'attributes':_0x4dfe83[_0x369d('0x17')],'include':_0x4dfe83[_0x369d('0x19')]?_[_0x369d('0x1b')](_0x4dfe83[_0x369d('0x19')],function(_0x41e0cf){return{'model':db[_0x41e0cf[_0x369d('0x1a')]],'as':_0x41e0cf['as'],'attributes':_0x41e0cf['attributes']};}):[]};}):[]};}):[]:[]})[_0x369d('0x1c')](function(_0xe95742){logger[_0x369d('0xa')](_0x369d('0x1d'),_0x572513);logger[_0x369d('0xd')](_0x369d('0x1d'),_0x572513,JSON[_0x369d('0xe')](_0xe95742));_0x2946be(_0xe95742);})['catch'](function(_0x157291){logger['error']('GetVtigerAccount',_0x157291[_0x369d('0x11')],_0x572513);_0x4494b3(_0x597b67[_0x369d('0xf')](0x1f4,_0x157291['message']));});});};exports[_0x369d('0x1e')]=function(_0x5a14ce){var _0x37274f=this;return new Promise(function(_0x39d656,_0xe45219){return db[_0x369d('0x14')][_0x369d('0x1f')]({'raw':_0x5a14ce[_0x369d('0x15')]?_0x5a14ce[_0x369d('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x5a14ce[_0x369d('0x15')]?_0x5a14ce[_0x369d('0x15')][_0x369d('0x20')]||null:null,'attributes':_0x5a14ce[_0x369d('0x15')]?_0x5a14ce[_0x369d('0x15')][_0x369d('0x17')]||null:null,'include':_0x5a14ce[_0x369d('0x15')]?_0x5a14ce[_0x369d('0x15')]['include']?_[_0x369d('0x1b')](_0x5a14ce[_0x369d('0x15')][_0x369d('0x19')],function(_0x1b4453){return{'model':db[_0x1b4453[_0x369d('0x1a')]],'as':_0x1b4453['as'],'attributes':_0x1b4453['attributes'],'include':_0x1b4453[_0x369d('0x19')]?_[_0x369d('0x1b')](_0x1b4453[_0x369d('0x19')],function(_0x3a0277){return{'model':db[_0x3a0277[_0x369d('0x1a')]],'as':_0x3a0277['as'],'attributes':_0x3a0277[_0x369d('0x17')],'include':_0x3a0277['include']?_[_0x369d('0x1b')](_0x3a0277[_0x369d('0x19')],function(_0x40afb2){return{'model':db[_0x40afb2[_0x369d('0x1a')]],'as':_0x40afb2['as'],'attributes':_0x40afb2[_0x369d('0x17')]};}):[]};}):[]};}):[]:[]})[_0x369d('0x1c')](function(_0xfa13da){logger[_0x369d('0xa')](_0x369d('0x1e'),_0x5a14ce);logger[_0x369d('0xd')](_0x369d('0x1e'),_0x5a14ce,JSON[_0x369d('0xe')](_0xfa13da));_0x39d656(_0xfa13da);})[_0x369d('0x13')](function(_0x43d734){logger[_0x369d('0xf')](_0x369d('0x1e'),_0x43d734[_0x369d('0x11')],_0x5a14ce);_0xe45219(_0x37274f[_0x369d('0xf')](0x1f4,_0x43d734[_0x369d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index ced34df..d17194b 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 _0x7a20=['./intVtigerConfiguration.controller','get','isAuthenticated','index','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','/:id','destroy','util','path','connect-timeout','../../components/auth/service'];(function(_0x41b2ff,_0x1bc707){var _0x625261=function(_0x3e7ec6){while(--_0x3e7ec6){_0x41b2ff['push'](_0x41b2ff['shift']());}};_0x625261(++_0x1bc707);}(_0x7a20,0x7a));var _0x07a2=function(_0x105188,_0x24aaa2){_0x105188=_0x105188-0x0;var _0x404369=_0x7a20[_0x105188];return _0x404369;};'use strict';var multer=require('multer');var util=require(_0x07a2('0x0'));var path=require(_0x07a2('0x1'));var timeout=require(_0x07a2('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x07a2('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x07a2('0x4'));router[_0x07a2('0x5')]('/',auth[_0x07a2('0x6')](),controller[_0x07a2('0x7')]);router[_0x07a2('0x5')]('/:id',auth[_0x07a2('0x6')](),controller['show']);router[_0x07a2('0x5')]('/:id/fields',auth[_0x07a2('0x6')](),controller[_0x07a2('0x8')]);router[_0x07a2('0x5')](_0x07a2('0x9'),auth[_0x07a2('0x6')](),controller[_0x07a2('0xa')]);router[_0x07a2('0x5')](_0x07a2('0xb'),auth[_0x07a2('0x6')](),controller[_0x07a2('0xc')]);router[_0x07a2('0xd')]('/',auth[_0x07a2('0x6')](),controller['create']);router[_0x07a2('0xe')]('/:id',auth[_0x07a2('0x6')](),controller[_0x07a2('0xf')]);router['delete'](_0x07a2('0x10'),auth['isAuthenticated'](),controller[_0x07a2('0x11')]);module['exports']=router; \ No newline at end of file +var _0x3da6=['put','update','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','index','/:id','show','isAuthenticated','getFields','/:id/subjects','getSubjects','getDescriptions','create'];(function(_0x4aa079,_0x584b3e){var _0x53b1db=function(_0xa5a5e){while(--_0xa5a5e){_0x4aa079['push'](_0x4aa079['shift']());}};_0x53b1db(++_0x584b3e);}(_0x3da6,0xd5));var _0x63da=function(_0x128d90,_0x5d79a9){_0x128d90=_0x128d90-0x0;var _0x314b0b=_0x3da6[_0x128d90];return _0x314b0b;};'use strict';var multer=require(_0x63da('0x0'));var util=require(_0x63da('0x1'));var path=require(_0x63da('0x2'));var timeout=require(_0x63da('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x63da('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x63da('0x5'));var config=require(_0x63da('0x6'));var controller=require(_0x63da('0x7'));router[_0x63da('0x8')]('/',auth['isAuthenticated'](),controller[_0x63da('0x9')]);router[_0x63da('0x8')](_0x63da('0xa'),auth['isAuthenticated'](),controller[_0x63da('0xb')]);router[_0x63da('0x8')]('/:id/fields',auth[_0x63da('0xc')](),controller[_0x63da('0xd')]);router[_0x63da('0x8')](_0x63da('0xe'),auth[_0x63da('0xc')](),controller[_0x63da('0xf')]);router[_0x63da('0x8')]('/:id/descriptions',auth[_0x63da('0xc')](),controller[_0x63da('0x10')]);router['post']('/',auth[_0x63da('0xc')](),controller[_0x63da('0x11')]);router[_0x63da('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x63da('0x13')]);router['delete'](_0x63da('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x63da('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 0ae8233..0e261da 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 _0x6646=['STRING','sequelize','exports'];(function(_0x486dc0,_0x100223){var _0x18c616=function(_0xd4d08){while(--_0xd4d08){_0x486dc0['push'](_0x486dc0['shift']());}};_0x18c616(++_0x100223);}(_0x6646,0x11b));var _0x6664=function(_0x337c0a,_0x66b76b){_0x337c0a=_0x337c0a-0x0;var _0x1e27e0=_0x6646[_0x337c0a];return _0x1e27e0;};'use strict';var Sequelize=require(_0x6664('0x0'));module[_0x6664('0x1')]={'name':{'type':Sequelize[_0x6664('0x2')]},'description':{'type':Sequelize[_0x6664('0x2')]}}; \ No newline at end of file +var _0xab68=['STRING','sequelize'];(function(_0x58ec0a,_0x187389){var _0x392d05=function(_0x567c14){while(--_0x567c14){_0x58ec0a['push'](_0x58ec0a['shift']());}};_0x392d05(++_0x187389);}(_0xab68,0x14f));var _0x8ab6=function(_0x461b47,_0x5ca4c4){_0x461b47=_0x461b47-0x0;var _0x1c9b8d=_0xab68[_0x461b47];return _0x1c9b8d;};'use strict';var Sequelize=require(_0x8ab6('0x0'));module['exports']={'name':{'type':Sequelize[_0x8ab6('0x1')]},'description':{'type':Sequelize[_0x8ab6('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 2f04591..be96f63 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 _0x9f3e=['api','../../config/environment','../../config/license/util','sendStatus','status','json','limit','undefined','count','set','Content-Range','reject','save','update','then','end','stack','name','send','map','VtigerConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','offset','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','params','find','create','body','destroy','getFields','findOne','VtigerField','nolimit','getSubjects','hasOwnProperty','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x5272be,_0x2256ce){var _0x320ff7=function(_0x4980c6){while(--_0x4980c6){_0x5272be['push'](_0x5272be['shift']());}};_0x320ff7(++_0x2256ce);}(_0x9f3e,0x1c4));var _0xe9f3=function(_0x5d644b,_0x815f8a){_0x5d644b=_0x5d644b-0x0;var _0x51296b=_0x9f3e[_0x5d644b];return _0x51296b;};'use strict';var emlformat=require(_0xe9f3('0x0'));var rimraf=require(_0xe9f3('0x1'));var zipdir=require(_0xe9f3('0x2'));var jsonpatch=require(_0xe9f3('0x3'));var rp=require(_0xe9f3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe9f3('0x5'));var path=require('path');var sox=require(_0xe9f3('0x6'));var csv=require(_0xe9f3('0x7'));var ejs=require(_0xe9f3('0x8'));var fs=require('fs');var fs_extra=require(_0xe9f3('0x9'));var _=require(_0xe9f3('0xa'));var squel=require(_0xe9f3('0xb'));var crypto=require(_0xe9f3('0xc'));var jsforce=require(_0xe9f3('0xd'));var deskjs=require(_0xe9f3('0xe'));var toCsv=require(_0xe9f3('0x7'));var querystring=require(_0xe9f3('0xf'));var Papa=require(_0xe9f3('0x10'));var Redis=require(_0xe9f3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe9f3('0x12'));var as=require(_0xe9f3('0x13'));var hardwareService=require(_0xe9f3('0x14'));var logger=require(_0xe9f3('0x15'))(_0xe9f3('0x16'));var utils=require('../../config/utils');var config=require(_0xe9f3('0x17'));var licenseUtil=require(_0xe9f3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1865a6,_0x4e2d17){_0x4e2d17=_0x4e2d17||0xcc;return function(_0x14af9f){if(_0x14af9f){return _0x1865a6[_0xe9f3('0x19')](_0x4e2d17);}return _0x1865a6[_0xe9f3('0x1a')](_0x4e2d17)['end']();};}function respondWithResult(_0x5501fe,_0x143a34){_0x143a34=_0x143a34||0xc8;return function(_0x158f4c){if(_0x158f4c){return _0x5501fe['status'](_0x143a34)[_0xe9f3('0x1b')](_0x158f4c);}};}function respondWithFilteredResult(_0x1f0dd9,_0x2d6c96){return function(_0x25abdc){if(_0x25abdc){var _0x45cfd5=typeof _0x2d6c96['offset']==='undefined'&&typeof _0x2d6c96[_0xe9f3('0x1c')]===_0xe9f3('0x1d');var _0x4acda2=_0x25abdc[_0xe9f3('0x1e')];var _0x16b788=_0x45cfd5?0x0:_0x2d6c96['offset'];var _0x1496f=_0x45cfd5?_0x25abdc[_0xe9f3('0x1e')]:_0x2d6c96['offset']+_0x2d6c96[_0xe9f3('0x1c')];var _0x679a80;if(_0x1496f>=_0x4acda2){_0x1496f=_0x4acda2;_0x679a80=0xc8;}else{_0x679a80=0xce;}_0x1f0dd9[_0xe9f3('0x1a')](_0x679a80);return _0x1f0dd9[_0xe9f3('0x1f')](_0xe9f3('0x20'),_0x16b788+'-'+_0x1496f+'/'+_0x4acda2)[_0xe9f3('0x1b')](_0x25abdc);}return null;};}function patchUpdates(_0x3866cc){return function(_0x44be8f){try{jsonpatch['apply'](_0x44be8f,_0x3866cc,!![]);}catch(_0x312b89){return BPromise[_0xe9f3('0x21')](_0x312b89);}return _0x44be8f[_0xe9f3('0x22')]();};}function saveUpdates(_0x514ddc,_0x138e5d){return function(_0x17f97e){if(_0x17f97e){return _0x17f97e[_0xe9f3('0x23')](_0x514ddc)['then'](function(_0x4f9cdd){return _0x4f9cdd;});}return null;};}function removeEntity(_0x1649fa,_0x526d6b){return function(_0x35a8af){if(_0x35a8af){return _0x35a8af['destroy']()[_0xe9f3('0x24')](function(){_0x1649fa[_0xe9f3('0x1a')](0xcc)[_0xe9f3('0x25')]();});}};}function handleEntityNotFound(_0x2e959a,_0x381300){return function(_0x40c7c2){if(!_0x40c7c2){_0x2e959a[_0xe9f3('0x19')](0x194);}return _0x40c7c2;};}function handleError(_0x5e518a,_0x3de723){_0x3de723=_0x3de723||0x1f4;return function(_0x144af0){logger['error'](_0x144af0[_0xe9f3('0x26')]);if(_0x144af0[_0xe9f3('0x27')]){delete _0x144af0[_0xe9f3('0x27')];}_0x5e518a[_0xe9f3('0x1a')](_0x3de723)[_0xe9f3('0x28')](_0x144af0);};}exports['index']=function(_0x54b315,_0x2a8e22){var _0x489ff2={},_0x2fff80={},_0x421b9f={'count':0x0,'rows':[]};var _0x2b33de=_[_0xe9f3('0x29')](db[_0xe9f3('0x2a')][_0xe9f3('0x2b')],function(_0x3baf84){return{'name':_0x3baf84[_0xe9f3('0x2c')],'type':_0x3baf84[_0xe9f3('0x2d')][_0xe9f3('0x2e')]};});_0x2fff80['model']=_[_0xe9f3('0x29')](_0x2b33de,_0xe9f3('0x27'));_0x2fff80[_0xe9f3('0x2f')]=_[_0xe9f3('0x30')](_0x54b315['query']);_0x2fff80[_0xe9f3('0x31')]=_[_0xe9f3('0x32')](_0x2fff80[_0xe9f3('0x33')],_0x2fff80[_0xe9f3('0x2f')]);_0x489ff2['attributes']=_['intersection'](_0x2fff80[_0xe9f3('0x33')],qs[_0xe9f3('0x34')](_0x54b315['query'][_0xe9f3('0x34')]));_0x489ff2[_0xe9f3('0x35')]=_0x489ff2['attributes'][_0xe9f3('0x36')]?_0x489ff2['attributes']:_0x2fff80['model'];if(!_0x54b315[_0xe9f3('0x2f')]['hasOwnProperty']('nolimit')){_0x489ff2['limit']=qs[_0xe9f3('0x1c')](_0x54b315[_0xe9f3('0x2f')]['limit']);_0x489ff2[_0xe9f3('0x37')]=qs[_0xe9f3('0x37')](_0x54b315[_0xe9f3('0x2f')][_0xe9f3('0x37')]);}_0x489ff2[_0xe9f3('0x38')]=qs[_0xe9f3('0x39')](_0x54b315['query'][_0xe9f3('0x39')]);_0x489ff2[_0xe9f3('0x3a')]=qs[_0xe9f3('0x31')](_[_0xe9f3('0x3b')](_0x54b315['query'],_0x2fff80['filters']),_0x2b33de);if(_0x54b315[_0xe9f3('0x2f')][_0xe9f3('0x3c')]){_0x489ff2[_0xe9f3('0x3a')]=_[_0xe9f3('0x3d')](_0x489ff2[_0xe9f3('0x3a')],{'$or':_[_0xe9f3('0x29')](_0x2b33de,function(_0x23bd11){if(_0x23bd11[_0xe9f3('0x2d')]!=='VIRTUAL'){var _0x333ed7={};_0x333ed7[_0x23bd11[_0xe9f3('0x27')]]={'$like':'%'+_0x54b315[_0xe9f3('0x2f')][_0xe9f3('0x3c')]+'%'};return _0x333ed7;}})});}_0x489ff2=_[_0xe9f3('0x3d')]({},_0x489ff2,_0x54b315[_0xe9f3('0x3e')]);var _0xfb1a78={'where':_0x489ff2[_0xe9f3('0x3a')]};return db[_0xe9f3('0x2a')]['count'](_0xfb1a78)[_0xe9f3('0x24')](function(_0x1ecf08){_0x421b9f[_0xe9f3('0x1e')]=_0x1ecf08;if(_0x54b315[_0xe9f3('0x2f')][_0xe9f3('0x3f')]){_0x489ff2[_0xe9f3('0x40')]=[{'all':!![]}];}return db[_0xe9f3('0x2a')][_0xe9f3('0x41')](_0x489ff2);})[_0xe9f3('0x24')](function(_0xb11d82){_0x421b9f['rows']=_0xb11d82;return _0x421b9f;})[_0xe9f3('0x24')](respondWithFilteredResult(_0x2a8e22,_0x489ff2))[_0xe9f3('0x42')](handleError(_0x2a8e22,null));};exports['show']=function(_0x2660c7,_0x17ef05){var _0x502e57={'raw':![],'where':{'id':_0x2660c7[_0xe9f3('0x43')]['id']}},_0x4332e1={};_0x4332e1['model']=_[_0xe9f3('0x30')](db[_0xe9f3('0x2a')]['rawAttributes']);_0x4332e1[_0xe9f3('0x2f')]=_[_0xe9f3('0x30')](_0x2660c7[_0xe9f3('0x2f')]);_0x4332e1[_0xe9f3('0x31')]=_[_0xe9f3('0x32')](_0x4332e1[_0xe9f3('0x33')],_0x4332e1[_0xe9f3('0x2f')]);_0x502e57[_0xe9f3('0x35')]=_['intersection'](_0x4332e1['model'],qs['fields'](_0x2660c7[_0xe9f3('0x2f')][_0xe9f3('0x34')]));_0x502e57[_0xe9f3('0x35')]=_0x502e57['attributes'][_0xe9f3('0x36')]?_0x502e57[_0xe9f3('0x35')]:_0x4332e1[_0xe9f3('0x33')];if(_0x2660c7[_0xe9f3('0x2f')][_0xe9f3('0x3f')]){_0x502e57[_0xe9f3('0x40')]=[{'all':!![]}];}_0x502e57=_[_0xe9f3('0x3d')]({},_0x502e57,_0x2660c7[_0xe9f3('0x3e')]);return db['VtigerConfiguration'][_0xe9f3('0x44')](_0x502e57)[_0xe9f3('0x24')](handleEntityNotFound(_0x17ef05,null))['then'](respondWithResult(_0x17ef05,null))['catch'](handleError(_0x17ef05,null));};exports[_0xe9f3('0x45')]=function(_0x5e2969,_0x3cd2d7){return db[_0xe9f3('0x2a')]['create'](_0x5e2969['body'],{})['then'](respondWithResult(_0x3cd2d7,0xc9))['catch'](handleError(_0x3cd2d7,null));};exports[_0xe9f3('0x23')]=function(_0x130c2b,_0x446d8d){if(_0x130c2b[_0xe9f3('0x46')]['id']){delete _0x130c2b['body']['id'];}return db[_0xe9f3('0x2a')][_0xe9f3('0x44')]({'where':{'id':_0x130c2b['params']['id']}})['then'](handleEntityNotFound(_0x446d8d,null))[_0xe9f3('0x24')](saveUpdates(_0x130c2b[_0xe9f3('0x46')],null))[_0xe9f3('0x24')](respondWithResult(_0x446d8d,null))[_0xe9f3('0x42')](handleError(_0x446d8d,null));};exports[_0xe9f3('0x47')]=function(_0xa2f83f,_0x51d208){return db[_0xe9f3('0x2a')][_0xe9f3('0x44')]({'where':{'id':_0xa2f83f['params']['id']}})[_0xe9f3('0x24')](handleEntityNotFound(_0x51d208,null))[_0xe9f3('0x24')](removeEntity(_0x51d208,null))[_0xe9f3('0x42')](handleError(_0x51d208,null));};exports[_0xe9f3('0x48')]=function(_0x8114c8,_0x11411a,_0x1c376f){var _0x1a3365={};var _0x10113f={};var _0x24b574;var _0x5ccc4f;return db[_0xe9f3('0x2a')][_0xe9f3('0x49')]({'where':{'id':_0x8114c8[_0xe9f3('0x43')]['id']}})['then'](handleEntityNotFound(_0x11411a,null))[_0xe9f3('0x24')](function(_0x249c16){if(_0x249c16){_0x24b574=_0x249c16;_0x10113f[_0xe9f3('0x33')]=_['keys'](db[_0xe9f3('0x4a')][_0xe9f3('0x2b')]);_0x10113f[_0xe9f3('0x2f')]=_[_0xe9f3('0x30')](_0x8114c8[_0xe9f3('0x2f')]);_0x10113f[_0xe9f3('0x31')]=_[_0xe9f3('0x32')](_0x10113f[_0xe9f3('0x33')],_0x10113f[_0xe9f3('0x2f')]);_0x1a3365[_0xe9f3('0x35')]=_[_0xe9f3('0x32')](_0x10113f['model'],qs[_0xe9f3('0x34')](_0x8114c8[_0xe9f3('0x2f')][_0xe9f3('0x34')]));_0x1a3365[_0xe9f3('0x35')]=_0x1a3365[_0xe9f3('0x35')][_0xe9f3('0x36')]?_0x1a3365[_0xe9f3('0x35')]:_0x10113f['model'];_0x1a3365[_0xe9f3('0x38')]=qs[_0xe9f3('0x39')](_0x8114c8[_0xe9f3('0x2f')]['sort']);_0x1a3365[_0xe9f3('0x3a')]=qs[_0xe9f3('0x31')](_['pick'](_0x8114c8['query'],_0x10113f['filters']));if(_0x8114c8[_0xe9f3('0x2f')][_0xe9f3('0x3c')]){_0x1a3365[_0xe9f3('0x3a')]=_[_0xe9f3('0x3d')](_0x1a3365[_0xe9f3('0x3a')],{'$or':_[_0xe9f3('0x29')](_0x1a3365[_0xe9f3('0x35')],function(_0x5267c6){var _0xdba122={};_0xdba122[_0x5267c6]={'$like':'%'+_0x8114c8[_0xe9f3('0x2f')][_0xe9f3('0x3c')]+'%'};return _0xdba122;})});}_0x1a3365=_[_0xe9f3('0x3d')]({},_0x1a3365,_0x8114c8[_0xe9f3('0x3e')]);return _0x24b574[_0xe9f3('0x48')](_0x1a3365);}})[_0xe9f3('0x24')](function(_0x59986c){if(_0x59986c){_0x5ccc4f=_0x59986c[_0xe9f3('0x36')];if(!_0x8114c8['query']['hasOwnProperty'](_0xe9f3('0x4b'))){_0x1a3365[_0xe9f3('0x1c')]=qs['limit'](_0x8114c8[_0xe9f3('0x2f')]['limit']);_0x1a3365[_0xe9f3('0x37')]=qs['offset'](_0x8114c8[_0xe9f3('0x2f')]['offset']);}return _0x24b574[_0xe9f3('0x48')](_0x1a3365);}})[_0xe9f3('0x24')](function(_0x3aec72){if(_0x3aec72){return _0x3aec72?{'count':_0x5ccc4f,'rows':_0x3aec72}:null;}})[_0xe9f3('0x24')](respondWithResult(_0x11411a,null))[_0xe9f3('0x42')](handleError(_0x11411a,null));};exports[_0xe9f3('0x4c')]=function(_0xe3bb87,_0xd21631,_0x328780){var _0x1f0d1d={};var _0x573cf1={};var _0xe9007b;var _0x57e2fc;return db[_0xe9f3('0x2a')][_0xe9f3('0x49')]({'where':{'id':_0xe3bb87[_0xe9f3('0x43')]['id']}})[_0xe9f3('0x24')](handleEntityNotFound(_0xd21631,null))[_0xe9f3('0x24')](function(_0x11e117){if(_0x11e117){_0xe9007b=_0x11e117;_0x573cf1['model']=_[_0xe9f3('0x30')](db[_0xe9f3('0x4a')]['rawAttributes']);_0x573cf1['query']=_[_0xe9f3('0x30')](_0xe3bb87[_0xe9f3('0x2f')]);_0x573cf1[_0xe9f3('0x31')]=_[_0xe9f3('0x32')](_0x573cf1[_0xe9f3('0x33')],_0x573cf1[_0xe9f3('0x2f')]);_0x1f0d1d[_0xe9f3('0x35')]=_[_0xe9f3('0x32')](_0x573cf1[_0xe9f3('0x33')],qs[_0xe9f3('0x34')](_0xe3bb87[_0xe9f3('0x2f')][_0xe9f3('0x34')]));_0x1f0d1d['attributes']=_0x1f0d1d[_0xe9f3('0x35')][_0xe9f3('0x36')]?_0x1f0d1d[_0xe9f3('0x35')]:_0x573cf1[_0xe9f3('0x33')];_0x1f0d1d[_0xe9f3('0x38')]=qs[_0xe9f3('0x39')](_0xe3bb87[_0xe9f3('0x2f')]['sort']);_0x1f0d1d[_0xe9f3('0x3a')]=qs[_0xe9f3('0x31')](_['pick'](_0xe3bb87[_0xe9f3('0x2f')],_0x573cf1[_0xe9f3('0x31')]));if(_0xe3bb87['query'][_0xe9f3('0x3c')]){_0x1f0d1d[_0xe9f3('0x3a')]=_[_0xe9f3('0x3d')](_0x1f0d1d[_0xe9f3('0x3a')],{'$or':_['map'](_0x1f0d1d[_0xe9f3('0x35')],function(_0x26c8d4){var _0x3eff1b={};_0x3eff1b[_0x26c8d4]={'$like':'%'+_0xe3bb87['query'][_0xe9f3('0x3c')]+'%'};return _0x3eff1b;})});}_0x1f0d1d=_[_0xe9f3('0x3d')]({},_0x1f0d1d,_0xe3bb87[_0xe9f3('0x3e')]);return _0xe9007b[_0xe9f3('0x4c')](_0x1f0d1d);}})[_0xe9f3('0x24')](function(_0x40911e){if(_0x40911e){_0x57e2fc=_0x40911e[_0xe9f3('0x36')];if(!_0xe3bb87[_0xe9f3('0x2f')][_0xe9f3('0x4d')]('nolimit')){_0x1f0d1d[_0xe9f3('0x1c')]=qs[_0xe9f3('0x1c')](_0xe3bb87[_0xe9f3('0x2f')]['limit']);_0x1f0d1d[_0xe9f3('0x37')]=qs[_0xe9f3('0x37')](_0xe3bb87[_0xe9f3('0x2f')]['offset']);}return _0xe9007b[_0xe9f3('0x4c')](_0x1f0d1d);}})[_0xe9f3('0x24')](function(_0x2732cd){if(_0x2732cd){return _0x2732cd?{'count':_0x57e2fc,'rows':_0x2732cd}:null;}})[_0xe9f3('0x24')](respondWithResult(_0xd21631,null))[_0xe9f3('0x42')](handleError(_0xd21631,null));};exports[_0xe9f3('0x4e')]=function(_0xc60512,_0x11d6bc,_0x442cb4){var _0x3bdee7={};var _0x4337f4={};var _0x244584;var _0x30e048;return db[_0xe9f3('0x2a')][_0xe9f3('0x49')]({'where':{'id':_0xc60512[_0xe9f3('0x43')]['id']}})[_0xe9f3('0x24')](handleEntityNotFound(_0x11d6bc,null))[_0xe9f3('0x24')](function(_0x5ac835){if(_0x5ac835){_0x244584=_0x5ac835;_0x4337f4[_0xe9f3('0x33')]=_[_0xe9f3('0x30')](db[_0xe9f3('0x4a')][_0xe9f3('0x2b')]);_0x4337f4[_0xe9f3('0x2f')]=_[_0xe9f3('0x30')](_0xc60512['query']);_0x4337f4[_0xe9f3('0x31')]=_[_0xe9f3('0x32')](_0x4337f4[_0xe9f3('0x33')],_0x4337f4[_0xe9f3('0x2f')]);_0x3bdee7[_0xe9f3('0x35')]=_['intersection'](_0x4337f4[_0xe9f3('0x33')],qs[_0xe9f3('0x34')](_0xc60512[_0xe9f3('0x2f')][_0xe9f3('0x34')]));_0x3bdee7[_0xe9f3('0x35')]=_0x3bdee7[_0xe9f3('0x35')][_0xe9f3('0x36')]?_0x3bdee7[_0xe9f3('0x35')]:_0x4337f4[_0xe9f3('0x33')];_0x3bdee7[_0xe9f3('0x38')]=qs[_0xe9f3('0x39')](_0xc60512[_0xe9f3('0x2f')][_0xe9f3('0x39')]);_0x3bdee7[_0xe9f3('0x3a')]=qs['filters'](_[_0xe9f3('0x3b')](_0xc60512[_0xe9f3('0x2f')],_0x4337f4[_0xe9f3('0x31')]));if(_0xc60512[_0xe9f3('0x2f')]['filter']){_0x3bdee7['where']=_['merge'](_0x3bdee7[_0xe9f3('0x3a')],{'$or':_[_0xe9f3('0x29')](_0x3bdee7['attributes'],function(_0x50b9c6){var _0x371c06={};_0x371c06[_0x50b9c6]={'$like':'%'+_0xc60512[_0xe9f3('0x2f')]['filter']+'%'};return _0x371c06;})});}_0x3bdee7=_[_0xe9f3('0x3d')]({},_0x3bdee7,_0xc60512[_0xe9f3('0x3e')]);return _0x244584['getDescriptions'](_0x3bdee7);}})[_0xe9f3('0x24')](function(_0x17ea27){if(_0x17ea27){_0x30e048=_0x17ea27[_0xe9f3('0x36')];if(!_0xc60512[_0xe9f3('0x2f')][_0xe9f3('0x4d')]('nolimit')){_0x3bdee7[_0xe9f3('0x1c')]=qs['limit'](_0xc60512[_0xe9f3('0x2f')]['limit']);_0x3bdee7[_0xe9f3('0x37')]=qs['offset'](_0xc60512['query'][_0xe9f3('0x37')]);}return _0x244584[_0xe9f3('0x4e')](_0x3bdee7);}})['then'](function(_0x571025){if(_0x571025){return _0x571025?{'count':_0x30e048,'rows':_0x571025}:null;}})[_0xe9f3('0x24')](respondWithResult(_0x11d6bc,null))[_0xe9f3('0x42')](handleError(_0x11d6bc,null));}; \ No newline at end of file +var _0x718b=['map','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','type','VIRTUAL','merge','VtigerConfiguration','include','findAll','catch','show','keys','includeAll','options','create','body','update','find','params','getFields','VtigerField','pick','hasOwnProperty','getSubjects','findOne','getDescriptions','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','key','model'];(function(_0x4459b8,_0x3271b8){var _0x4a4b07=function(_0x3075f8){while(--_0x3075f8){_0x4459b8['push'](_0x4459b8['shift']());}};_0x4a4b07(++_0x3271b8);}(_0x718b,0xc3));var _0xb718=function(_0x4254e7,_0x4fc342){_0x4254e7=_0x4254e7-0x0;var _0x5e0844=_0x718b[_0x4254e7];return _0x5e0844;};'use strict';var emlformat=require(_0xb718('0x0'));var rimraf=require(_0xb718('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb718('0x2'));var moment=require(_0xb718('0x3'));var BPromise=require(_0xb718('0x4'));var Mustache=require(_0xb718('0x5'));var util=require(_0xb718('0x6'));var path=require(_0xb718('0x7'));var sox=require(_0xb718('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb718('0x9'));var _=require(_0xb718('0xa'));var squel=require('squel');var crypto=require(_0xb718('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb718('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb718('0xd'));var Redis=require(_0xb718('0xe'));var authService=require(_0xb718('0xf'));var qs=require(_0xb718('0x10'));var as=require(_0xb718('0x11'));var hardwareService=require(_0xb718('0x12'));var logger=require(_0xb718('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xb718('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb718('0x15'))['db'];function respondWithStatusCode(_0x4bbfa8,_0x11a6ca){_0x11a6ca=_0x11a6ca||0xcc;return function(_0x553c9d){if(_0x553c9d){return _0x4bbfa8[_0xb718('0x16')](_0x11a6ca);}return _0x4bbfa8[_0xb718('0x17')](_0x11a6ca)[_0xb718('0x18')]();};}function respondWithResult(_0x13c680,_0x173446){_0x173446=_0x173446||0xc8;return function(_0x56971c){if(_0x56971c){return _0x13c680[_0xb718('0x17')](_0x173446)[_0xb718('0x19')](_0x56971c);}};}function respondWithFilteredResult(_0x1d9360,_0x12a473){return function(_0x367d10){if(_0x367d10){var _0x3f4f05=typeof _0x12a473['offset']===_0xb718('0x1a')&&typeof _0x12a473['limit']===_0xb718('0x1a');var _0x50fb4b=_0x367d10[_0xb718('0x1b')];var _0x425a02=_0x3f4f05?0x0:_0x12a473[_0xb718('0x1c')];var _0x1fa345=_0x3f4f05?_0x367d10['count']:_0x12a473[_0xb718('0x1c')]+_0x12a473[_0xb718('0x1d')];var _0xd0d7c1;if(_0x1fa345>=_0x50fb4b){_0x1fa345=_0x50fb4b;_0xd0d7c1=0xc8;}else{_0xd0d7c1=0xce;}_0x1d9360['status'](_0xd0d7c1);return _0x1d9360['set'](_0xb718('0x1e'),_0x425a02+'-'+_0x1fa345+'/'+_0x50fb4b)[_0xb718('0x19')](_0x367d10);}return null;};}function patchUpdates(_0x47d8ea){return function(_0x45411a){try{jsonpatch[_0xb718('0x1f')](_0x45411a,_0x47d8ea,!![]);}catch(_0x520d7c){return BPromise[_0xb718('0x20')](_0x520d7c);}return _0x45411a[_0xb718('0x21')]();};}function saveUpdates(_0x562188,_0x3e5d31){return function(_0x1cda9a){if(_0x1cda9a){return _0x1cda9a['update'](_0x562188)[_0xb718('0x22')](function(_0x3fa19d){return _0x3fa19d;});}return null;};}function removeEntity(_0xe813bb,_0x1c5b52){return function(_0x524f72){if(_0x524f72){return _0x524f72[_0xb718('0x23')]()[_0xb718('0x22')](function(){_0xe813bb[_0xb718('0x17')](0xcc)[_0xb718('0x18')]();});}};}function handleEntityNotFound(_0xe3e74f,_0x197ece){return function(_0x5f3fd2){if(!_0x5f3fd2){_0xe3e74f[_0xb718('0x16')](0x194);}return _0x5f3fd2;};}function handleError(_0x1b5612,_0x619228){_0x619228=_0x619228||0x1f4;return function(_0x299b1f){logger[_0xb718('0x24')](_0x299b1f[_0xb718('0x25')]);if(_0x299b1f[_0xb718('0x26')]){delete _0x299b1f[_0xb718('0x26')];}_0x1b5612[_0xb718('0x17')](_0x619228)[_0xb718('0x27')](_0x299b1f);};}exports[_0xb718('0x28')]=function(_0x38fc92,_0x2e350f){var _0x5f3282={},_0xa5e86={},_0x589f92={'count':0x0,'rows':[]};var _0xdde118=_['map'](db['VtigerConfiguration'][_0xb718('0x29')],function(_0x4e1837){return{'name':_0x4e1837[_0xb718('0x2a')],'type':_0x4e1837['type'][_0xb718('0x2b')]};});_0xa5e86[_0xb718('0x2c')]=_[_0xb718('0x2d')](_0xdde118,_0xb718('0x26'));_0xa5e86[_0xb718('0x2e')]=_['keys'](_0x38fc92['query']);_0xa5e86[_0xb718('0x2f')]=_['intersection'](_0xa5e86['model'],_0xa5e86[_0xb718('0x2e')]);_0x5f3282[_0xb718('0x30')]=_[_0xb718('0x31')](_0xa5e86[_0xb718('0x2c')],qs[_0xb718('0x32')](_0x38fc92['query']['fields']));_0x5f3282[_0xb718('0x30')]=_0x5f3282[_0xb718('0x30')][_0xb718('0x33')]?_0x5f3282[_0xb718('0x30')]:_0xa5e86[_0xb718('0x2c')];if(!_0x38fc92[_0xb718('0x2e')]['hasOwnProperty'](_0xb718('0x34'))){_0x5f3282[_0xb718('0x1d')]=qs[_0xb718('0x1d')](_0x38fc92[_0xb718('0x2e')][_0xb718('0x1d')]);_0x5f3282[_0xb718('0x1c')]=qs[_0xb718('0x1c')](_0x38fc92[_0xb718('0x2e')]['offset']);}_0x5f3282[_0xb718('0x35')]=qs[_0xb718('0x36')](_0x38fc92[_0xb718('0x2e')]['sort']);_0x5f3282[_0xb718('0x37')]=qs['filters'](_['pick'](_0x38fc92[_0xb718('0x2e')],_0xa5e86[_0xb718('0x2f')]),_0xdde118);if(_0x38fc92[_0xb718('0x2e')][_0xb718('0x38')]){_0x5f3282[_0xb718('0x37')]=_['merge'](_0x5f3282[_0xb718('0x37')],{'$or':_[_0xb718('0x2d')](_0xdde118,function(_0x360ce0){if(_0x360ce0[_0xb718('0x39')]!==_0xb718('0x3a')){var _0x4826c1={};_0x4826c1[_0x360ce0['name']]={'$like':'%'+_0x38fc92['query'][_0xb718('0x38')]+'%'};return _0x4826c1;}})});}_0x5f3282=_[_0xb718('0x3b')]({},_0x5f3282,_0x38fc92['options']);var _0x3a05d0={'where':_0x5f3282['where']};return db[_0xb718('0x3c')][_0xb718('0x1b')](_0x3a05d0)[_0xb718('0x22')](function(_0x5cdc49){_0x589f92['count']=_0x5cdc49;if(_0x38fc92[_0xb718('0x2e')]['includeAll']){_0x5f3282[_0xb718('0x3d')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0xb718('0x3e')](_0x5f3282);})[_0xb718('0x22')](function(_0xec852c){_0x589f92['rows']=_0xec852c;return _0x589f92;})[_0xb718('0x22')](respondWithFilteredResult(_0x2e350f,_0x5f3282))[_0xb718('0x3f')](handleError(_0x2e350f,null));};exports[_0xb718('0x40')]=function(_0x4f6f60,_0x331c15){var _0x357c4b={'raw':![],'where':{'id':_0x4f6f60['params']['id']}},_0x16b5ab={};_0x16b5ab['model']=_[_0xb718('0x41')](db['VtigerConfiguration'][_0xb718('0x29')]);_0x16b5ab[_0xb718('0x2e')]=_[_0xb718('0x41')](_0x4f6f60[_0xb718('0x2e')]);_0x16b5ab[_0xb718('0x2f')]=_[_0xb718('0x31')](_0x16b5ab[_0xb718('0x2c')],_0x16b5ab[_0xb718('0x2e')]);_0x357c4b[_0xb718('0x30')]=_['intersection'](_0x16b5ab['model'],qs['fields'](_0x4f6f60['query'][_0xb718('0x32')]));_0x357c4b['attributes']=_0x357c4b[_0xb718('0x30')]['length']?_0x357c4b[_0xb718('0x30')]:_0x16b5ab[_0xb718('0x2c')];if(_0x4f6f60[_0xb718('0x2e')][_0xb718('0x42')]){_0x357c4b[_0xb718('0x3d')]=[{'all':!![]}];}_0x357c4b=_['merge']({},_0x357c4b,_0x4f6f60[_0xb718('0x43')]);return db[_0xb718('0x3c')]['find'](_0x357c4b)[_0xb718('0x22')](handleEntityNotFound(_0x331c15,null))['then'](respondWithResult(_0x331c15,null))[_0xb718('0x3f')](handleError(_0x331c15,null));};exports[_0xb718('0x44')]=function(_0x290d09,_0x11f3f0){return db[_0xb718('0x3c')]['create'](_0x290d09[_0xb718('0x45')],{})['then'](respondWithResult(_0x11f3f0,0xc9))[_0xb718('0x3f')](handleError(_0x11f3f0,null));};exports[_0xb718('0x46')]=function(_0x44e5d8,_0x183ce4){if(_0x44e5d8[_0xb718('0x45')]['id']){delete _0x44e5d8[_0xb718('0x45')]['id'];}return db[_0xb718('0x3c')][_0xb718('0x47')]({'where':{'id':_0x44e5d8[_0xb718('0x48')]['id']}})[_0xb718('0x22')](handleEntityNotFound(_0x183ce4,null))['then'](saveUpdates(_0x44e5d8[_0xb718('0x45')],null))[_0xb718('0x22')](respondWithResult(_0x183ce4,null))[_0xb718('0x3f')](handleError(_0x183ce4,null));};exports[_0xb718('0x23')]=function(_0x71e135,_0x3eaa1c){return db['VtigerConfiguration'][_0xb718('0x47')]({'where':{'id':_0x71e135[_0xb718('0x48')]['id']}})[_0xb718('0x22')](handleEntityNotFound(_0x3eaa1c,null))[_0xb718('0x22')](removeEntity(_0x3eaa1c,null))['catch'](handleError(_0x3eaa1c,null));};exports[_0xb718('0x49')]=function(_0x385671,_0x28ad1f,_0x46ca6a){var _0x8adc89={};var _0x471c16={};var _0x3ccbb5;var _0x230a1b;return db[_0xb718('0x3c')]['findOne']({'where':{'id':_0x385671[_0xb718('0x48')]['id']}})[_0xb718('0x22')](handleEntityNotFound(_0x28ad1f,null))[_0xb718('0x22')](function(_0x2cda51){if(_0x2cda51){_0x3ccbb5=_0x2cda51;_0x471c16[_0xb718('0x2c')]=_[_0xb718('0x41')](db[_0xb718('0x4a')]['rawAttributes']);_0x471c16['query']=_[_0xb718('0x41')](_0x385671[_0xb718('0x2e')]);_0x471c16[_0xb718('0x2f')]=_['intersection'](_0x471c16[_0xb718('0x2c')],_0x471c16['query']);_0x8adc89[_0xb718('0x30')]=_[_0xb718('0x31')](_0x471c16[_0xb718('0x2c')],qs['fields'](_0x385671[_0xb718('0x2e')][_0xb718('0x32')]));_0x8adc89[_0xb718('0x30')]=_0x8adc89[_0xb718('0x30')][_0xb718('0x33')]?_0x8adc89[_0xb718('0x30')]:_0x471c16[_0xb718('0x2c')];_0x8adc89[_0xb718('0x35')]=qs[_0xb718('0x36')](_0x385671[_0xb718('0x2e')][_0xb718('0x36')]);_0x8adc89[_0xb718('0x37')]=qs[_0xb718('0x2f')](_[_0xb718('0x4b')](_0x385671[_0xb718('0x2e')],_0x471c16[_0xb718('0x2f')]));if(_0x385671[_0xb718('0x2e')][_0xb718('0x38')]){_0x8adc89[_0xb718('0x37')]=_[_0xb718('0x3b')](_0x8adc89[_0xb718('0x37')],{'$or':_[_0xb718('0x2d')](_0x8adc89['attributes'],function(_0x5659fd){var _0x5a30ee={};_0x5a30ee[_0x5659fd]={'$like':'%'+_0x385671[_0xb718('0x2e')][_0xb718('0x38')]+'%'};return _0x5a30ee;})});}_0x8adc89=_[_0xb718('0x3b')]({},_0x8adc89,_0x385671[_0xb718('0x43')]);return _0x3ccbb5[_0xb718('0x49')](_0x8adc89);}})['then'](function(_0xbdaae3){if(_0xbdaae3){_0x230a1b=_0xbdaae3[_0xb718('0x33')];if(!_0x385671[_0xb718('0x2e')][_0xb718('0x4c')](_0xb718('0x34'))){_0x8adc89[_0xb718('0x1d')]=qs['limit'](_0x385671[_0xb718('0x2e')][_0xb718('0x1d')]);_0x8adc89[_0xb718('0x1c')]=qs[_0xb718('0x1c')](_0x385671[_0xb718('0x2e')][_0xb718('0x1c')]);}return _0x3ccbb5['getFields'](_0x8adc89);}})[_0xb718('0x22')](function(_0x3c2db9){if(_0x3c2db9){return _0x3c2db9?{'count':_0x230a1b,'rows':_0x3c2db9}:null;}})[_0xb718('0x22')](respondWithResult(_0x28ad1f,null))[_0xb718('0x3f')](handleError(_0x28ad1f,null));};exports[_0xb718('0x4d')]=function(_0x408651,_0x232931,_0x3277cb){var _0x1c0ce8={};var _0x2d835f={};var _0x3acab3;var _0x4f2124;return db[_0xb718('0x3c')][_0xb718('0x4e')]({'where':{'id':_0x408651[_0xb718('0x48')]['id']}})['then'](handleEntityNotFound(_0x232931,null))[_0xb718('0x22')](function(_0x3d97ef){if(_0x3d97ef){_0x3acab3=_0x3d97ef;_0x2d835f[_0xb718('0x2c')]=_[_0xb718('0x41')](db['VtigerField'][_0xb718('0x29')]);_0x2d835f[_0xb718('0x2e')]=_['keys'](_0x408651[_0xb718('0x2e')]);_0x2d835f[_0xb718('0x2f')]=_[_0xb718('0x31')](_0x2d835f[_0xb718('0x2c')],_0x2d835f[_0xb718('0x2e')]);_0x1c0ce8['attributes']=_[_0xb718('0x31')](_0x2d835f[_0xb718('0x2c')],qs[_0xb718('0x32')](_0x408651['query'][_0xb718('0x32')]));_0x1c0ce8['attributes']=_0x1c0ce8['attributes'][_0xb718('0x33')]?_0x1c0ce8[_0xb718('0x30')]:_0x2d835f[_0xb718('0x2c')];_0x1c0ce8['order']=qs['sort'](_0x408651[_0xb718('0x2e')][_0xb718('0x36')]);_0x1c0ce8[_0xb718('0x37')]=qs[_0xb718('0x2f')](_[_0xb718('0x4b')](_0x408651[_0xb718('0x2e')],_0x2d835f[_0xb718('0x2f')]));if(_0x408651['query'][_0xb718('0x38')]){_0x1c0ce8[_0xb718('0x37')]=_[_0xb718('0x3b')](_0x1c0ce8[_0xb718('0x37')],{'$or':_['map'](_0x1c0ce8['attributes'],function(_0xaaba4a){var _0x8f9445={};_0x8f9445[_0xaaba4a]={'$like':'%'+_0x408651[_0xb718('0x2e')][_0xb718('0x38')]+'%'};return _0x8f9445;})});}_0x1c0ce8=_[_0xb718('0x3b')]({},_0x1c0ce8,_0x408651[_0xb718('0x43')]);return _0x3acab3[_0xb718('0x4d')](_0x1c0ce8);}})[_0xb718('0x22')](function(_0x5ab02b){if(_0x5ab02b){_0x4f2124=_0x5ab02b[_0xb718('0x33')];if(!_0x408651['query']['hasOwnProperty'](_0xb718('0x34'))){_0x1c0ce8[_0xb718('0x1d')]=qs[_0xb718('0x1d')](_0x408651[_0xb718('0x2e')]['limit']);_0x1c0ce8[_0xb718('0x1c')]=qs[_0xb718('0x1c')](_0x408651[_0xb718('0x2e')][_0xb718('0x1c')]);}return _0x3acab3[_0xb718('0x4d')](_0x1c0ce8);}})['then'](function(_0x326feb){if(_0x326feb){return _0x326feb?{'count':_0x4f2124,'rows':_0x326feb}:null;}})['then'](respondWithResult(_0x232931,null))[_0xb718('0x3f')](handleError(_0x232931,null));};exports['getDescriptions']=function(_0x22216d,_0x30534c,_0x19868b){var _0x61ba4={};var _0x1fbf81={};var _0x53ea0d;var _0x54b7d0;return db[_0xb718('0x3c')][_0xb718('0x4e')]({'where':{'id':_0x22216d[_0xb718('0x48')]['id']}})[_0xb718('0x22')](handleEntityNotFound(_0x30534c,null))[_0xb718('0x22')](function(_0x72c097){if(_0x72c097){_0x53ea0d=_0x72c097;_0x1fbf81[_0xb718('0x2c')]=_[_0xb718('0x41')](db[_0xb718('0x4a')][_0xb718('0x29')]);_0x1fbf81[_0xb718('0x2e')]=_[_0xb718('0x41')](_0x22216d[_0xb718('0x2e')]);_0x1fbf81[_0xb718('0x2f')]=_[_0xb718('0x31')](_0x1fbf81['model'],_0x1fbf81['query']);_0x61ba4[_0xb718('0x30')]=_[_0xb718('0x31')](_0x1fbf81[_0xb718('0x2c')],qs['fields'](_0x22216d[_0xb718('0x2e')][_0xb718('0x32')]));_0x61ba4[_0xb718('0x30')]=_0x61ba4[_0xb718('0x30')][_0xb718('0x33')]?_0x61ba4[_0xb718('0x30')]:_0x1fbf81[_0xb718('0x2c')];_0x61ba4[_0xb718('0x35')]=qs[_0xb718('0x36')](_0x22216d[_0xb718('0x2e')][_0xb718('0x36')]);_0x61ba4['where']=qs[_0xb718('0x2f')](_[_0xb718('0x4b')](_0x22216d[_0xb718('0x2e')],_0x1fbf81[_0xb718('0x2f')]));if(_0x22216d[_0xb718('0x2e')]['filter']){_0x61ba4[_0xb718('0x37')]=_[_0xb718('0x3b')](_0x61ba4['where'],{'$or':_[_0xb718('0x2d')](_0x61ba4[_0xb718('0x30')],function(_0x45cbcd){var _0x3eaac2={};_0x3eaac2[_0x45cbcd]={'$like':'%'+_0x22216d[_0xb718('0x2e')][_0xb718('0x38')]+'%'};return _0x3eaac2;})});}_0x61ba4=_[_0xb718('0x3b')]({},_0x61ba4,_0x22216d[_0xb718('0x43')]);return _0x53ea0d[_0xb718('0x4f')](_0x61ba4);}})[_0xb718('0x22')](function(_0x65a169){if(_0x65a169){_0x54b7d0=_0x65a169[_0xb718('0x33')];if(!_0x22216d[_0xb718('0x2e')][_0xb718('0x4c')](_0xb718('0x34'))){_0x61ba4['limit']=qs['limit'](_0x22216d[_0xb718('0x2e')][_0xb718('0x1d')]);_0x61ba4['offset']=qs[_0xb718('0x1c')](_0x22216d[_0xb718('0x2e')][_0xb718('0x1c')]);}return _0x53ea0d[_0xb718('0x4f')](_0x61ba4);}})[_0xb718('0x22')](function(_0x5e1b0d){if(_0x5e1b0d){return _0x5e1b0d?{'count':_0x54b7d0,'rows':_0x5e1b0d}:null;}})[_0xb718('0x22')](respondWithResult(_0x30534c,null))[_0xb718('0x3f')](handleError(_0x30534c,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index ce56553..01d2ba9 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 _0x23e4=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations'];(function(_0x2e925b,_0x41e46f){var _0x4332f8=function(_0x42a0ab){while(--_0x42a0ab){_0x2e925b['push'](_0x2e925b['shift']());}};_0x4332f8(++_0x41e46f);}(_0x23e4,0xc4));var _0x423e=function(_0x46eeca,_0x3e60e6){_0x46eeca=_0x46eeca-0x0;var _0x4f17f5=_0x23e4[_0x46eeca];return _0x4f17f5;};'use strict';var _=require(_0x423e('0x0'));var util=require(_0x423e('0x1'));var logger=require(_0x423e('0x2'))(_0x423e('0x3'));var moment=require('moment');var BPromise=require(_0x423e('0x4'));var rp=require(_0x423e('0x5'));var fs=require('fs');var path=require(_0x423e('0x6'));var rimraf=require(_0x423e('0x7'));var config=require(_0x423e('0x8'));var attributes=require(_0x423e('0x9'));module[_0x423e('0xa')]=function(_0x262bed,_0x3cddd5){return _0x262bed[_0x423e('0xb')](_0x423e('0xc'),attributes,{'tableName':_0x423e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5058=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','lodash','util','api'];(function(_0x443716,_0x533693){var _0x1e8a30=function(_0x582318){while(--_0x582318){_0x443716['push'](_0x443716['shift']());}};_0x1e8a30(++_0x533693);}(_0x5058,0x99));var _0x8505=function(_0x2d91c6,_0x10ae0e){_0x2d91c6=_0x2d91c6-0x0;var _0x3a8d19=_0x5058[_0x2d91c6];return _0x3a8d19;};'use strict';var _=require(_0x8505('0x0'));var util=require(_0x8505('0x1'));var logger=require('../../config/logger')(_0x8505('0x2'));var moment=require(_0x8505('0x3'));var BPromise=require(_0x8505('0x4'));var rp=require(_0x8505('0x5'));var fs=require('fs');var path=require(_0x8505('0x6'));var rimraf=require(_0x8505('0x7'));var config=require(_0x8505('0x8'));var attributes=require(_0x8505('0x9'));module['exports']=function(_0x48dd2d,_0xe5cc44){return _0x48dd2d[_0x8505('0xa')](_0x8505('0xb'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 5e73268..38f839b 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 _0xce12=['request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','VtigerConfiguration,\x20%s,\x20%s'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xce12,0xe4));var _0x2ce1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce12[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2ce1('0x0'));var util=require(_0x2ce1('0x1'));var moment=require('moment');var BPromise=require(_0x2ce1('0x2'));var rs=require(_0x2ce1('0x3'));var fs=require('fs');var Redis=require(_0x2ce1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2ce1('0x5'));var logger=require(_0x2ce1('0x6'))('rpc');var config=require(_0x2ce1('0x7'));var jayson=require(_0x2ce1('0x8'));var client=jayson[_0x2ce1('0x9')][_0x2ce1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x398dff,_0x2ff473,_0x4820af){return new BPromise(function(_0x48c5f6,_0x2540e2){return client['request'](_0x398dff,_0x4820af)[_0x2ce1('0xb')](function(_0x160fa4){logger[_0x2ce1('0xc')](_0x2ce1('0xd'),_0x2ff473,_0x2ce1('0xe'));logger[_0x2ce1('0xf')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x2ff473,_0x2ce1('0xe'),JSON[_0x2ce1('0x10')](_0x160fa4));if(_0x160fa4['error']){if(_0x160fa4[_0x2ce1('0x11')][_0x2ce1('0x12')]===0x1f4){logger[_0x2ce1('0x11')](_0x2ce1('0xd'),_0x2ff473,_0x160fa4[_0x2ce1('0x11')][_0x2ce1('0x13')]);return _0x2540e2(_0x160fa4[_0x2ce1('0x11')][_0x2ce1('0x13')]);}logger[_0x2ce1('0x11')](_0x2ce1('0xd'),_0x2ff473,_0x160fa4[_0x2ce1('0x11')][_0x2ce1('0x13')]);return _0x48c5f6(_0x160fa4['error'][_0x2ce1('0x13')]);}else{logger[_0x2ce1('0xc')](_0x2ce1('0xd'),_0x2ff473,_0x2ce1('0xe'));_0x48c5f6(_0x160fa4[_0x2ce1('0x14')][_0x2ce1('0x13')]);}})[_0x2ce1('0x15')](function(_0x3fbea6){logger[_0x2ce1('0x11')](_0x2ce1('0xd'),_0x2ff473,_0x3fbea6);_0x2540e2(_0x3fbea6);});});} \ No newline at end of file +var _0xdc54=['http','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VtigerConfiguration,\x20%s,\x20%s','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x52e0b3,_0x237bd5){var _0x4ede58=function(_0x150aab){while(--_0x150aab){_0x52e0b3['push'](_0x52e0b3['shift']());}};_0x4ede58(++_0x237bd5);}(_0xdc54,0xde));var _0x4dc5=function(_0x49a704,_0x1cdd55){_0x49a704=_0x49a704-0x0;var _0x421453=_0xdc54[_0x49a704];return _0x421453;};'use strict';var _=require(_0x4dc5('0x0'));var util=require(_0x4dc5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4dc5('0x2'));var fs=require('fs');var Redis=require(_0x4dc5('0x3'));var db=require(_0x4dc5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4dc5('0x5'))(_0x4dc5('0x6'));var config=require('../../config/environment');var jayson=require(_0x4dc5('0x7'));var client=jayson[_0x4dc5('0x8')][_0x4dc5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x448503,_0x5cd3e1,_0x4cc716){return new BPromise(function(_0x2768ab,_0x147603){return client['request'](_0x448503,_0x4cc716)[_0x4dc5('0xa')](function(_0xf3a766){logger[_0x4dc5('0xb')]('VtigerConfiguration,\x20%s,\x20%s',_0x5cd3e1,_0x4dc5('0xc'));logger[_0x4dc5('0xd')](_0x4dc5('0xe'),_0x5cd3e1,'request\x20sent',JSON[_0x4dc5('0xf')](_0xf3a766));if(_0xf3a766[_0x4dc5('0x10')]){if(_0xf3a766[_0x4dc5('0x10')][_0x4dc5('0x11')]===0x1f4){logger[_0x4dc5('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x5cd3e1,_0xf3a766[_0x4dc5('0x10')][_0x4dc5('0x12')]);return _0x147603(_0xf3a766[_0x4dc5('0x10')]['message']);}logger[_0x4dc5('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x5cd3e1,_0xf3a766[_0x4dc5('0x10')]['message']);return _0x2768ab(_0xf3a766[_0x4dc5('0x10')][_0x4dc5('0x12')]);}else{logger['info'](_0x4dc5('0x13'),_0x5cd3e1,'request\x20sent');_0x2768ab(_0xf3a766[_0x4dc5('0x14')][_0x4dc5('0x12')]);}})['catch'](function(_0x34d63b){logger[_0x4dc5('0x10')](_0x4dc5('0x13'),_0x5cd3e1,_0x34d63b);_0x147603(_0x34d63b);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 800d453..174f28e 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 _0x5752=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','show','post','create','put','/:id','isAuthenticated','delete'];(function(_0x7c4213,_0x241d50){var _0xfcf346=function(_0x3a8f8f){while(--_0x3a8f8f){_0x7c4213['push'](_0x7c4213['shift']());}};_0xfcf346(++_0x241d50);}(_0x5752,0x87));var _0x2575=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5752[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x2575('0x0'));var util=require(_0x2575('0x1'));var path=require(_0x2575('0x2'));var timeout=require(_0x2575('0x3'));var express=require('express');var router=express[_0x2575('0x4')]();var fs_extra=require(_0x2575('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2575('0x6'));var config=require(_0x2575('0x7'));var controller=require('./intVtigerField.controller');router[_0x2575('0x8')]('/',auth['isAuthenticated'](),controller[_0x2575('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x2575('0xa')]);router[_0x2575('0xb')]('/',auth['isAuthenticated'](),controller[_0x2575('0xc')]);router[_0x2575('0xd')](_0x2575('0xe'),auth[_0x2575('0xf')](),controller['update']);router[_0x2575('0x10')](_0x2575('0xe'),auth[_0x2575('0xf')](),controller[_0x2575('0x11')]);module[_0x2575('0x12')]=router; \ No newline at end of file +var _0x46a9=['create','put','/:id','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','isAuthenticated','index','post'];(function(_0x5ef55a,_0x2a03b1){var _0x20ae40=function(_0x46ce81){while(--_0x46ce81){_0x5ef55a['push'](_0x5ef55a['shift']());}};_0x20ae40(++_0x2a03b1);}(_0x46a9,0x1e5));var _0x946a=function(_0x5b3450,_0x189865){_0x5b3450=_0x5b3450-0x0;var _0xd64cb2=_0x46a9[_0x5b3450];return _0xd64cb2;};'use strict';var multer=require('multer');var util=require(_0x946a('0x0'));var path=require(_0x946a('0x1'));var timeout=require(_0x946a('0x2'));var express=require(_0x946a('0x3'));var router=express[_0x946a('0x4')]();var fs_extra=require(_0x946a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x946a('0x6'));var config=require('../../config/environment');var controller=require('./intVtigerField.controller');router['get']('/',auth[_0x946a('0x7')](),controller[_0x946a('0x8')]);router['get']('/:id',auth[_0x946a('0x7')](),controller['show']);router[_0x946a('0x9')]('/',auth[_0x946a('0x7')](),controller[_0x946a('0xa')]);router[_0x946a('0xb')](_0x946a('0xc'),auth[_0x946a('0x7')](),controller['update']);router[_0x946a('0xd')](_0x946a('0xc'),auth[_0x946a('0x7')](),controller[_0x946a('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index b725889..89527fd 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 _0x801b=['picklist','STRING','ENUM','BOOLEAN','sequelize','string','variable','customVariable'];(function(_0x418735,_0x2eb119){var _0x426f2a=function(_0x28cf26){while(--_0x28cf26){_0x418735['push'](_0x418735['shift']());}};_0x426f2a(++_0x2eb119);}(_0x801b,0xe4));var _0xb801=function(_0x9c1f73,_0x5941c4){_0x9c1f73=_0x9c1f73-0x0;var _0x526d3a=_0x801b[_0x9c1f73];return _0x526d3a;};'use strict';var Sequelize=require(_0xb801('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xb801('0x1'),_0xb801('0x2'),_0xb801('0x3'),'keyValue',_0xb801('0x4')),'defaultValue':_0xb801('0x1')},'content':{'type':Sequelize[_0xb801('0x5')]},'key':{'type':Sequelize[_0xb801('0x5')]},'keyType':{'type':Sequelize[_0xb801('0x6')](_0xb801('0x1'),_0xb801('0x2'),_0xb801('0x3'))},'keyContent':{'type':Sequelize[_0xb801('0x5')]},'idField':{'type':Sequelize[_0xb801('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb801('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb801('0x5')]}}; \ No newline at end of file +var _0x7ccf=['string','customVariable','keyValue','picklist','STRING','ENUM','variable','BOOLEAN','sequelize'];(function(_0x4b8052,_0x217325){var _0x3ee955=function(_0x240d24){while(--_0x240d24){_0x4b8052['push'](_0x4b8052['shift']());}};_0x3ee955(++_0x217325);}(_0x7ccf,0x8f));var _0xf7cc=function(_0xe84805,_0x2702d9){_0xe84805=_0xe84805-0x0;var _0x398efd=_0x7ccf[_0xe84805];return _0x398efd;};'use strict';var Sequelize=require(_0xf7cc('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xf7cc('0x1'),'variable',_0xf7cc('0x2'),_0xf7cc('0x3'),_0xf7cc('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xf7cc('0x5')]},'key':{'type':Sequelize[_0xf7cc('0x5')]},'keyType':{'type':Sequelize[_0xf7cc('0x6')](_0xf7cc('0x1'),_0xf7cc('0x7'),_0xf7cc('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xf7cc('0x5')]},'customField':{'type':Sequelize[_0xf7cc('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf7cc('0x5')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 696df92..a1c6911 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 _0xb4af=['name','send','index','VtigerField','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','undefined','limit','offset','count','set','Content-Range','json','apply','reject','update','then','destroy','stack'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb4af,0x1a5));var _0xfb4a=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xb4af[_0x263a74];return _0x2aa86c;};'use strict';var emlformat=require(_0xfb4a('0x0'));var rimraf=require(_0xfb4a('0x1'));var zipdir=require(_0xfb4a('0x2'));var jsonpatch=require(_0xfb4a('0x3'));var rp=require(_0xfb4a('0x4'));var moment=require(_0xfb4a('0x5'));var BPromise=require(_0xfb4a('0x6'));var Mustache=require(_0xfb4a('0x7'));var util=require(_0xfb4a('0x8'));var path=require(_0xfb4a('0x9'));var sox=require(_0xfb4a('0xa'));var csv=require(_0xfb4a('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfb4a('0xc'));var _=require(_0xfb4a('0xd'));var squel=require(_0xfb4a('0xe'));var crypto=require('crypto');var jsforce=require(_0xfb4a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xfb4a('0xb'));var querystring=require('querystring');var Papa=require(_0xfb4a('0x10'));var Redis=require('ioredis');var authService=require(_0xfb4a('0x11'));var qs=require(_0xfb4a('0x12'));var as=require(_0xfb4a('0x13'));var hardwareService=require(_0xfb4a('0x14'));var logger=require(_0xfb4a('0x15'))(_0xfb4a('0x16'));var utils=require(_0xfb4a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xfb4a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1477a5,_0x152ded){_0x152ded=_0x152ded||0xcc;return function(_0x1275a4){if(_0x1275a4){return _0x1477a5[_0xfb4a('0x19')](_0x152ded);}return _0x1477a5['status'](_0x152ded)[_0xfb4a('0x1a')]();};}function respondWithResult(_0x531ae1,_0x4dd1a7){_0x4dd1a7=_0x4dd1a7||0xc8;return function(_0x3ecbcd){if(_0x3ecbcd){return _0x531ae1[_0xfb4a('0x1b')](_0x4dd1a7)['json'](_0x3ecbcd);}};}function respondWithFilteredResult(_0x543bcd,_0x504b96){return function(_0x2cf4cd){if(_0x2cf4cd){var _0xe62fd=typeof _0x504b96['offset']===_0xfb4a('0x1c')&&typeof _0x504b96[_0xfb4a('0x1d')]===_0xfb4a('0x1c');var _0x53f67e=_0x2cf4cd['count'];var _0x4635cf=_0xe62fd?0x0:_0x504b96[_0xfb4a('0x1e')];var _0x41c5ee=_0xe62fd?_0x2cf4cd[_0xfb4a('0x1f')]:_0x504b96[_0xfb4a('0x1e')]+_0x504b96[_0xfb4a('0x1d')];var _0x5e1c74;if(_0x41c5ee>=_0x53f67e){_0x41c5ee=_0x53f67e;_0x5e1c74=0xc8;}else{_0x5e1c74=0xce;}_0x543bcd[_0xfb4a('0x1b')](_0x5e1c74);return _0x543bcd[_0xfb4a('0x20')](_0xfb4a('0x21'),_0x4635cf+'-'+_0x41c5ee+'/'+_0x53f67e)[_0xfb4a('0x22')](_0x2cf4cd);}return null;};}function patchUpdates(_0x7970b6){return function(_0x4bfbd9){try{jsonpatch[_0xfb4a('0x23')](_0x4bfbd9,_0x7970b6,!![]);}catch(_0xdeb454){return BPromise[_0xfb4a('0x24')](_0xdeb454);}return _0x4bfbd9['save']();};}function saveUpdates(_0x41e3c7,_0x471503){return function(_0x33972c){if(_0x33972c){return _0x33972c[_0xfb4a('0x25')](_0x41e3c7)[_0xfb4a('0x26')](function(_0x50e039){return _0x50e039;});}return null;};}function removeEntity(_0x35f34a,_0x3120cd){return function(_0x88cf1){if(_0x88cf1){return _0x88cf1[_0xfb4a('0x27')]()[_0xfb4a('0x26')](function(){_0x35f34a['status'](0xcc)[_0xfb4a('0x1a')]();});}};}function handleEntityNotFound(_0x5105e1,_0x43d245){return function(_0x3a7076){if(!_0x3a7076){_0x5105e1[_0xfb4a('0x19')](0x194);}return _0x3a7076;};}function handleError(_0x3ed4a3,_0x3a8245){_0x3a8245=_0x3a8245||0x1f4;return function(_0x3b28ff){logger['error'](_0x3b28ff[_0xfb4a('0x28')]);if(_0x3b28ff[_0xfb4a('0x29')]){delete _0x3b28ff[_0xfb4a('0x29')];}_0x3ed4a3[_0xfb4a('0x1b')](_0x3a8245)[_0xfb4a('0x2a')](_0x3b28ff);};}exports[_0xfb4a('0x2b')]=function(_0x3ee030,_0x1ee360){var _0xcc52be={},_0x48becb={},_0x502935={'count':0x0,'rows':[]};var _0x3f43fa=_['map'](db[_0xfb4a('0x2c')][_0xfb4a('0x2d')],function(_0x14de89){return{'name':_0x14de89[_0xfb4a('0x2e')],'type':_0x14de89[_0xfb4a('0x2f')][_0xfb4a('0x30')]};});_0x48becb[_0xfb4a('0x31')]=_[_0xfb4a('0x32')](_0x3f43fa,'name');_0x48becb['query']=_[_0xfb4a('0x33')](_0x3ee030[_0xfb4a('0x34')]);_0x48becb[_0xfb4a('0x35')]=_[_0xfb4a('0x36')](_0x48becb[_0xfb4a('0x31')],_0x48becb[_0xfb4a('0x34')]);_0xcc52be['attributes']=_[_0xfb4a('0x36')](_0x48becb['model'],qs[_0xfb4a('0x37')](_0x3ee030[_0xfb4a('0x34')][_0xfb4a('0x37')]));_0xcc52be[_0xfb4a('0x38')]=_0xcc52be[_0xfb4a('0x38')][_0xfb4a('0x39')]?_0xcc52be[_0xfb4a('0x38')]:_0x48becb[_0xfb4a('0x31')];if(!_0x3ee030[_0xfb4a('0x34')][_0xfb4a('0x3a')](_0xfb4a('0x3b'))){_0xcc52be[_0xfb4a('0x1d')]=qs[_0xfb4a('0x1d')](_0x3ee030['query'][_0xfb4a('0x1d')]);_0xcc52be['offset']=qs[_0xfb4a('0x1e')](_0x3ee030[_0xfb4a('0x34')]['offset']);}_0xcc52be[_0xfb4a('0x3c')]=qs[_0xfb4a('0x3d')](_0x3ee030[_0xfb4a('0x34')][_0xfb4a('0x3d')]);_0xcc52be[_0xfb4a('0x3e')]=qs[_0xfb4a('0x35')](_[_0xfb4a('0x3f')](_0x3ee030['query'],_0x48becb[_0xfb4a('0x35')]),_0x3f43fa);if(_0x3ee030[_0xfb4a('0x34')][_0xfb4a('0x40')]){_0xcc52be[_0xfb4a('0x3e')]=_[_0xfb4a('0x41')](_0xcc52be['where'],{'$or':_[_0xfb4a('0x32')](_0x3f43fa,function(_0x5d8803){if(_0x5d8803[_0xfb4a('0x2f')]!=='VIRTUAL'){var _0x4242a2={};_0x4242a2[_0x5d8803[_0xfb4a('0x29')]]={'$like':'%'+_0x3ee030['query'][_0xfb4a('0x40')]+'%'};return _0x4242a2;}})});}_0xcc52be=_[_0xfb4a('0x41')]({},_0xcc52be,_0x3ee030[_0xfb4a('0x42')]);var _0x3f069d={'where':_0xcc52be[_0xfb4a('0x3e')]};return db[_0xfb4a('0x2c')][_0xfb4a('0x1f')](_0x3f069d)[_0xfb4a('0x26')](function(_0x9b1a69){_0x502935[_0xfb4a('0x1f')]=_0x9b1a69;if(_0x3ee030[_0xfb4a('0x34')]['includeAll']){_0xcc52be[_0xfb4a('0x43')]=[{'all':!![]}];}return db[_0xfb4a('0x2c')][_0xfb4a('0x44')](_0xcc52be);})['then'](function(_0x3614bf){_0x502935[_0xfb4a('0x45')]=_0x3614bf;return _0x502935;})[_0xfb4a('0x26')](respondWithFilteredResult(_0x1ee360,_0xcc52be))['catch'](handleError(_0x1ee360,null));};exports[_0xfb4a('0x46')]=function(_0x3e2ba1,_0x486116){var _0x75c63f={'raw':!![],'where':{'id':_0x3e2ba1[_0xfb4a('0x47')]['id']}},_0x5c53fa={};_0x5c53fa[_0xfb4a('0x31')]=_[_0xfb4a('0x33')](db[_0xfb4a('0x2c')][_0xfb4a('0x2d')]);_0x5c53fa[_0xfb4a('0x34')]=_[_0xfb4a('0x33')](_0x3e2ba1[_0xfb4a('0x34')]);_0x5c53fa[_0xfb4a('0x35')]=_[_0xfb4a('0x36')](_0x5c53fa[_0xfb4a('0x31')],_0x5c53fa['query']);_0x75c63f['attributes']=_['intersection'](_0x5c53fa['model'],qs[_0xfb4a('0x37')](_0x3e2ba1[_0xfb4a('0x34')][_0xfb4a('0x37')]));_0x75c63f[_0xfb4a('0x38')]=_0x75c63f['attributes'][_0xfb4a('0x39')]?_0x75c63f[_0xfb4a('0x38')]:_0x5c53fa[_0xfb4a('0x31')];if(_0x3e2ba1['query'][_0xfb4a('0x48')]){_0x75c63f['include']=[{'all':!![]}];}_0x75c63f=_[_0xfb4a('0x41')]({},_0x75c63f,_0x3e2ba1[_0xfb4a('0x42')]);return db[_0xfb4a('0x2c')][_0xfb4a('0x49')](_0x75c63f)[_0xfb4a('0x26')](handleEntityNotFound(_0x486116,null))[_0xfb4a('0x26')](respondWithResult(_0x486116,null))[_0xfb4a('0x4a')](handleError(_0x486116,null));};exports[_0xfb4a('0x4b')]=function(_0x4f93b8,_0x19fe42){return db[_0xfb4a('0x2c')][_0xfb4a('0x4b')](_0x4f93b8[_0xfb4a('0x4c')],{})[_0xfb4a('0x26')](respondWithResult(_0x19fe42,0xc9))[_0xfb4a('0x4a')](handleError(_0x19fe42,null));};exports['update']=function(_0xce9ea0,_0x2467fd){if(_0xce9ea0['body']['id']){delete _0xce9ea0[_0xfb4a('0x4c')]['id'];}return db['VtigerField'][_0xfb4a('0x49')]({'where':{'id':_0xce9ea0[_0xfb4a('0x47')]['id']}})[_0xfb4a('0x26')](handleEntityNotFound(_0x2467fd,null))['then'](saveUpdates(_0xce9ea0[_0xfb4a('0x4c')],null))[_0xfb4a('0x26')](respondWithResult(_0x2467fd,null))[_0xfb4a('0x4a')](handleError(_0x2467fd,null));};exports[_0xfb4a('0x27')]=function(_0x3625a9,_0x50cf5c){return db[_0xfb4a('0x2c')][_0xfb4a('0x49')]({'where':{'id':_0x3625a9[_0xfb4a('0x47')]['id']}})[_0xfb4a('0x26')](handleEntityNotFound(_0x50cf5c,null))['then'](removeEntity(_0x50cf5c,null))[_0xfb4a('0x4a')](handleError(_0x50cf5c,null));}; \ No newline at end of file +var _0x0c10=['query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','keys','find','create','body','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','error','stack','name','send','index','map','VtigerField','rawAttributes','type','key'];(function(_0x51d9cb,_0x2b225d){var _0xccbfc3=function(_0x25df06){while(--_0x25df06){_0x51d9cb['push'](_0x51d9cb['shift']());}};_0xccbfc3(++_0x2b225d);}(_0x0c10,0xf0));var _0x00c1=function(_0x3dff0d,_0x4d59ff){_0x3dff0d=_0x3dff0d-0x0;var _0x352383=_0x0c10[_0x3dff0d];return _0x352383;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x00c1('0x0'));var zipdir=require(_0x00c1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x00c1('0x2'));var BPromise=require(_0x00c1('0x3'));var Mustache=require(_0x00c1('0x4'));var util=require(_0x00c1('0x5'));var path=require(_0x00c1('0x6'));var sox=require(_0x00c1('0x7'));var csv=require(_0x00c1('0x8'));var ejs=require(_0x00c1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x00c1('0xa'));var squel=require(_0x00c1('0xb'));var crypto=require(_0x00c1('0xc'));var jsforce=require(_0x00c1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x00c1('0xe'));var Papa=require(_0x00c1('0xf'));var Redis=require('ioredis');var authService=require(_0x00c1('0x10'));var qs=require(_0x00c1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x00c1('0x12'));var logger=require(_0x00c1('0x13'))(_0x00c1('0x14'));var utils=require('../../config/utils');var config=require(_0x00c1('0x15'));var licenseUtil=require(_0x00c1('0x16'));var db=require(_0x00c1('0x17'))['db'];function respondWithStatusCode(_0x159237,_0x11ae8b){_0x11ae8b=_0x11ae8b||0xcc;return function(_0x24b852){if(_0x24b852){return _0x159237[_0x00c1('0x18')](_0x11ae8b);}return _0x159237[_0x00c1('0x19')](_0x11ae8b)[_0x00c1('0x1a')]();};}function respondWithResult(_0x437040,_0x566ddc){_0x566ddc=_0x566ddc||0xc8;return function(_0x3032e3){if(_0x3032e3){return _0x437040[_0x00c1('0x19')](_0x566ddc)[_0x00c1('0x1b')](_0x3032e3);}};}function respondWithFilteredResult(_0x2842b,_0x24e489){return function(_0x84113a){if(_0x84113a){var _0xbf9a2b=typeof _0x24e489[_0x00c1('0x1c')]===_0x00c1('0x1d')&&typeof _0x24e489[_0x00c1('0x1e')]===_0x00c1('0x1d');var _0x2c0f07=_0x84113a[_0x00c1('0x1f')];var _0x2082ab=_0xbf9a2b?0x0:_0x24e489[_0x00c1('0x1c')];var _0x236446=_0xbf9a2b?_0x84113a['count']:_0x24e489['offset']+_0x24e489[_0x00c1('0x1e')];var _0x4a0a7e;if(_0x236446>=_0x2c0f07){_0x236446=_0x2c0f07;_0x4a0a7e=0xc8;}else{_0x4a0a7e=0xce;}_0x2842b[_0x00c1('0x19')](_0x4a0a7e);return _0x2842b[_0x00c1('0x20')]('Content-Range',_0x2082ab+'-'+_0x236446+'/'+_0x2c0f07)[_0x00c1('0x1b')](_0x84113a);}return null;};}function patchUpdates(_0x4d7c1f){return function(_0x10fa8b){try{jsonpatch[_0x00c1('0x21')](_0x10fa8b,_0x4d7c1f,!![]);}catch(_0x33c8fa){return BPromise[_0x00c1('0x22')](_0x33c8fa);}return _0x10fa8b[_0x00c1('0x23')]();};}function saveUpdates(_0x5e8627,_0x2407b8){return function(_0x440ea8){if(_0x440ea8){return _0x440ea8['update'](_0x5e8627)['then'](function(_0x1cb598){return _0x1cb598;});}return null;};}function removeEntity(_0x1e244b,_0x1ce41b){return function(_0x3507b3){if(_0x3507b3){return _0x3507b3[_0x00c1('0x24')]()[_0x00c1('0x25')](function(){_0x1e244b['status'](0xcc)[_0x00c1('0x1a')]();});}};}function handleEntityNotFound(_0x54ff2a,_0x591d67){return function(_0x4d0d6a){if(!_0x4d0d6a){_0x54ff2a[_0x00c1('0x18')](0x194);}return _0x4d0d6a;};}function handleError(_0x34ef59,_0x41cb9e){_0x41cb9e=_0x41cb9e||0x1f4;return function(_0x174d27){logger[_0x00c1('0x26')](_0x174d27[_0x00c1('0x27')]);if(_0x174d27['name']){delete _0x174d27[_0x00c1('0x28')];}_0x34ef59[_0x00c1('0x19')](_0x41cb9e)[_0x00c1('0x29')](_0x174d27);};}exports[_0x00c1('0x2a')]=function(_0x1c8a04,_0x21f0fb){var _0x3b4bdb={},_0x943d0c={},_0x4f0dce={'count':0x0,'rows':[]};var _0x10d77b=_[_0x00c1('0x2b')](db[_0x00c1('0x2c')][_0x00c1('0x2d')],function(_0x8214f9){return{'name':_0x8214f9['fieldName'],'type':_0x8214f9[_0x00c1('0x2e')][_0x00c1('0x2f')]};});_0x943d0c['model']=_[_0x00c1('0x2b')](_0x10d77b,_0x00c1('0x28'));_0x943d0c[_0x00c1('0x30')]=_['keys'](_0x1c8a04[_0x00c1('0x30')]);_0x943d0c[_0x00c1('0x31')]=_[_0x00c1('0x32')](_0x943d0c['model'],_0x943d0c[_0x00c1('0x30')]);_0x3b4bdb[_0x00c1('0x33')]=_[_0x00c1('0x32')](_0x943d0c[_0x00c1('0x34')],qs[_0x00c1('0x35')](_0x1c8a04[_0x00c1('0x30')][_0x00c1('0x35')]));_0x3b4bdb[_0x00c1('0x33')]=_0x3b4bdb[_0x00c1('0x33')][_0x00c1('0x36')]?_0x3b4bdb[_0x00c1('0x33')]:_0x943d0c[_0x00c1('0x34')];if(!_0x1c8a04['query'][_0x00c1('0x37')](_0x00c1('0x38'))){_0x3b4bdb[_0x00c1('0x1e')]=qs['limit'](_0x1c8a04[_0x00c1('0x30')][_0x00c1('0x1e')]);_0x3b4bdb['offset']=qs[_0x00c1('0x1c')](_0x1c8a04['query']['offset']);}_0x3b4bdb['order']=qs['sort'](_0x1c8a04[_0x00c1('0x30')]['sort']);_0x3b4bdb[_0x00c1('0x39')]=qs['filters'](_[_0x00c1('0x3a')](_0x1c8a04[_0x00c1('0x30')],_0x943d0c[_0x00c1('0x31')]),_0x10d77b);if(_0x1c8a04[_0x00c1('0x30')][_0x00c1('0x3b')]){_0x3b4bdb[_0x00c1('0x39')]=_[_0x00c1('0x3c')](_0x3b4bdb[_0x00c1('0x39')],{'$or':_[_0x00c1('0x2b')](_0x10d77b,function(_0xd30031){if(_0xd30031['type']!==_0x00c1('0x3d')){var _0x14d666={};_0x14d666[_0xd30031['name']]={'$like':'%'+_0x1c8a04[_0x00c1('0x30')][_0x00c1('0x3b')]+'%'};return _0x14d666;}})});}_0x3b4bdb=_[_0x00c1('0x3c')]({},_0x3b4bdb,_0x1c8a04['options']);var _0x575ea4={'where':_0x3b4bdb[_0x00c1('0x39')]};return db['VtigerField'][_0x00c1('0x1f')](_0x575ea4)['then'](function(_0x24bb04){_0x4f0dce['count']=_0x24bb04;if(_0x1c8a04[_0x00c1('0x30')][_0x00c1('0x3e')]){_0x3b4bdb[_0x00c1('0x3f')]=[{'all':!![]}];}return db[_0x00c1('0x2c')]['findAll'](_0x3b4bdb);})[_0x00c1('0x25')](function(_0x4a0ca3){_0x4f0dce[_0x00c1('0x40')]=_0x4a0ca3;return _0x4f0dce;})[_0x00c1('0x25')](respondWithFilteredResult(_0x21f0fb,_0x3b4bdb))[_0x00c1('0x41')](handleError(_0x21f0fb,null));};exports[_0x00c1('0x42')]=function(_0x148b35,_0x3a4735){var _0x1b112c={'raw':!![],'where':{'id':_0x148b35[_0x00c1('0x43')]['id']}},_0x51c211={};_0x51c211['model']=_[_0x00c1('0x44')](db[_0x00c1('0x2c')][_0x00c1('0x2d')]);_0x51c211[_0x00c1('0x30')]=_[_0x00c1('0x44')](_0x148b35[_0x00c1('0x30')]);_0x51c211[_0x00c1('0x31')]=_[_0x00c1('0x32')](_0x51c211[_0x00c1('0x34')],_0x51c211[_0x00c1('0x30')]);_0x1b112c[_0x00c1('0x33')]=_[_0x00c1('0x32')](_0x51c211[_0x00c1('0x34')],qs[_0x00c1('0x35')](_0x148b35[_0x00c1('0x30')][_0x00c1('0x35')]));_0x1b112c[_0x00c1('0x33')]=_0x1b112c[_0x00c1('0x33')]['length']?_0x1b112c[_0x00c1('0x33')]:_0x51c211[_0x00c1('0x34')];if(_0x148b35[_0x00c1('0x30')][_0x00c1('0x3e')]){_0x1b112c[_0x00c1('0x3f')]=[{'all':!![]}];}_0x1b112c=_[_0x00c1('0x3c')]({},_0x1b112c,_0x148b35['options']);return db[_0x00c1('0x2c')][_0x00c1('0x45')](_0x1b112c)[_0x00c1('0x25')](handleEntityNotFound(_0x3a4735,null))['then'](respondWithResult(_0x3a4735,null))[_0x00c1('0x41')](handleError(_0x3a4735,null));};exports[_0x00c1('0x46')]=function(_0x4b0163,_0x3979c7){return db[_0x00c1('0x2c')]['create'](_0x4b0163[_0x00c1('0x47')],{})[_0x00c1('0x25')](respondWithResult(_0x3979c7,0xc9))[_0x00c1('0x41')](handleError(_0x3979c7,null));};exports['update']=function(_0x45c8ca,_0x105481){if(_0x45c8ca['body']['id']){delete _0x45c8ca['body']['id'];}return db['VtigerField'][_0x00c1('0x45')]({'where':{'id':_0x45c8ca['params']['id']}})[_0x00c1('0x25')](handleEntityNotFound(_0x105481,null))[_0x00c1('0x25')](saveUpdates(_0x45c8ca['body'],null))['then'](respondWithResult(_0x105481,null))[_0x00c1('0x41')](handleError(_0x105481,null));};exports[_0x00c1('0x24')]=function(_0x821ba6,_0xd2fcee){return db[_0x00c1('0x2c')][_0x00c1('0x45')]({'where':{'id':_0x821ba6['params']['id']}})['then'](handleEntityNotFound(_0xd2fcee,null))[_0x00c1('0x25')](removeEntity(_0xd2fcee,null))[_0x00c1('0x41')](handleError(_0xd2fcee,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 7e76461..a6395e2 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 _0x5ddf=['bluebird','request-promise','path','../../config/environment','define','int_vtiger_fields','idField','FieldId','lodash','../../config/logger'];(function(_0x59f87d,_0x340b57){var _0x7286e7=function(_0x51ce69){while(--_0x51ce69){_0x59f87d['push'](_0x59f87d['shift']());}};_0x7286e7(++_0x340b57);}(_0x5ddf,0x12a));var _0xf5dd=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x5ddf[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xf5dd('0x0'));var util=require('util');var logger=require(_0xf5dd('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf5dd('0x2'));var rp=require(_0xf5dd('0x3'));var fs=require('fs');var path=require(_0xf5dd('0x4'));var rimraf=require('rimraf');var config=require(_0xf5dd('0x5'));var attributes=require('./intVtigerField.attributes');module['exports']=function(_0x54ce06,_0x201b3a){return _0x54ce06[_0xf5dd('0x6')]('VtigerField',attributes,{'tableName':_0xf5dd('0x7'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0xf5dd('0x8'),_0xf5dd('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeda9=['path','rimraf','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','FieldId','util','../../config/logger','api','bluebird'];(function(_0x5e5f5a,_0x5cb19a){var _0x4141ae=function(_0x4bb2ea){while(--_0x4bb2ea){_0x5e5f5a['push'](_0x5e5f5a['shift']());}};_0x4141ae(++_0x5cb19a);}(_0xeda9,0x64));var _0x9eda=function(_0x45518f,_0x475a6b){_0x45518f=_0x45518f-0x0;var _0x198175=_0xeda9[_0x45518f];return _0x198175;};'use strict';var _=require('lodash');var util=require(_0x9eda('0x0'));var logger=require(_0x9eda('0x1'))(_0x9eda('0x2'));var moment=require('moment');var BPromise=require(_0x9eda('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9eda('0x4'));var rimraf=require(_0x9eda('0x5'));var config=require('../../config/environment');var attributes=require(_0x9eda('0x6'));module[_0x9eda('0x7')]=function(_0x59d156,_0x190076){return _0x59d156[_0x9eda('0x8')](_0x9eda('0x9'),attributes,{'tableName':_0x9eda('0xa'),'paranoid':![],'indexes':[{'name':_0x9eda('0xb'),'fields':['idField',_0x9eda('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 a795224..e641d50 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 _0x4493=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerField,\x20%s,\x20%s','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x42c7b5,_0x3f2ccf){var _0x3919b2=function(_0x2e04c9){while(--_0x2e04c9){_0x42c7b5['push'](_0x42c7b5['shift']());}};_0x3919b2(++_0x3f2ccf);}(_0x4493,0x1a8));var _0x3449=function(_0x50a76f,_0x392bbf){_0x50a76f=_0x50a76f-0x0;var _0x5b4ce8=_0x4493[_0x50a76f];return _0x5b4ce8;};'use strict';var _=require(_0x3449('0x0'));var util=require(_0x3449('0x1'));var moment=require(_0x3449('0x2'));var BPromise=require('bluebird');var rs=require(_0x3449('0x3'));var fs=require('fs');var Redis=require(_0x3449('0x4'));var db=require(_0x3449('0x5'))['db'];var utils=require(_0x3449('0x6'));var logger=require(_0x3449('0x7'))(_0x3449('0x8'));var config=require(_0x3449('0x9'));var jayson=require(_0x3449('0xa'));var client=jayson[_0x3449('0xb')][_0x3449('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x54fb94,_0x3cb92d,_0x298f85){return new BPromise(function(_0x125148,_0x1d064e){return client[_0x3449('0xd')](_0x54fb94,_0x298f85)[_0x3449('0xe')](function(_0x9e211c){logger[_0x3449('0xf')]('VtigerField,\x20%s,\x20%s',_0x3cb92d,_0x3449('0x10'));logger[_0x3449('0x11')](_0x3449('0x12'),_0x3cb92d,_0x3449('0x10'),JSON[_0x3449('0x13')](_0x9e211c));if(_0x9e211c[_0x3449('0x14')]){if(_0x9e211c[_0x3449('0x14')][_0x3449('0x15')]===0x1f4){logger[_0x3449('0x14')](_0x3449('0x16'),_0x3cb92d,_0x9e211c[_0x3449('0x14')][_0x3449('0x17')]);return _0x1d064e(_0x9e211c['error'][_0x3449('0x17')]);}logger[_0x3449('0x14')]('VtigerField,\x20%s,\x20%s',_0x3cb92d,_0x9e211c['error'][_0x3449('0x17')]);return _0x125148(_0x9e211c[_0x3449('0x14')][_0x3449('0x17')]);}else{logger[_0x3449('0xf')]('VtigerField,\x20%s,\x20%s',_0x3cb92d,'request\x20sent');_0x125148(_0x9e211c['result'][_0x3449('0x17')]);}})['catch'](function(_0x15e852){logger['error'](_0x3449('0x16'),_0x3cb92d,_0x15e852);_0x1d064e(_0x15e852);});});} \ No newline at end of file +var _0xd748=['VtigerField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1c081c,_0x513b69){var _0x137ab8=function(_0x38ae8b){while(--_0x38ae8b){_0x1c081c['push'](_0x1c081c['shift']());}};_0x137ab8(++_0x513b69);}(_0xd748,0x148));var _0x8d74=function(_0x57e00e,_0x36e79a){_0x57e00e=_0x57e00e-0x0;var _0x415e60=_0xd748[_0x57e00e];return _0x415e60;};'use strict';var _=require(_0x8d74('0x0'));var util=require('util');var moment=require(_0x8d74('0x1'));var BPromise=require(_0x8d74('0x2'));var rs=require(_0x8d74('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8d74('0x4'))['db'];var utils=require(_0x8d74('0x5'));var logger=require('../../config/logger')(_0x8d74('0x6'));var config=require(_0x8d74('0x7'));var jayson=require(_0x8d74('0x8'));var client=jayson[_0x8d74('0x9')][_0x8d74('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f4e8c,_0x34f06e,_0x44af97){return new BPromise(function(_0x5f19b2,_0x1e0deb){return client[_0x8d74('0xb')](_0x2f4e8c,_0x44af97)[_0x8d74('0xc')](function(_0x122c50){logger[_0x8d74('0xd')](_0x8d74('0xe'),_0x34f06e,_0x8d74('0xf'));logger[_0x8d74('0x10')](_0x8d74('0x11'),_0x34f06e,_0x8d74('0xf'),JSON['stringify'](_0x122c50));if(_0x122c50[_0x8d74('0x12')]){if(_0x122c50[_0x8d74('0x12')][_0x8d74('0x13')]===0x1f4){logger[_0x8d74('0x12')](_0x8d74('0xe'),_0x34f06e,_0x122c50['error']['message']);return _0x1e0deb(_0x122c50[_0x8d74('0x12')]['message']);}logger[_0x8d74('0x12')](_0x8d74('0xe'),_0x34f06e,_0x122c50[_0x8d74('0x12')][_0x8d74('0x14')]);return _0x5f19b2(_0x122c50[_0x8d74('0x12')][_0x8d74('0x14')]);}else{logger[_0x8d74('0xd')](_0x8d74('0xe'),_0x34f06e,'request\x20sent');_0x5f19b2(_0x122c50[_0x8d74('0x15')][_0x8d74('0x14')]);}})[_0x8d74('0x16')](function(_0x5e8002){logger['error'](_0x8d74('0xe'),_0x34f06e,_0x5e8002);_0x1e0deb(_0x5e8002);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index e6e5cf8..0a60ea3 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 _0xa104=['connect-timeout','express','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','create','addConfiguration','update','delete','destroy','multer','util','path'];(function(_0x4fc9cf,_0x5c7c91){var _0x1c1580=function(_0x5d90f0){while(--_0x5d90f0){_0x4fc9cf['push'](_0x4fc9cf['shift']());}};_0x1c1580(++_0x5c7c91);}(_0xa104,0x9d));var _0x4a10=function(_0x5de1cd,_0x188de7){_0x5de1cd=_0x5de1cd-0x0;var _0x201060=_0xa104[_0x5de1cd];return _0x201060;};'use strict';var multer=require(_0x4a10('0x0'));var util=require(_0x4a10('0x1'));var path=require(_0x4a10('0x2'));var timeout=require(_0x4a10('0x3'));var express=require(_0x4a10('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4a10('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4a10('0x6'));var controller=require(_0x4a10('0x7'));router[_0x4a10('0x8')]('/',auth[_0x4a10('0x9')](),controller[_0x4a10('0xa')]);router[_0x4a10('0x8')](_0x4a10('0xb'),auth[_0x4a10('0x9')](),controller[_0x4a10('0xc')]);router[_0x4a10('0x8')](_0x4a10('0xd'),auth[_0x4a10('0x9')](),controller['getConfigurations']);router[_0x4a10('0x8')](_0x4a10('0xe'),auth[_0x4a10('0x9')](),controller['getFields']);router['post']('/',auth[_0x4a10('0x9')](),controller[_0x4a10('0xf')]);router['post']('/:id/configurations',auth[_0x4a10('0x9')](),controller[_0x4a10('0x10')]);router['put']('/:id',auth[_0x4a10('0x9')](),controller[_0x4a10('0x11')]);router[_0x4a10('0x12')](_0x4a10('0xb'),auth[_0x4a10('0x9')](),controller[_0x4a10('0x13')]);module['exports']=router; \ No newline at end of file +var _0x8b4d=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','create','post','addConfiguration','put','/:id','update','destroy','exports','multer'];(function(_0x39b62d,_0x4b802f){var _0x27ab0a=function(_0x3dea86){while(--_0x3dea86){_0x39b62d['push'](_0x39b62d['shift']());}};_0x27ab0a(++_0x4b802f);}(_0x8b4d,0x11d));var _0xd8b4=function(_0x4063a4,_0x19d730){_0x4063a4=_0x4063a4-0x0;var _0x17908d=_0x8b4d[_0x4063a4];return _0x17908d;};'use strict';var multer=require(_0xd8b4('0x0'));var util=require(_0xd8b4('0x1'));var path=require(_0xd8b4('0x2'));var timeout=require(_0xd8b4('0x3'));var express=require('express');var router=express[_0xd8b4('0x4')]();var fs_extra=require(_0xd8b4('0x5'));var auth=require(_0xd8b4('0x6'));var interaction=require(_0xd8b4('0x7'));var config=require('../../config/environment');var controller=require('./intZendeskAccount.controller');router[_0xd8b4('0x8')]('/',auth[_0xd8b4('0x9')](),controller['index']);router[_0xd8b4('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xd8b4('0xa')]);router[_0xd8b4('0x8')](_0xd8b4('0xb'),auth['isAuthenticated'](),controller[_0xd8b4('0xc')]);router['get'](_0xd8b4('0xd'),auth[_0xd8b4('0x9')](),controller['getFields']);router['post']('/',auth[_0xd8b4('0x9')](),controller[_0xd8b4('0xe')]);router[_0xd8b4('0xf')](_0xd8b4('0xb'),auth[_0xd8b4('0x9')](),controller[_0xd8b4('0x10')]);router[_0xd8b4('0x11')](_0xd8b4('0x12'),auth[_0xd8b4('0x9')](),controller[_0xd8b4('0x13')]);router['delete']('/:id',auth[_0xd8b4('0x9')](),controller[_0xd8b4('0x14')]);module[_0xd8b4('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index f5d7ecd..b792b24 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 _0x7c1a=['integrationTab','sequelize','exports','STRING','username','ENUM','token','password'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x7c1a,0x159));var _0xa7c1=function(_0x3c2dc8,_0x5e165f){_0x3c2dc8=_0x3c2dc8-0x0;var _0x29545e=_0x7c1a[_0x3c2dc8];return _0x29545e;};'use strict';var Sequelize=require(_0xa7c1('0x0'));module[_0xa7c1('0x1')]={'name':{'type':Sequelize[_0xa7c1('0x2')]},'description':{'type':Sequelize[_0xa7c1('0x2')]},'username':{'type':Sequelize[_0xa7c1('0x2')],'unique':_0xa7c1('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xa7c1('0x2')]},'remoteUri':{'type':Sequelize[_0xa7c1('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0xa7c1('0x4')]('password',_0xa7c1('0x5')),'defaultValue':_0xa7c1('0x6')},'serverUrl':{'type':Sequelize[_0xa7c1('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa7c1('0x4')]('integrationTab','newTab'),'defaultValue':_0xa7c1('0x7')}}; \ No newline at end of file +var _0x292c=['username','password','token','ENUM','integrationTab','newTab','sequelize','STRING'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x292c,0x66));var _0xc292=function(_0x496333,_0x1c47d6){_0x496333=_0x496333-0x0;var _0x44256e=_0x292c[_0x496333];return _0x44256e;};'use strict';var Sequelize=require(_0xc292('0x0'));module['exports']={'name':{'type':Sequelize[_0xc292('0x1')]},'description':{'type':Sequelize[_0xc292('0x1')]},'username':{'type':Sequelize[_0xc292('0x1')],'unique':_0xc292('0x2')},'password':{'type':Sequelize[_0xc292('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xc292('0x1')],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM'](_0xc292('0x3'),_0xc292('0x4')),'defaultValue':_0xc292('0x3')},'serverUrl':{'type':Sequelize[_0xc292('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xc292('0x5')](_0xc292('0x6'),_0xc292('0x7')),'defaultValue':_0xc292('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 357b70b..cb88efb 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 _0xbc9d=['merge','map','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','length','find','create','update','body','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','AccountId','getSubjects','channel','ZendeskField','Subjects','Descriptions','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','%s:%s','toString','base64','Basic\x20%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','includes','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','error','stack','send','index','ZendeskAccount','rawAttributes','type','key','name','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick'];(function(_0x29df9a,_0x42aff3){var _0x3a8e96=function(_0x70fbe7){while(--_0x70fbe7){_0x29df9a['push'](_0x29df9a['shift']());}};_0x3a8e96(++_0x42aff3);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x3daac9,_0x5ca67d){_0x3daac9=_0x3daac9-0x0;var _0x1c5e70=_0xbc9d[_0x3daac9];return _0x1c5e70;};'use strict';var emlformat=require(_0xdbc9('0x0'));var rimraf=require(_0xdbc9('0x1'));var zipdir=require(_0xdbc9('0x2'));var jsonpatch=require(_0xdbc9('0x3'));var rp=require(_0xdbc9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdbc9('0x5'));var path=require(_0xdbc9('0x6'));var sox=require(_0xdbc9('0x7'));var csv=require(_0xdbc9('0x8'));var ejs=require(_0xdbc9('0x9'));var fs=require('fs');var fs_extra=require(_0xdbc9('0xa'));var _=require(_0xdbc9('0xb'));var squel=require('squel');var crypto=require(_0xdbc9('0xc'));var jsforce=require(_0xdbc9('0xd'));var deskjs=require(_0xdbc9('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdbc9('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdbc9('0x10'));var qs=require(_0xdbc9('0x11'));var as=require(_0xdbc9('0x12'));var hardwareService=require(_0xdbc9('0x13'));var logger=require('../../config/logger')(_0xdbc9('0x14'));var utils=require(_0xdbc9('0x15'));var config=require(_0xdbc9('0x16'));var licenseUtil=require(_0xdbc9('0x17'));var db=require(_0xdbc9('0x18'))['db'];var integrations=require(_0xdbc9('0x19'));function respondWithStatusCode(_0x48bc83,_0x567e71){_0x567e71=_0x567e71||0xcc;return function(_0x3d0fdd){if(_0x3d0fdd){return _0x48bc83[_0xdbc9('0x1a')](_0x567e71);}return _0x48bc83[_0xdbc9('0x1b')](_0x567e71)[_0xdbc9('0x1c')]();};}function respondWithResult(_0x53495d,_0x4a9dcb){_0x4a9dcb=_0x4a9dcb||0xc8;return function(_0x2b7bd){if(_0x2b7bd){return _0x53495d[_0xdbc9('0x1b')](_0x4a9dcb)[_0xdbc9('0x1d')](_0x2b7bd);}};}function respondWithFilteredResult(_0x4c7b4f,_0x1b4616){return function(_0x1abee8){if(_0x1abee8){var _0x4fdb81=typeof _0x1b4616[_0xdbc9('0x1e')]===_0xdbc9('0x1f')&&typeof _0x1b4616[_0xdbc9('0x20')]===_0xdbc9('0x1f');var _0x1f22f4=_0x1abee8[_0xdbc9('0x21')];var _0x9f343d=_0x4fdb81?0x0:_0x1b4616[_0xdbc9('0x1e')];var _0x2ad952=_0x4fdb81?_0x1abee8[_0xdbc9('0x21')]:_0x1b4616['offset']+_0x1b4616[_0xdbc9('0x20')];var _0x497be2;if(_0x2ad952>=_0x1f22f4){_0x2ad952=_0x1f22f4;_0x497be2=0xc8;}else{_0x497be2=0xce;}_0x4c7b4f[_0xdbc9('0x1b')](_0x497be2);return _0x4c7b4f[_0xdbc9('0x22')]('Content-Range',_0x9f343d+'-'+_0x2ad952+'/'+_0x1f22f4)[_0xdbc9('0x1d')](_0x1abee8);}return null;};}function patchUpdates(_0x5367dc){return function(_0x569f32){try{jsonpatch['apply'](_0x569f32,_0x5367dc,!![]);}catch(_0x4f3b5d){return BPromise[_0xdbc9('0x23')](_0x4f3b5d);}return _0x569f32[_0xdbc9('0x24')]();};}function saveUpdates(_0x570ad9,_0x16dcf7){return function(_0x20563e){if(_0x20563e){return _0x20563e['update'](_0x570ad9)[_0xdbc9('0x25')](function(_0x6b788){return _0x6b788;});}return null;};}function removeEntity(_0x1b1c0d,_0x119230){return function(_0x3400e7){if(_0x3400e7){return _0x3400e7[_0xdbc9('0x26')]()[_0xdbc9('0x25')](function(){_0x1b1c0d[_0xdbc9('0x1b')](0xcc)[_0xdbc9('0x1c')]();});}};}function handleEntityNotFound(_0x4a868b,_0x550bef){return function(_0xe309ae){if(!_0xe309ae){_0x4a868b[_0xdbc9('0x1a')](0x194);}return _0xe309ae;};}function handleError(_0x1053ca,_0x24fdec){_0x24fdec=_0x24fdec||0x1f4;return function(_0x50c3ee){logger[_0xdbc9('0x27')](_0x50c3ee[_0xdbc9('0x28')]);if(_0x50c3ee['name']){delete _0x50c3ee['name'];}_0x1053ca[_0xdbc9('0x1b')](_0x24fdec)[_0xdbc9('0x29')](_0x50c3ee);};}exports[_0xdbc9('0x2a')]=function(_0x59bfd2,_0x13a432){var _0x539e57={},_0x561f8e={},_0x210a40={'count':0x0,'rows':[]};var _0x49da36=_['map'](db[_0xdbc9('0x2b')][_0xdbc9('0x2c')],function(_0x1cb557){return{'name':_0x1cb557['fieldName'],'type':_0x1cb557[_0xdbc9('0x2d')][_0xdbc9('0x2e')]};});_0x561f8e['model']=_['map'](_0x49da36,_0xdbc9('0x2f'));_0x561f8e[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x59bfd2[_0xdbc9('0x30')]);_0x561f8e[_0xdbc9('0x32')]=_[_0xdbc9('0x33')](_0x561f8e[_0xdbc9('0x34')],_0x561f8e['query']);_0x539e57[_0xdbc9('0x35')]=_[_0xdbc9('0x33')](_0x561f8e[_0xdbc9('0x34')],qs[_0xdbc9('0x36')](_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x36')]));_0x539e57['attributes']=_0x539e57[_0xdbc9('0x35')]['length']?_0x539e57['attributes']:_0x561f8e['model'];if(!_0x59bfd2['query']['hasOwnProperty'](_0xdbc9('0x37'))){_0x539e57[_0xdbc9('0x20')]=qs[_0xdbc9('0x20')](_0x59bfd2['query'][_0xdbc9('0x20')]);_0x539e57[_0xdbc9('0x1e')]=qs[_0xdbc9('0x1e')](_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x1e')]);}_0x539e57[_0xdbc9('0x38')]=qs['sort'](_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x39')]);_0x539e57[_0xdbc9('0x3a')]=qs['filters'](_[_0xdbc9('0x3b')](_0x59bfd2[_0xdbc9('0x30')],_0x561f8e[_0xdbc9('0x32')]),_0x49da36);if(_0x59bfd2[_0xdbc9('0x30')]['filter']){_0x539e57['where']=_[_0xdbc9('0x3c')](_0x539e57[_0xdbc9('0x3a')],{'$or':_[_0xdbc9('0x3d')](_0x49da36,function(_0x1ef970){if(_0x1ef970['type']!==_0xdbc9('0x3e')){var _0x3827be={};_0x3827be[_0x1ef970[_0xdbc9('0x2f')]]={'$like':'%'+_0x59bfd2['query'][_0xdbc9('0x3f')]+'%'};return _0x3827be;}})});}_0x539e57=_[_0xdbc9('0x3c')]({},_0x539e57,_0x59bfd2[_0xdbc9('0x40')]);var _0x523c79={'where':_0x539e57[_0xdbc9('0x3a')]};return db[_0xdbc9('0x2b')]['count'](_0x523c79)['then'](function(_0xfc34d5){_0x210a40[_0xdbc9('0x21')]=_0xfc34d5;if(_0x59bfd2[_0xdbc9('0x30')][_0xdbc9('0x41')]){_0x539e57['include']=[{'all':!![]}];}return db[_0xdbc9('0x2b')][_0xdbc9('0x42')](_0x539e57);})['then'](function(_0x8445b8){_0x210a40[_0xdbc9('0x43')]=_0x8445b8;return _0x210a40;})['then'](respondWithFilteredResult(_0x13a432,_0x539e57))[_0xdbc9('0x44')](handleError(_0x13a432,null));};exports[_0xdbc9('0x45')]=function(_0x2adb23,_0x3415c3){var _0x3ed4de={'raw':![],'where':{'id':_0x2adb23[_0xdbc9('0x46')]['id']}},_0x1cd538={};_0x1cd538['model']=_['keys'](db[_0xdbc9('0x2b')][_0xdbc9('0x2c')]);_0x1cd538[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x2adb23[_0xdbc9('0x30')]);_0x1cd538[_0xdbc9('0x32')]=_[_0xdbc9('0x33')](_0x1cd538[_0xdbc9('0x34')],_0x1cd538[_0xdbc9('0x30')]);_0x3ed4de[_0xdbc9('0x35')]=_[_0xdbc9('0x33')](_0x1cd538['model'],qs['fields'](_0x2adb23[_0xdbc9('0x30')][_0xdbc9('0x36')]));_0x3ed4de[_0xdbc9('0x35')]=_0x3ed4de[_0xdbc9('0x35')][_0xdbc9('0x47')]?_0x3ed4de[_0xdbc9('0x35')]:_0x1cd538[_0xdbc9('0x34')];if(_0x2adb23[_0xdbc9('0x30')]['includeAll']){_0x3ed4de['include']=[{'all':!![]}];}_0x3ed4de=_[_0xdbc9('0x3c')]({},_0x3ed4de,_0x2adb23[_0xdbc9('0x40')]);return db[_0xdbc9('0x2b')][_0xdbc9('0x48')](_0x3ed4de)[_0xdbc9('0x25')](handleEntityNotFound(_0x3415c3,null))[_0xdbc9('0x25')](respondWithResult(_0x3415c3,null))[_0xdbc9('0x44')](handleError(_0x3415c3,null));};exports[_0xdbc9('0x49')]=function(_0x43e3ec,_0x589557){return db[_0xdbc9('0x2b')][_0xdbc9('0x49')](_0x43e3ec['body'],{})['then'](respondWithResult(_0x589557,0xc9))[_0xdbc9('0x44')](handleError(_0x589557,null));};exports[_0xdbc9('0x4a')]=function(_0x133a13,_0x49a55c){if(_0x133a13[_0xdbc9('0x4b')]['id']){delete _0x133a13[_0xdbc9('0x4b')]['id'];}return db[_0xdbc9('0x2b')][_0xdbc9('0x48')]({'where':{'id':_0x133a13['params']['id']}})[_0xdbc9('0x25')](handleEntityNotFound(_0x49a55c,null))[_0xdbc9('0x25')](saveUpdates(_0x133a13[_0xdbc9('0x4b')],null))[_0xdbc9('0x25')](respondWithResult(_0x49a55c,null))['catch'](handleError(_0x49a55c,null));};exports[_0xdbc9('0x26')]=function(_0x36c70e,_0x3f49b7){return db[_0xdbc9('0x2b')][_0xdbc9('0x48')]({'where':{'id':_0x36c70e[_0xdbc9('0x46')]['id']}})[_0xdbc9('0x25')](handleEntityNotFound(_0x3f49b7,null))[_0xdbc9('0x25')](removeEntity(_0x3f49b7,null))['catch'](handleError(_0x3f49b7,null));};exports[_0xdbc9('0x4c')]=function(_0x4d09e1,_0x3f493e,_0x4279bc){var _0x53771a={};var _0x561737={};var _0xc7335d;var _0x4b55df;return db[_0xdbc9('0x2b')][_0xdbc9('0x4d')]({'where':{'id':_0x4d09e1[_0xdbc9('0x46')]['id']}})['then'](handleEntityNotFound(_0x3f493e,null))[_0xdbc9('0x25')](function(_0x1c52e6){if(_0x1c52e6){_0xc7335d=_0x1c52e6;_0x561737[_0xdbc9('0x34')]=_[_0xdbc9('0x31')](db[_0xdbc9('0x4e')][_0xdbc9('0x2c')]);_0x561737[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x4d09e1['query']);_0x561737['filters']=_['intersection'](_0x561737[_0xdbc9('0x34')],_0x561737[_0xdbc9('0x30')]);_0x53771a[_0xdbc9('0x35')]=_['intersection'](_0x561737['model'],qs[_0xdbc9('0x36')](_0x4d09e1[_0xdbc9('0x30')]['fields']));_0x53771a['attributes']=_0x53771a[_0xdbc9('0x35')][_0xdbc9('0x47')]?_0x53771a[_0xdbc9('0x35')]:_0x561737[_0xdbc9('0x34')];_0x53771a[_0xdbc9('0x38')]=qs[_0xdbc9('0x39')](_0x4d09e1['query'][_0xdbc9('0x39')]);_0x53771a[_0xdbc9('0x3a')]=qs[_0xdbc9('0x32')](_['pick'](_0x4d09e1[_0xdbc9('0x30')],_0x561737[_0xdbc9('0x32')]));if(_0x4d09e1[_0xdbc9('0x30')]['filter']){_0x53771a[_0xdbc9('0x3a')]=_['merge'](_0x53771a[_0xdbc9('0x3a')],{'$or':_[_0xdbc9('0x3d')](_0x53771a[_0xdbc9('0x35')],function(_0x26ed1c){var _0x148061={};_0x148061[_0x26ed1c]={'$like':'%'+_0x4d09e1[_0xdbc9('0x30')]['filter']+'%'};return _0x148061;})});}_0x53771a=_[_0xdbc9('0x3c')]({},_0x53771a,_0x4d09e1['options']);return _0xc7335d[_0xdbc9('0x4c')](_0x53771a);}})[_0xdbc9('0x25')](function(_0x53fcd6){if(_0x53fcd6){_0x4b55df=_0x53fcd6[_0xdbc9('0x47')];if(!_0x4d09e1[_0xdbc9('0x30')]['hasOwnProperty']('nolimit')){_0x53771a[_0xdbc9('0x20')]=qs[_0xdbc9('0x20')](_0x4d09e1[_0xdbc9('0x30')]['limit']);_0x53771a[_0xdbc9('0x1e')]=qs[_0xdbc9('0x1e')](_0x4d09e1['query'][_0xdbc9('0x1e')]);}return _0xc7335d[_0xdbc9('0x4c')](_0x53771a);}})['then'](function(_0x4876f9){if(_0x4876f9){return _0x4876f9?{'count':_0x4b55df,'rows':_0x4876f9}:null;}})[_0xdbc9('0x25')](respondWithResult(_0x3f493e,null))[_0xdbc9('0x44')](handleError(_0x3f493e,null));};exports[_0xdbc9('0x4f')]=function(_0xa8b4d9,_0x3e93d3,_0x14cbf4){if(_0xa8b4d9[_0xdbc9('0x4b')]['id']){delete _0xa8b4d9[_0xdbc9('0x4b')]['id'];}return db['ZendeskAccount'][_0xdbc9('0x4d')]({'where':{'id':_0xa8b4d9[_0xdbc9('0x46')]['id']}})[_0xdbc9('0x25')](handleEntityNotFound(_0x3e93d3,null))[_0xdbc9('0x25')](function(_0x38f7da){if(_0x38f7da){_0xa8b4d9[_0xdbc9('0x4b')][_0xdbc9('0x50')]=_0x38f7da['id'];_0xa8b4d9[_0xdbc9('0x4b')]['Subjects']=integrations[_0xdbc9('0x51')](_0xa8b4d9['body'][_0xdbc9('0x52')],_0xa8b4d9['body'][_0xdbc9('0x2d')]);_0xa8b4d9[_0xdbc9('0x4b')]['Descriptions']=integrations['getDescriptions'](_0xa8b4d9['body'][_0xdbc9('0x52')],_0xa8b4d9[_0xdbc9('0x4b')][_0xdbc9('0x2d')]);return db['ZendeskConfiguration'][_0xdbc9('0x49')](_0xa8b4d9[_0xdbc9('0x4b')],{'include':[{'model':db[_0xdbc9('0x53')],'as':_0xdbc9('0x54')},{'model':db[_0xdbc9('0x53')],'as':_0xdbc9('0x55')}]});}return null;})[_0xdbc9('0x25')](respondWithResult(_0x3e93d3,null))[_0xdbc9('0x44')](handleError(_0x3e93d3,null));};exports[_0xdbc9('0x56')]=function(_0x5e6522,_0x2787d9,_0x2c3223){var _0x511778='';return db['ZendeskAccount'][_0xdbc9('0x4d')]({'where':{'id':_0x5e6522[_0xdbc9('0x46')]['id']},'attributes':['id',_0xdbc9('0x57'),_0xdbc9('0x58'),_0xdbc9('0x59'),_0xdbc9('0x5a'),_0xdbc9('0x5b')]})['then'](handleEntityNotFound(_0x2787d9,null))[_0xdbc9('0x25')](function(_0x19af46){if(_0x19af46){_0x511778=_0x19af46[_0xdbc9('0x5b')];var _0x4a412e=_0x511778[_0xdbc9('0x5c')](-0x1);if(_0x4a412e==='/'){_0x511778=_0x511778[_0xdbc9('0x5d')](0x0,_0x511778[_0xdbc9('0x5e')](_0x4a412e));}var _0x2b4905={'method':_0xdbc9('0x5f'),'uri':util[_0xdbc9('0x60')](_0xdbc9('0x61'),_0x511778,_0xdbc9('0x62')),'json':!![]};switch(_0x19af46[_0xdbc9('0x5a')]){case _0xdbc9('0x58'):_0x2b4905[_0xdbc9('0x63')]={'Authorization':util[_0xdbc9('0x60')]('Basic\x20%s',new Buffer(util['format'](_0xdbc9('0x64'),_0x19af46['username'],_0x19af46['password']))[_0xdbc9('0x65')](_0xdbc9('0x66')))};break;case _0xdbc9('0x59'):_0x2b4905['headers']={'Authorization':util[_0xdbc9('0x60')](_0xdbc9('0x67'),new Buffer(util[_0xdbc9('0x60')]('%s/token:%s',_0x19af46[_0xdbc9('0x57')],_0x19af46[_0xdbc9('0x59')]))['toString'](_0xdbc9('0x66')))};break;default:throw new db[(_0xdbc9('0x68'))][(_0xdbc9('0x69'))](_0xdbc9('0x6a'));}return rp(_0x2b4905);}})[_0xdbc9('0x25')](function(_0x501754){if(_0x501754){var _0x4f984b=[_0xdbc9('0x6b'),_0xdbc9('0x6c'),'group',_0xdbc9('0x6d')];_[_0xdbc9('0x6e')](_0x501754[_0xdbc9('0x62')],function(_0x5802fc){return _0x4f984b[_0xdbc9('0x6f')](_0x5802fc[_0xdbc9('0x2d')]);});return{'count':_0x501754[_0xdbc9('0x62')][_0xdbc9('0x47')],'rows':_[_0xdbc9('0x3d')](_0x501754[_0xdbc9('0x62')],function(_0x1b053a){return{'id':_0x1b053a['id'],'name':_0x1b053a[_0xdbc9('0x70')]>0x7?_0x1b053a['title']:_0x1b053a[_0xdbc9('0x2d')],'custom':_0x1b053a[_0xdbc9('0x70')]>0x7?!![]:![],'options':_0x1b053a[_0xdbc9('0x71')]?_0x1b053a[_0xdbc9('0x71')]:_0x1b053a['custom_field_options']?_0x1b053a[_0xdbc9('0x72')]:[]};})};}})['then'](respondWithResult(_0x2787d9,null))['catch'](function(_0x34ebeb){var _0x3400d0=_0x5e6522['query'][_0xdbc9('0x73')]?0x1f4:_0x34ebeb[_0xdbc9('0x74')]||0x1f4;logger[_0xdbc9('0x27')](_0xdbc9('0x75'),_0xdbc9('0x56'),_0x3400d0,JSON[_0xdbc9('0x76')](_0x34ebeb));delete _0x34ebeb[_0xdbc9('0x2f')];if(_0x3400d0===0x191){_0x3400d0=0x190;}_0x2787d9['status'](_0x3400d0)['send'](_0x5e6522[_0xdbc9('0x30')][_0xdbc9('0x73')]?{'message':_0xdbc9('0x77'),'statusCode':_0x34ebeb['statusCode']}:_0x34ebeb);});}; \ 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(_0x3e6b2f,_0x1ffa07){var _0x323215=function(_0x5c4d82){while(--_0x5c4d82){_0x3e6b2f['push'](_0x3e6b2f['shift']());}};_0x323215(++_0x1ffa07);}(_0xe706,0xa3));var _0x6e70=function(_0x714e4e,_0x220d25){_0x714e4e=_0x714e4e-0x0;var _0x10552a=_0xe706[_0x714e4e];return _0x10552a;};'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 68d5256..c527f9a 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 _0x6c8b=['path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','ZendeskAccount','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x274e0e,_0x2e7080){var _0x4c370f=function(_0x1fedd9){while(--_0x1fedd9){_0x274e0e['push'](_0x274e0e['shift']());}};_0x4c370f(++_0x2e7080);}(_0x6c8b,0x10b));var _0xb6c8=function(_0x2b648e,_0x3b4b3c){_0x2b648e=_0x2b648e-0x0;var _0x48f1c9=_0x6c8b[_0x2b648e];return _0x48f1c9;};'use strict';var _=require(_0xb6c8('0x0'));var util=require(_0xb6c8('0x1'));var logger=require(_0xb6c8('0x2'))(_0xb6c8('0x3'));var moment=require('moment');var BPromise=require(_0xb6c8('0x4'));var rp=require(_0xb6c8('0x5'));var fs=require('fs');var path=require(_0xb6c8('0x6'));var rimraf=require(_0xb6c8('0x7'));var config=require(_0xb6c8('0x8'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xb6c8('0x9'));module[_0xb6c8('0xa')]=function(_0x377a1b,_0x3ff6b2){return _0x377a1b[_0xb6c8('0xb')](_0xb6c8('0xc'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c6e=['bluebird','request-promise','rimraf','../../components/integrations/configuration','exports','ZendeskAccount','lodash','../../config/logger','api'];(function(_0x356149,_0x5f292f){var _0x5558bd=function(_0x3d1844){while(--_0x3d1844){_0x356149['push'](_0x356149['shift']());}};_0x5558bd(++_0x5f292f);}(_0x9c6e,0x96));var _0xe9c6=function(_0x134192,_0x36adc5){_0x134192=_0x134192-0x0;var _0x3cd080=_0x9c6e[_0x134192];return _0x3cd080;};'use strict';var _=require(_0xe9c6('0x0'));var util=require('util');var logger=require(_0xe9c6('0x1'))(_0xe9c6('0x2'));var moment=require('moment');var BPromise=require(_0xe9c6('0x3'));var rp=require(_0xe9c6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe9c6('0x5'));var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xe9c6('0x6'));module[_0xe9c6('0x7')]=function(_0x5abdc6,_0x42574f){return _0x5abdc6['define'](_0xe9c6('0x8'),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 b63794d..a3e9d2a 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 _0xc59d=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','stringify','error','code','message','ZendeskAccount,\x20%s,\x20%s','result','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','model','debug','catch','ShowZendeskAccount','lodash','util'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc59d,0x11e));var _0xdc59=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xc59d[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xdc59('0x0'));var util=require(_0xdc59('0x1'));var moment=require(_0xdc59('0x2'));var BPromise=require(_0xdc59('0x3'));var rs=require(_0xdc59('0x4'));var fs=require('fs');var Redis=require(_0xdc59('0x5'));var db=require(_0xdc59('0x6'))['db'];var utils=require(_0xdc59('0x7'));var logger=require(_0xdc59('0x8'))(_0xdc59('0x9'));var config=require(_0xdc59('0xa'));var jayson=require(_0xdc59('0xb'));var client=jayson[_0xdc59('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x410378,_0x40714,_0x2bcc53){return new BPromise(function(_0x9312e7,_0x22bbe8){return client[_0xdc59('0xd')](_0x410378,_0x2bcc53)[_0xdc59('0xe')](function(_0x482299){logger[_0xdc59('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x40714,_0xdc59('0x10'));logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x40714,_0xdc59('0x10'),JSON[_0xdc59('0x11')](_0x482299));if(_0x482299['error']){if(_0x482299[_0xdc59('0x12')][_0xdc59('0x13')]===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x40714,_0x482299[_0xdc59('0x12')][_0xdc59('0x14')]);return _0x22bbe8(_0x482299[_0xdc59('0x12')][_0xdc59('0x14')]);}logger[_0xdc59('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x40714,_0x482299[_0xdc59('0x12')][_0xdc59('0x14')]);return _0x9312e7(_0x482299[_0xdc59('0x12')][_0xdc59('0x14')]);}else{logger[_0xdc59('0xf')](_0xdc59('0x15'),_0x40714,_0xdc59('0x10'));_0x9312e7(_0x482299[_0xdc59('0x16')][_0xdc59('0x14')]);}})['catch'](function(_0x1dac04){logger['error'](_0xdc59('0x15'),_0x40714,_0x1dac04);_0x22bbe8(_0x1dac04);});});}exports[_0xdc59('0x17')]=function(_0x5ad066){var _0x19b3fb=this;return new Promise(function(_0x329049,_0x7df3fd){return db[_0xdc59('0x18')][_0xdc59('0x19')]({'raw':_0x5ad066['options']?_0x5ad066[_0xdc59('0x1a')][_0xdc59('0x1b')]===undefined?!![]:![]:!![],'where':_0x5ad066[_0xdc59('0x1a')]?_0x5ad066[_0xdc59('0x1a')][_0xdc59('0x1c')]||null:null,'attributes':_0x5ad066[_0xdc59('0x1a')]?_0x5ad066[_0xdc59('0x1a')][_0xdc59('0x1d')]||null:null,'limit':_0x5ad066[_0xdc59('0x1a')]?_0x5ad066[_0xdc59('0x1a')][_0xdc59('0x1e')]||null:null,'include':_0x5ad066[_0xdc59('0x1a')]?_0x5ad066[_0xdc59('0x1a')]['include']?_['map'](_0x5ad066[_0xdc59('0x1a')][_0xdc59('0x1f')],function(_0x5d40da){return{'model':db[_0x5d40da[_0xdc59('0x20')]],'as':_0x5d40da['as'],'attributes':_0x5d40da[_0xdc59('0x1d')],'include':_0x5d40da[_0xdc59('0x1f')]?_['map'](_0x5d40da[_0xdc59('0x1f')],function(_0x4a3802){return{'model':db[_0x4a3802[_0xdc59('0x20')]],'as':_0x4a3802['as'],'attributes':_0x4a3802[_0xdc59('0x1d')],'include':_0x4a3802['include']?_['map'](_0x4a3802['include'],function(_0x62e90d){return{'model':db[_0x62e90d['model']],'as':_0x62e90d['as'],'attributes':_0x62e90d[_0xdc59('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdc59('0xe')](function(_0x4abecd){logger[_0xdc59('0xf')](_0xdc59('0x17'),_0x5ad066);logger[_0xdc59('0x21')]('GetZendeskAccount',_0x5ad066,JSON[_0xdc59('0x11')](_0x4abecd));_0x329049(_0x4abecd);})[_0xdc59('0x22')](function(_0x4a98f9){logger['error'](_0xdc59('0x17'),_0x4a98f9[_0xdc59('0x14')],_0x5ad066);_0x7df3fd(_0x19b3fb['error'](0x1f4,_0x4a98f9[_0xdc59('0x14')]));});});};exports[_0xdc59('0x23')]=function(_0x449c2d){var _0x3b97e8=this;return new Promise(function(_0x31e33a,_0x35b432){return db[_0xdc59('0x18')]['find']({'raw':_0x449c2d['options']?_0x449c2d[_0xdc59('0x1a')][_0xdc59('0x1b')]===undefined?!![]:![]:!![],'where':_0x449c2d[_0xdc59('0x1a')]?_0x449c2d[_0xdc59('0x1a')][_0xdc59('0x1c')]||null:null,'attributes':_0x449c2d[_0xdc59('0x1a')]?_0x449c2d[_0xdc59('0x1a')][_0xdc59('0x1d')]||null:null,'include':_0x449c2d['options']?_0x449c2d[_0xdc59('0x1a')][_0xdc59('0x1f')]?_['map'](_0x449c2d[_0xdc59('0x1a')][_0xdc59('0x1f')],function(_0x1cfd8b){return{'model':db[_0x1cfd8b[_0xdc59('0x20')]],'as':_0x1cfd8b['as'],'attributes':_0x1cfd8b[_0xdc59('0x1d')],'include':_0x1cfd8b['include']?_['map'](_0x1cfd8b[_0xdc59('0x1f')],function(_0x37a901){return{'model':db[_0x37a901[_0xdc59('0x20')]],'as':_0x37a901['as'],'attributes':_0x37a901[_0xdc59('0x1d')],'include':_0x37a901[_0xdc59('0x1f')]?_['map'](_0x37a901['include'],function(_0x319df8){return{'model':db[_0x319df8[_0xdc59('0x20')]],'as':_0x319df8['as'],'attributes':_0x319df8[_0xdc59('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdc59('0xe')](function(_0x16d1ac){logger[_0xdc59('0xf')](_0xdc59('0x23'),_0x449c2d);logger[_0xdc59('0x21')](_0xdc59('0x23'),_0x449c2d,JSON[_0xdc59('0x11')](_0x16d1ac));_0x31e33a(_0x16d1ac);})[_0xdc59('0x22')](function(_0x47e639){logger['error']('ShowZendeskAccount',_0x47e639['message'],_0x449c2d);_0x35b432(_0x3b97e8[_0xdc59('0x12')](0x1f4,_0x47e639[_0xdc59('0x14')]));});});}; \ No newline at end of file +var _0x75b4=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','error','ZendeskAccount,\x20%s,\x20%s','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','map','model','debug','stringify','find','raw','ShowZendeskAccount','lodash','util','moment','bluebird'];(function(_0x57f22c,_0x1c18f5){var _0x414177=function(_0x403f11){while(--_0x403f11){_0x57f22c['push'](_0x57f22c['shift']());}};_0x414177(++_0x1c18f5);}(_0x75b4,0x164));var _0x475b=function(_0x588e79,_0x5913d8){_0x588e79=_0x588e79-0x0;var _0x474e6f=_0x75b4[_0x588e79];return _0x474e6f;};'use strict';var _=require(_0x475b('0x0'));var util=require(_0x475b('0x1'));var moment=require(_0x475b('0x2'));var BPromise=require(_0x475b('0x3'));var rs=require(_0x475b('0x4'));var fs=require('fs');var Redis=require(_0x475b('0x5'));var db=require(_0x475b('0x6'))['db'];var utils=require(_0x475b('0x7'));var logger=require(_0x475b('0x8'))(_0x475b('0x9'));var config=require(_0x475b('0xa'));var jayson=require(_0x475b('0xb'));var client=jayson[_0x475b('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x836d63,_0x2e1e6e,_0x2c7fef){return new BPromise(function(_0x412e7d,_0x4abb05){return client[_0x475b('0xd')](_0x836d63,_0x2c7fef)[_0x475b('0xe')](function(_0x54fd3b){logger[_0x475b('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x2e1e6e,_0x475b('0x10'));logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x2e1e6e,_0x475b('0x10'),JSON['stringify'](_0x54fd3b));if(_0x54fd3b[_0x475b('0x11')]){if(_0x54fd3b[_0x475b('0x11')]['code']===0x1f4){logger[_0x475b('0x11')](_0x475b('0x12'),_0x2e1e6e,_0x54fd3b[_0x475b('0x11')][_0x475b('0x13')]);return _0x4abb05(_0x54fd3b['error']['message']);}logger[_0x475b('0x11')](_0x475b('0x12'),_0x2e1e6e,_0x54fd3b[_0x475b('0x11')][_0x475b('0x13')]);return _0x412e7d(_0x54fd3b[_0x475b('0x11')][_0x475b('0x13')]);}else{logger[_0x475b('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x2e1e6e,'request\x20sent');_0x412e7d(_0x54fd3b['result']['message']);}})[_0x475b('0x14')](function(_0x227d5d){logger[_0x475b('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x2e1e6e,_0x227d5d);_0x4abb05(_0x227d5d);});});}exports[_0x475b('0x15')]=function(_0x4bcf02){var _0x28c12e=this;return new Promise(function(_0x3e65be,_0x18c565){return db[_0x475b('0x16')][_0x475b('0x17')]({'raw':_0x4bcf02[_0x475b('0x18')]?_0x4bcf02[_0x475b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4bcf02[_0x475b('0x18')]?_0x4bcf02[_0x475b('0x18')][_0x475b('0x19')]||null:null,'attributes':_0x4bcf02['options']?_0x4bcf02[_0x475b('0x18')][_0x475b('0x1a')]||null:null,'limit':_0x4bcf02[_0x475b('0x18')]?_0x4bcf02[_0x475b('0x18')][_0x475b('0x1b')]||null:null,'include':_0x4bcf02[_0x475b('0x18')]?_0x4bcf02[_0x475b('0x18')][_0x475b('0x1c')]?_[_0x475b('0x1d')](_0x4bcf02['options'][_0x475b('0x1c')],function(_0x53e417){return{'model':db[_0x53e417[_0x475b('0x1e')]],'as':_0x53e417['as'],'attributes':_0x53e417['attributes'],'include':_0x53e417['include']?_['map'](_0x53e417[_0x475b('0x1c')],function(_0x4ed7f0){return{'model':db[_0x4ed7f0[_0x475b('0x1e')]],'as':_0x4ed7f0['as'],'attributes':_0x4ed7f0[_0x475b('0x1a')],'include':_0x4ed7f0[_0x475b('0x1c')]?_['map'](_0x4ed7f0[_0x475b('0x1c')],function(_0x10f2ca){return{'model':db[_0x10f2ca[_0x475b('0x1e')]],'as':_0x10f2ca['as'],'attributes':_0x10f2ca[_0x475b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x6be3c8){logger['info'](_0x475b('0x15'),_0x4bcf02);logger[_0x475b('0x1f')](_0x475b('0x15'),_0x4bcf02,JSON[_0x475b('0x20')](_0x6be3c8));_0x3e65be(_0x6be3c8);})[_0x475b('0x14')](function(_0x4b6db4){logger['error'](_0x475b('0x15'),_0x4b6db4[_0x475b('0x13')],_0x4bcf02);_0x18c565(_0x28c12e['error'](0x1f4,_0x4b6db4[_0x475b('0x13')]));});});};exports['ShowZendeskAccount']=function(_0x1c6b35){var _0x4067e5=this;return new Promise(function(_0x1d6bbc,_0x50e012){return db[_0x475b('0x16')][_0x475b('0x21')]({'raw':_0x1c6b35[_0x475b('0x18')]?_0x1c6b35[_0x475b('0x18')][_0x475b('0x22')]===undefined?!![]:![]:!![],'where':_0x1c6b35['options']?_0x1c6b35[_0x475b('0x18')][_0x475b('0x19')]||null:null,'attributes':_0x1c6b35['options']?_0x1c6b35[_0x475b('0x18')][_0x475b('0x1a')]||null:null,'include':_0x1c6b35[_0x475b('0x18')]?_0x1c6b35[_0x475b('0x18')][_0x475b('0x1c')]?_['map'](_0x1c6b35[_0x475b('0x18')][_0x475b('0x1c')],function(_0x6997c8){return{'model':db[_0x6997c8[_0x475b('0x1e')]],'as':_0x6997c8['as'],'attributes':_0x6997c8[_0x475b('0x1a')],'include':_0x6997c8[_0x475b('0x1c')]?_['map'](_0x6997c8[_0x475b('0x1c')],function(_0x315ce5){return{'model':db[_0x315ce5[_0x475b('0x1e')]],'as':_0x315ce5['as'],'attributes':_0x315ce5[_0x475b('0x1a')],'include':_0x315ce5[_0x475b('0x1c')]?_['map'](_0x315ce5[_0x475b('0x1c')],function(_0x3be06b){return{'model':db[_0x3be06b['model']],'as':_0x3be06b['as'],'attributes':_0x3be06b[_0x475b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d1649){logger[_0x475b('0xf')](_0x475b('0x23'),_0x1c6b35);logger['debug']('ShowZendeskAccount',_0x1c6b35,JSON['stringify'](_0x4d1649));_0x1d6bbc(_0x4d1649);})[_0x475b('0x14')](function(_0x2d8de8){logger['error'](_0x475b('0x23'),_0x2d8de8[_0x475b('0x13')],_0x1c6b35);_0x50e012(_0x4067e5[_0x475b('0x11')](0x1f4,_0x2d8de8[_0x475b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index a8800fe..e940e9b 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 _0xf4eb=['put','update','delete','/:id','destroy','exports','multer','Router','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/tags','getTags','create','post','setTags'];(function(_0x80f133,_0x313800){var _0x46e178=function(_0x23abf4){while(--_0x23abf4){_0x80f133['push'](_0x80f133['shift']());}};_0x46e178(++_0x313800);}(_0xf4eb,0xec));var _0xbf4e=function(_0x5e6299,_0x7b91a1){_0x5e6299=_0x5e6299-0x0;var _0x464d33=_0xf4eb[_0x5e6299];return _0x464d33;};'use strict';var multer=require(_0xbf4e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbf4e('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var controller=require(_0xbf4e('0x4'));router[_0xbf4e('0x5')]('/',auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x7')]);router[_0xbf4e('0x5')]('/:id',auth[_0xbf4e('0x6')](),controller['show']);router['get'](_0xbf4e('0x8'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0x5')](_0xbf4e('0xa'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0xb')]);router['get']('/:id/descriptions',auth[_0xbf4e('0x6')](),controller['getDescriptions']);router[_0xbf4e('0x5')](_0xbf4e('0xc'),auth['isAuthenticated'](),controller[_0xbf4e('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbf4e('0xe')]);router[_0xbf4e('0xf')](_0xbf4e('0xc'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x10')]);router[_0xbf4e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xbf4e('0x12')]);router[_0xbf4e('0x13')](_0xbf4e('0x14'),auth['isAuthenticated'](),controller[_0xbf4e('0x15')]);module[_0xbf4e('0x16')]=router; \ No newline at end of file +var _0x087b=['getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields'];(function(_0x37bc6d,_0x2fd411){var _0x13bb4a=function(_0x2fd7d7){while(--_0x2fd7d7){_0x37bc6d['push'](_0x37bc6d['shift']());}};_0x13bb4a(++_0x2fd411);}(_0x087b,0x11a));var _0xb087=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0x087b[_0x1b6186];return _0x186121;};'use strict';var multer=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb087('0x2'));var router=express['Router']();var fs_extra=require(_0xb087('0x3'));var auth=require(_0xb087('0x4'));var interaction=require(_0xb087('0x5'));var config=require(_0xb087('0x6'));var controller=require(_0xb087('0x7'));router[_0xb087('0x8')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xa')]);router[_0xb087('0x8')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0xc')]);router[_0xb087('0x8')](_0xb087('0xd'),auth[_0xb087('0x9')](),controller[_0xb087('0xe')]);router[_0xb087('0x8')]('/:id/subjects',auth[_0xb087('0x9')](),controller[_0xb087('0xf')]);router[_0xb087('0x8')](_0xb087('0x10'),auth[_0xb087('0x9')](),controller[_0xb087('0x11')]);router[_0xb087('0x8')]('/:id/tags',auth[_0xb087('0x9')](),controller[_0xb087('0x12')]);router[_0xb087('0x13')]('/',auth['isAuthenticated'](),controller[_0xb087('0x14')]);router[_0xb087('0x13')](_0xb087('0x15'),auth[_0xb087('0x9')](),controller[_0xb087('0x16')]);router[_0xb087('0x17')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0x18')]);router[_0xb087('0x19')]('/:id',auth[_0xb087('0x9')](),controller[_0xb087('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 82725db..c7ed9f1 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 _0x3c88=['sequelize','exports','STRING'];(function(_0x3463d6,_0xe38e21){var _0x3ceed2=function(_0x2615d5){while(--_0x2615d5){_0x3463d6['push'](_0x3463d6['shift']());}};_0x3ceed2(++_0xe38e21);}(_0x3c88,0x1da));var _0x83c8=function(_0x56e89a,_0x2c7364){_0x56e89a=_0x56e89a-0x0;var _0x2ce005=_0x3c88[_0x56e89a];return _0x2ce005;};'use strict';var Sequelize=require(_0x83c8('0x0'));module[_0x83c8('0x1')]={'name':{'type':Sequelize[_0x83c8('0x2')]},'description':{'type':Sequelize[_0x83c8('0x2')]}}; \ No newline at end of file +var _0x542c=['exports','STRING','sequelize'];(function(_0xf07911,_0x43e327){var _0x50b69d=function(_0x15f234){while(--_0x15f234){_0xf07911['push'](_0xf07911['shift']());}};_0x50b69d(++_0x43e327);}(_0x542c,0x1e5));var _0xc542=function(_0x2b400a,_0x33c5cb){_0x2b400a=_0x2b400a-0x0;var _0x145d0c=_0x542c[_0x2b400a];return _0x145d0c;};'use strict';var Sequelize=require(_0xc542('0x0'));module[_0xc542('0x1')]={'name':{'type':Sequelize[_0xc542('0x2')]},'description':{'type':Sequelize[_0xc542('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index eb9b0a1..5592ce7 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 _0x22ef=['update','then','error','name','index','map','ZendeskConfiguration','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','destroy','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x22ef,0x1d9));var _0xf22e=function(_0x304393,_0x4ba6ca){_0x304393=_0x304393-0x0;var _0x4a7019=_0x22ef[_0x304393];return _0x4a7019;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf22e('0x0'));var zipdir=require(_0xf22e('0x1'));var jsonpatch=require(_0xf22e('0x2'));var rp=require(_0xf22e('0x3'));var moment=require(_0xf22e('0x4'));var BPromise=require(_0xf22e('0x5'));var Mustache=require('mustache');var util=require(_0xf22e('0x6'));var path=require(_0xf22e('0x7'));var sox=require(_0xf22e('0x8'));var csv=require(_0xf22e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf22e('0xa'));var _=require(_0xf22e('0xb'));var squel=require('squel');var crypto=require(_0xf22e('0xc'));var jsforce=require(_0xf22e('0xd'));var deskjs=require(_0xf22e('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf22e('0xf'));var Papa=require(_0xf22e('0x10'));var Redis=require(_0xf22e('0x11'));var authService=require(_0xf22e('0x12'));var qs=require(_0xf22e('0x13'));var as=require(_0xf22e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf22e('0x15'))(_0xf22e('0x16'));var utils=require(_0xf22e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xf22e('0x18'));var db=require(_0xf22e('0x19'))['db'];function respondWithStatusCode(_0x2172eb,_0x5b2ad9){_0x5b2ad9=_0x5b2ad9||0xcc;return function(_0x220688){if(_0x220688){return _0x2172eb[_0xf22e('0x1a')](_0x5b2ad9);}return _0x2172eb[_0xf22e('0x1b')](_0x5b2ad9)[_0xf22e('0x1c')]();};}function respondWithResult(_0x2541b8,_0x3e7583){_0x3e7583=_0x3e7583||0xc8;return function(_0x206e4f){if(_0x206e4f){return _0x2541b8[_0xf22e('0x1b')](_0x3e7583)[_0xf22e('0x1d')](_0x206e4f);}};}function respondWithFilteredResult(_0x12897f,_0x3247f8){return function(_0xcdc710){if(_0xcdc710){var _0xabfede=typeof _0x3247f8[_0xf22e('0x1e')]===_0xf22e('0x1f')&&typeof _0x3247f8['limit']===_0xf22e('0x1f');var _0x19f03e=_0xcdc710[_0xf22e('0x20')];var _0x532e0a=_0xabfede?0x0:_0x3247f8[_0xf22e('0x1e')];var _0x3c6c1e=_0xabfede?_0xcdc710[_0xf22e('0x20')]:_0x3247f8[_0xf22e('0x1e')]+_0x3247f8['limit'];var _0x638803;if(_0x3c6c1e>=_0x19f03e){_0x3c6c1e=_0x19f03e;_0x638803=0xc8;}else{_0x638803=0xce;}_0x12897f[_0xf22e('0x1b')](_0x638803);return _0x12897f['set'](_0xf22e('0x21'),_0x532e0a+'-'+_0x3c6c1e+'/'+_0x19f03e)[_0xf22e('0x1d')](_0xcdc710);}return null;};}function patchUpdates(_0x205030){return function(_0xfac623){try{jsonpatch[_0xf22e('0x22')](_0xfac623,_0x205030,!![]);}catch(_0x30eaf1){return BPromise[_0xf22e('0x23')](_0x30eaf1);}return _0xfac623[_0xf22e('0x24')]();};}function saveUpdates(_0x27b453,_0x27e624){return function(_0x2d9289){if(_0x2d9289){return _0x2d9289[_0xf22e('0x25')](_0x27b453)[_0xf22e('0x26')](function(_0x132aab){return _0x132aab;});}return null;};}function removeEntity(_0x41930c,_0x54a398){return function(_0xaf7565){if(_0xaf7565){return _0xaf7565['destroy']()[_0xf22e('0x26')](function(){_0x41930c['status'](0xcc)[_0xf22e('0x1c')]();});}};}function handleEntityNotFound(_0x3924a8,_0x571303){return function(_0x37976c){if(!_0x37976c){_0x3924a8[_0xf22e('0x1a')](0x194);}return _0x37976c;};}function handleError(_0xf4380c,_0xbfee32){_0xbfee32=_0xbfee32||0x1f4;return function(_0xa1b9){logger[_0xf22e('0x27')](_0xa1b9['stack']);if(_0xa1b9[_0xf22e('0x28')]){delete _0xa1b9[_0xf22e('0x28')];}_0xf4380c[_0xf22e('0x1b')](_0xbfee32)['send'](_0xa1b9);};}exports[_0xf22e('0x29')]=function(_0x3b52b8,_0x2801c5){var _0x2082f5={},_0x629a0f={},_0x38205f={'count':0x0,'rows':[]};var _0x428c79=_[_0xf22e('0x2a')](db[_0xf22e('0x2b')]['rawAttributes'],function(_0x3f7331){return{'name':_0x3f7331['fieldName'],'type':_0x3f7331[_0xf22e('0x2c')][_0xf22e('0x2d')]};});_0x629a0f[_0xf22e('0x2e')]=_[_0xf22e('0x2a')](_0x428c79,_0xf22e('0x28'));_0x629a0f[_0xf22e('0x2f')]=_['keys'](_0x3b52b8[_0xf22e('0x2f')]);_0x629a0f[_0xf22e('0x30')]=_[_0xf22e('0x31')](_0x629a0f[_0xf22e('0x2e')],_0x629a0f[_0xf22e('0x2f')]);_0x2082f5[_0xf22e('0x32')]=_['intersection'](_0x629a0f[_0xf22e('0x2e')],qs[_0xf22e('0x33')](_0x3b52b8[_0xf22e('0x2f')][_0xf22e('0x33')]));_0x2082f5['attributes']=_0x2082f5['attributes'][_0xf22e('0x34')]?_0x2082f5[_0xf22e('0x32')]:_0x629a0f[_0xf22e('0x2e')];if(!_0x3b52b8[_0xf22e('0x2f')][_0xf22e('0x35')](_0xf22e('0x36'))){_0x2082f5['limit']=qs[_0xf22e('0x37')](_0x3b52b8[_0xf22e('0x2f')]['limit']);_0x2082f5['offset']=qs[_0xf22e('0x1e')](_0x3b52b8[_0xf22e('0x2f')]['offset']);}_0x2082f5[_0xf22e('0x38')]=qs[_0xf22e('0x39')](_0x3b52b8[_0xf22e('0x2f')]['sort']);_0x2082f5['where']=qs[_0xf22e('0x30')](_[_0xf22e('0x3a')](_0x3b52b8[_0xf22e('0x2f')],_0x629a0f[_0xf22e('0x30')]),_0x428c79);if(_0x3b52b8['query']['filter']){_0x2082f5[_0xf22e('0x3b')]=_['merge'](_0x2082f5['where'],{'$or':_[_0xf22e('0x2a')](_0x428c79,function(_0x4c8c53){if(_0x4c8c53[_0xf22e('0x2c')]!=='VIRTUAL'){var _0x2872e1={};_0x2872e1[_0x4c8c53[_0xf22e('0x28')]]={'$like':'%'+_0x3b52b8[_0xf22e('0x2f')][_0xf22e('0x3c')]+'%'};return _0x2872e1;}})});}_0x2082f5=_[_0xf22e('0x3d')]({},_0x2082f5,_0x3b52b8[_0xf22e('0x3e')]);var _0x12d9fe={'where':_0x2082f5['where']};return db[_0xf22e('0x2b')][_0xf22e('0x20')](_0x12d9fe)['then'](function(_0x42b685){_0x38205f['count']=_0x42b685;if(_0x3b52b8[_0xf22e('0x2f')][_0xf22e('0x3f')]){_0x2082f5[_0xf22e('0x40')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xf22e('0x41')](_0x2082f5);})['then'](function(_0x7d1ad1){_0x38205f[_0xf22e('0x42')]=_0x7d1ad1;return _0x38205f;})[_0xf22e('0x26')](respondWithFilteredResult(_0x2801c5,_0x2082f5))[_0xf22e('0x43')](handleError(_0x2801c5,null));};exports[_0xf22e('0x44')]=function(_0x383f96,_0x52eb56){var _0x1bddbc={'raw':![],'where':{'id':_0x383f96[_0xf22e('0x45')]['id']}},_0x358b92={};_0x358b92['model']=_[_0xf22e('0x46')](db['ZendeskConfiguration'][_0xf22e('0x47')]);_0x358b92[_0xf22e('0x2f')]=_['keys'](_0x383f96['query']);_0x358b92['filters']=_[_0xf22e('0x31')](_0x358b92[_0xf22e('0x2e')],_0x358b92[_0xf22e('0x2f')]);_0x1bddbc[_0xf22e('0x32')]=_['intersection'](_0x358b92['model'],qs[_0xf22e('0x33')](_0x383f96[_0xf22e('0x2f')][_0xf22e('0x33')]));_0x1bddbc[_0xf22e('0x32')]=_0x1bddbc[_0xf22e('0x32')][_0xf22e('0x34')]?_0x1bddbc[_0xf22e('0x32')]:_0x358b92[_0xf22e('0x2e')];if(_0x383f96[_0xf22e('0x2f')]['includeAll']){_0x1bddbc[_0xf22e('0x40')]=[{'all':!![]}];}_0x1bddbc=_[_0xf22e('0x3d')]({},_0x1bddbc,_0x383f96[_0xf22e('0x3e')]);return db['ZendeskConfiguration'][_0xf22e('0x48')](_0x1bddbc)[_0xf22e('0x26')](handleEntityNotFound(_0x52eb56,null))[_0xf22e('0x26')](respondWithResult(_0x52eb56,null))[_0xf22e('0x43')](handleError(_0x52eb56,null));};exports[_0xf22e('0x49')]=function(_0x5dc1c6,_0x3adfea){return db[_0xf22e('0x2b')][_0xf22e('0x49')](_0x5dc1c6['body'],{})[_0xf22e('0x26')](respondWithResult(_0x3adfea,0xc9))[_0xf22e('0x43')](handleError(_0x3adfea,null));};exports['update']=function(_0x360898,_0x9837b6){if(_0x360898[_0xf22e('0x4a')]['id']){delete _0x360898[_0xf22e('0x4a')]['id'];}return db[_0xf22e('0x2b')][_0xf22e('0x48')]({'where':{'id':_0x360898[_0xf22e('0x45')]['id']}})[_0xf22e('0x26')](handleEntityNotFound(_0x9837b6,null))['then'](saveUpdates(_0x360898[_0xf22e('0x4a')],null))['then'](respondWithResult(_0x9837b6,null))['catch'](handleError(_0x9837b6,null));};exports[_0xf22e('0x4b')]=function(_0x5dcfaf,_0x539c49){return db[_0xf22e('0x2b')][_0xf22e('0x48')]({'where':{'id':_0x5dcfaf[_0xf22e('0x45')]['id']}})[_0xf22e('0x26')](handleEntityNotFound(_0x539c49,null))[_0xf22e('0x26')](removeEntity(_0x539c49,null))[_0xf22e('0x43')](handleError(_0x539c49,null));};exports[_0xf22e('0x4c')]=function(_0x31d2da,_0x4fd36b,_0x3e15f1){var _0x1f2c58={};var _0x4d5311={};var _0x2c390c;var _0x56d01c;return db[_0xf22e('0x2b')][_0xf22e('0x4d')]({'where':{'id':_0x31d2da[_0xf22e('0x45')]['id']}})[_0xf22e('0x26')](handleEntityNotFound(_0x4fd36b,null))['then'](function(_0x4ff2fd){if(_0x4ff2fd){_0x2c390c=_0x4ff2fd;_0x4d5311[_0xf22e('0x2e')]=_[_0xf22e('0x46')](db['ZendeskField']['rawAttributes']);_0x4d5311[_0xf22e('0x2f')]=_[_0xf22e('0x46')](_0x31d2da[_0xf22e('0x2f')]);_0x4d5311[_0xf22e('0x30')]=_[_0xf22e('0x31')](_0x4d5311['model'],_0x4d5311[_0xf22e('0x2f')]);_0x1f2c58[_0xf22e('0x32')]=_[_0xf22e('0x31')](_0x4d5311['model'],qs[_0xf22e('0x33')](_0x31d2da[_0xf22e('0x2f')][_0xf22e('0x33')]));_0x1f2c58[_0xf22e('0x32')]=_0x1f2c58[_0xf22e('0x32')]['length']?_0x1f2c58['attributes']:_0x4d5311[_0xf22e('0x2e')];_0x1f2c58['order']=qs[_0xf22e('0x39')](_0x31d2da['query'][_0xf22e('0x39')]);_0x1f2c58[_0xf22e('0x3b')]=qs[_0xf22e('0x30')](_['pick'](_0x31d2da[_0xf22e('0x2f')],_0x4d5311['filters']));if(_0x31d2da['query'][_0xf22e('0x3c')]){_0x1f2c58[_0xf22e('0x3b')]=_[_0xf22e('0x3d')](_0x1f2c58['where'],{'$or':_['map'](_0x1f2c58[_0xf22e('0x32')],function(_0x1d0ab7){var _0x34e13a={};_0x34e13a[_0x1d0ab7]={'$like':'%'+_0x31d2da['query'][_0xf22e('0x3c')]+'%'};return _0x34e13a;})});}_0x1f2c58=_[_0xf22e('0x3d')]({},_0x1f2c58,_0x31d2da[_0xf22e('0x3e')]);return _0x2c390c[_0xf22e('0x4c')](_0x1f2c58);}})[_0xf22e('0x26')](function(_0x574b90){if(_0x574b90){_0x56d01c=_0x574b90[_0xf22e('0x34')];if(!_0x31d2da[_0xf22e('0x2f')][_0xf22e('0x35')](_0xf22e('0x36'))){_0x1f2c58[_0xf22e('0x37')]=qs[_0xf22e('0x37')](_0x31d2da['query'][_0xf22e('0x37')]);_0x1f2c58[_0xf22e('0x1e')]=qs[_0xf22e('0x1e')](_0x31d2da['query']['offset']);}return _0x2c390c[_0xf22e('0x4c')](_0x1f2c58);}})['then'](function(_0xb2a5aa){if(_0xb2a5aa){return _0xb2a5aa?{'count':_0x56d01c,'rows':_0xb2a5aa}:null;}})[_0xf22e('0x26')](respondWithResult(_0x4fd36b,null))['catch'](handleError(_0x4fd36b,null));};exports['getSubjects']=function(_0x1aba3d,_0x73e944,_0x35ef5b){var _0x4e48c2={};var _0x5b2b23={};var _0x3e788e;var _0x4f888c;return db[_0xf22e('0x2b')]['findOne']({'where':{'id':_0x1aba3d[_0xf22e('0x45')]['id']}})[_0xf22e('0x26')](handleEntityNotFound(_0x73e944,null))['then'](function(_0x23905a){if(_0x23905a){_0x3e788e=_0x23905a;_0x5b2b23['model']=_[_0xf22e('0x46')](db[_0xf22e('0x4e')]['rawAttributes']);_0x5b2b23[_0xf22e('0x2f')]=_[_0xf22e('0x46')](_0x1aba3d['query']);_0x5b2b23['filters']=_[_0xf22e('0x31')](_0x5b2b23[_0xf22e('0x2e')],_0x5b2b23[_0xf22e('0x2f')]);_0x4e48c2[_0xf22e('0x32')]=_['intersection'](_0x5b2b23[_0xf22e('0x2e')],qs[_0xf22e('0x33')](_0x1aba3d[_0xf22e('0x2f')]['fields']));_0x4e48c2[_0xf22e('0x32')]=_0x4e48c2[_0xf22e('0x32')][_0xf22e('0x34')]?_0x4e48c2['attributes']:_0x5b2b23[_0xf22e('0x2e')];_0x4e48c2[_0xf22e('0x38')]=qs[_0xf22e('0x39')](_0x1aba3d['query']['sort']);_0x4e48c2[_0xf22e('0x3b')]=qs[_0xf22e('0x30')](_[_0xf22e('0x3a')](_0x1aba3d[_0xf22e('0x2f')],_0x5b2b23[_0xf22e('0x30')]));if(_0x1aba3d['query'][_0xf22e('0x3c')]){_0x4e48c2['where']=_[_0xf22e('0x3d')](_0x4e48c2[_0xf22e('0x3b')],{'$or':_['map'](_0x4e48c2[_0xf22e('0x32')],function(_0x4c5846){var _0x5d6a6b={};_0x5d6a6b[_0x4c5846]={'$like':'%'+_0x1aba3d[_0xf22e('0x2f')]['filter']+'%'};return _0x5d6a6b;})});}_0x4e48c2=_[_0xf22e('0x3d')]({},_0x4e48c2,_0x1aba3d[_0xf22e('0x3e')]);return _0x3e788e['getSubjects'](_0x4e48c2);}})[_0xf22e('0x26')](function(_0x28a226){if(_0x28a226){_0x4f888c=_0x28a226[_0xf22e('0x34')];if(!_0x1aba3d[_0xf22e('0x2f')][_0xf22e('0x35')](_0xf22e('0x36'))){_0x4e48c2['limit']=qs[_0xf22e('0x37')](_0x1aba3d[_0xf22e('0x2f')][_0xf22e('0x37')]);_0x4e48c2[_0xf22e('0x1e')]=qs['offset'](_0x1aba3d[_0xf22e('0x2f')][_0xf22e('0x1e')]);}return _0x3e788e[_0xf22e('0x4f')](_0x4e48c2);}})[_0xf22e('0x26')](function(_0xed7de){if(_0xed7de){return _0xed7de?{'count':_0x4f888c,'rows':_0xed7de}:null;}})[_0xf22e('0x26')](respondWithResult(_0x73e944,null))['catch'](handleError(_0x73e944,null));};exports[_0xf22e('0x50')]=function(_0x40c0eb,_0x4c4554,_0x3794d8){var _0x46067a={};var _0x2bc84b={};var _0x15c519;var _0x1a4eb0;return db[_0xf22e('0x2b')][_0xf22e('0x4d')]({'where':{'id':_0x40c0eb[_0xf22e('0x45')]['id']}})[_0xf22e('0x26')](handleEntityNotFound(_0x4c4554,null))[_0xf22e('0x26')](function(_0x3f93dd){if(_0x3f93dd){_0x15c519=_0x3f93dd;_0x2bc84b[_0xf22e('0x2e')]=_[_0xf22e('0x46')](db[_0xf22e('0x4e')][_0xf22e('0x47')]);_0x2bc84b[_0xf22e('0x2f')]=_[_0xf22e('0x46')](_0x40c0eb['query']);_0x2bc84b['filters']=_[_0xf22e('0x31')](_0x2bc84b[_0xf22e('0x2e')],_0x2bc84b[_0xf22e('0x2f')]);_0x46067a[_0xf22e('0x32')]=_[_0xf22e('0x31')](_0x2bc84b[_0xf22e('0x2e')],qs[_0xf22e('0x33')](_0x40c0eb[_0xf22e('0x2f')]['fields']));_0x46067a['attributes']=_0x46067a['attributes'][_0xf22e('0x34')]?_0x46067a[_0xf22e('0x32')]:_0x2bc84b[_0xf22e('0x2e')];_0x46067a[_0xf22e('0x38')]=qs[_0xf22e('0x39')](_0x40c0eb[_0xf22e('0x2f')][_0xf22e('0x39')]);_0x46067a[_0xf22e('0x3b')]=qs[_0xf22e('0x30')](_[_0xf22e('0x3a')](_0x40c0eb[_0xf22e('0x2f')],_0x2bc84b['filters']));if(_0x40c0eb[_0xf22e('0x2f')][_0xf22e('0x3c')]){_0x46067a['where']=_[_0xf22e('0x3d')](_0x46067a[_0xf22e('0x3b')],{'$or':_[_0xf22e('0x2a')](_0x46067a[_0xf22e('0x32')],function(_0x5d4674){var _0x391fd0={};_0x391fd0[_0x5d4674]={'$like':'%'+_0x40c0eb['query'][_0xf22e('0x3c')]+'%'};return _0x391fd0;})});}_0x46067a=_[_0xf22e('0x3d')]({},_0x46067a,_0x40c0eb[_0xf22e('0x3e')]);return _0x15c519[_0xf22e('0x50')](_0x46067a);}})[_0xf22e('0x26')](function(_0x16cd56){if(_0x16cd56){_0x1a4eb0=_0x16cd56['length'];if(!_0x40c0eb[_0xf22e('0x2f')]['hasOwnProperty'](_0xf22e('0x36'))){_0x46067a[_0xf22e('0x37')]=qs[_0xf22e('0x37')](_0x40c0eb[_0xf22e('0x2f')][_0xf22e('0x37')]);_0x46067a[_0xf22e('0x1e')]=qs[_0xf22e('0x1e')](_0x40c0eb[_0xf22e('0x2f')][_0xf22e('0x1e')]);}return _0x15c519['getDescriptions'](_0x46067a);}})[_0xf22e('0x26')](function(_0xb0763a){if(_0xb0763a){return _0xb0763a?{'count':_0x1a4eb0,'rows':_0xb0763a}:null;}})[_0xf22e('0x26')](respondWithResult(_0x4c4554,null))[_0xf22e('0x43')](handleError(_0x4c4554,null));};exports[_0xf22e('0x51')]=function(_0x52e683,_0x4cdfd1,_0x558aa4){var _0x35f3d0={};var _0x13186d={};var _0x4412f0;var _0x4ed94a;return db['ZendeskConfiguration'][_0xf22e('0x4d')]({'where':{'id':_0x52e683[_0xf22e('0x45')]['id']}})[_0xf22e('0x26')](handleEntityNotFound(_0x4cdfd1,null))[_0xf22e('0x26')](function(_0x1e9d36){if(_0x1e9d36){_0x4412f0=_0x1e9d36;_0x13186d[_0xf22e('0x2e')]=_[_0xf22e('0x46')](db[_0xf22e('0x52')]['rawAttributes']);_0x13186d[_0xf22e('0x2f')]=_[_0xf22e('0x46')](_0x52e683['query']);_0x13186d[_0xf22e('0x30')]=_[_0xf22e('0x31')](_0x13186d['model'],_0x13186d[_0xf22e('0x2f')]);_0x35f3d0[_0xf22e('0x32')]=_['intersection'](_0x13186d[_0xf22e('0x2e')],qs[_0xf22e('0x33')](_0x52e683['query'][_0xf22e('0x33')]));_0x35f3d0[_0xf22e('0x32')]=_0x35f3d0[_0xf22e('0x32')][_0xf22e('0x34')]?_0x35f3d0['attributes']:_0x13186d[_0xf22e('0x2e')];_0x35f3d0[_0xf22e('0x38')]=qs[_0xf22e('0x39')](_0x52e683[_0xf22e('0x2f')][_0xf22e('0x39')]);_0x35f3d0[_0xf22e('0x3b')]=qs[_0xf22e('0x30')](_[_0xf22e('0x3a')](_0x52e683['query'],_0x13186d['filters']));if(_0x52e683[_0xf22e('0x2f')]['filter']){_0x35f3d0[_0xf22e('0x3b')]=_[_0xf22e('0x3d')](_0x35f3d0[_0xf22e('0x3b')],{'$or':_[_0xf22e('0x2a')](_0x35f3d0[_0xf22e('0x32')],function(_0x150845){var _0x7b90f5={};_0x7b90f5[_0x150845]={'$like':'%'+_0x52e683[_0xf22e('0x2f')][_0xf22e('0x3c')]+'%'};return _0x7b90f5;})});}_0x35f3d0=_[_0xf22e('0x3d')]({},_0x35f3d0,_0x52e683[_0xf22e('0x3e')]);return _0x4412f0['getTags'](_0x35f3d0);}})[_0xf22e('0x26')](function(_0x5a8649){if(_0x5a8649){_0x4ed94a=_0x5a8649[_0xf22e('0x34')];if(!_0x52e683[_0xf22e('0x2f')][_0xf22e('0x35')](_0xf22e('0x36'))){_0x35f3d0['limit']=qs[_0xf22e('0x37')](_0x52e683[_0xf22e('0x2f')]['limit']);_0x35f3d0[_0xf22e('0x1e')]=qs[_0xf22e('0x1e')](_0x52e683[_0xf22e('0x2f')][_0xf22e('0x1e')]);}return _0x4412f0[_0xf22e('0x51')](_0x35f3d0);}})['then'](function(_0x33d83d){if(_0x33d83d){return _0x33d83d?{'count':_0x4ed94a,'rows':_0x33d83d}:null;}})[_0xf22e('0x26')](respondWithResult(_0x4cdfd1,null))[_0xf22e('0x43')](handleError(_0x4cdfd1,null));};exports['setTags']=function(_0x27ec1c,_0x1d3bcb,_0x5e0bf7){if(_0x27ec1c[_0xf22e('0x4a')]['id']){delete _0x27ec1c[_0xf22e('0x4a')]['id'];}return db['ZendeskConfiguration'][_0xf22e('0x4d')]({'where':{'id':_0x27ec1c[_0xf22e('0x45')]['id']}})[_0xf22e('0x26')](handleEntityNotFound(_0x1d3bcb,null))[_0xf22e('0x26')](function(_0x485a13){if(_0x485a13){return _0x485a13[_0xf22e('0x53')](_0x27ec1c['body'][_0xf22e('0x54')]||[]);}return null;})['then'](respondWithResult(_0x1d3bcb,null))[_0xf22e('0x43')](handleError(_0x1d3bcb,null));}; \ No newline at end of file +var _0x3249=['Content-Range','json','apply','update','then','destroy','stack','name','send','index','map','ZendeskConfiguration','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','intersection','find','create','body','params','getFields','ZendeskField','order','pick','nolimit','getSubjects','findOne','rawAttributes','getDescriptions','getTags','Tag','setTags','eml-format','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','offset'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x3249,0x1b3));var _0x9324=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x3249[_0x4d613c];return _0x301fe3;};'use strict';var emlformat=require(_0x9324('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9324('0x1'));var rp=require(_0x9324('0x2'));var moment=require('moment');var BPromise=require(_0x9324('0x3'));var Mustache=require(_0x9324('0x4'));var util=require('util');var path=require('path');var sox=require(_0x9324('0x5'));var csv=require(_0x9324('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9324('0x7'));var squel=require(_0x9324('0x8'));var crypto=require('crypto');var jsforce=require(_0x9324('0x9'));var deskjs=require(_0x9324('0xa'));var toCsv=require('to-csv');var querystring=require(_0x9324('0xb'));var Papa=require(_0x9324('0xc'));var Redis=require(_0x9324('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x9324('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9324('0xf'));var logger=require(_0x9324('0x10'))('api');var utils=require(_0x9324('0x11'));var config=require(_0x9324('0x12'));var licenseUtil=require(_0x9324('0x13'));var db=require(_0x9324('0x14'))['db'];function respondWithStatusCode(_0xb8a34f,_0x223c14){_0x223c14=_0x223c14||0xcc;return function(_0x42b833){if(_0x42b833){return _0xb8a34f[_0x9324('0x15')](_0x223c14);}return _0xb8a34f['status'](_0x223c14)[_0x9324('0x16')]();};}function respondWithResult(_0x510b2a,_0x3a4bd0){_0x3a4bd0=_0x3a4bd0||0xc8;return function(_0x298f12){if(_0x298f12){return _0x510b2a[_0x9324('0x17')](_0x3a4bd0)['json'](_0x298f12);}};}function respondWithFilteredResult(_0x23f027,_0x1b4939){return function(_0x106eb8){if(_0x106eb8){var _0x298f72=typeof _0x1b4939['offset']===_0x9324('0x18')&&typeof _0x1b4939[_0x9324('0x19')]===_0x9324('0x18');var _0x3c1c27=_0x106eb8['count'];var _0x3c622b=_0x298f72?0x0:_0x1b4939[_0x9324('0x1a')];var _0x3ff8e3=_0x298f72?_0x106eb8['count']:_0x1b4939[_0x9324('0x1a')]+_0x1b4939[_0x9324('0x19')];var _0x18a499;if(_0x3ff8e3>=_0x3c1c27){_0x3ff8e3=_0x3c1c27;_0x18a499=0xc8;}else{_0x18a499=0xce;}_0x23f027['status'](_0x18a499);return _0x23f027['set'](_0x9324('0x1b'),_0x3c622b+'-'+_0x3ff8e3+'/'+_0x3c1c27)[_0x9324('0x1c')](_0x106eb8);}return null;};}function patchUpdates(_0x1b008a){return function(_0x5c4c2e){try{jsonpatch[_0x9324('0x1d')](_0x5c4c2e,_0x1b008a,!![]);}catch(_0x161d0d){return BPromise['reject'](_0x161d0d);}return _0x5c4c2e['save']();};}function saveUpdates(_0x4ad391,_0x29d5be){return function(_0x40c268){if(_0x40c268){return _0x40c268[_0x9324('0x1e')](_0x4ad391)[_0x9324('0x1f')](function(_0x4d47ad){return _0x4d47ad;});}return null;};}function removeEntity(_0x11fe50,_0x39b05c){return function(_0x100ced){if(_0x100ced){return _0x100ced[_0x9324('0x20')]()[_0x9324('0x1f')](function(){_0x11fe50[_0x9324('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x492dcd,_0x39a829){return function(_0x497c6d){if(!_0x497c6d){_0x492dcd[_0x9324('0x15')](0x194);}return _0x497c6d;};}function handleError(_0x5ccb17,_0x3aa97c){_0x3aa97c=_0x3aa97c||0x1f4;return function(_0x2b6268){logger['error'](_0x2b6268[_0x9324('0x21')]);if(_0x2b6268[_0x9324('0x22')]){delete _0x2b6268['name'];}_0x5ccb17[_0x9324('0x17')](_0x3aa97c)[_0x9324('0x23')](_0x2b6268);};}exports[_0x9324('0x24')]=function(_0x5e6814,_0x1eb4af){var _0x1236fd={},_0x160a00={},_0x325fb4={'count':0x0,'rows':[]};var _0x5de5cb=_[_0x9324('0x25')](db[_0x9324('0x26')]['rawAttributes'],function(_0x1b0313){return{'name':_0x1b0313[_0x9324('0x27')],'type':_0x1b0313[_0x9324('0x28')]['key']};});_0x160a00[_0x9324('0x29')]=_[_0x9324('0x25')](_0x5de5cb,_0x9324('0x22'));_0x160a00[_0x9324('0x2a')]=_[_0x9324('0x2b')](_0x5e6814[_0x9324('0x2a')]);_0x160a00[_0x9324('0x2c')]=_['intersection'](_0x160a00[_0x9324('0x29')],_0x160a00[_0x9324('0x2a')]);_0x1236fd[_0x9324('0x2d')]=_['intersection'](_0x160a00[_0x9324('0x29')],qs[_0x9324('0x2e')](_0x5e6814[_0x9324('0x2a')][_0x9324('0x2e')]));_0x1236fd[_0x9324('0x2d')]=_0x1236fd[_0x9324('0x2d')][_0x9324('0x2f')]?_0x1236fd['attributes']:_0x160a00[_0x9324('0x29')];if(!_0x5e6814[_0x9324('0x2a')][_0x9324('0x30')]('nolimit')){_0x1236fd[_0x9324('0x19')]=qs['limit'](_0x5e6814[_0x9324('0x2a')][_0x9324('0x19')]);_0x1236fd[_0x9324('0x1a')]=qs[_0x9324('0x1a')](_0x5e6814[_0x9324('0x2a')][_0x9324('0x1a')]);}_0x1236fd['order']=qs[_0x9324('0x31')](_0x5e6814[_0x9324('0x2a')][_0x9324('0x31')]);_0x1236fd[_0x9324('0x32')]=qs[_0x9324('0x2c')](_['pick'](_0x5e6814[_0x9324('0x2a')],_0x160a00['filters']),_0x5de5cb);if(_0x5e6814['query'][_0x9324('0x33')]){_0x1236fd[_0x9324('0x32')]=_[_0x9324('0x34')](_0x1236fd[_0x9324('0x32')],{'$or':_['map'](_0x5de5cb,function(_0x4c08af){if(_0x4c08af[_0x9324('0x28')]!==_0x9324('0x35')){var _0x197678={};_0x197678[_0x4c08af[_0x9324('0x22')]]={'$like':'%'+_0x5e6814['query'][_0x9324('0x33')]+'%'};return _0x197678;}})});}_0x1236fd=_[_0x9324('0x34')]({},_0x1236fd,_0x5e6814[_0x9324('0x36')]);var _0x5c7496={'where':_0x1236fd['where']};return db[_0x9324('0x26')]['count'](_0x5c7496)[_0x9324('0x1f')](function(_0x912f99){_0x325fb4['count']=_0x912f99;if(_0x5e6814[_0x9324('0x2a')][_0x9324('0x37')]){_0x1236fd[_0x9324('0x38')]=[{'all':!![]}];}return db[_0x9324('0x26')][_0x9324('0x39')](_0x1236fd);})['then'](function(_0x4d8112){_0x325fb4['rows']=_0x4d8112;return _0x325fb4;})[_0x9324('0x1f')](respondWithFilteredResult(_0x1eb4af,_0x1236fd))[_0x9324('0x3a')](handleError(_0x1eb4af,null));};exports[_0x9324('0x3b')]=function(_0x289d4a,_0x128932){var _0xaf3e33={'raw':![],'where':{'id':_0x289d4a['params']['id']}},_0x4e24b7={};_0x4e24b7[_0x9324('0x29')]=_['keys'](db[_0x9324('0x26')]['rawAttributes']);_0x4e24b7[_0x9324('0x2a')]=_['keys'](_0x289d4a[_0x9324('0x2a')]);_0x4e24b7[_0x9324('0x2c')]=_[_0x9324('0x3c')](_0x4e24b7['model'],_0x4e24b7['query']);_0xaf3e33[_0x9324('0x2d')]=_[_0x9324('0x3c')](_0x4e24b7['model'],qs['fields'](_0x289d4a['query'][_0x9324('0x2e')]));_0xaf3e33['attributes']=_0xaf3e33['attributes']['length']?_0xaf3e33[_0x9324('0x2d')]:_0x4e24b7['model'];if(_0x289d4a[_0x9324('0x2a')][_0x9324('0x37')]){_0xaf3e33[_0x9324('0x38')]=[{'all':!![]}];}_0xaf3e33=_[_0x9324('0x34')]({},_0xaf3e33,_0x289d4a[_0x9324('0x36')]);return db['ZendeskConfiguration'][_0x9324('0x3d')](_0xaf3e33)[_0x9324('0x1f')](handleEntityNotFound(_0x128932,null))[_0x9324('0x1f')](respondWithResult(_0x128932,null))[_0x9324('0x3a')](handleError(_0x128932,null));};exports[_0x9324('0x3e')]=function(_0x39d18b,_0x22e216){return db[_0x9324('0x26')][_0x9324('0x3e')](_0x39d18b[_0x9324('0x3f')],{})[_0x9324('0x1f')](respondWithResult(_0x22e216,0xc9))[_0x9324('0x3a')](handleError(_0x22e216,null));};exports[_0x9324('0x1e')]=function(_0x200352,_0x50e41b){if(_0x200352[_0x9324('0x3f')]['id']){delete _0x200352[_0x9324('0x3f')]['id'];}return db[_0x9324('0x26')][_0x9324('0x3d')]({'where':{'id':_0x200352[_0x9324('0x40')]['id']}})[_0x9324('0x1f')](handleEntityNotFound(_0x50e41b,null))[_0x9324('0x1f')](saveUpdates(_0x200352[_0x9324('0x3f')],null))[_0x9324('0x1f')](respondWithResult(_0x50e41b,null))['catch'](handleError(_0x50e41b,null));};exports[_0x9324('0x20')]=function(_0x2c2843,_0x5e892e){return db['ZendeskConfiguration']['find']({'where':{'id':_0x2c2843[_0x9324('0x40')]['id']}})[_0x9324('0x1f')](handleEntityNotFound(_0x5e892e,null))[_0x9324('0x1f')](removeEntity(_0x5e892e,null))[_0x9324('0x3a')](handleError(_0x5e892e,null));};exports[_0x9324('0x41')]=function(_0x401764,_0x13203e,_0x27579f){var _0x348822={};var _0x25216d={};var _0x463595;var _0xb0e98e;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x401764['params']['id']}})['then'](handleEntityNotFound(_0x13203e,null))[_0x9324('0x1f')](function(_0x484247){if(_0x484247){_0x463595=_0x484247;_0x25216d[_0x9324('0x29')]=_[_0x9324('0x2b')](db[_0x9324('0x42')]['rawAttributes']);_0x25216d[_0x9324('0x2a')]=_[_0x9324('0x2b')](_0x401764['query']);_0x25216d[_0x9324('0x2c')]=_[_0x9324('0x3c')](_0x25216d[_0x9324('0x29')],_0x25216d[_0x9324('0x2a')]);_0x348822[_0x9324('0x2d')]=_[_0x9324('0x3c')](_0x25216d[_0x9324('0x29')],qs[_0x9324('0x2e')](_0x401764[_0x9324('0x2a')][_0x9324('0x2e')]));_0x348822[_0x9324('0x2d')]=_0x348822[_0x9324('0x2d')][_0x9324('0x2f')]?_0x348822[_0x9324('0x2d')]:_0x25216d[_0x9324('0x29')];_0x348822[_0x9324('0x43')]=qs['sort'](_0x401764['query'][_0x9324('0x31')]);_0x348822[_0x9324('0x32')]=qs[_0x9324('0x2c')](_[_0x9324('0x44')](_0x401764[_0x9324('0x2a')],_0x25216d[_0x9324('0x2c')]));if(_0x401764[_0x9324('0x2a')][_0x9324('0x33')]){_0x348822['where']=_[_0x9324('0x34')](_0x348822['where'],{'$or':_[_0x9324('0x25')](_0x348822['attributes'],function(_0x49743a){var _0x1f6619={};_0x1f6619[_0x49743a]={'$like':'%'+_0x401764[_0x9324('0x2a')][_0x9324('0x33')]+'%'};return _0x1f6619;})});}_0x348822=_['merge']({},_0x348822,_0x401764[_0x9324('0x36')]);return _0x463595[_0x9324('0x41')](_0x348822);}})[_0x9324('0x1f')](function(_0x24b4a0){if(_0x24b4a0){_0xb0e98e=_0x24b4a0[_0x9324('0x2f')];if(!_0x401764[_0x9324('0x2a')]['hasOwnProperty'](_0x9324('0x45'))){_0x348822[_0x9324('0x19')]=qs[_0x9324('0x19')](_0x401764[_0x9324('0x2a')][_0x9324('0x19')]);_0x348822['offset']=qs[_0x9324('0x1a')](_0x401764[_0x9324('0x2a')][_0x9324('0x1a')]);}return _0x463595[_0x9324('0x41')](_0x348822);}})['then'](function(_0x224b03){if(_0x224b03){return _0x224b03?{'count':_0xb0e98e,'rows':_0x224b03}:null;}})[_0x9324('0x1f')](respondWithResult(_0x13203e,null))[_0x9324('0x3a')](handleError(_0x13203e,null));};exports[_0x9324('0x46')]=function(_0x26eebc,_0x191203,_0x5c6a79){var _0x3fff2a={};var _0x54a55c={};var _0x5a582a;var _0x1dde7a;return db['ZendeskConfiguration'][_0x9324('0x47')]({'where':{'id':_0x26eebc['params']['id']}})[_0x9324('0x1f')](handleEntityNotFound(_0x191203,null))[_0x9324('0x1f')](function(_0x2d9bee){if(_0x2d9bee){_0x5a582a=_0x2d9bee;_0x54a55c[_0x9324('0x29')]=_[_0x9324('0x2b')](db[_0x9324('0x42')][_0x9324('0x48')]);_0x54a55c[_0x9324('0x2a')]=_[_0x9324('0x2b')](_0x26eebc[_0x9324('0x2a')]);_0x54a55c['filters']=_[_0x9324('0x3c')](_0x54a55c[_0x9324('0x29')],_0x54a55c[_0x9324('0x2a')]);_0x3fff2a['attributes']=_[_0x9324('0x3c')](_0x54a55c[_0x9324('0x29')],qs[_0x9324('0x2e')](_0x26eebc[_0x9324('0x2a')][_0x9324('0x2e')]));_0x3fff2a[_0x9324('0x2d')]=_0x3fff2a[_0x9324('0x2d')][_0x9324('0x2f')]?_0x3fff2a['attributes']:_0x54a55c[_0x9324('0x29')];_0x3fff2a[_0x9324('0x43')]=qs[_0x9324('0x31')](_0x26eebc[_0x9324('0x2a')][_0x9324('0x31')]);_0x3fff2a[_0x9324('0x32')]=qs[_0x9324('0x2c')](_[_0x9324('0x44')](_0x26eebc[_0x9324('0x2a')],_0x54a55c[_0x9324('0x2c')]));if(_0x26eebc[_0x9324('0x2a')][_0x9324('0x33')]){_0x3fff2a[_0x9324('0x32')]=_[_0x9324('0x34')](_0x3fff2a[_0x9324('0x32')],{'$or':_[_0x9324('0x25')](_0x3fff2a['attributes'],function(_0x27aff7){var _0x53ef43={};_0x53ef43[_0x27aff7]={'$like':'%'+_0x26eebc[_0x9324('0x2a')][_0x9324('0x33')]+'%'};return _0x53ef43;})});}_0x3fff2a=_[_0x9324('0x34')]({},_0x3fff2a,_0x26eebc[_0x9324('0x36')]);return _0x5a582a[_0x9324('0x46')](_0x3fff2a);}})[_0x9324('0x1f')](function(_0x434269){if(_0x434269){_0x1dde7a=_0x434269[_0x9324('0x2f')];if(!_0x26eebc[_0x9324('0x2a')][_0x9324('0x30')](_0x9324('0x45'))){_0x3fff2a[_0x9324('0x19')]=qs[_0x9324('0x19')](_0x26eebc['query'][_0x9324('0x19')]);_0x3fff2a[_0x9324('0x1a')]=qs[_0x9324('0x1a')](_0x26eebc['query'][_0x9324('0x1a')]);}return _0x5a582a[_0x9324('0x46')](_0x3fff2a);}})['then'](function(_0x7accab){if(_0x7accab){return _0x7accab?{'count':_0x1dde7a,'rows':_0x7accab}:null;}})[_0x9324('0x1f')](respondWithResult(_0x191203,null))[_0x9324('0x3a')](handleError(_0x191203,null));};exports['getDescriptions']=function(_0x28e3a2,_0x49d540,_0x48c86e){var _0xabc145={};var _0x434790={};var _0x7cb655;var _0x183fbe;return db[_0x9324('0x26')]['findOne']({'where':{'id':_0x28e3a2[_0x9324('0x40')]['id']}})[_0x9324('0x1f')](handleEntityNotFound(_0x49d540,null))['then'](function(_0x1efa2d){if(_0x1efa2d){_0x7cb655=_0x1efa2d;_0x434790['model']=_[_0x9324('0x2b')](db[_0x9324('0x42')][_0x9324('0x48')]);_0x434790['query']=_[_0x9324('0x2b')](_0x28e3a2[_0x9324('0x2a')]);_0x434790[_0x9324('0x2c')]=_[_0x9324('0x3c')](_0x434790[_0x9324('0x29')],_0x434790[_0x9324('0x2a')]);_0xabc145[_0x9324('0x2d')]=_[_0x9324('0x3c')](_0x434790[_0x9324('0x29')],qs[_0x9324('0x2e')](_0x28e3a2[_0x9324('0x2a')][_0x9324('0x2e')]));_0xabc145[_0x9324('0x2d')]=_0xabc145[_0x9324('0x2d')][_0x9324('0x2f')]?_0xabc145[_0x9324('0x2d')]:_0x434790[_0x9324('0x29')];_0xabc145[_0x9324('0x43')]=qs[_0x9324('0x31')](_0x28e3a2[_0x9324('0x2a')]['sort']);_0xabc145['where']=qs[_0x9324('0x2c')](_['pick'](_0x28e3a2[_0x9324('0x2a')],_0x434790[_0x9324('0x2c')]));if(_0x28e3a2[_0x9324('0x2a')][_0x9324('0x33')]){_0xabc145[_0x9324('0x32')]=_[_0x9324('0x34')](_0xabc145[_0x9324('0x32')],{'$or':_[_0x9324('0x25')](_0xabc145[_0x9324('0x2d')],function(_0x2a24bc){var _0x48cf0c={};_0x48cf0c[_0x2a24bc]={'$like':'%'+_0x28e3a2[_0x9324('0x2a')]['filter']+'%'};return _0x48cf0c;})});}_0xabc145=_[_0x9324('0x34')]({},_0xabc145,_0x28e3a2[_0x9324('0x36')]);return _0x7cb655[_0x9324('0x49')](_0xabc145);}})[_0x9324('0x1f')](function(_0x1da936){if(_0x1da936){_0x183fbe=_0x1da936[_0x9324('0x2f')];if(!_0x28e3a2[_0x9324('0x2a')]['hasOwnProperty']('nolimit')){_0xabc145[_0x9324('0x19')]=qs[_0x9324('0x19')](_0x28e3a2['query'][_0x9324('0x19')]);_0xabc145[_0x9324('0x1a')]=qs[_0x9324('0x1a')](_0x28e3a2[_0x9324('0x2a')][_0x9324('0x1a')]);}return _0x7cb655[_0x9324('0x49')](_0xabc145);}})[_0x9324('0x1f')](function(_0x55e318){if(_0x55e318){return _0x55e318?{'count':_0x183fbe,'rows':_0x55e318}:null;}})[_0x9324('0x1f')](respondWithResult(_0x49d540,null))['catch'](handleError(_0x49d540,null));};exports[_0x9324('0x4a')]=function(_0x5c49ac,_0x12bf15,_0x4343c0){var _0x57ca5e={};var _0x50dae4={};var _0x268c07;var _0x3926d2;return db['ZendeskConfiguration'][_0x9324('0x47')]({'where':{'id':_0x5c49ac[_0x9324('0x40')]['id']}})['then'](handleEntityNotFound(_0x12bf15,null))[_0x9324('0x1f')](function(_0x229757){if(_0x229757){_0x268c07=_0x229757;_0x50dae4['model']=_['keys'](db[_0x9324('0x4b')][_0x9324('0x48')]);_0x50dae4[_0x9324('0x2a')]=_[_0x9324('0x2b')](_0x5c49ac['query']);_0x50dae4[_0x9324('0x2c')]=_[_0x9324('0x3c')](_0x50dae4['model'],_0x50dae4[_0x9324('0x2a')]);_0x57ca5e['attributes']=_['intersection'](_0x50dae4[_0x9324('0x29')],qs['fields'](_0x5c49ac[_0x9324('0x2a')]['fields']));_0x57ca5e[_0x9324('0x2d')]=_0x57ca5e['attributes'][_0x9324('0x2f')]?_0x57ca5e['attributes']:_0x50dae4[_0x9324('0x29')];_0x57ca5e[_0x9324('0x43')]=qs[_0x9324('0x31')](_0x5c49ac[_0x9324('0x2a')][_0x9324('0x31')]);_0x57ca5e['where']=qs['filters'](_[_0x9324('0x44')](_0x5c49ac[_0x9324('0x2a')],_0x50dae4['filters']));if(_0x5c49ac[_0x9324('0x2a')][_0x9324('0x33')]){_0x57ca5e[_0x9324('0x32')]=_['merge'](_0x57ca5e[_0x9324('0x32')],{'$or':_[_0x9324('0x25')](_0x57ca5e[_0x9324('0x2d')],function(_0x380709){var _0x3c72c2={};_0x3c72c2[_0x380709]={'$like':'%'+_0x5c49ac[_0x9324('0x2a')][_0x9324('0x33')]+'%'};return _0x3c72c2;})});}_0x57ca5e=_[_0x9324('0x34')]({},_0x57ca5e,_0x5c49ac[_0x9324('0x36')]);return _0x268c07['getTags'](_0x57ca5e);}})[_0x9324('0x1f')](function(_0x3dcec7){if(_0x3dcec7){_0x3926d2=_0x3dcec7['length'];if(!_0x5c49ac[_0x9324('0x2a')][_0x9324('0x30')](_0x9324('0x45'))){_0x57ca5e[_0x9324('0x19')]=qs[_0x9324('0x19')](_0x5c49ac[_0x9324('0x2a')]['limit']);_0x57ca5e[_0x9324('0x1a')]=qs[_0x9324('0x1a')](_0x5c49ac[_0x9324('0x2a')][_0x9324('0x1a')]);}return _0x268c07[_0x9324('0x4a')](_0x57ca5e);}})['then'](function(_0x9e8958){if(_0x9e8958){return _0x9e8958?{'count':_0x3926d2,'rows':_0x9e8958}:null;}})['then'](respondWithResult(_0x12bf15,null))['catch'](handleError(_0x12bf15,null));};exports[_0x9324('0x4c')]=function(_0x319c21,_0x54de5a,_0x1b9b4e){if(_0x319c21[_0x9324('0x3f')]['id']){delete _0x319c21[_0x9324('0x3f')]['id'];}return db[_0x9324('0x26')][_0x9324('0x47')]({'where':{'id':_0x319c21[_0x9324('0x40')]['id']}})[_0x9324('0x1f')](handleEntityNotFound(_0x54de5a,null))[_0x9324('0x1f')](function(_0x5b942b){if(_0x5b942b){return _0x5b942b['setTags'](_0x319c21[_0x9324('0x3f')]['ids']||[]);}return null;})[_0x9324('0x1f')](respondWithResult(_0x54de5a,null))['catch'](handleError(_0x54de5a,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 69e78a5..65a9aec 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 _0xefda=['../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','api','moment','request-promise','path','rimraf'];(function(_0x19249c,_0x2a2804){var _0xfc73ad=function(_0x7c480d){while(--_0x7c480d){_0x19249c['push'](_0x19249c['shift']());}};_0xfc73ad(++_0x2a2804);}(_0xefda,0x96));var _0xaefd=function(_0x2e0e55,_0x1a4e24){_0x2e0e55=_0x2e0e55-0x0;var _0x2c6fad=_0xefda[_0x2e0e55];return _0x2c6fad;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaefd('0x1'));var moment=require(_0xaefd('0x2'));var BPromise=require('bluebird');var rp=require(_0xaefd('0x3'));var fs=require('fs');var path=require(_0xaefd('0x4'));var rimraf=require(_0xaefd('0x5'));var config=require(_0xaefd('0x6'));var attributes=require(_0xaefd('0x7'));module[_0xaefd('0x8')]=function(_0x497258,_0x3677ea){return _0x497258[_0xaefd('0x9')](_0xaefd('0xa'),attributes,{'tableName':_0xaefd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd7d1=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x308896,_0x5e9684){_0x308896=_0x308896-0x0;var _0x14f056=_0xd7d1[_0x308896];return _0x14f056;};'use strict';var _=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var logger=require(_0x1d7d('0x2'))(_0x1d7d('0x3'));var moment=require(_0x1d7d('0x4'));var BPromise=require(_0x1d7d('0x5'));var rp=require(_0x1d7d('0x6'));var fs=require('fs');var path=require(_0x1d7d('0x7'));var rimraf=require(_0x1d7d('0x8'));var config=require(_0x1d7d('0x9'));var attributes=require(_0x1d7d('0xa'));module[_0x1d7d('0xb')]=function(_0x14b2b9,_0x5a8cf3){return _0x14b2b9[_0x1d7d('0xc')](_0x1d7d('0xd'),attributes,{'tableName':_0x1d7d('0xe'),'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 63f3bb0..12a3530 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 _0x5786=['code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x452968,_0x31e391){var _0xb6f9ae=function(_0x263987){while(--_0x263987){_0x452968['push'](_0x452968['shift']());}};_0xb6f9ae(++_0x31e391);}(_0x5786,0xea));var _0x6578=function(_0x87b887,_0x486517){_0x87b887=_0x87b887-0x0;var _0x4dad53=_0x5786[_0x87b887];return _0x4dad53;};'use strict';var _=require(_0x6578('0x0'));var util=require(_0x6578('0x1'));var moment=require('moment');var BPromise=require(_0x6578('0x2'));var rs=require(_0x6578('0x3'));var fs=require('fs');var Redis=require(_0x6578('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6578('0x5'))(_0x6578('0x6'));var config=require(_0x6578('0x7'));var jayson=require(_0x6578('0x8'));var client=jayson[_0x6578('0x9')][_0x6578('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a4a33,_0x282b3f,_0x3edda3){return new BPromise(function(_0x16b5be,_0x5cf7e3){return client[_0x6578('0xb')](_0x1a4a33,_0x3edda3)['then'](function(_0x28b794){logger[_0x6578('0xc')](_0x6578('0xd'),_0x282b3f,_0x6578('0xe'));logger['debug'](_0x6578('0xf'),_0x282b3f,_0x6578('0xe'),JSON[_0x6578('0x10')](_0x28b794));if(_0x28b794['error']){if(_0x28b794[_0x6578('0x11')][_0x6578('0x12')]===0x1f4){logger['error'](_0x6578('0xd'),_0x282b3f,_0x28b794[_0x6578('0x11')]['message']);return _0x5cf7e3(_0x28b794[_0x6578('0x11')][_0x6578('0x13')]);}logger[_0x6578('0x11')](_0x6578('0xd'),_0x282b3f,_0x28b794[_0x6578('0x11')][_0x6578('0x13')]);return _0x16b5be(_0x28b794['error'][_0x6578('0x13')]);}else{logger[_0x6578('0xc')](_0x6578('0xd'),_0x282b3f,_0x6578('0xe'));_0x16b5be(_0x28b794['result'][_0x6578('0x13')]);}})[_0x6578('0x14')](function(_0x178cf1){logger[_0x6578('0x11')](_0x6578('0xd'),_0x282b3f,_0x178cf1);_0x5cf7e3(_0x178cf1);});});} \ No newline at end of file +var _0xaf47=['ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug'];(function(_0xa1dd3,_0x934684){var _0x2ef922=function(_0x7a9614){while(--_0x7a9614){_0xa1dd3['push'](_0xa1dd3['shift']());}};_0x2ef922(++_0x934684);}(_0xaf47,0xaa));var _0x7af4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaf47[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7af4('0x0'));var util=require('util');var moment=require(_0x7af4('0x1'));var BPromise=require(_0x7af4('0x2'));var rs=require(_0x7af4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7af4('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7af4('0x5'));var config=require(_0x7af4('0x6'));var jayson=require(_0x7af4('0x7'));var client=jayson[_0x7af4('0x8')][_0x7af4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x515768,_0x487758,_0x756c84){return new BPromise(function(_0x57fb35,_0x27d98f){return client[_0x7af4('0xa')](_0x515768,_0x756c84)[_0x7af4('0xb')](function(_0x40f6e1){logger[_0x7af4('0xc')]('ZendeskConfiguration,\x20%s,\x20%s',_0x487758,'request\x20sent');logger[_0x7af4('0xd')](_0x7af4('0xe'),_0x487758,_0x7af4('0xf'),JSON[_0x7af4('0x10')](_0x40f6e1));if(_0x40f6e1[_0x7af4('0x11')]){if(_0x40f6e1[_0x7af4('0x11')][_0x7af4('0x12')]===0x1f4){logger['error'](_0x7af4('0x13'),_0x487758,_0x40f6e1['error']['message']);return _0x27d98f(_0x40f6e1[_0x7af4('0x11')][_0x7af4('0x14')]);}logger[_0x7af4('0x11')](_0x7af4('0x13'),_0x487758,_0x40f6e1['error'][_0x7af4('0x14')]);return _0x57fb35(_0x40f6e1[_0x7af4('0x11')]['message']);}else{logger[_0x7af4('0xc')](_0x7af4('0x13'),_0x487758,'request\x20sent');_0x57fb35(_0x40f6e1[_0x7af4('0x15')]['message']);}})[_0x7af4('0x16')](function(_0x3fd8bf){logger[_0x7af4('0x11')](_0x7af4('0x13'),_0x487758,_0x3fd8bf);_0x27d98f(_0x3fd8bf);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 29b800c..2e0eb5c 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 _0x854c=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','path'];(function(_0x25b24a,_0x1c0163){var _0x224e68=function(_0x1fc9d2){while(--_0x1fc9d2){_0x25b24a['push'](_0x25b24a['shift']());}};_0x224e68(++_0x1c0163);}(_0x854c,0xa9));var _0xc854=function(_0x35211e,_0x10f8ce){_0x35211e=_0x35211e-0x0;var _0x325aa1=_0x854c[_0x35211e];return _0x325aa1;};'use strict';var multer=require(_0xc854('0x0'));var util=require('util');var path=require(_0xc854('0x1'));var timeout=require(_0xc854('0x2'));var express=require(_0xc854('0x3'));var router=express[_0xc854('0x4')]();var fs_extra=require(_0xc854('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc854('0x6'));var config=require(_0xc854('0x7'));var controller=require('./intZendeskField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc854('0x8')]);router[_0xc854('0x9')](_0xc854('0xa'),auth[_0xc854('0xb')](),controller[_0xc854('0xc')]);router[_0xc854('0xd')]('/',auth[_0xc854('0xb')](),controller[_0xc854('0xe')]);router[_0xc854('0xf')]('/:id',auth[_0xc854('0xb')](),controller[_0xc854('0x10')]);router['delete'](_0xc854('0xa'),auth[_0xc854('0xb')](),controller[_0xc854('0x11')]);module[_0xc854('0x12')]=router; \ No newline at end of file +var _0x7d1e=['index','/:id','post','put','update','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x4e1fcf,_0x31e47e){var _0x45f6be=function(_0x3cde94){while(--_0x3cde94){_0x4e1fcf['push'](_0x4e1fcf['shift']());}};_0x45f6be(++_0x31e47e);}(_0x7d1e,0x15a));var _0xe7d1=function(_0x4bbabf,_0x3e3454){_0x4bbabf=_0x4bbabf-0x0;var _0x159343=_0x7d1e[_0x4bbabf];return _0x159343;};'use strict';var multer=require('multer');var util=require(_0xe7d1('0x0'));var path=require(_0xe7d1('0x1'));var timeout=require(_0xe7d1('0x2'));var express=require(_0xe7d1('0x3'));var router=express[_0xe7d1('0x4')]();var fs_extra=require(_0xe7d1('0x5'));var auth=require(_0xe7d1('0x6'));var interaction=require(_0xe7d1('0x7'));var config=require(_0xe7d1('0x8'));var controller=require('./intZendeskField.controller');router[_0xe7d1('0x9')]('/',auth[_0xe7d1('0xa')](),controller[_0xe7d1('0xb')]);router[_0xe7d1('0x9')](_0xe7d1('0xc'),auth[_0xe7d1('0xa')](),controller['show']);router[_0xe7d1('0xd')]('/',auth[_0xe7d1('0xa')](),controller['create']);router[_0xe7d1('0xe')](_0xe7d1('0xc'),auth[_0xe7d1('0xa')](),controller[_0xe7d1('0xf')]);router[_0xe7d1('0x10')](_0xe7d1('0xc'),auth[_0xe7d1('0xa')](),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 d8a71e1..bb725ce 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 _0xf571=['string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist'];(function(_0x16490f,_0x42f1d5){var _0x1c86e4=function(_0x581261){while(--_0x581261){_0x16490f['push'](_0x16490f['shift']());}};_0x1c86e4(++_0x42f1d5);}(_0xf571,0xe9));var _0x1f57=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf571[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1f57('0x0'));module[_0x1f57('0x1')]={'type':{'type':Sequelize[_0x1f57('0x2')]('string',_0x1f57('0x3'),_0x1f57('0x4'),_0x1f57('0x5'),_0x1f57('0x6')),'defaultValue':_0x1f57('0x7')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1f57('0x8')]},'keyType':{'type':Sequelize[_0x1f57('0x2')](_0x1f57('0x7'),'variable',_0x1f57('0x4'))},'keyContent':{'type':Sequelize[_0x1f57('0x8')]},'idField':{'type':Sequelize[_0x1f57('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1f57('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1f57('0x8')]}}; \ No newline at end of file +var _0x4aa3=['STRING','BOOLEAN','exports','ENUM','string','customVariable','keyValue','picklist'];(function(_0x1147ab,_0x10e72b){var _0x55cb5a=function(_0x364bd6){while(--_0x364bd6){_0x1147ab['push'](_0x1147ab['shift']());}};_0x55cb5a(++_0x10e72b);}(_0x4aa3,0x82));var _0x34aa=function(_0x2e1fab,_0x4347d4){_0x2e1fab=_0x2e1fab-0x0;var _0x2ece21=_0x4aa3[_0x2e1fab];return _0x2ece21;};'use strict';var Sequelize=require('sequelize');module[_0x34aa('0x0')]={'type':{'type':Sequelize[_0x34aa('0x1')](_0x34aa('0x2'),'variable',_0x34aa('0x3'),_0x34aa('0x4'),_0x34aa('0x5')),'defaultValue':_0x34aa('0x2')},'content':{'type':Sequelize[_0x34aa('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x34aa('0x1')](_0x34aa('0x2'),'variable',_0x34aa('0x3'))},'keyContent':{'type':Sequelize[_0x34aa('0x6')]},'idField':{'type':Sequelize[_0x34aa('0x6')]},'nameField':{'type':Sequelize[_0x34aa('0x6')]},'customField':{'type':Sequelize[_0x34aa('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x34aa('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index f62692e..78024da 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 _0x40d4=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','apply','reject','then','destroy','stack','name','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','ZendeskField','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','update','eml-format'];(function(_0x49d13e,_0x43e265){var _0x417ad5=function(_0x58ee19){while(--_0x58ee19){_0x49d13e['push'](_0x49d13e['shift']());}};_0x417ad5(++_0x43e265);}(_0x40d4,0x16c));var _0x440d=function(_0x143187,_0x421857){_0x143187=_0x143187-0x0;var _0x32cf7e=_0x40d4[_0x143187];return _0x32cf7e;};'use strict';var emlformat=require(_0x440d('0x0'));var rimraf=require(_0x440d('0x1'));var zipdir=require(_0x440d('0x2'));var jsonpatch=require(_0x440d('0x3'));var rp=require(_0x440d('0x4'));var moment=require(_0x440d('0x5'));var BPromise=require(_0x440d('0x6'));var Mustache=require(_0x440d('0x7'));var util=require(_0x440d('0x8'));var path=require(_0x440d('0x9'));var sox=require('sox');var csv=require(_0x440d('0xa'));var ejs=require(_0x440d('0xb'));var fs=require('fs');var fs_extra=require(_0x440d('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x440d('0xd'));var toCsv=require(_0x440d('0xa'));var querystring=require(_0x440d('0xe'));var Papa=require(_0x440d('0xf'));var Redis=require(_0x440d('0x10'));var authService=require(_0x440d('0x11'));var qs=require(_0x440d('0x12'));var as=require(_0x440d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x440d('0x14'))(_0x440d('0x15'));var utils=require(_0x440d('0x16'));var config=require(_0x440d('0x17'));var licenseUtil=require(_0x440d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21deba,_0x3b3e7c){_0x3b3e7c=_0x3b3e7c||0xcc;return function(_0x446420){if(_0x446420){return _0x21deba[_0x440d('0x19')](_0x3b3e7c);}return _0x21deba[_0x440d('0x1a')](_0x3b3e7c)[_0x440d('0x1b')]();};}function respondWithResult(_0x41bc41,_0x2f4c1e){_0x2f4c1e=_0x2f4c1e||0xc8;return function(_0x197013){if(_0x197013){return _0x41bc41[_0x440d('0x1a')](_0x2f4c1e)[_0x440d('0x1c')](_0x197013);}};}function respondWithFilteredResult(_0x31dccc,_0x48e9d3){return function(_0xeac57b){if(_0xeac57b){var _0x23628b=typeof _0x48e9d3['offset']===_0x440d('0x1d')&&typeof _0x48e9d3[_0x440d('0x1e')]===_0x440d('0x1d');var _0x720013=_0xeac57b['count'];var _0x5c3bfb=_0x23628b?0x0:_0x48e9d3[_0x440d('0x1f')];var _0x5b4831=_0x23628b?_0xeac57b[_0x440d('0x20')]:_0x48e9d3[_0x440d('0x1f')]+_0x48e9d3[_0x440d('0x1e')];var _0x4b94bb;if(_0x5b4831>=_0x720013){_0x5b4831=_0x720013;_0x4b94bb=0xc8;}else{_0x4b94bb=0xce;}_0x31dccc[_0x440d('0x1a')](_0x4b94bb);return _0x31dccc['set']('Content-Range',_0x5c3bfb+'-'+_0x5b4831+'/'+_0x720013)[_0x440d('0x1c')](_0xeac57b);}return null;};}function patchUpdates(_0x303b2b){return function(_0x2a0e8e){try{jsonpatch[_0x440d('0x21')](_0x2a0e8e,_0x303b2b,!![]);}catch(_0x15f644){return BPromise[_0x440d('0x22')](_0x15f644);}return _0x2a0e8e['save']();};}function saveUpdates(_0x44cef9,_0x535e51){return function(_0x3d3635){if(_0x3d3635){return _0x3d3635['update'](_0x44cef9)[_0x440d('0x23')](function(_0x2af96c){return _0x2af96c;});}return null;};}function removeEntity(_0x475a9e,_0x145152){return function(_0x59f515){if(_0x59f515){return _0x59f515[_0x440d('0x24')]()['then'](function(){_0x475a9e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x558f05,_0x5e4931){return function(_0x57adb0){if(!_0x57adb0){_0x558f05[_0x440d('0x19')](0x194);}return _0x57adb0;};}function handleError(_0x3a3501,_0x2f7ac3){_0x2f7ac3=_0x2f7ac3||0x1f4;return function(_0x418774){logger['error'](_0x418774[_0x440d('0x25')]);if(_0x418774['name']){delete _0x418774[_0x440d('0x26')];}_0x3a3501[_0x440d('0x1a')](_0x2f7ac3)['send'](_0x418774);};}exports[_0x440d('0x27')]=function(_0x4867da,_0x6b0f3){var _0x591704={},_0x5972dd={},_0xaf3d57={'count':0x0,'rows':[]};var _0xb74f3b=_[_0x440d('0x28')](db['ZendeskField']['rawAttributes'],function(_0x270069){return{'name':_0x270069[_0x440d('0x29')],'type':_0x270069['type'][_0x440d('0x2a')]};});_0x5972dd[_0x440d('0x2b')]=_[_0x440d('0x28')](_0xb74f3b,_0x440d('0x26'));_0x5972dd[_0x440d('0x2c')]=_[_0x440d('0x2d')](_0x4867da['query']);_0x5972dd[_0x440d('0x2e')]=_[_0x440d('0x2f')](_0x5972dd[_0x440d('0x2b')],_0x5972dd[_0x440d('0x2c')]);_0x591704[_0x440d('0x30')]=_[_0x440d('0x2f')](_0x5972dd[_0x440d('0x2b')],qs['fields'](_0x4867da[_0x440d('0x2c')][_0x440d('0x31')]));_0x591704[_0x440d('0x30')]=_0x591704[_0x440d('0x30')][_0x440d('0x32')]?_0x591704[_0x440d('0x30')]:_0x5972dd[_0x440d('0x2b')];if(!_0x4867da['query'][_0x440d('0x33')](_0x440d('0x34'))){_0x591704['limit']=qs[_0x440d('0x1e')](_0x4867da[_0x440d('0x2c')][_0x440d('0x1e')]);_0x591704[_0x440d('0x1f')]=qs['offset'](_0x4867da[_0x440d('0x2c')][_0x440d('0x1f')]);}_0x591704[_0x440d('0x35')]=qs[_0x440d('0x36')](_0x4867da[_0x440d('0x2c')][_0x440d('0x36')]);_0x591704[_0x440d('0x37')]=qs['filters'](_['pick'](_0x4867da[_0x440d('0x2c')],_0x5972dd[_0x440d('0x2e')]),_0xb74f3b);if(_0x4867da[_0x440d('0x2c')][_0x440d('0x38')]){_0x591704[_0x440d('0x37')]=_[_0x440d('0x39')](_0x591704['where'],{'$or':_[_0x440d('0x28')](_0xb74f3b,function(_0x1ba991){if(_0x1ba991[_0x440d('0x3a')]!==_0x440d('0x3b')){var _0x3f1193={};_0x3f1193[_0x1ba991[_0x440d('0x26')]]={'$like':'%'+_0x4867da[_0x440d('0x2c')]['filter']+'%'};return _0x3f1193;}})});}_0x591704=_[_0x440d('0x39')]({},_0x591704,_0x4867da[_0x440d('0x3c')]);var _0x3b7b29={'where':_0x591704['where']};return db[_0x440d('0x3d')][_0x440d('0x20')](_0x3b7b29)[_0x440d('0x23')](function(_0x346cea){_0xaf3d57[_0x440d('0x20')]=_0x346cea;if(_0x4867da[_0x440d('0x2c')][_0x440d('0x3e')]){_0x591704[_0x440d('0x3f')]=[{'all':!![]}];}return db[_0x440d('0x3d')]['findAll'](_0x591704);})['then'](function(_0x4b503b){_0xaf3d57[_0x440d('0x40')]=_0x4b503b;return _0xaf3d57;})[_0x440d('0x23')](respondWithFilteredResult(_0x6b0f3,_0x591704))[_0x440d('0x41')](handleError(_0x6b0f3,null));};exports[_0x440d('0x42')]=function(_0xad626b,_0x49383d){var _0xefda4d={'raw':!![],'where':{'id':_0xad626b[_0x440d('0x43')]['id']}},_0x14ddf1={};_0x14ddf1[_0x440d('0x2b')]=_[_0x440d('0x2d')](db['ZendeskField'][_0x440d('0x44')]);_0x14ddf1[_0x440d('0x2c')]=_[_0x440d('0x2d')](_0xad626b[_0x440d('0x2c')]);_0x14ddf1[_0x440d('0x2e')]=_[_0x440d('0x2f')](_0x14ddf1[_0x440d('0x2b')],_0x14ddf1[_0x440d('0x2c')]);_0xefda4d['attributes']=_[_0x440d('0x2f')](_0x14ddf1[_0x440d('0x2b')],qs[_0x440d('0x31')](_0xad626b['query']['fields']));_0xefda4d[_0x440d('0x30')]=_0xefda4d[_0x440d('0x30')][_0x440d('0x32')]?_0xefda4d[_0x440d('0x30')]:_0x14ddf1[_0x440d('0x2b')];if(_0xad626b['query'][_0x440d('0x3e')]){_0xefda4d[_0x440d('0x3f')]=[{'all':!![]}];}_0xefda4d=_[_0x440d('0x39')]({},_0xefda4d,_0xad626b['options']);return db[_0x440d('0x3d')][_0x440d('0x45')](_0xefda4d)['then'](handleEntityNotFound(_0x49383d,null))[_0x440d('0x23')](respondWithResult(_0x49383d,null))[_0x440d('0x41')](handleError(_0x49383d,null));};exports[_0x440d('0x46')]=function(_0x11906a,_0x5929c2){return db['ZendeskField'][_0x440d('0x46')](_0x11906a[_0x440d('0x47')],{})[_0x440d('0x23')](respondWithResult(_0x5929c2,0xc9))['catch'](handleError(_0x5929c2,null));};exports[_0x440d('0x48')]=function(_0x47ebdb,_0x3f34df){if(_0x47ebdb[_0x440d('0x47')]['id']){delete _0x47ebdb[_0x440d('0x47')]['id'];}return db['ZendeskField'][_0x440d('0x45')]({'where':{'id':_0x47ebdb[_0x440d('0x43')]['id']}})[_0x440d('0x23')](handleEntityNotFound(_0x3f34df,null))[_0x440d('0x23')](saveUpdates(_0x47ebdb['body'],null))[_0x440d('0x23')](respondWithResult(_0x3f34df,null))[_0x440d('0x41')](handleError(_0x3f34df,null));};exports[_0x440d('0x24')]=function(_0x5a9479,_0x35eaaa){return db[_0x440d('0x3d')][_0x440d('0x45')]({'where':{'id':_0x5a9479[_0x440d('0x43')]['id']}})['then'](handleEntityNotFound(_0x35eaaa,null))[_0x440d('0x23')](removeEntity(_0x35eaaa,null))[_0x440d('0x41')](handleError(_0x35eaaa,null));}; \ No newline at end of file +var _0x9f98=['keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','options','ZendeskField','includeAll','include','findAll','catch','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','destroy','then','stack','name','send','index','rawAttributes','type','key','model'];(function(_0x3f8e6f,_0x298450){var _0x1094b6=function(_0x522317){while(--_0x522317){_0x3f8e6f['push'](_0x3f8e6f['shift']());}};_0x1094b6(++_0x298450);}(_0x9f98,0xac));var _0x89f9=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x9f98[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0x89f9('0x0'));var rimraf=require(_0x89f9('0x1'));var zipdir=require(_0x89f9('0x2'));var jsonpatch=require(_0x89f9('0x3'));var rp=require('request-promise');var moment=require(_0x89f9('0x4'));var BPromise=require(_0x89f9('0x5'));var Mustache=require('mustache');var util=require(_0x89f9('0x6'));var path=require(_0x89f9('0x7'));var sox=require('sox');var csv=require(_0x89f9('0x8'));var ejs=require(_0x89f9('0x9'));var fs=require('fs');var fs_extra=require(_0x89f9('0xa'));var _=require(_0x89f9('0xb'));var squel=require(_0x89f9('0xc'));var crypto=require(_0x89f9('0xd'));var jsforce=require(_0x89f9('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x89f9('0xf'));var Papa=require(_0x89f9('0x10'));var Redis=require('ioredis');var authService=require(_0x89f9('0x11'));var qs=require(_0x89f9('0x12'));var as=require(_0x89f9('0x13'));var hardwareService=require(_0x89f9('0x14'));var logger=require(_0x89f9('0x15'))('api');var utils=require(_0x89f9('0x16'));var config=require(_0x89f9('0x17'));var licenseUtil=require(_0x89f9('0x18'));var db=require(_0x89f9('0x19'))['db'];function respondWithStatusCode(_0x1c1edb,_0x20b0da){_0x20b0da=_0x20b0da||0xcc;return function(_0x2e861b){if(_0x2e861b){return _0x1c1edb[_0x89f9('0x1a')](_0x20b0da);}return _0x1c1edb[_0x89f9('0x1b')](_0x20b0da)[_0x89f9('0x1c')]();};}function respondWithResult(_0x119a2d,_0x571cae){_0x571cae=_0x571cae||0xc8;return function(_0x23c957){if(_0x23c957){return _0x119a2d[_0x89f9('0x1b')](_0x571cae)[_0x89f9('0x1d')](_0x23c957);}};}function respondWithFilteredResult(_0x1f729a,_0x3a0fab){return function(_0x175621){if(_0x175621){var _0xa8ed99=typeof _0x3a0fab[_0x89f9('0x1e')]===_0x89f9('0x1f')&&typeof _0x3a0fab[_0x89f9('0x20')]===_0x89f9('0x1f');var _0x20c073=_0x175621[_0x89f9('0x21')];var _0x5e5c89=_0xa8ed99?0x0:_0x3a0fab[_0x89f9('0x1e')];var _0x5a31ee=_0xa8ed99?_0x175621[_0x89f9('0x21')]:_0x3a0fab[_0x89f9('0x1e')]+_0x3a0fab[_0x89f9('0x20')];var _0x589270;if(_0x5a31ee>=_0x20c073){_0x5a31ee=_0x20c073;_0x589270=0xc8;}else{_0x589270=0xce;}_0x1f729a[_0x89f9('0x1b')](_0x589270);return _0x1f729a['set']('Content-Range',_0x5e5c89+'-'+_0x5a31ee+'/'+_0x20c073)[_0x89f9('0x1d')](_0x175621);}return null;};}function patchUpdates(_0x59fa08){return function(_0xb6335b){try{jsonpatch[_0x89f9('0x22')](_0xb6335b,_0x59fa08,!![]);}catch(_0x1bf774){return BPromise[_0x89f9('0x23')](_0x1bf774);}return _0xb6335b[_0x89f9('0x24')]();};}function saveUpdates(_0x2499d6,_0x5c34e9){return function(_0x115e15){if(_0x115e15){return _0x115e15['update'](_0x2499d6)['then'](function(_0x973640){return _0x973640;});}return null;};}function removeEntity(_0x3b7dba,_0x4bfd3c){return function(_0x29075b){if(_0x29075b){return _0x29075b[_0x89f9('0x25')]()[_0x89f9('0x26')](function(){_0x3b7dba[_0x89f9('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x168ee0,_0x26c02e){return function(_0x17668b){if(!_0x17668b){_0x168ee0['sendStatus'](0x194);}return _0x17668b;};}function handleError(_0x538fb5,_0x1b43cc){_0x1b43cc=_0x1b43cc||0x1f4;return function(_0x3346cc){logger['error'](_0x3346cc[_0x89f9('0x27')]);if(_0x3346cc[_0x89f9('0x28')]){delete _0x3346cc[_0x89f9('0x28')];}_0x538fb5['status'](_0x1b43cc)[_0x89f9('0x29')](_0x3346cc);};}exports[_0x89f9('0x2a')]=function(_0x350ecc,_0x27a6e3){var _0x101e8b={},_0x271663={},_0x6d3168={'count':0x0,'rows':[]};var _0x45c2da=_['map'](db['ZendeskField'][_0x89f9('0x2b')],function(_0x507d27){return{'name':_0x507d27['fieldName'],'type':_0x507d27[_0x89f9('0x2c')][_0x89f9('0x2d')]};});_0x271663[_0x89f9('0x2e')]=_['map'](_0x45c2da,_0x89f9('0x28'));_0x271663['query']=_[_0x89f9('0x2f')](_0x350ecc[_0x89f9('0x30')]);_0x271663[_0x89f9('0x31')]=_[_0x89f9('0x32')](_0x271663[_0x89f9('0x2e')],_0x271663[_0x89f9('0x30')]);_0x101e8b['attributes']=_[_0x89f9('0x32')](_0x271663['model'],qs[_0x89f9('0x33')](_0x350ecc[_0x89f9('0x30')][_0x89f9('0x33')]));_0x101e8b[_0x89f9('0x34')]=_0x101e8b['attributes'][_0x89f9('0x35')]?_0x101e8b[_0x89f9('0x34')]:_0x271663[_0x89f9('0x2e')];if(!_0x350ecc[_0x89f9('0x30')][_0x89f9('0x36')](_0x89f9('0x37'))){_0x101e8b[_0x89f9('0x20')]=qs['limit'](_0x350ecc[_0x89f9('0x30')]['limit']);_0x101e8b[_0x89f9('0x1e')]=qs['offset'](_0x350ecc[_0x89f9('0x30')][_0x89f9('0x1e')]);}_0x101e8b[_0x89f9('0x38')]=qs[_0x89f9('0x39')](_0x350ecc[_0x89f9('0x30')][_0x89f9('0x39')]);_0x101e8b['where']=qs[_0x89f9('0x31')](_[_0x89f9('0x3a')](_0x350ecc[_0x89f9('0x30')],_0x271663['filters']),_0x45c2da);if(_0x350ecc[_0x89f9('0x30')][_0x89f9('0x3b')]){_0x101e8b[_0x89f9('0x3c')]=_[_0x89f9('0x3d')](_0x101e8b[_0x89f9('0x3c')],{'$or':_[_0x89f9('0x3e')](_0x45c2da,function(_0x3f0f3b){if(_0x3f0f3b[_0x89f9('0x2c')]!=='VIRTUAL'){var _0x38cf24={};_0x38cf24[_0x3f0f3b[_0x89f9('0x28')]]={'$like':'%'+_0x350ecc[_0x89f9('0x30')][_0x89f9('0x3b')]+'%'};return _0x38cf24;}})});}_0x101e8b=_['merge']({},_0x101e8b,_0x350ecc[_0x89f9('0x3f')]);var _0x2156fa={'where':_0x101e8b['where']};return db[_0x89f9('0x40')]['count'](_0x2156fa)['then'](function(_0xc811de){_0x6d3168[_0x89f9('0x21')]=_0xc811de;if(_0x350ecc[_0x89f9('0x30')][_0x89f9('0x41')]){_0x101e8b[_0x89f9('0x42')]=[{'all':!![]}];}return db[_0x89f9('0x40')][_0x89f9('0x43')](_0x101e8b);})[_0x89f9('0x26')](function(_0x503cda){_0x6d3168['rows']=_0x503cda;return _0x6d3168;})[_0x89f9('0x26')](respondWithFilteredResult(_0x27a6e3,_0x101e8b))[_0x89f9('0x44')](handleError(_0x27a6e3,null));};exports['show']=function(_0x24172c,_0x5e717d){var _0x3b1fa9={'raw':!![],'where':{'id':_0x24172c[_0x89f9('0x45')]['id']}},_0x3bb90d={};_0x3bb90d[_0x89f9('0x2e')]=_[_0x89f9('0x2f')](db[_0x89f9('0x40')]['rawAttributes']);_0x3bb90d[_0x89f9('0x30')]=_[_0x89f9('0x2f')](_0x24172c[_0x89f9('0x30')]);_0x3bb90d['filters']=_['intersection'](_0x3bb90d['model'],_0x3bb90d[_0x89f9('0x30')]);_0x3b1fa9[_0x89f9('0x34')]=_[_0x89f9('0x32')](_0x3bb90d[_0x89f9('0x2e')],qs['fields'](_0x24172c['query'][_0x89f9('0x33')]));_0x3b1fa9[_0x89f9('0x34')]=_0x3b1fa9[_0x89f9('0x34')]['length']?_0x3b1fa9[_0x89f9('0x34')]:_0x3bb90d[_0x89f9('0x2e')];if(_0x24172c[_0x89f9('0x30')][_0x89f9('0x41')]){_0x3b1fa9[_0x89f9('0x42')]=[{'all':!![]}];}_0x3b1fa9=_['merge']({},_0x3b1fa9,_0x24172c[_0x89f9('0x3f')]);return db[_0x89f9('0x40')][_0x89f9('0x46')](_0x3b1fa9)['then'](handleEntityNotFound(_0x5e717d,null))[_0x89f9('0x26')](respondWithResult(_0x5e717d,null))['catch'](handleError(_0x5e717d,null));};exports[_0x89f9('0x47')]=function(_0x1f1a74,_0x4098c2){return db['ZendeskField'][_0x89f9('0x47')](_0x1f1a74['body'],{})[_0x89f9('0x26')](respondWithResult(_0x4098c2,0xc9))[_0x89f9('0x44')](handleError(_0x4098c2,null));};exports['update']=function(_0x3dd009,_0x1ea191){if(_0x3dd009['body']['id']){delete _0x3dd009[_0x89f9('0x48')]['id'];}return db['ZendeskField'][_0x89f9('0x46')]({'where':{'id':_0x3dd009[_0x89f9('0x45')]['id']}})['then'](handleEntityNotFound(_0x1ea191,null))[_0x89f9('0x26')](saveUpdates(_0x3dd009[_0x89f9('0x48')],null))[_0x89f9('0x26')](respondWithResult(_0x1ea191,null))[_0x89f9('0x44')](handleError(_0x1ea191,null));};exports[_0x89f9('0x25')]=function(_0x27f535,_0x2f551a){return db[_0x89f9('0x40')][_0x89f9('0x46')]({'where':{'id':_0x27f535[_0x89f9('0x45')]['id']}})['then'](handleEntityNotFound(_0x2f551a,null))['then'](removeEntity(_0x2f551a,null))['catch'](handleError(_0x2f551a,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 7f82dc3..585d9ea 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 _0x4872=['idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZendeskField.attributes','exports','int_zendesk_fields'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4872,0x72));var _0x2487=function(_0x308c81,_0x3b1c85){_0x308c81=_0x308c81-0x0;var _0x5cc912=_0x4872[_0x308c81];return _0x5cc912;};'use strict';var _=require(_0x2487('0x0'));var util=require(_0x2487('0x1'));var logger=require(_0x2487('0x2'))(_0x2487('0x3'));var moment=require(_0x2487('0x4'));var BPromise=require(_0x2487('0x5'));var rp=require(_0x2487('0x6'));var fs=require('fs');var path=require(_0x2487('0x7'));var rimraf=require('rimraf');var config=require(_0x2487('0x8'));var attributes=require(_0x2487('0x9'));module[_0x2487('0xa')]=function(_0xdf1738,_0x5a3393){return _0xdf1738['define']('ZendeskField',attributes,{'tableName':_0x2487('0xb'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x2487('0xc'),_0x2487('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x056f=['moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskField.attributes','exports','ZendeskField','idField','FieldId','util','../../config/logger','api'];(function(_0x488a75,_0x1e66ab){var _0x5b5794=function(_0x1c5e8f){while(--_0x1c5e8f){_0x488a75['push'](_0x488a75['shift']());}};_0x5b5794(++_0x1e66ab);}(_0x056f,0x1aa));var _0xf056=function(_0x477085,_0x5c8bbf){_0x477085=_0x477085-0x0;var _0x5e2c7e=_0x056f[_0x477085];return _0x5e2c7e;};'use strict';var _=require('lodash');var util=require(_0xf056('0x0'));var logger=require(_0xf056('0x1'))(_0xf056('0x2'));var moment=require(_0xf056('0x3'));var BPromise=require(_0xf056('0x4'));var rp=require(_0xf056('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf056('0x6'));var config=require(_0xf056('0x7'));var attributes=require(_0xf056('0x8'));module[_0xf056('0x9')]=function(_0x3ae2b0,_0x28ebeb){return _0x3ae2b0['define'](_0xf056('0xa'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xf056('0xb'),_0xf056('0xc')],'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 0f63959..c0b0d15 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 _0x0d7b=['bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment'];(function(_0x67e749,_0x365d09){var _0x3ec9de=function(_0x121672){while(--_0x121672){_0x67e749['push'](_0x67e749['shift']());}};_0x3ec9de(++_0x365d09);}(_0x0d7b,0x174));var _0xb0d7=function(_0x3ecc22,_0x41ee7d){_0x3ecc22=_0x3ecc22-0x0;var _0x462231=_0x0d7b[_0x3ecc22];return _0x462231;};'use strict';var _=require('lodash');var util=require(_0xb0d7('0x0'));var moment=require(_0xb0d7('0x1'));var BPromise=require(_0xb0d7('0x2'));var rs=require(_0xb0d7('0x3'));var fs=require('fs');var Redis=require(_0xb0d7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb0d7('0x5'))(_0xb0d7('0x6'));var config=require(_0xb0d7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb0d7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x262ab0,_0x46cbb2,_0x511f4e){return new BPromise(function(_0x3967ce,_0x5a37cb){return client[_0xb0d7('0x9')](_0x262ab0,_0x511f4e)[_0xb0d7('0xa')](function(_0xf77f7b){logger[_0xb0d7('0xb')](_0xb0d7('0xc'),_0x46cbb2,_0xb0d7('0xd'));logger[_0xb0d7('0xe')](_0xb0d7('0xf'),_0x46cbb2,_0xb0d7('0xd'),JSON[_0xb0d7('0x10')](_0xf77f7b));if(_0xf77f7b[_0xb0d7('0x11')]){if(_0xf77f7b['error'][_0xb0d7('0x12')]===0x1f4){logger[_0xb0d7('0x11')](_0xb0d7('0xc'),_0x46cbb2,_0xf77f7b['error'][_0xb0d7('0x13')]);return _0x5a37cb(_0xf77f7b['error'][_0xb0d7('0x13')]);}logger[_0xb0d7('0x11')](_0xb0d7('0xc'),_0x46cbb2,_0xf77f7b['error'][_0xb0d7('0x13')]);return _0x3967ce(_0xf77f7b[_0xb0d7('0x11')]['message']);}else{logger[_0xb0d7('0xb')](_0xb0d7('0xc'),_0x46cbb2,_0xb0d7('0xd'));_0x3967ce(_0xf77f7b[_0xb0d7('0x14')][_0xb0d7('0x13')]);}})[_0xb0d7('0x15')](function(_0x13c982){logger[_0xb0d7('0x11')](_0xb0d7('0xc'),_0x46cbb2,_0x13c982);_0x5a37cb(_0x13c982);});});} \ No newline at end of file +var _0x26a5=['debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZendeskField,\x20%s,\x20%s'];(function(_0x754fd2,_0x27ac7d){var _0x1d7dbc=function(_0x122da9){while(--_0x122da9){_0x754fd2['push'](_0x754fd2['shift']());}};_0x1d7dbc(++_0x27ac7d);}(_0x26a5,0xbf));var _0x526a=function(_0x32b634,_0x4a83a7){_0x32b634=_0x32b634-0x0;var _0x245a0e=_0x26a5[_0x32b634];return _0x245a0e;};'use strict';var _=require(_0x526a('0x0'));var util=require(_0x526a('0x1'));var moment=require(_0x526a('0x2'));var BPromise=require(_0x526a('0x3'));var rs=require(_0x526a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x526a('0x5'))['db'];var utils=require(_0x526a('0x6'));var logger=require(_0x526a('0x7'))(_0x526a('0x8'));var config=require(_0x526a('0x9'));var jayson=require(_0x526a('0xa'));var client=jayson[_0x526a('0xb')][_0x526a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x39e643,_0x588d1a,_0x3ff689){return new BPromise(function(_0x208078,_0x45ba7c){return client['request'](_0x39e643,_0x3ff689)[_0x526a('0xd')](function(_0x14826d){logger[_0x526a('0xe')](_0x526a('0xf'),_0x588d1a,'request\x20sent');logger[_0x526a('0x10')](_0x526a('0x11'),_0x588d1a,'request\x20sent',JSON[_0x526a('0x12')](_0x14826d));if(_0x14826d[_0x526a('0x13')]){if(_0x14826d[_0x526a('0x13')][_0x526a('0x14')]===0x1f4){logger[_0x526a('0x13')](_0x526a('0xf'),_0x588d1a,_0x14826d[_0x526a('0x13')][_0x526a('0x15')]);return _0x45ba7c(_0x14826d[_0x526a('0x13')]['message']);}logger['error'](_0x526a('0xf'),_0x588d1a,_0x14826d[_0x526a('0x13')][_0x526a('0x15')]);return _0x208078(_0x14826d[_0x526a('0x13')][_0x526a('0x15')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x588d1a,'request\x20sent');_0x208078(_0x14826d['result'][_0x526a('0x15')]);}})[_0x526a('0x16')](function(_0x498eff){logger[_0x526a('0x13')]('ZendeskField,\x20%s,\x20%s',_0x588d1a,_0x498eff);_0x45ba7c(_0x498eff);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 174af23..27128fd 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 _0xb86e=['get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb86e,0x196));var _0xeb86=function(_0x381cc4,_0x1694f2){_0x381cc4=_0x381cc4-0x0;var _0x1fdac0=_0xb86e[_0x381cc4];return _0x1fdac0;};'use strict';var multer=require(_0xeb86('0x0'));var util=require(_0xeb86('0x1'));var path=require(_0xeb86('0x2'));var timeout=require(_0xeb86('0x3'));var express=require(_0xeb86('0x4'));var router=express[_0xeb86('0x5')]();var fs_extra=require(_0xeb86('0x6'));var auth=require(_0xeb86('0x7'));var interaction=require(_0xeb86('0x8'));var config=require(_0xeb86('0x9'));var controller=require('./intZohoAccount.controller');router[_0xeb86('0xa')]('/',auth[_0xeb86('0xb')](),controller[_0xeb86('0xc')]);router[_0xeb86('0xa')]('/:id',auth[_0xeb86('0xb')](),controller[_0xeb86('0xd')]);router[_0xeb86('0xa')](_0xeb86('0xe'),auth[_0xeb86('0xb')](),controller[_0xeb86('0xf')]);router[_0xeb86('0xa')](_0xeb86('0x10'),auth[_0xeb86('0xb')](),controller[_0xeb86('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xeb86('0x12')]);router[_0xeb86('0x13')]('/:id/configurations',auth[_0xeb86('0xb')](),controller[_0xeb86('0x14')]);router[_0xeb86('0x15')]('/:id',auth[_0xeb86('0xb')](),controller[_0xeb86('0x16')]);router[_0xeb86('0x17')](_0xeb86('0x18'),auth['isAuthenticated'](),controller[_0xeb86('0x19')]);module['exports']=router; \ No newline at end of file +var _0x3820=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','update','delete','destroy','multer'];(function(_0x9f547c,_0x3455f8){var _0x488ac9=function(_0x1a7b63){while(--_0x1a7b63){_0x9f547c['push'](_0x9f547c['shift']());}};_0x488ac9(++_0x3455f8);}(_0x3820,0x92));var _0x0382=function(_0x30b0d8,_0x57470c){_0x30b0d8=_0x30b0d8-0x0;var _0x459c09=_0x3820[_0x30b0d8];return _0x459c09;};'use strict';var multer=require(_0x0382('0x0'));var util=require('util');var path=require(_0x0382('0x1'));var timeout=require(_0x0382('0x2'));var express=require('express');var router=express[_0x0382('0x3')]();var fs_extra=require(_0x0382('0x4'));var auth=require(_0x0382('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0382('0x6'));var controller=require('./intZohoAccount.controller');router[_0x0382('0x7')]('/',auth['isAuthenticated'](),controller[_0x0382('0x8')]);router['get'](_0x0382('0x9'),auth[_0x0382('0xa')](),controller[_0x0382('0xb')]);router[_0x0382('0x7')](_0x0382('0xc'),auth[_0x0382('0xa')](),controller[_0x0382('0xd')]);router[_0x0382('0x7')](_0x0382('0xe'),auth['isAuthenticated'](),controller[_0x0382('0xf')]);router[_0x0382('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0382('0x10')](_0x0382('0xc'),auth[_0x0382('0xa')](),controller[_0x0382('0x11')]);router['put'](_0x0382('0x9'),auth['isAuthenticated'](),controller[_0x0382('0x12')]);router[_0x0382('0x13')]('/:id',auth[_0x0382('0xa')](),controller[_0x0382('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 0a0297f..07574ce 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 _0x84ab=['sequelize','exports','STRING'];(function(_0x5ef72f,_0x492db8){var _0x13b41b=function(_0x211fa5){while(--_0x211fa5){_0x5ef72f['push'](_0x5ef72f['shift']());}};_0x13b41b(++_0x492db8);}(_0x84ab,0x12f));var _0xb84a=function(_0x37a79c,_0x2b19f0){_0x37a79c=_0x37a79c-0x0;var _0x561d89=_0x84ab[_0x37a79c];return _0x561d89;};'use strict';var Sequelize=require(_0xb84a('0x0'));module[_0xb84a('0x1')]={'name':{'type':Sequelize[_0xb84a('0x2')]},'description':{'type':Sequelize[_0xb84a('0x2')]},'host':{'type':Sequelize[_0xb84a('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xb84a('0x2')]},'clientSecret':{'type':Sequelize[_0xb84a('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0xb84a('0x2')]},'refreshToken':{'type':Sequelize[_0xb84a('0x2')]}}; \ No newline at end of file +var _0xe5b3=['STRING','exports'];(function(_0x41e67a,_0x555fd2){var _0x33f606=function(_0x3d2c80){while(--_0x3d2c80){_0x41e67a['push'](_0x41e67a['shift']());}};_0x33f606(++_0x555fd2);}(_0xe5b3,0x133));var _0x3e5b=function(_0x51784a,_0x3663d7){_0x51784a=_0x51784a-0x0;var _0x42b922=_0xe5b3[_0x51784a];return _0x42b922;};'use strict';var Sequelize=require('sequelize');module[_0x3e5b('0x0')]={'name':{'type':Sequelize[_0x3e5b('0x1')]},'description':{'type':Sequelize[_0x3e5b('0x1')]},'host':{'type':Sequelize[_0x3e5b('0x1')]},'zone':{'type':Sequelize[_0x3e5b('0x1')]},'clientId':{'type':Sequelize[_0x3e5b('0x1')]},'clientSecret':{'type':Sequelize[_0x3e5b('0x1')]},'serverUrl':{'type':Sequelize[_0x3e5b('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x3e5b('0x1')]},'refreshToken':{'type':Sequelize[_0x3e5b('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index a26cf09..cecf8a4 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 _0xec1f=['/oauth/v2/token','refreshToken','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','zone','serverUrl','code','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','message','Subject','WhoId','Call_Result','Call_Type','api_name','display_label','custom_field','data_type','pick_list_values','test','statusCode','getFields','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','error','name','send','index','map','ZohoAccount','rawAttributes','type','key','keys','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','then','includeAll','include','findAll','show','catch','create','body','update','find','params','destroy','getConfigurations','findOne','ZohoConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn'];(function(_0x30b647,_0x3e45a7){var _0x1d55dd=function(_0x1c45db){while(--_0x1c45db){_0x30b647['push'](_0x30b647['shift']());}};_0x1d55dd(++_0x3e45a7);}(_0xec1f,0x19c));var _0xfec1=function(_0x361026,_0x2654b6){_0x361026=_0x361026-0x0;var _0x597f17=_0xec1f[_0x361026];return _0x597f17;};'use strict';var emlformat=require(_0xfec1('0x0'));var rimraf=require(_0xfec1('0x1'));var zipdir=require(_0xfec1('0x2'));var jsonpatch=require(_0xfec1('0x3'));var rp=require(_0xfec1('0x4'));var moment=require(_0xfec1('0x5'));var BPromise=require(_0xfec1('0x6'));var Mustache=require(_0xfec1('0x7'));var util=require(_0xfec1('0x8'));var path=require(_0xfec1('0x9'));var sox=require(_0xfec1('0xa'));var csv=require(_0xfec1('0xb'));var ejs=require(_0xfec1('0xc'));var fs=require('fs');var fs_extra=require(_0xfec1('0xd'));var _=require(_0xfec1('0xe'));var squel=require(_0xfec1('0xf'));var crypto=require('crypto');var jsforce=require(_0xfec1('0x10'));var deskjs=require(_0xfec1('0x11'));var toCsv=require(_0xfec1('0xb'));var querystring=require(_0xfec1('0x12'));var Papa=require(_0xfec1('0x13'));var Redis=require(_0xfec1('0x14'));var authService=require(_0xfec1('0x15'));var qs=require(_0xfec1('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfec1('0x17'));var logger=require(_0xfec1('0x18'))(_0xfec1('0x19'));var utils=require(_0xfec1('0x1a'));var config=require(_0xfec1('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xfec1('0x1c'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4408ab,_0x86ec12){_0x86ec12=_0x86ec12||0xcc;return function(_0x44dee3){if(_0x44dee3){return _0x4408ab['sendStatus'](_0x86ec12);}return _0x4408ab[_0xfec1('0x1d')](_0x86ec12)[_0xfec1('0x1e')]();};}function respondWithResult(_0x5c3023,_0x36ff95){_0x36ff95=_0x36ff95||0xc8;return function(_0x3ee96c){if(_0x3ee96c){return _0x5c3023[_0xfec1('0x1d')](_0x36ff95)[_0xfec1('0x1f')](_0x3ee96c);}};}function respondWithFilteredResult(_0x1084da,_0x114d62){return function(_0x237c8d){if(_0x237c8d){var _0x353e0b=typeof _0x114d62['offset']===_0xfec1('0x20')&&typeof _0x114d62[_0xfec1('0x21')]===_0xfec1('0x20');var _0x4420e8=_0x237c8d[_0xfec1('0x22')];var _0x1fe224=_0x353e0b?0x0:_0x114d62['offset'];var _0x49be38=_0x353e0b?_0x237c8d[_0xfec1('0x22')]:_0x114d62[_0xfec1('0x23')]+_0x114d62[_0xfec1('0x21')];var _0x30cf31;if(_0x49be38>=_0x4420e8){_0x49be38=_0x4420e8;_0x30cf31=0xc8;}else{_0x30cf31=0xce;}_0x1084da[_0xfec1('0x1d')](_0x30cf31);return _0x1084da[_0xfec1('0x24')](_0xfec1('0x25'),_0x1fe224+'-'+_0x49be38+'/'+_0x4420e8)[_0xfec1('0x1f')](_0x237c8d);}return null;};}function patchUpdates(_0x3c8ed2){return function(_0xa49aba){try{jsonpatch['apply'](_0xa49aba,_0x3c8ed2,!![]);}catch(_0x165044){return BPromise[_0xfec1('0x26')](_0x165044);}return _0xa49aba[_0xfec1('0x27')]();};}function saveUpdates(_0x1a8f52,_0x2a147a){return function(_0x3c0a5d){if(_0x3c0a5d){return _0x3c0a5d['update'](_0x1a8f52)['then'](function(_0xb9fd9c){return _0xb9fd9c;});}return null;};}function removeEntity(_0xaa52b3,_0x15e699){return function(_0x1891f6){if(_0x1891f6){return _0x1891f6['destroy']()['then'](function(){_0xaa52b3[_0xfec1('0x1d')](0xcc)[_0xfec1('0x1e')]();});}};}function handleEntityNotFound(_0x47894b,_0x4c30ec){return function(_0x9140cc){if(!_0x9140cc){_0x47894b['sendStatus'](0x194);}return _0x9140cc;};}function handleError(_0x3b3885,_0x348a15){_0x348a15=_0x348a15||0x1f4;return function(_0x28e136){logger[_0xfec1('0x28')](_0x28e136['stack']);if(_0x28e136[_0xfec1('0x29')]){delete _0x28e136['name'];}_0x3b3885[_0xfec1('0x1d')](_0x348a15)[_0xfec1('0x2a')](_0x28e136);};}exports[_0xfec1('0x2b')]=function(_0x2ce1d9,_0x2c16ad){var _0x4c9343={},_0x3df56b={},_0x3a030d={'count':0x0,'rows':[]};var _0x1bcf36=_[_0xfec1('0x2c')](db[_0xfec1('0x2d')][_0xfec1('0x2e')],function(_0x530d21){return{'name':_0x530d21['fieldName'],'type':_0x530d21[_0xfec1('0x2f')][_0xfec1('0x30')]};});_0x3df56b['model']=_['map'](_0x1bcf36,_0xfec1('0x29'));_0x3df56b['query']=_[_0xfec1('0x31')](_0x2ce1d9[_0xfec1('0x32')]);_0x3df56b[_0xfec1('0x33')]=_[_0xfec1('0x34')](_0x3df56b[_0xfec1('0x35')],_0x3df56b[_0xfec1('0x32')]);_0x4c9343['attributes']=_['intersection'](_0x3df56b[_0xfec1('0x35')],qs['fields'](_0x2ce1d9['query'][_0xfec1('0x36')]));_0x4c9343[_0xfec1('0x37')]=_0x4c9343['attributes'][_0xfec1('0x38')]?_0x4c9343[_0xfec1('0x37')]:_0x3df56b[_0xfec1('0x35')];if(!_0x2ce1d9['query']['hasOwnProperty'](_0xfec1('0x39'))){_0x4c9343[_0xfec1('0x21')]=qs[_0xfec1('0x21')](_0x2ce1d9[_0xfec1('0x32')][_0xfec1('0x21')]);_0x4c9343['offset']=qs['offset'](_0x2ce1d9['query'][_0xfec1('0x23')]);}_0x4c9343[_0xfec1('0x3a')]=qs[_0xfec1('0x3b')](_0x2ce1d9['query'][_0xfec1('0x3b')]);_0x4c9343['where']=qs['filters'](_[_0xfec1('0x3c')](_0x2ce1d9[_0xfec1('0x32')],_0x3df56b[_0xfec1('0x33')]),_0x1bcf36);if(_0x2ce1d9[_0xfec1('0x32')]['filter']){_0x4c9343['where']=_[_0xfec1('0x3d')](_0x4c9343[_0xfec1('0x3e')],{'$or':_[_0xfec1('0x2c')](_0x1bcf36,function(_0x1be734){if(_0x1be734['type']!==_0xfec1('0x3f')){var _0xe4905f={};_0xe4905f[_0x1be734[_0xfec1('0x29')]]={'$like':'%'+_0x2ce1d9[_0xfec1('0x32')][_0xfec1('0x40')]+'%'};return _0xe4905f;}})});}_0x4c9343=_['merge']({},_0x4c9343,_0x2ce1d9[_0xfec1('0x41')]);var _0x6f844d={'where':_0x4c9343[_0xfec1('0x3e')]};return db[_0xfec1('0x2d')]['count'](_0x6f844d)[_0xfec1('0x42')](function(_0x565651){_0x3a030d[_0xfec1('0x22')]=_0x565651;if(_0x2ce1d9[_0xfec1('0x32')][_0xfec1('0x43')]){_0x4c9343[_0xfec1('0x44')]=[{'all':!![]}];}return db[_0xfec1('0x2d')][_0xfec1('0x45')](_0x4c9343);})[_0xfec1('0x42')](function(_0x5046dd){_0x3a030d['rows']=_0x5046dd;return _0x3a030d;})[_0xfec1('0x42')](respondWithFilteredResult(_0x2c16ad,_0x4c9343))['catch'](handleError(_0x2c16ad,null));};exports[_0xfec1('0x46')]=function(_0x2c1a2a,_0x185b5b){var _0x5afbcf={'raw':![],'where':{'id':_0x2c1a2a['params']['id']}},_0xf1b528={};_0xf1b528[_0xfec1('0x35')]=_[_0xfec1('0x31')](db[_0xfec1('0x2d')][_0xfec1('0x2e')]);_0xf1b528['query']=_[_0xfec1('0x31')](_0x2c1a2a[_0xfec1('0x32')]);_0xf1b528['filters']=_[_0xfec1('0x34')](_0xf1b528[_0xfec1('0x35')],_0xf1b528[_0xfec1('0x32')]);_0x5afbcf[_0xfec1('0x37')]=_[_0xfec1('0x34')](_0xf1b528[_0xfec1('0x35')],qs[_0xfec1('0x36')](_0x2c1a2a['query'][_0xfec1('0x36')]));_0x5afbcf[_0xfec1('0x37')]=_0x5afbcf['attributes'][_0xfec1('0x38')]?_0x5afbcf[_0xfec1('0x37')]:_0xf1b528[_0xfec1('0x35')];if(_0x2c1a2a[_0xfec1('0x32')][_0xfec1('0x43')]){_0x5afbcf['include']=[{'all':!![]}];}_0x5afbcf=_['merge']({},_0x5afbcf,_0x2c1a2a[_0xfec1('0x41')]);return db[_0xfec1('0x2d')]['find'](_0x5afbcf)[_0xfec1('0x42')](handleEntityNotFound(_0x185b5b,null))[_0xfec1('0x42')](respondWithResult(_0x185b5b,null))[_0xfec1('0x47')](handleError(_0x185b5b,null));};exports['create']=function(_0x2f1c07,_0x899a0e){return db[_0xfec1('0x2d')][_0xfec1('0x48')](_0x2f1c07[_0xfec1('0x49')],{})['then'](respondWithResult(_0x899a0e,0xc9))['catch'](handleError(_0x899a0e,null));};exports[_0xfec1('0x4a')]=function(_0x235ebd,_0x48ed89){if(_0x235ebd[_0xfec1('0x49')]['id']){delete _0x235ebd['body']['id'];}return db[_0xfec1('0x2d')][_0xfec1('0x4b')]({'where':{'id':_0x235ebd[_0xfec1('0x4c')]['id']}})[_0xfec1('0x42')](handleEntityNotFound(_0x48ed89,null))[_0xfec1('0x42')](saveUpdates(_0x235ebd['body'],null))[_0xfec1('0x42')](respondWithResult(_0x48ed89,null))['catch'](handleError(_0x48ed89,null));};exports[_0xfec1('0x4d')]=function(_0x346994,_0x300580){return db[_0xfec1('0x2d')][_0xfec1('0x4b')]({'where':{'id':_0x346994[_0xfec1('0x4c')]['id']}})[_0xfec1('0x42')](handleEntityNotFound(_0x300580,null))[_0xfec1('0x42')](removeEntity(_0x300580,null))[_0xfec1('0x47')](handleError(_0x300580,null));};exports[_0xfec1('0x4e')]=function(_0x4cac81,_0x1ed203,_0x566b64){var _0x4ce553={};var _0x42157d={};var _0x128798;var _0x2116ec;return db[_0xfec1('0x2d')][_0xfec1('0x4f')]({'where':{'id':_0x4cac81[_0xfec1('0x4c')]['id']}})[_0xfec1('0x42')](handleEntityNotFound(_0x1ed203,null))[_0xfec1('0x42')](function(_0x31dc18){if(_0x31dc18){_0x128798=_0x31dc18;_0x42157d[_0xfec1('0x35')]=_[_0xfec1('0x31')](db[_0xfec1('0x50')]['rawAttributes']);_0x42157d[_0xfec1('0x32')]=_[_0xfec1('0x31')](_0x4cac81['query']);_0x42157d[_0xfec1('0x33')]=_[_0xfec1('0x34')](_0x42157d[_0xfec1('0x35')],_0x42157d[_0xfec1('0x32')]);_0x4ce553['attributes']=_[_0xfec1('0x34')](_0x42157d[_0xfec1('0x35')],qs[_0xfec1('0x36')](_0x4cac81['query'][_0xfec1('0x36')]));_0x4ce553[_0xfec1('0x37')]=_0x4ce553['attributes'][_0xfec1('0x38')]?_0x4ce553[_0xfec1('0x37')]:_0x42157d[_0xfec1('0x35')];_0x4ce553[_0xfec1('0x3a')]=qs[_0xfec1('0x3b')](_0x4cac81['query'][_0xfec1('0x3b')]);_0x4ce553[_0xfec1('0x3e')]=qs[_0xfec1('0x33')](_[_0xfec1('0x3c')](_0x4cac81[_0xfec1('0x32')],_0x42157d[_0xfec1('0x33')]));if(_0x4cac81[_0xfec1('0x32')][_0xfec1('0x40')]){_0x4ce553['where']=_[_0xfec1('0x3d')](_0x4ce553[_0xfec1('0x3e')],{'$or':_[_0xfec1('0x2c')](_0x4ce553[_0xfec1('0x37')],function(_0x41a373){var _0x8f6b7b={};_0x8f6b7b[_0x41a373]={'$like':'%'+_0x4cac81['query'][_0xfec1('0x40')]+'%'};return _0x8f6b7b;})});}_0x4ce553=_[_0xfec1('0x3d')]({},_0x4ce553,_0x4cac81[_0xfec1('0x41')]);return _0x128798[_0xfec1('0x4e')](_0x4ce553);}})[_0xfec1('0x42')](function(_0x398a1a){if(_0x398a1a){_0x2116ec=_0x398a1a[_0xfec1('0x38')];if(!_0x4cac81['query']['hasOwnProperty'](_0xfec1('0x39'))){_0x4ce553[_0xfec1('0x21')]=qs[_0xfec1('0x21')](_0x4cac81[_0xfec1('0x32')][_0xfec1('0x21')]);_0x4ce553[_0xfec1('0x23')]=qs[_0xfec1('0x23')](_0x4cac81[_0xfec1('0x32')]['offset']);}return _0x128798['getConfigurations'](_0x4ce553);}})[_0xfec1('0x42')](function(_0x5924e2){if(_0x5924e2){return _0x5924e2?{'count':_0x2116ec,'rows':_0x5924e2}:null;}})['then'](respondWithResult(_0x1ed203,null))['catch'](handleError(_0x1ed203,null));};exports[_0xfec1('0x51')]=function(_0x30c1a7,_0x256600,_0x5d74ae){if(_0x30c1a7[_0xfec1('0x49')]['id']){delete _0x30c1a7[_0xfec1('0x49')]['id'];}return db['ZohoAccount'][_0xfec1('0x4f')]({'where':{'id':_0x30c1a7[_0xfec1('0x4c')]['id']}})[_0xfec1('0x42')](handleEntityNotFound(_0x256600,null))[_0xfec1('0x42')](function(_0x46a9e4){if(_0x46a9e4){_0x30c1a7[_0xfec1('0x49')][_0xfec1('0x52')]=_0x46a9e4['id'];_0x30c1a7['body'][_0xfec1('0x53')]=integrations[_0xfec1('0x54')](_0x30c1a7[_0xfec1('0x49')][_0xfec1('0x55')],_0x30c1a7[_0xfec1('0x49')][_0xfec1('0x2f')]);_0x30c1a7['body'][_0xfec1('0x56')]=integrations[_0xfec1('0x57')](_0x30c1a7[_0xfec1('0x49')][_0xfec1('0x55')],_0x30c1a7['body'][_0xfec1('0x2f')]);return db[_0xfec1('0x50')][_0xfec1('0x48')](_0x30c1a7[_0xfec1('0x49')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db['ZohoField'],'as':_0xfec1('0x56')}]});}return null;})[_0xfec1('0x42')](respondWithResult(_0x256600,null))[_0xfec1('0x47')](handleError(_0x256600,null));};function getAccessToken(_0xd8ebf7){return new Promise(function(_0x3f9192,_0x274a6c){var _0x31794c;switch(_0xd8ebf7['zone']){case'US':_0x31794c='https://accounts.zoho.com';break;case'AU':_0x31794c=_0xfec1('0x58');break;case'EU':_0x31794c=_0xfec1('0x59');break;case'IN':_0x31794c=_0xfec1('0x5a');break;case'CN':_0x31794c=_0xfec1('0x5b');break;default:_0x31794c=_0xfec1('0x59');break;}var _0x1a5412={'method':'POST','uri':_0x31794c+_0xfec1('0x5c'),'qs':{'refresh_token':_0xd8ebf7[_0xfec1('0x5d')],'client_id':_0xd8ebf7[_0xfec1('0x5e')],'client_secret':_0xd8ebf7[_0xfec1('0x5f')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x1a5412)[_0xfec1('0x42')](function(_0xb8d97c){if(_0xb8d97c[_0xfec1('0x60')]){_0x3f9192(_0xb8d97c[_0xfec1('0x60')]);}else{_0x274a6c(_0xfec1('0x61'));}})['catch'](function(_0xaa26bd){_0x274a6c(_0xaa26bd);});});}exports['getFields']=function(_0x29aadd,_0x4156d1,_0xf2b49c){var _0x5f0af2,_0x20945c,_0x5df796,_0x33fc23,_0x3041aa;return db['ZohoAccount']['findOne']({'where':{'id':_0x29aadd[_0xfec1('0x4c')]['id']},'attributes':['id',_0xfec1('0x62'),_0xfec1('0x63'),_0xfec1('0x5e'),_0xfec1('0x5f'),_0xfec1('0x64'),_0xfec1('0x65'),_0xfec1('0x5d')]})[_0xfec1('0x42')](handleEntityNotFound(_0x4156d1,null))[_0xfec1('0x42')](function(_0x1a1e87){_0x3041aa=_0x1a1e87;_0x5f0af2=_0x3041aa[_0xfec1('0x62')];_0x20945c=_0x5f0af2===_0xfec1('0x66')?'eu':_0xfec1('0x67');_0x5df796=_0x3041aa[_0xfec1('0x64')];var _0x5491b9=_0x5df796[_0xfec1('0x68')](-0x1);if(_0x5491b9==='/'||_0x5491b9==='\x5c'||_0x5491b9===':'){_0x5df796=_0x5df796[_0xfec1('0x69')](0x0,_0x5df796[_0xfec1('0x6a')](_0x5491b9));}if(!_0x3041aa[_0xfec1('0x5d')]){throw new Error(_0xfec1('0x6b'));}return getAccessToken(_0x3041aa);})['then'](function(_0x5181b9){if(_0x5181b9){return rp({'method':'GET','uri':util[_0xfec1('0x6c')](_0xfec1('0x6d'),_0x20945c),'qs':{'module':'Calls'},'headers':{'Authorization':_0xfec1('0x6e')+_0x5181b9},'json':!![]});}})[_0xfec1('0x42')](function(_0x48ebc5){if(_0x48ebc5){if(_0x48ebc5[_0xfec1('0x6f')]&&_0x48ebc5['response']['error']){throw new Error(_0x48ebc5[_0xfec1('0x6f')][_0xfec1('0x28')][_0xfec1('0x70')]);}var _0x3c0eaf=[];var _0x119a25=[];var _0x50bbf8=['Owner',_0xfec1('0x71'),'Description',_0xfec1('0x72'),'Call_Duration',_0xfec1('0x73'),'Call_Start_Time',_0xfec1('0x74')];_0x119a25=_['remove'](_0x48ebc5[_0xfec1('0x36')],function(_0x4b5060){return _0x50bbf8['includes'](_0x4b5060[_0xfec1('0x75')]);});for(var _0x326409=0x0;_0x326409<_0x119a25[_0xfec1('0x38')];_0x326409++){if(_0x119a25[_0x326409]['system_mandatory']===![]){_0x3c0eaf['push']({'id':_0x119a25[_0x326409]['id'],'name':_0x119a25[_0x326409][_0xfec1('0x76')],'custom':_0x119a25[_0x326409][_0xfec1('0x77')],'options':_0x119a25[_0x326409][_0xfec1('0x78')]==='picklist'&&_0x119a25[_0x326409][_0xfec1('0x79')][_0xfec1('0x38')]>-0x1?_[_0xfec1('0x2c')](_0x119a25[_0x326409]['pick_list_values'],function(_0x7cbf2b){return{'name':_0x7cbf2b,'value':_0x7cbf2b};}):[]});}}return{'count':_0x3c0eaf[_0xfec1('0x38')],'rows':_0x3c0eaf};}else{return{'count':0x0,'rows':[]};}})[_0xfec1('0x42')](respondWithResult(_0x4156d1,null))[_0xfec1('0x47')](function(_0x58f0eb){var _0x1ad349=_0x29aadd['query'][_0xfec1('0x7a')]?0x1f4:_0x58f0eb[_0xfec1('0x7b')]||0x1f4;logger[_0xfec1('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0xfec1('0x7c'),_0x1ad349,JSON['stringify'](_0x58f0eb));delete _0x58f0eb[_0xfec1('0x29')];if(_0x1ad349===0x191){_0x1ad349=0x190;}_0x4156d1[_0xfec1('0x1d')](_0x1ad349)['send'](_0x29aadd[_0xfec1('0x32')]['test']?{'message':_0xfec1('0x7d'),'statusCode':_0x58f0eb[_0xfec1('0x7b')]}:_0x58f0eb);});}; \ No newline at end of file +var _0x829c=['../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','save','then','status','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','ZohoAccount','includeAll','include','catch','show','params','rawAttributes','find','create','body','destroy','getConfigurations','ZohoConfiguration','findOne','AccountId','Subjects','channel','Descriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','serverUrl','code','host','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','response','error','message','Subject','Description','WhoId','Call_Start_Time','Call_Type','remove','includes','push','display_label','custom_field','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x829c,0x165));var _0xc829=function(_0x1a1ed2,_0x309fd2){_0x1a1ed2=_0x1a1ed2-0x0;var _0x5e11d5=_0x829c[_0x1a1ed2];return _0x5e11d5;};'use strict';var emlformat=require(_0xc829('0x0'));var rimraf=require(_0xc829('0x1'));var zipdir=require(_0xc829('0x2'));var jsonpatch=require(_0xc829('0x3'));var rp=require(_0xc829('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc829('0x5'));var util=require(_0xc829('0x6'));var path=require(_0xc829('0x7'));var sox=require(_0xc829('0x8'));var csv=require(_0xc829('0x9'));var ejs=require(_0xc829('0xa'));var fs=require('fs');var fs_extra=require(_0xc829('0xb'));var _=require(_0xc829('0xc'));var squel=require(_0xc829('0xd'));var crypto=require(_0xc829('0xe'));var jsforce=require(_0xc829('0xf'));var deskjs=require(_0xc829('0x10'));var toCsv=require(_0xc829('0x9'));var querystring=require(_0xc829('0x11'));var Papa=require(_0xc829('0x12'));var Redis=require(_0xc829('0x13'));var authService=require(_0xc829('0x14'));var qs=require(_0xc829('0x15'));var as=require(_0xc829('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc829('0x17'))(_0xc829('0x18'));var utils=require('../../config/utils');var config=require(_0xc829('0x19'));var licenseUtil=require(_0xc829('0x1a'));var db=require(_0xc829('0x1b'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x52fcc,_0x354aef){_0x354aef=_0x354aef||0xcc;return function(_0x389b81){if(_0x389b81){return _0x52fcc[_0xc829('0x1c')](_0x354aef);}return _0x52fcc['status'](_0x354aef)[_0xc829('0x1d')]();};}function respondWithResult(_0x369bc3,_0x3861a2){_0x3861a2=_0x3861a2||0xc8;return function(_0x578427){if(_0x578427){return _0x369bc3['status'](_0x3861a2)[_0xc829('0x1e')](_0x578427);}};}function respondWithFilteredResult(_0x2848dc,_0x450558){return function(_0x1a857d){if(_0x1a857d){var _0x3ce990=typeof _0x450558[_0xc829('0x1f')]===_0xc829('0x20')&&typeof _0x450558[_0xc829('0x21')]===_0xc829('0x20');var _0x2a1e4f=_0x1a857d['count'];var _0x31a230=_0x3ce990?0x0:_0x450558[_0xc829('0x1f')];var _0x30af08=_0x3ce990?_0x1a857d[_0xc829('0x22')]:_0x450558['offset']+_0x450558['limit'];var _0x1e2696;if(_0x30af08>=_0x2a1e4f){_0x30af08=_0x2a1e4f;_0x1e2696=0xc8;}else{_0x1e2696=0xce;}_0x2848dc['status'](_0x1e2696);return _0x2848dc[_0xc829('0x23')](_0xc829('0x24'),_0x31a230+'-'+_0x30af08+'/'+_0x2a1e4f)[_0xc829('0x1e')](_0x1a857d);}return null;};}function patchUpdates(_0x16bac9){return function(_0x4050b7){try{jsonpatch['apply'](_0x4050b7,_0x16bac9,!![]);}catch(_0x3c4323){return BPromise['reject'](_0x3c4323);}return _0x4050b7[_0xc829('0x25')]();};}function saveUpdates(_0x20788e,_0x2a06fb){return function(_0xe70f37){if(_0xe70f37){return _0xe70f37['update'](_0x20788e)['then'](function(_0x9e0d76){return _0x9e0d76;});}return null;};}function removeEntity(_0x734ca2,_0x14b568){return function(_0x2834fb){if(_0x2834fb){return _0x2834fb['destroy']()[_0xc829('0x26')](function(){_0x734ca2[_0xc829('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50532d,_0x387593){return function(_0x1aeb5d){if(!_0x1aeb5d){_0x50532d['sendStatus'](0x194);}return _0x1aeb5d;};}function handleError(_0x235063,_0x153361){_0x153361=_0x153361||0x1f4;return function(_0x746c05){logger['error'](_0x746c05[_0xc829('0x28')]);if(_0x746c05[_0xc829('0x29')]){delete _0x746c05['name'];}_0x235063[_0xc829('0x27')](_0x153361)[_0xc829('0x2a')](_0x746c05);};}exports[_0xc829('0x2b')]=function(_0x4f64e2,_0x9764d7){var _0x342ab3={},_0x37ec36={},_0x304767={'count':0x0,'rows':[]};var _0x57a73d=_[_0xc829('0x2c')](db['ZohoAccount']['rawAttributes'],function(_0x19c683){return{'name':_0x19c683['fieldName'],'type':_0x19c683[_0xc829('0x2d')][_0xc829('0x2e')]};});_0x37ec36[_0xc829('0x2f')]=_['map'](_0x57a73d,_0xc829('0x29'));_0x37ec36[_0xc829('0x30')]=_[_0xc829('0x31')](_0x4f64e2['query']);_0x37ec36[_0xc829('0x32')]=_[_0xc829('0x33')](_0x37ec36[_0xc829('0x2f')],_0x37ec36[_0xc829('0x30')]);_0x342ab3['attributes']=_[_0xc829('0x33')](_0x37ec36[_0xc829('0x2f')],qs['fields'](_0x4f64e2[_0xc829('0x30')][_0xc829('0x34')]));_0x342ab3[_0xc829('0x35')]=_0x342ab3[_0xc829('0x35')][_0xc829('0x36')]?_0x342ab3[_0xc829('0x35')]:_0x37ec36[_0xc829('0x2f')];if(!_0x4f64e2[_0xc829('0x30')][_0xc829('0x37')](_0xc829('0x38'))){_0x342ab3['limit']=qs[_0xc829('0x21')](_0x4f64e2[_0xc829('0x30')][_0xc829('0x21')]);_0x342ab3[_0xc829('0x1f')]=qs[_0xc829('0x1f')](_0x4f64e2[_0xc829('0x30')][_0xc829('0x1f')]);}_0x342ab3[_0xc829('0x39')]=qs['sort'](_0x4f64e2['query'][_0xc829('0x3a')]);_0x342ab3['where']=qs[_0xc829('0x32')](_[_0xc829('0x3b')](_0x4f64e2['query'],_0x37ec36['filters']),_0x57a73d);if(_0x4f64e2[_0xc829('0x30')][_0xc829('0x3c')]){_0x342ab3[_0xc829('0x3d')]=_[_0xc829('0x3e')](_0x342ab3[_0xc829('0x3d')],{'$or':_[_0xc829('0x2c')](_0x57a73d,function(_0x2ea695){if(_0x2ea695[_0xc829('0x2d')]!==_0xc829('0x3f')){var _0x484349={};_0x484349[_0x2ea695[_0xc829('0x29')]]={'$like':'%'+_0x4f64e2['query']['filter']+'%'};return _0x484349;}})});}_0x342ab3=_['merge']({},_0x342ab3,_0x4f64e2[_0xc829('0x40')]);var _0x455ea2={'where':_0x342ab3[_0xc829('0x3d')]};return db[_0xc829('0x41')][_0xc829('0x22')](_0x455ea2)['then'](function(_0x2e97a9){_0x304767[_0xc829('0x22')]=_0x2e97a9;if(_0x4f64e2[_0xc829('0x30')][_0xc829('0x42')]){_0x342ab3[_0xc829('0x43')]=[{'all':!![]}];}return db['ZohoAccount']['findAll'](_0x342ab3);})['then'](function(_0x2273bf){_0x304767['rows']=_0x2273bf;return _0x304767;})['then'](respondWithFilteredResult(_0x9764d7,_0x342ab3))[_0xc829('0x44')](handleError(_0x9764d7,null));};exports[_0xc829('0x45')]=function(_0x3411a9,_0x6c4067){var _0x3e7163={'raw':![],'where':{'id':_0x3411a9[_0xc829('0x46')]['id']}},_0x3c152d={};_0x3c152d[_0xc829('0x2f')]=_['keys'](db['ZohoAccount'][_0xc829('0x47')]);_0x3c152d[_0xc829('0x30')]=_[_0xc829('0x31')](_0x3411a9[_0xc829('0x30')]);_0x3c152d[_0xc829('0x32')]=_['intersection'](_0x3c152d['model'],_0x3c152d['query']);_0x3e7163[_0xc829('0x35')]=_[_0xc829('0x33')](_0x3c152d[_0xc829('0x2f')],qs[_0xc829('0x34')](_0x3411a9[_0xc829('0x30')]['fields']));_0x3e7163[_0xc829('0x35')]=_0x3e7163[_0xc829('0x35')]['length']?_0x3e7163[_0xc829('0x35')]:_0x3c152d['model'];if(_0x3411a9[_0xc829('0x30')][_0xc829('0x42')]){_0x3e7163['include']=[{'all':!![]}];}_0x3e7163=_['merge']({},_0x3e7163,_0x3411a9[_0xc829('0x40')]);return db[_0xc829('0x41')][_0xc829('0x48')](_0x3e7163)[_0xc829('0x26')](handleEntityNotFound(_0x6c4067,null))['then'](respondWithResult(_0x6c4067,null))['catch'](handleError(_0x6c4067,null));};exports[_0xc829('0x49')]=function(_0xf09a45,_0x34c802){return db[_0xc829('0x41')][_0xc829('0x49')](_0xf09a45[_0xc829('0x4a')],{})['then'](respondWithResult(_0x34c802,0xc9))[_0xc829('0x44')](handleError(_0x34c802,null));};exports['update']=function(_0x4d72f1,_0x194197){if(_0x4d72f1[_0xc829('0x4a')]['id']){delete _0x4d72f1[_0xc829('0x4a')]['id'];}return db[_0xc829('0x41')][_0xc829('0x48')]({'where':{'id':_0x4d72f1[_0xc829('0x46')]['id']}})[_0xc829('0x26')](handleEntityNotFound(_0x194197,null))[_0xc829('0x26')](saveUpdates(_0x4d72f1[_0xc829('0x4a')],null))['then'](respondWithResult(_0x194197,null))[_0xc829('0x44')](handleError(_0x194197,null));};exports[_0xc829('0x4b')]=function(_0x179284,_0x2e4ad7){return db[_0xc829('0x41')][_0xc829('0x48')]({'where':{'id':_0x179284[_0xc829('0x46')]['id']}})['then'](handleEntityNotFound(_0x2e4ad7,null))[_0xc829('0x26')](removeEntity(_0x2e4ad7,null))[_0xc829('0x44')](handleError(_0x2e4ad7,null));};exports[_0xc829('0x4c')]=function(_0x508ed1,_0x4e9dd6,_0x26879b){var _0x5cae4e={};var _0x19225b={};var _0x466974;var _0x5e90f2;return db['ZohoAccount']['findOne']({'where':{'id':_0x508ed1['params']['id']}})[_0xc829('0x26')](handleEntityNotFound(_0x4e9dd6,null))[_0xc829('0x26')](function(_0x632b56){if(_0x632b56){_0x466974=_0x632b56;_0x19225b[_0xc829('0x2f')]=_[_0xc829('0x31')](db[_0xc829('0x4d')]['rawAttributes']);_0x19225b[_0xc829('0x30')]=_[_0xc829('0x31')](_0x508ed1[_0xc829('0x30')]);_0x19225b[_0xc829('0x32')]=_[_0xc829('0x33')](_0x19225b[_0xc829('0x2f')],_0x19225b['query']);_0x5cae4e[_0xc829('0x35')]=_['intersection'](_0x19225b[_0xc829('0x2f')],qs[_0xc829('0x34')](_0x508ed1[_0xc829('0x30')]['fields']));_0x5cae4e[_0xc829('0x35')]=_0x5cae4e[_0xc829('0x35')][_0xc829('0x36')]?_0x5cae4e[_0xc829('0x35')]:_0x19225b[_0xc829('0x2f')];_0x5cae4e[_0xc829('0x39')]=qs['sort'](_0x508ed1['query'][_0xc829('0x3a')]);_0x5cae4e['where']=qs['filters'](_[_0xc829('0x3b')](_0x508ed1[_0xc829('0x30')],_0x19225b[_0xc829('0x32')]));if(_0x508ed1[_0xc829('0x30')][_0xc829('0x3c')]){_0x5cae4e[_0xc829('0x3d')]=_[_0xc829('0x3e')](_0x5cae4e['where'],{'$or':_[_0xc829('0x2c')](_0x5cae4e[_0xc829('0x35')],function(_0x128463){var _0x79b2ca={};_0x79b2ca[_0x128463]={'$like':'%'+_0x508ed1[_0xc829('0x30')][_0xc829('0x3c')]+'%'};return _0x79b2ca;})});}_0x5cae4e=_[_0xc829('0x3e')]({},_0x5cae4e,_0x508ed1[_0xc829('0x40')]);return _0x466974[_0xc829('0x4c')](_0x5cae4e);}})[_0xc829('0x26')](function(_0x3dddcd){if(_0x3dddcd){_0x5e90f2=_0x3dddcd[_0xc829('0x36')];if(!_0x508ed1[_0xc829('0x30')][_0xc829('0x37')](_0xc829('0x38'))){_0x5cae4e['limit']=qs[_0xc829('0x21')](_0x508ed1[_0xc829('0x30')]['limit']);_0x5cae4e[_0xc829('0x1f')]=qs['offset'](_0x508ed1[_0xc829('0x30')][_0xc829('0x1f')]);}return _0x466974[_0xc829('0x4c')](_0x5cae4e);}})[_0xc829('0x26')](function(_0x58db79){if(_0x58db79){return _0x58db79?{'count':_0x5e90f2,'rows':_0x58db79}:null;}})[_0xc829('0x26')](respondWithResult(_0x4e9dd6,null))[_0xc829('0x44')](handleError(_0x4e9dd6,null));};exports['addConfiguration']=function(_0x62d9ee,_0xa6e45a,_0x33ca35){if(_0x62d9ee[_0xc829('0x4a')]['id']){delete _0x62d9ee[_0xc829('0x4a')]['id'];}return db[_0xc829('0x41')][_0xc829('0x4e')]({'where':{'id':_0x62d9ee[_0xc829('0x46')]['id']}})[_0xc829('0x26')](handleEntityNotFound(_0xa6e45a,null))[_0xc829('0x26')](function(_0x305861){if(_0x305861){_0x62d9ee[_0xc829('0x4a')][_0xc829('0x4f')]=_0x305861['id'];_0x62d9ee[_0xc829('0x4a')][_0xc829('0x50')]=integrations['getSubjects'](_0x62d9ee[_0xc829('0x4a')][_0xc829('0x51')],_0x62d9ee['body'][_0xc829('0x2d')]);_0x62d9ee['body'][_0xc829('0x52')]=integrations['getDescriptions'](_0x62d9ee[_0xc829('0x4a')][_0xc829('0x51')],_0x62d9ee[_0xc829('0x4a')][_0xc829('0x2d')]);return db['ZohoConfiguration']['create'](_0x62d9ee[_0xc829('0x4a')],{'include':[{'model':db[_0xc829('0x53')],'as':_0xc829('0x50')},{'model':db[_0xc829('0x53')],'as':'Descriptions'}]});}return null;})[_0xc829('0x26')](respondWithResult(_0xa6e45a,null))['catch'](handleError(_0xa6e45a,null));};function getAccessToken(_0x387d94){return new Promise(function(_0x73d67c,_0x50ebaa){var _0x839a48;switch(_0x387d94[_0xc829('0x54')]){case'US':_0x839a48=_0xc829('0x55');break;case'AU':_0x839a48=_0xc829('0x56');break;case'EU':_0x839a48='https://accounts.zoho.eu';break;case'IN':_0x839a48=_0xc829('0x57');break;case'CN':_0x839a48='https://accounts.zoho.com.cn';break;default:_0x839a48='https://accounts.zoho.eu';break;}var _0x11029b={'method':_0xc829('0x58'),'uri':_0x839a48+_0xc829('0x59'),'qs':{'refresh_token':_0x387d94[_0xc829('0x5a')],'client_id':_0x387d94[_0xc829('0x5b')],'client_secret':_0x387d94[_0xc829('0x5c')],'grant_type':_0xc829('0x5d')},'json':!![]};return rp(_0x11029b)['then'](function(_0x4dad19){if(_0x4dad19[_0xc829('0x5e')]){_0x73d67c(_0x4dad19['access_token']);}else{_0x50ebaa(_0xc829('0x5f'));}})[_0xc829('0x44')](function(_0x83a12d){_0x50ebaa(_0x83a12d);});});}exports[_0xc829('0x60')]=function(_0x4da410,_0x513f7a,_0x4864c2){var _0x4b1d9c,_0x4f86e0,_0x27369d,_0x54e1b3,_0x153c72;return db[_0xc829('0x41')][_0xc829('0x4e')]({'where':{'id':_0x4da410['params']['id']},'attributes':['id','host',_0xc829('0x54'),_0xc829('0x5b'),'clientSecret',_0xc829('0x61'),_0xc829('0x62'),'refreshToken']})[_0xc829('0x26')](handleEntityNotFound(_0x513f7a,null))[_0xc829('0x26')](function(_0x1ff9ce){_0x153c72=_0x1ff9ce;_0x4b1d9c=_0x153c72[_0xc829('0x63')];_0x4f86e0=_0x4b1d9c===_0xc829('0x64')?'eu':_0xc829('0x65');_0x27369d=_0x153c72['serverUrl'];var _0xdbc226=_0x27369d[_0xc829('0x66')](-0x1);if(_0xdbc226==='/'||_0xdbc226==='\x5c'||_0xdbc226===':'){_0x27369d=_0x27369d[_0xc829('0x67')](0x0,_0x27369d[_0xc829('0x68')](_0xdbc226));}if(!_0x153c72[_0xc829('0x5a')]){throw new Error(_0xc829('0x69'));}return getAccessToken(_0x153c72);})['then'](function(_0x1f66d3){if(_0x1f66d3){return rp({'method':'GET','uri':util[_0xc829('0x6a')](_0xc829('0x6b'),_0x4f86e0),'qs':{'module':'Calls'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1f66d3},'json':!![]});}})[_0xc829('0x26')](function(_0xd61843){if(_0xd61843){if(_0xd61843[_0xc829('0x6c')]&&_0xd61843[_0xc829('0x6c')][_0xc829('0x6d')]){throw new Error(_0xd61843[_0xc829('0x6c')][_0xc829('0x6d')][_0xc829('0x6e')]);}var _0x709fa8=[];var _0x10d5e9=[];var _0x3c34f7=['Owner',_0xc829('0x6f'),_0xc829('0x70'),_0xc829('0x71'),'Call_Duration','Call_Result',_0xc829('0x72'),_0xc829('0x73')];_0x10d5e9=_[_0xc829('0x74')](_0xd61843['fields'],function(_0x4d0cb9){return _0x3c34f7[_0xc829('0x75')](_0x4d0cb9['api_name']);});for(var _0x42ca3c=0x0;_0x42ca3c<_0x10d5e9['length'];_0x42ca3c++){if(_0x10d5e9[_0x42ca3c]['system_mandatory']===![]){_0x709fa8[_0xc829('0x76')]({'id':_0x10d5e9[_0x42ca3c]['id'],'name':_0x10d5e9[_0x42ca3c][_0xc829('0x77')],'custom':_0x10d5e9[_0x42ca3c][_0xc829('0x78')],'options':_0x10d5e9[_0x42ca3c][_0xc829('0x79')]==='picklist'&&_0x10d5e9[_0x42ca3c][_0xc829('0x7a')][_0xc829('0x36')]>-0x1?_['map'](_0x10d5e9[_0x42ca3c]['pick_list_values'],function(_0x1b1211){return{'name':_0x1b1211,'value':_0x1b1211};}):[]});}}return{'count':_0x709fa8[_0xc829('0x36')],'rows':_0x709fa8};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x513f7a,null))[_0xc829('0x44')](function(_0x337f04){var _0x4f1486=_0x4da410['query'][_0xc829('0x7b')]?0x1f4:_0x337f04[_0xc829('0x7c')]||0x1f4;logger['error'](_0xc829('0x7d'),_0xc829('0x60'),_0x4f1486,JSON[_0xc829('0x7e')](_0x337f04));delete _0x337f04[_0xc829('0x29')];if(_0x4f1486===0x191){_0x4f1486=0x190;}_0x513f7a['status'](_0x4f1486)['send'](_0x4da410[_0xc829('0x30')][_0xc829('0x7b')]?{'message':_0xc829('0x7f'),'statusCode':_0x337f04[_0xc829('0x7c')]}:_0x337f04);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index d65061a..2f73b5b 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 _0x000d=['error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','slice','substring','lastIndexOf','https://accounts.zoho.com.au','POST','/oauth/v2/token','refreshToken','lodash','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','zone','changed','serverUrl','clientId','clientSecret','code','host','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','authorization_code','application/x-www-form-urlencoded','parse','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x000d,0x1d2));var _0xd000=function(_0x38991d,_0x3f73e9){_0x38991d=_0x38991d-0x0;var _0x12ef00=_0x000d[_0x38991d];return _0x12ef00;};'use strict';var _=require(_0xd000('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xd000('0x1'));var BPromise=require(_0xd000('0x2'));var rp=require(_0xd000('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd000('0x4'));var config=require(_0xd000('0x5'));var attributes=require(_0xd000('0x6'));var integrations=require(_0xd000('0x7'));module['exports']=function(_0x28ae15,_0x4b545b){return _0x28ae15[_0xd000('0x8')]('ZohoAccount',attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x30383c,_0x11e04a,_0x5a6e32){if(_0x30383c['changed'](_0xd000('0x9'))||_0x30383c[_0xd000('0xa')](_0xd000('0xb'))||_0x30383c[_0xd000('0xa')](_0xd000('0xc'))||_0x30383c['changed'](_0xd000('0xd'))||_0x30383c['changed'](_0xd000('0xe'))||_0x30383c['changed'](_0xd000('0xf'))){var _0x3cc107,_0x42ef82;_0x3cc107=_0x30383c['serverUrl'];var _0xb5af5e=_0x3cc107['slice'](-0x1);if(_0xb5af5e==='/'||_0xb5af5e==='\x5c'||_0xb5af5e===':'){_0x3cc107=_0x3cc107['substring'](0x0,_0x3cc107['lastIndexOf'](_0xb5af5e));}switch(_0x30383c[_0xd000('0x9')]){case'US':_0x42ef82=_0xd000('0x10');break;case'AU':_0x42ef82='https://accounts.zoho.com.au';break;case'IN':_0x42ef82=_0xd000('0x11');break;case'CN':_0x42ef82=_0xd000('0x12');break;default:_0x42ef82=_0xd000('0x13');break;}var _0x2523cf={'method':'POST','uri':_0x42ef82+'/oauth/v2/token','form':{'grant_type':_0xd000('0x14'),'client_id':_0x30383c[_0xd000('0xc')],'client_secret':_0x30383c['clientSecret'],'redirect_uri':_0x30383c['serverUrl'],'code':_0x30383c['code']},'headers':{'Content-Type':_0xd000('0x15')}};return rp(_0x2523cf)['then'](function(_0xfadc15){var _0x216db4=JSON[_0xd000('0x16')](_0xfadc15);if(_0x216db4['refresh_token']){_0x30383c['refreshToken']=_0x216db4[_0xd000('0x17')];logger[_0xd000('0x18')](util[_0xd000('0x19')](_0xd000('0x1a'),_0x30383c[_0xd000('0x1b')],_0x30383c['id']));}else{logger[_0xd000('0x1c')](util['format'](_0xd000('0x1d'),_0x30383c['name'],_0x30383c['id']),util[_0xd000('0x1e')](_0x216db4,{'showHidden':![],'depth':null}));}return _0x5a6e32(null,_0x11e04a);})['catch'](function(_0x43c3e6){logger['error'](util[_0xd000('0x19')](_0xd000('0x1d'),_0x30383c[_0xd000('0x1b')],_0x30383c['id']),util[_0xd000('0x1e')](parsedResult,{'showHidden':![],'depth':null}));return _0x5a6e32(_0x43c3e6);});}else{return _0x5a6e32(null,_0x11e04a);}},'beforeUpdate':function(_0xe3ab98,_0x18d62d,_0x1aed31){if(_0xe3ab98['changed'](_0xd000('0x9'))||_0xe3ab98[_0xd000('0xa')](_0xd000('0xb'))||_0xe3ab98['changed'](_0xd000('0xc'))||_0xe3ab98['changed']('clientSecret')||_0xe3ab98[_0xd000('0xa')]('code')||_0xe3ab98[_0xd000('0xa')]('host')){var _0x44befd,_0x43bf15;_0x44befd=_0xe3ab98[_0xd000('0xb')];var _0x19e16c=_0x44befd[_0xd000('0x1f')](-0x1);if(_0x19e16c==='/'||_0x19e16c==='\x5c'||_0x19e16c===':'){_0x44befd=_0x44befd[_0xd000('0x20')](0x0,_0x44befd[_0xd000('0x21')](_0x19e16c));}switch(_0xe3ab98[_0xd000('0x9')]){case'US':_0x43bf15=_0xd000('0x10');break;case'AU':_0x43bf15=_0xd000('0x22');break;case'IN':_0x43bf15=_0xd000('0x11');break;case'CN':_0x43bf15=_0xd000('0x12');break;default:_0x43bf15='https://accounts.zoho.eu';break;}var _0x3ce5ad={'method':_0xd000('0x23'),'uri':_0x43bf15+_0xd000('0x24'),'form':{'grant_type':_0xd000('0x14'),'client_id':_0xe3ab98[_0xd000('0xc')],'client_secret':_0xe3ab98[_0xd000('0xd')],'redirect_uri':_0xe3ab98[_0xd000('0xb')],'code':_0xe3ab98[_0xd000('0xe')]},'headers':{'Content-Type':_0xd000('0x15')}};return rp(_0x3ce5ad)['then'](function(_0xcbb1ed){var _0x5b71b8=JSON['parse'](_0xcbb1ed);if(_0x5b71b8[_0xd000('0x17')]){_0xe3ab98[_0xd000('0x25')]=_0x5b71b8[_0xd000('0x17')];logger[_0xd000('0x18')](util[_0xd000('0x19')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0xe3ab98[_0xd000('0x1b')],_0xe3ab98['id']));}else{logger['error'](util[_0xd000('0x19')](_0xd000('0x1d'),_0xe3ab98[_0xd000('0x1b')],_0xe3ab98['id']),util[_0xd000('0x1e')](_0x5b71b8,{'showHidden':![],'depth':null}));}return _0x1aed31(null,_0x18d62d);})['catch'](function(_0x295cbc){logger[_0xd000('0x1c')](util[_0xd000('0x19')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0xe3ab98['name'],_0xe3ab98['id']),util[_0xd000('0x1e')](parsedResult,{'showHidden':![],'depth':null}));return _0x1aed31(_0x295cbc);});}else{return _0x1aed31(null,_0x18d62d);}}}});}; \ No newline at end of file +var _0xb16a=['then','parse','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','POST','authorization_code','application/x-www-form-urlencoded','refreshToken','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','clientId','clientSecret','host','serverUrl','substring','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','code'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xb16a,0xd6));var _0xab16=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb16a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xab16('0x0'));var util=require('util');var logger=require(_0xab16('0x1'))(_0xab16('0x2'));var moment=require(_0xab16('0x3'));var BPromise=require('bluebird');var rp=require(_0xab16('0x4'));var fs=require('fs');var path=require(_0xab16('0x5'));var rimraf=require(_0xab16('0x6'));var config=require(_0xab16('0x7'));var attributes=require(_0xab16('0x8'));var integrations=require(_0xab16('0x9'));module[_0xab16('0xa')]=function(_0x5113b3,_0x13a928){return _0x5113b3[_0xab16('0xb')](_0xab16('0xc'),attributes,{'tableName':_0xab16('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x307264,_0x1d06d4,_0x1bdd84){if(_0x307264[_0xab16('0xe')](_0xab16('0xf'))||_0x307264[_0xab16('0xe')]('serverUrl')||_0x307264['changed'](_0xab16('0x10'))||_0x307264[_0xab16('0xe')](_0xab16('0x11'))||_0x307264[_0xab16('0xe')]('code')||_0x307264['changed'](_0xab16('0x12'))){var _0x54e9da,_0x52d7fb;_0x54e9da=_0x307264[_0xab16('0x13')];var _0x6065a8=_0x54e9da['slice'](-0x1);if(_0x6065a8==='/'||_0x6065a8==='\x5c'||_0x6065a8===':'){_0x54e9da=_0x54e9da[_0xab16('0x14')](0x0,_0x54e9da['lastIndexOf'](_0x6065a8));}switch(_0x307264[_0xab16('0xf')]){case'US':_0x52d7fb='https://accounts.zoho.com';break;case'AU':_0x52d7fb=_0xab16('0x15');break;case'IN':_0x52d7fb='https://accounts.zoho.in';break;case'CN':_0x52d7fb=_0xab16('0x16');break;default:_0x52d7fb=_0xab16('0x17');break;}var _0x2ed3d2={'method':'POST','uri':_0x52d7fb+_0xab16('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x307264[_0xab16('0x10')],'client_secret':_0x307264[_0xab16('0x11')],'redirect_uri':_0x307264[_0xab16('0x13')],'code':_0x307264[_0xab16('0x19')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x2ed3d2)[_0xab16('0x1a')](function(_0x2203d2){var _0x7d4845=JSON[_0xab16('0x1b')](_0x2203d2);if(_0x7d4845[_0xab16('0x1c')]){_0x307264['refreshToken']=_0x7d4845[_0xab16('0x1c')];logger[_0xab16('0x1d')](util[_0xab16('0x1e')](_0xab16('0x1f'),_0x307264[_0xab16('0x20')],_0x307264['id']));}else{logger['error'](util[_0xab16('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x307264[_0xab16('0x20')],_0x307264['id']),util[_0xab16('0x21')](_0x7d4845,{'showHidden':![],'depth':null}));}return _0x1bdd84(null,_0x1d06d4);})['catch'](function(_0x5c4f4b){logger['error'](util[_0xab16('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x307264[_0xab16('0x20')],_0x307264['id']),util[_0xab16('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x1bdd84(_0x5c4f4b);});}else{return _0x1bdd84(null,_0x1d06d4);}},'beforeUpdate':function(_0x1503a,_0x33774f,_0x1b9b4d){if(_0x1503a['changed'](_0xab16('0xf'))||_0x1503a[_0xab16('0xe')](_0xab16('0x13'))||_0x1503a[_0xab16('0xe')](_0xab16('0x10'))||_0x1503a[_0xab16('0xe')](_0xab16('0x11'))||_0x1503a['changed'](_0xab16('0x19'))||_0x1503a[_0xab16('0xe')](_0xab16('0x12'))){var _0x262b8b,_0x10d7d3;_0x262b8b=_0x1503a[_0xab16('0x13')];var _0x1bac2b=_0x262b8b['slice'](-0x1);if(_0x1bac2b==='/'||_0x1bac2b==='\x5c'||_0x1bac2b===':'){_0x262b8b=_0x262b8b[_0xab16('0x14')](0x0,_0x262b8b['lastIndexOf'](_0x1bac2b));}switch(_0x1503a[_0xab16('0xf')]){case'US':_0x10d7d3='https://accounts.zoho.com';break;case'AU':_0x10d7d3='https://accounts.zoho.com.au';break;case'IN':_0x10d7d3='https://accounts.zoho.in';break;case'CN':_0x10d7d3='https://accounts.zoho.com.cn';break;default:_0x10d7d3=_0xab16('0x17');break;}var _0x59744b={'method':_0xab16('0x22'),'uri':_0x10d7d3+_0xab16('0x18'),'form':{'grant_type':_0xab16('0x23'),'client_id':_0x1503a[_0xab16('0x10')],'client_secret':_0x1503a['clientSecret'],'redirect_uri':_0x1503a[_0xab16('0x13')],'code':_0x1503a['code']},'headers':{'Content-Type':_0xab16('0x24')}};return rp(_0x59744b)[_0xab16('0x1a')](function(_0x25ef30){var _0x458db9=JSON['parse'](_0x25ef30);if(_0x458db9[_0xab16('0x1c')]){_0x1503a[_0xab16('0x25')]=_0x458db9[_0xab16('0x1c')];logger[_0xab16('0x1d')](util[_0xab16('0x1e')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1503a['name'],_0x1503a['id']));}else{logger[_0xab16('0x26')](util[_0xab16('0x1e')](_0xab16('0x27'),_0x1503a[_0xab16('0x20')],_0x1503a['id']),util['inspect'](_0x458db9,{'showHidden':![],'depth':null}));}return _0x1b9b4d(null,_0x33774f);})['catch'](function(_0x248087){logger[_0xab16('0x26')](util[_0xab16('0x1e')](_0xab16('0x27'),_0x1503a['name'],_0x1503a['id']),util[_0xab16('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x1b9b4d(_0x248087);});}else{return _0x1b9b4d(null,_0x33774f);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 9308203..26dbff8 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 _0x084b=['ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZohoAccount','options','where','attributes','include','map','model','ShowZohoAccount','ZohoAccount','find','raw','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info'];(function(_0x207811,_0x3420a6){var _0x170d56=function(_0x4340b7){while(--_0x4340b7){_0x207811['push'](_0x207811['shift']());}};_0x170d56(++_0x3420a6);}(_0x084b,0xd5));var _0xb084=function(_0x397cb5,_0x60d6b2){_0x397cb5=_0x397cb5-0x0;var _0x2a5444=_0x084b[_0x397cb5];return _0x2a5444;};'use strict';var _=require(_0xb084('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb084('0x1'));var fs=require('fs');var Redis=require(_0xb084('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xb084('0x3'));var logger=require(_0xb084('0x4'))(_0xb084('0x5'));var config=require('../../config/environment');var jayson=require(_0xb084('0x6'));var client=jayson['client'][_0xb084('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x449c7a,_0x275c8c,_0x4b69ad){return new BPromise(function(_0x4f45d2,_0x18a300){return client[_0xb084('0x8')](_0x449c7a,_0x4b69ad)[_0xb084('0x9')](function(_0xec1e0d){logger[_0xb084('0xa')](_0xb084('0xb'),_0x275c8c,_0xb084('0xc'));logger[_0xb084('0xd')](_0xb084('0xe'),_0x275c8c,_0xb084('0xc'),JSON[_0xb084('0xf')](_0xec1e0d));if(_0xec1e0d[_0xb084('0x10')]){if(_0xec1e0d[_0xb084('0x10')][_0xb084('0x11')]===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x275c8c,_0xec1e0d[_0xb084('0x10')]['message']);return _0x18a300(_0xec1e0d['error'][_0xb084('0x12')]);}logger[_0xb084('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x275c8c,_0xec1e0d['error'][_0xb084('0x12')]);return _0x4f45d2(_0xec1e0d[_0xb084('0x10')][_0xb084('0x12')]);}else{logger[_0xb084('0xa')](_0xb084('0xb'),_0x275c8c,'request\x20sent');_0x4f45d2(_0xec1e0d[_0xb084('0x13')][_0xb084('0x12')]);}})[_0xb084('0x14')](function(_0xbcdb1f){logger[_0xb084('0x10')](_0xb084('0xb'),_0x275c8c,_0xbcdb1f);_0x18a300(_0xbcdb1f);});});}exports[_0xb084('0x15')]=function(_0x42657a){var _0x13b3e4=this;return new Promise(function(_0x19d426,_0x4b91e5){return db['ZohoAccount']['findAll']({'raw':_0x42657a['options']?_0x42657a[_0xb084('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x42657a[_0xb084('0x16')]?_0x42657a[_0xb084('0x16')][_0xb084('0x17')]||null:null,'attributes':_0x42657a[_0xb084('0x16')]?_0x42657a[_0xb084('0x16')][_0xb084('0x18')]||null:null,'limit':_0x42657a[_0xb084('0x16')]?_0x42657a[_0xb084('0x16')]['limit']||null:null,'include':_0x42657a['options']?_0x42657a[_0xb084('0x16')][_0xb084('0x19')]?_[_0xb084('0x1a')](_0x42657a[_0xb084('0x16')][_0xb084('0x19')],function(_0x4795d9){return{'model':db[_0x4795d9[_0xb084('0x1b')]],'as':_0x4795d9['as'],'attributes':_0x4795d9[_0xb084('0x18')],'include':_0x4795d9['include']?_[_0xb084('0x1a')](_0x4795d9['include'],function(_0x1f4983){return{'model':db[_0x1f4983[_0xb084('0x1b')]],'as':_0x1f4983['as'],'attributes':_0x1f4983['attributes'],'include':_0x1f4983[_0xb084('0x19')]?_[_0xb084('0x1a')](_0x1f4983[_0xb084('0x19')],function(_0x4ce54c){return{'model':db[_0x4ce54c[_0xb084('0x1b')]],'as':_0x4ce54c['as'],'attributes':_0x4ce54c['attributes']};}):[]};}):[]};}):[]:[]})[_0xb084('0x9')](function(_0x623fe8){logger['info'](_0xb084('0x15'),_0x42657a);logger[_0xb084('0xd')]('GetZohoAccount',_0x42657a,JSON[_0xb084('0xf')](_0x623fe8));_0x19d426(_0x623fe8);})[_0xb084('0x14')](function(_0x57406f){logger[_0xb084('0x10')](_0xb084('0x15'),_0x57406f['message'],_0x42657a);_0x4b91e5(_0x13b3e4[_0xb084('0x10')](0x1f4,_0x57406f[_0xb084('0x12')]));});});};exports[_0xb084('0x1c')]=function(_0x257833){var _0x33ed25=this;return new Promise(function(_0x5afdf1,_0x318b34){return db[_0xb084('0x1d')][_0xb084('0x1e')]({'raw':_0x257833[_0xb084('0x16')]?_0x257833['options'][_0xb084('0x1f')]===undefined?!![]:![]:!![],'where':_0x257833[_0xb084('0x16')]?_0x257833[_0xb084('0x16')][_0xb084('0x17')]||null:null,'attributes':_0x257833[_0xb084('0x16')]?_0x257833['options']['attributes']||null:null,'include':_0x257833[_0xb084('0x16')]?_0x257833['options'][_0xb084('0x19')]?_['map'](_0x257833[_0xb084('0x16')][_0xb084('0x19')],function(_0x40e50b){return{'model':db[_0x40e50b[_0xb084('0x1b')]],'as':_0x40e50b['as'],'attributes':_0x40e50b['attributes'],'include':_0x40e50b[_0xb084('0x19')]?_[_0xb084('0x1a')](_0x40e50b[_0xb084('0x19')],function(_0x2ad60c){return{'model':db[_0x2ad60c[_0xb084('0x1b')]],'as':_0x2ad60c['as'],'attributes':_0x2ad60c['attributes'],'include':_0x2ad60c[_0xb084('0x19')]?_[_0xb084('0x1a')](_0x2ad60c['include'],function(_0x481a83){return{'model':db[_0x481a83[_0xb084('0x1b')]],'as':_0x481a83['as'],'attributes':_0x481a83[_0xb084('0x18')]};}):[]};}):[]};}):[]:[]})[_0xb084('0x9')](function(_0xdea33c){logger[_0xb084('0xa')](_0xb084('0x1c'),_0x257833);logger[_0xb084('0xd')](_0xb084('0x1c'),_0x257833,JSON['stringify'](_0xdea33c));_0x5afdf1(_0xdea33c);})[_0xb084('0x14')](function(_0x3da0e9){logger['error'](_0xb084('0x1c'),_0x3da0e9['message'],_0x257833);_0x318b34(_0x33ed25[_0xb084('0x10')](0x1f4,_0x3da0e9[_0xb084('0x12')]));});});}; \ No newline at end of file +var _0x5454=['model','debug','catch','ShowZohoAccount','find','raw','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetZohoAccount','ZohoAccount','options','where','attributes','map','include'];(function(_0x324fe8,_0x1ccb46){var _0x4a1cd9=function(_0x506af2){while(--_0x506af2){_0x324fe8['push'](_0x324fe8['shift']());}};_0x4a1cd9(++_0x1ccb46);}(_0x5454,0x15b));var _0x4545=function(_0x3274a4,_0x17bc0e){_0x3274a4=_0x3274a4-0x0;var _0x54c7cd=_0x5454[_0x3274a4];return _0x54c7cd;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x4545('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4545('0x1'));var logger=require(_0x4545('0x2'))(_0x4545('0x3'));var config=require(_0x4545('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x4545('0x5')][_0x4545('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x6fd3bb,_0xc79c57,_0x3f1134){return new BPromise(function(_0x1fd7e5,_0x1c5649){return client[_0x4545('0x7')](_0x6fd3bb,_0x3f1134)[_0x4545('0x8')](function(_0x3e2526){logger[_0x4545('0x9')](_0x4545('0xa'),_0xc79c57,_0x4545('0xb'));logger['debug'](_0x4545('0xc'),_0xc79c57,_0x4545('0xb'),JSON[_0x4545('0xd')](_0x3e2526));if(_0x3e2526[_0x4545('0xe')]){if(_0x3e2526[_0x4545('0xe')][_0x4545('0xf')]===0x1f4){logger['error'](_0x4545('0xa'),_0xc79c57,_0x3e2526[_0x4545('0xe')][_0x4545('0x10')]);return _0x1c5649(_0x3e2526[_0x4545('0xe')][_0x4545('0x10')]);}logger[_0x4545('0xe')](_0x4545('0xa'),_0xc79c57,_0x3e2526[_0x4545('0xe')][_0x4545('0x10')]);return _0x1fd7e5(_0x3e2526[_0x4545('0xe')][_0x4545('0x10')]);}else{logger['info'](_0x4545('0xa'),_0xc79c57,_0x4545('0xb'));_0x1fd7e5(_0x3e2526[_0x4545('0x11')][_0x4545('0x10')]);}})['catch'](function(_0x4a5bdf){logger[_0x4545('0xe')](_0x4545('0xa'),_0xc79c57,_0x4a5bdf);_0x1c5649(_0x4a5bdf);});});}exports[_0x4545('0x12')]=function(_0x2e13e0){var _0x207e38=this;return new Promise(function(_0x33393b,_0x3161c8){return db[_0x4545('0x13')]['findAll']({'raw':_0x2e13e0['options']?_0x2e13e0[_0x4545('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x2e13e0[_0x4545('0x14')]?_0x2e13e0[_0x4545('0x14')][_0x4545('0x15')]||null:null,'attributes':_0x2e13e0[_0x4545('0x14')]?_0x2e13e0[_0x4545('0x14')][_0x4545('0x16')]||null:null,'limit':_0x2e13e0[_0x4545('0x14')]?_0x2e13e0[_0x4545('0x14')]['limit']||null:null,'include':_0x2e13e0['options']?_0x2e13e0[_0x4545('0x14')]['include']?_[_0x4545('0x17')](_0x2e13e0['options'][_0x4545('0x18')],function(_0x4c47c0){return{'model':db[_0x4c47c0['model']],'as':_0x4c47c0['as'],'attributes':_0x4c47c0[_0x4545('0x16')],'include':_0x4c47c0[_0x4545('0x18')]?_[_0x4545('0x17')](_0x4c47c0[_0x4545('0x18')],function(_0x344633){return{'model':db[_0x344633[_0x4545('0x19')]],'as':_0x344633['as'],'attributes':_0x344633[_0x4545('0x16')],'include':_0x344633[_0x4545('0x18')]?_[_0x4545('0x17')](_0x344633[_0x4545('0x18')],function(_0x3e5807){return{'model':db[_0x3e5807[_0x4545('0x19')]],'as':_0x3e5807['as'],'attributes':_0x3e5807[_0x4545('0x16')]};}):[]};}):[]};}):[]:[]})[_0x4545('0x8')](function(_0x1d8c39){logger[_0x4545('0x9')]('GetZohoAccount',_0x2e13e0);logger[_0x4545('0x1a')](_0x4545('0x12'),_0x2e13e0,JSON[_0x4545('0xd')](_0x1d8c39));_0x33393b(_0x1d8c39);})[_0x4545('0x1b')](function(_0xb9c5ee){logger['error'](_0x4545('0x12'),_0xb9c5ee[_0x4545('0x10')],_0x2e13e0);_0x3161c8(_0x207e38[_0x4545('0xe')](0x1f4,_0xb9c5ee[_0x4545('0x10')]));});});};exports[_0x4545('0x1c')]=function(_0x27b7d7){var _0x52dd8e=this;return new Promise(function(_0x406920,_0x80b55f){return db[_0x4545('0x13')][_0x4545('0x1d')]({'raw':_0x27b7d7[_0x4545('0x14')]?_0x27b7d7[_0x4545('0x14')][_0x4545('0x1e')]===undefined?!![]:![]:!![],'where':_0x27b7d7[_0x4545('0x14')]?_0x27b7d7[_0x4545('0x14')][_0x4545('0x15')]||null:null,'attributes':_0x27b7d7[_0x4545('0x14')]?_0x27b7d7['options'][_0x4545('0x16')]||null:null,'include':_0x27b7d7['options']?_0x27b7d7[_0x4545('0x14')][_0x4545('0x18')]?_['map'](_0x27b7d7[_0x4545('0x14')][_0x4545('0x18')],function(_0x46e814){return{'model':db[_0x46e814[_0x4545('0x19')]],'as':_0x46e814['as'],'attributes':_0x46e814[_0x4545('0x16')],'include':_0x46e814[_0x4545('0x18')]?_[_0x4545('0x17')](_0x46e814['include'],function(_0x1abc06){return{'model':db[_0x1abc06[_0x4545('0x19')]],'as':_0x1abc06['as'],'attributes':_0x1abc06[_0x4545('0x16')],'include':_0x1abc06[_0x4545('0x18')]?_[_0x4545('0x17')](_0x1abc06[_0x4545('0x18')],function(_0x5bc452){return{'model':db[_0x5bc452[_0x4545('0x19')]],'as':_0x5bc452['as'],'attributes':_0x5bc452[_0x4545('0x16')]};}):[]};}):[]};}):[]:[]})[_0x4545('0x8')](function(_0x3cee1a){logger[_0x4545('0x9')](_0x4545('0x1c'),_0x27b7d7);logger[_0x4545('0x1a')](_0x4545('0x1c'),_0x27b7d7,JSON[_0x4545('0xd')](_0x3cee1a));_0x406920(_0x3cee1a);})['catch'](function(_0x47c85d){logger['error'](_0x4545('0x1c'),_0x47c85d['message'],_0x27b7d7);_0x80b55f(_0x52dd8e[_0x4545('0xe')](0x1f4,_0x47c85d[_0x4545('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 9fe5849..081089a 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 _0x009b=['connect-timeout','express','Router','fs-extra','../../config/environment','./intZohoConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','put','update','destroy','exports','multer','path'];(function(_0x5ff464,_0x5038d7){var _0x347182=function(_0xeef52c){while(--_0xeef52c){_0x5ff464['push'](_0x5ff464['shift']());}};_0x347182(++_0x5038d7);}(_0x009b,0x9f));var _0xb009=function(_0x5bee84,_0x3f6e8a){_0x5bee84=_0x5bee84-0x0;var _0x4d1cc5=_0x009b[_0x5bee84];return _0x4d1cc5;};'use strict';var multer=require(_0xb009('0x0'));var util=require('util');var path=require(_0xb009('0x1'));var timeout=require(_0xb009('0x2'));var express=require(_0xb009('0x3'));var router=express[_0xb009('0x4')]();var fs_extra=require(_0xb009('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb009('0x6'));var controller=require(_0xb009('0x7'));router['get']('/',auth[_0xb009('0x8')](),controller[_0xb009('0x9')]);router[_0xb009('0xa')](_0xb009('0xb'),auth[_0xb009('0x8')](),controller[_0xb009('0xc')]);router[_0xb009('0xa')](_0xb009('0xd'),auth[_0xb009('0x8')](),controller[_0xb009('0xe')]);router[_0xb009('0xa')](_0xb009('0xf'),auth[_0xb009('0x8')](),controller[_0xb009('0x10')]);router[_0xb009('0xa')](_0xb009('0x11'),auth[_0xb009('0x8')](),controller[_0xb009('0x12')]);router['post']('/',auth[_0xb009('0x8')](),controller['create']);router[_0xb009('0x13')](_0xb009('0xb'),auth[_0xb009('0x8')](),controller[_0xb009('0x14')]);router['delete'](_0xb009('0xb'),auth[_0xb009('0x8')](),controller[_0xb009('0x15')]);module[_0xb009('0x16')]=router; \ No newline at end of file +var _0xc549=['getSubjects','/:id/descriptions','getDescriptions','post','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intZohoConfiguration.controller','isAuthenticated','index','get','/:id/fields','/:id/subjects'];(function(_0x5573b4,_0x4020ec){var _0x506a32=function(_0x187f4b){while(--_0x187f4b){_0x5573b4['push'](_0x5573b4['shift']());}};_0x506a32(++_0x4020ec);}(_0xc549,0xaa));var _0x9c54=function(_0x25eaec,_0x12f562){_0x25eaec=_0x25eaec-0x0;var _0x7702ab=_0xc549[_0x25eaec];return _0x7702ab;};'use strict';var multer=require(_0x9c54('0x0'));var util=require(_0x9c54('0x1'));var path=require(_0x9c54('0x2'));var timeout=require(_0x9c54('0x3'));var express=require(_0x9c54('0x4'));var router=express[_0x9c54('0x5')]();var fs_extra=require(_0x9c54('0x6'));var auth=require(_0x9c54('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9c54('0x8'));router['get']('/',auth[_0x9c54('0x9')](),controller[_0x9c54('0xa')]);router[_0x9c54('0xb')]('/:id',auth[_0x9c54('0x9')](),controller['show']);router[_0x9c54('0xb')](_0x9c54('0xc'),auth[_0x9c54('0x9')](),controller['getFields']);router[_0x9c54('0xb')](_0x9c54('0xd'),auth[_0x9c54('0x9')](),controller[_0x9c54('0xe')]);router[_0x9c54('0xb')](_0x9c54('0xf'),auth['isAuthenticated'](),controller[_0x9c54('0x10')]);router[_0x9c54('0x11')]('/',auth[_0x9c54('0x9')](),controller['create']);router['put'](_0x9c54('0x12'),auth[_0x9c54('0x9')](),controller[_0x9c54('0x13')]);router[_0x9c54('0x14')](_0x9c54('0x12'),auth['isAuthenticated'](),controller[_0x9c54('0x15')]);module[_0x9c54('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index bfe6aa1..3738b8a 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 _0x1c17=['sequelize','exports','STRING','ENUM','contact','nothing','lead','contact_lead'];(function(_0xf0fe2a,_0x32d000){var _0xa6e4ef=function(_0x581cc2){while(--_0x581cc2){_0xf0fe2a['push'](_0xf0fe2a['shift']());}};_0xa6e4ef(++_0x32d000);}(_0x1c17,0x158));var _0x71c1=function(_0x51564e,_0x12ef79){_0x51564e=_0x51564e-0x0;var _0x31d941=_0x1c17[_0x51564e];return _0x31d941;};'use strict';var Sequelize=require(_0x71c1('0x0'));module[_0x71c1('0x1')]={'name':{'type':Sequelize[_0x71c1('0x2')]},'moduleCreate':{'type':Sequelize[_0x71c1('0x3')]('lead',_0x71c1('0x4'),_0x71c1('0x5')),'defaultValue':_0x71c1('0x6')},'moduleSearch':{'type':Sequelize['ENUM'](_0x71c1('0x7'),_0x71c1('0x4'),_0x71c1('0x6')),'defaultValue':_0x71c1('0x7')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf301=['exports','STRING','lead','ENUM','contact_lead','contact','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf301,0x1d4));var _0x1f30=function(_0x1855cd,_0x6fdae){_0x1855cd=_0x1855cd-0x0;var _0x562668=_0xf301[_0x1855cd];return _0x562668;};'use strict';var Sequelize=require(_0x1f30('0x0'));module[_0x1f30('0x1')]={'name':{'type':Sequelize[_0x1f30('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x1f30('0x3'),'contact','nothing'),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x1f30('0x4')](_0x1f30('0x5'),_0x1f30('0x6'),_0x1f30('0x3')),'defaultValue':_0x1f30('0x5')},'description':{'type':Sequelize[_0x1f30('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 6d24c89..d795656 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 _0x7dda=['nolimit','sort','where','pick','filter','merge','type','options','count','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','destroy','getFields','ZohoField','order','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject','update','then','error','stack','name','send','index','ZohoConfiguration','fieldName','key','map','keys','query','filters','intersection','fields','attributes','length','model','hasOwnProperty'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x7dda,0x1b5));var _0xa7dd=function(_0x47152a,_0x224c39){_0x47152a=_0x47152a-0x0;var _0x73406d=_0x7dda[_0x47152a];return _0x73406d;};'use strict';var emlformat=require(_0xa7dd('0x0'));var rimraf=require(_0xa7dd('0x1'));var zipdir=require(_0xa7dd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa7dd('0x3'));var moment=require(_0xa7dd('0x4'));var BPromise=require(_0xa7dd('0x5'));var Mustache=require(_0xa7dd('0x6'));var util=require(_0xa7dd('0x7'));var path=require(_0xa7dd('0x8'));var sox=require(_0xa7dd('0x9'));var csv=require('to-csv');var ejs=require(_0xa7dd('0xa'));var fs=require('fs');var fs_extra=require(_0xa7dd('0xb'));var _=require(_0xa7dd('0xc'));var squel=require(_0xa7dd('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa7dd('0xe'));var toCsv=require(_0xa7dd('0xf'));var querystring=require('querystring');var Papa=require(_0xa7dd('0x10'));var Redis=require(_0xa7dd('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa7dd('0x12'));var as=require(_0xa7dd('0x13'));var hardwareService=require(_0xa7dd('0x14'));var logger=require(_0xa7dd('0x15'))('api');var utils=require(_0xa7dd('0x16'));var config=require(_0xa7dd('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa7dd('0x18'))['db'];function respondWithStatusCode(_0x44bc63,_0x571711){_0x571711=_0x571711||0xcc;return function(_0x13f137){if(_0x13f137){return _0x44bc63[_0xa7dd('0x19')](_0x571711);}return _0x44bc63[_0xa7dd('0x1a')](_0x571711)[_0xa7dd('0x1b')]();};}function respondWithResult(_0x341141,_0x4b5022){_0x4b5022=_0x4b5022||0xc8;return function(_0x3543f4){if(_0x3543f4){return _0x341141[_0xa7dd('0x1a')](_0x4b5022)[_0xa7dd('0x1c')](_0x3543f4);}};}function respondWithFilteredResult(_0x180806,_0x3b4c9d){return function(_0x38c495){if(_0x38c495){var _0x5cd1e9=typeof _0x3b4c9d[_0xa7dd('0x1d')]==='undefined'&&typeof _0x3b4c9d[_0xa7dd('0x1e')]===_0xa7dd('0x1f');var _0x25ebaf=_0x38c495['count'];var _0x5cf461=_0x5cd1e9?0x0:_0x3b4c9d['offset'];var _0x558a42=_0x5cd1e9?_0x38c495['count']:_0x3b4c9d['offset']+_0x3b4c9d[_0xa7dd('0x1e')];var _0x282cfb;if(_0x558a42>=_0x25ebaf){_0x558a42=_0x25ebaf;_0x282cfb=0xc8;}else{_0x282cfb=0xce;}_0x180806[_0xa7dd('0x1a')](_0x282cfb);return _0x180806[_0xa7dd('0x20')]('Content-Range',_0x5cf461+'-'+_0x558a42+'/'+_0x25ebaf)[_0xa7dd('0x1c')](_0x38c495);}return null;};}function patchUpdates(_0x3e52c3){return function(_0x330e75){try{jsonpatch[_0xa7dd('0x21')](_0x330e75,_0x3e52c3,!![]);}catch(_0x3708e7){return BPromise[_0xa7dd('0x22')](_0x3708e7);}return _0x330e75['save']();};}function saveUpdates(_0x2656dd,_0x7bb075){return function(_0x4ddb34){if(_0x4ddb34){return _0x4ddb34[_0xa7dd('0x23')](_0x2656dd)[_0xa7dd('0x24')](function(_0xb51dcd){return _0xb51dcd;});}return null;};}function removeEntity(_0x23f948,_0x3a092f){return function(_0x223bcf){if(_0x223bcf){return _0x223bcf['destroy']()[_0xa7dd('0x24')](function(){_0x23f948[_0xa7dd('0x1a')](0xcc)[_0xa7dd('0x1b')]();});}};}function handleEntityNotFound(_0x4664c6,_0x3ff226){return function(_0x13807b){if(!_0x13807b){_0x4664c6[_0xa7dd('0x19')](0x194);}return _0x13807b;};}function handleError(_0x5dbcb5,_0x49ccc5){_0x49ccc5=_0x49ccc5||0x1f4;return function(_0x514aa4){logger[_0xa7dd('0x25')](_0x514aa4[_0xa7dd('0x26')]);if(_0x514aa4[_0xa7dd('0x27')]){delete _0x514aa4[_0xa7dd('0x27')];}_0x5dbcb5[_0xa7dd('0x1a')](_0x49ccc5)[_0xa7dd('0x28')](_0x514aa4);};}exports[_0xa7dd('0x29')]=function(_0x51e886,_0x1ab9ce){var _0xd06296={},_0x2e27a0={},_0x9a2271={'count':0x0,'rows':[]};var _0x53d0cc=_['map'](db[_0xa7dd('0x2a')]['rawAttributes'],function(_0x3bffbe){return{'name':_0x3bffbe[_0xa7dd('0x2b')],'type':_0x3bffbe['type'][_0xa7dd('0x2c')]};});_0x2e27a0['model']=_[_0xa7dd('0x2d')](_0x53d0cc,_0xa7dd('0x27'));_0x2e27a0['query']=_[_0xa7dd('0x2e')](_0x51e886[_0xa7dd('0x2f')]);_0x2e27a0[_0xa7dd('0x30')]=_[_0xa7dd('0x31')](_0x2e27a0['model'],_0x2e27a0[_0xa7dd('0x2f')]);_0xd06296['attributes']=_[_0xa7dd('0x31')](_0x2e27a0['model'],qs[_0xa7dd('0x32')](_0x51e886[_0xa7dd('0x2f')][_0xa7dd('0x32')]));_0xd06296[_0xa7dd('0x33')]=_0xd06296[_0xa7dd('0x33')][_0xa7dd('0x34')]?_0xd06296['attributes']:_0x2e27a0[_0xa7dd('0x35')];if(!_0x51e886[_0xa7dd('0x2f')][_0xa7dd('0x36')](_0xa7dd('0x37'))){_0xd06296['limit']=qs[_0xa7dd('0x1e')](_0x51e886[_0xa7dd('0x2f')][_0xa7dd('0x1e')]);_0xd06296[_0xa7dd('0x1d')]=qs['offset'](_0x51e886[_0xa7dd('0x2f')][_0xa7dd('0x1d')]);}_0xd06296['order']=qs[_0xa7dd('0x38')](_0x51e886['query'][_0xa7dd('0x38')]);_0xd06296[_0xa7dd('0x39')]=qs['filters'](_[_0xa7dd('0x3a')](_0x51e886[_0xa7dd('0x2f')],_0x2e27a0[_0xa7dd('0x30')]),_0x53d0cc);if(_0x51e886[_0xa7dd('0x2f')][_0xa7dd('0x3b')]){_0xd06296[_0xa7dd('0x39')]=_[_0xa7dd('0x3c')](_0xd06296['where'],{'$or':_[_0xa7dd('0x2d')](_0x53d0cc,function(_0x2b772d){if(_0x2b772d[_0xa7dd('0x3d')]!=='VIRTUAL'){var _0x1f46b9={};_0x1f46b9[_0x2b772d[_0xa7dd('0x27')]]={'$like':'%'+_0x51e886[_0xa7dd('0x2f')][_0xa7dd('0x3b')]+'%'};return _0x1f46b9;}})});}_0xd06296=_[_0xa7dd('0x3c')]({},_0xd06296,_0x51e886[_0xa7dd('0x3e')]);var _0x2d1fab={'where':_0xd06296[_0xa7dd('0x39')]};return db[_0xa7dd('0x2a')]['count'](_0x2d1fab)['then'](function(_0x55a452){_0x9a2271[_0xa7dd('0x3f')]=_0x55a452;if(_0x51e886[_0xa7dd('0x2f')][_0xa7dd('0x40')]){_0xd06296['include']=[{'all':!![]}];}return db[_0xa7dd('0x2a')][_0xa7dd('0x41')](_0xd06296);})[_0xa7dd('0x24')](function(_0x1d5c80){_0x9a2271[_0xa7dd('0x42')]=_0x1d5c80;return _0x9a2271;})['then'](respondWithFilteredResult(_0x1ab9ce,_0xd06296))[_0xa7dd('0x43')](handleError(_0x1ab9ce,null));};exports[_0xa7dd('0x44')]=function(_0x260bb1,_0x26591a){var _0x1b5e7e={'raw':![],'where':{'id':_0x260bb1[_0xa7dd('0x45')]['id']}},_0xcae7fd={};_0xcae7fd[_0xa7dd('0x35')]=_[_0xa7dd('0x2e')](db[_0xa7dd('0x2a')][_0xa7dd('0x46')]);_0xcae7fd['query']=_[_0xa7dd('0x2e')](_0x260bb1[_0xa7dd('0x2f')]);_0xcae7fd['filters']=_['intersection'](_0xcae7fd[_0xa7dd('0x35')],_0xcae7fd[_0xa7dd('0x2f')]);_0x1b5e7e[_0xa7dd('0x33')]=_[_0xa7dd('0x31')](_0xcae7fd['model'],qs[_0xa7dd('0x32')](_0x260bb1[_0xa7dd('0x2f')][_0xa7dd('0x32')]));_0x1b5e7e[_0xa7dd('0x33')]=_0x1b5e7e[_0xa7dd('0x33')][_0xa7dd('0x34')]?_0x1b5e7e[_0xa7dd('0x33')]:_0xcae7fd['model'];if(_0x260bb1[_0xa7dd('0x2f')][_0xa7dd('0x40')]){_0x1b5e7e[_0xa7dd('0x47')]=[{'all':!![]}];}_0x1b5e7e=_['merge']({},_0x1b5e7e,_0x260bb1[_0xa7dd('0x3e')]);return db[_0xa7dd('0x2a')][_0xa7dd('0x48')](_0x1b5e7e)[_0xa7dd('0x24')](handleEntityNotFound(_0x26591a,null))[_0xa7dd('0x24')](respondWithResult(_0x26591a,null))['catch'](handleError(_0x26591a,null));};exports[_0xa7dd('0x49')]=function(_0x2f3ba9,_0x4b6761){return db[_0xa7dd('0x2a')][_0xa7dd('0x49')](_0x2f3ba9[_0xa7dd('0x4a')],{})[_0xa7dd('0x24')](respondWithResult(_0x4b6761,0xc9))[_0xa7dd('0x43')](handleError(_0x4b6761,null));};exports[_0xa7dd('0x23')]=function(_0x2d51b9,_0x47ae17){if(_0x2d51b9[_0xa7dd('0x4a')]['id']){delete _0x2d51b9[_0xa7dd('0x4a')]['id'];}return db[_0xa7dd('0x2a')][_0xa7dd('0x48')]({'where':{'id':_0x2d51b9[_0xa7dd('0x45')]['id']}})[_0xa7dd('0x24')](handleEntityNotFound(_0x47ae17,null))[_0xa7dd('0x24')](saveUpdates(_0x2d51b9[_0xa7dd('0x4a')],null))[_0xa7dd('0x24')](respondWithResult(_0x47ae17,null))['catch'](handleError(_0x47ae17,null));};exports[_0xa7dd('0x4b')]=function(_0x469593,_0x2977cc){return db[_0xa7dd('0x2a')][_0xa7dd('0x48')]({'where':{'id':_0x469593[_0xa7dd('0x45')]['id']}})[_0xa7dd('0x24')](handleEntityNotFound(_0x2977cc,null))[_0xa7dd('0x24')](removeEntity(_0x2977cc,null))[_0xa7dd('0x43')](handleError(_0x2977cc,null));};exports[_0xa7dd('0x4c')]=function(_0x5efb2b,_0x5c7a53,_0x1118ac){var _0x43e69e={};var _0x161ad7={};var _0x145ffd;var _0x3bffe8;return db[_0xa7dd('0x2a')]['findOne']({'where':{'id':_0x5efb2b['params']['id']}})[_0xa7dd('0x24')](handleEntityNotFound(_0x5c7a53,null))[_0xa7dd('0x24')](function(_0x2b6ea5){if(_0x2b6ea5){_0x145ffd=_0x2b6ea5;_0x161ad7[_0xa7dd('0x35')]=_[_0xa7dd('0x2e')](db[_0xa7dd('0x4d')][_0xa7dd('0x46')]);_0x161ad7[_0xa7dd('0x2f')]=_['keys'](_0x5efb2b['query']);_0x161ad7[_0xa7dd('0x30')]=_[_0xa7dd('0x31')](_0x161ad7[_0xa7dd('0x35')],_0x161ad7['query']);_0x43e69e[_0xa7dd('0x33')]=_[_0xa7dd('0x31')](_0x161ad7[_0xa7dd('0x35')],qs['fields'](_0x5efb2b[_0xa7dd('0x2f')][_0xa7dd('0x32')]));_0x43e69e[_0xa7dd('0x33')]=_0x43e69e[_0xa7dd('0x33')][_0xa7dd('0x34')]?_0x43e69e[_0xa7dd('0x33')]:_0x161ad7[_0xa7dd('0x35')];_0x43e69e[_0xa7dd('0x4e')]=qs[_0xa7dd('0x38')](_0x5efb2b['query'][_0xa7dd('0x38')]);_0x43e69e[_0xa7dd('0x39')]=qs[_0xa7dd('0x30')](_[_0xa7dd('0x3a')](_0x5efb2b[_0xa7dd('0x2f')],_0x161ad7[_0xa7dd('0x30')]));if(_0x5efb2b['query']['filter']){_0x43e69e[_0xa7dd('0x39')]=_[_0xa7dd('0x3c')](_0x43e69e[_0xa7dd('0x39')],{'$or':_[_0xa7dd('0x2d')](_0x43e69e[_0xa7dd('0x33')],function(_0x12bf76){var _0x2e32b4={};_0x2e32b4[_0x12bf76]={'$like':'%'+_0x5efb2b['query'][_0xa7dd('0x3b')]+'%'};return _0x2e32b4;})});}_0x43e69e=_[_0xa7dd('0x3c')]({},_0x43e69e,_0x5efb2b[_0xa7dd('0x3e')]);return _0x145ffd['getFields'](_0x43e69e);}})['then'](function(_0x5145f6){if(_0x5145f6){_0x3bffe8=_0x5145f6['length'];if(!_0x5efb2b[_0xa7dd('0x2f')][_0xa7dd('0x36')](_0xa7dd('0x37'))){_0x43e69e[_0xa7dd('0x1e')]=qs[_0xa7dd('0x1e')](_0x5efb2b[_0xa7dd('0x2f')][_0xa7dd('0x1e')]);_0x43e69e[_0xa7dd('0x1d')]=qs['offset'](_0x5efb2b[_0xa7dd('0x2f')][_0xa7dd('0x1d')]);}return _0x145ffd[_0xa7dd('0x4c')](_0x43e69e);}})[_0xa7dd('0x24')](function(_0x452685){if(_0x452685){return _0x452685?{'count':_0x3bffe8,'rows':_0x452685}:null;}})[_0xa7dd('0x24')](respondWithResult(_0x5c7a53,null))['catch'](handleError(_0x5c7a53,null));};exports[_0xa7dd('0x4f')]=function(_0x5d7ed6,_0x466be9,_0x23308a){var _0x4199a0={};var _0x2f0173={};var _0x14fd61;var _0x57a45c;return db[_0xa7dd('0x2a')]['findOne']({'where':{'id':_0x5d7ed6[_0xa7dd('0x45')]['id']}})[_0xa7dd('0x24')](handleEntityNotFound(_0x466be9,null))[_0xa7dd('0x24')](function(_0x523eba){if(_0x523eba){_0x14fd61=_0x523eba;_0x2f0173[_0xa7dd('0x35')]=_['keys'](db[_0xa7dd('0x4d')]['rawAttributes']);_0x2f0173['query']=_[_0xa7dd('0x2e')](_0x5d7ed6[_0xa7dd('0x2f')]);_0x2f0173[_0xa7dd('0x30')]=_[_0xa7dd('0x31')](_0x2f0173[_0xa7dd('0x35')],_0x2f0173[_0xa7dd('0x2f')]);_0x4199a0[_0xa7dd('0x33')]=_[_0xa7dd('0x31')](_0x2f0173[_0xa7dd('0x35')],qs[_0xa7dd('0x32')](_0x5d7ed6[_0xa7dd('0x2f')][_0xa7dd('0x32')]));_0x4199a0[_0xa7dd('0x33')]=_0x4199a0[_0xa7dd('0x33')][_0xa7dd('0x34')]?_0x4199a0['attributes']:_0x2f0173[_0xa7dd('0x35')];_0x4199a0[_0xa7dd('0x4e')]=qs[_0xa7dd('0x38')](_0x5d7ed6['query'][_0xa7dd('0x38')]);_0x4199a0[_0xa7dd('0x39')]=qs[_0xa7dd('0x30')](_[_0xa7dd('0x3a')](_0x5d7ed6[_0xa7dd('0x2f')],_0x2f0173[_0xa7dd('0x30')]));if(_0x5d7ed6['query']['filter']){_0x4199a0[_0xa7dd('0x39')]=_[_0xa7dd('0x3c')](_0x4199a0[_0xa7dd('0x39')],{'$or':_[_0xa7dd('0x2d')](_0x4199a0['attributes'],function(_0x81a11f){var _0x20a500={};_0x20a500[_0x81a11f]={'$like':'%'+_0x5d7ed6[_0xa7dd('0x2f')][_0xa7dd('0x3b')]+'%'};return _0x20a500;})});}_0x4199a0=_[_0xa7dd('0x3c')]({},_0x4199a0,_0x5d7ed6[_0xa7dd('0x3e')]);return _0x14fd61[_0xa7dd('0x4f')](_0x4199a0);}})['then'](function(_0x1f6a0d){if(_0x1f6a0d){_0x57a45c=_0x1f6a0d[_0xa7dd('0x34')];if(!_0x5d7ed6['query'][_0xa7dd('0x36')](_0xa7dd('0x37'))){_0x4199a0['limit']=qs[_0xa7dd('0x1e')](_0x5d7ed6[_0xa7dd('0x2f')]['limit']);_0x4199a0[_0xa7dd('0x1d')]=qs[_0xa7dd('0x1d')](_0x5d7ed6['query'][_0xa7dd('0x1d')]);}return _0x14fd61['getSubjects'](_0x4199a0);}})['then'](function(_0x31ef1a){if(_0x31ef1a){return _0x31ef1a?{'count':_0x57a45c,'rows':_0x31ef1a}:null;}})['then'](respondWithResult(_0x466be9,null))[_0xa7dd('0x43')](handleError(_0x466be9,null));};exports['getDescriptions']=function(_0x57d978,_0x5ba97e,_0x44ea1d){var _0x1a40ab={};var _0x43a4c3={};var _0x2089b3;var _0x3086e2;return db['ZohoConfiguration'][_0xa7dd('0x50')]({'where':{'id':_0x57d978[_0xa7dd('0x45')]['id']}})[_0xa7dd('0x24')](handleEntityNotFound(_0x5ba97e,null))[_0xa7dd('0x24')](function(_0x832459){if(_0x832459){_0x2089b3=_0x832459;_0x43a4c3[_0xa7dd('0x35')]=_[_0xa7dd('0x2e')](db[_0xa7dd('0x4d')][_0xa7dd('0x46')]);_0x43a4c3[_0xa7dd('0x2f')]=_[_0xa7dd('0x2e')](_0x57d978[_0xa7dd('0x2f')]);_0x43a4c3[_0xa7dd('0x30')]=_['intersection'](_0x43a4c3[_0xa7dd('0x35')],_0x43a4c3['query']);_0x1a40ab[_0xa7dd('0x33')]=_['intersection'](_0x43a4c3[_0xa7dd('0x35')],qs[_0xa7dd('0x32')](_0x57d978[_0xa7dd('0x2f')][_0xa7dd('0x32')]));_0x1a40ab[_0xa7dd('0x33')]=_0x1a40ab[_0xa7dd('0x33')][_0xa7dd('0x34')]?_0x1a40ab['attributes']:_0x43a4c3[_0xa7dd('0x35')];_0x1a40ab[_0xa7dd('0x4e')]=qs[_0xa7dd('0x38')](_0x57d978[_0xa7dd('0x2f')][_0xa7dd('0x38')]);_0x1a40ab[_0xa7dd('0x39')]=qs[_0xa7dd('0x30')](_['pick'](_0x57d978[_0xa7dd('0x2f')],_0x43a4c3['filters']));if(_0x57d978[_0xa7dd('0x2f')][_0xa7dd('0x3b')]){_0x1a40ab[_0xa7dd('0x39')]=_[_0xa7dd('0x3c')](_0x1a40ab[_0xa7dd('0x39')],{'$or':_[_0xa7dd('0x2d')](_0x1a40ab[_0xa7dd('0x33')],function(_0x58ae77){var _0x3d415b={};_0x3d415b[_0x58ae77]={'$like':'%'+_0x57d978[_0xa7dd('0x2f')][_0xa7dd('0x3b')]+'%'};return _0x3d415b;})});}_0x1a40ab=_[_0xa7dd('0x3c')]({},_0x1a40ab,_0x57d978[_0xa7dd('0x3e')]);return _0x2089b3['getDescriptions'](_0x1a40ab);}})[_0xa7dd('0x24')](function(_0xcf8501){if(_0xcf8501){_0x3086e2=_0xcf8501[_0xa7dd('0x34')];if(!_0x57d978[_0xa7dd('0x2f')][_0xa7dd('0x36')](_0xa7dd('0x37'))){_0x1a40ab[_0xa7dd('0x1e')]=qs['limit'](_0x57d978[_0xa7dd('0x2f')][_0xa7dd('0x1e')]);_0x1a40ab[_0xa7dd('0x1d')]=qs[_0xa7dd('0x1d')](_0x57d978[_0xa7dd('0x2f')][_0xa7dd('0x1d')]);}return _0x2089b3[_0xa7dd('0x51')](_0x1a40ab);}})['then'](function(_0x1fcacd){if(_0x1fcacd){return _0x1fcacd?{'count':_0x3086e2,'rows':_0x1fcacd}:null;}})[_0xa7dd('0x24')](respondWithResult(_0x5ba97e,null))[_0xa7dd('0x43')](handleError(_0x5ba97e,null));}; \ No newline at end of file +var _0xc9e3=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','limit','count','set','apply','reject','save','update','then','error','stack','name','send','map','ZohoConfiguration','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','catch','params','keys','includeAll','include','find','create','body','destroy','getFields','getSubjects','findOne','ZohoField','getDescriptions','eml-format','rimraf'];(function(_0x29abe4,_0xffec54){var _0x5bae3b=function(_0xad4366){while(--_0xad4366){_0x29abe4['push'](_0x29abe4['shift']());}};_0x5bae3b(++_0xffec54);}(_0xc9e3,0x98));var _0x3c9e=function(_0x54c6d8,_0x346092){_0x54c6d8=_0x54c6d8-0x0;var _0xe335bb=_0xc9e3[_0x54c6d8];return _0xe335bb;};'use strict';var emlformat=require(_0x3c9e('0x0'));var rimraf=require(_0x3c9e('0x1'));var zipdir=require(_0x3c9e('0x2'));var jsonpatch=require(_0x3c9e('0x3'));var rp=require(_0x3c9e('0x4'));var moment=require(_0x3c9e('0x5'));var BPromise=require(_0x3c9e('0x6'));var Mustache=require('mustache');var util=require(_0x3c9e('0x7'));var path=require(_0x3c9e('0x8'));var sox=require(_0x3c9e('0x9'));var csv=require(_0x3c9e('0xa'));var ejs=require(_0x3c9e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3c9e('0xc'));var squel=require(_0x3c9e('0xd'));var crypto=require('crypto');var jsforce=require(_0x3c9e('0xe'));var deskjs=require(_0x3c9e('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3c9e('0x10'));var Papa=require(_0x3c9e('0x11'));var Redis=require('ioredis');var authService=require(_0x3c9e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3c9e('0x13'));var hardwareService=require(_0x3c9e('0x14'));var logger=require('../../config/logger')(_0x3c9e('0x15'));var utils=require(_0x3c9e('0x16'));var config=require(_0x3c9e('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46c74f,_0x42e00b){_0x42e00b=_0x42e00b||0xcc;return function(_0x5152da){if(_0x5152da){return _0x46c74f[_0x3c9e('0x18')](_0x42e00b);}return _0x46c74f['status'](_0x42e00b)[_0x3c9e('0x19')]();};}function respondWithResult(_0x399fa5,_0x4dfc5d){_0x4dfc5d=_0x4dfc5d||0xc8;return function(_0x5de3e7){if(_0x5de3e7){return _0x399fa5[_0x3c9e('0x1a')](_0x4dfc5d)[_0x3c9e('0x1b')](_0x5de3e7);}};}function respondWithFilteredResult(_0x24767a,_0x49e922){return function(_0x36aae4){if(_0x36aae4){var _0x2c69d9=typeof _0x49e922[_0x3c9e('0x1c')]==='undefined'&&typeof _0x49e922[_0x3c9e('0x1d')]==='undefined';var _0x25eb31=_0x36aae4[_0x3c9e('0x1e')];var _0x9d445c=_0x2c69d9?0x0:_0x49e922[_0x3c9e('0x1c')];var _0x49bddc=_0x2c69d9?_0x36aae4[_0x3c9e('0x1e')]:_0x49e922[_0x3c9e('0x1c')]+_0x49e922['limit'];var _0x47f9eb;if(_0x49bddc>=_0x25eb31){_0x49bddc=_0x25eb31;_0x47f9eb=0xc8;}else{_0x47f9eb=0xce;}_0x24767a['status'](_0x47f9eb);return _0x24767a[_0x3c9e('0x1f')]('Content-Range',_0x9d445c+'-'+_0x49bddc+'/'+_0x25eb31)['json'](_0x36aae4);}return null;};}function patchUpdates(_0x3032ec){return function(_0x109fc7){try{jsonpatch[_0x3c9e('0x20')](_0x109fc7,_0x3032ec,!![]);}catch(_0x72b806){return BPromise[_0x3c9e('0x21')](_0x72b806);}return _0x109fc7[_0x3c9e('0x22')]();};}function saveUpdates(_0x1906a3,_0x1ebcc3){return function(_0x27341f){if(_0x27341f){return _0x27341f[_0x3c9e('0x23')](_0x1906a3)[_0x3c9e('0x24')](function(_0x226a93){return _0x226a93;});}return null;};}function removeEntity(_0x411707,_0x5b5cf2){return function(_0x536f82){if(_0x536f82){return _0x536f82['destroy']()[_0x3c9e('0x24')](function(){_0x411707['status'](0xcc)[_0x3c9e('0x19')]();});}};}function handleEntityNotFound(_0xc9ecb4,_0x56fbca){return function(_0x4bf051){if(!_0x4bf051){_0xc9ecb4[_0x3c9e('0x18')](0x194);}return _0x4bf051;};}function handleError(_0x13dd35,_0x53d50f){_0x53d50f=_0x53d50f||0x1f4;return function(_0x50e288){logger[_0x3c9e('0x25')](_0x50e288[_0x3c9e('0x26')]);if(_0x50e288[_0x3c9e('0x27')]){delete _0x50e288[_0x3c9e('0x27')];}_0x13dd35[_0x3c9e('0x1a')](_0x53d50f)[_0x3c9e('0x28')](_0x50e288);};}exports['index']=function(_0x28ed8c,_0x2e28e8){var _0x2eed25={},_0x104567={},_0x5e4845={'count':0x0,'rows':[]};var _0x3e18f3=_[_0x3c9e('0x29')](db[_0x3c9e('0x2a')][_0x3c9e('0x2b')],function(_0x444f7c){return{'name':_0x444f7c[_0x3c9e('0x2c')],'type':_0x444f7c[_0x3c9e('0x2d')]['key']};});_0x104567[_0x3c9e('0x2e')]=_[_0x3c9e('0x29')](_0x3e18f3,_0x3c9e('0x27'));_0x104567[_0x3c9e('0x2f')]=_['keys'](_0x28ed8c['query']);_0x104567[_0x3c9e('0x30')]=_[_0x3c9e('0x31')](_0x104567[_0x3c9e('0x2e')],_0x104567[_0x3c9e('0x2f')]);_0x2eed25[_0x3c9e('0x32')]=_[_0x3c9e('0x31')](_0x104567[_0x3c9e('0x2e')],qs[_0x3c9e('0x33')](_0x28ed8c[_0x3c9e('0x2f')][_0x3c9e('0x33')]));_0x2eed25[_0x3c9e('0x32')]=_0x2eed25[_0x3c9e('0x32')][_0x3c9e('0x34')]?_0x2eed25[_0x3c9e('0x32')]:_0x104567[_0x3c9e('0x2e')];if(!_0x28ed8c['query'][_0x3c9e('0x35')](_0x3c9e('0x36'))){_0x2eed25[_0x3c9e('0x1d')]=qs[_0x3c9e('0x1d')](_0x28ed8c[_0x3c9e('0x2f')][_0x3c9e('0x1d')]);_0x2eed25['offset']=qs[_0x3c9e('0x1c')](_0x28ed8c[_0x3c9e('0x2f')]['offset']);}_0x2eed25[_0x3c9e('0x37')]=qs[_0x3c9e('0x38')](_0x28ed8c[_0x3c9e('0x2f')][_0x3c9e('0x38')]);_0x2eed25[_0x3c9e('0x39')]=qs[_0x3c9e('0x30')](_[_0x3c9e('0x3a')](_0x28ed8c[_0x3c9e('0x2f')],_0x104567[_0x3c9e('0x30')]),_0x3e18f3);if(_0x28ed8c[_0x3c9e('0x2f')][_0x3c9e('0x3b')]){_0x2eed25[_0x3c9e('0x39')]=_['merge'](_0x2eed25[_0x3c9e('0x39')],{'$or':_[_0x3c9e('0x29')](_0x3e18f3,function(_0xfb80a5){if(_0xfb80a5['type']!==_0x3c9e('0x3c')){var _0x58a11f={};_0x58a11f[_0xfb80a5[_0x3c9e('0x27')]]={'$like':'%'+_0x28ed8c[_0x3c9e('0x2f')]['filter']+'%'};return _0x58a11f;}})});}_0x2eed25=_[_0x3c9e('0x3d')]({},_0x2eed25,_0x28ed8c[_0x3c9e('0x3e')]);var _0x2a3d02={'where':_0x2eed25[_0x3c9e('0x39')]};return db[_0x3c9e('0x2a')]['count'](_0x2a3d02)['then'](function(_0x34b5da){_0x5e4845[_0x3c9e('0x1e')]=_0x34b5da;if(_0x28ed8c[_0x3c9e('0x2f')]['includeAll']){_0x2eed25['include']=[{'all':!![]}];}return db['ZohoConfiguration']['findAll'](_0x2eed25);})['then'](function(_0x4d62fc){_0x5e4845['rows']=_0x4d62fc;return _0x5e4845;})[_0x3c9e('0x24')](respondWithFilteredResult(_0x2e28e8,_0x2eed25))[_0x3c9e('0x3f')](handleError(_0x2e28e8,null));};exports['show']=function(_0x1020e2,_0x40d93a){var _0x58bc74={'raw':![],'where':{'id':_0x1020e2[_0x3c9e('0x40')]['id']}},_0x8d4a58={};_0x8d4a58[_0x3c9e('0x2e')]=_[_0x3c9e('0x41')](db[_0x3c9e('0x2a')][_0x3c9e('0x2b')]);_0x8d4a58[_0x3c9e('0x2f')]=_[_0x3c9e('0x41')](_0x1020e2[_0x3c9e('0x2f')]);_0x8d4a58[_0x3c9e('0x30')]=_[_0x3c9e('0x31')](_0x8d4a58[_0x3c9e('0x2e')],_0x8d4a58[_0x3c9e('0x2f')]);_0x58bc74[_0x3c9e('0x32')]=_[_0x3c9e('0x31')](_0x8d4a58[_0x3c9e('0x2e')],qs[_0x3c9e('0x33')](_0x1020e2[_0x3c9e('0x2f')]['fields']));_0x58bc74[_0x3c9e('0x32')]=_0x58bc74[_0x3c9e('0x32')][_0x3c9e('0x34')]?_0x58bc74[_0x3c9e('0x32')]:_0x8d4a58[_0x3c9e('0x2e')];if(_0x1020e2[_0x3c9e('0x2f')][_0x3c9e('0x42')]){_0x58bc74[_0x3c9e('0x43')]=[{'all':!![]}];}_0x58bc74=_[_0x3c9e('0x3d')]({},_0x58bc74,_0x1020e2['options']);return db['ZohoConfiguration'][_0x3c9e('0x44')](_0x58bc74)[_0x3c9e('0x24')](handleEntityNotFound(_0x40d93a,null))[_0x3c9e('0x24')](respondWithResult(_0x40d93a,null))[_0x3c9e('0x3f')](handleError(_0x40d93a,null));};exports[_0x3c9e('0x45')]=function(_0x37425a,_0x5a4288){return db[_0x3c9e('0x2a')]['create'](_0x37425a['body'],{})[_0x3c9e('0x24')](respondWithResult(_0x5a4288,0xc9))['catch'](handleError(_0x5a4288,null));};exports['update']=function(_0x12a9e8,_0x202bb0){if(_0x12a9e8[_0x3c9e('0x46')]['id']){delete _0x12a9e8[_0x3c9e('0x46')]['id'];}return db[_0x3c9e('0x2a')][_0x3c9e('0x44')]({'where':{'id':_0x12a9e8[_0x3c9e('0x40')]['id']}})[_0x3c9e('0x24')](handleEntityNotFound(_0x202bb0,null))[_0x3c9e('0x24')](saveUpdates(_0x12a9e8['body'],null))['then'](respondWithResult(_0x202bb0,null))[_0x3c9e('0x3f')](handleError(_0x202bb0,null));};exports[_0x3c9e('0x47')]=function(_0x233b05,_0x318203){return db['ZohoConfiguration']['find']({'where':{'id':_0x233b05[_0x3c9e('0x40')]['id']}})[_0x3c9e('0x24')](handleEntityNotFound(_0x318203,null))[_0x3c9e('0x24')](removeEntity(_0x318203,null))[_0x3c9e('0x3f')](handleError(_0x318203,null));};exports[_0x3c9e('0x48')]=function(_0x14f7d4,_0x1e45b3,_0x2c8caa){var _0x1346f5={};var _0x30a122={};var _0x11f1a7;var _0x357275;return db[_0x3c9e('0x2a')]['findOne']({'where':{'id':_0x14f7d4['params']['id']}})[_0x3c9e('0x24')](handleEntityNotFound(_0x1e45b3,null))[_0x3c9e('0x24')](function(_0x15e9bb){if(_0x15e9bb){_0x11f1a7=_0x15e9bb;_0x30a122[_0x3c9e('0x2e')]=_['keys'](db['ZohoField']['rawAttributes']);_0x30a122[_0x3c9e('0x2f')]=_['keys'](_0x14f7d4[_0x3c9e('0x2f')]);_0x30a122['filters']=_[_0x3c9e('0x31')](_0x30a122[_0x3c9e('0x2e')],_0x30a122[_0x3c9e('0x2f')]);_0x1346f5[_0x3c9e('0x32')]=_[_0x3c9e('0x31')](_0x30a122[_0x3c9e('0x2e')],qs[_0x3c9e('0x33')](_0x14f7d4[_0x3c9e('0x2f')][_0x3c9e('0x33')]));_0x1346f5[_0x3c9e('0x32')]=_0x1346f5[_0x3c9e('0x32')][_0x3c9e('0x34')]?_0x1346f5[_0x3c9e('0x32')]:_0x30a122['model'];_0x1346f5['order']=qs[_0x3c9e('0x38')](_0x14f7d4[_0x3c9e('0x2f')][_0x3c9e('0x38')]);_0x1346f5['where']=qs['filters'](_[_0x3c9e('0x3a')](_0x14f7d4[_0x3c9e('0x2f')],_0x30a122['filters']));if(_0x14f7d4[_0x3c9e('0x2f')]['filter']){_0x1346f5[_0x3c9e('0x39')]=_[_0x3c9e('0x3d')](_0x1346f5[_0x3c9e('0x39')],{'$or':_['map'](_0x1346f5[_0x3c9e('0x32')],function(_0x3d453a){var _0x51b4bf={};_0x51b4bf[_0x3d453a]={'$like':'%'+_0x14f7d4[_0x3c9e('0x2f')][_0x3c9e('0x3b')]+'%'};return _0x51b4bf;})});}_0x1346f5=_[_0x3c9e('0x3d')]({},_0x1346f5,_0x14f7d4[_0x3c9e('0x3e')]);return _0x11f1a7[_0x3c9e('0x48')](_0x1346f5);}})[_0x3c9e('0x24')](function(_0x3555b4){if(_0x3555b4){_0x357275=_0x3555b4[_0x3c9e('0x34')];if(!_0x14f7d4['query'][_0x3c9e('0x35')](_0x3c9e('0x36'))){_0x1346f5[_0x3c9e('0x1d')]=qs['limit'](_0x14f7d4[_0x3c9e('0x2f')]['limit']);_0x1346f5[_0x3c9e('0x1c')]=qs['offset'](_0x14f7d4['query'][_0x3c9e('0x1c')]);}return _0x11f1a7[_0x3c9e('0x48')](_0x1346f5);}})[_0x3c9e('0x24')](function(_0x16b558){if(_0x16b558){return _0x16b558?{'count':_0x357275,'rows':_0x16b558}:null;}})[_0x3c9e('0x24')](respondWithResult(_0x1e45b3,null))[_0x3c9e('0x3f')](handleError(_0x1e45b3,null));};exports[_0x3c9e('0x49')]=function(_0x582b67,_0x599752,_0x5b4073){var _0x211402={};var _0x59e3b3={};var _0x30a360;var _0x247e62;return db[_0x3c9e('0x2a')]['findOne']({'where':{'id':_0x582b67[_0x3c9e('0x40')]['id']}})[_0x3c9e('0x24')](handleEntityNotFound(_0x599752,null))[_0x3c9e('0x24')](function(_0x79fe32){if(_0x79fe32){_0x30a360=_0x79fe32;_0x59e3b3[_0x3c9e('0x2e')]=_['keys'](db['ZohoField'][_0x3c9e('0x2b')]);_0x59e3b3['query']=_[_0x3c9e('0x41')](_0x582b67[_0x3c9e('0x2f')]);_0x59e3b3[_0x3c9e('0x30')]=_[_0x3c9e('0x31')](_0x59e3b3['model'],_0x59e3b3[_0x3c9e('0x2f')]);_0x211402[_0x3c9e('0x32')]=_[_0x3c9e('0x31')](_0x59e3b3[_0x3c9e('0x2e')],qs[_0x3c9e('0x33')](_0x582b67[_0x3c9e('0x2f')][_0x3c9e('0x33')]));_0x211402[_0x3c9e('0x32')]=_0x211402['attributes'][_0x3c9e('0x34')]?_0x211402[_0x3c9e('0x32')]:_0x59e3b3[_0x3c9e('0x2e')];_0x211402['order']=qs[_0x3c9e('0x38')](_0x582b67[_0x3c9e('0x2f')][_0x3c9e('0x38')]);_0x211402[_0x3c9e('0x39')]=qs[_0x3c9e('0x30')](_[_0x3c9e('0x3a')](_0x582b67['query'],_0x59e3b3[_0x3c9e('0x30')]));if(_0x582b67[_0x3c9e('0x2f')][_0x3c9e('0x3b')]){_0x211402[_0x3c9e('0x39')]=_[_0x3c9e('0x3d')](_0x211402['where'],{'$or':_[_0x3c9e('0x29')](_0x211402[_0x3c9e('0x32')],function(_0x45e96f){var _0xb001de={};_0xb001de[_0x45e96f]={'$like':'%'+_0x582b67[_0x3c9e('0x2f')][_0x3c9e('0x3b')]+'%'};return _0xb001de;})});}_0x211402=_[_0x3c9e('0x3d')]({},_0x211402,_0x582b67[_0x3c9e('0x3e')]);return _0x30a360[_0x3c9e('0x49')](_0x211402);}})[_0x3c9e('0x24')](function(_0xf44237){if(_0xf44237){_0x247e62=_0xf44237[_0x3c9e('0x34')];if(!_0x582b67[_0x3c9e('0x2f')][_0x3c9e('0x35')](_0x3c9e('0x36'))){_0x211402[_0x3c9e('0x1d')]=qs['limit'](_0x582b67[_0x3c9e('0x2f')][_0x3c9e('0x1d')]);_0x211402['offset']=qs['offset'](_0x582b67[_0x3c9e('0x2f')][_0x3c9e('0x1c')]);}return _0x30a360[_0x3c9e('0x49')](_0x211402);}})[_0x3c9e('0x24')](function(_0x19a5ea){if(_0x19a5ea){return _0x19a5ea?{'count':_0x247e62,'rows':_0x19a5ea}:null;}})[_0x3c9e('0x24')](respondWithResult(_0x599752,null))[_0x3c9e('0x3f')](handleError(_0x599752,null));};exports['getDescriptions']=function(_0xe03d88,_0x1f427a,_0x48deb5){var _0xd4058={};var _0x4c6781={};var _0x4a88fe;var _0x10fa70;return db[_0x3c9e('0x2a')][_0x3c9e('0x4a')]({'where':{'id':_0xe03d88[_0x3c9e('0x40')]['id']}})['then'](handleEntityNotFound(_0x1f427a,null))[_0x3c9e('0x24')](function(_0x281195){if(_0x281195){_0x4a88fe=_0x281195;_0x4c6781['model']=_[_0x3c9e('0x41')](db[_0x3c9e('0x4b')][_0x3c9e('0x2b')]);_0x4c6781[_0x3c9e('0x2f')]=_[_0x3c9e('0x41')](_0xe03d88['query']);_0x4c6781[_0x3c9e('0x30')]=_[_0x3c9e('0x31')](_0x4c6781[_0x3c9e('0x2e')],_0x4c6781[_0x3c9e('0x2f')]);_0xd4058[_0x3c9e('0x32')]=_[_0x3c9e('0x31')](_0x4c6781[_0x3c9e('0x2e')],qs[_0x3c9e('0x33')](_0xe03d88[_0x3c9e('0x2f')][_0x3c9e('0x33')]));_0xd4058[_0x3c9e('0x32')]=_0xd4058['attributes'][_0x3c9e('0x34')]?_0xd4058[_0x3c9e('0x32')]:_0x4c6781[_0x3c9e('0x2e')];_0xd4058[_0x3c9e('0x37')]=qs[_0x3c9e('0x38')](_0xe03d88[_0x3c9e('0x2f')][_0x3c9e('0x38')]);_0xd4058['where']=qs[_0x3c9e('0x30')](_[_0x3c9e('0x3a')](_0xe03d88['query'],_0x4c6781[_0x3c9e('0x30')]));if(_0xe03d88[_0x3c9e('0x2f')][_0x3c9e('0x3b')]){_0xd4058[_0x3c9e('0x39')]=_['merge'](_0xd4058[_0x3c9e('0x39')],{'$or':_[_0x3c9e('0x29')](_0xd4058[_0x3c9e('0x32')],function(_0xe0ef50){var _0x2ee995={};_0x2ee995[_0xe0ef50]={'$like':'%'+_0xe03d88[_0x3c9e('0x2f')][_0x3c9e('0x3b')]+'%'};return _0x2ee995;})});}_0xd4058=_[_0x3c9e('0x3d')]({},_0xd4058,_0xe03d88[_0x3c9e('0x3e')]);return _0x4a88fe[_0x3c9e('0x4c')](_0xd4058);}})[_0x3c9e('0x24')](function(_0xcdf969){if(_0xcdf969){_0x10fa70=_0xcdf969[_0x3c9e('0x34')];if(!_0xe03d88[_0x3c9e('0x2f')][_0x3c9e('0x35')](_0x3c9e('0x36'))){_0xd4058[_0x3c9e('0x1d')]=qs[_0x3c9e('0x1d')](_0xe03d88[_0x3c9e('0x2f')][_0x3c9e('0x1d')]);_0xd4058[_0x3c9e('0x1c')]=qs[_0x3c9e('0x1c')](_0xe03d88[_0x3c9e('0x2f')][_0x3c9e('0x1c')]);}return _0x4a88fe['getDescriptions'](_0xd4058);}})[_0x3c9e('0x24')](function(_0x52cb00){if(_0x52cb00){return _0x52cb00?{'count':_0x10fa70,'rows':_0x52cb00}:null;}})['then'](respondWithResult(_0x1f427a,null))[_0x3c9e('0x3f')](handleError(_0x1f427a,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index ee8addb..00e9c67 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 _0xef50=['int_zoho_configurations','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','define','ZohoConfiguration'];(function(_0x335c8f,_0x574dad){var _0x431a00=function(_0x37c51a){while(--_0x37c51a){_0x335c8f['push'](_0x335c8f['shift']());}};_0x431a00(++_0x574dad);}(_0xef50,0x1e1));var _0x0ef5=function(_0x33e4b3,_0x50ff13){_0x33e4b3=_0x33e4b3-0x0;var _0x35b852=_0xef50[_0x33e4b3];return _0x35b852;};'use strict';var _=require(_0x0ef5('0x0'));var util=require(_0x0ef5('0x1'));var logger=require(_0x0ef5('0x2'))('api');var moment=require(_0x0ef5('0x3'));var BPromise=require(_0x0ef5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0ef5('0x5'));var rimraf=require(_0x0ef5('0x6'));var config=require(_0x0ef5('0x7'));var attributes=require(_0x0ef5('0x8'));module['exports']=function(_0x44c651,_0x256edd){return _0x44c651[_0x0ef5('0x9')](_0x0ef5('0xa'),attributes,{'tableName':_0x0ef5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb778=['lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations'];(function(_0x411134,_0x3e39dc){var _0x3e4433=function(_0x43f557){while(--_0x43f557){_0x411134['push'](_0x411134['shift']());}};_0x3e4433(++_0x3e39dc);}(_0xb778,0x193));var _0x8b77=function(_0x77b525,_0xd4dc1e){_0x77b525=_0x77b525-0x0;var _0xa83673=_0xb778[_0x77b525];return _0xa83673;};'use strict';var _=require(_0x8b77('0x0'));var util=require(_0x8b77('0x1'));var logger=require(_0x8b77('0x2'))(_0x8b77('0x3'));var moment=require(_0x8b77('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8b77('0x5'));var rimraf=require(_0x8b77('0x6'));var config=require(_0x8b77('0x7'));var attributes=require(_0x8b77('0x8'));module[_0x8b77('0x9')]=function(_0x47a7cc,_0x57b26b){return _0x47a7cc[_0x8b77('0xa')](_0x8b77('0xb'),attributes,{'tableName':_0x8b77('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 6ef7a44..f3cc79c 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 _0x5cac=['then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x5cac,0x6e));var _0xc5ca=function(_0x18e0d5,_0x1f7f3a){_0x18e0d5=_0x18e0d5-0x0;var _0x3b00bb=_0x5cac[_0x18e0d5];return _0x3b00bb;};'use strict';var _=require(_0xc5ca('0x0'));var util=require(_0xc5ca('0x1'));var moment=require(_0xc5ca('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5ca('0x3'));var db=require(_0xc5ca('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc5ca('0x5'))(_0xc5ca('0x6'));var config=require(_0xc5ca('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc5ca('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14cc96,_0x2fa982,_0x27f4b2){return new BPromise(function(_0x8e80b0,_0x57e28f){return client[_0xc5ca('0x9')](_0x14cc96,_0x27f4b2)[_0xc5ca('0xa')](function(_0x41621e){logger[_0xc5ca('0xb')](_0xc5ca('0xc'),_0x2fa982,_0xc5ca('0xd'));logger[_0xc5ca('0xe')](_0xc5ca('0xf'),_0x2fa982,_0xc5ca('0xd'),JSON['stringify'](_0x41621e));if(_0x41621e[_0xc5ca('0x10')]){if(_0x41621e[_0xc5ca('0x10')][_0xc5ca('0x11')]===0x1f4){logger[_0xc5ca('0x10')](_0xc5ca('0xc'),_0x2fa982,_0x41621e['error']['message']);return _0x57e28f(_0x41621e[_0xc5ca('0x10')]['message']);}logger['error'](_0xc5ca('0xc'),_0x2fa982,_0x41621e[_0xc5ca('0x10')][_0xc5ca('0x12')]);return _0x8e80b0(_0x41621e[_0xc5ca('0x10')]['message']);}else{logger[_0xc5ca('0xb')](_0xc5ca('0xc'),_0x2fa982,'request\x20sent');_0x8e80b0(_0x41621e[_0xc5ca('0x13')][_0xc5ca('0x12')]);}})['catch'](function(_0x5e100e){logger['error'](_0xc5ca('0xc'),_0x2fa982,_0x5e100e);_0x57e28f(_0x5e100e);});});} \ No newline at end of file +var _0x6093=['then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x6093,0x182));var _0x3609=function(_0x4040a6,_0x49cbcd){_0x4040a6=_0x4040a6-0x0;var _0x55fd3f=_0x6093[_0x4040a6];return _0x55fd3f;};'use strict';var _=require('lodash');var util=require(_0x3609('0x0'));var moment=require('moment');var BPromise=require(_0x3609('0x1'));var rs=require(_0x3609('0x2'));var fs=require('fs');var Redis=require(_0x3609('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3609('0x4'));var logger=require(_0x3609('0x5'))('rpc');var config=require(_0x3609('0x6'));var jayson=require(_0x3609('0x7'));var client=jayson[_0x3609('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4bbfcf,_0x189b9d,_0xb2b2be){return new BPromise(function(_0x367b24,_0x5d3b4e){return client[_0x3609('0x9')](_0x4bbfcf,_0xb2b2be)[_0x3609('0xa')](function(_0x71e5e9){logger[_0x3609('0xb')](_0x3609('0xc'),_0x189b9d,_0x3609('0xd'));logger[_0x3609('0xe')](_0x3609('0xf'),_0x189b9d,_0x3609('0xd'),JSON[_0x3609('0x10')](_0x71e5e9));if(_0x71e5e9[_0x3609('0x11')]){if(_0x71e5e9[_0x3609('0x11')][_0x3609('0x12')]===0x1f4){logger[_0x3609('0x11')](_0x3609('0xc'),_0x189b9d,_0x71e5e9['error'][_0x3609('0x13')]);return _0x5d3b4e(_0x71e5e9[_0x3609('0x11')][_0x3609('0x13')]);}logger[_0x3609('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x189b9d,_0x71e5e9[_0x3609('0x11')]['message']);return _0x367b24(_0x71e5e9[_0x3609('0x11')][_0x3609('0x13')]);}else{logger[_0x3609('0xb')](_0x3609('0xc'),_0x189b9d,_0x3609('0xd'));_0x367b24(_0x71e5e9[_0x3609('0x14')][_0x3609('0x13')]);}})[_0x3609('0x15')](function(_0x34b390){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x189b9d,_0x34b390);_0x5d3b4e(_0x34b390);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index dd50f8e..da4c9f2 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 _0xe5ca=['../../config/environment','./intZohoField.controller','isAuthenticated','index','get','/:id','post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x19fd2c,_0x4839d6){var _0x2621a7=function(_0x56c8c8){while(--_0x56c8c8){_0x19fd2c['push'](_0x19fd2c['shift']());}};_0x2621a7(++_0x4839d6);}(_0xe5ca,0x7d));var _0xae5c=function(_0x3ef2d5,_0x423d46){_0x3ef2d5=_0x3ef2d5-0x0;var _0x2fefb2=_0xe5ca[_0x3ef2d5];return _0x2fefb2;};'use strict';var multer=require(_0xae5c('0x0'));var util=require(_0xae5c('0x1'));var path=require(_0xae5c('0x2'));var timeout=require(_0xae5c('0x3'));var express=require(_0xae5c('0x4'));var router=express[_0xae5c('0x5')]();var fs_extra=require(_0xae5c('0x6'));var auth=require(_0xae5c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xae5c('0x8'));var controller=require(_0xae5c('0x9'));router['get']('/',auth[_0xae5c('0xa')](),controller[_0xae5c('0xb')]);router[_0xae5c('0xc')](_0xae5c('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xae5c('0xe')]('/',auth[_0xae5c('0xa')](),controller[_0xae5c('0xf')]);router[_0xae5c('0x10')](_0xae5c('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xae5c('0x11')](_0xae5c('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xae5c('0x12')]=router; \ No newline at end of file +var _0xead4=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','index','/:id','isAuthenticated','update','delete','destroy','multer','path'];(function(_0x24b2c1,_0x9bc75){var _0x314776=function(_0x34dcbd){while(--_0x34dcbd){_0x24b2c1['push'](_0x24b2c1['shift']());}};_0x314776(++_0x9bc75);}(_0xead4,0x1ed));var _0x4ead=function(_0x308213,_0x224541){_0x308213=_0x308213-0x0;var _0x2e1619=_0xead4[_0x308213];return _0x2e1619;};'use strict';var multer=require(_0x4ead('0x0'));var util=require('util');var path=require(_0x4ead('0x1'));var timeout=require(_0x4ead('0x2'));var express=require(_0x4ead('0x3'));var router=express['Router']();var fs_extra=require(_0x4ead('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4ead('0x5'));var config=require(_0x4ead('0x6'));var controller=require(_0x4ead('0x7'));router[_0x4ead('0x8')]('/',auth['isAuthenticated'](),controller[_0x4ead('0x9')]);router['get'](_0x4ead('0xa'),auth[_0x4ead('0xb')](),controller['show']);router['post']('/',auth[_0x4ead('0xb')](),controller['create']);router['put'](_0x4ead('0xa'),auth[_0x4ead('0xb')](),controller[_0x4ead('0xc')]);router[_0x4ead('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x4ead('0xe')]);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 75d4165..fc457ae 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 _0xe252=['keyValue','picklist','STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable'];(function(_0x1e61c4,_0x196edd){var _0x162df7=function(_0x396175){while(--_0x396175){_0x1e61c4['push'](_0x1e61c4['shift']());}};_0x162df7(++_0x196edd);}(_0xe252,0xd7));var _0x2e25=function(_0x1e4a8e,_0x18022b){_0x1e4a8e=_0x1e4a8e-0x0;var _0x5408f9=_0xe252[_0x1e4a8e];return _0x5408f9;};'use strict';var Sequelize=require(_0x2e25('0x0'));module[_0x2e25('0x1')]={'type':{'type':Sequelize[_0x2e25('0x2')](_0x2e25('0x3'),'variable',_0x2e25('0x4'),_0x2e25('0x5'),_0x2e25('0x6')),'defaultValue':_0x2e25('0x3')},'content':{'type':Sequelize[_0x2e25('0x7')]},'key':{'type':Sequelize[_0x2e25('0x7')]},'keyType':{'type':Sequelize[_0x2e25('0x2')](_0x2e25('0x3'),_0x2e25('0x8'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2e25('0x7')]},'customField':{'type':Sequelize[_0x2e25('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3e66=['customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x288b2c,_0x50c793){var _0x381897=function(_0x3fc37d){while(--_0x3fc37d){_0x288b2c['push'](_0x288b2c['shift']());}};_0x381897(++_0x50c793);}(_0x3e66,0x1b4));var _0x63e6=function(_0x50e61e,_0x53c188){_0x50e61e=_0x50e61e-0x0;var _0x5b4469=_0x3e66[_0x50e61e];return _0x5b4469;};'use strict';var Sequelize=require(_0x63e6('0x0'));module[_0x63e6('0x1')]={'type':{'type':Sequelize[_0x63e6('0x2')](_0x63e6('0x3'),_0x63e6('0x4'),_0x63e6('0x5'),_0x63e6('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x63e6('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x63e6('0x2')](_0x63e6('0x3'),'variable',_0x63e6('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x63e6('0x7')]},'nameField':{'type':Sequelize[_0x63e6('0x7')]},'customField':{'type':Sequelize[_0x63e6('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x63e6('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index bc041dd..7ae1ecb 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 _0x7f93=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','undefined','count','offset','limit','Content-Range','reject','update','then','destroy','status','sendStatus','stack','name','send','map','ZohoField','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x37235e,_0x42ee4a){var _0x741b7=function(_0x587629){while(--_0x587629){_0x37235e['push'](_0x37235e['shift']());}};_0x741b7(++_0x42ee4a);}(_0x7f93,0x1a6));var _0x37f9=function(_0x3be7fd,_0x322c09){_0x3be7fd=_0x3be7fd-0x0;var _0x25462a=_0x7f93[_0x3be7fd];return _0x25462a;};'use strict';var emlformat=require(_0x37f9('0x0'));var rimraf=require(_0x37f9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x37f9('0x2'));var rp=require(_0x37f9('0x3'));var moment=require(_0x37f9('0x4'));var BPromise=require(_0x37f9('0x5'));var Mustache=require(_0x37f9('0x6'));var util=require(_0x37f9('0x7'));var path=require(_0x37f9('0x8'));var sox=require(_0x37f9('0x9'));var csv=require(_0x37f9('0xa'));var ejs=require(_0x37f9('0xb'));var fs=require('fs');var fs_extra=require(_0x37f9('0xc'));var _=require('lodash');var squel=require(_0x37f9('0xd'));var crypto=require(_0x37f9('0xe'));var jsforce=require(_0x37f9('0xf'));var deskjs=require(_0x37f9('0x10'));var toCsv=require('to-csv');var querystring=require(_0x37f9('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x37f9('0x12'));var qs=require(_0x37f9('0x13'));var as=require(_0x37f9('0x14'));var hardwareService=require(_0x37f9('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x37f9('0x16'));var config=require(_0x37f9('0x17'));var licenseUtil=require(_0x37f9('0x18'));var db=require(_0x37f9('0x19'))['db'];function respondWithStatusCode(_0x26a912,_0x53d23d){_0x53d23d=_0x53d23d||0xcc;return function(_0x2675ca){if(_0x2675ca){return _0x26a912['sendStatus'](_0x53d23d);}return _0x26a912['status'](_0x53d23d)[_0x37f9('0x1a')]();};}function respondWithResult(_0x1865ba,_0x569f54){_0x569f54=_0x569f54||0xc8;return function(_0xa8c07c){if(_0xa8c07c){return _0x1865ba['status'](_0x569f54)[_0x37f9('0x1b')](_0xa8c07c);}};}function respondWithFilteredResult(_0x2f93e8,_0x3ac8b6){return function(_0x4b547f){if(_0x4b547f){var _0xeff21e=typeof _0x3ac8b6['offset']===_0x37f9('0x1c')&&typeof _0x3ac8b6['limit']===_0x37f9('0x1c');var _0x5430fc=_0x4b547f[_0x37f9('0x1d')];var _0x4bb90c=_0xeff21e?0x0:_0x3ac8b6[_0x37f9('0x1e')];var _0x8d9882=_0xeff21e?_0x4b547f[_0x37f9('0x1d')]:_0x3ac8b6[_0x37f9('0x1e')]+_0x3ac8b6[_0x37f9('0x1f')];var _0x333fc2;if(_0x8d9882>=_0x5430fc){_0x8d9882=_0x5430fc;_0x333fc2=0xc8;}else{_0x333fc2=0xce;}_0x2f93e8['status'](_0x333fc2);return _0x2f93e8['set'](_0x37f9('0x20'),_0x4bb90c+'-'+_0x8d9882+'/'+_0x5430fc)[_0x37f9('0x1b')](_0x4b547f);}return null;};}function patchUpdates(_0x53e02){return function(_0x5e1d80){try{jsonpatch['apply'](_0x5e1d80,_0x53e02,!![]);}catch(_0x3b7afe){return BPromise[_0x37f9('0x21')](_0x3b7afe);}return _0x5e1d80['save']();};}function saveUpdates(_0x25c189,_0x382156){return function(_0xe3a76a){if(_0xe3a76a){return _0xe3a76a[_0x37f9('0x22')](_0x25c189)[_0x37f9('0x23')](function(_0x80bfe7){return _0x80bfe7;});}return null;};}function removeEntity(_0x5ae1e5,_0x8f8be7){return function(_0x284cb3){if(_0x284cb3){return _0x284cb3[_0x37f9('0x24')]()[_0x37f9('0x23')](function(){_0x5ae1e5[_0x37f9('0x25')](0xcc)[_0x37f9('0x1a')]();});}};}function handleEntityNotFound(_0xcb4d5,_0x436f87){return function(_0x34fc44){if(!_0x34fc44){_0xcb4d5[_0x37f9('0x26')](0x194);}return _0x34fc44;};}function handleError(_0x475034,_0x4b3427){_0x4b3427=_0x4b3427||0x1f4;return function(_0x4d9e60){logger['error'](_0x4d9e60[_0x37f9('0x27')]);if(_0x4d9e60[_0x37f9('0x28')]){delete _0x4d9e60[_0x37f9('0x28')];}_0x475034[_0x37f9('0x25')](_0x4b3427)[_0x37f9('0x29')](_0x4d9e60);};}exports['index']=function(_0x1e2e11,_0x5f2f3e){var _0x16bab3={},_0x5c9dfb={},_0x5bc787={'count':0x0,'rows':[]};var _0x514039=_[_0x37f9('0x2a')](db[_0x37f9('0x2b')][_0x37f9('0x2c')],function(_0x7e4edc){return{'name':_0x7e4edc[_0x37f9('0x2d')],'type':_0x7e4edc['type'][_0x37f9('0x2e')]};});_0x5c9dfb[_0x37f9('0x2f')]=_[_0x37f9('0x2a')](_0x514039,_0x37f9('0x28'));_0x5c9dfb[_0x37f9('0x30')]=_[_0x37f9('0x31')](_0x1e2e11[_0x37f9('0x30')]);_0x5c9dfb['filters']=_['intersection'](_0x5c9dfb['model'],_0x5c9dfb[_0x37f9('0x30')]);_0x16bab3[_0x37f9('0x32')]=_[_0x37f9('0x33')](_0x5c9dfb[_0x37f9('0x2f')],qs[_0x37f9('0x34')](_0x1e2e11[_0x37f9('0x30')][_0x37f9('0x34')]));_0x16bab3[_0x37f9('0x32')]=_0x16bab3[_0x37f9('0x32')][_0x37f9('0x35')]?_0x16bab3[_0x37f9('0x32')]:_0x5c9dfb[_0x37f9('0x2f')];if(!_0x1e2e11[_0x37f9('0x30')][_0x37f9('0x36')](_0x37f9('0x37'))){_0x16bab3['limit']=qs[_0x37f9('0x1f')](_0x1e2e11[_0x37f9('0x30')]['limit']);_0x16bab3[_0x37f9('0x1e')]=qs[_0x37f9('0x1e')](_0x1e2e11[_0x37f9('0x30')][_0x37f9('0x1e')]);}_0x16bab3[_0x37f9('0x38')]=qs[_0x37f9('0x39')](_0x1e2e11[_0x37f9('0x30')][_0x37f9('0x39')]);_0x16bab3['where']=qs[_0x37f9('0x3a')](_[_0x37f9('0x3b')](_0x1e2e11[_0x37f9('0x30')],_0x5c9dfb[_0x37f9('0x3a')]),_0x514039);if(_0x1e2e11[_0x37f9('0x30')][_0x37f9('0x3c')]){_0x16bab3[_0x37f9('0x3d')]=_[_0x37f9('0x3e')](_0x16bab3[_0x37f9('0x3d')],{'$or':_[_0x37f9('0x2a')](_0x514039,function(_0x9a8c21){if(_0x9a8c21[_0x37f9('0x3f')]!==_0x37f9('0x40')){var _0x51fdf0={};_0x51fdf0[_0x9a8c21[_0x37f9('0x28')]]={'$like':'%'+_0x1e2e11[_0x37f9('0x30')][_0x37f9('0x3c')]+'%'};return _0x51fdf0;}})});}_0x16bab3=_[_0x37f9('0x3e')]({},_0x16bab3,_0x1e2e11[_0x37f9('0x41')]);var _0x59b784={'where':_0x16bab3[_0x37f9('0x3d')]};return db[_0x37f9('0x2b')][_0x37f9('0x1d')](_0x59b784)[_0x37f9('0x23')](function(_0x1e9940){_0x5bc787['count']=_0x1e9940;if(_0x1e2e11[_0x37f9('0x30')][_0x37f9('0x42')]){_0x16bab3[_0x37f9('0x43')]=[{'all':!![]}];}return db[_0x37f9('0x2b')][_0x37f9('0x44')](_0x16bab3);})[_0x37f9('0x23')](function(_0x41260d){_0x5bc787['rows']=_0x41260d;return _0x5bc787;})[_0x37f9('0x23')](respondWithFilteredResult(_0x5f2f3e,_0x16bab3))[_0x37f9('0x45')](handleError(_0x5f2f3e,null));};exports['show']=function(_0x328c73,_0x549f1a){var _0x174ff7={'raw':!![],'where':{'id':_0x328c73[_0x37f9('0x46')]['id']}},_0x3a0a57={};_0x3a0a57['model']=_['keys'](db[_0x37f9('0x2b')][_0x37f9('0x2c')]);_0x3a0a57[_0x37f9('0x30')]=_[_0x37f9('0x31')](_0x328c73[_0x37f9('0x30')]);_0x3a0a57[_0x37f9('0x3a')]=_[_0x37f9('0x33')](_0x3a0a57[_0x37f9('0x2f')],_0x3a0a57['query']);_0x174ff7[_0x37f9('0x32')]=_['intersection'](_0x3a0a57[_0x37f9('0x2f')],qs[_0x37f9('0x34')](_0x328c73[_0x37f9('0x30')][_0x37f9('0x34')]));_0x174ff7[_0x37f9('0x32')]=_0x174ff7['attributes']['length']?_0x174ff7[_0x37f9('0x32')]:_0x3a0a57[_0x37f9('0x2f')];if(_0x328c73['query'][_0x37f9('0x42')]){_0x174ff7['include']=[{'all':!![]}];}_0x174ff7=_['merge']({},_0x174ff7,_0x328c73[_0x37f9('0x41')]);return db[_0x37f9('0x2b')][_0x37f9('0x47')](_0x174ff7)[_0x37f9('0x23')](handleEntityNotFound(_0x549f1a,null))[_0x37f9('0x23')](respondWithResult(_0x549f1a,null))['catch'](handleError(_0x549f1a,null));};exports[_0x37f9('0x48')]=function(_0x30d959,_0x58db79){return db[_0x37f9('0x2b')][_0x37f9('0x48')](_0x30d959[_0x37f9('0x49')],{})[_0x37f9('0x23')](respondWithResult(_0x58db79,0xc9))[_0x37f9('0x45')](handleError(_0x58db79,null));};exports['update']=function(_0x2901bf,_0x3ad236){if(_0x2901bf[_0x37f9('0x49')]['id']){delete _0x2901bf['body']['id'];}return db[_0x37f9('0x2b')][_0x37f9('0x47')]({'where':{'id':_0x2901bf[_0x37f9('0x46')]['id']}})[_0x37f9('0x23')](handleEntityNotFound(_0x3ad236,null))[_0x37f9('0x23')](saveUpdates(_0x2901bf['body'],null))[_0x37f9('0x23')](respondWithResult(_0x3ad236,null))[_0x37f9('0x45')](handleError(_0x3ad236,null));};exports[_0x37f9('0x24')]=function(_0x44eef0,_0x3ac83e){return db[_0x37f9('0x2b')][_0x37f9('0x47')]({'where':{'id':_0x44eef0['params']['id']}})[_0x37f9('0x23')](handleEntityNotFound(_0x3ac83e,null))[_0x37f9('0x23')](removeEntity(_0x3ac83e,null))[_0x37f9('0x45')](handleError(_0x3ac83e,null));}; \ No newline at end of file +var _0x2883=['ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','then','error','stack','name','index','map','fieldName','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','ZohoField','includeAll','include','findAll','catch','show','params','keys','rawAttributes','length','find','create','update','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv'];(function(_0x40b7bd,_0x2f8acc){var _0x30f8a5=function(_0x34d3b3){while(--_0x34d3b3){_0x40b7bd['push'](_0x40b7bd['shift']());}};_0x30f8a5(++_0x2f8acc);}(_0x2883,0x11e));var _0x3288=function(_0x35a543,_0x1b70da){_0x35a543=_0x35a543-0x0;var _0x14fe43=_0x2883[_0x35a543];return _0x14fe43;};'use strict';var emlformat=require(_0x3288('0x0'));var rimraf=require(_0x3288('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3288('0x2'));var rp=require(_0x3288('0x3'));var moment=require(_0x3288('0x4'));var BPromise=require(_0x3288('0x5'));var Mustache=require(_0x3288('0x6'));var util=require(_0x3288('0x7'));var path=require('path');var sox=require(_0x3288('0x8'));var csv=require(_0x3288('0x9'));var ejs=require(_0x3288('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3288('0xb'));var squel=require(_0x3288('0xc'));var crypto=require(_0x3288('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3288('0xe'));var toCsv=require(_0x3288('0x9'));var querystring=require(_0x3288('0xf'));var Papa=require(_0x3288('0x10'));var Redis=require(_0x3288('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3288('0x12'));var logger=require('../../config/logger')(_0x3288('0x13'));var utils=require(_0x3288('0x14'));var config=require(_0x3288('0x15'));var licenseUtil=require(_0x3288('0x16'));var db=require(_0x3288('0x17'))['db'];function respondWithStatusCode(_0x375b4c,_0x5aa608){_0x5aa608=_0x5aa608||0xcc;return function(_0x32ed2d){if(_0x32ed2d){return _0x375b4c[_0x3288('0x18')](_0x5aa608);}return _0x375b4c[_0x3288('0x19')](_0x5aa608)[_0x3288('0x1a')]();};}function respondWithResult(_0x90bb20,_0x584229){_0x584229=_0x584229||0xc8;return function(_0x50eeb3){if(_0x50eeb3){return _0x90bb20[_0x3288('0x19')](_0x584229)[_0x3288('0x1b')](_0x50eeb3);}};}function respondWithFilteredResult(_0x5f3dd1,_0x32e986){return function(_0x36fdea){if(_0x36fdea){var _0x5bb67d=typeof _0x32e986[_0x3288('0x1c')]===_0x3288('0x1d')&&typeof _0x32e986['limit']===_0x3288('0x1d');var _0x283ec9=_0x36fdea[_0x3288('0x1e')];var _0x48093e=_0x5bb67d?0x0:_0x32e986['offset'];var _0x4672b1=_0x5bb67d?_0x36fdea[_0x3288('0x1e')]:_0x32e986[_0x3288('0x1c')]+_0x32e986['limit'];var _0x51fe99;if(_0x4672b1>=_0x283ec9){_0x4672b1=_0x283ec9;_0x51fe99=0xc8;}else{_0x51fe99=0xce;}_0x5f3dd1[_0x3288('0x19')](_0x51fe99);return _0x5f3dd1[_0x3288('0x1f')](_0x3288('0x20'),_0x48093e+'-'+_0x4672b1+'/'+_0x283ec9)[_0x3288('0x1b')](_0x36fdea);}return null;};}function patchUpdates(_0x58a602){return function(_0x44cb55){try{jsonpatch['apply'](_0x44cb55,_0x58a602,!![]);}catch(_0x45056e){return BPromise[_0x3288('0x21')](_0x45056e);}return _0x44cb55[_0x3288('0x22')]();};}function saveUpdates(_0x17bd28,_0x51829c){return function(_0x44a5f6){if(_0x44a5f6){return _0x44a5f6['update'](_0x17bd28)[_0x3288('0x23')](function(_0x489143){return _0x489143;});}return null;};}function removeEntity(_0x54d154,_0x5579db){return function(_0x17cce1){if(_0x17cce1){return _0x17cce1['destroy']()['then'](function(){_0x54d154[_0x3288('0x19')](0xcc)[_0x3288('0x1a')]();});}};}function handleEntityNotFound(_0xdecb36,_0x28ac40){return function(_0x2ab568){if(!_0x2ab568){_0xdecb36[_0x3288('0x18')](0x194);}return _0x2ab568;};}function handleError(_0x34d7bd,_0x413b28){_0x413b28=_0x413b28||0x1f4;return function(_0x55d84b){logger[_0x3288('0x24')](_0x55d84b[_0x3288('0x25')]);if(_0x55d84b[_0x3288('0x26')]){delete _0x55d84b[_0x3288('0x26')];}_0x34d7bd['status'](_0x413b28)['send'](_0x55d84b);};}exports[_0x3288('0x27')]=function(_0x4309ec,_0x559665){var _0x2e3f88={},_0x5eea75={},_0x4a879c={'count':0x0,'rows':[]};var _0x41c2c4=_[_0x3288('0x28')](db['ZohoField']['rawAttributes'],function(_0x1eb727){return{'name':_0x1eb727[_0x3288('0x29')],'type':_0x1eb727['type']['key']};});_0x5eea75['model']=_[_0x3288('0x28')](_0x41c2c4,_0x3288('0x26'));_0x5eea75[_0x3288('0x2a')]=_['keys'](_0x4309ec['query']);_0x5eea75[_0x3288('0x2b')]=_[_0x3288('0x2c')](_0x5eea75[_0x3288('0x2d')],_0x5eea75[_0x3288('0x2a')]);_0x2e3f88[_0x3288('0x2e')]=_['intersection'](_0x5eea75[_0x3288('0x2d')],qs[_0x3288('0x2f')](_0x4309ec[_0x3288('0x2a')][_0x3288('0x2f')]));_0x2e3f88[_0x3288('0x2e')]=_0x2e3f88[_0x3288('0x2e')]['length']?_0x2e3f88[_0x3288('0x2e')]:_0x5eea75[_0x3288('0x2d')];if(!_0x4309ec[_0x3288('0x2a')][_0x3288('0x30')](_0x3288('0x31'))){_0x2e3f88[_0x3288('0x32')]=qs[_0x3288('0x32')](_0x4309ec[_0x3288('0x2a')][_0x3288('0x32')]);_0x2e3f88[_0x3288('0x1c')]=qs[_0x3288('0x1c')](_0x4309ec[_0x3288('0x2a')][_0x3288('0x1c')]);}_0x2e3f88[_0x3288('0x33')]=qs[_0x3288('0x34')](_0x4309ec[_0x3288('0x2a')]['sort']);_0x2e3f88[_0x3288('0x35')]=qs['filters'](_[_0x3288('0x36')](_0x4309ec[_0x3288('0x2a')],_0x5eea75['filters']),_0x41c2c4);if(_0x4309ec[_0x3288('0x2a')][_0x3288('0x37')]){_0x2e3f88['where']=_[_0x3288('0x38')](_0x2e3f88[_0x3288('0x35')],{'$or':_[_0x3288('0x28')](_0x41c2c4,function(_0x59349c){if(_0x59349c['type']!==_0x3288('0x39')){var _0x4c7f51={};_0x4c7f51[_0x59349c[_0x3288('0x26')]]={'$like':'%'+_0x4309ec[_0x3288('0x2a')][_0x3288('0x37')]+'%'};return _0x4c7f51;}})});}_0x2e3f88=_['merge']({},_0x2e3f88,_0x4309ec[_0x3288('0x3a')]);var _0x151206={'where':_0x2e3f88['where']};return db[_0x3288('0x3b')][_0x3288('0x1e')](_0x151206)['then'](function(_0x440742){_0x4a879c[_0x3288('0x1e')]=_0x440742;if(_0x4309ec[_0x3288('0x2a')][_0x3288('0x3c')]){_0x2e3f88[_0x3288('0x3d')]=[{'all':!![]}];}return db[_0x3288('0x3b')][_0x3288('0x3e')](_0x2e3f88);})['then'](function(_0x255f6f){_0x4a879c['rows']=_0x255f6f;return _0x4a879c;})[_0x3288('0x23')](respondWithFilteredResult(_0x559665,_0x2e3f88))[_0x3288('0x3f')](handleError(_0x559665,null));};exports[_0x3288('0x40')]=function(_0x1d81ea,_0x61b4be){var _0x478347={'raw':!![],'where':{'id':_0x1d81ea[_0x3288('0x41')]['id']}},_0x4861fd={};_0x4861fd[_0x3288('0x2d')]=_[_0x3288('0x42')](db['ZohoField'][_0x3288('0x43')]);_0x4861fd[_0x3288('0x2a')]=_['keys'](_0x1d81ea['query']);_0x4861fd[_0x3288('0x2b')]=_[_0x3288('0x2c')](_0x4861fd[_0x3288('0x2d')],_0x4861fd['query']);_0x478347['attributes']=_[_0x3288('0x2c')](_0x4861fd[_0x3288('0x2d')],qs[_0x3288('0x2f')](_0x1d81ea[_0x3288('0x2a')]['fields']));_0x478347[_0x3288('0x2e')]=_0x478347[_0x3288('0x2e')][_0x3288('0x44')]?_0x478347['attributes']:_0x4861fd[_0x3288('0x2d')];if(_0x1d81ea[_0x3288('0x2a')][_0x3288('0x3c')]){_0x478347['include']=[{'all':!![]}];}_0x478347=_[_0x3288('0x38')]({},_0x478347,_0x1d81ea[_0x3288('0x3a')]);return db[_0x3288('0x3b')][_0x3288('0x45')](_0x478347)[_0x3288('0x23')](handleEntityNotFound(_0x61b4be,null))[_0x3288('0x23')](respondWithResult(_0x61b4be,null))[_0x3288('0x3f')](handleError(_0x61b4be,null));};exports[_0x3288('0x46')]=function(_0x19e115,_0x57304b){return db[_0x3288('0x3b')]['create'](_0x19e115['body'],{})[_0x3288('0x23')](respondWithResult(_0x57304b,0xc9))['catch'](handleError(_0x57304b,null));};exports[_0x3288('0x47')]=function(_0x215cd4,_0x2af85d){if(_0x215cd4[_0x3288('0x48')]['id']){delete _0x215cd4[_0x3288('0x48')]['id'];}return db[_0x3288('0x3b')][_0x3288('0x45')]({'where':{'id':_0x215cd4[_0x3288('0x41')]['id']}})[_0x3288('0x23')](handleEntityNotFound(_0x2af85d,null))['then'](saveUpdates(_0x215cd4['body'],null))[_0x3288('0x23')](respondWithResult(_0x2af85d,null))[_0x3288('0x3f')](handleError(_0x2af85d,null));};exports[_0x3288('0x49')]=function(_0x47eddc,_0x5d3536){return db['ZohoField'][_0x3288('0x45')]({'where':{'id':_0x47eddc[_0x3288('0x41')]['id']}})[_0x3288('0x23')](handleEntityNotFound(_0x5d3536,null))[_0x3288('0x23')](removeEntity(_0x5d3536,null))[_0x3288('0x3f')](handleError(_0x5d3536,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 07f4a29..f5d88a3 100644 --- a/server/api/intZohoField/intZohoField.model.js +++ b/server/api/intZohoField/intZohoField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x68b3=['../../config/environment','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x4e2582,_0x22633d){var _0x2341fb=function(_0x2744c9){while(--_0x2744c9){_0x4e2582['push'](_0x4e2582['shift']());}};_0x2341fb(++_0x22633d);}(_0x68b3,0x1d8));var _0x368b=function(_0x558874,_0x5d16fc){_0x558874=_0x558874-0x0;var _0x5f56b9=_0x68b3[_0x558874];return _0x5f56b9;};'use strict';var _=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var logger=require(_0x368b('0x2'))(_0x368b('0x3'));var moment=require(_0x368b('0x4'));var BPromise=require('bluebird');var rp=require(_0x368b('0x5'));var fs=require('fs');var path=require(_0x368b('0x6'));var rimraf=require(_0x368b('0x7'));var config=require(_0x368b('0x8'));var attributes=require('./intZohoField.attributes');module[_0x368b('0x9')]=function(_0x41b15b,_0x104dad){return _0x41b15b[_0x368b('0xa')](_0x368b('0xb'),attributes,{'tableName':_0x368b('0xc'),'paranoid':![],'indexes':[{'name':_0x368b('0xd'),'fields':[_0x368b('0xe'),_0x368b('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x57ca=['moment','bluebird','request-promise','path','rimraf','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','util','../../config/logger'];(function(_0x2c28e7,_0x13bab5){var _0x100084=function(_0x2c2a8e){while(--_0x2c2a8e){_0x2c28e7['push'](_0x2c28e7['shift']());}};_0x100084(++_0x13bab5);}(_0x57ca,0x108));var _0xa57c=function(_0x35cb03,_0x8f7393){_0x35cb03=_0x35cb03-0x0;var _0x27a965=_0x57ca[_0x35cb03];return _0x27a965;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var logger=require(_0xa57c('0x1'))('api');var moment=require(_0xa57c('0x2'));var BPromise=require(_0xa57c('0x3'));var rp=require(_0xa57c('0x4'));var fs=require('fs');var path=require(_0xa57c('0x5'));var rimraf=require(_0xa57c('0x6'));var config=require('../../config/environment');var attributes=require(_0xa57c('0x7'));module[_0xa57c('0x8')]=function(_0x113dcf,_0x19473f){return _0x113dcf[_0xa57c('0x9')](_0xa57c('0xa'),attributes,{'tableName':_0xa57c('0xb'),'paranoid':![],'indexes':[{'name':_0xa57c('0xc'),'fields':['idField',_0xa57c('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index a58c5b1..d06c2b2 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 _0x2598=['client','request','then','ZohoField,\x20%s,\x20%s','ZohoField,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','catch','lodash','util','moment','randomstring','../../config/utils','rpc','jayson/promise'];(function(_0x5ee507,_0x59e998){var _0x223caf=function(_0x39bfad){while(--_0x39bfad){_0x5ee507['push'](_0x5ee507['shift']());}};_0x223caf(++_0x59e998);}(_0x2598,0x197));var _0x8259=function(_0x385fed,_0x3a4757){_0x385fed=_0x385fed-0x0;var _0x52fa25=_0x2598[_0x385fed];return _0x52fa25;};'use strict';var _=require(_0x8259('0x0'));var util=require(_0x8259('0x1'));var moment=require(_0x8259('0x2'));var BPromise=require('bluebird');var rs=require(_0x8259('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8259('0x4'));var logger=require('../../config/logger')(_0x8259('0x5'));var config=require('../../config/environment');var jayson=require(_0x8259('0x6'));var client=jayson[_0x8259('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ca732,_0x3cd4bc,_0x134888){return new BPromise(function(_0x573e65,_0x77fded){return client[_0x8259('0x8')](_0x1ca732,_0x134888)[_0x8259('0x9')](function(_0x464247){logger['info'](_0x8259('0xa'),_0x3cd4bc,'request\x20sent');logger['debug'](_0x8259('0xb'),_0x3cd4bc,'request\x20sent',JSON['stringify'](_0x464247));if(_0x464247[_0x8259('0xc')]){if(_0x464247[_0x8259('0xc')][_0x8259('0xd')]===0x1f4){logger[_0x8259('0xc')](_0x8259('0xa'),_0x3cd4bc,_0x464247[_0x8259('0xc')]['message']);return _0x77fded(_0x464247[_0x8259('0xc')][_0x8259('0xe')]);}logger[_0x8259('0xc')](_0x8259('0xa'),_0x3cd4bc,_0x464247[_0x8259('0xc')][_0x8259('0xe')]);return _0x573e65(_0x464247[_0x8259('0xc')][_0x8259('0xe')]);}else{logger[_0x8259('0xf')](_0x8259('0xa'),_0x3cd4bc,_0x8259('0x10'));_0x573e65(_0x464247['result'][_0x8259('0xe')]);}})[_0x8259('0x11')](function(_0x3eea3d){logger[_0x8259('0xc')](_0x8259('0xa'),_0x3cd4bc,_0x3eea3d);_0x77fded(_0x3eea3d);});});} \ No newline at end of file +var _0x83b5=['message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZohoField,\x20%s,\x20%s','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x83b5,0x153));var _0x583b=function(_0x234318,_0xf22f31){_0x234318=_0x234318-0x0;var _0x1ab719=_0x83b5[_0x234318];return _0x1ab719;};'use strict';var _=require(_0x583b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x583b('0x1'));var rs=require(_0x583b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x583b('0x3'))['db'];var utils=require(_0x583b('0x4'));var logger=require(_0x583b('0x5'))(_0x583b('0x6'));var config=require(_0x583b('0x7'));var jayson=require(_0x583b('0x8'));var client=jayson[_0x583b('0x9')][_0x583b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26e662,_0x598fce,_0xfc4f5c){return new BPromise(function(_0x26f699,_0x357e21){return client['request'](_0x26e662,_0xfc4f5c)[_0x583b('0xb')](function(_0x17c942){logger[_0x583b('0xc')](_0x583b('0xd'),_0x598fce,'request\x20sent');logger['debug'](_0x583b('0xe'),_0x598fce,'request\x20sent',JSON[_0x583b('0xf')](_0x17c942));if(_0x17c942[_0x583b('0x10')]){if(_0x17c942[_0x583b('0x10')][_0x583b('0x11')]===0x1f4){logger[_0x583b('0x10')](_0x583b('0xd'),_0x598fce,_0x17c942[_0x583b('0x10')]['message']);return _0x357e21(_0x17c942[_0x583b('0x10')]['message']);}logger['error']('ZohoField,\x20%s,\x20%s',_0x598fce,_0x17c942[_0x583b('0x10')][_0x583b('0x12')]);return _0x26f699(_0x17c942[_0x583b('0x10')][_0x583b('0x12')]);}else{logger[_0x583b('0xc')](_0x583b('0xd'),_0x598fce,'request\x20sent');_0x26f699(_0x17c942[_0x583b('0x13')][_0x583b('0x12')]);}})[_0x583b('0x14')](function(_0x101856){logger[_0x583b('0x10')](_0x583b('0xd'),_0x598fce,_0x101856);_0x357e21(_0x101856);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index e5ac756..ec1c9b4 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x29f71e,_0x8f151f){var _0x92dbf3=function(_0x28dd7c){while(--_0x28dd7c){_0x29f71e['push'](_0x29f71e['shift']());}};_0x92dbf3(++_0x8f151f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x510c60,_0x50247e){_0x510c60=_0x510c60-0x0;var _0x49c4aa=_0xcb91[_0x510c60];return _0x49c4aa;};'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(_0x373b37,_0x201bbf){var _0x144a38=function(_0x367ab8){while(--_0x367ab8){_0x373b37['push'](_0x373b37['shift']());}};_0x144a38(++_0x201bbf);}(_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 6d0377f..f07d3a7 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 _0x47cb=['unique_name_and_version','INTEGER','BOOLEAN','state','exports','STRING'];(function(_0x57dae8,_0x14f493){var _0x2da89a=function(_0x498a30){while(--_0x498a30){_0x57dae8['push'](_0x57dae8['shift']());}};_0x2da89a(++_0x14f493);}(_0x47cb,0x10c));var _0xb47c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x47cb[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0xb47c('0x0')]={'name':{'type':Sequelize[_0xb47c('0x1')],'allowNull':![],'unique':_0xb47c('0x2')},'version':{'type':Sequelize[_0xb47c('0x1')],'allowNull':![],'unique':_0xb47c('0x2')},'main':{'type':Sequelize[_0xb47c('0x1')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0xb47c('0x1')]},'path':{'type':Sequelize[_0xb47c('0x1')]},'type':{'type':Sequelize[_0xb47c('0x1')]},'size':{'type':Sequelize[_0xb47c('0x3')]},'active':{'type':Sequelize[_0xb47c('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0xb47c('0x1')]},'logo':{'type':Sequelize[_0xb47c('0x1')]},'state':{'type':Sequelize[_0xb47c('0x1')],'unique':_0xb47c('0x5')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xb47c('0x1')]},'link':{'type':Sequelize[_0xb47c('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x162a=['sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state'];(function(_0x19a490,_0x4627d9){var _0x52081c=function(_0x418ba5){while(--_0x418ba5){_0x19a490['push'](_0x19a490['shift']());}};_0x52081c(++_0x4627d9);}(_0x162a,0x180));var _0xa162=function(_0xee2f01,_0x5bd1b7){_0xee2f01=_0xee2f01-0x0;var _0x3d4fde=_0x162a[_0xee2f01];return _0x3d4fde;};'use strict';var Sequelize=require(_0xa162('0x0'));module[_0xa162('0x1')]={'name':{'type':Sequelize[_0xa162('0x2')],'allowNull':![],'unique':_0xa162('0x3')},'version':{'type':Sequelize[_0xa162('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xa162('0x2')],'defaultValue':_0xa162('0x4')},'filename':{'type':Sequelize[_0xa162('0x2')]},'path':{'type':Sequelize[_0xa162('0x2')]},'type':{'type':Sequelize[_0xa162('0x2')]},'size':{'type':Sequelize[_0xa162('0x5')]},'active':{'type':Sequelize[_0xa162('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xa162('0x2')]},'logo':{'type':Sequelize[_0xa162('0x2')]},'state':{'type':Sequelize[_0xa162('0x2')],'unique':_0xa162('0x7')},'description':{'type':Sequelize[_0xa162('0x2')]},'title':{'type':Sequelize[_0xa162('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xa162('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 1a28618..ae1fb29 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 _0xc4aa=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','Integration','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xc4aa[_0x1928c9];return _0x51b5fb;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];function respondWithStatusCode(_0x24291d,_0x5e16aa){_0x5e16aa=_0x5e16aa||0xcc;return function(_0x21a79){if(_0x21a79){return _0x24291d[_0xac4a('0x17')](_0x5e16aa);}return _0x24291d[_0xac4a('0x18')](_0x5e16aa)[_0xac4a('0x19')]();};}function respondWithResult(_0x1b4313,_0x3b71c0){_0x3b71c0=_0x3b71c0||0xc8;return function(_0x34bc01){if(_0x34bc01){return _0x1b4313[_0xac4a('0x18')](_0x3b71c0)[_0xac4a('0x1a')](_0x34bc01);}};}function respondWithFilteredResult(_0x42c7fc,_0x11e101){return function(_0x26dbb8){if(_0x26dbb8){var _0x4a2119=typeof _0x11e101[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x11e101[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x3e88e3=_0x26dbb8[_0xac4a('0x1e')];var _0x28e304=_0x4a2119?0x0:_0x11e101[_0xac4a('0x1b')];var _0x546c5d=_0x4a2119?_0x26dbb8['count']:_0x11e101[_0xac4a('0x1b')]+_0x11e101[_0xac4a('0x1d')];var _0x39b691;if(_0x546c5d>=_0x3e88e3){_0x546c5d=_0x3e88e3;_0x39b691=0xc8;}else{_0x39b691=0xce;}_0x42c7fc['status'](_0x39b691);return _0x42c7fc[_0xac4a('0x1f')](_0xac4a('0x20'),_0x28e304+'-'+_0x546c5d+'/'+_0x3e88e3)[_0xac4a('0x1a')](_0x26dbb8);}return null;};}function patchUpdates(_0x3a3cdb){return function(_0x123694){try{jsonpatch[_0xac4a('0x21')](_0x123694,_0x3a3cdb,!![]);}catch(_0xe38996){return BPromise[_0xac4a('0x22')](_0xe38996);}return _0x123694['save']();};}function saveUpdates(_0x3d8f0a,_0x3204ad){return function(_0x599787){if(_0x599787){return _0x599787[_0xac4a('0x23')](_0x3d8f0a)[_0xac4a('0x24')](function(_0x3eacd3){return _0x3eacd3;});}return null;};}function removeEntity(_0x947d8e,_0x4d2d6c){return function(_0x1b7998){if(_0x1b7998){return _0x1b7998[_0xac4a('0x25')]()[_0xac4a('0x24')](function(){_0x947d8e[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x2b0dc2,_0x222507){return function(_0x36054a){if(!_0x36054a){_0x2b0dc2[_0xac4a('0x17')](0x194);}return _0x36054a;};}function handleError(_0x3bc318,_0x1d0539){_0x1d0539=_0x1d0539||0x1f4;return function(_0x215a31){logger[_0xac4a('0x26')](_0x215a31[_0xac4a('0x27')]);if(_0x215a31[_0xac4a('0x28')]){delete _0x215a31[_0xac4a('0x28')];}_0x3bc318['status'](_0x1d0539)[_0xac4a('0x29')](_0x215a31);};}exports[_0xac4a('0x2a')]=function(_0x42a33c,_0x2772fe){var _0x116700={},_0x4a5a9e={},_0x47f49c={'count':0x0,'rows':[]};var _0xdb7e=_[_0xac4a('0x2b')](db[_0xac4a('0x2c')]['rawAttributes'],function(_0x4bda1f){return{'name':_0x4bda1f[_0xac4a('0x2d')],'type':_0x4bda1f[_0xac4a('0x2e')][_0xac4a('0x2f')]};});_0x4a5a9e[_0xac4a('0x30')]=_[_0xac4a('0x2b')](_0xdb7e,'name');_0x4a5a9e[_0xac4a('0x31')]=_['keys'](_0x42a33c[_0xac4a('0x31')]);_0x4a5a9e['filters']=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],_0x4a5a9e[_0xac4a('0x31')]);_0x116700[_0xac4a('0x33')]=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x34')]));_0x116700[_0xac4a('0x33')]=_0x116700[_0xac4a('0x33')][_0xac4a('0x35')]?_0x116700[_0xac4a('0x33')]:_0x4a5a9e[_0xac4a('0x30')];if(!_0x42a33c['query'][_0xac4a('0x36')](_0xac4a('0x37'))){_0x116700['limit']=qs[_0xac4a('0x1d')](_0x42a33c[_0xac4a('0x31')]['limit']);_0x116700['offset']=qs[_0xac4a('0x1b')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x1b')]);}_0x116700[_0xac4a('0x38')]=qs['sort'](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x39')]);_0x116700['where']=qs[_0xac4a('0x3a')](_[_0xac4a('0x3b')](_0x42a33c[_0xac4a('0x31')],_0x4a5a9e['filters']),_0xdb7e);if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x3c')]){_0x116700[_0xac4a('0x3d')]=_['merge'](_0x116700[_0xac4a('0x3d')],{'$or':_[_0xac4a('0x2b')](_0xdb7e,function(_0x4b9faf){if(_0x4b9faf['type']!==_0xac4a('0x3e')){var _0x5e0926={};_0x5e0926[_0x4b9faf['name']]={'$like':'%'+_0x42a33c['query']['filter']+'%'};return _0x5e0926;}})});}_0x116700=_[_0xac4a('0x3f')]({},_0x116700,_0x42a33c[_0xac4a('0x40')]);var _0x37834b={'where':_0x116700[_0xac4a('0x3d')]};return db[_0xac4a('0x2c')][_0xac4a('0x1e')](_0x37834b)[_0xac4a('0x24')](function(_0x2b16f0){_0x47f49c[_0xac4a('0x1e')]=_0x2b16f0;if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x41')]){_0x116700[_0xac4a('0x42')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x116700);})['then'](function(_0x1e1cc5){_0x47f49c[_0xac4a('0x43')]=_0x1e1cc5;return _0x47f49c;})[_0xac4a('0x24')](respondWithFilteredResult(_0x2772fe,_0x116700))[_0xac4a('0x44')](handleError(_0x2772fe,null));};exports[_0xac4a('0x45')]=function(_0x411543,_0x8febf0){var _0x3441f2={'raw':![],'where':{'id':_0x411543[_0xac4a('0x46')]['id']}},_0x3e9973={};_0x3e9973['model']=_[_0xac4a('0x47')](db[_0xac4a('0x2c')][_0xac4a('0x48')]);_0x3e9973[_0xac4a('0x31')]=_[_0xac4a('0x47')](_0x411543['query']);_0x3e9973[_0xac4a('0x3a')]=_[_0xac4a('0x32')](_0x3e9973['model'],_0x3e9973[_0xac4a('0x31')]);_0x3441f2['attributes']=_[_0xac4a('0x32')](_0x3e9973[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x411543[_0xac4a('0x31')][_0xac4a('0x34')]));_0x3441f2[_0xac4a('0x33')]=_0x3441f2[_0xac4a('0x33')][_0xac4a('0x35')]?_0x3441f2[_0xac4a('0x33')]:_0x3e9973[_0xac4a('0x30')];if(_0x411543[_0xac4a('0x31')][_0xac4a('0x41')]){_0x3441f2['include']=[{'all':!![]}];}_0x3441f2=_[_0xac4a('0x3f')]({},_0x3441f2,_0x411543[_0xac4a('0x40')]);return db[_0xac4a('0x2c')]['find'](_0x3441f2)[_0xac4a('0x24')](handleEntityNotFound(_0x8febf0,null))[_0xac4a('0x24')](respondWithResult(_0x8febf0,null))['catch'](handleError(_0x8febf0,null));};exports[_0xac4a('0x49')]=function(_0x5a7f6e,_0x244950){return db[_0xac4a('0x2c')][_0xac4a('0x49')](_0x5a7f6e['body'],{})['then'](respondWithResult(_0x244950,0xc9))[_0xac4a('0x44')](handleError(_0x244950,null));};exports['update']=function(_0x18ae96,_0x566258){if(_0x18ae96[_0xac4a('0x4a')]['id']){delete _0x18ae96['body']['id'];}return db[_0xac4a('0x2c')][_0xac4a('0x4b')]({'where':{'id':_0x18ae96[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x566258,null))['then'](saveUpdates(_0x18ae96[_0xac4a('0x4a')],null))[_0xac4a('0x24')](respondWithResult(_0x566258,null))[_0xac4a('0x44')](handleError(_0x566258,null));};exports[_0xac4a('0x25')]=function(_0x2f30e2,_0x138876){return db[_0xac4a('0x2c')]['find']({'where':{'id':_0x2f30e2[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x138876,null))['then'](removeEntity(_0x138876,null))[_0xac4a('0x44')](handleError(_0x138876,null));}; \ No newline at end of file +var _0x90b1=['map','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','merge','where','type','options','Integration','includeAll','rows','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','then','destroy','error','name','send','index'];(function(_0x5aee84,_0x38c0b4){var _0x119212=function(_0x1c357b){while(--_0x1c357b){_0x5aee84['push'](_0x5aee84['shift']());}};_0x119212(++_0x38c0b4);}(_0x90b1,0x1bb));var _0x190b=function(_0x3222f7,_0x151aac){_0x3222f7=_0x3222f7-0x0;var _0x2fa881=_0x90b1[_0x3222f7];return _0x2fa881;};'use strict';var emlformat=require(_0x190b('0x0'));var rimraf=require(_0x190b('0x1'));var zipdir=require(_0x190b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x190b('0x3'));var BPromise=require(_0x190b('0x4'));var Mustache=require(_0x190b('0x5'));var util=require(_0x190b('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x190b('0x7'));var _=require(_0x190b('0x8'));var squel=require(_0x190b('0x9'));var crypto=require(_0x190b('0xa'));var jsforce=require(_0x190b('0xb'));var deskjs=require(_0x190b('0xc'));var toCsv=require(_0x190b('0xd'));var querystring=require('querystring');var Papa=require(_0x190b('0xe'));var Redis=require(_0x190b('0xf'));var authService=require(_0x190b('0x10'));var qs=require(_0x190b('0x11'));var as=require(_0x190b('0x12'));var hardwareService=require(_0x190b('0x13'));var logger=require(_0x190b('0x14'))(_0x190b('0x15'));var utils=require('../../config/utils');var config=require(_0x190b('0x16'));var licenseUtil=require(_0x190b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d63ac,_0x596c48){_0x596c48=_0x596c48||0xcc;return function(_0x286c81){if(_0x286c81){return _0x4d63ac[_0x190b('0x18')](_0x596c48);}return _0x4d63ac[_0x190b('0x19')](_0x596c48)[_0x190b('0x1a')]();};}function respondWithResult(_0x2e12d4,_0x13544c){_0x13544c=_0x13544c||0xc8;return function(_0x1ff180){if(_0x1ff180){return _0x2e12d4[_0x190b('0x19')](_0x13544c)[_0x190b('0x1b')](_0x1ff180);}};}function respondWithFilteredResult(_0x1a046f,_0xab346){return function(_0x3e8781){if(_0x3e8781){var _0x3fbfc3=typeof _0xab346[_0x190b('0x1c')]===_0x190b('0x1d')&&typeof _0xab346['limit']===_0x190b('0x1d');var _0x5efbed=_0x3e8781[_0x190b('0x1e')];var _0x21e458=_0x3fbfc3?0x0:_0xab346[_0x190b('0x1c')];var _0x16c009=_0x3fbfc3?_0x3e8781['count']:_0xab346[_0x190b('0x1c')]+_0xab346[_0x190b('0x1f')];var _0x441a2b;if(_0x16c009>=_0x5efbed){_0x16c009=_0x5efbed;_0x441a2b=0xc8;}else{_0x441a2b=0xce;}_0x1a046f[_0x190b('0x19')](_0x441a2b);return _0x1a046f[_0x190b('0x20')](_0x190b('0x21'),_0x21e458+'-'+_0x16c009+'/'+_0x5efbed)['json'](_0x3e8781);}return null;};}function patchUpdates(_0x3ed24c){return function(_0x14f0a5){try{jsonpatch['apply'](_0x14f0a5,_0x3ed24c,!![]);}catch(_0xb4c32b){return BPromise['reject'](_0xb4c32b);}return _0x14f0a5['save']();};}function saveUpdates(_0xcd15e5,_0x42e7f2){return function(_0x332006){if(_0x332006){return _0x332006['update'](_0xcd15e5)[_0x190b('0x22')](function(_0x2e633e){return _0x2e633e;});}return null;};}function removeEntity(_0x16e989,_0x292ce3){return function(_0x3b8c74){if(_0x3b8c74){return _0x3b8c74[_0x190b('0x23')]()[_0x190b('0x22')](function(){_0x16e989['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x262a63,_0x1a5f86){return function(_0x50605b){if(!_0x50605b){_0x262a63['sendStatus'](0x194);}return _0x50605b;};}function handleError(_0x3260d5,_0x4e2a93){_0x4e2a93=_0x4e2a93||0x1f4;return function(_0x328e5e){logger[_0x190b('0x24')](_0x328e5e['stack']);if(_0x328e5e[_0x190b('0x25')]){delete _0x328e5e[_0x190b('0x25')];}_0x3260d5['status'](_0x4e2a93)[_0x190b('0x26')](_0x328e5e);};}exports[_0x190b('0x27')]=function(_0x359b4a,_0x494f3f){var _0x536d7b={},_0x3730cc={},_0x4d5f3f={'count':0x0,'rows':[]};var _0x14be2c=_[_0x190b('0x28')](db['Integration'][_0x190b('0x29')],function(_0x580b92){return{'name':_0x580b92[_0x190b('0x2a')],'type':_0x580b92['type'][_0x190b('0x2b')]};});_0x3730cc['model']=_[_0x190b('0x28')](_0x14be2c,_0x190b('0x25'));_0x3730cc['query']=_[_0x190b('0x2c')](_0x359b4a[_0x190b('0x2d')]);_0x3730cc[_0x190b('0x2e')]=_[_0x190b('0x2f')](_0x3730cc[_0x190b('0x30')],_0x3730cc[_0x190b('0x2d')]);_0x536d7b[_0x190b('0x31')]=_[_0x190b('0x2f')](_0x3730cc['model'],qs['fields'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x32')]));_0x536d7b['attributes']=_0x536d7b[_0x190b('0x31')][_0x190b('0x33')]?_0x536d7b[_0x190b('0x31')]:_0x3730cc[_0x190b('0x30')];if(!_0x359b4a[_0x190b('0x2d')][_0x190b('0x34')](_0x190b('0x35'))){_0x536d7b['limit']=qs['limit'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x1f')]);_0x536d7b[_0x190b('0x1c')]=qs['offset'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x1c')]);}_0x536d7b[_0x190b('0x36')]=qs['sort'](_0x359b4a[_0x190b('0x2d')]['sort']);_0x536d7b['where']=qs[_0x190b('0x2e')](_[_0x190b('0x37')](_0x359b4a['query'],_0x3730cc[_0x190b('0x2e')]),_0x14be2c);if(_0x359b4a[_0x190b('0x2d')][_0x190b('0x38')]){_0x536d7b['where']=_[_0x190b('0x39')](_0x536d7b[_0x190b('0x3a')],{'$or':_['map'](_0x14be2c,function(_0x5d006d){if(_0x5d006d[_0x190b('0x3b')]!=='VIRTUAL'){var _0x46bdba={};_0x46bdba[_0x5d006d[_0x190b('0x25')]]={'$like':'%'+_0x359b4a[_0x190b('0x2d')][_0x190b('0x38')]+'%'};return _0x46bdba;}})});}_0x536d7b=_['merge']({},_0x536d7b,_0x359b4a[_0x190b('0x3c')]);var _0x5f118c={'where':_0x536d7b[_0x190b('0x3a')]};return db[_0x190b('0x3d')]['count'](_0x5f118c)[_0x190b('0x22')](function(_0x2a75d2){_0x4d5f3f[_0x190b('0x1e')]=_0x2a75d2;if(_0x359b4a['query'][_0x190b('0x3e')]){_0x536d7b['include']=[{'all':!![]}];}return db['Integration']['findAll'](_0x536d7b);})[_0x190b('0x22')](function(_0x3aef1d){_0x4d5f3f[_0x190b('0x3f')]=_0x3aef1d;return _0x4d5f3f;})[_0x190b('0x22')](respondWithFilteredResult(_0x494f3f,_0x536d7b))['catch'](handleError(_0x494f3f,null));};exports['show']=function(_0x4045b7,_0x492240){var _0x110891={'raw':![],'where':{'id':_0x4045b7['params']['id']}},_0x3d67f0={};_0x3d67f0[_0x190b('0x30')]=_[_0x190b('0x2c')](db[_0x190b('0x3d')]['rawAttributes']);_0x3d67f0[_0x190b('0x2d')]=_[_0x190b('0x2c')](_0x4045b7['query']);_0x3d67f0[_0x190b('0x2e')]=_['intersection'](_0x3d67f0[_0x190b('0x30')],_0x3d67f0[_0x190b('0x2d')]);_0x110891[_0x190b('0x31')]=_['intersection'](_0x3d67f0[_0x190b('0x30')],qs['fields'](_0x4045b7[_0x190b('0x2d')][_0x190b('0x32')]));_0x110891[_0x190b('0x31')]=_0x110891[_0x190b('0x31')][_0x190b('0x33')]?_0x110891[_0x190b('0x31')]:_0x3d67f0[_0x190b('0x30')];if(_0x4045b7['query'][_0x190b('0x3e')]){_0x110891[_0x190b('0x40')]=[{'all':!![]}];}_0x110891=_[_0x190b('0x39')]({},_0x110891,_0x4045b7['options']);return db[_0x190b('0x3d')][_0x190b('0x41')](_0x110891)[_0x190b('0x22')](handleEntityNotFound(_0x492240,null))[_0x190b('0x22')](respondWithResult(_0x492240,null))[_0x190b('0x42')](handleError(_0x492240,null));};exports['create']=function(_0x1f2262,_0xadc789){return db[_0x190b('0x3d')]['create'](_0x1f2262[_0x190b('0x43')],{})[_0x190b('0x22')](respondWithResult(_0xadc789,0xc9))[_0x190b('0x42')](handleError(_0xadc789,null));};exports['update']=function(_0x4cb561,_0x14958e){if(_0x4cb561[_0x190b('0x43')]['id']){delete _0x4cb561[_0x190b('0x43')]['id'];}return db[_0x190b('0x3d')][_0x190b('0x41')]({'where':{'id':_0x4cb561[_0x190b('0x44')]['id']}})['then'](handleEntityNotFound(_0x14958e,null))[_0x190b('0x22')](saveUpdates(_0x4cb561[_0x190b('0x43')],null))[_0x190b('0x22')](respondWithResult(_0x14958e,null))['catch'](handleError(_0x14958e,null));};exports[_0x190b('0x23')]=function(_0x38c135,_0x215ab6){return db['Integration'][_0x190b('0x41')]({'where':{'id':_0x38c135[_0x190b('0x44')]['id']}})[_0x190b('0x22')](handleEntityNotFound(_0x215ab6,null))[_0x190b('0x22')](removeEntity(_0x215ab6,null))[_0x190b('0x42')](handleError(_0x215ab6,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 9c24c8c..99fa6ac 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 _0x8174=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations','lodash'];(function(_0x27f48a,_0x5081e8){var _0x5a497b=function(_0x583d0c){while(--_0x583d0c){_0x27f48a['push'](_0x27f48a['shift']());}};_0x5a497b(++_0x5081e8);}(_0x8174,0xa8));var _0x4817=function(_0x342b40,_0x3bc1dd){_0x342b40=_0x342b40-0x0;var _0x370170=_0x8174[_0x342b40];return _0x370170;};'use strict';var _=require(_0x4817('0x0'));var util=require('util');var logger=require(_0x4817('0x1'))(_0x4817('0x2'));var moment=require(_0x4817('0x3'));var BPromise=require(_0x4817('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4817('0x5'));var rimraf=require(_0x4817('0x6'));var config=require(_0x4817('0x7'));var attributes=require(_0x4817('0x8'));module[_0x4817('0x9')]=function(_0x2cc60d,_0x20c744){return _0x2cc60d[_0x4817('0xa')](_0x4817('0xb'),attributes,{'tableName':_0x4817('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5bce=['exports','define','Integration','integrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./integration.attributes'];(function(_0x394f63,_0x34f396){var _0x3e940b=function(_0x4036b8){while(--_0x4036b8){_0x394f63['push'](_0x394f63['shift']());}};_0x3e940b(++_0x34f396);}(_0x5bce,0xfb));var _0xe5bc=function(_0x32b30c,_0x2d5ec8){_0x32b30c=_0x32b30c-0x0;var _0xcfc212=_0x5bce[_0x32b30c];return _0xcfc212;};'use strict';var _=require(_0xe5bc('0x0'));var util=require(_0xe5bc('0x1'));var logger=require(_0xe5bc('0x2'))(_0xe5bc('0x3'));var moment=require(_0xe5bc('0x4'));var BPromise=require(_0xe5bc('0x5'));var rp=require(_0xe5bc('0x6'));var fs=require('fs');var path=require(_0xe5bc('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe5bc('0x8'));module[_0xe5bc('0x9')]=function(_0x2c66fa,_0xdac508){return _0x2c66fa[_0xe5bc('0xa')](_0xe5bc('0xb'),attributes,{'tableName':_0xe5bc('0xc'),'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 fc69974..2b93f1d 100644 --- a/server/api/integration/integration.rpc.js +++ b/server/api/integration/integration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc6ac=['http','request','then','info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2cbfdf,_0x3123ce){var _0x31f1f2=function(_0x21c188){while(--_0x21c188){_0x2cbfdf['push'](_0x2cbfdf['shift']());}};_0x31f1f2(++_0x3123ce);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x289c73,_0x5a71a0){_0x289c73=_0x289c73-0x0;var _0x5d05ff=_0xc6ac[_0x289c73];return _0x5d05ff;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var moment=require(_0xcc6a('0x2'));var BPromise=require(_0xcc6a('0x3'));var rs=require(_0xcc6a('0x4'));var fs=require('fs');var Redis=require(_0xcc6a('0x5'));var db=require(_0xcc6a('0x6'))['db'];var utils=require(_0xcc6a('0x7'));var logger=require(_0xcc6a('0x8'))(_0xcc6a('0x9'));var config=require(_0xcc6a('0xa'));var jayson=require(_0xcc6a('0xb'));var client=jayson[_0xcc6a('0xc')][_0xcc6a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5f3887,_0x3dd497,_0x11b919){return new BPromise(function(_0xf02261,_0x560cc4){return client[_0xcc6a('0xe')](_0x5f3887,_0x11b919)[_0xcc6a('0xf')](function(_0x7806a0){logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,'request\x20sent');logger[_0xcc6a('0x12')](_0xcc6a('0x13'),_0x3dd497,_0xcc6a('0x14'),JSON['stringify'](_0x7806a0));if(_0x7806a0[_0xcc6a('0x15')]){if(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x16')]===0x1f4){logger['error']('Integration,\x20%s,\x20%s',_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0x560cc4(_0x7806a0[_0xcc6a('0x15')]['message']);}logger['error'](_0xcc6a('0x11'),_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0xf02261(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);}else{logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,_0xcc6a('0x14'));_0xf02261(_0x7806a0['result']['message']);}})['catch'](function(_0x395a55){logger[_0xcc6a('0x15')](_0xcc6a('0x11'),_0x3dd497,_0x395a55);_0x560cc4(_0x395a55);});});} \ No newline at end of file +var _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','Integration,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x26dcd8,_0x461d6b){var _0x1654e9=function(_0x29ab7b){while(--_0x29ab7b){_0x26dcd8['push'](_0x26dcd8['shift']());}};_0x1654e9(++_0x461d6b);}(_0x14a0,0x8e));var _0x014a=function(_0x1cb28a,_0x2d22a7){_0x1cb28a=_0x1cb28a-0x0;var _0xe9f9d4=_0x14a0[_0x1cb28a];return _0xe9f9d4;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('Integration,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('Integration,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('Integration,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index c6da52e..42b1110 100644 --- a/server/api/integrationReport/index.js +++ b/server/api/integrationReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4137=['show','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','/:id'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x4137,0xf8));var _0x7413=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x4137[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var path=require(_0x7413('0x2'));var timeout=require(_0x7413('0x3'));var express=require(_0x7413('0x4'));var router=express[_0x7413('0x5')]();var fs_extra=require(_0x7413('0x6'));var auth=require(_0x7413('0x7'));var interaction=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var controller=require(_0x7413('0xa'));router[_0x7413('0xb')]('/',auth['isAuthenticated'](),controller[_0x7413('0xc')]);router[_0x7413('0xb')](_0x7413('0xd'),auth[_0x7413('0xe')](),controller['describe']);router[_0x7413('0xb')](_0x7413('0xf'),auth['isAuthenticated'](),controller[_0x7413('0x10')]);router[_0x7413('0x11')]('/',auth['isAuthenticated'](),controller[_0x7413('0x12')]);router[_0x7413('0x13')](_0x7413('0xf'),auth[_0x7413('0xe')](),controller[_0x7413('0x14')]);router['delete'](_0x7413('0xf'),auth[_0x7413('0xe')](),controller['destroy']);module[_0x7413('0x15')]=router; \ No newline at end of file +var _0xe2fe=['describe','/:id','post','update','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x3f7861,_0x13619b){var _0x36fdae=function(_0x6aa7b8){while(--_0x6aa7b8){_0x3f7861['push'](_0x3f7861['shift']());}};_0x36fdae(++_0x13619b);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./integrationReport.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0xc')]('/',auth[_0xee2f('0x8')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xee2f('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xee2f('0xe')]);module[_0xee2f('0xf')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 7b6862c..d655df7 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 _0xe584=['BOOLEAN','TEXT','SENT','SENDING','sequelize','STRING','INTEGER','DATE'];(function(_0x456f76,_0x43cdb7){var _0x1d25e6=function(_0xdc84cb){while(--_0xdc84cb){_0x456f76['push'](_0x456f76['shift']());}};_0x1d25e6(++_0x43cdb7);}(_0xe584,0x14c));var _0x4e58=function(_0x59385f,_0x218c19){_0x59385f=_0x59385f-0x0;var _0x3502df=_0xe584[_0x59385f];return _0x3502df;};'use strict';var Sequelize=require(_0x4e58('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x4e58('0x1')]},'ticketId':{'type':Sequelize[_0x4e58('0x1')]},'integrationId':{'type':Sequelize[_0x4e58('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4e58('0x1')]},'calleridnum':{'type':Sequelize[_0x4e58('0x1')]},'calleridname':{'type':Sequelize[_0x4e58('0x1')]},'queue':{'type':Sequelize[_0x4e58('0x1')]},'interface':{'type':Sequelize[_0x4e58('0x1')]},'membername':{'type':Sequelize[_0x4e58('0x1')]},'agentcalledAt':{'type':Sequelize[_0x4e58('0x3')]},'agentconnectAt':{'type':Sequelize[_0x4e58('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x4e58('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x4e58('0x3')]},'talktime':{'type':Sequelize[_0x4e58('0x2')]},'agentacw':{'type':Sequelize[_0x4e58('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4e58('0x2')]},'reason':{'type':Sequelize[_0x4e58('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x4e58('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x4e58('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x4e58('0x3')]},'lastevent':{'type':Sequelize[_0x4e58('0x1')]},'channel':{'type':Sequelize[_0x4e58('0x1')]},'channelstate':{'type':Sequelize[_0x4e58('0x2')]},'channelstatedesc':{'type':Sequelize[_0x4e58('0x1')]},'connectedlinenum':{'type':Sequelize[_0x4e58('0x1')]},'connectedlinename':{'type':Sequelize[_0x4e58('0x1')]},'language':{'type':Sequelize[_0x4e58('0x1')]},'accountcode':{'type':Sequelize[_0x4e58('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x4e58('0x1')]},'priority':{'type':Sequelize[_0x4e58('0x1')]},'destchannel':{'type':Sequelize[_0x4e58('0x1')]},'destchannelstate':{'type':Sequelize[_0x4e58('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x4e58('0x1')]},'destcalleridnum':{'type':Sequelize[_0x4e58('0x1')]},'destcalleridname':{'type':Sequelize[_0x4e58('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x4e58('0x1')]},'destlanguage':{'type':Sequelize[_0x4e58('0x1')]},'destaccountcode':{'type':Sequelize[_0x4e58('0x1')]},'destcontext':{'type':Sequelize[_0x4e58('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x4e58('0x1')]},'destuniqueid':{'type':Sequelize[_0x4e58('0x1')]},'messageId':{'type':Sequelize[_0x4e58('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x4e58('0x1')]},'from':{'type':Sequelize[_0x4e58('0x1')]},'to':{'type':Sequelize[_0x4e58('0x1')]},'cc':{'type':Sequelize[_0x4e58('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x4e58('0x5')]},'status':{'type':Sequelize['ENUM'](_0x4e58('0x6'),_0x4e58('0x7'),'RECEIVED','FAILED')},'url':{'type':Sequelize[_0x4e58('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x4e58('0x1')]},'projectId':{'type':Sequelize[_0x4e58('0x2')]}}; \ No newline at end of file +var _0xf3b0=['DATE','BOOLEAN','TEXT','SENT','SENDING','RECEIVED','sequelize','exports','STRING','INTEGER'];(function(_0x2a0dc9,_0x3802f4){var _0x198be1=function(_0x154add){while(--_0x154add){_0x2a0dc9['push'](_0x2a0dc9['shift']());}};_0x198be1(++_0x3802f4);}(_0xf3b0,0x15a));var _0x0f3b=function(_0x29e3b6,_0x40b0b4){_0x29e3b6=_0x29e3b6-0x0;var _0x55d4b0=_0xf3b0[_0x29e3b6];return _0x55d4b0;};'use strict';var Sequelize=require(_0x0f3b('0x0'));module[_0x0f3b('0x1')]={'integration':{'type':Sequelize[_0x0f3b('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x0f3b('0x3')]},'contacts':{'type':Sequelize[_0x0f3b('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x0f3b('0x2')]},'calleridname':{'type':Sequelize[_0x0f3b('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x0f3b('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x0f3b('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x0f3b('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x0f3b('0x3')]},'reason':{'type':Sequelize[_0x0f3b('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x0f3b('0x4')]},'agentdump':{'type':Sequelize[_0x0f3b('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x0f3b('0x4')]},'lastevent':{'type':Sequelize[_0x0f3b('0x2')]},'channel':{'type':Sequelize[_0x0f3b('0x2')]},'channelstate':{'type':Sequelize[_0x0f3b('0x3')]},'channelstatedesc':{'type':Sequelize[_0x0f3b('0x2')]},'connectedlinenum':{'type':Sequelize[_0x0f3b('0x2')]},'connectedlinename':{'type':Sequelize[_0x0f3b('0x2')]},'language':{'type':Sequelize[_0x0f3b('0x2')]},'accountcode':{'type':Sequelize[_0x0f3b('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x0f3b('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x0f3b('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x0f3b('0x2')]},'destcalleridnum':{'type':Sequelize[_0x0f3b('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x0f3b('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x0f3b('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x0f3b('0x2')]},'destexten':{'type':Sequelize[_0x0f3b('0x2')]},'destpriority':{'type':Sequelize[_0x0f3b('0x2')]},'destuniqueid':{'type':Sequelize[_0x0f3b('0x2')]},'messageId':{'type':Sequelize[_0x0f3b('0x2')]},'inReplyTo':{'type':Sequelize[_0x0f3b('0x2')]},'subject':{'type':Sequelize[_0x0f3b('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x0f3b('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x0f3b('0x6')]},'html':{'type':Sequelize[_0x0f3b('0x6')]},'text':{'type':Sequelize[_0x0f3b('0x6')]},'status':{'type':Sequelize['ENUM'](_0x0f3b('0x7'),_0x0f3b('0x8'),_0x0f3b('0x9'),'FAILED')},'url':{'type':Sequelize[_0x0f3b('0x2')]},'app':{'type':Sequelize[_0x0f3b('0x2')]},'appdata':{'type':Sequelize[_0x0f3b('0x2')]},'projectId':{'type':Sequelize[_0x0f3b('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 615cd89..fe3561e 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 _0xdf90=['limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','IntegrationReport','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','catch','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined'];(function(_0x4df017,_0x2b1ce7){var _0x4f440d=function(_0x40945a){while(--_0x40945a){_0x4df017['push'](_0x4df017['shift']());}};_0x4f440d(++_0x2b1ce7);}(_0xdf90,0x148));var _0x0df9=function(_0x153c6a,_0x2a217a){_0x153c6a=_0x153c6a-0x0;var _0xce898f=_0xdf90[_0x153c6a];return _0xce898f;};'use strict';var emlformat=require(_0x0df9('0x0'));var rimraf=require(_0x0df9('0x1'));var zipdir=require(_0x0df9('0x2'));var jsonpatch=require(_0x0df9('0x3'));var rp=require(_0x0df9('0x4'));var moment=require(_0x0df9('0x5'));var BPromise=require(_0x0df9('0x6'));var Mustache=require(_0x0df9('0x7'));var util=require(_0x0df9('0x8'));var path=require('path');var sox=require(_0x0df9('0x9'));var csv=require(_0x0df9('0xa'));var ejs=require(_0x0df9('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0df9('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0df9('0xa'));var querystring=require('querystring');var Papa=require(_0x0df9('0xd'));var Redis=require(_0x0df9('0xe'));var authService=require(_0x0df9('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0df9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0df9('0x11'));var utils=require(_0x0df9('0x12'));var config=require(_0x0df9('0x13'));var licenseUtil=require(_0x0df9('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1aa819,_0x4cc7bb){_0x4cc7bb=_0x4cc7bb||0xcc;return function(_0x1c0ebe){if(_0x1c0ebe){return _0x1aa819[_0x0df9('0x15')](_0x4cc7bb);}return _0x1aa819[_0x0df9('0x16')](_0x4cc7bb)[_0x0df9('0x17')]();};}function respondWithResult(_0x5a66ed,_0x5db865){_0x5db865=_0x5db865||0xc8;return function(_0x4f7f4c){if(_0x4f7f4c){return _0x5a66ed[_0x0df9('0x16')](_0x5db865)[_0x0df9('0x18')](_0x4f7f4c);}};}function respondWithFilteredResult(_0x159528,_0x4fbb62){return function(_0x29c5a6){if(_0x29c5a6){var _0x48c932=typeof _0x4fbb62[_0x0df9('0x19')]===_0x0df9('0x1a')&&typeof _0x4fbb62[_0x0df9('0x1b')]===_0x0df9('0x1a');var _0x3482f7=_0x29c5a6[_0x0df9('0x1c')];var _0x530ef7=_0x48c932?0x0:_0x4fbb62[_0x0df9('0x19')];var _0x42ce42=_0x48c932?_0x29c5a6[_0x0df9('0x1c')]:_0x4fbb62[_0x0df9('0x19')]+_0x4fbb62[_0x0df9('0x1b')];var _0x23b756;if(_0x42ce42>=_0x3482f7){_0x42ce42=_0x3482f7;_0x23b756=0xc8;}else{_0x23b756=0xce;}_0x159528[_0x0df9('0x16')](_0x23b756);return _0x159528['set'](_0x0df9('0x1d'),_0x530ef7+'-'+_0x42ce42+'/'+_0x3482f7)[_0x0df9('0x18')](_0x29c5a6);}return null;};}function patchUpdates(_0x2a9bd7){return function(_0x556e06){try{jsonpatch[_0x0df9('0x1e')](_0x556e06,_0x2a9bd7,!![]);}catch(_0x295704){return BPromise[_0x0df9('0x1f')](_0x295704);}return _0x556e06[_0x0df9('0x20')]();};}function saveUpdates(_0x54b911,_0x17733b){return function(_0x475400){if(_0x475400){return _0x475400[_0x0df9('0x21')](_0x54b911)[_0x0df9('0x22')](function(_0x4c99b9){return _0x4c99b9;});}return null;};}function removeEntity(_0x170b98,_0x56269b){return function(_0x158e96){if(_0x158e96){return _0x158e96[_0x0df9('0x23')]()[_0x0df9('0x22')](function(){_0x170b98['status'](0xcc)[_0x0df9('0x17')]();});}};}function handleEntityNotFound(_0x5b2678,_0x57f13b){return function(_0x478eb6){if(!_0x478eb6){_0x5b2678[_0x0df9('0x15')](0x194);}return _0x478eb6;};}function handleError(_0x289f45,_0x538268){_0x538268=_0x538268||0x1f4;return function(_0x83a423){logger[_0x0df9('0x24')](_0x83a423[_0x0df9('0x25')]);if(_0x83a423['name']){delete _0x83a423[_0x0df9('0x26')];}_0x289f45[_0x0df9('0x16')](_0x538268)['send'](_0x83a423);};}exports[_0x0df9('0x27')]=function(_0xf2ddfd,_0x345138){var _0x460625={},_0x34c614={},_0x3bdbe0={'count':0x0,'rows':[]};var _0x2fd3c7=_[_0x0df9('0x28')](db[_0x0df9('0x29')][_0x0df9('0x2a')],function(_0x1ec7c0){return{'name':_0x1ec7c0['fieldName'],'type':_0x1ec7c0[_0x0df9('0x2b')][_0x0df9('0x2c')]};});_0x34c614['model']=_[_0x0df9('0x28')](_0x2fd3c7,_0x0df9('0x26'));_0x34c614[_0x0df9('0x2d')]=_[_0x0df9('0x2e')](_0xf2ddfd[_0x0df9('0x2d')]);_0x34c614['filters']=_[_0x0df9('0x2f')](_0x34c614[_0x0df9('0x30')],_0x34c614[_0x0df9('0x2d')]);_0x460625[_0x0df9('0x31')]=_[_0x0df9('0x2f')](_0x34c614[_0x0df9('0x30')],qs['fields'](_0xf2ddfd[_0x0df9('0x2d')][_0x0df9('0x32')]));_0x460625[_0x0df9('0x31')]=_0x460625[_0x0df9('0x31')]['length']?_0x460625['attributes']:_0x34c614[_0x0df9('0x30')];if(!_0xf2ddfd['query'][_0x0df9('0x33')](_0x0df9('0x34'))){_0x460625[_0x0df9('0x1b')]=qs[_0x0df9('0x1b')](_0xf2ddfd[_0x0df9('0x2d')]['limit']);_0x460625[_0x0df9('0x19')]=qs['offset'](_0xf2ddfd[_0x0df9('0x2d')][_0x0df9('0x19')]);}_0x460625[_0x0df9('0x35')]=qs['sort'](_0xf2ddfd[_0x0df9('0x2d')][_0x0df9('0x36')]);_0x460625[_0x0df9('0x37')]=qs[_0x0df9('0x38')](_[_0x0df9('0x39')](_0xf2ddfd[_0x0df9('0x2d')],_0x34c614[_0x0df9('0x38')]),_0x2fd3c7);if(_0xf2ddfd['query'][_0x0df9('0x3a')]){_0x460625[_0x0df9('0x37')]=_[_0x0df9('0x3b')](_0x460625[_0x0df9('0x37')],{'$or':_['map'](_0x2fd3c7,function(_0x1988a3){if(_0x1988a3['type']!=='VIRTUAL'){var _0x513d15={};_0x513d15[_0x1988a3['name']]={'$like':'%'+_0xf2ddfd[_0x0df9('0x2d')][_0x0df9('0x3a')]+'%'};return _0x513d15;}})});}_0x460625=_[_0x0df9('0x3b')]({},_0x460625,_0xf2ddfd[_0x0df9('0x3c')]);var _0x1cf005={'where':_0x460625['where']};return db[_0x0df9('0x29')]['count'](_0x1cf005)[_0x0df9('0x22')](function(_0x416b82){_0x3bdbe0[_0x0df9('0x1c')]=_0x416b82;if(_0xf2ddfd[_0x0df9('0x2d')][_0x0df9('0x3d')]){_0x460625[_0x0df9('0x3e')]=[{'all':!![]}];}return db['IntegrationReport'][_0x0df9('0x3f')](_0x460625);})[_0x0df9('0x22')](function(_0x4a0a22){_0x3bdbe0['rows']=_0x4a0a22;return _0x3bdbe0;})[_0x0df9('0x22')](respondWithFilteredResult(_0x345138,_0x460625))[_0x0df9('0x40')](handleError(_0x345138,null));};exports['show']=function(_0x4ff392,_0x4c0c76){var _0x5e83f6={'raw':![],'where':{'id':_0x4ff392[_0x0df9('0x41')]['id']}},_0x5015bb={};_0x5015bb['model']=_[_0x0df9('0x2e')](db['IntegrationReport'][_0x0df9('0x2a')]);_0x5015bb[_0x0df9('0x2d')]=_['keys'](_0x4ff392[_0x0df9('0x2d')]);_0x5015bb[_0x0df9('0x38')]=_[_0x0df9('0x2f')](_0x5015bb[_0x0df9('0x30')],_0x5015bb[_0x0df9('0x2d')]);_0x5e83f6[_0x0df9('0x31')]=_['intersection'](_0x5015bb[_0x0df9('0x30')],qs[_0x0df9('0x32')](_0x4ff392[_0x0df9('0x2d')]['fields']));_0x5e83f6[_0x0df9('0x31')]=_0x5e83f6[_0x0df9('0x31')][_0x0df9('0x42')]?_0x5e83f6[_0x0df9('0x31')]:_0x5015bb[_0x0df9('0x30')];if(_0x4ff392[_0x0df9('0x2d')][_0x0df9('0x3d')]){_0x5e83f6[_0x0df9('0x3e')]=[{'all':!![]}];}_0x5e83f6=_[_0x0df9('0x3b')]({},_0x5e83f6,_0x4ff392['options']);return db[_0x0df9('0x29')][_0x0df9('0x43')](_0x5e83f6)[_0x0df9('0x22')](handleEntityNotFound(_0x4c0c76,null))[_0x0df9('0x22')](respondWithResult(_0x4c0c76,null))[_0x0df9('0x40')](handleError(_0x4c0c76,null));};exports[_0x0df9('0x44')]=function(_0x1b453e,_0x103888){return db['IntegrationReport'][_0x0df9('0x44')](_0x1b453e[_0x0df9('0x45')],{})[_0x0df9('0x22')](respondWithResult(_0x103888,0xc9))['catch'](handleError(_0x103888,null));};exports['update']=function(_0x7a3d74,_0x3bdd1a){if(_0x7a3d74[_0x0df9('0x45')]['id']){delete _0x7a3d74[_0x0df9('0x45')]['id'];}return db[_0x0df9('0x29')][_0x0df9('0x43')]({'where':{'id':_0x7a3d74[_0x0df9('0x41')]['id']}})[_0x0df9('0x22')](handleEntityNotFound(_0x3bdd1a,null))[_0x0df9('0x22')](saveUpdates(_0x7a3d74[_0x0df9('0x45')],null))[_0x0df9('0x22')](respondWithResult(_0x3bdd1a,null))[_0x0df9('0x40')](handleError(_0x3bdd1a,null));};exports[_0x0df9('0x23')]=function(_0x5dfe51,_0x1ea2ec){return db[_0x0df9('0x29')][_0x0df9('0x43')]({'where':{'id':_0x5dfe51['params']['id']}})[_0x0df9('0x22')](handleEntityNotFound(_0x1ea2ec,null))[_0x0df9('0x22')](removeEntity(_0x1ea2ec,null))['catch'](handleError(_0x1ea2ec,null));};exports[_0x0df9('0x46')]=function(_0x43f5ba,_0x59a5ee){return db[_0x0df9('0x29')][_0x0df9('0x46')]()['then'](respondWithResult(_0x59a5ee,null))[_0x0df9('0x40')](handleError(_0x59a5ee,null));}; \ No newline at end of file +var _0x4cb7=['sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','end','stack','name','send','map','IntegrationReport','fieldName','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','params','keys','include','create','body','update','find','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment'];(function(_0xde092d,_0x58e6a3){var _0x204466=function(_0x4a495c){while(--_0x4a495c){_0xde092d['push'](_0xde092d['shift']());}};_0x204466(++_0x58e6a3);}(_0x4cb7,0x1c7));var _0x74cb=function(_0xabe055,_0x2b7883){_0xabe055=_0xabe055-0x0;var _0x3ebfc=_0x4cb7[_0xabe055];return _0x3ebfc;};'use strict';var emlformat=require(_0x74cb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x74cb('0x1'));var rp=require(_0x74cb('0x2'));var moment=require(_0x74cb('0x3'));var BPromise=require(_0x74cb('0x4'));var Mustache=require(_0x74cb('0x5'));var util=require(_0x74cb('0x6'));var path=require(_0x74cb('0x7'));var sox=require(_0x74cb('0x8'));var csv=require(_0x74cb('0x9'));var ejs=require(_0x74cb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x74cb('0xb'));var squel=require('squel');var crypto=require(_0x74cb('0xc'));var jsforce=require(_0x74cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x74cb('0x9'));var querystring=require(_0x74cb('0xe'));var Papa=require('papaparse');var Redis=require(_0x74cb('0xf'));var authService=require(_0x74cb('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x74cb('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x74cb('0x12'))(_0x74cb('0x13'));var utils=require('../../config/utils');var config=require(_0x74cb('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ca8ac,_0x2784e3){_0x2784e3=_0x2784e3||0xcc;return function(_0x2eb3b2){if(_0x2eb3b2){return _0x1ca8ac[_0x74cb('0x15')](_0x2784e3);}return _0x1ca8ac[_0x74cb('0x16')](_0x2784e3)['end']();};}function respondWithResult(_0x1d0e51,_0x3d3ea6){_0x3d3ea6=_0x3d3ea6||0xc8;return function(_0x40a34a){if(_0x40a34a){return _0x1d0e51[_0x74cb('0x16')](_0x3d3ea6)[_0x74cb('0x17')](_0x40a34a);}};}function respondWithFilteredResult(_0x5d9ef4,_0x228500){return function(_0x40dd6a){if(_0x40dd6a){var _0x24c640=typeof _0x228500[_0x74cb('0x18')]==='undefined'&&typeof _0x228500[_0x74cb('0x19')]===_0x74cb('0x1a');var _0x2a1c3f=_0x40dd6a[_0x74cb('0x1b')];var _0xf42c5e=_0x24c640?0x0:_0x228500[_0x74cb('0x18')];var _0xeb06f6=_0x24c640?_0x40dd6a[_0x74cb('0x1b')]:_0x228500['offset']+_0x228500['limit'];var _0x3928d1;if(_0xeb06f6>=_0x2a1c3f){_0xeb06f6=_0x2a1c3f;_0x3928d1=0xc8;}else{_0x3928d1=0xce;}_0x5d9ef4[_0x74cb('0x16')](_0x3928d1);return _0x5d9ef4[_0x74cb('0x1c')](_0x74cb('0x1d'),_0xf42c5e+'-'+_0xeb06f6+'/'+_0x2a1c3f)['json'](_0x40dd6a);}return null;};}function patchUpdates(_0x445dec){return function(_0x3a5148){try{jsonpatch['apply'](_0x3a5148,_0x445dec,!![]);}catch(_0x58a9db){return BPromise[_0x74cb('0x1e')](_0x58a9db);}return _0x3a5148[_0x74cb('0x1f')]();};}function saveUpdates(_0x5d4148,_0x3284d4){return function(_0x3e2fa9){if(_0x3e2fa9){return _0x3e2fa9['update'](_0x5d4148)[_0x74cb('0x20')](function(_0x4bc3f6){return _0x4bc3f6;});}return null;};}function removeEntity(_0x11ead1,_0x414ce0){return function(_0x314fe5){if(_0x314fe5){return _0x314fe5['destroy']()[_0x74cb('0x20')](function(){_0x11ead1['status'](0xcc)[_0x74cb('0x21')]();});}};}function handleEntityNotFound(_0xf5cddb,_0x16faa9){return function(_0x299284){if(!_0x299284){_0xf5cddb['sendStatus'](0x194);}return _0x299284;};}function handleError(_0x1a9317,_0x26f5ad){_0x26f5ad=_0x26f5ad||0x1f4;return function(_0x1651e2){logger['error'](_0x1651e2[_0x74cb('0x22')]);if(_0x1651e2['name']){delete _0x1651e2[_0x74cb('0x23')];}_0x1a9317[_0x74cb('0x16')](_0x26f5ad)[_0x74cb('0x24')](_0x1651e2);};}exports['index']=function(_0x1d8233,_0x4504fc){var _0x5896b3={},_0x373215={},_0x3e9fa0={'count':0x0,'rows':[]};var _0x5749fa=_[_0x74cb('0x25')](db[_0x74cb('0x26')]['rawAttributes'],function(_0x3b17df){return{'name':_0x3b17df[_0x74cb('0x27')],'type':_0x3b17df['type'][_0x74cb('0x28')]};});_0x373215['model']=_['map'](_0x5749fa,_0x74cb('0x23'));_0x373215[_0x74cb('0x29')]=_['keys'](_0x1d8233['query']);_0x373215[_0x74cb('0x2a')]=_[_0x74cb('0x2b')](_0x373215[_0x74cb('0x2c')],_0x373215[_0x74cb('0x29')]);_0x5896b3['attributes']=_[_0x74cb('0x2b')](_0x373215[_0x74cb('0x2c')],qs[_0x74cb('0x2d')](_0x1d8233['query'][_0x74cb('0x2d')]));_0x5896b3[_0x74cb('0x2e')]=_0x5896b3[_0x74cb('0x2e')][_0x74cb('0x2f')]?_0x5896b3[_0x74cb('0x2e')]:_0x373215[_0x74cb('0x2c')];if(!_0x1d8233[_0x74cb('0x29')][_0x74cb('0x30')]('nolimit')){_0x5896b3[_0x74cb('0x19')]=qs[_0x74cb('0x19')](_0x1d8233[_0x74cb('0x29')][_0x74cb('0x19')]);_0x5896b3[_0x74cb('0x18')]=qs[_0x74cb('0x18')](_0x1d8233[_0x74cb('0x29')][_0x74cb('0x18')]);}_0x5896b3['order']=qs['sort'](_0x1d8233[_0x74cb('0x29')][_0x74cb('0x31')]);_0x5896b3['where']=qs[_0x74cb('0x2a')](_[_0x74cb('0x32')](_0x1d8233['query'],_0x373215['filters']),_0x5749fa);if(_0x1d8233[_0x74cb('0x29')]['filter']){_0x5896b3[_0x74cb('0x33')]=_[_0x74cb('0x34')](_0x5896b3[_0x74cb('0x33')],{'$or':_[_0x74cb('0x25')](_0x5749fa,function(_0x35e1b6){if(_0x35e1b6['type']!==_0x74cb('0x35')){var _0x4254a5={};_0x4254a5[_0x35e1b6[_0x74cb('0x23')]]={'$like':'%'+_0x1d8233[_0x74cb('0x29')][_0x74cb('0x36')]+'%'};return _0x4254a5;}})});}_0x5896b3=_[_0x74cb('0x34')]({},_0x5896b3,_0x1d8233[_0x74cb('0x37')]);var _0x35f587={'where':_0x5896b3['where']};return db['IntegrationReport'][_0x74cb('0x1b')](_0x35f587)[_0x74cb('0x20')](function(_0x55be38){_0x3e9fa0[_0x74cb('0x1b')]=_0x55be38;if(_0x1d8233['query'][_0x74cb('0x38')]){_0x5896b3['include']=[{'all':!![]}];}return db[_0x74cb('0x26')]['findAll'](_0x5896b3);})[_0x74cb('0x20')](function(_0x1c4631){_0x3e9fa0[_0x74cb('0x39')]=_0x1c4631;return _0x3e9fa0;})[_0x74cb('0x20')](respondWithFilteredResult(_0x4504fc,_0x5896b3))[_0x74cb('0x3a')](handleError(_0x4504fc,null));};exports[_0x74cb('0x3b')]=function(_0x4853da,_0x235367){var _0x514522={'raw':![],'where':{'id':_0x4853da[_0x74cb('0x3c')]['id']}},_0x2fb2a3={};_0x2fb2a3[_0x74cb('0x2c')]=_['keys'](db['IntegrationReport']['rawAttributes']);_0x2fb2a3[_0x74cb('0x29')]=_[_0x74cb('0x3d')](_0x4853da[_0x74cb('0x29')]);_0x2fb2a3[_0x74cb('0x2a')]=_['intersection'](_0x2fb2a3[_0x74cb('0x2c')],_0x2fb2a3[_0x74cb('0x29')]);_0x514522[_0x74cb('0x2e')]=_[_0x74cb('0x2b')](_0x2fb2a3[_0x74cb('0x2c')],qs[_0x74cb('0x2d')](_0x4853da['query'][_0x74cb('0x2d')]));_0x514522[_0x74cb('0x2e')]=_0x514522[_0x74cb('0x2e')][_0x74cb('0x2f')]?_0x514522[_0x74cb('0x2e')]:_0x2fb2a3['model'];if(_0x4853da[_0x74cb('0x29')][_0x74cb('0x38')]){_0x514522[_0x74cb('0x3e')]=[{'all':!![]}];}_0x514522=_['merge']({},_0x514522,_0x4853da[_0x74cb('0x37')]);return db[_0x74cb('0x26')]['find'](_0x514522)[_0x74cb('0x20')](handleEntityNotFound(_0x235367,null))[_0x74cb('0x20')](respondWithResult(_0x235367,null))[_0x74cb('0x3a')](handleError(_0x235367,null));};exports['create']=function(_0x4f670d,_0x387246){return db[_0x74cb('0x26')][_0x74cb('0x3f')](_0x4f670d[_0x74cb('0x40')],{})[_0x74cb('0x20')](respondWithResult(_0x387246,0xc9))[_0x74cb('0x3a')](handleError(_0x387246,null));};exports[_0x74cb('0x41')]=function(_0x1445d6,_0x540301){if(_0x1445d6[_0x74cb('0x40')]['id']){delete _0x1445d6['body']['id'];}return db[_0x74cb('0x26')]['find']({'where':{'id':_0x1445d6[_0x74cb('0x3c')]['id']}})[_0x74cb('0x20')](handleEntityNotFound(_0x540301,null))['then'](saveUpdates(_0x1445d6[_0x74cb('0x40')],null))[_0x74cb('0x20')](respondWithResult(_0x540301,null))[_0x74cb('0x3a')](handleError(_0x540301,null));};exports['destroy']=function(_0x4edd1c,_0x1dcdf0){return db[_0x74cb('0x26')][_0x74cb('0x42')]({'where':{'id':_0x4edd1c['params']['id']}})[_0x74cb('0x20')](handleEntityNotFound(_0x1dcdf0,null))['then'](removeEntity(_0x1dcdf0,null))['catch'](handleError(_0x1dcdf0,null));};exports[_0x74cb('0x43')]=function(_0x5ad718,_0x50b5f5){return db[_0x74cb('0x26')][_0x74cb('0x43')]()[_0x74cb('0x20')](respondWithResult(_0x50b5f5,null))['catch'](handleError(_0x50b5f5,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 01cdb85..f6dd95d 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 _0x91c6=['request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','util','api','bluebird'];(function(_0x4e71cf,_0x40be23){var _0x27e7a5=function(_0x70d714){while(--_0x70d714){_0x4e71cf['push'](_0x4e71cf['shift']());}};_0x27e7a5(++_0x40be23);}(_0x91c6,0x129));var _0x691c=function(_0x3c0672,_0x31b3d9){_0x3c0672=_0x3c0672-0x0;var _0x2cef4d=_0x91c6[_0x3c0672];return _0x2cef4d;};'use strict';var _=require('lodash');var util=require(_0x691c('0x0'));var logger=require('../../config/logger')(_0x691c('0x1'));var moment=require('moment');var BPromise=require(_0x691c('0x2'));var rp=require(_0x691c('0x3'));var fs=require('fs');var path=require(_0x691c('0x4'));var rimraf=require(_0x691c('0x5'));var config=require(_0x691c('0x6'));var attributes=require(_0x691c('0x7'));module[_0x691c('0x8')]=function(_0x447bb8,_0x11843f){return _0x447bb8[_0x691c('0x9')](_0x691c('0xa'),attributes,{'tableName':_0x691c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2bc5=['define','IntegrationReport','report_integration','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./integrationReport.attributes','exports'];(function(_0x4a1d87,_0x69e5c9){var _0x3caade=function(_0x174f07){while(--_0x174f07){_0x4a1d87['push'](_0x4a1d87['shift']());}};_0x3caade(++_0x69e5c9);}(_0x2bc5,0x6f));var _0x52bc=function(_0x49a91f,_0x32339c){_0x49a91f=_0x49a91f-0x0;var _0x45243c=_0x2bc5[_0x49a91f];return _0x45243c;};'use strict';var _=require(_0x52bc('0x0'));var util=require('util');var logger=require(_0x52bc('0x1'))('api');var moment=require(_0x52bc('0x2'));var BPromise=require(_0x52bc('0x3'));var rp=require(_0x52bc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x52bc('0x5'));var config=require(_0x52bc('0x6'));var attributes=require(_0x52bc('0x7'));module[_0x52bc('0x8')]=function(_0x17e938,_0xa5abb9){return _0x17e938[_0x52bc('0x9')](_0x52bc('0xa'),attributes,{'tableName':_0x52bc('0xb'),'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 a5d7c69..978d6d9 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 _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x53ec,0x192));var _0xc53e=function(_0x2c24b8,_0x168e0b){_0x2c24b8=_0x2c24b8-0x0;var _0x563ed6=_0x53ec[_0x2c24b8];return _0x563ed6;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file +var _0x31f0=['../../config/environment','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x546895,_0xb414da){var _0x3b5a09=function(_0x1da01c){while(--_0x1da01c){_0x546895['push'](_0x546895['shift']());}};_0x3b5a09(++_0xb414da);}(_0x31f0,0xb7));var _0x031f=function(_0x142392,_0xb80a2c){_0x142392=_0x142392-0x0;var _0x235df3=_0x31f0[_0x142392];return _0x235df3;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var moment=require(_0x031f('0x1'));var BPromise=require('bluebird');var rs=require(_0x031f('0x2'));var fs=require('fs');var Redis=require(_0x031f('0x3'));var db=require(_0x031f('0x4'))['db'];var utils=require(_0x031f('0x5'));var logger=require('../../config/logger')(_0x031f('0x6'));var config=require(_0x031f('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3dc98e,_0x487e65,_0x365f59){return new BPromise(function(_0x4300b4,_0x2569b6){return client[_0x031f('0x8')](_0x3dc98e,_0x365f59)['then'](function(_0x2e5624){logger[_0x031f('0x9')](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));logger[_0x031f('0xc')](_0x031f('0xd'),_0x487e65,_0x031f('0xb'),JSON[_0x031f('0xe')](_0x2e5624));if(_0x2e5624['error']){if(_0x2e5624[_0x031f('0xf')][_0x031f('0x10')]===0x1f4){logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x2569b6(_0x2e5624[_0x031f('0xf')]['message']);}logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x4300b4(_0x2e5624[_0x031f('0xf')]['message']);}else{logger['info'](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));_0x4300b4(_0x2e5624[_0x031f('0x12')][_0x031f('0x11')]);}})['catch'](function(_0x1dc4a7){logger[_0x031f('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x487e65,_0x1dc4a7);_0x2569b6(_0x1dc4a7);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index d6d4dcf..7cfb11c 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 _0x43ef=['index','show','getIntervals','post','addInterval','addIntervals','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x40ed0e,_0xd9a1c9){var _0x206df4=function(_0x5c07cb){while(--_0x5c07cb){_0x40ed0e['push'](_0x40ed0e['shift']());}};_0x206df4(++_0xd9a1c9);}(_0x43ef,0x19a));var _0xf43e=function(_0x59bfd0,_0x5a2f99){_0x59bfd0=_0x59bfd0-0x0;var _0x1178ff=_0x43ef[_0x59bfd0];return _0x1178ff;};'use strict';var multer=require(_0xf43e('0x0'));var util=require(_0xf43e('0x1'));var path=require('path');var timeout=require(_0xf43e('0x2'));var express=require(_0xf43e('0x3'));var router=express[_0xf43e('0x4')]();var fs_extra=require(_0xf43e('0x5'));var auth=require(_0xf43e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf43e('0x7'));var controller=require('./interval.controller');router[_0xf43e('0x8')]('/',auth[_0xf43e('0x9')](),controller[_0xf43e('0xa')]);router[_0xf43e('0x8')]('/:id',auth[_0xf43e('0x9')](),controller[_0xf43e('0xb')]);router[_0xf43e('0x8')]('/:id/sub_intervals',auth[_0xf43e('0x9')](),controller[_0xf43e('0xc')]);router['post']('/',auth[_0xf43e('0x9')](),controller['create']);router[_0xf43e('0xd')]('/:id/sub_intervals',auth[_0xf43e('0x9')](),controller[_0xf43e('0xe')]);router['post']('/:id/sub_intervals/create_many',auth[_0xf43e('0x9')](),controller[_0xf43e('0xf')]);router[_0xf43e('0x10')](_0xf43e('0x11'),auth[_0xf43e('0x9')](),controller[_0xf43e('0x12')]);router[_0xf43e('0x13')](_0xf43e('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0xf43e('0x14')]=router; \ No newline at end of file +var _0x00b3=['getIntervals','post','addInterval','addIntervals','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./interval.controller','isAuthenticated','index','get','/:id','/:id/sub_intervals'];(function(_0x37b546,_0x8c85de){var _0x24a3b5=function(_0x337bc5){while(--_0x337bc5){_0x37b546['push'](_0x37b546['shift']());}};_0x24a3b5(++_0x8c85de);}(_0x00b3,0x157));var _0x300b=function(_0x1ab50f,_0x24ccfa){_0x1ab50f=_0x1ab50f-0x0;var _0x212551=_0x00b3[_0x1ab50f];return _0x212551;};'use strict';var multer=require(_0x300b('0x0'));var util=require(_0x300b('0x1'));var path=require(_0x300b('0x2'));var timeout=require(_0x300b('0x3'));var express=require(_0x300b('0x4'));var router=express[_0x300b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x300b('0x6'));var interaction=require(_0x300b('0x7'));var config=require('../../config/environment');var controller=require(_0x300b('0x8'));router['get']('/',auth[_0x300b('0x9')](),controller[_0x300b('0xa')]);router[_0x300b('0xb')](_0x300b('0xc'),auth[_0x300b('0x9')](),controller['show']);router[_0x300b('0xb')](_0x300b('0xd'),auth[_0x300b('0x9')](),controller[_0x300b('0xe')]);router[_0x300b('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x300b('0xf')](_0x300b('0xd'),auth['isAuthenticated'](),controller[_0x300b('0x10')]);router[_0x300b('0xf')]('/:id/sub_intervals/create_many',auth[_0x300b('0x9')](),controller[_0x300b('0x11')]);router[_0x300b('0x12')](_0x300b('0xc'),auth[_0x300b('0x9')](),controller[_0x300b('0x13')]);router[_0x300b('0x14')](_0x300b('0xc'),auth[_0x300b('0x9')](),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 76f9734..ce11e7a 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 _0x2ed4=['STRING','sequelize'];(function(_0x4d05a0,_0x53aa7e){var _0x4c999c=function(_0x358867){while(--_0x358867){_0x4d05a0['push'](_0x4d05a0['shift']());}};_0x4c999c(++_0x53aa7e);}(_0x2ed4,0x131));var _0x42ed=function(_0x59d0cc,_0xa7c52b){_0x59d0cc=_0x59d0cc-0x0;var _0x2ae79f=_0x2ed4[_0x59d0cc];return _0x2ae79f;};'use strict';var Sequelize=require(_0x42ed('0x0'));module['exports']={'name':{'type':Sequelize[_0x42ed('0x1')]},'description':{'type':Sequelize[_0x42ed('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xd50b=['STRING','exports'];(function(_0x5e8460,_0x2003b5){var _0x3d50fd=function(_0x4c499f){while(--_0x4c499f){_0x5e8460['push'](_0x5e8460['shift']());}};_0x3d50fd(++_0x2003b5);}(_0xd50b,0x1db));var _0xbd50=function(_0x2126c7,_0x5cd37f){_0x2126c7=_0x2126c7-0x0;var _0x2d91f4=_0xd50b[_0x2126c7];return _0x2d91f4;};'use strict';var Sequelize=require('sequelize');module[_0xbd50('0x0')]={'name':{'type':Sequelize[_0xbd50('0x1')]},'description':{'type':Sequelize[_0xbd50('0x1')]},'interval':{'type':Sequelize[_0xbd50('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index d460f34..bef36c0 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 _0x1ce1=['get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','addIntervals','sequelize','transaction','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','end','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','length','catch','create','body','user'];(function(_0x46cd01,_0x49ba4d){var _0x55dddd=function(_0x3b508e){while(--_0x3b508e){_0x46cd01['push'](_0x46cd01['shift']());}};_0x55dddd(++_0x49ba4d);}(_0x1ce1,0xc8));var _0x11ce=function(_0x5bfed0,_0x255c0d){_0x5bfed0=_0x5bfed0-0x0;var _0x439d92=_0x1ce1[_0x5bfed0];return _0x439d92;};'use strict';var emlformat=require(_0x11ce('0x0'));var rimraf=require(_0x11ce('0x1'));var zipdir=require(_0x11ce('0x2'));var jsonpatch=require(_0x11ce('0x3'));var rp=require(_0x11ce('0x4'));var moment=require(_0x11ce('0x5'));var BPromise=require(_0x11ce('0x6'));var Mustache=require(_0x11ce('0x7'));var util=require(_0x11ce('0x8'));var path=require(_0x11ce('0x9'));var sox=require(_0x11ce('0xa'));var csv=require('to-csv');var ejs=require(_0x11ce('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x11ce('0xc'));var crypto=require(_0x11ce('0xd'));var jsforce=require(_0x11ce('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x11ce('0xf'));var querystring=require(_0x11ce('0x10'));var Papa=require(_0x11ce('0x11'));var Redis=require(_0x11ce('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x11ce('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x11ce('0x14'));var utils=require(_0x11ce('0x15'));var config=require(_0x11ce('0x16'));var licenseUtil=require(_0x11ce('0x17'));var db=require(_0x11ce('0x18'))['db'];var extensions=require(_0x11ce('0x19'));function respondWithStatusCode(_0x2507fb,_0x1e4711){_0x1e4711=_0x1e4711||0xcc;return function(_0x400177){if(_0x400177){return _0x2507fb[_0x11ce('0x1a')](_0x1e4711);}return _0x2507fb[_0x11ce('0x1b')](_0x1e4711)['end']();};}function respondWithResult(_0x436efe,_0x5a6a79){_0x5a6a79=_0x5a6a79||0xc8;return function(_0xe051d0){if(_0xe051d0){return _0x436efe[_0x11ce('0x1b')](_0x5a6a79)[_0x11ce('0x1c')](_0xe051d0);}};}function respondWithFilteredResult(_0x32c351,_0x10916a){return function(_0x4299ae){if(_0x4299ae){var _0x4781b7=typeof _0x10916a[_0x11ce('0x1d')]===_0x11ce('0x1e')&&typeof _0x10916a[_0x11ce('0x1f')]===_0x11ce('0x1e');var _0x2aa157=_0x4299ae[_0x11ce('0x20')];var _0x32bab6=_0x4781b7?0x0:_0x10916a[_0x11ce('0x1d')];var _0xf4d474=_0x4781b7?_0x4299ae[_0x11ce('0x20')]:_0x10916a[_0x11ce('0x1d')]+_0x10916a[_0x11ce('0x1f')];var _0xfec129;if(_0xf4d474>=_0x2aa157){_0xf4d474=_0x2aa157;_0xfec129=0xc8;}else{_0xfec129=0xce;}_0x32c351[_0x11ce('0x1b')](_0xfec129);return _0x32c351[_0x11ce('0x21')](_0x11ce('0x22'),_0x32bab6+'-'+_0xf4d474+'/'+_0x2aa157)[_0x11ce('0x1c')](_0x4299ae);}return null;};}function patchUpdates(_0x85a39f){return function(_0x190ed2){try{jsonpatch[_0x11ce('0x23')](_0x190ed2,_0x85a39f,!![]);}catch(_0x506d20){return BPromise[_0x11ce('0x24')](_0x506d20);}return _0x190ed2[_0x11ce('0x25')]();};}function saveUpdates(_0x42181a,_0x1973a8){return function(_0x46e632){if(_0x46e632){return _0x46e632[_0x11ce('0x26')](_0x42181a)[_0x11ce('0x27')](function(_0x5f1466){return _0x5f1466;});}return null;};}function removeEntity(_0x496169,_0x41b2a5){return function(_0x2e26a8){if(_0x2e26a8){return _0x2e26a8[_0x11ce('0x28')]()[_0x11ce('0x27')](function(){var _0x59b7d7=_0x2e26a8['get']({'plain':!![]});var _0x2517f0='Intervals';return db[_0x11ce('0x29')]['destroy']({'where':{'type':_0x2517f0,'resourceId':_0x59b7d7['id']}})['then'](function(){return _0x2e26a8;});})[_0x11ce('0x27')](function(){_0x496169['status'](0xcc)[_0x11ce('0x2a')]();});}};}function handleEntityNotFound(_0x3e2bc0,_0xe1e42){return function(_0x1724d5){if(!_0x1724d5){_0x3e2bc0[_0x11ce('0x1a')](0x194);}return _0x1724d5;};}function handleError(_0x3b4283,_0x17f8f3){_0x17f8f3=_0x17f8f3||0x1f4;return function(_0x4dff41){logger[_0x11ce('0x2b')](_0x4dff41[_0x11ce('0x2c')]);if(_0x4dff41[_0x11ce('0x2d')]){delete _0x4dff41['name'];}_0x3b4283[_0x11ce('0x1b')](_0x17f8f3)[_0x11ce('0x2e')](_0x4dff41);};}exports[_0x11ce('0x2f')]=function(_0x400cce,_0x4ec450){var _0x3e319f={},_0x55d126={},_0x1c4160={'count':0x0,'rows':[]};var _0x414fee=_[_0x11ce('0x30')](db[_0x11ce('0x31')][_0x11ce('0x32')],function(_0x496a90){return{'name':_0x496a90[_0x11ce('0x33')],'type':_0x496a90[_0x11ce('0x34')][_0x11ce('0x35')]};});_0x55d126['model']=_[_0x11ce('0x30')](_0x414fee,_0x11ce('0x2d'));_0x55d126['query']=_[_0x11ce('0x36')](_0x400cce['query']);_0x55d126[_0x11ce('0x37')]=_[_0x11ce('0x38')](_0x55d126[_0x11ce('0x39')],_0x55d126[_0x11ce('0x3a')]);_0x3e319f[_0x11ce('0x3b')]=_[_0x11ce('0x38')](_0x55d126[_0x11ce('0x39')],qs['fields'](_0x400cce[_0x11ce('0x3a')][_0x11ce('0x3c')]));_0x3e319f['attributes']=_0x3e319f['attributes']['length']?_0x3e319f[_0x11ce('0x3b')]:_0x55d126[_0x11ce('0x39')];if(!_0x400cce['query'][_0x11ce('0x3d')]('nolimit')){_0x3e319f[_0x11ce('0x1f')]=qs['limit'](_0x400cce['query'][_0x11ce('0x1f')]);_0x3e319f[_0x11ce('0x1d')]=qs['offset'](_0x400cce[_0x11ce('0x3a')][_0x11ce('0x1d')]);}_0x3e319f[_0x11ce('0x3e')]=qs[_0x11ce('0x3f')](_0x400cce[_0x11ce('0x3a')][_0x11ce('0x3f')]);_0x3e319f[_0x11ce('0x40')]=qs['filters'](_[_0x11ce('0x41')](_0x400cce[_0x11ce('0x3a')],_0x55d126[_0x11ce('0x37')]),_0x414fee);if(_0x400cce[_0x11ce('0x3a')][_0x11ce('0x42')]){_0x3e319f[_0x11ce('0x40')]=_[_0x11ce('0x43')](_0x3e319f[_0x11ce('0x40')],{'$or':_[_0x11ce('0x30')](_0x414fee,function(_0x404a84){if(_0x404a84[_0x11ce('0x34')]!=='VIRTUAL'){var _0x5e53b7={};_0x5e53b7[_0x404a84['name']]={'$like':'%'+_0x400cce[_0x11ce('0x3a')][_0x11ce('0x42')]+'%'};return _0x5e53b7;}})});}_0x3e319f=_['merge']({},_0x3e319f,_0x400cce[_0x11ce('0x44')]);var _0x26d55a={'where':_0x3e319f[_0x11ce('0x40')]};return db[_0x11ce('0x31')][_0x11ce('0x20')](_0x26d55a)[_0x11ce('0x27')](function(_0x329078){_0x1c4160[_0x11ce('0x20')]=_0x329078;if(_0x400cce[_0x11ce('0x3a')][_0x11ce('0x45')]){_0x3e319f[_0x11ce('0x46')]=[{'all':!![]}];}return db[_0x11ce('0x31')][_0x11ce('0x47')](_0x3e319f);})[_0x11ce('0x27')](function(_0xddc185){_0x1c4160[_0x11ce('0x48')]=_0xddc185;return _0x1c4160;})[_0x11ce('0x27')](respondWithFilteredResult(_0x4ec450,_0x3e319f))['catch'](handleError(_0x4ec450,null));};exports['show']=function(_0x587e79,_0x4b4fd5){var _0x1cd3b2={'raw':!![],'where':{'id':_0x587e79[_0x11ce('0x49')]['id']}},_0x1ccd26={};_0x1ccd26[_0x11ce('0x39')]=_['keys'](db['Interval'][_0x11ce('0x32')]);_0x1ccd26[_0x11ce('0x3a')]=_['keys'](_0x587e79['query']);_0x1ccd26[_0x11ce('0x37')]=_[_0x11ce('0x38')](_0x1ccd26[_0x11ce('0x39')],_0x1ccd26[_0x11ce('0x3a')]);_0x1cd3b2[_0x11ce('0x3b')]=_[_0x11ce('0x38')](_0x1ccd26[_0x11ce('0x39')],qs['fields'](_0x587e79['query'][_0x11ce('0x3c')]));_0x1cd3b2['attributes']=_0x1cd3b2['attributes'][_0x11ce('0x4a')]?_0x1cd3b2[_0x11ce('0x3b')]:_0x1ccd26[_0x11ce('0x39')];if(_0x587e79['query'][_0x11ce('0x45')]){_0x1cd3b2[_0x11ce('0x46')]=[{'all':!![]}];}_0x1cd3b2=_[_0x11ce('0x43')]({},_0x1cd3b2,_0x587e79[_0x11ce('0x44')]);return db[_0x11ce('0x31')]['find'](_0x1cd3b2)['then'](handleEntityNotFound(_0x4b4fd5,null))['then'](respondWithResult(_0x4b4fd5,null))[_0x11ce('0x4b')](handleError(_0x4b4fd5,null));};exports['create']=function(_0x662dcc,_0x5201b0){return db[_0x11ce('0x31')][_0x11ce('0x4c')](_0x662dcc[_0x11ce('0x4d')],{})['then'](function(_0x4ee800){var _0x539bb3=_0x662dcc[_0x11ce('0x4e')][_0x11ce('0x4f')]({'plain':!![]});if(!_0x539bb3)throw new Error(_0x11ce('0x50'));if(_0x539bb3[_0x11ce('0x51')]===_0x11ce('0x4e')){var _0x5f3b8e=_0x4ee800[_0x11ce('0x4f')]({'plain':!![]});var _0x8d0162='Intervals';return db['UserProfileSection'][_0x11ce('0x52')]({'where':{'name':_0x8d0162,'userProfileId':_0x539bb3[_0x11ce('0x53')]},'raw':!![]})[_0x11ce('0x27')](function(_0x32606b){if(_0x32606b&&_0x32606b[_0x11ce('0x54')]===0x0){return db[_0x11ce('0x29')][_0x11ce('0x4c')]({'name':_0x5f3b8e[_0x11ce('0x2d')],'resourceId':_0x5f3b8e['id'],'type':_0x32606b[_0x11ce('0x2d')],'sectionId':_0x32606b['id']},{})[_0x11ce('0x27')](function(){return _0x4ee800;});}else{return _0x4ee800;}})[_0x11ce('0x4b')](function(_0x29c70f){logger[_0x11ce('0x2b')](_0x11ce('0x55'),_0x29c70f);throw _0x29c70f;});}return _0x4ee800;})[_0x11ce('0x27')](respondWithResult(_0x5201b0,0xc9))['catch'](handleError(_0x5201b0,null));};exports[_0x11ce('0x26')]=function(_0x563b6e,_0x7d665b){if(_0x563b6e[_0x11ce('0x4d')]['id']){delete _0x563b6e[_0x11ce('0x4d')]['id'];}return db[_0x11ce('0x31')][_0x11ce('0x52')]({'where':{'id':_0x563b6e[_0x11ce('0x49')]['id']}})['then'](handleEntityNotFound(_0x7d665b,null))[_0x11ce('0x27')](saveUpdates(_0x563b6e[_0x11ce('0x4d')],null))[_0x11ce('0x27')](respondWithResult(_0x7d665b,null))[_0x11ce('0x4b')](handleError(_0x7d665b,null));};exports['destroy']=function(_0x18a258,_0x225765){return db[_0x11ce('0x31')][_0x11ce('0x52')]({'where':{'id':_0x18a258['params']['id']}})[_0x11ce('0x27')](handleEntityNotFound(_0x225765,null))[_0x11ce('0x27')](removeEntity(_0x225765,null))[_0x11ce('0x4b')](handleError(_0x225765,null));};exports[_0x11ce('0x56')]=function(_0x19f1da,_0x3cd267,_0x2ebca6){if(_0x19f1da['body']['id']){delete _0x19f1da[_0x11ce('0x4d')]['id'];}return db['Interval'][_0x11ce('0x52')]({'where':{'id':_0x19f1da['params']['id']}})[_0x11ce('0x27')](handleEntityNotFound(_0x3cd267,null))['then'](function(_0x3a18ff){if(_0x3a18ff){_0x19f1da[_0x11ce('0x4d')][_0x11ce('0x57')]=_0x3a18ff['id'];return db[_0x11ce('0x31')][_0x11ce('0x4c')](_0x19f1da['body']);}})['then'](respondWithResult(_0x3cd267,null))['catch'](handleError(_0x3cd267,null));};exports[_0x11ce('0x58')]=function(_0x358731,_0x5869f4,_0x27b441){var _0x435f02={};var _0x2fa64f={};var _0x5ed1ce;var _0xc96a8b;return db[_0x11ce('0x31')][_0x11ce('0x59')]({'where':{'id':_0x358731[_0x11ce('0x49')]['id']}})[_0x11ce('0x27')](handleEntityNotFound(_0x5869f4,null))['then'](function(_0x7ebc06){if(_0x7ebc06){_0x5ed1ce=_0x7ebc06;_0x2fa64f[_0x11ce('0x39')]=_[_0x11ce('0x36')](db['Interval'][_0x11ce('0x32')]);_0x2fa64f[_0x11ce('0x3a')]=_[_0x11ce('0x36')](_0x358731[_0x11ce('0x3a')]);_0x2fa64f[_0x11ce('0x37')]=_[_0x11ce('0x38')](_0x2fa64f[_0x11ce('0x39')],_0x2fa64f[_0x11ce('0x3a')]);_0x435f02['attributes']=_[_0x11ce('0x38')](_0x2fa64f[_0x11ce('0x39')],qs['fields'](_0x358731[_0x11ce('0x3a')][_0x11ce('0x3c')]));_0x435f02[_0x11ce('0x3b')]=_0x435f02[_0x11ce('0x3b')][_0x11ce('0x4a')]?_0x435f02[_0x11ce('0x3b')]:_0x2fa64f[_0x11ce('0x39')];_0x435f02[_0x11ce('0x3e')]=qs['sort'](_0x358731['query'][_0x11ce('0x3f')]);_0x435f02[_0x11ce('0x40')]=qs[_0x11ce('0x37')](_[_0x11ce('0x41')](_0x358731[_0x11ce('0x3a')],_0x2fa64f[_0x11ce('0x37')]));if(_0x358731[_0x11ce('0x3a')]['filter']){_0x435f02[_0x11ce('0x40')]=_[_0x11ce('0x43')](_0x435f02[_0x11ce('0x40')],{'$or':_[_0x11ce('0x30')](_0x435f02[_0x11ce('0x3b')],function(_0xdafa6b){var _0xce005d={};_0xce005d[_0xdafa6b]={'$like':'%'+_0x358731[_0x11ce('0x3a')]['filter']+'%'};return _0xce005d;})});}_0x435f02=_['merge']({},_0x435f02,_0x358731[_0x11ce('0x44')]);return _0x5ed1ce[_0x11ce('0x58')](_0x435f02);}})[_0x11ce('0x27')](function(_0x439dbd){if(_0x439dbd){_0xc96a8b=_0x439dbd['length'];if(!_0x358731[_0x11ce('0x3a')][_0x11ce('0x3d')]('nolimit')){_0x435f02[_0x11ce('0x1f')]=qs[_0x11ce('0x1f')](_0x358731[_0x11ce('0x3a')][_0x11ce('0x1f')]);_0x435f02[_0x11ce('0x1d')]=qs['offset'](_0x358731[_0x11ce('0x3a')]['offset']);}return _0x5ed1ce[_0x11ce('0x58')](_0x435f02);}})['then'](function(_0x5e35a8){if(_0x5e35a8){return _0x5e35a8?{'count':_0xc96a8b,'rows':_0x5e35a8}:null;}})[_0x11ce('0x27')](respondWithResult(_0x5869f4,null))[_0x11ce('0x4b')](handleError(_0x5869f4,null));};exports[_0x11ce('0x5a')]=function(_0x595917,_0xbe2cbf,_0x4a1124){return db['Interval'][_0x11ce('0x59')]({'where':{'id':_0x595917[_0x11ce('0x49')]['id']}})[_0x11ce('0x27')](handleEntityNotFound(_0xbe2cbf,null))[_0x11ce('0x27')](function(_0x5ea72c){if(_0x5ea72c){return db[_0x11ce('0x5b')][_0x11ce('0x5c')](function(_0x372957){return db[_0x11ce('0x31')][_0x11ce('0x28')]({'where':{'IntervalId':_0x595917[_0x11ce('0x49')]['id']},'transaction':_0x372957})[_0x11ce('0x27')](function(_0x135219){var _0x1f0317=_['map'](_0x595917['body'],function(_0x32c3f3){delete _0x32c3f3['id'];_0x32c3f3[_0x11ce('0x57')]=_0x595917['params']['id'];return _0x32c3f3;});return db[_0x11ce('0x31')]['bulkCreate'](_0x1f0317,{'transaction':_0x372957});});})['then'](function(){return db['Interval'][_0x11ce('0x47')]({'where':{'IntervalId':_0x595917['params']['id']}});});}})[_0x11ce('0x27')](respondWithResult(_0xbe2cbf,null))[_0x11ce('0x4b')](handleError(_0xbe2cbf,null));}; \ No newline at end of file +var _0x0c61=['hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','role','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','IntervalId','findOne','order','getIntervals','addIntervals','sequelize','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','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','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','Intervals','name','Interval','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length'];(function(_0x386b03,_0x5d0000){var _0xd3d524=function(_0x474754){while(--_0x474754){_0x386b03['push'](_0x386b03['shift']());}};_0xd3d524(++_0x5d0000);}(_0x0c61,0xd2));var _0x10c6=function(_0x235f49,_0x2992b4){_0x235f49=_0x235f49-0x0;var _0x551139=_0x0c61[_0x235f49];return _0x551139;};'use strict';var emlformat=require(_0x10c6('0x0'));var rimraf=require(_0x10c6('0x1'));var zipdir=require(_0x10c6('0x2'));var jsonpatch=require(_0x10c6('0x3'));var rp=require(_0x10c6('0x4'));var moment=require('moment');var BPromise=require(_0x10c6('0x5'));var Mustache=require(_0x10c6('0x6'));var util=require(_0x10c6('0x7'));var path=require(_0x10c6('0x8'));var sox=require(_0x10c6('0x9'));var csv=require(_0x10c6('0xa'));var ejs=require(_0x10c6('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x10c6('0xc'));var squel=require(_0x10c6('0xd'));var crypto=require(_0x10c6('0xe'));var jsforce=require(_0x10c6('0xf'));var deskjs=require(_0x10c6('0x10'));var toCsv=require('to-csv');var querystring=require(_0x10c6('0x11'));var Papa=require(_0x10c6('0x12'));var Redis=require(_0x10c6('0x13'));var authService=require(_0x10c6('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x10c6('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x10c6('0x16'))(_0x10c6('0x17'));var utils=require(_0x10c6('0x18'));var config=require(_0x10c6('0x19'));var licenseUtil=require(_0x10c6('0x1a'));var db=require(_0x10c6('0x1b'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x3a9af8,_0xc86778){_0xc86778=_0xc86778||0xcc;return function(_0x4d885d){if(_0x4d885d){return _0x3a9af8[_0x10c6('0x1c')](_0xc86778);}return _0x3a9af8[_0x10c6('0x1d')](_0xc86778)['end']();};}function respondWithResult(_0x144a11,_0x362c0e){_0x362c0e=_0x362c0e||0xc8;return function(_0xc8b96f){if(_0xc8b96f){return _0x144a11[_0x10c6('0x1d')](_0x362c0e)['json'](_0xc8b96f);}};}function respondWithFilteredResult(_0x28725b,_0x5c2370){return function(_0x5df266){if(_0x5df266){var _0x2906f2=typeof _0x5c2370[_0x10c6('0x1e')]===_0x10c6('0x1f')&&typeof _0x5c2370[_0x10c6('0x20')]===_0x10c6('0x1f');var _0x1771ed=_0x5df266[_0x10c6('0x21')];var _0x16b898=_0x2906f2?0x0:_0x5c2370[_0x10c6('0x1e')];var _0x47dc60=_0x2906f2?_0x5df266[_0x10c6('0x21')]:_0x5c2370[_0x10c6('0x1e')]+_0x5c2370[_0x10c6('0x20')];var _0x107827;if(_0x47dc60>=_0x1771ed){_0x47dc60=_0x1771ed;_0x107827=0xc8;}else{_0x107827=0xce;}_0x28725b[_0x10c6('0x1d')](_0x107827);return _0x28725b['set'](_0x10c6('0x22'),_0x16b898+'-'+_0x47dc60+'/'+_0x1771ed)['json'](_0x5df266);}return null;};}function patchUpdates(_0x43e9fd){return function(_0x304152){try{jsonpatch[_0x10c6('0x23')](_0x304152,_0x43e9fd,!![]);}catch(_0xf52a28){return BPromise[_0x10c6('0x24')](_0xf52a28);}return _0x304152[_0x10c6('0x25')]();};}function saveUpdates(_0x5d05de,_0xd8e0e7){return function(_0x15948a){if(_0x15948a){return _0x15948a[_0x10c6('0x26')](_0x5d05de)[_0x10c6('0x27')](function(_0x42f346){return _0x42f346;});}return null;};}function removeEntity(_0x572b8f,_0x5c5e88){return function(_0x20c8c7){if(_0x20c8c7){return _0x20c8c7[_0x10c6('0x28')]()[_0x10c6('0x27')](function(){var _0x320bc3=_0x20c8c7[_0x10c6('0x29')]({'plain':!![]});var _0x2a8015=_0x10c6('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x2a8015,'resourceId':_0x320bc3['id']}})['then'](function(){return _0x20c8c7;});})[_0x10c6('0x27')](function(){_0x572b8f[_0x10c6('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a729e,_0x1f32b8){return function(_0x570d9c){if(!_0x570d9c){_0x1a729e['sendStatus'](0x194);}return _0x570d9c;};}function handleError(_0x48bd93,_0x278df3){_0x278df3=_0x278df3||0x1f4;return function(_0x47da38){logger['error'](_0x47da38['stack']);if(_0x47da38[_0x10c6('0x2b')]){delete _0x47da38[_0x10c6('0x2b')];}_0x48bd93[_0x10c6('0x1d')](_0x278df3)['send'](_0x47da38);};}exports['index']=function(_0x38926f,_0x31f113){var _0x5e1320={},_0x2c0aa2={},_0x3500e7={'count':0x0,'rows':[]};var _0x5db099=_['map'](db[_0x10c6('0x2c')][_0x10c6('0x2d')],function(_0x461ced){return{'name':_0x461ced[_0x10c6('0x2e')],'type':_0x461ced[_0x10c6('0x2f')][_0x10c6('0x30')]};});_0x2c0aa2[_0x10c6('0x31')]=_[_0x10c6('0x32')](_0x5db099,_0x10c6('0x2b'));_0x2c0aa2[_0x10c6('0x33')]=_['keys'](_0x38926f[_0x10c6('0x33')]);_0x2c0aa2[_0x10c6('0x34')]=_[_0x10c6('0x35')](_0x2c0aa2[_0x10c6('0x31')],_0x2c0aa2[_0x10c6('0x33')]);_0x5e1320[_0x10c6('0x36')]=_['intersection'](_0x2c0aa2[_0x10c6('0x31')],qs[_0x10c6('0x37')](_0x38926f[_0x10c6('0x33')][_0x10c6('0x37')]));_0x5e1320['attributes']=_0x5e1320[_0x10c6('0x36')][_0x10c6('0x38')]?_0x5e1320[_0x10c6('0x36')]:_0x2c0aa2[_0x10c6('0x31')];if(!_0x38926f['query'][_0x10c6('0x39')](_0x10c6('0x3a'))){_0x5e1320[_0x10c6('0x20')]=qs['limit'](_0x38926f[_0x10c6('0x33')][_0x10c6('0x20')]);_0x5e1320[_0x10c6('0x1e')]=qs[_0x10c6('0x1e')](_0x38926f[_0x10c6('0x33')]['offset']);}_0x5e1320['order']=qs[_0x10c6('0x3b')](_0x38926f[_0x10c6('0x33')][_0x10c6('0x3b')]);_0x5e1320['where']=qs[_0x10c6('0x34')](_[_0x10c6('0x3c')](_0x38926f[_0x10c6('0x33')],_0x2c0aa2[_0x10c6('0x34')]),_0x5db099);if(_0x38926f[_0x10c6('0x33')][_0x10c6('0x3d')]){_0x5e1320[_0x10c6('0x3e')]=_[_0x10c6('0x3f')](_0x5e1320[_0x10c6('0x3e')],{'$or':_['map'](_0x5db099,function(_0x78d9a5){if(_0x78d9a5[_0x10c6('0x2f')]!=='VIRTUAL'){var _0x24d398={};_0x24d398[_0x78d9a5['name']]={'$like':'%'+_0x38926f[_0x10c6('0x33')][_0x10c6('0x3d')]+'%'};return _0x24d398;}})});}_0x5e1320=_[_0x10c6('0x3f')]({},_0x5e1320,_0x38926f[_0x10c6('0x40')]);var _0xa209d={'where':_0x5e1320[_0x10c6('0x3e')]};return db[_0x10c6('0x2c')][_0x10c6('0x21')](_0xa209d)['then'](function(_0x5bc462){_0x3500e7[_0x10c6('0x21')]=_0x5bc462;if(_0x38926f[_0x10c6('0x33')][_0x10c6('0x41')]){_0x5e1320[_0x10c6('0x42')]=[{'all':!![]}];}return db[_0x10c6('0x2c')][_0x10c6('0x43')](_0x5e1320);})[_0x10c6('0x27')](function(_0x53b8cb){_0x3500e7[_0x10c6('0x44')]=_0x53b8cb;return _0x3500e7;})[_0x10c6('0x27')](respondWithFilteredResult(_0x31f113,_0x5e1320))[_0x10c6('0x45')](handleError(_0x31f113,null));};exports[_0x10c6('0x46')]=function(_0x43841e,_0x5cdb03){var _0x26c735={'raw':!![],'where':{'id':_0x43841e[_0x10c6('0x47')]['id']}},_0x4fd907={};_0x4fd907['model']=_[_0x10c6('0x48')](db[_0x10c6('0x2c')]['rawAttributes']);_0x4fd907[_0x10c6('0x33')]=_[_0x10c6('0x48')](_0x43841e['query']);_0x4fd907['filters']=_[_0x10c6('0x35')](_0x4fd907[_0x10c6('0x31')],_0x4fd907[_0x10c6('0x33')]);_0x26c735['attributes']=_[_0x10c6('0x35')](_0x4fd907['model'],qs[_0x10c6('0x37')](_0x43841e[_0x10c6('0x33')][_0x10c6('0x37')]));_0x26c735[_0x10c6('0x36')]=_0x26c735[_0x10c6('0x36')][_0x10c6('0x38')]?_0x26c735[_0x10c6('0x36')]:_0x4fd907['model'];if(_0x43841e[_0x10c6('0x33')][_0x10c6('0x41')]){_0x26c735[_0x10c6('0x42')]=[{'all':!![]}];}_0x26c735=_['merge']({},_0x26c735,_0x43841e['options']);return db[_0x10c6('0x2c')]['find'](_0x26c735)['then'](handleEntityNotFound(_0x5cdb03,null))[_0x10c6('0x27')](respondWithResult(_0x5cdb03,null))[_0x10c6('0x45')](handleError(_0x5cdb03,null));};exports[_0x10c6('0x49')]=function(_0x3c1e00,_0x120524){return db[_0x10c6('0x2c')][_0x10c6('0x49')](_0x3c1e00[_0x10c6('0x4a')],{})[_0x10c6('0x27')](function(_0x39db1e){var _0x5333c0=_0x3c1e00['user']['get']({'plain':!![]});if(!_0x5333c0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5333c0[_0x10c6('0x4b')]===_0x10c6('0x4c')){var _0x3eef7c=_0x39db1e[_0x10c6('0x29')]({'plain':!![]});var _0x26357b=_0x10c6('0x2a');return db['UserProfileSection']['find']({'where':{'name':_0x26357b,'userProfileId':_0x5333c0[_0x10c6('0x4d')]},'raw':!![]})[_0x10c6('0x27')](function(_0x252628){if(_0x252628&&_0x252628[_0x10c6('0x4e')]===0x0){return db['UserProfileResource'][_0x10c6('0x49')]({'name':_0x3eef7c[_0x10c6('0x2b')],'resourceId':_0x3eef7c['id'],'type':_0x252628[_0x10c6('0x2b')],'sectionId':_0x252628['id']},{})[_0x10c6('0x27')](function(){return _0x39db1e;});}else{return _0x39db1e;}})[_0x10c6('0x45')](function(_0x5f1007){logger[_0x10c6('0x4f')](_0x10c6('0x50'),_0x5f1007);throw _0x5f1007;});}return _0x39db1e;})['then'](respondWithResult(_0x120524,0xc9))[_0x10c6('0x45')](handleError(_0x120524,null));};exports[_0x10c6('0x26')]=function(_0x32fad9,_0x257a38){if(_0x32fad9[_0x10c6('0x4a')]['id']){delete _0x32fad9['body']['id'];}return db[_0x10c6('0x2c')][_0x10c6('0x51')]({'where':{'id':_0x32fad9[_0x10c6('0x47')]['id']}})[_0x10c6('0x27')](handleEntityNotFound(_0x257a38,null))['then'](saveUpdates(_0x32fad9['body'],null))['then'](respondWithResult(_0x257a38,null))[_0x10c6('0x45')](handleError(_0x257a38,null));};exports[_0x10c6('0x28')]=function(_0x50b51a,_0x1b5af6){return db[_0x10c6('0x2c')][_0x10c6('0x51')]({'where':{'id':_0x50b51a[_0x10c6('0x47')]['id']}})[_0x10c6('0x27')](handleEntityNotFound(_0x1b5af6,null))[_0x10c6('0x27')](removeEntity(_0x1b5af6,null))[_0x10c6('0x45')](handleError(_0x1b5af6,null));};exports['addInterval']=function(_0x35f2b8,_0x675a3e,_0x5d9950){if(_0x35f2b8[_0x10c6('0x4a')]['id']){delete _0x35f2b8[_0x10c6('0x4a')]['id'];}return db[_0x10c6('0x2c')][_0x10c6('0x51')]({'where':{'id':_0x35f2b8[_0x10c6('0x47')]['id']}})[_0x10c6('0x27')](handleEntityNotFound(_0x675a3e,null))['then'](function(_0x579f93){if(_0x579f93){_0x35f2b8[_0x10c6('0x4a')][_0x10c6('0x52')]=_0x579f93['id'];return db[_0x10c6('0x2c')]['create'](_0x35f2b8[_0x10c6('0x4a')]);}})[_0x10c6('0x27')](respondWithResult(_0x675a3e,null))[_0x10c6('0x45')](handleError(_0x675a3e,null));};exports['getIntervals']=function(_0xf54d39,_0x29742a,_0x485139){var _0x3e939f={};var _0x46c356={};var _0x500d1f;var _0xcc2772;return db[_0x10c6('0x2c')][_0x10c6('0x53')]({'where':{'id':_0xf54d39[_0x10c6('0x47')]['id']}})[_0x10c6('0x27')](handleEntityNotFound(_0x29742a,null))[_0x10c6('0x27')](function(_0x53a8b1){if(_0x53a8b1){_0x500d1f=_0x53a8b1;_0x46c356[_0x10c6('0x31')]=_['keys'](db[_0x10c6('0x2c')][_0x10c6('0x2d')]);_0x46c356[_0x10c6('0x33')]=_[_0x10c6('0x48')](_0xf54d39['query']);_0x46c356[_0x10c6('0x34')]=_[_0x10c6('0x35')](_0x46c356[_0x10c6('0x31')],_0x46c356[_0x10c6('0x33')]);_0x3e939f[_0x10c6('0x36')]=_['intersection'](_0x46c356['model'],qs['fields'](_0xf54d39[_0x10c6('0x33')][_0x10c6('0x37')]));_0x3e939f[_0x10c6('0x36')]=_0x3e939f[_0x10c6('0x36')]['length']?_0x3e939f[_0x10c6('0x36')]:_0x46c356[_0x10c6('0x31')];_0x3e939f[_0x10c6('0x54')]=qs[_0x10c6('0x3b')](_0xf54d39['query']['sort']);_0x3e939f['where']=qs[_0x10c6('0x34')](_['pick'](_0xf54d39[_0x10c6('0x33')],_0x46c356[_0x10c6('0x34')]));if(_0xf54d39['query']['filter']){_0x3e939f[_0x10c6('0x3e')]=_[_0x10c6('0x3f')](_0x3e939f['where'],{'$or':_[_0x10c6('0x32')](_0x3e939f[_0x10c6('0x36')],function(_0x5ae17d){var _0x49da7f={};_0x49da7f[_0x5ae17d]={'$like':'%'+_0xf54d39[_0x10c6('0x33')]['filter']+'%'};return _0x49da7f;})});}_0x3e939f=_[_0x10c6('0x3f')]({},_0x3e939f,_0xf54d39[_0x10c6('0x40')]);return _0x500d1f[_0x10c6('0x55')](_0x3e939f);}})[_0x10c6('0x27')](function(_0x31033e){if(_0x31033e){_0xcc2772=_0x31033e['length'];if(!_0xf54d39['query'][_0x10c6('0x39')](_0x10c6('0x3a'))){_0x3e939f[_0x10c6('0x20')]=qs['limit'](_0xf54d39[_0x10c6('0x33')][_0x10c6('0x20')]);_0x3e939f['offset']=qs[_0x10c6('0x1e')](_0xf54d39['query'][_0x10c6('0x1e')]);}return _0x500d1f['getIntervals'](_0x3e939f);}})['then'](function(_0x364414){if(_0x364414){return _0x364414?{'count':_0xcc2772,'rows':_0x364414}:null;}})['then'](respondWithResult(_0x29742a,null))['catch'](handleError(_0x29742a,null));};exports[_0x10c6('0x56')]=function(_0x55d7ae,_0x598e85,_0x11de1d){return db['Interval'][_0x10c6('0x53')]({'where':{'id':_0x55d7ae[_0x10c6('0x47')]['id']}})[_0x10c6('0x27')](handleEntityNotFound(_0x598e85,null))[_0x10c6('0x27')](function(_0x3a3480){if(_0x3a3480){return db[_0x10c6('0x57')]['transaction'](function(_0x47882c){return db[_0x10c6('0x2c')][_0x10c6('0x28')]({'where':{'IntervalId':_0x55d7ae[_0x10c6('0x47')]['id']},'transaction':_0x47882c})[_0x10c6('0x27')](function(_0x44a634){var _0x59f979=_['map'](_0x55d7ae[_0x10c6('0x4a')],function(_0x38ab70){delete _0x38ab70['id'];_0x38ab70['IntervalId']=_0x55d7ae[_0x10c6('0x47')]['id'];return _0x38ab70;});return db['Interval'][_0x10c6('0x58')](_0x59f979,{'transaction':_0x47882c});});})['then'](function(){return db[_0x10c6('0x2c')][_0x10c6('0x43')]({'where':{'IntervalId':_0x55d7ae['params']['id']}});});}})[_0x10c6('0x27')](respondWithResult(_0x598e85,null))['catch'](handleError(_0x598e85,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 0d2cb6e..e333519 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 _0x8838=['request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8838,0x90));var _0x8883=function(_0x3059d1,_0x4bacf2){_0x3059d1=_0x3059d1-0x0;var _0x91c31a=_0x8838[_0x3059d1];return _0x91c31a;};'use strict';var _=require(_0x8883('0x0'));var util=require(_0x8883('0x1'));var logger=require(_0x8883('0x2'))(_0x8883('0x3'));var moment=require(_0x8883('0x4'));var BPromise=require(_0x8883('0x5'));var rp=require(_0x8883('0x6'));var fs=require('fs');var path=require(_0x8883('0x7'));var rimraf=require(_0x8883('0x8'));var config=require(_0x8883('0x9'));var attributes=require(_0x8883('0xa'));var extensions=require(_0x8883('0xb'));module['exports']=function(_0x5061d6,_0x363519){return _0x5061d6['define'](_0x8883('0xc'),attributes,{'tableName':_0x8883('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x22060b,_0xeded88){extensions[_0x8883('0xe')](_0x5061d6,_0x22060b);},'afterBulkCreate':function(_0x2f91ae,_0x320367,_0x52e9fe){_0x52e9fe();extensions[_0x8883('0xe')](_0x5061d6,_0x2f91ae[0x0]);},'afterUpdate':function(_0x3d3a4a,_0x13f776){extensions[_0x8883('0xe')](_0x5061d6,_0x3d3a4a);},'afterDestroy':function(_0x4bea54,_0x10c259){extensions['rewrite'](_0x5061d6,_0x4bea54);}}});}; \ No newline at end of file +var _0x815f=['../../components/extensions/rewrite','define','Interval','tools_intervals','rewrite','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes'];(function(_0x4d88f6,_0x52f758){var _0x2041c8=function(_0x16f556){while(--_0x16f556){_0x4d88f6['push'](_0x4d88f6['shift']());}};_0x2041c8(++_0x52f758);}(_0x815f,0x1c5));var _0xf815=function(_0xef6cd2,_0x4f2c29){_0xef6cd2=_0xef6cd2-0x0;var _0x46f4a9=_0x815f[_0xef6cd2];return _0x46f4a9;};'use strict';var _=require(_0xf815('0x0'));var util=require('util');var logger=require(_0xf815('0x1'))('api');var moment=require(_0xf815('0x2'));var BPromise=require(_0xf815('0x3'));var rp=require(_0xf815('0x4'));var fs=require('fs');var path=require(_0xf815('0x5'));var rimraf=require(_0xf815('0x6'));var config=require(_0xf815('0x7'));var attributes=require(_0xf815('0x8'));var extensions=require(_0xf815('0x9'));module['exports']=function(_0x4b22c1,_0x1665ff){return _0x4b22c1[_0xf815('0xa')](_0xf815('0xb'),attributes,{'tableName':_0xf815('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5ac028,_0x48f73a){extensions[_0xf815('0xd')](_0x4b22c1,_0x5ac028);},'afterBulkCreate':function(_0x1cd300,_0x55672d,_0x476fe5){_0x476fe5();extensions[_0xf815('0xd')](_0x4b22c1,_0x1cd300[0x0]);},'afterUpdate':function(_0x94ab48,_0x33b0de){extensions['rewrite'](_0x4b22c1,_0x94ab48);},'afterDestroy':function(_0x542936,_0x96a9e7){extensions['rewrite'](_0x4b22c1,_0x542936);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index a3e4b57..8eeccfd 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x34c553,_0x3e7dfc){var _0x1357d2=function(_0x3b509f){while(--_0x3b509f){_0x34c553['push'](_0x34c553['shift']());}};_0x1357d2(++_0x3e7dfc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x622035,_0x1a4b91){var _0x326cf2=function(_0x5c3002){while(--_0x5c3002){_0x622035['push'](_0x622035['shift']());}};_0x326cf2(++_0x1a4b91);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 3b27319..333432b 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x1840a4,_0x2edd45){var _0x26b335=function(_0x13bb78){while(--_0x13bb78){_0x1840a4['push'](_0x1840a4['shift']());}};_0x26b335(++_0x2edd45);}(_0x5f2f,0x73));var _0xf5f2=function(_0x14d48b,_0x619802){_0x14d48b=_0x14d48b-0x0;var _0x33f149=_0x5f2f[_0x14d48b];return _0x33f149;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file +var _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x2ef69a,_0x414188){var _0x3e82b5=function(_0x32c941){while(--_0x32c941){_0x2ef69a['push'](_0x2ef69a['shift']());}};_0x3e82b5(++_0x414188);}(_0xdb28,0x106));var _0x8db2=function(_0x24cd22,_0x3df367){_0x24cd22=_0x24cd22-0x0;var _0x39853f=_0xdb28[_0x24cd22];return _0x39853f;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 693349a..a6e78a9 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 _0x3e99=['fields','customfield_11500','email','customfield_11501','oldToken','newToken','customfield_11503','name','customfield_11504','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','status','statusCode','parse','error','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','body','headers','x-forwarded-for','connection','socket','remoteAddress','bluebird','https','../../config/logger','api','3eAmWpBVP0','MOTGUI','summary','Report','description'];(function(_0x3ce089,_0x1a4890){var _0x35b89d=function(_0x57f388){while(--_0x57f388){_0x3ce089['push'](_0x3ce089['shift']());}};_0x35b89d(++_0x1a4890);}(_0x3e99,0x139));var _0x93e9=function(_0x45b30a,_0x13ac08){_0x45b30a=_0x45b30a-0x0;var _0x111b5a=_0x3e99[_0x45b30a];return _0x111b5a;};'use strict';var BPromise=require(_0x93e9('0x0'));var https=require(_0x93e9('0x1'));var logger=require(_0x93e9('0x2'))(_0x93e9('0x3'));var USERNAME='support';var PASSWORD=_0x93e9('0x4');function openIssue(_0x4d12e9,_0x4906d8){var _0x3d45d3={'fields':{'project':{'key':_0x4d12e9['key']||_0x93e9('0x5')},'summary':(_0x4d12e9[_0x93e9('0x6')]||_0x93e9('0x7'))+'\x20from\x20'+_0x4d12e9['ip'],'description':_0x4d12e9[_0x93e9('0x8')]||JSON['stringify'](_0x4d12e9),'issuetype':{'name':_0x4d12e9['issuetype']||'Bug'}}};_0x3d45d3[_0x93e9('0x9')][_0x93e9('0xa')]=_0x4d12e9[_0x93e9('0xb')];_0x3d45d3[_0x93e9('0x9')][_0x93e9('0xc')]=_0x4d12e9[_0x93e9('0xd')];_0x3d45d3[_0x93e9('0x9')]['customfield_11502']=_0x4d12e9[_0x93e9('0xe')];_0x3d45d3[_0x93e9('0x9')][_0x93e9('0xf')]=_0x4d12e9[_0x93e9('0x10')];_0x3d45d3['fields'][_0x93e9('0x11')]=_0x4d12e9['reason'];_0x3d45d3[_0x93e9('0x9')][_0x93e9('0x12')]=_0x4d12e9['ip'];var _0x3a0888={'host':_0x93e9('0x13'),'port':0x1bb,'path':_0x93e9('0x14'),'method':_0x93e9('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0x93e9('0x16'),'Authorization':_0x93e9('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0x93e9('0x18')](_0x93e9('0x19'))}};var _0x4ee15f=JSON['stringify'](_0x3d45d3);var _0x79ece0=https[_0x93e9('0x1a')](_0x3a0888,function(_0x2be713){_0x2be713[_0x93e9('0x1b')](_0x93e9('0x1c'));var _0x57c5de='';_0x2be713['on'](_0x93e9('0x1d'),function(_0x1e4ec3){_0x57c5de+=_0x1e4ec3;});_0x2be713['on'](_0x93e9('0x1e'),function(){if(_0x4906d8){return _0x4906d8[_0x93e9('0x1f')](_0x2be713[_0x93e9('0x20')])['json'](JSON[_0x93e9('0x21')](_0x57c5de));}});});_0x79ece0['on'](_0x93e9('0x22'),function(_0x11d165){if(_0x4906d8){return _0x4906d8[_0x93e9('0x1f')](0x1f4)[_0x93e9('0x23')]({'errors':[{'message':_0x93e9('0x24'),'type':_0x93e9('0x25')}]});}});_0x79ece0[_0x93e9('0x26')](_0x4ee15f);_0x79ece0[_0x93e9('0x1e')]();}exports[_0x93e9('0x27')]=openIssue;exports['send']=function(_0x853062,_0x5e3045){_0x853062[_0x93e9('0x28')]['ip']=_0x853062[_0x93e9('0x29')][_0x93e9('0x2a')]||_0x853062[_0x93e9('0x2b')]['remoteAddress']||_0x853062[_0x93e9('0x2c')][_0x93e9('0x2d')]||_0x853062[_0x93e9('0x2b')][_0x93e9('0x2c')][_0x93e9('0x2d')];return openIssue(_0x853062['body'],_0x5e3045);}; \ No newline at end of file +var _0x78a0=['customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','statusCode','status','json','write','send','body','headers','x-forwarded-for','connection','socket','remoteAddress','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501'];(function(_0x20db6c,_0x4ff24a){var _0x30b5d3=function(_0x1ba9f0){while(--_0x1ba9f0){_0x20db6c['push'](_0x20db6c['shift']());}};_0x30b5d3(++_0x4ff24a);}(_0x78a0,0x1f3));var _0x078a=function(_0x5999ba,_0x97b26a){_0x5999ba=_0x5999ba-0x0;var _0x2140b5=_0x78a0[_0x5999ba];return _0x2140b5;};'use strict';var BPromise=require(_0x078a('0x0'));var https=require(_0x078a('0x1'));var logger=require(_0x078a('0x2'))(_0x078a('0x3'));var USERNAME=_0x078a('0x4');var PASSWORD=_0x078a('0x5');function openIssue(_0x45514a,_0x180291){var _0x42ec47={'fields':{'project':{'key':_0x45514a[_0x078a('0x6')]||_0x078a('0x7')},'summary':(_0x45514a[_0x078a('0x8')]||_0x078a('0x9'))+'\x20from\x20'+_0x45514a['ip'],'description':_0x45514a[_0x078a('0xa')]||JSON[_0x078a('0xb')](_0x45514a),'issuetype':{'name':_0x45514a[_0x078a('0xc')]||_0x078a('0xd')}}};_0x42ec47[_0x078a('0xe')][_0x078a('0xf')]=_0x45514a[_0x078a('0x10')];_0x42ec47[_0x078a('0xe')][_0x078a('0x11')]=_0x45514a['oldToken'];_0x42ec47['fields'][_0x078a('0x12')]=_0x45514a[_0x078a('0x13')];_0x42ec47['fields'][_0x078a('0x14')]=_0x45514a[_0x078a('0x15')];_0x42ec47['fields'][_0x078a('0x16')]=_0x45514a[_0x078a('0x17')];_0x42ec47['fields'][_0x078a('0x18')]=_0x45514a['ip'];var _0x32e895={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x078a('0x19'),'method':_0x078a('0x1a'),'timeout':0x4e20,'headers':{'Content-Type':_0x078a('0x1b'),'Authorization':_0x078a('0x1c')+new Buffer(USERNAME+':'+PASSWORD)[_0x078a('0x1d')](_0x078a('0x1e'))}};var _0x3bb19c=JSON[_0x078a('0xb')](_0x42ec47);var _0x3c3db7=https[_0x078a('0x1f')](_0x32e895,function(_0x95b76e){_0x95b76e[_0x078a('0x20')](_0x078a('0x21'));var _0x201d72='';_0x95b76e['on'](_0x078a('0x22'),function(_0x24d496){_0x201d72+=_0x24d496;});_0x95b76e['on'](_0x078a('0x23'),function(){if(_0x180291){return _0x180291['status'](_0x95b76e[_0x078a('0x24')])['json'](JSON['parse'](_0x201d72));}});});_0x3c3db7['on']('error',function(_0x7f5465){if(_0x180291){return _0x180291[_0x078a('0x25')](0x1f4)[_0x078a('0x26')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':'api.jira'}]});}});_0x3c3db7[_0x078a('0x27')](_0x3bb19c);_0x3c3db7['end']();}exports['openIssue']=openIssue;exports[_0x078a('0x28')]=function(_0x49e617,_0x77160a){_0x49e617[_0x078a('0x29')]['ip']=_0x49e617[_0x078a('0x2a')][_0x078a('0x2b')]||_0x49e617[_0x078a('0x2c')]['remoteAddress']||_0x49e617['socket']['remoteAddress']||_0x49e617[_0x078a('0x2c')][_0x078a('0x2d')][_0x078a('0x2e')];return openIssue(_0x49e617[_0x078a('0x29')],_0x77160a);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index d37b85f..5e9370b 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 _0xa74f=['/describe','isAuthenticated','describe','show','post','put','/:id','update','delete','exports','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','index','get'];(function(_0x2f05c6,_0x42673e){var _0x21df7c=function(_0x416cdb){while(--_0x416cdb){_0x2f05c6['push'](_0x2f05c6['shift']());}};_0x21df7c(++_0x42673e);}(_0xa74f,0x9a));var _0xfa74=function(_0x29e3ec,_0x138a18){_0x29e3ec=_0x29e3ec-0x0;var _0x25727e=_0xa74f[_0x29e3ec];return _0x25727e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfa74('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfa74('0x1')]();var fs_extra=require(_0xfa74('0x2'));var auth=require(_0xfa74('0x3'));var interaction=require(_0xfa74('0x4'));var config=require('../../config/environment');var controller=require(_0xfa74('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xfa74('0x6')]);router[_0xfa74('0x7')](_0xfa74('0x8'),auth[_0xfa74('0x9')](),controller[_0xfa74('0xa')]);router[_0xfa74('0x7')]('/:id',auth[_0xfa74('0x9')](),controller[_0xfa74('0xb')]);router[_0xfa74('0xc')]('/',auth[_0xfa74('0x9')](),controller['create']);router[_0xfa74('0xd')](_0xfa74('0xe'),auth['isAuthenticated'](),controller[_0xfa74('0xf')]);router[_0xfa74('0x10')](_0xfa74('0xe'),auth[_0xfa74('0x9')](),controller['destroy']);module[_0xfa74('0x11')]=router; \ No newline at end of file +var _0x668b=['get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','isAuthenticated','index'];(function(_0x26e721,_0x5eb0ad){var _0x455880=function(_0x86248b){while(--_0x86248b){_0x26e721['push'](_0x26e721['shift']());}};_0x455880(++_0x5eb0ad);}(_0x668b,0x140));var _0xb668=function(_0xa2b098,_0x461a08){_0xa2b098=_0xa2b098-0x0;var _0x29502e=_0x668b[_0xa2b098];return _0x29502e;};'use strict';var multer=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var path=require('path');var timeout=require(_0xb668('0x2'));var express=require(_0xb668('0x3'));var router=express['Router']();var fs_extra=require(_0xb668('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb668('0x5'));var config=require(_0xb668('0x6'));var controller=require(_0xb668('0x7'));router['get']('/',auth[_0xb668('0x8')](),controller[_0xb668('0x9')]);router[_0xb668('0xa')](_0xb668('0xb'),auth[_0xb668('0x8')](),controller[_0xb668('0xc')]);router['get'](_0xb668('0xd'),auth[_0xb668('0x8')](),controller[_0xb668('0xe')]);router[_0xb668('0xf')]('/',auth[_0xb668('0x8')](),controller[_0xb668('0x10')]);router[_0xb668('0x11')](_0xb668('0xd'),auth['isAuthenticated'](),controller[_0xb668('0x12')]);router[_0xb668('0x13')](_0xb668('0xd'),auth[_0xb668('0x8')](),controller[_0xb668('0x14')]);module[_0xb668('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index f7635cb..3ddd5f5 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(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x7a54,0x106));var _0x47a5=function(_0x157aaa,_0x523795){_0x157aaa=_0x157aaa-0x0;var _0x1195b4=_0x7a54[_0x157aaa];return _0x1195b4;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x7a54,0x106));var _0x47a5=function(_0xc7ef97,_0x44c828){_0xc7ef97=_0xc7ef97-0x0;var _0xb01e8a=_0x7a54[_0xc7ef97];return _0xb01e8a;};'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 58a004a..b46cc67 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 _0xd2bb=['destroy','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','create','body','find'];(function(_0x522d90,_0x41aaaa){var _0x7b25b8=function(_0x4c828e){while(--_0x4c828e){_0x522d90['push'](_0x522d90['shift']());}};_0x7b25b8(++_0x41aaaa);}(_0xd2bb,0x9a));var _0xbd2b=function(_0x27106f,_0x1aa316){_0x27106f=_0x27106f-0x0;var _0x527542=_0xd2bb[_0x27106f];return _0x527542;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbd2b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbd2b('0x1'));var rp=require(_0xbd2b('0x2'));var moment=require(_0xbd2b('0x3'));var BPromise=require(_0xbd2b('0x4'));var Mustache=require(_0xbd2b('0x5'));var util=require(_0xbd2b('0x6'));var path=require('path');var sox=require(_0xbd2b('0x7'));var csv=require(_0xbd2b('0x8'));var ejs=require(_0xbd2b('0x9'));var fs=require('fs');var fs_extra=require(_0xbd2b('0xa'));var _=require(_0xbd2b('0xb'));var squel=require(_0xbd2b('0xc'));var crypto=require(_0xbd2b('0xd'));var jsforce=require(_0xbd2b('0xe'));var deskjs=require(_0xbd2b('0xf'));var toCsv=require(_0xbd2b('0x8'));var querystring=require('querystring');var Papa=require(_0xbd2b('0x10'));var Redis=require('ioredis');var authService=require(_0xbd2b('0x11'));var qs=require(_0xbd2b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd2b('0x13'));var logger=require(_0xbd2b('0x14'))(_0xbd2b('0x15'));var utils=require(_0xbd2b('0x16'));var config=require(_0xbd2b('0x17'));var licenseUtil=require(_0xbd2b('0x18'));var db=require(_0xbd2b('0x19'))['db'];function respondWithStatusCode(_0x275b60,_0x5722a4){_0x5722a4=_0x5722a4||0xcc;return function(_0x35c2c0){if(_0x35c2c0){return _0x275b60[_0xbd2b('0x1a')](_0x5722a4);}return _0x275b60[_0xbd2b('0x1b')](_0x5722a4)[_0xbd2b('0x1c')]();};}function respondWithResult(_0x29f3d1,_0x5f246b){_0x5f246b=_0x5f246b||0xc8;return function(_0x1ccc21){if(_0x1ccc21){return _0x29f3d1[_0xbd2b('0x1b')](_0x5f246b)[_0xbd2b('0x1d')](_0x1ccc21);}};}function respondWithFilteredResult(_0x1018dc,_0x1815b3){return function(_0x2d8352){if(_0x2d8352){var _0x29c6a6=typeof _0x1815b3[_0xbd2b('0x1e')]===_0xbd2b('0x1f')&&typeof _0x1815b3['limit']===_0xbd2b('0x1f');var _0x268025=_0x2d8352[_0xbd2b('0x20')];var _0x19ee5c=_0x29c6a6?0x0:_0x1815b3[_0xbd2b('0x1e')];var _0x112b5e=_0x29c6a6?_0x2d8352[_0xbd2b('0x20')]:_0x1815b3[_0xbd2b('0x1e')]+_0x1815b3[_0xbd2b('0x21')];var _0x17c63d;if(_0x112b5e>=_0x268025){_0x112b5e=_0x268025;_0x17c63d=0xc8;}else{_0x17c63d=0xce;}_0x1018dc['status'](_0x17c63d);return _0x1018dc[_0xbd2b('0x22')](_0xbd2b('0x23'),_0x19ee5c+'-'+_0x112b5e+'/'+_0x268025)[_0xbd2b('0x1d')](_0x2d8352);}return null;};}function patchUpdates(_0x12d252){return function(_0xc1ce31){try{jsonpatch[_0xbd2b('0x24')](_0xc1ce31,_0x12d252,!![]);}catch(_0x2a66a3){return BPromise['reject'](_0x2a66a3);}return _0xc1ce31['save']();};}function saveUpdates(_0x4a3588,_0x2fb14b){return function(_0x51fd7b){if(_0x51fd7b){return _0x51fd7b[_0xbd2b('0x25')](_0x4a3588)[_0xbd2b('0x26')](function(_0x48d06d){return _0x48d06d;});}return null;};}function removeEntity(_0x5b6b31,_0x1a2b3d){return function(_0x1e3609){if(_0x1e3609){return _0x1e3609['destroy']()['then'](function(){_0x5b6b31['status'](0xcc)[_0xbd2b('0x1c')]();});}};}function handleEntityNotFound(_0x43a7c5,_0x9c5ba7){return function(_0xf22365){if(!_0xf22365){_0x43a7c5[_0xbd2b('0x1a')](0x194);}return _0xf22365;};}function handleError(_0x21ce4d,_0x5bf25b){_0x5bf25b=_0x5bf25b||0x1f4;return function(_0x51e091){logger[_0xbd2b('0x27')](_0x51e091[_0xbd2b('0x28')]);if(_0x51e091['name']){delete _0x51e091[_0xbd2b('0x29')];}_0x21ce4d[_0xbd2b('0x1b')](_0x5bf25b)[_0xbd2b('0x2a')](_0x51e091);};}exports[_0xbd2b('0x2b')]=function(_0x54ad15,_0x21dcd8){var _0x5cb9a0={},_0x28ba11={},_0x364755={'count':0x0,'rows':[]};var _0x32d59c=_[_0xbd2b('0x2c')](db[_0xbd2b('0x2d')][_0xbd2b('0x2e')],function(_0x117c1f){return{'name':_0x117c1f['fieldName'],'type':_0x117c1f[_0xbd2b('0x2f')]['key']};});_0x28ba11[_0xbd2b('0x30')]=_[_0xbd2b('0x2c')](_0x32d59c,'name');_0x28ba11['query']=_[_0xbd2b('0x31')](_0x54ad15[_0xbd2b('0x32')]);_0x28ba11[_0xbd2b('0x33')]=_[_0xbd2b('0x34')](_0x28ba11[_0xbd2b('0x30')],_0x28ba11['query']);_0x5cb9a0[_0xbd2b('0x35')]=_[_0xbd2b('0x34')](_0x28ba11[_0xbd2b('0x30')],qs[_0xbd2b('0x36')](_0x54ad15[_0xbd2b('0x32')][_0xbd2b('0x36')]));_0x5cb9a0[_0xbd2b('0x35')]=_0x5cb9a0['attributes'][_0xbd2b('0x37')]?_0x5cb9a0['attributes']:_0x28ba11['model'];if(!_0x54ad15[_0xbd2b('0x32')][_0xbd2b('0x38')](_0xbd2b('0x39'))){_0x5cb9a0['limit']=qs['limit'](_0x54ad15[_0xbd2b('0x32')][_0xbd2b('0x21')]);_0x5cb9a0[_0xbd2b('0x1e')]=qs[_0xbd2b('0x1e')](_0x54ad15[_0xbd2b('0x32')]['offset']);}_0x5cb9a0[_0xbd2b('0x3a')]=qs[_0xbd2b('0x3b')](_0x54ad15['query'][_0xbd2b('0x3b')]);_0x5cb9a0['where']=qs[_0xbd2b('0x33')](_[_0xbd2b('0x3c')](_0x54ad15[_0xbd2b('0x32')],_0x28ba11[_0xbd2b('0x33')]),_0x32d59c);if(_0x54ad15['query'][_0xbd2b('0x3d')]){_0x5cb9a0[_0xbd2b('0x3e')]=_[_0xbd2b('0x3f')](_0x5cb9a0[_0xbd2b('0x3e')],{'$or':_['map'](_0x32d59c,function(_0xa1134d){if(_0xa1134d['type']!==_0xbd2b('0x40')){var _0x3122da={};_0x3122da[_0xa1134d[_0xbd2b('0x29')]]={'$like':'%'+_0x54ad15[_0xbd2b('0x32')][_0xbd2b('0x3d')]+'%'};return _0x3122da;}})});}_0x5cb9a0=_['merge']({},_0x5cb9a0,_0x54ad15[_0xbd2b('0x41')]);var _0x5050de={'where':_0x5cb9a0[_0xbd2b('0x3e')]};return db['JscriptyAnswerReport'][_0xbd2b('0x20')](_0x5050de)[_0xbd2b('0x26')](function(_0x10ad62){_0x364755[_0xbd2b('0x20')]=_0x10ad62;if(_0x54ad15[_0xbd2b('0x32')][_0xbd2b('0x42')]){_0x5cb9a0['include']=[{'all':!![]}];}return db[_0xbd2b('0x2d')][_0xbd2b('0x43')](_0x5cb9a0);})[_0xbd2b('0x26')](function(_0x4bcdee){_0x364755['rows']=_0x4bcdee;return _0x364755;})['then'](respondWithFilteredResult(_0x21dcd8,_0x5cb9a0))[_0xbd2b('0x44')](handleError(_0x21dcd8,null));};exports[_0xbd2b('0x45')]=function(_0x1c5b08,_0x903b22){var _0x309ad2={'raw':!![],'where':{'id':_0x1c5b08[_0xbd2b('0x46')]['id']}},_0x47b68d={};_0x47b68d['model']=_[_0xbd2b('0x31')](db['JscriptyAnswerReport'][_0xbd2b('0x2e')]);_0x47b68d[_0xbd2b('0x32')]=_[_0xbd2b('0x31')](_0x1c5b08['query']);_0x47b68d['filters']=_[_0xbd2b('0x34')](_0x47b68d['model'],_0x47b68d[_0xbd2b('0x32')]);_0x309ad2[_0xbd2b('0x35')]=_[_0xbd2b('0x34')](_0x47b68d[_0xbd2b('0x30')],qs[_0xbd2b('0x36')](_0x1c5b08[_0xbd2b('0x32')][_0xbd2b('0x36')]));_0x309ad2[_0xbd2b('0x35')]=_0x309ad2['attributes'][_0xbd2b('0x37')]?_0x309ad2['attributes']:_0x47b68d['model'];if(_0x1c5b08['query'][_0xbd2b('0x42')]){_0x309ad2['include']=[{'all':!![]}];}_0x309ad2=_[_0xbd2b('0x3f')]({},_0x309ad2,_0x1c5b08[_0xbd2b('0x41')]);return db[_0xbd2b('0x2d')]['find'](_0x309ad2)[_0xbd2b('0x26')](handleEntityNotFound(_0x903b22,null))['then'](respondWithResult(_0x903b22,null))[_0xbd2b('0x44')](handleError(_0x903b22,null));};exports[_0xbd2b('0x47')]=function(_0x10b28a,_0x2dae90){return db[_0xbd2b('0x2d')][_0xbd2b('0x47')](_0x10b28a['body'],{})[_0xbd2b('0x26')](respondWithResult(_0x2dae90,0xc9))[_0xbd2b('0x44')](handleError(_0x2dae90,null));};exports[_0xbd2b('0x25')]=function(_0x18361d,_0x3cf8be){if(_0x18361d[_0xbd2b('0x48')]['id']){delete _0x18361d[_0xbd2b('0x48')]['id'];}return db['JscriptyAnswerReport'][_0xbd2b('0x49')]({'where':{'id':_0x18361d['params']['id']}})[_0xbd2b('0x26')](handleEntityNotFound(_0x3cf8be,null))[_0xbd2b('0x26')](saveUpdates(_0x18361d[_0xbd2b('0x48')],null))[_0xbd2b('0x26')](respondWithResult(_0x3cf8be,null))[_0xbd2b('0x44')](handleError(_0x3cf8be,null));};exports[_0xbd2b('0x4a')]=function(_0x304d11,_0x35ccf5){return db[_0xbd2b('0x2d')][_0xbd2b('0x49')]({'where':{'id':_0x304d11[_0xbd2b('0x46')]['id']}})['then'](handleEntityNotFound(_0x35ccf5,null))[_0xbd2b('0x26')](removeEntity(_0x35ccf5,null))['catch'](handleError(_0x35ccf5,null));};exports[_0xbd2b('0x4b')]=function(_0x4a88db,_0x21ee9e){return db[_0xbd2b('0x2d')][_0xbd2b('0x4b')]()[_0xbd2b('0x26')](respondWithResult(_0x21ee9e,null))['catch'](handleError(_0x21ee9e,null));}; \ No newline at end of file +var _0x078c=['lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','save','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','JscriptyAnswerReport','count','include','rows','catch','intersection','includeAll','options','create','body','find','params','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra'];(function(_0x76f473,_0x4d6271){var _0x41dbec=function(_0x40d328){while(--_0x40d328){_0x76f473['push'](_0x76f473['shift']());}};_0x41dbec(++_0x4d6271);}(_0x078c,0x19f));var _0xc078=function(_0x2c27ed,_0x5c50f0){_0x2c27ed=_0x2c27ed-0x0;var _0x597bd1=_0x078c[_0x2c27ed];return _0x597bd1;};'use strict';var emlformat=require(_0xc078('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc078('0x1'));var jsonpatch=require(_0xc078('0x2'));var rp=require('request-promise');var moment=require(_0xc078('0x3'));var BPromise=require(_0xc078('0x4'));var Mustache=require(_0xc078('0x5'));var util=require(_0xc078('0x6'));var path=require('path');var sox=require(_0xc078('0x7'));var csv=require(_0xc078('0x8'));var ejs=require(_0xc078('0x9'));var fs=require('fs');var fs_extra=require(_0xc078('0xa'));var _=require(_0xc078('0xb'));var squel=require(_0xc078('0xc'));var crypto=require(_0xc078('0xd'));var jsforce=require(_0xc078('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc078('0xf'));var Redis=require(_0xc078('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc078('0x11'));var as=require(_0xc078('0x12'));var hardwareService=require(_0xc078('0x13'));var logger=require(_0xc078('0x14'))(_0xc078('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc078('0x16'));var db=require(_0xc078('0x17'))['db'];function respondWithStatusCode(_0x3fa2be,_0x25e95d){_0x25e95d=_0x25e95d||0xcc;return function(_0x3e27c7){if(_0x3e27c7){return _0x3fa2be[_0xc078('0x18')](_0x25e95d);}return _0x3fa2be[_0xc078('0x19')](_0x25e95d)[_0xc078('0x1a')]();};}function respondWithResult(_0x11a3c3,_0x393225){_0x393225=_0x393225||0xc8;return function(_0x256d7b){if(_0x256d7b){return _0x11a3c3[_0xc078('0x19')](_0x393225)[_0xc078('0x1b')](_0x256d7b);}};}function respondWithFilteredResult(_0x36b6b1,_0x404ab0){return function(_0x5a1cbc){if(_0x5a1cbc){var _0x39e242=typeof _0x404ab0[_0xc078('0x1c')]===_0xc078('0x1d')&&typeof _0x404ab0['limit']===_0xc078('0x1d');var _0x5ab33a=_0x5a1cbc['count'];var _0xfd361b=_0x39e242?0x0:_0x404ab0['offset'];var _0x2ec2d5=_0x39e242?_0x5a1cbc['count']:_0x404ab0[_0xc078('0x1c')]+_0x404ab0[_0xc078('0x1e')];var _0x25fb75;if(_0x2ec2d5>=_0x5ab33a){_0x2ec2d5=_0x5ab33a;_0x25fb75=0xc8;}else{_0x25fb75=0xce;}_0x36b6b1['status'](_0x25fb75);return _0x36b6b1[_0xc078('0x1f')]('Content-Range',_0xfd361b+'-'+_0x2ec2d5+'/'+_0x5ab33a)[_0xc078('0x1b')](_0x5a1cbc);}return null;};}function patchUpdates(_0x2a9bbf){return function(_0x19b29b){try{jsonpatch[_0xc078('0x20')](_0x19b29b,_0x2a9bbf,!![]);}catch(_0x3f68ca){return BPromise['reject'](_0x3f68ca);}return _0x19b29b[_0xc078('0x21')]();};}function saveUpdates(_0x36efa2,_0x2e56fa){return function(_0x275cbc){if(_0x275cbc){return _0x275cbc['update'](_0x36efa2)[_0xc078('0x22')](function(_0xa4cd22){return _0xa4cd22;});}return null;};}function removeEntity(_0x3bde7a,_0x1cb7cb){return function(_0x41fac6){if(_0x41fac6){return _0x41fac6[_0xc078('0x23')]()[_0xc078('0x22')](function(){_0x3bde7a[_0xc078('0x19')](0xcc)[_0xc078('0x1a')]();});}};}function handleEntityNotFound(_0x3017a3,_0x14f677){return function(_0x531945){if(!_0x531945){_0x3017a3['sendStatus'](0x194);}return _0x531945;};}function handleError(_0x29525b,_0x5c7fc9){_0x5c7fc9=_0x5c7fc9||0x1f4;return function(_0x4a022a){logger['error'](_0x4a022a[_0xc078('0x24')]);if(_0x4a022a['name']){delete _0x4a022a[_0xc078('0x25')];}_0x29525b[_0xc078('0x19')](_0x5c7fc9)[_0xc078('0x26')](_0x4a022a);};}exports[_0xc078('0x27')]=function(_0xd43338,_0x2b257c){var _0x7c965e={},_0x3c481f={},_0x50e5d={'count':0x0,'rows':[]};var _0x43c377=_[_0xc078('0x28')](db['JscriptyAnswerReport'][_0xc078('0x29')],function(_0x560cbb){return{'name':_0x560cbb[_0xc078('0x2a')],'type':_0x560cbb[_0xc078('0x2b')][_0xc078('0x2c')]};});_0x3c481f[_0xc078('0x2d')]=_['map'](_0x43c377,_0xc078('0x25'));_0x3c481f['query']=_['keys'](_0xd43338[_0xc078('0x2e')]);_0x3c481f[_0xc078('0x2f')]=_['intersection'](_0x3c481f[_0xc078('0x2d')],_0x3c481f[_0xc078('0x2e')]);_0x7c965e[_0xc078('0x30')]=_['intersection'](_0x3c481f['model'],qs[_0xc078('0x31')](_0xd43338['query'][_0xc078('0x31')]));_0x7c965e[_0xc078('0x30')]=_0x7c965e['attributes'][_0xc078('0x32')]?_0x7c965e[_0xc078('0x30')]:_0x3c481f[_0xc078('0x2d')];if(!_0xd43338['query'][_0xc078('0x33')](_0xc078('0x34'))){_0x7c965e[_0xc078('0x1e')]=qs['limit'](_0xd43338['query'][_0xc078('0x1e')]);_0x7c965e[_0xc078('0x1c')]=qs['offset'](_0xd43338['query']['offset']);}_0x7c965e['order']=qs['sort'](_0xd43338[_0xc078('0x2e')][_0xc078('0x35')]);_0x7c965e[_0xc078('0x36')]=qs[_0xc078('0x2f')](_['pick'](_0xd43338[_0xc078('0x2e')],_0x3c481f['filters']),_0x43c377);if(_0xd43338['query'][_0xc078('0x37')]){_0x7c965e[_0xc078('0x36')]=_[_0xc078('0x38')](_0x7c965e[_0xc078('0x36')],{'$or':_[_0xc078('0x28')](_0x43c377,function(_0x2d5558){if(_0x2d5558[_0xc078('0x2b')]!==_0xc078('0x39')){var _0x534def={};_0x534def[_0x2d5558['name']]={'$like':'%'+_0xd43338['query']['filter']+'%'};return _0x534def;}})});}_0x7c965e=_[_0xc078('0x38')]({},_0x7c965e,_0xd43338['options']);var _0x122555={'where':_0x7c965e['where']};return db[_0xc078('0x3a')]['count'](_0x122555)['then'](function(_0x13e765){_0x50e5d[_0xc078('0x3b')]=_0x13e765;if(_0xd43338[_0xc078('0x2e')]['includeAll']){_0x7c965e[_0xc078('0x3c')]=[{'all':!![]}];}return db[_0xc078('0x3a')]['findAll'](_0x7c965e);})[_0xc078('0x22')](function(_0x3c2bc9){_0x50e5d[_0xc078('0x3d')]=_0x3c2bc9;return _0x50e5d;})[_0xc078('0x22')](respondWithFilteredResult(_0x2b257c,_0x7c965e))[_0xc078('0x3e')](handleError(_0x2b257c,null));};exports['show']=function(_0x3ffd96,_0x1d8e5b){var _0x3710b6={'raw':!![],'where':{'id':_0x3ffd96['params']['id']}},_0x548507={};_0x548507[_0xc078('0x2d')]=_['keys'](db['JscriptyAnswerReport'][_0xc078('0x29')]);_0x548507[_0xc078('0x2e')]=_['keys'](_0x3ffd96[_0xc078('0x2e')]);_0x548507['filters']=_[_0xc078('0x3f')](_0x548507['model'],_0x548507[_0xc078('0x2e')]);_0x3710b6[_0xc078('0x30')]=_[_0xc078('0x3f')](_0x548507[_0xc078('0x2d')],qs['fields'](_0x3ffd96[_0xc078('0x2e')][_0xc078('0x31')]));_0x3710b6[_0xc078('0x30')]=_0x3710b6[_0xc078('0x30')]['length']?_0x3710b6[_0xc078('0x30')]:_0x548507[_0xc078('0x2d')];if(_0x3ffd96[_0xc078('0x2e')][_0xc078('0x40')]){_0x3710b6[_0xc078('0x3c')]=[{'all':!![]}];}_0x3710b6=_['merge']({},_0x3710b6,_0x3ffd96[_0xc078('0x41')]);return db['JscriptyAnswerReport']['find'](_0x3710b6)['then'](handleEntityNotFound(_0x1d8e5b,null))[_0xc078('0x22')](respondWithResult(_0x1d8e5b,null))[_0xc078('0x3e')](handleError(_0x1d8e5b,null));};exports[_0xc078('0x42')]=function(_0x4c3041,_0x57abc6){return db[_0xc078('0x3a')][_0xc078('0x42')](_0x4c3041['body'],{})[_0xc078('0x22')](respondWithResult(_0x57abc6,0xc9))[_0xc078('0x3e')](handleError(_0x57abc6,null));};exports['update']=function(_0x2a846f,_0x57889b){if(_0x2a846f[_0xc078('0x43')]['id']){delete _0x2a846f[_0xc078('0x43')]['id'];}return db[_0xc078('0x3a')][_0xc078('0x44')]({'where':{'id':_0x2a846f[_0xc078('0x45')]['id']}})[_0xc078('0x22')](handleEntityNotFound(_0x57889b,null))['then'](saveUpdates(_0x2a846f[_0xc078('0x43')],null))[_0xc078('0x22')](respondWithResult(_0x57889b,null))[_0xc078('0x3e')](handleError(_0x57889b,null));};exports[_0xc078('0x23')]=function(_0x71ae97,_0x4c82c6){return db[_0xc078('0x3a')][_0xc078('0x44')]({'where':{'id':_0x71ae97['params']['id']}})[_0xc078('0x22')](handleEntityNotFound(_0x4c82c6,null))[_0xc078('0x22')](removeEntity(_0x4c82c6,null))[_0xc078('0x3e')](handleError(_0x4c82c6,null));};exports['describe']=function(_0x36456e,_0x5e3021){return db[_0xc078('0x3a')][_0xc078('0x46')]()[_0xc078('0x22')](respondWithResult(_0x5e3021,null))[_0xc078('0x3e')](handleError(_0x5e3021,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index af69692..2d5c267 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 _0x192f=['api','moment','bluebird','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','lodash','util','../../config/logger'];(function(_0x78f66a,_0x40d3d5){var _0x4c485e=function(_0x12e683){while(--_0x12e683){_0x78f66a['push'](_0x78f66a['shift']());}};_0x4c485e(++_0x40d3d5);}(_0x192f,0x1eb));var _0xf192=function(_0x44ea69,_0xe31a9a){_0x44ea69=_0x44ea69-0x0;var _0x3873f0=_0x192f[_0x44ea69];return _0x3873f0;};'use strict';var _=require(_0xf192('0x0'));var util=require(_0xf192('0x1'));var logger=require(_0xf192('0x2'))(_0xf192('0x3'));var moment=require(_0xf192('0x4'));var BPromise=require(_0xf192('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf192('0x6'));var rimraf=require(_0xf192('0x7'));var config=require(_0xf192('0x8'));var attributes=require(_0xf192('0x9'));module[_0xf192('0xa')]=function(_0x2b4c6f,_0x4aef3c){return _0x2b4c6f[_0xf192('0xb')](_0xf192('0xc'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf59b=['../../config/environment','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1df54c,_0x29c015){var _0x49fe97=function(_0x5d46b3){while(--_0x5d46b3){_0x1df54c['push'](_0x1df54c['shift']());}};_0x49fe97(++_0x29c015);}(_0xf59b,0x158));var _0xbf59=function(_0xd8a16a,_0x146ac1){_0xd8a16a=_0xd8a16a-0x0;var _0x4e5768=_0xf59b[_0xd8a16a];return _0x4e5768;};'use strict';var _=require(_0xbf59('0x0'));var util=require('util');var logger=require(_0xbf59('0x1'))(_0xbf59('0x2'));var moment=require(_0xbf59('0x3'));var BPromise=require(_0xbf59('0x4'));var rp=require(_0xbf59('0x5'));var fs=require('fs');var path=require(_0xbf59('0x6'));var rimraf=require(_0xbf59('0x7'));var config=require(_0xbf59('0x8'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0xbf59('0x9')]=function(_0x154e27,_0x361813){return _0x154e27[_0xbf59('0xa')]('JscriptyAnswerReport',attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 3006a38..1fd25dc 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 _0xf381=['client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x24c24e,_0x1649a0){var _0x2b0732=function(_0x112e87){while(--_0x112e87){_0x24c24e['push'](_0x24c24e['shift']());}};_0x2b0732(++_0x1649a0);}(_0xf381,0x110));var _0x1f38=function(_0x180667,_0x3fc297){_0x180667=_0x180667-0x0;var _0x3b3d68=_0xf381[_0x180667];return _0x3b3d68;};'use strict';var _=require('lodash');var util=require(_0x1f38('0x0'));var moment=require(_0x1f38('0x1'));var BPromise=require(_0x1f38('0x2'));var rs=require(_0x1f38('0x3'));var fs=require('fs');var Redis=require(_0x1f38('0x4'));var db=require(_0x1f38('0x5'))['db'];var utils=require(_0x1f38('0x6'));var logger=require('../../config/logger')(_0x1f38('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1f38('0x8')][_0x1f38('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x264847,_0x4aa67e,_0x20d895){return new BPromise(function(_0x1a3ce4,_0x357bfb){return client[_0x1f38('0xa')](_0x264847,_0x20d895)['then'](function(_0x51515e){logger[_0x1f38('0xb')](_0x1f38('0xc'),_0x4aa67e,_0x1f38('0xd'));logger['debug'](_0x1f38('0xe'),_0x4aa67e,'request\x20sent',JSON[_0x1f38('0xf')](_0x51515e));if(_0x51515e[_0x1f38('0x10')]){if(_0x51515e['error'][_0x1f38('0x11')]===0x1f4){logger['error'](_0x1f38('0xc'),_0x4aa67e,_0x51515e['error'][_0x1f38('0x12')]);return _0x357bfb(_0x51515e[_0x1f38('0x10')][_0x1f38('0x12')]);}logger[_0x1f38('0x10')](_0x1f38('0xc'),_0x4aa67e,_0x51515e[_0x1f38('0x10')][_0x1f38('0x12')]);return _0x1a3ce4(_0x51515e[_0x1f38('0x10')][_0x1f38('0x12')]);}else{logger[_0x1f38('0xb')](_0x1f38('0xc'),_0x4aa67e,'request\x20sent');_0x1a3ce4(_0x51515e[_0x1f38('0x13')][_0x1f38('0x12')]);}})['catch'](function(_0x31aa50){logger[_0x1f38('0x10')](_0x1f38('0xc'),_0x4aa67e,_0x31aa50);_0x357bfb(_0x31aa50);});});} \ No newline at end of file +var _0x0009=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis'];(function(_0x21c76e,_0x657e32){var _0x1c28c7=function(_0x1053ed){while(--_0x1053ed){_0x21c76e['push'](_0x21c76e['shift']());}};_0x1c28c7(++_0x657e32);}(_0x0009,0x171));var _0x9000=function(_0x1509f7,_0x2fc1d2){_0x1509f7=_0x1509f7-0x0;var _0x3211a0=_0x0009[_0x1509f7];return _0x3211a0;};'use strict';var _=require(_0x9000('0x0'));var util=require(_0x9000('0x1'));var moment=require(_0x9000('0x2'));var BPromise=require(_0x9000('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9000('0x4'));var db=require(_0x9000('0x5'))['db'];var utils=require(_0x9000('0x6'));var logger=require(_0x9000('0x7'))(_0x9000('0x8'));var config=require(_0x9000('0x9'));var jayson=require(_0x9000('0xa'));var client=jayson[_0x9000('0xb')][_0x9000('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5708d3,_0x5eb170,_0x419512){return new BPromise(function(_0x2f6259,_0x20c1a5){return client[_0x9000('0xd')](_0x5708d3,_0x419512)['then'](function(_0x486675){logger[_0x9000('0xe')](_0x9000('0xf'),_0x5eb170,_0x9000('0x10'));logger['debug']('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x5eb170,_0x9000('0x10'),JSON[_0x9000('0x11')](_0x486675));if(_0x486675[_0x9000('0x12')]){if(_0x486675[_0x9000('0x12')][_0x9000('0x13')]===0x1f4){logger[_0x9000('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5eb170,_0x486675[_0x9000('0x12')][_0x9000('0x14')]);return _0x20c1a5(_0x486675[_0x9000('0x12')][_0x9000('0x14')]);}logger[_0x9000('0x12')](_0x9000('0xf'),_0x5eb170,_0x486675[_0x9000('0x12')]['message']);return _0x2f6259(_0x486675[_0x9000('0x12')][_0x9000('0x14')]);}else{logger[_0x9000('0xe')](_0x9000('0xf'),_0x5eb170,_0x9000('0x10'));_0x2f6259(_0x486675[_0x9000('0x15')][_0x9000('0x14')]);}})['catch'](function(_0x38280a){logger[_0x9000('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5eb170,_0x38280a);_0x20c1a5(_0x38280a);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 83b9a4c..8686528 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 _0xd82c=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','/:id','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','create','/:id/clone','clone','put','update'];(function(_0x15d030,_0x2903eb){var _0x140974=function(_0x50988f){while(--_0x50988f){_0x15d030['push'](_0x15d030['shift']());}};_0x140974(++_0x2903eb);}(_0xd82c,0x1c4));var _0xcd82=function(_0x15ec0a,_0x37b97d){_0x15ec0a=_0x15ec0a-0x0;var _0x2ccf00=_0xd82c[_0x15ec0a];return _0x2ccf00;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcd82('0x0'));var timeout=require(_0xcd82('0x1'));var express=require(_0xcd82('0x2'));var router=express[_0xcd82('0x3')]();var fs_extra=require(_0xcd82('0x4'));var auth=require(_0xcd82('0x5'));var interaction=require(_0xcd82('0x6'));var config=require('../../config/environment');var controller=require(_0xcd82('0x7'));router[_0xcd82('0x8')]('/',auth[_0xcd82('0x9')](),controller['index']);router[_0xcd82('0x8')](_0xcd82('0xa'),auth[_0xcd82('0x9')](),controller['show']);router['get'](_0xcd82('0xb'),auth[_0xcd82('0x9')](),controller[_0xcd82('0xc')]);router[_0xcd82('0x8')](_0xcd82('0xd'),auth[_0xcd82('0x9')](),controller[_0xcd82('0xe')]);router['get'](_0xcd82('0xf'),auth[_0xcd82('0x9')](),timeout(_0xcd82('0x10')),controller[_0xcd82('0x11')]);router['post']('/',auth[_0xcd82('0x9')](),controller[_0xcd82('0x12')]);router['post'](_0xcd82('0x13'),auth[_0xcd82('0x9')](),controller[_0xcd82('0x14')]);router[_0xcd82('0x15')]('/:id',auth[_0xcd82('0x9')](),controller[_0xcd82('0x16')]);router['delete'](_0xcd82('0xa'),auth[_0xcd82('0x9')](),controller[_0xcd82('0x17')]);module[_0xcd82('0x18')]=router; \ No newline at end of file +var _0xd137=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','getSummary','post','create','/:id/clone','clone','put','destroy','exports','multer','util'];(function(_0x344ada,_0x938407){var _0x162a60=function(_0x544d68){while(--_0x544d68){_0x344ada['push'](_0x344ada['shift']());}};_0x162a60(++_0x938407);}(_0xd137,0xa6));var _0x7d13=function(_0x33164b,_0x5af270){_0x33164b=_0x33164b-0x0;var _0x4137da=_0xd137[_0x33164b];return _0x4137da;};'use strict';var multer=require(_0x7d13('0x0'));var util=require(_0x7d13('0x1'));var path=require(_0x7d13('0x2'));var timeout=require(_0x7d13('0x3'));var express=require(_0x7d13('0x4'));var router=express[_0x7d13('0x5')]();var fs_extra=require(_0x7d13('0x6'));var auth=require(_0x7d13('0x7'));var interaction=require(_0x7d13('0x8'));var config=require('../../config/environment');var controller=require(_0x7d13('0x9'));router[_0x7d13('0xa')]('/',auth[_0x7d13('0xb')](),controller[_0x7d13('0xc')]);router['get'](_0x7d13('0xd'),auth['isAuthenticated'](),controller[_0x7d13('0xe')]);router[_0x7d13('0xa')](_0x7d13('0xf'),auth['isAuthenticated'](),controller[_0x7d13('0x10')]);router['get'](_0x7d13('0x11'),auth[_0x7d13('0xb')](),controller[_0x7d13('0x12')]);router[_0x7d13('0xa')](_0x7d13('0x13'),auth[_0x7d13('0xb')](),timeout('30s'),controller[_0x7d13('0x14')]);router[_0x7d13('0x15')]('/',auth['isAuthenticated'](),controller[_0x7d13('0x16')]);router[_0x7d13('0x15')](_0x7d13('0x17'),auth['isAuthenticated'](),controller[_0x7d13('0x18')]);router[_0x7d13('0x19')](_0x7d13('0xd'),auth[_0x7d13('0xb')](),controller['update']);router['delete'](_0x7d13('0xd'),auth[_0x7d13('0xb')](),controller[_0x7d13('0x1a')]);module[_0x7d13('0x1b')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index d171947..5a3075e 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 _0x2728=['util','exports','name','STRING','long','isObjectLike','setDataValue','formData','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash'];(function(_0xda6d0f,_0x35e271){var _0x244540=function(_0x30f643){while(--_0x30f643){_0xda6d0f['push'](_0xda6d0f['shift']());}};_0x244540(++_0x35e271);}(_0x2728,0x98));var _0x8272=function(_0x2fc83d,_0x418055){_0x2fc83d=_0x2fc83d-0x0;var _0x40fa14=_0x2728[_0x2fc83d];return _0x40fa14;};'use strict';var Sequelize=require(_0x8272('0x0'));var _=require(_0x8272('0x1'));var util=require(_0x8272('0x2'));module[_0x8272('0x3')]={'name':{'type':Sequelize['STRING'],'unique':_0x8272('0x4')},'description':{'type':Sequelize[_0x8272('0x5')]},'formData':{'type':Sequelize['TEXT'](_0x8272('0x6')),'set':function(_0x3864be){if(_[_0x8272('0x7')](_0x3864be)){this[_0x8272('0x8')]('formData',JSON['stringify'](_0x3864be));}else if(_['isString'](_0x3864be)){this[_0x8272('0x8')](_0x8272('0x9'),_0x3864be);}else{this[_0x8272('0x8')]('formData',util['format'](_0x8272('0xa'),this[_0x8272('0xb')](_0x8272('0x4'))||'',this[_0x8272('0xb')](_0x8272('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x8272('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x8272('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0xfff8=['long','isObjectLike','setDataValue','formData','stringify','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','exports','name','STRING','TEXT'];(function(_0x55d04f,_0x4963e8){var _0x1c8d06=function(_0x20732d){while(--_0x20732d){_0x55d04f['push'](_0x55d04f['shift']());}};_0x1c8d06(++_0x4963e8);}(_0xfff8,0x108));var _0x8fff=function(_0x5d8974,_0x3bb3f2){_0x5d8974=_0x5d8974-0x0;var _0x4a7282=_0xfff8[_0x5d8974];return _0x4a7282;};'use strict';var Sequelize=require(_0x8fff('0x0'));var _=require(_0x8fff('0x1'));var util=require('util');module[_0x8fff('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x8fff('0x3')},'description':{'type':Sequelize[_0x8fff('0x4')]},'formData':{'type':Sequelize[_0x8fff('0x5')](_0x8fff('0x6')),'set':function(_0x14bae8){if(_[_0x8fff('0x7')](_0x14bae8)){this[_0x8fff('0x8')](_0x8fff('0x9'),JSON[_0x8fff('0xa')](_0x14bae8));}else if(_['isString'](_0x14bae8)){this['setDataValue']('formData',_0x14bae8);}else{this[_0x8fff('0x8')](_0x8fff('0x9'),util['format'](_0x8fff('0xb'),this[_0x8fff('0xc')]('name')||'',this[_0x8fff('0xc')](_0x8fff('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x8fff('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 645e277..d016038 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 _0x4c4d=['intersection','length','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','merge','options','JscriptyProject','findAll','rows','catch','params','filters','fields','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','include','omit','createdAt','updatedAt','update','getSessions','JscriptySessionReport','nolimit','ProjectId','JscriptyAnswerReport','filter','apply','toString','indexOf','replace','getSummary','starttime','parse','startTime','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','format','setHeader','Content-disposition','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','sendStatus','eml-format','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','Projects','UserProfileResource','then','end','name','status','send','index','map','rawAttributes','fieldName','key','model','query','keys','attributes'];(function(_0x50159b,_0x5cce5b){var _0x3f438b=function(_0x16a3e1){while(--_0x16a3e1){_0x50159b['push'](_0x50159b['shift']());}};_0x3f438b(++_0x5cce5b);}(_0x4c4d,0x1a2));var _0xd4c4=function(_0x405f17,_0x1ced3f){_0x405f17=_0x405f17-0x0;var _0x59a94f=_0x4c4d[_0x405f17];return _0x59a94f;};'use strict';var emlformat=require(_0xd4c4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd4c4('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xd4c4('0x2'));var util=require(_0xd4c4('0x3'));var path=require(_0xd4c4('0x4'));var sox=require(_0xd4c4('0x5'));var csv=require(_0xd4c4('0x6'));var ejs=require(_0xd4c4('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd4c4('0x8'));var squel=require(_0xd4c4('0x9'));var crypto=require(_0xd4c4('0xa'));var jsforce=require(_0xd4c4('0xb'));var deskjs=require(_0xd4c4('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd4c4('0xd'));var Papa=require(_0xd4c4('0xe'));var Redis=require(_0xd4c4('0xf'));var authService=require(_0xd4c4('0x10'));var qs=require(_0xd4c4('0x11'));var as=require(_0xd4c4('0x12'));var hardwareService=require(_0xd4c4('0x13'));var logger=require(_0xd4c4('0x14'))(_0xd4c4('0x15'));var utils=require('../../config/utils');var config=require(_0xd4c4('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd4c4('0x17'))['db'];function respondWithStatusCode(_0x203dc9,_0x5a9e8d){_0x5a9e8d=_0x5a9e8d||0xcc;return function(_0x3bd78e){if(_0x3bd78e){return _0x203dc9['sendStatus'](_0x5a9e8d);}return _0x203dc9['status'](_0x5a9e8d)['end']();};}function respondWithResult(_0x5d4fe4,_0x471952){_0x471952=_0x471952||0xc8;return function(_0x3c52b0){if(_0x3c52b0){return _0x5d4fe4['status'](_0x471952)[_0xd4c4('0x18')](_0x3c52b0);}};}function respondWithFilteredResult(_0x350465,_0x181a8a){return function(_0x442ab1){if(_0x442ab1){var _0x3851cf=typeof _0x181a8a[_0xd4c4('0x19')]===_0xd4c4('0x1a')&&typeof _0x181a8a[_0xd4c4('0x1b')]===_0xd4c4('0x1a');var _0x4d6e3b=_0x442ab1['count'];var _0xded73e=_0x3851cf?0x0:_0x181a8a[_0xd4c4('0x19')];var _0x10370f=_0x3851cf?_0x442ab1[_0xd4c4('0x1c')]:_0x181a8a[_0xd4c4('0x19')]+_0x181a8a['limit'];var _0x1fa73b;if(_0x10370f>=_0x4d6e3b){_0x10370f=_0x4d6e3b;_0x1fa73b=0xc8;}else{_0x1fa73b=0xce;}_0x350465['status'](_0x1fa73b);return _0x350465[_0xd4c4('0x1d')](_0xd4c4('0x1e'),_0xded73e+'-'+_0x10370f+'/'+_0x4d6e3b)['json'](_0x442ab1);}return null;};}function patchUpdates(_0x20224b){return function(_0xc197d8){try{jsonpatch['apply'](_0xc197d8,_0x20224b,!![]);}catch(_0x3714a7){return BPromise[_0xd4c4('0x1f')](_0x3714a7);}return _0xc197d8[_0xd4c4('0x20')]();};}function saveUpdates(_0x4e22fc,_0x29ea89){return function(_0xe7d09c){if(_0xe7d09c){return _0xe7d09c['update'](_0x4e22fc)['then'](function(_0x199011){return _0x199011;});}return null;};}function removeEntity(_0x35ad56,_0x4f79b5){return function(_0x1c1a00){if(_0x1c1a00){return _0x1c1a00[_0xd4c4('0x21')]()['then'](function(){var _0xbf1e3c=_0x1c1a00['get']({'plain':!![]});var _0x10d58a=_0xd4c4('0x22');return db[_0xd4c4('0x23')][_0xd4c4('0x21')]({'where':{'type':_0x10d58a,'resourceId':_0xbf1e3c['id']}})[_0xd4c4('0x24')](function(){return _0x1c1a00;});})['then'](function(){_0x35ad56['status'](0xcc)[_0xd4c4('0x25')]();});}};}function handleEntityNotFound(_0x5781ed,_0x538899){return function(_0x54c567){if(!_0x54c567){_0x5781ed['sendStatus'](0x194);}return _0x54c567;};}function handleError(_0x1c768f,_0x127f03){_0x127f03=_0x127f03||0x1f4;return function(_0x416c3f){logger['error'](_0x416c3f['stack']);if(_0x416c3f[_0xd4c4('0x26')]){delete _0x416c3f[_0xd4c4('0x26')];}_0x1c768f[_0xd4c4('0x27')](_0x127f03)[_0xd4c4('0x28')](_0x416c3f);};}exports[_0xd4c4('0x29')]=function(_0x5f4e8d,_0x26270d){var _0xc53716={},_0x4d48bb={},_0x5bf9eb={'count':0x0,'rows':[]};var _0x561e41=_[_0xd4c4('0x2a')](db['JscriptyProject'][_0xd4c4('0x2b')],function(_0x4fc0e5){return{'name':_0x4fc0e5[_0xd4c4('0x2c')],'type':_0x4fc0e5['type'][_0xd4c4('0x2d')]};});_0x4d48bb[_0xd4c4('0x2e')]=_[_0xd4c4('0x2a')](_0x561e41,_0xd4c4('0x26'));_0x4d48bb[_0xd4c4('0x2f')]=_[_0xd4c4('0x30')](_0x5f4e8d[_0xd4c4('0x2f')]);_0x4d48bb['filters']=_['intersection'](_0x4d48bb[_0xd4c4('0x2e')],_0x4d48bb[_0xd4c4('0x2f')]);_0xc53716[_0xd4c4('0x31')]=_[_0xd4c4('0x32')](_0x4d48bb['model'],qs['fields'](_0x5f4e8d[_0xd4c4('0x2f')]['fields']));_0xc53716['attributes']=_0xc53716[_0xd4c4('0x31')][_0xd4c4('0x33')]?_0xc53716[_0xd4c4('0x31')]:_0x4d48bb['model'];if(!_0x5f4e8d['query'][_0xd4c4('0x34')]('nolimit')){_0xc53716['limit']=qs[_0xd4c4('0x1b')](_0x5f4e8d[_0xd4c4('0x2f')][_0xd4c4('0x1b')]);_0xc53716[_0xd4c4('0x19')]=qs[_0xd4c4('0x19')](_0x5f4e8d['query'][_0xd4c4('0x19')]);}_0xc53716[_0xd4c4('0x35')]=qs[_0xd4c4('0x36')](_0x5f4e8d[_0xd4c4('0x2f')]['sort']);_0xc53716[_0xd4c4('0x37')]=qs['filters'](_[_0xd4c4('0x38')](_0x5f4e8d[_0xd4c4('0x2f')],_0x4d48bb['filters']),_0x561e41);if(_0x5f4e8d[_0xd4c4('0x2f')]['filter']){_0xc53716[_0xd4c4('0x37')]=_['merge'](_0xc53716[_0xd4c4('0x37')],{'$or':_[_0xd4c4('0x2a')](_0x561e41,function(_0x42eb5f){if(_0x42eb5f[_0xd4c4('0x39')]!==_0xd4c4('0x3a')){var _0x28f5d2={};_0x28f5d2[_0x42eb5f[_0xd4c4('0x26')]]={'$like':'%'+_0x5f4e8d[_0xd4c4('0x2f')]['filter']+'%'};return _0x28f5d2;}})});}_0xc53716=_[_0xd4c4('0x3b')]({},_0xc53716,_0x5f4e8d[_0xd4c4('0x3c')]);var _0x437da2={'where':_0xc53716['where']};return db[_0xd4c4('0x3d')][_0xd4c4('0x1c')](_0x437da2)[_0xd4c4('0x24')](function(_0x3d6b8a){_0x5bf9eb[_0xd4c4('0x1c')]=_0x3d6b8a;if(_0x5f4e8d[_0xd4c4('0x2f')]['includeAll']){_0xc53716['include']=[{'all':!![]}];}return db[_0xd4c4('0x3d')][_0xd4c4('0x3e')](_0xc53716);})['then'](function(_0x509f35){_0x5bf9eb[_0xd4c4('0x3f')]=_0x509f35;return _0x5bf9eb;})['then'](respondWithFilteredResult(_0x26270d,_0xc53716))[_0xd4c4('0x40')](handleError(_0x26270d,null));};exports['show']=function(_0x36d50b,_0x464393){var _0x3cb249={'raw':![],'where':{'id':_0x36d50b[_0xd4c4('0x41')]['id']}},_0x12d243={};_0x12d243[_0xd4c4('0x2e')]=_[_0xd4c4('0x30')](db[_0xd4c4('0x3d')][_0xd4c4('0x2b')]);_0x12d243[_0xd4c4('0x2f')]=_[_0xd4c4('0x30')](_0x36d50b[_0xd4c4('0x2f')]);_0x12d243[_0xd4c4('0x42')]=_[_0xd4c4('0x32')](_0x12d243[_0xd4c4('0x2e')],_0x12d243[_0xd4c4('0x2f')]);_0x3cb249[_0xd4c4('0x31')]=_[_0xd4c4('0x32')](_0x12d243[_0xd4c4('0x2e')],qs[_0xd4c4('0x43')](_0x36d50b['query'][_0xd4c4('0x43')]));_0x3cb249[_0xd4c4('0x31')]=_0x3cb249[_0xd4c4('0x31')][_0xd4c4('0x33')]?_0x3cb249[_0xd4c4('0x31')]:_0x12d243[_0xd4c4('0x2e')];if(_0x36d50b[_0xd4c4('0x2f')]['includeAll']){_0x3cb249['include']=[{'all':!![]}];}_0x3cb249=_['merge']({},_0x3cb249,_0x36d50b[_0xd4c4('0x3c')]);return db[_0xd4c4('0x3d')][_0xd4c4('0x44')](_0x3cb249)[_0xd4c4('0x24')](handleEntityNotFound(_0x464393,null))[_0xd4c4('0x24')](respondWithResult(_0x464393,null))[_0xd4c4('0x40')](handleError(_0x464393,null));};exports[_0xd4c4('0x45')]=function(_0x27d36b,_0x509c57){return db['JscriptyProject'][_0xd4c4('0x45')](_0x27d36b[_0xd4c4('0x46')],{})[_0xd4c4('0x24')](function(_0x4edc4f){var _0x1d38b9=_0x27d36b[_0xd4c4('0x47')][_0xd4c4('0x48')]({'plain':!![]});if(!_0x1d38b9)throw new Error(_0xd4c4('0x49'));if(_0x1d38b9[_0xd4c4('0x4a')]==='user'){var _0x3d98c0=_0x4edc4f[_0xd4c4('0x48')]({'plain':!![]});var _0x4b43be='Projects';return db[_0xd4c4('0x4b')]['find']({'where':{'name':_0x4b43be,'userProfileId':_0x1d38b9[_0xd4c4('0x4c')]},'raw':!![]})['then'](function(_0x3439f3){if(_0x3439f3&&_0x3439f3[_0xd4c4('0x4d')]===0x0){return db['UserProfileResource'][_0xd4c4('0x45')]({'name':_0x3d98c0[_0xd4c4('0x26')],'resourceId':_0x3d98c0['id'],'type':_0x3439f3[_0xd4c4('0x26')],'sectionId':_0x3439f3['id']},{})[_0xd4c4('0x24')](function(){return _0x4edc4f;});}else{return _0x4edc4f;}})[_0xd4c4('0x40')](function(_0x85c9a7){logger['error'](_0xd4c4('0x4e'),_0x85c9a7);throw _0x85c9a7;});}return _0x4edc4f;})['then'](respondWithResult(_0x509c57,0xc9))[_0xd4c4('0x40')](handleError(_0x509c57,null));};exports[_0xd4c4('0x4f')]=function(_0x1ec55d,_0x44c91b){var _0x11b35a={'where':{'id':_0x1ec55d[_0xd4c4('0x41')]['id']}},_0x4da5e7={};_0x4da5e7['model']=_[_0xd4c4('0x30')](db[_0xd4c4('0x3d')]['rawAttributes']);_0x11b35a['attributes']=_[_0xd4c4('0x32')](_0x4da5e7[_0xd4c4('0x2e')],qs[_0xd4c4('0x43')](_0x1ec55d[_0xd4c4('0x2f')][_0xd4c4('0x43')]));_0x11b35a[_0xd4c4('0x31')]=_0x11b35a[_0xd4c4('0x31')][_0xd4c4('0x33')]?_0x11b35a[_0xd4c4('0x31')]:_0x4da5e7[_0xd4c4('0x2e')];if(_0x1ec55d[_0xd4c4('0x2f')][_0xd4c4('0x50')]){_0x11b35a[_0xd4c4('0x51')]=[{'all':!![]}];}_0x11b35a=_[_0xd4c4('0x3b')]({},_0x11b35a,_0x1ec55d[_0xd4c4('0x3c')]);return db[_0xd4c4('0x3d')][_0xd4c4('0x44')](_0x11b35a)[_0xd4c4('0x24')](handleEntityNotFound(_0x44c91b,null))['then'](function(_0x3a3fdf){if(_0x3a3fdf){var _0x31a042=_0x3a3fdf[_0xd4c4('0x48')]({'plain':!![]});_0x31a042=qs[_0xd4c4('0x52')](_0x31a042,['id',_0xd4c4('0x53'),'updatedAt']);_0x1ec55d['body']=_['omit'](_0x1ec55d[_0xd4c4('0x46')],['id',_0xd4c4('0x53'),_0xd4c4('0x54')]);return db['JscriptyProject'][_0xd4c4('0x45')](_[_0xd4c4('0x3b')](_0x31a042,_0x1ec55d[_0xd4c4('0x46')]),{'include':_0x1ec55d[_0xd4c4('0x2f')][_0xd4c4('0x50')]?[{'all':!![]}]:undefined})[_0xd4c4('0x24')](function(_0x30d67f){var _0x35a52e=_0x1ec55d[_0xd4c4('0x47')][_0xd4c4('0x48')]({'plain':!![]});if(!_0x35a52e)throw new Error(_0xd4c4('0x49'));if(_0x35a52e[_0xd4c4('0x4a')]===_0xd4c4('0x47')){var _0x9acc7f=_0x30d67f[_0xd4c4('0x48')]({'plain':!![]});var _0x469464=_0xd4c4('0x22');return db[_0xd4c4('0x4b')]['find']({'where':{'name':_0x469464,'userProfileId':_0x35a52e['userProfileId']},'raw':!![]})['then'](function(_0x3170c3){if(_0x3170c3&&_0x3170c3[_0xd4c4('0x4d')]===0x0){return db[_0xd4c4('0x23')][_0xd4c4('0x45')]({'name':_0x9acc7f[_0xd4c4('0x26')],'resourceId':_0x9acc7f['id'],'type':_0x3170c3[_0xd4c4('0x26')],'sectionId':_0x3170c3['id']},{})[_0xd4c4('0x24')](function(){return _0x30d67f;});}else{return _0x30d67f;}})[_0xd4c4('0x40')](function(_0x1f6eae){logger['error'](_0xd4c4('0x4e'),_0x1f6eae);throw _0x1f6eae;});}return _0x30d67f;});}})[_0xd4c4('0x24')](respondWithResult(_0x44c91b,0xc9))['catch'](handleError(_0x44c91b,null));};exports[_0xd4c4('0x55')]=function(_0x16f668,_0x59ff22){if(_0x16f668[_0xd4c4('0x46')]['id']){delete _0x16f668[_0xd4c4('0x46')]['id'];}return db[_0xd4c4('0x3d')][_0xd4c4('0x44')]({'where':{'id':_0x16f668[_0xd4c4('0x41')]['id']}})[_0xd4c4('0x24')](handleEntityNotFound(_0x59ff22,null))[_0xd4c4('0x24')](saveUpdates(_0x16f668[_0xd4c4('0x46')],null))[_0xd4c4('0x24')](respondWithResult(_0x59ff22,null))[_0xd4c4('0x40')](handleError(_0x59ff22,null));};exports[_0xd4c4('0x21')]=function(_0x3140ab,_0x22db84){return db[_0xd4c4('0x3d')]['find']({'where':{'id':_0x3140ab['params']['id']}})[_0xd4c4('0x24')](handleEntityNotFound(_0x22db84,null))[_0xd4c4('0x24')](removeEntity(_0x22db84,null))[_0xd4c4('0x40')](handleError(_0x22db84,null));};exports[_0xd4c4('0x56')]=function(_0x7c54f4,_0x524765,_0x100aed){var _0x1c6ad3={'raw':!![],'where':{}};var _0x1964ff={};var _0x4b3480={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x7c54f4[_0xd4c4('0x41')]['id']}})['then'](handleEntityNotFound(_0x524765,null))[_0xd4c4('0x24')](function(_0x19b89b){if(_0x19b89b){_0x1964ff[_0xd4c4('0x2e')]=_[_0xd4c4('0x30')](db[_0xd4c4('0x57')][_0xd4c4('0x2b')]);_0x1964ff['query']=_[_0xd4c4('0x30')](_0x7c54f4['query']);_0x1964ff[_0xd4c4('0x42')]=_[_0xd4c4('0x32')](_0x1964ff[_0xd4c4('0x2e')],_0x1964ff[_0xd4c4('0x2f')]);_0x1c6ad3[_0xd4c4('0x31')]=_[_0xd4c4('0x32')](_0x1964ff[_0xd4c4('0x2e')],qs[_0xd4c4('0x43')](_0x7c54f4['query'][_0xd4c4('0x43')]));_0x1c6ad3[_0xd4c4('0x31')]=_0x1c6ad3['attributes']['length']?_0x1c6ad3[_0xd4c4('0x31')]:_0x1964ff['model'];if(!_0x7c54f4[_0xd4c4('0x2f')][_0xd4c4('0x34')](_0xd4c4('0x58'))){_0x1c6ad3[_0xd4c4('0x1b')]=qs[_0xd4c4('0x1b')](_0x7c54f4[_0xd4c4('0x2f')][_0xd4c4('0x1b')]);_0x1c6ad3[_0xd4c4('0x19')]=qs[_0xd4c4('0x19')](_0x7c54f4[_0xd4c4('0x2f')][_0xd4c4('0x19')]);}_0x1c6ad3['order']=qs[_0xd4c4('0x36')](_0x7c54f4[_0xd4c4('0x2f')][_0xd4c4('0x36')]);_0x1c6ad3[_0xd4c4('0x37')]=qs[_0xd4c4('0x42')](_['pick'](_0x7c54f4['query'],_0x1964ff['filters']));_0x1c6ad3['where'][_0xd4c4('0x59')]=_0x19b89b['id'];if(_0x7c54f4[_0xd4c4('0x2f')]['filter']){_0x1c6ad3[_0xd4c4('0x37')]=_['merge'](_0x1c6ad3['where'],{'$or':_[_0xd4c4('0x2a')](_0x1c6ad3['attributes'],function(_0xf536aa){var _0x1ac2f3={};_0x1ac2f3[_0xf536aa]={'$like':'%'+_0x7c54f4['query']['filter']+'%'};return _0x1ac2f3;})});}_0x1c6ad3=_[_0xd4c4('0x3b')]({},_0x1c6ad3,_0x7c54f4[_0xd4c4('0x3c')]);return db[_0xd4c4('0x57')]['count']({'where':_0x1c6ad3[_0xd4c4('0x37')]})['then'](function(_0x2f6b08){_0x4b3480[_0xd4c4('0x1c')]=_0x2f6b08;if(_0x7c54f4['query'][_0xd4c4('0x50')]){_0x1c6ad3[_0xd4c4('0x51')]=[{'all':!![]}];}return db[_0xd4c4('0x57')][_0xd4c4('0x3e')](_0x1c6ad3);})[_0xd4c4('0x24')](function(_0x31cf97){_0x4b3480[_0xd4c4('0x3f')]=_0x31cf97;return _0x4b3480;});}})['then'](respondWithFilteredResult(_0x524765,_0x1c6ad3))[_0xd4c4('0x40')](handleError(_0x524765,null));};exports['getAnswers']=function(_0x3e89d5,_0x193009,_0x475be3){var _0x141626={'raw':!![],'where':{}};var _0x579146={};var _0x2f7030={'count':0x0,'rows':[]};return db[_0xd4c4('0x3d')]['findOne']({'where':{'id':_0x3e89d5[_0xd4c4('0x41')]['id']}})['then'](handleEntityNotFound(_0x193009,null))[_0xd4c4('0x24')](function(_0x2ce820){if(_0x2ce820){_0x579146[_0xd4c4('0x2e')]=_[_0xd4c4('0x30')](db[_0xd4c4('0x5a')][_0xd4c4('0x2b')]);_0x579146[_0xd4c4('0x2f')]=_[_0xd4c4('0x30')](_0x3e89d5['query']);_0x579146[_0xd4c4('0x42')]=_['intersection'](_0x579146[_0xd4c4('0x2e')],_0x579146['query']);_0x141626['attributes']=_['intersection'](_0x579146[_0xd4c4('0x2e')],qs[_0xd4c4('0x43')](_0x3e89d5[_0xd4c4('0x2f')][_0xd4c4('0x43')]));_0x141626['attributes']=_0x141626[_0xd4c4('0x31')][_0xd4c4('0x33')]?_0x141626['attributes']:_0x579146[_0xd4c4('0x2e')];if(!_0x3e89d5[_0xd4c4('0x2f')][_0xd4c4('0x34')]('nolimit')){_0x141626[_0xd4c4('0x1b')]=qs[_0xd4c4('0x1b')](_0x3e89d5[_0xd4c4('0x2f')][_0xd4c4('0x1b')]);_0x141626[_0xd4c4('0x19')]=qs[_0xd4c4('0x19')](_0x3e89d5['query'][_0xd4c4('0x19')]);}_0x141626[_0xd4c4('0x35')]=qs['sort'](_0x3e89d5['query'][_0xd4c4('0x36')]);_0x141626[_0xd4c4('0x37')]=qs['filters'](_[_0xd4c4('0x38')](_0x3e89d5[_0xd4c4('0x2f')],_0x579146[_0xd4c4('0x42')]));_0x141626['where'][_0xd4c4('0x59')]=_0x2ce820['id'];if(_0x3e89d5[_0xd4c4('0x2f')][_0xd4c4('0x5b')]){_0x141626[_0xd4c4('0x37')]=_[_0xd4c4('0x3b')](_0x141626['where'],{'$or':_['map'](_0x141626[_0xd4c4('0x31')],function(_0x506342){var _0xb23e5c={};_0xb23e5c[_0x506342]={'$like':'%'+_0x3e89d5['query']['filter']+'%'};return _0xb23e5c;})});}_0x141626=_[_0xd4c4('0x3b')]({},_0x141626,_0x3e89d5[_0xd4c4('0x3c')]);return db['JscriptyAnswerReport'][_0xd4c4('0x1c')]({'where':_0x141626[_0xd4c4('0x37')]})[_0xd4c4('0x24')](function(_0x51df71){_0x2f7030[_0xd4c4('0x1c')]=_0x51df71;if(_0x3e89d5[_0xd4c4('0x2f')][_0xd4c4('0x50')]){_0x141626[_0xd4c4('0x51')]=[{'all':!![]}];}return db[_0xd4c4('0x5a')][_0xd4c4('0x3e')](_0x141626);})[_0xd4c4('0x24')](function(_0x120a72){_0x2f7030[_0xd4c4('0x3f')]=_0x120a72;return _0x2f7030;});}})[_0xd4c4('0x24')](respondWithFilteredResult(_0x193009,_0x141626))[_0xd4c4('0x40')](handleError(_0x193009,null));};function char(_0x4eb4d0){return'number'===typeof _0x4eb4d0?String['fromCharCode'][_0xd4c4('0x5c')](null,arguments):_0x4eb4d0;}function needsEncapsulation(_0x1e80ae){return!!_0x1e80ae&&(_0x1e80ae['toString']()['indexOf'](char(0xd))>=0x0||_0x1e80ae[_0xd4c4('0x5d')]()['indexOf'](char(0xa))>=0x0||_0x1e80ae[_0xd4c4('0x5d')]()['indexOf'](char(0x2c))>=0x0||_0x1e80ae[_0xd4c4('0x5d')]()[_0xd4c4('0x5e')](char(0x22))>=0x0);}function encapsulate(_0x2a828e){var _0x46d514=char(0x22),_0x32492b='\x5c'+char(0x22),_0x3324e5=_0x2a828e['toString']()[_0xd4c4('0x5f')](new RegExp(_0x46d514,'g'),_0x32492b);return _0x46d514+_0x3324e5+_0x46d514;}exports[_0xd4c4('0x60')]=function(_0x4cbfcc,_0x598e28,_0x5afd77){var _0x44681e,_0x1fc889;var _0x2f88f3={'where':{'ProjectId':_0x4cbfcc['params']['id']}};if(_0x4cbfcc[_0xd4c4('0x2f')]['startTime']){_0x2f88f3[_0xd4c4('0x37')][_0xd4c4('0x61')]=JSON[_0xd4c4('0x62')](_0x4cbfcc[_0xd4c4('0x2f')][_0xd4c4('0x63')]);}return db[_0xd4c4('0x57')][_0xd4c4('0x3e')](_0x2f88f3)['then'](handleEntityNotFound(_0x598e28,null))[_0xd4c4('0x24')](function(_0x159276){if(_0x159276){_0x44681e=_0x159276;return db['JscriptyQuestionReport'][_0xd4c4('0x3e')]({'where':{'SessionId':{'$in':_[_0xd4c4('0x2a')](_0x44681e,'id')},'ProjectId':_0x4cbfcc[_0xd4c4('0x41')]['id']},'order':'-createdAt'});}})[_0xd4c4('0x24')](handleEntityNotFound(_0x598e28,null))[_0xd4c4('0x24')](function(_0x2f4d50){if(_0x2f4d50){_0x1fc889=_0x2f4d50;var _0x520bf5={};for(var _0x154301=0x0,_0x6242ee=_0x1fc889[_0xd4c4('0x33')];_0x154301<_0x6242ee;_0x154301++){if(!_0x520bf5[_0xd4c4('0x34')](_0x1fc889[_0x154301][_0xd4c4('0x64')])){_0x520bf5[_0x1fc889[_0x154301][_0xd4c4('0x64')]]=needsEncapsulation(_0x1fc889[_0x154301]['question'])?encapsulate(_0x1fc889[_0x154301]['question']):_0x1fc889[_0x154301][_0xd4c4('0x65')];}}var _0x5e92af=[],_0xba5ea5={};for(var _0x52b988=0x0,_0x3883d5=_0x44681e[_0xd4c4('0x33')];_0x52b988<_0x3883d5;_0x52b988++){_0xba5ea5={'ProjectId':_0x4cbfcc['params']['id'],'SessionId':_0x44681e[_0x52b988]['id'],'StartTime':moment(_0x44681e[_0x52b988][_0xd4c4('0x61')])['format'](_0xd4c4('0x66'))};for(var _0x18e08b=0x0,_0x474e08=_0x1fc889['length'];_0x18e08b<_0x474e08;_0x18e08b++){if(_0x1fc889[_0x18e08b][_0xd4c4('0x67')]==_0x44681e[_0x52b988]['id']&&_0x520bf5[_0xd4c4('0x34')](_0x1fc889[_0x18e08b][_0xd4c4('0x64')])){_0xba5ea5[_0x520bf5[_0x1fc889[_0x18e08b][_0xd4c4('0x64')]]]=_0x1fc889[_0x18e08b][_0xd4c4('0x68')];}}for(var _0x314768 in _0x520bf5){if(!_0xba5ea5[_0xd4c4('0x34')](_0x520bf5[_0x314768])){_0xba5ea5[_0x520bf5[_0x314768]]=null;}}_0x5e92af[_0xd4c4('0x69')](_0xba5ea5);}return _0x5e92af;}})['then'](function(_0x296474){if(!_[_0xd4c4('0x6a')](_0x296474)){var _0x63e39e=toCsv(_0x296474);var _0x1c21d4=Date[_0xd4c4('0x6b')]();fs[_0xd4c4('0x6c')](util[_0xd4c4('0x6d')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x4cbfcc[_0xd4c4('0x41')]['id'],_0x1c21d4),_0x63e39e);_0x598e28[_0xd4c4('0x6e')](_0xd4c4('0x6f'),'attachment;\x20filename='+util[_0xd4c4('0x6d')]('Jscripty_Project_%d_Summary_%s.csv',_0x4cbfcc[_0xd4c4('0x41')]['id'],_0x1c21d4));_0x598e28[_0xd4c4('0x6e')](_0xd4c4('0x70'),_0xd4c4('0x71'));return _0x598e28[_0xd4c4('0x72')](util['format'](_0xd4c4('0x73'),_0x4cbfcc[_0xd4c4('0x41')]['id'],_0x1c21d4));}else{return _0x598e28[_0xd4c4('0x74')](0xcc);}})[_0xd4c4('0x40')](handleError(_0x598e28,null));}; \ No newline at end of file +var _0x3339=['nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','clone','omit','createdAt','updatedAt','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','findOne','JscriptySessionReport','hasOwnProperty','order','ProjectId','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','offset','set','json','apply','reject','save','update','then','get','Projects','UserProfileResource','stack','name','index','JscriptyProject','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x6c200b,_0x1dd691){var _0x2158ef=function(_0x5e0544){while(--_0x5e0544){_0x6c200b['push'](_0x6c200b['shift']());}};_0x2158ef(++_0x1dd691);}(_0x3339,0x1a7));var _0x9333=function(_0x434c82,_0xf7bd70){_0x434c82=_0x434c82-0x0;var _0x483389=_0x3339[_0x434c82];return _0x483389;};'use strict';var emlformat=require(_0x9333('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9333('0x1'));var jsonpatch=require(_0x9333('0x2'));var rp=require(_0x9333('0x3'));var moment=require(_0x9333('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9333('0x5'));var util=require('util');var path=require(_0x9333('0x6'));var sox=require(_0x9333('0x7'));var csv=require(_0x9333('0x8'));var ejs=require(_0x9333('0x9'));var fs=require('fs');var fs_extra=require(_0x9333('0xa'));var _=require(_0x9333('0xb'));var squel=require(_0x9333('0xc'));var crypto=require(_0x9333('0xd'));var jsforce=require(_0x9333('0xe'));var deskjs=require(_0x9333('0xf'));var toCsv=require(_0x9333('0x8'));var querystring=require(_0x9333('0x10'));var Papa=require('papaparse');var Redis=require(_0x9333('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9333('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9333('0x13'));var logger=require(_0x9333('0x14'))(_0x9333('0x15'));var utils=require(_0x9333('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9333('0x17'));var db=require(_0x9333('0x18'))['db'];function respondWithStatusCode(_0x54563a,_0x2f3918){_0x2f3918=_0x2f3918||0xcc;return function(_0x5247d3){if(_0x5247d3){return _0x54563a[_0x9333('0x19')](_0x2f3918);}return _0x54563a[_0x9333('0x1a')](_0x2f3918)[_0x9333('0x1b')]();};}function respondWithResult(_0x5a023c,_0x1eecff){_0x1eecff=_0x1eecff||0xc8;return function(_0x3b9075){if(_0x3b9075){return _0x5a023c[_0x9333('0x1a')](_0x1eecff)['json'](_0x3b9075);}};}function respondWithFilteredResult(_0x1b996b,_0x127a5a){return function(_0x2940bd){if(_0x2940bd){var _0x4c3cd9=typeof _0x127a5a['offset']==='undefined'&&typeof _0x127a5a[_0x9333('0x1c')]===_0x9333('0x1d');var _0x4d0e7c=_0x2940bd['count'];var _0x3060d6=_0x4c3cd9?0x0:_0x127a5a['offset'];var _0x2102aa=_0x4c3cd9?_0x2940bd['count']:_0x127a5a[_0x9333('0x1e')]+_0x127a5a[_0x9333('0x1c')];var _0x309872;if(_0x2102aa>=_0x4d0e7c){_0x2102aa=_0x4d0e7c;_0x309872=0xc8;}else{_0x309872=0xce;}_0x1b996b[_0x9333('0x1a')](_0x309872);return _0x1b996b[_0x9333('0x1f')]('Content-Range',_0x3060d6+'-'+_0x2102aa+'/'+_0x4d0e7c)[_0x9333('0x20')](_0x2940bd);}return null;};}function patchUpdates(_0xbea6c3){return function(_0x2afa69){try{jsonpatch[_0x9333('0x21')](_0x2afa69,_0xbea6c3,!![]);}catch(_0x3c6169){return BPromise[_0x9333('0x22')](_0x3c6169);}return _0x2afa69[_0x9333('0x23')]();};}function saveUpdates(_0x56cc3e,_0x2791ac){return function(_0x2e5f58){if(_0x2e5f58){return _0x2e5f58[_0x9333('0x24')](_0x56cc3e)[_0x9333('0x25')](function(_0x1987c4){return _0x1987c4;});}return null;};}function removeEntity(_0x18c528,_0x6e32eb){return function(_0x4155a0){if(_0x4155a0){return _0x4155a0['destroy']()['then'](function(){var _0xe58fd6=_0x4155a0[_0x9333('0x26')]({'plain':!![]});var _0x2bd79a=_0x9333('0x27');return db[_0x9333('0x28')]['destroy']({'where':{'type':_0x2bd79a,'resourceId':_0xe58fd6['id']}})[_0x9333('0x25')](function(){return _0x4155a0;});})[_0x9333('0x25')](function(){_0x18c528[_0x9333('0x1a')](0xcc)[_0x9333('0x1b')]();});}};}function handleEntityNotFound(_0x1a4fda,_0x51ffff){return function(_0x271072){if(!_0x271072){_0x1a4fda[_0x9333('0x19')](0x194);}return _0x271072;};}function handleError(_0x3deea9,_0x91ec5c){_0x91ec5c=_0x91ec5c||0x1f4;return function(_0x58c535){logger['error'](_0x58c535[_0x9333('0x29')]);if(_0x58c535[_0x9333('0x2a')]){delete _0x58c535[_0x9333('0x2a')];}_0x3deea9[_0x9333('0x1a')](_0x91ec5c)['send'](_0x58c535);};}exports[_0x9333('0x2b')]=function(_0x5e4bd0,_0x5d406b){var _0x349f4f={},_0x4f0bb7={},_0x22ab4f={'count':0x0,'rows':[]};var _0x263099=_['map'](db[_0x9333('0x2c')][_0x9333('0x2d')],function(_0x197bf9){return{'name':_0x197bf9[_0x9333('0x2e')],'type':_0x197bf9[_0x9333('0x2f')][_0x9333('0x30')]};});_0x4f0bb7[_0x9333('0x31')]=_['map'](_0x263099,_0x9333('0x2a'));_0x4f0bb7[_0x9333('0x32')]=_[_0x9333('0x33')](_0x5e4bd0[_0x9333('0x32')]);_0x4f0bb7[_0x9333('0x34')]=_[_0x9333('0x35')](_0x4f0bb7['model'],_0x4f0bb7[_0x9333('0x32')]);_0x349f4f[_0x9333('0x36')]=_['intersection'](_0x4f0bb7[_0x9333('0x31')],qs[_0x9333('0x37')](_0x5e4bd0[_0x9333('0x32')][_0x9333('0x37')]));_0x349f4f[_0x9333('0x36')]=_0x349f4f[_0x9333('0x36')][_0x9333('0x38')]?_0x349f4f[_0x9333('0x36')]:_0x4f0bb7[_0x9333('0x31')];if(!_0x5e4bd0[_0x9333('0x32')]['hasOwnProperty'](_0x9333('0x39'))){_0x349f4f[_0x9333('0x1c')]=qs[_0x9333('0x1c')](_0x5e4bd0[_0x9333('0x32')]['limit']);_0x349f4f[_0x9333('0x1e')]=qs['offset'](_0x5e4bd0[_0x9333('0x32')]['offset']);}_0x349f4f['order']=qs[_0x9333('0x3a')](_0x5e4bd0[_0x9333('0x32')]['sort']);_0x349f4f[_0x9333('0x3b')]=qs[_0x9333('0x34')](_[_0x9333('0x3c')](_0x5e4bd0[_0x9333('0x32')],_0x4f0bb7[_0x9333('0x34')]),_0x263099);if(_0x5e4bd0[_0x9333('0x32')][_0x9333('0x3d')]){_0x349f4f['where']=_[_0x9333('0x3e')](_0x349f4f[_0x9333('0x3b')],{'$or':_[_0x9333('0x3f')](_0x263099,function(_0x5ad0d8){if(_0x5ad0d8['type']!==_0x9333('0x40')){var _0xc96f6c={};_0xc96f6c[_0x5ad0d8[_0x9333('0x2a')]]={'$like':'%'+_0x5e4bd0[_0x9333('0x32')]['filter']+'%'};return _0xc96f6c;}})});}_0x349f4f=_[_0x9333('0x3e')]({},_0x349f4f,_0x5e4bd0[_0x9333('0x41')]);var _0x7be911={'where':_0x349f4f[_0x9333('0x3b')]};return db['JscriptyProject'][_0x9333('0x42')](_0x7be911)[_0x9333('0x25')](function(_0x2be4ba){_0x22ab4f[_0x9333('0x42')]=_0x2be4ba;if(_0x5e4bd0[_0x9333('0x32')][_0x9333('0x43')]){_0x349f4f[_0x9333('0x44')]=[{'all':!![]}];}return db['JscriptyProject'][_0x9333('0x45')](_0x349f4f);})['then'](function(_0x56d168){_0x22ab4f[_0x9333('0x46')]=_0x56d168;return _0x22ab4f;})['then'](respondWithFilteredResult(_0x5d406b,_0x349f4f))[_0x9333('0x47')](handleError(_0x5d406b,null));};exports[_0x9333('0x48')]=function(_0x3c7e14,_0x192cad){var _0x1b643={'raw':![],'where':{'id':_0x3c7e14[_0x9333('0x49')]['id']}},_0x368b21={};_0x368b21['model']=_[_0x9333('0x33')](db[_0x9333('0x2c')][_0x9333('0x2d')]);_0x368b21[_0x9333('0x32')]=_[_0x9333('0x33')](_0x3c7e14[_0x9333('0x32')]);_0x368b21[_0x9333('0x34')]=_['intersection'](_0x368b21[_0x9333('0x31')],_0x368b21[_0x9333('0x32')]);_0x1b643[_0x9333('0x36')]=_[_0x9333('0x35')](_0x368b21[_0x9333('0x31')],qs['fields'](_0x3c7e14[_0x9333('0x32')]['fields']));_0x1b643[_0x9333('0x36')]=_0x1b643[_0x9333('0x36')][_0x9333('0x38')]?_0x1b643[_0x9333('0x36')]:_0x368b21[_0x9333('0x31')];if(_0x3c7e14[_0x9333('0x32')][_0x9333('0x43')]){_0x1b643[_0x9333('0x44')]=[{'all':!![]}];}_0x1b643=_[_0x9333('0x3e')]({},_0x1b643,_0x3c7e14[_0x9333('0x41')]);return db[_0x9333('0x2c')][_0x9333('0x4a')](_0x1b643)['then'](handleEntityNotFound(_0x192cad,null))[_0x9333('0x25')](respondWithResult(_0x192cad,null))[_0x9333('0x47')](handleError(_0x192cad,null));};exports['create']=function(_0x1a9dc9,_0xc7140e){return db[_0x9333('0x2c')][_0x9333('0x4b')](_0x1a9dc9[_0x9333('0x4c')],{})[_0x9333('0x25')](function(_0x53a9cf){var _0x3cccb6=_0x1a9dc9[_0x9333('0x4d')][_0x9333('0x26')]({'plain':!![]});if(!_0x3cccb6)throw new Error(_0x9333('0x4e'));if(_0x3cccb6[_0x9333('0x4f')]===_0x9333('0x4d')){var _0x28080c=_0x53a9cf[_0x9333('0x26')]({'plain':!![]});var _0x56a170='Projects';return db[_0x9333('0x50')]['find']({'where':{'name':_0x56a170,'userProfileId':_0x3cccb6['userProfileId']},'raw':!![]})[_0x9333('0x25')](function(_0x4f42c2){if(_0x4f42c2&&_0x4f42c2[_0x9333('0x51')]===0x0){return db[_0x9333('0x28')][_0x9333('0x4b')]({'name':_0x28080c[_0x9333('0x2a')],'resourceId':_0x28080c['id'],'type':_0x4f42c2['name'],'sectionId':_0x4f42c2['id']},{})[_0x9333('0x25')](function(){return _0x53a9cf;});}else{return _0x53a9cf;}})[_0x9333('0x47')](function(_0x23ea1d){logger[_0x9333('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23ea1d);throw _0x23ea1d;});}return _0x53a9cf;})['then'](respondWithResult(_0xc7140e,0xc9))[_0x9333('0x47')](handleError(_0xc7140e,null));};exports[_0x9333('0x53')]=function(_0x59fea7,_0x526195){var _0x4035b2={'where':{'id':_0x59fea7['params']['id']}},_0x587ebe={};_0x587ebe['model']=_[_0x9333('0x33')](db['JscriptyProject'][_0x9333('0x2d')]);_0x4035b2[_0x9333('0x36')]=_[_0x9333('0x35')](_0x587ebe['model'],qs[_0x9333('0x37')](_0x59fea7['query'][_0x9333('0x37')]));_0x4035b2['attributes']=_0x4035b2[_0x9333('0x36')][_0x9333('0x38')]?_0x4035b2[_0x9333('0x36')]:_0x587ebe[_0x9333('0x31')];if(_0x59fea7[_0x9333('0x32')][_0x9333('0x43')]){_0x4035b2[_0x9333('0x44')]=[{'all':!![]}];}_0x4035b2=_[_0x9333('0x3e')]({},_0x4035b2,_0x59fea7['options']);return db['JscriptyProject']['find'](_0x4035b2)['then'](handleEntityNotFound(_0x526195,null))[_0x9333('0x25')](function(_0x1cbf1a){if(_0x1cbf1a){var _0x8adebc=_0x1cbf1a[_0x9333('0x26')]({'plain':!![]});_0x8adebc=qs[_0x9333('0x54')](_0x8adebc,['id',_0x9333('0x55'),_0x9333('0x56')]);_0x59fea7['body']=_[_0x9333('0x54')](_0x59fea7[_0x9333('0x4c')],['id',_0x9333('0x55'),_0x9333('0x56')]);return db[_0x9333('0x2c')]['create'](_[_0x9333('0x3e')](_0x8adebc,_0x59fea7[_0x9333('0x4c')]),{'include':_0x59fea7[_0x9333('0x32')][_0x9333('0x43')]?[{'all':!![]}]:undefined})['then'](function(_0xf4abf4){var _0x3894c0=_0x59fea7[_0x9333('0x4d')][_0x9333('0x26')]({'plain':!![]});if(!_0x3894c0)throw new Error(_0x9333('0x4e'));if(_0x3894c0['role']===_0x9333('0x4d')){var _0x47699b=_0xf4abf4['get']({'plain':!![]});var _0x1fef83=_0x9333('0x27');return db['UserProfileSection'][_0x9333('0x4a')]({'where':{'name':_0x1fef83,'userProfileId':_0x3894c0[_0x9333('0x57')]},'raw':!![]})['then'](function(_0x464bd1){if(_0x464bd1&&_0x464bd1[_0x9333('0x51')]===0x0){return db[_0x9333('0x28')]['create']({'name':_0x47699b[_0x9333('0x2a')],'resourceId':_0x47699b['id'],'type':_0x464bd1[_0x9333('0x2a')],'sectionId':_0x464bd1['id']},{})[_0x9333('0x25')](function(){return _0xf4abf4;});}else{return _0xf4abf4;}})[_0x9333('0x47')](function(_0x50f57c){logger['error'](_0x9333('0x58'),_0x50f57c);throw _0x50f57c;});}return _0xf4abf4;});}})['then'](respondWithResult(_0x526195,0xc9))[_0x9333('0x47')](handleError(_0x526195,null));};exports[_0x9333('0x24')]=function(_0x1e7e0b,_0x218dd3){if(_0x1e7e0b[_0x9333('0x4c')]['id']){delete _0x1e7e0b[_0x9333('0x4c')]['id'];}return db[_0x9333('0x2c')]['find']({'where':{'id':_0x1e7e0b[_0x9333('0x49')]['id']}})[_0x9333('0x25')](handleEntityNotFound(_0x218dd3,null))[_0x9333('0x25')](saveUpdates(_0x1e7e0b['body'],null))[_0x9333('0x25')](respondWithResult(_0x218dd3,null))[_0x9333('0x47')](handleError(_0x218dd3,null));};exports[_0x9333('0x59')]=function(_0x2e0a24,_0x2b61b2){return db[_0x9333('0x2c')][_0x9333('0x4a')]({'where':{'id':_0x2e0a24[_0x9333('0x49')]['id']}})[_0x9333('0x25')](handleEntityNotFound(_0x2b61b2,null))[_0x9333('0x25')](removeEntity(_0x2b61b2,null))['catch'](handleError(_0x2b61b2,null));};exports['getSessions']=function(_0x4e2b11,_0x5428b7,_0x10a853){var _0x210711={'raw':!![],'where':{}};var _0x38a5d0={};var _0x16db07={'count':0x0,'rows':[]};return db[_0x9333('0x2c')][_0x9333('0x5a')]({'where':{'id':_0x4e2b11[_0x9333('0x49')]['id']}})[_0x9333('0x25')](handleEntityNotFound(_0x5428b7,null))['then'](function(_0x292dff){if(_0x292dff){_0x38a5d0[_0x9333('0x31')]=_[_0x9333('0x33')](db[_0x9333('0x5b')][_0x9333('0x2d')]);_0x38a5d0[_0x9333('0x32')]=_[_0x9333('0x33')](_0x4e2b11['query']);_0x38a5d0[_0x9333('0x34')]=_[_0x9333('0x35')](_0x38a5d0[_0x9333('0x31')],_0x38a5d0[_0x9333('0x32')]);_0x210711['attributes']=_[_0x9333('0x35')](_0x38a5d0['model'],qs[_0x9333('0x37')](_0x4e2b11[_0x9333('0x32')][_0x9333('0x37')]));_0x210711[_0x9333('0x36')]=_0x210711[_0x9333('0x36')][_0x9333('0x38')]?_0x210711[_0x9333('0x36')]:_0x38a5d0['model'];if(!_0x4e2b11[_0x9333('0x32')][_0x9333('0x5c')](_0x9333('0x39'))){_0x210711['limit']=qs['limit'](_0x4e2b11['query'][_0x9333('0x1c')]);_0x210711[_0x9333('0x1e')]=qs['offset'](_0x4e2b11[_0x9333('0x32')][_0x9333('0x1e')]);}_0x210711[_0x9333('0x5d')]=qs['sort'](_0x4e2b11['query'][_0x9333('0x3a')]);_0x210711[_0x9333('0x3b')]=qs['filters'](_[_0x9333('0x3c')](_0x4e2b11['query'],_0x38a5d0[_0x9333('0x34')]));_0x210711['where'][_0x9333('0x5e')]=_0x292dff['id'];if(_0x4e2b11[_0x9333('0x32')][_0x9333('0x3d')]){_0x210711[_0x9333('0x3b')]=_['merge'](_0x210711[_0x9333('0x3b')],{'$or':_[_0x9333('0x3f')](_0x210711[_0x9333('0x36')],function(_0x3da4c4){var _0x3f0246={};_0x3f0246[_0x3da4c4]={'$like':'%'+_0x4e2b11[_0x9333('0x32')][_0x9333('0x3d')]+'%'};return _0x3f0246;})});}_0x210711=_[_0x9333('0x3e')]({},_0x210711,_0x4e2b11[_0x9333('0x41')]);return db[_0x9333('0x5b')][_0x9333('0x42')]({'where':_0x210711[_0x9333('0x3b')]})[_0x9333('0x25')](function(_0x30f3e6){_0x16db07[_0x9333('0x42')]=_0x30f3e6;if(_0x4e2b11[_0x9333('0x32')][_0x9333('0x43')]){_0x210711['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x9333('0x45')](_0x210711);})[_0x9333('0x25')](function(_0x54d40d){_0x16db07['rows']=_0x54d40d;return _0x16db07;});}})[_0x9333('0x25')](respondWithFilteredResult(_0x5428b7,_0x210711))[_0x9333('0x47')](handleError(_0x5428b7,null));};exports[_0x9333('0x5f')]=function(_0x106580,_0x167166,_0x4884ce){var _0x3f906e={'raw':!![],'where':{}};var _0x533652={};var _0x5d7863={'count':0x0,'rows':[]};return db[_0x9333('0x2c')][_0x9333('0x5a')]({'where':{'id':_0x106580[_0x9333('0x49')]['id']}})[_0x9333('0x25')](handleEntityNotFound(_0x167166,null))[_0x9333('0x25')](function(_0x2adc52){if(_0x2adc52){_0x533652[_0x9333('0x31')]=_[_0x9333('0x33')](db['JscriptyAnswerReport'][_0x9333('0x2d')]);_0x533652[_0x9333('0x32')]=_[_0x9333('0x33')](_0x106580['query']);_0x533652[_0x9333('0x34')]=_['intersection'](_0x533652[_0x9333('0x31')],_0x533652['query']);_0x3f906e[_0x9333('0x36')]=_[_0x9333('0x35')](_0x533652[_0x9333('0x31')],qs['fields'](_0x106580[_0x9333('0x32')]['fields']));_0x3f906e[_0x9333('0x36')]=_0x3f906e[_0x9333('0x36')][_0x9333('0x38')]?_0x3f906e[_0x9333('0x36')]:_0x533652[_0x9333('0x31')];if(!_0x106580[_0x9333('0x32')]['hasOwnProperty']('nolimit')){_0x3f906e[_0x9333('0x1c')]=qs[_0x9333('0x1c')](_0x106580['query'][_0x9333('0x1c')]);_0x3f906e['offset']=qs[_0x9333('0x1e')](_0x106580[_0x9333('0x32')][_0x9333('0x1e')]);}_0x3f906e['order']=qs['sort'](_0x106580[_0x9333('0x32')][_0x9333('0x3a')]);_0x3f906e[_0x9333('0x3b')]=qs[_0x9333('0x34')](_[_0x9333('0x3c')](_0x106580['query'],_0x533652['filters']));_0x3f906e[_0x9333('0x3b')][_0x9333('0x5e')]=_0x2adc52['id'];if(_0x106580[_0x9333('0x32')]['filter']){_0x3f906e[_0x9333('0x3b')]=_[_0x9333('0x3e')](_0x3f906e[_0x9333('0x3b')],{'$or':_[_0x9333('0x3f')](_0x3f906e[_0x9333('0x36')],function(_0x100eb2){var _0x358a8d={};_0x358a8d[_0x100eb2]={'$like':'%'+_0x106580[_0x9333('0x32')]['filter']+'%'};return _0x358a8d;})});}_0x3f906e=_[_0x9333('0x3e')]({},_0x3f906e,_0x106580[_0x9333('0x41')]);return db[_0x9333('0x60')][_0x9333('0x42')]({'where':_0x3f906e[_0x9333('0x3b')]})[_0x9333('0x25')](function(_0x14e14e){_0x5d7863[_0x9333('0x42')]=_0x14e14e;if(_0x106580[_0x9333('0x32')][_0x9333('0x43')]){_0x3f906e['include']=[{'all':!![]}];}return db[_0x9333('0x60')][_0x9333('0x45')](_0x3f906e);})[_0x9333('0x25')](function(_0x14fbf1){_0x5d7863['rows']=_0x14fbf1;return _0x5d7863;});}})[_0x9333('0x25')](respondWithFilteredResult(_0x167166,_0x3f906e))[_0x9333('0x47')](handleError(_0x167166,null));};function char(_0x2b0c3c){return _0x9333('0x61')===typeof _0x2b0c3c?String[_0x9333('0x62')][_0x9333('0x21')](null,arguments):_0x2b0c3c;}function needsEncapsulation(_0x335941){return!!_0x335941&&(_0x335941[_0x9333('0x63')]()[_0x9333('0x64')](char(0xd))>=0x0||_0x335941['toString']()[_0x9333('0x64')](char(0xa))>=0x0||_0x335941['toString']()[_0x9333('0x64')](char(0x2c))>=0x0||_0x335941[_0x9333('0x63')]()[_0x9333('0x64')](char(0x22))>=0x0);}function encapsulate(_0x1ce625){var _0x570e09=char(0x22),_0x5a356d='\x5c'+char(0x22),_0x553801=_0x1ce625['toString']()[_0x9333('0x65')](new RegExp(_0x570e09,'g'),_0x5a356d);return _0x570e09+_0x553801+_0x570e09;}exports['getSummary']=function(_0x487dbf,_0x13fca8,_0x5250a8){var _0x595a02,_0x3356cf;var _0x3df54a={'where':{'ProjectId':_0x487dbf['params']['id']}};if(_0x487dbf['query'][_0x9333('0x66')]){_0x3df54a[_0x9333('0x3b')][_0x9333('0x67')]=JSON[_0x9333('0x68')](_0x487dbf[_0x9333('0x32')][_0x9333('0x66')]);}return db[_0x9333('0x5b')][_0x9333('0x45')](_0x3df54a)[_0x9333('0x25')](handleEntityNotFound(_0x13fca8,null))[_0x9333('0x25')](function(_0x4bcc0f){if(_0x4bcc0f){_0x595a02=_0x4bcc0f;return db[_0x9333('0x69')]['findAll']({'where':{'SessionId':{'$in':_[_0x9333('0x3f')](_0x595a02,'id')},'ProjectId':_0x487dbf[_0x9333('0x49')]['id']},'order':_0x9333('0x6a')});}})[_0x9333('0x25')](handleEntityNotFound(_0x13fca8,null))[_0x9333('0x25')](function(_0x12122c){if(_0x12122c){_0x3356cf=_0x12122c;var _0x5b0608={};for(var _0x31bba6=0x0,_0x535864=_0x3356cf['length'];_0x31bba6<_0x535864;_0x31bba6++){if(!_0x5b0608[_0x9333('0x5c')](_0x3356cf[_0x31bba6][_0x9333('0x6b')])){_0x5b0608[_0x3356cf[_0x31bba6][_0x9333('0x6b')]]=needsEncapsulation(_0x3356cf[_0x31bba6][_0x9333('0x6c')])?encapsulate(_0x3356cf[_0x31bba6]['question']):_0x3356cf[_0x31bba6][_0x9333('0x6c')];}}var _0x38fa58=[],_0x10434e={};for(var _0x226c2c=0x0,_0x5c32fb=_0x595a02['length'];_0x226c2c<_0x5c32fb;_0x226c2c++){_0x10434e={'ProjectId':_0x487dbf['params']['id'],'SessionId':_0x595a02[_0x226c2c]['id'],'StartTime':moment(_0x595a02[_0x226c2c][_0x9333('0x67')])[_0x9333('0x6d')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x3601bc=0x0,_0x3820b2=_0x3356cf['length'];_0x3601bc<_0x3820b2;_0x3601bc++){if(_0x3356cf[_0x3601bc]['SessionId']==_0x595a02[_0x226c2c]['id']&&_0x5b0608[_0x9333('0x5c')](_0x3356cf[_0x3601bc]['questionId'])){_0x10434e[_0x5b0608[_0x3356cf[_0x3601bc][_0x9333('0x6b')]]]=_0x3356cf[_0x3601bc]['answer'];}}for(var _0x56eec6 in _0x5b0608){if(!_0x10434e[_0x9333('0x5c')](_0x5b0608[_0x56eec6])){_0x10434e[_0x5b0608[_0x56eec6]]=null;}}_0x38fa58['push'](_0x10434e);}return _0x38fa58;}})['then'](function(_0x199e7f){if(!_[_0x9333('0x6e')](_0x199e7f)){var _0x2f9425=toCsv(_0x199e7f);var _0x22b593=Date['now']();fs[_0x9333('0x6f')](util[_0x9333('0x6d')](_0x9333('0x70'),_0x487dbf[_0x9333('0x49')]['id'],_0x22b593),_0x2f9425);_0x13fca8[_0x9333('0x71')](_0x9333('0x72'),_0x9333('0x73')+util[_0x9333('0x6d')](_0x9333('0x74'),_0x487dbf[_0x9333('0x49')]['id'],_0x22b593));_0x13fca8['setHeader'](_0x9333('0x75'),_0x9333('0x76'));return _0x13fca8[_0x9333('0x77')](util[_0x9333('0x6d')](_0x9333('0x70'),_0x487dbf['params']['id'],_0x22b593));}else{return _0x13fca8[_0x9333('0x19')](0xcc);}})[_0x9333('0x47')](handleError(_0x13fca8,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index de9f30c..86034f9 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 _0xf041=['path','../../config/environment','define','JscriptyProject','jscripty_projects','../../config/logger','api','moment','bluebird'];(function(_0x412bce,_0x49b658){var _0x2b933e=function(_0xec41f9){while(--_0xec41f9){_0x412bce['push'](_0x412bce['shift']());}};_0x2b933e(++_0x49b658);}(_0xf041,0x15b));var _0x1f04=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf041[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1f04('0x0'))(_0x1f04('0x1'));var moment=require(_0x1f04('0x2'));var BPromise=require(_0x1f04('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1f04('0x4'));var rimraf=require('rimraf');var config=require(_0x1f04('0x5'));var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0x25d578,_0x504d71){return _0x25d578[_0x1f04('0x6')](_0x1f04('0x7'),attributes,{'tableName':_0x1f04('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x92bc=['../../config/logger','bluebird','request-promise','path','rimraf','./jscriptyProject.attributes','exports','JscriptyProject','jscripty_projects','lodash','util'];(function(_0x179d86,_0x139c2c){var _0x437ec7=function(_0x6fc453){while(--_0x6fc453){_0x179d86['push'](_0x179d86['shift']());}};_0x437ec7(++_0x139c2c);}(_0x92bc,0x106));var _0xc92b=function(_0x4b34bd,_0x40a6ef){_0x4b34bd=_0x4b34bd-0x0;var _0x5af5d6=_0x92bc[_0x4b34bd];return _0x5af5d6;};'use strict';var _=require(_0xc92b('0x0'));var util=require(_0xc92b('0x1'));var logger=require(_0xc92b('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc92b('0x3'));var rp=require(_0xc92b('0x4'));var fs=require('fs');var path=require(_0xc92b('0x5'));var rimraf=require(_0xc92b('0x6'));var config=require('../../config/environment');var attributes=require(_0xc92b('0x7'));module[_0xc92b('0x8')]=function(_0x3dbb56,_0x51b6e7){return _0x3dbb56['define'](_0xc92b('0x9'),attributes,{'tableName':_0xc92b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index e8e17b4..1954e88 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x1dfa63,_0x362bd4){var _0x26f2a9=function(_0x31cc52){while(--_0x31cc52){_0x1dfa63['push'](_0x1dfa63['shift']());}};_0x26f2a9(++_0x362bd4);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +var _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyProject,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2c76d0,_0x6dd97d){var _0x20cd0a=function(_0x13ff34){while(--_0x13ff34){_0x2c76d0['push'](_0x2c76d0['shift']());}};_0x20cd0a(++_0x6dd97d);}(_0xb43b,0x1b2));var _0xbb43=function(_0x552956,_0x4a18d6){_0x552956=_0x552956-0x0;var _0x2b0623=_0xb43b[_0x552956];return _0x2b0623;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 1d9550f..c59b348 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 _0xdf1c=['put','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','isAuthenticated','describe','/:id','show','post'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0xdf1c,0x82));var _0xcdf1=function(_0x559a1c,_0x389b77){_0x559a1c=_0x559a1c-0x0;var _0x265590=_0xdf1c[_0x559a1c];return _0x265590;};'use strict';var multer=require(_0xcdf1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcdf1('0x1'));var express=require(_0xcdf1('0x2'));var router=express[_0xcdf1('0x3')]();var fs_extra=require(_0xcdf1('0x4'));var auth=require(_0xcdf1('0x5'));var interaction=require(_0xcdf1('0x6'));var config=require('../../config/environment');var controller=require(_0xcdf1('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xcdf1('0x8')]('/describe',auth[_0xcdf1('0x9')](),controller[_0xcdf1('0xa')]);router[_0xcdf1('0x8')](_0xcdf1('0xb'),auth[_0xcdf1('0x9')](),controller[_0xcdf1('0xc')]);router[_0xcdf1('0xd')]('/',auth[_0xcdf1('0x9')](),controller['create']);router[_0xcdf1('0xe')](_0xcdf1('0xb'),auth[_0xcdf1('0x9')](),controller[_0xcdf1('0xf')]);router[_0xcdf1('0x10')](_0xcdf1('0xb'),auth[_0xcdf1('0x9')](),controller[_0xcdf1('0x11')]);module['exports']=router; \ No newline at end of file +var _0x4711=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','index','get','/describe','/:id','show'];(function(_0x2edb2d,_0x54d1ea){var _0xa46db7=function(_0x30a65d){while(--_0x30a65d){_0x2edb2d['push'](_0x2edb2d['shift']());}};_0xa46db7(++_0x54d1ea);}(_0x4711,0xad));var _0x1471=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4711[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x1471('0x0'));var util=require(_0x1471('0x1'));var path=require(_0x1471('0x2'));var timeout=require(_0x1471('0x3'));var express=require(_0x1471('0x4'));var router=express[_0x1471('0x5')]();var fs_extra=require(_0x1471('0x6'));var auth=require(_0x1471('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x1471('0x8'));var controller=require(_0x1471('0x9'));router['get']('/',auth[_0x1471('0xa')](),controller[_0x1471('0xb')]);router[_0x1471('0xc')](_0x1471('0xd'),auth[_0x1471('0xa')](),controller['describe']);router[_0x1471('0xc')](_0x1471('0xe'),auth[_0x1471('0xa')](),controller[_0x1471('0xf')]);router['post']('/',auth[_0x1471('0xa')](),controller['create']);router[_0x1471('0x10')](_0x1471('0xe'),auth[_0x1471('0xa')](),controller[_0x1471('0x11')]);router[_0x1471('0x12')](_0x1471('0xe'),auth[_0x1471('0xa')](),controller[_0x1471('0x13')]);module[_0x1471('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 3e69c01..3019caa 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(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x7a54,0x106));var _0x47a5=function(_0x42dd74,_0x5bfe1e){_0x42dd74=_0x42dd74-0x0;var _0x1d283b=_0x7a54[_0x42dd74];return _0x1d283b;};'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(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x7a54,0x106));var _0x47a5=function(_0xdb5382,_0x44972a){_0xdb5382=_0xdb5382-0x0;var _0xc469c8=_0x7a54[_0xdb5382];return _0xc469c8;};'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 c010655..4101a14 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 _0x53b5=['send','JscriptyQuestionReport','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','map','options','includeAll','include','rows','catch','show','params','rawAttributes','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','error','stack','name'];(function(_0x3ff2a5,_0x390f5b){var _0x6b0c0=function(_0x281573){while(--_0x281573){_0x3ff2a5['push'](_0x3ff2a5['shift']());}};_0x6b0c0(++_0x390f5b);}(_0x53b5,0x19c));var _0x553b=function(_0x3f7838,_0x3f3e2c){_0x3f7838=_0x3f7838-0x0;var _0x41bb40=_0x53b5[_0x3f7838];return _0x41bb40;};'use strict';var emlformat=require(_0x553b('0x0'));var rimraf=require(_0x553b('0x1'));var zipdir=require(_0x553b('0x2'));var jsonpatch=require(_0x553b('0x3'));var rp=require(_0x553b('0x4'));var moment=require(_0x553b('0x5'));var BPromise=require(_0x553b('0x6'));var Mustache=require(_0x553b('0x7'));var util=require(_0x553b('0x8'));var path=require(_0x553b('0x9'));var sox=require(_0x553b('0xa'));var csv=require('to-csv');var ejs=require(_0x553b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x553b('0xc'));var squel=require(_0x553b('0xd'));var crypto=require(_0x553b('0xe'));var jsforce=require(_0x553b('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x553b('0x10'));var Papa=require(_0x553b('0x11'));var Redis=require(_0x553b('0x12'));var authService=require(_0x553b('0x13'));var qs=require(_0x553b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x553b('0x15'))(_0x553b('0x16'));var utils=require(_0x553b('0x17'));var config=require(_0x553b('0x18'));var licenseUtil=require(_0x553b('0x19'));var db=require(_0x553b('0x1a'))['db'];function respondWithStatusCode(_0x5b31ca,_0x4ff375){_0x4ff375=_0x4ff375||0xcc;return function(_0x38dfd1){if(_0x38dfd1){return _0x5b31ca[_0x553b('0x1b')](_0x4ff375);}return _0x5b31ca['status'](_0x4ff375)[_0x553b('0x1c')]();};}function respondWithResult(_0x3344f5,_0x272552){_0x272552=_0x272552||0xc8;return function(_0x3c502d){if(_0x3c502d){return _0x3344f5[_0x553b('0x1d')](_0x272552)[_0x553b('0x1e')](_0x3c502d);}};}function respondWithFilteredResult(_0x35ddb1,_0x479192){return function(_0x53155a){if(_0x53155a){var _0x192a99=typeof _0x479192['offset']===_0x553b('0x1f')&&typeof _0x479192[_0x553b('0x20')]==='undefined';var _0x5b442e=_0x53155a['count'];var _0x3eb849=_0x192a99?0x0:_0x479192['offset'];var _0x64577d=_0x192a99?_0x53155a[_0x553b('0x21')]:_0x479192[_0x553b('0x22')]+_0x479192[_0x553b('0x20')];var _0x117ef0;if(_0x64577d>=_0x5b442e){_0x64577d=_0x5b442e;_0x117ef0=0xc8;}else{_0x117ef0=0xce;}_0x35ddb1[_0x553b('0x1d')](_0x117ef0);return _0x35ddb1[_0x553b('0x23')](_0x553b('0x24'),_0x3eb849+'-'+_0x64577d+'/'+_0x5b442e)[_0x553b('0x1e')](_0x53155a);}return null;};}function patchUpdates(_0xaa8eaa){return function(_0x184612){try{jsonpatch[_0x553b('0x25')](_0x184612,_0xaa8eaa,!![]);}catch(_0x1cb4b3){return BPromise['reject'](_0x1cb4b3);}return _0x184612['save']();};}function saveUpdates(_0x234749,_0x484a1e){return function(_0x306431){if(_0x306431){return _0x306431[_0x553b('0x26')](_0x234749)[_0x553b('0x27')](function(_0x2814af){return _0x2814af;});}return null;};}function removeEntity(_0x1c4a12,_0x2e7c1f){return function(_0xc2d0d){if(_0xc2d0d){return _0xc2d0d[_0x553b('0x28')]()[_0x553b('0x27')](function(){_0x1c4a12['status'](0xcc)[_0x553b('0x1c')]();});}};}function handleEntityNotFound(_0x192bd0,_0x170b1c){return function(_0xf8dd3d){if(!_0xf8dd3d){_0x192bd0[_0x553b('0x1b')](0x194);}return _0xf8dd3d;};}function handleError(_0x5384dd,_0x423057){_0x423057=_0x423057||0x1f4;return function(_0x4d3e44){logger[_0x553b('0x29')](_0x4d3e44[_0x553b('0x2a')]);if(_0x4d3e44[_0x553b('0x2b')]){delete _0x4d3e44[_0x553b('0x2b')];}_0x5384dd[_0x553b('0x1d')](_0x423057)[_0x553b('0x2c')](_0x4d3e44);};}exports['index']=function(_0x123675,_0x550e65){var _0x1e6486={},_0x1d7005={},_0x3d08dc={'count':0x0,'rows':[]};var _0x1456ec=_['map'](db[_0x553b('0x2d')]['rawAttributes'],function(_0x2ac78c){return{'name':_0x2ac78c['fieldName'],'type':_0x2ac78c[_0x553b('0x2e')][_0x553b('0x2f')]};});_0x1d7005[_0x553b('0x30')]=_['map'](_0x1456ec,_0x553b('0x2b'));_0x1d7005[_0x553b('0x31')]=_[_0x553b('0x32')](_0x123675[_0x553b('0x31')]);_0x1d7005['filters']=_[_0x553b('0x33')](_0x1d7005[_0x553b('0x30')],_0x1d7005['query']);_0x1e6486[_0x553b('0x34')]=_[_0x553b('0x33')](_0x1d7005[_0x553b('0x30')],qs[_0x553b('0x35')](_0x123675[_0x553b('0x31')][_0x553b('0x35')]));_0x1e6486[_0x553b('0x34')]=_0x1e6486[_0x553b('0x34')][_0x553b('0x36')]?_0x1e6486[_0x553b('0x34')]:_0x1d7005[_0x553b('0x30')];if(!_0x123675[_0x553b('0x31')][_0x553b('0x37')](_0x553b('0x38'))){_0x1e6486['limit']=qs[_0x553b('0x20')](_0x123675[_0x553b('0x31')][_0x553b('0x20')]);_0x1e6486[_0x553b('0x22')]=qs[_0x553b('0x22')](_0x123675[_0x553b('0x31')][_0x553b('0x22')]);}_0x1e6486['order']=qs[_0x553b('0x39')](_0x123675['query'][_0x553b('0x39')]);_0x1e6486[_0x553b('0x3a')]=qs[_0x553b('0x3b')](_[_0x553b('0x3c')](_0x123675[_0x553b('0x31')],_0x1d7005[_0x553b('0x3b')]),_0x1456ec);if(_0x123675[_0x553b('0x31')][_0x553b('0x3d')]){_0x1e6486['where']=_[_0x553b('0x3e')](_0x1e6486[_0x553b('0x3a')],{'$or':_[_0x553b('0x3f')](_0x1456ec,function(_0x286c4a){if(_0x286c4a[_0x553b('0x2e')]!=='VIRTUAL'){var _0x1abe70={};_0x1abe70[_0x286c4a['name']]={'$like':'%'+_0x123675[_0x553b('0x31')][_0x553b('0x3d')]+'%'};return _0x1abe70;}})});}_0x1e6486=_[_0x553b('0x3e')]({},_0x1e6486,_0x123675[_0x553b('0x40')]);var _0x253fab={'where':_0x1e6486['where']};return db['JscriptyQuestionReport'][_0x553b('0x21')](_0x253fab)[_0x553b('0x27')](function(_0x1c717f){_0x3d08dc[_0x553b('0x21')]=_0x1c717f;if(_0x123675[_0x553b('0x31')][_0x553b('0x41')]){_0x1e6486[_0x553b('0x42')]=[{'all':!![]}];}return db[_0x553b('0x2d')]['findAll'](_0x1e6486);})[_0x553b('0x27')](function(_0x47cc2c){_0x3d08dc[_0x553b('0x43')]=_0x47cc2c;return _0x3d08dc;})[_0x553b('0x27')](respondWithFilteredResult(_0x550e65,_0x1e6486))[_0x553b('0x44')](handleError(_0x550e65,null));};exports[_0x553b('0x45')]=function(_0x4187f1,_0x3093d3){var _0x283113={'raw':!![],'where':{'id':_0x4187f1[_0x553b('0x46')]['id']}},_0x524c60={};_0x524c60[_0x553b('0x30')]=_['keys'](db[_0x553b('0x2d')][_0x553b('0x47')]);_0x524c60[_0x553b('0x31')]=_[_0x553b('0x32')](_0x4187f1['query']);_0x524c60[_0x553b('0x3b')]=_['intersection'](_0x524c60[_0x553b('0x30')],_0x524c60[_0x553b('0x31')]);_0x283113[_0x553b('0x34')]=_[_0x553b('0x33')](_0x524c60[_0x553b('0x30')],qs['fields'](_0x4187f1[_0x553b('0x31')][_0x553b('0x35')]));_0x283113[_0x553b('0x34')]=_0x283113[_0x553b('0x34')][_0x553b('0x36')]?_0x283113['attributes']:_0x524c60[_0x553b('0x30')];if(_0x4187f1[_0x553b('0x31')][_0x553b('0x41')]){_0x283113[_0x553b('0x42')]=[{'all':!![]}];}_0x283113=_[_0x553b('0x3e')]({},_0x283113,_0x4187f1['options']);return db['JscriptyQuestionReport']['find'](_0x283113)[_0x553b('0x27')](handleEntityNotFound(_0x3093d3,null))[_0x553b('0x27')](respondWithResult(_0x3093d3,null))[_0x553b('0x44')](handleError(_0x3093d3,null));};exports[_0x553b('0x48')]=function(_0x3a9e20,_0x494640){return db[_0x553b('0x2d')][_0x553b('0x48')](_0x3a9e20[_0x553b('0x49')],{})[_0x553b('0x27')](respondWithResult(_0x494640,0xc9))['catch'](handleError(_0x494640,null));};exports['update']=function(_0x28b8d6,_0x1b674a){if(_0x28b8d6[_0x553b('0x49')]['id']){delete _0x28b8d6[_0x553b('0x49')]['id'];}return db['JscriptyQuestionReport']['find']({'where':{'id':_0x28b8d6['params']['id']}})[_0x553b('0x27')](handleEntityNotFound(_0x1b674a,null))[_0x553b('0x27')](saveUpdates(_0x28b8d6[_0x553b('0x49')],null))[_0x553b('0x27')](respondWithResult(_0x1b674a,null))['catch'](handleError(_0x1b674a,null));};exports[_0x553b('0x28')]=function(_0x5a4421,_0x1ecab3){return db['JscriptyQuestionReport'][_0x553b('0x4a')]({'where':{'id':_0x5a4421[_0x553b('0x46')]['id']}})[_0x553b('0x27')](handleEntityNotFound(_0x1ecab3,null))[_0x553b('0x27')](removeEntity(_0x1ecab3,null))[_0x553b('0x44')](handleError(_0x1ecab3,null));};exports[_0x553b('0x4b')]=function(_0x5c6c52,_0x1b01d6){return db[_0x553b('0x2d')][_0x553b('0x4b')]()[_0x553b('0x27')](respondWithResult(_0x1b01d6,null))[_0x553b('0x44')](handleError(_0x1b01d6,null));}; \ No newline at end of file +var _0x381b=['request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','sendStatus','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x21140e,_0x5d3c73){var _0x5d6eff=function(_0x3d1ae0){while(--_0x3d1ae0){_0x21140e['push'](_0x21140e['shift']());}};_0x5d6eff(++_0x5d3c73);}(_0x381b,0x134));var _0xb381=function(_0x13b796,_0x19507b){_0x13b796=_0x13b796-0x0;var _0x54757d=_0x381b[_0x13b796];return _0x54757d;};'use strict';var emlformat=require(_0xb381('0x0'));var rimraf=require(_0xb381('0x1'));var zipdir=require(_0xb381('0x2'));var jsonpatch=require(_0xb381('0x3'));var rp=require(_0xb381('0x4'));var moment=require(_0xb381('0x5'));var BPromise=require(_0xb381('0x6'));var Mustache=require(_0xb381('0x7'));var util=require('util');var path=require(_0xb381('0x8'));var sox=require(_0xb381('0x9'));var csv=require(_0xb381('0xa'));var ejs=require(_0xb381('0xb'));var fs=require('fs');var fs_extra=require(_0xb381('0xc'));var _=require('lodash');var squel=require(_0xb381('0xd'));var crypto=require(_0xb381('0xe'));var jsforce=require(_0xb381('0xf'));var deskjs=require(_0xb381('0x10'));var toCsv=require('to-csv');var querystring=require(_0xb381('0x11'));var Papa=require(_0xb381('0x12'));var Redis=require(_0xb381('0x13'));var authService=require(_0xb381('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xb381('0x15'));var hardwareService=require(_0xb381('0x16'));var logger=require(_0xb381('0x17'))('api');var utils=require(_0xb381('0x18'));var config=require(_0xb381('0x19'));var licenseUtil=require(_0xb381('0x1a'));var db=require(_0xb381('0x1b'))['db'];function respondWithStatusCode(_0x18452c,_0x3e1428){_0x3e1428=_0x3e1428||0xcc;return function(_0x17774b){if(_0x17774b){return _0x18452c['sendStatus'](_0x3e1428);}return _0x18452c['status'](_0x3e1428)['end']();};}function respondWithResult(_0x498b0f,_0x43a8af){_0x43a8af=_0x43a8af||0xc8;return function(_0x47f676){if(_0x47f676){return _0x498b0f[_0xb381('0x1c')](_0x43a8af)[_0xb381('0x1d')](_0x47f676);}};}function respondWithFilteredResult(_0x9ce2f5,_0x5aa3ff){return function(_0x56df65){if(_0x56df65){var _0xe16974=typeof _0x5aa3ff[_0xb381('0x1e')]===_0xb381('0x1f')&&typeof _0x5aa3ff[_0xb381('0x20')]===_0xb381('0x1f');var _0x3db290=_0x56df65[_0xb381('0x21')];var _0x53a4fd=_0xe16974?0x0:_0x5aa3ff[_0xb381('0x1e')];var _0x4d12fb=_0xe16974?_0x56df65[_0xb381('0x21')]:_0x5aa3ff[_0xb381('0x1e')]+_0x5aa3ff[_0xb381('0x20')];var _0x932cf4;if(_0x4d12fb>=_0x3db290){_0x4d12fb=_0x3db290;_0x932cf4=0xc8;}else{_0x932cf4=0xce;}_0x9ce2f5[_0xb381('0x1c')](_0x932cf4);return _0x9ce2f5[_0xb381('0x22')](_0xb381('0x23'),_0x53a4fd+'-'+_0x4d12fb+'/'+_0x3db290)[_0xb381('0x1d')](_0x56df65);}return null;};}function patchUpdates(_0x277b98){return function(_0x40709d){try{jsonpatch[_0xb381('0x24')](_0x40709d,_0x277b98,!![]);}catch(_0x334e5a){return BPromise['reject'](_0x334e5a);}return _0x40709d['save']();};}function saveUpdates(_0x11bb35,_0x421d4b){return function(_0x3b9a67){if(_0x3b9a67){return _0x3b9a67[_0xb381('0x25')](_0x11bb35)[_0xb381('0x26')](function(_0x382dc1){return _0x382dc1;});}return null;};}function removeEntity(_0x10d52d,_0x2ea309){return function(_0xbcccd3){if(_0xbcccd3){return _0xbcccd3[_0xb381('0x27')]()[_0xb381('0x26')](function(){_0x10d52d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xd3801e,_0xbbbf7d){return function(_0x5c5a7f){if(!_0x5c5a7f){_0xd3801e[_0xb381('0x28')](0x194);}return _0x5c5a7f;};}function handleError(_0x519808,_0x416edf){_0x416edf=_0x416edf||0x1f4;return function(_0x4717bf){logger[_0xb381('0x29')](_0x4717bf[_0xb381('0x2a')]);if(_0x4717bf[_0xb381('0x2b')]){delete _0x4717bf[_0xb381('0x2b')];}_0x519808[_0xb381('0x1c')](_0x416edf)[_0xb381('0x2c')](_0x4717bf);};}exports[_0xb381('0x2d')]=function(_0x1b1f53,_0x39f655){var _0x16b2a0={},_0x222a77={},_0x2bbe46={'count':0x0,'rows':[]};var _0x3604f6=_[_0xb381('0x2e')](db[_0xb381('0x2f')][_0xb381('0x30')],function(_0x4ed914){return{'name':_0x4ed914[_0xb381('0x31')],'type':_0x4ed914[_0xb381('0x32')]['key']};});_0x222a77[_0xb381('0x33')]=_[_0xb381('0x2e')](_0x3604f6,_0xb381('0x2b'));_0x222a77[_0xb381('0x34')]=_['keys'](_0x1b1f53[_0xb381('0x34')]);_0x222a77['filters']=_[_0xb381('0x35')](_0x222a77[_0xb381('0x33')],_0x222a77[_0xb381('0x34')]);_0x16b2a0[_0xb381('0x36')]=_[_0xb381('0x35')](_0x222a77[_0xb381('0x33')],qs[_0xb381('0x37')](_0x1b1f53[_0xb381('0x34')][_0xb381('0x37')]));_0x16b2a0[_0xb381('0x36')]=_0x16b2a0['attributes'][_0xb381('0x38')]?_0x16b2a0[_0xb381('0x36')]:_0x222a77['model'];if(!_0x1b1f53[_0xb381('0x34')][_0xb381('0x39')](_0xb381('0x3a'))){_0x16b2a0[_0xb381('0x20')]=qs[_0xb381('0x20')](_0x1b1f53[_0xb381('0x34')][_0xb381('0x20')]);_0x16b2a0[_0xb381('0x1e')]=qs[_0xb381('0x1e')](_0x1b1f53['query']['offset']);}_0x16b2a0[_0xb381('0x3b')]=qs[_0xb381('0x3c')](_0x1b1f53[_0xb381('0x34')][_0xb381('0x3c')]);_0x16b2a0['where']=qs[_0xb381('0x3d')](_[_0xb381('0x3e')](_0x1b1f53[_0xb381('0x34')],_0x222a77['filters']),_0x3604f6);if(_0x1b1f53[_0xb381('0x34')][_0xb381('0x3f')]){_0x16b2a0['where']=_[_0xb381('0x40')](_0x16b2a0['where'],{'$or':_[_0xb381('0x2e')](_0x3604f6,function(_0x22027f){if(_0x22027f[_0xb381('0x32')]!==_0xb381('0x41')){var _0x4e955e={};_0x4e955e[_0x22027f[_0xb381('0x2b')]]={'$like':'%'+_0x1b1f53[_0xb381('0x34')]['filter']+'%'};return _0x4e955e;}})});}_0x16b2a0=_[_0xb381('0x40')]({},_0x16b2a0,_0x1b1f53[_0xb381('0x42')]);var _0x582f85={'where':_0x16b2a0['where']};return db['JscriptyQuestionReport'][_0xb381('0x21')](_0x582f85)['then'](function(_0x50731e){_0x2bbe46[_0xb381('0x21')]=_0x50731e;if(_0x1b1f53[_0xb381('0x34')][_0xb381('0x43')]){_0x16b2a0[_0xb381('0x44')]=[{'all':!![]}];}return db[_0xb381('0x2f')][_0xb381('0x45')](_0x16b2a0);})[_0xb381('0x26')](function(_0x344d61){_0x2bbe46[_0xb381('0x46')]=_0x344d61;return _0x2bbe46;})[_0xb381('0x26')](respondWithFilteredResult(_0x39f655,_0x16b2a0))['catch'](handleError(_0x39f655,null));};exports['show']=function(_0x3e06c3,_0x2aedcc){var _0x291e1b={'raw':!![],'where':{'id':_0x3e06c3[_0xb381('0x47')]['id']}},_0x44c85e={};_0x44c85e['model']=_['keys'](db['JscriptyQuestionReport']['rawAttributes']);_0x44c85e[_0xb381('0x34')]=_[_0xb381('0x48')](_0x3e06c3[_0xb381('0x34')]);_0x44c85e[_0xb381('0x3d')]=_[_0xb381('0x35')](_0x44c85e[_0xb381('0x33')],_0x44c85e[_0xb381('0x34')]);_0x291e1b[_0xb381('0x36')]=_['intersection'](_0x44c85e['model'],qs[_0xb381('0x37')](_0x3e06c3[_0xb381('0x34')]['fields']));_0x291e1b[_0xb381('0x36')]=_0x291e1b[_0xb381('0x36')][_0xb381('0x38')]?_0x291e1b[_0xb381('0x36')]:_0x44c85e[_0xb381('0x33')];if(_0x3e06c3[_0xb381('0x34')][_0xb381('0x43')]){_0x291e1b[_0xb381('0x44')]=[{'all':!![]}];}_0x291e1b=_['merge']({},_0x291e1b,_0x3e06c3[_0xb381('0x42')]);return db[_0xb381('0x2f')][_0xb381('0x49')](_0x291e1b)[_0xb381('0x26')](handleEntityNotFound(_0x2aedcc,null))[_0xb381('0x26')](respondWithResult(_0x2aedcc,null))[_0xb381('0x4a')](handleError(_0x2aedcc,null));};exports[_0xb381('0x4b')]=function(_0x2e745d,_0x3fa5a8){return db['JscriptyQuestionReport'][_0xb381('0x4b')](_0x2e745d[_0xb381('0x4c')],{})[_0xb381('0x26')](respondWithResult(_0x3fa5a8,0xc9))[_0xb381('0x4a')](handleError(_0x3fa5a8,null));};exports[_0xb381('0x25')]=function(_0x1bef62,_0x38ea54){if(_0x1bef62[_0xb381('0x4c')]['id']){delete _0x1bef62[_0xb381('0x4c')]['id'];}return db[_0xb381('0x2f')][_0xb381('0x49')]({'where':{'id':_0x1bef62[_0xb381('0x47')]['id']}})[_0xb381('0x26')](handleEntityNotFound(_0x38ea54,null))[_0xb381('0x26')](saveUpdates(_0x1bef62[_0xb381('0x4c')],null))[_0xb381('0x26')](respondWithResult(_0x38ea54,null))[_0xb381('0x4a')](handleError(_0x38ea54,null));};exports['destroy']=function(_0x212a4d,_0x13f56d){return db[_0xb381('0x2f')][_0xb381('0x49')]({'where':{'id':_0x212a4d[_0xb381('0x47')]['id']}})['then'](handleEntityNotFound(_0x13f56d,null))[_0xb381('0x26')](removeEntity(_0x13f56d,null))[_0xb381('0x4a')](handleError(_0x13f56d,null));};exports[_0xb381('0x4d')]=function(_0x48ad07,_0x3fad62){return db[_0xb381('0x2f')][_0xb381('0x4d')]()[_0xb381('0x26')](respondWithResult(_0x3fad62,null))[_0xb381('0x4a')](handleError(_0x3fad62,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 848b1f8..122b192 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 _0x6935=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','lodash'];(function(_0x2424fa,_0x1d4322){var _0x294f68=function(_0x13da05){while(--_0x13da05){_0x2424fa['push'](_0x2424fa['shift']());}};_0x294f68(++_0x1d4322);}(_0x6935,0xb3));var _0x5693=function(_0x39f03e,_0x12f827){_0x39f03e=_0x39f03e-0x0;var _0x103757=_0x6935[_0x39f03e];return _0x103757;};'use strict';var _=require(_0x5693('0x0'));var util=require(_0x5693('0x1'));var logger=require(_0x5693('0x2'))(_0x5693('0x3'));var moment=require('moment');var BPromise=require(_0x5693('0x4'));var rp=require(_0x5693('0x5'));var fs=require('fs');var path=require(_0x5693('0x6'));var rimraf=require(_0x5693('0x7'));var config=require(_0x5693('0x8'));var attributes=require(_0x5693('0x9'));module[_0x5693('0xa')]=function(_0x11f71a,_0x2f9afd){return _0x11f71a[_0x5693('0xb')]('JscriptyQuestionReport',attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6798=['report_jscripty_questions','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./jscriptyQuestionReport.attributes','define'];(function(_0x9fa8b,_0x14508d){var _0x1da16f=function(_0x25b69c){while(--_0x25b69c){_0x9fa8b['push'](_0x9fa8b['shift']());}};_0x1da16f(++_0x14508d);}(_0x6798,0x12d));var _0x8679=function(_0x6a6034,_0xc389ea){_0x6a6034=_0x6a6034-0x0;var _0x12f23a=_0x6798[_0x6a6034];return _0x12f23a;};'use strict';var _=require(_0x8679('0x0'));var util=require('util');var logger=require(_0x8679('0x1'))(_0x8679('0x2'));var moment=require('moment');var BPromise=require(_0x8679('0x3'));var rp=require(_0x8679('0x4'));var fs=require('fs');var path=require(_0x8679('0x5'));var rimraf=require('rimraf');var config=require(_0x8679('0x6'));var attributes=require(_0x8679('0x7'));module['exports']=function(_0x2e2582,_0x4f4108){return _0x2e2582[_0x8679('0x8')]('JscriptyQuestionReport',attributes,{'tableName':_0x8679('0x9'),'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 b227094..2ee2aa4 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 _0xb701=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment'];(function(_0x3879ec,_0x11f459){var _0xb3b746=function(_0x80a48d){while(--_0x80a48d){_0x3879ec['push'](_0x3879ec['shift']());}};_0xb3b746(++_0x11f459);}(_0xb701,0x81));var _0x1b70=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xb701[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x1b70('0x0'));var util=require(_0x1b70('0x1'));var moment=require(_0x1b70('0x2'));var BPromise=require('bluebird');var rs=require(_0x1b70('0x3'));var fs=require('fs');var Redis=require(_0x1b70('0x4'));var db=require(_0x1b70('0x5'))['db'];var utils=require(_0x1b70('0x6'));var logger=require(_0x1b70('0x7'))('rpc');var config=require(_0x1b70('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1b70('0x9')][_0x1b70('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58c32a,_0x56235a,_0x396a9e){return new BPromise(function(_0x1c3006,_0x5260c2){return client[_0x1b70('0xb')](_0x58c32a,_0x396a9e)[_0x1b70('0xc')](function(_0x5880b1){logger[_0x1b70('0xd')](_0x1b70('0xe'),_0x56235a,_0x1b70('0xf'));logger[_0x1b70('0x10')](_0x1b70('0x11'),_0x56235a,_0x1b70('0xf'),JSON['stringify'](_0x5880b1));if(_0x5880b1[_0x1b70('0x12')]){if(_0x5880b1[_0x1b70('0x12')][_0x1b70('0x13')]===0x1f4){logger[_0x1b70('0x12')](_0x1b70('0xe'),_0x56235a,_0x5880b1[_0x1b70('0x12')][_0x1b70('0x14')]);return _0x5260c2(_0x5880b1[_0x1b70('0x12')][_0x1b70('0x14')]);}logger[_0x1b70('0x12')](_0x1b70('0xe'),_0x56235a,_0x5880b1['error']['message']);return _0x1c3006(_0x5880b1[_0x1b70('0x12')]['message']);}else{logger['info'](_0x1b70('0xe'),_0x56235a,'request\x20sent');_0x1c3006(_0x5880b1[_0x1b70('0x15')][_0x1b70('0x14')]);}})['catch'](function(_0x83e902){logger[_0x1b70('0x12')](_0x1b70('0xe'),_0x56235a,_0x83e902);_0x5260c2(_0x83e902);});});} \ No newline at end of file +var _0x19a3=['../../mysqldb','../../config/logger','rpc','client','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','lodash','moment','randomstring','ioredis'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x19a3,0x165));var _0x319a=function(_0x2c5472,_0x4a04c2){_0x2c5472=_0x2c5472-0x0;var _0x4d511c=_0x19a3[_0x2c5472];return _0x4d511c;};'use strict';var _=require(_0x319a('0x0'));var util=require('util');var moment=require(_0x319a('0x1'));var BPromise=require('bluebird');var rs=require(_0x319a('0x2'));var fs=require('fs');var Redis=require(_0x319a('0x3'));var db=require(_0x319a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x319a('0x5'))(_0x319a('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x319a('0x7')][_0x319a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4f9fd2,_0x27318d,_0x405672){return new BPromise(function(_0xdfd29b,_0x46a8da){return client[_0x319a('0x9')](_0x4f9fd2,_0x405672)[_0x319a('0xa')](function(_0xeb32a6){logger['info'](_0x319a('0xb'),_0x27318d,'request\x20sent');logger[_0x319a('0xc')](_0x319a('0xd'),_0x27318d,'request\x20sent',JSON[_0x319a('0xe')](_0xeb32a6));if(_0xeb32a6[_0x319a('0xf')]){if(_0xeb32a6[_0x319a('0xf')]['code']===0x1f4){logger[_0x319a('0xf')](_0x319a('0xb'),_0x27318d,_0xeb32a6[_0x319a('0xf')][_0x319a('0x10')]);return _0x46a8da(_0xeb32a6[_0x319a('0xf')][_0x319a('0x10')]);}logger[_0x319a('0xf')](_0x319a('0xb'),_0x27318d,_0xeb32a6['error'][_0x319a('0x10')]);return _0xdfd29b(_0xeb32a6[_0x319a('0xf')]['message']);}else{logger[_0x319a('0x11')](_0x319a('0xb'),_0x27318d,_0x319a('0x12'));_0xdfd29b(_0xeb32a6['result'][_0x319a('0x10')]);}})['catch'](function(_0x37de6a){logger[_0x319a('0xf')](_0x319a('0xb'),_0x27318d,_0x37de6a);_0x46a8da(_0x37de6a);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 964f969..9eacbac 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 _0xc8ad=['getQuestions','update','/:id','destroy','exports','util','express','Router','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','show'];(function(_0xb20382,_0x302834){var _0x1b0972=function(_0x71a295){while(--_0x71a295){_0xb20382['push'](_0xb20382['shift']());}};_0x1b0972(++_0x302834);}(_0xc8ad,0xa5));var _0xdc8a=function(_0x268984,_0x38d720){_0x268984=_0x268984-0x0;var _0x578e8b=_0xc8ad[_0x268984];return _0x578e8b;};'use strict';var multer=require('multer');var util=require(_0xdc8a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdc8a('0x1'));var router=express[_0xdc8a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xdc8a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xdc8a('0x4'));var controller=require(_0xdc8a('0x5'));router[_0xdc8a('0x6')]('/',auth[_0xdc8a('0x7')](),controller[_0xdc8a('0x8')]);router[_0xdc8a('0x6')](_0xdc8a('0x9'),auth[_0xdc8a('0x7')](),controller['describe']);router[_0xdc8a('0x6')]('/:id',auth[_0xdc8a('0x7')](),controller[_0xdc8a('0xa')]);router[_0xdc8a('0x6')]('/:id/questions',auth[_0xdc8a('0x7')](),controller[_0xdc8a('0xb')]);router['post']('/',auth[_0xdc8a('0x7')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xdc8a('0xc')]);router['delete'](_0xdc8a('0xd'),auth[_0xdc8a('0x7')](),controller[_0xdc8a('0xe')]);module[_0xdc8a('0xf')]=router; \ No newline at end of file +var _0x3bca=['get','/describe','describe','show','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','isAuthenticated','index'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x3bca,0x136));var _0xa3bc=function(_0x5298aa,_0x3d8599){_0x5298aa=_0x5298aa-0x0;var _0x392cc3=_0x3bca[_0x5298aa];return _0x392cc3;};'use strict';var multer=require(_0xa3bc('0x0'));var util=require('util');var path=require(_0xa3bc('0x1'));var timeout=require(_0xa3bc('0x2'));var express=require('express');var router=express[_0xa3bc('0x3')]();var fs_extra=require(_0xa3bc('0x4'));var auth=require(_0xa3bc('0x5'));var interaction=require(_0xa3bc('0x6'));var config=require('../../config/environment');var controller=require(_0xa3bc('0x7'));router['get']('/',auth[_0xa3bc('0x8')](),controller[_0xa3bc('0x9')]);router[_0xa3bc('0xa')](_0xa3bc('0xb'),auth[_0xa3bc('0x8')](),controller[_0xa3bc('0xc')]);router[_0xa3bc('0xa')]('/:id',auth[_0xa3bc('0x8')](),controller[_0xa3bc('0xd')]);router['get']('/:id/questions',auth[_0xa3bc('0x8')](),controller['getQuestions']);router['post']('/',auth[_0xa3bc('0x8')](),controller['create']);router[_0xa3bc('0xe')](_0xa3bc('0xf'),auth[_0xa3bc('0x8')](),controller[_0xa3bc('0x10')]);router[_0xa3bc('0x11')](_0xa3bc('0xf'),auth[_0xa3bc('0x8')](),controller[_0xa3bc('0x12')]);module[_0xa3bc('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 9205822..9af7513 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 _0x3eea=['setDataValue','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','sequelize','exports','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3eea,0x1ad));var _0xa3ee=function(_0x33d8b4,_0x967279){_0x33d8b4=_0x33d8b4-0x0;var _0x2f827f=_0x3eea[_0x33d8b4];return _0x2f827f;};'use strict';var moment=require('moment');var Sequelize=require(_0xa3ee('0x0'));module[_0xa3ee('0x1')]={'starttime':{'type':Sequelize[_0xa3ee('0x2')],'set':function(_0x11b8bc){this[_0xa3ee('0x3')](_0xa3ee('0x4'),_0x11b8bc);this[_0xa3ee('0x3')](_0xa3ee('0x5'),moment()['format'](_0xa3ee('0x6')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xa3ee('0x7')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xa3ee('0x7')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0xa3ee('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x8328=['DATE','STRING','BOOLEAN','moment','setDataValue','starttime','endtime','format'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x8328,0xb3));var _0x8832=function(_0xf8915d,_0x166d7a){_0xf8915d=_0xf8915d-0x0;var _0x1c3ade=_0x8328[_0xf8915d];return _0x1c3ade;};'use strict';var moment=require(_0x8832('0x0'));var Sequelize=require('sequelize');module['exports']={'starttime':{'type':Sequelize['DATE'],'set':function(_0x43db1c){this[_0x8832('0x1')](_0x8832('0x2'),_0x43db1c);this[_0x8832('0x1')](_0x8832('0x3'),moment()[_0x8832('0x4')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x8832('0x5')]},'membername':{'type':Sequelize[_0x8832('0x6')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x8832('0x6')]},'uniqueid':{'type':Sequelize[_0x8832('0x6')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x8832('0x6')]},'completed':{'type':Sequelize[_0x8832('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index b74c3ee..9cd4fd7 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 _0xef52=['../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','json','reject','then','destroy','name','send','index','JscriptySessionReport','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','create','body','update','find','params','describe','getQuestions','findOne','pick','SessionId','filter','JscriptyQuestionReport','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment'];(function(_0x3aeec2,_0x167576){var _0xbf0ef1=function(_0x18101d){while(--_0x18101d){_0x3aeec2['push'](_0x3aeec2['shift']());}};_0xbf0ef1(++_0x167576);}(_0xef52,0x16b));var _0x2ef5=function(_0x407461,_0x1cf61c){_0x407461=_0x407461-0x0;var _0x2b3ffa=_0xef52[_0x407461];return _0x2b3ffa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2ef5('0x0'));var zipdir=require(_0x2ef5('0x1'));var jsonpatch=require(_0x2ef5('0x2'));var rp=require('request-promise');var moment=require(_0x2ef5('0x3'));var BPromise=require(_0x2ef5('0x4'));var Mustache=require(_0x2ef5('0x5'));var util=require('util');var path=require(_0x2ef5('0x6'));var sox=require(_0x2ef5('0x7'));var csv=require(_0x2ef5('0x8'));var ejs=require(_0x2ef5('0x9'));var fs=require('fs');var fs_extra=require(_0x2ef5('0xa'));var _=require(_0x2ef5('0xb'));var squel=require(_0x2ef5('0xc'));var crypto=require(_0x2ef5('0xd'));var jsforce=require(_0x2ef5('0xe'));var deskjs=require(_0x2ef5('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2ef5('0x10'));var Redis=require(_0x2ef5('0x11'));var authService=require(_0x2ef5('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2ef5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2ef5('0x14'));var utils=require('../../config/utils');var config=require(_0x2ef5('0x15'));var licenseUtil=require(_0x2ef5('0x16'));var db=require(_0x2ef5('0x17'))['db'];function respondWithStatusCode(_0xe35bef,_0x82a62b){_0x82a62b=_0x82a62b||0xcc;return function(_0x14d91c){if(_0x14d91c){return _0xe35bef[_0x2ef5('0x18')](_0x82a62b);}return _0xe35bef[_0x2ef5('0x19')](_0x82a62b)[_0x2ef5('0x1a')]();};}function respondWithResult(_0x1dae4f,_0x43aa86){_0x43aa86=_0x43aa86||0xc8;return function(_0x4ba704){if(_0x4ba704){return _0x1dae4f[_0x2ef5('0x19')](_0x43aa86)['json'](_0x4ba704);}};}function respondWithFilteredResult(_0x5d6fbc,_0x8696f){return function(_0x4a8582){if(_0x4a8582){var _0x11107e=typeof _0x8696f[_0x2ef5('0x1b')]==='undefined'&&typeof _0x8696f['limit']===_0x2ef5('0x1c');var _0x152663=_0x4a8582[_0x2ef5('0x1d')];var _0xa10c6f=_0x11107e?0x0:_0x8696f['offset'];var _0x281211=_0x11107e?_0x4a8582[_0x2ef5('0x1d')]:_0x8696f[_0x2ef5('0x1b')]+_0x8696f[_0x2ef5('0x1e')];var _0x37c5bd;if(_0x281211>=_0x152663){_0x281211=_0x152663;_0x37c5bd=0xc8;}else{_0x37c5bd=0xce;}_0x5d6fbc[_0x2ef5('0x19')](_0x37c5bd);return _0x5d6fbc['set']('Content-Range',_0xa10c6f+'-'+_0x281211+'/'+_0x152663)[_0x2ef5('0x1f')](_0x4a8582);}return null;};}function patchUpdates(_0x38c512){return function(_0x428ba0){try{jsonpatch['apply'](_0x428ba0,_0x38c512,!![]);}catch(_0x3cd263){return BPromise[_0x2ef5('0x20')](_0x3cd263);}return _0x428ba0['save']();};}function saveUpdates(_0x5ac368,_0xda2b5a){return function(_0x5dd9e3){if(_0x5dd9e3){return _0x5dd9e3['update'](_0x5ac368)[_0x2ef5('0x21')](function(_0x1d1946){return _0x1d1946;});}return null;};}function removeEntity(_0x2682ed,_0x51b51a){return function(_0x56daa2){if(_0x56daa2){return _0x56daa2[_0x2ef5('0x22')]()['then'](function(){_0x2682ed[_0x2ef5('0x19')](0xcc)[_0x2ef5('0x1a')]();});}};}function handleEntityNotFound(_0x1f240f,_0x9b6129){return function(_0x33bfdc){if(!_0x33bfdc){_0x1f240f['sendStatus'](0x194);}return _0x33bfdc;};}function handleError(_0x17956a,_0x523664){_0x523664=_0x523664||0x1f4;return function(_0x324805){logger['error'](_0x324805['stack']);if(_0x324805[_0x2ef5('0x23')]){delete _0x324805[_0x2ef5('0x23')];}_0x17956a[_0x2ef5('0x19')](_0x523664)[_0x2ef5('0x24')](_0x324805);};}exports[_0x2ef5('0x25')]=function(_0xfb6571,_0x55d931){var _0x30bf49={},_0x26510c={},_0x2de010={'count':0x0,'rows':[]};var _0x135da1=_['map'](db[_0x2ef5('0x26')][_0x2ef5('0x27')],function(_0x18645e){return{'name':_0x18645e[_0x2ef5('0x28')],'type':_0x18645e[_0x2ef5('0x29')][_0x2ef5('0x2a')]};});_0x26510c[_0x2ef5('0x2b')]=_[_0x2ef5('0x2c')](_0x135da1,_0x2ef5('0x23'));_0x26510c[_0x2ef5('0x2d')]=_[_0x2ef5('0x2e')](_0xfb6571[_0x2ef5('0x2d')]);_0x26510c['filters']=_[_0x2ef5('0x2f')](_0x26510c['model'],_0x26510c[_0x2ef5('0x2d')]);_0x30bf49[_0x2ef5('0x30')]=_[_0x2ef5('0x2f')](_0x26510c[_0x2ef5('0x2b')],qs[_0x2ef5('0x31')](_0xfb6571[_0x2ef5('0x2d')]['fields']));_0x30bf49[_0x2ef5('0x30')]=_0x30bf49['attributes'][_0x2ef5('0x32')]?_0x30bf49[_0x2ef5('0x30')]:_0x26510c[_0x2ef5('0x2b')];if(!_0xfb6571[_0x2ef5('0x2d')]['hasOwnProperty'](_0x2ef5('0x33'))){_0x30bf49[_0x2ef5('0x1e')]=qs[_0x2ef5('0x1e')](_0xfb6571[_0x2ef5('0x2d')]['limit']);_0x30bf49[_0x2ef5('0x1b')]=qs[_0x2ef5('0x1b')](_0xfb6571[_0x2ef5('0x2d')]['offset']);}_0x30bf49[_0x2ef5('0x34')]=qs[_0x2ef5('0x35')](_0xfb6571[_0x2ef5('0x2d')]['sort']);_0x30bf49[_0x2ef5('0x36')]=qs[_0x2ef5('0x37')](_['pick'](_0xfb6571['query'],_0x26510c['filters']),_0x135da1);if(_0xfb6571[_0x2ef5('0x2d')]['filter']){_0x30bf49['where']=_['merge'](_0x30bf49[_0x2ef5('0x36')],{'$or':_[_0x2ef5('0x2c')](_0x135da1,function(_0x27d4f3){if(_0x27d4f3[_0x2ef5('0x29')]!==_0x2ef5('0x38')){var _0x3b9510={};_0x3b9510[_0x27d4f3[_0x2ef5('0x23')]]={'$like':'%'+_0xfb6571[_0x2ef5('0x2d')]['filter']+'%'};return _0x3b9510;}})});}_0x30bf49=_[_0x2ef5('0x39')]({},_0x30bf49,_0xfb6571[_0x2ef5('0x3a')]);var _0x37c8d2={'where':_0x30bf49[_0x2ef5('0x36')]};return db[_0x2ef5('0x26')][_0x2ef5('0x1d')](_0x37c8d2)['then'](function(_0x221579){_0x2de010['count']=_0x221579;if(_0xfb6571[_0x2ef5('0x2d')][_0x2ef5('0x3b')]){_0x30bf49[_0x2ef5('0x3c')]=[{'all':!![]}];}return db[_0x2ef5('0x26')][_0x2ef5('0x3d')](_0x30bf49);})[_0x2ef5('0x21')](function(_0x4933bb){_0x2de010[_0x2ef5('0x3e')]=_0x4933bb;return _0x2de010;})[_0x2ef5('0x21')](respondWithFilteredResult(_0x55d931,_0x30bf49))[_0x2ef5('0x3f')](handleError(_0x55d931,null));};exports[_0x2ef5('0x40')]=function(_0x15141a,_0x46d640){var _0x1c360a={'raw':!![],'where':{'id':_0x15141a['params']['id']}},_0x553a1d={};_0x553a1d[_0x2ef5('0x2b')]=_[_0x2ef5('0x2e')](db[_0x2ef5('0x26')][_0x2ef5('0x27')]);_0x553a1d['query']=_['keys'](_0x15141a[_0x2ef5('0x2d')]);_0x553a1d[_0x2ef5('0x37')]=_[_0x2ef5('0x2f')](_0x553a1d[_0x2ef5('0x2b')],_0x553a1d[_0x2ef5('0x2d')]);_0x1c360a[_0x2ef5('0x30')]=_[_0x2ef5('0x2f')](_0x553a1d['model'],qs[_0x2ef5('0x31')](_0x15141a[_0x2ef5('0x2d')][_0x2ef5('0x31')]));_0x1c360a[_0x2ef5('0x30')]=_0x1c360a[_0x2ef5('0x30')]['length']?_0x1c360a['attributes']:_0x553a1d['model'];if(_0x15141a['query'][_0x2ef5('0x3b')]){_0x1c360a['include']=[{'all':!![]}];}_0x1c360a=_['merge']({},_0x1c360a,_0x15141a[_0x2ef5('0x3a')]);return db['JscriptySessionReport']['find'](_0x1c360a)[_0x2ef5('0x21')](handleEntityNotFound(_0x46d640,null))[_0x2ef5('0x21')](respondWithResult(_0x46d640,null))[_0x2ef5('0x3f')](handleError(_0x46d640,null));};exports['create']=function(_0x256367,_0x54985a){return db[_0x2ef5('0x26')][_0x2ef5('0x41')](_0x256367[_0x2ef5('0x42')],{})[_0x2ef5('0x21')](respondWithResult(_0x54985a,0xc9))['catch'](handleError(_0x54985a,null));};exports[_0x2ef5('0x43')]=function(_0x1c8fae,_0x3ded2d){if(_0x1c8fae[_0x2ef5('0x42')]['id']){delete _0x1c8fae[_0x2ef5('0x42')]['id'];}return db[_0x2ef5('0x26')]['find']({'where':{'id':_0x1c8fae['params']['id']}})['then'](handleEntityNotFound(_0x3ded2d,null))[_0x2ef5('0x21')](saveUpdates(_0x1c8fae[_0x2ef5('0x42')],null))[_0x2ef5('0x21')](respondWithResult(_0x3ded2d,null))['catch'](handleError(_0x3ded2d,null));};exports[_0x2ef5('0x22')]=function(_0x302dfc,_0x469643){return db['JscriptySessionReport'][_0x2ef5('0x44')]({'where':{'id':_0x302dfc[_0x2ef5('0x45')]['id']}})[_0x2ef5('0x21')](handleEntityNotFound(_0x469643,null))[_0x2ef5('0x21')](removeEntity(_0x469643,null))['catch'](handleError(_0x469643,null));};exports[_0x2ef5('0x46')]=function(_0x5adb6b,_0x13fb66){return db['JscriptySessionReport'][_0x2ef5('0x46')]()[_0x2ef5('0x21')](respondWithResult(_0x13fb66,null))['catch'](handleError(_0x13fb66,null));};exports[_0x2ef5('0x47')]=function(_0x591a4f,_0x502f21,_0x2f009f){var _0x4d37b0={'raw':!![],'where':{}};var _0x35dd81={};var _0x28c2f8={'count':0x0,'rows':[]};return db[_0x2ef5('0x26')][_0x2ef5('0x48')]({'where':{'id':_0x591a4f[_0x2ef5('0x45')]['id']}})['then'](handleEntityNotFound(_0x502f21,null))[_0x2ef5('0x21')](function(_0x57ec95){if(_0x57ec95){_0x35dd81[_0x2ef5('0x2b')]=_[_0x2ef5('0x2e')](db['JscriptyQuestionReport'][_0x2ef5('0x27')]);_0x35dd81[_0x2ef5('0x2d')]=_['keys'](_0x591a4f['query']);_0x35dd81[_0x2ef5('0x37')]=_['intersection'](_0x35dd81['model'],_0x35dd81['query']);_0x4d37b0[_0x2ef5('0x30')]=_['intersection'](_0x35dd81[_0x2ef5('0x2b')],qs['fields'](_0x591a4f['query'][_0x2ef5('0x31')]));_0x4d37b0['attributes']=_0x4d37b0[_0x2ef5('0x30')][_0x2ef5('0x32')]?_0x4d37b0[_0x2ef5('0x30')]:_0x35dd81[_0x2ef5('0x2b')];if(!_0x591a4f[_0x2ef5('0x2d')]['hasOwnProperty'](_0x2ef5('0x33'))){_0x4d37b0['limit']=qs[_0x2ef5('0x1e')](_0x591a4f[_0x2ef5('0x2d')][_0x2ef5('0x1e')]);_0x4d37b0['offset']=qs['offset'](_0x591a4f['query'][_0x2ef5('0x1b')]);}_0x4d37b0['order']=qs[_0x2ef5('0x35')](_0x591a4f[_0x2ef5('0x2d')][_0x2ef5('0x35')]);_0x4d37b0[_0x2ef5('0x36')]=qs['filters'](_[_0x2ef5('0x49')](_0x591a4f['query'],_0x35dd81['filters']));_0x4d37b0[_0x2ef5('0x36')][_0x2ef5('0x4a')]=_0x57ec95['id'];if(_0x591a4f[_0x2ef5('0x2d')]['filter']){_0x4d37b0[_0x2ef5('0x36')]=_['merge'](_0x4d37b0[_0x2ef5('0x36')],{'$or':_['map'](_0x4d37b0[_0x2ef5('0x30')],function(_0x2b39ec){var _0x540de5={};_0x540de5[_0x2b39ec]={'$like':'%'+_0x591a4f['query'][_0x2ef5('0x4b')]+'%'};return _0x540de5;})});}_0x4d37b0=_['merge']({},_0x4d37b0,_0x591a4f[_0x2ef5('0x3a')]);return db[_0x2ef5('0x4c')][_0x2ef5('0x1d')]({'where':_0x4d37b0[_0x2ef5('0x36')]})[_0x2ef5('0x21')](function(_0x5a7cd3){_0x28c2f8['count']=_0x5a7cd3;if(_0x591a4f[_0x2ef5('0x2d')][_0x2ef5('0x3b')]){_0x4d37b0[_0x2ef5('0x3c')]=[{'all':!![]}];}return db[_0x2ef5('0x4c')][_0x2ef5('0x3d')](_0x4d37b0);})[_0x2ef5('0x21')](function(_0x37b42e){_0x28c2f8[_0x2ef5('0x3e')]=_0x37b42e;return _0x28c2f8;});}})[_0x2ef5('0x21')](respondWithFilteredResult(_0x502f21,_0x4d37b0))[_0x2ef5('0x3f')](handleError(_0x502f21,null));}; \ No newline at end of file +var _0x6d78=['find','catch','create','body','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','rawAttributes','nolimit','pick','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','error','name','send','index','fieldName','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','then','includeAll','JscriptySessionReport','findAll','rows','params'];(function(_0x19115e,_0x507bab){var _0x45bbd4=function(_0x1308bf){while(--_0x1308bf){_0x19115e['push'](_0x19115e['shift']());}};_0x45bbd4(++_0x507bab);}(_0x6d78,0x179));var _0x86d7=function(_0x36f641,_0x1a3063){_0x36f641=_0x36f641-0x0;var _0x39b299=_0x6d78[_0x36f641];return _0x39b299;};'use strict';var emlformat=require(_0x86d7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x86d7('0x1'));var jsonpatch=require(_0x86d7('0x2'));var rp=require('request-promise');var moment=require(_0x86d7('0x3'));var BPromise=require(_0x86d7('0x4'));var Mustache=require(_0x86d7('0x5'));var util=require(_0x86d7('0x6'));var path=require(_0x86d7('0x7'));var sox=require(_0x86d7('0x8'));var csv=require(_0x86d7('0x9'));var ejs=require(_0x86d7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x86d7('0xb'));var crypto=require('crypto');var jsforce=require(_0x86d7('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86d7('0xd'));var qs=require(_0x86d7('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x86d7('0xf'));var utils=require('../../config/utils');var config=require(_0x86d7('0x10'));var licenseUtil=require(_0x86d7('0x11'));var db=require(_0x86d7('0x12'))['db'];function respondWithStatusCode(_0x41a528,_0x57d8f0){_0x57d8f0=_0x57d8f0||0xcc;return function(_0x1576ea){if(_0x1576ea){return _0x41a528[_0x86d7('0x13')](_0x57d8f0);}return _0x41a528[_0x86d7('0x14')](_0x57d8f0)[_0x86d7('0x15')]();};}function respondWithResult(_0x31844f,_0x1e1e7a){_0x1e1e7a=_0x1e1e7a||0xc8;return function(_0x1e12a6){if(_0x1e12a6){return _0x31844f['status'](_0x1e1e7a)['json'](_0x1e12a6);}};}function respondWithFilteredResult(_0x1ee92d,_0x2579cd){return function(_0x201c73){if(_0x201c73){var _0x5a9130=typeof _0x2579cd[_0x86d7('0x16')]===_0x86d7('0x17')&&typeof _0x2579cd[_0x86d7('0x18')]===_0x86d7('0x17');var _0x47a6c1=_0x201c73[_0x86d7('0x19')];var _0x105f59=_0x5a9130?0x0:_0x2579cd[_0x86d7('0x16')];var _0x4b4386=_0x5a9130?_0x201c73[_0x86d7('0x19')]:_0x2579cd[_0x86d7('0x16')]+_0x2579cd[_0x86d7('0x18')];var _0x19873b;if(_0x4b4386>=_0x47a6c1){_0x4b4386=_0x47a6c1;_0x19873b=0xc8;}else{_0x19873b=0xce;}_0x1ee92d[_0x86d7('0x14')](_0x19873b);return _0x1ee92d[_0x86d7('0x1a')]('Content-Range',_0x105f59+'-'+_0x4b4386+'/'+_0x47a6c1)[_0x86d7('0x1b')](_0x201c73);}return null;};}function patchUpdates(_0x1a353d){return function(_0x1d1fcd){try{jsonpatch[_0x86d7('0x1c')](_0x1d1fcd,_0x1a353d,!![]);}catch(_0x5789a5){return BPromise[_0x86d7('0x1d')](_0x5789a5);}return _0x1d1fcd[_0x86d7('0x1e')]();};}function saveUpdates(_0x5506d1,_0x47de47){return function(_0x2d7165){if(_0x2d7165){return _0x2d7165[_0x86d7('0x1f')](_0x5506d1)['then'](function(_0x4328e2){return _0x4328e2;});}return null;};}function removeEntity(_0x4e0e67,_0x1e8811){return function(_0x30d3c6){if(_0x30d3c6){return _0x30d3c6['destroy']()['then'](function(){_0x4e0e67[_0x86d7('0x14')](0xcc)[_0x86d7('0x15')]();});}};}function handleEntityNotFound(_0x4c277a,_0x3134a8){return function(_0x1e8e00){if(!_0x1e8e00){_0x4c277a[_0x86d7('0x13')](0x194);}return _0x1e8e00;};}function handleError(_0x3beaf0,_0x8690a7){_0x8690a7=_0x8690a7||0x1f4;return function(_0x4a24e3){logger[_0x86d7('0x20')](_0x4a24e3['stack']);if(_0x4a24e3[_0x86d7('0x21')]){delete _0x4a24e3[_0x86d7('0x21')];}_0x3beaf0[_0x86d7('0x14')](_0x8690a7)[_0x86d7('0x22')](_0x4a24e3);};}exports[_0x86d7('0x23')]=function(_0x324ecb,_0x1b0c7b){var _0xf7e9cb={},_0x583b12={},_0x2109f5={'count':0x0,'rows':[]};var _0x349268=_['map'](db['JscriptySessionReport']['rawAttributes'],function(_0x503648){return{'name':_0x503648[_0x86d7('0x24')],'type':_0x503648['type']['key']};});_0x583b12['model']=_[_0x86d7('0x25')](_0x349268,_0x86d7('0x21'));_0x583b12[_0x86d7('0x26')]=_[_0x86d7('0x27')](_0x324ecb[_0x86d7('0x26')]);_0x583b12[_0x86d7('0x28')]=_[_0x86d7('0x29')](_0x583b12[_0x86d7('0x2a')],_0x583b12[_0x86d7('0x26')]);_0xf7e9cb[_0x86d7('0x2b')]=_['intersection'](_0x583b12[_0x86d7('0x2a')],qs[_0x86d7('0x2c')](_0x324ecb[_0x86d7('0x26')]['fields']));_0xf7e9cb[_0x86d7('0x2b')]=_0xf7e9cb[_0x86d7('0x2b')][_0x86d7('0x2d')]?_0xf7e9cb[_0x86d7('0x2b')]:_0x583b12[_0x86d7('0x2a')];if(!_0x324ecb[_0x86d7('0x26')][_0x86d7('0x2e')]('nolimit')){_0xf7e9cb['limit']=qs[_0x86d7('0x18')](_0x324ecb[_0x86d7('0x26')][_0x86d7('0x18')]);_0xf7e9cb[_0x86d7('0x16')]=qs[_0x86d7('0x16')](_0x324ecb[_0x86d7('0x26')][_0x86d7('0x16')]);}_0xf7e9cb[_0x86d7('0x2f')]=qs[_0x86d7('0x30')](_0x324ecb[_0x86d7('0x26')][_0x86d7('0x30')]);_0xf7e9cb[_0x86d7('0x31')]=qs[_0x86d7('0x28')](_['pick'](_0x324ecb[_0x86d7('0x26')],_0x583b12[_0x86d7('0x28')]),_0x349268);if(_0x324ecb[_0x86d7('0x26')][_0x86d7('0x32')]){_0xf7e9cb[_0x86d7('0x31')]=_[_0x86d7('0x33')](_0xf7e9cb[_0x86d7('0x31')],{'$or':_[_0x86d7('0x25')](_0x349268,function(_0x50a36b){if(_0x50a36b[_0x86d7('0x34')]!==_0x86d7('0x35')){var _0x22b2e5={};_0x22b2e5[_0x50a36b['name']]={'$like':'%'+_0x324ecb[_0x86d7('0x26')][_0x86d7('0x32')]+'%'};return _0x22b2e5;}})});}_0xf7e9cb=_['merge']({},_0xf7e9cb,_0x324ecb[_0x86d7('0x36')]);var _0x518052={'where':_0xf7e9cb[_0x86d7('0x31')]};return db['JscriptySessionReport'][_0x86d7('0x19')](_0x518052)[_0x86d7('0x37')](function(_0x3d240c){_0x2109f5[_0x86d7('0x19')]=_0x3d240c;if(_0x324ecb[_0x86d7('0x26')][_0x86d7('0x38')]){_0xf7e9cb['include']=[{'all':!![]}];}return db[_0x86d7('0x39')][_0x86d7('0x3a')](_0xf7e9cb);})[_0x86d7('0x37')](function(_0x32d502){_0x2109f5[_0x86d7('0x3b')]=_0x32d502;return _0x2109f5;})[_0x86d7('0x37')](respondWithFilteredResult(_0x1b0c7b,_0xf7e9cb))['catch'](handleError(_0x1b0c7b,null));};exports['show']=function(_0x20bcab,_0x344dbe){var _0x278c8b={'raw':!![],'where':{'id':_0x20bcab[_0x86d7('0x3c')]['id']}},_0x483b61={};_0x483b61[_0x86d7('0x2a')]=_[_0x86d7('0x27')](db[_0x86d7('0x39')]['rawAttributes']);_0x483b61[_0x86d7('0x26')]=_['keys'](_0x20bcab[_0x86d7('0x26')]);_0x483b61[_0x86d7('0x28')]=_['intersection'](_0x483b61[_0x86d7('0x2a')],_0x483b61['query']);_0x278c8b[_0x86d7('0x2b')]=_[_0x86d7('0x29')](_0x483b61[_0x86d7('0x2a')],qs[_0x86d7('0x2c')](_0x20bcab[_0x86d7('0x26')][_0x86d7('0x2c')]));_0x278c8b[_0x86d7('0x2b')]=_0x278c8b[_0x86d7('0x2b')][_0x86d7('0x2d')]?_0x278c8b[_0x86d7('0x2b')]:_0x483b61[_0x86d7('0x2a')];if(_0x20bcab['query'][_0x86d7('0x38')]){_0x278c8b['include']=[{'all':!![]}];}_0x278c8b=_[_0x86d7('0x33')]({},_0x278c8b,_0x20bcab[_0x86d7('0x36')]);return db[_0x86d7('0x39')][_0x86d7('0x3d')](_0x278c8b)[_0x86d7('0x37')](handleEntityNotFound(_0x344dbe,null))[_0x86d7('0x37')](respondWithResult(_0x344dbe,null))[_0x86d7('0x3e')](handleError(_0x344dbe,null));};exports[_0x86d7('0x3f')]=function(_0xab3c87,_0x5a2eab){return db['JscriptySessionReport']['create'](_0xab3c87[_0x86d7('0x40')],{})[_0x86d7('0x37')](respondWithResult(_0x5a2eab,0xc9))['catch'](handleError(_0x5a2eab,null));};exports[_0x86d7('0x1f')]=function(_0x1d2493,_0x348df2){if(_0x1d2493['body']['id']){delete _0x1d2493[_0x86d7('0x40')]['id'];}return db['JscriptySessionReport'][_0x86d7('0x3d')]({'where':{'id':_0x1d2493[_0x86d7('0x3c')]['id']}})['then'](handleEntityNotFound(_0x348df2,null))[_0x86d7('0x37')](saveUpdates(_0x1d2493[_0x86d7('0x40')],null))['then'](respondWithResult(_0x348df2,null))['catch'](handleError(_0x348df2,null));};exports[_0x86d7('0x41')]=function(_0x58fd7b,_0x3fbf45){return db[_0x86d7('0x39')][_0x86d7('0x3d')]({'where':{'id':_0x58fd7b[_0x86d7('0x3c')]['id']}})[_0x86d7('0x37')](handleEntityNotFound(_0x3fbf45,null))[_0x86d7('0x37')](removeEntity(_0x3fbf45,null))[_0x86d7('0x3e')](handleError(_0x3fbf45,null));};exports[_0x86d7('0x42')]=function(_0xb3bd5a,_0x1e73da){return db[_0x86d7('0x39')]['describe']()[_0x86d7('0x37')](respondWithResult(_0x1e73da,null))['catch'](handleError(_0x1e73da,null));};exports[_0x86d7('0x43')]=function(_0x753cc,_0x592636,_0x140167){var _0x317a0a={'raw':!![],'where':{}};var _0x48b7a0={};var _0x2af4c7={'count':0x0,'rows':[]};return db[_0x86d7('0x39')][_0x86d7('0x44')]({'where':{'id':_0x753cc[_0x86d7('0x3c')]['id']}})[_0x86d7('0x37')](handleEntityNotFound(_0x592636,null))[_0x86d7('0x37')](function(_0x583c03){if(_0x583c03){_0x48b7a0[_0x86d7('0x2a')]=_['keys'](db[_0x86d7('0x45')][_0x86d7('0x46')]);_0x48b7a0[_0x86d7('0x26')]=_[_0x86d7('0x27')](_0x753cc[_0x86d7('0x26')]);_0x48b7a0[_0x86d7('0x28')]=_[_0x86d7('0x29')](_0x48b7a0['model'],_0x48b7a0[_0x86d7('0x26')]);_0x317a0a[_0x86d7('0x2b')]=_[_0x86d7('0x29')](_0x48b7a0['model'],qs[_0x86d7('0x2c')](_0x753cc[_0x86d7('0x26')][_0x86d7('0x2c')]));_0x317a0a[_0x86d7('0x2b')]=_0x317a0a['attributes']['length']?_0x317a0a[_0x86d7('0x2b')]:_0x48b7a0['model'];if(!_0x753cc['query']['hasOwnProperty'](_0x86d7('0x47'))){_0x317a0a[_0x86d7('0x18')]=qs[_0x86d7('0x18')](_0x753cc[_0x86d7('0x26')]['limit']);_0x317a0a[_0x86d7('0x16')]=qs[_0x86d7('0x16')](_0x753cc[_0x86d7('0x26')][_0x86d7('0x16')]);}_0x317a0a['order']=qs[_0x86d7('0x30')](_0x753cc[_0x86d7('0x26')][_0x86d7('0x30')]);_0x317a0a['where']=qs[_0x86d7('0x28')](_[_0x86d7('0x48')](_0x753cc[_0x86d7('0x26')],_0x48b7a0[_0x86d7('0x28')]));_0x317a0a['where']['SessionId']=_0x583c03['id'];if(_0x753cc[_0x86d7('0x26')][_0x86d7('0x32')]){_0x317a0a[_0x86d7('0x31')]=_['merge'](_0x317a0a['where'],{'$or':_[_0x86d7('0x25')](_0x317a0a[_0x86d7('0x2b')],function(_0x8524ba){var _0x1074a8={};_0x1074a8[_0x8524ba]={'$like':'%'+_0x753cc[_0x86d7('0x26')][_0x86d7('0x32')]+'%'};return _0x1074a8;})});}_0x317a0a=_[_0x86d7('0x33')]({},_0x317a0a,_0x753cc[_0x86d7('0x36')]);return db[_0x86d7('0x45')][_0x86d7('0x19')]({'where':_0x317a0a[_0x86d7('0x31')]})[_0x86d7('0x37')](function(_0x4e7ecb){_0x2af4c7[_0x86d7('0x19')]=_0x4e7ecb;if(_0x753cc['query'][_0x86d7('0x38')]){_0x317a0a['include']=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x317a0a);})['then'](function(_0x255e96){_0x2af4c7[_0x86d7('0x3b')]=_0x255e96;return _0x2af4c7;});}})[_0x86d7('0x37')](respondWithFilteredResult(_0x592636,_0x317a0a))[_0x86d7('0x3e')](handleError(_0x592636,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index ac2ac09..4e9a1de 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 _0xc7a3=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','JscriptySessionReport','util'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xc7a3,0xbd));var _0x3c7a=function(_0x290358,_0x38c9b8){_0x290358=_0x290358-0x0;var _0x10641c=_0xc7a3[_0x290358];return _0x10641c;};'use strict';var _=require('lodash');var util=require(_0x3c7a('0x0'));var logger=require(_0x3c7a('0x1'))(_0x3c7a('0x2'));var moment=require(_0x3c7a('0x3'));var BPromise=require(_0x3c7a('0x4'));var rp=require(_0x3c7a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3c7a('0x6'));var config=require(_0x3c7a('0x7'));var attributes=require('./jscriptySessionReport.attributes');module[_0x3c7a('0x8')]=function(_0x2051ce,_0x2736c1){return _0x2051ce['define'](_0x3c7a('0x9'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed1c=['exports','JscriptySessionReport','report_jscripty_sessions','lodash','util','request-promise','path','rimraf','./jscriptySessionReport.attributes'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xed1c,0xe4));var _0xced1=function(_0x59612b,_0x182e66){_0x59612b=_0x59612b-0x0;var _0x26b911=_0xed1c[_0x59612b];return _0x26b911;};'use strict';var _=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xced1('0x2'));var fs=require('fs');var path=require(_0xced1('0x3'));var rimraf=require(_0xced1('0x4'));var config=require('../../config/environment');var attributes=require(_0xced1('0x5'));module[_0xced1('0x6')]=function(_0x466657,_0x37b22b){return _0x466657['define'](_0xced1('0x7'),attributes,{'tableName':_0xced1('0x8'),'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 c737c50..c8283d0 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 _0x6343=['message','result','catch','moment','bluebird','../../config/logger','rpc','jayson/promise','client','request','then','info','JscriptySessionReport,\x20%s,\x20%s','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x3b936a,_0x1961be){var _0x594d1e=function(_0x5f09ec){while(--_0x5f09ec){_0x3b936a['push'](_0x3b936a['shift']());}};_0x594d1e(++_0x1961be);}(_0x6343,0x168));var _0x3634=function(_0x4914a6,_0x2ec46a){_0x4914a6=_0x4914a6-0x0;var _0x51163b=_0x6343[_0x4914a6];return _0x51163b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3634('0x0'));var BPromise=require(_0x3634('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3634('0x2'))(_0x3634('0x3'));var config=require('../../config/environment');var jayson=require(_0x3634('0x4'));var client=jayson[_0x3634('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x302828,_0xd40513,_0x4e6d71){return new BPromise(function(_0x5affba,_0x19170a){return client[_0x3634('0x6')](_0x302828,_0x4e6d71)[_0x3634('0x7')](function(_0x3c813b){logger[_0x3634('0x8')](_0x3634('0x9'),_0xd40513,'request\x20sent');logger['debug'](_0x3634('0xa'),_0xd40513,_0x3634('0xb'),JSON['stringify'](_0x3c813b));if(_0x3c813b[_0x3634('0xc')]){if(_0x3c813b[_0x3634('0xc')][_0x3634('0xd')]===0x1f4){logger[_0x3634('0xc')](_0x3634('0x9'),_0xd40513,_0x3c813b[_0x3634('0xc')][_0x3634('0xe')]);return _0x19170a(_0x3c813b[_0x3634('0xc')][_0x3634('0xe')]);}logger[_0x3634('0xc')](_0x3634('0x9'),_0xd40513,_0x3c813b[_0x3634('0xc')][_0x3634('0xe')]);return _0x5affba(_0x3c813b[_0x3634('0xc')]['message']);}else{logger[_0x3634('0x8')]('JscriptySessionReport,\x20%s,\x20%s',_0xd40513,_0x3634('0xb'));_0x5affba(_0x3c813b[_0x3634('0xf')][_0x3634('0xe')]);}})[_0x3634('0x10')](function(_0x91061e){logger['error'](_0x3634('0x9'),_0xd40513,_0x91061e);_0x19170a(_0x91061e);});});} \ No newline at end of file +var _0x82c4=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x45c48f,_0x4aa891){var _0xaf5037=function(_0x3e3c1f){while(--_0x3e3c1f){_0x45c48f['push'](_0x45c48f['shift']());}};_0xaf5037(++_0x4aa891);}(_0x82c4,0x1ca));var _0x482c=function(_0x46a00a,_0x1ebb84){_0x46a00a=_0x46a00a-0x0;var _0x2fc495=_0x82c4[_0x46a00a];return _0x2fc495;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var moment=require(_0x482c('0x2'));var BPromise=require(_0x482c('0x3'));var rs=require(_0x482c('0x4'));var fs=require('fs');var Redis=require(_0x482c('0x5'));var db=require(_0x482c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x482c('0x7'))('rpc');var config=require(_0x482c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x482c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfdb92,_0x32a503,_0x35cdab){return new BPromise(function(_0x1c10f2,_0x3846d8){return client['request'](_0xfdb92,_0x35cdab)[_0x482c('0xa')](function(_0x135cc1){logger[_0x482c('0xb')](_0x482c('0xc'),_0x32a503,_0x482c('0xd'));logger[_0x482c('0xe')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x32a503,_0x482c('0xd'),JSON[_0x482c('0xf')](_0x135cc1));if(_0x135cc1[_0x482c('0x10')]){if(_0x135cc1['error'][_0x482c('0x11')]===0x1f4){logger[_0x482c('0x10')](_0x482c('0xc'),_0x32a503,_0x135cc1['error']['message']);return _0x3846d8(_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x32a503,_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);return _0x1c10f2(_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);}else{logger[_0x482c('0xb')](_0x482c('0xc'),_0x32a503,_0x482c('0xd'));_0x1c10f2(_0x135cc1[_0x482c('0x13')][_0x482c('0x12')]);}})[_0x482c('0x14')](function(_0x363403){logger[_0x482c('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x32a503,_0x363403);_0x3846d8(_0x363403);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 40fd54f..9033dea 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 _0x61a5=['multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','put','/:id','isAuthenticated','update','exports'];(function(_0x4c6e44,_0x5067b5){var _0x4a9239=function(_0xa4b260){while(--_0xa4b260){_0x4c6e44['push'](_0x4c6e44['shift']());}};_0x4a9239(++_0x5067b5);}(_0x61a5,0xf0));var _0x561a=function(_0x1d006a,_0x2812b5){_0x1d006a=_0x1d006a-0x0;var _0x20a76b=_0x61a5[_0x1d006a];return _0x20a76b;};'use strict';var multer=require(_0x561a('0x0'));var util=require('util');var path=require(_0x561a('0x1'));var timeout=require(_0x561a('0x2'));var express=require(_0x561a('0x3'));var router=express[_0x561a('0x4')]();var fs_extra=require(_0x561a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x561a('0x6'));var config=require(_0x561a('0x7'));var controller=require('./license.controller');router[_0x561a('0x8')]('/',controller[_0x561a('0x9')]);router[_0x561a('0xa')](_0x561a('0xb'),auth[_0x561a('0xc')](),controller[_0x561a('0xd')]);module[_0x561a('0xe')]=router; \ No newline at end of file +var _0x3379=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./license.controller','get','index','put','isAuthenticated','exports','multer','util','path'];(function(_0x4d72b3,_0x208e41){var _0x1a8777=function(_0x59a54b){while(--_0x59a54b){_0x4d72b3['push'](_0x4d72b3['shift']());}};_0x1a8777(++_0x208e41);}(_0x3379,0x115));var _0x9337=function(_0x31fc9e,_0xabf90d){_0x31fc9e=_0x31fc9e-0x0;var _0x7f9da=_0x3379[_0x31fc9e];return _0x7f9da;};'use strict';var multer=require(_0x9337('0x0'));var util=require(_0x9337('0x1'));var path=require(_0x9337('0x2'));var timeout=require(_0x9337('0x3'));var express=require('express');var router=express[_0x9337('0x4')]();var fs_extra=require(_0x9337('0x5'));var auth=require(_0x9337('0x6'));var interaction=require(_0x9337('0x7'));var config=require('../../config/environment');var controller=require(_0x9337('0x8'));router[_0x9337('0x9')]('/',controller[_0x9337('0xa')]);router[_0x9337('0xb')]('/:id',auth[_0x9337('0xc')](),controller['update']);module[_0x9337('0xd')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 1ba8349..f50f6db 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 _0x6d60=['INTEGER','exports','TEXT','STRING'];(function(_0x36c6eb,_0x4fb127){var _0x30675b=function(_0x3a788b){while(--_0x3a788b){_0x36c6eb['push'](_0x36c6eb['shift']());}};_0x30675b(++_0x4fb127);}(_0x6d60,0x199));var _0x06d6=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x6d60[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require('sequelize');module[_0x06d6('0x0')]={'license':{'type':Sequelize[_0x06d6('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x06d6('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x06d6('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xeb52=['sequelize','TEXT','STRING','INTEGER'];(function(_0x498dec,_0x305f99){var _0x1abe55=function(_0x5d7b04){while(--_0x5d7b04){_0x498dec['push'](_0x498dec['shift']());}};_0x1abe55(++_0x305f99);}(_0xeb52,0x1ac));var _0x2eb5=function(_0x59ca5c,_0x3cc98d){_0x59ca5c=_0x59ca5c-0x0;var _0x59a251=_0xeb52[_0x59ca5c];return _0x59a251;};'use strict';var Sequelize=require(_0x2eb5('0x0'));module['exports']={'license':{'type':Sequelize[_0x2eb5('0x1')]},'data1':{'type':Sequelize[_0x2eb5('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x2eb5('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index b6cb5c0..3c6e1ca 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 _0xc4aa=['zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','model','keys','License','query','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','body','find','params','get','checkLicense','key','demo','eml-format','rimraf'];(function(_0x28a5ad,_0x520afa){var _0x176b8a=function(_0x3d71b){while(--_0x3d71b){_0x28a5ad['push'](_0x28a5ad['shift']());}};_0x176b8a(++_0x520afa);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xc4aa[_0xa148b7];return _0x51efd3;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];function respondWithStatusCode(_0x24291d,_0x5e16aa){_0x5e16aa=_0x5e16aa||0xcc;return function(_0x21a79){if(_0x21a79){return _0x24291d[_0xac4a('0x17')](_0x5e16aa);}return _0x24291d[_0xac4a('0x18')](_0x5e16aa)[_0xac4a('0x19')]();};}function respondWithResult(_0x1b4313,_0x3b71c0){_0x3b71c0=_0x3b71c0||0xc8;return function(_0x34bc01){if(_0x34bc01){return _0x1b4313[_0xac4a('0x18')](_0x3b71c0)[_0xac4a('0x1a')](_0x34bc01);}};}function respondWithFilteredResult(_0x42c7fc,_0x11e101){return function(_0x26dbb8){if(_0x26dbb8){var _0x4a2119=typeof _0x11e101[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x11e101[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x3e88e3=_0x26dbb8[_0xac4a('0x1e')];var _0x28e304=_0x4a2119?0x0:_0x11e101[_0xac4a('0x1b')];var _0x546c5d=_0x4a2119?_0x26dbb8['count']:_0x11e101[_0xac4a('0x1b')]+_0x11e101[_0xac4a('0x1d')];var _0x39b691;if(_0x546c5d>=_0x3e88e3){_0x546c5d=_0x3e88e3;_0x39b691=0xc8;}else{_0x39b691=0xce;}_0x42c7fc['status'](_0x39b691);return _0x42c7fc[_0xac4a('0x1f')](_0xac4a('0x20'),_0x28e304+'-'+_0x546c5d+'/'+_0x3e88e3)[_0xac4a('0x1a')](_0x26dbb8);}return null;};}function patchUpdates(_0x3a3cdb){return function(_0x123694){try{jsonpatch[_0xac4a('0x21')](_0x123694,_0x3a3cdb,!![]);}catch(_0xe38996){return BPromise[_0xac4a('0x22')](_0xe38996);}return _0x123694['save']();};}function saveUpdates(_0x3d8f0a,_0x3204ad){return function(_0x599787){if(_0x599787){return _0x599787[_0xac4a('0x23')](_0x3d8f0a)[_0xac4a('0x24')](function(_0x3eacd3){return _0x3eacd3;});}return null;};}function removeEntity(_0x947d8e,_0x4d2d6c){return function(_0x1b7998){if(_0x1b7998){return _0x1b7998[_0xac4a('0x25')]()[_0xac4a('0x24')](function(){_0x947d8e[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x2b0dc2,_0x222507){return function(_0x36054a){if(!_0x36054a){_0x2b0dc2[_0xac4a('0x17')](0x194);}return _0x36054a;};}function handleError(_0x3bc318,_0x1d0539){_0x1d0539=_0x1d0539||0x1f4;return function(_0x215a31){logger[_0xac4a('0x26')](_0x215a31[_0xac4a('0x27')]);if(_0x215a31[_0xac4a('0x28')]){delete _0x215a31[_0xac4a('0x28')];}_0x3bc318['status'](_0x1d0539)[_0xac4a('0x29')](_0x215a31);};}var utilLicense=require(_0xac4a('0x15'));exports[_0xac4a('0x2a')]=function(_0x2772fe,_0x116700){var _0x4a5a9e={'raw':!![],'where':{'id':0x1}},_0x47f49c={};_0x47f49c[_0xac4a('0x2b')]=_[_0xac4a('0x2c')](db[_0xac4a('0x2d')]['rawAttributes']);_0x47f49c['query']=_[_0xac4a('0x2c')](_0x2772fe[_0xac4a('0x2e')]);_0x47f49c[_0xac4a('0x2f')]=_[_0xac4a('0x30')](_0x47f49c[_0xac4a('0x2b')],_0x47f49c['query']);_0x4a5a9e[_0xac4a('0x31')]=_['intersection'](_0x47f49c[_0xac4a('0x2b')],qs['fields'](_0x2772fe[_0xac4a('0x2e')][_0xac4a('0x32')]));_0x4a5a9e[_0xac4a('0x31')]=_0x4a5a9e[_0xac4a('0x31')][_0xac4a('0x33')]?_0x4a5a9e[_0xac4a('0x31')]:_0x47f49c[_0xac4a('0x2b')];_0x4a5a9e=_[_0xac4a('0x34')]({},_0x4a5a9e,_0x2772fe[_0xac4a('0x35')]);return utilLicense[_0xac4a('0x36')](_0x4a5a9e)[_0xac4a('0x24')](respondWithResult(_0x116700,null))[_0xac4a('0x37')](handleError(_0x116700,null));};exports[_0xac4a('0x23')]=function(_0x1a9d4e,_0x5634e2){if(_0x1a9d4e[_0xac4a('0x38')]['id']){delete _0x1a9d4e[_0xac4a('0x38')]['id'];}return db['License'][_0xac4a('0x39')]({'where':{'id':_0x1a9d4e[_0xac4a('0x3a')]['id']}})['then'](handleEntityNotFound(_0x5634e2,null))['then'](function(_0x11f0be){var _0x1ba096=_0x11f0be[_0xac4a('0x3b')]({'plain':!![]});return utilLicense[_0xac4a('0x3c')](_0x1ba096,_0x1a9d4e['body'][_0xac4a('0x3d')]);})[_0xac4a('0x24')](function(_0x4e7630){if(!_0x4e7630[_0xac4a('0x3e')]){return saveUpdates(_0x1a9d4e[_0xac4a('0x38')],null);}return _0x4e7630;})[_0xac4a('0x24')](respondWithResult(_0x5634e2,null))['catch'](handleError(_0x5634e2,null));}; \ No newline at end of file +var _0xabce=['status','end','json','limit','count','offset','Content-Range','apply','reject','save','update','then','sendStatus','error','name','send','model','keys','License','rawAttributes','query','intersection','attributes','fields','merge','getLicense','catch','find','get','body','demo','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x356fc5,_0x1592c8){var _0x162c2d=function(_0x5c63a0){while(--_0x5c63a0){_0x356fc5['push'](_0x356fc5['shift']());}};_0x162c2d(++_0x1592c8);}(_0xabce,0x103));var _0xeabc=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xabce[_0x5b78e8];return _0xf2c321;};'use strict';var emlformat=require(_0xeabc('0x0'));var rimraf=require(_0xeabc('0x1'));var zipdir=require(_0xeabc('0x2'));var jsonpatch=require(_0xeabc('0x3'));var rp=require(_0xeabc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeabc('0x5'));var util=require(_0xeabc('0x6'));var path=require(_0xeabc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeabc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];function respondWithStatusCode(_0x3fd0b5,_0x36a92e){_0x36a92e=_0x36a92e||0xcc;return function(_0xcfbf06){if(_0xcfbf06){return _0x3fd0b5['sendStatus'](_0x36a92e);}return _0x3fd0b5[_0xeabc('0x1a')](_0x36a92e)[_0xeabc('0x1b')]();};}function respondWithResult(_0x3251c6,_0x55f0de){_0x55f0de=_0x55f0de||0xc8;return function(_0x5f4ee8){if(_0x5f4ee8){return _0x3251c6[_0xeabc('0x1a')](_0x55f0de)[_0xeabc('0x1c')](_0x5f4ee8);}};}function respondWithFilteredResult(_0x326bac,_0x53d5cb){return function(_0xf913d7){if(_0xf913d7){var _0x638976=typeof _0x53d5cb['offset']==='undefined'&&typeof _0x53d5cb[_0xeabc('0x1d')]==='undefined';var _0x3d0e21=_0xf913d7[_0xeabc('0x1e')];var _0x58a3c0=_0x638976?0x0:_0x53d5cb[_0xeabc('0x1f')];var _0x31dd53=_0x638976?_0xf913d7[_0xeabc('0x1e')]:_0x53d5cb[_0xeabc('0x1f')]+_0x53d5cb[_0xeabc('0x1d')];var _0x5d92e5;if(_0x31dd53>=_0x3d0e21){_0x31dd53=_0x3d0e21;_0x5d92e5=0xc8;}else{_0x5d92e5=0xce;}_0x326bac[_0xeabc('0x1a')](_0x5d92e5);return _0x326bac['set'](_0xeabc('0x20'),_0x58a3c0+'-'+_0x31dd53+'/'+_0x3d0e21)[_0xeabc('0x1c')](_0xf913d7);}return null;};}function patchUpdates(_0x502947){return function(_0x28063a){try{jsonpatch[_0xeabc('0x21')](_0x28063a,_0x502947,!![]);}catch(_0x254590){return BPromise[_0xeabc('0x22')](_0x254590);}return _0x28063a[_0xeabc('0x23')]();};}function saveUpdates(_0x4e99a4,_0xecdbf){return function(_0x10c675){if(_0x10c675){return _0x10c675[_0xeabc('0x24')](_0x4e99a4)['then'](function(_0x457f27){return _0x457f27;});}return null;};}function removeEntity(_0x3854d2,_0x214953){return function(_0x319119){if(_0x319119){return _0x319119['destroy']()[_0xeabc('0x25')](function(){_0x3854d2['status'](0xcc)[_0xeabc('0x1b')]();});}};}function handleEntityNotFound(_0x4d4e29,_0x811f0d){return function(_0x12acbd){if(!_0x12acbd){_0x4d4e29[_0xeabc('0x26')](0x194);}return _0x12acbd;};}function handleError(_0x3f194e,_0x3a1a04){_0x3a1a04=_0x3a1a04||0x1f4;return function(_0x137293){logger[_0xeabc('0x27')](_0x137293['stack']);if(_0x137293['name']){delete _0x137293[_0xeabc('0x28')];}_0x3f194e['status'](_0x3a1a04)[_0xeabc('0x29')](_0x137293);};}var utilLicense=require(_0xeabc('0x18'));exports['index']=function(_0x2163e6,_0x38572d){var _0x2b568f={'raw':!![],'where':{'id':0x1}},_0x2f8633={};_0x2f8633[_0xeabc('0x2a')]=_[_0xeabc('0x2b')](db[_0xeabc('0x2c')][_0xeabc('0x2d')]);_0x2f8633[_0xeabc('0x2e')]=_['keys'](_0x2163e6[_0xeabc('0x2e')]);_0x2f8633['filters']=_[_0xeabc('0x2f')](_0x2f8633[_0xeabc('0x2a')],_0x2f8633[_0xeabc('0x2e')]);_0x2b568f[_0xeabc('0x30')]=_[_0xeabc('0x2f')](_0x2f8633[_0xeabc('0x2a')],qs[_0xeabc('0x31')](_0x2163e6['query'][_0xeabc('0x31')]));_0x2b568f[_0xeabc('0x30')]=_0x2b568f[_0xeabc('0x30')]['length']?_0x2b568f[_0xeabc('0x30')]:_0x2f8633[_0xeabc('0x2a')];_0x2b568f=_[_0xeabc('0x32')]({},_0x2b568f,_0x2163e6['options']);return utilLicense[_0xeabc('0x33')](_0x2b568f)[_0xeabc('0x25')](respondWithResult(_0x38572d,null))[_0xeabc('0x34')](handleError(_0x38572d,null));};exports['update']=function(_0xf98c7c,_0x286203){if(_0xf98c7c['body']['id']){delete _0xf98c7c['body']['id'];}return db[_0xeabc('0x2c')][_0xeabc('0x35')]({'where':{'id':_0xf98c7c['params']['id']}})[_0xeabc('0x25')](handleEntityNotFound(_0x286203,null))[_0xeabc('0x25')](function(_0x3edee7){var _0x10434e=_0x3edee7[_0xeabc('0x36')]({'plain':!![]});return utilLicense['checkLicense'](_0x10434e,_0xf98c7c[_0xeabc('0x37')]['key']);})[_0xeabc('0x25')](function(_0x2bda29){if(!_0x2bda29[_0xeabc('0x38')]){return saveUpdates(_0xf98c7c['body'],null);}return _0x2bda29;})['then'](respondWithResult(_0x286203,null))[_0xeabc('0x34')](handleError(_0x286203,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 658b73f..e6e4fa6 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 _0xc489=['license','lodash','util','api','bluebird','request-promise','path','./license.attributes','exports','License'];(function(_0x2c1114,_0x2a5c50){var _0x2b877c=function(_0x4f356d){while(--_0x4f356d){_0x2c1114['push'](_0x2c1114['shift']());}};_0x2b877c(++_0x2a5c50);}(_0xc489,0x137));var _0x9c48=function(_0x1a24f3,_0x59a629){_0x1a24f3=_0x1a24f3-0x0;var _0x4edf11=_0xc489[_0x1a24f3];return _0x4edf11;};'use strict';var _=require(_0x9c48('0x0'));var util=require(_0x9c48('0x1'));var logger=require('../../config/logger')(_0x9c48('0x2'));var moment=require('moment');var BPromise=require(_0x9c48('0x3'));var rp=require(_0x9c48('0x4'));var fs=require('fs');var path=require(_0x9c48('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9c48('0x6'));module[_0x9c48('0x7')]=function(_0x24853f,_0x3492f1){return _0x24853f['define'](_0x9c48('0x8'),attributes,{'tableName':_0x9c48('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaff4=['util','../../config/logger','api','moment','bluebird','rimraf','./license.attributes','exports','define','License','license','lodash'];(function(_0x2f46bc,_0x3503de){var _0x3b8cd1=function(_0x500483){while(--_0x500483){_0x2f46bc['push'](_0x2f46bc['shift']());}};_0x3b8cd1(++_0x3503de);}(_0xaff4,0xbf));var _0x4aff=function(_0x142ec2,_0x5bb03d){_0x142ec2=_0x142ec2-0x0;var _0x45ef4e=_0xaff4[_0x142ec2];return _0x45ef4e;};'use strict';var _=require(_0x4aff('0x0'));var util=require(_0x4aff('0x1'));var logger=require(_0x4aff('0x2'))(_0x4aff('0x3'));var moment=require(_0x4aff('0x4'));var BPromise=require(_0x4aff('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4aff('0x6'));var config=require('../../config/environment');var attributes=require(_0x4aff('0x7'));module[_0x4aff('0x8')]=function(_0x4ca394,_0x6ef6b4){return _0x4ca394[_0x4aff('0x9')](_0x4aff('0xa'),attributes,{'tableName':_0x4aff('0xb'),'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 7adf14f..a14ea62 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 _0x75ee=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util','moment','randomstring'];(function(_0x7f4776,_0x3d3d05){var _0x188d22=function(_0x2e053b){while(--_0x2e053b){_0x7f4776['push'](_0x7f4776['shift']());}};_0x188d22(++_0x3d3d05);}(_0x75ee,0x179));var _0xe75e=function(_0x41b0a8,_0x1b05cc){_0x41b0a8=_0x41b0a8-0x0;var _0x3a83d4=_0x75ee[_0x41b0a8];return _0x3a83d4;};'use strict';var _=require('lodash');var util=require(_0xe75e('0x0'));var moment=require(_0xe75e('0x1'));var BPromise=require('bluebird');var rs=require(_0xe75e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe75e('0x3'))['db'];var utils=require(_0xe75e('0x4'));var logger=require(_0xe75e('0x5'))(_0xe75e('0x6'));var config=require(_0xe75e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe75e('0x8')][_0xe75e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16b65e,_0x285676,_0x2ace61){return new BPromise(function(_0xd2367d,_0xd12d49){return client[_0xe75e('0xa')](_0x16b65e,_0x2ace61)['then'](function(_0x1c5705){logger['info'](_0xe75e('0xb'),_0x285676,_0xe75e('0xc'));logger['debug'](_0xe75e('0xd'),_0x285676,_0xe75e('0xc'),JSON[_0xe75e('0xe')](_0x1c5705));if(_0x1c5705[_0xe75e('0xf')]){if(_0x1c5705[_0xe75e('0xf')]['code']===0x1f4){logger['error'](_0xe75e('0xb'),_0x285676,_0x1c5705[_0xe75e('0xf')]['message']);return _0xd12d49(_0x1c5705[_0xe75e('0xf')][_0xe75e('0x10')]);}logger[_0xe75e('0xf')](_0xe75e('0xb'),_0x285676,_0x1c5705[_0xe75e('0xf')][_0xe75e('0x10')]);return _0xd2367d(_0x1c5705[_0xe75e('0xf')][_0xe75e('0x10')]);}else{logger[_0xe75e('0x11')](_0xe75e('0xb'),_0x285676,'request\x20sent');_0xd2367d(_0x1c5705[_0xe75e('0x12')][_0xe75e('0x10')]);}})[_0xe75e('0x13')](function(_0x1320a7){logger[_0xe75e('0xf')](_0xe75e('0xb'),_0x285676,_0x1320a7);_0xd12d49(_0x1320a7);});});} \ No newline at end of file +var _0x6560=['debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','moment','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','License,\x20%s,\x20%s','request\x20sent'];(function(_0x11b34c,_0x3927d1){var _0x3fc1d3=function(_0x4dd148){while(--_0x4dd148){_0x11b34c['push'](_0x11b34c['shift']());}};_0x3fc1d3(++_0x3927d1);}(_0x6560,0x111));var _0x0656=function(_0xcdce8a,_0x10b639){_0xcdce8a=_0xcdce8a-0x0;var _0x79611f=_0x6560[_0xcdce8a];return _0x79611f;};'use strict';var _=require('lodash');var util=require(_0x0656('0x0'));var moment=require(_0x0656('0x1'));var BPromise=require(_0x0656('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0656('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0656('0x4'));var config=require(_0x0656('0x5'));var jayson=require(_0x0656('0x6'));var client=jayson[_0x0656('0x7')][_0x0656('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x261afe,_0x14311e,_0x48cd6a){return new BPromise(function(_0x37b11c,_0x278471){return client['request'](_0x261afe,_0x48cd6a)[_0x0656('0x9')](function(_0xa28d73){logger['info'](_0x0656('0xa'),_0x14311e,_0x0656('0xb'));logger[_0x0656('0xc')](_0x0656('0xd'),_0x14311e,_0x0656('0xb'),JSON[_0x0656('0xe')](_0xa28d73));if(_0xa28d73['error']){if(_0xa28d73[_0x0656('0xf')]['code']===0x1f4){logger[_0x0656('0xf')]('License,\x20%s,\x20%s',_0x14311e,_0xa28d73[_0x0656('0xf')][_0x0656('0x10')]);return _0x278471(_0xa28d73[_0x0656('0xf')]['message']);}logger[_0x0656('0xf')]('License,\x20%s,\x20%s',_0x14311e,_0xa28d73['error'][_0x0656('0x10')]);return _0x37b11c(_0xa28d73[_0x0656('0xf')][_0x0656('0x10')]);}else{logger[_0x0656('0x11')](_0x0656('0xa'),_0x14311e,'request\x20sent');_0x37b11c(_0xa28d73[_0x0656('0x12')][_0x0656('0x10')]);}})['catch'](function(_0x140240){logger[_0x0656('0xf')](_0x0656('0xa'),_0x14311e,_0x140240);_0x278471(_0x140240);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 05e11a5..7143fd3 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 _0xba98=['/:id/messages','getMessages','/:id/verify','post','addDisposition','addAnswer','create','addImap','addSmtp','/:id/interactions','addInteraction','addApplications','/:id/send','send','/:id','delete','/:id/dispositions','removeDispositions','removeAnswers','removeSmtp','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../config/environment','./mailAccount.controller','index','get','isAuthenticated','describe','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getInteractions','/:id/applications','getApplications'];(function(_0x47ba42,_0x6707a8){var _0x3084ba=function(_0x59d8bf){while(--_0x59d8bf){_0x47ba42['push'](_0x47ba42['shift']());}};_0x3084ba(++_0x6707a8);}(_0xba98,0x112));var _0x8ba9=function(_0x488fa5,_0x40fb32){_0x488fa5=_0x488fa5-0x0;var _0x2c72c2=_0xba98[_0x488fa5];return _0x2c72c2;};'use strict';var multer=require(_0x8ba9('0x0'));var util=require(_0x8ba9('0x1'));var path=require('path');var timeout=require(_0x8ba9('0x2'));var express=require('express');var router=express[_0x8ba9('0x3')]();var fs_extra=require(_0x8ba9('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8ba9('0x5'));var controller=require(_0x8ba9('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x8ba9('0x7')]);router[_0x8ba9('0x8')]('/describe',auth[_0x8ba9('0x9')](),controller[_0x8ba9('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['get']('/:id/dispositions',auth[_0x8ba9('0x9')](),controller[_0x8ba9('0xb')]);router[_0x8ba9('0x8')](_0x8ba9('0xc'),auth[_0x8ba9('0x9')](),controller[_0x8ba9('0xd')]);router[_0x8ba9('0x8')](_0x8ba9('0xe'),auth[_0x8ba9('0x9')](),controller[_0x8ba9('0xf')]);router['get'](_0x8ba9('0x10'),auth['isAuthenticated'](),controller['getSmtp']);router[_0x8ba9('0x8')]('/:id/interactions',auth[_0x8ba9('0x9')](),controller[_0x8ba9('0x11')]);router[_0x8ba9('0x8')](_0x8ba9('0x12'),auth[_0x8ba9('0x9')](),controller[_0x8ba9('0x13')]);router['get'](_0x8ba9('0x14'),auth['isAuthenticated'](),controller[_0x8ba9('0x15')]);router[_0x8ba9('0x8')](_0x8ba9('0x16'),auth['isAuthenticated'](),controller['verifySmtp']);router[_0x8ba9('0x8')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x8ba9('0x17')]('/:id/dispositions',auth[_0x8ba9('0x9')](),controller[_0x8ba9('0x18')]);router[_0x8ba9('0x17')](_0x8ba9('0xc'),auth[_0x8ba9('0x9')](),controller[_0x8ba9('0x19')]);router[_0x8ba9('0x17')]('/',auth[_0x8ba9('0x9')](),controller[_0x8ba9('0x1a')]);router[_0x8ba9('0x17')]('/:id/in_servers',auth[_0x8ba9('0x9')](),controller[_0x8ba9('0x1b')]);router['post'](_0x8ba9('0x10'),auth[_0x8ba9('0x9')](),controller[_0x8ba9('0x1c')]);router[_0x8ba9('0x17')](_0x8ba9('0x1d'),auth['isAuthenticated'](),controller[_0x8ba9('0x1e')]);router[_0x8ba9('0x17')](_0x8ba9('0x12'),auth['isAuthenticated'](),controller[_0x8ba9('0x1f')]);router[_0x8ba9('0x17')](_0x8ba9('0x20'),auth[_0x8ba9('0x9')](),controller[_0x8ba9('0x21')]);router[_0x8ba9('0x17')]('/:id/users',auth[_0x8ba9('0x9')](),controller['addAgents']);router['put'](_0x8ba9('0x22'),auth[_0x8ba9('0x9')](),controller['update']);router[_0x8ba9('0x23')](_0x8ba9('0x24'),auth[_0x8ba9('0x9')](),controller[_0x8ba9('0x25')]);router['delete']('/:id/canned_answers',auth[_0x8ba9('0x9')](),controller[_0x8ba9('0x26')]);router[_0x8ba9('0x23')](_0x8ba9('0xe'),auth[_0x8ba9('0x9')](),controller['removeImap']);router[_0x8ba9('0x23')](_0x8ba9('0x10'),auth[_0x8ba9('0x9')](),controller[_0x8ba9('0x27')]);router[_0x8ba9('0x23')](_0x8ba9('0x22'),auth['isAuthenticated'](),controller[_0x8ba9('0x28')]);router[_0x8ba9('0x23')]('/:id/users',auth[_0x8ba9('0x9')](),controller['removeAgents']);module[_0x8ba9('0x29')]=router; \ No newline at end of file +var _0xdd41=['/:id/users','getAgents','addDisposition','addAnswer','post','create','/:id/in_servers','addImap','/:id/out_servers','addInteraction','addApplications','send','addAgents','/:id','update','removeDispositions','delete','removeImap','removeSmtp','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id/dispositions','/:id/canned_answers','getAnswers','getImap','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','verifySmtp'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xdd41,0x142));var _0x1dd4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd41[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1dd4('0x0'));var util=require(_0x1dd4('0x1'));var path=require('path');var timeout=require(_0x1dd4('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1dd4('0x3'));var auth=require(_0x1dd4('0x4'));var interaction=require(_0x1dd4('0x5'));var config=require(_0x1dd4('0x6'));var controller=require('./mailAccount.controller');router['get']('/',auth[_0x1dd4('0x7')](),controller['index']);router[_0x1dd4('0x8')](_0x1dd4('0x9'),auth[_0x1dd4('0x7')](),controller[_0x1dd4('0xa')]);router[_0x1dd4('0x8')]('/:id',auth[_0x1dd4('0x7')](),controller['show']);router['get'](_0x1dd4('0xb'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x1dd4('0x8')](_0x1dd4('0xc'),auth[_0x1dd4('0x7')](),controller[_0x1dd4('0xd')]);router['get']('/:id/in_servers',auth[_0x1dd4('0x7')](),controller[_0x1dd4('0xe')]);router[_0x1dd4('0x8')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0x1dd4('0xf')]);router[_0x1dd4('0x8')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x1dd4('0x10')]);router['get'](_0x1dd4('0x11'),auth[_0x1dd4('0x7')](),controller[_0x1dd4('0x12')]);router[_0x1dd4('0x8')](_0x1dd4('0x13'),auth[_0x1dd4('0x7')](),controller[_0x1dd4('0x14')]);router['get']('/:id/verify',auth[_0x1dd4('0x7')](),controller[_0x1dd4('0x15')]);router[_0x1dd4('0x8')](_0x1dd4('0x16'),auth[_0x1dd4('0x7')](),controller[_0x1dd4('0x17')]);router['post'](_0x1dd4('0xb'),auth[_0x1dd4('0x7')](),controller[_0x1dd4('0x18')]);router['post'](_0x1dd4('0xc'),auth[_0x1dd4('0x7')](),controller[_0x1dd4('0x19')]);router[_0x1dd4('0x1a')]('/',auth[_0x1dd4('0x7')](),controller[_0x1dd4('0x1b')]);router['post'](_0x1dd4('0x1c'),auth['isAuthenticated'](),controller[_0x1dd4('0x1d')]);router[_0x1dd4('0x1a')](_0x1dd4('0x1e'),auth[_0x1dd4('0x7')](),controller['addSmtp']);router[_0x1dd4('0x1a')]('/:id/interactions',auth[_0x1dd4('0x7')](),controller[_0x1dd4('0x1f')]);router['post'](_0x1dd4('0x11'),auth['isAuthenticated'](),controller[_0x1dd4('0x20')]);router['post']('/:id/send',auth[_0x1dd4('0x7')](),controller[_0x1dd4('0x21')]);router['post']('/:id/users',auth[_0x1dd4('0x7')](),controller[_0x1dd4('0x22')]);router['put'](_0x1dd4('0x23'),auth[_0x1dd4('0x7')](),controller[_0x1dd4('0x24')]);router['delete']('/:id/dispositions',auth[_0x1dd4('0x7')](),controller[_0x1dd4('0x25')]);router[_0x1dd4('0x26')](_0x1dd4('0xc'),auth[_0x1dd4('0x7')](),controller['removeAnswers']);router['delete'](_0x1dd4('0x1c'),auth['isAuthenticated'](),controller[_0x1dd4('0x27')]);router[_0x1dd4('0x26')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0x1dd4('0x28')]);router[_0x1dd4('0x26')](_0x1dd4('0x23'),auth[_0x1dd4('0x7')](),controller[_0x1dd4('0x29')]);router[_0x1dd4('0x26')](_0x1dd4('0x16'),auth[_0x1dd4('0x7')](),controller['removeAgents']);module[_0x1dd4('0x2a')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index a6afcdd..8ff0f47 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 _0x80d9=['TEXT','UNSIGNED','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','BOOLEAN'];(function(_0x40fe55,_0x58f2bd){var _0x7ae83b=function(_0x5738f5){while(--_0x5738f5){_0x40fe55['push'](_0x40fe55['shift']());}};_0x7ae83b(++_0x58f2bd);}(_0x80d9,0x15c));var _0x980d=function(_0x35dc99,_0x32be63){_0x35dc99=_0x35dc99-0x0;var _0x47fca8=_0x80d9[_0x35dc99];return _0x47fca8;};'use strict';var Sequelize=require(_0x980d('0x0'));module['exports']={'description':{'type':Sequelize[_0x980d('0x1')]},'name':{'type':Sequelize[_0x980d('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x980d('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x980d('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x980d('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x980d('0x3')]},'markAsUnread':{'type':Sequelize[_0x980d('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x980d('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x980d('0x4')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x980d('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x980d('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x980d('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x980d('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x980d('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x980d('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x980d('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x980d('0x6'),'set':function(_0x10872c){if(!_0x10872c)this['setDataValue'](_0x980d('0x7'),null);this['setDataValue'](_0x980d('0x8'),_0x10872c);}}}; \ No newline at end of file +var _0xaa19=['sequelize','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xaa19,0x79));var _0x9aa1=function(_0x4dcfaf,_0x237d19){_0x4dcfaf=_0x4dcfaf-0x0;var _0x42b5a4=_0xaa19[_0x4dcfaf];return _0x42b5a4;};'use strict';var Sequelize=require(_0x9aa1('0x0'));module[_0x9aa1('0x1')]={'description':{'type':Sequelize[_0x9aa1('0x2')]},'name':{'type':Sequelize[_0x9aa1('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x9aa1('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x9aa1('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x9aa1('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x9aa1('0x2')],'allowNull':![],'defaultValue':_0x9aa1('0x4')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x9aa1('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x9aa1('0x6')],'defaultValue':function(){return _0x9aa1('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9aa1('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9aa1('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9aa1('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9aa1('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9aa1('0x8')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x9aa1('0x9'),'set':function(_0x4ffdcc){if(!_0x4ffdcc)this[_0x9aa1('0xa')]('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x4ffdcc);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 0830968..8d66ded 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 _0xdafa=['service','cuser','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','CmContact','Contact','Owner','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','stack','finally','send','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','split','CmList','List','updatedAt','from','attachments','join','server/files/attachments','basename','auth','secure','SendMail','List\x20not\x20found','Contacts','messageId','subject','attach','out','Interaction','Messages','VerifySmtp','verifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','User','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','html-to-text','juice','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','get','MailAccounts','UserProfileResource','name','index','Imap','MailServerOut','Smtp','mandatoryDispositionPause','rawAttributes','fieldName','type','key','model','map','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','params','MailServerIn','Pause','MailAccount','find','body','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','findAll','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','email','ListId','isNil','description','cservice','user','password','pass','cpassword','authentication','host','port'];(function(_0x1d944d,_0x3b17a3){var _0x228a42=function(_0x490c52){while(--_0x490c52){_0x1d944d['push'](_0x1d944d['shift']());}};_0x228a42(++_0x3b17a3);}(_0xdafa,0x113));var _0xadaf=function(_0x322cd7,_0x158cad){_0x322cd7=_0x322cd7-0x0;var _0x16d5e1=_0xdafa[_0x322cd7];return _0x16d5e1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xadaf('0x0'));var zipdir=require(_0xadaf('0x1'));var jsonpatch=require(_0xadaf('0x2'));var rp=require('request-promise');var moment=require(_0xadaf('0x3'));var BPromise=require(_0xadaf('0x4'));var Mustache=require(_0xadaf('0x5'));var util=require(_0xadaf('0x6'));var path=require(_0xadaf('0x7'));var sox=require(_0xadaf('0x8'));var csv=require(_0xadaf('0x9'));var ejs=require(_0xadaf('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xadaf('0xb'));var squel=require(_0xadaf('0xc'));var crypto=require(_0xadaf('0xd'));var jsforce=require(_0xadaf('0xe'));var deskjs=require(_0xadaf('0xf'));var toCsv=require(_0xadaf('0x9'));var querystring=require('querystring');var Papa=require(_0xadaf('0x10'));var htmlToText=require(_0xadaf('0x11'));var juice=require(_0xadaf('0x12'));var Redis=require(_0xadaf('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xadaf('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xadaf('0x15'));var logger=require(_0xadaf('0x16'))(_0xadaf('0x17'));var utils=require('../../config/utils');var config=require(_0xadaf('0x18'));var licenseUtil=require(_0xadaf('0x19'));var db=require(_0xadaf('0x1a'))['db'];config[_0xadaf('0x1b')]=_[_0xadaf('0x1c')](config[_0xadaf('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xadaf('0x1d'))(new Redis(config[_0xadaf('0x1b')]));require('./mailAccount.socket')[_0xadaf('0x1e')](socket);var jayson=require(_0xadaf('0x1f'));var client=jayson[_0xadaf('0x20')]['http']({'port':0x232b});function respondWithRpcPromise(_0x3dbcdc,_0xf7112d,_0x533f6f,_0x53a0b5){return new BPromise(function(_0x6c857b,_0xbda776){var _0x29367c=_0x53a0b5||client;return _0x29367c[_0xadaf('0x21')](_0x3dbcdc,_0x533f6f)[_0xadaf('0x22')](function(_0x435358){logger[_0xadaf('0x23')](_0xadaf('0x24'),_0xf7112d,_0xadaf('0x25'));logger[_0xadaf('0x26')](_0xadaf('0x27'),_0xf7112d,_0xadaf('0x25'),JSON['stringify'](_0x435358));if(_0x435358[_0xadaf('0x28')]){if(_0x435358['error'][_0xadaf('0x29')]===0x1f4){logger[_0xadaf('0x28')]('MailAccount,\x20%s,\x20%s',_0xf7112d,_0x435358[_0xadaf('0x28')][_0xadaf('0x2a')]);return _0xbda776(_0x435358[_0xadaf('0x28')][_0xadaf('0x2a')]);}logger[_0xadaf('0x28')](_0xadaf('0x24'),_0xf7112d,_0x435358[_0xadaf('0x28')][_0xadaf('0x2a')]);return _0x6c857b(_0x435358[_0xadaf('0x28')][_0xadaf('0x2a')]);}else{logger[_0xadaf('0x23')](_0xadaf('0x24'),_0xf7112d,_0xadaf('0x25'));_0x6c857b(_0x435358[_0xadaf('0x2b')][_0xadaf('0x2a')]);}})[_0xadaf('0x2c')](function(_0x1fbad0){logger[_0xadaf('0x28')](_0xadaf('0x24'),_0xf7112d,_0x1fbad0);_0xbda776(_0x1fbad0);});});}function respondWithStatusCode(_0x45fde5,_0x4ed81e){_0x4ed81e=_0x4ed81e||0xcc;return function(_0x449c73){if(_0x449c73){return _0x45fde5[_0xadaf('0x2d')](_0x4ed81e);}return _0x45fde5[_0xadaf('0x2e')](_0x4ed81e)[_0xadaf('0x2f')]();};}function respondWithResult(_0x5719a1,_0x19948){_0x19948=_0x19948||0xc8;return function(_0xd4fa1a){if(_0xd4fa1a){return _0x5719a1[_0xadaf('0x2e')](_0x19948)[_0xadaf('0x30')](_0xd4fa1a);}};}function respondWithFilteredResult(_0xf14c7,_0x56ab14){return function(_0x4b9bc9){if(_0x4b9bc9){var _0x4487a5=typeof _0x56ab14[_0xadaf('0x31')]===_0xadaf('0x32')&&typeof _0x56ab14['limit']===_0xadaf('0x32');var _0x36422d=_0x4b9bc9[_0xadaf('0x33')];var _0x2082d3=_0x4487a5?0x0:_0x56ab14[_0xadaf('0x31')];var _0x2bd825=_0x4487a5?_0x4b9bc9[_0xadaf('0x33')]:_0x56ab14['offset']+_0x56ab14[_0xadaf('0x34')];var _0x483554;if(_0x2bd825>=_0x36422d){_0x2bd825=_0x36422d;_0x483554=0xc8;}else{_0x483554=0xce;}_0xf14c7['status'](_0x483554);return _0xf14c7[_0xadaf('0x35')](_0xadaf('0x36'),_0x2082d3+'-'+_0x2bd825+'/'+_0x36422d)[_0xadaf('0x30')](_0x4b9bc9);}return null;};}function patchUpdates(_0x4c29ac){return function(_0x5c29f2){try{jsonpatch['apply'](_0x5c29f2,_0x4c29ac,!![]);}catch(_0x1ef1f9){return BPromise[_0xadaf('0x37')](_0x1ef1f9);}return _0x5c29f2[_0xadaf('0x38')]();};}function saveUpdates(_0xb0122,_0x526d3a){return function(_0x1c3144){if(_0x1c3144){return _0x1c3144[_0xadaf('0x39')](_0xb0122)[_0xadaf('0x22')](function(_0xfaa263){return _0xfaa263;});}return null;};}function removeEntity(_0x5ea074,_0xd5e754){return function(_0x586a4a){if(_0x586a4a){return _0x586a4a[_0xadaf('0x3a')]()[_0xadaf('0x22')](function(){var _0x5a5ac3=_0x586a4a[_0xadaf('0x3b')]({'plain':!![]});var _0xe0db68=_0xadaf('0x3c');return db[_0xadaf('0x3d')][_0xadaf('0x3a')]({'where':{'type':_0xe0db68,'resourceId':_0x5a5ac3['id']}})[_0xadaf('0x22')](function(){return _0x586a4a;});})[_0xadaf('0x22')](function(){_0x5ea074[_0xadaf('0x2e')](0xcc)[_0xadaf('0x2f')]();});}};}function handleEntityNotFound(_0x44e663,_0x581b91){return function(_0x465ef4){if(!_0x465ef4){_0x44e663['sendStatus'](0x194);}return _0x465ef4;};}function handleError(_0x5c58f7,_0x5fab4b){_0x5fab4b=_0x5fab4b||0x1f4;return function(_0x5f005e){logger['error'](_0x5f005e['stack']);if(_0x5f005e[_0xadaf('0x3e')]){delete _0x5f005e['name'];}_0x5c58f7[_0xadaf('0x2e')](_0x5fab4b)['send'](_0x5f005e);};}exports[_0xadaf('0x3f')]=function(_0x533a45,_0x3ae7b6){var _0x88f5aa={'include':[{'model':db['MailServerIn'],'as':_0xadaf('0x40')},{'model':db[_0xadaf('0x41')],'as':_0xadaf('0x42')},{'model':db['Pause'],'as':_0xadaf('0x43')}]},_0xfdb4d3={},_0x5a6eb2={'count':0x0,'rows':[]};var _0x383a41=_['map'](db['MailAccount'][_0xadaf('0x44')],function(_0x54afdc){return{'name':_0x54afdc[_0xadaf('0x45')],'type':_0x54afdc[_0xadaf('0x46')][_0xadaf('0x47')]};});_0xfdb4d3[_0xadaf('0x48')]=_[_0xadaf('0x49')](_0x383a41,'name');_0xfdb4d3['query']=_[_0xadaf('0x4a')](_0x533a45[_0xadaf('0x4b')]);_0xfdb4d3['filters']=_['intersection'](_0xfdb4d3[_0xadaf('0x48')],_0xfdb4d3[_0xadaf('0x4b')]);_0x88f5aa[_0xadaf('0x4c')]=_[_0xadaf('0x4d')](_0xfdb4d3['model'],qs[_0xadaf('0x4e')](_0x533a45[_0xadaf('0x4b')][_0xadaf('0x4e')]));_0x88f5aa[_0xadaf('0x4c')]=_0x88f5aa['attributes'][_0xadaf('0x4f')]?_0x88f5aa[_0xadaf('0x4c')]:_0xfdb4d3[_0xadaf('0x48')];if(!_0x533a45[_0xadaf('0x4b')][_0xadaf('0x50')](_0xadaf('0x51'))){_0x88f5aa['limit']=qs['limit'](_0x533a45[_0xadaf('0x4b')][_0xadaf('0x34')]);_0x88f5aa[_0xadaf('0x31')]=qs['offset'](_0x533a45[_0xadaf('0x4b')]['offset']);}_0x88f5aa[_0xadaf('0x52')]=qs['sort'](_0x533a45[_0xadaf('0x4b')][_0xadaf('0x53')]);_0x88f5aa[_0xadaf('0x54')]=qs[_0xadaf('0x55')](_[_0xadaf('0x56')](_0x533a45[_0xadaf('0x4b')],_0xfdb4d3[_0xadaf('0x55')]),_0x383a41);if(_0x533a45['query'][_0xadaf('0x57')]){_0x88f5aa[_0xadaf('0x54')]=_[_0xadaf('0x58')](_0x88f5aa['where'],{'$or':_['map'](_0x383a41,function(_0x12564d){if(_0x12564d[_0xadaf('0x46')]!==_0xadaf('0x59')){var _0x47caed={};_0x47caed[_0x12564d[_0xadaf('0x3e')]]={'$like':'%'+_0x533a45[_0xadaf('0x4b')][_0xadaf('0x57')]+'%'};return _0x47caed;}})});}_0x88f5aa=_['merge']({},_0x88f5aa,_0x533a45[_0xadaf('0x5a')]);var _0x15b5b5={'where':_0x88f5aa['where']};return db['MailAccount'][_0xadaf('0x33')](_0x15b5b5)[_0xadaf('0x22')](function(_0x1105e1){_0x5a6eb2[_0xadaf('0x33')]=_0x1105e1;if(_0x533a45['query'][_0xadaf('0x5b')]){_0x88f5aa[_0xadaf('0x5c')]=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x88f5aa);})[_0xadaf('0x22')](function(_0x4e9e52){_0x5a6eb2[_0xadaf('0x5d')]=_0x4e9e52;return _0x5a6eb2;})[_0xadaf('0x22')](respondWithFilteredResult(_0x3ae7b6,_0x88f5aa))['catch'](handleError(_0x3ae7b6,null));};exports['show']=function(_0x8d80a1,_0x4340ef){var _0x1cd0e7={'raw':![],'where':{'id':_0x8d80a1[_0xadaf('0x5e')]['id']},'include':[{'model':db[_0xadaf('0x5f')],'as':_0xadaf('0x40')},{'model':db['MailServerOut'],'as':_0xadaf('0x42')},{'model':db[_0xadaf('0x60')],'as':_0xadaf('0x43')}]},_0x268a12={};_0x268a12['model']=_[_0xadaf('0x4a')](db[_0xadaf('0x61')][_0xadaf('0x44')]);_0x268a12[_0xadaf('0x4b')]=_[_0xadaf('0x4a')](_0x8d80a1['query']);_0x268a12[_0xadaf('0x55')]=_[_0xadaf('0x4d')](_0x268a12['model'],_0x268a12['query']);_0x1cd0e7[_0xadaf('0x4c')]=_['intersection'](_0x268a12[_0xadaf('0x48')],qs[_0xadaf('0x4e')](_0x8d80a1[_0xadaf('0x4b')][_0xadaf('0x4e')]));_0x1cd0e7['attributes']=_0x1cd0e7[_0xadaf('0x4c')]['length']?_0x1cd0e7[_0xadaf('0x4c')]:_0x268a12[_0xadaf('0x48')];if(_0x8d80a1[_0xadaf('0x4b')][_0xadaf('0x5b')]){_0x1cd0e7[_0xadaf('0x5c')]=[{'all':!![]}];}_0x1cd0e7=_[_0xadaf('0x58')]({},_0x1cd0e7,_0x8d80a1[_0xadaf('0x5a')]);return db[_0xadaf('0x61')][_0xadaf('0x62')](_0x1cd0e7)[_0xadaf('0x22')](handleEntityNotFound(_0x4340ef,null))[_0xadaf('0x22')](respondWithResult(_0x4340ef,null))[_0xadaf('0x2c')](handleError(_0x4340ef,null));};exports['update']=function(_0x2a5012,_0x482601){if(_0x2a5012[_0xadaf('0x63')]['id']){delete _0x2a5012[_0xadaf('0x63')]['id'];}return db[_0xadaf('0x61')][_0xadaf('0x62')]({'where':{'id':_0x2a5012[_0xadaf('0x5e')]['id']},'include':[{'model':db[_0xadaf('0x5f')],'as':_0xadaf('0x40')},{'model':db[_0xadaf('0x41')],'as':_0xadaf('0x42')},{'model':db[_0xadaf('0x60')],'as':_0xadaf('0x43')}]})[_0xadaf('0x22')](handleEntityNotFound(_0x482601,null))['then'](saveUpdates(_0x2a5012['body'],null))[_0xadaf('0x22')](function(_0x1ae2cc){if(_0x1ae2cc&&_0x2a5012['body']['Imap']){return db['MailServerIn'][_0xadaf('0x39')](_0x2a5012[_0xadaf('0x63')][_0xadaf('0x40')],{'where':{'MailAccountId':_0x1ae2cc['id']}})[_0xadaf('0x22')](function(){return _0x1ae2cc;});}return _0x1ae2cc;})[_0xadaf('0x22')](function(_0x3cf5f6){if(_0x3cf5f6&&_0x2a5012[_0xadaf('0x63')][_0xadaf('0x42')]){return db[_0xadaf('0x41')][_0xadaf('0x39')](_0x2a5012[_0xadaf('0x63')][_0xadaf('0x42')],{'where':{'MailAccountId':_0x3cf5f6['id']}})[_0xadaf('0x22')](function(){return _0x3cf5f6;});}return _0x3cf5f6;})['then'](respondWithResult(_0x482601,null))[_0xadaf('0x2c')](handleError(_0x482601,null));};exports[_0xadaf('0x64')]=function(_0x431b0f,_0x3091ca){return db[_0xadaf('0x61')][_0xadaf('0x64')]()[_0xadaf('0x22')](respondWithResult(_0x3091ca,null))[_0xadaf('0x2c')](handleError(_0x3091ca,null));};exports[_0xadaf('0x65')]=function(_0x87ad70,_0x20c52d,_0x430576){if(_0x87ad70[_0xadaf('0x63')]['id']){delete _0x87ad70[_0xadaf('0x63')]['id'];}return db[_0xadaf('0x61')]['find']({'where':{'id':_0x87ad70[_0xadaf('0x5e')]['id']}})[_0xadaf('0x22')](handleEntityNotFound(_0x20c52d,null))[_0xadaf('0x22')](function(_0x178b9a){if(_0x178b9a){_0x87ad70[_0xadaf('0x63')][_0xadaf('0x66')]=_0x178b9a['id'];return db[_0xadaf('0x67')][_0xadaf('0x68')](_0x87ad70['body']);}})[_0xadaf('0x22')](respondWithResult(_0x20c52d,null))[_0xadaf('0x2c')](handleError(_0x20c52d,null));};exports[_0xadaf('0x69')]=function(_0x36780d,_0x14c23e,_0x5d4991){var _0x2173ba={'raw':![],'where':{}};var _0x1f0b6b={};var _0x2a4f36={'count':0x0,'rows':[]};return db[_0xadaf('0x61')][_0xadaf('0x6a')]({'where':{'id':_0x36780d[_0xadaf('0x5e')]['id']}})[_0xadaf('0x22')](handleEntityNotFound(_0x14c23e,null))[_0xadaf('0x22')](function(_0x3b7a80){if(_0x3b7a80){_0x1f0b6b[_0xadaf('0x48')]=_[_0xadaf('0x4a')](db['Disposition']['rawAttributes']);_0x1f0b6b[_0xadaf('0x4b')]=_[_0xadaf('0x4a')](_0x36780d['query']);_0x1f0b6b['filters']=_[_0xadaf('0x4d')](_0x1f0b6b[_0xadaf('0x48')],_0x1f0b6b['query']);_0x2173ba[_0xadaf('0x4c')]=_['intersection'](_0x1f0b6b['model'],qs[_0xadaf('0x4e')](_0x36780d[_0xadaf('0x4b')]['fields']));_0x2173ba['attributes']=_0x2173ba[_0xadaf('0x4c')][_0xadaf('0x4f')]?_0x2173ba[_0xadaf('0x4c')]:_0x1f0b6b[_0xadaf('0x48')];if(!_0x36780d['query'][_0xadaf('0x50')]('nolimit')){_0x2173ba[_0xadaf('0x34')]=qs[_0xadaf('0x34')](_0x36780d[_0xadaf('0x4b')][_0xadaf('0x34')]);_0x2173ba['offset']=qs[_0xadaf('0x31')](_0x36780d[_0xadaf('0x4b')][_0xadaf('0x31')]);}_0x2173ba['order']=qs[_0xadaf('0x53')](_0x36780d['query']['sort']);_0x2173ba[_0xadaf('0x54')]=qs[_0xadaf('0x55')](_[_0xadaf('0x56')](_0x36780d[_0xadaf('0x4b')],_0x1f0b6b['filters']));_0x2173ba[_0xadaf('0x54')]['MailAccountId']=_0x3b7a80['id'];if(_0x36780d['query'][_0xadaf('0x57')]){_0x2173ba[_0xadaf('0x54')]=_[_0xadaf('0x58')](_0x2173ba[_0xadaf('0x54')],{'$or':_[_0xadaf('0x49')](_0x2173ba[_0xadaf('0x4c')],function(_0x28c32c){var _0x2469f6={};_0x2469f6[_0x28c32c]={'$like':'%'+_0x36780d[_0xadaf('0x4b')]['filter']+'%'};return _0x2469f6;})});}_0x2173ba=_[_0xadaf('0x58')]({},_0x2173ba,_0x36780d['options']);return db[_0xadaf('0x67')]['count']({'where':_0x2173ba[_0xadaf('0x54')]})[_0xadaf('0x22')](function(_0x12087a){_0x2a4f36['count']=_0x12087a;if(_0x36780d[_0xadaf('0x4b')][_0xadaf('0x5b')]){_0x2173ba['include']=[{'all':!![]}];}return db[_0xadaf('0x67')][_0xadaf('0x6b')](_0x2173ba);})[_0xadaf('0x22')](function(_0x29911a){_0x2a4f36[_0xadaf('0x5d')]=_0x29911a;return _0x2a4f36;});}})['then'](respondWithFilteredResult(_0x14c23e,_0x2173ba))['catch'](handleError(_0x14c23e,null));};exports[_0xadaf('0x6c')]=function(_0x507237,_0xcbdb51,_0x55be33){return db[_0xadaf('0x61')][_0xadaf('0x62')]({'where':{'id':_0x507237[_0xadaf('0x5e')]['id']}})[_0xadaf('0x22')](handleEntityNotFound(_0xcbdb51,null))[_0xadaf('0x22')](function(_0x5a3c6c){if(_0x5a3c6c){return _0x5a3c6c[_0xadaf('0x6c')](_0x507237[_0xadaf('0x4b')][_0xadaf('0x6d')]);}})[_0xadaf('0x22')](respondWithStatusCode(_0xcbdb51,null))['catch'](handleError(_0xcbdb51,null));};exports['addAnswer']=function(_0x51fd02,_0x2c43da,_0x491918){if(_0x51fd02[_0xadaf('0x63')]['id']){delete _0x51fd02[_0xadaf('0x63')]['id'];}return db[_0xadaf('0x61')][_0xadaf('0x62')]({'where':{'id':_0x51fd02[_0xadaf('0x5e')]['id']}})[_0xadaf('0x22')](handleEntityNotFound(_0x2c43da,null))[_0xadaf('0x22')](function(_0x564e29){if(_0x564e29){_0x51fd02[_0xadaf('0x63')][_0xadaf('0x66')]=_0x564e29['id'];return db['CannedAnswer'][_0xadaf('0x68')](_0x51fd02[_0xadaf('0x63')]);}})[_0xadaf('0x22')](respondWithResult(_0x2c43da,null))[_0xadaf('0x2c')](handleError(_0x2c43da,null));};exports[_0xadaf('0x6e')]=function(_0x296351,_0x4569c0,_0x43d6c7){var _0x54c28a={'raw':![],'where':{}};var _0x2dc81e={};var _0x2c9605={'count':0x0,'rows':[]};return db[_0xadaf('0x61')][_0xadaf('0x6a')]({'where':{'id':_0x296351[_0xadaf('0x5e')]['id']}})[_0xadaf('0x22')](handleEntityNotFound(_0x4569c0,null))['then'](function(_0x153105){if(_0x153105){_0x2dc81e[_0xadaf('0x48')]=_['keys'](db[_0xadaf('0x6f')][_0xadaf('0x44')]);_0x2dc81e['query']=_[_0xadaf('0x4a')](_0x296351[_0xadaf('0x4b')]);_0x2dc81e['filters']=_['intersection'](_0x2dc81e[_0xadaf('0x48')],_0x2dc81e['query']);_0x54c28a[_0xadaf('0x4c')]=_[_0xadaf('0x4d')](_0x2dc81e[_0xadaf('0x48')],qs[_0xadaf('0x4e')](_0x296351[_0xadaf('0x4b')][_0xadaf('0x4e')]));_0x54c28a[_0xadaf('0x4c')]=_0x54c28a[_0xadaf('0x4c')][_0xadaf('0x4f')]?_0x54c28a['attributes']:_0x2dc81e[_0xadaf('0x48')];if(!_0x296351[_0xadaf('0x4b')][_0xadaf('0x50')](_0xadaf('0x51'))){_0x54c28a['limit']=qs['limit'](_0x296351[_0xadaf('0x4b')][_0xadaf('0x34')]);_0x54c28a['offset']=qs['offset'](_0x296351[_0xadaf('0x4b')][_0xadaf('0x31')]);}_0x54c28a[_0xadaf('0x52')]=qs[_0xadaf('0x53')](_0x296351['query']['sort']);_0x54c28a['where']=qs[_0xadaf('0x55')](_[_0xadaf('0x56')](_0x296351['query'],_0x2dc81e[_0xadaf('0x55')]));_0x54c28a[_0xadaf('0x54')]['MailAccountId']=_0x153105['id'];if(_0x296351[_0xadaf('0x4b')]['filter']){_0x54c28a[_0xadaf('0x54')]=_['merge'](_0x54c28a[_0xadaf('0x54')],{'$or':_['map'](_0x54c28a[_0xadaf('0x4c')],function(_0x4514eb){var _0x302511={};_0x302511[_0x4514eb]={'$like':'%'+_0x296351[_0xadaf('0x4b')][_0xadaf('0x57')]+'%'};return _0x302511;})});}_0x54c28a=_[_0xadaf('0x58')]({},_0x54c28a,_0x296351[_0xadaf('0x5a')]);return db[_0xadaf('0x6f')]['count']({'where':_0x54c28a[_0xadaf('0x54')]})['then'](function(_0x191491){_0x2c9605[_0xadaf('0x33')]=_0x191491;if(_0x296351[_0xadaf('0x4b')][_0xadaf('0x5b')]){_0x54c28a['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xadaf('0x6b')](_0x54c28a);})[_0xadaf('0x22')](function(_0x49d892){_0x2c9605[_0xadaf('0x5d')]=_0x49d892;return _0x2c9605;});}})[_0xadaf('0x22')](respondWithFilteredResult(_0x4569c0,_0x54c28a))['catch'](handleError(_0x4569c0,null));};exports[_0xadaf('0x70')]=function(_0x566640,_0x3922c0,_0x276c6f){return db['MailAccount']['find']({'where':{'id':_0x566640['params']['id']}})[_0xadaf('0x22')](handleEntityNotFound(_0x3922c0,null))[_0xadaf('0x22')](function(_0xf97b89){if(_0xf97b89){return _0xf97b89[_0xadaf('0x70')](_0x566640[_0xadaf('0x4b')][_0xadaf('0x6d')]);}})[_0xadaf('0x22')](respondWithStatusCode(_0x3922c0,null))['catch'](handleError(_0x3922c0,null));};exports[_0xadaf('0x68')]=function(_0x31651e,_0x20395f){var _0x145d17={'name':_0x31651e[_0xadaf('0x63')][_0xadaf('0x3e')],'key':_0x31651e[_0xadaf('0x63')][_0xadaf('0x47')],'email':_0x31651e[_0xadaf('0x63')][_0xadaf('0x71')],'ListId':_0x31651e[_0xadaf('0x63')][_0xadaf('0x72')],'active':!_[_0xadaf('0x73')](_0x31651e['body']['active'])?_0x31651e[_0xadaf('0x63')]['active']:!![],'description':_0x31651e[_0xadaf('0x63')][_0xadaf('0x74')]||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x31651e[_0xadaf('0x63')][_0xadaf('0x75')])){if(_0x31651e[_0xadaf('0x63')]['cauthentication']){_0x145d17['Imap'][_0xadaf('0x76')]=_0x145d17['Smtp'][_0xadaf('0x76')]=_0x31651e['body']['cuser'];_0x145d17[_0xadaf('0x40')][_0xadaf('0x77')]=_0x145d17[_0xadaf('0x42')][_0xadaf('0x78')]=_0x31651e['body'][_0xadaf('0x79')];}else{_0x145d17[_0xadaf('0x40')][_0xadaf('0x7a')]=_0x145d17[_0xadaf('0x42')][_0xadaf('0x7a')]=![];}_0x145d17['Imap'][_0xadaf('0x7b')]=_0x31651e['body'][_0xadaf('0x40')][_0xadaf('0x7b')];_0x145d17[_0xadaf('0x40')]['port']=_0x31651e[_0xadaf('0x63')]['Imap']['port'];_0x145d17[_0xadaf('0x42')][_0xadaf('0x7b')]=_0x31651e['body']['Smtp'][_0xadaf('0x7b')];_0x145d17[_0xadaf('0x42')]['port']=_0x31651e[_0xadaf('0x63')][_0xadaf('0x42')][_0xadaf('0x7c')];}else{_0x145d17[_0xadaf('0x40')][_0xadaf('0x7d')]=_0x145d17[_0xadaf('0x42')][_0xadaf('0x7d')]=_0x31651e[_0xadaf('0x63')][_0xadaf('0x75')];_0x145d17[_0xadaf('0x40')][_0xadaf('0x76')]=_0x145d17[_0xadaf('0x42')]['user']=_0x31651e['body'][_0xadaf('0x7e')];_0x145d17[_0xadaf('0x40')][_0xadaf('0x77')]=_0x145d17['Smtp'][_0xadaf('0x78')]=_0x31651e['body'][_0xadaf('0x79')];}return db[_0xadaf('0x61')][_0xadaf('0x68')](_0x145d17,{'include':[{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0xadaf('0x5f')],'as':_0xadaf('0x40')}]})[_0xadaf('0x22')](function(_0x1efddc){var _0x2fa55a=_0x31651e[_0xadaf('0x76')][_0xadaf('0x3b')]({'plain':!![]});if(!_0x2fa55a)throw new Error(_0xadaf('0x7f'));if(_0x2fa55a[_0xadaf('0x80')]===_0xadaf('0x76')){var _0x4dec86=_0x1efddc['get']({'plain':!![]});return db[_0xadaf('0x81')][_0xadaf('0x62')]({'where':{'name':_0xadaf('0x3c'),'userProfileId':_0x2fa55a['userProfileId']},'raw':!![]})[_0xadaf('0x22')](function(_0x10e2e7){if(_0x10e2e7&&_0x10e2e7[_0xadaf('0x82')]===0x0){return db[_0xadaf('0x3d')][_0xadaf('0x68')]({'name':_0x4dec86[_0xadaf('0x3e')],'resourceId':_0x4dec86['id'],'type':_0x10e2e7[_0xadaf('0x3e')],'sectionId':_0x10e2e7['id']},{})[_0xadaf('0x22')](function(){return _0x1efddc;});}else{return _0x1efddc;}})[_0xadaf('0x2c')](function(_0x1e39c3){logger[_0xadaf('0x28')](_0xadaf('0x83'),_0x1e39c3);throw _0x1e39c3;});}return _0x1efddc;})[_0xadaf('0x22')](respondWithResult(_0x20395f,0xc9))[_0xadaf('0x2c')](handleError(_0x20395f,null));};exports[_0xadaf('0x84')]=function(_0x4106d5,_0x3f1bf1,_0x4e16a0){return db[_0xadaf('0x61')]['findOne']({'where':{'id':_0x4106d5[_0xadaf('0x5e')]['id']}})[_0xadaf('0x22')](handleEntityNotFound(_0x3f1bf1,null))['then'](function(_0x46d300){if(_0x46d300){return _0x46d300[_0xadaf('0x84')]();}return null;})[_0xadaf('0x22')](respondWithResult(_0x3f1bf1,null))[_0xadaf('0x2c')](handleError(_0x3f1bf1,null));};exports['addImap']=function(_0x3ed8e7,_0x123bca,_0x53a338){if(_0x3ed8e7['body']['id']){delete _0x3ed8e7[_0xadaf('0x63')]['id'];}return db['MailAccount'][_0xadaf('0x62')]({'where':{'id':_0x3ed8e7[_0xadaf('0x5e')]['id']}})[_0xadaf('0x22')](handleEntityNotFound(_0x123bca,null))[_0xadaf('0x22')](function(_0x28a4ef){if(_0x28a4ef){_0x3ed8e7[_0xadaf('0x63')]['MailAccountId']=_0x28a4ef['id'];return db[_0xadaf('0x5f')][_0xadaf('0x68')](_0x3ed8e7[_0xadaf('0x63')]);}})['then'](respondWithResult(_0x123bca,null))['catch'](handleError(_0x123bca,null));};exports[_0xadaf('0x85')]=function(_0x366590,_0x48b18d,_0x59ec81){return db['MailAccount']['findOne']({'where':{'id':_0x366590[_0xadaf('0x5e')]['id']}})[_0xadaf('0x22')](handleEntityNotFound(_0x48b18d,null))[_0xadaf('0x22')](function(_0x22797e){if(_0x22797e){return _0x22797e[_0xadaf('0x86')](null);}return null;})['then'](respondWithStatusCode(_0x48b18d,null))[_0xadaf('0x2c')](handleError(_0x48b18d,null));};exports[_0xadaf('0x87')]=function(_0x587894,_0x2ff512,_0x1c9e0a){return db[_0xadaf('0x61')][_0xadaf('0x6a')]({'where':{'id':_0x587894[_0xadaf('0x5e')]['id']}})[_0xadaf('0x22')](handleEntityNotFound(_0x2ff512,null))[_0xadaf('0x22')](function(_0x3af117){if(_0x3af117){return _0x3af117[_0xadaf('0x87')]();}return null;})[_0xadaf('0x22')](respondWithResult(_0x2ff512,null))[_0xadaf('0x2c')](handleError(_0x2ff512,null));};exports[_0xadaf('0x88')]=function(_0x414b55,_0x5aca38,_0xb0c062){if(_0x414b55[_0xadaf('0x63')]['id']){delete _0x414b55['body']['id'];}return db[_0xadaf('0x61')][_0xadaf('0x62')]({'where':{'id':_0x414b55['params']['id']}})['then'](handleEntityNotFound(_0x5aca38,null))[_0xadaf('0x22')](function(_0x2eec6a){if(_0x2eec6a){_0x414b55[_0xadaf('0x63')][_0xadaf('0x66')]=_0x2eec6a['id'];return db[_0xadaf('0x41')][_0xadaf('0x68')](_0x414b55[_0xadaf('0x63')]);}})[_0xadaf('0x22')](respondWithResult(_0x5aca38,null))['catch'](handleError(_0x5aca38,null));};exports[_0xadaf('0x89')]=function(_0x4d4a43,_0x450bc7,_0x2cbb70){return db['MailAccount'][_0xadaf('0x6a')]({'where':{'id':_0x4d4a43['params']['id']}})['then'](handleEntityNotFound(_0x450bc7,null))['then'](function(_0x1dc978){if(_0x1dc978){return _0x1dc978[_0xadaf('0x8a')](null);}return null;})[_0xadaf('0x22')](respondWithStatusCode(_0x450bc7,null))[_0xadaf('0x2c')](handleError(_0x450bc7,null));};exports['addInteraction']=function(_0x5d8cea,_0x547fa6,_0x3f0fea){return db[_0xadaf('0x8b')]['find']({'where':{'id':_0x5d8cea[_0xadaf('0x5e')]['id']}})[_0xadaf('0x22')](handleEntityNotFound(_0x547fa6,null))[_0xadaf('0x22')](function(_0x34f40b){if(_0x34f40b){return _0x34f40b[_0xadaf('0x8c')](_0x5d8cea[_0xadaf('0x63')][_0xadaf('0x6d')],_['omit'](_0x5d8cea[_0xadaf('0x63')],[_0xadaf('0x6d'),'id'])||{});}})[_0xadaf('0x22')](respondWithResult(_0x547fa6,null))['catch'](handleError(_0x547fa6,null));};exports['getInteractions']=function(_0x59c84e,_0x36a68b,_0x1c59a0){var _0x525e05={'raw':![],'where':{}};var _0x2dd3d5={};var _0x1bf4c3={'count':0x0,'rows':[]};return db[_0xadaf('0x61')][_0xadaf('0x6a')]({'where':{'id':_0x59c84e[_0xadaf('0x5e')]['id']}})[_0xadaf('0x22')](handleEntityNotFound(_0x36a68b,null))['then'](function(_0x3c2318){if(_0x3c2318){_0x2dd3d5['model']=_[_0xadaf('0x4a')](db[_0xadaf('0x8b')][_0xadaf('0x44')]);_0x2dd3d5[_0xadaf('0x4b')]=_[_0xadaf('0x4a')](_0x59c84e['query']);_0x2dd3d5[_0xadaf('0x55')]=_[_0xadaf('0x4d')](_0x2dd3d5[_0xadaf('0x48')],_0x2dd3d5['query']);_0x525e05['attributes']=_[_0xadaf('0x4d')](_0x2dd3d5[_0xadaf('0x48')],qs['fields'](_0x59c84e[_0xadaf('0x4b')][_0xadaf('0x4e')]));_0x525e05['attributes']=_0x525e05['attributes'][_0xadaf('0x4f')]?_0x525e05[_0xadaf('0x4c')]:_0x2dd3d5[_0xadaf('0x48')];if(!_0x59c84e[_0xadaf('0x4b')][_0xadaf('0x50')]('nolimit')){_0x525e05[_0xadaf('0x34')]=qs[_0xadaf('0x34')](_0x59c84e['query'][_0xadaf('0x34')]);_0x525e05[_0xadaf('0x31')]=qs[_0xadaf('0x31')](_0x59c84e[_0xadaf('0x4b')][_0xadaf('0x31')]);}_0x525e05[_0xadaf('0x52')]=qs[_0xadaf('0x53')](_0x59c84e[_0xadaf('0x4b')][_0xadaf('0x53')]);_0x525e05['where']=qs[_0xadaf('0x55')](_['pick'](_0x59c84e[_0xadaf('0x4b')],_0x2dd3d5[_0xadaf('0x55')]));_0x525e05[_0xadaf('0x54')][_0xadaf('0x66')]=_0x3c2318['id'];if(_0x59c84e[_0xadaf('0x4b')][_0xadaf('0x57')]){_0x525e05[_0xadaf('0x54')]=_['merge'](_0x525e05[_0xadaf('0x54')],{'$or':_[_0xadaf('0x49')](_0x525e05[_0xadaf('0x4c')],function(_0x30c4f8){var _0x244040={};_0x244040[_0x30c4f8]={'$like':'%'+_0x59c84e[_0xadaf('0x4b')]['filter']+'%'};return _0x244040;})});}_0x525e05=_[_0xadaf('0x58')]({},_0x525e05,_0x59c84e['options']);return db[_0xadaf('0x8b')][_0xadaf('0x33')]({'where':_0x525e05[_0xadaf('0x54')]})['then'](function(_0x1ca76d){_0x1bf4c3[_0xadaf('0x33')]=_0x1ca76d;if(_0x59c84e['query'][_0xadaf('0x5b')]){_0x525e05[_0xadaf('0x5c')]=[{'model':db[_0xadaf('0x8d')],'as':_0xadaf('0x8e'),'required':![]},{'model':db['User'],'as':_0xadaf('0x8f'),'attributes':[_0xadaf('0x3e'),'fullname','internal'],'required':![]},{'model':db[_0xadaf('0x90')],'as':_0xadaf('0x91'),'attributes':['id',_0xadaf('0x3e'),_0xadaf('0x92')],'where':_0x59c84e['query']['tag']?{'id':_0x59c84e['query'][_0xadaf('0x93')]}:undefined,'required':_0x59c84e[_0xadaf('0x4b')][_0xadaf('0x93')]?!![]:![]}];}return db['MailInteraction']['findAll'](_0x525e05);})[_0xadaf('0x22')](function(_0x20acc7){_0x1bf4c3[_0xadaf('0x5d')]=_0x20acc7;return _0x1bf4c3;});}})[_0xadaf('0x22')](respondWithFilteredResult(_0x36a68b,_0x525e05))['catch'](handleError(_0x36a68b,null));};exports[_0xadaf('0x94')]=function addApplications(_0x5e0415,_0x36a380){var _0x4c7db2=_0x5e0415[_0xadaf('0x5e')]['id'];var _0x55189b=_0x5e0415[_0xadaf('0x63')];var _0x25bc81=0xc8;var _0x5355f5=null;return db[_0xadaf('0x95')][_0xadaf('0x96')]({'isolationLevel':db['sequelize'][_0xadaf('0x97')][_0xadaf('0x98')][_0xadaf('0x99')]},function(_0x1dec0d){return db['MailAccount'][_0xadaf('0x6a')]({'where':{'id':_0x4c7db2},'transaction':_0x1dec0d})[_0xadaf('0x22')](function(_0x5755b5){if(_0x5755b5){return db['MailApplication'][_0xadaf('0x3a')]({'where':{'MailAccountId':_0x4c7db2},'transaction':_0x1dec0d})[_0xadaf('0x22')](function(){var _0x295c82=_['map'](_0x55189b,function(_0x5d2e44){_0x5d2e44[_0xadaf('0x66')]=_0x4c7db2;return _0x5d2e44;});return db['MailApplication'][_0xadaf('0x9a')](_0x295c82,{'transaction':_0x1dec0d});});}else{_0x25bc81=0x194;_0x5355f5=[];}});})[_0xadaf('0x22')](function(){if(_0x25bc81!==0x194){return db['MailApplication'][_0xadaf('0x9b')]({'where':{'MailAccountId':_0x4c7db2},'order':'priority'})['then'](function(_0x183d68){_0x5355f5=_0x183d68;});}})['catch'](function(_0x5e9b95){_0x25bc81=0x1f4;logger[_0xadaf('0x28')](_0x5e9b95[_0xadaf('0x9c')]);if(_0x5e9b95[_0xadaf('0x3e')]){delete _0x5e9b95[_0xadaf('0x3e')];}_0x5355f5=_0x5e9b95;})[_0xadaf('0x9d')](function(){if(_0x5355f5===null){_0x36a380['sendStatus'](_0x25bc81);}else{if(_0x25bc81===0x1f4){_0x36a380['status'](_0x25bc81)[_0xadaf('0x9e')](_0x5355f5);}else{_0x36a380[_0xadaf('0x2e')](_0x25bc81)['json'](_0x5355f5);}}});};exports[_0xadaf('0x9f')]=function(_0x525229,_0x113c03,_0x1f44c5){var _0x59e5f3={};var _0x569b2d={};var _0x4cb5bf;var _0x15df44;return db[_0xadaf('0x61')][_0xadaf('0x6a')]({'where':{'id':_0x525229['params']['id']}})[_0xadaf('0x22')](handleEntityNotFound(_0x113c03,null))['then'](function(_0xec62ba){if(_0xec62ba){_0x4cb5bf=_0xec62ba;_0x569b2d[_0xadaf('0x48')]=_[_0xadaf('0x4a')](db['MailApplication'][_0xadaf('0x44')]);_0x569b2d['query']=_[_0xadaf('0x4a')](_0x525229[_0xadaf('0x4b')]);_0x569b2d[_0xadaf('0x55')]=_[_0xadaf('0x4d')](_0x569b2d[_0xadaf('0x48')],_0x569b2d[_0xadaf('0x4b')]);_0x59e5f3[_0xadaf('0x4c')]=_[_0xadaf('0x4d')](_0x569b2d[_0xadaf('0x48')],qs[_0xadaf('0x4e')](_0x525229[_0xadaf('0x4b')][_0xadaf('0x4e')]));_0x59e5f3['attributes']=_0x59e5f3[_0xadaf('0x4c')][_0xadaf('0x4f')]?_0x59e5f3[_0xadaf('0x4c')]:_0x569b2d[_0xadaf('0x48')];_0x59e5f3[_0xadaf('0x52')]=qs[_0xadaf('0x53')](_0x525229[_0xadaf('0x4b')]['sort']);_0x59e5f3[_0xadaf('0x54')]=qs[_0xadaf('0x55')](_[_0xadaf('0x56')](_0x525229[_0xadaf('0x4b')],_0x569b2d['filters']));if(_0x525229[_0xadaf('0x4b')][_0xadaf('0x57')]){_0x59e5f3['where']=_[_0xadaf('0x58')](_0x59e5f3[_0xadaf('0x54')],{'$or':_[_0xadaf('0x49')](_0x59e5f3[_0xadaf('0x4c')],function(_0x241b5d){var _0x4c5490={};_0x4c5490[_0x241b5d]={'$like':'%'+_0x525229['query'][_0xadaf('0x57')]+'%'};return _0x4c5490;})});}_0x59e5f3=_[_0xadaf('0x58')]({},_0x59e5f3,_0x525229[_0xadaf('0x5a')]);return _0x4cb5bf[_0xadaf('0x9f')](_0x59e5f3);}})['then'](function(_0x1f9e18){if(_0x1f9e18){_0x15df44=_0x1f9e18[_0xadaf('0x4f')];if(!_0x525229['query']['hasOwnProperty'](_0xadaf('0x51'))){_0x59e5f3[_0xadaf('0x34')]=qs['limit'](_0x525229['query']['limit']);_0x59e5f3['offset']=qs['offset'](_0x525229['query'][_0xadaf('0x31')]);}return _0x4cb5bf[_0xadaf('0x9f')](_0x59e5f3);}})['then'](function(_0x575540){if(_0x575540){return _0x575540?{'count':_0x15df44,'rows':_0x575540}:null;}})[_0xadaf('0x22')](respondWithResult(_0x113c03,null))[_0xadaf('0x2c')](handleError(_0x113c03,null));};exports[_0xadaf('0xa0')]=function(_0x4b3300,_0x4bea6d,_0x253393){var _0x3cb00e={'raw':!![],'where':{}};var _0x36d623={};var _0x3a0353={'count':0x0,'rows':[]};return db['MailAccount'][_0xadaf('0x6a')]({'where':{'id':_0x4b3300[_0xadaf('0x5e')]['id']}})[_0xadaf('0x22')](handleEntityNotFound(_0x4bea6d,null))[_0xadaf('0x22')](function(_0x534c10){if(_0x534c10){_0x36d623['model']=_[_0xadaf('0x4a')](db[_0xadaf('0xa1')][_0xadaf('0x44')]);_0x36d623[_0xadaf('0x4b')]=_[_0xadaf('0x4a')](_0x4b3300['query']);_0x36d623[_0xadaf('0x55')]=_[_0xadaf('0x4d')](_0x36d623[_0xadaf('0x48')],_0x36d623[_0xadaf('0x4b')]);_0x3cb00e[_0xadaf('0x4c')]=_[_0xadaf('0x4d')](_0x36d623[_0xadaf('0x48')],qs[_0xadaf('0x4e')](_0x4b3300[_0xadaf('0x4b')][_0xadaf('0x4e')]));_0x3cb00e[_0xadaf('0x4c')]=_0x3cb00e[_0xadaf('0x4c')]['length']?_0x3cb00e[_0xadaf('0x4c')]:_0x36d623[_0xadaf('0x48')];if(!_0x4b3300[_0xadaf('0x4b')][_0xadaf('0x50')](_0xadaf('0x51'))){_0x3cb00e[_0xadaf('0x34')]=qs[_0xadaf('0x34')](_0x4b3300[_0xadaf('0x4b')][_0xadaf('0x34')]);_0x3cb00e[_0xadaf('0x31')]=qs[_0xadaf('0x31')](_0x4b3300[_0xadaf('0x4b')][_0xadaf('0x31')]);}_0x3cb00e[_0xadaf('0x52')]=qs[_0xadaf('0x53')](_0x4b3300['query'][_0xadaf('0x53')]);_0x3cb00e[_0xadaf('0x54')]=qs['filters'](_['pick'](_0x4b3300[_0xadaf('0x4b')],_0x36d623[_0xadaf('0x55')]));_0x3cb00e[_0xadaf('0x54')]['MailAccountId']=_0x534c10['id'];if(_0x4b3300[_0xadaf('0x4b')][_0xadaf('0x57')]){_0x3cb00e['where']=_[_0xadaf('0x58')](_0x3cb00e[_0xadaf('0x54')],{'$or':_['map'](_0x3cb00e[_0xadaf('0x4c')],function(_0x402938){var _0x146108={};_0x146108[_0x402938]={'$like':'%'+_0x4b3300[_0xadaf('0x4b')]['filter']+'%'};return _0x146108;})});}if(_0x4b3300[_0xadaf('0x4b')][_0xadaf('0xa2')]){var _0x223dd3=_0x4b3300[_0xadaf('0x4b')][_0xadaf('0xa2')]['split'](',');var _0x1dca48={};_0x1dca48[_0x223dd3[0x0]]={'$gte':moment(_0x223dd3[0x1])[_0xadaf('0xa3')](_0xadaf('0xa4'))};_0x3cb00e[_0xadaf('0x54')]=_[_0xadaf('0x58')](_0x3cb00e[_0xadaf('0x54')],_0x1dca48);}_0x3cb00e=_[_0xadaf('0x58')]({},_0x3cb00e,_0x4b3300['options']);return db[_0xadaf('0xa1')][_0xadaf('0x33')]({'where':_0x3cb00e['where']})[_0xadaf('0x22')](function(_0x5eb450){_0x3a0353[_0xadaf('0x33')]=_0x5eb450;if(_0x4b3300['query'][_0xadaf('0x5b')]){_0x3cb00e[_0xadaf('0x5c')]=[{'all':!![]}];}return db[_0xadaf('0xa1')][_0xadaf('0x6b')](_0x3cb00e);})[_0xadaf('0x22')](function(_0xc4d15){if(_0x4b3300['query'][_0xadaf('0xa5')]==='true'){for(var _0x8a5526=0x0;_0x8a5526<_0xc4d15[_0xadaf('0x4f')];_0x8a5526++){_0xc4d15[_0x8a5526][_0xadaf('0x63')]=juice(_0xc4d15[_0x8a5526][_0xadaf('0x63')]);}}_0x3a0353[_0xadaf('0x5d')]=_0xc4d15;return _0x3a0353;});}})[_0xadaf('0x22')](respondWithFilteredResult(_0x4bea6d,_0x3cb00e))[_0xadaf('0x2c')](handleError(_0x4bea6d,null));};exports[_0xadaf('0x9e')]=function(_0x1eb081,_0x4945f5,_0x4c8def){var _0x2630e3,_0x3ce88e={},_0x3eb5f3;if(_0x1eb081['body']['to']){_0x3eb5f3=_0x1eb081['body']['to'][_0xadaf('0xa6')](',')[0x0];}return db[_0xadaf('0x61')]['find']({'where':{'id':_0x1eb081[_0xadaf('0x5e')]['id']},'include':[{'model':db[_0xadaf('0xa7')],'as':_0xadaf('0xa8'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x3eb5f3},'limit':0x1,'order':[[_0xadaf('0xa9'),'DESC']]}]},{'model':db[_0xadaf('0x41')],'as':_0xadaf('0x42'),'raw':!![]}]})['then'](handleEntityNotFound(_0x4945f5,null))[_0xadaf('0x22')](function(_0xef9aab){if(_0xef9aab){_0x2630e3=_0xef9aab;if(_0xef9aab['Smtp']){if(_['isNil'](_0x1eb081['body'][_0xadaf('0xaa')])){_0x1eb081[_0xadaf('0x63')][_0xadaf('0xaa')]=util[_0xadaf('0xa3')]('%s\x20<%s>',_0xef9aab['name'],_0xef9aab[_0xadaf('0x71')]||_0xef9aab[_0xadaf('0x42')]['user']);}if(_0x1eb081[_0xadaf('0x63')]['attachments']&&_0x1eb081[_0xadaf('0x63')]['attachments'][_0xadaf('0x4f')]){for(var _0xd9dcc1=0x0;_0xd9dcc1<_0x1eb081[_0xadaf('0x63')][_0xadaf('0xab')]['length'];_0xd9dcc1+=0x1){_0x1eb081[_0xadaf('0x63')][_0xadaf('0xab')][_0xd9dcc1]={'filename':_0x1eb081[_0xadaf('0x63')][_0xadaf('0xab')][_0xd9dcc1][_0xadaf('0x3e')],'path':path[_0xadaf('0xac')](config['root'],_0xadaf('0xad'),_0x1eb081[_0xadaf('0x63')][_0xadaf('0xab')][_0xd9dcc1][_0xadaf('0xae')])};}}var _0x5184a2={'tls':{'rejectUnauthorized':![]}};if(_[_0xadaf('0x73')](_0xef9aab[_0xadaf('0x42')][_0xadaf('0x7d')])){if(_0xef9aab[_0xadaf('0x42')][_0xadaf('0x7a')]){_0x5184a2[_0xadaf('0xaf')]={'user':_0xef9aab[_0xadaf('0x42')][_0xadaf('0x76')],'pass':_0xef9aab['Smtp'][_0xadaf('0x78')]};}_0x5184a2[_0xadaf('0x7b')]=_0xef9aab[_0xadaf('0x42')]['host'];_0x5184a2[_0xadaf('0x7c')]=_0xef9aab['Smtp'][_0xadaf('0x7c')];_0x5184a2['secure']=_0xef9aab[_0xadaf('0x42')][_0xadaf('0xb0')];}else{_0x5184a2[_0xadaf('0x7d')]=_0xef9aab[_0xadaf('0x42')][_0xadaf('0x7d')];_0x5184a2[_0xadaf('0xaf')]={'user':_0xef9aab[_0xadaf('0x42')][_0xadaf('0x76')],'pass':_0xef9aab[_0xadaf('0x42')]['pass']};}return respondWithRpcPromise(_0xadaf('0xb1'),'sendMail',{'account':_0x5184a2,'message':_0x1eb081[_0xadaf('0x63')]});}else{throw new Error(_0xadaf('0xb2'));}}})['then'](function(_0x3afd11){if(_0x3afd11){_0x3ce88e=_0x3afd11;if(_0x2630e3[_0xadaf('0xa8')]){if(_0x2630e3[_0xadaf('0xa8')][_0xadaf('0xb3')][_0xadaf('0x4f')]){return _0x2630e3[_0xadaf('0xa8')][_0xadaf('0xb3')][0x0];}else{return db['CmContact'][_0xadaf('0x68')](_[_0xadaf('0x1c')](_0x1eb081[_0xadaf('0x63')],{'firstName':_0x1eb081[_0xadaf('0x63')]['to'],'email':_0x1eb081[_0xadaf('0x63')]['to'],'phone':_0x1eb081[_0xadaf('0x63')]['to'],'ListId':_0x2630e3[_0xadaf('0x72')]}));}}else{throw new Error(_0xadaf('0xb2'));}}})[_0xadaf('0x22')](function(_0x12a1a0){if(_0x12a1a0){var _0x4bb5e1={'UserId':_0x1eb081[_0xadaf('0x76')]['id'],'ContactId':_0x12a1a0['id'],'MailAccountId':_0x2630e3['id'],'inReplyTo':_0x3ce88e[_0xadaf('0xb4')],'to':_0x1eb081['body']['from'],'cc':_0x1eb081[_0xadaf('0x63')]['cc'],'subject':_0x1eb081['body'][_0xadaf('0xb5')],'attach':_0x1eb081[_0xadaf('0x63')][_0xadaf('0xb6')],'firstMsgDirection':_0xadaf('0xb7'),'lastMsgAt':moment()[_0xadaf('0xa3')](_0xadaf('0xa4')),'lastMsgDirection':_0xadaf('0xb7'),'Messages':[_[_0xadaf('0x58')](_0x1eb081['body'],{'messageId':_0x3ce88e['messageId'],'sentAt':moment()[_0xadaf('0xa3')](_0xadaf('0xa4')),'read':!![],'MailAccountId':_0x2630e3['id'],'UserId':_0x1eb081[_0xadaf('0x76')]['id'],'ContactId':_0x12a1a0['id']})]};if(_0x1eb081[_0xadaf('0x63')][_0xadaf('0xb8')]){_0x4bb5e1=_[_0xadaf('0x58')](_0x4bb5e1,_0x1eb081[_0xadaf('0x63')][_0xadaf('0xb8')]);}return db[_0xadaf('0x8b')][_0xadaf('0x68')](_0x4bb5e1,{'include':[{'model':db[_0xadaf('0xa1')],'as':_0xadaf('0xb9')}]});}})[_0xadaf('0x22')](respondWithResult(_0x4945f5,null))[_0xadaf('0x2c')](handleError(_0x4945f5,null));};exports['verifySmtp']=function(_0x5ec99d,_0x59fd1b,_0x2ab7b3){return db[_0xadaf('0x61')][_0xadaf('0x62')]({'where':{'id':_0x5ec99d['params']['id']},'include':[{'model':db[_0xadaf('0x41')],'as':_0xadaf('0x42'),'raw':!![]}]})[_0xadaf('0x22')](handleEntityNotFound(_0x59fd1b,null))[_0xadaf('0x22')](function(_0x365b68){if(_0x365b68&&_0x365b68[_0xadaf('0x42')]){var _0x50a033={'id':_0x365b68['id'],'tls':{'rejectUnauthorized':![]}};if(_0x365b68[_0xadaf('0x42')][_0xadaf('0x7d')]){_0x50a033['service']=_0x365b68['Smtp'][_0xadaf('0x7d')];}else{_0x50a033[_0xadaf('0x7b')]=_0x365b68['Smtp']['host'];_0x50a033[_0xadaf('0x7c')]=_0x365b68['Smtp'][_0xadaf('0x7c')];_0x50a033[_0xadaf('0xb0')]=_0x365b68[_0xadaf('0x42')][_0xadaf('0xb0')];}if(_0x365b68[_0xadaf('0x42')][_0xadaf('0x7a')]){_0x50a033['auth']={'user':_0x365b68[_0xadaf('0x42')][_0xadaf('0x76')],'pass':_0x365b68['Smtp'][_0xadaf('0x78')]};}return respondWithRpcPromise(_0xadaf('0xba'),_0xadaf('0xbb'),{'account':_0x50a033});}})[_0xadaf('0x22')](respondWithResult(_0x59fd1b,null))[_0xadaf('0x2c')](handleError(_0x59fd1b,null));};exports[_0xadaf('0x3a')]=function(_0x4ad755,_0x2c3960){return db['MailAccount']['find']({'where':{'id':_0x4ad755[_0xadaf('0x5e')]['id']}})[_0xadaf('0x22')](handleEntityNotFound(_0x2c3960,null))[_0xadaf('0x22')](function(_0x548532){if(_0x548532&&_0x548532[_0xadaf('0x7d')]){throw new db[(_0xadaf('0xbc'))]['ValidationError'](_0xadaf('0xbd'));}return _0x548532;})[_0xadaf('0x22')](removeEntity(_0x2c3960,null))[_0xadaf('0x2c')](handleError(_0x2c3960,null));};exports[_0xadaf('0xbe')]=function(_0xc349db,_0x18cd68,_0xf77f69){return db['MailAccount'][_0xadaf('0x62')]({'where':{'id':_0xc349db[_0xadaf('0x5e')]['id']}})[_0xadaf('0x22')](handleEntityNotFound(_0x18cd68,null))[_0xadaf('0x22')](function(_0x1054a3){if(_0x1054a3){return _0x1054a3[_0xadaf('0xbe')](_0xc349db[_0xadaf('0x63')][_0xadaf('0x6d')],_[_0xadaf('0xbf')](_0xc349db['body'],[_0xadaf('0x6d'),'id'])||{})[_0xadaf('0xc0')](function(_0x6f52f5){for(var _0x4f93b8=0x0;_0x4f93b8<_0xc349db[_0xadaf('0x63')][_0xadaf('0x6d')][_0xadaf('0x4f')];_0x4f93b8+=0x1){socket[_0xadaf('0xc1')](_0xadaf('0xc2'),{'UserId':Number(_0xc349db[_0xadaf('0x63')]['ids'][_0x4f93b8]),'MailAccountId':Number(_0xc349db['params']['id'])});}return _0x6f52f5;});}})['then'](respondWithResult(_0x18cd68,null))[_0xadaf('0x2c')](handleError(_0x18cd68,null));};exports[_0xadaf('0xc3')]=function(_0x5e21a3,_0x2d5341,_0x32fa08){return db['MailAccount'][_0xadaf('0x62')]({'where':{'id':_0x5e21a3[_0xadaf('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2d5341,null))[_0xadaf('0x22')](function(_0xad8e21){if(_0xad8e21){return _0xad8e21[_0xadaf('0xc3')](_0x5e21a3['query']['ids'])[_0xadaf('0x22')](function(){if(_[_0xadaf('0xc4')](_0x5e21a3[_0xadaf('0x4b')][_0xadaf('0x6d')])){for(var _0x1b2a44=0x0;_0x1b2a44<_0x5e21a3[_0xadaf('0x4b')][_0xadaf('0x6d')][_0xadaf('0x4f')];_0x1b2a44+=0x1){socket[_0xadaf('0xc1')](_0xadaf('0xc5'),{'UserId':Number(_0x5e21a3[_0xadaf('0x4b')]['ids'][_0x1b2a44]),'MailAccountId':Number(_0x5e21a3[_0xadaf('0x5e')]['id'])});}}else{socket[_0xadaf('0xc1')](_0xadaf('0xc5'),{'UserId':Number(_0x5e21a3[_0xadaf('0x4b')]['ids']),'MailAccountId':Number(_0x5e21a3['params']['id'])});}});}})[_0xadaf('0x22')](respondWithStatusCode(_0x2d5341,null))[_0xadaf('0x2c')](handleError(_0x2d5341,null));};exports['getAgents']=function(_0x211eda,_0xc14bb6,_0xfec3aa){var _0x3690be={};var _0x12216c={};var _0x16de13;var _0x5b134c;return db['MailAccount'][_0xadaf('0x6a')]({'where':{'id':_0x211eda['params']['id']}})['then'](handleEntityNotFound(_0xc14bb6,null))[_0xadaf('0x22')](function(_0x1db89a){if(_0x1db89a){_0x16de13=_0x1db89a;_0x12216c[_0xadaf('0x48')]=_['keys'](db[_0xadaf('0xc6')]['rawAttributes']);_0x12216c[_0xadaf('0x4b')]=_[_0xadaf('0x4a')](_0x211eda['query']);_0x12216c[_0xadaf('0x55')]=_[_0xadaf('0x4d')](_0x12216c[_0xadaf('0x48')],_0x12216c[_0xadaf('0x4b')]);_0x3690be[_0xadaf('0x4c')]=_[_0xadaf('0x4d')](_0x12216c[_0xadaf('0x48')],qs[_0xadaf('0x4e')](_0x211eda['query'][_0xadaf('0x4e')]));_0x3690be[_0xadaf('0x4c')]=_0x3690be[_0xadaf('0x4c')]['length']?_0x3690be[_0xadaf('0x4c')]:_0x12216c[_0xadaf('0x48')];_0x3690be[_0xadaf('0x52')]=qs[_0xadaf('0x53')](_0x211eda['query'][_0xadaf('0x53')]);_0x3690be[_0xadaf('0x54')]=qs['filters'](_[_0xadaf('0x56')](_0x211eda[_0xadaf('0x4b')],_0x12216c['filters']));if(_0x211eda['query'][_0xadaf('0x57')]){_0x3690be['where']=_[_0xadaf('0x58')](_0x3690be['where'],{'$or':_[_0xadaf('0x49')](_0x3690be['attributes'],function(_0x12730d){var _0xd877e8={};_0xd877e8[_0x12730d]={'$like':'%'+_0x211eda[_0xadaf('0x4b')][_0xadaf('0x57')]+'%'};return _0xd877e8;})});}_0x3690be=_['merge']({},_0x3690be,_0x211eda['options']);return _0x16de13['getAgents'](_0x3690be);}})['then'](function(_0x59cf5f){if(_0x59cf5f){_0x5b134c=_0x59cf5f[_0xadaf('0x4f')];if(!_0x211eda['query'][_0xadaf('0x50')](_0xadaf('0x51'))){_0x3690be[_0xadaf('0x34')]=qs[_0xadaf('0x34')](_0x211eda[_0xadaf('0x4b')]['limit']);_0x3690be['offset']=qs[_0xadaf('0x31')](_0x211eda[_0xadaf('0x4b')]['offset']);}return _0x16de13[_0xadaf('0xc7')](_0x3690be);}})['then'](function(_0x3e4526){if(_0x3e4526){return _0x3e4526?{'count':_0x5b134c,'rows':_0x3e4526}:null;}})[_0xadaf('0x22')](respondWithResult(_0xc14bb6,null))['catch'](handleError(_0xc14bb6,null));}; \ No newline at end of file +var _0xa20b=['cpassword','authentication','host','port','service','pass','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','getInteractions','rawAttributes','CmContact','Contact','Owner','fullname','Tag','Tags','tag','sequelize','transaction','ISOLATION_LEVELS','MailApplication','finally','getApplications','getMessages','MailMessage','$gte','split','inlineCss','true','List','Contacts','updatedAt','from','format','%s\x20<%s>','email','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','defaults','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','messageId','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./mailAccount.socket','register','jayson/promise','client','http','info','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','MailAccount,\x20%s,\x20%s','status','end','undefined','limit','count','offset','set','json','apply','reject','save','update','destroy','get','MailAccounts','UserProfileResource','then','sendStatus','stack','name','send','index','MailServerIn','Imap','Smtp','mandatoryDispositionPause','type','key','map','keys','query','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','where','filters','filter','merge','VIRTUAL','options','MailAccount','include','findAll','rows','show','MailServerOut','Pause','includeAll','find','body','params','describe','addDisposition','MailAccountId','Disposition','create','findOne','sort','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','ListId','isNil','active','cauthentication','user','cuser','password'];(function(_0x3158ac,_0x26bbab){var _0xdea395=function(_0x373f26){while(--_0x373f26){_0x3158ac['push'](_0x3158ac['shift']());}};_0xdea395(++_0x26bbab);}(_0xa20b,0x10e));var _0xba20=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa20b[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xba20('0x0'));var zipdir=require(_0xba20('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xba20('0x2'));var moment=require('moment');var BPromise=require(_0xba20('0x3'));var Mustache=require(_0xba20('0x4'));var util=require(_0xba20('0x5'));var path=require(_0xba20('0x6'));var sox=require(_0xba20('0x7'));var csv=require(_0xba20('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xba20('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xba20('0xa'));var jsforce=require(_0xba20('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xba20('0x8'));var querystring=require(_0xba20('0xc'));var Papa=require(_0xba20('0xd'));var htmlToText=require('html-to-text');var juice=require('juice');var Redis=require(_0xba20('0xe'));var authService=require(_0xba20('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xba20('0x10'));var hardwareService=require(_0xba20('0x11'));var logger=require(_0xba20('0x12'))(_0xba20('0x13'));var utils=require('../../config/utils');var config=require(_0xba20('0x14'));var licenseUtil=require(_0xba20('0x15'));var db=require(_0xba20('0x16'))['db'];config[_0xba20('0x17')]=_['defaults'](config['redis'],{'host':_0xba20('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xba20('0x17')]));require(_0xba20('0x19'))[_0xba20('0x1a')](socket);var jayson=require(_0xba20('0x1b'));var client=jayson[_0xba20('0x1c')][_0xba20('0x1d')]({'port':0x232b});function respondWithRpcPromise(_0x55f01d,_0x5d9642,_0x3b0038,_0x252948){return new BPromise(function(_0x3f6950,_0x4ebd6b){var _0x1440fb=_0x252948||client;return _0x1440fb['request'](_0x55f01d,_0x3b0038)['then'](function(_0x363e81){logger[_0xba20('0x1e')]('MailAccount,\x20%s,\x20%s',_0x5d9642,'request\x20sent');logger[_0xba20('0x1f')](_0xba20('0x20'),_0x5d9642,_0xba20('0x21'),JSON['stringify'](_0x363e81));if(_0x363e81[_0xba20('0x22')]){if(_0x363e81[_0xba20('0x22')][_0xba20('0x23')]===0x1f4){logger[_0xba20('0x22')]('MailAccount,\x20%s,\x20%s',_0x5d9642,_0x363e81[_0xba20('0x22')][_0xba20('0x24')]);return _0x4ebd6b(_0x363e81[_0xba20('0x22')][_0xba20('0x24')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x5d9642,_0x363e81[_0xba20('0x22')][_0xba20('0x24')]);return _0x3f6950(_0x363e81[_0xba20('0x22')]['message']);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x5d9642,_0xba20('0x21'));_0x3f6950(_0x363e81['result']['message']);}})[_0xba20('0x25')](function(_0xb91e6a){logger['error'](_0xba20('0x26'),_0x5d9642,_0xb91e6a);_0x4ebd6b(_0xb91e6a);});});}function respondWithStatusCode(_0x23b729,_0x248339){_0x248339=_0x248339||0xcc;return function(_0x252de3){if(_0x252de3){return _0x23b729['sendStatus'](_0x248339);}return _0x23b729[_0xba20('0x27')](_0x248339)[_0xba20('0x28')]();};}function respondWithResult(_0x1096bf,_0x2e6ff9){_0x2e6ff9=_0x2e6ff9||0xc8;return function(_0x4d7a34){if(_0x4d7a34){return _0x1096bf[_0xba20('0x27')](_0x2e6ff9)['json'](_0x4d7a34);}};}function respondWithFilteredResult(_0x317f52,_0x523877){return function(_0xbca3ff){if(_0xbca3ff){var _0x3cc1ee=typeof _0x523877['offset']===_0xba20('0x29')&&typeof _0x523877[_0xba20('0x2a')]===_0xba20('0x29');var _0x591fac=_0xbca3ff[_0xba20('0x2b')];var _0x54ec41=_0x3cc1ee?0x0:_0x523877[_0xba20('0x2c')];var _0x462fab=_0x3cc1ee?_0xbca3ff['count']:_0x523877[_0xba20('0x2c')]+_0x523877[_0xba20('0x2a')];var _0x430873;if(_0x462fab>=_0x591fac){_0x462fab=_0x591fac;_0x430873=0xc8;}else{_0x430873=0xce;}_0x317f52[_0xba20('0x27')](_0x430873);return _0x317f52[_0xba20('0x2d')]('Content-Range',_0x54ec41+'-'+_0x462fab+'/'+_0x591fac)[_0xba20('0x2e')](_0xbca3ff);}return null;};}function patchUpdates(_0x43e5e0){return function(_0x46c698){try{jsonpatch[_0xba20('0x2f')](_0x46c698,_0x43e5e0,!![]);}catch(_0x2d237f){return BPromise[_0xba20('0x30')](_0x2d237f);}return _0x46c698[_0xba20('0x31')]();};}function saveUpdates(_0xdf5e84,_0x15ce64){return function(_0x3e1400){if(_0x3e1400){return _0x3e1400[_0xba20('0x32')](_0xdf5e84)['then'](function(_0x5bc650){return _0x5bc650;});}return null;};}function removeEntity(_0x33a23b,_0x5d37cc){return function(_0x127581){if(_0x127581){return _0x127581[_0xba20('0x33')]()['then'](function(){var _0x48cdf2=_0x127581[_0xba20('0x34')]({'plain':!![]});var _0x2bf287=_0xba20('0x35');return db[_0xba20('0x36')][_0xba20('0x33')]({'where':{'type':_0x2bf287,'resourceId':_0x48cdf2['id']}})[_0xba20('0x37')](function(){return _0x127581;});})[_0xba20('0x37')](function(){_0x33a23b[_0xba20('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x192505,_0x36b947){return function(_0x263f43){if(!_0x263f43){_0x192505[_0xba20('0x38')](0x194);}return _0x263f43;};}function handleError(_0x3fd077,_0x265f25){_0x265f25=_0x265f25||0x1f4;return function(_0x2fe276){logger[_0xba20('0x22')](_0x2fe276[_0xba20('0x39')]);if(_0x2fe276[_0xba20('0x3a')]){delete _0x2fe276[_0xba20('0x3a')];}_0x3fd077[_0xba20('0x27')](_0x265f25)[_0xba20('0x3b')](_0x2fe276);};}exports[_0xba20('0x3c')]=function(_0x2b114e,_0x3f21e3){var _0x106508={'include':[{'model':db[_0xba20('0x3d')],'as':_0xba20('0x3e')},{'model':db['MailServerOut'],'as':_0xba20('0x3f')},{'model':db['Pause'],'as':_0xba20('0x40')}]},_0x69f563={},_0x3a9812={'count':0x0,'rows':[]};var _0xd3db0=_['map'](db['MailAccount']['rawAttributes'],function(_0x3afd13){return{'name':_0x3afd13['fieldName'],'type':_0x3afd13[_0xba20('0x41')][_0xba20('0x42')]};});_0x69f563['model']=_[_0xba20('0x43')](_0xd3db0,_0xba20('0x3a'));_0x69f563['query']=_[_0xba20('0x44')](_0x2b114e[_0xba20('0x45')]);_0x69f563['filters']=_[_0xba20('0x46')](_0x69f563['model'],_0x69f563[_0xba20('0x45')]);_0x106508[_0xba20('0x47')]=_[_0xba20('0x46')](_0x69f563['model'],qs[_0xba20('0x48')](_0x2b114e[_0xba20('0x45')][_0xba20('0x48')]));_0x106508[_0xba20('0x47')]=_0x106508[_0xba20('0x47')][_0xba20('0x49')]?_0x106508[_0xba20('0x47')]:_0x69f563[_0xba20('0x4a')];if(!_0x2b114e[_0xba20('0x45')][_0xba20('0x4b')](_0xba20('0x4c'))){_0x106508[_0xba20('0x2a')]=qs[_0xba20('0x2a')](_0x2b114e[_0xba20('0x45')]['limit']);_0x106508[_0xba20('0x2c')]=qs[_0xba20('0x2c')](_0x2b114e[_0xba20('0x45')]['offset']);}_0x106508[_0xba20('0x4d')]=qs['sort'](_0x2b114e[_0xba20('0x45')]['sort']);_0x106508[_0xba20('0x4e')]=qs[_0xba20('0x4f')](_['pick'](_0x2b114e[_0xba20('0x45')],_0x69f563[_0xba20('0x4f')]),_0xd3db0);if(_0x2b114e[_0xba20('0x45')][_0xba20('0x50')]){_0x106508['where']=_[_0xba20('0x51')](_0x106508[_0xba20('0x4e')],{'$or':_['map'](_0xd3db0,function(_0x2b8549){if(_0x2b8549[_0xba20('0x41')]!==_0xba20('0x52')){var _0x55dec9={};_0x55dec9[_0x2b8549[_0xba20('0x3a')]]={'$like':'%'+_0x2b114e[_0xba20('0x45')]['filter']+'%'};return _0x55dec9;}})});}_0x106508=_[_0xba20('0x51')]({},_0x106508,_0x2b114e[_0xba20('0x53')]);var _0x908d60={'where':_0x106508['where']};return db[_0xba20('0x54')]['count'](_0x908d60)[_0xba20('0x37')](function(_0x31d9c0){_0x3a9812[_0xba20('0x2b')]=_0x31d9c0;if(_0x2b114e[_0xba20('0x45')]['includeAll']){_0x106508[_0xba20('0x55')]=[{'all':!![]}];}return db['MailAccount'][_0xba20('0x56')](_0x106508);})[_0xba20('0x37')](function(_0x480f2b){_0x3a9812[_0xba20('0x57')]=_0x480f2b;return _0x3a9812;})[_0xba20('0x37')](respondWithFilteredResult(_0x3f21e3,_0x106508))[_0xba20('0x25')](handleError(_0x3f21e3,null));};exports[_0xba20('0x58')]=function(_0x2660b3,_0xe3aa8a){var _0x1519b2={'raw':![],'where':{'id':_0x2660b3['params']['id']},'include':[{'model':db[_0xba20('0x3d')],'as':_0xba20('0x3e')},{'model':db[_0xba20('0x59')],'as':_0xba20('0x3f')},{'model':db[_0xba20('0x5a')],'as':'mandatoryDispositionPause'}]},_0x1952a8={};_0x1952a8[_0xba20('0x4a')]=_[_0xba20('0x44')](db[_0xba20('0x54')]['rawAttributes']);_0x1952a8[_0xba20('0x45')]=_[_0xba20('0x44')](_0x2660b3[_0xba20('0x45')]);_0x1952a8[_0xba20('0x4f')]=_[_0xba20('0x46')](_0x1952a8[_0xba20('0x4a')],_0x1952a8[_0xba20('0x45')]);_0x1519b2[_0xba20('0x47')]=_['intersection'](_0x1952a8['model'],qs[_0xba20('0x48')](_0x2660b3[_0xba20('0x45')][_0xba20('0x48')]));_0x1519b2[_0xba20('0x47')]=_0x1519b2[_0xba20('0x47')][_0xba20('0x49')]?_0x1519b2[_0xba20('0x47')]:_0x1952a8[_0xba20('0x4a')];if(_0x2660b3['query'][_0xba20('0x5b')]){_0x1519b2[_0xba20('0x55')]=[{'all':!![]}];}_0x1519b2=_[_0xba20('0x51')]({},_0x1519b2,_0x2660b3[_0xba20('0x53')]);return db[_0xba20('0x54')][_0xba20('0x5c')](_0x1519b2)['then'](handleEntityNotFound(_0xe3aa8a,null))[_0xba20('0x37')](respondWithResult(_0xe3aa8a,null))['catch'](handleError(_0xe3aa8a,null));};exports[_0xba20('0x32')]=function(_0x20e8bc,_0x259680){if(_0x20e8bc[_0xba20('0x5d')]['id']){delete _0x20e8bc['body']['id'];}return db[_0xba20('0x54')][_0xba20('0x5c')]({'where':{'id':_0x20e8bc[_0xba20('0x5e')]['id']},'include':[{'model':db[_0xba20('0x3d')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0xba20('0x3f')},{'model':db['Pause'],'as':_0xba20('0x40')}]})[_0xba20('0x37')](handleEntityNotFound(_0x259680,null))[_0xba20('0x37')](saveUpdates(_0x20e8bc['body'],null))[_0xba20('0x37')](function(_0x1307fc){if(_0x1307fc&&_0x20e8bc['body']['Imap']){return db[_0xba20('0x3d')]['update'](_0x20e8bc[_0xba20('0x5d')]['Imap'],{'where':{'MailAccountId':_0x1307fc['id']}})[_0xba20('0x37')](function(){return _0x1307fc;});}return _0x1307fc;})[_0xba20('0x37')](function(_0x387c21){if(_0x387c21&&_0x20e8bc[_0xba20('0x5d')][_0xba20('0x3f')]){return db[_0xba20('0x59')][_0xba20('0x32')](_0x20e8bc[_0xba20('0x5d')][_0xba20('0x3f')],{'where':{'MailAccountId':_0x387c21['id']}})[_0xba20('0x37')](function(){return _0x387c21;});}return _0x387c21;})[_0xba20('0x37')](respondWithResult(_0x259680,null))[_0xba20('0x25')](handleError(_0x259680,null));};exports[_0xba20('0x5f')]=function(_0x369227,_0x1009bf){return db[_0xba20('0x54')]['describe']()[_0xba20('0x37')](respondWithResult(_0x1009bf,null))[_0xba20('0x25')](handleError(_0x1009bf,null));};exports[_0xba20('0x60')]=function(_0x5ccd53,_0x3c4a7d,_0x563b30){if(_0x5ccd53[_0xba20('0x5d')]['id']){delete _0x5ccd53[_0xba20('0x5d')]['id'];}return db[_0xba20('0x54')][_0xba20('0x5c')]({'where':{'id':_0x5ccd53['params']['id']}})[_0xba20('0x37')](handleEntityNotFound(_0x3c4a7d,null))[_0xba20('0x37')](function(_0x27f3cc){if(_0x27f3cc){_0x5ccd53[_0xba20('0x5d')][_0xba20('0x61')]=_0x27f3cc['id'];return db[_0xba20('0x62')][_0xba20('0x63')](_0x5ccd53[_0xba20('0x5d')]);}})[_0xba20('0x37')](respondWithResult(_0x3c4a7d,null))[_0xba20('0x25')](handleError(_0x3c4a7d,null));};exports['getDispositions']=function(_0x557007,_0x431387,_0x3a6799){var _0x5a8f84={'raw':![],'where':{}};var _0x2a80ba={};var _0x5e35ac={'count':0x0,'rows':[]};return db[_0xba20('0x54')][_0xba20('0x64')]({'where':{'id':_0x557007[_0xba20('0x5e')]['id']}})[_0xba20('0x37')](handleEntityNotFound(_0x431387,null))['then'](function(_0x3efc15){if(_0x3efc15){_0x2a80ba[_0xba20('0x4a')]=_[_0xba20('0x44')](db[_0xba20('0x62')]['rawAttributes']);_0x2a80ba[_0xba20('0x45')]=_['keys'](_0x557007[_0xba20('0x45')]);_0x2a80ba[_0xba20('0x4f')]=_[_0xba20('0x46')](_0x2a80ba['model'],_0x2a80ba[_0xba20('0x45')]);_0x5a8f84[_0xba20('0x47')]=_['intersection'](_0x2a80ba['model'],qs[_0xba20('0x48')](_0x557007[_0xba20('0x45')][_0xba20('0x48')]));_0x5a8f84['attributes']=_0x5a8f84['attributes'][_0xba20('0x49')]?_0x5a8f84[_0xba20('0x47')]:_0x2a80ba[_0xba20('0x4a')];if(!_0x557007[_0xba20('0x45')]['hasOwnProperty'](_0xba20('0x4c'))){_0x5a8f84[_0xba20('0x2a')]=qs['limit'](_0x557007[_0xba20('0x45')][_0xba20('0x2a')]);_0x5a8f84[_0xba20('0x2c')]=qs[_0xba20('0x2c')](_0x557007[_0xba20('0x45')][_0xba20('0x2c')]);}_0x5a8f84[_0xba20('0x4d')]=qs[_0xba20('0x65')](_0x557007[_0xba20('0x45')][_0xba20('0x65')]);_0x5a8f84[_0xba20('0x4e')]=qs['filters'](_[_0xba20('0x66')](_0x557007[_0xba20('0x45')],_0x2a80ba[_0xba20('0x4f')]));_0x5a8f84[_0xba20('0x4e')][_0xba20('0x61')]=_0x3efc15['id'];if(_0x557007[_0xba20('0x45')]['filter']){_0x5a8f84[_0xba20('0x4e')]=_['merge'](_0x5a8f84[_0xba20('0x4e')],{'$or':_[_0xba20('0x43')](_0x5a8f84[_0xba20('0x47')],function(_0x46f3ec){var _0x25a7fd={};_0x25a7fd[_0x46f3ec]={'$like':'%'+_0x557007[_0xba20('0x45')][_0xba20('0x50')]+'%'};return _0x25a7fd;})});}_0x5a8f84=_[_0xba20('0x51')]({},_0x5a8f84,_0x557007[_0xba20('0x53')]);return db[_0xba20('0x62')][_0xba20('0x2b')]({'where':_0x5a8f84[_0xba20('0x4e')]})[_0xba20('0x37')](function(_0x3caea7){_0x5e35ac[_0xba20('0x2b')]=_0x3caea7;if(_0x557007[_0xba20('0x45')]['includeAll']){_0x5a8f84[_0xba20('0x55')]=[{'all':!![]}];}return db['Disposition'][_0xba20('0x56')](_0x5a8f84);})[_0xba20('0x37')](function(_0x199b31){_0x5e35ac[_0xba20('0x57')]=_0x199b31;return _0x5e35ac;});}})[_0xba20('0x37')](respondWithFilteredResult(_0x431387,_0x5a8f84))[_0xba20('0x25')](handleError(_0x431387,null));};exports[_0xba20('0x67')]=function(_0x3be8ed,_0x26a7e2,_0x29769b){return db[_0xba20('0x54')][_0xba20('0x5c')]({'where':{'id':_0x3be8ed['params']['id']}})[_0xba20('0x37')](handleEntityNotFound(_0x26a7e2,null))['then'](function(_0x31c677){if(_0x31c677){return _0x31c677['removeDispositions'](_0x3be8ed[_0xba20('0x45')][_0xba20('0x68')]);}})['then'](respondWithStatusCode(_0x26a7e2,null))[_0xba20('0x25')](handleError(_0x26a7e2,null));};exports[_0xba20('0x69')]=function(_0x2b2f7a,_0x482054,_0x3e5026){if(_0x2b2f7a[_0xba20('0x5d')]['id']){delete _0x2b2f7a[_0xba20('0x5d')]['id'];}return db['MailAccount'][_0xba20('0x5c')]({'where':{'id':_0x2b2f7a[_0xba20('0x5e')]['id']}})['then'](handleEntityNotFound(_0x482054,null))[_0xba20('0x37')](function(_0x1caad8){if(_0x1caad8){_0x2b2f7a[_0xba20('0x5d')][_0xba20('0x61')]=_0x1caad8['id'];return db[_0xba20('0x6a')]['create'](_0x2b2f7a['body']);}})[_0xba20('0x37')](respondWithResult(_0x482054,null))['catch'](handleError(_0x482054,null));};exports[_0xba20('0x6b')]=function(_0x125e9,_0xfc08c7,_0x581889){var _0xdc678b={'raw':![],'where':{}};var _0x4997d9={};var _0x3e2411={'count':0x0,'rows':[]};return db[_0xba20('0x54')][_0xba20('0x64')]({'where':{'id':_0x125e9[_0xba20('0x5e')]['id']}})[_0xba20('0x37')](handleEntityNotFound(_0xfc08c7,null))[_0xba20('0x37')](function(_0x209b75){if(_0x209b75){_0x4997d9['model']=_[_0xba20('0x44')](db[_0xba20('0x6a')]['rawAttributes']);_0x4997d9[_0xba20('0x45')]=_[_0xba20('0x44')](_0x125e9[_0xba20('0x45')]);_0x4997d9[_0xba20('0x4f')]=_[_0xba20('0x46')](_0x4997d9['model'],_0x4997d9[_0xba20('0x45')]);_0xdc678b[_0xba20('0x47')]=_[_0xba20('0x46')](_0x4997d9[_0xba20('0x4a')],qs[_0xba20('0x48')](_0x125e9[_0xba20('0x45')][_0xba20('0x48')]));_0xdc678b[_0xba20('0x47')]=_0xdc678b['attributes'][_0xba20('0x49')]?_0xdc678b[_0xba20('0x47')]:_0x4997d9[_0xba20('0x4a')];if(!_0x125e9[_0xba20('0x45')]['hasOwnProperty']('nolimit')){_0xdc678b[_0xba20('0x2a')]=qs[_0xba20('0x2a')](_0x125e9[_0xba20('0x45')][_0xba20('0x2a')]);_0xdc678b['offset']=qs[_0xba20('0x2c')](_0x125e9['query'][_0xba20('0x2c')]);}_0xdc678b[_0xba20('0x4d')]=qs[_0xba20('0x65')](_0x125e9[_0xba20('0x45')][_0xba20('0x65')]);_0xdc678b[_0xba20('0x4e')]=qs[_0xba20('0x4f')](_[_0xba20('0x66')](_0x125e9[_0xba20('0x45')],_0x4997d9[_0xba20('0x4f')]));_0xdc678b[_0xba20('0x4e')][_0xba20('0x61')]=_0x209b75['id'];if(_0x125e9[_0xba20('0x45')][_0xba20('0x50')]){_0xdc678b['where']=_['merge'](_0xdc678b['where'],{'$or':_[_0xba20('0x43')](_0xdc678b[_0xba20('0x47')],function(_0x4857d6){var _0x25b2ed={};_0x25b2ed[_0x4857d6]={'$like':'%'+_0x125e9[_0xba20('0x45')][_0xba20('0x50')]+'%'};return _0x25b2ed;})});}_0xdc678b=_['merge']({},_0xdc678b,_0x125e9['options']);return db[_0xba20('0x6a')][_0xba20('0x2b')]({'where':_0xdc678b[_0xba20('0x4e')]})['then'](function(_0x4756d6){_0x3e2411['count']=_0x4756d6;if(_0x125e9[_0xba20('0x45')][_0xba20('0x5b')]){_0xdc678b[_0xba20('0x55')]=[{'all':!![]}];}return db[_0xba20('0x6a')][_0xba20('0x56')](_0xdc678b);})[_0xba20('0x37')](function(_0x20da95){_0x3e2411[_0xba20('0x57')]=_0x20da95;return _0x3e2411;});}})[_0xba20('0x37')](respondWithFilteredResult(_0xfc08c7,_0xdc678b))[_0xba20('0x25')](handleError(_0xfc08c7,null));};exports[_0xba20('0x6c')]=function(_0x12cbdb,_0x19fc00,_0x4fd979){return db[_0xba20('0x54')][_0xba20('0x5c')]({'where':{'id':_0x12cbdb[_0xba20('0x5e')]['id']}})['then'](handleEntityNotFound(_0x19fc00,null))[_0xba20('0x37')](function(_0x44d1e8){if(_0x44d1e8){return _0x44d1e8[_0xba20('0x6c')](_0x12cbdb[_0xba20('0x45')][_0xba20('0x68')]);}})[_0xba20('0x37')](respondWithStatusCode(_0x19fc00,null))[_0xba20('0x25')](handleError(_0x19fc00,null));};exports[_0xba20('0x63')]=function(_0x1da2f2,_0x20e534){var _0x22d5c2={'name':_0x1da2f2['body'][_0xba20('0x3a')],'key':_0x1da2f2[_0xba20('0x5d')][_0xba20('0x42')],'email':_0x1da2f2[_0xba20('0x5d')]['email'],'ListId':_0x1da2f2[_0xba20('0x5d')][_0xba20('0x6d')],'active':!_[_0xba20('0x6e')](_0x1da2f2[_0xba20('0x5d')][_0xba20('0x6f')])?_0x1da2f2[_0xba20('0x5d')][_0xba20('0x6f')]:!![],'description':_0x1da2f2[_0xba20('0x5d')]['description']||null,'Imap':{},'Smtp':{}};if(_[_0xba20('0x6e')](_0x1da2f2[_0xba20('0x5d')]['cservice'])){if(_0x1da2f2['body'][_0xba20('0x70')]){_0x22d5c2[_0xba20('0x3e')]['user']=_0x22d5c2[_0xba20('0x3f')][_0xba20('0x71')]=_0x1da2f2[_0xba20('0x5d')][_0xba20('0x72')];_0x22d5c2[_0xba20('0x3e')][_0xba20('0x73')]=_0x22d5c2[_0xba20('0x3f')]['pass']=_0x1da2f2['body'][_0xba20('0x74')];}else{_0x22d5c2[_0xba20('0x3e')][_0xba20('0x75')]=_0x22d5c2[_0xba20('0x3f')][_0xba20('0x75')]=![];}_0x22d5c2[_0xba20('0x3e')][_0xba20('0x76')]=_0x1da2f2[_0xba20('0x5d')][_0xba20('0x3e')]['host'];_0x22d5c2[_0xba20('0x3e')][_0xba20('0x77')]=_0x1da2f2[_0xba20('0x5d')][_0xba20('0x3e')]['port'];_0x22d5c2[_0xba20('0x3f')][_0xba20('0x76')]=_0x1da2f2[_0xba20('0x5d')]['Smtp'][_0xba20('0x76')];_0x22d5c2[_0xba20('0x3f')][_0xba20('0x77')]=_0x1da2f2[_0xba20('0x5d')][_0xba20('0x3f')][_0xba20('0x77')];}else{_0x22d5c2[_0xba20('0x3e')][_0xba20('0x78')]=_0x22d5c2[_0xba20('0x3f')][_0xba20('0x78')]=_0x1da2f2['body']['cservice'];_0x22d5c2[_0xba20('0x3e')]['user']=_0x22d5c2[_0xba20('0x3f')][_0xba20('0x71')]=_0x1da2f2[_0xba20('0x5d')][_0xba20('0x72')];_0x22d5c2[_0xba20('0x3e')]['password']=_0x22d5c2[_0xba20('0x3f')][_0xba20('0x79')]=_0x1da2f2[_0xba20('0x5d')]['cpassword'];}return db[_0xba20('0x54')][_0xba20('0x63')](_0x22d5c2,{'include':[{'model':db[_0xba20('0x59')],'as':_0xba20('0x3f')},{'model':db[_0xba20('0x3d')],'as':'Imap'}]})[_0xba20('0x37')](function(_0xfe1529){var _0x1a24ec=_0x1da2f2[_0xba20('0x71')][_0xba20('0x34')]({'plain':!![]});if(!_0x1a24ec)throw new Error(_0xba20('0x7a'));if(_0x1a24ec['role']===_0xba20('0x71')){var _0x40b5da=_0xfe1529[_0xba20('0x34')]({'plain':!![]});return db[_0xba20('0x7b')][_0xba20('0x5c')]({'where':{'name':_0xba20('0x35'),'userProfileId':_0x1a24ec[_0xba20('0x7c')]},'raw':!![]})[_0xba20('0x37')](function(_0x1a054a){if(_0x1a054a&&_0x1a054a['autoAssociation']===0x0){return db['UserProfileResource'][_0xba20('0x63')]({'name':_0x40b5da[_0xba20('0x3a')],'resourceId':_0x40b5da['id'],'type':_0x1a054a[_0xba20('0x3a')],'sectionId':_0x1a054a['id']},{})['then'](function(){return _0xfe1529;});}else{return _0xfe1529;}})[_0xba20('0x25')](function(_0x51544a){logger[_0xba20('0x22')](_0xba20('0x7d'),_0x51544a);throw _0x51544a;});}return _0xfe1529;})[_0xba20('0x37')](respondWithResult(_0x20e534,0xc9))[_0xba20('0x25')](handleError(_0x20e534,null));};exports[_0xba20('0x7e')]=function(_0x3b6850,_0x1fe392,_0x19d1bb){return db[_0xba20('0x54')][_0xba20('0x64')]({'where':{'id':_0x3b6850[_0xba20('0x5e')]['id']}})[_0xba20('0x37')](handleEntityNotFound(_0x1fe392,null))[_0xba20('0x37')](function(_0x3b8659){if(_0x3b8659){return _0x3b8659[_0xba20('0x7e')]();}return null;})['then'](respondWithResult(_0x1fe392,null))['catch'](handleError(_0x1fe392,null));};exports[_0xba20('0x7f')]=function(_0x107953,_0x5106c3,_0xde0ebf){if(_0x107953[_0xba20('0x5d')]['id']){delete _0x107953[_0xba20('0x5d')]['id'];}return db['MailAccount'][_0xba20('0x5c')]({'where':{'id':_0x107953[_0xba20('0x5e')]['id']}})[_0xba20('0x37')](handleEntityNotFound(_0x5106c3,null))[_0xba20('0x37')](function(_0x259587){if(_0x259587){_0x107953['body'][_0xba20('0x61')]=_0x259587['id'];return db[_0xba20('0x3d')][_0xba20('0x63')](_0x107953[_0xba20('0x5d')]);}})[_0xba20('0x37')](respondWithResult(_0x5106c3,null))[_0xba20('0x25')](handleError(_0x5106c3,null));};exports['removeImap']=function(_0x262f5e,_0x947b52,_0x24c471){return db['MailAccount'][_0xba20('0x64')]({'where':{'id':_0x262f5e[_0xba20('0x5e')]['id']}})[_0xba20('0x37')](handleEntityNotFound(_0x947b52,null))['then'](function(_0x3c5191){if(_0x3c5191){return _0x3c5191[_0xba20('0x80')](null);}return null;})[_0xba20('0x37')](respondWithStatusCode(_0x947b52,null))[_0xba20('0x25')](handleError(_0x947b52,null));};exports[_0xba20('0x81')]=function(_0x285d9c,_0x5ec3f7,_0x1fa62a){return db['MailAccount']['findOne']({'where':{'id':_0x285d9c[_0xba20('0x5e')]['id']}})[_0xba20('0x37')](handleEntityNotFound(_0x5ec3f7,null))['then'](function(_0x514149){if(_0x514149){return _0x514149[_0xba20('0x81')]();}return null;})[_0xba20('0x37')](respondWithResult(_0x5ec3f7,null))[_0xba20('0x25')](handleError(_0x5ec3f7,null));};exports['addSmtp']=function(_0x556e4a,_0x4adc51,_0x8f33ab){if(_0x556e4a[_0xba20('0x5d')]['id']){delete _0x556e4a['body']['id'];}return db[_0xba20('0x54')][_0xba20('0x5c')]({'where':{'id':_0x556e4a[_0xba20('0x5e')]['id']}})[_0xba20('0x37')](handleEntityNotFound(_0x4adc51,null))[_0xba20('0x37')](function(_0x431cac){if(_0x431cac){_0x556e4a[_0xba20('0x5d')][_0xba20('0x61')]=_0x431cac['id'];return db[_0xba20('0x59')][_0xba20('0x63')](_0x556e4a[_0xba20('0x5d')]);}})[_0xba20('0x37')](respondWithResult(_0x4adc51,null))[_0xba20('0x25')](handleError(_0x4adc51,null));};exports[_0xba20('0x82')]=function(_0x26bb8a,_0x30c6e8,_0x509c6a){return db[_0xba20('0x54')][_0xba20('0x64')]({'where':{'id':_0x26bb8a[_0xba20('0x5e')]['id']}})[_0xba20('0x37')](handleEntityNotFound(_0x30c6e8,null))['then'](function(_0x4ccb9a){if(_0x4ccb9a){return _0x4ccb9a[_0xba20('0x83')](null);}return null;})['then'](respondWithStatusCode(_0x30c6e8,null))[_0xba20('0x25')](handleError(_0x30c6e8,null));};exports['addInteraction']=function(_0x3cbbb3,_0xa15f83,_0x5c3d9f){return db[_0xba20('0x84')]['find']({'where':{'id':_0x3cbbb3[_0xba20('0x5e')]['id']}})[_0xba20('0x37')](handleEntityNotFound(_0xa15f83,null))[_0xba20('0x37')](function(_0x6ec5af){if(_0x6ec5af){return _0x6ec5af[_0xba20('0x85')](_0x3cbbb3[_0xba20('0x5d')]['ids'],_[_0xba20('0x86')](_0x3cbbb3['body'],['ids','id'])||{});}})['then'](respondWithResult(_0xa15f83,null))[_0xba20('0x25')](handleError(_0xa15f83,null));};exports[_0xba20('0x87')]=function(_0x16547a,_0x3f182e,_0x43e878){var _0x4f32da={'raw':![],'where':{}};var _0x13eb3e={};var _0x3d2703={'count':0x0,'rows':[]};return db[_0xba20('0x54')][_0xba20('0x64')]({'where':{'id':_0x16547a[_0xba20('0x5e')]['id']}})[_0xba20('0x37')](handleEntityNotFound(_0x3f182e,null))[_0xba20('0x37')](function(_0xc4cfa7){if(_0xc4cfa7){_0x13eb3e[_0xba20('0x4a')]=_['keys'](db['MailInteraction'][_0xba20('0x88')]);_0x13eb3e[_0xba20('0x45')]=_[_0xba20('0x44')](_0x16547a[_0xba20('0x45')]);_0x13eb3e[_0xba20('0x4f')]=_[_0xba20('0x46')](_0x13eb3e[_0xba20('0x4a')],_0x13eb3e['query']);_0x4f32da[_0xba20('0x47')]=_[_0xba20('0x46')](_0x13eb3e[_0xba20('0x4a')],qs['fields'](_0x16547a[_0xba20('0x45')][_0xba20('0x48')]));_0x4f32da[_0xba20('0x47')]=_0x4f32da[_0xba20('0x47')][_0xba20('0x49')]?_0x4f32da[_0xba20('0x47')]:_0x13eb3e[_0xba20('0x4a')];if(!_0x16547a['query']['hasOwnProperty']('nolimit')){_0x4f32da[_0xba20('0x2a')]=qs[_0xba20('0x2a')](_0x16547a[_0xba20('0x45')][_0xba20('0x2a')]);_0x4f32da['offset']=qs[_0xba20('0x2c')](_0x16547a[_0xba20('0x45')][_0xba20('0x2c')]);}_0x4f32da['order']=qs[_0xba20('0x65')](_0x16547a[_0xba20('0x45')]['sort']);_0x4f32da[_0xba20('0x4e')]=qs['filters'](_[_0xba20('0x66')](_0x16547a[_0xba20('0x45')],_0x13eb3e[_0xba20('0x4f')]));_0x4f32da[_0xba20('0x4e')][_0xba20('0x61')]=_0xc4cfa7['id'];if(_0x16547a[_0xba20('0x45')][_0xba20('0x50')]){_0x4f32da[_0xba20('0x4e')]=_[_0xba20('0x51')](_0x4f32da[_0xba20('0x4e')],{'$or':_['map'](_0x4f32da[_0xba20('0x47')],function(_0x26cb2c){var _0x46ea9f={};_0x46ea9f[_0x26cb2c]={'$like':'%'+_0x16547a['query'][_0xba20('0x50')]+'%'};return _0x46ea9f;})});}_0x4f32da=_[_0xba20('0x51')]({},_0x4f32da,_0x16547a['options']);return db[_0xba20('0x84')][_0xba20('0x2b')]({'where':_0x4f32da[_0xba20('0x4e')]})['then'](function(_0x5c4c14){_0x3d2703[_0xba20('0x2b')]=_0x5c4c14;if(_0x16547a[_0xba20('0x45')][_0xba20('0x5b')]){_0x4f32da[_0xba20('0x55')]=[{'model':db[_0xba20('0x89')],'as':_0xba20('0x8a'),'required':![]},{'model':db['User'],'as':_0xba20('0x8b'),'attributes':[_0xba20('0x3a'),_0xba20('0x8c'),'internal'],'required':![]},{'model':db[_0xba20('0x8d')],'as':_0xba20('0x8e'),'attributes':['id',_0xba20('0x3a'),'color'],'where':_0x16547a[_0xba20('0x45')][_0xba20('0x8f')]?{'id':_0x16547a[_0xba20('0x45')]['tag']}:undefined,'required':_0x16547a[_0xba20('0x45')][_0xba20('0x8f')]?!![]:![]}];}return db[_0xba20('0x84')][_0xba20('0x56')](_0x4f32da);})[_0xba20('0x37')](function(_0x1b5cd9){_0x3d2703[_0xba20('0x57')]=_0x1b5cd9;return _0x3d2703;});}})[_0xba20('0x37')](respondWithFilteredResult(_0x3f182e,_0x4f32da))['catch'](handleError(_0x3f182e,null));};exports['addApplications']=function addApplications(_0x1776bd,_0x34d509){var _0x47f5b1=_0x1776bd[_0xba20('0x5e')]['id'];var _0x15277f=_0x1776bd[_0xba20('0x5d')];var _0x42ce93=0xc8;var _0x54285c=null;return db[_0xba20('0x90')][_0xba20('0x91')]({'isolationLevel':db['sequelize']['Transaction'][_0xba20('0x92')]['READ_COMMITTED']},function(_0x197560){return db[_0xba20('0x54')][_0xba20('0x64')]({'where':{'id':_0x47f5b1},'transaction':_0x197560})[_0xba20('0x37')](function(_0x4654be){if(_0x4654be){return db[_0xba20('0x93')][_0xba20('0x33')]({'where':{'MailAccountId':_0x47f5b1},'transaction':_0x197560})[_0xba20('0x37')](function(){var _0x5e86a8=_[_0xba20('0x43')](_0x15277f,function(_0x1d089a){_0x1d089a[_0xba20('0x61')]=_0x47f5b1;return _0x1d089a;});return db[_0xba20('0x93')]['bulkCreate'](_0x5e86a8,{'transaction':_0x197560});});}else{_0x42ce93=0x194;_0x54285c=[];}});})[_0xba20('0x37')](function(){if(_0x42ce93!==0x194){return db['MailApplication']['findAndCountAll']({'where':{'MailAccountId':_0x47f5b1},'order':'priority'})[_0xba20('0x37')](function(_0x357c97){_0x54285c=_0x357c97;});}})[_0xba20('0x25')](function(_0x1e6afd){_0x42ce93=0x1f4;logger[_0xba20('0x22')](_0x1e6afd[_0xba20('0x39')]);if(_0x1e6afd[_0xba20('0x3a')]){delete _0x1e6afd['name'];}_0x54285c=_0x1e6afd;})[_0xba20('0x94')](function(){if(_0x54285c===null){_0x34d509[_0xba20('0x38')](_0x42ce93);}else{if(_0x42ce93===0x1f4){_0x34d509[_0xba20('0x27')](_0x42ce93)[_0xba20('0x3b')](_0x54285c);}else{_0x34d509[_0xba20('0x27')](_0x42ce93)[_0xba20('0x2e')](_0x54285c);}}});};exports[_0xba20('0x95')]=function(_0x4b7f71,_0x440684,_0x370dc2){var _0x4dbe4c={};var _0x4a0773={};var _0x53c648;var _0x50e69b;return db[_0xba20('0x54')]['findOne']({'where':{'id':_0x4b7f71[_0xba20('0x5e')]['id']}})['then'](handleEntityNotFound(_0x440684,null))[_0xba20('0x37')](function(_0x4f17f7){if(_0x4f17f7){_0x53c648=_0x4f17f7;_0x4a0773['model']=_['keys'](db[_0xba20('0x93')]['rawAttributes']);_0x4a0773['query']=_[_0xba20('0x44')](_0x4b7f71[_0xba20('0x45')]);_0x4a0773[_0xba20('0x4f')]=_[_0xba20('0x46')](_0x4a0773['model'],_0x4a0773[_0xba20('0x45')]);_0x4dbe4c[_0xba20('0x47')]=_[_0xba20('0x46')](_0x4a0773['model'],qs[_0xba20('0x48')](_0x4b7f71['query'][_0xba20('0x48')]));_0x4dbe4c[_0xba20('0x47')]=_0x4dbe4c[_0xba20('0x47')]['length']?_0x4dbe4c[_0xba20('0x47')]:_0x4a0773[_0xba20('0x4a')];_0x4dbe4c[_0xba20('0x4d')]=qs['sort'](_0x4b7f71[_0xba20('0x45')][_0xba20('0x65')]);_0x4dbe4c[_0xba20('0x4e')]=qs[_0xba20('0x4f')](_['pick'](_0x4b7f71[_0xba20('0x45')],_0x4a0773[_0xba20('0x4f')]));if(_0x4b7f71['query'][_0xba20('0x50')]){_0x4dbe4c['where']=_[_0xba20('0x51')](_0x4dbe4c[_0xba20('0x4e')],{'$or':_[_0xba20('0x43')](_0x4dbe4c[_0xba20('0x47')],function(_0x363696){var _0x52a929={};_0x52a929[_0x363696]={'$like':'%'+_0x4b7f71['query'][_0xba20('0x50')]+'%'};return _0x52a929;})});}_0x4dbe4c=_['merge']({},_0x4dbe4c,_0x4b7f71[_0xba20('0x53')]);return _0x53c648['getApplications'](_0x4dbe4c);}})[_0xba20('0x37')](function(_0x13e35b){if(_0x13e35b){_0x50e69b=_0x13e35b['length'];if(!_0x4b7f71[_0xba20('0x45')][_0xba20('0x4b')](_0xba20('0x4c'))){_0x4dbe4c[_0xba20('0x2a')]=qs[_0xba20('0x2a')](_0x4b7f71[_0xba20('0x45')]['limit']);_0x4dbe4c[_0xba20('0x2c')]=qs[_0xba20('0x2c')](_0x4b7f71[_0xba20('0x45')][_0xba20('0x2c')]);}return _0x53c648['getApplications'](_0x4dbe4c);}})[_0xba20('0x37')](function(_0x19d5e1){if(_0x19d5e1){return _0x19d5e1?{'count':_0x50e69b,'rows':_0x19d5e1}:null;}})['then'](respondWithResult(_0x440684,null))['catch'](handleError(_0x440684,null));};exports[_0xba20('0x96')]=function(_0x549311,_0x16794e,_0x4a5117){var _0x37bd0c={'raw':!![],'where':{}};var _0x5e3442={};var _0x2071c7={'count':0x0,'rows':[]};return db[_0xba20('0x54')][_0xba20('0x64')]({'where':{'id':_0x549311[_0xba20('0x5e')]['id']}})[_0xba20('0x37')](handleEntityNotFound(_0x16794e,null))['then'](function(_0x34e470){if(_0x34e470){_0x5e3442[_0xba20('0x4a')]=_['keys'](db[_0xba20('0x97')][_0xba20('0x88')]);_0x5e3442[_0xba20('0x45')]=_[_0xba20('0x44')](_0x549311[_0xba20('0x45')]);_0x5e3442[_0xba20('0x4f')]=_[_0xba20('0x46')](_0x5e3442[_0xba20('0x4a')],_0x5e3442['query']);_0x37bd0c[_0xba20('0x47')]=_[_0xba20('0x46')](_0x5e3442[_0xba20('0x4a')],qs[_0xba20('0x48')](_0x549311[_0xba20('0x45')][_0xba20('0x48')]));_0x37bd0c['attributes']=_0x37bd0c[_0xba20('0x47')][_0xba20('0x49')]?_0x37bd0c[_0xba20('0x47')]:_0x5e3442[_0xba20('0x4a')];if(!_0x549311['query'][_0xba20('0x4b')](_0xba20('0x4c'))){_0x37bd0c[_0xba20('0x2a')]=qs['limit'](_0x549311[_0xba20('0x45')][_0xba20('0x2a')]);_0x37bd0c[_0xba20('0x2c')]=qs[_0xba20('0x2c')](_0x549311[_0xba20('0x45')]['offset']);}_0x37bd0c[_0xba20('0x4d')]=qs['sort'](_0x549311['query'][_0xba20('0x65')]);_0x37bd0c[_0xba20('0x4e')]=qs[_0xba20('0x4f')](_['pick'](_0x549311[_0xba20('0x45')],_0x5e3442[_0xba20('0x4f')]));_0x37bd0c[_0xba20('0x4e')][_0xba20('0x61')]=_0x34e470['id'];if(_0x549311[_0xba20('0x45')][_0xba20('0x50')]){_0x37bd0c['where']=_[_0xba20('0x51')](_0x37bd0c['where'],{'$or':_['map'](_0x37bd0c['attributes'],function(_0x22b346){var _0x44bcf3={};_0x44bcf3[_0x22b346]={'$like':'%'+_0x549311[_0xba20('0x45')][_0xba20('0x50')]+'%'};return _0x44bcf3;})});}if(_0x549311[_0xba20('0x45')]['$gte']){var _0x120c29=_0x549311['query'][_0xba20('0x98')][_0xba20('0x99')](',');var _0x50be4b={};_0x50be4b[_0x120c29[0x0]]={'$gte':moment(_0x120c29[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x37bd0c[_0xba20('0x4e')]=_[_0xba20('0x51')](_0x37bd0c[_0xba20('0x4e')],_0x50be4b);}_0x37bd0c=_[_0xba20('0x51')]({},_0x37bd0c,_0x549311['options']);return db[_0xba20('0x97')][_0xba20('0x2b')]({'where':_0x37bd0c[_0xba20('0x4e')]})[_0xba20('0x37')](function(_0x58a7a9){_0x2071c7[_0xba20('0x2b')]=_0x58a7a9;if(_0x549311[_0xba20('0x45')][_0xba20('0x5b')]){_0x37bd0c['include']=[{'all':!![]}];}return db['MailMessage'][_0xba20('0x56')](_0x37bd0c);})['then'](function(_0x128842){if(_0x549311[_0xba20('0x45')][_0xba20('0x9a')]===_0xba20('0x9b')){for(var _0x31d2b8=0x0;_0x31d2b8<_0x128842[_0xba20('0x49')];_0x31d2b8++){_0x128842[_0x31d2b8][_0xba20('0x5d')]=juice(_0x128842[_0x31d2b8]['body']);}}_0x2071c7[_0xba20('0x57')]=_0x128842;return _0x2071c7;});}})[_0xba20('0x37')](respondWithFilteredResult(_0x16794e,_0x37bd0c))[_0xba20('0x25')](handleError(_0x16794e,null));};exports[_0xba20('0x3b')]=function(_0x4164f0,_0x3b227a,_0x25b567){var _0x245d8e,_0x15c8bf={},_0x48081f;if(_0x4164f0[_0xba20('0x5d')]['to']){_0x48081f=_0x4164f0[_0xba20('0x5d')]['to'][_0xba20('0x99')](',')[0x0];}return db[_0xba20('0x54')][_0xba20('0x5c')]({'where':{'id':_0x4164f0[_0xba20('0x5e')]['id']},'include':[{'model':db['CmList'],'as':_0xba20('0x9c'),'include':[{'model':db[_0xba20('0x89')],'as':_0xba20('0x9d'),'where':{'email':_0x48081f},'limit':0x1,'order':[[_0xba20('0x9e'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0xba20('0x3f'),'raw':!![]}]})[_0xba20('0x37')](handleEntityNotFound(_0x3b227a,null))[_0xba20('0x37')](function(_0x17cc43){if(_0x17cc43){_0x245d8e=_0x17cc43;if(_0x17cc43['Smtp']){if(_[_0xba20('0x6e')](_0x4164f0['body'][_0xba20('0x9f')])){_0x4164f0[_0xba20('0x5d')][_0xba20('0x9f')]=util[_0xba20('0xa0')](_0xba20('0xa1'),_0x17cc43['name'],_0x17cc43[_0xba20('0xa2')]||_0x17cc43['Smtp'][_0xba20('0x71')]);}if(_0x4164f0[_0xba20('0x5d')][_0xba20('0xa3')]&&_0x4164f0[_0xba20('0x5d')][_0xba20('0xa3')][_0xba20('0x49')]){for(var _0x598c91=0x0;_0x598c91<_0x4164f0['body'][_0xba20('0xa3')][_0xba20('0x49')];_0x598c91+=0x1){_0x4164f0[_0xba20('0x5d')][_0xba20('0xa3')][_0x598c91]={'filename':_0x4164f0[_0xba20('0x5d')][_0xba20('0xa3')][_0x598c91]['name'],'path':path[_0xba20('0xa4')](config[_0xba20('0xa5')],_0xba20('0xa6'),_0x4164f0[_0xba20('0x5d')][_0xba20('0xa3')][_0x598c91][_0xba20('0xa7')])};}}var _0x53144a={'tls':{'rejectUnauthorized':![]}};if(_[_0xba20('0x6e')](_0x17cc43[_0xba20('0x3f')][_0xba20('0x78')])){if(_0x17cc43['Smtp']['authentication']){_0x53144a[_0xba20('0xa8')]={'user':_0x17cc43['Smtp']['user'],'pass':_0x17cc43[_0xba20('0x3f')][_0xba20('0x79')]};}_0x53144a[_0xba20('0x76')]=_0x17cc43['Smtp']['host'];_0x53144a[_0xba20('0x77')]=_0x17cc43[_0xba20('0x3f')][_0xba20('0x77')];_0x53144a[_0xba20('0xa9')]=_0x17cc43[_0xba20('0x3f')][_0xba20('0xa9')];}else{_0x53144a[_0xba20('0x78')]=_0x17cc43['Smtp']['service'];_0x53144a[_0xba20('0xa8')]={'user':_0x17cc43[_0xba20('0x3f')][_0xba20('0x71')],'pass':_0x17cc43[_0xba20('0x3f')][_0xba20('0x79')]};}return respondWithRpcPromise(_0xba20('0xaa'),_0xba20('0xab'),{'account':_0x53144a,'message':_0x4164f0[_0xba20('0x5d')]});}else{throw new Error(_0xba20('0xac'));}}})['then'](function(_0xce8b2b){if(_0xce8b2b){_0x15c8bf=_0xce8b2b;if(_0x245d8e[_0xba20('0x9c')]){if(_0x245d8e[_0xba20('0x9c')][_0xba20('0x9d')][_0xba20('0x49')]){return _0x245d8e[_0xba20('0x9c')][_0xba20('0x9d')][0x0];}else{return db[_0xba20('0x89')]['create'](_[_0xba20('0xad')](_0x4164f0[_0xba20('0x5d')],{'firstName':_0x4164f0['body']['to'],'email':_0x4164f0[_0xba20('0x5d')]['to'],'phone':_0x4164f0[_0xba20('0x5d')]['to'],'ListId':_0x245d8e['ListId']}));}}else{throw new Error(_0xba20('0xac'));}}})['then'](function(_0x33f31e){if(_0x33f31e){var _0x102a67={'UserId':_0x4164f0[_0xba20('0x71')]['id'],'ContactId':_0x33f31e['id'],'MailAccountId':_0x245d8e['id'],'inReplyTo':_0x15c8bf['messageId'],'to':_0x4164f0[_0xba20('0x5d')][_0xba20('0x9f')],'cc':_0x4164f0[_0xba20('0x5d')]['cc'],'subject':_0x4164f0[_0xba20('0x5d')][_0xba20('0xae')],'attach':_0x4164f0[_0xba20('0x5d')][_0xba20('0xaf')],'firstMsgDirection':_0xba20('0xb0'),'lastMsgAt':moment()[_0xba20('0xa0')](_0xba20('0xb1')),'lastMsgDirection':'out','Messages':[_[_0xba20('0x51')](_0x4164f0['body'],{'messageId':_0x15c8bf[_0xba20('0xb2')],'sentAt':moment()['format'](_0xba20('0xb1')),'read':!![],'MailAccountId':_0x245d8e['id'],'UserId':_0x4164f0[_0xba20('0x71')]['id'],'ContactId':_0x33f31e['id']})]};if(_0x4164f0['body'][_0xba20('0xb3')]){_0x102a67=_[_0xba20('0x51')](_0x102a67,_0x4164f0['body'][_0xba20('0xb3')]);}return db[_0xba20('0x84')][_0xba20('0x63')](_0x102a67,{'include':[{'model':db['MailMessage'],'as':_0xba20('0xb4')}]});}})[_0xba20('0x37')](respondWithResult(_0x3b227a,null))[_0xba20('0x25')](handleError(_0x3b227a,null));};exports[_0xba20('0xb5')]=function(_0x1e23d3,_0x3cf045,_0x3cca5c){return db[_0xba20('0x54')][_0xba20('0x5c')]({'where':{'id':_0x1e23d3[_0xba20('0x5e')]['id']},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0xba20('0x37')](handleEntityNotFound(_0x3cf045,null))[_0xba20('0x37')](function(_0x53d5e0){if(_0x53d5e0&&_0x53d5e0[_0xba20('0x3f')]){var _0x428e89={'id':_0x53d5e0['id'],'tls':{'rejectUnauthorized':![]}};if(_0x53d5e0[_0xba20('0x3f')][_0xba20('0x78')]){_0x428e89[_0xba20('0x78')]=_0x53d5e0[_0xba20('0x3f')]['service'];}else{_0x428e89[_0xba20('0x76')]=_0x53d5e0[_0xba20('0x3f')][_0xba20('0x76')];_0x428e89[_0xba20('0x77')]=_0x53d5e0['Smtp'][_0xba20('0x77')];_0x428e89[_0xba20('0xa9')]=_0x53d5e0['Smtp'][_0xba20('0xa9')];}if(_0x53d5e0[_0xba20('0x3f')][_0xba20('0x75')]){_0x428e89[_0xba20('0xa8')]={'user':_0x53d5e0[_0xba20('0x3f')][_0xba20('0x71')],'pass':_0x53d5e0[_0xba20('0x3f')][_0xba20('0x79')]};}return respondWithRpcPromise(_0xba20('0xb6'),_0xba20('0xb5'),{'account':_0x428e89});}})[_0xba20('0x37')](respondWithResult(_0x3cf045,null))[_0xba20('0x25')](handleError(_0x3cf045,null));};exports[_0xba20('0x33')]=function(_0x1ba09f,_0x560f79){return db[_0xba20('0x54')]['find']({'where':{'id':_0x1ba09f[_0xba20('0x5e')]['id']}})[_0xba20('0x37')](handleEntityNotFound(_0x560f79,null))[_0xba20('0x37')](function(_0x413620){if(_0x413620&&_0x413620[_0xba20('0x78')]){throw new db[(_0xba20('0xb7'))]['ValidationError'](_0xba20('0xb8'));}return _0x413620;})['then'](removeEntity(_0x560f79,null))[_0xba20('0x25')](handleError(_0x560f79,null));};exports[_0xba20('0xb9')]=function(_0x3526d4,_0x3981f7,_0x4d238f){return db['MailAccount'][_0xba20('0x5c')]({'where':{'id':_0x3526d4['params']['id']}})[_0xba20('0x37')](handleEntityNotFound(_0x3981f7,null))[_0xba20('0x37')](function(_0x3fdf44){if(_0x3fdf44){return _0x3fdf44[_0xba20('0xb9')](_0x3526d4[_0xba20('0x5d')]['ids'],_[_0xba20('0x86')](_0x3526d4['body'],[_0xba20('0x68'),'id'])||{})[_0xba20('0xba')](function(_0x57e4d5){for(var _0x25833e=0x0;_0x25833e<_0x3526d4[_0xba20('0x5d')][_0xba20('0x68')][_0xba20('0x49')];_0x25833e+=0x1){socket[_0xba20('0xbb')](_0xba20('0xbc'),{'UserId':Number(_0x3526d4[_0xba20('0x5d')]['ids'][_0x25833e]),'MailAccountId':Number(_0x3526d4[_0xba20('0x5e')]['id'])});}return _0x57e4d5;});}})[_0xba20('0x37')](respondWithResult(_0x3981f7,null))[_0xba20('0x25')](handleError(_0x3981f7,null));};exports[_0xba20('0xbd')]=function(_0x4cb2ec,_0x2bdc2f,_0x21d7d3){return db[_0xba20('0x54')][_0xba20('0x5c')]({'where':{'id':_0x4cb2ec['params']['id']}})[_0xba20('0x37')](handleEntityNotFound(_0x2bdc2f,null))['then'](function(_0x2d633a){if(_0x2d633a){return _0x2d633a[_0xba20('0xbd')](_0x4cb2ec[_0xba20('0x45')][_0xba20('0x68')])[_0xba20('0x37')](function(){if(_[_0xba20('0xbe')](_0x4cb2ec[_0xba20('0x45')][_0xba20('0x68')])){for(var _0x2c0a7d=0x0;_0x2c0a7d<_0x4cb2ec[_0xba20('0x45')][_0xba20('0x68')][_0xba20('0x49')];_0x2c0a7d+=0x1){socket[_0xba20('0xbb')](_0xba20('0xbf'),{'UserId':Number(_0x4cb2ec['query']['ids'][_0x2c0a7d]),'MailAccountId':Number(_0x4cb2ec[_0xba20('0x5e')]['id'])});}}else{socket[_0xba20('0xbb')]('userMailAccount:remove',{'UserId':Number(_0x4cb2ec[_0xba20('0x45')]['ids']),'MailAccountId':Number(_0x4cb2ec[_0xba20('0x5e')]['id'])});}});}})['then'](respondWithStatusCode(_0x2bdc2f,null))[_0xba20('0x25')](handleError(_0x2bdc2f,null));};exports[_0xba20('0xc0')]=function(_0x394e96,_0x411ecf,_0x37a926){var _0x5034c4={};var _0x77ee77={};var _0x574125;var _0xa2e5ce;return db[_0xba20('0x54')][_0xba20('0x64')]({'where':{'id':_0x394e96[_0xba20('0x5e')]['id']}})['then'](handleEntityNotFound(_0x411ecf,null))[_0xba20('0x37')](function(_0x4347b8){if(_0x4347b8){_0x574125=_0x4347b8;_0x77ee77[_0xba20('0x4a')]=_['keys'](db['User'][_0xba20('0x88')]);_0x77ee77['query']=_[_0xba20('0x44')](_0x394e96['query']);_0x77ee77[_0xba20('0x4f')]=_[_0xba20('0x46')](_0x77ee77[_0xba20('0x4a')],_0x77ee77[_0xba20('0x45')]);_0x5034c4[_0xba20('0x47')]=_[_0xba20('0x46')](_0x77ee77[_0xba20('0x4a')],qs[_0xba20('0x48')](_0x394e96[_0xba20('0x45')]['fields']));_0x5034c4[_0xba20('0x47')]=_0x5034c4['attributes']['length']?_0x5034c4[_0xba20('0x47')]:_0x77ee77['model'];_0x5034c4[_0xba20('0x4d')]=qs[_0xba20('0x65')](_0x394e96[_0xba20('0x45')][_0xba20('0x65')]);_0x5034c4[_0xba20('0x4e')]=qs[_0xba20('0x4f')](_['pick'](_0x394e96[_0xba20('0x45')],_0x77ee77['filters']));if(_0x394e96[_0xba20('0x45')][_0xba20('0x50')]){_0x5034c4[_0xba20('0x4e')]=_[_0xba20('0x51')](_0x5034c4['where'],{'$or':_[_0xba20('0x43')](_0x5034c4['attributes'],function(_0x22a160){var _0x4a9033={};_0x4a9033[_0x22a160]={'$like':'%'+_0x394e96['query'][_0xba20('0x50')]+'%'};return _0x4a9033;})});}_0x5034c4=_[_0xba20('0x51')]({},_0x5034c4,_0x394e96[_0xba20('0x53')]);return _0x574125[_0xba20('0xc0')](_0x5034c4);}})[_0xba20('0x37')](function(_0x1b9537){if(_0x1b9537){_0xa2e5ce=_0x1b9537[_0xba20('0x49')];if(!_0x394e96[_0xba20('0x45')]['hasOwnProperty'](_0xba20('0x4c'))){_0x5034c4[_0xba20('0x2a')]=qs['limit'](_0x394e96[_0xba20('0x45')][_0xba20('0x2a')]);_0x5034c4[_0xba20('0x2c')]=qs[_0xba20('0x2c')](_0x394e96[_0xba20('0x45')][_0xba20('0x2c')]);}return _0x574125[_0xba20('0xc0')](_0x5034c4);}})[_0xba20('0x37')](function(_0x5a8560){if(_0x5a8560){return _0x5a8560?{'count':_0xa2e5ce,'rows':_0x5a8560}:null;}})[_0xba20('0x37')](respondWithResult(_0x411ecf,null))[_0xba20('0x25')](handleError(_0x411ecf,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index a02c620..a293500 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 _0x1ae7=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners'];(function(_0x532e6f,_0x4fa3c2){var _0x23600e=function(_0x160730){while(--_0x160730){_0x532e6f['push'](_0x532e6f['shift']());}};_0x23600e(++_0x4fa3c2);}(_0x1ae7,0x150));var _0x71ae=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x1ae7[_0x5b644e];return _0x49c6bf;};'use strict';var EventEmitter=require(_0x71ae('0x0'));var MailAccount=require(_0x71ae('0x1'))['db'][_0x71ae('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x71ae('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x71ae('0x4'),'afterDestroy':_0x71ae('0x5')};function emitEvent(_0xd66f7d){return function(_0x3182e1,_0x4d6fa7,_0x573837){MailAccountEvents[_0x71ae('0x6')](_0xd66f7d+':'+_0x3182e1['id'],_0x3182e1);MailAccountEvents['emit'](_0xd66f7d,_0x3182e1);_0x573837(null);};}for(var e in events){if(events[_0x71ae('0x7')](e)){var event=events[e];MailAccount[_0x71ae('0x8')](e,emitEvent(event));}}module[_0x71ae('0x9')]=MailAccountEvents; \ No newline at end of file +var _0x49fe=['remove','emit','hasOwnProperty','hook','exports','events','save','update'];(function(_0x5e6f73,_0x3f27d8){var _0x432614=function(_0x56e42d){while(--_0x56e42d){_0x5e6f73['push'](_0x5e6f73['shift']());}};_0x432614(++_0x3f27d8);}(_0x49fe,0x75));var _0xe49f=function(_0x3f1bea,_0x4a53f4){_0x3f1bea=_0x3f1bea-0x0;var _0x552865=_0x49fe[_0x3f1bea];return _0x552865;};'use strict';var EventEmitter=require(_0xe49f('0x0'));var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe49f('0x1'),'afterUpdate':_0xe49f('0x2'),'afterDestroy':_0xe49f('0x3')};function emitEvent(_0xb99c7){return function(_0x1cac40,_0x2db0ec,_0x1235f4){MailAccountEvents[_0xe49f('0x4')](_0xb99c7+':'+_0x1cac40['id'],_0x1cac40);MailAccountEvents[_0xe49f('0x4')](_0xb99c7,_0x1cac40);_0x1235f4(null);};}for(var e in events){if(events[_0xe49f('0x5')](e)){var event=events[e];MailAccount[_0xe49f('0x6')](e,emitEvent(event));}}module[_0xe49f('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index b83a4b7..8945981 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 _0x11db=['define','MailAccount','lodash','util','api','moment','bluebird','request-promise','./mailAccount.attributes'];(function(_0x1baf21,_0x41f45d){var _0x373f34=function(_0x1a00b4){while(--_0x1a00b4){_0x1baf21['push'](_0x1baf21['shift']());}};_0x373f34(++_0x41f45d);}(_0x11db,0x9b));var _0xb11d=function(_0x4a4922,_0x82cb8f){_0x4a4922=_0x4a4922-0x0;var _0x55a8c6=_0x11db[_0x4a4922];return _0x55a8c6;};'use strict';var _=require(_0xb11d('0x0'));var util=require(_0xb11d('0x1'));var logger=require('../../config/logger')(_0xb11d('0x2'));var moment=require(_0xb11d('0x3'));var BPromise=require(_0xb11d('0x4'));var rp=require(_0xb11d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb11d('0x6'));module['exports']=function(_0x399123,_0x8e0098){return _0x399123[_0xb11d('0x7')](_0xb11d('0x8'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6675=['lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports','mail_accounts'];(function(_0x144b30,_0x77072d){var _0x1bb7bc=function(_0x1082cc){while(--_0x1082cc){_0x144b30['push'](_0x144b30['shift']());}};_0x1bb7bc(++_0x77072d);}(_0x6675,0x1e0));var _0x5667=function(_0x3da77a,_0x21a70f){_0x3da77a=_0x3da77a-0x0;var _0x46cf5b=_0x6675[_0x3da77a];return _0x46cf5b;};'use strict';var _=require(_0x5667('0x0'));var util=require('util');var logger=require(_0x5667('0x1'))(_0x5667('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5667('0x3'));var fs=require('fs');var path=require(_0x5667('0x4'));var rimraf=require(_0x5667('0x5'));var config=require(_0x5667('0x6'));var attributes=require(_0x5667('0x7'));module[_0x5667('0x8')]=function(_0x1145c1,_0x494c5c){return _0x1145c1['define']('MailAccount',attributes,{'tableName':_0x5667('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 7db8b6b..f7ca140 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 _0xc99a=['created','originCc','bcc','ChatWebsiteId','originChannel','ChatOfflineMessageId','Attachment','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','GetMailAccount','options','raw','where','attributes','limit','include','map','model','ShowMailAccount','find','body','difference','keys','CmContact','createdAt','updatedAt','CompanyId','ListId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','MailAccount','account','CmList','Contacts','DESC','MailApplication','MailServerOut','Smtp','List','omit','Applications','applications','list','orderBy','priority','asc','autoclose','push','close','*,*,*,*','length','defaults','create','List\x20not\x20found','contact','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','Contact\x20not\x20found','update','subject','interaction','get'];(function(_0x3590ed,_0x3a4587){var _0x21f72f=function(_0x45be21){while(--_0x45be21){_0x3590ed['push'](_0x3590ed['shift']());}};_0x21f72f(++_0x3a4587);}(_0xc99a,0x143));var _0xac99=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc99a[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xac99('0x0'));var util=require('util');var moment=require(_0xac99('0x1'));var BPromise=require('bluebird');var rs=require(_0xac99('0x2'));var fs=require('fs');var Redis=require(_0xac99('0x3'));var db=require(_0xac99('0x4'))['db'];var utils=require(_0xac99('0x5'));var logger=require(_0xac99('0x6'))('rpc');var config=require(_0xac99('0x7'));var jayson=require(_0xac99('0x8'));var client=jayson['client'][_0xac99('0x9')]({'port':0x232c});config[_0xac99('0xa')]=_['defaults'](config['redis'],{'host':_0xac99('0xb'),'port':0x18eb});var socket=require(_0xac99('0xc'))(new Redis(config['redis']));require(_0xac99('0xd'))[_0xac99('0xe')](socket);function respondWithRpcPromise(_0x70d5cb,_0x11cbe4,_0x21827f){return new BPromise(function(_0x53a6c3,_0x5a7858){return client['request'](_0x70d5cb,_0x21827f)[_0xac99('0xf')](function(_0x55b135){logger[_0xac99('0x10')](_0xac99('0x11'),_0x11cbe4,'request\x20sent');logger[_0xac99('0x12')](_0xac99('0x13'),_0x11cbe4,'request\x20sent',JSON[_0xac99('0x14')](_0x55b135));if(_0x55b135[_0xac99('0x15')]){if(_0x55b135[_0xac99('0x15')]['code']===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x11cbe4,_0x55b135[_0xac99('0x15')]['message']);return _0x5a7858(_0x55b135[_0xac99('0x15')][_0xac99('0x16')]);}logger[_0xac99('0x15')](_0xac99('0x11'),_0x11cbe4,_0x55b135[_0xac99('0x15')][_0xac99('0x16')]);return _0x53a6c3(_0x55b135['error'][_0xac99('0x16')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x11cbe4,_0xac99('0x17'));_0x53a6c3(_0x55b135['result']['message']);}})[_0xac99('0x18')](function(_0x103774){logger[_0xac99('0x15')](_0xac99('0x11'),_0x11cbe4,_0x103774);_0x5a7858(_0x103774);});});}exports[_0xac99('0x19')]=function(_0x19ac2f){var _0x49329d=this;return new Promise(function(_0x2e6094,_0x29ca5e){return db['MailAccount']['findAll']({'raw':_0x19ac2f[_0xac99('0x1a')]?_0x19ac2f[_0xac99('0x1a')][_0xac99('0x1b')]===undefined?!![]:![]:!![],'where':_0x19ac2f[_0xac99('0x1a')]?_0x19ac2f['options'][_0xac99('0x1c')]||null:null,'attributes':_0x19ac2f[_0xac99('0x1a')]?_0x19ac2f[_0xac99('0x1a')][_0xac99('0x1d')]||null:null,'limit':_0x19ac2f[_0xac99('0x1a')]?_0x19ac2f['options'][_0xac99('0x1e')]||null:null,'include':_0x19ac2f[_0xac99('0x1a')]?_0x19ac2f[_0xac99('0x1a')][_0xac99('0x1f')]?_[_0xac99('0x20')](_0x19ac2f[_0xac99('0x1a')][_0xac99('0x1f')],function(_0x267c01){return{'model':db[_0x267c01[_0xac99('0x21')]],'as':_0x267c01['as'],'attributes':_0x267c01['attributes'],'include':_0x267c01[_0xac99('0x1f')]?_['map'](_0x267c01['include'],function(_0x5733f8){return{'model':db[_0x5733f8[_0xac99('0x21')]],'as':_0x5733f8['as'],'attributes':_0x5733f8[_0xac99('0x1d')],'include':_0x5733f8[_0xac99('0x1f')]?_[_0xac99('0x20')](_0x5733f8[_0xac99('0x1f')],function(_0x461566){return{'model':db[_0x461566[_0xac99('0x21')]],'as':_0x461566['as'],'attributes':_0x461566[_0xac99('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x226103){logger[_0xac99('0x10')](_0xac99('0x19'),_0x19ac2f);logger[_0xac99('0x12')](_0xac99('0x19'),_0x19ac2f,JSON[_0xac99('0x14')](_0x226103));_0x2e6094(_0x226103);})[_0xac99('0x18')](function(_0x3af7d4){logger[_0xac99('0x15')](_0xac99('0x19'),_0x3af7d4[_0xac99('0x16')],_0x19ac2f);_0x29ca5e(_0x49329d['error'](0x1f4,_0x3af7d4[_0xac99('0x16')]));});});};exports[_0xac99('0x22')]=function(_0x4a1226){var _0x5906e7=this;return new Promise(function(_0x1f8ee5,_0x118fbc){return db['MailAccount'][_0xac99('0x23')]({'raw':_0x4a1226[_0xac99('0x1a')]?_0x4a1226[_0xac99('0x1a')][_0xac99('0x1b')]===undefined?!![]:![]:!![],'where':_0x4a1226[_0xac99('0x1a')]?_0x4a1226[_0xac99('0x1a')][_0xac99('0x1c')]||null:null,'attributes':_0x4a1226['options']?_0x4a1226['options'][_0xac99('0x1d')]||null:null,'include':_0x4a1226[_0xac99('0x1a')]?_0x4a1226[_0xac99('0x1a')]['include']?_[_0xac99('0x20')](_0x4a1226[_0xac99('0x1a')][_0xac99('0x1f')],function(_0x3c2873){return{'model':db[_0x3c2873[_0xac99('0x21')]],'as':_0x3c2873['as'],'attributes':_0x3c2873[_0xac99('0x1d')],'include':_0x3c2873[_0xac99('0x1f')]?_[_0xac99('0x20')](_0x3c2873['include'],function(_0x573c80){return{'model':db[_0x573c80[_0xac99('0x21')]],'as':_0x573c80['as'],'attributes':_0x573c80[_0xac99('0x1d')],'include':_0x573c80[_0xac99('0x1f')]?_[_0xac99('0x20')](_0x573c80[_0xac99('0x1f')],function(_0x7b39){return{'model':db[_0x7b39[_0xac99('0x21')]],'as':_0x7b39['as'],'attributes':_0x7b39['attributes']};}):[]};}):[]};}):[]:[]})[_0xac99('0xf')](function(_0x2d01f8){logger['info']('ShowMailAccount',_0x4a1226);logger[_0xac99('0x12')](_0xac99('0x22'),_0x4a1226,JSON['stringify'](_0x2d01f8));_0x1f8ee5(_0x2d01f8);})[_0xac99('0x18')](function(_0xd1b2b1){logger[_0xac99('0x15')](_0xac99('0x22'),_0xd1b2b1[_0xac99('0x16')],_0x4a1226);_0x118fbc(_0x5906e7['error'](0x1f4,_0xd1b2b1[_0xac99('0x16')]));});});};exports['NotifyMailAccount']=function(_0x58023d){var _0x4f5f10=this;return new Promise(function(_0x4ce75d,_0x40a776){var _0x505466={'body':_0x58023d[_0xac99('0x24')],'channel':'mail'};var _0x49551a=_[_0xac99('0x25')](_[_0xac99('0x26')](db[_0xac99('0x27')]['rawAttributes']),[_0xac99('0x28'),_0xac99('0x29'),_0xac99('0x2a'),_0xac99('0x2b')]);var _0x26ce02=![];if(_0x58023d[_0xac99('0x24')]['id']){delete _0x58023d[_0xac99('0x24')]['id'];}if(_[_0xac99('0x2c')](_0x58023d[_0xac99('0x24')]['from'])){return _0x40a776(_0x4f5f10[_0xac99('0x15')](0x1f4,'from\x20is\x20mandatory'));}if(_['isNil'](_0x58023d['body'][_0xac99('0x24')])||_0x58023d[_0xac99('0x24')][_0xac99('0x24')]===''){return _0x40a776(_0x4f5f10[_0xac99('0x15')](0x1f4,_0xac99('0x2d')));}if(_[_0xac99('0x2c')](_0x58023d[_0xac99('0x24')][_0xac99('0x2e')])){return _0x40a776(_0x4f5f10[_0xac99('0x15')](0x1f4,_0xac99('0x2f')+_0x49551a));}if(!_[_0xac99('0x30')](_0x49551a,_0x58023d[_0xac99('0x24')]['mapKey'])){return _0x40a776(_0x4f5f10['error'](0x1f4,_0xac99('0x31')+_0x49551a));}var _0x5c23df={};_0x5c23df[_0x58023d['body'][_0xac99('0x2e')]]=_0x58023d['body'][_0xac99('0x32')];return db[_0xac99('0x33')][_0xac99('0x23')]({'where':{'id':_0x58023d[_0xac99('0x34')]['id']},'include':[{'model':db[_0xac99('0x35')],'as':'List','include':[{'model':db['CmContact'],'as':_0xac99('0x36'),'where':_0x5c23df,'limit':0x1,'order':[[_0xac99('0x29'),_0xac99('0x37')]]}]},{'model':db[_0xac99('0x38')],'as':'Applications'},{'model':db[_0xac99('0x39')],'as':_0xac99('0x3a')}]})[_0xac99('0xf')](function(_0x3aaa5e){if(_0x3aaa5e&&_0x3aaa5e[_0xac99('0x3b')]){var _0x57ab71=_0x3aaa5e['get']({'plain':!![]});_0x505466[_0xac99('0x34')]=_[_0xac99('0x3c')](_0x57ab71,[_0xac99('0x3d'),'List']);_0x505466[_0xac99('0x3e')]=_0x57ab71[_0xac99('0x3d')];_0x505466[_0xac99('0x3f')]=_0x57ab71[_0xac99('0x3b')];_0x505466[_0xac99('0x3e')]=_[_0xac99('0x40')](_0x505466[_0xac99('0x3e')],[_0xac99('0x41')],[_0xac99('0x42')]);if(_0x505466[_0xac99('0x34')]&&_0x505466['account'][_0xac99('0x43')]){_0x505466[_0xac99('0x3e')][_0xac99('0x44')]({'id':0x0,'priority':_0x505466[_0xac99('0x3e')]['length']+0x1,'app':_0xac99('0x45'),'appdata':_0xac99('0x43'),'interval':_0xac99('0x46')});}if(_0x505466['account'][_0xac99('0x3d')]){delete _0x505466[_0xac99('0x34')][_0xac99('0x3d')];}if(_0x505466['account'][_0xac99('0x3b')]){delete _0x505466[_0xac99('0x34')]['List'];}if(_0x57ab71[_0xac99('0x3b')][_0xac99('0x36')][_0xac99('0x47')]){return _0x57ab71[_0xac99('0x3b')][_0xac99('0x36')][0x0];}var _0x1f9982=_[_0xac99('0x48')](_0x58023d['body'],{'firstName':_0x58023d[_0xac99('0x24')]['from'],'ListId':_0x57ab71[_0xac99('0x2b')]});_0x1f9982[_0x58023d[_0xac99('0x24')][_0xac99('0x2e')]]=_0x58023d[_0xac99('0x24')][_0xac99('0x32')];return db[_0xac99('0x27')][_0xac99('0x49')](_0x1f9982);}else{throw new Error(_0xac99('0x4a'));}})[_0xac99('0xf')](function(_0x2febbf){_0x505466[_0xac99('0x4b')]=_0x2febbf;if(_0x2febbf){if(!_0x58023d[_0xac99('0x24')]['message'][_0xac99('0x4c')]){_0x58023d[_0xac99('0x24')][_0xac99('0x16')][_0xac99('0x4c')]=rs[_0xac99('0x4d')]()+'\x20'+_0x58023d[_0xac99('0x24')]['message'][_0xac99('0x32')];}var _0x1e2840={'ContactId':_0x2febbf['id'],'MailAccountId':_0x58023d[_0xac99('0x34')]['id'],'inReplyTo':_0x58023d['body'][_0xac99('0x16')][_0xac99('0x4c')],'to':_0x58023d[_0xac99('0x24')]['message'][_0xac99('0x32')],'cc':_0x58023d[_0xac99('0x24')][_0xac99('0x16')]['cc'],'subject':_0x58023d[_0xac99('0x24')][_0xac99('0x16')]['subject'],'attach':_0x58023d[_0xac99('0x24')]['message'][_0xac99('0x4e')],'lastMsgAt':moment()[_0xac99('0x4f')](_0xac99('0x50')),'lastMsgDirection':'in'};return db[_0xac99('0x51')]['find']({'where':{'closed':![],'MailAccountId':_0x58023d['account']['id']},'include':[{'model':db[_0xac99('0x52')],'as':_0xac99('0x53'),'attributes':['messageId'],'where':{'messageId':_0x58023d[_0xac99('0x24')][_0xac99('0x16')]['inReplyTo']}}]})[_0xac99('0xf')](function(_0x3738aa){if(_0x3738aa){return[_0x3738aa,![]];}return db[_0xac99('0x51')][_0xac99('0x49')](_0x1e2840)[_0xac99('0xf')](function(_0x1780d2){return[_0x1780d2,!![]];});});}else{throw new Error(_0xac99('0x54'));}})['spread'](function(_0x4cb40f,_0x1beef0){if(_0x4cb40f){_0x26ce02=_0x1beef0;if(!_0x1beef0){return _0x4cb40f[_0xac99('0x55')]({'inReplyTo':_0x58023d[_0xac99('0x24')][_0xac99('0x16')]['messageId'],'to':_0x58023d[_0xac99('0x24')][_0xac99('0x16')][_0xac99('0x32')],'cc':_0x58023d['body'][_0xac99('0x16')]['cc'],'subject':_0x58023d[_0xac99('0x24')][_0xac99('0x16')][_0xac99('0x56')],'attach':_0x4cb40f[_0xac99('0x4e')]?_0x4cb40f['attach']:_0x58023d['body'][_0xac99('0x16')][_0xac99('0x4e')],'substatus':null,'substatusAt':moment()[_0xac99('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0xac99('0x4f')](_0xac99('0x50')),'lastMsgDirection':'in'});}else{return _0x4cb40f;}}})[_0xac99('0xf')](function(_0x50d187){_0x505466[_0xac99('0x57')]=_0x50d187[_0xac99('0x58')]({'plain':!![]});_0x505466[_0xac99('0x57')][_0xac99('0x59')]=_0x26ce02;return db[_0xac99('0x52')][_0xac99('0x49')]({'body':_0x58023d[_0xac99('0x24')][_0xac99('0x24')],'MailAccountId':_0x58023d[_0xac99('0x34')]['id'],'MailInteractionId':_0x50d187['id'],'direction':'in','ContactId':_0x505466[_0xac99('0x4b')]['id'],'messageId':_0x58023d[_0xac99('0x24')]['message'][_0xac99('0x4c')],'from':_0x58023d[_0xac99('0x24')]['message'][_0xac99('0x32')],'to':_0x58023d[_0xac99('0x24')][_0xac99('0x16')]['to'],'cc':_0x58023d[_0xac99('0x24')][_0xac99('0x16')]['cc'],'subject':_0x58023d['body']['message'][_0xac99('0x56')],'attach':_0x58023d[_0xac99('0x24')]['message']['attach'],'Attachments':_0x58023d['body'][_0xac99('0x16')]['attachments'],'originTo':_0x58023d[_0xac99('0x24')][_0xac99('0x16')]['originTo'],'originCc':_0x58023d[_0xac99('0x24')][_0xac99('0x16')][_0xac99('0x5a')],'bcc':_0x58023d[_0xac99('0x24')]['message'][_0xac99('0x5b')],'ChatWebsiteId':_0x58023d[_0xac99('0x24')][_0xac99('0x16')][_0xac99('0x5c')]||null,'originChannel':_0x58023d[_0xac99('0x24')]['message'][_0xac99('0x5d')]||'Email','ChatOfflineMessageId':_0x58023d[_0xac99('0x24')][_0xac99('0x16')][_0xac99('0x5e')]||null},{'include':[{'model':db[_0xac99('0x5f')],'as':'Attachments'}]});})[_0xac99('0xf')](function(_0x521012){_0x505466[_0xac99('0x16')]=_0x521012;if(_0x505466['interaction'][_0xac99('0x60')]){return db[_0xac99('0x61')][_0xac99('0x23')]({'attributes':['id','name'],'where':{'id':_0x505466[_0xac99('0x57')][_0xac99('0x60')]}})[_0xac99('0xf')](function(_0x408730){if(_0x408730){_0x505466['applications'][_0xac99('0x62')]({'id':0x0,'priority':0x0,'app':_0xac99('0x63'),'appdata':_0x408730['name']+','+(_0x505466[_0xac99('0x34')][_0xac99('0x64')]||0xa),'interval':_0xac99('0x46')});}return respondWithRpcPromise(_0xac99('0x65'),'startRouting',_0x505466);});}return respondWithRpcPromise('Start',_0xac99('0x66'),_0x505466);})[_0xac99('0xf')](function(_0x4e91d8){_0x4ce75d(_0x4e91d8);})[_0xac99('0x18')](function(_0x360ca4){_0x40a776(_0x4f5f10[_0xac99('0x15')](0x1f4,_0x360ca4[_0xac99('0x16')]));});});}; \ No newline at end of file +var _0x95f0=['from','ListId','create','List\x20not\x20found','contact','messageId','generate','attach','format','MailMessage','Messages','inReplyTo','MailInteraction','Contact\x20not\x20found','spread','update','subject','YYYY-MM-DD\x20HH:mm:ss','interaction','created','attachments','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','name','UserId','unshift','waitForTheAssignedAgent','startRouting','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetMailAccount','MailAccount','findAll','options','attributes','limit','include','map','model','ShowMailAccount','find','raw','where','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','Contacts','DESC','MailApplication','Applications','Smtp','List','get','omit','applications','orderBy','priority','asc','autoclose','push','close','*,*,*,*','defaults'];(function(_0x5b5dbc,_0x303b33){var _0x45ac8e=function(_0x2980f9){while(--_0x2980f9){_0x5b5dbc['push'](_0x5b5dbc['shift']());}};_0x45ac8e(++_0x303b33);}(_0x95f0,0xf8));var _0x095f=function(_0x426c24,_0x1e4806){_0x426c24=_0x426c24-0x0;var _0x50fd45=_0x95f0[_0x426c24];return _0x50fd45;};'use strict';var _=require(_0x095f('0x0'));var util=require('util');var moment=require(_0x095f('0x1'));var BPromise=require('bluebird');var rs=require(_0x095f('0x2'));var fs=require('fs');var Redis=require(_0x095f('0x3'));var db=require(_0x095f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x095f('0x5'))(_0x095f('0x6'));var config=require(_0x095f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x095f('0x8')][_0x095f('0x9')]({'port':0x232c});config[_0x095f('0xa')]=_['defaults'](config[_0x095f('0xa')],{'host':_0x095f('0xb'),'port':0x18eb});var socket=require(_0x095f('0xc'))(new Redis(config['redis']));require(_0x095f('0xd'))[_0x095f('0xe')](socket);function respondWithRpcPromise(_0x4f8ad5,_0xe0bfd4,_0x3e9d1a){return new BPromise(function(_0x9458ef,_0x5e9887){return client[_0x095f('0xf')](_0x4f8ad5,_0x3e9d1a)[_0x095f('0x10')](function(_0x1e8c7f){logger[_0x095f('0x11')](_0x095f('0x12'),_0xe0bfd4,'request\x20sent');logger[_0x095f('0x13')](_0x095f('0x14'),_0xe0bfd4,_0x095f('0x15'),JSON[_0x095f('0x16')](_0x1e8c7f));if(_0x1e8c7f[_0x095f('0x17')]){if(_0x1e8c7f[_0x095f('0x17')][_0x095f('0x18')]===0x1f4){logger[_0x095f('0x17')](_0x095f('0x12'),_0xe0bfd4,_0x1e8c7f[_0x095f('0x17')][_0x095f('0x19')]);return _0x5e9887(_0x1e8c7f[_0x095f('0x17')][_0x095f('0x19')]);}logger[_0x095f('0x17')](_0x095f('0x12'),_0xe0bfd4,_0x1e8c7f[_0x095f('0x17')]['message']);return _0x9458ef(_0x1e8c7f['error'][_0x095f('0x19')]);}else{logger[_0x095f('0x11')](_0x095f('0x12'),_0xe0bfd4,_0x095f('0x15'));_0x9458ef(_0x1e8c7f['result'][_0x095f('0x19')]);}})[_0x095f('0x1a')](function(_0x46d0f7){logger[_0x095f('0x17')](_0x095f('0x12'),_0xe0bfd4,_0x46d0f7);_0x5e9887(_0x46d0f7);});});}exports[_0x095f('0x1b')]=function(_0x26b652){var _0x198004=this;return new Promise(function(_0x2898d8,_0x4d3e04){return db[_0x095f('0x1c')][_0x095f('0x1d')]({'raw':_0x26b652[_0x095f('0x1e')]?_0x26b652[_0x095f('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x26b652['options']?_0x26b652[_0x095f('0x1e')]['where']||null:null,'attributes':_0x26b652[_0x095f('0x1e')]?_0x26b652[_0x095f('0x1e')][_0x095f('0x1f')]||null:null,'limit':_0x26b652['options']?_0x26b652[_0x095f('0x1e')][_0x095f('0x20')]||null:null,'include':_0x26b652[_0x095f('0x1e')]?_0x26b652['options'][_0x095f('0x21')]?_[_0x095f('0x22')](_0x26b652['options']['include'],function(_0x8fdbcf){return{'model':db[_0x8fdbcf[_0x095f('0x23')]],'as':_0x8fdbcf['as'],'attributes':_0x8fdbcf[_0x095f('0x1f')],'include':_0x8fdbcf['include']?_[_0x095f('0x22')](_0x8fdbcf[_0x095f('0x21')],function(_0x27d1b8){return{'model':db[_0x27d1b8[_0x095f('0x23')]],'as':_0x27d1b8['as'],'attributes':_0x27d1b8['attributes'],'include':_0x27d1b8['include']?_['map'](_0x27d1b8[_0x095f('0x21')],function(_0x56880b){return{'model':db[_0x56880b[_0x095f('0x23')]],'as':_0x56880b['as'],'attributes':_0x56880b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x226d6e){logger[_0x095f('0x11')]('GetMailAccount',_0x26b652);logger[_0x095f('0x13')](_0x095f('0x1b'),_0x26b652,JSON[_0x095f('0x16')](_0x226d6e));_0x2898d8(_0x226d6e);})[_0x095f('0x1a')](function(_0x2c40ed){logger['error'](_0x095f('0x1b'),_0x2c40ed[_0x095f('0x19')],_0x26b652);_0x4d3e04(_0x198004[_0x095f('0x17')](0x1f4,_0x2c40ed['message']));});});};exports[_0x095f('0x24')]=function(_0x1ae1b3){var _0x3b63db=this;return new Promise(function(_0x27ff2c,_0x2f0c74){return db[_0x095f('0x1c')][_0x095f('0x25')]({'raw':_0x1ae1b3[_0x095f('0x1e')]?_0x1ae1b3[_0x095f('0x1e')][_0x095f('0x26')]===undefined?!![]:![]:!![],'where':_0x1ae1b3[_0x095f('0x1e')]?_0x1ae1b3[_0x095f('0x1e')][_0x095f('0x27')]||null:null,'attributes':_0x1ae1b3[_0x095f('0x1e')]?_0x1ae1b3[_0x095f('0x1e')][_0x095f('0x1f')]||null:null,'include':_0x1ae1b3[_0x095f('0x1e')]?_0x1ae1b3['options'][_0x095f('0x21')]?_[_0x095f('0x22')](_0x1ae1b3['options'][_0x095f('0x21')],function(_0x56133e){return{'model':db[_0x56133e[_0x095f('0x23')]],'as':_0x56133e['as'],'attributes':_0x56133e['attributes'],'include':_0x56133e[_0x095f('0x21')]?_['map'](_0x56133e['include'],function(_0x49fb84){return{'model':db[_0x49fb84[_0x095f('0x23')]],'as':_0x49fb84['as'],'attributes':_0x49fb84[_0x095f('0x1f')],'include':_0x49fb84[_0x095f('0x21')]?_[_0x095f('0x22')](_0x49fb84[_0x095f('0x21')],function(_0x5c55c3){return{'model':db[_0x5c55c3[_0x095f('0x23')]],'as':_0x5c55c3['as'],'attributes':_0x5c55c3[_0x095f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x095f('0x10')](function(_0x56de3e){logger[_0x095f('0x11')](_0x095f('0x24'),_0x1ae1b3);logger[_0x095f('0x13')](_0x095f('0x24'),_0x1ae1b3,JSON[_0x095f('0x16')](_0x56de3e));_0x27ff2c(_0x56de3e);})[_0x095f('0x1a')](function(_0x2715cd){logger[_0x095f('0x17')](_0x095f('0x24'),_0x2715cd['message'],_0x1ae1b3);_0x2f0c74(_0x3b63db['error'](0x1f4,_0x2715cd['message']));});});};exports[_0x095f('0x28')]=function(_0x2d9cf9){var _0x327ce0=this;return new Promise(function(_0x590ce6,_0x36f66d){var _0xff203c={'body':_0x2d9cf9[_0x095f('0x29')],'channel':_0x095f('0x2a')};var _0x337add=_[_0x095f('0x2b')](_[_0x095f('0x2c')](db[_0x095f('0x2d')][_0x095f('0x2e')]),[_0x095f('0x2f'),_0x095f('0x30'),'CompanyId','ListId']);var _0x1b3521=![];if(_0x2d9cf9['body']['id']){delete _0x2d9cf9[_0x095f('0x29')]['id'];}if(_[_0x095f('0x31')](_0x2d9cf9[_0x095f('0x29')]['from'])){return _0x36f66d(_0x327ce0[_0x095f('0x17')](0x1f4,_0x095f('0x32')));}if(_[_0x095f('0x31')](_0x2d9cf9[_0x095f('0x29')][_0x095f('0x29')])||_0x2d9cf9[_0x095f('0x29')]['body']===''){return _0x36f66d(_0x327ce0[_0x095f('0x17')](0x1f4,_0x095f('0x33')));}if(_[_0x095f('0x31')](_0x2d9cf9[_0x095f('0x29')][_0x095f('0x34')])){return _0x36f66d(_0x327ce0[_0x095f('0x17')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x337add));}if(!_['includes'](_0x337add,_0x2d9cf9[_0x095f('0x29')][_0x095f('0x34')])){return _0x36f66d(_0x327ce0[_0x095f('0x17')](0x1f4,_0x095f('0x35')+_0x337add));}var _0x8c7aa0={};_0x8c7aa0[_0x2d9cf9[_0x095f('0x29')][_0x095f('0x34')]]=_0x2d9cf9[_0x095f('0x29')]['from'];return db[_0x095f('0x1c')][_0x095f('0x25')]({'where':{'id':_0x2d9cf9[_0x095f('0x36')]['id']},'include':[{'model':db[_0x095f('0x37')],'as':'List','include':[{'model':db[_0x095f('0x2d')],'as':_0x095f('0x38'),'where':_0x8c7aa0,'limit':0x1,'order':[[_0x095f('0x30'),_0x095f('0x39')]]}]},{'model':db[_0x095f('0x3a')],'as':_0x095f('0x3b')},{'model':db['MailServerOut'],'as':_0x095f('0x3c')}]})['then'](function(_0x8214f0){if(_0x8214f0&&_0x8214f0[_0x095f('0x3d')]){var _0x3ab9a3=_0x8214f0[_0x095f('0x3e')]({'plain':!![]});_0xff203c[_0x095f('0x36')]=_[_0x095f('0x3f')](_0x3ab9a3,[_0x095f('0x3b'),_0x095f('0x3d')]);_0xff203c[_0x095f('0x40')]=_0x3ab9a3[_0x095f('0x3b')];_0xff203c['list']=_0x3ab9a3['List'];_0xff203c[_0x095f('0x40')]=_[_0x095f('0x41')](_0xff203c[_0x095f('0x40')],[_0x095f('0x42')],[_0x095f('0x43')]);if(_0xff203c[_0x095f('0x36')]&&_0xff203c['account'][_0x095f('0x44')]){_0xff203c['applications'][_0x095f('0x45')]({'id':0x0,'priority':_0xff203c[_0x095f('0x40')]['length']+0x1,'app':_0x095f('0x46'),'appdata':'autoclose','interval':_0x095f('0x47')});}if(_0xff203c[_0x095f('0x36')]['Applications']){delete _0xff203c[_0x095f('0x36')][_0x095f('0x3b')];}if(_0xff203c[_0x095f('0x36')]['List']){delete _0xff203c[_0x095f('0x36')]['List'];}if(_0x3ab9a3[_0x095f('0x3d')][_0x095f('0x38')]['length']){return _0x3ab9a3[_0x095f('0x3d')][_0x095f('0x38')][0x0];}var _0x3055f7=_[_0x095f('0x48')](_0x2d9cf9[_0x095f('0x29')],{'firstName':_0x2d9cf9['body'][_0x095f('0x49')],'ListId':_0x3ab9a3[_0x095f('0x4a')]});_0x3055f7[_0x2d9cf9[_0x095f('0x29')][_0x095f('0x34')]]=_0x2d9cf9[_0x095f('0x29')][_0x095f('0x49')];return db[_0x095f('0x2d')][_0x095f('0x4b')](_0x3055f7);}else{throw new Error(_0x095f('0x4c'));}})[_0x095f('0x10')](function(_0x58ba02){_0xff203c[_0x095f('0x4d')]=_0x58ba02;if(_0x58ba02){if(!_0x2d9cf9['body'][_0x095f('0x19')][_0x095f('0x4e')]){_0x2d9cf9[_0x095f('0x29')][_0x095f('0x19')][_0x095f('0x4e')]=rs[_0x095f('0x4f')]()+'\x20'+_0x2d9cf9[_0x095f('0x29')][_0x095f('0x19')][_0x095f('0x49')];}var _0x3295af={'ContactId':_0x58ba02['id'],'MailAccountId':_0x2d9cf9[_0x095f('0x36')]['id'],'inReplyTo':_0x2d9cf9['body'][_0x095f('0x19')][_0x095f('0x4e')],'to':_0x2d9cf9[_0x095f('0x29')][_0x095f('0x19')][_0x095f('0x49')],'cc':_0x2d9cf9[_0x095f('0x29')][_0x095f('0x19')]['cc'],'subject':_0x2d9cf9['body'][_0x095f('0x19')]['subject'],'attach':_0x2d9cf9[_0x095f('0x29')][_0x095f('0x19')][_0x095f('0x50')],'lastMsgAt':moment()[_0x095f('0x51')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db['MailInteraction'][_0x095f('0x25')]({'where':{'closed':![],'MailAccountId':_0x2d9cf9[_0x095f('0x36')]['id']},'include':[{'model':db[_0x095f('0x52')],'as':_0x095f('0x53'),'attributes':['messageId'],'where':{'messageId':_0x2d9cf9['body'][_0x095f('0x19')][_0x095f('0x54')]}}]})[_0x095f('0x10')](function(_0x21c506){if(_0x21c506){return[_0x21c506,![]];}return db[_0x095f('0x55')][_0x095f('0x4b')](_0x3295af)[_0x095f('0x10')](function(_0x4ce298){return[_0x4ce298,!![]];});});}else{throw new Error(_0x095f('0x56'));}})[_0x095f('0x57')](function(_0xefc06b,_0x5c4090){if(_0xefc06b){_0x1b3521=_0x5c4090;if(!_0x5c4090){return _0xefc06b[_0x095f('0x58')]({'inReplyTo':_0x2d9cf9['body'][_0x095f('0x19')][_0x095f('0x4e')],'to':_0x2d9cf9[_0x095f('0x29')][_0x095f('0x19')][_0x095f('0x49')],'cc':_0x2d9cf9[_0x095f('0x29')]['message']['cc'],'subject':_0x2d9cf9[_0x095f('0x29')]['message'][_0x095f('0x59')],'attach':_0xefc06b[_0x095f('0x50')]?_0xefc06b['attach']:_0x2d9cf9[_0x095f('0x29')][_0x095f('0x19')][_0x095f('0x50')],'substatus':null,'substatusAt':moment()[_0x095f('0x51')](_0x095f('0x5a')),'lastMsgAt':moment()[_0x095f('0x51')](_0x095f('0x5a')),'lastMsgDirection':'in'});}else{return _0xefc06b;}}})[_0x095f('0x10')](function(_0x3aa28c){_0xff203c[_0x095f('0x5b')]=_0x3aa28c['get']({'plain':!![]});_0xff203c[_0x095f('0x5b')][_0x095f('0x5c')]=_0x1b3521;return db[_0x095f('0x52')][_0x095f('0x4b')]({'body':_0x2d9cf9[_0x095f('0x29')][_0x095f('0x29')],'MailAccountId':_0x2d9cf9['account']['id'],'MailInteractionId':_0x3aa28c['id'],'direction':'in','ContactId':_0xff203c[_0x095f('0x4d')]['id'],'messageId':_0x2d9cf9[_0x095f('0x29')]['message'][_0x095f('0x4e')],'from':_0x2d9cf9[_0x095f('0x29')][_0x095f('0x19')][_0x095f('0x49')],'to':_0x2d9cf9['body'][_0x095f('0x19')]['to'],'cc':_0x2d9cf9['body'][_0x095f('0x19')]['cc'],'subject':_0x2d9cf9[_0x095f('0x29')]['message'][_0x095f('0x59')],'attach':_0x2d9cf9['body'][_0x095f('0x19')]['attach'],'Attachments':_0x2d9cf9[_0x095f('0x29')][_0x095f('0x19')][_0x095f('0x5d')],'originTo':_0x2d9cf9[_0x095f('0x29')][_0x095f('0x19')]['originTo'],'originCc':_0x2d9cf9['body'][_0x095f('0x19')][_0x095f('0x5e')],'bcc':_0x2d9cf9[_0x095f('0x29')][_0x095f('0x19')][_0x095f('0x5f')],'ChatWebsiteId':_0x2d9cf9[_0x095f('0x29')]['message'][_0x095f('0x60')]||null,'originChannel':_0x2d9cf9['body'][_0x095f('0x19')][_0x095f('0x61')]||_0x095f('0x62'),'ChatOfflineMessageId':_0x2d9cf9['body']['message'][_0x095f('0x63')]||null},{'include':[{'model':db[_0x095f('0x64')],'as':_0x095f('0x65')}]});})[_0x095f('0x10')](function(_0x1bf678){_0xff203c[_0x095f('0x19')]=_0x1bf678;if(_0xff203c[_0x095f('0x5b')]['UserId']){return db['User'][_0x095f('0x25')]({'attributes':['id',_0x095f('0x66')],'where':{'id':_0xff203c['interaction'][_0x095f('0x67')]}})[_0x095f('0x10')](function(_0x5f1413){if(_0x5f1413){_0xff203c['applications'][_0x095f('0x68')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5f1413['name']+','+(_0xff203c[_0x095f('0x36')][_0x095f('0x69')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x095f('0x6a'),_0xff203c);});}return respondWithRpcPromise('Start',_0x095f('0x6a'),_0xff203c);})[_0x095f('0x10')](function(_0x195a81){_0x590ce6(_0x195a81);})[_0x095f('0x1a')](function(_0x3cb651){_0x36f66d(_0x327ce0[_0x095f('0x17')](0x1f4,_0x3cb651[_0x095f('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 9828e52..362984d 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 _0x7d1f=['remove','update','emit','removeListener','register','./mailAccount.events','save'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7d1f,0x10f));var _0xf7d1=function(_0x53e001,_0xedce48){_0x53e001=_0x53e001-0x0;var _0x4d9b76=_0x7d1f[_0x53e001];return _0x4d9b76;};'use strict';var MailAccountEvents=require(_0xf7d1('0x0'));var events=[_0xf7d1('0x1'),_0xf7d1('0x2'),_0xf7d1('0x3')];function createListener(_0x51ec0d,_0x1b6726){return function(_0x54440f){_0x1b6726[_0xf7d1('0x4')](_0x51ec0d,_0x54440f);};}function removeListener(_0x547da2,_0x5bcef6){return function(){MailAccountEvents[_0xf7d1('0x5')](_0x547da2,_0x5bcef6);};}exports[_0xf7d1('0x6')]=function(_0x4ddd66){for(var _0x5edc59=0x0,_0x25ed5=events['length'];_0x5edc59<_0x25ed5;_0x5edc59++){var _0x4e60ab=events[_0x5edc59];var _0x29902d=createListener('mailAccount:'+_0x4e60ab,_0x4ddd66);MailAccountEvents['on'](_0x4e60ab,_0x29902d);}}; \ No newline at end of file +var _0x1373=['mailAccount:','./mailAccount.events','update','emit','removeListener','length'];(function(_0x45ec1a,_0x2d4378){var _0x22cf41=function(_0x2de762){while(--_0x2de762){_0x45ec1a['push'](_0x45ec1a['shift']());}};_0x22cf41(++_0x2d4378);}(_0x1373,0x1e1));var _0x3137=function(_0x486a3c,_0x1f8eaf){_0x486a3c=_0x486a3c-0x0;var _0x3ce3ce=_0x1373[_0x486a3c];return _0x3ce3ce;};'use strict';var MailAccountEvents=require(_0x3137('0x0'));var events=['save','remove',_0x3137('0x1')];function createListener(_0x1040b2,_0x4df522){return function(_0x466357){_0x4df522[_0x3137('0x2')](_0x1040b2,_0x466357);};}function removeListener(_0x2e6900,_0x527c82){return function(){MailAccountEvents[_0x3137('0x3')](_0x2e6900,_0x527c82);};}exports['register']=function(_0x265af1){for(var _0x172999=0x0,_0x55e3ea=events[_0x3137('0x4')];_0x172999<_0x55e3ea;_0x172999++){var _0x513e02=events[_0x172999];var _0x2140ef=createListener(_0x3137('0x5')+_0x513e02,_0x265af1);MailAccountEvents['on'](_0x513e02,_0x2140ef);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index cda069a..c047093 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 _0x1aae=['show','isAuthenticated','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./mailApplication.controller','get','/:id'];(function(_0x35d2b2,_0x47388f){var _0xc35fd4=function(_0x4a85ab){while(--_0x4a85ab){_0x35d2b2['push'](_0x35d2b2['shift']());}};_0xc35fd4(++_0x47388f);}(_0x1aae,0x131));var _0xe1aa=function(_0x8f926d,_0x13de6b){_0x8f926d=_0x8f926d-0x0;var _0x2a080d=_0x1aae[_0x8f926d];return _0x2a080d;};'use strict';var multer=require('multer');var util=require(_0xe1aa('0x0'));var path=require(_0xe1aa('0x1'));var timeout=require(_0xe1aa('0x2'));var express=require(_0xe1aa('0x3'));var router=express[_0xe1aa('0x4')]();var fs_extra=require(_0xe1aa('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe1aa('0x6'));var config=require('../../config/environment');var controller=require(_0xe1aa('0x7'));router[_0xe1aa('0x8')](_0xe1aa('0x9'),auth['isAuthenticated'](),controller[_0xe1aa('0xa')]);router['put'](_0xe1aa('0x9'),auth[_0xe1aa('0xb')](),controller[_0xe1aa('0xc')]);router[_0xe1aa('0xd')]('/:id',auth[_0xe1aa('0xb')](),controller['destroy']);module[_0xe1aa('0xe')]=router; \ No newline at end of file +var _0x13eb=['destroy','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete'];(function(_0x4cdecc,_0x321d1a){var _0x3948a9=function(_0x2a247d){while(--_0x2a247d){_0x4cdecc['push'](_0x4cdecc['shift']());}};_0x3948a9(++_0x321d1a);}(_0x13eb,0x81));var _0xb13e=function(_0x2c74e2,_0x78daf1){_0x2c74e2=_0x2c74e2-0x0;var _0x14e004=_0x13eb[_0x2c74e2];return _0x14e004;};'use strict';var multer=require('multer');var util=require(_0xb13e('0x0'));var path=require(_0xb13e('0x1'));var timeout=require('connect-timeout');var express=require(_0xb13e('0x2'));var router=express[_0xb13e('0x3')]();var fs_extra=require(_0xb13e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb13e('0x5'));var config=require(_0xb13e('0x6'));var controller=require(_0xb13e('0x7'));router[_0xb13e('0x8')](_0xb13e('0x9'),auth[_0xb13e('0xa')](),controller[_0xb13e('0xb')]);router[_0xb13e('0xc')](_0xb13e('0x9'),auth['isAuthenticated'](),controller[_0xb13e('0xd')]);router[_0xb13e('0xe')](_0xb13e('0x9'),auth['isAuthenticated'](),controller[_0xb13e('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index c9c59b6..ef4349c 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 _0xd81d=['exports','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x55a312,_0x385afa){var _0x49a53c=function(_0xfd4334){while(--_0xfd4334){_0x55a312['push'](_0x55a312['shift']());}};_0x49a53c(++_0x385afa);}(_0xd81d,0xe3));var _0xdd81=function(_0x9e0ae3,_0x1da32c){_0x9e0ae3=_0x9e0ae3-0x0;var _0x5e1b58=_0xd81d[_0x9e0ae3];return _0x5e1b58;};'use strict';var Sequelize=require(_0xdd81('0x0'));module[_0xdd81('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xdd81('0x2')],'allowNull':![],'defaultValue':_0xdd81('0x3')},'appdata':{'type':Sequelize[_0xdd81('0x4')]()},'description':{'type':Sequelize[_0xdd81('0x2')]},'interval':{'type':Sequelize[_0xdd81('0x2')],'defaultValue':_0xdd81('0x5')}}; \ No newline at end of file +var _0xa7df=['STRING','noop','sequelize','INTEGER'];(function(_0x3a9d0c,_0x1da7c4){var _0x250738=function(_0x4fdbd6){while(--_0x4fdbd6){_0x3a9d0c['push'](_0x3a9d0c['shift']());}};_0x250738(++_0x1da7c4);}(_0xa7df,0x1d2));var _0xfa7d=function(_0x1fad20,_0x220164){_0x1fad20=_0x1fad20-0x0;var _0x5b70ec=_0xa7df[_0x1fad20];return _0x5b70ec;};'use strict';var Sequelize=require(_0xfa7d('0x0'));module['exports']={'priority':{'type':Sequelize[_0xfa7d('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xfa7d('0x2')],'allowNull':![],'defaultValue':_0xfa7d('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xfa7d('0x2')]},'interval':{'type':Sequelize[_0xfa7d('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index a06e602..655cdba 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(_0x1dc448,_0xcafe01){var _0x64794a=function(_0x4f54b6){while(--_0x4f54b6){_0x1dc448['push'](_0x1dc448['shift']());}};_0x64794a(++_0xcafe01);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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 _0x70e0=['util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','show','model','keys','MailApplication','query','filters','attributes','intersection','length','includeAll','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x368abc,_0x8bbc6f){var _0x2fd9f0=function(_0x129756){while(--_0x129756){_0x368abc['push'](_0x368abc['shift']());}};_0x2fd9f0(++_0x8bbc6f);}(_0x70e0,0x17b));var _0x070e=function(_0x4fe5e,_0x128463){_0x4fe5e=_0x4fe5e-0x0;var _0x24e364=_0x70e0[_0x4fe5e];return _0x24e364;};'use strict';var emlformat=require(_0x070e('0x0'));var rimraf=require(_0x070e('0x1'));var zipdir=require(_0x070e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x070e('0x3'));var BPromise=require(_0x070e('0x4'));var Mustache=require(_0x070e('0x5'));var util=require(_0x070e('0x6'));var path=require('path');var sox=require(_0x070e('0x7'));var csv=require('to-csv');var ejs=require(_0x070e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0xc'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require(_0x070e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x18')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x19')](_0x4a33d2)[_0x070e('0x1a')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=typeof _0x5d3a38[_0x070e('0x1b')]===_0x070e('0x1c')&&typeof _0x5d3a38['limit']==='undefined';var _0x17e2e4=_0x373d86[_0x070e('0x1d')];var _0x38f6e6=_0xeae1a5?0x0:_0x5d3a38[_0x070e('0x1b')];var _0x364b3f=_0xeae1a5?_0x373d86['count']:_0x5d3a38[_0x070e('0x1b')]+_0x5d3a38[_0x070e('0x1e')];var _0x1ad3de;if(_0x364b3f>=_0x17e2e4){_0x364b3f=_0x17e2e4;_0x1ad3de=0xc8;}else{_0x1ad3de=0xce;}_0x51d14d[_0x070e('0x19')](_0x1ad3de);return _0x51d14d[_0x070e('0x1f')]('Content-Range',_0x38f6e6+'-'+_0x364b3f+'/'+_0x17e2e4)['json'](_0x373d86);}return null;};}function patchUpdates(_0x4e958f){return function(_0x9907cf){try{jsonpatch[_0x070e('0x20')](_0x9907cf,_0x4e958f,!![]);}catch(_0x20dc60){return BPromise['reject'](_0x20dc60);}return _0x9907cf[_0x070e('0x21')]();};}function saveUpdates(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x22')](_0x5dc5d2)[_0x070e('0x23')](function(_0x28a1c3){return _0x28a1c3;});}return null;};}function removeEntity(_0xa86797,_0xe405e){return function(_0x164cdf){if(_0x164cdf){return _0x164cdf['destroy']()[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x503f4d,_0xf17c56){return function(_0x5f3e9d){if(!_0x5f3e9d){_0x503f4d['sendStatus'](0x194);}return _0x5f3e9d;};}function handleError(_0x2ccbd7,_0x25f6e){_0x25f6e=_0x25f6e||0x1f4;return function(_0x41deb1){logger[_0x070e('0x24')](_0x41deb1[_0x070e('0x25')]);if(_0x41deb1['name']){delete _0x41deb1[_0x070e('0x26')];}_0x2ccbd7[_0x070e('0x19')](_0x25f6e)[_0x070e('0x27')](_0x41deb1);};}exports[_0x070e('0x28')]=function(_0x43dd96,_0x28d7f2){var _0x1a1892={'raw':!![],'where':{'id':_0x43dd96['params']['id']}},_0x26373b={};_0x26373b[_0x070e('0x29')]=_[_0x070e('0x2a')](db[_0x070e('0x2b')]['rawAttributes']);_0x26373b['query']=_[_0x070e('0x2a')](_0x43dd96[_0x070e('0x2c')]);_0x26373b[_0x070e('0x2d')]=_['intersection'](_0x26373b[_0x070e('0x29')],_0x26373b[_0x070e('0x2c')]);_0x1a1892[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x26373b['model'],qs['fields'](_0x43dd96['query']['fields']));_0x1a1892[_0x070e('0x2e')]=_0x1a1892['attributes'][_0x070e('0x30')]?_0x1a1892[_0x070e('0x2e')]:_0x26373b['model'];if(_0x43dd96['query'][_0x070e('0x31')]){_0x1a1892[_0x070e('0x32')]=[{'all':!![]}];}_0x1a1892=_['merge']({},_0x1a1892,_0x43dd96['options']);return db[_0x070e('0x2b')][_0x070e('0x33')](_0x1a1892)[_0x070e('0x23')](handleEntityNotFound(_0x28d7f2,null))[_0x070e('0x23')](respondWithResult(_0x28d7f2,null))[_0x070e('0x34')](handleError(_0x28d7f2,null));};exports['update']=function(_0x482cc2,_0x24d17d){if(_0x482cc2[_0x070e('0x35')]['id']){delete _0x482cc2[_0x070e('0x35')]['id'];}return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x482cc2['params']['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x24d17d,null))[_0x070e('0x23')](saveUpdates(_0x482cc2['body'],null))[_0x070e('0x23')](respondWithResult(_0x24d17d,null))[_0x070e('0x34')](handleError(_0x24d17d,null));};exports['destroy']=function(_0x4d4ee8,_0x5ddbe9){return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x4d4ee8[_0x070e('0x36')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x5ddbe9,null))[_0x070e('0x23')](removeEntity(_0x5ddbe9,null))['catch'](handleError(_0x5ddbe9,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 8f65292..9d21d5a 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 _0x1644=['../../config/logger','moment','path','../../config/environment','./mailApplication.attributes','exports','define','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x54af0d,_0x3e5db0){var _0x57b08d=function(_0x35d93a){while(--_0x35d93a){_0x54af0d['push'](_0x54af0d['shift']());}};_0x57b08d(++_0x3e5db0);}(_0x1644,0x196));var _0x4164=function(_0x323430,_0x3d2b6d){_0x323430=_0x323430-0x0;var _0x9eecd1=_0x1644[_0x323430];return _0x9eecd1;};'use strict';var _=require(_0x4164('0x0'));var util=require(_0x4164('0x1'));var logger=require(_0x4164('0x2'))('api');var moment=require(_0x4164('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4164('0x4'));var rimraf=require('rimraf');var config=require(_0x4164('0x5'));var attributes=require(_0x4164('0x6'));module[_0x4164('0x7')]=function(_0x4afb20,_0x3e437e){return _0x4afb20[_0x4164('0x8')]('MailApplication',attributes,{'tableName':_0x4164('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4164('0xa'),'collate':_0x4164('0xb')});}; \ No newline at end of file +var _0x3b74=['./mailApplication.attributes','MailApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','path','rimraf','../../config/environment'];(function(_0x31dd8a,_0x43ce3d){var _0x29b775=function(_0x3a9745){while(--_0x3a9745){_0x31dd8a['push'](_0x31dd8a['shift']());}};_0x29b775(++_0x43ce3d);}(_0x3b74,0xe0));var _0x43b7=function(_0x26e89e,_0xacad9){_0x26e89e=_0x26e89e-0x0;var _0x5bf1d3=_0x3b74[_0x26e89e];return _0x5bf1d3;};'use strict';var _=require(_0x43b7('0x0'));var util=require(_0x43b7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x43b7('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43b7('0x3'));var rimraf=require(_0x43b7('0x4'));var config=require(_0x43b7('0x5'));var attributes=require(_0x43b7('0x6'));module['exports']=function(_0x83acd4,_0x435f10){return _0x83acd4['define'](_0x43b7('0x7'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x43b7('0x8'),'collate':_0x43b7('0x9')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index fbebe04..19ccc8f 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 _0xde6b=['info','MailApplication,\x20%s,\x20%s','debug','error','message','catch','UpdateMailApplication','MailApplication','body','options','where','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5ce8b9,_0x5cded8){var _0xe34be0=function(_0xe3d4e5){while(--_0xe3d4e5){_0x5ce8b9['push'](_0x5ce8b9['shift']());}};_0xe34be0(++_0x5cded8);}(_0xde6b,0xde));var _0xbde6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xde6b[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xbde6('0x0'));var util=require(_0xbde6('0x1'));var moment=require(_0xbde6('0x2'));var BPromise=require(_0xbde6('0x3'));var rs=require(_0xbde6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbde6('0x5'))['db'];var utils=require(_0xbde6('0x6'));var logger=require('../../config/logger')(_0xbde6('0x7'));var config=require(_0xbde6('0x8'));var jayson=require(_0xbde6('0x9'));var client=jayson[_0xbde6('0xa')][_0xbde6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x160e90,_0x23f3ee,_0x474dd6){return new BPromise(function(_0x56e47,_0x2a57c4){return client['request'](_0x160e90,_0x474dd6)['then'](function(_0x180570){logger[_0xbde6('0xc')](_0xbde6('0xd'),_0x23f3ee,'request\x20sent');logger[_0xbde6('0xe')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x23f3ee,'request\x20sent',JSON['stringify'](_0x180570));if(_0x180570[_0xbde6('0xf')]){if(_0x180570['error']['code']===0x1f4){logger[_0xbde6('0xf')](_0xbde6('0xd'),_0x23f3ee,_0x180570[_0xbde6('0xf')][_0xbde6('0x10')]);return _0x2a57c4(_0x180570['error']['message']);}logger[_0xbde6('0xf')](_0xbde6('0xd'),_0x23f3ee,_0x180570[_0xbde6('0xf')]['message']);return _0x56e47(_0x180570['error']['message']);}else{logger[_0xbde6('0xc')]('MailApplication,\x20%s,\x20%s',_0x23f3ee,'request\x20sent');_0x56e47(_0x180570['result'][_0xbde6('0x10')]);}})[_0xbde6('0x11')](function(_0x560e8d){logger[_0xbde6('0xf')](_0xbde6('0xd'),_0x23f3ee,_0x560e8d);_0x2a57c4(_0x560e8d);});});}exports[_0xbde6('0x12')]=function(_0x2e987b){var _0x27838d=this;return new Promise(function(_0x37ef0c,_0x196c95){return db[_0xbde6('0x13')]['update'](_0x2e987b[_0xbde6('0x14')],{'raw':_0x2e987b[_0xbde6('0x15')]?_0x2e987b[_0xbde6('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e987b['options']?_0x2e987b[_0xbde6('0x15')][_0xbde6('0x16')]||null:null,'attributes':_0x2e987b['options']?_0x2e987b[_0xbde6('0x15')][_0xbde6('0x17')]||null:null,'limit':_0x2e987b[_0xbde6('0x15')]?_0x2e987b[_0xbde6('0x15')][_0xbde6('0x18')]||null:null})['then'](function(_0x57b40d){logger[_0xbde6('0xc')](_0xbde6('0x12'),_0x2e987b);logger['debug'](_0xbde6('0x12'),_0x2e987b,JSON[_0xbde6('0x19')](_0x57b40d));_0x37ef0c(_0x57b40d);})['catch'](function(_0x45f19d){logger[_0xbde6('0xf')](_0xbde6('0x12'),_0x45f19d[_0xbde6('0x10')],_0x2e987b);_0x196c95(_0x27838d[_0xbde6('0xf')](0x1f4,_0x45f19d['message']));});});}; \ No newline at end of file +var _0x6799=['request\x20sent','result','catch','UpdateMailApplication','update','body','options','raw','where','stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','MailApplication,\x20%s,\x20%s','MailApplication,\x20%s,\x20%s,\x20%s','code','error','message'];(function(_0x264f48,_0x2c82d8){var _0xb99167=function(_0x4a6be7){while(--_0x4a6be7){_0x264f48['push'](_0x264f48['shift']());}};_0xb99167(++_0x2c82d8);}(_0x6799,0x91));var _0x9679=function(_0x211836,_0x31c1dc){_0x211836=_0x211836-0x0;var _0x369d34=_0x6799[_0x211836];return _0x369d34;};'use strict';var _=require(_0x9679('0x0'));var util=require(_0x9679('0x1'));var moment=require('moment');var BPromise=require(_0x9679('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9679('0x3'));var db=require(_0x9679('0x4'))['db'];var utils=require(_0x9679('0x5'));var logger=require(_0x9679('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9679('0x7'));var client=jayson[_0x9679('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29d0c1,_0x41bc1c,_0x4b7f48){return new BPromise(function(_0xc12caf,_0x25d823){return client[_0x9679('0x9')](_0x29d0c1,_0x4b7f48)[_0x9679('0xa')](function(_0x5a63a2){logger[_0x9679('0xb')](_0x9679('0xc'),_0x41bc1c,'request\x20sent');logger['debug'](_0x9679('0xd'),_0x41bc1c,'request\x20sent',JSON['stringify'](_0x5a63a2));if(_0x5a63a2['error']){if(_0x5a63a2['error'][_0x9679('0xe')]===0x1f4){logger[_0x9679('0xf')](_0x9679('0xc'),_0x41bc1c,_0x5a63a2[_0x9679('0xf')]['message']);return _0x25d823(_0x5a63a2['error'][_0x9679('0x10')]);}logger[_0x9679('0xf')]('MailApplication,\x20%s,\x20%s',_0x41bc1c,_0x5a63a2[_0x9679('0xf')]['message']);return _0xc12caf(_0x5a63a2['error']['message']);}else{logger[_0x9679('0xb')](_0x9679('0xc'),_0x41bc1c,_0x9679('0x11'));_0xc12caf(_0x5a63a2[_0x9679('0x12')]['message']);}})[_0x9679('0x13')](function(_0x293599){logger[_0x9679('0xf')](_0x9679('0xc'),_0x41bc1c,_0x293599);_0x25d823(_0x293599);});});}exports[_0x9679('0x14')]=function(_0x285098){var _0x462236=this;return new Promise(function(_0x371b46,_0x1bbdb1){return db['MailApplication'][_0x9679('0x15')](_0x285098[_0x9679('0x16')],{'raw':_0x285098[_0x9679('0x17')]?_0x285098[_0x9679('0x17')][_0x9679('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x285098[_0x9679('0x17')]?_0x285098[_0x9679('0x17')][_0x9679('0x19')]||null:null,'attributes':_0x285098[_0x9679('0x17')]?_0x285098['options']['attributes']||null:null,'limit':_0x285098[_0x9679('0x17')]?_0x285098[_0x9679('0x17')]['limit']||null:null})[_0x9679('0xa')](function(_0x345c99){logger[_0x9679('0xb')](_0x9679('0x14'),_0x285098);logger['debug'](_0x9679('0x14'),_0x285098,JSON[_0x9679('0x1a')](_0x345c99));_0x371b46(_0x345c99);})['catch'](function(_0x2b9a0e){logger['error'](_0x9679('0x14'),_0x2b9a0e['message'],_0x285098);_0x1bbdb1(_0x462236[_0x9679('0xf')](0x1f4,_0x2b9a0e[_0x9679('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 0e6c697..929a7c8 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 _0xef72=['./mailInteraction.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','tracked','mail','put','update','delete','mailinteraction:destroy','/:id/tags','removeTags','exports','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3bd6ea,_0x4cdd1c){var _0x1d5da2=function(_0x1b341e){while(--_0x1b341e){_0x3bd6ea['push'](_0x3bd6ea['shift']());}};_0x1d5da2(++_0x4cdd1c);}(_0xef72,0x9f));var _0x2ef7=function(_0x37ace5,_0x5546de){_0x37ace5=_0x37ace5-0x0;var _0x235299=_0xef72[_0x37ace5];return _0x235299;};'use strict';var express=require('express');var router=express[_0x2ef7('0x0')]();var auth=require(_0x2ef7('0x1'));var interaction=require(_0x2ef7('0x2'));var controller=require(_0x2ef7('0x3'));router[_0x2ef7('0x4')]('/',auth['isAuthenticated'](),controller[_0x2ef7('0x5')]);router[_0x2ef7('0x4')](_0x2ef7('0x6'),auth['isAuthenticated'](),controller[_0x2ef7('0x7')]);router[_0x2ef7('0x4')](_0x2ef7('0x8'),auth[_0x2ef7('0x9')](),controller[_0x2ef7('0xa')]);router[_0x2ef7('0x4')](_0x2ef7('0xb'),auth['isAuthenticated'](),controller[_0x2ef7('0xc')]);router[_0x2ef7('0x4')](_0x2ef7('0xd'),auth[_0x2ef7('0x9')](),controller[_0x2ef7('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2ef7('0xf')]);router[_0x2ef7('0x10')](_0x2ef7('0xb'),auth['isAuthenticated'](),controller[_0x2ef7('0x11')]);router['post']('/:id/tags',auth[_0x2ef7('0x9')](),interaction[_0x2ef7('0x12')](_0x2ef7('0x13'),'mailinteraction:addtags'),controller['addTags']);router[_0x2ef7('0x14')](_0x2ef7('0x8'),auth['isAuthenticated'](),interaction['tracked'](_0x2ef7('0x13'),'mailinteraction:update'),controller[_0x2ef7('0x15')]);router[_0x2ef7('0x16')](_0x2ef7('0x8'),auth[_0x2ef7('0x9')](),interaction[_0x2ef7('0x12')](_0x2ef7('0x13'),_0x2ef7('0x17')),controller['destroy']);router[_0x2ef7('0x16')](_0x2ef7('0x18'),auth[_0x2ef7('0x9')](),controller[_0x2ef7('0x19')]);module[_0x2ef7('0x1a')]=router; \ No newline at end of file +var _0x6648=['download','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','/:id/messages'];(function(_0x45357e,_0x5cb790){var _0x580576=function(_0x3e4267){while(--_0x3e4267){_0x45357e['push'](_0x45357e['shift']());}};_0x580576(++_0x5cb790);}(_0x6648,0x13a));var _0x8664=function(_0x27d94f,_0x18ae26){_0x27d94f=_0x27d94f-0x0;var _0x3a0f7b=_0x6648[_0x27d94f];return _0x3a0f7b;};'use strict';var express=require(_0x8664('0x0'));var router=express[_0x8664('0x1')]();var auth=require(_0x8664('0x2'));var interaction=require(_0x8664('0x3'));var controller=require('./mailInteraction.controller');router[_0x8664('0x4')]('/',auth[_0x8664('0x5')](),controller['index']);router[_0x8664('0x4')](_0x8664('0x6'),auth[_0x8664('0x5')](),controller[_0x8664('0x7')]);router['get'](_0x8664('0x8'),auth[_0x8664('0x5')](),controller['show']);router[_0x8664('0x4')](_0x8664('0x9'),auth[_0x8664('0x5')](),controller['getMessages']);router[_0x8664('0x4')]('/:id/download',auth[_0x8664('0x5')](),controller[_0x8664('0xa')]);router[_0x8664('0xb')]('/',auth[_0x8664('0x5')](),controller[_0x8664('0xc')]);router['post'](_0x8664('0x9'),auth[_0x8664('0x5')](),controller[_0x8664('0xd')]);router['post'](_0x8664('0xe'),auth[_0x8664('0x5')](),interaction[_0x8664('0xf')](_0x8664('0x10'),_0x8664('0x11')),controller[_0x8664('0x12')]);router[_0x8664('0x13')]('/:id',auth[_0x8664('0x5')](),interaction[_0x8664('0xf')](_0x8664('0x10'),_0x8664('0x14')),controller[_0x8664('0x15')]);router[_0x8664('0x16')]('/:id',auth['isAuthenticated'](),interaction[_0x8664('0xf')](_0x8664('0x10'),_0x8664('0x17')),controller[_0x8664('0x18')]);router[_0x8664('0x16')](_0x8664('0xe'),auth[_0x8664('0x5')](),controller[_0x8664('0x19')]);module[_0x8664('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 5d0ca2b..978ce95 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 _0x8878=['ENUM','out','sequelize','BOOLEAN','STRING','TEXT','long','DATE'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x8878,0x8a));var _0x8887=function(_0x5c4444,_0x119726){_0x5c4444=_0x5c4444-0x0;var _0x20d93d=_0x8878[_0x5c4444];return _0x20d93d;};'use strict';var Sequelize=require(_0x8887('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize[_0x8887('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x8887('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x8887('0x2')]},'note':{'type':Sequelize[_0x8887('0x2')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x8887('0x2')]},'cc':{'type':Sequelize[_0x8887('0x3')](_0x8887('0x4'))},'subject':{'type':Sequelize[_0x8887('0x3')]()},'attach':{'type':Sequelize[_0x8887('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x8887('0x5')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x8887('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x8887('0x6')]('in',_0x8887('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x8887('0x6')]('in',_0x8887('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8887('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x09e3=['ENUM','out','sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT'];(function(_0x4fdc46,_0x2a3759){var _0x2c178a=function(_0x59ead9){while(--_0x59ead9){_0x4fdc46['push'](_0x4fdc46['shift']());}};_0x2c178a(++_0x2a3759);}(_0x09e3,0x134));var _0x309e=function(_0x5d693e,_0x58c947){_0x5d693e=_0x5d693e-0x0;var _0x533229=_0x09e3[_0x5d693e];return _0x533229;};'use strict';var Sequelize=require(_0x309e('0x0'));var iconv=require(_0x309e('0x1'));module[_0x309e('0x2')]={'closed':{'type':Sequelize[_0x309e('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x309e('0x4')]},'disposition':{'type':Sequelize[_0x309e('0x5')]},'secondDisposition':{'type':Sequelize[_0x309e('0x5')]},'thirdDisposition':{'type':Sequelize[_0x309e('0x5')]},'note':{'type':Sequelize[_0x309e('0x5')]},'inReplyTo':{'type':Sequelize[_0x309e('0x5')](0x1fe)},'to':{'type':Sequelize[_0x309e('0x5')]},'cc':{'type':Sequelize[_0x309e('0x6')]('long')},'subject':{'type':Sequelize[_0x309e('0x6')]()},'attach':{'type':Sequelize[_0x309e('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x309e('0x4')]},'substatus':{'type':Sequelize[_0x309e('0x5')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x309e('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x309e('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x309e('0x7')]('in',_0x309e('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x309e('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 83c77c2..978b4ef 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 _0xab1e=['YYYY-MM-DD\x20HH:mm:ss','include','findAll','inlineCss','addTags','setTags','spread','Tag','emit','mailInteractionTags:save','download','unix','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','subject','get','mkdirSync','each','decode','headers','Bcc','basename','existsSync','readFileSync','writeFileSync','unlinkSync','sendStatus','eml-format','rimraf','zip-dir','moment','bluebird','lodash','squel','juice','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','defaults','redis','./mailInteraction.socket','register','status','end','json','offset','undefined','limit','set','update','destroy','then','error','stack','name','send','Users','fullname','TagIds','Tags','forEach','push','MailMessage','findOne','out','plainBody','-id','lastMsgText','trimStart','catch','index','map','MailInteraction','rawAttributes','fieldName','type','key','model','filters','intersection','attributes','query','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','users','u.id\x20=\x20ui.UserId','mail_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','sqlOperator','conditions','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','$substring','value','split','getFullTextValue','find','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','createdAt','parse','$gte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.MailAccountId\x20IS\x20NULL','sequelize','count','keyBy','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','toString','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','enableEmailPreview','all','rows','params','keys','includeAll','options','create','body','describe','addMessage','ids','omit','getMessages','format'];(function(_0x43b882,_0x1b41ab){var _0x3286b9=function(_0x3b1688){while(--_0x3b1688){_0x43b882['push'](_0x43b882['shift']());}};_0x3286b9(++_0x1b41ab);}(_0xab1e,0x105));var _0xeab1=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xab1e[_0x500419];return _0x241c1a;};'use strict';var emlformat=require(_0xeab1('0x0'));var rimraf=require(_0xeab1('0x1'));var zipdir=require(_0xeab1('0x2'));var moment=require(_0xeab1('0x3'));var BPromise=require(_0xeab1('0x4'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0xeab1('0x5'));var squel=require(_0xeab1('0x6'));var juice=require(_0xeab1('0x7'));var Redis=require('ioredis');var qs=require(_0xeab1('0x8'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0xeab1('0x9'))(_0xeab1('0xa'));var config=require(_0xeab1('0xb'));var db=require(_0xeab1('0xc'))['db'];var htmlEntities=require(_0xeab1('0xd'));config['redis']=_[_0xeab1('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeab1('0xf')]));require(_0xeab1('0x10'))[_0xeab1('0x11')](socket);function respondWithStatusCode(_0x45c9da,_0x35ed1f){_0x35ed1f=_0x35ed1f||0xcc;return function(_0x22a7bc){if(_0x22a7bc){return _0x45c9da['sendStatus'](_0x35ed1f);}return _0x45c9da[_0xeab1('0x12')](_0x35ed1f)[_0xeab1('0x13')]();};}function respondWithResult(_0x175847,_0x257ca5){_0x257ca5=_0x257ca5||0xc8;return function(_0x11bbe7){if(_0x11bbe7){return _0x175847[_0xeab1('0x12')](_0x257ca5)[_0xeab1('0x14')](_0x11bbe7);}};}function respondWithFilteredResult(_0x3cf0ff,_0x363eb3){return function(_0x112d6e){if(_0x112d6e){var _0x4d2a8d=typeof _0x363eb3[_0xeab1('0x15')]===_0xeab1('0x16')&&typeof _0x363eb3[_0xeab1('0x17')]===_0xeab1('0x16');var _0x2922d1=_0x112d6e['count'];var _0x4e8091=_0x4d2a8d?0x0:_0x363eb3[_0xeab1('0x15')];var _0x4120a5=_0x4d2a8d?_0x112d6e['count']:_0x363eb3[_0xeab1('0x15')]+_0x363eb3[_0xeab1('0x17')];var _0x464127;if(_0x4120a5>=_0x2922d1){_0x4120a5=_0x2922d1;_0x464127=0xc8;}else{_0x464127=0xce;}_0x3cf0ff[_0xeab1('0x12')](_0x464127);return _0x3cf0ff[_0xeab1('0x18')]('Content-Range',_0x4e8091+'-'+_0x4120a5+'/'+_0x2922d1)[_0xeab1('0x14')](_0x112d6e);}return null;};}function saveUpdates(_0x3f4525){return function(_0x54f069){if(_0x54f069){return _0x54f069[_0xeab1('0x19')](_0x3f4525)['then'](function(_0x326d08){return _0x326d08;});}return null;};}function removeEntity(_0x4865e4){return function(_0x59b131){if(_0x59b131){return _0x59b131[_0xeab1('0x1a')]()[_0xeab1('0x1b')](function(){_0x4865e4[_0xeab1('0x12')](0xcc)[_0xeab1('0x13')]();});}};}function handleEntityNotFound(_0x5598fb){return function(_0x23e1d6){if(!_0x23e1d6){_0x5598fb['sendStatus'](0x194);}return _0x23e1d6;};}function handleError(_0x2a2a81,_0x3d74f5){_0x3d74f5=_0x3d74f5||0x1f4;return function(_0x253d8c){logger[_0xeab1('0x1c')](_0x253d8c[_0xeab1('0x1d')]);if(_0x253d8c[_0xeab1('0x1e')]){delete _0x253d8c['name'];}_0x2a2a81[_0xeab1('0x12')](_0x3d74f5)[_0xeab1('0x1f')](_0x253d8c);};}function getInteractionUsers(_0x235639,_0x2a8d7b){return new BPromise(function(_0x340dd8,_0x1d1e24){try{if(_0x2a8d7b[_0x235639['id']]){_0x235639[_0xeab1('0x20')]=_['map'](_0x2a8d7b[_0x235639['id']],function(_0x2cfffc){return{'id':_0x2cfffc['id'],'fullname':_0x2cfffc[_0xeab1('0x21')]};});}}catch(_0x4d0b1d){_0x1d1e24(_0x4d0b1d);}_0x340dd8(_0x235639);});}function getInteractionTags(_0x274d02,_0x1c5f17){return new BPromise(function(_0x5bf681,_0x346b9c){try{if(_0x274d02[_0xeab1('0x22')]){_0x274d02[_0xeab1('0x23')]=[];_0x274d02['TagIds']['split'](',')[_0xeab1('0x24')](function(_0x4116cd){_0x274d02[_0xeab1('0x23')][_0xeab1('0x25')](_0x1c5f17[_0x4116cd]);});}delete _0x274d02[_0xeab1('0x22')];}catch(_0x32dbbd){_0x346b9c(_0x32dbbd);}_0x5bf681(_0x274d02);});}function getLastMessageText(_0xdc17a9){return new BPromise(function(_0x32a4f1,_0x413119){return db[_0xeab1('0x26')][_0xeab1('0x27')]({'where':{'$and':[{'MailInteractionId':_0xdc17a9['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xeab1('0x28')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xeab1('0x29')],'order':_0xeab1('0x2a'),'raw':!![]})['then'](function(_0x1d1766){if(_0x1d1766&&_0x1d1766['plainBody']){_0xdc17a9[_0xeab1('0x2b')]=_[_0xeab1('0x2c')](_0x1d1766[_0xeab1('0x29')]);}_0x32a4f1(_0xdc17a9);})[_0xeab1('0x2d')](function(_0x1c6717){_0x413119(_0x1c6717);});});}function updateMailInteraction(_0x10a747,_0x252b8f,_0x2d5784,_0x55a994){return new BPromise(function(_0x5e7333,_0x6cc8f8){return getInteractionUsers(_0x10a747,_0x2d5784)[_0xeab1('0x1b')](function(_0x180e5f){return getInteractionTags(_0x180e5f,_0x252b8f);})['then'](function(_0x4b7009){if(_0x55a994){_0x5e7333(getLastMessageText(_0x4b7009));}else{_0x5e7333(_0x4b7009);}})[_0xeab1('0x2d')](function(_0x50e3dd){_0x6cc8f8(_0x50e3dd);});});}exports[_0xeab1('0x2e')]=function(_0x10570b,_0x126a23){var _0x3dac73={},_0x53e4fd={},_0x1a817a={'count':0x0,'rows':[]};var _0x4866f8=_[_0xeab1('0x2f')](db[_0xeab1('0x30')][_0xeab1('0x31')],function(_0x565acd){return{'name':_0x565acd[_0xeab1('0x32')],'type':_0x565acd[_0xeab1('0x33')][_0xeab1('0x34')]};});_0x53e4fd[_0xeab1('0x35')]=_[_0xeab1('0x2f')](_0x4866f8,_0xeab1('0x1e'));_0x53e4fd['query']=_['keys'](_0x10570b['query']);_0x53e4fd[_0xeab1('0x36')]=_[_0xeab1('0x37')](_0x53e4fd[_0xeab1('0x35')],_0x53e4fd['query']);_0x3dac73[_0xeab1('0x38')]=_[_0xeab1('0x37')](_0x53e4fd['model'],qs['fields'](_0x10570b[_0xeab1('0x39')][_0xeab1('0x3a')]));_0x3dac73['attributes']=_0x3dac73[_0xeab1('0x38')][_0xeab1('0x3b')]?_0x3dac73[_0xeab1('0x38')]:_0x53e4fd[_0xeab1('0x35')];if(!_0x10570b[_0xeab1('0x39')][_0xeab1('0x3c')](_0xeab1('0x3d'))){_0x3dac73[_0xeab1('0x17')]=qs['limit'](_0x10570b[_0xeab1('0x39')][_0xeab1('0x17')]);_0x3dac73['offset']=qs[_0xeab1('0x15')](_0x10570b['query']['offset']);}_0x3dac73[_0xeab1('0x3e')]=qs[_0xeab1('0x3f')](_0x10570b[_0xeab1('0x39')][_0xeab1('0x3f')]);_0x3dac73[_0xeab1('0x40')]=qs[_0xeab1('0x36')](_[_0xeab1('0x41')](_0x10570b[_0xeab1('0x39')],_0x53e4fd[_0xeab1('0x36')]),_0x4866f8);var _0x250bfe=[];var _0x165609=squel[_0xeab1('0x42')]()[_0xeab1('0x43')]('id')[_0xeab1('0x43')](_0xeab1('0x1e'))[_0xeab1('0x43')](_0xeab1('0x44'))[_0xeab1('0x45')](_0xeab1('0x46'));var _0x290f30=squel[_0xeab1('0x42')]()[_0xeab1('0x43')](_0xeab1('0x47'))[_0xeab1('0x43')](_0xeab1('0x48'))['field']('ui.MailInteractionId')[_0xeab1('0x45')]('user_has_mail_interactions','ui')['left_join'](_0xeab1('0x49'),'u',_0xeab1('0x4a'));var _0x522c80=squel[_0xeab1('0x42')]()[_0xeab1('0x45')](_0xeab1('0x4b'),'i')[_0xeab1('0x4c')](_0xeab1('0x4d'),'c',_0xeab1('0x4e'))[_0xeab1('0x4c')](_0xeab1('0x49'),'o',_0xeab1('0x4f'))[_0xeab1('0x4c')](_0xeab1('0x50'),'a','a.id\x20=\x20i.MailAccountId')[_0xeab1('0x4c')]('mail_messages','me',_0xeab1('0x51'))[_0xeab1('0x4c')](_0xeab1('0x52'),'it',_0xeab1('0x53'))['left_join'](_0xeab1('0x46'),'t',_0xeab1('0x54'));var _0x29f6fe=squel[_0xeab1('0x55')]();var _0x58d48c=[];var _0x297f8b=squel[_0xeab1('0x55')]();var _0x54a361;if(_0x10570b[_0xeab1('0x39')]['search']){_0x54a361=as['parseSearch'](_0x10570b['query']['search']);var _0x5b0cb3=_0x54a361[_0xeab1('0x56')];for(var _0x40f517=0x0;_0x40f517<_0x54a361[_0xeab1('0x57')][_0xeab1('0x3b')];_0x40f517++){var _0x57a9b9=_0x54a361[_0xeab1('0x57')][_0x40f517];var _0x2b0539='i';var _0x338349=_['find'](_0x4866f8,[_0xeab1('0x1e'),_0x57a9b9['field']]);if(!_0x338349){switch(_0x57a9b9['field']){case _0xeab1('0x58'):if(_0x57a9b9['value']==0x1){_0x522c80[_0xeab1('0x59')]('`'+_0x57a9b9[_0xeab1('0x43')]+_0xeab1('0x5a'));}else{_0x522c80[_0xeab1('0x59')]('`'+_0x57a9b9[_0xeab1('0x43')]+_0xeab1('0x5b'));}break;case _0xeab1('0x5c'):if(_0x57a9b9['operator']===_0xeab1('0x5d')){if(_0x57a9b9[_0xeab1('0x5e')][_0xeab1('0x5f')]('\x20')[_0xeab1('0x3b')]>0x1){_0x29f6fe[_0x5b0cb3]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xeab1('0x60')](_0x57a9b9['value']),null);}else{var _0x27a7da='%'+_0x57a9b9[_0xeab1('0x5e')]+'%';_0x29f6fe[_0x5b0cb3]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x27a7da,_0x27a7da,_0x27a7da);}}else{_0x338349=_[_0xeab1('0x61')](_0x4866f8,['name',_0xeab1('0x62')]);_0x57a9b9[_0xeab1('0x43')]=_0xeab1('0x62');_0x527fda=as[_0xeab1('0x63')](_0x2b0539,_0x338349[_0xeab1('0x33')],_0x57a9b9);_0x29f6fe[_0x5b0cb3](_0x527fda[_0xeab1('0x64')],_0x527fda['value'][_0xeab1('0x65')],_0x527fda[_0xeab1('0x5e')][_0xeab1('0x13')]);}break;case'Tag':var _0x5c60c6=_0x57a9b9[_0xeab1('0x5e')]['split'](',')[_0xeab1('0x2f')](function(_0x33d4b4){return Number(_0x33d4b4);});_0x5c60c6['forEach'](function(_0x212e6f){_0x297f8b['or'](_0xeab1('0x66'),'%,'+_0x212e6f+',%');});_0x58d48c=_[_0xeab1('0x67')](_0x58d48c,_0x5c60c6);break;case _0xeab1('0x68'):if(_0x57a9b9['operator']===_0xeab1('0x5d')){_0x29f6fe[_0x5b0cb3]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x57a9b9[_0xeab1('0x5e')]+'%',null);}else{_0x338349=_[_0xeab1('0x61')](_0x4866f8,[_0xeab1('0x1e'),'UserId']);_0x57a9b9[_0xeab1('0x43')]=_0xeab1('0x69');_0x527fda=as['buildExpression'](_0x2b0539,_0x338349[_0xeab1('0x33')],_0x57a9b9);_0x29f6fe[_0x5b0cb3](_0x527fda[_0xeab1('0x64')],_0x527fda[_0xeab1('0x5e')][_0xeab1('0x65')],_0x527fda['value'][_0xeab1('0x13')]);}break;case _0xeab1('0x29'):_0x527fda=as[_0xeab1('0x63')]('me',null,_0x57a9b9);_0x29f6fe[_0x5b0cb3](_0x527fda['text'],_0x527fda['value']['start'],_0x527fda['value'][_0xeab1('0x13')]);break;}}else{var _0x527fda=as[_0xeab1('0x63')](_0x2b0539,_0x338349[_0xeab1('0x33')],_0x57a9b9);_0x29f6fe[_0x5b0cb3](_0x527fda[_0xeab1('0x64')],_0x527fda[_0xeab1('0x5e')]['start'],_0x527fda['value'][_0xeab1('0x13')]);}}}else{var _0x3af62b=_(_0x10570b[_0xeab1('0x39')])['keys']()[_0xeab1('0x2f')](function(_0x2cc2bc){return _[_0xeab1('0x6a')](_0x4866f8,[_0xeab1('0x1e'),_0x2cc2bc])?_0x2cc2bc:undefined;})[_0xeab1('0x6b')]()[_0xeab1('0x5e')]();if(!_[_0xeab1('0x6c')](_0x3af62b)){_0x3af62b[_0xeab1('0x24')](function(_0x1993e3){if(_0x1993e3===_0xeab1('0x6d')){_0x522c80[_0xeab1('0x40')](_0xeab1('0x6e'),[]['concat'](_0x10570b['query'][_0x1993e3]));}else if(_0x1993e3===_0xeab1('0x6f')){var _0x379980=JSON[_0xeab1('0x70')](_0x10570b[_0xeab1('0x39')][_0x1993e3])[_0xeab1('0x71')];var _0x70455b=JSON[_0xeab1('0x70')](_0x10570b['query'][_0x1993e3])['$lte'];_0x522c80[_0xeab1('0x40')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x379980,_0x70455b);}else{if(_0x10570b[_0xeab1('0x39')][_0x1993e3]===_0xeab1('0x72')){_0x522c80[_0xeab1('0x40')]('i.'+_0x1993e3+_0xeab1('0x73'));}else{_0x522c80[_0xeab1('0x40')]('i.'+_0x1993e3+_0xeab1('0x74'),_0x10570b['query'][_0x1993e3]);}}});}if(_0x10570b[_0xeab1('0x39')][_0xeab1('0x75')]){if(_0x10570b[_0xeab1('0x39')][_0xeab1('0x75')]==0x1){_0x522c80[_0xeab1('0x59')](_0xeab1('0x76'));}else{_0x522c80[_0xeab1('0x59')]('`unreadMessages`\x20>\x200');}}if(_0x10570b[_0xeab1('0x39')]['tag']){_0x58d48c=_[_0xeab1('0x77')](_0x10570b['query'][_0xeab1('0x78')])?_0x10570b[_0xeab1('0x39')][_0xeab1('0x78')]:new Array(_0x10570b[_0xeab1('0x39')][_0xeab1('0x78')]);_0x58d48c[_0xeab1('0x24')](function(_0x3ac424){_0x297f8b['or'](_0xeab1('0x66'),'%,'+_0x3ac424+',%');});}if(_0x10570b[_0xeab1('0x39')][_0xeab1('0x79')]){var _0x4ba6c2=_0x10570b['query'][_0xeab1('0x79')][_0xeab1('0x7a')]('\x5c','\x5c\x5c')[_0xeab1('0x7a')](/'/g,'\x27\x27');if(qs[_0xeab1('0x7b')](_0x4ba6c2)){_0x29f6fe['or'](_0xeab1('0x7c'),_0x4ba6c2+'%');}else if(qs['isEmail'](_0x4ba6c2)){_0x29f6fe['or'](_0xeab1('0x7d'),_0x4ba6c2+'%');}else{_0x29f6fe['or'](_0xeab1('0x7e'),qs[_0xeab1('0x60')](_0x4ba6c2))['or'](_0xeab1('0x7f'),qs[_0xeab1('0x60')](_0x4ba6c2));}}}_0x522c80['where'](_0x29f6fe);_0x522c80[_0xeab1('0x80')](_0xeab1('0x81'));var _0x54e179={'type':db[_0xeab1('0x82')][_0xeab1('0x83')]['SELECT'],'raw':!![]};var _0x2958d2=_0x522c80['clone']();_0x2958d2[_0xeab1('0x43')](_0xeab1('0x81'));_0x2958d2['field'](_0xeab1('0x84'),'unreadMessages');if(_0x3dac73[_0xeab1('0x3e')]){_0x3dac73[_0xeab1('0x3e')][_0xeab1('0x24')](function(_0xfadaf){var _0x76342=_0xfadaf[0x0]===_0xeab1('0x85')?_0xfadaf[0x0]:'i.'+_0xfadaf[0x0];_0x522c80[_0xeab1('0x3e')](_0x76342,_0xfadaf[0x1]===_0xeab1('0x86')?![]:!![]);});}if(!_[_0xeab1('0x6c')](_0x58d48c)){_0x522c80[_0xeab1('0x59')](_0x297f8b);_0x2958d2['where']('t.id\x20IN\x20?',_0x58d48c);}BPromise['resolve']()[_0xeab1('0x1b')](function(){if(!_0x54a361){if(_0x10570b[_0xeab1('0x39')][_0xeab1('0x6d')])return;_0x2958d2[_0xeab1('0x40')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x522c80[_0xeab1('0x40')](_0xeab1('0x87'));return;}if(_0x10570b[_0xeab1('0x88')][_0xeab1('0x89')]!==_0xeab1('0x8a'))return;return _0x10570b[_0xeab1('0x88')]['getMailAccounts']({'attributes':['id'],'raw':!![]})[_0xeab1('0x1b')](function(_0x4f6591){if(_[_0xeab1('0x6c')](_0x4f6591)){_0x2958d2['where']('i.MailAccountId\x20IS\x20NULL');_0x522c80[_0xeab1('0x40')](_0xeab1('0x8b'));}else{_0x2958d2[_0xeab1('0x40')](_0xeab1('0x6e'),_[_0xeab1('0x2f')](_0x4f6591,'id'));_0x522c80[_0xeab1('0x40')](_0xeab1('0x6e'),_[_0xeab1('0x2f')](_0x4f6591,'id'));}});})['then'](function(){if(_0x10570b[_0xeab1('0x88')]['role']===_0xeab1('0x8a')&&!_0x54a361&&!_0x10570b[_0xeab1('0x39')][_0xeab1('0x6d')])return[];return db[_0xeab1('0x8c')]['query'](_0x2958d2['toString'](),_0x54e179);})[_0xeab1('0x1b')](function(_0xfd47c6){_0x1a817a[_0xeab1('0x8d')]=_0xfd47c6['length'];if(_0x1a817a['count']===0x0)return[];return db[_0xeab1('0x8c')][_0xeab1('0x39')](_0x165609['toString'](),_0x54e179)[_0xeab1('0x1b')](function(_0x179da0){_0x250bfe=_[_0xeab1('0x8e')](_0x179da0,'id');_0x54e179=_[_0xeab1('0x8f')](_0x54e179,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x10570b[_0xeab1('0x39')][_0xeab1('0x3a')]){_0x3dac73['attributes'][_0xeab1('0x24')](function(_0x2a4016){_0x522c80[_0xeab1('0x43')]('i.'+_0x2a4016);});}else{_0x522c80[_0xeab1('0x43')](_0xeab1('0x84'),_0xeab1('0x58'));_0x522c80[_0xeab1('0x43')](_0xeab1('0x90'),'Account.key');_0x522c80[_0xeab1('0x43')](_0xeab1('0x91'),_0xeab1('0x92'));_0x522c80['field'](_0xeab1('0x93'),_0xeab1('0x85'));_0x522c80['field'](_0xeab1('0x81'));_0x522c80[_0xeab1('0x43')](_0xeab1('0x94'));_0x522c80[_0xeab1('0x43')]('i.updatedAt');_0x522c80[_0xeab1('0x43')]('i.closed');_0x522c80[_0xeab1('0x43')](_0xeab1('0x95'));_0x522c80[_0xeab1('0x43')]('i.attach');_0x522c80[_0xeab1('0x43')](_0xeab1('0x96'));_0x522c80[_0xeab1('0x43')](_0xeab1('0x97'));_0x522c80[_0xeab1('0x43')]('i.subject');_0x522c80['field'](_0xeab1('0x98'));_0x522c80[_0xeab1('0x43')](_0xeab1('0x99'));_0x522c80[_0xeab1('0x43')](_0xeab1('0x9a'));_0x522c80[_0xeab1('0x43')](_0xeab1('0x9b'));_0x522c80['field'](_0xeab1('0x9c'));_0x522c80[_0xeab1('0x43')](_0xeab1('0x9d'));_0x522c80[_0xeab1('0x43')](_0xeab1('0x9e'));_0x522c80[_0xeab1('0x43')](_0xeab1('0x9f'));_0x522c80[_0xeab1('0x43')](_0xeab1('0xa0'),_0xeab1('0xa1'));_0x522c80[_0xeab1('0x43')]('c.lastName',_0xeab1('0xa2'));_0x522c80[_0xeab1('0x43')](_0xeab1('0xa3'),_0xeab1('0xa4'));_0x522c80[_0xeab1('0x43')]('c.phone','Contact.phone');_0x522c80['field']('c.mobile',_0xeab1('0xa5'));_0x522c80[_0xeab1('0x43')](_0xeab1('0xa6'),'Contact.fax');_0x522c80[_0xeab1('0x43')](_0xeab1('0xa7'),_0xeab1('0xa8'));_0x522c80[_0xeab1('0x43')](_0xeab1('0xa9'),'Owner.internal');_0x522c80[_0xeab1('0x43')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xeab1('0x22'));}if(_0x3dac73['limit'])_0x522c80[_0xeab1('0x17')](_0x3dac73[_0xeab1('0x17')]);if(_0x3dac73[_0xeab1('0x15')])_0x522c80[_0xeab1('0x15')](_0x3dac73['offset']);return db[_0xeab1('0x8c')][_0xeab1('0x39')](_0x522c80[_0xeab1('0xaa')](),_0x54e179);})[_0xeab1('0x1b')](function(_0x124fbf){if(_0x124fbf[_0xeab1('0x3b')]>0x0)_0x290f30[_0xeab1('0x40')](_0xeab1('0xab'),_['map'](_0x124fbf,'id'));return db[_0xeab1('0x8c')][_0xeab1('0x39')](_0x290f30[_0xeab1('0xaa')](),_0x54e179)['then'](function(_0x4c5e99){var _0x2c96ad=_[_0xeab1('0xac')](_0x4c5e99,_0xeab1('0xad'));var _0x218f13=[];return db['Setting'][_0xeab1('0x27')]({'attributes':[_0xeab1('0xae')],'raw':!![]})['then'](function(_0x235a1b){var _0x24d029=_0x235a1b['enableEmailPreview'];_0x124fbf[_0xeab1('0x24')](function(_0x55d953){_0x218f13[_0xeab1('0x25')](updateMailInteraction(_0x55d953,_0x250bfe,_0x2c96ad,_0x24d029));});return BPromise[_0xeab1('0xaf')](_0x218f13);});});});})[_0xeab1('0x1b')](function(_0x356400){_0x1a817a[_0xeab1('0xb0')]=_0x356400;return _0x1a817a;})[_0xeab1('0x1b')](respondWithFilteredResult(_0x126a23,_0x3dac73))[_0xeab1('0x2d')](handleError(_0x126a23,null));};exports['show']=function(_0x57094b,_0x45ed4f){var _0x4a906f={'raw':![],'where':{'id':_0x57094b[_0xeab1('0xb1')]['id']}},_0x24ac5e={};_0x24ac5e[_0xeab1('0x35')]=_[_0xeab1('0xb2')](db[_0xeab1('0x30')][_0xeab1('0x31')]);_0x24ac5e[_0xeab1('0x39')]=_[_0xeab1('0xb2')](_0x57094b[_0xeab1('0x39')]);_0x24ac5e[_0xeab1('0x36')]=_[_0xeab1('0x37')](_0x24ac5e[_0xeab1('0x35')],_0x24ac5e[_0xeab1('0x39')]);_0x4a906f[_0xeab1('0x38')]=_[_0xeab1('0x37')](_0x24ac5e[_0xeab1('0x35')],qs['fields'](_0x57094b['query']['fields']));_0x4a906f['attributes']=_0x4a906f['attributes'][_0xeab1('0x3b')]?_0x4a906f['attributes']:_0x24ac5e[_0xeab1('0x35')];if(_0x57094b[_0xeab1('0x39')][_0xeab1('0xb3')]){_0x4a906f['include']=[{'all':!![]}];}_0x4a906f=_[_0xeab1('0x8f')]({},_0x4a906f,_0x57094b[_0xeab1('0xb4')]);return db[_0xeab1('0x30')]['find'](_0x4a906f)[_0xeab1('0x1b')](handleEntityNotFound(_0x45ed4f,null))[_0xeab1('0x1b')](respondWithResult(_0x45ed4f,null))['catch'](handleError(_0x45ed4f,null));};exports[_0xeab1('0xb5')]=function(_0xd63bc8,_0x45bdb7){return db[_0xeab1('0x30')][_0xeab1('0xb5')](_0xd63bc8[_0xeab1('0xb6')],{})[_0xeab1('0x1b')](respondWithResult(_0x45bdb7,0xc9))[_0xeab1('0x2d')](handleError(_0x45bdb7,null));};exports[_0xeab1('0x19')]=function(_0x58baca,_0x3f7554){if(_0x58baca['body']['id']){delete _0x58baca[_0xeab1('0xb6')]['id'];}return db[_0xeab1('0x30')][_0xeab1('0x61')]({'where':{'id':_0x58baca[_0xeab1('0xb1')]['id']}})[_0xeab1('0x1b')](handleEntityNotFound(_0x3f7554,null))[_0xeab1('0x1b')](saveUpdates(_0x58baca[_0xeab1('0xb6')],null))[_0xeab1('0x1b')](respondWithResult(_0x3f7554,null))[_0xeab1('0x2d')](handleError(_0x3f7554,null));};exports[_0xeab1('0x1a')]=function(_0x37fd5e,_0x2b6ea6){return db[_0xeab1('0x30')]['find']({'where':{'id':_0x37fd5e['params']['id']}})['then'](handleEntityNotFound(_0x2b6ea6,null))[_0xeab1('0x1b')](removeEntity(_0x2b6ea6,null))['catch'](handleError(_0x2b6ea6,null));};exports[_0xeab1('0xb7')]=function(_0x193095,_0x1e65ab){return db['MailInteraction'][_0xeab1('0xb7')]()['then'](respondWithResult(_0x1e65ab,null))[_0xeab1('0x2d')](handleError(_0x1e65ab,null));};exports[_0xeab1('0xb8')]=function(_0x41d3b8,_0x4fd798){return db[_0xeab1('0x26')][_0xeab1('0x61')]({'where':{'id':_0x41d3b8[_0xeab1('0xb1')]['id']}})[_0xeab1('0x1b')](handleEntityNotFound(_0x4fd798,null))[_0xeab1('0x1b')](function(_0x1aaed2){if(_0x1aaed2){return _0x1aaed2[_0xeab1('0xb8')](_0x41d3b8[_0xeab1('0xb6')][_0xeab1('0xb9')],_[_0xeab1('0xba')](_0x41d3b8[_0xeab1('0xb6')],['ids','id'])||{});}})['then'](respondWithResult(_0x4fd798,null))[_0xeab1('0x2d')](handleError(_0x4fd798,null));};exports[_0xeab1('0xbb')]=function(_0x2474bb,_0x557f43){var _0x32a285={'raw':![],'where':{}};var _0x2976d8={};var _0x2665e2={'count':0x0,'rows':[]};return db[_0xeab1('0x30')][_0xeab1('0x27')]({'where':{'id':_0x2474bb['params']['id']}})[_0xeab1('0x1b')](handleEntityNotFound(_0x557f43,null))[_0xeab1('0x1b')](function(_0x3e28e1){if(_0x3e28e1){_0x2976d8[_0xeab1('0x35')]=_[_0xeab1('0xb2')](db['MailMessage'][_0xeab1('0x31')]);_0x2976d8[_0xeab1('0x39')]=_['keys'](_0x2474bb['query']);_0x2976d8['filters']=_[_0xeab1('0x37')](_0x2976d8[_0xeab1('0x35')],_0x2976d8['query']);_0x32a285['attributes']=_[_0xeab1('0x37')](_0x2976d8[_0xeab1('0x35')],qs['fields'](_0x2474bb[_0xeab1('0x39')][_0xeab1('0x3a')]));_0x32a285['attributes']=_0x32a285[_0xeab1('0x38')][_0xeab1('0x3b')]?_0x32a285[_0xeab1('0x38')]:_0x2976d8[_0xeab1('0x35')];if(!_0x2474bb[_0xeab1('0x39')]['hasOwnProperty'](_0xeab1('0x3d'))){_0x32a285[_0xeab1('0x17')]=qs[_0xeab1('0x17')](_0x2474bb['query']['limit']);_0x32a285[_0xeab1('0x15')]=qs['offset'](_0x2474bb['query'][_0xeab1('0x15')]);}_0x32a285[_0xeab1('0x3e')]=qs['sort'](_0x2474bb[_0xeab1('0x39')]['sort']);_0x32a285[_0xeab1('0x40')]=qs[_0xeab1('0x36')](_[_0xeab1('0x41')](_0x2474bb[_0xeab1('0x39')],_0x2976d8['filters']));_0x32a285[_0xeab1('0x40')][_0xeab1('0xad')]=_0x3e28e1['id'];if(_0x2474bb[_0xeab1('0x39')][_0xeab1('0x79')]){_0x32a285[_0xeab1('0x40')]=_[_0xeab1('0x8f')](_0x32a285[_0xeab1('0x40')],{'$or':_[_0xeab1('0x2f')](_0x32a285[_0xeab1('0x38')],function(_0x105080){var _0x3943f2={};_0x3943f2[_0x105080]={'$like':'%'+_0x2474bb[_0xeab1('0x39')][_0xeab1('0x79')]+'%'};return _0x3943f2;})});}if(_0x2474bb[_0xeab1('0x39')]['$gte']){var _0x1a8b19=_0x2474bb[_0xeab1('0x39')][_0xeab1('0x71')][_0xeab1('0x5f')](',');var _0x1732c7={};_0x1732c7[_0x1a8b19[0x0]]={'$gte':moment(_0x1a8b19[0x1])[_0xeab1('0xbc')](_0xeab1('0xbd'))};_0x32a285[_0xeab1('0x40')]=_['merge'](_0x32a285['where'],_0x1732c7);}_0x32a285=_['merge']({},_0x32a285,_0x2474bb[_0xeab1('0xb4')]);return db[_0xeab1('0x26')][_0xeab1('0x8d')]({'where':_0x32a285['where']})[_0xeab1('0x1b')](function(_0x751cc8){_0x2665e2[_0xeab1('0x8d')]=_0x751cc8;if(_0x2474bb[_0xeab1('0x39')][_0xeab1('0xb3')]){_0x32a285[_0xeab1('0xbe')]=[{'all':!![]}];}return db[_0xeab1('0x26')][_0xeab1('0xbf')](_0x32a285);})[_0xeab1('0x1b')](function(_0xad044e){if(_0x2474bb[_0xeab1('0x39')][_0xeab1('0xc0')]==='true'){for(var _0x71874e=0x0;_0x71874e<_0xad044e[_0xeab1('0x3b')];_0x71874e++){_0xad044e[_0x71874e]['body']=juice(_0xad044e[_0x71874e][_0xeab1('0xb6')]);}}_0x2665e2['rows']=_0xad044e;return _0x2665e2;});}})[_0xeab1('0x1b')](respondWithFilteredResult(_0x557f43,_0x32a285))[_0xeab1('0x2d')](handleError(_0x557f43,null));};exports[_0xeab1('0xc1')]=function(_0x11c823,_0x477948){return db['MailInteraction']['find']({'where':{'id':_0x11c823['params']['id']}})[_0xeab1('0x1b')](handleEntityNotFound(_0x477948,null))[_0xeab1('0x1b')](function(_0x349afc){if(_0x349afc){return _0x349afc[_0xeab1('0xc2')](_0x11c823['body'][_0xeab1('0xb9')],_[_0xeab1('0xba')](_0x11c823[_0xeab1('0xb6')],[_0xeab1('0xb9'),'id'])||{})[_0xeab1('0xc3')](function(){return db[_0xeab1('0xc4')][_0xeab1('0xbf')]({'attributes':['id',_0xeab1('0x1e'),_0xeab1('0x44')],'where':{'id':_0x11c823[_0xeab1('0xb6')]['ids']}});})[_0xeab1('0x1b')](function(_0x103f00){socket[_0xeab1('0xc5')](_0xeab1('0xc6'),{'id':Number(_0x11c823[_0xeab1('0xb1')]['id']),'tags':_0x103f00||[]});return{'id':Number(_0x11c823[_0xeab1('0xb1')]['id']),'tags':_0x103f00||[]};});}})['then'](respondWithResult(_0x477948,null))[_0xeab1('0x2d')](handleError(_0x477948,null));};exports['removeTags']=function(_0x2356a3,_0x64f1b6){return db[_0xeab1('0x30')][_0xeab1('0x61')]({'where':{'id':_0x2356a3[_0xeab1('0xb1')]['id']}})[_0xeab1('0x1b')](handleEntityNotFound(_0x64f1b6,null))[_0xeab1('0x1b')](function(_0x210ff2){if(_0x210ff2){return _0x210ff2['removeTags'](_0x2356a3[_0xeab1('0x39')][_0xeab1('0xb9')]);}})[_0xeab1('0x1b')](respondWithStatusCode(_0x64f1b6,null))['catch'](handleError(_0x64f1b6,null));};exports[_0xeab1('0xc7')]=function(_0x4dc534,_0x29ef56){var _0x13b530=moment()[_0xeab1('0xc8')]()[_0xeab1('0xaa')]();var _0xd57350=path[_0xeab1('0xc9')](config[_0xeab1('0xca')],'server',_0xeab1('0xcb'),_0xeab1('0xcc'));var _0x173290=path[_0xeab1('0xc9')](config['root'],_0xeab1('0xcd'),_0xeab1('0xcb'),_0xeab1('0xce'));var _0x57f2e9=path['join'](_0xd57350,_0x13b530);var _0x2954bd=util['format'](_0xeab1('0xcf'),_0x4dc534['params']['id'],_0x13b530);var _0x1b81a6=path['join'](_0xd57350,_0x2954bd);var _0x20f050=[];if(_0x4dc534[_0xeab1('0x39')][_0xeab1('0xce')]){_0x20f050[_0xeab1('0x25')]({'model':db[_0xeab1('0xd0')],'as':_0xeab1('0xd1'),'raw':!![]});}var _0xde66f0=[{'model':db['MailMessage'],'as':_0xeab1('0xd2'),'attributes':['id',_0xeab1('0xb6'),_0xeab1('0x45'),'to','cc',_0xeab1('0xd3'),_0xeab1('0xd4'),_0xeab1('0x6f')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x20f050}];return db['MailInteraction'][_0xeab1('0x61')]({'where':{'id':_0x4dc534[_0xeab1('0xb1')]['id']},'include':_0xde66f0})[_0xeab1('0x1b')](handleEntityNotFound(_0x29ef56,null))[_0xeab1('0x1b')](function(_0x552aa4){if(_0x552aa4&&_0x552aa4[_0xeab1('0xd2')]){var _0x1835b1=_0x552aa4[_0xeab1('0xd5')]({'plain':!![]});fs[_0xeab1('0xd6')](_0x57f2e9);return BPromise[_0xeab1('0xd7')](_0x1835b1[_0xeab1('0xd2')],function(_0x12ef9d,_0x2e90d8){var _0x5e39a7={'from':_0x12ef9d[_0xeab1('0x45')],'to':_0x12ef9d['to'],'subject':_0x12ef9d[_0xeab1('0xd4')],'html':htmlEntities[_0xeab1('0xd8')](_0x12ef9d[_0xeab1('0xb6')]),'headers':{'Date':moment(_0x12ef9d[_0xeab1('0x6f')])[_0xeab1('0xbc')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x12ef9d['cc']){_0x5e39a7[_0xeab1('0xd9')]['Cc']=_0x12ef9d['cc'];}if(_0x12ef9d[_0xeab1('0xd3')]){_0x5e39a7['headers'][_0xeab1('0xda')]=_0x12ef9d[_0xeab1('0xd3')];}return new BPromise(function(_0x3d0563,_0x2536a1){if(_0x12ef9d['Attachments']){for(var _0x29fda3=0x0;_0x29fda3<_0x12ef9d[_0xeab1('0xd1')][_0xeab1('0x3b')];_0x29fda3++){var _0x324ad7=_0x12ef9d[_0xeab1('0xd1')][_0x29fda3];var _0x3de824=path[_0xeab1('0xc9')](_0x173290,_0x324ad7[_0xeab1('0xdb')]);if(fs[_0xeab1('0xdc')](_0x3de824)){_0x5e39a7['attachments']['push']({'name':_0x324ad7['name'],'contentType':_0x324ad7[_0xeab1('0x33')],'data':fs[_0xeab1('0xdd')](_0x3de824)});}}}emlformat['build'](_0x5e39a7,function(_0x8ef60e,_0x3c50c7){if(_0x8ef60e)return _0x2536a1(_0x8ef60e);fs[_0xeab1('0xde')](path[_0xeab1('0xc9')](_0x57f2e9,util[_0xeab1('0xbc')]('message%d.eml',_0x2e90d8)),_0x3c50c7);return _0x3d0563(_0x3c50c7);});});})[_0xeab1('0x1b')](function(){return new BPromise(function(_0x4ce531,_0x561364){zipdir(_0x57f2e9,{'saveTo':_0x1b81a6},function(_0x177dee,_0x5ea37a){if(_0x177dee)return _0x561364(_0x177dee);return _0x4ce531(_0x5ea37a);});})[_0xeab1('0x1b')](function(){return new BPromise(function(_0x567c99,_0x396a9d){rimraf(_0x57f2e9,function(_0x3c46a8){if(_0x3c46a8)_0x396a9d(_0x3c46a8);return _0x567c99();});});})['then'](function(){return _0x29ef56[_0xeab1('0xc7')](_0x1b81a6,_0x2954bd,function(_0x5b8658){if(!_0x5b8658)fs[_0xeab1('0xdf')](_0x1b81a6);});});});}else{return _0x29ef56[_0xeab1('0xe0')](0xc8);}})[_0xeab1('0x2d')](handleError(_0x29ef56,null));}; \ No newline at end of file +var _0x1b29=['server','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','subject','get','mkdirSync','each','format','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','writeFileSync','message%d.eml','unlinkSync','sendStatus','eml-format','rimraf','zip-dir','bluebird','util','path','lodash','squel','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','status','end','json','offset','limit','undefined','count','set','Content-Range','destroy','then','error','stack','name','send','map','fullname','TagIds','Tags','MailMessage','findOne','out','plainBody','lastMsgText','trimStart','catch','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','select','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','left_join','users','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','text','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','start','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','tag','filter','replace','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','toString','keyBy','merge','MailInteraction','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.id','i.createdAt','i.updatedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.disposition','i.thirdDisposition','i.substatus','i.MailAccountId','i.UserId','c.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.MailInteractionId\x20IN\x20?','groupBy','Setting','enableEmailPreview','push','all','rows','show','keys','rawAttributes','include','options','create','body','update','params','describe','addMessage','ids','omit','getMessages','hasOwnProperty','pick','MailInteractionId','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','inlineCss','addTags','setTags','spread','emit','removeTags','download','unix','join','root','tmp'];(function(_0x41a60b,_0xc398d){var _0x10c95a=function(_0x2b8bd9){while(--_0x2b8bd9){_0x41a60b['push'](_0x41a60b['shift']());}};_0x10c95a(++_0xc398d);}(_0x1b29,0x1ea));var _0x91b2=function(_0x296427,_0x120868){_0x296427=_0x296427-0x0;var _0x12ef4d=_0x1b29[_0x296427];return _0x12ef4d;};'use strict';var emlformat=require(_0x91b2('0x0'));var rimraf=require(_0x91b2('0x1'));var zipdir=require(_0x91b2('0x2'));var moment=require('moment');var BPromise=require(_0x91b2('0x3'));var util=require(_0x91b2('0x4'));var path=require(_0x91b2('0x5'));var fs=require('fs');var _=require(_0x91b2('0x6'));var squel=require(_0x91b2('0x7'));var juice=require(_0x91b2('0x8'));var Redis=require(_0x91b2('0x9'));var qs=require(_0x91b2('0xa'));var as=require(_0x91b2('0xb'));var logger=require(_0x91b2('0xc'))(_0x91b2('0xd'));var config=require(_0x91b2('0xe'));var db=require(_0x91b2('0xf'))['db'];var htmlEntities=require('html-entities');config[_0x91b2('0x10')]=_[_0x91b2('0x11')](config[_0x91b2('0x10')],{'host':_0x91b2('0x12'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x91b2('0x10')]));require(_0x91b2('0x13'))[_0x91b2('0x14')](socket);function respondWithStatusCode(_0x55d4de,_0x1cd323){_0x1cd323=_0x1cd323||0xcc;return function(_0x5b9ad){if(_0x5b9ad){return _0x55d4de['sendStatus'](_0x1cd323);}return _0x55d4de[_0x91b2('0x15')](_0x1cd323)[_0x91b2('0x16')]();};}function respondWithResult(_0x1cae17,_0x38d365){_0x38d365=_0x38d365||0xc8;return function(_0x10d026){if(_0x10d026){return _0x1cae17[_0x91b2('0x15')](_0x38d365)[_0x91b2('0x17')](_0x10d026);}};}function respondWithFilteredResult(_0x341e9c,_0x896026){return function(_0x330532){if(_0x330532){var _0x51e717=typeof _0x896026[_0x91b2('0x18')]==='undefined'&&typeof _0x896026[_0x91b2('0x19')]===_0x91b2('0x1a');var _0x4a46ce=_0x330532[_0x91b2('0x1b')];var _0x579684=_0x51e717?0x0:_0x896026[_0x91b2('0x18')];var _0x591975=_0x51e717?_0x330532[_0x91b2('0x1b')]:_0x896026[_0x91b2('0x18')]+_0x896026[_0x91b2('0x19')];var _0x108def;if(_0x591975>=_0x4a46ce){_0x591975=_0x4a46ce;_0x108def=0xc8;}else{_0x108def=0xce;}_0x341e9c[_0x91b2('0x15')](_0x108def);return _0x341e9c[_0x91b2('0x1c')](_0x91b2('0x1d'),_0x579684+'-'+_0x591975+'/'+_0x4a46ce)['json'](_0x330532);}return null;};}function saveUpdates(_0x572869){return function(_0x5799bd){if(_0x5799bd){return _0x5799bd['update'](_0x572869)['then'](function(_0x206c9d){return _0x206c9d;});}return null;};}function removeEntity(_0x402d33){return function(_0x1579e7){if(_0x1579e7){return _0x1579e7[_0x91b2('0x1e')]()[_0x91b2('0x1f')](function(){_0x402d33['status'](0xcc)[_0x91b2('0x16')]();});}};}function handleEntityNotFound(_0x2cb82a){return function(_0x4d3d06){if(!_0x4d3d06){_0x2cb82a['sendStatus'](0x194);}return _0x4d3d06;};}function handleError(_0x217bb6,_0x2f6aa6){_0x2f6aa6=_0x2f6aa6||0x1f4;return function(_0x1f88ec){logger[_0x91b2('0x20')](_0x1f88ec[_0x91b2('0x21')]);if(_0x1f88ec[_0x91b2('0x22')]){delete _0x1f88ec[_0x91b2('0x22')];}_0x217bb6['status'](_0x2f6aa6)[_0x91b2('0x23')](_0x1f88ec);};}function getInteractionUsers(_0xbd3bbe,_0x2e08ea){return new BPromise(function(_0x1808d3,_0x482aa7){try{if(_0x2e08ea[_0xbd3bbe['id']]){_0xbd3bbe['Users']=_[_0x91b2('0x24')](_0x2e08ea[_0xbd3bbe['id']],function(_0x3fb095){return{'id':_0x3fb095['id'],'fullname':_0x3fb095[_0x91b2('0x25')]};});}}catch(_0x1e734b){_0x482aa7(_0x1e734b);}_0x1808d3(_0xbd3bbe);});}function getInteractionTags(_0x47d4e3,_0x2f3fd1){return new BPromise(function(_0x2ae972,_0x3f3414){try{if(_0x47d4e3[_0x91b2('0x26')]){_0x47d4e3[_0x91b2('0x27')]=[];_0x47d4e3[_0x91b2('0x26')]['split'](',')['forEach'](function(_0x285652){_0x47d4e3[_0x91b2('0x27')]['push'](_0x2f3fd1[_0x285652]);});}delete _0x47d4e3['TagIds'];}catch(_0x54ab58){_0x3f3414(_0x54ab58);}_0x2ae972(_0x47d4e3);});}function getLastMessageText(_0x3b332f){return new BPromise(function(_0x3c1913,_0x3eba2f){return db[_0x91b2('0x28')][_0x91b2('0x29')]({'where':{'$and':[{'MailInteractionId':_0x3b332f['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x91b2('0x2a')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x91b2('0x2b')],'order':'-id','raw':!![]})[_0x91b2('0x1f')](function(_0x40b86e){if(_0x40b86e&&_0x40b86e['plainBody']){_0x3b332f[_0x91b2('0x2c')]=_[_0x91b2('0x2d')](_0x40b86e[_0x91b2('0x2b')]);}_0x3c1913(_0x3b332f);})['catch'](function(_0x4d570a){_0x3eba2f(_0x4d570a);});});}function updateMailInteraction(_0xd42ec6,_0x53808f,_0x5e845e,_0x3f6efe){return new BPromise(function(_0x2c5805,_0x14d677){return getInteractionUsers(_0xd42ec6,_0x5e845e)[_0x91b2('0x1f')](function(_0x392e84){return getInteractionTags(_0x392e84,_0x53808f);})[_0x91b2('0x1f')](function(_0xf4eb0b){if(_0x3f6efe){_0x2c5805(getLastMessageText(_0xf4eb0b));}else{_0x2c5805(_0xf4eb0b);}})[_0x91b2('0x2e')](function(_0x41105b){_0x14d677(_0x41105b);});});}exports['index']=function(_0x1a5376,_0x189089){var _0x5e4982={},_0x2a1b9d={},_0x4c8c77={'count':0x0,'rows':[]};var _0x1f8255=_[_0x91b2('0x24')](db['MailInteraction']['rawAttributes'],function(_0x10f470){return{'name':_0x10f470['fieldName'],'type':_0x10f470[_0x91b2('0x2f')][_0x91b2('0x30')]};});_0x2a1b9d[_0x91b2('0x31')]=_[_0x91b2('0x24')](_0x1f8255,'name');_0x2a1b9d[_0x91b2('0x32')]=_['keys'](_0x1a5376[_0x91b2('0x32')]);_0x2a1b9d[_0x91b2('0x33')]=_[_0x91b2('0x34')](_0x2a1b9d[_0x91b2('0x31')],_0x2a1b9d[_0x91b2('0x32')]);_0x5e4982[_0x91b2('0x35')]=_['intersection'](_0x2a1b9d['model'],qs[_0x91b2('0x36')](_0x1a5376['query'][_0x91b2('0x36')]));_0x5e4982[_0x91b2('0x35')]=_0x5e4982['attributes'][_0x91b2('0x37')]?_0x5e4982[_0x91b2('0x35')]:_0x2a1b9d[_0x91b2('0x31')];if(!_0x1a5376['query']['hasOwnProperty'](_0x91b2('0x38'))){_0x5e4982[_0x91b2('0x19')]=qs[_0x91b2('0x19')](_0x1a5376[_0x91b2('0x32')]['limit']);_0x5e4982[_0x91b2('0x18')]=qs['offset'](_0x1a5376[_0x91b2('0x32')][_0x91b2('0x18')]);}_0x5e4982[_0x91b2('0x39')]=qs['sort'](_0x1a5376[_0x91b2('0x32')][_0x91b2('0x3a')]);_0x5e4982[_0x91b2('0x3b')]=qs[_0x91b2('0x33')](_['pick'](_0x1a5376[_0x91b2('0x32')],_0x2a1b9d[_0x91b2('0x33')]),_0x1f8255);var _0x56e56f=[];var _0x2e4158=squel[_0x91b2('0x3c')]()['field']('id')['field'](_0x91b2('0x22'))[_0x91b2('0x3d')](_0x91b2('0x3e'))[_0x91b2('0x3f')](_0x91b2('0x40'));var _0x36534a=squel[_0x91b2('0x3c')]()[_0x91b2('0x3d')](_0x91b2('0x41'))[_0x91b2('0x3d')](_0x91b2('0x42'))[_0x91b2('0x3d')](_0x91b2('0x43'))[_0x91b2('0x3f')]('user_has_mail_interactions','ui')[_0x91b2('0x44')](_0x91b2('0x45'),'u','u.id\x20=\x20ui.UserId');var _0x485bec=squel[_0x91b2('0x3c')]()[_0x91b2('0x3f')]('mail_interactions','i')['left_join']('cm_contacts','c',_0x91b2('0x46'))[_0x91b2('0x44')](_0x91b2('0x45'),'o',_0x91b2('0x47'))[_0x91b2('0x44')](_0x91b2('0x48'),'a',_0x91b2('0x49'))[_0x91b2('0x44')]('mail_messages','me',_0x91b2('0x4a'))['left_join'](_0x91b2('0x4b'),'it',_0x91b2('0x4c'))['left_join'](_0x91b2('0x40'),'t',_0x91b2('0x4d'));var _0x58a9cf=squel[_0x91b2('0x4e')]();var _0x3563a4=[];var _0x5c974c=squel['expr']();var _0x1a8bb8;if(_0x1a5376[_0x91b2('0x32')][_0x91b2('0x4f')]){_0x1a8bb8=as[_0x91b2('0x50')](_0x1a5376[_0x91b2('0x32')][_0x91b2('0x4f')]);var _0x116c64=_0x1a8bb8[_0x91b2('0x51')];for(var _0x29dca7=0x0;_0x29dca7<_0x1a8bb8[_0x91b2('0x52')]['length'];_0x29dca7++){var _0x18f54d=_0x1a8bb8['conditions'][_0x29dca7];var _0x2ad068='i';var _0x252fe6=_[_0x91b2('0x53')](_0x1f8255,['name',_0x18f54d[_0x91b2('0x3d')]]);if(!_0x252fe6){switch(_0x18f54d[_0x91b2('0x3d')]){case'unreadMessages':if(_0x18f54d[_0x91b2('0x54')]==0x1){_0x485bec[_0x91b2('0x55')]('`'+_0x18f54d[_0x91b2('0x3d')]+_0x91b2('0x56'));}else{_0x485bec['having']('`'+_0x18f54d[_0x91b2('0x3d')]+_0x91b2('0x57'));}break;case _0x91b2('0x58'):if(_0x18f54d[_0x91b2('0x59')]===_0x91b2('0x5a')){if(_0x18f54d[_0x91b2('0x54')][_0x91b2('0x5b')]('\x20')[_0x91b2('0x37')]>0x1){_0x58a9cf[_0x116c64](_0x91b2('0x5c'),qs['getFullTextValue'](_0x18f54d[_0x91b2('0x54')]),null);}else{var _0x3f1967='%'+_0x18f54d['value']+'%';_0x58a9cf[_0x116c64]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3f1967,_0x3f1967,_0x3f1967);}}else{_0x252fe6=_['find'](_0x1f8255,[_0x91b2('0x22'),_0x91b2('0x5d')]);_0x18f54d['field']='ContactId';_0x54c202=as['buildExpression'](_0x2ad068,_0x252fe6[_0x91b2('0x2f')],_0x18f54d);_0x58a9cf[_0x116c64](_0x54c202[_0x91b2('0x5e')],_0x54c202['value']['start'],_0x54c202['value']['end']);}break;case _0x91b2('0x5f'):var _0x3d6a9c=_0x18f54d[_0x91b2('0x54')]['split'](',')[_0x91b2('0x24')](function(_0x297ca2){return Number(_0x297ca2);});_0x3d6a9c[_0x91b2('0x60')](function(_0x4b699b){_0x5c974c['or'](_0x91b2('0x61'),'%,'+_0x4b699b+',%');});_0x3563a4=_['union'](_0x3563a4,_0x3d6a9c);break;case _0x91b2('0x62'):if(_0x18f54d['operator']===_0x91b2('0x5a')){_0x58a9cf[_0x116c64](_0x91b2('0x63'),'%'+_0x18f54d[_0x91b2('0x54')]+'%',null);}else{_0x252fe6=_[_0x91b2('0x53')](_0x1f8255,[_0x91b2('0x22'),'UserId']);_0x18f54d[_0x91b2('0x3d')]=_0x91b2('0x64');_0x54c202=as[_0x91b2('0x65')](_0x2ad068,_0x252fe6[_0x91b2('0x2f')],_0x18f54d);_0x58a9cf[_0x116c64](_0x54c202[_0x91b2('0x5e')],_0x54c202[_0x91b2('0x54')][_0x91b2('0x66')],_0x54c202[_0x91b2('0x54')][_0x91b2('0x16')]);}break;case _0x91b2('0x2b'):_0x54c202=as['buildExpression']('me',null,_0x18f54d);_0x58a9cf[_0x116c64](_0x54c202['text'],_0x54c202[_0x91b2('0x54')][_0x91b2('0x66')],_0x54c202[_0x91b2('0x54')][_0x91b2('0x16')]);break;}}else{var _0x54c202=as[_0x91b2('0x65')](_0x2ad068,_0x252fe6[_0x91b2('0x2f')],_0x18f54d);_0x58a9cf[_0x116c64](_0x54c202[_0x91b2('0x5e')],_0x54c202[_0x91b2('0x54')][_0x91b2('0x66')],_0x54c202[_0x91b2('0x54')][_0x91b2('0x16')]);}}}else{var _0x2bf461=_(_0x1a5376[_0x91b2('0x32')])['keys']()[_0x91b2('0x24')](function(_0x3e759e){return _[_0x91b2('0x67')](_0x1f8255,[_0x91b2('0x22'),_0x3e759e])?_0x3e759e:undefined;})[_0x91b2('0x68')]()[_0x91b2('0x54')]();if(!_[_0x91b2('0x69')](_0x2bf461)){_0x2bf461[_0x91b2('0x60')](function(_0x50f2b6){if(_0x50f2b6===_0x91b2('0x6a')){_0x485bec[_0x91b2('0x3b')](_0x91b2('0x6b'),[][_0x91b2('0x6c')](_0x1a5376[_0x91b2('0x32')][_0x50f2b6]));}else if(_0x50f2b6===_0x91b2('0x6d')){var _0x203dce=JSON[_0x91b2('0x6e')](_0x1a5376['query'][_0x50f2b6])[_0x91b2('0x6f')];var _0x3728ee=JSON['parse'](_0x1a5376[_0x91b2('0x32')][_0x50f2b6])[_0x91b2('0x70')];_0x485bec[_0x91b2('0x3b')](_0x91b2('0x71'),_0x203dce,_0x3728ee);}else{if(_0x1a5376[_0x91b2('0x32')][_0x50f2b6]===_0x91b2('0x72')){_0x485bec['where']('i.'+_0x50f2b6+_0x91b2('0x73'));}else{_0x485bec[_0x91b2('0x3b')]('i.'+_0x50f2b6+_0x91b2('0x74'),_0x1a5376[_0x91b2('0x32')][_0x50f2b6]);}}});}if(_0x1a5376[_0x91b2('0x32')][_0x91b2('0x75')]){if(_0x1a5376[_0x91b2('0x32')][_0x91b2('0x75')]==0x1){_0x485bec[_0x91b2('0x55')]('`unreadMessages`\x20=\x200');}else{_0x485bec[_0x91b2('0x55')]('`unreadMessages`\x20>\x200');}}if(_0x1a5376['query']['tag']){_0x3563a4=_['isArray'](_0x1a5376[_0x91b2('0x32')][_0x91b2('0x76')])?_0x1a5376['query'][_0x91b2('0x76')]:new Array(_0x1a5376[_0x91b2('0x32')][_0x91b2('0x76')]);_0x3563a4[_0x91b2('0x60')](function(_0x4f9ca8){_0x5c974c['or'](_0x91b2('0x61'),'%,'+_0x4f9ca8+',%');});}if(_0x1a5376[_0x91b2('0x32')][_0x91b2('0x77')]){var _0x5cf48c=_0x1a5376[_0x91b2('0x32')][_0x91b2('0x77')][_0x91b2('0x78')]('\x5c','\x5c\x5c')[_0x91b2('0x78')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x5cf48c)){_0x58a9cf['or'](_0x91b2('0x79'),_0x5cf48c+'%');}else if(qs[_0x91b2('0x7a')](_0x5cf48c)){_0x58a9cf['or'](_0x91b2('0x7b'),_0x5cf48c+'%');}else{_0x58a9cf['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x91b2('0x7c')](_0x5cf48c))['or'](_0x91b2('0x7d'),qs[_0x91b2('0x7c')](_0x5cf48c));}}}_0x485bec[_0x91b2('0x3b')](_0x58a9cf);_0x485bec[_0x91b2('0x7e')]('i.id');var _0x8c1233={'type':db['Sequelize'][_0x91b2('0x7f')][_0x91b2('0x80')],'raw':!![]};var _0x2b0588=_0x485bec[_0x91b2('0x81')]();_0x2b0588[_0x91b2('0x3d')]('i.id');_0x2b0588['field'](_0x91b2('0x82'),_0x91b2('0x83'));if(_0x5e4982['order']){_0x5e4982['order']['forEach'](function(_0x277c03){var _0x269246=_0x277c03[0x0]===_0x91b2('0x84')?_0x277c03[0x0]:'i.'+_0x277c03[0x0];_0x485bec[_0x91b2('0x39')](_0x269246,_0x277c03[0x1]===_0x91b2('0x85')?![]:!![]);});}if(!_[_0x91b2('0x69')](_0x3563a4)){_0x485bec[_0x91b2('0x55')](_0x5c974c);_0x2b0588[_0x91b2('0x3b')](_0x91b2('0x86'),_0x3563a4);}BPromise[_0x91b2('0x87')]()['then'](function(){if(!_0x1a8bb8){if(_0x1a5376['query'][_0x91b2('0x6a')])return;_0x2b0588['where'](_0x91b2('0x88'));_0x485bec[_0x91b2('0x3b')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x1a5376[_0x91b2('0x89')][_0x91b2('0x8a')]!=='agent')return;return _0x1a5376[_0x91b2('0x89')]['getMailAccounts']({'attributes':['id'],'raw':!![]})[_0x91b2('0x1f')](function(_0x5000c0){if(_[_0x91b2('0x69')](_0x5000c0)){_0x2b0588[_0x91b2('0x3b')]('i.MailAccountId\x20IS\x20NULL');_0x485bec[_0x91b2('0x3b')]('i.MailAccountId\x20IS\x20NULL');}else{_0x2b0588[_0x91b2('0x3b')]('i.MailAccountId\x20IN\x20?',_['map'](_0x5000c0,'id'));_0x485bec[_0x91b2('0x3b')](_0x91b2('0x6b'),_[_0x91b2('0x24')](_0x5000c0,'id'));}});})[_0x91b2('0x1f')](function(){if(_0x1a5376['user'][_0x91b2('0x8a')]===_0x91b2('0x8b')&&!_0x1a8bb8&&!_0x1a5376[_0x91b2('0x32')][_0x91b2('0x6a')])return[];return db['sequelize']['query'](_0x2b0588[_0x91b2('0x8c')](),_0x8c1233);})['then'](function(_0x52abe7){_0x4c8c77[_0x91b2('0x1b')]=_0x52abe7[_0x91b2('0x37')];if(_0x4c8c77[_0x91b2('0x1b')]===0x0)return[];return db['sequelize']['query'](_0x2e4158[_0x91b2('0x8c')](),_0x8c1233)[_0x91b2('0x1f')](function(_0x141ac9){_0x56e56f=_[_0x91b2('0x8d')](_0x141ac9,'id');_0x8c1233=_[_0x91b2('0x8e')](_0x8c1233,{'model':db[_0x91b2('0x8f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1a5376[_0x91b2('0x32')][_0x91b2('0x36')]){_0x5e4982[_0x91b2('0x35')][_0x91b2('0x60')](function(_0x565d13){_0x485bec[_0x91b2('0x3d')]('i.'+_0x565d13);});}else{_0x485bec[_0x91b2('0x3d')](_0x91b2('0x82'),_0x91b2('0x83'));_0x485bec[_0x91b2('0x3d')]('a.key',_0x91b2('0x90'));_0x485bec[_0x91b2('0x3d')]('a.mandatoryDisposition',_0x91b2('0x91'));_0x485bec[_0x91b2('0x3d')](_0x91b2('0x92'),_0x91b2('0x84'));_0x485bec[_0x91b2('0x3d')](_0x91b2('0x93'));_0x485bec[_0x91b2('0x3d')](_0x91b2('0x94'));_0x485bec[_0x91b2('0x3d')](_0x91b2('0x95'));_0x485bec[_0x91b2('0x3d')]('i.closed');_0x485bec[_0x91b2('0x3d')]('i.closedAt');_0x485bec['field'](_0x91b2('0x96'));_0x485bec[_0x91b2('0x3d')](_0x91b2('0x97'));_0x485bec[_0x91b2('0x3d')](_0x91b2('0x98'));_0x485bec[_0x91b2('0x3d')]('i.subject');_0x485bec[_0x91b2('0x3d')](_0x91b2('0x99'));_0x485bec[_0x91b2('0x3d')]('i.secondDisposition');_0x485bec[_0x91b2('0x3d')](_0x91b2('0x9a'));_0x485bec['field'](_0x91b2('0x9b'));_0x485bec[_0x91b2('0x3d')]('i.to');_0x485bec['field']('i.ContactId');_0x485bec[_0x91b2('0x3d')](_0x91b2('0x9c'));_0x485bec[_0x91b2('0x3d')](_0x91b2('0x9d'));_0x485bec['field'](_0x91b2('0x9e'),'Contact.firstName');_0x485bec[_0x91b2('0x3d')](_0x91b2('0x9f'),_0x91b2('0xa0'));_0x485bec[_0x91b2('0x3d')]('c.email',_0x91b2('0xa1'));_0x485bec[_0x91b2('0x3d')](_0x91b2('0xa2'),_0x91b2('0xa3'));_0x485bec[_0x91b2('0x3d')](_0x91b2('0xa4'),_0x91b2('0xa5'));_0x485bec[_0x91b2('0x3d')](_0x91b2('0xa6'),_0x91b2('0xa7'));_0x485bec[_0x91b2('0x3d')](_0x91b2('0xa8'),_0x91b2('0xa9'));_0x485bec[_0x91b2('0x3d')](_0x91b2('0xaa'),_0x91b2('0xab'));_0x485bec['field'](_0x91b2('0xac'),'TagIds');}if(_0x5e4982[_0x91b2('0x19')])_0x485bec[_0x91b2('0x19')](_0x5e4982[_0x91b2('0x19')]);if(_0x5e4982[_0x91b2('0x18')])_0x485bec[_0x91b2('0x18')](_0x5e4982[_0x91b2('0x18')]);return db[_0x91b2('0xad')][_0x91b2('0x32')](_0x485bec[_0x91b2('0x8c')](),_0x8c1233);})[_0x91b2('0x1f')](function(_0x820685){if(_0x820685[_0x91b2('0x37')]>0x0)_0x36534a[_0x91b2('0x3b')](_0x91b2('0xae'),_['map'](_0x820685,'id'));return db[_0x91b2('0xad')]['query'](_0x36534a[_0x91b2('0x8c')](),_0x8c1233)[_0x91b2('0x1f')](function(_0x158283){var _0xb99a23=_[_0x91b2('0xaf')](_0x158283,'MailInteractionId');var _0x15a0c8=[];return db[_0x91b2('0xb0')][_0x91b2('0x29')]({'attributes':[_0x91b2('0xb1')],'raw':!![]})['then'](function(_0x447f13){var _0x3668fd=_0x447f13[_0x91b2('0xb1')];_0x820685['forEach'](function(_0x52e13a){_0x15a0c8[_0x91b2('0xb2')](updateMailInteraction(_0x52e13a,_0x56e56f,_0xb99a23,_0x3668fd));});return BPromise[_0x91b2('0xb3')](_0x15a0c8);});});});})[_0x91b2('0x1f')](function(_0x4fe6c8){_0x4c8c77[_0x91b2('0xb4')]=_0x4fe6c8;return _0x4c8c77;})[_0x91b2('0x1f')](respondWithFilteredResult(_0x189089,_0x5e4982))['catch'](handleError(_0x189089,null));};exports[_0x91b2('0xb5')]=function(_0x641a40,_0x1e3d8c){var _0xf69c0f={'raw':![],'where':{'id':_0x641a40['params']['id']}},_0x229098={};_0x229098[_0x91b2('0x31')]=_[_0x91b2('0xb6')](db[_0x91b2('0x8f')][_0x91b2('0xb7')]);_0x229098[_0x91b2('0x32')]=_[_0x91b2('0xb6')](_0x641a40[_0x91b2('0x32')]);_0x229098[_0x91b2('0x33')]=_[_0x91b2('0x34')](_0x229098[_0x91b2('0x31')],_0x229098[_0x91b2('0x32')]);_0xf69c0f[_0x91b2('0x35')]=_[_0x91b2('0x34')](_0x229098[_0x91b2('0x31')],qs['fields'](_0x641a40[_0x91b2('0x32')]['fields']));_0xf69c0f[_0x91b2('0x35')]=_0xf69c0f[_0x91b2('0x35')][_0x91b2('0x37')]?_0xf69c0f[_0x91b2('0x35')]:_0x229098[_0x91b2('0x31')];if(_0x641a40[_0x91b2('0x32')]['includeAll']){_0xf69c0f[_0x91b2('0xb8')]=[{'all':!![]}];}_0xf69c0f=_[_0x91b2('0x8e')]({},_0xf69c0f,_0x641a40[_0x91b2('0xb9')]);return db['MailInteraction']['find'](_0xf69c0f)['then'](handleEntityNotFound(_0x1e3d8c,null))[_0x91b2('0x1f')](respondWithResult(_0x1e3d8c,null))[_0x91b2('0x2e')](handleError(_0x1e3d8c,null));};exports['create']=function(_0x1decc0,_0x25bfe3){return db[_0x91b2('0x8f')][_0x91b2('0xba')](_0x1decc0[_0x91b2('0xbb')],{})['then'](respondWithResult(_0x25bfe3,0xc9))[_0x91b2('0x2e')](handleError(_0x25bfe3,null));};exports[_0x91b2('0xbc')]=function(_0x26d17a,_0x73aa1c){if(_0x26d17a[_0x91b2('0xbb')]['id']){delete _0x26d17a[_0x91b2('0xbb')]['id'];}return db[_0x91b2('0x8f')][_0x91b2('0x53')]({'where':{'id':_0x26d17a['params']['id']}})[_0x91b2('0x1f')](handleEntityNotFound(_0x73aa1c,null))[_0x91b2('0x1f')](saveUpdates(_0x26d17a[_0x91b2('0xbb')],null))[_0x91b2('0x1f')](respondWithResult(_0x73aa1c,null))[_0x91b2('0x2e')](handleError(_0x73aa1c,null));};exports[_0x91b2('0x1e')]=function(_0x487b9b,_0x5e12ed){return db[_0x91b2('0x8f')][_0x91b2('0x53')]({'where':{'id':_0x487b9b[_0x91b2('0xbd')]['id']}})[_0x91b2('0x1f')](handleEntityNotFound(_0x5e12ed,null))[_0x91b2('0x1f')](removeEntity(_0x5e12ed,null))[_0x91b2('0x2e')](handleError(_0x5e12ed,null));};exports['describe']=function(_0x5cc52c,_0x4f6c75){return db[_0x91b2('0x8f')][_0x91b2('0xbe')]()[_0x91b2('0x1f')](respondWithResult(_0x4f6c75,null))[_0x91b2('0x2e')](handleError(_0x4f6c75,null));};exports[_0x91b2('0xbf')]=function(_0x159021,_0x313ed0){return db[_0x91b2('0x28')][_0x91b2('0x53')]({'where':{'id':_0x159021[_0x91b2('0xbd')]['id']}})[_0x91b2('0x1f')](handleEntityNotFound(_0x313ed0,null))[_0x91b2('0x1f')](function(_0x531020){if(_0x531020){return _0x531020[_0x91b2('0xbf')](_0x159021[_0x91b2('0xbb')][_0x91b2('0xc0')],_[_0x91b2('0xc1')](_0x159021[_0x91b2('0xbb')],[_0x91b2('0xc0'),'id'])||{});}})[_0x91b2('0x1f')](respondWithResult(_0x313ed0,null))['catch'](handleError(_0x313ed0,null));};exports[_0x91b2('0xc2')]=function(_0x4417af,_0xe26cb8){var _0x399c16={'raw':![],'where':{}};var _0x2059c1={};var _0x4c7716={'count':0x0,'rows':[]};return db['MailInteraction'][_0x91b2('0x29')]({'where':{'id':_0x4417af[_0x91b2('0xbd')]['id']}})[_0x91b2('0x1f')](handleEntityNotFound(_0xe26cb8,null))[_0x91b2('0x1f')](function(_0x2b6fc1){if(_0x2b6fc1){_0x2059c1['model']=_[_0x91b2('0xb6')](db['MailMessage'][_0x91b2('0xb7')]);_0x2059c1[_0x91b2('0x32')]=_[_0x91b2('0xb6')](_0x4417af['query']);_0x2059c1[_0x91b2('0x33')]=_[_0x91b2('0x34')](_0x2059c1[_0x91b2('0x31')],_0x2059c1['query']);_0x399c16[_0x91b2('0x35')]=_[_0x91b2('0x34')](_0x2059c1[_0x91b2('0x31')],qs[_0x91b2('0x36')](_0x4417af[_0x91b2('0x32')][_0x91b2('0x36')]));_0x399c16[_0x91b2('0x35')]=_0x399c16[_0x91b2('0x35')][_0x91b2('0x37')]?_0x399c16[_0x91b2('0x35')]:_0x2059c1[_0x91b2('0x31')];if(!_0x4417af[_0x91b2('0x32')][_0x91b2('0xc3')](_0x91b2('0x38'))){_0x399c16['limit']=qs[_0x91b2('0x19')](_0x4417af['query'][_0x91b2('0x19')]);_0x399c16[_0x91b2('0x18')]=qs[_0x91b2('0x18')](_0x4417af[_0x91b2('0x32')][_0x91b2('0x18')]);}_0x399c16[_0x91b2('0x39')]=qs['sort'](_0x4417af[_0x91b2('0x32')][_0x91b2('0x3a')]);_0x399c16['where']=qs[_0x91b2('0x33')](_[_0x91b2('0xc4')](_0x4417af[_0x91b2('0x32')],_0x2059c1[_0x91b2('0x33')]));_0x399c16[_0x91b2('0x3b')][_0x91b2('0xc5')]=_0x2b6fc1['id'];if(_0x4417af['query'][_0x91b2('0x77')]){_0x399c16[_0x91b2('0x3b')]=_[_0x91b2('0x8e')](_0x399c16['where'],{'$or':_[_0x91b2('0x24')](_0x399c16['attributes'],function(_0x234659){var _0x2d0ea7={};_0x2d0ea7[_0x234659]={'$like':'%'+_0x4417af['query'][_0x91b2('0x77')]+'%'};return _0x2d0ea7;})});}if(_0x4417af['query'][_0x91b2('0x6f')]){var _0x5189ec=_0x4417af['query'][_0x91b2('0x6f')][_0x91b2('0x5b')](',');var _0x1de9da={};_0x1de9da[_0x5189ec[0x0]]={'$gte':moment(_0x5189ec[0x1])['format'](_0x91b2('0xc6'))};_0x399c16['where']=_[_0x91b2('0x8e')](_0x399c16['where'],_0x1de9da);}_0x399c16=_[_0x91b2('0x8e')]({},_0x399c16,_0x4417af['options']);return db['MailMessage'][_0x91b2('0x1b')]({'where':_0x399c16[_0x91b2('0x3b')]})[_0x91b2('0x1f')](function(_0x4d89f0){_0x4c7716[_0x91b2('0x1b')]=_0x4d89f0;if(_0x4417af['query'][_0x91b2('0xc7')]){_0x399c16[_0x91b2('0xb8')]=[{'all':!![]}];}return db[_0x91b2('0x28')][_0x91b2('0xc8')](_0x399c16);})[_0x91b2('0x1f')](function(_0x48ecbe){if(_0x4417af['query'][_0x91b2('0xc9')]==='true'){for(var _0x20d74d=0x0;_0x20d74d<_0x48ecbe[_0x91b2('0x37')];_0x20d74d++){_0x48ecbe[_0x20d74d]['body']=juice(_0x48ecbe[_0x20d74d][_0x91b2('0xbb')]);}}_0x4c7716[_0x91b2('0xb4')]=_0x48ecbe;return _0x4c7716;});}})[_0x91b2('0x1f')](respondWithFilteredResult(_0xe26cb8,_0x399c16))[_0x91b2('0x2e')](handleError(_0xe26cb8,null));};exports[_0x91b2('0xca')]=function(_0x2f7b1b,_0x453fce){return db[_0x91b2('0x8f')][_0x91b2('0x53')]({'where':{'id':_0x2f7b1b[_0x91b2('0xbd')]['id']}})[_0x91b2('0x1f')](handleEntityNotFound(_0x453fce,null))['then'](function(_0xd37ca8){if(_0xd37ca8){return _0xd37ca8[_0x91b2('0xcb')](_0x2f7b1b[_0x91b2('0xbb')]['ids'],_[_0x91b2('0xc1')](_0x2f7b1b['body'],['ids','id'])||{})[_0x91b2('0xcc')](function(){return db['Tag'][_0x91b2('0xc8')]({'attributes':['id',_0x91b2('0x22'),_0x91b2('0x3e')],'where':{'id':_0x2f7b1b[_0x91b2('0xbb')]['ids']}});})[_0x91b2('0x1f')](function(_0x3f969f){socket[_0x91b2('0xcd')]('mailInteractionTags:save',{'id':Number(_0x2f7b1b[_0x91b2('0xbd')]['id']),'tags':_0x3f969f||[]});return{'id':Number(_0x2f7b1b[_0x91b2('0xbd')]['id']),'tags':_0x3f969f||[]};});}})[_0x91b2('0x1f')](respondWithResult(_0x453fce,null))[_0x91b2('0x2e')](handleError(_0x453fce,null));};exports[_0x91b2('0xce')]=function(_0x5ee097,_0x36a8a7){return db[_0x91b2('0x8f')][_0x91b2('0x53')]({'where':{'id':_0x5ee097['params']['id']}})[_0x91b2('0x1f')](handleEntityNotFound(_0x36a8a7,null))[_0x91b2('0x1f')](function(_0x555855){if(_0x555855){return _0x555855['removeTags'](_0x5ee097[_0x91b2('0x32')][_0x91b2('0xc0')]);}})[_0x91b2('0x1f')](respondWithStatusCode(_0x36a8a7,null))[_0x91b2('0x2e')](handleError(_0x36a8a7,null));};exports[_0x91b2('0xcf')]=function(_0x245efb,_0x505bf4){var _0x4df354=moment()[_0x91b2('0xd0')]()[_0x91b2('0x8c')]();var _0x590b5e=path[_0x91b2('0xd1')](config[_0x91b2('0xd2')],'server','files',_0x91b2('0xd3'));var _0x4edb20=path['join'](config[_0x91b2('0xd2')],_0x91b2('0xd4'),'files',_0x91b2('0xd5'));var _0x834d1a=path[_0x91b2('0xd1')](_0x590b5e,_0x4df354);var _0x2f056c=util['format'](_0x91b2('0xd6'),_0x245efb[_0x91b2('0xbd')]['id'],_0x4df354);var _0xe22741=path[_0x91b2('0xd1')](_0x590b5e,_0x2f056c);var _0x13668f=[];if(_0x245efb['query'][_0x91b2('0xd5')]){_0x13668f[_0x91b2('0xb2')]({'model':db[_0x91b2('0xd7')],'as':_0x91b2('0xd8'),'raw':!![]});}var _0x252d70=[{'model':db['MailMessage'],'as':_0x91b2('0xd9'),'attributes':['id',_0x91b2('0xbb'),'from','to','cc',_0x91b2('0xda'),_0x91b2('0xdb'),_0x91b2('0x6d')],'where':{'secret':![]},'order':qs[_0x91b2('0x3a')]('id'),'include':_0x13668f}];return db[_0x91b2('0x8f')]['find']({'where':{'id':_0x245efb['params']['id']},'include':_0x252d70})[_0x91b2('0x1f')](handleEntityNotFound(_0x505bf4,null))[_0x91b2('0x1f')](function(_0x300214){if(_0x300214&&_0x300214[_0x91b2('0xd9')]){var _0xf80c94=_0x300214[_0x91b2('0xdc')]({'plain':!![]});fs[_0x91b2('0xdd')](_0x834d1a);return BPromise[_0x91b2('0xde')](_0xf80c94[_0x91b2('0xd9')],function(_0x529771,_0x500b49){var _0x424e3a={'from':_0x529771[_0x91b2('0x3f')],'to':_0x529771['to'],'subject':_0x529771[_0x91b2('0xdb')],'html':htmlEntities['decode'](_0x529771['body']),'headers':{'Date':moment(_0x529771['createdAt'])[_0x91b2('0xdf')](_0x91b2('0xe0'))},'attachments':[]};if(_0x529771['cc']){_0x424e3a['headers']['Cc']=_0x529771['cc'];}if(_0x529771[_0x91b2('0xda')]){_0x424e3a[_0x91b2('0xe1')][_0x91b2('0xe2')]=_0x529771[_0x91b2('0xda')];}return new BPromise(function(_0x4d2058,_0x43fb8e){if(_0x529771['Attachments']){for(var _0x50d1d3=0x0;_0x50d1d3<_0x529771[_0x91b2('0xd8')]['length'];_0x50d1d3++){var _0x4a03b5=_0x529771[_0x91b2('0xd8')][_0x50d1d3];var _0x4844f5=path[_0x91b2('0xd1')](_0x4edb20,_0x4a03b5[_0x91b2('0xe3')]);if(fs[_0x91b2('0xe4')](_0x4844f5)){_0x424e3a[_0x91b2('0xd5')][_0x91b2('0xb2')]({'name':_0x4a03b5['name'],'contentType':_0x4a03b5[_0x91b2('0x2f')],'data':fs[_0x91b2('0xe5')](_0x4844f5)});}}}emlformat['build'](_0x424e3a,function(_0x577502,_0xd7972b){if(_0x577502)return _0x43fb8e(_0x577502);fs[_0x91b2('0xe6')](path[_0x91b2('0xd1')](_0x834d1a,util[_0x91b2('0xdf')](_0x91b2('0xe7'),_0x500b49)),_0xd7972b);return _0x4d2058(_0xd7972b);});});})[_0x91b2('0x1f')](function(){return new BPromise(function(_0x43bb1f,_0x235d40){zipdir(_0x834d1a,{'saveTo':_0xe22741},function(_0x1d1ad8,_0x177cf6){if(_0x1d1ad8)return _0x235d40(_0x1d1ad8);return _0x43bb1f(_0x177cf6);});})[_0x91b2('0x1f')](function(){return new BPromise(function(_0x19e06a,_0x51802c){rimraf(_0x834d1a,function(_0x1e6475){if(_0x1e6475)_0x51802c(_0x1e6475);return _0x19e06a();});});})[_0x91b2('0x1f')](function(){return _0x505bf4[_0x91b2('0xcf')](_0xe22741,_0x2f056c,function(_0x41157e){if(!_0x41157e)fs[_0x91b2('0xe8')](_0xe22741);});});});}else{return _0x505bf4[_0x91b2('0xe9')](0xc8);}})[_0x91b2('0x2e')](handleError(_0x505bf4,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index d519f6f..bf6d481 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 _0x8a8a=['hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','then','setDataValue','Users','map','unreadMessages','emit','catch'];(function(_0x140707,_0xf06afc){var _0x855cb=function(_0x110916){while(--_0x110916){_0x140707['push'](_0x140707['shift']());}};_0x855cb(++_0xf06afc);}(_0x8a8a,0x1d2));var _0xa8a8=function(_0x1d0018,_0x3c503a){_0x1d0018=_0x1d0018-0x0;var _0x1c0b54=_0x8a8a[_0x1d0018];return _0x1c0b54;};'use strict';var EventEmitter=require(_0xa8a8('0x0'));var MailInteraction=require(_0xa8a8('0x1'))['db'][_0xa8a8('0x2')];var MailMessage=require('../../mysqldb')['db'][_0xa8a8('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xa8a8('0x4')](0x0);var events={'afterCreate':_0xa8a8('0x5'),'afterUpdate':_0xa8a8('0x6'),'afterDestroy':'remove'};function emitEvent(_0x406209){return function(_0x50591d,_0x2baba0,_0x3507d8){_0x50591d['getUsers']({'attributes':['id'],'raw':!![]})[_0xa8a8('0x7')](function(_0x513098){_0x50591d[_0xa8a8('0x8')](_0xa8a8('0x9'),_0x513098[_0xa8a8('0xa')](function(_0x8e7559){return{'id':_0x8e7559['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x50591d['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa8a8('0x7')](function(_0x418219){_0x50591d[_0xa8a8('0x8')](_0xa8a8('0xb'),_0x418219['length']);MailInteractionEvents[_0xa8a8('0xc')](_0x406209+':'+_0x50591d['id'],_0x50591d);MailInteractionEvents[_0xa8a8('0xc')](_0x406209,_0x50591d);_0x3507d8(null);})[_0xa8a8('0xd')](_0x3507d8(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xa8a8('0xe')](e,emitEvent(event));}}module[_0xa8a8('0xf')]=MailInteractionEvents; \ No newline at end of file +var _0x4487=['Users','map','findAll','then','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','setDataValue'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x4487,0x191));var _0x7448=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x4487[_0x599f41];return _0x2e4d58;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x7448('0x0'))['db'][_0x7448('0x1')];var MailMessage=require(_0x7448('0x0'))['db'][_0x7448('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x7448('0x3')](0x0);var events={'afterCreate':_0x7448('0x4'),'afterUpdate':_0x7448('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4d10de){return function(_0x3c557e,_0x2c68bd,_0x22b2cb){_0x3c557e['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x1ac59c){_0x3c557e[_0x7448('0x6')](_0x7448('0x7'),_0x1ac59c[_0x7448('0x8')](function(_0x40b4f1){return{'id':_0x40b4f1['id']};}));return MailMessage[_0x7448('0x9')]({'where':{'MailInteractionId':_0x3c557e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7448('0xa')](function(_0x24a936){_0x3c557e[_0x7448('0x6')]('unreadMessages',_0x24a936[_0x7448('0xb')]);MailInteractionEvents[_0x7448('0xc')](_0x4d10de+':'+_0x3c557e['id'],_0x3c557e);MailInteractionEvents[_0x7448('0xc')](_0x4d10de,_0x3c557e);_0x22b2cb(null);})[_0x7448('0xd')](_0x22b2cb(null));};}for(var e in events){if(events[_0x7448('0xe')](e)){var event=events[e];MailInteraction[_0x7448('0xf')](e,emitEvent(event));}}module[_0x7448('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index d25ae55..9e29bbd 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 _0x7473=['utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','exports','MailInteraction','fti_mail_interactions','FULLTEXT','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','format','models','get','MailMessage'];(function(_0x308213,_0x224541){var _0x2e1619=function(_0x972b51){while(--_0x972b51){_0x308213['push'](_0x308213['shift']());}};_0x2e1619(++_0x224541);}(_0x7473,0x94));var _0x3747=function(_0x15a019,_0x1c302f){_0x15a019=_0x15a019-0x0;var _0x2aa0a5=_0x7473[_0x15a019];return _0x2aa0a5;};'use strict';var _=require(_0x3747('0x0'));var util=require(_0x3747('0x1'));var logger=require(_0x3747('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3747('0x3'));var rp=require(_0x3747('0x4'));var fs=require('fs');var path=require(_0x3747('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailInteraction.attributes');module[_0x3747('0x6')]=function(_0x25b50f,_0xa2b609){return _0x25b50f['define'](_0x3747('0x7'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x3747('0x8'),'fields':['subject','to'],'type':_0x3747('0x9')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3d844d,_0x21ce93,_0x1e0c38){if(_0x3d844d[_0x3747('0xa')]){_0x3d844d[_0x3747('0xb')]=moment()['format'](_0x3747('0xc'));}if(_0x3d844d[_0x3747('0xd')]){_0x3d844d[_0x3747('0xe')]=moment()['format'](_0x3747('0xc'));}_0x1e0c38(null,_0x21ce93);},'beforeUpdate':function(_0x3034df,_0x3b93ea,_0x24e543){if(_0x3034df[_0x3747('0xf')](_0x3747('0xa'))){_0x3034df[_0x3747('0xb')]=_0x3034df['substatus']?moment()[_0x3747('0x10')](_0x3747('0xc')):null;}if(_0x3034df[_0x3747('0xf')]('closed')){_0x3034df['closedAt']=moment()[_0x3747('0x10')](_0x3747('0xc'));_0x3034df[_0x3747('0xa')]=null;_0x3034df['substatusAt']=null;}_0x24e543(null,_0x3034df);},'afterUpdate':function(_0x364b28,_0x52d827,_0x30987a){var _0x4ed858=_0x25b50f[_0x3747('0x11')];var _0x48b683=_0x364b28[_0x3747('0x12')]({'plain':!![]});if(_0x48b683[_0x3747('0xd')]){return _0x4ed858[_0x3747('0x13')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x48b683['id']}})['then'](function(){_0x30987a();})['catch'](function(_0x2b7e6d){_0x30987a(_0x2b7e6d);});}else{_0x30987a();}}},'charset':'utf8mb4','collate':_0x3747('0x14')});}; \ No newline at end of file +var _0x1889=['MailMessage','update','then','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','substatusAt','YYYY-MM-DD\x20HH:mm:ss','format','substatus','changed','closedAt','models'];(function(_0x145b93,_0x4cf77a){var _0x596ac2=function(_0x2c418d){while(--_0x2c418d){_0x145b93['push'](_0x145b93['shift']());}};_0x596ac2(++_0x4cf77a);}(_0x1889,0x17f));var _0x9188=function(_0x2aa5ea,_0x43c4bf){_0x2aa5ea=_0x2aa5ea-0x0;var _0x296d88=_0x1889[_0x2aa5ea];return _0x296d88;};'use strict';var _=require(_0x9188('0x0'));var util=require(_0x9188('0x1'));var logger=require(_0x9188('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9188('0x3'));var rp=require(_0x9188('0x4'));var fs=require('fs');var path=require(_0x9188('0x5'));var rimraf=require(_0x9188('0x6'));var config=require(_0x9188('0x7'));var attributes=require(_0x9188('0x8'));module[_0x9188('0x9')]=function(_0x2d5a79,_0x21ee2b){return _0x2d5a79[_0x9188('0xa')](_0x9188('0xb'),attributes,{'tableName':_0x9188('0xc'),'paranoid':![],'indexes':[{'name':_0x9188('0xd'),'fields':[_0x9188('0xe'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2c935b,_0xa75441,_0x5c8803){if(_0x2c935b['substatus']){_0x2c935b[_0x9188('0xf')]=moment()['format'](_0x9188('0x10'));}if(_0x2c935b['closed']){_0x2c935b['closedAt']=moment()[_0x9188('0x11')](_0x9188('0x10'));}_0x5c8803(null,_0xa75441);},'beforeUpdate':function(_0x3209f0,_0x3f61c6,_0x3aa94c){if(_0x3209f0['changed'](_0x9188('0x12'))){_0x3209f0[_0x9188('0xf')]=_0x3209f0[_0x9188('0x12')]?moment()[_0x9188('0x11')](_0x9188('0x10')):null;}if(_0x3209f0[_0x9188('0x13')]('closed')){_0x3209f0[_0x9188('0x14')]=moment()[_0x9188('0x11')](_0x9188('0x10'));_0x3209f0[_0x9188('0x12')]=null;_0x3209f0[_0x9188('0xf')]=null;}_0x3aa94c(null,_0x3209f0);},'afterUpdate':function(_0x6d3d85,_0x224fed,_0x27b0e6){var _0x77dd20=_0x2d5a79[_0x9188('0x15')];var _0x206acc=_0x6d3d85['get']({'plain':!![]});if(_0x206acc['closed']){return _0x77dd20[_0x9188('0x16')][_0x9188('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x206acc['id']}})[_0x9188('0x18')](function(){_0x27b0e6();})['catch'](function(_0x118837){_0x27b0e6(_0x118837);});}else{_0x27b0e6();}}},'charset':_0x9188('0x19'),'collate':_0x9188('0x1a')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 284d236..a7f7453 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 _0xcec8=['limit','stringify','catch','find','where','addTags','omit','spread','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','socket.io-emitter','./mailInteraction.socket','request','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','UpdateMailInteraction','MailInteraction','update','body','options','raw'];(function(_0x5289f9,_0x1f3f49){var _0x23e4da=function(_0x4ff904){while(--_0x4ff904){_0x5289f9['push'](_0x5289f9['shift']());}};_0x23e4da(++_0x1f3f49);}(_0xcec8,0x10c));var _0x8cec=function(_0x46a38b,_0x16ffb5){_0x46a38b=_0x46a38b-0x0;var _0x346e75=_0xcec8[_0x46a38b];return _0x346e75;};'use strict';var _=require('lodash');var util=require(_0x8cec('0x0'));var moment=require(_0x8cec('0x1'));var BPromise=require(_0x8cec('0x2'));var rs=require(_0x8cec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8cec('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8cec('0x5'))(_0x8cec('0x6'));var config=require(_0x8cec('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8cec('0x8')][_0x8cec('0x9')]({'port':0x232a});config['redis']=_[_0x8cec('0xa')](config[_0x8cec('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8cec('0xc'))(new Redis(config[_0x8cec('0xb')]));require(_0x8cec('0xd'))['register'](socket);function respondWithRpcPromise(_0xe41014,_0xb7f80d,_0x2ddefb){return new BPromise(function(_0x1886cf,_0x4eae98){return client[_0x8cec('0xe')](_0xe41014,_0x2ddefb)['then'](function(_0x5bfa4a){logger[_0x8cec('0xf')](_0x8cec('0x10'),_0xb7f80d,_0x8cec('0x11'));logger[_0x8cec('0x12')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0xb7f80d,_0x8cec('0x11'),JSON['stringify'](_0x5bfa4a));if(_0x5bfa4a['error']){if(_0x5bfa4a[_0x8cec('0x13')][_0x8cec('0x14')]===0x1f4){logger[_0x8cec('0x13')](_0x8cec('0x10'),_0xb7f80d,_0x5bfa4a[_0x8cec('0x13')]['message']);return _0x4eae98(_0x5bfa4a[_0x8cec('0x13')][_0x8cec('0x15')]);}logger[_0x8cec('0x13')](_0x8cec('0x10'),_0xb7f80d,_0x5bfa4a[_0x8cec('0x13')]['message']);return _0x1886cf(_0x5bfa4a['error'][_0x8cec('0x15')]);}else{logger[_0x8cec('0xf')]('MailInteraction,\x20%s,\x20%s',_0xb7f80d,_0x8cec('0x11'));_0x1886cf(_0x5bfa4a['result'][_0x8cec('0x15')]);}})['catch'](function(_0xf95d28){logger['error']('MailInteraction,\x20%s,\x20%s',_0xb7f80d,_0xf95d28);_0x4eae98(_0xf95d28);});});}exports[_0x8cec('0x16')]=function(_0x58a730){var _0x1abffd=this;return new Promise(function(_0x30d337,_0x246406){return db[_0x8cec('0x17')][_0x8cec('0x18')](_0x58a730[_0x8cec('0x19')],{'raw':_0x58a730[_0x8cec('0x1a')]?_0x58a730[_0x8cec('0x1a')][_0x8cec('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58a730[_0x8cec('0x1a')]?_0x58a730[_0x8cec('0x1a')]['where']||null:null,'attributes':_0x58a730[_0x8cec('0x1a')]?_0x58a730[_0x8cec('0x1a')]['attributes']||null:null,'limit':_0x58a730['options']?_0x58a730[_0x8cec('0x1a')][_0x8cec('0x1c')]||null:null})['then'](function(_0x2f9804){logger[_0x8cec('0xf')](_0x8cec('0x16'),_0x58a730);logger['debug'](_0x8cec('0x16'),_0x58a730,JSON[_0x8cec('0x1d')](_0x2f9804));_0x30d337(_0x2f9804);})[_0x8cec('0x1e')](function(_0x211697){logger[_0x8cec('0x13')]('UpdateMailInteraction',_0x211697[_0x8cec('0x15')],_0x58a730);_0x246406(_0x1abffd[_0x8cec('0x13')](0x1f4,_0x211697[_0x8cec('0x15')]));});});};exports['AddTagsToMailInteraction']=function(_0x3fe071){return new Promise(function(_0x404527,_0x314ec7){return db[_0x8cec('0x17')][_0x8cec('0x1f')]({'where':_0x3fe071['options']?_0x3fe071[_0x8cec('0x1a')][_0x8cec('0x20')]||null:null})['then'](function(_0x3c706b){if(_0x3c706b){return _0x3c706b[_0x8cec('0x21')](_0x3fe071[_0x8cec('0x19')]['ids'],_[_0x8cec('0x22')](_0x3fe071[_0x8cec('0x19')],['ids','id'])||{});}})[_0x8cec('0x23')](function(_0x4fbc02){logger['info'](_0x8cec('0x24'),_0x3fe071);logger['debug'](_0x8cec('0x24'),_0x3fe071,JSON['stringify'](_0x4fbc02));_0x404527(_0x4fbc02);})[_0x8cec('0x1e')](function(_0x3b20aa){logger['error'](_0x8cec('0x24'),_0x3b20aa['message'],_0x3fe071);_0x314ec7(_this[_0x8cec('0x13')](0x1f4,_0x3b20aa[_0x8cec('0x15')]));});});}; \ No newline at end of file +var _0xa54c=['spread','AddTags','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','update','body','options','where','attributes','limit','UpdateMailInteraction','catch','AddTagsToMailInteraction','MailInteraction','find','addTags','ids'];(function(_0x4ac424,_0x554b5d){var _0xe1b890=function(_0x5e85c4){while(--_0x5e85c4){_0x4ac424['push'](_0x4ac424['shift']());}};_0xe1b890(++_0x554b5d);}(_0xa54c,0xcf));var _0xca54=function(_0x4953da,_0x5adaca){_0x4953da=_0x4953da-0x0;var _0x2d3780=_0xa54c[_0x4953da];return _0x2d3780;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xca54('0x0'));var BPromise=require(_0xca54('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xca54('0x2'));var db=require(_0xca54('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xca54('0x4'))(_0xca54('0x5'));var config=require(_0xca54('0x6'));var jayson=require(_0xca54('0x7'));var client=jayson[_0xca54('0x8')][_0xca54('0x9')]({'port':0x232a});config['redis']=_[_0xca54('0xa')](config[_0xca54('0xb')],{'host':_0xca54('0xc'),'port':0x18eb});var socket=require(_0xca54('0xd'))(new Redis(config[_0xca54('0xb')]));require('./mailInteraction.socket')[_0xca54('0xe')](socket);function respondWithRpcPromise(_0x5a781b,_0x78a356,_0x6a14b0){return new BPromise(function(_0x4b4a16,_0x775fb3){return client[_0xca54('0xf')](_0x5a781b,_0x6a14b0)[_0xca54('0x10')](function(_0x1a2591){logger['info'](_0xca54('0x11'),_0x78a356,_0xca54('0x12'));logger[_0xca54('0x13')](_0xca54('0x14'),_0x78a356,_0xca54('0x12'),JSON[_0xca54('0x15')](_0x1a2591));if(_0x1a2591[_0xca54('0x16')]){if(_0x1a2591[_0xca54('0x16')]['code']===0x1f4){logger['error'](_0xca54('0x11'),_0x78a356,_0x1a2591[_0xca54('0x16')][_0xca54('0x17')]);return _0x775fb3(_0x1a2591[_0xca54('0x16')][_0xca54('0x17')]);}logger[_0xca54('0x16')]('MailInteraction,\x20%s,\x20%s',_0x78a356,_0x1a2591[_0xca54('0x16')][_0xca54('0x17')]);return _0x4b4a16(_0x1a2591[_0xca54('0x16')][_0xca54('0x17')]);}else{logger[_0xca54('0x18')](_0xca54('0x11'),_0x78a356,_0xca54('0x12'));_0x4b4a16(_0x1a2591[_0xca54('0x19')][_0xca54('0x17')]);}})['catch'](function(_0x5726ec){logger['error'](_0xca54('0x11'),_0x78a356,_0x5726ec);_0x775fb3(_0x5726ec);});});}exports['UpdateMailInteraction']=function(_0x662d60){var _0x2d5078=this;return new Promise(function(_0x11ef8b,_0x544019){return db['MailInteraction'][_0xca54('0x1a')](_0x662d60[_0xca54('0x1b')],{'raw':_0x662d60['options']?_0x662d60[_0xca54('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x662d60['options']?_0x662d60[_0xca54('0x1c')][_0xca54('0x1d')]||null:null,'attributes':_0x662d60[_0xca54('0x1c')]?_0x662d60[_0xca54('0x1c')][_0xca54('0x1e')]||null:null,'limit':_0x662d60[_0xca54('0x1c')]?_0x662d60[_0xca54('0x1c')][_0xca54('0x1f')]||null:null})['then'](function(_0x10cd7e){logger['info'](_0xca54('0x20'),_0x662d60);logger['debug'](_0xca54('0x20'),_0x662d60,JSON[_0xca54('0x15')](_0x10cd7e));_0x11ef8b(_0x10cd7e);})[_0xca54('0x21')](function(_0x46e0d0){logger[_0xca54('0x16')](_0xca54('0x20'),_0x46e0d0[_0xca54('0x17')],_0x662d60);_0x544019(_0x2d5078['error'](0x1f4,_0x46e0d0['message']));});});};exports[_0xca54('0x22')]=function(_0x267681){return new Promise(function(_0x41377b,_0x5ccf80){return db[_0xca54('0x23')][_0xca54('0x24')]({'where':_0x267681['options']?_0x267681[_0xca54('0x1c')][_0xca54('0x1d')]||null:null})[_0xca54('0x10')](function(_0x2967d6){if(_0x2967d6){return _0x2967d6[_0xca54('0x25')](_0x267681[_0xca54('0x1b')][_0xca54('0x26')],_['omit'](_0x267681['body'],[_0xca54('0x26'),'id'])||{});}})[_0xca54('0x27')](function(_0x96ab4e){logger['info'](_0xca54('0x28'),_0x267681);logger[_0xca54('0x13')](_0xca54('0x28'),_0x267681,JSON[_0xca54('0x15')](_0x96ab4e));_0x41377b(_0x96ab4e);})[_0xca54('0x21')](function(_0x21aaae){logger['error'](_0xca54('0x28'),_0x21aaae[_0xca54('0x17')],_0x267681);_0x5ccf80(_this[_0xca54('0x16')](0x1f4,_0x21aaae[_0xca54('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index a4a41b0..d62dd68 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 _0x312a=['removeListener','register','length','mailInteraction:','./mailInteraction.events','save','remove','emit'];(function(_0x35ea3f,_0xd437e){var _0x3e262f=function(_0x155e78){while(--_0x155e78){_0x35ea3f['push'](_0x35ea3f['shift']());}};_0x3e262f(++_0xd437e);}(_0x312a,0x104));var _0xa312=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x312a[_0x14add3];return _0x4a174f;};'use strict';var MailInteractionEvents=require(_0xa312('0x0'));var events=[_0xa312('0x1'),_0xa312('0x2'),'update'];function createListener(_0x29e09c,_0x2115b0){return function(_0x388059){_0x2115b0[_0xa312('0x3')](_0x29e09c,_0x388059);};}function removeListener(_0x327514,_0x36161c){return function(){MailInteractionEvents[_0xa312('0x4')](_0x327514,_0x36161c);};}exports[_0xa312('0x5')]=function(_0x5b79f1){for(var _0x2a3a7c=0x0,_0x5635e6=events[_0xa312('0x6')];_0x2a3a7c<_0x5635e6;_0x2a3a7c++){var _0x3d24f8=events[_0x2a3a7c];var _0x221423=createListener(_0xa312('0x7')+_0x3d24f8,_0x5b79f1);MailInteractionEvents['on'](_0x3d24f8,_0x221423);}}; \ No newline at end of file +var _0x932e=['removeListener','length','mailInteraction:','save','update','emit'];(function(_0x41f727,_0x187f5c){var _0x36c8f9=function(_0x5e835b){while(--_0x5e835b){_0x41f727['push'](_0x41f727['shift']());}};_0x36c8f9(++_0x187f5c);}(_0x932e,0x1ad));var _0xe932=function(_0x26ccf9,_0x7274d6){_0x26ccf9=_0x26ccf9-0x0;var _0x294752=_0x932e[_0x26ccf9];return _0x294752;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0xe932('0x0'),'remove',_0xe932('0x1')];function createListener(_0x55e51a,_0x5c0ae5){return function(_0x3d939a){_0x5c0ae5[_0xe932('0x2')](_0x55e51a,_0x3d939a);};}function removeListener(_0x167387,_0x533da3){return function(){MailInteractionEvents[_0xe932('0x3')](_0x167387,_0x533da3);};}exports['register']=function(_0x4fb6c5){for(var _0x51d449=0x0,_0x3e22d8=events[_0xe932('0x4')];_0x51d449<_0x3e22d8;_0x51d449++){var _0x10d5cc=events[_0x51d449];var _0x3393f1=createListener(_0xe932('0x5')+_0x10d5cc,_0x4fb6c5);MailInteractionEvents['on'](_0x10d5cc,_0x3393f1);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 95d2e4d..06e8238 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 _0xe205=['../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','index','/:id','/:id/download','download','tracked','mail','mailmessage:create','create','put','update','reject','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x131604,_0x475a68){var _0x4a2aea=function(_0xa43f77){while(--_0xa43f77){_0x131604['push'](_0x131604['shift']());}};_0x4a2aea(++_0x475a68);}(_0xe205,0xa7));var _0x5e20=function(_0x376de6,_0x3d4ea7){_0x376de6=_0x376de6-0x0;var _0x6b4fd6=_0xe205[_0x376de6];return _0x6b4fd6;};'use strict';var multer=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var path=require(_0x5e20('0x2'));var timeout=require(_0x5e20('0x3'));var express=require(_0x5e20('0x4'));var router=express[_0x5e20('0x5')]();var fs_extra=require(_0x5e20('0x6'));var auth=require(_0x5e20('0x7'));var interaction=require(_0x5e20('0x8'));var config=require('../../config/environment');var controller=require(_0x5e20('0x9'));router[_0x5e20('0xa')]('/',auth[_0x5e20('0xb')](),controller[_0x5e20('0xc')]);router['get']('/describe',auth[_0x5e20('0xb')](),controller['describe']);router['get'](_0x5e20('0xd'),auth[_0x5e20('0xb')](),controller['show']);router[_0x5e20('0xa')](_0x5e20('0xe'),auth[_0x5e20('0xb')](),controller[_0x5e20('0xf')]);router['post']('/',auth[_0x5e20('0xb')](),interaction[_0x5e20('0x10')](_0x5e20('0x11'),_0x5e20('0x12')),controller[_0x5e20('0x13')]);router[_0x5e20('0x14')]('/:id',auth[_0x5e20('0xb')](),controller[_0x5e20('0x15')]);router[_0x5e20('0x14')]('/:id/accept',auth[_0x5e20('0xb')](),controller['accept']);router[_0x5e20('0x14')]('/:id/reject',auth[_0x5e20('0xb')](),controller[_0x5e20('0x16')]);router[_0x5e20('0x17')](_0x5e20('0xd'),auth[_0x5e20('0xb')](),controller['destroy']);module[_0x5e20('0x18')]=router; \ No newline at end of file +var _0x9a86=['tracked','mail','mailmessage:create','/:id','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','show','/:id/download'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0x9a86,0x1ed));var _0x69a8=function(_0x35e92e,_0x21581b){_0x35e92e=_0x35e92e-0x0;var _0x1205a8=_0x9a86[_0x35e92e];return _0x1205a8;};'use strict';var multer=require(_0x69a8('0x0'));var util=require(_0x69a8('0x1'));var path=require('path');var timeout=require(_0x69a8('0x2'));var express=require(_0x69a8('0x3'));var router=express[_0x69a8('0x4')]();var fs_extra=require(_0x69a8('0x5'));var auth=require(_0x69a8('0x6'));var interaction=require(_0x69a8('0x7'));var config=require(_0x69a8('0x8'));var controller=require(_0x69a8('0x9'));router[_0x69a8('0xa')]('/',auth[_0x69a8('0xb')](),controller[_0x69a8('0xc')]);router[_0x69a8('0xa')](_0x69a8('0xd'),auth[_0x69a8('0xb')](),controller[_0x69a8('0xe')]);router[_0x69a8('0xa')]('/:id',auth[_0x69a8('0xb')](),controller[_0x69a8('0xf')]);router['get'](_0x69a8('0x10'),auth[_0x69a8('0xb')](),controller['download']);router['post']('/',auth[_0x69a8('0xb')](),interaction[_0x69a8('0x11')](_0x69a8('0x12'),_0x69a8('0x13')),controller['create']);router['put'](_0x69a8('0x14'),auth['isAuthenticated'](),controller[_0x69a8('0x15')]);router[_0x69a8('0x16')](_0x69a8('0x17'),auth[_0x69a8('0xb')](),controller[_0x69a8('0x18')]);router['put'](_0x69a8('0x19'),auth['isAuthenticated'](),controller[_0x69a8('0x1a')]);router[_0x69a8('0x1b')]('/:id',auth[_0x69a8('0xb')](),controller[_0x69a8('0x1c')]);module[_0x69a8('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index f3d9d01..4c01944 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 _0xdc87=['out','STRING','long','DATE','INTEGER','BOOLEAN','Chat','Email','lodash','exports','TEXT','medium','ENUM'];(function(_0x26fac8,_0x4c4906){var _0x1c54cc=function(_0x12b2b){while(--_0x12b2b){_0x26fac8['push'](_0x26fac8['shift']());}};_0x1c54cc(++_0x4c4906);}(_0xdc87,0x7d));var _0x7dc8=function(_0x2de0a7,_0x38d3e7){_0x2de0a7=_0x2de0a7-0x0;var _0x429437=_0xdc87[_0x2de0a7];return _0x429437;};'use strict';var Sequelize=require('sequelize');var _=require(_0x7dc8('0x0'));module[_0x7dc8('0x1')]={'body':{'type':Sequelize[_0x7dc8('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x7dc8('0x2')](_0x7dc8('0x3'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x7dc8('0x4')]('in',_0x7dc8('0x5')),'defaultValue':_0x7dc8('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x7dc8('0x6')](0x1fe)},'from':{'type':Sequelize[_0x7dc8('0x6')]},'to':{'type':Sequelize[_0x7dc8('0x2')](_0x7dc8('0x7'))},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize['TEXT'](_0x7dc8('0x7'))},'subject':{'type':Sequelize[_0x7dc8('0x2')]},'sentAt':{'type':Sequelize[_0x7dc8('0x8')]},'attach':{'type':Sequelize[_0x7dc8('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x7dc8('0xa')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x7dc8('0x8')]},'originTo':{'type':Sequelize[_0x7dc8('0x2')](_0x7dc8('0x7'))},'originCc':{'type':Sequelize[_0x7dc8('0x2')]('long')},'originChannel':{'type':Sequelize[_0x7dc8('0x4')]('Email',_0x7dc8('0xb')),'defaultValue':_0x7dc8('0xc'),'allowNull':![]}}; \ No newline at end of file +var _0xf80a=['Email','Chat','sequelize','lodash','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','long','DATE'];(function(_0x8a7e38,_0x473a5d){var _0x228609=function(_0x5dcb5c){while(--_0x5dcb5c){_0x8a7e38['push'](_0x8a7e38['shift']());}};_0x228609(++_0x473a5d);}(_0xf80a,0x13a));var _0xaf80=function(_0x23eaa0,_0x410651){_0x23eaa0=_0x23eaa0-0x0;var _0x17f7db=_0xf80a[_0x23eaa0];return _0x17f7db;};'use strict';var Sequelize=require(_0xaf80('0x0'));var _=require(_0xaf80('0x1'));module[_0xaf80('0x2')]={'body':{'type':Sequelize['TEXT']('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xaf80('0x3')](_0xaf80('0x4'))},'read':{'type':Sequelize[_0xaf80('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xaf80('0x6')]('in','out'),'defaultValue':_0xaf80('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0xaf80('0x8')](0x1fe)},'from':{'type':Sequelize[_0xaf80('0x8')]},'to':{'type':Sequelize['TEXT']('long')},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize['TEXT'](_0xaf80('0x9'))},'subject':{'type':Sequelize[_0xaf80('0x3')]},'sentAt':{'type':Sequelize[_0xaf80('0xa')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xaf80('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xaf80('0xa')]},'originTo':{'type':Sequelize[_0xaf80('0x3')]('long')},'originCc':{'type':Sequelize['TEXT'](_0xaf80('0x9'))},'originChannel':{'type':Sequelize[_0xaf80('0x6')](_0xaf80('0xb'),_0xaf80('0xc')),'defaultValue':_0xaf80('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 1669e3c..d875d5c 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 _0x1bb1=['Bcc','existsSync','push','readFileSync','writeFileSync','unlinkSync','eml-format','moment','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','json','offset','undefined','limit','count','set','update','end','sendStatus','stack','name','send','map','MailMessage','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','find','body','params','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','List','CmContact','Contacts','MailServerOut','Smtp','isNil','service','host','port','secure','pass','auth','attachments','join','root','server/files/attachments','ListId','SendMail','sendMail','YYYY-MM-DD\x20HH:mm:ss','accept','mail','readAt','format','UserId','agent','get','MailInteraction','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','fromString','reject','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','EventManager','rejectmessage','download','unix','toString','server','files','message-%s.eml','from','bcc','subject','createdAt','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers'];(function(_0x5a2285,_0x3212d1){var _0x48f6ed=function(_0x322127){while(--_0x322127){_0x5a2285['push'](_0x5a2285['shift']());}};_0x48f6ed(++_0x3212d1);}(_0x1bb1,0xa9));var _0x11bb=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x1bb1[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x11bb('0x0'));var moment=require(_0x11bb('0x1'));var BPromise=require('bluebird');var util=require(_0x11bb('0x2'));var path=require(_0x11bb('0x3'));var fs=require('fs');var _=require(_0x11bb('0x4'));var Redis=require(_0x11bb('0x5'));var htmlToText=require(_0x11bb('0x6'));var qs=require(_0x11bb('0x7'));var logger=require(_0x11bb('0x8'))(_0x11bb('0x9'));var interaction_log=require(_0x11bb('0x8'))(_0x11bb('0xa'));var config=require(_0x11bb('0xb'));var db=require(_0x11bb('0xc'))['db'];config[_0x11bb('0xd')]=_['defaults'](config[_0x11bb('0xd')],{'host':_0x11bb('0xe'),'port':0x18eb});var socket=require(_0x11bb('0xf'))(new Redis(config[_0x11bb('0xd')]));var htmlEntities=require(_0x11bb('0x10'));require(_0x11bb('0x11'))[_0x11bb('0x12')](socket);var jayson=require(_0x11bb('0x13'));var client=jayson[_0x11bb('0x14')][_0x11bb('0x15')]({'port':0x232c});var client9003=jayson[_0x11bb('0x14')]['http']({'port':0x232b});var client9002=jayson[_0x11bb('0x14')][_0x11bb('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x462bd4,_0x36a021,_0x5ada9f,_0x3bceb9){return new BPromise(function(_0x3d10b6,_0x257f4f){var _0x4c00ae=_0x3bceb9||client;return _0x4c00ae['request'](_0x462bd4,_0x5ada9f)[_0x11bb('0x16')](function(_0x4c0501){logger[_0x11bb('0x17')](_0x11bb('0x18'),_0x36a021,'request\x20sent');logger[_0x11bb('0x19')](_0x11bb('0x1a'),_0x36a021,'request\x20sent',JSON[_0x11bb('0x1b')](_0x4c0501));if(_0x4c0501[_0x11bb('0x1c')]){if(_0x4c0501[_0x11bb('0x1c')]['code']===0x1f4){logger[_0x11bb('0x1c')]('MailMessage,\x20%s,\x20%s',_0x36a021,_0x4c0501[_0x11bb('0x1c')][_0x11bb('0x1d')]);return _0x257f4f(_0x4c0501[_0x11bb('0x1c')]['message']);}logger[_0x11bb('0x1c')]('MailMessage,\x20%s,\x20%s',_0x36a021,_0x4c0501[_0x11bb('0x1c')][_0x11bb('0x1d')]);return _0x3d10b6(_0x4c0501[_0x11bb('0x1c')]['message']);}else{logger[_0x11bb('0x17')](_0x11bb('0x18'),_0x36a021,'request\x20sent');_0x3d10b6(_0x4c0501[_0x11bb('0x1e')]['message']);}})[_0x11bb('0x1f')](function(_0x2b818b){logger[_0x11bb('0x1c')](_0x11bb('0x18'),_0x36a021,_0x2b818b);_0x257f4f(_0x2b818b);});});}function respondWithResult(_0x3f6904,_0x264896){_0x264896=_0x264896||0xc8;return function(_0x14bd47){if(_0x14bd47){return _0x3f6904[_0x11bb('0x20')](_0x264896)[_0x11bb('0x21')](_0x14bd47);}};}function respondWithFilteredResult(_0xff2f5d,_0x25f699){return function(_0x81d8ec){if(_0x81d8ec){var _0x18fe70=typeof _0x25f699[_0x11bb('0x22')]===_0x11bb('0x23')&&typeof _0x25f699[_0x11bb('0x24')]===_0x11bb('0x23');var _0x1a36c5=_0x81d8ec[_0x11bb('0x25')];var _0xccdfc1=_0x18fe70?0x0:_0x25f699[_0x11bb('0x22')];var _0x375a28=_0x18fe70?_0x81d8ec[_0x11bb('0x25')]:_0x25f699['offset']+_0x25f699[_0x11bb('0x24')];var _0x2216bb;if(_0x375a28>=_0x1a36c5){_0x375a28=_0x1a36c5;_0x2216bb=0xc8;}else{_0x2216bb=0xce;}_0xff2f5d['status'](_0x2216bb);return _0xff2f5d[_0x11bb('0x26')]('Content-Range',_0xccdfc1+'-'+_0x375a28+'/'+_0x1a36c5)[_0x11bb('0x21')](_0x81d8ec);}return null;};}function saveUpdates(_0x488132){return function(_0x394f4e){if(_0x394f4e){return _0x394f4e[_0x11bb('0x27')](_0x488132)['then'](function(_0x21862f){return _0x21862f;});}return null;};}function removeEntity(_0x951886){return function(_0x3e23d9){if(_0x3e23d9){return _0x3e23d9['destroy']()[_0x11bb('0x16')](function(){_0x951886['status'](0xcc)[_0x11bb('0x28')]();});}};}function handleEntityNotFound(_0x3443d7){return function(_0x2ea12d){if(!_0x2ea12d){_0x3443d7[_0x11bb('0x29')](0x194);}return _0x2ea12d;};}function handleError(_0xf4a212,_0x367873){_0x367873=_0x367873||0x1f4;return function(_0x45e7d4){logger[_0x11bb('0x1c')](_0x45e7d4[_0x11bb('0x2a')]);if(_0x45e7d4[_0x11bb('0x2b')]){delete _0x45e7d4[_0x11bb('0x2b')];}_0xf4a212[_0x11bb('0x20')](_0x367873)[_0x11bb('0x2c')](_0x45e7d4);};}exports['index']=function(_0x183335,_0x43ea8b){var _0x2205c4={},_0x424014={},_0x18acfc={'count':0x0,'rows':[]};var _0x2c7c24=_[_0x11bb('0x2d')](db[_0x11bb('0x2e')]['rawAttributes'],function(_0x424737){return{'name':_0x424737[_0x11bb('0x2f')],'type':_0x424737[_0x11bb('0x30')][_0x11bb('0x31')]};});_0x424014[_0x11bb('0x32')]=_[_0x11bb('0x2d')](_0x2c7c24,_0x11bb('0x2b'));_0x424014[_0x11bb('0x33')]=_[_0x11bb('0x34')](_0x183335[_0x11bb('0x33')]);_0x424014[_0x11bb('0x35')]=_['intersection'](_0x424014[_0x11bb('0x32')],_0x424014['query']);_0x2205c4['attributes']=_[_0x11bb('0x36')](_0x424014['model'],qs['fields'](_0x183335[_0x11bb('0x33')][_0x11bb('0x37')]));_0x2205c4[_0x11bb('0x38')]=_0x2205c4[_0x11bb('0x38')][_0x11bb('0x39')]?_0x2205c4['attributes']:_0x424014[_0x11bb('0x32')];if(!_0x183335[_0x11bb('0x33')][_0x11bb('0x3a')](_0x11bb('0x3b'))){_0x2205c4['limit']=qs[_0x11bb('0x24')](_0x183335['query'][_0x11bb('0x24')]);_0x2205c4[_0x11bb('0x22')]=qs[_0x11bb('0x22')](_0x183335[_0x11bb('0x33')][_0x11bb('0x22')]);}_0x2205c4[_0x11bb('0x3c')]=qs[_0x11bb('0x3d')](_0x183335[_0x11bb('0x33')][_0x11bb('0x3d')]);_0x2205c4[_0x11bb('0x3e')]=qs[_0x11bb('0x35')](_[_0x11bb('0x3f')](_0x183335[_0x11bb('0x33')],_0x424014[_0x11bb('0x35')]),_0x2c7c24);if(_0x183335[_0x11bb('0x33')][_0x11bb('0x40')]){_0x2205c4[_0x11bb('0x3e')]=_[_0x11bb('0x41')](_0x2205c4[_0x11bb('0x3e')],{'$or':_[_0x11bb('0x2d')](_0x2c7c24,function(_0x140f83){if(_0x140f83[_0x11bb('0x30')]!==_0x11bb('0x42')){var _0x3f07a4={};_0x3f07a4[_0x140f83[_0x11bb('0x2b')]]={'$like':'%'+_0x183335[_0x11bb('0x33')][_0x11bb('0x40')]+'%'};return _0x3f07a4;}})});}_0x2205c4=_[_0x11bb('0x41')]({},_0x2205c4,_0x183335[_0x11bb('0x43')]);var _0x34ac13={'where':_0x2205c4[_0x11bb('0x3e')]};return db[_0x11bb('0x2e')][_0x11bb('0x25')](_0x34ac13)[_0x11bb('0x16')](function(_0x168efd){_0x18acfc[_0x11bb('0x25')]=_0x168efd;if(_0x183335[_0x11bb('0x33')][_0x11bb('0x44')]){_0x2205c4[_0x11bb('0x45')]=[{'all':!![]}];}return db[_0x11bb('0x2e')][_0x11bb('0x46')](_0x2205c4);})['then'](function(_0x37fa5a){_0x18acfc[_0x11bb('0x47')]=_0x37fa5a;return _0x18acfc;})['then'](respondWithFilteredResult(_0x43ea8b,_0x2205c4))[_0x11bb('0x1f')](handleError(_0x43ea8b,null));};exports[_0x11bb('0x48')]=function(_0x30e7af,_0x10eca2){var _0x124570={'raw':!![],'where':{'id':_0x30e7af['params']['id']}},_0x2ce96c={};_0x2ce96c['model']=_[_0x11bb('0x34')](db[_0x11bb('0x2e')][_0x11bb('0x49')]);_0x2ce96c[_0x11bb('0x33')]=_['keys'](_0x30e7af[_0x11bb('0x33')]);_0x2ce96c[_0x11bb('0x35')]=_[_0x11bb('0x36')](_0x2ce96c[_0x11bb('0x32')],_0x2ce96c[_0x11bb('0x33')]);_0x124570['attributes']=_['intersection'](_0x2ce96c['model'],qs[_0x11bb('0x37')](_0x30e7af[_0x11bb('0x33')][_0x11bb('0x37')]));_0x124570[_0x11bb('0x38')]=_0x124570['attributes'][_0x11bb('0x39')]?_0x124570[_0x11bb('0x38')]:_0x2ce96c[_0x11bb('0x32')];if(_0x30e7af[_0x11bb('0x33')]['includeAll']){_0x124570[_0x11bb('0x45')]=[{'all':!![]}];}_0x124570=_[_0x11bb('0x41')]({},_0x124570,_0x30e7af[_0x11bb('0x43')]);return db[_0x11bb('0x2e')][_0x11bb('0x4a')](_0x124570)['then'](handleEntityNotFound(_0x10eca2,null))[_0x11bb('0x16')](respondWithResult(_0x10eca2,null))['catch'](handleError(_0x10eca2,null));};exports[_0x11bb('0x27')]=function(_0x44b128,_0x53f0d5){if(_0x44b128[_0x11bb('0x4b')]['id']){delete _0x44b128[_0x11bb('0x4b')]['id'];}return db[_0x11bb('0x2e')][_0x11bb('0x4a')]({'where':{'id':_0x44b128[_0x11bb('0x4c')]['id']}})['then'](handleEntityNotFound(_0x53f0d5,null))[_0x11bb('0x16')](saveUpdates(_0x44b128[_0x11bb('0x4b')],null))[_0x11bb('0x16')](respondWithResult(_0x53f0d5,null))[_0x11bb('0x1f')](handleError(_0x53f0d5,null));};exports['destroy']=function(_0x2675f1,_0x2f6f2f){return db[_0x11bb('0x2e')][_0x11bb('0x4a')]({'where':{'id':_0x2675f1[_0x11bb('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2f6f2f,null))[_0x11bb('0x16')](removeEntity(_0x2f6f2f,null))[_0x11bb('0x1f')](handleError(_0x2f6f2f,null));};exports['describe']=function(_0x1a2a19,_0x418e14){return db[_0x11bb('0x2e')]['describe']()['then'](respondWithResult(_0x418e14,null))[_0x11bb('0x1f')](handleError(_0x418e14,null));};exports[_0x11bb('0x4d')]=function(_0x4acd11,_0x4bc78c){return db[_0x11bb('0x2e')][_0x11bb('0x4d')](_0x4acd11[_0x11bb('0x4b')])[_0x11bb('0x16')](function(_0x3afa81){if(_0x3afa81){if(_0x3afa81[_0x11bb('0x4e')]===_0x11bb('0x4f')&&!_0x3afa81[_0x11bb('0x50')]){var _0x489082,_0x2a3c6c,_0x22cdaf;if(_0x4acd11[_0x11bb('0x4b')]['to']){_0x2a3c6c=_0x4acd11[_0x11bb('0x4b')]['to'][_0x11bb('0x51')](',')[0x0];}return db[_0x11bb('0x52')][_0x11bb('0x53')]({'where':{'id':_0x3afa81[_0x11bb('0x54')]},'include':[{'model':db['CmList'],'as':_0x11bb('0x55'),'include':[{'model':db[_0x11bb('0x56')],'as':_0x11bb('0x57'),'where':{'email':_0x2a3c6c},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x11bb('0x58')],'as':_0x11bb('0x59'),'raw':!![]}]})[_0x11bb('0x16')](function(_0xb7c1f5){_0x489082=_0xb7c1f5;if(_0x489082&&_0x489082[_0x11bb('0x59')]){var _0x1d411e={'tls':{'rejectUnauthorized':![]}};if(_[_0x11bb('0x5a')](_0x489082[_0x11bb('0x59')][_0x11bb('0x5b')])){_0x1d411e[_0x11bb('0x5c')]=_0x489082[_0x11bb('0x59')][_0x11bb('0x5c')];_0x1d411e[_0x11bb('0x5d')]=_0x489082['Smtp'][_0x11bb('0x5d')];_0x1d411e[_0x11bb('0x5e')]=_0x489082[_0x11bb('0x59')]['secure'];if(_0x489082[_0x11bb('0x59')]['authentication']){_0x1d411e['auth']={'user':_0x489082[_0x11bb('0x59')]['user'],'pass':_0x489082[_0x11bb('0x59')][_0x11bb('0x5f')]};}}else{_0x1d411e[_0x11bb('0x5b')]=_0x489082[_0x11bb('0x59')]['service'];_0x1d411e[_0x11bb('0x60')]={'user':_0x489082['Smtp']['user'],'pass':_0x489082[_0x11bb('0x59')]['pass']};_0x1d411e['secure']=_0x489082[_0x11bb('0x59')][_0x11bb('0x5e')];}if(_0x4acd11['body'][_0x11bb('0x61')]&&_0x4acd11[_0x11bb('0x4b')][_0x11bb('0x61')][_0x11bb('0x39')]){for(var _0x1385bd=0x0;_0x1385bd<_0x4acd11[_0x11bb('0x4b')][_0x11bb('0x61')]['length'];_0x1385bd+=0x1){_0x4acd11[_0x11bb('0x4b')][_0x11bb('0x61')][_0x1385bd]={'filename':_0x4acd11[_0x11bb('0x4b')]['attachments'][_0x1385bd][_0x11bb('0x2b')],'path':path[_0x11bb('0x62')](config[_0x11bb('0x63')],_0x11bb('0x64'),_0x4acd11[_0x11bb('0x4b')][_0x11bb('0x61')][_0x1385bd]['basename'])};}}_0x22cdaf={'account':_0x1d411e,'message':_0x4acd11['body']};return;}})[_0x11bb('0x16')](function(){if(_0x489082[_0x11bb('0x55')]){if(_0x489082[_0x11bb('0x55')][_0x11bb('0x57')][_0x11bb('0x39')]){return _0x489082['List'][_0x11bb('0x57')][0x0];}else{return db[_0x11bb('0x56')]['create'](_['defaults'](_0x4acd11[_0x11bb('0x4b')],{'firstName':_0x4acd11[_0x11bb('0x4b')]['to'],'email':_0x4acd11[_0x11bb('0x4b')]['to'],'phone':_0x4acd11[_0x11bb('0x4b')]['to'],'ListId':_0x489082[_0x11bb('0x65')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x11bb('0x16')](function(){if(_0x22cdaf){return respondWithRpcPromise(_0x11bb('0x66'),_0x11bb('0x67'),_0x22cdaf,client9003)[_0x11bb('0x16')](function(_0x25cfcf){return _0x3afa81[_0x11bb('0x27')]({'read':!![],'messageId':_0x25cfcf['messageId'],'sentAt':moment()['format'](_0x11bb('0x68'))});})['catch'](function(_0x5c78f6){logger[_0x11bb('0x1c')]('%s',JSON['stringify'](_0x5c78f6));return _0x3afa81;});}return _0x3afa81;});}return _0x3afa81;}})[_0x11bb('0x16')](respondWithResult(_0x4bc78c,0xc9))['catch'](handleError(_0x4bc78c,null));};exports[_0x11bb('0x69')]=function(_0x28c3a4,_0x378d9c){var _0x45ce7a={'agent':{},'channel':_0x11bb('0x6a')};if(_0x28c3a4['body']['id']){delete _0x28c3a4[_0x11bb('0x4b')]['id'];}_0x28c3a4[_0x11bb('0x4b')]['read']=!![];_0x28c3a4[_0x11bb('0x4b')][_0x11bb('0x6b')]=moment()[_0x11bb('0x6c')]('YYYY-MM-DD\x20HH:mm:ss');_0x28c3a4['body'][_0x11bb('0x6d')]=_0x28c3a4[_0x11bb('0x4b')][_0x11bb('0x6d')]||_0x28c3a4['user']['id'];_0x45ce7a[_0x11bb('0x6e')]['id']=_0x28c3a4[_0x11bb('0x4b')][_0x11bb('0x6d')];return db['MailMessage'][_0x11bb('0x4a')]({'where':{'id':_0x28c3a4[_0x11bb('0x4c')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x378d9c,null))[_0x11bb('0x16')](saveUpdates(_0x28c3a4[_0x11bb('0x4b')],null))[_0x11bb('0x16')](function(_0x80d4e3){if(_0x80d4e3){_0x45ce7a[_0x11bb('0x1d')]=_0x80d4e3[_0x11bb('0x6f')]({'plain':!![]});return db[_0x11bb('0x70')]['find']({'where':{'id':_0x80d4e3['MailInteractionId']}});}return null;})[_0x11bb('0x16')](handleEntityNotFound(_0x378d9c,null))[_0x11bb('0x16')](function(_0x3462d3){if(_0x3462d3){return _0x3462d3[_0x11bb('0x27')]({'UserId':_0x28c3a4['body'][_0x11bb('0x6d')],'read1stAt':_[_0x11bb('0x5a')](_0x3462d3[_0x11bb('0x71')])?moment()['format'](_0x11bb('0x68')):undefined});}return null;})['then'](function(_0x50bedd){if(_0x50bedd){_0x45ce7a['interaction']=_0x50bedd[_0x11bb('0x6f')]({'plain':!![]});interaction_log[_0x11bb('0x17')](_0x11bb('0x72'),_0x28c3a4[_0x11bb('0x73')]['id'],_0x28c3a4[_0x11bb('0x73')][_0x11bb('0x2b')],_0x28c3a4[_0x11bb('0x73')][_0x11bb('0x74')],_0x45ce7a[_0x11bb('0x75')]['id'],_0x28c3a4[_0x11bb('0x4b')]?JSON[_0x11bb('0x1b')](_0x28c3a4[_0x11bb('0x4b')]):_0x11bb('0x76'));return respondWithRpcPromise(_0x11bb('0x77'),'acceptMessage',_0x45ce7a);}return null;})['then'](function(_0x5016d0){var _0x21a3be=_0x11bb('0x78')+_0x5016d0[_0x11bb('0x1d')][_0x11bb('0x79')];return db['sequelize'][_0x11bb('0x33')](_0x21a3be,{'type':db[_0x11bb('0x7a')][_0x11bb('0x7b')][_0x11bb('0x7c')],'raw':!![]})['then'](function(_0x2a3865){return _0x2a3865;});})[_0x11bb('0x16')](function(_0x871be8){if(_0x871be8){_0x45ce7a[_0x11bb('0x1d')][_0x11bb('0x7d')]=_0x871be8[0x0];if(!_0x28c3a4[_0x11bb('0x4b')][_0x11bb('0x6d')])return;return db[_0x11bb('0x7e')]['find']({'where':{'id':_0x28c3a4[_0x11bb('0x4b')]['UserId'],'role':_0x11bb('0x6e')},'attributes':['id','name',_0x11bb('0x7f'),'email',_0x11bb('0x80')],'raw':!![]});}return null;})['then'](function(_0x195fdc){if(!_0x195fdc)return null;_0x45ce7a[_0x11bb('0x1d')][_0x11bb('0x6e')]=_0x195fdc;return _0x45ce7a;})[_0x11bb('0x16')](function(_0xebcff7){if(_0xebcff7){if(_0x28c3a4['body'][_0x11bb('0x81')]){_0x45ce7a[_0x11bb('0x1d')][_0x11bb('0x82')]=util[_0x11bb('0x6c')](_0x11bb('0x83'),_0x28c3a4[_0x11bb('0x73')][_0x11bb('0x2b')]);_0x45ce7a[_0x11bb('0x1d')][_0x11bb('0x84')]=_0x45ce7a[_0x11bb('0x84')];_0x45ce7a[_0x11bb('0x1d')][_0x11bb('0x85')]=_0x45ce7a['channel'];_0x45ce7a['message']['event']=_0x11bb('0x69');_0x45ce7a[_0x11bb('0x1d')][_0x11bb('0x4b')]=htmlToText[_0x11bb('0x86')](_0x45ce7a['message'][_0x11bb('0x4b')]);return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x45ce7a[_0x11bb('0x1d')]},client9002)['then'](function(){return _0x45ce7a;});}return _0x45ce7a;}return null;})[_0x11bb('0x16')](respondWithResult(_0x378d9c,null))[_0x11bb('0x1f')](handleError(_0x378d9c,null));};exports[_0x11bb('0x87')]=function(_0x3cc32f,_0x4230cc){var _0x18f01e={'agent':{},'channel':_0x11bb('0x6a')};if(_0x3cc32f[_0x11bb('0x4b')]['id']){delete _0x3cc32f[_0x11bb('0x4b')]['id'];}_0x3cc32f['body'][_0x11bb('0x6d')]=_0x3cc32f['body']['UserId']||_0x3cc32f['user']['id'];_0x18f01e[_0x11bb('0x6e')]['id']=_0x3cc32f[_0x11bb('0x4b')]['UserId'];return db[_0x11bb('0x2e')]['find']({'where':{'id':_0x3cc32f['params']['id'],'UserId':null}})[_0x11bb('0x16')](handleEntityNotFound(_0x4230cc,null))['then'](function(_0x1ef986){if(_0x1ef986){_0x18f01e[_0x11bb('0x1d')]=_0x1ef986[_0x11bb('0x6f')]({'plain':!![]});return db[_0x11bb('0x70')][_0x11bb('0x4a')]({'where':{'id':_0x1ef986[_0x11bb('0x88')]}});}return null;})[_0x11bb('0x16')](handleEntityNotFound(_0x4230cc,null))[_0x11bb('0x16')](function(_0x5eea2e){if(_0x5eea2e){_0x18f01e[_0x11bb('0x75')]=_0x5eea2e[_0x11bb('0x6f')]({'plain':!![]});interaction_log[_0x11bb('0x17')](_0x11bb('0x89'),_0x3cc32f[_0x11bb('0x73')]['id'],_0x3cc32f[_0x11bb('0x73')][_0x11bb('0x2b')],_0x3cc32f[_0x11bb('0x73')][_0x11bb('0x74')],_0x18f01e['interaction']['id'],_0x3cc32f[_0x11bb('0x4b')]?JSON['stringify'](_0x3cc32f[_0x11bb('0x4b')]):_0x11bb('0x76'));return respondWithRpcPromise(_0x11bb('0x8a'),_0x11bb('0x8b'),_0x18f01e);}return null;})[_0x11bb('0x16')](function(_0x55a288){var _0x3aa0d1='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x55a288['message']['ContactId'];return db[_0x11bb('0x8c')]['query'](_0x3aa0d1,{'type':db[_0x11bb('0x7a')][_0x11bb('0x7b')][_0x11bb('0x7c')],'raw':!![]})['then'](function(_0x4639d2){return _0x4639d2;});})[_0x11bb('0x16')](function(_0x4930cc){if(_0x4930cc){_0x18f01e[_0x11bb('0x1d')][_0x11bb('0x7d')]=_0x4930cc[0x0];if(!_0x3cc32f[_0x11bb('0x4b')][_0x11bb('0x6d')])return;return db['User'][_0x11bb('0x4a')]({'where':{'id':_0x3cc32f[_0x11bb('0x4b')]['UserId'],'role':_0x11bb('0x6e')},'attributes':['id',_0x11bb('0x2b'),'fullname','email',_0x11bb('0x80')],'raw':!![]});}return null;})[_0x11bb('0x16')](function(_0x41ee06){if(!_0x41ee06)return null;_0x18f01e[_0x11bb('0x1d')]['agent']=_0x41ee06;return _0x18f01e;})[_0x11bb('0x16')](function(_0x3faae8){if(_0x3faae8){_0x3faae8[_0x11bb('0x1d')][_0x11bb('0x82')]=util[_0x11bb('0x6c')](_0x11bb('0x83'),_0x3cc32f[_0x11bb('0x73')][_0x11bb('0x2b')]);_0x3faae8[_0x11bb('0x1d')][_0x11bb('0x84')]=_0x18f01e['channel'];_0x3faae8[_0x11bb('0x1d')]['motionChannel']=_0x18f01e[_0x11bb('0x84')];_0x3faae8[_0x11bb('0x1d')]['event']=_0x11bb('0x87');_0x3faae8['message'][_0x11bb('0x4b')]=htmlToText['fromString'](_0x18f01e['message'][_0x11bb('0x4b')]);respondWithRpcPromise(_0x11bb('0x8d'),_0x11bb('0x8d'),{'event':_0x11bb('0x8e'),'message':_0x3faae8[_0x11bb('0x1d')]},client9002);return _0x18f01e;}return null;})[_0x11bb('0x16')](respondWithResult(_0x4230cc,null))[_0x11bb('0x1f')](handleError(_0x4230cc,null));};exports[_0x11bb('0x8f')]=function(_0x1c4982,_0x23ce6c){var _0x5cd44c=moment()[_0x11bb('0x90')]()[_0x11bb('0x91')]();var _0x14c7fd=path[_0x11bb('0x62')](config[_0x11bb('0x63')],_0x11bb('0x92'),'files','tmp');var _0x705634=path['join'](config[_0x11bb('0x63')],_0x11bb('0x92'),_0x11bb('0x93'),_0x11bb('0x61'));var _0x5756ca=util[_0x11bb('0x6c')](_0x11bb('0x94'),_0x5cd44c);return db[_0x11bb('0x2e')][_0x11bb('0x4a')]({'where':{'id':_0x1c4982[_0x11bb('0x4c')]['id']},'attributes':['id',_0x11bb('0x4b'),_0x11bb('0x95'),'to','cc',_0x11bb('0x96'),_0x11bb('0x97'),_0x11bb('0x98')],'include':_0x1c4982[_0x11bb('0x33')][_0x11bb('0x61')]?[{'model':db['Attachment'],'as':_0x11bb('0x99')}]:undefined})[_0x11bb('0x16')](handleEntityNotFound(_0x23ce6c,null))['then'](function(_0x4d3731){if(_0x4d3731){var _0x5b3588=_0x4d3731;var _0x512479={'from':_0x5b3588[_0x11bb('0x95')],'to':_0x5b3588['to'],'subject':_0x5b3588[_0x11bb('0x97')],'html':htmlEntities[_0x11bb('0x9a')](_0x5b3588['body']),'headers':{'Date':moment(_0x5b3588[_0x11bb('0x98')])['format'](_0x11bb('0x9b'))},'attachments':[]};if(_0x4d3731['cc']){_0x512479[_0x11bb('0x9c')]['Cc']=_0x4d3731['cc'];}if(_0x4d3731[_0x11bb('0x96')]){_0x512479[_0x11bb('0x9c')][_0x11bb('0x9d')]=_0x4d3731[_0x11bb('0x96')];}return new BPromise(function(_0x43f7ea,_0x468921){if(_0x4d3731[_0x11bb('0x99')]){for(var _0x187eb7=0x0;_0x187eb7<_0x4d3731[_0x11bb('0x99')]['length'];_0x187eb7++){var _0x42901d=_0x4d3731['Attachments'][_0x187eb7];var _0xee76d4=path[_0x11bb('0x62')](_0x705634,_0x42901d['basename']);if(fs[_0x11bb('0x9e')](_0xee76d4)){_0x512479[_0x11bb('0x61')][_0x11bb('0x9f')]({'name':_0x42901d['name'],'contentType':_0x42901d[_0x11bb('0x30')],'data':fs[_0x11bb('0xa0')](_0xee76d4)});}}}emlformat['build'](_0x512479,function(_0x36ab01,_0xaccd0b){if(_0x36ab01)return _0x468921(_0x36ab01);fs[_0x11bb('0xa1')](path['join'](_0x14c7fd,_0x5756ca),_0xaccd0b);return _0x43f7ea(_0xaccd0b);});});}})['then'](function(_0x180364){if(_0x180364){return _0x23ce6c['download'](path[_0x11bb('0x62')](_0x14c7fd,_0x5756ca),_0x5756ca,function(_0xce55a1){if(!_0xce55a1)fs[_0x11bb('0xa2')](path['join'](_0x14c7fd,_0x5756ca));});}})['catch'](handleError(_0x23ce6c,null));}; \ No newline at end of file +var _0x5ad3=['null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','contact','email','internal','manual','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','mail','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','fullname','interface','rejectmessage','download','unix','server','files','tmp','message-%s.eml','from','bcc','createdAt','Attachment','Attachments','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','build','unlinkSync','eml-format','bluebird','util','lodash','ioredis','html-to-text','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','html-entities','register','jayson/promise','client','http','request','debug','request\x20sent','stringify','error','code','MailMessage,\x20%s,\x20%s','message','info','result','catch','status','undefined','limit','count','offset','set','Content-Range','update','then','destroy','sendStatus','name','send','map','MailMessage','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','body','describe','create','direction','out','secret','split','MailAccount','findOne','CmList','CmContact','updatedAt','DESC','Smtp','isNil','service','host','secure','auth','user','pass','attachments','join','root','basename','List','Contacts','ListId','List\x20not\x20found','SendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','accept','read','readAt','format','UserId','agent','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role'];(function(_0x503325,_0x24a407){var _0x452fff=function(_0x42bf26){while(--_0x42bf26){_0x503325['push'](_0x503325['shift']());}};_0x452fff(++_0x24a407);}(_0x5ad3,0xd0));var _0x35ad=function(_0x52085a,_0x3717ca){_0x52085a=_0x52085a-0x0;var _0x5afc1a=_0x5ad3[_0x52085a];return _0x5afc1a;};'use strict';var emlformat=require(_0x35ad('0x0'));var moment=require('moment');var BPromise=require(_0x35ad('0x1'));var util=require(_0x35ad('0x2'));var path=require('path');var fs=require('fs');var _=require(_0x35ad('0x3'));var Redis=require(_0x35ad('0x4'));var htmlToText=require(_0x35ad('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0x35ad('0x6'))(_0x35ad('0x7'));var interaction_log=require('../../config/logger')(_0x35ad('0x8'));var config=require(_0x35ad('0x9'));var db=require(_0x35ad('0xa'))['db'];config['redis']=_[_0x35ad('0xb')](config['redis'],{'host':_0x35ad('0xc'),'port':0x18eb});var socket=require(_0x35ad('0xd'))(new Redis(config[_0x35ad('0xe')]));var htmlEntities=require(_0x35ad('0xf'));require('./mailMessage.socket')[_0x35ad('0x10')](socket);var jayson=require(_0x35ad('0x11'));var client=jayson[_0x35ad('0x12')][_0x35ad('0x13')]({'port':0x232c});var client9003=jayson[_0x35ad('0x12')]['http']({'port':0x232b});var client9002=jayson[_0x35ad('0x12')][_0x35ad('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x86f8ad,_0x2571b9,_0x1f2bc9,_0x4f2d0d){return new BPromise(function(_0x2946e0,_0x9d2892){var _0x41ce5b=_0x4f2d0d||client;return _0x41ce5b[_0x35ad('0x14')](_0x86f8ad,_0x1f2bc9)['then'](function(_0x18739f){logger['info']('MailMessage,\x20%s,\x20%s',_0x2571b9,'request\x20sent');logger[_0x35ad('0x15')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x2571b9,_0x35ad('0x16'),JSON[_0x35ad('0x17')](_0x18739f));if(_0x18739f[_0x35ad('0x18')]){if(_0x18739f['error'][_0x35ad('0x19')]===0x1f4){logger[_0x35ad('0x18')](_0x35ad('0x1a'),_0x2571b9,_0x18739f[_0x35ad('0x18')][_0x35ad('0x1b')]);return _0x9d2892(_0x18739f[_0x35ad('0x18')][_0x35ad('0x1b')]);}logger['error'](_0x35ad('0x1a'),_0x2571b9,_0x18739f[_0x35ad('0x18')]['message']);return _0x2946e0(_0x18739f[_0x35ad('0x18')]['message']);}else{logger[_0x35ad('0x1c')](_0x35ad('0x1a'),_0x2571b9,_0x35ad('0x16'));_0x2946e0(_0x18739f[_0x35ad('0x1d')][_0x35ad('0x1b')]);}})[_0x35ad('0x1e')](function(_0x144a2c){logger[_0x35ad('0x18')](_0x35ad('0x1a'),_0x2571b9,_0x144a2c);_0x9d2892(_0x144a2c);});});}function respondWithResult(_0x7c27e2,_0x27a964){_0x27a964=_0x27a964||0xc8;return function(_0x146439){if(_0x146439){return _0x7c27e2[_0x35ad('0x1f')](_0x27a964)['json'](_0x146439);}};}function respondWithFilteredResult(_0x56cc84,_0x414401){return function(_0x267ca7){if(_0x267ca7){var _0x46da4a=typeof _0x414401['offset']===_0x35ad('0x20')&&typeof _0x414401[_0x35ad('0x21')]==='undefined';var _0x44e041=_0x267ca7[_0x35ad('0x22')];var _0x184576=_0x46da4a?0x0:_0x414401[_0x35ad('0x23')];var _0x8636b9=_0x46da4a?_0x267ca7[_0x35ad('0x22')]:_0x414401[_0x35ad('0x23')]+_0x414401[_0x35ad('0x21')];var _0x734901;if(_0x8636b9>=_0x44e041){_0x8636b9=_0x44e041;_0x734901=0xc8;}else{_0x734901=0xce;}_0x56cc84['status'](_0x734901);return _0x56cc84[_0x35ad('0x24')](_0x35ad('0x25'),_0x184576+'-'+_0x8636b9+'/'+_0x44e041)['json'](_0x267ca7);}return null;};}function saveUpdates(_0x328de3){return function(_0x147d07){if(_0x147d07){return _0x147d07[_0x35ad('0x26')](_0x328de3)[_0x35ad('0x27')](function(_0x499765){return _0x499765;});}return null;};}function removeEntity(_0x250a0c){return function(_0x5f0be8){if(_0x5f0be8){return _0x5f0be8[_0x35ad('0x28')]()[_0x35ad('0x27')](function(){_0x250a0c[_0x35ad('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41a1f3){return function(_0xfc1e35){if(!_0xfc1e35){_0x41a1f3[_0x35ad('0x29')](0x194);}return _0xfc1e35;};}function handleError(_0x55afc2,_0x5cddfa){_0x5cddfa=_0x5cddfa||0x1f4;return function(_0x25f58d){logger['error'](_0x25f58d['stack']);if(_0x25f58d['name']){delete _0x25f58d[_0x35ad('0x2a')];}_0x55afc2[_0x35ad('0x1f')](_0x5cddfa)[_0x35ad('0x2b')](_0x25f58d);};}exports['index']=function(_0x2667ad,_0x2adb1a){var _0x594853={},_0x117270={},_0x2a48f9={'count':0x0,'rows':[]};var _0x291d66=_[_0x35ad('0x2c')](db[_0x35ad('0x2d')]['rawAttributes'],function(_0x4c498b){return{'name':_0x4c498b['fieldName'],'type':_0x4c498b[_0x35ad('0x2e')][_0x35ad('0x2f')]};});_0x117270['model']=_['map'](_0x291d66,_0x35ad('0x2a'));_0x117270[_0x35ad('0x30')]=_[_0x35ad('0x31')](_0x2667ad[_0x35ad('0x30')]);_0x117270[_0x35ad('0x32')]=_[_0x35ad('0x33')](_0x117270[_0x35ad('0x34')],_0x117270[_0x35ad('0x30')]);_0x594853['attributes']=_[_0x35ad('0x33')](_0x117270[_0x35ad('0x34')],qs[_0x35ad('0x35')](_0x2667ad[_0x35ad('0x30')][_0x35ad('0x35')]));_0x594853[_0x35ad('0x36')]=_0x594853[_0x35ad('0x36')][_0x35ad('0x37')]?_0x594853[_0x35ad('0x36')]:_0x117270[_0x35ad('0x34')];if(!_0x2667ad[_0x35ad('0x30')]['hasOwnProperty'](_0x35ad('0x38'))){_0x594853[_0x35ad('0x21')]=qs['limit'](_0x2667ad[_0x35ad('0x30')][_0x35ad('0x21')]);_0x594853[_0x35ad('0x23')]=qs['offset'](_0x2667ad['query'][_0x35ad('0x23')]);}_0x594853[_0x35ad('0x39')]=qs['sort'](_0x2667ad[_0x35ad('0x30')][_0x35ad('0x3a')]);_0x594853['where']=qs['filters'](_['pick'](_0x2667ad[_0x35ad('0x30')],_0x117270[_0x35ad('0x32')]),_0x291d66);if(_0x2667ad[_0x35ad('0x30')]['filter']){_0x594853[_0x35ad('0x3b')]=_[_0x35ad('0x3c')](_0x594853[_0x35ad('0x3b')],{'$or':_['map'](_0x291d66,function(_0x40e1aa){if(_0x40e1aa[_0x35ad('0x2e')]!==_0x35ad('0x3d')){var _0x294b8a={};_0x294b8a[_0x40e1aa['name']]={'$like':'%'+_0x2667ad['query'][_0x35ad('0x3e')]+'%'};return _0x294b8a;}})});}_0x594853=_[_0x35ad('0x3c')]({},_0x594853,_0x2667ad[_0x35ad('0x3f')]);var _0x3ca48b={'where':_0x594853[_0x35ad('0x3b')]};return db[_0x35ad('0x2d')][_0x35ad('0x22')](_0x3ca48b)[_0x35ad('0x27')](function(_0x39d060){_0x2a48f9['count']=_0x39d060;if(_0x2667ad[_0x35ad('0x30')][_0x35ad('0x40')]){_0x594853[_0x35ad('0x41')]=[{'all':!![]}];}return db[_0x35ad('0x2d')][_0x35ad('0x42')](_0x594853);})[_0x35ad('0x27')](function(_0x1c592d){_0x2a48f9[_0x35ad('0x43')]=_0x1c592d;return _0x2a48f9;})['then'](respondWithFilteredResult(_0x2adb1a,_0x594853))['catch'](handleError(_0x2adb1a,null));};exports[_0x35ad('0x44')]=function(_0x325376,_0x500342){var _0x248faa={'raw':!![],'where':{'id':_0x325376[_0x35ad('0x45')]['id']}},_0x469bd8={};_0x469bd8[_0x35ad('0x34')]=_[_0x35ad('0x31')](db[_0x35ad('0x2d')]['rawAttributes']);_0x469bd8['query']=_[_0x35ad('0x31')](_0x325376['query']);_0x469bd8['filters']=_[_0x35ad('0x33')](_0x469bd8[_0x35ad('0x34')],_0x469bd8[_0x35ad('0x30')]);_0x248faa[_0x35ad('0x36')]=_['intersection'](_0x469bd8[_0x35ad('0x34')],qs[_0x35ad('0x35')](_0x325376[_0x35ad('0x30')][_0x35ad('0x35')]));_0x248faa[_0x35ad('0x36')]=_0x248faa[_0x35ad('0x36')][_0x35ad('0x37')]?_0x248faa[_0x35ad('0x36')]:_0x469bd8[_0x35ad('0x34')];if(_0x325376[_0x35ad('0x30')]['includeAll']){_0x248faa[_0x35ad('0x41')]=[{'all':!![]}];}_0x248faa=_[_0x35ad('0x3c')]({},_0x248faa,_0x325376[_0x35ad('0x3f')]);return db[_0x35ad('0x2d')][_0x35ad('0x46')](_0x248faa)['then'](handleEntityNotFound(_0x500342,null))['then'](respondWithResult(_0x500342,null))[_0x35ad('0x1e')](handleError(_0x500342,null));};exports['update']=function(_0x5e6bad,_0x2a2e00){if(_0x5e6bad[_0x35ad('0x47')]['id']){delete _0x5e6bad[_0x35ad('0x47')]['id'];}return db[_0x35ad('0x2d')][_0x35ad('0x46')]({'where':{'id':_0x5e6bad['params']['id']}})[_0x35ad('0x27')](handleEntityNotFound(_0x2a2e00,null))['then'](saveUpdates(_0x5e6bad[_0x35ad('0x47')],null))[_0x35ad('0x27')](respondWithResult(_0x2a2e00,null))['catch'](handleError(_0x2a2e00,null));};exports[_0x35ad('0x28')]=function(_0x17c343,_0x429daa){return db['MailMessage'][_0x35ad('0x46')]({'where':{'id':_0x17c343[_0x35ad('0x45')]['id']}})[_0x35ad('0x27')](handleEntityNotFound(_0x429daa,null))['then'](removeEntity(_0x429daa,null))[_0x35ad('0x1e')](handleError(_0x429daa,null));};exports[_0x35ad('0x48')]=function(_0x3929d7,_0x1c7e58){return db[_0x35ad('0x2d')][_0x35ad('0x48')]()[_0x35ad('0x27')](respondWithResult(_0x1c7e58,null))[_0x35ad('0x1e')](handleError(_0x1c7e58,null));};exports[_0x35ad('0x49')]=function(_0x45e77e,_0x2ef53c){return db[_0x35ad('0x2d')][_0x35ad('0x49')](_0x45e77e[_0x35ad('0x47')])[_0x35ad('0x27')](function(_0x2723e9){if(_0x2723e9){if(_0x2723e9[_0x35ad('0x4a')]===_0x35ad('0x4b')&&!_0x2723e9[_0x35ad('0x4c')]){var _0x5de785,_0x549c02,_0x137f94;if(_0x45e77e[_0x35ad('0x47')]['to']){_0x549c02=_0x45e77e[_0x35ad('0x47')]['to'][_0x35ad('0x4d')](',')[0x0];}return db[_0x35ad('0x4e')][_0x35ad('0x4f')]({'where':{'id':_0x2723e9['MailAccountId']},'include':[{'model':db[_0x35ad('0x50')],'as':'List','include':[{'model':db[_0x35ad('0x51')],'as':'Contacts','where':{'email':_0x549c02},'limit':0x1,'order':[[_0x35ad('0x52'),_0x35ad('0x53')]]}]},{'model':db['MailServerOut'],'as':_0x35ad('0x54'),'raw':!![]}]})[_0x35ad('0x27')](function(_0x291353){_0x5de785=_0x291353;if(_0x5de785&&_0x5de785[_0x35ad('0x54')]){var _0xe4c3a1={'tls':{'rejectUnauthorized':![]}};if(_[_0x35ad('0x55')](_0x5de785['Smtp'][_0x35ad('0x56')])){_0xe4c3a1[_0x35ad('0x57')]=_0x5de785['Smtp'][_0x35ad('0x57')];_0xe4c3a1['port']=_0x5de785[_0x35ad('0x54')]['port'];_0xe4c3a1[_0x35ad('0x58')]=_0x5de785[_0x35ad('0x54')]['secure'];if(_0x5de785['Smtp']['authentication']){_0xe4c3a1[_0x35ad('0x59')]={'user':_0x5de785[_0x35ad('0x54')][_0x35ad('0x5a')],'pass':_0x5de785[_0x35ad('0x54')][_0x35ad('0x5b')]};}}else{_0xe4c3a1[_0x35ad('0x56')]=_0x5de785[_0x35ad('0x54')]['service'];_0xe4c3a1[_0x35ad('0x59')]={'user':_0x5de785[_0x35ad('0x54')][_0x35ad('0x5a')],'pass':_0x5de785[_0x35ad('0x54')]['pass']};_0xe4c3a1[_0x35ad('0x58')]=_0x5de785[_0x35ad('0x54')]['secure'];}if(_0x45e77e[_0x35ad('0x47')][_0x35ad('0x5c')]&&_0x45e77e['body'][_0x35ad('0x5c')]['length']){for(var _0x5be753=0x0;_0x5be753<_0x45e77e[_0x35ad('0x47')][_0x35ad('0x5c')][_0x35ad('0x37')];_0x5be753+=0x1){_0x45e77e[_0x35ad('0x47')][_0x35ad('0x5c')][_0x5be753]={'filename':_0x45e77e[_0x35ad('0x47')][_0x35ad('0x5c')][_0x5be753][_0x35ad('0x2a')],'path':path[_0x35ad('0x5d')](config[_0x35ad('0x5e')],'server/files/attachments',_0x45e77e[_0x35ad('0x47')][_0x35ad('0x5c')][_0x5be753][_0x35ad('0x5f')])};}}_0x137f94={'account':_0xe4c3a1,'message':_0x45e77e[_0x35ad('0x47')]};return;}})[_0x35ad('0x27')](function(){if(_0x5de785[_0x35ad('0x60')]){if(_0x5de785[_0x35ad('0x60')][_0x35ad('0x61')][_0x35ad('0x37')]){return _0x5de785['List'][_0x35ad('0x61')][0x0];}else{return db[_0x35ad('0x51')][_0x35ad('0x49')](_[_0x35ad('0xb')](_0x45e77e['body'],{'firstName':_0x45e77e[_0x35ad('0x47')]['to'],'email':_0x45e77e[_0x35ad('0x47')]['to'],'phone':_0x45e77e[_0x35ad('0x47')]['to'],'ListId':_0x5de785[_0x35ad('0x62')]}));}}else{throw new Error(_0x35ad('0x63'));}})[_0x35ad('0x27')](function(){if(_0x137f94){return respondWithRpcPromise(_0x35ad('0x64'),'sendMail',_0x137f94,client9003)[_0x35ad('0x27')](function(_0xd4e697){return _0x2723e9[_0x35ad('0x26')]({'read':!![],'messageId':_0xd4e697[_0x35ad('0x65')],'sentAt':moment()['format'](_0x35ad('0x66'))});})[_0x35ad('0x1e')](function(_0x58c417){logger[_0x35ad('0x18')]('%s',JSON[_0x35ad('0x17')](_0x58c417));return _0x2723e9;});}return _0x2723e9;});}return _0x2723e9;}})['then'](respondWithResult(_0x2ef53c,0xc9))[_0x35ad('0x1e')](handleError(_0x2ef53c,null));};exports[_0x35ad('0x67')]=function(_0x233b2e,_0x3ba51e){var _0x57b860={'agent':{},'channel':'mail'};if(_0x233b2e[_0x35ad('0x47')]['id']){delete _0x233b2e['body']['id'];}_0x233b2e[_0x35ad('0x47')][_0x35ad('0x68')]=!![];_0x233b2e[_0x35ad('0x47')][_0x35ad('0x69')]=moment()[_0x35ad('0x6a')](_0x35ad('0x66'));_0x233b2e[_0x35ad('0x47')][_0x35ad('0x6b')]=_0x233b2e['body'][_0x35ad('0x6b')]||_0x233b2e['user']['id'];_0x57b860[_0x35ad('0x6c')]['id']=_0x233b2e[_0x35ad('0x47')][_0x35ad('0x6b')];return db['MailMessage'][_0x35ad('0x46')]({'where':{'id':_0x233b2e['params']['id'],'UserId':null}})[_0x35ad('0x27')](handleEntityNotFound(_0x3ba51e,null))[_0x35ad('0x27')](saveUpdates(_0x233b2e[_0x35ad('0x47')],null))[_0x35ad('0x27')](function(_0x3c62bc){if(_0x3c62bc){_0x57b860[_0x35ad('0x1b')]=_0x3c62bc[_0x35ad('0x6d')]({'plain':!![]});return db[_0x35ad('0x6e')][_0x35ad('0x46')]({'where':{'id':_0x3c62bc[_0x35ad('0x6f')]}});}return null;})[_0x35ad('0x27')](handleEntityNotFound(_0x3ba51e,null))['then'](function(_0x2cab88){if(_0x2cab88){return _0x2cab88[_0x35ad('0x26')]({'UserId':_0x233b2e['body'][_0x35ad('0x6b')],'read1stAt':_[_0x35ad('0x55')](_0x2cab88[_0x35ad('0x70')])?moment()[_0x35ad('0x6a')](_0x35ad('0x66')):undefined});}return null;})[_0x35ad('0x27')](function(_0x2483a8){if(_0x2483a8){_0x57b860[_0x35ad('0x71')]=_0x2483a8[_0x35ad('0x6d')]({'plain':!![]});interaction_log[_0x35ad('0x1c')](_0x35ad('0x72'),_0x233b2e[_0x35ad('0x5a')]['id'],_0x233b2e[_0x35ad('0x5a')][_0x35ad('0x2a')],_0x233b2e['user'][_0x35ad('0x73')],_0x57b860['interaction']['id'],_0x233b2e['body']?JSON[_0x35ad('0x17')](_0x233b2e['body']):_0x35ad('0x74'));return respondWithRpcPromise(_0x35ad('0x75'),_0x35ad('0x76'),_0x57b860);}return null;})['then'](function(_0x233773){var _0x10e286='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x233773[_0x35ad('0x1b')][_0x35ad('0x77')];return db[_0x35ad('0x78')][_0x35ad('0x30')](_0x10e286,{'type':db[_0x35ad('0x79')][_0x35ad('0x7a')]['SELECT'],'raw':!![]})[_0x35ad('0x27')](function(_0x238822){return _0x238822;});})[_0x35ad('0x27')](function(_0x257c1d){if(_0x257c1d){_0x57b860[_0x35ad('0x1b')][_0x35ad('0x7b')]=_0x257c1d[0x0];if(!_0x233b2e[_0x35ad('0x47')][_0x35ad('0x6b')])return;return db['User'][_0x35ad('0x46')]({'where':{'id':_0x233b2e[_0x35ad('0x47')][_0x35ad('0x6b')],'role':'agent'},'attributes':['id','name','fullname',_0x35ad('0x7c'),_0x35ad('0x7d')],'raw':!![]});}return null;})['then'](function(_0x3b6996){if(!_0x3b6996)return null;_0x57b860[_0x35ad('0x1b')][_0x35ad('0x6c')]=_0x3b6996;return _0x57b860;})['then'](function(_0x1673e8){if(_0x1673e8){if(_0x233b2e[_0x35ad('0x47')][_0x35ad('0x7e')]){_0x57b860[_0x35ad('0x1b')]['interface']=util[_0x35ad('0x6a')](_0x35ad('0x7f'),_0x233b2e[_0x35ad('0x5a')][_0x35ad('0x2a')]);_0x57b860[_0x35ad('0x1b')]['channel']=_0x57b860[_0x35ad('0x80')];_0x57b860[_0x35ad('0x1b')][_0x35ad('0x81')]=_0x57b860[_0x35ad('0x80')];_0x57b860[_0x35ad('0x1b')][_0x35ad('0x82')]=_0x35ad('0x67');_0x57b860[_0x35ad('0x1b')][_0x35ad('0x47')]=htmlToText[_0x35ad('0x83')](_0x57b860['message']['body']);return respondWithRpcPromise(_0x35ad('0x84'),_0x35ad('0x84'),{'event':_0x35ad('0x85'),'message':_0x57b860[_0x35ad('0x1b')]},client9002)[_0x35ad('0x27')](function(){return _0x57b860;});}return _0x57b860;}return null;})[_0x35ad('0x27')](respondWithResult(_0x3ba51e,null))['catch'](handleError(_0x3ba51e,null));};exports[_0x35ad('0x86')]=function(_0xec7822,_0xb5aef2){var _0x15ae41={'agent':{},'channel':_0x35ad('0x87')};if(_0xec7822[_0x35ad('0x47')]['id']){delete _0xec7822[_0x35ad('0x47')]['id'];}_0xec7822['body'][_0x35ad('0x6b')]=_0xec7822['body'][_0x35ad('0x6b')]||_0xec7822['user']['id'];_0x15ae41[_0x35ad('0x6c')]['id']=_0xec7822[_0x35ad('0x47')][_0x35ad('0x6b')];return db[_0x35ad('0x2d')]['find']({'where':{'id':_0xec7822[_0x35ad('0x45')]['id'],'UserId':null}})[_0x35ad('0x27')](handleEntityNotFound(_0xb5aef2,null))[_0x35ad('0x27')](function(_0x4707cb){if(_0x4707cb){_0x15ae41[_0x35ad('0x1b')]=_0x4707cb['get']({'plain':!![]});return db[_0x35ad('0x6e')]['find']({'where':{'id':_0x4707cb[_0x35ad('0x6f')]}});}return null;})[_0x35ad('0x27')](handleEntityNotFound(_0xb5aef2,null))[_0x35ad('0x27')](function(_0x4583fc){if(_0x4583fc){_0x15ae41[_0x35ad('0x71')]=_0x4583fc[_0x35ad('0x6d')]({'plain':!![]});interaction_log[_0x35ad('0x1c')](_0x35ad('0x88'),_0xec7822['user']['id'],_0xec7822[_0x35ad('0x5a')][_0x35ad('0x2a')],_0xec7822[_0x35ad('0x5a')][_0x35ad('0x73')],_0x15ae41[_0x35ad('0x71')]['id'],_0xec7822[_0x35ad('0x47')]?JSON[_0x35ad('0x17')](_0xec7822[_0x35ad('0x47')]):'null');return respondWithRpcPromise(_0x35ad('0x89'),_0x35ad('0x8a'),_0x15ae41);}return null;})['then'](function(_0x4fd929){var _0x550f10='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4fd929[_0x35ad('0x1b')][_0x35ad('0x77')];return db[_0x35ad('0x78')]['query'](_0x550f10,{'type':db['Sequelize'][_0x35ad('0x7a')][_0x35ad('0x8b')],'raw':!![]})[_0x35ad('0x27')](function(_0x644ede){return _0x644ede;});})['then'](function(_0x4487c5){if(_0x4487c5){_0x15ae41['message'][_0x35ad('0x7b')]=_0x4487c5[0x0];if(!_0xec7822['body'][_0x35ad('0x6b')])return;return db['User'][_0x35ad('0x46')]({'where':{'id':_0xec7822[_0x35ad('0x47')]['UserId'],'role':_0x35ad('0x6c')},'attributes':['id','name',_0x35ad('0x8c'),_0x35ad('0x7c'),_0x35ad('0x7d')],'raw':!![]});}return null;})[_0x35ad('0x27')](function(_0x207e3a){if(!_0x207e3a)return null;_0x15ae41[_0x35ad('0x1b')]['agent']=_0x207e3a;return _0x15ae41;})['then'](function(_0x15786f){if(_0x15786f){_0x15786f[_0x35ad('0x1b')][_0x35ad('0x8d')]=util['format'](_0x35ad('0x7f'),_0xec7822['user']['name']);_0x15786f[_0x35ad('0x1b')][_0x35ad('0x80')]=_0x15ae41[_0x35ad('0x80')];_0x15786f[_0x35ad('0x1b')][_0x35ad('0x81')]=_0x15ae41[_0x35ad('0x80')];_0x15786f[_0x35ad('0x1b')][_0x35ad('0x82')]=_0x35ad('0x86');_0x15786f['message'][_0x35ad('0x47')]=htmlToText[_0x35ad('0x83')](_0x15ae41['message']['body']);respondWithRpcPromise(_0x35ad('0x84'),_0x35ad('0x84'),{'event':_0x35ad('0x8e'),'message':_0x15786f['message']},client9002);return _0x15ae41;}return null;})[_0x35ad('0x27')](respondWithResult(_0xb5aef2,null))[_0x35ad('0x1e')](handleError(_0xb5aef2,null));};exports[_0x35ad('0x8f')]=function(_0x17a934,_0x497433){var _0x5298b5=moment()[_0x35ad('0x90')]()['toString']();var _0x400b48=path[_0x35ad('0x5d')](config[_0x35ad('0x5e')],_0x35ad('0x91'),_0x35ad('0x92'),_0x35ad('0x93'));var _0x34cdda=path[_0x35ad('0x5d')](config[_0x35ad('0x5e')],'server','files',_0x35ad('0x5c'));var _0x182974=util[_0x35ad('0x6a')](_0x35ad('0x94'),_0x5298b5);return db[_0x35ad('0x2d')][_0x35ad('0x46')]({'where':{'id':_0x17a934[_0x35ad('0x45')]['id']},'attributes':['id',_0x35ad('0x47'),_0x35ad('0x95'),'to','cc',_0x35ad('0x96'),'subject',_0x35ad('0x97')],'include':_0x17a934[_0x35ad('0x30')][_0x35ad('0x5c')]?[{'model':db[_0x35ad('0x98')],'as':_0x35ad('0x99')}]:undefined})[_0x35ad('0x27')](handleEntityNotFound(_0x497433,null))[_0x35ad('0x27')](function(_0x27ba72){if(_0x27ba72){var _0x1e885f=_0x27ba72;var _0x144533={'from':_0x1e885f[_0x35ad('0x95')],'to':_0x1e885f['to'],'subject':_0x1e885f[_0x35ad('0x9a')],'html':htmlEntities[_0x35ad('0x9b')](_0x1e885f[_0x35ad('0x47')]),'headers':{'Date':moment(_0x1e885f[_0x35ad('0x97')])[_0x35ad('0x6a')](_0x35ad('0x9c'))},'attachments':[]};if(_0x27ba72['cc']){_0x144533[_0x35ad('0x9d')]['Cc']=_0x27ba72['cc'];}if(_0x27ba72[_0x35ad('0x96')]){_0x144533[_0x35ad('0x9d')][_0x35ad('0x9e')]=_0x27ba72['bcc'];}return new BPromise(function(_0x5bff62,_0x594d76){if(_0x27ba72[_0x35ad('0x99')]){for(var _0x2b500b=0x0;_0x2b500b<_0x27ba72[_0x35ad('0x99')][_0x35ad('0x37')];_0x2b500b++){var _0x5f04a6=_0x27ba72['Attachments'][_0x2b500b];var _0x5c9f15=path['join'](_0x34cdda,_0x5f04a6[_0x35ad('0x5f')]);if(fs[_0x35ad('0x9f')](_0x5c9f15)){_0x144533[_0x35ad('0x5c')]['push']({'name':_0x5f04a6[_0x35ad('0x2a')],'contentType':_0x5f04a6[_0x35ad('0x2e')],'data':fs['readFileSync'](_0x5c9f15)});}}}emlformat[_0x35ad('0xa0')](_0x144533,function(_0x318792,_0x335ccb){if(_0x318792)return _0x594d76(_0x318792);fs['writeFileSync'](path['join'](_0x400b48,_0x182974),_0x335ccb);return _0x5bff62(_0x335ccb);});});}})[_0x35ad('0x27')](function(_0x384d8e){if(_0x384d8e){return _0x497433[_0x35ad('0x8f')](path['join'](_0x400b48,_0x182974),_0x182974,function(_0x1795b4){if(!_0x1795b4)fs[_0x35ad('0xa1')](path[_0x35ad('0x5d')](_0x400b48,_0x182974));});}})[_0x35ad('0x1e')](handleError(_0x497433,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 61df8c5..876b9b0 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 _0xb64b=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x3c0f79,_0xafde90){var _0x1fc206=function(_0x2f1587){while(--_0x2f1587){_0x3c0f79['push'](_0x3c0f79['shift']());}};_0x1fc206(++_0xafde90);}(_0xb64b,0x16d));var _0xbb64=function(_0x245f64,_0x4ae342){_0x245f64=_0x245f64-0x0;var _0x3447e0=_0xb64b[_0x245f64];return _0x3447e0;};'use strict';var EventEmitter=require(_0xbb64('0x0'));var MailMessage=require(_0xbb64('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xbb64('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xbb64('0x3')};function emitEvent(_0x50a347){return function(_0x1e1ec4,_0x68978c,_0x465efc){MailMessageEvents[_0xbb64('0x4')](_0x50a347+':'+_0x1e1ec4['id'],_0x1e1ec4);MailMessageEvents[_0xbb64('0x4')](_0x50a347,_0x1e1ec4);_0x465efc(null);};}for(var e in events){if(events[_0xbb64('0x5')](e)){var event=events[e];MailMessage[_0xbb64('0x6')](e,emitEvent(event));}}module[_0xbb64('0x7')]=MailMessageEvents; \ No newline at end of file +var _0xb1ac=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','MailMessage','setMaxListeners','save'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb1ac,0x109));var _0xcb1a=function(_0x1c0d18,_0x5bba54){_0x1c0d18=_0x1c0d18-0x0;var _0x2b6c1c=_0xb1ac[_0x1c0d18];return _0x2b6c1c;};'use strict';var EventEmitter=require(_0xcb1a('0x0'));var MailMessage=require(_0xcb1a('0x1'))['db'][_0xcb1a('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xcb1a('0x3')](0x0);var events={'afterCreate':_0xcb1a('0x4'),'afterUpdate':_0xcb1a('0x5'),'afterDestroy':_0xcb1a('0x6')};function emitEvent(_0x1dc2d3){return function(_0x506919,_0x216067,_0x291820){MailMessageEvents[_0xcb1a('0x7')](_0x1dc2d3+':'+_0x506919['id'],_0x506919);MailMessageEvents['emit'](_0x1dc2d3,_0x506919);_0x291820(null);};}for(var e in events){if(events[_0xcb1a('0x8')](e)){var event=events[e];MailMessage[_0xcb1a('0x9')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index f812b9c..f2014a1 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 _0xe8a2=['messageId','subject','FULLTEXT','fromString','models','get','direction','toLowerCase','secret','UserId','MailInteraction','MailInteractionId','then','update','error','utf8mb4','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailMessage.attributes','define','MailMessage','mail_messages'];(function(_0x517961,_0x5e49fd){var _0x1f10c3=function(_0x430e05){while(--_0x430e05){_0x517961['push'](_0x517961['shift']());}};_0x1f10c3(++_0x5e49fd);}(_0xe8a2,0x160));var _0x2e8a=function(_0x2f5ea8,_0x52a89b){_0x2f5ea8=_0x2f5ea8-0x0;var _0x403463=_0xe8a2[_0x2f5ea8];return _0x403463;};'use strict';var _=require('lodash');var util=require(_0x2e8a('0x0'));var logger=require('../../config/logger')(_0x2e8a('0x1'));var moment=require(_0x2e8a('0x2'));var BPromise=require(_0x2e8a('0x3'));var rp=require(_0x2e8a('0x4'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x2e8a('0x5'));var rimraf=require(_0x2e8a('0x6'));var config=require(_0x2e8a('0x7'));var attributes=require(_0x2e8a('0x8'));module['exports']=function(_0x4a6f5d,_0x13fb65){return _0x4a6f5d[_0x2e8a('0x9')](_0x2e8a('0xa'),attributes,{'tableName':_0x2e8a('0xb'),'paranoid':![],'indexes':[{'name':_0x2e8a('0xc'),'fields':[_0x2e8a('0xc')]},{'name':'fti_mail_messages','fields':['plainBody',_0x2e8a('0xd')],'type':_0x2e8a('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x424fcb,_0x1a5890,_0x2a886d){if(_0x424fcb['body']){_0x424fcb['plainBody']=htmlToText[_0x2e8a('0xf')](_0x424fcb['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2a886d(null,_0x1a5890);},'afterCreate':function(_0x58b4fd,_0x489f9a,_0x5f2232){var _0x1167b0=_0x4a6f5d[_0x2e8a('0x10')];var _0x587b85=_0x58b4fd[_0x2e8a('0x11')]({'plain':!![]});if(_0x587b85['direction']['toLowerCase']()==='in'||_0x587b85[_0x2e8a('0x12')][_0x2e8a('0x13')]()==='out'&&!_0x587b85[_0x2e8a('0x14')]&&!_['isNil'](_0x587b85[_0x2e8a('0x15')])){_0x1167b0[_0x2e8a('0x16')]['findOne']({'where':{'id':_0x587b85[_0x2e8a('0x17')]}})[_0x2e8a('0x18')](function(_0x41396d){if(_0x41396d){_0x41396d[_0x2e8a('0x19')]({'lastMsgAt':_0x587b85['createdAt'],'lastMsgDirection':_0x587b85[_0x2e8a('0x12')]['toLowerCase']()});}})['catch'](function(_0x5a8944){console[_0x2e8a('0x1a')](_0x5a8944);});}_0x5f2232();}},'charset':_0x2e8a('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2bd4=['UserId','MailInteraction','findOne','MailInteractionId','then','direction','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailMessage.attributes','exports','define','mail_messages','messageId','plainBody','subject','FULLTEXT','fromString','body','models','get','toLowerCase','out','isNil'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x2bd4,0x1e6));var _0x42bd=function(_0x1ddaf3,_0x5be217){_0x1ddaf3=_0x1ddaf3-0x0;var _0xd2c1e1=_0x2bd4[_0x1ddaf3];return _0xd2c1e1;};'use strict';var _=require(_0x42bd('0x0'));var util=require(_0x42bd('0x1'));var logger=require(_0x42bd('0x2'))(_0x42bd('0x3'));var moment=require(_0x42bd('0x4'));var BPromise=require(_0x42bd('0x5'));var rp=require(_0x42bd('0x6'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x42bd('0x7'));var rimraf=require('rimraf');var config=require(_0x42bd('0x8'));var attributes=require(_0x42bd('0x9'));module[_0x42bd('0xa')]=function(_0x22bd9e,_0x124d24){return _0x22bd9e[_0x42bd('0xb')]('MailMessage',attributes,{'tableName':_0x42bd('0xc'),'paranoid':![],'indexes':[{'name':_0x42bd('0xd'),'fields':[_0x42bd('0xd')]},{'name':'fti_mail_messages','fields':[_0x42bd('0xe'),_0x42bd('0xf')],'type':_0x42bd('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x41a6cc,_0x345ad7,_0xa090cc){if(_0x41a6cc['body']){_0x41a6cc[_0x42bd('0xe')]=htmlToText[_0x42bd('0x11')](_0x41a6cc[_0x42bd('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xa090cc(null,_0x345ad7);},'afterCreate':function(_0x2689e8,_0x3ca9c9,_0x313758){var _0x292295=_0x22bd9e[_0x42bd('0x13')];var _0x3cbba8=_0x2689e8[_0x42bd('0x14')]({'plain':!![]});if(_0x3cbba8['direction'][_0x42bd('0x15')]()==='in'||_0x3cbba8['direction']['toLowerCase']()===_0x42bd('0x16')&&!_0x3cbba8['secret']&&!_[_0x42bd('0x17')](_0x3cbba8[_0x42bd('0x18')])){_0x292295[_0x42bd('0x19')][_0x42bd('0x1a')]({'where':{'id':_0x3cbba8[_0x42bd('0x1b')]}})[_0x42bd('0x1c')](function(_0x4cb2f4){if(_0x4cb2f4){_0x4cb2f4['update']({'lastMsgAt':_0x3cbba8['createdAt'],'lastMsgDirection':_0x3cbba8[_0x42bd('0x1d')][_0x42bd('0x15')]()});}})[_0x42bd('0x1e')](function(_0x19ef2c){console[_0x42bd('0x1f')](_0x19ef2c);});}_0x313758();}},'charset':_0x42bd('0x20'),'collate':_0x42bd('0x21')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 6da44fd..65f2273 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 _0x896e=['request\x20sent','debug','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','options','raw','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./mailMessage.socket','register','request','then','MailMessage,\x20%s,\x20%s'];(function(_0x200a86,_0x2f126b){var _0x241c2b=function(_0x27fee4){while(--_0x27fee4){_0x200a86['push'](_0x200a86['shift']());}};_0x241c2b(++_0x2f126b);}(_0x896e,0x1e9));var _0xe896=function(_0x55b906,_0x338c0e){_0x55b906=_0x55b906-0x0;var _0x5d2117=_0x896e[_0x55b906];return _0x5d2117;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));var BPromise=require(_0xe896('0x3'));var rs=require(_0xe896('0x4'));var fs=require('fs');var Redis=require(_0xe896('0x5'));var db=require(_0xe896('0x6'))['db'];var utils=require(_0xe896('0x7'));var logger=require(_0xe896('0x8'))(_0xe896('0x9'));var config=require(_0xe896('0xa'));var jayson=require(_0xe896('0xb'));var client=jayson['client'][_0xe896('0xc')]({'port':0x232a});config[_0xe896('0xd')]=_[_0xe896('0xe')](config[_0xe896('0xd')],{'host':_0xe896('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe896('0xd')]));require(_0xe896('0x10'))[_0xe896('0x11')](socket);function respondWithRpcPromise(_0x4afd3f,_0x305616,_0x48251e){return new BPromise(function(_0x45b15b,_0x5be679){return client[_0xe896('0x12')](_0x4afd3f,_0x48251e)[_0xe896('0x13')](function(_0xa00ae9){logger['info'](_0xe896('0x14'),_0x305616,_0xe896('0x15'));logger[_0xe896('0x16')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x305616,_0xe896('0x15'),JSON[_0xe896('0x17')](_0xa00ae9));if(_0xa00ae9[_0xe896('0x18')]){if(_0xa00ae9['error'][_0xe896('0x19')]===0x1f4){logger[_0xe896('0x18')](_0xe896('0x14'),_0x305616,_0xa00ae9['error']['message']);return _0x5be679(_0xa00ae9[_0xe896('0x18')][_0xe896('0x1a')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x305616,_0xa00ae9[_0xe896('0x18')][_0xe896('0x1a')]);return _0x45b15b(_0xa00ae9['error'][_0xe896('0x1a')]);}else{logger['info'](_0xe896('0x14'),_0x305616,_0xe896('0x15'));_0x45b15b(_0xa00ae9[_0xe896('0x1b')]['message']);}})[_0xe896('0x1c')](function(_0x9714f1){logger[_0xe896('0x18')](_0xe896('0x14'),_0x305616,_0x9714f1);_0x5be679(_0x9714f1);});});}exports[_0xe896('0x1d')]=function(_0x3ac8b8){var _0x388c2e=this;return new Promise(function(_0x32d3d3,_0x49547b){return db[_0xe896('0x1e')]['create'](_0x3ac8b8['body'],{'raw':_0x3ac8b8[_0xe896('0x1f')]?_0x3ac8b8[_0xe896('0x1f')][_0xe896('0x20')]===undefined?!![]:![]:!![]})[_0xe896('0x13')](function(_0x498469){logger[_0xe896('0x21')]('CreateMailMessage',_0x3ac8b8);logger['debug'](_0xe896('0x1d'),_0x3ac8b8,JSON[_0xe896('0x17')](_0x498469));_0x32d3d3(_0x498469);})[_0xe896('0x1c')](function(_0x2e2c10){logger[_0xe896('0x18')](_0xe896('0x1d'),_0x2e2c10[_0xe896('0x1a')],_0x3ac8b8);_0x49547b(_0x388c2e['error'](0x1f4,_0x2e2c10[_0xe896('0x1a')]));});});}; \ No newline at end of file +var _0x9582=['client','http','redis','defaults','register','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateMailMessage','MailMessage','options','raw','info','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x8bfc82,_0x2e3023){var _0x3d5a6d=function(_0x560611){while(--_0x560611){_0x8bfc82['push'](_0x8bfc82['shift']());}};_0x3d5a6d(++_0x2e3023);}(_0x9582,0x95));var _0x2958=function(_0x58f6a8,_0x1d068b){_0x58f6a8=_0x58f6a8-0x0;var _0x1a8daa=_0x9582[_0x58f6a8];return _0x1a8daa;};'use strict';var _=require(_0x2958('0x0'));var util=require(_0x2958('0x1'));var moment=require(_0x2958('0x2'));var BPromise=require(_0x2958('0x3'));var rs=require(_0x2958('0x4'));var fs=require('fs');var Redis=require(_0x2958('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2958('0x6'));var logger=require(_0x2958('0x7'))(_0x2958('0x8'));var config=require(_0x2958('0x9'));var jayson=require(_0x2958('0xa'));var client=jayson[_0x2958('0xb')][_0x2958('0xc')]({'port':0x232a});config[_0x2958('0xd')]=_[_0x2958('0xe')](config[_0x2958('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2958('0xd')]));require('./mailMessage.socket')[_0x2958('0xf')](socket);function respondWithRpcPromise(_0x51e460,_0x44cccc,_0x5ef23c){return new BPromise(function(_0x3aacfa,_0x29776c){return client[_0x2958('0x10')](_0x51e460,_0x5ef23c)[_0x2958('0x11')](function(_0x11ec8d){logger['info'](_0x2958('0x12'),_0x44cccc,_0x2958('0x13'));logger[_0x2958('0x14')](_0x2958('0x15'),_0x44cccc,_0x2958('0x13'),JSON[_0x2958('0x16')](_0x11ec8d));if(_0x11ec8d[_0x2958('0x17')]){if(_0x11ec8d[_0x2958('0x17')]['code']===0x1f4){logger[_0x2958('0x17')](_0x2958('0x12'),_0x44cccc,_0x11ec8d['error']['message']);return _0x29776c(_0x11ec8d[_0x2958('0x17')][_0x2958('0x18')]);}logger['error'](_0x2958('0x12'),_0x44cccc,_0x11ec8d['error']['message']);return _0x3aacfa(_0x11ec8d[_0x2958('0x17')][_0x2958('0x18')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x44cccc,_0x2958('0x13'));_0x3aacfa(_0x11ec8d[_0x2958('0x19')][_0x2958('0x18')]);}})[_0x2958('0x1a')](function(_0x27599c){logger['error'](_0x2958('0x12'),_0x44cccc,_0x27599c);_0x29776c(_0x27599c);});});}exports[_0x2958('0x1b')]=function(_0x1a12fa){var _0x57b6c5=this;return new Promise(function(_0x1e77eb,_0x53b100){return db[_0x2958('0x1c')]['create'](_0x1a12fa['body'],{'raw':_0x1a12fa[_0x2958('0x1d')]?_0x1a12fa[_0x2958('0x1d')][_0x2958('0x1e')]===undefined?!![]:![]:!![]})[_0x2958('0x11')](function(_0x2202f8){logger[_0x2958('0x1f')](_0x2958('0x1b'),_0x1a12fa);logger[_0x2958('0x14')](_0x2958('0x1b'),_0x1a12fa,JSON[_0x2958('0x16')](_0x2202f8));_0x1e77eb(_0x2202f8);})[_0x2958('0x1a')](function(_0xd58ae1){logger[_0x2958('0x17')](_0x2958('0x1b'),_0xd58ae1[_0x2958('0x18')],_0x1a12fa);_0x53b100(_0x57b6c5['error'](0x1f4,_0xd58ae1['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 5bc340c..6fd74e3 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 _0x65e9=['./mailMessage.events','save','update','removeListener','register','length','mailMessage:'];(function(_0x38894d,_0x1883d8){var _0x5614fe=function(_0x181989){while(--_0x181989){_0x38894d['push'](_0x38894d['shift']());}};_0x5614fe(++_0x1883d8);}(_0x65e9,0x15e));var _0x965e=function(_0x475769,_0x1f80ee){_0x475769=_0x475769-0x0;var _0x4fdac4=_0x65e9[_0x475769];return _0x4fdac4;};'use strict';var MailMessageEvents=require(_0x965e('0x0'));var events=[_0x965e('0x1'),'remove',_0x965e('0x2')];function createListener(_0x537fb6,_0x18623f){return function(_0x120820){_0x18623f['emit'](_0x537fb6,_0x120820);};}function removeListener(_0xd368fc,_0x8900ca){return function(){MailMessageEvents[_0x965e('0x3')](_0xd368fc,_0x8900ca);};}exports[_0x965e('0x4')]=function(_0x32e6ad){for(var _0x363e45=0x0,_0xa623d5=events[_0x965e('0x5')];_0x363e45<_0xa623d5;_0x363e45++){var _0x38081c=events[_0x363e45];var _0x4bc92d=createListener(_0x965e('0x6')+_0x38081c,_0x32e6ad);MailMessageEvents['on'](_0x38081c,_0x4bc92d);}}; \ No newline at end of file +var _0xaced=['update','emit','register','length','./mailMessage.events','save','remove'];(function(_0x5a28a2,_0x4c7230){var _0x1dddff=function(_0x5eef98){while(--_0x5eef98){_0x5a28a2['push'](_0x5a28a2['shift']());}};_0x1dddff(++_0x4c7230);}(_0xaced,0x18c));var _0xdace=function(_0xa22998,_0x2c30ff){_0xa22998=_0xa22998-0x0;var _0x1d2bd0=_0xaced[_0xa22998];return _0x1d2bd0;};'use strict';var MailMessageEvents=require(_0xdace('0x0'));var events=[_0xdace('0x1'),_0xdace('0x2'),_0xdace('0x3')];function createListener(_0x44b792,_0x58f547){return function(_0x36bfd5){_0x58f547[_0xdace('0x4')](_0x44b792,_0x36bfd5);};}function removeListener(_0x1ba367,_0x46522e){return function(){MailMessageEvents['removeListener'](_0x1ba367,_0x46522e);};}exports[_0xdace('0x5')]=function(_0x4d7f80){for(var _0x5f5d92=0x0,_0x198ca1=events[_0xdace('0x6')];_0x5f5d92<_0x198ca1;_0x5f5d92++){var _0x3521d8=events[_0x5f5d92];var _0x199697=createListener('mailMessage:'+_0x3521d8,_0x4d7f80);MailMessageEvents['on'](_0x3521d8,_0x199697);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 975e1a0..3e20e12 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 _0x903a=['put','delete','destroy','removeTeams','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','create','post','addAgents'];(function(_0x469411,_0x22d14a){var _0x5503ae=function(_0x25335c){while(--_0x25335c){_0x469411['push'](_0x469411['shift']());}};_0x5503ae(++_0x22d14a);}(_0x903a,0x17f));var _0xa903=function(_0x420600,_0x28865c){_0x420600=_0x420600-0x0;var _0x2a0117=_0x903a[_0x420600];return _0x2a0117;};'use strict';var multer=require('multer');var util=require(_0xa903('0x0'));var path=require('path');var timeout=require(_0xa903('0x1'));var express=require(_0xa903('0x2'));var router=express[_0xa903('0x3')]();var fs_extra=require(_0xa903('0x4'));var auth=require(_0xa903('0x5'));var interaction=require(_0xa903('0x6'));var config=require(_0xa903('0x7'));var controller=require('./mailQueue.controller');router['get']('/',auth[_0xa903('0x8')](),controller[_0xa903('0x9')]);router[_0xa903('0xa')](_0xa903('0xb'),auth[_0xa903('0x8')](),controller[_0xa903('0xc')]);router[_0xa903('0xa')](_0xa903('0xd'),auth[_0xa903('0x8')](),controller[_0xa903('0xe')]);router[_0xa903('0xa')]('/:id/members',auth[_0xa903('0x8')](),controller[_0xa903('0xf')]);router[_0xa903('0xa')](_0xa903('0x10'),auth['isAuthenticated'](),controller[_0xa903('0x11')]);router[_0xa903('0xa')](_0xa903('0x12'),auth[_0xa903('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa903('0x8')](),controller[_0xa903('0x13')]);router[_0xa903('0x14')](_0xa903('0x10'),auth[_0xa903('0x8')](),controller['addTeams']);router[_0xa903('0x14')](_0xa903('0x12'),auth[_0xa903('0x8')](),controller[_0xa903('0x15')]);router[_0xa903('0x16')](_0xa903('0xd'),auth[_0xa903('0x8')](),controller['update']);router[_0xa903('0x17')](_0xa903('0xd'),auth['isAuthenticated'](),controller[_0xa903('0x18')]);router[_0xa903('0x17')](_0xa903('0x10'),auth[_0xa903('0x8')](),controller[_0xa903('0x19')]);router[_0xa903('0x17')](_0xa903('0x12'),auth[_0xa903('0x8')](),controller['removeAgents']);module[_0xa903('0x1a')]=router; \ No newline at end of file +var _0x1aac=['/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','describe','/:id','isAuthenticated','show','getMembers','/:id/teams','getTeams','post'];(function(_0x117d08,_0x10678d){var _0x1332c1=function(_0x4e7bd9){while(--_0x4e7bd9){_0x117d08['push'](_0x117d08['shift']());}};_0x1332c1(++_0x10678d);}(_0x1aac,0x90));var _0xc1aa=function(_0x4f0bb4,_0x2f0161){_0x4f0bb4=_0x4f0bb4-0x0;var _0x1cbad8=_0x1aac[_0x4f0bb4];return _0x1cbad8;};'use strict';var multer=require(_0xc1aa('0x0'));var util=require(_0xc1aa('0x1'));var path=require('path');var timeout=require(_0xc1aa('0x2'));var express=require(_0xc1aa('0x3'));var router=express[_0xc1aa('0x4')]();var fs_extra=require(_0xc1aa('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc1aa('0x6'));var config=require(_0xc1aa('0x7'));var controller=require(_0xc1aa('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc1aa('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xc1aa('0xa')]);router[_0xc1aa('0x9')](_0xc1aa('0xb'),auth[_0xc1aa('0xc')](),controller[_0xc1aa('0xd')]);router[_0xc1aa('0x9')]('/:id/members',auth['isAuthenticated'](),controller[_0xc1aa('0xe')]);router[_0xc1aa('0x9')](_0xc1aa('0xf'),auth[_0xc1aa('0xc')](),controller[_0xc1aa('0x10')]);router[_0xc1aa('0x9')]('/:id/users',auth[_0xc1aa('0xc')](),controller['getAgents']);router[_0xc1aa('0x11')]('/',auth[_0xc1aa('0xc')](),controller['create']);router[_0xc1aa('0x11')](_0xc1aa('0xf'),auth['isAuthenticated'](),controller['addTeams']);router['post'](_0xc1aa('0x12'),auth[_0xc1aa('0xc')](),controller[_0xc1aa('0x13')]);router[_0xc1aa('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xc1aa('0x15')]);router[_0xc1aa('0x16')]('/:id',auth[_0xc1aa('0xc')](),controller[_0xc1aa('0x17')]);router['delete'](_0xc1aa('0xf'),auth[_0xc1aa('0xc')](),controller[_0xc1aa('0x18')]);router['delete']('/:id/users',auth[_0xc1aa('0xc')](),controller[_0xc1aa('0x19')]);module[_0xc1aa('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index f839187..159024b 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 _0xe221=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x1ba5c5,_0x2178d9){var _0x28d8a7=function(_0x5cb087){while(--_0x5cb087){_0x1ba5c5['push'](_0x1ba5c5['shift']());}};_0x28d8a7(++_0x2178d9);}(_0xe221,0x133));var _0x1e22=function(_0x58d188,_0xa06a1f){_0x58d188=_0x58d188-0x0;var _0x1fc4a6=_0xe221[_0x58d188];return _0x1fc4a6;};'use strict';var Sequelize=require(_0x1e22('0x0'));module[_0x1e22('0x1')]={'name':{'type':Sequelize[_0x1e22('0x2')],'unique':_0x1e22('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x1e22('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1e22('0x5')](_0x1e22('0x6'),_0x1e22('0x7'),_0x1e22('0x8'))}}; \ No newline at end of file +var _0xad08=['exports','STRING','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x5491e5,_0x37a869){var _0x214eb5=function(_0x13a469){while(--_0x13a469){_0x5491e5['push'](_0x5491e5['shift']());}};_0x214eb5(++_0x37a869);}(_0xad08,0x84));var _0x8ad0=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xad08[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x8ad0('0x0'));module[_0x8ad0('0x1')]={'name':{'type':Sequelize[_0x8ad0('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8ad0('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8ad0('0x3')](_0x8ad0('0x4'),_0x8ad0('0x5'),_0x8ad0('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 7f850ee..b702381 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 _0x1109=['../../config/utils','../../config/environment','../../config/license/util','defaults','socket.io-emitter','redis','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','get','UserMailQueue','UserId','agent','updatedAt','createdAt','%s/%s','SIP','mailPause','getTeams','findOne','Team','pick','addTeams','ids','User','Agents','online','interface','flatMap','sequelize','findOrCreate','forEach','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','includes','all','union','value','transaction','removeAgents','userMailQueue:remove','addAgents','spread','emit','isArray','getAgents','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x2e0405,_0x515e07){var _0x1cded0=function(_0x49c6c6){while(--_0x49c6c6){_0x2e0405['push'](_0x2e0405['shift']());}};_0x1cded0(++_0x515e07);}(_0x1109,0x17d));var _0x9110=function(_0x4b935a,_0x327ee3){_0x4b935a=_0x4b935a-0x0;var _0xa298f0=_0x1109[_0x4b935a];return _0xa298f0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9110('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9110('0x1'));var moment=require('moment');var BPromise=require(_0x9110('0x2'));var Mustache=require(_0x9110('0x3'));var util=require(_0x9110('0x4'));var path=require(_0x9110('0x5'));var sox=require(_0x9110('0x6'));var csv=require(_0x9110('0x7'));var ejs=require(_0x9110('0x8'));var fs=require('fs');var fs_extra=require(_0x9110('0x9'));var _=require(_0x9110('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9110('0xb'));var toCsv=require(_0x9110('0x7'));var querystring=require(_0x9110('0xc'));var Papa=require('papaparse');var Redis=require(_0x9110('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9110('0xe'));var hardwareService=require(_0x9110('0xf'));var logger=require(_0x9110('0x10'))(_0x9110('0x11'));var utils=require(_0x9110('0x12'));var config=require(_0x9110('0x13'));var licenseUtil=require(_0x9110('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x9110('0x15')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9110('0x16'))(new Redis(config[_0x9110('0x17')]));require('./mailQueue.socket')[_0x9110('0x18')](socket);function respondWithStatusCode(_0x4948a7,_0x3b6aa4){_0x3b6aa4=_0x3b6aa4||0xcc;return function(_0x935939){if(_0x935939){return _0x4948a7[_0x9110('0x19')](_0x3b6aa4);}return _0x4948a7[_0x9110('0x1a')](_0x3b6aa4)[_0x9110('0x1b')]();};}function respondWithResult(_0x1234be,_0x58ebd6){_0x58ebd6=_0x58ebd6||0xc8;return function(_0x56d0af){if(_0x56d0af){return _0x1234be[_0x9110('0x1a')](_0x58ebd6)[_0x9110('0x1c')](_0x56d0af);}};}function respondWithFilteredResult(_0x55f739,_0x460f98){return function(_0x11dec4){if(_0x11dec4){var _0x1bcaf2=typeof _0x460f98[_0x9110('0x1d')]===_0x9110('0x1e')&&typeof _0x460f98[_0x9110('0x1f')]===_0x9110('0x1e');var _0x32b89a=_0x11dec4[_0x9110('0x20')];var _0x256c27=_0x1bcaf2?0x0:_0x460f98[_0x9110('0x1d')];var _0x4a8dcc=_0x1bcaf2?_0x11dec4[_0x9110('0x20')]:_0x460f98[_0x9110('0x1d')]+_0x460f98[_0x9110('0x1f')];var _0x1f3ebf;if(_0x4a8dcc>=_0x32b89a){_0x4a8dcc=_0x32b89a;_0x1f3ebf=0xc8;}else{_0x1f3ebf=0xce;}_0x55f739['status'](_0x1f3ebf);return _0x55f739[_0x9110('0x21')]('Content-Range',_0x256c27+'-'+_0x4a8dcc+'/'+_0x32b89a)['json'](_0x11dec4);}return null;};}function patchUpdates(_0x38ea6e){return function(_0x2c98be){try{jsonpatch[_0x9110('0x22')](_0x2c98be,_0x38ea6e,!![]);}catch(_0x296ad0){return BPromise[_0x9110('0x23')](_0x296ad0);}return _0x2c98be[_0x9110('0x24')]();};}function saveUpdates(_0x34903c,_0x2a6f17){return function(_0x10759b){if(_0x10759b){return _0x10759b['update'](_0x34903c)[_0x9110('0x25')](function(_0x472c10){return _0x472c10;});}return null;};}function removeEntity(_0x505daf,_0x410a01){return function(_0x495825){if(_0x495825){return _0x495825[_0x9110('0x26')]()[_0x9110('0x25')](function(){var _0x5ad783=_0x495825['get']({'plain':!![]});var _0x3b0dce='MailQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0x3b0dce,'resourceId':_0x5ad783['id']}})[_0x9110('0x25')](function(){return _0x495825;});})[_0x9110('0x25')](function(){_0x505daf[_0x9110('0x1a')](0xcc)[_0x9110('0x1b')]();});}};}function handleEntityNotFound(_0x207255,_0x5803fc){return function(_0xf0e7fe){if(!_0xf0e7fe){_0x207255[_0x9110('0x19')](0x194);}return _0xf0e7fe;};}function handleError(_0x2be2d4,_0x4da7bc){_0x4da7bc=_0x4da7bc||0x1f4;return function(_0xa51863){logger[_0x9110('0x27')](_0xa51863[_0x9110('0x28')]);if(_0xa51863[_0x9110('0x29')]){delete _0xa51863[_0x9110('0x29')];}_0x2be2d4[_0x9110('0x1a')](_0x4da7bc)[_0x9110('0x2a')](_0xa51863);};}exports[_0x9110('0x2b')]=function(_0x259cfb,_0x3be9f2){var _0x37d90f={},_0x82732c={},_0x3a7f5f={'count':0x0,'rows':[]};var _0x3264ac=_[_0x9110('0x2c')](db[_0x9110('0x2d')][_0x9110('0x2e')],function(_0x320447){return{'name':_0x320447[_0x9110('0x2f')],'type':_0x320447['type']['key']};});_0x82732c[_0x9110('0x30')]=_['map'](_0x3264ac,_0x9110('0x29'));_0x82732c[_0x9110('0x31')]=_[_0x9110('0x32')](_0x259cfb[_0x9110('0x31')]);_0x82732c[_0x9110('0x33')]=_[_0x9110('0x34')](_0x82732c[_0x9110('0x30')],_0x82732c[_0x9110('0x31')]);_0x37d90f[_0x9110('0x35')]=_[_0x9110('0x34')](_0x82732c[_0x9110('0x30')],qs['fields'](_0x259cfb[_0x9110('0x31')]['fields']));_0x37d90f[_0x9110('0x35')]=_0x37d90f[_0x9110('0x35')][_0x9110('0x36')]?_0x37d90f[_0x9110('0x35')]:_0x82732c[_0x9110('0x30')];if(!_0x259cfb[_0x9110('0x31')][_0x9110('0x37')](_0x9110('0x38'))){_0x37d90f[_0x9110('0x1f')]=qs[_0x9110('0x1f')](_0x259cfb[_0x9110('0x31')][_0x9110('0x1f')]);_0x37d90f[_0x9110('0x1d')]=qs['offset'](_0x259cfb['query']['offset']);}_0x37d90f[_0x9110('0x39')]=qs[_0x9110('0x3a')](_0x259cfb[_0x9110('0x31')][_0x9110('0x3a')]);_0x37d90f['where']=qs['filters'](_['pick'](_0x259cfb['query'],_0x82732c['filters']),_0x3264ac);if(_0x259cfb['query'][_0x9110('0x3b')]){_0x37d90f['where']=_[_0x9110('0x3c')](_0x37d90f[_0x9110('0x3d')],{'$or':_['map'](_0x3264ac,function(_0x4e8286){if(_0x4e8286['type']!==_0x9110('0x3e')){var _0x5e643f={};_0x5e643f[_0x4e8286[_0x9110('0x29')]]={'$like':'%'+_0x259cfb[_0x9110('0x31')][_0x9110('0x3b')]+'%'};return _0x5e643f;}})});}_0x37d90f=_[_0x9110('0x3c')]({},_0x37d90f,_0x259cfb[_0x9110('0x3f')]);var _0xe5f7dc={'where':_0x37d90f[_0x9110('0x3d')]};return db[_0x9110('0x2d')][_0x9110('0x20')](_0xe5f7dc)[_0x9110('0x25')](function(_0x42316a){_0x3a7f5f[_0x9110('0x20')]=_0x42316a;if(_0x259cfb[_0x9110('0x31')][_0x9110('0x40')]){_0x37d90f[_0x9110('0x41')]=[{'all':!![]}];}return db[_0x9110('0x2d')][_0x9110('0x42')](_0x37d90f);})['then'](function(_0x55d25f){_0x3a7f5f[_0x9110('0x43')]=_0x55d25f;return _0x3a7f5f;})[_0x9110('0x25')](respondWithFilteredResult(_0x3be9f2,_0x37d90f))[_0x9110('0x44')](handleError(_0x3be9f2,null));};exports[_0x9110('0x45')]=function(_0x584804,_0x164618){var _0x447415={'raw':!![],'where':{'id':_0x584804[_0x9110('0x46')]['id']}},_0x4102f7={};_0x4102f7[_0x9110('0x30')]=_['keys'](db[_0x9110('0x2d')][_0x9110('0x2e')]);_0x4102f7[_0x9110('0x31')]=_['keys'](_0x584804[_0x9110('0x31')]);_0x4102f7[_0x9110('0x33')]=_['intersection'](_0x4102f7[_0x9110('0x30')],_0x4102f7[_0x9110('0x31')]);_0x447415[_0x9110('0x35')]=_[_0x9110('0x34')](_0x4102f7[_0x9110('0x30')],qs[_0x9110('0x47')](_0x584804[_0x9110('0x31')][_0x9110('0x47')]));_0x447415[_0x9110('0x35')]=_0x447415[_0x9110('0x35')][_0x9110('0x36')]?_0x447415[_0x9110('0x35')]:_0x4102f7['model'];if(_0x584804[_0x9110('0x31')][_0x9110('0x40')]){_0x447415[_0x9110('0x41')]=[{'all':!![]}];}_0x447415=_[_0x9110('0x3c')]({},_0x447415,_0x584804[_0x9110('0x3f')]);return db[_0x9110('0x2d')][_0x9110('0x48')](_0x447415)['then'](handleEntityNotFound(_0x164618,null))['then'](respondWithResult(_0x164618,null))[_0x9110('0x44')](handleError(_0x164618,null));};exports['create']=function(_0x353df4,_0x598344){return db[_0x9110('0x2d')][_0x9110('0x49')](_0x353df4['body'],{})[_0x9110('0x25')](function(_0x8c8aa7){var _0x1b4f3c=_0x353df4[_0x9110('0x4a')]['get']({'plain':!![]});if(!_0x1b4f3c)throw new Error(_0x9110('0x4b'));if(_0x1b4f3c[_0x9110('0x4c')]==='user'){var _0x287860=_0x8c8aa7['get']({'plain':!![]});var _0x466899=_0x9110('0x4d');return db[_0x9110('0x4e')][_0x9110('0x48')]({'where':{'name':_0x466899,'userProfileId':_0x1b4f3c[_0x9110('0x4f')]},'raw':!![]})[_0x9110('0x25')](function(_0x48d4df){if(_0x48d4df&&_0x48d4df['autoAssociation']===0x0){return db[_0x9110('0x50')]['create']({'name':_0x287860[_0x9110('0x29')],'resourceId':_0x287860['id'],'type':_0x48d4df['name'],'sectionId':_0x48d4df['id']},{})['then'](function(){return _0x8c8aa7;});}else{return _0x8c8aa7;}})[_0x9110('0x44')](function(_0xb1ebf3){logger['error'](_0x9110('0x51'),_0xb1ebf3);throw _0xb1ebf3;});}return _0x8c8aa7;})[_0x9110('0x25')](respondWithResult(_0x598344,0xc9))[_0x9110('0x44')](handleError(_0x598344,null));};exports[_0x9110('0x52')]=function(_0x214b83,_0x107130){if(_0x214b83['body']['id']){delete _0x214b83[_0x9110('0x53')]['id'];}return db['MailQueue'][_0x9110('0x48')]({'where':{'id':_0x214b83['params']['id']}})[_0x9110('0x25')](handleEntityNotFound(_0x107130,null))['then'](saveUpdates(_0x214b83['body'],null))[_0x9110('0x25')](respondWithResult(_0x107130,null))[_0x9110('0x44')](handleError(_0x107130,null));};exports[_0x9110('0x26')]=function(_0x13b278,_0x53bd45){return db['MailQueue'][_0x9110('0x48')]({'where':{'id':_0x13b278[_0x9110('0x46')]['id']}})['then'](handleEntityNotFound(_0x53bd45,null))['then'](removeEntity(_0x53bd45,null))[_0x9110('0x44')](handleError(_0x53bd45,null));};exports[_0x9110('0x54')]=function(_0x51a4ce,_0x21853e){return db[_0x9110('0x2d')][_0x9110('0x54')]()['then'](respondWithResult(_0x21853e,null))[_0x9110('0x44')](handleError(_0x21853e,null));};exports['getMembers']=function(_0x20d612,_0x138043,_0x1aa967){var _0x2ccdde={'raw':!![],'where':{}},_0x15f29e={},_0x5e3213;return db[_0x9110('0x2d')]['findOne']({'where':{'id':_0x20d612['params']['id']}})[_0x9110('0x25')](handleEntityNotFound(_0x138043,null))[_0x9110('0x25')](function(_0x55fb48){if(_0x55fb48){_0x5e3213=_0x55fb48[_0x9110('0x55')]({'plain':!![]});_0x15f29e[_0x9110('0x30')]=_['keys'](db[_0x9110('0x56')][_0x9110('0x2e')]);_0x15f29e[_0x9110('0x31')]=_[_0x9110('0x32')](_0x20d612[_0x9110('0x31')]);_0x15f29e[_0x9110('0x33')]=_[_0x9110('0x34')](_0x15f29e[_0x9110('0x30')],_0x15f29e['query']);_0x2ccdde['attributes']=_[_0x9110('0x34')](_0x15f29e['model'],qs['fields'](_0x20d612[_0x9110('0x31')][_0x9110('0x47')]));_0x2ccdde[_0x9110('0x35')]=_0x2ccdde[_0x9110('0x35')]['length']?_0x2ccdde[_0x9110('0x35')]:_0x15f29e[_0x9110('0x30')];if(!_0x20d612[_0x9110('0x31')][_0x9110('0x37')](_0x9110('0x38'))){_0x2ccdde[_0x9110('0x1f')]=qs[_0x9110('0x1f')](_0x20d612[_0x9110('0x31')]['limit']);_0x2ccdde['offset']=qs[_0x9110('0x1d')](_0x20d612[_0x9110('0x31')][_0x9110('0x1d')]);}_0x2ccdde['order']=qs[_0x9110('0x3a')](_0x20d612[_0x9110('0x31')][_0x9110('0x3a')]);_0x2ccdde['where']=qs[_0x9110('0x33')](_['pick'](_0x20d612[_0x9110('0x31')],_0x15f29e[_0x9110('0x33')]));_0x2ccdde[_0x9110('0x3d')]['MailQueueId']=_0x55fb48['id'];if(_0x20d612['query'][_0x9110('0x3b')]){_0x2ccdde['where']=_['merge'](_0x2ccdde['where'],{'$or':_[_0x9110('0x2c')](_0x2ccdde['attributes'],function(_0x19aca1){var _0x4443db={};_0x4443db[_0x19aca1]={'$like':'%'+_0x20d612[_0x9110('0x31')][_0x9110('0x3b')]+'%'};return _0x4443db;})});}_0x2ccdde=_[_0x9110('0x3c')]({},_0x2ccdde,_0x20d612[_0x9110('0x3f')]);return db[_0x9110('0x56')][_0x9110('0x42')](_0x2ccdde);}})[_0x9110('0x25')](function(_0x541a6e){if(_0x541a6e){return db['User']['findAndCountAll']({'where':{'id':_[_0x9110('0x2c')](_0x541a6e,_0x9110('0x57')),'role':_0x9110('0x58')},'attributes':['id',_0x9110('0x29'),'mailPause',_0x9110('0x59'),_0x9110('0x5a')]});}})['then'](function(_0x9aba81){if(_0x9aba81){return{'count':_0x9aba81[_0x9110('0x20')],'rows':_[_0x9110('0x2c')](_0x9aba81[_0x9110('0x43')],function(_0x31db6a){return{'membername':_0x31db6a['name'],'UserId':_0x31db6a['id'],'queue_name':_0x5e3213[_0x9110('0x29')],'MailQueueId':_0x5e3213['id'],'interface':util['format'](_0x9110('0x5b'),_0x9110('0x5c'),_0x31db6a[_0x9110('0x29')]),'penalty':0x0,'paused':_0x31db6a[_0x9110('0x5d')],'createdAt':_0x31db6a['createdAt'],'updatedAt':_0x31db6a[_0x9110('0x59')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9110('0x25')](respondWithFilteredResult(_0x138043,_0x2ccdde))[_0x9110('0x44')](handleError(_0x138043,null));};exports[_0x9110('0x5e')]=function(_0x5bcac5,_0x213831,_0x501b1e){var _0x29b263={};var _0x5b9733={};var _0x141628;var _0x1a1968;return db[_0x9110('0x2d')][_0x9110('0x5f')]({'where':{'id':_0x5bcac5[_0x9110('0x46')]['id']}})[_0x9110('0x25')](handleEntityNotFound(_0x213831,null))[_0x9110('0x25')](function(_0x5edf85){if(_0x5edf85){_0x141628=_0x5edf85;_0x5b9733[_0x9110('0x30')]=_[_0x9110('0x32')](db[_0x9110('0x60')]['rawAttributes']);_0x5b9733[_0x9110('0x31')]=_[_0x9110('0x32')](_0x5bcac5[_0x9110('0x31')]);_0x5b9733[_0x9110('0x33')]=_[_0x9110('0x34')](_0x5b9733[_0x9110('0x30')],_0x5b9733[_0x9110('0x31')]);_0x29b263[_0x9110('0x35')]=_[_0x9110('0x34')](_0x5b9733[_0x9110('0x30')],qs[_0x9110('0x47')](_0x5bcac5[_0x9110('0x31')][_0x9110('0x47')]));_0x29b263[_0x9110('0x35')]=_0x29b263[_0x9110('0x35')][_0x9110('0x36')]?_0x29b263[_0x9110('0x35')]:_0x5b9733[_0x9110('0x30')];_0x29b263['order']=qs[_0x9110('0x3a')](_0x5bcac5[_0x9110('0x31')]['sort']);_0x29b263['where']=qs[_0x9110('0x33')](_[_0x9110('0x61')](_0x5bcac5[_0x9110('0x31')],_0x5b9733[_0x9110('0x33')]));if(_0x5bcac5['query']['filter']){_0x29b263[_0x9110('0x3d')]=_['merge'](_0x29b263[_0x9110('0x3d')],{'$or':_[_0x9110('0x2c')](_0x29b263[_0x9110('0x35')],function(_0xf63202){var _0x1670b0={};_0x1670b0[_0xf63202]={'$like':'%'+_0x5bcac5[_0x9110('0x31')][_0x9110('0x3b')]+'%'};return _0x1670b0;})});}_0x29b263=_[_0x9110('0x3c')]({},_0x29b263,_0x5bcac5[_0x9110('0x3f')]);return _0x141628['getTeams'](_0x29b263);}})['then'](function(_0x11181d){if(_0x11181d){_0x1a1968=_0x11181d[_0x9110('0x36')];if(!_0x5bcac5[_0x9110('0x31')]['hasOwnProperty']('nolimit')){_0x29b263[_0x9110('0x1f')]=qs[_0x9110('0x1f')](_0x5bcac5[_0x9110('0x31')][_0x9110('0x1f')]);_0x29b263['offset']=qs[_0x9110('0x1d')](_0x5bcac5[_0x9110('0x31')]['offset']);}return _0x141628[_0x9110('0x5e')](_0x29b263);}})['then'](function(_0x170ed4){if(_0x170ed4){return _0x170ed4?{'count':_0x1a1968,'rows':_0x170ed4}:null;}})[_0x9110('0x25')](respondWithResult(_0x213831,null))[_0x9110('0x44')](handleError(_0x213831,null));};exports[_0x9110('0x62')]=function(_0x31277c,_0x3dbe1,_0x10c41e){var _0x293713=_0x31277c[_0x9110('0x53')][_0x9110('0x63')];return db[_0x9110('0x60')][_0x9110('0x42')]({'where':{'id':_0x293713},'attributes':['id'],'include':[{'model':db[_0x9110('0x64')],'as':_0x9110('0x65'),'attributes':['id','name',_0x9110('0x66'),'voicePause',_0x9110('0x67')],'raw':!![]}]})[_0x9110('0x25')](function(_0x2f2b40){if(_0x2f2b40){var _0x25a7fb=_[_0x9110('0x68')](_0x2f2b40,function(_0x3b7db5){var _0x537480=_0x3b7db5[_0x9110('0x55')]({'plain':!![]});return _0x537480[_0x9110('0x65')];});return db[_0x9110('0x2d')][_0x9110('0x48')]({'where':{'id':_0x31277c[_0x9110('0x46')]['id']}})['then'](function(_0x2452e7){return db[_0x9110('0x69')]['transaction'](function(_0x3a9ce4){return _0x2452e7['addTeams'](_0x293713,{'transaction':_0x3a9ce4})[_0x9110('0x25')](function(){return BPromise['each'](_0x25a7fb,function(_0x2e1cd4){return db[_0x9110('0x56')][_0x9110('0x6a')]({'where':{'UserId':_0x2e1cd4['id'],'MailQueueId':_0x31277c['params']['id']},'transaction':_0x3a9ce4});});})[_0x9110('0x25')](function(){_0x25a7fb[_0x9110('0x6b')](function(_0x1a36ad){socket['emit'](_0x9110('0x6c'),{'UserId':_0x1a36ad['id'],'MailQueueId':_0x2452e7['id']});});});});});}})[_0x9110('0x25')](respondWithStatusCode(_0x3dbe1,null))[_0x9110('0x44')](handleError(_0x3dbe1,null));};exports[_0x9110('0x6d')]=function(_0x1657ab,_0x5edc51,_0x46c623){return db[_0x9110('0x60')][_0x9110('0x42')]({'where':{'id':_0x1657ab[_0x9110('0x31')][_0x9110('0x63')]},'attributes':['id'],'include':[{'model':db[_0x9110('0x64')],'as':_0x9110('0x65'),'attributes':['id'],'raw':!![]}]})[_0x9110('0x25')](handleEntityNotFound(_0x5edc51,null))['then'](function(_0x5d9f61){var _0x17ef60=_['map'](_0x5d9f61,'id');var _0x44e3f2=[];var _0x338ad2=[];var _0x4f7cdd=squel[_0x9110('0x6e')]();_0x4f7cdd[_0x9110('0x6f')](_0x9110('0x70'))[_0x9110('0x71')](_0x9110('0x72'),'tq')['join'](_0x9110('0x73'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x9110('0x3d')]('MailQueueId\x20=\x20?',_0x1657ab['params']['id']);for(var _0x3f4bff=0x0;_0x3f4bff<_0x5d9f61[_0x9110('0x36')];_0x3f4bff+=0x1){let _0x14e2ce=_0x5d9f61[_0x3f4bff];for(var _0x38ac56=0x0;_0x38ac56<_0x14e2ce[_0x9110('0x65')][_0x9110('0x36')];_0x38ac56+=0x1){let _0x19115b=_0x14e2ce[_0x9110('0x65')][_0x38ac56];var _0x461f37=_0x4f7cdd[_0x9110('0x74')]();_0x461f37[_0x9110('0x3d')](_0x9110('0x75'),_0x19115b['id']);_0x338ad2[_0x9110('0x76')](db['sequelize'][_0x9110('0x31')](_0x461f37[_0x9110('0x77')](),{'type':db[_0x9110('0x69')][_0x9110('0x78')]['SELECT']})[_0x9110('0x25')](function(_0xde12e0){if(_0xde12e0[_0x9110('0x36')]===0x1){return _0x19115b['id'];}else{var _0x5970ba=_['every'](_['map'](_0xde12e0,'TeamId'),function(_0x25b0b8){return _[_0x9110('0x79')](_0x17ef60,_0x25b0b8);});if(_0x5970ba){return _0x19115b['id'];}}}));}}return BPromise[_0x9110('0x7a')](_0x338ad2)[_0x9110('0x25')](function(_0x410644){_0x44e3f2=_(_0x44e3f2)[_0x9110('0x7b')](_0x410644)['compact']()[_0x9110('0x7c')]();return db[_0x9110('0x2d')][_0x9110('0x48')]({'where':{'id':_0x1657ab[_0x9110('0x46')]['id']}})[_0x9110('0x25')](function(_0x5ef7bc){return db[_0x9110('0x69')][_0x9110('0x7d')](function(_0x9b3173){return _0x5ef7bc[_0x9110('0x6d')](_0x1657ab['query'][_0x9110('0x63')],{'transaction':_0x9b3173})[_0x9110('0x25')](function(){if(!_['isEmpty'](_0x44e3f2)){return _0x5ef7bc[_0x9110('0x7e')](_0x44e3f2,{'transaction':_0x9b3173});}})[_0x9110('0x25')](function(){_0x44e3f2[_0x9110('0x6b')](function(_0x197d12){socket['emit'](_0x9110('0x7f'),{'UserId':_0x197d12,'MailQueueId':_0x5ef7bc['id']});});});});});});})[_0x9110('0x25')](respondWithStatusCode(_0x5edc51,null))[_0x9110('0x44')](handleError(_0x5edc51,null));};exports[_0x9110('0x80')]=function(_0x43fdcb,_0x599c6f,_0x52aaec){return db[_0x9110('0x2d')][_0x9110('0x48')]({'where':{'id':_0x43fdcb[_0x9110('0x46')]['id']}})['then'](handleEntityNotFound(_0x599c6f,null))[_0x9110('0x25')](function(_0x5a1e12){if(_0x5a1e12){return _0x5a1e12[_0x9110('0x80')](_0x43fdcb[_0x9110('0x53')]['ids'],_['omit'](_0x43fdcb[_0x9110('0x53')],[_0x9110('0x63'),'id'])||{})[_0x9110('0x81')](function(_0x277feb){for(var _0x2c52b9=0x0;_0x2c52b9<_0x43fdcb[_0x9110('0x53')][_0x9110('0x63')][_0x9110('0x36')];_0x2c52b9+=0x1){socket[_0x9110('0x82')](_0x9110('0x6c'),{'UserId':Number(_0x43fdcb[_0x9110('0x53')][_0x9110('0x63')][_0x2c52b9]),'MailQueueId':Number(_0x43fdcb[_0x9110('0x46')]['id'])});}return _0x277feb;});}})['then'](respondWithResult(_0x599c6f,null))[_0x9110('0x44')](handleError(_0x599c6f,null));};exports[_0x9110('0x7e')]=function(_0x55dcc9,_0x11935c,_0x2bc411){return db['MailQueue']['find']({'where':{'id':_0x55dcc9[_0x9110('0x46')]['id']}})[_0x9110('0x25')](handleEntityNotFound(_0x11935c,null))[_0x9110('0x25')](function(_0x145b25){if(_0x145b25){return _0x145b25[_0x9110('0x7e')](_0x55dcc9[_0x9110('0x31')][_0x9110('0x63')])[_0x9110('0x25')](function(){if(_[_0x9110('0x83')](_0x55dcc9[_0x9110('0x31')]['ids'])){for(var _0x2bd192=0x0;_0x2bd192<_0x55dcc9['query'][_0x9110('0x63')][_0x9110('0x36')];_0x2bd192+=0x1){socket[_0x9110('0x82')]('userMailQueue:remove',{'UserId':Number(_0x55dcc9['query']['ids'][_0x2bd192]),'MailQueueId':Number(_0x55dcc9[_0x9110('0x46')]['id'])});}}else{socket[_0x9110('0x82')](_0x9110('0x7f'),{'UserId':Number(_0x55dcc9[_0x9110('0x31')][_0x9110('0x63')]),'MailQueueId':Number(_0x55dcc9[_0x9110('0x46')]['id'])});}});}})['then'](respondWithStatusCode(_0x11935c,null))['catch'](handleError(_0x11935c,null));};exports[_0x9110('0x84')]=function(_0x3417eb,_0x4c580c,_0xf335a0){var _0x58abb1={};var _0xd82c4b={};var _0x4c8232;var _0xa4e179;return db[_0x9110('0x2d')]['findOne']({'where':{'id':_0x3417eb[_0x9110('0x46')]['id']}})[_0x9110('0x25')](handleEntityNotFound(_0x4c580c,null))[_0x9110('0x25')](function(_0x439a90){if(_0x439a90){_0x4c8232=_0x439a90;_0xd82c4b[_0x9110('0x30')]=_[_0x9110('0x32')](db['User'][_0x9110('0x2e')]);_0xd82c4b[_0x9110('0x31')]=_[_0x9110('0x32')](_0x3417eb[_0x9110('0x31')]);_0xd82c4b[_0x9110('0x33')]=_[_0x9110('0x34')](_0xd82c4b['model'],_0xd82c4b[_0x9110('0x31')]);_0x58abb1['attributes']=_[_0x9110('0x34')](_0xd82c4b[_0x9110('0x30')],qs['fields'](_0x3417eb['query'][_0x9110('0x47')]));_0x58abb1[_0x9110('0x35')]=_0x58abb1[_0x9110('0x35')]['length']?_0x58abb1[_0x9110('0x35')]:_0xd82c4b[_0x9110('0x30')];_0x58abb1[_0x9110('0x39')]=qs[_0x9110('0x3a')](_0x3417eb[_0x9110('0x31')][_0x9110('0x3a')]);_0x58abb1[_0x9110('0x3d')]=qs[_0x9110('0x33')](_[_0x9110('0x61')](_0x3417eb[_0x9110('0x31')],_0xd82c4b[_0x9110('0x33')]));if(_0x3417eb[_0x9110('0x31')][_0x9110('0x3b')]){_0x58abb1[_0x9110('0x3d')]=_['merge'](_0x58abb1[_0x9110('0x3d')],{'$or':_[_0x9110('0x2c')](_0x58abb1[_0x9110('0x35')],function(_0x31d59f){var _0x56ede3={};_0x56ede3[_0x31d59f]={'$like':'%'+_0x3417eb[_0x9110('0x31')][_0x9110('0x3b')]+'%'};return _0x56ede3;})});}_0x58abb1=_[_0x9110('0x3c')]({},_0x58abb1,_0x3417eb[_0x9110('0x3f')]);return _0x4c8232[_0x9110('0x84')](_0x58abb1);}})['then'](function(_0x525397){if(_0x525397){_0xa4e179=_0x525397['length'];if(!_0x3417eb[_0x9110('0x31')][_0x9110('0x37')](_0x9110('0x38'))){_0x58abb1[_0x9110('0x1f')]=qs['limit'](_0x3417eb['query'][_0x9110('0x1f')]);_0x58abb1[_0x9110('0x1d')]=qs[_0x9110('0x1d')](_0x3417eb['query'][_0x9110('0x1d')]);}return _0x4c8232[_0x9110('0x84')](_0x58abb1);}})[_0x9110('0x25')](function(_0x866936){if(_0x866936){return _0x866936?{'count':_0xa4e179,'rows':_0x866936}:null;}})[_0x9110('0x25')](respondWithResult(_0x4c580c,null))[_0x9110('0x44')](handleError(_0x4c580c,null));}; \ No newline at end of file +var _0x8c4a=['forEach','emit','userMailQueue:save','removeTeams','User','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','spread','isArray','userMailQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','update','then','destroy','get','stack','name','index','map','MailQueue','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','length','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','UserMailQueue','pick','MailQueueId','findAndCountAll','UserId','agent','mailPause','updatedAt','format','SIP','createdAt','getTeams','Team','addTeams','ids','online','voicePause','interface','flatMap','Agents','findOrCreate'];(function(_0x459847,_0x81d5ce){var _0x424130=function(_0x1328a7){while(--_0x1328a7){_0x459847['push'](_0x459847['shift']());}};_0x424130(++_0x81d5ce);}(_0x8c4a,0xb0));var _0xa8c4=function(_0x46c948,_0x1bafa1){_0x46c948=_0x46c948-0x0;var _0x2522ea=_0x8c4a[_0x46c948];return _0x2522ea;};'use strict';var emlformat=require(_0xa8c4('0x0'));var rimraf=require(_0xa8c4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa8c4('0x2'));var rp=require('request-promise');var moment=require(_0xa8c4('0x3'));var BPromise=require(_0xa8c4('0x4'));var Mustache=require(_0xa8c4('0x5'));var util=require(_0xa8c4('0x6'));var path=require(_0xa8c4('0x7'));var sox=require(_0xa8c4('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa8c4('0x9'));var _=require(_0xa8c4('0xa'));var squel=require(_0xa8c4('0xb'));var crypto=require(_0xa8c4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa8c4('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa8c4('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa8c4('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa8c4('0x10'));var hardwareService=require(_0xa8c4('0x11'));var logger=require(_0xa8c4('0x12'))(_0xa8c4('0x13'));var utils=require(_0xa8c4('0x14'));var config=require(_0xa8c4('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa8c4('0x16'))['db'];config['redis']=_['defaults'](config[_0xa8c4('0x17')],{'host':_0xa8c4('0x18'),'port':0x18eb});var socket=require(_0xa8c4('0x19'))(new Redis(config[_0xa8c4('0x17')]));require(_0xa8c4('0x1a'))[_0xa8c4('0x1b')](socket);function respondWithStatusCode(_0x3a9f54,_0x1fb118){_0x1fb118=_0x1fb118||0xcc;return function(_0x1e764c){if(_0x1e764c){return _0x3a9f54[_0xa8c4('0x1c')](_0x1fb118);}return _0x3a9f54[_0xa8c4('0x1d')](_0x1fb118)[_0xa8c4('0x1e')]();};}function respondWithResult(_0x2e7c0b,_0x32d379){_0x32d379=_0x32d379||0xc8;return function(_0x256412){if(_0x256412){return _0x2e7c0b['status'](_0x32d379)[_0xa8c4('0x1f')](_0x256412);}};}function respondWithFilteredResult(_0x27543a,_0x3c09e1){return function(_0x1ee1bb){if(_0x1ee1bb){var _0x3557ae=typeof _0x3c09e1[_0xa8c4('0x20')]==='undefined'&&typeof _0x3c09e1[_0xa8c4('0x21')]===_0xa8c4('0x22');var _0x57dd85=_0x1ee1bb['count'];var _0x1c7aaa=_0x3557ae?0x0:_0x3c09e1[_0xa8c4('0x20')];var _0x2a4f14=_0x3557ae?_0x1ee1bb[_0xa8c4('0x23')]:_0x3c09e1[_0xa8c4('0x20')]+_0x3c09e1[_0xa8c4('0x21')];var _0x42609e;if(_0x2a4f14>=_0x57dd85){_0x2a4f14=_0x57dd85;_0x42609e=0xc8;}else{_0x42609e=0xce;}_0x27543a[_0xa8c4('0x1d')](_0x42609e);return _0x27543a[_0xa8c4('0x24')](_0xa8c4('0x25'),_0x1c7aaa+'-'+_0x2a4f14+'/'+_0x57dd85)[_0xa8c4('0x1f')](_0x1ee1bb);}return null;};}function patchUpdates(_0x32161d){return function(_0xf204dc){try{jsonpatch['apply'](_0xf204dc,_0x32161d,!![]);}catch(_0x313eda){return BPromise['reject'](_0x313eda);}return _0xf204dc[_0xa8c4('0x26')]();};}function saveUpdates(_0x1125e5,_0x2dceaa){return function(_0x2dcc2f){if(_0x2dcc2f){return _0x2dcc2f[_0xa8c4('0x27')](_0x1125e5)[_0xa8c4('0x28')](function(_0x288d79){return _0x288d79;});}return null;};}function removeEntity(_0x9522bd,_0x12779c){return function(_0xc02d90){if(_0xc02d90){return _0xc02d90[_0xa8c4('0x29')]()[_0xa8c4('0x28')](function(){var _0x530c6b=_0xc02d90[_0xa8c4('0x2a')]({'plain':!![]});var _0x113c03='MailQueues';return db['UserProfileResource'][_0xa8c4('0x29')]({'where':{'type':_0x113c03,'resourceId':_0x530c6b['id']}})[_0xa8c4('0x28')](function(){return _0xc02d90;});})[_0xa8c4('0x28')](function(){_0x9522bd[_0xa8c4('0x1d')](0xcc)[_0xa8c4('0x1e')]();});}};}function handleEntityNotFound(_0x755c52,_0xd2b2f){return function(_0x34da82){if(!_0x34da82){_0x755c52[_0xa8c4('0x1c')](0x194);}return _0x34da82;};}function handleError(_0x41e67d,_0x3726c7){_0x3726c7=_0x3726c7||0x1f4;return function(_0x5ba4fb){logger['error'](_0x5ba4fb[_0xa8c4('0x2b')]);if(_0x5ba4fb[_0xa8c4('0x2c')]){delete _0x5ba4fb['name'];}_0x41e67d[_0xa8c4('0x1d')](_0x3726c7)['send'](_0x5ba4fb);};}exports[_0xa8c4('0x2d')]=function(_0x10b16f,_0x5048ef){var _0x46dfea={},_0x14cda8={},_0x594bca={'count':0x0,'rows':[]};var _0x212fe1=_[_0xa8c4('0x2e')](db[_0xa8c4('0x2f')][_0xa8c4('0x30')],function(_0x30761a){return{'name':_0x30761a['fieldName'],'type':_0x30761a['type'][_0xa8c4('0x31')]};});_0x14cda8[_0xa8c4('0x32')]=_[_0xa8c4('0x2e')](_0x212fe1,_0xa8c4('0x2c'));_0x14cda8[_0xa8c4('0x33')]=_[_0xa8c4('0x34')](_0x10b16f[_0xa8c4('0x33')]);_0x14cda8[_0xa8c4('0x35')]=_[_0xa8c4('0x36')](_0x14cda8[_0xa8c4('0x32')],_0x14cda8[_0xa8c4('0x33')]);_0x46dfea['attributes']=_[_0xa8c4('0x36')](_0x14cda8[_0xa8c4('0x32')],qs[_0xa8c4('0x37')](_0x10b16f[_0xa8c4('0x33')][_0xa8c4('0x37')]));_0x46dfea[_0xa8c4('0x38')]=_0x46dfea[_0xa8c4('0x38')]['length']?_0x46dfea[_0xa8c4('0x38')]:_0x14cda8['model'];if(!_0x10b16f['query'][_0xa8c4('0x39')](_0xa8c4('0x3a'))){_0x46dfea[_0xa8c4('0x21')]=qs[_0xa8c4('0x21')](_0x10b16f['query'][_0xa8c4('0x21')]);_0x46dfea[_0xa8c4('0x20')]=qs['offset'](_0x10b16f[_0xa8c4('0x33')][_0xa8c4('0x20')]);}_0x46dfea[_0xa8c4('0x3b')]=qs[_0xa8c4('0x3c')](_0x10b16f[_0xa8c4('0x33')]['sort']);_0x46dfea['where']=qs['filters'](_['pick'](_0x10b16f['query'],_0x14cda8['filters']),_0x212fe1);if(_0x10b16f[_0xa8c4('0x33')]['filter']){_0x46dfea[_0xa8c4('0x3d')]=_['merge'](_0x46dfea[_0xa8c4('0x3d')],{'$or':_[_0xa8c4('0x2e')](_0x212fe1,function(_0x2ac2b3){if(_0x2ac2b3[_0xa8c4('0x3e')]!==_0xa8c4('0x3f')){var _0x38f0e7={};_0x38f0e7[_0x2ac2b3[_0xa8c4('0x2c')]]={'$like':'%'+_0x10b16f[_0xa8c4('0x33')][_0xa8c4('0x40')]+'%'};return _0x38f0e7;}})});}_0x46dfea=_[_0xa8c4('0x41')]({},_0x46dfea,_0x10b16f[_0xa8c4('0x42')]);var _0xb901f2={'where':_0x46dfea[_0xa8c4('0x3d')]};return db[_0xa8c4('0x2f')][_0xa8c4('0x23')](_0xb901f2)['then'](function(_0x3f79e0){_0x594bca['count']=_0x3f79e0;if(_0x10b16f['query'][_0xa8c4('0x43')]){_0x46dfea['include']=[{'all':!![]}];}return db[_0xa8c4('0x2f')][_0xa8c4('0x44')](_0x46dfea);})['then'](function(_0x5d6c94){_0x594bca[_0xa8c4('0x45')]=_0x5d6c94;return _0x594bca;})[_0xa8c4('0x28')](respondWithFilteredResult(_0x5048ef,_0x46dfea))[_0xa8c4('0x46')](handleError(_0x5048ef,null));};exports[_0xa8c4('0x47')]=function(_0x4bbff1,_0x5ec9a6){var _0x301a58={'raw':!![],'where':{'id':_0x4bbff1['params']['id']}},_0x45ed56={};_0x45ed56[_0xa8c4('0x32')]=_[_0xa8c4('0x34')](db[_0xa8c4('0x2f')][_0xa8c4('0x30')]);_0x45ed56['query']=_['keys'](_0x4bbff1[_0xa8c4('0x33')]);_0x45ed56[_0xa8c4('0x35')]=_[_0xa8c4('0x36')](_0x45ed56['model'],_0x45ed56[_0xa8c4('0x33')]);_0x301a58[_0xa8c4('0x38')]=_['intersection'](_0x45ed56[_0xa8c4('0x32')],qs[_0xa8c4('0x37')](_0x4bbff1[_0xa8c4('0x33')][_0xa8c4('0x37')]));_0x301a58[_0xa8c4('0x38')]=_0x301a58[_0xa8c4('0x38')][_0xa8c4('0x48')]?_0x301a58['attributes']:_0x45ed56[_0xa8c4('0x32')];if(_0x4bbff1[_0xa8c4('0x33')]['includeAll']){_0x301a58[_0xa8c4('0x49')]=[{'all':!![]}];}_0x301a58=_[_0xa8c4('0x41')]({},_0x301a58,_0x4bbff1['options']);return db['MailQueue'][_0xa8c4('0x4a')](_0x301a58)[_0xa8c4('0x28')](handleEntityNotFound(_0x5ec9a6,null))[_0xa8c4('0x28')](respondWithResult(_0x5ec9a6,null))['catch'](handleError(_0x5ec9a6,null));};exports[_0xa8c4('0x4b')]=function(_0x13b598,_0x4d1048){return db[_0xa8c4('0x2f')][_0xa8c4('0x4b')](_0x13b598['body'],{})[_0xa8c4('0x28')](function(_0x3eeec7){var _0x4e7523=_0x13b598[_0xa8c4('0x4c')][_0xa8c4('0x2a')]({'plain':!![]});if(!_0x4e7523)throw new Error(_0xa8c4('0x4d'));if(_0x4e7523[_0xa8c4('0x4e')]==='user'){var _0x47b4e5=_0x3eeec7['get']({'plain':!![]});var _0x206330=_0xa8c4('0x4f');return db[_0xa8c4('0x50')][_0xa8c4('0x4a')]({'where':{'name':_0x206330,'userProfileId':_0x4e7523[_0xa8c4('0x51')]},'raw':!![]})[_0xa8c4('0x28')](function(_0x15cf63){if(_0x15cf63&&_0x15cf63[_0xa8c4('0x52')]===0x0){return db[_0xa8c4('0x53')][_0xa8c4('0x4b')]({'name':_0x47b4e5[_0xa8c4('0x2c')],'resourceId':_0x47b4e5['id'],'type':_0x15cf63[_0xa8c4('0x2c')],'sectionId':_0x15cf63['id']},{})[_0xa8c4('0x28')](function(){return _0x3eeec7;});}else{return _0x3eeec7;}})[_0xa8c4('0x46')](function(_0x45454f){logger[_0xa8c4('0x54')](_0xa8c4('0x55'),_0x45454f);throw _0x45454f;});}return _0x3eeec7;})[_0xa8c4('0x28')](respondWithResult(_0x4d1048,0xc9))[_0xa8c4('0x46')](handleError(_0x4d1048,null));};exports['update']=function(_0x318a62,_0x559cfa){if(_0x318a62[_0xa8c4('0x56')]['id']){delete _0x318a62[_0xa8c4('0x56')]['id'];}return db[_0xa8c4('0x2f')][_0xa8c4('0x4a')]({'where':{'id':_0x318a62[_0xa8c4('0x57')]['id']}})['then'](handleEntityNotFound(_0x559cfa,null))[_0xa8c4('0x28')](saveUpdates(_0x318a62[_0xa8c4('0x56')],null))[_0xa8c4('0x28')](respondWithResult(_0x559cfa,null))[_0xa8c4('0x46')](handleError(_0x559cfa,null));};exports[_0xa8c4('0x29')]=function(_0x14944d,_0x437645){return db[_0xa8c4('0x2f')][_0xa8c4('0x4a')]({'where':{'id':_0x14944d[_0xa8c4('0x57')]['id']}})[_0xa8c4('0x28')](handleEntityNotFound(_0x437645,null))[_0xa8c4('0x28')](removeEntity(_0x437645,null))[_0xa8c4('0x46')](handleError(_0x437645,null));};exports[_0xa8c4('0x58')]=function(_0x12868c,_0x2df253){return db[_0xa8c4('0x2f')][_0xa8c4('0x58')]()[_0xa8c4('0x28')](respondWithResult(_0x2df253,null))['catch'](handleError(_0x2df253,null));};exports[_0xa8c4('0x59')]=function(_0x26a281,_0x58a6a1,_0xe9e0ca){var _0x22c8e4={'raw':!![],'where':{}},_0x5186a8={},_0x847279;return db[_0xa8c4('0x2f')][_0xa8c4('0x5a')]({'where':{'id':_0x26a281[_0xa8c4('0x57')]['id']}})[_0xa8c4('0x28')](handleEntityNotFound(_0x58a6a1,null))[_0xa8c4('0x28')](function(_0x526f28){if(_0x526f28){_0x847279=_0x526f28[_0xa8c4('0x2a')]({'plain':!![]});_0x5186a8[_0xa8c4('0x32')]=_[_0xa8c4('0x34')](db[_0xa8c4('0x5b')][_0xa8c4('0x30')]);_0x5186a8[_0xa8c4('0x33')]=_[_0xa8c4('0x34')](_0x26a281[_0xa8c4('0x33')]);_0x5186a8['filters']=_[_0xa8c4('0x36')](_0x5186a8[_0xa8c4('0x32')],_0x5186a8[_0xa8c4('0x33')]);_0x22c8e4['attributes']=_[_0xa8c4('0x36')](_0x5186a8['model'],qs['fields'](_0x26a281[_0xa8c4('0x33')]['fields']));_0x22c8e4['attributes']=_0x22c8e4[_0xa8c4('0x38')]['length']?_0x22c8e4[_0xa8c4('0x38')]:_0x5186a8[_0xa8c4('0x32')];if(!_0x26a281['query']['hasOwnProperty'](_0xa8c4('0x3a'))){_0x22c8e4[_0xa8c4('0x21')]=qs[_0xa8c4('0x21')](_0x26a281['query']['limit']);_0x22c8e4['offset']=qs[_0xa8c4('0x20')](_0x26a281[_0xa8c4('0x33')]['offset']);}_0x22c8e4[_0xa8c4('0x3b')]=qs[_0xa8c4('0x3c')](_0x26a281[_0xa8c4('0x33')][_0xa8c4('0x3c')]);_0x22c8e4[_0xa8c4('0x3d')]=qs[_0xa8c4('0x35')](_[_0xa8c4('0x5c')](_0x26a281[_0xa8c4('0x33')],_0x5186a8['filters']));_0x22c8e4[_0xa8c4('0x3d')][_0xa8c4('0x5d')]=_0x526f28['id'];if(_0x26a281[_0xa8c4('0x33')]['filter']){_0x22c8e4[_0xa8c4('0x3d')]=_[_0xa8c4('0x41')](_0x22c8e4[_0xa8c4('0x3d')],{'$or':_[_0xa8c4('0x2e')](_0x22c8e4[_0xa8c4('0x38')],function(_0x4028ac){var _0x28053b={};_0x28053b[_0x4028ac]={'$like':'%'+_0x26a281['query'][_0xa8c4('0x40')]+'%'};return _0x28053b;})});}_0x22c8e4=_[_0xa8c4('0x41')]({},_0x22c8e4,_0x26a281[_0xa8c4('0x42')]);return db[_0xa8c4('0x5b')][_0xa8c4('0x44')](_0x22c8e4);}})[_0xa8c4('0x28')](function(_0x2ca7fa){if(_0x2ca7fa){return db['User'][_0xa8c4('0x5e')]({'where':{'id':_['map'](_0x2ca7fa,_0xa8c4('0x5f')),'role':_0xa8c4('0x60')},'attributes':['id',_0xa8c4('0x2c'),_0xa8c4('0x61'),_0xa8c4('0x62'),'createdAt']});}})[_0xa8c4('0x28')](function(_0x45f543){if(_0x45f543){return{'count':_0x45f543[_0xa8c4('0x23')],'rows':_[_0xa8c4('0x2e')](_0x45f543[_0xa8c4('0x45')],function(_0x344e55){return{'membername':_0x344e55[_0xa8c4('0x2c')],'UserId':_0x344e55['id'],'queue_name':_0x847279[_0xa8c4('0x2c')],'MailQueueId':_0x847279['id'],'interface':util[_0xa8c4('0x63')]('%s/%s',_0xa8c4('0x64'),_0x344e55[_0xa8c4('0x2c')]),'penalty':0x0,'paused':_0x344e55['mailPause'],'createdAt':_0x344e55[_0xa8c4('0x65')],'updatedAt':_0x344e55['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xa8c4('0x28')](respondWithFilteredResult(_0x58a6a1,_0x22c8e4))['catch'](handleError(_0x58a6a1,null));};exports[_0xa8c4('0x66')]=function(_0xa3c653,_0xc3ac17,_0x2d522e){var _0x453d3f={};var _0x203440={};var _0x29d2dd;var _0x4d28cc;return db['MailQueue'][_0xa8c4('0x5a')]({'where':{'id':_0xa3c653[_0xa8c4('0x57')]['id']}})['then'](handleEntityNotFound(_0xc3ac17,null))[_0xa8c4('0x28')](function(_0x41706d){if(_0x41706d){_0x29d2dd=_0x41706d;_0x203440[_0xa8c4('0x32')]=_['keys'](db[_0xa8c4('0x67')][_0xa8c4('0x30')]);_0x203440['query']=_[_0xa8c4('0x34')](_0xa3c653[_0xa8c4('0x33')]);_0x203440[_0xa8c4('0x35')]=_[_0xa8c4('0x36')](_0x203440[_0xa8c4('0x32')],_0x203440[_0xa8c4('0x33')]);_0x453d3f[_0xa8c4('0x38')]=_['intersection'](_0x203440[_0xa8c4('0x32')],qs[_0xa8c4('0x37')](_0xa3c653[_0xa8c4('0x33')][_0xa8c4('0x37')]));_0x453d3f[_0xa8c4('0x38')]=_0x453d3f['attributes'][_0xa8c4('0x48')]?_0x453d3f['attributes']:_0x203440[_0xa8c4('0x32')];_0x453d3f['order']=qs[_0xa8c4('0x3c')](_0xa3c653[_0xa8c4('0x33')][_0xa8c4('0x3c')]);_0x453d3f[_0xa8c4('0x3d')]=qs[_0xa8c4('0x35')](_[_0xa8c4('0x5c')](_0xa3c653[_0xa8c4('0x33')],_0x203440[_0xa8c4('0x35')]));if(_0xa3c653[_0xa8c4('0x33')][_0xa8c4('0x40')]){_0x453d3f[_0xa8c4('0x3d')]=_[_0xa8c4('0x41')](_0x453d3f[_0xa8c4('0x3d')],{'$or':_['map'](_0x453d3f['attributes'],function(_0x13f4b5){var _0x5eb538={};_0x5eb538[_0x13f4b5]={'$like':'%'+_0xa3c653[_0xa8c4('0x33')]['filter']+'%'};return _0x5eb538;})});}_0x453d3f=_[_0xa8c4('0x41')]({},_0x453d3f,_0xa3c653[_0xa8c4('0x42')]);return _0x29d2dd['getTeams'](_0x453d3f);}})[_0xa8c4('0x28')](function(_0x5da079){if(_0x5da079){_0x4d28cc=_0x5da079[_0xa8c4('0x48')];if(!_0xa3c653[_0xa8c4('0x33')][_0xa8c4('0x39')](_0xa8c4('0x3a'))){_0x453d3f[_0xa8c4('0x21')]=qs['limit'](_0xa3c653[_0xa8c4('0x33')][_0xa8c4('0x21')]);_0x453d3f[_0xa8c4('0x20')]=qs['offset'](_0xa3c653[_0xa8c4('0x33')][_0xa8c4('0x20')]);}return _0x29d2dd['getTeams'](_0x453d3f);}})[_0xa8c4('0x28')](function(_0xdc8640){if(_0xdc8640){return _0xdc8640?{'count':_0x4d28cc,'rows':_0xdc8640}:null;}})[_0xa8c4('0x28')](respondWithResult(_0xc3ac17,null))[_0xa8c4('0x46')](handleError(_0xc3ac17,null));};exports[_0xa8c4('0x68')]=function(_0x299f12,_0x4ecca,_0x5fb4d1){var _0x3698af=_0x299f12[_0xa8c4('0x56')][_0xa8c4('0x69')];return db[_0xa8c4('0x67')][_0xa8c4('0x44')]({'where':{'id':_0x3698af},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xa8c4('0x2c'),_0xa8c4('0x6a'),_0xa8c4('0x6b'),_0xa8c4('0x6c')],'raw':!![]}]})[_0xa8c4('0x28')](function(_0x2d9bb8){if(_0x2d9bb8){var _0x20556c=_[_0xa8c4('0x6d')](_0x2d9bb8,function(_0x596414){var _0x155680=_0x596414['get']({'plain':!![]});return _0x155680[_0xa8c4('0x6e')];});return db[_0xa8c4('0x2f')]['find']({'where':{'id':_0x299f12[_0xa8c4('0x57')]['id']}})[_0xa8c4('0x28')](function(_0x3178e7){return db['sequelize']['transaction'](function(_0x14dae2){return _0x3178e7[_0xa8c4('0x68')](_0x3698af,{'transaction':_0x14dae2})[_0xa8c4('0x28')](function(){return BPromise['each'](_0x20556c,function(_0x179894){return db['UserMailQueue'][_0xa8c4('0x6f')]({'where':{'UserId':_0x179894['id'],'MailQueueId':_0x299f12['params']['id']},'transaction':_0x14dae2});});})[_0xa8c4('0x28')](function(){_0x20556c[_0xa8c4('0x70')](function(_0xea79ca){socket[_0xa8c4('0x71')](_0xa8c4('0x72'),{'UserId':_0xea79ca['id'],'MailQueueId':_0x3178e7['id']});});});});});}})['then'](respondWithStatusCode(_0x4ecca,null))['catch'](handleError(_0x4ecca,null));};exports[_0xa8c4('0x73')]=function(_0xb7e8ab,_0x236af8,_0x238edd){return db['Team']['findAll']({'where':{'id':_0xb7e8ab['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xa8c4('0x74')],'as':_0xa8c4('0x6e'),'attributes':['id'],'raw':!![]}]})[_0xa8c4('0x28')](handleEntityNotFound(_0x236af8,null))[_0xa8c4('0x28')](function(_0xadca40){var _0x297980=_[_0xa8c4('0x2e')](_0xadca40,'id');var _0x41e3d5=[];var _0x1c0824=[];var _0x3ce190=squel[_0xa8c4('0x75')]();_0x3ce190[_0xa8c4('0x76')](_0xa8c4('0x77'))[_0xa8c4('0x78')]('team_has_mail_queues','tq')['join'](_0xa8c4('0x79'),'ut',_0xa8c4('0x7a'))[_0xa8c4('0x3d')](_0xa8c4('0x7b'),_0xb7e8ab[_0xa8c4('0x57')]['id']);for(var _0x48a2c8=0x0;_0x48a2c8<_0xadca40[_0xa8c4('0x48')];_0x48a2c8+=0x1){let _0x12eb0a=_0xadca40[_0x48a2c8];for(var _0x9734=0x0;_0x9734<_0x12eb0a['Agents']['length'];_0x9734+=0x1){let _0x57fe50=_0x12eb0a[_0xa8c4('0x6e')][_0x9734];var _0x5c0ded=_0x3ce190[_0xa8c4('0x7c')]();_0x5c0ded[_0xa8c4('0x3d')](_0xa8c4('0x7d'),_0x57fe50['id']);_0x1c0824[_0xa8c4('0x7e')](db[_0xa8c4('0x7f')][_0xa8c4('0x33')](_0x5c0ded[_0xa8c4('0x80')](),{'type':db[_0xa8c4('0x7f')]['QueryTypes'][_0xa8c4('0x81')]})[_0xa8c4('0x28')](function(_0x3a4120){if(_0x3a4120['length']===0x1){return _0x57fe50['id'];}else{var _0x2acc0c=_[_0xa8c4('0x82')](_[_0xa8c4('0x2e')](_0x3a4120,_0xa8c4('0x83')),function(_0x77770f){return _['includes'](_0x297980,_0x77770f);});if(_0x2acc0c){return _0x57fe50['id'];}}}));}}return BPromise[_0xa8c4('0x84')](_0x1c0824)[_0xa8c4('0x28')](function(_0x5b80c5){_0x41e3d5=_(_0x41e3d5)[_0xa8c4('0x85')](_0x5b80c5)[_0xa8c4('0x86')]()[_0xa8c4('0x87')]();return db['MailQueue'][_0xa8c4('0x4a')]({'where':{'id':_0xb7e8ab[_0xa8c4('0x57')]['id']}})[_0xa8c4('0x28')](function(_0x5c126c){return db[_0xa8c4('0x7f')]['transaction'](function(_0x4171c3){return _0x5c126c['removeTeams'](_0xb7e8ab[_0xa8c4('0x33')][_0xa8c4('0x69')],{'transaction':_0x4171c3})[_0xa8c4('0x28')](function(){if(!_[_0xa8c4('0x88')](_0x41e3d5)){return _0x5c126c[_0xa8c4('0x89')](_0x41e3d5,{'transaction':_0x4171c3});}})[_0xa8c4('0x28')](function(){_0x41e3d5[_0xa8c4('0x70')](function(_0x30a210){socket[_0xa8c4('0x71')]('userMailQueue:remove',{'UserId':_0x30a210,'MailQueueId':_0x5c126c['id']});});});});});});})[_0xa8c4('0x28')](respondWithStatusCode(_0x236af8,null))[_0xa8c4('0x46')](handleError(_0x236af8,null));};exports[_0xa8c4('0x8a')]=function(_0xfebcae,_0x1249d4,_0x4c6422){return db[_0xa8c4('0x2f')][_0xa8c4('0x4a')]({'where':{'id':_0xfebcae[_0xa8c4('0x57')]['id']}})[_0xa8c4('0x28')](handleEntityNotFound(_0x1249d4,null))[_0xa8c4('0x28')](function(_0xe310ff){if(_0xe310ff){return _0xe310ff[_0xa8c4('0x8a')](_0xfebcae['body']['ids'],_[_0xa8c4('0x8b')](_0xfebcae[_0xa8c4('0x56')],[_0xa8c4('0x69'),'id'])||{})[_0xa8c4('0x8c')](function(_0x2efb24){for(var _0x2a4c24=0x0;_0x2a4c24<_0xfebcae[_0xa8c4('0x56')]['ids'][_0xa8c4('0x48')];_0x2a4c24+=0x1){socket[_0xa8c4('0x71')](_0xa8c4('0x72'),{'UserId':Number(_0xfebcae[_0xa8c4('0x56')][_0xa8c4('0x69')][_0x2a4c24]),'MailQueueId':Number(_0xfebcae['params']['id'])});}return _0x2efb24;});}})[_0xa8c4('0x28')](respondWithResult(_0x1249d4,null))[_0xa8c4('0x46')](handleError(_0x1249d4,null));};exports[_0xa8c4('0x89')]=function(_0x284481,_0x4d7a6d,_0x5d1a53){return db['MailQueue'][_0xa8c4('0x4a')]({'where':{'id':_0x284481['params']['id']}})[_0xa8c4('0x28')](handleEntityNotFound(_0x4d7a6d,null))[_0xa8c4('0x28')](function(_0x22d3f6){if(_0x22d3f6){return _0x22d3f6[_0xa8c4('0x89')](_0x284481[_0xa8c4('0x33')][_0xa8c4('0x69')])[_0xa8c4('0x28')](function(){if(_[_0xa8c4('0x8d')](_0x284481[_0xa8c4('0x33')][_0xa8c4('0x69')])){for(var _0x1c2927=0x0;_0x1c2927<_0x284481['query']['ids'][_0xa8c4('0x48')];_0x1c2927+=0x1){socket[_0xa8c4('0x71')](_0xa8c4('0x8e'),{'UserId':Number(_0x284481[_0xa8c4('0x33')]['ids'][_0x1c2927]),'MailQueueId':Number(_0x284481[_0xa8c4('0x57')]['id'])});}}else{socket[_0xa8c4('0x71')](_0xa8c4('0x8e'),{'UserId':Number(_0x284481[_0xa8c4('0x33')][_0xa8c4('0x69')]),'MailQueueId':Number(_0x284481['params']['id'])});}});}})[_0xa8c4('0x28')](respondWithStatusCode(_0x4d7a6d,null))['catch'](handleError(_0x4d7a6d,null));};exports[_0xa8c4('0x8f')]=function(_0x37e7b4,_0x5bda5a,_0x53bb22){var _0x1596f8={};var _0x34b80d={};var _0x8278b2;var _0x2f7aa8;return db[_0xa8c4('0x2f')][_0xa8c4('0x5a')]({'where':{'id':_0x37e7b4['params']['id']}})['then'](handleEntityNotFound(_0x5bda5a,null))[_0xa8c4('0x28')](function(_0x54e479){if(_0x54e479){_0x8278b2=_0x54e479;_0x34b80d[_0xa8c4('0x32')]=_['keys'](db[_0xa8c4('0x74')][_0xa8c4('0x30')]);_0x34b80d[_0xa8c4('0x33')]=_['keys'](_0x37e7b4[_0xa8c4('0x33')]);_0x34b80d[_0xa8c4('0x35')]=_[_0xa8c4('0x36')](_0x34b80d[_0xa8c4('0x32')],_0x34b80d[_0xa8c4('0x33')]);_0x1596f8['attributes']=_['intersection'](_0x34b80d[_0xa8c4('0x32')],qs[_0xa8c4('0x37')](_0x37e7b4['query'][_0xa8c4('0x37')]));_0x1596f8[_0xa8c4('0x38')]=_0x1596f8[_0xa8c4('0x38')][_0xa8c4('0x48')]?_0x1596f8[_0xa8c4('0x38')]:_0x34b80d['model'];_0x1596f8[_0xa8c4('0x3b')]=qs[_0xa8c4('0x3c')](_0x37e7b4[_0xa8c4('0x33')][_0xa8c4('0x3c')]);_0x1596f8[_0xa8c4('0x3d')]=qs[_0xa8c4('0x35')](_['pick'](_0x37e7b4[_0xa8c4('0x33')],_0x34b80d[_0xa8c4('0x35')]));if(_0x37e7b4[_0xa8c4('0x33')][_0xa8c4('0x40')]){_0x1596f8[_0xa8c4('0x3d')]=_[_0xa8c4('0x41')](_0x1596f8[_0xa8c4('0x3d')],{'$or':_[_0xa8c4('0x2e')](_0x1596f8[_0xa8c4('0x38')],function(_0x3660db){var _0x2e4ae7={};_0x2e4ae7[_0x3660db]={'$like':'%'+_0x37e7b4[_0xa8c4('0x33')][_0xa8c4('0x40')]+'%'};return _0x2e4ae7;})});}_0x1596f8=_[_0xa8c4('0x41')]({},_0x1596f8,_0x37e7b4[_0xa8c4('0x42')]);return _0x8278b2[_0xa8c4('0x8f')](_0x1596f8);}})['then'](function(_0x30902a){if(_0x30902a){_0x2f7aa8=_0x30902a[_0xa8c4('0x48')];if(!_0x37e7b4[_0xa8c4('0x33')][_0xa8c4('0x39')](_0xa8c4('0x3a'))){_0x1596f8['limit']=qs[_0xa8c4('0x21')](_0x37e7b4[_0xa8c4('0x33')][_0xa8c4('0x21')]);_0x1596f8[_0xa8c4('0x20')]=qs['offset'](_0x37e7b4[_0xa8c4('0x33')][_0xa8c4('0x20')]);}return _0x8278b2[_0xa8c4('0x8f')](_0x1596f8);}})['then'](function(_0x5688d6){if(_0x5688d6){return _0x5688d6?{'count':_0x2f7aa8,'rows':_0x5688d6}:null;}})[_0xa8c4('0x28')](respondWithResult(_0x5bda5a,null))[_0xa8c4('0x46')](handleError(_0x5bda5a,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index d180fa3..e2f98ff 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 _0x1d59=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','MailQueue','setMaxListeners'];(function(_0x12faa7,_0x4e82bb){var _0x9f4b7f=function(_0x4b2e35){while(--_0x4b2e35){_0x12faa7['push'](_0x12faa7['shift']());}};_0x9f4b7f(++_0x4e82bb);}(_0x1d59,0x1be));var _0x91d5=function(_0x14a5f0,_0x41aa87){_0x14a5f0=_0x14a5f0-0x0;var _0x1c71bd=_0x1d59[_0x14a5f0];return _0x1c71bd;};'use strict';var EventEmitter=require(_0x91d5('0x0'));var MailQueue=require(_0x91d5('0x1'))['db'][_0x91d5('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x91d5('0x3')](0x0);var events={'afterCreate':_0x91d5('0x4'),'afterUpdate':_0x91d5('0x5'),'afterDestroy':_0x91d5('0x6')};function emitEvent(_0xf254d8){return function(_0x53c782,_0x403a83,_0x2c3be9){MailQueueEvents[_0x91d5('0x7')](_0xf254d8+':'+_0x53c782['id'],_0x53c782);MailQueueEvents[_0x91d5('0x7')](_0xf254d8,_0x53c782);_0x2c3be9(null);};}for(var e in events){if(events[_0x91d5('0x8')](e)){var event=events[e];MailQueue[_0x91d5('0x9')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x303f=['save','remove','emit','hasOwnProperty','exports','../../mysqldb','MailQueue'];(function(_0x4f8cfc,_0x397ae3){var _0x4dedc0=function(_0x4c6be5){while(--_0x4c6be5){_0x4f8cfc['push'](_0x4f8cfc['shift']());}};_0x4dedc0(++_0x397ae3);}(_0x303f,0xc9));var _0xf303=function(_0x4e7afb,_0x5260b2){_0x4e7afb=_0x4e7afb-0x0;var _0x311c57=_0x303f[_0x4e7afb];return _0x311c57;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xf303('0x0'))['db'][_0xf303('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf303('0x2'),'afterUpdate':'update','afterDestroy':_0xf303('0x3')};function emitEvent(_0x2a5c9a){return function(_0xcb8f39,_0x366dc6,_0x574e26){MailQueueEvents['emit'](_0x2a5c9a+':'+_0xcb8f39['id'],_0xcb8f39);MailQueueEvents[_0xf303('0x4')](_0x2a5c9a,_0xcb8f39);_0x574e26(null);};}for(var e in events){if(events[_0xf303('0x5')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xf303('0x6')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 47426a9..7ac608c 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 _0x461f=['path','rimraf','../../config/environment','exports','MailQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x15813e,_0x135677){var _0x2b1022=function(_0x37113f){while(--_0x37113f){_0x15813e['push'](_0x15813e['shift']());}};_0x2b1022(++_0x135677);}(_0x461f,0x1a9));var _0xf461=function(_0x561197,_0x2d7d64){_0x561197=_0x561197-0x0;var _0x191270=_0x461f[_0x561197];return _0x191270;};'use strict';var _=require(_0xf461('0x0'));var util=require(_0xf461('0x1'));var logger=require(_0xf461('0x2'))(_0xf461('0x3'));var moment=require(_0xf461('0x4'));var BPromise=require(_0xf461('0x5'));var rp=require(_0xf461('0x6'));var fs=require('fs');var path=require(_0xf461('0x7'));var rimraf=require(_0xf461('0x8'));var config=require(_0xf461('0x9'));var attributes=require('./mailQueue.attributes');module[_0xf461('0xa')]=function(_0x17c28a,_0x575813){return _0x17c28a['define'](_0xf461('0xb'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7068=['path','rimraf','../../config/environment','./mailQueue.attributes','exports','mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xbe4c61,_0x24e06a){var _0x35076d=function(_0x126a03){while(--_0x126a03){_0xbe4c61['push'](_0xbe4c61['shift']());}};_0x35076d(++_0x24e06a);}(_0x7068,0x165));var _0x8706=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x7068[_0x616290];return _0x453879;};'use strict';var _=require(_0x8706('0x0'));var util=require(_0x8706('0x1'));var logger=require(_0x8706('0x2'))(_0x8706('0x3'));var moment=require(_0x8706('0x4'));var BPromise=require(_0x8706('0x5'));var rp=require(_0x8706('0x6'));var fs=require('fs');var path=require(_0x8706('0x7'));var rimraf=require(_0x8706('0x8'));var config=require(_0x8706('0x9'));var attributes=require(_0x8706('0xa'));module[_0x8706('0xb')]=function(_0x58f667,_0x3a3062){return _0x58f667['define']('MailQueue',attributes,{'tableName':_0x8706('0xc'),'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 d33fc82..ec93c0e 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 _0xa6e2=['redis','localhost','./mailQueue.socket','register','request','then','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','MailQueue,\x20%s,\x20%s','message','result','catch','GetMailQueue','MailQueue','options','raw','attributes','limit','include','map','model','ShowMailQueue','lodash','util','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http'];(function(_0x19efb2,_0x1a2687){var _0x5304b2=function(_0x3713bc){while(--_0x3713bc){_0x19efb2['push'](_0x19efb2['shift']());}};_0x5304b2(++_0x1a2687);}(_0xa6e2,0x132));var _0x2a6e=function(_0x1a86ca,_0x3efc1c){_0x1a86ca=_0x1a86ca-0x0;var _0x16e9dd=_0xa6e2[_0x1a86ca];return _0x16e9dd;};'use strict';var _=require(_0x2a6e('0x0'));var util=require(_0x2a6e('0x1'));var moment=require('moment');var BPromise=require(_0x2a6e('0x2'));var rs=require(_0x2a6e('0x3'));var fs=require('fs');var Redis=require(_0x2a6e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2a6e('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2a6e('0x6'));var client=jayson[_0x2a6e('0x7')][_0x2a6e('0x8')]({'port':0x232a});config[_0x2a6e('0x9')]=_['defaults'](config[_0x2a6e('0x9')],{'host':_0x2a6e('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2a6e('0x9')]));require(_0x2a6e('0xb'))[_0x2a6e('0xc')](socket);function respondWithRpcPromise(_0x1b0d7e,_0x18188f,_0x46af2e){return new BPromise(function(_0x37c377,_0x22ba50){return client[_0x2a6e('0xd')](_0x1b0d7e,_0x46af2e)[_0x2a6e('0xe')](function(_0x5f21b4){logger[_0x2a6e('0xf')]('MailQueue,\x20%s,\x20%s',_0x18188f,_0x2a6e('0x10'));logger[_0x2a6e('0x11')](_0x2a6e('0x12'),_0x18188f,_0x2a6e('0x10'),JSON[_0x2a6e('0x13')](_0x5f21b4));if(_0x5f21b4[_0x2a6e('0x14')]){if(_0x5f21b4[_0x2a6e('0x14')]['code']===0x1f4){logger[_0x2a6e('0x14')](_0x2a6e('0x15'),_0x18188f,_0x5f21b4['error'][_0x2a6e('0x16')]);return _0x22ba50(_0x5f21b4[_0x2a6e('0x14')][_0x2a6e('0x16')]);}logger[_0x2a6e('0x14')]('MailQueue,\x20%s,\x20%s',_0x18188f,_0x5f21b4[_0x2a6e('0x14')][_0x2a6e('0x16')]);return _0x37c377(_0x5f21b4[_0x2a6e('0x14')][_0x2a6e('0x16')]);}else{logger[_0x2a6e('0xf')]('MailQueue,\x20%s,\x20%s',_0x18188f,_0x2a6e('0x10'));_0x37c377(_0x5f21b4[_0x2a6e('0x17')][_0x2a6e('0x16')]);}})[_0x2a6e('0x18')](function(_0x17b66f){logger[_0x2a6e('0x14')]('MailQueue,\x20%s,\x20%s',_0x18188f,_0x17b66f);_0x22ba50(_0x17b66f);});});}exports[_0x2a6e('0x19')]=function(_0xff2518){var _0x27cf40=this;return new Promise(function(_0x3373eb,_0x41202e){return db[_0x2a6e('0x1a')]['findAll']({'raw':_0xff2518[_0x2a6e('0x1b')]?_0xff2518[_0x2a6e('0x1b')][_0x2a6e('0x1c')]===undefined?!![]:![]:!![],'where':_0xff2518[_0x2a6e('0x1b')]?_0xff2518[_0x2a6e('0x1b')]['where']||null:null,'attributes':_0xff2518[_0x2a6e('0x1b')]?_0xff2518['options'][_0x2a6e('0x1d')]||null:null,'limit':_0xff2518[_0x2a6e('0x1b')]?_0xff2518['options'][_0x2a6e('0x1e')]||null:null,'include':_0xff2518['options']?_0xff2518['options'][_0x2a6e('0x1f')]?_[_0x2a6e('0x20')](_0xff2518[_0x2a6e('0x1b')][_0x2a6e('0x1f')],function(_0x14f995){return{'model':db[_0x14f995[_0x2a6e('0x21')]],'as':_0x14f995['as'],'attributes':_0x14f995[_0x2a6e('0x1d')],'include':_0x14f995['include']?_[_0x2a6e('0x20')](_0x14f995[_0x2a6e('0x1f')],function(_0x20e5e4){return{'model':db[_0x20e5e4[_0x2a6e('0x21')]],'as':_0x20e5e4['as'],'attributes':_0x20e5e4[_0x2a6e('0x1d')],'include':_0x20e5e4[_0x2a6e('0x1f')]?_[_0x2a6e('0x20')](_0x20e5e4[_0x2a6e('0x1f')],function(_0x1de228){return{'model':db[_0x1de228[_0x2a6e('0x21')]],'as':_0x1de228['as'],'attributes':_0x1de228[_0x2a6e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2a6e('0xe')](function(_0x3895a4){logger['info']('GetMailQueue',_0xff2518);logger['debug'](_0x2a6e('0x19'),_0xff2518,JSON[_0x2a6e('0x13')](_0x3895a4));_0x3373eb(_0x3895a4);})[_0x2a6e('0x18')](function(_0x6777a0){logger['error'](_0x2a6e('0x19'),_0x6777a0[_0x2a6e('0x16')],_0xff2518);_0x41202e(_0x27cf40[_0x2a6e('0x14')](0x1f4,_0x6777a0[_0x2a6e('0x16')]));});});};exports[_0x2a6e('0x22')]=function(_0x1924e7){var _0x3c17dd=this;return new Promise(function(_0x4535b7,_0x5f0b07){return db[_0x2a6e('0x1a')]['find']({'raw':_0x1924e7[_0x2a6e('0x1b')]?_0x1924e7[_0x2a6e('0x1b')][_0x2a6e('0x1c')]===undefined?!![]:![]:!![],'where':_0x1924e7[_0x2a6e('0x1b')]?_0x1924e7[_0x2a6e('0x1b')]['where']||null:null,'attributes':_0x1924e7[_0x2a6e('0x1b')]?_0x1924e7['options']['attributes']||null:null,'include':_0x1924e7[_0x2a6e('0x1b')]?_0x1924e7[_0x2a6e('0x1b')][_0x2a6e('0x1f')]?_[_0x2a6e('0x20')](_0x1924e7[_0x2a6e('0x1b')]['include'],function(_0x2c84e0){return{'model':db[_0x2c84e0['model']],'as':_0x2c84e0['as'],'attributes':_0x2c84e0[_0x2a6e('0x1d')],'include':_0x2c84e0[_0x2a6e('0x1f')]?_['map'](_0x2c84e0[_0x2a6e('0x1f')],function(_0x4529c8){return{'model':db[_0x4529c8[_0x2a6e('0x21')]],'as':_0x4529c8['as'],'attributes':_0x4529c8[_0x2a6e('0x1d')],'include':_0x4529c8['include']?_[_0x2a6e('0x20')](_0x4529c8['include'],function(_0x43e116){return{'model':db[_0x43e116['model']],'as':_0x43e116['as'],'attributes':_0x43e116['attributes']};}):[]};}):[]};}):[]:[]})[_0x2a6e('0xe')](function(_0x22ce90){logger[_0x2a6e('0xf')](_0x2a6e('0x22'),_0x1924e7);logger[_0x2a6e('0x11')](_0x2a6e('0x22'),_0x1924e7,JSON[_0x2a6e('0x13')](_0x22ce90));_0x4535b7(_0x22ce90);})[_0x2a6e('0x18')](function(_0x2d1f34){logger[_0x2a6e('0x14')](_0x2a6e('0x22'),_0x2d1f34[_0x2a6e('0x16')],_0x1924e7);_0x5f0b07(_0x3c17dd['error'](0x1f4,_0x2d1f34[_0x2a6e('0x16')]));});});}; \ No newline at end of file +var _0x7d6e=['raw','where','attributes','limit','include','map','model','GetMailQueue','ShowMailQueue','find','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','redis','defaults','socket.io-emitter','./mailQueue.socket','register','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','MailQueue','findAll','options'];(function(_0x5eaa6a,_0x41d4f9){var _0x332a98=function(_0x27e532){while(--_0x27e532){_0x5eaa6a['push'](_0x5eaa6a['shift']());}};_0x332a98(++_0x41d4f9);}(_0x7d6e,0x76));var _0xe7d6=function(_0x334fea,_0x1f1e18){_0x334fea=_0x334fea-0x0;var _0x3c5829=_0x7d6e[_0x334fea];return _0x3c5829;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7d6('0x0'));var BPromise=require('bluebird');var rs=require(_0xe7d6('0x1'));var fs=require('fs');var Redis=require(_0xe7d6('0x2'));var db=require(_0xe7d6('0x3'))['db'];var utils=require(_0xe7d6('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xe7d6('0x5'));var client=jayson[_0xe7d6('0x6')]['http']({'port':0x232a});config[_0xe7d6('0x7')]=_[_0xe7d6('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe7d6('0x9'))(new Redis(config[_0xe7d6('0x7')]));require(_0xe7d6('0xa'))[_0xe7d6('0xb')](socket);function respondWithRpcPromise(_0x45db75,_0x4c8b09,_0x5d9083){return new BPromise(function(_0x4456cc,_0x4621f5){return client['request'](_0x45db75,_0x5d9083)[_0xe7d6('0xc')](function(_0xb5857e){logger[_0xe7d6('0xd')](_0xe7d6('0xe'),_0x4c8b09,_0xe7d6('0xf'));logger[_0xe7d6('0x10')](_0xe7d6('0x11'),_0x4c8b09,_0xe7d6('0xf'),JSON[_0xe7d6('0x12')](_0xb5857e));if(_0xb5857e[_0xe7d6('0x13')]){if(_0xb5857e[_0xe7d6('0x13')][_0xe7d6('0x14')]===0x1f4){logger[_0xe7d6('0x13')](_0xe7d6('0xe'),_0x4c8b09,_0xb5857e[_0xe7d6('0x13')][_0xe7d6('0x15')]);return _0x4621f5(_0xb5857e['error'][_0xe7d6('0x15')]);}logger[_0xe7d6('0x13')]('MailQueue,\x20%s,\x20%s',_0x4c8b09,_0xb5857e[_0xe7d6('0x13')][_0xe7d6('0x15')]);return _0x4456cc(_0xb5857e[_0xe7d6('0x13')]['message']);}else{logger[_0xe7d6('0xd')](_0xe7d6('0xe'),_0x4c8b09,_0xe7d6('0xf'));_0x4456cc(_0xb5857e['result'][_0xe7d6('0x15')]);}})[_0xe7d6('0x16')](function(_0x11ca78){logger[_0xe7d6('0x13')](_0xe7d6('0xe'),_0x4c8b09,_0x11ca78);_0x4621f5(_0x11ca78);});});}exports['GetMailQueue']=function(_0x5c222e){var _0xbab47b=this;return new Promise(function(_0x2a0a95,_0x1052d8){return db[_0xe7d6('0x17')][_0xe7d6('0x18')]({'raw':_0x5c222e[_0xe7d6('0x19')]?_0x5c222e[_0xe7d6('0x19')][_0xe7d6('0x1a')]===undefined?!![]:![]:!![],'where':_0x5c222e[_0xe7d6('0x19')]?_0x5c222e[_0xe7d6('0x19')][_0xe7d6('0x1b')]||null:null,'attributes':_0x5c222e[_0xe7d6('0x19')]?_0x5c222e[_0xe7d6('0x19')][_0xe7d6('0x1c')]||null:null,'limit':_0x5c222e[_0xe7d6('0x19')]?_0x5c222e['options'][_0xe7d6('0x1d')]||null:null,'include':_0x5c222e[_0xe7d6('0x19')]?_0x5c222e[_0xe7d6('0x19')][_0xe7d6('0x1e')]?_[_0xe7d6('0x1f')](_0x5c222e[_0xe7d6('0x19')][_0xe7d6('0x1e')],function(_0x2d13c0){return{'model':db[_0x2d13c0[_0xe7d6('0x20')]],'as':_0x2d13c0['as'],'attributes':_0x2d13c0['attributes'],'include':_0x2d13c0['include']?_[_0xe7d6('0x1f')](_0x2d13c0[_0xe7d6('0x1e')],function(_0xac70e){return{'model':db[_0xac70e[_0xe7d6('0x20')]],'as':_0xac70e['as'],'attributes':_0xac70e[_0xe7d6('0x1c')],'include':_0xac70e[_0xe7d6('0x1e')]?_[_0xe7d6('0x1f')](_0xac70e[_0xe7d6('0x1e')],function(_0x24e60c){return{'model':db[_0x24e60c[_0xe7d6('0x20')]],'as':_0x24e60c['as'],'attributes':_0x24e60c[_0xe7d6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe7d6('0xc')](function(_0x5804f0){logger[_0xe7d6('0xd')](_0xe7d6('0x21'),_0x5c222e);logger[_0xe7d6('0x10')](_0xe7d6('0x21'),_0x5c222e,JSON[_0xe7d6('0x12')](_0x5804f0));_0x2a0a95(_0x5804f0);})[_0xe7d6('0x16')](function(_0x4d4d78){logger['error'](_0xe7d6('0x21'),_0x4d4d78[_0xe7d6('0x15')],_0x5c222e);_0x1052d8(_0xbab47b[_0xe7d6('0x13')](0x1f4,_0x4d4d78[_0xe7d6('0x15')]));});});};exports[_0xe7d6('0x22')]=function(_0x32c06d){var _0x1ee9ea=this;return new Promise(function(_0xeef2ee,_0x53e698){return db[_0xe7d6('0x17')][_0xe7d6('0x23')]({'raw':_0x32c06d[_0xe7d6('0x19')]?_0x32c06d[_0xe7d6('0x19')][_0xe7d6('0x1a')]===undefined?!![]:![]:!![],'where':_0x32c06d[_0xe7d6('0x19')]?_0x32c06d['options']['where']||null:null,'attributes':_0x32c06d[_0xe7d6('0x19')]?_0x32c06d[_0xe7d6('0x19')]['attributes']||null:null,'include':_0x32c06d[_0xe7d6('0x19')]?_0x32c06d[_0xe7d6('0x19')][_0xe7d6('0x1e')]?_[_0xe7d6('0x1f')](_0x32c06d[_0xe7d6('0x19')][_0xe7d6('0x1e')],function(_0x55f6a1){return{'model':db[_0x55f6a1[_0xe7d6('0x20')]],'as':_0x55f6a1['as'],'attributes':_0x55f6a1[_0xe7d6('0x1c')],'include':_0x55f6a1['include']?_[_0xe7d6('0x1f')](_0x55f6a1[_0xe7d6('0x1e')],function(_0x3326e0){return{'model':db[_0x3326e0[_0xe7d6('0x20')]],'as':_0x3326e0['as'],'attributes':_0x3326e0[_0xe7d6('0x1c')],'include':_0x3326e0[_0xe7d6('0x1e')]?_[_0xe7d6('0x1f')](_0x3326e0[_0xe7d6('0x1e')],function(_0x220724){return{'model':db[_0x220724['model']],'as':_0x220724['as'],'attributes':_0x220724[_0xe7d6('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x33e831){logger[_0xe7d6('0xd')](_0xe7d6('0x22'),_0x32c06d);logger[_0xe7d6('0x10')](_0xe7d6('0x22'),_0x32c06d,JSON[_0xe7d6('0x12')](_0x33e831));_0xeef2ee(_0x33e831);})[_0xe7d6('0x16')](function(_0x42a2a8){logger['error'](_0xe7d6('0x22'),_0x42a2a8['message'],_0x32c06d);_0x53e698(_0x1ee9ea[_0xe7d6('0x13')](0x1f4,_0x42a2a8[_0xe7d6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index dcffd89..5f04852 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 _0x930b=['mailQueue:','./mailQueue.events','update','removeListener','register','length'];(function(_0x32e880,_0x448247){var _0x5936a6=function(_0xae6854){while(--_0xae6854){_0x32e880['push'](_0x32e880['shift']());}};_0x5936a6(++_0x448247);}(_0x930b,0xc1));var _0xb930=function(_0x97edb1,_0x5b17bf){_0x97edb1=_0x97edb1-0x0;var _0x34004e=_0x930b[_0x97edb1];return _0x34004e;};'use strict';var MailQueueEvents=require(_0xb930('0x0'));var events=['save','remove',_0xb930('0x1')];function createListener(_0x8a2a12,_0x395251){return function(_0x1c28ae){_0x395251['emit'](_0x8a2a12,_0x1c28ae);};}function removeListener(_0x55974,_0x47f97e){return function(){MailQueueEvents[_0xb930('0x2')](_0x55974,_0x47f97e);};}exports[_0xb930('0x3')]=function(_0x49abf3){for(var _0x30e655=0x0,_0x47f1ca=events[_0xb930('0x4')];_0x30e655<_0x47f1ca;_0x30e655++){var _0x29fe53=events[_0x30e655];var _0x241c44=createListener(_0xb930('0x5')+_0x29fe53,_0x49abf3);MailQueueEvents['on'](_0x29fe53,_0x241c44);}}; \ No newline at end of file +var _0xbf97=['register','length','./mailQueue.events','remove','emit','removeListener'];(function(_0x315cfc,_0x2b0345){var _0x601801=function(_0x49dff4){while(--_0x49dff4){_0x315cfc['push'](_0x315cfc['shift']());}};_0x601801(++_0x2b0345);}(_0xbf97,0x9e));var _0x7bf9=function(_0x145fd5,_0x505f89){_0x145fd5=_0x145fd5-0x0;var _0x5b90ff=_0xbf97[_0x145fd5];return _0x5b90ff;};'use strict';var MailQueueEvents=require(_0x7bf9('0x0'));var events=['save',_0x7bf9('0x1'),'update'];function createListener(_0x4d7f37,_0x4174ec){return function(_0x1f577f){_0x4174ec[_0x7bf9('0x2')](_0x4d7f37,_0x1f577f);};}function removeListener(_0x11d63a,_0x159709){return function(){MailQueueEvents[_0x7bf9('0x3')](_0x11d63a,_0x159709);};}exports[_0x7bf9('0x4')]=function(_0x18cfee){for(var _0x18e631=0x0,_0x36ceb8=events[_0x7bf9('0x5')];_0x18e631<_0x36ceb8;_0x18e631++){var _0x4fe585=events[_0x18e631];var _0xc0787f=createListener('mailQueue:'+_0x4fe585,_0x18cfee);MailQueueEvents['on'](_0x4fe585,_0xc0787f);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 1df987d..9be90ad 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 _0xf0a2=['exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','destroy'];(function(_0x9cda45,_0xb96ab0){var _0x45a8e5=function(_0x20e621){while(--_0x20e621){_0x9cda45['push'](_0x9cda45['shift']());}};_0x45a8e5(++_0xb96ab0);}(_0xf0a2,0xc9));var _0x2f0a=function(_0xf33887,_0x501b09){_0xf33887=_0xf33887-0x0;var _0x1b7bc0=_0xf0a2[_0xf33887];return _0x1b7bc0;};'use strict';var multer=require(_0x2f0a('0x0'));var util=require(_0x2f0a('0x1'));var path=require(_0x2f0a('0x2'));var timeout=require('connect-timeout');var express=require(_0x2f0a('0x3'));var router=express[_0x2f0a('0x4')]();var fs_extra=require(_0x2f0a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2f0a('0x6'));var config=require('../../config/environment');var controller=require(_0x2f0a('0x7'));router[_0x2f0a('0x8')]('/',auth[_0x2f0a('0x9')](),controller['index']);router[_0x2f0a('0x8')](_0x2f0a('0xa'),auth[_0x2f0a('0x9')](),controller[_0x2f0a('0xb')]);router[_0x2f0a('0x8')](_0x2f0a('0xc'),auth['isAuthenticated'](),controller[_0x2f0a('0xd')]);router['post']('/',auth[_0x2f0a('0x9')](),controller[_0x2f0a('0xe')]);router[_0x2f0a('0xf')](_0x2f0a('0xc'),auth[_0x2f0a('0x9')](),controller[_0x2f0a('0x10')]);router[_0x2f0a('0x11')]('/:id',auth[_0x2f0a('0x9')](),controller[_0x2f0a('0x12')]);module[_0x2f0a('0x13')]=router; \ No newline at end of file +var _0xd298=['get','/describe','describe','/:id','show','post','create','put','update','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index'];(function(_0x44c14b,_0x29b7e4){var _0xcf6b96=function(_0x5eef5b){while(--_0x5eef5b){_0x44c14b['push'](_0x44c14b['shift']());}};_0xcf6b96(++_0x29b7e4);}(_0xd298,0xed));var _0x8d29=function(_0x1b01da,_0x248657){_0x1b01da=_0x1b01da-0x0;var _0x4db391=_0xd298[_0x1b01da];return _0x4db391;};'use strict';var multer=require(_0x8d29('0x0'));var util=require(_0x8d29('0x1'));var path=require(_0x8d29('0x2'));var timeout=require('connect-timeout');var express=require(_0x8d29('0x3'));var router=express[_0x8d29('0x4')]();var fs_extra=require(_0x8d29('0x5'));var auth=require(_0x8d29('0x6'));var interaction=require(_0x8d29('0x7'));var config=require('../../config/environment');var controller=require('./mailQueueReport.controller');router['get']('/',auth[_0x8d29('0x8')](),controller[_0x8d29('0x9')]);router[_0x8d29('0xa')](_0x8d29('0xb'),auth['isAuthenticated'](),controller[_0x8d29('0xc')]);router[_0x8d29('0xa')](_0x8d29('0xd'),auth[_0x8d29('0x8')](),controller[_0x8d29('0xe')]);router[_0x8d29('0xf')]('/',auth['isAuthenticated'](),controller[_0x8d29('0x10')]);router[_0x8d29('0x11')](_0x8d29('0xd'),auth[_0x8d29('0x8')](),controller[_0x8d29('0x12')]);router['delete'](_0x8d29('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 3ca2153..efe9135 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 _0x3bc0=['STRING','DATE','moment','sequelize','exports'];(function(_0x3756cf,_0x2f83b3){var _0x2bd267=function(_0x5657b7){while(--_0x5657b7){_0x3756cf['push'](_0x3756cf['shift']());}};_0x2bd267(++_0x2f83b3);}(_0x3bc0,0x1ba));var _0x03bc=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0x3bc0[_0x2080a3];return _0x8d7d17;};'use strict';var moment=require(_0x03bc('0x0'));var Sequelize=require(_0x03bc('0x1'));module[_0x03bc('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x03bc('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x03bc('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x03bc('0x4')]},'reason':{'type':Sequelize[_0x03bc('0x3')]}}; \ No newline at end of file +var _0xf37f=['sequelize','STRING','DATE'];(function(_0x1c2421,_0x1c152c){var _0x5867b2=function(_0x16e49c){while(--_0x16e49c){_0x1c2421['push'](_0x1c2421['shift']());}};_0x5867b2(++_0x1c152c);}(_0xf37f,0x11a));var _0xff37=function(_0x1ae31c,_0x8dcd2d){_0x1ae31c=_0x1ae31c-0x0;var _0x19519d=_0xf37f[_0x1ae31c];return _0x19519d;};'use strict';var moment=require('moment');var Sequelize=require(_0xff37('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xff37('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xff37('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xff37('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xff37('0x2')]},'reason':{'type':Sequelize[_0xff37('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index aa5d9aa..85d46b2 100644 --- a/server/api/mailQueueReport/mailQueueReport.controller.js +++ b/server/api/mailQueueReport/mailQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfcbb=['destroy','error','stack','name','send','index','MailQueueReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','options','include','rows','catch','show','length','includeAll','find','create','body','params','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','update','then'];(function(_0x2ba7b9,_0x5b3526){var _0xb43e2a=function(_0xfbd620){while(--_0xfbd620){_0x2ba7b9['push'](_0x2ba7b9['shift']());}};_0xb43e2a(++_0x5b3526);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x419b14,_0x1384e9){_0x419b14=_0x419b14-0x0;var _0x93f88b=_0xfcbb[_0x419b14];return _0x93f88b;};'use strict';var emlformat=require(_0xbfcb('0x0'));var rimraf=require(_0xbfcb('0x1'));var zipdir=require(_0xbfcb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbfcb('0x3'));var BPromise=require(_0xbfcb('0x4'));var Mustache=require(_0xbfcb('0x5'));var util=require(_0xbfcb('0x6'));var path=require(_0xbfcb('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbfcb('0x8'));var fs=require('fs');var fs_extra=require(_0xbfcb('0x9'));var _=require(_0xbfcb('0xa'));var squel=require(_0xbfcb('0xb'));var crypto=require(_0xbfcb('0xc'));var jsforce=require(_0xbfcb('0xd'));var deskjs=require(_0xbfcb('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbfcb('0xf'));var Papa=require(_0xbfcb('0x10'));var Redis=require(_0xbfcb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbfcb('0x12'));var as=require(_0xbfcb('0x13'));var hardwareService=require(_0xbfcb('0x14'));var logger=require(_0xbfcb('0x15'))(_0xbfcb('0x16'));var utils=require(_0xbfcb('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xbfcb('0x18'));var db=require(_0xbfcb('0x19'))['db'];function respondWithStatusCode(_0xb2f601,_0x2268da){_0x2268da=_0x2268da||0xcc;return function(_0x4ba4f1){if(_0x4ba4f1){return _0xb2f601[_0xbfcb('0x1a')](_0x2268da);}return _0xb2f601['status'](_0x2268da)[_0xbfcb('0x1b')]();};}function respondWithResult(_0x1c52df,_0x44ad6c){_0x44ad6c=_0x44ad6c||0xc8;return function(_0x1047c4){if(_0x1047c4){return _0x1c52df[_0xbfcb('0x1c')](_0x44ad6c)[_0xbfcb('0x1d')](_0x1047c4);}};}function respondWithFilteredResult(_0x71304e,_0x2d314a){return function(_0x90ed8c){if(_0x90ed8c){var _0x339347=typeof _0x2d314a[_0xbfcb('0x1e')]===_0xbfcb('0x1f')&&typeof _0x2d314a[_0xbfcb('0x20')]===_0xbfcb('0x1f');var _0x318d07=_0x90ed8c[_0xbfcb('0x21')];var _0xba1d6=_0x339347?0x0:_0x2d314a[_0xbfcb('0x1e')];var _0x3404aa=_0x339347?_0x90ed8c[_0xbfcb('0x21')]:_0x2d314a[_0xbfcb('0x1e')]+_0x2d314a[_0xbfcb('0x20')];var _0x53c9e0;if(_0x3404aa>=_0x318d07){_0x3404aa=_0x318d07;_0x53c9e0=0xc8;}else{_0x53c9e0=0xce;}_0x71304e[_0xbfcb('0x1c')](_0x53c9e0);return _0x71304e[_0xbfcb('0x22')]('Content-Range',_0xba1d6+'-'+_0x3404aa+'/'+_0x318d07)[_0xbfcb('0x1d')](_0x90ed8c);}return null;};}function patchUpdates(_0x1a7225){return function(_0x48c3c8){try{jsonpatch['apply'](_0x48c3c8,_0x1a7225,!![]);}catch(_0x4199c5){return BPromise[_0xbfcb('0x23')](_0x4199c5);}return _0x48c3c8[_0xbfcb('0x24')]();};}function saveUpdates(_0x45661a,_0x1c5924){return function(_0x56c158){if(_0x56c158){return _0x56c158[_0xbfcb('0x25')](_0x45661a)[_0xbfcb('0x26')](function(_0x2d9288){return _0x2d9288;});}return null;};}function removeEntity(_0xd4d29,_0x1651e5){return function(_0x19616c){if(_0x19616c){return _0x19616c[_0xbfcb('0x27')]()[_0xbfcb('0x26')](function(){_0xd4d29[_0xbfcb('0x1c')](0xcc)[_0xbfcb('0x1b')]();});}};}function handleEntityNotFound(_0x1ca8c3,_0xf6dbb7){return function(_0x3ef71c){if(!_0x3ef71c){_0x1ca8c3[_0xbfcb('0x1a')](0x194);}return _0x3ef71c;};}function handleError(_0x3e954d,_0x2a1272){_0x2a1272=_0x2a1272||0x1f4;return function(_0x5cd703){logger[_0xbfcb('0x28')](_0x5cd703[_0xbfcb('0x29')]);if(_0x5cd703['name']){delete _0x5cd703[_0xbfcb('0x2a')];}_0x3e954d[_0xbfcb('0x1c')](_0x2a1272)[_0xbfcb('0x2b')](_0x5cd703);};}exports[_0xbfcb('0x2c')]=function(_0xf4b944,_0x3542e9){var _0x4069a7={},_0x1a5db2={},_0x434764={'count':0x0,'rows':[]};var _0x27606f=_['map'](db[_0xbfcb('0x2d')][_0xbfcb('0x2e')],function(_0x43c3c3){return{'name':_0x43c3c3[_0xbfcb('0x2f')],'type':_0x43c3c3[_0xbfcb('0x30')][_0xbfcb('0x31')]};});_0x1a5db2[_0xbfcb('0x32')]=_[_0xbfcb('0x33')](_0x27606f,_0xbfcb('0x2a'));_0x1a5db2['query']=_[_0xbfcb('0x34')](_0xf4b944[_0xbfcb('0x35')]);_0x1a5db2[_0xbfcb('0x36')]=_[_0xbfcb('0x37')](_0x1a5db2['model'],_0x1a5db2['query']);_0x4069a7[_0xbfcb('0x38')]=_[_0xbfcb('0x37')](_0x1a5db2[_0xbfcb('0x32')],qs[_0xbfcb('0x39')](_0xf4b944[_0xbfcb('0x35')][_0xbfcb('0x39')]));_0x4069a7[_0xbfcb('0x38')]=_0x4069a7['attributes']['length']?_0x4069a7['attributes']:_0x1a5db2[_0xbfcb('0x32')];if(!_0xf4b944['query'][_0xbfcb('0x3a')](_0xbfcb('0x3b'))){_0x4069a7['limit']=qs['limit'](_0xf4b944[_0xbfcb('0x35')][_0xbfcb('0x20')]);_0x4069a7[_0xbfcb('0x1e')]=qs[_0xbfcb('0x1e')](_0xf4b944['query'][_0xbfcb('0x1e')]);}_0x4069a7[_0xbfcb('0x3c')]=qs['sort'](_0xf4b944['query'][_0xbfcb('0x3d')]);_0x4069a7['where']=qs['filters'](_[_0xbfcb('0x3e')](_0xf4b944[_0xbfcb('0x35')],_0x1a5db2[_0xbfcb('0x36')]),_0x27606f);if(_0xf4b944[_0xbfcb('0x35')]['filter']){_0x4069a7[_0xbfcb('0x3f')]=_[_0xbfcb('0x40')](_0x4069a7[_0xbfcb('0x3f')],{'$or':_[_0xbfcb('0x33')](_0x27606f,function(_0x2289fd){if(_0x2289fd[_0xbfcb('0x30')]!=='VIRTUAL'){var _0x2fc01f={};_0x2fc01f[_0x2289fd['name']]={'$like':'%'+_0xf4b944[_0xbfcb('0x35')]['filter']+'%'};return _0x2fc01f;}})});}_0x4069a7=_[_0xbfcb('0x40')]({},_0x4069a7,_0xf4b944[_0xbfcb('0x41')]);var _0xe719cd={'where':_0x4069a7[_0xbfcb('0x3f')]};return db[_0xbfcb('0x2d')][_0xbfcb('0x21')](_0xe719cd)[_0xbfcb('0x26')](function(_0x149bd5){_0x434764[_0xbfcb('0x21')]=_0x149bd5;if(_0xf4b944[_0xbfcb('0x35')]['includeAll']){_0x4069a7[_0xbfcb('0x42')]=[{'all':!![]}];}return db[_0xbfcb('0x2d')]['findAll'](_0x4069a7);})[_0xbfcb('0x26')](function(_0x306ea4){_0x434764[_0xbfcb('0x43')]=_0x306ea4;return _0x434764;})[_0xbfcb('0x26')](respondWithFilteredResult(_0x3542e9,_0x4069a7))[_0xbfcb('0x44')](handleError(_0x3542e9,null));};exports[_0xbfcb('0x45')]=function(_0x500e7c,_0x96691c){var _0x10ffa0={'raw':!![],'where':{'id':_0x500e7c['params']['id']}},_0x10ea4f={};_0x10ea4f[_0xbfcb('0x32')]=_[_0xbfcb('0x34')](db[_0xbfcb('0x2d')]['rawAttributes']);_0x10ea4f[_0xbfcb('0x35')]=_[_0xbfcb('0x34')](_0x500e7c['query']);_0x10ea4f['filters']=_[_0xbfcb('0x37')](_0x10ea4f[_0xbfcb('0x32')],_0x10ea4f['query']);_0x10ffa0[_0xbfcb('0x38')]=_[_0xbfcb('0x37')](_0x10ea4f['model'],qs[_0xbfcb('0x39')](_0x500e7c[_0xbfcb('0x35')][_0xbfcb('0x39')]));_0x10ffa0[_0xbfcb('0x38')]=_0x10ffa0[_0xbfcb('0x38')][_0xbfcb('0x46')]?_0x10ffa0[_0xbfcb('0x38')]:_0x10ea4f[_0xbfcb('0x32')];if(_0x500e7c[_0xbfcb('0x35')][_0xbfcb('0x47')]){_0x10ffa0[_0xbfcb('0x42')]=[{'all':!![]}];}_0x10ffa0=_[_0xbfcb('0x40')]({},_0x10ffa0,_0x500e7c['options']);return db[_0xbfcb('0x2d')][_0xbfcb('0x48')](_0x10ffa0)[_0xbfcb('0x26')](handleEntityNotFound(_0x96691c,null))['then'](respondWithResult(_0x96691c,null))[_0xbfcb('0x44')](handleError(_0x96691c,null));};exports['create']=function(_0x4a3b40,_0x2dcfb3){return db[_0xbfcb('0x2d')][_0xbfcb('0x49')](_0x4a3b40['body'],{})[_0xbfcb('0x26')](respondWithResult(_0x2dcfb3,0xc9))['catch'](handleError(_0x2dcfb3,null));};exports['update']=function(_0x33725a,_0x588d32){if(_0x33725a[_0xbfcb('0x4a')]['id']){delete _0x33725a[_0xbfcb('0x4a')]['id'];}return db['MailQueueReport'][_0xbfcb('0x48')]({'where':{'id':_0x33725a['params']['id']}})[_0xbfcb('0x26')](handleEntityNotFound(_0x588d32,null))['then'](saveUpdates(_0x33725a[_0xbfcb('0x4a')],null))['then'](respondWithResult(_0x588d32,null))[_0xbfcb('0x44')](handleError(_0x588d32,null));};exports[_0xbfcb('0x27')]=function(_0x5efbe1,_0x131af7){return db['MailQueueReport']['find']({'where':{'id':_0x5efbe1[_0xbfcb('0x4b')]['id']}})[_0xbfcb('0x26')](handleEntityNotFound(_0x131af7,null))[_0xbfcb('0x26')](removeEntity(_0x131af7,null))['catch'](handleError(_0x131af7,null));};exports['describe']=function(_0x19dca9,_0x931bf){return db[_0xbfcb('0x2d')][_0xbfcb('0x4c')]()[_0xbfcb('0x26')](respondWithResult(_0x931bf,null))['catch'](handleError(_0x931bf,null));}; \ No newline at end of file +var _0x25e7=['params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','MailQueueReport','findAll','rows','catch','show','fields','create','body','update','find'];(function(_0x1107d8,_0x114c00){var _0x38984b=function(_0x48d956){while(--_0x48d956){_0x1107d8['push'](_0x1107d8['shift']());}};_0x38984b(++_0x114c00);}(_0x25e7,0x1d6));var _0x725e=function(_0x1118da,_0x2fde4c){_0x1118da=_0x1118da-0x0;var _0x7374da=_0x25e7[_0x1118da];return _0x7374da;};'use strict';var emlformat=require(_0x725e('0x0'));var rimraf=require(_0x725e('0x1'));var zipdir=require(_0x725e('0x2'));var jsonpatch=require(_0x725e('0x3'));var rp=require(_0x725e('0x4'));var moment=require(_0x725e('0x5'));var BPromise=require(_0x725e('0x6'));var Mustache=require(_0x725e('0x7'));var util=require(_0x725e('0x8'));var path=require(_0x725e('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x725e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x725e('0xb'));var crypto=require(_0x725e('0xc'));var jsforce=require(_0x725e('0xd'));var deskjs=require(_0x725e('0xe'));var toCsv=require(_0x725e('0xf'));var querystring=require(_0x725e('0x10'));var Papa=require(_0x725e('0x11'));var Redis=require(_0x725e('0x12'));var authService=require(_0x725e('0x13'));var qs=require(_0x725e('0x14'));var as=require(_0x725e('0x15'));var hardwareService=require(_0x725e('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x725e('0x17'));var config=require(_0x725e('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11916d,_0x14218e){_0x14218e=_0x14218e||0xcc;return function(_0x5c5e44){if(_0x5c5e44){return _0x11916d[_0x725e('0x19')](_0x14218e);}return _0x11916d[_0x725e('0x1a')](_0x14218e)[_0x725e('0x1b')]();};}function respondWithResult(_0x4e0515,_0x3f8052){_0x3f8052=_0x3f8052||0xc8;return function(_0x221e02){if(_0x221e02){return _0x4e0515[_0x725e('0x1a')](_0x3f8052)[_0x725e('0x1c')](_0x221e02);}};}function respondWithFilteredResult(_0x24c3c1,_0x13fbfe){return function(_0x523422){if(_0x523422){var _0x156b99=typeof _0x13fbfe[_0x725e('0x1d')]===_0x725e('0x1e')&&typeof _0x13fbfe['limit']===_0x725e('0x1e');var _0x125fef=_0x523422[_0x725e('0x1f')];var _0x397e33=_0x156b99?0x0:_0x13fbfe[_0x725e('0x1d')];var _0x2811e7=_0x156b99?_0x523422['count']:_0x13fbfe[_0x725e('0x1d')]+_0x13fbfe[_0x725e('0x20')];var _0x1b8879;if(_0x2811e7>=_0x125fef){_0x2811e7=_0x125fef;_0x1b8879=0xc8;}else{_0x1b8879=0xce;}_0x24c3c1[_0x725e('0x1a')](_0x1b8879);return _0x24c3c1[_0x725e('0x21')](_0x725e('0x22'),_0x397e33+'-'+_0x2811e7+'/'+_0x125fef)['json'](_0x523422);}return null;};}function patchUpdates(_0x2fc416){return function(_0xd30de9){try{jsonpatch[_0x725e('0x23')](_0xd30de9,_0x2fc416,!![]);}catch(_0x40c21b){return BPromise[_0x725e('0x24')](_0x40c21b);}return _0xd30de9[_0x725e('0x25')]();};}function saveUpdates(_0x127c99,_0x262b01){return function(_0x7d0792){if(_0x7d0792){return _0x7d0792['update'](_0x127c99)[_0x725e('0x26')](function(_0x36cbab){return _0x36cbab;});}return null;};}function removeEntity(_0x389668,_0x3facae){return function(_0x5a8191){if(_0x5a8191){return _0x5a8191[_0x725e('0x27')]()['then'](function(){_0x389668['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2aad7b,_0x1cbaae){return function(_0x2d3c55){if(!_0x2d3c55){_0x2aad7b['sendStatus'](0x194);}return _0x2d3c55;};}function handleError(_0xab6cfd,_0x8a138f){_0x8a138f=_0x8a138f||0x1f4;return function(_0x5a5bef){logger[_0x725e('0x28')](_0x5a5bef[_0x725e('0x29')]);if(_0x5a5bef['name']){delete _0x5a5bef[_0x725e('0x2a')];}_0xab6cfd['status'](_0x8a138f)['send'](_0x5a5bef);};}exports[_0x725e('0x2b')]=function(_0x5b8dec,_0x3b42bd){var _0x4cc4ad={},_0x4de2e0={},_0x9b5b7f={'count':0x0,'rows':[]};var _0x31a8ff=_[_0x725e('0x2c')](db['MailQueueReport'][_0x725e('0x2d')],function(_0x5b03d9){return{'name':_0x5b03d9[_0x725e('0x2e')],'type':_0x5b03d9[_0x725e('0x2f')][_0x725e('0x30')]};});_0x4de2e0[_0x725e('0x31')]=_[_0x725e('0x2c')](_0x31a8ff,_0x725e('0x2a'));_0x4de2e0[_0x725e('0x32')]=_[_0x725e('0x33')](_0x5b8dec[_0x725e('0x32')]);_0x4de2e0[_0x725e('0x34')]=_[_0x725e('0x35')](_0x4de2e0['model'],_0x4de2e0[_0x725e('0x32')]);_0x4cc4ad[_0x725e('0x36')]=_['intersection'](_0x4de2e0[_0x725e('0x31')],qs['fields'](_0x5b8dec[_0x725e('0x32')]['fields']));_0x4cc4ad[_0x725e('0x36')]=_0x4cc4ad[_0x725e('0x36')][_0x725e('0x37')]?_0x4cc4ad[_0x725e('0x36')]:_0x4de2e0[_0x725e('0x31')];if(!_0x5b8dec[_0x725e('0x32')]['hasOwnProperty']('nolimit')){_0x4cc4ad[_0x725e('0x20')]=qs[_0x725e('0x20')](_0x5b8dec[_0x725e('0x32')]['limit']);_0x4cc4ad[_0x725e('0x1d')]=qs['offset'](_0x5b8dec[_0x725e('0x32')][_0x725e('0x1d')]);}_0x4cc4ad[_0x725e('0x38')]=qs[_0x725e('0x39')](_0x5b8dec['query']['sort']);_0x4cc4ad[_0x725e('0x3a')]=qs[_0x725e('0x34')](_[_0x725e('0x3b')](_0x5b8dec['query'],_0x4de2e0[_0x725e('0x34')]),_0x31a8ff);if(_0x5b8dec[_0x725e('0x32')][_0x725e('0x3c')]){_0x4cc4ad['where']=_[_0x725e('0x3d')](_0x4cc4ad['where'],{'$or':_[_0x725e('0x2c')](_0x31a8ff,function(_0x462dac){if(_0x462dac[_0x725e('0x2f')]!==_0x725e('0x3e')){var _0x46eaa0={};_0x46eaa0[_0x462dac['name']]={'$like':'%'+_0x5b8dec['query'][_0x725e('0x3c')]+'%'};return _0x46eaa0;}})});}_0x4cc4ad=_[_0x725e('0x3d')]({},_0x4cc4ad,_0x5b8dec[_0x725e('0x3f')]);var _0x5dd1d1={'where':_0x4cc4ad[_0x725e('0x3a')]};return db['MailQueueReport'][_0x725e('0x1f')](_0x5dd1d1)[_0x725e('0x26')](function(_0x337e53){_0x9b5b7f[_0x725e('0x1f')]=_0x337e53;if(_0x5b8dec['query'][_0x725e('0x40')]){_0x4cc4ad[_0x725e('0x41')]=[{'all':!![]}];}return db[_0x725e('0x42')][_0x725e('0x43')](_0x4cc4ad);})[_0x725e('0x26')](function(_0x19ed0a){_0x9b5b7f[_0x725e('0x44')]=_0x19ed0a;return _0x9b5b7f;})['then'](respondWithFilteredResult(_0x3b42bd,_0x4cc4ad))[_0x725e('0x45')](handleError(_0x3b42bd,null));};exports[_0x725e('0x46')]=function(_0x58ebe3,_0x2200ad){var _0x3b7a87={'raw':!![],'where':{'id':_0x58ebe3['params']['id']}},_0x5e719e={};_0x5e719e['model']=_['keys'](db[_0x725e('0x42')][_0x725e('0x2d')]);_0x5e719e[_0x725e('0x32')]=_['keys'](_0x58ebe3[_0x725e('0x32')]);_0x5e719e['filters']=_['intersection'](_0x5e719e[_0x725e('0x31')],_0x5e719e[_0x725e('0x32')]);_0x3b7a87[_0x725e('0x36')]=_[_0x725e('0x35')](_0x5e719e[_0x725e('0x31')],qs[_0x725e('0x47')](_0x58ebe3['query'][_0x725e('0x47')]));_0x3b7a87['attributes']=_0x3b7a87[_0x725e('0x36')][_0x725e('0x37')]?_0x3b7a87['attributes']:_0x5e719e[_0x725e('0x31')];if(_0x58ebe3['query'][_0x725e('0x40')]){_0x3b7a87[_0x725e('0x41')]=[{'all':!![]}];}_0x3b7a87=_['merge']({},_0x3b7a87,_0x58ebe3['options']);return db[_0x725e('0x42')]['find'](_0x3b7a87)[_0x725e('0x26')](handleEntityNotFound(_0x2200ad,null))['then'](respondWithResult(_0x2200ad,null))['catch'](handleError(_0x2200ad,null));};exports['create']=function(_0x118ef5,_0x38a81f){return db['MailQueueReport'][_0x725e('0x48')](_0x118ef5[_0x725e('0x49')],{})['then'](respondWithResult(_0x38a81f,0xc9))[_0x725e('0x45')](handleError(_0x38a81f,null));};exports[_0x725e('0x4a')]=function(_0x4d5415,_0x19f524){if(_0x4d5415[_0x725e('0x49')]['id']){delete _0x4d5415[_0x725e('0x49')]['id'];}return db[_0x725e('0x42')][_0x725e('0x4b')]({'where':{'id':_0x4d5415[_0x725e('0x4c')]['id']}})[_0x725e('0x26')](handleEntityNotFound(_0x19f524,null))[_0x725e('0x26')](saveUpdates(_0x4d5415[_0x725e('0x49')],null))[_0x725e('0x26')](respondWithResult(_0x19f524,null))['catch'](handleError(_0x19f524,null));};exports[_0x725e('0x27')]=function(_0x5e3678,_0x11e2f7){return db[_0x725e('0x42')][_0x725e('0x4b')]({'where':{'id':_0x5e3678[_0x725e('0x4c')]['id']}})[_0x725e('0x26')](handleEntityNotFound(_0x11e2f7,null))[_0x725e('0x26')](removeEntity(_0x11e2f7,null))[_0x725e('0x45')](handleError(_0x11e2f7,null));};exports[_0x725e('0x4d')]=function(_0x1f3097,_0xd366b9){return db[_0x725e('0x42')][_0x725e('0x4d')]()[_0x725e('0x26')](respondWithResult(_0xd366b9,null))[_0x725e('0x45')](handleError(_0xd366b9,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 068606c..b57ac58 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 _0xb715=['./mailQueueReport.attributes','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x144d9b,_0x5414e3){var _0x2fd543=function(_0x303772){while(--_0x303772){_0x144d9b['push'](_0x144d9b['shift']());}};_0x2fd543(++_0x5414e3);}(_0xb715,0x1e4));var _0x5b71=function(_0x599682,_0xdd7fb3){_0x599682=_0x599682-0x0;var _0x56a8df=_0xb715[_0x599682];return _0x56a8df;};'use strict';var _=require(_0x5b71('0x0'));var util=require(_0x5b71('0x1'));var logger=require(_0x5b71('0x2'))(_0x5b71('0x3'));var moment=require('moment');var BPromise=require(_0x5b71('0x4'));var rp=require(_0x5b71('0x5'));var fs=require('fs');var path=require(_0x5b71('0x6'));var rimraf=require('rimraf');var config=require(_0x5b71('0x7'));var attributes=require(_0x5b71('0x8'));module['exports']=function(_0x34c2ae,_0x4b2840){return _0x34c2ae['define'](_0x5b71('0x9'),attributes,{'tableName':_0x5b71('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5b71('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xff67=['path','rimraf','../../config/environment','exports','MailQueueReport','report_mail_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0x3804da,_0x4b1678){var _0x1038e3=function(_0x46dbaf){while(--_0x46dbaf){_0x3804da['push'](_0x3804da['shift']());}};_0x1038e3(++_0x4b1678);}(_0xff67,0x1b7));var _0x7ff6=function(_0x23281f,_0x1d8dc1){_0x23281f=_0x23281f-0x0;var _0x5ad381=_0xff67[_0x23281f];return _0x5ad381;};'use strict';var _=require(_0x7ff6('0x0'));var util=require('util');var logger=require(_0x7ff6('0x1'))(_0x7ff6('0x2'));var moment=require(_0x7ff6('0x3'));var BPromise=require(_0x7ff6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7ff6('0x5'));var rimraf=require(_0x7ff6('0x6'));var config=require(_0x7ff6('0x7'));var attributes=require('./mailQueueReport.attributes');module[_0x7ff6('0x8')]=function(_0x3342d7,_0x4cc1dd){return _0x3342d7['define'](_0x7ff6('0x9'),attributes,{'tableName':_0x7ff6('0xa'),'paranoid':![],'indexes':[{'name':_0x7ff6('0xb'),'fields':[_0x7ff6('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 4f91379..0c2bfec 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0xd7e057,_0xd71681){var _0x4f8e85=function(_0x24f7c8){while(--_0x24f7c8){_0xd7e057['push'](_0xd7e057['shift']());}};_0x4f8e85(++_0xd71681);}(_0xdb28,0x106));var _0x8db2=function(_0x4ef473,_0x157ff7){_0x4ef473=_0x4ef473-0x0;var _0x315db5=_0xdb28[_0x4ef473];return _0x315db5;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file +var _0x326f=['error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','options','raw','stringify','UpdateMailQueueReport','body','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2e730b,_0x438b8a){var _0x5b1c22=function(_0x49dbdd){while(--_0x49dbdd){_0x2e730b['push'](_0x2e730b['shift']());}};_0x5b1c22(++_0x438b8a);}(_0x326f,0xd1));var _0xf326=function(_0x46c9b1,_0x516577){_0x46c9b1=_0x46c9b1-0x0;var _0x3ebffe=_0x326f[_0x46c9b1];return _0x3ebffe;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 7e8beb3..75d6df5 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1909f9,_0x1795ef){var _0x4fc488=function(_0x4fb79a){while(--_0x4fb79a){_0x1909f9['push'](_0x1909f9['shift']());}};_0x4fc488(++_0x1795ef);}(_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'));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(_0x1720f6,_0x5e9128){var _0x46e9fd=function(_0x4e3c53){while(--_0x4e3c53){_0x1720f6['push'](_0x1720f6['shift']());}};_0x46e9fd(++_0x5e9128);}(_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 c38e1ea..d41701b 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 _0xcffe=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x5e2e76,_0x6a8d61){var _0x2bbe52=function(_0xe40705){while(--_0xe40705){_0x5e2e76['push'](_0x5e2e76['shift']());}};_0x2bbe52(++_0x6a8d61);}(_0xcffe,0x1a1));var _0xecff=function(_0x54496d,_0x5b8572){_0x54496d=_0x54496d-0x0;var _0x40e626=_0xcffe[_0x54496d];return _0x40e626;};'use strict';var Sequelize=require(_0xecff('0x0'));module[_0xecff('0x1')]={'description':{'type':Sequelize[_0xecff('0x2')]},'host':{'type':Sequelize[_0xecff('0x2')]},'authentication':{'type':Sequelize[_0xecff('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xecff('0x2')]},'password':{'type':Sequelize[_0xecff('0x2')]},'port':{'type':Sequelize[_0xecff('0x4')]},'tls':{'type':Sequelize[_0xecff('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xecff('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xecff('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xecff('0x2')]}}; \ No newline at end of file +var _0x049e=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x5b474c,_0x426d87){var _0x273b2c=function(_0x2a3fcf){while(--_0x2a3fcf){_0x5b474c['push'](_0x5b474c['shift']());}};_0x273b2c(++_0x426d87);}(_0x049e,0x16a));var _0xe049=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0x049e[_0x310504];return _0x5b36d0;};'use strict';var Sequelize=require(_0xe049('0x0'));module[_0xe049('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xe049('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0xe049('0x2')]},'password':{'type':Sequelize[_0xe049('0x2')]},'port':{'type':Sequelize[_0xe049('0x3')]},'tls':{'type':Sequelize[_0xe049('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xe049('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xe049('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xe049('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0xe049('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 16d2283..773004a 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 _0x89d1=['api','moment','path','../../config/environment','exports','MailServerIn','util','../../config/logger'];(function(_0x14b0d6,_0xc0d4be){var _0x57b90b=function(_0x589ea1){while(--_0x589ea1){_0x14b0d6['push'](_0x14b0d6['shift']());}};_0x57b90b(++_0xc0d4be);}(_0x89d1,0x19e));var _0x189d=function(_0x3c8c6a,_0x8d7c6c){_0x3c8c6a=_0x3c8c6a-0x0;var _0x412c89=_0x89d1[_0x3c8c6a];return _0x412c89;};'use strict';var _=require('lodash');var util=require(_0x189d('0x0'));var logger=require(_0x189d('0x1'))(_0x189d('0x2'));var moment=require(_0x189d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x189d('0x4'));var rimraf=require('rimraf');var config=require(_0x189d('0x5'));var attributes=require('./mailServerIn.attributes');module[_0x189d('0x6')]=function(_0x51ac33,_0x5bbf92){return _0x51ac33['define'](_0x189d('0x7'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x649e=['mail_servers_in','util','api','moment','bluebird','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x649e,0x1f0));var _0xe649=function(_0x2df8e3,_0x5f0382){_0x2df8e3=_0x2df8e3-0x0;var _0x111523=_0x649e[_0x2df8e3];return _0x111523;};'use strict';var _=require('lodash');var util=require(_0xe649('0x0'));var logger=require('../../config/logger')(_0xe649('0x1'));var moment=require(_0xe649('0x2'));var BPromise=require(_0xe649('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe649('0x4'));var config=require(_0xe649('0x5'));var attributes=require(_0xe649('0x6'));module[_0xe649('0x7')]=function(_0x4a9c54,_0x64890c){return _0x4a9c54[_0xe649('0x8')](_0xe649('0x9'),attributes,{'tableName':_0xe649('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index f3ee0aa..4c84e7a 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 _0x6a72=['options','where','attributes','limit','map','include','model','debug','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerIn,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetMailServerIn','MailServerIn','findAll'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6a72,0x118));var _0x26a7=function(_0x3986fc,_0x41fd49){_0x3986fc=_0x3986fc-0x0;var _0x514bd1=_0x6a72[_0x3986fc];return _0x514bd1;};'use strict';var _=require(_0x26a7('0x0'));var util=require(_0x26a7('0x1'));var moment=require(_0x26a7('0x2'));var BPromise=require('bluebird');var rs=require(_0x26a7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x26a7('0x4'))['db'];var utils=require(_0x26a7('0x5'));var logger=require(_0x26a7('0x6'))(_0x26a7('0x7'));var config=require(_0x26a7('0x8'));var jayson=require(_0x26a7('0x9'));var client=jayson[_0x26a7('0xa')][_0x26a7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ae95c,_0x20e058,_0x46dbc0){return new BPromise(function(_0x5115c5,_0x7fa77b){return client[_0x26a7('0xc')](_0x4ae95c,_0x46dbc0)[_0x26a7('0xd')](function(_0x274dbf){logger['info'](_0x26a7('0xe'),_0x20e058,_0x26a7('0xf'));logger['debug']('MailServerIn,\x20%s,\x20%s,\x20%s',_0x20e058,_0x26a7('0xf'),JSON[_0x26a7('0x10')](_0x274dbf));if(_0x274dbf[_0x26a7('0x11')]){if(_0x274dbf['error'][_0x26a7('0x12')]===0x1f4){logger[_0x26a7('0x11')](_0x26a7('0xe'),_0x20e058,_0x274dbf[_0x26a7('0x11')][_0x26a7('0x13')]);return _0x7fa77b(_0x274dbf['error'][_0x26a7('0x13')]);}logger['error'](_0x26a7('0xe'),_0x20e058,_0x274dbf[_0x26a7('0x11')][_0x26a7('0x13')]);return _0x5115c5(_0x274dbf[_0x26a7('0x11')][_0x26a7('0x13')]);}else{logger[_0x26a7('0x14')](_0x26a7('0xe'),_0x20e058,_0x26a7('0xf'));_0x5115c5(_0x274dbf[_0x26a7('0x15')][_0x26a7('0x13')]);}})[_0x26a7('0x16')](function(_0x19ed18){logger[_0x26a7('0x11')]('MailServerIn,\x20%s,\x20%s',_0x20e058,_0x19ed18);_0x7fa77b(_0x19ed18);});});}exports[_0x26a7('0x17')]=function(_0x22eb67){var _0xb8011d=this;return new Promise(function(_0x36515e,_0x207232){return db[_0x26a7('0x18')][_0x26a7('0x19')]({'raw':_0x22eb67[_0x26a7('0x1a')]?_0x22eb67['options']['raw']===undefined?!![]:![]:!![],'where':_0x22eb67[_0x26a7('0x1a')]?_0x22eb67[_0x26a7('0x1a')][_0x26a7('0x1b')]||null:null,'attributes':_0x22eb67['options']?_0x22eb67[_0x26a7('0x1a')][_0x26a7('0x1c')]||null:null,'limit':_0x22eb67[_0x26a7('0x1a')]?_0x22eb67[_0x26a7('0x1a')][_0x26a7('0x1d')]||null:null,'include':_0x22eb67[_0x26a7('0x1a')]?_0x22eb67[_0x26a7('0x1a')]['include']?_[_0x26a7('0x1e')](_0x22eb67[_0x26a7('0x1a')][_0x26a7('0x1f')],function(_0x499795){return{'model':db[_0x499795[_0x26a7('0x20')]],'as':_0x499795['as'],'attributes':_0x499795['attributes'],'include':_0x499795[_0x26a7('0x1f')]?_[_0x26a7('0x1e')](_0x499795[_0x26a7('0x1f')],function(_0x2ed12c){return{'model':db[_0x2ed12c[_0x26a7('0x20')]],'as':_0x2ed12c['as'],'attributes':_0x2ed12c[_0x26a7('0x1c')],'include':_0x2ed12c['include']?_[_0x26a7('0x1e')](_0x2ed12c[_0x26a7('0x1f')],function(_0x111285){return{'model':db[_0x111285['model']],'as':_0x111285['as'],'attributes':_0x111285[_0x26a7('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x128ec2){logger[_0x26a7('0x14')](_0x26a7('0x17'),_0x22eb67);logger[_0x26a7('0x21')](_0x26a7('0x17'),_0x22eb67,JSON[_0x26a7('0x10')](_0x128ec2));_0x36515e(_0x128ec2);})[_0x26a7('0x16')](function(_0xbd9c83){logger['error'](_0x26a7('0x17'),_0xbd9c83[_0x26a7('0x13')],_0x22eb67);_0x207232(_0xb8011d[_0x26a7('0x11')](0x1f4,_0xbd9c83[_0x26a7('0x13')]));});});}; \ No newline at end of file +var _0x4de5=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','attributes','map','include','model','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4b7cc1,_0x9a7fc0){var _0x33b3d9=function(_0x4b1d6c){while(--_0x4b1d6c){_0x4b7cc1['push'](_0x4b7cc1['shift']());}};_0x33b3d9(++_0x9a7fc0);}(_0x4de5,0xbb));var _0x54de=function(_0x5c7930,_0x47d72b){_0x5c7930=_0x5c7930-0x0;var _0x235c8f=_0x4de5[_0x5c7930];return _0x235c8f;};'use strict';var _=require('lodash');var util=require(_0x54de('0x0'));var moment=require('moment');var BPromise=require(_0x54de('0x1'));var rs=require(_0x54de('0x2'));var fs=require('fs');var Redis=require(_0x54de('0x3'));var db=require(_0x54de('0x4'))['db'];var utils=require(_0x54de('0x5'));var logger=require(_0x54de('0x6'))(_0x54de('0x7'));var config=require(_0x54de('0x8'));var jayson=require(_0x54de('0x9'));var client=jayson['client'][_0x54de('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47a982,_0x1e5d4d,_0x423a72){return new BPromise(function(_0x2e03e7,_0x21718){return client[_0x54de('0xb')](_0x47a982,_0x423a72)[_0x54de('0xc')](function(_0x30dc76){logger[_0x54de('0xd')](_0x54de('0xe'),_0x1e5d4d,_0x54de('0xf'));logger[_0x54de('0x10')](_0x54de('0x11'),_0x1e5d4d,'request\x20sent',JSON[_0x54de('0x12')](_0x30dc76));if(_0x30dc76[_0x54de('0x13')]){if(_0x30dc76[_0x54de('0x13')][_0x54de('0x14')]===0x1f4){logger['error']('MailServerIn,\x20%s,\x20%s',_0x1e5d4d,_0x30dc76['error'][_0x54de('0x15')]);return _0x21718(_0x30dc76[_0x54de('0x13')][_0x54de('0x15')]);}logger[_0x54de('0x13')](_0x54de('0xe'),_0x1e5d4d,_0x30dc76['error'][_0x54de('0x15')]);return _0x2e03e7(_0x30dc76[_0x54de('0x13')][_0x54de('0x15')]);}else{logger[_0x54de('0xd')]('MailServerIn,\x20%s,\x20%s',_0x1e5d4d,'request\x20sent');_0x2e03e7(_0x30dc76[_0x54de('0x16')]['message']);}})[_0x54de('0x17')](function(_0x4f7c7d){logger[_0x54de('0x13')](_0x54de('0xe'),_0x1e5d4d,_0x4f7c7d);_0x21718(_0x4f7c7d);});});}exports[_0x54de('0x18')]=function(_0x2a684d){var _0x4b8d2e=this;return new Promise(function(_0x1d6a57,_0x91a3ee){return db[_0x54de('0x19')][_0x54de('0x1a')]({'raw':_0x2a684d[_0x54de('0x1b')]?_0x2a684d[_0x54de('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2a684d[_0x54de('0x1b')]?_0x2a684d['options']['where']||null:null,'attributes':_0x2a684d[_0x54de('0x1b')]?_0x2a684d[_0x54de('0x1b')][_0x54de('0x1c')]||null:null,'limit':_0x2a684d['options']?_0x2a684d['options']['limit']||null:null,'include':_0x2a684d[_0x54de('0x1b')]?_0x2a684d[_0x54de('0x1b')]['include']?_[_0x54de('0x1d')](_0x2a684d[_0x54de('0x1b')][_0x54de('0x1e')],function(_0x35209b){return{'model':db[_0x35209b['model']],'as':_0x35209b['as'],'attributes':_0x35209b[_0x54de('0x1c')],'include':_0x35209b['include']?_[_0x54de('0x1d')](_0x35209b[_0x54de('0x1e')],function(_0x1bfeb8){return{'model':db[_0x1bfeb8[_0x54de('0x1f')]],'as':_0x1bfeb8['as'],'attributes':_0x1bfeb8[_0x54de('0x1c')],'include':_0x1bfeb8['include']?_['map'](_0x1bfeb8[_0x54de('0x1e')],function(_0x369a10){return{'model':db[_0x369a10[_0x54de('0x1f')]],'as':_0x369a10['as'],'attributes':_0x369a10['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x42ee28){logger[_0x54de('0xd')](_0x54de('0x18'),_0x2a684d);logger[_0x54de('0x10')](_0x54de('0x18'),_0x2a684d,JSON[_0x54de('0x12')](_0x42ee28));_0x1d6a57(_0x42ee28);})['catch'](function(_0x3ceabe){logger['error'](_0x54de('0x18'),_0x3ceabe[_0x54de('0x15')],_0x2a684d);_0x91a3ee(_0x4b8d2e[_0x54de('0x13')](0x1f4,_0x3ceabe[_0x54de('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 382e912..5d7758b 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7a54,0x106));var _0x47a5=function(_0x1a1069,_0x5b63af){_0x1a1069=_0x1a1069-0x0;var _0x17073b=_0x7a54[_0x1a1069];return _0x17073b;};'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 0b63de8..d541268 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 _0x18f6=['STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x19fe61,_0x5e16af){var _0x387685=function(_0x4f242d){while(--_0x4f242d){_0x19fe61['push'](_0x19fe61['shift']());}};_0x387685(++_0x5e16af);}(_0x18f6,0x17f));var _0x618f=function(_0x454142,_0x23cbd2){_0x454142=_0x454142-0x0;var _0x18f8a2=_0x18f6[_0x454142];return _0x18f8a2;};'use strict';var Sequelize=require(_0x618f('0x0'));module['exports']={'description':{'type':Sequelize[_0x618f('0x1')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x618f('0x1')]},'port':{'type':Sequelize[_0x618f('0x2')]},'secure':{'type':Sequelize[_0x618f('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x618f('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xd4ba=['STRING','BOOLEAN','sequelize'];(function(_0x2e0426,_0x344f4d){var _0x3a98e5=function(_0x70fac3){while(--_0x70fac3){_0x2e0426['push'](_0x2e0426['shift']());}};_0x3a98e5(++_0x344f4d);}(_0xd4ba,0x131));var _0xad4b=function(_0x29f9cb,_0x58c553){_0x29f9cb=_0x29f9cb-0x0;var _0x46eb4b=_0xd4ba[_0x29f9cb];return _0x46eb4b;};'use strict';var Sequelize=require(_0xad4b('0x0'));module['exports']={'description':{'type':Sequelize[_0xad4b('0x1')]},'host':{'type':Sequelize[_0xad4b('0x1')]},'user':{'type':Sequelize[_0xad4b('0x1')]},'pass':{'type':Sequelize[_0xad4b('0x1')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0xad4b('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0xad4b('0x1')]},'authentication':{'type':Sequelize[_0xad4b('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 6260836..794e117 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 _0x5316=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','end','error','stack','name','index','map','MailServerOut','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x4ae63d,_0x152404){var _0x4c1e01=function(_0x58cb7e){while(--_0x58cb7e){_0x4ae63d['push'](_0x4ae63d['shift']());}};_0x4c1e01(++_0x152404);}(_0x5316,0x16f));var _0x6531=function(_0x574159,_0x952110){_0x574159=_0x574159-0x0;var _0x5dd226=_0x5316[_0x574159];return _0x5dd226;};'use strict';var emlformat=require(_0x6531('0x0'));var rimraf=require(_0x6531('0x1'));var zipdir=require(_0x6531('0x2'));var jsonpatch=require(_0x6531('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6531('0x4'));var path=require(_0x6531('0x5'));var sox=require(_0x6531('0x6'));var csv=require(_0x6531('0x7'));var ejs=require(_0x6531('0x8'));var fs=require('fs');var fs_extra=require(_0x6531('0x9'));var _=require('lodash');var squel=require(_0x6531('0xa'));var crypto=require(_0x6531('0xb'));var jsforce=require(_0x6531('0xc'));var deskjs=require(_0x6531('0xd'));var toCsv=require(_0x6531('0x7'));var querystring=require('querystring');var Papa=require(_0x6531('0xe'));var Redis=require(_0x6531('0xf'));var authService=require(_0x6531('0x10'));var qs=require(_0x6531('0x11'));var as=require(_0x6531('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6531('0x13'))(_0x6531('0x14'));var utils=require(_0x6531('0x15'));var config=require(_0x6531('0x16'));var licenseUtil=require(_0x6531('0x17'));var db=require(_0x6531('0x18'))['db'];function respondWithStatusCode(_0x59d818,_0x3609cf){_0x3609cf=_0x3609cf||0xcc;return function(_0x10f196){if(_0x10f196){return _0x59d818[_0x6531('0x19')](_0x3609cf);}return _0x59d818[_0x6531('0x1a')](_0x3609cf)['end']();};}function respondWithResult(_0x139da5,_0x1c4346){_0x1c4346=_0x1c4346||0xc8;return function(_0x47864b){if(_0x47864b){return _0x139da5[_0x6531('0x1a')](_0x1c4346)[_0x6531('0x1b')](_0x47864b);}};}function respondWithFilteredResult(_0x2c7592,_0x592af1){return function(_0x480527){if(_0x480527){var _0x368ac9=typeof _0x592af1[_0x6531('0x1c')]===_0x6531('0x1d')&&typeof _0x592af1[_0x6531('0x1e')]===_0x6531('0x1d');var _0x3f0da0=_0x480527['count'];var _0xa4b5a2=_0x368ac9?0x0:_0x592af1['offset'];var _0x18f711=_0x368ac9?_0x480527[_0x6531('0x1f')]:_0x592af1['offset']+_0x592af1['limit'];var _0x3e7485;if(_0x18f711>=_0x3f0da0){_0x18f711=_0x3f0da0;_0x3e7485=0xc8;}else{_0x3e7485=0xce;}_0x2c7592[_0x6531('0x1a')](_0x3e7485);return _0x2c7592[_0x6531('0x20')](_0x6531('0x21'),_0xa4b5a2+'-'+_0x18f711+'/'+_0x3f0da0)[_0x6531('0x1b')](_0x480527);}return null;};}function patchUpdates(_0x107019){return function(_0x24239f){try{jsonpatch[_0x6531('0x22')](_0x24239f,_0x107019,!![]);}catch(_0x48653b){return BPromise['reject'](_0x48653b);}return _0x24239f[_0x6531('0x23')]();};}function saveUpdates(_0x53d46e,_0x3dc2d0){return function(_0x34b24c){if(_0x34b24c){return _0x34b24c['update'](_0x53d46e)[_0x6531('0x24')](function(_0xc307f7){return _0xc307f7;});}return null;};}function removeEntity(_0x32430d,_0x50dd99){return function(_0x239de2){if(_0x239de2){return _0x239de2[_0x6531('0x25')]()[_0x6531('0x24')](function(){_0x32430d[_0x6531('0x1a')](0xcc)[_0x6531('0x26')]();});}};}function handleEntityNotFound(_0xe77a33,_0xa2b75d){return function(_0x2f2688){if(!_0x2f2688){_0xe77a33[_0x6531('0x19')](0x194);}return _0x2f2688;};}function handleError(_0x419e79,_0x4cbe28){_0x4cbe28=_0x4cbe28||0x1f4;return function(_0x2ceb0b){logger[_0x6531('0x27')](_0x2ceb0b[_0x6531('0x28')]);if(_0x2ceb0b[_0x6531('0x29')]){delete _0x2ceb0b[_0x6531('0x29')];}_0x419e79['status'](_0x4cbe28)['send'](_0x2ceb0b);};}exports[_0x6531('0x2a')]=function(_0x2dfb72,_0x3add76){var _0xbe6af6={},_0x47b1ee={},_0x591e4c={'count':0x0,'rows':[]};var _0x45d40a=_[_0x6531('0x2b')](db[_0x6531('0x2c')][_0x6531('0x2d')],function(_0x32a62b){return{'name':_0x32a62b[_0x6531('0x2e')],'type':_0x32a62b[_0x6531('0x2f')][_0x6531('0x30')]};});_0x47b1ee['model']=_[_0x6531('0x2b')](_0x45d40a,_0x6531('0x29'));_0x47b1ee[_0x6531('0x31')]=_['keys'](_0x2dfb72['query']);_0x47b1ee[_0x6531('0x32')]=_[_0x6531('0x33')](_0x47b1ee[_0x6531('0x34')],_0x47b1ee[_0x6531('0x31')]);_0xbe6af6['attributes']=_[_0x6531('0x33')](_0x47b1ee[_0x6531('0x34')],qs[_0x6531('0x35')](_0x2dfb72[_0x6531('0x31')]['fields']));_0xbe6af6[_0x6531('0x36')]=_0xbe6af6[_0x6531('0x36')][_0x6531('0x37')]?_0xbe6af6[_0x6531('0x36')]:_0x47b1ee[_0x6531('0x34')];if(!_0x2dfb72[_0x6531('0x31')][_0x6531('0x38')](_0x6531('0x39'))){_0xbe6af6['limit']=qs[_0x6531('0x1e')](_0x2dfb72[_0x6531('0x31')][_0x6531('0x1e')]);_0xbe6af6['offset']=qs['offset'](_0x2dfb72[_0x6531('0x31')]['offset']);}_0xbe6af6[_0x6531('0x3a')]=qs[_0x6531('0x3b')](_0x2dfb72['query']['sort']);_0xbe6af6[_0x6531('0x3c')]=qs[_0x6531('0x32')](_[_0x6531('0x3d')](_0x2dfb72[_0x6531('0x31')],_0x47b1ee[_0x6531('0x32')]),_0x45d40a);if(_0x2dfb72[_0x6531('0x31')][_0x6531('0x3e')]){_0xbe6af6[_0x6531('0x3c')]=_[_0x6531('0x3f')](_0xbe6af6[_0x6531('0x3c')],{'$or':_[_0x6531('0x2b')](_0x45d40a,function(_0x111135){if(_0x111135[_0x6531('0x2f')]!=='VIRTUAL'){var _0x326a7b={};_0x326a7b[_0x111135[_0x6531('0x29')]]={'$like':'%'+_0x2dfb72[_0x6531('0x31')][_0x6531('0x3e')]+'%'};return _0x326a7b;}})});}_0xbe6af6=_[_0x6531('0x3f')]({},_0xbe6af6,_0x2dfb72['options']);var _0x43ef53={'where':_0xbe6af6[_0x6531('0x3c')]};return db[_0x6531('0x2c')][_0x6531('0x1f')](_0x43ef53)['then'](function(_0x2a2613){_0x591e4c['count']=_0x2a2613;if(_0x2dfb72[_0x6531('0x31')][_0x6531('0x40')]){_0xbe6af6[_0x6531('0x41')]=[{'all':!![]}];}return db[_0x6531('0x2c')][_0x6531('0x42')](_0xbe6af6);})[_0x6531('0x24')](function(_0x41bd0b){_0x591e4c[_0x6531('0x43')]=_0x41bd0b;return _0x591e4c;})[_0x6531('0x24')](respondWithFilteredResult(_0x3add76,_0xbe6af6))[_0x6531('0x44')](handleError(_0x3add76,null));};exports[_0x6531('0x45')]=function(_0x45c2c2,_0x2e388e){var _0x3f78b1={'raw':!![],'where':{'id':_0x45c2c2[_0x6531('0x46')]['id']}},_0x208558={};_0x208558[_0x6531('0x34')]=_['keys'](db['MailServerOut']['rawAttributes']);_0x208558[_0x6531('0x31')]=_[_0x6531('0x47')](_0x45c2c2[_0x6531('0x31')]);_0x208558['filters']=_['intersection'](_0x208558[_0x6531('0x34')],_0x208558['query']);_0x3f78b1[_0x6531('0x36')]=_[_0x6531('0x33')](_0x208558[_0x6531('0x34')],qs[_0x6531('0x35')](_0x45c2c2[_0x6531('0x31')][_0x6531('0x35')]));_0x3f78b1['attributes']=_0x3f78b1[_0x6531('0x36')]['length']?_0x3f78b1['attributes']:_0x208558[_0x6531('0x34')];if(_0x45c2c2[_0x6531('0x31')][_0x6531('0x40')]){_0x3f78b1['include']=[{'all':!![]}];}_0x3f78b1=_['merge']({},_0x3f78b1,_0x45c2c2[_0x6531('0x48')]);return db['MailServerOut']['find'](_0x3f78b1)[_0x6531('0x24')](handleEntityNotFound(_0x2e388e,null))[_0x6531('0x24')](respondWithResult(_0x2e388e,null))[_0x6531('0x44')](handleError(_0x2e388e,null));};exports['create']=function(_0x247501,_0x13f6cf){return db['MailServerOut'][_0x6531('0x49')](_0x247501[_0x6531('0x4a')],{})['then'](respondWithResult(_0x13f6cf,0xc9))[_0x6531('0x44')](handleError(_0x13f6cf,null));};exports[_0x6531('0x4b')]=function(_0x2443f7,_0x708cd2){if(_0x2443f7['body']['id']){delete _0x2443f7[_0x6531('0x4a')]['id'];}return db[_0x6531('0x2c')][_0x6531('0x4c')]({'where':{'id':_0x2443f7[_0x6531('0x46')]['id']}})[_0x6531('0x24')](handleEntityNotFound(_0x708cd2,null))[_0x6531('0x24')](saveUpdates(_0x2443f7[_0x6531('0x4a')],null))[_0x6531('0x24')](respondWithResult(_0x708cd2,null))['catch'](handleError(_0x708cd2,null));};exports['destroy']=function(_0x344711,_0x3d1558){return db[_0x6531('0x2c')][_0x6531('0x4c')]({'where':{'id':_0x344711[_0x6531('0x46')]['id']}})[_0x6531('0x24')](handleEntityNotFound(_0x3d1558,null))[_0x6531('0x24')](removeEntity(_0x3d1558,null))['catch'](handleError(_0x3d1558,null));}; \ No newline at end of file +var _0x7d69=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','send','index','map','MailServerOut','fieldName','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv'];(function(_0x4f320f,_0x56c1f6){var _0x341c69=function(_0x1241d8){while(--_0x1241d8){_0x4f320f['push'](_0x4f320f['shift']());}};_0x341c69(++_0x56c1f6);}(_0x7d69,0xdb));var _0x97d6=function(_0x3328ec,_0x3d2e05){_0x3328ec=_0x3328ec-0x0;var _0x25472f=_0x7d69[_0x3328ec];return _0x25472f;};'use strict';var emlformat=require(_0x97d6('0x0'));var rimraf=require(_0x97d6('0x1'));var zipdir=require(_0x97d6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x97d6('0x3'));var moment=require('moment');var BPromise=require(_0x97d6('0x4'));var Mustache=require(_0x97d6('0x5'));var util=require(_0x97d6('0x6'));var path=require(_0x97d6('0x7'));var sox=require(_0x97d6('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x97d6('0x9'));var _=require(_0x97d6('0xa'));var squel=require('squel');var crypto=require(_0x97d6('0xb'));var jsforce=require(_0x97d6('0xc'));var deskjs=require(_0x97d6('0xd'));var toCsv=require(_0x97d6('0xe'));var querystring=require(_0x97d6('0xf'));var Papa=require('papaparse');var Redis=require(_0x97d6('0x10'));var authService=require(_0x97d6('0x11'));var qs=require(_0x97d6('0x12'));var as=require(_0x97d6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x97d6('0x14'))(_0x97d6('0x15'));var utils=require(_0x97d6('0x16'));var config=require(_0x97d6('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x97d6('0x18'))['db'];function respondWithStatusCode(_0x3d3490,_0x507546){_0x507546=_0x507546||0xcc;return function(_0x115ce7){if(_0x115ce7){return _0x3d3490[_0x97d6('0x19')](_0x507546);}return _0x3d3490[_0x97d6('0x1a')](_0x507546)['end']();};}function respondWithResult(_0xc99146,_0x392565){_0x392565=_0x392565||0xc8;return function(_0x1fea98){if(_0x1fea98){return _0xc99146[_0x97d6('0x1a')](_0x392565)[_0x97d6('0x1b')](_0x1fea98);}};}function respondWithFilteredResult(_0x24df28,_0x3e7801){return function(_0x2c5f5e){if(_0x2c5f5e){var _0x30a184=typeof _0x3e7801[_0x97d6('0x1c')]===_0x97d6('0x1d')&&typeof _0x3e7801[_0x97d6('0x1e')]===_0x97d6('0x1d');var _0x4e38af=_0x2c5f5e['count'];var _0x5abebd=_0x30a184?0x0:_0x3e7801[_0x97d6('0x1c')];var _0x33cca4=_0x30a184?_0x2c5f5e[_0x97d6('0x1f')]:_0x3e7801[_0x97d6('0x1c')]+_0x3e7801[_0x97d6('0x1e')];var _0x3cde40;if(_0x33cca4>=_0x4e38af){_0x33cca4=_0x4e38af;_0x3cde40=0xc8;}else{_0x3cde40=0xce;}_0x24df28[_0x97d6('0x1a')](_0x3cde40);return _0x24df28[_0x97d6('0x20')](_0x97d6('0x21'),_0x5abebd+'-'+_0x33cca4+'/'+_0x4e38af)['json'](_0x2c5f5e);}return null;};}function patchUpdates(_0x1c22bf){return function(_0x2dcdcc){try{jsonpatch[_0x97d6('0x22')](_0x2dcdcc,_0x1c22bf,!![]);}catch(_0x433346){return BPromise[_0x97d6('0x23')](_0x433346);}return _0x2dcdcc[_0x97d6('0x24')]();};}function saveUpdates(_0x2e9a04,_0x5d31c0){return function(_0x31125f){if(_0x31125f){return _0x31125f[_0x97d6('0x25')](_0x2e9a04)[_0x97d6('0x26')](function(_0x5b85ee){return _0x5b85ee;});}return null;};}function removeEntity(_0x2f9582,_0x155522){return function(_0x1aae71){if(_0x1aae71){return _0x1aae71[_0x97d6('0x27')]()[_0x97d6('0x26')](function(){_0x2f9582[_0x97d6('0x1a')](0xcc)[_0x97d6('0x28')]();});}};}function handleEntityNotFound(_0x160f94,_0x1c97e2){return function(_0x10399c){if(!_0x10399c){_0x160f94[_0x97d6('0x19')](0x194);}return _0x10399c;};}function handleError(_0x10664e,_0x3f8b57){_0x3f8b57=_0x3f8b57||0x1f4;return function(_0x1254e9){logger[_0x97d6('0x29')](_0x1254e9[_0x97d6('0x2a')]);if(_0x1254e9['name']){delete _0x1254e9['name'];}_0x10664e[_0x97d6('0x1a')](_0x3f8b57)[_0x97d6('0x2b')](_0x1254e9);};}exports[_0x97d6('0x2c')]=function(_0x34db7e,_0x104b76){var _0x5ebe9f={},_0x5d429c={},_0x4bee16={'count':0x0,'rows':[]};var _0x105f4f=_[_0x97d6('0x2d')](db[_0x97d6('0x2e')]['rawAttributes'],function(_0x437029){return{'name':_0x437029[_0x97d6('0x2f')],'type':_0x437029['type'][_0x97d6('0x30')]};});_0x5d429c[_0x97d6('0x31')]=_[_0x97d6('0x2d')](_0x105f4f,_0x97d6('0x32'));_0x5d429c[_0x97d6('0x33')]=_['keys'](_0x34db7e['query']);_0x5d429c[_0x97d6('0x34')]=_[_0x97d6('0x35')](_0x5d429c[_0x97d6('0x31')],_0x5d429c[_0x97d6('0x33')]);_0x5ebe9f[_0x97d6('0x36')]=_[_0x97d6('0x35')](_0x5d429c[_0x97d6('0x31')],qs[_0x97d6('0x37')](_0x34db7e[_0x97d6('0x33')][_0x97d6('0x37')]));_0x5ebe9f[_0x97d6('0x36')]=_0x5ebe9f['attributes'][_0x97d6('0x38')]?_0x5ebe9f['attributes']:_0x5d429c[_0x97d6('0x31')];if(!_0x34db7e[_0x97d6('0x33')][_0x97d6('0x39')](_0x97d6('0x3a'))){_0x5ebe9f[_0x97d6('0x1e')]=qs['limit'](_0x34db7e['query']['limit']);_0x5ebe9f[_0x97d6('0x1c')]=qs['offset'](_0x34db7e[_0x97d6('0x33')][_0x97d6('0x1c')]);}_0x5ebe9f['order']=qs[_0x97d6('0x3b')](_0x34db7e[_0x97d6('0x33')][_0x97d6('0x3b')]);_0x5ebe9f[_0x97d6('0x3c')]=qs[_0x97d6('0x34')](_['pick'](_0x34db7e['query'],_0x5d429c[_0x97d6('0x34')]),_0x105f4f);if(_0x34db7e[_0x97d6('0x33')]['filter']){_0x5ebe9f[_0x97d6('0x3c')]=_['merge'](_0x5ebe9f[_0x97d6('0x3c')],{'$or':_[_0x97d6('0x2d')](_0x105f4f,function(_0x4c18f2){if(_0x4c18f2[_0x97d6('0x3d')]!==_0x97d6('0x3e')){var _0x464fae={};_0x464fae[_0x4c18f2[_0x97d6('0x32')]]={'$like':'%'+_0x34db7e[_0x97d6('0x33')][_0x97d6('0x3f')]+'%'};return _0x464fae;}})});}_0x5ebe9f=_[_0x97d6('0x40')]({},_0x5ebe9f,_0x34db7e[_0x97d6('0x41')]);var _0x103f0c={'where':_0x5ebe9f[_0x97d6('0x3c')]};return db[_0x97d6('0x2e')][_0x97d6('0x1f')](_0x103f0c)['then'](function(_0x4d2745){_0x4bee16[_0x97d6('0x1f')]=_0x4d2745;if(_0x34db7e[_0x97d6('0x33')][_0x97d6('0x42')]){_0x5ebe9f[_0x97d6('0x43')]=[{'all':!![]}];}return db[_0x97d6('0x2e')][_0x97d6('0x44')](_0x5ebe9f);})['then'](function(_0x7d3590){_0x4bee16[_0x97d6('0x45')]=_0x7d3590;return _0x4bee16;})[_0x97d6('0x26')](respondWithFilteredResult(_0x104b76,_0x5ebe9f))[_0x97d6('0x46')](handleError(_0x104b76,null));};exports[_0x97d6('0x47')]=function(_0x26a694,_0x5f149f){var _0x29ab28={'raw':!![],'where':{'id':_0x26a694[_0x97d6('0x48')]['id']}},_0x48ce03={};_0x48ce03[_0x97d6('0x31')]=_[_0x97d6('0x49')](db[_0x97d6('0x2e')][_0x97d6('0x4a')]);_0x48ce03['query']=_['keys'](_0x26a694[_0x97d6('0x33')]);_0x48ce03[_0x97d6('0x34')]=_['intersection'](_0x48ce03['model'],_0x48ce03[_0x97d6('0x33')]);_0x29ab28['attributes']=_[_0x97d6('0x35')](_0x48ce03[_0x97d6('0x31')],qs[_0x97d6('0x37')](_0x26a694[_0x97d6('0x33')][_0x97d6('0x37')]));_0x29ab28[_0x97d6('0x36')]=_0x29ab28['attributes'][_0x97d6('0x38')]?_0x29ab28[_0x97d6('0x36')]:_0x48ce03[_0x97d6('0x31')];if(_0x26a694[_0x97d6('0x33')]['includeAll']){_0x29ab28[_0x97d6('0x43')]=[{'all':!![]}];}_0x29ab28=_[_0x97d6('0x40')]({},_0x29ab28,_0x26a694[_0x97d6('0x41')]);return db['MailServerOut'][_0x97d6('0x4b')](_0x29ab28)[_0x97d6('0x26')](handleEntityNotFound(_0x5f149f,null))['then'](respondWithResult(_0x5f149f,null))[_0x97d6('0x46')](handleError(_0x5f149f,null));};exports[_0x97d6('0x4c')]=function(_0x40bf99,_0x708498){return db[_0x97d6('0x2e')]['create'](_0x40bf99['body'],{})[_0x97d6('0x26')](respondWithResult(_0x708498,0xc9))[_0x97d6('0x46')](handleError(_0x708498,null));};exports[_0x97d6('0x25')]=function(_0x142ead,_0x441c9d){if(_0x142ead['body']['id']){delete _0x142ead[_0x97d6('0x4d')]['id'];}return db[_0x97d6('0x2e')]['find']({'where':{'id':_0x142ead[_0x97d6('0x48')]['id']}})[_0x97d6('0x26')](handleEntityNotFound(_0x441c9d,null))[_0x97d6('0x26')](saveUpdates(_0x142ead[_0x97d6('0x4d')],null))[_0x97d6('0x26')](respondWithResult(_0x441c9d,null))['catch'](handleError(_0x441c9d,null));};exports[_0x97d6('0x27')]=function(_0x1b8ed7,_0x1094dc){return db['MailServerOut'][_0x97d6('0x4b')]({'where':{'id':_0x1b8ed7[_0x97d6('0x48')]['id']}})[_0x97d6('0x26')](handleEntityNotFound(_0x1094dc,null))[_0x97d6('0x26')](removeEntity(_0x1094dc,null))['catch'](handleError(_0x1094dc,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index b9094c2..4daee4d 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 _0xa0ef=['exports','define','MailServerOut','mail_servers_out','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes'];(function(_0x2c0a49,_0x4720ae){var _0xdfc42d=function(_0x3ff5cf){while(--_0x3ff5cf){_0x2c0a49['push'](_0x2c0a49['shift']());}};_0xdfc42d(++_0x4720ae);}(_0xa0ef,0x12f));var _0xfa0e=function(_0x55adee,_0x4d9108){_0x55adee=_0x55adee-0x0;var _0x5f0455=_0xa0ef[_0x55adee];return _0x5f0455;};'use strict';var _=require(_0xfa0e('0x0'));var util=require('util');var logger=require(_0xfa0e('0x1'))('api');var moment=require(_0xfa0e('0x2'));var BPromise=require(_0xfa0e('0x3'));var rp=require(_0xfa0e('0x4'));var fs=require('fs');var path=require(_0xfa0e('0x5'));var rimraf=require(_0xfa0e('0x6'));var config=require(_0xfa0e('0x7'));var attributes=require(_0xfa0e('0x8'));module[_0xfa0e('0x9')]=function(_0x30d911,_0x39d82b){return _0x30d911[_0xfa0e('0xa')](_0xfa0e('0xb'),attributes,{'tableName':_0xfa0e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x49a6=['request-promise','path','rimraf','./mailServerOut.attributes','exports','define','MailServerOut','lodash','api','moment','bluebird'];(function(_0x50f9ab,_0x5009b4){var _0x58dda4=function(_0x5f1ff5){while(--_0x5f1ff5){_0x50f9ab['push'](_0x50f9ab['shift']());}};_0x58dda4(++_0x5009b4);}(_0x49a6,0xcd));var _0x649a=function(_0x3ab4c8,_0x1e05a4){_0x3ab4c8=_0x3ab4c8-0x0;var _0x59f1e2=_0x49a6[_0x3ab4c8];return _0x59f1e2;};'use strict';var _=require(_0x649a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x649a('0x1'));var moment=require(_0x649a('0x2'));var BPromise=require(_0x649a('0x3'));var rp=require(_0x649a('0x4'));var fs=require('fs');var path=require(_0x649a('0x5'));var rimraf=require(_0x649a('0x6'));var config=require('../../config/environment');var attributes=require(_0x649a('0x7'));module[_0x649a('0x8')]=function(_0x330e24,_0x1b5917){return _0x330e24[_0x649a('0x9')](_0x649a('0xa'),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 54125a6..415fcf9 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x4212f6,_0xf9fb41){var _0x57aaa9=function(_0x54135e){while(--_0x54135e){_0x4212f6['push'](_0x4212f6['shift']());}};_0x57aaa9(++_0xf9fb41);}(_0x2ef3,0xba));var _0x32ef=function(_0x2a810d,_0x596b4f){_0x2a810d=_0x2a810d-0x0;var _0x2ea39d=_0x2ef3[_0x2a810d];return _0x2ea39d;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x171d54,_0xf0262e){var _0x4da1f0=function(_0x45bda6){while(--_0x45bda6){_0x171d54['push'](_0x171d54['shift']());}};_0x4da1f0(++_0xf0262e);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5f66[_0x4243a3];return _0x1b2a33;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('MailServerOut,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index fbc4f72..5b1de67 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 _0x97f6=['update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put'];(function(_0x402f4b,_0x284fe6){var _0x116846=function(_0x30424e){while(--_0x30424e){_0x402f4b['push'](_0x402f4b['shift']());}};_0x116846(++_0x284fe6);}(_0x97f6,0x1d1));var _0x697f=function(_0x4ee4f0,_0x490efb){_0x4ee4f0=_0x4ee4f0-0x0;var _0x303121=_0x97f6[_0x4ee4f0];return _0x303121;};'use strict';var multer=require(_0x697f('0x0'));var util=require('util');var path=require(_0x697f('0x1'));var timeout=require(_0x697f('0x2'));var express=require(_0x697f('0x3'));var router=express[_0x697f('0x4')]();var fs_extra=require(_0x697f('0x5'));var auth=require(_0x697f('0x6'));var interaction=require(_0x697f('0x7'));var config=require('../../config/environment');var controller=require(_0x697f('0x8'));router[_0x697f('0x9')]('/',auth[_0x697f('0xa')](),controller['index']);router[_0x697f('0x9')](_0x697f('0xb'),auth['isAuthenticated'](),controller[_0x697f('0xc')]);router[_0x697f('0x9')](_0x697f('0xd'),auth[_0x697f('0xa')](),controller[_0x697f('0xe')]);router[_0x697f('0xf')]('/',auth[_0x697f('0xa')](),controller[_0x697f('0x10')]);router[_0x697f('0x11')](_0x697f('0xd'),auth[_0x697f('0xa')](),controller[_0x697f('0x12')]);router[_0x697f('0x13')](_0x697f('0xd'),auth[_0x697f('0xa')](),controller[_0x697f('0x14')]);module['exports']=router; \ No newline at end of file +var _0x618c=['/describe','/:id','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x7b7e39,_0x5a5a05){var _0x87fa3f=function(_0x1c686d){while(--_0x1c686d){_0x7b7e39['push'](_0x7b7e39['shift']());}};_0x87fa3f(++_0x5a5a05);}(_0x618c,0x8d));var _0xc618=function(_0x3d0c34,_0x425d37){_0x3d0c34=_0x3d0c34-0x0;var _0x25a376=_0x618c[_0x3d0c34];return _0x25a376;};'use strict';var multer=require('multer');var util=require(_0xc618('0x0'));var path=require(_0xc618('0x1'));var timeout=require(_0xc618('0x2'));var express=require(_0xc618('0x3'));var router=express[_0xc618('0x4')]();var fs_extra=require(_0xc618('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc618('0x6'));var config=require(_0xc618('0x7'));var controller=require('./mailSubstatus.controller');router[_0xc618('0x8')]('/',auth[_0xc618('0x9')](),controller[_0xc618('0xa')]);router[_0xc618('0x8')](_0xc618('0xb'),auth[_0xc618('0x9')](),controller['describe']);router[_0xc618('0x8')](_0xc618('0xc'),auth[_0xc618('0x9')](),controller['show']);router[_0xc618('0xd')]('/',auth[_0xc618('0x9')](),controller['create']);router[_0xc618('0xe')](_0xc618('0xc'),auth[_0xc618('0x9')](),controller[_0xc618('0xf')]);router[_0xc618('0x10')](_0xc618('0xc'),auth['isAuthenticated'](),controller[_0xc618('0x11')]);module[_0xc618('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index cdb2877..0cecc25 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 _0x8c46=['name','sequelize'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x8c46,0x171));var _0x68c4=function(_0x4e5969,_0x59d73e){_0x4e5969=_0x4e5969-0x0;var _0x59d7ce=_0x8c46[_0x4e5969];return _0x59d7ce;};'use strict';var Sequelize=require(_0x68c4('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x68c4('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xafc4=['STRING','sequelize'];(function(_0x5b4133,_0xfd40a8){var _0x23ab9f=function(_0xdb8807){while(--_0xdb8807){_0x5b4133['push'](_0x5b4133['shift']());}};_0x23ab9f(++_0xfd40a8);}(_0xafc4,0x69));var _0x4afc=function(_0x25fd71,_0x493b52){_0x25fd71=_0x25fd71-0x0;var _0x15917d=_0xafc4[_0x25fd71];return _0x15917d;};'use strict';var Sequelize=require(_0x4afc('0x0'));module['exports']={'name':{'type':Sequelize[_0x4afc('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4afc('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 8b797b5..611ef06 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 _0xc58f=['update','then','destroy','status','stack','name','index','map','MailSubstatus','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','describe','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','set','apply','reject','save'];(function(_0x5d9e68,_0x5f21f8){var _0x3598cc=function(_0x42a02c){while(--_0x42a02c){_0x5d9e68['push'](_0x5d9e68['shift']());}};_0x3598cc(++_0x5f21f8);}(_0xc58f,0xc1));var _0xfc58=function(_0x3de7e0,_0x28cbff){_0x3de7e0=_0x3de7e0-0x0;var _0x11d0b3=_0xc58f[_0x3de7e0];return _0x11d0b3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfc58('0x0'));var jsonpatch=require(_0xfc58('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfc58('0x2'));var Mustache=require(_0xfc58('0x3'));var util=require(_0xfc58('0x4'));var path=require('path');var sox=require(_0xfc58('0x5'));var csv=require(_0xfc58('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfc58('0x7'));var _=require(_0xfc58('0x8'));var squel=require(_0xfc58('0x9'));var crypto=require(_0xfc58('0xa'));var jsforce=require(_0xfc58('0xb'));var deskjs=require(_0xfc58('0xc'));var toCsv=require(_0xfc58('0x6'));var querystring=require(_0xfc58('0xd'));var Papa=require(_0xfc58('0xe'));var Redis=require(_0xfc58('0xf'));var authService=require(_0xfc58('0x10'));var qs=require(_0xfc58('0x11'));var as=require(_0xfc58('0x12'));var hardwareService=require(_0xfc58('0x13'));var logger=require(_0xfc58('0x14'))('api');var utils=require(_0xfc58('0x15'));var config=require(_0xfc58('0x16'));var licenseUtil=require(_0xfc58('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x385441,_0x1f2196){_0x1f2196=_0x1f2196||0xcc;return function(_0x32a76f){if(_0x32a76f){return _0x385441[_0xfc58('0x18')](_0x1f2196);}return _0x385441['status'](_0x1f2196)[_0xfc58('0x19')]();};}function respondWithResult(_0x6fe14f,_0x38f5bf){_0x38f5bf=_0x38f5bf||0xc8;return function(_0x193dee){if(_0x193dee){return _0x6fe14f['status'](_0x38f5bf)[_0xfc58('0x1a')](_0x193dee);}};}function respondWithFilteredResult(_0x47b4cd,_0x50d035){return function(_0x47d203){if(_0x47d203){var _0x525265=typeof _0x50d035[_0xfc58('0x1b')]===_0xfc58('0x1c')&&typeof _0x50d035[_0xfc58('0x1d')]===_0xfc58('0x1c');var _0x280c46=_0x47d203[_0xfc58('0x1e')];var _0x2911ba=_0x525265?0x0:_0x50d035[_0xfc58('0x1b')];var _0x3baf5c=_0x525265?_0x47d203[_0xfc58('0x1e')]:_0x50d035[_0xfc58('0x1b')]+_0x50d035[_0xfc58('0x1d')];var _0x52d11f;if(_0x3baf5c>=_0x280c46){_0x3baf5c=_0x280c46;_0x52d11f=0xc8;}else{_0x52d11f=0xce;}_0x47b4cd['status'](_0x52d11f);return _0x47b4cd[_0xfc58('0x1f')]('Content-Range',_0x2911ba+'-'+_0x3baf5c+'/'+_0x280c46)[_0xfc58('0x1a')](_0x47d203);}return null;};}function patchUpdates(_0x50c920){return function(_0x1d3aa8){try{jsonpatch[_0xfc58('0x20')](_0x1d3aa8,_0x50c920,!![]);}catch(_0x310cfb){return BPromise[_0xfc58('0x21')](_0x310cfb);}return _0x1d3aa8[_0xfc58('0x22')]();};}function saveUpdates(_0x385d63,_0x42b234){return function(_0x1ee78d){if(_0x1ee78d){return _0x1ee78d[_0xfc58('0x23')](_0x385d63)[_0xfc58('0x24')](function(_0x13045b){return _0x13045b;});}return null;};}function removeEntity(_0x1d1f70,_0xec25ed){return function(_0x367cb5){if(_0x367cb5){return _0x367cb5[_0xfc58('0x25')]()[_0xfc58('0x24')](function(){_0x1d1f70[_0xfc58('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42c614,_0x4b3300){return function(_0x224d16){if(!_0x224d16){_0x42c614['sendStatus'](0x194);}return _0x224d16;};}function handleError(_0x2c2fcf,_0x4e1670){_0x4e1670=_0x4e1670||0x1f4;return function(_0x22ce80){logger['error'](_0x22ce80[_0xfc58('0x27')]);if(_0x22ce80[_0xfc58('0x28')]){delete _0x22ce80[_0xfc58('0x28')];}_0x2c2fcf[_0xfc58('0x26')](_0x4e1670)['send'](_0x22ce80);};}exports[_0xfc58('0x29')]=function(_0x45a88b,_0xe01cd1){var _0x3f762c={},_0x476e49={},_0x47a645={'count':0x0,'rows':[]};var _0x2a1f5f=_[_0xfc58('0x2a')](db[_0xfc58('0x2b')][_0xfc58('0x2c')],function(_0xb0da32){return{'name':_0xb0da32[_0xfc58('0x2d')],'type':_0xb0da32[_0xfc58('0x2e')][_0xfc58('0x2f')]};});_0x476e49['model']=_[_0xfc58('0x2a')](_0x2a1f5f,_0xfc58('0x28'));_0x476e49[_0xfc58('0x30')]=_[_0xfc58('0x31')](_0x45a88b[_0xfc58('0x30')]);_0x476e49[_0xfc58('0x32')]=_[_0xfc58('0x33')](_0x476e49[_0xfc58('0x34')],_0x476e49[_0xfc58('0x30')]);_0x3f762c[_0xfc58('0x35')]=_[_0xfc58('0x33')](_0x476e49['model'],qs[_0xfc58('0x36')](_0x45a88b[_0xfc58('0x30')][_0xfc58('0x36')]));_0x3f762c[_0xfc58('0x35')]=_0x3f762c['attributes']['length']?_0x3f762c['attributes']:_0x476e49['model'];if(!_0x45a88b[_0xfc58('0x30')][_0xfc58('0x37')](_0xfc58('0x38'))){_0x3f762c[_0xfc58('0x1d')]=qs[_0xfc58('0x1d')](_0x45a88b['query'][_0xfc58('0x1d')]);_0x3f762c[_0xfc58('0x1b')]=qs[_0xfc58('0x1b')](_0x45a88b[_0xfc58('0x30')][_0xfc58('0x1b')]);}_0x3f762c[_0xfc58('0x39')]=qs[_0xfc58('0x3a')](_0x45a88b[_0xfc58('0x30')][_0xfc58('0x3a')]);_0x3f762c['where']=qs[_0xfc58('0x32')](_[_0xfc58('0x3b')](_0x45a88b[_0xfc58('0x30')],_0x476e49[_0xfc58('0x32')]),_0x2a1f5f);if(_0x45a88b['query']['filter']){_0x3f762c[_0xfc58('0x3c')]=_[_0xfc58('0x3d')](_0x3f762c[_0xfc58('0x3c')],{'$or':_[_0xfc58('0x2a')](_0x2a1f5f,function(_0x338c3d){if(_0x338c3d[_0xfc58('0x2e')]!==_0xfc58('0x3e')){var _0x818ac8={};_0x818ac8[_0x338c3d[_0xfc58('0x28')]]={'$like':'%'+_0x45a88b['query'][_0xfc58('0x3f')]+'%'};return _0x818ac8;}})});}_0x3f762c=_[_0xfc58('0x3d')]({},_0x3f762c,_0x45a88b['options']);var _0x3c68e2={'where':_0x3f762c[_0xfc58('0x3c')]};return db[_0xfc58('0x2b')][_0xfc58('0x1e')](_0x3c68e2)['then'](function(_0x21bbea){_0x47a645['count']=_0x21bbea;if(_0x45a88b[_0xfc58('0x30')][_0xfc58('0x40')]){_0x3f762c['include']=[{'all':!![]}];}return db[_0xfc58('0x2b')][_0xfc58('0x41')](_0x3f762c);})['then'](function(_0x4f38a2){_0x47a645[_0xfc58('0x42')]=_0x4f38a2;return _0x47a645;})[_0xfc58('0x24')](respondWithFilteredResult(_0xe01cd1,_0x3f762c))[_0xfc58('0x43')](handleError(_0xe01cd1,null));};exports[_0xfc58('0x44')]=function(_0x35ba9a,_0x474bda){var _0x4871e9={'raw':!![],'where':{'id':_0x35ba9a[_0xfc58('0x45')]['id']}},_0x101fd8={};_0x101fd8[_0xfc58('0x34')]=_['keys'](db[_0xfc58('0x2b')][_0xfc58('0x2c')]);_0x101fd8['query']=_['keys'](_0x35ba9a['query']);_0x101fd8['filters']=_[_0xfc58('0x33')](_0x101fd8[_0xfc58('0x34')],_0x101fd8[_0xfc58('0x30')]);_0x4871e9[_0xfc58('0x35')]=_[_0xfc58('0x33')](_0x101fd8['model'],qs[_0xfc58('0x36')](_0x35ba9a[_0xfc58('0x30')][_0xfc58('0x36')]));_0x4871e9[_0xfc58('0x35')]=_0x4871e9[_0xfc58('0x35')]['length']?_0x4871e9[_0xfc58('0x35')]:_0x101fd8['model'];if(_0x35ba9a['query'][_0xfc58('0x40')]){_0x4871e9[_0xfc58('0x46')]=[{'all':!![]}];}_0x4871e9=_[_0xfc58('0x3d')]({},_0x4871e9,_0x35ba9a[_0xfc58('0x47')]);return db[_0xfc58('0x2b')][_0xfc58('0x48')](_0x4871e9)[_0xfc58('0x24')](handleEntityNotFound(_0x474bda,null))[_0xfc58('0x24')](respondWithResult(_0x474bda,null))[_0xfc58('0x43')](handleError(_0x474bda,null));};exports[_0xfc58('0x49')]=function(_0x1d258b,_0x1a8592){return db[_0xfc58('0x2b')]['create'](_0x1d258b['body'],{})[_0xfc58('0x24')](respondWithResult(_0x1a8592,0xc9))[_0xfc58('0x43')](handleError(_0x1a8592,null));};exports[_0xfc58('0x23')]=function(_0x23628a,_0x2163c1){if(_0x23628a[_0xfc58('0x4a')]['id']){delete _0x23628a[_0xfc58('0x4a')]['id'];}return db[_0xfc58('0x2b')][_0xfc58('0x48')]({'where':{'id':_0x23628a[_0xfc58('0x45')]['id']}})[_0xfc58('0x24')](handleEntityNotFound(_0x2163c1,null))['then'](saveUpdates(_0x23628a[_0xfc58('0x4a')],null))[_0xfc58('0x24')](respondWithResult(_0x2163c1,null))[_0xfc58('0x43')](handleError(_0x2163c1,null));};exports['destroy']=function(_0x51cc89,_0xb0ad60){return db[_0xfc58('0x2b')][_0xfc58('0x48')]({'where':{'id':_0x51cc89['params']['id']}})[_0xfc58('0x24')](handleEntityNotFound(_0xb0ad60,null))['then'](removeEntity(_0xb0ad60,null))[_0xfc58('0x43')](handleError(_0xb0ad60,null));};exports['describe']=function(_0x2ce226,_0x43453a){return db[_0xfc58('0x2b')][_0xfc58('0x4b')]()[_0xfc58('0x24')](respondWithResult(_0x43453a,null))[_0xfc58('0x43')](handleError(_0x43453a,null));}; \ No newline at end of file +var _0x13ca=['then','destroy','end','error','stack','name','send','index','map','MailSubstatus','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject'];(function(_0x202013,_0x28c1d0){var _0x1a5275=function(_0x372a58){while(--_0x372a58){_0x202013['push'](_0x202013['shift']());}};_0x1a5275(++_0x28c1d0);}(_0x13ca,0x162));var _0xa13c=function(_0x31d51e,_0x36b9aa){_0x31d51e=_0x31d51e-0x0;var _0x1b8702=_0x13ca[_0x31d51e];return _0x1b8702;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa13c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa13c('0x1'));var rp=require(_0xa13c('0x2'));var moment=require(_0xa13c('0x3'));var BPromise=require(_0xa13c('0x4'));var Mustache=require(_0xa13c('0x5'));var util=require('util');var path=require(_0xa13c('0x6'));var sox=require(_0xa13c('0x7'));var csv=require('to-csv');var ejs=require(_0xa13c('0x8'));var fs=require('fs');var fs_extra=require(_0xa13c('0x9'));var _=require(_0xa13c('0xa'));var squel=require(_0xa13c('0xb'));var crypto=require(_0xa13c('0xc'));var jsforce=require(_0xa13c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa13c('0xe'));var querystring=require(_0xa13c('0xf'));var Papa=require(_0xa13c('0x10'));var Redis=require(_0xa13c('0x11'));var authService=require(_0xa13c('0x12'));var qs=require(_0xa13c('0x13'));var as=require(_0xa13c('0x14'));var hardwareService=require(_0xa13c('0x15'));var logger=require(_0xa13c('0x16'))(_0xa13c('0x17'));var utils=require(_0xa13c('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xa13c('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x418560,_0x4edf72){_0x4edf72=_0x4edf72||0xcc;return function(_0x3f932e){if(_0x3f932e){return _0x418560[_0xa13c('0x1a')](_0x4edf72);}return _0x418560['status'](_0x4edf72)['end']();};}function respondWithResult(_0x353b31,_0x3b7c41){_0x3b7c41=_0x3b7c41||0xc8;return function(_0x15228e){if(_0x15228e){return _0x353b31[_0xa13c('0x1b')](_0x3b7c41)[_0xa13c('0x1c')](_0x15228e);}};}function respondWithFilteredResult(_0x340a23,_0x1aed57){return function(_0x39dec2){if(_0x39dec2){var _0x34ecc1=typeof _0x1aed57[_0xa13c('0x1d')]===_0xa13c('0x1e')&&typeof _0x1aed57[_0xa13c('0x1f')]==='undefined';var _0x32824f=_0x39dec2[_0xa13c('0x20')];var _0x158250=_0x34ecc1?0x0:_0x1aed57[_0xa13c('0x1d')];var _0x2c89b2=_0x34ecc1?_0x39dec2[_0xa13c('0x20')]:_0x1aed57[_0xa13c('0x1d')]+_0x1aed57[_0xa13c('0x1f')];var _0x1e6fe5;if(_0x2c89b2>=_0x32824f){_0x2c89b2=_0x32824f;_0x1e6fe5=0xc8;}else{_0x1e6fe5=0xce;}_0x340a23['status'](_0x1e6fe5);return _0x340a23['set'](_0xa13c('0x21'),_0x158250+'-'+_0x2c89b2+'/'+_0x32824f)[_0xa13c('0x1c')](_0x39dec2);}return null;};}function patchUpdates(_0x52f283){return function(_0x3876eb){try{jsonpatch[_0xa13c('0x22')](_0x3876eb,_0x52f283,!![]);}catch(_0x9b1d45){return BPromise[_0xa13c('0x23')](_0x9b1d45);}return _0x3876eb['save']();};}function saveUpdates(_0x209aec,_0x27e4b9){return function(_0x25a252){if(_0x25a252){return _0x25a252['update'](_0x209aec)[_0xa13c('0x24')](function(_0x438aac){return _0x438aac;});}return null;};}function removeEntity(_0x31e5fc,_0x301b85){return function(_0x383f0b){if(_0x383f0b){return _0x383f0b[_0xa13c('0x25')]()[_0xa13c('0x24')](function(){_0x31e5fc[_0xa13c('0x1b')](0xcc)[_0xa13c('0x26')]();});}};}function handleEntityNotFound(_0x18ce5d,_0x530332){return function(_0x4feec6){if(!_0x4feec6){_0x18ce5d[_0xa13c('0x1a')](0x194);}return _0x4feec6;};}function handleError(_0x1f58ec,_0x4cf3b5){_0x4cf3b5=_0x4cf3b5||0x1f4;return function(_0x5affa7){logger[_0xa13c('0x27')](_0x5affa7[_0xa13c('0x28')]);if(_0x5affa7[_0xa13c('0x29')]){delete _0x5affa7[_0xa13c('0x29')];}_0x1f58ec[_0xa13c('0x1b')](_0x4cf3b5)[_0xa13c('0x2a')](_0x5affa7);};}exports[_0xa13c('0x2b')]=function(_0x3f3f9c,_0x377de3){var _0x532ccf={},_0xf9dfaa={},_0x1069fd={'count':0x0,'rows':[]};var _0x19b4e6=_[_0xa13c('0x2c')](db[_0xa13c('0x2d')][_0xa13c('0x2e')],function(_0x10c123){return{'name':_0x10c123['fieldName'],'type':_0x10c123[_0xa13c('0x2f')][_0xa13c('0x30')]};});_0xf9dfaa[_0xa13c('0x31')]=_['map'](_0x19b4e6,'name');_0xf9dfaa[_0xa13c('0x32')]=_[_0xa13c('0x33')](_0x3f3f9c[_0xa13c('0x32')]);_0xf9dfaa[_0xa13c('0x34')]=_[_0xa13c('0x35')](_0xf9dfaa[_0xa13c('0x31')],_0xf9dfaa[_0xa13c('0x32')]);_0x532ccf[_0xa13c('0x36')]=_[_0xa13c('0x35')](_0xf9dfaa[_0xa13c('0x31')],qs[_0xa13c('0x37')](_0x3f3f9c[_0xa13c('0x32')][_0xa13c('0x37')]));_0x532ccf[_0xa13c('0x36')]=_0x532ccf['attributes'][_0xa13c('0x38')]?_0x532ccf['attributes']:_0xf9dfaa[_0xa13c('0x31')];if(!_0x3f3f9c[_0xa13c('0x32')][_0xa13c('0x39')]('nolimit')){_0x532ccf[_0xa13c('0x1f')]=qs[_0xa13c('0x1f')](_0x3f3f9c[_0xa13c('0x32')][_0xa13c('0x1f')]);_0x532ccf[_0xa13c('0x1d')]=qs[_0xa13c('0x1d')](_0x3f3f9c[_0xa13c('0x32')][_0xa13c('0x1d')]);}_0x532ccf[_0xa13c('0x3a')]=qs['sort'](_0x3f3f9c[_0xa13c('0x32')][_0xa13c('0x3b')]);_0x532ccf[_0xa13c('0x3c')]=qs[_0xa13c('0x34')](_[_0xa13c('0x3d')](_0x3f3f9c[_0xa13c('0x32')],_0xf9dfaa['filters']),_0x19b4e6);if(_0x3f3f9c[_0xa13c('0x32')][_0xa13c('0x3e')]){_0x532ccf[_0xa13c('0x3c')]=_['merge'](_0x532ccf[_0xa13c('0x3c')],{'$or':_[_0xa13c('0x2c')](_0x19b4e6,function(_0x4ec8f6){if(_0x4ec8f6[_0xa13c('0x2f')]!==_0xa13c('0x3f')){var _0x585cc4={};_0x585cc4[_0x4ec8f6[_0xa13c('0x29')]]={'$like':'%'+_0x3f3f9c['query'][_0xa13c('0x3e')]+'%'};return _0x585cc4;}})});}_0x532ccf=_[_0xa13c('0x40')]({},_0x532ccf,_0x3f3f9c[_0xa13c('0x41')]);var _0x482ac2={'where':_0x532ccf[_0xa13c('0x3c')]};return db[_0xa13c('0x2d')]['count'](_0x482ac2)[_0xa13c('0x24')](function(_0x49d984){_0x1069fd[_0xa13c('0x20')]=_0x49d984;if(_0x3f3f9c[_0xa13c('0x32')][_0xa13c('0x42')]){_0x532ccf[_0xa13c('0x43')]=[{'all':!![]}];}return db[_0xa13c('0x2d')][_0xa13c('0x44')](_0x532ccf);})[_0xa13c('0x24')](function(_0x5be1bd){_0x1069fd[_0xa13c('0x45')]=_0x5be1bd;return _0x1069fd;})[_0xa13c('0x24')](respondWithFilteredResult(_0x377de3,_0x532ccf))[_0xa13c('0x46')](handleError(_0x377de3,null));};exports[_0xa13c('0x47')]=function(_0x3c3800,_0x140164){var _0x572658={'raw':!![],'where':{'id':_0x3c3800[_0xa13c('0x48')]['id']}},_0x392433={};_0x392433[_0xa13c('0x31')]=_[_0xa13c('0x33')](db[_0xa13c('0x2d')][_0xa13c('0x2e')]);_0x392433[_0xa13c('0x32')]=_['keys'](_0x3c3800['query']);_0x392433[_0xa13c('0x34')]=_[_0xa13c('0x35')](_0x392433[_0xa13c('0x31')],_0x392433['query']);_0x572658[_0xa13c('0x36')]=_[_0xa13c('0x35')](_0x392433['model'],qs[_0xa13c('0x37')](_0x3c3800['query'][_0xa13c('0x37')]));_0x572658[_0xa13c('0x36')]=_0x572658[_0xa13c('0x36')][_0xa13c('0x38')]?_0x572658[_0xa13c('0x36')]:_0x392433[_0xa13c('0x31')];if(_0x3c3800['query']['includeAll']){_0x572658[_0xa13c('0x43')]=[{'all':!![]}];}_0x572658=_[_0xa13c('0x40')]({},_0x572658,_0x3c3800['options']);return db[_0xa13c('0x2d')][_0xa13c('0x49')](_0x572658)['then'](handleEntityNotFound(_0x140164,null))[_0xa13c('0x24')](respondWithResult(_0x140164,null))[_0xa13c('0x46')](handleError(_0x140164,null));};exports[_0xa13c('0x4a')]=function(_0x1e46a0,_0x557dd8){return db['MailSubstatus'][_0xa13c('0x4a')](_0x1e46a0[_0xa13c('0x4b')],{})['then'](respondWithResult(_0x557dd8,0xc9))[_0xa13c('0x46')](handleError(_0x557dd8,null));};exports[_0xa13c('0x4c')]=function(_0x4fe1ec,_0x4741a2){if(_0x4fe1ec[_0xa13c('0x4b')]['id']){delete _0x4fe1ec[_0xa13c('0x4b')]['id'];}return db['MailSubstatus'][_0xa13c('0x49')]({'where':{'id':_0x4fe1ec[_0xa13c('0x48')]['id']}})[_0xa13c('0x24')](handleEntityNotFound(_0x4741a2,null))[_0xa13c('0x24')](saveUpdates(_0x4fe1ec[_0xa13c('0x4b')],null))[_0xa13c('0x24')](respondWithResult(_0x4741a2,null))['catch'](handleError(_0x4741a2,null));};exports[_0xa13c('0x25')]=function(_0x165c93,_0x40c85a){return db['MailSubstatus'][_0xa13c('0x49')]({'where':{'id':_0x165c93['params']['id']}})[_0xa13c('0x24')](handleEntityNotFound(_0x40c85a,null))[_0xa13c('0x24')](removeEntity(_0x40c85a,null))[_0xa13c('0x46')](handleError(_0x40c85a,null));};exports['describe']=function(_0x334006,_0x54c11f){return db[_0xa13c('0x2d')][_0xa13c('0x4d')]()['then'](respondWithResult(_0x54c11f,null))[_0xa13c('0x46')](handleError(_0x54c11f,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index dbd6752..48d459a 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 _0x8358=['events','../../mysqldb','MailSubstatus','setMaxListeners','emit','hasOwnProperty','hook','exports'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x8358,0x198));var _0x8835=function(_0x51e6a5,_0x10c26d){_0x51e6a5=_0x51e6a5-0x0;var _0x11dc94=_0x8358[_0x51e6a5];return _0x11dc94;};'use strict';var EventEmitter=require(_0x8835('0x0'));var MailSubstatus=require(_0x8835('0x1'))['db'][_0x8835('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x8835('0x3')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x46a86e){return function(_0x126b33,_0x561f72,_0x420a49){MailSubstatusEvents[_0x8835('0x4')](_0x46a86e+':'+_0x126b33['id'],_0x126b33);MailSubstatusEvents['emit'](_0x46a86e,_0x126b33);_0x420a49(null);};}for(var e in events){if(events[_0x8835('0x5')](e)){var event=events[e];MailSubstatus[_0x8835('0x6')](e,emitEvent(event));}}module[_0x8835('0x7')]=MailSubstatusEvents; \ No newline at end of file +var _0x19c9=['hook','exports','events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x40b241,_0x2ce6cc){var _0x22b4b1=function(_0x83fc40){while(--_0x83fc40){_0x40b241['push'](_0x40b241['shift']());}};_0x22b4b1(++_0x2ce6cc);}(_0x19c9,0x17c));var _0x919c=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x19c9[_0x36dfbd];return _0x4ecad9;};'use strict';var EventEmitter=require(_0x919c('0x0'));var MailSubstatus=require(_0x919c('0x1'))['db'][_0x919c('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x919c('0x3')](0x0);var events={'afterUpdate':_0x919c('0x4')};function emitEvent(_0x43bbf7){return function(_0x20a7c6,_0x432ac8,_0x28f602){MailSubstatusEvents['emit'](_0x43bbf7+':'+_0x20a7c6['id'],_0x20a7c6);MailSubstatusEvents[_0x919c('0x5')](_0x43bbf7,_0x20a7c6);_0x28f602(null);};}for(var e in events){if(events[_0x919c('0x6')](e)){var event=events[e];MailSubstatus[_0x919c('0x7')](e,emitEvent(event));}}module[_0x919c('0x8')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 4a1d355..9f4e878 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 _0xdc34=['./mailSubstatus.attributes','exports','models','define','Condition','update','name','_previousDataValues','then','catch'];(function(_0x477575,_0xf4784b){var _0x3b3751=function(_0x7074d6){while(--_0x7074d6){_0x477575['push'](_0x477575['shift']());}};_0x3b3751(++_0xf4784b);}(_0xdc34,0x186));var _0x4dc3=function(_0x517117,_0x1470e1){_0x517117=_0x517117-0x0;var _0xb8f47b=_0xdc34[_0x517117];return _0xb8f47b;};'use strict';var attributes=require(_0x4dc3('0x0'));module[_0x4dc3('0x1')]=function(_0x37e8e4){var _0x3ed69f=_0x37e8e4[_0x4dc3('0x2')];return _0x37e8e4[_0x4dc3('0x3')]('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x3d74c3,_0x31a1ef,_0x340550){return _0x3ed69f[_0x4dc3('0x4')][_0x4dc3('0x5')]({'value':_0x3d74c3[_0x4dc3('0x6')]},{'where':{'field':'mailSubstatus','value':_0x3d74c3[_0x4dc3('0x7')][_0x4dc3('0x6')]}})[_0x4dc3('0x8')](function(){_0x340550();})[_0x4dc3('0x9')](function(_0xb8685a){_0x340550(_0xb8685a);});}}});}; \ No newline at end of file +var _0xc815=['_previousDataValues','catch','./mailSubstatus.attributes','exports','models','define','MailSubstatus','mail_substatuses','Condition','update','name','mailSubstatus'];(function(_0x3f3848,_0x3cdd50){var _0x113b97=function(_0x3ee6e8){while(--_0x3ee6e8){_0x3f3848['push'](_0x3f3848['shift']());}};_0x113b97(++_0x3cdd50);}(_0xc815,0xaa));var _0x5c81=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xc815[_0x4a747d];return _0x3a5b5c;};'use strict';var attributes=require(_0x5c81('0x0'));module[_0x5c81('0x1')]=function(_0x124473){var _0x122cb7=_0x124473[_0x5c81('0x2')];return _0x124473[_0x5c81('0x3')](_0x5c81('0x4'),attributes,{'tableName':_0x5c81('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0xd6d8c1,_0xdb8f53,_0x16089e){return _0x122cb7[_0x5c81('0x6')][_0x5c81('0x7')]({'value':_0xd6d8c1[_0x5c81('0x8')]},{'where':{'field':_0x5c81('0x9'),'value':_0xd6d8c1[_0x5c81('0xa')]['name']}})['then'](function(){_0x16089e();})[_0x5c81('0xb')](function(_0x107da4){_0x16089e(_0x107da4);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 9244564..83d5287 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 _0x0690=['jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x347fc7,_0x27e40e){var _0x1f8d56=function(_0x4fd8ba){while(--_0x4fd8ba){_0x347fc7['push'](_0x347fc7['shift']());}};_0x1f8d56(++_0x27e40e);}(_0x0690,0xeb));var _0x0069=function(_0x5ecc1b,_0x537be5){_0x5ecc1b=_0x5ecc1b-0x0;var _0x3f9382=_0x0690[_0x5ecc1b];return _0x3f9382;};'use strict';var _=require(_0x0069('0x0'));var util=require(_0x0069('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0069('0x2'));var fs=require('fs');var Redis=require(_0x0069('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0069('0x4'));var logger=require(_0x0069('0x5'))(_0x0069('0x6'));var config=require('../../config/environment');var jayson=require(_0x0069('0x7'));var client=jayson[_0x0069('0x8')][_0x0069('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5564ce,_0x52f239,_0x6092f2){return new BPromise(function(_0x278787,_0x11e228){return client[_0x0069('0xa')](_0x5564ce,_0x6092f2)[_0x0069('0xb')](function(_0x793c44){logger[_0x0069('0xc')](_0x0069('0xd'),_0x52f239,'request\x20sent');logger[_0x0069('0xe')](_0x0069('0xf'),_0x52f239,_0x0069('0x10'),JSON[_0x0069('0x11')](_0x793c44));if(_0x793c44[_0x0069('0x12')]){if(_0x793c44['error'][_0x0069('0x13')]===0x1f4){logger[_0x0069('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x52f239,_0x793c44[_0x0069('0x12')]['message']);return _0x11e228(_0x793c44[_0x0069('0x12')][_0x0069('0x14')]);}logger[_0x0069('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x52f239,_0x793c44[_0x0069('0x12')][_0x0069('0x14')]);return _0x278787(_0x793c44[_0x0069('0x12')][_0x0069('0x14')]);}else{logger['info'](_0x0069('0xd'),_0x52f239,_0x0069('0x10'));_0x278787(_0x793c44[_0x0069('0x15')]['message']);}})['catch'](function(_0x3701ff){logger['error'](_0x0069('0xd'),_0x52f239,_0x3701ff);_0x11e228(_0x3701ff);});});} \ No newline at end of file +var _0xa10d=['jayson/promise','client','http','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','../../config/logger','rpc','../../config/environment'];(function(_0x3cef5d,_0x26d5f1){var _0x2bc228=function(_0x52f4b6){while(--_0x52f4b6){_0x3cef5d['push'](_0x3cef5d['shift']());}};_0x2bc228(++_0x26d5f1);}(_0xa10d,0x1dc));var _0xda10=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xa10d[_0x1b6186];return _0x186121;};'use strict';var _=require(_0xda10('0x0'));var util=require(_0xda10('0x1'));var moment=require(_0xda10('0x2'));var BPromise=require('bluebird');var rs=require(_0xda10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xda10('0x4'))(_0xda10('0x5'));var config=require(_0xda10('0x6'));var jayson=require(_0xda10('0x7'));var client=jayson[_0xda10('0x8')][_0xda10('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x480cf3,_0xc912fa,_0x3fe396){return new BPromise(function(_0x3601e8,_0x46e4e3){return client['request'](_0x480cf3,_0x3fe396)[_0xda10('0xa')](function(_0x1c8908){logger[_0xda10('0xb')](_0xda10('0xc'),_0xc912fa,_0xda10('0xd'));logger[_0xda10('0xe')](_0xda10('0xf'),_0xc912fa,'request\x20sent',JSON[_0xda10('0x10')](_0x1c8908));if(_0x1c8908[_0xda10('0x11')]){if(_0x1c8908[_0xda10('0x11')]['code']===0x1f4){logger[_0xda10('0x11')](_0xda10('0xc'),_0xc912fa,_0x1c8908[_0xda10('0x11')]['message']);return _0x46e4e3(_0x1c8908[_0xda10('0x11')]['message']);}logger[_0xda10('0x11')]('MailSubstatus,\x20%s,\x20%s',_0xc912fa,_0x1c8908[_0xda10('0x11')]['message']);return _0x3601e8(_0x1c8908[_0xda10('0x11')][_0xda10('0x12')]);}else{logger[_0xda10('0xb')]('MailSubstatus,\x20%s,\x20%s',_0xc912fa,_0xda10('0xd'));_0x3601e8(_0x1c8908[_0xda10('0x13')][_0xda10('0x12')]);}})[_0xda10('0x14')](function(_0x55ec74){logger[_0xda10('0x11')](_0xda10('0xc'),_0xc912fa,_0x55ec74);_0x46e4e3(_0x55ec74);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 365a787..15a2903 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 _0x4931=['isAuthenticated','index','get','/describe','describe','/:id','show','create','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4931,0x7d));var _0x1493=function(_0x666357,_0x46f30f){_0x666357=_0x666357-0x0;var _0xce4f94=_0x4931[_0x666357];return _0xce4f94;};'use strict';var multer=require(_0x1493('0x0'));var util=require(_0x1493('0x1'));var path=require(_0x1493('0x2'));var timeout=require('connect-timeout');var express=require(_0x1493('0x3'));var router=express[_0x1493('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1493('0x5'));var interaction=require(_0x1493('0x6'));var config=require('../../config/environment');var controller=require(_0x1493('0x7'));router['get']('/',auth[_0x1493('0x8')](),controller[_0x1493('0x9')]);router[_0x1493('0xa')](_0x1493('0xb'),auth['isAuthenticated'](),controller[_0x1493('0xc')]);router[_0x1493('0xa')](_0x1493('0xd'),auth[_0x1493('0x8')](),controller[_0x1493('0xe')]);router['post']('/',auth[_0x1493('0x8')](),controller[_0x1493('0xf')]);router['put'](_0x1493('0xd'),auth[_0x1493('0x8')](),controller[_0x1493('0x10')]);router['delete'](_0x1493('0xd'),auth[_0x1493('0x8')](),controller[_0x1493('0x11')]);module[_0x1493('0x12')]=router; \ No newline at end of file +var _0x5c30=['index','/describe','describe','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','isAuthenticated'];(function(_0x96093f,_0x21ff01){var _0x9cdcb4=function(_0x3f7cbd){while(--_0x3f7cbd){_0x96093f['push'](_0x96093f['shift']());}};_0x9cdcb4(++_0x21ff01);}(_0x5c30,0x199));var _0x05c3=function(_0x2ec42b,_0x293f68){_0x2ec42b=_0x2ec42b-0x0;var _0x2efa28=_0x5c30[_0x2ec42b];return _0x2efa28;};'use strict';var multer=require(_0x05c3('0x0'));var util=require(_0x05c3('0x1'));var path=require(_0x05c3('0x2'));var timeout=require(_0x05c3('0x3'));var express=require('express');var router=express[_0x05c3('0x4')]();var fs_extra=require(_0x05c3('0x5'));var auth=require(_0x05c3('0x6'));var interaction=require(_0x05c3('0x7'));var config=require('../../config/environment');var controller=require(_0x05c3('0x8'));router[_0x05c3('0x9')]('/',auth[_0x05c3('0xa')](),controller[_0x05c3('0xb')]);router[_0x05c3('0x9')](_0x05c3('0xc'),auth[_0x05c3('0xa')](),controller[_0x05c3('0xd')]);router[_0x05c3('0x9')](_0x05c3('0xe'),auth[_0x05c3('0xa')](),controller[_0x05c3('0xf')]);router['post']('/',auth[_0x05c3('0xa')](),controller['create']);router[_0x05c3('0x10')](_0x05c3('0xe'),auth[_0x05c3('0xa')](),controller[_0x05c3('0x11')]);router[_0x05c3('0x12')](_0x05c3('0xe'),auth[_0x05c3('0xa')](),controller[_0x05c3('0x13')]);module[_0x05c3('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 7ff4fc6..f3d2245 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x348681,_0x486a1d){var _0x30d4b7=function(_0x4b6cb1){while(--_0x4b6cb1){_0x348681['push'](_0x348681['shift']());}};_0x30d4b7(++_0x486a1d);}(_0x54ef,0x112));var _0xf54e=function(_0x578ef2,_0xd2c04f){_0x578ef2=_0x578ef2-0x0;var _0x1e17c5=_0x54ef[_0x578ef2];return _0x1e17c5;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x776417,_0x35ae0c){var _0x5a214b=function(_0x331088){while(--_0x331088){_0x776417['push'](_0x776417['shift']());}};_0x5a214b(++_0x35ae0c);}(_0xaa88,0x137));var _0x8aa8=function(_0x4c0622,_0x5dacaf){_0x4c0622=_0x4c0622-0x0;var _0x1799d8=_0xaa88[_0x4c0622];return _0x1799d8;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index e18e12b..1c20a3e 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 _0x0d16=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','error','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','then','includeAll','findAll','keys','include','options','catch','create','body','find','params','destroy','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x2a8c21,_0x163576){var _0x5f3061=function(_0x4dc8eb){while(--_0x4dc8eb){_0x2a8c21['push'](_0x2a8c21['shift']());}};_0x5f3061(++_0x163576);}(_0x0d16,0xd4));var _0x60d1=function(_0x51b2a8,_0x471d5d){_0x51b2a8=_0x51b2a8-0x0;var _0x37ce12=_0x0d16[_0x51b2a8];return _0x37ce12;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x60d1('0x0'));var zipdir=require(_0x60d1('0x1'));var jsonpatch=require(_0x60d1('0x2'));var rp=require('request-promise');var moment=require(_0x60d1('0x3'));var BPromise=require(_0x60d1('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x60d1('0x5'));var sox=require(_0x60d1('0x6'));var csv=require('to-csv');var ejs=require(_0x60d1('0x7'));var fs=require('fs');var fs_extra=require(_0x60d1('0x8'));var _=require(_0x60d1('0x9'));var squel=require('squel');var crypto=require(_0x60d1('0xa'));var jsforce=require(_0x60d1('0xb'));var deskjs=require(_0x60d1('0xc'));var toCsv=require('to-csv');var querystring=require(_0x60d1('0xd'));var Papa=require(_0x60d1('0xe'));var Redis=require(_0x60d1('0xf'));var authService=require(_0x60d1('0x10'));var qs=require(_0x60d1('0x11'));var as=require(_0x60d1('0x12'));var hardwareService=require(_0x60d1('0x13'));var logger=require(_0x60d1('0x14'))(_0x60d1('0x15'));var utils=require(_0x60d1('0x16'));var config=require(_0x60d1('0x17'));var licenseUtil=require(_0x60d1('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a2bab,_0x146f22){_0x146f22=_0x146f22||0xcc;return function(_0x5353c3){if(_0x5353c3){return _0x5a2bab[_0x60d1('0x19')](_0x146f22);}return _0x5a2bab[_0x60d1('0x1a')](_0x146f22)[_0x60d1('0x1b')]();};}function respondWithResult(_0x1e839a,_0x560cea){_0x560cea=_0x560cea||0xc8;return function(_0x39d11b){if(_0x39d11b){return _0x1e839a[_0x60d1('0x1a')](_0x560cea)['json'](_0x39d11b);}};}function respondWithFilteredResult(_0x1ecee2,_0x39a74d){return function(_0x52b627){if(_0x52b627){var _0x100d45=typeof _0x39a74d['offset']===_0x60d1('0x1c')&&typeof _0x39a74d['limit']===_0x60d1('0x1c');var _0x4eab9d=_0x52b627[_0x60d1('0x1d')];var _0x573769=_0x100d45?0x0:_0x39a74d['offset'];var _0x8f055c=_0x100d45?_0x52b627[_0x60d1('0x1d')]:_0x39a74d[_0x60d1('0x1e')]+_0x39a74d[_0x60d1('0x1f')];var _0x15b95a;if(_0x8f055c>=_0x4eab9d){_0x8f055c=_0x4eab9d;_0x15b95a=0xc8;}else{_0x15b95a=0xce;}_0x1ecee2['status'](_0x15b95a);return _0x1ecee2[_0x60d1('0x20')](_0x60d1('0x21'),_0x573769+'-'+_0x8f055c+'/'+_0x4eab9d)[_0x60d1('0x22')](_0x52b627);}return null;};}function patchUpdates(_0xe6a097){return function(_0x3ab5aa){try{jsonpatch[_0x60d1('0x23')](_0x3ab5aa,_0xe6a097,!![]);}catch(_0xb40f9e){return BPromise[_0x60d1('0x24')](_0xb40f9e);}return _0x3ab5aa[_0x60d1('0x25')]();};}function saveUpdates(_0x2c3b2f,_0x1ceb10){return function(_0x5b0bb9){if(_0x5b0bb9){return _0x5b0bb9[_0x60d1('0x26')](_0x2c3b2f)['then'](function(_0x272e43){return _0x272e43;});}return null;};}function removeEntity(_0x3adb29,_0x289514){return function(_0x27b113){if(_0x27b113){return _0x27b113['destroy']()['then'](function(){_0x3adb29['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xfc456c,_0xdbe9cd){return function(_0x437f2d){if(!_0x437f2d){_0xfc456c[_0x60d1('0x19')](0x194);}return _0x437f2d;};}function handleError(_0xe306fd,_0x41cef9){_0x41cef9=_0x41cef9||0x1f4;return function(_0x52df48){logger[_0x60d1('0x27')](_0x52df48['stack']);if(_0x52df48['name']){delete _0x52df48[_0x60d1('0x28')];}_0xe306fd[_0x60d1('0x1a')](_0x41cef9)[_0x60d1('0x29')](_0x52df48);};}exports[_0x60d1('0x2a')]=function(_0x461a2f,_0x21d503){var _0x1724cd={},_0xf5794b={},_0x2e72f9={'count':0x0,'rows':[]};var _0x57a170=_[_0x60d1('0x2b')](db[_0x60d1('0x2c')][_0x60d1('0x2d')],function(_0xb81356){return{'name':_0xb81356[_0x60d1('0x2e')],'type':_0xb81356[_0x60d1('0x2f')]['key']};});_0xf5794b[_0x60d1('0x30')]=_[_0x60d1('0x2b')](_0x57a170,_0x60d1('0x28'));_0xf5794b[_0x60d1('0x31')]=_['keys'](_0x461a2f[_0x60d1('0x31')]);_0xf5794b[_0x60d1('0x32')]=_[_0x60d1('0x33')](_0xf5794b[_0x60d1('0x30')],_0xf5794b[_0x60d1('0x31')]);_0x1724cd[_0x60d1('0x34')]=_['intersection'](_0xf5794b[_0x60d1('0x30')],qs['fields'](_0x461a2f[_0x60d1('0x31')][_0x60d1('0x35')]));_0x1724cd[_0x60d1('0x34')]=_0x1724cd['attributes'][_0x60d1('0x36')]?_0x1724cd[_0x60d1('0x34')]:_0xf5794b[_0x60d1('0x30')];if(!_0x461a2f[_0x60d1('0x31')][_0x60d1('0x37')](_0x60d1('0x38'))){_0x1724cd[_0x60d1('0x1f')]=qs['limit'](_0x461a2f[_0x60d1('0x31')][_0x60d1('0x1f')]);_0x1724cd[_0x60d1('0x1e')]=qs[_0x60d1('0x1e')](_0x461a2f[_0x60d1('0x31')][_0x60d1('0x1e')]);}_0x1724cd['order']=qs[_0x60d1('0x39')](_0x461a2f[_0x60d1('0x31')]['sort']);_0x1724cd['where']=qs[_0x60d1('0x32')](_[_0x60d1('0x3a')](_0x461a2f['query'],_0xf5794b[_0x60d1('0x32')]),_0x57a170);if(_0x461a2f[_0x60d1('0x31')]['filter']){_0x1724cd[_0x60d1('0x3b')]=_[_0x60d1('0x3c')](_0x1724cd[_0x60d1('0x3b')],{'$or':_[_0x60d1('0x2b')](_0x57a170,function(_0x173a75){if(_0x173a75[_0x60d1('0x2f')]!==_0x60d1('0x3d')){var _0x5f2450={};_0x5f2450[_0x173a75[_0x60d1('0x28')]]={'$like':'%'+_0x461a2f[_0x60d1('0x31')][_0x60d1('0x3e')]+'%'};return _0x5f2450;}})});}_0x1724cd=_[_0x60d1('0x3c')]({},_0x1724cd,_0x461a2f['options']);var _0xc9c62={'where':_0x1724cd[_0x60d1('0x3b')]};return db[_0x60d1('0x2c')][_0x60d1('0x1d')](_0xc9c62)[_0x60d1('0x3f')](function(_0x9f63b1){_0x2e72f9[_0x60d1('0x1d')]=_0x9f63b1;if(_0x461a2f[_0x60d1('0x31')][_0x60d1('0x40')]){_0x1724cd['include']=[{'all':!![]}];}return db['MailTransferReport'][_0x60d1('0x41')](_0x1724cd);})[_0x60d1('0x3f')](function(_0x4e22cb){_0x2e72f9['rows']=_0x4e22cb;return _0x2e72f9;})['then'](respondWithFilteredResult(_0x21d503,_0x1724cd))['catch'](handleError(_0x21d503,null));};exports['show']=function(_0x3d3c48,_0x53407d){var _0x59d2f6={'raw':!![],'where':{'id':_0x3d3c48['params']['id']}},_0x204d3d={};_0x204d3d[_0x60d1('0x30')]=_[_0x60d1('0x42')](db[_0x60d1('0x2c')][_0x60d1('0x2d')]);_0x204d3d[_0x60d1('0x31')]=_[_0x60d1('0x42')](_0x3d3c48[_0x60d1('0x31')]);_0x204d3d['filters']=_[_0x60d1('0x33')](_0x204d3d[_0x60d1('0x30')],_0x204d3d[_0x60d1('0x31')]);_0x59d2f6[_0x60d1('0x34')]=_[_0x60d1('0x33')](_0x204d3d['model'],qs[_0x60d1('0x35')](_0x3d3c48[_0x60d1('0x31')][_0x60d1('0x35')]));_0x59d2f6['attributes']=_0x59d2f6[_0x60d1('0x34')]['length']?_0x59d2f6[_0x60d1('0x34')]:_0x204d3d[_0x60d1('0x30')];if(_0x3d3c48[_0x60d1('0x31')][_0x60d1('0x40')]){_0x59d2f6[_0x60d1('0x43')]=[{'all':!![]}];}_0x59d2f6=_[_0x60d1('0x3c')]({},_0x59d2f6,_0x3d3c48[_0x60d1('0x44')]);return db[_0x60d1('0x2c')]['find'](_0x59d2f6)[_0x60d1('0x3f')](handleEntityNotFound(_0x53407d,null))[_0x60d1('0x3f')](respondWithResult(_0x53407d,null))[_0x60d1('0x45')](handleError(_0x53407d,null));};exports[_0x60d1('0x46')]=function(_0x18d996,_0x27f1ea){return db[_0x60d1('0x2c')][_0x60d1('0x46')](_0x18d996[_0x60d1('0x47')],{})[_0x60d1('0x3f')](respondWithResult(_0x27f1ea,0xc9))['catch'](handleError(_0x27f1ea,null));};exports[_0x60d1('0x26')]=function(_0x4ebb80,_0x3b996c){if(_0x4ebb80[_0x60d1('0x47')]['id']){delete _0x4ebb80[_0x60d1('0x47')]['id'];}return db[_0x60d1('0x2c')][_0x60d1('0x48')]({'where':{'id':_0x4ebb80[_0x60d1('0x49')]['id']}})['then'](handleEntityNotFound(_0x3b996c,null))['then'](saveUpdates(_0x4ebb80['body'],null))[_0x60d1('0x3f')](respondWithResult(_0x3b996c,null))[_0x60d1('0x45')](handleError(_0x3b996c,null));};exports[_0x60d1('0x4a')]=function(_0x342e90,_0x306db2){return db[_0x60d1('0x2c')][_0x60d1('0x48')]({'where':{'id':_0x342e90[_0x60d1('0x49')]['id']}})[_0x60d1('0x3f')](handleEntityNotFound(_0x306db2,null))[_0x60d1('0x3f')](removeEntity(_0x306db2,null))[_0x60d1('0x45')](handleError(_0x306db2,null));};exports[_0x60d1('0x4b')]=function(_0x28f6a2,_0x33de8e){return db[_0x60d1('0x2c')][_0x60d1('0x4b')]()[_0x60d1('0x3f')](respondWithResult(_0x33de8e,null))[_0x60d1('0x45')](handleError(_0x33de8e,null));}; \ No newline at end of file +var _0xf7ca=['keys','filters','intersection','attributes','model','fields','length','nolimit','limit','where','pick','merge','VIRTUAL','filter','options','include','rows','catch','params','includeAll','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','MailTransferReport','type','key','query'];(function(_0x5337c4,_0x471ab6){var _0x1f25af=function(_0x57088b){while(--_0x57088b){_0x5337c4['push'](_0x5337c4['shift']());}};_0x1f25af(++_0x471ab6);}(_0xf7ca,0x1b6));var _0xaf7c=function(_0x36f748,_0x3d45d8){_0x36f748=_0x36f748-0x0;var _0x292bf0=_0xf7ca[_0x36f748];return _0x292bf0;};'use strict';var emlformat=require(_0xaf7c('0x0'));var rimraf=require(_0xaf7c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaf7c('0x2'));var rp=require(_0xaf7c('0x3'));var moment=require('moment');var BPromise=require(_0xaf7c('0x4'));var Mustache=require(_0xaf7c('0x5'));var util=require(_0xaf7c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xaf7c('0x7'));var ejs=require(_0xaf7c('0x8'));var fs=require('fs');var fs_extra=require(_0xaf7c('0x9'));var _=require('lodash');var squel=require(_0xaf7c('0xa'));var crypto=require(_0xaf7c('0xb'));var jsforce=require(_0xaf7c('0xc'));var deskjs=require(_0xaf7c('0xd'));var toCsv=require(_0xaf7c('0x7'));var querystring=require(_0xaf7c('0xe'));var Papa=require(_0xaf7c('0xf'));var Redis=require(_0xaf7c('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaf7c('0x11'));var hardwareService=require(_0xaf7c('0x12'));var logger=require(_0xaf7c('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xaf7c('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xaf7c('0x15'))['db'];function respondWithStatusCode(_0xf2387f,_0x334a41){_0x334a41=_0x334a41||0xcc;return function(_0x48ed8f){if(_0x48ed8f){return _0xf2387f[_0xaf7c('0x16')](_0x334a41);}return _0xf2387f['status'](_0x334a41)[_0xaf7c('0x17')]();};}function respondWithResult(_0x7ab12d,_0x236411){_0x236411=_0x236411||0xc8;return function(_0x1d5e44){if(_0x1d5e44){return _0x7ab12d['status'](_0x236411)['json'](_0x1d5e44);}};}function respondWithFilteredResult(_0x5c1c2f,_0xe555bd){return function(_0xd69f03){if(_0xd69f03){var _0x5e29a1=typeof _0xe555bd[_0xaf7c('0x18')]===_0xaf7c('0x19')&&typeof _0xe555bd['limit']==='undefined';var _0x452098=_0xd69f03['count'];var _0x4cae33=_0x5e29a1?0x0:_0xe555bd[_0xaf7c('0x18')];var _0x5218bb=_0x5e29a1?_0xd69f03[_0xaf7c('0x1a')]:_0xe555bd['offset']+_0xe555bd['limit'];var _0x10fc87;if(_0x5218bb>=_0x452098){_0x5218bb=_0x452098;_0x10fc87=0xc8;}else{_0x10fc87=0xce;}_0x5c1c2f['status'](_0x10fc87);return _0x5c1c2f[_0xaf7c('0x1b')](_0xaf7c('0x1c'),_0x4cae33+'-'+_0x5218bb+'/'+_0x452098)[_0xaf7c('0x1d')](_0xd69f03);}return null;};}function patchUpdates(_0x253f46){return function(_0x5d1f34){try{jsonpatch[_0xaf7c('0x1e')](_0x5d1f34,_0x253f46,!![]);}catch(_0x549c0b){return BPromise[_0xaf7c('0x1f')](_0x549c0b);}return _0x5d1f34[_0xaf7c('0x20')]();};}function saveUpdates(_0x1d12ab,_0x14013){return function(_0x48c1d7){if(_0x48c1d7){return _0x48c1d7[_0xaf7c('0x21')](_0x1d12ab)[_0xaf7c('0x22')](function(_0xfaf171){return _0xfaf171;});}return null;};}function removeEntity(_0x491d7c,_0x2125df){return function(_0x368c47){if(_0x368c47){return _0x368c47[_0xaf7c('0x23')]()[_0xaf7c('0x22')](function(){_0x491d7c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x567dc0,_0x20d01b){return function(_0x1e9bce){if(!_0x1e9bce){_0x567dc0['sendStatus'](0x194);}return _0x1e9bce;};}function handleError(_0x1f10a8,_0x5806d4){_0x5806d4=_0x5806d4||0x1f4;return function(_0x241de0){logger[_0xaf7c('0x24')](_0x241de0[_0xaf7c('0x25')]);if(_0x241de0[_0xaf7c('0x26')]){delete _0x241de0['name'];}_0x1f10a8['status'](_0x5806d4)['send'](_0x241de0);};}exports[_0xaf7c('0x27')]=function(_0x1c08e1,_0x531333){var _0x171447={},_0xe4c494={},_0x480051={'count':0x0,'rows':[]};var _0x525fd3=_[_0xaf7c('0x28')](db[_0xaf7c('0x29')]['rawAttributes'],function(_0x800e65){return{'name':_0x800e65['fieldName'],'type':_0x800e65[_0xaf7c('0x2a')][_0xaf7c('0x2b')]};});_0xe4c494['model']=_[_0xaf7c('0x28')](_0x525fd3,_0xaf7c('0x26'));_0xe4c494[_0xaf7c('0x2c')]=_[_0xaf7c('0x2d')](_0x1c08e1[_0xaf7c('0x2c')]);_0xe4c494[_0xaf7c('0x2e')]=_[_0xaf7c('0x2f')](_0xe4c494['model'],_0xe4c494['query']);_0x171447[_0xaf7c('0x30')]=_[_0xaf7c('0x2f')](_0xe4c494[_0xaf7c('0x31')],qs[_0xaf7c('0x32')](_0x1c08e1[_0xaf7c('0x2c')][_0xaf7c('0x32')]));_0x171447['attributes']=_0x171447['attributes'][_0xaf7c('0x33')]?_0x171447[_0xaf7c('0x30')]:_0xe4c494[_0xaf7c('0x31')];if(!_0x1c08e1[_0xaf7c('0x2c')]['hasOwnProperty'](_0xaf7c('0x34'))){_0x171447[_0xaf7c('0x35')]=qs[_0xaf7c('0x35')](_0x1c08e1[_0xaf7c('0x2c')]['limit']);_0x171447['offset']=qs[_0xaf7c('0x18')](_0x1c08e1[_0xaf7c('0x2c')][_0xaf7c('0x18')]);}_0x171447['order']=qs['sort'](_0x1c08e1[_0xaf7c('0x2c')]['sort']);_0x171447[_0xaf7c('0x36')]=qs[_0xaf7c('0x2e')](_[_0xaf7c('0x37')](_0x1c08e1[_0xaf7c('0x2c')],_0xe4c494['filters']),_0x525fd3);if(_0x1c08e1[_0xaf7c('0x2c')]['filter']){_0x171447[_0xaf7c('0x36')]=_[_0xaf7c('0x38')](_0x171447[_0xaf7c('0x36')],{'$or':_[_0xaf7c('0x28')](_0x525fd3,function(_0x2fea69){if(_0x2fea69[_0xaf7c('0x2a')]!==_0xaf7c('0x39')){var _0x5c9a28={};_0x5c9a28[_0x2fea69[_0xaf7c('0x26')]]={'$like':'%'+_0x1c08e1['query'][_0xaf7c('0x3a')]+'%'};return _0x5c9a28;}})});}_0x171447=_[_0xaf7c('0x38')]({},_0x171447,_0x1c08e1[_0xaf7c('0x3b')]);var _0x3ecbd0={'where':_0x171447['where']};return db[_0xaf7c('0x29')][_0xaf7c('0x1a')](_0x3ecbd0)[_0xaf7c('0x22')](function(_0x34604a){_0x480051[_0xaf7c('0x1a')]=_0x34604a;if(_0x1c08e1['query']['includeAll']){_0x171447[_0xaf7c('0x3c')]=[{'all':!![]}];}return db[_0xaf7c('0x29')]['findAll'](_0x171447);})[_0xaf7c('0x22')](function(_0x186dea){_0x480051[_0xaf7c('0x3d')]=_0x186dea;return _0x480051;})[_0xaf7c('0x22')](respondWithFilteredResult(_0x531333,_0x171447))[_0xaf7c('0x3e')](handleError(_0x531333,null));};exports['show']=function(_0x4c4e15,_0x1b88b3){var _0x356a4e={'raw':!![],'where':{'id':_0x4c4e15[_0xaf7c('0x3f')]['id']}},_0x465d6a={};_0x465d6a[_0xaf7c('0x31')]=_[_0xaf7c('0x2d')](db['MailTransferReport']['rawAttributes']);_0x465d6a[_0xaf7c('0x2c')]=_['keys'](_0x4c4e15[_0xaf7c('0x2c')]);_0x465d6a[_0xaf7c('0x2e')]=_['intersection'](_0x465d6a[_0xaf7c('0x31')],_0x465d6a[_0xaf7c('0x2c')]);_0x356a4e[_0xaf7c('0x30')]=_['intersection'](_0x465d6a['model'],qs[_0xaf7c('0x32')](_0x4c4e15[_0xaf7c('0x2c')]['fields']));_0x356a4e[_0xaf7c('0x30')]=_0x356a4e[_0xaf7c('0x30')][_0xaf7c('0x33')]?_0x356a4e[_0xaf7c('0x30')]:_0x465d6a[_0xaf7c('0x31')];if(_0x4c4e15[_0xaf7c('0x2c')][_0xaf7c('0x40')]){_0x356a4e[_0xaf7c('0x3c')]=[{'all':!![]}];}_0x356a4e=_[_0xaf7c('0x38')]({},_0x356a4e,_0x4c4e15[_0xaf7c('0x3b')]);return db['MailTransferReport'][_0xaf7c('0x41')](_0x356a4e)['then'](handleEntityNotFound(_0x1b88b3,null))[_0xaf7c('0x22')](respondWithResult(_0x1b88b3,null))[_0xaf7c('0x3e')](handleError(_0x1b88b3,null));};exports[_0xaf7c('0x42')]=function(_0x3988e1,_0x3b3a2c){return db[_0xaf7c('0x29')]['create'](_0x3988e1[_0xaf7c('0x43')],{})[_0xaf7c('0x22')](respondWithResult(_0x3b3a2c,0xc9))[_0xaf7c('0x3e')](handleError(_0x3b3a2c,null));};exports[_0xaf7c('0x21')]=function(_0x2ac20c,_0x4cab68){if(_0x2ac20c[_0xaf7c('0x43')]['id']){delete _0x2ac20c[_0xaf7c('0x43')]['id'];}return db[_0xaf7c('0x29')][_0xaf7c('0x41')]({'where':{'id':_0x2ac20c[_0xaf7c('0x3f')]['id']}})[_0xaf7c('0x22')](handleEntityNotFound(_0x4cab68,null))['then'](saveUpdates(_0x2ac20c[_0xaf7c('0x43')],null))[_0xaf7c('0x22')](respondWithResult(_0x4cab68,null))['catch'](handleError(_0x4cab68,null));};exports['destroy']=function(_0x294c74,_0x2c8249){return db[_0xaf7c('0x29')][_0xaf7c('0x41')]({'where':{'id':_0x294c74[_0xaf7c('0x3f')]['id']}})[_0xaf7c('0x22')](handleEntityNotFound(_0x2c8249,null))['then'](removeEntity(_0x2c8249,null))['catch'](handleError(_0x2c8249,null));};exports[_0xaf7c('0x44')]=function(_0x3c0476,_0x45e0b7){return db[_0xaf7c('0x29')][_0xaf7c('0x44')]()['then'](respondWithResult(_0x45e0b7,null))[_0xaf7c('0x3e')](handleError(_0x45e0b7,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 4fb8fb1..e0f1f94 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 _0x406f=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer','uniqueid','lodash','../../config/logger'];(function(_0x2b6a55,_0x1860a9){var _0x599954=function(_0x3bf430){while(--_0x3bf430){_0x2b6a55['push'](_0x2b6a55['shift']());}};_0x599954(++_0x1860a9);}(_0x406f,0xe8));var _0xf406=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x406f[_0x344a3f];return _0x264712;};'use strict';var _=require(_0xf406('0x0'));var util=require('util');var logger=require(_0xf406('0x1'))('api');var moment=require(_0xf406('0x2'));var BPromise=require(_0xf406('0x3'));var rp=require(_0xf406('0x4'));var fs=require('fs');var path=require(_0xf406('0x5'));var rimraf=require(_0xf406('0x6'));var config=require(_0xf406('0x7'));var attributes=require(_0xf406('0x8'));module[_0xf406('0x9')]=function(_0x40542f,_0x235134){return _0x40542f['define'](_0xf406('0xa'),attributes,{'tableName':_0xf406('0xb'),'paranoid':![],'indexes':[{'name':_0xf406('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3b75=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./mailTransferReport.attributes','exports','report_mail_transfer','uniqueid'];(function(_0x1ff575,_0xdba21f){var _0x48fc9e=function(_0x51cf97){while(--_0x51cf97){_0x1ff575['push'](_0x1ff575['shift']());}};_0x48fc9e(++_0xdba21f);}(_0x3b75,0x144));var _0x53b7=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x3b75[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0x53b7('0x0'));var util=require(_0x53b7('0x1'));var logger=require(_0x53b7('0x2'))(_0x53b7('0x3'));var moment=require(_0x53b7('0x4'));var BPromise=require(_0x53b7('0x5'));var rp=require(_0x53b7('0x6'));var fs=require('fs');var path=require(_0x53b7('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x53b7('0x8'));module[_0x53b7('0x9')]=function(_0x3bfde3,_0x46f651){return _0x3bfde3['define']('MailTransferReport',attributes,{'tableName':_0x53b7('0xa'),'paranoid':![],'indexes':[{'name':_0x53b7('0xb'),'fields':[_0x53b7('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 6f045a7..b918bd7 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 _0xe285=['code','MailTransferReport,\x20%s,\x20%s','message','info','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','debug','request\x20sent','stringify','error'];(function(_0x284541,_0x197a01){var _0xd528bc=function(_0x205412){while(--_0x205412){_0x284541['push'](_0x284541['shift']());}};_0xd528bc(++_0x197a01);}(_0xe285,0x122));var _0x5e28=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xe285[_0x23e7c1];return _0x1add43;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5e28('0x0'));var BPromise=require(_0x5e28('0x1'));var rs=require(_0x5e28('0x2'));var fs=require('fs');var Redis=require(_0x5e28('0x3'));var db=require(_0x5e28('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5e28('0x5'));var config=require(_0x5e28('0x6'));var jayson=require(_0x5e28('0x7'));var client=jayson[_0x5e28('0x8')][_0x5e28('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46181f,_0x322a77,_0x818f41){return new BPromise(function(_0x4ce413,_0x2ecd11){return client['request'](_0x46181f,_0x818f41)['then'](function(_0x50af99){logger['info']('MailTransferReport,\x20%s,\x20%s',_0x322a77,'request\x20sent');logger[_0x5e28('0xa')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x322a77,_0x5e28('0xb'),JSON[_0x5e28('0xc')](_0x50af99));if(_0x50af99[_0x5e28('0xd')]){if(_0x50af99[_0x5e28('0xd')][_0x5e28('0xe')]===0x1f4){logger[_0x5e28('0xd')](_0x5e28('0xf'),_0x322a77,_0x50af99[_0x5e28('0xd')][_0x5e28('0x10')]);return _0x2ecd11(_0x50af99['error'][_0x5e28('0x10')]);}logger[_0x5e28('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x322a77,_0x50af99['error'][_0x5e28('0x10')]);return _0x4ce413(_0x50af99[_0x5e28('0xd')]['message']);}else{logger[_0x5e28('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x322a77,_0x5e28('0xb'));_0x4ce413(_0x50af99['result'][_0x5e28('0x10')]);}})[_0x5e28('0x12')](function(_0x20a434){logger[_0x5e28('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x322a77,_0x20a434);_0x2ecd11(_0x20a434);});});} \ No newline at end of file +var _0x3d26=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','MailTransferReport,\x20%s,\x20%s','MailTransferReport,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x3b2395,_0x1cf2c1){var _0x2e6751=function(_0x4ea274){while(--_0x4ea274){_0x3b2395['push'](_0x3b2395['shift']());}};_0x2e6751(++_0x1cf2c1);}(_0x3d26,0x7d));var _0x63d2=function(_0x576df0,_0x3cf751){_0x576df0=_0x576df0-0x0;var _0x2ff311=_0x3d26[_0x576df0];return _0x2ff311;};'use strict';var _=require(_0x63d2('0x0'));var util=require(_0x63d2('0x1'));var moment=require(_0x63d2('0x2'));var BPromise=require(_0x63d2('0x3'));var rs=require(_0x63d2('0x4'));var fs=require('fs');var Redis=require(_0x63d2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x63d2('0x6'));var logger=require(_0x63d2('0x7'))('rpc');var config=require(_0x63d2('0x8'));var jayson=require(_0x63d2('0x9'));var client=jayson[_0x63d2('0xa')][_0x63d2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f32fa,_0x42fa06,_0x2c5ba6){return new BPromise(function(_0x22db03,_0x52210d){return client[_0x63d2('0xc')](_0x4f32fa,_0x2c5ba6)[_0x63d2('0xd')](function(_0x227ccd){logger['info'](_0x63d2('0xe'),_0x42fa06,'request\x20sent');logger['debug'](_0x63d2('0xf'),_0x42fa06,'request\x20sent',JSON['stringify'](_0x227ccd));if(_0x227ccd[_0x63d2('0x10')]){if(_0x227ccd['error']['code']===0x1f4){logger[_0x63d2('0x10')](_0x63d2('0xe'),_0x42fa06,_0x227ccd[_0x63d2('0x10')][_0x63d2('0x11')]);return _0x52210d(_0x227ccd['error'][_0x63d2('0x11')]);}logger[_0x63d2('0x10')](_0x63d2('0xe'),_0x42fa06,_0x227ccd['error'][_0x63d2('0x11')]);return _0x22db03(_0x227ccd['error'][_0x63d2('0x11')]);}else{logger[_0x63d2('0x12')](_0x63d2('0xe'),_0x42fa06,_0x63d2('0x13'));_0x22db03(_0x227ccd[_0x63d2('0x14')][_0x63d2('0x11')]);}})[_0x63d2('0x15')](function(_0x4e0df8){logger[_0x63d2('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x42fa06,_0x4e0df8);_0x52210d(_0x4e0df8);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 3315222..f701d58 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 _0xf5e9=['../../components/auth/service','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x545e48,_0x471714){var _0x2d6f13=function(_0x2bc9c5){while(--_0x2bc9c5){_0x545e48['push'](_0x545e48['shift']());}};_0x2d6f13(++_0x471714);}(_0xf5e9,0xcb));var _0x9f5e=function(_0x5659c0,_0x5f2532){_0x5659c0=_0x5659c0-0x0;var _0x36e3c0=_0xf5e9[_0x5659c0];return _0x36e3c0;};'use strict';var multer=require(_0x9f5e('0x0'));var util=require(_0x9f5e('0x1'));var path=require(_0x9f5e('0x2'));var timeout=require(_0x9f5e('0x3'));var express=require(_0x9f5e('0x4'));var router=express[_0x9f5e('0x5')]();var fs_extra=require(_0x9f5e('0x6'));var auth=require(_0x9f5e('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9f5e('0x8'));router[_0x9f5e('0x9')]('/',auth[_0x9f5e('0xa')](),controller[_0x9f5e('0xb')]);router[_0x9f5e('0x9')](_0x9f5e('0xc'),auth[_0x9f5e('0xa')](),controller[_0x9f5e('0xd')]);router[_0x9f5e('0x9')](_0x9f5e('0xe'),auth[_0x9f5e('0xa')](),controller['show']);router[_0x9f5e('0xf')]('/',auth['isAuthenticated'](),controller[_0x9f5e('0x10')]);router[_0x9f5e('0x11')](_0x9f5e('0xe'),auth[_0x9f5e('0xa')](),controller[_0x9f5e('0x12')]);router[_0x9f5e('0x13')](_0x9f5e('0xe'),auth[_0x9f5e('0xa')](),controller[_0x9f5e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xb2cd=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x22fef9,_0x1ac5e2){var _0x175fd8=function(_0x577e99){while(--_0x577e99){_0x22fef9['push'](_0x22fef9['shift']());}};_0x175fd8(++_0x1ac5e2);}(_0xb2cd,0xab));var _0xdb2c=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xb2cd[_0x500419];return _0x241c1a;};'use strict';var multer=require(_0xdb2c('0x0'));var util=require(_0xdb2c('0x1'));var path=require(_0xdb2c('0x2'));var timeout=require(_0xdb2c('0x3'));var express=require(_0xdb2c('0x4'));var router=express[_0xdb2c('0x5')]();var fs_extra=require(_0xdb2c('0x6'));var auth=require(_0xdb2c('0x7'));var interaction=require(_0xdb2c('0x8'));var config=require(_0xdb2c('0x9'));var controller=require(_0xdb2c('0xa'));router[_0xdb2c('0xb')]('/',auth[_0xdb2c('0xc')](),controller[_0xdb2c('0xd')]);router['get'](_0xdb2c('0xe'),auth['isAuthenticated'](),controller[_0xdb2c('0xf')]);router[_0xdb2c('0xb')](_0xdb2c('0x10'),auth[_0xdb2c('0xc')](),controller['show']);router[_0xdb2c('0x11')]('/',auth['isAuthenticated'](),controller[_0xdb2c('0x12')]);router[_0xdb2c('0x13')](_0xdb2c('0x10'),auth[_0xdb2c('0xc')](),controller['update']);router[_0xdb2c('0x14')](_0xdb2c('0x10'),auth[_0xdb2c('0xc')](),controller[_0xdb2c('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 593e23f..28b94ea 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 _0x1b29=['diff','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','DATE','getDataValue'];(function(_0x403115,_0x2d6d03){var _0x596ef3=function(_0x145d97){while(--_0x145d97){_0x403115['push'](_0x403115['shift']());}};_0x596ef3(++_0x2d6d03);}(_0x1b29,0x1d5));var _0x91b2=function(_0x8ad8,_0x4de02f){_0x8ad8=_0x8ad8-0x0;var _0x57e72a=_0x1b29[_0x8ad8];return _0x57e72a;};'use strict';var Sequelize=require(_0x91b2('0x0'));var moment=require(_0x91b2('0x1'));module[_0x91b2('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x91b2('0x3')]},'interface':{'type':Sequelize[_0x91b2('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x91b2('0x4'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x91b2('0x5')],'set':function(_0x4857a4){var _0x3cecf6=moment(_0x4857a4);var _0x442475=moment(this[_0x91b2('0x6')]('enterAt'));var _0x31f5c3=_0x3cecf6[_0x91b2('0x7')](_0x442475,_0x91b2('0x8'));this[_0x91b2('0x9')](_0x91b2('0xa'),_0x4857a4);this['setDataValue']('duration',_0x31f5c3>=0x0?_0x31f5c3:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x91b2('0xb')},'data2':{'type':Sequelize[_0x91b2('0x3')],'comment':_0x91b2('0xc')},'data3':{'type':Sequelize[_0x91b2('0x3')],'comment':_0x91b2('0xd')},'data4':{'type':Sequelize[_0x91b2('0x3')],'comment':_0x91b2('0xe')},'data5':{'type':Sequelize[_0x91b2('0x3')],'comment':_0x91b2('0xf')},'role':{'type':Sequelize[_0x91b2('0x3')]},'internal':{'type':Sequelize[_0x91b2('0x10')]},'uniqueid':{'type':Sequelize[_0x91b2('0x3')]}}; \ No newline at end of file +var _0x60f1=['exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue'];(function(_0x2c6e5d,_0x22cca6){var _0x39e3eb=function(_0x9e329b){while(--_0x9e329b){_0x2c6e5d['push'](_0x2c6e5d['shift']());}};_0x39e3eb(++_0x22cca6);}(_0x60f1,0x1bf));var _0x160f=function(_0x1f9744,_0x54a947){_0x1f9744=_0x1f9744-0x0;var _0x5aba67=_0x60f1[_0x1f9744];return _0x5aba67;};'use strict';var Sequelize=require(_0x160f('0x0'));var moment=require('moment');module[_0x160f('0x1')]={'channel':{'type':Sequelize[_0x160f('0x2')]},'membername':{'type':Sequelize[_0x160f('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x160f('0x2')],'defaultValue':_0x160f('0x3'),'comment':_0x160f('0x4')},'duration':{'type':Sequelize[_0x160f('0x5')]},'enterAt':{'type':Sequelize[_0x160f('0x6')]},'exitAt':{'type':Sequelize[_0x160f('0x6')],'set':function(_0x5dff06){var _0x49fc0b=moment(_0x5dff06);var _0x2ce396=moment(this[_0x160f('0x7')](_0x160f('0x8')));var _0x55d01b=_0x49fc0b[_0x160f('0x9')](_0x2ce396,_0x160f('0xa'));this[_0x160f('0xb')](_0x160f('0xc'),_0x5dff06);this[_0x160f('0xb')](_0x160f('0xd'),_0x55d01b>=0x0?_0x55d01b:null);}},'data1':{'type':Sequelize[_0x160f('0x2')],'comment':_0x160f('0xe')},'data2':{'type':Sequelize['STRING'],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x160f('0x2')],'comment':_0x160f('0xf')},'data4':{'type':Sequelize['STRING'],'comment':_0x160f('0x10')},'data5':{'type':Sequelize[_0x160f('0x2')],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x160f('0x5')]},'uniqueid':{'type':Sequelize[_0x160f('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index fe14533..e3c0a30 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 _0x008c=['destroy','sendStatus','send','index','MemberReport','rawAttributes','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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'];(function(_0x3c59b5,_0x40975c){var _0x40a8a1=function(_0x2c38c8){while(--_0x2c38c8){_0x3c59b5['push'](_0x3c59b5['shift']());}};_0x40a8a1(++_0x40975c);}(_0x008c,0x188));var _0xc008=function(_0x39adb2,_0x540b96){_0x39adb2=_0x39adb2-0x0;var _0x1df693=_0x008c[_0x39adb2];return _0x1df693;};'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(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_0x2a7d4f,_0xc008('0x2b'));_0x32390d[_0xc008('0x2c')]=_[_0xc008('0x2d')](_0x25eae4[_0xc008('0x2c')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x32390d[_0xc008('0x29')],_0x32390d[_0xc008('0x2c')]);_0x24c14c[_0xc008('0x30')]=_['intersection'](_0x32390d[_0xc008('0x29')],qs[_0xc008('0x31')](_0x25eae4['query'][_0xc008('0x31')]));_0x24c14c[_0xc008('0x30')]=_0x24c14c[_0xc008('0x30')][_0xc008('0x32')]?_0x24c14c[_0xc008('0x30')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2c')][_0xc008('0x33')](_0xc008('0x34'))){_0x24c14c['limit']=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1b')]);}_0x24c14c['order']=qs[_0xc008('0x35')](_0x25eae4[_0xc008('0x2c')]['sort']);_0x24c14c[_0xc008('0x36')]=qs[_0xc008('0x2e')](_['pick'](_0x25eae4[_0xc008('0x2c')],_0x32390d[_0xc008('0x2e')]),_0x2a7d4f);if(_0x25eae4[_0xc008('0x2c')]['filter']){_0x24c14c['where']=_['merge'](_0x24c14c[_0xc008('0x36')],{'$or':_['map'](_0x2a7d4f,function(_0x3dd0ac){if(_0x3dd0ac[_0xc008('0x37')]!==_0xc008('0x38')){var _0x440459={};_0x440459[_0x3dd0ac[_0xc008('0x2b')]]={'$like':'%'+_0x25eae4[_0xc008('0x2c')][_0xc008('0x39')]+'%'};return _0x440459;}})});}_0x24c14c=_[_0xc008('0x3a')]({},_0x24c14c,_0x25eae4[_0xc008('0x3b')]);var _0x387dfd={'where':_0x24c14c[_0xc008('0x36')]};return db[_0xc008('0x26')][_0xc008('0x1e')](_0x387dfd)[_0xc008('0x21')](function(_0x4cace5){_0x209591[_0xc008('0x1e')]=_0x4cace5;if(_0x25eae4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x24c14c[_0xc008('0x3d')]=[{'all':!![]}];}return db['MemberReport'][_0xc008('0x3e')](_0x24c14c);})[_0xc008('0x21')](function(_0xc8cb91){_0x209591[_0xc008('0x3f')]=_0xc8cb91;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))['catch'](handleError(_0x529961,null));};exports[_0xc008('0x40')]=function(_0x3323f4,_0x3794b0){var _0x3e9a99={'raw':!![],'where':{'id':_0x3323f4['params']['id']}},_0x7279e8={};_0x7279e8[_0xc008('0x29')]=_[_0xc008('0x2d')](db[_0xc008('0x26')][_0xc008('0x27')]);_0x7279e8['query']=_[_0xc008('0x2d')](_0x3323f4[_0xc008('0x2c')]);_0x7279e8[_0xc008('0x2e')]=_['intersection'](_0x7279e8[_0xc008('0x29')],_0x7279e8['query']);_0x3e9a99[_0xc008('0x30')]=_['intersection'](_0x7279e8[_0xc008('0x29')],qs[_0xc008('0x31')](_0x3323f4['query'][_0xc008('0x31')]));_0x3e9a99[_0xc008('0x30')]=_0x3e9a99[_0xc008('0x30')]['length']?_0x3e9a99[_0xc008('0x30')]:_0x7279e8[_0xc008('0x29')];if(_0x3323f4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x3e9a99[_0xc008('0x3d')]=[{'all':!![]}];}_0x3e9a99=_[_0xc008('0x3a')]({},_0x3e9a99,_0x3323f4['options']);return db['MemberReport']['find'](_0x3e9a99)[_0xc008('0x21')](handleEntityNotFound(_0x3794b0,null))[_0xc008('0x21')](respondWithResult(_0x3794b0,null))[_0xc008('0x41')](handleError(_0x3794b0,null));};exports[_0xc008('0x42')]=function(_0x25289f,_0x24f6a4){return db[_0xc008('0x26')][_0xc008('0x42')](_0x25289f['body'],{})['then'](respondWithResult(_0x24f6a4,0xc9))['catch'](handleError(_0x24f6a4,null));};exports[_0xc008('0x20')]=function(_0x2651cf,_0x158eae){if(_0x2651cf['body']['id']){delete _0x2651cf[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x44')]({'where':{'id':_0x2651cf[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x158eae,null))[_0xc008('0x21')](saveUpdates(_0x2651cf[_0xc008('0x43')],null))[_0xc008('0x21')](respondWithResult(_0x158eae,null))[_0xc008('0x41')](handleError(_0x158eae,null));};exports[_0xc008('0x22')]=function(_0x52c444,_0x4c63d4){return db[_0xc008('0x26')]['find']({'where':{'id':_0x52c444[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x4c63d4,null))[_0xc008('0x21')](removeEntity(_0x4c63d4,null))['catch'](handleError(_0x4c63d4,null));};exports[_0xc008('0x46')]=function(_0x32b435,_0xee64){return db[_0xc008('0x26')][_0xc008('0x46')]()['then'](respondWithResult(_0xee64,null))[_0xc008('0x41')](handleError(_0xee64,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(_0x2a6490,_0x1adf0f){var _0x1b31df=function(_0x51eeb7){while(--_0x51eeb7){_0x2a6490['push'](_0x2a6490['shift']());}};_0x1b31df(++_0x1adf0f);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){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 142c263..eae09da 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 _0x25fa=['MemberReport','report_member','membername_interface','membername','interface','lodash','../../config/logger','api','bluebird','request-promise','path','./memberReport.attributes','define'];(function(_0x26f93d,_0x49bebe){var _0x58bd77=function(_0x1f2648){while(--_0x1f2648){_0x26f93d['push'](_0x26f93d['shift']());}};_0x58bd77(++_0x49bebe);}(_0x25fa,0x109));var _0xa25f=function(_0x5271ca,_0x15d323){_0x5271ca=_0x5271ca-0x0;var _0x5c8646=_0x25fa[_0x5271ca];return _0x5c8646;};'use strict';var _=require(_0xa25f('0x0'));var util=require('util');var logger=require(_0xa25f('0x1'))(_0xa25f('0x2'));var moment=require('moment');var BPromise=require(_0xa25f('0x3'));var rp=require(_0xa25f('0x4'));var fs=require('fs');var path=require(_0xa25f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa25f('0x6'));module['exports']=function(_0x2ea9ea,_0x3ab530){return _0x2ea9ea[_0xa25f('0x7')](_0xa25f('0x8'),attributes,{'tableName':_0xa25f('0x9'),'paranoid':![],'indexes':[{'name':_0xa25f('0xa'),'fields':[_0xa25f('0xb'),_0xa25f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1bf3=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','define','MemberReport','report_member','membername_interface','membername','interface','lodash'];(function(_0xef2b60,_0x357604){var _0x525559=function(_0x21a069){while(--_0x21a069){_0xef2b60['push'](_0xef2b60['shift']());}};_0x525559(++_0x357604);}(_0x1bf3,0x16f));var _0x31bf=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x1bf3[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x31bf('0x0'));var util=require(_0x31bf('0x1'));var logger=require('../../config/logger')(_0x31bf('0x2'));var moment=require(_0x31bf('0x3'));var BPromise=require(_0x31bf('0x4'));var rp=require(_0x31bf('0x5'));var fs=require('fs');var path=require(_0x31bf('0x6'));var rimraf=require(_0x31bf('0x7'));var config=require(_0x31bf('0x8'));var attributes=require(_0x31bf('0x9'));module['exports']=function(_0x557d5c,_0x24b931){return _0x557d5c[_0x31bf('0xa')](_0x31bf('0xb'),attributes,{'tableName':_0x31bf('0xc'),'paranoid':![],'indexes':[{'name':_0x31bf('0xd'),'fields':[_0x31bf('0xe'),_0x31bf('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index e496474..f5e5eb2 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 _0xc4f5=['debug','MemberReport,\x20%s,\x20%s,\x20%s','error','message','catch','GetMemberReport','MemberReport','findAll','options','raw','attributes','limit','include','model','map','then','CreateMemberReport','create','body','stringify','UpdateMemberReport','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','MemberReport,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc4f5,0xa5));var _0x5c4f=function(_0x1ce23d,_0x25a351){_0x1ce23d=_0x1ce23d-0x0;var _0x4338d9=_0xc4f5[_0x1ce23d];return _0x4338d9;};'use strict';var _=require('lodash');var util=require(_0x5c4f('0x0'));var moment=require(_0x5c4f('0x1'));var BPromise=require(_0x5c4f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5c4f('0x3'));var db=require(_0x5c4f('0x4'))['db'];var utils=require(_0x5c4f('0x5'));var logger=require(_0x5c4f('0x6'))(_0x5c4f('0x7'));var config=require('../../config/environment');var jayson=require(_0x5c4f('0x8'));var client=jayson[_0x5c4f('0x9')][_0x5c4f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x123651,_0x51be50,_0x48f095){return new BPromise(function(_0x1ec0c8,_0x4a7bd4){return client[_0x5c4f('0xb')](_0x123651,_0x48f095)['then'](function(_0x381d46){logger[_0x5c4f('0xc')](_0x5c4f('0xd'),_0x51be50,_0x5c4f('0xe'));logger[_0x5c4f('0xf')](_0x5c4f('0x10'),_0x51be50,_0x5c4f('0xe'),JSON['stringify'](_0x381d46));if(_0x381d46[_0x5c4f('0x11')]){if(_0x381d46[_0x5c4f('0x11')]['code']===0x1f4){logger[_0x5c4f('0x11')](_0x5c4f('0xd'),_0x51be50,_0x381d46[_0x5c4f('0x11')][_0x5c4f('0x12')]);return _0x4a7bd4(_0x381d46[_0x5c4f('0x11')]['message']);}logger['error'](_0x5c4f('0xd'),_0x51be50,_0x381d46[_0x5c4f('0x11')][_0x5c4f('0x12')]);return _0x1ec0c8(_0x381d46[_0x5c4f('0x11')][_0x5c4f('0x12')]);}else{logger['info']('MemberReport,\x20%s,\x20%s',_0x51be50,_0x5c4f('0xe'));_0x1ec0c8(_0x381d46['result']['message']);}})[_0x5c4f('0x13')](function(_0x5154eb){logger[_0x5c4f('0x11')](_0x5c4f('0xd'),_0x51be50,_0x5154eb);_0x4a7bd4(_0x5154eb);});});}exports[_0x5c4f('0x14')]=function(_0x39f21c){var _0x3b6fcc=this;return new Promise(function(_0x35f5fa,_0x661bab){return db[_0x5c4f('0x15')][_0x5c4f('0x16')]({'raw':_0x39f21c['options']?_0x39f21c[_0x5c4f('0x17')][_0x5c4f('0x18')]===undefined?!![]:![]:!![],'where':_0x39f21c[_0x5c4f('0x17')]?_0x39f21c[_0x5c4f('0x17')]['where']||null:null,'attributes':_0x39f21c['options']?_0x39f21c[_0x5c4f('0x17')][_0x5c4f('0x19')]||null:null,'limit':_0x39f21c[_0x5c4f('0x17')]?_0x39f21c[_0x5c4f('0x17')][_0x5c4f('0x1a')]||null:null,'include':_0x39f21c[_0x5c4f('0x17')]?_0x39f21c[_0x5c4f('0x17')][_0x5c4f('0x1b')]?_['map'](_0x39f21c['options'][_0x5c4f('0x1b')],function(_0x45ae8c){return{'model':db[_0x45ae8c[_0x5c4f('0x1c')]],'as':_0x45ae8c['as'],'attributes':_0x45ae8c[_0x5c4f('0x19')],'include':_0x45ae8c['include']?_[_0x5c4f('0x1d')](_0x45ae8c[_0x5c4f('0x1b')],function(_0x3d4283){return{'model':db[_0x3d4283[_0x5c4f('0x1c')]],'as':_0x3d4283['as'],'attributes':_0x3d4283[_0x5c4f('0x19')],'include':_0x3d4283['include']?_[_0x5c4f('0x1d')](_0x3d4283[_0x5c4f('0x1b')],function(_0x36ca2a){return{'model':db[_0x36ca2a[_0x5c4f('0x1c')]],'as':_0x36ca2a['as'],'attributes':_0x36ca2a[_0x5c4f('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5c4f('0x1e')](function(_0x5da4a0){logger[_0x5c4f('0xc')](_0x5c4f('0x14'),_0x39f21c);logger[_0x5c4f('0xf')](_0x5c4f('0x14'),_0x39f21c,JSON['stringify'](_0x5da4a0));_0x35f5fa(_0x5da4a0);})['catch'](function(_0x545b1c){logger[_0x5c4f('0x11')](_0x5c4f('0x14'),_0x545b1c[_0x5c4f('0x12')],_0x39f21c);_0x661bab(_0x3b6fcc[_0x5c4f('0x11')](0x1f4,_0x545b1c[_0x5c4f('0x12')]));});});};exports[_0x5c4f('0x1f')]=function(_0x24732e){var _0x44b2ff=this;return new Promise(function(_0x1cc74d,_0x358dca){return db[_0x5c4f('0x15')][_0x5c4f('0x20')](_0x24732e[_0x5c4f('0x21')],{'raw':_0x24732e['options']?_0x24732e['options'][_0x5c4f('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x2297f9){logger[_0x5c4f('0xc')](_0x5c4f('0x1f'),_0x24732e);logger[_0x5c4f('0xf')](_0x5c4f('0x1f'),_0x24732e,JSON[_0x5c4f('0x22')](_0x2297f9));_0x1cc74d(_0x2297f9);})[_0x5c4f('0x13')](function(_0x5da614){logger[_0x5c4f('0x11')](_0x5c4f('0x1f'),_0x5da614[_0x5c4f('0x12')],_0x24732e);_0x358dca(_0x44b2ff['error'](0x1f4,_0x5da614['message']));});});};exports['UpdateMemberReport']=function(_0xc34c59){var _0x1ffc6e=this;return new Promise(function(_0x46b020,_0x1025e2){return db[_0x5c4f('0x15')]['update'](_0xc34c59[_0x5c4f('0x21')],{'raw':_0xc34c59[_0x5c4f('0x17')]?_0xc34c59['options'][_0x5c4f('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc34c59[_0x5c4f('0x17')]?_0xc34c59['options']['where']||null:null,'attributes':_0xc34c59[_0x5c4f('0x17')]?_0xc34c59[_0x5c4f('0x17')]['attributes']||null:null,'limit':_0xc34c59[_0x5c4f('0x17')]?_0xc34c59[_0x5c4f('0x17')][_0x5c4f('0x1a')]||null:null})[_0x5c4f('0x1e')](function(_0xcbe2b3){logger['info'](_0x5c4f('0x23'),_0xc34c59);logger['debug'](_0x5c4f('0x23'),_0xc34c59,JSON[_0x5c4f('0x22')](_0xcbe2b3));_0x46b020(_0xcbe2b3);})[_0x5c4f('0x13')](function(_0x419c1e){logger[_0x5c4f('0x11')](_0x5c4f('0x23'),_0x419c1e[_0x5c4f('0x12')],_0xc34c59);_0x1025e2(_0x1ffc6e[_0x5c4f('0x11')](0x1f4,_0x419c1e[_0x5c4f('0x12')]));});});}; \ No newline at end of file +var _0x2f74=['map','model','attributes','stringify','CreateMemberReport','create','body','UpdateMemberReport','update','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw','limit','include'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x2f74,0x7b));var _0x42f7=function(_0x4607e1,_0x596f78){_0x4607e1=_0x4607e1-0x0;var _0x22f1b2=_0x2f74[_0x4607e1];return _0x22f1b2;};'use strict';var _=require(_0x42f7('0x0'));var util=require('util');var moment=require(_0x42f7('0x1'));var BPromise=require(_0x42f7('0x2'));var rs=require(_0x42f7('0x3'));var fs=require('fs');var Redis=require(_0x42f7('0x4'));var db=require(_0x42f7('0x5'))['db'];var utils=require(_0x42f7('0x6'));var logger=require(_0x42f7('0x7'))(_0x42f7('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x42f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1cb6e0,_0x20ff46,_0x36b55e){return new BPromise(function(_0x2c64b2,_0x28fc83){return client[_0x42f7('0xa')](_0x1cb6e0,_0x36b55e)[_0x42f7('0xb')](function(_0x5772a8){logger[_0x42f7('0xc')](_0x42f7('0xd'),_0x20ff46,_0x42f7('0xe'));logger[_0x42f7('0xf')](_0x42f7('0x10'),_0x20ff46,_0x42f7('0xe'),JSON['stringify'](_0x5772a8));if(_0x5772a8[_0x42f7('0x11')]){if(_0x5772a8[_0x42f7('0x11')][_0x42f7('0x12')]===0x1f4){logger[_0x42f7('0x11')](_0x42f7('0xd'),_0x20ff46,_0x5772a8[_0x42f7('0x11')][_0x42f7('0x13')]);return _0x28fc83(_0x5772a8[_0x42f7('0x11')]['message']);}logger['error'](_0x42f7('0xd'),_0x20ff46,_0x5772a8[_0x42f7('0x11')][_0x42f7('0x13')]);return _0x2c64b2(_0x5772a8[_0x42f7('0x11')][_0x42f7('0x13')]);}else{logger['info'](_0x42f7('0xd'),_0x20ff46,'request\x20sent');_0x2c64b2(_0x5772a8[_0x42f7('0x14')][_0x42f7('0x13')]);}})[_0x42f7('0x15')](function(_0x19eff3){logger[_0x42f7('0x11')](_0x42f7('0xd'),_0x20ff46,_0x19eff3);_0x28fc83(_0x19eff3);});});}exports[_0x42f7('0x16')]=function(_0x47aa1d){var _0x3fc38d=this;return new Promise(function(_0x29f472,_0x43ef57){return db[_0x42f7('0x17')][_0x42f7('0x18')]({'raw':_0x47aa1d[_0x42f7('0x19')]?_0x47aa1d['options'][_0x42f7('0x1a')]===undefined?!![]:![]:!![],'where':_0x47aa1d['options']?_0x47aa1d[_0x42f7('0x19')]['where']||null:null,'attributes':_0x47aa1d[_0x42f7('0x19')]?_0x47aa1d['options']['attributes']||null:null,'limit':_0x47aa1d['options']?_0x47aa1d[_0x42f7('0x19')][_0x42f7('0x1b')]||null:null,'include':_0x47aa1d[_0x42f7('0x19')]?_0x47aa1d[_0x42f7('0x19')][_0x42f7('0x1c')]?_[_0x42f7('0x1d')](_0x47aa1d[_0x42f7('0x19')][_0x42f7('0x1c')],function(_0x1d45a0){return{'model':db[_0x1d45a0[_0x42f7('0x1e')]],'as':_0x1d45a0['as'],'attributes':_0x1d45a0[_0x42f7('0x1f')],'include':_0x1d45a0[_0x42f7('0x1c')]?_[_0x42f7('0x1d')](_0x1d45a0[_0x42f7('0x1c')],function(_0x553531){return{'model':db[_0x553531['model']],'as':_0x553531['as'],'attributes':_0x553531[_0x42f7('0x1f')],'include':_0x553531[_0x42f7('0x1c')]?_[_0x42f7('0x1d')](_0x553531[_0x42f7('0x1c')],function(_0x1e31de){return{'model':db[_0x1e31de[_0x42f7('0x1e')]],'as':_0x1e31de['as'],'attributes':_0x1e31de[_0x42f7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x42f7('0xb')](function(_0xe53027){logger[_0x42f7('0xc')]('GetMemberReport',_0x47aa1d);logger['debug'](_0x42f7('0x16'),_0x47aa1d,JSON[_0x42f7('0x20')](_0xe53027));_0x29f472(_0xe53027);})[_0x42f7('0x15')](function(_0x4d7137){logger[_0x42f7('0x11')](_0x42f7('0x16'),_0x4d7137['message'],_0x47aa1d);_0x43ef57(_0x3fc38d['error'](0x1f4,_0x4d7137[_0x42f7('0x13')]));});});};exports[_0x42f7('0x21')]=function(_0x210054){var _0xf6664c=this;return new Promise(function(_0x1e245c,_0x3a07b8){return db[_0x42f7('0x17')][_0x42f7('0x22')](_0x210054[_0x42f7('0x23')],{'raw':_0x210054['options']?_0x210054[_0x42f7('0x19')][_0x42f7('0x1a')]===undefined?!![]:![]:!![]})[_0x42f7('0xb')](function(_0xd26ccf){logger[_0x42f7('0xc')]('CreateMemberReport',_0x210054);logger[_0x42f7('0xf')](_0x42f7('0x21'),_0x210054,JSON[_0x42f7('0x20')](_0xd26ccf));_0x1e245c(_0xd26ccf);})[_0x42f7('0x15')](function(_0x505310){logger[_0x42f7('0x11')]('CreateMemberReport',_0x505310[_0x42f7('0x13')],_0x210054);_0x3a07b8(_0xf6664c[_0x42f7('0x11')](0x1f4,_0x505310[_0x42f7('0x13')]));});});};exports[_0x42f7('0x24')]=function(_0x14cae3){var _0x22a45b=this;return new Promise(function(_0x372a20,_0x4e506f){return db['MemberReport'][_0x42f7('0x25')](_0x14cae3[_0x42f7('0x23')],{'raw':_0x14cae3['options']?_0x14cae3[_0x42f7('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14cae3[_0x42f7('0x19')]?_0x14cae3[_0x42f7('0x19')]['where']||null:null,'attributes':_0x14cae3['options']?_0x14cae3['options'][_0x42f7('0x1f')]||null:null,'limit':_0x14cae3['options']?_0x14cae3[_0x42f7('0x19')][_0x42f7('0x1b')]||null:null})[_0x42f7('0xb')](function(_0x12f787){logger[_0x42f7('0xc')]('UpdateMemberReport',_0x14cae3);logger[_0x42f7('0xf')](_0x42f7('0x24'),_0x14cae3,JSON['stringify'](_0x12f787));_0x372a20(_0x12f787);})['catch'](function(_0x151c80){logger[_0x42f7('0x11')](_0x42f7('0x24'),_0x151c80[_0x42f7('0x13')],_0x14cae3);_0x4e506f(_0x22a45b[_0x42f7('0x11')](0x1f4,_0x151c80[_0x42f7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index e49df84..03644c9 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 _0x1e92=['../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer','path','Router','fs-extra','../../components/auth/service'];(function(_0x5cc655,_0x4b6145){var _0x244379=function(_0x30d2c5){while(--_0x30d2c5){_0x5cc655['push'](_0x5cc655['shift']());}};_0x244379(++_0x4b6145);}(_0x1e92,0x1df));var _0x21e9=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0x1e92[_0x22f8ab];return _0x2a70e5;};'use strict';var multer=require(_0x21e9('0x0'));var util=require('util');var path=require(_0x21e9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x21e9('0x2')]();var fs_extra=require(_0x21e9('0x3'));var auth=require(_0x21e9('0x4'));var interaction=require(_0x21e9('0x5'));var config=require(_0x21e9('0x6'));var controller=require(_0x21e9('0x7'));router[_0x21e9('0x8')]('/',controller[_0x21e9('0x9')]);module[_0x21e9('0xa')]=router; \ No newline at end of file +var _0xc49f=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer','connect-timeout'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xc49f,0x1c0));var _0xfc49=function(_0x1c596b,_0x2b6c08){_0x1c596b=_0x1c596b-0x0;var _0x1aceb5=_0xc49f[_0x1c596b];return _0x1aceb5;};'use strict';var multer=require(_0xfc49('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfc49('0x1'));var express=require('express');var router=express[_0xfc49('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xfc49('0x3'));var interaction=require(_0xfc49('0x4'));var config=require(_0xfc49('0x5'));var controller=require(_0xfc49('0x6'));router[_0xfc49('0x7')]('/',controller[_0xfc49('0x8')]);module[_0xfc49('0x9')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index cc0a76f..385c1fd 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 _0xfe46=['exports','STRING','version'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0xfe46,0x117));var _0x6fe4=function(_0x4e8a61,_0x37a359){_0x4e8a61=_0x4e8a61-0x0;var _0x30c0b2=_0xfe46[_0x4e8a61];return _0x30c0b2;};'use strict';var Sequelize=require('sequelize');module[_0x6fe4('0x0')]={'version':{'type':Sequelize[_0x6fe4('0x1')],'unique':_0x6fe4('0x2')}}; \ No newline at end of file +var _0x351c=['version','sequelize','STRING'];(function(_0x901f29,_0x180fa9){var _0x4406b9=function(_0x2468d5){while(--_0x2468d5){_0x901f29['push'](_0x901f29['shift']());}};_0x4406b9(++_0x180fa9);}(_0x351c,0xe5));var _0xc351=function(_0x23470a,_0x215ead){_0x23470a=_0x23470a-0x0;var _0x1c9ed1=_0x351c[_0x23470a];return _0x1c9ed1;};'use strict';var Sequelize=require(_0xc351('0x0'));module['exports']={'version':{'type':Sequelize[_0xc351('0x1')],'unique':_0xc351('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 606dde8..3256ca3 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 _0x8d81=['error','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','Migration','includeAll','include','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','destroy'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8d81,0xe4));var _0x18d8=function(_0x2dd5e8,_0x38db2e){_0x2dd5e8=_0x2dd5e8-0x0;var _0x2e8cb8=_0x8d81[_0x2dd5e8];return _0x2e8cb8;};'use strict';var emlformat=require(_0x18d8('0x0'));var rimraf=require(_0x18d8('0x1'));var zipdir=require(_0x18d8('0x2'));var jsonpatch=require(_0x18d8('0x3'));var rp=require(_0x18d8('0x4'));var moment=require(_0x18d8('0x5'));var BPromise=require(_0x18d8('0x6'));var Mustache=require(_0x18d8('0x7'));var util=require(_0x18d8('0x8'));var path=require(_0x18d8('0x9'));var sox=require('sox');var csv=require(_0x18d8('0xa'));var ejs=require(_0x18d8('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x18d8('0xc'));var crypto=require('crypto');var jsforce=require(_0x18d8('0xd'));var deskjs=require(_0x18d8('0xe'));var toCsv=require(_0x18d8('0xa'));var querystring=require(_0x18d8('0xf'));var Papa=require(_0x18d8('0x10'));var Redis=require(_0x18d8('0x11'));var authService=require(_0x18d8('0x12'));var qs=require(_0x18d8('0x13'));var as=require(_0x18d8('0x14'));var hardwareService=require(_0x18d8('0x15'));var logger=require(_0x18d8('0x16'))(_0x18d8('0x17'));var utils=require(_0x18d8('0x18'));var config=require(_0x18d8('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x18d8('0x1a'))['db'];function respondWithStatusCode(_0x591f3f,_0x56ad9c){_0x56ad9c=_0x56ad9c||0xcc;return function(_0x323a05){if(_0x323a05){return _0x591f3f[_0x18d8('0x1b')](_0x56ad9c);}return _0x591f3f[_0x18d8('0x1c')](_0x56ad9c)['end']();};}function respondWithResult(_0x122ec0,_0x1ecbea){_0x1ecbea=_0x1ecbea||0xc8;return function(_0x294fab){if(_0x294fab){return _0x122ec0[_0x18d8('0x1c')](_0x1ecbea)[_0x18d8('0x1d')](_0x294fab);}};}function respondWithFilteredResult(_0x9f2d36,_0xbfaef2){return function(_0x16c133){if(_0x16c133){var _0x4493a0=typeof _0xbfaef2[_0x18d8('0x1e')]===_0x18d8('0x1f')&&typeof _0xbfaef2['limit']==='undefined';var _0x5d03c9=_0x16c133[_0x18d8('0x20')];var _0x9745b1=_0x4493a0?0x0:_0xbfaef2[_0x18d8('0x1e')];var _0x1834ea=_0x4493a0?_0x16c133['count']:_0xbfaef2[_0x18d8('0x1e')]+_0xbfaef2[_0x18d8('0x21')];var _0x261db9;if(_0x1834ea>=_0x5d03c9){_0x1834ea=_0x5d03c9;_0x261db9=0xc8;}else{_0x261db9=0xce;}_0x9f2d36[_0x18d8('0x1c')](_0x261db9);return _0x9f2d36['set'](_0x18d8('0x22'),_0x9745b1+'-'+_0x1834ea+'/'+_0x5d03c9)[_0x18d8('0x1d')](_0x16c133);}return null;};}function patchUpdates(_0x2fd710){return function(_0x2119fb){try{jsonpatch[_0x18d8('0x23')](_0x2119fb,_0x2fd710,!![]);}catch(_0x56b1a5){return BPromise[_0x18d8('0x24')](_0x56b1a5);}return _0x2119fb[_0x18d8('0x25')]();};}function saveUpdates(_0x1d4d94,_0x249e20){return function(_0x2135ce){if(_0x2135ce){return _0x2135ce['update'](_0x1d4d94)[_0x18d8('0x26')](function(_0x3a389a){return _0x3a389a;});}return null;};}function removeEntity(_0x23b53e,_0x29248e){return function(_0x5e19e5){if(_0x5e19e5){return _0x5e19e5[_0x18d8('0x27')]()[_0x18d8('0x26')](function(){_0x23b53e[_0x18d8('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46491d,_0x5b8d93){return function(_0x12b427){if(!_0x12b427){_0x46491d['sendStatus'](0x194);}return _0x12b427;};}function handleError(_0x1b6e17,_0x284e04){_0x284e04=_0x284e04||0x1f4;return function(_0x10d974){logger[_0x18d8('0x28')](_0x10d974['stack']);if(_0x10d974[_0x18d8('0x29')]){delete _0x10d974['name'];}_0x1b6e17['status'](_0x284e04)[_0x18d8('0x2a')](_0x10d974);};}exports[_0x18d8('0x2b')]=function(_0x1dc361,_0x53e320){var _0x4c52dc={},_0x1f8e87={},_0x185a71={'count':0x0,'rows':[]};var _0x576298=_[_0x18d8('0x2c')](db['Migration'][_0x18d8('0x2d')],function(_0x2596f2){return{'name':_0x2596f2[_0x18d8('0x2e')],'type':_0x2596f2['type']['key']};});_0x1f8e87[_0x18d8('0x2f')]=_[_0x18d8('0x2c')](_0x576298,_0x18d8('0x29'));_0x1f8e87[_0x18d8('0x30')]=_[_0x18d8('0x31')](_0x1dc361[_0x18d8('0x30')]);_0x1f8e87[_0x18d8('0x32')]=_[_0x18d8('0x33')](_0x1f8e87[_0x18d8('0x2f')],_0x1f8e87['query']);_0x4c52dc[_0x18d8('0x34')]=_[_0x18d8('0x33')](_0x1f8e87[_0x18d8('0x2f')],qs[_0x18d8('0x35')](_0x1dc361[_0x18d8('0x30')][_0x18d8('0x35')]));_0x4c52dc['attributes']=_0x4c52dc[_0x18d8('0x34')][_0x18d8('0x36')]?_0x4c52dc[_0x18d8('0x34')]:_0x1f8e87['model'];if(!_0x1dc361[_0x18d8('0x30')]['hasOwnProperty']('nolimit')){_0x4c52dc[_0x18d8('0x21')]=qs[_0x18d8('0x21')](_0x1dc361[_0x18d8('0x30')][_0x18d8('0x21')]);_0x4c52dc[_0x18d8('0x1e')]=qs[_0x18d8('0x1e')](_0x1dc361[_0x18d8('0x30')]['offset']);}_0x4c52dc[_0x18d8('0x37')]=qs[_0x18d8('0x38')](_0x1dc361[_0x18d8('0x30')][_0x18d8('0x38')]);_0x4c52dc[_0x18d8('0x39')]=qs[_0x18d8('0x32')](_[_0x18d8('0x3a')](_0x1dc361[_0x18d8('0x30')],_0x1f8e87['filters']),_0x576298);if(_0x1dc361[_0x18d8('0x30')]['filter']){_0x4c52dc['where']=_[_0x18d8('0x3b')](_0x4c52dc[_0x18d8('0x39')],{'$or':_[_0x18d8('0x2c')](_0x576298,function(_0x3a40e9){if(_0x3a40e9['type']!==_0x18d8('0x3c')){var _0x59fbda={};_0x59fbda[_0x3a40e9[_0x18d8('0x29')]]={'$like':'%'+_0x1dc361[_0x18d8('0x30')][_0x18d8('0x3d')]+'%'};return _0x59fbda;}})});}_0x4c52dc=_['merge']({},_0x4c52dc,_0x1dc361[_0x18d8('0x3e')]);var _0x21d53c={'where':_0x4c52dc[_0x18d8('0x39')]};return db[_0x18d8('0x3f')][_0x18d8('0x20')](_0x21d53c)['then'](function(_0xf76518){_0x185a71[_0x18d8('0x20')]=_0xf76518;if(_0x1dc361[_0x18d8('0x30')][_0x18d8('0x40')]){_0x4c52dc[_0x18d8('0x41')]=[{'all':!![]}];}return db['Migration']['findAll'](_0x4c52dc);})[_0x18d8('0x26')](function(_0x8f38d5){_0x185a71[_0x18d8('0x42')]=_0x8f38d5;return _0x185a71;})[_0x18d8('0x26')](respondWithFilteredResult(_0x53e320,_0x4c52dc))['catch'](handleError(_0x53e320,null));}; \ No newline at end of file +var _0xf854=['set','reject','save','update','then','destroy','stack','name','send','index','map','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','Migration','include','findAll','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x4566db,_0x5da9a1){var _0x3167e6=function(_0x154ed8){while(--_0x154ed8){_0x4566db['push'](_0x4566db['shift']());}};_0x3167e6(++_0x5da9a1);}(_0xf854,0xa0));var _0x4f85=function(_0x300719,_0x530cd8){_0x300719=_0x300719-0x0;var _0x248402=_0xf854[_0x300719];return _0x248402;};'use strict';var emlformat=require(_0x4f85('0x0'));var rimraf=require(_0x4f85('0x1'));var zipdir=require(_0x4f85('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4f85('0x3'));var BPromise=require(_0x4f85('0x4'));var Mustache=require(_0x4f85('0x5'));var util=require(_0x4f85('0x6'));var path=require(_0x4f85('0x7'));var sox=require(_0x4f85('0x8'));var csv=require(_0x4f85('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4f85('0xa'));var _=require(_0x4f85('0xb'));var squel=require(_0x4f85('0xc'));var crypto=require(_0x4f85('0xd'));var jsforce=require(_0x4f85('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4f85('0x9'));var querystring=require('querystring');var Papa=require(_0x4f85('0xf'));var Redis=require(_0x4f85('0x10'));var authService=require(_0x4f85('0x11'));var qs=require(_0x4f85('0x12'));var as=require(_0x4f85('0x13'));var hardwareService=require(_0x4f85('0x14'));var logger=require(_0x4f85('0x15'))(_0x4f85('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f85('0x17'))['db'];function respondWithStatusCode(_0x291438,_0x168bb4){_0x168bb4=_0x168bb4||0xcc;return function(_0x354375){if(_0x354375){return _0x291438[_0x4f85('0x18')](_0x168bb4);}return _0x291438[_0x4f85('0x19')](_0x168bb4)[_0x4f85('0x1a')]();};}function respondWithResult(_0x262424,_0x1a3551){_0x1a3551=_0x1a3551||0xc8;return function(_0x97c524){if(_0x97c524){return _0x262424[_0x4f85('0x19')](_0x1a3551)[_0x4f85('0x1b')](_0x97c524);}};}function respondWithFilteredResult(_0x34b2d0,_0x364da7){return function(_0x5a4458){if(_0x5a4458){var _0x23acea=typeof _0x364da7[_0x4f85('0x1c')]===_0x4f85('0x1d')&&typeof _0x364da7['limit']===_0x4f85('0x1d');var _0x66a31b=_0x5a4458[_0x4f85('0x1e')];var _0x53121f=_0x23acea?0x0:_0x364da7[_0x4f85('0x1c')];var _0x1f9e7c=_0x23acea?_0x5a4458['count']:_0x364da7[_0x4f85('0x1c')]+_0x364da7[_0x4f85('0x1f')];var _0x5dcfe1;if(_0x1f9e7c>=_0x66a31b){_0x1f9e7c=_0x66a31b;_0x5dcfe1=0xc8;}else{_0x5dcfe1=0xce;}_0x34b2d0[_0x4f85('0x19')](_0x5dcfe1);return _0x34b2d0[_0x4f85('0x20')]('Content-Range',_0x53121f+'-'+_0x1f9e7c+'/'+_0x66a31b)[_0x4f85('0x1b')](_0x5a4458);}return null;};}function patchUpdates(_0x2db05c){return function(_0x8cf4c4){try{jsonpatch['apply'](_0x8cf4c4,_0x2db05c,!![]);}catch(_0x4c37f2){return BPromise[_0x4f85('0x21')](_0x4c37f2);}return _0x8cf4c4[_0x4f85('0x22')]();};}function saveUpdates(_0x1d7def,_0x4850a6){return function(_0x545349){if(_0x545349){return _0x545349[_0x4f85('0x23')](_0x1d7def)[_0x4f85('0x24')](function(_0x2e1e0f){return _0x2e1e0f;});}return null;};}function removeEntity(_0x5d0d09,_0x474f0a){return function(_0x3eca1d){if(_0x3eca1d){return _0x3eca1d[_0x4f85('0x25')]()[_0x4f85('0x24')](function(){_0x5d0d09[_0x4f85('0x19')](0xcc)[_0x4f85('0x1a')]();});}};}function handleEntityNotFound(_0x41fb5b,_0x57cb94){return function(_0x3a7c30){if(!_0x3a7c30){_0x41fb5b[_0x4f85('0x18')](0x194);}return _0x3a7c30;};}function handleError(_0x30f7dc,_0x4b4a9e){_0x4b4a9e=_0x4b4a9e||0x1f4;return function(_0x450a01){logger['error'](_0x450a01[_0x4f85('0x26')]);if(_0x450a01[_0x4f85('0x27')]){delete _0x450a01[_0x4f85('0x27')];}_0x30f7dc[_0x4f85('0x19')](_0x4b4a9e)[_0x4f85('0x28')](_0x450a01);};}exports[_0x4f85('0x29')]=function(_0x1ca62d,_0x4dd56b){var _0x97a918={},_0x6c1bf1={},_0x5ed90e={'count':0x0,'rows':[]};var _0x18b8aa=_[_0x4f85('0x2a')](db['Migration']['rawAttributes'],function(_0x262f27){return{'name':_0x262f27[_0x4f85('0x2b')],'type':_0x262f27['type'][_0x4f85('0x2c')]};});_0x6c1bf1[_0x4f85('0x2d')]=_[_0x4f85('0x2a')](_0x18b8aa,_0x4f85('0x27'));_0x6c1bf1['query']=_[_0x4f85('0x2e')](_0x1ca62d[_0x4f85('0x2f')]);_0x6c1bf1[_0x4f85('0x30')]=_[_0x4f85('0x31')](_0x6c1bf1[_0x4f85('0x2d')],_0x6c1bf1['query']);_0x97a918[_0x4f85('0x32')]=_[_0x4f85('0x31')](_0x6c1bf1['model'],qs[_0x4f85('0x33')](_0x1ca62d[_0x4f85('0x2f')]['fields']));_0x97a918[_0x4f85('0x32')]=_0x97a918[_0x4f85('0x32')][_0x4f85('0x34')]?_0x97a918[_0x4f85('0x32')]:_0x6c1bf1[_0x4f85('0x2d')];if(!_0x1ca62d[_0x4f85('0x2f')]['hasOwnProperty'](_0x4f85('0x35'))){_0x97a918[_0x4f85('0x1f')]=qs['limit'](_0x1ca62d[_0x4f85('0x2f')]['limit']);_0x97a918[_0x4f85('0x1c')]=qs[_0x4f85('0x1c')](_0x1ca62d[_0x4f85('0x2f')]['offset']);}_0x97a918[_0x4f85('0x36')]=qs[_0x4f85('0x37')](_0x1ca62d[_0x4f85('0x2f')][_0x4f85('0x37')]);_0x97a918['where']=qs[_0x4f85('0x30')](_['pick'](_0x1ca62d['query'],_0x6c1bf1['filters']),_0x18b8aa);if(_0x1ca62d[_0x4f85('0x2f')][_0x4f85('0x38')]){_0x97a918[_0x4f85('0x39')]=_[_0x4f85('0x3a')](_0x97a918[_0x4f85('0x39')],{'$or':_[_0x4f85('0x2a')](_0x18b8aa,function(_0x1cc9c6){if(_0x1cc9c6['type']!==_0x4f85('0x3b')){var _0x54ca35={};_0x54ca35[_0x1cc9c6[_0x4f85('0x27')]]={'$like':'%'+_0x1ca62d[_0x4f85('0x2f')][_0x4f85('0x38')]+'%'};return _0x54ca35;}})});}_0x97a918=_['merge']({},_0x97a918,_0x1ca62d[_0x4f85('0x3c')]);var _0x7843f9={'where':_0x97a918[_0x4f85('0x39')]};return db[_0x4f85('0x3d')][_0x4f85('0x1e')](_0x7843f9)[_0x4f85('0x24')](function(_0x5d28a6){_0x5ed90e[_0x4f85('0x1e')]=_0x5d28a6;if(_0x1ca62d[_0x4f85('0x2f')]['includeAll']){_0x97a918[_0x4f85('0x3e')]=[{'all':!![]}];}return db[_0x4f85('0x3d')][_0x4f85('0x3f')](_0x97a918);})[_0x4f85('0x24')](function(_0x34d785){_0x5ed90e['rows']=_0x34d785;return _0x5ed90e;})[_0x4f85('0x24')](respondWithFilteredResult(_0x4dd56b,_0x97a918))['catch'](handleError(_0x4dd56b,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 6d62f63..a6debb3 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 _0xe086=['define','Migration','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe086,0x110));var _0x6e08=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe086[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6e08('0x0'));var util=require('util');var logger=require(_0x6e08('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6e08('0x2'));var rp=require(_0x6e08('0x3'));var fs=require('fs');var path=require(_0x6e08('0x4'));var rimraf=require(_0x6e08('0x5'));var config=require(_0x6e08('0x6'));var attributes=require('./migration.attributes');module[_0x6e08('0x7')]=function(_0x1fa672,_0x274635){return _0x1fa672[_0x6e08('0x8')](_0x6e08('0x9'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fda=['Migration','migrations','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./migration.attributes','define'];(function(_0x52f73a,_0x4418dd){var _0x4b5d40=function(_0x3aea52){while(--_0x3aea52){_0x52f73a['push'](_0x52f73a['shift']());}};_0x4b5d40(++_0x4418dd);}(_0x7fda,0xa7));var _0xa7fd=function(_0x5cc8cb,_0x3dbe39){_0x5cc8cb=_0x5cc8cb-0x0;var _0x2d7a7d=_0x7fda[_0x5cc8cb];return _0x2d7a7d;};'use strict';var _=require('lodash');var util=require(_0xa7fd('0x0'));var logger=require(_0xa7fd('0x1'))(_0xa7fd('0x2'));var moment=require(_0xa7fd('0x3'));var BPromise=require('bluebird');var rp=require(_0xa7fd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa7fd('0x5'));var config=require(_0xa7fd('0x6'));var attributes=require(_0xa7fd('0x7'));module['exports']=function(_0x4e9292,_0x2ce515){return _0x4e9292[_0xa7fd('0x8')](_0xa7fd('0x9'),attributes,{'tableName':_0xa7fd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index e459638..1a6f7b5 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 _0x222f=['result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x55cbb4,_0x39d3c){var _0x50a0b9=function(_0x1140e5){while(--_0x1140e5){_0x55cbb4['push'](_0x55cbb4['shift']());}};_0x50a0b9(++_0x39d3c);}(_0x222f,0x1a4));var _0xf222=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0x222f[_0x163040];return _0x364667;};'use strict';var _=require(_0xf222('0x0'));var util=require(_0xf222('0x1'));var moment=require(_0xf222('0x2'));var BPromise=require(_0xf222('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf222('0x4'))['db'];var utils=require(_0xf222('0x5'));var logger=require(_0xf222('0x6'))(_0xf222('0x7'));var config=require('../../config/environment');var jayson=require(_0xf222('0x8'));var client=jayson['client'][_0xf222('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26f129,_0x518ebb,_0xf5a105){return new BPromise(function(_0x302d7a,_0x4aceb4){return client[_0xf222('0xa')](_0x26f129,_0xf5a105)[_0xf222('0xb')](function(_0x878804){logger[_0xf222('0xc')](_0xf222('0xd'),_0x518ebb,_0xf222('0xe'));logger['debug'](_0xf222('0xf'),_0x518ebb,_0xf222('0xe'),JSON[_0xf222('0x10')](_0x878804));if(_0x878804[_0xf222('0x11')]){if(_0x878804['error'][_0xf222('0x12')]===0x1f4){logger[_0xf222('0x11')](_0xf222('0xd'),_0x518ebb,_0x878804[_0xf222('0x11')][_0xf222('0x13')]);return _0x4aceb4(_0x878804[_0xf222('0x11')][_0xf222('0x13')]);}logger[_0xf222('0x11')]('Migration,\x20%s,\x20%s',_0x518ebb,_0x878804['error'][_0xf222('0x13')]);return _0x302d7a(_0x878804[_0xf222('0x11')]['message']);}else{logger[_0xf222('0xc')](_0xf222('0xd'),_0x518ebb,_0xf222('0xe'));_0x302d7a(_0x878804[_0xf222('0x14')][_0xf222('0x13')]);}})[_0xf222('0x15')](function(_0x30b646){logger['error'](_0xf222('0xd'),_0x518ebb,_0x30b646);_0x4aceb4(_0x30b646);});});} \ No newline at end of file +var _0x049e=['then','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','Migration,\x20%s,\x20%s','message','info','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x1e9e56,_0x34a74a){var _0x5d5e2e=function(_0x4bfcc2){while(--_0x4bfcc2){_0x1e9e56['push'](_0x1e9e56['shift']());}};_0x5d5e2e(++_0x34a74a);}(_0x049e,0x16a));var _0xe049=function(_0x58eec7,_0x2353db){_0x58eec7=_0x58eec7-0x0;var _0x25c5d3=_0x049e[_0x58eec7];return _0x25c5d3;};'use strict';var _=require(_0xe049('0x0'));var util=require(_0xe049('0x1'));var moment=require('moment');var BPromise=require(_0xe049('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe049('0x3'));var db=require(_0xe049('0x4'))['db'];var utils=require(_0xe049('0x5'));var logger=require(_0xe049('0x6'))(_0xe049('0x7'));var config=require('../../config/environment');var jayson=require(_0xe049('0x8'));var client=jayson[_0xe049('0x9')][_0xe049('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x221a5f,_0x1d4fc6,_0x17945b){return new BPromise(function(_0x22abb2,_0x515823){return client[_0xe049('0xb')](_0x221a5f,_0x17945b)[_0xe049('0xc')](function(_0x6d04ed){logger['info']('Migration,\x20%s,\x20%s',_0x1d4fc6,_0xe049('0xd'));logger[_0xe049('0xe')](_0xe049('0xf'),_0x1d4fc6,'request\x20sent',JSON['stringify'](_0x6d04ed));if(_0x6d04ed['error']){if(_0x6d04ed[_0xe049('0x10')][_0xe049('0x11')]===0x1f4){logger[_0xe049('0x10')](_0xe049('0x12'),_0x1d4fc6,_0x6d04ed[_0xe049('0x10')][_0xe049('0x13')]);return _0x515823(_0x6d04ed[_0xe049('0x10')][_0xe049('0x13')]);}logger['error'](_0xe049('0x12'),_0x1d4fc6,_0x6d04ed[_0xe049('0x10')][_0xe049('0x13')]);return _0x22abb2(_0x6d04ed[_0xe049('0x10')]['message']);}else{logger[_0xe049('0x14')](_0xe049('0x12'),_0x1d4fc6,'request\x20sent');_0x22abb2(_0x6d04ed[_0xe049('0x15')][_0xe049('0x13')]);}})['catch'](function(_0x8b9bfe){logger[_0xe049('0x10')]('Migration,\x20%s,\x20%s',_0x1d4fc6,_0x8b9bfe);_0x515823(_0x8b9bfe);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 93b65bc..e2be2b2 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 _0x4b24=['../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x30e097,_0xefe2bc){var _0x7c0193=function(_0x304ea1){while(--_0x304ea1){_0x30e097['push'](_0x30e097['shift']());}};_0x7c0193(++_0xefe2bc);}(_0x4b24,0x8a));var _0x44b2=function(_0x4bfbd4,_0x1e2b67){_0x4bfbd4=_0x4bfbd4-0x0;var _0x4622e5=_0x4b24[_0x4bfbd4];return _0x4622e5;};'use strict';var multer=require(_0x44b2('0x0'));var util=require(_0x44b2('0x1'));var path=require(_0x44b2('0x2'));var timeout=require(_0x44b2('0x3'));var express=require(_0x44b2('0x4'));var router=express['Router']();var fs_extra=require(_0x44b2('0x5'));var auth=require(_0x44b2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x44b2('0x7'));var controller=require('./network.controller');router[_0x44b2('0x8')]('/',auth['isAuthenticated'](),controller[_0x44b2('0x9')]);router[_0x44b2('0x8')](_0x44b2('0xa'),auth[_0x44b2('0xb')](),controller['show']);router[_0x44b2('0xc')]('/',auth[_0x44b2('0xb')](),controller['create']);router[_0x44b2('0xd')](_0x44b2('0xa'),auth[_0x44b2('0xb')](),controller[_0x44b2('0xe')]);router[_0x44b2('0xf')](_0x44b2('0xa'),auth[_0x44b2('0xb')](),controller[_0x44b2('0x10')]);module[_0x44b2('0x11')]=router; \ No newline at end of file +var _0xd7ac=['./network.controller','get','isAuthenticated','/:id','show','create','update','delete','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x2e0378,_0x28c31e){var _0x1822c2=function(_0x240c79){while(--_0x240c79){_0x2e0378['push'](_0x2e0378['shift']());}};_0x1822c2(++_0x28c31e);}(_0xd7ac,0x167));var _0xcd7a=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xd7ac[_0x4e676e];return _0x336a3c;};'use strict';var multer=require(_0xcd7a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcd7a('0x1'));var express=require(_0xcd7a('0x2'));var router=express['Router']();var fs_extra=require(_0xcd7a('0x3'));var auth=require(_0xcd7a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcd7a('0x5'));router[_0xcd7a('0x6')]('/',auth[_0xcd7a('0x7')](),controller['index']);router[_0xcd7a('0x6')](_0xcd7a('0x8'),auth[_0xcd7a('0x7')](),controller[_0xcd7a('0x9')]);router['post']('/',auth[_0xcd7a('0x7')](),controller[_0xcd7a('0xa')]);router['put'](_0xcd7a('0x8'),auth[_0xcd7a('0x7')](),controller[_0xcd7a('0xb')]);router[_0xcd7a('0xc')](_0xcd7a('0x8'),auth[_0xcd7a('0x7')](),controller['destroy']);module[_0xcd7a('0xd')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 2ccebda..6640cb7 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 _0x09ec=['exports','ENUM','localnet','STRING','sequelize'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x09ec,0x149));var _0xc09e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x09ec[_0x46aff0];return _0x9d78cf;};'use strict';var Sequelize=require(_0xc09e('0x0'));module[_0xc09e('0x1')]={'type':{'type':Sequelize[_0xc09e('0x2')](_0xc09e('0x3'),'externip','stun','turn')},'value':{'type':Sequelize[_0xc09e('0x4')]},'username':{'type':Sequelize[_0xc09e('0x4')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf5ec=['ENUM','stun','turn','STRING','sequelize','exports'];(function(_0x95a96c,_0xb0efff){var _0x372bd1=function(_0x29b1b8){while(--_0x29b1b8){_0x95a96c['push'](_0x95a96c['shift']());}};_0x372bd1(++_0xb0efff);}(_0xf5ec,0xd0));var _0xcf5e=function(_0x151ae0,_0x597cff){_0x151ae0=_0x151ae0-0x0;var _0x25a588=_0xf5ec[_0x151ae0];return _0x25a588;};'use strict';var Sequelize=require(_0xcf5e('0x0'));module[_0xcf5e('0x1')]={'type':{'type':Sequelize[_0xcf5e('0x2')]('localnet','externip',_0xcf5e('0x3'),_0xcf5e('0x4'))},'value':{'type':Sequelize[_0xcf5e('0x5')]},'username':{'type':Sequelize[_0xcf5e('0x5')]},'password':{'type':Sequelize[_0xcf5e('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 5138dd5..5dc6250 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 _0x3105=['readFileSync','root','server/files/templates/turn_multiple.ejs','utf8','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','server/files/templates/network.ejs','writeFileSync','toLowerCase','chan_sip.so','/etc/asterisk/stun_xcally.conf','TURN','format','destroy','/etc/asterisk/sip_xcally_%s.conf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','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','jayson/promise','client','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','stack','name','send','Network','rawAttributes','fieldName','key','map','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','findAll','rows','params','include','options','find','create','sequelize','transaction','body','toUpperCase','STUN','join','server/files/templates/stun_multiple.ejs','render','Reload'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x3105,0x7e));var _0x5310=function(_0x168d67,_0xdeffbe){_0x168d67=_0x168d67-0x0;var _0x3f130a=_0x3105[_0x168d67];return _0x3f130a;};'use strict';var emlformat=require(_0x5310('0x0'));var rimraf=require(_0x5310('0x1'));var zipdir=require(_0x5310('0x2'));var jsonpatch=require(_0x5310('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5310('0x4'));var Mustache=require(_0x5310('0x5'));var util=require(_0x5310('0x6'));var path=require('path');var sox=require(_0x5310('0x7'));var csv=require(_0x5310('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5310('0x9'));var squel=require(_0x5310('0xa'));var crypto=require(_0x5310('0xb'));var jsforce=require(_0x5310('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5310('0x8'));var querystring=require(_0x5310('0xd'));var Papa=require(_0x5310('0xe'));var Redis=require(_0x5310('0xf'));var authService=require(_0x5310('0x10'));var qs=require(_0x5310('0x11'));var as=require(_0x5310('0x12'));var hardwareService=require(_0x5310('0x13'));var logger=require(_0x5310('0x14'))(_0x5310('0x15'));var utils=require(_0x5310('0x16'));var config=require(_0x5310('0x17'));var licenseUtil=require(_0x5310('0x18'));var db=require(_0x5310('0x19'))['db'];var jayson=require(_0x5310('0x1a'));var client=jayson[_0x5310('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x169127,_0x3fc46a,_0x4b2eab,_0x5562e9){return new BPromise(function(_0x262085,_0x7cb71c){var _0x37478d=_0x5562e9||client;return _0x37478d[_0x5310('0x1c')](_0x169127,_0x4b2eab)[_0x5310('0x1d')](function(_0x4f772){logger[_0x5310('0x1e')](_0x5310('0x1f'),_0x3fc46a,_0x5310('0x20'));logger[_0x5310('0x21')](_0x5310('0x22'),_0x3fc46a,_0x5310('0x20'),JSON[_0x5310('0x23')](_0x4f772));if(_0x4f772[_0x5310('0x24')]){if(_0x4f772[_0x5310('0x24')][_0x5310('0x25')]===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0x3fc46a,_0x4f772[_0x5310('0x24')][_0x5310('0x26')]);return _0x7cb71c(_0x4f772['error'][_0x5310('0x26')]);}logger['error'](_0x5310('0x1f'),_0x3fc46a,_0x4f772[_0x5310('0x24')]['message']);return _0x262085(_0x4f772[_0x5310('0x24')]['message']);}else{logger[_0x5310('0x1e')](_0x5310('0x1f'),_0x3fc46a,_0x5310('0x20'));_0x262085(_0x4f772[_0x5310('0x27')][_0x5310('0x26')]);}})[_0x5310('0x28')](function(_0x1a9c89){logger[_0x5310('0x24')](_0x5310('0x1f'),_0x3fc46a,_0x1a9c89);_0x7cb71c(_0x1a9c89);});});}function respondWithStatusCode(_0x1e0e87,_0x4a78f3){_0x4a78f3=_0x4a78f3||0xcc;return function(_0x4902a1){if(_0x4902a1){return _0x1e0e87[_0x5310('0x29')](_0x4a78f3);}return _0x1e0e87['status'](_0x4a78f3)[_0x5310('0x2a')]();};}function respondWithResult(_0x3ebf88,_0x5e9db0){_0x5e9db0=_0x5e9db0||0xc8;return function(_0x19fbca){if(_0x19fbca){return _0x3ebf88[_0x5310('0x2b')](_0x5e9db0)[_0x5310('0x2c')](_0x19fbca);}};}function respondWithFilteredResult(_0x2db375,_0x59a143){return function(_0x362258){if(_0x362258){var _0x453e17=typeof _0x59a143[_0x5310('0x2d')]===_0x5310('0x2e')&&typeof _0x59a143[_0x5310('0x2f')]===_0x5310('0x2e');var _0x573dfc=_0x362258[_0x5310('0x30')];var _0x2da5f7=_0x453e17?0x0:_0x59a143[_0x5310('0x2d')];var _0x1c1b72=_0x453e17?_0x362258['count']:_0x59a143[_0x5310('0x2d')]+_0x59a143[_0x5310('0x2f')];var _0x3b94d5;if(_0x1c1b72>=_0x573dfc){_0x1c1b72=_0x573dfc;_0x3b94d5=0xc8;}else{_0x3b94d5=0xce;}_0x2db375[_0x5310('0x2b')](_0x3b94d5);return _0x2db375[_0x5310('0x31')](_0x5310('0x32'),_0x2da5f7+'-'+_0x1c1b72+'/'+_0x573dfc)['json'](_0x362258);}return null;};}function patchUpdates(_0x346135){return function(_0x2e9580){try{jsonpatch['apply'](_0x2e9580,_0x346135,!![]);}catch(_0x2f4e64){return BPromise[_0x5310('0x33')](_0x2f4e64);}return _0x2e9580[_0x5310('0x34')]();};}function saveUpdates(_0x21ac9c,_0x3d9022){return function(_0x15d84d){if(_0x15d84d){return _0x15d84d[_0x5310('0x35')](_0x21ac9c)['then'](function(_0x3b2759){return _0x3b2759;});}return null;};}function removeEntity(_0x321eff,_0x4afbff){return function(_0x5261ed){if(_0x5261ed){return _0x5261ed['destroy']()[_0x5310('0x1d')](function(){_0x321eff[_0x5310('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8c7c18,_0x1d55cc){return function(_0x40b2cd){if(!_0x40b2cd){_0x8c7c18[_0x5310('0x29')](0x194);}return _0x40b2cd;};}function handleError(_0x3fdf34,_0x3f60ef){_0x3f60ef=_0x3f60ef||0x1f4;return function(_0xf3f91e){logger['error'](_0xf3f91e[_0x5310('0x36')]);if(_0xf3f91e['name']){delete _0xf3f91e[_0x5310('0x37')];}_0x3fdf34[_0x5310('0x2b')](_0x3f60ef)[_0x5310('0x38')](_0xf3f91e);};}exports['index']=function(_0x574311,_0x5c9822){var _0x6635b1={},_0x537428={},_0x4adf34={'count':0x0,'rows':[]};var _0x4110db=_['map'](db[_0x5310('0x39')][_0x5310('0x3a')],function(_0x12d1cd){return{'name':_0x12d1cd[_0x5310('0x3b')],'type':_0x12d1cd['type'][_0x5310('0x3c')]};});_0x537428['model']=_[_0x5310('0x3d')](_0x4110db,_0x5310('0x37'));_0x537428['query']=_[_0x5310('0x3e')](_0x574311[_0x5310('0x3f')]);_0x537428[_0x5310('0x40')]=_[_0x5310('0x41')](_0x537428['model'],_0x537428[_0x5310('0x3f')]);_0x6635b1['attributes']=_[_0x5310('0x41')](_0x537428[_0x5310('0x42')],qs[_0x5310('0x43')](_0x574311['query'][_0x5310('0x43')]));_0x6635b1[_0x5310('0x44')]=_0x6635b1[_0x5310('0x44')][_0x5310('0x45')]?_0x6635b1['attributes']:_0x537428['model'];if(!_0x574311[_0x5310('0x3f')][_0x5310('0x46')](_0x5310('0x47'))){_0x6635b1[_0x5310('0x2f')]=qs[_0x5310('0x2f')](_0x574311[_0x5310('0x3f')][_0x5310('0x2f')]);_0x6635b1[_0x5310('0x2d')]=qs[_0x5310('0x2d')](_0x574311[_0x5310('0x3f')][_0x5310('0x2d')]);}_0x6635b1[_0x5310('0x48')]=qs[_0x5310('0x49')](_0x574311[_0x5310('0x3f')][_0x5310('0x49')]);_0x6635b1[_0x5310('0x4a')]=qs['filters'](_['pick'](_0x574311[_0x5310('0x3f')],_0x537428[_0x5310('0x40')]),_0x4110db);if(_0x574311[_0x5310('0x3f')][_0x5310('0x4b')]){_0x6635b1[_0x5310('0x4a')]=_[_0x5310('0x4c')](_0x6635b1['where'],{'$or':_[_0x5310('0x3d')](_0x4110db,function(_0x5223f6){if(_0x5223f6[_0x5310('0x4d')]!==_0x5310('0x4e')){var _0x10c02d={};_0x10c02d[_0x5223f6['name']]={'$like':'%'+_0x574311[_0x5310('0x3f')][_0x5310('0x4b')]+'%'};return _0x10c02d;}})});}_0x6635b1=_[_0x5310('0x4c')]({},_0x6635b1,_0x574311['options']);var _0x4cc207={'where':_0x6635b1['where']};return db[_0x5310('0x39')][_0x5310('0x30')](_0x4cc207)[_0x5310('0x1d')](function(_0x1e8ed3){_0x4adf34[_0x5310('0x30')]=_0x1e8ed3;if(_0x574311['query'][_0x5310('0x4f')]){_0x6635b1['include']=[{'all':!![]}];}return db[_0x5310('0x39')][_0x5310('0x50')](_0x6635b1);})[_0x5310('0x1d')](function(_0x37e56a){_0x4adf34[_0x5310('0x51')]=_0x37e56a;return _0x4adf34;})[_0x5310('0x1d')](respondWithFilteredResult(_0x5c9822,_0x6635b1))[_0x5310('0x28')](handleError(_0x5c9822,null));};exports['show']=function(_0x408372,_0x10b8e5){var _0x58d30a={'raw':!![],'where':{'id':_0x408372[_0x5310('0x52')]['id']}},_0x273535={};_0x273535['model']=_[_0x5310('0x3e')](db[_0x5310('0x39')]['rawAttributes']);_0x273535['query']=_['keys'](_0x408372[_0x5310('0x3f')]);_0x273535[_0x5310('0x40')]=_[_0x5310('0x41')](_0x273535[_0x5310('0x42')],_0x273535[_0x5310('0x3f')]);_0x58d30a['attributes']=_[_0x5310('0x41')](_0x273535[_0x5310('0x42')],qs['fields'](_0x408372[_0x5310('0x3f')][_0x5310('0x43')]));_0x58d30a['attributes']=_0x58d30a[_0x5310('0x44')][_0x5310('0x45')]?_0x58d30a[_0x5310('0x44')]:_0x273535[_0x5310('0x42')];if(_0x408372[_0x5310('0x3f')]['includeAll']){_0x58d30a[_0x5310('0x53')]=[{'all':!![]}];}_0x58d30a=_['merge']({},_0x58d30a,_0x408372[_0x5310('0x54')]);return db[_0x5310('0x39')][_0x5310('0x55')](_0x58d30a)[_0x5310('0x1d')](handleEntityNotFound(_0x10b8e5,null))['then'](respondWithResult(_0x10b8e5,null))[_0x5310('0x28')](handleError(_0x10b8e5,null));};exports[_0x5310('0x56')]=function(_0x131b04,_0x36522f,_0x35f1f8){var _0x4006ac;return db[_0x5310('0x57')][_0x5310('0x58')](function(_0x466944){return db['Network'][_0x5310('0x56')](_0x131b04[_0x5310('0x59')],{'raw':!![]})['then'](function(_0x4202a2){_0x4006ac=_0x4202a2;return db[_0x5310('0x39')][_0x5310('0x50')]({'where':{'type':_0x131b04['body']['type']},'raw':!![]});})[_0x5310('0x1d')](function(_0x315db1){if(_0x4006ac[_0x5310('0x4d')][_0x5310('0x5a')]()==_0x5310('0x5b')){var _0x222588=fs['readFileSync'](path[_0x5310('0x5c')](config['root'],_0x5310('0x5d')),'utf8');var _0x2a4bda=ejs[_0x5310('0x5e')](_0x222588,{'networks':_0x315db1||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x2a4bda);return respondWithRpcPromise(_0x5310('0x5f'),_0x5310('0x56'),{'module':'res_stun_monitor.so'});}else if(_0x4006ac['type'][_0x5310('0x5a')]()=='TURN'){var _0x495020=fs[_0x5310('0x60')](path[_0x5310('0x5c')](config[_0x5310('0x61')],_0x5310('0x62')),_0x5310('0x63'));var _0x55c707=ejs[_0x5310('0x5e')](_0x495020,{'networks':_0x315db1||[]});fs['writeFileSync'](_0x5310('0x64'),_0x55c707);return respondWithRpcPromise(_0x5310('0x5f'),_0x5310('0x56'),{'module':_0x5310('0x65')});}else{var _0x4163ea=fs[_0x5310('0x60')](path[_0x5310('0x5c')](config['root'],_0x5310('0x66')),_0x5310('0x63'));var _0xe40358=ejs['render'](_0x4163ea,{'networks':_0x315db1||[]});fs[_0x5310('0x67')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x131b04[_0x5310('0x59')][_0x5310('0x4d')][_0x5310('0x68')]()),_0xe40358);return respondWithRpcPromise('Reload',_0x5310('0x56'),{'module':_0x5310('0x69')});}return null;})['then'](function(){return _0x4006ac;});})['then'](respondWithResult(_0x36522f,0xc9))[_0x5310('0x28')](handleError(_0x36522f,null));};exports[_0x5310('0x35')]=function(_0x2d67aa,_0x3ce22c,_0xde3688){var _0x3cceff;return db['sequelize'][_0x5310('0x58')](function(_0x41459a){return db['Network'][_0x5310('0x55')]({'where':{'id':_0x2d67aa[_0x5310('0x52')]['id']}})[_0x5310('0x1d')](handleEntityNotFound(_0x3ce22c,null))[_0x5310('0x1d')](saveUpdates(_0x2d67aa[_0x5310('0x59')],null))[_0x5310('0x1d')](function(_0x5f35d7){if(_0x5f35d7){_0x3cceff=_0x5f35d7;return db[_0x5310('0x39')]['findAll']({'where':{'type':_0x3cceff['type']},'raw':!![]});}return null;})[_0x5310('0x1d')](function(_0x123746){if(_0x3cceff['type'][_0x5310('0x5a')]()==_0x5310('0x5b')){var _0x27e84d=fs[_0x5310('0x60')](path[_0x5310('0x5c')](config[_0x5310('0x61')],'server/files/templates/stun_multiple.ejs'),_0x5310('0x63'));var _0x2f2aa7=ejs['render'](_0x27e84d,{'networks':_0x123746||[]});fs[_0x5310('0x67')](_0x5310('0x6a'),_0x2f2aa7);return respondWithRpcPromise(_0x5310('0x5f'),'update',{'module':_0x5310('0x65')});}else if(_0x3cceff['type'][_0x5310('0x5a')]()==_0x5310('0x6b')){var _0x46507c=fs['readFileSync'](path['join'](config[_0x5310('0x61')],_0x5310('0x62')),_0x5310('0x63'));var _0x5fe4ea=ejs[_0x5310('0x5e')](_0x46507c,{'networks':_0x123746||[]});fs[_0x5310('0x67')](_0x5310('0x64'),_0x5fe4ea);return respondWithRpcPromise(_0x5310('0x5f'),'update',{'module':'res_stun_monitor.so'});}else{var _0x490cf5=fs[_0x5310('0x60')](path[_0x5310('0x5c')](config['root'],_0x5310('0x66')),_0x5310('0x63'));var _0x4633a6=ejs['render'](_0x490cf5,{'networks':_0x123746||[]});fs[_0x5310('0x67')](util[_0x5310('0x6c')]('/etc/asterisk/sip_xcally_%s.conf',_0x2d67aa['body'][_0x5310('0x4d')][_0x5310('0x68')]()),_0x4633a6);return respondWithRpcPromise(_0x5310('0x5f'),_0x5310('0x35'),{'module':_0x5310('0x69')});}return null;})[_0x5310('0x1d')](function(_0x2c3e6e){if(_0x2c3e6e){return _0x3cceff;}return null;});})['then'](respondWithResult(_0x3ce22c,null))[_0x5310('0x28')](handleError(_0x3ce22c,null));};exports[_0x5310('0x6d')]=function(_0xf4ae48,_0xa4eac4,_0x5effd2){var _0x51770e;return db[_0x5310('0x39')][_0x5310('0x55')]({'where':{'id':_0xf4ae48[_0x5310('0x52')]['id']}})[_0x5310('0x1d')](function(_0x543722){_0x51770e=_0x543722;return _0x543722;})[_0x5310('0x1d')](handleEntityNotFound(_0xa4eac4,null))['then'](removeEntity(_0xa4eac4,null))[_0x5310('0x1d')](function(){if(_0x51770e){return db[_0x5310('0x39')][_0x5310('0x50')]({'where':{'type':_0x51770e[_0x5310('0x4d')]},'raw':!![]});}})[_0x5310('0x1d')](function(_0xb8bbc6){if(_0x51770e['type'][_0x5310('0x5a')]()==_0x5310('0x5b')){var _0x54c758=fs[_0x5310('0x60')](path['join'](config[_0x5310('0x61')],_0x5310('0x5d')),_0x5310('0x63'));var _0x23f5ef=ejs['render'](_0x54c758,{'networks':_0xb8bbc6||[]});fs[_0x5310('0x67')](_0x5310('0x6a'),_0x23f5ef);return respondWithRpcPromise(_0x5310('0x5f'),_0x5310('0x6d'),{'module':'res_stun_monitor.so'});}else if(_0x51770e['type'][_0x5310('0x5a')]()==_0x5310('0x6b')){var _0x16fcdf=fs[_0x5310('0x60')](path[_0x5310('0x5c')](config[_0x5310('0x61')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x2fdd92=ejs[_0x5310('0x5e')](_0x16fcdf,{'networks':_0xb8bbc6||[]});fs[_0x5310('0x67')](_0x5310('0x64'),_0x2fdd92);return respondWithRpcPromise(_0x5310('0x5f'),_0x5310('0x6d'),{'module':_0x5310('0x65')});}else{var _0x354a10=fs[_0x5310('0x60')](path[_0x5310('0x5c')](config[_0x5310('0x61')],_0x5310('0x66')),_0x5310('0x63'));var _0x1307e0=ejs[_0x5310('0x5e')](_0x354a10,{'networks':_0xb8bbc6||[]});fs[_0x5310('0x67')](util[_0x5310('0x6c')](_0x5310('0x6e'),_0xf4ae48[_0x5310('0x59')]['type']['toLowerCase']()),_0x1307e0);return respondWithRpcPromise(_0x5310('0x5f'),_0x5310('0x6d'),{'module':'chan_sip.so'});}return null;})[_0x5310('0x28')](handleError(_0xa4eac4,null));}; \ No newline at end of file +var _0x5329=['count','offset','Content-Range','json','apply','reject','save','destroy','stack','name','index','map','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','type','VIRTUAL','merge','options','Network','includeAll','include','rows','catch','keys','find','create','sequelize','transaction','findAll','body','toUpperCase','STUN','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','readFileSync','join','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','update','params','server/files/templates/stun_multiple.ejs','TURN','format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','then','info','Network,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','undefined','limit'];(function(_0x44ed2c,_0x1c31b5){var _0x5034e2=function(_0x5efd7c){while(--_0x5efd7c){_0x44ed2c['push'](_0x44ed2c['shift']());}};_0x5034e2(++_0x1c31b5);}(_0x5329,0xab));var _0x9532=function(_0x276189,_0x1229de){_0x276189=_0x276189-0x0;var _0x28f941=_0x5329[_0x276189];return _0x28f941;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9532('0x0'));var zipdir=require(_0x9532('0x1'));var jsonpatch=require(_0x9532('0x2'));var rp=require(_0x9532('0x3'));var moment=require(_0x9532('0x4'));var BPromise=require(_0x9532('0x5'));var Mustache=require(_0x9532('0x6'));var util=require('util');var path=require(_0x9532('0x7'));var sox=require(_0x9532('0x8'));var csv=require(_0x9532('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9532('0xa'));var _=require('lodash');var squel=require(_0x9532('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9532('0xc'));var toCsv=require(_0x9532('0x9'));var querystring=require(_0x9532('0xd'));var Papa=require('papaparse');var Redis=require(_0x9532('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9532('0xf'));var as=require(_0x9532('0x10'));var hardwareService=require(_0x9532('0x11'));var logger=require(_0x9532('0x12'))(_0x9532('0x13'));var utils=require(_0x9532('0x14'));var config=require(_0x9532('0x15'));var licenseUtil=require(_0x9532('0x16'));var db=require(_0x9532('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x9532('0x18')][_0x9532('0x19')]({'port':0x232a});function respondWithRpcPromise(_0xde616e,_0x10346a,_0x46c946,_0x1c5769){return new BPromise(function(_0x404b98,_0x2719de){var _0x5f4f47=_0x1c5769||client;return _0x5f4f47['request'](_0xde616e,_0x46c946)[_0x9532('0x1a')](function(_0x49845b){logger[_0x9532('0x1b')](_0x9532('0x1c'),_0x10346a,'request\x20sent');logger[_0x9532('0x1d')]('Network,\x20%s,\x20%s,\x20%s',_0x10346a,_0x9532('0x1e'),JSON[_0x9532('0x1f')](_0x49845b));if(_0x49845b[_0x9532('0x20')]){if(_0x49845b[_0x9532('0x20')][_0x9532('0x21')]===0x1f4){logger[_0x9532('0x20')]('Network,\x20%s,\x20%s',_0x10346a,_0x49845b[_0x9532('0x20')]['message']);return _0x2719de(_0x49845b['error'][_0x9532('0x22')]);}logger[_0x9532('0x20')](_0x9532('0x1c'),_0x10346a,_0x49845b[_0x9532('0x20')]['message']);return _0x404b98(_0x49845b[_0x9532('0x20')]['message']);}else{logger[_0x9532('0x1b')](_0x9532('0x1c'),_0x10346a,_0x9532('0x1e'));_0x404b98(_0x49845b[_0x9532('0x23')][_0x9532('0x22')]);}})['catch'](function(_0x2ca814){logger[_0x9532('0x20')]('Network,\x20%s,\x20%s',_0x10346a,_0x2ca814);_0x2719de(_0x2ca814);});});}function respondWithStatusCode(_0x16b9ed,_0x586246){_0x586246=_0x586246||0xcc;return function(_0x40431b){if(_0x40431b){return _0x16b9ed[_0x9532('0x24')](_0x586246);}return _0x16b9ed[_0x9532('0x25')](_0x586246)[_0x9532('0x26')]();};}function respondWithResult(_0x54bfa5,_0x84e174){_0x84e174=_0x84e174||0xc8;return function(_0x2a1409){if(_0x2a1409){return _0x54bfa5['status'](_0x84e174)['json'](_0x2a1409);}};}function respondWithFilteredResult(_0x3a26f0,_0x2bad72){return function(_0x1691cd){if(_0x1691cd){var _0x5d755a=typeof _0x2bad72['offset']===_0x9532('0x27')&&typeof _0x2bad72[_0x9532('0x28')]===_0x9532('0x27');var _0x218346=_0x1691cd[_0x9532('0x29')];var _0x119423=_0x5d755a?0x0:_0x2bad72[_0x9532('0x2a')];var _0x1b6a61=_0x5d755a?_0x1691cd['count']:_0x2bad72[_0x9532('0x2a')]+_0x2bad72[_0x9532('0x28')];var _0x1deda7;if(_0x1b6a61>=_0x218346){_0x1b6a61=_0x218346;_0x1deda7=0xc8;}else{_0x1deda7=0xce;}_0x3a26f0[_0x9532('0x25')](_0x1deda7);return _0x3a26f0['set'](_0x9532('0x2b'),_0x119423+'-'+_0x1b6a61+'/'+_0x218346)[_0x9532('0x2c')](_0x1691cd);}return null;};}function patchUpdates(_0x254c2c){return function(_0x180e65){try{jsonpatch[_0x9532('0x2d')](_0x180e65,_0x254c2c,!![]);}catch(_0x1e3ba7){return BPromise[_0x9532('0x2e')](_0x1e3ba7);}return _0x180e65[_0x9532('0x2f')]();};}function saveUpdates(_0x35bae8,_0x16142f){return function(_0x3e7dce){if(_0x3e7dce){return _0x3e7dce['update'](_0x35bae8)[_0x9532('0x1a')](function(_0x16489a){return _0x16489a;});}return null;};}function removeEntity(_0xfe0582,_0x2534e2){return function(_0x3f2d66){if(_0x3f2d66){return _0x3f2d66[_0x9532('0x30')]()['then'](function(){_0xfe0582[_0x9532('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x460e40,_0x2be447){return function(_0x3d26cc){if(!_0x3d26cc){_0x460e40[_0x9532('0x24')](0x194);}return _0x3d26cc;};}function handleError(_0x438d49,_0xe56662){_0xe56662=_0xe56662||0x1f4;return function(_0x542321){logger['error'](_0x542321[_0x9532('0x31')]);if(_0x542321['name']){delete _0x542321[_0x9532('0x32')];}_0x438d49[_0x9532('0x25')](_0xe56662)['send'](_0x542321);};}exports[_0x9532('0x33')]=function(_0x51df37,_0xe88fe){var _0x12d53e={},_0x2863f3={},_0x1e4219={'count':0x0,'rows':[]};var _0x538ed4=_[_0x9532('0x34')](db['Network'][_0x9532('0x35')],function(_0x26b7a4){return{'name':_0x26b7a4[_0x9532('0x36')],'type':_0x26b7a4['type']['key']};});_0x2863f3[_0x9532('0x37')]=_[_0x9532('0x34')](_0x538ed4,_0x9532('0x32'));_0x2863f3[_0x9532('0x38')]=_['keys'](_0x51df37[_0x9532('0x38')]);_0x2863f3['filters']=_[_0x9532('0x39')](_0x2863f3[_0x9532('0x37')],_0x2863f3[_0x9532('0x38')]);_0x12d53e[_0x9532('0x3a')]=_[_0x9532('0x39')](_0x2863f3[_0x9532('0x37')],qs[_0x9532('0x3b')](_0x51df37[_0x9532('0x38')][_0x9532('0x3b')]));_0x12d53e[_0x9532('0x3a')]=_0x12d53e[_0x9532('0x3a')][_0x9532('0x3c')]?_0x12d53e['attributes']:_0x2863f3['model'];if(!_0x51df37[_0x9532('0x38')][_0x9532('0x3d')](_0x9532('0x3e'))){_0x12d53e[_0x9532('0x28')]=qs['limit'](_0x51df37[_0x9532('0x38')][_0x9532('0x28')]);_0x12d53e[_0x9532('0x2a')]=qs[_0x9532('0x2a')](_0x51df37[_0x9532('0x38')][_0x9532('0x2a')]);}_0x12d53e[_0x9532('0x3f')]=qs[_0x9532('0x40')](_0x51df37[_0x9532('0x38')][_0x9532('0x40')]);_0x12d53e[_0x9532('0x41')]=qs[_0x9532('0x42')](_['pick'](_0x51df37[_0x9532('0x38')],_0x2863f3[_0x9532('0x42')]),_0x538ed4);if(_0x51df37[_0x9532('0x38')][_0x9532('0x43')]){_0x12d53e[_0x9532('0x41')]=_['merge'](_0x12d53e[_0x9532('0x41')],{'$or':_[_0x9532('0x34')](_0x538ed4,function(_0x3f1d08){if(_0x3f1d08[_0x9532('0x44')]!==_0x9532('0x45')){var _0x144511={};_0x144511[_0x3f1d08[_0x9532('0x32')]]={'$like':'%'+_0x51df37['query'][_0x9532('0x43')]+'%'};return _0x144511;}})});}_0x12d53e=_[_0x9532('0x46')]({},_0x12d53e,_0x51df37[_0x9532('0x47')]);var _0x1507a8={'where':_0x12d53e[_0x9532('0x41')]};return db[_0x9532('0x48')]['count'](_0x1507a8)[_0x9532('0x1a')](function(_0x231589){_0x1e4219[_0x9532('0x29')]=_0x231589;if(_0x51df37[_0x9532('0x38')][_0x9532('0x49')]){_0x12d53e[_0x9532('0x4a')]=[{'all':!![]}];}return db[_0x9532('0x48')]['findAll'](_0x12d53e);})[_0x9532('0x1a')](function(_0x3971bb){_0x1e4219[_0x9532('0x4b')]=_0x3971bb;return _0x1e4219;})[_0x9532('0x1a')](respondWithFilteredResult(_0xe88fe,_0x12d53e))[_0x9532('0x4c')](handleError(_0xe88fe,null));};exports['show']=function(_0x8bfffc,_0x5393dc){var _0x45ef7a={'raw':!![],'where':{'id':_0x8bfffc['params']['id']}},_0xd4bf72={};_0xd4bf72[_0x9532('0x37')]=_[_0x9532('0x4d')](db['Network'][_0x9532('0x35')]);_0xd4bf72[_0x9532('0x38')]=_[_0x9532('0x4d')](_0x8bfffc['query']);_0xd4bf72[_0x9532('0x42')]=_[_0x9532('0x39')](_0xd4bf72[_0x9532('0x37')],_0xd4bf72[_0x9532('0x38')]);_0x45ef7a[_0x9532('0x3a')]=_[_0x9532('0x39')](_0xd4bf72['model'],qs['fields'](_0x8bfffc[_0x9532('0x38')][_0x9532('0x3b')]));_0x45ef7a[_0x9532('0x3a')]=_0x45ef7a['attributes'][_0x9532('0x3c')]?_0x45ef7a['attributes']:_0xd4bf72[_0x9532('0x37')];if(_0x8bfffc[_0x9532('0x38')][_0x9532('0x49')]){_0x45ef7a['include']=[{'all':!![]}];}_0x45ef7a=_[_0x9532('0x46')]({},_0x45ef7a,_0x8bfffc[_0x9532('0x47')]);return db['Network'][_0x9532('0x4e')](_0x45ef7a)[_0x9532('0x1a')](handleEntityNotFound(_0x5393dc,null))[_0x9532('0x1a')](respondWithResult(_0x5393dc,null))[_0x9532('0x4c')](handleError(_0x5393dc,null));};exports[_0x9532('0x4f')]=function(_0x158966,_0x1e8cd6,_0x4d6552){var _0x37a54f;return db[_0x9532('0x50')][_0x9532('0x51')](function(_0x3af423){return db[_0x9532('0x48')][_0x9532('0x4f')](_0x158966['body'],{'raw':!![]})[_0x9532('0x1a')](function(_0x18caf6){_0x37a54f=_0x18caf6;return db[_0x9532('0x48')][_0x9532('0x52')]({'where':{'type':_0x158966[_0x9532('0x53')][_0x9532('0x44')]},'raw':!![]});})['then'](function(_0x3af70b){if(_0x37a54f[_0x9532('0x44')][_0x9532('0x54')]()==_0x9532('0x55')){var _0x2fb9b4=fs['readFileSync'](path['join'](config[_0x9532('0x56')],'server/files/templates/stun_multiple.ejs'),_0x9532('0x57'));var _0x498bfc=ejs[_0x9532('0x58')](_0x2fb9b4,{'networks':_0x3af70b||[]});fs[_0x9532('0x59')](_0x9532('0x5a'),_0x498bfc);return respondWithRpcPromise(_0x9532('0x5b'),_0x9532('0x4f'),{'module':_0x9532('0x5c')});}else if(_0x37a54f[_0x9532('0x44')][_0x9532('0x54')]()=='TURN'){var _0x2a027a=fs[_0x9532('0x5d')](path[_0x9532('0x5e')](config['root'],_0x9532('0x5f')),_0x9532('0x57'));var _0x407f7d=ejs[_0x9532('0x58')](_0x2a027a,{'networks':_0x3af70b||[]});fs[_0x9532('0x59')](_0x9532('0x60'),_0x407f7d);return respondWithRpcPromise(_0x9532('0x5b'),'create',{'module':_0x9532('0x5c')});}else{var _0xf97475=fs[_0x9532('0x5d')](path[_0x9532('0x5e')](config[_0x9532('0x56')],_0x9532('0x61')),_0x9532('0x57'));var _0x3fec38=ejs[_0x9532('0x58')](_0xf97475,{'networks':_0x3af70b||[]});fs[_0x9532('0x59')](util['format'](_0x9532('0x62'),_0x158966[_0x9532('0x53')]['type'][_0x9532('0x63')]()),_0x3fec38);return respondWithRpcPromise(_0x9532('0x5b'),_0x9532('0x4f'),{'module':_0x9532('0x64')});}return null;})['then'](function(){return _0x37a54f;});})[_0x9532('0x1a')](respondWithResult(_0x1e8cd6,0xc9))['catch'](handleError(_0x1e8cd6,null));};exports[_0x9532('0x65')]=function(_0x86db73,_0x15ce70,_0xff4ca7){var _0x5d6773;return db[_0x9532('0x50')]['transaction'](function(_0x130a9b){return db['Network'][_0x9532('0x4e')]({'where':{'id':_0x86db73[_0x9532('0x66')]['id']}})['then'](handleEntityNotFound(_0x15ce70,null))[_0x9532('0x1a')](saveUpdates(_0x86db73[_0x9532('0x53')],null))[_0x9532('0x1a')](function(_0x2b785b){if(_0x2b785b){_0x5d6773=_0x2b785b;return db['Network'][_0x9532('0x52')]({'where':{'type':_0x5d6773[_0x9532('0x44')]},'raw':!![]});}return null;})['then'](function(_0x1c557c){if(_0x5d6773[_0x9532('0x44')][_0x9532('0x54')]()=='STUN'){var _0x4206fc=fs[_0x9532('0x5d')](path[_0x9532('0x5e')](config[_0x9532('0x56')],_0x9532('0x67')),_0x9532('0x57'));var _0x1068c4=ejs[_0x9532('0x58')](_0x4206fc,{'networks':_0x1c557c||[]});fs[_0x9532('0x59')](_0x9532('0x5a'),_0x1068c4);return respondWithRpcPromise(_0x9532('0x5b'),_0x9532('0x65'),{'module':'res_stun_monitor.so'});}else if(_0x5d6773['type'][_0x9532('0x54')]()==_0x9532('0x68')){var _0x271d3b=fs['readFileSync'](path[_0x9532('0x5e')](config[_0x9532('0x56')],_0x9532('0x5f')),'utf8');var _0x56c612=ejs[_0x9532('0x58')](_0x271d3b,{'networks':_0x1c557c||[]});fs['writeFileSync'](_0x9532('0x60'),_0x56c612);return respondWithRpcPromise(_0x9532('0x5b'),_0x9532('0x65'),{'module':_0x9532('0x5c')});}else{var _0x4a4597=fs[_0x9532('0x5d')](path[_0x9532('0x5e')](config[_0x9532('0x56')],_0x9532('0x61')),_0x9532('0x57'));var _0x25d724=ejs['render'](_0x4a4597,{'networks':_0x1c557c||[]});fs[_0x9532('0x59')](util[_0x9532('0x69')]('/etc/asterisk/sip_xcally_%s.conf',_0x86db73[_0x9532('0x53')]['type']['toLowerCase']()),_0x25d724);return respondWithRpcPromise(_0x9532('0x5b'),_0x9532('0x65'),{'module':_0x9532('0x64')});}return null;})['then'](function(_0x6a01d0){if(_0x6a01d0){return _0x5d6773;}return null;});})[_0x9532('0x1a')](respondWithResult(_0x15ce70,null))[_0x9532('0x4c')](handleError(_0x15ce70,null));};exports['destroy']=function(_0x49c4ed,_0x60ba8e,_0x4b9b08){var _0x4fd2f3;return db['Network']['find']({'where':{'id':_0x49c4ed['params']['id']}})['then'](function(_0x214aea){_0x4fd2f3=_0x214aea;return _0x214aea;})[_0x9532('0x1a')](handleEntityNotFound(_0x60ba8e,null))['then'](removeEntity(_0x60ba8e,null))['then'](function(){if(_0x4fd2f3){return db[_0x9532('0x48')]['findAll']({'where':{'type':_0x4fd2f3[_0x9532('0x44')]},'raw':!![]});}})[_0x9532('0x1a')](function(_0x58387d){if(_0x4fd2f3['type'][_0x9532('0x54')]()=='STUN'){var _0x264271=fs[_0x9532('0x5d')](path[_0x9532('0x5e')](config['root'],_0x9532('0x67')),'utf8');var _0x335d25=ejs[_0x9532('0x58')](_0x264271,{'networks':_0x58387d||[]});fs['writeFileSync'](_0x9532('0x5a'),_0x335d25);return respondWithRpcPromise(_0x9532('0x5b'),_0x9532('0x30'),{'module':_0x9532('0x5c')});}else if(_0x4fd2f3['type']['toUpperCase']()=='TURN'){var _0x59ff7a=fs[_0x9532('0x5d')](path['join'](config['root'],_0x9532('0x5f')),_0x9532('0x57'));var _0x51f603=ejs['render'](_0x59ff7a,{'networks':_0x58387d||[]});fs['writeFileSync'](_0x9532('0x60'),_0x51f603);return respondWithRpcPromise(_0x9532('0x5b'),'destroy',{'module':_0x9532('0x5c')});}else{var _0x3f165a=fs['readFileSync'](path[_0x9532('0x5e')](config[_0x9532('0x56')],'server/files/templates/network.ejs'),_0x9532('0x57'));var _0x16232d=ejs[_0x9532('0x58')](_0x3f165a,{'networks':_0x58387d||[]});fs['writeFileSync'](util[_0x9532('0x69')](_0x9532('0x62'),_0x49c4ed['body']['type']['toLowerCase']()),_0x16232d);return respondWithRpcPromise('Reload',_0x9532('0x30'),{'module':_0x9532('0x64')});}return null;})['catch'](handleError(_0x60ba8e,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index e6855ee..34553f3 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 _0x702d=['exports','define','Network','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x503798,_0x3af578){var _0x761bfa=function(_0x3f44ca){while(--_0x3f44ca){_0x503798['push'](_0x503798['shift']());}};_0x761bfa(++_0x3af578);}(_0x702d,0x147));var _0xd702=function(_0x21be95,_0x4fb14e){_0x21be95=_0x21be95-0x0;var _0x4c9910=_0x702d[_0x21be95];return _0x4c9910;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var logger=require(_0xd702('0x2'))(_0xd702('0x3'));var moment=require(_0xd702('0x4'));var BPromise=require('bluebird');var rp=require(_0xd702('0x5'));var fs=require('fs');var path=require(_0xd702('0x6'));var rimraf=require(_0xd702('0x7'));var config=require(_0xd702('0x8'));var attributes=require('./network.attributes');module[_0xd702('0x9')]=function(_0x544e94,_0x1aecfc){return _0x544e94[_0xd702('0xa')](_0xd702('0xb'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3667=['network','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./network.attributes','exports','Network'];(function(_0x4a5e62,_0x555664){var _0x23a02e=function(_0x5d79e3){while(--_0x5d79e3){_0x4a5e62['push'](_0x4a5e62['shift']());}};_0x23a02e(++_0x555664);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7366('0x0'));var util=require(_0x7366('0x1'));var logger=require(_0x7366('0x2'))(_0x7366('0x3'));var moment=require(_0x7366('0x4'));var BPromise=require('bluebird');var rp=require(_0x7366('0x5'));var fs=require('fs');var path=require(_0x7366('0x6'));var rimraf=require('rimraf');var config=require(_0x7366('0x7'));var attributes=require(_0x7366('0x8'));module[_0x7366('0x9')]=function(_0x1c0cf4,_0x101e3d){return _0x1c0cf4['define'](_0x7366('0xa'),attributes,{'tableName':_0x7366('0xb'),'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 89ac967..4bc9631 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x116a72,_0x3a950e){_0x116a72=_0x116a72-0x0;var _0x5c68b1=_0x7a54[_0x116a72];return _0x5c68b1;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2a81bf,_0x5b3d31){var _0x12ac87=function(_0x57d69a){while(--_0x57d69a){_0x2a81bf['push'](_0x2a81bf['shift']());}};_0x12ac87(++_0x5b3d31);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 46d3d29..511d526 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 _0x8315=['getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','/:id/applications','addApplications','send','destroy','delete','removeAnswers','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelAccount.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers'];(function(_0x211632,_0x378e2e){var _0x5a1da1=function(_0x44aff2){while(--_0x44aff2){_0x211632['push'](_0x211632['shift']());}};_0x5a1da1(++_0x378e2e);}(_0x8315,0x19e));var _0x5831=function(_0x532251,_0x44d617){_0x532251=_0x532251-0x0;var _0x3a3dba=_0x8315[_0x532251];return _0x3a3dba;};'use strict';var multer=require(_0x5831('0x0'));var util=require(_0x5831('0x1'));var path=require(_0x5831('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5831('0x3')]();var fs_extra=require(_0x5831('0x4'));var auth=require(_0x5831('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5831('0x6'));var controller=require(_0x5831('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x5831('0x8')]);router[_0x5831('0x9')](_0x5831('0xa'),auth[_0x5831('0xb')](),controller[_0x5831('0xc')]);router[_0x5831('0x9')](_0x5831('0xd'),auth['isAuthenticated'](),controller[_0x5831('0xe')]);router[_0x5831('0x9')](_0x5831('0xf'),auth[_0x5831('0xb')](),controller[_0x5831('0x10')]);router[_0x5831('0x9')](_0x5831('0x11'),auth[_0x5831('0xb')](),controller[_0x5831('0x12')]);router['get']('/:id/applications',auth[_0x5831('0xb')](),controller[_0x5831('0x13')]);router[_0x5831('0x9')](_0x5831('0x14'),auth[_0x5831('0xb')](),controller[_0x5831('0x15')]);router[_0x5831('0x9')](_0x5831('0x16'),auth[_0x5831('0xb')](),controller[_0x5831('0x17')]);router[_0x5831('0x18')]('/',auth[_0x5831('0xb')](),controller[_0x5831('0x19')]);router[_0x5831('0x18')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x5831('0x1a')]);router[_0x5831('0x18')](_0x5831('0x11'),auth[_0x5831('0xb')](),controller[_0x5831('0x1b')]);router['post'](_0x5831('0x1c'),controller['notify']);router['post'](_0x5831('0x1d'),auth[_0x5831('0xb')](),controller[_0x5831('0x1e')]);router[_0x5831('0x18')](_0x5831('0x16'),auth[_0x5831('0xb')](),controller['addAgents']);router[_0x5831('0x18')]('/:id/send',auth[_0x5831('0xb')](),controller[_0x5831('0x1f')]);router['put'](_0x5831('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x5831('0xd'),auth[_0x5831('0xb')](),controller[_0x5831('0x20')]);router[_0x5831('0x21')](_0x5831('0xf'),auth[_0x5831('0xb')](),controller['removeDispositions']);router[_0x5831('0x21')]('/:id/canned_answers',auth[_0x5831('0xb')](),controller[_0x5831('0x22')]);router[_0x5831('0x21')](_0x5831('0x16'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x5831('0x23')]=router; \ No newline at end of file +var _0x2b3c=['removeAgents','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelAccount.controller','get','isAuthenticated','index','describe','/:id','show','getDispositions','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','/:id/dispositions','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','notify','addAgents','/:id/send','send','put','destroy','delete','removeDispositions','removeAnswers'];(function(_0x1b2869,_0x4f442b){var _0x5a644c=function(_0x2d2ca5){while(--_0x2d2ca5){_0x1b2869['push'](_0x1b2869['shift']());}};_0x5a644c(++_0x4f442b);}(_0x2b3c,0x73));var _0xc2b3=function(_0x266fb8,_0x30d69b){_0x266fb8=_0x266fb8-0x0;var _0x4ffb58=_0x2b3c[_0x266fb8];return _0x4ffb58;};'use strict';var multer=require('multer');var util=require(_0xc2b3('0x0'));var path=require(_0xc2b3('0x1'));var timeout=require(_0xc2b3('0x2'));var express=require(_0xc2b3('0x3'));var router=express[_0xc2b3('0x4')]();var fs_extra=require(_0xc2b3('0x5'));var auth=require(_0xc2b3('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc2b3('0x7'));router[_0xc2b3('0x8')]('/',auth[_0xc2b3('0x9')](),controller[_0xc2b3('0xa')]);router[_0xc2b3('0x8')]('/describe',auth[_0xc2b3('0x9')](),controller[_0xc2b3('0xb')]);router[_0xc2b3('0x8')](_0xc2b3('0xc'),auth[_0xc2b3('0x9')](),controller[_0xc2b3('0xd')]);router[_0xc2b3('0x8')]('/:id/dispositions',auth[_0xc2b3('0x9')](),controller[_0xc2b3('0xe')]);router[_0xc2b3('0x8')]('/:id/canned_answers',auth[_0xc2b3('0x9')](),controller['getAnswers']);router[_0xc2b3('0x8')](_0xc2b3('0xf'),auth[_0xc2b3('0x9')](),controller[_0xc2b3('0x10')]);router[_0xc2b3('0x8')](_0xc2b3('0x11'),auth[_0xc2b3('0x9')](),controller[_0xc2b3('0x12')]);router[_0xc2b3('0x8')](_0xc2b3('0x13'),auth['isAuthenticated'](),controller[_0xc2b3('0x14')]);router['post']('/',auth[_0xc2b3('0x9')](),controller[_0xc2b3('0x15')]);router[_0xc2b3('0x16')](_0xc2b3('0x17'),auth['isAuthenticated'](),controller[_0xc2b3('0x18')]);router[_0xc2b3('0x16')](_0xc2b3('0x19'),auth[_0xc2b3('0x9')](),controller[_0xc2b3('0x1a')]);router[_0xc2b3('0x16')](_0xc2b3('0x1b'),controller[_0xc2b3('0x1c')]);router[_0xc2b3('0x16')]('/:id/applications',auth[_0xc2b3('0x9')](),controller['addApplications']);router['post'](_0xc2b3('0x13'),auth[_0xc2b3('0x9')](),controller[_0xc2b3('0x1d')]);router[_0xc2b3('0x16')](_0xc2b3('0x1e'),auth[_0xc2b3('0x9')](),controller[_0xc2b3('0x1f')]);router[_0xc2b3('0x20')]('/:id',auth[_0xc2b3('0x9')](),controller['update']);router['delete']('/:id',auth[_0xc2b3('0x9')](),controller[_0xc2b3('0x21')]);router[_0xc2b3('0x22')]('/:id/dispositions',auth[_0xc2b3('0x9')](),controller[_0xc2b3('0x23')]);router['delete'](_0xc2b3('0x19'),auth[_0xc2b3('0x9')](),controller[_0xc2b3('0x24')]);router[_0xc2b3('0x22')](_0xc2b3('0x13'),auth[_0xc2b3('0x9')](),controller[_0xc2b3('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 bcb81a2..f8aaef6 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 _0x5f4b=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','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','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x1612d6,_0x5577bf){var _0x27a583=function(_0x3dc4a2){while(--_0x3dc4a2){_0x1612d6['push'](_0x1612d6['shift']());}};_0x27a583(++_0x5577bf);}(_0x5f4b,0xb8));var _0xb5f4=function(_0x44e96e,_0x3b551a){_0x44e96e=_0x44e96e-0x0;var _0x27c3a2=_0x5f4b[_0x44e96e];return _0x27c3a2;};'use strict';var Sequelize=require(_0xb5f4('0x0'));var rs=require('randomstring');module[_0xb5f4('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xb5f4('0x2')]},'token':{'type':Sequelize[_0xb5f4('0x2')],'defaultValue':function(){return rs[_0xb5f4('0x3')]();}},'replyUri':{'type':Sequelize[_0xb5f4('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xb5f4('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xb5f4('0x4')],'defaultValue':function(){return _0xb5f4('0x5');}},'notificationSound':{'type':Sequelize[_0xb5f4('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb5f4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xb5f4('0x2')]},'queueTransfer':{'type':Sequelize[_0xb5f4('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb5f4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb5f4('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb5f4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xb5f4('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xb5f4('0x9'),'set':function(_0xf5b6cb){if(!_0xf5b6cb)this[_0xb5f4('0xa')](_0xb5f4('0xb'),null);this['setDataValue'](_0xb5f4('0xc'),_0xf5b6cb);}}}; \ No newline at end of file +var _0xa8f1=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa8f1,0x1e7));var _0x1a8f=function(_0x542589,_0x5d6b91){_0x542589=_0x542589-0x0;var _0x4c7d47=_0xa8f1[_0x542589];return _0x4c7d47;};'use strict';var Sequelize=require(_0x1a8f('0x0'));var rs=require(_0x1a8f('0x1'));module['exports']={'name':{'type':Sequelize[_0x1a8f('0x2')],'unique':_0x1a8f('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x1a8f('0x2')]},'token':{'type':Sequelize[_0x1a8f('0x2')],'defaultValue':function(){return rs[_0x1a8f('0x4')]();}},'replyUri':{'type':Sequelize[_0x1a8f('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x1a8f('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x1a8f('0x5')],'defaultValue':function(){return _0x1a8f('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1a8f('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1a8f('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x1a8f('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1a8f('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1a8f('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x1a8f('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x1a8f('0x7')],'defaultValue':![],'comment':_0x1a8f('0xa'),'set':function(_0xae4369){if(!_0xae4369)this[_0x1a8f('0xb')]('mandatoryDispositionPauseId',null);this[_0x1a8f('0xb')](_0x1a8f('0xc'),_0xae4369);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index f234497..c7fcce9 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 _0xfdd6=['autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','stack','finally','getApplications','getInteractions','Contact','Owner','internal','Tag','Tags','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','CmList','out','Messages','dataValues','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','../../components/auth/service','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','client','http','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','message','catch','sendStatus','status','json','offset','undefined','limit','set','Content-Range','reject','destroy','get','UserProfileResource','end','name','send','index','mandatoryDispositionPause','OpenchannelAccount','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','options','count','includeAll','findAll','rows','show','params','rawAttributes','include','find','create','body','user','role','OpenchannelAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','Pause','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','getAnswers','CannedAnswer','order','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','asc','defaults','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','messageId','interaction','created'];(function(_0x5062d1,_0x1cc467){var _0x4f1cd3=function(_0x35f8fa){while(--_0x35f8fa){_0x5062d1['push'](_0x5062d1['shift']());}};_0x4f1cd3(++_0x1cc467);}(_0xfdd6,0xde));var _0x6fdd=function(_0x12c280,_0x51dd07){_0x12c280=_0x12c280-0x0;var _0x3638d3=_0xfdd6[_0x12c280];return _0x3638d3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6fdd('0x0'));var jsonpatch=require(_0x6fdd('0x1'));var rp=require(_0x6fdd('0x2'));var moment=require(_0x6fdd('0x3'));var BPromise=require(_0x6fdd('0x4'));var Mustache=require(_0x6fdd('0x5'));var util=require(_0x6fdd('0x6'));var path=require(_0x6fdd('0x7'));var sox=require(_0x6fdd('0x8'));var csv=require('to-csv');var ejs=require(_0x6fdd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6fdd('0xa'));var squel=require('squel');var crypto=require(_0x6fdd('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6fdd('0xc'));var toCsv=require(_0x6fdd('0xd'));var querystring=require(_0x6fdd('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6fdd('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6fdd('0x10'));var utils=require(_0x6fdd('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x6fdd('0x12'));var db=require('../../mysqldb')['db'];config[_0x6fdd('0x13')]=_['defaults'](config[_0x6fdd('0x13')],{'host':_0x6fdd('0x14'),'port':0x18eb});var socket=require(_0x6fdd('0x15'))(new Redis(config[_0x6fdd('0x13')]));require(_0x6fdd('0x16'))['register'](socket);var jayson=require(_0x6fdd('0x17'));var client=jayson[_0x6fdd('0x18')][_0x6fdd('0x19')]({'port':0x232c});var client9002=jayson[_0x6fdd('0x18')][_0x6fdd('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2bc5f9,_0x4cb8ac,_0x311cf0,_0x112309){return new BPromise(function(_0xe5fbdb,_0x172f9b){var _0x43744e=_0x112309||client;return _0x43744e['request'](_0x2bc5f9,_0x311cf0)[_0x6fdd('0x1a')](function(_0xcfb70d){logger[_0x6fdd('0x1b')](_0x6fdd('0x1c'),_0x4cb8ac,_0x6fdd('0x1d'));logger[_0x6fdd('0x1e')](_0x6fdd('0x1f'),_0x4cb8ac,_0x6fdd('0x1d'),JSON['stringify'](_0xcfb70d));if(_0xcfb70d[_0x6fdd('0x20')]){if(_0xcfb70d[_0x6fdd('0x20')]['code']===0x1f4){logger[_0x6fdd('0x20')]('OpenchannelAccount,\x20%s,\x20%s',_0x4cb8ac,_0xcfb70d[_0x6fdd('0x20')]['message']);return _0x172f9b(_0xcfb70d[_0x6fdd('0x20')][_0x6fdd('0x21')]);}logger[_0x6fdd('0x20')](_0x6fdd('0x1c'),_0x4cb8ac,_0xcfb70d['error'][_0x6fdd('0x21')]);return _0xe5fbdb(_0xcfb70d['error'][_0x6fdd('0x21')]);}else{logger[_0x6fdd('0x1b')](_0x6fdd('0x1c'),_0x4cb8ac,'request\x20sent');_0xe5fbdb(_0xcfb70d['result'][_0x6fdd('0x21')]);}})[_0x6fdd('0x22')](function(_0x2abf69){logger[_0x6fdd('0x20')](_0x6fdd('0x1c'),_0x4cb8ac,_0x2abf69);_0x172f9b(_0x2abf69);});});}function respondWithStatusCode(_0x511f39,_0x15376d){_0x15376d=_0x15376d||0xcc;return function(_0x1e7a0c){if(_0x1e7a0c){return _0x511f39[_0x6fdd('0x23')](_0x15376d);}return _0x511f39[_0x6fdd('0x24')](_0x15376d)['end']();};}function respondWithResult(_0x43cd04,_0x212d28){_0x212d28=_0x212d28||0xc8;return function(_0x3a0810){if(_0x3a0810){return _0x43cd04[_0x6fdd('0x24')](_0x212d28)[_0x6fdd('0x25')](_0x3a0810);}};}function respondWithFilteredResult(_0x5a790b,_0xf964aa){return function(_0x2fa674){if(_0x2fa674){var _0x193094=typeof _0xf964aa[_0x6fdd('0x26')]===_0x6fdd('0x27')&&typeof _0xf964aa[_0x6fdd('0x28')]===_0x6fdd('0x27');var _0x28fe43=_0x2fa674['count'];var _0x5906ea=_0x193094?0x0:_0xf964aa['offset'];var _0x361160=_0x193094?_0x2fa674['count']:_0xf964aa[_0x6fdd('0x26')]+_0xf964aa['limit'];var _0x4d7f82;if(_0x361160>=_0x28fe43){_0x361160=_0x28fe43;_0x4d7f82=0xc8;}else{_0x4d7f82=0xce;}_0x5a790b[_0x6fdd('0x24')](_0x4d7f82);return _0x5a790b[_0x6fdd('0x29')](_0x6fdd('0x2a'),_0x5906ea+'-'+_0x361160+'/'+_0x28fe43)[_0x6fdd('0x25')](_0x2fa674);}return null;};}function patchUpdates(_0x4c72c4){return function(_0x39e2ed){try{jsonpatch['apply'](_0x39e2ed,_0x4c72c4,!![]);}catch(_0x541d47){return BPromise[_0x6fdd('0x2b')](_0x541d47);}return _0x39e2ed['save']();};}function saveUpdates(_0x238275,_0x40b2d6){return function(_0x21512a){if(_0x21512a){return _0x21512a['update'](_0x238275)['then'](function(_0x521ff7){return _0x521ff7;});}return null;};}function removeEntity(_0x3abad6,_0x241e3e){return function(_0x4ba3d2){if(_0x4ba3d2){return _0x4ba3d2[_0x6fdd('0x2c')]()[_0x6fdd('0x1a')](function(){var _0x1d6dd3=_0x4ba3d2[_0x6fdd('0x2d')]({'plain':!![]});var _0x52052d='OpenchannelAccounts';return db[_0x6fdd('0x2e')][_0x6fdd('0x2c')]({'where':{'type':_0x52052d,'resourceId':_0x1d6dd3['id']}})[_0x6fdd('0x1a')](function(){return _0x4ba3d2;});})[_0x6fdd('0x1a')](function(){_0x3abad6[_0x6fdd('0x24')](0xcc)[_0x6fdd('0x2f')]();});}};}function handleEntityNotFound(_0x423d8a,_0x49ca55){return function(_0x1bcba9){if(!_0x1bcba9){_0x423d8a[_0x6fdd('0x23')](0x194);}return _0x1bcba9;};}function handleError(_0x46f8c2,_0x6f74a0){_0x6f74a0=_0x6f74a0||0x1f4;return function(_0x200871){logger[_0x6fdd('0x20')](_0x200871['stack']);if(_0x200871['name']){delete _0x200871[_0x6fdd('0x30')];}_0x46f8c2[_0x6fdd('0x24')](_0x6f74a0)[_0x6fdd('0x31')](_0x200871);};}exports[_0x6fdd('0x32')]=function(_0x4c62b6,_0x3ff5f9){var _0x223c26={'include':[{'model':db['Pause'],'as':_0x6fdd('0x33')}]},_0x6f0d06={},_0x53c445={'count':0x0,'rows':[]};var _0x35789f=_['map'](db[_0x6fdd('0x34')]['rawAttributes'],function(_0x1d349d){return{'name':_0x1d349d[_0x6fdd('0x35')],'type':_0x1d349d['type'][_0x6fdd('0x36')]};});_0x6f0d06[_0x6fdd('0x37')]=_['map'](_0x35789f,_0x6fdd('0x30'));_0x6f0d06[_0x6fdd('0x38')]=_[_0x6fdd('0x39')](_0x4c62b6['query']);_0x6f0d06[_0x6fdd('0x3a')]=_[_0x6fdd('0x3b')](_0x6f0d06[_0x6fdd('0x37')],_0x6f0d06['query']);_0x223c26[_0x6fdd('0x3c')]=_[_0x6fdd('0x3b')](_0x6f0d06[_0x6fdd('0x37')],qs[_0x6fdd('0x3d')](_0x4c62b6[_0x6fdd('0x38')][_0x6fdd('0x3d')]));_0x223c26[_0x6fdd('0x3c')]=_0x223c26[_0x6fdd('0x3c')][_0x6fdd('0x3e')]?_0x223c26[_0x6fdd('0x3c')]:_0x6f0d06[_0x6fdd('0x37')];if(!_0x4c62b6[_0x6fdd('0x38')][_0x6fdd('0x3f')](_0x6fdd('0x40'))){_0x223c26['limit']=qs[_0x6fdd('0x28')](_0x4c62b6[_0x6fdd('0x38')][_0x6fdd('0x28')]);_0x223c26[_0x6fdd('0x26')]=qs['offset'](_0x4c62b6[_0x6fdd('0x38')]['offset']);}_0x223c26['order']=qs[_0x6fdd('0x41')](_0x4c62b6['query'][_0x6fdd('0x41')]);_0x223c26['where']=qs[_0x6fdd('0x3a')](_[_0x6fdd('0x42')](_0x4c62b6[_0x6fdd('0x38')],_0x6f0d06['filters']),_0x35789f);if(_0x4c62b6[_0x6fdd('0x38')][_0x6fdd('0x43')]){_0x223c26[_0x6fdd('0x44')]=_[_0x6fdd('0x45')](_0x223c26[_0x6fdd('0x44')],{'$or':_[_0x6fdd('0x46')](_0x35789f,function(_0x29147e){if(_0x29147e['type']!=='VIRTUAL'){var _0x2c384b={};_0x2c384b[_0x29147e[_0x6fdd('0x30')]]={'$like':'%'+_0x4c62b6['query'][_0x6fdd('0x43')]+'%'};return _0x2c384b;}})});}_0x223c26=_['merge']({},_0x223c26,_0x4c62b6[_0x6fdd('0x47')]);var _0x21f0ba={'where':_0x223c26['where']};return db[_0x6fdd('0x34')][_0x6fdd('0x48')](_0x21f0ba)[_0x6fdd('0x1a')](function(_0x17d443){_0x53c445['count']=_0x17d443;if(_0x4c62b6[_0x6fdd('0x38')][_0x6fdd('0x49')]){_0x223c26['include']=[{'all':!![]}];}return db[_0x6fdd('0x34')][_0x6fdd('0x4a')](_0x223c26);})['then'](function(_0x4dde2d){_0x53c445[_0x6fdd('0x4b')]=_0x4dde2d;return _0x53c445;})[_0x6fdd('0x1a')](respondWithFilteredResult(_0x3ff5f9,_0x223c26))[_0x6fdd('0x22')](handleError(_0x3ff5f9,null));};exports[_0x6fdd('0x4c')]=function(_0x445b62,_0x4c8964){var _0x13d589={'raw':![],'where':{'id':_0x445b62[_0x6fdd('0x4d')]['id']},'include':[{'model':db['Pause'],'as':_0x6fdd('0x33')}]},_0x5c984a={};_0x5c984a[_0x6fdd('0x37')]=_[_0x6fdd('0x39')](db[_0x6fdd('0x34')][_0x6fdd('0x4e')]);_0x5c984a[_0x6fdd('0x38')]=_['keys'](_0x445b62[_0x6fdd('0x38')]);_0x5c984a[_0x6fdd('0x3a')]=_[_0x6fdd('0x3b')](_0x5c984a[_0x6fdd('0x37')],_0x5c984a[_0x6fdd('0x38')]);_0x13d589[_0x6fdd('0x3c')]=_[_0x6fdd('0x3b')](_0x5c984a[_0x6fdd('0x37')],qs[_0x6fdd('0x3d')](_0x445b62[_0x6fdd('0x38')]['fields']));_0x13d589[_0x6fdd('0x3c')]=_0x13d589[_0x6fdd('0x3c')][_0x6fdd('0x3e')]?_0x13d589[_0x6fdd('0x3c')]:_0x5c984a[_0x6fdd('0x37')];if(_0x445b62[_0x6fdd('0x38')][_0x6fdd('0x49')]){_0x13d589[_0x6fdd('0x4f')]=[{'all':!![]}];}_0x13d589=_['merge']({},_0x13d589,_0x445b62[_0x6fdd('0x47')]);return db[_0x6fdd('0x34')][_0x6fdd('0x50')](_0x13d589)[_0x6fdd('0x1a')](handleEntityNotFound(_0x4c8964,null))['then'](respondWithResult(_0x4c8964,null))['catch'](handleError(_0x4c8964,null));};exports['create']=function(_0x4e6073,_0x319f1c){return db[_0x6fdd('0x34')][_0x6fdd('0x51')](_0x4e6073[_0x6fdd('0x52')],{})[_0x6fdd('0x1a')](function(_0x5b46f9){var _0x197183=_0x4e6073[_0x6fdd('0x53')][_0x6fdd('0x2d')]({'plain':!![]});if(!_0x197183)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x197183[_0x6fdd('0x54')]===_0x6fdd('0x53')){var _0xb4673c=_0x5b46f9[_0x6fdd('0x2d')]({'plain':!![]});var _0x5a528a=_0x6fdd('0x55');return db[_0x6fdd('0x56')][_0x6fdd('0x50')]({'where':{'name':_0x5a528a,'userProfileId':_0x197183[_0x6fdd('0x57')]},'raw':!![]})[_0x6fdd('0x1a')](function(_0x47dea1){if(_0x47dea1&&_0x47dea1[_0x6fdd('0x58')]===0x0){return db['UserProfileResource'][_0x6fdd('0x51')]({'name':_0xb4673c[_0x6fdd('0x30')],'resourceId':_0xb4673c['id'],'type':_0x47dea1[_0x6fdd('0x30')],'sectionId':_0x47dea1['id']},{})[_0x6fdd('0x1a')](function(){return _0x5b46f9;});}else{return _0x5b46f9;}})[_0x6fdd('0x22')](function(_0x5d0cf3){logger[_0x6fdd('0x20')](_0x6fdd('0x59'),_0x5d0cf3);throw _0x5d0cf3;});}return _0x5b46f9;})[_0x6fdd('0x1a')](respondWithResult(_0x319f1c,0xc9))[_0x6fdd('0x22')](handleError(_0x319f1c,null));};exports[_0x6fdd('0x5a')]=function(_0x379b0c,_0x542c4f){if(_0x379b0c[_0x6fdd('0x52')]['id']){delete _0x379b0c['body']['id'];}return db['OpenchannelAccount'][_0x6fdd('0x50')]({'where':{'id':_0x379b0c[_0x6fdd('0x4d')]['id']},'include':[{'model':db[_0x6fdd('0x5b')],'as':_0x6fdd('0x33')}]})[_0x6fdd('0x1a')](handleEntityNotFound(_0x542c4f,null))['then'](saveUpdates(_0x379b0c[_0x6fdd('0x52')],null))[_0x6fdd('0x1a')](respondWithResult(_0x542c4f,null))[_0x6fdd('0x22')](handleError(_0x542c4f,null));};exports[_0x6fdd('0x2c')]=function(_0x4057b4,_0x1a2a14){return db[_0x6fdd('0x34')][_0x6fdd('0x50')]({'where':{'id':_0x4057b4[_0x6fdd('0x4d')]['id']}})[_0x6fdd('0x1a')](handleEntityNotFound(_0x1a2a14,null))['then'](removeEntity(_0x1a2a14,null))['catch'](handleError(_0x1a2a14,null));};exports['describe']=function(_0x1db426,_0x5340f9){return db[_0x6fdd('0x34')][_0x6fdd('0x5c')]()['then'](respondWithResult(_0x5340f9,null))[_0x6fdd('0x22')](handleError(_0x5340f9,null));};exports[_0x6fdd('0x5d')]=function(_0x209b73,_0x4c0fe1,_0x18d717){if(_0x209b73['body']['id']){delete _0x209b73[_0x6fdd('0x52')]['id'];}return db[_0x6fdd('0x34')]['find']({'where':{'id':_0x209b73[_0x6fdd('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4c0fe1,null))['then'](function(_0x3c2f25){if(_0x3c2f25){_0x209b73[_0x6fdd('0x52')][_0x6fdd('0x5e')]=_0x3c2f25['id'];return db[_0x6fdd('0x5f')][_0x6fdd('0x51')](_0x209b73['body']);}})[_0x6fdd('0x1a')](respondWithResult(_0x4c0fe1,null))['catch'](handleError(_0x4c0fe1,null));};exports[_0x6fdd('0x60')]=function(_0x2c4e4e,_0x298733,_0x1f8dde){var _0x18c081={'raw':![],'where':{}};var _0x49af81={};var _0x577623={'count':0x0,'rows':[]};return db[_0x6fdd('0x34')][_0x6fdd('0x61')]({'where':{'id':_0x2c4e4e['params']['id']}})[_0x6fdd('0x1a')](handleEntityNotFound(_0x298733,null))[_0x6fdd('0x1a')](function(_0x37c05c){if(_0x37c05c){_0x49af81[_0x6fdd('0x37')]=_[_0x6fdd('0x39')](db[_0x6fdd('0x5f')]['rawAttributes']);_0x49af81['query']=_['keys'](_0x2c4e4e['query']);_0x49af81[_0x6fdd('0x3a')]=_[_0x6fdd('0x3b')](_0x49af81['model'],_0x49af81[_0x6fdd('0x38')]);_0x18c081[_0x6fdd('0x3c')]=_[_0x6fdd('0x3b')](_0x49af81['model'],qs[_0x6fdd('0x3d')](_0x2c4e4e[_0x6fdd('0x38')][_0x6fdd('0x3d')]));_0x18c081[_0x6fdd('0x3c')]=_0x18c081['attributes'][_0x6fdd('0x3e')]?_0x18c081[_0x6fdd('0x3c')]:_0x49af81[_0x6fdd('0x37')];if(!_0x2c4e4e['query']['hasOwnProperty'](_0x6fdd('0x40'))){_0x18c081['limit']=qs[_0x6fdd('0x28')](_0x2c4e4e['query'][_0x6fdd('0x28')]);_0x18c081['offset']=qs[_0x6fdd('0x26')](_0x2c4e4e[_0x6fdd('0x38')][_0x6fdd('0x26')]);}_0x18c081['order']=qs[_0x6fdd('0x41')](_0x2c4e4e[_0x6fdd('0x38')][_0x6fdd('0x41')]);_0x18c081['where']=qs[_0x6fdd('0x3a')](_['pick'](_0x2c4e4e[_0x6fdd('0x38')],_0x49af81[_0x6fdd('0x3a')]));_0x18c081['where'][_0x6fdd('0x5e')]=_0x37c05c['id'];if(_0x2c4e4e[_0x6fdd('0x38')]['filter']){_0x18c081[_0x6fdd('0x44')]=_[_0x6fdd('0x45')](_0x18c081[_0x6fdd('0x44')],{'$or':_[_0x6fdd('0x46')](_0x18c081['attributes'],function(_0x26b01b){var _0x726cd2={};_0x726cd2[_0x26b01b]={'$like':'%'+_0x2c4e4e[_0x6fdd('0x38')][_0x6fdd('0x43')]+'%'};return _0x726cd2;})});}_0x18c081=_['merge']({},_0x18c081,_0x2c4e4e['options']);return db['Disposition'][_0x6fdd('0x48')]({'where':_0x18c081[_0x6fdd('0x44')]})[_0x6fdd('0x1a')](function(_0x453290){_0x577623[_0x6fdd('0x48')]=_0x453290;if(_0x2c4e4e[_0x6fdd('0x38')][_0x6fdd('0x49')]){_0x18c081[_0x6fdd('0x4f')]=[{'all':!![]}];}return db[_0x6fdd('0x5f')][_0x6fdd('0x4a')](_0x18c081);})[_0x6fdd('0x1a')](function(_0x1b4335){_0x577623[_0x6fdd('0x4b')]=_0x1b4335;return _0x577623;});}})[_0x6fdd('0x1a')](respondWithFilteredResult(_0x298733,_0x18c081))[_0x6fdd('0x22')](handleError(_0x298733,null));};exports[_0x6fdd('0x62')]=function(_0x2de9dd,_0x21e76d,_0x5acc81){return db['OpenchannelAccount']['find']({'where':{'id':_0x2de9dd[_0x6fdd('0x4d')]['id']}})[_0x6fdd('0x1a')](handleEntityNotFound(_0x21e76d,null))['then'](function(_0x213cca){if(_0x213cca){return _0x213cca[_0x6fdd('0x62')](_0x2de9dd[_0x6fdd('0x38')][_0x6fdd('0x63')]);}})['then'](respondWithStatusCode(_0x21e76d,null))[_0x6fdd('0x22')](handleError(_0x21e76d,null));};exports['addAnswer']=function(_0x329ccd,_0x22ded2,_0x35be3d){if(_0x329ccd[_0x6fdd('0x52')]['id']){delete _0x329ccd[_0x6fdd('0x52')]['id'];}return db[_0x6fdd('0x34')][_0x6fdd('0x50')]({'where':{'id':_0x329ccd[_0x6fdd('0x4d')]['id']}})[_0x6fdd('0x1a')](handleEntityNotFound(_0x22ded2,null))[_0x6fdd('0x1a')](function(_0x5d82bb){if(_0x5d82bb){_0x329ccd[_0x6fdd('0x52')][_0x6fdd('0x5e')]=_0x5d82bb['id'];return db['CannedAnswer'][_0x6fdd('0x51')](_0x329ccd[_0x6fdd('0x52')]);}})[_0x6fdd('0x1a')](respondWithResult(_0x22ded2,null))['catch'](handleError(_0x22ded2,null));};exports[_0x6fdd('0x64')]=function(_0x46c36a,_0x2abed4,_0x558ea1){var _0x4ed4f1={'raw':![],'where':{}};var _0x3811c6={};var _0xc71e4b={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x46c36a[_0x6fdd('0x4d')]['id']}})[_0x6fdd('0x1a')](handleEntityNotFound(_0x2abed4,null))['then'](function(_0x3e7cc8){if(_0x3e7cc8){_0x3811c6[_0x6fdd('0x37')]=_['keys'](db[_0x6fdd('0x65')][_0x6fdd('0x4e')]);_0x3811c6['query']=_[_0x6fdd('0x39')](_0x46c36a[_0x6fdd('0x38')]);_0x3811c6[_0x6fdd('0x3a')]=_[_0x6fdd('0x3b')](_0x3811c6['model'],_0x3811c6['query']);_0x4ed4f1[_0x6fdd('0x3c')]=_[_0x6fdd('0x3b')](_0x3811c6['model'],qs[_0x6fdd('0x3d')](_0x46c36a[_0x6fdd('0x38')][_0x6fdd('0x3d')]));_0x4ed4f1['attributes']=_0x4ed4f1[_0x6fdd('0x3c')][_0x6fdd('0x3e')]?_0x4ed4f1[_0x6fdd('0x3c')]:_0x3811c6[_0x6fdd('0x37')];if(!_0x46c36a[_0x6fdd('0x38')]['hasOwnProperty'](_0x6fdd('0x40'))){_0x4ed4f1[_0x6fdd('0x28')]=qs['limit'](_0x46c36a[_0x6fdd('0x38')]['limit']);_0x4ed4f1[_0x6fdd('0x26')]=qs['offset'](_0x46c36a[_0x6fdd('0x38')]['offset']);}_0x4ed4f1[_0x6fdd('0x66')]=qs[_0x6fdd('0x41')](_0x46c36a['query'][_0x6fdd('0x41')]);_0x4ed4f1[_0x6fdd('0x44')]=qs[_0x6fdd('0x3a')](_['pick'](_0x46c36a[_0x6fdd('0x38')],_0x3811c6[_0x6fdd('0x3a')]));_0x4ed4f1[_0x6fdd('0x44')][_0x6fdd('0x5e')]=_0x3e7cc8['id'];if(_0x46c36a[_0x6fdd('0x38')][_0x6fdd('0x43')]){_0x4ed4f1[_0x6fdd('0x44')]=_['merge'](_0x4ed4f1[_0x6fdd('0x44')],{'$or':_['map'](_0x4ed4f1[_0x6fdd('0x3c')],function(_0x1dd7f9){var _0x43a7cb={};_0x43a7cb[_0x1dd7f9]={'$like':'%'+_0x46c36a['query'][_0x6fdd('0x43')]+'%'};return _0x43a7cb;})});}_0x4ed4f1=_['merge']({},_0x4ed4f1,_0x46c36a[_0x6fdd('0x47')]);return db[_0x6fdd('0x65')]['count']({'where':_0x4ed4f1[_0x6fdd('0x44')]})[_0x6fdd('0x1a')](function(_0x551dd0){_0xc71e4b[_0x6fdd('0x48')]=_0x551dd0;if(_0x46c36a['query'][_0x6fdd('0x49')]){_0x4ed4f1['include']=[{'all':!![]}];}return db[_0x6fdd('0x65')][_0x6fdd('0x4a')](_0x4ed4f1);})[_0x6fdd('0x1a')](function(_0x573787){_0xc71e4b[_0x6fdd('0x4b')]=_0x573787;return _0xc71e4b;});}})[_0x6fdd('0x1a')](respondWithFilteredResult(_0x2abed4,_0x4ed4f1))[_0x6fdd('0x22')](handleError(_0x2abed4,null));};exports['removeAnswers']=function(_0xb6fb29,_0x3ec574,_0x21c78c){return db[_0x6fdd('0x34')]['find']({'where':{'id':_0xb6fb29[_0x6fdd('0x4d')]['id']}})[_0x6fdd('0x1a')](handleEntityNotFound(_0x3ec574,null))['then'](function(_0x3ed875){if(_0x3ed875){return _0x3ed875['removeAnswers'](_0xb6fb29['query'][_0x6fdd('0x63')]);}})[_0x6fdd('0x1a')](respondWithStatusCode(_0x3ec574,null))['catch'](handleError(_0x3ec574,null));};exports[_0x6fdd('0x67')]=function(_0x5c12a2,_0x4ef9f3,_0x1692c5){var _0x4de1d7={'body':_0x5c12a2[_0x6fdd('0x52')],'channel':_0x6fdd('0x68')};var _0x3303b8=[];var _0x5db087=[];var _0x598a59={};var _0x391e67=![];return db[_0x6fdd('0x69')][_0x6fdd('0x5c')]()['then'](function(_0x23bde1){if(!_0x23bde1){throw new db[(_0x6fdd('0x6a'))][(_0x6fdd('0x6b'))](_0x6fdd('0x6c'));}_0x3303b8=_['difference'](_['keys'](_0x23bde1),[_0x6fdd('0x6d'),_0x6fdd('0x6e')]);_0x5db087=_[_0x6fdd('0x6f')](_[_0x6fdd('0x39')](_0x23bde1),['createdAt',_0x6fdd('0x6e'),'CompanyId',_0x6fdd('0x70')]);if(_0x5c12a2[_0x6fdd('0x52')]['id']){delete _0x5c12a2[_0x6fdd('0x52')]['id'];}if(_[_0x6fdd('0x71')](_0x5c12a2['body'][_0x6fdd('0x72')])){throw new db[(_0x6fdd('0x6a'))][(_0x6fdd('0x6b'))]('from\x20is\x20mandatory');}if(_[_0x6fdd('0x71')](_0x5c12a2['body'][_0x6fdd('0x52')])||_0x5c12a2[_0x6fdd('0x52')][_0x6fdd('0x52')]===''){throw new db[(_0x6fdd('0x6a'))]['ValidationError'](_0x6fdd('0x73'));}if(_[_0x6fdd('0x71')](_0x5c12a2[_0x6fdd('0x52')][_0x6fdd('0x74')])){throw new db[(_0x6fdd('0x6a'))][(_0x6fdd('0x6b'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5db087);}if(!_[_0x6fdd('0x75')](_0x5db087,_0x5c12a2[_0x6fdd('0x52')][_0x6fdd('0x74')])){throw new db[(_0x6fdd('0x6a'))][(_0x6fdd('0x6b'))](_0x6fdd('0x76')+_0x5db087);}_0x598a59[_0x5c12a2['body'][_0x6fdd('0x74')]]=_0x5c12a2[_0x6fdd('0x52')][_0x6fdd('0x72')];})[_0x6fdd('0x1a')](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x5c12a2[_0x6fdd('0x4d')]['id']},'include':[{'model':db['CmList'],'as':_0x6fdd('0x77'),'include':[{'model':db[_0x6fdd('0x69')],'as':_0x6fdd('0x78'),'where':_0x598a59,'limit':0x1,'order':[[_0x6fdd('0x6e'),_0x6fdd('0x79')]]}]},{'model':db[_0x6fdd('0x7a')],'as':_0x6fdd('0x7b')}]});})[_0x6fdd('0x1a')](handleEntityNotFound(_0x4ef9f3,null))['then'](function(_0x57e2bf){if(_0x57e2bf&&_0x57e2bf['List']){_0x4de1d7[_0x6fdd('0x7c')]=_0x57e2bf;_0x4de1d7[_0x6fdd('0x7d')]=_0x57e2bf[_0x6fdd('0x7b')];_0x4de1d7[_0x6fdd('0x7e')]=_0x57e2bf[_0x6fdd('0x77')];_0x4de1d7[_0x6fdd('0x7d')]=_['orderBy'](_0x4de1d7[_0x6fdd('0x7d')],['priority'],[_0x6fdd('0x7f')]);if(_0x4de1d7[_0x6fdd('0x7c')][_0x6fdd('0x7b')]){delete _0x4de1d7[_0x6fdd('0x7c')]['Applications'];}if(_0x4de1d7['account'][_0x6fdd('0x77')]&&_0x4de1d7['account']['List']['Contacts'][_0x6fdd('0x3e')]){return _0x4de1d7[_0x6fdd('0x7c')][_0x6fdd('0x77')][_0x6fdd('0x78')][0x0];}var _0x36dc4b=_[_0x6fdd('0x80')](_0x5c12a2['body'],{'firstName':_0x5c12a2['body']['from'],'ListId':_0x57e2bf[_0x6fdd('0x70')]});_0x36dc4b[_0x5c12a2[_0x6fdd('0x52')]['mapKey']]=_0x5c12a2[_0x6fdd('0x52')][_0x6fdd('0x72')];return db[_0x6fdd('0x69')][_0x6fdd('0x51')](_0x36dc4b,{'fields':_0x3303b8,'raw':!![]});}})[_0x6fdd('0x1a')](handleEntityNotFound(_0x4ef9f3,null))[_0x6fdd('0x1a')](function(_0x25c218){_0x4de1d7[_0x6fdd('0x81')]=_0x25c218;if(_0x25c218){var _0x4da1dc={'ContactId':_0x25c218['id'],'OpenchannelAccountId':_0x5c12a2[_0x6fdd('0x4d')]['id'],'from':(_0x25c218[_0x6fdd('0x82')]||'')+'\x20'+(_0x25c218[_0x6fdd('0x83')]||'')};var _0x38b1ff={'OpenchannelAccountId':_0x5c12a2['params']['id'],'closed':![]};if(_0x5c12a2[_0x6fdd('0x52')][_0x6fdd('0x84')]){_0x38b1ff[_0x6fdd('0x84')]=_0x5c12a2[_0x6fdd('0x52')][_0x6fdd('0x84')];return db['OpenchannelInteraction']['find']({'where':_0x38b1ff})[_0x6fdd('0x1a')](function(_0x28d49a){if(_0x28d49a){return[_0x28d49a,![]];}_0x4da1dc[_0x6fdd('0x84')]=_0x5c12a2[_0x6fdd('0x52')][_0x6fdd('0x84')];_0x4da1dc['externalUrl']=_0x5c12a2[_0x6fdd('0x52')][_0x6fdd('0x85')];return db[_0x6fdd('0x86')][_0x6fdd('0x51')](_0x4da1dc)[_0x6fdd('0x1a')](function(_0x1fc9c3){return[_0x1fc9c3,!![]];});});}else{_0x38b1ff[_0x6fdd('0x84')]=null;}_0x38b1ff[_0x6fdd('0x87')]=_0x25c218['id'];return db[_0x6fdd('0x86')][_0x6fdd('0x50')]({'where':_0x38b1ff})[_0x6fdd('0x1a')](function(_0x11b5d8){if(_0x11b5d8){return[_0x11b5d8,![]];}return db[_0x6fdd('0x86')]['create'](_0x4da1dc)['then'](function(_0x2bd459){return[_0x2bd459,!![]];});});}})[_0x6fdd('0x88')](function(_0x52d051,_0x285b2e){if(_0x52d051){_0x391e67=_0x285b2e;if(!_0x285b2e){var _0x386607={'from':(_0x4de1d7['contact'][_0x6fdd('0x82')]||'')+'\x20'+(_0x4de1d7[_0x6fdd('0x81')][_0x6fdd('0x83')]||'')};if(_0x5c12a2['body'][_0x6fdd('0x84')]&&_0x5c12a2[_0x6fdd('0x52')]['messageId']&&_0x5c12a2[_0x6fdd('0x52')]['threadId']!=_0x5c12a2[_0x6fdd('0x52')][_0x6fdd('0x89')]){_0x386607[_0x6fdd('0x84')]=_0x5c12a2[_0x6fdd('0x52')][_0x6fdd('0x89')];}return _0x52d051[_0x6fdd('0x5a')](_0x386607);}else{return _0x52d051;}}})[_0x6fdd('0x1a')](function(_0x3f5721){_0x4de1d7['interaction']=_0x3f5721[_0x6fdd('0x2d')]({'plain':!![]});_0x4de1d7[_0x6fdd('0x8a')][_0x6fdd('0x8b')]=_0x391e67;if(_0x4de1d7[_0x6fdd('0x8a')]['created']){if(_0x4de1d7['account'][_0x6fdd('0x8c')]){_0x4de1d7[_0x6fdd('0x7d')][_0x6fdd('0x8d')]({'id':0x0,'priority':_0x4de1d7[_0x6fdd('0x7d')]['length']+0x1,'app':'close','appdata':_0x6fdd('0x8e'),'interval':_0x6fdd('0x8f')});}}return db[_0x6fdd('0x90')]['create']({'body':_0x5c12a2[_0x6fdd('0x52')][_0x6fdd('0x52')],'OpenchannelAccountId':_0x5c12a2[_0x6fdd('0x4d')]['id'],'OpenchannelInteractionId':_0x3f5721['id'],'direction':'in','ContactId':_0x4de1d7['contact']['id'],'AttachmentId':_0x5c12a2[_0x6fdd('0x52')][_0x6fdd('0x91')]});})['then'](function(_0x59c586){_0x4de1d7[_0x6fdd('0x21')]=_0x59c586;if(_0x4de1d7[_0x6fdd('0x8a')][_0x6fdd('0x92')]){return db[_0x6fdd('0x93')][_0x6fdd('0x50')]({'attributes':['id',_0x6fdd('0x30')],'where':{'id':_0x4de1d7[_0x6fdd('0x8a')]['UserId']}})[_0x6fdd('0x1a')](function(_0x2239a8){if(_0x2239a8){_0x4de1d7[_0x6fdd('0x7d')][_0x6fdd('0x94')]({'id':0x0,'priority':0x0,'app':_0x6fdd('0x95'),'appdata':_0x2239a8[_0x6fdd('0x30')]+','+(_0x4de1d7['account'][_0x6fdd('0x96')]||0xa),'interval':'*,*,*,*'});_0x4de1d7[_0x6fdd('0x97')]=![];}return respondWithRpcPromise(_0x6fdd('0x98'),'startRouting',_0x4de1d7);});}return respondWithRpcPromise(_0x6fdd('0x98'),'startRouting',_0x4de1d7);})[_0x6fdd('0x1a')](function(_0xfad521){respondWithRpcPromise(_0x6fdd('0x99'),'EventManager',{'event':_0x6fdd('0x67'),'message':_0xfad521},client9002);return _0xfad521;})['then'](respondWithResult(_0x4ef9f3,null))[_0x6fdd('0x22')](handleError(_0x4ef9f3,null));};exports[_0x6fdd('0x9a')]=function(_0x2d2205,_0x487fae){var _0x529bc3=_0x2d2205[_0x6fdd('0x4d')]['id'];var _0x182e2d=_0x2d2205[_0x6fdd('0x52')];var _0x4fcf9e=0xc8;var _0x557c37=null;return db[_0x6fdd('0x9b')][_0x6fdd('0x9c')]({'isolationLevel':db[_0x6fdd('0x9b')][_0x6fdd('0x9d')][_0x6fdd('0x9e')][_0x6fdd('0x9f')]},function(_0xae250b){return db[_0x6fdd('0x34')][_0x6fdd('0x61')]({'where':{'id':_0x529bc3},'transaction':_0xae250b})[_0x6fdd('0x1a')](function(_0x410d3b){if(_0x410d3b){return db['OpenchannelApplication']['destroy']({'where':{'OpenchannelAccountId':_0x529bc3},'transaction':_0xae250b})[_0x6fdd('0x1a')](function(){var _0x22b01a=_[_0x6fdd('0x46')](_0x182e2d,function(_0x88d663){_0x88d663[_0x6fdd('0x5e')]=_0x529bc3;return _0x88d663;});return db['OpenchannelApplication']['bulkCreate'](_0x22b01a,{'transaction':_0xae250b});});}else{_0x4fcf9e=0x194;_0x557c37=[];}});})['then'](function(){if(_0x4fcf9e!==0x194){return db['OpenchannelApplication'][_0x6fdd('0xa0')]({'where':{'OpenchannelAccountId':_0x529bc3},'order':'priority'})[_0x6fdd('0x1a')](function(_0x1908ca){_0x557c37=_0x1908ca;});}})['catch'](function(_0x20c828){_0x4fcf9e=0x1f4;logger[_0x6fdd('0x20')](_0x20c828[_0x6fdd('0xa1')]);if(_0x20c828[_0x6fdd('0x30')]){delete _0x20c828[_0x6fdd('0x30')];}_0x557c37=_0x20c828;})[_0x6fdd('0xa2')](function(){if(_0x557c37===null){_0x487fae[_0x6fdd('0x23')](_0x4fcf9e);}else{if(_0x4fcf9e===0x1f4){_0x487fae[_0x6fdd('0x24')](_0x4fcf9e)[_0x6fdd('0x31')](_0x557c37);}else{_0x487fae[_0x6fdd('0x24')](_0x4fcf9e)[_0x6fdd('0x25')](_0x557c37);}}});};exports[_0x6fdd('0xa3')]=function(_0x1e35db,_0x286777,_0x36b0e7){var _0x489b0d={};var _0x4ea72d={};var _0x2eb02f;var _0xa89f95;return db[_0x6fdd('0x34')][_0x6fdd('0x61')]({'where':{'id':_0x1e35db[_0x6fdd('0x4d')]['id']}})[_0x6fdd('0x1a')](handleEntityNotFound(_0x286777,null))[_0x6fdd('0x1a')](function(_0x380989){if(_0x380989){_0x2eb02f=_0x380989;_0x4ea72d[_0x6fdd('0x37')]=_[_0x6fdd('0x39')](db[_0x6fdd('0x7a')][_0x6fdd('0x4e')]);_0x4ea72d[_0x6fdd('0x38')]=_[_0x6fdd('0x39')](_0x1e35db['query']);_0x4ea72d[_0x6fdd('0x3a')]=_[_0x6fdd('0x3b')](_0x4ea72d['model'],_0x4ea72d[_0x6fdd('0x38')]);_0x489b0d[_0x6fdd('0x3c')]=_['intersection'](_0x4ea72d[_0x6fdd('0x37')],qs[_0x6fdd('0x3d')](_0x1e35db[_0x6fdd('0x38')][_0x6fdd('0x3d')]));_0x489b0d['attributes']=_0x489b0d['attributes'][_0x6fdd('0x3e')]?_0x489b0d[_0x6fdd('0x3c')]:_0x4ea72d[_0x6fdd('0x37')];_0x489b0d[_0x6fdd('0x66')]=qs[_0x6fdd('0x41')](_0x1e35db['query'][_0x6fdd('0x41')]);_0x489b0d[_0x6fdd('0x44')]=qs[_0x6fdd('0x3a')](_[_0x6fdd('0x42')](_0x1e35db['query'],_0x4ea72d['filters']));if(_0x1e35db[_0x6fdd('0x38')][_0x6fdd('0x43')]){_0x489b0d[_0x6fdd('0x44')]=_[_0x6fdd('0x45')](_0x489b0d[_0x6fdd('0x44')],{'$or':_[_0x6fdd('0x46')](_0x489b0d[_0x6fdd('0x3c')],function(_0x426404){var _0x56e8cf={};_0x56e8cf[_0x426404]={'$like':'%'+_0x1e35db[_0x6fdd('0x38')][_0x6fdd('0x43')]+'%'};return _0x56e8cf;})});}_0x489b0d=_[_0x6fdd('0x45')]({},_0x489b0d,_0x1e35db[_0x6fdd('0x47')]);return _0x2eb02f[_0x6fdd('0xa3')](_0x489b0d);}})[_0x6fdd('0x1a')](function(_0x52dc5d){if(_0x52dc5d){_0xa89f95=_0x52dc5d[_0x6fdd('0x3e')];if(!_0x1e35db[_0x6fdd('0x38')][_0x6fdd('0x3f')](_0x6fdd('0x40'))){_0x489b0d[_0x6fdd('0x28')]=qs[_0x6fdd('0x28')](_0x1e35db['query'][_0x6fdd('0x28')]);_0x489b0d[_0x6fdd('0x26')]=qs[_0x6fdd('0x26')](_0x1e35db['query'][_0x6fdd('0x26')]);}return _0x2eb02f[_0x6fdd('0xa3')](_0x489b0d);}})[_0x6fdd('0x1a')](function(_0x32bbc7){if(_0x32bbc7){return _0x32bbc7?{'count':_0xa89f95,'rows':_0x32bbc7}:null;}})[_0x6fdd('0x1a')](respondWithResult(_0x286777,null))[_0x6fdd('0x22')](handleError(_0x286777,null));};exports[_0x6fdd('0xa4')]=function(_0x2f8e82,_0x5811a7,_0x2528da){var _0x27ecb5={'raw':![],'where':{}};var _0x354368={};var _0x26491c={'count':0x0,'rows':[]};return db[_0x6fdd('0x34')][_0x6fdd('0x61')]({'where':{'id':_0x2f8e82[_0x6fdd('0x4d')]['id']}})[_0x6fdd('0x1a')](handleEntityNotFound(_0x5811a7,null))['then'](function(_0x3eccf2){if(_0x3eccf2){_0x354368[_0x6fdd('0x37')]=_[_0x6fdd('0x39')](db[_0x6fdd('0x86')][_0x6fdd('0x4e')]);_0x354368['query']=_[_0x6fdd('0x39')](_0x2f8e82[_0x6fdd('0x38')]);_0x354368[_0x6fdd('0x3a')]=_[_0x6fdd('0x3b')](_0x354368[_0x6fdd('0x37')],_0x354368[_0x6fdd('0x38')]);_0x27ecb5[_0x6fdd('0x3c')]=_[_0x6fdd('0x3b')](_0x354368[_0x6fdd('0x37')],qs[_0x6fdd('0x3d')](_0x2f8e82[_0x6fdd('0x38')][_0x6fdd('0x3d')]));_0x27ecb5[_0x6fdd('0x3c')]=_0x27ecb5[_0x6fdd('0x3c')]['length']?_0x27ecb5[_0x6fdd('0x3c')]:_0x354368[_0x6fdd('0x37')];if(!_0x2f8e82[_0x6fdd('0x38')][_0x6fdd('0x3f')](_0x6fdd('0x40'))){_0x27ecb5['limit']=qs['limit'](_0x2f8e82[_0x6fdd('0x38')]['limit']);_0x27ecb5[_0x6fdd('0x26')]=qs[_0x6fdd('0x26')](_0x2f8e82[_0x6fdd('0x38')][_0x6fdd('0x26')]);}_0x27ecb5[_0x6fdd('0x66')]=qs['sort'](_0x2f8e82[_0x6fdd('0x38')]['sort']);_0x27ecb5[_0x6fdd('0x44')]=qs[_0x6fdd('0x3a')](_[_0x6fdd('0x42')](_0x2f8e82[_0x6fdd('0x38')],_0x354368[_0x6fdd('0x3a')]));_0x27ecb5[_0x6fdd('0x44')][_0x6fdd('0x5e')]=_0x3eccf2['id'];if(_0x2f8e82[_0x6fdd('0x38')][_0x6fdd('0x43')]){_0x27ecb5['where']=_[_0x6fdd('0x45')](_0x27ecb5[_0x6fdd('0x44')],{'$or':_[_0x6fdd('0x46')](_0x27ecb5[_0x6fdd('0x3c')],function(_0x35abb5){var _0x57ee85={};_0x57ee85[_0x35abb5]={'$like':'%'+_0x2f8e82[_0x6fdd('0x38')][_0x6fdd('0x43')]+'%'};return _0x57ee85;})});}_0x27ecb5=_[_0x6fdd('0x45')]({},_0x27ecb5,_0x2f8e82[_0x6fdd('0x47')]);return db[_0x6fdd('0x86')][_0x6fdd('0x48')]({'where':_0x27ecb5[_0x6fdd('0x44')]})[_0x6fdd('0x1a')](function(_0x5f2621){_0x26491c[_0x6fdd('0x48')]=_0x5f2621;if(_0x2f8e82[_0x6fdd('0x38')]['includeAll']){_0x27ecb5['include']=[{'model':db['CmContact'],'as':_0x6fdd('0xa5'),'required':![]},{'model':db['User'],'as':_0x6fdd('0xa6'),'attributes':[_0x6fdd('0x30'),'fullname',_0x6fdd('0xa7')],'required':![]},{'model':db[_0x6fdd('0xa8')],'as':_0x6fdd('0xa9'),'attributes':['id','name','color'],'where':_0x2f8e82[_0x6fdd('0x38')]['tag']?{'id':_0x2f8e82[_0x6fdd('0x38')]['tag']}:undefined,'required':_0x2f8e82[_0x6fdd('0x38')]['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0x6fdd('0x4a')](_0x27ecb5);})[_0x6fdd('0x1a')](function(_0x13c4ee){_0x26491c[_0x6fdd('0x4b')]=_0x13c4ee;return _0x26491c;});}})[_0x6fdd('0x1a')](respondWithFilteredResult(_0x5811a7,_0x27ecb5))[_0x6fdd('0x22')](handleError(_0x5811a7,null));};exports['addAgents']=function(_0x548ec0,_0x386bdb,_0x22be52){return db['OpenchannelAccount'][_0x6fdd('0x50')]({'where':{'id':_0x548ec0['params']['id']}})[_0x6fdd('0x1a')](handleEntityNotFound(_0x386bdb,null))[_0x6fdd('0x1a')](function(_0xb672df){if(_0xb672df){return _0xb672df['addAgents'](_0x548ec0[_0x6fdd('0x52')][_0x6fdd('0x63')],_[_0x6fdd('0xaa')](_0x548ec0['body'],['ids','id'])||{})[_0x6fdd('0x88')](function(_0x48db25){for(var _0x3f1c29=0x0;_0x3f1c29<_0x548ec0[_0x6fdd('0x52')][_0x6fdd('0x63')][_0x6fdd('0x3e')];_0x3f1c29+=0x1){socket[_0x6fdd('0xab')](_0x6fdd('0xac'),{'UserId':Number(_0x548ec0[_0x6fdd('0x52')][_0x6fdd('0x63')][_0x3f1c29]),'OpenchannelAccountId':Number(_0x548ec0[_0x6fdd('0x4d')]['id'])});}return _0x48db25;});}})[_0x6fdd('0x1a')](respondWithResult(_0x386bdb,null))[_0x6fdd('0x22')](handleError(_0x386bdb,null));};exports[_0x6fdd('0xad')]=function(_0x4379d4,_0x535ec1,_0x213787){return db['OpenchannelAccount']['find']({'where':{'id':_0x4379d4[_0x6fdd('0x4d')]['id']}})[_0x6fdd('0x1a')](handleEntityNotFound(_0x535ec1,null))[_0x6fdd('0x1a')](function(_0x450823){if(_0x450823){return _0x450823[_0x6fdd('0xad')](_0x4379d4[_0x6fdd('0x38')][_0x6fdd('0x63')])[_0x6fdd('0x1a')](function(){if(_[_0x6fdd('0xae')](_0x4379d4[_0x6fdd('0x38')][_0x6fdd('0x63')])){for(var _0x5e93fd=0x0;_0x5e93fd<_0x4379d4['query'][_0x6fdd('0x63')][_0x6fdd('0x3e')];_0x5e93fd+=0x1){socket[_0x6fdd('0xab')](_0x6fdd('0xaf'),{'UserId':Number(_0x4379d4[_0x6fdd('0x38')][_0x6fdd('0x63')][_0x5e93fd]),'OpenchannelAccountId':Number(_0x4379d4[_0x6fdd('0x4d')]['id'])});}}else{socket[_0x6fdd('0xab')]('userOpenchannelAccount:remove',{'UserId':Number(_0x4379d4['query'][_0x6fdd('0x63')]),'OpenchannelAccountId':Number(_0x4379d4['params']['id'])});}});}})['then'](respondWithStatusCode(_0x535ec1,null))['catch'](handleError(_0x535ec1,null));};exports[_0x6fdd('0xb0')]=function(_0x22edf1,_0xb94d4c,_0x45c3d4){var _0x42eb09={};var _0x280695={};var _0x10ff01;var _0x42b1c5;return db[_0x6fdd('0x34')][_0x6fdd('0x61')]({'where':{'id':_0x22edf1[_0x6fdd('0x4d')]['id']}})[_0x6fdd('0x1a')](handleEntityNotFound(_0xb94d4c,null))[_0x6fdd('0x1a')](function(_0x3ad937){if(_0x3ad937){_0x10ff01=_0x3ad937;_0x280695[_0x6fdd('0x37')]=_[_0x6fdd('0x39')](db['User']['rawAttributes']);_0x280695[_0x6fdd('0x38')]=_[_0x6fdd('0x39')](_0x22edf1[_0x6fdd('0x38')]);_0x280695['filters']=_[_0x6fdd('0x3b')](_0x280695[_0x6fdd('0x37')],_0x280695[_0x6fdd('0x38')]);_0x42eb09['attributes']=_[_0x6fdd('0x3b')](_0x280695[_0x6fdd('0x37')],qs['fields'](_0x22edf1[_0x6fdd('0x38')][_0x6fdd('0x3d')]));_0x42eb09[_0x6fdd('0x3c')]=_0x42eb09['attributes'][_0x6fdd('0x3e')]?_0x42eb09['attributes']:_0x280695['model'];_0x42eb09[_0x6fdd('0x66')]=qs['sort'](_0x22edf1[_0x6fdd('0x38')]['sort']);_0x42eb09[_0x6fdd('0x44')]=qs[_0x6fdd('0x3a')](_[_0x6fdd('0x42')](_0x22edf1['query'],_0x280695['filters']));if(_0x22edf1[_0x6fdd('0x38')][_0x6fdd('0x43')]){_0x42eb09[_0x6fdd('0x44')]=_[_0x6fdd('0x45')](_0x42eb09[_0x6fdd('0x44')],{'$or':_[_0x6fdd('0x46')](_0x42eb09[_0x6fdd('0x3c')],function(_0x5c20b0){var _0x5c9355={};_0x5c9355[_0x5c20b0]={'$like':'%'+_0x22edf1[_0x6fdd('0x38')]['filter']+'%'};return _0x5c9355;})});}_0x42eb09=_[_0x6fdd('0x45')]({},_0x42eb09,_0x22edf1['options']);return _0x10ff01[_0x6fdd('0xb0')](_0x42eb09);}})[_0x6fdd('0x1a')](function(_0x1ac296){if(_0x1ac296){_0x42b1c5=_0x1ac296[_0x6fdd('0x3e')];if(!_0x22edf1['query'][_0x6fdd('0x3f')](_0x6fdd('0x40'))){_0x42eb09[_0x6fdd('0x28')]=qs[_0x6fdd('0x28')](_0x22edf1[_0x6fdd('0x38')]['limit']);_0x42eb09[_0x6fdd('0x26')]=qs[_0x6fdd('0x26')](_0x22edf1[_0x6fdd('0x38')][_0x6fdd('0x26')]);}return _0x10ff01[_0x6fdd('0xb0')](_0x42eb09);}})[_0x6fdd('0x1a')](function(_0x151ee8){if(_0x151ee8){return _0x151ee8?{'count':_0x42b1c5,'rows':_0x151ee8}:null;}})[_0x6fdd('0x1a')](respondWithResult(_0xb94d4c,null))['catch'](handleError(_0xb94d4c,null));};exports['send']=function(_0x398543,_0x499569,_0x181615){var _0x264424,_0x1a24b8,_0x1002e2;if(_[_0x6fdd('0x71')](_0x398543['body']['body'])||_0x398543[_0x6fdd('0x52')][_0x6fdd('0x52')]===''){throw new db[(_0x6fdd('0x6a'))][(_0x6fdd('0x6b'))](_0x6fdd('0x73'));}if(_[_0x6fdd('0x71')](_0x398543[_0x6fdd('0x52')]['to'])){}_0x264424=_0x398543[_0x6fdd('0x52')]['to'];return db[_0x6fdd('0x34')][_0x6fdd('0x61')]({'where':{'id':_0x398543[_0x6fdd('0x4d')]['id']}})[_0x6fdd('0x1a')](handleEntityNotFound(_0x499569,null))[_0x6fdd('0x1a')](function(_0x485921){if(_0x485921){return db[_0x6fdd('0x34')]['find']({'where':{'id':_0x485921['id']},'include':[{'model':db[_0x6fdd('0xb1')],'as':'List','include':[{'model':db['CmContact'],'as':_0x6fdd('0x78'),'where':{[_0x485921[_0x6fdd('0x74')]]:_0x264424},'limit':0x1,'order':[[_0x6fdd('0x6e'),_0x6fdd('0x79')]]}]}]})[_0x6fdd('0x1a')](handleEntityNotFound(_0x499569,null))[_0x6fdd('0x1a')](function(_0x2321a2){if(_0x2321a2&&_0x2321a2[_0x6fdd('0x77')]){_0x1a24b8=_0x2321a2[_0x6fdd('0x2d')]({'plain':!![]});if(_0x1a24b8[_0x6fdd('0x77')]&&_0x1a24b8[_0x6fdd('0x77')]['Contacts'][_0x6fdd('0x3e')]){return _0x1a24b8[_0x6fdd('0x77')]['Contacts'][0x0];}return db[_0x6fdd('0x69')][_0x6fdd('0x51')](_[_0x6fdd('0x80')](_0x398543[_0x6fdd('0x52')],{'firstName':_0x264424,[_0x2321a2['mapKey']]:_0x264424,'phone':_0x264424,'ListId':_0x1a24b8[_0x6fdd('0x70')]}));}})[_0x6fdd('0x1a')](handleEntityNotFound(_0x499569,null))[_0x6fdd('0x1a')](function(_0x1d6266){if(_0x1d6266){_0x1002e2=_0x1d6266;return db[_0x6fdd('0x86')][_0x6fdd('0x50')]({'where':{'ContactId':_0x1002e2['id'],'closed':![],'OpenchannelAccountId':_0x1a24b8['id']}})[_0x6fdd('0x1a')](function(_0x622425){if(_0x622425){return[_0x622425,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x398543[_0x6fdd('0x53')]['id'],'ContactId':_0x1002e2['id'],'OpenchannelAccountId':_0x1a24b8['id'],'lastMsgDirection':_0x6fdd('0xb2'),'Messages':[_[_0x6fdd('0x45')](_0x398543[_0x6fdd('0x52')],{'read':![],'body':_0x398543['body'][_0x6fdd('0x52')],'OpenchannelAccountId':_0x1a24b8['id'],'UserId':_0x398543[_0x6fdd('0x53')]['id'],'ContactId':_0x1002e2['id']})]},{'include':[{'model':db[_0x6fdd('0x90')],'as':_0x6fdd('0xb3')}]})[_0x6fdd('0x1a')](function(_0x551934){return[_0x551934,!![]];});});}})[_0x6fdd('0x88')](function(_0x24bec8,_0x38ae34){if(_0x38ae34){return _0x24bec8;}return db['OpenchannelMessage']['create'](_[_0x6fdd('0x45')](_0x398543['body'],{'read':![],'body':_0x398543[_0x6fdd('0x52')][_0x6fdd('0x52')],'OpenchannelAccountId':_0x1a24b8['id'],'OpenchannelInteractionId':_0x24bec8['id'],'UserId':_0x398543['user']['id'],'ContactId':_0x1002e2['id']}))[_0x6fdd('0x1a')](function(_0x51a9a1){_0x24bec8[_0x6fdd('0xb4')]['Messages']=[];_0x24bec8[_0x6fdd('0xb4')][_0x6fdd('0xb3')][_0x6fdd('0x8d')](_0x51a9a1[_0x6fdd('0xb4')]);return _0x24bec8;});});}})[_0x6fdd('0x1a')](respondWithResult(_0x499569,null))[_0x6fdd('0x22')](handleError(_0x499569,null));}; \ No newline at end of file +var _0xa548=['stringify','error','code','message','result','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','update','then','get','OpenchannelAccounts','UserProfileResource','destroy','stack','name','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition','getDispositions','OpenchannelAccountId','removeDispositions','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','ids','notify','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','from','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','List','OpenchannelApplication','Applications','account','applications','orderBy','priority','asc','Contacts','firstName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','contact','messageId','interaction','created','autoclose','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','addApplications','transaction','sequelize','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','finally','send','getApplications','getInteractions','Owner','fullname','Tag','Tags','color','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','getAgents','CmList','DESC','Messages','dataValues','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','client','http','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa548,0x9a));var _0x8a54=function(_0x384a1e,_0x164935){_0x384a1e=_0x384a1e-0x0;var _0x5308fa=_0xa548[_0x384a1e];return _0x5308fa;};'use strict';var emlformat=require(_0x8a54('0x0'));var rimraf=require(_0x8a54('0x1'));var zipdir=require(_0x8a54('0x2'));var jsonpatch=require(_0x8a54('0x3'));var rp=require(_0x8a54('0x4'));var moment=require(_0x8a54('0x5'));var BPromise=require(_0x8a54('0x6'));var Mustache=require(_0x8a54('0x7'));var util=require(_0x8a54('0x8'));var path=require(_0x8a54('0x9'));var sox=require('sox');var csv=require(_0x8a54('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8a54('0xb'));var _=require(_0x8a54('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8a54('0xa'));var querystring=require(_0x8a54('0xd'));var Papa=require(_0x8a54('0xe'));var Redis=require('ioredis');var authService=require(_0x8a54('0xf'));var qs=require(_0x8a54('0x10'));var as=require(_0x8a54('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8a54('0x12'));var utils=require('../../config/utils');var config=require(_0x8a54('0x13'));var licenseUtil=require(_0x8a54('0x14'));var db=require(_0x8a54('0x15'))['db'];config[_0x8a54('0x16')]=_[_0x8a54('0x17')](config[_0x8a54('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x8a54('0x18'))(new Redis(config[_0x8a54('0x16')]));require(_0x8a54('0x19'))[_0x8a54('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x8a54('0x1b')][_0x8a54('0x1c')]({'port':0x232c});var client9002=jayson[_0x8a54('0x1b')][_0x8a54('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5759d1,_0x244a1e,_0x509734,_0x2e3d54){return new BPromise(function(_0x17777c,_0x4fb432){var _0x43bc66=_0x2e3d54||client;return _0x43bc66[_0x8a54('0x1d')](_0x5759d1,_0x509734)['then'](function(_0x225197){logger[_0x8a54('0x1e')](_0x8a54('0x1f'),_0x244a1e,_0x8a54('0x20'));logger[_0x8a54('0x21')](_0x8a54('0x22'),_0x244a1e,_0x8a54('0x20'),JSON[_0x8a54('0x23')](_0x225197));if(_0x225197[_0x8a54('0x24')]){if(_0x225197[_0x8a54('0x24')][_0x8a54('0x25')]===0x1f4){logger[_0x8a54('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x244a1e,_0x225197[_0x8a54('0x24')][_0x8a54('0x26')]);return _0x4fb432(_0x225197[_0x8a54('0x24')][_0x8a54('0x26')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x244a1e,_0x225197[_0x8a54('0x24')]['message']);return _0x17777c(_0x225197[_0x8a54('0x24')]['message']);}else{logger[_0x8a54('0x1e')]('OpenchannelAccount,\x20%s,\x20%s',_0x244a1e,_0x8a54('0x20'));_0x17777c(_0x225197[_0x8a54('0x27')]['message']);}})[_0x8a54('0x28')](function(_0x3c0b08){logger['error'](_0x8a54('0x1f'),_0x244a1e,_0x3c0b08);_0x4fb432(_0x3c0b08);});});}function respondWithStatusCode(_0x113f0b,_0xcc0eae){_0xcc0eae=_0xcc0eae||0xcc;return function(_0x4897c6){if(_0x4897c6){return _0x113f0b[_0x8a54('0x29')](_0xcc0eae);}return _0x113f0b['status'](_0xcc0eae)[_0x8a54('0x2a')]();};}function respondWithResult(_0x588852,_0x5349b3){_0x5349b3=_0x5349b3||0xc8;return function(_0x5bd02e){if(_0x5bd02e){return _0x588852['status'](_0x5349b3)[_0x8a54('0x2b')](_0x5bd02e);}};}function respondWithFilteredResult(_0x2ee74d,_0xbf4630){return function(_0x57f2e2){if(_0x57f2e2){var _0x465edc=typeof _0xbf4630[_0x8a54('0x2c')]===_0x8a54('0x2d')&&typeof _0xbf4630[_0x8a54('0x2e')]===_0x8a54('0x2d');var _0x16f8f7=_0x57f2e2[_0x8a54('0x2f')];var _0x1f6834=_0x465edc?0x0:_0xbf4630[_0x8a54('0x2c')];var _0x201265=_0x465edc?_0x57f2e2[_0x8a54('0x2f')]:_0xbf4630['offset']+_0xbf4630[_0x8a54('0x2e')];var _0x2e0d9b;if(_0x201265>=_0x16f8f7){_0x201265=_0x16f8f7;_0x2e0d9b=0xc8;}else{_0x2e0d9b=0xce;}_0x2ee74d[_0x8a54('0x30')](_0x2e0d9b);return _0x2ee74d[_0x8a54('0x31')](_0x8a54('0x32'),_0x1f6834+'-'+_0x201265+'/'+_0x16f8f7)[_0x8a54('0x2b')](_0x57f2e2);}return null;};}function patchUpdates(_0x49d01b){return function(_0x3f42ba){try{jsonpatch[_0x8a54('0x33')](_0x3f42ba,_0x49d01b,!![]);}catch(_0x3a0e16){return BPromise['reject'](_0x3a0e16);}return _0x3f42ba['save']();};}function saveUpdates(_0x3e75c8,_0x131f34){return function(_0x2f04a8){if(_0x2f04a8){return _0x2f04a8[_0x8a54('0x34')](_0x3e75c8)['then'](function(_0xdcbd17){return _0xdcbd17;});}return null;};}function removeEntity(_0x3fe922,_0x61df9e){return function(_0x46844a){if(_0x46844a){return _0x46844a['destroy']()[_0x8a54('0x35')](function(){var _0x9117e9=_0x46844a[_0x8a54('0x36')]({'plain':!![]});var _0x3fb427=_0x8a54('0x37');return db[_0x8a54('0x38')][_0x8a54('0x39')]({'where':{'type':_0x3fb427,'resourceId':_0x9117e9['id']}})[_0x8a54('0x35')](function(){return _0x46844a;});})['then'](function(){_0x3fe922[_0x8a54('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x118dd3,_0x43cef6){return function(_0x28b046){if(!_0x28b046){_0x118dd3[_0x8a54('0x29')](0x194);}return _0x28b046;};}function handleError(_0x5b61b1,_0x5491c6){_0x5491c6=_0x5491c6||0x1f4;return function(_0x554ca8){logger[_0x8a54('0x24')](_0x554ca8[_0x8a54('0x3a')]);if(_0x554ca8[_0x8a54('0x3b')]){delete _0x554ca8[_0x8a54('0x3b')];}_0x5b61b1[_0x8a54('0x30')](_0x5491c6)['send'](_0x554ca8);};}exports[_0x8a54('0x3c')]=function(_0xddc5c6,_0x2a9fc5){var _0x2c9683={'include':[{'model':db[_0x8a54('0x3d')],'as':_0x8a54('0x3e')}]},_0x345594={},_0x216262={'count':0x0,'rows':[]};var _0xafd49=_[_0x8a54('0x3f')](db[_0x8a54('0x40')][_0x8a54('0x41')],function(_0x2c97d8){return{'name':_0x2c97d8['fieldName'],'type':_0x2c97d8['type'][_0x8a54('0x42')]};});_0x345594[_0x8a54('0x43')]=_[_0x8a54('0x3f')](_0xafd49,'name');_0x345594['query']=_[_0x8a54('0x44')](_0xddc5c6[_0x8a54('0x45')]);_0x345594[_0x8a54('0x46')]=_[_0x8a54('0x47')](_0x345594['model'],_0x345594['query']);_0x2c9683[_0x8a54('0x48')]=_[_0x8a54('0x47')](_0x345594[_0x8a54('0x43')],qs[_0x8a54('0x49')](_0xddc5c6[_0x8a54('0x45')]['fields']));_0x2c9683[_0x8a54('0x48')]=_0x2c9683[_0x8a54('0x48')]['length']?_0x2c9683[_0x8a54('0x48')]:_0x345594['model'];if(!_0xddc5c6[_0x8a54('0x45')][_0x8a54('0x4a')](_0x8a54('0x4b'))){_0x2c9683[_0x8a54('0x2e')]=qs['limit'](_0xddc5c6[_0x8a54('0x45')]['limit']);_0x2c9683[_0x8a54('0x2c')]=qs[_0x8a54('0x2c')](_0xddc5c6['query'][_0x8a54('0x2c')]);}_0x2c9683[_0x8a54('0x4c')]=qs['sort'](_0xddc5c6['query'][_0x8a54('0x4d')]);_0x2c9683['where']=qs['filters'](_[_0x8a54('0x4e')](_0xddc5c6['query'],_0x345594[_0x8a54('0x46')]),_0xafd49);if(_0xddc5c6[_0x8a54('0x45')][_0x8a54('0x4f')]){_0x2c9683[_0x8a54('0x50')]=_[_0x8a54('0x51')](_0x2c9683[_0x8a54('0x50')],{'$or':_[_0x8a54('0x3f')](_0xafd49,function(_0x376341){if(_0x376341[_0x8a54('0x52')]!==_0x8a54('0x53')){var _0x5c22df={};_0x5c22df[_0x376341[_0x8a54('0x3b')]]={'$like':'%'+_0xddc5c6[_0x8a54('0x45')]['filter']+'%'};return _0x5c22df;}})});}_0x2c9683=_['merge']({},_0x2c9683,_0xddc5c6[_0x8a54('0x54')]);var _0x369131={'where':_0x2c9683[_0x8a54('0x50')]};return db[_0x8a54('0x40')]['count'](_0x369131)['then'](function(_0x844ed1){_0x216262['count']=_0x844ed1;if(_0xddc5c6[_0x8a54('0x45')][_0x8a54('0x55')]){_0x2c9683[_0x8a54('0x56')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x8a54('0x57')](_0x2c9683);})[_0x8a54('0x35')](function(_0x54284e){_0x216262[_0x8a54('0x58')]=_0x54284e;return _0x216262;})[_0x8a54('0x35')](respondWithFilteredResult(_0x2a9fc5,_0x2c9683))[_0x8a54('0x28')](handleError(_0x2a9fc5,null));};exports['show']=function(_0x687383,_0x5d4c99){var _0x4136c6={'raw':![],'where':{'id':_0x687383[_0x8a54('0x59')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x6608c4={};_0x6608c4[_0x8a54('0x43')]=_[_0x8a54('0x44')](db[_0x8a54('0x40')][_0x8a54('0x41')]);_0x6608c4[_0x8a54('0x45')]=_['keys'](_0x687383[_0x8a54('0x45')]);_0x6608c4[_0x8a54('0x46')]=_[_0x8a54('0x47')](_0x6608c4[_0x8a54('0x43')],_0x6608c4['query']);_0x4136c6['attributes']=_[_0x8a54('0x47')](_0x6608c4['model'],qs[_0x8a54('0x49')](_0x687383[_0x8a54('0x45')]['fields']));_0x4136c6[_0x8a54('0x48')]=_0x4136c6['attributes'][_0x8a54('0x5a')]?_0x4136c6['attributes']:_0x6608c4[_0x8a54('0x43')];if(_0x687383['query'][_0x8a54('0x55')]){_0x4136c6[_0x8a54('0x56')]=[{'all':!![]}];}_0x4136c6=_[_0x8a54('0x51')]({},_0x4136c6,_0x687383[_0x8a54('0x54')]);return db[_0x8a54('0x40')][_0x8a54('0x5b')](_0x4136c6)[_0x8a54('0x35')](handleEntityNotFound(_0x5d4c99,null))[_0x8a54('0x35')](respondWithResult(_0x5d4c99,null))[_0x8a54('0x28')](handleError(_0x5d4c99,null));};exports[_0x8a54('0x5c')]=function(_0x2738c1,_0x35a2c7){return db[_0x8a54('0x40')][_0x8a54('0x5c')](_0x2738c1['body'],{})[_0x8a54('0x35')](function(_0x126360){var _0x157d2c=_0x2738c1[_0x8a54('0x5d')][_0x8a54('0x36')]({'plain':!![]});if(!_0x157d2c)throw new Error(_0x8a54('0x5e'));if(_0x157d2c[_0x8a54('0x5f')]==='user'){var _0x3ea902=_0x126360[_0x8a54('0x36')]({'plain':!![]});var _0x2dcd67=_0x8a54('0x37');return db[_0x8a54('0x60')]['find']({'where':{'name':_0x2dcd67,'userProfileId':_0x157d2c[_0x8a54('0x61')]},'raw':!![]})[_0x8a54('0x35')](function(_0x205b09){if(_0x205b09&&_0x205b09['autoAssociation']===0x0){return db[_0x8a54('0x38')]['create']({'name':_0x3ea902[_0x8a54('0x3b')],'resourceId':_0x3ea902['id'],'type':_0x205b09[_0x8a54('0x3b')],'sectionId':_0x205b09['id']},{})['then'](function(){return _0x126360;});}else{return _0x126360;}})[_0x8a54('0x28')](function(_0x194002){logger[_0x8a54('0x24')](_0x8a54('0x62'),_0x194002);throw _0x194002;});}return _0x126360;})[_0x8a54('0x35')](respondWithResult(_0x35a2c7,0xc9))[_0x8a54('0x28')](handleError(_0x35a2c7,null));};exports[_0x8a54('0x34')]=function(_0x561641,_0x2a1816){if(_0x561641[_0x8a54('0x63')]['id']){delete _0x561641[_0x8a54('0x63')]['id'];}return db[_0x8a54('0x40')][_0x8a54('0x5b')]({'where':{'id':_0x561641[_0x8a54('0x59')]['id']},'include':[{'model':db[_0x8a54('0x3d')],'as':_0x8a54('0x3e')}]})[_0x8a54('0x35')](handleEntityNotFound(_0x2a1816,null))[_0x8a54('0x35')](saveUpdates(_0x561641[_0x8a54('0x63')],null))[_0x8a54('0x35')](respondWithResult(_0x2a1816,null))[_0x8a54('0x28')](handleError(_0x2a1816,null));};exports[_0x8a54('0x39')]=function(_0x556188,_0x4df1cf){return db[_0x8a54('0x40')]['find']({'where':{'id':_0x556188[_0x8a54('0x59')]['id']}})['then'](handleEntityNotFound(_0x4df1cf,null))['then'](removeEntity(_0x4df1cf,null))[_0x8a54('0x28')](handleError(_0x4df1cf,null));};exports[_0x8a54('0x64')]=function(_0x49ef8e,_0xb1532f){return db['OpenchannelAccount']['describe']()['then'](respondWithResult(_0xb1532f,null))[_0x8a54('0x28')](handleError(_0xb1532f,null));};exports[_0x8a54('0x65')]=function(_0x10d695,_0x2e012d,_0x5e667c){if(_0x10d695['body']['id']){delete _0x10d695[_0x8a54('0x63')]['id'];}return db[_0x8a54('0x40')][_0x8a54('0x5b')]({'where':{'id':_0x10d695[_0x8a54('0x59')]['id']}})[_0x8a54('0x35')](handleEntityNotFound(_0x2e012d,null))['then'](function(_0x203d7f){if(_0x203d7f){_0x10d695[_0x8a54('0x63')]['OpenchannelAccountId']=_0x203d7f['id'];return db[_0x8a54('0x66')][_0x8a54('0x5c')](_0x10d695[_0x8a54('0x63')]);}})[_0x8a54('0x35')](respondWithResult(_0x2e012d,null))[_0x8a54('0x28')](handleError(_0x2e012d,null));};exports[_0x8a54('0x67')]=function(_0x28445a,_0x2c3c97,_0x5d0376){var _0x3e0ed0={'raw':![],'where':{}};var _0x31debe={};var _0x88945={'count':0x0,'rows':[]};return db[_0x8a54('0x40')]['findOne']({'where':{'id':_0x28445a['params']['id']}})['then'](handleEntityNotFound(_0x2c3c97,null))[_0x8a54('0x35')](function(_0x79f49a){if(_0x79f49a){_0x31debe[_0x8a54('0x43')]=_[_0x8a54('0x44')](db[_0x8a54('0x66')]['rawAttributes']);_0x31debe[_0x8a54('0x45')]=_['keys'](_0x28445a['query']);_0x31debe[_0x8a54('0x46')]=_[_0x8a54('0x47')](_0x31debe[_0x8a54('0x43')],_0x31debe[_0x8a54('0x45')]);_0x3e0ed0[_0x8a54('0x48')]=_[_0x8a54('0x47')](_0x31debe['model'],qs[_0x8a54('0x49')](_0x28445a[_0x8a54('0x45')]['fields']));_0x3e0ed0[_0x8a54('0x48')]=_0x3e0ed0[_0x8a54('0x48')][_0x8a54('0x5a')]?_0x3e0ed0['attributes']:_0x31debe[_0x8a54('0x43')];if(!_0x28445a[_0x8a54('0x45')][_0x8a54('0x4a')](_0x8a54('0x4b'))){_0x3e0ed0['limit']=qs['limit'](_0x28445a[_0x8a54('0x45')][_0x8a54('0x2e')]);_0x3e0ed0['offset']=qs[_0x8a54('0x2c')](_0x28445a[_0x8a54('0x45')][_0x8a54('0x2c')]);}_0x3e0ed0[_0x8a54('0x4c')]=qs['sort'](_0x28445a[_0x8a54('0x45')][_0x8a54('0x4d')]);_0x3e0ed0[_0x8a54('0x50')]=qs[_0x8a54('0x46')](_[_0x8a54('0x4e')](_0x28445a[_0x8a54('0x45')],_0x31debe['filters']));_0x3e0ed0[_0x8a54('0x50')][_0x8a54('0x68')]=_0x79f49a['id'];if(_0x28445a['query'][_0x8a54('0x4f')]){_0x3e0ed0[_0x8a54('0x50')]=_[_0x8a54('0x51')](_0x3e0ed0[_0x8a54('0x50')],{'$or':_[_0x8a54('0x3f')](_0x3e0ed0['attributes'],function(_0x9a74aa){var _0x5c39fd={};_0x5c39fd[_0x9a74aa]={'$like':'%'+_0x28445a[_0x8a54('0x45')]['filter']+'%'};return _0x5c39fd;})});}_0x3e0ed0=_[_0x8a54('0x51')]({},_0x3e0ed0,_0x28445a[_0x8a54('0x54')]);return db[_0x8a54('0x66')][_0x8a54('0x2f')]({'where':_0x3e0ed0[_0x8a54('0x50')]})[_0x8a54('0x35')](function(_0x24ea5b){_0x88945[_0x8a54('0x2f')]=_0x24ea5b;if(_0x28445a[_0x8a54('0x45')][_0x8a54('0x55')]){_0x3e0ed0['include']=[{'all':!![]}];}return db[_0x8a54('0x66')][_0x8a54('0x57')](_0x3e0ed0);})[_0x8a54('0x35')](function(_0x5c3bcf){_0x88945[_0x8a54('0x58')]=_0x5c3bcf;return _0x88945;});}})[_0x8a54('0x35')](respondWithFilteredResult(_0x2c3c97,_0x3e0ed0))[_0x8a54('0x28')](handleError(_0x2c3c97,null));};exports[_0x8a54('0x69')]=function(_0x286afb,_0xb2f76a,_0x2154d0){return db['OpenchannelAccount'][_0x8a54('0x5b')]({'where':{'id':_0x286afb[_0x8a54('0x59')]['id']}})[_0x8a54('0x35')](handleEntityNotFound(_0xb2f76a,null))[_0x8a54('0x35')](function(_0xdfd263){if(_0xdfd263){return _0xdfd263[_0x8a54('0x69')](_0x286afb[_0x8a54('0x45')]['ids']);}})[_0x8a54('0x35')](respondWithStatusCode(_0xb2f76a,null))[_0x8a54('0x28')](handleError(_0xb2f76a,null));};exports[_0x8a54('0x6a')]=function(_0x2b4b3d,_0x1a9cca,_0x31c5ea){if(_0x2b4b3d[_0x8a54('0x63')]['id']){delete _0x2b4b3d[_0x8a54('0x63')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x2b4b3d[_0x8a54('0x59')]['id']}})[_0x8a54('0x35')](handleEntityNotFound(_0x1a9cca,null))[_0x8a54('0x35')](function(_0x470811){if(_0x470811){_0x2b4b3d['body']['OpenchannelAccountId']=_0x470811['id'];return db['CannedAnswer'][_0x8a54('0x5c')](_0x2b4b3d[_0x8a54('0x63')]);}})[_0x8a54('0x35')](respondWithResult(_0x1a9cca,null))['catch'](handleError(_0x1a9cca,null));};exports[_0x8a54('0x6b')]=function(_0x31f011,_0x4a32b7,_0x2d0587){var _0x5dcea5={'raw':![],'where':{}};var _0x30cf76={};var _0x18459f={'count':0x0,'rows':[]};return db[_0x8a54('0x40')][_0x8a54('0x6c')]({'where':{'id':_0x31f011[_0x8a54('0x59')]['id']}})[_0x8a54('0x35')](handleEntityNotFound(_0x4a32b7,null))[_0x8a54('0x35')](function(_0xd6cb10){if(_0xd6cb10){_0x30cf76[_0x8a54('0x43')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0x30cf76[_0x8a54('0x45')]=_[_0x8a54('0x44')](_0x31f011['query']);_0x30cf76['filters']=_[_0x8a54('0x47')](_0x30cf76[_0x8a54('0x43')],_0x30cf76[_0x8a54('0x45')]);_0x5dcea5[_0x8a54('0x48')]=_[_0x8a54('0x47')](_0x30cf76['model'],qs[_0x8a54('0x49')](_0x31f011[_0x8a54('0x45')]['fields']));_0x5dcea5[_0x8a54('0x48')]=_0x5dcea5[_0x8a54('0x48')]['length']?_0x5dcea5[_0x8a54('0x48')]:_0x30cf76[_0x8a54('0x43')];if(!_0x31f011[_0x8a54('0x45')][_0x8a54('0x4a')](_0x8a54('0x4b'))){_0x5dcea5[_0x8a54('0x2e')]=qs[_0x8a54('0x2e')](_0x31f011[_0x8a54('0x45')][_0x8a54('0x2e')]);_0x5dcea5[_0x8a54('0x2c')]=qs[_0x8a54('0x2c')](_0x31f011['query']['offset']);}_0x5dcea5[_0x8a54('0x4c')]=qs[_0x8a54('0x4d')](_0x31f011[_0x8a54('0x45')]['sort']);_0x5dcea5[_0x8a54('0x50')]=qs['filters'](_[_0x8a54('0x4e')](_0x31f011[_0x8a54('0x45')],_0x30cf76['filters']));_0x5dcea5[_0x8a54('0x50')]['OpenchannelAccountId']=_0xd6cb10['id'];if(_0x31f011[_0x8a54('0x45')][_0x8a54('0x4f')]){_0x5dcea5[_0x8a54('0x50')]=_['merge'](_0x5dcea5[_0x8a54('0x50')],{'$or':_[_0x8a54('0x3f')](_0x5dcea5[_0x8a54('0x48')],function(_0x79e0d4){var _0x2a75ad={};_0x2a75ad[_0x79e0d4]={'$like':'%'+_0x31f011[_0x8a54('0x45')][_0x8a54('0x4f')]+'%'};return _0x2a75ad;})});}_0x5dcea5=_[_0x8a54('0x51')]({},_0x5dcea5,_0x31f011[_0x8a54('0x54')]);return db['CannedAnswer'][_0x8a54('0x2f')]({'where':_0x5dcea5[_0x8a54('0x50')]})[_0x8a54('0x35')](function(_0x250e8f){_0x18459f[_0x8a54('0x2f')]=_0x250e8f;if(_0x31f011[_0x8a54('0x45')][_0x8a54('0x55')]){_0x5dcea5[_0x8a54('0x56')]=[{'all':!![]}];}return db[_0x8a54('0x6d')][_0x8a54('0x57')](_0x5dcea5);})[_0x8a54('0x35')](function(_0x276f0a){_0x18459f[_0x8a54('0x58')]=_0x276f0a;return _0x18459f;});}})[_0x8a54('0x35')](respondWithFilteredResult(_0x4a32b7,_0x5dcea5))[_0x8a54('0x28')](handleError(_0x4a32b7,null));};exports[_0x8a54('0x6e')]=function(_0x5713ae,_0x2b09c2,_0x1b2cb5){return db['OpenchannelAccount'][_0x8a54('0x5b')]({'where':{'id':_0x5713ae['params']['id']}})[_0x8a54('0x35')](handleEntityNotFound(_0x2b09c2,null))[_0x8a54('0x35')](function(_0x164d3c){if(_0x164d3c){return _0x164d3c[_0x8a54('0x6e')](_0x5713ae[_0x8a54('0x45')][_0x8a54('0x6f')]);}})['then'](respondWithStatusCode(_0x2b09c2,null))['catch'](handleError(_0x2b09c2,null));};exports[_0x8a54('0x70')]=function(_0x1541ae,_0xb11fda,_0xe10824){var _0x1e405d={'body':_0x1541ae[_0x8a54('0x63')],'channel':'openchannel'};var _0x104105=[];var _0x588a7e=[];var _0x3198ab={};var _0x2f81b6=![];return db[_0x8a54('0x71')][_0x8a54('0x64')]()['then'](function(_0x29c02e){if(!_0x29c02e){throw new db[(_0x8a54('0x72'))][(_0x8a54('0x73'))](_0x8a54('0x74'));}_0x104105=_[_0x8a54('0x75')](_[_0x8a54('0x44')](_0x29c02e),[_0x8a54('0x76'),'updatedAt']);_0x588a7e=_[_0x8a54('0x75')](_['keys'](_0x29c02e),[_0x8a54('0x76'),_0x8a54('0x77'),'CompanyId',_0x8a54('0x78')]);if(_0x1541ae[_0x8a54('0x63')]['id']){delete _0x1541ae[_0x8a54('0x63')]['id'];}if(_['isNil'](_0x1541ae['body'][_0x8a54('0x79')])){throw new db[(_0x8a54('0x72'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x8a54('0x7a')](_0x1541ae[_0x8a54('0x63')][_0x8a54('0x63')])||_0x1541ae[_0x8a54('0x63')][_0x8a54('0x63')]===''){throw new db[(_0x8a54('0x72'))][(_0x8a54('0x73'))](_0x8a54('0x7b'));}if(_[_0x8a54('0x7a')](_0x1541ae[_0x8a54('0x63')][_0x8a54('0x7c')])){throw new db[(_0x8a54('0x72'))][(_0x8a54('0x73'))](_0x8a54('0x7d')+_0x588a7e);}if(!_[_0x8a54('0x7e')](_0x588a7e,_0x1541ae['body'][_0x8a54('0x7c')])){throw new db[(_0x8a54('0x72'))][(_0x8a54('0x73'))](_0x8a54('0x7f')+_0x588a7e);}_0x3198ab[_0x1541ae[_0x8a54('0x63')][_0x8a54('0x7c')]]=_0x1541ae[_0x8a54('0x63')]['from'];})[_0x8a54('0x35')](function(){return db[_0x8a54('0x40')][_0x8a54('0x5b')]({'where':{'id':_0x1541ae[_0x8a54('0x59')]['id']},'include':[{'model':db['CmList'],'as':_0x8a54('0x80'),'include':[{'model':db[_0x8a54('0x71')],'as':'Contacts','where':_0x3198ab,'limit':0x1,'order':[[_0x8a54('0x77'),'DESC']]}]},{'model':db[_0x8a54('0x81')],'as':_0x8a54('0x82')}]});})[_0x8a54('0x35')](handleEntityNotFound(_0xb11fda,null))[_0x8a54('0x35')](function(_0x1d1fe7){if(_0x1d1fe7&&_0x1d1fe7['List']){_0x1e405d[_0x8a54('0x83')]=_0x1d1fe7;_0x1e405d['applications']=_0x1d1fe7['Applications'];_0x1e405d['list']=_0x1d1fe7[_0x8a54('0x80')];_0x1e405d[_0x8a54('0x84')]=_[_0x8a54('0x85')](_0x1e405d['applications'],[_0x8a54('0x86')],[_0x8a54('0x87')]);if(_0x1e405d['account'][_0x8a54('0x82')]){delete _0x1e405d[_0x8a54('0x83')]['Applications'];}if(_0x1e405d[_0x8a54('0x83')]['List']&&_0x1e405d[_0x8a54('0x83')][_0x8a54('0x80')][_0x8a54('0x88')][_0x8a54('0x5a')]){return _0x1e405d['account'][_0x8a54('0x80')][_0x8a54('0x88')][0x0];}var _0x340b33=_[_0x8a54('0x17')](_0x1541ae[_0x8a54('0x63')],{'firstName':_0x1541ae[_0x8a54('0x63')][_0x8a54('0x79')],'ListId':_0x1d1fe7[_0x8a54('0x78')]});_0x340b33[_0x1541ae[_0x8a54('0x63')]['mapKey']]=_0x1541ae[_0x8a54('0x63')]['from'];return db[_0x8a54('0x71')][_0x8a54('0x5c')](_0x340b33,{'fields':_0x104105,'raw':!![]});}})[_0x8a54('0x35')](handleEntityNotFound(_0xb11fda,null))[_0x8a54('0x35')](function(_0x5a8a81){_0x1e405d['contact']=_0x5a8a81;if(_0x5a8a81){var _0x5dce84={'ContactId':_0x5a8a81['id'],'OpenchannelAccountId':_0x1541ae[_0x8a54('0x59')]['id'],'from':(_0x5a8a81[_0x8a54('0x89')]||'')+'\x20'+(_0x5a8a81['lastName']||'')};var _0x240bfc={'OpenchannelAccountId':_0x1541ae[_0x8a54('0x59')]['id'],'closed':![]};if(_0x1541ae[_0x8a54('0x63')][_0x8a54('0x8a')]){_0x240bfc['threadId']=_0x1541ae['body'][_0x8a54('0x8a')];return db['OpenchannelInteraction']['find']({'where':_0x240bfc})[_0x8a54('0x35')](function(_0x4a9f73){if(_0x4a9f73){return[_0x4a9f73,![]];}_0x5dce84[_0x8a54('0x8a')]=_0x1541ae['body'][_0x8a54('0x8a')];_0x5dce84[_0x8a54('0x8b')]=_0x1541ae[_0x8a54('0x63')][_0x8a54('0x8b')];return db[_0x8a54('0x8c')][_0x8a54('0x5c')](_0x5dce84)[_0x8a54('0x35')](function(_0x226d95){return[_0x226d95,!![]];});});}else{_0x240bfc[_0x8a54('0x8a')]=null;}_0x240bfc[_0x8a54('0x8d')]=_0x5a8a81['id'];return db[_0x8a54('0x8c')]['find']({'where':_0x240bfc})[_0x8a54('0x35')](function(_0x5896f4){if(_0x5896f4){return[_0x5896f4,![]];}return db[_0x8a54('0x8c')][_0x8a54('0x5c')](_0x5dce84)['then'](function(_0x2ea5b5){return[_0x2ea5b5,!![]];});});}})[_0x8a54('0x8e')](function(_0x561820,_0x1d9775){if(_0x561820){_0x2f81b6=_0x1d9775;if(!_0x1d9775){var _0x119cd7={'from':(_0x1e405d[_0x8a54('0x8f')][_0x8a54('0x89')]||'')+'\x20'+(_0x1e405d['contact']['lastName']||'')};if(_0x1541ae['body'][_0x8a54('0x8a')]&&_0x1541ae[_0x8a54('0x63')][_0x8a54('0x90')]&&_0x1541ae[_0x8a54('0x63')][_0x8a54('0x8a')]!=_0x1541ae[_0x8a54('0x63')][_0x8a54('0x90')]){_0x119cd7[_0x8a54('0x8a')]=_0x1541ae['body']['messageId'];}return _0x561820['update'](_0x119cd7);}else{return _0x561820;}}})[_0x8a54('0x35')](function(_0x39992c){_0x1e405d['interaction']=_0x39992c[_0x8a54('0x36')]({'plain':!![]});_0x1e405d['interaction']['created']=_0x2f81b6;if(_0x1e405d[_0x8a54('0x91')][_0x8a54('0x92')]){if(_0x1e405d[_0x8a54('0x83')][_0x8a54('0x93')]){_0x1e405d[_0x8a54('0x84')]['push']({'id':0x0,'priority':_0x1e405d[_0x8a54('0x84')][_0x8a54('0x5a')]+0x1,'app':_0x8a54('0x94'),'appdata':_0x8a54('0x95'),'interval':_0x8a54('0x96')});}}return db[_0x8a54('0x97')][_0x8a54('0x5c')]({'body':_0x1541ae[_0x8a54('0x63')][_0x8a54('0x63')],'OpenchannelAccountId':_0x1541ae[_0x8a54('0x59')]['id'],'OpenchannelInteractionId':_0x39992c['id'],'direction':'in','ContactId':_0x1e405d[_0x8a54('0x8f')]['id'],'AttachmentId':_0x1541ae['body'][_0x8a54('0x98')]});})[_0x8a54('0x35')](function(_0x23c7b4){_0x1e405d[_0x8a54('0x26')]=_0x23c7b4;if(_0x1e405d[_0x8a54('0x91')][_0x8a54('0x99')]){return db[_0x8a54('0x9a')][_0x8a54('0x5b')]({'attributes':['id','name'],'where':{'id':_0x1e405d[_0x8a54('0x91')][_0x8a54('0x99')]}})[_0x8a54('0x35')](function(_0x3a1d79){if(_0x3a1d79){_0x1e405d[_0x8a54('0x84')][_0x8a54('0x9b')]({'id':0x0,'priority':0x0,'app':_0x8a54('0x9c'),'appdata':_0x3a1d79['name']+','+(_0x1e405d[_0x8a54('0x83')][_0x8a54('0x9d')]||0xa),'interval':_0x8a54('0x96')});_0x1e405d[_0x8a54('0x9e')]=![];}return respondWithRpcPromise('Start',_0x8a54('0x9f'),_0x1e405d);});}return respondWithRpcPromise(_0x8a54('0xa0'),_0x8a54('0x9f'),_0x1e405d);})[_0x8a54('0x35')](function(_0x59e53a){respondWithRpcPromise(_0x8a54('0xa1'),'EventManager',{'event':_0x8a54('0x70'),'message':_0x59e53a},client9002);return _0x59e53a;})['then'](respondWithResult(_0xb11fda,null))[_0x8a54('0x28')](handleError(_0xb11fda,null));};exports[_0x8a54('0xa2')]=function(_0x4a85f6,_0x5adc72){var _0xa000c7=_0x4a85f6[_0x8a54('0x59')]['id'];var _0x1a2ac0=_0x4a85f6[_0x8a54('0x63')];var _0x1f9e57=0xc8;var _0xc2876f=null;return db['sequelize'][_0x8a54('0xa3')]({'isolationLevel':db[_0x8a54('0xa4')][_0x8a54('0xa5')]['ISOLATION_LEVELS'][_0x8a54('0xa6')]},function(_0x36059c){return db[_0x8a54('0x40')][_0x8a54('0x6c')]({'where':{'id':_0xa000c7},'transaction':_0x36059c})[_0x8a54('0x35')](function(_0x41e68f){if(_0x41e68f){return db[_0x8a54('0x81')][_0x8a54('0x39')]({'where':{'OpenchannelAccountId':_0xa000c7},'transaction':_0x36059c})[_0x8a54('0x35')](function(){var _0x2d3d19=_[_0x8a54('0x3f')](_0x1a2ac0,function(_0x24f760){_0x24f760[_0x8a54('0x68')]=_0xa000c7;return _0x24f760;});return db['OpenchannelApplication'][_0x8a54('0xa7')](_0x2d3d19,{'transaction':_0x36059c});});}else{_0x1f9e57=0x194;_0xc2876f=[];}});})[_0x8a54('0x35')](function(){if(_0x1f9e57!==0x194){return db[_0x8a54('0x81')][_0x8a54('0xa8')]({'where':{'OpenchannelAccountId':_0xa000c7},'order':_0x8a54('0x86')})[_0x8a54('0x35')](function(_0x2a1419){_0xc2876f=_0x2a1419;});}})[_0x8a54('0x28')](function(_0x344a90){_0x1f9e57=0x1f4;logger['error'](_0x344a90[_0x8a54('0x3a')]);if(_0x344a90[_0x8a54('0x3b')]){delete _0x344a90[_0x8a54('0x3b')];}_0xc2876f=_0x344a90;})[_0x8a54('0xa9')](function(){if(_0xc2876f===null){_0x5adc72[_0x8a54('0x29')](_0x1f9e57);}else{if(_0x1f9e57===0x1f4){_0x5adc72[_0x8a54('0x30')](_0x1f9e57)[_0x8a54('0xaa')](_0xc2876f);}else{_0x5adc72[_0x8a54('0x30')](_0x1f9e57)[_0x8a54('0x2b')](_0xc2876f);}}});};exports[_0x8a54('0xab')]=function(_0x22b90e,_0x26f49e,_0x332993){var _0x4a2c91={};var _0x50d196={};var _0x173dab;var _0x5f0600;return db[_0x8a54('0x40')][_0x8a54('0x6c')]({'where':{'id':_0x22b90e[_0x8a54('0x59')]['id']}})[_0x8a54('0x35')](handleEntityNotFound(_0x26f49e,null))['then'](function(_0x27feb5){if(_0x27feb5){_0x173dab=_0x27feb5;_0x50d196[_0x8a54('0x43')]=_['keys'](db['OpenchannelApplication'][_0x8a54('0x41')]);_0x50d196[_0x8a54('0x45')]=_['keys'](_0x22b90e['query']);_0x50d196[_0x8a54('0x46')]=_[_0x8a54('0x47')](_0x50d196[_0x8a54('0x43')],_0x50d196['query']);_0x4a2c91['attributes']=_[_0x8a54('0x47')](_0x50d196[_0x8a54('0x43')],qs[_0x8a54('0x49')](_0x22b90e[_0x8a54('0x45')][_0x8a54('0x49')]));_0x4a2c91[_0x8a54('0x48')]=_0x4a2c91['attributes'][_0x8a54('0x5a')]?_0x4a2c91[_0x8a54('0x48')]:_0x50d196[_0x8a54('0x43')];_0x4a2c91['order']=qs[_0x8a54('0x4d')](_0x22b90e[_0x8a54('0x45')][_0x8a54('0x4d')]);_0x4a2c91['where']=qs[_0x8a54('0x46')](_['pick'](_0x22b90e['query'],_0x50d196['filters']));if(_0x22b90e[_0x8a54('0x45')][_0x8a54('0x4f')]){_0x4a2c91['where']=_[_0x8a54('0x51')](_0x4a2c91[_0x8a54('0x50')],{'$or':_[_0x8a54('0x3f')](_0x4a2c91['attributes'],function(_0x1348ef){var _0x450050={};_0x450050[_0x1348ef]={'$like':'%'+_0x22b90e[_0x8a54('0x45')][_0x8a54('0x4f')]+'%'};return _0x450050;})});}_0x4a2c91=_['merge']({},_0x4a2c91,_0x22b90e[_0x8a54('0x54')]);return _0x173dab['getApplications'](_0x4a2c91);}})['then'](function(_0x35359e){if(_0x35359e){_0x5f0600=_0x35359e[_0x8a54('0x5a')];if(!_0x22b90e['query']['hasOwnProperty'](_0x8a54('0x4b'))){_0x4a2c91[_0x8a54('0x2e')]=qs['limit'](_0x22b90e[_0x8a54('0x45')][_0x8a54('0x2e')]);_0x4a2c91[_0x8a54('0x2c')]=qs[_0x8a54('0x2c')](_0x22b90e[_0x8a54('0x45')][_0x8a54('0x2c')]);}return _0x173dab[_0x8a54('0xab')](_0x4a2c91);}})[_0x8a54('0x35')](function(_0x230ec9){if(_0x230ec9){return _0x230ec9?{'count':_0x5f0600,'rows':_0x230ec9}:null;}})[_0x8a54('0x35')](respondWithResult(_0x26f49e,null))[_0x8a54('0x28')](handleError(_0x26f49e,null));};exports[_0x8a54('0xac')]=function(_0x7cab88,_0x21996e,_0x33a248){var _0x5bddb3={'raw':![],'where':{}};var _0x119ea7={};var _0x526917={'count':0x0,'rows':[]};return db[_0x8a54('0x40')][_0x8a54('0x6c')]({'where':{'id':_0x7cab88[_0x8a54('0x59')]['id']}})[_0x8a54('0x35')](handleEntityNotFound(_0x21996e,null))[_0x8a54('0x35')](function(_0x127b7c){if(_0x127b7c){_0x119ea7[_0x8a54('0x43')]=_[_0x8a54('0x44')](db[_0x8a54('0x8c')][_0x8a54('0x41')]);_0x119ea7[_0x8a54('0x45')]=_[_0x8a54('0x44')](_0x7cab88[_0x8a54('0x45')]);_0x119ea7['filters']=_[_0x8a54('0x47')](_0x119ea7[_0x8a54('0x43')],_0x119ea7['query']);_0x5bddb3[_0x8a54('0x48')]=_[_0x8a54('0x47')](_0x119ea7[_0x8a54('0x43')],qs['fields'](_0x7cab88[_0x8a54('0x45')][_0x8a54('0x49')]));_0x5bddb3[_0x8a54('0x48')]=_0x5bddb3[_0x8a54('0x48')]['length']?_0x5bddb3[_0x8a54('0x48')]:_0x119ea7[_0x8a54('0x43')];if(!_0x7cab88['query'][_0x8a54('0x4a')]('nolimit')){_0x5bddb3[_0x8a54('0x2e')]=qs[_0x8a54('0x2e')](_0x7cab88[_0x8a54('0x45')]['limit']);_0x5bddb3[_0x8a54('0x2c')]=qs[_0x8a54('0x2c')](_0x7cab88[_0x8a54('0x45')][_0x8a54('0x2c')]);}_0x5bddb3[_0x8a54('0x4c')]=qs['sort'](_0x7cab88[_0x8a54('0x45')][_0x8a54('0x4d')]);_0x5bddb3[_0x8a54('0x50')]=qs[_0x8a54('0x46')](_['pick'](_0x7cab88['query'],_0x119ea7[_0x8a54('0x46')]));_0x5bddb3[_0x8a54('0x50')]['OpenchannelAccountId']=_0x127b7c['id'];if(_0x7cab88[_0x8a54('0x45')][_0x8a54('0x4f')]){_0x5bddb3['where']=_['merge'](_0x5bddb3[_0x8a54('0x50')],{'$or':_[_0x8a54('0x3f')](_0x5bddb3[_0x8a54('0x48')],function(_0x32861c){var _0x3bb9b6={};_0x3bb9b6[_0x32861c]={'$like':'%'+_0x7cab88[_0x8a54('0x45')][_0x8a54('0x4f')]+'%'};return _0x3bb9b6;})});}_0x5bddb3=_[_0x8a54('0x51')]({},_0x5bddb3,_0x7cab88['options']);return db[_0x8a54('0x8c')][_0x8a54('0x2f')]({'where':_0x5bddb3[_0x8a54('0x50')]})[_0x8a54('0x35')](function(_0x12803b){_0x526917[_0x8a54('0x2f')]=_0x12803b;if(_0x7cab88[_0x8a54('0x45')][_0x8a54('0x55')]){_0x5bddb3[_0x8a54('0x56')]=[{'model':db[_0x8a54('0x71')],'as':'Contact','required':![]},{'model':db[_0x8a54('0x9a')],'as':_0x8a54('0xad'),'attributes':[_0x8a54('0x3b'),_0x8a54('0xae'),'internal'],'required':![]},{'model':db[_0x8a54('0xaf')],'as':_0x8a54('0xb0'),'attributes':['id',_0x8a54('0x3b'),_0x8a54('0xb1')],'where':_0x7cab88['query']['tag']?{'id':_0x7cab88[_0x8a54('0x45')]['tag']}:undefined,'required':_0x7cab88['query']['tag']?!![]:![]}];}return db[_0x8a54('0x8c')]['findAll'](_0x5bddb3);})[_0x8a54('0x35')](function(_0x86de40){_0x526917['rows']=_0x86de40;return _0x526917;});}})[_0x8a54('0x35')](respondWithFilteredResult(_0x21996e,_0x5bddb3))[_0x8a54('0x28')](handleError(_0x21996e,null));};exports[_0x8a54('0xb2')]=function(_0x1ec9e0,_0x4ff42a,_0x105e8f){return db['OpenchannelAccount'][_0x8a54('0x5b')]({'where':{'id':_0x1ec9e0[_0x8a54('0x59')]['id']}})[_0x8a54('0x35')](handleEntityNotFound(_0x4ff42a,null))[_0x8a54('0x35')](function(_0x5dbc25){if(_0x5dbc25){return _0x5dbc25['addAgents'](_0x1ec9e0[_0x8a54('0x63')][_0x8a54('0x6f')],_[_0x8a54('0xb3')](_0x1ec9e0[_0x8a54('0x63')],['ids','id'])||{})[_0x8a54('0x8e')](function(_0x538ccd){for(var _0x3fe3d3=0x0;_0x3fe3d3<_0x1ec9e0[_0x8a54('0x63')]['ids']['length'];_0x3fe3d3+=0x1){socket[_0x8a54('0xb4')](_0x8a54('0xb5'),{'UserId':Number(_0x1ec9e0[_0x8a54('0x63')]['ids'][_0x3fe3d3]),'OpenchannelAccountId':Number(_0x1ec9e0[_0x8a54('0x59')]['id'])});}return _0x538ccd;});}})[_0x8a54('0x35')](respondWithResult(_0x4ff42a,null))['catch'](handleError(_0x4ff42a,null));};exports[_0x8a54('0xb6')]=function(_0x58b584,_0x251bb4,_0x36d5fb){return db['OpenchannelAccount'][_0x8a54('0x5b')]({'where':{'id':_0x58b584[_0x8a54('0x59')]['id']}})['then'](handleEntityNotFound(_0x251bb4,null))[_0x8a54('0x35')](function(_0x14f370){if(_0x14f370){return _0x14f370[_0x8a54('0xb6')](_0x58b584[_0x8a54('0x45')]['ids'])[_0x8a54('0x35')](function(){if(_['isArray'](_0x58b584[_0x8a54('0x45')][_0x8a54('0x6f')])){for(var _0x45c19c=0x0;_0x45c19c<_0x58b584['query'][_0x8a54('0x6f')]['length'];_0x45c19c+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x58b584[_0x8a54('0x45')][_0x8a54('0x6f')][_0x45c19c]),'OpenchannelAccountId':Number(_0x58b584['params']['id'])});}}else{socket[_0x8a54('0xb4')]('userOpenchannelAccount:remove',{'UserId':Number(_0x58b584[_0x8a54('0x45')][_0x8a54('0x6f')]),'OpenchannelAccountId':Number(_0x58b584[_0x8a54('0x59')]['id'])});}});}})[_0x8a54('0x35')](respondWithStatusCode(_0x251bb4,null))[_0x8a54('0x28')](handleError(_0x251bb4,null));};exports[_0x8a54('0xb7')]=function(_0x3bdb53,_0x5f4326,_0x5a7790){var _0x2827b4={};var _0x3f1be6={};var _0x16df2f;var _0x4b1837;return db[_0x8a54('0x40')][_0x8a54('0x6c')]({'where':{'id':_0x3bdb53[_0x8a54('0x59')]['id']}})[_0x8a54('0x35')](handleEntityNotFound(_0x5f4326,null))['then'](function(_0x1f244c){if(_0x1f244c){_0x16df2f=_0x1f244c;_0x3f1be6['model']=_[_0x8a54('0x44')](db[_0x8a54('0x9a')][_0x8a54('0x41')]);_0x3f1be6[_0x8a54('0x45')]=_['keys'](_0x3bdb53['query']);_0x3f1be6[_0x8a54('0x46')]=_[_0x8a54('0x47')](_0x3f1be6[_0x8a54('0x43')],_0x3f1be6[_0x8a54('0x45')]);_0x2827b4[_0x8a54('0x48')]=_[_0x8a54('0x47')](_0x3f1be6['model'],qs[_0x8a54('0x49')](_0x3bdb53[_0x8a54('0x45')][_0x8a54('0x49')]));_0x2827b4[_0x8a54('0x48')]=_0x2827b4[_0x8a54('0x48')][_0x8a54('0x5a')]?_0x2827b4[_0x8a54('0x48')]:_0x3f1be6[_0x8a54('0x43')];_0x2827b4['order']=qs['sort'](_0x3bdb53[_0x8a54('0x45')][_0x8a54('0x4d')]);_0x2827b4['where']=qs['filters'](_[_0x8a54('0x4e')](_0x3bdb53['query'],_0x3f1be6[_0x8a54('0x46')]));if(_0x3bdb53['query'][_0x8a54('0x4f')]){_0x2827b4[_0x8a54('0x50')]=_[_0x8a54('0x51')](_0x2827b4[_0x8a54('0x50')],{'$or':_['map'](_0x2827b4[_0x8a54('0x48')],function(_0x29cd57){var _0x4e22c4={};_0x4e22c4[_0x29cd57]={'$like':'%'+_0x3bdb53[_0x8a54('0x45')][_0x8a54('0x4f')]+'%'};return _0x4e22c4;})});}_0x2827b4=_['merge']({},_0x2827b4,_0x3bdb53[_0x8a54('0x54')]);return _0x16df2f[_0x8a54('0xb7')](_0x2827b4);}})[_0x8a54('0x35')](function(_0x42e775){if(_0x42e775){_0x4b1837=_0x42e775['length'];if(!_0x3bdb53[_0x8a54('0x45')][_0x8a54('0x4a')](_0x8a54('0x4b'))){_0x2827b4[_0x8a54('0x2e')]=qs[_0x8a54('0x2e')](_0x3bdb53['query'][_0x8a54('0x2e')]);_0x2827b4['offset']=qs[_0x8a54('0x2c')](_0x3bdb53[_0x8a54('0x45')][_0x8a54('0x2c')]);}return _0x16df2f[_0x8a54('0xb7')](_0x2827b4);}})[_0x8a54('0x35')](function(_0x6569bd){if(_0x6569bd){return _0x6569bd?{'count':_0x4b1837,'rows':_0x6569bd}:null;}})[_0x8a54('0x35')](respondWithResult(_0x5f4326,null))[_0x8a54('0x28')](handleError(_0x5f4326,null));};exports[_0x8a54('0xaa')]=function(_0x12a3a2,_0xef35b0,_0xd457f8){var _0x1618d5,_0x49efd,_0x5a527c;if(_[_0x8a54('0x7a')](_0x12a3a2[_0x8a54('0x63')]['body'])||_0x12a3a2[_0x8a54('0x63')][_0x8a54('0x63')]===''){throw new db[(_0x8a54('0x72'))][(_0x8a54('0x73'))](_0x8a54('0x7b'));}if(_['isNil'](_0x12a3a2[_0x8a54('0x63')]['to'])){}_0x1618d5=_0x12a3a2[_0x8a54('0x63')]['to'];return db[_0x8a54('0x40')][_0x8a54('0x6c')]({'where':{'id':_0x12a3a2[_0x8a54('0x59')]['id']}})[_0x8a54('0x35')](handleEntityNotFound(_0xef35b0,null))[_0x8a54('0x35')](function(_0x15a1d8){if(_0x15a1d8){return db[_0x8a54('0x40')][_0x8a54('0x5b')]({'where':{'id':_0x15a1d8['id']},'include':[{'model':db[_0x8a54('0xb8')],'as':_0x8a54('0x80'),'include':[{'model':db[_0x8a54('0x71')],'as':_0x8a54('0x88'),'where':{[_0x15a1d8[_0x8a54('0x7c')]]:_0x1618d5},'limit':0x1,'order':[[_0x8a54('0x77'),_0x8a54('0xb9')]]}]}]})['then'](handleEntityNotFound(_0xef35b0,null))[_0x8a54('0x35')](function(_0xa29d7c){if(_0xa29d7c&&_0xa29d7c[_0x8a54('0x80')]){_0x49efd=_0xa29d7c['get']({'plain':!![]});if(_0x49efd['List']&&_0x49efd[_0x8a54('0x80')][_0x8a54('0x88')][_0x8a54('0x5a')]){return _0x49efd[_0x8a54('0x80')]['Contacts'][0x0];}return db['CmContact'][_0x8a54('0x5c')](_['defaults'](_0x12a3a2[_0x8a54('0x63')],{'firstName':_0x1618d5,[_0xa29d7c[_0x8a54('0x7c')]]:_0x1618d5,'phone':_0x1618d5,'ListId':_0x49efd['ListId']}));}})[_0x8a54('0x35')](handleEntityNotFound(_0xef35b0,null))['then'](function(_0x474405){if(_0x474405){_0x5a527c=_0x474405;return db[_0x8a54('0x8c')]['find']({'where':{'ContactId':_0x5a527c['id'],'closed':![],'OpenchannelAccountId':_0x49efd['id']}})[_0x8a54('0x35')](function(_0x2ab580){if(_0x2ab580){return[_0x2ab580,![]];}return db[_0x8a54('0x8c')]['create']({'UserId':_0x12a3a2[_0x8a54('0x5d')]['id'],'ContactId':_0x5a527c['id'],'OpenchannelAccountId':_0x49efd['id'],'lastMsgDirection':'out','Messages':[_[_0x8a54('0x51')](_0x12a3a2[_0x8a54('0x63')],{'read':![],'body':_0x12a3a2[_0x8a54('0x63')][_0x8a54('0x63')],'OpenchannelAccountId':_0x49efd['id'],'UserId':_0x12a3a2[_0x8a54('0x5d')]['id'],'ContactId':_0x5a527c['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x8a54('0xba')}]})[_0x8a54('0x35')](function(_0x5461db){return[_0x5461db,!![]];});});}})[_0x8a54('0x8e')](function(_0x5997d6,_0x522b8a){if(_0x522b8a){return _0x5997d6;}return db[_0x8a54('0x97')][_0x8a54('0x5c')](_[_0x8a54('0x51')](_0x12a3a2[_0x8a54('0x63')],{'read':![],'body':_0x12a3a2[_0x8a54('0x63')][_0x8a54('0x63')],'OpenchannelAccountId':_0x49efd['id'],'OpenchannelInteractionId':_0x5997d6['id'],'UserId':_0x12a3a2[_0x8a54('0x5d')]['id'],'ContactId':_0x5a527c['id']}))[_0x8a54('0x35')](function(_0x2f20ac){_0x5997d6[_0x8a54('0xbb')][_0x8a54('0xba')]=[];_0x5997d6['dataValues'][_0x8a54('0xba')][_0x8a54('0xbc')](_0x2f20ac['dataValues']);return _0x5997d6;});});}})[_0x8a54('0x35')](respondWithResult(_0xef35b0,null))[_0x8a54('0x28')](handleError(_0xef35b0,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 9220742..90636a8 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 _0x6f7a=['events','../../mysqldb','OpenchannelAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x3fe4e2,_0x54a55f){_0x3fe4e2=_0x3fe4e2-0x0;var _0x132790=_0x6f7a[_0x3fe4e2];return _0x132790;};'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 +var _0xb688=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x3b5226,_0x496a84){var _0x3a13d1=function(_0x22a1f8){while(--_0x22a1f8){_0x3b5226['push'](_0x3b5226['shift']());}};_0x3a13d1(++_0x496a84);}(_0xb688,0xcf));var _0x8b68=function(_0x11a0a1,_0x3596e9){_0x11a0a1=_0x11a0a1-0x0;var _0x4a6e2f=_0xb688[_0x11a0a1];return _0x4a6e2f;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x8b68('0x0'))['db'][_0x8b68('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x8b68('0x2')](0x0);var events={'afterCreate':_0x8b68('0x3'),'afterUpdate':_0x8b68('0x4'),'afterDestroy':_0x8b68('0x5')};function emitEvent(_0x4e281c){return function(_0x41030e,_0x27925d,_0x30f33d){OpenchannelAccountEvents[_0x8b68('0x6')](_0x4e281c+':'+_0x41030e['id'],_0x41030e);OpenchannelAccountEvents['emit'](_0x4e281c,_0x41030e);_0x30f33d(null);};}for(var e in events){if(events[_0x8b68('0x7')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x8b68('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index b18ad67..2bb0a56 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(_0x19ba0c,_0x3a9220){var _0x4730de=function(_0x4243de){while(--_0x4243de){_0x19ba0c['push'](_0x19ba0c['shift']());}};_0x4730de(++_0x3a9220);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x42e5ea,_0x2a85be){var _0x34f510=function(_0x339688){while(--_0x339688){_0x42e5ea['push'](_0x42e5ea['shift']());}};_0x34f510(++_0x2a85be);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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 5d98ca7..184e6d2 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 _0x55f1=['socket.io-emitter','./openchannelAccount.socket','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','localhost'];(function(_0x3274e1,_0x10a0dd){var _0x3f08b8=function(_0x36a729){while(--_0x36a729){_0x3274e1['push'](_0x3274e1['shift']());}};_0x3f08b8(++_0x10a0dd);}(_0x55f1,0x9b));var _0x155f=function(_0x35104e,_0x5db136){_0x35104e=_0x35104e-0x0;var _0x1857a4=_0x55f1[_0x35104e];return _0x1857a4;};'use strict';var _=require(_0x155f('0x0'));var util=require('util');var moment=require(_0x155f('0x1'));var BPromise=require(_0x155f('0x2'));var rs=require(_0x155f('0x3'));var fs=require('fs');var Redis=require(_0x155f('0x4'));var db=require(_0x155f('0x5'))['db'];var utils=require(_0x155f('0x6'));var logger=require(_0x155f('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x155f('0x8'));var client=jayson['client'][_0x155f('0x9')]({'port':0x232a});config[_0x155f('0xa')]=_[_0x155f('0xb')](config[_0x155f('0xa')],{'host':_0x155f('0xc'),'port':0x18eb});var socket=require(_0x155f('0xd'))(new Redis(config[_0x155f('0xa')]));require(_0x155f('0xe'))[_0x155f('0xf')](socket);function respondWithRpcPromise(_0x281c5a,_0x11c946,_0x39d85a){return new BPromise(function(_0x5b9e3b,_0x9fb9a){return client[_0x155f('0x10')](_0x281c5a,_0x39d85a)[_0x155f('0x11')](function(_0x3575d8){logger['info'](_0x155f('0x12'),_0x11c946,_0x155f('0x13'));logger[_0x155f('0x14')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x11c946,'request\x20sent',JSON[_0x155f('0x15')](_0x3575d8));if(_0x3575d8[_0x155f('0x16')]){if(_0x3575d8[_0x155f('0x16')][_0x155f('0x17')]===0x1f4){logger[_0x155f('0x16')](_0x155f('0x12'),_0x11c946,_0x3575d8[_0x155f('0x16')]['message']);return _0x9fb9a(_0x3575d8[_0x155f('0x16')][_0x155f('0x18')]);}logger['error'](_0x155f('0x12'),_0x11c946,_0x3575d8[_0x155f('0x16')][_0x155f('0x18')]);return _0x5b9e3b(_0x3575d8[_0x155f('0x16')][_0x155f('0x18')]);}else{logger[_0x155f('0x19')](_0x155f('0x12'),_0x11c946,_0x155f('0x13'));_0x5b9e3b(_0x3575d8[_0x155f('0x1a')][_0x155f('0x18')]);}})[_0x155f('0x1b')](function(_0x3bdede){logger[_0x155f('0x16')](_0x155f('0x12'),_0x11c946,_0x3bdede);_0x9fb9a(_0x3bdede);});});} \ No newline at end of file +var _0xb9be=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x1d211b,_0x475f3b){var _0x47c88b=function(_0x3126f5){while(--_0x3126f5){_0x1d211b['push'](_0x1d211b['shift']());}};_0x47c88b(++_0x475f3b);}(_0xb9be,0xc5));var _0xeb9b=function(_0xa79977,_0x4f7f12){_0xa79977=_0xa79977-0x0;var _0x109f10=_0xb9be[_0xa79977];return _0x109f10;};'use strict';var _=require(_0xeb9b('0x0'));var util=require(_0xeb9b('0x1'));var moment=require(_0xeb9b('0x2'));var BPromise=require(_0xeb9b('0x3'));var rs=require(_0xeb9b('0x4'));var fs=require('fs');var Redis=require(_0xeb9b('0x5'));var db=require(_0xeb9b('0x6'))['db'];var utils=require(_0xeb9b('0x7'));var logger=require(_0xeb9b('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xeb9b('0x9'));var client=jayson[_0xeb9b('0xa')][_0xeb9b('0xb')]({'port':0x232a});config['redis']=_[_0xeb9b('0xc')](config[_0xeb9b('0xd')],{'host':_0xeb9b('0xe'),'port':0x18eb});var socket=require(_0xeb9b('0xf'))(new Redis(config[_0xeb9b('0xd')]));require(_0xeb9b('0x10'))[_0xeb9b('0x11')](socket);function respondWithRpcPromise(_0x16761a,_0x32f0c4,_0x4f4952){return new BPromise(function(_0x20c855,_0x58d6a4){return client['request'](_0x16761a,_0x4f4952)[_0xeb9b('0x12')](function(_0x4236c0){logger['info'](_0xeb9b('0x13'),_0x32f0c4,_0xeb9b('0x14'));logger[_0xeb9b('0x15')](_0xeb9b('0x16'),_0x32f0c4,'request\x20sent',JSON['stringify'](_0x4236c0));if(_0x4236c0['error']){if(_0x4236c0[_0xeb9b('0x17')][_0xeb9b('0x18')]===0x1f4){logger[_0xeb9b('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0x32f0c4,_0x4236c0['error']['message']);return _0x58d6a4(_0x4236c0[_0xeb9b('0x17')][_0xeb9b('0x19')]);}logger[_0xeb9b('0x17')](_0xeb9b('0x13'),_0x32f0c4,_0x4236c0[_0xeb9b('0x17')][_0xeb9b('0x19')]);return _0x20c855(_0x4236c0[_0xeb9b('0x17')]['message']);}else{logger[_0xeb9b('0x1a')](_0xeb9b('0x13'),_0x32f0c4,_0xeb9b('0x14'));_0x20c855(_0x4236c0[_0xeb9b('0x1b')][_0xeb9b('0x19')]);}})[_0xeb9b('0x1c')](function(_0x21010e){logger[_0xeb9b('0x17')](_0xeb9b('0x13'),_0x32f0c4,_0x21010e);_0x58d6a4(_0x21010e);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index d6d4a0b..276704c 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 _0x1fdc=['save','update','emit','register','length','openchannelAccount:','./openchannelAccount.events'];(function(_0x3daab0,_0x5d8b14){var _0x53eca4=function(_0x1cb0c8){while(--_0x1cb0c8){_0x3daab0['push'](_0x3daab0['shift']());}};_0x53eca4(++_0x5d8b14);}(_0x1fdc,0x8b));var _0xc1fd=function(_0x77773a,_0x5a7026){_0x77773a=_0x77773a-0x0;var _0x1091a2=_0x1fdc[_0x77773a];return _0x1091a2;};'use strict';var OpenchannelAccountEvents=require(_0xc1fd('0x0'));var events=[_0xc1fd('0x1'),'remove',_0xc1fd('0x2')];function createListener(_0x30eaf5,_0x1849f5){return function(_0x256e28){_0x1849f5[_0xc1fd('0x3')](_0x30eaf5,_0x256e28);};}function removeListener(_0x7fe059,_0x259024){return function(){OpenchannelAccountEvents['removeListener'](_0x7fe059,_0x259024);};}exports[_0xc1fd('0x4')]=function(_0x141dab){for(var _0x43cd02=0x0,_0xf6faef=events[_0xc1fd('0x5')];_0x43cd02<_0xf6faef;_0x43cd02++){var _0x3eebe6=events[_0x43cd02];var _0x43b858=createListener(_0xc1fd('0x6')+_0x3eebe6,_0x141dab);OpenchannelAccountEvents['on'](_0x3eebe6,_0x43b858);}}; \ No newline at end of file +var _0xc36d=['update','emit','removeListener','register','openchannelAccount:','./openchannelAccount.events','save','remove'];(function(_0xecf9e4,_0x1331bf){var _0x15e498=function(_0x9b9026){while(--_0x9b9026){_0xecf9e4['push'](_0xecf9e4['shift']());}};_0x15e498(++_0x1331bf);}(_0xc36d,0x7d));var _0xdc36=function(_0xc0f3d0,_0x4cfe98){_0xc0f3d0=_0xc0f3d0-0x0;var _0x1798ba=_0xc36d[_0xc0f3d0];return _0x1798ba;};'use strict';var OpenchannelAccountEvents=require(_0xdc36('0x0'));var events=[_0xdc36('0x1'),_0xdc36('0x2'),_0xdc36('0x3')];function createListener(_0x471240,_0x2d5df5){return function(_0x4c42dd){_0x2d5df5[_0xdc36('0x4')](_0x471240,_0x4c42dd);};}function removeListener(_0x3431f9,_0x53ac17){return function(){OpenchannelAccountEvents[_0xdc36('0x5')](_0x3431f9,_0x53ac17);};}exports[_0xdc36('0x6')]=function(_0x186c58){for(var _0x11ad3b=0x0,_0x6e4753=events['length'];_0x11ad3b<_0x6e4753;_0x11ad3b++){var _0x20ba02=events[_0x11ad3b];var _0x456897=createListener(_0xdc36('0x7')+_0x20ba02,_0x186c58);OpenchannelAccountEvents['on'](_0x20ba02,_0x456897);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index b43ae1f..a3082c9 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 _0x819f=['get','isAuthenticated','index','create','put','/:id','update','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelApplication.controller'];(function(_0x76c7f8,_0x498e10){var _0x56c0b2=function(_0x6dd83b){while(--_0x6dd83b){_0x76c7f8['push'](_0x76c7f8['shift']());}};_0x56c0b2(++_0x498e10);}(_0x819f,0x1c9));var _0xf819=function(_0x5eca50,_0xc1e3f8){_0x5eca50=_0x5eca50-0x0;var _0x41fb84=_0x819f[_0x5eca50];return _0x41fb84;};'use strict';var multer=require('multer');var util=require(_0xf819('0x0'));var path=require('path');var timeout=require(_0xf819('0x1'));var express=require('express');var router=express[_0xf819('0x2')]();var fs_extra=require(_0xf819('0x3'));var auth=require(_0xf819('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf819('0x5'));var controller=require(_0xf819('0x6'));router[_0xf819('0x7')]('/',auth[_0xf819('0x8')](),controller[_0xf819('0x9')]);router[_0xf819('0x7')]('/:id',auth[_0xf819('0x8')](),controller['show']);router['post']('/',auth[_0xf819('0x8')](),controller[_0xf819('0xa')]);router[_0xf819('0xb')](_0xf819('0xc'),auth['isAuthenticated'](),controller[_0xf819('0xd')]);router['delete']('/:id',auth[_0xf819('0x8')](),controller[_0xf819('0xe')]);module[_0xf819('0xf')]=router; \ No newline at end of file +var _0x795c=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','delete','exports','util'];(function(_0x308944,_0x1c462e){var _0x2bf805=function(_0x1e6564){while(--_0x1e6564){_0x308944['push'](_0x308944['shift']());}};_0x2bf805(++_0x1c462e);}(_0x795c,0x149));var _0xc795=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x795c[_0x433a86];return _0x23000c;};'use strict';var multer=require('multer');var util=require(_0xc795('0x0'));var path=require(_0xc795('0x1'));var timeout=require(_0xc795('0x2'));var express=require(_0xc795('0x3'));var router=express[_0xc795('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc795('0x5'));var interaction=require(_0xc795('0x6'));var config=require(_0xc795('0x7'));var controller=require('./openchannelApplication.controller');router[_0xc795('0x8')]('/',auth[_0xc795('0x9')](),controller['index']);router[_0xc795('0x8')](_0xc795('0xa'),auth[_0xc795('0x9')](),controller[_0xc795('0xb')]);router[_0xc795('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xc795('0xa'),auth[_0xc795('0x9')](),controller['update']);router[_0xc795('0xd')](_0xc795('0xa'),auth[_0xc795('0x9')](),controller['destroy']);module[_0xc795('0xe')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 97d9c52..8324ea7 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 _0xa121=['INTEGER','noop','TEXT','STRING','sequelize','exports'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0xa121,0x1c6));var _0x1a12=function(_0x313811,_0x2842f5){_0x313811=_0x313811-0x0;var _0x1d6702=_0xa121[_0x313811];return _0x1d6702;};'use strict';var Sequelize=require(_0x1a12('0x0'));module[_0x1a12('0x1')]={'priority':{'type':Sequelize[_0x1a12('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1a12('0x3')},'appdata':{'type':Sequelize[_0x1a12('0x4')]()},'description':{'type':Sequelize[_0x1a12('0x5')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xf126=['STRING','TEXT','sequelize','exports','INTEGER'];(function(_0x906291,_0x505ff1){var _0x86c053=function(_0x1e50b2){while(--_0x1e50b2){_0x906291['push'](_0x906291['shift']());}};_0x86c053(++_0x505ff1);}(_0xf126,0xe3));var _0x6f12=function(_0x1191da,_0x1f49b7){_0x1191da=_0x1191da-0x0;var _0x288acf=_0xf126[_0x1191da];return _0x288acf;};'use strict';var Sequelize=require(_0x6f12('0x0'));module[_0x6f12('0x1')]={'priority':{'type':Sequelize[_0x6f12('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6f12('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x6f12('0x4')]()},'description':{'type':Sequelize[_0x6f12('0x3')]},'interval':{'type':Sequelize[_0x6f12('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 64b7ebe..885d5bc 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 _0x6668=['order','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','show','params','includeAll','include','create','catch','update','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','offset','undefined','limit','count','status','Content-Range','json','apply','reject','then','destroy','sendStatus','stack','index','OpenchannelApplication','rawAttributes','fieldName','type','key','model','map','name','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x296897,_0x4d23ea){var _0x2b44ab=function(_0xdf90d8){while(--_0xdf90d8){_0x296897['push'](_0x296897['shift']());}};_0x2b44ab(++_0x4d23ea);}(_0x6668,0x1cf));var _0x8666=function(_0x123d3d,_0x114ea5){_0x123d3d=_0x123d3d-0x0;var _0x5707bf=_0x6668[_0x123d3d];return _0x5707bf;};'use strict';var emlformat=require(_0x8666('0x0'));var rimraf=require(_0x8666('0x1'));var zipdir=require(_0x8666('0x2'));var jsonpatch=require(_0x8666('0x3'));var rp=require(_0x8666('0x4'));var moment=require(_0x8666('0x5'));var BPromise=require(_0x8666('0x6'));var Mustache=require(_0x8666('0x7'));var util=require('util');var path=require('path');var sox=require(_0x8666('0x8'));var csv=require(_0x8666('0x9'));var ejs=require(_0x8666('0xa'));var fs=require('fs');var fs_extra=require(_0x8666('0xb'));var _=require('lodash');var squel=require(_0x8666('0xc'));var crypto=require(_0x8666('0xd'));var jsforce=require(_0x8666('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8666('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8666('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8666('0x11'));var hardwareService=require(_0x8666('0x12'));var logger=require(_0x8666('0x13'))('api');var utils=require(_0x8666('0x14'));var config=require(_0x8666('0x15'));var licenseUtil=require(_0x8666('0x16'));var db=require(_0x8666('0x17'))['db'];function respondWithStatusCode(_0x1b0e7c,_0x361aa6){_0x361aa6=_0x361aa6||0xcc;return function(_0xbd87d){if(_0xbd87d){return _0x1b0e7c['sendStatus'](_0x361aa6);}return _0x1b0e7c['status'](_0x361aa6)[_0x8666('0x18')]();};}function respondWithResult(_0x1a2b75,_0x296e56){_0x296e56=_0x296e56||0xc8;return function(_0x33ab28){if(_0x33ab28){return _0x1a2b75['status'](_0x296e56)['json'](_0x33ab28);}};}function respondWithFilteredResult(_0x155ed9,_0x3c3de6){return function(_0x4f0fb4){if(_0x4f0fb4){var _0x519123=typeof _0x3c3de6[_0x8666('0x19')]===_0x8666('0x1a')&&typeof _0x3c3de6[_0x8666('0x1b')]==='undefined';var _0x533168=_0x4f0fb4['count'];var _0x159a55=_0x519123?0x0:_0x3c3de6[_0x8666('0x19')];var _0x3b4156=_0x519123?_0x4f0fb4[_0x8666('0x1c')]:_0x3c3de6['offset']+_0x3c3de6[_0x8666('0x1b')];var _0x2ef9ba;if(_0x3b4156>=_0x533168){_0x3b4156=_0x533168;_0x2ef9ba=0xc8;}else{_0x2ef9ba=0xce;}_0x155ed9[_0x8666('0x1d')](_0x2ef9ba);return _0x155ed9['set'](_0x8666('0x1e'),_0x159a55+'-'+_0x3b4156+'/'+_0x533168)[_0x8666('0x1f')](_0x4f0fb4);}return null;};}function patchUpdates(_0x79ba7){return function(_0x1c970c){try{jsonpatch[_0x8666('0x20')](_0x1c970c,_0x79ba7,!![]);}catch(_0xc503e7){return BPromise[_0x8666('0x21')](_0xc503e7);}return _0x1c970c['save']();};}function saveUpdates(_0x40f392,_0x24fef8){return function(_0x3bbcf5){if(_0x3bbcf5){return _0x3bbcf5['update'](_0x40f392)[_0x8666('0x22')](function(_0xa4819d){return _0xa4819d;});}return null;};}function removeEntity(_0x1138ef,_0x13c304){return function(_0x58da34){if(_0x58da34){return _0x58da34[_0x8666('0x23')]()[_0x8666('0x22')](function(){_0x1138ef[_0x8666('0x1d')](0xcc)[_0x8666('0x18')]();});}};}function handleEntityNotFound(_0x145090,_0x5bbd34){return function(_0x2ba5ea){if(!_0x2ba5ea){_0x145090[_0x8666('0x24')](0x194);}return _0x2ba5ea;};}function handleError(_0x8eb26f,_0x1c6f76){_0x1c6f76=_0x1c6f76||0x1f4;return function(_0x2ddbd7){logger['error'](_0x2ddbd7[_0x8666('0x25')]);if(_0x2ddbd7['name']){delete _0x2ddbd7['name'];}_0x8eb26f[_0x8666('0x1d')](_0x1c6f76)['send'](_0x2ddbd7);};}exports[_0x8666('0x26')]=function(_0xb64e10,_0x3832f7){var _0x44ed12={},_0x3f40d8={},_0x463c1b={'count':0x0,'rows':[]};var _0x44d1eb=_['map'](db[_0x8666('0x27')][_0x8666('0x28')],function(_0x380aa7){return{'name':_0x380aa7[_0x8666('0x29')],'type':_0x380aa7[_0x8666('0x2a')][_0x8666('0x2b')]};});_0x3f40d8[_0x8666('0x2c')]=_[_0x8666('0x2d')](_0x44d1eb,_0x8666('0x2e'));_0x3f40d8['query']=_[_0x8666('0x2f')](_0xb64e10[_0x8666('0x30')]);_0x3f40d8['filters']=_['intersection'](_0x3f40d8[_0x8666('0x2c')],_0x3f40d8['query']);_0x44ed12[_0x8666('0x31')]=_[_0x8666('0x32')](_0x3f40d8['model'],qs[_0x8666('0x33')](_0xb64e10[_0x8666('0x30')]['fields']));_0x44ed12[_0x8666('0x31')]=_0x44ed12[_0x8666('0x31')][_0x8666('0x34')]?_0x44ed12[_0x8666('0x31')]:_0x3f40d8[_0x8666('0x2c')];if(!_0xb64e10['query'][_0x8666('0x35')](_0x8666('0x36'))){_0x44ed12[_0x8666('0x1b')]=qs[_0x8666('0x1b')](_0xb64e10[_0x8666('0x30')][_0x8666('0x1b')]);_0x44ed12[_0x8666('0x19')]=qs[_0x8666('0x19')](_0xb64e10[_0x8666('0x30')][_0x8666('0x19')]);}_0x44ed12[_0x8666('0x37')]=qs[_0x8666('0x38')](_0xb64e10[_0x8666('0x30')]['sort']);_0x44ed12[_0x8666('0x39')]=qs[_0x8666('0x3a')](_[_0x8666('0x3b')](_0xb64e10['query'],_0x3f40d8[_0x8666('0x3a')]),_0x44d1eb);if(_0xb64e10[_0x8666('0x30')][_0x8666('0x3c')]){_0x44ed12[_0x8666('0x39')]=_[_0x8666('0x3d')](_0x44ed12[_0x8666('0x39')],{'$or':_['map'](_0x44d1eb,function(_0x6b3127){if(_0x6b3127[_0x8666('0x2a')]!==_0x8666('0x3e')){var _0x595ff8={};_0x595ff8[_0x6b3127[_0x8666('0x2e')]]={'$like':'%'+_0xb64e10[_0x8666('0x30')][_0x8666('0x3c')]+'%'};return _0x595ff8;}})});}_0x44ed12=_['merge']({},_0x44ed12,_0xb64e10[_0x8666('0x3f')]);var _0x4d24e4={'where':_0x44ed12[_0x8666('0x39')]};return db['OpenchannelApplication'][_0x8666('0x1c')](_0x4d24e4)[_0x8666('0x22')](function(_0x2ace5d){_0x463c1b[_0x8666('0x1c')]=_0x2ace5d;if(_0xb64e10[_0x8666('0x30')]['includeAll']){_0x44ed12['include']=[{'all':!![]}];}return db[_0x8666('0x27')][_0x8666('0x40')](_0x44ed12);})['then'](function(_0x24e7f2){_0x463c1b['rows']=_0x24e7f2;return _0x463c1b;})[_0x8666('0x22')](respondWithFilteredResult(_0x3832f7,_0x44ed12))['catch'](handleError(_0x3832f7,null));};exports[_0x8666('0x41')]=function(_0x163684,_0x33ab76){var _0x33d83c={'raw':!![],'where':{'id':_0x163684[_0x8666('0x42')]['id']}},_0x5ad1ee={};_0x5ad1ee[_0x8666('0x2c')]=_['keys'](db[_0x8666('0x27')]['rawAttributes']);_0x5ad1ee[_0x8666('0x30')]=_['keys'](_0x163684[_0x8666('0x30')]);_0x5ad1ee[_0x8666('0x3a')]=_[_0x8666('0x32')](_0x5ad1ee[_0x8666('0x2c')],_0x5ad1ee['query']);_0x33d83c[_0x8666('0x31')]=_[_0x8666('0x32')](_0x5ad1ee[_0x8666('0x2c')],qs[_0x8666('0x33')](_0x163684['query'][_0x8666('0x33')]));_0x33d83c[_0x8666('0x31')]=_0x33d83c[_0x8666('0x31')][_0x8666('0x34')]?_0x33d83c[_0x8666('0x31')]:_0x5ad1ee[_0x8666('0x2c')];if(_0x163684[_0x8666('0x30')][_0x8666('0x43')]){_0x33d83c[_0x8666('0x44')]=[{'all':!![]}];}_0x33d83c=_[_0x8666('0x3d')]({},_0x33d83c,_0x163684[_0x8666('0x3f')]);return db['OpenchannelApplication']['find'](_0x33d83c)[_0x8666('0x22')](handleEntityNotFound(_0x33ab76,null))[_0x8666('0x22')](respondWithResult(_0x33ab76,null))['catch'](handleError(_0x33ab76,null));};exports['create']=function(_0x4dff09,_0x4e6a71){return db[_0x8666('0x27')][_0x8666('0x45')](_0x4dff09['body'],{})[_0x8666('0x22')](respondWithResult(_0x4e6a71,0xc9))[_0x8666('0x46')](handleError(_0x4e6a71,null));};exports[_0x8666('0x47')]=function(_0x286b13,_0x1dc0c0){if(_0x286b13[_0x8666('0x48')]['id']){delete _0x286b13[_0x8666('0x48')]['id'];}return db[_0x8666('0x27')]['find']({'where':{'id':_0x286b13[_0x8666('0x42')]['id']}})[_0x8666('0x22')](handleEntityNotFound(_0x1dc0c0,null))[_0x8666('0x22')](saveUpdates(_0x286b13['body'],null))[_0x8666('0x22')](respondWithResult(_0x1dc0c0,null))['catch'](handleError(_0x1dc0c0,null));};exports[_0x8666('0x23')]=function(_0x517881,_0x2f0fa8){return db[_0x8666('0x27')][_0x8666('0x49')]({'where':{'id':_0x517881[_0x8666('0x42')]['id']}})[_0x8666('0x22')](handleEntityNotFound(_0x2f0fa8,null))[_0x8666('0x22')](removeEntity(_0x2f0fa8,null))['catch'](handleError(_0x2f0fa8,null));}; \ No newline at end of file +var _0x81f2=['count','set','Content-Range','json','apply','reject','save','update','then','stack','name','index','map','OpenchannelApplication','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit'];(function(_0x42c383,_0x5b92b6){var _0x4aba3b=function(_0x2bfba3){while(--_0x2bfba3){_0x42c383['push'](_0x42c383['shift']());}};_0x4aba3b(++_0x5b92b6);}(_0x81f2,0x74));var _0x281f=function(_0x11de69,_0x46c7c6){_0x11de69=_0x11de69-0x0;var _0x211379=_0x81f2[_0x11de69];return _0x211379;};'use strict';var emlformat=require(_0x281f('0x0'));var rimraf=require(_0x281f('0x1'));var zipdir=require(_0x281f('0x2'));var jsonpatch=require(_0x281f('0x3'));var rp=require('request-promise');var moment=require(_0x281f('0x4'));var BPromise=require(_0x281f('0x5'));var Mustache=require(_0x281f('0x6'));var util=require(_0x281f('0x7'));var path=require(_0x281f('0x8'));var sox=require(_0x281f('0x9'));var csv=require(_0x281f('0xa'));var ejs=require(_0x281f('0xb'));var fs=require('fs');var fs_extra=require(_0x281f('0xc'));var _=require(_0x281f('0xd'));var squel=require(_0x281f('0xe'));var crypto=require(_0x281f('0xf'));var jsforce=require(_0x281f('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x281f('0xa'));var querystring=require(_0x281f('0x11'));var Papa=require(_0x281f('0x12'));var Redis=require(_0x281f('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x281f('0x14'));var as=require(_0x281f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x281f('0x16'))(_0x281f('0x17'));var utils=require(_0x281f('0x18'));var config=require(_0x281f('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x281f('0x1a'))['db'];function respondWithStatusCode(_0x2c4b0a,_0x54716b){_0x54716b=_0x54716b||0xcc;return function(_0x533b7b){if(_0x533b7b){return _0x2c4b0a[_0x281f('0x1b')](_0x54716b);}return _0x2c4b0a[_0x281f('0x1c')](_0x54716b)['end']();};}function respondWithResult(_0x177e86,_0x58fe94){_0x58fe94=_0x58fe94||0xc8;return function(_0x344c66){if(_0x344c66){return _0x177e86['status'](_0x58fe94)['json'](_0x344c66);}};}function respondWithFilteredResult(_0x22f7c5,_0xaf1661){return function(_0x4c1e21){if(_0x4c1e21){var _0x2d3dfe=typeof _0xaf1661[_0x281f('0x1d')]===_0x281f('0x1e')&&typeof _0xaf1661[_0x281f('0x1f')]===_0x281f('0x1e');var _0x50fbc8=_0x4c1e21[_0x281f('0x20')];var _0x8511b0=_0x2d3dfe?0x0:_0xaf1661[_0x281f('0x1d')];var _0x17ffa0=_0x2d3dfe?_0x4c1e21[_0x281f('0x20')]:_0xaf1661[_0x281f('0x1d')]+_0xaf1661[_0x281f('0x1f')];var _0x1aab0e;if(_0x17ffa0>=_0x50fbc8){_0x17ffa0=_0x50fbc8;_0x1aab0e=0xc8;}else{_0x1aab0e=0xce;}_0x22f7c5['status'](_0x1aab0e);return _0x22f7c5[_0x281f('0x21')](_0x281f('0x22'),_0x8511b0+'-'+_0x17ffa0+'/'+_0x50fbc8)[_0x281f('0x23')](_0x4c1e21);}return null;};}function patchUpdates(_0x3b65e9){return function(_0x781182){try{jsonpatch[_0x281f('0x24')](_0x781182,_0x3b65e9,!![]);}catch(_0x3a2532){return BPromise[_0x281f('0x25')](_0x3a2532);}return _0x781182[_0x281f('0x26')]();};}function saveUpdates(_0x4d1b4d,_0x48879f){return function(_0x440ba1){if(_0x440ba1){return _0x440ba1[_0x281f('0x27')](_0x4d1b4d)[_0x281f('0x28')](function(_0x9f235a){return _0x9f235a;});}return null;};}function removeEntity(_0x1b9410,_0xadb44a){return function(_0x32224b){if(_0x32224b){return _0x32224b['destroy']()[_0x281f('0x28')](function(){_0x1b9410['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xc90d37,_0x19a426){return function(_0xb004f4){if(!_0xb004f4){_0xc90d37[_0x281f('0x1b')](0x194);}return _0xb004f4;};}function handleError(_0x1f02a4,_0x52863b){_0x52863b=_0x52863b||0x1f4;return function(_0x4967af){logger['error'](_0x4967af[_0x281f('0x29')]);if(_0x4967af[_0x281f('0x2a')]){delete _0x4967af['name'];}_0x1f02a4[_0x281f('0x1c')](_0x52863b)['send'](_0x4967af);};}exports[_0x281f('0x2b')]=function(_0x490d84,_0x7af41){var _0x27dbf6={},_0x393e9c={},_0x8839af={'count':0x0,'rows':[]};var _0x3c035f=_[_0x281f('0x2c')](db[_0x281f('0x2d')][_0x281f('0x2e')],function(_0x43bfef){return{'name':_0x43bfef[_0x281f('0x2f')],'type':_0x43bfef[_0x281f('0x30')]['key']};});_0x393e9c[_0x281f('0x31')]=_['map'](_0x3c035f,_0x281f('0x2a'));_0x393e9c['query']=_[_0x281f('0x32')](_0x490d84[_0x281f('0x33')]);_0x393e9c[_0x281f('0x34')]=_[_0x281f('0x35')](_0x393e9c[_0x281f('0x31')],_0x393e9c[_0x281f('0x33')]);_0x27dbf6[_0x281f('0x36')]=_[_0x281f('0x35')](_0x393e9c[_0x281f('0x31')],qs[_0x281f('0x37')](_0x490d84[_0x281f('0x33')]['fields']));_0x27dbf6[_0x281f('0x36')]=_0x27dbf6[_0x281f('0x36')][_0x281f('0x38')]?_0x27dbf6[_0x281f('0x36')]:_0x393e9c[_0x281f('0x31')];if(!_0x490d84['query'][_0x281f('0x39')]('nolimit')){_0x27dbf6[_0x281f('0x1f')]=qs['limit'](_0x490d84['query']['limit']);_0x27dbf6[_0x281f('0x1d')]=qs[_0x281f('0x1d')](_0x490d84[_0x281f('0x33')][_0x281f('0x1d')]);}_0x27dbf6['order']=qs['sort'](_0x490d84['query'][_0x281f('0x3a')]);_0x27dbf6[_0x281f('0x3b')]=qs[_0x281f('0x34')](_[_0x281f('0x3c')](_0x490d84[_0x281f('0x33')],_0x393e9c[_0x281f('0x34')]),_0x3c035f);if(_0x490d84[_0x281f('0x33')][_0x281f('0x3d')]){_0x27dbf6[_0x281f('0x3b')]=_[_0x281f('0x3e')](_0x27dbf6[_0x281f('0x3b')],{'$or':_[_0x281f('0x2c')](_0x3c035f,function(_0x2b6047){if(_0x2b6047[_0x281f('0x30')]!==_0x281f('0x3f')){var _0x4693d0={};_0x4693d0[_0x2b6047['name']]={'$like':'%'+_0x490d84['query'][_0x281f('0x3d')]+'%'};return _0x4693d0;}})});}_0x27dbf6=_['merge']({},_0x27dbf6,_0x490d84[_0x281f('0x40')]);var _0x3e3f7e={'where':_0x27dbf6[_0x281f('0x3b')]};return db['OpenchannelApplication'][_0x281f('0x20')](_0x3e3f7e)[_0x281f('0x28')](function(_0xcb8ccc){_0x8839af[_0x281f('0x20')]=_0xcb8ccc;if(_0x490d84[_0x281f('0x33')][_0x281f('0x41')]){_0x27dbf6['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0x281f('0x42')](_0x27dbf6);})['then'](function(_0x22d0b6){_0x8839af['rows']=_0x22d0b6;return _0x8839af;})[_0x281f('0x28')](respondWithFilteredResult(_0x7af41,_0x27dbf6))[_0x281f('0x43')](handleError(_0x7af41,null));};exports[_0x281f('0x44')]=function(_0x29d935,_0x1a1158){var _0x5ab695={'raw':!![],'where':{'id':_0x29d935[_0x281f('0x45')]['id']}},_0x4cc6ce={};_0x4cc6ce['model']=_[_0x281f('0x32')](db[_0x281f('0x2d')][_0x281f('0x2e')]);_0x4cc6ce[_0x281f('0x33')]=_[_0x281f('0x32')](_0x29d935['query']);_0x4cc6ce[_0x281f('0x34')]=_[_0x281f('0x35')](_0x4cc6ce[_0x281f('0x31')],_0x4cc6ce['query']);_0x5ab695['attributes']=_[_0x281f('0x35')](_0x4cc6ce[_0x281f('0x31')],qs[_0x281f('0x37')](_0x29d935[_0x281f('0x33')][_0x281f('0x37')]));_0x5ab695[_0x281f('0x36')]=_0x5ab695[_0x281f('0x36')]['length']?_0x5ab695[_0x281f('0x36')]:_0x4cc6ce[_0x281f('0x31')];if(_0x29d935[_0x281f('0x33')][_0x281f('0x41')]){_0x5ab695[_0x281f('0x46')]=[{'all':!![]}];}_0x5ab695=_[_0x281f('0x3e')]({},_0x5ab695,_0x29d935['options']);return db[_0x281f('0x2d')][_0x281f('0x47')](_0x5ab695)[_0x281f('0x28')](handleEntityNotFound(_0x1a1158,null))[_0x281f('0x28')](respondWithResult(_0x1a1158,null))[_0x281f('0x43')](handleError(_0x1a1158,null));};exports['create']=function(_0x5f12d,_0x10c134){return db[_0x281f('0x2d')]['create'](_0x5f12d[_0x281f('0x48')],{})['then'](respondWithResult(_0x10c134,0xc9))[_0x281f('0x43')](handleError(_0x10c134,null));};exports[_0x281f('0x27')]=function(_0x26cb34,_0x24687a){if(_0x26cb34[_0x281f('0x48')]['id']){delete _0x26cb34[_0x281f('0x48')]['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x26cb34[_0x281f('0x45')]['id']}})[_0x281f('0x28')](handleEntityNotFound(_0x24687a,null))[_0x281f('0x28')](saveUpdates(_0x26cb34[_0x281f('0x48')],null))[_0x281f('0x28')](respondWithResult(_0x24687a,null))[_0x281f('0x43')](handleError(_0x24687a,null));};exports[_0x281f('0x49')]=function(_0x3bef8a,_0x1e41ef){return db['OpenchannelApplication']['find']({'where':{'id':_0x3bef8a[_0x281f('0x45')]['id']}})['then'](handleEntityNotFound(_0x1e41ef,null))['then'](removeEntity(_0x1e41ef,null))[_0x281f('0x43')](handleError(_0x1e41ef,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 8f49eb1..eb58b5c 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 _0xe9cb=['openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util','moment','request-promise','path','../../config/environment','OpenchannelApplication'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0xe9cb,0xc0));var _0xbe9c=function(_0x459c09,_0x596ed4){_0x459c09=_0x459c09-0x0;var _0x2aee20=_0xe9cb[_0x459c09];return _0x2aee20;};'use strict';var _=require('lodash');var util=require(_0xbe9c('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xbe9c('0x1'));var BPromise=require('bluebird');var rp=require(_0xbe9c('0x2'));var fs=require('fs');var path=require(_0xbe9c('0x3'));var rimraf=require('rimraf');var config=require(_0xbe9c('0x4'));var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x19a3d5,_0x2f050d){return _0x19a3d5['define'](_0xbe9c('0x5'),attributes,{'tableName':_0xbe9c('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbe9c('0x7'),'collate':_0xbe9c('0x8')});}; \ No newline at end of file +var _0x710f=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','openchannel_applications','utf8mb4_unicode_ci'];(function(_0x33c637,_0x597c26){var _0x14aa20=function(_0x32a8b5){while(--_0x32a8b5){_0x33c637['push'](_0x33c637['shift']());}};_0x14aa20(++_0x597c26);}(_0x710f,0xb6));var _0xf710=function(_0x107e20,_0x4ce097){_0x107e20=_0x107e20-0x0;var _0x527f30=_0x710f[_0x107e20];return _0x527f30;};'use strict';var _=require(_0xf710('0x0'));var util=require(_0xf710('0x1'));var logger=require(_0xf710('0x2'))(_0xf710('0x3'));var moment=require(_0xf710('0x4'));var BPromise=require(_0xf710('0x5'));var rp=require(_0xf710('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf710('0x7'));var config=require(_0xf710('0x8'));var attributes=require('./openchannelApplication.attributes');module[_0xf710('0x9')]=function(_0x30213c,_0x82c179){return _0x30213c[_0xf710('0xa')]('OpenchannelApplication',attributes,{'tableName':_0xf710('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf710('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index f382a1f..bd04b20 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 _0x0bdf=['message','info','result','catch','OpenchannelApplication','update','options','raw','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x25a63d,_0x21599a){var _0x3230ef=function(_0x1944f8){while(--_0x1944f8){_0x25a63d['push'](_0x25a63d['shift']());}};_0x3230ef(++_0x21599a);}(_0x0bdf,0x1ab));var _0xf0bd=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x0bdf[_0x465028];return _0xb783d4;};'use strict';var _=require(_0xf0bd('0x0'));var util=require(_0xf0bd('0x1'));var moment=require(_0xf0bd('0x2'));var BPromise=require('bluebird');var rs=require(_0xf0bd('0x3'));var fs=require('fs');var Redis=require(_0xf0bd('0x4'));var db=require(_0xf0bd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0bd('0x6'))(_0xf0bd('0x7'));var config=require(_0xf0bd('0x8'));var jayson=require(_0xf0bd('0x9'));var client=jayson[_0xf0bd('0xa')][_0xf0bd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c4e0f,_0x452867,_0x2ec439){return new BPromise(function(_0x881746,_0x80054f){return client[_0xf0bd('0xc')](_0x5c4e0f,_0x2ec439)[_0xf0bd('0xd')](function(_0x5e4773){logger['info'](_0xf0bd('0xe'),_0x452867,_0xf0bd('0xf'));logger[_0xf0bd('0x10')](_0xf0bd('0x11'),_0x452867,'request\x20sent',JSON[_0xf0bd('0x12')](_0x5e4773));if(_0x5e4773[_0xf0bd('0x13')]){if(_0x5e4773[_0xf0bd('0x13')][_0xf0bd('0x14')]===0x1f4){logger[_0xf0bd('0x13')](_0xf0bd('0xe'),_0x452867,_0x5e4773[_0xf0bd('0x13')][_0xf0bd('0x15')]);return _0x80054f(_0x5e4773[_0xf0bd('0x13')]['message']);}logger[_0xf0bd('0x13')]('OpenchannelApplication,\x20%s,\x20%s',_0x452867,_0x5e4773['error'][_0xf0bd('0x15')]);return _0x881746(_0x5e4773['error']['message']);}else{logger[_0xf0bd('0x16')](_0xf0bd('0xe'),_0x452867,_0xf0bd('0xf'));_0x881746(_0x5e4773[_0xf0bd('0x17')][_0xf0bd('0x15')]);}})[_0xf0bd('0x18')](function(_0x26cd47){logger[_0xf0bd('0x13')](_0xf0bd('0xe'),_0x452867,_0x26cd47);_0x80054f(_0x26cd47);});});}exports['UpdateOpenchannelApplication']=function(_0x30dc27){var _0x4d34d0=this;return new Promise(function(_0x5a1bf3,_0x1a5349){return db[_0xf0bd('0x19')][_0xf0bd('0x1a')](_0x30dc27['body'],{'raw':_0x30dc27[_0xf0bd('0x1b')]?_0x30dc27[_0xf0bd('0x1b')][_0xf0bd('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30dc27['options']?_0x30dc27[_0xf0bd('0x1b')][_0xf0bd('0x1d')]||null:null,'attributes':_0x30dc27['options']?_0x30dc27['options'][_0xf0bd('0x1e')]||null:null,'limit':_0x30dc27[_0xf0bd('0x1b')]?_0x30dc27['options'][_0xf0bd('0x1f')]||null:null})[_0xf0bd('0xd')](function(_0x3b0f22){logger['info']('UpdateOpenchannelApplication',_0x30dc27);logger[_0xf0bd('0x10')]('UpdateOpenchannelApplication',_0x30dc27,JSON[_0xf0bd('0x12')](_0x3b0f22));_0x5a1bf3(_0x3b0f22);})[_0xf0bd('0x18')](function(_0x457d96){logger[_0xf0bd('0x13')]('UpdateOpenchannelApplication',_0x457d96[_0xf0bd('0x15')],_0x30dc27);_0x1a5349(_0x4d34d0['error'](0x1f4,_0x457d96[_0xf0bd('0x15')]));});});}; \ No newline at end of file +var _0xf425=['body','options','raw','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','OpenchannelApplication,\x20%s,\x20%s','message','catch','UpdateOpenchannelApplication','update'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xf425,0x13c));var _0x5f42=function(_0x14a516,_0x5dee29){_0x14a516=_0x14a516-0x0;var _0x51a308=_0xf425[_0x14a516];return _0x51a308;};'use strict';var _=require(_0x5f42('0x0'));var util=require(_0x5f42('0x1'));var moment=require('moment');var BPromise=require(_0x5f42('0x2'));var rs=require(_0x5f42('0x3'));var fs=require('fs');var Redis=require(_0x5f42('0x4'));var db=require(_0x5f42('0x5'))['db'];var utils=require(_0x5f42('0x6'));var logger=require(_0x5f42('0x7'))('rpc');var config=require(_0x5f42('0x8'));var jayson=require(_0x5f42('0x9'));var client=jayson[_0x5f42('0xa')][_0x5f42('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10e844,_0x3e3355,_0x2182a9){return new BPromise(function(_0x1fda95,_0x511bab){return client[_0x5f42('0xc')](_0x10e844,_0x2182a9)[_0x5f42('0xd')](function(_0x56e965){logger[_0x5f42('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0x3e3355,'request\x20sent');logger[_0x5f42('0xf')](_0x5f42('0x10'),_0x3e3355,_0x5f42('0x11'),JSON[_0x5f42('0x12')](_0x56e965));if(_0x56e965[_0x5f42('0x13')]){if(_0x56e965[_0x5f42('0x13')]['code']===0x1f4){logger[_0x5f42('0x13')](_0x5f42('0x14'),_0x3e3355,_0x56e965[_0x5f42('0x13')][_0x5f42('0x15')]);return _0x511bab(_0x56e965[_0x5f42('0x13')][_0x5f42('0x15')]);}logger[_0x5f42('0x13')](_0x5f42('0x14'),_0x3e3355,_0x56e965[_0x5f42('0x13')][_0x5f42('0x15')]);return _0x1fda95(_0x56e965['error'][_0x5f42('0x15')]);}else{logger[_0x5f42('0xe')](_0x5f42('0x14'),_0x3e3355,'request\x20sent');_0x1fda95(_0x56e965['result']['message']);}})[_0x5f42('0x16')](function(_0xec3264){logger[_0x5f42('0x13')](_0x5f42('0x14'),_0x3e3355,_0xec3264);_0x511bab(_0xec3264);});});}exports[_0x5f42('0x17')]=function(_0x2d6001){var _0x45823f=this;return new Promise(function(_0x24b229,_0x399f12){return db['OpenchannelApplication'][_0x5f42('0x18')](_0x2d6001[_0x5f42('0x19')],{'raw':_0x2d6001[_0x5f42('0x1a')]?_0x2d6001[_0x5f42('0x1a')][_0x5f42('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d6001[_0x5f42('0x1a')]?_0x2d6001[_0x5f42('0x1a')][_0x5f42('0x1c')]||null:null,'attributes':_0x2d6001[_0x5f42('0x1a')]?_0x2d6001[_0x5f42('0x1a')][_0x5f42('0x1d')]||null:null,'limit':_0x2d6001['options']?_0x2d6001[_0x5f42('0x1a')][_0x5f42('0x1e')]||null:null})[_0x5f42('0xd')](function(_0x221038){logger[_0x5f42('0xe')](_0x5f42('0x17'),_0x2d6001);logger[_0x5f42('0xf')](_0x5f42('0x17'),_0x2d6001,JSON['stringify'](_0x221038));_0x24b229(_0x221038);})[_0x5f42('0x16')](function(_0x26a3d7){logger[_0x5f42('0x13')](_0x5f42('0x17'),_0x26a3d7[_0x5f42('0x15')],_0x2d6001);_0x399f12(_0x45823f['error'](0x1f4,_0x26a3d7['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 9066c2d..aa19799 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 _0x29bb=['express','Router','fs-extra','../../components/interaction/service','isAuthenticated','get','/describe','describe','show','/:id/messages','post','create','addMessage','tracked','openchannel','put','/:id','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','/:id/tags','removeTags','multer','util','connect-timeout'];(function(_0x1e82f2,_0x57120e){var _0x1ccad9=function(_0x25dd1c){while(--_0x25dd1c){_0x1e82f2['push'](_0x1e82f2['shift']());}};_0x1ccad9(++_0x57120e);}(_0x29bb,0x15c));var _0xb29b=function(_0x49f09f,_0x1d5542){_0x49f09f=_0x49f09f-0x0;var _0x50569b=_0x29bb[_0x49f09f];return _0x50569b;};'use strict';var multer=require(_0xb29b('0x0'));var util=require(_0xb29b('0x1'));var path=require('path');var timeout=require(_0xb29b('0x2'));var express=require(_0xb29b('0x3'));var router=express[_0xb29b('0x4')]();var fs_extra=require(_0xb29b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb29b('0x6'));var config=require('../../config/environment');var controller=require('./openchannelInteraction.controller');router['get']('/',auth[_0xb29b('0x7')](),controller['index']);router[_0xb29b('0x8')](_0xb29b('0x9'),auth[_0xb29b('0x7')](),controller[_0xb29b('0xa')]);router[_0xb29b('0x8')]('/:id',auth[_0xb29b('0x7')](),controller[_0xb29b('0xb')]);router['get'](_0xb29b('0xc'),auth[_0xb29b('0x7')](),controller['getMessages']);router[_0xb29b('0x8')]('/:id/download',auth[_0xb29b('0x7')](),controller['download']);router[_0xb29b('0xd')]('/',auth[_0xb29b('0x7')](),controller[_0xb29b('0xe')]);router[_0xb29b('0xd')](_0xb29b('0xc'),auth['isAuthenticated'](),controller[_0xb29b('0xf')]);router[_0xb29b('0xd')]('/:id/tags',auth[_0xb29b('0x7')](),interaction[_0xb29b('0x10')](_0xb29b('0x11'),'openchannelinteraction:addtags'),controller['addTags']);router[_0xb29b('0x12')](_0xb29b('0x13'),auth['isAuthenticated'](),interaction['tracked']('openchannel',_0xb29b('0x14')),controller[_0xb29b('0x15')]);router[_0xb29b('0x16')](_0xb29b('0x13'),auth['isAuthenticated'](),interaction['tracked']('openchannel',_0xb29b('0x17')),controller[_0xb29b('0x18')]);router['delete'](_0xb29b('0x19'),auth[_0xb29b('0x7')](),controller[_0xb29b('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x6afb=['openchannelinteraction:addtags','addTags','put','update','delete','openchannelinteraction:destroy','removeTags','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','/describe','/:id','show','/:id/messages','/:id/download','create','post','addMessage','/:id/tags','tracked','openchannel'];(function(_0x39bfa5,_0x255e1e){var _0x1ebe18=function(_0x23e50a){while(--_0x23e50a){_0x39bfa5['push'](_0x39bfa5['shift']());}};_0x1ebe18(++_0x255e1e);}(_0x6afb,0x174));var _0xb6af=function(_0x358df5,_0x2d31af){_0x358df5=_0x358df5-0x0;var _0x3727b2=_0x6afb[_0x358df5];return _0x3727b2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb6af('0x0'));var timeout=require(_0xb6af('0x1'));var express=require(_0xb6af('0x2'));var router=express[_0xb6af('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb6af('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb6af('0x5'));var controller=require(_0xb6af('0x6'));router[_0xb6af('0x7')]('/',auth[_0xb6af('0x8')](),controller['index']);router[_0xb6af('0x7')](_0xb6af('0x9'),auth[_0xb6af('0x8')](),controller['describe']);router['get'](_0xb6af('0xa'),auth[_0xb6af('0x8')](),controller[_0xb6af('0xb')]);router[_0xb6af('0x7')](_0xb6af('0xc'),auth[_0xb6af('0x8')](),controller['getMessages']);router[_0xb6af('0x7')](_0xb6af('0xd'),auth[_0xb6af('0x8')](),controller['download']);router['post']('/',auth[_0xb6af('0x8')](),controller[_0xb6af('0xe')]);router[_0xb6af('0xf')](_0xb6af('0xc'),auth[_0xb6af('0x8')](),controller[_0xb6af('0x10')]);router[_0xb6af('0xf')](_0xb6af('0x11'),auth[_0xb6af('0x8')](),interaction[_0xb6af('0x12')](_0xb6af('0x13'),_0xb6af('0x14')),controller[_0xb6af('0x15')]);router[_0xb6af('0x16')](_0xb6af('0xa'),auth[_0xb6af('0x8')](),interaction[_0xb6af('0x12')](_0xb6af('0x13'),'openchannelinteraction:update'),controller[_0xb6af('0x17')]);router[_0xb6af('0x18')](_0xb6af('0xa'),auth[_0xb6af('0x8')](),interaction[_0xb6af('0x12')](_0xb6af('0x13'),_0xb6af('0x19')),controller['destroy']);router['delete'](_0xb6af('0x11'),auth[_0xb6af('0x8')](),controller[_0xb6af('0x1a')]);module[_0xb6af('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index d2e803a..744a6db 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 _0x86dd=['DATE','STRING','ENUM','out','exports'];(function(_0xda6478,_0x53163c){var _0x2ff8ce=function(_0x401b80){while(--_0x401b80){_0xda6478['push'](_0xda6478['shift']());}};_0x2ff8ce(++_0x53163c);}(_0x86dd,0x1ee));var _0xd86d=function(_0x2303e1,_0x270550){_0x2303e1=_0x2303e1-0x0;var _0x4d51c6=_0x86dd[_0x2303e1];return _0x4d51c6;};'use strict';var Sequelize=require('sequelize');module[_0xd86d('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd86d('0x1')]},'disposition':{'type':Sequelize[_0xd86d('0x2')]},'secondDisposition':{'type':Sequelize[_0xd86d('0x2')]},'thirdDisposition':{'type':Sequelize[_0xd86d('0x2')]},'note':{'type':Sequelize[_0xd86d('0x2')]},'read1stAt':{'type':Sequelize[_0xd86d('0x1')]},'threadId':{'type':Sequelize[_0xd86d('0x2')]},'externalUrl':{'type':Sequelize[_0xd86d('0x2')]},'lastMsgAt':{'type':Sequelize[_0xd86d('0x1')]},'lastMsgDirection':{'type':Sequelize[_0xd86d('0x3')]('in',_0xd86d('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xd86d('0x2')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x3561=['DATE','STRING','ENUM','out','sequelize','BOOLEAN'];(function(_0x23f80d,_0x318cb9){var _0x4d7787=function(_0x4baf43){while(--_0x4baf43){_0x23f80d['push'](_0x23f80d['shift']());}};_0x4d7787(++_0x318cb9);}(_0x3561,0x94));var _0x1356=function(_0x15655e,_0x251dae){_0x15655e=_0x15655e-0x0;var _0x614358=_0x3561[_0x15655e];return _0x614358;};'use strict';var Sequelize=require(_0x1356('0x0'));module['exports']={'closed':{'type':Sequelize[_0x1356('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1356('0x2')]},'disposition':{'type':Sequelize[_0x1356('0x3')]},'secondDisposition':{'type':Sequelize[_0x1356('0x3')]},'thirdDisposition':{'type':Sequelize[_0x1356('0x3')]},'note':{'type':Sequelize[_0x1356('0x3')]},'read1stAt':{'type':Sequelize[_0x1356('0x2')]},'threadId':{'type':Sequelize[_0x1356('0x3')]},'externalUrl':{'type':Sequelize[_0x1356('0x3')]},'lastMsgAt':{'type':Sequelize[_0x1356('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x1356('0x4')]('in',_0x1356('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x1356('0x3')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index ce26197..e977975 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 _0xcca7=['mkdirSync','Openchannel','N.A.','closedAt','Private','basename','existsSync','createReadStream','pipe','out','System','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','sendStatus','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','stack','send','map','fullname','TagIds','Tags','split','forEach','push','catch','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','name','keys','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','sqlOperator','find','unreadMessages','value','having','`\x20=\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','UserId','buildExpression','start','some','compact','isEmpty','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','agent','user','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','keyBy','merge','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','toString','groupBy','OpenchannelInteractionId','rows','show','params','includeAll','options','create','body','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','spread','color','emit','openchannelInteractionTags:save','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','Messages','direction','OpenchannelAccount','Account','Owner'];(function(_0x4a14d9,_0x5caaf6){var _0x1afc25=function(_0x4b96ef){while(--_0x4b96ef){_0x4a14d9['push'](_0x4a14d9['shift']());}};_0x1afc25(++_0x5caaf6);}(_0xcca7,0xff));var _0x7cca=function(_0x552cb2,_0x503b9a){_0x552cb2=_0x552cb2-0x0;var _0xc5a7ca=_0xcca7[_0x552cb2];return _0xc5a7ca;};'use strict';var emlformat=require(_0x7cca('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7cca('0x1'));var rp=require(_0x7cca('0x2'));var moment=require(_0x7cca('0x3'));var BPromise=require(_0x7cca('0x4'));var Mustache=require(_0x7cca('0x5'));var util=require('util');var path=require(_0x7cca('0x6'));var sox=require(_0x7cca('0x7'));var csv=require(_0x7cca('0x8'));var ejs=require(_0x7cca('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7cca('0xa'));var squel=require(_0x7cca('0xb'));var crypto=require(_0x7cca('0xc'));var jsforce=require(_0x7cca('0xd'));var deskjs=require(_0x7cca('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7cca('0xf'));var Papa=require(_0x7cca('0x10'));var Redis=require(_0x7cca('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7cca('0x12'));var as=require(_0x7cca('0x13'));var pdf=require(_0x7cca('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7cca('0x15'))(_0x7cca('0x16'));var utils=require(_0x7cca('0x17'));var config=require(_0x7cca('0x18'));var licenseUtil=require(_0x7cca('0x19'));var db=require(_0x7cca('0x1a'))['db'];config['redis']=_[_0x7cca('0x1b')](config[_0x7cca('0x1c')],{'host':_0x7cca('0x1d'),'port':0x18eb});var socket=require(_0x7cca('0x1e'))(new Redis(config[_0x7cca('0x1c')]));require(_0x7cca('0x1f'))[_0x7cca('0x20')](socket);function respondWithStatusCode(_0x15532d,_0x43f116){_0x43f116=_0x43f116||0xcc;return function(_0xcec626){if(_0xcec626){return _0x15532d['sendStatus'](_0x43f116);}return _0x15532d['status'](_0x43f116)[_0x7cca('0x21')]();};}function respondWithResult(_0x5e6753,_0x2448e9){_0x2448e9=_0x2448e9||0xc8;return function(_0x154942){if(_0x154942){return _0x5e6753[_0x7cca('0x22')](_0x2448e9)[_0x7cca('0x23')](_0x154942);}};}function respondWithFilteredResult(_0x29cc51,_0x141c2d){return function(_0x3a1af6){if(_0x3a1af6){var _0x4c706a=typeof _0x141c2d[_0x7cca('0x24')]==='undefined'&&typeof _0x141c2d[_0x7cca('0x25')]===_0x7cca('0x26');var _0x4d8c52=_0x3a1af6[_0x7cca('0x27')];var _0xc54424=_0x4c706a?0x0:_0x141c2d[_0x7cca('0x24')];var _0x248340=_0x4c706a?_0x3a1af6[_0x7cca('0x27')]:_0x141c2d[_0x7cca('0x24')]+_0x141c2d[_0x7cca('0x25')];var _0x422875;if(_0x248340>=_0x4d8c52){_0x248340=_0x4d8c52;_0x422875=0xc8;}else{_0x422875=0xce;}_0x29cc51[_0x7cca('0x22')](_0x422875);return _0x29cc51[_0x7cca('0x28')](_0x7cca('0x29'),_0xc54424+'-'+_0x248340+'/'+_0x4d8c52)['json'](_0x3a1af6);}return null;};}function patchUpdates(_0x54b5dc){return function(_0x488758){try{jsonpatch[_0x7cca('0x2a')](_0x488758,_0x54b5dc,!![]);}catch(_0x3f7c55){return BPromise['reject'](_0x3f7c55);}return _0x488758[_0x7cca('0x2b')]();};}function saveUpdates(_0x2192c2,_0x403026){return function(_0x21e066){if(_0x21e066){return _0x21e066[_0x7cca('0x2c')](_0x2192c2)[_0x7cca('0x2d')](function(_0x526021){return _0x526021;});}return null;};}function removeEntity(_0x1fb343,_0x3259ef){return function(_0x5ea65b){if(_0x5ea65b){return _0x5ea65b[_0x7cca('0x2e')]()['then'](function(){_0x1fb343['status'](0xcc)[_0x7cca('0x21')]();});}};}function handleEntityNotFound(_0x62b1ab,_0x541175){return function(_0x4133e7){if(!_0x4133e7){_0x62b1ab['sendStatus'](0x194);}return _0x4133e7;};}function handleError(_0x30e536,_0x3d29c9){_0x3d29c9=_0x3d29c9||0x1f4;return function(_0x3c568a){logger['error'](_0x3c568a[_0x7cca('0x2f')]);if(_0x3c568a['name']){delete _0x3c568a['name'];}_0x30e536[_0x7cca('0x22')](_0x3d29c9)[_0x7cca('0x30')](_0x3c568a);};}function getInteractionUsers(_0x51ec60,_0x2e7202){return new BPromise(function(_0x170e62,_0xcb4422){try{if(_0x2e7202[_0x51ec60['id']]){_0x51ec60['Users']=_[_0x7cca('0x31')](_0x2e7202[_0x51ec60['id']],function(_0x2af021){return{'id':_0x2af021['id'],'fullname':_0x2af021[_0x7cca('0x32')]};});}}catch(_0x181497){_0xcb4422(_0x181497);}_0x170e62(_0x51ec60);});}function getInteractionTags(_0x24b606,_0x3c6c96){return new BPromise(function(_0x3330b4,_0x34c0dc){try{if(_0x24b606[_0x7cca('0x33')]){_0x24b606[_0x7cca('0x34')]=[];_0x24b606[_0x7cca('0x33')][_0x7cca('0x35')](',')[_0x7cca('0x36')](function(_0x228c2f){_0x24b606['Tags'][_0x7cca('0x37')](_0x3c6c96[_0x228c2f]);});}delete _0x24b606[_0x7cca('0x33')];}catch(_0x22dbbd){_0x34c0dc(_0x22dbbd);}_0x3330b4(_0x24b606);});}function updateOpenchannelInteraction(_0x16af60,_0x5ae13d,_0x41e9c7){return new BPromise(function(_0x9cdb55,_0x5a8e1e){return getInteractionUsers(_0x16af60,_0x41e9c7)[_0x7cca('0x2d')](function(_0x5a7a59){return getInteractionTags(_0x5a7a59,_0x5ae13d);})[_0x7cca('0x2d')](function(_0x9d06ec){_0x9cdb55(_0x9d06ec);})[_0x7cca('0x38')](function(_0x416553){_0x5a8e1e(_0x416553);});});}exports[_0x7cca('0x39')]=function(_0x3fe17c,_0x4c164f){var _0x23ffdf={},_0x9289c2={},_0x159f3a={'count':0x0,'rows':[]};var _0x4f0da1=_[_0x7cca('0x31')](db[_0x7cca('0x3a')][_0x7cca('0x3b')],function(_0xafb3b0){return{'name':_0xafb3b0[_0x7cca('0x3c')],'type':_0xafb3b0[_0x7cca('0x3d')][_0x7cca('0x3e')]};});_0x9289c2['model']=_[_0x7cca('0x31')](_0x4f0da1,_0x7cca('0x3f'));_0x9289c2['query']=_[_0x7cca('0x40')](_0x3fe17c[_0x7cca('0x41')]);_0x9289c2[_0x7cca('0x42')]=_['intersection'](_0x9289c2['model'],_0x9289c2[_0x7cca('0x41')]);_0x23ffdf[_0x7cca('0x43')]=_[_0x7cca('0x44')](_0x9289c2[_0x7cca('0x45')],qs[_0x7cca('0x46')](_0x3fe17c[_0x7cca('0x41')]['fields']));_0x23ffdf[_0x7cca('0x43')]=_0x23ffdf[_0x7cca('0x43')][_0x7cca('0x47')]?_0x23ffdf['attributes']:_0x9289c2[_0x7cca('0x45')];if(!_0x3fe17c['query'][_0x7cca('0x48')](_0x7cca('0x49'))){_0x23ffdf['limit']=qs[_0x7cca('0x25')](_0x3fe17c['query'][_0x7cca('0x25')]);_0x23ffdf[_0x7cca('0x24')]=qs[_0x7cca('0x24')](_0x3fe17c[_0x7cca('0x41')][_0x7cca('0x24')]);}_0x23ffdf[_0x7cca('0x4a')]=qs[_0x7cca('0x4b')](_0x3fe17c['query']['sort']);_0x23ffdf[_0x7cca('0x4c')]=qs[_0x7cca('0x42')](_[_0x7cca('0x4d')](_0x3fe17c[_0x7cca('0x41')],_0x9289c2['filters']),_0x4f0da1);var _0x47cb57=[];var _0x4ea2d9=squel[_0x7cca('0x4e')]()[_0x7cca('0x4f')]('id')[_0x7cca('0x4f')](_0x7cca('0x3f'))['field']('color')[_0x7cca('0x50')](_0x7cca('0x51'));var _0x4b0d5d=squel[_0x7cca('0x4e')]()[_0x7cca('0x4f')](_0x7cca('0x52'))[_0x7cca('0x4f')](_0x7cca('0x53'))[_0x7cca('0x4f')](_0x7cca('0x54'))[_0x7cca('0x50')]('user_has_openchannel_interactions','ui')[_0x7cca('0x55')](_0x7cca('0x56'),'u',_0x7cca('0x57'));var _0x18fae1=squel[_0x7cca('0x4e')]()[_0x7cca('0x50')](_0x7cca('0x58'),'i')[_0x7cca('0x55')](_0x7cca('0x59'),'c',_0x7cca('0x5a'))['left_join'](_0x7cca('0x56'),'o',_0x7cca('0x5b'))[_0x7cca('0x55')]('openchannel_accounts','a',_0x7cca('0x5c'))[_0x7cca('0x55')](_0x7cca('0x5d'),'me',_0x7cca('0x5e'))['left_join']('openchannel_interaction_has_tags','it',_0x7cca('0x5f'))[_0x7cca('0x55')](_0x7cca('0x51'),'t','t.id\x20=\x20it.TagId');var _0x41811f=squel[_0x7cca('0x60')]();var _0x40b158=[];var _0x37fa40=squel[_0x7cca('0x60')]();var _0x3bfe31;if(_0x3fe17c[_0x7cca('0x41')][_0x7cca('0x61')]){_0x3bfe31=as['parseSearch'](_0x3fe17c[_0x7cca('0x41')][_0x7cca('0x61')]);var _0x6c1394=_0x3bfe31[_0x7cca('0x62')];for(var _0x277249=0x0;_0x277249<_0x3bfe31['conditions'][_0x7cca('0x47')];_0x277249++){var _0x39860d=_0x3bfe31['conditions'][_0x277249];var _0x28a3d1='i';var _0x4784ed=_[_0x7cca('0x63')](_0x4f0da1,[_0x7cca('0x3f'),_0x39860d[_0x7cca('0x4f')]]);if(!_0x4784ed){switch(_0x39860d[_0x7cca('0x4f')]){case _0x7cca('0x64'):if(_0x39860d[_0x7cca('0x65')]==0x1){_0x18fae1[_0x7cca('0x66')]('`'+_0x39860d[_0x7cca('0x4f')]+_0x7cca('0x67'));}else{_0x18fae1[_0x7cca('0x66')]('`'+_0x39860d['field']+'`\x20>\x200');}break;case _0x7cca('0x68'):if(_0x39860d['operator']===_0x7cca('0x69')){if(_0x39860d['value'][_0x7cca('0x35')]('\x20')['length']>0x1){_0x41811f[_0x6c1394](_0x7cca('0x6a'),qs[_0x7cca('0x6b')](_0x39860d[_0x7cca('0x65')]),null);}else{var _0x1db0ca='%'+_0x39860d[_0x7cca('0x65')]+'%';_0x41811f[_0x6c1394](_0x7cca('0x6c'),_0x1db0ca,_0x1db0ca,_0x1db0ca);}}else{_0x4784ed=_[_0x7cca('0x63')](_0x4f0da1,[_0x7cca('0x3f'),_0x7cca('0x6d')]);_0x39860d[_0x7cca('0x4f')]=_0x7cca('0x6d');_0x1e9480=as['buildExpression'](_0x28a3d1,_0x4784ed[_0x7cca('0x3d')],_0x39860d);_0x41811f[_0x6c1394](_0x1e9480[_0x7cca('0x6e')],_0x1e9480[_0x7cca('0x65')]['start'],_0x1e9480[_0x7cca('0x65')][_0x7cca('0x21')]);}break;case _0x7cca('0x6f'):var _0x2d441f=_0x39860d[_0x7cca('0x65')]['split'](',')[_0x7cca('0x31')](function(_0x5d57ab){return Number(_0x5d57ab);});_0x2d441f[_0x7cca('0x36')](function(_0x280c3f){_0x37fa40['or'](_0x7cca('0x70'),'%,'+_0x280c3f+',%');});_0x40b158=_[_0x7cca('0x71')](_0x40b158,_0x2d441f);break;case _0x7cca('0x72'):if(_0x39860d[_0x7cca('0x73')]===_0x7cca('0x69')){_0x41811f[_0x6c1394]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x39860d[_0x7cca('0x65')]+'%',null);}else{_0x4784ed=_[_0x7cca('0x63')](_0x4f0da1,[_0x7cca('0x3f'),_0x7cca('0x74')]);_0x39860d['field']=_0x7cca('0x74');_0x1e9480=as[_0x7cca('0x75')](_0x28a3d1,_0x4784ed[_0x7cca('0x3d')],_0x39860d);_0x41811f[_0x6c1394](_0x1e9480[_0x7cca('0x6e')],_0x1e9480[_0x7cca('0x65')][_0x7cca('0x76')],_0x1e9480['value'][_0x7cca('0x21')]);}break;case'body':_0x1e9480=as[_0x7cca('0x75')]('me',null,_0x39860d);_0x41811f[_0x6c1394](_0x1e9480['text'],_0x1e9480[_0x7cca('0x65')][_0x7cca('0x76')],_0x1e9480[_0x7cca('0x65')][_0x7cca('0x21')]);break;}}else{var _0x1e9480=as[_0x7cca('0x75')](_0x28a3d1,_0x4784ed[_0x7cca('0x3d')],_0x39860d);_0x41811f[_0x6c1394](_0x1e9480[_0x7cca('0x6e')],_0x1e9480[_0x7cca('0x65')][_0x7cca('0x76')],_0x1e9480[_0x7cca('0x65')][_0x7cca('0x21')]);}}}else{var _0x15dc7c=_(_0x3fe17c[_0x7cca('0x41')])[_0x7cca('0x40')]()[_0x7cca('0x31')](function(_0x470ce6){return _[_0x7cca('0x77')](_0x4f0da1,[_0x7cca('0x3f'),_0x470ce6])?_0x470ce6:undefined;})[_0x7cca('0x78')]()[_0x7cca('0x65')]();if(!_[_0x7cca('0x79')](_0x15dc7c)){_0x15dc7c[_0x7cca('0x36')](function(_0x5c219d){if(_0x5c219d==='OpenchannelAccountId'){_0x18fae1['where'](_0x7cca('0x7a'),[][_0x7cca('0x7b')](_0x3fe17c[_0x7cca('0x41')][_0x5c219d]));}else if(_0x5c219d===_0x7cca('0x7c')){var _0x469d2b=JSON['parse'](_0x3fe17c['query'][_0x5c219d])['$gte'];var _0x2649a0=JSON[_0x7cca('0x7d')](_0x3fe17c[_0x7cca('0x41')][_0x5c219d])[_0x7cca('0x7e')];_0x18fae1[_0x7cca('0x4c')](_0x7cca('0x7f'),_0x469d2b,_0x2649a0);}else{if(_0x3fe17c[_0x7cca('0x41')][_0x5c219d]===_0x7cca('0x80')){_0x18fae1[_0x7cca('0x4c')]('i.'+_0x5c219d+_0x7cca('0x81'));}else{_0x18fae1[_0x7cca('0x4c')]('i.'+_0x5c219d+_0x7cca('0x82'),_0x3fe17c[_0x7cca('0x41')][_0x5c219d]);}}});}if(_0x3fe17c['query'][_0x7cca('0x83')]){if(_0x3fe17c['query'][_0x7cca('0x83')]==0x1){_0x18fae1['having'](_0x7cca('0x84'));}else{_0x18fae1[_0x7cca('0x66')](_0x7cca('0x85'));}}if(_0x3fe17c[_0x7cca('0x41')]['tag']){_0x40b158=_[_0x7cca('0x86')](_0x3fe17c[_0x7cca('0x41')][_0x7cca('0x87')])?_0x3fe17c[_0x7cca('0x41')][_0x7cca('0x87')]:new Array(_0x3fe17c['query'][_0x7cca('0x87')]);_0x40b158['forEach'](function(_0x57a0e4){_0x37fa40['or'](_0x7cca('0x70'),'%,'+_0x57a0e4+',%');});}if(_0x3fe17c[_0x7cca('0x41')]['filter']){var _0x2d2dee=_0x3fe17c[_0x7cca('0x41')][_0x7cca('0x88')][_0x7cca('0x89')]('\x5c','\x5c\x5c')[_0x7cca('0x89')](/'/g,'\x27\x27');if(qs[_0x7cca('0x8a')](_0x2d2dee)){_0x41811f['or']('i.id\x20LIKE\x20?',_0x2d2dee+'%');}else{_0x41811f['or'](_0x7cca('0x8b'),qs['getFullTextValue'](_0x2d2dee))['or'](_0x7cca('0x8c'),_0x2d2dee+'%')['or'](_0x7cca('0x8d'),_0x2d2dee+'%');}}}_0x18fae1[_0x7cca('0x4c')](_0x41811f);_0x18fae1[_0x7cca('0x8e')](_0x7cca('0x8f'));var _0x2d1005={'type':db[_0x7cca('0x90')]['QueryTypes']['SELECT'],'raw':!![]};var _0xdf4125=_0x18fae1[_0x7cca('0x91')]();_0xdf4125[_0x7cca('0x4f')](_0x7cca('0x8f'));_0xdf4125[_0x7cca('0x4f')](_0x7cca('0x92'),'unreadMessages');if(_0x23ffdf[_0x7cca('0x4a')]){_0x23ffdf[_0x7cca('0x4a')][_0x7cca('0x36')](function(_0x6aa7aa){var _0x1cb16c=_0x6aa7aa[0x0]===_0x7cca('0x93')?_0x6aa7aa[0x0]:'i.'+_0x6aa7aa[0x0];_0x18fae1[_0x7cca('0x4a')](_0x1cb16c,_0x6aa7aa[0x1]===_0x7cca('0x94')?![]:!![]);});}if(!_['isEmpty'](_0x40b158)){_0x18fae1['having'](_0x37fa40);_0xdf4125[_0x7cca('0x4c')](_0x7cca('0x95'),_0x40b158);}BPromise[_0x7cca('0x96')]()[_0x7cca('0x2d')](function(){if(!_0x3bfe31){if(_0x3fe17c[_0x7cca('0x41')][_0x7cca('0x97')])return;_0xdf4125[_0x7cca('0x4c')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x18fae1[_0x7cca('0x4c')](_0x7cca('0x98'));return;}if(_0x3fe17c['user']['role']!==_0x7cca('0x99'))return;return _0x3fe17c[_0x7cca('0x9a')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x234a16){if(_[_0x7cca('0x79')](_0x234a16)){_0xdf4125['where']('i.OpenchannelAccountId\x20IS\x20NULL');_0x18fae1['where'](_0x7cca('0x9b'));}else{_0xdf4125[_0x7cca('0x4c')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x7cca('0x31')](_0x234a16,'id'));_0x18fae1[_0x7cca('0x4c')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x7cca('0x31')](_0x234a16,'id'));}});})[_0x7cca('0x2d')](function(){if(_0x3fe17c[_0x7cca('0x9a')]['role']==='agent'&&!_0x3bfe31&&!_0x3fe17c[_0x7cca('0x41')][_0x7cca('0x97')])return[];return db[_0x7cca('0x9c')][_0x7cca('0x41')](_0xdf4125['toString'](),_0x2d1005);})[_0x7cca('0x2d')](function(_0x1ca413){_0x159f3a[_0x7cca('0x27')]=_0x1ca413[_0x7cca('0x47')];if(_0x159f3a[_0x7cca('0x27')]===0x0)return[];return db[_0x7cca('0x9c')][_0x7cca('0x41')](_0x4ea2d9['toString'](),_0x2d1005)['then'](function(_0x29e029){_0x47cb57=_[_0x7cca('0x9d')](_0x29e029,'id');_0x2d1005=_[_0x7cca('0x9e')](_0x2d1005,{'model':db[_0x7cca('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3fe17c[_0x7cca('0x41')][_0x7cca('0x46')]){_0x23ffdf[_0x7cca('0x43')][_0x7cca('0x36')](function(_0x368340){_0x18fae1['field']('i.'+_0x368340);});}else{_0x18fae1['field'](_0x7cca('0x92'),_0x7cca('0x64'));_0x18fae1[_0x7cca('0x4f')]('a.key',_0x7cca('0x9f'));_0x18fae1['field']('a.mandatoryDisposition',_0x7cca('0xa0'));_0x18fae1[_0x7cca('0x4f')](_0x7cca('0xa1'),'contactName');_0x18fae1[_0x7cca('0x4f')]('i.*');_0x18fae1[_0x7cca('0x4f')]('c.firstName',_0x7cca('0xa2'));_0x18fae1[_0x7cca('0x4f')](_0x7cca('0xa3'),_0x7cca('0xa4'));_0x18fae1[_0x7cca('0x4f')](_0x7cca('0xa5'),'Contact.email');_0x18fae1[_0x7cca('0x4f')](_0x7cca('0xa6'),_0x7cca('0xa7'));_0x18fae1[_0x7cca('0x4f')]('c.mobile',_0x7cca('0xa8'));_0x18fae1[_0x7cca('0x4f')](_0x7cca('0xa9'),_0x7cca('0xaa'));_0x18fae1['field']('o.fullname',_0x7cca('0xab'));_0x18fae1['field'](_0x7cca('0xac'),'Owner.internal');_0x18fae1[_0x7cca('0x4f')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x23ffdf[_0x7cca('0x25')])_0x18fae1[_0x7cca('0x25')](_0x23ffdf['limit']);if(_0x23ffdf[_0x7cca('0x24')])_0x18fae1['offset'](_0x23ffdf[_0x7cca('0x24')]);return db[_0x7cca('0x9c')][_0x7cca('0x41')](_0x18fae1[_0x7cca('0xad')](),_0x2d1005);})[_0x7cca('0x2d')](function(_0x7028ac){if(_0x7028ac['length']>0x0)_0x4b0d5d[_0x7cca('0x4c')]('ui.OpenchannelInteractionId\x20IN\x20?',_['map'](_0x7028ac,'id'));return db['sequelize']['query'](_0x4b0d5d[_0x7cca('0xad')](),_0x2d1005)[_0x7cca('0x2d')](function(_0x1ed57f){var _0xa0e66b=_[_0x7cca('0xae')](_0x1ed57f,_0x7cca('0xaf'));var _0x1add00=[];_0x7028ac[_0x7cca('0x36')](function(_0x5a94cd){_0x1add00[_0x7cca('0x37')](updateOpenchannelInteraction(_0x5a94cd,_0x47cb57,_0xa0e66b));});return BPromise['all'](_0x1add00);});});})[_0x7cca('0x2d')](function(_0x141e53){_0x159f3a[_0x7cca('0xb0')]=_0x141e53;return _0x159f3a;})[_0x7cca('0x2d')](respondWithFilteredResult(_0x4c164f,_0x23ffdf))[_0x7cca('0x38')](handleError(_0x4c164f,null));};exports[_0x7cca('0xb1')]=function(_0x188fa9,_0x3d8fbf){var _0x2147a8={};if(_0x188fa9[_0x7cca('0x41')][_0x7cca('0x3d')]&&_0x188fa9['query']['type']===_0x7cca('0x50')){_0x2147a8[_0x7cca('0x50')]=_0x188fa9[_0x7cca('0xb2')]['id'];}else{_0x2147a8['id']=_0x188fa9[_0x7cca('0xb2')]['id'];}var _0x47f721={'raw':![],'where':_0x2147a8},_0x1b90e6={};_0x1b90e6[_0x7cca('0x45')]=_[_0x7cca('0x40')](db[_0x7cca('0x3a')][_0x7cca('0x3b')]);_0x1b90e6[_0x7cca('0x41')]=_['keys'](_0x188fa9[_0x7cca('0x41')]);_0x1b90e6[_0x7cca('0x42')]=_[_0x7cca('0x44')](_0x1b90e6[_0x7cca('0x45')],_0x1b90e6[_0x7cca('0x41')]);_0x47f721['attributes']=_[_0x7cca('0x44')](_0x1b90e6[_0x7cca('0x45')],qs[_0x7cca('0x46')](_0x188fa9['query'][_0x7cca('0x46')]));_0x47f721[_0x7cca('0x43')]=_0x47f721[_0x7cca('0x43')][_0x7cca('0x47')]?_0x47f721['attributes']:_0x1b90e6[_0x7cca('0x45')];if(_0x188fa9['query'][_0x7cca('0xb3')]){_0x47f721['include']=[{'all':!![]}];}_0x47f721=_[_0x7cca('0x9e')]({},_0x47f721,_0x188fa9[_0x7cca('0xb4')]);return db[_0x7cca('0x3a')]['find'](_0x47f721)[_0x7cca('0x2d')](handleEntityNotFound(_0x3d8fbf,null))[_0x7cca('0x2d')](respondWithResult(_0x3d8fbf,null))[_0x7cca('0x38')](handleError(_0x3d8fbf,null));};exports[_0x7cca('0xb5')]=function(_0x3a5ed8,_0x7a8d41){return db[_0x7cca('0x3a')]['create'](_0x3a5ed8[_0x7cca('0xb6')],{})[_0x7cca('0x2d')](respondWithResult(_0x7a8d41,0xc9))[_0x7cca('0x38')](handleError(_0x7a8d41,null));};exports[_0x7cca('0x2c')]=function(_0x1690ea,_0xc1dec0){if(_0x1690ea[_0x7cca('0xb6')]['id']){delete _0x1690ea[_0x7cca('0xb6')]['id'];}return db[_0x7cca('0x3a')]['find']({'where':{'id':_0x1690ea[_0x7cca('0xb2')]['id']}})[_0x7cca('0x2d')](handleEntityNotFound(_0xc1dec0,null))['then'](saveUpdates(_0x1690ea[_0x7cca('0xb6')],null))['then'](respondWithResult(_0xc1dec0,null))['catch'](handleError(_0xc1dec0,null));};exports['destroy']=function(_0x2f72dd,_0x311879){return db[_0x7cca('0x3a')][_0x7cca('0x63')]({'where':{'id':_0x2f72dd['params']['id']}})[_0x7cca('0x2d')](handleEntityNotFound(_0x311879,null))[_0x7cca('0x2d')](removeEntity(_0x311879,null))[_0x7cca('0x38')](handleError(_0x311879,null));};exports[_0x7cca('0xb7')]=function(_0x233606,_0x315e0e){return db[_0x7cca('0x3a')]['describe']()[_0x7cca('0x2d')](respondWithResult(_0x315e0e,null))[_0x7cca('0x38')](handleError(_0x315e0e,null));};exports[_0x7cca('0xb8')]=function(_0x1137f9,_0x422c54,_0x1d5cf1){return db[_0x7cca('0xb9')][_0x7cca('0x63')]({'where':{'id':_0x1137f9[_0x7cca('0xb2')]['id']}})[_0x7cca('0x2d')](handleEntityNotFound(_0x422c54,null))[_0x7cca('0x2d')](function(_0x28b55c){if(_0x28b55c){return _0x28b55c[_0x7cca('0xb8')](_0x1137f9[_0x7cca('0xb6')][_0x7cca('0xba')],_[_0x7cca('0xbb')](_0x1137f9['body'],[_0x7cca('0xba'),'id'])||{});}})[_0x7cca('0x2d')](respondWithResult(_0x422c54,null))[_0x7cca('0x38')](handleError(_0x422c54,null));};exports[_0x7cca('0xbc')]=function(_0x4e3d27,_0x54f878,_0x47536d){var _0x1c5066={'raw':![],'where':{}};var _0x158caa={};var _0x1c6d6a={'count':0x0,'rows':[]};return db[_0x7cca('0x3a')]['findOne']({'where':{'id':_0x4e3d27[_0x7cca('0xb2')]['id']}})[_0x7cca('0x2d')](handleEntityNotFound(_0x54f878,null))[_0x7cca('0x2d')](function(_0x120c38){if(_0x120c38){_0x158caa[_0x7cca('0x45')]=_[_0x7cca('0x40')](db[_0x7cca('0xb9')][_0x7cca('0x3b')]);_0x158caa[_0x7cca('0x41')]=_['keys'](_0x4e3d27[_0x7cca('0x41')]);_0x158caa[_0x7cca('0x42')]=_[_0x7cca('0x44')](_0x158caa['model'],_0x158caa[_0x7cca('0x41')]);_0x1c5066[_0x7cca('0x43')]=_[_0x7cca('0x44')](_0x158caa[_0x7cca('0x45')],qs['fields'](_0x4e3d27[_0x7cca('0x41')][_0x7cca('0x46')]));_0x1c5066[_0x7cca('0x43')]=_0x1c5066[_0x7cca('0x43')][_0x7cca('0x47')]?_0x1c5066[_0x7cca('0x43')]:_0x158caa[_0x7cca('0x45')];if(!_0x4e3d27[_0x7cca('0x41')][_0x7cca('0x48')](_0x7cca('0x49'))){_0x1c5066[_0x7cca('0x25')]=qs['limit'](_0x4e3d27[_0x7cca('0x41')][_0x7cca('0x25')]);_0x1c5066[_0x7cca('0x24')]=qs[_0x7cca('0x24')](_0x4e3d27['query'][_0x7cca('0x24')]);}_0x1c5066['order']=qs[_0x7cca('0x4b')](_0x4e3d27[_0x7cca('0x41')][_0x7cca('0x4b')]);_0x1c5066['where']=qs[_0x7cca('0x42')](_[_0x7cca('0x4d')](_0x4e3d27[_0x7cca('0x41')],_0x158caa[_0x7cca('0x42')]));_0x1c5066[_0x7cca('0x4c')]['OpenchannelInteractionId']=_0x120c38['id'];if(_0x4e3d27[_0x7cca('0x41')]['filter']){_0x1c5066[_0x7cca('0x4c')]=_[_0x7cca('0x9e')](_0x1c5066[_0x7cca('0x4c')],{'$or':_['map'](_0x1c5066[_0x7cca('0x43')],function(_0x37bc73){var _0x1f14e2={};_0x1f14e2[_0x37bc73]={'$like':'%'+_0x4e3d27[_0x7cca('0x41')][_0x7cca('0x88')]+'%'};return _0x1f14e2;})});}if(_0x4e3d27[_0x7cca('0x41')][_0x7cca('0xbd')]){var _0x3e8831=_0x4e3d27[_0x7cca('0x41')][_0x7cca('0xbd')][_0x7cca('0x35')](',');var _0x4c7692={};_0x4c7692[_0x3e8831[0x0]]={'$gte':moment(_0x3e8831[0x1])[_0x7cca('0xbe')](_0x7cca('0xbf'))};_0x1c5066[_0x7cca('0x4c')]=_['merge'](_0x1c5066[_0x7cca('0x4c')],_0x4c7692);}_0x1c5066=_['merge']({},_0x1c5066,_0x4e3d27['options']);return db[_0x7cca('0xb9')][_0x7cca('0x27')]({'where':_0x1c5066['where']})[_0x7cca('0x2d')](function(_0x184a75){_0x1c6d6a[_0x7cca('0x27')]=_0x184a75;if(_0x4e3d27['query'][_0x7cca('0xb3')]){_0x1c5066[_0x7cca('0xc0')]=[{'all':!![]}];}return db[_0x7cca('0xb9')][_0x7cca('0xc1')](_0x1c5066);})['then'](function(_0x5d9716){_0x1c6d6a[_0x7cca('0xb0')]=_0x5d9716;return _0x1c6d6a;});}})[_0x7cca('0x2d')](respondWithFilteredResult(_0x54f878,_0x1c5066))[_0x7cca('0x38')](handleError(_0x54f878,null));};exports[_0x7cca('0xc2')]=function(_0x23886a,_0x2fb14d,_0x405feb){return db[_0x7cca('0x3a')][_0x7cca('0x63')]({'where':{'id':_0x23886a[_0x7cca('0xb2')]['id']}})[_0x7cca('0x2d')](handleEntityNotFound(_0x2fb14d,null))[_0x7cca('0x2d')](function(_0x2b5f4d){if(_0x2b5f4d){return _0x2b5f4d['setTags'](_0x23886a['body'][_0x7cca('0xba')],_[_0x7cca('0xbb')](_0x23886a['body'],[_0x7cca('0xba'),'id'])||{})[_0x7cca('0xc3')](function(){return db[_0x7cca('0x6f')][_0x7cca('0xc1')]({'attributes':['id',_0x7cca('0x3f'),_0x7cca('0xc4')],'where':{'id':_0x23886a[_0x7cca('0xb6')]['ids']}});})[_0x7cca('0x2d')](function(_0x1a6f70){socket[_0x7cca('0xc5')](_0x7cca('0xc6'),{'id':Number(_0x23886a['params']['id']),'tags':_0x1a6f70||[]});return{'id':Number(_0x23886a[_0x7cca('0xb2')]['id']),'tags':_0x1a6f70||[]};});}})[_0x7cca('0x2d')](respondWithResult(_0x2fb14d,null))[_0x7cca('0x38')](handleError(_0x2fb14d,null));};exports[_0x7cca('0xc7')]=function(_0x2d9dc6,_0x29286f,_0x49026d){return db[_0x7cca('0x3a')]['find']({'where':{'id':_0x2d9dc6[_0x7cca('0xb2')]['id']}})[_0x7cca('0x2d')](handleEntityNotFound(_0x29286f,null))[_0x7cca('0x2d')](function(_0x3e7b95){if(_0x3e7b95){return _0x3e7b95[_0x7cca('0xc7')](_0x2d9dc6[_0x7cca('0x41')][_0x7cca('0xba')]);}})['then'](respondWithStatusCode(_0x29286f,null))['catch'](handleError(_0x29286f,null));};exports[_0x7cca('0xc8')]=function(_0x1d72c8,_0x33a427){var _0x359cf3=moment()['unix']()[_0x7cca('0xad')]();var _0x3d9479=path[_0x7cca('0xc9')](config[_0x7cca('0xca')],_0x7cca('0xcb'),_0x7cca('0xcc'),_0x7cca('0xcd'));var _0x117c5d=path[_0x7cca('0xc9')](config[_0x7cca('0xca')],'server',_0x7cca('0xcc'),_0x7cca('0xce'));var _0x4c046b=path[_0x7cca('0xc9')](_0x3d9479,_0x359cf3);var _0x5ea919=util['format'](_0x7cca('0xcf'),_0x1d72c8[_0x7cca('0xb2')]['id'],_0x359cf3);var _0x2b365d=path[_0x7cca('0xc9')](_0x3d9479,_0x5ea919);var _0x114d0e=[];_0x114d0e[_0x7cca('0x37')]({'model':db[_0x7cca('0x72')],'as':_0x7cca('0x72'),'attributes':['id',_0x7cca('0x32')],'raw':!![]});_0x114d0e['push']({'model':db[_0x7cca('0xd0')],'as':'Contact','attributes':['id',_0x7cca('0xd1'),_0x7cca('0xd2')],'raw':!![]});if(_0x1d72c8[_0x7cca('0x41')][_0x7cca('0xce')]){_0x114d0e['push']({'model':db[_0x7cca('0xd3')],'as':_0x7cca('0xd3'),'raw':!![]});}var _0x23ecd9=[{'model':db['OpenchannelMessage'],'as':_0x7cca('0xd4'),'attributes':['id',_0x7cca('0xb6'),_0x7cca('0x7c'),_0x7cca('0xd5'),'secret',_0x7cca('0x83')],'include':_0x114d0e}];_0x23ecd9[_0x7cca('0x37')]({'model':db[_0x7cca('0xd6')],'as':_0x7cca('0xd7'),'attributes':['id',_0x7cca('0x3f')]});_0x23ecd9['push']({'model':db[_0x7cca('0x72')],'as':_0x7cca('0xd8'),'attributes':['id',_0x7cca('0x32')]});return db['OpenchannelInteraction'][_0x7cca('0x63')]({'where':{'id':_0x1d72c8[_0x7cca('0xb2')]['id']},'include':_0x23ecd9})[_0x7cca('0x2d')](handleEntityNotFound(_0x33a427,null))[_0x7cca('0x2d')](function(_0x306780){if(_0x306780){var _0x595404=_0x306780['get']({'plain':!![]});fs[_0x7cca('0xd9')](_0x4c046b);var _0x3fa53a={'channel':_0x7cca('0xda'),'account':_0x595404[_0x7cca('0xd7')][_0x7cca('0x3f')],'agent':_0x595404[_0x7cca('0xd8')]?_0x595404[_0x7cca('0xd8')][_0x7cca('0x32')]:_0x7cca('0xdb'),'createdAt':moment(_0x595404[_0x7cca('0x7c')])[_0x7cca('0xbe')](_0x7cca('0xbf'))[_0x7cca('0xad')](),'closedAt':_0x595404['closed']?moment(_0x595404[_0x7cca('0xdc')])['format'](_0x7cca('0xbf'))[_0x7cca('0xad')]():'','disposition':_0x595404['disposition'],'visibility':_0x595404['threadId']?'Public':_0x7cca('0xdd'),'messages':_(_0x595404[_0x7cca('0xd4')])[_0x7cca('0x88')]({'secret':![]})['map'](function(_0x565515){if(_0x565515['Attachment']){var _0x350fa1=path[_0x7cca('0xc9')](_0x117c5d,_0x565515[_0x7cca('0xd3')][_0x7cca('0xde')]);if(fs[_0x7cca('0xdf')](_0x350fa1)){fs[_0x7cca('0xe0')](_0x350fa1)[_0x7cca('0xe1')](fs['createWriteStream'](path['join'](_0x4c046b,_0x565515[_0x7cca('0xd3')][_0x7cca('0xde')])));}}return{'date':moment(_0x565515[_0x7cca('0x7c')])[_0x7cca('0xbe')](_0x7cca('0xbf'))[_0x7cca('0xad')](),'sender':_0x565515['direction']===_0x7cca('0xe2')?_0x565515['User']?_0x565515[_0x7cca('0x72')][_0x7cca('0x32')]:_0x7cca('0xe3'):_0x565515[_0x7cca('0x68')][_0x7cca('0xd1')]+(_0x565515['Contact'][_0x7cca('0xd2')]?'\x20'+_0x565515['Contact'][_0x7cca('0xd2')]:''),'body':_0x565515[_0x7cca('0xd3')]?_0x565515[_0x7cca('0xd3')][_0x7cca('0xde')]:_0x565515['body'],'direction':_0x565515[_0x7cca('0xd5')]===_0x7cca('0xe2')?'A':'C','secret':_0x565515['secret'],'read':_0x565515[_0x7cca('0x83')],'attachment':_0x565515[_0x7cca('0xd3')]};})[_0x7cca('0x65')]()};return ejs[_0x7cca('0xe4')](path[_0x7cca('0xc9')](config[_0x7cca('0xca')],_0x7cca('0xcb'),'views',_0x7cca('0xe5')),{'interaction':_0x3fa53a})[_0x7cca('0x2d')](function(_0x45416f){var _0x495b0a=path[_0x7cca('0xc9')](_0x4c046b,_0x7cca('0xe6')+_0x595404['id']+'-'+_0x359cf3+_0x7cca('0xe7'));var _0x520326={'path':_0x495b0a,'channel':_0x7cca('0xda'),'interactionId':_0x595404['id']};return pdf[_0x7cca('0xe8')](_0x45416f,_0x520326);})[_0x7cca('0x2d')](function(){return new BPromise(function(_0x2936a1,_0x2ab977){zipdir(_0x4c046b,{'saveTo':_0x2b365d},function(_0xe8d2f8,_0x56f222){if(_0xe8d2f8)return _0x2ab977(_0xe8d2f8);return _0x2936a1(_0x56f222);});})[_0x7cca('0x2d')](function(){return new BPromise(function(_0x4692d2,_0x5b55fc){rimraf(_0x4c046b,function(_0x3592c8){if(_0x3592c8)_0x5b55fc(_0x3592c8);return _0x4692d2();});});})['then'](function(){return _0x33a427[_0x7cca('0xc8')](_0x2b365d,_0x5ea919,function(_0x30ceaf){if(_0x30ceaf){console[_0x7cca('0xe9')]('err',_0x30ceaf);}else{fs[_0x7cca('0xea')](_0x2b365d);}});});});}else{return _0x33a427[_0x7cca('0xeb')](0xc8);}})['catch'](handleError(_0x33a427,null));}; \ No newline at end of file +var _0xfa18=['../../mysqldb','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','Users','fullname','TagIds','Tags','split','forEach','push','catch','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','getFullTextValue','ContactId','text','start','end','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','buildExpression','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','isEmpty','i.OpenchannelAccountId\x20IS\x20NULL','OpenchannelAccountId','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','rows','show','params','includeAll','include','options','OpenchannelInteraction','create','describe','addMessage','OpenchannelMessage','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','setTags','ids','spread','findAll','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','tmp','transcript-%d-%s.zip','firstName','lastName','attachments','Messages','direction','secret','OpenchannelAccount','Account','get','Owner','closed','disposition','Public','Private','basename','existsSync','createReadStream','createWriteStream','Attachment','out','System','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x33ff15,_0x2cbb0e){var _0x2866ff=function(_0x1c5ed1){while(--_0x1c5ed1){_0x33ff15['push'](_0x33ff15['shift']());}};_0x2866ff(++_0x2cbb0e);}(_0xfa18,0xd5));var _0x8fa1=function(_0x1a80a8,_0x38fd21){_0x1a80a8=_0x1a80a8-0x0;var _0x37fd38=_0xfa18[_0x1a80a8];return _0x37fd38;};'use strict';var emlformat=require(_0x8fa1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8fa1('0x1'));var jsonpatch=require(_0x8fa1('0x2'));var rp=require(_0x8fa1('0x3'));var moment=require(_0x8fa1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8fa1('0x5'));var util=require('util');var path=require(_0x8fa1('0x6'));var sox=require(_0x8fa1('0x7'));var csv=require(_0x8fa1('0x8'));var ejs=require(_0x8fa1('0x9'));var fs=require('fs');var fs_extra=require(_0x8fa1('0xa'));var _=require(_0x8fa1('0xb'));var squel=require('squel');var crypto=require(_0x8fa1('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8fa1('0xd'));var toCsv=require(_0x8fa1('0x8'));var querystring=require(_0x8fa1('0xe'));var Papa=require(_0x8fa1('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8fa1('0x10'));var as=require(_0x8fa1('0x11'));var pdf=require(_0x8fa1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8fa1('0x13'));var utils=require(_0x8fa1('0x14'));var config=require(_0x8fa1('0x15'));var licenseUtil=require(_0x8fa1('0x16'));var db=require(_0x8fa1('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x8fa1('0x18'),'port':0x18eb});var socket=require(_0x8fa1('0x19'))(new Redis(config['redis']));require(_0x8fa1('0x1a'))[_0x8fa1('0x1b')](socket);function respondWithStatusCode(_0x1dc6a2,_0x1e7af0){_0x1e7af0=_0x1e7af0||0xcc;return function(_0x567d04){if(_0x567d04){return _0x1dc6a2[_0x8fa1('0x1c')](_0x1e7af0);}return _0x1dc6a2[_0x8fa1('0x1d')](_0x1e7af0)['end']();};}function respondWithResult(_0x4d87b0,_0x188230){_0x188230=_0x188230||0xc8;return function(_0x48aee5){if(_0x48aee5){return _0x4d87b0[_0x8fa1('0x1d')](_0x188230)[_0x8fa1('0x1e')](_0x48aee5);}};}function respondWithFilteredResult(_0x1a7c84,_0x2be760){return function(_0x53e5b9){if(_0x53e5b9){var _0x2fd9c=typeof _0x2be760[_0x8fa1('0x1f')]===_0x8fa1('0x20')&&typeof _0x2be760['limit']==='undefined';var _0x2a9669=_0x53e5b9[_0x8fa1('0x21')];var _0x1c7a60=_0x2fd9c?0x0:_0x2be760[_0x8fa1('0x1f')];var _0x24efd4=_0x2fd9c?_0x53e5b9[_0x8fa1('0x21')]:_0x2be760[_0x8fa1('0x1f')]+_0x2be760[_0x8fa1('0x22')];var _0x44cc09;if(_0x24efd4>=_0x2a9669){_0x24efd4=_0x2a9669;_0x44cc09=0xc8;}else{_0x44cc09=0xce;}_0x1a7c84[_0x8fa1('0x1d')](_0x44cc09);return _0x1a7c84[_0x8fa1('0x23')](_0x8fa1('0x24'),_0x1c7a60+'-'+_0x24efd4+'/'+_0x2a9669)[_0x8fa1('0x1e')](_0x53e5b9);}return null;};}function patchUpdates(_0x141784){return function(_0x300776){try{jsonpatch[_0x8fa1('0x25')](_0x300776,_0x141784,!![]);}catch(_0x2943f9){return BPromise[_0x8fa1('0x26')](_0x2943f9);}return _0x300776[_0x8fa1('0x27')]();};}function saveUpdates(_0x53874e,_0x4375e2){return function(_0x2e986d){if(_0x2e986d){return _0x2e986d[_0x8fa1('0x28')](_0x53874e)[_0x8fa1('0x29')](function(_0x404d32){return _0x404d32;});}return null;};}function removeEntity(_0x2c3b91,_0x245b78){return function(_0x3ab472){if(_0x3ab472){return _0x3ab472[_0x8fa1('0x2a')]()[_0x8fa1('0x29')](function(){_0x2c3b91[_0x8fa1('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x416bc3,_0x3c980b){return function(_0x5488e1){if(!_0x5488e1){_0x416bc3[_0x8fa1('0x1c')](0x194);}return _0x5488e1;};}function handleError(_0x559f2e,_0x330bdd){_0x330bdd=_0x330bdd||0x1f4;return function(_0x4e7646){logger['error'](_0x4e7646[_0x8fa1('0x2b')]);if(_0x4e7646[_0x8fa1('0x2c')]){delete _0x4e7646[_0x8fa1('0x2c')];}_0x559f2e['status'](_0x330bdd)['send'](_0x4e7646);};}function getInteractionUsers(_0x1499d4,_0x27a0ae){return new BPromise(function(_0x2a56dd,_0x96a9b4){try{if(_0x27a0ae[_0x1499d4['id']]){_0x1499d4[_0x8fa1('0x2d')]=_['map'](_0x27a0ae[_0x1499d4['id']],function(_0x1e3815){return{'id':_0x1e3815['id'],'fullname':_0x1e3815[_0x8fa1('0x2e')]};});}}catch(_0x256b0c){_0x96a9b4(_0x256b0c);}_0x2a56dd(_0x1499d4);});}function getInteractionTags(_0x5690bd,_0x21771c){return new BPromise(function(_0x5cc679,_0x5a2b06){try{if(_0x5690bd[_0x8fa1('0x2f')]){_0x5690bd[_0x8fa1('0x30')]=[];_0x5690bd[_0x8fa1('0x2f')][_0x8fa1('0x31')](',')[_0x8fa1('0x32')](function(_0xa33a79){_0x5690bd[_0x8fa1('0x30')][_0x8fa1('0x33')](_0x21771c[_0xa33a79]);});}delete _0x5690bd[_0x8fa1('0x2f')];}catch(_0x533a6d){_0x5a2b06(_0x533a6d);}_0x5cc679(_0x5690bd);});}function updateOpenchannelInteraction(_0x47cd86,_0x1bc6cf,_0x525cd3){return new BPromise(function(_0x12424b,_0xd1e1a9){return getInteractionUsers(_0x47cd86,_0x525cd3)['then'](function(_0x267f17){return getInteractionTags(_0x267f17,_0x1bc6cf);})[_0x8fa1('0x29')](function(_0x4f476b){_0x12424b(_0x4f476b);})[_0x8fa1('0x34')](function(_0x2e96d8){_0xd1e1a9(_0x2e96d8);});});}exports['index']=function(_0x3a6c87,_0x49daea){var _0xecd72b={},_0x360172={},_0xf5d319={'count':0x0,'rows':[]};var _0x123b09=_[_0x8fa1('0x35')](db['OpenchannelInteraction'][_0x8fa1('0x36')],function(_0x5ca8fb){return{'name':_0x5ca8fb[_0x8fa1('0x37')],'type':_0x5ca8fb[_0x8fa1('0x38')][_0x8fa1('0x39')]};});_0x360172[_0x8fa1('0x3a')]=_[_0x8fa1('0x35')](_0x123b09,_0x8fa1('0x2c'));_0x360172[_0x8fa1('0x3b')]=_[_0x8fa1('0x3c')](_0x3a6c87[_0x8fa1('0x3b')]);_0x360172[_0x8fa1('0x3d')]=_[_0x8fa1('0x3e')](_0x360172[_0x8fa1('0x3a')],_0x360172[_0x8fa1('0x3b')]);_0xecd72b[_0x8fa1('0x3f')]=_[_0x8fa1('0x3e')](_0x360172[_0x8fa1('0x3a')],qs[_0x8fa1('0x40')](_0x3a6c87[_0x8fa1('0x3b')][_0x8fa1('0x40')]));_0xecd72b['attributes']=_0xecd72b[_0x8fa1('0x3f')][_0x8fa1('0x41')]?_0xecd72b[_0x8fa1('0x3f')]:_0x360172[_0x8fa1('0x3a')];if(!_0x3a6c87[_0x8fa1('0x3b')][_0x8fa1('0x42')](_0x8fa1('0x43'))){_0xecd72b['limit']=qs[_0x8fa1('0x22')](_0x3a6c87[_0x8fa1('0x3b')][_0x8fa1('0x22')]);_0xecd72b[_0x8fa1('0x1f')]=qs[_0x8fa1('0x1f')](_0x3a6c87[_0x8fa1('0x3b')][_0x8fa1('0x1f')]);}_0xecd72b[_0x8fa1('0x44')]=qs[_0x8fa1('0x45')](_0x3a6c87[_0x8fa1('0x3b')][_0x8fa1('0x45')]);_0xecd72b[_0x8fa1('0x46')]=qs[_0x8fa1('0x3d')](_[_0x8fa1('0x47')](_0x3a6c87[_0x8fa1('0x3b')],_0x360172[_0x8fa1('0x3d')]),_0x123b09);var _0x4405b5=[];var _0x8f7742=squel[_0x8fa1('0x48')]()['field']('id')[_0x8fa1('0x49')](_0x8fa1('0x2c'))['field'](_0x8fa1('0x4a'))[_0x8fa1('0x4b')]('tools_tags');var _0x35128e=squel[_0x8fa1('0x48')]()[_0x8fa1('0x49')](_0x8fa1('0x4c'))[_0x8fa1('0x49')](_0x8fa1('0x4d'))[_0x8fa1('0x49')](_0x8fa1('0x4e'))['from'](_0x8fa1('0x4f'),'ui')[_0x8fa1('0x50')](_0x8fa1('0x51'),'u',_0x8fa1('0x52'));var _0x573f0b=squel[_0x8fa1('0x48')]()['from'](_0x8fa1('0x53'),'i')[_0x8fa1('0x50')](_0x8fa1('0x54'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x8fa1('0x50')]('users','o','o.id\x20=\x20i.UserId')['left_join']('openchannel_accounts','a',_0x8fa1('0x55'))[_0x8fa1('0x50')]('openchannel_messages','me','me.OpenchannelInteractionId\x20=\x20i.id')[_0x8fa1('0x50')](_0x8fa1('0x56'),'it',_0x8fa1('0x57'))[_0x8fa1('0x50')]('tools_tags','t',_0x8fa1('0x58'));var _0x8713ac=squel[_0x8fa1('0x59')]();var _0x332c41=[];var _0x578a50=squel['expr']();var _0x3d7dad;if(_0x3a6c87[_0x8fa1('0x3b')]['search']){_0x3d7dad=as[_0x8fa1('0x5a')](_0x3a6c87[_0x8fa1('0x3b')][_0x8fa1('0x5b')]);var _0x17e071=_0x3d7dad[_0x8fa1('0x5c')];for(var _0x231722=0x0;_0x231722<_0x3d7dad[_0x8fa1('0x5d')][_0x8fa1('0x41')];_0x231722++){var _0x4341f3=_0x3d7dad[_0x8fa1('0x5d')][_0x231722];var _0x3ef34c='i';var _0x1ca97e=_[_0x8fa1('0x5e')](_0x123b09,[_0x8fa1('0x2c'),_0x4341f3[_0x8fa1('0x49')]]);if(!_0x1ca97e){switch(_0x4341f3[_0x8fa1('0x49')]){case _0x8fa1('0x5f'):if(_0x4341f3[_0x8fa1('0x60')]==0x1){_0x573f0b['having']('`'+_0x4341f3[_0x8fa1('0x49')]+_0x8fa1('0x61'));}else{_0x573f0b[_0x8fa1('0x62')]('`'+_0x4341f3[_0x8fa1('0x49')]+_0x8fa1('0x63'));}break;case _0x8fa1('0x64'):if(_0x4341f3[_0x8fa1('0x65')]===_0x8fa1('0x66')){if(_0x4341f3[_0x8fa1('0x60')][_0x8fa1('0x31')]('\x20')[_0x8fa1('0x41')]>0x1){_0x8713ac[_0x17e071]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8fa1('0x67')](_0x4341f3[_0x8fa1('0x60')]),null);}else{var _0x3295ab='%'+_0x4341f3[_0x8fa1('0x60')]+'%';_0x8713ac[_0x17e071]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3295ab,_0x3295ab,_0x3295ab);}}else{_0x1ca97e=_[_0x8fa1('0x5e')](_0x123b09,[_0x8fa1('0x2c'),_0x8fa1('0x68')]);_0x4341f3[_0x8fa1('0x49')]=_0x8fa1('0x68');_0x135cfc=as['buildExpression'](_0x3ef34c,_0x1ca97e['type'],_0x4341f3);_0x8713ac[_0x17e071](_0x135cfc[_0x8fa1('0x69')],_0x135cfc[_0x8fa1('0x60')][_0x8fa1('0x6a')],_0x135cfc[_0x8fa1('0x60')][_0x8fa1('0x6b')]);}break;case _0x8fa1('0x6c'):var _0x7e6ea6=_0x4341f3[_0x8fa1('0x60')]['split'](',')[_0x8fa1('0x35')](function(_0x305953){return Number(_0x305953);});_0x7e6ea6[_0x8fa1('0x32')](function(_0x258235){_0x578a50['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x258235+',%');});_0x332c41=_[_0x8fa1('0x6d')](_0x332c41,_0x7e6ea6);break;case _0x8fa1('0x6e'):if(_0x4341f3[_0x8fa1('0x65')]===_0x8fa1('0x66')){_0x8713ac[_0x17e071](_0x8fa1('0x6f'),'%'+_0x4341f3[_0x8fa1('0x60')]+'%',null);}else{_0x1ca97e=_['find'](_0x123b09,[_0x8fa1('0x2c'),'UserId']);_0x4341f3['field']=_0x8fa1('0x70');_0x135cfc=as['buildExpression'](_0x3ef34c,_0x1ca97e[_0x8fa1('0x38')],_0x4341f3);_0x8713ac[_0x17e071](_0x135cfc[_0x8fa1('0x69')],_0x135cfc[_0x8fa1('0x60')]['start'],_0x135cfc[_0x8fa1('0x60')][_0x8fa1('0x6b')]);}break;case _0x8fa1('0x71'):_0x135cfc=as[_0x8fa1('0x72')]('me',null,_0x4341f3);_0x8713ac[_0x17e071](_0x135cfc[_0x8fa1('0x69')],_0x135cfc[_0x8fa1('0x60')]['start'],_0x135cfc[_0x8fa1('0x60')][_0x8fa1('0x6b')]);break;}}else{var _0x135cfc=as['buildExpression'](_0x3ef34c,_0x1ca97e[_0x8fa1('0x38')],_0x4341f3);_0x8713ac[_0x17e071](_0x135cfc[_0x8fa1('0x69')],_0x135cfc['value'][_0x8fa1('0x6a')],_0x135cfc[_0x8fa1('0x60')]['end']);}}}else{var _0x3e2244=_(_0x3a6c87[_0x8fa1('0x3b')])[_0x8fa1('0x3c')]()[_0x8fa1('0x35')](function(_0x26f369){return _['some'](_0x123b09,[_0x8fa1('0x2c'),_0x26f369])?_0x26f369:undefined;})['compact']()['value']();if(!_['isEmpty'](_0x3e2244)){_0x3e2244['forEach'](function(_0x78030b){if(_0x78030b==='OpenchannelAccountId'){_0x573f0b[_0x8fa1('0x46')](_0x8fa1('0x73'),[][_0x8fa1('0x74')](_0x3a6c87[_0x8fa1('0x3b')][_0x78030b]));}else if(_0x78030b===_0x8fa1('0x75')){var _0x37903d=JSON[_0x8fa1('0x76')](_0x3a6c87[_0x8fa1('0x3b')][_0x78030b])[_0x8fa1('0x77')];var _0x46d1b3=JSON['parse'](_0x3a6c87[_0x8fa1('0x3b')][_0x78030b])[_0x8fa1('0x78')];_0x573f0b[_0x8fa1('0x46')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x37903d,_0x46d1b3);}else{if(_0x3a6c87[_0x8fa1('0x3b')][_0x78030b]===_0x8fa1('0x79')){_0x573f0b[_0x8fa1('0x46')]('i.'+_0x78030b+_0x8fa1('0x7a'));}else{_0x573f0b['where']('i.'+_0x78030b+_0x8fa1('0x7b'),_0x3a6c87[_0x8fa1('0x3b')][_0x78030b]);}}});}if(_0x3a6c87[_0x8fa1('0x3b')][_0x8fa1('0x7c')]){if(_0x3a6c87['query'][_0x8fa1('0x7c')]==0x1){_0x573f0b[_0x8fa1('0x62')]('`unreadMessages`\x20=\x200');}else{_0x573f0b[_0x8fa1('0x62')](_0x8fa1('0x7d'));}}if(_0x3a6c87[_0x8fa1('0x3b')][_0x8fa1('0x7e')]){_0x332c41=_[_0x8fa1('0x7f')](_0x3a6c87['query']['tag'])?_0x3a6c87[_0x8fa1('0x3b')]['tag']:new Array(_0x3a6c87[_0x8fa1('0x3b')][_0x8fa1('0x7e')]);_0x332c41['forEach'](function(_0x2aad08){_0x578a50['or'](_0x8fa1('0x80'),'%,'+_0x2aad08+',%');});}if(_0x3a6c87[_0x8fa1('0x3b')]['filter']){var _0x2cdf15=_0x3a6c87[_0x8fa1('0x3b')][_0x8fa1('0x81')]['replace']('\x5c','\x5c\x5c')[_0x8fa1('0x82')](/'/g,'\x27\x27');if(qs[_0x8fa1('0x83')](_0x2cdf15)){_0x8713ac['or'](_0x8fa1('0x84'),_0x2cdf15+'%');}else{_0x8713ac['or'](_0x8fa1('0x85'),qs[_0x8fa1('0x67')](_0x2cdf15))['or'](_0x8fa1('0x86'),_0x2cdf15+'%')['or'](_0x8fa1('0x87'),_0x2cdf15+'%');}}}_0x573f0b['where'](_0x8713ac);_0x573f0b[_0x8fa1('0x88')](_0x8fa1('0x89'));var _0x403b07={'type':db[_0x8fa1('0x8a')]['QueryTypes'][_0x8fa1('0x8b')],'raw':!![]};var _0x59e669=_0x573f0b['clone']();_0x59e669[_0x8fa1('0x49')](_0x8fa1('0x89'));_0x59e669[_0x8fa1('0x49')](_0x8fa1('0x8c'),_0x8fa1('0x5f'));if(_0xecd72b['order']){_0xecd72b[_0x8fa1('0x44')][_0x8fa1('0x32')](function(_0x24c5fd){var _0x4f36da=_0x24c5fd[0x0]===_0x8fa1('0x8d')?_0x24c5fd[0x0]:'i.'+_0x24c5fd[0x0];_0x573f0b['order'](_0x4f36da,_0x24c5fd[0x1]===_0x8fa1('0x8e')?![]:!![]);});}if(!_['isEmpty'](_0x332c41)){_0x573f0b[_0x8fa1('0x62')](_0x578a50);_0x59e669[_0x8fa1('0x46')](_0x8fa1('0x8f'),_0x332c41);}BPromise[_0x8fa1('0x90')]()[_0x8fa1('0x29')](function(){if(!_0x3d7dad){if(_0x3a6c87[_0x8fa1('0x3b')]['OpenchannelAccountId'])return;_0x59e669[_0x8fa1('0x46')](_0x8fa1('0x91'));_0x573f0b[_0x8fa1('0x46')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x3a6c87[_0x8fa1('0x92')][_0x8fa1('0x93')]!==_0x8fa1('0x94'))return;return _0x3a6c87['user'][_0x8fa1('0x95')]({'attributes':['id'],'raw':!![]})['then'](function(_0xa5c268){if(_[_0x8fa1('0x96')](_0xa5c268)){_0x59e669[_0x8fa1('0x46')](_0x8fa1('0x97'));_0x573f0b[_0x8fa1('0x46')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x59e669[_0x8fa1('0x46')](_0x8fa1('0x73'),_[_0x8fa1('0x35')](_0xa5c268,'id'));_0x573f0b['where']('i.OpenchannelAccountId\x20IN\x20?',_[_0x8fa1('0x35')](_0xa5c268,'id'));}});})['then'](function(){if(_0x3a6c87['user']['role']===_0x8fa1('0x94')&&!_0x3d7dad&&!_0x3a6c87[_0x8fa1('0x3b')][_0x8fa1('0x98')])return[];return db[_0x8fa1('0x99')][_0x8fa1('0x3b')](_0x59e669[_0x8fa1('0x9a')](),_0x403b07);})['then'](function(_0x5b44bd){_0xf5d319[_0x8fa1('0x21')]=_0x5b44bd[_0x8fa1('0x41')];if(_0xf5d319['count']===0x0)return[];return db[_0x8fa1('0x99')][_0x8fa1('0x3b')](_0x8f7742[_0x8fa1('0x9a')](),_0x403b07)['then'](function(_0x5f489d){_0x4405b5=_[_0x8fa1('0x9b')](_0x5f489d,'id');_0x403b07=_[_0x8fa1('0x9c')](_0x403b07,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3a6c87[_0x8fa1('0x3b')]['fields']){_0xecd72b[_0x8fa1('0x3f')][_0x8fa1('0x32')](function(_0x1d8628){_0x573f0b[_0x8fa1('0x49')]('i.'+_0x1d8628);});}else{_0x573f0b[_0x8fa1('0x49')](_0x8fa1('0x8c'),_0x8fa1('0x5f'));_0x573f0b[_0x8fa1('0x49')]('a.key',_0x8fa1('0x9d'));_0x573f0b['field'](_0x8fa1('0x9e'),_0x8fa1('0x9f'));_0x573f0b[_0x8fa1('0x49')]('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',_0x8fa1('0x8d'));_0x573f0b[_0x8fa1('0x49')]('i.*');_0x573f0b[_0x8fa1('0x49')]('c.firstName','Contact.firstName');_0x573f0b[_0x8fa1('0x49')](_0x8fa1('0xa0'),_0x8fa1('0xa1'));_0x573f0b[_0x8fa1('0x49')](_0x8fa1('0xa2'),_0x8fa1('0xa3'));_0x573f0b[_0x8fa1('0x49')](_0x8fa1('0xa4'),_0x8fa1('0xa5'));_0x573f0b['field'](_0x8fa1('0xa6'),_0x8fa1('0xa7'));_0x573f0b[_0x8fa1('0x49')](_0x8fa1('0xa8'),_0x8fa1('0xa9'));_0x573f0b[_0x8fa1('0x49')]('o.fullname',_0x8fa1('0xaa'));_0x573f0b[_0x8fa1('0x49')](_0x8fa1('0xab'),_0x8fa1('0xac'));_0x573f0b[_0x8fa1('0x49')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0xecd72b['limit'])_0x573f0b[_0x8fa1('0x22')](_0xecd72b['limit']);if(_0xecd72b[_0x8fa1('0x1f')])_0x573f0b[_0x8fa1('0x1f')](_0xecd72b[_0x8fa1('0x1f')]);return db[_0x8fa1('0x99')][_0x8fa1('0x3b')](_0x573f0b[_0x8fa1('0x9a')](),_0x403b07);})[_0x8fa1('0x29')](function(_0x84ed5b){if(_0x84ed5b['length']>0x0)_0x35128e['where'](_0x8fa1('0xad'),_[_0x8fa1('0x35')](_0x84ed5b,'id'));return db[_0x8fa1('0x99')][_0x8fa1('0x3b')](_0x35128e[_0x8fa1('0x9a')](),_0x403b07)['then'](function(_0xa2c3bf){var _0x3b6776=_[_0x8fa1('0xae')](_0xa2c3bf,_0x8fa1('0xaf'));var _0x1d5dfd=[];_0x84ed5b['forEach'](function(_0x181917){_0x1d5dfd['push'](updateOpenchannelInteraction(_0x181917,_0x4405b5,_0x3b6776));});return BPromise['all'](_0x1d5dfd);});});})[_0x8fa1('0x29')](function(_0x3f5ded){_0xf5d319[_0x8fa1('0xb0')]=_0x3f5ded;return _0xf5d319;})['then'](respondWithFilteredResult(_0x49daea,_0xecd72b))[_0x8fa1('0x34')](handleError(_0x49daea,null));};exports[_0x8fa1('0xb1')]=function(_0x285e66,_0x353736){var _0x2dba34={};if(_0x285e66[_0x8fa1('0x3b')][_0x8fa1('0x38')]&&_0x285e66[_0x8fa1('0x3b')]['type']===_0x8fa1('0x4b')){_0x2dba34[_0x8fa1('0x4b')]=_0x285e66[_0x8fa1('0xb2')]['id'];}else{_0x2dba34['id']=_0x285e66[_0x8fa1('0xb2')]['id'];}var _0x154081={'raw':![],'where':_0x2dba34},_0x2631f2={};_0x2631f2[_0x8fa1('0x3a')]=_[_0x8fa1('0x3c')](db['OpenchannelInteraction'][_0x8fa1('0x36')]);_0x2631f2[_0x8fa1('0x3b')]=_[_0x8fa1('0x3c')](_0x285e66['query']);_0x2631f2[_0x8fa1('0x3d')]=_[_0x8fa1('0x3e')](_0x2631f2[_0x8fa1('0x3a')],_0x2631f2[_0x8fa1('0x3b')]);_0x154081[_0x8fa1('0x3f')]=_[_0x8fa1('0x3e')](_0x2631f2[_0x8fa1('0x3a')],qs['fields'](_0x285e66['query'][_0x8fa1('0x40')]));_0x154081[_0x8fa1('0x3f')]=_0x154081['attributes'][_0x8fa1('0x41')]?_0x154081[_0x8fa1('0x3f')]:_0x2631f2['model'];if(_0x285e66['query'][_0x8fa1('0xb3')]){_0x154081[_0x8fa1('0xb4')]=[{'all':!![]}];}_0x154081=_['merge']({},_0x154081,_0x285e66[_0x8fa1('0xb5')]);return db[_0x8fa1('0xb6')][_0x8fa1('0x5e')](_0x154081)[_0x8fa1('0x29')](handleEntityNotFound(_0x353736,null))[_0x8fa1('0x29')](respondWithResult(_0x353736,null))[_0x8fa1('0x34')](handleError(_0x353736,null));};exports[_0x8fa1('0xb7')]=function(_0xaebbfd,_0x5089a5){return db[_0x8fa1('0xb6')][_0x8fa1('0xb7')](_0xaebbfd['body'],{})[_0x8fa1('0x29')](respondWithResult(_0x5089a5,0xc9))[_0x8fa1('0x34')](handleError(_0x5089a5,null));};exports[_0x8fa1('0x28')]=function(_0x28fa76,_0x465aa5){if(_0x28fa76[_0x8fa1('0x71')]['id']){delete _0x28fa76[_0x8fa1('0x71')]['id'];}return db[_0x8fa1('0xb6')][_0x8fa1('0x5e')]({'where':{'id':_0x28fa76[_0x8fa1('0xb2')]['id']}})[_0x8fa1('0x29')](handleEntityNotFound(_0x465aa5,null))[_0x8fa1('0x29')](saveUpdates(_0x28fa76['body'],null))['then'](respondWithResult(_0x465aa5,null))['catch'](handleError(_0x465aa5,null));};exports['destroy']=function(_0x20f12f,_0x179800){return db[_0x8fa1('0xb6')][_0x8fa1('0x5e')]({'where':{'id':_0x20f12f[_0x8fa1('0xb2')]['id']}})[_0x8fa1('0x29')](handleEntityNotFound(_0x179800,null))[_0x8fa1('0x29')](removeEntity(_0x179800,null))[_0x8fa1('0x34')](handleError(_0x179800,null));};exports['describe']=function(_0x92cbb1,_0x25b90e){return db[_0x8fa1('0xb6')][_0x8fa1('0xb8')]()[_0x8fa1('0x29')](respondWithResult(_0x25b90e,null))[_0x8fa1('0x34')](handleError(_0x25b90e,null));};exports[_0x8fa1('0xb9')]=function(_0xdb565d,_0x45bd6e,_0x48171c){return db[_0x8fa1('0xba')][_0x8fa1('0x5e')]({'where':{'id':_0xdb565d[_0x8fa1('0xb2')]['id']}})['then'](handleEntityNotFound(_0x45bd6e,null))[_0x8fa1('0x29')](function(_0x51ce76){if(_0x51ce76){return _0x51ce76[_0x8fa1('0xb9')](_0xdb565d[_0x8fa1('0x71')]['ids'],_[_0x8fa1('0xbb')](_0xdb565d['body'],['ids','id'])||{});}})[_0x8fa1('0x29')](respondWithResult(_0x45bd6e,null))[_0x8fa1('0x34')](handleError(_0x45bd6e,null));};exports[_0x8fa1('0xbc')]=function(_0x55219d,_0x35821f,_0x4bb5fd){var _0x42efd6={'raw':![],'where':{}};var _0xdd0af8={};var _0x4476eb={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x8fa1('0xbd')]({'where':{'id':_0x55219d['params']['id']}})['then'](handleEntityNotFound(_0x35821f,null))[_0x8fa1('0x29')](function(_0x35740d){if(_0x35740d){_0xdd0af8[_0x8fa1('0x3a')]=_['keys'](db[_0x8fa1('0xba')][_0x8fa1('0x36')]);_0xdd0af8[_0x8fa1('0x3b')]=_[_0x8fa1('0x3c')](_0x55219d[_0x8fa1('0x3b')]);_0xdd0af8['filters']=_['intersection'](_0xdd0af8[_0x8fa1('0x3a')],_0xdd0af8[_0x8fa1('0x3b')]);_0x42efd6[_0x8fa1('0x3f')]=_[_0x8fa1('0x3e')](_0xdd0af8['model'],qs[_0x8fa1('0x40')](_0x55219d[_0x8fa1('0x3b')][_0x8fa1('0x40')]));_0x42efd6[_0x8fa1('0x3f')]=_0x42efd6[_0x8fa1('0x3f')][_0x8fa1('0x41')]?_0x42efd6[_0x8fa1('0x3f')]:_0xdd0af8[_0x8fa1('0x3a')];if(!_0x55219d[_0x8fa1('0x3b')][_0x8fa1('0x42')]('nolimit')){_0x42efd6[_0x8fa1('0x22')]=qs[_0x8fa1('0x22')](_0x55219d[_0x8fa1('0x3b')]['limit']);_0x42efd6[_0x8fa1('0x1f')]=qs['offset'](_0x55219d['query'][_0x8fa1('0x1f')]);}_0x42efd6['order']=qs[_0x8fa1('0x45')](_0x55219d[_0x8fa1('0x3b')][_0x8fa1('0x45')]);_0x42efd6[_0x8fa1('0x46')]=qs[_0x8fa1('0x3d')](_['pick'](_0x55219d['query'],_0xdd0af8[_0x8fa1('0x3d')]));_0x42efd6[_0x8fa1('0x46')]['OpenchannelInteractionId']=_0x35740d['id'];if(_0x55219d[_0x8fa1('0x3b')]['filter']){_0x42efd6[_0x8fa1('0x46')]=_[_0x8fa1('0x9c')](_0x42efd6[_0x8fa1('0x46')],{'$or':_[_0x8fa1('0x35')](_0x42efd6['attributes'],function(_0x3dc2b7){var _0x41ee90={};_0x41ee90[_0x3dc2b7]={'$like':'%'+_0x55219d[_0x8fa1('0x3b')][_0x8fa1('0x81')]+'%'};return _0x41ee90;})});}if(_0x55219d['query'][_0x8fa1('0x77')]){var _0x5f3468=_0x55219d['query'][_0x8fa1('0x77')][_0x8fa1('0x31')](',');var _0xbff9c9={};_0xbff9c9[_0x5f3468[0x0]]={'$gte':moment(_0x5f3468[0x1])[_0x8fa1('0xbe')](_0x8fa1('0xbf'))};_0x42efd6[_0x8fa1('0x46')]=_[_0x8fa1('0x9c')](_0x42efd6[_0x8fa1('0x46')],_0xbff9c9);}_0x42efd6=_['merge']({},_0x42efd6,_0x55219d[_0x8fa1('0xb5')]);return db[_0x8fa1('0xba')][_0x8fa1('0x21')]({'where':_0x42efd6['where']})[_0x8fa1('0x29')](function(_0x22947a){_0x4476eb[_0x8fa1('0x21')]=_0x22947a;if(_0x55219d['query'][_0x8fa1('0xb3')]){_0x42efd6[_0x8fa1('0xb4')]=[{'all':!![]}];}return db[_0x8fa1('0xba')]['findAll'](_0x42efd6);})[_0x8fa1('0x29')](function(_0x3257fc){_0x4476eb[_0x8fa1('0xb0')]=_0x3257fc;return _0x4476eb;});}})[_0x8fa1('0x29')](respondWithFilteredResult(_0x35821f,_0x42efd6))['catch'](handleError(_0x35821f,null));};exports['addTags']=function(_0x3e046d,_0x314adf,_0x3eff2f){return db[_0x8fa1('0xb6')]['find']({'where':{'id':_0x3e046d[_0x8fa1('0xb2')]['id']}})[_0x8fa1('0x29')](handleEntityNotFound(_0x314adf,null))['then'](function(_0x19c638){if(_0x19c638){return _0x19c638[_0x8fa1('0xc0')](_0x3e046d[_0x8fa1('0x71')][_0x8fa1('0xc1')],_['omit'](_0x3e046d['body'],[_0x8fa1('0xc1'),'id'])||{})[_0x8fa1('0xc2')](function(){return db['Tag'][_0x8fa1('0xc3')]({'attributes':['id',_0x8fa1('0x2c'),_0x8fa1('0x4a')],'where':{'id':_0x3e046d[_0x8fa1('0x71')][_0x8fa1('0xc1')]}});})[_0x8fa1('0x29')](function(_0x3ebf23){socket[_0x8fa1('0xc4')](_0x8fa1('0xc5'),{'id':Number(_0x3e046d[_0x8fa1('0xb2')]['id']),'tags':_0x3ebf23||[]});return{'id':Number(_0x3e046d[_0x8fa1('0xb2')]['id']),'tags':_0x3ebf23||[]};});}})[_0x8fa1('0x29')](respondWithResult(_0x314adf,null))[_0x8fa1('0x34')](handleError(_0x314adf,null));};exports[_0x8fa1('0xc6')]=function(_0x1a714b,_0x10c8f5,_0x46400c){return db[_0x8fa1('0xb6')][_0x8fa1('0x5e')]({'where':{'id':_0x1a714b['params']['id']}})[_0x8fa1('0x29')](handleEntityNotFound(_0x10c8f5,null))['then'](function(_0x45b564){if(_0x45b564){return _0x45b564[_0x8fa1('0xc6')](_0x1a714b[_0x8fa1('0x3b')][_0x8fa1('0xc1')]);}})['then'](respondWithStatusCode(_0x10c8f5,null))[_0x8fa1('0x34')](handleError(_0x10c8f5,null));};exports[_0x8fa1('0xc7')]=function(_0x3b2964,_0x568533){var _0x4f949b=moment()[_0x8fa1('0xc8')]()[_0x8fa1('0x9a')]();var _0x153210=path[_0x8fa1('0xc9')](config[_0x8fa1('0xca')],_0x8fa1('0xcb'),'files',_0x8fa1('0xcc'));var _0x527f26=path[_0x8fa1('0xc9')](config['root'],_0x8fa1('0xcb'),'files','attachments');var _0x21897e=path[_0x8fa1('0xc9')](_0x153210,_0x4f949b);var _0x197103=util[_0x8fa1('0xbe')](_0x8fa1('0xcd'),_0x3b2964['params']['id'],_0x4f949b);var _0x141ebb=path['join'](_0x153210,_0x197103);var _0x58c042=[];_0x58c042[_0x8fa1('0x33')]({'model':db[_0x8fa1('0x6e')],'as':'User','attributes':['id',_0x8fa1('0x2e')],'raw':!![]});_0x58c042[_0x8fa1('0x33')]({'model':db['CmContact'],'as':_0x8fa1('0x64'),'attributes':['id',_0x8fa1('0xce'),_0x8fa1('0xcf')],'raw':!![]});if(_0x3b2964[_0x8fa1('0x3b')][_0x8fa1('0xd0')]){_0x58c042[_0x8fa1('0x33')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x18e51a=[{'model':db[_0x8fa1('0xba')],'as':_0x8fa1('0xd1'),'attributes':['id',_0x8fa1('0x71'),_0x8fa1('0x75'),_0x8fa1('0xd2'),_0x8fa1('0xd3'),_0x8fa1('0x7c')],'include':_0x58c042}];_0x18e51a[_0x8fa1('0x33')]({'model':db[_0x8fa1('0xd4')],'as':_0x8fa1('0xd5'),'attributes':['id',_0x8fa1('0x2c')]});_0x18e51a[_0x8fa1('0x33')]({'model':db[_0x8fa1('0x6e')],'as':'Owner','attributes':['id','fullname']});return db[_0x8fa1('0xb6')][_0x8fa1('0x5e')]({'where':{'id':_0x3b2964['params']['id']},'include':_0x18e51a})[_0x8fa1('0x29')](handleEntityNotFound(_0x568533,null))['then'](function(_0x88815c){if(_0x88815c){var _0x683cbd=_0x88815c[_0x8fa1('0xd6')]({'plain':!![]});fs['mkdirSync'](_0x21897e);var _0x33ba6c={'channel':'Openchannel','account':_0x683cbd[_0x8fa1('0xd5')]['name'],'agent':_0x683cbd[_0x8fa1('0xd7')]?_0x683cbd[_0x8fa1('0xd7')][_0x8fa1('0x2e')]:'N.A.','createdAt':moment(_0x683cbd[_0x8fa1('0x75')])[_0x8fa1('0xbe')](_0x8fa1('0xbf'))['toString'](),'closedAt':_0x683cbd[_0x8fa1('0xd8')]?moment(_0x683cbd['closedAt'])['format'](_0x8fa1('0xbf'))[_0x8fa1('0x9a')]():'','disposition':_0x683cbd[_0x8fa1('0xd9')],'visibility':_0x683cbd['threadId']?_0x8fa1('0xda'):_0x8fa1('0xdb'),'messages':_(_0x683cbd[_0x8fa1('0xd1')])[_0x8fa1('0x81')]({'secret':![]})['map'](function(_0x36c31a){if(_0x36c31a['Attachment']){var _0x4f5674=path['join'](_0x527f26,_0x36c31a['Attachment'][_0x8fa1('0xdc')]);if(fs[_0x8fa1('0xdd')](_0x4f5674)){fs[_0x8fa1('0xde')](_0x4f5674)['pipe'](fs[_0x8fa1('0xdf')](path[_0x8fa1('0xc9')](_0x21897e,_0x36c31a[_0x8fa1('0xe0')][_0x8fa1('0xdc')])));}}return{'date':moment(_0x36c31a[_0x8fa1('0x75')])['format'](_0x8fa1('0xbf'))[_0x8fa1('0x9a')](),'sender':_0x36c31a[_0x8fa1('0xd2')]===_0x8fa1('0xe1')?_0x36c31a[_0x8fa1('0x6e')]?_0x36c31a[_0x8fa1('0x6e')][_0x8fa1('0x2e')]:_0x8fa1('0xe2'):_0x36c31a[_0x8fa1('0x64')][_0x8fa1('0xce')]+(_0x36c31a[_0x8fa1('0x64')][_0x8fa1('0xcf')]?'\x20'+_0x36c31a[_0x8fa1('0x64')][_0x8fa1('0xcf')]:''),'body':_0x36c31a[_0x8fa1('0xe0')]?_0x36c31a['Attachment'][_0x8fa1('0xdc')]:_0x36c31a[_0x8fa1('0x71')],'direction':_0x36c31a[_0x8fa1('0xd2')]==='out'?'A':'C','secret':_0x36c31a['secret'],'read':_0x36c31a[_0x8fa1('0x7c')],'attachment':_0x36c31a[_0x8fa1('0xe0')]};})[_0x8fa1('0x60')]()};return ejs[_0x8fa1('0xe3')](path[_0x8fa1('0xc9')](config[_0x8fa1('0xca')],_0x8fa1('0xcb'),_0x8fa1('0xe4'),_0x8fa1('0xe5')),{'interaction':_0x33ba6c})[_0x8fa1('0x29')](function(_0x1c2626){var _0x21951c=path['join'](_0x21897e,_0x8fa1('0xe6')+_0x683cbd['id']+'-'+_0x4f949b+_0x8fa1('0xe7'));var _0x503fb1={'path':_0x21951c,'channel':'Openchannel','interactionId':_0x683cbd['id']};return pdf[_0x8fa1('0xe8')](_0x1c2626,_0x503fb1);})[_0x8fa1('0x29')](function(){return new BPromise(function(_0xc4df8,_0x595545){zipdir(_0x21897e,{'saveTo':_0x141ebb},function(_0x4f9c41,_0x2fc097){if(_0x4f9c41)return _0x595545(_0x4f9c41);return _0xc4df8(_0x2fc097);});})['then'](function(){return new BPromise(function(_0x1acb6c,_0x48f2cf){rimraf(_0x21897e,function(_0x9fa104){if(_0x9fa104)_0x48f2cf(_0x9fa104);return _0x1acb6c();});});})[_0x8fa1('0x29')](function(){return _0x568533['download'](_0x141ebb,_0x197103,function(_0x14703a){if(_0x14703a){console[_0x8fa1('0xe9')](_0x8fa1('0xea'),_0x14703a);}else{fs[_0x8fa1('0xeb')](_0x141ebb);}});});});}else{return _0x568533['sendStatus'](0xc8);}})['catch'](handleError(_0x568533,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index f9aadb3..f06e180 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 _0x2581=['OpenchannelMessage','setMaxListeners','save','update','getUsers','setDataValue','findAll','then','unreadMessages','length','emit','catch','hook','events','../../mysqldb','OpenchannelInteraction'];(function(_0x5e58d6,_0x553e06){var _0x1f571c=function(_0x47c666){while(--_0x47c666){_0x5e58d6['push'](_0x5e58d6['shift']());}};_0x1f571c(++_0x553e06);}(_0x2581,0x9d));var _0x1258=function(_0x385931,_0x431805){_0x385931=_0x385931-0x0;var _0x97058=_0x2581[_0x385931];return _0x97058;};'use strict';var EventEmitter=require(_0x1258('0x0'));var OpenchannelInteraction=require(_0x1258('0x1'))['db'][_0x1258('0x2')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x1258('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x1258('0x4')](0x0);var events={'afterCreate':_0x1258('0x5'),'afterUpdate':_0x1258('0x6'),'afterDestroy':'remove'};function emitEvent(_0x1c9fe9){return function(_0x25832a,_0x3fe96b,_0x37d739){_0x25832a[_0x1258('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1479fc){_0x25832a[_0x1258('0x8')]('Users',_0x1479fc['map'](function(_0x2b0267){return{'id':_0x2b0267['id']};}));return OpenchannelMessage[_0x1258('0x9')]({'where':{'OpenchannelInteractionId':_0x25832a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1258('0xa')](function(_0x4ee664){_0x25832a[_0x1258('0x8')](_0x1258('0xb'),_0x4ee664[_0x1258('0xc')]);OpenchannelInteractionEvents[_0x1258('0xd')](_0x1c9fe9+':'+_0x25832a['id'],_0x25832a);OpenchannelInteractionEvents[_0x1258('0xd')](_0x1c9fe9,_0x25832a);_0x37d739(null);})[_0x1258('0xe')](_0x37d739(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x1258('0xf')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x519e=['save','update','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage'];(function(_0x11ee59,_0x11f8c1){var _0x35bc14=function(_0x278b2a){while(--_0x278b2a){_0x11ee59['push'](_0x11ee59['shift']());}};_0x35bc14(++_0x11f8c1);}(_0x519e,0x10c));var _0xe519=function(_0x124a89,_0x2e9c87){_0x124a89=_0x124a89-0x0;var _0x2a7ebb=_0x519e[_0x124a89];return _0x2a7ebb;};'use strict';var EventEmitter=require(_0xe519('0x0'));var OpenchannelInteraction=require(_0xe519('0x1'))['db'][_0xe519('0x2')];var OpenchannelMessage=require(_0xe519('0x1'))['db'][_0xe519('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe519('0x4'),'afterUpdate':_0xe519('0x5'),'afterDestroy':'remove'};function emitEvent(_0x204f2d){return function(_0x413a4f,_0x22259a,_0x7134f9){_0x413a4f[_0xe519('0x6')]({'attributes':['id'],'raw':!![]})[_0xe519('0x7')](function(_0x4ac0f4){_0x413a4f[_0xe519('0x8')](_0xe519('0x9'),_0x4ac0f4[_0xe519('0xa')](function(_0xc07ae0){return{'id':_0xc07ae0['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x413a4f['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe519('0x7')](function(_0x1b002b){_0x413a4f[_0xe519('0x8')](_0xe519('0xb'),_0x1b002b[_0xe519('0xc')]);OpenchannelInteractionEvents[_0xe519('0xd')](_0x204f2d+':'+_0x413a4f['id'],_0x413a4f);OpenchannelInteractionEvents['emit'](_0x204f2d,_0x413a4f);_0x7134f9(null);})['catch'](_0x7134f9(null));};}for(var e in events){if(events[_0xe519('0xe')](e)){var event=events[e];OpenchannelInteraction[_0xe519('0xf')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 33ad4c9..d02a9cb 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 _0xc59d=['closedAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed'];(function(_0x2bdc1f,_0x15a033){var _0x599318=function(_0x4e270f){while(--_0x4e270f){_0x2bdc1f['push'](_0x2bdc1f['shift']());}};_0x599318(++_0x15a033);}(_0xc59d,0x11e));var _0xdc59=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc59d[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xdc59('0x0'));var util=require(_0xdc59('0x1'));var logger=require(_0xdc59('0x2'))(_0xdc59('0x3'));var moment=require(_0xdc59('0x4'));var BPromise=require(_0xdc59('0x5'));var rp=require(_0xdc59('0x6'));var fs=require('fs');var path=require(_0xdc59('0x7'));var rimraf=require(_0xdc59('0x8'));var config=require(_0xdc59('0x9'));var attributes=require(_0xdc59('0xa'));module[_0xdc59('0xb')]=function(_0x37a266,_0x5337c3){return _0x37a266[_0xdc59('0xc')](_0xdc59('0xd'),attributes,{'tableName':_0xdc59('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdc59('0xf'),'collate':_0xdc59('0x10'),'hooks':{'beforeUpdate':function(_0x3d1615,_0x3c53cc,_0x482299){if(_0x3d1615[_0xdc59('0x11')]('closed')){_0x3d1615[_0xdc59('0x12')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x482299(null,_0x3d1615);}}});}; \ No newline at end of file +var _0x3d91=['moment','bluebird','request-promise','path','../../config/environment','exports','OpenchannelInteraction','openchannel_interactions','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api'];(function(_0x5e0e90,_0x1c8363){var _0x33cfe3=function(_0x44f842){while(--_0x44f842){_0x5e0e90['push'](_0x5e0e90['shift']());}};_0x33cfe3(++_0x1c8363);}(_0x3d91,0x1d9));var _0x13d9=function(_0x5b2433,_0x55e16e){_0x5b2433=_0x5b2433-0x0;var _0x43dfe0=_0x3d91[_0x5b2433];return _0x43dfe0;};'use strict';var _=require(_0x13d9('0x0'));var util=require('util');var logger=require(_0x13d9('0x1'))(_0x13d9('0x2'));var moment=require(_0x13d9('0x3'));var BPromise=require(_0x13d9('0x4'));var rp=require(_0x13d9('0x5'));var fs=require('fs');var path=require(_0x13d9('0x6'));var rimraf=require('rimraf');var config=require(_0x13d9('0x7'));var attributes=require('./openchannelInteraction.attributes');module[_0x13d9('0x8')]=function(_0x43c570,_0x13b1b4){return _0x43c570['define'](_0x13d9('0x9'),attributes,{'tableName':_0x13d9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x13d9('0xb'),'hooks':{'beforeUpdate':function(_0x5afaed,_0x177b66,_0x1f68e2){if(_0x5afaed[_0x13d9('0xc')](_0x13d9('0xd'))){_0x5afaed[_0x13d9('0xe')]=moment()[_0x13d9('0xf')](_0x13d9('0x10'));}_0x1f68e2(null,_0x5afaed);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index af9148a..a711f39 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 _0x0300=['OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','result','UpdateOpenchannelInteraction','OpenchannelInteraction','options','raw','where','attributes','limit','debug','find','body','ids','omit','spread','AddTags','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','then','info'];(function(_0x23c0a6,_0x354b7d){var _0x27eaf3=function(_0x31862a){while(--_0x31862a){_0x23c0a6['push'](_0x23c0a6['shift']());}};_0x27eaf3(++_0x354b7d);}(_0x0300,0x107));var _0x0030=function(_0x599a81,_0x4b4ee7){_0x599a81=_0x599a81-0x0;var _0x766623=_0x0300[_0x599a81];return _0x766623;};'use strict';var _=require(_0x0030('0x0'));var util=require(_0x0030('0x1'));var moment=require(_0x0030('0x2'));var BPromise=require(_0x0030('0x3'));var rs=require(_0x0030('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0030('0x5'));var logger=require(_0x0030('0x6'))(_0x0030('0x7'));var config=require('../../config/environment');var jayson=require(_0x0030('0x8'));var client=jayson['client'][_0x0030('0x9')]({'port':0x232a});config[_0x0030('0xa')]=_['defaults'](config['redis'],{'host':_0x0030('0xb'),'port':0x18eb});var socket=require(_0x0030('0xc'))(new Redis(config[_0x0030('0xa')]));require(_0x0030('0xd'))[_0x0030('0xe')](socket);function respondWithRpcPromise(_0x325fde,_0x2af161,_0x38c7e8){return new BPromise(function(_0x559607,_0x268617){return client['request'](_0x325fde,_0x38c7e8)[_0x0030('0xf')](function(_0x33ad47){logger[_0x0030('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2af161,'request\x20sent');logger['debug'](_0x0030('0x11'),_0x2af161,_0x0030('0x12'),JSON[_0x0030('0x13')](_0x33ad47));if(_0x33ad47[_0x0030('0x14')]){if(_0x33ad47[_0x0030('0x14')][_0x0030('0x15')]===0x1f4){logger[_0x0030('0x14')](_0x0030('0x16'),_0x2af161,_0x33ad47[_0x0030('0x14')][_0x0030('0x17')]);return _0x268617(_0x33ad47['error'][_0x0030('0x17')]);}logger[_0x0030('0x14')](_0x0030('0x16'),_0x2af161,_0x33ad47[_0x0030('0x14')]['message']);return _0x559607(_0x33ad47[_0x0030('0x14')][_0x0030('0x17')]);}else{logger[_0x0030('0x10')](_0x0030('0x16'),_0x2af161,'request\x20sent');_0x559607(_0x33ad47[_0x0030('0x18')][_0x0030('0x17')]);}})['catch'](function(_0xf47c8f){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x2af161,_0xf47c8f);_0x268617(_0xf47c8f);});});}exports[_0x0030('0x19')]=function(_0x453901){var _0x3e88d5=this;return new Promise(function(_0x562763,_0x3ea46b){return db[_0x0030('0x1a')]['update'](_0x453901['body'],{'raw':_0x453901['options']?_0x453901[_0x0030('0x1b')][_0x0030('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x453901[_0x0030('0x1b')]?_0x453901['options'][_0x0030('0x1d')]||null:null,'attributes':_0x453901[_0x0030('0x1b')]?_0x453901[_0x0030('0x1b')][_0x0030('0x1e')]||null:null,'limit':_0x453901[_0x0030('0x1b')]?_0x453901['options'][_0x0030('0x1f')]||null:null})[_0x0030('0xf')](function(_0x2b82a2){logger[_0x0030('0x10')](_0x0030('0x19'),_0x453901);logger[_0x0030('0x20')](_0x0030('0x19'),_0x453901,JSON['stringify'](_0x2b82a2));_0x562763(_0x2b82a2);})['catch'](function(_0x5bd780){logger[_0x0030('0x14')](_0x0030('0x19'),_0x5bd780[_0x0030('0x17')],_0x453901);_0x3ea46b(_0x3e88d5[_0x0030('0x14')](0x1f4,_0x5bd780[_0x0030('0x17')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x393a75){return new Promise(function(_0x36d0a9,_0x334902){return db[_0x0030('0x1a')][_0x0030('0x21')]({'where':_0x393a75[_0x0030('0x1b')]?_0x393a75[_0x0030('0x1b')]['where']||null:null})['then'](function(_0x20db97){if(_0x20db97){return _0x20db97['addTags'](_0x393a75[_0x0030('0x22')][_0x0030('0x23')],_[_0x0030('0x24')](_0x393a75[_0x0030('0x22')],[_0x0030('0x23'),'id'])||{});}})[_0x0030('0x25')](function(_0x5eadc5){logger['info'](_0x0030('0x26'),_0x393a75);logger[_0x0030('0x20')]('AddTags',_0x393a75,JSON[_0x0030('0x13')](_0x5eadc5));_0x36d0a9(_0x5eadc5);})[_0x0030('0x27')](function(_0xdb3df6){logger['error'](_0x0030('0x26'),_0xdb3df6[_0x0030('0x17')],_0x393a75);_0x334902(_this[_0x0030('0x14')](0x1f4,_0xdb3df6[_0x0030('0x17')]));});});}; \ No newline at end of file +var _0xb1c0=['AddTagsToOpenchannelInteraction','addTags','ids','omit','spread','AddTags','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','then'];(function(_0x3b7079,_0x31dba5){var _0x4de396=function(_0x3bec56){while(--_0x3bec56){_0x3b7079['push'](_0x3b7079['shift']());}};_0x4de396(++_0x31dba5);}(_0xb1c0,0xfd));var _0x0b1c=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xb1c0[_0x5f309e];return _0x487b5e;};'use strict';var _=require('lodash');var util=require(_0x0b1c('0x0'));var moment=require(_0x0b1c('0x1'));var BPromise=require('bluebird');var rs=require(_0x0b1c('0x2'));var fs=require('fs');var Redis=require(_0x0b1c('0x3'));var db=require(_0x0b1c('0x4'))['db'];var utils=require(_0x0b1c('0x5'));var logger=require('../../config/logger')(_0x0b1c('0x6'));var config=require(_0x0b1c('0x7'));var jayson=require(_0x0b1c('0x8'));var client=jayson[_0x0b1c('0x9')]['http']({'port':0x232a});config[_0x0b1c('0xa')]=_['defaults'](config[_0x0b1c('0xa')],{'host':_0x0b1c('0xb'),'port':0x18eb});var socket=require(_0x0b1c('0xc'))(new Redis(config[_0x0b1c('0xa')]));require('./openchannelInteraction.socket')[_0x0b1c('0xd')](socket);function respondWithRpcPromise(_0x2a2f2b,_0x589e44,_0x6deed8){return new BPromise(function(_0x351abb,_0x1a7f3d){return client[_0x0b1c('0xe')](_0x2a2f2b,_0x6deed8)['then'](function(_0x4da4c5){logger[_0x0b1c('0xf')](_0x0b1c('0x10'),_0x589e44,_0x0b1c('0x11'));logger[_0x0b1c('0x12')](_0x0b1c('0x13'),_0x589e44,_0x0b1c('0x11'),JSON['stringify'](_0x4da4c5));if(_0x4da4c5[_0x0b1c('0x14')]){if(_0x4da4c5[_0x0b1c('0x14')][_0x0b1c('0x15')]===0x1f4){logger[_0x0b1c('0x14')](_0x0b1c('0x10'),_0x589e44,_0x4da4c5[_0x0b1c('0x14')][_0x0b1c('0x16')]);return _0x1a7f3d(_0x4da4c5[_0x0b1c('0x14')][_0x0b1c('0x16')]);}logger[_0x0b1c('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x589e44,_0x4da4c5[_0x0b1c('0x14')][_0x0b1c('0x16')]);return _0x351abb(_0x4da4c5[_0x0b1c('0x14')][_0x0b1c('0x16')]);}else{logger[_0x0b1c('0xf')](_0x0b1c('0x10'),_0x589e44,_0x0b1c('0x11'));_0x351abb(_0x4da4c5['result'][_0x0b1c('0x16')]);}})[_0x0b1c('0x17')](function(_0x390925){logger['error'](_0x0b1c('0x10'),_0x589e44,_0x390925);_0x1a7f3d(_0x390925);});});}exports[_0x0b1c('0x18')]=function(_0x20fb53){var _0x28251e=this;return new Promise(function(_0x35561d,_0xaff0c6){return db[_0x0b1c('0x19')][_0x0b1c('0x1a')](_0x20fb53[_0x0b1c('0x1b')],{'raw':_0x20fb53['options']?_0x20fb53[_0x0b1c('0x1c')][_0x0b1c('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20fb53['options']?_0x20fb53[_0x0b1c('0x1c')][_0x0b1c('0x1e')]||null:null,'attributes':_0x20fb53[_0x0b1c('0x1c')]?_0x20fb53['options'][_0x0b1c('0x1f')]||null:null,'limit':_0x20fb53[_0x0b1c('0x1c')]?_0x20fb53[_0x0b1c('0x1c')][_0x0b1c('0x20')]||null:null})[_0x0b1c('0x21')](function(_0x31a51f){logger[_0x0b1c('0xf')](_0x0b1c('0x18'),_0x20fb53);logger[_0x0b1c('0x12')](_0x0b1c('0x18'),_0x20fb53,JSON['stringify'](_0x31a51f));_0x35561d(_0x31a51f);})[_0x0b1c('0x17')](function(_0x335c01){logger[_0x0b1c('0x14')]('UpdateOpenchannelInteraction',_0x335c01['message'],_0x20fb53);_0xaff0c6(_0x28251e[_0x0b1c('0x14')](0x1f4,_0x335c01[_0x0b1c('0x16')]));});});};exports[_0x0b1c('0x22')]=function(_0x177315){return new Promise(function(_0x465020,_0x84053){return db['OpenchannelInteraction']['find']({'where':_0x177315[_0x0b1c('0x1c')]?_0x177315['options']['where']||null:null})['then'](function(_0x3c7899){if(_0x3c7899){return _0x3c7899[_0x0b1c('0x23')](_0x177315['body'][_0x0b1c('0x24')],_[_0x0b1c('0x25')](_0x177315[_0x0b1c('0x1b')],[_0x0b1c('0x24'),'id'])||{});}})[_0x0b1c('0x26')](function(_0x522a32){logger['info']('AddTags',_0x177315);logger[_0x0b1c('0x12')](_0x0b1c('0x27'),_0x177315,JSON[_0x0b1c('0x28')](_0x522a32));_0x465020(_0x522a32);})[_0x0b1c('0x17')](function(_0x20baa1){logger['error'](_0x0b1c('0x27'),_0x20baa1['message'],_0x177315);_0x84053(_this['error'](0x1f4,_0x20baa1[_0x0b1c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index c6f4517..30ab1c2 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 _0x33b4=['openchannelInteraction:','./openchannelInteraction.events','remove','update','emit','removeListener','length'];(function(_0x481691,_0x474008){var _0x5af136=function(_0x44cee3){while(--_0x44cee3){_0x481691['push'](_0x481691['shift']());}};_0x5af136(++_0x474008);}(_0x33b4,0x16d));var _0x433b=function(_0x1785e8,_0x492aac){_0x1785e8=_0x1785e8-0x0;var _0x5e6021=_0x33b4[_0x1785e8];return _0x5e6021;};'use strict';var OpenchannelInteractionEvents=require(_0x433b('0x0'));var events=['save',_0x433b('0x1'),_0x433b('0x2')];function createListener(_0x73ce3d,_0x1c5ee0){return function(_0x268f6e){_0x1c5ee0[_0x433b('0x3')](_0x73ce3d,_0x268f6e);};}function removeListener(_0x508e39,_0x2e8e53){return function(){OpenchannelInteractionEvents[_0x433b('0x4')](_0x508e39,_0x2e8e53);};}exports['register']=function(_0x6cddd4){for(var _0x2919b9=0x0,_0x25c77a=events[_0x433b('0x5')];_0x2919b9<_0x25c77a;_0x2919b9++){var _0x389a44=events[_0x2919b9];var _0x4e5856=createListener(_0x433b('0x6')+_0x389a44,_0x6cddd4);OpenchannelInteractionEvents['on'](_0x389a44,_0x4e5856);}}; \ No newline at end of file +var _0x2c8f=['remove','update','emit','removeListener','register','length','openchannelInteraction:','save'];(function(_0x10a820,_0x3bdcef){var _0x5ae72d=function(_0x7d9822){while(--_0x7d9822){_0x10a820['push'](_0x10a820['shift']());}};_0x5ae72d(++_0x3bdcef);}(_0x2c8f,0x147));var _0xf2c8=function(_0x1cca12,_0x49cbaa){_0x1cca12=_0x1cca12-0x0;var _0x34c97d=_0x2c8f[_0x1cca12];return _0x34c97d;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xf2c8('0x0'),_0xf2c8('0x1'),_0xf2c8('0x2')];function createListener(_0xf933e1,_0xa9d20b){return function(_0x23abff){_0xa9d20b[_0xf2c8('0x3')](_0xf933e1,_0x23abff);};}function removeListener(_0x5b3031,_0x1ee25d){return function(){OpenchannelInteractionEvents[_0xf2c8('0x4')](_0x5b3031,_0x1ee25d);};}exports[_0xf2c8('0x5')]=function(_0x4f2cb1){for(var _0x2451f6=0x0,_0xb7aa72=events[_0xf2c8('0x6')];_0x2451f6<_0xb7aa72;_0x2451f6++){var _0x1f0347=events[_0x2451f6];var _0xcdf892=createListener(_0xf2c8('0x7')+_0x1f0347,_0x4f2cb1);OpenchannelInteractionEvents['on'](_0x1f0347,_0xcdf892);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 1fc7253..166ad80 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x3dab4e,_0x419650){var _0x2a2ec8=function(_0x272dd1){while(--_0x272dd1){_0x3dab4e['push'](_0x3dab4e['shift']());}};_0x2a2ec8(++_0x419650);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file +var _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x319877,_0x53a027){var _0x24056d=function(_0x370cb5){while(--_0x370cb5){_0x319877['push'](_0x319877['shift']());}};_0x24056d(++_0x53a027);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'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');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 33459cc..b240ba4 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 _0x1bc6=['ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x1bc6,0x94));var _0x61bc=function(_0x2ac69d,_0x42398c){_0x2ac69d=_0x2ac69d-0x0;var _0x2022d0=_0x1bc6[_0x2ac69d];return _0x2022d0;};'use strict';var Sequelize=require(_0x61bc('0x0'));module[_0x61bc('0x1')]={'body':{'type':Sequelize[_0x61bc('0x2')](_0x61bc('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x61bc('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x61bc('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x61bc('0x5')]('in','out'),'defaultValue':_0x61bc('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x61bc('0x7')]},'providerName':{'type':Sequelize[_0x61bc('0x8')]},'providerResponse':{'type':Sequelize[_0x61bc('0x2')]}}; \ No newline at end of file +var _0x087b=['STRING','TEXT','sequelize','exports','BOOLEAN','ENUM','out','DATE'];(function(_0x2d8e23,_0x137866){var _0x1eb51a=function(_0x25165d){while(--_0x25165d){_0x2d8e23['push'](_0x2d8e23['shift']());}};_0x1eb51a(++_0x137866);}(_0x087b,0x11a));var _0xb087=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0x087b[_0x580647];return _0x5f0792;};'use strict';var Sequelize=require(_0xb087('0x0'));module[_0xb087('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xb087('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xb087('0x3')]('in',_0xb087('0x4')),'defaultValue':_0xb087('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xb087('0x5')]},'providerName':{'type':Sequelize[_0xb087('0x6')]},'providerResponse':{'type':Sequelize[_0xb087('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 4b210c1..dc64bef 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 _0x758d=['length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','VIRTUAL','options','include','rows','show','params','intersection','fields','create','body','find','describe','openchannel-interactions','openchannel','readAt','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','SIP/%s','channel','motionChannel','accept','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','sequelize','interface','event','EventManager','rejectmessage','eml-format','rimraf','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes'];(function(_0x510c60,_0x50247e){var _0x49c4aa=function(_0x3149c7){while(--_0x3149c7){_0x510c60['push'](_0x510c60['shift']());}};_0x49c4aa(++_0x50247e);}(_0x758d,0xc0));var _0xd758=function(_0x27cf74,_0x465234){_0x27cf74=_0x27cf74-0x0;var _0x5f5997=_0x758d[_0x27cf74];return _0x5f5997;};'use strict';var emlformat=require(_0xd758('0x0'));var rimraf=require(_0xd758('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(_0xd758('0x2'));var util=require(_0xd758('0x3'));var path=require(_0xd758('0x4'));var sox=require(_0xd758('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd758('0x6'));var squel=require(_0xd758('0x7'));var crypto=require(_0xd758('0x8'));var jsforce=require(_0xd758('0x9'));var deskjs=require(_0xd758('0xa'));var toCsv=require(_0xd758('0xb'));var querystring=require(_0xd758('0xc'));var Papa=require(_0xd758('0xd'));var Redis=require('ioredis');var authService=require(_0xd758('0xe'));var qs=require(_0xd758('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd758('0x10'));var logger=require(_0xd758('0x11'))(_0xd758('0x12'));var utils=require(_0xd758('0x13'));var config=require(_0xd758('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd758('0x15'))['db'];config[_0xd758('0x16')]=_[_0xd758('0x17')](config[_0xd758('0x16')],{'host':_0xd758('0x18'),'port':0x18eb});var socket=require(_0xd758('0x19'))(new Redis(config[_0xd758('0x16')]));require('./openchannelMessage.socket')[_0xd758('0x1a')](socket);var jayson=require(_0xd758('0x1b'));var client=jayson[_0xd758('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0xd758('0x1c')][_0xd758('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x9ac450,_0x570dda,_0x1dd258,_0x4caf6c){return new BPromise(function(_0x1c07e8,_0x3e5eee){var _0x1e7eca=_0x4caf6c||client;return _0x1e7eca[_0xd758('0x1e')](_0x9ac450,_0x1dd258)['then'](function(_0x557e69){logger['info'](_0xd758('0x1f'),_0x570dda,'request\x20sent');logger[_0xd758('0x20')](_0xd758('0x21'),_0x570dda,_0xd758('0x22'),JSON[_0xd758('0x23')](_0x557e69));if(_0x557e69['error']){if(_0x557e69['error'][_0xd758('0x24')]===0x1f4){logger[_0xd758('0x25')](_0xd758('0x1f'),_0x570dda,_0x557e69['error'][_0xd758('0x26')]);return _0x3e5eee(_0x557e69['error']['message']);}logger[_0xd758('0x25')](_0xd758('0x1f'),_0x570dda,_0x557e69[_0xd758('0x25')]['message']);return _0x1c07e8(_0x557e69[_0xd758('0x25')]['message']);}else{logger[_0xd758('0x27')](_0xd758('0x1f'),_0x570dda,_0xd758('0x22'));_0x1c07e8(_0x557e69[_0xd758('0x28')]['message']);}})[_0xd758('0x29')](function(_0x4a9ef9){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x570dda,_0x4a9ef9);_0x3e5eee(_0x4a9ef9);});});}function respondWithStatusCode(_0x3e99b3,_0x598a8f){_0x598a8f=_0x598a8f||0xcc;return function(_0x284676){if(_0x284676){return _0x3e99b3['sendStatus'](_0x598a8f);}return _0x3e99b3[_0xd758('0x2a')](_0x598a8f)[_0xd758('0x2b')]();};}function respondWithResult(_0x21194f,_0x1f5e6d){_0x1f5e6d=_0x1f5e6d||0xc8;return function(_0x2204a4){if(_0x2204a4){return _0x21194f[_0xd758('0x2a')](_0x1f5e6d)[_0xd758('0x2c')](_0x2204a4);}};}function respondWithFilteredResult(_0x7743c1,_0x5bd054){return function(_0x5c2a34){if(_0x5c2a34){var _0x5c414c=typeof _0x5bd054[_0xd758('0x2d')]===_0xd758('0x2e')&&typeof _0x5bd054['limit']==='undefined';var _0x227e28=_0x5c2a34[_0xd758('0x2f')];var _0x507b7a=_0x5c414c?0x0:_0x5bd054[_0xd758('0x2d')];var _0x20f581=_0x5c414c?_0x5c2a34[_0xd758('0x2f')]:_0x5bd054[_0xd758('0x2d')]+_0x5bd054['limit'];var _0x5db9da;if(_0x20f581>=_0x227e28){_0x20f581=_0x227e28;_0x5db9da=0xc8;}else{_0x5db9da=0xce;}_0x7743c1[_0xd758('0x2a')](_0x5db9da);return _0x7743c1['set'](_0xd758('0x30'),_0x507b7a+'-'+_0x20f581+'/'+_0x227e28)['json'](_0x5c2a34);}return null;};}function patchUpdates(_0x2250fd){return function(_0x3e8c25){try{jsonpatch[_0xd758('0x31')](_0x3e8c25,_0x2250fd,!![]);}catch(_0x172640){return BPromise[_0xd758('0x32')](_0x172640);}return _0x3e8c25[_0xd758('0x33')]();};}function saveUpdates(_0x10a423,_0x2c911f){return function(_0x2a9b93){if(_0x2a9b93){return _0x2a9b93[_0xd758('0x34')](_0x10a423)[_0xd758('0x35')](function(_0x2aa8e1){return _0x2aa8e1;});}return null;};}function removeEntity(_0x26905e,_0x5173bb){return function(_0x27d413){if(_0x27d413){return _0x27d413[_0xd758('0x36')]()['then'](function(){_0x26905e[_0xd758('0x2a')](0xcc)[_0xd758('0x2b')]();});}};}function handleEntityNotFound(_0x16e647,_0x2847cf){return function(_0x45b597){if(!_0x45b597){_0x16e647[_0xd758('0x37')](0x194);}return _0x45b597;};}function handleError(_0x26577a,_0x276b21){_0x276b21=_0x276b21||0x1f4;return function(_0x47c540){logger[_0xd758('0x25')](_0x47c540[_0xd758('0x38')]);if(_0x47c540[_0xd758('0x39')]){delete _0x47c540[_0xd758('0x39')];}_0x26577a[_0xd758('0x2a')](_0x276b21)[_0xd758('0x3a')](_0x47c540);};}exports['index']=function(_0x50516d,_0x5094a5){var _0x1c82ce={},_0x501370={},_0x4acaab={'count':0x0,'rows':[]};var _0xc574f1=_[_0xd758('0x3b')](db[_0xd758('0x3c')][_0xd758('0x3d')],function(_0x33e74d){return{'name':_0x33e74d[_0xd758('0x3e')],'type':_0x33e74d[_0xd758('0x3f')][_0xd758('0x40')]};});_0x501370[_0xd758('0x41')]=_[_0xd758('0x3b')](_0xc574f1,_0xd758('0x39'));_0x501370['query']=_[_0xd758('0x42')](_0x50516d['query']);_0x501370[_0xd758('0x43')]=_['intersection'](_0x501370[_0xd758('0x41')],_0x501370[_0xd758('0x44')]);_0x1c82ce[_0xd758('0x45')]=_['intersection'](_0x501370['model'],qs['fields'](_0x50516d[_0xd758('0x44')]['fields']));_0x1c82ce[_0xd758('0x45')]=_0x1c82ce[_0xd758('0x45')][_0xd758('0x46')]?_0x1c82ce[_0xd758('0x45')]:_0x501370[_0xd758('0x41')];if(!_0x50516d[_0xd758('0x44')][_0xd758('0x47')](_0xd758('0x48'))){_0x1c82ce[_0xd758('0x49')]=qs['limit'](_0x50516d[_0xd758('0x44')][_0xd758('0x49')]);_0x1c82ce[_0xd758('0x2d')]=qs['offset'](_0x50516d['query']['offset']);}_0x1c82ce[_0xd758('0x4a')]=qs[_0xd758('0x4b')](_0x50516d[_0xd758('0x44')][_0xd758('0x4b')]);_0x1c82ce['where']=qs[_0xd758('0x43')](_['pick'](_0x50516d[_0xd758('0x44')],_0x501370['filters']),_0xc574f1);if(_0x50516d['query'][_0xd758('0x4c')]){_0x1c82ce[_0xd758('0x4d')]=_[_0xd758('0x4e')](_0x1c82ce['where'],{'$or':_['map'](_0xc574f1,function(_0x109554){if(_0x109554['type']!==_0xd758('0x4f')){var _0x22c788={};_0x22c788[_0x109554['name']]={'$like':'%'+_0x50516d[_0xd758('0x44')][_0xd758('0x4c')]+'%'};return _0x22c788;}})});}_0x1c82ce=_[_0xd758('0x4e')]({},_0x1c82ce,_0x50516d[_0xd758('0x50')]);var _0x33f7b1={'where':_0x1c82ce['where']};return db[_0xd758('0x3c')][_0xd758('0x2f')](_0x33f7b1)[_0xd758('0x35')](function(_0x5708a4){_0x4acaab['count']=_0x5708a4;if(_0x50516d[_0xd758('0x44')]['includeAll']){_0x1c82ce[_0xd758('0x51')]=[{'all':!![]}];}return db[_0xd758('0x3c')]['findAll'](_0x1c82ce);})[_0xd758('0x35')](function(_0x478a52){_0x4acaab[_0xd758('0x52')]=_0x478a52;return _0x4acaab;})['then'](respondWithFilteredResult(_0x5094a5,_0x1c82ce))[_0xd758('0x29')](handleError(_0x5094a5,null));};exports[_0xd758('0x53')]=function(_0x5be92a,_0x4abd98){var _0x4c2901={'raw':!![],'where':{'id':_0x5be92a[_0xd758('0x54')]['id']}},_0x1fe51b={};_0x1fe51b[_0xd758('0x41')]=_[_0xd758('0x42')](db[_0xd758('0x3c')][_0xd758('0x3d')]);_0x1fe51b[_0xd758('0x44')]=_[_0xd758('0x42')](_0x5be92a['query']);_0x1fe51b[_0xd758('0x43')]=_[_0xd758('0x55')](_0x1fe51b['model'],_0x1fe51b[_0xd758('0x44')]);_0x4c2901[_0xd758('0x45')]=_[_0xd758('0x55')](_0x1fe51b[_0xd758('0x41')],qs['fields'](_0x5be92a['query'][_0xd758('0x56')]));_0x4c2901['attributes']=_0x4c2901[_0xd758('0x45')]['length']?_0x4c2901['attributes']:_0x1fe51b[_0xd758('0x41')];if(_0x5be92a[_0xd758('0x44')]['includeAll']){_0x4c2901['include']=[{'all':!![]}];}_0x4c2901=_[_0xd758('0x4e')]({},_0x4c2901,_0x5be92a[_0xd758('0x50')]);return db[_0xd758('0x3c')]['find'](_0x4c2901)[_0xd758('0x35')](handleEntityNotFound(_0x4abd98,null))[_0xd758('0x35')](respondWithResult(_0x4abd98,null))['catch'](handleError(_0x4abd98,null));};exports[_0xd758('0x57')]=function(_0x2403db,_0x15f8f9){return db[_0xd758('0x3c')][_0xd758('0x57')](_0x2403db[_0xd758('0x58')],{})['then'](respondWithResult(_0x15f8f9,0xc9))[_0xd758('0x29')](handleError(_0x15f8f9,null));};exports[_0xd758('0x34')]=function(_0x534fdb,_0x5b1ad0){if(_0x534fdb[_0xd758('0x58')]['id']){delete _0x534fdb[_0xd758('0x58')]['id'];}return db[_0xd758('0x3c')][_0xd758('0x59')]({'where':{'id':_0x534fdb[_0xd758('0x54')]['id']}})[_0xd758('0x35')](handleEntityNotFound(_0x5b1ad0,null))['then'](saveUpdates(_0x534fdb[_0xd758('0x58')],null))[_0xd758('0x35')](respondWithResult(_0x5b1ad0,null))[_0xd758('0x29')](handleError(_0x5b1ad0,null));};exports[_0xd758('0x36')]=function(_0x5c6d4c,_0xee8fd3){return db[_0xd758('0x3c')][_0xd758('0x59')]({'where':{'id':_0x5c6d4c['params']['id']}})[_0xd758('0x35')](handleEntityNotFound(_0xee8fd3,null))[_0xd758('0x35')](removeEntity(_0xee8fd3,null))[_0xd758('0x29')](handleError(_0xee8fd3,null));};exports[_0xd758('0x5a')]=function(_0x323b2e,_0x4ee0b2){return db[_0xd758('0x3c')][_0xd758('0x5a')]()[_0xd758('0x35')](respondWithResult(_0x4ee0b2,null))[_0xd758('0x29')](handleError(_0x4ee0b2,null));};var interaction_log=require(_0xd758('0x11'))(_0xd758('0x5b'));exports['accept']=function(_0x4f4398,_0x346d79,_0x255f4b){var _0x56e56d={'agent':{},'channel':_0xd758('0x5c')};if(_0x4f4398['body']['id']){delete _0x4f4398['body']['id'];}_0x4f4398[_0xd758('0x58')]['read']=!![];_0x4f4398[_0xd758('0x58')][_0xd758('0x5d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4f4398[_0xd758('0x58')]['UserId']=_0x4f4398['body'][_0xd758('0x5e')]||_0x4f4398[_0xd758('0x5f')]['id'];_0x56e56d[_0xd758('0x60')]['id']=_0x4f4398[_0xd758('0x58')]['UserId'];return db[_0xd758('0x3c')][_0xd758('0x59')]({'where':{'id':_0x4f4398[_0xd758('0x54')]['id'],'UserId':null}})[_0xd758('0x35')](handleEntityNotFound(_0x346d79,null))[_0xd758('0x35')](saveUpdates(_0x4f4398[_0xd758('0x58')],null))[_0xd758('0x35')](function(_0x29a35f){if(_0x29a35f){_0x56e56d[_0xd758('0x26')]=_0x29a35f[_0xd758('0x61')]({'plain':!![]});return db[_0xd758('0x62')][_0xd758('0x59')]({'where':{'id':_0x29a35f[_0xd758('0x63')]}});}return null;})[_0xd758('0x35')](handleEntityNotFound(_0x346d79,null))['then'](function(_0x10d5d1){if(_0x10d5d1){return _0x10d5d1[_0xd758('0x34')]({'UserId':_0x4f4398['body'][_0xd758('0x5e')],'read1stAt':_['isNil'](_0x10d5d1[_0xd758('0x64')])?moment()[_0xd758('0x65')](_0xd758('0x66')):undefined});}return null;})[_0xd758('0x35')](function(_0x5df9b1){if(_0x5df9b1){_0x56e56d[_0xd758('0x67')]=_0x5df9b1[_0xd758('0x61')]({'plain':!![]});interaction_log[_0xd758('0x27')](_0xd758('0x68'),_0x4f4398[_0xd758('0x5f')]['id'],_0x4f4398[_0xd758('0x5f')][_0xd758('0x39')],_0x4f4398[_0xd758('0x5f')][_0xd758('0x69')],_0x56e56d[_0xd758('0x67')]['id'],_0x4f4398['body']?JSON[_0xd758('0x23')](_0x4f4398[_0xd758('0x58')]):'null');return respondWithRpcPromise(_0xd758('0x6a'),_0xd758('0x6b'),_0x56e56d);}return null;})['then'](function(_0x533821){var _0xa38a15=_0xd758('0x6c')+_0x533821[_0xd758('0x26')][_0xd758('0x6d')];return db['sequelize'][_0xd758('0x44')](_0xa38a15,{'type':db[_0xd758('0x6e')][_0xd758('0x6f')][_0xd758('0x70')],'raw':!![]})[_0xd758('0x35')](function(_0x323b9d){return _0x323b9d;});})[_0xd758('0x35')](function(_0x314982){if(_0x314982){_0x56e56d[_0xd758('0x26')][_0xd758('0x71')]=_0x314982[0x0];if(!_0x4f4398[_0xd758('0x58')]['UserId'])return;return db[_0xd758('0x72')][_0xd758('0x59')]({'where':{'id':_0x4f4398[_0xd758('0x58')][_0xd758('0x5e')],'role':'agent'},'attributes':['id',_0xd758('0x39'),_0xd758('0x73'),_0xd758('0x74'),'internal'],'raw':!![]});}return null;})['then'](function(_0x20ec52){if(!_0x20ec52)return null;_0x56e56d[_0xd758('0x26')][_0xd758('0x60')]=_0x20ec52;return _0x56e56d;})[_0xd758('0x35')](function(_0x1cfa52){if(_0x1cfa52){if(_0x4f4398[_0xd758('0x58')]['manual']){_0x56e56d[_0xd758('0x26')]['interface']=util[_0xd758('0x65')](_0xd758('0x75'),_0x4f4398['user'][_0xd758('0x39')]);_0x56e56d[_0xd758('0x26')]['channel']=_0x56e56d[_0xd758('0x76')];_0x56e56d[_0xd758('0x26')][_0xd758('0x77')]=_0x56e56d[_0xd758('0x76')];_0x56e56d[_0xd758('0x26')]['event']=_0xd758('0x78');return respondWithRpcPromise('EventManager','EventManager',{'event':_0xd758('0x79'),'message':_0x56e56d[_0xd758('0x26')]},client9002)[_0xd758('0x35')](function(){return _0x56e56d;});}return _0x56e56d;}return null;})[_0xd758('0x35')](respondWithResult(_0x346d79,null))['catch'](handleError(_0x346d79,null));};var interaction_log=require(_0xd758('0x11'))(_0xd758('0x5b'));exports[_0xd758('0x32')]=function(_0x4b797c,_0x5836ba,_0x1bf18f){var _0x70ea75={'agent':{},'channel':_0xd758('0x5c')};if(_0x4b797c[_0xd758('0x58')]['id']){delete _0x4b797c[_0xd758('0x58')]['id'];}_0x4b797c[_0xd758('0x58')][_0xd758('0x5e')]=_0x4b797c[_0xd758('0x58')][_0xd758('0x5e')]||_0x4b797c[_0xd758('0x5f')]['id'];_0x70ea75[_0xd758('0x60')]['id']=_0x4b797c[_0xd758('0x58')][_0xd758('0x5e')];return db['OpenchannelMessage']['find']({'where':{'id':_0x4b797c['params']['id'],'UserId':null}})[_0xd758('0x35')](handleEntityNotFound(_0x5836ba,null))[_0xd758('0x35')](function(_0x4eafcb){if(_0x4eafcb){_0x70ea75[_0xd758('0x26')]=_0x4eafcb['get']({'plain':!![]});return db[_0xd758('0x62')][_0xd758('0x59')]({'where':{'id':_0x4eafcb[_0xd758('0x63')]}});}return null;})[_0xd758('0x35')](handleEntityNotFound(_0x5836ba,null))[_0xd758('0x35')](function(_0x115a80){if(_0x115a80){_0x70ea75[_0xd758('0x67')]=_0x115a80[_0xd758('0x61')]({'plain':!![]});interaction_log[_0xd758('0x27')](_0xd758('0x7a'),_0x4b797c[_0xd758('0x5f')]['id'],_0x4b797c[_0xd758('0x5f')][_0xd758('0x39')],_0x4b797c['user']['role'],_0x70ea75[_0xd758('0x67')]['id'],_0x4b797c[_0xd758('0x58')]?JSON['stringify'](_0x4b797c[_0xd758('0x58')]):_0xd758('0x7b'));return respondWithRpcPromise(_0xd758('0x7c'),_0xd758('0x7d'),_0x70ea75);}return null;})[_0xd758('0x35')](function(_0x583a08){var _0x5c79aa=_0xd758('0x6c')+_0x583a08[_0xd758('0x26')][_0xd758('0x6d')];return db[_0xd758('0x7e')]['query'](_0x5c79aa,{'type':db[_0xd758('0x6e')][_0xd758('0x6f')]['SELECT'],'raw':!![]})[_0xd758('0x35')](function(_0x21b735){return _0x21b735;});})[_0xd758('0x35')](function(_0x23baa0){if(_0x23baa0){_0x70ea75[_0xd758('0x26')][_0xd758('0x71')]=_0x23baa0[0x0];if(!_0x4b797c[_0xd758('0x58')]['UserId'])return;return db[_0xd758('0x72')][_0xd758('0x59')]({'where':{'id':_0x4b797c[_0xd758('0x58')]['UserId'],'role':'agent'},'attributes':['id',_0xd758('0x39'),_0xd758('0x73'),'email','internal'],'raw':!![]});}return null;})[_0xd758('0x35')](function(_0x488861){if(!_0x488861)return null;_0x70ea75[_0xd758('0x26')]['agent']=_0x488861;return _0x70ea75;})[_0xd758('0x35')](function(_0x569a7f){if(_0x569a7f){_0x569a7f[_0xd758('0x26')][_0xd758('0x7f')]=util[_0xd758('0x65')]('SIP/%s',_0x4b797c[_0xd758('0x5f')][_0xd758('0x39')]);_0x569a7f[_0xd758('0x26')][_0xd758('0x76')]=_0x70ea75['channel'];_0x569a7f[_0xd758('0x26')][_0xd758('0x77')]=_0x70ea75[_0xd758('0x76')];_0x569a7f[_0xd758('0x26')][_0xd758('0x80')]='reject';respondWithRpcPromise('EventManager',_0xd758('0x81'),{'event':_0xd758('0x82'),'message':_0x569a7f[_0xd758('0x26')]},client9002);return _0x70ea75;}return null;})[_0xd758('0x35')](respondWithResult(_0x5836ba,null))['catch'](handleError(_0x5836ba,null));}; \ No newline at end of file +var _0x6215=['readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','OpenchannelInteraction','isNil','read1stAt','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','User','manual','interface','channel','motionChannel','EventManager','acceptmessage','openchannel-interactions','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','fullname','email','internal','SIP/%s','event','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./openchannelMessage.socket','register','http','client','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','OpenchannelMessage','include','create','body','find','describe','accept','openchannel','read'];(function(_0x1b0a36,_0x360514){var _0x3dff4f=function(_0x44ac66){while(--_0x44ac66){_0x1b0a36['push'](_0x1b0a36['shift']());}};_0x3dff4f(++_0x360514);}(_0x6215,0x13f));var _0x5621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6215[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x5621('0x0'));var rimraf=require(_0x5621('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5621('0x2'));var rp=require(_0x5621('0x3'));var moment=require(_0x5621('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5621('0x5'));var util=require(_0x5621('0x6'));var path=require(_0x5621('0x7'));var sox=require(_0x5621('0x8'));var csv=require(_0x5621('0x9'));var ejs=require(_0x5621('0xa'));var fs=require('fs');var fs_extra=require(_0x5621('0xb'));var _=require(_0x5621('0xc'));var squel=require(_0x5621('0xd'));var crypto=require(_0x5621('0xe'));var jsforce=require(_0x5621('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x5621('0x9'));var querystring=require('querystring');var Papa=require(_0x5621('0x10'));var Redis=require(_0x5621('0x11'));var authService=require(_0x5621('0x12'));var qs=require(_0x5621('0x13'));var as=require(_0x5621('0x14'));var hardwareService=require(_0x5621('0x15'));var logger=require(_0x5621('0x16'))(_0x5621('0x17'));var utils=require(_0x5621('0x18'));var config=require(_0x5621('0x19'));var licenseUtil=require(_0x5621('0x1a'));var db=require(_0x5621('0x1b'))['db'];config[_0x5621('0x1c')]=_['defaults'](config['redis'],{'host':_0x5621('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5621('0x1c')]));require(_0x5621('0x1e'))[_0x5621('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x5621('0x20')]({'port':0x232c});var client9002=jayson[_0x5621('0x21')][_0x5621('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x36b782,_0x4e9c13,_0x12c25e,_0x226395){return new BPromise(function(_0x24f702,_0x793e87){var _0x480b8f=_0x226395||client;return _0x480b8f[_0x5621('0x22')](_0x36b782,_0x12c25e)[_0x5621('0x23')](function(_0x15f428){logger[_0x5621('0x24')](_0x5621('0x25'),_0x4e9c13,_0x5621('0x26'));logger[_0x5621('0x27')](_0x5621('0x28'),_0x4e9c13,_0x5621('0x26'),JSON[_0x5621('0x29')](_0x15f428));if(_0x15f428[_0x5621('0x2a')]){if(_0x15f428['error'][_0x5621('0x2b')]===0x1f4){logger['error'](_0x5621('0x25'),_0x4e9c13,_0x15f428['error'][_0x5621('0x2c')]);return _0x793e87(_0x15f428[_0x5621('0x2a')][_0x5621('0x2c')]);}logger[_0x5621('0x2a')](_0x5621('0x25'),_0x4e9c13,_0x15f428[_0x5621('0x2a')][_0x5621('0x2c')]);return _0x24f702(_0x15f428['error'][_0x5621('0x2c')]);}else{logger[_0x5621('0x24')](_0x5621('0x25'),_0x4e9c13,_0x5621('0x26'));_0x24f702(_0x15f428[_0x5621('0x2d')][_0x5621('0x2c')]);}})[_0x5621('0x2e')](function(_0x545f9a){logger[_0x5621('0x2a')](_0x5621('0x25'),_0x4e9c13,_0x545f9a);_0x793e87(_0x545f9a);});});}function respondWithStatusCode(_0x5e0e16,_0x3511b2){_0x3511b2=_0x3511b2||0xcc;return function(_0x1ba34c){if(_0x1ba34c){return _0x5e0e16[_0x5621('0x2f')](_0x3511b2);}return _0x5e0e16[_0x5621('0x30')](_0x3511b2)[_0x5621('0x31')]();};}function respondWithResult(_0x54bece,_0x4cf437){_0x4cf437=_0x4cf437||0xc8;return function(_0x2545b5){if(_0x2545b5){return _0x54bece[_0x5621('0x30')](_0x4cf437)[_0x5621('0x32')](_0x2545b5);}};}function respondWithFilteredResult(_0x3c9b5a,_0x32ac0c){return function(_0x4eda80){if(_0x4eda80){var _0x238e93=typeof _0x32ac0c[_0x5621('0x33')]===_0x5621('0x34')&&typeof _0x32ac0c[_0x5621('0x35')]===_0x5621('0x34');var _0x359419=_0x4eda80[_0x5621('0x36')];var _0x518e64=_0x238e93?0x0:_0x32ac0c[_0x5621('0x33')];var _0x140e3f=_0x238e93?_0x4eda80[_0x5621('0x36')]:_0x32ac0c[_0x5621('0x33')]+_0x32ac0c['limit'];var _0x5b2aab;if(_0x140e3f>=_0x359419){_0x140e3f=_0x359419;_0x5b2aab=0xc8;}else{_0x5b2aab=0xce;}_0x3c9b5a[_0x5621('0x30')](_0x5b2aab);return _0x3c9b5a[_0x5621('0x37')](_0x5621('0x38'),_0x518e64+'-'+_0x140e3f+'/'+_0x359419)[_0x5621('0x32')](_0x4eda80);}return null;};}function patchUpdates(_0x14666e){return function(_0x203295){try{jsonpatch[_0x5621('0x39')](_0x203295,_0x14666e,!![]);}catch(_0x6e946c){return BPromise['reject'](_0x6e946c);}return _0x203295['save']();};}function saveUpdates(_0x59512c,_0x918df0){return function(_0x12fbe8){if(_0x12fbe8){return _0x12fbe8[_0x5621('0x3a')](_0x59512c)[_0x5621('0x23')](function(_0x626910){return _0x626910;});}return null;};}function removeEntity(_0x213177,_0x2fcbd4){return function(_0x434fbc){if(_0x434fbc){return _0x434fbc[_0x5621('0x3b')]()[_0x5621('0x23')](function(){_0x213177[_0x5621('0x30')](0xcc)[_0x5621('0x31')]();});}};}function handleEntityNotFound(_0x36dc71,_0x5e03b8){return function(_0x51bee8){if(!_0x51bee8){_0x36dc71['sendStatus'](0x194);}return _0x51bee8;};}function handleError(_0x17717d,_0x2b4035){_0x2b4035=_0x2b4035||0x1f4;return function(_0x4552a5){logger[_0x5621('0x2a')](_0x4552a5[_0x5621('0x3c')]);if(_0x4552a5[_0x5621('0x3d')]){delete _0x4552a5[_0x5621('0x3d')];}_0x17717d[_0x5621('0x30')](_0x2b4035)[_0x5621('0x3e')](_0x4552a5);};}exports[_0x5621('0x3f')]=function(_0x3e5135,_0x651fb){var _0x52c5bd={},_0x437e46={},_0x60c9c3={'count':0x0,'rows':[]};var _0xee7f0d=_[_0x5621('0x40')](db['OpenchannelMessage'][_0x5621('0x41')],function(_0x106410){return{'name':_0x106410[_0x5621('0x42')],'type':_0x106410[_0x5621('0x43')][_0x5621('0x44')]};});_0x437e46[_0x5621('0x45')]=_[_0x5621('0x40')](_0xee7f0d,_0x5621('0x3d'));_0x437e46[_0x5621('0x46')]=_[_0x5621('0x47')](_0x3e5135[_0x5621('0x46')]);_0x437e46[_0x5621('0x48')]=_[_0x5621('0x49')](_0x437e46[_0x5621('0x45')],_0x437e46[_0x5621('0x46')]);_0x52c5bd[_0x5621('0x4a')]=_[_0x5621('0x49')](_0x437e46[_0x5621('0x45')],qs[_0x5621('0x4b')](_0x3e5135[_0x5621('0x46')][_0x5621('0x4b')]));_0x52c5bd[_0x5621('0x4a')]=_0x52c5bd[_0x5621('0x4a')][_0x5621('0x4c')]?_0x52c5bd['attributes']:_0x437e46[_0x5621('0x45')];if(!_0x3e5135['query'][_0x5621('0x4d')](_0x5621('0x4e'))){_0x52c5bd[_0x5621('0x35')]=qs[_0x5621('0x35')](_0x3e5135[_0x5621('0x46')][_0x5621('0x35')]);_0x52c5bd[_0x5621('0x33')]=qs[_0x5621('0x33')](_0x3e5135[_0x5621('0x46')][_0x5621('0x33')]);}_0x52c5bd[_0x5621('0x4f')]=qs[_0x5621('0x50')](_0x3e5135['query'][_0x5621('0x50')]);_0x52c5bd['where']=qs[_0x5621('0x48')](_[_0x5621('0x51')](_0x3e5135[_0x5621('0x46')],_0x437e46[_0x5621('0x48')]),_0xee7f0d);if(_0x3e5135[_0x5621('0x46')][_0x5621('0x52')]){_0x52c5bd[_0x5621('0x53')]=_['merge'](_0x52c5bd['where'],{'$or':_['map'](_0xee7f0d,function(_0x12b704){if(_0x12b704[_0x5621('0x43')]!==_0x5621('0x54')){var _0x1effc1={};_0x1effc1[_0x12b704[_0x5621('0x3d')]]={'$like':'%'+_0x3e5135[_0x5621('0x46')][_0x5621('0x52')]+'%'};return _0x1effc1;}})});}_0x52c5bd=_[_0x5621('0x55')]({},_0x52c5bd,_0x3e5135[_0x5621('0x56')]);var _0x3b3280={'where':_0x52c5bd[_0x5621('0x53')]};return db['OpenchannelMessage'][_0x5621('0x36')](_0x3b3280)[_0x5621('0x23')](function(_0x4ef082){_0x60c9c3['count']=_0x4ef082;if(_0x3e5135[_0x5621('0x46')][_0x5621('0x57')]){_0x52c5bd['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0x5621('0x58')](_0x52c5bd);})[_0x5621('0x23')](function(_0x1f5feb){_0x60c9c3[_0x5621('0x59')]=_0x1f5feb;return _0x60c9c3;})[_0x5621('0x23')](respondWithFilteredResult(_0x651fb,_0x52c5bd))[_0x5621('0x2e')](handleError(_0x651fb,null));};exports[_0x5621('0x5a')]=function(_0x49ea48,_0x4357fa){var _0x3a689e={'raw':!![],'where':{'id':_0x49ea48[_0x5621('0x5b')]['id']}},_0x12ef0e={};_0x12ef0e[_0x5621('0x45')]=_[_0x5621('0x47')](db[_0x5621('0x5c')][_0x5621('0x41')]);_0x12ef0e[_0x5621('0x46')]=_[_0x5621('0x47')](_0x49ea48[_0x5621('0x46')]);_0x12ef0e[_0x5621('0x48')]=_[_0x5621('0x49')](_0x12ef0e[_0x5621('0x45')],_0x12ef0e[_0x5621('0x46')]);_0x3a689e[_0x5621('0x4a')]=_['intersection'](_0x12ef0e['model'],qs[_0x5621('0x4b')](_0x49ea48[_0x5621('0x46')][_0x5621('0x4b')]));_0x3a689e[_0x5621('0x4a')]=_0x3a689e[_0x5621('0x4a')][_0x5621('0x4c')]?_0x3a689e[_0x5621('0x4a')]:_0x12ef0e[_0x5621('0x45')];if(_0x49ea48[_0x5621('0x46')][_0x5621('0x57')]){_0x3a689e[_0x5621('0x5d')]=[{'all':!![]}];}_0x3a689e=_[_0x5621('0x55')]({},_0x3a689e,_0x49ea48['options']);return db['OpenchannelMessage']['find'](_0x3a689e)[_0x5621('0x23')](handleEntityNotFound(_0x4357fa,null))[_0x5621('0x23')](respondWithResult(_0x4357fa,null))[_0x5621('0x2e')](handleError(_0x4357fa,null));};exports[_0x5621('0x5e')]=function(_0x209841,_0x98b7ce){return db[_0x5621('0x5c')]['create'](_0x209841[_0x5621('0x5f')],{})[_0x5621('0x23')](respondWithResult(_0x98b7ce,0xc9))[_0x5621('0x2e')](handleError(_0x98b7ce,null));};exports['update']=function(_0x89a83b,_0x43c516){if(_0x89a83b[_0x5621('0x5f')]['id']){delete _0x89a83b[_0x5621('0x5f')]['id'];}return db[_0x5621('0x5c')][_0x5621('0x60')]({'where':{'id':_0x89a83b[_0x5621('0x5b')]['id']}})[_0x5621('0x23')](handleEntityNotFound(_0x43c516,null))['then'](saveUpdates(_0x89a83b[_0x5621('0x5f')],null))[_0x5621('0x23')](respondWithResult(_0x43c516,null))['catch'](handleError(_0x43c516,null));};exports[_0x5621('0x3b')]=function(_0x394e50,_0x98d9c0){return db[_0x5621('0x5c')][_0x5621('0x60')]({'where':{'id':_0x394e50['params']['id']}})[_0x5621('0x23')](handleEntityNotFound(_0x98d9c0,null))[_0x5621('0x23')](removeEntity(_0x98d9c0,null))[_0x5621('0x2e')](handleError(_0x98d9c0,null));};exports['describe']=function(_0x58cce0,_0x165c8d){return db[_0x5621('0x5c')][_0x5621('0x61')]()[_0x5621('0x23')](respondWithResult(_0x165c8d,null))[_0x5621('0x2e')](handleError(_0x165c8d,null));};var interaction_log=require(_0x5621('0x16'))('openchannel-interactions');exports[_0x5621('0x62')]=function(_0x25971e,_0xd0fa82,_0x3d0a3d){var _0x415ee7={'agent':{},'channel':_0x5621('0x63')};if(_0x25971e[_0x5621('0x5f')]['id']){delete _0x25971e[_0x5621('0x5f')]['id'];}_0x25971e['body'][_0x5621('0x64')]=!![];_0x25971e[_0x5621('0x5f')][_0x5621('0x65')]=moment()[_0x5621('0x66')](_0x5621('0x67'));_0x25971e[_0x5621('0x5f')][_0x5621('0x68')]=_0x25971e['body'][_0x5621('0x68')]||_0x25971e[_0x5621('0x69')]['id'];_0x415ee7[_0x5621('0x6a')]['id']=_0x25971e[_0x5621('0x5f')][_0x5621('0x68')];return db[_0x5621('0x5c')][_0x5621('0x60')]({'where':{'id':_0x25971e[_0x5621('0x5b')]['id'],'UserId':null}})[_0x5621('0x23')](handleEntityNotFound(_0xd0fa82,null))[_0x5621('0x23')](saveUpdates(_0x25971e[_0x5621('0x5f')],null))['then'](function(_0x4c62ec){if(_0x4c62ec){_0x415ee7['message']=_0x4c62ec['get']({'plain':!![]});return db[_0x5621('0x6b')][_0x5621('0x60')]({'where':{'id':_0x4c62ec['OpenchannelInteractionId']}});}return null;})[_0x5621('0x23')](handleEntityNotFound(_0xd0fa82,null))['then'](function(_0x28ae09){if(_0x28ae09){return _0x28ae09['update']({'UserId':_0x25971e[_0x5621('0x5f')][_0x5621('0x68')],'read1stAt':_[_0x5621('0x6c')](_0x28ae09[_0x5621('0x6d')])?moment()[_0x5621('0x66')](_0x5621('0x67')):undefined});}return null;})[_0x5621('0x23')](function(_0x2973cc){if(_0x2973cc){_0x415ee7[_0x5621('0x6e')]=_0x2973cc[_0x5621('0x6f')]({'plain':!![]});interaction_log[_0x5621('0x24')](_0x5621('0x70'),_0x25971e['user']['id'],_0x25971e[_0x5621('0x69')]['name'],_0x25971e[_0x5621('0x69')][_0x5621('0x71')],_0x415ee7[_0x5621('0x6e')]['id'],_0x25971e[_0x5621('0x5f')]?JSON['stringify'](_0x25971e[_0x5621('0x5f')]):_0x5621('0x72'));return respondWithRpcPromise(_0x5621('0x73'),'acceptMessage',_0x415ee7);}return null;})[_0x5621('0x23')](function(_0x45a73e){var _0x182e87=_0x5621('0x74')+_0x45a73e[_0x5621('0x2c')][_0x5621('0x75')];return db[_0x5621('0x76')][_0x5621('0x46')](_0x182e87,{'type':db[_0x5621('0x77')][_0x5621('0x78')]['SELECT'],'raw':!![]})['then'](function(_0x19682a){return _0x19682a;});})[_0x5621('0x23')](function(_0x694cc4){if(_0x694cc4){_0x415ee7[_0x5621('0x2c')]['contact']=_0x694cc4[0x0];if(!_0x25971e[_0x5621('0x5f')][_0x5621('0x68')])return;return db[_0x5621('0x79')][_0x5621('0x60')]({'where':{'id':_0x25971e[_0x5621('0x5f')]['UserId'],'role':_0x5621('0x6a')},'attributes':['id','name','fullname','email','internal'],'raw':!![]});}return null;})['then'](function(_0x24bb3d){if(!_0x24bb3d)return null;_0x415ee7[_0x5621('0x2c')]['agent']=_0x24bb3d;return _0x415ee7;})[_0x5621('0x23')](function(_0x529c71){if(_0x529c71){if(_0x25971e[_0x5621('0x5f')][_0x5621('0x7a')]){_0x415ee7['message'][_0x5621('0x7b')]=util[_0x5621('0x66')]('SIP/%s',_0x25971e[_0x5621('0x69')][_0x5621('0x3d')]);_0x415ee7['message'][_0x5621('0x7c')]=_0x415ee7[_0x5621('0x7c')];_0x415ee7[_0x5621('0x2c')][_0x5621('0x7d')]=_0x415ee7[_0x5621('0x7c')];_0x415ee7['message']['event']='accept';return respondWithRpcPromise(_0x5621('0x7e'),_0x5621('0x7e'),{'event':_0x5621('0x7f'),'message':_0x415ee7[_0x5621('0x2c')]},client9002)[_0x5621('0x23')](function(){return _0x415ee7;});}return _0x415ee7;}return null;})[_0x5621('0x23')](respondWithResult(_0xd0fa82,null))['catch'](handleError(_0xd0fa82,null));};var interaction_log=require('../../config/logger')(_0x5621('0x80'));exports['reject']=function(_0x5cbbbc,_0x868839,_0x217a06){var _0x46624d={'agent':{},'channel':_0x5621('0x63')};if(_0x5cbbbc[_0x5621('0x5f')]['id']){delete _0x5cbbbc[_0x5621('0x5f')]['id'];}_0x5cbbbc[_0x5621('0x5f')]['UserId']=_0x5cbbbc[_0x5621('0x5f')][_0x5621('0x68')]||_0x5cbbbc[_0x5621('0x69')]['id'];_0x46624d['agent']['id']=_0x5cbbbc['body']['UserId'];return db[_0x5621('0x5c')][_0x5621('0x60')]({'where':{'id':_0x5cbbbc['params']['id'],'UserId':null}})[_0x5621('0x23')](handleEntityNotFound(_0x868839,null))[_0x5621('0x23')](function(_0x5b5ec1){if(_0x5b5ec1){_0x46624d[_0x5621('0x2c')]=_0x5b5ec1['get']({'plain':!![]});return db[_0x5621('0x6b')][_0x5621('0x60')]({'where':{'id':_0x5b5ec1[_0x5621('0x81')]}});}return null;})[_0x5621('0x23')](handleEntityNotFound(_0x868839,null))['then'](function(_0x2c60af){if(_0x2c60af){_0x46624d[_0x5621('0x6e')]=_0x2c60af[_0x5621('0x6f')]({'plain':!![]});interaction_log[_0x5621('0x24')](_0x5621('0x82'),_0x5cbbbc[_0x5621('0x69')]['id'],_0x5cbbbc[_0x5621('0x69')][_0x5621('0x3d')],_0x5cbbbc[_0x5621('0x69')][_0x5621('0x71')],_0x46624d[_0x5621('0x6e')]['id'],_0x5cbbbc[_0x5621('0x5f')]?JSON[_0x5621('0x29')](_0x5cbbbc[_0x5621('0x5f')]):_0x5621('0x72'));return respondWithRpcPromise(_0x5621('0x83'),_0x5621('0x84'),_0x46624d);}return null;})[_0x5621('0x23')](function(_0x584346){var _0x3d758f=_0x5621('0x74')+_0x584346[_0x5621('0x2c')][_0x5621('0x75')];return db['sequelize']['query'](_0x3d758f,{'type':db[_0x5621('0x77')]['QueryTypes'][_0x5621('0x85')],'raw':!![]})[_0x5621('0x23')](function(_0x1a5041){return _0x1a5041;});})[_0x5621('0x23')](function(_0x2cd36c){if(_0x2cd36c){_0x46624d[_0x5621('0x2c')]['contact']=_0x2cd36c[0x0];if(!_0x5cbbbc['body'][_0x5621('0x68')])return;return db[_0x5621('0x79')][_0x5621('0x60')]({'where':{'id':_0x5cbbbc['body'][_0x5621('0x68')],'role':_0x5621('0x6a')},'attributes':['id',_0x5621('0x3d'),_0x5621('0x86'),_0x5621('0x87'),_0x5621('0x88')],'raw':!![]});}return null;})[_0x5621('0x23')](function(_0x2af999){if(!_0x2af999)return null;_0x46624d['message']['agent']=_0x2af999;return _0x46624d;})[_0x5621('0x23')](function(_0x290d3d){if(_0x290d3d){_0x290d3d['message'][_0x5621('0x7b')]=util['format'](_0x5621('0x89'),_0x5cbbbc[_0x5621('0x69')][_0x5621('0x3d')]);_0x290d3d[_0x5621('0x2c')][_0x5621('0x7c')]=_0x46624d[_0x5621('0x7c')];_0x290d3d[_0x5621('0x2c')][_0x5621('0x7d')]=_0x46624d['channel'];_0x290d3d[_0x5621('0x2c')][_0x5621('0x8a')]='reject';respondWithRpcPromise(_0x5621('0x7e'),_0x5621('0x7e'),{'event':_0x5621('0x8b'),'message':_0x290d3d['message']},client9002);return _0x46624d;}return null;})[_0x5621('0x23')](respondWithResult(_0x868839,null))[_0x5621('0x2e')](handleError(_0x868839,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index c5db912..b572570 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 _0x481c=['save','update','remove','emit','hook','../../mysqldb','setMaxListeners'];(function(_0x1c290f,_0x94ef44){var _0x3980fe=function(_0x203af9){while(--_0x203af9){_0x1c290f['push'](_0x1c290f['shift']());}};_0x3980fe(++_0x94ef44);}(_0x481c,0x83));var _0xc481=function(_0x5d1b9c,_0x41eae3){_0x5d1b9c=_0x5d1b9c-0x0;var _0x7efe06=_0x481c[_0x5d1b9c];return _0x7efe06;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xc481('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xc481('0x1')](0x0);var events={'afterCreate':_0xc481('0x2'),'afterUpdate':_0xc481('0x3'),'afterDestroy':_0xc481('0x4')};function emitEvent(_0x2715b4){return function(_0x367da2,_0x4b1b4f,_0x1f9e6a){OpenchannelMessageEvents[_0xc481('0x5')](_0x2715b4+':'+_0x367da2['id'],_0x367da2);OpenchannelMessageEvents[_0xc481('0x5')](_0x2715b4,_0x367da2);_0x1f9e6a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xc481('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0xe2f0=['remove','emit','exports','events','OpenchannelMessage','setMaxListeners','update'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0xe2f0,0x96));var _0x0e2f=function(_0x149f32,_0x4273f7){_0x149f32=_0x149f32-0x0;var _0x11f475=_0xe2f0[_0x149f32];return _0x11f475;};'use strict';var EventEmitter=require(_0x0e2f('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x0e2f('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x0e2f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0e2f('0x3'),'afterDestroy':_0x0e2f('0x4')};function emitEvent(_0x2044c8){return function(_0x131ced,_0x634cfd,_0x40740f){OpenchannelMessageEvents[_0x0e2f('0x5')](_0x2044c8+':'+_0x131ced['id'],_0x131ced);OpenchannelMessageEvents['emit'](_0x2044c8,_0x131ced);_0x40740f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x0e2f('0x6')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 554af5a..d6cc0f3 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 _0xea28=['moment','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','update','createdAt','catch','error','CmContact','describe','then','OpenchannelAccount','find','OpenchannelAccountId','Interactions','get','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','omit','Contact','POST','GET','afterCreate','threadId','finally','utf8mb4','lodash','util','../../config/logger','api'];(function(_0x43fe80,_0x3bad2c){var _0x18d848=function(_0x57fb53){while(--_0x57fb53){_0x43fe80['push'](_0x43fe80['shift']());}};_0x18d848(++_0x3bad2c);}(_0xea28,0x13a));var _0x8ea2=function(_0x4d6617,_0x831056){_0x4d6617=_0x4d6617-0x0;var _0x218511=_0xea28[_0x4d6617];return _0x218511;};'use strict';var _=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var logger=require(_0x8ea2('0x2'))(_0x8ea2('0x3'));var moment=require(_0x8ea2('0x4'));var BPromise=require(_0x8ea2('0x5'));var rp=require(_0x8ea2('0x6'));var fs=require('fs');var path=require(_0x8ea2('0x7'));var rimraf=require('rimraf');var config=require(_0x8ea2('0x8'));var attributes=require(_0x8ea2('0x9'));module[_0x8ea2('0xa')]=function(_0x513a0d,_0x29b82b){return _0x513a0d[_0x8ea2('0xb')](_0x8ea2('0xc'),attributes,{'tableName':_0x8ea2('0xd'),'paranoid':![],'indexes':[{'name':_0x8ea2('0xe'),'fields':[_0x8ea2('0xf')],'type':_0x8ea2('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x320750,_0x3de4a1,_0x3000f9){var _0x3d0b35=_0x513a0d[_0x8ea2('0x11')];var _0x500b82=_0x320750['get']({'plain':!![]});if(_0x500b82[_0x8ea2('0x12')][_0x8ea2('0x13')]()==='in'||_0x500b82[_0x8ea2('0x12')]['toLowerCase']()===_0x8ea2('0x14')&&!_0x500b82[_0x8ea2('0x15')]&&!_[_0x8ea2('0x16')](_0x500b82[_0x8ea2('0x17')])){_0x3d0b35[_0x8ea2('0x18')]['findOne']({'where':{'id':_0x500b82[_0x8ea2('0x19')]}})['then'](function(_0x4b2192){if(_0x4b2192){_0x4b2192[_0x8ea2('0x1a')]({'lastMsgAt':_0x500b82[_0x8ea2('0x1b')],'lastMsgDirection':_0x500b82[_0x8ea2('0x12')][_0x8ea2('0x13')]()});}})[_0x8ea2('0x1c')](function(_0xbb9bd1){console[_0x8ea2('0x1d')](_0xbb9bd1);});}if(_0x500b82[_0x8ea2('0x12')]===_0x8ea2('0x14')&&!_0x500b82[_0x8ea2('0x15')]){var _0x2dfa7c;_0x3d0b35[_0x8ea2('0x1e')][_0x8ea2('0x1f')]()[_0x8ea2('0x20')](function(_0x1b64cf){return _0x3d0b35[_0x8ea2('0x21')][_0x8ea2('0x22')]({'where':{'id':_0x500b82[_0x8ea2('0x23')]},'include':[{'model':_0x3d0b35[_0x8ea2('0x18')],'as':_0x8ea2('0x24'),'where':{'id':_0x500b82[_0x8ea2('0x19')]},'limit':0x1,'include':[{'model':_0x3d0b35[_0x8ea2('0x1e')],'as':'Contact','attributes':_['keys'](_0x1b64cf)}]}]});})[_0x8ea2('0x20')](function(_0x248c18){_0x2dfa7c=_0x248c18[_0x8ea2('0x25')]({'plain':!![]});if(_0x2dfa7c&&_0x2dfa7c['replyUri']){logger[_0x8ea2('0x26')](_0x8ea2('0x27'),'afterCreate',util[_0x8ea2('0x28')](_0x8ea2('0x29'),_0x500b82['id'],_0x2dfa7c[_0x8ea2('0x2a')]));if(_0x2dfa7c[_0x8ea2('0x24')]&&_0x2dfa7c[_0x8ea2('0x24')][_0x8ea2('0x2b')]){_0x500b82[_0x8ea2('0x2c')]=_[_0x8ea2('0x2d')](_0x2dfa7c[_0x8ea2('0x24')][0x0],'Contact');_0x500b82[_0x8ea2('0x2e')]=_0x2dfa7c['Interactions'][0x0][_0x8ea2('0x2e')];}var _0x3de4a1={'method':_0x8ea2('0x2f'),'uri':encodeURI(_0x2dfa7c['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3de4a1['method']){case _0x8ea2('0x30'):_0x3de4a1['qs']=_0x500b82;break;case'POST':_0x3de4a1[_0x8ea2('0xf')]=_0x500b82;break;}return rp(_0x3de4a1)['then'](function(_0x3be291){logger[_0x8ea2('0x26')](_0x8ea2('0x27'),_0x8ea2('0x31'),util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x500b82['id'],_0x2dfa7c[_0x8ea2('0x2a')]));if(_0x3be291['body'][_0x8ea2('0x32')]&&_0x3be291[_0x8ea2('0xf')][_0x8ea2('0x32')]!=_0x500b82[_0x8ea2('0x2c')][_0x8ea2('0x32')]){return _0x3d0b35[_0x8ea2('0x18')][_0x8ea2('0x1a')]({'threadId':_0x3be291[_0x8ea2('0xf')][_0x8ea2('0x32')]},{'logging':!![],'where':{'id':_0x500b82[_0x8ea2('0x2c')]['id']}});}else{return;}})['then'](function(){return _0x320750['update']({'read':!![]});})[_0x8ea2('0x1c')](function(_0x188553){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x8ea2('0x31'),util['inspect'](_0x188553,{'showHidden':![],'depth':null}));_0x3000f9();});}else{_0x3000f9();}})[_0x8ea2('0x33')](function(){_0x3000f9();});}else{_0x3000f9();}}},'charset':_0x8ea2('0x34'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa571=['afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','omit','Contact','POST','method','GET','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','exports','define','OpenchannelMessage','openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','findOne','OpenchannelInteractionId','createdAt','catch','error','CmContact','then','OpenchannelAccount','OpenchannelAccountId','OpenchannelInteraction','Interactions'];(function(_0x1a7a47,_0x81ca90){var _0x193dd9=function(_0x4f9d66){while(--_0x4f9d66){_0x1a7a47['push'](_0x1a7a47['shift']());}};_0x193dd9(++_0x81ca90);}(_0xa571,0x107));var _0x1a57=function(_0x3c5a56,_0x53341e){_0x3c5a56=_0x3c5a56-0x0;var _0x2ea67e=_0xa571[_0x3c5a56];return _0x2ea67e;};'use strict';var _=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var logger=require(_0x1a57('0x2'))(_0x1a57('0x3'));var moment=require('moment');var BPromise=require(_0x1a57('0x4'));var rp=require(_0x1a57('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1a57('0x6'));var attributes=require('./openchannelMessage.attributes');module[_0x1a57('0x7')]=function(_0xd97a33,_0x22ca20){return _0xd97a33[_0x1a57('0x8')](_0x1a57('0x9'),attributes,{'tableName':_0x1a57('0xa'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x1a57('0xb')],'type':_0x1a57('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3631d6,_0x58e266,_0x3c8182){var _0x1f7086=_0xd97a33[_0x1a57('0xd')];var _0x289dc0=_0x3631d6[_0x1a57('0xe')]({'plain':!![]});if(_0x289dc0[_0x1a57('0xf')][_0x1a57('0x10')]()==='in'||_0x289dc0[_0x1a57('0xf')]['toLowerCase']()==='out'&&!_0x289dc0[_0x1a57('0x11')]&&!_[_0x1a57('0x12')](_0x289dc0[_0x1a57('0x13')])){_0x1f7086['OpenchannelInteraction'][_0x1a57('0x14')]({'where':{'id':_0x289dc0[_0x1a57('0x15')]}})['then'](function(_0x503278){if(_0x503278){_0x503278['update']({'lastMsgAt':_0x289dc0[_0x1a57('0x16')],'lastMsgDirection':_0x289dc0[_0x1a57('0xf')][_0x1a57('0x10')]()});}})[_0x1a57('0x17')](function(_0x5802d6){console[_0x1a57('0x18')](_0x5802d6);});}if(_0x289dc0['direction']==='out'&&!_0x289dc0[_0x1a57('0x11')]){var _0x1c537f;_0x1f7086[_0x1a57('0x19')]['describe']()[_0x1a57('0x1a')](function(_0x1662a3){return _0x1f7086[_0x1a57('0x1b')]['find']({'where':{'id':_0x289dc0[_0x1a57('0x1c')]},'include':[{'model':_0x1f7086[_0x1a57('0x1d')],'as':_0x1a57('0x1e'),'where':{'id':_0x289dc0[_0x1a57('0x15')]},'limit':0x1,'include':[{'model':_0x1f7086[_0x1a57('0x19')],'as':'Contact','attributes':_['keys'](_0x1662a3)}]}]});})[_0x1a57('0x1a')](function(_0x21e811){_0x1c537f=_0x21e811[_0x1a57('0xe')]({'plain':!![]});if(_0x1c537f&&_0x1c537f['replyUri']){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x1a57('0x1f'),util[_0x1a57('0x20')](_0x1a57('0x21'),_0x289dc0['id'],_0x1c537f[_0x1a57('0x22')]));if(_0x1c537f[_0x1a57('0x1e')]&&_0x1c537f[_0x1a57('0x1e')][_0x1a57('0x23')]){_0x289dc0[_0x1a57('0x24')]=_[_0x1a57('0x25')](_0x1c537f[_0x1a57('0x1e')][0x0],_0x1a57('0x26'));_0x289dc0[_0x1a57('0x26')]=_0x1c537f[_0x1a57('0x1e')][0x0][_0x1a57('0x26')];}var _0x58e266={'method':_0x1a57('0x27'),'uri':encodeURI(_0x1c537f[_0x1a57('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x58e266[_0x1a57('0x28')]){case _0x1a57('0x29'):_0x58e266['qs']=_0x289dc0;break;case _0x1a57('0x27'):_0x58e266[_0x1a57('0xb')]=_0x289dc0;break;}return rp(_0x58e266)[_0x1a57('0x1a')](function(_0x5a53c8){logger['info'](_0x1a57('0x2a'),_0x1a57('0x1f'),util['format'](_0x1a57('0x2b'),_0x289dc0['id'],_0x1c537f['replyUri']));if(_0x5a53c8[_0x1a57('0xb')][_0x1a57('0x2c')]&&_0x5a53c8['body'][_0x1a57('0x2c')]!=_0x289dc0[_0x1a57('0x24')][_0x1a57('0x2c')]){return _0x1f7086[_0x1a57('0x1d')]['update']({'threadId':_0x5a53c8[_0x1a57('0xb')][_0x1a57('0x2c')]},{'logging':!![],'where':{'id':_0x289dc0[_0x1a57('0x24')]['id']}});}else{return;}})[_0x1a57('0x1a')](function(){return _0x3631d6['update']({'read':!![]});})[_0x1a57('0x17')](function(_0x251a54){logger[_0x1a57('0x18')](_0x1a57('0x2a'),_0x1a57('0x1f'),util[_0x1a57('0x2d')](_0x251a54,{'showHidden':![],'depth':null}));_0x3c8182();});}else{_0x3c8182();}})[_0x1a57('0x2e')](function(){_0x3c8182();});}else{_0x3c8182();}}},'charset':_0x1a57('0x2f'),'collate':_0x1a57('0x30')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 3074405..c3a4a32 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x45e684,_0x33a27d){var _0x31a0f2=function(_0x4c7541){while(--_0x4c7541){_0x45e684['push'](_0x45e684['shift']());}};_0x31a0f2(++_0x33a27d);}(_0x2ef3,0xba));var _0x32ef=function(_0x925915,_0x451ec3){_0x925915=_0x925915-0x0;var _0x1bd01e=_0x2ef3[_0x925915];return _0x1bd01e;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});}; \ No newline at end of file +var _0x5f66=['stringify','error','code','message','info','result','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x1ba328,_0x30bd4b){var _0x4bbb11=function(_0x23abd5){while(--_0x23abd5){_0x1ba328['push'](_0x1ba328['shift']());}};_0x4bbb11(++_0x30bd4b);}(_0x5f66,0x1a0));var _0x65f6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5f66[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateOpenchannelMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 5d2a35f..1d0f577 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 _0x6dfb=['length','openchannelMessage:','./openchannelMessage.events','save','remove','emit','removeListener','register'];(function(_0x1491aa,_0x46daa2){var _0x33ebb5=function(_0x415c4e){while(--_0x415c4e){_0x1491aa['push'](_0x1491aa['shift']());}};_0x33ebb5(++_0x46daa2);}(_0x6dfb,0x14a));var _0xb6df=function(_0x4a64f1,_0x36a9d7){_0x4a64f1=_0x4a64f1-0x0;var _0x24b874=_0x6dfb[_0x4a64f1];return _0x24b874;};'use strict';var OpenchannelMessageEvents=require(_0xb6df('0x0'));var events=[_0xb6df('0x1'),_0xb6df('0x2'),'update'];function createListener(_0x3df384,_0x1cb39d){return function(_0x415319){_0x1cb39d[_0xb6df('0x3')](_0x3df384,_0x415319);};}function removeListener(_0x33b712,_0x59d0a2){return function(){OpenchannelMessageEvents[_0xb6df('0x4')](_0x33b712,_0x59d0a2);};}exports[_0xb6df('0x5')]=function(_0x1ecf28){for(var _0x33038c=0x0,_0x2df04e=events[_0xb6df('0x6')];_0x33038c<_0x2df04e;_0x33038c++){var _0x453d41=events[_0x33038c];var _0x3b66dc=createListener(_0xb6df('0x7')+_0x453d41,_0x1ecf28);OpenchannelMessageEvents['on'](_0x453d41,_0x3b66dc);}}; \ No newline at end of file +var _0x54ba=['save','remove','update','emit','removeListener','register','length','openchannelMessage:','./openchannelMessage.events'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x54ba,0x170));var _0xa54b=function(_0x3d626c,_0x30deb1){_0x3d626c=_0x3d626c-0x0;var _0x18c9da=_0x54ba[_0x3d626c];return _0x18c9da;};'use strict';var OpenchannelMessageEvents=require(_0xa54b('0x0'));var events=[_0xa54b('0x1'),_0xa54b('0x2'),_0xa54b('0x3')];function createListener(_0x19e323,_0xea7291){return function(_0x53e1f3){_0xea7291[_0xa54b('0x4')](_0x19e323,_0x53e1f3);};}function removeListener(_0x4af786,_0x3e1157){return function(){OpenchannelMessageEvents[_0xa54b('0x5')](_0x4af786,_0x3e1157);};}exports[_0xa54b('0x6')]=function(_0x3ca5d5){for(var _0x574edb=0x0,_0x4e3dc1=events[_0xa54b('0x7')];_0x574edb<_0x4e3dc1;_0x574edb++){var _0xbd9471=events[_0x574edb];var _0x471566=createListener(_0xa54b('0x8')+_0xbd9471,_0x3ca5d5);OpenchannelMessageEvents['on'](_0xbd9471,_0x471566);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 11cafb1..4256b26 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 _0xcc04=['isAuthenticated','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','addAgents','put','/:id','delete','destroy','removeTeams','removeAgents','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x1866c3,_0x4693b1){var _0x4f4758=function(_0x56ec15){while(--_0x56ec15){_0x1866c3['push'](_0x1866c3['shift']());}};_0x4f4758(++_0x4693b1);}(_0xcc04,0xfb));var _0x4cc0=function(_0xebf5,_0x3754f3){_0xebf5=_0xebf5-0x0;var _0x4c52bf=_0xcc04[_0xebf5];return _0x4c52bf;};'use strict';var multer=require(_0x4cc0('0x0'));var util=require(_0x4cc0('0x1'));var path=require(_0x4cc0('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4cc0('0x3')]();var fs_extra=require(_0x4cc0('0x4'));var auth=require(_0x4cc0('0x5'));var interaction=require(_0x4cc0('0x6'));var config=require(_0x4cc0('0x7'));var controller=require('./openchannelQueue.controller');router[_0x4cc0('0x8')]('/',auth[_0x4cc0('0x9')](),controller['index']);router[_0x4cc0('0x8')]('/describe',auth[_0x4cc0('0x9')](),controller[_0x4cc0('0xa')]);router[_0x4cc0('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x4cc0('0xb')]);router[_0x4cc0('0x8')](_0x4cc0('0xc'),auth[_0x4cc0('0x9')](),controller[_0x4cc0('0xd')]);router['get'](_0x4cc0('0xe'),auth[_0x4cc0('0x9')](),controller[_0x4cc0('0xf')]);router['get'](_0x4cc0('0x10'),auth[_0x4cc0('0x9')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x4cc0('0x11')](_0x4cc0('0xe'),auth[_0x4cc0('0x9')](),controller[_0x4cc0('0x12')]);router[_0x4cc0('0x11')](_0x4cc0('0x10'),auth[_0x4cc0('0x9')](),controller[_0x4cc0('0x13')]);router[_0x4cc0('0x14')](_0x4cc0('0x15'),auth[_0x4cc0('0x9')](),controller['update']);router[_0x4cc0('0x16')](_0x4cc0('0x15'),auth['isAuthenticated'](),controller[_0x4cc0('0x17')]);router[_0x4cc0('0x16')](_0x4cc0('0xe'),auth[_0x4cc0('0x9')](),controller[_0x4cc0('0x18')]);router[_0x4cc0('0x16')]('/:id/users',auth[_0x4cc0('0x9')](),controller[_0x4cc0('0x19')]);module['exports']=router; \ No newline at end of file +var _0x1cd3=['post','create','addTeams','addAgents','update','/:id','delete','removeTeams','/:id/users','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','/describe','isAuthenticated','getMembers','/:id/teams'];(function(_0x7bdc44,_0x3805d7){var _0x1a4f95=function(_0x2aadb6){while(--_0x2aadb6){_0x7bdc44['push'](_0x7bdc44['shift']());}};_0x1a4f95(++_0x3805d7);}(_0x1cd3,0x143));var _0x31cd=function(_0x10d750,_0x4042cc){_0x10d750=_0x10d750-0x0;var _0x4aacc6=_0x1cd3[_0x10d750];return _0x4aacc6;};'use strict';var multer=require('multer');var util=require(_0x31cd('0x0'));var path=require(_0x31cd('0x1'));var timeout=require(_0x31cd('0x2'));var express=require(_0x31cd('0x3'));var router=express[_0x31cd('0x4')]();var fs_extra=require(_0x31cd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x31cd('0x6'));var config=require(_0x31cd('0x7'));var controller=require(_0x31cd('0x8'));router[_0x31cd('0x9')]('/',auth['isAuthenticated'](),controller[_0x31cd('0xa')]);router['get'](_0x31cd('0xb'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x31cd('0xc')](),controller['show']);router[_0x31cd('0x9')]('/:id/members',auth[_0x31cd('0xc')](),controller[_0x31cd('0xd')]);router[_0x31cd('0x9')](_0x31cd('0xe'),auth[_0x31cd('0xc')](),controller['getTeams']);router[_0x31cd('0x9')]('/:id/users',auth[_0x31cd('0xc')](),controller['getAgents']);router[_0x31cd('0xf')]('/',auth[_0x31cd('0xc')](),controller[_0x31cd('0x10')]);router['post'](_0x31cd('0xe'),auth[_0x31cd('0xc')](),controller[_0x31cd('0x11')]);router[_0x31cd('0xf')]('/:id/users',auth[_0x31cd('0xc')](),controller[_0x31cd('0x12')]);router['put']('/:id',auth[_0x31cd('0xc')](),controller[_0x31cd('0x13')]);router['delete'](_0x31cd('0x14'),auth[_0x31cd('0xc')](),controller['destroy']);router[_0x31cd('0x15')](_0x31cd('0xe'),auth[_0x31cd('0xc')](),controller[_0x31cd('0x16')]);router['delete'](_0x31cd('0x17'),auth[_0x31cd('0xc')](),controller[_0x31cd('0x18')]);module[_0x31cd('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 69abfa5..5a16132 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 _0x7996=['STRING','INTEGER','ENUM','beepall','roundrobin','sequelize','exports'];(function(_0x368b19,_0xcf4ad7){var _0x8ec657=function(_0x250768){while(--_0x250768){_0x368b19['push'](_0x368b19['shift']());}};_0x8ec657(++_0xcf4ad7);}(_0x7996,0x1c5));var _0x6799=function(_0x219935,_0x5b7d02){_0x219935=_0x219935-0x0;var _0x130409=_0x7996[_0x219935];return _0x130409;};'use strict';var Sequelize=require(_0x6799('0x0'));module[_0x6799('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6799('0x2')]},'timeout':{'type':Sequelize[_0x6799('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6799('0x4')]('rrmemory',_0x6799('0x5'),_0x6799('0x6'))}}; \ No newline at end of file +var _0x0b8b=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','INTEGER'];(function(_0x2625be,_0x5a9690){var _0x2d4dd1=function(_0x2fefbf){while(--_0x2fefbf){_0x2625be['push'](_0x2625be['shift']());}};_0x2d4dd1(++_0x5a9690);}(_0x0b8b,0x1cc));var _0xb0b8=function(_0x2d5818,_0xc9aa8b){_0x2d5818=_0x2d5818-0x0;var _0x1d1e9d=_0x0b8b[_0x2d5818];return _0x1d1e9d;};'use strict';var Sequelize=require(_0xb0b8('0x0'));module[_0xb0b8('0x1')]={'name':{'type':Sequelize[_0xb0b8('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb0b8('0x2')]},'timeout':{'type':Sequelize[_0xb0b8('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb0b8('0x4')](_0xb0b8('0x5'),_0xb0b8('0x6'),_0xb0b8('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 837b2ef..aa66a30 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 _0x753f=['where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','describe','getMembers','findOne','UserOpenchannelQueue','order','pick','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','createdAt','%s/%s','updatedAt','getTeams','addTeams','ids','Team','online','voicePause','interface','flatMap','Agents','sequelize','transaction','forEach','emit','select','field','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','QueryTypes','every','all','union','value','removeTeams','isEmpty','removeAgents','addAgents','omit','spread','userOpenchannelQueue:save','isArray','userOpenchannelQueue:remove','getAgents','eml-format','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','OpenchannelQueues','UserProfileResource','end','stack','name','send','index','OpenchannelQueue','rawAttributes','type','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','filter'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x753f,0x15b));var _0xf753=function(_0xfe4d6f,_0x1488ce){_0xfe4d6f=_0xfe4d6f-0x0;var _0x5748e5=_0x753f[_0xfe4d6f];return _0x5748e5;};'use strict';var emlformat=require(_0xf753('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf753('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf753('0x2'));var moment=require(_0xf753('0x3'));var BPromise=require(_0xf753('0x4'));var Mustache=require('mustache');var util=require(_0xf753('0x5'));var path=require(_0xf753('0x6'));var sox=require('sox');var csv=require(_0xf753('0x7'));var ejs=require(_0xf753('0x8'));var fs=require('fs');var fs_extra=require(_0xf753('0x9'));var _=require(_0xf753('0xa'));var squel=require(_0xf753('0xb'));var crypto=require(_0xf753('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf753('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf753('0xe'));var Papa=require('papaparse');var Redis=require(_0xf753('0xf'));var authService=require(_0xf753('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf753('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf753('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xf753('0x13'));var licenseUtil=require(_0xf753('0x14'));var db=require(_0xf753('0x15'))['db'];config['redis']=_[_0xf753('0x16')](config[_0xf753('0x17')],{'host':_0xf753('0x18'),'port':0x18eb});var socket=require(_0xf753('0x19'))(new Redis(config[_0xf753('0x17')]));require('./openchannelQueue.socket')['register'](socket);function respondWithStatusCode(_0x3f3d0b,_0x5d5211){_0x5d5211=_0x5d5211||0xcc;return function(_0x4b3c63){if(_0x4b3c63){return _0x3f3d0b[_0xf753('0x1a')](_0x5d5211);}return _0x3f3d0b[_0xf753('0x1b')](_0x5d5211)['end']();};}function respondWithResult(_0x432336,_0x22a67f){_0x22a67f=_0x22a67f||0xc8;return function(_0x216527){if(_0x216527){return _0x432336[_0xf753('0x1b')](_0x22a67f)[_0xf753('0x1c')](_0x216527);}};}function respondWithFilteredResult(_0x10c580,_0x55568e){return function(_0x342f84){if(_0x342f84){var _0x387b18=typeof _0x55568e[_0xf753('0x1d')]===_0xf753('0x1e')&&typeof _0x55568e[_0xf753('0x1f')]==='undefined';var _0x5976ef=_0x342f84[_0xf753('0x20')];var _0x1a7342=_0x387b18?0x0:_0x55568e[_0xf753('0x1d')];var _0x2affc6=_0x387b18?_0x342f84['count']:_0x55568e[_0xf753('0x1d')]+_0x55568e[_0xf753('0x1f')];var _0x4c1682;if(_0x2affc6>=_0x5976ef){_0x2affc6=_0x5976ef;_0x4c1682=0xc8;}else{_0x4c1682=0xce;}_0x10c580[_0xf753('0x1b')](_0x4c1682);return _0x10c580[_0xf753('0x21')](_0xf753('0x22'),_0x1a7342+'-'+_0x2affc6+'/'+_0x5976ef)['json'](_0x342f84);}return null;};}function patchUpdates(_0x30e8d5){return function(_0x3502c7){try{jsonpatch[_0xf753('0x23')](_0x3502c7,_0x30e8d5,!![]);}catch(_0x444179){return BPromise[_0xf753('0x24')](_0x444179);}return _0x3502c7[_0xf753('0x25')]();};}function saveUpdates(_0x87e81a,_0x50e6c2){return function(_0x54016a){if(_0x54016a){return _0x54016a[_0xf753('0x26')](_0x87e81a)[_0xf753('0x27')](function(_0x251145){return _0x251145;});}return null;};}function removeEntity(_0x115b05,_0x532050){return function(_0x56f578){if(_0x56f578){return _0x56f578['destroy']()[_0xf753('0x27')](function(){var _0x3cfdb4=_0x56f578[_0xf753('0x28')]({'plain':!![]});var _0x1d5748=_0xf753('0x29');return db[_0xf753('0x2a')]['destroy']({'where':{'type':_0x1d5748,'resourceId':_0x3cfdb4['id']}})['then'](function(){return _0x56f578;});})[_0xf753('0x27')](function(){_0x115b05[_0xf753('0x1b')](0xcc)[_0xf753('0x2b')]();});}};}function handleEntityNotFound(_0x463912,_0x4cc0a2){return function(_0x5b6020){if(!_0x5b6020){_0x463912[_0xf753('0x1a')](0x194);}return _0x5b6020;};}function handleError(_0x2020ba,_0x5958c9){_0x5958c9=_0x5958c9||0x1f4;return function(_0x558913){logger['error'](_0x558913[_0xf753('0x2c')]);if(_0x558913[_0xf753('0x2d')]){delete _0x558913[_0xf753('0x2d')];}_0x2020ba[_0xf753('0x1b')](_0x5958c9)[_0xf753('0x2e')](_0x558913);};}exports[_0xf753('0x2f')]=function(_0x730eab,_0x253759){var _0x280a8b={},_0x516434={},_0x3928d3={'count':0x0,'rows':[]};var _0x43bae9=_['map'](db[_0xf753('0x30')][_0xf753('0x31')],function(_0x276ee0){return{'name':_0x276ee0['fieldName'],'type':_0x276ee0[_0xf753('0x32')]['key']};});_0x516434[_0xf753('0x33')]=_[_0xf753('0x34')](_0x43bae9,_0xf753('0x2d'));_0x516434['query']=_[_0xf753('0x35')](_0x730eab[_0xf753('0x36')]);_0x516434['filters']=_[_0xf753('0x37')](_0x516434[_0xf753('0x33')],_0x516434[_0xf753('0x36')]);_0x280a8b[_0xf753('0x38')]=_[_0xf753('0x37')](_0x516434['model'],qs['fields'](_0x730eab['query'][_0xf753('0x39')]));_0x280a8b[_0xf753('0x38')]=_0x280a8b[_0xf753('0x38')][_0xf753('0x3a')]?_0x280a8b[_0xf753('0x38')]:_0x516434[_0xf753('0x33')];if(!_0x730eab[_0xf753('0x36')][_0xf753('0x3b')](_0xf753('0x3c'))){_0x280a8b[_0xf753('0x1f')]=qs[_0xf753('0x1f')](_0x730eab[_0xf753('0x36')][_0xf753('0x1f')]);_0x280a8b[_0xf753('0x1d')]=qs[_0xf753('0x1d')](_0x730eab[_0xf753('0x36')]['offset']);}_0x280a8b['order']=qs[_0xf753('0x3d')](_0x730eab['query'][_0xf753('0x3d')]);_0x280a8b['where']=qs[_0xf753('0x3e')](_['pick'](_0x730eab[_0xf753('0x36')],_0x516434[_0xf753('0x3e')]),_0x43bae9);if(_0x730eab[_0xf753('0x36')][_0xf753('0x3f')]){_0x280a8b[_0xf753('0x40')]=_['merge'](_0x280a8b[_0xf753('0x40')],{'$or':_[_0xf753('0x34')](_0x43bae9,function(_0x12efac){if(_0x12efac[_0xf753('0x32')]!=='VIRTUAL'){var _0x236f2d={};_0x236f2d[_0x12efac[_0xf753('0x2d')]]={'$like':'%'+_0x730eab[_0xf753('0x36')][_0xf753('0x3f')]+'%'};return _0x236f2d;}})});}_0x280a8b=_[_0xf753('0x41')]({},_0x280a8b,_0x730eab[_0xf753('0x42')]);var _0x4ab1a3={'where':_0x280a8b[_0xf753('0x40')]};return db[_0xf753('0x30')][_0xf753('0x20')](_0x4ab1a3)[_0xf753('0x27')](function(_0x482da9){_0x3928d3[_0xf753('0x20')]=_0x482da9;if(_0x730eab[_0xf753('0x36')][_0xf753('0x43')]){_0x280a8b[_0xf753('0x44')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0xf753('0x45')](_0x280a8b);})['then'](function(_0x590023){_0x3928d3[_0xf753('0x46')]=_0x590023;return _0x3928d3;})['then'](respondWithFilteredResult(_0x253759,_0x280a8b))[_0xf753('0x47')](handleError(_0x253759,null));};exports[_0xf753('0x48')]=function(_0x2c15b2,_0x81ec99){var _0xb73b2={'raw':!![],'where':{'id':_0x2c15b2[_0xf753('0x49')]['id']}},_0x76198c={};_0x76198c[_0xf753('0x33')]=_['keys'](db['OpenchannelQueue'][_0xf753('0x31')]);_0x76198c[_0xf753('0x36')]=_['keys'](_0x2c15b2[_0xf753('0x36')]);_0x76198c[_0xf753('0x3e')]=_['intersection'](_0x76198c[_0xf753('0x33')],_0x76198c[_0xf753('0x36')]);_0xb73b2[_0xf753('0x38')]=_[_0xf753('0x37')](_0x76198c['model'],qs['fields'](_0x2c15b2['query'][_0xf753('0x39')]));_0xb73b2[_0xf753('0x38')]=_0xb73b2['attributes'][_0xf753('0x3a')]?_0xb73b2[_0xf753('0x38')]:_0x76198c[_0xf753('0x33')];if(_0x2c15b2[_0xf753('0x36')][_0xf753('0x43')]){_0xb73b2[_0xf753('0x44')]=[{'all':!![]}];}_0xb73b2=_['merge']({},_0xb73b2,_0x2c15b2[_0xf753('0x42')]);return db[_0xf753('0x30')][_0xf753('0x4a')](_0xb73b2)['then'](handleEntityNotFound(_0x81ec99,null))[_0xf753('0x27')](respondWithResult(_0x81ec99,null))[_0xf753('0x47')](handleError(_0x81ec99,null));};exports[_0xf753('0x4b')]=function(_0x3e5068,_0x395059){return db[_0xf753('0x30')][_0xf753('0x4b')](_0x3e5068['body'],{})[_0xf753('0x27')](function(_0x2c6d08){var _0x2ae546=_0x3e5068[_0xf753('0x4c')][_0xf753('0x28')]({'plain':!![]});if(!_0x2ae546)throw new Error(_0xf753('0x4d'));if(_0x2ae546[_0xf753('0x4e')]===_0xf753('0x4c')){var _0x2c8eca=_0x2c6d08['get']({'plain':!![]});var _0x2385f8=_0xf753('0x29');return db[_0xf753('0x4f')][_0xf753('0x4a')]({'where':{'name':_0x2385f8,'userProfileId':_0x2ae546['userProfileId']},'raw':!![]})[_0xf753('0x27')](function(_0x573364){if(_0x573364&&_0x573364[_0xf753('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x2c8eca[_0xf753('0x2d')],'resourceId':_0x2c8eca['id'],'type':_0x573364['name'],'sectionId':_0x573364['id']},{})['then'](function(){return _0x2c6d08;});}else{return _0x2c6d08;}})[_0xf753('0x47')](function(_0x1d9a3f){logger[_0xf753('0x51')](_0xf753('0x52'),_0x1d9a3f);throw _0x1d9a3f;});}return _0x2c6d08;})[_0xf753('0x27')](respondWithResult(_0x395059,0xc9))['catch'](handleError(_0x395059,null));};exports[_0xf753('0x26')]=function(_0x5d0c0f,_0x161f64){if(_0x5d0c0f['body']['id']){delete _0x5d0c0f['body']['id'];}return db[_0xf753('0x30')]['find']({'where':{'id':_0x5d0c0f[_0xf753('0x49')]['id']}})[_0xf753('0x27')](handleEntityNotFound(_0x161f64,null))[_0xf753('0x27')](saveUpdates(_0x5d0c0f[_0xf753('0x53')],null))['then'](respondWithResult(_0x161f64,null))['catch'](handleError(_0x161f64,null));};exports[_0xf753('0x54')]=function(_0x269519,_0xf70762){return db['OpenchannelQueue'][_0xf753('0x4a')]({'where':{'id':_0x269519[_0xf753('0x49')]['id']}})[_0xf753('0x27')](handleEntityNotFound(_0xf70762,null))[_0xf753('0x27')](removeEntity(_0xf70762,null))[_0xf753('0x47')](handleError(_0xf70762,null));};exports[_0xf753('0x55')]=function(_0x363424,_0x3d53cd){return db[_0xf753('0x30')][_0xf753('0x55')]()[_0xf753('0x27')](respondWithResult(_0x3d53cd,null))[_0xf753('0x47')](handleError(_0x3d53cd,null));};exports[_0xf753('0x56')]=function(_0x5b7565,_0x163db9,_0x37e08b){var _0x82cab1={'raw':!![],'where':{}},_0x2fd099={},_0x45fdd8;return db['OpenchannelQueue'][_0xf753('0x57')]({'where':{'id':_0x5b7565[_0xf753('0x49')]['id']}})[_0xf753('0x27')](handleEntityNotFound(_0x163db9,null))['then'](function(_0x478ad9){if(_0x478ad9){_0x45fdd8=_0x478ad9['get']({'plain':!![]});_0x2fd099['model']=_[_0xf753('0x35')](db[_0xf753('0x58')][_0xf753('0x31')]);_0x2fd099[_0xf753('0x36')]=_['keys'](_0x5b7565[_0xf753('0x36')]);_0x2fd099[_0xf753('0x3e')]=_[_0xf753('0x37')](_0x2fd099[_0xf753('0x33')],_0x2fd099[_0xf753('0x36')]);_0x82cab1[_0xf753('0x38')]=_['intersection'](_0x2fd099[_0xf753('0x33')],qs[_0xf753('0x39')](_0x5b7565[_0xf753('0x36')][_0xf753('0x39')]));_0x82cab1['attributes']=_0x82cab1[_0xf753('0x38')]['length']?_0x82cab1[_0xf753('0x38')]:_0x2fd099[_0xf753('0x33')];if(!_0x5b7565['query']['hasOwnProperty'](_0xf753('0x3c'))){_0x82cab1[_0xf753('0x1f')]=qs[_0xf753('0x1f')](_0x5b7565[_0xf753('0x36')]['limit']);_0x82cab1[_0xf753('0x1d')]=qs['offset'](_0x5b7565['query']['offset']);}_0x82cab1[_0xf753('0x59')]=qs[_0xf753('0x3d')](_0x5b7565[_0xf753('0x36')][_0xf753('0x3d')]);_0x82cab1[_0xf753('0x40')]=qs['filters'](_[_0xf753('0x5a')](_0x5b7565[_0xf753('0x36')],_0x2fd099[_0xf753('0x3e')]));_0x82cab1['where'][_0xf753('0x5b')]=_0x478ad9['id'];if(_0x5b7565[_0xf753('0x36')][_0xf753('0x3f')]){_0x82cab1[_0xf753('0x40')]=_['merge'](_0x82cab1[_0xf753('0x40')],{'$or':_[_0xf753('0x34')](_0x82cab1[_0xf753('0x38')],function(_0x3dc63c){var _0x32db99={};_0x32db99[_0x3dc63c]={'$like':'%'+_0x5b7565[_0xf753('0x36')]['filter']+'%'};return _0x32db99;})});}_0x82cab1=_[_0xf753('0x41')]({},_0x82cab1,_0x5b7565['options']);return db[_0xf753('0x58')]['findAll'](_0x82cab1);}})[_0xf753('0x27')](function(_0x15a330){if(_0x15a330){return db[_0xf753('0x5c')][_0xf753('0x5d')]({'where':{'id':_[_0xf753('0x34')](_0x15a330,_0xf753('0x5e')),'role':_0xf753('0x5f')},'attributes':['id',_0xf753('0x2d'),_0xf753('0x60'),'updatedAt',_0xf753('0x61')]});}})[_0xf753('0x27')](function(_0x53561b){if(_0x53561b){return{'count':_0x53561b['count'],'rows':_['map'](_0x53561b[_0xf753('0x46')],function(_0x48554a){return{'membername':_0x48554a[_0xf753('0x2d')],'UserId':_0x48554a['id'],'queue_name':_0x45fdd8[_0xf753('0x2d')],'OpenchannelQueueId':_0x45fdd8['id'],'interface':util['format'](_0xf753('0x62'),'SIP',_0x48554a['name']),'penalty':0x0,'paused':_0x48554a[_0xf753('0x60')],'createdAt':_0x48554a[_0xf753('0x61')],'updatedAt':_0x48554a[_0xf753('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf753('0x27')](respondWithFilteredResult(_0x163db9,_0x82cab1))['catch'](handleError(_0x163db9,null));};exports[_0xf753('0x64')]=function(_0x163297,_0x1b1882,_0x466237){var _0x4ebeeb={};var _0x184e0c={};var _0x452fec;var _0x146b04;return db[_0xf753('0x30')][_0xf753('0x57')]({'where':{'id':_0x163297['params']['id']}})['then'](handleEntityNotFound(_0x1b1882,null))['then'](function(_0x2e732e){if(_0x2e732e){_0x452fec=_0x2e732e;_0x184e0c[_0xf753('0x33')]=_['keys'](db['Team'][_0xf753('0x31')]);_0x184e0c[_0xf753('0x36')]=_[_0xf753('0x35')](_0x163297[_0xf753('0x36')]);_0x184e0c['filters']=_[_0xf753('0x37')](_0x184e0c[_0xf753('0x33')],_0x184e0c[_0xf753('0x36')]);_0x4ebeeb[_0xf753('0x38')]=_['intersection'](_0x184e0c[_0xf753('0x33')],qs[_0xf753('0x39')](_0x163297[_0xf753('0x36')]['fields']));_0x4ebeeb['attributes']=_0x4ebeeb['attributes'][_0xf753('0x3a')]?_0x4ebeeb[_0xf753('0x38')]:_0x184e0c['model'];_0x4ebeeb[_0xf753('0x59')]=qs[_0xf753('0x3d')](_0x163297['query'][_0xf753('0x3d')]);_0x4ebeeb['where']=qs[_0xf753('0x3e')](_[_0xf753('0x5a')](_0x163297[_0xf753('0x36')],_0x184e0c[_0xf753('0x3e')]));if(_0x163297['query']['filter']){_0x4ebeeb['where']=_[_0xf753('0x41')](_0x4ebeeb[_0xf753('0x40')],{'$or':_[_0xf753('0x34')](_0x4ebeeb[_0xf753('0x38')],function(_0x372491){var _0x541f47={};_0x541f47[_0x372491]={'$like':'%'+_0x163297[_0xf753('0x36')]['filter']+'%'};return _0x541f47;})});}_0x4ebeeb=_[_0xf753('0x41')]({},_0x4ebeeb,_0x163297[_0xf753('0x42')]);return _0x452fec[_0xf753('0x64')](_0x4ebeeb);}})[_0xf753('0x27')](function(_0x59482a){if(_0x59482a){_0x146b04=_0x59482a['length'];if(!_0x163297['query'][_0xf753('0x3b')](_0xf753('0x3c'))){_0x4ebeeb['limit']=qs[_0xf753('0x1f')](_0x163297[_0xf753('0x36')]['limit']);_0x4ebeeb[_0xf753('0x1d')]=qs[_0xf753('0x1d')](_0x163297[_0xf753('0x36')][_0xf753('0x1d')]);}return _0x452fec['getTeams'](_0x4ebeeb);}})['then'](function(_0x34b808){if(_0x34b808){return _0x34b808?{'count':_0x146b04,'rows':_0x34b808}:null;}})['then'](respondWithResult(_0x1b1882,null))['catch'](handleError(_0x1b1882,null));};exports[_0xf753('0x65')]=function(_0x38d650,_0x1aab02,_0x22c2e7){var _0x401267=_0x38d650[_0xf753('0x53')][_0xf753('0x66')];return db[_0xf753('0x67')]['findAll']({'where':{'id':_0x401267},'attributes':['id'],'include':[{'model':db[_0xf753('0x5c')],'as':'Agents','attributes':['id','name',_0xf753('0x68'),_0xf753('0x69'),_0xf753('0x6a')],'raw':!![]}]})[_0xf753('0x27')](function(_0x53e91a){if(_0x53e91a){var _0x554d90=_[_0xf753('0x6b')](_0x53e91a,function(_0x33b946){var _0x11b3f2=_0x33b946['get']({'plain':!![]});return _0x11b3f2[_0xf753('0x6c')];});return db[_0xf753('0x30')][_0xf753('0x4a')]({'where':{'id':_0x38d650[_0xf753('0x49')]['id']}})[_0xf753('0x27')](function(_0x3b58fd){return db[_0xf753('0x6d')][_0xf753('0x6e')](function(_0xe7355d){return _0x3b58fd[_0xf753('0x65')](_0x401267,{'transaction':_0xe7355d})[_0xf753('0x27')](function(){return BPromise['each'](_0x554d90,function(_0xeeb777){return db[_0xf753('0x58')]['findOrCreate']({'where':{'UserId':_0xeeb777['id'],'OpenchannelQueueId':_0x38d650[_0xf753('0x49')]['id']},'transaction':_0xe7355d});});})[_0xf753('0x27')](function(){_0x554d90[_0xf753('0x6f')](function(_0x1d0bb5){socket[_0xf753('0x70')]('userOpenchannelQueue:save',{'UserId':_0x1d0bb5['id'],'OpenchannelQueueId':_0x3b58fd['id']});});});});});}})[_0xf753('0x27')](respondWithStatusCode(_0x1aab02,null))[_0xf753('0x47')](handleError(_0x1aab02,null));};exports['removeTeams']=function(_0x3167bc,_0x5878bf,_0x61fe36){return db[_0xf753('0x67')][_0xf753('0x45')]({'where':{'id':_0x3167bc['query'][_0xf753('0x66')]},'attributes':['id'],'include':[{'model':db[_0xf753('0x5c')],'as':_0xf753('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xf753('0x27')](handleEntityNotFound(_0x5878bf,null))[_0xf753('0x27')](function(_0x23fede){var _0x2775ae=_[_0xf753('0x34')](_0x23fede,'id');var _0x26c98d=[];var _0x45347e=[];var _0x475f0c=squel[_0xf753('0x71')]();_0x475f0c[_0xf753('0x72')]('tq.TeamId')['from'](_0xf753('0x73'),'tq')[_0xf753('0x74')](_0xf753('0x75'),'ut',_0xf753('0x76'))[_0xf753('0x40')](_0xf753('0x77'),_0x3167bc['params']['id']);for(var _0x5b9620=0x0;_0x5b9620<_0x23fede['length'];_0x5b9620+=0x1){let _0x24c0f8=_0x23fede[_0x5b9620];for(var _0x34b8f0=0x0;_0x34b8f0<_0x24c0f8['Agents'][_0xf753('0x3a')];_0x34b8f0+=0x1){let _0x2afaff=_0x24c0f8[_0xf753('0x6c')][_0x34b8f0];var _0x9d5654=_0x475f0c[_0xf753('0x78')]();_0x9d5654[_0xf753('0x40')]('ut.UserId\x20=\x20?',_0x2afaff['id']);_0x45347e[_0xf753('0x79')](db[_0xf753('0x6d')][_0xf753('0x36')](_0x9d5654['toString'](),{'type':db['sequelize'][_0xf753('0x7a')]['SELECT']})['then'](function(_0x1e8e6c){if(_0x1e8e6c['length']===0x1){return _0x2afaff['id'];}else{var _0x39df95=_[_0xf753('0x7b')](_['map'](_0x1e8e6c,'TeamId'),function(_0xc9480b){return _['includes'](_0x2775ae,_0xc9480b);});if(_0x39df95){return _0x2afaff['id'];}}}));}}return BPromise[_0xf753('0x7c')](_0x45347e)[_0xf753('0x27')](function(_0x2ce935){_0x26c98d=_(_0x26c98d)[_0xf753('0x7d')](_0x2ce935)['compact']()[_0xf753('0x7e')]();return db['OpenchannelQueue'][_0xf753('0x4a')]({'where':{'id':_0x3167bc['params']['id']}})[_0xf753('0x27')](function(_0x3093e9){return db[_0xf753('0x6d')][_0xf753('0x6e')](function(_0x5ef213){return _0x3093e9[_0xf753('0x7f')](_0x3167bc['query'][_0xf753('0x66')],{'transaction':_0x5ef213})[_0xf753('0x27')](function(){if(!_[_0xf753('0x80')](_0x26c98d)){return _0x3093e9[_0xf753('0x81')](_0x26c98d,{'transaction':_0x5ef213});}})[_0xf753('0x27')](function(){_0x26c98d[_0xf753('0x6f')](function(_0x18f97b){socket[_0xf753('0x70')]('userOpenchannelQueue:remove',{'UserId':_0x18f97b,'OpenchannelQueueId':_0x3093e9['id']});});});});});});})[_0xf753('0x27')](respondWithStatusCode(_0x5878bf,null))['catch'](handleError(_0x5878bf,null));};exports[_0xf753('0x82')]=function(_0x459af8,_0x49dddb,_0x5ca635){return db[_0xf753('0x30')][_0xf753('0x4a')]({'where':{'id':_0x459af8['params']['id']}})[_0xf753('0x27')](handleEntityNotFound(_0x49dddb,null))['then'](function(_0x34e772){if(_0x34e772){return _0x34e772['addAgents'](_0x459af8[_0xf753('0x53')]['ids'],_[_0xf753('0x83')](_0x459af8[_0xf753('0x53')],[_0xf753('0x66'),'id'])||{})[_0xf753('0x84')](function(_0x5653a2){for(var _0x40bac8=0x0;_0x40bac8<_0x459af8[_0xf753('0x53')][_0xf753('0x66')][_0xf753('0x3a')];_0x40bac8+=0x1){socket[_0xf753('0x70')](_0xf753('0x85'),{'UserId':Number(_0x459af8[_0xf753('0x53')][_0xf753('0x66')][_0x40bac8]),'OpenchannelQueueId':Number(_0x459af8[_0xf753('0x49')]['id'])});}return _0x5653a2;});}})['then'](respondWithResult(_0x49dddb,null))['catch'](handleError(_0x49dddb,null));};exports[_0xf753('0x81')]=function(_0x44b02a,_0x555a97,_0x2f315f){return db[_0xf753('0x30')][_0xf753('0x4a')]({'where':{'id':_0x44b02a[_0xf753('0x49')]['id']}})[_0xf753('0x27')](handleEntityNotFound(_0x555a97,null))[_0xf753('0x27')](function(_0x37ef24){if(_0x37ef24){return _0x37ef24[_0xf753('0x81')](_0x44b02a['query'][_0xf753('0x66')])['then'](function(){if(_[_0xf753('0x86')](_0x44b02a[_0xf753('0x36')][_0xf753('0x66')])){for(var _0x2e8624=0x0;_0x2e8624<_0x44b02a[_0xf753('0x36')][_0xf753('0x66')][_0xf753('0x3a')];_0x2e8624+=0x1){socket[_0xf753('0x70')](_0xf753('0x87'),{'UserId':Number(_0x44b02a[_0xf753('0x36')][_0xf753('0x66')][_0x2e8624]),'OpenchannelQueueId':Number(_0x44b02a[_0xf753('0x49')]['id'])});}}else{socket[_0xf753('0x70')](_0xf753('0x87'),{'UserId':Number(_0x44b02a[_0xf753('0x36')]['ids']),'OpenchannelQueueId':Number(_0x44b02a[_0xf753('0x49')]['id'])});}});}})[_0xf753('0x27')](respondWithStatusCode(_0x555a97,null))[_0xf753('0x47')](handleError(_0x555a97,null));};exports[_0xf753('0x88')]=function(_0x2fae1f,_0x38f789,_0x2396df){var _0x56a4bc={};var _0x3b11e8={};var _0x22ca35;var _0x49976b;return db['OpenchannelQueue'][_0xf753('0x57')]({'where':{'id':_0x2fae1f['params']['id']}})[_0xf753('0x27')](handleEntityNotFound(_0x38f789,null))['then'](function(_0xcf804d){if(_0xcf804d){_0x22ca35=_0xcf804d;_0x3b11e8[_0xf753('0x33')]=_['keys'](db['User'][_0xf753('0x31')]);_0x3b11e8[_0xf753('0x36')]=_[_0xf753('0x35')](_0x2fae1f[_0xf753('0x36')]);_0x3b11e8[_0xf753('0x3e')]=_[_0xf753('0x37')](_0x3b11e8[_0xf753('0x33')],_0x3b11e8[_0xf753('0x36')]);_0x56a4bc[_0xf753('0x38')]=_[_0xf753('0x37')](_0x3b11e8[_0xf753('0x33')],qs[_0xf753('0x39')](_0x2fae1f[_0xf753('0x36')][_0xf753('0x39')]));_0x56a4bc[_0xf753('0x38')]=_0x56a4bc[_0xf753('0x38')][_0xf753('0x3a')]?_0x56a4bc['attributes']:_0x3b11e8[_0xf753('0x33')];_0x56a4bc[_0xf753('0x59')]=qs[_0xf753('0x3d')](_0x2fae1f[_0xf753('0x36')]['sort']);_0x56a4bc[_0xf753('0x40')]=qs[_0xf753('0x3e')](_['pick'](_0x2fae1f[_0xf753('0x36')],_0x3b11e8[_0xf753('0x3e')]));if(_0x2fae1f['query']['filter']){_0x56a4bc[_0xf753('0x40')]=_[_0xf753('0x41')](_0x56a4bc['where'],{'$or':_[_0xf753('0x34')](_0x56a4bc[_0xf753('0x38')],function(_0x11ad21){var _0x403ef2={};_0x403ef2[_0x11ad21]={'$like':'%'+_0x2fae1f[_0xf753('0x36')]['filter']+'%'};return _0x403ef2;})});}_0x56a4bc=_['merge']({},_0x56a4bc,_0x2fae1f[_0xf753('0x42')]);return _0x22ca35[_0xf753('0x88')](_0x56a4bc);}})[_0xf753('0x27')](function(_0x4626a9){if(_0x4626a9){_0x49976b=_0x4626a9[_0xf753('0x3a')];if(!_0x2fae1f[_0xf753('0x36')]['hasOwnProperty'](_0xf753('0x3c'))){_0x56a4bc['limit']=qs[_0xf753('0x1f')](_0x2fae1f[_0xf753('0x36')]['limit']);_0x56a4bc['offset']=qs[_0xf753('0x1d')](_0x2fae1f[_0xf753('0x36')]['offset']);}return _0x22ca35[_0xf753('0x88')](_0x56a4bc);}})['then'](function(_0x2c8c5e){if(_0x2c8c5e){return _0x2c8c5e?{'count':_0x49976b,'rows':_0x2c8c5e}:null;}})[_0xf753('0x27')](respondWithResult(_0x38f789,null))['catch'](handleError(_0x38f789,null));}; \ No newline at end of file +var _0xc4ea=['tq.TeamId','from','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','sequelize','QueryTypes','SELECT','every','includes','all','union','compact','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','emit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./openchannelQueue.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','end','sendStatus','error','stack','name','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','options','find','create','body','role','user','UserProfileSection','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserOpenchannelQueue','nolimit','OpenchannelQueueId','User','UserId','agent','openchannelPause','updatedAt','createdAt','SIP','getTeams','Team','addTeams','ids','voicePause','flatMap','Agents','transaction','each','findOrCreate','forEach','userOpenchannelQueue:save','select','field'];(function(_0x523fd9,_0x1a9bee){var _0x3c17c5=function(_0x2fd2b6){while(--_0x2fd2b6){_0x523fd9['push'](_0x523fd9['shift']());}};_0x3c17c5(++_0x1a9bee);}(_0xc4ea,0x12b));var _0xac4e=function(_0xad4036,_0x5b842b){_0xad4036=_0xad4036-0x0;var _0x702979=_0xc4ea[_0xad4036];return _0x702979;};'use strict';var emlformat=require(_0xac4e('0x0'));var rimraf=require(_0xac4e('0x1'));var zipdir=require(_0xac4e('0x2'));var jsonpatch=require(_0xac4e('0x3'));var rp=require('request-promise');var moment=require(_0xac4e('0x4'));var BPromise=require(_0xac4e('0x5'));var Mustache=require(_0xac4e('0x6'));var util=require(_0xac4e('0x7'));var path=require(_0xac4e('0x8'));var sox=require('sox');var csv=require(_0xac4e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xac4e('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xac4e('0xb'));var jsforce=require(_0xac4e('0xc'));var deskjs=require(_0xac4e('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xac4e('0xe'));var Redis=require(_0xac4e('0xf'));var authService=require(_0xac4e('0x10'));var qs=require(_0xac4e('0x11'));var as=require(_0xac4e('0x12'));var hardwareService=require(_0xac4e('0x13'));var logger=require(_0xac4e('0x14'))('api');var utils=require(_0xac4e('0x15'));var config=require(_0xac4e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xac4e('0x17'))['db'];config[_0xac4e('0x18')]=_['defaults'](config[_0xac4e('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xac4e('0x19'))(new Redis(config[_0xac4e('0x18')]));require(_0xac4e('0x1a'))[_0xac4e('0x1b')](socket);function respondWithStatusCode(_0x204d96,_0xa287c9){_0xa287c9=_0xa287c9||0xcc;return function(_0x215703){if(_0x215703){return _0x204d96['sendStatus'](_0xa287c9);}return _0x204d96[_0xac4e('0x1c')](_0xa287c9)['end']();};}function respondWithResult(_0x11c4cb,_0x1cee5d){_0x1cee5d=_0x1cee5d||0xc8;return function(_0x20316f){if(_0x20316f){return _0x11c4cb[_0xac4e('0x1c')](_0x1cee5d)[_0xac4e('0x1d')](_0x20316f);}};}function respondWithFilteredResult(_0x7a7f6f,_0x4b03a0){return function(_0xbce05e){if(_0xbce05e){var _0x2572d6=typeof _0x4b03a0[_0xac4e('0x1e')]===_0xac4e('0x1f')&&typeof _0x4b03a0[_0xac4e('0x20')]===_0xac4e('0x1f');var _0x231641=_0xbce05e['count'];var _0x1df76d=_0x2572d6?0x0:_0x4b03a0['offset'];var _0x4720f1=_0x2572d6?_0xbce05e[_0xac4e('0x21')]:_0x4b03a0[_0xac4e('0x1e')]+_0x4b03a0[_0xac4e('0x20')];var _0x5a6a63;if(_0x4720f1>=_0x231641){_0x4720f1=_0x231641;_0x5a6a63=0xc8;}else{_0x5a6a63=0xce;}_0x7a7f6f[_0xac4e('0x1c')](_0x5a6a63);return _0x7a7f6f[_0xac4e('0x22')](_0xac4e('0x23'),_0x1df76d+'-'+_0x4720f1+'/'+_0x231641)[_0xac4e('0x1d')](_0xbce05e);}return null;};}function patchUpdates(_0x564e09){return function(_0x18b9c9){try{jsonpatch[_0xac4e('0x24')](_0x18b9c9,_0x564e09,!![]);}catch(_0x52173d){return BPromise[_0xac4e('0x25')](_0x52173d);}return _0x18b9c9['save']();};}function saveUpdates(_0x1ff5ab,_0x5c5f0c){return function(_0x519b9c){if(_0x519b9c){return _0x519b9c[_0xac4e('0x26')](_0x1ff5ab)[_0xac4e('0x27')](function(_0x5648b1){return _0x5648b1;});}return null;};}function removeEntity(_0x2c3678,_0x2fc90b){return function(_0x3ff9c9){if(_0x3ff9c9){return _0x3ff9c9[_0xac4e('0x28')]()[_0xac4e('0x27')](function(){var _0x1b003=_0x3ff9c9[_0xac4e('0x29')]({'plain':!![]});var _0x8e0d4e='OpenchannelQueues';return db[_0xac4e('0x2a')][_0xac4e('0x28')]({'where':{'type':_0x8e0d4e,'resourceId':_0x1b003['id']}})[_0xac4e('0x27')](function(){return _0x3ff9c9;});})[_0xac4e('0x27')](function(){_0x2c3678[_0xac4e('0x1c')](0xcc)[_0xac4e('0x2b')]();});}};}function handleEntityNotFound(_0x10c2a5,_0x1eeafb){return function(_0x9882d0){if(!_0x9882d0){_0x10c2a5[_0xac4e('0x2c')](0x194);}return _0x9882d0;};}function handleError(_0x947a08,_0x4696a0){_0x4696a0=_0x4696a0||0x1f4;return function(_0x87ec38){logger[_0xac4e('0x2d')](_0x87ec38[_0xac4e('0x2e')]);if(_0x87ec38[_0xac4e('0x2f')]){delete _0x87ec38[_0xac4e('0x2f')];}_0x947a08[_0xac4e('0x1c')](_0x4696a0)['send'](_0x87ec38);};}exports['index']=function(_0x33d0a4,_0x13b6d0){var _0x2f4361={},_0x529d96={},_0x6c5971={'count':0x0,'rows':[]};var _0x51fc1d=_[_0xac4e('0x30')](db[_0xac4e('0x31')][_0xac4e('0x32')],function(_0x385a32){return{'name':_0x385a32[_0xac4e('0x33')],'type':_0x385a32[_0xac4e('0x34')][_0xac4e('0x35')]};});_0x529d96[_0xac4e('0x36')]=_['map'](_0x51fc1d,_0xac4e('0x2f'));_0x529d96[_0xac4e('0x37')]=_[_0xac4e('0x38')](_0x33d0a4[_0xac4e('0x37')]);_0x529d96[_0xac4e('0x39')]=_[_0xac4e('0x3a')](_0x529d96[_0xac4e('0x36')],_0x529d96[_0xac4e('0x37')]);_0x2f4361[_0xac4e('0x3b')]=_['intersection'](_0x529d96[_0xac4e('0x36')],qs[_0xac4e('0x3c')](_0x33d0a4[_0xac4e('0x37')][_0xac4e('0x3c')]));_0x2f4361['attributes']=_0x2f4361[_0xac4e('0x3b')][_0xac4e('0x3d')]?_0x2f4361[_0xac4e('0x3b')]:_0x529d96[_0xac4e('0x36')];if(!_0x33d0a4[_0xac4e('0x37')][_0xac4e('0x3e')]('nolimit')){_0x2f4361[_0xac4e('0x20')]=qs['limit'](_0x33d0a4[_0xac4e('0x37')][_0xac4e('0x20')]);_0x2f4361['offset']=qs[_0xac4e('0x1e')](_0x33d0a4[_0xac4e('0x37')][_0xac4e('0x1e')]);}_0x2f4361[_0xac4e('0x3f')]=qs[_0xac4e('0x40')](_0x33d0a4[_0xac4e('0x37')][_0xac4e('0x40')]);_0x2f4361[_0xac4e('0x41')]=qs[_0xac4e('0x39')](_[_0xac4e('0x42')](_0x33d0a4[_0xac4e('0x37')],_0x529d96[_0xac4e('0x39')]),_0x51fc1d);if(_0x33d0a4[_0xac4e('0x37')][_0xac4e('0x43')]){_0x2f4361[_0xac4e('0x41')]=_[_0xac4e('0x44')](_0x2f4361['where'],{'$or':_['map'](_0x51fc1d,function(_0x48c83a){if(_0x48c83a[_0xac4e('0x34')]!=='VIRTUAL'){var _0x5d536b={};_0x5d536b[_0x48c83a[_0xac4e('0x2f')]]={'$like':'%'+_0x33d0a4[_0xac4e('0x37')]['filter']+'%'};return _0x5d536b;}})});}_0x2f4361=_[_0xac4e('0x44')]({},_0x2f4361,_0x33d0a4['options']);var _0x4ddbca={'where':_0x2f4361['where']};return db[_0xac4e('0x31')][_0xac4e('0x21')](_0x4ddbca)[_0xac4e('0x27')](function(_0x38a0cf){_0x6c5971[_0xac4e('0x21')]=_0x38a0cf;if(_0x33d0a4['query'][_0xac4e('0x45')]){_0x2f4361[_0xac4e('0x46')]=[{'all':!![]}];}return db[_0xac4e('0x31')][_0xac4e('0x47')](_0x2f4361);})[_0xac4e('0x27')](function(_0x32d6bd){_0x6c5971[_0xac4e('0x48')]=_0x32d6bd;return _0x6c5971;})[_0xac4e('0x27')](respondWithFilteredResult(_0x13b6d0,_0x2f4361))['catch'](handleError(_0x13b6d0,null));};exports[_0xac4e('0x49')]=function(_0x29fd75,_0x4cf4be){var _0x281346={'raw':!![],'where':{'id':_0x29fd75['params']['id']}},_0x129e44={};_0x129e44['model']=_[_0xac4e('0x38')](db[_0xac4e('0x31')][_0xac4e('0x32')]);_0x129e44[_0xac4e('0x37')]=_['keys'](_0x29fd75[_0xac4e('0x37')]);_0x129e44[_0xac4e('0x39')]=_[_0xac4e('0x3a')](_0x129e44[_0xac4e('0x36')],_0x129e44[_0xac4e('0x37')]);_0x281346[_0xac4e('0x3b')]=_['intersection'](_0x129e44['model'],qs['fields'](_0x29fd75[_0xac4e('0x37')][_0xac4e('0x3c')]));_0x281346['attributes']=_0x281346['attributes'][_0xac4e('0x3d')]?_0x281346[_0xac4e('0x3b')]:_0x129e44[_0xac4e('0x36')];if(_0x29fd75[_0xac4e('0x37')][_0xac4e('0x45')]){_0x281346[_0xac4e('0x46')]=[{'all':!![]}];}_0x281346=_[_0xac4e('0x44')]({},_0x281346,_0x29fd75[_0xac4e('0x4a')]);return db[_0xac4e('0x31')][_0xac4e('0x4b')](_0x281346)[_0xac4e('0x27')](handleEntityNotFound(_0x4cf4be,null))[_0xac4e('0x27')](respondWithResult(_0x4cf4be,null))['catch'](handleError(_0x4cf4be,null));};exports[_0xac4e('0x4c')]=function(_0x405d04,_0x358589){return db[_0xac4e('0x31')][_0xac4e('0x4c')](_0x405d04[_0xac4e('0x4d')],{})[_0xac4e('0x27')](function(_0x400039){var _0x23bc34=_0x405d04['user']['get']({'plain':!![]});if(!_0x23bc34)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23bc34[_0xac4e('0x4e')]===_0xac4e('0x4f')){var _0x111db3=_0x400039[_0xac4e('0x29')]({'plain':!![]});var _0x1f235b='OpenchannelQueues';return db[_0xac4e('0x50')][_0xac4e('0x4b')]({'where':{'name':_0x1f235b,'userProfileId':_0x23bc34[_0xac4e('0x51')]},'raw':!![]})[_0xac4e('0x27')](function(_0x45007e){if(_0x45007e&&_0x45007e['autoAssociation']===0x0){return db[_0xac4e('0x2a')]['create']({'name':_0x111db3[_0xac4e('0x2f')],'resourceId':_0x111db3['id'],'type':_0x45007e[_0xac4e('0x2f')],'sectionId':_0x45007e['id']},{})[_0xac4e('0x27')](function(){return _0x400039;});}else{return _0x400039;}})[_0xac4e('0x52')](function(_0x5acd27){logger[_0xac4e('0x2d')](_0xac4e('0x53'),_0x5acd27);throw _0x5acd27;});}return _0x400039;})[_0xac4e('0x27')](respondWithResult(_0x358589,0xc9))[_0xac4e('0x52')](handleError(_0x358589,null));};exports[_0xac4e('0x26')]=function(_0x33bf54,_0xf2b1ce){if(_0x33bf54['body']['id']){delete _0x33bf54['body']['id'];}return db[_0xac4e('0x31')][_0xac4e('0x4b')]({'where':{'id':_0x33bf54[_0xac4e('0x54')]['id']}})[_0xac4e('0x27')](handleEntityNotFound(_0xf2b1ce,null))['then'](saveUpdates(_0x33bf54[_0xac4e('0x4d')],null))['then'](respondWithResult(_0xf2b1ce,null))[_0xac4e('0x52')](handleError(_0xf2b1ce,null));};exports[_0xac4e('0x28')]=function(_0x4dd892,_0x55dc79){return db[_0xac4e('0x31')]['find']({'where':{'id':_0x4dd892[_0xac4e('0x54')]['id']}})[_0xac4e('0x27')](handleEntityNotFound(_0x55dc79,null))[_0xac4e('0x27')](removeEntity(_0x55dc79,null))[_0xac4e('0x52')](handleError(_0x55dc79,null));};exports['describe']=function(_0x4d52e0,_0x3f8104){return db[_0xac4e('0x31')][_0xac4e('0x55')]()['then'](respondWithResult(_0x3f8104,null))['catch'](handleError(_0x3f8104,null));};exports[_0xac4e('0x56')]=function(_0x37333f,_0x163297,_0x584d17){var _0x24173c={'raw':!![],'where':{}},_0x46bf79={},_0x5662b6;return db['OpenchannelQueue'][_0xac4e('0x57')]({'where':{'id':_0x37333f['params']['id']}})['then'](handleEntityNotFound(_0x163297,null))['then'](function(_0x354d5c){if(_0x354d5c){_0x5662b6=_0x354d5c[_0xac4e('0x29')]({'plain':!![]});_0x46bf79[_0xac4e('0x36')]=_[_0xac4e('0x38')](db[_0xac4e('0x58')][_0xac4e('0x32')]);_0x46bf79[_0xac4e('0x37')]=_[_0xac4e('0x38')](_0x37333f[_0xac4e('0x37')]);_0x46bf79[_0xac4e('0x39')]=_[_0xac4e('0x3a')](_0x46bf79[_0xac4e('0x36')],_0x46bf79['query']);_0x24173c[_0xac4e('0x3b')]=_[_0xac4e('0x3a')](_0x46bf79[_0xac4e('0x36')],qs['fields'](_0x37333f[_0xac4e('0x37')][_0xac4e('0x3c')]));_0x24173c[_0xac4e('0x3b')]=_0x24173c['attributes']['length']?_0x24173c[_0xac4e('0x3b')]:_0x46bf79[_0xac4e('0x36')];if(!_0x37333f[_0xac4e('0x37')][_0xac4e('0x3e')](_0xac4e('0x59'))){_0x24173c['limit']=qs[_0xac4e('0x20')](_0x37333f[_0xac4e('0x37')][_0xac4e('0x20')]);_0x24173c[_0xac4e('0x1e')]=qs[_0xac4e('0x1e')](_0x37333f[_0xac4e('0x37')][_0xac4e('0x1e')]);}_0x24173c['order']=qs[_0xac4e('0x40')](_0x37333f[_0xac4e('0x37')][_0xac4e('0x40')]);_0x24173c[_0xac4e('0x41')]=qs[_0xac4e('0x39')](_[_0xac4e('0x42')](_0x37333f['query'],_0x46bf79[_0xac4e('0x39')]));_0x24173c[_0xac4e('0x41')][_0xac4e('0x5a')]=_0x354d5c['id'];if(_0x37333f[_0xac4e('0x37')]['filter']){_0x24173c[_0xac4e('0x41')]=_[_0xac4e('0x44')](_0x24173c[_0xac4e('0x41')],{'$or':_['map'](_0x24173c['attributes'],function(_0xe4196b){var _0x527028={};_0x527028[_0xe4196b]={'$like':'%'+_0x37333f[_0xac4e('0x37')][_0xac4e('0x43')]+'%'};return _0x527028;})});}_0x24173c=_[_0xac4e('0x44')]({},_0x24173c,_0x37333f[_0xac4e('0x4a')]);return db[_0xac4e('0x58')][_0xac4e('0x47')](_0x24173c);}})['then'](function(_0x2d631f){if(_0x2d631f){return db[_0xac4e('0x5b')]['findAndCountAll']({'where':{'id':_[_0xac4e('0x30')](_0x2d631f,_0xac4e('0x5c')),'role':_0xac4e('0x5d')},'attributes':['id','name',_0xac4e('0x5e'),_0xac4e('0x5f'),_0xac4e('0x60')]});}})[_0xac4e('0x27')](function(_0x3860f4){if(_0x3860f4){return{'count':_0x3860f4[_0xac4e('0x21')],'rows':_['map'](_0x3860f4[_0xac4e('0x48')],function(_0x426775){return{'membername':_0x426775[_0xac4e('0x2f')],'UserId':_0x426775['id'],'queue_name':_0x5662b6['name'],'OpenchannelQueueId':_0x5662b6['id'],'interface':util['format']('%s/%s',_0xac4e('0x61'),_0x426775[_0xac4e('0x2f')]),'penalty':0x0,'paused':_0x426775[_0xac4e('0x5e')],'createdAt':_0x426775[_0xac4e('0x60')],'updatedAt':_0x426775[_0xac4e('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xac4e('0x27')](respondWithFilteredResult(_0x163297,_0x24173c))[_0xac4e('0x52')](handleError(_0x163297,null));};exports[_0xac4e('0x62')]=function(_0x4ed56d,_0x1c81ba,_0x4599a0){var _0x5597e0={};var _0x587d89={};var _0x384c69;var _0x412845;return db[_0xac4e('0x31')][_0xac4e('0x57')]({'where':{'id':_0x4ed56d[_0xac4e('0x54')]['id']}})['then'](handleEntityNotFound(_0x1c81ba,null))[_0xac4e('0x27')](function(_0x3634be){if(_0x3634be){_0x384c69=_0x3634be;_0x587d89[_0xac4e('0x36')]=_[_0xac4e('0x38')](db[_0xac4e('0x63')][_0xac4e('0x32')]);_0x587d89[_0xac4e('0x37')]=_['keys'](_0x4ed56d[_0xac4e('0x37')]);_0x587d89[_0xac4e('0x39')]=_['intersection'](_0x587d89[_0xac4e('0x36')],_0x587d89[_0xac4e('0x37')]);_0x5597e0['attributes']=_[_0xac4e('0x3a')](_0x587d89[_0xac4e('0x36')],qs['fields'](_0x4ed56d[_0xac4e('0x37')][_0xac4e('0x3c')]));_0x5597e0['attributes']=_0x5597e0[_0xac4e('0x3b')][_0xac4e('0x3d')]?_0x5597e0[_0xac4e('0x3b')]:_0x587d89['model'];_0x5597e0[_0xac4e('0x3f')]=qs[_0xac4e('0x40')](_0x4ed56d[_0xac4e('0x37')][_0xac4e('0x40')]);_0x5597e0[_0xac4e('0x41')]=qs[_0xac4e('0x39')](_[_0xac4e('0x42')](_0x4ed56d[_0xac4e('0x37')],_0x587d89[_0xac4e('0x39')]));if(_0x4ed56d['query'][_0xac4e('0x43')]){_0x5597e0['where']=_[_0xac4e('0x44')](_0x5597e0[_0xac4e('0x41')],{'$or':_['map'](_0x5597e0['attributes'],function(_0x39d2f4){var _0x4b5923={};_0x4b5923[_0x39d2f4]={'$like':'%'+_0x4ed56d[_0xac4e('0x37')][_0xac4e('0x43')]+'%'};return _0x4b5923;})});}_0x5597e0=_['merge']({},_0x5597e0,_0x4ed56d[_0xac4e('0x4a')]);return _0x384c69['getTeams'](_0x5597e0);}})['then'](function(_0x1d9d21){if(_0x1d9d21){_0x412845=_0x1d9d21[_0xac4e('0x3d')];if(!_0x4ed56d['query'][_0xac4e('0x3e')](_0xac4e('0x59'))){_0x5597e0[_0xac4e('0x20')]=qs[_0xac4e('0x20')](_0x4ed56d[_0xac4e('0x37')][_0xac4e('0x20')]);_0x5597e0[_0xac4e('0x1e')]=qs[_0xac4e('0x1e')](_0x4ed56d[_0xac4e('0x37')][_0xac4e('0x1e')]);}return _0x384c69[_0xac4e('0x62')](_0x5597e0);}})[_0xac4e('0x27')](function(_0x4876f7){if(_0x4876f7){return _0x4876f7?{'count':_0x412845,'rows':_0x4876f7}:null;}})[_0xac4e('0x27')](respondWithResult(_0x1c81ba,null))['catch'](handleError(_0x1c81ba,null));};exports[_0xac4e('0x64')]=function(_0x223e07,_0x10aaad,_0x359eba){var _0x476474=_0x223e07[_0xac4e('0x4d')][_0xac4e('0x65')];return db[_0xac4e('0x63')][_0xac4e('0x47')]({'where':{'id':_0x476474},'attributes':['id'],'include':[{'model':db[_0xac4e('0x5b')],'as':'Agents','attributes':['id',_0xac4e('0x2f'),'online',_0xac4e('0x66'),'interface'],'raw':!![]}]})['then'](function(_0x31f224){if(_0x31f224){var _0x45eb16=_[_0xac4e('0x67')](_0x31f224,function(_0x334568){var _0x13a286=_0x334568['get']({'plain':!![]});return _0x13a286[_0xac4e('0x68')];});return db['OpenchannelQueue'][_0xac4e('0x4b')]({'where':{'id':_0x223e07[_0xac4e('0x54')]['id']}})[_0xac4e('0x27')](function(_0x28c17b){return db['sequelize'][_0xac4e('0x69')](function(_0x3ced9c){return _0x28c17b[_0xac4e('0x64')](_0x476474,{'transaction':_0x3ced9c})[_0xac4e('0x27')](function(){return BPromise[_0xac4e('0x6a')](_0x45eb16,function(_0x2f662d){return db['UserOpenchannelQueue'][_0xac4e('0x6b')]({'where':{'UserId':_0x2f662d['id'],'OpenchannelQueueId':_0x223e07['params']['id']},'transaction':_0x3ced9c});});})['then'](function(){_0x45eb16[_0xac4e('0x6c')](function(_0xc18ef2){socket['emit'](_0xac4e('0x6d'),{'UserId':_0xc18ef2['id'],'OpenchannelQueueId':_0x28c17b['id']});});});});});}})['then'](respondWithStatusCode(_0x10aaad,null))[_0xac4e('0x52')](handleError(_0x10aaad,null));};exports['removeTeams']=function(_0x45eb5e,_0x55d9b5,_0x544edd){return db[_0xac4e('0x63')][_0xac4e('0x47')]({'where':{'id':_0x45eb5e['query'][_0xac4e('0x65')]},'attributes':['id'],'include':[{'model':db[_0xac4e('0x5b')],'as':_0xac4e('0x68'),'attributes':['id'],'raw':!![]}]})[_0xac4e('0x27')](handleEntityNotFound(_0x55d9b5,null))['then'](function(_0x4bc2cd){var _0x503cfd=_[_0xac4e('0x30')](_0x4bc2cd,'id');var _0x2fcae2=[];var _0x5f4185=[];var _0x3f5d36=squel[_0xac4e('0x6e')]();_0x3f5d36[_0xac4e('0x6f')](_0xac4e('0x70'))[_0xac4e('0x71')](_0xac4e('0x72'),'tq')['join'](_0xac4e('0x73'),'ut',_0xac4e('0x74'))[_0xac4e('0x41')](_0xac4e('0x75'),_0x45eb5e[_0xac4e('0x54')]['id']);for(var _0x1ea500=0x0;_0x1ea500<_0x4bc2cd[_0xac4e('0x3d')];_0x1ea500+=0x1){let _0x1ff319=_0x4bc2cd[_0x1ea500];for(var _0x398b1e=0x0;_0x398b1e<_0x1ff319['Agents'][_0xac4e('0x3d')];_0x398b1e+=0x1){let _0x58e45c=_0x1ff319['Agents'][_0x398b1e];var _0x3214d9=_0x3f5d36[_0xac4e('0x76')]();_0x3214d9['where']('ut.UserId\x20=\x20?',_0x58e45c['id']);_0x5f4185[_0xac4e('0x77')](db[_0xac4e('0x78')][_0xac4e('0x37')](_0x3214d9['toString'](),{'type':db[_0xac4e('0x78')][_0xac4e('0x79')][_0xac4e('0x7a')]})['then'](function(_0x1bd804){if(_0x1bd804[_0xac4e('0x3d')]===0x1){return _0x58e45c['id'];}else{var _0xbed229=_[_0xac4e('0x7b')](_[_0xac4e('0x30')](_0x1bd804,'TeamId'),function(_0x55e8af){return _[_0xac4e('0x7c')](_0x503cfd,_0x55e8af);});if(_0xbed229){return _0x58e45c['id'];}}}));}}return BPromise[_0xac4e('0x7d')](_0x5f4185)[_0xac4e('0x27')](function(_0x2e988f){_0x2fcae2=_(_0x2fcae2)[_0xac4e('0x7e')](_0x2e988f)[_0xac4e('0x7f')]()['value']();return db['OpenchannelQueue'][_0xac4e('0x4b')]({'where':{'id':_0x45eb5e[_0xac4e('0x54')]['id']}})[_0xac4e('0x27')](function(_0x30c643){return db[_0xac4e('0x78')][_0xac4e('0x69')](function(_0x2b4ac1){return _0x30c643[_0xac4e('0x80')](_0x45eb5e[_0xac4e('0x37')][_0xac4e('0x65')],{'transaction':_0x2b4ac1})[_0xac4e('0x27')](function(){if(!_[_0xac4e('0x81')](_0x2fcae2)){return _0x30c643[_0xac4e('0x82')](_0x2fcae2,{'transaction':_0x2b4ac1});}})[_0xac4e('0x27')](function(){_0x2fcae2['forEach'](function(_0x2dab05){socket['emit'](_0xac4e('0x83'),{'UserId':_0x2dab05,'OpenchannelQueueId':_0x30c643['id']});});});});});});})[_0xac4e('0x27')](respondWithStatusCode(_0x55d9b5,null))[_0xac4e('0x52')](handleError(_0x55d9b5,null));};exports['addAgents']=function(_0x4b6f75,_0x160f84,_0x132c8e){return db[_0xac4e('0x31')][_0xac4e('0x4b')]({'where':{'id':_0x4b6f75[_0xac4e('0x54')]['id']}})[_0xac4e('0x27')](handleEntityNotFound(_0x160f84,null))[_0xac4e('0x27')](function(_0x48a450){if(_0x48a450){return _0x48a450[_0xac4e('0x84')](_0x4b6f75[_0xac4e('0x4d')][_0xac4e('0x65')],_[_0xac4e('0x85')](_0x4b6f75[_0xac4e('0x4d')],['ids','id'])||{})[_0xac4e('0x86')](function(_0x16f037){for(var _0x48dcd8=0x0;_0x48dcd8<_0x4b6f75[_0xac4e('0x4d')][_0xac4e('0x65')][_0xac4e('0x3d')];_0x48dcd8+=0x1){socket[_0xac4e('0x87')]('userOpenchannelQueue:save',{'UserId':Number(_0x4b6f75[_0xac4e('0x4d')][_0xac4e('0x65')][_0x48dcd8]),'OpenchannelQueueId':Number(_0x4b6f75[_0xac4e('0x54')]['id'])});}return _0x16f037;});}})[_0xac4e('0x27')](respondWithResult(_0x160f84,null))[_0xac4e('0x52')](handleError(_0x160f84,null));};exports[_0xac4e('0x82')]=function(_0x45169d,_0x4df8be,_0x44576b){return db[_0xac4e('0x31')][_0xac4e('0x4b')]({'where':{'id':_0x45169d['params']['id']}})[_0xac4e('0x27')](handleEntityNotFound(_0x4df8be,null))[_0xac4e('0x27')](function(_0x4908df){if(_0x4908df){return _0x4908df['removeAgents'](_0x45169d['query'][_0xac4e('0x65')])['then'](function(){if(_['isArray'](_0x45169d['query'][_0xac4e('0x65')])){for(var _0x36bfea=0x0;_0x36bfea<_0x45169d[_0xac4e('0x37')][_0xac4e('0x65')][_0xac4e('0x3d')];_0x36bfea+=0x1){socket['emit'](_0xac4e('0x83'),{'UserId':Number(_0x45169d[_0xac4e('0x37')][_0xac4e('0x65')][_0x36bfea]),'OpenchannelQueueId':Number(_0x45169d[_0xac4e('0x54')]['id'])});}}else{socket[_0xac4e('0x87')](_0xac4e('0x83'),{'UserId':Number(_0x45169d[_0xac4e('0x37')][_0xac4e('0x65')]),'OpenchannelQueueId':Number(_0x45169d['params']['id'])});}});}})[_0xac4e('0x27')](respondWithStatusCode(_0x4df8be,null))[_0xac4e('0x52')](handleError(_0x4df8be,null));};exports[_0xac4e('0x88')]=function(_0x168dff,_0x3639e6,_0x10ac22){var _0x4c74a0={};var _0x11a13f={};var _0x4105af;var _0x317eca;return db[_0xac4e('0x31')]['findOne']({'where':{'id':_0x168dff[_0xac4e('0x54')]['id']}})['then'](handleEntityNotFound(_0x3639e6,null))[_0xac4e('0x27')](function(_0x2099a0){if(_0x2099a0){_0x4105af=_0x2099a0;_0x11a13f[_0xac4e('0x36')]=_[_0xac4e('0x38')](db[_0xac4e('0x5b')][_0xac4e('0x32')]);_0x11a13f['query']=_[_0xac4e('0x38')](_0x168dff['query']);_0x11a13f[_0xac4e('0x39')]=_[_0xac4e('0x3a')](_0x11a13f[_0xac4e('0x36')],_0x11a13f['query']);_0x4c74a0[_0xac4e('0x3b')]=_[_0xac4e('0x3a')](_0x11a13f[_0xac4e('0x36')],qs['fields'](_0x168dff[_0xac4e('0x37')][_0xac4e('0x3c')]));_0x4c74a0['attributes']=_0x4c74a0[_0xac4e('0x3b')][_0xac4e('0x3d')]?_0x4c74a0[_0xac4e('0x3b')]:_0x11a13f[_0xac4e('0x36')];_0x4c74a0['order']=qs[_0xac4e('0x40')](_0x168dff[_0xac4e('0x37')][_0xac4e('0x40')]);_0x4c74a0['where']=qs[_0xac4e('0x39')](_[_0xac4e('0x42')](_0x168dff[_0xac4e('0x37')],_0x11a13f[_0xac4e('0x39')]));if(_0x168dff[_0xac4e('0x37')][_0xac4e('0x43')]){_0x4c74a0[_0xac4e('0x41')]=_[_0xac4e('0x44')](_0x4c74a0[_0xac4e('0x41')],{'$or':_[_0xac4e('0x30')](_0x4c74a0[_0xac4e('0x3b')],function(_0x1ba38b){var _0xb357a8={};_0xb357a8[_0x1ba38b]={'$like':'%'+_0x168dff[_0xac4e('0x37')][_0xac4e('0x43')]+'%'};return _0xb357a8;})});}_0x4c74a0=_['merge']({},_0x4c74a0,_0x168dff['options']);return _0x4105af[_0xac4e('0x88')](_0x4c74a0);}})[_0xac4e('0x27')](function(_0x263208){if(_0x263208){_0x317eca=_0x263208[_0xac4e('0x3d')];if(!_0x168dff[_0xac4e('0x37')][_0xac4e('0x3e')](_0xac4e('0x59'))){_0x4c74a0['limit']=qs['limit'](_0x168dff[_0xac4e('0x37')][_0xac4e('0x20')]);_0x4c74a0[_0xac4e('0x1e')]=qs[_0xac4e('0x1e')](_0x168dff[_0xac4e('0x37')]['offset']);}return _0x4105af[_0xac4e('0x88')](_0x4c74a0);}})[_0xac4e('0x27')](function(_0x6f2555){if(_0x6f2555){return _0x6f2555?{'count':_0x317eca,'rows':_0x6f2555}:null;}})[_0xac4e('0x27')](respondWithResult(_0x3639e6,null))['catch'](handleError(_0x3639e6,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index aa1a90a..76b10f8 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 _0x36a0=['exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x26c517,_0x16481a){var _0x4fe380=function(_0x231443){while(--_0x231443){_0x26c517['push'](_0x26c517['shift']());}};_0x4fe380(++_0x16481a);}(_0x36a0,0x83));var _0x036a=function(_0x400aee,_0x4f3c2b){_0x400aee=_0x400aee-0x0;var _0x40551d=_0x36a0[_0x400aee];return _0x40551d;};'use strict';var EventEmitter=require(_0x036a('0x0'));var OpenchannelQueue=require(_0x036a('0x1'))['db'][_0x036a('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x036a('0x3')](0x0);var events={'afterCreate':_0x036a('0x4'),'afterUpdate':_0x036a('0x5'),'afterDestroy':_0x036a('0x6')};function emitEvent(_0x1070f9){return function(_0x462c73,_0xee8195,_0x2888d1){OpenchannelQueueEvents[_0x036a('0x7')](_0x1070f9+':'+_0x462c73['id'],_0x462c73);OpenchannelQueueEvents[_0x036a('0x7')](_0x1070f9,_0x462c73);_0x2888d1(null);};}for(var e in events){if(events[_0x036a('0x8')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x036a('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xce24=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue'];(function(_0x2216fe,_0x53a04e){var _0x35510b=function(_0x29c1cc){while(--_0x29c1cc){_0x2216fe['push'](_0x2216fe['shift']());}};_0x35510b(++_0x53a04e);}(_0xce24,0xbb));var _0x4ce2=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xce24[_0x5447fd];return _0x15b28a;};'use strict';var EventEmitter=require(_0x4ce2('0x0'));var OpenchannelQueue=require(_0x4ce2('0x1'))['db'][_0x4ce2('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4ce2('0x3'),'afterUpdate':_0x4ce2('0x4'),'afterDestroy':_0x4ce2('0x5')};function emitEvent(_0x3e643a){return function(_0x5bc410,_0x2f8e43,_0x231364){OpenchannelQueueEvents[_0x4ce2('0x6')](_0x3e643a+':'+_0x5bc410['id'],_0x5bc410);OpenchannelQueueEvents[_0x4ce2('0x6')](_0x3e643a,_0x5bc410);_0x231364(null);};}for(var e in events){if(events[_0x4ce2('0x7')](e)){var event=events[e];OpenchannelQueue[_0x4ce2('0x8')](e,emitEvent(event));}}module[_0x4ce2('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 9fb5f81..ef929db 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 _0xb9dc=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelQueue.attributes','OpenchannelQueue','lodash'];(function(_0x33be9d,_0x41618e){var _0x4a9267=function(_0x4f0e70){while(--_0x4f0e70){_0x33be9d['push'](_0x33be9d['shift']());}};_0x4a9267(++_0x41618e);}(_0xb9dc,0xbd));var _0xcb9d=function(_0x1a5870,_0x2d5cfb){_0x1a5870=_0x1a5870-0x0;var _0x1cd614=_0xb9dc[_0x1a5870];return _0x1cd614;};'use strict';var _=require(_0xcb9d('0x0'));var util=require('util');var logger=require(_0xcb9d('0x1'))(_0xcb9d('0x2'));var moment=require(_0xcb9d('0x3'));var BPromise=require(_0xcb9d('0x4'));var rp=require(_0xcb9d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcb9d('0x6'));var config=require(_0xcb9d('0x7'));var attributes=require(_0xcb9d('0x8'));module['exports']=function(_0x2b54e3,_0x40d33a){return _0x2b54e3['define'](_0xcb9d('0x9'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ba1=['exports','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./openchannelQueue.attributes'];(function(_0x591e16,_0x5aefc1){var _0x543b35=function(_0x81e3be){while(--_0x81e3be){_0x591e16['push'](_0x591e16['shift']());}};_0x543b35(++_0x5aefc1);}(_0x3ba1,0x19a));var _0x13ba=function(_0x531bc7,_0x113e06){_0x531bc7=_0x531bc7-0x0;var _0x26547c=_0x3ba1[_0x531bc7];return _0x26547c;};'use strict';var _=require(_0x13ba('0x0'));var util=require(_0x13ba('0x1'));var logger=require(_0x13ba('0x2'))(_0x13ba('0x3'));var moment=require(_0x13ba('0x4'));var BPromise=require('bluebird');var rp=require(_0x13ba('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x13ba('0x6'));var config=require('../../config/environment');var attributes=require(_0x13ba('0x7'));module[_0x13ba('0x8')]=function(_0x5e4518,_0x26210b){return _0x5e4518['define'](_0x13ba('0x9'),attributes,{'tableName':_0x13ba('0xa'),'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 a7b3e44..d118cf2 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 _0x8ae2=['message','result','catch','OpenchannelQueue','findAll','options','raw','where','limit','include','map','model','attributes','GetOpenchannelQueue','find','ShowOpenchannelQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ae2,0x66));var _0x28ae=function(_0x5a6e02,_0x3d1739){_0x5a6e02=_0x5a6e02-0x0;var _0x1913e4=_0x8ae2[_0x5a6e02];return _0x1913e4;};'use strict';var _=require(_0x28ae('0x0'));var util=require('util');var moment=require(_0x28ae('0x1'));var BPromise=require(_0x28ae('0x2'));var rs=require(_0x28ae('0x3'));var fs=require('fs');var Redis=require(_0x28ae('0x4'));var db=require(_0x28ae('0x5'))['db'];var utils=require(_0x28ae('0x6'));var logger=require(_0x28ae('0x7'))(_0x28ae('0x8'));var config=require(_0x28ae('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x28ae('0xa')][_0x28ae('0xb')]({'port':0x232a});config['redis']=_[_0x28ae('0xc')](config[_0x28ae('0xd')],{'host':_0x28ae('0xe'),'port':0x18eb});var socket=require(_0x28ae('0xf'))(new Redis(config[_0x28ae('0xd')]));require('./openchannelQueue.socket')[_0x28ae('0x10')](socket);function respondWithRpcPromise(_0x3a1e24,_0x2cb0e5,_0x280e0f){return new BPromise(function(_0x37e1d4,_0x25c5ab){return client[_0x28ae('0x11')](_0x3a1e24,_0x280e0f)[_0x28ae('0x12')](function(_0x4ce311){logger[_0x28ae('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x2cb0e5,'request\x20sent');logger[_0x28ae('0x14')](_0x28ae('0x15'),_0x2cb0e5,_0x28ae('0x16'),JSON[_0x28ae('0x17')](_0x4ce311));if(_0x4ce311['error']){if(_0x4ce311[_0x28ae('0x18')][_0x28ae('0x19')]===0x1f4){logger['error'](_0x28ae('0x1a'),_0x2cb0e5,_0x4ce311[_0x28ae('0x18')][_0x28ae('0x1b')]);return _0x25c5ab(_0x4ce311[_0x28ae('0x18')]['message']);}logger[_0x28ae('0x18')](_0x28ae('0x1a'),_0x2cb0e5,_0x4ce311[_0x28ae('0x18')][_0x28ae('0x1b')]);return _0x37e1d4(_0x4ce311[_0x28ae('0x18')][_0x28ae('0x1b')]);}else{logger[_0x28ae('0x13')](_0x28ae('0x1a'),_0x2cb0e5,_0x28ae('0x16'));_0x37e1d4(_0x4ce311[_0x28ae('0x1c')][_0x28ae('0x1b')]);}})[_0x28ae('0x1d')](function(_0x4e1a4f){logger[_0x28ae('0x18')](_0x28ae('0x1a'),_0x2cb0e5,_0x4e1a4f);_0x25c5ab(_0x4e1a4f);});});}exports['GetOpenchannelQueue']=function(_0x3b2e7a){var _0x2a9872=this;return new Promise(function(_0x1c909d,_0x6590b1){return db[_0x28ae('0x1e')][_0x28ae('0x1f')]({'raw':_0x3b2e7a[_0x28ae('0x20')]?_0x3b2e7a[_0x28ae('0x20')][_0x28ae('0x21')]===undefined?!![]:![]:!![],'where':_0x3b2e7a[_0x28ae('0x20')]?_0x3b2e7a[_0x28ae('0x20')][_0x28ae('0x22')]||null:null,'attributes':_0x3b2e7a[_0x28ae('0x20')]?_0x3b2e7a['options']['attributes']||null:null,'limit':_0x3b2e7a['options']?_0x3b2e7a[_0x28ae('0x20')][_0x28ae('0x23')]||null:null,'include':_0x3b2e7a[_0x28ae('0x20')]?_0x3b2e7a['options'][_0x28ae('0x24')]?_[_0x28ae('0x25')](_0x3b2e7a[_0x28ae('0x20')]['include'],function(_0x25f9d3){return{'model':db[_0x25f9d3[_0x28ae('0x26')]],'as':_0x25f9d3['as'],'attributes':_0x25f9d3[_0x28ae('0x27')],'include':_0x25f9d3[_0x28ae('0x24')]?_[_0x28ae('0x25')](_0x25f9d3[_0x28ae('0x24')],function(_0x52a6a2){return{'model':db[_0x52a6a2['model']],'as':_0x52a6a2['as'],'attributes':_0x52a6a2['attributes'],'include':_0x52a6a2[_0x28ae('0x24')]?_[_0x28ae('0x25')](_0x52a6a2[_0x28ae('0x24')],function(_0x1e6717){return{'model':db[_0x1e6717[_0x28ae('0x26')]],'as':_0x1e6717['as'],'attributes':_0x1e6717[_0x28ae('0x27')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x59d448){logger[_0x28ae('0x13')](_0x28ae('0x28'),_0x3b2e7a);logger['debug'](_0x28ae('0x28'),_0x3b2e7a,JSON['stringify'](_0x59d448));_0x1c909d(_0x59d448);})[_0x28ae('0x1d')](function(_0x41a31b){logger[_0x28ae('0x18')](_0x28ae('0x28'),_0x41a31b[_0x28ae('0x1b')],_0x3b2e7a);_0x6590b1(_0x2a9872['error'](0x1f4,_0x41a31b[_0x28ae('0x1b')]));});});};exports['ShowOpenchannelQueue']=function(_0x3a9731){var _0x1a959f=this;return new Promise(function(_0x2baeca,_0x44405e){return db['OpenchannelQueue'][_0x28ae('0x29')]({'raw':_0x3a9731['options']?_0x3a9731[_0x28ae('0x20')][_0x28ae('0x21')]===undefined?!![]:![]:!![],'where':_0x3a9731[_0x28ae('0x20')]?_0x3a9731[_0x28ae('0x20')][_0x28ae('0x22')]||null:null,'attributes':_0x3a9731[_0x28ae('0x20')]?_0x3a9731[_0x28ae('0x20')][_0x28ae('0x27')]||null:null,'include':_0x3a9731[_0x28ae('0x20')]?_0x3a9731[_0x28ae('0x20')][_0x28ae('0x24')]?_['map'](_0x3a9731[_0x28ae('0x20')][_0x28ae('0x24')],function(_0x47f3d1){return{'model':db[_0x47f3d1['model']],'as':_0x47f3d1['as'],'attributes':_0x47f3d1[_0x28ae('0x27')],'include':_0x47f3d1[_0x28ae('0x24')]?_['map'](_0x47f3d1[_0x28ae('0x24')],function(_0x4a4d23){return{'model':db[_0x4a4d23['model']],'as':_0x4a4d23['as'],'attributes':_0x4a4d23[_0x28ae('0x27')],'include':_0x4a4d23['include']?_['map'](_0x4a4d23[_0x28ae('0x24')],function(_0x204fd9){return{'model':db[_0x204fd9['model']],'as':_0x204fd9['as'],'attributes':_0x204fd9[_0x28ae('0x27')]};}):[]};}):[]};}):[]:[]})[_0x28ae('0x12')](function(_0x506c73){logger[_0x28ae('0x13')](_0x28ae('0x2a'),_0x3a9731);logger[_0x28ae('0x14')](_0x28ae('0x2a'),_0x3a9731,JSON[_0x28ae('0x17')](_0x506c73));_0x2baeca(_0x506c73);})[_0x28ae('0x1d')](function(_0x5100bf){logger[_0x28ae('0x18')](_0x28ae('0x2a'),_0x5100bf[_0x28ae('0x1b')],_0x3a9731);_0x44405e(_0x1a959f['error'](0x1f4,_0x5100bf[_0x28ae('0x1b')]));});});}; \ No newline at end of file +var _0x631b=['http','defaults','redis','socket.io-emitter','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','catch','ShowOpenchannelQueue','find','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x183d5a,_0x2452d1){var _0x455fe8=function(_0x41fcc2){while(--_0x41fcc2){_0x183d5a['push'](_0x183d5a['shift']());}};_0x455fe8(++_0x2452d1);}(_0x631b,0xfb));var _0xb631=function(_0x5d9867,_0x5e9030){_0x5d9867=_0x5d9867-0x0;var _0x7d2118=_0x631b[_0x5d9867];return _0x7d2118;};'use strict';var _=require(_0xb631('0x0'));var util=require(_0xb631('0x1'));var moment=require('moment');var BPromise=require(_0xb631('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb631('0x3'));var db=require(_0xb631('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb631('0x5'))(_0xb631('0x6'));var config=require(_0xb631('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb631('0x8')]({'port':0x232a});config['redis']=_[_0xb631('0x9')](config[_0xb631('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xb631('0xb'))(new Redis(config[_0xb631('0xa')]));require('./openchannelQueue.socket')['register'](socket);function respondWithRpcPromise(_0x27b88b,_0x329f14,_0x47c10f){return new BPromise(function(_0x5256e0,_0x5ab00b){return client['request'](_0x27b88b,_0x47c10f)[_0xb631('0xc')](function(_0x34a85d){logger[_0xb631('0xd')](_0xb631('0xe'),_0x329f14,_0xb631('0xf'));logger['debug'](_0xb631('0x10'),_0x329f14,_0xb631('0xf'),JSON['stringify'](_0x34a85d));if(_0x34a85d['error']){if(_0x34a85d[_0xb631('0x11')][_0xb631('0x12')]===0x1f4){logger[_0xb631('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x329f14,_0x34a85d[_0xb631('0x11')][_0xb631('0x13')]);return _0x5ab00b(_0x34a85d[_0xb631('0x11')][_0xb631('0x13')]);}logger[_0xb631('0x11')](_0xb631('0xe'),_0x329f14,_0x34a85d[_0xb631('0x11')][_0xb631('0x13')]);return _0x5256e0(_0x34a85d['error'][_0xb631('0x13')]);}else{logger[_0xb631('0xd')](_0xb631('0xe'),_0x329f14,_0xb631('0xf'));_0x5256e0(_0x34a85d[_0xb631('0x14')][_0xb631('0x13')]);}})['catch'](function(_0x1f7821){logger[_0xb631('0x11')](_0xb631('0xe'),_0x329f14,_0x1f7821);_0x5ab00b(_0x1f7821);});});}exports[_0xb631('0x15')]=function(_0x48002e){var _0x1eb32f=this;return new Promise(function(_0x4a4cd2,_0x2bdfd2){return db[_0xb631('0x16')][_0xb631('0x17')]({'raw':_0x48002e['options']?_0x48002e[_0xb631('0x18')][_0xb631('0x19')]===undefined?!![]:![]:!![],'where':_0x48002e[_0xb631('0x18')]?_0x48002e['options'][_0xb631('0x1a')]||null:null,'attributes':_0x48002e['options']?_0x48002e[_0xb631('0x18')][_0xb631('0x1b')]||null:null,'limit':_0x48002e[_0xb631('0x18')]?_0x48002e[_0xb631('0x18')][_0xb631('0x1c')]||null:null,'include':_0x48002e['options']?_0x48002e[_0xb631('0x18')][_0xb631('0x1d')]?_[_0xb631('0x1e')](_0x48002e[_0xb631('0x18')][_0xb631('0x1d')],function(_0x23c604){return{'model':db[_0x23c604[_0xb631('0x1f')]],'as':_0x23c604['as'],'attributes':_0x23c604[_0xb631('0x1b')],'include':_0x23c604[_0xb631('0x1d')]?_['map'](_0x23c604['include'],function(_0x2105ca){return{'model':db[_0x2105ca[_0xb631('0x1f')]],'as':_0x2105ca['as'],'attributes':_0x2105ca[_0xb631('0x1b')],'include':_0x2105ca['include']?_[_0xb631('0x1e')](_0x2105ca[_0xb631('0x1d')],function(_0x4610d6){return{'model':db[_0x4610d6[_0xb631('0x1f')]],'as':_0x4610d6['as'],'attributes':_0x4610d6[_0xb631('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2308fc){logger['info'](_0xb631('0x15'),_0x48002e);logger[_0xb631('0x20')](_0xb631('0x15'),_0x48002e,JSON[_0xb631('0x21')](_0x2308fc));_0x4a4cd2(_0x2308fc);})[_0xb631('0x22')](function(_0x226412){logger['error']('GetOpenchannelQueue',_0x226412[_0xb631('0x13')],_0x48002e);_0x2bdfd2(_0x1eb32f['error'](0x1f4,_0x226412[_0xb631('0x13')]));});});};exports[_0xb631('0x23')]=function(_0x126911){var _0x4341b8=this;return new Promise(function(_0x458b1c,_0x3f3992){return db['OpenchannelQueue'][_0xb631('0x24')]({'raw':_0x126911[_0xb631('0x18')]?_0x126911[_0xb631('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x126911[_0xb631('0x18')]?_0x126911[_0xb631('0x18')][_0xb631('0x1a')]||null:null,'attributes':_0x126911[_0xb631('0x18')]?_0x126911[_0xb631('0x18')][_0xb631('0x1b')]||null:null,'include':_0x126911[_0xb631('0x18')]?_0x126911[_0xb631('0x18')][_0xb631('0x1d')]?_['map'](_0x126911[_0xb631('0x18')][_0xb631('0x1d')],function(_0x2019e7){return{'model':db[_0x2019e7[_0xb631('0x1f')]],'as':_0x2019e7['as'],'attributes':_0x2019e7[_0xb631('0x1b')],'include':_0x2019e7[_0xb631('0x1d')]?_['map'](_0x2019e7['include'],function(_0x1c3fdb){return{'model':db[_0x1c3fdb['model']],'as':_0x1c3fdb['as'],'attributes':_0x1c3fdb[_0xb631('0x1b')],'include':_0x1c3fdb[_0xb631('0x1d')]?_[_0xb631('0x1e')](_0x1c3fdb[_0xb631('0x1d')],function(_0x45501b){return{'model':db[_0x45501b['model']],'as':_0x45501b['as'],'attributes':_0x45501b[_0xb631('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb631('0xc')](function(_0xde3bc3){logger[_0xb631('0xd')](_0xb631('0x23'),_0x126911);logger[_0xb631('0x20')](_0xb631('0x23'),_0x126911,JSON[_0xb631('0x21')](_0xde3bc3));_0x458b1c(_0xde3bc3);})[_0xb631('0x22')](function(_0x39bf6b){logger[_0xb631('0x11')](_0xb631('0x23'),_0x39bf6b['message'],_0x126911);_0x3f3992(_0x4341b8['error'](0x1f4,_0x39bf6b[_0xb631('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 3281a62..3f117ba 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 _0x064b=['update','emit','removeListener','register','length','openchannelQueue:','./openchannelQueue.events','save'];(function(_0x338442,_0x1974d1){var _0x11179b=function(_0x5bd177){while(--_0x5bd177){_0x338442['push'](_0x338442['shift']());}};_0x11179b(++_0x1974d1);}(_0x064b,0xa6));var _0xb064=function(_0x3c5cee,_0x2639ef){_0x3c5cee=_0x3c5cee-0x0;var _0x5d7064=_0x064b[_0x3c5cee];return _0x5d7064;};'use strict';var OpenchannelQueueEvents=require(_0xb064('0x0'));var events=[_0xb064('0x1'),'remove',_0xb064('0x2')];function createListener(_0x2f91ab,_0xe6825f){return function(_0x431b33){_0xe6825f[_0xb064('0x3')](_0x2f91ab,_0x431b33);};}function removeListener(_0x5067f4,_0x2ca61b){return function(){OpenchannelQueueEvents[_0xb064('0x4')](_0x5067f4,_0x2ca61b);};}exports[_0xb064('0x5')]=function(_0x4267b){for(var _0x4cdc64=0x0,_0x39b81d=events[_0xb064('0x6')];_0x4cdc64<_0x39b81d;_0x4cdc64++){var _0x18ad3b=events[_0x4cdc64];var _0x670e9=createListener(_0xb064('0x7')+_0x18ad3b,_0x4267b);OpenchannelQueueEvents['on'](_0x18ad3b,_0x670e9);}}; \ No newline at end of file +var _0x713c=['emit','length','openchannelQueue:','./openchannelQueue.events','save','remove'];(function(_0x4ee70f,_0x3bfa86){var _0x11a56c=function(_0x16ef0c){while(--_0x16ef0c){_0x4ee70f['push'](_0x4ee70f['shift']());}};_0x11a56c(++_0x3bfa86);}(_0x713c,0x195));var _0xc713=function(_0x5afbca,_0x136662){_0x5afbca=_0x5afbca-0x0;var _0x2bddce=_0x713c[_0x5afbca];return _0x2bddce;};'use strict';var OpenchannelQueueEvents=require(_0xc713('0x0'));var events=[_0xc713('0x1'),_0xc713('0x2'),'update'];function createListener(_0x3884da,_0xc8d616){return function(_0x30eb15){_0xc8d616[_0xc713('0x3')](_0x3884da,_0x30eb15);};}function removeListener(_0x462908,_0x3cac36){return function(){OpenchannelQueueEvents['removeListener'](_0x462908,_0x3cac36);};}exports['register']=function(_0x4470bb){for(var _0x20310b=0x0,_0x2f4c80=events[_0xc713('0x4')];_0x20310b<_0x2f4c80;_0x20310b++){var _0x387b37=events[_0x20310b];var _0x2dd06d=createListener(_0xc713('0x5')+_0x387b37,_0x4470bb);OpenchannelQueueEvents['on'](_0x387b37,_0x2dd06d);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index b32fd8a..90b4da0 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 _0xeaeb=['describe','/:id','show','post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelQueueReport.controller','isAuthenticated','index','get','/describe'];(function(_0x1da42f,_0x23dc53){var _0x458c83=function(_0x16eb14){while(--_0x16eb14){_0x1da42f['push'](_0x1da42f['shift']());}};_0x458c83(++_0x23dc53);}(_0xeaeb,0x1ec));var _0xbeae=function(_0x85d56d,_0x37f5c1){_0x85d56d=_0x85d56d-0x0;var _0x51f613=_0xeaeb[_0x85d56d];return _0x51f613;};'use strict';var multer=require(_0xbeae('0x0'));var util=require(_0xbeae('0x1'));var path=require('path');var timeout=require(_0xbeae('0x2'));var express=require(_0xbeae('0x3'));var router=express[_0xbeae('0x4')]();var fs_extra=require(_0xbeae('0x5'));var auth=require(_0xbeae('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbeae('0x7'));router['get']('/',auth[_0xbeae('0x8')](),controller[_0xbeae('0x9')]);router[_0xbeae('0xa')](_0xbeae('0xb'),auth['isAuthenticated'](),controller[_0xbeae('0xc')]);router[_0xbeae('0xa')](_0xbeae('0xd'),auth['isAuthenticated'](),controller[_0xbeae('0xe')]);router[_0xbeae('0xf')]('/',auth['isAuthenticated'](),controller[_0xbeae('0x10')]);router[_0xbeae('0x11')](_0xbeae('0xd'),auth[_0xbeae('0x8')](),controller[_0xbeae('0x12')]);router[_0xbeae('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xbeae('0x14')]=router; \ No newline at end of file +var _0x24d5=['isAuthenticated','/describe','describe','/:id','show','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x569ede,_0x24c203){var _0x2d39c9=function(_0x5491e5){while(--_0x5491e5){_0x569ede['push'](_0x569ede['shift']());}};_0x2d39c9(++_0x24c203);}(_0x24d5,0xbc));var _0x524d=function(_0x512889,_0x4b242e){_0x512889=_0x512889-0x0;var _0x34789e=_0x24d5[_0x512889];return _0x34789e;};'use strict';var multer=require(_0x524d('0x0'));var util=require(_0x524d('0x1'));var path=require(_0x524d('0x2'));var timeout=require('connect-timeout');var express=require(_0x524d('0x3'));var router=express[_0x524d('0x4')]();var fs_extra=require(_0x524d('0x5'));var auth=require(_0x524d('0x6'));var interaction=require(_0x524d('0x7'));var config=require(_0x524d('0x8'));var controller=require('./openchannelQueueReport.controller');router[_0x524d('0x9')]('/',auth[_0x524d('0xa')](),controller['index']);router[_0x524d('0x9')](_0x524d('0xb'),auth[_0x524d('0xa')](),controller[_0x524d('0xc')]);router['get'](_0x524d('0xd'),auth[_0x524d('0xa')](),controller[_0x524d('0xe')]);router['post']('/',auth[_0x524d('0xa')](),controller['create']);router['put'](_0x524d('0xd'),auth['isAuthenticated'](),controller[_0x524d('0xf')]);router[_0x524d('0x10')](_0x524d('0xd'),auth[_0x524d('0xa')](),controller['destroy']);module[_0x524d('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 20faa54..747827f 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 _0xecc6=['sequelize','exports','STRING','DATE'];(function(_0x5ae776,_0x2a6480){var _0x49751d=function(_0x46d175){while(--_0x46d175){_0x5ae776['push'](_0x5ae776['shift']());}};_0x49751d(++_0x2a6480);}(_0xecc6,0x148));var _0x6ecc=function(_0x2721ec,_0x501561){_0x2721ec=_0x2721ec-0x0;var _0x440a36=_0xecc6[_0x2721ec];return _0x440a36;};'use strict';var moment=require('moment');var Sequelize=require(_0x6ecc('0x0'));module[_0x6ecc('0x1')]={'uniqueid':{'type':Sequelize[_0x6ecc('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x6ecc('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x6ecc('0x3')]},'exitAt':{'type':Sequelize[_0x6ecc('0x3')]},'reason':{'type':Sequelize[_0x6ecc('0x2')]}}; \ No newline at end of file +var _0xb51c=['exports','STRING','DATE','moment','sequelize'];(function(_0x1679cf,_0xa72ba3){var _0x8cf151=function(_0x114eb5){while(--_0x114eb5){_0x1679cf['push'](_0x1679cf['shift']());}};_0x8cf151(++_0xa72ba3);}(_0xb51c,0x1c5));var _0xcb51=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xb51c[_0x1035c1];return _0x308d67;};'use strict';var moment=require(_0xcb51('0x0'));var Sequelize=require(_0xcb51('0x1'));module[_0xcb51('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xcb51('0x3')]},'joinAt':{'type':Sequelize[_0xcb51('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xcb51('0x4')]},'reason':{'type':Sequelize[_0xcb51('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 63e71d4..9ba8478 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 _0x8561=['describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','stack','name','map','OpenchannelQueueReport','rawAttributes','fieldName','type','model','filters','intersection','attributes','fields','query','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','destroy'];(function(_0x3a946c,_0x38e13c){var _0x41bd2e=function(_0x453a76){while(--_0x453a76){_0x3a946c['push'](_0x3a946c['shift']());}};_0x41bd2e(++_0x38e13c);}(_0x8561,0x1b7));var _0x1856=function(_0x248d46,_0xba08ec){_0x248d46=_0x248d46-0x0;var _0x354942=_0x8561[_0x248d46];return _0x354942;};'use strict';var emlformat=require(_0x1856('0x0'));var rimraf=require(_0x1856('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1856('0x2'));var rp=require('request-promise');var moment=require(_0x1856('0x3'));var BPromise=require(_0x1856('0x4'));var Mustache=require(_0x1856('0x5'));var util=require(_0x1856('0x6'));var path=require(_0x1856('0x7'));var sox=require(_0x1856('0x8'));var csv=require(_0x1856('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1856('0xa'));var crypto=require(_0x1856('0xb'));var jsforce=require(_0x1856('0xc'));var deskjs=require(_0x1856('0xd'));var toCsv=require(_0x1856('0x9'));var querystring=require(_0x1856('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1856('0xf'));var qs=require(_0x1856('0x10'));var as=require(_0x1856('0x11'));var hardwareService=require(_0x1856('0x12'));var logger=require(_0x1856('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x1856('0x14'));var licenseUtil=require(_0x1856('0x15'));var db=require(_0x1856('0x16'))['db'];function respondWithStatusCode(_0x116838,_0x13e329){_0x13e329=_0x13e329||0xcc;return function(_0x49dca5){if(_0x49dca5){return _0x116838[_0x1856('0x17')](_0x13e329);}return _0x116838[_0x1856('0x18')](_0x13e329)[_0x1856('0x19')]();};}function respondWithResult(_0x44a81d,_0x2b00d5){_0x2b00d5=_0x2b00d5||0xc8;return function(_0x5e80f8){if(_0x5e80f8){return _0x44a81d[_0x1856('0x18')](_0x2b00d5)[_0x1856('0x1a')](_0x5e80f8);}};}function respondWithFilteredResult(_0xbaa1f5,_0x8ddf46){return function(_0x29407a){if(_0x29407a){var _0x659158=typeof _0x8ddf46[_0x1856('0x1b')]==='undefined'&&typeof _0x8ddf46[_0x1856('0x1c')]===_0x1856('0x1d');var _0x17a06e=_0x29407a[_0x1856('0x1e')];var _0x442f5a=_0x659158?0x0:_0x8ddf46[_0x1856('0x1b')];var _0x23fa10=_0x659158?_0x29407a['count']:_0x8ddf46['offset']+_0x8ddf46[_0x1856('0x1c')];var _0x416891;if(_0x23fa10>=_0x17a06e){_0x23fa10=_0x17a06e;_0x416891=0xc8;}else{_0x416891=0xce;}_0xbaa1f5[_0x1856('0x18')](_0x416891);return _0xbaa1f5[_0x1856('0x1f')](_0x1856('0x20'),_0x442f5a+'-'+_0x23fa10+'/'+_0x17a06e)[_0x1856('0x1a')](_0x29407a);}return null;};}function patchUpdates(_0x134007){return function(_0x4cf2ab){try{jsonpatch[_0x1856('0x21')](_0x4cf2ab,_0x134007,!![]);}catch(_0x5801ae){return BPromise[_0x1856('0x22')](_0x5801ae);}return _0x4cf2ab[_0x1856('0x23')]();};}function saveUpdates(_0x31d325,_0x35aeec){return function(_0x2d8ac3){if(_0x2d8ac3){return _0x2d8ac3[_0x1856('0x24')](_0x31d325)[_0x1856('0x25')](function(_0x56dbbc){return _0x56dbbc;});}return null;};}function removeEntity(_0x821664,_0x3623b4){return function(_0x2b9f5c){if(_0x2b9f5c){return _0x2b9f5c['destroy']()['then'](function(){_0x821664[_0x1856('0x18')](0xcc)[_0x1856('0x19')]();});}};}function handleEntityNotFound(_0x15e7f7,_0x150669){return function(_0x54d45b){if(!_0x54d45b){_0x15e7f7['sendStatus'](0x194);}return _0x54d45b;};}function handleError(_0x17985a,_0xbb316f){_0xbb316f=_0xbb316f||0x1f4;return function(_0x389db1){logger['error'](_0x389db1[_0x1856('0x26')]);if(_0x389db1[_0x1856('0x27')]){delete _0x389db1['name'];}_0x17985a['status'](_0xbb316f)['send'](_0x389db1);};}exports['index']=function(_0x1547ab,_0x2785c2){var _0x3f58a6={},_0xc2d9b0={},_0x5ac8e9={'count':0x0,'rows':[]};var _0x3b02b6=_[_0x1856('0x28')](db[_0x1856('0x29')][_0x1856('0x2a')],function(_0x75c33a){return{'name':_0x75c33a[_0x1856('0x2b')],'type':_0x75c33a[_0x1856('0x2c')]['key']};});_0xc2d9b0[_0x1856('0x2d')]=_[_0x1856('0x28')](_0x3b02b6,'name');_0xc2d9b0['query']=_['keys'](_0x1547ab['query']);_0xc2d9b0[_0x1856('0x2e')]=_[_0x1856('0x2f')](_0xc2d9b0[_0x1856('0x2d')],_0xc2d9b0['query']);_0x3f58a6[_0x1856('0x30')]=_[_0x1856('0x2f')](_0xc2d9b0['model'],qs[_0x1856('0x31')](_0x1547ab[_0x1856('0x32')][_0x1856('0x31')]));_0x3f58a6[_0x1856('0x30')]=_0x3f58a6[_0x1856('0x30')][_0x1856('0x33')]?_0x3f58a6[_0x1856('0x30')]:_0xc2d9b0['model'];if(!_0x1547ab[_0x1856('0x32')][_0x1856('0x34')]('nolimit')){_0x3f58a6['limit']=qs[_0x1856('0x1c')](_0x1547ab[_0x1856('0x32')]['limit']);_0x3f58a6['offset']=qs[_0x1856('0x1b')](_0x1547ab[_0x1856('0x32')][_0x1856('0x1b')]);}_0x3f58a6[_0x1856('0x35')]=qs['sort'](_0x1547ab['query'][_0x1856('0x36')]);_0x3f58a6[_0x1856('0x37')]=qs['filters'](_[_0x1856('0x38')](_0x1547ab[_0x1856('0x32')],_0xc2d9b0[_0x1856('0x2e')]),_0x3b02b6);if(_0x1547ab[_0x1856('0x32')]['filter']){_0x3f58a6[_0x1856('0x37')]=_[_0x1856('0x39')](_0x3f58a6[_0x1856('0x37')],{'$or':_[_0x1856('0x28')](_0x3b02b6,function(_0x2e6e49){if(_0x2e6e49['type']!=='VIRTUAL'){var _0x263568={};_0x263568[_0x2e6e49[_0x1856('0x27')]]={'$like':'%'+_0x1547ab[_0x1856('0x32')][_0x1856('0x3a')]+'%'};return _0x263568;}})});}_0x3f58a6=_[_0x1856('0x39')]({},_0x3f58a6,_0x1547ab[_0x1856('0x3b')]);var _0x3173a5={'where':_0x3f58a6[_0x1856('0x37')]};return db[_0x1856('0x29')][_0x1856('0x1e')](_0x3173a5)[_0x1856('0x25')](function(_0x27232d){_0x5ac8e9['count']=_0x27232d;if(_0x1547ab[_0x1856('0x32')][_0x1856('0x3c')]){_0x3f58a6[_0x1856('0x3d')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x1856('0x3e')](_0x3f58a6);})['then'](function(_0x594010){_0x5ac8e9[_0x1856('0x3f')]=_0x594010;return _0x5ac8e9;})[_0x1856('0x25')](respondWithFilteredResult(_0x2785c2,_0x3f58a6))[_0x1856('0x40')](handleError(_0x2785c2,null));};exports[_0x1856('0x41')]=function(_0x464e03,_0x1dd5d7){var _0x2f32bd={'raw':!![],'where':{'id':_0x464e03[_0x1856('0x42')]['id']}},_0x2e4d89={};_0x2e4d89[_0x1856('0x2d')]=_[_0x1856('0x43')](db['OpenchannelQueueReport'][_0x1856('0x2a')]);_0x2e4d89[_0x1856('0x32')]=_['keys'](_0x464e03[_0x1856('0x32')]);_0x2e4d89[_0x1856('0x2e')]=_['intersection'](_0x2e4d89[_0x1856('0x2d')],_0x2e4d89[_0x1856('0x32')]);_0x2f32bd[_0x1856('0x30')]=_[_0x1856('0x2f')](_0x2e4d89[_0x1856('0x2d')],qs[_0x1856('0x31')](_0x464e03['query'][_0x1856('0x31')]));_0x2f32bd[_0x1856('0x30')]=_0x2f32bd['attributes']['length']?_0x2f32bd['attributes']:_0x2e4d89['model'];if(_0x464e03[_0x1856('0x32')][_0x1856('0x3c')]){_0x2f32bd[_0x1856('0x3d')]=[{'all':!![]}];}_0x2f32bd=_['merge']({},_0x2f32bd,_0x464e03[_0x1856('0x3b')]);return db['OpenchannelQueueReport'][_0x1856('0x44')](_0x2f32bd)[_0x1856('0x25')](handleEntityNotFound(_0x1dd5d7,null))['then'](respondWithResult(_0x1dd5d7,null))['catch'](handleError(_0x1dd5d7,null));};exports[_0x1856('0x45')]=function(_0x257436,_0x160412){return db[_0x1856('0x29')][_0x1856('0x45')](_0x257436[_0x1856('0x46')],{})[_0x1856('0x25')](respondWithResult(_0x160412,0xc9))[_0x1856('0x40')](handleError(_0x160412,null));};exports[_0x1856('0x24')]=function(_0x572490,_0x1a16fb){if(_0x572490[_0x1856('0x46')]['id']){delete _0x572490[_0x1856('0x46')]['id'];}return db[_0x1856('0x29')]['find']({'where':{'id':_0x572490['params']['id']}})[_0x1856('0x25')](handleEntityNotFound(_0x1a16fb,null))['then'](saveUpdates(_0x572490[_0x1856('0x46')],null))[_0x1856('0x25')](respondWithResult(_0x1a16fb,null))['catch'](handleError(_0x1a16fb,null));};exports[_0x1856('0x47')]=function(_0x5e0ac8,_0x3f1e83){return db[_0x1856('0x29')][_0x1856('0x44')]({'where':{'id':_0x5e0ac8['params']['id']}})[_0x1856('0x25')](handleEntityNotFound(_0x3f1e83,null))[_0x1856('0x25')](removeEntity(_0x3f1e83,null))[_0x1856('0x40')](handleError(_0x3f1e83,null));};exports[_0x1856('0x48')]=function(_0x390499,_0x4fb1aa){return db[_0x1856('0x29')]['describe']()['then'](respondWithResult(_0x4fb1aa,null))[_0x1856('0x40')](handleError(_0x4fb1aa,null));}; \ No newline at end of file +var _0x0e82=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','json','reject','save','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','OpenchannelQueueReport','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util'];(function(_0x447fee,_0x3d5d93){var _0x3baa77=function(_0x415708){while(--_0x415708){_0x447fee['push'](_0x447fee['shift']());}};_0x3baa77(++_0x3d5d93);}(_0x0e82,0x198));var _0x20e8=function(_0x455ac0,_0x1d5f16){_0x455ac0=_0x455ac0-0x0;var _0xfb9257=_0x0e82[_0x455ac0];return _0xfb9257;};'use strict';var emlformat=require(_0x20e8('0x0'));var rimraf=require(_0x20e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x20e8('0x2'));var rp=require(_0x20e8('0x3'));var moment=require('moment');var BPromise=require(_0x20e8('0x4'));var Mustache=require('mustache');var util=require(_0x20e8('0x5'));var path=require('path');var sox=require(_0x20e8('0x6'));var csv=require(_0x20e8('0x7'));var ejs=require(_0x20e8('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x20e8('0x9'));var squel=require(_0x20e8('0xa'));var crypto=require(_0x20e8('0xb'));var jsforce=require(_0x20e8('0xc'));var deskjs=require(_0x20e8('0xd'));var toCsv=require(_0x20e8('0x7'));var querystring=require('querystring');var Papa=require(_0x20e8('0xe'));var Redis=require(_0x20e8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x20e8('0x10'));var as=require(_0x20e8('0x11'));var hardwareService=require(_0x20e8('0x12'));var logger=require(_0x20e8('0x13'))(_0x20e8('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x20e8('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x533279,_0x1175e2){_0x1175e2=_0x1175e2||0xcc;return function(_0x4cad8c){if(_0x4cad8c){return _0x533279[_0x20e8('0x16')](_0x1175e2);}return _0x533279[_0x20e8('0x17')](_0x1175e2)[_0x20e8('0x18')]();};}function respondWithResult(_0x225f7a,_0x3bc521){_0x3bc521=_0x3bc521||0xc8;return function(_0x597156){if(_0x597156){return _0x225f7a[_0x20e8('0x17')](_0x3bc521)['json'](_0x597156);}};}function respondWithFilteredResult(_0x3cfbd2,_0x3107a1){return function(_0x3a346f){if(_0x3a346f){var _0x32c924=typeof _0x3107a1[_0x20e8('0x19')]===_0x20e8('0x1a')&&typeof _0x3107a1[_0x20e8('0x1b')]===_0x20e8('0x1a');var _0x4adf64=_0x3a346f[_0x20e8('0x1c')];var _0x339bbd=_0x32c924?0x0:_0x3107a1[_0x20e8('0x19')];var _0xa16b99=_0x32c924?_0x3a346f[_0x20e8('0x1c')]:_0x3107a1[_0x20e8('0x19')]+_0x3107a1[_0x20e8('0x1b')];var _0x1c0ef8;if(_0xa16b99>=_0x4adf64){_0xa16b99=_0x4adf64;_0x1c0ef8=0xc8;}else{_0x1c0ef8=0xce;}_0x3cfbd2['status'](_0x1c0ef8);return _0x3cfbd2['set']('Content-Range',_0x339bbd+'-'+_0xa16b99+'/'+_0x4adf64)[_0x20e8('0x1d')](_0x3a346f);}return null;};}function patchUpdates(_0x4b35eb){return function(_0x1ddc51){try{jsonpatch['apply'](_0x1ddc51,_0x4b35eb,!![]);}catch(_0x4d6281){return BPromise[_0x20e8('0x1e')](_0x4d6281);}return _0x1ddc51[_0x20e8('0x1f')]();};}function saveUpdates(_0x5002aa,_0x55ad22){return function(_0x1ad2e6){if(_0x1ad2e6){return _0x1ad2e6[_0x20e8('0x20')](_0x5002aa)[_0x20e8('0x21')](function(_0x230279){return _0x230279;});}return null;};}function removeEntity(_0x4d00e2,_0x4cb999){return function(_0x2a9730){if(_0x2a9730){return _0x2a9730[_0x20e8('0x22')]()['then'](function(){_0x4d00e2['status'](0xcc)[_0x20e8('0x18')]();});}};}function handleEntityNotFound(_0x1d50e3,_0x590e1b){return function(_0x1feba9){if(!_0x1feba9){_0x1d50e3[_0x20e8('0x16')](0x194);}return _0x1feba9;};}function handleError(_0x5b5497,_0x2f6fe4){_0x2f6fe4=_0x2f6fe4||0x1f4;return function(_0x11aa39){logger['error'](_0x11aa39[_0x20e8('0x23')]);if(_0x11aa39[_0x20e8('0x24')]){delete _0x11aa39[_0x20e8('0x24')];}_0x5b5497['status'](_0x2f6fe4)['send'](_0x11aa39);};}exports[_0x20e8('0x25')]=function(_0x241309,_0x4f70d4){var _0x28dd2b={},_0x3444bf={},_0x16193e={'count':0x0,'rows':[]};var _0x30e870=_[_0x20e8('0x26')](db['OpenchannelQueueReport'][_0x20e8('0x27')],function(_0x4f5590){return{'name':_0x4f5590[_0x20e8('0x28')],'type':_0x4f5590[_0x20e8('0x29')][_0x20e8('0x2a')]};});_0x3444bf[_0x20e8('0x2b')]=_[_0x20e8('0x26')](_0x30e870,'name');_0x3444bf[_0x20e8('0x2c')]=_[_0x20e8('0x2d')](_0x241309[_0x20e8('0x2c')]);_0x3444bf[_0x20e8('0x2e')]=_[_0x20e8('0x2f')](_0x3444bf[_0x20e8('0x2b')],_0x3444bf['query']);_0x28dd2b[_0x20e8('0x30')]=_['intersection'](_0x3444bf['model'],qs[_0x20e8('0x31')](_0x241309[_0x20e8('0x2c')]['fields']));_0x28dd2b['attributes']=_0x28dd2b[_0x20e8('0x30')]['length']?_0x28dd2b[_0x20e8('0x30')]:_0x3444bf[_0x20e8('0x2b')];if(!_0x241309[_0x20e8('0x2c')]['hasOwnProperty'](_0x20e8('0x32'))){_0x28dd2b['limit']=qs['limit'](_0x241309['query'][_0x20e8('0x1b')]);_0x28dd2b[_0x20e8('0x19')]=qs[_0x20e8('0x19')](_0x241309[_0x20e8('0x2c')]['offset']);}_0x28dd2b['order']=qs['sort'](_0x241309[_0x20e8('0x2c')][_0x20e8('0x33')]);_0x28dd2b['where']=qs[_0x20e8('0x2e')](_[_0x20e8('0x34')](_0x241309[_0x20e8('0x2c')],_0x3444bf[_0x20e8('0x2e')]),_0x30e870);if(_0x241309[_0x20e8('0x2c')][_0x20e8('0x35')]){_0x28dd2b[_0x20e8('0x36')]=_[_0x20e8('0x37')](_0x28dd2b['where'],{'$or':_[_0x20e8('0x26')](_0x30e870,function(_0x28d1f7){if(_0x28d1f7[_0x20e8('0x29')]!==_0x20e8('0x38')){var _0x266edd={};_0x266edd[_0x28d1f7[_0x20e8('0x24')]]={'$like':'%'+_0x241309[_0x20e8('0x2c')][_0x20e8('0x35')]+'%'};return _0x266edd;}})});}_0x28dd2b=_[_0x20e8('0x37')]({},_0x28dd2b,_0x241309[_0x20e8('0x39')]);var _0x45ec2a={'where':_0x28dd2b[_0x20e8('0x36')]};return db['OpenchannelQueueReport'][_0x20e8('0x1c')](_0x45ec2a)['then'](function(_0x1e0f27){_0x16193e[_0x20e8('0x1c')]=_0x1e0f27;if(_0x241309['query'][_0x20e8('0x3a')]){_0x28dd2b[_0x20e8('0x3b')]=[{'all':!![]}];}return db[_0x20e8('0x3c')][_0x20e8('0x3d')](_0x28dd2b);})[_0x20e8('0x21')](function(_0x1ede94){_0x16193e[_0x20e8('0x3e')]=_0x1ede94;return _0x16193e;})[_0x20e8('0x21')](respondWithFilteredResult(_0x4f70d4,_0x28dd2b))[_0x20e8('0x3f')](handleError(_0x4f70d4,null));};exports[_0x20e8('0x40')]=function(_0xa02a5a,_0x515fec){var _0x1062c2={'raw':!![],'where':{'id':_0xa02a5a[_0x20e8('0x41')]['id']}},_0x46eef9={};_0x46eef9[_0x20e8('0x2b')]=_[_0x20e8('0x2d')](db[_0x20e8('0x3c')]['rawAttributes']);_0x46eef9[_0x20e8('0x2c')]=_[_0x20e8('0x2d')](_0xa02a5a[_0x20e8('0x2c')]);_0x46eef9[_0x20e8('0x2e')]=_['intersection'](_0x46eef9['model'],_0x46eef9[_0x20e8('0x2c')]);_0x1062c2[_0x20e8('0x30')]=_[_0x20e8('0x2f')](_0x46eef9['model'],qs['fields'](_0xa02a5a['query'][_0x20e8('0x31')]));_0x1062c2['attributes']=_0x1062c2[_0x20e8('0x30')]['length']?_0x1062c2['attributes']:_0x46eef9['model'];if(_0xa02a5a['query'][_0x20e8('0x3a')]){_0x1062c2['include']=[{'all':!![]}];}_0x1062c2=_[_0x20e8('0x37')]({},_0x1062c2,_0xa02a5a[_0x20e8('0x39')]);return db[_0x20e8('0x3c')][_0x20e8('0x42')](_0x1062c2)[_0x20e8('0x21')](handleEntityNotFound(_0x515fec,null))[_0x20e8('0x21')](respondWithResult(_0x515fec,null))[_0x20e8('0x3f')](handleError(_0x515fec,null));};exports[_0x20e8('0x43')]=function(_0x5b987b,_0x1ec673){return db[_0x20e8('0x3c')][_0x20e8('0x43')](_0x5b987b[_0x20e8('0x44')],{})[_0x20e8('0x21')](respondWithResult(_0x1ec673,0xc9))[_0x20e8('0x3f')](handleError(_0x1ec673,null));};exports['update']=function(_0x2d8eb8,_0xc4bca6){if(_0x2d8eb8[_0x20e8('0x44')]['id']){delete _0x2d8eb8[_0x20e8('0x44')]['id'];}return db[_0x20e8('0x3c')][_0x20e8('0x42')]({'where':{'id':_0x2d8eb8[_0x20e8('0x41')]['id']}})[_0x20e8('0x21')](handleEntityNotFound(_0xc4bca6,null))[_0x20e8('0x21')](saveUpdates(_0x2d8eb8[_0x20e8('0x44')],null))[_0x20e8('0x21')](respondWithResult(_0xc4bca6,null))[_0x20e8('0x3f')](handleError(_0xc4bca6,null));};exports[_0x20e8('0x22')]=function(_0xa69a5,_0xdc24c3){return db[_0x20e8('0x3c')][_0x20e8('0x42')]({'where':{'id':_0xa69a5[_0x20e8('0x41')]['id']}})['then'](handleEntityNotFound(_0xdc24c3,null))[_0x20e8('0x21')](removeEntity(_0xdc24c3,null))[_0x20e8('0x3f')](handleError(_0xdc24c3,null));};exports['describe']=function(_0x24e5f0,_0x1be616){return db[_0x20e8('0x3c')]['describe']()[_0x20e8('0x21')](respondWithResult(_0x1be616,null))['catch'](handleError(_0x1be616,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 30e5b9c..b9feb14 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x17f117,_0x5144c6){var _0x50d150=function(_0x36e70f){while(--_0x36e70f){_0x17f117['push'](_0x17f117['shift']());}};_0x50d150(++_0x5144c6);}(_0x1261,0x144));var _0x1126=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0x1261[_0x432fca];return _0x3adba4;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x814b,0x1a2));var _0xb814=function(_0x14090e,_0x30c2f7){_0x14090e=_0x14090e-0x0;var _0x554da7=_0x814b[_0x14090e];return _0x554da7;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index d229bba..6248265 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 _0xae60=['rpc','jayson/promise','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xae60,0x1c7));var _0x0ae6=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xae60[_0x3070dc];return _0x431489;};'use strict';var _=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var moment=require(_0x0ae6('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ae6('0x3'));var fs=require('fs');var Redis=require(_0x0ae6('0x4'));var db=require(_0x0ae6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0ae6('0x6'))(_0x0ae6('0x7'));var config=require('../../config/environment');var jayson=require(_0x0ae6('0x8'));var client=jayson[_0x0ae6('0x9')][_0x0ae6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46fed4,_0xbb596c,_0x447a1d){return new BPromise(function(_0x120910,_0x1b5e80){return client['request'](_0x46fed4,_0x447a1d)[_0x0ae6('0xb')](function(_0x36a5e0){logger[_0x0ae6('0xc')](_0x0ae6('0xd'),_0xbb596c,'request\x20sent');logger[_0x0ae6('0xe')](_0x0ae6('0xf'),_0xbb596c,_0x0ae6('0x10'),JSON[_0x0ae6('0x11')](_0x36a5e0));if(_0x36a5e0[_0x0ae6('0x12')]){if(_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x13')]===0x1f4){logger[_0x0ae6('0x12')](_0x0ae6('0xd'),_0xbb596c,_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);return _0x1b5e80(_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);}logger[_0x0ae6('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xbb596c,_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);return _0x120910(_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);}else{logger[_0x0ae6('0xc')](_0x0ae6('0xd'),_0xbb596c,_0x0ae6('0x10'));_0x120910(_0x36a5e0[_0x0ae6('0x15')][_0x0ae6('0x14')]);}})[_0x0ae6('0x16')](function(_0x8a4c9a){logger[_0x0ae6('0x12')](_0x0ae6('0xd'),_0xbb596c,_0x8a4c9a);_0x1b5e80(_0x8a4c9a);});});}exports[_0x0ae6('0x17')]=function(_0xda4f01){var _0x3f5c41=this;return new Promise(function(_0x2fdf25,_0x1735ba){return db[_0x0ae6('0x18')][_0x0ae6('0x19')](_0xda4f01[_0x0ae6('0x1a')],{'raw':_0xda4f01[_0x0ae6('0x1b')]?_0xda4f01['options'][_0x0ae6('0x1c')]===undefined?!![]:![]:!![]})[_0x0ae6('0xb')](function(_0x140a3b){logger[_0x0ae6('0xc')](_0x0ae6('0x17'),_0xda4f01);logger[_0x0ae6('0xe')](_0x0ae6('0x17'),_0xda4f01,JSON[_0x0ae6('0x11')](_0x140a3b));_0x2fdf25(_0x140a3b);})['catch'](function(_0x39b22e){logger[_0x0ae6('0x12')](_0x0ae6('0x17'),_0x39b22e[_0x0ae6('0x14')],_0xda4f01);_0x1735ba(_0x3f5c41[_0x0ae6('0x12')](0x1f4,_0x39b22e['message']));});});};exports[_0x0ae6('0x1d')]=function(_0x4e1242){var _0xccd1c5=this;return new Promise(function(_0x3955d8,_0x3c43d8){return db[_0x0ae6('0x18')]['update'](_0x4e1242[_0x0ae6('0x1a')],{'raw':_0x4e1242[_0x0ae6('0x1b')]?_0x4e1242['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e1242[_0x0ae6('0x1b')]?_0x4e1242[_0x0ae6('0x1b')][_0x0ae6('0x1e')]||null:null,'attributes':_0x4e1242['options']?_0x4e1242[_0x0ae6('0x1b')][_0x0ae6('0x1f')]||null:null,'limit':_0x4e1242[_0x0ae6('0x1b')]?_0x4e1242['options'][_0x0ae6('0x20')]||null:null})[_0x0ae6('0xb')](function(_0x449c33){logger[_0x0ae6('0xc')](_0x0ae6('0x1d'),_0x4e1242);logger[_0x0ae6('0xe')]('UpdateOpenchannelQueueReport',_0x4e1242,JSON['stringify'](_0x449c33));_0x3955d8(_0x449c33);})[_0x0ae6('0x16')](function(_0x419384){logger['error']('UpdateOpenchannelQueueReport',_0x419384[_0x0ae6('0x14')],_0x4e1242);_0x3c43d8(_0xccd1c5[_0x0ae6('0x12')](0x1f4,_0x419384[_0x0ae6('0x14')]));});});}; \ No newline at end of file +var _0x06ef=['rpc','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','code','message','result','catch','OpenchannelQueueReport,\x20%s,\x20%s','body','options','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','raw','where','attributes','limit','moment','../../config/utils','../../config/logger'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x06ef,0x185));var _0xf06e=function(_0x32cada,_0x3374f0){_0x32cada=_0x32cada-0x0;var _0x1319d6=_0x06ef[_0x32cada];return _0x1319d6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf06e('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf06e('0x1'));var logger=require(_0xf06e('0x2'))(_0xf06e('0x3'));var config=require('../../config/environment');var jayson=require(_0xf06e('0x4'));var client=jayson[_0xf06e('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59b74b,_0x4e05dc,_0x5cddf1){return new BPromise(function(_0x4ccbee,_0x25b56e){return client[_0xf06e('0x6')](_0x59b74b,_0x5cddf1)[_0xf06e('0x7')](function(_0x2bb08c){logger[_0xf06e('0x8')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4e05dc,_0xf06e('0x9'));logger[_0xf06e('0xa')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x4e05dc,_0xf06e('0x9'),JSON[_0xf06e('0xb')](_0x2bb08c));if(_0x2bb08c[_0xf06e('0xc')]){if(_0x2bb08c[_0xf06e('0xc')][_0xf06e('0xd')]===0x1f4){logger[_0xf06e('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4e05dc,_0x2bb08c[_0xf06e('0xc')][_0xf06e('0xe')]);return _0x25b56e(_0x2bb08c['error'][_0xf06e('0xe')]);}logger[_0xf06e('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4e05dc,_0x2bb08c['error']['message']);return _0x4ccbee(_0x2bb08c[_0xf06e('0xc')][_0xf06e('0xe')]);}else{logger[_0xf06e('0x8')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4e05dc,_0xf06e('0x9'));_0x4ccbee(_0x2bb08c[_0xf06e('0xf')][_0xf06e('0xe')]);}})[_0xf06e('0x10')](function(_0x44157a){logger[_0xf06e('0xc')](_0xf06e('0x11'),_0x4e05dc,_0x44157a);_0x25b56e(_0x44157a);});});}exports['CreateOpenchannelQueueReport']=function(_0x380c07){var _0x55dabf=this;return new Promise(function(_0x251c9f,_0x7a9f4b){return db['OpenchannelQueueReport']['create'](_0x380c07[_0xf06e('0x12')],{'raw':_0x380c07[_0xf06e('0x13')]?_0x380c07['options']['raw']===undefined?!![]:![]:!![]})[_0xf06e('0x7')](function(_0x211590){logger[_0xf06e('0x8')]('CreateOpenchannelQueueReport',_0x380c07);logger[_0xf06e('0xa')](_0xf06e('0x14'),_0x380c07,JSON['stringify'](_0x211590));_0x251c9f(_0x211590);})[_0xf06e('0x10')](function(_0x1ba130){logger[_0xf06e('0xc')]('CreateOpenchannelQueueReport',_0x1ba130[_0xf06e('0xe')],_0x380c07);_0x7a9f4b(_0x55dabf[_0xf06e('0xc')](0x1f4,_0x1ba130[_0xf06e('0xe')]));});});};exports[_0xf06e('0x15')]=function(_0x3b410e){var _0x4c2d01=this;return new Promise(function(_0x3a969c,_0x4923d3){return db[_0xf06e('0x16')][_0xf06e('0x17')](_0x3b410e[_0xf06e('0x12')],{'raw':_0x3b410e[_0xf06e('0x13')]?_0x3b410e[_0xf06e('0x13')][_0xf06e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b410e['options']?_0x3b410e[_0xf06e('0x13')][_0xf06e('0x19')]||null:null,'attributes':_0x3b410e[_0xf06e('0x13')]?_0x3b410e[_0xf06e('0x13')][_0xf06e('0x1a')]||null:null,'limit':_0x3b410e['options']?_0x3b410e[_0xf06e('0x13')][_0xf06e('0x1b')]||null:null})[_0xf06e('0x7')](function(_0x89a74f){logger[_0xf06e('0x8')](_0xf06e('0x15'),_0x3b410e);logger['debug'](_0xf06e('0x15'),_0x3b410e,JSON[_0xf06e('0xb')](_0x89a74f));_0x3a969c(_0x89a74f);})[_0xf06e('0x10')](function(_0x5d21f7){logger[_0xf06e('0xc')](_0xf06e('0x15'),_0x5d21f7[_0xf06e('0xe')],_0x3b410e);_0x4923d3(_0x4c2d01[_0xf06e('0xc')](0x1f4,_0x5d21f7[_0xf06e('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 3e0d0d3..b73fd38 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 _0x4199=['fs-extra','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x364322,_0x1644c6){var _0x1517e5=function(_0x4e118f){while(--_0x4e118f){_0x364322['push'](_0x364322['shift']());}};_0x1517e5(++_0x1644c6);}(_0x4199,0x86));var _0x9419=function(_0x5d2796,_0x3e2234){_0x5d2796=_0x5d2796-0x0;var _0x4ea88a=_0x4199[_0x5d2796];return _0x4ea88a;};'use strict';var multer=require(_0x9419('0x0'));var util=require(_0x9419('0x1'));var path=require(_0x9419('0x2'));var timeout=require(_0x9419('0x3'));var express=require(_0x9419('0x4'));var router=express[_0x9419('0x5')]();var fs_extra=require(_0x9419('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9419('0x7'));var config=require(_0x9419('0x8'));var controller=require(_0x9419('0x9'));router[_0x9419('0xa')]('/',auth[_0x9419('0xb')](),controller['index']);router[_0x9419('0xa')](_0x9419('0xc'),auth[_0x9419('0xb')](),controller[_0x9419('0xd')]);router[_0x9419('0xa')](_0x9419('0xe'),auth[_0x9419('0xb')](),controller[_0x9419('0xf')]);router['post']('/',auth[_0x9419('0xb')](),controller[_0x9419('0x10')]);router[_0x9419('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x9419('0x12')]);router['delete'](_0x9419('0xe'),auth[_0x9419('0xb')](),controller['destroy']);module[_0x9419('0x13')]=router; \ No newline at end of file +var _0xc7c5=['/:id','show','post','put','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','isAuthenticated','index','/describe','get'];(function(_0xf46af5,_0x3c7713){var _0x3caa8e=function(_0x763a71){while(--_0x763a71){_0xf46af5['push'](_0xf46af5['shift']());}};_0x3caa8e(++_0x3c7713);}(_0xc7c5,0x1c8));var _0x5c7c=function(_0x16d163,_0x193f3b){_0x16d163=_0x16d163-0x0;var _0x440a6d=_0xc7c5[_0x16d163];return _0x440a6d;};'use strict';var multer=require(_0x5c7c('0x0'));var util=require(_0x5c7c('0x1'));var path=require('path');var timeout=require(_0x5c7c('0x2'));var express=require(_0x5c7c('0x3'));var router=express[_0x5c7c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5c7c('0x5'));var interaction=require(_0x5c7c('0x6'));var config=require('../../config/environment');var controller=require(_0x5c7c('0x7'));router['get']('/',auth[_0x5c7c('0x8')](),controller[_0x5c7c('0x9')]);router['get'](_0x5c7c('0xa'),auth[_0x5c7c('0x8')](),controller['describe']);router[_0x5c7c('0xb')](_0x5c7c('0xc'),auth[_0x5c7c('0x8')](),controller[_0x5c7c('0xd')]);router[_0x5c7c('0xe')]('/',auth[_0x5c7c('0x8')](),controller['create']);router[_0x5c7c('0xf')]('/:id',auth[_0x5c7c('0x8')](),controller['update']);router['delete'](_0x5c7c('0xc'),auth['isAuthenticated'](),controller[_0x5c7c('0x10')]);module[_0x5c7c('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 54a6f31..06bed0b 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x4cc42f,_0x3c0a63){var _0x2e6df9=function(_0x2b9456){while(--_0x2b9456){_0x4cc42f['push'](_0x4cc42f['shift']());}};_0x2e6df9(++_0x3c0a63);}(_0x008c,0x188));var _0xc008=function(_0x3e4566,_0x1e02e2){_0x3e4566=_0x3e4566-0x0;var _0x2eb60f=_0x008c[_0x3e4566];return _0x2eb60f;};'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 +var _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x25e6d1,_0xdaa915){var _0x486c24=function(_0x3bb3ea){while(--_0x3bb3ea){_0x25e6d1['push'](_0x25e6d1['shift']());}};_0x486c24(++_0xdaa915);}(_0x4b84,0x1cc));var _0x44b8=function(_0x2ddfd9,_0x5877d0){_0x2ddfd9=_0x2ddfd9-0x0;var _0x2668f0=_0x4b84[_0x2ddfd9];return _0x2668f0;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index e2b758d..e8eb7a0 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 _0x8b50=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','then','destroy','error','stack','name','index','map','OpenchannelTransferReport','rawAttributes','fieldName','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','options','includeAll','include','rows','catch','show','params','keys','create','body','find','describe','eml-format','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x8b50,0x1ea));var _0x08b5=function(_0x124c3d,_0x5e6e47){_0x124c3d=_0x124c3d-0x0;var _0x2ef0a6=_0x8b50[_0x124c3d];return _0x2ef0a6;};'use strict';var emlformat=require(_0x08b5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x08b5('0x1'));var rp=require('request-promise');var moment=require(_0x08b5('0x2'));var BPromise=require(_0x08b5('0x3'));var Mustache=require('mustache');var util=require(_0x08b5('0x4'));var path=require(_0x08b5('0x5'));var sox=require(_0x08b5('0x6'));var csv=require(_0x08b5('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x08b5('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x08b5('0x9'));var jsforce=require(_0x08b5('0xa'));var deskjs=require(_0x08b5('0xb'));var toCsv=require(_0x08b5('0x7'));var querystring=require(_0x08b5('0xc'));var Papa=require(_0x08b5('0xd'));var Redis=require(_0x08b5('0xe'));var authService=require(_0x08b5('0xf'));var qs=require(_0x08b5('0x10'));var as=require(_0x08b5('0x11'));var hardwareService=require(_0x08b5('0x12'));var logger=require(_0x08b5('0x13'))(_0x08b5('0x14'));var utils=require('../../config/utils');var config=require(_0x08b5('0x15'));var licenseUtil=require(_0x08b5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc039d5,_0x350a79){_0x350a79=_0x350a79||0xcc;return function(_0x3c7fd9){if(_0x3c7fd9){return _0xc039d5[_0x08b5('0x17')](_0x350a79);}return _0xc039d5[_0x08b5('0x18')](_0x350a79)[_0x08b5('0x19')]();};}function respondWithResult(_0x5e6448,_0x261da9){_0x261da9=_0x261da9||0xc8;return function(_0xf0553a){if(_0xf0553a){return _0x5e6448[_0x08b5('0x18')](_0x261da9)[_0x08b5('0x1a')](_0xf0553a);}};}function respondWithFilteredResult(_0x23790d,_0x2dbf9c){return function(_0x3fab9d){if(_0x3fab9d){var _0x1c7e9b=typeof _0x2dbf9c[_0x08b5('0x1b')]===_0x08b5('0x1c')&&typeof _0x2dbf9c[_0x08b5('0x1d')]===_0x08b5('0x1c');var _0x5182b9=_0x3fab9d[_0x08b5('0x1e')];var _0x5c89a1=_0x1c7e9b?0x0:_0x2dbf9c[_0x08b5('0x1b')];var _0x24fc57=_0x1c7e9b?_0x3fab9d[_0x08b5('0x1e')]:_0x2dbf9c[_0x08b5('0x1b')]+_0x2dbf9c[_0x08b5('0x1d')];var _0x485049;if(_0x24fc57>=_0x5182b9){_0x24fc57=_0x5182b9;_0x485049=0xc8;}else{_0x485049=0xce;}_0x23790d['status'](_0x485049);return _0x23790d['set']('Content-Range',_0x5c89a1+'-'+_0x24fc57+'/'+_0x5182b9)['json'](_0x3fab9d);}return null;};}function patchUpdates(_0x2d0ce6){return function(_0x54cb0a){try{jsonpatch[_0x08b5('0x1f')](_0x54cb0a,_0x2d0ce6,!![]);}catch(_0x44cb32){return BPromise[_0x08b5('0x20')](_0x44cb32);}return _0x54cb0a['save']();};}function saveUpdates(_0x80d132,_0x4021b3){return function(_0x4f12da){if(_0x4f12da){return _0x4f12da[_0x08b5('0x21')](_0x80d132)[_0x08b5('0x22')](function(_0x2c6a68){return _0x2c6a68;});}return null;};}function removeEntity(_0xbc0e36,_0x1a02dc){return function(_0x27c971){if(_0x27c971){return _0x27c971[_0x08b5('0x23')]()[_0x08b5('0x22')](function(){_0xbc0e36[_0x08b5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x63ae13,_0x5ef3b6){return function(_0x416802){if(!_0x416802){_0x63ae13[_0x08b5('0x17')](0x194);}return _0x416802;};}function handleError(_0xce55b,_0x13fd77){_0x13fd77=_0x13fd77||0x1f4;return function(_0x41e969){logger[_0x08b5('0x24')](_0x41e969[_0x08b5('0x25')]);if(_0x41e969[_0x08b5('0x26')]){delete _0x41e969['name'];}_0xce55b[_0x08b5('0x18')](_0x13fd77)['send'](_0x41e969);};}exports[_0x08b5('0x27')]=function(_0x5312c9,_0xeb7618){var _0x322311={},_0x2ccab1={},_0x45dac9={'count':0x0,'rows':[]};var _0xb1aef6=_[_0x08b5('0x28')](db[_0x08b5('0x29')][_0x08b5('0x2a')],function(_0xe795b3){return{'name':_0xe795b3[_0x08b5('0x2b')],'type':_0xe795b3['type'][_0x08b5('0x2c')]};});_0x2ccab1[_0x08b5('0x2d')]=_[_0x08b5('0x28')](_0xb1aef6,_0x08b5('0x26'));_0x2ccab1[_0x08b5('0x2e')]=_['keys'](_0x5312c9['query']);_0x2ccab1['filters']=_['intersection'](_0x2ccab1['model'],_0x2ccab1[_0x08b5('0x2e')]);_0x322311[_0x08b5('0x2f')]=_[_0x08b5('0x30')](_0x2ccab1[_0x08b5('0x2d')],qs[_0x08b5('0x31')](_0x5312c9[_0x08b5('0x2e')][_0x08b5('0x31')]));_0x322311[_0x08b5('0x2f')]=_0x322311['attributes'][_0x08b5('0x32')]?_0x322311['attributes']:_0x2ccab1['model'];if(!_0x5312c9['query'][_0x08b5('0x33')](_0x08b5('0x34'))){_0x322311[_0x08b5('0x1d')]=qs[_0x08b5('0x1d')](_0x5312c9[_0x08b5('0x2e')][_0x08b5('0x1d')]);_0x322311[_0x08b5('0x1b')]=qs[_0x08b5('0x1b')](_0x5312c9[_0x08b5('0x2e')][_0x08b5('0x1b')]);}_0x322311[_0x08b5('0x35')]=qs[_0x08b5('0x36')](_0x5312c9['query'][_0x08b5('0x36')]);_0x322311[_0x08b5('0x37')]=qs['filters'](_['pick'](_0x5312c9['query'],_0x2ccab1[_0x08b5('0x38')]),_0xb1aef6);if(_0x5312c9['query'][_0x08b5('0x39')]){_0x322311[_0x08b5('0x37')]=_[_0x08b5('0x3a')](_0x322311[_0x08b5('0x37')],{'$or':_['map'](_0xb1aef6,function(_0x1b5f34){if(_0x1b5f34[_0x08b5('0x3b')]!=='VIRTUAL'){var _0x4e8e17={};_0x4e8e17[_0x1b5f34['name']]={'$like':'%'+_0x5312c9[_0x08b5('0x2e')][_0x08b5('0x39')]+'%'};return _0x4e8e17;}})});}_0x322311=_[_0x08b5('0x3a')]({},_0x322311,_0x5312c9[_0x08b5('0x3c')]);var _0x2a1d4f={'where':_0x322311[_0x08b5('0x37')]};return db[_0x08b5('0x29')][_0x08b5('0x1e')](_0x2a1d4f)[_0x08b5('0x22')](function(_0x435091){_0x45dac9[_0x08b5('0x1e')]=_0x435091;if(_0x5312c9[_0x08b5('0x2e')][_0x08b5('0x3d')]){_0x322311[_0x08b5('0x3e')]=[{'all':!![]}];}return db[_0x08b5('0x29')]['findAll'](_0x322311);})['then'](function(_0x2461d3){_0x45dac9[_0x08b5('0x3f')]=_0x2461d3;return _0x45dac9;})[_0x08b5('0x22')](respondWithFilteredResult(_0xeb7618,_0x322311))[_0x08b5('0x40')](handleError(_0xeb7618,null));};exports[_0x08b5('0x41')]=function(_0x2866b9,_0x5932f1){var _0x56e133={'raw':!![],'where':{'id':_0x2866b9[_0x08b5('0x42')]['id']}},_0x1e8450={};_0x1e8450[_0x08b5('0x2d')]=_[_0x08b5('0x43')](db[_0x08b5('0x29')]['rawAttributes']);_0x1e8450[_0x08b5('0x2e')]=_[_0x08b5('0x43')](_0x2866b9[_0x08b5('0x2e')]);_0x1e8450[_0x08b5('0x38')]=_[_0x08b5('0x30')](_0x1e8450[_0x08b5('0x2d')],_0x1e8450[_0x08b5('0x2e')]);_0x56e133[_0x08b5('0x2f')]=_[_0x08b5('0x30')](_0x1e8450[_0x08b5('0x2d')],qs[_0x08b5('0x31')](_0x2866b9['query'][_0x08b5('0x31')]));_0x56e133['attributes']=_0x56e133[_0x08b5('0x2f')]['length']?_0x56e133[_0x08b5('0x2f')]:_0x1e8450[_0x08b5('0x2d')];if(_0x2866b9[_0x08b5('0x2e')]['includeAll']){_0x56e133[_0x08b5('0x3e')]=[{'all':!![]}];}_0x56e133=_[_0x08b5('0x3a')]({},_0x56e133,_0x2866b9['options']);return db[_0x08b5('0x29')]['find'](_0x56e133)[_0x08b5('0x22')](handleEntityNotFound(_0x5932f1,null))[_0x08b5('0x22')](respondWithResult(_0x5932f1,null))[_0x08b5('0x40')](handleError(_0x5932f1,null));};exports[_0x08b5('0x44')]=function(_0x113014,_0x3cbb2b){return db[_0x08b5('0x29')][_0x08b5('0x44')](_0x113014[_0x08b5('0x45')],{})['then'](respondWithResult(_0x3cbb2b,0xc9))[_0x08b5('0x40')](handleError(_0x3cbb2b,null));};exports[_0x08b5('0x21')]=function(_0x1b5426,_0xe1a4e5){if(_0x1b5426[_0x08b5('0x45')]['id']){delete _0x1b5426[_0x08b5('0x45')]['id'];}return db[_0x08b5('0x29')]['find']({'where':{'id':_0x1b5426[_0x08b5('0x42')]['id']}})[_0x08b5('0x22')](handleEntityNotFound(_0xe1a4e5,null))['then'](saveUpdates(_0x1b5426['body'],null))[_0x08b5('0x22')](respondWithResult(_0xe1a4e5,null))[_0x08b5('0x40')](handleError(_0xe1a4e5,null));};exports['destroy']=function(_0x49ab3a,_0x161461){return db[_0x08b5('0x29')][_0x08b5('0x46')]({'where':{'id':_0x49ab3a[_0x08b5('0x42')]['id']}})[_0x08b5('0x22')](handleEntityNotFound(_0x161461,null))[_0x08b5('0x22')](removeEntity(_0x161461,null))['catch'](handleError(_0x161461,null));};exports[_0x08b5('0x47')]=function(_0x190e76,_0x4e5384){return db[_0x08b5('0x29')][_0x08b5('0x47')]()['then'](respondWithResult(_0x4e5384,null))[_0x08b5('0x40')](handleError(_0x4e5384,null));}; \ No newline at end of file +var _0xf5cd=['../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','save','update','then','error','stack','name','send','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','catch','show','params','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util'];(function(_0x4a2ad0,_0x5c6748){var _0xa448b=function(_0x5cc882){while(--_0x5cc882){_0x4a2ad0['push'](_0x4a2ad0['shift']());}};_0xa448b(++_0x5c6748);}(_0xf5cd,0x1bf));var _0xdf5c=function(_0x32c054,_0x4da5c0){_0x32c054=_0x32c054-0x0;var _0x2227e0=_0xf5cd[_0x32c054];return _0x2227e0;};'use strict';var emlformat=require(_0xdf5c('0x0'));var rimraf=require(_0xdf5c('0x1'));var zipdir=require(_0xdf5c('0x2'));var jsonpatch=require(_0xdf5c('0x3'));var rp=require(_0xdf5c('0x4'));var moment=require(_0xdf5c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdf5c('0x6'));var util=require(_0xdf5c('0x7'));var path=require(_0xdf5c('0x8'));var sox=require(_0xdf5c('0x9'));var csv=require(_0xdf5c('0xa'));var ejs=require(_0xdf5c('0xb'));var fs=require('fs');var fs_extra=require(_0xdf5c('0xc'));var _=require(_0xdf5c('0xd'));var squel=require(_0xdf5c('0xe'));var crypto=require(_0xdf5c('0xf'));var jsforce=require(_0xdf5c('0x10'));var deskjs=require(_0xdf5c('0x11'));var toCsv=require(_0xdf5c('0xa'));var querystring=require(_0xdf5c('0x12'));var Papa=require(_0xdf5c('0x13'));var Redis=require('ioredis');var authService=require(_0xdf5c('0x14'));var qs=require(_0xdf5c('0x15'));var as=require(_0xdf5c('0x16'));var hardwareService=require(_0xdf5c('0x17'));var logger=require(_0xdf5c('0x18'))(_0xdf5c('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdf5c('0x1a'));var db=require(_0xdf5c('0x1b'))['db'];function respondWithStatusCode(_0x5809a5,_0x285569){_0x285569=_0x285569||0xcc;return function(_0x3f3c5f){if(_0x3f3c5f){return _0x5809a5[_0xdf5c('0x1c')](_0x285569);}return _0x5809a5[_0xdf5c('0x1d')](_0x285569)[_0xdf5c('0x1e')]();};}function respondWithResult(_0x460647,_0x32e112){_0x32e112=_0x32e112||0xc8;return function(_0x3c9728){if(_0x3c9728){return _0x460647[_0xdf5c('0x1d')](_0x32e112)['json'](_0x3c9728);}};}function respondWithFilteredResult(_0x436b88,_0x12a546){return function(_0x3d6ebc){if(_0x3d6ebc){var _0xc0889f=typeof _0x12a546['offset']===_0xdf5c('0x1f')&&typeof _0x12a546[_0xdf5c('0x20')]===_0xdf5c('0x1f');var _0x392aea=_0x3d6ebc[_0xdf5c('0x21')];var _0x41b922=_0xc0889f?0x0:_0x12a546[_0xdf5c('0x22')];var _0x5b2981=_0xc0889f?_0x3d6ebc['count']:_0x12a546[_0xdf5c('0x22')]+_0x12a546[_0xdf5c('0x20')];var _0x32e211;if(_0x5b2981>=_0x392aea){_0x5b2981=_0x392aea;_0x32e211=0xc8;}else{_0x32e211=0xce;}_0x436b88[_0xdf5c('0x1d')](_0x32e211);return _0x436b88['set'](_0xdf5c('0x23'),_0x41b922+'-'+_0x5b2981+'/'+_0x392aea)[_0xdf5c('0x24')](_0x3d6ebc);}return null;};}function patchUpdates(_0x1bcbc9){return function(_0x88ae31){try{jsonpatch[_0xdf5c('0x25')](_0x88ae31,_0x1bcbc9,!![]);}catch(_0x4c7b94){return BPromise['reject'](_0x4c7b94);}return _0x88ae31[_0xdf5c('0x26')]();};}function saveUpdates(_0x547fae,_0x297cd2){return function(_0x18e8d9){if(_0x18e8d9){return _0x18e8d9[_0xdf5c('0x27')](_0x547fae)[_0xdf5c('0x28')](function(_0x1e8c1d){return _0x1e8c1d;});}return null;};}function removeEntity(_0x390a3c,_0x937403){return function(_0x2af965){if(_0x2af965){return _0x2af965['destroy']()[_0xdf5c('0x28')](function(){_0x390a3c[_0xdf5c('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9cc31,_0x32f8b3){return function(_0x52deb9){if(!_0x52deb9){_0x9cc31[_0xdf5c('0x1c')](0x194);}return _0x52deb9;};}function handleError(_0x1035ed,_0x18fe30){_0x18fe30=_0x18fe30||0x1f4;return function(_0x43e432){logger[_0xdf5c('0x29')](_0x43e432[_0xdf5c('0x2a')]);if(_0x43e432['name']){delete _0x43e432[_0xdf5c('0x2b')];}_0x1035ed['status'](_0x18fe30)[_0xdf5c('0x2c')](_0x43e432);};}exports['index']=function(_0x7ebb52,_0x18b627){var _0x48ec5d={},_0xf07b12={},_0x1c448d={'count':0x0,'rows':[]};var _0x28dd38=_[_0xdf5c('0x2d')](db[_0xdf5c('0x2e')][_0xdf5c('0x2f')],function(_0x23c64a){return{'name':_0x23c64a[_0xdf5c('0x30')],'type':_0x23c64a[_0xdf5c('0x31')][_0xdf5c('0x32')]};});_0xf07b12[_0xdf5c('0x33')]=_[_0xdf5c('0x2d')](_0x28dd38,'name');_0xf07b12[_0xdf5c('0x34')]=_[_0xdf5c('0x35')](_0x7ebb52[_0xdf5c('0x34')]);_0xf07b12[_0xdf5c('0x36')]=_[_0xdf5c('0x37')](_0xf07b12[_0xdf5c('0x33')],_0xf07b12[_0xdf5c('0x34')]);_0x48ec5d['attributes']=_[_0xdf5c('0x37')](_0xf07b12['model'],qs[_0xdf5c('0x38')](_0x7ebb52[_0xdf5c('0x34')][_0xdf5c('0x38')]));_0x48ec5d[_0xdf5c('0x39')]=_0x48ec5d[_0xdf5c('0x39')][_0xdf5c('0x3a')]?_0x48ec5d[_0xdf5c('0x39')]:_0xf07b12[_0xdf5c('0x33')];if(!_0x7ebb52[_0xdf5c('0x34')][_0xdf5c('0x3b')](_0xdf5c('0x3c'))){_0x48ec5d['limit']=qs[_0xdf5c('0x20')](_0x7ebb52[_0xdf5c('0x34')]['limit']);_0x48ec5d['offset']=qs[_0xdf5c('0x22')](_0x7ebb52['query'][_0xdf5c('0x22')]);}_0x48ec5d['order']=qs[_0xdf5c('0x3d')](_0x7ebb52[_0xdf5c('0x34')]['sort']);_0x48ec5d[_0xdf5c('0x3e')]=qs['filters'](_[_0xdf5c('0x3f')](_0x7ebb52[_0xdf5c('0x34')],_0xf07b12[_0xdf5c('0x36')]),_0x28dd38);if(_0x7ebb52[_0xdf5c('0x34')]['filter']){_0x48ec5d[_0xdf5c('0x3e')]=_[_0xdf5c('0x40')](_0x48ec5d[_0xdf5c('0x3e')],{'$or':_['map'](_0x28dd38,function(_0x4adcfc){if(_0x4adcfc[_0xdf5c('0x31')]!==_0xdf5c('0x41')){var _0x516d35={};_0x516d35[_0x4adcfc[_0xdf5c('0x2b')]]={'$like':'%'+_0x7ebb52[_0xdf5c('0x34')][_0xdf5c('0x42')]+'%'};return _0x516d35;}})});}_0x48ec5d=_[_0xdf5c('0x40')]({},_0x48ec5d,_0x7ebb52['options']);var _0x38cca9={'where':_0x48ec5d[_0xdf5c('0x3e')]};return db['OpenchannelTransferReport'][_0xdf5c('0x21')](_0x38cca9)[_0xdf5c('0x28')](function(_0x524401){_0x1c448d['count']=_0x524401;if(_0x7ebb52[_0xdf5c('0x34')][_0xdf5c('0x43')]){_0x48ec5d[_0xdf5c('0x44')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0xdf5c('0x45')](_0x48ec5d);})[_0xdf5c('0x28')](function(_0x2db53f){_0x1c448d['rows']=_0x2db53f;return _0x1c448d;})['then'](respondWithFilteredResult(_0x18b627,_0x48ec5d))[_0xdf5c('0x46')](handleError(_0x18b627,null));};exports[_0xdf5c('0x47')]=function(_0x5a7aa3,_0x3c8696){var _0x5a7224={'raw':!![],'where':{'id':_0x5a7aa3[_0xdf5c('0x48')]['id']}},_0x25fbbd={};_0x25fbbd[_0xdf5c('0x33')]=_[_0xdf5c('0x35')](db[_0xdf5c('0x2e')][_0xdf5c('0x2f')]);_0x25fbbd['query']=_[_0xdf5c('0x35')](_0x5a7aa3['query']);_0x25fbbd[_0xdf5c('0x36')]=_[_0xdf5c('0x37')](_0x25fbbd[_0xdf5c('0x33')],_0x25fbbd[_0xdf5c('0x34')]);_0x5a7224[_0xdf5c('0x39')]=_[_0xdf5c('0x37')](_0x25fbbd[_0xdf5c('0x33')],qs[_0xdf5c('0x38')](_0x5a7aa3['query'][_0xdf5c('0x38')]));_0x5a7224[_0xdf5c('0x39')]=_0x5a7224['attributes'][_0xdf5c('0x3a')]?_0x5a7224[_0xdf5c('0x39')]:_0x25fbbd['model'];if(_0x5a7aa3[_0xdf5c('0x34')][_0xdf5c('0x43')]){_0x5a7224[_0xdf5c('0x44')]=[{'all':!![]}];}_0x5a7224=_['merge']({},_0x5a7224,_0x5a7aa3[_0xdf5c('0x49')]);return db[_0xdf5c('0x2e')][_0xdf5c('0x4a')](_0x5a7224)[_0xdf5c('0x28')](handleEntityNotFound(_0x3c8696,null))['then'](respondWithResult(_0x3c8696,null))[_0xdf5c('0x46')](handleError(_0x3c8696,null));};exports[_0xdf5c('0x4b')]=function(_0x1c6831,_0x15b02d){return db[_0xdf5c('0x2e')][_0xdf5c('0x4b')](_0x1c6831['body'],{})[_0xdf5c('0x28')](respondWithResult(_0x15b02d,0xc9))[_0xdf5c('0x46')](handleError(_0x15b02d,null));};exports[_0xdf5c('0x27')]=function(_0x574ae7,_0x6c50e7){if(_0x574ae7[_0xdf5c('0x4c')]['id']){delete _0x574ae7[_0xdf5c('0x4c')]['id'];}return db['OpenchannelTransferReport'][_0xdf5c('0x4a')]({'where':{'id':_0x574ae7['params']['id']}})['then'](handleEntityNotFound(_0x6c50e7,null))[_0xdf5c('0x28')](saveUpdates(_0x574ae7[_0xdf5c('0x4c')],null))[_0xdf5c('0x28')](respondWithResult(_0x6c50e7,null))[_0xdf5c('0x46')](handleError(_0x6c50e7,null));};exports[_0xdf5c('0x4d')]=function(_0x5ced23,_0x2eda44){return db[_0xdf5c('0x2e')]['find']({'where':{'id':_0x5ced23[_0xdf5c('0x48')]['id']}})['then'](handleEntityNotFound(_0x2eda44,null))[_0xdf5c('0x28')](removeEntity(_0x2eda44,null))['catch'](handleError(_0x2eda44,null));};exports[_0xdf5c('0x4e')]=function(_0x4a4c96,_0x227a8a){return db['OpenchannelTransferReport'][_0xdf5c('0x4e')]()[_0xdf5c('0x28')](respondWithResult(_0x227a8a,null))[_0xdf5c('0x46')](handleError(_0x227a8a,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index cd87940..d862d68 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 _0xd5d5=['define','OpenchannelTransferReport','report_openchannel_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes'];(function(_0x21ef85,_0x2d9f4f){var _0x5b9a7d=function(_0x5b5f13){while(--_0x5b5f13){_0x21ef85['push'](_0x21ef85['shift']());}};_0x5b9a7d(++_0x2d9f4f);}(_0xd5d5,0x137));var _0x5d5d=function(_0x399e3b,_0x5dd3d2){_0x399e3b=_0x399e3b-0x0;var _0x28c6a4=_0xd5d5[_0x399e3b];return _0x28c6a4;};'use strict';var _=require(_0x5d5d('0x0'));var util=require(_0x5d5d('0x1'));var logger=require(_0x5d5d('0x2'))(_0x5d5d('0x3'));var moment=require(_0x5d5d('0x4'));var BPromise=require(_0x5d5d('0x5'));var rp=require(_0x5d5d('0x6'));var fs=require('fs');var path=require(_0x5d5d('0x7'));var rimraf=require(_0x5d5d('0x8'));var config=require(_0x5d5d('0x9'));var attributes=require(_0x5d5d('0xa'));module['exports']=function(_0x326cac,_0x430d21){return _0x326cac[_0x5d5d('0xb')](_0x5d5d('0xc'),attributes,{'tableName':_0x5d5d('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe031=['request-promise','path','../../config/environment','exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xeaade7,_0x178f56){var _0x23d6db=function(_0x15d0cf){while(--_0x15d0cf){_0xeaade7['push'](_0xeaade7['shift']());}};_0x23d6db(++_0x178f56);}(_0xe031,0x159));var _0x1e03=function(_0x3dfecc,_0x535500){_0x3dfecc=_0x3dfecc-0x0;var _0x5ca86b=_0xe031[_0x3dfecc];return _0x5ca86b;};'use strict';var _=require(_0x1e03('0x0'));var util=require(_0x1e03('0x1'));var logger=require(_0x1e03('0x2'))(_0x1e03('0x3'));var moment=require(_0x1e03('0x4'));var BPromise=require(_0x1e03('0x5'));var rp=require(_0x1e03('0x6'));var fs=require('fs');var path=require(_0x1e03('0x7'));var rimraf=require('rimraf');var config=require(_0x1e03('0x8'));var attributes=require('./openchannelTransferReport.attributes');module[_0x1e03('0x9')]=function(_0xca0e4d,_0x2e3d4e){return _0xca0e4d['define'](_0x1e03('0xa'),attributes,{'tableName':_0x1e03('0xb'),'paranoid':![],'indexes':[{'name':_0x1e03('0xc'),'fields':[_0x1e03('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index d229931..35784bd 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 _0x9c5a=['http','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x4204b9,_0x18aee4){var _0x46e056=function(_0x650cd2){while(--_0x650cd2){_0x4204b9['push'](_0x4204b9['shift']());}};_0x46e056(++_0x18aee4);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x169b42,_0x2c96f7){_0x169b42=_0x169b42-0x0;var _0x313019=_0x9c5a[_0x169b42];return _0x313019;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var moment=require('moment');var BPromise=require(_0xa9c5('0x2'));var rs=require(_0xa9c5('0x3'));var fs=require('fs');var Redis=require(_0xa9c5('0x4'));var db=require(_0xa9c5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa9c5('0x6'))(_0xa9c5('0x7'));var config=require('../../config/environment');var jayson=require(_0xa9c5('0x8'));var client=jayson['client'][_0xa9c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3df556,_0x4cb597,_0x4b6db6){return new BPromise(function(_0x3d6b50,_0x16f331){return client['request'](_0x3df556,_0x4b6db6)[_0xa9c5('0xa')](function(_0x97f9e2){logger['info'](_0xa9c5('0xb'),_0x4cb597,_0xa9c5('0xc'));logger['debug']('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x4cb597,_0xa9c5('0xc'),JSON[_0xa9c5('0xd')](_0x97f9e2));if(_0x97f9e2[_0xa9c5('0xe')]){if(_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0xf')]===0x1f4){logger[_0xa9c5('0xe')](_0xa9c5('0xb'),_0x4cb597,_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);return _0x16f331(_0x97f9e2[_0xa9c5('0xe')]['message']);}logger[_0xa9c5('0xe')](_0xa9c5('0xb'),_0x4cb597,_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);return _0x3d6b50(_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);}else{logger[_0xa9c5('0x11')](_0xa9c5('0xb'),_0x4cb597,_0xa9c5('0xc'));_0x3d6b50(_0x97f9e2[_0xa9c5('0x12')]['message']);}})[_0xa9c5('0x13')](function(_0xd85c32){logger[_0xa9c5('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4cb597,_0xd85c32);_0x16f331(_0xd85c32);});});} \ No newline at end of file +var _0x448b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x448b,0x125));var _0xb448=function(_0x3209f9,_0x1b3845){_0x3209f9=_0x3209f9-0x0;var _0x508a5a=_0x448b[_0x3209f9];return _0x508a5a;};'use strict';var _=require(_0xb448('0x0'));var util=require(_0xb448('0x1'));var moment=require(_0xb448('0x2'));var BPromise=require(_0xb448('0x3'));var rs=require(_0xb448('0x4'));var fs=require('fs');var Redis=require(_0xb448('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb448('0x6'));var logger=require(_0xb448('0x7'))(_0xb448('0x8'));var config=require(_0xb448('0x9'));var jayson=require(_0xb448('0xa'));var client=jayson[_0xb448('0xb')][_0xb448('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5993ad,_0x2de6e5,_0x2f6f82){return new BPromise(function(_0x2c2bdd,_0x180c18){return client[_0xb448('0xd')](_0x5993ad,_0x2f6f82)[_0xb448('0xe')](function(_0x1e6e2f){logger[_0xb448('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2de6e5,_0xb448('0x10'));logger[_0xb448('0x11')](_0xb448('0x12'),_0x2de6e5,_0xb448('0x10'),JSON[_0xb448('0x13')](_0x1e6e2f));if(_0x1e6e2f[_0xb448('0x14')]){if(_0x1e6e2f['error'][_0xb448('0x15')]===0x1f4){logger['error'](_0xb448('0x16'),_0x2de6e5,_0x1e6e2f[_0xb448('0x14')][_0xb448('0x17')]);return _0x180c18(_0x1e6e2f[_0xb448('0x14')][_0xb448('0x17')]);}logger[_0xb448('0x14')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2de6e5,_0x1e6e2f[_0xb448('0x14')][_0xb448('0x17')]);return _0x2c2bdd(_0x1e6e2f[_0xb448('0x14')][_0xb448('0x17')]);}else{logger[_0xb448('0xf')](_0xb448('0x16'),_0x2de6e5,_0xb448('0x10'));_0x2c2bdd(_0x1e6e2f[_0xb448('0x18')][_0xb448('0x17')]);}})['catch'](function(_0x4a5fe5){logger[_0xb448('0x14')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2de6e5,_0x4a5fe5);_0x180c18(_0x4a5fe5);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 628bac4..004638f 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 _0x916c=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./pause.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x916c,0x6d));var _0xc916=function(_0x57645b,_0x25f73a){_0x57645b=_0x57645b-0x0;var _0xe82f00=_0x916c[_0x57645b];return _0xe82f00;};'use strict';var multer=require(_0xc916('0x0'));var util=require('util');var path=require(_0xc916('0x1'));var timeout=require(_0xc916('0x2'));var express=require(_0xc916('0x3'));var router=express[_0xc916('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc916('0x5'));var interaction=require(_0xc916('0x6'));var config=require('../../config/environment');var controller=require(_0xc916('0x7'));router[_0xc916('0x8')]('/',auth[_0xc916('0x9')](),controller['index']);router['get'](_0xc916('0xa'),auth['isAuthenticated'](),controller[_0xc916('0xb')]);router[_0xc916('0xc')]('/',auth[_0xc916('0x9')](),controller[_0xc916('0xd')]);router[_0xc916('0xe')](_0xc916('0xa'),auth[_0xc916('0x9')](),controller['update']);router[_0xc916('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xc916('0x10')]);module[_0xc916('0x11')]=router; \ No newline at end of file +var _0x3d7a=['isAuthenticated','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./pause.controller','get','index','/:id','post','create','put','update','delete'];(function(_0x26eaf0,_0x130e57){var _0x17fef3=function(_0x46ff91){while(--_0x46ff91){_0x26eaf0['push'](_0x26eaf0['shift']());}};_0x17fef3(++_0x130e57);}(_0x3d7a,0xa4));var _0xa3d7=function(_0x53f402,_0x326920){_0x53f402=_0x53f402-0x0;var _0x45a76d=_0x3d7a[_0x53f402];return _0x45a76d;};'use strict';var multer=require(_0xa3d7('0x0'));var util=require(_0xa3d7('0x1'));var path=require(_0xa3d7('0x2'));var timeout=require(_0xa3d7('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa3d7('0x4'));var auth=require(_0xa3d7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa3d7('0x6'));var controller=require(_0xa3d7('0x7'));router[_0xa3d7('0x8')]('/',auth['isAuthenticated'](),controller[_0xa3d7('0x9')]);router[_0xa3d7('0x8')](_0xa3d7('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xa3d7('0xb')]('/',auth['isAuthenticated'](),controller[_0xa3d7('0xc')]);router[_0xa3d7('0xd')](_0xa3d7('0xa'),auth['isAuthenticated'](),controller[_0xa3d7('0xe')]);router[_0xa3d7('0xf')](_0xa3d7('0xa'),auth[_0xa3d7('0x10')](),controller['destroy']);module[_0xa3d7('0x11')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 1e6e853..09149e8 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 _0xc7c2=['sequelize','exports','STRING','name'];(function(_0x19d4e9,_0x4a8446){var _0x22a280=function(_0x54c608){while(--_0x54c608){_0x19d4e9['push'](_0x19d4e9['shift']());}};_0x22a280(++_0x4a8446);}(_0xc7c2,0xb8));var _0x2c7c=function(_0x242e94,_0x37ba73){_0x242e94=_0x242e94-0x0;var _0x27afec=_0xc7c2[_0x242e94];return _0x27afec;};'use strict';var Sequelize=require(_0x2c7c('0x0'));module[_0x2c7c('0x1')]={'name':{'type':Sequelize[_0x2c7c('0x2')],'unique':_0x2c7c('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdffd=['name','sequelize','STRING'];(function(_0x427ba8,_0x4eae12){var _0x10675e=function(_0x2fbbb2){while(--_0x2fbbb2){_0x427ba8['push'](_0x427ba8['shift']());}};_0x10675e(++_0x4eae12);}(_0xdffd,0x7c));var _0xddff=function(_0x2a0f4b,_0x276975){_0x2a0f4b=_0x2a0f4b-0x0;var _0x54562b=_0xdffd[_0x2a0f4b];return _0x54562b;};'use strict';var Sequelize=require(_0xddff('0x0'));module['exports']={'name':{'type':Sequelize[_0xddff('0x1')],'unique':_0xddff('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 8d9005d..cfef3cd 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 _0x3a8f=['merge','options','where','include','findAll','rows','catch','show','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Pauses','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','destroy','error','stack','name','send','index','Pause','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','map','filter'];(function(_0x27235e,_0x410d32){var _0x10a010=function(_0xcd8b1c){while(--_0xcd8b1c){_0x27235e['push'](_0x27235e['shift']());}};_0x10a010(++_0x410d32);}(_0x3a8f,0xbf));var _0xf3a8=function(_0xb41ee,_0x3e1038){_0xb41ee=_0xb41ee-0x0;var _0x51c4c2=_0x3a8f[_0xb41ee];return _0x51c4c2;};'use strict';var emlformat=require(_0xf3a8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf3a8('0x1'));var rp=require(_0xf3a8('0x2'));var moment=require(_0xf3a8('0x3'));var BPromise=require(_0xf3a8('0x4'));var Mustache=require(_0xf3a8('0x5'));var util=require('util');var path=require(_0xf3a8('0x6'));var sox=require(_0xf3a8('0x7'));var csv=require(_0xf3a8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf3a8('0x9'));var _=require('lodash');var squel=require(_0xf3a8('0xa'));var crypto=require(_0xf3a8('0xb'));var jsforce=require(_0xf3a8('0xc'));var deskjs=require(_0xf3a8('0xd'));var toCsv=require(_0xf3a8('0x8'));var querystring=require(_0xf3a8('0xe'));var Papa=require(_0xf3a8('0xf'));var Redis=require(_0xf3a8('0x10'));var authService=require(_0xf3a8('0x11'));var qs=require(_0xf3a8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf3a8('0x13'));var logger=require('../../config/logger')(_0xf3a8('0x14'));var utils=require('../../config/utils');var config=require(_0xf3a8('0x15'));var licenseUtil=require(_0xf3a8('0x16'));var db=require(_0xf3a8('0x17'))['db'];function respondWithStatusCode(_0xa13541,_0x1b6faa){_0x1b6faa=_0x1b6faa||0xcc;return function(_0x23feb2){if(_0x23feb2){return _0xa13541[_0xf3a8('0x18')](_0x1b6faa);}return _0xa13541['status'](_0x1b6faa)[_0xf3a8('0x19')]();};}function respondWithResult(_0x3c03f6,_0x296cd4){_0x296cd4=_0x296cd4||0xc8;return function(_0x414222){if(_0x414222){return _0x3c03f6[_0xf3a8('0x1a')](_0x296cd4)[_0xf3a8('0x1b')](_0x414222);}};}function respondWithFilteredResult(_0x3261be,_0x59f3ee){return function(_0x204abc){if(_0x204abc){var _0x4bc486=typeof _0x59f3ee[_0xf3a8('0x1c')]===_0xf3a8('0x1d')&&typeof _0x59f3ee[_0xf3a8('0x1e')]==='undefined';var _0x57b89b=_0x204abc[_0xf3a8('0x1f')];var _0x3ce2cd=_0x4bc486?0x0:_0x59f3ee[_0xf3a8('0x1c')];var _0x58848e=_0x4bc486?_0x204abc[_0xf3a8('0x1f')]:_0x59f3ee[_0xf3a8('0x1c')]+_0x59f3ee[_0xf3a8('0x1e')];var _0x34a3f4;if(_0x58848e>=_0x57b89b){_0x58848e=_0x57b89b;_0x34a3f4=0xc8;}else{_0x34a3f4=0xce;}_0x3261be[_0xf3a8('0x1a')](_0x34a3f4);return _0x3261be[_0xf3a8('0x20')](_0xf3a8('0x21'),_0x3ce2cd+'-'+_0x58848e+'/'+_0x57b89b)[_0xf3a8('0x1b')](_0x204abc);}return null;};}function patchUpdates(_0x379c00){return function(_0x15f184){try{jsonpatch[_0xf3a8('0x22')](_0x15f184,_0x379c00,!![]);}catch(_0x22d499){return BPromise['reject'](_0x22d499);}return _0x15f184[_0xf3a8('0x23')]();};}function saveUpdates(_0x45fc06,_0x461c7c){return function(_0x509c91){if(_0x509c91){return _0x509c91[_0xf3a8('0x24')](_0x45fc06)[_0xf3a8('0x25')](function(_0x1fb213){return _0x1fb213;});}return null;};}function removeEntity(_0x131ef0,_0x215664){return function(_0x33dd54){if(_0x33dd54){return _0x33dd54['destroy']()['then'](function(){var _0x2967f0=_0x33dd54[_0xf3a8('0x26')]({'plain':!![]});var _0x456442='Pauses';return db['UserProfileResource'][_0xf3a8('0x27')]({'where':{'type':_0x456442,'resourceId':_0x2967f0['id']}})['then'](function(){return _0x33dd54;});})['then'](function(){_0x131ef0[_0xf3a8('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x498d26,_0x5939d6){return function(_0x4267a4){if(!_0x4267a4){_0x498d26[_0xf3a8('0x18')](0x194);}return _0x4267a4;};}function handleError(_0x42d4d8,_0x38f4a0){_0x38f4a0=_0x38f4a0||0x1f4;return function(_0x53f07d){logger[_0xf3a8('0x28')](_0x53f07d[_0xf3a8('0x29')]);if(_0x53f07d[_0xf3a8('0x2a')]){delete _0x53f07d[_0xf3a8('0x2a')];}_0x42d4d8['status'](_0x38f4a0)[_0xf3a8('0x2b')](_0x53f07d);};}exports[_0xf3a8('0x2c')]=function(_0xc16c12,_0x350c1c){var _0xb5d920={},_0x3ec7cb={},_0x2d69cd={'count':0x0,'rows':[]};var _0x397bff=_['map'](db[_0xf3a8('0x2d')][_0xf3a8('0x2e')],function(_0x35ed13){return{'name':_0x35ed13[_0xf3a8('0x2f')],'type':_0x35ed13[_0xf3a8('0x30')]['key']};});_0x3ec7cb[_0xf3a8('0x31')]=_['map'](_0x397bff,'name');_0x3ec7cb[_0xf3a8('0x32')]=_[_0xf3a8('0x33')](_0xc16c12[_0xf3a8('0x32')]);_0x3ec7cb[_0xf3a8('0x34')]=_[_0xf3a8('0x35')](_0x3ec7cb[_0xf3a8('0x31')],_0x3ec7cb[_0xf3a8('0x32')]);_0xb5d920[_0xf3a8('0x36')]=_['intersection'](_0x3ec7cb[_0xf3a8('0x31')],qs[_0xf3a8('0x37')](_0xc16c12[_0xf3a8('0x32')][_0xf3a8('0x37')]));_0xb5d920[_0xf3a8('0x36')]=_0xb5d920[_0xf3a8('0x36')][_0xf3a8('0x38')]?_0xb5d920[_0xf3a8('0x36')]:_0x3ec7cb[_0xf3a8('0x31')];if(!_0xc16c12[_0xf3a8('0x32')][_0xf3a8('0x39')](_0xf3a8('0x3a'))){_0xb5d920[_0xf3a8('0x1e')]=qs[_0xf3a8('0x1e')](_0xc16c12['query'][_0xf3a8('0x1e')]);_0xb5d920[_0xf3a8('0x1c')]=qs[_0xf3a8('0x1c')](_0xc16c12[_0xf3a8('0x32')]['offset']);}_0xb5d920[_0xf3a8('0x3b')]=qs['sort'](_0xc16c12['query'][_0xf3a8('0x3c')]);_0xb5d920['where']=qs[_0xf3a8('0x34')](_[_0xf3a8('0x3d')](_0xc16c12[_0xf3a8('0x32')],_0x3ec7cb[_0xf3a8('0x34')]),_0x397bff);if(_0xc16c12[_0xf3a8('0x32')]['filter']){_0xb5d920['where']=_['merge'](_0xb5d920['where'],{'$or':_[_0xf3a8('0x3e')](_0x397bff,function(_0x5033b9){if(_0x5033b9[_0xf3a8('0x30')]!=='VIRTUAL'){var _0x2bedd7={};_0x2bedd7[_0x5033b9[_0xf3a8('0x2a')]]={'$like':'%'+_0xc16c12[_0xf3a8('0x32')][_0xf3a8('0x3f')]+'%'};return _0x2bedd7;}})});}_0xb5d920=_[_0xf3a8('0x40')]({},_0xb5d920,_0xc16c12[_0xf3a8('0x41')]);var _0x46c16f={'where':_0xb5d920[_0xf3a8('0x42')]};return db[_0xf3a8('0x2d')][_0xf3a8('0x1f')](_0x46c16f)[_0xf3a8('0x25')](function(_0x1176a0){_0x2d69cd[_0xf3a8('0x1f')]=_0x1176a0;if(_0xc16c12[_0xf3a8('0x32')]['includeAll']){_0xb5d920[_0xf3a8('0x43')]=[{'all':!![]}];}return db[_0xf3a8('0x2d')][_0xf3a8('0x44')](_0xb5d920);})[_0xf3a8('0x25')](function(_0x810d15){_0x2d69cd[_0xf3a8('0x45')]=_0x810d15;return _0x2d69cd;})['then'](respondWithFilteredResult(_0x350c1c,_0xb5d920))[_0xf3a8('0x46')](handleError(_0x350c1c,null));};exports[_0xf3a8('0x47')]=function(_0x7503e7,_0x10efb7){var _0x2660ba={'raw':!![],'where':{'id':_0x7503e7['params']['id']}},_0x28125c={};_0x28125c[_0xf3a8('0x31')]=_[_0xf3a8('0x33')](db['Pause'][_0xf3a8('0x2e')]);_0x28125c['query']=_[_0xf3a8('0x33')](_0x7503e7[_0xf3a8('0x32')]);_0x28125c[_0xf3a8('0x34')]=_['intersection'](_0x28125c[_0xf3a8('0x31')],_0x28125c[_0xf3a8('0x32')]);_0x2660ba[_0xf3a8('0x36')]=_[_0xf3a8('0x35')](_0x28125c[_0xf3a8('0x31')],qs[_0xf3a8('0x37')](_0x7503e7[_0xf3a8('0x32')][_0xf3a8('0x37')]));_0x2660ba['attributes']=_0x2660ba[_0xf3a8('0x36')][_0xf3a8('0x38')]?_0x2660ba[_0xf3a8('0x36')]:_0x28125c[_0xf3a8('0x31')];if(_0x7503e7[_0xf3a8('0x32')]['includeAll']){_0x2660ba[_0xf3a8('0x43')]=[{'all':!![]}];}_0x2660ba=_[_0xf3a8('0x40')]({},_0x2660ba,_0x7503e7[_0xf3a8('0x41')]);return db[_0xf3a8('0x2d')]['find'](_0x2660ba)[_0xf3a8('0x25')](handleEntityNotFound(_0x10efb7,null))[_0xf3a8('0x25')](respondWithResult(_0x10efb7,null))[_0xf3a8('0x46')](handleError(_0x10efb7,null));};exports['create']=function(_0x2a6276,_0x2a75ce){return db['Pause'][_0xf3a8('0x48')](_0x2a6276[_0xf3a8('0x49')],{})['then'](function(_0x552191){var _0xf3e401=_0x2a6276['user'][_0xf3a8('0x26')]({'plain':!![]});if(!_0xf3e401)throw new Error(_0xf3a8('0x4a'));if(_0xf3e401[_0xf3a8('0x4b')]===_0xf3a8('0x4c')){var _0x355eab=_0x552191[_0xf3a8('0x26')]({'plain':!![]});var _0x4cc08c=_0xf3a8('0x4d');return db[_0xf3a8('0x4e')][_0xf3a8('0x4f')]({'where':{'name':_0x4cc08c,'userProfileId':_0xf3e401[_0xf3a8('0x50')]},'raw':!![]})['then'](function(_0x2199fc){if(_0x2199fc&&_0x2199fc[_0xf3a8('0x51')]===0x0){return db[_0xf3a8('0x52')][_0xf3a8('0x48')]({'name':_0x355eab[_0xf3a8('0x2a')],'resourceId':_0x355eab['id'],'type':_0x2199fc[_0xf3a8('0x2a')],'sectionId':_0x2199fc['id']},{})['then'](function(){return _0x552191;});}else{return _0x552191;}})['catch'](function(_0x4db948){logger[_0xf3a8('0x28')](_0xf3a8('0x53'),_0x4db948);throw _0x4db948;});}return _0x552191;})[_0xf3a8('0x25')](respondWithResult(_0x2a75ce,0xc9))[_0xf3a8('0x46')](handleError(_0x2a75ce,null));};exports[_0xf3a8('0x24')]=function(_0x3c4133,_0x3bfdf3){if(_0x3c4133[_0xf3a8('0x49')]['id']){delete _0x3c4133['body']['id'];}return db['Pause'][_0xf3a8('0x4f')]({'where':{'id':_0x3c4133['params']['id']}})[_0xf3a8('0x25')](handleEntityNotFound(_0x3bfdf3,null))[_0xf3a8('0x25')](saveUpdates(_0x3c4133[_0xf3a8('0x49')],null))[_0xf3a8('0x25')](respondWithResult(_0x3bfdf3,null))[_0xf3a8('0x46')](handleError(_0x3bfdf3,null));};exports[_0xf3a8('0x27')]=function(_0x32c914,_0x5de01c){return db['Pause'][_0xf3a8('0x4f')]({'where':{'id':_0x32c914[_0xf3a8('0x54')]['id']}})[_0xf3a8('0x25')](handleEntityNotFound(_0x5de01c,null))['then'](removeEntity(_0x5de01c,null))[_0xf3a8('0x46')](handleError(_0x5de01c,null));}; \ No newline at end of file +var _0x3a1e=['send','index','map','Pause','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','catch','show','params','length','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','get','Pauses','end','error','stack','name'];(function(_0x4d6a9a,_0x60c3d2){var _0x203823=function(_0x5dc131){while(--_0x5dc131){_0x4d6a9a['push'](_0x4d6a9a['shift']());}};_0x203823(++_0x60c3d2);}(_0x3a1e,0x11c));var _0xe3a1=function(_0x503ffd,_0x8ecde){_0x503ffd=_0x503ffd-0x0;var _0x160437=_0x3a1e[_0x503ffd];return _0x160437;};'use strict';var emlformat=require(_0xe3a1('0x0'));var rimraf=require(_0xe3a1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe3a1('0x2'));var rp=require(_0xe3a1('0x3'));var moment=require('moment');var BPromise=require(_0xe3a1('0x4'));var Mustache=require(_0xe3a1('0x5'));var util=require(_0xe3a1('0x6'));var path=require('path');var sox=require(_0xe3a1('0x7'));var csv=require(_0xe3a1('0x8'));var ejs=require(_0xe3a1('0x9'));var fs=require('fs');var fs_extra=require(_0xe3a1('0xa'));var _=require(_0xe3a1('0xb'));var squel=require(_0xe3a1('0xc'));var crypto=require(_0xe3a1('0xd'));var jsforce=require(_0xe3a1('0xe'));var deskjs=require(_0xe3a1('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe3a1('0x10'));var Redis=require('ioredis');var authService=require(_0xe3a1('0x11'));var qs=require(_0xe3a1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe3a1('0x13'))(_0xe3a1('0x14'));var utils=require(_0xe3a1('0x15'));var config=require(_0xe3a1('0x16'));var licenseUtil=require(_0xe3a1('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f8c38,_0x40aa82){_0x40aa82=_0x40aa82||0xcc;return function(_0x4697a4){if(_0x4697a4){return _0x3f8c38[_0xe3a1('0x18')](_0x40aa82);}return _0x3f8c38['status'](_0x40aa82)['end']();};}function respondWithResult(_0x350f4c,_0x5bea52){_0x5bea52=_0x5bea52||0xc8;return function(_0x34f952){if(_0x34f952){return _0x350f4c[_0xe3a1('0x19')](_0x5bea52)['json'](_0x34f952);}};}function respondWithFilteredResult(_0x1a9f95,_0x85c1cf){return function(_0x3d6216){if(_0x3d6216){var _0x31144c=typeof _0x85c1cf[_0xe3a1('0x1a')]===_0xe3a1('0x1b')&&typeof _0x85c1cf[_0xe3a1('0x1c')]===_0xe3a1('0x1b');var _0x398387=_0x3d6216['count'];var _0x18d5f4=_0x31144c?0x0:_0x85c1cf[_0xe3a1('0x1a')];var _0x5179ce=_0x31144c?_0x3d6216[_0xe3a1('0x1d')]:_0x85c1cf[_0xe3a1('0x1a')]+_0x85c1cf['limit'];var _0x14dc54;if(_0x5179ce>=_0x398387){_0x5179ce=_0x398387;_0x14dc54=0xc8;}else{_0x14dc54=0xce;}_0x1a9f95[_0xe3a1('0x19')](_0x14dc54);return _0x1a9f95[_0xe3a1('0x1e')]('Content-Range',_0x18d5f4+'-'+_0x5179ce+'/'+_0x398387)[_0xe3a1('0x1f')](_0x3d6216);}return null;};}function patchUpdates(_0x129b2a){return function(_0x200e48){try{jsonpatch[_0xe3a1('0x20')](_0x200e48,_0x129b2a,!![]);}catch(_0x3d628b){return BPromise[_0xe3a1('0x21')](_0x3d628b);}return _0x200e48[_0xe3a1('0x22')]();};}function saveUpdates(_0x52f4a1,_0x142c23){return function(_0x1ca7fa){if(_0x1ca7fa){return _0x1ca7fa[_0xe3a1('0x23')](_0x52f4a1)[_0xe3a1('0x24')](function(_0x2eac3d){return _0x2eac3d;});}return null;};}function removeEntity(_0x49eb7a,_0x4664b1){return function(_0x298ec0){if(_0x298ec0){return _0x298ec0[_0xe3a1('0x25')]()[_0xe3a1('0x24')](function(){var _0x2fc01f=_0x298ec0[_0xe3a1('0x26')]({'plain':!![]});var _0x2a7b5f=_0xe3a1('0x27');return db['UserProfileResource'][_0xe3a1('0x25')]({'where':{'type':_0x2a7b5f,'resourceId':_0x2fc01f['id']}})['then'](function(){return _0x298ec0;});})[_0xe3a1('0x24')](function(){_0x49eb7a['status'](0xcc)[_0xe3a1('0x28')]();});}};}function handleEntityNotFound(_0x2437a8,_0x3bda89){return function(_0x2241ae){if(!_0x2241ae){_0x2437a8['sendStatus'](0x194);}return _0x2241ae;};}function handleError(_0xba91a5,_0x561b2e){_0x561b2e=_0x561b2e||0x1f4;return function(_0x5288f6){logger[_0xe3a1('0x29')](_0x5288f6[_0xe3a1('0x2a')]);if(_0x5288f6[_0xe3a1('0x2b')]){delete _0x5288f6[_0xe3a1('0x2b')];}_0xba91a5[_0xe3a1('0x19')](_0x561b2e)[_0xe3a1('0x2c')](_0x5288f6);};}exports[_0xe3a1('0x2d')]=function(_0x240139,_0x16f5da){var _0x17ce85={},_0x5ea7bc={},_0x5a42ba={'count':0x0,'rows':[]};var _0x16000f=_[_0xe3a1('0x2e')](db[_0xe3a1('0x2f')]['rawAttributes'],function(_0x45fe3c){return{'name':_0x45fe3c[_0xe3a1('0x30')],'type':_0x45fe3c[_0xe3a1('0x31')][_0xe3a1('0x32')]};});_0x5ea7bc[_0xe3a1('0x33')]=_[_0xe3a1('0x2e')](_0x16000f,'name');_0x5ea7bc[_0xe3a1('0x34')]=_[_0xe3a1('0x35')](_0x240139[_0xe3a1('0x34')]);_0x5ea7bc[_0xe3a1('0x36')]=_[_0xe3a1('0x37')](_0x5ea7bc[_0xe3a1('0x33')],_0x5ea7bc[_0xe3a1('0x34')]);_0x17ce85[_0xe3a1('0x38')]=_[_0xe3a1('0x37')](_0x5ea7bc[_0xe3a1('0x33')],qs[_0xe3a1('0x39')](_0x240139[_0xe3a1('0x34')][_0xe3a1('0x39')]));_0x17ce85[_0xe3a1('0x38')]=_0x17ce85['attributes']['length']?_0x17ce85[_0xe3a1('0x38')]:_0x5ea7bc['model'];if(!_0x240139['query'][_0xe3a1('0x3a')]('nolimit')){_0x17ce85[_0xe3a1('0x1c')]=qs[_0xe3a1('0x1c')](_0x240139[_0xe3a1('0x34')][_0xe3a1('0x1c')]);_0x17ce85[_0xe3a1('0x1a')]=qs['offset'](_0x240139[_0xe3a1('0x34')][_0xe3a1('0x1a')]);}_0x17ce85[_0xe3a1('0x3b')]=qs[_0xe3a1('0x3c')](_0x240139['query'][_0xe3a1('0x3c')]);_0x17ce85[_0xe3a1('0x3d')]=qs[_0xe3a1('0x36')](_[_0xe3a1('0x3e')](_0x240139[_0xe3a1('0x34')],_0x5ea7bc[_0xe3a1('0x36')]),_0x16000f);if(_0x240139[_0xe3a1('0x34')][_0xe3a1('0x3f')]){_0x17ce85[_0xe3a1('0x3d')]=_[_0xe3a1('0x40')](_0x17ce85[_0xe3a1('0x3d')],{'$or':_[_0xe3a1('0x2e')](_0x16000f,function(_0x2c9e2f){if(_0x2c9e2f[_0xe3a1('0x31')]!==_0xe3a1('0x41')){var _0x68b9b3={};_0x68b9b3[_0x2c9e2f[_0xe3a1('0x2b')]]={'$like':'%'+_0x240139[_0xe3a1('0x34')][_0xe3a1('0x3f')]+'%'};return _0x68b9b3;}})});}_0x17ce85=_['merge']({},_0x17ce85,_0x240139['options']);var _0x8705f1={'where':_0x17ce85[_0xe3a1('0x3d')]};return db[_0xe3a1('0x2f')][_0xe3a1('0x1d')](_0x8705f1)[_0xe3a1('0x24')](function(_0x2274f3){_0x5a42ba['count']=_0x2274f3;if(_0x240139[_0xe3a1('0x34')][_0xe3a1('0x42')]){_0x17ce85['include']=[{'all':!![]}];}return db['Pause']['findAll'](_0x17ce85);})[_0xe3a1('0x24')](function(_0x51c9c0){_0x5a42ba['rows']=_0x51c9c0;return _0x5a42ba;})[_0xe3a1('0x24')](respondWithFilteredResult(_0x16f5da,_0x17ce85))[_0xe3a1('0x43')](handleError(_0x16f5da,null));};exports[_0xe3a1('0x44')]=function(_0x2b193b,_0x237513){var _0x6e698d={'raw':!![],'where':{'id':_0x2b193b[_0xe3a1('0x45')]['id']}},_0x5a7b6c={};_0x5a7b6c[_0xe3a1('0x33')]=_[_0xe3a1('0x35')](db[_0xe3a1('0x2f')]['rawAttributes']);_0x5a7b6c[_0xe3a1('0x34')]=_[_0xe3a1('0x35')](_0x2b193b['query']);_0x5a7b6c[_0xe3a1('0x36')]=_[_0xe3a1('0x37')](_0x5a7b6c[_0xe3a1('0x33')],_0x5a7b6c[_0xe3a1('0x34')]);_0x6e698d['attributes']=_[_0xe3a1('0x37')](_0x5a7b6c['model'],qs[_0xe3a1('0x39')](_0x2b193b[_0xe3a1('0x34')][_0xe3a1('0x39')]));_0x6e698d['attributes']=_0x6e698d[_0xe3a1('0x38')][_0xe3a1('0x46')]?_0x6e698d[_0xe3a1('0x38')]:_0x5a7b6c[_0xe3a1('0x33')];if(_0x2b193b[_0xe3a1('0x34')][_0xe3a1('0x42')]){_0x6e698d[_0xe3a1('0x47')]=[{'all':!![]}];}_0x6e698d=_[_0xe3a1('0x40')]({},_0x6e698d,_0x2b193b[_0xe3a1('0x48')]);return db[_0xe3a1('0x2f')][_0xe3a1('0x49')](_0x6e698d)['then'](handleEntityNotFound(_0x237513,null))['then'](respondWithResult(_0x237513,null))[_0xe3a1('0x43')](handleError(_0x237513,null));};exports[_0xe3a1('0x4a')]=function(_0x367311,_0x341dbd){return db[_0xe3a1('0x2f')]['create'](_0x367311['body'],{})['then'](function(_0x36b6b8){var _0x478156=_0x367311[_0xe3a1('0x4b')][_0xe3a1('0x26')]({'plain':!![]});if(!_0x478156)throw new Error(_0xe3a1('0x4c'));if(_0x478156[_0xe3a1('0x4d')]===_0xe3a1('0x4b')){var _0xc7243=_0x36b6b8[_0xe3a1('0x26')]({'plain':!![]});var _0x420c34=_0xe3a1('0x27');return db[_0xe3a1('0x4e')]['find']({'where':{'name':_0x420c34,'userProfileId':_0x478156[_0xe3a1('0x4f')]},'raw':!![]})[_0xe3a1('0x24')](function(_0x2c9487){if(_0x2c9487&&_0x2c9487['autoAssociation']===0x0){return db['UserProfileResource'][_0xe3a1('0x4a')]({'name':_0xc7243[_0xe3a1('0x2b')],'resourceId':_0xc7243['id'],'type':_0x2c9487[_0xe3a1('0x2b')],'sectionId':_0x2c9487['id']},{})[_0xe3a1('0x24')](function(){return _0x36b6b8;});}else{return _0x36b6b8;}})[_0xe3a1('0x43')](function(_0x1b65b7){logger['error'](_0xe3a1('0x50'),_0x1b65b7);throw _0x1b65b7;});}return _0x36b6b8;})['then'](respondWithResult(_0x341dbd,0xc9))[_0xe3a1('0x43')](handleError(_0x341dbd,null));};exports[_0xe3a1('0x23')]=function(_0x15d65c,_0x8aaccc){if(_0x15d65c[_0xe3a1('0x51')]['id']){delete _0x15d65c[_0xe3a1('0x51')]['id'];}return db[_0xe3a1('0x2f')][_0xe3a1('0x49')]({'where':{'id':_0x15d65c[_0xe3a1('0x45')]['id']}})['then'](handleEntityNotFound(_0x8aaccc,null))[_0xe3a1('0x24')](saveUpdates(_0x15d65c[_0xe3a1('0x51')],null))[_0xe3a1('0x24')](respondWithResult(_0x8aaccc,null))[_0xe3a1('0x43')](handleError(_0x8aaccc,null));};exports[_0xe3a1('0x25')]=function(_0x43de3f,_0x45cf6d){return db[_0xe3a1('0x2f')][_0xe3a1('0x49')]({'where':{'id':_0x43de3f['params']['id']}})[_0xe3a1('0x24')](handleEntityNotFound(_0x45cf6d,null))['then'](removeEntity(_0x45cf6d,null))['catch'](handleError(_0x45cf6d,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 0695577..5fdae17 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 _0xf494=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','lodash','util'];(function(_0x480986,_0x6d6b32){var _0x40b219=function(_0x58a741){while(--_0x58a741){_0x480986['push'](_0x480986['shift']());}};_0x40b219(++_0x6d6b32);}(_0xf494,0x1c6));var _0x4f49=function(_0x5e28a1,_0x306092){_0x5e28a1=_0x5e28a1-0x0;var _0x37d2a7=_0xf494[_0x5e28a1];return _0x37d2a7;};'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')]('Pause',attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ef6=['exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./pause.attributes'];(function(_0x5b1bbc,_0x98e6c3){var _0x424fb4=function(_0x45ba56){while(--_0x45ba56){_0x5b1bbc['push'](_0x5b1bbc['shift']());}};_0x424fb4(++_0x98e6c3);}(_0x8ef6,0xf2));var _0x68ef=function(_0x4a9eda,_0x4b4f95){_0x4a9eda=_0x4a9eda-0x0;var _0x5ad93e=_0x8ef6[_0x4a9eda];return _0x5ad93e;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 858fe44..70e3ce9 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(_0x5b842b,_0x4b88e9){var _0x264ff2=function(_0x8bff9b){while(--_0x8bff9b){_0x5b842b['push'](_0x5b842b['shift']());}};_0x264ff2(++_0x4b88e9);}(_0xb10b,0x12a));var _0xbb10=function(_0x5659c0,_0x5f2532){_0x5659c0=_0x5659c0-0x0;var _0x36e3c0=_0xb10b[_0x5659c0];return _0x36e3c0;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x3cbd29,_0xb3701b){var _0x8320f4=function(_0x50ef52){while(--_0x50ef52){_0x3cbd29['push'](_0x3cbd29['shift']());}};_0x8320f4(++_0xb3701b);}(_0x7a54,0x106));var _0x47a5=function(_0x32880d,_0x34cf11){_0x32880d=_0x32880d-0x0;var _0x5013f8=_0x7a54[_0x32880d];return _0x5013f8;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index d0ce5e4..8f88501 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 _0x4ea3=['%s-%s%s','basename','extname','now','single','file','upload','post','webhookPost','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download','root','server/files/plugins','originalname','replace','format'];(function(_0x3c9a7c,_0x26856c){var _0x43826c=function(_0x4224c4){while(--_0x4224c4){_0x3c9a7c['push'](_0x3c9a7c['shift']());}};_0x43826c(++_0x26856c);}(_0x4ea3,0x70));var _0x34ea=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x4ea3[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var path=require(_0x34ea('0x2'));var timeout=require(_0x34ea('0x3'));var express=require('express');var router=express[_0x34ea('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x34ea('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x34ea('0x6'));router[_0x34ea('0x7')]('/',auth[_0x34ea('0x8')](),controller[_0x34ea('0x9')]);router[_0x34ea('0x7')](_0x34ea('0xa'),controller[_0x34ea('0xb')]);router['get'](_0x34ea('0xc'),auth[_0x34ea('0x8')](),controller[_0x34ea('0xd')]);router['get'](_0x34ea('0xe'),auth[_0x34ea('0x8')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5bd8b6,_0x346287,_0x167667){_0x167667(null,path['join'](config[_0x34ea('0xf')],_0x34ea('0x10')));},'filename':function(_0x10135f,_0x233b11,_0x60725f){_0x233b11[_0x34ea('0x11')]=_0x233b11[_0x34ea('0x11')][_0x34ea('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x60725f(null,util[_0x34ea('0x13')](_0x34ea('0x14'),path[_0x34ea('0x15')](_0x233b11['originalname'],path[_0x34ea('0x16')](_0x233b11[_0x34ea('0x11')])),Date[_0x34ea('0x17')](),path[_0x34ea('0x16')](_0x233b11[_0x34ea('0x11')])));}})});router['post']('/',upload[_0x34ea('0x18')](_0x34ea('0x19')),controller[_0x34ea('0x1a')]);router[_0x34ea('0x1b')]('/webhook',controller[_0x34ea('0x1c')]);router[_0x34ea('0x1d')](_0x34ea('0xc'),auth['isAuthenticated'](),controller[_0x34ea('0x1e')]);router[_0x34ea('0x1f')](_0x34ea('0xc'),auth[_0x34ea('0x8')](),controller['delete']);module[_0x34ea('0x20')]=router; \ No newline at end of file +var _0xf021=['server/files/plugins','originalname','basename','extname','now','post','file','put','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','get','/webhook','webhookGet','/:id','show','download','diskStorage','root'];(function(_0x4516e3,_0x32c352){var _0x28441a=function(_0x499bfb){while(--_0x499bfb){_0x4516e3['push'](_0x4516e3['shift']());}};_0x28441a(++_0x32c352);}(_0xf021,0x18f));var _0x1f02=function(_0x4c56b6,_0x239082){_0x4c56b6=_0x4c56b6-0x0;var _0x1ee73a=_0xf021[_0x4c56b6];return _0x1ee73a;};'use strict';var multer=require(_0x1f02('0x0'));var util=require(_0x1f02('0x1'));var path=require(_0x1f02('0x2'));var timeout=require(_0x1f02('0x3'));var express=require(_0x1f02('0x4'));var router=express['Router']();var fs_extra=require(_0x1f02('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1f02('0x6'));var config=require(_0x1f02('0x7'));var controller=require('./plugin.controller');router['get']('/',auth[_0x1f02('0x8')](),controller['index']);router[_0x1f02('0x9')](_0x1f02('0xa'),controller[_0x1f02('0xb')]);router[_0x1f02('0x9')](_0x1f02('0xc'),auth['isAuthenticated'](),controller[_0x1f02('0xd')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x1f02('0xe')]);var upload=multer({'storage':multer[_0x1f02('0xf')]({'destination':function(_0x1a93ec,_0x19ee35,_0x3c2b15){_0x3c2b15(null,path['join'](config[_0x1f02('0x10')],_0x1f02('0x11')));},'filename':function(_0x204e17,_0x56a2c2,_0x24e9b8){_0x56a2c2[_0x1f02('0x12')]=_0x56a2c2[_0x1f02('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x24e9b8(null,util['format']('%s-%s%s',path[_0x1f02('0x13')](_0x56a2c2[_0x1f02('0x12')],path[_0x1f02('0x14')](_0x56a2c2[_0x1f02('0x12')])),Date[_0x1f02('0x15')](),path[_0x1f02('0x14')](_0x56a2c2[_0x1f02('0x12')])));}})});router[_0x1f02('0x16')]('/',upload['single'](_0x1f02('0x17')),controller['upload']);router['post']('/webhook',controller['webhookPost']);router[_0x1f02('0x18')](_0x1f02('0xc'),auth[_0x1f02('0x8')](),controller['update']);router[_0x1f02('0x19')](_0x1f02('0xc'),auth[_0x1f02('0x8')](),controller[_0x1f02('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index dcd6bb0..175e4f1 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 _0xff9c=['sequelize','exports','STRING','ENUM','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x278ed1,_0x3997e6){var _0x599068=function(_0x1da92f){while(--_0x1da92f){_0x278ed1['push'](_0x278ed1['shift']());}};_0x599068(++_0x3997e6);}(_0xff9c,0x108));var _0xcff9=function(_0x1935e0,_0x3c7e5d){_0x1935e0=_0x1935e0-0x0;var _0x19eac7=_0xff9c[_0x1935e0];return _0x19eac7;};'use strict';var Sequelize=require(_0xcff9('0x0'));module[_0xcff9('0x1')]={'name':{'type':Sequelize[_0xcff9('0x2')]},'type':{'type':Sequelize[_0xcff9('0x3')]('html',_0xcff9('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xcff9('0x5')]},'path':{'type':Sequelize['STRING'],'comment':_0xcff9('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xcff9('0x7')},'sidebar':{'type':Sequelize[_0xcff9('0x3')](_0xcff9('0x8'),'agentOnly',_0xcff9('0x9'),'never'),'defaultValue':_0xcff9('0x9'),'comment':_0xcff9('0xa')},'icon':{'type':Sequelize[_0xcff9('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xcff9('0x2')]},'scriptName':{'type':Sequelize[_0xcff9('0x2')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8257=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','always','never'];(function(_0x351453,_0x34718d){var _0x37be69=function(_0x585cb9){while(--_0x585cb9){_0x351453['push'](_0x351453['shift']());}};_0x37be69(++_0x34718d);}(_0x8257,0x153));var _0x7825=function(_0x590b63,_0x14debb){_0x590b63=_0x590b63-0x0;var _0x3c9380=_0x8257[_0x590b63];return _0x3c9380;};'use strict';var Sequelize=require(_0x7825('0x0'));module[_0x7825('0x1')]={'name':{'type':Sequelize[_0x7825('0x2')]},'type':{'type':Sequelize[_0x7825('0x3')](_0x7825('0x4'),'script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x7825('0x5')]},'path':{'type':Sequelize['STRING'],'comment':_0x7825('0x6')},'active':{'type':Sequelize[_0x7825('0x7')],'defaultValue':0x0,'comment':_0x7825('0x8')},'sidebar':{'type':Sequelize[_0x7825('0x3')]('adminOnly',_0x7825('0x9'),_0x7825('0xa'),_0x7825('0xb')),'defaultValue':_0x7825('0xa'),'comment':_0x7825('0xc')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x7825('0x2')]},'agentUrl':{'type':Sequelize[_0x7825('0x2')]},'scriptName':{'type':Sequelize[_0x7825('0x2')]},'scriptPath':{'type':Sequelize[_0x7825('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 24e1534..09a85b4 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 _0xc397=['filter','type','VIRTUAL','merge','options','Plugin','includeAll','findAll','rows','catch','show','keys','intersection','find','download','root','server/files/plugins','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Error','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','join','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','Temporary\x20file\x20removed','file','filename','extname','info','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','Invalid\x20plugin\x20structure','lstatSync','isDirectory','readdirSync','some','Plugin\x20manifest\x20missing','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','Invalid\x20manifest:\x20views\x20missing','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Extracted\x20folder\x20removed','update','params','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./plugin.socket','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','get','Plugins','UserProfileResource','destroy','error','stack','name','index','map','rawAttributes','fieldName','model','query','fields','attributes','length','nolimit','sort','where','filters'];(function(_0x5a868f,_0x3466d8){var _0x1e0fd7=function(_0x32de99){while(--_0x32de99){_0x5a868f['push'](_0x5a868f['shift']());}};_0x1e0fd7(++_0x3466d8);}(_0xc397,0x6b));var _0x7c39=function(_0x2e4bff,_0x40e5b1){_0x2e4bff=_0x2e4bff-0x0;var _0x1b4c18=_0xc397[_0x2e4bff];return _0x1b4c18;};'use strict';var emlformat=require(_0x7c39('0x0'));var rimraf=require(_0x7c39('0x1'));var zipdir=require(_0x7c39('0x2'));var jsonpatch=require(_0x7c39('0x3'));var rp=require(_0x7c39('0x4'));var moment=require(_0x7c39('0x5'));var BPromise=require(_0x7c39('0x6'));var Mustache=require(_0x7c39('0x7'));var util=require(_0x7c39('0x8'));var path=require(_0x7c39('0x9'));var sox=require(_0x7c39('0xa'));var csv=require(_0x7c39('0xb'));var ejs=require(_0x7c39('0xc'));var fs=require('fs');var fs_extra=require(_0x7c39('0xd'));var _=require(_0x7c39('0xe'));var squel=require(_0x7c39('0xf'));var crypto=require('crypto');var jsforce=require(_0x7c39('0x10'));var deskjs=require(_0x7c39('0x11'));var toCsv=require(_0x7c39('0xb'));var querystring=require(_0x7c39('0x12'));var Papa=require(_0x7c39('0x13'));var extract=require('extract-zip');var rimraf=require(_0x7c39('0x1'));var archiver=require(_0x7c39('0x14'));var Redis=require(_0x7c39('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x7c39('0x16'));var as=require(_0x7c39('0x17'));var hardwareService=require(_0x7c39('0x18'));var logger=require(_0x7c39('0x19'))(_0x7c39('0x1a'));var utils=require('../../config/utils');var config=require(_0x7c39('0x1b'));var licenseUtil=require(_0x7c39('0x1c'));var db=require('../../mysqldb')['db'];config[_0x7c39('0x1d')]=_[_0x7c39('0x1e')](config['redis'],{'host':_0x7c39('0x1f'),'port':0x18eb});var socket=require(_0x7c39('0x20'))(new Redis(config[_0x7c39('0x1d')]));require(_0x7c39('0x21'))['register'](socket);function respondWithStatusCode(_0x27d1cd,_0x1a2667){_0x1a2667=_0x1a2667||0xcc;return function(_0x1eec47){if(_0x1eec47){return _0x27d1cd[_0x7c39('0x22')](_0x1a2667);}return _0x27d1cd[_0x7c39('0x23')](_0x1a2667)[_0x7c39('0x24')]();};}function respondWithResult(_0x3f4023,_0x216bc5){_0x216bc5=_0x216bc5||0xc8;return function(_0x52793b){if(_0x52793b){return _0x3f4023[_0x7c39('0x23')](_0x216bc5)['json'](_0x52793b);}};}function respondWithFilteredResult(_0x308ddc,_0x266f19){return function(_0x1c6076){if(_0x1c6076){var _0x2e9881=typeof _0x266f19[_0x7c39('0x25')]===_0x7c39('0x26')&&typeof _0x266f19[_0x7c39('0x27')]===_0x7c39('0x26');var _0x395ded=_0x1c6076[_0x7c39('0x28')];var _0x400b3f=_0x2e9881?0x0:_0x266f19['offset'];var _0x3b822b=_0x2e9881?_0x1c6076[_0x7c39('0x28')]:_0x266f19[_0x7c39('0x25')]+_0x266f19[_0x7c39('0x27')];var _0x1240c8;if(_0x3b822b>=_0x395ded){_0x3b822b=_0x395ded;_0x1240c8=0xc8;}else{_0x1240c8=0xce;}_0x308ddc[_0x7c39('0x23')](_0x1240c8);return _0x308ddc[_0x7c39('0x29')](_0x7c39('0x2a'),_0x400b3f+'-'+_0x3b822b+'/'+_0x395ded)[_0x7c39('0x2b')](_0x1c6076);}return null;};}function patchUpdates(_0x31335a){return function(_0x4351ae){try{jsonpatch[_0x7c39('0x2c')](_0x4351ae,_0x31335a,!![]);}catch(_0xa459dc){return BPromise['reject'](_0xa459dc);}return _0x4351ae[_0x7c39('0x2d')]();};}function saveUpdates(_0x36a668,_0x5c4235){return function(_0x13c122){if(_0x13c122){return _0x13c122['update'](_0x36a668)[_0x7c39('0x2e')](function(_0x4f9751){return _0x4f9751;});}return null;};}function removeEntity(_0x2e205b,_0x5d3539){return function(_0x4746b1){if(_0x4746b1){return _0x4746b1['destroy']()[_0x7c39('0x2e')](function(){var _0x32d454=_0x4746b1[_0x7c39('0x2f')]({'plain':!![]});var _0x2c468a=_0x7c39('0x30');return db[_0x7c39('0x31')][_0x7c39('0x32')]({'where':{'type':_0x2c468a,'resourceId':_0x32d454['id']}})['then'](function(){return _0x4746b1;});})[_0x7c39('0x2e')](function(){_0x2e205b[_0x7c39('0x23')](0xcc)[_0x7c39('0x24')]();});}};}function handleEntityNotFound(_0x501a38,_0x196f69){return function(_0x81d599){if(!_0x81d599){_0x501a38[_0x7c39('0x22')](0x194);}return _0x81d599;};}function handleError(_0x253ae9,_0x2685c8){_0x2685c8=_0x2685c8||0x1f4;return function(_0x5a86a2){logger[_0x7c39('0x33')](_0x5a86a2[_0x7c39('0x34')]);if(_0x5a86a2[_0x7c39('0x35')]){delete _0x5a86a2[_0x7c39('0x35')];}_0x253ae9[_0x7c39('0x23')](_0x2685c8)['send'](_0x5a86a2);};}exports[_0x7c39('0x36')]=function(_0x45571b,_0x323c9c){var _0x6ca4fc={},_0x5da99a={},_0x2dd9b2={'count':0x0,'rows':[]};var _0x137c76=_[_0x7c39('0x37')](db['Plugin'][_0x7c39('0x38')],function(_0x51811b){return{'name':_0x51811b[_0x7c39('0x39')],'type':_0x51811b['type']['key']};});_0x5da99a[_0x7c39('0x3a')]=_[_0x7c39('0x37')](_0x137c76,'name');_0x5da99a[_0x7c39('0x3b')]=_['keys'](_0x45571b[_0x7c39('0x3b')]);_0x5da99a['filters']=_['intersection'](_0x5da99a[_0x7c39('0x3a')],_0x5da99a[_0x7c39('0x3b')]);_0x6ca4fc['attributes']=_['intersection'](_0x5da99a[_0x7c39('0x3a')],qs[_0x7c39('0x3c')](_0x45571b[_0x7c39('0x3b')]['fields']));_0x6ca4fc[_0x7c39('0x3d')]=_0x6ca4fc[_0x7c39('0x3d')][_0x7c39('0x3e')]?_0x6ca4fc[_0x7c39('0x3d')]:_0x5da99a[_0x7c39('0x3a')];if(!_0x45571b[_0x7c39('0x3b')]['hasOwnProperty'](_0x7c39('0x3f'))){_0x6ca4fc[_0x7c39('0x27')]=qs[_0x7c39('0x27')](_0x45571b[_0x7c39('0x3b')][_0x7c39('0x27')]);_0x6ca4fc[_0x7c39('0x25')]=qs[_0x7c39('0x25')](_0x45571b['query'][_0x7c39('0x25')]);}_0x6ca4fc['order']=qs[_0x7c39('0x40')](_0x45571b[_0x7c39('0x3b')][_0x7c39('0x40')]);_0x6ca4fc[_0x7c39('0x41')]=qs['filters'](_['pick'](_0x45571b[_0x7c39('0x3b')],_0x5da99a[_0x7c39('0x42')]),_0x137c76);if(_0x45571b[_0x7c39('0x3b')][_0x7c39('0x43')]){_0x6ca4fc['where']=_['merge'](_0x6ca4fc['where'],{'$or':_['map'](_0x137c76,function(_0x366978){if(_0x366978[_0x7c39('0x44')]!==_0x7c39('0x45')){var _0x1ee84e={};_0x1ee84e[_0x366978[_0x7c39('0x35')]]={'$like':'%'+_0x45571b['query'][_0x7c39('0x43')]+'%'};return _0x1ee84e;}})});}_0x6ca4fc=_[_0x7c39('0x46')]({},_0x6ca4fc,_0x45571b[_0x7c39('0x47')]);var _0x5f34e1={'where':_0x6ca4fc[_0x7c39('0x41')]};return db[_0x7c39('0x48')][_0x7c39('0x28')](_0x5f34e1)[_0x7c39('0x2e')](function(_0x2b4c0){_0x2dd9b2[_0x7c39('0x28')]=_0x2b4c0;if(_0x45571b['query'][_0x7c39('0x49')]){_0x6ca4fc['include']=[{'all':!![]}];}return db[_0x7c39('0x48')][_0x7c39('0x4a')](_0x6ca4fc);})[_0x7c39('0x2e')](function(_0x3fcfaf){_0x2dd9b2[_0x7c39('0x4b')]=_0x3fcfaf;return _0x2dd9b2;})[_0x7c39('0x2e')](respondWithFilteredResult(_0x323c9c,_0x6ca4fc))[_0x7c39('0x4c')](handleError(_0x323c9c,null));};exports[_0x7c39('0x4d')]=function(_0x2c5a54,_0x18cfbc){var _0x433ce3={'raw':!![],'where':{'id':_0x2c5a54['params']['id']}},_0x47c185={};_0x47c185[_0x7c39('0x3a')]=_[_0x7c39('0x4e')](db[_0x7c39('0x48')]['rawAttributes']);_0x47c185[_0x7c39('0x3b')]=_['keys'](_0x2c5a54['query']);_0x47c185[_0x7c39('0x42')]=_['intersection'](_0x47c185[_0x7c39('0x3a')],_0x47c185['query']);_0x433ce3[_0x7c39('0x3d')]=_[_0x7c39('0x4f')](_0x47c185['model'],qs['fields'](_0x2c5a54[_0x7c39('0x3b')][_0x7c39('0x3c')]));_0x433ce3[_0x7c39('0x3d')]=_0x433ce3['attributes']['length']?_0x433ce3[_0x7c39('0x3d')]:_0x47c185[_0x7c39('0x3a')];if(_0x2c5a54[_0x7c39('0x3b')]['includeAll']){_0x433ce3['include']=[{'all':!![]}];}_0x433ce3=_[_0x7c39('0x46')]({},_0x433ce3,_0x2c5a54[_0x7c39('0x47')]);return db[_0x7c39('0x48')][_0x7c39('0x50')](_0x433ce3)[_0x7c39('0x2e')](handleEntityNotFound(_0x18cfbc,null))[_0x7c39('0x2e')](respondWithResult(_0x18cfbc,null))[_0x7c39('0x4c')](handleError(_0x18cfbc,null));};exports[_0x7c39('0x51')]=function(_0x51dbf2,_0x196627,_0xf87904){return db['Plugin'][_0x7c39('0x50')]({'where':{'id':_0x51dbf2['params']['id']},'attributes':['name','path'],'raw':!![]})[_0x7c39('0x2e')](handleEntityNotFound(_0x196627,null))['then'](function(_0x175897){if(_0x175897){var _0x29fb01=path['join'](config[_0x7c39('0x52')],_0x7c39('0x53'),util['format'](_0x7c39('0x54'),path[_0x7c39('0x55')](_0x175897['path'])));var _0xdaef8e=fs[_0x7c39('0x56')](_0x29fb01);var _0x50deab=archiver(_0x7c39('0x57'),{'zlib':{'level':0x9}});_0x50deab['on'](_0x7c39('0x58'),function(_0x463f2b){if(_0x463f2b[_0x7c39('0x59')]===_0x7c39('0x5a')){logger[_0x7c39('0x33')](_0x463f2b);}else{throw new db['Sequelize'][(_0x7c39('0x5b'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x50deab['on'](_0x7c39('0x33'),function(_0x12c50e){throw new db[(_0x7c39('0x5c'))][(_0x7c39('0x5b'))](_0x7c39('0x5d'));});_0x50deab[_0x7c39('0x5e')](_0xdaef8e);_0x50deab['glob'](_0x7c39('0x5f'),{'cwd':path[_0x7c39('0x60')](config[_0x7c39('0x52')],'server/files/plugins',path[_0x7c39('0x61')](_0x175897[_0x7c39('0x9')])),'ignore':[path['join'](path[_0x7c39('0x55')](_0x175897[_0x7c39('0x9')]),_0x7c39('0x62')),path[_0x7c39('0x60')](path[_0x7c39('0x55')](_0x175897[_0x7c39('0x9')]),_0x7c39('0x63'))],'nodir':!![]})[_0x7c39('0x64')]();_0xdaef8e['on'](_0x7c39('0x65'),function(){if(!fs[_0x7c39('0x66')](_0x29fb01)){throw new db['Sequelize'][(_0x7c39('0x5b'))](_0x7c39('0x67'));}return _0x196627[_0x7c39('0x51')](_0x29fb01,util['format']('%s.zip',path[_0x7c39('0x55')](_0x175897[_0x7c39('0x9')])),function(_0x829114){if(_0x829114){throw new db[(_0x7c39('0x5c'))][(_0x7c39('0x5b'))](_0x7c39('0x68'));}fs[_0x7c39('0x69')](_0x29fb01);logger['info'](_0x7c39('0x6a'));logger['info'](_0x7c39('0x6b'));});});}return null;})[_0x7c39('0x4c')](handleError(_0x196627,null));};exports['upload']=function(_0x24f638,_0x5260c5,_0x1fbe3b){var _0x2492d9=path[_0x7c39('0x55')](_0x24f638[_0x7c39('0x6c')][_0x7c39('0x6d')],path[_0x7c39('0x6e')](_0x24f638[_0x7c39('0x6c')]['filename']));var _0x4debcc=path[_0x7c39('0x60')](config[_0x7c39('0x52')],_0x7c39('0x53'),_0x24f638[_0x7c39('0x6c')][_0x7c39('0x6d')]);var _0x58eafd=path['join'](config[_0x7c39('0x52')],_0x7c39('0x53'),_0x2492d9);logger[_0x7c39('0x6f')](_0x7c39('0x70'),_0x4debcc);logger[_0x7c39('0x6f')](_0x7c39('0x71'),_0x58eafd);try{fs['chmodSync'](_0x4debcc,parseInt(_0x7c39('0x72'),0x8));extract(_0x4debcc,{'dir':_0x58eafd},function(_0x54727d){if(_0x54727d){logger[_0x7c39('0x33')](_0x54727d);handleError(_0x54727d,!![]);};var _0x130a80=fs['readdirSync'](_0x58eafd);if(_0x130a80[_0x7c39('0x3e')]>0x1){removeReferences(_0x4debcc,_0x58eafd);logger[_0x7c39('0x33')]('Invalid\x20plugin\x20structure');return _0x1fbe3b(new Error(_0x7c39('0x73')));}var _0x11f9c5=fs[_0x7c39('0x74')](path[_0x7c39('0x60')](_0x58eafd,_0x130a80[0x0]));if(_0x11f9c5['isFile']()){removeReferences(_0x4debcc,_0x58eafd);logger[_0x7c39('0x33')](_0x7c39('0x73'));return _0x1fbe3b(new Error(_0x7c39('0x73')));}if(_0x11f9c5[_0x7c39('0x75')]()){var _0x3757c7=fs[_0x7c39('0x76')](path[_0x7c39('0x60')](_0x58eafd,_0x130a80[0x0]));if(_0x3757c7[_0x7c39('0x3e')]===0x0){removeReferences(_0x4debcc,_0x58eafd);logger['error'](_0x7c39('0x73'));return _0x1fbe3b(new Error('Invalid\x20plugin\x20structure'));}var _0x32bca9=_0x3757c7[_0x7c39('0x77')](function(_0x4110f7){return _0x4110f7==='manifest.json';});if(!_0x32bca9){return _0x1fbe3b(new Error(_0x7c39('0x78')));}var _0x219fbe=fs['readFileSync'](path[_0x7c39('0x60')](_0x58eafd,_0x130a80[0x0],_0x7c39('0x79')));var _0x1370b8=JSON[_0x7c39('0x7a')](_0x219fbe);if(_0x7c39('0x26')==typeof _0x1370b8[_0x7c39('0x35')]){return _0x1fbe3b(new Error(_0x7c39('0x7b')));}if(_0x7c39('0x26')==typeof _0x1370b8[_0x7c39('0x44')]){return _0x1fbe3b(new Error(_0x7c39('0x7c')));}if(_0x7c39('0x26')==typeof _0x1370b8[_0x7c39('0x7d')]){return _0x1fbe3b(new Error(_0x7c39('0x7e')));}if('undefined'==typeof _0x1370b8['parameters']){return _0x1fbe3b(new Error(_0x7c39('0x7f')));}if(_0x1370b8[_0x7c39('0x44')]===_0x7c39('0x80')){if(_0x7c39('0x26')==typeof _0x1370b8[_0x7c39('0x81')]['views']){return _0x1fbe3b(new Error(_0x7c39('0x82')));}if(_0x7c39('0x26')==typeof _0x1370b8['parameters'][_0x7c39('0x83')][_0x7c39('0x84')]&&_0x7c39('0x26')==typeof _0x1370b8[_0x7c39('0x81')][_0x7c39('0x83')][_0x7c39('0x85')]){return _0x1fbe3b(new Error(_0x7c39('0x86')));}}else if(_0x1370b8['type']===_0x7c39('0x87')){if(_0x7c39('0x26')==typeof _0x1370b8[_0x7c39('0x81')][_0x7c39('0x88')]){return _0x1fbe3b(new Error(_0x7c39('0x89')));}if(_0x7c39('0x26')==typeof _0x1370b8['parameters'][_0x7c39('0x8a')]){return _0x1fbe3b(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x1fbe3b(new Error(_0x7c39('0x8b')));}var _0x4b8292=_0x1370b8['name'];var _0x2bb4b7=_0x1370b8[_0x7c39('0x8c')];var _0x441a89=_0x1370b8['type'];var _0x4003f5=_0x1370b8[_0x7c39('0x8d')]?_0x1370b8['sidebar']:_0x7c39('0x8e');var _0x458190=_0x1370b8[_0x7c39('0x8f')]?_0x1370b8['icon']:'icon-apps';var _0x88e66d='';var _0x1f8d10='';var _0xb2661f='';var _0x23f720='';var _0x481112=_0x1370b8['version'];if(_0x441a89===_0x7c39('0x80')){if(_0x7c39('0x26')!=typeof _0x1370b8[_0x7c39('0x81')][_0x7c39('0x83')][_0x7c39('0x84')]){var _0x415430=_0x1370b8[_0x7c39('0x81')][_0x7c39('0x83')][_0x7c39('0x84')];if(!/^(f|ht)tps?:\/\//i['test'](_0x415430)){_0x88e66d=path[_0x7c39('0x60')](_0x7c39('0x90'),_0x2492d9,_0x130a80[0x0],_0x415430);}else{_0x88e66d=_0x415430;}}else{logger[_0x7c39('0x6f')](_0x7c39('0x91'));}if(_0x7c39('0x26')!=typeof _0x1370b8[_0x7c39('0x81')]['views'][_0x7c39('0x85')]){var _0x760abc=_0x1370b8['parameters'][_0x7c39('0x83')][_0x7c39('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x7c39('0x92')](_0x760abc)){_0x1f8d10=path[_0x7c39('0x60')](_0x7c39('0x90'),_0x2492d9,_0x130a80[0x0],_0x760abc);}else{_0x1f8d10=_0x760abc;}}else{logger[_0x7c39('0x6f')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x441a89===_0x7c39('0x87')){_0xb2661f=_0x1370b8[_0x7c39('0x81')][_0x7c39('0x88')];_0x23f720=_0x1370b8[_0x7c39('0x81')][_0x7c39('0x8a')];if('undefined'!=typeof _0x1370b8[_0x7c39('0x81')]['views']){if(_0x7c39('0x26')!=typeof _0x1370b8['parameters'][_0x7c39('0x83')]['admin']){var _0x415430=_0x1370b8['parameters']['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x7c39('0x92')](_0x415430)){_0x88e66d=path['join']('plugins',_0x2492d9,_0x130a80[0x0],_0x415430);}else{_0x88e66d=_0x415430;}}if(_0x7c39('0x26')!=typeof _0x1370b8[_0x7c39('0x81')][_0x7c39('0x83')][_0x7c39('0x85')]){var _0x760abc=_0x1370b8[_0x7c39('0x81')][_0x7c39('0x83')][_0x7c39('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x7c39('0x92')](_0x760abc)){_0x1f8d10=path[_0x7c39('0x60')]('plugins',_0x2492d9,_0x130a80[0x0],_0x760abc);}else{_0x1f8d10=_0x760abc;}}}}var _0x105c5f={'name':_0x4b8292,'description':_0x2bb4b7,'path':path['join'](_0x2492d9,_0x130a80[0x0]),'type':_0x441a89,'sidebar':_0x4003f5,'icon':_0x458190,'adminUrl':_0x88e66d,'agentUrl':_0x1f8d10,'scriptName':_0xb2661f,'scriptPath':_0x23f720,'version':_0x481112};removeReferences(_0x4debcc,null);return db[_0x7c39('0x48')]['create'](_0x105c5f)[_0x7c39('0x2e')](function(_0x44da2e){var _0x11a5b4={'role':_0x24f638[_0x7c39('0x93')][_0x7c39('0x94')],'userProfileId':_0x24f638[_0x7c39('0x93')]['userProfileId']};if(!_0x11a5b4)throw new Error(_0x7c39('0x95'));if(_0x11a5b4[_0x7c39('0x94')]===_0x7c39('0x96')){var _0x12db2d=_0x44da2e[_0x7c39('0x2f')]({'plain':!![]});return db[_0x7c39('0x97')]['find']({'where':{'name':_0x7c39('0x30'),'userProfileId':_0x11a5b4[_0x7c39('0x98')]},'raw':!![]})[_0x7c39('0x2e')](function(_0x33feb0){if(_0x33feb0&&_0x33feb0['autoAssociation']===0x0){return db[_0x7c39('0x31')]['create']({'name':_0x12db2d[_0x7c39('0x35')],'resourceId':_0x12db2d['id'],'type':_0x33feb0[_0x7c39('0x35')],'sectionId':_0x33feb0['id']},{})[_0x7c39('0x2e')](function(){return _0x44da2e;});}else{return _0x44da2e;}})[_0x7c39('0x4c')](function(_0xb02ff8){logger[_0x7c39('0x33')](_0x7c39('0x99'),_0xb02ff8);throw _0xb02ff8;});}return _0x44da2e;})[_0x7c39('0x2e')](respondWithResult(_0x5260c5,null))[_0x7c39('0x4c')](handleError(_0x5260c5,null));}});}catch(_0x3175a2){_0x5260c5[_0x7c39('0x23')](0x1f4)[_0x7c39('0x9a')](_0x3175a2);}};function removeReferences(_0x308eba,_0x1cc94a){try{if(_0x308eba){fs[_0x7c39('0x69')](_0x308eba);logger[_0x7c39('0x6f')]('Zip\x20archive\x20removed');}if(_0x1cc94a){rimraf(_0x1cc94a,function(){});logger['info'](_0x7c39('0x9b'));}}catch(_0x36cca2){logger['error'](_0x36cca2);}}exports[_0x7c39('0x9c')]=function(_0x330d6a,_0x589247,_0x176eb3){return db[_0x7c39('0x48')][_0x7c39('0x50')]({'where':{'id':_0x330d6a[_0x7c39('0x9d')]['id']}})[_0x7c39('0x2e')](handleEntityNotFound(_0x589247,null))['then'](saveUpdates(_0x330d6a['body'],null))['then'](respondWithResult(_0x589247,null))[_0x7c39('0x4c')](handleError(_0x589247,null));};exports['delete']=function(_0x3ce16f,_0x479c7e,_0x3c556e){return db[_0x7c39('0x48')][_0x7c39('0x50')]({'where':{'id':_0x3ce16f[_0x7c39('0x9d')]['id']}})[_0x7c39('0x2e')](function(_0x44a86f){if(_0x44a86f){return _0x44a86f['destroy']();}})[_0x7c39('0x2e')](function(_0x48407e){rimraf(path['join'](config['root'],_0x7c39('0x53'),path['dirname'](_0x48407e[_0x7c39('0x9')])),function(){});return _0x48407e;})[_0x7c39('0x2e')](handleEntityNotFound(_0x479c7e,null))[_0x7c39('0x2e')](respondWithStatusCode(_0x479c7e,null))[_0x7c39('0x4c')](handleError(_0x479c7e,null));};exports['webhookGet']=function(_0x4258d3,_0x48bb6d,_0x3fd7ff){return BPromise[_0x7c39('0x9e')]()[_0x7c39('0x2e')](function(){if(!_0x4258d3[_0x7c39('0x3b')][_0x7c39('0x9')]){throw new Error(_0x7c39('0x9f'));}if(!_0x4258d3[_0x7c39('0x3b')]['port']){throw new Error(_0x7c39('0xa0'));}var _0x3d9806=_0x4258d3[_0x7c39('0x3b')][_0x7c39('0xa1')]?_0x4258d3[_0x7c39('0x3b')][_0x7c39('0xa1')]+':'+_0x4258d3[_0x7c39('0x3b')][_0x7c39('0xa2')]:_0x7c39('0xa3')+_0x4258d3['query'][_0x7c39('0xa2')];var _0x5b202a=_0x4258d3[_0x7c39('0x3b')][_0x7c39('0x2b')]?_0x4258d3['query']['json']:!![];var _0x4e198e=_0x4258d3['query'][_0x7c39('0xa4')]?_0x4258d3[_0x7c39('0x3b')]['encoding']:null;var _0x2bd8eb={'method':_0x4258d3[_0x7c39('0xa5')],'uri':util['format'](_0x7c39('0xa6'),_0x3d9806,_0x4258d3[_0x7c39('0x3b')][_0x7c39('0x9')]),'json':_0x5b202a,'resolveWithFullResponse':!![],'encoding':_0x4e198e,'qs':_0x4258d3[_0x7c39('0x3b')]};if(_0x4258d3[_0x7c39('0xa7')]){_0x2bd8eb[_0x7c39('0xa7')]=_0x4258d3[_0x7c39('0xa7')];if(_0x2bd8eb['headers'][_0x7c39('0xa8')]){delete _0x2bd8eb[_0x7c39('0xa7')][_0x7c39('0xa8')];}}if(_0x2bd8eb[_0x7c39('0xa7')][_0x7c39('0xa9')]){delete _0x2bd8eb['headers'][_0x7c39('0xa9')];}return rp(_0x2bd8eb);})[_0x7c39('0x2e')](function(_0x451882){if(_0x451882){_0x48bb6d[_0x7c39('0x29')](_0x451882[_0x7c39('0xa7')]);logger[_0x7c39('0x6f')](_0x451882[_0x7c39('0x93')]);if(_[_0x7c39('0xaa')](_0x4258d3[_0x7c39('0x3b')]['path'],_0x7c39('0x51'))&&_0x451882['statusCode']==0x1f4){return _0x48bb6d['sendStatus'](_0x451882[_0x7c39('0xab')]);}else{return _0x48bb6d[_0x7c39('0x23')](_0x451882[_0x7c39('0xab')])[_0x7c39('0x9a')](_0x451882[_0x7c39('0x93')]);}}else{return _0x48bb6d[_0x7c39('0x22')](0xc8);}})['catch'](handleError(_0x48bb6d,null));};exports[_0x7c39('0xac')]=function(_0x4bc47e,_0xecbcbd,_0x455184){return BPromise['resolve']()[_0x7c39('0x2e')](function(){if(!_0x4bc47e[_0x7c39('0x3b')][_0x7c39('0x9')]){throw new Error(_0x7c39('0x9f'));}if(!_0x4bc47e[_0x7c39('0x3b')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0xd41b86=_0x4bc47e[_0x7c39('0x3b')][_0x7c39('0xa1')]?_0x4bc47e[_0x7c39('0x3b')][_0x7c39('0xa1')]+':'+_0x4bc47e[_0x7c39('0x3b')][_0x7c39('0xa2')]:_0x7c39('0xa3')+_0x4bc47e[_0x7c39('0x3b')]['port'];var _0xca7152=_0x4bc47e['query'][_0x7c39('0x2b')]?_0x4bc47e[_0x7c39('0x3b')][_0x7c39('0x2b')]:!![];var _0x282c3b=_0x4bc47e[_0x7c39('0x3b')]['encoding']?_0x4bc47e[_0x7c39('0x3b')][_0x7c39('0xa4')]:null;var _0x5d1ee1={'method':_0x4bc47e[_0x7c39('0xa5')],'uri':util[_0x7c39('0xad')](_0x7c39('0xa6'),_0xd41b86,_0x4bc47e[_0x7c39('0x3b')]['path']),'json':_0xca7152,'resolveWithFullResponse':!![],'encoding':_0x282c3b,'body':_0x4bc47e[_0x7c39('0x93')]};if(_0x4bc47e[_0x7c39('0xa7')]){_0x5d1ee1['headers']=_0x4bc47e[_0x7c39('0xa7')];if(_0x5d1ee1['headers'][_0x7c39('0xa8')]){delete _0x5d1ee1[_0x7c39('0xa7')][_0x7c39('0xa8')];}}if(_0x5d1ee1[_0x7c39('0xa7')][_0x7c39('0xa9')]){delete _0x5d1ee1['headers'][_0x7c39('0xa9')];}return rp(_0x5d1ee1);})[_0x7c39('0x2e')](function(_0xc3193e){if(_0xc3193e){_0xecbcbd[_0x7c39('0x29')](_0xc3193e[_0x7c39('0xa7')]);logger['info'](_0xc3193e[_0x7c39('0x93')]);return _0xecbcbd[_0x7c39('0x23')](_0xc3193e[_0x7c39('0xab')])[_0x7c39('0x9a')](_0xc3193e[_0x7c39('0x93')]);}else{return _0xecbcbd[_0x7c39('0x22')](0xc8);}})[_0x7c39('0x4c')](handleError(_0xecbcbd,null));}; \ No newline at end of file +var _0x7893=['../../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','socket.io-emitter','./plugin.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','stack','name','send','index','map','Plugin','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','download','find','join','root','server/files/plugins','%s.zip','basename','code','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','dirname','node_modules/**/*','finalize','close','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','info','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','agent','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','icon-apps','version','admin','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s','headers','content-length','content-type','statusCode','webhookPost','http://localhost:','eml-format','rimraf','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','extract-zip','archiver'];(function(_0x51f08e,_0x4e3a97){var _0x5a2674=function(_0x58f759){while(--_0x58f759){_0x51f08e['push'](_0x51f08e['shift']());}};_0x5a2674(++_0x4e3a97);}(_0x7893,0x1e5));var _0x3789=function(_0x1be848,_0x435fe2){_0x1be848=_0x1be848-0x0;var _0x4bf257=_0x7893[_0x1be848];return _0x4bf257;};'use strict';var emlformat=require(_0x3789('0x0'));var rimraf=require(_0x3789('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3789('0x2'));var rp=require('request-promise');var moment=require(_0x3789('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3789('0x4'));var util=require('util');var path=require(_0x3789('0x5'));var sox=require(_0x3789('0x6'));var csv=require(_0x3789('0x7'));var ejs=require(_0x3789('0x8'));var fs=require('fs');var fs_extra=require(_0x3789('0x9'));var _=require(_0x3789('0xa'));var squel=require('squel');var crypto=require(_0x3789('0xb'));var jsforce=require(_0x3789('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3789('0x7'));var querystring=require('querystring');var Papa=require(_0x3789('0xd'));var extract=require(_0x3789('0xe'));var rimraf=require(_0x3789('0x1'));var archiver=require(_0x3789('0xf'));var Redis=require('ioredis');var authService=require(_0x3789('0x10'));var qs=require(_0x3789('0x11'));var as=require(_0x3789('0x12'));var hardwareService=require(_0x3789('0x13'));var logger=require(_0x3789('0x14'))(_0x3789('0x15'));var utils=require(_0x3789('0x16'));var config=require(_0x3789('0x17'));var licenseUtil=require(_0x3789('0x18'));var db=require(_0x3789('0x19'))['db'];config[_0x3789('0x1a')]=_[_0x3789('0x1b')](config[_0x3789('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x3789('0x1c'))(new Redis(config[_0x3789('0x1a')]));require(_0x3789('0x1d'))['register'](socket);function respondWithStatusCode(_0x306cdb,_0xbdf6b6){_0xbdf6b6=_0xbdf6b6||0xcc;return function(_0x1a046c){if(_0x1a046c){return _0x306cdb[_0x3789('0x1e')](_0xbdf6b6);}return _0x306cdb[_0x3789('0x1f')](_0xbdf6b6)[_0x3789('0x20')]();};}function respondWithResult(_0x4013f3,_0x1f70f5){_0x1f70f5=_0x1f70f5||0xc8;return function(_0x319262){if(_0x319262){return _0x4013f3[_0x3789('0x1f')](_0x1f70f5)[_0x3789('0x21')](_0x319262);}};}function respondWithFilteredResult(_0x58266f,_0xe498f5){return function(_0x38ff53){if(_0x38ff53){var _0x96694f=typeof _0xe498f5[_0x3789('0x22')]===_0x3789('0x23')&&typeof _0xe498f5[_0x3789('0x24')]===_0x3789('0x23');var _0x4ee8b3=_0x38ff53[_0x3789('0x25')];var _0x5dd31f=_0x96694f?0x0:_0xe498f5[_0x3789('0x22')];var _0x359cc=_0x96694f?_0x38ff53[_0x3789('0x25')]:_0xe498f5['offset']+_0xe498f5[_0x3789('0x24')];var _0x16ea0b;if(_0x359cc>=_0x4ee8b3){_0x359cc=_0x4ee8b3;_0x16ea0b=0xc8;}else{_0x16ea0b=0xce;}_0x58266f['status'](_0x16ea0b);return _0x58266f[_0x3789('0x26')](_0x3789('0x27'),_0x5dd31f+'-'+_0x359cc+'/'+_0x4ee8b3)[_0x3789('0x21')](_0x38ff53);}return null;};}function patchUpdates(_0x305e7c){return function(_0x2485b1){try{jsonpatch[_0x3789('0x28')](_0x2485b1,_0x305e7c,!![]);}catch(_0x354985){return BPromise[_0x3789('0x29')](_0x354985);}return _0x2485b1[_0x3789('0x2a')]();};}function saveUpdates(_0x5d09f5,_0x520838){return function(_0x564ce8){if(_0x564ce8){return _0x564ce8[_0x3789('0x2b')](_0x5d09f5)['then'](function(_0x34baad){return _0x34baad;});}return null;};}function removeEntity(_0x20a786,_0x3f2d2b){return function(_0x162137){if(_0x162137){return _0x162137['destroy']()[_0x3789('0x2c')](function(){var _0xd9ccbe=_0x162137[_0x3789('0x2d')]({'plain':!![]});var _0x4cb11f='Plugins';return db[_0x3789('0x2e')][_0x3789('0x2f')]({'where':{'type':_0x4cb11f,'resourceId':_0xd9ccbe['id']}})[_0x3789('0x2c')](function(){return _0x162137;});})[_0x3789('0x2c')](function(){_0x20a786[_0x3789('0x1f')](0xcc)[_0x3789('0x20')]();});}};}function handleEntityNotFound(_0x11bac9,_0x159c59){return function(_0x4cf865){if(!_0x4cf865){_0x11bac9[_0x3789('0x1e')](0x194);}return _0x4cf865;};}function handleError(_0x4bcbd7,_0x16929d){_0x16929d=_0x16929d||0x1f4;return function(_0x3c9853){logger['error'](_0x3c9853[_0x3789('0x30')]);if(_0x3c9853[_0x3789('0x31')]){delete _0x3c9853[_0x3789('0x31')];}_0x4bcbd7['status'](_0x16929d)[_0x3789('0x32')](_0x3c9853);};}exports[_0x3789('0x33')]=function(_0x4e408b,_0x13b79f){var _0x30c797={},_0x1d4fbe={},_0x5b5d3a={'count':0x0,'rows':[]};var _0x4f5d6c=_[_0x3789('0x34')](db[_0x3789('0x35')][_0x3789('0x36')],function(_0x1fe8db){return{'name':_0x1fe8db['fieldName'],'type':_0x1fe8db[_0x3789('0x37')][_0x3789('0x38')]};});_0x1d4fbe[_0x3789('0x39')]=_[_0x3789('0x34')](_0x4f5d6c,_0x3789('0x31'));_0x1d4fbe[_0x3789('0x3a')]=_[_0x3789('0x3b')](_0x4e408b[_0x3789('0x3a')]);_0x1d4fbe[_0x3789('0x3c')]=_[_0x3789('0x3d')](_0x1d4fbe[_0x3789('0x39')],_0x1d4fbe[_0x3789('0x3a')]);_0x30c797['attributes']=_[_0x3789('0x3d')](_0x1d4fbe['model'],qs[_0x3789('0x3e')](_0x4e408b[_0x3789('0x3a')][_0x3789('0x3e')]));_0x30c797[_0x3789('0x3f')]=_0x30c797['attributes']['length']?_0x30c797[_0x3789('0x3f')]:_0x1d4fbe[_0x3789('0x39')];if(!_0x4e408b[_0x3789('0x3a')][_0x3789('0x40')](_0x3789('0x41'))){_0x30c797['limit']=qs[_0x3789('0x24')](_0x4e408b[_0x3789('0x3a')][_0x3789('0x24')]);_0x30c797[_0x3789('0x22')]=qs['offset'](_0x4e408b[_0x3789('0x3a')][_0x3789('0x22')]);}_0x30c797['order']=qs[_0x3789('0x42')](_0x4e408b[_0x3789('0x3a')][_0x3789('0x42')]);_0x30c797[_0x3789('0x43')]=qs['filters'](_[_0x3789('0x44')](_0x4e408b[_0x3789('0x3a')],_0x1d4fbe[_0x3789('0x3c')]),_0x4f5d6c);if(_0x4e408b[_0x3789('0x3a')][_0x3789('0x45')]){_0x30c797[_0x3789('0x43')]=_[_0x3789('0x46')](_0x30c797[_0x3789('0x43')],{'$or':_[_0x3789('0x34')](_0x4f5d6c,function(_0x2a7981){if(_0x2a7981[_0x3789('0x37')]!==_0x3789('0x47')){var _0x13d76c={};_0x13d76c[_0x2a7981[_0x3789('0x31')]]={'$like':'%'+_0x4e408b['query']['filter']+'%'};return _0x13d76c;}})});}_0x30c797=_[_0x3789('0x46')]({},_0x30c797,_0x4e408b[_0x3789('0x48')]);var _0x22ec8a={'where':_0x30c797[_0x3789('0x43')]};return db['Plugin'][_0x3789('0x25')](_0x22ec8a)[_0x3789('0x2c')](function(_0x2816bd){_0x5b5d3a['count']=_0x2816bd;if(_0x4e408b[_0x3789('0x3a')][_0x3789('0x49')]){_0x30c797[_0x3789('0x4a')]=[{'all':!![]}];}return db[_0x3789('0x35')]['findAll'](_0x30c797);})[_0x3789('0x2c')](function(_0x196ee6){_0x5b5d3a[_0x3789('0x4b')]=_0x196ee6;return _0x5b5d3a;})[_0x3789('0x2c')](respondWithFilteredResult(_0x13b79f,_0x30c797))[_0x3789('0x4c')](handleError(_0x13b79f,null));};exports[_0x3789('0x4d')]=function(_0x22daad,_0xdf414f){var _0x5cbdd5={'raw':!![],'where':{'id':_0x22daad[_0x3789('0x4e')]['id']}},_0x22a00d={};_0x22a00d[_0x3789('0x39')]=_['keys'](db[_0x3789('0x35')][_0x3789('0x36')]);_0x22a00d[_0x3789('0x3a')]=_[_0x3789('0x3b')](_0x22daad[_0x3789('0x3a')]);_0x22a00d['filters']=_[_0x3789('0x3d')](_0x22a00d['model'],_0x22a00d[_0x3789('0x3a')]);_0x5cbdd5[_0x3789('0x3f')]=_[_0x3789('0x3d')](_0x22a00d[_0x3789('0x39')],qs[_0x3789('0x3e')](_0x22daad[_0x3789('0x3a')]['fields']));_0x5cbdd5[_0x3789('0x3f')]=_0x5cbdd5['attributes'][_0x3789('0x4f')]?_0x5cbdd5[_0x3789('0x3f')]:_0x22a00d[_0x3789('0x39')];if(_0x22daad['query'][_0x3789('0x49')]){_0x5cbdd5['include']=[{'all':!![]}];}_0x5cbdd5=_[_0x3789('0x46')]({},_0x5cbdd5,_0x22daad[_0x3789('0x48')]);return db['Plugin']['find'](_0x5cbdd5)[_0x3789('0x2c')](handleEntityNotFound(_0xdf414f,null))[_0x3789('0x2c')](respondWithResult(_0xdf414f,null))['catch'](handleError(_0xdf414f,null));};exports[_0x3789('0x50')]=function(_0x1cca1e,_0x4e7e10,_0x283452){return db[_0x3789('0x35')][_0x3789('0x51')]({'where':{'id':_0x1cca1e['params']['id']},'attributes':[_0x3789('0x31'),_0x3789('0x5')],'raw':!![]})[_0x3789('0x2c')](handleEntityNotFound(_0x4e7e10,null))[_0x3789('0x2c')](function(_0x2f36dd){if(_0x2f36dd){var _0x1352df=path[_0x3789('0x52')](config[_0x3789('0x53')],_0x3789('0x54'),util['format'](_0x3789('0x55'),path[_0x3789('0x56')](_0x2f36dd[_0x3789('0x5')])));var _0xa48ae9=fs['createWriteStream'](_0x1352df);var _0x2caab4=archiver('zip',{'zlib':{'level':0x9}});_0x2caab4['on']('warning',function(_0x47d46d){if(_0x47d46d[_0x3789('0x57')]==='ENOENT'){logger[_0x3789('0x58')](_0x47d46d);}else{throw new db[(_0x3789('0x59'))][(_0x3789('0x5a'))](_0x3789('0x5b'));}});_0x2caab4['on'](_0x3789('0x58'),function(_0x36466e){throw new db[(_0x3789('0x59'))][(_0x3789('0x5a'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x2caab4[_0x3789('0x5c')](_0xa48ae9);_0x2caab4[_0x3789('0x5d')]('**/*',{'cwd':path[_0x3789('0x52')](config[_0x3789('0x53')],_0x3789('0x54'),path[_0x3789('0x5e')](_0x2f36dd['path'])),'ignore':[path[_0x3789('0x52')](path['basename'](_0x2f36dd[_0x3789('0x5')]),_0x3789('0x5f')),path['join'](path[_0x3789('0x56')](_0x2f36dd[_0x3789('0x5')]),'attachments/**/*')],'nodir':!![]})[_0x3789('0x60')]();_0xa48ae9['on'](_0x3789('0x61'),function(){if(!fs['existsSync'](_0x1352df)){throw new db[(_0x3789('0x59'))]['Error'](_0x3789('0x62'));}return _0x4e7e10[_0x3789('0x50')](_0x1352df,util[_0x3789('0x63')](_0x3789('0x55'),path[_0x3789('0x56')](_0x2f36dd['path'])),function(_0x255369){if(_0x255369){throw new db[(_0x3789('0x59'))][(_0x3789('0x5a'))](_0x3789('0x64'));}fs['unlinkSync'](_0x1352df);logger[_0x3789('0x65')]('Download\x20completed');logger[_0x3789('0x65')](_0x3789('0x66'));});});}return null;})[_0x3789('0x4c')](handleError(_0x4e7e10,null));};exports['upload']=function(_0x2dc118,_0x4b1116,_0x3cc71b){var _0x2b3464=path[_0x3789('0x56')](_0x2dc118[_0x3789('0x67')][_0x3789('0x68')],path[_0x3789('0x69')](_0x2dc118[_0x3789('0x67')][_0x3789('0x68')]));var _0xed411f=path[_0x3789('0x52')](config['root'],_0x3789('0x54'),_0x2dc118[_0x3789('0x67')]['filename']);var _0x45d13f=path[_0x3789('0x52')](config[_0x3789('0x53')],_0x3789('0x54'),_0x2b3464);logger['info'](_0x3789('0x6a'),_0xed411f);logger[_0x3789('0x65')](_0x3789('0x6b'),_0x45d13f);try{fs[_0x3789('0x6c')](_0xed411f,parseInt(_0x3789('0x6d'),0x8));extract(_0xed411f,{'dir':_0x45d13f},function(_0x271e6c){if(_0x271e6c){logger[_0x3789('0x58')](_0x271e6c);handleError(_0x271e6c,!![]);};var _0x26eeb3=fs[_0x3789('0x6e')](_0x45d13f);if(_0x26eeb3[_0x3789('0x4f')]>0x1){removeReferences(_0xed411f,_0x45d13f);logger[_0x3789('0x58')](_0x3789('0x6f'));return _0x3cc71b(new Error(_0x3789('0x6f')));}var _0x51361d=fs[_0x3789('0x70')](path['join'](_0x45d13f,_0x26eeb3[0x0]));if(_0x51361d[_0x3789('0x71')]()){removeReferences(_0xed411f,_0x45d13f);logger['error'](_0x3789('0x6f'));return _0x3cc71b(new Error(_0x3789('0x6f')));}if(_0x51361d[_0x3789('0x72')]()){var _0x44e070=fs[_0x3789('0x6e')](path[_0x3789('0x52')](_0x45d13f,_0x26eeb3[0x0]));if(_0x44e070[_0x3789('0x4f')]===0x0){removeReferences(_0xed411f,_0x45d13f);logger[_0x3789('0x58')](_0x3789('0x6f'));return _0x3cc71b(new Error('Invalid\x20plugin\x20structure'));}var _0x53385f=_0x44e070['some'](function(_0xaad834){return _0xaad834===_0x3789('0x73');});if(!_0x53385f){return _0x3cc71b(new Error(_0x3789('0x74')));}var _0x127dfd=fs[_0x3789('0x75')](path[_0x3789('0x52')](_0x45d13f,_0x26eeb3[0x0],_0x3789('0x73')));var _0x5795c8=JSON['parse'](_0x127dfd);if(_0x3789('0x23')==typeof _0x5795c8[_0x3789('0x31')]){return _0x3cc71b(new Error(_0x3789('0x76')));}if(_0x3789('0x23')==typeof _0x5795c8[_0x3789('0x37')]){return _0x3cc71b(new Error(_0x3789('0x77')));}if(_0x3789('0x23')==typeof _0x5795c8['version']){return _0x3cc71b(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x3789('0x23')==typeof _0x5795c8[_0x3789('0x78')]){return _0x3cc71b(new Error(_0x3789('0x79')));}if(_0x5795c8['type']===_0x3789('0x7a')){if('undefined'==typeof _0x5795c8[_0x3789('0x78')][_0x3789('0x7b')]){return _0x3cc71b(new Error(_0x3789('0x7c')));}if(_0x3789('0x23')==typeof _0x5795c8[_0x3789('0x78')]['views']['admin']&&_0x3789('0x23')==typeof _0x5795c8[_0x3789('0x78')]['views'][_0x3789('0x7d')]){return _0x3cc71b(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x5795c8[_0x3789('0x37')]===_0x3789('0x7e')){if('undefined'==typeof _0x5795c8[_0x3789('0x78')][_0x3789('0x7f')]){return _0x3cc71b(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if('undefined'==typeof _0x5795c8[_0x3789('0x78')][_0x3789('0x80')]){return _0x3cc71b(new Error(_0x3789('0x81')));}}else{return _0x3cc71b(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0xa95e08=_0x5795c8[_0x3789('0x31')];var _0x132528=_0x5795c8[_0x3789('0x82')];var _0x2dfb93=_0x5795c8['type'];var _0x17948b=_0x5795c8[_0x3789('0x83')]?_0x5795c8[_0x3789('0x83')]:_0x3789('0x84');var _0xb6f9bd=_0x5795c8[_0x3789('0x85')]?_0x5795c8[_0x3789('0x85')]:_0x3789('0x86');var _0x333dce='';var _0x545f71='';var _0x4a5c93='';var _0x4c9740='';var _0x41ada1=_0x5795c8[_0x3789('0x87')];if(_0x2dfb93===_0x3789('0x7a')){if(_0x3789('0x23')!=typeof _0x5795c8['parameters'][_0x3789('0x7b')][_0x3789('0x88')]){var _0x14b4ef=_0x5795c8['parameters']['views'][_0x3789('0x88')];if(!/^(f|ht)tps?:\/\//i[_0x3789('0x89')](_0x14b4ef)){_0x333dce=path[_0x3789('0x52')](_0x3789('0x8a'),_0x2b3464,_0x26eeb3[0x0],_0x14b4ef);}else{_0x333dce=_0x14b4ef;}}else{logger[_0x3789('0x65')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x3789('0x23')!=typeof _0x5795c8[_0x3789('0x78')][_0x3789('0x7b')]['agent']){var _0x3d6812=_0x5795c8[_0x3789('0x78')][_0x3789('0x7b')][_0x3789('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x3789('0x89')](_0x3d6812)){_0x545f71=path[_0x3789('0x52')](_0x3789('0x8a'),_0x2b3464,_0x26eeb3[0x0],_0x3d6812);}else{_0x545f71=_0x3d6812;}}else{logger[_0x3789('0x65')](_0x3789('0x8b'));}}else if(_0x2dfb93==='script'){_0x4a5c93=_0x5795c8[_0x3789('0x78')][_0x3789('0x7f')];_0x4c9740=_0x5795c8[_0x3789('0x78')]['scriptPath'];if(_0x3789('0x23')!=typeof _0x5795c8[_0x3789('0x78')][_0x3789('0x7b')]){if(_0x3789('0x23')!=typeof _0x5795c8[_0x3789('0x78')][_0x3789('0x7b')][_0x3789('0x88')]){var _0x14b4ef=_0x5795c8['parameters']['views'][_0x3789('0x88')];if(!/^(f|ht)tps?:\/\//i[_0x3789('0x89')](_0x14b4ef)){_0x333dce=path[_0x3789('0x52')](_0x3789('0x8a'),_0x2b3464,_0x26eeb3[0x0],_0x14b4ef);}else{_0x333dce=_0x14b4ef;}}if(_0x3789('0x23')!=typeof _0x5795c8[_0x3789('0x78')][_0x3789('0x7b')]['agent']){var _0x3d6812=_0x5795c8['parameters'][_0x3789('0x7b')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x3d6812)){_0x545f71=path[_0x3789('0x52')](_0x3789('0x8a'),_0x2b3464,_0x26eeb3[0x0],_0x3d6812);}else{_0x545f71=_0x3d6812;}}}}var _0x2f0be6={'name':_0xa95e08,'description':_0x132528,'path':path[_0x3789('0x52')](_0x2b3464,_0x26eeb3[0x0]),'type':_0x2dfb93,'sidebar':_0x17948b,'icon':_0xb6f9bd,'adminUrl':_0x333dce,'agentUrl':_0x545f71,'scriptName':_0x4a5c93,'scriptPath':_0x4c9740,'version':_0x41ada1};removeReferences(_0xed411f,null);return db[_0x3789('0x35')][_0x3789('0x8c')](_0x2f0be6)[_0x3789('0x2c')](function(_0x17850c){var _0x37f4bd={'role':_0x2dc118[_0x3789('0x8d')][_0x3789('0x8e')],'userProfileId':_0x2dc118[_0x3789('0x8d')][_0x3789('0x8f')]};if(!_0x37f4bd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x37f4bd['role']===_0x3789('0x90')){var _0x12e83b=_0x17850c['get']({'plain':!![]});return db[_0x3789('0x91')][_0x3789('0x51')]({'where':{'name':'Plugins','userProfileId':_0x37f4bd[_0x3789('0x8f')]},'raw':!![]})[_0x3789('0x2c')](function(_0xcebdbf){if(_0xcebdbf&&_0xcebdbf[_0x3789('0x92')]===0x0){return db[_0x3789('0x2e')][_0x3789('0x8c')]({'name':_0x12e83b[_0x3789('0x31')],'resourceId':_0x12e83b['id'],'type':_0xcebdbf[_0x3789('0x31')],'sectionId':_0xcebdbf['id']},{})[_0x3789('0x2c')](function(){return _0x17850c;});}else{return _0x17850c;}})[_0x3789('0x4c')](function(_0x331c49){logger[_0x3789('0x58')](_0x3789('0x93'),_0x331c49);throw _0x331c49;});}return _0x17850c;})[_0x3789('0x2c')](respondWithResult(_0x4b1116,null))[_0x3789('0x4c')](handleError(_0x4b1116,null));}});}catch(_0x41c05d){_0x4b1116[_0x3789('0x1f')](0x1f4)[_0x3789('0x32')](_0x41c05d);}};function removeReferences(_0x38d4d1,_0x43be9f){try{if(_0x38d4d1){fs[_0x3789('0x94')](_0x38d4d1);logger['info'](_0x3789('0x95'));}if(_0x43be9f){rimraf(_0x43be9f,function(){});logger[_0x3789('0x65')](_0x3789('0x96'));}}catch(_0x218f3a){logger[_0x3789('0x58')](_0x218f3a);}}exports['update']=function(_0x3cafab,_0x5ad59c,_0x44a676){return db[_0x3789('0x35')][_0x3789('0x51')]({'where':{'id':_0x3cafab[_0x3789('0x4e')]['id']}})[_0x3789('0x2c')](handleEntityNotFound(_0x5ad59c,null))[_0x3789('0x2c')](saveUpdates(_0x3cafab[_0x3789('0x8d')],null))[_0x3789('0x2c')](respondWithResult(_0x5ad59c,null))[_0x3789('0x4c')](handleError(_0x5ad59c,null));};exports[_0x3789('0x97')]=function(_0x47cac6,_0x4de427,_0xa95f53){return db[_0x3789('0x35')][_0x3789('0x51')]({'where':{'id':_0x47cac6['params']['id']}})[_0x3789('0x2c')](function(_0x194734){if(_0x194734){return _0x194734[_0x3789('0x2f')]();}})[_0x3789('0x2c')](function(_0x44d503){rimraf(path[_0x3789('0x52')](config[_0x3789('0x53')],'server/files/plugins',path[_0x3789('0x5e')](_0x44d503['path'])),function(){});return _0x44d503;})[_0x3789('0x2c')](handleEntityNotFound(_0x4de427,null))[_0x3789('0x2c')](respondWithStatusCode(_0x4de427,null))[_0x3789('0x4c')](handleError(_0x4de427,null));};exports[_0x3789('0x98')]=function(_0x2d8f09,_0x50aae1,_0x4a7061){return BPromise[_0x3789('0x99')]()[_0x3789('0x2c')](function(){if(!_0x2d8f09[_0x3789('0x3a')][_0x3789('0x5')]){throw new Error(_0x3789('0x9a'));}if(!_0x2d8f09[_0x3789('0x3a')][_0x3789('0x9b')]){throw new Error(_0x3789('0x9c'));}var _0x5c8b4=_0x2d8f09[_0x3789('0x3a')][_0x3789('0x9d')]?_0x2d8f09['query']['hostname']+':'+_0x2d8f09['query'][_0x3789('0x9b')]:'http://localhost:'+_0x2d8f09[_0x3789('0x3a')][_0x3789('0x9b')];var _0x31d2f7=_0x2d8f09[_0x3789('0x3a')]['json']?_0x2d8f09[_0x3789('0x3a')][_0x3789('0x21')]:!![];var _0x3f831f=_0x2d8f09[_0x3789('0x3a')]['encoding']?_0x2d8f09[_0x3789('0x3a')][_0x3789('0x9e')]:null;var _0x35c01b={'method':_0x2d8f09[_0x3789('0x9f')],'uri':util['format'](_0x3789('0xa0'),_0x5c8b4,_0x2d8f09['query']['path']),'json':_0x31d2f7,'resolveWithFullResponse':!![],'encoding':_0x3f831f,'qs':_0x2d8f09[_0x3789('0x3a')]};if(_0x2d8f09[_0x3789('0xa1')]){_0x35c01b[_0x3789('0xa1')]=_0x2d8f09[_0x3789('0xa1')];if(_0x35c01b['headers'][_0x3789('0xa2')]){delete _0x35c01b[_0x3789('0xa1')][_0x3789('0xa2')];}}if(_0x35c01b[_0x3789('0xa1')][_0x3789('0xa3')]){delete _0x35c01b[_0x3789('0xa1')][_0x3789('0xa3')];}return rp(_0x35c01b);})[_0x3789('0x2c')](function(_0x1be535){if(_0x1be535){_0x50aae1[_0x3789('0x26')](_0x1be535[_0x3789('0xa1')]);logger[_0x3789('0x65')](_0x1be535['body']);if(_['endsWith'](_0x2d8f09[_0x3789('0x3a')][_0x3789('0x5')],_0x3789('0x50'))&&_0x1be535['statusCode']==0x1f4){return _0x50aae1['sendStatus'](_0x1be535[_0x3789('0xa4')]);}else{return _0x50aae1[_0x3789('0x1f')](_0x1be535[_0x3789('0xa4')])[_0x3789('0x32')](_0x1be535['body']);}}else{return _0x50aae1[_0x3789('0x1e')](0xc8);}})[_0x3789('0x4c')](handleError(_0x50aae1,null));};exports[_0x3789('0xa5')]=function(_0x3ac351,_0x444bb0,_0x4b3d8c){return BPromise[_0x3789('0x99')]()[_0x3789('0x2c')](function(){if(!_0x3ac351[_0x3789('0x3a')][_0x3789('0x5')]){throw new Error(_0x3789('0x9a'));}if(!_0x3ac351['query']['port']){throw new Error(_0x3789('0x9c'));}var _0x191402=_0x3ac351[_0x3789('0x3a')][_0x3789('0x9d')]?_0x3ac351[_0x3789('0x3a')][_0x3789('0x9d')]+':'+_0x3ac351[_0x3789('0x3a')][_0x3789('0x9b')]:_0x3789('0xa6')+_0x3ac351[_0x3789('0x3a')][_0x3789('0x9b')];var _0x3529ff=_0x3ac351[_0x3789('0x3a')]['json']?_0x3ac351[_0x3789('0x3a')][_0x3789('0x21')]:!![];var _0x3bd47e=_0x3ac351[_0x3789('0x3a')]['encoding']?_0x3ac351[_0x3789('0x3a')][_0x3789('0x9e')]:null;var _0x2cefe4={'method':_0x3ac351[_0x3789('0x9f')],'uri':util[_0x3789('0x63')](_0x3789('0xa0'),_0x191402,_0x3ac351['query']['path']),'json':_0x3529ff,'resolveWithFullResponse':!![],'encoding':_0x3bd47e,'body':_0x3ac351[_0x3789('0x8d')]};if(_0x3ac351[_0x3789('0xa1')]){_0x2cefe4[_0x3789('0xa1')]=_0x3ac351[_0x3789('0xa1')];if(_0x2cefe4[_0x3789('0xa1')][_0x3789('0xa2')]){delete _0x2cefe4[_0x3789('0xa1')][_0x3789('0xa2')];}}if(_0x2cefe4[_0x3789('0xa1')][_0x3789('0xa3')]){delete _0x2cefe4[_0x3789('0xa1')][_0x3789('0xa3')];}return rp(_0x2cefe4);})[_0x3789('0x2c')](function(_0x51bfce){if(_0x51bfce){_0x444bb0[_0x3789('0x26')](_0x51bfce[_0x3789('0xa1')]);logger['info'](_0x51bfce['body']);return _0x444bb0[_0x3789('0x1f')](_0x51bfce['statusCode'])[_0x3789('0x32')](_0x51bfce[_0x3789('0x8d')]);}else{return _0x444bb0[_0x3789('0x1e')](0xc8);}})[_0x3789('0x4c')](handleError(_0x444bb0,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 5a3e731..e7d7b6a 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 _0x3ca4=['hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','update','remove','emit'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x3ca4,0x17d));var _0x43ca=function(_0x274b3b,_0x2dd1f0){_0x274b3b=_0x274b3b-0x0;var _0x2b4ef4=_0x3ca4[_0x274b3b];return _0x2b4ef4;};'use strict';var EventEmitter=require(_0x43ca('0x0'));var Plugin=require(_0x43ca('0x1'))['db'][_0x43ca('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x43ca('0x3'),'afterDestroy':_0x43ca('0x4')};function emitEvent(_0x21e96a){return function(_0x23ce52,_0x23c381,_0xc00cdb){PluginEvents[_0x43ca('0x5')](_0x21e96a+':'+_0x23ce52['id'],_0x23ce52);PluginEvents['emit'](_0x21e96a,_0x23ce52);_0xc00cdb(null);};}for(var e in events){if(events[_0x43ca('0x6')](e)){var event=events[e];Plugin[_0x43ca('0x7')](e,emitEvent(event));}}module[_0x43ca('0x8')]=PluginEvents; \ No newline at end of file +var _0x5075=['Plugin','setMaxListeners','save','update','remove','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5075,0x73));var _0x5507=function(_0x4efd3d,_0x2b9694){_0x4efd3d=_0x4efd3d-0x0;var _0x1293f2=_0x5075[_0x4efd3d];return _0x1293f2;};'use strict';var EventEmitter=require(_0x5507('0x0'));var Plugin=require(_0x5507('0x1'))['db'][_0x5507('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x5507('0x3')](0x0);var events={'afterCreate':_0x5507('0x4'),'afterUpdate':_0x5507('0x5'),'afterDestroy':_0x5507('0x6')};function emitEvent(_0x518ca7){return function(_0x3e96ee,_0x19a7ab,_0x8fb8a3){PluginEvents['emit'](_0x518ca7+':'+_0x3e96ee['id'],_0x3e96ee);PluginEvents['emit'](_0x518ca7,_0x3e96ee);_0x8fb8a3(null);};}for(var e in events){if(events[_0x5507('0x7')](e)){var event=events[e];Plugin[_0x5507('0x8')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 79c73f8..14bb40f 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 _0x2260=['plugins','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','define'];(function(_0x500334,_0x962aba){var _0x7fcae=function(_0x2fc48e){while(--_0x2fc48e){_0x500334['push'](_0x500334['shift']());}};_0x7fcae(++_0x962aba);}(_0x2260,0x156));var _0x0226=function(_0xdd827a,_0x482ad2){_0xdd827a=_0xdd827a-0x0;var _0x2f46f1=_0x2260[_0xdd827a];return _0x2f46f1;};'use strict';var _=require('lodash');var util=require(_0x0226('0x0'));var logger=require(_0x0226('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0226('0x2'));var rp=require(_0x0226('0x3'));var fs=require('fs');var path=require(_0x0226('0x4'));var rimraf=require(_0x0226('0x5'));var config=require(_0x0226('0x6'));var attributes=require(_0x0226('0x7'));module[_0x0226('0x8')]=function(_0x216ec4,_0x4f3202){return _0x216ec4[_0x0226('0x9')]('Plugin',attributes,{'tableName':_0x0226('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2f1=['rimraf','../../config/environment','Plugin','lodash','util','api','moment','bluebird','request-promise'];(function(_0x3b176c,_0x9ce908){var _0x1a2600=function(_0x1de6de){while(--_0x1de6de){_0x3b176c['push'](_0x3b176c['shift']());}};_0x1a2600(++_0x9ce908);}(_0xf2f1,0xed));var _0x1f2f=function(_0x237398,_0xc0ef22){_0x237398=_0x237398-0x0;var _0x5598de=_0xf2f1[_0x237398];return _0x5598de;};'use strict';var _=require(_0x1f2f('0x0'));var util=require(_0x1f2f('0x1'));var logger=require('../../config/logger')(_0x1f2f('0x2'));var moment=require(_0x1f2f('0x3'));var BPromise=require(_0x1f2f('0x4'));var rp=require(_0x1f2f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f2f('0x6'));var config=require(_0x1f2f('0x7'));var attributes=require('./plugin.attributes');module['exports']=function(_0x36117a,_0x2ec747){return _0x36117a['define'](_0x1f2f('0x8'),attributes,{'tableName':'plugins','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 7fa5d4e..e22fbb3 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 _0xc102=['message','result','catch','CreatePlugin','body','raw','then','info','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','Plugin,\x20%s,\x20%s','debug','request\x20sent','error','code'];(function(_0x43637d,_0x553e14){var _0x2d7ab3=function(_0x441e1e){while(--_0x441e1e){_0x43637d['push'](_0x43637d['shift']());}};_0x2d7ab3(++_0x553e14);}(_0xc102,0xb8));var _0x2c10=function(_0x16a0e0,_0x2e7c73){_0x16a0e0=_0x16a0e0-0x0;var _0x22fe8f=_0xc102[_0x16a0e0];return _0x22fe8f;};'use strict';var _=require(_0x2c10('0x0'));var util=require(_0x2c10('0x1'));var moment=require(_0x2c10('0x2'));var BPromise=require(_0x2c10('0x3'));var rs=require(_0x2c10('0x4'));var fs=require('fs');var Redis=require(_0x2c10('0x5'));var db=require(_0x2c10('0x6'))['db'];var utils=require(_0x2c10('0x7'));var logger=require(_0x2c10('0x8'))(_0x2c10('0x9'));var config=require(_0x2c10('0xa'));var jayson=require(_0x2c10('0xb'));var client=jayson[_0x2c10('0xc')][_0x2c10('0xd')]({'port':0x232a});config[_0x2c10('0xe')]=_[_0x2c10('0xf')](config[_0x2c10('0xe')],{'host':_0x2c10('0x10'),'port':0x18eb});var socket=require(_0x2c10('0x11'))(new Redis(config['redis']));require(_0x2c10('0x12'))[_0x2c10('0x13')](socket);function respondWithRpcPromise(_0x2dc1d1,_0x5ba5d6,_0x257560){return new BPromise(function(_0x3fd1eb,_0x104335){return client[_0x2c10('0x14')](_0x2dc1d1,_0x257560)['then'](function(_0x1b4d18){logger['info'](_0x2c10('0x15'),_0x5ba5d6,'request\x20sent');logger[_0x2c10('0x16')]('Plugin,\x20%s,\x20%s,\x20%s',_0x5ba5d6,_0x2c10('0x17'),JSON['stringify'](_0x1b4d18));if(_0x1b4d18[_0x2c10('0x18')]){if(_0x1b4d18[_0x2c10('0x18')][_0x2c10('0x19')]===0x1f4){logger[_0x2c10('0x18')](_0x2c10('0x15'),_0x5ba5d6,_0x1b4d18[_0x2c10('0x18')][_0x2c10('0x1a')]);return _0x104335(_0x1b4d18[_0x2c10('0x18')][_0x2c10('0x1a')]);}logger[_0x2c10('0x18')](_0x2c10('0x15'),_0x5ba5d6,_0x1b4d18[_0x2c10('0x18')]['message']);return _0x3fd1eb(_0x1b4d18[_0x2c10('0x18')][_0x2c10('0x1a')]);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x5ba5d6,_0x2c10('0x17'));_0x3fd1eb(_0x1b4d18[_0x2c10('0x1b')][_0x2c10('0x1a')]);}})[_0x2c10('0x1c')](function(_0x16f3b2){logger[_0x2c10('0x18')](_0x2c10('0x15'),_0x5ba5d6,_0x16f3b2);_0x104335(_0x16f3b2);});});}exports[_0x2c10('0x1d')]=function(_0x5d2f85){var _0x340951=this;return new Promise(function(_0x5d2b7a,_0x35d43a){return db['Plugin']['create'](_0x5d2f85[_0x2c10('0x1e')],{'raw':_0x5d2f85['options']?_0x5d2f85['options'][_0x2c10('0x1f')]===undefined?!![]:![]:!![]})[_0x2c10('0x20')](function(_0x32c97a){logger[_0x2c10('0x21')]('CreatePlugin',_0x5d2f85);logger[_0x2c10('0x16')](_0x2c10('0x1d'),_0x5d2f85,JSON[_0x2c10('0x22')](_0x32c97a));_0x5d2b7a(_0x32c97a);})[_0x2c10('0x1c')](function(_0x317aac){logger[_0x2c10('0x18')](_0x2c10('0x1d'),_0x317aac['message'],_0x5d2f85);_0x35d43a(_0x340951['error'](0x1f4,_0x317aac[_0x2c10('0x1a')]));});});}; \ No newline at end of file +var _0x7257=['register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreatePlugin','Plugin','create','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x5b685e,_0x3e69ad){var _0x9a0173=function(_0x5cc6ad){while(--_0x5cc6ad){_0x5b685e['push'](_0x5b685e['shift']());}};_0x9a0173(++_0x3e69ad);}(_0x7257,0x7b));var _0x7725=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0x7257[_0x288f5e];return _0x476cc9;};'use strict';var _=require(_0x7725('0x0'));var util=require(_0x7725('0x1'));var moment=require(_0x7725('0x2'));var BPromise=require(_0x7725('0x3'));var rs=require(_0x7725('0x4'));var fs=require('fs');var Redis=require(_0x7725('0x5'));var db=require(_0x7725('0x6'))['db'];var utils=require(_0x7725('0x7'));var logger=require(_0x7725('0x8'))(_0x7725('0x9'));var config=require('../../config/environment');var jayson=require(_0x7725('0xa'));var client=jayson[_0x7725('0xb')][_0x7725('0xc')]({'port':0x232a});config[_0x7725('0xd')]=_[_0x7725('0xe')](config[_0x7725('0xd')],{'host':_0x7725('0xf'),'port':0x18eb});var socket=require(_0x7725('0x10'))(new Redis(config[_0x7725('0xd')]));require('./plugin.socket')[_0x7725('0x11')](socket);function respondWithRpcPromise(_0x51c442,_0x4bf908,_0x5cb527){return new BPromise(function(_0x3df626,_0x51a67f){return client[_0x7725('0x12')](_0x51c442,_0x5cb527)[_0x7725('0x13')](function(_0x500f87){logger[_0x7725('0x14')](_0x7725('0x15'),_0x4bf908,_0x7725('0x16'));logger[_0x7725('0x17')]('Plugin,\x20%s,\x20%s,\x20%s',_0x4bf908,_0x7725('0x16'),JSON[_0x7725('0x18')](_0x500f87));if(_0x500f87[_0x7725('0x19')]){if(_0x500f87[_0x7725('0x19')][_0x7725('0x1a')]===0x1f4){logger['error']('Plugin,\x20%s,\x20%s',_0x4bf908,_0x500f87[_0x7725('0x19')]['message']);return _0x51a67f(_0x500f87[_0x7725('0x19')][_0x7725('0x1b')]);}logger[_0x7725('0x19')](_0x7725('0x15'),_0x4bf908,_0x500f87[_0x7725('0x19')][_0x7725('0x1b')]);return _0x3df626(_0x500f87[_0x7725('0x19')][_0x7725('0x1b')]);}else{logger[_0x7725('0x14')](_0x7725('0x15'),_0x4bf908,_0x7725('0x16'));_0x3df626(_0x500f87[_0x7725('0x1c')][_0x7725('0x1b')]);}})[_0x7725('0x1d')](function(_0x256f66){logger[_0x7725('0x19')](_0x7725('0x15'),_0x4bf908,_0x256f66);_0x51a67f(_0x256f66);});});}exports[_0x7725('0x1e')]=function(_0x3626c4){var _0xb9054=this;return new Promise(function(_0x2ba414,_0xb5d955){return db[_0x7725('0x1f')][_0x7725('0x20')](_0x3626c4['body'],{'raw':_0x3626c4[_0x7725('0x21')]?_0x3626c4[_0x7725('0x21')][_0x7725('0x22')]===undefined?!![]:![]:!![]})[_0x7725('0x13')](function(_0x50d9b9){logger[_0x7725('0x14')](_0x7725('0x1e'),_0x3626c4);logger[_0x7725('0x17')](_0x7725('0x1e'),_0x3626c4,JSON[_0x7725('0x18')](_0x50d9b9));_0x2ba414(_0x50d9b9);})[_0x7725('0x1d')](function(_0x3c70c3){logger[_0x7725('0x19')](_0x7725('0x1e'),_0x3c70c3[_0x7725('0x1b')],_0x3626c4);_0xb5d955(_0xb9054['error'](0x1f4,_0x3c70c3[_0x7725('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 7c11258..a1c8fc1 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 _0xb6d8=['plugin:','save','remove','emit','register','length'];(function(_0x2be459,_0x2062be){var _0x188a31=function(_0x3f4cbf){while(--_0x3f4cbf){_0x2be459['push'](_0x2be459['shift']());}};_0x188a31(++_0x2062be);}(_0xb6d8,0x145));var _0x8b6d=function(_0x44c79e,_0x5cb645){_0x44c79e=_0x44c79e-0x0;var _0x291a40=_0xb6d8[_0x44c79e];return _0x291a40;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x8b6d('0x0'),_0x8b6d('0x1'),'update'];function createListener(_0x54b2c3,_0x4914d8){return function(_0x2fbec2){_0x4914d8[_0x8b6d('0x2')](_0x54b2c3,_0x2fbec2);};}function removeListener(_0x1f4982,_0x3e0fb3){return function(){PluginEvents['removeListener'](_0x1f4982,_0x3e0fb3);};}exports[_0x8b6d('0x3')]=function(_0x38ce3c){for(var _0x1ff170=0x0,_0x567f5d=events[_0x8b6d('0x4')];_0x1ff170<_0x567f5d;_0x1ff170++){var _0x31fb2f=events[_0x1ff170];var _0x2ab329=createListener(_0x8b6d('0x5')+_0x31fb2f,_0x38ce3c);PluginEvents['on'](_0x31fb2f,_0x2ab329);}}; \ No newline at end of file +var _0xe790=['register','length','./plugin.events','update','emit','removeListener'];(function(_0x34e19c,_0x4a3b2){var _0x30b3bf=function(_0x2767d1){while(--_0x2767d1){_0x34e19c['push'](_0x34e19c['shift']());}};_0x30b3bf(++_0x4a3b2);}(_0xe790,0x15e));var _0x0e79=function(_0x1fedc0,_0x12c33d){_0x1fedc0=_0x1fedc0-0x0;var _0x5a69b4=_0xe790[_0x1fedc0];return _0x5a69b4;};'use strict';var PluginEvents=require(_0x0e79('0x0'));var events=['save','remove',_0x0e79('0x1')];function createListener(_0x16d05a,_0x193b37){return function(_0x2343e3){_0x193b37[_0x0e79('0x2')](_0x16d05a,_0x2343e3);};}function removeListener(_0x5373eb,_0x53a271){return function(){PluginEvents[_0x0e79('0x3')](_0x5373eb,_0x53a271);};}exports[_0x0e79('0x4')]=function(_0x765a7f){for(var _0x51e374=0x0,_0x1f4dfc=events[_0x0e79('0x5')];_0x51e374<_0x1f4dfc;_0x51e374++){var _0x283587=events[_0x51e374];var _0x2c1d32=createListener('plugin:'+_0x283587,_0x765a7f);PluginEvents['on'](_0x283587,_0x2c1d32);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 14a119b..637505a 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(_0x18ed60,_0x3e3d4c){var _0x4cabfd=function(_0x4a83ad){while(--_0x4a83ad){_0x18ed60['push'](_0x18ed60['shift']());}};_0x4cabfd(++_0x3e3d4c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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(_0x1c5c32,_0x3e6148){var _0x4abe42=function(_0x5b7723){while(--_0x5b7723){_0x1c5c32['push'](_0x1c5c32['shift']());}};_0x4abe42(++_0x3e6148);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index fd0a1f0..f04a7db 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 _0xde2c=['start','dump','update','restart','stop','hasOwnProperty','params','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','send','info','list','reject','express','motion2','then','catch','show','create','body','script','cwd','chdir','dirname'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xde2c,0x7f));var _0xcde2=function(_0x2de0a7,_0x38d3e7){_0x2de0a7=_0x2de0a7-0x0;var _0x429437=_0xde2c[_0x2de0a7];return _0x429437;};'use strict';var _=require(_0xcde2('0x0'));var pm2=require(_0xcde2('0x1'));var logger=require(_0xcde2('0x2'))(_0xcde2('0x3'));var path=require(_0xcde2('0x4'));var exec=require(_0xcde2('0x5'))[_0xcde2('0x6')];var BPromise=require(_0xcde2('0x7'));function handleEntityNotFound(_0x55c175,_0x4353c8){return function(_0x196898){if(!_0x196898){_0x55c175[_0xcde2('0x8')](0x194);;}return _0x196898;};}function respondWithResult(_0x1398de,_0x401b16){_0x401b16=_0x401b16||0xc8;return function(_0x53c558){if(_0x53c558){return _0x1398de[_0xcde2('0x9')](_0x401b16)[_0xcde2('0xa')](_0x53c558);}return null;};}function handleError(_0x9c7036,_0x544235){_0x544235=_0x544235||0x1f4;return function(_0x582a6c){logger[_0xcde2('0xb')](_0x582a6c[_0xcde2('0xc')]);if(_0x582a6c['name']){delete _0x582a6c[_0xcde2('0xd')];}_0x9c7036[_0xcde2('0x9')](_0x544235)[_0xcde2('0xe')](_0x582a6c);};}function execChildProcess(){return new BPromise(function(_0x127358,_0x54b7c5){exec('npm\x20install',function(_0x25677f,_0x1bc697,_0x3b1333){logger[_0xcde2('0xf')](_0x1bc697);logger[_0xcde2('0xf')](_0x3b1333);if(_0x25677f){logger[_0xcde2('0xb')](_0x25677f);return _0x54b7c5(_0x25677f);}return _0x127358(_0x1bc697);});});}exports['index']=function(_0x211215,_0x577062){return pm2[_0xcde2('0x10')]()['then'](function(_0x4b0e0e){if(_0x4b0e0e){var _0x34e079=_[_0xcde2('0x11')](_0x4b0e0e,function(_0x417505){return _0x417505[_0xcde2('0xd')]===_0xcde2('0x12')||_0x417505['name']===_0xcde2('0x13');});return{'rows':_0x34e079,'count':_0x34e079['length']};}return null;})[_0xcde2('0x14')](respondWithResult(_0x577062,null))[_0xcde2('0x15')](handleError(_0x577062,null));};exports[_0xcde2('0x16')]=function(_0x1f1858,_0x5223f1){return pm2['describe'](_0x1f1858['params']['id'])[_0xcde2('0x14')](respondWithResult(_0x5223f1,null))['then'](handleEntityNotFound(_0x5223f1,null))[_0xcde2('0x15')](handleError(_0x5223f1,null));};exports[_0xcde2('0x17')]=function(_0x252372,_0x481fc0){if(_0x252372[_0xcde2('0x18')][_0xcde2('0xd')]&&_0x252372[_0xcde2('0x18')][_0xcde2('0x19')]){var _0x43df7a=path['join'](__dirname,'../../files/plugins',_0x252372['body'][_0xcde2('0x19')]);var _0x3e5170=process[_0xcde2('0x1a')]();process[_0xcde2('0x1b')](path[_0xcde2('0x1c')](_0x43df7a));return execChildProcess()['then'](function(_0x1104b8){process['chdir'](_0x3e5170);return pm2[_0xcde2('0x1d')]({'name':_0x252372[_0xcde2('0x18')][_0xcde2('0xd')],'script':_0x43df7a});})['then'](function(_0x593aa4){pm2[_0xcde2('0x1e')]();return _0x593aa4[0x0];})[_0xcde2('0x14')](respondWithResult(_0x481fc0,0xc9))[_0xcde2('0x15')](handleError(_0x481fc0,null));}else{return _0x481fc0[_0xcde2('0x9')](0x1f4)[_0xcde2('0xe')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xcde2('0x1f')]=function(_0x45275a,_0x1dce65){if(_0x45275a['body']['id']){delete _0x45275a[_0xcde2('0x18')]['id'];}var _0x348ca1={'online':_0xcde2('0x20'),'stopped':_0xcde2('0x21')};if(_0x348ca1[_0xcde2('0x22')](_0x45275a[_0xcde2('0x18')][_0xcde2('0x9')])){return pm2[_0x348ca1[_0x45275a[_0xcde2('0x18')]['status']]](_0x45275a[_0xcde2('0x23')]['id'])['then'](respondWithResult(_0x1dce65,0xc8))[_0xcde2('0x15')](handleError(_0x1dce65,null));}else{return _0x1dce65[_0xcde2('0x9')](0x1f4)[_0xcde2('0xe')]({'message':'Unknown\x20status'});}};exports[_0xcde2('0x24')]=function(_0x28fedd,_0x58afb1){if(_0x28fedd[_0xcde2('0x18')]['id']){delete _0x28fedd[_0xcde2('0x18')]['id'];}if(_0x28fedd[_0xcde2('0x23')]['id']){return pm2[_0xcde2('0x25')](_0x28fedd[_0xcde2('0x23')]['id'])[_0xcde2('0x14')](function(_0x11b817){pm2[_0xcde2('0x1e')]();return _0x11b817[0x0];})['then'](respondWithResult(_0x58afb1,null))[_0xcde2('0x15')](handleError(_0x58afb1,null));}else{return _0x58afb1[_0xcde2('0x9')](0x1f4)[_0xcde2('0xe')]({'message':_0xcde2('0x26')});}}; \ No newline at end of file +var _0xb58b=['Unknown\x20status','destroy','params','delete','Unknown\x20id','../../config/pm2','../../config/logger','api','child_process','exec','sendStatus','status','json','error','stack','name','npm\x20install','info','list','then','reject','motion2','length','describe','catch','create','body','join','../../files/plugins','script','cwd','chdir','dirname','start','dump','send','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty'];(function(_0x390bbd,_0x43fd18){var _0x360d20=function(_0x38af28){while(--_0x38af28){_0x390bbd['push'](_0x390bbd['shift']());}};_0x360d20(++_0x43fd18);}(_0xb58b,0x1f1));var _0xbb58=function(_0x18145c,_0x23c102){_0x18145c=_0x18145c-0x0;var _0x52dd35=_0xb58b[_0x18145c];return _0x52dd35;};'use strict';var _=require('lodash');var pm2=require(_0xbb58('0x0'));var logger=require(_0xbb58('0x1'))(_0xbb58('0x2'));var path=require('path');var exec=require(_0xbb58('0x3'))[_0xbb58('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x226363,_0x546510){return function(_0x2edb10){if(!_0x2edb10){_0x226363[_0xbb58('0x5')](0x194);;}return _0x2edb10;};}function respondWithResult(_0x33fe85,_0x5cf8b1){_0x5cf8b1=_0x5cf8b1||0xc8;return function(_0x27cbda){if(_0x27cbda){return _0x33fe85[_0xbb58('0x6')](_0x5cf8b1)[_0xbb58('0x7')](_0x27cbda);}return null;};}function handleError(_0x5d7fe8,_0xd94f1){_0xd94f1=_0xd94f1||0x1f4;return function(_0x3e3144){logger[_0xbb58('0x8')](_0x3e3144[_0xbb58('0x9')]);if(_0x3e3144[_0xbb58('0xa')]){delete _0x3e3144[_0xbb58('0xa')];}_0x5d7fe8[_0xbb58('0x6')](_0xd94f1)['send'](_0x3e3144);};}function execChildProcess(){return new BPromise(function(_0x80ab3a,_0x5c3bf7){exec(_0xbb58('0xb'),function(_0x440392,_0x26d8e6,_0x19d185){logger['info'](_0x26d8e6);logger[_0xbb58('0xc')](_0x19d185);if(_0x440392){logger[_0xbb58('0x8')](_0x440392);return _0x5c3bf7(_0x440392);}return _0x80ab3a(_0x26d8e6);});});}exports['index']=function(_0x132511,_0xdc68b9){return pm2[_0xbb58('0xd')]()[_0xbb58('0xe')](function(_0x19ceda){if(_0x19ceda){var _0x58245f=_[_0xbb58('0xf')](_0x19ceda,function(_0x23fd15){return _0x23fd15['name']==='express'||_0x23fd15[_0xbb58('0xa')]===_0xbb58('0x10');});return{'rows':_0x58245f,'count':_0x58245f[_0xbb58('0x11')]};}return null;})['then'](respondWithResult(_0xdc68b9,null))['catch'](handleError(_0xdc68b9,null));};exports['show']=function(_0x55156e,_0x28637b){return pm2[_0xbb58('0x12')](_0x55156e['params']['id'])[_0xbb58('0xe')](respondWithResult(_0x28637b,null))['then'](handleEntityNotFound(_0x28637b,null))[_0xbb58('0x13')](handleError(_0x28637b,null));};exports[_0xbb58('0x14')]=function(_0x3c33d9,_0xb8f982){if(_0x3c33d9[_0xbb58('0x15')][_0xbb58('0xa')]&&_0x3c33d9[_0xbb58('0x15')]['script']){var _0x84f34=path[_0xbb58('0x16')](__dirname,_0xbb58('0x17'),_0x3c33d9[_0xbb58('0x15')][_0xbb58('0x18')]);var _0x5d4a91=process[_0xbb58('0x19')]();process[_0xbb58('0x1a')](path[_0xbb58('0x1b')](_0x84f34));return execChildProcess()['then'](function(_0x27806d){process['chdir'](_0x5d4a91);return pm2[_0xbb58('0x1c')]({'name':_0x3c33d9[_0xbb58('0x15')][_0xbb58('0xa')],'script':_0x84f34});})[_0xbb58('0xe')](function(_0x2d111c){pm2[_0xbb58('0x1d')]();return _0x2d111c[0x0];})[_0xbb58('0xe')](respondWithResult(_0xb8f982,0xc9))[_0xbb58('0x13')](handleError(_0xb8f982,null));}else{return _0xb8f982['status'](0x1f4)[_0xbb58('0x1e')]({'message':_0xbb58('0x1f')});}};exports[_0xbb58('0x20')]=function(_0x129094,_0x8e9ed9){if(_0x129094[_0xbb58('0x15')]['id']){delete _0x129094[_0xbb58('0x15')]['id'];}var _0x2ce7c3={'online':_0xbb58('0x21'),'stopped':_0xbb58('0x22')};if(_0x2ce7c3[_0xbb58('0x23')](_0x129094[_0xbb58('0x15')][_0xbb58('0x6')])){return pm2[_0x2ce7c3[_0x129094[_0xbb58('0x15')][_0xbb58('0x6')]]](_0x129094['params']['id'])[_0xbb58('0xe')](respondWithResult(_0x8e9ed9,0xc8))[_0xbb58('0x13')](handleError(_0x8e9ed9,null));}else{return _0x8e9ed9[_0xbb58('0x6')](0x1f4)[_0xbb58('0x1e')]({'message':_0xbb58('0x24')});}};exports[_0xbb58('0x25')]=function(_0x1ba526,_0x643e0e){if(_0x1ba526[_0xbb58('0x15')]['id']){delete _0x1ba526['body']['id'];}if(_0x1ba526[_0xbb58('0x26')]['id']){return pm2[_0xbb58('0x27')](_0x1ba526[_0xbb58('0x26')]['id'])[_0xbb58('0xe')](function(_0xdbbe7b){pm2[_0xbb58('0x1d')]();return _0xdbbe7b[0x0];})[_0xbb58('0xe')](respondWithResult(_0x643e0e,null))[_0xbb58('0x13')](handleError(_0x643e0e,null));}else{return _0x643e0e[_0xbb58('0x6')](0x1f4)[_0xbb58('0x1e')]({'message':_0xbb58('0x28')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 0c3ea6b..9d5cd11 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 _0x76f2=['getQueues','exports','express','Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents','/queues'];(function(_0x2eb138,_0x48f6d8){var _0x2a59cb=function(_0x460a00){while(--_0x460a00){_0x2eb138['push'](_0x2eb138['shift']());}};_0x2a59cb(++_0x48f6d8);}(_0x76f2,0x1af));var _0x276f=function(_0x94c5c1,_0x35528a){_0x94c5c1=_0x94c5c1-0x0;var _0x615b88=_0x76f2[_0x94c5c1];return _0x615b88;};'use strict';var express=require(_0x276f('0x0'));var router=express[_0x276f('0x1')]();var auth=require(_0x276f('0x2'));var controller=require(_0x276f('0x3'));router[_0x276f('0x4')](_0x276f('0x5'),auth[_0x276f('0x6')](),controller[_0x276f('0x7')]);router[_0x276f('0x4')](_0x276f('0x8'),auth[_0x276f('0x6')](),controller[_0x276f('0x9')]);module[_0x276f('0xa')]=router; \ No newline at end of file +var _0x2655=['../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents','/queues','getQueues','exports','Router'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2655,0x8b));var _0x5265=function(_0x25930c,_0x51deff){_0x25930c=_0x25930c-0x0;var _0x18bc7b=_0x2655[_0x25930c];return _0x18bc7b;};'use strict';var express=require('express');var router=express[_0x5265('0x0')]();var auth=require(_0x5265('0x1'));var controller=require(_0x5265('0x2'));router[_0x5265('0x3')](_0x5265('0x4'),auth[_0x5265('0x5')](),controller[_0x5265('0x6')]);router[_0x5265('0x3')](_0x5265('0x7'),auth['isAuthenticated'](),controller[_0x5265('0x8')]);module[_0x5265('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 fdc08d8..490180b 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 _0x3651=['mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','faxCurrentCapacity','mailStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','resolve','map','rawAttributes','fieldName','key','query','role','agent','raw','user','userProfileId','sort','UserProfile','getResources','rows','globalStatus','globalStatusFilter','pauseTypeFilter','getQueues','mail','chat','openchannel','fax','whatsapp','channel','includes','Invalid\x20channel','type','getOptions','QueueCampaigns','Queues','findAndCountAll','util','jayson/promise','../../components/parsers/qs','api','../../mysqldb','http','offset','undefined','count','limit','status','set','Content-Range','json','error','stack','name','send','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','waiting','paused','voice','outbound','push','pTalking','originated','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','agents','find','pick','filter','queue','length','busy','internal','toString','talking','getMembers','UserId','accountcode','online','voiceStatus','loggedInDb','User','startCase','Queue','Pause','QueueId','unknown','unavailable','ringing','chatPause','faxPause','openchannelPause','smsPause','voicePause','whatsappPause','pause','every','chatStatus','faxStatus','openchannelStatus','smsStatus','whatsappStatus','idle','getAgents','userpic','pauseType','lastPauseAt','address','mailPause'];(function(_0x30f5bb,_0x4db4bd){var _0x1cfc00=function(_0x20f833){while(--_0x20f833){_0x30f5bb['push'](_0x30f5bb['shift']());}};_0x1cfc00(++_0x4db4bd);}(_0x3651,0x160));var _0x1365=function(_0x4e8660,_0x3d27d0){_0x4e8660=_0x4e8660-0x0;var _0x137a81=_0x3651[_0x4e8660];return _0x137a81;};'use strict';var util=require(_0x1365('0x0'));var _=require('lodash');var jayson=require(_0x1365('0x1'));var qs=require(_0x1365('0x2'));var logger=require('../../config/logger')(_0x1365('0x3'));var db=require(_0x1365('0x4'))['db'];var amiClient=jayson['client'][_0x1365('0x5')]({'port':0x232a});var routingClient=jayson['client'][_0x1365('0x5')]({'port':0x232c});function respondWithFilteredResult(_0x19a877,_0x7b1590){return function(_0x533756){if(_0x533756){var _0x1a40af=typeof _0x7b1590[_0x1365('0x6')]===_0x1365('0x7')&&typeof _0x7b1590['limit']===_0x1365('0x7');var _0x5226bf=_0x533756[_0x1365('0x8')];var _0x3d8660=_0x1a40af?0x0:_0x7b1590[_0x1365('0x6')];var _0x3aab31=_0x1a40af?_0x533756[_0x1365('0x8')]:_0x7b1590[_0x1365('0x6')]+_0x7b1590[_0x1365('0x9')];var _0x1d00a7;if(_0x3aab31>=_0x5226bf){_0x3aab31=_0x5226bf;_0x1d00a7=0xc8;}else{_0x1d00a7=0xce;}_0x19a877[_0x1365('0xa')](_0x1d00a7);return _0x19a877[_0x1365('0xb')](_0x1365('0xc'),_0x3d8660+'-'+_0x3aab31+'/'+_0x5226bf)[_0x1365('0xd')](_0x533756);}return null;};}function handleError(_0x25a6a7,_0x322456){_0x322456=_0x322456||0x1f4;return function(_0x4cac9e){logger[_0x1365('0xe')](_0x4cac9e[_0x1365('0xf')]);if(_0x4cac9e['name']){delete _0x4cac9e[_0x1365('0x10')];}_0x25a6a7[_0x1365('0xa')](_0x322456)[_0x1365('0x11')](_0x4cac9e);};}function getRealtimeAgents(){return new Promise(function(_0x325cab,_0x2c334c){return amiClient[_0x1365('0x12')](_0x1365('0x13'),{})[_0x1365('0x14')](function(_0x793178){if(_0x793178['error'])throw new Error(_0x1365('0x15'));var _0x265013=_0x793178[_0x1365('0x16')];return routingClient[_0x1365('0x12')](_0x1365('0x13'),{})[_0x1365('0x14')](function(_0x489385){if(_0x489385['error'])throw new Error(_0x1365('0x17'));var _0x2d8a63=_0x489385[_0x1365('0x16')];return _0x325cab(_[_0x1365('0x18')]({},_0x265013,_0x2d8a63));});})[_0x1365('0x19')](function(_0x46743e){_0x2c334c(_0x46743e);});});}function getRealtimeQueues(_0x488f08,_0x2e82f4){return new Promise(function(_0x581bc4,_0x554b44){var _0x44408b=_0x2e82f4==='voice'?amiClient:routingClient;return _0x44408b[_0x1365('0x12')](_['startCase'](_0x2e82f4)+'Queues',_0x488f08)['then'](function(_0x3ac0b2){if(_0x3ac0b2[_0x1365('0xe')])throw new Error(util[_0x1365('0x1a')](_0x1365('0x1b'),_0x2e82f4));return _0x581bc4(_0x3ac0b2[_0x1365('0x16')]);})[_0x1365('0x19')](function(_0x25b1f5){_0x554b44(_0x25b1f5);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x1177e6,_0x129f07){return amiClient[_0x1365('0x12')]('VoiceQueuesChannels',{})[_0x1365('0x14')](function(_0x394489){if(_0x394489[_0x1365('0xe')])throw new Error(_0x1365('0x1c'));return _0x1177e6(_0x394489[_0x1365('0x16')]);})[_0x1365('0x19')](function(_0x1a0f90){_0x129f07(_0x1a0f90);});});}function initializeQueues(_0x1c10a6,_0x31f18f,_0x405cac,_0x20b1da){var _0x4ce08b=[_0x1365('0x1d'),_0x1365('0x1e'),_0x1365('0x1f'),'talking',_0x1365('0x20')];if(_0x405cac===_0x1365('0x21')&&_0x20b1da===_0x1365('0x22')){_0x4ce08b[_0x1365('0x23')](_0x1365('0x24'),_0x1365('0x25'),_0x1365('0x26'),_0x1365('0x27'),_0x1365('0x28'),_0x1365('0x29'),_0x1365('0x2a'),_0x1365('0x2b'),_0x1365('0x2c'),_0x1365('0x2d'),'erlangAbandonmentRate',_0x1365('0x2e'),_0x1365('0x2f'),_0x1365('0x30'),_0x1365('0x31'),'predictiveIntervalAvailable',_0x1365('0x32'),_0x1365('0x33'),'predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit',_0x1365('0x34'),_0x1365('0x35'));}return _0x1c10a6['map'](function(_0x55d83e){var _0x53daad=_0x55d83e['get']({'plain':!![]});_0x53daad[_0x1365('0x36')]=[];_0x53daad['paused']=0x0;_0x53daad['loggedInDb']=0x0;_0x53daad[_0x1365('0x1d')]=0x0;_0x53daad[_0x1365('0x1e')]=0x0;_0x53daad['waiting']=0x0;if(_0x405cac===_0x1365('0x21')){_0x53daad['talking']=0x0;_0x53daad['busy']=0x0;if(_0x20b1da===_0x1365('0x22')){_0x53daad[_0x1365('0x24')]=0x0;_0x53daad[_0x1365('0x25')]=0x0;}}var _0x46eab6=_[_0x1365('0x37')](_0x31f18f,['id',_0x53daad['id']]);if(_0x46eab6)_[_0x1365('0x18')](_0x53daad,_[_0x1365('0x38')](_0x46eab6,_0x4ce08b));return _0x53daad;});}function updateAgentVoiceStatus(_0x1ae784,_0x4a9b20,_0xa9e4d5){var _0x60703a=_[_0x1365('0x39')](_0xa9e4d5,[_0x1365('0x3a'),_0x4a9b20[_0x1365('0x10')]]);if(_0x60703a[_0x1365('0x3b')]===0x0)return _0x1ae784[_0x1365('0x3c')]=!![];if(_['some'](_0x60703a,['connectedlinenum',_0x1ae784[_0x1365('0x3d')][_0x1365('0x3e')]()]))return _0x1ae784[_0x1365('0x3f')]=!![];if(!_0x1ae784[_0x1365('0x3f')])return _0x1ae784['busy']=!![];}function getVoiceQueueAgents(_0x4fc5ad,_0x17255c,_0x413979,_0x1773a9){var _0x5be80a=_[_0x1365('0x37')](_0x17255c,['id',_0x4fc5ad['id']]);if(!_0x5be80a)return _0x4fc5ad;return _0x5be80a[_0x1365('0x40')]({'raw':!![]})['then'](function(_0x1d72cb){for(var _0x135292=0x0;_0x135292<_0x1d72cb[_0x1365('0x3b')];_0x135292++){var _0x23f067=_[_0x1365('0x37')](_0x413979,['id',_0x1d72cb[_0x135292]['UserId']]);if(!_0x23f067){_0x23f067={'id':_0x1d72cb[_0x135292][_0x1365('0x41')],'name':_0x1d72cb[_0x135292][_0x1365('0x41')],'accountcode':'','online':![]};}var _0x4992a7={'id':_0x23f067['id'],'name':_0x23f067['name'],'internal':_0x23f067[_0x1365('0x42')],'online':Boolean(_0x23f067[_0x1365('0x43')]),'paused':Boolean(_0x1d72cb[_0x135292][_0x1365('0x20')])};if(_0x23f067[_0x1365('0x44')]===_0x1365('0x3f'))updateAgentVoiceStatus(_0x4992a7,_0x4fc5ad,_0x1773a9);if(_0x4992a7[_0x1365('0x43')])_0x4fc5ad[_0x1365('0x45')]++;if(_0x4992a7['busy'])_0x4fc5ad[_0x1365('0x3c')]++;if(_0x4992a7[_0x1365('0x20')]&&!_0x4992a7[_0x1365('0x3c')]&&!_0x4992a7[_0x1365('0x3f')])_0x4fc5ad[_0x1365('0x20')]++;_0x4fc5ad[_0x1365('0x36')][_0x1365('0x23')](_0x4992a7);}return _0x4fc5ad;});}function getQueueAgents(_0x464da9,_0x3f5b28,_0x17120a){var _0x14d619=_0x1365('0x46')+_[_0x1365('0x47')](_0x17120a)+_0x1365('0x48');var _0x2539e1=_0x17120a+_0x1365('0x49');return db[_0x14d619]['findAll']({'where':{[_[_0x1365('0x47')](_0x17120a)+_0x1365('0x4a')]:_0x464da9['id']},'raw':!![]})[_0x1365('0x14')](function(_0xf2a0f4){for(var _0x36364f=0x0;_0x36364f<_0xf2a0f4['length'];_0x36364f++){var _0x1aa505=_[_0x1365('0x37')](_0x3f5b28,['id',_0xf2a0f4[_0x36364f][_0x1365('0x41')]]);if(!_0x1aa505){_0x1aa505={'id':_0xf2a0f4[_0x36364f][_0x1365('0x41')],'name':_0xf2a0f4[_0x36364f]['UserId'],'online':![],['pauseField']:![]};}var _0x255e11={'id':_0x1aa505['id'],'name':_0x1aa505[_0x1365('0x10')],'online':Boolean(_0x1aa505[_0x1365('0x43')]),'paused':Boolean(_0x1aa505[_0x2539e1])};if(_0x255e11[_0x1365('0x43')])_0x464da9['loggedInDb']++;_0x464da9[_0x1365('0x36')][_0x1365('0x23')](_0x255e11);}return _0x464da9;});}function isIdle(_0x759890){return _0x759890==='idle'||_0x759890===_0x1365('0x4b')||_0x759890===_0x1365('0x4c')||_0x759890===_0x1365('0x4d')||_['isNil'](_0x759890);}function isAgentPaused(_0xde2218,_0x5002d){var _0x8d3e03=[_0xde2218[_0x1365('0x4e')],_0xde2218[_0x1365('0x4f')],_0xde2218['mailPause'],_0xde2218[_0x1365('0x50')],_0xde2218[_0x1365('0x51')],_0xde2218[_0x1365('0x52')],_0xde2218[_0x1365('0x53')]];if(!_0x5002d)return _['every'](_0x8d3e03);var _0x299305=_[_0x1365('0x39')](_0x8d3e03);return _0x299305[_0x1365('0x3b')]>0x0&&_0x299305[_0x1365('0x3b')]<_0x8d3e03[_0x1365('0x3b')]?!![]:![];}function isAgentIdle(_0x21db35){if(_0x21db35[_0x1365('0x44')]!=='idle'&&_0x21db35[_0x1365('0x52')]){_0x21db35[_0x1365('0x44')]=_0x1365('0x54');return![];}return _[_0x1365('0x55')]([_0x21db35[_0x1365('0x56')],_0x21db35[_0x1365('0x57')],_0x21db35['mailStatus'],_0x21db35[_0x1365('0x58')],_0x21db35[_0x1365('0x59')],_0x21db35['voiceStatus'],_0x21db35[_0x1365('0x5a')]],isIdle);}function getAgentStatus(_0x162c13){var _0x16f794=_0x1365('0x4b');if(isAgentPaused(_0x162c13))_0x16f794=_0x1365('0x54');else if(isAgentPaused(_0x162c13,!![]))_0x16f794='*pause';else if(isAgentIdle(_0x162c13))_0x16f794=_0x1365('0x5b');else _0x16f794='busy';return _0x16f794;}exports[_0x1365('0x5c')]=function(_0x222b58,_0x524efe){var _0x21bfc6={'count':0x0,'rows':[]},_0x874c99={},_0xdc10b,_0x4a482d,_0x1959d4=[_0x1365('0x5d'),_0x1365('0x43'),'lastLoginAt','lastPauseAt',_0x1365('0x5e'),_0x1365('0x5f'),'internal',_0x1365('0x60'),_0x1365('0x4e'),_0x1365('0x50'),_0x1365('0x61'),_0x1365('0x51'),_0x1365('0x53'),_0x1365('0x4f'),_0x1365('0x52'),'chatCapacity','openchannelCapacity',_0x1365('0x62'),_0x1365('0x63'),_0x1365('0x64'),_0x1365('0x65'),_0x1365('0x66'),_0x1365('0x67'),_0x1365('0x68'),'smsCurrentCapacity','whatsappCurrentCapacity',_0x1365('0x69'),'chatStatus',_0x1365('0x58'),_0x1365('0x6a'),_0x1365('0x59'),_0x1365('0x5a'),_0x1365('0x57'),_0x1365('0x44'),_0x1365('0x6b'),_0x1365('0x6c'),_0x1365('0x6d'),_0x1365('0x6e'),_0x1365('0x6f'),'faxStatusTime',_0x1365('0x70'),'queue',_0x1365('0x71'),_0x1365('0x72'),_0x1365('0x73'),_0x1365('0x74'),_0x1365('0x75')],_0x3cc884=[_0x1365('0x4e'),_0x1365('0x50'),_0x1365('0x61'),'smsPause',_0x1365('0x53'),_0x1365('0x4f'),_0x1365('0x52'),_0x1365('0x43')];Promise[_0x1365('0x76')]()[_0x1365('0x14')](function(){var _0x119b82=_[_0x1365('0x77')](db[_0x1365('0x46')][_0x1365('0x78')],function(_0xa0bffe){return{'name':_0xa0bffe[_0x1365('0x79')],'type':_0xa0bffe['type'][_0x1365('0x7a')]};});_0x222b58[_0x1365('0x7b')][_0x1365('0x7c')]=_0x1365('0x7d');_0x222b58[_0x1365('0x7b')]['online']=!![];_0x874c99=qs['getOptions'](_0x119b82,_0x222b58);_0x874c99[_0x1365('0x7e')]=!![];if(_0x222b58[_0x1365('0x7f')][_0x1365('0x7c')]===_0x1365('0x7f')){var _0x519cef={'params':{'id':_0x222b58[_0x1365('0x7f')][_0x1365('0x80')]},'query':{'section':_0x1365('0x13'),'role':'agent','online':!![],'nolimit':_0x222b58[_0x1365('0x7b')]['nolimit'],'sort':_0x222b58[_0x1365('0x7b')][_0x1365('0x81')],'filter':_0x222b58[_0x1365('0x7b')][_0x1365('0x39')]},'raw':!![]};return db[_0x1365('0x82')][_0x1365('0x83')](_0x519cef);}return db[_0x1365('0x46')]['findAndCountAll'](_0x874c99);})[_0x1365('0x14')](function(_0x1af640){_0x21bfc6[_0x1365('0x8')]=_0x1af640['count'];_0xdc10b=_0x1af640[_0x1365('0x84')];return getRealtimeAgents();})[_0x1365('0x14')](function(_0x1a878c){_0x4a482d=_0x1a878c[_0x1365('0x84')];return _0xdc10b[_0x1365('0x77')](function(_0x2567bf){var _0x2ef220=_['find'](_0x4a482d,['id',_0x2567bf['id']]);if(_0x2ef220)_[_0x1365('0x18')](_0x2567bf,_[_0x1365('0x38')](_['omit'](_0x2ef220,_0x3cc884),_0x1959d4));_0x2567bf[_0x1365('0x85')]=getAgentStatus(_0x2567bf);return _0x2567bf;});})[_0x1365('0x14')](function(_0xdca86c){if(_0x222b58[_0x1365('0x7b')]['globalStatusFilter']){var _0x2a6ffb=_['filter'](_0xdca86c,['globalStatus',_0x222b58[_0x1365('0x7b')][_0x1365('0x86')]]);if(_0x222b58[_0x1365('0x7b')]['pauseTypeFilter']){_0x2a6ffb=_[_0x1365('0x39')](_0x2a6ffb,[_0x1365('0x5e'),_0x222b58[_0x1365('0x7b')][_0x1365('0x87')]]);}}_0x21bfc6[_0x1365('0x84')]=_0x2a6ffb||_0xdca86c;return _0x21bfc6;})[_0x1365('0x14')](respondWithFilteredResult(_0x524efe,_0x874c99))['catch'](handleError(_0x524efe,null));};exports[_0x1365('0x88')]=function(_0x5783b3,_0x4d836b){var _0x2d4137=[_0x1365('0x89'),_0x1365('0x8a'),'sms',_0x1365('0x8b'),_0x1365('0x8c'),_0x1365('0x8d'),'voice'];var _0x2d3079={'count':0x0,'rows':[]},_0x261e0b={},_0x1f88f9,_0xde6130,_0x40ceea,_0x489148,_0x1e27ca;Promise[_0x1365('0x76')]()['then'](function(){if(_0x5783b3['query'][_0x1365('0x8e')]){if(!_[_0x1365('0x8f')](_0x2d4137,_0x5783b3[_0x1365('0x7b')][_0x1365('0x8e')]['toLowerCase']()))throw new Error(_0x1365('0x90'));_0x1f88f9=_0x5783b3[_0x1365('0x7b')]['channel']['toLowerCase']();}var _0x27aede=_['startCase'](_0x1f88f9)+_0x1365('0x48');var _0x1b2a5f=_[_0x1365('0x77')](db[_0x27aede][_0x1365('0x78')],function(_0x5775d7){return{'name':_0x5775d7[_0x1365('0x79')],'type':_0x5775d7[_0x1365('0x91')][_0x1365('0x7a')]};});_0x261e0b=qs[_0x1365('0x92')](_0x1b2a5f,_0x5783b3);if(_0x5783b3[_0x1365('0x7f')][_0x1365('0x7c')]===_0x1365('0x7f')){var _0x12fb6d={'params':{'id':_0x5783b3['user'][_0x1365('0x80')]},'query':{'section':_0x1f88f9===_0x1365('0x21')&&_0x5783b3[_0x1365('0x7b')][_0x1365('0x91')]==='outbound'?_0x1365('0x93'):_['startCase'](_0x1f88f9)+_0x1365('0x94'),'type':_0x5783b3[_0x1365('0x7b')]['type'],'nolimit':!![],'sort':_0x1365('0x10'),'filter':_0x5783b3[_0x1365('0x7b')][_0x1365('0x39')]}};return db['UserProfile'][_0x1365('0x83')](_0x12fb6d);}return db[_0x27aede][_0x1365('0x95')](_0x261e0b);})[_0x1365('0x14')](function(_0x45f186){_0x2d3079[_0x1365('0x8')]=_0x45f186[_0x1365('0x8')];_0xde6130=_0x45f186[_0x1365('0x84')];return getRealtimeQueues(_0x5783b3,_0x1f88f9);})[_0x1365('0x14')](function(_0x8c98d9){_0x489148=_0x8c98d9['rows'];return getRealtimeAgents();})[_0x1365('0x14')](function(_0x3088c0){_0x40ceea=_0x3088c0[_0x1365('0x84')];if(_0x1f88f9!='voice')return;return getRealtimeVoiceQueueChannels();})[_0x1365('0x14')](function(_0x1dc31e){_0x1e27ca=_0x1dc31e?_0x1dc31e[_0x1365('0x84')]:[];return initializeQueues(_0xde6130,_0x489148,_0x1f88f9,_0x5783b3[_0x1365('0x7b')][_0x1365('0x91')]);})['then'](function(_0x5168c1){var _0x404239=_0x5168c1[_0x1365('0x77')](function(_0x4c2a5b){if(_0x1f88f9===_0x1365('0x21'))return getVoiceQueueAgents(_0x4c2a5b,_0xde6130,_0x40ceea,_0x1e27ca);else return getQueueAgents(_0x4c2a5b,_0x40ceea,_0x1f88f9);});return Promise['all'](_0x404239);})['then'](function(_0x8b703a){_0x2d3079['rows']=_0x8b703a;return _0x2d3079;})[_0x1365('0x14')](respondWithFilteredResult(_0x4d836b,_0x261e0b))[_0x1365('0x19')](handleError(_0x4d836b,null));}; \ No newline at end of file +var _0x1fda=['name','request','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Agents','merge','catch','startCase','Queues','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','available','paused','voice','outbound','push','message','dialMethod','startProgressive','erlangCalls','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','get','loggedInDb','loggedIn','waiting','talking','find','pick','queue','length','busy','connectedlinenum','internal','toString','getMembers','UserId','accountcode','voiceStatus','online','agents','User','Queue','findAll','QueueId','unknown','unavailable','ringing','isNil','chatPause','mailPause','voicePause','whatsappPause','filter','idle','pause','chatStatus','faxStatus','openchannelStatus','smsStatus','whatsappStatus','*pause','userpic','pauseType','address','faxPause','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','mailStatus','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','routealias','smsPause','resolve','map','rawAttributes','fieldName','query','role','agent','raw','user','userProfileId','nolimit','sort','UserProfile','getResources','findAndCountAll','rows','omit','globalStatusFilter','globalStatus','pauseTypeFilter','getQueues','mail','chat','sms','fax','channel','includes','toLowerCase','Invalid\x20channel','type','key','getOptions','util','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','offset','undefined','count','limit','status','set','Content-Range','json'];(function(_0x252eb3,_0x5c4ff5){var _0x3d5e34=function(_0x519e1e){while(--_0x519e1e){_0x252eb3['push'](_0x252eb3['shift']());}};_0x3d5e34(++_0x5c4ff5);}(_0x1fda,0x19b));var _0xa1fd=function(_0x579a16,_0x27986b){_0x579a16=_0x579a16-0x0;var _0x489de6=_0x1fda[_0x579a16];return _0x489de6;};'use strict';var util=require(_0xa1fd('0x0'));var _=require('lodash');var jayson=require('jayson/promise');var qs=require(_0xa1fd('0x1'));var logger=require(_0xa1fd('0x2'))(_0xa1fd('0x3'));var db=require(_0xa1fd('0x4'))['db'];var amiClient=jayson[_0xa1fd('0x5')][_0xa1fd('0x6')]({'port':0x232a});var routingClient=jayson[_0xa1fd('0x5')][_0xa1fd('0x6')]({'port':0x232c});function respondWithFilteredResult(_0x48f3ee,_0x151253){return function(_0x3e4df7){if(_0x3e4df7){var _0x22e1b5=typeof _0x151253[_0xa1fd('0x7')]===_0xa1fd('0x8')&&typeof _0x151253['limit']==='undefined';var _0x8c3ef7=_0x3e4df7[_0xa1fd('0x9')];var _0x48037d=_0x22e1b5?0x0:_0x151253[_0xa1fd('0x7')];var _0x1efb03=_0x22e1b5?_0x3e4df7['count']:_0x151253[_0xa1fd('0x7')]+_0x151253[_0xa1fd('0xa')];var _0x58b5a6;if(_0x1efb03>=_0x8c3ef7){_0x1efb03=_0x8c3ef7;_0x58b5a6=0xc8;}else{_0x58b5a6=0xce;}_0x48f3ee[_0xa1fd('0xb')](_0x58b5a6);return _0x48f3ee[_0xa1fd('0xc')](_0xa1fd('0xd'),_0x48037d+'-'+_0x1efb03+'/'+_0x8c3ef7)[_0xa1fd('0xe')](_0x3e4df7);}return null;};}function handleError(_0x59f895,_0x31db78){_0x31db78=_0x31db78||0x1f4;return function(_0x49ad8f){logger['error'](_0x49ad8f['stack']);if(_0x49ad8f[_0xa1fd('0xf')]){delete _0x49ad8f[_0xa1fd('0xf')];}_0x59f895[_0xa1fd('0xb')](_0x31db78)['send'](_0x49ad8f);};}function getRealtimeAgents(){return new Promise(function(_0x431b37,_0x8dc106){return amiClient[_0xa1fd('0x10')]('Agents',{})[_0xa1fd('0x11')](function(_0x22caf0){if(_0x22caf0[_0xa1fd('0x12')])throw new Error(_0xa1fd('0x13'));var _0x32c000=_0x22caf0[_0xa1fd('0x14')];return routingClient['request'](_0xa1fd('0x15'),{})[_0xa1fd('0x11')](function(_0x13a9e6){if(_0x13a9e6[_0xa1fd('0x12')])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');var _0x28b66a=_0x13a9e6[_0xa1fd('0x14')];return _0x431b37(_[_0xa1fd('0x16')]({},_0x32c000,_0x28b66a));});})[_0xa1fd('0x17')](function(_0x3d8175){_0x8dc106(_0x3d8175);});});}function getRealtimeQueues(_0x36d994,_0x274483){return new Promise(function(_0x4857a3,_0x5e1c9f){var _0x1e9d0d=_0x274483==='voice'?amiClient:routingClient;return _0x1e9d0d[_0xa1fd('0x10')](_[_0xa1fd('0x18')](_0x274483)+_0xa1fd('0x19'),_0x36d994)[_0xa1fd('0x11')](function(_0x35069f){if(_0x35069f['error'])throw new Error(util['format']('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x274483));return _0x4857a3(_0x35069f[_0xa1fd('0x14')]);})[_0xa1fd('0x17')](function(_0x547127){_0x5e1c9f(_0x547127);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x3e8b34,_0xd25ce){return amiClient[_0xa1fd('0x10')](_0xa1fd('0x1a'),{})[_0xa1fd('0x11')](function(_0x40bdcf){if(_0x40bdcf[_0xa1fd('0x12')])throw new Error(_0xa1fd('0x1b'));return _0x3e8b34(_0x40bdcf[_0xa1fd('0x14')]);})[_0xa1fd('0x17')](function(_0x483e0f){_0xd25ce(_0x483e0f);});});}function initializeQueues(_0x1a5068,_0x15e563,_0x429b66,_0x11e820){var _0x3057ca=['loggedIn',_0xa1fd('0x1c'),'waiting','talking',_0xa1fd('0x1d')];if(_0x429b66===_0xa1fd('0x1e')&&_0x11e820===_0xa1fd('0x1f')){_0x3057ca[_0xa1fd('0x20')]('pTalking','originated',_0xa1fd('0x21'),'dialActive',_0xa1fd('0x22'),'Trunk','startPredictive',_0xa1fd('0x23'),_0xa1fd('0x24'),'erlangCallToSecond','erlangAbandonmentRate',_0xa1fd('0x25'),_0xa1fd('0x26'),_0xa1fd('0x27'),_0xa1fd('0x28'),_0xa1fd('0x29'),_0xa1fd('0x2a'),_0xa1fd('0x2b'),'predictiveIntervalDroppedCallsTimeout',_0xa1fd('0x2c'),_0xa1fd('0x2d'),'predictiveIntervalAvgTalktime');}return _0x1a5068['map'](function(_0x5aca0b){var _0x312ecc=_0x5aca0b[_0xa1fd('0x2e')]({'plain':!![]});_0x312ecc['agents']=[];_0x312ecc['paused']=0x0;_0x312ecc[_0xa1fd('0x2f')]=0x0;_0x312ecc[_0xa1fd('0x30')]=0x0;_0x312ecc[_0xa1fd('0x1c')]=0x0;_0x312ecc[_0xa1fd('0x31')]=0x0;if(_0x429b66==='voice'){_0x312ecc[_0xa1fd('0x32')]=0x0;_0x312ecc['busy']=0x0;if(_0x11e820===_0xa1fd('0x1f')){_0x312ecc['pTalking']=0x0;_0x312ecc['originated']=0x0;}}var _0x530d04=_[_0xa1fd('0x33')](_0x15e563,['id',_0x312ecc['id']]);if(_0x530d04)_[_0xa1fd('0x16')](_0x312ecc,_[_0xa1fd('0x34')](_0x530d04,_0x3057ca));return _0x312ecc;});}function updateAgentVoiceStatus(_0x348929,_0x208a16,_0x23035f){var _0x1d940c=_['filter'](_0x23035f,[_0xa1fd('0x35'),_0x208a16[_0xa1fd('0xf')]]);if(_0x1d940c[_0xa1fd('0x36')]===0x0)return _0x348929[_0xa1fd('0x37')]=!![];if(_['some'](_0x1d940c,[_0xa1fd('0x38'),_0x348929[_0xa1fd('0x39')][_0xa1fd('0x3a')]()]))return _0x348929[_0xa1fd('0x32')]=!![];if(!_0x348929['talking'])return _0x348929[_0xa1fd('0x37')]=!![];}function getVoiceQueueAgents(_0x7351a8,_0x56e890,_0x4b4030,_0x416ba9){var _0x2d88ff=_['find'](_0x56e890,['id',_0x7351a8['id']]);if(!_0x2d88ff)return _0x7351a8;return _0x2d88ff[_0xa1fd('0x3b')]({'raw':!![]})[_0xa1fd('0x11')](function(_0x260e12){for(var _0xc9e065=0x0;_0xc9e065<_0x260e12[_0xa1fd('0x36')];_0xc9e065++){var _0x53af97=_[_0xa1fd('0x33')](_0x4b4030,['id',_0x260e12[_0xc9e065][_0xa1fd('0x3c')]]);if(!_0x53af97){_0x53af97={'id':_0x260e12[_0xc9e065][_0xa1fd('0x3c')],'name':_0x260e12[_0xc9e065]['UserId'],'accountcode':'','online':![]};}var _0xfd2c00={'id':_0x53af97['id'],'name':_0x53af97['name'],'internal':_0x53af97[_0xa1fd('0x3d')],'online':Boolean(_0x53af97['online']),'paused':Boolean(_0x260e12[_0xc9e065][_0xa1fd('0x1d')])};if(_0x53af97[_0xa1fd('0x3e')]==='talking')updateAgentVoiceStatus(_0xfd2c00,_0x7351a8,_0x416ba9);if(_0xfd2c00[_0xa1fd('0x3f')])_0x7351a8[_0xa1fd('0x2f')]++;if(_0xfd2c00[_0xa1fd('0x37')])_0x7351a8[_0xa1fd('0x37')]++;if(_0xfd2c00[_0xa1fd('0x1d')]&&!_0xfd2c00[_0xa1fd('0x37')]&&!_0xfd2c00[_0xa1fd('0x32')])_0x7351a8[_0xa1fd('0x1d')]++;_0x7351a8[_0xa1fd('0x40')][_0xa1fd('0x20')](_0xfd2c00);}return _0x7351a8;});}function getQueueAgents(_0x361348,_0x2529d2,_0x2c944c){var _0x5e4a57=_0xa1fd('0x41')+_[_0xa1fd('0x18')](_0x2c944c)+_0xa1fd('0x42');var _0x4d2ad5=_0x2c944c+'Pause';return db[_0x5e4a57][_0xa1fd('0x43')]({'where':{[_[_0xa1fd('0x18')](_0x2c944c)+_0xa1fd('0x44')]:_0x361348['id']},'raw':!![]})[_0xa1fd('0x11')](function(_0x54fa7f){for(var _0x47e7dc=0x0;_0x47e7dc<_0x54fa7f[_0xa1fd('0x36')];_0x47e7dc++){var _0x46bfff=_[_0xa1fd('0x33')](_0x2529d2,['id',_0x54fa7f[_0x47e7dc][_0xa1fd('0x3c')]]);if(!_0x46bfff){_0x46bfff={'id':_0x54fa7f[_0x47e7dc][_0xa1fd('0x3c')],'name':_0x54fa7f[_0x47e7dc][_0xa1fd('0x3c')],'online':![],['pauseField']:![]};}var _0x5bdd2a={'id':_0x46bfff['id'],'name':_0x46bfff[_0xa1fd('0xf')],'online':Boolean(_0x46bfff[_0xa1fd('0x3f')]),'paused':Boolean(_0x46bfff[_0x4d2ad5])};if(_0x5bdd2a['online'])_0x361348[_0xa1fd('0x2f')]++;_0x361348[_0xa1fd('0x40')][_0xa1fd('0x20')](_0x5bdd2a);}return _0x361348;});}function isIdle(_0x3abd52){return _0x3abd52==='idle'||_0x3abd52===_0xa1fd('0x45')||_0x3abd52===_0xa1fd('0x46')||_0x3abd52===_0xa1fd('0x47')||_[_0xa1fd('0x48')](_0x3abd52);}function isAgentPaused(_0x1e2ce0,_0xf97313){var _0x3bfb5c=[_0x1e2ce0[_0xa1fd('0x49')],_0x1e2ce0['faxPause'],_0x1e2ce0[_0xa1fd('0x4a')],_0x1e2ce0['openchannelPause'],_0x1e2ce0['smsPause'],_0x1e2ce0[_0xa1fd('0x4b')],_0x1e2ce0[_0xa1fd('0x4c')]];if(!_0xf97313)return _['every'](_0x3bfb5c);var _0x45d860=_[_0xa1fd('0x4d')](_0x3bfb5c);return _0x45d860[_0xa1fd('0x36')]>0x0&&_0x45d860[_0xa1fd('0x36')]<_0x3bfb5c[_0xa1fd('0x36')]?!![]:![];}function isAgentIdle(_0x3203b2){if(_0x3203b2[_0xa1fd('0x3e')]!==_0xa1fd('0x4e')&&_0x3203b2[_0xa1fd('0x4b')]){_0x3203b2['voiceStatus']=_0xa1fd('0x4f');return![];}return _['every']([_0x3203b2[_0xa1fd('0x50')],_0x3203b2[_0xa1fd('0x51')],_0x3203b2['mailStatus'],_0x3203b2[_0xa1fd('0x52')],_0x3203b2[_0xa1fd('0x53')],_0x3203b2[_0xa1fd('0x3e')],_0x3203b2[_0xa1fd('0x54')]],isIdle);}function getAgentStatus(_0x4871a9){var _0x4c480a=_0xa1fd('0x45');if(isAgentPaused(_0x4871a9))_0x4c480a=_0xa1fd('0x4f');else if(isAgentPaused(_0x4871a9,!![]))_0x4c480a=_0xa1fd('0x55');else if(isAgentIdle(_0x4871a9))_0x4c480a='idle';else _0x4c480a='busy';return _0x4c480a;}exports['getAgents']=function(_0x2f39ae,_0x1da954){var _0x327442={'count':0x0,'rows':[]},_0x2076bc={},_0x4b3066,_0x5f368f,_0x15ae5a=[_0xa1fd('0x56'),'online','lastLoginAt','lastPauseAt',_0xa1fd('0x57'),'lastPauseAt',_0xa1fd('0x39'),_0xa1fd('0x58'),_0xa1fd('0x49'),'openchannelPause',_0xa1fd('0x4a'),'smsPause',_0xa1fd('0x4c'),_0xa1fd('0x59'),_0xa1fd('0x4b'),'chatCapacity',_0xa1fd('0x5a'),_0xa1fd('0x5b'),_0xa1fd('0x5c'),_0xa1fd('0x5d'),_0xa1fd('0x5e'),'chatCurrentCapacity','openchannelCurrentCapacity',_0xa1fd('0x5f'),_0xa1fd('0x60'),_0xa1fd('0x61'),_0xa1fd('0x62'),'chatStatus','openchannelStatus',_0xa1fd('0x63'),_0xa1fd('0x53'),_0xa1fd('0x54'),_0xa1fd('0x51'),'voiceStatus','chatStatusTime','openchannelStatusTime',_0xa1fd('0x64'),_0xa1fd('0x65'),_0xa1fd('0x66'),_0xa1fd('0x67'),_0xa1fd('0x68'),_0xa1fd('0x35'),_0xa1fd('0x69'),_0xa1fd('0x6a'),_0xa1fd('0x6b'),'phoneBarEnableAutomaticScreenRecording',_0xa1fd('0x6c')],_0x4fd474=[_0xa1fd('0x49'),'openchannelPause',_0xa1fd('0x4a'),_0xa1fd('0x6d'),'whatsappPause',_0xa1fd('0x59'),_0xa1fd('0x4b'),_0xa1fd('0x3f')];Promise[_0xa1fd('0x6e')]()[_0xa1fd('0x11')](function(){var _0x4ade79=_[_0xa1fd('0x6f')](db[_0xa1fd('0x41')][_0xa1fd('0x70')],function(_0xf06193){return{'name':_0xf06193[_0xa1fd('0x71')],'type':_0xf06193['type']['key']};});_0x2f39ae[_0xa1fd('0x72')][_0xa1fd('0x73')]=_0xa1fd('0x74');_0x2f39ae['query']['online']=!![];_0x2076bc=qs['getOptions'](_0x4ade79,_0x2f39ae);_0x2076bc[_0xa1fd('0x75')]=!![];if(_0x2f39ae[_0xa1fd('0x76')][_0xa1fd('0x73')]==='user'){var _0x255866={'params':{'id':_0x2f39ae[_0xa1fd('0x76')][_0xa1fd('0x77')]},'query':{'section':'Agents','role':_0xa1fd('0x74'),'online':!![],'nolimit':_0x2f39ae[_0xa1fd('0x72')][_0xa1fd('0x78')],'sort':_0x2f39ae[_0xa1fd('0x72')][_0xa1fd('0x79')],'filter':_0x2f39ae[_0xa1fd('0x72')][_0xa1fd('0x4d')]},'raw':!![]};return db[_0xa1fd('0x7a')][_0xa1fd('0x7b')](_0x255866);}return db[_0xa1fd('0x41')][_0xa1fd('0x7c')](_0x2076bc);})[_0xa1fd('0x11')](function(_0x4d7f8a){_0x327442[_0xa1fd('0x9')]=_0x4d7f8a[_0xa1fd('0x9')];_0x4b3066=_0x4d7f8a[_0xa1fd('0x7d')];return getRealtimeAgents();})[_0xa1fd('0x11')](function(_0x1ba4ec){_0x5f368f=_0x1ba4ec[_0xa1fd('0x7d')];return _0x4b3066[_0xa1fd('0x6f')](function(_0x2069f7){var _0xa5f062=_[_0xa1fd('0x33')](_0x5f368f,['id',_0x2069f7['id']]);if(_0xa5f062)_[_0xa1fd('0x16')](_0x2069f7,_[_0xa1fd('0x34')](_[_0xa1fd('0x7e')](_0xa5f062,_0x4fd474),_0x15ae5a));_0x2069f7['globalStatus']=getAgentStatus(_0x2069f7);return _0x2069f7;});})['then'](function(_0x3bdd11){if(_0x2f39ae[_0xa1fd('0x72')][_0xa1fd('0x7f')]){var _0x23e520=_['filter'](_0x3bdd11,[_0xa1fd('0x80'),_0x2f39ae[_0xa1fd('0x72')][_0xa1fd('0x7f')]]);if(_0x2f39ae['query']['pauseTypeFilter']){_0x23e520=_['filter'](_0x23e520,['pauseType',_0x2f39ae[_0xa1fd('0x72')][_0xa1fd('0x81')]]);}}_0x327442['rows']=_0x23e520||_0x3bdd11;return _0x327442;})[_0xa1fd('0x11')](respondWithFilteredResult(_0x1da954,_0x2076bc))[_0xa1fd('0x17')](handleError(_0x1da954,null));};exports[_0xa1fd('0x82')]=function(_0x4fd461,_0x1e44ae){var _0xd9f347=[_0xa1fd('0x83'),_0xa1fd('0x84'),_0xa1fd('0x85'),'openchannel',_0xa1fd('0x86'),'whatsapp','voice'];var _0x35c135={'count':0x0,'rows':[]},_0x29adf2={},_0x5a3fb9,_0x5738fe,_0x3d2dc8,_0x3834d5,_0x44fc13;Promise['resolve']()['then'](function(){if(_0x4fd461[_0xa1fd('0x72')][_0xa1fd('0x87')]){if(!_[_0xa1fd('0x88')](_0xd9f347,_0x4fd461[_0xa1fd('0x72')][_0xa1fd('0x87')][_0xa1fd('0x89')]()))throw new Error(_0xa1fd('0x8a'));_0x5a3fb9=_0x4fd461[_0xa1fd('0x72')][_0xa1fd('0x87')]['toLowerCase']();}var _0x5895ec=_[_0xa1fd('0x18')](_0x5a3fb9)+_0xa1fd('0x42');var _0x26d715=_[_0xa1fd('0x6f')](db[_0x5895ec][_0xa1fd('0x70')],function(_0x30aa20){return{'name':_0x30aa20[_0xa1fd('0x71')],'type':_0x30aa20[_0xa1fd('0x8b')][_0xa1fd('0x8c')]};});_0x29adf2=qs[_0xa1fd('0x8d')](_0x26d715,_0x4fd461);if(_0x4fd461[_0xa1fd('0x76')][_0xa1fd('0x73')]==='user'){var _0x2268f0={'params':{'id':_0x4fd461[_0xa1fd('0x76')][_0xa1fd('0x77')]},'query':{'section':_0x5a3fb9===_0xa1fd('0x1e')&&_0x4fd461[_0xa1fd('0x72')][_0xa1fd('0x8b')]===_0xa1fd('0x1f')?'QueueCampaigns':_[_0xa1fd('0x18')](_0x5a3fb9)+_0xa1fd('0x19'),'type':_0x4fd461['query']['type'],'nolimit':!![],'sort':_0xa1fd('0xf'),'filter':_0x4fd461[_0xa1fd('0x72')][_0xa1fd('0x4d')]}};return db['UserProfile'][_0xa1fd('0x7b')](_0x2268f0);}return db[_0x5895ec][_0xa1fd('0x7c')](_0x29adf2);})[_0xa1fd('0x11')](function(_0x3838ab){_0x35c135[_0xa1fd('0x9')]=_0x3838ab['count'];_0x5738fe=_0x3838ab[_0xa1fd('0x7d')];return getRealtimeQueues(_0x4fd461,_0x5a3fb9);})[_0xa1fd('0x11')](function(_0x5db66a){_0x3834d5=_0x5db66a['rows'];return getRealtimeAgents();})[_0xa1fd('0x11')](function(_0x4ba6e8){_0x3d2dc8=_0x4ba6e8[_0xa1fd('0x7d')];if(_0x5a3fb9!=_0xa1fd('0x1e'))return;return getRealtimeVoiceQueueChannels();})[_0xa1fd('0x11')](function(_0x251f15){_0x44fc13=_0x251f15?_0x251f15[_0xa1fd('0x7d')]:[];return initializeQueues(_0x5738fe,_0x3834d5,_0x5a3fb9,_0x4fd461['query'][_0xa1fd('0x8b')]);})['then'](function(_0x522ce0){var _0x523759=_0x522ce0[_0xa1fd('0x6f')](function(_0xc0df8b){if(_0x5a3fb9===_0xa1fd('0x1e'))return getVoiceQueueAgents(_0xc0df8b,_0x5738fe,_0x3d2dc8,_0x44fc13);else return getQueueAgents(_0xc0df8b,_0x3d2dc8,_0x5a3fb9);});return Promise['all'](_0x523759);})[_0xa1fd('0x11')](function(_0x534aa4){_0x35c135[_0xa1fd('0x7d')]=_0x534aa4;return _0x35c135;})[_0xa1fd('0x11')](respondWithFilteredResult(_0x1e44ae,_0x29adf2))[_0xa1fd('0x17')](handleError(_0x1e44ae,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index bb99fc4..e2bcfb9 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xdbff26,_0xfc8995){var _0x4adb23=function(_0x291780){while(--_0x291780){_0xdbff26['push'](_0xdbff26['shift']());}};_0x4adb23(++_0xfc8995);}(_0x9c44,0x178));var _0x49c4=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x9c44[_0x5f09c5];return _0x426ad9;};'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(_0x1ee2c0,_0x553cfe){var _0x172947=function(_0x12a362){while(--_0x12a362){_0x1ee2c0['push'](_0x1ee2c0['shift']());}};_0x172947(++_0x553cfe);}(_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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 8014950..99415b6 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 _0xc1fa=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0x222054,_0x45620f){var _0x5de492=function(_0x8ee7b4){while(--_0x8ee7b4){_0x222054['push'](_0x222054['shift']());}};_0x5de492(++_0x45620f);}(_0xc1fa,0x83));var _0xac1f=function(_0x4996d5,_0x123daf){_0x4996d5=_0x4996d5-0x0;var _0x4793f9=_0xc1fa[_0x4996d5];return _0x4793f9;};'use strict';var Sequelize=require(_0xac1f('0x0'));module[_0xac1f('0x1')]={'state':{'type':Sequelize[_0xac1f('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xac1f('0x3')]},'scheduledat':{'type':Sequelize[_0xac1f('0x4')]},'uniqueid':{'type':Sequelize[_0xac1f('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xac1f('0x4')]},'ringtime':{'type':Sequelize[_0xac1f('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xac1f('0x3')]},'campaigntype':{'type':Sequelize[_0xac1f('0x3')]},'membername':{'type':Sequelize[_0xac1f('0x3')]}}; \ No newline at end of file +var _0x0650=['DATE','sequelize','INTEGER','STRING'];(function(_0x4da49e,_0x22afee){var _0x171102=function(_0x47ca17){while(--_0x47ca17){_0x4da49e['push'](_0x4da49e['shift']());}};_0x171102(++_0x22afee);}(_0x0650,0xed));var _0x0065=function(_0x36a560,_0x57378b){_0x36a560=_0x36a560-0x0;var _0x10923a=_0x0650[_0x36a560];return _0x10923a;};'use strict';var Sequelize=require(_0x0065('0x0'));module['exports']={'state':{'type':Sequelize[_0x0065('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x0065('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x0065('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x0065('0x3')]},'ringtime':{'type':Sequelize[_0x0065('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x0065('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x0065('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index d0dfce6..7eb6ab2 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 _0xdc70=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','report_agent_preview','lodash'];(function(_0x154d5d,_0x2fd8ef){var _0x138c13=function(_0x327544){while(--_0x327544){_0x154d5d['push'](_0x154d5d['shift']());}};_0x138c13(++_0x2fd8ef);}(_0xdc70,0x173));var _0x0dc7=function(_0x5470e5,_0x2915c3){_0x5470e5=_0x5470e5-0x0;var _0x24bd75=_0xdc70[_0x5470e5];return _0x24bd75;};'use strict';var _=require(_0x0dc7('0x0'));var util=require(_0x0dc7('0x1'));var logger=require(_0x0dc7('0x2'))(_0x0dc7('0x3'));var moment=require(_0x0dc7('0x4'));var BPromise=require(_0x0dc7('0x5'));var rp=require(_0x0dc7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0dc7('0x7'));var config=require(_0x0dc7('0x8'));var attributes=require(_0x0dc7('0x9'));module[_0x0dc7('0xa')]=function(_0x18de38,_0x5bc634){return _0x18de38['define']('ReportAgentPreview',attributes,{'tableName':_0x0dc7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a3e=['report_agent_preview','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','define','ReportAgentPreview'];(function(_0x339c1f,_0x4d1161){var _0x2c0fb8=function(_0x430e3f){while(--_0x430e3f){_0x339c1f['push'](_0x339c1f['shift']());}};_0x2c0fb8(++_0x4d1161);}(_0x5a3e,0x169));var _0xe5a3=function(_0x36c05c,_0x263754){_0x36c05c=_0x36c05c-0x0;var _0x2d892f=_0x5a3e[_0x36c05c];return _0x2d892f;};'use strict';var _=require(_0xe5a3('0x0'));var util=require(_0xe5a3('0x1'));var logger=require(_0xe5a3('0x2'))('api');var moment=require(_0xe5a3('0x3'));var BPromise=require(_0xe5a3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe5a3('0x5'));var config=require(_0xe5a3('0x6'));var attributes=require('./reportAgentPreview.attributes');module['exports']=function(_0x2a141e,_0x83f699){return _0x2a141e[_0xe5a3('0x7')](_0xe5a3('0x8'),attributes,{'tableName':_0xe5a3('0x9'),'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 19d840f..5e62056 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 _0xf9aa=['debug','request\x20sent','error','code','ReportAgentPreview,\x20%s,\x20%s','message','info','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x3c9c06,_0x4e0395){var _0x32cd7d=function(_0x31b15f){while(--_0x31b15f){_0x3c9c06['push'](_0x3c9c06['shift']());}};_0x32cd7d(++_0x4e0395);}(_0xf9aa,0x15a));var _0xaf9a=function(_0x4ada50,_0x54757b){_0x4ada50=_0x4ada50-0x0;var _0x3d85d5=_0xf9aa[_0x4ada50];return _0x3d85d5;};'use strict';var _=require(_0xaf9a('0x0'));var util=require(_0xaf9a('0x1'));var moment=require(_0xaf9a('0x2'));var BPromise=require(_0xaf9a('0x3'));var rs=require(_0xaf9a('0x4'));var fs=require('fs');var Redis=require(_0xaf9a('0x5'));var db=require(_0xaf9a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xaf9a('0x7'))(_0xaf9a('0x8'));var config=require('../../config/environment');var jayson=require(_0xaf9a('0x9'));var client=jayson[_0xaf9a('0xa')][_0xaf9a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x20ae35,_0x5c4f84,_0x5026bc){return new BPromise(function(_0x452228,_0x5b7eed){return client[_0xaf9a('0xc')](_0x20ae35,_0x5026bc)[_0xaf9a('0xd')](function(_0x10e7e0){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x5c4f84,'request\x20sent');logger[_0xaf9a('0xe')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x5c4f84,_0xaf9a('0xf'),JSON['stringify'](_0x10e7e0));if(_0x10e7e0['error']){if(_0x10e7e0[_0xaf9a('0x10')][_0xaf9a('0x11')]===0x1f4){logger[_0xaf9a('0x10')](_0xaf9a('0x12'),_0x5c4f84,_0x10e7e0[_0xaf9a('0x10')]['message']);return _0x5b7eed(_0x10e7e0['error'][_0xaf9a('0x13')]);}logger[_0xaf9a('0x10')](_0xaf9a('0x12'),_0x5c4f84,_0x10e7e0[_0xaf9a('0x10')][_0xaf9a('0x13')]);return _0x452228(_0x10e7e0[_0xaf9a('0x10')]['message']);}else{logger[_0xaf9a('0x14')]('ReportAgentPreview,\x20%s,\x20%s',_0x5c4f84,_0xaf9a('0xf'));_0x452228(_0x10e7e0[_0xaf9a('0x15')][_0xaf9a('0x13')]);}})[_0xaf9a('0x16')](function(_0x1d4d5c){logger['error'](_0xaf9a('0x12'),_0x5c4f84,_0x1d4d5c);_0x5b7eed(_0x1d4d5c);});});}exports[_0xaf9a('0x17')]=function(_0x33fa7a){var _0x28bfa4=this;return new Promise(function(_0xd6bbad,_0x428da8){return db[_0xaf9a('0x18')][_0xaf9a('0x19')](_0x33fa7a[_0xaf9a('0x1a')],{'raw':_0x33fa7a[_0xaf9a('0x1b')]?_0x33fa7a[_0xaf9a('0x1b')][_0xaf9a('0x1c')]===undefined?!![]:![]:!![]})[_0xaf9a('0xd')](function(_0x12bace){logger['info']('CreateReportAgentPreview',_0x33fa7a);logger[_0xaf9a('0xe')](_0xaf9a('0x17'),_0x33fa7a,JSON[_0xaf9a('0x1d')](_0x12bace));_0xd6bbad(_0x12bace);})[_0xaf9a('0x16')](function(_0x3b3b8f){logger[_0xaf9a('0x10')](_0xaf9a('0x17'),_0x3b3b8f[_0xaf9a('0x13')],_0x33fa7a);_0x428da8(_0x28bfa4[_0xaf9a('0x10')](0x1f4,_0x3b3b8f[_0xaf9a('0x13')]));});});}; \ No newline at end of file +var _0x9c16=['stringify','error','message','result','catch','ReportAgentPreview','create','options','raw','CreateReportAgentPreview','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x49ed67,_0x290989){var _0x1523d5=function(_0x34a179){while(--_0x34a179){_0x49ed67['push'](_0x49ed67['shift']());}};_0x1523d5(++_0x290989);}(_0x9c16,0x190));var _0x69c1=function(_0x378159,_0x3e2f8c){_0x378159=_0x378159-0x0;var _0x4ec2e2=_0x9c16[_0x378159];return _0x4ec2e2;};'use strict';var _=require(_0x69c1('0x0'));var util=require(_0x69c1('0x1'));var moment=require(_0x69c1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x69c1('0x3'));var db=require(_0x69c1('0x4'))['db'];var utils=require(_0x69c1('0x5'));var logger=require(_0x69c1('0x6'))(_0x69c1('0x7'));var config=require('../../config/environment');var jayson=require(_0x69c1('0x8'));var client=jayson[_0x69c1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa1abf5,_0x15cfcc,_0x314bef){return new BPromise(function(_0x583b8d,_0x4b7263){return client[_0x69c1('0xa')](_0xa1abf5,_0x314bef)[_0x69c1('0xb')](function(_0x65fb37){logger[_0x69c1('0xc')](_0x69c1('0xd'),_0x15cfcc,_0x69c1('0xe'));logger[_0x69c1('0xf')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x15cfcc,'request\x20sent',JSON[_0x69c1('0x10')](_0x65fb37));if(_0x65fb37[_0x69c1('0x11')]){if(_0x65fb37[_0x69c1('0x11')]['code']===0x1f4){logger['error'](_0x69c1('0xd'),_0x15cfcc,_0x65fb37['error'][_0x69c1('0x12')]);return _0x4b7263(_0x65fb37['error'][_0x69c1('0x12')]);}logger[_0x69c1('0x11')](_0x69c1('0xd'),_0x15cfcc,_0x65fb37[_0x69c1('0x11')][_0x69c1('0x12')]);return _0x583b8d(_0x65fb37['error']['message']);}else{logger['info'](_0x69c1('0xd'),_0x15cfcc,_0x69c1('0xe'));_0x583b8d(_0x65fb37[_0x69c1('0x13')][_0x69c1('0x12')]);}})[_0x69c1('0x14')](function(_0x35d72e){logger[_0x69c1('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x15cfcc,_0x35d72e);_0x4b7263(_0x35d72e);});});}exports['CreateReportAgentPreview']=function(_0x6a8f4f){var _0x163c48=this;return new Promise(function(_0x5e6502,_0x1e0711){return db[_0x69c1('0x15')][_0x69c1('0x16')](_0x6a8f4f['body'],{'raw':_0x6a8f4f[_0x69c1('0x17')]?_0x6a8f4f['options'][_0x69c1('0x18')]===undefined?!![]:![]:!![]})[_0x69c1('0xb')](function(_0x97ec2a){logger['info'](_0x69c1('0x19'),_0x6a8f4f);logger[_0x69c1('0xf')](_0x69c1('0x19'),_0x6a8f4f,JSON['stringify'](_0x97ec2a));_0x5e6502(_0x97ec2a);})[_0x69c1('0x14')](function(_0x44950b){logger[_0x69c1('0x11')]('CreateReportAgentPreview',_0x44950b[_0x69c1('0x12')],_0x6a8f4f);_0x1e0711(_0x163c48[_0x69c1('0x11')](0x1f4,_0x44950b[_0x69c1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 9f16851..4aacd70 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 _0xc264=['openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','/fax/queues','faxQueues','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','/telephones','/trunks','/campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions'];(function(_0x46e807,_0x4821a4){var _0x44bee4=function(_0x3be339){while(--_0x3be339){_0x46e807['push'](_0x46e807['shift']());}};_0x44bee4(++_0x4821a4);}(_0xc264,0x1a6));var _0x4c26=function(_0x2384f6,_0x167775){_0x2384f6=_0x2384f6-0x0;var _0x370294=_0xc264[_0x2384f6];return _0x370294;};'use strict';var multer=require(_0x4c26('0x0'));var util=require(_0x4c26('0x1'));var path=require(_0x4c26('0x2'));var express=require(_0x4c26('0x3'));var router=express[_0x4c26('0x4')]();var auth=require(_0x4c26('0x5'));var controller=require(_0x4c26('0x6'));router[_0x4c26('0x7')](_0x4c26('0x8'),auth['isAuthenticated'](),controller[_0x4c26('0x9')]);router[_0x4c26('0x7')](_0x4c26('0xa'),auth[_0x4c26('0xb')](),controller[_0x4c26('0xc')]);router['get'](_0x4c26('0xd'),auth['isAuthenticated'](),controller[_0x4c26('0xe')]);router[_0x4c26('0x7')](_0x4c26('0xf'),auth[_0x4c26('0xb')](),controller[_0x4c26('0x10')]);router[_0x4c26('0x7')]('/chat/queues',auth[_0x4c26('0xb')](),controller['chatQueues']);router['get'](_0x4c26('0x11'),auth[_0x4c26('0xb')](),controller[_0x4c26('0x12')]);router[_0x4c26('0x7')](_0x4c26('0x13'),auth[_0x4c26('0xb')](),controller['mailAccounts']);router[_0x4c26('0x7')](_0x4c26('0x14'),auth[_0x4c26('0xb')](),controller[_0x4c26('0x15')]);router[_0x4c26('0x7')](_0x4c26('0x16'),auth[_0x4c26('0xb')](),controller['smsQueues']);router[_0x4c26('0x7')]('/whatsapp/queues',auth[_0x4c26('0xb')](),controller['whatsappQueues']);router[_0x4c26('0x7')](_0x4c26('0x17'),auth[_0x4c26('0xb')](),controller[_0x4c26('0x18')]);router[_0x4c26('0x7')]('/voice/queues/preview/:id',auth['isAuthenticated'](),controller['voiceQueuesPreview']);router['get'](_0x4c26('0x19'),auth[_0x4c26('0xb')](),controller[_0x4c26('0x1a')]);router[_0x4c26('0x7')](_0x4c26('0x1b'),auth[_0x4c26('0xb')](),controller[_0x4c26('0x1c')]);router['get'](_0x4c26('0x1d'),auth[_0x4c26('0xb')](),controller['voiceQueuesChannelHangup']);router[_0x4c26('0x7')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth['isAuthenticated'](),controller[_0x4c26('0x1e')]);router[_0x4c26('0x7')](_0x4c26('0x1f'),auth[_0x4c26('0xb')](),controller[_0x4c26('0x20')]);router[_0x4c26('0x21')]('/voice/queues/:id',auth[_0x4c26('0xb')](),controller[_0x4c26('0x22')]);router[_0x4c26('0x7')](_0x4c26('0x23'),auth[_0x4c26('0xb')](),controller[_0x4c26('0x24')]);router[_0x4c26('0x7')](_0x4c26('0x25'),auth[_0x4c26('0xb')](),controller[_0x4c26('0x26')]);router[_0x4c26('0x7')](_0x4c26('0x27'),auth['isAuthenticated'](),controller[_0x4c26('0x28')]);router[_0x4c26('0x21')](_0x4c26('0x29'),auth[_0x4c26('0xb')](),controller['agentCapacity']);router[_0x4c26('0x7')](_0x4c26('0x2a'),auth['isAuthenticated'](),controller['telephones']);router[_0x4c26('0x7')](_0x4c26('0x2b'),auth['isAuthenticated'](),controller['trunks']);router[_0x4c26('0x7')](_0x4c26('0x2c'),auth[_0x4c26('0xb')](),controller['campaigns']);router[_0x4c26('0x7')](_0x4c26('0x2d'),auth[_0x4c26('0xb')](),controller['faxAccounts']);router['get'](_0x4c26('0x2e'),auth['isAuthenticated'](),controller[_0x4c26('0x2f')]);router[_0x4c26('0x7')](_0x4c26('0x30'),auth[_0x4c26('0xb')](),controller[_0x4c26('0x31')]);router[_0x4c26('0x7')]('/openchannel/queues/waitinginteractions',auth[_0x4c26('0xb')](),controller[_0x4c26('0x32')]);router[_0x4c26('0x7')](_0x4c26('0x33'),auth['isAuthenticated'](),controller[_0x4c26('0x34')]);router[_0x4c26('0x7')]('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x4c26('0x35')]);router[_0x4c26('0x7')](_0x4c26('0x36'),auth['isAuthenticated'](),controller[_0x4c26('0x37')]);router[_0x4c26('0x7')]('/fax/queues/waitinginteractions',auth[_0x4c26('0xb')](),controller[_0x4c26('0x38')]);router[_0x4c26('0x39')]('/mail/queues/:id/notify',auth[_0x4c26('0xb')](),controller[_0x4c26('0x3a')](_0x4c26('0x3b')));router[_0x4c26('0x7')](_0x4c26('0x3c'),auth[_0x4c26('0xb')](),controller[_0x4c26('0x3d')]);router[_0x4c26('0x39')](_0x4c26('0x3e'),auth['isAuthenticated'](),controller[_0x4c26('0x3a')](_0x4c26('0x3f')));router[_0x4c26('0x7')](_0x4c26('0x40'),auth[_0x4c26('0xb')](),controller[_0x4c26('0x41')]);router[_0x4c26('0x39')](_0x4c26('0x42'),auth[_0x4c26('0xb')](),controller[_0x4c26('0x3a')](_0x4c26('0x43')));router[_0x4c26('0x7')](_0x4c26('0x44'),auth[_0x4c26('0xb')](),controller['showFaxQueues']);router[_0x4c26('0x39')]('/openchannel/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0x4c26('0x45')));router[_0x4c26('0x7')](_0x4c26('0x46'),auth[_0x4c26('0xb')](),controller[_0x4c26('0x47')]);router['post'](_0x4c26('0x48'),auth[_0x4c26('0xb')](),controller[_0x4c26('0x3a')]('sms'));router['post']('/whatsapp/queues/:id/notify',auth[_0x4c26('0xb')](),controller['queueNotify'](_0x4c26('0x49')));router['get']('/sms/queues/:id',auth[_0x4c26('0xb')](),controller[_0x4c26('0x4a')]);router[_0x4c26('0x7')](_0x4c26('0x4b'),auth[_0x4c26('0xb')](),controller[_0x4c26('0x4c')]);router[_0x4c26('0x39')]('/agents/:id/notify',auth['isAuthenticated'](),controller[_0x4c26('0x4d')]);module[_0x4c26('0x4e')]=router; \ No newline at end of file +var _0xdd20=['openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','/voice/queues/:id','/outbound','outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','trunks','campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','mail','/mail/queues/:id','queueNotify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','showFaxQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','path','express','Router','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues'];(function(_0xb66224,_0x3a3f2f){var _0x346365=function(_0x51de16){while(--_0x51de16){_0xb66224['push'](_0xb66224['shift']());}};_0x346365(++_0x3a3f2f);}(_0xdd20,0x12a));var _0x0dd2=function(_0x2f9413,_0x721160){_0x2f9413=_0x2f9413-0x0;var _0x3abc04=_0xdd20[_0x2f9413];return _0x3abc04;};'use strict';var multer=require(_0x0dd2('0x0'));var util=require('util');var path=require(_0x0dd2('0x1'));var express=require(_0x0dd2('0x2'));var router=express[_0x0dd2('0x3')]();var auth=require('../../components/auth/service');var controller=require(_0x0dd2('0x4'));router[_0x0dd2('0x5')]('/voice/channels',auth[_0x0dd2('0x6')](),controller[_0x0dd2('0x7')]);router[_0x0dd2('0x5')](_0x0dd2('0x8'),auth[_0x0dd2('0x6')](),controller['voiceChannelMixMonitor']);router[_0x0dd2('0x5')](_0x0dd2('0x9'),auth['isAuthenticated'](),controller[_0x0dd2('0xa')]);router['get'](_0x0dd2('0xb'),auth[_0x0dd2('0x6')](),controller[_0x0dd2('0xc')]);router[_0x0dd2('0x5')]('/chat/queues',auth['isAuthenticated'](),controller[_0x0dd2('0xd')]);router[_0x0dd2('0x5')](_0x0dd2('0xe'),auth[_0x0dd2('0x6')](),controller[_0x0dd2('0xf')]);router[_0x0dd2('0x5')](_0x0dd2('0x10'),auth[_0x0dd2('0x6')](),controller['mailAccounts']);router[_0x0dd2('0x5')](_0x0dd2('0x11'),auth[_0x0dd2('0x6')](),controller[_0x0dd2('0x12')]);router[_0x0dd2('0x5')](_0x0dd2('0x13'),auth['isAuthenticated'](),controller[_0x0dd2('0x14')]);router[_0x0dd2('0x5')](_0x0dd2('0x15'),auth[_0x0dd2('0x6')](),controller[_0x0dd2('0x16')]);router['get'](_0x0dd2('0x17'),auth[_0x0dd2('0x6')](),controller[_0x0dd2('0x18')]);router[_0x0dd2('0x5')](_0x0dd2('0x19'),auth[_0x0dd2('0x6')](),controller[_0x0dd2('0x1a')]);router[_0x0dd2('0x5')]('/voice/queues/channels',auth['isAuthenticated'](),controller[_0x0dd2('0x1b')]);router[_0x0dd2('0x5')](_0x0dd2('0x1c'),auth[_0x0dd2('0x6')](),controller[_0x0dd2('0x1d')]);router['get'](_0x0dd2('0x1e'),auth[_0x0dd2('0x6')](),controller[_0x0dd2('0x1f')]);router[_0x0dd2('0x5')](_0x0dd2('0x20'),auth[_0x0dd2('0x6')](),controller[_0x0dd2('0x21')]);router[_0x0dd2('0x5')]('/voice/queues/:id',auth[_0x0dd2('0x6')](),controller[_0x0dd2('0x22')]);router[_0x0dd2('0x23')](_0x0dd2('0x24'),auth[_0x0dd2('0x6')](),controller['updateVoiceQueue']);router[_0x0dd2('0x5')](_0x0dd2('0x25'),auth[_0x0dd2('0x6')](),controller[_0x0dd2('0x26')]);router[_0x0dd2('0x5')](_0x0dd2('0x27'),auth[_0x0dd2('0x6')](),controller['outboundChannels']);router[_0x0dd2('0x5')](_0x0dd2('0x28'),auth['isAuthenticated'](),controller[_0x0dd2('0x29')]);router[_0x0dd2('0x23')](_0x0dd2('0x2a'),auth[_0x0dd2('0x6')](),controller[_0x0dd2('0x2b')]);router['get'](_0x0dd2('0x2c'),auth[_0x0dd2('0x6')](),controller[_0x0dd2('0x2d')]);router[_0x0dd2('0x5')]('/trunks',auth['isAuthenticated'](),controller[_0x0dd2('0x2e')]);router[_0x0dd2('0x5')]('/campaigns',auth['isAuthenticated'](),controller[_0x0dd2('0x2f')]);router[_0x0dd2('0x5')]('/fax/accounts',auth[_0x0dd2('0x6')](),controller[_0x0dd2('0x30')]);router[_0x0dd2('0x5')](_0x0dd2('0x31'),auth[_0x0dd2('0x6')](),controller[_0x0dd2('0x32')]);router[_0x0dd2('0x5')](_0x0dd2('0x33'),auth[_0x0dd2('0x6')](),controller[_0x0dd2('0x34')]);router['get'](_0x0dd2('0x35'),auth[_0x0dd2('0x6')](),controller[_0x0dd2('0x36')]);router[_0x0dd2('0x5')](_0x0dd2('0x37'),auth[_0x0dd2('0x6')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x0dd2('0x5')](_0x0dd2('0x38'),auth[_0x0dd2('0x6')](),controller[_0x0dd2('0x39')]);router[_0x0dd2('0x5')]('/whatsapp/queues/waitinginteractions',auth['isAuthenticated'](),controller['whatsappQueuesWaitingInteractions']);router[_0x0dd2('0x5')](_0x0dd2('0x3a'),auth[_0x0dd2('0x6')](),controller[_0x0dd2('0x3b')]);router[_0x0dd2('0x3c')](_0x0dd2('0x3d'),auth['isAuthenticated'](),controller['queueNotify'](_0x0dd2('0x3e')));router[_0x0dd2('0x5')](_0x0dd2('0x3f'),auth['isAuthenticated'](),controller['showMailQueues']);router['post']('/chat/queues/:id/notify',auth[_0x0dd2('0x6')](),controller[_0x0dd2('0x40')](_0x0dd2('0x41')));router[_0x0dd2('0x5')](_0x0dd2('0x42'),auth[_0x0dd2('0x6')](),controller[_0x0dd2('0x43')]);router[_0x0dd2('0x3c')](_0x0dd2('0x44'),auth[_0x0dd2('0x6')](),controller[_0x0dd2('0x40')]('fax'));router[_0x0dd2('0x5')]('/fax/queues/:id',auth[_0x0dd2('0x6')](),controller[_0x0dd2('0x45')]);router[_0x0dd2('0x3c')]('/openchannel/queues/:id/notify',auth[_0x0dd2('0x6')](),controller['queueNotify']('openchannel'));router[_0x0dd2('0x5')]('/openchannel/queues/:id',auth['isAuthenticated'](),controller['showOpenchannelQueues']);router[_0x0dd2('0x3c')](_0x0dd2('0x46'),auth[_0x0dd2('0x6')](),controller[_0x0dd2('0x40')](_0x0dd2('0x47')));router[_0x0dd2('0x3c')](_0x0dd2('0x48'),auth[_0x0dd2('0x6')](),controller[_0x0dd2('0x40')](_0x0dd2('0x49')));router['get'](_0x0dd2('0x4a'),auth['isAuthenticated'](),controller['showSmsQueues']);router[_0x0dd2('0x5')](_0x0dd2('0x4b'),auth['isAuthenticated'](),controller[_0x0dd2('0x4c')]);router['post']('/agents/:id/notify',auth['isAuthenticated'](),controller[_0x0dd2('0x4d')]);module[_0x0dd2('0x4e')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index b7be043..cc93e30 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 _0xeff8=['error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','then','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','body','interaction','user','hasOwnProperty','findAll','INTERACTION','format','length','updateAttributes','interface','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','showMailQueues','MailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','\x20Queue\x20not\x20found','findOne','Interaction','\x20Message\x20not\x20found','MessageId','From','QueueId','TransferReport','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','User','Agent\x20not\x20found','Message','messageId','update','InteractionId','create','agentTransferTimeout','bluebird','moment','util','../../mysqldb','../../config/logger','jayson/promise','client','http','request'];(function(_0x46f1a6,_0xc7a582){var _0x38429a=function(_0x31adae){while(--_0x31adae){_0x46f1a6['push'](_0x46f1a6['shift']());}};_0x38429a(++_0xc7a582);}(_0xeff8,0x186));var _0x8eff=function(_0x3f4891,_0x4e6f62){_0x3f4891=_0x3f4891-0x0;var _0x54f2d8=_0xeff8[_0x3f4891];return _0x54f2d8;};'use strict';var BPromise=require(_0x8eff('0x0'));var moment=require(_0x8eff('0x1'));var _=require('lodash');var util=require(_0x8eff('0x2'));var db=require(_0x8eff('0x3'))['db'];var logger=require(_0x8eff('0x4'))('api');var jayson=require(_0x8eff('0x5'));var amiClient=jayson[_0x8eff('0x6')][_0x8eff('0x7')]({'port':0x232a});var mailClient=jayson[_0x8eff('0x6')]['http']({'port':0x232b});var routingClient=jayson[_0x8eff('0x6')][_0x8eff('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x3409bc,_0x323b2,_0x491f01){return new BPromise(function(_0x3fb9ee,_0x19557f){var _0x17f22b=_0x491f01?_0x491f01:amiClient;return _0x17f22b[_0x8eff('0x8')](_0x3409bc,_0x323b2)['then'](function(_0x56f120){if(_0x56f120[_0x8eff('0x9')]){if(_0x56f120[_0x8eff('0x9')][_0x8eff('0xa')]===0x1f4){return _0x19557f(_0x56f120['error'][_0x8eff('0xb')]);}return _0x3fb9ee(_0x56f120[_0x8eff('0x9')]['message']);}else{_0x3fb9ee(_0x56f120[_0x8eff('0xc')]);}})[_0x8eff('0xd')](function(_0x559143){_0x19557f(_0x559143);});});}function respondWithResult(_0x4a399e,_0x45f280){_0x45f280=_0x45f280||0xc8;return function(_0x43c914){if(_0x43c914){return _0x4a399e[_0x8eff('0xe')](_0x45f280)[_0x8eff('0xf')](_0x43c914);}return _0x4a399e[_0x8eff('0x10')](0x194);};}function handleError(_0x56efdf,_0x3e7c01){_0x3e7c01=_0x3e7c01||0x1f4;return function(_0x212a2e){logger[_0x8eff('0x9')](_0x212a2e[_0x8eff('0x11')]);if(_0x212a2e[_0x8eff('0x12')]){delete _0x212a2e[_0x8eff('0x12')];}_0x56efdf[_0x8eff('0xe')](_0x3e7c01)[_0x8eff('0x13')](_0x212a2e);};}function findById(_0x16a4eb){return function(_0x427902){if(!_[_0x8eff('0x14')](_0x16a4eb)&&!_['isNil'](_0x427902)&&!_[_0x8eff('0x14')](_0x427902[_0x8eff('0x15')])){return _[_0x8eff('0x16')](_0x427902[_0x8eff('0x15')],function(_0x2cd7c5){return _0x2cd7c5['id']==_0x16a4eb;});}return null;};}exports[_0x8eff('0x17')]=function(_0x38f5ee,_0x399d96){return respondWithRpcPromise(_0x8eff('0x18'),_0x38f5ee[_0x8eff('0x19')])[_0x8eff('0x1a')](respondWithResult(_0x399d96,null))[_0x8eff('0xd')](handleError(_0x399d96,null));};exports[_0x8eff('0x1b')]=function(_0x2a7337,_0xdbb7b5){return respondWithRpcPromise(_0x8eff('0x1c'),_['merge'](_0x2a7337[_0x8eff('0x19')],_0x2a7337[_0x8eff('0x1d')]))['then'](respondWithResult(_0xdbb7b5,null))[_0x8eff('0xd')](handleError(_0xdbb7b5,null));};exports['voiceChannelStopMixMonitor']=function(_0x2fe360,_0x23c030){return respondWithRpcPromise(_0x8eff('0x1e'),_[_0x8eff('0x1f')](_0x2fe360[_0x8eff('0x19')],_0x2fe360['params']))[_0x8eff('0x1a')](respondWithResult(_0x23c030,null))[_0x8eff('0xd')](handleError(_0x23c030,null));};exports['voiceQueues']=function(_0x15b66f,_0x5ec3d7){return respondWithRpcPromise(_0x8eff('0x20'),_0x15b66f[_0x8eff('0x19')])[_0x8eff('0x1a')](respondWithResult(_0x5ec3d7,null))[_0x8eff('0xd')](handleError(_0x5ec3d7,null));};exports[_0x8eff('0x21')]=function(_0x2e8067,_0x516173){return respondWithRpcPromise(_0x8eff('0x20'),_0x2e8067[_0x8eff('0x19')])[_0x8eff('0x1a')](findById(_0x2e8067[_0x8eff('0x1d')]['id']))[_0x8eff('0x1a')](respondWithResult(_0x516173,null))[_0x8eff('0xd')](handleError(_0x516173,null));};exports['updateVoiceQueue']=function(_0x4ed3b8,_0x44dcdb){return respondWithRpcPromise(_0x8eff('0x22'),_[_0x8eff('0x1f')](_0x4ed3b8['body'],_0x4ed3b8[_0x8eff('0x1d')]))[_0x8eff('0x1a')](respondWithResult(_0x44dcdb,null))[_0x8eff('0xd')](handleError(_0x44dcdb,null));};exports[_0x8eff('0x23')]=function(_0x25b98e,_0x2c5727){return respondWithRpcPromise(_0x8eff('0x24'),_[_0x8eff('0x1f')](_0x25b98e[_0x8eff('0x19')],_0x25b98e[_0x8eff('0x1d')]))[_0x8eff('0x1a')](respondWithResult(_0x2c5727,null))[_0x8eff('0xd')](handleError(_0x2c5727,null));};exports['voiceQueuesChannels']=function(_0x2ad4b7,_0x165f8e){return respondWithRpcPromise(_0x8eff('0x25'),_0x2ad4b7[_0x8eff('0x19')])['then'](respondWithResult(_0x165f8e,null))[_0x8eff('0xd')](handleError(_0x165f8e,null));};exports[_0x8eff('0x26')]=function(_0x4c4220,_0x4e1256){return respondWithRpcPromise(_0x8eff('0x27'),_[_0x8eff('0x1f')](_0x4c4220['query'],_0x4c4220['params']))['then'](respondWithResult(_0x4e1256,null))[_0x8eff('0xd')](handleError(_0x4e1256,null));};exports['voiceQueuesChannelHangup']=function(_0x45d9d4,_0x59c9cc){return respondWithRpcPromise(_0x8eff('0x28'),_[_0x8eff('0x1f')](_0x45d9d4[_0x8eff('0x19')],_0x45d9d4[_0x8eff('0x1d')]))[_0x8eff('0x1a')](respondWithResult(_0x59c9cc,null))[_0x8eff('0xd')](handleError(_0x59c9cc,null));};exports['voiceQueuesChannelRedirect']=function(_0xd95908,_0x5907e0){return respondWithRpcPromise(_0x8eff('0x29'),_['merge'](_0xd95908[_0x8eff('0x19')],_0xd95908[_0x8eff('0x1d')]))[_0x8eff('0x1a')](respondWithResult(_0x5907e0,null))[_0x8eff('0xd')](handleError(_0x5907e0,null));};exports['outbound']=function(_0x2eb4bb,_0x170a33){return respondWithRpcPromise(_0x8eff('0x2a'),_0x2eb4bb['query'])[_0x8eff('0x1a')](respondWithResult(_0x170a33,null))[_0x8eff('0xd')](handleError(_0x170a33,null));};exports[_0x8eff('0x2b')]=function(_0x345bc7,_0x721c71){return respondWithRpcPromise(_0x8eff('0x2c'),_0x345bc7[_0x8eff('0x19')])[_0x8eff('0x1a')](respondWithResult(_0x721c71,null))[_0x8eff('0xd')](handleError(_0x721c71,null));};exports['agents']=function(_0x54a2d9,_0xf67cf3){var _0x114f8e;return respondWithRpcPromise(_0x8eff('0x2d'),_0x54a2d9[_0x8eff('0x19')])[_0x8eff('0x1a')](function(_0x1ba78a){_0x114f8e=_0x1ba78a;return respondWithRpcPromise(_0x8eff('0x2d'),_0x54a2d9['query'],routingClient);})[_0x8eff('0x1a')](function(_0x1c7332){return _['merge']({},_0x1c7332,_0x114f8e);})[_0x8eff('0x1a')](respondWithResult(_0xf67cf3,null))[_0x8eff('0xd')](handleError(_0xf67cf3,null));};exports[_0x8eff('0x2e')]=function(_0x18309b,_0xdc5e2f){if(_0x18309b[_0x8eff('0x2f')]&&_0x18309b[_0x8eff('0x2f')][_0x8eff('0x30')]&&_0x18309b[_0x8eff('0x31')]&&_0x18309b['user'][_0x8eff('0x12')]){for(var _0x27a8c9 in _0x18309b[_0x8eff('0x2f')][_0x8eff('0x30')]){if(_0x18309b[_0x8eff('0x2f')]['interaction'][_0x8eff('0x32')](_0x27a8c9)){db['MemberReport'][_0x8eff('0x33')]({'where':{'channel':_0x27a8c9,'membername':_0x18309b[_0x8eff('0x31')][_0x8eff('0x12')],'type':_0x8eff('0x34'),'exitAt':null,'uniqueid':_0x18309b['body'][_0x8eff('0x30')][_0x27a8c9]&&_0x18309b[_0x8eff('0x2f')][_0x8eff('0x30')][_0x27a8c9]['length']?{'$notIn':_0x18309b['body'][_0x8eff('0x30')][_0x27a8c9]}:{'$ne':null}}})[_0x8eff('0x1a')](function(_0x3bf913){var _0x22f173=moment()[_0x8eff('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x28cb8e=0x0,_0x51aa5d=_0x3bf913[_0x8eff('0x36')];_0x28cb8e<_0x51aa5d;_0x28cb8e+=0x1){_0x3bf913[_0x28cb8e][_0x8eff('0x37')]({'exitAt':_0x22f173});}});for(var _0x577a2b=0x0;_0x577a2b<_0x18309b['body']['interaction'][_0x27a8c9]['length'];_0x577a2b+=0x1){db['MemberReport']['findOrCreate']({'where':{'channel':_0x27a8c9,'membername':_0x18309b[_0x8eff('0x31')][_0x8eff('0x12')],'type':_0x8eff('0x34'),'uniqueid':_0x18309b[_0x8eff('0x2f')][_0x8eff('0x30')][_0x27a8c9][_0x577a2b],'exitAt':null},'defaults':{'channel':_0x27a8c9,'membername':_0x18309b[_0x8eff('0x31')][_0x8eff('0x12')],'interface':_[_0x8eff('0x14')](_0x18309b[_0x8eff('0x31')][_0x8eff('0x38')])?util['format'](_0x8eff('0x39'),_0x18309b['user'][_0x8eff('0x12')]):_0x18309b[_0x8eff('0x31')][_0x8eff('0x38')],'type':_0x8eff('0x34'),'enterAt':moment()[_0x8eff('0x35')](_0x8eff('0x3a')),'role':_0x8eff('0x3b'),'internal':_0x18309b[_0x8eff('0x31')][_0x8eff('0x3c')],'uniqueid':_0x18309b[_0x8eff('0x2f')][_0x8eff('0x30')][_0x27a8c9][_0x577a2b]}});}}}}return respondWithRpcPromise(_0x8eff('0x3d'),{'id':_0x18309b['params']['id'],'capacity':_0x18309b[_0x8eff('0x2f')][_0x8eff('0x3e')]},routingClient)[_0x8eff('0x1a')](respondWithResult(_0xdc5e2f,null))[_0x8eff('0xd')](handleError(_0xdc5e2f,null));};exports[_0x8eff('0x3f')]=function(_0x2de7fd,_0x16473d){return respondWithRpcPromise(_0x8eff('0x40'),_0x2de7fd[_0x8eff('0x19')])['then'](respondWithResult(_0x16473d,null))['catch'](handleError(_0x16473d,null));};exports[_0x8eff('0x41')]=function(_0x36e2fd,_0x430f5e){return respondWithRpcPromise(_0x8eff('0x42'),_0x36e2fd[_0x8eff('0x19')])[_0x8eff('0x1a')](respondWithResult(_0x430f5e,null))['catch'](handleError(_0x430f5e,null));};exports[_0x8eff('0x43')]=function(_0x1ca203,_0x1d0a8e){return respondWithRpcPromise('Campaigns',_0x1ca203[_0x8eff('0x19')])[_0x8eff('0x1a')](respondWithResult(_0x1d0a8e,null))[_0x8eff('0xd')](handleError(_0x1d0a8e,null));};exports[_0x8eff('0x44')]=function(_0x549e88,_0x40de1d){return respondWithRpcPromise(_0x8eff('0x45'),_0x549e88[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x40de1d,null))[_0x8eff('0xd')](handleError(_0x40de1d,null));};exports[_0x8eff('0x46')]=function(_0x3f646d,_0x575b0e){return respondWithRpcPromise(_0x8eff('0x45'),_0x3f646d[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](findById(_0x3f646d[_0x8eff('0x1d')]['id']))[_0x8eff('0x1a')](respondWithResult(_0x575b0e,null))['catch'](handleError(_0x575b0e,null));};exports[_0x8eff('0x47')]=function(_0x16b968,_0x5d79b){return respondWithRpcPromise('MailQueues',_0x16b968[_0x8eff('0x19')],routingClient)['then'](respondWithResult(_0x5d79b,null))[_0x8eff('0xd')](handleError(_0x5d79b,null));};exports[_0x8eff('0x48')]=function(_0x23ed92,_0xfecdd8){return respondWithRpcPromise(_0x8eff('0x49'),_0x23ed92[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](findById(_0x23ed92['params']['id']))['then'](respondWithResult(_0xfecdd8,null))[_0x8eff('0xd')](handleError(_0xfecdd8,null));};exports['mailAccounts']=function(_0x3bfeac,_0x375ed3){return respondWithRpcPromise(_0x8eff('0x4a'),_0x3bfeac[_0x8eff('0x19')],mailClient)[_0x8eff('0x1a')](respondWithResult(_0x375ed3,null))['catch'](handleError(_0x375ed3,null));};exports[_0x8eff('0x4b')]=function(_0x36afc3,_0x1813df){return respondWithRpcPromise(_0x8eff('0x4c'),_0x36afc3[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x1813df,null))['catch'](handleError(_0x1813df,null));};exports[_0x8eff('0x4d')]=function(_0x5c0ea3,_0x2e45c2){return respondWithRpcPromise(_0x8eff('0x4c'),_0x5c0ea3['query'],routingClient)[_0x8eff('0x1a')](findById(_0x5c0ea3[_0x8eff('0x1d')]['id']))[_0x8eff('0x1a')](respondWithResult(_0x2e45c2,null))[_0x8eff('0xd')](handleError(_0x2e45c2,null));};exports[_0x8eff('0x4e')]=function(_0x35467c,_0xabdd84){return respondWithRpcPromise(_0x8eff('0x4f'),_0x35467c['query'],routingClient)[_0x8eff('0x1a')](respondWithResult(_0xabdd84,null))['catch'](handleError(_0xabdd84,null));};exports['showSmsQueues']=function(_0x1a748f,_0x47626e){return respondWithRpcPromise('SmsQueues',_0x1a748f[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](findById(_0x1a748f['params']['id']))[_0x8eff('0x1a')](respondWithResult(_0x47626e,null))[_0x8eff('0xd')](handleError(_0x47626e,null));};exports['whatsappQueues']=function(_0xc70ecc,_0x1c6ee1){return respondWithRpcPromise(_0x8eff('0x50'),_0xc70ecc[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x1c6ee1,null))[_0x8eff('0xd')](handleError(_0x1c6ee1,null));};exports[_0x8eff('0x51')]=function(_0x58c9e6,_0x479a4b){return respondWithRpcPromise(_0x8eff('0x50'),_0x58c9e6[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](findById(_0x58c9e6[_0x8eff('0x1d')]['id']))[_0x8eff('0x1a')](respondWithResult(_0x479a4b,null))[_0x8eff('0xd')](handleError(_0x479a4b,null));};exports[_0x8eff('0x52')]=function(_0x4f1c54,_0x593a18){return respondWithRpcPromise(_0x8eff('0x53'),_0x4f1c54['query'],routingClient)['then'](respondWithResult(_0x593a18,null))['catch'](handleError(_0x593a18,null));};exports[_0x8eff('0x54')]=function(_0x436db2,_0x461026){return respondWithRpcPromise(_0x8eff('0x53'),_0x436db2[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](findById(_0x436db2[_0x8eff('0x1d')]['id']))[_0x8eff('0x1a')](respondWithResult(_0x461026,null))['catch'](handleError(_0x461026,null));};exports[_0x8eff('0x55')]=function(_0x5492df,_0x42efc6){return respondWithRpcPromise(_0x8eff('0x56'),_0x5492df[_0x8eff('0x19')])[_0x8eff('0x1a')](respondWithResult(_0x42efc6,null))[_0x8eff('0xd')](handleError(_0x42efc6,null));};exports[_0x8eff('0x57')]=function(_0x570728,_0x3db0d8){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x570728[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x3db0d8,null))[_0x8eff('0xd')](handleError(_0x3db0d8,null));};exports[_0x8eff('0x58')]=function(_0x41d7e2,_0x2f30cb){return respondWithRpcPromise(_0x8eff('0x59'),_0x41d7e2[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x2f30cb,null))['catch'](handleError(_0x2f30cb,null));};exports[_0x8eff('0x5a')]=function(_0x73b49f,_0x1299b5){return respondWithRpcPromise(_0x8eff('0x5b'),_0x73b49f[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x1299b5,null))[_0x8eff('0xd')](handleError(_0x1299b5,null));};exports[_0x8eff('0x5c')]=function(_0x3350b8,_0x123673){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x3350b8['query'],routingClient)['then'](function(_0x5f3443){if(_0x3350b8[_0x8eff('0x19')][_0x8eff('0x5d')]!==undefined){var _0x2a15ba=_(_0x5f3443[_0x8eff('0x15')])[_0x8eff('0x5e')]([_0x3350b8[_0x8eff('0x19')][_0x8eff('0x5d')],_0x3350b8['params']['id']])[_0x8eff('0x5f')](_0x8eff('0x60'))[_0x8eff('0x61')]()[_0x8eff('0x62')]();return _0x5f3443['rows'][_0x8eff('0x5e')](function(_0x34ca22){return _0x2a15ba['indexOf'](_0x34ca22[_0x8eff('0x60')])>-0x1;});}else{return _0x5f3443[_0x8eff('0x15')][_0x8eff('0x5e')](function(_0x47e24f){return _0x47e24f['queue_id']===parseInt(_0x3350b8['params']['id']);});}})[_0x8eff('0x1a')](respondWithResult(_0x123673,null))[_0x8eff('0xd')](handleError(_0x123673,null));};exports[_0x8eff('0x63')]=function(_0x168465,_0xaca1b5){return respondWithRpcPromise(_0x8eff('0x64'),_0x168465[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0xaca1b5,null))[_0x8eff('0xd')](handleError(_0xaca1b5,null));};exports[_0x8eff('0x65')]=function(_0x4272e8,_0x5c8a83){return respondWithRpcPromise(_0x8eff('0x66'),_0x4272e8['query'],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x5c8a83,null))[_0x8eff('0xd')](handleError(_0x5c8a83,null));};exports['faxQueuesWaitingInteractions']=function(_0x9c448b,_0x536b6f){return respondWithRpcPromise(_0x8eff('0x67'),_0x9c448b[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x536b6f,null))[_0x8eff('0xd')](handleError(_0x536b6f,null));};exports[_0x8eff('0x68')]=function(_0x4a4603){return function(_0x842ad7,_0x56fd7d){var _0xd5edc5,_0x19768b;var _0x30c321=_[_0x8eff('0x69')](_0x4a4603);var _0x52be06=_0x4a4603===_0x8eff('0x6a')?_0x8eff('0x6b'):_0x8eff('0x6c');return db[_0x30c321+_0x8eff('0x6d')]['findOne']({'raw':!![],'where':{'id':_0x842ad7[_0x8eff('0x1d')]['id']}})[_0x8eff('0x1a')](function(_0x10e26f){if(_[_0x8eff('0x14')](_0x10e26f)){throw new Error(_0x30c321+_0x8eff('0x6e'));}_0xd5edc5=_0x10e26f;return db[_0x30c321+'Message'][_0x8eff('0x6f')]({'where':{'id':_0x842ad7[_0x8eff('0x2f')]['messageId']},'include':[{'model':db[_0x30c321+'Interaction'],'as':_0x8eff('0x70')},{'model':db[_0x30c321+_0x52be06],'as':_0x8eff('0x6c')}]});})[_0x8eff('0x1a')](function(_0xe31924){if(_[_0x8eff('0x14')](_0xe31924)){throw new Error(_0x30c321+_0x8eff('0x71'));}_0x19768b=_0xe31924;return _0xe31924['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x8eff('0x1a')](function(){var _0x522e5f={'uniqueid':_0x4a4603+'.'+_0x19768b['id']+'.'+_0x19768b[_0x8eff('0x70')]['id'],'FromUserId':_0x842ad7[_0x8eff('0x31')]['id'],'type':'queue'};_0x522e5f[_0x30c321+_0x8eff('0x72')]=_0x19768b['id'];_0x522e5f[_0x30c321+'InteractionId']=_0x19768b['Interaction']['id'];_0x522e5f[_0x8eff('0x73')+_0x30c321+_0x52be06+'Id']=_0x19768b['Account']['id'];_0x522e5f['To'+_0x30c321+_0x8eff('0x74')]=_0xd5edc5['id'];return db[_0x30c321+_0x8eff('0x75')]['create'](_0x522e5f);})[_0x8eff('0x1a')](function(){return respondWithRpcPromise(_0x8eff('0x76'),{'channel':_0x4a4603,'interaction':_0x19768b['Interaction'],'message':_0x19768b,'account':_0x19768b[_0x8eff('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':_0x8eff('0x77'),'appdata':_0xd5edc5[_0x8eff('0x12')]+','+(_0x19768b[_0x8eff('0x6c')][_0x8eff('0x78')]||0x12c),'interval':_0x8eff('0x79')}]},routingClient);})[_0x8eff('0x1a')](respondWithResult(_0x56fd7d,null))[_0x8eff('0xd')](handleError(_0x56fd7d,null));};};exports[_0x8eff('0x7a')]=function(_0x4aa16e,_0x4f7209){var _0x4c9436,_0x338269;if(_[_0x8eff('0x14')](_0x4aa16e[_0x8eff('0x2f')]['channel'])){throw new Error(_0x8eff('0x7b'));}var _0x35cf4c=_0x4aa16e[_0x8eff('0x2f')][_0x8eff('0x7c')];var _0x2c9646=_[_0x8eff('0x69')](_0x35cf4c);var _0x5ee248=_0x35cf4c===_0x8eff('0x6a')?'Website':_0x8eff('0x6c');return db[_0x8eff('0x7d')][_0x8eff('0x6f')]({'raw':!![],'where':{'id':_0x4aa16e[_0x8eff('0x1d')]['id'],'role':_0x8eff('0x3b')}})[_0x8eff('0x1a')](function(_0x476701){if(_['isNil'](_0x476701)){throw new Error(_0x8eff('0x7e'));}_0x4c9436=_0x476701;return db[_0x2c9646+_0x8eff('0x7f')][_0x8eff('0x6f')]({'where':{'id':_0x4aa16e[_0x8eff('0x2f')][_0x8eff('0x80')]},'include':[{'model':db[_0x2c9646+'Interaction'],'as':_0x8eff('0x70')},{'model':db[_0x2c9646+_0x5ee248],'as':_0x8eff('0x6c')}]});})[_0x8eff('0x1a')](function(_0x488a69){if(_['isNil'](_0x488a69)){throw new Error(_0x2c9646+_0x8eff('0x71'));}_0x338269=_0x488a69;return _0x488a69[_0x8eff('0x81')]({'read':0x0,'readAt':null,'UserId':null});})[_0x8eff('0x1a')](function(){var _0x58db46={'uniqueid':_0x35cf4c+'.'+_0x338269['id']+'.'+_0x338269[_0x8eff('0x70')]['id'],'FromUserId':_0x4aa16e['user']['id'],'type':'queue','ToUserId':_0x4c9436['id']};_0x58db46[_0x2c9646+_0x8eff('0x72')]=_0x338269['id'];_0x58db46[_0x2c9646+_0x8eff('0x82')]=_0x338269[_0x8eff('0x70')]['id'];_0x58db46[_0x8eff('0x73')+_0x2c9646+_0x5ee248+'Id']=_0x338269[_0x8eff('0x6c')]['id'];return db[_0x2c9646+_0x8eff('0x75')][_0x8eff('0x83')](_0x58db46);})[_0x8eff('0x1a')](function(){return respondWithRpcPromise(_0x8eff('0x76'),{'channel':_0x35cf4c,'interaction':_0x338269[_0x8eff('0x70')],'message':_0x338269,'account':_0x338269[_0x8eff('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':_0x8eff('0x3b'),'appdata':_0x4c9436['name']+','+(_0x338269[_0x8eff('0x6c')][_0x8eff('0x84')]||0x12c),'interval':_0x8eff('0x79')}]},routingClient);})[_0x8eff('0x1a')](respondWithResult(_0x4f7209,null))[_0x8eff('0xd')](handleError(_0x4f7209,null));}; \ No newline at end of file +var _0xd6d6=['capacity','Telephones','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','OpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','indexOf','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','queue','MessageId','InteractionId','From','QueueId','create','Start','*,*,*,*','agentNotify','channel','capitalize','User','Agent\x20not\x20found','TransferReport','agentTransferTimeout','bluebird','moment','lodash','util','../../config/logger','api','jayson/promise','client','http','error','code','message','status','json','sendStatus','stack','name','send','isNil','find','rows','voiceChannels','VoiceChannels','then','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','INTERACTION','interface','agent','internal'];(function(_0x254076,_0x5e7b8d){var _0x21a93e=function(_0x26aa78){while(--_0x26aa78){_0x254076['push'](_0x254076['shift']());}};_0x21a93e(++_0x5e7b8d);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x5ed528,_0x5b1571){_0x5ed528=_0x5ed528-0x0;var _0xd3fb8f=_0xd6d6[_0x5ed528];return _0xd3fb8f;};'use strict';var BPromise=require(_0x6d6d('0x0'));var moment=require(_0x6d6d('0x1'));var _=require(_0x6d6d('0x2'));var util=require(_0x6d6d('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x6d6d('0x4'))(_0x6d6d('0x5'));var jayson=require(_0x6d6d('0x6'));var amiClient=jayson[_0x6d6d('0x7')][_0x6d6d('0x8')]({'port':0x232a});var mailClient=jayson[_0x6d6d('0x7')][_0x6d6d('0x8')]({'port':0x232b});var routingClient=jayson['client'][_0x6d6d('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x1bf731,_0x44f83d,_0x18f824){return new BPromise(function(_0xd49f57,_0x408f88){var _0x3e69a4=_0x18f824?_0x18f824:amiClient;return _0x3e69a4['request'](_0x1bf731,_0x44f83d)['then'](function(_0x404c88){if(_0x404c88[_0x6d6d('0x9')]){if(_0x404c88[_0x6d6d('0x9')][_0x6d6d('0xa')]===0x1f4){return _0x408f88(_0x404c88[_0x6d6d('0x9')]['message']);}return _0xd49f57(_0x404c88[_0x6d6d('0x9')][_0x6d6d('0xb')]);}else{_0xd49f57(_0x404c88['result']);}})['catch'](function(_0x176618){_0x408f88(_0x176618);});});}function respondWithResult(_0x32146d,_0xe61c36){_0xe61c36=_0xe61c36||0xc8;return function(_0x3f8542){if(_0x3f8542){return _0x32146d[_0x6d6d('0xc')](_0xe61c36)[_0x6d6d('0xd')](_0x3f8542);}return _0x32146d[_0x6d6d('0xe')](0x194);};}function handleError(_0x2cb2dd,_0x5f4154){_0x5f4154=_0x5f4154||0x1f4;return function(_0xd09ea7){logger[_0x6d6d('0x9')](_0xd09ea7[_0x6d6d('0xf')]);if(_0xd09ea7[_0x6d6d('0x10')]){delete _0xd09ea7[_0x6d6d('0x10')];}_0x2cb2dd['status'](_0x5f4154)[_0x6d6d('0x11')](_0xd09ea7);};}function findById(_0x587338){return function(_0x27830d){if(!_[_0x6d6d('0x12')](_0x587338)&&!_[_0x6d6d('0x12')](_0x27830d)&&!_['isNil'](_0x27830d['rows'])){return _[_0x6d6d('0x13')](_0x27830d[_0x6d6d('0x14')],function(_0x2b59d4){return _0x2b59d4['id']==_0x587338;});}return null;};}exports[_0x6d6d('0x15')]=function(_0x51fff6,_0x554392){return respondWithRpcPromise(_0x6d6d('0x16'),_0x51fff6['query'])[_0x6d6d('0x17')](respondWithResult(_0x554392,null))[_0x6d6d('0x18')](handleError(_0x554392,null));};exports[_0x6d6d('0x19')]=function(_0x450352,_0x40d35b){return respondWithRpcPromise(_0x6d6d('0x1a'),_[_0x6d6d('0x1b')](_0x450352[_0x6d6d('0x1c')],_0x450352[_0x6d6d('0x1d')]))[_0x6d6d('0x17')](respondWithResult(_0x40d35b,null))[_0x6d6d('0x18')](handleError(_0x40d35b,null));};exports[_0x6d6d('0x1e')]=function(_0x466a29,_0x21b95d){return respondWithRpcPromise(_0x6d6d('0x1f'),_[_0x6d6d('0x1b')](_0x466a29[_0x6d6d('0x1c')],_0x466a29['params']))[_0x6d6d('0x17')](respondWithResult(_0x21b95d,null))[_0x6d6d('0x18')](handleError(_0x21b95d,null));};exports[_0x6d6d('0x20')]=function(_0x97ec9e,_0xf0df7f){return respondWithRpcPromise(_0x6d6d('0x21'),_0x97ec9e['query'])[_0x6d6d('0x17')](respondWithResult(_0xf0df7f,null))[_0x6d6d('0x18')](handleError(_0xf0df7f,null));};exports[_0x6d6d('0x22')]=function(_0x126ac8,_0x25c121){return respondWithRpcPromise(_0x6d6d('0x21'),_0x126ac8[_0x6d6d('0x1c')])['then'](findById(_0x126ac8[_0x6d6d('0x1d')]['id']))[_0x6d6d('0x17')](respondWithResult(_0x25c121,null))['catch'](handleError(_0x25c121,null));};exports['updateVoiceQueue']=function(_0x3edcce,_0x5273cd){return respondWithRpcPromise(_0x6d6d('0x23'),_['merge'](_0x3edcce[_0x6d6d('0x24')],_0x3edcce[_0x6d6d('0x1d')]))[_0x6d6d('0x17')](respondWithResult(_0x5273cd,null))[_0x6d6d('0x18')](handleError(_0x5273cd,null));};exports[_0x6d6d('0x25')]=function(_0x428c17,_0xdda3f2){return respondWithRpcPromise(_0x6d6d('0x26'),_[_0x6d6d('0x1b')](_0x428c17[_0x6d6d('0x1c')],_0x428c17['params']))[_0x6d6d('0x17')](respondWithResult(_0xdda3f2,null))['catch'](handleError(_0xdda3f2,null));};exports[_0x6d6d('0x27')]=function(_0x1ea9b2,_0xf527da){return respondWithRpcPromise(_0x6d6d('0x28'),_0x1ea9b2['query'])[_0x6d6d('0x17')](respondWithResult(_0xf527da,null))['catch'](handleError(_0xf527da,null));};exports[_0x6d6d('0x29')]=function(_0x219fd4,_0x5be8da){return respondWithRpcPromise(_0x6d6d('0x2a'),_[_0x6d6d('0x1b')](_0x219fd4[_0x6d6d('0x1c')],_0x219fd4[_0x6d6d('0x1d')]))[_0x6d6d('0x17')](respondWithResult(_0x5be8da,null))[_0x6d6d('0x18')](handleError(_0x5be8da,null));};exports[_0x6d6d('0x2b')]=function(_0x2d524d,_0x243555){return respondWithRpcPromise(_0x6d6d('0x2c'),_[_0x6d6d('0x1b')](_0x2d524d[_0x6d6d('0x1c')],_0x2d524d[_0x6d6d('0x1d')]))[_0x6d6d('0x17')](respondWithResult(_0x243555,null))['catch'](handleError(_0x243555,null));};exports[_0x6d6d('0x2d')]=function(_0xf98bfa,_0x3e2415){return respondWithRpcPromise(_0x6d6d('0x2e'),_['merge'](_0xf98bfa['query'],_0xf98bfa[_0x6d6d('0x1d')]))[_0x6d6d('0x17')](respondWithResult(_0x3e2415,null))[_0x6d6d('0x18')](handleError(_0x3e2415,null));};exports['outbound']=function(_0x2a3f67,_0x2607c1){return respondWithRpcPromise(_0x6d6d('0x2f'),_0x2a3f67[_0x6d6d('0x1c')])['then'](respondWithResult(_0x2607c1,null))['catch'](handleError(_0x2607c1,null));};exports['outboundChannels']=function(_0x62620d,_0x4196f0){return respondWithRpcPromise(_0x6d6d('0x30'),_0x62620d[_0x6d6d('0x1c')])['then'](respondWithResult(_0x4196f0,null))[_0x6d6d('0x18')](handleError(_0x4196f0,null));};exports[_0x6d6d('0x31')]=function(_0x344f6f,_0x3c6d23){var _0x3d632c;return respondWithRpcPromise(_0x6d6d('0x32'),_0x344f6f['query'])[_0x6d6d('0x17')](function(_0x3c7292){_0x3d632c=_0x3c7292;return respondWithRpcPromise(_0x6d6d('0x32'),_0x344f6f[_0x6d6d('0x1c')],routingClient);})[_0x6d6d('0x17')](function(_0x3e27b7){return _[_0x6d6d('0x1b')]({},_0x3e27b7,_0x3d632c);})['then'](respondWithResult(_0x3c6d23,null))[_0x6d6d('0x18')](handleError(_0x3c6d23,null));};exports[_0x6d6d('0x33')]=function(_0x16e177,_0x2107e0){if(_0x16e177[_0x6d6d('0x24')]&&_0x16e177['body'][_0x6d6d('0x34')]&&_0x16e177[_0x6d6d('0x35')]&&_0x16e177['user'][_0x6d6d('0x10')]){for(var _0x50dc17 in _0x16e177[_0x6d6d('0x24')][_0x6d6d('0x34')]){if(_0x16e177['body'][_0x6d6d('0x34')][_0x6d6d('0x36')](_0x50dc17)){db[_0x6d6d('0x37')][_0x6d6d('0x38')]({'where':{'channel':_0x50dc17,'membername':_0x16e177[_0x6d6d('0x35')]['name'],'type':'INTERACTION','exitAt':null,'uniqueid':_0x16e177[_0x6d6d('0x24')]['interaction'][_0x50dc17]&&_0x16e177['body'][_0x6d6d('0x34')][_0x50dc17][_0x6d6d('0x39')]?{'$notIn':_0x16e177[_0x6d6d('0x24')]['interaction'][_0x50dc17]}:{'$ne':null}}})[_0x6d6d('0x17')](function(_0x4cff80){var _0x1a2d4c=moment()[_0x6d6d('0x3a')](_0x6d6d('0x3b'));for(var _0x4606eb=0x0,_0x75f298=_0x4cff80[_0x6d6d('0x39')];_0x4606eb<_0x75f298;_0x4606eb+=0x1){_0x4cff80[_0x4606eb][_0x6d6d('0x3c')]({'exitAt':_0x1a2d4c});}});for(var _0x5c0495=0x0;_0x5c0495<_0x16e177[_0x6d6d('0x24')][_0x6d6d('0x34')][_0x50dc17][_0x6d6d('0x39')];_0x5c0495+=0x1){db[_0x6d6d('0x37')][_0x6d6d('0x3d')]({'where':{'channel':_0x50dc17,'membername':_0x16e177[_0x6d6d('0x35')][_0x6d6d('0x10')],'type':_0x6d6d('0x3e'),'uniqueid':_0x16e177[_0x6d6d('0x24')]['interaction'][_0x50dc17][_0x5c0495],'exitAt':null},'defaults':{'channel':_0x50dc17,'membername':_0x16e177['user'][_0x6d6d('0x10')],'interface':_[_0x6d6d('0x12')](_0x16e177[_0x6d6d('0x35')][_0x6d6d('0x3f')])?util[_0x6d6d('0x3a')]('SIP/%s',_0x16e177[_0x6d6d('0x35')][_0x6d6d('0x10')]):_0x16e177[_0x6d6d('0x35')][_0x6d6d('0x3f')],'type':_0x6d6d('0x3e'),'enterAt':moment()[_0x6d6d('0x3a')](_0x6d6d('0x3b')),'role':_0x6d6d('0x40'),'internal':_0x16e177[_0x6d6d('0x35')][_0x6d6d('0x41')],'uniqueid':_0x16e177[_0x6d6d('0x24')][_0x6d6d('0x34')][_0x50dc17][_0x5c0495]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x16e177[_0x6d6d('0x1d')]['id'],'capacity':_0x16e177[_0x6d6d('0x24')][_0x6d6d('0x42')]},routingClient)[_0x6d6d('0x17')](respondWithResult(_0x2107e0,null))[_0x6d6d('0x18')](handleError(_0x2107e0,null));};exports['telephones']=function(_0x38c307,_0x36bc5a){return respondWithRpcPromise(_0x6d6d('0x43'),_0x38c307['query'])['then'](respondWithResult(_0x36bc5a,null))[_0x6d6d('0x18')](handleError(_0x36bc5a,null));};exports['trunks']=function(_0x3ea57e,_0x995fe2){return respondWithRpcPromise(_0x6d6d('0x44'),_0x3ea57e[_0x6d6d('0x1c')])[_0x6d6d('0x17')](respondWithResult(_0x995fe2,null))[_0x6d6d('0x18')](handleError(_0x995fe2,null));};exports[_0x6d6d('0x45')]=function(_0x26c23a,_0x1a8f33){return respondWithRpcPromise(_0x6d6d('0x46'),_0x26c23a['query'])[_0x6d6d('0x17')](respondWithResult(_0x1a8f33,null))[_0x6d6d('0x18')](handleError(_0x1a8f33,null));};exports[_0x6d6d('0x47')]=function(_0x8000b6,_0x1f98d4){return respondWithRpcPromise(_0x6d6d('0x48'),_0x8000b6[_0x6d6d('0x1c')],routingClient)['then'](respondWithResult(_0x1f98d4,null))['catch'](handleError(_0x1f98d4,null));};exports[_0x6d6d('0x49')]=function(_0x122865,_0x5cc644){return respondWithRpcPromise(_0x6d6d('0x48'),_0x122865[_0x6d6d('0x1c')],routingClient)[_0x6d6d('0x17')](findById(_0x122865[_0x6d6d('0x1d')]['id']))[_0x6d6d('0x17')](respondWithResult(_0x5cc644,null))[_0x6d6d('0x18')](handleError(_0x5cc644,null));};exports[_0x6d6d('0x4a')]=function(_0x1ef7fb,_0x2abd8c){return respondWithRpcPromise(_0x6d6d('0x4b'),_0x1ef7fb[_0x6d6d('0x1c')],routingClient)[_0x6d6d('0x17')](respondWithResult(_0x2abd8c,null))[_0x6d6d('0x18')](handleError(_0x2abd8c,null));};exports[_0x6d6d('0x4c')]=function(_0x3065ea,_0x50d8dd){return respondWithRpcPromise(_0x6d6d('0x4b'),_0x3065ea[_0x6d6d('0x1c')],routingClient)['then'](findById(_0x3065ea[_0x6d6d('0x1d')]['id']))[_0x6d6d('0x17')](respondWithResult(_0x50d8dd,null))[_0x6d6d('0x18')](handleError(_0x50d8dd,null));};exports[_0x6d6d('0x4d')]=function(_0x2d61cc,_0xd0a573){return respondWithRpcPromise(_0x6d6d('0x4e'),_0x2d61cc[_0x6d6d('0x1c')],mailClient)[_0x6d6d('0x17')](respondWithResult(_0xd0a573,null))['catch'](handleError(_0xd0a573,null));};exports['openchannelQueues']=function(_0x22c3a1,_0x325fe2){return respondWithRpcPromise(_0x6d6d('0x4f'),_0x22c3a1['query'],routingClient)['then'](respondWithResult(_0x325fe2,null))[_0x6d6d('0x18')](handleError(_0x325fe2,null));};exports['showOpenchannelQueues']=function(_0x30badc,_0x5b6f58){return respondWithRpcPromise(_0x6d6d('0x4f'),_0x30badc[_0x6d6d('0x1c')],routingClient)[_0x6d6d('0x17')](findById(_0x30badc[_0x6d6d('0x1d')]['id']))[_0x6d6d('0x17')](respondWithResult(_0x5b6f58,null))[_0x6d6d('0x18')](handleError(_0x5b6f58,null));};exports['smsQueues']=function(_0x41e576,_0x5eb78f){return respondWithRpcPromise(_0x6d6d('0x50'),_0x41e576['query'],routingClient)[_0x6d6d('0x17')](respondWithResult(_0x5eb78f,null))[_0x6d6d('0x18')](handleError(_0x5eb78f,null));};exports[_0x6d6d('0x51')]=function(_0xa71db1,_0x29b68b){return respondWithRpcPromise(_0x6d6d('0x50'),_0xa71db1[_0x6d6d('0x1c')],routingClient)['then'](findById(_0xa71db1['params']['id']))[_0x6d6d('0x17')](respondWithResult(_0x29b68b,null))['catch'](handleError(_0x29b68b,null));};exports[_0x6d6d('0x52')]=function(_0x53b77a,_0xe19d23){return respondWithRpcPromise(_0x6d6d('0x53'),_0x53b77a[_0x6d6d('0x1c')],routingClient)[_0x6d6d('0x17')](respondWithResult(_0xe19d23,null))[_0x6d6d('0x18')](handleError(_0xe19d23,null));};exports[_0x6d6d('0x54')]=function(_0x5dd3b0,_0x3cedc0){return respondWithRpcPromise(_0x6d6d('0x53'),_0x5dd3b0[_0x6d6d('0x1c')],routingClient)[_0x6d6d('0x17')](findById(_0x5dd3b0[_0x6d6d('0x1d')]['id']))[_0x6d6d('0x17')](respondWithResult(_0x3cedc0,null))[_0x6d6d('0x18')](handleError(_0x3cedc0,null));};exports['faxQueues']=function(_0x3fa820,_0x4ec43e){return respondWithRpcPromise(_0x6d6d('0x55'),_0x3fa820[_0x6d6d('0x1c')],routingClient)[_0x6d6d('0x17')](respondWithResult(_0x4ec43e,null))[_0x6d6d('0x18')](handleError(_0x4ec43e,null));};exports[_0x6d6d('0x56')]=function(_0x1d1d1d,_0x56feda){return respondWithRpcPromise(_0x6d6d('0x55'),_0x1d1d1d[_0x6d6d('0x1c')],routingClient)['then'](findById(_0x1d1d1d['params']['id']))[_0x6d6d('0x17')](respondWithResult(_0x56feda,null))['catch'](handleError(_0x56feda,null));};exports['faxAccounts']=function(_0x5b6ca7,_0x1e3b17){return respondWithRpcPromise(_0x6d6d('0x57'),_0x5b6ca7[_0x6d6d('0x1c')])[_0x6d6d('0x17')](respondWithResult(_0x1e3b17,null))[_0x6d6d('0x18')](handleError(_0x1e3b17,null));};exports[_0x6d6d('0x58')]=function(_0x4d4083,_0x48472d){return respondWithRpcPromise(_0x6d6d('0x59'),_0x4d4083['query'],routingClient)['then'](respondWithResult(_0x48472d,null))['catch'](handleError(_0x48472d,null));};exports[_0x6d6d('0x5a')]=function(_0x5cd494,_0x45a374){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x5cd494[_0x6d6d('0x1c')],routingClient)[_0x6d6d('0x17')](respondWithResult(_0x45a374,null))['catch'](handleError(_0x45a374,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x167d0c,_0x202bf6){return respondWithRpcPromise(_0x6d6d('0x5b'),_0x167d0c[_0x6d6d('0x1c')],routingClient)['then'](respondWithResult(_0x202bf6,null))[_0x6d6d('0x18')](handleError(_0x202bf6,null));};exports[_0x6d6d('0x5c')]=function(_0x1fb21d,_0x2b53eb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x1fb21d[_0x6d6d('0x1c')],routingClient)['then'](function(_0x4b6594){if(_0x1fb21d['query'][_0x6d6d('0x5d')]!==undefined){var _0x5bcfbd=_(_0x4b6594[_0x6d6d('0x14')])[_0x6d6d('0x5e')]([_0x1fb21d[_0x6d6d('0x1c')]['type'],_0x1fb21d['params']['id']])[_0x6d6d('0x5f')](_0x6d6d('0x60'))['uniq']()['value']();return _0x4b6594[_0x6d6d('0x14')][_0x6d6d('0x5e')](function(_0x14feba){return _0x5bcfbd[_0x6d6d('0x61')](_0x14feba[_0x6d6d('0x60')])>-0x1;});}else{return _0x4b6594[_0x6d6d('0x14')][_0x6d6d('0x5e')](function(_0x52f758){return _0x52f758['queue_id']===parseInt(_0x1fb21d['params']['id']);});}})['then'](respondWithResult(_0x2b53eb,null))['catch'](handleError(_0x2b53eb,null));};exports['smsQueuesWaitingInteractions']=function(_0x87dd34,_0x21e5a8){return respondWithRpcPromise(_0x6d6d('0x62'),_0x87dd34[_0x6d6d('0x1c')],routingClient)['then'](respondWithResult(_0x21e5a8,null))['catch'](handleError(_0x21e5a8,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x39b34e,_0xfbad7a){return respondWithRpcPromise(_0x6d6d('0x63'),_0x39b34e[_0x6d6d('0x1c')],routingClient)['then'](respondWithResult(_0xfbad7a,null))['catch'](handleError(_0xfbad7a,null));};exports[_0x6d6d('0x64')]=function(_0x1e1c4e,_0x478ed4){return respondWithRpcPromise(_0x6d6d('0x65'),_0x1e1c4e[_0x6d6d('0x1c')],routingClient)[_0x6d6d('0x17')](respondWithResult(_0x478ed4,null))[_0x6d6d('0x18')](handleError(_0x478ed4,null));};exports[_0x6d6d('0x66')]=function(_0x581027){return function(_0xf5586f,_0x50eea6){var _0x39f986,_0x5885c5;var _0x108108=_['capitalize'](_0x581027);var _0x445196=_0x581027===_0x6d6d('0x67')?_0x6d6d('0x68'):_0x6d6d('0x69');return db[_0x108108+_0x6d6d('0x6a')][_0x6d6d('0x6b')]({'raw':!![],'where':{'id':_0xf5586f[_0x6d6d('0x1d')]['id']}})[_0x6d6d('0x17')](function(_0x139a7){if(_[_0x6d6d('0x12')](_0x139a7)){throw new Error(_0x108108+_0x6d6d('0x6c'));}_0x39f986=_0x139a7;return db[_0x108108+_0x6d6d('0x6d')][_0x6d6d('0x6b')]({'where':{'id':_0xf5586f[_0x6d6d('0x24')][_0x6d6d('0x6e')]},'include':[{'model':db[_0x108108+_0x6d6d('0x6f')],'as':'Interaction'},{'model':db[_0x108108+_0x445196],'as':'Account'}]});})[_0x6d6d('0x17')](function(_0x5a7b23){if(_[_0x6d6d('0x12')](_0x5a7b23)){throw new Error(_0x108108+_0x6d6d('0x70'));}_0x5885c5=_0x5a7b23;return _0x5a7b23['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x1d2668={'uniqueid':_0x581027+'.'+_0x5885c5['id']+'.'+_0x5885c5['Interaction']['id'],'FromUserId':_0xf5586f[_0x6d6d('0x35')]['id'],'type':_0x6d6d('0x71')};_0x1d2668[_0x108108+_0x6d6d('0x72')]=_0x5885c5['id'];_0x1d2668[_0x108108+_0x6d6d('0x73')]=_0x5885c5[_0x6d6d('0x6f')]['id'];_0x1d2668[_0x6d6d('0x74')+_0x108108+_0x445196+'Id']=_0x5885c5[_0x6d6d('0x69')]['id'];_0x1d2668['To'+_0x108108+_0x6d6d('0x75')]=_0x39f986['id'];return db[_0x108108+'TransferReport'][_0x6d6d('0x76')](_0x1d2668);})[_0x6d6d('0x17')](function(){return respondWithRpcPromise(_0x6d6d('0x77'),{'channel':_0x581027,'interaction':_0x5885c5['Interaction'],'message':_0x5885c5,'account':_0x5885c5['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x6d6d('0x71'),'appdata':_0x39f986[_0x6d6d('0x10')]+','+(_0x5885c5[_0x6d6d('0x69')]['queueTransferTimeout']||0x12c),'interval':_0x6d6d('0x78')}]},routingClient);})[_0x6d6d('0x17')](respondWithResult(_0x50eea6,null))['catch'](handleError(_0x50eea6,null));};};exports[_0x6d6d('0x79')]=function(_0x721d98,_0xa8ec98){var _0x155edb,_0x21057d;if(_['isNil'](_0x721d98[_0x6d6d('0x24')][_0x6d6d('0x7a')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x56825d=_0x721d98[_0x6d6d('0x24')][_0x6d6d('0x7a')];var _0xe80727=_[_0x6d6d('0x7b')](_0x56825d);var _0x5a8974=_0x56825d===_0x6d6d('0x67')?'Website':_0x6d6d('0x69');return db[_0x6d6d('0x7c')][_0x6d6d('0x6b')]({'raw':!![],'where':{'id':_0x721d98[_0x6d6d('0x1d')]['id'],'role':_0x6d6d('0x40')}})[_0x6d6d('0x17')](function(_0x39c1a5){if(_[_0x6d6d('0x12')](_0x39c1a5)){throw new Error(_0x6d6d('0x7d'));}_0x155edb=_0x39c1a5;return db[_0xe80727+_0x6d6d('0x6d')][_0x6d6d('0x6b')]({'where':{'id':_0x721d98[_0x6d6d('0x24')][_0x6d6d('0x6e')]},'include':[{'model':db[_0xe80727+_0x6d6d('0x6f')],'as':_0x6d6d('0x6f')},{'model':db[_0xe80727+_0x5a8974],'as':_0x6d6d('0x69')}]});})[_0x6d6d('0x17')](function(_0xccbc07){if(_[_0x6d6d('0x12')](_0xccbc07)){throw new Error(_0xe80727+_0x6d6d('0x70'));}_0x21057d=_0xccbc07;return _0xccbc07['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x3445f5={'uniqueid':_0x56825d+'.'+_0x21057d['id']+'.'+_0x21057d[_0x6d6d('0x6f')]['id'],'FromUserId':_0x721d98[_0x6d6d('0x35')]['id'],'type':_0x6d6d('0x71'),'ToUserId':_0x155edb['id']};_0x3445f5[_0xe80727+_0x6d6d('0x72')]=_0x21057d['id'];_0x3445f5[_0xe80727+_0x6d6d('0x73')]=_0x21057d[_0x6d6d('0x6f')]['id'];_0x3445f5[_0x6d6d('0x74')+_0xe80727+_0x5a8974+'Id']=_0x21057d[_0x6d6d('0x69')]['id'];return db[_0xe80727+_0x6d6d('0x7e')][_0x6d6d('0x76')](_0x3445f5);})[_0x6d6d('0x17')](function(){return respondWithRpcPromise(_0x6d6d('0x77'),{'channel':_0x56825d,'interaction':_0x21057d[_0x6d6d('0x6f')],'message':_0x21057d,'account':_0x21057d[_0x6d6d('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x155edb[_0x6d6d('0x10')]+','+(_0x21057d[_0x6d6d('0x69')][_0x6d6d('0x7f')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0xa8ec98,null))['catch'](handleError(_0xa8ec98,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 10dad95..4dd69ab 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 _0x60ee=['run','/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/interaction/service','get','index','isAuthenticated','show','/:id/run'];(function(_0xcfeff4,_0x3f2e19){var _0xb2fadc=function(_0x4cd013){while(--_0x4cd013){_0xcfeff4['push'](_0xcfeff4['shift']());}};_0xb2fadc(++_0x3f2e19);}(_0x60ee,0x75));var _0xe60e=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x60ee[_0x243b59];return _0x3e1676;};'use strict';var multer=require(_0xe60e('0x0'));var util=require(_0xe60e('0x1'));var path=require('path');var timeout=require(_0xe60e('0x2'));var express=require(_0xe60e('0x3'));var router=express[_0xe60e('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe60e('0x5'));var config=require('../../config/environment');var controller=require('./schedule.controller');router[_0xe60e('0x6')]('/',auth['isAuthenticated'](),controller[_0xe60e('0x7')]);router['get']('/:id',auth[_0xe60e('0x8')](),controller[_0xe60e('0x9')]);router[_0xe60e('0x6')](_0xe60e('0xa'),auth[_0xe60e('0x8')](),controller[_0xe60e('0xb')]);router['post']('/',auth[_0xe60e('0x8')](),controller['create']);router['put'](_0xe60e('0xc'),auth[_0xe60e('0x8')](),controller[_0xe60e('0xd')]);router[_0xe60e('0xe')](_0xe60e('0xc'),auth[_0xe60e('0x8')](),controller[_0xe60e('0xf')]);module['exports']=router; \ No newline at end of file +var _0xbe75=['path','express','./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','post','create','put','exports','multer','util'];(function(_0x510c9a,_0x4dc1f){var _0x3f5070=function(_0x702a83){while(--_0x702a83){_0x510c9a['push'](_0x510c9a['shift']());}};_0x3f5070(++_0x4dc1f);}(_0xbe75,0x1cf));var _0x5be7=function(_0x57325e,_0x4d98de){_0x57325e=_0x57325e-0x0;var _0x1d12e9=_0xbe75[_0x57325e];return _0x1d12e9;};'use strict';var multer=require(_0x5be7('0x0'));var util=require(_0x5be7('0x1'));var path=require(_0x5be7('0x2'));var timeout=require('connect-timeout');var express=require(_0x5be7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5be7('0x4'));router[_0x5be7('0x5')]('/',auth[_0x5be7('0x6')](),controller[_0x5be7('0x7')]);router['get'](_0x5be7('0x8'),auth[_0x5be7('0x6')](),controller[_0x5be7('0x9')]);router['get'](_0x5be7('0xa'),auth[_0x5be7('0x6')](),controller['run']);router[_0x5be7('0xb')]('/',auth[_0x5be7('0x6')](),controller[_0x5be7('0xc')]);router[_0x5be7('0xd')](_0x5be7('0x8'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x5be7('0x6')](),controller['destroy']);module[_0x5be7('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 0faef66..8ec0828 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 _0x357b=['days','csv','pdf','default','custom','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','weeks','hours','minutes'];(function(_0x5a0824,_0x402173){var _0xf9f1dd=function(_0x44027c){while(--_0x44027c){_0x5a0824['push'](_0x5a0824['shift']());}};_0xf9f1dd(++_0x402173);}(_0x357b,0xeb));var _0xb357=function(_0x256f9b,_0x503fbc){_0x256f9b=_0x256f9b-0x0;var _0x3f5c47=_0x357b[_0x256f9b];return _0x3f5c47;};'use strict';var Sequelize=require(_0xb357('0x0'));module[_0xb357('0x1')]={'name':{'type':Sequelize[_0xb357('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xb357('0x2')],'allowNull':![],'defaultValue':_0xb357('0x3')},'startAt':{'type':Sequelize[_0xb357('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xb357('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xb357('0x6')](_0xb357('0x7'),_0xb357('0x8'),'months',_0xb357('0x9'),'days',_0xb357('0xa'),_0xb357('0xb')),'allowNull':![],'defaultValue':_0xb357('0xc')},'output':{'type':Sequelize['ENUM'](_0xb357('0xd'),_0xb357('0xe'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM']('custom',_0xb357('0xf')),'allowNull':![],'defaultValue':_0xb357('0x10')},'sendMail':{'type':Sequelize[_0xb357('0x11')],'defaultValue':![]},'email':{'type':Sequelize[_0xb357('0x2')]},'cc':{'type':Sequelize[_0xb357('0x12')]},'bcc':{'type':Sequelize[_0xb357('0x12')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x69d1=['minutes','csv','pdf','xlsx','default','custom','TEXT','BOOLEAN','STRING','DATE','INTEGER','ENUM','quarters','months','weeks','days','hours'];(function(_0x30c649,_0x2ebbac){var _0x3edfb9=function(_0xab82f5){while(--_0xab82f5){_0x30c649['push'](_0x30c649['shift']());}};_0x3edfb9(++_0x2ebbac);}(_0x69d1,0x7f));var _0x169d=function(_0x3f3514,_0x4dbfea){_0x3f3514=_0x3f3514-0x0;var _0x1203de=_0x69d1[_0x3f3514];return _0x1203de;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x169d('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x169d('0x0')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x169d('0x0')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x169d('0x1')],'allowNull':![]},'endAt':{'type':Sequelize[_0x169d('0x1')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x169d('0x2')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x169d('0x3')]('years',_0x169d('0x4'),_0x169d('0x5'),_0x169d('0x6'),_0x169d('0x7'),_0x169d('0x8'),_0x169d('0x9')),'allowNull':![],'defaultValue':_0x169d('0x7')},'output':{'type':Sequelize[_0x169d('0x3')](_0x169d('0xa'),_0x169d('0xb'),_0x169d('0xc')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x169d('0x3')]('custom',_0x169d('0xd')),'allowNull':![],'defaultValue':_0x169d('0xe')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x169d('0xf')]},'bcc':{'type':Sequelize[_0x169d('0xf')]},'sendIfEmpty':{'type':Sequelize[_0x169d('0x10')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 4a55b8d..0aed2cf 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 _0xc906=['hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','run','../../config/schedule','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','destroy','then','Scheduler','UserProfileResource','sendStatus','name','send','index','map','Schedule','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length'];(function(_0x25c326,_0x250137){var _0x762452=function(_0x50ce5e){while(--_0x50ce5e){_0x25c326['push'](_0x25c326['shift']());}};_0x762452(++_0x250137);}(_0xc906,0x71));var _0x6c90=function(_0xaa9385,_0x12443b){_0xaa9385=_0xaa9385-0x0;var _0x1cae6f=_0xc906[_0xaa9385];return _0x1cae6f;};'use strict';var emlformat=require(_0x6c90('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6c90('0x1'));var jsonpatch=require(_0x6c90('0x2'));var rp=require(_0x6c90('0x3'));var moment=require(_0x6c90('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6c90('0x5'));var util=require(_0x6c90('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6c90('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c90('0x8'));var _=require(_0x6c90('0x9'));var squel=require(_0x6c90('0xa'));var crypto=require(_0x6c90('0xb'));var jsforce=require(_0x6c90('0xc'));var deskjs=require(_0x6c90('0xd'));var toCsv=require(_0x6c90('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6c90('0xe'));var authService=require(_0x6c90('0xf'));var qs=require(_0x6c90('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6c90('0x11'));var logger=require('../../config/logger')(_0x6c90('0x12'));var utils=require(_0x6c90('0x13'));var config=require(_0x6c90('0x14'));var licenseUtil=require(_0x6c90('0x15'));var db=require(_0x6c90('0x16'))['db'];function respondWithStatusCode(_0x190183,_0xe6b449){_0xe6b449=_0xe6b449||0xcc;return function(_0x17a941){if(_0x17a941){return _0x190183['sendStatus'](_0xe6b449);}return _0x190183[_0x6c90('0x17')](_0xe6b449)[_0x6c90('0x18')]();};}function respondWithResult(_0x421f92,_0x509da7){_0x509da7=_0x509da7||0xc8;return function(_0x5e20e6){if(_0x5e20e6){return _0x421f92[_0x6c90('0x17')](_0x509da7)[_0x6c90('0x19')](_0x5e20e6);}};}function respondWithFilteredResult(_0x5d5aea,_0x42d6e9){return function(_0x553cd4){if(_0x553cd4){var _0x4670ff=typeof _0x42d6e9[_0x6c90('0x1a')]===_0x6c90('0x1b')&&typeof _0x42d6e9[_0x6c90('0x1c')]==='undefined';var _0x2e83fa=_0x553cd4[_0x6c90('0x1d')];var _0x282e93=_0x4670ff?0x0:_0x42d6e9['offset'];var _0x3ec5ab=_0x4670ff?_0x553cd4[_0x6c90('0x1d')]:_0x42d6e9['offset']+_0x42d6e9['limit'];var _0x55d247;if(_0x3ec5ab>=_0x2e83fa){_0x3ec5ab=_0x2e83fa;_0x55d247=0xc8;}else{_0x55d247=0xce;}_0x5d5aea[_0x6c90('0x17')](_0x55d247);return _0x5d5aea[_0x6c90('0x1e')]('Content-Range',_0x282e93+'-'+_0x3ec5ab+'/'+_0x2e83fa)[_0x6c90('0x19')](_0x553cd4);}return null;};}function patchUpdates(_0x306509){return function(_0x2ed1f1){try{jsonpatch[_0x6c90('0x1f')](_0x2ed1f1,_0x306509,!![]);}catch(_0x57c640){return BPromise[_0x6c90('0x20')](_0x57c640);}return _0x2ed1f1['save']();};}function saveUpdates(_0x1eba17,_0x500484){return function(_0x4940dd){if(_0x4940dd){return _0x4940dd['update'](_0x1eba17)['then'](function(_0x187976){return _0x187976;});}return null;};}function removeEntity(_0x70a27e,_0x31af41){return function(_0xf84f5a){if(_0xf84f5a){return _0xf84f5a[_0x6c90('0x21')]()[_0x6c90('0x22')](function(){var _0x190fa8=_0xf84f5a['get']({'plain':!![]});var _0x2223c9=_0x6c90('0x23');return db[_0x6c90('0x24')][_0x6c90('0x21')]({'where':{'type':_0x2223c9,'resourceId':_0x190fa8['id']}})[_0x6c90('0x22')](function(){return _0xf84f5a;});})[_0x6c90('0x22')](function(){_0x70a27e[_0x6c90('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59252a,_0x1d3787){return function(_0x1e89e4){if(!_0x1e89e4){_0x59252a[_0x6c90('0x25')](0x194);}return _0x1e89e4;};}function handleError(_0x2e6fb2,_0xaa7a84){_0xaa7a84=_0xaa7a84||0x1f4;return function(_0x21e68e){logger['error'](_0x21e68e['stack']);if(_0x21e68e[_0x6c90('0x26')]){delete _0x21e68e[_0x6c90('0x26')];}_0x2e6fb2[_0x6c90('0x17')](_0xaa7a84)[_0x6c90('0x27')](_0x21e68e);};}exports[_0x6c90('0x28')]=function(_0x22b856,_0x5dc49c){var _0x23a46e={},_0x55f209={},_0x17e460={'count':0x0,'rows':[]};var _0x447d6a=_[_0x6c90('0x29')](db[_0x6c90('0x2a')][_0x6c90('0x2b')],function(_0x134ab3){return{'name':_0x134ab3['fieldName'],'type':_0x134ab3[_0x6c90('0x2c')]['key']};});_0x55f209['model']=_[_0x6c90('0x29')](_0x447d6a,_0x6c90('0x26'));_0x55f209[_0x6c90('0x2d')]=_[_0x6c90('0x2e')](_0x22b856[_0x6c90('0x2d')]);_0x55f209[_0x6c90('0x2f')]=_[_0x6c90('0x30')](_0x55f209[_0x6c90('0x31')],_0x55f209[_0x6c90('0x2d')]);_0x23a46e[_0x6c90('0x32')]=_[_0x6c90('0x30')](_0x55f209[_0x6c90('0x31')],qs['fields'](_0x22b856['query'][_0x6c90('0x33')]));_0x23a46e['attributes']=_0x23a46e[_0x6c90('0x32')][_0x6c90('0x34')]?_0x23a46e[_0x6c90('0x32')]:_0x55f209[_0x6c90('0x31')];if(!_0x22b856['query'][_0x6c90('0x35')](_0x6c90('0x36'))){_0x23a46e[_0x6c90('0x1c')]=qs['limit'](_0x22b856[_0x6c90('0x2d')]['limit']);_0x23a46e[_0x6c90('0x1a')]=qs['offset'](_0x22b856[_0x6c90('0x2d')]['offset']);}_0x23a46e[_0x6c90('0x37')]=qs[_0x6c90('0x38')](_0x22b856['query'][_0x6c90('0x38')]);_0x23a46e['where']=qs[_0x6c90('0x2f')](_[_0x6c90('0x39')](_0x22b856[_0x6c90('0x2d')],_0x55f209[_0x6c90('0x2f')]),_0x447d6a);if(_0x22b856[_0x6c90('0x2d')][_0x6c90('0x3a')]){_0x23a46e[_0x6c90('0x3b')]=_[_0x6c90('0x3c')](_0x23a46e[_0x6c90('0x3b')],{'$or':_['map'](_0x447d6a,function(_0x435e99){if(_0x435e99[_0x6c90('0x2c')]!==_0x6c90('0x3d')){var _0x216fc1={};_0x216fc1[_0x435e99[_0x6c90('0x26')]]={'$like':'%'+_0x22b856[_0x6c90('0x2d')][_0x6c90('0x3a')]+'%'};return _0x216fc1;}})});}_0x23a46e=_[_0x6c90('0x3c')]({},_0x23a46e,_0x22b856[_0x6c90('0x3e')]);var _0x2e9399={'where':_0x23a46e[_0x6c90('0x3b')]};return db[_0x6c90('0x2a')][_0x6c90('0x1d')](_0x2e9399)[_0x6c90('0x22')](function(_0x507b55){_0x17e460[_0x6c90('0x1d')]=_0x507b55;if(_0x22b856[_0x6c90('0x2d')][_0x6c90('0x3f')]){_0x23a46e['include']=[{'all':!![]}];}return db['Schedule'][_0x6c90('0x40')](_0x23a46e);})['then'](function(_0x590eae){_0x17e460[_0x6c90('0x41')]=_0x590eae;return _0x17e460;})[_0x6c90('0x22')](respondWithFilteredResult(_0x5dc49c,_0x23a46e))[_0x6c90('0x42')](handleError(_0x5dc49c,null));};exports[_0x6c90('0x43')]=function(_0xd0aec5,_0x2ef5d4){var _0x415573={'raw':![],'where':{'id':_0xd0aec5[_0x6c90('0x44')]['id']}},_0x2f81e5={};_0x2f81e5[_0x6c90('0x31')]=_['keys'](db[_0x6c90('0x2a')][_0x6c90('0x2b')]);_0x2f81e5[_0x6c90('0x2d')]=_[_0x6c90('0x2e')](_0xd0aec5['query']);_0x2f81e5['filters']=_[_0x6c90('0x30')](_0x2f81e5[_0x6c90('0x31')],_0x2f81e5[_0x6c90('0x2d')]);_0x415573[_0x6c90('0x32')]=_[_0x6c90('0x30')](_0x2f81e5[_0x6c90('0x31')],qs['fields'](_0xd0aec5[_0x6c90('0x2d')][_0x6c90('0x33')]));_0x415573[_0x6c90('0x32')]=_0x415573['attributes']['length']?_0x415573['attributes']:_0x2f81e5[_0x6c90('0x31')];if(_0xd0aec5['query'][_0x6c90('0x3f')]){_0x415573['include']=[{'all':!![]}];}_0x415573=_[_0x6c90('0x3c')]({},_0x415573,_0xd0aec5[_0x6c90('0x3e')]);return db[_0x6c90('0x2a')]['find'](_0x415573)[_0x6c90('0x22')](handleEntityNotFound(_0x2ef5d4,null))[_0x6c90('0x22')](respondWithResult(_0x2ef5d4,null))[_0x6c90('0x42')](handleError(_0x2ef5d4,null));};exports[_0x6c90('0x45')]=function(_0x391b34,_0x538aad){return db[_0x6c90('0x2a')][_0x6c90('0x45')](_0x391b34[_0x6c90('0x46')],{})['then'](function(_0x655daa){var _0x57620c=_0x391b34[_0x6c90('0x47')][_0x6c90('0x48')]({'plain':!![]});if(!_0x57620c)throw new Error(_0x6c90('0x49'));if(_0x57620c['role']==='user'){var _0x19df98=_0x655daa[_0x6c90('0x48')]({'plain':!![]});var _0x1c68a4=_0x6c90('0x23');return db[_0x6c90('0x4a')]['find']({'where':{'name':_0x1c68a4,'userProfileId':_0x57620c[_0x6c90('0x4b')]},'raw':!![]})[_0x6c90('0x22')](function(_0x3ab892){if(_0x3ab892&&_0x3ab892[_0x6c90('0x4c')]===0x0){return db[_0x6c90('0x24')][_0x6c90('0x45')]({'name':_0x19df98['name'],'resourceId':_0x19df98['id'],'type':_0x3ab892[_0x6c90('0x26')],'sectionId':_0x3ab892['id']},{})[_0x6c90('0x22')](function(){return _0x655daa;});}else{return _0x655daa;}})['catch'](function(_0x303759){logger[_0x6c90('0x4d')](_0x6c90('0x4e'),_0x303759);throw _0x303759;});}return _0x655daa;})[_0x6c90('0x22')](respondWithResult(_0x538aad,0xc9))[_0x6c90('0x42')](handleError(_0x538aad,null));};exports[_0x6c90('0x4f')]=function(_0xbff985,_0x5470c0){if(_0xbff985[_0x6c90('0x46')]['id']){delete _0xbff985[_0x6c90('0x46')]['id'];}return db[_0x6c90('0x2a')][_0x6c90('0x50')]({'where':{'id':_0xbff985['params']['id']}})[_0x6c90('0x22')](handleEntityNotFound(_0x5470c0,null))[_0x6c90('0x22')](saveUpdates(_0xbff985[_0x6c90('0x46')],null))[_0x6c90('0x22')](respondWithResult(_0x5470c0,null))[_0x6c90('0x42')](handleError(_0x5470c0,null));};exports[_0x6c90('0x21')]=function(_0x589277,_0x4a1df0){return db['Schedule'][_0x6c90('0x50')]({'where':{'id':_0x589277['params']['id']}})[_0x6c90('0x22')](handleEntityNotFound(_0x4a1df0,null))[_0x6c90('0x22')](removeEntity(_0x4a1df0,null))['catch'](handleError(_0x4a1df0,null));};exports[_0x6c90('0x51')]=function(_0x4ee8f,_0x4aab44,_0x40bdb0){var _0x4ca216=require(_0x6c90('0x52'));return db['Schedule'][_0x6c90('0x50')]({'where':{'id':_0x4ee8f[_0x6c90('0x44')]['id']},'raw':!![]})[_0x6c90('0x22')](handleEntityNotFound(_0x4aab44,null))[_0x6c90('0x22')](function(){_0x4ca216[_0x6c90('0x51')](_0x4ee8f[_0x6c90('0x44')]['id']);})[_0x6c90('0x22')](respondWithStatusCode(_0x4aab44,null))[_0x6c90('0x42')](handleError(_0x4aab44,null));}; \ No newline at end of file +var _0x9cb8=['undefined','count','set','reject','update','destroy','then','get','Scheduler','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','include','Schedule','findAll','catch','params','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','../../config/schedule','run','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit'];(function(_0x3779bb,_0x2f14ac){var _0x1d1578=function(_0x53a250){while(--_0x53a250){_0x3779bb['push'](_0x3779bb['shift']());}};_0x1d1578(++_0x2f14ac);}(_0x9cb8,0x1be));var _0x89cb=function(_0x3c5151,_0xfbf2b4){_0x3c5151=_0x3c5151-0x0;var _0x39fac2=_0x9cb8[_0x3c5151];return _0x39fac2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x89cb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x89cb('0x1'));var rp=require('request-promise');var moment=require(_0x89cb('0x2'));var BPromise=require(_0x89cb('0x3'));var Mustache=require(_0x89cb('0x4'));var util=require(_0x89cb('0x5'));var path=require(_0x89cb('0x6'));var sox=require(_0x89cb('0x7'));var csv=require(_0x89cb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x89cb('0x9'));var _=require('lodash');var squel=require(_0x89cb('0xa'));var crypto=require(_0x89cb('0xb'));var jsforce=require(_0x89cb('0xc'));var deskjs=require(_0x89cb('0xd'));var toCsv=require(_0x89cb('0x8'));var querystring=require(_0x89cb('0xe'));var Papa=require(_0x89cb('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x89cb('0x10'));var as=require(_0x89cb('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x89cb('0x12'))(_0x89cb('0x13'));var utils=require('../../config/utils');var config=require(_0x89cb('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x89cb('0x15'))['db'];function respondWithStatusCode(_0x4679ef,_0x277f06){_0x277f06=_0x277f06||0xcc;return function(_0x97fdd6){if(_0x97fdd6){return _0x4679ef[_0x89cb('0x16')](_0x277f06);}return _0x4679ef[_0x89cb('0x17')](_0x277f06)[_0x89cb('0x18')]();};}function respondWithResult(_0xdc6329,_0x57d7ab){_0x57d7ab=_0x57d7ab||0xc8;return function(_0x2b7b57){if(_0x2b7b57){return _0xdc6329['status'](_0x57d7ab)[_0x89cb('0x19')](_0x2b7b57);}};}function respondWithFilteredResult(_0x577c5c,_0x4e1913){return function(_0x5cc663){if(_0x5cc663){var _0xa49f79=typeof _0x4e1913[_0x89cb('0x1a')]==='undefined'&&typeof _0x4e1913[_0x89cb('0x1b')]===_0x89cb('0x1c');var _0x5db6e2=_0x5cc663[_0x89cb('0x1d')];var _0x42d453=_0xa49f79?0x0:_0x4e1913[_0x89cb('0x1a')];var _0x136a58=_0xa49f79?_0x5cc663['count']:_0x4e1913[_0x89cb('0x1a')]+_0x4e1913[_0x89cb('0x1b')];var _0x2ccc3c;if(_0x136a58>=_0x5db6e2){_0x136a58=_0x5db6e2;_0x2ccc3c=0xc8;}else{_0x2ccc3c=0xce;}_0x577c5c['status'](_0x2ccc3c);return _0x577c5c[_0x89cb('0x1e')]('Content-Range',_0x42d453+'-'+_0x136a58+'/'+_0x5db6e2)[_0x89cb('0x19')](_0x5cc663);}return null;};}function patchUpdates(_0x5a0670){return function(_0x23ded3){try{jsonpatch['apply'](_0x23ded3,_0x5a0670,!![]);}catch(_0x2a1108){return BPromise[_0x89cb('0x1f')](_0x2a1108);}return _0x23ded3['save']();};}function saveUpdates(_0xe0d41e,_0x6831ca){return function(_0x5290c8){if(_0x5290c8){return _0x5290c8[_0x89cb('0x20')](_0xe0d41e)['then'](function(_0x310a6b){return _0x310a6b;});}return null;};}function removeEntity(_0x16a444,_0x26ea72){return function(_0x30176b){if(_0x30176b){return _0x30176b[_0x89cb('0x21')]()[_0x89cb('0x22')](function(){var _0x9503c4=_0x30176b[_0x89cb('0x23')]({'plain':!![]});var _0x368b1a=_0x89cb('0x24');return db['UserProfileResource'][_0x89cb('0x21')]({'where':{'type':_0x368b1a,'resourceId':_0x9503c4['id']}})['then'](function(){return _0x30176b;});})['then'](function(){_0x16a444[_0x89cb('0x17')](0xcc)[_0x89cb('0x18')]();});}};}function handleEntityNotFound(_0x1ddc0c,_0x3778b6){return function(_0x36c221){if(!_0x36c221){_0x1ddc0c['sendStatus'](0x194);}return _0x36c221;};}function handleError(_0x2a5f4e,_0x61049e){_0x61049e=_0x61049e||0x1f4;return function(_0x38065f){logger[_0x89cb('0x25')](_0x38065f[_0x89cb('0x26')]);if(_0x38065f['name']){delete _0x38065f[_0x89cb('0x27')];}_0x2a5f4e[_0x89cb('0x17')](_0x61049e)['send'](_0x38065f);};}exports[_0x89cb('0x28')]=function(_0x18382d,_0x37fee4){var _0x52b25a={},_0x1a0c37={},_0x1d020e={'count':0x0,'rows':[]};var _0xa4244b=_[_0x89cb('0x29')](db['Schedule'][_0x89cb('0x2a')],function(_0x49cd68){return{'name':_0x49cd68[_0x89cb('0x2b')],'type':_0x49cd68[_0x89cb('0x2c')][_0x89cb('0x2d')]};});_0x1a0c37['model']=_['map'](_0xa4244b,_0x89cb('0x27'));_0x1a0c37[_0x89cb('0x2e')]=_[_0x89cb('0x2f')](_0x18382d['query']);_0x1a0c37['filters']=_[_0x89cb('0x30')](_0x1a0c37[_0x89cb('0x31')],_0x1a0c37[_0x89cb('0x2e')]);_0x52b25a[_0x89cb('0x32')]=_[_0x89cb('0x30')](_0x1a0c37[_0x89cb('0x31')],qs[_0x89cb('0x33')](_0x18382d['query'][_0x89cb('0x33')]));_0x52b25a[_0x89cb('0x32')]=_0x52b25a[_0x89cb('0x32')]['length']?_0x52b25a[_0x89cb('0x32')]:_0x1a0c37[_0x89cb('0x31')];if(!_0x18382d[_0x89cb('0x2e')][_0x89cb('0x34')]('nolimit')){_0x52b25a[_0x89cb('0x1b')]=qs[_0x89cb('0x1b')](_0x18382d[_0x89cb('0x2e')][_0x89cb('0x1b')]);_0x52b25a[_0x89cb('0x1a')]=qs[_0x89cb('0x1a')](_0x18382d['query'][_0x89cb('0x1a')]);}_0x52b25a[_0x89cb('0x35')]=qs[_0x89cb('0x36')](_0x18382d[_0x89cb('0x2e')][_0x89cb('0x36')]);_0x52b25a[_0x89cb('0x37')]=qs['filters'](_[_0x89cb('0x38')](_0x18382d[_0x89cb('0x2e')],_0x1a0c37[_0x89cb('0x39')]),_0xa4244b);if(_0x18382d[_0x89cb('0x2e')][_0x89cb('0x3a')]){_0x52b25a['where']=_[_0x89cb('0x3b')](_0x52b25a[_0x89cb('0x37')],{'$or':_[_0x89cb('0x29')](_0xa4244b,function(_0x439123){if(_0x439123[_0x89cb('0x2c')]!==_0x89cb('0x3c')){var _0x54c784={};_0x54c784[_0x439123['name']]={'$like':'%'+_0x18382d[_0x89cb('0x2e')]['filter']+'%'};return _0x54c784;}})});}_0x52b25a=_[_0x89cb('0x3b')]({},_0x52b25a,_0x18382d['options']);var _0x44851d={'where':_0x52b25a['where']};return db['Schedule']['count'](_0x44851d)['then'](function(_0x443bda){_0x1d020e[_0x89cb('0x1d')]=_0x443bda;if(_0x18382d[_0x89cb('0x2e')]['includeAll']){_0x52b25a[_0x89cb('0x3d')]=[{'all':!![]}];}return db[_0x89cb('0x3e')][_0x89cb('0x3f')](_0x52b25a);})[_0x89cb('0x22')](function(_0x6c7b4b){_0x1d020e['rows']=_0x6c7b4b;return _0x1d020e;})['then'](respondWithFilteredResult(_0x37fee4,_0x52b25a))[_0x89cb('0x40')](handleError(_0x37fee4,null));};exports['show']=function(_0x50a0de,_0x816cea){var _0x168361={'raw':![],'where':{'id':_0x50a0de[_0x89cb('0x41')]['id']}},_0x5cbfdf={};_0x5cbfdf[_0x89cb('0x31')]=_[_0x89cb('0x2f')](db['Schedule'][_0x89cb('0x2a')]);_0x5cbfdf['query']=_[_0x89cb('0x2f')](_0x50a0de['query']);_0x5cbfdf['filters']=_[_0x89cb('0x30')](_0x5cbfdf[_0x89cb('0x31')],_0x5cbfdf[_0x89cb('0x2e')]);_0x168361[_0x89cb('0x32')]=_[_0x89cb('0x30')](_0x5cbfdf[_0x89cb('0x31')],qs['fields'](_0x50a0de[_0x89cb('0x2e')]['fields']));_0x168361[_0x89cb('0x32')]=_0x168361[_0x89cb('0x32')][_0x89cb('0x42')]?_0x168361[_0x89cb('0x32')]:_0x5cbfdf[_0x89cb('0x31')];if(_0x50a0de[_0x89cb('0x2e')]['includeAll']){_0x168361[_0x89cb('0x3d')]=[{'all':!![]}];}_0x168361=_[_0x89cb('0x3b')]({},_0x168361,_0x50a0de[_0x89cb('0x43')]);return db[_0x89cb('0x3e')][_0x89cb('0x44')](_0x168361)[_0x89cb('0x22')](handleEntityNotFound(_0x816cea,null))['then'](respondWithResult(_0x816cea,null))['catch'](handleError(_0x816cea,null));};exports['create']=function(_0x342a9a,_0x186b54){return db['Schedule'][_0x89cb('0x45')](_0x342a9a[_0x89cb('0x46')],{})['then'](function(_0x320f85){var _0x5abaf6=_0x342a9a[_0x89cb('0x47')][_0x89cb('0x23')]({'plain':!![]});if(!_0x5abaf6)throw new Error(_0x89cb('0x48'));if(_0x5abaf6[_0x89cb('0x49')]===_0x89cb('0x47')){var _0x5c7d37=_0x320f85['get']({'plain':!![]});var _0x225a8a=_0x89cb('0x24');return db['UserProfileSection']['find']({'where':{'name':_0x225a8a,'userProfileId':_0x5abaf6[_0x89cb('0x4a')]},'raw':!![]})['then'](function(_0x124314){if(_0x124314&&_0x124314['autoAssociation']===0x0){return db[_0x89cb('0x4b')][_0x89cb('0x45')]({'name':_0x5c7d37[_0x89cb('0x27')],'resourceId':_0x5c7d37['id'],'type':_0x124314[_0x89cb('0x27')],'sectionId':_0x124314['id']},{})[_0x89cb('0x22')](function(){return _0x320f85;});}else{return _0x320f85;}})[_0x89cb('0x40')](function(_0x3ffd8a){logger[_0x89cb('0x25')](_0x89cb('0x4c'),_0x3ffd8a);throw _0x3ffd8a;});}return _0x320f85;})[_0x89cb('0x22')](respondWithResult(_0x186b54,0xc9))['catch'](handleError(_0x186b54,null));};exports[_0x89cb('0x20')]=function(_0x314f6f,_0xf959c2){if(_0x314f6f['body']['id']){delete _0x314f6f[_0x89cb('0x46')]['id'];}return db[_0x89cb('0x3e')]['find']({'where':{'id':_0x314f6f[_0x89cb('0x41')]['id']}})['then'](handleEntityNotFound(_0xf959c2,null))['then'](saveUpdates(_0x314f6f[_0x89cb('0x46')],null))[_0x89cb('0x22')](respondWithResult(_0xf959c2,null))['catch'](handleError(_0xf959c2,null));};exports[_0x89cb('0x21')]=function(_0x326b1b,_0x443e7b){return db[_0x89cb('0x3e')][_0x89cb('0x44')]({'where':{'id':_0x326b1b['params']['id']}})[_0x89cb('0x22')](handleEntityNotFound(_0x443e7b,null))[_0x89cb('0x22')](removeEntity(_0x443e7b,null))[_0x89cb('0x40')](handleError(_0x443e7b,null));};exports['run']=function(_0x374ea7,_0x22dbba,_0xfe08d9){var _0x52fbb5=require(_0x89cb('0x4d'));return db[_0x89cb('0x3e')]['find']({'where':{'id':_0x374ea7['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x22dbba,null))[_0x89cb('0x22')](function(){_0x52fbb5[_0x89cb('0x4e')](_0x374ea7[_0x89cb('0x41')]['id']);})[_0x89cb('0x22')](respondWithStatusCode(_0x22dbba,null))['catch'](handleError(_0x22dbba,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 3babca7..385e3d6 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 _0xaa2d=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','./schedule.attributes','exports','tools_schedules','lodash'];(function(_0x5c7ae3,_0x241a97){var _0x32226b=function(_0x1eb5ba){while(--_0x1eb5ba){_0x5c7ae3['push'](_0x5c7ae3['shift']());}};_0x32226b(++_0x241a97);}(_0xaa2d,0xba));var _0xdaa2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa2d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdaa2('0x0'));var util=require(_0xdaa2('0x1'));var logger=require(_0xdaa2('0x2'))(_0xdaa2('0x3'));var moment=require(_0xdaa2('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdaa2('0x5'));var rimraf=require(_0xdaa2('0x6'));var config=require(_0xdaa2('0x7'));var attributes=require(_0xdaa2('0x8'));module[_0xdaa2('0x9')]=function(_0x5bb588,_0x527f9f){return _0x5bb588['define']('Schedule',attributes,{'tableName':_0xdaa2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6434=['bluebird','request-promise','path','rimraf','./schedule.attributes','exports','define','Schedule','tools_schedules','util','../../config/logger','api','moment'];(function(_0x13db30,_0x536d8c){var _0x2980c7=function(_0x3704c3){while(--_0x3704c3){_0x13db30['push'](_0x13db30['shift']());}};_0x2980c7(++_0x536d8c);}(_0x6434,0x1ea));var _0x4643=function(_0x4f0383,_0x5b0a32){_0x4f0383=_0x4f0383-0x0;var _0x1972b5=_0x6434[_0x4f0383];return _0x1972b5;};'use strict';var _=require('lodash');var util=require(_0x4643('0x0'));var logger=require(_0x4643('0x1'))(_0x4643('0x2'));var moment=require(_0x4643('0x3'));var BPromise=require(_0x4643('0x4'));var rp=require(_0x4643('0x5'));var fs=require('fs');var path=require(_0x4643('0x6'));var rimraf=require(_0x4643('0x7'));var config=require('../../config/environment');var attributes=require(_0x4643('0x8'));module[_0x4643('0x9')]=function(_0x3fcdf8,_0x443d54){return _0x3fcdf8[_0x4643('0xa')](_0x4643('0xb'),attributes,{'tableName':_0x4643('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index cb27a5a..22476a7 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 _0xc42d=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird'];(function(_0x2d7d4d,_0x2a94e9){var _0x3291c0=function(_0x327025){while(--_0x327025){_0x2d7d4d['push'](_0x2d7d4d['shift']());}};_0x3291c0(++_0x2a94e9);}(_0xc42d,0x11c));var _0xdc42=function(_0x6a2f45,_0xe43c67){_0x6a2f45=_0x6a2f45-0x0;var _0x3b9cb3=_0xc42d[_0x6a2f45];return _0x3b9cb3;};'use strict';var _=require(_0xdc42('0x0'));var util=require(_0xdc42('0x1'));var moment=require(_0xdc42('0x2'));var BPromise=require(_0xdc42('0x3'));var rs=require(_0xdc42('0x4'));var fs=require('fs');var Redis=require(_0xdc42('0x5'));var db=require(_0xdc42('0x6'))['db'];var utils=require(_0xdc42('0x7'));var logger=require(_0xdc42('0x8'))(_0xdc42('0x9'));var config=require(_0xdc42('0xa'));var jayson=require(_0xdc42('0xb'));var client=jayson['client'][_0xdc42('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x348923,_0x40ae47,_0x375897){return new BPromise(function(_0x5be533,_0x1bff3e){return client[_0xdc42('0xd')](_0x348923,_0x375897)[_0xdc42('0xe')](function(_0x12ffe3){logger[_0xdc42('0xf')](_0xdc42('0x10'),_0x40ae47,_0xdc42('0x11'));logger[_0xdc42('0x12')](_0xdc42('0x13'),_0x40ae47,_0xdc42('0x11'),JSON[_0xdc42('0x14')](_0x12ffe3));if(_0x12ffe3[_0xdc42('0x15')]){if(_0x12ffe3['error']['code']===0x1f4){logger[_0xdc42('0x15')]('Schedule,\x20%s,\x20%s',_0x40ae47,_0x12ffe3['error']['message']);return _0x1bff3e(_0x12ffe3['error'][_0xdc42('0x16')]);}logger['error'](_0xdc42('0x10'),_0x40ae47,_0x12ffe3[_0xdc42('0x15')][_0xdc42('0x16')]);return _0x5be533(_0x12ffe3[_0xdc42('0x15')][_0xdc42('0x16')]);}else{logger[_0xdc42('0xf')](_0xdc42('0x10'),_0x40ae47,_0xdc42('0x11'));_0x5be533(_0x12ffe3['result']['message']);}})[_0xdc42('0x17')](function(_0x1d4559){logger[_0xdc42('0x15')]('Schedule,\x20%s,\x20%s',_0x40ae47,_0x1d4559);_0x1bff3e(_0x1d4559);});});} \ No newline at end of file +var _0x1abe=['code','Schedule,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','then','info','request\x20sent','debug','error'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x1abe,0x1f3));var _0xe1ab=function(_0x769fd3,_0x4e56b1){_0x769fd3=_0x769fd3-0x0;var _0x13a008=_0x1abe[_0x769fd3];return _0x13a008;};'use strict';var _=require(_0xe1ab('0x0'));var util=require('util');var moment=require(_0xe1ab('0x1'));var BPromise=require('bluebird');var rs=require(_0xe1ab('0x2'));var fs=require('fs');var Redis=require(_0xe1ab('0x3'));var db=require(_0xe1ab('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe1ab('0x5'))(_0xe1ab('0x6'));var config=require('../../config/environment');var jayson=require(_0xe1ab('0x7'));var client=jayson[_0xe1ab('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x459c57,_0x326b46,_0x795c0c){return new BPromise(function(_0x30b0de,_0x384e04){return client['request'](_0x459c57,_0x795c0c)[_0xe1ab('0x9')](function(_0x51ab9b){logger[_0xe1ab('0xa')]('Schedule,\x20%s,\x20%s',_0x326b46,_0xe1ab('0xb'));logger[_0xe1ab('0xc')]('Schedule,\x20%s,\x20%s,\x20%s',_0x326b46,'request\x20sent',JSON['stringify'](_0x51ab9b));if(_0x51ab9b[_0xe1ab('0xd')]){if(_0x51ab9b[_0xe1ab('0xd')][_0xe1ab('0xe')]===0x1f4){logger[_0xe1ab('0xd')](_0xe1ab('0xf'),_0x326b46,_0x51ab9b['error'][_0xe1ab('0x10')]);return _0x384e04(_0x51ab9b[_0xe1ab('0xd')]['message']);}logger['error'](_0xe1ab('0xf'),_0x326b46,_0x51ab9b[_0xe1ab('0xd')][_0xe1ab('0x10')]);return _0x30b0de(_0x51ab9b[_0xe1ab('0xd')][_0xe1ab('0x10')]);}else{logger[_0xe1ab('0xa')](_0xe1ab('0xf'),_0x326b46,_0xe1ab('0xb'));_0x30b0de(_0x51ab9b[_0xe1ab('0x11')][_0xe1ab('0x10')]);}})[_0xe1ab('0x12')](function(_0xa766e){logger['error'](_0xe1ab('0xf'),_0x326b46,_0xa766e);_0x384e04(_0xa766e);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 232605f..140f098 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 _0x26c3=['isAuthenticated','show','/:id/download','download','post','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x283d0c,_0x3f0e67){var _0x1c91f5=function(_0x40369e){while(--_0x40369e){_0x283d0c['push'](_0x283d0c['shift']());}};_0x1c91f5(++_0x3f0e67);}(_0x26c3,0x1c2));var _0x326c=function(_0x318050,_0x49ceb8){_0x318050=_0x318050-0x0;var _0x1a189d=_0x26c3[_0x318050];return _0x1a189d;};'use strict';var multer=require(_0x326c('0x0'));var util=require(_0x326c('0x1'));var path=require(_0x326c('0x2'));var timeout=require(_0x326c('0x3'));var express=require(_0x326c('0x4'));var router=express[_0x326c('0x5')]();var fs_extra=require(_0x326c('0x6'));var auth=require(_0x326c('0x7'));var interaction=require(_0x326c('0x8'));var config=require(_0x326c('0x9'));var controller=require('./screenRecording.controller');router[_0x326c('0xa')]('/',auth['isAuthenticated'](),controller[_0x326c('0xb')]);router[_0x326c('0xa')]('/describe',auth[_0x326c('0xc')](),controller['describe']);router[_0x326c('0xa')]('/:id',auth[_0x326c('0xc')](),controller[_0x326c('0xd')]);router['get'](_0x326c('0xe'),auth[_0x326c('0xc')](),controller[_0x326c('0xf')]);router[_0x326c('0x10')]('/',auth[_0x326c('0xc')](),controller['create']);router[_0x326c('0x11')](_0x326c('0x12'),auth[_0x326c('0xc')](),controller[_0x326c('0x13')]);router[_0x326c('0x14')]('/:id',auth[_0x326c('0xc')](),controller['destroy']);module[_0x326c('0x15')]=router; \ No newline at end of file +var _0x6adf=['put','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','get','index','/describe','describe','/:id','isAuthenticated','/:id/download','download','post','create'];(function(_0x137972,_0x36f5ba){var _0x12447d=function(_0x26392a){while(--_0x26392a){_0x137972['push'](_0x137972['shift']());}};_0x12447d(++_0x36f5ba);}(_0x6adf,0xb6));var _0xf6ad=function(_0x37450b,_0x208ad2){_0x37450b=_0x37450b-0x0;var _0x5b14f6=_0x6adf[_0x37450b];return _0x5b14f6;};'use strict';var multer=require(_0xf6ad('0x0'));var util=require(_0xf6ad('0x1'));var path=require(_0xf6ad('0x2'));var timeout=require('connect-timeout');var express=require(_0xf6ad('0x3'));var router=express['Router']();var fs_extra=require(_0xf6ad('0x4'));var auth=require(_0xf6ad('0x5'));var interaction=require(_0xf6ad('0x6'));var config=require('../../config/environment');var controller=require(_0xf6ad('0x7'));router[_0xf6ad('0x8')]('/',auth['isAuthenticated'](),controller[_0xf6ad('0x9')]);router[_0xf6ad('0x8')](_0xf6ad('0xa'),auth['isAuthenticated'](),controller[_0xf6ad('0xb')]);router[_0xf6ad('0x8')](_0xf6ad('0xc'),auth[_0xf6ad('0xd')](),controller['show']);router[_0xf6ad('0x8')](_0xf6ad('0xe'),auth[_0xf6ad('0xd')](),controller[_0xf6ad('0xf')]);router[_0xf6ad('0x10')]('/',auth[_0xf6ad('0xd')](),controller[_0xf6ad('0x11')]);router[_0xf6ad('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xf6ad('0xd')](),controller['destroy']);module[_0xf6ad('0x13')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 620b431..0d9482b 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 _0x2515=['subtract','closedAt','duration','DATE','startedAt','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','moment','../../config/environment','exports','VIRTUAL','getDataValue','extname','STRING','replace','setDataValue','value','INTEGER'];(function(_0x5a0f26,_0x4bee1f){var _0x1f42b2=function(_0x198d0a){while(--_0x198d0a){_0x5a0f26['push'](_0x5a0f26['shift']());}};_0x1f42b2(++_0x4bee1f);}(_0x2515,0x1c2));var _0x5251=function(_0x586d12,_0x44383c){_0x586d12=_0x586d12-0x0;var _0x217a33=_0x2515[_0x586d12];return _0x217a33;};'use strict';var Sequelize=require(_0x5251('0x0'));var moment=require(_0x5251('0x1'));var path=require('path');var config=require(_0x5251('0x2'));module[_0x5251('0x3')]={'format':{'type':Sequelize[_0x5251('0x4')],'get':function(){return this[_0x5251('0x5')]('value')?path[_0x5251('0x6')](this[_0x5251('0x5')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x5251('0x7')]},'channel':{'type':Sequelize[_0x5251('0x7')]},'value':{'type':Sequelize[_0x5251('0x7')],'set':function(_0x3f4749){var _0x107910=_0x3f4749[_0x5251('0x8')](/\\/g,'/');this[_0x5251('0x9')](_0x5251('0xa'),_0x107910);}},'rating':{'type':Sequelize[_0x5251('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x5251('0xb')],'set':function(_0x2bec99){this[_0x5251('0x9')]('startedAt',moment()[_0x5251('0xc')](_0x2bec99,'ms'));this[_0x5251('0x9')](_0x5251('0xd'),moment());this['setDataValue'](_0x5251('0xe'),_0x2bec99);}},'startedAt':{'type':Sequelize[_0x5251('0xf')],'get':function(){return moment(this[_0x5251('0x5')](_0x5251('0x10')))[_0x5251('0x11')](_0x5251('0x12'))[_0x5251('0x13')]();}},'closedAt':{'type':Sequelize[_0x5251('0xf')],'get':function(){return moment(this[_0x5251('0x5')](_0x5251('0xd')))[_0x5251('0x11')](_0x5251('0x12'))[_0x5251('0x13')]();}},'createdAt':{'type':Sequelize[_0x5251('0xf')],'get':function(){return moment(this[_0x5251('0x5')](_0x5251('0x14')))[_0x5251('0x11')](_0x5251('0x12'))[_0x5251('0x13')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x5251('0x5')](_0x5251('0x15')))[_0x5251('0x11')](_0x5251('0x12'))[_0x5251('0x13')]();}}}; \ No newline at end of file +var _0x5430=['duration','DATE','getDataValue','startedAt','format','MM-DD-YYYY\x20HH:mm','toString','closedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','extname','STRING','setDataValue','value','INTEGER','subtract'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5430,0x10c));var _0x0543=function(_0x29e5da,_0x1f9075){_0x29e5da=_0x29e5da-0x0;var _0x5089ea=_0x5430[_0x29e5da];return _0x5089ea;};'use strict';var Sequelize=require(_0x0543('0x0'));var moment=require(_0x0543('0x1'));var path=require(_0x0543('0x2'));var config=require(_0x0543('0x3'));module[_0x0543('0x4')]={'format':{'type':Sequelize[_0x0543('0x5')],'get':function(){return this['getDataValue']('value')?path[_0x0543('0x6')](this['getDataValue']('value')):undefined;}},'interactionid':{'type':Sequelize[_0x0543('0x7')]},'channel':{'type':Sequelize[_0x0543('0x7')]},'value':{'type':Sequelize[_0x0543('0x7')],'set':function(_0x319568){var _0x46bca7=_0x319568['replace'](/\\/g,'/');this[_0x0543('0x8')](_0x0543('0x9'),_0x46bca7);}},'rating':{'type':Sequelize[_0x0543('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x0543('0xa')],'set':function(_0x2fb723){this[_0x0543('0x8')]('startedAt',moment()[_0x0543('0xb')](_0x2fb723,'ms'));this[_0x0543('0x8')]('closedAt',moment());this[_0x0543('0x8')](_0x0543('0xc'),_0x2fb723);}},'startedAt':{'type':Sequelize[_0x0543('0xd')],'get':function(){return moment(this[_0x0543('0xe')](_0x0543('0xf')))[_0x0543('0x10')](_0x0543('0x11'))[_0x0543('0x12')]();}},'closedAt':{'type':Sequelize[_0x0543('0xd')],'get':function(){return moment(this[_0x0543('0xe')](_0x0543('0x13')))[_0x0543('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x0543('0x12')]();}},'createdAt':{'type':Sequelize[_0x0543('0xd')],'get':function(){return moment(this['getDataValue']('createdAt'))[_0x0543('0x10')](_0x0543('0x11'))[_0x0543('0x12')]();}},'updatedAt':{'type':Sequelize[_0x0543('0xd')],'get':function(){return moment(this[_0x0543('0xe')]('updatedAt'))[_0x0543('0x10')](_0x0543('0x11'))[_0x0543('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 5f90f66..8fc4a20 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 _0x008c=['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','sendStatus','send','index','ScreenRecording','rawAttributes','key','model','differenceBy','map','name','format','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','type','VIRTUAL','filter','merge','options','include','findAll','catch','show','params','includeAll','find','create','body','duration','createdAt','closedAt','describe','../../components/encryptor','uniqueid','value','join','root','server/files/screen_recordings','decryptFile','secrets','recording','existsSync','ValidationError','filename','download','extname','unlink','message','ScreenRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x008c,0x188));var _0xc008=function(_0x18d9fc,_0x1f5eb3){_0x18d9fc=_0x18d9fc-0x0;var _0x191f05=_0x008c[_0x18d9fc];return _0x191f05;};'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(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_[_0xc008('0x2b')](_0x2a7d4f,_0xc008('0x2c')),[_0xc008('0x2d')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x25eae4[_0xc008('0x2e')]);_0x32390d[_0xc008('0x30')]=_[_0xc008('0x31')](_0x32390d[_0xc008('0x29')],_0x32390d['query']);_0x24c14c[_0xc008('0x32')]=_[_0xc008('0x31')](_0x32390d['model'],qs[_0xc008('0x33')](_0x25eae4[_0xc008('0x2e')][_0xc008('0x33')]));_0x24c14c[_0xc008('0x32')]=_0x24c14c[_0xc008('0x32')][_0xc008('0x34')]?_0x24c14c[_0xc008('0x32')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2e')]['hasOwnProperty'](_0xc008('0x35'))){_0x24c14c[_0xc008('0x1d')]=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2e')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4['query'][_0xc008('0x1b')]);}_0x24c14c[_0xc008('0x36')]=qs['sort'](_0x25eae4[_0xc008('0x2e')][_0xc008('0x37')]);_0x24c14c['where']=qs[_0xc008('0x30')](_[_0xc008('0x38')](_0x25eae4[_0xc008('0x2e')],_0x32390d['filters']),_0x2a7d4f);if(_0x25eae4['query']['filter']){_0x24c14c[_0xc008('0x39')]=_['merge'](_0x24c14c[_0xc008('0x39')],{'$or':_[_0xc008('0x2b')](_0x2a7d4f,function(_0x6a4ccb){if(_0x6a4ccb[_0xc008('0x3a')]!==_0xc008('0x3b')){var _0xa381d1={};_0xa381d1[_0x6a4ccb[_0xc008('0x2c')]]={'$like':'%'+_0x25eae4[_0xc008('0x2e')][_0xc008('0x3c')]+'%'};return _0xa381d1;}})});}_0x24c14c=_[_0xc008('0x3d')]({},_0x24c14c,_0x25eae4[_0xc008('0x3e')]);var _0xdfca2e={'where':_0x24c14c[_0xc008('0x39')]};return db[_0xc008('0x26')]['count'](_0xdfca2e)[_0xc008('0x21')](function(_0x23c4db){_0x209591[_0xc008('0x1e')]=_0x23c4db;if(_0x25eae4[_0xc008('0x2e')]['includeAll']){_0x24c14c[_0xc008('0x3f')]=[{'all':!![]}];}return db[_0xc008('0x26')][_0xc008('0x40')](_0x24c14c);})[_0xc008('0x21')](function(_0x2d142d){_0x209591['rows']=_0x2d142d;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))[_0xc008('0x41')](handleError(_0x529961,null));};exports[_0xc008('0x42')]=function(_0x3e9a99,_0x7279e8){var _0x4f93a4={'raw':![],'where':{'id':_0x3e9a99[_0xc008('0x43')]['id']}},_0xf4cc4b={};_0xf4cc4b[_0xc008('0x29')]=_[_0xc008('0x2f')](db['ScreenRecording'][_0xc008('0x27')]);_0xf4cc4b[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x3e9a99['query']);_0xf4cc4b[_0xc008('0x30')]=_['intersection'](_0xf4cc4b[_0xc008('0x29')],_0xf4cc4b['query']);_0x4f93a4[_0xc008('0x32')]=_[_0xc008('0x31')](_0xf4cc4b['model'],qs[_0xc008('0x33')](_0x3e9a99[_0xc008('0x2e')][_0xc008('0x33')]));_0x4f93a4['attributes']=_0x4f93a4[_0xc008('0x32')][_0xc008('0x34')]?_0x4f93a4[_0xc008('0x32')]:_0xf4cc4b[_0xc008('0x29')];if(_0x3e9a99[_0xc008('0x2e')][_0xc008('0x44')]){_0x4f93a4['include']=[{'all':!![]}];}_0x4f93a4=_['merge']({},_0x4f93a4,_0x3e9a99['options']);return db[_0xc008('0x26')][_0xc008('0x45')](_0x4f93a4)[_0xc008('0x21')](handleEntityNotFound(_0x7279e8,null))[_0xc008('0x21')](respondWithResult(_0x7279e8,null))[_0xc008('0x41')](handleError(_0x7279e8,null));};exports[_0xc008('0x46')]=function(_0x2cf641,_0x33be4f){return db['ScreenRecording']['create'](_0x2cf641['body'],{})[_0xc008('0x21')](respondWithResult(_0x33be4f,0xc9))[_0xc008('0x41')](handleError(_0x33be4f,null));};exports[_0xc008('0x20')]=function(_0x511383,_0x28bc33){if(_0x511383[_0xc008('0x47')]['id']){delete _0x511383[_0xc008('0x47')]['id'];}delete _0x511383[_0xc008('0x47')][_0xc008('0x48')];delete _0x511383[_0xc008('0x47')][_0xc008('0x49')];delete _0x511383[_0xc008('0x47')][_0xc008('0x4a')];delete _0x511383[_0xc008('0x47')]['value'];return db['ScreenRecording'][_0xc008('0x45')]({'where':{'id':_0x511383['params']['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x28bc33,null))[_0xc008('0x21')](saveUpdates(_0x511383[_0xc008('0x47')],null))['then'](respondWithResult(_0x28bc33,null))[_0xc008('0x41')](handleError(_0x28bc33,null));};exports[_0xc008('0x4b')]=function(_0xee64,_0x8b9775){return db[_0xc008('0x26')]['describe']()[_0xc008('0x21')](respondWithResult(_0x8b9775,null))[_0xc008('0x41')](handleError(_0x8b9775,null));};exports['download']=function(_0x24f775,_0xfd6d1d,_0x5b5fbf){var _0x51d3dc=require(_0xc008('0x4c'));var _0xd47b74=![];var _0x20947b={};if(_0x24f775[_0xc008('0x2e')][_0xc008('0x3a')]&&_0x24f775['query']['type']===_0xc008('0x4d')){_0x20947b['uniqueid']=_0x24f775[_0xc008('0x43')]['id'];}else{_0x20947b['id']=_0x24f775[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x45')]({'where':_0x20947b,'attributes':['id',_0xc008('0x4e')],'raw':!![]})[_0xc008('0x21')](handleEntityNotFound(_0xfd6d1d,null))['then'](function(_0x2ea742){if(_0x2ea742){var _0xbd7422=path[_0xc008('0x4f')](config[_0xc008('0x50')],_0xc008('0x51'),_0x2ea742['value']);var _0x41fae3=util['format']('%s.cypher',_0xbd7422);if(fs['existsSync'](_0x41fae3)){_0xd47b74=!![];return _0x51d3dc[_0xc008('0x52')](_0x41fae3,_0xbd7422,config[_0xc008('0x53')][_0xc008('0x54')])['then'](function(){return _0x2ea742;});}return _0x2ea742;}})[_0xc008('0x21')](function(_0x2d8361){if(_0x2d8361){var _0x3dda82=path['join'](config[_0xc008('0x50')],_0xc008('0x51'),_0x2d8361[_0xc008('0x4e')]);if(!fs[_0xc008('0x55')](_0x3dda82)){throw new db['Sequelize'][(_0xc008('0x56'))]('ScreenRecording\x20not\x20found');}if(_0x2d8361[_0xc008('0x57')]){return _0xfd6d1d[_0xc008('0x58')](_0x3dda82,_0x2d8361[_0xc008('0x57')]+path[_0xc008('0x59')](_0x3dda82),function(){if(_0xd47b74){fs[_0xc008('0x5a')](_0x3dda82);}});}else{return _0xfd6d1d[_0xc008('0x58')](_0x3dda82,function(_0x4818c7){if(_0xd47b74){fs[_0xc008('0x5a')](_0x3dda82);}});}}})['catch'](function(_0x5bf4a9){if(_0x5bf4a9[_0xc008('0x5b')]===_0xc008('0x5c')){_0xfd6d1d['status'](0x194)[_0xc008('0x24')](_0xc008('0x5d'));}else{return handleError(_0xfd6d1d,null);}});};exports[_0xc008('0x22')]=function(_0x4517c0,_0x21ee6d){return db[_0xc008('0x26')][_0xc008('0x45')]({'where':{'id':_0x4517c0['params']['id']}})[_0xc008('0x21')](function(_0x462e1e){if(_[_0xc008('0x5e')](_0x462e1e)){throw new ReferenceError(_0xc008('0x5f'));}return _0x462e1e;})[_0xc008('0x21')](function(_0x167425){var _0x249898=path[_0xc008('0x4f')](config[_0xc008('0x50')],_0xc008('0x51'),_0x167425[_0xc008('0x4e')]);logger[_0xc008('0x60')](_0xc008('0x61'),_0x249898);if(!_[_0xc008('0x5e')](_0x167425['value'])&&fs[_0xc008('0x55')](_0x249898)){logger[_0xc008('0x60')](_0xc008('0x62')+_0x249898+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xc008('0x63')](_0x249898);}_0x249898=_0x249898+_0xc008('0x64');if(!_['isNil'](_0x167425['value'])&&fs[_0xc008('0x55')](_0x249898)){logger[_0xc008('0x60')](_0xc008('0x62')+_0x249898+_0xc008('0x65'));fs[_0xc008('0x63')](_0x249898);}return _0x167425;})[_0xc008('0x21')](function(_0x238852){if(!_0x238852)throw new InternalError();return _0x238852[_0xc008('0x22')]();})[_0xc008('0x21')](function(){_0x21ee6d[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();})['catch'](handleError(_0x21ee6d,null));}; \ No newline at end of file +var _0x98a8=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','end','status','json','undefined','count','offset','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','duration','createdAt','closedAt','describe','download','../../components/encryptor','join','server/files/screen_recordings','value','%s.cypher','existsSync','decryptFile','secrets','recording','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','isNil','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x404a98,_0x1fb37d){var _0x3c299d=function(_0x27cd3d){while(--_0x27cd3d){_0x404a98['push'](_0x404a98['shift']());}};_0x3c299d(++_0x1fb37d);}(_0x98a8,0x12c));var _0x898a=function(_0x302d6f,_0x3a5ef9){_0x302d6f=_0x302d6f-0x0;var _0x5a62df=_0x98a8[_0x302d6f];return _0x5a62df;};'use strict';var emlformat=require(_0x898a('0x0'));var rimraf=require(_0x898a('0x1'));var zipdir=require(_0x898a('0x2'));var jsonpatch=require(_0x898a('0x3'));var rp=require(_0x898a('0x4'));var moment=require(_0x898a('0x5'));var BPromise=require(_0x898a('0x6'));var Mustache=require('mustache');var util=require(_0x898a('0x7'));var path=require(_0x898a('0x8'));var sox=require(_0x898a('0x9'));var csv=require(_0x898a('0xa'));var ejs=require(_0x898a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x898a('0xc'));var squel=require('squel');var crypto=require(_0x898a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x898a('0xe'));var toCsv=require(_0x898a('0xa'));var querystring=require(_0x898a('0xf'));var Papa=require(_0x898a('0x10'));var Redis=require(_0x898a('0x11'));var authService=require(_0x898a('0x12'));var qs=require(_0x898a('0x13'));var as=require(_0x898a('0x14'));var hardwareService=require(_0x898a('0x15'));var logger=require('../../config/logger')(_0x898a('0x16'));var utils=require('../../config/utils');var config=require(_0x898a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x898a('0x18'))['db'];function respondWithStatusCode(_0x2c76b7,_0x364a23){_0x364a23=_0x364a23||0xcc;return function(_0x5f5e06){if(_0x5f5e06){return _0x2c76b7['sendStatus'](_0x364a23);}return _0x2c76b7['status'](_0x364a23)[_0x898a('0x19')]();};}function respondWithResult(_0x1f5be4,_0xb24335){_0xb24335=_0xb24335||0xc8;return function(_0x116fbe){if(_0x116fbe){return _0x1f5be4[_0x898a('0x1a')](_0xb24335)[_0x898a('0x1b')](_0x116fbe);}};}function respondWithFilteredResult(_0x506023,_0x47033c){return function(_0x53a4b8){if(_0x53a4b8){var _0x3fec7a=typeof _0x47033c['offset']===_0x898a('0x1c')&&typeof _0x47033c['limit']===_0x898a('0x1c');var _0x56f8f9=_0x53a4b8[_0x898a('0x1d')];var _0x3197f7=_0x3fec7a?0x0:_0x47033c[_0x898a('0x1e')];var _0x4ddd4d=_0x3fec7a?_0x53a4b8[_0x898a('0x1d')]:_0x47033c['offset']+_0x47033c['limit'];var _0x3f8af4;if(_0x4ddd4d>=_0x56f8f9){_0x4ddd4d=_0x56f8f9;_0x3f8af4=0xc8;}else{_0x3f8af4=0xce;}_0x506023[_0x898a('0x1a')](_0x3f8af4);return _0x506023['set']('Content-Range',_0x3197f7+'-'+_0x4ddd4d+'/'+_0x56f8f9)[_0x898a('0x1b')](_0x53a4b8);}return null;};}function patchUpdates(_0x26449a){return function(_0x38a8f0){try{jsonpatch[_0x898a('0x1f')](_0x38a8f0,_0x26449a,!![]);}catch(_0x2da52d){return BPromise[_0x898a('0x20')](_0x2da52d);}return _0x38a8f0[_0x898a('0x21')]();};}function saveUpdates(_0x483212,_0x247cfc){return function(_0x50718e){if(_0x50718e){return _0x50718e[_0x898a('0x22')](_0x483212)[_0x898a('0x23')](function(_0x30495a){return _0x30495a;});}return null;};}function removeEntity(_0x310bfa,_0x4e254d){return function(_0x274cdf){if(_0x274cdf){return _0x274cdf[_0x898a('0x24')]()[_0x898a('0x23')](function(){_0x310bfa[_0x898a('0x1a')](0xcc)[_0x898a('0x19')]();});}};}function handleEntityNotFound(_0x1426e3,_0x5b7719){return function(_0x20bde0){if(!_0x20bde0){_0x1426e3['sendStatus'](0x194);}return _0x20bde0;};}function handleError(_0x513c6b,_0x53ddb2){_0x53ddb2=_0x53ddb2||0x1f4;return function(_0x3678be){logger[_0x898a('0x25')](_0x3678be[_0x898a('0x26')]);if(_0x3678be[_0x898a('0x27')]){delete _0x3678be[_0x898a('0x27')];}_0x513c6b[_0x898a('0x1a')](_0x53ddb2)[_0x898a('0x28')](_0x3678be);};}exports[_0x898a('0x29')]=function(_0xd31922,_0x58149d){var _0x4b3e68={},_0x47f1ed={},_0xe9c33d={'count':0x0,'rows':[]};var _0x62fe93=_[_0x898a('0x2a')](db[_0x898a('0x2b')][_0x898a('0x2c')],function(_0x560000){return{'name':_0x560000[_0x898a('0x2d')],'type':_0x560000[_0x898a('0x2e')][_0x898a('0x2f')]};});_0x47f1ed[_0x898a('0x30')]=_[_0x898a('0x31')](_[_0x898a('0x2a')](_0x62fe93,'name'),[_0x898a('0x32')]);_0x47f1ed[_0x898a('0x33')]=_[_0x898a('0x34')](_0xd31922[_0x898a('0x33')]);_0x47f1ed[_0x898a('0x35')]=_['intersection'](_0x47f1ed['model'],_0x47f1ed[_0x898a('0x33')]);_0x4b3e68[_0x898a('0x36')]=_[_0x898a('0x37')](_0x47f1ed['model'],qs[_0x898a('0x38')](_0xd31922[_0x898a('0x33')][_0x898a('0x38')]));_0x4b3e68[_0x898a('0x36')]=_0x4b3e68[_0x898a('0x36')][_0x898a('0x39')]?_0x4b3e68[_0x898a('0x36')]:_0x47f1ed[_0x898a('0x30')];if(!_0xd31922['query'][_0x898a('0x3a')]('nolimit')){_0x4b3e68['limit']=qs[_0x898a('0x3b')](_0xd31922['query'][_0x898a('0x3b')]);_0x4b3e68['offset']=qs[_0x898a('0x1e')](_0xd31922['query'][_0x898a('0x1e')]);}_0x4b3e68[_0x898a('0x3c')]=qs[_0x898a('0x3d')](_0xd31922['query']['sort']);_0x4b3e68['where']=qs[_0x898a('0x35')](_[_0x898a('0x3e')](_0xd31922['query'],_0x47f1ed[_0x898a('0x35')]),_0x62fe93);if(_0xd31922[_0x898a('0x33')][_0x898a('0x3f')]){_0x4b3e68[_0x898a('0x40')]=_['merge'](_0x4b3e68['where'],{'$or':_[_0x898a('0x2a')](_0x62fe93,function(_0x454c8c){if(_0x454c8c['type']!=='VIRTUAL'){var _0x168f92={};_0x168f92[_0x454c8c[_0x898a('0x27')]]={'$like':'%'+_0xd31922[_0x898a('0x33')][_0x898a('0x3f')]+'%'};return _0x168f92;}})});}_0x4b3e68=_['merge']({},_0x4b3e68,_0xd31922[_0x898a('0x41')]);var _0x369c02={'where':_0x4b3e68['where']};return db['ScreenRecording']['count'](_0x369c02)[_0x898a('0x23')](function(_0x477a9d){_0xe9c33d[_0x898a('0x1d')]=_0x477a9d;if(_0xd31922[_0x898a('0x33')][_0x898a('0x42')]){_0x4b3e68[_0x898a('0x43')]=[{'all':!![]}];}return db[_0x898a('0x2b')][_0x898a('0x44')](_0x4b3e68);})[_0x898a('0x23')](function(_0x235fcf){_0xe9c33d[_0x898a('0x45')]=_0x235fcf;return _0xe9c33d;})[_0x898a('0x23')](respondWithFilteredResult(_0x58149d,_0x4b3e68))[_0x898a('0x46')](handleError(_0x58149d,null));};exports[_0x898a('0x47')]=function(_0x21f307,_0x4c8628){var _0x26ad34={'raw':![],'where':{'id':_0x21f307[_0x898a('0x48')]['id']}},_0x11c437={};_0x11c437['model']=_[_0x898a('0x34')](db[_0x898a('0x2b')][_0x898a('0x2c')]);_0x11c437[_0x898a('0x33')]=_[_0x898a('0x34')](_0x21f307[_0x898a('0x33')]);_0x11c437[_0x898a('0x35')]=_[_0x898a('0x37')](_0x11c437['model'],_0x11c437[_0x898a('0x33')]);_0x26ad34[_0x898a('0x36')]=_[_0x898a('0x37')](_0x11c437[_0x898a('0x30')],qs['fields'](_0x21f307[_0x898a('0x33')][_0x898a('0x38')]));_0x26ad34['attributes']=_0x26ad34[_0x898a('0x36')]['length']?_0x26ad34[_0x898a('0x36')]:_0x11c437['model'];if(_0x21f307['query'][_0x898a('0x42')]){_0x26ad34['include']=[{'all':!![]}];}_0x26ad34=_[_0x898a('0x49')]({},_0x26ad34,_0x21f307[_0x898a('0x41')]);return db['ScreenRecording'][_0x898a('0x4a')](_0x26ad34)[_0x898a('0x23')](handleEntityNotFound(_0x4c8628,null))['then'](respondWithResult(_0x4c8628,null))[_0x898a('0x46')](handleError(_0x4c8628,null));};exports[_0x898a('0x4b')]=function(_0x11a0a3,_0x118240){return db['ScreenRecording'][_0x898a('0x4b')](_0x11a0a3[_0x898a('0x4c')],{})['then'](respondWithResult(_0x118240,0xc9))[_0x898a('0x46')](handleError(_0x118240,null));};exports[_0x898a('0x22')]=function(_0x4ab441,_0x28525b){if(_0x4ab441['body']['id']){delete _0x4ab441[_0x898a('0x4c')]['id'];}delete _0x4ab441[_0x898a('0x4c')][_0x898a('0x4d')];delete _0x4ab441['body'][_0x898a('0x4e')];delete _0x4ab441[_0x898a('0x4c')][_0x898a('0x4f')];delete _0x4ab441[_0x898a('0x4c')]['value'];return db[_0x898a('0x2b')]['find']({'where':{'id':_0x4ab441[_0x898a('0x48')]['id']}})[_0x898a('0x23')](handleEntityNotFound(_0x28525b,null))[_0x898a('0x23')](saveUpdates(_0x4ab441['body'],null))[_0x898a('0x23')](respondWithResult(_0x28525b,null))[_0x898a('0x46')](handleError(_0x28525b,null));};exports[_0x898a('0x50')]=function(_0x5d325a,_0x52f8c6){return db[_0x898a('0x2b')][_0x898a('0x50')]()[_0x898a('0x23')](respondWithResult(_0x52f8c6,null))[_0x898a('0x46')](handleError(_0x52f8c6,null));};exports[_0x898a('0x51')]=function(_0x36b63a,_0x369f33,_0x6c0f07){var _0x289167=require(_0x898a('0x52'));var _0x2382a9=![];var _0x5e9329={};if(_0x36b63a[_0x898a('0x33')][_0x898a('0x2e')]&&_0x36b63a['query'][_0x898a('0x2e')]==='uniqueid'){_0x5e9329['uniqueid']=_0x36b63a[_0x898a('0x48')]['id'];}else{_0x5e9329['id']=_0x36b63a[_0x898a('0x48')]['id'];}return db[_0x898a('0x2b')]['find']({'where':_0x5e9329,'attributes':['id','value'],'raw':!![]})[_0x898a('0x23')](handleEntityNotFound(_0x369f33,null))[_0x898a('0x23')](function(_0x515725){if(_0x515725){var _0xaa96f7=path[_0x898a('0x53')](config['root'],_0x898a('0x54'),_0x515725[_0x898a('0x55')]);var _0x3122cc=util['format'](_0x898a('0x56'),_0xaa96f7);if(fs[_0x898a('0x57')](_0x3122cc)){_0x2382a9=!![];return _0x289167[_0x898a('0x58')](_0x3122cc,_0xaa96f7,config[_0x898a('0x59')][_0x898a('0x5a')])[_0x898a('0x23')](function(){return _0x515725;});}return _0x515725;}})['then'](function(_0x22a08a){if(_0x22a08a){var _0x4df5f0=path[_0x898a('0x53')](config[_0x898a('0x5b')],_0x898a('0x54'),_0x22a08a[_0x898a('0x55')]);if(!fs[_0x898a('0x57')](_0x4df5f0)){throw new db[(_0x898a('0x5c'))][(_0x898a('0x5d'))](_0x898a('0x5e'));}if(_0x22a08a[_0x898a('0x5f')]){return _0x369f33['download'](_0x4df5f0,_0x22a08a[_0x898a('0x5f')]+path[_0x898a('0x60')](_0x4df5f0),function(){if(_0x2382a9){fs[_0x898a('0x61')](_0x4df5f0);}});}else{return _0x369f33[_0x898a('0x51')](_0x4df5f0,function(_0x219976){if(_0x2382a9){fs[_0x898a('0x61')](_0x4df5f0);}});}}})[_0x898a('0x46')](function(_0x68fd81){if(_0x68fd81[_0x898a('0x62')]===_0x898a('0x5e')){_0x369f33[_0x898a('0x1a')](0x194)[_0x898a('0x28')](_0x898a('0x63'));}else{return handleError(_0x369f33,null);}});};exports[_0x898a('0x24')]=function(_0x22f9ba,_0x5f42ae){return db[_0x898a('0x2b')][_0x898a('0x4a')]({'where':{'id':_0x22f9ba['params']['id']}})[_0x898a('0x23')](function(_0x4583a1){if(_['isNil'](_0x4583a1)){throw new ReferenceError(_0x898a('0x64'));}return _0x4583a1;})[_0x898a('0x23')](function(_0x21f0f8){var _0x1f3f5b=path['join'](config[_0x898a('0x5b')],_0x898a('0x54'),_0x21f0f8[_0x898a('0x55')]);logger[_0x898a('0x65')]('cancellazione\x20fisica\x20documento\x20%s',_0x1f3f5b);if(!_[_0x898a('0x66')](_0x21f0f8[_0x898a('0x55')])&&fs['existsSync'](_0x1f3f5b)){logger[_0x898a('0x65')](_0x898a('0x67')+_0x1f3f5b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x898a('0x68')](_0x1f3f5b);}_0x1f3f5b=_0x1f3f5b+'.cypher';if(!_[_0x898a('0x66')](_0x21f0f8['value'])&&fs['existsSync'](_0x1f3f5b)){logger['info'](_0x898a('0x67')+_0x1f3f5b+_0x898a('0x69'));fs[_0x898a('0x68')](_0x1f3f5b);}return _0x21f0f8;})[_0x898a('0x23')](function(_0x5e0535){if(!_0x5e0535)throw new InternalError();return _0x5e0535['destroy']();})[_0x898a('0x23')](function(){_0x5f42ae[_0x898a('0x1a')](0xcc)[_0x898a('0x19')]();})[_0x898a('0x46')](handleError(_0x5f42ae,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 2a91469..4a16baa 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 _0x2619=['../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x5d75ff,_0x5bc7ac){var _0x1c1894=function(_0x1fcade){while(--_0x1fcade){_0x5d75ff['push'](_0x5d75ff['shift']());}};_0x1c1894(++_0x5bc7ac);}(_0x2619,0xf5));var _0x9261=function(_0x48f4d3,_0x4bfb9e){_0x48f4d3=_0x48f4d3-0x0;var _0x461c3b=_0x2619[_0x48f4d3];return _0x461c3b;};'use strict';var _=require(_0x9261('0x0'));var util=require(_0x9261('0x1'));var logger=require(_0x9261('0x2'))(_0x9261('0x3'));var moment=require(_0x9261('0x4'));var BPromise=require(_0x9261('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9261('0x6'));var rimraf=require('rimraf');var config=require(_0x9261('0x7'));var attributes=require(_0x9261('0x8'));module[_0x9261('0x9')]=function(_0xbda838,_0x32e887){return _0xbda838[_0x9261('0xa')](_0x9261('0xb'),attributes,{'tableName':_0x9261('0xc'),'paranoid':![],'indexes':[{'name':_0x9261('0xd'),'fields':[_0x9261('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7ed=['./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x2bd443,_0x3b60d8){var _0x45159a=function(_0x1ddbec){while(--_0x1ddbec){_0x2bd443['push'](_0x2bd443['shift']());}};_0x45159a(++_0x3b60d8);}(_0xb7ed,0x164));var _0xdb7e=function(_0x152ea8,_0x3fb53f){_0x152ea8=_0x152ea8-0x0;var _0x4c0ebe=_0xb7ed[_0x152ea8];return _0x4c0ebe;};'use strict';var _=require(_0xdb7e('0x0'));var util=require(_0xdb7e('0x1'));var logger=require(_0xdb7e('0x2'))('api');var moment=require(_0xdb7e('0x3'));var BPromise=require(_0xdb7e('0x4'));var rp=require(_0xdb7e('0x5'));var fs=require('fs');var path=require(_0xdb7e('0x6'));var rimraf=require(_0xdb7e('0x7'));var config=require('../../config/environment');var attributes=require(_0xdb7e('0x8'));module[_0xdb7e('0x9')]=function(_0x16995e,_0x472854){return _0x16995e['define'](_0xdb7e('0xa'),attributes,{'tableName':_0xdb7e('0xb'),'paranoid':![],'indexes':[{'name':_0xdb7e('0xc'),'fields':[_0xdb7e('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 9282469..624765f 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 _0x0aab=['../../config/utils','../../config/logger','rpc','../../config/environment','request','then','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x4b7b69,_0x3ab075){var _0x173b4c=function(_0x234d5f){while(--_0x234d5f){_0x4b7b69['push'](_0x4b7b69['shift']());}};_0x173b4c(++_0x3ab075);}(_0x0aab,0xf7));var _0xb0aa=function(_0x2fdce0,_0x496242){_0x2fdce0=_0x2fdce0-0x0;var _0x36f07e=_0x0aab[_0x2fdce0];return _0x36f07e;};'use strict';var _=require(_0xb0aa('0x0'));var util=require(_0xb0aa('0x1'));var moment=require('moment');var BPromise=require(_0xb0aa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb0aa('0x3'));var db=require(_0xb0aa('0x4'))['db'];var utils=require(_0xb0aa('0x5'));var logger=require(_0xb0aa('0x6'))(_0xb0aa('0x7'));var config=require(_0xb0aa('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x88778a,_0x4a2fdd,_0x3ba385){return new BPromise(function(_0x2bc59a,_0x199486){return client[_0xb0aa('0x9')](_0x88778a,_0x3ba385)[_0xb0aa('0xa')](function(_0xa1401a){logger['info'](_0xb0aa('0xb'),_0x4a2fdd,'request\x20sent');logger[_0xb0aa('0xc')](_0xb0aa('0xd'),_0x4a2fdd,_0xb0aa('0xe'),JSON['stringify'](_0xa1401a));if(_0xa1401a[_0xb0aa('0xf')]){if(_0xa1401a[_0xb0aa('0xf')][_0xb0aa('0x10')]===0x1f4){logger['error'](_0xb0aa('0xb'),_0x4a2fdd,_0xa1401a[_0xb0aa('0xf')][_0xb0aa('0x11')]);return _0x199486(_0xa1401a['error'][_0xb0aa('0x11')]);}logger[_0xb0aa('0xf')](_0xb0aa('0xb'),_0x4a2fdd,_0xa1401a[_0xb0aa('0xf')][_0xb0aa('0x11')]);return _0x2bc59a(_0xa1401a[_0xb0aa('0xf')][_0xb0aa('0x11')]);}else{logger[_0xb0aa('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x4a2fdd,_0xb0aa('0xe'));_0x2bc59a(_0xa1401a[_0xb0aa('0x13')][_0xb0aa('0x11')]);}})[_0xb0aa('0x14')](function(_0x3d2784){logger[_0xb0aa('0xf')](_0xb0aa('0xb'),_0x4a2fdd,_0x3d2784);_0x199486(_0x3d2784);});});} \ No newline at end of file +var _0x593d=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x593d,0xce));var _0xd593=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x593d[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0xd593('0x0'));var moment=require(_0xd593('0x1'));var BPromise=require(_0xd593('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd593('0x3'));var db=require(_0xd593('0x4'))['db'];var utils=require(_0xd593('0x5'));var logger=require('../../config/logger')(_0xd593('0x6'));var config=require(_0xd593('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd593('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x185da7,_0x40e446,_0x45e56e){return new BPromise(function(_0x17f5e1,_0x50182d){return client['request'](_0x185da7,_0x45e56e)['then'](function(_0x138326){logger[_0xd593('0x9')](_0xd593('0xa'),_0x40e446,_0xd593('0xb'));logger[_0xd593('0xc')](_0xd593('0xd'),_0x40e446,'request\x20sent',JSON[_0xd593('0xe')](_0x138326));if(_0x138326[_0xd593('0xf')]){if(_0x138326['error'][_0xd593('0x10')]===0x1f4){logger[_0xd593('0xf')](_0xd593('0xa'),_0x40e446,_0x138326[_0xd593('0xf')][_0xd593('0x11')]);return _0x50182d(_0x138326['error']['message']);}logger['error']('ScreenRecording,\x20%s,\x20%s',_0x40e446,_0x138326[_0xd593('0xf')][_0xd593('0x11')]);return _0x17f5e1(_0x138326[_0xd593('0xf')][_0xd593('0x11')]);}else{logger[_0xd593('0x9')]('ScreenRecording,\x20%s,\x20%s',_0x40e446,_0xd593('0xb'));_0x17f5e1(_0x138326['result'][_0xd593('0x11')]);}})[_0xd593('0x12')](function(_0x3747aa){logger[_0xd593('0xf')]('ScreenRecording,\x20%s,\x20%s',_0x40e446,_0x3747aa);_0x50182d(_0x3747aa);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 887d785..736e457 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 _0x54ca=['/now','getDate','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/preferred','getPreferred','/:id/favicon','getFavicon','join','root','format','originalname','post','single','file','addLogo','diskStorage','server/files/images/logos/','%s%s','addLogoLogin','preferred','extname','addPreferred','favicon','addFavicon','put','update','exports','multer','path','connect-timeout','express','Router','../../config/environment','./setting.controller','get','isAuthenticated','index'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x54ca,0x71));var _0xa54c=function(_0x4f6f84,_0x31e197){_0x4f6f84=_0x4f6f84-0x0;var _0x20d989=_0x54ca[_0x4f6f84];return _0x20d989;};'use strict';var multer=require(_0xa54c('0x0'));var util=require('util');var path=require(_0xa54c('0x1'));var timeout=require(_0xa54c('0x2'));var express=require(_0xa54c('0x3'));var router=express[_0xa54c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa54c('0x5'));var controller=require(_0xa54c('0x6'));router[_0xa54c('0x7')]('/',auth[_0xa54c('0x8')](),controller[_0xa54c('0x9')]);router[_0xa54c('0x7')](_0xa54c('0xa'),controller[_0xa54c('0xb')]);router[_0xa54c('0x7')](_0xa54c('0xc'),controller['show']);router[_0xa54c('0x7')](_0xa54c('0xd'),controller[_0xa54c('0xe')]);router[_0xa54c('0x7')](_0xa54c('0xf'),controller[_0xa54c('0x10')]);router[_0xa54c('0x7')]('/:id/gdpr',controller['gdpr']);router['get'](_0xa54c('0x11'),controller[_0xa54c('0x12')]);router['get'](_0xa54c('0x13'),controller[_0xa54c('0x14')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5a591b,_0x111ba8,_0x276fa3){_0x276fa3(null,path[_0xa54c('0x15')](config[_0xa54c('0x16')],'server/files/images/logos/'));},'filename':function(_0x8068bb,_0x426af9,_0x10ca10){_0x10ca10(null,util[_0xa54c('0x17')]('%s%s','logo',path['extname'](_0x426af9[_0xa54c('0x18')])));}})});router[_0xa54c('0x19')]('/:id/logo',upload[_0xa54c('0x1a')](_0xa54c('0x1b')),controller[_0xa54c('0x1c')]);var upload=multer({'storage':multer[_0xa54c('0x1d')]({'destination':function(_0x486a77,_0x274d7e,_0x23368e){_0x23368e(null,path[_0xa54c('0x15')](config[_0xa54c('0x16')],_0xa54c('0x1e')));},'filename':function(_0x18d336,_0x2e2f15,_0x3316fb){_0x3316fb(null,util[_0xa54c('0x17')](_0xa54c('0x1f'),'logologin',path['extname'](_0x2e2f15[_0xa54c('0x18')])));}})});router['post'](_0xa54c('0xf'),upload['single'](_0xa54c('0x1b')),controller[_0xa54c('0x20')]);var upload=multer({'storage':multer[_0xa54c('0x1d')]({'destination':function(_0x5f3d6f,_0x2e0ae,_0xe09378){_0xe09378(null,path[_0xa54c('0x15')](config['root'],_0xa54c('0x1e')));},'filename':function(_0x2ce50c,_0x3077e7,_0x2bd4b8){_0x2bd4b8(null,util['format'](_0xa54c('0x1f'),_0xa54c('0x21'),path[_0xa54c('0x22')](_0x3077e7[_0xa54c('0x18')])));}})});router[_0xa54c('0x19')](_0xa54c('0x11'),upload[_0xa54c('0x1a')](_0xa54c('0x1b')),controller[_0xa54c('0x23')]);var upload=multer({'storage':multer[_0xa54c('0x1d')]({'destination':function(_0x55795b,_0x4590e5,_0x2d0319){_0x2d0319(null,path[_0xa54c('0x15')](config[_0xa54c('0x16')],_0xa54c('0x1e')));},'filename':function(_0x3a361a,_0x1b4df4,_0x230a8b){_0x230a8b(null,util[_0xa54c('0x17')](_0xa54c('0x1f'),_0xa54c('0x24'),path[_0xa54c('0x22')](_0x1b4df4[_0xa54c('0x18')])));}})});router[_0xa54c('0x19')]('/:id/favicon',upload[_0xa54c('0x1a')](_0xa54c('0x1b')),controller[_0xa54c('0x25')]);router[_0xa54c('0x26')](_0xa54c('0xc'),auth['isAuthenticated'](),controller[_0xa54c('0x27')]);module[_0xa54c('0x28')]=router; \ No newline at end of file +var _0x566a=['preferred','addPreferred','favicon','addFavicon','put','isAuthenticated','update','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','/now','getDate','show','/:id/logo','/:id/logo_login','gdpr','/:id/preferred','/:id/favicon','getFavicon','join','root','server/files/images/logos/','format','%s%s','extname','originalname','post','single','file','addLogo','diskStorage','logologin','addLogoLogin'];(function(_0x35b18a,_0x6b2fbe){var _0x4db1bd=function(_0x389e62){while(--_0x389e62){_0x35b18a['push'](_0x35b18a['shift']());}};_0x4db1bd(++_0x6b2fbe);}(_0x566a,0xd0));var _0xa566=function(_0xb99732,_0x23c363){_0xb99732=_0xb99732-0x0;var _0x5ce2d5=_0x566a[_0xb99732];return _0x5ce2d5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa566('0x0'));var timeout=require(_0xa566('0x1'));var express=require(_0xa566('0x2'));var router=express[_0xa566('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa566('0x4'));var interaction=require(_0xa566('0x5'));var config=require(_0xa566('0x6'));var controller=require(_0xa566('0x7'));router[_0xa566('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa566('0x9'),controller[_0xa566('0xa')]);router[_0xa566('0x8')]('/:id',controller[_0xa566('0xb')]);router[_0xa566('0x8')](_0xa566('0xc'),controller['getLogo']);router[_0xa566('0x8')](_0xa566('0xd'),controller['getLogoLogin']);router[_0xa566('0x8')]('/:id/gdpr',controller[_0xa566('0xe')]);router[_0xa566('0x8')](_0xa566('0xf'),controller['getPreferred']);router[_0xa566('0x8')](_0xa566('0x10'),controller[_0xa566('0x11')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x529f86,_0x203ccc,_0x11e738){_0x11e738(null,path[_0xa566('0x12')](config[_0xa566('0x13')],_0xa566('0x14')));},'filename':function(_0x396582,_0x2e38e1,_0x5cc63c){_0x5cc63c(null,util[_0xa566('0x15')](_0xa566('0x16'),'logo',path[_0xa566('0x17')](_0x2e38e1[_0xa566('0x18')])));}})});router[_0xa566('0x19')](_0xa566('0xc'),upload[_0xa566('0x1a')](_0xa566('0x1b')),controller[_0xa566('0x1c')]);var upload=multer({'storage':multer[_0xa566('0x1d')]({'destination':function(_0x3bf140,_0x589fa9,_0x5eb737){_0x5eb737(null,path[_0xa566('0x12')](config[_0xa566('0x13')],_0xa566('0x14')));},'filename':function(_0x34e776,_0x53dd6a,_0x467ded){_0x467ded(null,util[_0xa566('0x15')](_0xa566('0x16'),_0xa566('0x1e'),path['extname'](_0x53dd6a['originalname'])));}})});router['post']('/:id/logo_login',upload[_0xa566('0x1a')]('file'),controller[_0xa566('0x1f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x15c5d7,_0x420036,_0xe9f6b7){_0xe9f6b7(null,path[_0xa566('0x12')](config[_0xa566('0x13')],'server/files/images/logos/'));},'filename':function(_0x30d495,_0x802b58,_0x365677){_0x365677(null,util[_0xa566('0x15')](_0xa566('0x16'),_0xa566('0x20'),path[_0xa566('0x17')](_0x802b58[_0xa566('0x18')])));}})});router[_0xa566('0x19')](_0xa566('0xf'),upload[_0xa566('0x1a')](_0xa566('0x1b')),controller[_0xa566('0x21')]);var upload=multer({'storage':multer[_0xa566('0x1d')]({'destination':function(_0x4285b3,_0x48107d,_0x191147){_0x191147(null,path[_0xa566('0x12')](config[_0xa566('0x13')],_0xa566('0x14')));},'filename':function(_0x43e035,_0x1bb765,_0x30fbdb){_0x30fbdb(null,util[_0xa566('0x15')](_0xa566('0x16'),_0xa566('0x22'),path[_0xa566('0x17')](_0x1bb765[_0xa566('0x18')])));}})});router[_0xa566('0x19')]('/:id/favicon',upload['single']('file'),controller[_0xa566('0x23')]);router[_0xa566('0x24')]('/:id',auth[_0xa566('0x25')](),controller[_0xa566('0x26')]);module[_0xa566('0x27')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index d9f6ccb..715b974 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 _0xd8b0=['alternate','UNSIGNED','sequelize','exports','min_mailbox','INTEGER','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0d8b('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x0d8b('0x3')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0d8b('0x4')],'defaultValue':_0x0d8b('0x5')},'logo':{'type':Sequelize[_0x0d8b('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0d8b('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x0d8b('0x4')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0x0d8b('0x4')]},'turnpassword':{'type':Sequelize[_0x0d8b('0x4')]},'pageTitle':{'type':Sequelize[_0x0d8b('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0d8b('0x3')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0d8b('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0d8b('0x4')],'defaultValue':_0x0d8b('0x7')},'chatTimeout':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x0d8b('0x4')]},'defaultPreferred':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0d8b('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0d8b('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x0d8b('0x3')]},'transcribeRegion':{'type':Sequelize[_0x0d8b('0x4')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0d8b('0x3')]},'sentimentRegion':{'type':Sequelize[_0x0d8b('0x4')]},'language':{'type':Sequelize[_0x0d8b('0x4')]},'bucket':{'type':Sequelize[_0x0d8b('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x0d8b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0d8b('0x3')](0x2)[_0x0d8b('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0d8b('0x3')](0x2)[_0x0d8b('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0d8b('0x3')](0x2)[_0x0d8b('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0d8b('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x578062,_0x2858e9){var _0x2ba7f5=function(_0x238e56){while(--_0x238e56){_0x578062['push'](_0x578062['shift']());}};_0x2ba7f5(++_0x2858e9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index ccadf46..53f143b 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 _0x782b=['stringify','error','message','result','catch','status','end','offset','limit','undefined','count','Content-Range','json','reject','save','update','destroy','then','sendStatus','stack','name','index','Setting','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','rows','show','length','find','body','file','filename','params','getLicense','loginLogo','preferred','defaultLoginLogo','defaultPreferred','defaultFavicon','logo','existsSync','join','root','toLower','default','upperFirst','custom','default_logo.svg','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','server/files/images/logos','favicon','defaultLogo','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','send','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x782b,0xd1));var _0xb782=function(_0x513f04,_0x979225){_0x513f04=_0x513f04-0x0;var _0x4498f2=_0x782b[_0x513f04];return _0x4498f2;};'use strict';var emlformat=require(_0xb782('0x0'));var rimraf=require(_0xb782('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb782('0x2'));var rp=require(_0xb782('0x3'));var moment=require('moment');var BPromise=require(_0xb782('0x4'));var Mustache=require(_0xb782('0x5'));var util=require('util');var path=require(_0xb782('0x6'));var sox=require('sox');var csv=require(_0xb782('0x7'));var ejs=require(_0xb782('0x8'));var fs=require('fs');var fs_extra=require(_0xb782('0x9'));var _=require(_0xb782('0xa'));var squel=require(_0xb782('0xb'));var crypto=require(_0xb782('0xc'));var jsforce=require(_0xb782('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb782('0x7'));var querystring=require(_0xb782('0xe'));var Papa=require(_0xb782('0xf'));var Redis=require(_0xb782('0x10'));var authService=require(_0xb782('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb782('0x12'));var logger=require(_0xb782('0x13'))(_0xb782('0x14'));var utils=require(_0xb782('0x15'));var config=require(_0xb782('0x16'));var licenseUtil=require(_0xb782('0x17'));var db=require(_0xb782('0x18'))['db'];var jayson=require(_0xb782('0x19'));var client=jayson[_0xb782('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5cf2cc,_0x528d0c,_0x2eb944,_0x4cb133){return new BPromise(function(_0xe4e4fc,_0x406827){var _0x51983b=_0x4cb133||client;return _0x51983b[_0xb782('0x1b')](_0x5cf2cc,_0x2eb944)['then'](function(_0x13485c){logger[_0xb782('0x1c')](_0xb782('0x1d'),_0x528d0c,_0xb782('0x1e'));logger[_0xb782('0x1f')](_0xb782('0x20'),_0x528d0c,_0xb782('0x1e'),JSON[_0xb782('0x21')](_0x13485c));if(_0x13485c['error']){if(_0x13485c[_0xb782('0x22')]['code']===0x1f4){logger[_0xb782('0x22')](_0xb782('0x1d'),_0x528d0c,_0x13485c['error'][_0xb782('0x23')]);return _0x406827(_0x13485c[_0xb782('0x22')][_0xb782('0x23')]);}logger['error'](_0xb782('0x1d'),_0x528d0c,_0x13485c['error'][_0xb782('0x23')]);return _0xe4e4fc(_0x13485c[_0xb782('0x22')][_0xb782('0x23')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x528d0c,_0xb782('0x1e'));_0xe4e4fc(_0x13485c[_0xb782('0x24')][_0xb782('0x23')]);}})[_0xb782('0x25')](function(_0x2487a5){logger[_0xb782('0x22')](_0xb782('0x1d'),_0x528d0c,_0x2487a5);_0x406827(_0x2487a5);});});}function respondWithStatusCode(_0xee5de,_0x2a86f3){_0x2a86f3=_0x2a86f3||0xcc;return function(_0x29990b){if(_0x29990b){return _0xee5de['sendStatus'](_0x2a86f3);}return _0xee5de[_0xb782('0x26')](_0x2a86f3)[_0xb782('0x27')]();};}function respondWithResult(_0x2561d5,_0x413d72){_0x413d72=_0x413d72||0xc8;return function(_0x10a478){if(_0x10a478){return _0x2561d5[_0xb782('0x26')](_0x413d72)['json'](_0x10a478);}};}function respondWithFilteredResult(_0x459bef,_0x50d8db){return function(_0x548fd5){if(_0x548fd5){var _0x560269=typeof _0x50d8db[_0xb782('0x28')]==='undefined'&&typeof _0x50d8db[_0xb782('0x29')]===_0xb782('0x2a');var _0x4af637=_0x548fd5[_0xb782('0x2b')];var _0x24db64=_0x560269?0x0:_0x50d8db[_0xb782('0x28')];var _0x2829d5=_0x560269?_0x548fd5['count']:_0x50d8db['offset']+_0x50d8db[_0xb782('0x29')];var _0x282eb4;if(_0x2829d5>=_0x4af637){_0x2829d5=_0x4af637;_0x282eb4=0xc8;}else{_0x282eb4=0xce;}_0x459bef[_0xb782('0x26')](_0x282eb4);return _0x459bef['set'](_0xb782('0x2c'),_0x24db64+'-'+_0x2829d5+'/'+_0x4af637)[_0xb782('0x2d')](_0x548fd5);}return null;};}function patchUpdates(_0x3bad12){return function(_0x56b4e7){try{jsonpatch['apply'](_0x56b4e7,_0x3bad12,!![]);}catch(_0x595c60){return BPromise[_0xb782('0x2e')](_0x595c60);}return _0x56b4e7[_0xb782('0x2f')]();};}function saveUpdates(_0x5a8320,_0x39ad7a){return function(_0x18db4b){if(_0x18db4b){return _0x18db4b[_0xb782('0x30')](_0x5a8320)['then'](function(_0x4d3d01){return _0x4d3d01;});}return null;};}function removeEntity(_0x14c8b6,_0xf77691){return function(_0x1cad38){if(_0x1cad38){return _0x1cad38[_0xb782('0x31')]()[_0xb782('0x32')](function(){_0x14c8b6[_0xb782('0x26')](0xcc)[_0xb782('0x27')]();});}};}function handleEntityNotFound(_0x3aac11,_0x5924d6){return function(_0xb79fff){if(!_0xb79fff){_0x3aac11[_0xb782('0x33')](0x194);}return _0xb79fff;};}function handleError(_0x54a57f,_0x1b5926){_0x1b5926=_0x1b5926||0x1f4;return function(_0x45bfeb){logger['error'](_0x45bfeb[_0xb782('0x34')]);if(_0x45bfeb[_0xb782('0x35')]){delete _0x45bfeb[_0xb782('0x35')];}_0x54a57f[_0xb782('0x26')](_0x1b5926)['send'](_0x45bfeb);};}exports[_0xb782('0x36')]=function(_0xc1fc3,_0x5925fe){var _0x5c272f={},_0x5de8c6={},_0x5f3946={'count':0x0,'rows':[]};var _0x31c207=_['map'](db[_0xb782('0x37')][_0xb782('0x38')],function(_0x2af98a){return{'name':_0x2af98a['fieldName'],'type':_0x2af98a[_0xb782('0x39')][_0xb782('0x3a')]};});_0x5de8c6[_0xb782('0x3b')]=_[_0xb782('0x3c')](_0x31c207,'name');_0x5de8c6[_0xb782('0x3d')]=_[_0xb782('0x3e')](_0xc1fc3[_0xb782('0x3d')]);_0x5de8c6[_0xb782('0x3f')]=_['intersection'](_0x5de8c6[_0xb782('0x3b')],_0x5de8c6[_0xb782('0x3d')]);_0x5c272f[_0xb782('0x40')]=_[_0xb782('0x41')](_0x5de8c6[_0xb782('0x3b')],qs[_0xb782('0x42')](_0xc1fc3[_0xb782('0x3d')][_0xb782('0x42')]));_0x5c272f['attributes']=_0x5c272f[_0xb782('0x40')]['length']?_0x5c272f[_0xb782('0x40')]:_0x5de8c6[_0xb782('0x3b')];if(!_0xc1fc3[_0xb782('0x3d')][_0xb782('0x43')](_0xb782('0x44'))){_0x5c272f['limit']=qs[_0xb782('0x29')](_0xc1fc3[_0xb782('0x3d')][_0xb782('0x29')]);_0x5c272f[_0xb782('0x28')]=qs['offset'](_0xc1fc3[_0xb782('0x3d')]['offset']);}_0x5c272f['order']=qs[_0xb782('0x45')](_0xc1fc3[_0xb782('0x3d')][_0xb782('0x45')]);_0x5c272f['where']=qs[_0xb782('0x3f')](_['pick'](_0xc1fc3[_0xb782('0x3d')],_0x5de8c6['filters']),_0x31c207);if(_0xc1fc3[_0xb782('0x3d')]['filter']){_0x5c272f[_0xb782('0x46')]=_[_0xb782('0x47')](_0x5c272f[_0xb782('0x46')],{'$or':_[_0xb782('0x3c')](_0x31c207,function(_0x17de5f){if(_0x17de5f[_0xb782('0x39')]!==_0xb782('0x48')){var _0xa22a8a={};_0xa22a8a[_0x17de5f[_0xb782('0x35')]]={'$like':'%'+_0xc1fc3['query'][_0xb782('0x49')]+'%'};return _0xa22a8a;}})});}_0x5c272f=_['merge']({},_0x5c272f,_0xc1fc3[_0xb782('0x4a')]);var _0x3f103a={'where':_0x5c272f['where']};return db[_0xb782('0x37')][_0xb782('0x2b')](_0x3f103a)[_0xb782('0x32')](function(_0x5b796d){_0x5f3946[_0xb782('0x2b')]=_0x5b796d;if(_0xc1fc3[_0xb782('0x3d')][_0xb782('0x4b')]){_0x5c272f[_0xb782('0x4c')]=[{'all':!![]}];}return db[_0xb782('0x37')]['findAll'](_0x5c272f);})[_0xb782('0x32')](function(_0x1a8ce7){_0x5f3946[_0xb782('0x4d')]=_0x1a8ce7;return _0x5f3946;})['then'](respondWithFilteredResult(_0x5925fe,_0x5c272f))[_0xb782('0x25')](handleError(_0x5925fe,null));};exports[_0xb782('0x4e')]=function(_0x261f5d,_0x48b153){var _0x3b28dc={'raw':![],'where':{'id':_0x261f5d['params']['id']}},_0x4ed591={};_0x4ed591[_0xb782('0x3b')]=_[_0xb782('0x3e')](db[_0xb782('0x37')][_0xb782('0x38')]);_0x4ed591[_0xb782('0x3d')]=_[_0xb782('0x3e')](_0x261f5d['query']);_0x4ed591[_0xb782('0x3f')]=_[_0xb782('0x41')](_0x4ed591[_0xb782('0x3b')],_0x4ed591[_0xb782('0x3d')]);_0x3b28dc[_0xb782('0x40')]=_[_0xb782('0x41')](_0x4ed591[_0xb782('0x3b')],qs[_0xb782('0x42')](_0x261f5d[_0xb782('0x3d')]['fields']));_0x3b28dc[_0xb782('0x40')]=_0x3b28dc[_0xb782('0x40')][_0xb782('0x4f')]?_0x3b28dc['attributes']:_0x4ed591['model'];if(_0x261f5d['query'][_0xb782('0x4b')]){_0x3b28dc[_0xb782('0x4c')]=[{'all':!![]}];}_0x3b28dc=_[_0xb782('0x47')]({},_0x3b28dc,_0x261f5d['options']);return db[_0xb782('0x37')][_0xb782('0x50')](_0x3b28dc)[_0xb782('0x32')](handleEntityNotFound(_0x48b153,null))[_0xb782('0x32')](respondWithResult(_0x48b153,null))['catch'](handleError(_0x48b153,null));};exports[_0xb782('0x30')]=function(_0xabf218,_0xb75f32){if(_0xabf218[_0xb782('0x51')]['id']){delete _0xabf218[_0xb782('0x51')]['id'];}return db[_0xb782('0x37')]['find']({'where':{'id':_0xabf218['params']['id']}})[_0xb782('0x32')](handleEntityNotFound(_0xb75f32,null))[_0xb782('0x32')](saveUpdates(_0xabf218[_0xb782('0x51')],null))[_0xb782('0x32')](respondWithResult(_0xb75f32,null))['catch'](handleError(_0xb75f32,null));};exports['addLogo']=function(_0xd06286,_0x12fa9e,_0x2c0ac5){if(_0xd06286[_0xb782('0x52')]&&_0xd06286[_0xb782('0x52')][_0xb782('0x53')]){_0xd06286['body']['logo']=_0xd06286['file'][_0xb782('0x53')];}return db[_0xb782('0x37')]['find']({'where':{'id':_0xd06286[_0xb782('0x54')]['id']}})[_0xb782('0x32')](handleEntityNotFound(_0x12fa9e,null))[_0xb782('0x32')](saveUpdates(_0xd06286[_0xb782('0x51')],null))[_0xb782('0x32')](respondWithResult(_0x12fa9e,null))['catch'](handleError(_0x12fa9e,null));};exports['addLogoLogin']=function(_0xaed303,_0x587a85,_0x3ca733){if(_0xaed303[_0xb782('0x52')]&&_0xaed303[_0xb782('0x52')][_0xb782('0x53')]){_0xaed303['body']['loginLogo']=_0xaed303[_0xb782('0x52')]['filename'];}return db['Setting'][_0xb782('0x50')]({'where':{'id':_0xaed303[_0xb782('0x54')]['id']}})[_0xb782('0x32')](handleEntityNotFound(_0x587a85,null))[_0xb782('0x32')](saveUpdates(_0xaed303['body'],null))[_0xb782('0x32')](respondWithResult(_0x587a85,null))[_0xb782('0x25')](handleError(_0x587a85,null));};var utilLicense=require('../../config/license/util');exports['getLogo']=function(_0x2ccc36,_0xb55b08,_0x2c8cab){var _0x18f795='server/files/images/logos';var _0x1a8dd4={'custom':![]};return utilLicense[_0xb782('0x55')]()[_0xb782('0x32')](function(_0x3122f2){if(_0x3122f2){_0x1a8dd4=_0x3122f2;}return db[_0xb782('0x37')]['find']({'where':{'id':_0x2ccc36[_0xb782('0x54')]['id']},'attributes':['logo',_0xb782('0x56'),_0xb782('0x57'),'favicon','defaultLogo',_0xb782('0x58'),_0xb782('0x59'),_0xb782('0x5a')],'raw':!![]});})['then'](handleEntityNotFound(_0xb55b08,null))[_0xb782('0x32')](function(_0x40db1a){if(_0x40db1a){var _0x36c877=_0x40db1a[_0xb782('0x5b')]&&fs[_0xb782('0x5c')](path[_0xb782('0x5d')](config[_0xb782('0x5e')],_0x18f795,_['toLower'](_0x40db1a[_0xb782('0x5b')])))?path[_0xb782('0x5d')](config[_0xb782('0x5e')],_0x18f795,_[_0xb782('0x5f')](_0x40db1a[_0xb782('0x5b')])):path[_0xb782('0x5d')](config[_0xb782('0x5e')],_0x18f795,_['toLower']('default_logo.svg'));var _0x4958fb=_0xb782('0x60')+_[_0xb782('0x61')](_0xb782('0x5b'));if(_0x40db1a[_0x4958fb]||!_0x1a8dd4[_0xb782('0x62')]){_0x36c877=path[_0xb782('0x5d')](config[_0xb782('0x5e')],_0x18f795,_[_0xb782('0x5f')](_0xb782('0x63')));}if(!fs[_0xb782('0x5c')](_0x36c877)){throw new db[(_0xb782('0x64'))][(_0xb782('0x65'))](_[_0xb782('0x61')](_0xb782('0x5b'))+_0xb782('0x66'));}return _0xb55b08[_0xb782('0x67')](_0x36c877);}})[_0xb782('0x25')](handleError(_0xb55b08,null));};var utilLicense=require(_0xb782('0x17'));exports[_0xb782('0x68')]=function(_0xf380b5,_0xd75583,_0x504757){var _0x2f3c6f=_0xb782('0x69');var _0x272277={'custom':![]};return utilLicense[_0xb782('0x55')]()[_0xb782('0x32')](function(_0x15f67b){if(_0x15f67b){_0x272277=_0x15f67b;}return db[_0xb782('0x37')][_0xb782('0x50')]({'where':{'id':_0xf380b5['params']['id']},'attributes':[_0xb782('0x5b'),_0xb782('0x56'),_0xb782('0x57'),_0xb782('0x6a'),_0xb782('0x6b'),_0xb782('0x58'),'defaultPreferred',_0xb782('0x5a')],'raw':!![]});})[_0xb782('0x32')](handleEntityNotFound(_0xd75583,null))[_0xb782('0x32')](function(_0x1f41f5){if(_0x1f41f5){var _0x31d7e3=_0x1f41f5[_0xb782('0x56')]&&fs[_0xb782('0x5c')](path[_0xb782('0x5d')](config[_0xb782('0x5e')],_0x2f3c6f,_[_0xb782('0x5f')](_0x1f41f5['loginLogo'])))?path[_0xb782('0x5d')](config[_0xb782('0x5e')],_0x2f3c6f,_['toLower'](_0x1f41f5[_0xb782('0x56')])):path[_0xb782('0x5d')](config[_0xb782('0x5e')],_0x2f3c6f,_[_0xb782('0x5f')](_0xb782('0x6c')));var _0x2eb8b9=_0xb782('0x60')+_[_0xb782('0x61')](_0xb782('0x56'));if(_0x1f41f5[_0x2eb8b9]||!_0x272277[_0xb782('0x62')]){_0x31d7e3=path[_0xb782('0x5d')](config['root'],_0x2f3c6f,_['toLower']('default_loginLogo.svg'));}if(!fs['existsSync'](_0x31d7e3)){throw new db[(_0xb782('0x64'))][(_0xb782('0x65'))](_['upperFirst']('loginLogo')+_0xb782('0x66'));}return _0xd75583[_0xb782('0x67')](_0x31d7e3);}})[_0xb782('0x25')](handleError(_0xd75583,null));};exports[_0xb782('0x6d')]=function(_0x39b394,_0x2d7611){return db[_0xb782('0x37')]['find']({'where':{'id':_0x39b394[_0xb782('0x54')]['id']},'attributes':[_0xb782('0x6e')]})['then'](respondWithResult(_0x2d7611,null))['catch'](handleError(_0x2d7611,null));};exports[_0xb782('0x6f')]=function(_0x5f461b,_0x241e38,_0x37f97d){if(_0x5f461b['file']&&_0x5f461b[_0xb782('0x52')][_0xb782('0x53')]){_0x5f461b[_0xb782('0x51')][_0xb782('0x57')]=_0x5f461b['file']['filename'];}return db[_0xb782('0x37')]['find']({'where':{'id':_0x5f461b['params']['id']}})[_0xb782('0x32')](handleEntityNotFound(_0x241e38,null))['then'](saveUpdates(_0x5f461b[_0xb782('0x51')],null))[_0xb782('0x32')](respondWithResult(_0x241e38,null))[_0xb782('0x25')](handleError(_0x241e38,null));};var utilLicense=require(_0xb782('0x17'));exports[_0xb782('0x70')]=function(_0x42c7c6,_0x3179f0,_0x110918){var _0xb42529=_0xb782('0x69');var _0x531a87={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x53b3dc){if(_0x53b3dc){_0x531a87=_0x53b3dc;}return db['Setting']['find']({'where':{'id':_0x42c7c6[_0xb782('0x54')]['id']},'attributes':[_0xb782('0x5b'),_0xb782('0x56'),_0xb782('0x57'),_0xb782('0x6a'),_0xb782('0x6b'),_0xb782('0x58'),_0xb782('0x59'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x3179f0,null))['then'](function(_0x5b2326){if(_0x5b2326){var _0x226690=_0x5b2326[_0xb782('0x57')]&&fs[_0xb782('0x5c')](path[_0xb782('0x5d')](config[_0xb782('0x5e')],_0xb42529,_[_0xb782('0x5f')](_0x5b2326[_0xb782('0x57')])))?path[_0xb782('0x5d')](config[_0xb782('0x5e')],_0xb42529,_['toLower'](_0x5b2326[_0xb782('0x57')])):path[_0xb782('0x5d')](config[_0xb782('0x5e')],_0xb42529,_['toLower'](_0xb782('0x71')));var _0xb9f2=_0xb782('0x60')+_[_0xb782('0x61')](_0xb782('0x57'));if(_0x5b2326[_0xb9f2]||!_0x531a87[_0xb782('0x62')]||!_0x531a87[_0xb782('0x57')]){_0x226690=path[_0xb782('0x5d')](config['root'],_0xb42529,_['toLower']('default_preferred.png'));}if(!fs[_0xb782('0x5c')](_0x226690)){throw new db[(_0xb782('0x64'))]['ValidationError'](_['upperFirst'](_0xb782('0x57'))+_0xb782('0x66'));}return _0x3179f0['download'](_0x226690);}})[_0xb782('0x25')](handleError(_0x3179f0,null));};exports['addFavicon']=function(_0x4ba9b9,_0x17f281,_0x25a1d9){if(_0x4ba9b9['file']&&_0x4ba9b9[_0xb782('0x52')]['filename']){_0x4ba9b9['body'][_0xb782('0x6a')]=_0x4ba9b9[_0xb782('0x52')][_0xb782('0x53')];}return db['Setting'][_0xb782('0x50')]({'where':{'id':_0x4ba9b9[_0xb782('0x54')]['id']}})[_0xb782('0x32')](handleEntityNotFound(_0x17f281,null))[_0xb782('0x32')](saveUpdates(_0x4ba9b9[_0xb782('0x51')],null))[_0xb782('0x32')](respondWithResult(_0x17f281,null))[_0xb782('0x25')](handleError(_0x17f281,null));};var utilLicense=require('../../config/license/util');exports[_0xb782('0x72')]=function(_0x334b24,_0x4ee2e9,_0x599e98){var _0x216a21=_0xb782('0x69');var _0x4e3187={'custom':![]};return utilLicense[_0xb782('0x55')]()[_0xb782('0x32')](function(_0x141cb7){if(_0x141cb7){_0x4e3187=_0x141cb7;}return db[_0xb782('0x37')][_0xb782('0x50')]({'where':{'id':_0x334b24['params']['id']},'attributes':[_0xb782('0x5b'),_0xb782('0x56'),_0xb782('0x57'),_0xb782('0x6a'),_0xb782('0x6b'),_0xb782('0x58'),_0xb782('0x59'),_0xb782('0x5a')],'raw':!![]});})[_0xb782('0x32')](handleEntityNotFound(_0x4ee2e9,null))[_0xb782('0x32')](function(_0xc21766){if(_0xc21766){var _0x532857=_0xc21766['favicon']&&fs['existsSync'](path[_0xb782('0x5d')](config[_0xb782('0x5e')],_0x216a21,_[_0xb782('0x5f')](_0xc21766[_0xb782('0x6a')])))?path[_0xb782('0x5d')](config['root'],_0x216a21,_[_0xb782('0x5f')](_0xc21766[_0xb782('0x6a')])):path[_0xb782('0x5d')](config[_0xb782('0x5e')],_0x216a21,_[_0xb782('0x5f')](_0xb782('0x73')));var _0x549280='default'+_[_0xb782('0x61')](_0xb782('0x6a'));if(_0xc21766[_0x549280]||!_0x4e3187['custom']){_0x532857=path[_0xb782('0x5d')](config[_0xb782('0x5e')],_0x216a21,_[_0xb782('0x5f')](_0xb782('0x73')));}if(!fs[_0xb782('0x5c')](_0x532857)){throw new db[(_0xb782('0x64'))][(_0xb782('0x65'))](_[_0xb782('0x61')](_0xb782('0x6a'))+_0xb782('0x66'));}return _0x4ee2e9[_0xb782('0x67')](_0x532857);}})['catch'](handleError(_0x4ee2e9,null));};exports[_0xb782('0x74')]=function(_0x28642b,_0x430022){var _0x337aa0={'offset':moment()[_0xb782('0x75')]()};_0x337aa0[_0xb782('0x76')]=moment()[_0xb782('0x75')](_0x337aa0['offset'])[_0xb782('0x77')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x430022[_0xb782('0x26')](0xc8)[_0xb782('0x78')](_0x337aa0);}; \ No newline at end of file +var _0x30ff=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','offset','undefined','count','limit','set','Content-Range','save','end','sendStatus','stack','name','index','map','Setting','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','rawAttributes','find','update','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','../../config/license/util','getLogo','server/files/images/logos','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','join','root','toLower','default','upperFirst','custom','default_logo.svg','existsSync','Sequelize','ValidationError','\x20not\x20found','getLogoLogin','getLicense','defaultFavicon','default_loginLogo.svg','download','gdpr','getPreferred','favicon','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','send','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis'];(function(_0xfeb5d4,_0x211945){var _0x167b53=function(_0x10f15d){while(--_0x10f15d){_0xfeb5d4['push'](_0xfeb5d4['shift']());}};_0x167b53(++_0x211945);}(_0x30ff,0x6a));var _0xf30f=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x30ff[_0x432682];return _0x463d05;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf30f('0x0'));var zipdir=require(_0xf30f('0x1'));var jsonpatch=require(_0xf30f('0x2'));var rp=require(_0xf30f('0x3'));var moment=require(_0xf30f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf30f('0x5'));var util=require(_0xf30f('0x6'));var path=require('path');var sox=require(_0xf30f('0x7'));var csv=require(_0xf30f('0x8'));var ejs=require(_0xf30f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf30f('0xa'));var squel=require(_0xf30f('0xb'));var crypto=require(_0xf30f('0xc'));var jsforce=require(_0xf30f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf30f('0x8'));var querystring=require(_0xf30f('0xe'));var Papa=require(_0xf30f('0xf'));var Redis=require(_0xf30f('0x10'));var authService=require(_0xf30f('0x11'));var qs=require(_0xf30f('0x12'));var as=require(_0xf30f('0x13'));var hardwareService=require(_0xf30f('0x14'));var logger=require(_0xf30f('0x15'))(_0xf30f('0x16'));var utils=require(_0xf30f('0x17'));var config=require(_0xf30f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf30f('0x19'))['db'];var jayson=require(_0xf30f('0x1a'));var client=jayson[_0xf30f('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb6e956,_0xb0d05c,_0x19ba46,_0x511955){return new BPromise(function(_0x71e1fb,_0x44e339){var _0x15abb2=_0x511955||client;return _0x15abb2[_0xf30f('0x1c')](_0xb6e956,_0x19ba46)[_0xf30f('0x1d')](function(_0x776a21){logger[_0xf30f('0x1e')](_0xf30f('0x1f'),_0xb0d05c,_0xf30f('0x20'));logger['debug'](_0xf30f('0x21'),_0xb0d05c,_0xf30f('0x20'),JSON[_0xf30f('0x22')](_0x776a21));if(_0x776a21[_0xf30f('0x23')]){if(_0x776a21[_0xf30f('0x23')][_0xf30f('0x24')]===0x1f4){logger['error'](_0xf30f('0x1f'),_0xb0d05c,_0x776a21[_0xf30f('0x23')][_0xf30f('0x25')]);return _0x44e339(_0x776a21[_0xf30f('0x23')]['message']);}logger[_0xf30f('0x23')](_0xf30f('0x1f'),_0xb0d05c,_0x776a21[_0xf30f('0x23')]['message']);return _0x71e1fb(_0x776a21['error'][_0xf30f('0x25')]);}else{logger[_0xf30f('0x1e')](_0xf30f('0x1f'),_0xb0d05c,'request\x20sent');_0x71e1fb(_0x776a21[_0xf30f('0x26')][_0xf30f('0x25')]);}})[_0xf30f('0x27')](function(_0x97d9ba){logger[_0xf30f('0x23')]('Setting,\x20%s,\x20%s',_0xb0d05c,_0x97d9ba);_0x44e339(_0x97d9ba);});});}function respondWithStatusCode(_0x91bd22,_0x3f445e){_0x3f445e=_0x3f445e||0xcc;return function(_0x1419c8){if(_0x1419c8){return _0x91bd22['sendStatus'](_0x3f445e);}return _0x91bd22[_0xf30f('0x28')](_0x3f445e)['end']();};}function respondWithResult(_0x2412df,_0x317a36){_0x317a36=_0x317a36||0xc8;return function(_0x55bb5e){if(_0x55bb5e){return _0x2412df[_0xf30f('0x28')](_0x317a36)[_0xf30f('0x29')](_0x55bb5e);}};}function respondWithFilteredResult(_0x1e6835,_0x5ec460){return function(_0x758f63){if(_0x758f63){var _0x54bbb4=typeof _0x5ec460[_0xf30f('0x2a')]==='undefined'&&typeof _0x5ec460['limit']===_0xf30f('0x2b');var _0x3eb30e=_0x758f63[_0xf30f('0x2c')];var _0x6ef41d=_0x54bbb4?0x0:_0x5ec460[_0xf30f('0x2a')];var _0x62a109=_0x54bbb4?_0x758f63['count']:_0x5ec460[_0xf30f('0x2a')]+_0x5ec460[_0xf30f('0x2d')];var _0x4adcb9;if(_0x62a109>=_0x3eb30e){_0x62a109=_0x3eb30e;_0x4adcb9=0xc8;}else{_0x4adcb9=0xce;}_0x1e6835[_0xf30f('0x28')](_0x4adcb9);return _0x1e6835[_0xf30f('0x2e')](_0xf30f('0x2f'),_0x6ef41d+'-'+_0x62a109+'/'+_0x3eb30e)[_0xf30f('0x29')](_0x758f63);}return null;};}function patchUpdates(_0x1d70a8){return function(_0x328b1b){try{jsonpatch['apply'](_0x328b1b,_0x1d70a8,!![]);}catch(_0x30be36){return BPromise['reject'](_0x30be36);}return _0x328b1b[_0xf30f('0x30')]();};}function saveUpdates(_0x578947,_0x1e1489){return function(_0x58b605){if(_0x58b605){return _0x58b605['update'](_0x578947)[_0xf30f('0x1d')](function(_0x35ca84){return _0x35ca84;});}return null;};}function removeEntity(_0x346fef,_0x360c15){return function(_0x2ea306){if(_0x2ea306){return _0x2ea306['destroy']()[_0xf30f('0x1d')](function(){_0x346fef['status'](0xcc)[_0xf30f('0x31')]();});}};}function handleEntityNotFound(_0x2d7a2f,_0x424b75){return function(_0x1a8db1){if(!_0x1a8db1){_0x2d7a2f[_0xf30f('0x32')](0x194);}return _0x1a8db1;};}function handleError(_0x2d63d4,_0x1238b5){_0x1238b5=_0x1238b5||0x1f4;return function(_0x3580aa){logger[_0xf30f('0x23')](_0x3580aa[_0xf30f('0x33')]);if(_0x3580aa[_0xf30f('0x34')]){delete _0x3580aa[_0xf30f('0x34')];}_0x2d63d4[_0xf30f('0x28')](_0x1238b5)['send'](_0x3580aa);};}exports[_0xf30f('0x35')]=function(_0x315c45,_0x261e58){var _0x426ace={},_0x4c6b71={},_0xf62da2={'count':0x0,'rows':[]};var _0x398cc5=_[_0xf30f('0x36')](db[_0xf30f('0x37')]['rawAttributes'],function(_0x33e765){return{'name':_0x33e765[_0xf30f('0x38')],'type':_0x33e765[_0xf30f('0x39')][_0xf30f('0x3a')]};});_0x4c6b71['model']=_[_0xf30f('0x36')](_0x398cc5,_0xf30f('0x34'));_0x4c6b71[_0xf30f('0x3b')]=_[_0xf30f('0x3c')](_0x315c45[_0xf30f('0x3b')]);_0x4c6b71['filters']=_[_0xf30f('0x3d')](_0x4c6b71[_0xf30f('0x3e')],_0x4c6b71[_0xf30f('0x3b')]);_0x426ace[_0xf30f('0x3f')]=_[_0xf30f('0x3d')](_0x4c6b71[_0xf30f('0x3e')],qs[_0xf30f('0x40')](_0x315c45[_0xf30f('0x3b')]['fields']));_0x426ace[_0xf30f('0x3f')]=_0x426ace[_0xf30f('0x3f')][_0xf30f('0x41')]?_0x426ace[_0xf30f('0x3f')]:_0x4c6b71[_0xf30f('0x3e')];if(!_0x315c45[_0xf30f('0x3b')]['hasOwnProperty'](_0xf30f('0x42'))){_0x426ace['limit']=qs[_0xf30f('0x2d')](_0x315c45[_0xf30f('0x3b')][_0xf30f('0x2d')]);_0x426ace[_0xf30f('0x2a')]=qs[_0xf30f('0x2a')](_0x315c45['query'][_0xf30f('0x2a')]);}_0x426ace['order']=qs['sort'](_0x315c45['query'][_0xf30f('0x43')]);_0x426ace[_0xf30f('0x44')]=qs['filters'](_[_0xf30f('0x45')](_0x315c45[_0xf30f('0x3b')],_0x4c6b71['filters']),_0x398cc5);if(_0x315c45[_0xf30f('0x3b')][_0xf30f('0x46')]){_0x426ace['where']=_[_0xf30f('0x47')](_0x426ace['where'],{'$or':_['map'](_0x398cc5,function(_0x249dab){if(_0x249dab['type']!==_0xf30f('0x48')){var _0x4d70b8={};_0x4d70b8[_0x249dab[_0xf30f('0x34')]]={'$like':'%'+_0x315c45[_0xf30f('0x3b')]['filter']+'%'};return _0x4d70b8;}})});}_0x426ace=_[_0xf30f('0x47')]({},_0x426ace,_0x315c45[_0xf30f('0x49')]);var _0x26c76b={'where':_0x426ace[_0xf30f('0x44')]};return db[_0xf30f('0x37')][_0xf30f('0x2c')](_0x26c76b)[_0xf30f('0x1d')](function(_0x4c7e12){_0xf62da2[_0xf30f('0x2c')]=_0x4c7e12;if(_0x315c45[_0xf30f('0x3b')]['includeAll']){_0x426ace[_0xf30f('0x4a')]=[{'all':!![]}];}return db[_0xf30f('0x37')][_0xf30f('0x4b')](_0x426ace);})[_0xf30f('0x1d')](function(_0x142172){_0xf62da2[_0xf30f('0x4c')]=_0x142172;return _0xf62da2;})['then'](respondWithFilteredResult(_0x261e58,_0x426ace))[_0xf30f('0x27')](handleError(_0x261e58,null));};exports['show']=function(_0x1bfffd,_0x5a2d88){var _0x5e7306={'raw':![],'where':{'id':_0x1bfffd[_0xf30f('0x4d')]['id']}},_0x5d4da5={};_0x5d4da5[_0xf30f('0x3e')]=_['keys'](db['Setting'][_0xf30f('0x4e')]);_0x5d4da5[_0xf30f('0x3b')]=_[_0xf30f('0x3c')](_0x1bfffd[_0xf30f('0x3b')]);_0x5d4da5['filters']=_['intersection'](_0x5d4da5[_0xf30f('0x3e')],_0x5d4da5['query']);_0x5e7306[_0xf30f('0x3f')]=_[_0xf30f('0x3d')](_0x5d4da5[_0xf30f('0x3e')],qs[_0xf30f('0x40')](_0x1bfffd[_0xf30f('0x3b')]['fields']));_0x5e7306['attributes']=_0x5e7306[_0xf30f('0x3f')]['length']?_0x5e7306['attributes']:_0x5d4da5[_0xf30f('0x3e')];if(_0x1bfffd[_0xf30f('0x3b')]['includeAll']){_0x5e7306[_0xf30f('0x4a')]=[{'all':!![]}];}_0x5e7306=_[_0xf30f('0x47')]({},_0x5e7306,_0x1bfffd[_0xf30f('0x49')]);return db['Setting'][_0xf30f('0x4f')](_0x5e7306)[_0xf30f('0x1d')](handleEntityNotFound(_0x5a2d88,null))[_0xf30f('0x1d')](respondWithResult(_0x5a2d88,null))[_0xf30f('0x27')](handleError(_0x5a2d88,null));};exports[_0xf30f('0x50')]=function(_0x65899e,_0x3113db){if(_0x65899e[_0xf30f('0x51')]['id']){delete _0x65899e[_0xf30f('0x51')]['id'];}return db[_0xf30f('0x37')][_0xf30f('0x4f')]({'where':{'id':_0x65899e[_0xf30f('0x4d')]['id']}})[_0xf30f('0x1d')](handleEntityNotFound(_0x3113db,null))[_0xf30f('0x1d')](saveUpdates(_0x65899e[_0xf30f('0x51')],null))[_0xf30f('0x1d')](respondWithResult(_0x3113db,null))[_0xf30f('0x27')](handleError(_0x3113db,null));};exports[_0xf30f('0x52')]=function(_0x374d84,_0x20fc4e,_0x198dd3){if(_0x374d84['file']&&_0x374d84[_0xf30f('0x53')][_0xf30f('0x54')]){_0x374d84[_0xf30f('0x51')][_0xf30f('0x55')]=_0x374d84[_0xf30f('0x53')][_0xf30f('0x54')];}return db[_0xf30f('0x37')]['find']({'where':{'id':_0x374d84['params']['id']}})[_0xf30f('0x1d')](handleEntityNotFound(_0x20fc4e,null))[_0xf30f('0x1d')](saveUpdates(_0x374d84[_0xf30f('0x51')],null))['then'](respondWithResult(_0x20fc4e,null))[_0xf30f('0x27')](handleError(_0x20fc4e,null));};exports[_0xf30f('0x56')]=function(_0xa9390e,_0x9acc21,_0x5e803f){if(_0xa9390e[_0xf30f('0x53')]&&_0xa9390e[_0xf30f('0x53')][_0xf30f('0x54')]){_0xa9390e[_0xf30f('0x51')][_0xf30f('0x57')]=_0xa9390e[_0xf30f('0x53')]['filename'];}return db['Setting'][_0xf30f('0x4f')]({'where':{'id':_0xa9390e[_0xf30f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x9acc21,null))['then'](saveUpdates(_0xa9390e[_0xf30f('0x51')],null))[_0xf30f('0x1d')](respondWithResult(_0x9acc21,null))['catch'](handleError(_0x9acc21,null));};var utilLicense=require(_0xf30f('0x58'));exports[_0xf30f('0x59')]=function(_0x2cd786,_0x371ed0,_0x1c5c4e){var _0x39e67c=_0xf30f('0x5a');var _0xa56436={'custom':![]};return utilLicense['getLicense']()[_0xf30f('0x1d')](function(_0x399cc5){if(_0x399cc5){_0xa56436=_0x399cc5;}return db[_0xf30f('0x37')][_0xf30f('0x4f')]({'where':{'id':_0x2cd786[_0xf30f('0x4d')]['id']},'attributes':[_0xf30f('0x55'),'loginLogo',_0xf30f('0x5b'),'favicon',_0xf30f('0x5c'),_0xf30f('0x5d'),_0xf30f('0x5e'),'defaultFavicon'],'raw':!![]});})[_0xf30f('0x1d')](handleEntityNotFound(_0x371ed0,null))[_0xf30f('0x1d')](function(_0x28a638){if(_0x28a638){var _0x293d1a=_0x28a638[_0xf30f('0x55')]&&fs['existsSync'](path[_0xf30f('0x5f')](config[_0xf30f('0x60')],_0x39e67c,_[_0xf30f('0x61')](_0x28a638['logo'])))?path[_0xf30f('0x5f')](config[_0xf30f('0x60')],_0x39e67c,_[_0xf30f('0x61')](_0x28a638[_0xf30f('0x55')])):path[_0xf30f('0x5f')](config[_0xf30f('0x60')],_0x39e67c,_['toLower']('default_logo.svg'));var _0x3c90ca=_0xf30f('0x62')+_[_0xf30f('0x63')](_0xf30f('0x55'));if(_0x28a638[_0x3c90ca]||!_0xa56436[_0xf30f('0x64')]){_0x293d1a=path['join'](config[_0xf30f('0x60')],_0x39e67c,_[_0xf30f('0x61')](_0xf30f('0x65')));}if(!fs[_0xf30f('0x66')](_0x293d1a)){throw new db[(_0xf30f('0x67'))][(_0xf30f('0x68'))](_[_0xf30f('0x63')](_0xf30f('0x55'))+_0xf30f('0x69'));}return _0x371ed0['download'](_0x293d1a);}})['catch'](handleError(_0x371ed0,null));};var utilLicense=require('../../config/license/util');exports[_0xf30f('0x6a')]=function(_0x211fb7,_0x5a99e6,_0x3943e4){var _0x40cb70=_0xf30f('0x5a');var _0x284e63={'custom':![]};return utilLicense[_0xf30f('0x6b')]()[_0xf30f('0x1d')](function(_0x191b36){if(_0x191b36){_0x284e63=_0x191b36;}return db[_0xf30f('0x37')]['find']({'where':{'id':_0x211fb7[_0xf30f('0x4d')]['id']},'attributes':[_0xf30f('0x55'),_0xf30f('0x57'),'preferred','favicon',_0xf30f('0x5c'),'defaultLoginLogo',_0xf30f('0x5e'),_0xf30f('0x6c')],'raw':!![]});})[_0xf30f('0x1d')](handleEntityNotFound(_0x5a99e6,null))['then'](function(_0x24ab61){if(_0x24ab61){var _0x38648d=_0x24ab61[_0xf30f('0x57')]&&fs[_0xf30f('0x66')](path[_0xf30f('0x5f')](config['root'],_0x40cb70,_['toLower'](_0x24ab61[_0xf30f('0x57')])))?path[_0xf30f('0x5f')](config[_0xf30f('0x60')],_0x40cb70,_[_0xf30f('0x61')](_0x24ab61[_0xf30f('0x57')])):path['join'](config[_0xf30f('0x60')],_0x40cb70,_[_0xf30f('0x61')](_0xf30f('0x6d')));var _0x576ea7=_0xf30f('0x62')+_[_0xf30f('0x63')](_0xf30f('0x57'));if(_0x24ab61[_0x576ea7]||!_0x284e63[_0xf30f('0x64')]){_0x38648d=path[_0xf30f('0x5f')](config[_0xf30f('0x60')],_0x40cb70,_[_0xf30f('0x61')](_0xf30f('0x6d')));}if(!fs['existsSync'](_0x38648d)){throw new db[(_0xf30f('0x67'))][(_0xf30f('0x68'))](_[_0xf30f('0x63')]('loginLogo')+_0xf30f('0x69'));}return _0x5a99e6[_0xf30f('0x6e')](_0x38648d);}})[_0xf30f('0x27')](handleError(_0x5a99e6,null));};exports[_0xf30f('0x6f')]=function(_0x54ca0d,_0x2dba45){return db[_0xf30f('0x37')][_0xf30f('0x4f')]({'where':{'id':_0x54ca0d['params']['id']},'attributes':['securePassword']})[_0xf30f('0x1d')](respondWithResult(_0x2dba45,null))[_0xf30f('0x27')](handleError(_0x2dba45,null));};exports['addPreferred']=function(_0x3cf658,_0x1603ee,_0x243620){if(_0x3cf658['file']&&_0x3cf658[_0xf30f('0x53')][_0xf30f('0x54')]){_0x3cf658[_0xf30f('0x51')][_0xf30f('0x5b')]=_0x3cf658[_0xf30f('0x53')][_0xf30f('0x54')];}return db[_0xf30f('0x37')]['find']({'where':{'id':_0x3cf658[_0xf30f('0x4d')]['id']}})[_0xf30f('0x1d')](handleEntityNotFound(_0x1603ee,null))[_0xf30f('0x1d')](saveUpdates(_0x3cf658['body'],null))[_0xf30f('0x1d')](respondWithResult(_0x1603ee,null))['catch'](handleError(_0x1603ee,null));};var utilLicense=require(_0xf30f('0x58'));exports[_0xf30f('0x70')]=function(_0x3c2a9d,_0x1bc549,_0x2fb05){var _0x3fa16e=_0xf30f('0x5a');var _0xe3801f={'custom':![]};return utilLicense['getLicense']()[_0xf30f('0x1d')](function(_0x27b45f){if(_0x27b45f){_0xe3801f=_0x27b45f;}return db[_0xf30f('0x37')][_0xf30f('0x4f')]({'where':{'id':_0x3c2a9d[_0xf30f('0x4d')]['id']},'attributes':['logo',_0xf30f('0x57'),'preferred',_0xf30f('0x71'),_0xf30f('0x5c'),'defaultLoginLogo','defaultPreferred',_0xf30f('0x6c')],'raw':!![]});})[_0xf30f('0x1d')](handleEntityNotFound(_0x1bc549,null))['then'](function(_0x2ae95c){if(_0x2ae95c){var _0x52e726=_0x2ae95c[_0xf30f('0x5b')]&&fs['existsSync'](path[_0xf30f('0x5f')](config['root'],_0x3fa16e,_['toLower'](_0x2ae95c[_0xf30f('0x5b')])))?path[_0xf30f('0x5f')](config['root'],_0x3fa16e,_[_0xf30f('0x61')](_0x2ae95c[_0xf30f('0x5b')])):path[_0xf30f('0x5f')](config['root'],_0x3fa16e,_['toLower'](_0xf30f('0x72')));var _0x14830d=_0xf30f('0x62')+_[_0xf30f('0x63')](_0xf30f('0x5b'));if(_0x2ae95c[_0x14830d]||!_0xe3801f[_0xf30f('0x64')]||!_0xe3801f[_0xf30f('0x5b')]){_0x52e726=path[_0xf30f('0x5f')](config[_0xf30f('0x60')],_0x3fa16e,_[_0xf30f('0x61')](_0xf30f('0x72')));}if(!fs[_0xf30f('0x66')](_0x52e726)){throw new db[(_0xf30f('0x67'))]['ValidationError'](_[_0xf30f('0x63')](_0xf30f('0x5b'))+_0xf30f('0x69'));}return _0x1bc549['download'](_0x52e726);}})[_0xf30f('0x27')](handleError(_0x1bc549,null));};exports[_0xf30f('0x73')]=function(_0x51f5dd,_0x4c75d3,_0x3303ac){if(_0x51f5dd[_0xf30f('0x53')]&&_0x51f5dd[_0xf30f('0x53')][_0xf30f('0x54')]){_0x51f5dd['body'][_0xf30f('0x71')]=_0x51f5dd[_0xf30f('0x53')][_0xf30f('0x54')];}return db[_0xf30f('0x37')][_0xf30f('0x4f')]({'where':{'id':_0x51f5dd['params']['id']}})[_0xf30f('0x1d')](handleEntityNotFound(_0x4c75d3,null))[_0xf30f('0x1d')](saveUpdates(_0x51f5dd[_0xf30f('0x51')],null))[_0xf30f('0x1d')](respondWithResult(_0x4c75d3,null))[_0xf30f('0x27')](handleError(_0x4c75d3,null));};var utilLicense=require(_0xf30f('0x58'));exports[_0xf30f('0x74')]=function(_0x1b9937,_0x2f32c0,_0x3d69e9){var _0x4dfb89=_0xf30f('0x5a');var _0x106d0b={'custom':![]};return utilLicense[_0xf30f('0x6b')]()['then'](function(_0x3c5a3f){if(_0x3c5a3f){_0x106d0b=_0x3c5a3f;}return db[_0xf30f('0x37')]['find']({'where':{'id':_0x1b9937[_0xf30f('0x4d')]['id']},'attributes':['logo',_0xf30f('0x57'),'preferred',_0xf30f('0x71'),'defaultLogo',_0xf30f('0x5d'),_0xf30f('0x5e'),_0xf30f('0x6c')],'raw':!![]});})[_0xf30f('0x1d')](handleEntityNotFound(_0x2f32c0,null))[_0xf30f('0x1d')](function(_0xa191c2){if(_0xa191c2){var _0x380a28=_0xa191c2['favicon']&&fs[_0xf30f('0x66')](path['join'](config[_0xf30f('0x60')],_0x4dfb89,_[_0xf30f('0x61')](_0xa191c2['favicon'])))?path['join'](config[_0xf30f('0x60')],_0x4dfb89,_['toLower'](_0xa191c2['favicon'])):path[_0xf30f('0x5f')](config[_0xf30f('0x60')],_0x4dfb89,_['toLower'](_0xf30f('0x75')));var _0x53a19a=_0xf30f('0x62')+_[_0xf30f('0x63')](_0xf30f('0x71'));if(_0xa191c2[_0x53a19a]||!_0x106d0b[_0xf30f('0x64')]){_0x380a28=path[_0xf30f('0x5f')](config['root'],_0x4dfb89,_[_0xf30f('0x61')](_0xf30f('0x75')));}if(!fs[_0xf30f('0x66')](_0x380a28)){throw new db[(_0xf30f('0x67'))][(_0xf30f('0x68'))](_['upperFirst']('favicon')+_0xf30f('0x69'));}return _0x2f32c0[_0xf30f('0x6e')](_0x380a28);}})[_0xf30f('0x27')](handleError(_0x2f32c0,null));};exports[_0xf30f('0x76')]=function(_0x5473a3,_0x1f0f33){var _0xb7135f={'offset':moment()[_0xf30f('0x77')]()};_0xb7135f[_0xf30f('0x78')]=moment()[_0xf30f('0x77')](_0xb7135f[_0xf30f('0x2a')])['format'](_0xf30f('0x79'));return _0x1f0f33['status'](0xc8)[_0xf30f('0x7a')](_0xb7135f);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index a55647a..54f6144 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 _0x34e8=['settings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','Setting'];(function(_0x338263,_0x32aed4){var _0x23652c=function(_0x56fea3){while(--_0x56fea3){_0x338263['push'](_0x338263['shift']());}};_0x23652c(++_0x32aed4);}(_0x34e8,0x12c));var _0x834e=function(_0x42b8cb,_0x597c17){_0x42b8cb=_0x42b8cb-0x0;var _0x405480=_0x34e8[_0x42b8cb];return _0x405480;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x492221,_0x9e2521){var _0x398bf9=function(_0x303c5b){while(--_0x303c5b){_0x492221['push'](_0x492221['shift']());}};_0x398bf9(++_0x9e2521);}(_0x55ca,0x126));var _0xa55c=function(_0x4b6792,_0x1098bb){_0x4b6792=_0x4b6792-0x0;var _0x406802=_0x55ca[_0x4b6792];return _0x406802;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index bafc4e7..a85b87c 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 _0xcc56=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','ShowSetting','Setting','find','options','raw','attributes','map','include','model','lodash','util','moment','bluebird'];(function(_0x4db46b,_0xadcb1a){var _0x565be8=function(_0x5d2e50){while(--_0x5d2e50){_0x4db46b['push'](_0x4db46b['shift']());}};_0x565be8(++_0xadcb1a);}(_0xcc56,0xa1));var _0x6cc5=function(_0x154f39,_0x2ae186){_0x154f39=_0x154f39-0x0;var _0x592a9d=_0xcc56[_0x154f39];return _0x592a9d;};'use strict';var _=require(_0x6cc5('0x0'));var util=require(_0x6cc5('0x1'));var moment=require(_0x6cc5('0x2'));var BPromise=require(_0x6cc5('0x3'));var rs=require(_0x6cc5('0x4'));var fs=require('fs');var Redis=require(_0x6cc5('0x5'));var db=require(_0x6cc5('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6cc5('0x7'));var config=require(_0x6cc5('0x8'));var jayson=require(_0x6cc5('0x9'));var client=jayson[_0x6cc5('0xa')][_0x6cc5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x471bf6,_0x315f4f,_0x100c06){return new BPromise(function(_0x4ffa5e,_0x90e2ea){return client[_0x6cc5('0xc')](_0x471bf6,_0x100c06)[_0x6cc5('0xd')](function(_0x56047d){logger['info'](_0x6cc5('0xe'),_0x315f4f,'request\x20sent');logger[_0x6cc5('0xf')](_0x6cc5('0x10'),_0x315f4f,_0x6cc5('0x11'),JSON[_0x6cc5('0x12')](_0x56047d));if(_0x56047d[_0x6cc5('0x13')]){if(_0x56047d['error'][_0x6cc5('0x14')]===0x1f4){logger[_0x6cc5('0x13')](_0x6cc5('0xe'),_0x315f4f,_0x56047d[_0x6cc5('0x13')]['message']);return _0x90e2ea(_0x56047d[_0x6cc5('0x13')][_0x6cc5('0x15')]);}logger['error'](_0x6cc5('0xe'),_0x315f4f,_0x56047d['error'][_0x6cc5('0x15')]);return _0x4ffa5e(_0x56047d['error'][_0x6cc5('0x15')]);}else{logger[_0x6cc5('0x16')](_0x6cc5('0xe'),_0x315f4f,_0x6cc5('0x11'));_0x4ffa5e(_0x56047d['result'][_0x6cc5('0x15')]);}})[_0x6cc5('0x17')](function(_0x5b585c){logger[_0x6cc5('0x13')](_0x6cc5('0xe'),_0x315f4f,_0x5b585c);_0x90e2ea(_0x5b585c);});});}exports[_0x6cc5('0x18')]=function(_0x5b8556){var _0x131f55=this;return new Promise(function(_0x50916e,_0x5d435e){return db[_0x6cc5('0x19')][_0x6cc5('0x1a')]({'raw':_0x5b8556[_0x6cc5('0x1b')]?_0x5b8556['options'][_0x6cc5('0x1c')]===undefined?!![]:![]:!![],'where':_0x5b8556[_0x6cc5('0x1b')]?_0x5b8556[_0x6cc5('0x1b')]['where']||null:null,'attributes':_0x5b8556['options']?_0x5b8556[_0x6cc5('0x1b')][_0x6cc5('0x1d')]||null:null,'include':_0x5b8556['options']?_0x5b8556[_0x6cc5('0x1b')]['include']?_[_0x6cc5('0x1e')](_0x5b8556[_0x6cc5('0x1b')][_0x6cc5('0x1f')],function(_0x4c06d4){return{'model':db[_0x4c06d4['model']],'as':_0x4c06d4['as'],'attributes':_0x4c06d4[_0x6cc5('0x1d')],'include':_0x4c06d4['include']?_[_0x6cc5('0x1e')](_0x4c06d4['include'],function(_0x57f2ce){return{'model':db[_0x57f2ce[_0x6cc5('0x20')]],'as':_0x57f2ce['as'],'attributes':_0x57f2ce[_0x6cc5('0x1d')],'include':_0x57f2ce[_0x6cc5('0x1f')]?_[_0x6cc5('0x1e')](_0x57f2ce[_0x6cc5('0x1f')],function(_0x117198){return{'model':db[_0x117198[_0x6cc5('0x20')]],'as':_0x117198['as'],'attributes':_0x117198[_0x6cc5('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6cc5('0xd')](function(_0x30825e){logger[_0x6cc5('0x16')](_0x6cc5('0x18'),_0x5b8556);logger['debug'](_0x6cc5('0x18'),_0x5b8556,JSON['stringify'](_0x30825e));_0x50916e(_0x30825e);})['catch'](function(_0x155923){logger['error'](_0x6cc5('0x18'),_0x155923[_0x6cc5('0x15')],_0x5b8556);_0x5d435e(_0x131f55[_0x6cc5('0x13')](0x1f4,_0x155923[_0x6cc5('0x15')]));});});}; \ No newline at end of file +var _0x92ef=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSetting','Setting','raw','options','where','attributes','include','map','model'];(function(_0x4bc984,_0xd65bdd){var _0x500594=function(_0x16783b){while(--_0x16783b){_0x4bc984['push'](_0x4bc984['shift']());}};_0x500594(++_0xd65bdd);}(_0x92ef,0x129));var _0xf92e=function(_0x4f3e2e,_0x281237){_0x4f3e2e=_0x4f3e2e-0x0;var _0x121faf=_0x92ef[_0x4f3e2e];return _0x121faf;};'use strict';var _=require(_0xf92e('0x0'));var util=require(_0xf92e('0x1'));var moment=require(_0xf92e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf92e('0x3'));var fs=require('fs');var Redis=require(_0xf92e('0x4'));var db=require(_0xf92e('0x5'))['db'];var utils=require(_0xf92e('0x6'));var logger=require(_0xf92e('0x7'))(_0xf92e('0x8'));var config=require(_0xf92e('0x9'));var jayson=require(_0xf92e('0xa'));var client=jayson['client'][_0xf92e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x298f50,_0x3a0937,_0x482fdc){return new BPromise(function(_0x3772d1,_0x55a9a4){return client[_0xf92e('0xc')](_0x298f50,_0x482fdc)[_0xf92e('0xd')](function(_0x275e81){logger[_0xf92e('0xe')](_0xf92e('0xf'),_0x3a0937,_0xf92e('0x10'));logger['debug'](_0xf92e('0x11'),_0x3a0937,_0xf92e('0x10'),JSON[_0xf92e('0x12')](_0x275e81));if(_0x275e81[_0xf92e('0x13')]){if(_0x275e81[_0xf92e('0x13')][_0xf92e('0x14')]===0x1f4){logger['error'](_0xf92e('0xf'),_0x3a0937,_0x275e81[_0xf92e('0x13')][_0xf92e('0x15')]);return _0x55a9a4(_0x275e81[_0xf92e('0x13')][_0xf92e('0x15')]);}logger[_0xf92e('0x13')](_0xf92e('0xf'),_0x3a0937,_0x275e81[_0xf92e('0x13')][_0xf92e('0x15')]);return _0x3772d1(_0x275e81[_0xf92e('0x13')][_0xf92e('0x15')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x3a0937,_0xf92e('0x10'));_0x3772d1(_0x275e81[_0xf92e('0x16')][_0xf92e('0x15')]);}})[_0xf92e('0x17')](function(_0x50c9df){logger['error']('Setting,\x20%s,\x20%s',_0x3a0937,_0x50c9df);_0x55a9a4(_0x50c9df);});});}exports[_0xf92e('0x18')]=function(_0x15fe46){var _0x3235d4=this;return new Promise(function(_0x453fd9,_0x30f177){return db[_0xf92e('0x19')]['find']({'raw':_0x15fe46['options']?_0x15fe46['options'][_0xf92e('0x1a')]===undefined?!![]:![]:!![],'where':_0x15fe46[_0xf92e('0x1b')]?_0x15fe46[_0xf92e('0x1b')][_0xf92e('0x1c')]||null:null,'attributes':_0x15fe46['options']?_0x15fe46[_0xf92e('0x1b')][_0xf92e('0x1d')]||null:null,'include':_0x15fe46[_0xf92e('0x1b')]?_0x15fe46['options'][_0xf92e('0x1e')]?_[_0xf92e('0x1f')](_0x15fe46[_0xf92e('0x1b')][_0xf92e('0x1e')],function(_0x20acfb){return{'model':db[_0x20acfb[_0xf92e('0x20')]],'as':_0x20acfb['as'],'attributes':_0x20acfb['attributes'],'include':_0x20acfb[_0xf92e('0x1e')]?_[_0xf92e('0x1f')](_0x20acfb[_0xf92e('0x1e')],function(_0x17f7fe){return{'model':db[_0x17f7fe[_0xf92e('0x20')]],'as':_0x17f7fe['as'],'attributes':_0x17f7fe[_0xf92e('0x1d')],'include':_0x17f7fe[_0xf92e('0x1e')]?_[_0xf92e('0x1f')](_0x17f7fe[_0xf92e('0x1e')],function(_0x1f0772){return{'model':db[_0x1f0772['model']],'as':_0x1f0772['as'],'attributes':_0x1f0772['attributes']};}):[]};}):[]};}):[]:[]})[_0xf92e('0xd')](function(_0xf244a3){logger[_0xf92e('0xe')](_0xf92e('0x18'),_0x15fe46);logger['debug'](_0xf92e('0x18'),_0x15fe46,JSON[_0xf92e('0x12')](_0xf244a3));_0x453fd9(_0xf244a3);})[_0xf92e('0x17')](function(_0x3e7392){logger[_0xf92e('0x13')](_0xf92e('0x18'),_0x3e7392['message'],_0x15fe46);_0x30f177(_0x3235d4['error'](0x1f4,_0x3e7392[_0xf92e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 7c8bf7d..bdf0637 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 _0x6aa7=['create','addDisposition','addAnswer','addApplications','/:id/send','send','status','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','/:id/users','getAgents','post'];(function(_0x1c5926,_0x42bd89){var _0x1a7b33=function(_0x12a278){while(--_0x12a278){_0x1c5926['push'](_0x1c5926['shift']());}};_0x1a7b33(++_0x42bd89);}(_0x6aa7,0x178));var _0x76aa=function(_0x2da4c0,_0x32a0b2){_0x2da4c0=_0x2da4c0-0x0;var _0x30d90a=_0x6aa7[_0x2da4c0];return _0x30d90a;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x76aa('0x5'));var interaction=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var controller=require('./smsAccount.controller');router['get']('/',auth[_0x76aa('0x8')](),controller['index']);router[_0x76aa('0x9')](_0x76aa('0xa'),auth[_0x76aa('0x8')](),controller['describe']);router[_0x76aa('0x9')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller['show']);router[_0x76aa('0x9')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xd')]);router[_0x76aa('0x9')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xf')]);router[_0x76aa('0x9')](_0x76aa('0x10'),auth['isAuthenticated'](),controller[_0x76aa('0x11')]);router['get'](_0x76aa('0x12'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x13')]);router[_0x76aa('0x9')](_0x76aa('0x14'),controller['statusGet']);router['get'](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x16')]);router[_0x76aa('0x17')]('/',auth['isAuthenticated'](),controller[_0x76aa('0x18')]);router['post'](_0x76aa('0xc'),auth['isAuthenticated'](),controller[_0x76aa('0x19')]);router[_0x76aa('0x17')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1a')]);router[_0x76aa('0x17')]('/:id/notify',controller['notify']);router[_0x76aa('0x17')](_0x76aa('0x10'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1b')]);router[_0x76aa('0x17')](_0x76aa('0x1c'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1d')]);router[_0x76aa('0x17')]('/:id/status',controller[_0x76aa('0x1e')]);router[_0x76aa('0x17')](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x1f')]);router[_0x76aa('0x20')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x21')]);router[_0x76aa('0x22')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x23')]);router[_0x76aa('0x22')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x24')]);router['delete'](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x25')]);router[_0x76aa('0x22')](_0x76aa('0x15'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x26')]);module[_0x76aa('0x27')]=router; \ No newline at end of file +var _0x5fc3=['/:id','show','getDispositions','/:id/canned_answers','/:id/applications','getInteractions','/:id/status','statusGet','post','create','/:id/dispositions','addAnswer','/:id/notify','/:id/send','send','status','/:id/users','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','describe'];(function(_0x5ee6c7,_0x2f5593){var _0x224d69=function(_0x4a0669){while(--_0x4a0669){_0x5ee6c7['push'](_0x5ee6c7['shift']());}};_0x224d69(++_0x2f5593);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5a7112,_0x1f9492){_0x5a7112=_0x5a7112-0x0;var _0x3147f7=_0x5fc3[_0x5a7112];return _0x3147f7;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/dispositions',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getAnswers']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getApplications']);router[_0x35fc('0x9')]('/:id/interactions',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router[_0x35fc('0x9')](_0x35fc('0x12'),controller[_0x35fc('0x13')]);router['get']('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x14')]('/',auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x14')](_0x35fc('0x16'),auth[_0x35fc('0xa')](),controller['addDisposition']);router[_0x35fc('0x14')](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x14')](_0x35fc('0x18'),controller['notify']);router[_0x35fc('0x14')](_0x35fc('0x10'),auth[_0x35fc('0xa')](),controller['addApplications']);router[_0x35fc('0x14')](_0x35fc('0x19'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x1a')]);router[_0x35fc('0x14')](_0x35fc('0x12'),controller[_0x35fc('0x1b')]);router[_0x35fc('0x14')](_0x35fc('0x1c'),auth[_0x35fc('0xa')](),controller['addAgents']);router[_0x35fc('0x1d')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x1e')]);router[_0x35fc('0x1f')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x20')]);router['delete'](_0x35fc('0x16'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x21')]);router['delete'](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x22')]);router[_0x35fc('0x1f')]('/:id/users',auth['isAuthenticated'](),controller[_0x35fc('0x23')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 26c51d6..7d423f8 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 _0x13e6=['INTEGER','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','connectel','clicksend','plivo','clickatell','bandwidth','csc','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x35dff8,_0x94094f){var _0x486bd0=function(_0x35d63a){while(--_0x35d63a){_0x35dff8['push'](_0x35dff8['shift']());}};_0x486bd0(++_0x94094f);}(_0x13e6,0x96));var _0x613e=function(_0x2d5ffe,_0x22d481){_0x2d5ffe=_0x2d5ffe-0x0;var _0x17ef5d=_0x13e6[_0x2d5ffe];return _0x17ef5d;};'use strict';var Sequelize=require(_0x613e('0x0'));var rs=require(_0x613e('0x1'));module[_0x613e('0x2')]={'name':{'type':Sequelize[_0x613e('0x3')],'unique':_0x613e('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x613e('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x613e('0x3')],'defaultValue':function(){return rs[_0x613e('0x5')]();}},'phone':{'type':Sequelize[_0x613e('0x3')]},'type':{'type':Sequelize[_0x613e('0x6')](_0x613e('0x7'),'skebby',_0x613e('0x8'),_0x613e('0x9'),_0x613e('0xa'),_0x613e('0xb'),_0x613e('0xc'),_0x613e('0xd'),'infobip',_0x613e('0xe'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x613e('0x3')]},'authToken':{'type':Sequelize[_0x613e('0x3')]},'smsMethod':{'type':Sequelize[_0x613e('0x6')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x613e('0x3')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x613e('0x3')]},'senderString':{'type':Sequelize[_0x613e('0x3')]},'deliveryReport':{'type':Sequelize[_0x613e('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0x613e('0x3')]},'notificationTemplate':{'type':Sequelize[_0x613e('0x10')],'defaultValue':function(){return _0x613e('0x11');}},'notificationSound':{'type':Sequelize[_0x613e('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x613e('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x613e('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x613e('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x613e('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x613e('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x613e('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x613e('0xf')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2a7e90){if(!_0x2a7e90)this['setDataValue'](_0x613e('0x13'),null);this['setDataValue'](_0x613e('0x14'),_0x2a7e90);}}}; \ No newline at end of file +var _0xc273=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','STRING','name','generate','ENUM','twilio','skebby','connectel','clickatell','bandwidth','infobip','intelepeer','BOOLEAN','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc273,0x1aa));var _0x3c27=function(_0x43de22,_0x1eced6){_0x43de22=_0x43de22-0x0;var _0x4b15ee=_0xc273[_0x43de22];return _0x4b15ee;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x3c27('0x0'));module['exports']={'name':{'type':Sequelize[_0x3c27('0x1')],'unique':_0x3c27('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x3c27('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x3c27('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x3c27('0x1')],'defaultValue':function(){return rs[_0x3c27('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3c27('0x4')](_0x3c27('0x5'),_0x3c27('0x6'),_0x3c27('0x7'),'clicksend','plivo',_0x3c27('0x8'),_0x3c27('0x9'),'csc',_0x3c27('0xa'),_0x3c27('0xb'))},'accountSid':{'type':Sequelize[_0x3c27('0x1')]},'authId':{'type':Sequelize[_0x3c27('0x1')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x3c27('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0x3c27('0x1')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x3c27('0x1')]},'applicationId':{'type':Sequelize[_0x3c27('0x1')]},'accountId':{'type':Sequelize[_0x3c27('0x1')]},'senderString':{'type':Sequelize[_0x3c27('0x1')]},'deliveryReport':{'type':Sequelize[_0x3c27('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0x3c27('0x1')]},'notificationTemplate':{'type':Sequelize[_0x3c27('0xd')],'defaultValue':function(){return _0x3c27('0xe');}},'notificationSound':{'type':Sequelize[_0x3c27('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3c27('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3c27('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3c27('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3c27('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x3c27('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x3c27('0xc')],'defaultValue':![],'comment':_0x3c27('0x10'),'set':function(_0x31093a){if(!_0x31093a)this[_0x3c27('0x11')](_0x3c27('0x12'),null);this['setDataValue'](_0x3c27('0x13'),_0x31093a);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index ef1c294..6d34d11 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 _0x9113=['rows','show','mandatoryDispositionPause','keys','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','SmsAccountId','Disposition','getDispositions','merge','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','account','applications','Applications','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','ListId','mobile','From','Body','messageId','MessageSid','skebby','sender','connectel','from','clicksend','plivo','results','csc','originatingAddress','clickatell','fromNumber','text','bandwidth','intelepeer','refid','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','defaults','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','twilio','set','text/xml','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','findAndCountAll','priority','finally','getApplications','fullname','internal','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','dataValues','Messages','debug','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','message_id','status_code','infobip','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','register','jayson/promise','client','http','request','then','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','SmsAccount,\x20%s,\x20%s','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','get','SmsAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','SmsAccount','rawAttributes','fieldName','map','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','options','includeAll','include','findAll'];(function(_0x20d390,_0x4e14ef){var _0x2ce0c5=function(_0xbcbb62){while(--_0xbcbb62){_0x20d390['push'](_0x20d390['shift']());}};_0x2ce0c5(++_0x4e14ef);}(_0x9113,0x90));var _0x3911=function(_0x1d6a95,_0x24a509){_0x1d6a95=_0x1d6a95-0x0;var _0x466efd=_0x9113[_0x1d6a95];return _0x466efd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3911('0x0'));var zipdir=require(_0x3911('0x1'));var jsonpatch=require(_0x3911('0x2'));var rp=require(_0x3911('0x3'));var moment=require(_0x3911('0x4'));var BPromise=require(_0x3911('0x5'));var Mustache=require(_0x3911('0x6'));var util=require('util');var path=require(_0x3911('0x7'));var sox=require('sox');var csv=require(_0x3911('0x8'));var ejs=require(_0x3911('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3911('0xa'));var squel=require(_0x3911('0xb'));var crypto=require(_0x3911('0xc'));var jsforce=require(_0x3911('0xd'));var deskjs=require(_0x3911('0xe'));var toCsv=require(_0x3911('0x8'));var querystring=require(_0x3911('0xf'));var Papa=require(_0x3911('0x10'));var Redis=require(_0x3911('0x11'));var authService=require(_0x3911('0x12'));var qs=require(_0x3911('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3911('0x14'));var logger=require(_0x3911('0x15'))(_0x3911('0x16'));var utils=require(_0x3911('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3911('0x18'));var db=require(_0x3911('0x19'))['db'];config[_0x3911('0x1a')]=_['defaults'](config[_0x3911('0x1a')],{'host':_0x3911('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsAccount.socket')[_0x3911('0x1c')](socket);var jayson=require(_0x3911('0x1d'));var client=jayson[_0x3911('0x1e')][_0x3911('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x1b8431,_0x2e77f3,_0x1fc69d,_0x1f3015){return new BPromise(function(_0x259145,_0x4499be){var _0x1fa7a4=_0x1f3015||client;return _0x1fa7a4[_0x3911('0x20')](_0x1b8431,_0x1fc69d)[_0x3911('0x21')](function(_0x23a0e2){logger['info']('SmsAccount,\x20%s,\x20%s',_0x2e77f3,_0x3911('0x22'));logger['debug'](_0x3911('0x23'),_0x2e77f3,_0x3911('0x22'),JSON[_0x3911('0x24')](_0x23a0e2));if(_0x23a0e2[_0x3911('0x25')]){if(_0x23a0e2['error'][_0x3911('0x26')]===0x1f4){logger[_0x3911('0x25')]('SmsAccount,\x20%s,\x20%s',_0x2e77f3,_0x23a0e2[_0x3911('0x25')][_0x3911('0x27')]);return _0x4499be(_0x23a0e2[_0x3911('0x25')]['message']);}logger[_0x3911('0x25')]('SmsAccount,\x20%s,\x20%s',_0x2e77f3,_0x23a0e2[_0x3911('0x25')]['message']);return _0x259145(_0x23a0e2[_0x3911('0x25')]['message']);}else{logger[_0x3911('0x28')](_0x3911('0x29'),_0x2e77f3,_0x3911('0x22'));_0x259145(_0x23a0e2['result'][_0x3911('0x27')]);}})[_0x3911('0x2a')](function(_0x377670){logger[_0x3911('0x25')](_0x3911('0x29'),_0x2e77f3,_0x377670);_0x4499be(_0x377670);});});}function respondWithStatusCode(_0x371404,_0x555dfb){_0x555dfb=_0x555dfb||0xcc;return function(_0x5b5757){if(_0x5b5757){return _0x371404[_0x3911('0x2b')](_0x555dfb);}return _0x371404['status'](_0x555dfb)['end']();};}function respondWithResult(_0x14f248,_0x48a306){_0x48a306=_0x48a306||0xc8;return function(_0x278af1){if(_0x278af1){return _0x14f248[_0x3911('0x2c')](_0x48a306)[_0x3911('0x2d')](_0x278af1);}};}function respondWithFilteredResult(_0x55c263,_0x22efbb){return function(_0x13d0e8){if(_0x13d0e8){var _0x29f8ee=typeof _0x22efbb[_0x3911('0x2e')]===_0x3911('0x2f')&&typeof _0x22efbb[_0x3911('0x30')]==='undefined';var _0x5ba8f5=_0x13d0e8[_0x3911('0x31')];var _0x212916=_0x29f8ee?0x0:_0x22efbb[_0x3911('0x2e')];var _0x46fb54=_0x29f8ee?_0x13d0e8[_0x3911('0x31')]:_0x22efbb[_0x3911('0x2e')]+_0x22efbb['limit'];var _0x41a52c;if(_0x46fb54>=_0x5ba8f5){_0x46fb54=_0x5ba8f5;_0x41a52c=0xc8;}else{_0x41a52c=0xce;}_0x55c263[_0x3911('0x2c')](_0x41a52c);return _0x55c263['set'](_0x3911('0x32'),_0x212916+'-'+_0x46fb54+'/'+_0x5ba8f5)['json'](_0x13d0e8);}return null;};}function patchUpdates(_0xd074a9){return function(_0x57e71f){try{jsonpatch[_0x3911('0x33')](_0x57e71f,_0xd074a9,!![]);}catch(_0x15bdf5){return BPromise[_0x3911('0x34')](_0x15bdf5);}return _0x57e71f['save']();};}function saveUpdates(_0x13ed4b,_0x12e3af){return function(_0x308033){if(_0x308033){return _0x308033[_0x3911('0x35')](_0x13ed4b)[_0x3911('0x21')](function(_0x5a802d){return _0x5a802d;});}return null;};}function removeEntity(_0x1641e7,_0x4f7ef3){return function(_0x2eb742){if(_0x2eb742){return _0x2eb742['destroy']()[_0x3911('0x21')](function(){var _0x4c0ee8=_0x2eb742[_0x3911('0x36')]({'plain':!![]});var _0xe618c9=_0x3911('0x37');return db[_0x3911('0x38')][_0x3911('0x39')]({'where':{'type':_0xe618c9,'resourceId':_0x4c0ee8['id']}})['then'](function(){return _0x2eb742;});})['then'](function(){_0x1641e7[_0x3911('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24b71c,_0x48bfc2){return function(_0x114cf0){if(!_0x114cf0){_0x24b71c[_0x3911('0x2b')](0x194);}return _0x114cf0;};}function handleError(_0x51e6f0,_0x52d9ac){_0x52d9ac=_0x52d9ac||0x1f4;return function(_0x3bee72){logger[_0x3911('0x25')](_0x3bee72[_0x3911('0x3a')]);if(_0x3bee72[_0x3911('0x3b')]){delete _0x3bee72[_0x3911('0x3b')];}_0x51e6f0[_0x3911('0x2c')](_0x52d9ac)[_0x3911('0x3c')](_0x3bee72);};}exports[_0x3911('0x3d')]=function(_0x521269,_0x8a75c){var _0x288502={'include':[{'model':db[_0x3911('0x3e')],'as':'mandatoryDispositionPause'}]},_0x5c4796={},_0x1a1bc8={'count':0x0,'rows':[]};var _0x1a613f=_['map'](db[_0x3911('0x3f')][_0x3911('0x40')],function(_0x4a2cf6){return{'name':_0x4a2cf6[_0x3911('0x41')],'type':_0x4a2cf6['type']['key']};});_0x5c4796['model']=_[_0x3911('0x42')](_0x1a613f,_0x3911('0x3b'));_0x5c4796[_0x3911('0x43')]=_['keys'](_0x521269[_0x3911('0x43')]);_0x5c4796[_0x3911('0x44')]=_[_0x3911('0x45')](_0x5c4796['model'],_0x5c4796[_0x3911('0x43')]);_0x288502[_0x3911('0x46')]=_[_0x3911('0x45')](_0x5c4796[_0x3911('0x47')],qs['fields'](_0x521269[_0x3911('0x43')][_0x3911('0x48')]));_0x288502[_0x3911('0x46')]=_0x288502[_0x3911('0x46')]['length']?_0x288502[_0x3911('0x46')]:_0x5c4796[_0x3911('0x47')];if(!_0x521269[_0x3911('0x43')][_0x3911('0x49')](_0x3911('0x4a'))){_0x288502['limit']=qs['limit'](_0x521269['query'][_0x3911('0x30')]);_0x288502['offset']=qs[_0x3911('0x2e')](_0x521269[_0x3911('0x43')]['offset']);}_0x288502[_0x3911('0x4b')]=qs[_0x3911('0x4c')](_0x521269[_0x3911('0x43')][_0x3911('0x4c')]);_0x288502['where']=qs[_0x3911('0x44')](_[_0x3911('0x4d')](_0x521269[_0x3911('0x43')],_0x5c4796[_0x3911('0x44')]),_0x1a613f);if(_0x521269[_0x3911('0x43')][_0x3911('0x4e')]){_0x288502[_0x3911('0x4f')]=_['merge'](_0x288502[_0x3911('0x4f')],{'$or':_[_0x3911('0x42')](_0x1a613f,function(_0x28fed5){if(_0x28fed5[_0x3911('0x50')]!==_0x3911('0x51')){var _0x4fb191={};_0x4fb191[_0x28fed5['name']]={'$like':'%'+_0x521269['query'][_0x3911('0x4e')]+'%'};return _0x4fb191;}})});}_0x288502=_['merge']({},_0x288502,_0x521269[_0x3911('0x52')]);var _0xa0a599={'where':_0x288502['where']};return db[_0x3911('0x3f')][_0x3911('0x31')](_0xa0a599)['then'](function(_0x180693){_0x1a1bc8[_0x3911('0x31')]=_0x180693;if(_0x521269[_0x3911('0x43')][_0x3911('0x53')]){_0x288502[_0x3911('0x54')]=[{'all':!![]}];}return db[_0x3911('0x3f')][_0x3911('0x55')](_0x288502);})[_0x3911('0x21')](function(_0x555db9){_0x1a1bc8[_0x3911('0x56')]=_0x555db9;return _0x1a1bc8;})[_0x3911('0x21')](respondWithFilteredResult(_0x8a75c,_0x288502))[_0x3911('0x2a')](handleError(_0x8a75c,null));};exports[_0x3911('0x57')]=function(_0x3745b3,_0x1a573d){var _0x15e28f={'raw':![],'where':{'id':_0x3745b3['params']['id']},'include':[{'model':db[_0x3911('0x3e')],'as':_0x3911('0x58')}]},_0xe03567={};_0xe03567[_0x3911('0x47')]=_[_0x3911('0x59')](db[_0x3911('0x3f')][_0x3911('0x40')]);_0xe03567[_0x3911('0x43')]=_['keys'](_0x3745b3[_0x3911('0x43')]);_0xe03567[_0x3911('0x44')]=_[_0x3911('0x45')](_0xe03567[_0x3911('0x47')],_0xe03567['query']);_0x15e28f[_0x3911('0x46')]=_[_0x3911('0x45')](_0xe03567[_0x3911('0x47')],qs[_0x3911('0x48')](_0x3745b3[_0x3911('0x43')][_0x3911('0x48')]));_0x15e28f[_0x3911('0x46')]=_0x15e28f[_0x3911('0x46')][_0x3911('0x5a')]?_0x15e28f['attributes']:_0xe03567[_0x3911('0x47')];if(_0x3745b3[_0x3911('0x43')][_0x3911('0x53')]){_0x15e28f[_0x3911('0x54')]=[{'all':!![]}];}_0x15e28f=_['merge']({},_0x15e28f,_0x3745b3[_0x3911('0x52')]);return db[_0x3911('0x3f')][_0x3911('0x5b')](_0x15e28f)[_0x3911('0x21')](handleEntityNotFound(_0x1a573d,null))['then'](respondWithResult(_0x1a573d,null))[_0x3911('0x2a')](handleError(_0x1a573d,null));};exports[_0x3911('0x5c')]=function(_0x1d87f8,_0xcf36c5){return db[_0x3911('0x3f')][_0x3911('0x5c')](_0x1d87f8[_0x3911('0x5d')],{})[_0x3911('0x21')](function(_0x3582a0){var _0x4197f0=_0x1d87f8['user']['get']({'plain':!![]});if(!_0x4197f0)throw new Error(_0x3911('0x5e'));if(_0x4197f0[_0x3911('0x5f')]===_0x3911('0x60')){var _0x2ef12e=_0x3582a0[_0x3911('0x36')]({'plain':!![]});var _0x275303=_0x3911('0x37');return db[_0x3911('0x61')][_0x3911('0x5b')]({'where':{'name':_0x275303,'userProfileId':_0x4197f0[_0x3911('0x62')]},'raw':!![]})['then'](function(_0x444f33){if(_0x444f33&&_0x444f33[_0x3911('0x63')]===0x0){return db[_0x3911('0x38')][_0x3911('0x5c')]({'name':_0x2ef12e['name'],'resourceId':_0x2ef12e['id'],'type':_0x444f33['name'],'sectionId':_0x444f33['id']},{})[_0x3911('0x21')](function(){return _0x3582a0;});}else{return _0x3582a0;}})[_0x3911('0x2a')](function(_0x42e24e){logger['error'](_0x3911('0x64'),_0x42e24e);throw _0x42e24e;});}return _0x3582a0;})[_0x3911('0x21')](respondWithResult(_0xcf36c5,0xc9))[_0x3911('0x2a')](handleError(_0xcf36c5,null));};exports[_0x3911('0x35')]=function(_0x1a8ac3,_0x2e432c){if(_0x1a8ac3[_0x3911('0x5d')]['id']){delete _0x1a8ac3[_0x3911('0x5d')]['id'];}return db[_0x3911('0x3f')]['find']({'where':{'id':_0x1a8ac3[_0x3911('0x65')]['id']},'include':[{'model':db[_0x3911('0x3e')],'as':_0x3911('0x58')}]})[_0x3911('0x21')](handleEntityNotFound(_0x2e432c,null))[_0x3911('0x21')](saveUpdates(_0x1a8ac3[_0x3911('0x5d')],null))[_0x3911('0x21')](respondWithResult(_0x2e432c,null))[_0x3911('0x2a')](handleError(_0x2e432c,null));};exports['destroy']=function(_0x47056f,_0x241918){return db[_0x3911('0x3f')][_0x3911('0x5b')]({'where':{'id':_0x47056f[_0x3911('0x65')]['id']}})[_0x3911('0x21')](handleEntityNotFound(_0x241918,null))[_0x3911('0x21')](removeEntity(_0x241918,null))[_0x3911('0x2a')](handleError(_0x241918,null));};exports[_0x3911('0x66')]=function(_0x403fdb,_0x4b58df){return db[_0x3911('0x3f')][_0x3911('0x66')]()[_0x3911('0x21')](respondWithResult(_0x4b58df,null))[_0x3911('0x2a')](handleError(_0x4b58df,null));};exports[_0x3911('0x67')]=function(_0x2f5e7f,_0x5d3d4b,_0x9ff3fc){if(_0x2f5e7f[_0x3911('0x5d')]['id']){delete _0x2f5e7f[_0x3911('0x5d')]['id'];}return db['SmsAccount'][_0x3911('0x5b')]({'where':{'id':_0x2f5e7f['params']['id']}})[_0x3911('0x21')](handleEntityNotFound(_0x5d3d4b,null))[_0x3911('0x21')](function(_0x5cb07a){if(_0x5cb07a){_0x2f5e7f[_0x3911('0x5d')][_0x3911('0x68')]=_0x5cb07a['id'];return db[_0x3911('0x69')]['create'](_0x2f5e7f['body']);}})[_0x3911('0x21')](respondWithResult(_0x5d3d4b,null))[_0x3911('0x2a')](handleError(_0x5d3d4b,null));};exports[_0x3911('0x6a')]=function(_0x54fc4c,_0x5aa11c,_0x69adfe){var _0x5ca000={'raw':![],'where':{}};var _0x46d434={};var _0x3e40e4={'count':0x0,'rows':[]};return db[_0x3911('0x3f')]['findOne']({'where':{'id':_0x54fc4c[_0x3911('0x65')]['id']}})[_0x3911('0x21')](handleEntityNotFound(_0x5aa11c,null))[_0x3911('0x21')](function(_0x46d090){if(_0x46d090){_0x46d434[_0x3911('0x47')]=_[_0x3911('0x59')](db[_0x3911('0x69')][_0x3911('0x40')]);_0x46d434[_0x3911('0x43')]=_[_0x3911('0x59')](_0x54fc4c[_0x3911('0x43')]);_0x46d434[_0x3911('0x44')]=_[_0x3911('0x45')](_0x46d434['model'],_0x46d434[_0x3911('0x43')]);_0x5ca000[_0x3911('0x46')]=_[_0x3911('0x45')](_0x46d434[_0x3911('0x47')],qs[_0x3911('0x48')](_0x54fc4c[_0x3911('0x43')]['fields']));_0x5ca000[_0x3911('0x46')]=_0x5ca000['attributes'][_0x3911('0x5a')]?_0x5ca000[_0x3911('0x46')]:_0x46d434[_0x3911('0x47')];if(!_0x54fc4c[_0x3911('0x43')][_0x3911('0x49')](_0x3911('0x4a'))){_0x5ca000[_0x3911('0x30')]=qs['limit'](_0x54fc4c[_0x3911('0x43')]['limit']);_0x5ca000[_0x3911('0x2e')]=qs[_0x3911('0x2e')](_0x54fc4c[_0x3911('0x43')][_0x3911('0x2e')]);}_0x5ca000[_0x3911('0x4b')]=qs['sort'](_0x54fc4c[_0x3911('0x43')][_0x3911('0x4c')]);_0x5ca000[_0x3911('0x4f')]=qs[_0x3911('0x44')](_['pick'](_0x54fc4c['query'],_0x46d434[_0x3911('0x44')]));_0x5ca000[_0x3911('0x4f')][_0x3911('0x68')]=_0x46d090['id'];if(_0x54fc4c['query'][_0x3911('0x4e')]){_0x5ca000[_0x3911('0x4f')]=_[_0x3911('0x6b')](_0x5ca000[_0x3911('0x4f')],{'$or':_[_0x3911('0x42')](_0x5ca000[_0x3911('0x46')],function(_0x3d61dd){var _0x22891e={};_0x22891e[_0x3d61dd]={'$like':'%'+_0x54fc4c['query'][_0x3911('0x4e')]+'%'};return _0x22891e;})});}_0x5ca000=_[_0x3911('0x6b')]({},_0x5ca000,_0x54fc4c[_0x3911('0x52')]);return db[_0x3911('0x69')]['count']({'where':_0x5ca000[_0x3911('0x4f')]})['then'](function(_0x5de59b){_0x3e40e4[_0x3911('0x31')]=_0x5de59b;if(_0x54fc4c[_0x3911('0x43')][_0x3911('0x53')]){_0x5ca000[_0x3911('0x54')]=[{'all':!![]}];}return db[_0x3911('0x69')][_0x3911('0x55')](_0x5ca000);})[_0x3911('0x21')](function(_0x332b57){_0x3e40e4['rows']=_0x332b57;return _0x3e40e4;});}})[_0x3911('0x21')](respondWithFilteredResult(_0x5aa11c,_0x5ca000))[_0x3911('0x2a')](handleError(_0x5aa11c,null));};exports['removeDispositions']=function(_0x5cd472,_0x50f862,_0x4d90ad){return db[_0x3911('0x3f')][_0x3911('0x5b')]({'where':{'id':_0x5cd472[_0x3911('0x65')]['id']}})['then'](handleEntityNotFound(_0x50f862,null))[_0x3911('0x21')](function(_0x4b88a7){if(_0x4b88a7){return _0x4b88a7[_0x3911('0x6c')](_0x5cd472[_0x3911('0x43')][_0x3911('0x6d')]);}})[_0x3911('0x21')](respondWithStatusCode(_0x50f862,null))[_0x3911('0x2a')](handleError(_0x50f862,null));};exports['addAnswer']=function(_0x494e45,_0x4c90bc,_0x2cdefc){if(_0x494e45[_0x3911('0x5d')]['id']){delete _0x494e45[_0x3911('0x5d')]['id'];}return db[_0x3911('0x3f')]['find']({'where':{'id':_0x494e45['params']['id']}})[_0x3911('0x21')](handleEntityNotFound(_0x4c90bc,null))[_0x3911('0x21')](function(_0x1c6695){if(_0x1c6695){_0x494e45[_0x3911('0x5d')][_0x3911('0x68')]=_0x1c6695['id'];return db[_0x3911('0x6e')]['create'](_0x494e45['body']);}})[_0x3911('0x21')](respondWithResult(_0x4c90bc,null))[_0x3911('0x2a')](handleError(_0x4c90bc,null));};exports[_0x3911('0x6f')]=function(_0x4714cd,_0x5ab108,_0x1b640f){var _0x386b2b={'raw':![],'where':{}};var _0x40215d={};var _0x48e21a={'count':0x0,'rows':[]};return db[_0x3911('0x3f')]['findOne']({'where':{'id':_0x4714cd[_0x3911('0x65')]['id']}})[_0x3911('0x21')](handleEntityNotFound(_0x5ab108,null))[_0x3911('0x21')](function(_0xde5187){if(_0xde5187){_0x40215d['model']=_[_0x3911('0x59')](db['CannedAnswer'][_0x3911('0x40')]);_0x40215d[_0x3911('0x43')]=_[_0x3911('0x59')](_0x4714cd['query']);_0x40215d[_0x3911('0x44')]=_[_0x3911('0x45')](_0x40215d[_0x3911('0x47')],_0x40215d['query']);_0x386b2b[_0x3911('0x46')]=_[_0x3911('0x45')](_0x40215d[_0x3911('0x47')],qs[_0x3911('0x48')](_0x4714cd[_0x3911('0x43')][_0x3911('0x48')]));_0x386b2b[_0x3911('0x46')]=_0x386b2b['attributes'][_0x3911('0x5a')]?_0x386b2b[_0x3911('0x46')]:_0x40215d[_0x3911('0x47')];if(!_0x4714cd[_0x3911('0x43')]['hasOwnProperty']('nolimit')){_0x386b2b[_0x3911('0x30')]=qs[_0x3911('0x30')](_0x4714cd[_0x3911('0x43')][_0x3911('0x30')]);_0x386b2b[_0x3911('0x2e')]=qs[_0x3911('0x2e')](_0x4714cd['query'][_0x3911('0x2e')]);}_0x386b2b['order']=qs[_0x3911('0x4c')](_0x4714cd[_0x3911('0x43')][_0x3911('0x4c')]);_0x386b2b[_0x3911('0x4f')]=qs[_0x3911('0x44')](_['pick'](_0x4714cd[_0x3911('0x43')],_0x40215d[_0x3911('0x44')]));_0x386b2b[_0x3911('0x4f')][_0x3911('0x68')]=_0xde5187['id'];if(_0x4714cd[_0x3911('0x43')][_0x3911('0x4e')]){_0x386b2b[_0x3911('0x4f')]=_[_0x3911('0x6b')](_0x386b2b[_0x3911('0x4f')],{'$or':_[_0x3911('0x42')](_0x386b2b[_0x3911('0x46')],function(_0x63fd0f){var _0x577d29={};_0x577d29[_0x63fd0f]={'$like':'%'+_0x4714cd[_0x3911('0x43')][_0x3911('0x4e')]+'%'};return _0x577d29;})});}_0x386b2b=_['merge']({},_0x386b2b,_0x4714cd[_0x3911('0x52')]);return db['CannedAnswer'][_0x3911('0x31')]({'where':_0x386b2b[_0x3911('0x4f')]})[_0x3911('0x21')](function(_0x65cb3a){_0x48e21a[_0x3911('0x31')]=_0x65cb3a;if(_0x4714cd[_0x3911('0x43')][_0x3911('0x53')]){_0x386b2b[_0x3911('0x54')]=[{'all':!![]}];}return db['CannedAnswer'][_0x3911('0x55')](_0x386b2b);})['then'](function(_0x271e2f){_0x48e21a[_0x3911('0x56')]=_0x271e2f;return _0x48e21a;});}})[_0x3911('0x21')](respondWithFilteredResult(_0x5ab108,_0x386b2b))[_0x3911('0x2a')](handleError(_0x5ab108,null));};exports[_0x3911('0x70')]=function(_0x512faa,_0x592e82,_0x58cded){return db[_0x3911('0x3f')][_0x3911('0x5b')]({'where':{'id':_0x512faa[_0x3911('0x65')]['id']}})[_0x3911('0x21')](handleEntityNotFound(_0x592e82,null))['then'](function(_0xa917c4){if(_0xa917c4){return _0xa917c4['removeAnswers'](_0x512faa[_0x3911('0x43')][_0x3911('0x6d')]);}})[_0x3911('0x21')](respondWithStatusCode(_0x592e82,null))['catch'](handleError(_0x592e82,null));};exports[_0x3911('0x71')]=function(_0x24cafe,_0x5d40ee,_0x5a4bbd){var _0x35bbff={'channel':_0x3911('0x72')};var _0x30f855=[];var _0x1e1cbe=[];var _0x2613c2={};return db[_0x3911('0x3f')][_0x3911('0x5b')]({'where':{'id':_0x24cafe[_0x3911('0x65')]['id']},'include':[{'model':db[_0x3911('0x73')],'as':'Applications'}]})[_0x3911('0x21')](handleEntityNotFound(_0x5d40ee,null))[_0x3911('0x21')](function(_0xfb9b5f){_0x35bbff[_0x3911('0x74')]=_0xfb9b5f;_0x35bbff[_0x3911('0x75')]=_['orderBy'](_0xfb9b5f[_0x3911('0x76')],['priority'],['asc']);if(_0x35bbff[_0x3911('0x74')][_0x3911('0x76')]){delete _0x35bbff[_0x3911('0x74')]['Applications'];}return db[_0x3911('0x77')][_0x3911('0x66')]();})['then'](function(_0x3f7efc){if(!_0x3f7efc){throw new db[(_0x3911('0x78'))][(_0x3911('0x79'))](_0x3911('0x7a'));}_0x30f855=_['difference'](_[_0x3911('0x59')](_0x3f7efc),[_0x3911('0x7b'),_0x3911('0x7c')]);_0x1e1cbe=_[_0x3911('0x7d')](_[_0x3911('0x59')](_0x3f7efc),[_0x3911('0x7b'),_0x3911('0x7c'),'CompanyId',_0x3911('0x7e')]);_0x35bbff[_0x3911('0x5d')]={'mapKey':_0x3911('0x7f')};if(_0x35bbff[_0x3911('0x74')][_0x3911('0x50')]){switch(_0x35bbff[_0x3911('0x74')]['type']){case'twilio':_0x35bbff[_0x3911('0x5d')]['from']=_0x24cafe[_0x3911('0x5d')][_0x3911('0x80')];_0x35bbff[_0x3911('0x5d')]['body']=_0x24cafe[_0x3911('0x5d')][_0x3911('0x81')];_0x35bbff[_0x3911('0x5d')][_0x3911('0x82')]=_0x24cafe[_0x3911('0x5d')][_0x3911('0x83')];break;case _0x3911('0x84'):_0x35bbff[_0x3911('0x5d')]['from']='+'+_0x24cafe[_0x3911('0x5d')][_0x3911('0x85')];_0x35bbff[_0x3911('0x5d')][_0x3911('0x5d')]=_0x24cafe[_0x3911('0x5d')]['text'];break;case _0x3911('0x86'):_0x35bbff[_0x3911('0x5d')]['from']=_0x24cafe['body'][_0x3911('0x87')];_0x35bbff[_0x3911('0x5d')][_0x3911('0x5d')]=_0x24cafe[_0x3911('0x5d')][_0x3911('0x27')];break;case _0x3911('0x88'):_0x35bbff['body'][_0x3911('0x87')]=_0x24cafe['body'][_0x3911('0x87')];_0x35bbff[_0x3911('0x5d')][_0x3911('0x5d')]=_0x24cafe['body'][_0x3911('0x5d')];_0x35bbff[_0x3911('0x5d')]['messageId']=_0x24cafe[_0x3911('0x5d')]['message_id'];break;case _0x3911('0x89'):_0x35bbff['body']['from']=_0x24cafe[_0x3911('0x5d')][_0x3911('0x80')];_0x35bbff[_0x3911('0x5d')][_0x3911('0x5d')]=_0x24cafe[_0x3911('0x5d')]['Text'];_0x35bbff['body'][_0x3911('0x82')]=_0x24cafe[_0x3911('0x5d')]['MessageUUID'];break;case'infobip':_0x35bbff['body'][_0x3911('0x87')]='+'+_0x24cafe[_0x3911('0x5d')][_0x3911('0x8a')][0x0][_0x3911('0x87')];_0x35bbff[_0x3911('0x5d')][_0x3911('0x5d')]=_0x24cafe['body'][_0x3911('0x8a')][0x0]['text'];_0x35bbff[_0x3911('0x5d')][_0x3911('0x82')]=_0x24cafe['body'][_0x3911('0x8a')][0x0]['messageId'];break;case _0x3911('0x8b'):_0x35bbff[_0x3911('0x5d')][_0x3911('0x87')]=_0x24cafe[_0x3911('0x5d')][_0x3911('0x8c')];_0x35bbff[_0x3911('0x5d')][_0x3911('0x5d')]=_0x24cafe[_0x3911('0x5d')]['segmentedMessage'][_0x3911('0x27')];break;case _0x3911('0x8d'):_0x35bbff[_0x3911('0x5d')]['from']=_0x24cafe[_0x3911('0x5d')][_0x3911('0x8e')];_0x35bbff[_0x3911('0x5d')][_0x3911('0x5d')]=_0x24cafe[_0x3911('0x5d')][_0x3911('0x8f')];_0x35bbff[_0x3911('0x5d')]['messageId']=_0x24cafe['body']['replyMessageId'];break;case _0x3911('0x90'):_0x35bbff[_0x3911('0x5d')]['messageId']=_0x24cafe[_0x3911('0x5d')][0x0][_0x3911('0x27')]['id'];_0x35bbff[_0x3911('0x5d')][_0x3911('0x87')]=_0x24cafe['body'][0x0][_0x3911('0x27')][_0x3911('0x87')];_0x35bbff[_0x3911('0x5d')][_0x3911('0x5d')]=_0x24cafe[_0x3911('0x5d')][0x0][_0x3911('0x27')][_0x3911('0x8f')];break;case _0x3911('0x91'):_0x35bbff[_0x3911('0x5d')][_0x3911('0x87')]=_0x24cafe[_0x3911('0x5d')][_0x3911('0x87')];_0x35bbff['body']['body']=_0x24cafe[_0x3911('0x5d')]['message'];_0x35bbff['body'][_0x3911('0x82')]=_0x24cafe[_0x3911('0x5d')][_0x3911('0x92')];break;}}if(_0x35bbff[_0x3911('0x5d')]['id']){delete _0x35bbff[_0x3911('0x5d')]['id'];}if(_[_0x3911('0x93')](_0x35bbff[_0x3911('0x5d')]['from'])){throw new db[(_0x3911('0x78'))][(_0x3911('0x79'))]('from\x20is\x20mandatory');}if(_[_0x3911('0x93')](_0x35bbff[_0x3911('0x5d')][_0x3911('0x5d')])||_0x35bbff[_0x3911('0x5d')][_0x3911('0x5d')]===''){throw new db[(_0x3911('0x78'))][(_0x3911('0x79'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x3911('0x93')](_0x35bbff[_0x3911('0x5d')][_0x3911('0x94')])){throw new db[(_0x3911('0x78'))][(_0x3911('0x79'))](_0x3911('0x95')+_0x1e1cbe);}if(!_['includes'](_0x1e1cbe,_0x35bbff['body'][_0x3911('0x94')])){throw new db['Sequelize'][(_0x3911('0x79'))](_0x3911('0x96')+_0x1e1cbe);}_0x2613c2[_0x35bbff[_0x3911('0x5d')][_0x3911('0x94')]]=_0x35bbff[_0x3911('0x5d')]['from'];return db[_0x3911('0x97')][_0x3911('0x5b')]({'where':{'id':_0x35bbff[_0x3911('0x74')]['ListId']},'include':[{'model':db[_0x3911('0x77')],'as':_0x3911('0x98'),'where':_0x2613c2,'limit':0x1,'order':[[_0x3911('0x7c'),_0x3911('0x99')]]}]});})['then'](handleEntityNotFound(_0x5d40ee,null))[_0x3911('0x21')](function(_0x3a958a){if(_0x3a958a){_0x35bbff[_0x3911('0x9a')]=_[_0x3911('0x9b')](_0x3a958a,['Contacts']);if(_0x3a958a[_0x3911('0x98')][_0x3911('0x5a')]){return _0x3a958a[_0x3911('0x98')][0x0];}var _0x228a74=_[_0x3911('0x9c')](_0x35bbff['body'],{'firstName':_0x35bbff[_0x3911('0x5d')][_0x3911('0x87')],'ListId':_0x3a958a['id']});_0x228a74[_0x35bbff['body'][_0x3911('0x94')]]=_0x35bbff[_0x3911('0x5d')][_0x3911('0x87')];return db[_0x3911('0x77')][_0x3911('0x5c')](_0x228a74,{'fields':_0x30f855,'raw':!![]});}})[_0x3911('0x21')](handleEntityNotFound(_0x5d40ee,null))[_0x3911('0x21')](function(_0x1a689d){if(_0x1a689d){_0x35bbff['contact']=_0x1a689d;var _0x353ce7={'ContactId':_0x1a689d['id'],'phone':_0x35bbff[_0x3911('0x5d')][_0x3911('0x87')],'SmsAccountId':_0x24cafe[_0x3911('0x65')]['id']};var _0x157944={'ContactId':_0x1a689d['id'],'SmsAccountId':_0x24cafe[_0x3911('0x65')]['id'],'closed':![]};return db[_0x3911('0x9d')]['find']({'where':_0x157944})['then'](function(_0x1f3a99){if(_0x1f3a99){return[_0x1f3a99,![]];}return db[_0x3911('0x9d')][_0x3911('0x5c')](_0x353ce7)['then'](function(_0x459640){return[_0x459640,!![]];});});}})[_0x3911('0x9e')](function(_0x11b80c,_0xe82834){_0x35bbff[_0x3911('0x9f')]=_0x11b80c[_0x3911('0x36')]({'plain':!![]});_0x35bbff[_0x3911('0x9f')][_0x3911('0xa0')]=![];if(_0xe82834){if(_0x35bbff[_0x3911('0x74')][_0x3911('0xa1')]){_0x35bbff[_0x3911('0x75')][_0x3911('0xa2')]({'id':0x0,'priority':_0x35bbff[_0x3911('0x75')][_0x3911('0x5a')]+0x1,'app':_0x3911('0xa3'),'appdata':_0x3911('0xa4'),'interval':_0x3911('0xa5')});}_0x35bbff['interaction']['created']=!![];}return db[_0x3911('0xa6')][_0x3911('0x5c')]({'phone':_0x35bbff[_0x3911('0x5d')]['from'],'messageId':_0x35bbff[_0x3911('0x5d')][_0x3911('0x82')],'body':_0x35bbff[_0x3911('0x5d')]['body'],'SmsAccountId':_0x24cafe[_0x3911('0x65')]['id'],'SmsInteractionId':_0x11b80c['id'],'direction':'in','ContactId':_0x11b80c['ContactId'],'AttachmentId':_0x35bbff[_0x3911('0x5d')][_0x3911('0xa7')]});})[_0x3911('0x21')](function(_0x1eeac3){_0x35bbff[_0x3911('0x27')]=_0x1eeac3;if(_0x35bbff[_0x3911('0x9f')][_0x3911('0xa8')]){return db[_0x3911('0xa9')]['find']({'attributes':['id','name'],'where':{'id':_0x35bbff['interaction'][_0x3911('0xa8')]}})[_0x3911('0x21')](function(_0x3c030d){if(_0x3c030d){_0x35bbff['applications'][_0x3911('0xaa')]({'id':0x0,'priority':0x0,'app':_0x3911('0xab'),'appdata':_0x3c030d[_0x3911('0x3b')]+','+(_0x35bbff[_0x3911('0x74')][_0x3911('0xac')]||0xa),'interval':_0x3911('0xa5')});}return respondWithRpcPromise(_0x3911('0xad'),_0x3911('0xae'),_0x35bbff);});}return respondWithRpcPromise(_0x3911('0xad'),_0x3911('0xae'),_0x35bbff);})[_0x3911('0x21')](function(_0x35b0bd){if(_0x35b0bd){var _0x307ff9=0xc8;var _0x3e25f9=_0x3911('0xaf');logger[_0x3911('0x28')](_0x3911('0x23'),_0x3e25f9,_0x307ff9,_0x3911('0xb0'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x3e25f9,_0x307ff9,_0x3911('0xb0'),JSON[_0x3911('0x24')](_0x35b0bd));if(_0x35bbff[_0x3911('0x74')][_0x3911('0x50')]===_0x3911('0xb1')){return _0x5d40ee[_0x3911('0x2c')](_0x307ff9)[_0x3911('0xb2')]('Content-Type',_0x3911('0xb3'))[_0x3911('0x3c')](_0x3911('0xb4'));}else{return _0x5d40ee[_0x3911('0x2c')](_0x307ff9)['json'](_0x35b0bd);}}})[_0x3911('0x2a')](handleError(_0x5d40ee,null));};exports[_0x3911('0xb5')]=function(_0x27ab67,_0x4445bc){var _0x287d39=_0x27ab67[_0x3911('0x65')]['id'];var _0x1d2907=_0x27ab67[_0x3911('0x5d')];var _0x2a847f=0xc8;var _0xda60c5=null;return db[_0x3911('0xb6')][_0x3911('0xb7')]({'isolationLevel':db['sequelize'][_0x3911('0xb8')][_0x3911('0xb9')][_0x3911('0xba')]},function(_0x418e0e){return db[_0x3911('0x3f')][_0x3911('0xbb')]({'where':{'id':_0x287d39},'transaction':_0x418e0e})['then'](function(_0x40931b){if(_0x40931b){return db[_0x3911('0x73')][_0x3911('0x39')]({'where':{'SmsAccountId':_0x287d39},'transaction':_0x418e0e})[_0x3911('0x21')](function(){var _0x310522=_[_0x3911('0x42')](_0x1d2907,function(_0x207da4){_0x207da4[_0x3911('0x68')]=_0x287d39;return _0x207da4;});return db[_0x3911('0x73')]['bulkCreate'](_0x310522,{'transaction':_0x418e0e});});}else{_0x2a847f=0x194;_0xda60c5=[];}});})[_0x3911('0x21')](function(){if(_0x2a847f!==0x194){return db[_0x3911('0x73')][_0x3911('0xbc')]({'where':{'SmsAccountId':_0x287d39},'order':_0x3911('0xbd')})['then'](function(_0x13acff){_0xda60c5=_0x13acff;});}})[_0x3911('0x2a')](function(_0x326ee8){_0x2a847f=0x1f4;logger[_0x3911('0x25')](_0x326ee8['stack']);if(_0x326ee8['name']){delete _0x326ee8[_0x3911('0x3b')];}_0xda60c5=_0x326ee8;})[_0x3911('0xbe')](function(){if(_0xda60c5===null){_0x4445bc['sendStatus'](_0x2a847f);}else{if(_0x2a847f===0x1f4){_0x4445bc[_0x3911('0x2c')](_0x2a847f)['send'](_0xda60c5);}else{_0x4445bc[_0x3911('0x2c')](_0x2a847f)[_0x3911('0x2d')](_0xda60c5);}}});};exports[_0x3911('0xbf')]=function(_0x38ddce,_0xa633a3,_0x4c4cd6){var _0x2ba4bd={};var _0x2b934a={};var _0x59decb;var _0x420174;return db[_0x3911('0x3f')][_0x3911('0xbb')]({'where':{'id':_0x38ddce[_0x3911('0x65')]['id']}})[_0x3911('0x21')](handleEntityNotFound(_0xa633a3,null))['then'](function(_0x1cf658){if(_0x1cf658){_0x59decb=_0x1cf658;_0x2b934a[_0x3911('0x47')]=_['keys'](db[_0x3911('0x73')][_0x3911('0x40')]);_0x2b934a[_0x3911('0x43')]=_[_0x3911('0x59')](_0x38ddce[_0x3911('0x43')]);_0x2b934a['filters']=_[_0x3911('0x45')](_0x2b934a[_0x3911('0x47')],_0x2b934a[_0x3911('0x43')]);_0x2ba4bd[_0x3911('0x46')]=_[_0x3911('0x45')](_0x2b934a[_0x3911('0x47')],qs['fields'](_0x38ddce['query']['fields']));_0x2ba4bd[_0x3911('0x46')]=_0x2ba4bd[_0x3911('0x46')][_0x3911('0x5a')]?_0x2ba4bd[_0x3911('0x46')]:_0x2b934a['model'];_0x2ba4bd[_0x3911('0x4b')]=qs[_0x3911('0x4c')](_0x38ddce[_0x3911('0x43')][_0x3911('0x4c')]);_0x2ba4bd[_0x3911('0x4f')]=qs[_0x3911('0x44')](_[_0x3911('0x4d')](_0x38ddce[_0x3911('0x43')],_0x2b934a['filters']));if(_0x38ddce[_0x3911('0x43')]['filter']){_0x2ba4bd[_0x3911('0x4f')]=_[_0x3911('0x6b')](_0x2ba4bd[_0x3911('0x4f')],{'$or':_['map'](_0x2ba4bd[_0x3911('0x46')],function(_0x2d363b){var _0x5eed1c={};_0x5eed1c[_0x2d363b]={'$like':'%'+_0x38ddce[_0x3911('0x43')]['filter']+'%'};return _0x5eed1c;})});}_0x2ba4bd=_['merge']({},_0x2ba4bd,_0x38ddce[_0x3911('0x52')]);return _0x59decb['getApplications'](_0x2ba4bd);}})[_0x3911('0x21')](function(_0xadf2){if(_0xadf2){_0x420174=_0xadf2[_0x3911('0x5a')];if(!_0x38ddce['query'][_0x3911('0x49')](_0x3911('0x4a'))){_0x2ba4bd[_0x3911('0x30')]=qs[_0x3911('0x30')](_0x38ddce[_0x3911('0x43')][_0x3911('0x30')]);_0x2ba4bd['offset']=qs[_0x3911('0x2e')](_0x38ddce[_0x3911('0x43')][_0x3911('0x2e')]);}return _0x59decb[_0x3911('0xbf')](_0x2ba4bd);}})[_0x3911('0x21')](function(_0x511a84){if(_0x511a84){return _0x511a84?{'count':_0x420174,'rows':_0x511a84}:null;}})[_0x3911('0x21')](respondWithResult(_0xa633a3,null))[_0x3911('0x2a')](handleError(_0xa633a3,null));};exports['getInteractions']=function(_0x2bd5d6,_0x2308ba,_0x1fd47e){var _0x5d83a6={'raw':![],'where':{}};var _0x55dedd={};var _0x2c23ca={'count':0x0,'rows':[]};return db['SmsAccount'][_0x3911('0xbb')]({'where':{'id':_0x2bd5d6[_0x3911('0x65')]['id']}})[_0x3911('0x21')](handleEntityNotFound(_0x2308ba,null))[_0x3911('0x21')](function(_0x4d2cfd){if(_0x4d2cfd){_0x55dedd['model']=_[_0x3911('0x59')](db['SmsInteraction']['rawAttributes']);_0x55dedd['query']=_[_0x3911('0x59')](_0x2bd5d6[_0x3911('0x43')]);_0x55dedd[_0x3911('0x44')]=_[_0x3911('0x45')](_0x55dedd[_0x3911('0x47')],_0x55dedd[_0x3911('0x43')]);_0x5d83a6[_0x3911('0x46')]=_[_0x3911('0x45')](_0x55dedd[_0x3911('0x47')],qs['fields'](_0x2bd5d6[_0x3911('0x43')]['fields']));_0x5d83a6[_0x3911('0x46')]=_0x5d83a6[_0x3911('0x46')][_0x3911('0x5a')]?_0x5d83a6[_0x3911('0x46')]:_0x55dedd[_0x3911('0x47')];if(!_0x2bd5d6[_0x3911('0x43')][_0x3911('0x49')](_0x3911('0x4a'))){_0x5d83a6['limit']=qs['limit'](_0x2bd5d6['query'][_0x3911('0x30')]);_0x5d83a6['offset']=qs[_0x3911('0x2e')](_0x2bd5d6[_0x3911('0x43')][_0x3911('0x2e')]);}_0x5d83a6['order']=qs[_0x3911('0x4c')](_0x2bd5d6[_0x3911('0x43')][_0x3911('0x4c')]);_0x5d83a6[_0x3911('0x4f')]=qs[_0x3911('0x44')](_[_0x3911('0x4d')](_0x2bd5d6[_0x3911('0x43')],_0x55dedd[_0x3911('0x44')]));_0x5d83a6['where'][_0x3911('0x68')]=_0x4d2cfd['id'];if(_0x2bd5d6[_0x3911('0x43')]['filter']){_0x5d83a6[_0x3911('0x4f')]=_[_0x3911('0x6b')](_0x5d83a6[_0x3911('0x4f')],{'$or':_['map'](_0x5d83a6['attributes'],function(_0x482986){var _0x9ab512={};_0x9ab512[_0x482986]={'$like':'%'+_0x2bd5d6[_0x3911('0x43')][_0x3911('0x4e')]+'%'};return _0x9ab512;})});}_0x5d83a6=_[_0x3911('0x6b')]({},_0x5d83a6,_0x2bd5d6[_0x3911('0x52')]);return db['SmsInteraction'][_0x3911('0x31')]({'where':_0x5d83a6['where']})[_0x3911('0x21')](function(_0x3f0370){_0x2c23ca[_0x3911('0x31')]=_0x3f0370;if(_0x2bd5d6[_0x3911('0x43')][_0x3911('0x53')]){_0x5d83a6[_0x3911('0x54')]=[{'model':db[_0x3911('0x77')],'as':'Contact','required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x3911('0x3b'),_0x3911('0xc0'),_0x3911('0xc1')],'required':![]},{'model':db[_0x3911('0xc2')],'as':_0x3911('0xc3'),'attributes':['id',_0x3911('0x3b'),_0x3911('0xc4')],'where':_0x2bd5d6[_0x3911('0x43')][_0x3911('0xc5')]?{'id':_0x2bd5d6[_0x3911('0x43')][_0x3911('0xc5')]}:undefined,'required':_0x2bd5d6[_0x3911('0x43')][_0x3911('0xc5')]?!![]:![]}];}return db[_0x3911('0x9d')]['findAll'](_0x5d83a6);})['then'](function(_0x56ccb6){_0x2c23ca[_0x3911('0x56')]=_0x56ccb6;return _0x2c23ca;});}})[_0x3911('0x21')](respondWithFilteredResult(_0x2308ba,_0x5d83a6))[_0x3911('0x2a')](handleError(_0x2308ba,null));};exports[_0x3911('0x3c')]=function(_0x50e85f,_0x3f86a2,_0x1f475e){var _0x389a7d,_0x3d7bf8,_0x384838;if(_['isNil'](_0x50e85f['body']['body'])||_0x50e85f[_0x3911('0x5d')][_0x3911('0x5d')]===''){throw new db[(_0x3911('0x78'))][(_0x3911('0x79'))](_0x3911('0xc6'));}if(_[_0x3911('0x93')](_0x50e85f[_0x3911('0x5d')]['to'])){throw new db[(_0x3911('0x78'))]['ValidationError'](_0x3911('0xc7'));}_0x389a7d=_0x50e85f[_0x3911('0x5d')]['to'];return db[_0x3911('0x3f')][_0x3911('0x5b')]({'where':{'id':_0x50e85f[_0x3911('0x65')]['id']},'include':[{'model':db[_0x3911('0x97')],'as':_0x3911('0xc8'),'include':[{'model':db[_0x3911('0x77')],'as':_0x3911('0x98'),'where':{'mobile':_0x389a7d},'limit':0x1,'order':[[_0x3911('0x7c'),_0x3911('0x99')]]}]}]})['then'](handleEntityNotFound(_0x3f86a2,null))[_0x3911('0x21')](function(_0x30d2cc){if(_0x30d2cc&&_0x30d2cc[_0x3911('0xc8')]){_0x3d7bf8=_0x30d2cc[_0x3911('0x36')]({'plain':!![]});if(_0x3d7bf8[_0x3911('0xc8')]&&_0x3d7bf8[_0x3911('0xc8')][_0x3911('0x98')][_0x3911('0x5a')]){return _0x3d7bf8[_0x3911('0xc8')][_0x3911('0x98')][0x0];}return db[_0x3911('0x77')][_0x3911('0x5c')](_[_0x3911('0x9c')](_0x50e85f['body'],{'firstName':_0x389a7d,'mobile':_0x389a7d,'phone':_0x389a7d,'ListId':_0x3d7bf8[_0x3911('0x7e')]}));}})[_0x3911('0x21')](handleEntityNotFound(_0x3f86a2,null))['then'](function(_0x588257){if(_0x588257){_0x384838=_0x588257;return db['SmsInteraction'][_0x3911('0x5b')]({'where':{'ContactId':_0x384838['id'],'closed':![],'SmsAccountId':_0x3d7bf8['id']}})['then'](function(_0x17b75b){if(_0x17b75b){return[_0x17b75b,![]];}return db['SmsInteraction'][_0x3911('0x5c')]({'UserId':_0x50e85f[_0x3911('0x60')]['id'],'ContactId':_0x384838['id'],'SmsAccountId':_0x3d7bf8['id'],'phone':_0x389a7d,'firstMsgDirection':_0x3911('0xc9'),'Messages':[_[_0x3911('0x6b')](_0x50e85f[_0x3911('0x5d')],{'read':![],'body':_0x50e85f[_0x3911('0x5d')][_0x3911('0x5d')],'phone':_0x389a7d,'SmsAccountId':_0x3d7bf8['id'],'UserId':_0x50e85f[_0x3911('0x60')]['id'],'ContactId':_0x384838['id']})]},{'include':[{'model':db[_0x3911('0xa6')],'as':'Messages'}]})[_0x3911('0x21')](function(_0x14d9eb){return[_0x14d9eb,!![]];});});}})[_0x3911('0x9e')](function(_0x13c9d8,_0xdcdb7f){if(_0xdcdb7f){return _0x13c9d8;}return db['SmsMessage'][_0x3911('0x5c')](_[_0x3911('0x6b')](_0x50e85f[_0x3911('0x5d')],{'read':![],'body':_0x50e85f[_0x3911('0x5d')][_0x3911('0x5d')],'phone':_0x389a7d,'SmsAccountId':_0x3d7bf8['id'],'SmsInteractionId':_0x13c9d8['id'],'UserId':_0x50e85f[_0x3911('0x60')]['id'],'ContactId':_0x384838['id']}))[_0x3911('0x21')](function(_0x1ba3a7){_0x13c9d8[_0x3911('0xca')]['Messages']=[];_0x13c9d8[_0x3911('0xca')][_0x3911('0xcb')][_0x3911('0xa2')](_0x1ba3a7[_0x3911('0xca')]);return _0x13c9d8;});})[_0x3911('0x21')](respondWithResult(_0x3f86a2,null))[_0x3911('0x2a')](handleError(_0x3f86a2,null));};exports['status']=function(_0x2729b9,_0x35c18e,_0x243e7b){if(_0x2729b9[_0x3911('0x5d')]['id']){delete _0x2729b9['body']['id'];}var _0x41ce99,_0x169ccd,_0x468d80;return db[_0x3911('0x3f')][_0x3911('0x5b')]({'where':{'id':_0x2729b9[_0x3911('0x65')]['id']}})['then'](handleEntityNotFound(_0x35c18e,null))[_0x3911('0x21')](function(_0x210fa3){if(_0x210fa3){_0x468d80=_0x210fa3;logger[_0x3911('0xcc')](_0x3911('0x23'),'status',_0x3911('0xcd'),_0x210fa3[_0x3911('0x50')],util[_0x3911('0xce')](_0x2729b9[_0x3911('0x5d')],{'showHidden':![],'depth':null}));switch(_0x210fa3[_0x3911('0x50')]){case _0x3911('0x84'):if(_0x2729b9[_0x3911('0x5d')][_0x3911('0xcf')]&&_0x2729b9[_0x3911('0x5d')][_0x3911('0x2c')]){_0x169ccd=_0x2729b9[_0x3911('0x5d')][_0x3911('0x2c')];return db[_0x3911('0xa6')][_0x3911('0x5b')]({'where':{'messageId':_0x2729b9[_0x3911('0x5d')][_0x3911('0xcf')]}});}break;case'connectel':if(_0x2729b9['body'][_0x3911('0xd0')]&&_0x2729b9[_0x3911('0x5d')]['statusInt']){_0x169ccd=_0x2729b9[_0x3911('0x5d')][_0x3911('0xd1')];return db[_0x3911('0xa6')]['find']({'where':{'messageId':_0x2729b9[_0x3911('0x5d')][_0x3911('0xd0')]}});}break;case _0x3911('0x88'):if(_0x2729b9[_0x3911('0x5d')][_0x3911('0xd2')]&&_0x2729b9[_0x3911('0x5d')][_0x3911('0xd3')]){_0x169ccd=_0x2729b9[_0x3911('0x5d')][_0x3911('0xd3')];return db[_0x3911('0xa6')][_0x3911('0x5b')]({'where':{'messageId':_0x2729b9['body'][_0x3911('0xd2')]}});}break;case _0x3911('0xd4'):var _0x20edaf=_0x2729b9[_0x3911('0x5d')][_0x3911('0x8a')][0x0];if(_0x20edaf['messageId']&&_0x20edaf['status'][_0x3911('0xd5')]===_0x3911('0xd6')){_0x169ccd=_0x20edaf['status']['groupName'];return db[_0x3911('0xa6')]['find']({'where':{'messageId':_0x20edaf[_0x3911('0x82')]}});}break;case _0x3911('0x8d'):if(_0x2729b9[_0x3911('0x5d')][_0x3911('0x82')]&&_0x2729b9[_0x3911('0x5d')][_0x3911('0x2c')]){_0x169ccd=_0x2729b9[_0x3911('0x5d')][_0x3911('0x2c')];return db['SmsMessage'][_0x3911('0x5b')]({'where':{'messageId':_0x2729b9['body'][_0x3911('0x82')]}});}break;case _0x3911('0x90'):if(_0x2729b9['body'][0x0][_0x3911('0x27')]['id']){_0x169ccd=_0x2729b9[_0x3911('0x5d')][0x0][_0x3911('0x50')];return db[_0x3911('0xa6')][_0x3911('0x5b')]({'where':{'messageId':_0x2729b9['body'][0x0]['message']['id']}});}break;case _0x3911('0x91'):if(_0x2729b9[_0x3911('0x5d')]['redif']&&_0x2729b9[_0x3911('0x5d')][_0x3911('0x2c')]){_0x169ccd=_0x2729b9[_0x3911('0x5d')][_0x3911('0x2c')];return db['SmsMessage'][_0x3911('0x5b')]({'where':{'messageId':_0x2729b9[_0x3911('0x5d')][_0x3911('0xd7')]}});}break;}}})[_0x3911('0x21')](handleEntityNotFound(_0x35c18e,null))[_0x3911('0x21')](function(_0x10f7f0){if(_0x10f7f0){_0x41ce99=_0x10f7f0;switch(_0x468d80['type']){case'skebby':if(_0x169ccd===_0x3911('0xd6')){return _0x41ce99[_0x3911('0x35')]({'read':!![]});}else{logger['error'](_0x3911('0x23'),_0x3911('0x2c'),_0x3911('0x84'),util['inspect'](_0x2729b9[_0x3911('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x3911('0x86'):if(_0x169ccd==='1'){return _0x41ce99[_0x3911('0x35')]({'read':!![]});}else{logger[_0x3911('0x25')](_0x3911('0x23'),_0x3911('0x2c'),'skebby',util['inspect'](_0x2729b9[_0x3911('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x3911('0x88'):if(!_0x2729b9[_0x3911('0x5d')][_0x3911('0xd8')]&&_0x169ccd>=0xc8&&_0x169ccd<=0xce){return _0x41ce99['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3911('0x2c'),_0x3911('0x88'),util[_0x3911('0xce')](_0x2729b9[_0x3911('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x3911('0xd4'):var _0x2042de=_0x2729b9[_0x3911('0x5d')]['results'][0x0];if(_0x2042de[_0x3911('0x2c')][_0x3911('0xd5')]==='DELIVERED'){return _0x41ce99[_0x3911('0x35')]({'read':!![]});}else{logger[_0x3911('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3911('0x2c'),_0x3911('0xd4'),util['inspect'](_0x2729b9['body'],{'showHidden':![],'depth':null}));}break;case _0x3911('0x8d'):if(_0x169ccd==_0x3911('0xd9')||_0x169ccd==_0x3911('0xda')){return _0x41ce99[_0x3911('0x35')]({'read':!![]});}else{logger[_0x3911('0x25')](_0x3911('0x23'),_0x3911('0x2c'),'clickatell',util[_0x3911('0xce')](_0x2729b9[_0x3911('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x3911('0x90'):if(_0x169ccd==_0x3911('0xdb')){return _0x41ce99[_0x3911('0x35')]({'read':!![]});}else{logger[_0x3911('0x25')](_0x3911('0x23'),_0x3911('0x2c'),_0x3911('0x90'),util[_0x3911('0xce')](_0x2729b9[_0x3911('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x3911('0x91'):if(_0x169ccd===_0x3911('0xdc')||_0x169ccd===_0x3911('0xdd')){return _0x41ce99[_0x3911('0x35')]({'read':!![]});}else{logger[_0x3911('0x25')](_0x3911('0x23'),_0x3911('0x2c'),_0x3911('0x91'),util[_0x3911('0xce')](_0x2729b9[_0x3911('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x41ce99;}})[_0x3911('0x21')](respondWithResult(_0x35c18e,null))['catch'](handleError(_0x35c18e,null));};exports[_0x3911('0xde')]=function(_0x3e68e8,_0x2a3a89,_0x4f87fa){var _0x135754,_0x3d856f,_0x35297f;return db[_0x3911('0x3f')]['find']({'where':{'id':_0x3e68e8['params']['id']}})[_0x3911('0x21')](handleEntityNotFound(_0x2a3a89,null))[_0x3911('0x21')](function(_0x5e2df3){if(_0x5e2df3){_0x35297f=_0x5e2df3;logger[_0x3911('0xcc')](_0x3911('0x23'),_0x3911('0x2c'),_0x3911('0xcd'),_0x5e2df3[_0x3911('0x50')],util[_0x3911('0xce')](_0x3e68e8[_0x3911('0x43')],{'showHidden':![],'depth':null}));switch(_0x5e2df3[_0x3911('0x50')]){case _0x3911('0x8b'):if(_0x3e68e8[_0x3911('0x43')]['message-id']&&_0x3e68e8['query']['state']){_0x3d856f=_0x3e68e8['query']['state'];return db[_0x3911('0xa6')][_0x3911('0x5b')]({'where':{'messageId':_0x3e68e8[_0x3911('0x43')]['message-id']}});}break;}}})[_0x3911('0x21')](handleEntityNotFound(_0x2a3a89,null))['then'](function(_0x2c66){if(_0x2c66){_0x135754=_0x2c66;switch(_0x35297f['type']){case _0x3911('0x8b'):if(_0x3d856f==='2'||_0x3d856f==='6'){return _0x135754[_0x3911('0x35')]({'read':!![]});}else{logger[_0x3911('0x25')](_0x3911('0x23'),'status',_0x3911('0x8b'),util[_0x3911('0xce')](_0x3e68e8[_0x3911('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x135754;}})[_0x3911('0x21')](respondWithResult(_0x2a3a89,null))['catch'](handleError(_0x2a3a89,null));};exports[_0x3911('0xdf')]=function(_0x3910f8,_0x2f46eb,_0x4a1cfe){return db['SmsAccount'][_0x3911('0x5b')]({'where':{'id':_0x3910f8['params']['id']}})[_0x3911('0x21')](handleEntityNotFound(_0x2f46eb,null))[_0x3911('0x21')](function(_0x265654){if(_0x265654){return _0x265654[_0x3911('0xdf')](_0x3910f8[_0x3911('0x5d')][_0x3911('0x6d')],_[_0x3911('0x9b')](_0x3910f8[_0x3911('0x5d')],[_0x3911('0x6d'),'id'])||{})[_0x3911('0x9e')](function(_0x2e6682){for(var _0x496418=0x0;_0x496418<_0x3910f8[_0x3911('0x5d')][_0x3911('0x6d')][_0x3911('0x5a')];_0x496418+=0x1){socket[_0x3911('0xe0')](_0x3911('0xe1'),{'UserId':Number(_0x3910f8[_0x3911('0x5d')][_0x3911('0x6d')][_0x496418]),'SmsAccountId':Number(_0x3910f8[_0x3911('0x65')]['id'])});}return _0x2e6682;});}})[_0x3911('0x21')](respondWithResult(_0x2f46eb,null))[_0x3911('0x2a')](handleError(_0x2f46eb,null));};exports[_0x3911('0xe2')]=function(_0x1a6b21,_0x5592c2,_0x273d15){return db['SmsAccount']['find']({'where':{'id':_0x1a6b21[_0x3911('0x65')]['id']}})[_0x3911('0x21')](handleEntityNotFound(_0x5592c2,null))['then'](function(_0x22fff8){if(_0x22fff8){return _0x22fff8[_0x3911('0xe2')](_0x1a6b21[_0x3911('0x43')][_0x3911('0x6d')])['then'](function(){if(_[_0x3911('0xe3')](_0x1a6b21['query'][_0x3911('0x6d')])){for(var _0x3f5166=0x0;_0x3f5166<_0x1a6b21[_0x3911('0x43')]['ids'][_0x3911('0x5a')];_0x3f5166+=0x1){socket[_0x3911('0xe0')]('userSmsAccount:remove',{'UserId':Number(_0x1a6b21[_0x3911('0x43')][_0x3911('0x6d')][_0x3f5166]),'SmsAccountId':Number(_0x1a6b21[_0x3911('0x65')]['id'])});}}else{socket[_0x3911('0xe0')](_0x3911('0xe4'),{'UserId':Number(_0x1a6b21[_0x3911('0x43')][_0x3911('0x6d')]),'SmsAccountId':Number(_0x1a6b21['params']['id'])});}});}})[_0x3911('0x21')](respondWithStatusCode(_0x5592c2,null))[_0x3911('0x2a')](handleError(_0x5592c2,null));};exports[_0x3911('0xe5')]=function(_0x3d2e34,_0x1c531a,_0x546bd3){var _0x390c19={};var _0x4989c1={};var _0x194647;var _0x1f4dcf;return db['SmsAccount']['findOne']({'where':{'id':_0x3d2e34[_0x3911('0x65')]['id']}})[_0x3911('0x21')](handleEntityNotFound(_0x1c531a,null))[_0x3911('0x21')](function(_0x5d4d8a){if(_0x5d4d8a){_0x194647=_0x5d4d8a;_0x4989c1['model']=_[_0x3911('0x59')](db[_0x3911('0xa9')][_0x3911('0x40')]);_0x4989c1['query']=_[_0x3911('0x59')](_0x3d2e34['query']);_0x4989c1['filters']=_[_0x3911('0x45')](_0x4989c1[_0x3911('0x47')],_0x4989c1['query']);_0x390c19[_0x3911('0x46')]=_['intersection'](_0x4989c1[_0x3911('0x47')],qs[_0x3911('0x48')](_0x3d2e34[_0x3911('0x43')][_0x3911('0x48')]));_0x390c19[_0x3911('0x46')]=_0x390c19['attributes']['length']?_0x390c19[_0x3911('0x46')]:_0x4989c1['model'];_0x390c19['order']=qs[_0x3911('0x4c')](_0x3d2e34[_0x3911('0x43')]['sort']);_0x390c19['where']=qs[_0x3911('0x44')](_['pick'](_0x3d2e34[_0x3911('0x43')],_0x4989c1[_0x3911('0x44')]));if(_0x3d2e34[_0x3911('0x43')][_0x3911('0x4e')]){_0x390c19['where']=_['merge'](_0x390c19[_0x3911('0x4f')],{'$or':_[_0x3911('0x42')](_0x390c19[_0x3911('0x46')],function(_0x4ce396){var _0x1e5127={};_0x1e5127[_0x4ce396]={'$like':'%'+_0x3d2e34[_0x3911('0x43')]['filter']+'%'};return _0x1e5127;})});}_0x390c19=_['merge']({},_0x390c19,_0x3d2e34[_0x3911('0x52')]);return _0x194647[_0x3911('0xe5')](_0x390c19);}})[_0x3911('0x21')](function(_0x596168){if(_0x596168){_0x1f4dcf=_0x596168[_0x3911('0x5a')];if(!_0x3d2e34['query'][_0x3911('0x49')](_0x3911('0x4a'))){_0x390c19[_0x3911('0x30')]=qs[_0x3911('0x30')](_0x3d2e34['query'][_0x3911('0x30')]);_0x390c19[_0x3911('0x2e')]=qs[_0x3911('0x2e')](_0x3d2e34[_0x3911('0x43')][_0x3911('0x2e')]);}return _0x194647[_0x3911('0xe5')](_0x390c19);}})['then'](function(_0x1e9785){if(_0x1e9785){return _0x1e9785?{'count':_0x1f4dcf,'rows':_0x1e9785}:null;}})['then'](respondWithResult(_0x1c531a,null))[_0x3911('0x2a')](handleError(_0x1c531a,null));}; \ No newline at end of file +var _0xe170=['internal','Tags','tag','to\x20is\x20mandatory','CmList','List','out','SmsMessage','dataValues','Messages','inspect','skebby_dispatch_id','requestid','status_code','DELIVERED','groupName','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','emit','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','info','result','sendStatus','end','undefined','limit','count','offset','status','set','Content-Range','json','apply','update','destroy','get','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','type','key','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','merge','where','map','VIRTUAL','include','findAll','rows','catch','show','params','keys','length','includeAll','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','order','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','Body','messageId','skebby','sender','text','connectel','clicksend','message_id','plivo','From','Text','infobip','results','csc','originatingAddress','clickatell','fromNumber','bandwidth','intelepeer','refid','ValidationError','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','ListId','CmContact','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','autoclose','push','unmanaged','*,*,*,*','created','ContactId','AttachmentId','UserId','unshift','agent','Start','startRouting','SmsAccount,\x20%s,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','send','\x0a','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','User','Owner','fullname'];(function(_0x363759,_0x37f7da){var _0x3fd8df=function(_0x4ea8b9){while(--_0x4ea8b9){_0x363759['push'](_0x363759['shift']());}};_0x3fd8df(++_0x37f7da);}(_0xe170,0x1f2));var _0x0e17=function(_0x3d7365,_0x13ccfb){_0x3d7365=_0x3d7365-0x0;var _0x3d96ac=_0xe170[_0x3d7365];return _0x3d96ac;};'use strict';var emlformat=require(_0x0e17('0x0'));var rimraf=require(_0x0e17('0x1'));var zipdir=require(_0x0e17('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0e17('0x3'));var BPromise=require(_0x0e17('0x4'));var Mustache=require(_0x0e17('0x5'));var util=require(_0x0e17('0x6'));var path=require(_0x0e17('0x7'));var sox=require(_0x0e17('0x8'));var csv=require(_0x0e17('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e17('0xa'));var squel=require(_0x0e17('0xb'));var crypto=require(_0x0e17('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0e17('0xd'));var toCsv=require(_0x0e17('0x9'));var querystring=require(_0x0e17('0xe'));var Papa=require('papaparse');var Redis=require(_0x0e17('0xf'));var authService=require(_0x0e17('0x10'));var qs=require(_0x0e17('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0e17('0x12'))('api');var utils=require(_0x0e17('0x13'));var config=require(_0x0e17('0x14'));var licenseUtil=require(_0x0e17('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0e17('0x16')](config[_0x0e17('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x0e17('0x18'))(new Redis(config[_0x0e17('0x17')]));require(_0x0e17('0x19'))[_0x0e17('0x1a')](socket);var jayson=require(_0x0e17('0x1b'));var client=jayson[_0x0e17('0x1c')][_0x0e17('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x23c350,_0xdc7404,_0x30dce2,_0x442a9b){return new BPromise(function(_0x572ee5,_0x41188b){var _0x4fd3c9=_0x442a9b||client;return _0x4fd3c9[_0x0e17('0x1e')](_0x23c350,_0x30dce2)[_0x0e17('0x1f')](function(_0x1d6d3d){logger['info']('SmsAccount,\x20%s,\x20%s',_0xdc7404,'request\x20sent');logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xdc7404,_0x0e17('0x20'),JSON[_0x0e17('0x21')](_0x1d6d3d));if(_0x1d6d3d[_0x0e17('0x22')]){if(_0x1d6d3d[_0x0e17('0x22')][_0x0e17('0x23')]===0x1f4){logger[_0x0e17('0x22')](_0x0e17('0x24'),_0xdc7404,_0x1d6d3d[_0x0e17('0x22')][_0x0e17('0x25')]);return _0x41188b(_0x1d6d3d[_0x0e17('0x22')]['message']);}logger['error'](_0x0e17('0x24'),_0xdc7404,_0x1d6d3d[_0x0e17('0x22')][_0x0e17('0x25')]);return _0x572ee5(_0x1d6d3d['error']['message']);}else{logger[_0x0e17('0x26')](_0x0e17('0x24'),_0xdc7404,_0x0e17('0x20'));_0x572ee5(_0x1d6d3d[_0x0e17('0x27')][_0x0e17('0x25')]);}})['catch'](function(_0x7d81f7){logger[_0x0e17('0x22')]('SmsAccount,\x20%s,\x20%s',_0xdc7404,_0x7d81f7);_0x41188b(_0x7d81f7);});});}function respondWithStatusCode(_0x177c98,_0x3a3a2b){_0x3a3a2b=_0x3a3a2b||0xcc;return function(_0x1d84e1){if(_0x1d84e1){return _0x177c98[_0x0e17('0x28')](_0x3a3a2b);}return _0x177c98['status'](_0x3a3a2b)[_0x0e17('0x29')]();};}function respondWithResult(_0x3e7726,_0x5ae0ee){_0x5ae0ee=_0x5ae0ee||0xc8;return function(_0x3ef666){if(_0x3ef666){return _0x3e7726['status'](_0x5ae0ee)['json'](_0x3ef666);}};}function respondWithFilteredResult(_0x5558db,_0x35099e){return function(_0x261c13){if(_0x261c13){var _0x276f13=typeof _0x35099e['offset']===_0x0e17('0x2a')&&typeof _0x35099e[_0x0e17('0x2b')]===_0x0e17('0x2a');var _0x4df9d0=_0x261c13[_0x0e17('0x2c')];var _0x376dd0=_0x276f13?0x0:_0x35099e[_0x0e17('0x2d')];var _0x2f1552=_0x276f13?_0x261c13[_0x0e17('0x2c')]:_0x35099e[_0x0e17('0x2d')]+_0x35099e['limit'];var _0x5848b2;if(_0x2f1552>=_0x4df9d0){_0x2f1552=_0x4df9d0;_0x5848b2=0xc8;}else{_0x5848b2=0xce;}_0x5558db[_0x0e17('0x2e')](_0x5848b2);return _0x5558db[_0x0e17('0x2f')](_0x0e17('0x30'),_0x376dd0+'-'+_0x2f1552+'/'+_0x4df9d0)[_0x0e17('0x31')](_0x261c13);}return null;};}function patchUpdates(_0x2418d0){return function(_0xbe44f2){try{jsonpatch[_0x0e17('0x32')](_0xbe44f2,_0x2418d0,!![]);}catch(_0xbb9f66){return BPromise['reject'](_0xbb9f66);}return _0xbe44f2['save']();};}function saveUpdates(_0x5d9adb,_0x1fc22d){return function(_0x3c8a3e){if(_0x3c8a3e){return _0x3c8a3e[_0x0e17('0x33')](_0x5d9adb)['then'](function(_0x58ccfc){return _0x58ccfc;});}return null;};}function removeEntity(_0x1eb4f4,_0x524c2a){return function(_0x36833b){if(_0x36833b){return _0x36833b[_0x0e17('0x34')]()[_0x0e17('0x1f')](function(){var _0x585208=_0x36833b[_0x0e17('0x35')]({'plain':!![]});var _0x204a2e='SmsAccounts';return db[_0x0e17('0x36')][_0x0e17('0x34')]({'where':{'type':_0x204a2e,'resourceId':_0x585208['id']}})[_0x0e17('0x1f')](function(){return _0x36833b;});})[_0x0e17('0x1f')](function(){_0x1eb4f4[_0x0e17('0x2e')](0xcc)[_0x0e17('0x29')]();});}};}function handleEntityNotFound(_0x3ad92c,_0x1fb794){return function(_0x4148ea){if(!_0x4148ea){_0x3ad92c[_0x0e17('0x28')](0x194);}return _0x4148ea;};}function handleError(_0x97e12f,_0x4b15b4){_0x4b15b4=_0x4b15b4||0x1f4;return function(_0x4a7f9b){logger[_0x0e17('0x22')](_0x4a7f9b[_0x0e17('0x37')]);if(_0x4a7f9b[_0x0e17('0x38')]){delete _0x4a7f9b[_0x0e17('0x38')];}_0x97e12f[_0x0e17('0x2e')](_0x4b15b4)['send'](_0x4a7f9b);};}exports[_0x0e17('0x39')]=function(_0x1f3a4e,_0x481c3a){var _0x1f42b4={'include':[{'model':db[_0x0e17('0x3a')],'as':_0x0e17('0x3b')}]},_0x1aee63={},_0x4f887e={'count':0x0,'rows':[]};var _0x4bde5a=_['map'](db[_0x0e17('0x3c')][_0x0e17('0x3d')],function(_0x4a1750){return{'name':_0x4a1750['fieldName'],'type':_0x4a1750[_0x0e17('0x3e')][_0x0e17('0x3f')]};});_0x1aee63['model']=_['map'](_0x4bde5a,_0x0e17('0x38'));_0x1aee63[_0x0e17('0x40')]=_['keys'](_0x1f3a4e[_0x0e17('0x40')]);_0x1aee63['filters']=_[_0x0e17('0x41')](_0x1aee63[_0x0e17('0x42')],_0x1aee63[_0x0e17('0x40')]);_0x1f42b4[_0x0e17('0x43')]=_[_0x0e17('0x41')](_0x1aee63[_0x0e17('0x42')],qs[_0x0e17('0x44')](_0x1f3a4e[_0x0e17('0x40')][_0x0e17('0x44')]));_0x1f42b4[_0x0e17('0x43')]=_0x1f42b4['attributes']['length']?_0x1f42b4[_0x0e17('0x43')]:_0x1aee63[_0x0e17('0x42')];if(!_0x1f3a4e[_0x0e17('0x40')][_0x0e17('0x45')](_0x0e17('0x46'))){_0x1f42b4[_0x0e17('0x2b')]=qs[_0x0e17('0x2b')](_0x1f3a4e[_0x0e17('0x40')][_0x0e17('0x2b')]);_0x1f42b4[_0x0e17('0x2d')]=qs['offset'](_0x1f3a4e[_0x0e17('0x40')][_0x0e17('0x2d')]);}_0x1f42b4['order']=qs[_0x0e17('0x47')](_0x1f3a4e['query'][_0x0e17('0x47')]);_0x1f42b4['where']=qs[_0x0e17('0x48')](_[_0x0e17('0x49')](_0x1f3a4e[_0x0e17('0x40')],_0x1aee63[_0x0e17('0x48')]),_0x4bde5a);if(_0x1f3a4e['query'][_0x0e17('0x4a')]){_0x1f42b4['where']=_[_0x0e17('0x4b')](_0x1f42b4[_0x0e17('0x4c')],{'$or':_[_0x0e17('0x4d')](_0x4bde5a,function(_0x1b5387){if(_0x1b5387[_0x0e17('0x3e')]!==_0x0e17('0x4e')){var _0x4ee775={};_0x4ee775[_0x1b5387[_0x0e17('0x38')]]={'$like':'%'+_0x1f3a4e[_0x0e17('0x40')][_0x0e17('0x4a')]+'%'};return _0x4ee775;}})});}_0x1f42b4=_[_0x0e17('0x4b')]({},_0x1f42b4,_0x1f3a4e['options']);var _0x38183f={'where':_0x1f42b4[_0x0e17('0x4c')]};return db[_0x0e17('0x3c')][_0x0e17('0x2c')](_0x38183f)['then'](function(_0x25a76d){_0x4f887e['count']=_0x25a76d;if(_0x1f3a4e[_0x0e17('0x40')]['includeAll']){_0x1f42b4[_0x0e17('0x4f')]=[{'all':!![]}];}return db[_0x0e17('0x3c')][_0x0e17('0x50')](_0x1f42b4);})[_0x0e17('0x1f')](function(_0xed01a1){_0x4f887e[_0x0e17('0x51')]=_0xed01a1;return _0x4f887e;})[_0x0e17('0x1f')](respondWithFilteredResult(_0x481c3a,_0x1f42b4))[_0x0e17('0x52')](handleError(_0x481c3a,null));};exports[_0x0e17('0x53')]=function(_0x5e0df5,_0x163e42){var _0x3c0db0={'raw':![],'where':{'id':_0x5e0df5[_0x0e17('0x54')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x24f649={};_0x24f649[_0x0e17('0x42')]=_[_0x0e17('0x55')](db[_0x0e17('0x3c')]['rawAttributes']);_0x24f649['query']=_[_0x0e17('0x55')](_0x5e0df5[_0x0e17('0x40')]);_0x24f649[_0x0e17('0x48')]=_[_0x0e17('0x41')](_0x24f649[_0x0e17('0x42')],_0x24f649[_0x0e17('0x40')]);_0x3c0db0[_0x0e17('0x43')]=_[_0x0e17('0x41')](_0x24f649[_0x0e17('0x42')],qs['fields'](_0x5e0df5[_0x0e17('0x40')][_0x0e17('0x44')]));_0x3c0db0[_0x0e17('0x43')]=_0x3c0db0[_0x0e17('0x43')][_0x0e17('0x56')]?_0x3c0db0[_0x0e17('0x43')]:_0x24f649[_0x0e17('0x42')];if(_0x5e0df5[_0x0e17('0x40')][_0x0e17('0x57')]){_0x3c0db0[_0x0e17('0x4f')]=[{'all':!![]}];}_0x3c0db0=_[_0x0e17('0x4b')]({},_0x3c0db0,_0x5e0df5[_0x0e17('0x58')]);return db[_0x0e17('0x3c')][_0x0e17('0x59')](_0x3c0db0)[_0x0e17('0x1f')](handleEntityNotFound(_0x163e42,null))[_0x0e17('0x1f')](respondWithResult(_0x163e42,null))['catch'](handleError(_0x163e42,null));};exports[_0x0e17('0x5a')]=function(_0x1754c8,_0x16e074){return db[_0x0e17('0x3c')][_0x0e17('0x5a')](_0x1754c8['body'],{})[_0x0e17('0x1f')](function(_0x439052){var _0x195982=_0x1754c8[_0x0e17('0x5b')][_0x0e17('0x35')]({'plain':!![]});if(!_0x195982)throw new Error(_0x0e17('0x5c'));if(_0x195982[_0x0e17('0x5d')]==='user'){var _0x510e2b=_0x439052[_0x0e17('0x35')]({'plain':!![]});var _0x31940b=_0x0e17('0x5e');return db[_0x0e17('0x5f')][_0x0e17('0x59')]({'where':{'name':_0x31940b,'userProfileId':_0x195982[_0x0e17('0x60')]},'raw':!![]})[_0x0e17('0x1f')](function(_0x7e2a83){if(_0x7e2a83&&_0x7e2a83[_0x0e17('0x61')]===0x0){return db['UserProfileResource'][_0x0e17('0x5a')]({'name':_0x510e2b[_0x0e17('0x38')],'resourceId':_0x510e2b['id'],'type':_0x7e2a83[_0x0e17('0x38')],'sectionId':_0x7e2a83['id']},{})[_0x0e17('0x1f')](function(){return _0x439052;});}else{return _0x439052;}})['catch'](function(_0x54c7f8){logger['error'](_0x0e17('0x62'),_0x54c7f8);throw _0x54c7f8;});}return _0x439052;})[_0x0e17('0x1f')](respondWithResult(_0x16e074,0xc9))[_0x0e17('0x52')](handleError(_0x16e074,null));};exports[_0x0e17('0x33')]=function(_0x19445c,_0x2feb85){if(_0x19445c['body']['id']){delete _0x19445c[_0x0e17('0x63')]['id'];}return db[_0x0e17('0x3c')][_0x0e17('0x59')]({'where':{'id':_0x19445c[_0x0e17('0x54')]['id']},'include':[{'model':db[_0x0e17('0x3a')],'as':_0x0e17('0x3b')}]})['then'](handleEntityNotFound(_0x2feb85,null))[_0x0e17('0x1f')](saveUpdates(_0x19445c['body'],null))[_0x0e17('0x1f')](respondWithResult(_0x2feb85,null))[_0x0e17('0x52')](handleError(_0x2feb85,null));};exports['destroy']=function(_0x5c0882,_0x14ce4a){return db['SmsAccount'][_0x0e17('0x59')]({'where':{'id':_0x5c0882[_0x0e17('0x54')]['id']}})[_0x0e17('0x1f')](handleEntityNotFound(_0x14ce4a,null))[_0x0e17('0x1f')](removeEntity(_0x14ce4a,null))[_0x0e17('0x52')](handleError(_0x14ce4a,null));};exports['describe']=function(_0x43c7d3,_0x507dba){return db[_0x0e17('0x3c')][_0x0e17('0x64')]()[_0x0e17('0x1f')](respondWithResult(_0x507dba,null))[_0x0e17('0x52')](handleError(_0x507dba,null));};exports[_0x0e17('0x65')]=function(_0x26ad35,_0x453933,_0x17c3c1){if(_0x26ad35[_0x0e17('0x63')]['id']){delete _0x26ad35[_0x0e17('0x63')]['id'];}return db[_0x0e17('0x3c')][_0x0e17('0x59')]({'where':{'id':_0x26ad35[_0x0e17('0x54')]['id']}})['then'](handleEntityNotFound(_0x453933,null))[_0x0e17('0x1f')](function(_0x12a799){if(_0x12a799){_0x26ad35[_0x0e17('0x63')][_0x0e17('0x66')]=_0x12a799['id'];return db[_0x0e17('0x67')][_0x0e17('0x5a')](_0x26ad35[_0x0e17('0x63')]);}})[_0x0e17('0x1f')](respondWithResult(_0x453933,null))[_0x0e17('0x52')](handleError(_0x453933,null));};exports[_0x0e17('0x68')]=function(_0x366e42,_0xdcbdda,_0x535594){var _0x5171f3={'raw':![],'where':{}};var _0xc27117={};var _0x42a26d={'count':0x0,'rows':[]};return db[_0x0e17('0x3c')][_0x0e17('0x69')]({'where':{'id':_0x366e42[_0x0e17('0x54')]['id']}})[_0x0e17('0x1f')](handleEntityNotFound(_0xdcbdda,null))[_0x0e17('0x1f')](function(_0x430ec5){if(_0x430ec5){_0xc27117['model']=_[_0x0e17('0x55')](db[_0x0e17('0x67')][_0x0e17('0x3d')]);_0xc27117[_0x0e17('0x40')]=_[_0x0e17('0x55')](_0x366e42[_0x0e17('0x40')]);_0xc27117[_0x0e17('0x48')]=_[_0x0e17('0x41')](_0xc27117[_0x0e17('0x42')],_0xc27117[_0x0e17('0x40')]);_0x5171f3[_0x0e17('0x43')]=_[_0x0e17('0x41')](_0xc27117[_0x0e17('0x42')],qs[_0x0e17('0x44')](_0x366e42['query'][_0x0e17('0x44')]));_0x5171f3[_0x0e17('0x43')]=_0x5171f3[_0x0e17('0x43')]['length']?_0x5171f3[_0x0e17('0x43')]:_0xc27117['model'];if(!_0x366e42[_0x0e17('0x40')][_0x0e17('0x45')](_0x0e17('0x46'))){_0x5171f3['limit']=qs[_0x0e17('0x2b')](_0x366e42[_0x0e17('0x40')][_0x0e17('0x2b')]);_0x5171f3[_0x0e17('0x2d')]=qs[_0x0e17('0x2d')](_0x366e42['query'][_0x0e17('0x2d')]);}_0x5171f3[_0x0e17('0x6a')]=qs[_0x0e17('0x47')](_0x366e42['query'][_0x0e17('0x47')]);_0x5171f3[_0x0e17('0x4c')]=qs[_0x0e17('0x48')](_[_0x0e17('0x49')](_0x366e42[_0x0e17('0x40')],_0xc27117['filters']));_0x5171f3[_0x0e17('0x4c')][_0x0e17('0x66')]=_0x430ec5['id'];if(_0x366e42['query']['filter']){_0x5171f3[_0x0e17('0x4c')]=_[_0x0e17('0x4b')](_0x5171f3[_0x0e17('0x4c')],{'$or':_[_0x0e17('0x4d')](_0x5171f3[_0x0e17('0x43')],function(_0x2ff7b0){var _0x14125f={};_0x14125f[_0x2ff7b0]={'$like':'%'+_0x366e42[_0x0e17('0x40')][_0x0e17('0x4a')]+'%'};return _0x14125f;})});}_0x5171f3=_[_0x0e17('0x4b')]({},_0x5171f3,_0x366e42[_0x0e17('0x58')]);return db[_0x0e17('0x67')][_0x0e17('0x2c')]({'where':_0x5171f3['where']})[_0x0e17('0x1f')](function(_0x4e5c9c){_0x42a26d['count']=_0x4e5c9c;if(_0x366e42['query']['includeAll']){_0x5171f3[_0x0e17('0x4f')]=[{'all':!![]}];}return db[_0x0e17('0x67')][_0x0e17('0x50')](_0x5171f3);})[_0x0e17('0x1f')](function(_0x3ac68a){_0x42a26d[_0x0e17('0x51')]=_0x3ac68a;return _0x42a26d;});}})[_0x0e17('0x1f')](respondWithFilteredResult(_0xdcbdda,_0x5171f3))['catch'](handleError(_0xdcbdda,null));};exports[_0x0e17('0x6b')]=function(_0x5b4a4e,_0x32a294,_0x1934aa){return db[_0x0e17('0x3c')][_0x0e17('0x59')]({'where':{'id':_0x5b4a4e[_0x0e17('0x54')]['id']}})['then'](handleEntityNotFound(_0x32a294,null))[_0x0e17('0x1f')](function(_0x4a0b10){if(_0x4a0b10){return _0x4a0b10['removeDispositions'](_0x5b4a4e[_0x0e17('0x40')][_0x0e17('0x6c')]);}})['then'](respondWithStatusCode(_0x32a294,null))['catch'](handleError(_0x32a294,null));};exports[_0x0e17('0x6d')]=function(_0x69b672,_0x25f47d,_0x2715a3){if(_0x69b672['body']['id']){delete _0x69b672['body']['id'];}return db[_0x0e17('0x3c')][_0x0e17('0x59')]({'where':{'id':_0x69b672['params']['id']}})[_0x0e17('0x1f')](handleEntityNotFound(_0x25f47d,null))['then'](function(_0x525c86){if(_0x525c86){_0x69b672[_0x0e17('0x63')][_0x0e17('0x66')]=_0x525c86['id'];return db[_0x0e17('0x6e')]['create'](_0x69b672[_0x0e17('0x63')]);}})['then'](respondWithResult(_0x25f47d,null))[_0x0e17('0x52')](handleError(_0x25f47d,null));};exports[_0x0e17('0x6f')]=function(_0x40a49f,_0x38bb14,_0x2f379a){var _0x586d40={'raw':![],'where':{}};var _0x4bde4d={};var _0x355a39={'count':0x0,'rows':[]};return db['SmsAccount'][_0x0e17('0x69')]({'where':{'id':_0x40a49f[_0x0e17('0x54')]['id']}})[_0x0e17('0x1f')](handleEntityNotFound(_0x38bb14,null))[_0x0e17('0x1f')](function(_0x11ff95){if(_0x11ff95){_0x4bde4d[_0x0e17('0x42')]=_[_0x0e17('0x55')](db[_0x0e17('0x6e')][_0x0e17('0x3d')]);_0x4bde4d[_0x0e17('0x40')]=_[_0x0e17('0x55')](_0x40a49f[_0x0e17('0x40')]);_0x4bde4d[_0x0e17('0x48')]=_[_0x0e17('0x41')](_0x4bde4d[_0x0e17('0x42')],_0x4bde4d['query']);_0x586d40['attributes']=_[_0x0e17('0x41')](_0x4bde4d[_0x0e17('0x42')],qs[_0x0e17('0x44')](_0x40a49f[_0x0e17('0x40')]['fields']));_0x586d40[_0x0e17('0x43')]=_0x586d40[_0x0e17('0x43')]['length']?_0x586d40[_0x0e17('0x43')]:_0x4bde4d['model'];if(!_0x40a49f[_0x0e17('0x40')][_0x0e17('0x45')](_0x0e17('0x46'))){_0x586d40[_0x0e17('0x2b')]=qs[_0x0e17('0x2b')](_0x40a49f[_0x0e17('0x40')][_0x0e17('0x2b')]);_0x586d40[_0x0e17('0x2d')]=qs[_0x0e17('0x2d')](_0x40a49f[_0x0e17('0x40')][_0x0e17('0x2d')]);}_0x586d40[_0x0e17('0x6a')]=qs[_0x0e17('0x47')](_0x40a49f[_0x0e17('0x40')][_0x0e17('0x47')]);_0x586d40['where']=qs[_0x0e17('0x48')](_[_0x0e17('0x49')](_0x40a49f[_0x0e17('0x40')],_0x4bde4d['filters']));_0x586d40[_0x0e17('0x4c')][_0x0e17('0x66')]=_0x11ff95['id'];if(_0x40a49f[_0x0e17('0x40')][_0x0e17('0x4a')]){_0x586d40[_0x0e17('0x4c')]=_[_0x0e17('0x4b')](_0x586d40[_0x0e17('0x4c')],{'$or':_['map'](_0x586d40[_0x0e17('0x43')],function(_0x402354){var _0x9c416e={};_0x9c416e[_0x402354]={'$like':'%'+_0x40a49f[_0x0e17('0x40')][_0x0e17('0x4a')]+'%'};return _0x9c416e;})});}_0x586d40=_['merge']({},_0x586d40,_0x40a49f[_0x0e17('0x58')]);return db['CannedAnswer']['count']({'where':_0x586d40[_0x0e17('0x4c')]})['then'](function(_0x2eaeec){_0x355a39[_0x0e17('0x2c')]=_0x2eaeec;if(_0x40a49f[_0x0e17('0x40')]['includeAll']){_0x586d40[_0x0e17('0x4f')]=[{'all':!![]}];}return db[_0x0e17('0x6e')][_0x0e17('0x50')](_0x586d40);})[_0x0e17('0x1f')](function(_0x383c58){_0x355a39[_0x0e17('0x51')]=_0x383c58;return _0x355a39;});}})[_0x0e17('0x1f')](respondWithFilteredResult(_0x38bb14,_0x586d40))['catch'](handleError(_0x38bb14,null));};exports[_0x0e17('0x70')]=function(_0x24f463,_0x57d556,_0x20d760){return db[_0x0e17('0x3c')][_0x0e17('0x59')]({'where':{'id':_0x24f463[_0x0e17('0x54')]['id']}})[_0x0e17('0x1f')](handleEntityNotFound(_0x57d556,null))[_0x0e17('0x1f')](function(_0x1f599d){if(_0x1f599d){return _0x1f599d['removeAnswers'](_0x24f463[_0x0e17('0x40')][_0x0e17('0x6c')]);}})[_0x0e17('0x1f')](respondWithStatusCode(_0x57d556,null))[_0x0e17('0x52')](handleError(_0x57d556,null));};exports[_0x0e17('0x71')]=function(_0x18a485,_0x507410,_0x13c518){var _0x7c2bf5={'channel':_0x0e17('0x72')};var _0x532acd=[];var _0x195831=[];var _0x1228af={};return db[_0x0e17('0x3c')][_0x0e17('0x59')]({'where':{'id':_0x18a485[_0x0e17('0x54')]['id']},'include':[{'model':db[_0x0e17('0x73')],'as':_0x0e17('0x74')}]})[_0x0e17('0x1f')](handleEntityNotFound(_0x507410,null))[_0x0e17('0x1f')](function(_0x2199b8){_0x7c2bf5[_0x0e17('0x75')]=_0x2199b8;_0x7c2bf5[_0x0e17('0x76')]=_[_0x0e17('0x77')](_0x2199b8['Applications'],[_0x0e17('0x78')],[_0x0e17('0x79')]);if(_0x7c2bf5[_0x0e17('0x75')][_0x0e17('0x74')]){delete _0x7c2bf5[_0x0e17('0x75')][_0x0e17('0x74')];}return db['CmContact'][_0x0e17('0x64')]();})[_0x0e17('0x1f')](function(_0x3d03cb){if(!_0x3d03cb){throw new db[(_0x0e17('0x7a'))]['ValidationError'](_0x0e17('0x7b'));}_0x532acd=_[_0x0e17('0x7c')](_['keys'](_0x3d03cb),[_0x0e17('0x7d'),'updatedAt']);_0x195831=_[_0x0e17('0x7c')](_[_0x0e17('0x55')](_0x3d03cb),[_0x0e17('0x7d'),_0x0e17('0x7e'),_0x0e17('0x7f'),'ListId']);_0x7c2bf5['body']={'mapKey':_0x0e17('0x80')};if(_0x7c2bf5[_0x0e17('0x75')][_0x0e17('0x3e')]){switch(_0x7c2bf5['account'][_0x0e17('0x3e')]){case _0x0e17('0x81'):_0x7c2bf5[_0x0e17('0x63')][_0x0e17('0x82')]=_0x18a485[_0x0e17('0x63')]['From'];_0x7c2bf5['body'][_0x0e17('0x63')]=_0x18a485[_0x0e17('0x63')][_0x0e17('0x83')];_0x7c2bf5['body'][_0x0e17('0x84')]=_0x18a485['body']['MessageSid'];break;case _0x0e17('0x85'):_0x7c2bf5['body']['from']='+'+_0x18a485[_0x0e17('0x63')][_0x0e17('0x86')];_0x7c2bf5['body'][_0x0e17('0x63')]=_0x18a485[_0x0e17('0x63')][_0x0e17('0x87')];break;case _0x0e17('0x88'):_0x7c2bf5[_0x0e17('0x63')][_0x0e17('0x82')]=_0x18a485['body'][_0x0e17('0x82')];_0x7c2bf5[_0x0e17('0x63')]['body']=_0x18a485['body']['message'];break;case _0x0e17('0x89'):_0x7c2bf5[_0x0e17('0x63')]['from']=_0x18a485[_0x0e17('0x63')][_0x0e17('0x82')];_0x7c2bf5[_0x0e17('0x63')][_0x0e17('0x63')]=_0x18a485[_0x0e17('0x63')][_0x0e17('0x63')];_0x7c2bf5[_0x0e17('0x63')]['messageId']=_0x18a485[_0x0e17('0x63')][_0x0e17('0x8a')];break;case _0x0e17('0x8b'):_0x7c2bf5[_0x0e17('0x63')][_0x0e17('0x82')]=_0x18a485[_0x0e17('0x63')][_0x0e17('0x8c')];_0x7c2bf5[_0x0e17('0x63')][_0x0e17('0x63')]=_0x18a485[_0x0e17('0x63')][_0x0e17('0x8d')];_0x7c2bf5[_0x0e17('0x63')][_0x0e17('0x84')]=_0x18a485['body']['MessageUUID'];break;case _0x0e17('0x8e'):_0x7c2bf5['body']['from']='+'+_0x18a485[_0x0e17('0x63')][_0x0e17('0x8f')][0x0][_0x0e17('0x82')];_0x7c2bf5[_0x0e17('0x63')][_0x0e17('0x63')]=_0x18a485[_0x0e17('0x63')][_0x0e17('0x8f')][0x0][_0x0e17('0x87')];_0x7c2bf5[_0x0e17('0x63')][_0x0e17('0x84')]=_0x18a485[_0x0e17('0x63')][_0x0e17('0x8f')][0x0][_0x0e17('0x84')];break;case _0x0e17('0x90'):_0x7c2bf5[_0x0e17('0x63')]['from']=_0x18a485[_0x0e17('0x63')][_0x0e17('0x91')];_0x7c2bf5[_0x0e17('0x63')][_0x0e17('0x63')]=_0x18a485[_0x0e17('0x63')]['segmentedMessage']['message'];break;case _0x0e17('0x92'):_0x7c2bf5[_0x0e17('0x63')]['from']=_0x18a485[_0x0e17('0x63')][_0x0e17('0x93')];_0x7c2bf5[_0x0e17('0x63')][_0x0e17('0x63')]=_0x18a485[_0x0e17('0x63')][_0x0e17('0x87')];_0x7c2bf5['body'][_0x0e17('0x84')]=_0x18a485['body']['replyMessageId'];break;case _0x0e17('0x94'):_0x7c2bf5[_0x0e17('0x63')]['messageId']=_0x18a485[_0x0e17('0x63')][0x0][_0x0e17('0x25')]['id'];_0x7c2bf5[_0x0e17('0x63')][_0x0e17('0x82')]=_0x18a485['body'][0x0]['message'][_0x0e17('0x82')];_0x7c2bf5[_0x0e17('0x63')][_0x0e17('0x63')]=_0x18a485['body'][0x0][_0x0e17('0x25')][_0x0e17('0x87')];break;case _0x0e17('0x95'):_0x7c2bf5[_0x0e17('0x63')][_0x0e17('0x82')]=_0x18a485[_0x0e17('0x63')][_0x0e17('0x82')];_0x7c2bf5[_0x0e17('0x63')]['body']=_0x18a485[_0x0e17('0x63')][_0x0e17('0x25')];_0x7c2bf5[_0x0e17('0x63')]['messageId']=_0x18a485[_0x0e17('0x63')][_0x0e17('0x96')];break;}}if(_0x7c2bf5[_0x0e17('0x63')]['id']){delete _0x7c2bf5[_0x0e17('0x63')]['id'];}if(_['isNil'](_0x7c2bf5['body']['from'])){throw new db[(_0x0e17('0x7a'))][(_0x0e17('0x97'))](_0x0e17('0x98'));}if(_[_0x0e17('0x99')](_0x7c2bf5[_0x0e17('0x63')]['body'])||_0x7c2bf5[_0x0e17('0x63')]['body']===''){throw new db[(_0x0e17('0x7a'))][(_0x0e17('0x97'))](_0x0e17('0x9a'));}if(_[_0x0e17('0x99')](_0x7c2bf5['body'][_0x0e17('0x9b')])){throw new db[(_0x0e17('0x7a'))][(_0x0e17('0x97'))](_0x0e17('0x9c')+_0x195831);}if(!_[_0x0e17('0x9d')](_0x195831,_0x7c2bf5['body'][_0x0e17('0x9b')])){throw new db['Sequelize'][(_0x0e17('0x97'))](_0x0e17('0x9e')+_0x195831);}_0x1228af[_0x7c2bf5['body'][_0x0e17('0x9b')]]=_0x7c2bf5[_0x0e17('0x63')]['from'];return db['CmList'][_0x0e17('0x59')]({'where':{'id':_0x7c2bf5[_0x0e17('0x75')][_0x0e17('0x9f')]},'include':[{'model':db[_0x0e17('0xa0')],'as':_0x0e17('0xa1'),'where':_0x1228af,'limit':0x1,'order':[['updatedAt',_0x0e17('0xa2')]]}]});})[_0x0e17('0x1f')](handleEntityNotFound(_0x507410,null))[_0x0e17('0x1f')](function(_0x1cbf33){if(_0x1cbf33){_0x7c2bf5[_0x0e17('0xa3')]=_[_0x0e17('0xa4')](_0x1cbf33,[_0x0e17('0xa1')]);if(_0x1cbf33['Contacts']['length']){return _0x1cbf33[_0x0e17('0xa1')][0x0];}var _0x330429=_[_0x0e17('0x16')](_0x7c2bf5[_0x0e17('0x63')],{'firstName':_0x7c2bf5[_0x0e17('0x63')]['from'],'ListId':_0x1cbf33['id']});_0x330429[_0x7c2bf5['body'][_0x0e17('0x9b')]]=_0x7c2bf5[_0x0e17('0x63')][_0x0e17('0x82')];return db['CmContact'][_0x0e17('0x5a')](_0x330429,{'fields':_0x532acd,'raw':!![]});}})['then'](handleEntityNotFound(_0x507410,null))[_0x0e17('0x1f')](function(_0x4a722f){if(_0x4a722f){_0x7c2bf5[_0x0e17('0xa5')]=_0x4a722f;var _0x397989={'ContactId':_0x4a722f['id'],'phone':_0x7c2bf5[_0x0e17('0x63')][_0x0e17('0x82')],'SmsAccountId':_0x18a485[_0x0e17('0x54')]['id']};var _0x25960d={'ContactId':_0x4a722f['id'],'SmsAccountId':_0x18a485['params']['id'],'closed':![]};return db[_0x0e17('0xa6')][_0x0e17('0x59')]({'where':_0x25960d})['then'](function(_0x403fa0){if(_0x403fa0){return[_0x403fa0,![]];}return db[_0x0e17('0xa6')][_0x0e17('0x5a')](_0x397989)[_0x0e17('0x1f')](function(_0x1b0252){return[_0x1b0252,!![]];});});}})[_0x0e17('0xa7')](function(_0x5da057,_0x303495){_0x7c2bf5['interaction']=_0x5da057['get']({'plain':!![]});_0x7c2bf5[_0x0e17('0xa8')]['created']=![];if(_0x303495){if(_0x7c2bf5[_0x0e17('0x75')][_0x0e17('0xa9')]){_0x7c2bf5['applications'][_0x0e17('0xaa')]({'id':0x0,'priority':_0x7c2bf5[_0x0e17('0x76')]['length']+0x1,'app':'close','appdata':_0x0e17('0xab'),'interval':_0x0e17('0xac')});}_0x7c2bf5[_0x0e17('0xa8')][_0x0e17('0xad')]=!![];}return db['SmsMessage'][_0x0e17('0x5a')]({'phone':_0x7c2bf5['body']['from'],'messageId':_0x7c2bf5[_0x0e17('0x63')]['messageId'],'body':_0x7c2bf5['body'][_0x0e17('0x63')],'SmsAccountId':_0x18a485[_0x0e17('0x54')]['id'],'SmsInteractionId':_0x5da057['id'],'direction':'in','ContactId':_0x5da057[_0x0e17('0xae')],'AttachmentId':_0x7c2bf5[_0x0e17('0x63')][_0x0e17('0xaf')]});})[_0x0e17('0x1f')](function(_0x279432){_0x7c2bf5[_0x0e17('0x25')]=_0x279432;if(_0x7c2bf5[_0x0e17('0xa8')][_0x0e17('0xb0')]){return db['User'][_0x0e17('0x59')]({'attributes':['id',_0x0e17('0x38')],'where':{'id':_0x7c2bf5['interaction'][_0x0e17('0xb0')]}})['then'](function(_0x546ad8){if(_0x546ad8){_0x7c2bf5[_0x0e17('0x76')][_0x0e17('0xb1')]({'id':0x0,'priority':0x0,'app':_0x0e17('0xb2'),'appdata':_0x546ad8[_0x0e17('0x38')]+','+(_0x7c2bf5['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x0e17('0xb3'),_0x0e17('0xb4'),_0x7c2bf5);});}return respondWithRpcPromise('Start',_0x0e17('0xb4'),_0x7c2bf5);})[_0x0e17('0x1f')](function(_0x2e1cac){if(_0x2e1cac){var _0x4e9854=0xc8;var _0x2a1763='receiveMessage';logger[_0x0e17('0x26')](_0x0e17('0xb5'),_0x2a1763,_0x4e9854,'entity\x20found');logger[_0x0e17('0xb6')](_0x0e17('0xb7'),_0x2a1763,_0x4e9854,'entity\x20found',JSON['stringify'](_0x2e1cac));if(_0x7c2bf5[_0x0e17('0x75')]['type']==='twilio'){return _0x507410[_0x0e17('0x2e')](_0x4e9854)[_0x0e17('0x2f')](_0x0e17('0xb8'),_0x0e17('0xb9'))[_0x0e17('0xba')](_0x0e17('0xbb'));}else{return _0x507410[_0x0e17('0x2e')](_0x4e9854)[_0x0e17('0x31')](_0x2e1cac);}}})[_0x0e17('0x52')](handleError(_0x507410,null));};exports['addApplications']=function(_0x29dfd1,_0x5e4bec){var _0x4a2678=_0x29dfd1[_0x0e17('0x54')]['id'];var _0x4eda35=_0x29dfd1[_0x0e17('0x63')];var _0x4c0482=0xc8;var _0x233ec9=null;return db[_0x0e17('0xbc')]['transaction']({'isolationLevel':db[_0x0e17('0xbc')][_0x0e17('0xbd')][_0x0e17('0xbe')][_0x0e17('0xbf')]},function(_0x5edd3f){return db['SmsAccount'][_0x0e17('0x69')]({'where':{'id':_0x4a2678},'transaction':_0x5edd3f})[_0x0e17('0x1f')](function(_0x325879){if(_0x325879){return db[_0x0e17('0x73')][_0x0e17('0x34')]({'where':{'SmsAccountId':_0x4a2678},'transaction':_0x5edd3f})['then'](function(){var _0x53389b=_[_0x0e17('0x4d')](_0x4eda35,function(_0x19ddf1){_0x19ddf1['SmsAccountId']=_0x4a2678;return _0x19ddf1;});return db[_0x0e17('0x73')][_0x0e17('0xc0')](_0x53389b,{'transaction':_0x5edd3f});});}else{_0x4c0482=0x194;_0x233ec9=[];}});})['then'](function(){if(_0x4c0482!==0x194){return db['SmsApplication'][_0x0e17('0xc1')]({'where':{'SmsAccountId':_0x4a2678},'order':_0x0e17('0x78')})['then'](function(_0x1b1724){_0x233ec9=_0x1b1724;});}})['catch'](function(_0x48d0f3){_0x4c0482=0x1f4;logger[_0x0e17('0x22')](_0x48d0f3[_0x0e17('0x37')]);if(_0x48d0f3[_0x0e17('0x38')]){delete _0x48d0f3['name'];}_0x233ec9=_0x48d0f3;})[_0x0e17('0xc2')](function(){if(_0x233ec9===null){_0x5e4bec[_0x0e17('0x28')](_0x4c0482);}else{if(_0x4c0482===0x1f4){_0x5e4bec[_0x0e17('0x2e')](_0x4c0482)[_0x0e17('0xba')](_0x233ec9);}else{_0x5e4bec[_0x0e17('0x2e')](_0x4c0482)[_0x0e17('0x31')](_0x233ec9);}}});};exports['getApplications']=function(_0x4af19c,_0xe2391a,_0x2b1b62){var _0x446ac9={};var _0x1e420b={};var _0x28f434;var _0x47e73c;return db[_0x0e17('0x3c')][_0x0e17('0x69')]({'where':{'id':_0x4af19c[_0x0e17('0x54')]['id']}})[_0x0e17('0x1f')](handleEntityNotFound(_0xe2391a,null))['then'](function(_0x3484e3){if(_0x3484e3){_0x28f434=_0x3484e3;_0x1e420b['model']=_['keys'](db[_0x0e17('0x73')][_0x0e17('0x3d')]);_0x1e420b[_0x0e17('0x40')]=_[_0x0e17('0x55')](_0x4af19c[_0x0e17('0x40')]);_0x1e420b[_0x0e17('0x48')]=_[_0x0e17('0x41')](_0x1e420b[_0x0e17('0x42')],_0x1e420b[_0x0e17('0x40')]);_0x446ac9[_0x0e17('0x43')]=_['intersection'](_0x1e420b[_0x0e17('0x42')],qs[_0x0e17('0x44')](_0x4af19c[_0x0e17('0x40')]['fields']));_0x446ac9[_0x0e17('0x43')]=_0x446ac9[_0x0e17('0x43')][_0x0e17('0x56')]?_0x446ac9['attributes']:_0x1e420b['model'];_0x446ac9[_0x0e17('0x6a')]=qs[_0x0e17('0x47')](_0x4af19c[_0x0e17('0x40')][_0x0e17('0x47')]);_0x446ac9[_0x0e17('0x4c')]=qs[_0x0e17('0x48')](_[_0x0e17('0x49')](_0x4af19c['query'],_0x1e420b[_0x0e17('0x48')]));if(_0x4af19c['query'][_0x0e17('0x4a')]){_0x446ac9[_0x0e17('0x4c')]=_[_0x0e17('0x4b')](_0x446ac9[_0x0e17('0x4c')],{'$or':_[_0x0e17('0x4d')](_0x446ac9['attributes'],function(_0x1b0ec4){var _0x55843a={};_0x55843a[_0x1b0ec4]={'$like':'%'+_0x4af19c[_0x0e17('0x40')][_0x0e17('0x4a')]+'%'};return _0x55843a;})});}_0x446ac9=_['merge']({},_0x446ac9,_0x4af19c[_0x0e17('0x58')]);return _0x28f434[_0x0e17('0xc3')](_0x446ac9);}})['then'](function(_0x4a509d){if(_0x4a509d){_0x47e73c=_0x4a509d[_0x0e17('0x56')];if(!_0x4af19c[_0x0e17('0x40')][_0x0e17('0x45')](_0x0e17('0x46'))){_0x446ac9[_0x0e17('0x2b')]=qs[_0x0e17('0x2b')](_0x4af19c['query']['limit']);_0x446ac9[_0x0e17('0x2d')]=qs[_0x0e17('0x2d')](_0x4af19c[_0x0e17('0x40')][_0x0e17('0x2d')]);}return _0x28f434['getApplications'](_0x446ac9);}})[_0x0e17('0x1f')](function(_0x436ad0){if(_0x436ad0){return _0x436ad0?{'count':_0x47e73c,'rows':_0x436ad0}:null;}})[_0x0e17('0x1f')](respondWithResult(_0xe2391a,null))['catch'](handleError(_0xe2391a,null));};exports[_0x0e17('0xc4')]=function(_0xd27029,_0x47ab70,_0xedc091){var _0x4c853c={'raw':![],'where':{}};var _0x49d94a={};var _0x242157={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0xd27029[_0x0e17('0x54')]['id']}})['then'](handleEntityNotFound(_0x47ab70,null))['then'](function(_0x55ccb2){if(_0x55ccb2){_0x49d94a['model']=_[_0x0e17('0x55')](db['SmsInteraction']['rawAttributes']);_0x49d94a['query']=_[_0x0e17('0x55')](_0xd27029[_0x0e17('0x40')]);_0x49d94a[_0x0e17('0x48')]=_['intersection'](_0x49d94a['model'],_0x49d94a[_0x0e17('0x40')]);_0x4c853c['attributes']=_[_0x0e17('0x41')](_0x49d94a['model'],qs[_0x0e17('0x44')](_0xd27029[_0x0e17('0x40')][_0x0e17('0x44')]));_0x4c853c[_0x0e17('0x43')]=_0x4c853c[_0x0e17('0x43')]['length']?_0x4c853c[_0x0e17('0x43')]:_0x49d94a[_0x0e17('0x42')];if(!_0xd27029[_0x0e17('0x40')][_0x0e17('0x45')](_0x0e17('0x46'))){_0x4c853c[_0x0e17('0x2b')]=qs[_0x0e17('0x2b')](_0xd27029[_0x0e17('0x40')][_0x0e17('0x2b')]);_0x4c853c['offset']=qs[_0x0e17('0x2d')](_0xd27029[_0x0e17('0x40')][_0x0e17('0x2d')]);}_0x4c853c[_0x0e17('0x6a')]=qs['sort'](_0xd27029['query']['sort']);_0x4c853c[_0x0e17('0x4c')]=qs['filters'](_[_0x0e17('0x49')](_0xd27029['query'],_0x49d94a[_0x0e17('0x48')]));_0x4c853c['where'][_0x0e17('0x66')]=_0x55ccb2['id'];if(_0xd27029[_0x0e17('0x40')]['filter']){_0x4c853c[_0x0e17('0x4c')]=_[_0x0e17('0x4b')](_0x4c853c[_0x0e17('0x4c')],{'$or':_[_0x0e17('0x4d')](_0x4c853c[_0x0e17('0x43')],function(_0x5cdc7e){var _0x265124={};_0x265124[_0x5cdc7e]={'$like':'%'+_0xd27029[_0x0e17('0x40')]['filter']+'%'};return _0x265124;})});}_0x4c853c=_[_0x0e17('0x4b')]({},_0x4c853c,_0xd27029[_0x0e17('0x58')]);return db['SmsInteraction']['count']({'where':_0x4c853c['where']})[_0x0e17('0x1f')](function(_0x590dbc){_0x242157[_0x0e17('0x2c')]=_0x590dbc;if(_0xd27029['query'][_0x0e17('0x57')]){_0x4c853c[_0x0e17('0x4f')]=[{'model':db[_0x0e17('0xa0')],'as':_0x0e17('0xc5'),'required':![]},{'model':db[_0x0e17('0xc6')],'as':_0x0e17('0xc7'),'attributes':[_0x0e17('0x38'),_0x0e17('0xc8'),_0x0e17('0xc9')],'required':![]},{'model':db['Tag'],'as':_0x0e17('0xca'),'attributes':['id',_0x0e17('0x38'),'color'],'where':_0xd27029['query'][_0x0e17('0xcb')]?{'id':_0xd27029['query'][_0x0e17('0xcb')]}:undefined,'required':_0xd27029[_0x0e17('0x40')][_0x0e17('0xcb')]?!![]:![]}];}return db[_0x0e17('0xa6')][_0x0e17('0x50')](_0x4c853c);})[_0x0e17('0x1f')](function(_0xca6cdd){_0x242157[_0x0e17('0x51')]=_0xca6cdd;return _0x242157;});}})[_0x0e17('0x1f')](respondWithFilteredResult(_0x47ab70,_0x4c853c))[_0x0e17('0x52')](handleError(_0x47ab70,null));};exports[_0x0e17('0xba')]=function(_0xd08514,_0x371a40,_0x3e8042){var _0x369148,_0x557169,_0x354d75;if(_[_0x0e17('0x99')](_0xd08514[_0x0e17('0x63')][_0x0e17('0x63')])||_0xd08514[_0x0e17('0x63')][_0x0e17('0x63')]===''){throw new db['Sequelize'][(_0x0e17('0x97'))](_0x0e17('0x9a'));}if(_[_0x0e17('0x99')](_0xd08514[_0x0e17('0x63')]['to'])){throw new db[(_0x0e17('0x7a'))][(_0x0e17('0x97'))](_0x0e17('0xcc'));}_0x369148=_0xd08514['body']['to'];return db[_0x0e17('0x3c')][_0x0e17('0x59')]({'where':{'id':_0xd08514[_0x0e17('0x54')]['id']},'include':[{'model':db[_0x0e17('0xcd')],'as':_0x0e17('0xce'),'include':[{'model':db[_0x0e17('0xa0')],'as':_0x0e17('0xa1'),'where':{'mobile':_0x369148},'limit':0x1,'order':[[_0x0e17('0x7e'),_0x0e17('0xa2')]]}]}]})['then'](handleEntityNotFound(_0x371a40,null))[_0x0e17('0x1f')](function(_0x5923ab){if(_0x5923ab&&_0x5923ab[_0x0e17('0xce')]){_0x557169=_0x5923ab['get']({'plain':!![]});if(_0x557169[_0x0e17('0xce')]&&_0x557169[_0x0e17('0xce')][_0x0e17('0xa1')][_0x0e17('0x56')]){return _0x557169[_0x0e17('0xce')][_0x0e17('0xa1')][0x0];}return db[_0x0e17('0xa0')]['create'](_['defaults'](_0xd08514[_0x0e17('0x63')],{'firstName':_0x369148,'mobile':_0x369148,'phone':_0x369148,'ListId':_0x557169[_0x0e17('0x9f')]}));}})[_0x0e17('0x1f')](handleEntityNotFound(_0x371a40,null))[_0x0e17('0x1f')](function(_0x25931d){if(_0x25931d){_0x354d75=_0x25931d;return db[_0x0e17('0xa6')][_0x0e17('0x59')]({'where':{'ContactId':_0x354d75['id'],'closed':![],'SmsAccountId':_0x557169['id']}})[_0x0e17('0x1f')](function(_0x4267e1){if(_0x4267e1){return[_0x4267e1,![]];}return db[_0x0e17('0xa6')][_0x0e17('0x5a')]({'UserId':_0xd08514[_0x0e17('0x5b')]['id'],'ContactId':_0x354d75['id'],'SmsAccountId':_0x557169['id'],'phone':_0x369148,'firstMsgDirection':_0x0e17('0xcf'),'Messages':[_['merge'](_0xd08514[_0x0e17('0x63')],{'read':![],'body':_0xd08514[_0x0e17('0x63')]['body'],'phone':_0x369148,'SmsAccountId':_0x557169['id'],'UserId':_0xd08514[_0x0e17('0x5b')]['id'],'ContactId':_0x354d75['id']})]},{'include':[{'model':db[_0x0e17('0xd0')],'as':'Messages'}]})['then'](function(_0x373c70){return[_0x373c70,!![]];});});}})[_0x0e17('0xa7')](function(_0x4df1b3,_0x5830bb){if(_0x5830bb){return _0x4df1b3;}return db['SmsMessage'][_0x0e17('0x5a')](_['merge'](_0xd08514[_0x0e17('0x63')],{'read':![],'body':_0xd08514[_0x0e17('0x63')][_0x0e17('0x63')],'phone':_0x369148,'SmsAccountId':_0x557169['id'],'SmsInteractionId':_0x4df1b3['id'],'UserId':_0xd08514['user']['id'],'ContactId':_0x354d75['id']}))['then'](function(_0x44b5b6){_0x4df1b3[_0x0e17('0xd1')][_0x0e17('0xd2')]=[];_0x4df1b3['dataValues'][_0x0e17('0xd2')][_0x0e17('0xaa')](_0x44b5b6[_0x0e17('0xd1')]);return _0x4df1b3;});})[_0x0e17('0x1f')](respondWithResult(_0x371a40,null))[_0x0e17('0x52')](handleError(_0x371a40,null));};exports[_0x0e17('0x2e')]=function(_0x46c70f,_0x2f1bfd,_0xccd726){if(_0x46c70f[_0x0e17('0x63')]['id']){delete _0x46c70f['body']['id'];}var _0x283144,_0x53ecc3,_0x4dd74d;return db[_0x0e17('0x3c')][_0x0e17('0x59')]({'where':{'id':_0x46c70f[_0x0e17('0x54')]['id']}})[_0x0e17('0x1f')](handleEntityNotFound(_0x2f1bfd,null))[_0x0e17('0x1f')](function(_0x4744a9){if(_0x4744a9){_0x4dd74d=_0x4744a9;logger[_0x0e17('0xb6')](_0x0e17('0xb5'),_0x0e17('0x2e'),'received\x20delivery\x20report\x20from',_0x4744a9[_0x0e17('0x3e')],util[_0x0e17('0xd3')](_0x46c70f['body'],{'showHidden':![],'depth':null}));switch(_0x4744a9[_0x0e17('0x3e')]){case _0x0e17('0x85'):if(_0x46c70f['body'][_0x0e17('0xd4')]&&_0x46c70f[_0x0e17('0x63')][_0x0e17('0x2e')]){_0x53ecc3=_0x46c70f[_0x0e17('0x63')][_0x0e17('0x2e')];return db[_0x0e17('0xd0')]['find']({'where':{'messageId':_0x46c70f[_0x0e17('0x63')][_0x0e17('0xd4')]}});}break;case'connectel':if(_0x46c70f[_0x0e17('0x63')][_0x0e17('0xd5')]&&_0x46c70f[_0x0e17('0x63')]['statusInt']){_0x53ecc3=_0x46c70f[_0x0e17('0x63')]['statusInt'];return db[_0x0e17('0xd0')][_0x0e17('0x59')]({'where':{'messageId':_0x46c70f[_0x0e17('0x63')][_0x0e17('0xd5')]}});}break;case'clicksend':if(_0x46c70f[_0x0e17('0x63')][_0x0e17('0x8a')]&&_0x46c70f[_0x0e17('0x63')][_0x0e17('0xd6')]){_0x53ecc3=_0x46c70f[_0x0e17('0x63')][_0x0e17('0xd6')];return db[_0x0e17('0xd0')][_0x0e17('0x59')]({'where':{'messageId':_0x46c70f[_0x0e17('0x63')][_0x0e17('0x8a')]}});}break;case _0x0e17('0x8e'):var _0x2485f5=_0x46c70f[_0x0e17('0x63')][_0x0e17('0x8f')][0x0];if(_0x2485f5['messageId']&&_0x2485f5[_0x0e17('0x2e')]['groupName']===_0x0e17('0xd7')){_0x53ecc3=_0x2485f5['status'][_0x0e17('0xd8')];return db[_0x0e17('0xd0')][_0x0e17('0x59')]({'where':{'messageId':_0x2485f5[_0x0e17('0x84')]}});}break;case'clickatell':if(_0x46c70f[_0x0e17('0x63')][_0x0e17('0x84')]&&_0x46c70f[_0x0e17('0x63')][_0x0e17('0x2e')]){_0x53ecc3=_0x46c70f['body'][_0x0e17('0x2e')];return db[_0x0e17('0xd0')][_0x0e17('0x59')]({'where':{'messageId':_0x46c70f[_0x0e17('0x63')][_0x0e17('0x84')]}});}break;case _0x0e17('0x94'):if(_0x46c70f[_0x0e17('0x63')][0x0][_0x0e17('0x25')]['id']){_0x53ecc3=_0x46c70f[_0x0e17('0x63')][0x0][_0x0e17('0x3e')];return db[_0x0e17('0xd0')][_0x0e17('0x59')]({'where':{'messageId':_0x46c70f['body'][0x0][_0x0e17('0x25')]['id']}});}break;case _0x0e17('0x95'):if(_0x46c70f['body'][_0x0e17('0xd9')]&&_0x46c70f['body'][_0x0e17('0x2e')]){_0x53ecc3=_0x46c70f[_0x0e17('0x63')]['status'];return db[_0x0e17('0xd0')][_0x0e17('0x59')]({'where':{'messageId':_0x46c70f['body'][_0x0e17('0xd9')]}});}break;}}})['then'](handleEntityNotFound(_0x2f1bfd,null))['then'](function(_0xb77598){if(_0xb77598){_0x283144=_0xb77598;switch(_0x4dd74d[_0x0e17('0x3e')]){case'skebby':if(_0x53ecc3===_0x0e17('0xd7')){return _0x283144[_0x0e17('0x33')]({'read':!![]});}else{logger[_0x0e17('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0e17('0x2e'),'skebby',util[_0x0e17('0xd3')](_0x46c70f['body'],{'showHidden':![],'depth':null}));}break;case _0x0e17('0x88'):if(_0x53ecc3==='1'){return _0x283144[_0x0e17('0x33')]({'read':!![]});}else{logger[_0x0e17('0x22')](_0x0e17('0xb5'),'status',_0x0e17('0x85'),util[_0x0e17('0xd3')](_0x46c70f['body'],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x46c70f[_0x0e17('0x63')][_0x0e17('0xda')]&&_0x53ecc3>=0xc8&&_0x53ecc3<=0xce){return _0x283144[_0x0e17('0x33')]({'read':!![]});}else{logger[_0x0e17('0x22')](_0x0e17('0xb5'),'status',_0x0e17('0x89'),util[_0x0e17('0xd3')](_0x46c70f[_0x0e17('0x63')],{'showHidden':![],'depth':null}));}break;case _0x0e17('0x8e'):var _0xe4a286=_0x46c70f['body'][_0x0e17('0x8f')][0x0];if(_0xe4a286['status']['groupName']===_0x0e17('0xd7')){return _0x283144['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0e17('0x2e'),'infobip',util[_0x0e17('0xd3')](_0x46c70f[_0x0e17('0x63')],{'showHidden':![],'depth':null}));}break;case _0x0e17('0x92'):if(_0x53ecc3==_0x0e17('0xdb')||_0x53ecc3==_0x0e17('0xdc')){return _0x283144['update']({'read':!![]});}else{logger['error'](_0x0e17('0xb5'),'status',_0x0e17('0x92'),util['inspect'](_0x46c70f[_0x0e17('0x63')],{'showHidden':![],'depth':null}));}break;case _0x0e17('0x94'):if(_0x53ecc3==_0x0e17('0xdd')){return _0x283144['update']({'read':!![]});}else{logger[_0x0e17('0x22')](_0x0e17('0xb5'),'status',_0x0e17('0x94'),util[_0x0e17('0xd3')](_0x46c70f[_0x0e17('0x63')],{'showHidden':![],'depth':null}));}break;case _0x0e17('0x95'):if(_0x53ecc3==='DELIVRD'||_0x53ecc3===_0x0e17('0xde')){return _0x283144[_0x0e17('0x33')]({'read':!![]});}else{logger[_0x0e17('0x22')](_0x0e17('0xb5'),_0x0e17('0x2e'),_0x0e17('0x95'),util[_0x0e17('0xd3')](_0x46c70f[_0x0e17('0x63')],{'showHidden':![],'depth':null}));}break;}return _0x283144;}})[_0x0e17('0x1f')](respondWithResult(_0x2f1bfd,null))['catch'](handleError(_0x2f1bfd,null));};exports[_0x0e17('0xdf')]=function(_0x3e019e,_0x44119e,_0x413961){var _0x295729,_0x18c6aa,_0x45d8b9;return db[_0x0e17('0x3c')]['find']({'where':{'id':_0x3e019e[_0x0e17('0x54')]['id']}})[_0x0e17('0x1f')](handleEntityNotFound(_0x44119e,null))[_0x0e17('0x1f')](function(_0x31c2b5){if(_0x31c2b5){_0x45d8b9=_0x31c2b5;logger[_0x0e17('0xb6')](_0x0e17('0xb5'),_0x0e17('0x2e'),_0x0e17('0xe0'),_0x31c2b5[_0x0e17('0x3e')],util['inspect'](_0x3e019e[_0x0e17('0x40')],{'showHidden':![],'depth':null}));switch(_0x31c2b5[_0x0e17('0x3e')]){case _0x0e17('0x90'):if(_0x3e019e[_0x0e17('0x40')][_0x0e17('0xe1')]&&_0x3e019e[_0x0e17('0x40')][_0x0e17('0xe2')]){_0x18c6aa=_0x3e019e['query'][_0x0e17('0xe2')];return db[_0x0e17('0xd0')]['find']({'where':{'messageId':_0x3e019e['query']['message-id']}});}break;}}})['then'](handleEntityNotFound(_0x44119e,null))[_0x0e17('0x1f')](function(_0x2b09ab){if(_0x2b09ab){_0x295729=_0x2b09ab;switch(_0x45d8b9[_0x0e17('0x3e')]){case'csc':if(_0x18c6aa==='2'||_0x18c6aa==='6'){return _0x295729['update']({'read':!![]});}else{logger[_0x0e17('0x22')](_0x0e17('0xb5'),_0x0e17('0x2e'),_0x0e17('0x90'),util[_0x0e17('0xd3')](_0x3e019e[_0x0e17('0x40')],{'showHidden':![],'depth':null}));};break;}return _0x295729;}})[_0x0e17('0x1f')](respondWithResult(_0x44119e,null))['catch'](handleError(_0x44119e,null));};exports[_0x0e17('0xe3')]=function(_0xb53e66,_0x1cf530,_0x594a57){return db[_0x0e17('0x3c')][_0x0e17('0x59')]({'where':{'id':_0xb53e66[_0x0e17('0x54')]['id']}})['then'](handleEntityNotFound(_0x1cf530,null))[_0x0e17('0x1f')](function(_0x46f323){if(_0x46f323){return _0x46f323[_0x0e17('0xe3')](_0xb53e66[_0x0e17('0x63')][_0x0e17('0x6c')],_[_0x0e17('0xa4')](_0xb53e66[_0x0e17('0x63')],[_0x0e17('0x6c'),'id'])||{})['spread'](function(_0x2d1bdf){for(var _0x4aaf04=0x0;_0x4aaf04<_0xb53e66[_0x0e17('0x63')][_0x0e17('0x6c')][_0x0e17('0x56')];_0x4aaf04+=0x1){socket[_0x0e17('0xe4')]('userSmsAccount:save',{'UserId':Number(_0xb53e66[_0x0e17('0x63')][_0x0e17('0x6c')][_0x4aaf04]),'SmsAccountId':Number(_0xb53e66[_0x0e17('0x54')]['id'])});}return _0x2d1bdf;});}})[_0x0e17('0x1f')](respondWithResult(_0x1cf530,null))[_0x0e17('0x52')](handleError(_0x1cf530,null));};exports['removeAgents']=function(_0x169dc4,_0x7938c3,_0x86e67c){return db[_0x0e17('0x3c')][_0x0e17('0x59')]({'where':{'id':_0x169dc4[_0x0e17('0x54')]['id']}})[_0x0e17('0x1f')](handleEntityNotFound(_0x7938c3,null))[_0x0e17('0x1f')](function(_0x4c5020){if(_0x4c5020){return _0x4c5020[_0x0e17('0xe5')](_0x169dc4[_0x0e17('0x40')][_0x0e17('0x6c')])[_0x0e17('0x1f')](function(){if(_[_0x0e17('0xe6')](_0x169dc4['query'][_0x0e17('0x6c')])){for(var _0x55c08e=0x0;_0x55c08e<_0x169dc4[_0x0e17('0x40')][_0x0e17('0x6c')][_0x0e17('0x56')];_0x55c08e+=0x1){socket[_0x0e17('0xe4')](_0x0e17('0xe7'),{'UserId':Number(_0x169dc4['query']['ids'][_0x55c08e]),'SmsAccountId':Number(_0x169dc4['params']['id'])});}}else{socket[_0x0e17('0xe4')](_0x0e17('0xe7'),{'UserId':Number(_0x169dc4[_0x0e17('0x40')]['ids']),'SmsAccountId':Number(_0x169dc4[_0x0e17('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x7938c3,null))[_0x0e17('0x52')](handleError(_0x7938c3,null));};exports[_0x0e17('0xe8')]=function(_0x2cdbd2,_0x33c532,_0x4b5d9c){var _0x57a78e={};var _0x26bb1e={};var _0x25433c;var _0x563e88;return db[_0x0e17('0x3c')]['findOne']({'where':{'id':_0x2cdbd2['params']['id']}})[_0x0e17('0x1f')](handleEntityNotFound(_0x33c532,null))['then'](function(_0x43eff2){if(_0x43eff2){_0x25433c=_0x43eff2;_0x26bb1e['model']=_[_0x0e17('0x55')](db[_0x0e17('0xc6')][_0x0e17('0x3d')]);_0x26bb1e[_0x0e17('0x40')]=_[_0x0e17('0x55')](_0x2cdbd2[_0x0e17('0x40')]);_0x26bb1e[_0x0e17('0x48')]=_[_0x0e17('0x41')](_0x26bb1e[_0x0e17('0x42')],_0x26bb1e['query']);_0x57a78e[_0x0e17('0x43')]=_[_0x0e17('0x41')](_0x26bb1e[_0x0e17('0x42')],qs['fields'](_0x2cdbd2[_0x0e17('0x40')]['fields']));_0x57a78e[_0x0e17('0x43')]=_0x57a78e['attributes'][_0x0e17('0x56')]?_0x57a78e['attributes']:_0x26bb1e[_0x0e17('0x42')];_0x57a78e[_0x0e17('0x6a')]=qs[_0x0e17('0x47')](_0x2cdbd2[_0x0e17('0x40')][_0x0e17('0x47')]);_0x57a78e['where']=qs['filters'](_[_0x0e17('0x49')](_0x2cdbd2[_0x0e17('0x40')],_0x26bb1e[_0x0e17('0x48')]));if(_0x2cdbd2[_0x0e17('0x40')]['filter']){_0x57a78e[_0x0e17('0x4c')]=_[_0x0e17('0x4b')](_0x57a78e[_0x0e17('0x4c')],{'$or':_['map'](_0x57a78e[_0x0e17('0x43')],function(_0x5f291e){var _0x528c4d={};_0x528c4d[_0x5f291e]={'$like':'%'+_0x2cdbd2[_0x0e17('0x40')]['filter']+'%'};return _0x528c4d;})});}_0x57a78e=_['merge']({},_0x57a78e,_0x2cdbd2[_0x0e17('0x58')]);return _0x25433c['getAgents'](_0x57a78e);}})[_0x0e17('0x1f')](function(_0x13116e){if(_0x13116e){_0x563e88=_0x13116e['length'];if(!_0x2cdbd2[_0x0e17('0x40')][_0x0e17('0x45')](_0x0e17('0x46'))){_0x57a78e['limit']=qs[_0x0e17('0x2b')](_0x2cdbd2[_0x0e17('0x40')][_0x0e17('0x2b')]);_0x57a78e['offset']=qs[_0x0e17('0x2d')](_0x2cdbd2[_0x0e17('0x40')][_0x0e17('0x2d')]);}return _0x25433c['getAgents'](_0x57a78e);}})[_0x0e17('0x1f')](function(_0x2155d4){if(_0x2155d4){return _0x2155d4?{'count':_0x563e88,'rows':_0x2155d4}:null;}})[_0x0e17('0x1f')](respondWithResult(_0x33c532,null))[_0x0e17('0x52')](handleError(_0x33c532,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 0e19535..857124c 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 _0x479a=['events','../../mysqldb','SmsAccount','save','emit','hasOwnProperty','hook','exports'];(function(_0x22f924,_0x17b3db){var _0x558899=function(_0x1c7474){while(--_0x1c7474){_0x22f924['push'](_0x22f924['shift']());}};_0x558899(++_0x17b3db);}(_0x479a,0x158));var _0xa479=function(_0x415024,_0x53fed2){_0x415024=_0x415024-0x0;var _0x238cbd=_0x479a[_0x415024];return _0x238cbd;};'use strict';var EventEmitter=require(_0xa479('0x0'));var SmsAccount=require(_0xa479('0x1'))['db'][_0xa479('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa479('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3e2a12){return function(_0x3bd9c5,_0x3793a2,_0x246e6f){SmsAccountEvents[_0xa479('0x4')](_0x3e2a12+':'+_0x3bd9c5['id'],_0x3bd9c5);SmsAccountEvents[_0xa479('0x4')](_0x3e2a12,_0x3bd9c5);_0x246e6f(null);};}for(var e in events){if(events[_0xa479('0x5')](e)){var event=events[e];SmsAccount[_0xa479('0x6')](e,emitEvent(event));}}module[_0xa479('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0x297a=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','SmsAccount','setMaxListeners','save'];(function(_0x210d7f,_0x2abe4f){var _0x42d687=function(_0x46b2ae){while(--_0x46b2ae){_0x210d7f['push'](_0x210d7f['shift']());}};_0x42d687(++_0x2abe4f);}(_0x297a,0x1a3));var _0xa297=function(_0x451657,_0x512c79){_0x451657=_0x451657-0x0;var _0x2e7b7a=_0x297a[_0x451657];return _0x2e7b7a;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0xa297('0x0'))['db'][_0xa297('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xa297('0x2')](0x0);var events={'afterCreate':_0xa297('0x3'),'afterUpdate':_0xa297('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2cc2a2){return function(_0x5c1d60,_0x1e107f,_0xf7e114){SmsAccountEvents['emit'](_0x2cc2a2+':'+_0x5c1d60['id'],_0x5c1d60);SmsAccountEvents[_0xa297('0x5')](_0x2cc2a2,_0x5c1d60);_0xf7e114(null);};}for(var e in events){if(events[_0xa297('0x6')](e)){var event=events[e];SmsAccount[_0xa297('0x7')](e,emitEvent(event));}}module[_0xa297('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 431e4ad..5388ff6 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 _0xee8f=['exports','define','SmsAccount','sms_accounts','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./smsAccount.attributes'];(function(_0x2830f9,_0x509012){var _0x556ca8=function(_0x55f604){while(--_0x55f604){_0x2830f9['push'](_0x2830f9['shift']());}};_0x556ca8(++_0x509012);}(_0xee8f,0xf4));var _0xfee8=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xee8f[_0x3e5086];return _0xfeb102;};'use strict';var _=require('lodash');var util=require(_0xfee8('0x0'));var logger=require(_0xfee8('0x1'))(_0xfee8('0x2'));var moment=require('moment');var BPromise=require(_0xfee8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfee8('0x4'));var rimraf=require(_0xfee8('0x5'));var config=require(_0xfee8('0x6'));var attributes=require(_0xfee8('0x7'));module[_0xfee8('0x8')]=function(_0x1b8218,_0x714426){return _0x1b8218[_0xfee8('0x9')](_0xfee8('0xa'),attributes,{'tableName':_0xfee8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb5bd=['../../config/environment','define','SmsAccount','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb5bd,0x12c));var _0xdb5b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb5bd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdb5b('0x0'));var util=require('util');var logger=require(_0xdb5b('0x1'))(_0xdb5b('0x2'));var moment=require(_0xdb5b('0x3'));var BPromise=require(_0xdb5b('0x4'));var rp=require(_0xdb5b('0x5'));var fs=require('fs');var path=require(_0xdb5b('0x6'));var rimraf=require(_0xdb5b('0x7'));var config=require(_0xdb5b('0x8'));var attributes=require('./smsAccount.attributes');module['exports']=function(_0x1102ba,_0x4e9b27){return _0x1102ba[_0xdb5b('0x9')](_0xdb5b('0xa'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index d25d795..7fc16ee 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 _0xa66b=['error','code','message','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','include','map','model','attributes','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x501831,_0x4d0b01){var _0x3ac5d5=function(_0x400174){while(--_0x400174){_0x501831['push'](_0x501831['shift']());}};_0x3ac5d5(++_0x4d0b01);}(_0xa66b,0x180));var _0xba66=function(_0x5e4ffa,_0x56154d){_0x5e4ffa=_0x5e4ffa-0x0;var _0x43a656=_0xa66b[_0x5e4ffa];return _0x43a656;};'use strict';var _=require('lodash');var util=require(_0xba66('0x0'));var moment=require(_0xba66('0x1'));var BPromise=require(_0xba66('0x2'));var rs=require(_0xba66('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba66('0x4'))['db'];var utils=require(_0xba66('0x5'));var logger=require(_0xba66('0x6'))(_0xba66('0x7'));var config=require(_0xba66('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xba66('0x9')][_0xba66('0xa')]({'port':0x232a});config['redis']=_[_0xba66('0xb')](config[_0xba66('0xc')],{'host':_0xba66('0xd'),'port':0x18eb});var socket=require(_0xba66('0xe'))(new Redis(config[_0xba66('0xc')]));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0x217dfc,_0x285c62,_0xd70571){return new BPromise(function(_0x29f5a3,_0x30f4ee){return client[_0xba66('0xf')](_0x217dfc,_0xd70571)[_0xba66('0x10')](function(_0x5da6de){logger[_0xba66('0x11')](_0xba66('0x12'),_0x285c62,_0xba66('0x13'));logger[_0xba66('0x14')](_0xba66('0x15'),_0x285c62,'request\x20sent',JSON[_0xba66('0x16')](_0x5da6de));if(_0x5da6de[_0xba66('0x17')]){if(_0x5da6de[_0xba66('0x17')][_0xba66('0x18')]===0x1f4){logger[_0xba66('0x17')](_0xba66('0x12'),_0x285c62,_0x5da6de['error']['message']);return _0x30f4ee(_0x5da6de[_0xba66('0x17')][_0xba66('0x19')]);}logger[_0xba66('0x17')](_0xba66('0x12'),_0x285c62,_0x5da6de[_0xba66('0x17')][_0xba66('0x19')]);return _0x29f5a3(_0x5da6de[_0xba66('0x17')][_0xba66('0x19')]);}else{logger[_0xba66('0x11')]('SmsAccount,\x20%s,\x20%s',_0x285c62,_0xba66('0x13'));_0x29f5a3(_0x5da6de['result'][_0xba66('0x19')]);}})[_0xba66('0x1a')](function(_0x4cd991){logger[_0xba66('0x17')]('SmsAccount,\x20%s,\x20%s',_0x285c62,_0x4cd991);_0x30f4ee(_0x4cd991);});});}exports[_0xba66('0x1b')]=function(_0x20d252){var _0x568de4=this;return new Promise(function(_0x31f746,_0x50c239){return db[_0xba66('0x1c')][_0xba66('0x1d')]({'raw':_0x20d252[_0xba66('0x1e')]?_0x20d252[_0xba66('0x1e')][_0xba66('0x1f')]===undefined?!![]:![]:!![],'where':_0x20d252[_0xba66('0x1e')]?_0x20d252[_0xba66('0x1e')][_0xba66('0x20')]||null:null,'attributes':_0x20d252[_0xba66('0x1e')]?_0x20d252[_0xba66('0x1e')]['attributes']||null:null,'include':_0x20d252[_0xba66('0x1e')]?_0x20d252[_0xba66('0x1e')][_0xba66('0x21')]?_[_0xba66('0x22')](_0x20d252[_0xba66('0x1e')]['include'],function(_0x52f8b2){return{'model':db[_0x52f8b2[_0xba66('0x23')]],'as':_0x52f8b2['as'],'attributes':_0x52f8b2[_0xba66('0x24')],'include':_0x52f8b2[_0xba66('0x21')]?_['map'](_0x52f8b2[_0xba66('0x21')],function(_0x250601){return{'model':db[_0x250601[_0xba66('0x23')]],'as':_0x250601['as'],'attributes':_0x250601[_0xba66('0x24')],'include':_0x250601[_0xba66('0x21')]?_[_0xba66('0x22')](_0x250601[_0xba66('0x21')],function(_0x1d0150){return{'model':db[_0x1d0150[_0xba66('0x23')]],'as':_0x1d0150['as'],'attributes':_0x1d0150[_0xba66('0x24')]};}):[]};}):[]};}):[]:[]})[_0xba66('0x10')](function(_0x1610da){logger[_0xba66('0x11')](_0xba66('0x1b'),_0x20d252);logger[_0xba66('0x14')](_0xba66('0x1b'),_0x20d252,JSON[_0xba66('0x16')](_0x1610da));_0x31f746(_0x1610da);})[_0xba66('0x1a')](function(_0x417ac2){logger['error'](_0xba66('0x1b'),_0x417ac2[_0xba66('0x19')],_0x20d252);_0x50c239(_0x568de4['error'](0x1f4,_0x417ac2['message']));});});}; \ No newline at end of file +var _0xe612=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','socket.io-emitter','./smsAccount.socket','register','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','map','include','model','stringify','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x4bcb3c,_0x192122){var _0xfe09bb=function(_0xcd8ad2){while(--_0xcd8ad2){_0x4bcb3c['push'](_0x4bcb3c['shift']());}};_0xfe09bb(++_0x192122);}(_0xe612,0x192));var _0x2e61=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xe612[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x2e61('0x0'));var util=require(_0x2e61('0x1'));var moment=require(_0x2e61('0x2'));var BPromise=require(_0x2e61('0x3'));var rs=require(_0x2e61('0x4'));var fs=require('fs');var Redis=require(_0x2e61('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2e61('0x6'));var logger=require(_0x2e61('0x7'))(_0x2e61('0x8'));var config=require(_0x2e61('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2e61('0xa')]({'port':0x232a});config[_0x2e61('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2e61('0xc'))(new Redis(config[_0x2e61('0xb')]));require(_0x2e61('0xd'))[_0x2e61('0xe')](socket);function respondWithRpcPromise(_0x13cb3d,_0x3d3e9f,_0x584a64){return new BPromise(function(_0x3ac877,_0x177e3e){return client[_0x2e61('0xf')](_0x13cb3d,_0x584a64)[_0x2e61('0x10')](function(_0x12646c){logger['info'](_0x2e61('0x11'),_0x3d3e9f,_0x2e61('0x12'));logger[_0x2e61('0x13')](_0x2e61('0x14'),_0x3d3e9f,_0x2e61('0x12'),JSON['stringify'](_0x12646c));if(_0x12646c[_0x2e61('0x15')]){if(_0x12646c['error'][_0x2e61('0x16')]===0x1f4){logger[_0x2e61('0x15')](_0x2e61('0x11'),_0x3d3e9f,_0x12646c[_0x2e61('0x15')][_0x2e61('0x17')]);return _0x177e3e(_0x12646c[_0x2e61('0x15')][_0x2e61('0x17')]);}logger[_0x2e61('0x15')](_0x2e61('0x11'),_0x3d3e9f,_0x12646c['error'][_0x2e61('0x17')]);return _0x3ac877(_0x12646c[_0x2e61('0x15')][_0x2e61('0x17')]);}else{logger[_0x2e61('0x18')]('SmsAccount,\x20%s,\x20%s',_0x3d3e9f,'request\x20sent');_0x3ac877(_0x12646c['result'][_0x2e61('0x17')]);}})['catch'](function(_0x5ec422){logger[_0x2e61('0x15')](_0x2e61('0x11'),_0x3d3e9f,_0x5ec422);_0x177e3e(_0x5ec422);});});}exports[_0x2e61('0x19')]=function(_0x3197eb){var _0x2fdcc3=this;return new Promise(function(_0x229ba2,_0x14e0c2){return db[_0x2e61('0x1a')][_0x2e61('0x1b')]({'raw':_0x3197eb[_0x2e61('0x1c')]?_0x3197eb[_0x2e61('0x1c')][_0x2e61('0x1d')]===undefined?!![]:![]:!![],'where':_0x3197eb[_0x2e61('0x1c')]?_0x3197eb[_0x2e61('0x1c')][_0x2e61('0x1e')]||null:null,'attributes':_0x3197eb[_0x2e61('0x1c')]?_0x3197eb[_0x2e61('0x1c')][_0x2e61('0x1f')]||null:null,'include':_0x3197eb[_0x2e61('0x1c')]?_0x3197eb[_0x2e61('0x1c')]['include']?_[_0x2e61('0x20')](_0x3197eb['options'][_0x2e61('0x21')],function(_0x35ea01){return{'model':db[_0x35ea01[_0x2e61('0x22')]],'as':_0x35ea01['as'],'attributes':_0x35ea01[_0x2e61('0x1f')],'include':_0x35ea01[_0x2e61('0x21')]?_['map'](_0x35ea01[_0x2e61('0x21')],function(_0xf9f086){return{'model':db[_0xf9f086[_0x2e61('0x22')]],'as':_0xf9f086['as'],'attributes':_0xf9f086['attributes'],'include':_0xf9f086[_0x2e61('0x21')]?_['map'](_0xf9f086['include'],function(_0x5dbbba){return{'model':db[_0x5dbbba['model']],'as':_0x5dbbba['as'],'attributes':_0x5dbbba[_0x2e61('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2e61('0x10')](function(_0x165695){logger['info'](_0x2e61('0x19'),_0x3197eb);logger[_0x2e61('0x13')](_0x2e61('0x19'),_0x3197eb,JSON[_0x2e61('0x23')](_0x165695));_0x229ba2(_0x165695);})[_0x2e61('0x24')](function(_0xe7822){logger['error'](_0x2e61('0x19'),_0xe7822[_0x2e61('0x17')],_0x3197eb);_0x14e0c2(_0x2fdcc3[_0x2e61('0x15')](0x1f4,_0xe7822['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 305fa02..6203b98 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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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 9116a14..d97c484 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x40dbb2,_0x258f53){var _0x14e768=function(_0x538843){while(--_0x538843){_0x40dbb2['push'](_0x40dbb2['shift']());}};_0x14e768(++_0x258f53);}(_0x008c,0x188));var _0xc008=function(_0xbec8e6,_0x2841b5){_0xbec8e6=_0xbec8e6-0x0;var _0x4aa6f2=_0x008c[_0xbec8e6];return _0x4aa6f2;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file +var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x98b7de,_0x19e558){var _0x5127a1=function(_0x3de529){while(--_0x3de529){_0x98b7de['push'](_0x98b7de['shift']());}};_0x5127a1(++_0x19e558);}(_0x3e74,0x175));var _0x43e7=function(_0xe6a2f7,_0x5126b8){_0xe6a2f7=_0xe6a2f7-0x0;var _0x4e1469=_0x3e74[_0xe6a2f7];return _0x4e1469;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index df4e8eb..e00b7d2 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 _0x168a=['exports','INTEGER','STRING','TEXT','*,*,*,*','sequelize'];(function(_0x2493f7,_0x49c670){var _0x594ab2=function(_0x344ec2){while(--_0x344ec2){_0x2493f7['push'](_0x2493f7['shift']());}};_0x594ab2(++_0x49c670);}(_0x168a,0x19d));var _0xa168=function(_0x297153,_0x238b8f){_0x297153=_0x297153-0x0;var _0x308d7e=_0x168a[_0x297153];return _0x308d7e;};'use strict';var Sequelize=require(_0xa168('0x0'));module[_0xa168('0x1')]={'priority':{'type':Sequelize[_0xa168('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa168('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xa168('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xa168('0x3')],'defaultValue':_0xa168('0x5')}}; \ No newline at end of file +var _0x964c=['noop','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x4ffc12,_0x5efbac){var _0x1d6153=function(_0x4e53ea){while(--_0x4e53ea){_0x4ffc12['push'](_0x4ffc12['shift']());}};_0x1d6153(++_0x5efbac);}(_0x964c,0x1d3));var _0xc964=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x964c[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xc964('0x0'));module['exports']={'priority':{'type':Sequelize[_0xc964('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xc964('0x2')],'allowNull':![],'defaultValue':_0xc964('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xc964('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 8a48920..36fc867 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 _0x84d9=['../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','count','include','findAll','rows','catch','params','includeAll','options','find','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x33d50d,_0x3c5b8c){var _0x2dc536=function(_0x4f6049){while(--_0x4f6049){_0x33d50d['push'](_0x33d50d['shift']());}};_0x2dc536(++_0x3c5b8c);}(_0x84d9,0x10a));var _0x984d=function(_0x3c52a5,_0x43b85b){_0x3c52a5=_0x3c52a5-0x0;var _0x35803f=_0x84d9[_0x3c52a5];return _0x35803f;};'use strict';var emlformat=require(_0x984d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x984d('0x1'));var jsonpatch=require(_0x984d('0x2'));var rp=require(_0x984d('0x3'));var moment=require('moment');var BPromise=require(_0x984d('0x4'));var Mustache=require(_0x984d('0x5'));var util=require('util');var path=require(_0x984d('0x6'));var sox=require(_0x984d('0x7'));var csv=require(_0x984d('0x8'));var ejs=require(_0x984d('0x9'));var fs=require('fs');var fs_extra=require(_0x984d('0xa'));var _=require(_0x984d('0xb'));var squel=require(_0x984d('0xc'));var crypto=require('crypto');var jsforce=require(_0x984d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x984d('0x8'));var querystring=require(_0x984d('0xe'));var Papa=require(_0x984d('0xf'));var Redis=require('ioredis');var authService=require(_0x984d('0x10'));var qs=require(_0x984d('0x11'));var as=require(_0x984d('0x12'));var hardwareService=require(_0x984d('0x13'));var logger=require('../../config/logger')(_0x984d('0x14'));var utils=require('../../config/utils');var config=require(_0x984d('0x15'));var licenseUtil=require(_0x984d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9ed4a2,_0x2e9c09){_0x2e9c09=_0x2e9c09||0xcc;return function(_0x81fa00){if(_0x81fa00){return _0x9ed4a2[_0x984d('0x17')](_0x2e9c09);}return _0x9ed4a2[_0x984d('0x18')](_0x2e9c09)[_0x984d('0x19')]();};}function respondWithResult(_0x3429df,_0x3217a5){_0x3217a5=_0x3217a5||0xc8;return function(_0x119a30){if(_0x119a30){return _0x3429df[_0x984d('0x18')](_0x3217a5)[_0x984d('0x1a')](_0x119a30);}};}function respondWithFilteredResult(_0x2be52f,_0x475278){return function(_0x302385){if(_0x302385){var _0x2f9072=typeof _0x475278[_0x984d('0x1b')]===_0x984d('0x1c')&&typeof _0x475278['limit']===_0x984d('0x1c');var _0x5dca4c=_0x302385['count'];var _0x4d818d=_0x2f9072?0x0:_0x475278[_0x984d('0x1b')];var _0x56b2d5=_0x2f9072?_0x302385['count']:_0x475278[_0x984d('0x1b')]+_0x475278[_0x984d('0x1d')];var _0x2d9cf8;if(_0x56b2d5>=_0x5dca4c){_0x56b2d5=_0x5dca4c;_0x2d9cf8=0xc8;}else{_0x2d9cf8=0xce;}_0x2be52f[_0x984d('0x18')](_0x2d9cf8);return _0x2be52f['set'](_0x984d('0x1e'),_0x4d818d+'-'+_0x56b2d5+'/'+_0x5dca4c)[_0x984d('0x1a')](_0x302385);}return null;};}function patchUpdates(_0xc785bb){return function(_0x22f399){try{jsonpatch[_0x984d('0x1f')](_0x22f399,_0xc785bb,!![]);}catch(_0x5d0697){return BPromise[_0x984d('0x20')](_0x5d0697);}return _0x22f399[_0x984d('0x21')]();};}function saveUpdates(_0x4ec103,_0x1fd49d){return function(_0x213e63){if(_0x213e63){return _0x213e63['update'](_0x4ec103)['then'](function(_0x11f74f){return _0x11f74f;});}return null;};}function removeEntity(_0xf73d7d,_0x412359){return function(_0x1377ea){if(_0x1377ea){return _0x1377ea[_0x984d('0x22')]()[_0x984d('0x23')](function(){_0xf73d7d[_0x984d('0x18')](0xcc)[_0x984d('0x19')]();});}};}function handleEntityNotFound(_0x2463e0,_0x1590eb){return function(_0x5ee610){if(!_0x5ee610){_0x2463e0[_0x984d('0x17')](0x194);}return _0x5ee610;};}function handleError(_0x16414e,_0x12e533){_0x12e533=_0x12e533||0x1f4;return function(_0x49e57c){logger[_0x984d('0x24')](_0x49e57c[_0x984d('0x25')]);if(_0x49e57c[_0x984d('0x26')]){delete _0x49e57c['name'];}_0x16414e[_0x984d('0x18')](_0x12e533)[_0x984d('0x27')](_0x49e57c);};}exports[_0x984d('0x28')]=function(_0x5b6518,_0x29e1a4){var _0x27686f={},_0x3d8592={},_0x2c6de7={'count':0x0,'rows':[]};var _0x5a7cef=_[_0x984d('0x29')](db[_0x984d('0x2a')][_0x984d('0x2b')],function(_0x11318a){return{'name':_0x11318a[_0x984d('0x2c')],'type':_0x11318a['type']['key']};});_0x3d8592[_0x984d('0x2d')]=_[_0x984d('0x29')](_0x5a7cef,_0x984d('0x26'));_0x3d8592[_0x984d('0x2e')]=_[_0x984d('0x2f')](_0x5b6518['query']);_0x3d8592[_0x984d('0x30')]=_['intersection'](_0x3d8592[_0x984d('0x2d')],_0x3d8592[_0x984d('0x2e')]);_0x27686f[_0x984d('0x31')]=_[_0x984d('0x32')](_0x3d8592['model'],qs[_0x984d('0x33')](_0x5b6518['query']['fields']));_0x27686f[_0x984d('0x31')]=_0x27686f[_0x984d('0x31')][_0x984d('0x34')]?_0x27686f['attributes']:_0x3d8592[_0x984d('0x2d')];if(!_0x5b6518[_0x984d('0x2e')]['hasOwnProperty']('nolimit')){_0x27686f['limit']=qs[_0x984d('0x1d')](_0x5b6518['query'][_0x984d('0x1d')]);_0x27686f['offset']=qs[_0x984d('0x1b')](_0x5b6518['query'][_0x984d('0x1b')]);}_0x27686f[_0x984d('0x35')]=qs[_0x984d('0x36')](_0x5b6518[_0x984d('0x2e')][_0x984d('0x36')]);_0x27686f[_0x984d('0x37')]=qs[_0x984d('0x30')](_[_0x984d('0x38')](_0x5b6518[_0x984d('0x2e')],_0x3d8592['filters']),_0x5a7cef);if(_0x5b6518[_0x984d('0x2e')][_0x984d('0x39')]){_0x27686f[_0x984d('0x37')]=_[_0x984d('0x3a')](_0x27686f[_0x984d('0x37')],{'$or':_['map'](_0x5a7cef,function(_0x2bfb2c){if(_0x2bfb2c['type']!==_0x984d('0x3b')){var _0x3a06e8={};_0x3a06e8[_0x2bfb2c[_0x984d('0x26')]]={'$like':'%'+_0x5b6518['query'][_0x984d('0x39')]+'%'};return _0x3a06e8;}})});}_0x27686f=_[_0x984d('0x3a')]({},_0x27686f,_0x5b6518['options']);var _0x11765e={'where':_0x27686f['where']};return db[_0x984d('0x2a')][_0x984d('0x3c')](_0x11765e)[_0x984d('0x23')](function(_0x3d9d5a){_0x2c6de7[_0x984d('0x3c')]=_0x3d9d5a;if(_0x5b6518[_0x984d('0x2e')]['includeAll']){_0x27686f[_0x984d('0x3d')]=[{'all':!![]}];}return db[_0x984d('0x2a')][_0x984d('0x3e')](_0x27686f);})['then'](function(_0x395233){_0x2c6de7[_0x984d('0x3f')]=_0x395233;return _0x2c6de7;})[_0x984d('0x23')](respondWithFilteredResult(_0x29e1a4,_0x27686f))[_0x984d('0x40')](handleError(_0x29e1a4,null));};exports['show']=function(_0x56063f,_0x4e3d2f){var _0x5ba3e7={'raw':!![],'where':{'id':_0x56063f[_0x984d('0x41')]['id']}},_0x22a03c={};_0x22a03c[_0x984d('0x2d')]=_[_0x984d('0x2f')](db[_0x984d('0x2a')][_0x984d('0x2b')]);_0x22a03c[_0x984d('0x2e')]=_['keys'](_0x56063f[_0x984d('0x2e')]);_0x22a03c[_0x984d('0x30')]=_[_0x984d('0x32')](_0x22a03c[_0x984d('0x2d')],_0x22a03c['query']);_0x5ba3e7[_0x984d('0x31')]=_[_0x984d('0x32')](_0x22a03c[_0x984d('0x2d')],qs[_0x984d('0x33')](_0x56063f['query'][_0x984d('0x33')]));_0x5ba3e7[_0x984d('0x31')]=_0x5ba3e7[_0x984d('0x31')][_0x984d('0x34')]?_0x5ba3e7['attributes']:_0x22a03c['model'];if(_0x56063f['query'][_0x984d('0x42')]){_0x5ba3e7[_0x984d('0x3d')]=[{'all':!![]}];}_0x5ba3e7=_[_0x984d('0x3a')]({},_0x5ba3e7,_0x56063f[_0x984d('0x43')]);return db['SmsApplication'][_0x984d('0x44')](_0x5ba3e7)[_0x984d('0x23')](handleEntityNotFound(_0x4e3d2f,null))['then'](respondWithResult(_0x4e3d2f,null))[_0x984d('0x40')](handleError(_0x4e3d2f,null));};exports[_0x984d('0x45')]=function(_0x192c4b,_0x57ccd9){return db[_0x984d('0x2a')]['create'](_0x192c4b[_0x984d('0x46')],{})[_0x984d('0x23')](respondWithResult(_0x57ccd9,0xc9))[_0x984d('0x40')](handleError(_0x57ccd9,null));};exports[_0x984d('0x47')]=function(_0x319109,_0xe1605){if(_0x319109['body']['id']){delete _0x319109[_0x984d('0x46')]['id'];}return db[_0x984d('0x2a')][_0x984d('0x44')]({'where':{'id':_0x319109[_0x984d('0x41')]['id']}})[_0x984d('0x23')](handleEntityNotFound(_0xe1605,null))[_0x984d('0x23')](saveUpdates(_0x319109[_0x984d('0x46')],null))['then'](respondWithResult(_0xe1605,null))['catch'](handleError(_0xe1605,null));};exports['destroy']=function(_0x227c69,_0x123bc4){return db[_0x984d('0x2a')][_0x984d('0x44')]({'where':{'id':_0x227c69[_0x984d('0x41')]['id']}})[_0x984d('0x23')](handleEntityNotFound(_0x123bc4,null))[_0x984d('0x23')](removeEntity(_0x123bc4,null))[_0x984d('0x40')](handleError(_0x123bc4,null));}; \ No newline at end of file +var _0xa6ab=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','reject','save','then','destroy','error','name','send','map','SmsApplication','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','merge','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','squel'];(function(_0x548200,_0x3241b8){var _0x1a6d74=function(_0x412f84){while(--_0x412f84){_0x548200['push'](_0x548200['shift']());}};_0x1a6d74(++_0x3241b8);}(_0xa6ab,0xd6));var _0xba6a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa6ab[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0xba6a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xba6a('0x1'));var jsonpatch=require(_0xba6a('0x2'));var rp=require(_0xba6a('0x3'));var moment=require('moment');var BPromise=require(_0xba6a('0x4'));var Mustache=require('mustache');var util=require(_0xba6a('0x5'));var path=require(_0xba6a('0x6'));var sox=require(_0xba6a('0x7'));var csv=require(_0xba6a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xba6a('0x9'));var _=require('lodash');var squel=require(_0xba6a('0xa'));var crypto=require(_0xba6a('0xb'));var jsforce=require(_0xba6a('0xc'));var deskjs=require(_0xba6a('0xd'));var toCsv=require(_0xba6a('0x8'));var querystring=require(_0xba6a('0xe'));var Papa=require(_0xba6a('0xf'));var Redis=require(_0xba6a('0x10'));var authService=require(_0xba6a('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xba6a('0x12'));var logger=require(_0xba6a('0x13'))(_0xba6a('0x14'));var utils=require(_0xba6a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xba6a('0x16'));var db=require(_0xba6a('0x17'))['db'];function respondWithStatusCode(_0x2ac7bc,_0x416601){_0x416601=_0x416601||0xcc;return function(_0x3db4ba){if(_0x3db4ba){return _0x2ac7bc[_0xba6a('0x18')](_0x416601);}return _0x2ac7bc[_0xba6a('0x19')](_0x416601)[_0xba6a('0x1a')]();};}function respondWithResult(_0x43f21f,_0x1d37ba){_0x1d37ba=_0x1d37ba||0xc8;return function(_0x264df9){if(_0x264df9){return _0x43f21f['status'](_0x1d37ba)[_0xba6a('0x1b')](_0x264df9);}};}function respondWithFilteredResult(_0x19dea4,_0x46e34c){return function(_0x50dc2f){if(_0x50dc2f){var _0x3d1329=typeof _0x46e34c['offset']===_0xba6a('0x1c')&&typeof _0x46e34c['limit']===_0xba6a('0x1c');var _0x6c5083=_0x50dc2f[_0xba6a('0x1d')];var _0xfdd8d1=_0x3d1329?0x0:_0x46e34c[_0xba6a('0x1e')];var _0x4269ad=_0x3d1329?_0x50dc2f['count']:_0x46e34c['offset']+_0x46e34c[_0xba6a('0x1f')];var _0x37f8f2;if(_0x4269ad>=_0x6c5083){_0x4269ad=_0x6c5083;_0x37f8f2=0xc8;}else{_0x37f8f2=0xce;}_0x19dea4[_0xba6a('0x19')](_0x37f8f2);return _0x19dea4[_0xba6a('0x20')]('Content-Range',_0xfdd8d1+'-'+_0x4269ad+'/'+_0x6c5083)[_0xba6a('0x1b')](_0x50dc2f);}return null;};}function patchUpdates(_0xd2aa10){return function(_0x2508be){try{jsonpatch[_0xba6a('0x21')](_0x2508be,_0xd2aa10,!![]);}catch(_0x58e1b4){return BPromise[_0xba6a('0x22')](_0x58e1b4);}return _0x2508be[_0xba6a('0x23')]();};}function saveUpdates(_0x242331,_0x29af95){return function(_0x162116){if(_0x162116){return _0x162116['update'](_0x242331)[_0xba6a('0x24')](function(_0x2b134a){return _0x2b134a;});}return null;};}function removeEntity(_0x16c34b,_0xc2d0f8){return function(_0x3b923e){if(_0x3b923e){return _0x3b923e[_0xba6a('0x25')]()[_0xba6a('0x24')](function(){_0x16c34b[_0xba6a('0x19')](0xcc)[_0xba6a('0x1a')]();});}};}function handleEntityNotFound(_0x3483b8,_0x175222){return function(_0x32e449){if(!_0x32e449){_0x3483b8['sendStatus'](0x194);}return _0x32e449;};}function handleError(_0x486149,_0x16b3ab){_0x16b3ab=_0x16b3ab||0x1f4;return function(_0x5d1bca){logger[_0xba6a('0x26')](_0x5d1bca['stack']);if(_0x5d1bca['name']){delete _0x5d1bca[_0xba6a('0x27')];}_0x486149['status'](_0x16b3ab)[_0xba6a('0x28')](_0x5d1bca);};}exports['index']=function(_0x2d265d,_0x34edac){var _0x56411d={},_0x115ebf={},_0x352731={'count':0x0,'rows':[]};var _0x33d280=_[_0xba6a('0x29')](db[_0xba6a('0x2a')][_0xba6a('0x2b')],function(_0x5623fc){return{'name':_0x5623fc[_0xba6a('0x2c')],'type':_0x5623fc[_0xba6a('0x2d')][_0xba6a('0x2e')]};});_0x115ebf[_0xba6a('0x2f')]=_['map'](_0x33d280,'name');_0x115ebf['query']=_[_0xba6a('0x30')](_0x2d265d[_0xba6a('0x31')]);_0x115ebf[_0xba6a('0x32')]=_['intersection'](_0x115ebf[_0xba6a('0x2f')],_0x115ebf[_0xba6a('0x31')]);_0x56411d[_0xba6a('0x33')]=_[_0xba6a('0x34')](_0x115ebf['model'],qs[_0xba6a('0x35')](_0x2d265d[_0xba6a('0x31')][_0xba6a('0x35')]));_0x56411d[_0xba6a('0x33')]=_0x56411d[_0xba6a('0x33')][_0xba6a('0x36')]?_0x56411d[_0xba6a('0x33')]:_0x115ebf['model'];if(!_0x2d265d['query'][_0xba6a('0x37')](_0xba6a('0x38'))){_0x56411d[_0xba6a('0x1f')]=qs['limit'](_0x2d265d[_0xba6a('0x31')][_0xba6a('0x1f')]);_0x56411d[_0xba6a('0x1e')]=qs[_0xba6a('0x1e')](_0x2d265d['query'][_0xba6a('0x1e')]);}_0x56411d[_0xba6a('0x39')]=qs[_0xba6a('0x3a')](_0x2d265d[_0xba6a('0x31')]['sort']);_0x56411d[_0xba6a('0x3b')]=qs['filters'](_[_0xba6a('0x3c')](_0x2d265d['query'],_0x115ebf['filters']),_0x33d280);if(_0x2d265d[_0xba6a('0x31')][_0xba6a('0x3d')]){_0x56411d[_0xba6a('0x3b')]=_['merge'](_0x56411d[_0xba6a('0x3b')],{'$or':_[_0xba6a('0x29')](_0x33d280,function(_0x27a06d){if(_0x27a06d['type']!==_0xba6a('0x3e')){var _0x20534c={};_0x20534c[_0x27a06d['name']]={'$like':'%'+_0x2d265d[_0xba6a('0x31')][_0xba6a('0x3d')]+'%'};return _0x20534c;}})});}_0x56411d=_['merge']({},_0x56411d,_0x2d265d[_0xba6a('0x3f')]);var _0x3cfe15={'where':_0x56411d[_0xba6a('0x3b')]};return db[_0xba6a('0x2a')]['count'](_0x3cfe15)[_0xba6a('0x24')](function(_0x2036c3){_0x352731['count']=_0x2036c3;if(_0x2d265d[_0xba6a('0x31')][_0xba6a('0x40')]){_0x56411d['include']=[{'all':!![]}];}return db[_0xba6a('0x2a')][_0xba6a('0x41')](_0x56411d);})[_0xba6a('0x24')](function(_0x3435b0){_0x352731[_0xba6a('0x42')]=_0x3435b0;return _0x352731;})[_0xba6a('0x24')](respondWithFilteredResult(_0x34edac,_0x56411d))[_0xba6a('0x43')](handleError(_0x34edac,null));};exports[_0xba6a('0x44')]=function(_0x1eafc8,_0x5d90dd){var _0x5dfa79={'raw':!![],'where':{'id':_0x1eafc8[_0xba6a('0x45')]['id']}},_0x3f3065={};_0x3f3065['model']=_[_0xba6a('0x30')](db[_0xba6a('0x2a')][_0xba6a('0x2b')]);_0x3f3065[_0xba6a('0x31')]=_[_0xba6a('0x30')](_0x1eafc8[_0xba6a('0x31')]);_0x3f3065[_0xba6a('0x32')]=_[_0xba6a('0x34')](_0x3f3065['model'],_0x3f3065[_0xba6a('0x31')]);_0x5dfa79['attributes']=_[_0xba6a('0x34')](_0x3f3065[_0xba6a('0x2f')],qs['fields'](_0x1eafc8[_0xba6a('0x31')]['fields']));_0x5dfa79[_0xba6a('0x33')]=_0x5dfa79['attributes']['length']?_0x5dfa79[_0xba6a('0x33')]:_0x3f3065['model'];if(_0x1eafc8[_0xba6a('0x31')][_0xba6a('0x40')]){_0x5dfa79[_0xba6a('0x46')]=[{'all':!![]}];}_0x5dfa79=_[_0xba6a('0x47')]({},_0x5dfa79,_0x1eafc8[_0xba6a('0x3f')]);return db[_0xba6a('0x2a')][_0xba6a('0x48')](_0x5dfa79)[_0xba6a('0x24')](handleEntityNotFound(_0x5d90dd,null))['then'](respondWithResult(_0x5d90dd,null))[_0xba6a('0x43')](handleError(_0x5d90dd,null));};exports['create']=function(_0x58f434,_0x27bfe4){return db[_0xba6a('0x2a')][_0xba6a('0x49')](_0x58f434[_0xba6a('0x4a')],{})['then'](respondWithResult(_0x27bfe4,0xc9))[_0xba6a('0x43')](handleError(_0x27bfe4,null));};exports['update']=function(_0x100adf,_0x5b44d0){if(_0x100adf[_0xba6a('0x4a')]['id']){delete _0x100adf[_0xba6a('0x4a')]['id'];}return db[_0xba6a('0x2a')]['find']({'where':{'id':_0x100adf['params']['id']}})[_0xba6a('0x24')](handleEntityNotFound(_0x5b44d0,null))['then'](saveUpdates(_0x100adf[_0xba6a('0x4a')],null))[_0xba6a('0x24')](respondWithResult(_0x5b44d0,null))[_0xba6a('0x43')](handleError(_0x5b44d0,null));};exports[_0xba6a('0x25')]=function(_0x3e5ef2,_0x3e2157){return db[_0xba6a('0x2a')][_0xba6a('0x48')]({'where':{'id':_0x3e5ef2[_0xba6a('0x45')]['id']}})[_0xba6a('0x24')](handleEntityNotFound(_0x3e2157,null))[_0xba6a('0x24')](removeEntity(_0x3e2157,null))[_0xba6a('0x43')](handleError(_0x3e2157,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 45d8f64..5e20937 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 _0x9677=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','exports','define','sms_applications'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9677,0xc2));var _0x7967=function(_0x4b4c68,_0x14d416){_0x4b4c68=_0x4b4c68-0x0;var _0x1686e6=_0x9677[_0x4b4c68];return _0x1686e6;};'use strict';var _=require(_0x7967('0x0'));var util=require(_0x7967('0x1'));var logger=require(_0x7967('0x2'))(_0x7967('0x3'));var moment=require('moment');var BPromise=require(_0x7967('0x4'));var rp=require(_0x7967('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7967('0x6'));var attributes=require('./smsApplication.attributes');module[_0x7967('0x7')]=function(_0x2c95db,_0x40d405){return _0x2c95db[_0x7967('0x8')]('SmsApplication',attributes,{'tableName':_0x7967('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7967('0xa'),'collate':_0x7967('0xb')});}; \ No newline at end of file +var _0x8c5a=['sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsApplication.attributes','exports','SmsApplication'];(function(_0x336030,_0x4086ea){var _0x2b203b=function(_0x10b0ad){while(--_0x10b0ad){_0x336030['push'](_0x336030['shift']());}};_0x2b203b(++_0x4086ea);}(_0x8c5a,0x1b6));var _0xa8c5=function(_0x4bdfa9,_0x301dcd){_0x4bdfa9=_0x4bdfa9-0x0;var _0x40de34=_0x8c5a[_0x4bdfa9];return _0x40de34;};'use strict';var _=require(_0xa8c5('0x0'));var util=require(_0xa8c5('0x1'));var logger=require(_0xa8c5('0x2'))(_0xa8c5('0x3'));var moment=require(_0xa8c5('0x4'));var BPromise=require(_0xa8c5('0x5'));var rp=require(_0xa8c5('0x6'));var fs=require('fs');var path=require(_0xa8c5('0x7'));var rimraf=require('rimraf');var config=require(_0xa8c5('0x8'));var attributes=require(_0xa8c5('0x9'));module[_0xa8c5('0xa')]=function(_0x1ffc0d,_0x132476){return _0x1ffc0d['define'](_0xa8c5('0xb'),attributes,{'tableName':_0xa8c5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa8c5('0xd'),'collate':_0xa8c5('0xe')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 4a40971..2fc2bef 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 _0x794b=['SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info'];(function(_0x49eb23,_0xa64e13){var _0x450ca1=function(_0x269487){while(--_0x269487){_0x49eb23['push'](_0x49eb23['shift']());}};_0x450ca1(++_0xa64e13);}(_0x794b,0x1c2));var _0xb794=function(_0x5a98a8,_0x4c1bf9){_0x5a98a8=_0x5a98a8-0x0;var _0x5c019d=_0x794b[_0x5a98a8];return _0x5c019d;};'use strict';var _=require(_0xb794('0x0'));var util=require(_0xb794('0x1'));var moment=require('moment');var BPromise=require(_0xb794('0x2'));var rs=require(_0xb794('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb794('0x4'));var logger=require(_0xb794('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb794('0x6'));var client=jayson[_0xb794('0x7')][_0xb794('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20e4d4,_0x231206,_0x340863){return new BPromise(function(_0x5d099b,_0x30f03f){return client[_0xb794('0x9')](_0x20e4d4,_0x340863)[_0xb794('0xa')](function(_0xc3dde7){logger[_0xb794('0xb')](_0xb794('0xc'),_0x231206,_0xb794('0xd'));logger[_0xb794('0xe')](_0xb794('0xf'),_0x231206,_0xb794('0xd'),JSON[_0xb794('0x10')](_0xc3dde7));if(_0xc3dde7[_0xb794('0x11')]){if(_0xc3dde7[_0xb794('0x11')][_0xb794('0x12')]===0x1f4){logger[_0xb794('0x11')](_0xb794('0xc'),_0x231206,_0xc3dde7[_0xb794('0x11')][_0xb794('0x13')]);return _0x30f03f(_0xc3dde7[_0xb794('0x11')][_0xb794('0x13')]);}logger[_0xb794('0x11')]('SmsApplication,\x20%s,\x20%s',_0x231206,_0xc3dde7[_0xb794('0x11')][_0xb794('0x13')]);return _0x5d099b(_0xc3dde7[_0xb794('0x11')][_0xb794('0x13')]);}else{logger[_0xb794('0xb')](_0xb794('0xc'),_0x231206,'request\x20sent');_0x5d099b(_0xc3dde7[_0xb794('0x14')][_0xb794('0x13')]);}})['catch'](function(_0x408766){logger[_0xb794('0x11')]('SmsApplication,\x20%s,\x20%s',_0x231206,_0x408766);_0x30f03f(_0x408766);});});} \ No newline at end of file +var _0xb1fa=['code','error','message','catch','moment','randomstring','../../config/environment','request','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x423e4b,_0x1bb75b){var _0x626fd4=function(_0x1e731e){while(--_0x1e731e){_0x423e4b['push'](_0x423e4b['shift']());}};_0x626fd4(++_0x1bb75b);}(_0xb1fa,0x9e));var _0xab1f=function(_0x25fe88,_0x3307d7){_0x25fe88=_0x25fe88-0x0;var _0x14d5c6=_0xb1fa[_0x25fe88];return _0x14d5c6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xab1f('0x0'));var BPromise=require('bluebird');var rs=require(_0xab1f('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xab1f('0x2'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x463442,_0x54c5b0,_0x17e178){return new BPromise(function(_0x2fbc7e,_0x5213a4){return client[_0xab1f('0x3')](_0x463442,_0x17e178)['then'](function(_0x578cf7){logger[_0xab1f('0x4')](_0xab1f('0x5'),_0x54c5b0,_0xab1f('0x6'));logger[_0xab1f('0x7')](_0xab1f('0x8'),_0x54c5b0,'request\x20sent',JSON[_0xab1f('0x9')](_0x578cf7));if(_0x578cf7['error']){if(_0x578cf7['error'][_0xab1f('0xa')]===0x1f4){logger[_0xab1f('0xb')]('SmsApplication,\x20%s,\x20%s',_0x54c5b0,_0x578cf7['error'][_0xab1f('0xc')]);return _0x5213a4(_0x578cf7['error'][_0xab1f('0xc')]);}logger[_0xab1f('0xb')](_0xab1f('0x5'),_0x54c5b0,_0x578cf7['error'][_0xab1f('0xc')]);return _0x2fbc7e(_0x578cf7[_0xab1f('0xb')][_0xab1f('0xc')]);}else{logger[_0xab1f('0x4')]('SmsApplication,\x20%s,\x20%s',_0x54c5b0,_0xab1f('0x6'));_0x2fbc7e(_0x578cf7['result'][_0xab1f('0xc')]);}})[_0xab1f('0xd')](function(_0xcdba98){logger['error'](_0xab1f('0x5'),_0x54c5b0,_0xcdba98);_0x5213a4(_0xcdba98);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 47c716c..6ad4240 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 _0x3c81=['express','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','addTags','tracked','sms','update','delete','smsinteraction:destroy','destroy','/:id/tags','exports','multer','util','connect-timeout'];(function(_0x1abb95,_0x3a47d3){var _0xa65a62=function(_0x58ab39){while(--_0x58ab39){_0x1abb95['push'](_0x1abb95['shift']());}};_0xa65a62(++_0x3a47d3);}(_0x3c81,0x102));var _0x13c8=function(_0x34bf70,_0x38db47){_0x34bf70=_0x34bf70-0x0;var _0x6e4a20=_0x3c81[_0x34bf70];return _0x6e4a20;};'use strict';var multer=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var path=require('path');var timeout=require(_0x13c8('0x2'));var express=require(_0x13c8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x13c8('0x4'));var controller=require(_0x13c8('0x5'));router[_0x13c8('0x6')]('/',auth[_0x13c8('0x7')](),controller[_0x13c8('0x8')]);router[_0x13c8('0x6')](_0x13c8('0x9'),auth['isAuthenticated'](),controller[_0x13c8('0xa')]);router['get'](_0x13c8('0xb'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xc')]);router[_0x13c8('0x6')](_0x13c8('0xd'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xe')]);router[_0x13c8('0x6')](_0x13c8('0xf'),auth[_0x13c8('0x7')](),controller[_0x13c8('0x10')]);router[_0x13c8('0x11')]('/',auth[_0x13c8('0x7')](),controller[_0x13c8('0x12')]);router['post'](_0x13c8('0xd'),auth[_0x13c8('0x7')](),controller[_0x13c8('0x13')]);router[_0x13c8('0x11')]('/:id/tags',auth[_0x13c8('0x7')](),interaction['tracked']('sms','smsinteraction:addtags'),controller[_0x13c8('0x14')]);router['put'](_0x13c8('0xb'),auth[_0x13c8('0x7')](),interaction[_0x13c8('0x15')](_0x13c8('0x16'),'smsinteraction:update'),controller[_0x13c8('0x17')]);router[_0x13c8('0x18')](_0x13c8('0xb'),auth[_0x13c8('0x7')](),interaction[_0x13c8('0x15')](_0x13c8('0x16'),_0x13c8('0x19')),controller[_0x13c8('0x1a')]);router[_0x13c8('0x18')](_0x13c8('0x1b'),auth[_0x13c8('0x7')](),controller['removeTags']);module[_0x13c8('0x1c')]=router; \ No newline at end of file +var _0x4213=['download','post','create','/:id/messages','addMessage','/:id/tags','tracked','smsinteraction:addtags','put','smsinteraction:update','update','sms','smsinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x4213,0x77));var _0x3421=function(_0xb4f705,_0x39327b){_0xb4f705=_0xb4f705-0x0;var _0x48e5b6=_0x4213[_0xb4f705];return _0x48e5b6;};'use strict';var multer=require(_0x3421('0x0'));var util=require(_0x3421('0x1'));var path=require(_0x3421('0x2'));var timeout=require(_0x3421('0x3'));var express=require(_0x3421('0x4'));var router=express[_0x3421('0x5')]();var fs_extra=require(_0x3421('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3421('0x7'));var config=require('../../config/environment');var controller=require(_0x3421('0x8'));router[_0x3421('0x9')]('/',auth[_0x3421('0xa')](),controller[_0x3421('0xb')]);router['get'](_0x3421('0xc'),auth[_0x3421('0xa')](),controller[_0x3421('0xd')]);router[_0x3421('0x9')](_0x3421('0xe'),auth['isAuthenticated'](),controller[_0x3421('0xf')]);router['get']('/:id/messages',auth[_0x3421('0xa')](),controller['getMessages']);router[_0x3421('0x9')](_0x3421('0x10'),auth[_0x3421('0xa')](),controller[_0x3421('0x11')]);router[_0x3421('0x12')]('/',auth[_0x3421('0xa')](),controller[_0x3421('0x13')]);router['post'](_0x3421('0x14'),auth[_0x3421('0xa')](),controller[_0x3421('0x15')]);router[_0x3421('0x12')](_0x3421('0x16'),auth[_0x3421('0xa')](),interaction[_0x3421('0x17')]('sms',_0x3421('0x18')),controller['addTags']);router[_0x3421('0x19')](_0x3421('0xe'),auth['isAuthenticated'](),interaction[_0x3421('0x17')]('sms',_0x3421('0x1a')),controller[_0x3421('0x1b')]);router['delete'](_0x3421('0xe'),auth[_0x3421('0xa')](),interaction[_0x3421('0x17')](_0x3421('0x1c'),_0x3421('0x1d')),controller[_0x3421('0x1e')]);router[_0x3421('0x1f')](_0x3421('0x16'),auth[_0x3421('0xa')](),controller[_0x3421('0x20')]);module[_0x3421('0x21')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 3c4be0d..7cf78aa 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 _0xf611=['STRING','DATE','ENUM','out','moment','exports','BOOLEAN'];(function(_0x37c94f,_0x2f1a92){var _0x4463a1=function(_0x1004d9){while(--_0x1004d9){_0x37c94f['push'](_0x37c94f['shift']());}};_0x4463a1(++_0x2f1a92);}(_0xf611,0x7b));var _0x1f61=function(_0x5ac0f0,_0xee4d98){_0x5ac0f0=_0x5ac0f0-0x0;var _0x4aceec=_0xf611[_0x5ac0f0];return _0x4aceec;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x1f61('0x0'));module[_0x1f61('0x1')]={'closed':{'type':Sequelize[_0x1f61('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x1f61('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x1f61('0x3')]},'read1stAt':{'type':Sequelize[_0x1f61('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1f61('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x1f61('0x5')]('in',_0x1f61('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1f61('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x7a08=['moment','DATE','STRING','ENUM','out','BOOLEAN','sequelize'];(function(_0x3bb45b,_0x2dcc0b){var _0x513162=function(_0x46f44b){while(--_0x46f44b){_0x3bb45b['push'](_0x3bb45b['shift']());}};_0x513162(++_0x2dcc0b);}(_0x7a08,0x11e));var _0x87a0=function(_0xbd1f60,_0x470e77){_0xbd1f60=_0xbd1f60-0x0;var _0x25802f=_0x7a08[_0xbd1f60];return _0x25802f;};'use strict';var Sequelize=require(_0x87a0('0x0'));var moment=require(_0x87a0('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x87a0('0x2')]},'disposition':{'type':Sequelize[_0x87a0('0x3')]},'secondDisposition':{'type':Sequelize[_0x87a0('0x3')]},'thirdDisposition':{'type':Sequelize[_0x87a0('0x3')]},'note':{'type':Sequelize[_0x87a0('0x3')]},'phone':{'type':Sequelize[_0x87a0('0x3')]},'read1stAt':{'type':Sequelize[_0x87a0('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x87a0('0x4')]('in',_0x87a0('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x87a0('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x87a0('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x87a0('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 3766265..f42a985 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 _0xb1ef=['contactName','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','agent','sequelize','toString','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','push','all','rows','show','intersection','includeAll','include','options','create','params','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','$gte','format','findAll','addTags','setTags','spread','smsInteractionTags:save','removeTags','download','unix','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','User','fullname','CmContact','firstName','lastName','direction','secret','SmsAccount','Account','get','mkdirSync','Sms','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','disposition','out','System','renderFile','views','transcript-','.pdf','createPdfFromHTML','log','err','eml-format','zip-dir','fast-json-patch','moment','mustache','util','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','Users','map','TagIds','Tags','split','forEach','catch','index','SmsInteraction','rawAttributes','fieldName','key','model','query','keys','attributes','fields','length','order','sort','where','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','u.id\x20=\x20ui.UserId','sms_interactions','left_join','cm_contacts','users','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','value','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','type','body','some','isEmpty','SmsAccountId','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages'];(function(_0x53a7af,_0x1408a5){var _0x3cc7f6=function(_0x4bf101){while(--_0x4bf101){_0x53a7af['push'](_0x53a7af['shift']());}};_0x3cc7f6(++_0x1408a5);}(_0xb1ef,0x146));var _0xfb1e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb1ef[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0xfb1e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfb1e('0x1'));var jsonpatch=require(_0xfb1e('0x2'));var rp=require('request-promise');var moment=require(_0xfb1e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfb1e('0x4'));var util=require(_0xfb1e('0x5'));var path=require('path');var sox=require(_0xfb1e('0x6'));var csv=require('to-csv');var ejs=require(_0xfb1e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfb1e('0x8'));var crypto=require(_0xfb1e('0x9'));var jsforce=require(_0xfb1e('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xfb1e('0xb'));var querystring=require(_0xfb1e('0xc'));var Papa=require(_0xfb1e('0xd'));var Redis=require('ioredis');var authService=require(_0xfb1e('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xfb1e('0xf'));var pdf=require(_0xfb1e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfb1e('0x11'))(_0xfb1e('0x12'));var utils=require(_0xfb1e('0x13'));var config=require(_0xfb1e('0x14'));var licenseUtil=require(_0xfb1e('0x15'));var db=require(_0xfb1e('0x16'))['db'];config[_0xfb1e('0x17')]=_['defaults'](config[_0xfb1e('0x17')],{'host':_0xfb1e('0x18'),'port':0x18eb});var socket=require(_0xfb1e('0x19'))(new Redis(config[_0xfb1e('0x17')]));require(_0xfb1e('0x1a'))[_0xfb1e('0x1b')](socket);function respondWithStatusCode(_0x5201f1,_0x138f71){_0x138f71=_0x138f71||0xcc;return function(_0x70a008){if(_0x70a008){return _0x5201f1['sendStatus'](_0x138f71);}return _0x5201f1[_0xfb1e('0x1c')](_0x138f71)[_0xfb1e('0x1d')]();};}function respondWithResult(_0x3c7277,_0x338b9a){_0x338b9a=_0x338b9a||0xc8;return function(_0x2e312b){if(_0x2e312b){return _0x3c7277[_0xfb1e('0x1c')](_0x338b9a)[_0xfb1e('0x1e')](_0x2e312b);}};}function respondWithFilteredResult(_0x4d1a45,_0x1820e2){return function(_0x18909e){if(_0x18909e){var _0x2ed8a0=typeof _0x1820e2[_0xfb1e('0x1f')]===_0xfb1e('0x20')&&typeof _0x1820e2[_0xfb1e('0x21')]===_0xfb1e('0x20');var _0x27c705=_0x18909e['count'];var _0x41c882=_0x2ed8a0?0x0:_0x1820e2[_0xfb1e('0x1f')];var _0x2b8c7b=_0x2ed8a0?_0x18909e[_0xfb1e('0x22')]:_0x1820e2['offset']+_0x1820e2[_0xfb1e('0x21')];var _0x23f138;if(_0x2b8c7b>=_0x27c705){_0x2b8c7b=_0x27c705;_0x23f138=0xc8;}else{_0x23f138=0xce;}_0x4d1a45['status'](_0x23f138);return _0x4d1a45[_0xfb1e('0x23')](_0xfb1e('0x24'),_0x41c882+'-'+_0x2b8c7b+'/'+_0x27c705)[_0xfb1e('0x1e')](_0x18909e);}return null;};}function patchUpdates(_0x3efb79){return function(_0x3bdd80){try{jsonpatch[_0xfb1e('0x25')](_0x3bdd80,_0x3efb79,!![]);}catch(_0x26c7e4){return BPromise[_0xfb1e('0x26')](_0x26c7e4);}return _0x3bdd80[_0xfb1e('0x27')]();};}function saveUpdates(_0x5d2d1a,_0x507909){return function(_0x561455){if(_0x561455){return _0x561455[_0xfb1e('0x28')](_0x5d2d1a)['then'](function(_0x3eb09d){return _0x3eb09d;});}return null;};}function removeEntity(_0x16c328,_0x27abb3){return function(_0x1cf77e){if(_0x1cf77e){return _0x1cf77e[_0xfb1e('0x29')]()[_0xfb1e('0x2a')](function(){_0x16c328[_0xfb1e('0x1c')](0xcc)[_0xfb1e('0x1d')]();});}};}function handleEntityNotFound(_0x538083,_0x447a93){return function(_0x260eb2){if(!_0x260eb2){_0x538083[_0xfb1e('0x2b')](0x194);}return _0x260eb2;};}function handleError(_0x25fe9d,_0x3b891c){_0x3b891c=_0x3b891c||0x1f4;return function(_0x483f67){logger[_0xfb1e('0x2c')](_0x483f67[_0xfb1e('0x2d')]);if(_0x483f67[_0xfb1e('0x2e')]){delete _0x483f67[_0xfb1e('0x2e')];}_0x25fe9d[_0xfb1e('0x1c')](_0x3b891c)[_0xfb1e('0x2f')](_0x483f67);};}function getInteractionUsers(_0x40b534,_0x496942){return new BPromise(function(_0x466833,_0x399de0){try{if(_0x496942[_0x40b534['id']]){_0x40b534[_0xfb1e('0x30')]=_[_0xfb1e('0x31')](_0x496942[_0x40b534['id']],function(_0xc30036){return{'id':_0xc30036['id'],'fullname':_0xc30036['fullname']};});}}catch(_0x3048e3){_0x399de0(_0x3048e3);}_0x466833(_0x40b534);});}function getInteractionTags(_0x1b4d3b,_0xd8abfd){return new BPromise(function(_0x47d5c4,_0x4aecca){try{if(_0x1b4d3b[_0xfb1e('0x32')]){_0x1b4d3b[_0xfb1e('0x33')]=[];_0x1b4d3b[_0xfb1e('0x32')][_0xfb1e('0x34')](',')[_0xfb1e('0x35')](function(_0x31890d){_0x1b4d3b['Tags']['push'](_0xd8abfd[_0x31890d]);});}delete _0x1b4d3b[_0xfb1e('0x32')];}catch(_0x5a0dc6){_0x4aecca(_0x5a0dc6);}_0x47d5c4(_0x1b4d3b);});}function updateSmsInteraction(_0x3111b8,_0x58a476,_0x4c51d4){return new BPromise(function(_0x555537,_0x31ed6b){return getInteractionUsers(_0x3111b8,_0x4c51d4)[_0xfb1e('0x2a')](function(_0x178abf){return getInteractionTags(_0x178abf,_0x58a476);})[_0xfb1e('0x2a')](function(_0x40024b){_0x555537(_0x40024b);})[_0xfb1e('0x36')](function(_0x3bcaf6){_0x31ed6b(_0x3bcaf6);});});}exports[_0xfb1e('0x37')]=function(_0x27d5dc,_0x3ac27a){var _0x438ba0={},_0x8f58b7={},_0x4a0e0f={'count':0x0,'rows':[]};var _0x3e6608=_[_0xfb1e('0x31')](db[_0xfb1e('0x38')][_0xfb1e('0x39')],function(_0x99abcf){return{'name':_0x99abcf[_0xfb1e('0x3a')],'type':_0x99abcf['type'][_0xfb1e('0x3b')]};});_0x8f58b7[_0xfb1e('0x3c')]=_['map'](_0x3e6608,_0xfb1e('0x2e'));_0x8f58b7[_0xfb1e('0x3d')]=_[_0xfb1e('0x3e')](_0x27d5dc[_0xfb1e('0x3d')]);_0x8f58b7['filters']=_['intersection'](_0x8f58b7[_0xfb1e('0x3c')],_0x8f58b7['query']);_0x438ba0[_0xfb1e('0x3f')]=_['intersection'](_0x8f58b7[_0xfb1e('0x3c')],qs[_0xfb1e('0x40')](_0x27d5dc[_0xfb1e('0x3d')][_0xfb1e('0x40')]));_0x438ba0[_0xfb1e('0x3f')]=_0x438ba0['attributes'][_0xfb1e('0x41')]?_0x438ba0[_0xfb1e('0x3f')]:_0x8f58b7[_0xfb1e('0x3c')];if(!_0x27d5dc['query']['hasOwnProperty']('nolimit')){_0x438ba0[_0xfb1e('0x21')]=qs[_0xfb1e('0x21')](_0x27d5dc[_0xfb1e('0x3d')]['limit']);_0x438ba0[_0xfb1e('0x1f')]=qs[_0xfb1e('0x1f')](_0x27d5dc[_0xfb1e('0x3d')][_0xfb1e('0x1f')]);}_0x438ba0[_0xfb1e('0x42')]=qs['sort'](_0x27d5dc[_0xfb1e('0x3d')][_0xfb1e('0x43')]);_0x438ba0[_0xfb1e('0x44')]=qs[_0xfb1e('0x45')](_[_0xfb1e('0x46')](_0x27d5dc[_0xfb1e('0x3d')],_0x8f58b7[_0xfb1e('0x45')]),_0x3e6608);var _0x47f955=[];var _0x4fe474=squel[_0xfb1e('0x47')]()[_0xfb1e('0x48')]('id')[_0xfb1e('0x48')](_0xfb1e('0x2e'))['field'](_0xfb1e('0x49'))[_0xfb1e('0x4a')](_0xfb1e('0x4b'));var _0x1f9080=squel[_0xfb1e('0x47')]()[_0xfb1e('0x48')](_0xfb1e('0x4c'))['field'](_0xfb1e('0x4d'))[_0xfb1e('0x48')](_0xfb1e('0x4e'))[_0xfb1e('0x4a')]('user_has_sms_interactions','ui')['left_join']('users','u',_0xfb1e('0x4f'));var _0x9293a7=squel['select']()[_0xfb1e('0x4a')](_0xfb1e('0x50'),'i')[_0xfb1e('0x51')](_0xfb1e('0x52'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xfb1e('0x51')](_0xfb1e('0x53'),'o',_0xfb1e('0x54'))['left_join'](_0xfb1e('0x55'),'a',_0xfb1e('0x56'))[_0xfb1e('0x51')](_0xfb1e('0x57'),'me',_0xfb1e('0x58'))[_0xfb1e('0x51')]('sms_interaction_has_tags','it','it.SmsInteractionId\x20=\x20i.id')['left_join'](_0xfb1e('0x4b'),'t',_0xfb1e('0x59'));var _0xddc426=squel[_0xfb1e('0x5a')]();var _0x576d38=[];var _0x119c71=squel[_0xfb1e('0x5a')]();var _0x336129;if(_0x27d5dc[_0xfb1e('0x3d')][_0xfb1e('0x5b')]){_0x336129=as[_0xfb1e('0x5c')](_0x27d5dc[_0xfb1e('0x3d')][_0xfb1e('0x5b')]);var _0x28c35a=_0x336129[_0xfb1e('0x5d')];for(var _0x24b093=0x0;_0x24b093<_0x336129[_0xfb1e('0x5e')]['length'];_0x24b093++){var _0x95299d=_0x336129[_0xfb1e('0x5e')][_0x24b093];var _0x49b6ad='i';var _0x24ecc0=_['find'](_0x3e6608,[_0xfb1e('0x2e'),_0x95299d['field']]);if(!_0x24ecc0){switch(_0x95299d['field']){case'unreadMessages':if(_0x95299d[_0xfb1e('0x5f')]==0x1){_0x9293a7['having']('`'+_0x95299d[_0xfb1e('0x48')]+'`\x20=\x200');}else{_0x9293a7['having']('`'+_0x95299d['field']+_0xfb1e('0x60'));}break;case _0xfb1e('0x61'):if(_0x95299d[_0xfb1e('0x62')]===_0xfb1e('0x63')){if(_0x95299d[_0xfb1e('0x5f')]['split']('\x20')[_0xfb1e('0x41')]>0x1){_0xddc426[_0x28c35a](_0xfb1e('0x64'),qs['getFullTextValue'](_0x95299d[_0xfb1e('0x5f')]),null);}else{var _0xf4e328='%'+_0x95299d[_0xfb1e('0x5f')]+'%';_0xddc426[_0x28c35a](_0xfb1e('0x65'),_0xf4e328,_0xf4e328,_0xf4e328);}}else{_0x24ecc0=_[_0xfb1e('0x66')](_0x3e6608,[_0xfb1e('0x2e'),_0xfb1e('0x67')]);_0x95299d[_0xfb1e('0x48')]='ContactId';_0x3ddd79=as[_0xfb1e('0x68')](_0x49b6ad,_0x24ecc0['type'],_0x95299d);_0xddc426[_0x28c35a](_0x3ddd79[_0xfb1e('0x69')],_0x3ddd79[_0xfb1e('0x5f')][_0xfb1e('0x6a')],_0x3ddd79[_0xfb1e('0x5f')]['end']);}break;case _0xfb1e('0x6b'):var _0x2719a6=_0x95299d[_0xfb1e('0x5f')][_0xfb1e('0x34')](',')[_0xfb1e('0x31')](function(_0x158a96){return Number(_0x158a96);});_0x2719a6[_0xfb1e('0x35')](function(_0x40c055){_0x119c71['or'](_0xfb1e('0x6c'),'%,'+_0x40c055+',%');});_0x576d38=_[_0xfb1e('0x6d')](_0x576d38,_0x2719a6);break;case'User':if(_0x95299d[_0xfb1e('0x62')]==='$substring'){_0xddc426[_0x28c35a](_0xfb1e('0x6e'),'%'+_0x95299d['value']+'%',null);}else{_0x24ecc0=_[_0xfb1e('0x66')](_0x3e6608,['name',_0xfb1e('0x6f')]);_0x95299d['field']=_0xfb1e('0x6f');_0x3ddd79=as[_0xfb1e('0x68')](_0x49b6ad,_0x24ecc0[_0xfb1e('0x70')],_0x95299d);_0xddc426[_0x28c35a](_0x3ddd79[_0xfb1e('0x69')],_0x3ddd79[_0xfb1e('0x5f')][_0xfb1e('0x6a')],_0x3ddd79[_0xfb1e('0x5f')][_0xfb1e('0x1d')]);}break;case _0xfb1e('0x71'):_0x3ddd79=as[_0xfb1e('0x68')]('me',null,_0x95299d);_0xddc426[_0x28c35a](_0x3ddd79[_0xfb1e('0x69')],_0x3ddd79[_0xfb1e('0x5f')][_0xfb1e('0x6a')],_0x3ddd79[_0xfb1e('0x5f')]['end']);break;}}else{var _0x3ddd79=as['buildExpression'](_0x49b6ad,_0x24ecc0[_0xfb1e('0x70')],_0x95299d);_0xddc426[_0x28c35a](_0x3ddd79[_0xfb1e('0x69')],_0x3ddd79['value']['start'],_0x3ddd79['value'][_0xfb1e('0x1d')]);}}}else{var _0x635734=_(_0x27d5dc['query'])[_0xfb1e('0x3e')]()[_0xfb1e('0x31')](function(_0x522901){return _[_0xfb1e('0x72')](_0x3e6608,[_0xfb1e('0x2e'),_0x522901])?_0x522901:undefined;})['compact']()[_0xfb1e('0x5f')]();if(!_[_0xfb1e('0x73')](_0x635734)){_0x635734[_0xfb1e('0x35')](function(_0x429754){if(_0x429754===_0xfb1e('0x74')){_0x9293a7[_0xfb1e('0x44')]('i.SmsAccountId\x20IN\x20?',[][_0xfb1e('0x75')](_0x27d5dc[_0xfb1e('0x3d')][_0x429754]));}else if(_0x429754===_0xfb1e('0x76')){var _0x1bd37c=JSON[_0xfb1e('0x77')](_0x27d5dc[_0xfb1e('0x3d')][_0x429754])['$gte'];var _0x7017f8=JSON[_0xfb1e('0x77')](_0x27d5dc[_0xfb1e('0x3d')][_0x429754])[_0xfb1e('0x78')];_0x9293a7[_0xfb1e('0x44')](_0xfb1e('0x79'),_0x1bd37c,_0x7017f8);}else{if(_0x27d5dc[_0xfb1e('0x3d')][_0x429754]===_0xfb1e('0x7a')){_0x9293a7[_0xfb1e('0x44')]('i.'+_0x429754+'\x20IS\x20NULL');}else{_0x9293a7[_0xfb1e('0x44')]('i.'+_0x429754+_0xfb1e('0x7b'),_0x27d5dc['query'][_0x429754]);}}});}if(_0x27d5dc['query'][_0xfb1e('0x7c')]){if(_0x27d5dc[_0xfb1e('0x3d')][_0xfb1e('0x7c')]==0x1){_0x9293a7[_0xfb1e('0x7d')](_0xfb1e('0x7e'));}else{_0x9293a7['having'](_0xfb1e('0x7f'));}}if(_0x27d5dc[_0xfb1e('0x3d')][_0xfb1e('0x80')]){_0x576d38=_[_0xfb1e('0x81')](_0x27d5dc[_0xfb1e('0x3d')][_0xfb1e('0x80')])?_0x27d5dc[_0xfb1e('0x3d')][_0xfb1e('0x80')]:new Array(_0x27d5dc[_0xfb1e('0x3d')][_0xfb1e('0x80')]);_0x576d38[_0xfb1e('0x35')](function(_0x496ea1){_0x119c71['or'](_0xfb1e('0x6c'),'%,'+_0x496ea1+',%');});}if(_0x27d5dc['query'][_0xfb1e('0x82')]){var _0x1341af=_0x27d5dc['query'][_0xfb1e('0x82')][_0xfb1e('0x83')]('\x5c','\x5c\x5c')[_0xfb1e('0x83')](/'/g,'\x27\x27');if(qs[_0xfb1e('0x84')](_0x1341af)){_0xddc426['or'](_0xfb1e('0x85'),_0x1341af+'%')['or'](_0xfb1e('0x86'),_0x1341af+'%');}else{_0xddc426['or'](_0xfb1e('0x87'),qs[_0xfb1e('0x88')](_0x1341af))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x1341af+'%');}}}_0x9293a7[_0xfb1e('0x44')](_0xddc426);_0x9293a7[_0xfb1e('0x89')](_0xfb1e('0x8a'));var _0x2f5a18={'type':db[_0xfb1e('0x8b')]['QueryTypes'][_0xfb1e('0x8c')],'raw':!![]};var _0x154165=_0x9293a7[_0xfb1e('0x8d')]();_0x154165[_0xfb1e('0x48')]('i.id');_0x154165[_0xfb1e('0x48')](_0xfb1e('0x8e'),_0xfb1e('0x8f'));if(_0x438ba0[_0xfb1e('0x42')]){_0x438ba0['order'][_0xfb1e('0x35')](function(_0x570a8e){var _0x154ab7=_0x570a8e[0x0]===_0xfb1e('0x90')?_0x570a8e[0x0]:'i.'+_0x570a8e[0x0];_0x9293a7[_0xfb1e('0x42')](_0x154ab7,_0x570a8e[0x1]==='DESC'?![]:!![]);});}if(!_[_0xfb1e('0x73')](_0x576d38)){_0x9293a7[_0xfb1e('0x7d')](_0x119c71);_0x154165[_0xfb1e('0x44')]('t.id\x20IN\x20?',_0x576d38);}BPromise['resolve']()[_0xfb1e('0x2a')](function(){if(!_0x336129){if(_0x27d5dc[_0xfb1e('0x3d')][_0xfb1e('0x74')])return;_0x154165['where'](_0xfb1e('0x91'));_0x9293a7['where'](_0xfb1e('0x91'));return;}if(_0x27d5dc[_0xfb1e('0x92')][_0xfb1e('0x93')]!=='agent')return;return _0x27d5dc[_0xfb1e('0x92')][_0xfb1e('0x94')]({'attributes':['id'],'raw':!![]})[_0xfb1e('0x2a')](function(_0x3ca46d){if(_[_0xfb1e('0x73')](_0x3ca46d)){_0x154165['where'](_0xfb1e('0x95'));_0x9293a7[_0xfb1e('0x44')](_0xfb1e('0x95'));}else{_0x154165[_0xfb1e('0x44')](_0xfb1e('0x96'),_[_0xfb1e('0x31')](_0x3ca46d,'id'));_0x9293a7[_0xfb1e('0x44')](_0xfb1e('0x96'),_['map'](_0x3ca46d,'id'));}});})[_0xfb1e('0x2a')](function(){if(_0x27d5dc[_0xfb1e('0x92')][_0xfb1e('0x93')]===_0xfb1e('0x97')&&!_0x336129&&!_0x27d5dc[_0xfb1e('0x3d')][_0xfb1e('0x74')])return[];return db[_0xfb1e('0x98')][_0xfb1e('0x3d')](_0x154165[_0xfb1e('0x99')](),_0x2f5a18);})[_0xfb1e('0x2a')](function(_0x2be7ff){_0x4a0e0f[_0xfb1e('0x22')]=_0x2be7ff[_0xfb1e('0x41')];if(_0x4a0e0f['count']===0x0)return[];return db['sequelize'][_0xfb1e('0x3d')](_0x4fe474[_0xfb1e('0x99')](),_0x2f5a18)[_0xfb1e('0x2a')](function(_0x3028ab){_0x47f955=_['keyBy'](_0x3028ab,'id');_0x2f5a18=_[_0xfb1e('0x9a')](_0x2f5a18,{'model':db[_0xfb1e('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x27d5dc[_0xfb1e('0x3d')][_0xfb1e('0x40')]){_0x438ba0['attributes'][_0xfb1e('0x35')](function(_0x3eafbb){_0x9293a7[_0xfb1e('0x48')]('i.'+_0x3eafbb);});}else{_0x9293a7[_0xfb1e('0x48')](_0xfb1e('0x8e'),_0xfb1e('0x8f'));_0x9293a7[_0xfb1e('0x48')](_0xfb1e('0x9b'),_0xfb1e('0x9c'));_0x9293a7[_0xfb1e('0x48')](_0xfb1e('0x9d'),_0xfb1e('0x9e'));_0x9293a7['field']('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',_0xfb1e('0x90'));_0x9293a7[_0xfb1e('0x48')](_0xfb1e('0x9f'));_0x9293a7[_0xfb1e('0x48')](_0xfb1e('0xa0'),_0xfb1e('0xa1'));_0x9293a7[_0xfb1e('0x48')](_0xfb1e('0xa2'),'Contact.lastName');_0x9293a7[_0xfb1e('0x48')](_0xfb1e('0xa3'),_0xfb1e('0xa4'));_0x9293a7['field'](_0xfb1e('0xa5'),_0xfb1e('0xa6'));_0x9293a7[_0xfb1e('0x48')](_0xfb1e('0xa7'),'Contact.mobile');_0x9293a7[_0xfb1e('0x48')](_0xfb1e('0xa8'),_0xfb1e('0xa9'));_0x9293a7['field']('o.fullname','Owner.fullname');_0x9293a7[_0xfb1e('0x48')]('o.internal',_0xfb1e('0xaa'));_0x9293a7[_0xfb1e('0x48')](_0xfb1e('0xab'),_0xfb1e('0x32'));}if(_0x438ba0[_0xfb1e('0x21')])_0x9293a7[_0xfb1e('0x21')](_0x438ba0['limit']);if(_0x438ba0[_0xfb1e('0x1f')])_0x9293a7[_0xfb1e('0x1f')](_0x438ba0[_0xfb1e('0x1f')]);return db['sequelize']['query'](_0x9293a7[_0xfb1e('0x99')](),_0x2f5a18);})[_0xfb1e('0x2a')](function(_0x35c7a2){if(_0x35c7a2[_0xfb1e('0x41')]>0x0)_0x1f9080[_0xfb1e('0x44')](_0xfb1e('0xac'),_[_0xfb1e('0x31')](_0x35c7a2,'id'));return db[_0xfb1e('0x98')][_0xfb1e('0x3d')](_0x1f9080['toString'](),_0x2f5a18)[_0xfb1e('0x2a')](function(_0x2028be){var _0x229ca6=_['groupBy'](_0x2028be,_0xfb1e('0xad'));var _0x4f0ccf=[];_0x35c7a2['forEach'](function(_0x28e5e0){_0x4f0ccf[_0xfb1e('0xae')](updateSmsInteraction(_0x28e5e0,_0x47f955,_0x229ca6));});return BPromise[_0xfb1e('0xaf')](_0x4f0ccf);});});})[_0xfb1e('0x2a')](function(_0x7254b2){_0x4a0e0f[_0xfb1e('0xb0')]=_0x7254b2;return _0x4a0e0f;})[_0xfb1e('0x2a')](respondWithFilteredResult(_0x3ac27a,_0x438ba0))['catch'](handleError(_0x3ac27a,null));};exports[_0xfb1e('0xb1')]=function(_0x5d95cf,_0x56478d){var _0x49c140={'raw':![],'where':{'id':_0x5d95cf['params']['id']}},_0x590efc={};_0x590efc[_0xfb1e('0x3c')]=_[_0xfb1e('0x3e')](db[_0xfb1e('0x38')]['rawAttributes']);_0x590efc[_0xfb1e('0x3d')]=_['keys'](_0x5d95cf['query']);_0x590efc[_0xfb1e('0x45')]=_[_0xfb1e('0xb2')](_0x590efc[_0xfb1e('0x3c')],_0x590efc[_0xfb1e('0x3d')]);_0x49c140[_0xfb1e('0x3f')]=_[_0xfb1e('0xb2')](_0x590efc[_0xfb1e('0x3c')],qs[_0xfb1e('0x40')](_0x5d95cf['query'][_0xfb1e('0x40')]));_0x49c140['attributes']=_0x49c140[_0xfb1e('0x3f')][_0xfb1e('0x41')]?_0x49c140[_0xfb1e('0x3f')]:_0x590efc['model'];if(_0x5d95cf[_0xfb1e('0x3d')][_0xfb1e('0xb3')]){_0x49c140[_0xfb1e('0xb4')]=[{'all':!![]}];}_0x49c140=_[_0xfb1e('0x9a')]({},_0x49c140,_0x5d95cf[_0xfb1e('0xb5')]);return db[_0xfb1e('0x38')][_0xfb1e('0x66')](_0x49c140)[_0xfb1e('0x2a')](handleEntityNotFound(_0x56478d,null))['then'](respondWithResult(_0x56478d,null))[_0xfb1e('0x36')](handleError(_0x56478d,null));};exports[_0xfb1e('0xb6')]=function(_0x1e2153,_0x3d6f82){return db[_0xfb1e('0x38')][_0xfb1e('0xb6')](_0x1e2153[_0xfb1e('0x71')],{})[_0xfb1e('0x2a')](respondWithResult(_0x3d6f82,0xc9))[_0xfb1e('0x36')](handleError(_0x3d6f82,null));};exports[_0xfb1e('0x28')]=function(_0x1294ae,_0x14c852){if(_0x1294ae[_0xfb1e('0x71')]['id']){delete _0x1294ae['body']['id'];}return db[_0xfb1e('0x38')]['find']({'where':{'id':_0x1294ae[_0xfb1e('0xb7')]['id']}})[_0xfb1e('0x2a')](handleEntityNotFound(_0x14c852,null))[_0xfb1e('0x2a')](saveUpdates(_0x1294ae['body'],null))[_0xfb1e('0x2a')](respondWithResult(_0x14c852,null))[_0xfb1e('0x36')](handleError(_0x14c852,null));};exports['destroy']=function(_0x25ad7f,_0x1c3059){return db[_0xfb1e('0x38')][_0xfb1e('0x66')]({'where':{'id':_0x25ad7f['params']['id']}})[_0xfb1e('0x2a')](handleEntityNotFound(_0x1c3059,null))['then'](removeEntity(_0x1c3059,null))['catch'](handleError(_0x1c3059,null));};exports[_0xfb1e('0xb8')]=function(_0x55c991,_0x2471a1){return db[_0xfb1e('0x38')][_0xfb1e('0xb8')]()[_0xfb1e('0x2a')](respondWithResult(_0x2471a1,null))[_0xfb1e('0x36')](handleError(_0x2471a1,null));};exports[_0xfb1e('0xb9')]=function(_0x49741d,_0x142ff4,_0x574638){return db[_0xfb1e('0xba')]['find']({'where':{'id':_0x49741d['params']['id']}})[_0xfb1e('0x2a')](handleEntityNotFound(_0x142ff4,null))[_0xfb1e('0x2a')](function(_0x44b027){if(_0x44b027){return _0x44b027[_0xfb1e('0xb9')](_0x49741d[_0xfb1e('0x71')][_0xfb1e('0xbb')],_[_0xfb1e('0xbc')](_0x49741d[_0xfb1e('0x71')],[_0xfb1e('0xbb'),'id'])||{});}})['then'](respondWithResult(_0x142ff4,null))[_0xfb1e('0x36')](handleError(_0x142ff4,null));};exports[_0xfb1e('0xbd')]=function(_0x22fe46,_0x30d01e,_0xd4baf3){var _0x275d59={'raw':![],'where':{}};var _0x4ee58d={};var _0x41db91={'count':0x0,'rows':[]};return db[_0xfb1e('0x38')][_0xfb1e('0xbe')]({'where':{'id':_0x22fe46[_0xfb1e('0xb7')]['id']}})[_0xfb1e('0x2a')](handleEntityNotFound(_0x30d01e,null))[_0xfb1e('0x2a')](function(_0x415fe6){if(_0x415fe6){_0x4ee58d[_0xfb1e('0x3c')]=_[_0xfb1e('0x3e')](db[_0xfb1e('0xba')][_0xfb1e('0x39')]);_0x4ee58d[_0xfb1e('0x3d')]=_[_0xfb1e('0x3e')](_0x22fe46[_0xfb1e('0x3d')]);_0x4ee58d[_0xfb1e('0x45')]=_[_0xfb1e('0xb2')](_0x4ee58d[_0xfb1e('0x3c')],_0x4ee58d['query']);_0x275d59[_0xfb1e('0x3f')]=_['intersection'](_0x4ee58d['model'],qs['fields'](_0x22fe46[_0xfb1e('0x3d')][_0xfb1e('0x40')]));_0x275d59[_0xfb1e('0x3f')]=_0x275d59[_0xfb1e('0x3f')][_0xfb1e('0x41')]?_0x275d59['attributes']:_0x4ee58d['model'];if(!_0x22fe46[_0xfb1e('0x3d')][_0xfb1e('0xbf')](_0xfb1e('0xc0'))){_0x275d59[_0xfb1e('0x21')]=qs[_0xfb1e('0x21')](_0x22fe46[_0xfb1e('0x3d')][_0xfb1e('0x21')]);_0x275d59[_0xfb1e('0x1f')]=qs[_0xfb1e('0x1f')](_0x22fe46[_0xfb1e('0x3d')][_0xfb1e('0x1f')]);}_0x275d59['order']=qs[_0xfb1e('0x43')](_0x22fe46[_0xfb1e('0x3d')][_0xfb1e('0x43')]);_0x275d59[_0xfb1e('0x44')]=qs[_0xfb1e('0x45')](_['pick'](_0x22fe46[_0xfb1e('0x3d')],_0x4ee58d[_0xfb1e('0x45')]));_0x275d59['where'][_0xfb1e('0xad')]=_0x415fe6['id'];if(_0x22fe46[_0xfb1e('0x3d')][_0xfb1e('0x82')]){_0x275d59[_0xfb1e('0x44')]=_[_0xfb1e('0x9a')](_0x275d59['where'],{'$or':_['map'](_0x275d59[_0xfb1e('0x3f')],function(_0xd67e63){var _0x92838e={};_0x92838e[_0xd67e63]={'$like':'%'+_0x22fe46[_0xfb1e('0x3d')]['filter']+'%'};return _0x92838e;})});}if(_0x22fe46[_0xfb1e('0x3d')][_0xfb1e('0xc1')]){var _0x1af8d6=_0x22fe46['query']['$gte'][_0xfb1e('0x34')](',');var _0x516ce5={};_0x516ce5[_0x1af8d6[0x0]]={'$gte':moment(_0x1af8d6[0x1])[_0xfb1e('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')};_0x275d59[_0xfb1e('0x44')]=_['merge'](_0x275d59[_0xfb1e('0x44')],_0x516ce5);}_0x275d59=_[_0xfb1e('0x9a')]({},_0x275d59,_0x22fe46['options']);return db[_0xfb1e('0xba')][_0xfb1e('0x22')]({'where':_0x275d59[_0xfb1e('0x44')]})[_0xfb1e('0x2a')](function(_0x229133){_0x41db91[_0xfb1e('0x22')]=_0x229133;if(_0x22fe46['query'][_0xfb1e('0xb3')]){_0x275d59['include']=[{'all':!![]}];}return db[_0xfb1e('0xba')][_0xfb1e('0xc3')](_0x275d59);})['then'](function(_0x33de8e){_0x41db91[_0xfb1e('0xb0')]=_0x33de8e;return _0x41db91;});}})[_0xfb1e('0x2a')](respondWithFilteredResult(_0x30d01e,_0x275d59))[_0xfb1e('0x36')](handleError(_0x30d01e,null));};exports[_0xfb1e('0xc4')]=function(_0x287c9e,_0x59cf6e,_0x5bfcf2){return db[_0xfb1e('0x38')][_0xfb1e('0x66')]({'where':{'id':_0x287c9e['params']['id']}})[_0xfb1e('0x2a')](handleEntityNotFound(_0x59cf6e,null))[_0xfb1e('0x2a')](function(_0x4e174b){if(_0x4e174b){return _0x4e174b[_0xfb1e('0xc5')](_0x287c9e[_0xfb1e('0x71')][_0xfb1e('0xbb')],_[_0xfb1e('0xbc')](_0x287c9e[_0xfb1e('0x71')],[_0xfb1e('0xbb'),'id'])||{})[_0xfb1e('0xc6')](function(){return db['Tag'][_0xfb1e('0xc3')]({'attributes':['id',_0xfb1e('0x2e'),_0xfb1e('0x49')],'where':{'id':_0x287c9e[_0xfb1e('0x71')][_0xfb1e('0xbb')]}});})[_0xfb1e('0x2a')](function(_0x220f18){socket['emit'](_0xfb1e('0xc7'),{'id':Number(_0x287c9e[_0xfb1e('0xb7')]['id']),'tags':_0x220f18||[]});return{'id':Number(_0x287c9e[_0xfb1e('0xb7')]['id']),'tags':_0x220f18||[]};});}})[_0xfb1e('0x2a')](respondWithResult(_0x59cf6e,null))[_0xfb1e('0x36')](handleError(_0x59cf6e,null));};exports[_0xfb1e('0xc8')]=function(_0x163ff6,_0x8be1af,_0x413533){return db[_0xfb1e('0x38')][_0xfb1e('0x66')]({'where':{'id':_0x163ff6[_0xfb1e('0xb7')]['id']}})[_0xfb1e('0x2a')](handleEntityNotFound(_0x8be1af,null))[_0xfb1e('0x2a')](function(_0xdbc81a){if(_0xdbc81a){return _0xdbc81a[_0xfb1e('0xc8')](_0x163ff6[_0xfb1e('0x3d')][_0xfb1e('0xbb')]);}})[_0xfb1e('0x2a')](respondWithStatusCode(_0x8be1af,null))[_0xfb1e('0x36')](handleError(_0x8be1af,null));};exports[_0xfb1e('0xc9')]=function(_0x13a1f3,_0x1868a9){var _0x235315=moment()[_0xfb1e('0xca')]()[_0xfb1e('0x99')]();var _0x98d68a=path[_0xfb1e('0xcb')](config[_0xfb1e('0xcc')],_0xfb1e('0xcd'),'files',_0xfb1e('0xce'));var _0xc3bf07=path[_0xfb1e('0xcb')](config[_0xfb1e('0xcc')],'server',_0xfb1e('0xcf'),_0xfb1e('0xd0'));var _0x5cd2a0=path[_0xfb1e('0xcb')](_0x98d68a,_0x235315);var _0x59df81=util['format'](_0xfb1e('0xd1'),_0x13a1f3['params']['id'],_0x235315);var _0x716a49=path[_0xfb1e('0xcb')](_0x98d68a,_0x59df81);var _0x372266=[];_0x372266[_0xfb1e('0xae')]({'model':db[_0xfb1e('0xd2')],'as':_0xfb1e('0xd2'),'attributes':['id',_0xfb1e('0xd3')],'raw':!![]});_0x372266[_0xfb1e('0xae')]({'model':db[_0xfb1e('0xd4')],'as':_0xfb1e('0x61'),'attributes':['id',_0xfb1e('0xd5'),_0xfb1e('0xd6')],'raw':!![]});var _0x3be41d=[{'model':db[_0xfb1e('0xba')],'as':'Messages','attributes':['id','body',_0xfb1e('0x76'),_0xfb1e('0xd7'),_0xfb1e('0xd8'),_0xfb1e('0x7c')],'include':_0x372266}];_0x3be41d[_0xfb1e('0xae')]({'model':db[_0xfb1e('0xd9')],'as':_0xfb1e('0xda'),'attributes':['id','name']});_0x3be41d[_0xfb1e('0xae')]({'model':db['User'],'as':'Owner','attributes':['id',_0xfb1e('0xd3')]});return db['SmsInteraction'][_0xfb1e('0x66')]({'where':{'id':_0x13a1f3[_0xfb1e('0xb7')]['id']},'include':_0x3be41d})[_0xfb1e('0x2a')](handleEntityNotFound(_0x1868a9,null))[_0xfb1e('0x2a')](function(_0x3e4017){if(_0x3e4017){var _0x489e3a=_0x3e4017[_0xfb1e('0xdb')]({'plain':!![]});fs[_0xfb1e('0xdc')](_0x5cd2a0);var _0x29d2d4={'channel':_0xfb1e('0xdd'),'account':_0x489e3a[_0xfb1e('0xda')][_0xfb1e('0x2e')],'agent':_0x489e3a[_0xfb1e('0xde')]?_0x489e3a[_0xfb1e('0xde')]['fullname']:_0xfb1e('0xdf'),'createdAt':moment(_0x489e3a[_0xfb1e('0x76')])[_0xfb1e('0xc2')](_0xfb1e('0xe0'))[_0xfb1e('0x99')](),'closedAt':_0x489e3a['closed']?moment(_0x489e3a['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x489e3a[_0xfb1e('0xe1')],'messages':_(_0x489e3a['Messages'])[_0xfb1e('0x82')]({'secret':![]})[_0xfb1e('0x31')](function(_0x1a3579){return{'date':moment(_0x1a3579[_0xfb1e('0x76')])[_0xfb1e('0xc2')](_0xfb1e('0xe0'))['toString'](),'sender':_0x1a3579[_0xfb1e('0xd7')]===_0xfb1e('0xe2')?_0x1a3579[_0xfb1e('0xd2')]?_0x1a3579[_0xfb1e('0xd2')][_0xfb1e('0xd3')]:_0xfb1e('0xe3'):_0x1a3579[_0xfb1e('0x61')][_0xfb1e('0xd5')]+(_0x1a3579[_0xfb1e('0x61')][_0xfb1e('0xd6')]?'\x20'+_0x1a3579[_0xfb1e('0x61')][_0xfb1e('0xd6')]:''),'body':_0x1a3579['body'],'direction':_0x1a3579[_0xfb1e('0xd7')]==='out'?'A':'C','secret':_0x1a3579[_0xfb1e('0xd8')],'read':_0x1a3579[_0xfb1e('0x7c')]};})[_0xfb1e('0x5f')]()};return ejs[_0xfb1e('0xe4')](path[_0xfb1e('0xcb')](config[_0xfb1e('0xcc')],'server',_0xfb1e('0xe5'),'downloadInteraction.ejs'),{'interaction':_0x29d2d4})['then'](function(_0x2725d8){var _0x1a980b=path[_0xfb1e('0xcb')](_0x5cd2a0,_0xfb1e('0xe6')+_0x489e3a['id']+'-'+_0x235315+_0xfb1e('0xe7'));var _0x3bd5bc={'path':_0x1a980b,'channel':_0xfb1e('0xdd'),'interactionId':_0x489e3a['id']};return pdf[_0xfb1e('0xe8')](_0x2725d8,_0x3bd5bc);})[_0xfb1e('0x2a')](function(){return new BPromise(function(_0x1c01cb,_0x40ad61){zipdir(_0x5cd2a0,{'saveTo':_0x716a49},function(_0x2c26b1,_0x4f0391){if(_0x2c26b1)return _0x40ad61(_0x2c26b1);return _0x1c01cb(_0x4f0391);});})[_0xfb1e('0x2a')](function(){return new BPromise(function(_0x45c124,_0x1c1a4e){rimraf(_0x5cd2a0,function(_0x1ad3c0){if(_0x1ad3c0)_0x1c1a4e(_0x1ad3c0);return _0x45c124();});});})[_0xfb1e('0x2a')](function(){return _0x1868a9[_0xfb1e('0xc9')](_0x716a49,_0x59df81,function(_0x366c17){if(_0x366c17){console[_0xfb1e('0xe9')](_0xfb1e('0xea'),_0x366c17);}else{fs['unlinkSync'](_0x716a49);}});});});}else{return _0x1868a9[_0xfb1e('0x2b')](0xc8);}})[_0xfb1e('0x36')](handleError(_0x1868a9,null));}; \ No newline at end of file +var _0x22fb=['filters','pick','select','field','color','tools_tags','u.id','u.fullname','ui.SmsInteractionId','from','left_join','users','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','text','keys','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','filter','replace','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','user','sequelize','toString','keyBy','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','show','includeAll','include','options','create','params','destroy','describe','addMessage','SmsMessage','omit','ids','findOne','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','findAll','emit','removeTags','download','unix','join','root','server','files','transcript-%d-%s.zip','CmContact','lastName','Messages','direction','secret','Owner','get','Account','N.A.','closed','disposition','out','System','firstName','renderFile','views','downloadInteraction.ejs','Sms','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','SmsInteraction','rawAttributes','fieldName','type','key','query','intersection','attributes','model','fields','length','nolimit','order','sort','where'];(function(_0x447393,_0xbae442){var _0x495ee0=function(_0x55375e){while(--_0x55375e){_0x447393['push'](_0x447393['shift']());}};_0x495ee0(++_0xbae442);}(_0x22fb,0x18f));var _0xb22f=function(_0xffa62a,_0x677ff2){_0xffa62a=_0xffa62a-0x0;var _0x18c706=_0x22fb[_0xffa62a];return _0x18c706;};'use strict';var emlformat=require(_0xb22f('0x0'));var rimraf=require(_0xb22f('0x1'));var zipdir=require(_0xb22f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb22f('0x3'));var moment=require(_0xb22f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb22f('0x5'));var util=require(_0xb22f('0x6'));var path=require(_0xb22f('0x7'));var sox=require(_0xb22f('0x8'));var csv=require(_0xb22f('0x9'));var ejs=require(_0xb22f('0xa'));var fs=require('fs');var fs_extra=require(_0xb22f('0xb'));var _=require('lodash');var squel=require(_0xb22f('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb22f('0xd'));var toCsv=require(_0xb22f('0x9'));var querystring=require('querystring');var Papa=require(_0xb22f('0xe'));var Redis=require(_0xb22f('0xf'));var authService=require(_0xb22f('0x10'));var qs=require(_0xb22f('0x11'));var as=require(_0xb22f('0x12'));var pdf=require(_0xb22f('0x13'));var hardwareService=require(_0xb22f('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xb22f('0x15'));var licenseUtil=require(_0xb22f('0x16'));var db=require(_0xb22f('0x17'))['db'];config[_0xb22f('0x18')]=_['defaults'](config['redis'],{'host':_0xb22f('0x19'),'port':0x18eb});var socket=require(_0xb22f('0x1a'))(new Redis(config[_0xb22f('0x18')]));require(_0xb22f('0x1b'))[_0xb22f('0x1c')](socket);function respondWithStatusCode(_0x4795dc,_0x3e3642){_0x3e3642=_0x3e3642||0xcc;return function(_0x4da342){if(_0x4da342){return _0x4795dc[_0xb22f('0x1d')](_0x3e3642);}return _0x4795dc[_0xb22f('0x1e')](_0x3e3642)[_0xb22f('0x1f')]();};}function respondWithResult(_0x1a64e1,_0x41f259){_0x41f259=_0x41f259||0xc8;return function(_0x432b51){if(_0x432b51){return _0x1a64e1[_0xb22f('0x1e')](_0x41f259)['json'](_0x432b51);}};}function respondWithFilteredResult(_0x14ecc1,_0x4e23fb){return function(_0x9b9ad8){if(_0x9b9ad8){var _0x2472a8=typeof _0x4e23fb[_0xb22f('0x20')]===_0xb22f('0x21')&&typeof _0x4e23fb[_0xb22f('0x22')]===_0xb22f('0x21');var _0x499413=_0x9b9ad8['count'];var _0xf23afe=_0x2472a8?0x0:_0x4e23fb[_0xb22f('0x20')];var _0xf126f2=_0x2472a8?_0x9b9ad8[_0xb22f('0x23')]:_0x4e23fb[_0xb22f('0x20')]+_0x4e23fb[_0xb22f('0x22')];var _0x161ae2;if(_0xf126f2>=_0x499413){_0xf126f2=_0x499413;_0x161ae2=0xc8;}else{_0x161ae2=0xce;}_0x14ecc1[_0xb22f('0x1e')](_0x161ae2);return _0x14ecc1[_0xb22f('0x24')](_0xb22f('0x25'),_0xf23afe+'-'+_0xf126f2+'/'+_0x499413)[_0xb22f('0x26')](_0x9b9ad8);}return null;};}function patchUpdates(_0x20d938){return function(_0x345e22){try{jsonpatch[_0xb22f('0x27')](_0x345e22,_0x20d938,!![]);}catch(_0x190a0a){return BPromise[_0xb22f('0x28')](_0x190a0a);}return _0x345e22[_0xb22f('0x29')]();};}function saveUpdates(_0x343e7e,_0x238fd0){return function(_0x2efda9){if(_0x2efda9){return _0x2efda9[_0xb22f('0x2a')](_0x343e7e)[_0xb22f('0x2b')](function(_0x22befe){return _0x22befe;});}return null;};}function removeEntity(_0x2084e3,_0x437ea5){return function(_0x47d3f1){if(_0x47d3f1){return _0x47d3f1['destroy']()['then'](function(){_0x2084e3['status'](0xcc)[_0xb22f('0x1f')]();});}};}function handleEntityNotFound(_0x50fd7f,_0x20f3ad){return function(_0x381f0a){if(!_0x381f0a){_0x50fd7f[_0xb22f('0x1d')](0x194);}return _0x381f0a;};}function handleError(_0x15bffe,_0x143f56){_0x143f56=_0x143f56||0x1f4;return function(_0x5a5951){logger['error'](_0x5a5951['stack']);if(_0x5a5951[_0xb22f('0x2c')]){delete _0x5a5951[_0xb22f('0x2c')];}_0x15bffe[_0xb22f('0x1e')](_0x143f56)[_0xb22f('0x2d')](_0x5a5951);};}function getInteractionUsers(_0x2e7956,_0x37cde7){return new BPromise(function(_0x220421,_0x3de171){try{if(_0x37cde7[_0x2e7956['id']]){_0x2e7956[_0xb22f('0x2e')]=_[_0xb22f('0x2f')](_0x37cde7[_0x2e7956['id']],function(_0x77bdd5){return{'id':_0x77bdd5['id'],'fullname':_0x77bdd5[_0xb22f('0x30')]};});}}catch(_0x1d80dd){_0x3de171(_0x1d80dd);}_0x220421(_0x2e7956);});}function getInteractionTags(_0x13bc6d,_0x1e15a8){return new BPromise(function(_0xf0aee1,_0x2a393b){try{if(_0x13bc6d[_0xb22f('0x31')]){_0x13bc6d[_0xb22f('0x32')]=[];_0x13bc6d[_0xb22f('0x31')][_0xb22f('0x33')](',')[_0xb22f('0x34')](function(_0x52484e){_0x13bc6d[_0xb22f('0x32')][_0xb22f('0x35')](_0x1e15a8[_0x52484e]);});}delete _0x13bc6d[_0xb22f('0x31')];}catch(_0x1c8694){_0x2a393b(_0x1c8694);}_0xf0aee1(_0x13bc6d);});}function updateSmsInteraction(_0x3d5538,_0x48c82b,_0xb2fa9a){return new BPromise(function(_0x201244,_0x3c12d6){return getInteractionUsers(_0x3d5538,_0xb2fa9a)[_0xb22f('0x2b')](function(_0x2a1657){return getInteractionTags(_0x2a1657,_0x48c82b);})[_0xb22f('0x2b')](function(_0x325ace){_0x201244(_0x325ace);})[_0xb22f('0x36')](function(_0x451e81){_0x3c12d6(_0x451e81);});});}exports[_0xb22f('0x37')]=function(_0x40919a,_0x470aae){var _0x28c514={},_0x2f8468={},_0x4b506a={'count':0x0,'rows':[]};var _0x493178=_[_0xb22f('0x2f')](db[_0xb22f('0x38')][_0xb22f('0x39')],function(_0x2c5b74){return{'name':_0x2c5b74[_0xb22f('0x3a')],'type':_0x2c5b74[_0xb22f('0x3b')][_0xb22f('0x3c')]};});_0x2f8468['model']=_['map'](_0x493178,_0xb22f('0x2c'));_0x2f8468[_0xb22f('0x3d')]=_['keys'](_0x40919a[_0xb22f('0x3d')]);_0x2f8468['filters']=_[_0xb22f('0x3e')](_0x2f8468['model'],_0x2f8468[_0xb22f('0x3d')]);_0x28c514[_0xb22f('0x3f')]=_[_0xb22f('0x3e')](_0x2f8468[_0xb22f('0x40')],qs[_0xb22f('0x41')](_0x40919a[_0xb22f('0x3d')][_0xb22f('0x41')]));_0x28c514[_0xb22f('0x3f')]=_0x28c514['attributes'][_0xb22f('0x42')]?_0x28c514[_0xb22f('0x3f')]:_0x2f8468[_0xb22f('0x40')];if(!_0x40919a[_0xb22f('0x3d')]['hasOwnProperty'](_0xb22f('0x43'))){_0x28c514['limit']=qs[_0xb22f('0x22')](_0x40919a[_0xb22f('0x3d')]['limit']);_0x28c514[_0xb22f('0x20')]=qs[_0xb22f('0x20')](_0x40919a[_0xb22f('0x3d')]['offset']);}_0x28c514[_0xb22f('0x44')]=qs[_0xb22f('0x45')](_0x40919a['query'][_0xb22f('0x45')]);_0x28c514[_0xb22f('0x46')]=qs[_0xb22f('0x47')](_[_0xb22f('0x48')](_0x40919a[_0xb22f('0x3d')],_0x2f8468[_0xb22f('0x47')]),_0x493178);var _0x1ecba1=[];var _0x228054=squel[_0xb22f('0x49')]()[_0xb22f('0x4a')]('id')['field'](_0xb22f('0x2c'))[_0xb22f('0x4a')](_0xb22f('0x4b'))['from'](_0xb22f('0x4c'));var _0x365667=squel[_0xb22f('0x49')]()[_0xb22f('0x4a')](_0xb22f('0x4d'))['field'](_0xb22f('0x4e'))[_0xb22f('0x4a')](_0xb22f('0x4f'))[_0xb22f('0x50')]('user_has_sms_interactions','ui')[_0xb22f('0x51')](_0xb22f('0x52'),'u',_0xb22f('0x53'));var _0x2afbd2=squel[_0xb22f('0x49')]()[_0xb22f('0x50')]('sms_interactions','i')[_0xb22f('0x51')]('cm_contacts','c',_0xb22f('0x54'))['left_join']('users','o',_0xb22f('0x55'))[_0xb22f('0x51')](_0xb22f('0x56'),'a','a.id\x20=\x20i.SmsAccountId')[_0xb22f('0x51')]('sms_messages','me',_0xb22f('0x57'))['left_join'](_0xb22f('0x58'),'it',_0xb22f('0x59'))['left_join'](_0xb22f('0x4c'),'t',_0xb22f('0x5a'));var _0x1a0866=squel['expr']();var _0x409535=[];var _0x3a19e4=squel[_0xb22f('0x5b')]();var _0x3c6e6a;if(_0x40919a['query'][_0xb22f('0x5c')]){_0x3c6e6a=as[_0xb22f('0x5d')](_0x40919a[_0xb22f('0x3d')]['search']);var _0x5ce689=_0x3c6e6a[_0xb22f('0x5e')];for(var _0x4bbeb6=0x0;_0x4bbeb6<_0x3c6e6a[_0xb22f('0x5f')]['length'];_0x4bbeb6++){var _0x13a205=_0x3c6e6a[_0xb22f('0x5f')][_0x4bbeb6];var _0x19b4c2='i';var _0x403c8a=_['find'](_0x493178,[_0xb22f('0x2c'),_0x13a205['field']]);if(!_0x403c8a){switch(_0x13a205[_0xb22f('0x4a')]){case _0xb22f('0x60'):if(_0x13a205['value']==0x1){_0x2afbd2[_0xb22f('0x61')]('`'+_0x13a205[_0xb22f('0x4a')]+_0xb22f('0x62'));}else{_0x2afbd2[_0xb22f('0x61')]('`'+_0x13a205[_0xb22f('0x4a')]+_0xb22f('0x63'));}break;case _0xb22f('0x64'):if(_0x13a205[_0xb22f('0x65')]===_0xb22f('0x66')){if(_0x13a205[_0xb22f('0x67')]['split']('\x20')[_0xb22f('0x42')]>0x1){_0x1a0866[_0x5ce689](_0xb22f('0x68'),qs['getFullTextValue'](_0x13a205[_0xb22f('0x67')]),null);}else{var _0x198592='%'+_0x13a205['value']+'%';_0x1a0866[_0x5ce689](_0xb22f('0x69'),_0x198592,_0x198592,_0x198592);}}else{_0x403c8a=_[_0xb22f('0x6a')](_0x493178,[_0xb22f('0x2c'),_0xb22f('0x6b')]);_0x13a205['field']='ContactId';_0x94f047=as['buildExpression'](_0x19b4c2,_0x403c8a[_0xb22f('0x3b')],_0x13a205);_0x1a0866[_0x5ce689](_0x94f047['text'],_0x94f047[_0xb22f('0x67')][_0xb22f('0x6c')],_0x94f047[_0xb22f('0x67')][_0xb22f('0x1f')]);}break;case _0xb22f('0x6d'):var _0x38bfbc=_0x13a205[_0xb22f('0x67')]['split'](',')[_0xb22f('0x2f')](function(_0x5c7fbc){return Number(_0x5c7fbc);});_0x38bfbc[_0xb22f('0x34')](function(_0x568277){_0x3a19e4['or'](_0xb22f('0x6e'),'%,'+_0x568277+',%');});_0x409535=_[_0xb22f('0x6f')](_0x409535,_0x38bfbc);break;case _0xb22f('0x70'):if(_0x13a205[_0xb22f('0x65')]==='$substring'){_0x1a0866[_0x5ce689](_0xb22f('0x71'),'%'+_0x13a205[_0xb22f('0x67')]+'%',null);}else{_0x403c8a=_[_0xb22f('0x6a')](_0x493178,['name',_0xb22f('0x72')]);_0x13a205[_0xb22f('0x4a')]=_0xb22f('0x72');_0x94f047=as[_0xb22f('0x73')](_0x19b4c2,_0x403c8a[_0xb22f('0x3b')],_0x13a205);_0x1a0866[_0x5ce689](_0x94f047['text'],_0x94f047['value'][_0xb22f('0x6c')],_0x94f047[_0xb22f('0x67')][_0xb22f('0x1f')]);}break;case _0xb22f('0x74'):_0x94f047=as[_0xb22f('0x73')]('me',null,_0x13a205);_0x1a0866[_0x5ce689](_0x94f047['text'],_0x94f047[_0xb22f('0x67')][_0xb22f('0x6c')],_0x94f047[_0xb22f('0x67')]['end']);break;}}else{var _0x94f047=as['buildExpression'](_0x19b4c2,_0x403c8a['type'],_0x13a205);_0x1a0866[_0x5ce689](_0x94f047[_0xb22f('0x75')],_0x94f047['value'][_0xb22f('0x6c')],_0x94f047[_0xb22f('0x67')][_0xb22f('0x1f')]);}}}else{var _0x22da66=_(_0x40919a[_0xb22f('0x3d')])[_0xb22f('0x76')]()[_0xb22f('0x2f')](function(_0x4abc08){return _[_0xb22f('0x77')](_0x493178,[_0xb22f('0x2c'),_0x4abc08])?_0x4abc08:undefined;})[_0xb22f('0x78')]()['value']();if(!_[_0xb22f('0x79')](_0x22da66)){_0x22da66['forEach'](function(_0x3fa4aa){if(_0x3fa4aa===_0xb22f('0x7a')){_0x2afbd2['where'](_0xb22f('0x7b'),[][_0xb22f('0x7c')](_0x40919a['query'][_0x3fa4aa]));}else if(_0x3fa4aa===_0xb22f('0x7d')){var _0xb5a48e=JSON[_0xb22f('0x7e')](_0x40919a[_0xb22f('0x3d')][_0x3fa4aa])[_0xb22f('0x7f')];var _0x50d46b=JSON[_0xb22f('0x7e')](_0x40919a[_0xb22f('0x3d')][_0x3fa4aa])[_0xb22f('0x80')];_0x2afbd2[_0xb22f('0x46')](_0xb22f('0x81'),_0xb5a48e,_0x50d46b);}else{if(_0x40919a[_0xb22f('0x3d')][_0x3fa4aa]===_0xb22f('0x82')){_0x2afbd2['where']('i.'+_0x3fa4aa+_0xb22f('0x83'));}else{_0x2afbd2[_0xb22f('0x46')]('i.'+_0x3fa4aa+_0xb22f('0x84'),_0x40919a[_0xb22f('0x3d')][_0x3fa4aa]);}}});}if(_0x40919a[_0xb22f('0x3d')]['read']){if(_0x40919a[_0xb22f('0x3d')][_0xb22f('0x85')]==0x1){_0x2afbd2[_0xb22f('0x61')]('`unreadMessages`\x20=\x200');}else{_0x2afbd2['having'](_0xb22f('0x86'));}}if(_0x40919a['query'][_0xb22f('0x87')]){_0x409535=_['isArray'](_0x40919a[_0xb22f('0x3d')][_0xb22f('0x87')])?_0x40919a[_0xb22f('0x3d')][_0xb22f('0x87')]:new Array(_0x40919a[_0xb22f('0x3d')]['tag']);_0x409535[_0xb22f('0x34')](function(_0x24842d){_0x3a19e4['or'](_0xb22f('0x6e'),'%,'+_0x24842d+',%');});}if(_0x40919a[_0xb22f('0x3d')]['filter']){var _0x4d7edc=_0x40919a['query'][_0xb22f('0x88')][_0xb22f('0x89')]('\x5c','\x5c\x5c')[_0xb22f('0x89')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x4d7edc)){_0x1a0866['or']('i.id\x20LIKE\x20?',_0x4d7edc+'%')['or'](_0xb22f('0x8a'),_0x4d7edc+'%');}else{_0x1a0866['or'](_0xb22f('0x8b'),qs[_0xb22f('0x8c')](_0x4d7edc))['or'](_0xb22f('0x8d'),_0x4d7edc+'%');}}}_0x2afbd2[_0xb22f('0x46')](_0x1a0866);_0x2afbd2[_0xb22f('0x8e')]('i.id');var _0x2d0b9e={'type':db[_0xb22f('0x8f')][_0xb22f('0x90')][_0xb22f('0x91')],'raw':!![]};var _0x5824ca=_0x2afbd2[_0xb22f('0x92')]();_0x5824ca[_0xb22f('0x4a')](_0xb22f('0x93'));_0x5824ca[_0xb22f('0x4a')](_0xb22f('0x94'),_0xb22f('0x60'));if(_0x28c514['order']){_0x28c514['order']['forEach'](function(_0x5c79ba){var _0xc69898=_0x5c79ba[0x0]===_0xb22f('0x95')?_0x5c79ba[0x0]:'i.'+_0x5c79ba[0x0];_0x2afbd2['order'](_0xc69898,_0x5c79ba[0x1]===_0xb22f('0x96')?![]:!![]);});}if(!_['isEmpty'](_0x409535)){_0x2afbd2['having'](_0x3a19e4);_0x5824ca['where'](_0xb22f('0x97'),_0x409535);}BPromise[_0xb22f('0x98')]()['then'](function(){if(!_0x3c6e6a){if(_0x40919a[_0xb22f('0x3d')][_0xb22f('0x7a')])return;_0x5824ca[_0xb22f('0x46')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x2afbd2[_0xb22f('0x46')](_0xb22f('0x99'));return;}if(_0x40919a['user'][_0xb22f('0x9a')]!==_0xb22f('0x9b'))return;return _0x40919a['user'][_0xb22f('0x9c')]({'attributes':['id'],'raw':!![]})[_0xb22f('0x2b')](function(_0x4203f9){if(_[_0xb22f('0x79')](_0x4203f9)){_0x5824ca[_0xb22f('0x46')](_0xb22f('0x9d'));_0x2afbd2[_0xb22f('0x46')](_0xb22f('0x9d'));}else{_0x5824ca[_0xb22f('0x46')](_0xb22f('0x7b'),_[_0xb22f('0x2f')](_0x4203f9,'id'));_0x2afbd2[_0xb22f('0x46')](_0xb22f('0x7b'),_[_0xb22f('0x2f')](_0x4203f9,'id'));}});})[_0xb22f('0x2b')](function(){if(_0x40919a[_0xb22f('0x9e')][_0xb22f('0x9a')]==='agent'&&!_0x3c6e6a&&!_0x40919a[_0xb22f('0x3d')][_0xb22f('0x7a')])return[];return db[_0xb22f('0x9f')][_0xb22f('0x3d')](_0x5824ca['toString'](),_0x2d0b9e);})[_0xb22f('0x2b')](function(_0x51e4c5){_0x4b506a[_0xb22f('0x23')]=_0x51e4c5[_0xb22f('0x42')];if(_0x4b506a[_0xb22f('0x23')]===0x0)return[];return db[_0xb22f('0x9f')][_0xb22f('0x3d')](_0x228054[_0xb22f('0xa0')](),_0x2d0b9e)[_0xb22f('0x2b')](function(_0x18bfc0){_0x1ecba1=_[_0xb22f('0xa1')](_0x18bfc0,'id');_0x2d0b9e=_[_0xb22f('0xa2')](_0x2d0b9e,{'model':db[_0xb22f('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x40919a[_0xb22f('0x3d')][_0xb22f('0x41')]){_0x28c514['attributes'][_0xb22f('0x34')](function(_0x5749ec){_0x2afbd2[_0xb22f('0x4a')]('i.'+_0x5749ec);});}else{_0x2afbd2[_0xb22f('0x4a')](_0xb22f('0x94'),_0xb22f('0x60'));_0x2afbd2[_0xb22f('0x4a')](_0xb22f('0xa3'),'Account.key');_0x2afbd2[_0xb22f('0x4a')](_0xb22f('0xa4'),_0xb22f('0xa5'));_0x2afbd2[_0xb22f('0x4a')](_0xb22f('0xa6'),'contactName');_0x2afbd2[_0xb22f('0x4a')]('i.*');_0x2afbd2['field'](_0xb22f('0xa7'),_0xb22f('0xa8'));_0x2afbd2[_0xb22f('0x4a')](_0xb22f('0xa9'),_0xb22f('0xaa'));_0x2afbd2['field'](_0xb22f('0xab'),'Contact.email');_0x2afbd2[_0xb22f('0x4a')](_0xb22f('0xac'),_0xb22f('0xad'));_0x2afbd2[_0xb22f('0x4a')]('c.mobile',_0xb22f('0xae'));_0x2afbd2[_0xb22f('0x4a')]('c.fax',_0xb22f('0xaf'));_0x2afbd2[_0xb22f('0x4a')](_0xb22f('0xb0'),_0xb22f('0xb1'));_0x2afbd2[_0xb22f('0x4a')](_0xb22f('0xb2'),'Owner.internal');_0x2afbd2['field'](_0xb22f('0xb3'),_0xb22f('0x31'));}if(_0x28c514['limit'])_0x2afbd2['limit'](_0x28c514['limit']);if(_0x28c514[_0xb22f('0x20')])_0x2afbd2[_0xb22f('0x20')](_0x28c514[_0xb22f('0x20')]);return db['sequelize']['query'](_0x2afbd2[_0xb22f('0xa0')](),_0x2d0b9e);})[_0xb22f('0x2b')](function(_0x15306a){if(_0x15306a['length']>0x0)_0x365667['where'](_0xb22f('0xb4'),_[_0xb22f('0x2f')](_0x15306a,'id'));return db['sequelize']['query'](_0x365667[_0xb22f('0xa0')](),_0x2d0b9e)[_0xb22f('0x2b')](function(_0x1c3d47){var _0x17980e=_[_0xb22f('0xb5')](_0x1c3d47,_0xb22f('0xb6'));var _0x12ed5b=[];_0x15306a[_0xb22f('0x34')](function(_0x1b54f9){_0x12ed5b[_0xb22f('0x35')](updateSmsInteraction(_0x1b54f9,_0x1ecba1,_0x17980e));});return BPromise[_0xb22f('0xb7')](_0x12ed5b);});});})[_0xb22f('0x2b')](function(_0x20b9be){_0x4b506a[_0xb22f('0xb8')]=_0x20b9be;return _0x4b506a;})[_0xb22f('0x2b')](respondWithFilteredResult(_0x470aae,_0x28c514))[_0xb22f('0x36')](handleError(_0x470aae,null));};exports[_0xb22f('0xb9')]=function(_0x7dc431,_0x28f27f){var _0x174b65={'raw':![],'where':{'id':_0x7dc431['params']['id']}},_0xebafba={};_0xebafba[_0xb22f('0x40')]=_[_0xb22f('0x76')](db[_0xb22f('0x38')][_0xb22f('0x39')]);_0xebafba[_0xb22f('0x3d')]=_['keys'](_0x7dc431[_0xb22f('0x3d')]);_0xebafba[_0xb22f('0x47')]=_[_0xb22f('0x3e')](_0xebafba[_0xb22f('0x40')],_0xebafba['query']);_0x174b65[_0xb22f('0x3f')]=_[_0xb22f('0x3e')](_0xebafba[_0xb22f('0x40')],qs[_0xb22f('0x41')](_0x7dc431[_0xb22f('0x3d')][_0xb22f('0x41')]));_0x174b65['attributes']=_0x174b65['attributes'][_0xb22f('0x42')]?_0x174b65[_0xb22f('0x3f')]:_0xebafba[_0xb22f('0x40')];if(_0x7dc431[_0xb22f('0x3d')][_0xb22f('0xba')]){_0x174b65[_0xb22f('0xbb')]=[{'all':!![]}];}_0x174b65=_[_0xb22f('0xa2')]({},_0x174b65,_0x7dc431[_0xb22f('0xbc')]);return db[_0xb22f('0x38')][_0xb22f('0x6a')](_0x174b65)['then'](handleEntityNotFound(_0x28f27f,null))[_0xb22f('0x2b')](respondWithResult(_0x28f27f,null))[_0xb22f('0x36')](handleError(_0x28f27f,null));};exports[_0xb22f('0xbd')]=function(_0x29b78d,_0x45dc9d){return db['SmsInteraction'][_0xb22f('0xbd')](_0x29b78d[_0xb22f('0x74')],{})[_0xb22f('0x2b')](respondWithResult(_0x45dc9d,0xc9))[_0xb22f('0x36')](handleError(_0x45dc9d,null));};exports[_0xb22f('0x2a')]=function(_0x14962a,_0x2d97a3){if(_0x14962a[_0xb22f('0x74')]['id']){delete _0x14962a[_0xb22f('0x74')]['id'];}return db[_0xb22f('0x38')][_0xb22f('0x6a')]({'where':{'id':_0x14962a[_0xb22f('0xbe')]['id']}})[_0xb22f('0x2b')](handleEntityNotFound(_0x2d97a3,null))[_0xb22f('0x2b')](saveUpdates(_0x14962a['body'],null))[_0xb22f('0x2b')](respondWithResult(_0x2d97a3,null))[_0xb22f('0x36')](handleError(_0x2d97a3,null));};exports[_0xb22f('0xbf')]=function(_0x43d67b,_0x2fa9c6){return db['SmsInteraction'][_0xb22f('0x6a')]({'where':{'id':_0x43d67b['params']['id']}})[_0xb22f('0x2b')](handleEntityNotFound(_0x2fa9c6,null))[_0xb22f('0x2b')](removeEntity(_0x2fa9c6,null))[_0xb22f('0x36')](handleError(_0x2fa9c6,null));};exports[_0xb22f('0xc0')]=function(_0x44a9ef,_0x2a099a){return db[_0xb22f('0x38')]['describe']()[_0xb22f('0x2b')](respondWithResult(_0x2a099a,null))[_0xb22f('0x36')](handleError(_0x2a099a,null));};exports[_0xb22f('0xc1')]=function(_0x2f490c,_0x130c30,_0x464c0a){return db[_0xb22f('0xc2')][_0xb22f('0x6a')]({'where':{'id':_0x2f490c[_0xb22f('0xbe')]['id']}})['then'](handleEntityNotFound(_0x130c30,null))['then'](function(_0x3f05bb){if(_0x3f05bb){return _0x3f05bb[_0xb22f('0xc1')](_0x2f490c[_0xb22f('0x74')]['ids'],_[_0xb22f('0xc3')](_0x2f490c[_0xb22f('0x74')],[_0xb22f('0xc4'),'id'])||{});}})[_0xb22f('0x2b')](respondWithResult(_0x130c30,null))[_0xb22f('0x36')](handleError(_0x130c30,null));};exports['getMessages']=function(_0x91b516,_0x183b77,_0x115404){var _0xf9707a={'raw':![],'where':{}};var _0x93ead5={};var _0x45df98={'count':0x0,'rows':[]};return db[_0xb22f('0x38')][_0xb22f('0xc5')]({'where':{'id':_0x91b516[_0xb22f('0xbe')]['id']}})[_0xb22f('0x2b')](handleEntityNotFound(_0x183b77,null))[_0xb22f('0x2b')](function(_0x40feec){if(_0x40feec){_0x93ead5[_0xb22f('0x40')]=_[_0xb22f('0x76')](db[_0xb22f('0xc2')]['rawAttributes']);_0x93ead5[_0xb22f('0x3d')]=_[_0xb22f('0x76')](_0x91b516[_0xb22f('0x3d')]);_0x93ead5[_0xb22f('0x47')]=_[_0xb22f('0x3e')](_0x93ead5['model'],_0x93ead5[_0xb22f('0x3d')]);_0xf9707a['attributes']=_[_0xb22f('0x3e')](_0x93ead5[_0xb22f('0x40')],qs[_0xb22f('0x41')](_0x91b516[_0xb22f('0x3d')][_0xb22f('0x41')]));_0xf9707a[_0xb22f('0x3f')]=_0xf9707a[_0xb22f('0x3f')]['length']?_0xf9707a[_0xb22f('0x3f')]:_0x93ead5[_0xb22f('0x40')];if(!_0x91b516[_0xb22f('0x3d')][_0xb22f('0xc6')](_0xb22f('0x43'))){_0xf9707a[_0xb22f('0x22')]=qs[_0xb22f('0x22')](_0x91b516['query'][_0xb22f('0x22')]);_0xf9707a[_0xb22f('0x20')]=qs['offset'](_0x91b516[_0xb22f('0x3d')][_0xb22f('0x20')]);}_0xf9707a['order']=qs[_0xb22f('0x45')](_0x91b516['query'][_0xb22f('0x45')]);_0xf9707a[_0xb22f('0x46')]=qs[_0xb22f('0x47')](_[_0xb22f('0x48')](_0x91b516[_0xb22f('0x3d')],_0x93ead5[_0xb22f('0x47')]));_0xf9707a[_0xb22f('0x46')]['SmsInteractionId']=_0x40feec['id'];if(_0x91b516[_0xb22f('0x3d')][_0xb22f('0x88')]){_0xf9707a['where']=_['merge'](_0xf9707a['where'],{'$or':_[_0xb22f('0x2f')](_0xf9707a[_0xb22f('0x3f')],function(_0x2de350){var _0x2470d1={};_0x2470d1[_0x2de350]={'$like':'%'+_0x91b516[_0xb22f('0x3d')][_0xb22f('0x88')]+'%'};return _0x2470d1;})});}if(_0x91b516['query'][_0xb22f('0x7f')]){var _0x1ad440=_0x91b516['query']['$gte'][_0xb22f('0x33')](',');var _0x5c4b23={};_0x5c4b23[_0x1ad440[0x0]]={'$gte':moment(_0x1ad440[0x1])[_0xb22f('0xc7')](_0xb22f('0xc8'))};_0xf9707a[_0xb22f('0x46')]=_[_0xb22f('0xa2')](_0xf9707a[_0xb22f('0x46')],_0x5c4b23);}_0xf9707a=_['merge']({},_0xf9707a,_0x91b516[_0xb22f('0xbc')]);return db[_0xb22f('0xc2')][_0xb22f('0x23')]({'where':_0xf9707a[_0xb22f('0x46')]})[_0xb22f('0x2b')](function(_0x4e6b43){_0x45df98['count']=_0x4e6b43;if(_0x91b516['query'][_0xb22f('0xba')]){_0xf9707a[_0xb22f('0xbb')]=[{'all':!![]}];}return db[_0xb22f('0xc2')]['findAll'](_0xf9707a);})[_0xb22f('0x2b')](function(_0x1a817a){_0x45df98['rows']=_0x1a817a;return _0x45df98;});}})[_0xb22f('0x2b')](respondWithFilteredResult(_0x183b77,_0xf9707a))[_0xb22f('0x36')](handleError(_0x183b77,null));};exports[_0xb22f('0xc9')]=function(_0x1f3f44,_0xf34eb4,_0x23c362){return db['SmsInteraction'][_0xb22f('0x6a')]({'where':{'id':_0x1f3f44[_0xb22f('0xbe')]['id']}})['then'](handleEntityNotFound(_0xf34eb4,null))[_0xb22f('0x2b')](function(_0xc4995){if(_0xc4995){return _0xc4995[_0xb22f('0xca')](_0x1f3f44['body'][_0xb22f('0xc4')],_[_0xb22f('0xc3')](_0x1f3f44[_0xb22f('0x74')],[_0xb22f('0xc4'),'id'])||{})['spread'](function(){return db['Tag'][_0xb22f('0xcb')]({'attributes':['id','name',_0xb22f('0x4b')],'where':{'id':_0x1f3f44[_0xb22f('0x74')]['ids']}});})['then'](function(_0x324ca6){socket[_0xb22f('0xcc')]('smsInteractionTags:save',{'id':Number(_0x1f3f44[_0xb22f('0xbe')]['id']),'tags':_0x324ca6||[]});return{'id':Number(_0x1f3f44['params']['id']),'tags':_0x324ca6||[]};});}})[_0xb22f('0x2b')](respondWithResult(_0xf34eb4,null))[_0xb22f('0x36')](handleError(_0xf34eb4,null));};exports['removeTags']=function(_0x2966e3,_0x22c59c,_0x17b204){return db[_0xb22f('0x38')][_0xb22f('0x6a')]({'where':{'id':_0x2966e3['params']['id']}})[_0xb22f('0x2b')](handleEntityNotFound(_0x22c59c,null))[_0xb22f('0x2b')](function(_0x369f99){if(_0x369f99){return _0x369f99[_0xb22f('0xcd')](_0x2966e3[_0xb22f('0x3d')][_0xb22f('0xc4')]);}})[_0xb22f('0x2b')](respondWithStatusCode(_0x22c59c,null))[_0xb22f('0x36')](handleError(_0x22c59c,null));};exports[_0xb22f('0xce')]=function(_0x10067b,_0x370fee){var _0x440671=moment()[_0xb22f('0xcf')]()[_0xb22f('0xa0')]();var _0x510b11=path[_0xb22f('0xd0')](config[_0xb22f('0xd1')],_0xb22f('0xd2'),_0xb22f('0xd3'),'tmp');var _0x523cd8=path[_0xb22f('0xd0')](config[_0xb22f('0xd1')],_0xb22f('0xd2'),_0xb22f('0xd3'),'attachments');var _0x41195e=path[_0xb22f('0xd0')](_0x510b11,_0x440671);var _0x572a85=util['format'](_0xb22f('0xd4'),_0x10067b[_0xb22f('0xbe')]['id'],_0x440671);var _0x1bf5c2=path['join'](_0x510b11,_0x572a85);var _0x5467b0=[];_0x5467b0[_0xb22f('0x35')]({'model':db[_0xb22f('0x70')],'as':_0xb22f('0x70'),'attributes':['id',_0xb22f('0x30')],'raw':!![]});_0x5467b0['push']({'model':db[_0xb22f('0xd5')],'as':_0xb22f('0x64'),'attributes':['id','firstName',_0xb22f('0xd6')],'raw':!![]});var _0x5999c5=[{'model':db[_0xb22f('0xc2')],'as':_0xb22f('0xd7'),'attributes':['id',_0xb22f('0x74'),_0xb22f('0x7d'),_0xb22f('0xd8'),_0xb22f('0xd9'),'read'],'include':_0x5467b0}];_0x5999c5[_0xb22f('0x35')]({'model':db['SmsAccount'],'as':'Account','attributes':['id','name']});_0x5999c5[_0xb22f('0x35')]({'model':db[_0xb22f('0x70')],'as':_0xb22f('0xda'),'attributes':['id',_0xb22f('0x30')]});return db[_0xb22f('0x38')]['find']({'where':{'id':_0x10067b[_0xb22f('0xbe')]['id']},'include':_0x5999c5})['then'](handleEntityNotFound(_0x370fee,null))[_0xb22f('0x2b')](function(_0x392a02){if(_0x392a02){var _0x1add4c=_0x392a02[_0xb22f('0xdb')]({'plain':!![]});fs['mkdirSync'](_0x41195e);var _0x262d64={'channel':'Sms','account':_0x1add4c[_0xb22f('0xdc')][_0xb22f('0x2c')],'agent':_0x1add4c[_0xb22f('0xda')]?_0x1add4c['Owner']['fullname']:_0xb22f('0xdd'),'createdAt':moment(_0x1add4c[_0xb22f('0x7d')])[_0xb22f('0xc7')](_0xb22f('0xc8'))[_0xb22f('0xa0')](),'closedAt':_0x1add4c[_0xb22f('0xde')]?moment(_0x1add4c['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x1add4c[_0xb22f('0xdf')],'messages':_(_0x1add4c[_0xb22f('0xd7')])[_0xb22f('0x88')]({'secret':![]})['map'](function(_0xdf0344){return{'date':moment(_0xdf0344[_0xb22f('0x7d')])[_0xb22f('0xc7')](_0xb22f('0xc8'))[_0xb22f('0xa0')](),'sender':_0xdf0344['direction']===_0xb22f('0xe0')?_0xdf0344[_0xb22f('0x70')]?_0xdf0344['User'][_0xb22f('0x30')]:_0xb22f('0xe1'):_0xdf0344[_0xb22f('0x64')][_0xb22f('0xe2')]+(_0xdf0344[_0xb22f('0x64')][_0xb22f('0xd6')]?'\x20'+_0xdf0344[_0xb22f('0x64')][_0xb22f('0xd6')]:''),'body':_0xdf0344[_0xb22f('0x74')],'direction':_0xdf0344['direction']===_0xb22f('0xe0')?'A':'C','secret':_0xdf0344['secret'],'read':_0xdf0344[_0xb22f('0x85')]};})[_0xb22f('0x67')]()};return ejs[_0xb22f('0xe3')](path[_0xb22f('0xd0')](config[_0xb22f('0xd1')],_0xb22f('0xd2'),_0xb22f('0xe4'),_0xb22f('0xe5')),{'interaction':_0x262d64})['then'](function(_0x1e0326){var _0x45ec79=path[_0xb22f('0xd0')](_0x41195e,'transcript-'+_0x1add4c['id']+'-'+_0x440671+'.pdf');var _0x2b697a={'path':_0x45ec79,'channel':_0xb22f('0xe6'),'interactionId':_0x1add4c['id']};return pdf[_0xb22f('0xe7')](_0x1e0326,_0x2b697a);})[_0xb22f('0x2b')](function(){return new BPromise(function(_0x275752,_0x3a7401){zipdir(_0x41195e,{'saveTo':_0x1bf5c2},function(_0x1077a3,_0x5b8fc2){if(_0x1077a3)return _0x3a7401(_0x1077a3);return _0x275752(_0x5b8fc2);});})[_0xb22f('0x2b')](function(){return new BPromise(function(_0x168faa,_0x34f3eb){rimraf(_0x41195e,function(_0x7830c5){if(_0x7830c5)_0x34f3eb(_0x7830c5);return _0x168faa();});});})[_0xb22f('0x2b')](function(){return _0x370fee[_0xb22f('0xce')](_0x1bf5c2,_0x572a85,function(_0x4d490b){if(_0x4d490b){console[_0xb22f('0xe8')](_0xb22f('0xe9'),_0x4d490b);}else{fs[_0xb22f('0xea')](_0x1bf5c2);}});});});}else{return _0x370fee[_0xb22f('0x1d')](0xc8);}})['catch'](handleError(_0x370fee,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 9f8b593..7f65bc6 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 _0xef0f=['SmsInteraction','../../mysqldb','SmsMessage','save','update','remove','getUsers','then','Users','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x558a01,_0x5239e3){var _0x319bb8=function(_0x4a95d8){while(--_0x4a95d8){_0x558a01['push'](_0x558a01['shift']());}};_0x319bb8(++_0x5239e3);}(_0xef0f,0x168));var _0xfef0=function(_0x1ec8f9,_0x9348b2){_0x1ec8f9=_0x1ec8f9-0x0;var _0x417145=_0xef0f[_0x1ec8f9];return _0x417145;};'use strict';var EventEmitter=require(_0xfef0('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xfef0('0x1')];var SmsMessage=require(_0xfef0('0x2'))['db'][_0xfef0('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfef0('0x4'),'afterUpdate':_0xfef0('0x5'),'afterDestroy':_0xfef0('0x6')};function emitEvent(_0x4e1af6){return function(_0x2a6fcf,_0x9b8b9e,_0x2697df){_0x2a6fcf[_0xfef0('0x7')]({'attributes':['id'],'raw':!![]})[_0xfef0('0x8')](function(_0x11dfd7){_0x2a6fcf['setDataValue'](_0xfef0('0x9'),_0x11dfd7['map'](function(_0x82e37a){return{'id':_0x82e37a['id']};}));return SmsMessage[_0xfef0('0xa')]({'where':{'SmsInteractionId':_0x2a6fcf['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfef0('0x8')](function(_0x2d42dc){_0x2a6fcf[_0xfef0('0xb')](_0xfef0('0xc'),_0x2d42dc[_0xfef0('0xd')]);SmsInteractionEvents[_0xfef0('0xe')](_0x4e1af6+':'+_0x2a6fcf['id'],_0x2a6fcf);SmsInteractionEvents[_0xfef0('0xe')](_0x4e1af6,_0x2a6fcf);_0x2697df(null);})[_0xfef0('0xf')](_0x2697df(null));};}for(var e in events){if(events[_0xfef0('0x10')](e)){var event=events[e];SmsInteraction[_0xfef0('0x11')](e,emitEvent(event));}}module[_0xfef0('0x12')]=SmsInteractionEvents; \ No newline at end of file +var _0xe2cf=['update','remove','then','map','findAll','setDataValue','unreadMessages','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x315b6c,_0x2ac37f){_0x315b6c=_0x315b6c-0x0;var _0x94dc8=_0xe2cf[_0x315b6c];return _0x94dc8;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0xfe2c('0x0'))['db']['SmsInteraction'];var SmsMessage=require(_0xfe2c('0x0'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xfe2c('0x1')](0x0);var events={'afterCreate':_0xfe2c('0x2'),'afterUpdate':_0xfe2c('0x3'),'afterDestroy':_0xfe2c('0x4')};function emitEvent(_0x494978){return function(_0xd40c31,_0x14674d,_0x55bb12){_0xd40c31['getUsers']({'attributes':['id'],'raw':!![]})[_0xfe2c('0x5')](function(_0x417bc4){_0xd40c31['setDataValue']('Users',_0x417bc4[_0xfe2c('0x6')](function(_0x2e2933){return{'id':_0x2e2933['id']};}));return SmsMessage[_0xfe2c('0x7')]({'where':{'SmsInteractionId':_0xd40c31['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5b616c){_0xd40c31[_0xfe2c('0x8')](_0xfe2c('0x9'),_0x5b616c['length']);SmsInteractionEvents[_0xfe2c('0xa')](_0x494978+':'+_0xd40c31['id'],_0xd40c31);SmsInteractionEvents[_0xfe2c('0xa')](_0x494978,_0xd40c31);_0x55bb12(null);})[_0xfe2c('0xb')](_0x55bb12(null));};}for(var e in events){if(events[_0xfe2c('0xc')](e)){var event=events[e];SmsInteraction[_0xfe2c('0xd')](e,emitEvent(event));}}module[_0xfe2c('0xe')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 737fa42..af9873e 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 _0x13bf=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','define','SmsInteraction','sms_interactions','changed','closed','format','lodash','util','../../config/logger'];(function(_0xb0ee18,_0x36a014){var _0x165c69=function(_0x2dc2d0){while(--_0x2dc2d0){_0xb0ee18['push'](_0xb0ee18['shift']());}};_0x165c69(++_0x36a014);}(_0x13bf,0x1c8));var _0xf13b=function(_0x4a5dc7,_0x8b8bbb){_0x4a5dc7=_0x4a5dc7-0x0;var _0x4653c9=_0x13bf[_0x4a5dc7];return _0x4653c9;};'use strict';var _=require(_0xf13b('0x0'));var util=require(_0xf13b('0x1'));var logger=require(_0xf13b('0x2'))(_0xf13b('0x3'));var moment=require(_0xf13b('0x4'));var BPromise=require(_0xf13b('0x5'));var rp=require(_0xf13b('0x6'));var fs=require('fs');var path=require(_0xf13b('0x7'));var rimraf=require(_0xf13b('0x8'));var config=require(_0xf13b('0x9'));var attributes=require(_0xf13b('0xa'));module['exports']=function(_0x4f8655,_0x1e0db3){return _0x4f8655[_0xf13b('0xb')](_0xf13b('0xc'),attributes,{'tableName':_0xf13b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x442f9b,_0x44a292,_0x306414){if(_0x442f9b[_0xf13b('0xe')](_0xf13b('0xf'))){_0x442f9b['closedAt']=moment()[_0xf13b('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x306414(null,_0x442f9b);}}});}; \ No newline at end of file +var _0x54ee=['sms_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./smsInteraction.attributes','SmsInteraction'];(function(_0xf06163,_0x80c74b){var _0x29df4d=function(_0x57eea0){while(--_0x57eea0){_0xf06163['push'](_0xf06163['shift']());}};_0x29df4d(++_0x80c74b);}(_0x54ee,0x19a));var _0xe54e=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x54ee[_0x5608a3];return _0x1ed50a;};'use strict';var _=require(_0xe54e('0x0'));var util=require(_0xe54e('0x1'));var logger=require(_0xe54e('0x2'))(_0xe54e('0x3'));var moment=require(_0xe54e('0x4'));var BPromise=require('bluebird');var rp=require(_0xe54e('0x5'));var fs=require('fs');var path=require(_0xe54e('0x6'));var rimraf=require(_0xe54e('0x7'));var config=require('../../config/environment');var attributes=require(_0xe54e('0x8'));module['exports']=function(_0x3ec678,_0x52ed00){return _0x3ec678['define'](_0xe54e('0x9'),attributes,{'tableName':_0xe54e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x24efb1,_0x3556c5,_0x3ae401){if(_0x24efb1[_0xe54e('0xb')](_0xe54e('0xc'))){_0x24efb1[_0xe54e('0xd')]=moment()['format'](_0xe54e('0xe'));}_0x3ae401(null,_0x24efb1);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 020dc17..a498440 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 _0x3adf=['omit','body','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateSmsInteraction','update','options','raw','where','attributes','limit','AddTagsToSmsInteraction','addTags','ids'];(function(_0x381172,_0xf1af48){var _0x251bf3=function(_0x34c0de){while(--_0x34c0de){_0x381172['push'](_0x381172['shift']());}};_0x251bf3(++_0xf1af48);}(_0x3adf,0xd5));var _0xf3ad=function(_0x3439bc,_0xc03879){_0x3439bc=_0x3439bc-0x0;var _0x484801=_0x3adf[_0x3439bc];return _0x484801;};'use strict';var _=require(_0xf3ad('0x0'));var util=require(_0xf3ad('0x1'));var moment=require('moment');var BPromise=require(_0xf3ad('0x2'));var rs=require(_0xf3ad('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf3ad('0x4'))['db'];var utils=require(_0xf3ad('0x5'));var logger=require(_0xf3ad('0x6'))(_0xf3ad('0x7'));var config=require(_0xf3ad('0x8'));var jayson=require(_0xf3ad('0x9'));var client=jayson['client'][_0xf3ad('0xa')]({'port':0x232a});config['redis']=_[_0xf3ad('0xb')](config[_0xf3ad('0xc')],{'host':_0xf3ad('0xd'),'port':0x18eb});var socket=require(_0xf3ad('0xe'))(new Redis(config[_0xf3ad('0xc')]));require(_0xf3ad('0xf'))[_0xf3ad('0x10')](socket);function respondWithRpcPromise(_0x26a24a,_0x5c2ee1,_0x43de42){return new BPromise(function(_0x1f32fe,_0x4f36f9){return client[_0xf3ad('0x11')](_0x26a24a,_0x43de42)[_0xf3ad('0x12')](function(_0x41adb8){logger[_0xf3ad('0x13')](_0xf3ad('0x14'),_0x5c2ee1,_0xf3ad('0x15'));logger[_0xf3ad('0x16')](_0xf3ad('0x17'),_0x5c2ee1,_0xf3ad('0x15'),JSON[_0xf3ad('0x18')](_0x41adb8));if(_0x41adb8['error']){if(_0x41adb8['error']['code']===0x1f4){logger['error'](_0xf3ad('0x14'),_0x5c2ee1,_0x41adb8[_0xf3ad('0x19')]['message']);return _0x4f36f9(_0x41adb8[_0xf3ad('0x19')][_0xf3ad('0x1a')]);}logger[_0xf3ad('0x19')](_0xf3ad('0x14'),_0x5c2ee1,_0x41adb8[_0xf3ad('0x19')]['message']);return _0x1f32fe(_0x41adb8[_0xf3ad('0x19')][_0xf3ad('0x1a')]);}else{logger['info']('SmsInteraction,\x20%s,\x20%s',_0x5c2ee1,'request\x20sent');_0x1f32fe(_0x41adb8[_0xf3ad('0x1b')][_0xf3ad('0x1a')]);}})[_0xf3ad('0x1c')](function(_0x44db35){logger[_0xf3ad('0x19')](_0xf3ad('0x14'),_0x5c2ee1,_0x44db35);_0x4f36f9(_0x44db35);});});}exports[_0xf3ad('0x1d')]=function(_0x57da2f){var _0xcb1502=this;return new Promise(function(_0x28f215,_0x4f0123){return db['SmsInteraction'][_0xf3ad('0x1e')](_0x57da2f['body'],{'raw':_0x57da2f[_0xf3ad('0x1f')]?_0x57da2f['options'][_0xf3ad('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57da2f[_0xf3ad('0x1f')]?_0x57da2f[_0xf3ad('0x1f')][_0xf3ad('0x21')]||null:null,'attributes':_0x57da2f[_0xf3ad('0x1f')]?_0x57da2f['options'][_0xf3ad('0x22')]||null:null,'limit':_0x57da2f['options']?_0x57da2f[_0xf3ad('0x1f')][_0xf3ad('0x23')]||null:null})[_0xf3ad('0x12')](function(_0x5df931){logger[_0xf3ad('0x13')](_0xf3ad('0x1d'),_0x57da2f);logger[_0xf3ad('0x16')]('UpdateSmsInteraction',_0x57da2f,JSON[_0xf3ad('0x18')](_0x5df931));_0x28f215(_0x5df931);})[_0xf3ad('0x1c')](function(_0x34c8ec){logger[_0xf3ad('0x19')](_0xf3ad('0x1d'),_0x34c8ec[_0xf3ad('0x1a')],_0x57da2f);_0x4f0123(_0xcb1502[_0xf3ad('0x19')](0x1f4,_0x34c8ec[_0xf3ad('0x1a')]));});});};exports[_0xf3ad('0x24')]=function(_0x58e079){return new Promise(function(_0x4e50ff,_0x23270e){return db['SmsInteraction']['find']({'where':_0x58e079[_0xf3ad('0x1f')]?_0x58e079[_0xf3ad('0x1f')][_0xf3ad('0x21')]||null:null})[_0xf3ad('0x12')](function(_0x2ec2af){if(_0x2ec2af){return _0x2ec2af[_0xf3ad('0x25')](_0x58e079['body'][_0xf3ad('0x26')],_[_0xf3ad('0x27')](_0x58e079[_0xf3ad('0x28')],[_0xf3ad('0x26'),'id'])||{});}})['spread'](function(_0x271bd9){logger[_0xf3ad('0x13')](_0xf3ad('0x29'),_0x58e079);logger['debug'](_0xf3ad('0x29'),_0x58e079,JSON[_0xf3ad('0x18')](_0x271bd9));_0x4e50ff(_0x271bd9);})[_0xf3ad('0x1c')](function(_0xdafd20){logger[_0xf3ad('0x19')](_0xf3ad('0x29'),_0xdafd20['message'],_0x58e079);_0x23270e(_this[_0xf3ad('0x19')](0x1f4,_0xdafd20[_0xf3ad('0x1a')]));});});}; \ No newline at end of file +var _0xb775=['redis','localhost','./smsInteraction.socket','register','request','then','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsInteraction,\x20%s,\x20%s','result','catch','UpdateSmsInteraction','SmsInteraction','options','raw','where','limit','AddTagsToSmsInteraction','find','body','ids','omit','spread','AddTags','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x11fc81,_0x55fbb1){var _0x3110c6=function(_0x53add4){while(--_0x53add4){_0x11fc81['push'](_0x11fc81['shift']());}};_0x3110c6(++_0x55fbb1);}(_0xb775,0x1ae));var _0x5b77=function(_0x327558,_0x35723e){_0x327558=_0x327558-0x0;var _0x10c217=_0xb775[_0x327558];return _0x10c217;};'use strict';var _=require(_0x5b77('0x0'));var util=require('util');var moment=require(_0x5b77('0x1'));var BPromise=require('bluebird');var rs=require(_0x5b77('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b77('0x3'))['db'];var utils=require(_0x5b77('0x4'));var logger=require(_0x5b77('0x5'))(_0x5b77('0x6'));var config=require(_0x5b77('0x7'));var jayson=require(_0x5b77('0x8'));var client=jayson[_0x5b77('0x9')]['http']({'port':0x232a});config[_0x5b77('0xa')]=_['defaults'](config[_0x5b77('0xa')],{'host':_0x5b77('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5b77('0xa')]));require(_0x5b77('0xc'))[_0x5b77('0xd')](socket);function respondWithRpcPromise(_0x1a82f9,_0x139892,_0x2339da){return new BPromise(function(_0x5b250e,_0x354250){return client[_0x5b77('0xe')](_0x1a82f9,_0x2339da)[_0x5b77('0xf')](function(_0x3d03c0){logger[_0x5b77('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x139892,_0x5b77('0x11'));logger[_0x5b77('0x12')](_0x5b77('0x13'),_0x139892,_0x5b77('0x11'),JSON[_0x5b77('0x14')](_0x3d03c0));if(_0x3d03c0['error']){if(_0x3d03c0[_0x5b77('0x15')][_0x5b77('0x16')]===0x1f4){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x139892,_0x3d03c0[_0x5b77('0x15')][_0x5b77('0x17')]);return _0x354250(_0x3d03c0[_0x5b77('0x15')][_0x5b77('0x17')]);}logger[_0x5b77('0x15')](_0x5b77('0x18'),_0x139892,_0x3d03c0[_0x5b77('0x15')][_0x5b77('0x17')]);return _0x5b250e(_0x3d03c0[_0x5b77('0x15')][_0x5b77('0x17')]);}else{logger[_0x5b77('0x10')](_0x5b77('0x18'),_0x139892,_0x5b77('0x11'));_0x5b250e(_0x3d03c0[_0x5b77('0x19')][_0x5b77('0x17')]);}})[_0x5b77('0x1a')](function(_0x1cfaeb){logger[_0x5b77('0x15')](_0x5b77('0x18'),_0x139892,_0x1cfaeb);_0x354250(_0x1cfaeb);});});}exports[_0x5b77('0x1b')]=function(_0x4c0d07){var _0x52cd75=this;return new Promise(function(_0x495adf,_0x40ff8f){return db[_0x5b77('0x1c')]['update'](_0x4c0d07['body'],{'raw':_0x4c0d07[_0x5b77('0x1d')]?_0x4c0d07[_0x5b77('0x1d')][_0x5b77('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c0d07[_0x5b77('0x1d')]?_0x4c0d07[_0x5b77('0x1d')][_0x5b77('0x1f')]||null:null,'attributes':_0x4c0d07['options']?_0x4c0d07[_0x5b77('0x1d')]['attributes']||null:null,'limit':_0x4c0d07[_0x5b77('0x1d')]?_0x4c0d07[_0x5b77('0x1d')][_0x5b77('0x20')]||null:null})[_0x5b77('0xf')](function(_0x4d84ed){logger[_0x5b77('0x10')]('UpdateSmsInteraction',_0x4c0d07);logger[_0x5b77('0x12')](_0x5b77('0x1b'),_0x4c0d07,JSON[_0x5b77('0x14')](_0x4d84ed));_0x495adf(_0x4d84ed);})[_0x5b77('0x1a')](function(_0x2a929f){logger['error'](_0x5b77('0x1b'),_0x2a929f[_0x5b77('0x17')],_0x4c0d07);_0x40ff8f(_0x52cd75[_0x5b77('0x15')](0x1f4,_0x2a929f[_0x5b77('0x17')]));});});};exports[_0x5b77('0x21')]=function(_0x17abcb){return new Promise(function(_0x4ee563,_0x164062){return db['SmsInteraction'][_0x5b77('0x22')]({'where':_0x17abcb[_0x5b77('0x1d')]?_0x17abcb[_0x5b77('0x1d')][_0x5b77('0x1f')]||null:null})['then'](function(_0xe1c42b){if(_0xe1c42b){return _0xe1c42b['addTags'](_0x17abcb[_0x5b77('0x23')][_0x5b77('0x24')],_[_0x5b77('0x25')](_0x17abcb[_0x5b77('0x23')],[_0x5b77('0x24'),'id'])||{});}})[_0x5b77('0x26')](function(_0x54ec7f){logger[_0x5b77('0x10')](_0x5b77('0x27'),_0x17abcb);logger[_0x5b77('0x12')]('AddTags',_0x17abcb,JSON['stringify'](_0x54ec7f));_0x4ee563(_0x54ec7f);})[_0x5b77('0x1a')](function(_0xa178f6){logger[_0x5b77('0x15')]('AddTags',_0xa178f6['message'],_0x17abcb);_0x164062(_this[_0x5b77('0x15')](0x1f4,_0xa178f6[_0x5b77('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 086b6cc..840d15a 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 _0xe253=['./smsInteraction.events','save','remove','update','emit','length','smsInteraction:'];(function(_0x265aa2,_0x220072){var _0x447a3a=function(_0x1512cc){while(--_0x1512cc){_0x265aa2['push'](_0x265aa2['shift']());}};_0x447a3a(++_0x220072);}(_0xe253,0x196));var _0x3e25=function(_0x143a0e,_0x7862c){_0x143a0e=_0x143a0e-0x0;var _0x3c96de=_0xe253[_0x143a0e];return _0x3c96de;};'use strict';var SmsInteractionEvents=require(_0x3e25('0x0'));var events=[_0x3e25('0x1'),_0x3e25('0x2'),_0x3e25('0x3')];function createListener(_0xf277d9,_0x20e415){return function(_0x396794){_0x20e415[_0x3e25('0x4')](_0xf277d9,_0x396794);};}function removeListener(_0x5e6cd9,_0x59469b){return function(){SmsInteractionEvents['removeListener'](_0x5e6cd9,_0x59469b);};}exports['register']=function(_0x33404a){for(var _0x2233e1=0x0,_0x18b96f=events[_0x3e25('0x5')];_0x2233e1<_0x18b96f;_0x2233e1++){var _0x26eba6=events[_0x2233e1];var _0x4934e6=createListener(_0x3e25('0x6')+_0x26eba6,_0x33404a);SmsInteractionEvents['on'](_0x26eba6,_0x4934e6);}}; \ No newline at end of file +var _0xdb0b=['length','smsInteraction:','save','remove','update','emit','register'];(function(_0x39872b,_0x343e6b){var _0x55fa18=function(_0x217c7f){while(--_0x217c7f){_0x39872b['push'](_0x39872b['shift']());}};_0x55fa18(++_0x343e6b);}(_0xdb0b,0xaa));var _0xbdb0=function(_0x3c3d5b,_0x410836){_0x3c3d5b=_0x3c3d5b-0x0;var _0x1f2740=_0xdb0b[_0x3c3d5b];return _0x1f2740;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xbdb0('0x0'),_0xbdb0('0x1'),_0xbdb0('0x2')];function createListener(_0x43b97b,_0x2455b4){return function(_0x58e9d0){_0x2455b4[_0xbdb0('0x3')](_0x43b97b,_0x58e9d0);};}function removeListener(_0x49e21f,_0x8d2f83){return function(){SmsInteractionEvents['removeListener'](_0x49e21f,_0x8d2f83);};}exports[_0xbdb0('0x4')]=function(_0x153221){for(var _0x47396d=0x0,_0x2a5dbf=events[_0xbdb0('0x5')];_0x47396d<_0x2a5dbf;_0x47396d++){var _0x2b874d=events[_0x47396d];var _0x37bf45=createListener(_0xbdb0('0x6')+_0x2b874d,_0x153221);SmsInteractionEvents['on'](_0x2b874d,_0x37bf45);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index a9afc95..93f8130 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 _0x7916=['post','/:id/status','status','put','/:id','update','/:id/accept','/:id/reject','reject','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','isAuthenticated','index','/describe','describe','show','tracked','sms','create'];(function(_0x5190b8,_0x28ffad){var _0x3a9c02=function(_0x5df0fc){while(--_0x5df0fc){_0x5190b8['push'](_0x5190b8['shift']());}};_0x3a9c02(++_0x28ffad);}(_0x7916,0x128));var _0x6791=function(_0x28b3a5,_0x54d002){_0x28b3a5=_0x28b3a5-0x0;var _0x323f59=_0x7916[_0x28b3a5];return _0x323f59;};'use strict';var multer=require(_0x6791('0x0'));var util=require('util');var path=require(_0x6791('0x1'));var timeout=require(_0x6791('0x2'));var express=require('express');var router=express[_0x6791('0x3')]();var fs_extra=require(_0x6791('0x4'));var auth=require(_0x6791('0x5'));var interaction=require(_0x6791('0x6'));var config=require('../../config/environment');var controller=require(_0x6791('0x7'));router['get']('/',auth[_0x6791('0x8')](),controller[_0x6791('0x9')]);router['get'](_0x6791('0xa'),auth['isAuthenticated'](),controller[_0x6791('0xb')]);router['get']('/:id',auth[_0x6791('0x8')](),controller[_0x6791('0xc')]);router['post']('/',auth[_0x6791('0x8')](),interaction[_0x6791('0xd')](_0x6791('0xe'),'smsmessage:create'),controller[_0x6791('0xf')]);router[_0x6791('0x10')](_0x6791('0x11'),controller[_0x6791('0x12')]);router[_0x6791('0x13')](_0x6791('0x14'),auth[_0x6791('0x8')](),controller[_0x6791('0x15')]);router[_0x6791('0x13')](_0x6791('0x16'),auth[_0x6791('0x8')](),controller['accept']);router['put'](_0x6791('0x17'),auth['isAuthenticated'](),controller[_0x6791('0x18')]);router['delete'](_0x6791('0x14'),auth[_0x6791('0x8')](),controller['destroy']);module[_0x6791('0x19')]=router; \ No newline at end of file +var _0x8d8f=['create','/:id/status','status','put','update','/:id/accept','/:id/reject','reject','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','describe','/:id','show','post','sms','smsmessage:create'];(function(_0x1ba815,_0x3cdd34){var _0x110c82=function(_0x30afcc){while(--_0x30afcc){_0x1ba815['push'](_0x1ba815['shift']());}};_0x110c82(++_0x3cdd34);}(_0x8d8f,0x13d));var _0xf8d8=function(_0x30f09f,_0x1c2bec){_0x30f09f=_0x30f09f-0x0;var _0xcb62ff=_0x8d8f[_0x30f09f];return _0xcb62ff;};'use strict';var multer=require(_0xf8d8('0x0'));var util=require(_0xf8d8('0x1'));var path=require(_0xf8d8('0x2'));var timeout=require(_0xf8d8('0x3'));var express=require(_0xf8d8('0x4'));var router=express[_0xf8d8('0x5')]();var fs_extra=require(_0xf8d8('0x6'));var auth=require(_0xf8d8('0x7'));var interaction=require(_0xf8d8('0x8'));var config=require(_0xf8d8('0x9'));var controller=require(_0xf8d8('0xa'));router[_0xf8d8('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf8d8('0xb')]('/describe',auth[_0xf8d8('0xc')](),controller[_0xf8d8('0xd')]);router[_0xf8d8('0xb')](_0xf8d8('0xe'),auth[_0xf8d8('0xc')](),controller[_0xf8d8('0xf')]);router[_0xf8d8('0x10')]('/',auth[_0xf8d8('0xc')](),interaction['tracked'](_0xf8d8('0x11'),_0xf8d8('0x12')),controller[_0xf8d8('0x13')]);router['post'](_0xf8d8('0x14'),controller[_0xf8d8('0x15')]);router[_0xf8d8('0x16')](_0xf8d8('0xe'),auth[_0xf8d8('0xc')](),controller[_0xf8d8('0x17')]);router[_0xf8d8('0x16')](_0xf8d8('0x18'),auth[_0xf8d8('0xc')](),controller['accept']);router[_0xf8d8('0x16')](_0xf8d8('0x19'),auth[_0xf8d8('0xc')](),controller[_0xf8d8('0x1a')]);router['delete'](_0xf8d8('0xe'),auth[_0xf8d8('0xc')](),controller['destroy']);module[_0xf8d8('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 5e89d34..b135ae6 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 _0xc69b=['exports','medium','BOOLEAN','ENUM','out','STRING','DATE','TEXT','sequelize'];(function(_0x14c309,_0x373331){var _0x3bc8da=function(_0x180f4c){while(--_0x180f4c){_0x14c309['push'](_0x14c309['shift']());}};_0x3bc8da(++_0x373331);}(_0xc69b,0x1d3));var _0xbc69=function(_0x5a99db,_0x1cece5){_0x5a99db=_0x5a99db-0x0;var _0x3aad62=_0xc69b[_0x5a99db];return _0x3aad62;};'use strict';var Sequelize=require(_0xbc69('0x0'));module[_0xbc69('0x1')]={'body':{'type':Sequelize['TEXT'](_0xbc69('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xbc69('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbc69('0x4')]('in',_0xbc69('0x5')),'defaultValue':_0xbc69('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xbc69('0x6')](0xbe)},'phone':{'type':Sequelize[_0xbc69('0x6')]},'readAt':{'type':Sequelize[_0xbc69('0x7')]},'secret':{'type':Sequelize[_0xbc69('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xbc69('0x6')]},'providerResponse':{'type':Sequelize[_0xbc69('0x8')]}}; \ No newline at end of file +var _0x428b=['ENUM','out','STRING','DATE','BOOLEAN','exports','TEXT','medium'];(function(_0x12f11e,_0x45a399){var _0x25ecf1=function(_0x12907b){while(--_0x12907b){_0x12f11e['push'](_0x12f11e['shift']());}};_0x25ecf1(++_0x45a399);}(_0x428b,0xc5));var _0xb428=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x428b[_0xaa1b3e];return _0x454d7d;};'use strict';var Sequelize=require('sequelize');module[_0xb428('0x0')]={'body':{'type':Sequelize[_0xb428('0x1')](_0xb428('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xb428('0x3')]('in',_0xb428('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xb428('0x5')]},'readAt':{'type':Sequelize[_0xb428('0x6')]},'secret':{'type':Sequelize[_0xb428('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xb428('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 21d2ec7..6af5b5e 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 _0xe34f=['[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','ContactId','QueryTypes','SELECT','rejectmessage','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','plivo','MessageUUID','messageId','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','results','groupName','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','SmsMessage','includeAll','include','show','params','length','create','body','update','describe','../../config/logger','sms-interactions','accept','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','find','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe34f,0xbc));var _0xfe34=function(_0x86d9dc,_0x382631){_0x86d9dc=_0x86d9dc-0x0;var _0x4cdbf3=_0xe34f[_0x86d9dc];return _0x4cdbf3;};'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(_0xfe34('0x0'));var moment=require(_0xfe34('0x1'));var BPromise=require(_0xfe34('0x2'));var Mustache=require(_0xfe34('0x3'));var util=require(_0xfe34('0x4'));var path=require(_0xfe34('0x5'));var sox=require(_0xfe34('0x6'));var csv=require('to-csv');var ejs=require(_0xfe34('0x7'));var fs=require('fs');var fs_extra=require(_0xfe34('0x8'));var _=require(_0xfe34('0x9'));var squel=require(_0xfe34('0xa'));var crypto=require(_0xfe34('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfe34('0xc'));var querystring=require(_0xfe34('0xd'));var Papa=require(_0xfe34('0xe'));var Redis=require(_0xfe34('0xf'));var authService=require(_0xfe34('0x10'));var qs=require(_0xfe34('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xfe34('0x12'));var config=require(_0xfe34('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xfe34('0x14'))['db'];config[_0xfe34('0x15')]=_[_0xfe34('0x16')](config[_0xfe34('0x15')],{'host':_0xfe34('0x17'),'port':0x18eb});var socket=require(_0xfe34('0x18'))(new Redis(config['redis']));require(_0xfe34('0x19'))[_0xfe34('0x1a')](socket);var jayson=require(_0xfe34('0x1b'));var client=jayson[_0xfe34('0x1c')][_0xfe34('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xfe34('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x3acbda,_0x2cdaa5,_0x40927b,_0x53099b){return new BPromise(function(_0x53b469,_0x543d77){var _0x2ce838=_0x53099b||client;return _0x2ce838['request'](_0x3acbda,_0x40927b)['then'](function(_0x495b48){logger[_0xfe34('0x1e')](_0xfe34('0x1f'),_0x2cdaa5,_0xfe34('0x20'));logger[_0xfe34('0x21')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2cdaa5,_0xfe34('0x20'),JSON[_0xfe34('0x22')](_0x495b48));if(_0x495b48[_0xfe34('0x23')]){if(_0x495b48[_0xfe34('0x23')][_0xfe34('0x24')]===0x1f4){logger[_0xfe34('0x23')]('SmsMessage,\x20%s,\x20%s',_0x2cdaa5,_0x495b48[_0xfe34('0x23')][_0xfe34('0x25')]);return _0x543d77(_0x495b48[_0xfe34('0x23')]['message']);}logger[_0xfe34('0x23')](_0xfe34('0x1f'),_0x2cdaa5,_0x495b48[_0xfe34('0x23')][_0xfe34('0x25')]);return _0x53b469(_0x495b48[_0xfe34('0x23')][_0xfe34('0x25')]);}else{logger[_0xfe34('0x1e')](_0xfe34('0x1f'),_0x2cdaa5,_0xfe34('0x20'));_0x53b469(_0x495b48[_0xfe34('0x26')]['message']);}})[_0xfe34('0x27')](function(_0x257c3c){logger['error'](_0xfe34('0x1f'),_0x2cdaa5,_0x257c3c);_0x543d77(_0x257c3c);});});}function respondWithStatusCode(_0x524b55,_0x5a0db6){_0x5a0db6=_0x5a0db6||0xcc;return function(_0xdec4c7){if(_0xdec4c7){return _0x524b55['sendStatus'](_0x5a0db6);}return _0x524b55['status'](_0x5a0db6)[_0xfe34('0x28')]();};}function respondWithResult(_0x27c895,_0x48a886){_0x48a886=_0x48a886||0xc8;return function(_0x372886){if(_0x372886){return _0x27c895[_0xfe34('0x29')](_0x48a886)[_0xfe34('0x2a')](_0x372886);}};}function respondWithFilteredResult(_0x3ab3e5,_0x58eba7){return function(_0x4d153b){if(_0x4d153b){var _0x59e06b=typeof _0x58eba7[_0xfe34('0x2b')]===_0xfe34('0x2c')&&typeof _0x58eba7[_0xfe34('0x2d')]===_0xfe34('0x2c');var _0x550e44=_0x4d153b[_0xfe34('0x2e')];var _0x44adf0=_0x59e06b?0x0:_0x58eba7['offset'];var _0x345c00=_0x59e06b?_0x4d153b[_0xfe34('0x2e')]:_0x58eba7[_0xfe34('0x2b')]+_0x58eba7['limit'];var _0x435670;if(_0x345c00>=_0x550e44){_0x345c00=_0x550e44;_0x435670=0xc8;}else{_0x435670=0xce;}_0x3ab3e5[_0xfe34('0x29')](_0x435670);return _0x3ab3e5[_0xfe34('0x2f')](_0xfe34('0x30'),_0x44adf0+'-'+_0x345c00+'/'+_0x550e44)['json'](_0x4d153b);}return null;};}function patchUpdates(_0x3694ab){return function(_0xd2f3df){try{jsonpatch['apply'](_0xd2f3df,_0x3694ab,!![]);}catch(_0x187cf0){return BPromise[_0xfe34('0x31')](_0x187cf0);}return _0xd2f3df[_0xfe34('0x32')]();};}function saveUpdates(_0x1f09e4,_0x38ffc6){return function(_0x54bc7a){if(_0x54bc7a){return _0x54bc7a['update'](_0x1f09e4)[_0xfe34('0x33')](function(_0x486339){return _0x486339;});}return null;};}function removeEntity(_0x2b3e1e,_0x3ae5aa){return function(_0x1a3b9c){if(_0x1a3b9c){return _0x1a3b9c[_0xfe34('0x34')]()[_0xfe34('0x33')](function(){_0x2b3e1e[_0xfe34('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f5039,_0x275a81){return function(_0xa7d1d4){if(!_0xa7d1d4){_0x2f5039[_0xfe34('0x35')](0x194);}return _0xa7d1d4;};}function handleError(_0x147870,_0x28ee1b){_0x28ee1b=_0x28ee1b||0x1f4;return function(_0x34b812){logger[_0xfe34('0x23')](_0x34b812[_0xfe34('0x36')]);if(_0x34b812[_0xfe34('0x37')]){delete _0x34b812[_0xfe34('0x37')];}_0x147870[_0xfe34('0x29')](_0x28ee1b)[_0xfe34('0x38')](_0x34b812);};}exports[_0xfe34('0x39')]=function(_0x1589f9,_0x46c857){var _0x16d7ea={},_0x1f463a={},_0xefb472={'count':0x0,'rows':[]};var _0x4c1c71=_[_0xfe34('0x3a')](db['SmsMessage'][_0xfe34('0x3b')],function(_0x5900a3){return{'name':_0x5900a3[_0xfe34('0x3c')],'type':_0x5900a3[_0xfe34('0x3d')][_0xfe34('0x3e')]};});_0x1f463a[_0xfe34('0x3f')]=_['map'](_0x4c1c71,'name');_0x1f463a['query']=_[_0xfe34('0x40')](_0x1589f9['query']);_0x1f463a[_0xfe34('0x41')]=_[_0xfe34('0x42')](_0x1f463a[_0xfe34('0x3f')],_0x1f463a[_0xfe34('0x43')]);_0x16d7ea[_0xfe34('0x44')]=_[_0xfe34('0x42')](_0x1f463a[_0xfe34('0x3f')],qs[_0xfe34('0x45')](_0x1589f9[_0xfe34('0x43')][_0xfe34('0x45')]));_0x16d7ea[_0xfe34('0x44')]=_0x16d7ea[_0xfe34('0x44')]['length']?_0x16d7ea[_0xfe34('0x44')]:_0x1f463a[_0xfe34('0x3f')];if(!_0x1589f9[_0xfe34('0x43')][_0xfe34('0x46')]('nolimit')){_0x16d7ea[_0xfe34('0x2d')]=qs[_0xfe34('0x2d')](_0x1589f9['query'][_0xfe34('0x2d')]);_0x16d7ea['offset']=qs[_0xfe34('0x2b')](_0x1589f9['query'][_0xfe34('0x2b')]);}_0x16d7ea['order']=qs[_0xfe34('0x47')](_0x1589f9[_0xfe34('0x43')][_0xfe34('0x47')]);_0x16d7ea[_0xfe34('0x48')]=qs[_0xfe34('0x41')](_[_0xfe34('0x49')](_0x1589f9[_0xfe34('0x43')],_0x1f463a['filters']),_0x4c1c71);if(_0x1589f9[_0xfe34('0x43')][_0xfe34('0x4a')]){_0x16d7ea['where']=_[_0xfe34('0x4b')](_0x16d7ea['where'],{'$or':_[_0xfe34('0x3a')](_0x4c1c71,function(_0x7762c7){if(_0x7762c7[_0xfe34('0x3d')]!==_0xfe34('0x4c')){var _0x455563={};_0x455563[_0x7762c7[_0xfe34('0x37')]]={'$like':'%'+_0x1589f9[_0xfe34('0x43')][_0xfe34('0x4a')]+'%'};return _0x455563;}})});}_0x16d7ea=_[_0xfe34('0x4b')]({},_0x16d7ea,_0x1589f9[_0xfe34('0x4d')]);var _0x345985={'where':_0x16d7ea[_0xfe34('0x48')]};return db[_0xfe34('0x4e')][_0xfe34('0x2e')](_0x345985)[_0xfe34('0x33')](function(_0x4dc971){_0xefb472[_0xfe34('0x2e')]=_0x4dc971;if(_0x1589f9['query'][_0xfe34('0x4f')]){_0x16d7ea[_0xfe34('0x50')]=[{'all':!![]}];}return db[_0xfe34('0x4e')]['findAll'](_0x16d7ea);})['then'](function(_0x4707d4){_0xefb472['rows']=_0x4707d4;return _0xefb472;})['then'](respondWithFilteredResult(_0x46c857,_0x16d7ea))[_0xfe34('0x27')](handleError(_0x46c857,null));};exports[_0xfe34('0x51')]=function(_0x1ed876,_0x408390){var _0x510db3={'raw':!![],'where':{'id':_0x1ed876[_0xfe34('0x52')]['id']}},_0x232622={};_0x232622[_0xfe34('0x3f')]=_[_0xfe34('0x40')](db[_0xfe34('0x4e')][_0xfe34('0x3b')]);_0x232622[_0xfe34('0x43')]=_[_0xfe34('0x40')](_0x1ed876['query']);_0x232622[_0xfe34('0x41')]=_[_0xfe34('0x42')](_0x232622[_0xfe34('0x3f')],_0x232622[_0xfe34('0x43')]);_0x510db3['attributes']=_[_0xfe34('0x42')](_0x232622[_0xfe34('0x3f')],qs[_0xfe34('0x45')](_0x1ed876['query']['fields']));_0x510db3['attributes']=_0x510db3[_0xfe34('0x44')][_0xfe34('0x53')]?_0x510db3['attributes']:_0x232622[_0xfe34('0x3f')];if(_0x1ed876['query'][_0xfe34('0x4f')]){_0x510db3[_0xfe34('0x50')]=[{'all':!![]}];}_0x510db3=_[_0xfe34('0x4b')]({},_0x510db3,_0x1ed876[_0xfe34('0x4d')]);return db[_0xfe34('0x4e')]['find'](_0x510db3)[_0xfe34('0x33')](handleEntityNotFound(_0x408390,null))[_0xfe34('0x33')](respondWithResult(_0x408390,null))[_0xfe34('0x27')](handleError(_0x408390,null));};exports[_0xfe34('0x54')]=function(_0x5f3232,_0x56a6dc){return db[_0xfe34('0x4e')][_0xfe34('0x54')](_0x5f3232[_0xfe34('0x55')],{})[_0xfe34('0x33')](respondWithResult(_0x56a6dc,0xc9))['catch'](handleError(_0x56a6dc,null));};exports[_0xfe34('0x56')]=function(_0x450ebe,_0x1ef0eb){if(_0x450ebe[_0xfe34('0x55')]['id']){delete _0x450ebe['body']['id'];}return db[_0xfe34('0x4e')]['find']({'where':{'id':_0x450ebe[_0xfe34('0x52')]['id']}})['then'](handleEntityNotFound(_0x1ef0eb,null))[_0xfe34('0x33')](saveUpdates(_0x450ebe[_0xfe34('0x55')],null))[_0xfe34('0x33')](respondWithResult(_0x1ef0eb,null))[_0xfe34('0x27')](handleError(_0x1ef0eb,null));};exports[_0xfe34('0x34')]=function(_0x249e9a,_0x1cc5bb){return db[_0xfe34('0x4e')]['find']({'where':{'id':_0x249e9a[_0xfe34('0x52')]['id']}})[_0xfe34('0x33')](handleEntityNotFound(_0x1cc5bb,null))[_0xfe34('0x33')](removeEntity(_0x1cc5bb,null))['catch'](handleError(_0x1cc5bb,null));};exports[_0xfe34('0x57')]=function(_0x12e354,_0x4daf0f){return db[_0xfe34('0x4e')]['describe']()['then'](respondWithResult(_0x4daf0f,null))[_0xfe34('0x27')](handleError(_0x4daf0f,null));};var interaction_log=require(_0xfe34('0x58'))(_0xfe34('0x59'));exports[_0xfe34('0x5a')]=function(_0x4042d6,_0x26fe36,_0x3f56b3){var _0x3bc3e8={'agent':{},'channel':_0xfe34('0x5b')};if(_0x4042d6['body']['id']){delete _0x4042d6[_0xfe34('0x55')]['id'];}_0x4042d6[_0xfe34('0x55')][_0xfe34('0x5c')]=!![];_0x4042d6[_0xfe34('0x55')]['readAt']=moment()[_0xfe34('0x5d')](_0xfe34('0x5e'));_0x4042d6['body'][_0xfe34('0x5f')]=_0x4042d6[_0xfe34('0x55')]['UserId']||_0x4042d6[_0xfe34('0x60')]['id'];_0x3bc3e8['agent']['id']=_0x4042d6['body']['UserId'];return db[_0xfe34('0x4e')][_0xfe34('0x61')]({'where':{'id':_0x4042d6[_0xfe34('0x52')]['id'],'UserId':null}})[_0xfe34('0x33')](handleEntityNotFound(_0x26fe36,null))[_0xfe34('0x33')](saveUpdates(_0x4042d6['body'],null))[_0xfe34('0x33')](function(_0x50c798){if(_0x50c798){_0x3bc3e8[_0xfe34('0x25')]=_0x50c798[_0xfe34('0x62')]({'plain':!![]});return db[_0xfe34('0x63')][_0xfe34('0x61')]({'where':{'id':_0x50c798[_0xfe34('0x64')]}});}return null;})[_0xfe34('0x33')](handleEntityNotFound(_0x26fe36,null))[_0xfe34('0x33')](function(_0x428c85){if(_0x428c85){return _0x428c85['update']({'UserId':_0x4042d6['body'][_0xfe34('0x5f')],'read1stAt':_[_0xfe34('0x65')](_0x428c85[_0xfe34('0x66')])?moment()[_0xfe34('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xfe34('0x33')](function(_0x2b05dd){if(_0x2b05dd){_0x3bc3e8[_0xfe34('0x67')]=_0x2b05dd[_0xfe34('0x62')]({'plain':!![]});interaction_log[_0xfe34('0x1e')](_0xfe34('0x68'),_0x4042d6[_0xfe34('0x60')]['id'],_0x4042d6[_0xfe34('0x60')]['name'],_0x4042d6[_0xfe34('0x60')]['role'],_0x3bc3e8[_0xfe34('0x67')]['id'],_0x4042d6[_0xfe34('0x55')]?JSON['stringify'](_0x4042d6[_0xfe34('0x55')]):'null');return respondWithRpcPromise(_0xfe34('0x69'),_0xfe34('0x6a'),_0x3bc3e8);}return null;})[_0xfe34('0x33')](function(_0xd55b0a){var _0x2a7724=_0xfe34('0x6b')+_0xd55b0a[_0xfe34('0x25')]['ContactId'];return db[_0xfe34('0x6c')]['query'](_0x2a7724,{'type':db[_0xfe34('0x6d')]['QueryTypes']['SELECT'],'raw':!![]})[_0xfe34('0x33')](function(_0x33ee25){return _0x33ee25;});})[_0xfe34('0x33')](function(_0x10385f){if(_0x10385f){_0x3bc3e8[_0xfe34('0x25')][_0xfe34('0x6e')]=_0x10385f[0x0];if(!_0x4042d6[_0xfe34('0x55')][_0xfe34('0x5f')])return;return db[_0xfe34('0x6f')][_0xfe34('0x61')]({'where':{'id':_0x4042d6[_0xfe34('0x55')][_0xfe34('0x5f')],'role':_0xfe34('0x70')},'attributes':['id','name',_0xfe34('0x71'),_0xfe34('0x72'),_0xfe34('0x73')],'raw':!![]});}return null;})[_0xfe34('0x33')](function(_0x7b7a1){if(!_0x7b7a1)return null;_0x3bc3e8[_0xfe34('0x25')][_0xfe34('0x70')]=_0x7b7a1;return _0x3bc3e8;})[_0xfe34('0x33')](function(_0x543228){if(_0x543228){if(_0x4042d6[_0xfe34('0x55')][_0xfe34('0x74')]){_0x3bc3e8[_0xfe34('0x25')][_0xfe34('0x75')]=util[_0xfe34('0x5d')](_0xfe34('0x76'),_0x4042d6['user'][_0xfe34('0x37')]);_0x3bc3e8[_0xfe34('0x25')]['channel']=_0x3bc3e8[_0xfe34('0x77')];_0x3bc3e8[_0xfe34('0x25')][_0xfe34('0x78')]=_0x3bc3e8[_0xfe34('0x77')];_0x3bc3e8['message'][_0xfe34('0x79')]=_0xfe34('0x5a');return respondWithRpcPromise(_0xfe34('0x7a'),_0xfe34('0x7a'),{'event':'acceptmessage','message':_0x3bc3e8['message']},client9002)[_0xfe34('0x33')](function(){return _0x3bc3e8;});}return _0x3bc3e8;}return null;})[_0xfe34('0x33')](respondWithResult(_0x26fe36,null))[_0xfe34('0x27')](handleError(_0x26fe36,null));};var interaction_log=require('../../config/logger')(_0xfe34('0x59'));exports[_0xfe34('0x31')]=function(_0x5b51a6,_0x5d5f83,_0x3c9acc){var _0x31d35e={'agent':{},'channel':_0xfe34('0x5b')};if(_0x5b51a6[_0xfe34('0x55')]['id']){delete _0x5b51a6[_0xfe34('0x55')]['id'];}_0x5b51a6[_0xfe34('0x55')][_0xfe34('0x5f')]=_0x5b51a6[_0xfe34('0x55')][_0xfe34('0x5f')]||_0x5b51a6['user']['id'];_0x31d35e[_0xfe34('0x70')]['id']=_0x5b51a6[_0xfe34('0x55')][_0xfe34('0x5f')];return db[_0xfe34('0x4e')][_0xfe34('0x61')]({'where':{'id':_0x5b51a6['params']['id'],'UserId':null}})[_0xfe34('0x33')](handleEntityNotFound(_0x5d5f83,null))[_0xfe34('0x33')](function(_0x2edaf3){if(_0x2edaf3){_0x31d35e[_0xfe34('0x25')]=_0x2edaf3[_0xfe34('0x62')]({'plain':!![]});return db['SmsInteraction'][_0xfe34('0x61')]({'where':{'id':_0x2edaf3[_0xfe34('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x5d5f83,null))['then'](function(_0x33cf98){if(_0x33cf98){_0x31d35e[_0xfe34('0x67')]=_0x33cf98[_0xfe34('0x62')]({'plain':!![]});interaction_log[_0xfe34('0x1e')](_0xfe34('0x7b'),_0x5b51a6[_0xfe34('0x60')]['id'],_0x5b51a6['user']['name'],_0x5b51a6[_0xfe34('0x60')][_0xfe34('0x7c')],_0x31d35e[_0xfe34('0x67')]['id'],_0x5b51a6[_0xfe34('0x55')]?JSON[_0xfe34('0x22')](_0x5b51a6['body']):_0xfe34('0x7d'));return respondWithRpcPromise(_0xfe34('0x7e'),_0xfe34('0x7f'),_0x31d35e);}return null;})['then'](function(_0x176539){var _0x1ff46f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x176539[_0xfe34('0x25')][_0xfe34('0x80')];return db[_0xfe34('0x6c')]['query'](_0x1ff46f,{'type':db[_0xfe34('0x6d')][_0xfe34('0x81')][_0xfe34('0x82')],'raw':!![]})['then'](function(_0x55a509){return _0x55a509;});})['then'](function(_0x48e922){if(_0x48e922){_0x31d35e[_0xfe34('0x25')]['contact']=_0x48e922[0x0];if(!_0x5b51a6[_0xfe34('0x55')][_0xfe34('0x5f')])return;return db[_0xfe34('0x6f')]['find']({'where':{'id':_0x5b51a6['body'][_0xfe34('0x5f')],'role':_0xfe34('0x70')},'attributes':['id',_0xfe34('0x37'),_0xfe34('0x71'),_0xfe34('0x72'),_0xfe34('0x73')],'raw':!![]});}return null;})[_0xfe34('0x33')](function(_0x2188a1){if(!_0x2188a1)return null;_0x31d35e['message'][_0xfe34('0x70')]=_0x2188a1;return _0x31d35e;})[_0xfe34('0x33')](function(_0xc857da){if(_0xc857da){_0xc857da[_0xfe34('0x25')][_0xfe34('0x75')]=util[_0xfe34('0x5d')](_0xfe34('0x76'),_0x5b51a6[_0xfe34('0x60')][_0xfe34('0x37')]);_0xc857da[_0xfe34('0x25')]['channel']=_0x31d35e['channel'];_0xc857da[_0xfe34('0x25')][_0xfe34('0x78')]=_0x31d35e['channel'];_0xc857da[_0xfe34('0x25')]['event']='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0xfe34('0x83'),'message':_0xc857da['message']},client9002);return _0x31d35e;}return null;})[_0xfe34('0x33')](respondWithResult(_0x5d5f83,null))[_0xfe34('0x27')](handleError(_0x5d5f83,null));};exports[_0xfe34('0x29')]=function(_0x36f3d8,_0x31cd81,_0x1fd630){if(_0x36f3d8[_0xfe34('0x55')]['id']){delete _0x36f3d8['body']['id'];}var _0x39dc30;return db['SmsMessage']['find']({'where':{'id':_0x36f3d8[_0xfe34('0x52')]['id']}})[_0xfe34('0x33')](handleEntityNotFound(_0x31cd81,null))[_0xfe34('0x33')](function(_0x1ea241){if(_0x1ea241){_0x39dc30=_0x1ea241;return db['SmsAccount'][_0xfe34('0x61')]({'where':{'id':_0x1ea241[_0xfe34('0x84')]}});}})[_0xfe34('0x33')](handleEntityNotFound(_0x31cd81,null))['then'](function(_0x46980f){if(_0x46980f){logger[_0xfe34('0x21')](_0xfe34('0x85'),_0xfe34('0x29'),'received\x20delivery\x20report\x20from',_0x46980f[_0xfe34('0x3d')],util[_0xfe34('0x86')](_0x36f3d8[_0xfe34('0x55')],{'showHidden':![],'depth':null}));switch(_0x46980f[_0xfe34('0x3d')]){case _0xfe34('0x87'):if(_0x36f3d8[_0xfe34('0x55')][_0xfe34('0x88')]&&_0x36f3d8[_0xfe34('0x55')][_0xfe34('0x88')]===_0x39dc30['messageId']){return _0x39dc30[_0xfe34('0x56')]({'read':!![]});}else{logger[_0xfe34('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xfe34('0x29'),'twilio',util['inspect'](_0x36f3d8['body'],{'showHidden':![],'depth':null}));}break;case _0xfe34('0x89'):if(_0x36f3d8[_0xfe34('0x55')][_0xfe34('0x8a')]&&_0x36f3d8[_0xfe34('0x55')][_0xfe34('0x8a')]===_0x39dc30[_0xfe34('0x8b')]&&_['indexOf'](['sent',_0xfe34('0x8c')],_0x36f3d8['body'][_0xfe34('0x8d')])>=0x0){return _0x39dc30[_0xfe34('0x56')]({'read':!![]});}else{logger[_0xfe34('0x23')](_0xfe34('0x8e'),_0xfe34('0x29'),_0xfe34('0x8f'),util[_0xfe34('0x86')](_0x36f3d8[_0xfe34('0x55')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x3556a0=_0x36f3d8[_0xfe34('0x55')][_0xfe34('0x90')][0x0];if(_0x3556a0['status'][_0xfe34('0x91')]==='DELIVERED'){return _0x39dc30['update']({'read':!![]});}else{logger[_0xfe34('0x23')](_0xfe34('0x8e'),_0xfe34('0x29'),'infobip',util[_0xfe34('0x86')](_0x36f3d8[_0xfe34('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x39dc30;}})['then'](respondWithResult(_0x31cd81,null))[_0xfe34('0x27')](handleError(_0x31cd81,null));}; \ No newline at end of file +var _0x17bb=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./smsMessage.socket','register','http','request','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','send','index','SmsMessage','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll','rows','catch','show','fields','includeAll','options','create','body','params','describe','accept','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','find','SmsInteractionId','isNil','read1stAt','format','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','contact','agent','fullname','internal','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','sms-interactions','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','SELECT','User','email','SIP/%s','rejectmessage','SmsAccountId','debug','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','delivered','Status','plivio','groupName','DELIVERED','infobip','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x1b0051,_0x4725e6){var _0x5a9c59=function(_0x40ee81){while(--_0x40ee81){_0x1b0051['push'](_0x1b0051['shift']());}};_0x5a9c59(++_0x4725e6);}(_0x17bb,0x80));var _0xb17b=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x17bb[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xb17b('0x0'));var rimraf=require(_0xb17b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb17b('0x2'));var rp=require(_0xb17b('0x3'));var moment=require(_0xb17b('0x4'));var BPromise=require(_0xb17b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb17b('0x6'));var sox=require(_0xb17b('0x7'));var csv=require(_0xb17b('0x8'));var ejs=require(_0xb17b('0x9'));var fs=require('fs');var fs_extra=require(_0xb17b('0xa'));var _=require(_0xb17b('0xb'));var squel=require(_0xb17b('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb17b('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb17b('0xe'));var Papa=require(_0xb17b('0xf'));var Redis=require(_0xb17b('0x10'));var authService=require(_0xb17b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb17b('0x12'));var hardwareService=require(_0xb17b('0x13'));var logger=require(_0xb17b('0x14'))('api');var utils=require(_0xb17b('0x15'));var config=require(_0xb17b('0x16'));var licenseUtil=require(_0xb17b('0x17'));var db=require(_0xb17b('0x18'))['db'];config[_0xb17b('0x19')]=_[_0xb17b('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb17b('0x1b'))[_0xb17b('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xb17b('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xb17b('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5276b8,_0x5b3af5,_0x4f9d5f,_0x1e0fe2){return new BPromise(function(_0x4f02a0,_0xf44cfe){var _0x543b8b=_0x1e0fe2||client;return _0x543b8b[_0xb17b('0x1e')](_0x5276b8,_0x4f9d5f)['then'](function(_0x3c7209){logger['info'](_0xb17b('0x1f'),_0x5b3af5,_0xb17b('0x20'));logger['debug'](_0xb17b('0x21'),_0x5b3af5,_0xb17b('0x20'),JSON[_0xb17b('0x22')](_0x3c7209));if(_0x3c7209['error']){if(_0x3c7209[_0xb17b('0x23')][_0xb17b('0x24')]===0x1f4){logger['error'](_0xb17b('0x1f'),_0x5b3af5,_0x3c7209[_0xb17b('0x23')][_0xb17b('0x25')]);return _0xf44cfe(_0x3c7209['error']['message']);}logger[_0xb17b('0x23')]('SmsMessage,\x20%s,\x20%s',_0x5b3af5,_0x3c7209[_0xb17b('0x23')][_0xb17b('0x25')]);return _0x4f02a0(_0x3c7209[_0xb17b('0x23')][_0xb17b('0x25')]);}else{logger[_0xb17b('0x26')](_0xb17b('0x1f'),_0x5b3af5,_0xb17b('0x20'));_0x4f02a0(_0x3c7209[_0xb17b('0x27')][_0xb17b('0x25')]);}})['catch'](function(_0x313f8a){logger[_0xb17b('0x23')](_0xb17b('0x1f'),_0x5b3af5,_0x313f8a);_0xf44cfe(_0x313f8a);});});}function respondWithStatusCode(_0x31d86c,_0x58154b){_0x58154b=_0x58154b||0xcc;return function(_0x14d6f1){if(_0x14d6f1){return _0x31d86c[_0xb17b('0x28')](_0x58154b);}return _0x31d86c[_0xb17b('0x29')](_0x58154b)[_0xb17b('0x2a')]();};}function respondWithResult(_0x674fc7,_0x40be8e){_0x40be8e=_0x40be8e||0xc8;return function(_0x379f53){if(_0x379f53){return _0x674fc7[_0xb17b('0x29')](_0x40be8e)['json'](_0x379f53);}};}function respondWithFilteredResult(_0x2400e0,_0x32f918){return function(_0xf4cc35){if(_0xf4cc35){var _0x1ce6c0=typeof _0x32f918[_0xb17b('0x2b')]===_0xb17b('0x2c')&&typeof _0x32f918[_0xb17b('0x2d')]==='undefined';var _0x130699=_0xf4cc35[_0xb17b('0x2e')];var _0x497353=_0x1ce6c0?0x0:_0x32f918[_0xb17b('0x2b')];var _0x45855e=_0x1ce6c0?_0xf4cc35[_0xb17b('0x2e')]:_0x32f918[_0xb17b('0x2b')]+_0x32f918['limit'];var _0x5da2b3;if(_0x45855e>=_0x130699){_0x45855e=_0x130699;_0x5da2b3=0xc8;}else{_0x5da2b3=0xce;}_0x2400e0['status'](_0x5da2b3);return _0x2400e0[_0xb17b('0x2f')](_0xb17b('0x30'),_0x497353+'-'+_0x45855e+'/'+_0x130699)['json'](_0xf4cc35);}return null;};}function patchUpdates(_0x42d0fa){return function(_0x2096e0){try{jsonpatch['apply'](_0x2096e0,_0x42d0fa,!![]);}catch(_0x369a63){return BPromise[_0xb17b('0x31')](_0x369a63);}return _0x2096e0[_0xb17b('0x32')]();};}function saveUpdates(_0x570b55,_0x2867a7){return function(_0x509da1){if(_0x509da1){return _0x509da1[_0xb17b('0x33')](_0x570b55)[_0xb17b('0x34')](function(_0x39fd31){return _0x39fd31;});}return null;};}function removeEntity(_0x110442,_0x3a7343){return function(_0x9a0c9b){if(_0x9a0c9b){return _0x9a0c9b[_0xb17b('0x35')]()[_0xb17b('0x34')](function(){_0x110442['status'](0xcc)[_0xb17b('0x2a')]();});}};}function handleEntityNotFound(_0xdb6693,_0x4adb93){return function(_0x1aa543){if(!_0x1aa543){_0xdb6693['sendStatus'](0x194);}return _0x1aa543;};}function handleError(_0x2511f6,_0x309696){_0x309696=_0x309696||0x1f4;return function(_0x3c6f2e){logger[_0xb17b('0x23')](_0x3c6f2e['stack']);if(_0x3c6f2e['name']){delete _0x3c6f2e['name'];}_0x2511f6[_0xb17b('0x29')](_0x309696)[_0xb17b('0x36')](_0x3c6f2e);};}exports[_0xb17b('0x37')]=function(_0x3b2771,_0x50ef09){var _0x3d50e9={},_0x246c7a={},_0x3e4d09={'count':0x0,'rows':[]};var _0x30b321=_['map'](db[_0xb17b('0x38')][_0xb17b('0x39')],function(_0x16ab79){return{'name':_0x16ab79[_0xb17b('0x3a')],'type':_0x16ab79[_0xb17b('0x3b')][_0xb17b('0x3c')]};});_0x246c7a[_0xb17b('0x3d')]=_[_0xb17b('0x3e')](_0x30b321,_0xb17b('0x3f'));_0x246c7a[_0xb17b('0x40')]=_[_0xb17b('0x41')](_0x3b2771['query']);_0x246c7a[_0xb17b('0x42')]=_[_0xb17b('0x43')](_0x246c7a[_0xb17b('0x3d')],_0x246c7a['query']);_0x3d50e9[_0xb17b('0x44')]=_[_0xb17b('0x43')](_0x246c7a[_0xb17b('0x3d')],qs['fields'](_0x3b2771[_0xb17b('0x40')]['fields']));_0x3d50e9[_0xb17b('0x44')]=_0x3d50e9[_0xb17b('0x44')]['length']?_0x3d50e9[_0xb17b('0x44')]:_0x246c7a[_0xb17b('0x3d')];if(!_0x3b2771[_0xb17b('0x40')][_0xb17b('0x45')](_0xb17b('0x46'))){_0x3d50e9['limit']=qs[_0xb17b('0x2d')](_0x3b2771[_0xb17b('0x40')]['limit']);_0x3d50e9[_0xb17b('0x2b')]=qs['offset'](_0x3b2771[_0xb17b('0x40')][_0xb17b('0x2b')]);}_0x3d50e9[_0xb17b('0x47')]=qs[_0xb17b('0x48')](_0x3b2771[_0xb17b('0x40')]['sort']);_0x3d50e9[_0xb17b('0x49')]=qs[_0xb17b('0x42')](_[_0xb17b('0x4a')](_0x3b2771[_0xb17b('0x40')],_0x246c7a['filters']),_0x30b321);if(_0x3b2771[_0xb17b('0x40')][_0xb17b('0x4b')]){_0x3d50e9[_0xb17b('0x49')]=_[_0xb17b('0x4c')](_0x3d50e9[_0xb17b('0x49')],{'$or':_[_0xb17b('0x3e')](_0x30b321,function(_0x43f07a){if(_0x43f07a[_0xb17b('0x3b')]!=='VIRTUAL'){var _0x5f197f={};_0x5f197f[_0x43f07a['name']]={'$like':'%'+_0x3b2771[_0xb17b('0x40')][_0xb17b('0x4b')]+'%'};return _0x5f197f;}})});}_0x3d50e9=_['merge']({},_0x3d50e9,_0x3b2771['options']);var _0x249ff8={'where':_0x3d50e9[_0xb17b('0x49')]};return db[_0xb17b('0x38')][_0xb17b('0x2e')](_0x249ff8)[_0xb17b('0x34')](function(_0x30acae){_0x3e4d09['count']=_0x30acae;if(_0x3b2771[_0xb17b('0x40')]['includeAll']){_0x3d50e9[_0xb17b('0x4d')]=[{'all':!![]}];}return db[_0xb17b('0x38')][_0xb17b('0x4e')](_0x3d50e9);})['then'](function(_0x14e853){_0x3e4d09[_0xb17b('0x4f')]=_0x14e853;return _0x3e4d09;})['then'](respondWithFilteredResult(_0x50ef09,_0x3d50e9))[_0xb17b('0x50')](handleError(_0x50ef09,null));};exports[_0xb17b('0x51')]=function(_0x3a12a3,_0x4e3871){var _0x3d1027={'raw':!![],'where':{'id':_0x3a12a3['params']['id']}},_0x4a96e5={};_0x4a96e5[_0xb17b('0x3d')]=_[_0xb17b('0x41')](db[_0xb17b('0x38')][_0xb17b('0x39')]);_0x4a96e5[_0xb17b('0x40')]=_['keys'](_0x3a12a3[_0xb17b('0x40')]);_0x4a96e5['filters']=_[_0xb17b('0x43')](_0x4a96e5['model'],_0x4a96e5[_0xb17b('0x40')]);_0x3d1027[_0xb17b('0x44')]=_[_0xb17b('0x43')](_0x4a96e5[_0xb17b('0x3d')],qs['fields'](_0x3a12a3['query'][_0xb17b('0x52')]));_0x3d1027[_0xb17b('0x44')]=_0x3d1027[_0xb17b('0x44')]['length']?_0x3d1027[_0xb17b('0x44')]:_0x4a96e5['model'];if(_0x3a12a3[_0xb17b('0x40')][_0xb17b('0x53')]){_0x3d1027['include']=[{'all':!![]}];}_0x3d1027=_['merge']({},_0x3d1027,_0x3a12a3[_0xb17b('0x54')]);return db['SmsMessage']['find'](_0x3d1027)[_0xb17b('0x34')](handleEntityNotFound(_0x4e3871,null))['then'](respondWithResult(_0x4e3871,null))[_0xb17b('0x50')](handleError(_0x4e3871,null));};exports[_0xb17b('0x55')]=function(_0x46a73b,_0x36bc6e){return db[_0xb17b('0x38')][_0xb17b('0x55')](_0x46a73b[_0xb17b('0x56')],{})[_0xb17b('0x34')](respondWithResult(_0x36bc6e,0xc9))[_0xb17b('0x50')](handleError(_0x36bc6e,null));};exports['update']=function(_0x524400,_0x2968a7){if(_0x524400['body']['id']){delete _0x524400[_0xb17b('0x56')]['id'];}return db[_0xb17b('0x38')]['find']({'where':{'id':_0x524400[_0xb17b('0x57')]['id']}})[_0xb17b('0x34')](handleEntityNotFound(_0x2968a7,null))[_0xb17b('0x34')](saveUpdates(_0x524400[_0xb17b('0x56')],null))['then'](respondWithResult(_0x2968a7,null))[_0xb17b('0x50')](handleError(_0x2968a7,null));};exports['destroy']=function(_0x64995d,_0x28f77a){return db[_0xb17b('0x38')]['find']({'where':{'id':_0x64995d['params']['id']}})[_0xb17b('0x34')](handleEntityNotFound(_0x28f77a,null))['then'](removeEntity(_0x28f77a,null))[_0xb17b('0x50')](handleError(_0x28f77a,null));};exports[_0xb17b('0x58')]=function(_0x277f99,_0x216caa){return db['SmsMessage'][_0xb17b('0x58')]()[_0xb17b('0x34')](respondWithResult(_0x216caa,null))[_0xb17b('0x50')](handleError(_0x216caa,null));};var interaction_log=require(_0xb17b('0x14'))('sms-interactions');exports[_0xb17b('0x59')]=function(_0x3f6778,_0x2401d0,_0xd0850c){var _0x43a9f5={'agent':{},'channel':_0xb17b('0x5a')};if(_0x3f6778[_0xb17b('0x56')]['id']){delete _0x3f6778[_0xb17b('0x56')]['id'];}_0x3f6778[_0xb17b('0x56')][_0xb17b('0x5b')]=!![];_0x3f6778['body'][_0xb17b('0x5c')]=moment()['format'](_0xb17b('0x5d'));_0x3f6778[_0xb17b('0x56')]['UserId']=_0x3f6778[_0xb17b('0x56')][_0xb17b('0x5e')]||_0x3f6778[_0xb17b('0x5f')]['id'];_0x43a9f5['agent']['id']=_0x3f6778['body'][_0xb17b('0x5e')];return db['SmsMessage'][_0xb17b('0x60')]({'where':{'id':_0x3f6778[_0xb17b('0x57')]['id'],'UserId':null}})[_0xb17b('0x34')](handleEntityNotFound(_0x2401d0,null))[_0xb17b('0x34')](saveUpdates(_0x3f6778['body'],null))['then'](function(_0x1dbdc5){if(_0x1dbdc5){_0x43a9f5['message']=_0x1dbdc5['get']({'plain':!![]});return db['SmsInteraction'][_0xb17b('0x60')]({'where':{'id':_0x1dbdc5[_0xb17b('0x61')]}});}return null;})[_0xb17b('0x34')](handleEntityNotFound(_0x2401d0,null))['then'](function(_0x4f3388){if(_0x4f3388){return _0x4f3388['update']({'UserId':_0x3f6778[_0xb17b('0x56')][_0xb17b('0x5e')],'read1stAt':_[_0xb17b('0x62')](_0x4f3388[_0xb17b('0x63')])?moment()[_0xb17b('0x64')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xb17b('0x34')](function(_0x2243c4){if(_0x2243c4){_0x43a9f5['interaction']=_0x2243c4[_0xb17b('0x65')]({'plain':!![]});interaction_log[_0xb17b('0x26')](_0xb17b('0x66'),_0x3f6778[_0xb17b('0x5f')]['id'],_0x3f6778['user'][_0xb17b('0x3f')],_0x3f6778[_0xb17b('0x5f')][_0xb17b('0x67')],_0x43a9f5[_0xb17b('0x68')]['id'],_0x3f6778['body']?JSON[_0xb17b('0x22')](_0x3f6778[_0xb17b('0x56')]):_0xb17b('0x69'));return respondWithRpcPromise(_0xb17b('0x6a'),'acceptMessage',_0x43a9f5);}return null;})[_0xb17b('0x34')](function(_0x12224c){var _0x50fb88=_0xb17b('0x6b')+_0x12224c['message']['ContactId'];return db[_0xb17b('0x6c')]['query'](_0x50fb88,{'type':db['Sequelize'][_0xb17b('0x6d')]['SELECT'],'raw':!![]})['then'](function(_0x5b0b5c){return _0x5b0b5c;});})['then'](function(_0x4e037a){if(_0x4e037a){_0x43a9f5[_0xb17b('0x25')][_0xb17b('0x6e')]=_0x4e037a[0x0];if(!_0x3f6778['body'][_0xb17b('0x5e')])return;return db['User'][_0xb17b('0x60')]({'where':{'id':_0x3f6778[_0xb17b('0x56')]['UserId'],'role':_0xb17b('0x6f')},'attributes':['id',_0xb17b('0x3f'),_0xb17b('0x70'),'email',_0xb17b('0x71')],'raw':!![]});}return null;})[_0xb17b('0x34')](function(_0x51d5ce){if(!_0x51d5ce)return null;_0x43a9f5[_0xb17b('0x25')][_0xb17b('0x6f')]=_0x51d5ce;return _0x43a9f5;})[_0xb17b('0x34')](function(_0x516f66){if(_0x516f66){if(_0x3f6778[_0xb17b('0x56')][_0xb17b('0x72')]){_0x43a9f5[_0xb17b('0x25')][_0xb17b('0x73')]=util[_0xb17b('0x64')]('SIP/%s',_0x3f6778['user'][_0xb17b('0x3f')]);_0x43a9f5[_0xb17b('0x25')][_0xb17b('0x74')]=_0x43a9f5[_0xb17b('0x74')];_0x43a9f5[_0xb17b('0x25')][_0xb17b('0x75')]=_0x43a9f5[_0xb17b('0x74')];_0x43a9f5['message'][_0xb17b('0x76')]=_0xb17b('0x59');return respondWithRpcPromise('EventManager',_0xb17b('0x77'),{'event':_0xb17b('0x78'),'message':_0x43a9f5[_0xb17b('0x25')]},client9002)[_0xb17b('0x34')](function(){return _0x43a9f5;});}return _0x43a9f5;}return null;})[_0xb17b('0x34')](respondWithResult(_0x2401d0,null))[_0xb17b('0x50')](handleError(_0x2401d0,null));};var interaction_log=require(_0xb17b('0x14'))(_0xb17b('0x79'));exports[_0xb17b('0x31')]=function(_0x71900c,_0x2df624,_0x235cde){var _0x406d43={'agent':{},'channel':_0xb17b('0x5a')};if(_0x71900c['body']['id']){delete _0x71900c[_0xb17b('0x56')]['id'];}_0x71900c['body'][_0xb17b('0x5e')]=_0x71900c[_0xb17b('0x56')][_0xb17b('0x5e')]||_0x71900c['user']['id'];_0x406d43[_0xb17b('0x6f')]['id']=_0x71900c['body'][_0xb17b('0x5e')];return db['SmsMessage'][_0xb17b('0x60')]({'where':{'id':_0x71900c['params']['id'],'UserId':null}})[_0xb17b('0x34')](handleEntityNotFound(_0x2df624,null))[_0xb17b('0x34')](function(_0x29ba01){if(_0x29ba01){_0x406d43[_0xb17b('0x25')]=_0x29ba01[_0xb17b('0x65')]({'plain':!![]});return db['SmsInteraction'][_0xb17b('0x60')]({'where':{'id':_0x29ba01[_0xb17b('0x61')]}});}return null;})[_0xb17b('0x34')](handleEntityNotFound(_0x2df624,null))[_0xb17b('0x34')](function(_0x51142a){if(_0x51142a){_0x406d43[_0xb17b('0x68')]=_0x51142a[_0xb17b('0x65')]({'plain':!![]});interaction_log[_0xb17b('0x26')](_0xb17b('0x7a'),_0x71900c['user']['id'],_0x71900c[_0xb17b('0x5f')][_0xb17b('0x3f')],_0x71900c['user'][_0xb17b('0x67')],_0x406d43[_0xb17b('0x68')]['id'],_0x71900c['body']?JSON['stringify'](_0x71900c[_0xb17b('0x56')]):_0xb17b('0x69'));return respondWithRpcPromise(_0xb17b('0x7b'),_0xb17b('0x7c'),_0x406d43);}return null;})['then'](function(_0x1502d1){var _0x150679='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1502d1[_0xb17b('0x25')]['ContactId'];return db[_0xb17b('0x6c')][_0xb17b('0x40')](_0x150679,{'type':db[_0xb17b('0x7d')]['QueryTypes'][_0xb17b('0x7e')],'raw':!![]})[_0xb17b('0x34')](function(_0x39d61d){return _0x39d61d;});})[_0xb17b('0x34')](function(_0x1d1edc){if(_0x1d1edc){_0x406d43[_0xb17b('0x25')][_0xb17b('0x6e')]=_0x1d1edc[0x0];if(!_0x71900c[_0xb17b('0x56')][_0xb17b('0x5e')])return;return db[_0xb17b('0x7f')]['find']({'where':{'id':_0x71900c['body'][_0xb17b('0x5e')],'role':_0xb17b('0x6f')},'attributes':['id',_0xb17b('0x3f'),_0xb17b('0x70'),_0xb17b('0x80'),_0xb17b('0x71')],'raw':!![]});}return null;})[_0xb17b('0x34')](function(_0x2e8b00){if(!_0x2e8b00)return null;_0x406d43[_0xb17b('0x25')]['agent']=_0x2e8b00;return _0x406d43;})[_0xb17b('0x34')](function(_0x12bc3d){if(_0x12bc3d){_0x12bc3d[_0xb17b('0x25')][_0xb17b('0x73')]=util[_0xb17b('0x64')](_0xb17b('0x81'),_0x71900c[_0xb17b('0x5f')][_0xb17b('0x3f')]);_0x12bc3d[_0xb17b('0x25')]['channel']=_0x406d43['channel'];_0x12bc3d[_0xb17b('0x25')][_0xb17b('0x75')]=_0x406d43[_0xb17b('0x74')];_0x12bc3d[_0xb17b('0x25')][_0xb17b('0x76')]=_0xb17b('0x31');respondWithRpcPromise(_0xb17b('0x77'),_0xb17b('0x77'),{'event':_0xb17b('0x82'),'message':_0x12bc3d['message']},client9002);return _0x406d43;}return null;})[_0xb17b('0x34')](respondWithResult(_0x2df624,null))[_0xb17b('0x50')](handleError(_0x2df624,null));};exports[_0xb17b('0x29')]=function(_0xdc0c67,_0x5cbe2b,_0x55e00e){if(_0xdc0c67[_0xb17b('0x56')]['id']){delete _0xdc0c67[_0xb17b('0x56')]['id'];}var _0x2e0d2d;return db[_0xb17b('0x38')][_0xb17b('0x60')]({'where':{'id':_0xdc0c67[_0xb17b('0x57')]['id']}})[_0xb17b('0x34')](handleEntityNotFound(_0x5cbe2b,null))[_0xb17b('0x34')](function(_0x20f08c){if(_0x20f08c){_0x2e0d2d=_0x20f08c;return db['SmsAccount'][_0xb17b('0x60')]({'where':{'id':_0x20f08c[_0xb17b('0x83')]}});}})[_0xb17b('0x34')](handleEntityNotFound(_0x5cbe2b,null))['then'](function(_0x30a9d7){if(_0x30a9d7){logger[_0xb17b('0x84')](_0xb17b('0x21'),_0xb17b('0x29'),'received\x20delivery\x20report\x20from',_0x30a9d7[_0xb17b('0x3b')],util[_0xb17b('0x85')](_0xdc0c67[_0xb17b('0x56')],{'showHidden':![],'depth':null}));switch(_0x30a9d7[_0xb17b('0x3b')]){case _0xb17b('0x86'):if(_0xdc0c67['body'][_0xb17b('0x87')]&&_0xdc0c67[_0xb17b('0x56')][_0xb17b('0x87')]===_0x2e0d2d[_0xb17b('0x88')]){return _0x2e0d2d[_0xb17b('0x33')]({'read':!![]});}else{logger[_0xb17b('0x23')](_0xb17b('0x89'),_0xb17b('0x29'),_0xb17b('0x86'),util['inspect'](_0xdc0c67[_0xb17b('0x56')],{'showHidden':![],'depth':null}));}break;case _0xb17b('0x8a'):if(_0xdc0c67['body'][_0xb17b('0x8b')]&&_0xdc0c67['body'][_0xb17b('0x8b')]===_0x2e0d2d['messageId']&&_[_0xb17b('0x8c')](['sent',_0xb17b('0x8d')],_0xdc0c67[_0xb17b('0x56')][_0xb17b('0x8e')])>=0x0){return _0x2e0d2d[_0xb17b('0x33')]({'read':!![]});}else{logger[_0xb17b('0x23')](_0xb17b('0x89'),'status',_0xb17b('0x8f'),util[_0xb17b('0x85')](_0xdc0c67[_0xb17b('0x56')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0xb66527=_0xdc0c67[_0xb17b('0x56')]['results'][0x0];if(_0xb66527[_0xb17b('0x29')][_0xb17b('0x90')]===_0xb17b('0x91')){return _0x2e0d2d[_0xb17b('0x33')]({'read':!![]});}else{logger[_0xb17b('0x23')](_0xb17b('0x89'),_0xb17b('0x29'),_0xb17b('0x92'),util[_0xb17b('0x85')](_0xdc0c67['body'],{'showHidden':![],'depth':null}));}break;}return _0x2e0d2d;}})[_0xb17b('0x34')](respondWithResult(_0x5cbe2b,null))[_0xb17b('0x50')](handleError(_0x5cbe2b,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 7bf270e..4e02f80 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 _0x5eb0=['events','../../mysqldb','SmsMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x30da4f,_0xc61977){var _0x370dac=function(_0xf16d8c){while(--_0xf16d8c){_0x30da4f['push'](_0x30da4f['shift']());}};_0x370dac(++_0xc61977);}(_0x5eb0,0x82));var _0x05eb=function(_0x4ad476,_0x1345c3){_0x4ad476=_0x4ad476-0x0;var _0x5adea9=_0x5eb0[_0x4ad476];return _0x5adea9;};'use strict';var EventEmitter=require(_0x05eb('0x0'));var SmsMessage=require(_0x05eb('0x1'))['db'][_0x05eb('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x05eb('0x3')](0x0);var events={'afterCreate':_0x05eb('0x4'),'afterUpdate':_0x05eb('0x5'),'afterDestroy':'remove'};function emitEvent(_0x396b95){return function(_0x1efd51,_0x1c7b21,_0x40da63){SmsMessageEvents[_0x05eb('0x6')](_0x396b95+':'+_0x1efd51['id'],_0x1efd51);SmsMessageEvents[_0x05eb('0x6')](_0x396b95,_0x1efd51);_0x40da63(null);};}for(var e in events){if(events[_0x05eb('0x7')](e)){var event=events[e];SmsMessage[_0x05eb('0x8')](e,emitEvent(event));}}module[_0x05eb('0x9')]=SmsMessageEvents; \ No newline at end of file +var _0xb983=['hook','exports','../../mysqldb','setMaxListeners','save','update','remove','hasOwnProperty'];(function(_0x1c4c24,_0x154c79){var _0x1c033d=function(_0x155415){while(--_0x155415){_0x1c4c24['push'](_0x1c4c24['shift']());}};_0x1c033d(++_0x154c79);}(_0xb983,0x15a));var _0x3b98=function(_0x439d59,_0x11ccdf){_0x439d59=_0x439d59-0x0;var _0x3670c7=_0xb983[_0x439d59];return _0x3670c7;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x3b98('0x0'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x3b98('0x1')](0x0);var events={'afterCreate':_0x3b98('0x2'),'afterUpdate':_0x3b98('0x3'),'afterDestroy':_0x3b98('0x4')};function emitEvent(_0x458c86){return function(_0x297067,_0x13ed54,_0x4471a1){SmsMessageEvents['emit'](_0x458c86+':'+_0x297067['id'],_0x297067);SmsMessageEvents['emit'](_0x458c86,_0x297067);_0x4471a1(null);};}for(var e in events){if(events[_0x3b98('0x5')](e)){var event=events[e];SmsMessage[_0x3b98('0x6')](e,emitEvent(event));}}module[_0x3b98('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 88da22b..c14fa47 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 _0x976b=['/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','csc','apiKey','text','timestamp','keys','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','Missing\x20parameters:\x20apiKey','clickatell','uuid','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','intelepeer','finally','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','rimraf','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','SmsInteractionId','findOne','then','update','createdAt','error','out','find','SmsAccountId','type','twilio','accountSid','authToken','messages','create','body','phone','remote','/status?token=','token','sid','catch','inspect','afterCreate','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','username','&password=','GET','POST','session_key','total_sent','internal_order_id','deliveryReport','read','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId'];(function(_0x2b92b7,_0x221988){var _0x8e2195=function(_0x4dd094){while(--_0x4dd094){_0x2b92b7['push'](_0x2b92b7['shift']());}};_0x8e2195(++_0x221988);}(_0x976b,0x117));var _0xb976=function(_0x5f3d47,_0x2329b8){_0x5f3d47=_0x5f3d47-0x0;var _0x42a103=_0x976b[_0x5f3d47];return _0x42a103;};'use strict';var _=require(_0xb976('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb976('0x1'));var moment=require(_0xb976('0x2'));var BPromise=require(_0xb976('0x3'));var rp=require(_0xb976('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb976('0x5'));var config=require('../../config/environment');var attributes=require(_0xb976('0x6'));module[_0xb976('0x7')]=function(_0x5362cf,_0x429fc6){return _0x5362cf['define'](_0xb976('0x8'),attributes,{'tableName':_0xb976('0x9'),'paranoid':![],'indexes':[{'name':_0xb976('0xa'),'fields':[_0xb976('0xa')]},{'name':_0xb976('0xb'),'fields':['body'],'type':_0xb976('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x334204,_0x14739f,_0x461d00){var _0x28ebed=_0x5362cf[_0xb976('0xd')];var _0x568062=_0x334204[_0xb976('0xe')]({'plain':!![]});if(_0x568062[_0xb976('0xf')][_0xb976('0x10')]()==='in'||_0x568062['direction'][_0xb976('0x10')]()==='out'&&!_0x568062[_0xb976('0x11')]&&!_[_0xb976('0x12')](_0x568062[_0xb976('0x13')])&&!_['isNil'](_0x568062[_0xb976('0x14')])){_0x28ebed['SmsInteraction'][_0xb976('0x15')]({'where':{'id':_0x568062[_0xb976('0x14')]}})[_0xb976('0x16')](function(_0x253d54){if(_0x253d54){_0x253d54[_0xb976('0x17')]({'lastMsgAt':_0x568062[_0xb976('0x18')],'lastMsgDirection':_0x568062[_0xb976('0xf')][_0xb976('0x10')]()});}})['catch'](function(_0x30d2b6){console[_0xb976('0x19')](_0x30d2b6);});}if(_0x568062[_0xb976('0xf')]===_0xb976('0x1a')&&!_0x568062['secret']){var _0x320bdc;_0x28ebed['SmsAccount'][_0xb976('0x1b')]({'where':{'id':_0x568062[_0xb976('0x1c')]},'raw':!![]})[_0xb976('0x16')](function(_0x41dbfc){_0x320bdc=_0x41dbfc;if(_0x320bdc&&_0x320bdc['type']){switch(_0x320bdc[_0xb976('0x1d')]){case _0xb976('0x1e'):var _0x404527=require('twilio');if(_0x320bdc[_0xb976('0x1f')]&&_0x320bdc[_0xb976('0x20')]&&_0x320bdc['phone']){var _0x5291c4=new _0x404527(_0x320bdc[_0xb976('0x1f')],_0x320bdc[_0xb976('0x20')]);_0x5291c4[_0xb976('0x21')][_0xb976('0x22')]({'body':_0x568062[_0xb976('0x23')],'to':_0x568062[_0xb976('0x24')],'from':_0x320bdc[_0xb976('0x24')],'statusCallback':_0x320bdc[_0xb976('0x25')]+'/api/sms/messages/'+_0x568062['id']+_0xb976('0x26')+_0x320bdc[_0xb976('0x27')]})[_0xb976('0x16')](function(_0x1d3955){if(_0x1d3955[_0xb976('0x28')]){return _0x334204['update']({'messageId':_0x1d3955[_0xb976('0x28')]});}})[_0xb976('0x29')](function(_0x401fa1){logger[_0xb976('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xb976('0x1e'),util[_0xb976('0x2a')](_0x401fa1,{'showHidden':![],'depth':null}));});}else{logger[_0xb976('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb976('0x2b'),_0xb976('0x1e'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xb976('0x2c'):var _0x3fc788=_0xb976('0x2d');if(_0x320bdc['username']&&_0x320bdc[_0xb976('0x2e')]){var _0xb2517d={'recipient':[_0x568062['phone']],'message':_0x568062['body'],'message_type':_0x320bdc['smsMethod']};if(_0x320bdc[_0xb976('0x2f')]&&_0x320bdc[_0xb976('0x2f')]!=='SI'){_0xb2517d[_0xb976('0x30')]=_0x320bdc['phone'];}var _0x591ea9={'url':_0x3fc788+_0xb976('0x31')+_0x320bdc[_0xb976('0x32')]+_0xb976('0x33')+_0x320bdc[_0xb976('0x2e')],'method':_0xb976('0x34')};rp(_0x591ea9)[_0xb976('0x16')](function(_0x346b7b){var _0x5551c8=_0x346b7b['split'](';');var _0xfcd38b={'user_key':_0x5551c8[0x0],'session_key':_0x5551c8[0x1]};_0x591ea9={'url':_0x3fc788+'sms','method':_0xb976('0x35'),'headers':{'user_key':_0xfcd38b['user_key'],'Session_key':_0xfcd38b[_0xb976('0x36')]},'json':!![],'body':_0xb2517d};return rp(_0x591ea9);})[_0xb976('0x16')](function(_0x2bffa4){if(_0x2bffa4[_0xb976('0x37')]>=0x1){var _0x36e033={'messageId':_0x2bffa4[_0xb976('0x38')]};if(_0x320bdc['smsMethod']!=='GP'||!_0x320bdc[_0xb976('0x39')]){_0x36e033[_0xb976('0x3a')]=!![];}return _0x334204[_0xb976('0x17')](_0x36e033);}else{return logger[_0xb976('0x19')](_0xb976('0x3b'),_0xb976('0x2b'),_0xb976('0x2c'),util[_0xb976('0x2a')](_0x2bffa4,{'showHidden':![],'depth':null}));}})['catch'](function(_0x247ceb){return logger['error'](_0xb976('0x3b'),_0xb976('0x2b'),_0xb976('0x2c'),util[_0xb976('0x2a')](_0x247ceb,{'showHidden':![],'depth':null}));});}else{logger[_0xb976('0x19')](_0xb976('0x3b'),_0xb976('0x2b'),_0xb976('0x2c'),_0xb976('0x3c'));}break;case _0xb976('0x3d'):if(_0x320bdc[_0xb976('0x20')]){var _0x1f4568={'recipient':_0x568062[_0xb976('0x24')],'message':_0x568062[_0xb976('0x23')],'sender':_0x320bdc[_0xb976('0x3e')]||_0x320bdc[_0xb976('0x24')],'authorization':_0x320bdc[_0xb976('0x20')]};var _0x14739f={'method':_0xb976('0x35'),'uri':_0xb976('0x3f'),'body':_0x1f4568,'json':!![]};rp(_0x14739f)['then'](function(_0x1052c3){var _0x14b14f={'messageId':_0x1052c3[_0xb976('0x40')]};if(!_0x320bdc['deliveryReport']){_0x14b14f[_0xb976('0x3a')]=!![];}return _0x334204['update'](_0x14b14f);})[_0xb976('0x29')](function(_0x90e9a5){logger[_0xb976('0x19')](_0xb976('0x3b'),_0xb976('0x2b'),_0xb976('0x3d'),util[_0xb976('0x2a')](_0x90e9a5,{'showHidden':![],'depth':null}));});}else{logger[_0xb976('0x19')](_0xb976('0x3b'),_0xb976('0x2b'),_0xb976('0x3d'),_0xb976('0x41'));}break;case _0xb976('0x42'):if(_0x320bdc[_0xb976('0x32')]&&_0x320bdc[_0xb976('0x2e')]){var _0x1f4568={'messages':[{'source':_0xb976('0x43'),'to':_0x568062[_0xb976('0x24')],'body':_0x568062[_0xb976('0x23')],'from':_0x320bdc[_0xb976('0x3e')]||_0x320bdc[_0xb976('0x24')]}]};var _0x5de74c=util[_0xb976('0x44')](_0xb976('0x45'),_0x320bdc[_0xb976('0x32')],_0x320bdc[_0xb976('0x2e')]);var _0x14739f={'method':_0xb976('0x35'),'uri':_0xb976('0x46'),'body':_0x1f4568,'headers':{'Authorization':util[_0xb976('0x44')](_0xb976('0x47'),new Buffer(_0x5de74c)['toString'](_0xb976('0x48')))},'json':!![]};rp(_0x14739f)[_0xb976('0x16')](function(_0x4e20eb){if(_0x4e20eb['http_code']>=0xc8&&_0x4e20eb[_0xb976('0x49')]<=0xce){if(_0x4e20eb[_0xb976('0x4a')]&&_0x4e20eb[_0xb976('0x4a')][_0xb976('0x4b')]>0x0){var _0x4638ac=_[_0xb976('0x4c')](_0x4e20eb[_0xb976('0x4a')][_0xb976('0x21')]);var _0x423151={'messageId':_0x4638ac[_0xb976('0x4d')]};if(!_0x320bdc[_0xb976('0x39')]){_0x423151[_0xb976('0x3a')]=!![];}return _0x334204[_0xb976('0x17')](_0x423151);}else{logger[_0xb976('0x19')](_0xb976('0x3b'),_0xb976('0x2b'),'clickSend',util[_0xb976('0x2a')](_0x4e20eb,{'showHidden':![],'depth':null}));}}else{logger['error'](_0xb976('0x3b'),'afterCreate',_0xb976('0x4e'),util[_0xb976('0x2a')](_0x4e20eb,{'showHidden':![],'depth':null}));}})['catch'](function(_0x455bc2){logger[_0xb976('0x19')](_0xb976('0x3b'),'afterCreate',_0xb976('0x4e'),util[_0xb976('0x2a')](_0x455bc2,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb976('0x3b'),_0xb976('0x2b'),_0xb976('0x4e'),_0xb976('0x3c'));}break;case _0xb976('0x4f'):if(_0x320bdc[_0xb976('0x50')]&&_0x320bdc[_0xb976('0x20')]){var _0x1f4568={'dst':_0x568062[_0xb976('0x24')],'text':_0x568062[_0xb976('0x23')],'src':_0x320bdc['senderString']||_0x320bdc[_0xb976('0x24')],'url':_0x320bdc[_0xb976('0x25')]+_0xb976('0x51')+_0x568062['id']+'/status?token='+_0x320bdc['token']};var _0x5de74c=util[_0xb976('0x44')]('%s:%s',_0x320bdc[_0xb976('0x50')],_0x320bdc['authToken']);var _0x14739f={'method':'POST','uri':util[_0xb976('0x44')](_0xb976('0x52'),_0x320bdc[_0xb976('0x50')]),'body':_0x1f4568,'headers':{'Authorization':util[_0xb976('0x44')](_0xb976('0x47'),new Buffer(_0x5de74c)[_0xb976('0x53')]('base64'))},'json':!![]};rp(_0x14739f)[_0xb976('0x16')](function(_0x34f5a7){var _0x2a652b={'messageId':_0x34f5a7[_0xb976('0x54')][0x0]};return _0x334204[_0xb976('0x17')](_0x2a652b);})['catch'](function(_0x4809cf){logger['error'](_0xb976('0x3b'),_0xb976('0x2b'),_0xb976('0x4f'),util[_0xb976('0x2a')](_0x4809cf,{'showHidden':![],'depth':null}));});}else{logger[_0xb976('0x19')](_0xb976('0x3b'),_0xb976('0x2b'),_0xb976('0x4f'),_0xb976('0x55'));}break;case _0xb976('0x56'):if(_0x320bdc[_0xb976('0x32')]&&_0x320bdc['password']){if(_0x320bdc[_0xb976('0x57')]){var _0x43fe30={'method':'POST','uri':_0x320bdc['baseUrl']+_0xb976('0x58'),'body':{'username':_0x320bdc['username'],'password':_0x320bdc[_0xb976('0x2e')]},'json':!![]};return rp(_0x43fe30)['then'](function(_0x5f22ee){var _0x518884={'method':_0xb976('0x35'),'uri':_0x320bdc['baseUrl']+_0xb976('0x59'),'body':{'messages':[{'from':_0x320bdc[_0xb976('0x24')],'destinations':[{'to':_0x568062['phone']}],'text':_0x568062[_0xb976('0x23')],'notifyUrl':_0x320bdc[_0xb976('0x25')]+_0xb976('0x51')+_0x568062['id']+_0xb976('0x26')+_0x320bdc['token'],'notifyContentType':_0xb976('0x5a'),'callbackData':_0x320bdc[_0xb976('0x24')]+';'+_0x568062[_0xb976('0x23')]}]},'headers':{'Authorization':_0xb976('0x5b')+_0x5f22ee[_0xb976('0x27')]},'json':!![]};return rp(_0x518884)[_0xb976('0x16')](function(_0x1bdae5){if(_0x1bdae5[_0xb976('0x21')]){var _0xfc9362={'messageId':_0x1bdae5[_0xb976('0x21')][0x0][_0xb976('0xa')]};if(!_0x320bdc['deliveryReport']){_0xfc9362['read']=!![];}return _0x334204[_0xb976('0x17')](_0xfc9362);}else{return logger[_0xb976('0x19')](_0xb976('0x3b'),_0xb976('0x2b'),_0xb976('0x56'),util[_0xb976('0x2a')](_0x1bdae5,{'showHidden':![],'depth':null}));}});})[_0xb976('0x29')](function(_0x133810){return logger[_0xb976('0x19')](_0xb976('0x3b'),_0xb976('0x2b'),_0xb976('0x56'),util['inspect'](_0x133810,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xb976('0x56'),'Missing\x20parameters:\x20base_url');}}else{logger[_0xb976('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb976('0x2b'),_0xb976('0x56'),_0xb976('0x3c'));}break;case _0xb976('0x5c'):var _0x131858=require('crypto');if(_0x320bdc[_0xb976('0x5d')]){var _0xeca03c={};_0xeca03c['login']=_0x320bdc['username'];_0xeca03c[_0xb976('0x24')]=_0x568062[_0xb976('0x24')];_0xeca03c[_0xb976('0x30')]=_0x320bdc[_0xb976('0x24')];_0xeca03c[_0xb976('0x5e')]=_0x568062['body'];_0xeca03c[_0xb976('0x5f')]=+new Date();var _0x5f1876='';var _0x21854e='';var _0x4b1ab2=Object[_0xb976('0x60')](_0xeca03c);_0x4b1ab2['sort']();for(var _0x43b327=0x0;_0x43b327<_0x4b1ab2[_0xb976('0x61')];_0x43b327++){if(_0x5f1876!=''){_0x5f1876+='&';}_0x5f1876+=_0x4b1ab2[_0x43b327]+'='+encodeURIComponent(_0xeca03c[_0x4b1ab2[_0x43b327]]);_0x21854e+=_0xeca03c[_0x4b1ab2[_0x43b327]];}_0x21854e+=_0x320bdc['apiKey'];_0x21854e=_0x131858[_0xb976('0x62')](_0xb976('0x63'))[_0xb976('0x17')](_0x21854e)[_0xb976('0x64')](_0xb976('0x65'));if(_0x5f1876!==''){_0x5f1876+='&';}_0x5f1876+=_0xb976('0x66')+_0x21854e;var _0x591ea9={'method':_0xb976('0x34'),'uri':_0x320bdc[_0xb976('0x57')]+_0xb976('0x67')+_0x5f1876,'json':!![]};return rp(_0x591ea9)[_0xb976('0x16')](function(_0x27c814){var _0x510ef8=Object['keys'](_0x27c814);if(_0x27c814[_0x510ef8[0x0]][_0xb976('0x19')]&&parseInt(_0x27c814[_0x510ef8[0x0]][_0xb976('0x19')])===0x0){var _0x225494={'messageId':_0x27c814[_0x510ef8[0x0]]['id_sms']};if(!_0x320bdc['deliveryReport']){_0x225494['read']=!![];}return _0x334204[_0xb976('0x17')](_0x225494);}else{return logger[_0xb976('0x19')](_0xb976('0x3b'),_0xb976('0x2b'),_0xb976('0x5c'),util[_0xb976('0x2a')](_0x27c814[_0xb976('0x19')],{'showHidden':![],'depth':null}));}})[_0xb976('0x29')](function(_0x15c847){return logger[_0xb976('0x19')](_0xb976('0x3b'),_0xb976('0x2b'),_0xb976('0x5c'),util[_0xb976('0x2a')](_0x15c847,{'showHidden':![],'depth':null}));});}else{logger[_0xb976('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','csc',_0xb976('0x68'));}break;case _0xb976('0x69'):if(_0x320bdc[_0xb976('0x5d')]){var _0x122ad2={'method':_0xb976('0x35'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x320bdc['apiKey']},'body':{'content':_0x568062[_0xb976('0x23')],'to':[_0x568062[_0xb976('0x24')]],'from':_0x320bdc['phone'],'binary':![],'clientMessageId':_0xb976('0x6a'),'charset':'UTF-8'},'json':!![]};rp(_0x122ad2)[_0xb976('0x16')](function(_0x425e38){if(!_0x425e38[_0xb976('0x19')]){var _0x2cb8e9={'messageId':_0x425e38[_0xb976('0x21')][0x0]['apiMessageId']};if(!_0x320bdc['deliveryReport']){_0x2cb8e9[_0xb976('0x3a')]=!![];}return _0x334204[_0xb976('0x17')](_0x2cb8e9);}else{return logger[_0xb976('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb976('0x2b'),'clickatell',util['inspect'](_0x425e38['error'],{'showHidden':![],'depth':null}));}})[_0xb976('0x29')](function(_0x568b3a){return logger[_0xb976('0x19')](_0xb976('0x3b'),_0xb976('0x2b'),_0xb976('0x69'),util['inspect'](_0x568b3a,{'showHidden':![],'depth':null}));});}else{logger[_0xb976('0x19')](_0xb976('0x3b'),'afterCreate','clickatell',_0xb976('0x68'));}break;case _0xb976('0x6b'):if(_0x320bdc[_0xb976('0x32')]&&_0x320bdc[_0xb976('0x2e')]){var _0x5de74c=util[_0xb976('0x44')](_0xb976('0x45'),_0x320bdc[_0xb976('0x32')],_0x320bdc['password']);var _0x14739f={'method':_0xb976('0x35'),'uri':_0xb976('0x6c')+_0x320bdc[_0xb976('0x6d')]+_0xb976('0x6e'),'body':{'to':[_0x568062['phone']],'text':_0x568062[_0xb976('0x23')],'from':_0x320bdc[_0xb976('0x24')],'applicationId':_0x320bdc['applicationId']},'headers':{'Authorization':util[_0xb976('0x44')](_0xb976('0x47'),new Buffer(_0x5de74c)[_0xb976('0x53')](_0xb976('0x48')))},'json':!![]};rp(_0x14739f)[_0xb976('0x16')](function(_0x5f47aa){if(_0x5f47aa['id']){var _0x36efa8={'messageId':_0x5f47aa['id']};return _0x334204[_0xb976('0x17')](_0x36efa8);}else{logger[_0xb976('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb976('0x2b'),'bandwidth',util['inspect'](_0x5f47aa,{'showHidden':![],'depth':null}));}})['catch'](function(_0x104198){logger[_0xb976('0x19')](_0xb976('0x3b'),'afterCreate',_0xb976('0x6b'),util['inspect'](_0x104198,{'showHidden':![],'depth':null}));});}else{logger[_0xb976('0x19')](_0xb976('0x3b'),_0xb976('0x2b'),'bandwidth',_0xb976('0x3c'));}break;case'intelepeer':if(_0x320bdc[_0xb976('0x5d')]){var _0x4e5201={};var _0x591ea9={'method':_0xb976('0x35'),'uri':_0xb976('0x6f'),'headers':{'Authorization':'Bearer\x20'+_0x320bdc[_0xb976('0x5d')],'Content-Type':_0xb976('0x5a')},'body':{'from':_0x320bdc[_0xb976('0x24')],'to':_0x568062[_0xb976('0x24')],'text':_0x568062[_0xb976('0x23')]},'json':!![]};return rp(_0x591ea9)[_0xb976('0x16')](function(_0x27326a){if(_0x27326a[_0xb976('0x70')]==0xca){_0x4e5201[_0xb976('0x71')]=_0x27326a;var _0x41c234={'method':_0xb976('0x35'),'uri':_0xb976('0x72'),'headers':{'Authorization':_0xb976('0x73')+_0x320bdc[_0xb976('0x5d')],'Content-Type':_0xb976('0x5a')},'body':{'refid':_0x4e5201['message'][_0xb976('0x74')]},'json':!![]};return rp(_0x41c234)['then'](function(_0x3bf7c5){_0x4e5201['status']=_0x3bf7c5;var _0x19e776={'messageId':_0x4e5201[_0xb976('0x71')][_0xb976('0x74')],'read':!![]};return _0x334204[_0xb976('0x17')](_0x19e776);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb976('0x2b'),_0xb976('0x75'),util[_0xb976('0x2a')](_0x27326a,{'showHidden':![],'depth':null}));}})[_0xb976('0x29')](function(_0x415934){return logger['error'](_0xb976('0x3b'),_0xb976('0x2b'),_0xb976('0x75'),util[_0xb976('0x2a')](_0x415934,{'showHidden':![],'depth':null}));});}else{return logger[_0xb976('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb976('0x2b'),'intelepeer','Token\x20not\x20received');}break;}}})[_0xb976('0x76')](function(){_0x461d00();});}else{_0x461d00();}}},'charset':'utf8mb4','collate':_0xb976('0x77')});}; \ No newline at end of file +var _0x8f51=['/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','apiKey','text','keys','sort','createHash','md5','digest','hex','signature=','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','message','Token\x20not\x20received','finally','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','error','SmsAccount','find','SmsAccountId','type','twilio','authToken','accountSid','messages','create','phone','remote','/api/sms/messages/','token','sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','split','POST','session_key','total_sent','read','Missing\x20parameters:\x20username,\x20password','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','connectel','Missing\x20parameters:\x20authToken','clicksend','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','/status?token=','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl'];(function(_0x3dd112,_0x5b87e9){var _0x281bd9=function(_0x8214f7){while(--_0x8214f7){_0x3dd112['push'](_0x3dd112['shift']());}};_0x281bd9(++_0x5b87e9);}(_0x8f51,0x120));var _0x18f5=function(_0x4914e2,_0x48be8f){_0x4914e2=_0x4914e2-0x0;var _0x2dcd07=_0x8f51[_0x4914e2];return _0x2dcd07;};'use strict';var _=require(_0x18f5('0x0'));var util=require(_0x18f5('0x1'));var logger=require(_0x18f5('0x2'))(_0x18f5('0x3'));var moment=require(_0x18f5('0x4'));var BPromise=require('bluebird');var rp=require(_0x18f5('0x5'));var fs=require('fs');var path=require(_0x18f5('0x6'));var rimraf=require('rimraf');var config=require(_0x18f5('0x7'));var attributes=require(_0x18f5('0x8'));module[_0x18f5('0x9')]=function(_0x2794c0,_0x2b7085){return _0x2794c0[_0x18f5('0xa')](_0x18f5('0xb'),attributes,{'tableName':_0x18f5('0xc'),'paranoid':![],'indexes':[{'name':_0x18f5('0xd'),'fields':[_0x18f5('0xd')]},{'name':'fti_sms_messages','fields':[_0x18f5('0xe')],'type':_0x18f5('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x44e42b,_0x351adf,_0x2fbcc5){var _0x5dc2a5=_0x2794c0[_0x18f5('0x10')];var _0x808953=_0x44e42b[_0x18f5('0x11')]({'plain':!![]});if(_0x808953[_0x18f5('0x12')][_0x18f5('0x13')]()==='in'||_0x808953['direction'][_0x18f5('0x13')]()===_0x18f5('0x14')&&!_0x808953[_0x18f5('0x15')]&&!_[_0x18f5('0x16')](_0x808953[_0x18f5('0x17')])&&!_[_0x18f5('0x16')](_0x808953[_0x18f5('0x18')])){_0x5dc2a5[_0x18f5('0x19')][_0x18f5('0x1a')]({'where':{'id':_0x808953[_0x18f5('0x18')]}})[_0x18f5('0x1b')](function(_0x4b4046){if(_0x4b4046){_0x4b4046[_0x18f5('0x1c')]({'lastMsgAt':_0x808953[_0x18f5('0x1d')],'lastMsgDirection':_0x808953[_0x18f5('0x12')]['toLowerCase']()});}})['catch'](function(_0x1b3019){console[_0x18f5('0x1e')](_0x1b3019);});}if(_0x808953[_0x18f5('0x12')]===_0x18f5('0x14')&&!_0x808953['secret']){var _0xa812aa;_0x5dc2a5[_0x18f5('0x1f')][_0x18f5('0x20')]({'where':{'id':_0x808953[_0x18f5('0x21')]},'raw':!![]})[_0x18f5('0x1b')](function(_0x31e011){_0xa812aa=_0x31e011;if(_0xa812aa&&_0xa812aa['type']){switch(_0xa812aa[_0x18f5('0x22')]){case'twilio':var _0x2f3a76=require(_0x18f5('0x23'));if(_0xa812aa['accountSid']&&_0xa812aa[_0x18f5('0x24')]&&_0xa812aa['phone']){var _0x1d0b5d=new _0x2f3a76(_0xa812aa[_0x18f5('0x25')],_0xa812aa[_0x18f5('0x24')]);_0x1d0b5d[_0x18f5('0x26')][_0x18f5('0x27')]({'body':_0x808953['body'],'to':_0x808953['phone'],'from':_0xa812aa[_0x18f5('0x28')],'statusCallback':_0xa812aa[_0x18f5('0x29')]+_0x18f5('0x2a')+_0x808953['id']+'/status?token='+_0xa812aa[_0x18f5('0x2b')]})['then'](function(_0x466f85){if(_0x466f85[_0x18f5('0x2c')]){return _0x44e42b[_0x18f5('0x1c')]({'messageId':_0x466f85[_0x18f5('0x2c')]});}})[_0x18f5('0x2d')](function(_0x4cd82f){logger[_0x18f5('0x1e')](_0x18f5('0x2e'),_0x18f5('0x2f'),_0x18f5('0x23'),util[_0x18f5('0x30')](_0x4cd82f,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x18f5('0x2e'),_0x18f5('0x2f'),_0x18f5('0x23'),_0x18f5('0x31'));}break;case _0x18f5('0x32'):var _0x7a4181=_0x18f5('0x33');if(_0xa812aa[_0x18f5('0x34')]&&_0xa812aa[_0x18f5('0x35')]){var _0x196dbd={'recipient':[_0x808953[_0x18f5('0x28')]],'message':_0x808953[_0x18f5('0xe')],'message_type':_0xa812aa[_0x18f5('0x36')]};if(_0xa812aa['smsMethod']&&_0xa812aa['smsMethod']!=='SI'){_0x196dbd[_0x18f5('0x37')]=_0xa812aa[_0x18f5('0x28')];}var _0x5d29fb={'url':_0x7a4181+_0x18f5('0x38')+_0xa812aa[_0x18f5('0x34')]+_0x18f5('0x39')+_0xa812aa[_0x18f5('0x35')],'method':'GET'};rp(_0x5d29fb)[_0x18f5('0x1b')](function(_0x5dfbc6){var _0x202dd7=_0x5dfbc6[_0x18f5('0x3a')](';');var _0x317b53={'user_key':_0x202dd7[0x0],'session_key':_0x202dd7[0x1]};_0x5d29fb={'url':_0x7a4181+'sms','method':_0x18f5('0x3b'),'headers':{'user_key':_0x317b53['user_key'],'Session_key':_0x317b53[_0x18f5('0x3c')]},'json':!![],'body':_0x196dbd};return rp(_0x5d29fb);})[_0x18f5('0x1b')](function(_0x4c3098){if(_0x4c3098[_0x18f5('0x3d')]>=0x1){var _0x3627aa={'messageId':_0x4c3098['internal_order_id']};if(_0xa812aa['smsMethod']!=='GP'||!_0xa812aa['deliveryReport']){_0x3627aa[_0x18f5('0x3e')]=!![];}return _0x44e42b['update'](_0x3627aa);}else{return logger[_0x18f5('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x18f5('0x2f'),_0x18f5('0x32'),util[_0x18f5('0x30')](_0x4c3098,{'showHidden':![],'depth':null}));}})['catch'](function(_0xcc7fc4){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x18f5('0x2f'),_0x18f5('0x32'),util[_0x18f5('0x30')](_0xcc7fc4,{'showHidden':![],'depth':null}));});}else{logger[_0x18f5('0x1e')](_0x18f5('0x2e'),_0x18f5('0x2f'),'skebby',_0x18f5('0x3f'));}break;case'connectel':if(_0xa812aa['authToken']){var _0x499fc6={'recipient':_0x808953[_0x18f5('0x28')],'message':_0x808953[_0x18f5('0xe')],'sender':_0xa812aa['senderString']||_0xa812aa['phone'],'authorization':_0xa812aa[_0x18f5('0x24')]};var _0x351adf={'method':'POST','uri':_0x18f5('0x40'),'body':_0x499fc6,'json':!![]};rp(_0x351adf)['then'](function(_0x567960){var _0x3cd56a={'messageId':_0x567960[_0x18f5('0x41')]};if(!_0xa812aa[_0x18f5('0x42')]){_0x3cd56a[_0x18f5('0x3e')]=!![];}return _0x44e42b[_0x18f5('0x1c')](_0x3cd56a);})[_0x18f5('0x2d')](function(_0xe2c3c0){logger[_0x18f5('0x1e')](_0x18f5('0x2e'),_0x18f5('0x2f'),_0x18f5('0x43'),util[_0x18f5('0x30')](_0xe2c3c0,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x18f5('0x2f'),'connectel',_0x18f5('0x44'));}break;case _0x18f5('0x45'):if(_0xa812aa['username']&&_0xa812aa[_0x18f5('0x35')]){var _0x499fc6={'messages':[{'source':'xCALLY\x20Motion','to':_0x808953['phone'],'body':_0x808953['body'],'from':_0xa812aa['senderString']||_0xa812aa['phone']}]};var _0x27df28=util[_0x18f5('0x46')](_0x18f5('0x47'),_0xa812aa[_0x18f5('0x34')],_0xa812aa[_0x18f5('0x35')]);var _0x351adf={'method':_0x18f5('0x3b'),'uri':_0x18f5('0x48'),'body':_0x499fc6,'headers':{'Authorization':util[_0x18f5('0x46')](_0x18f5('0x49'),new Buffer(_0x27df28)[_0x18f5('0x4a')](_0x18f5('0x4b')))},'json':!![]};rp(_0x351adf)[_0x18f5('0x1b')](function(_0x3ee60e){if(_0x3ee60e[_0x18f5('0x4c')]>=0xc8&&_0x3ee60e[_0x18f5('0x4c')]<=0xce){if(_0x3ee60e[_0x18f5('0x4d')]&&_0x3ee60e[_0x18f5('0x4d')][_0x18f5('0x4e')]>0x0){var _0x4b6027=_[_0x18f5('0x4f')](_0x3ee60e[_0x18f5('0x4d')][_0x18f5('0x26')]);var _0x29ad39={'messageId':_0x4b6027[_0x18f5('0x50')]};if(!_0xa812aa['deliveryReport']){_0x29ad39['read']=!![];}return _0x44e42b['update'](_0x29ad39);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x18f5('0x51'),util[_0x18f5('0x30')](_0x3ee60e,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x18f5('0x2e'),'afterCreate',_0x18f5('0x51'),util[_0x18f5('0x30')](_0x3ee60e,{'showHidden':![],'depth':null}));}})[_0x18f5('0x2d')](function(_0x1f3550){logger[_0x18f5('0x1e')](_0x18f5('0x2e'),_0x18f5('0x2f'),_0x18f5('0x51'),util[_0x18f5('0x30')](_0x1f3550,{'showHidden':![],'depth':null}));});}else{logger[_0x18f5('0x1e')](_0x18f5('0x2e'),_0x18f5('0x2f'),'clickSend',_0x18f5('0x3f'));}break;case'plivo':if(_0xa812aa['authId']&&_0xa812aa[_0x18f5('0x24')]){var _0x499fc6={'dst':_0x808953[_0x18f5('0x28')],'text':_0x808953['body'],'src':_0xa812aa['senderString']||_0xa812aa[_0x18f5('0x28')],'url':_0xa812aa['remote']+_0x18f5('0x2a')+_0x808953['id']+_0x18f5('0x52')+_0xa812aa[_0x18f5('0x2b')]};var _0x27df28=util['format'](_0x18f5('0x47'),_0xa812aa[_0x18f5('0x53')],_0xa812aa['authToken']);var _0x351adf={'method':'POST','uri':util['format'](_0x18f5('0x54'),_0xa812aa[_0x18f5('0x53')]),'body':_0x499fc6,'headers':{'Authorization':util[_0x18f5('0x46')]('Basic\x20%s',new Buffer(_0x27df28)[_0x18f5('0x4a')](_0x18f5('0x4b')))},'json':!![]};rp(_0x351adf)[_0x18f5('0x1b')](function(_0x226c24){var _0x1dea68={'messageId':_0x226c24[_0x18f5('0x55')][0x0]};return _0x44e42b[_0x18f5('0x1c')](_0x1dea68);})[_0x18f5('0x2d')](function(_0x14baba){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x18f5('0x2f'),_0x18f5('0x56'),util[_0x18f5('0x30')](_0x14baba,{'showHidden':![],'depth':null}));});}else{logger[_0x18f5('0x1e')](_0x18f5('0x2e'),_0x18f5('0x2f'),_0x18f5('0x56'),_0x18f5('0x57'));}break;case _0x18f5('0x58'):if(_0xa812aa[_0x18f5('0x34')]&&_0xa812aa[_0x18f5('0x35')]){if(_0xa812aa['baseUrl']){var _0x3e92a6={'method':_0x18f5('0x3b'),'uri':_0xa812aa[_0x18f5('0x59')]+_0x18f5('0x5a'),'body':{'username':_0xa812aa[_0x18f5('0x34')],'password':_0xa812aa[_0x18f5('0x35')]},'json':!![]};return rp(_0x3e92a6)[_0x18f5('0x1b')](function(_0x1d3cd2){var _0x27d378={'method':'POST','uri':_0xa812aa['baseUrl']+_0x18f5('0x5b'),'body':{'messages':[{'from':_0xa812aa[_0x18f5('0x28')],'destinations':[{'to':_0x808953[_0x18f5('0x28')]}],'text':_0x808953['body'],'notifyUrl':_0xa812aa['remote']+'/api/sms/messages/'+_0x808953['id']+_0x18f5('0x52')+_0xa812aa['token'],'notifyContentType':_0x18f5('0x5c'),'callbackData':_0xa812aa[_0x18f5('0x28')]+';'+_0x808953[_0x18f5('0xe')]}]},'headers':{'Authorization':_0x18f5('0x5d')+_0x1d3cd2[_0x18f5('0x2b')]},'json':!![]};return rp(_0x27d378)[_0x18f5('0x1b')](function(_0x330927){if(_0x330927['messages']){var _0x30eda0={'messageId':_0x330927[_0x18f5('0x26')][0x0][_0x18f5('0xd')]};if(!_0xa812aa[_0x18f5('0x42')]){_0x30eda0[_0x18f5('0x3e')]=!![];}return _0x44e42b[_0x18f5('0x1c')](_0x30eda0);}else{return logger[_0x18f5('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x18f5('0x2f'),_0x18f5('0x58'),util['inspect'](_0x330927,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x50a911){return logger['error'](_0x18f5('0x2e'),_0x18f5('0x2f'),_0x18f5('0x58'),util[_0x18f5('0x30')](_0x50a911,{'showHidden':![],'depth':null}));});}else{logger[_0x18f5('0x1e')](_0x18f5('0x2e'),_0x18f5('0x2f'),_0x18f5('0x58'),_0x18f5('0x5e'));}}else{logger[_0x18f5('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x18f5('0x2f'),'infobip',_0x18f5('0x3f'));}break;case'csc':var _0x131d6c=require('crypto');if(_0xa812aa[_0x18f5('0x5f')]){var _0x378ad8={};_0x378ad8['login']=_0xa812aa[_0x18f5('0x34')];_0x378ad8[_0x18f5('0x28')]=_0x808953[_0x18f5('0x28')];_0x378ad8[_0x18f5('0x37')]=_0xa812aa[_0x18f5('0x28')];_0x378ad8[_0x18f5('0x60')]=_0x808953['body'];_0x378ad8['timestamp']=+new Date();var _0xc799d8='';var _0xe2c3f0='';var _0x47c7c9=Object[_0x18f5('0x61')](_0x378ad8);_0x47c7c9[_0x18f5('0x62')]();for(var _0x5c4e5c=0x0;_0x5c4e5c<_0x47c7c9['length'];_0x5c4e5c++){if(_0xc799d8!=''){_0xc799d8+='&';}_0xc799d8+=_0x47c7c9[_0x5c4e5c]+'='+encodeURIComponent(_0x378ad8[_0x47c7c9[_0x5c4e5c]]);_0xe2c3f0+=_0x378ad8[_0x47c7c9[_0x5c4e5c]];}_0xe2c3f0+=_0xa812aa[_0x18f5('0x5f')];_0xe2c3f0=_0x131d6c[_0x18f5('0x63')](_0x18f5('0x64'))[_0x18f5('0x1c')](_0xe2c3f0)[_0x18f5('0x65')](_0x18f5('0x66'));if(_0xc799d8!==''){_0xc799d8+='&';}_0xc799d8+=_0x18f5('0x67')+_0xe2c3f0;var _0x5d29fb={'method':'GET','uri':_0xa812aa['baseUrl']+'/external/get/send.php?'+_0xc799d8,'json':!![]};return rp(_0x5d29fb)[_0x18f5('0x1b')](function(_0x55fde5){var _0x534511=Object[_0x18f5('0x61')](_0x55fde5);if(_0x55fde5[_0x534511[0x0]][_0x18f5('0x1e')]&&parseInt(_0x55fde5[_0x534511[0x0]][_0x18f5('0x1e')])===0x0){var _0x1fdd7d={'messageId':_0x55fde5[_0x534511[0x0]][_0x18f5('0x68')]};if(!_0xa812aa[_0x18f5('0x42')]){_0x1fdd7d['read']=!![];}return _0x44e42b[_0x18f5('0x1c')](_0x1fdd7d);}else{return logger[_0x18f5('0x1e')](_0x18f5('0x2e'),_0x18f5('0x2f'),_0x18f5('0x69'),util[_0x18f5('0x30')](_0x55fde5['error'],{'showHidden':![],'depth':null}));}})[_0x18f5('0x2d')](function(_0x5679e6){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','csc',util[_0x18f5('0x30')](_0x5679e6,{'showHidden':![],'depth':null}));});}else{logger[_0x18f5('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x18f5('0x2f'),_0x18f5('0x69'),_0x18f5('0x6a'));}break;case _0x18f5('0x6b'):if(_0xa812aa[_0x18f5('0x5f')]){var _0xe6b777={'method':_0x18f5('0x3b'),'uri':_0x18f5('0x6c'),'headers':{'Authorization':_0xa812aa[_0x18f5('0x5f')]},'body':{'content':_0x808953[_0x18f5('0xe')],'to':[_0x808953[_0x18f5('0x28')]],'from':_0xa812aa[_0x18f5('0x28')],'binary':![],'clientMessageId':_0x18f5('0x6d'),'charset':_0x18f5('0x6e')},'json':!![]};rp(_0xe6b777)['then'](function(_0x17dd7){if(!_0x17dd7['error']){var _0x4dbcba={'messageId':_0x17dd7[_0x18f5('0x26')][0x0][_0x18f5('0x6f')]};if(!_0xa812aa[_0x18f5('0x42')]){_0x4dbcba[_0x18f5('0x3e')]=!![];}return _0x44e42b['update'](_0x4dbcba);}else{return logger[_0x18f5('0x1e')](_0x18f5('0x2e'),_0x18f5('0x2f'),_0x18f5('0x6b'),util['inspect'](_0x17dd7[_0x18f5('0x1e')],{'showHidden':![],'depth':null}));}})[_0x18f5('0x2d')](function(_0x4fe45d){return logger[_0x18f5('0x1e')](_0x18f5('0x2e'),_0x18f5('0x2f'),'clickatell',util[_0x18f5('0x30')](_0x4fe45d,{'showHidden':![],'depth':null}));});}else{logger[_0x18f5('0x1e')](_0x18f5('0x2e'),_0x18f5('0x2f'),_0x18f5('0x6b'),_0x18f5('0x6a'));}break;case _0x18f5('0x70'):if(_0xa812aa[_0x18f5('0x34')]&&_0xa812aa[_0x18f5('0x35')]){var _0x27df28=util[_0x18f5('0x46')](_0x18f5('0x47'),_0xa812aa['username'],_0xa812aa['password']);var _0x351adf={'method':_0x18f5('0x3b'),'uri':_0x18f5('0x71')+_0xa812aa[_0x18f5('0x72')]+'/messages','body':{'to':[_0x808953[_0x18f5('0x28')]],'text':_0x808953[_0x18f5('0xe')],'from':_0xa812aa[_0x18f5('0x28')],'applicationId':_0xa812aa['applicationId']},'headers':{'Authorization':util[_0x18f5('0x46')](_0x18f5('0x49'),new Buffer(_0x27df28)[_0x18f5('0x4a')]('base64'))},'json':!![]};rp(_0x351adf)[_0x18f5('0x1b')](function(_0x295072){if(_0x295072['id']){var _0x4099fa={'messageId':_0x295072['id']};return _0x44e42b[_0x18f5('0x1c')](_0x4099fa);}else{logger['error'](_0x18f5('0x2e'),'afterCreate',_0x18f5('0x70'),util[_0x18f5('0x30')](_0x295072,{'showHidden':![],'depth':null}));}})[_0x18f5('0x2d')](function(_0x53fcf6){logger[_0x18f5('0x1e')](_0x18f5('0x2e'),_0x18f5('0x2f'),_0x18f5('0x70'),util[_0x18f5('0x30')](_0x53fcf6,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x18f5('0x2e'),_0x18f5('0x2f'),'bandwidth',_0x18f5('0x3f'));}break;case _0x18f5('0x73'):if(_0xa812aa[_0x18f5('0x5f')]){var _0x41b738={};var _0x5d29fb={'method':'POST','uri':_0x18f5('0x74'),'headers':{'Authorization':_0x18f5('0x75')+_0xa812aa['apiKey'],'Content-Type':_0x18f5('0x5c')},'body':{'from':_0xa812aa[_0x18f5('0x28')],'to':_0x808953[_0x18f5('0x28')],'text':_0x808953[_0x18f5('0xe')]},'json':!![]};return rp(_0x5d29fb)[_0x18f5('0x1b')](function(_0x5651bc){if(_0x5651bc[_0x18f5('0x76')]==0xca){_0x41b738['message']=_0x5651bc;var _0x43688a={'method':_0x18f5('0x3b'),'uri':_0x18f5('0x77'),'headers':{'Authorization':_0x18f5('0x75')+_0xa812aa[_0x18f5('0x5f')],'Content-Type':_0x18f5('0x5c')},'body':{'refid':_0x41b738['message'][_0x18f5('0x78')]},'json':!![]};return rp(_0x43688a)[_0x18f5('0x1b')](function(_0x412e81){_0x41b738[_0x18f5('0x79')]=_0x412e81;var _0x971430={'messageId':_0x41b738[_0x18f5('0x7a')]['refid'],'read':!![]};return _0x44e42b['update'](_0x971430);});}else{return logger[_0x18f5('0x1e')](_0x18f5('0x2e'),_0x18f5('0x2f'),_0x18f5('0x73'),util['inspect'](_0x5651bc,{'showHidden':![],'depth':null}));}})[_0x18f5('0x2d')](function(_0x346734){return logger[_0x18f5('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','intelepeer',util['inspect'](_0x346734,{'showHidden':![],'depth':null}));});}else{return logger[_0x18f5('0x1e')](_0x18f5('0x2e'),_0x18f5('0x2f'),'intelepeer',_0x18f5('0x7b'));}break;}}})[_0x18f5('0x7c')](function(){_0x2fbcc5();});}else{_0x2fbcc5();}}},'charset':_0x18f5('0x7d'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 0429616..f2f3d6a 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 _0xd996=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./smsMessage.socket','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsMessage','create','body','raw','CreateSmsMessage','lodash','util','moment'];(function(_0xa8a364,_0x4f2e15){var _0x30ddcc=function(_0x109b50){while(--_0x109b50){_0xa8a364['push'](_0xa8a364['shift']());}};_0x30ddcc(++_0x4f2e15);}(_0xd996,0x1ec));var _0x6d99=function(_0x234d56,_0x4eee01){_0x234d56=_0x234d56-0x0;var _0xd47811=_0xd996[_0x234d56];return _0xd47811;};'use strict';var _=require(_0x6d99('0x0'));var util=require(_0x6d99('0x1'));var moment=require(_0x6d99('0x2'));var BPromise=require(_0x6d99('0x3'));var rs=require(_0x6d99('0x4'));var fs=require('fs');var Redis=require(_0x6d99('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d99('0x6'));var logger=require(_0x6d99('0x7'))(_0x6d99('0x8'));var config=require(_0x6d99('0x9'));var jayson=require(_0x6d99('0xa'));var client=jayson[_0x6d99('0xb')][_0x6d99('0xc')]({'port':0x232a});config[_0x6d99('0xd')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6d99('0xe'))(new Redis(config[_0x6d99('0xd')]));require(_0x6d99('0xf'))['register'](socket);function respondWithRpcPromise(_0xbbea3b,_0x1ee896,_0x285b68){return new BPromise(function(_0x4e9daa,_0x5a9540){return client[_0x6d99('0x10')](_0xbbea3b,_0x285b68)[_0x6d99('0x11')](function(_0x292523){logger['info'](_0x6d99('0x12'),_0x1ee896,_0x6d99('0x13'));logger[_0x6d99('0x14')](_0x6d99('0x15'),_0x1ee896,_0x6d99('0x13'),JSON[_0x6d99('0x16')](_0x292523));if(_0x292523[_0x6d99('0x17')]){if(_0x292523[_0x6d99('0x17')][_0x6d99('0x18')]===0x1f4){logger[_0x6d99('0x17')]('SmsMessage,\x20%s,\x20%s',_0x1ee896,_0x292523[_0x6d99('0x17')][_0x6d99('0x19')]);return _0x5a9540(_0x292523[_0x6d99('0x17')][_0x6d99('0x19')]);}logger[_0x6d99('0x17')]('SmsMessage,\x20%s,\x20%s',_0x1ee896,_0x292523[_0x6d99('0x17')][_0x6d99('0x19')]);return _0x4e9daa(_0x292523[_0x6d99('0x17')][_0x6d99('0x19')]);}else{logger['info'](_0x6d99('0x12'),_0x1ee896,_0x6d99('0x13'));_0x4e9daa(_0x292523[_0x6d99('0x1a')][_0x6d99('0x19')]);}})[_0x6d99('0x1b')](function(_0x132586){logger[_0x6d99('0x17')]('SmsMessage,\x20%s,\x20%s',_0x1ee896,_0x132586);_0x5a9540(_0x132586);});});}exports['CreateSmsMessage']=function(_0x28ea89){var _0x1c83a9=this;return new Promise(function(_0x313bec,_0x3c467e){return db[_0x6d99('0x1c')][_0x6d99('0x1d')](_0x28ea89[_0x6d99('0x1e')],{'raw':_0x28ea89['options']?_0x28ea89['options'][_0x6d99('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x21715b){logger['info'](_0x6d99('0x20'),_0x28ea89);logger[_0x6d99('0x14')]('CreateSmsMessage',_0x28ea89,JSON[_0x6d99('0x16')](_0x21715b));_0x313bec(_0x21715b);})[_0x6d99('0x1b')](function(_0x37c294){logger[_0x6d99('0x17')]('CreateSmsMessage',_0x37c294[_0x6d99('0x19')],_0x28ea89);_0x3c467e(_0x1c83a9[_0x6d99('0x17')](0x1f4,_0x37c294[_0x6d99('0x19')]));});});}; \ No newline at end of file +var _0xf9c3=['CreateSmsMessage','SmsMessage','create','body','options','raw','then','debug','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','info','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','error','SmsMessage,\x20%s,\x20%s','message','result','catch'];(function(_0x56a8c8,_0x1cb851){var _0x51740c=function(_0x525f6d){while(--_0x525f6d){_0x56a8c8['push'](_0x56a8c8['shift']());}};_0x51740c(++_0x1cb851);}(_0xf9c3,0xd5));var _0x3f9c=function(_0x4c978c,_0xbd7d69){_0x4c978c=_0x4c978c-0x0;var _0x48db9c=_0xf9c3[_0x4c978c];return _0x48db9c;};'use strict';var _=require(_0x3f9c('0x0'));var util=require(_0x3f9c('0x1'));var moment=require(_0x3f9c('0x2'));var BPromise=require(_0x3f9c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f9c('0x4'));var db=require(_0x3f9c('0x5'))['db'];var utils=require(_0x3f9c('0x6'));var logger=require(_0x3f9c('0x7'))('rpc');var config=require(_0x3f9c('0x8'));var jayson=require(_0x3f9c('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x3f9c('0xa')]=_[_0x3f9c('0xb')](config[_0x3f9c('0xa')],{'host':_0x3f9c('0xc'),'port':0x18eb});var socket=require(_0x3f9c('0xd'))(new Redis(config['redis']));require(_0x3f9c('0xe'))[_0x3f9c('0xf')](socket);function respondWithRpcPromise(_0x4239d3,_0xc97907,_0x38e42){return new BPromise(function(_0x325dad,_0xfa8b6f){return client[_0x3f9c('0x10')](_0x4239d3,_0x38e42)['then'](function(_0x2f1009){logger[_0x3f9c('0x11')]('SmsMessage,\x20%s,\x20%s',_0xc97907,_0x3f9c('0x12'));logger['debug'](_0x3f9c('0x13'),_0xc97907,_0x3f9c('0x12'),JSON['stringify'](_0x2f1009));if(_0x2f1009[_0x3f9c('0x14')]){if(_0x2f1009[_0x3f9c('0x14')]['code']===0x1f4){logger[_0x3f9c('0x14')](_0x3f9c('0x15'),_0xc97907,_0x2f1009['error'][_0x3f9c('0x16')]);return _0xfa8b6f(_0x2f1009[_0x3f9c('0x14')][_0x3f9c('0x16')]);}logger[_0x3f9c('0x14')]('SmsMessage,\x20%s,\x20%s',_0xc97907,_0x2f1009[_0x3f9c('0x14')][_0x3f9c('0x16')]);return _0x325dad(_0x2f1009['error']['message']);}else{logger[_0x3f9c('0x11')]('SmsMessage,\x20%s,\x20%s',_0xc97907,'request\x20sent');_0x325dad(_0x2f1009[_0x3f9c('0x17')][_0x3f9c('0x16')]);}})[_0x3f9c('0x18')](function(_0x500de1){logger['error']('SmsMessage,\x20%s,\x20%s',_0xc97907,_0x500de1);_0xfa8b6f(_0x500de1);});});}exports[_0x3f9c('0x19')]=function(_0x7385fd){var _0x20f298=this;return new Promise(function(_0x557110,_0x49d438){return db[_0x3f9c('0x1a')][_0x3f9c('0x1b')](_0x7385fd[_0x3f9c('0x1c')],{'raw':_0x7385fd[_0x3f9c('0x1d')]?_0x7385fd['options'][_0x3f9c('0x1e')]===undefined?!![]:![]:!![]})[_0x3f9c('0x1f')](function(_0x32b1be){logger[_0x3f9c('0x11')](_0x3f9c('0x19'),_0x7385fd);logger[_0x3f9c('0x20')](_0x3f9c('0x19'),_0x7385fd,JSON[_0x3f9c('0x21')](_0x32b1be));_0x557110(_0x32b1be);})[_0x3f9c('0x18')](function(_0x14c6ec){logger[_0x3f9c('0x14')](_0x3f9c('0x19'),_0x14c6ec[_0x3f9c('0x16')],_0x7385fd);_0x49d438(_0x20f298[_0x3f9c('0x14')](0x1f4,_0x14c6ec[_0x3f9c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index cc76c99..6e69b0c 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 _0xf091=['update','emit','removeListener','register','length','smsMessage:','./smsMessage.events','save','remove'];(function(_0x558e45,_0x4f5e4f){var _0x3e9075=function(_0x289725){while(--_0x289725){_0x558e45['push'](_0x558e45['shift']());}};_0x3e9075(++_0x4f5e4f);}(_0xf091,0x19b));var _0x1f09=function(_0x3c3127,_0x44a3c6){_0x3c3127=_0x3c3127-0x0;var _0x1de229=_0xf091[_0x3c3127];return _0x1de229;};'use strict';var SmsMessageEvents=require(_0x1f09('0x0'));var events=[_0x1f09('0x1'),_0x1f09('0x2'),_0x1f09('0x3')];function createListener(_0x3aa2a6,_0x2f5d99){return function(_0x26dad7){_0x2f5d99[_0x1f09('0x4')](_0x3aa2a6,_0x26dad7);};}function removeListener(_0x190140,_0x1a44fe){return function(){SmsMessageEvents[_0x1f09('0x5')](_0x190140,_0x1a44fe);};}exports[_0x1f09('0x6')]=function(_0x101700){for(var _0x121b6d=0x0,_0x2741d8=events[_0x1f09('0x7')];_0x121b6d<_0x2741d8;_0x121b6d++){var _0x2f9a5f=events[_0x121b6d];var _0x1a39e7=createListener(_0x1f09('0x8')+_0x2f9a5f,_0x101700);SmsMessageEvents['on'](_0x2f9a5f,_0x1a39e7);}}; \ No newline at end of file +var _0x6474=['save','remove','update','emit','removeListener','register','smsMessage:'];(function(_0x150c3c,_0x1f160c){var _0xf30f16=function(_0x51768f){while(--_0x51768f){_0x150c3c['push'](_0x150c3c['shift']());}};_0xf30f16(++_0x1f160c);}(_0x6474,0x1c0));var _0x4647=function(_0x456963,_0xe70b42){_0x456963=_0x456963-0x0;var _0x492073=_0x6474[_0x456963];return _0x492073;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x4647('0x0'),_0x4647('0x1'),_0x4647('0x2')];function createListener(_0x1f4e2b,_0x4e9e50){return function(_0x5bf8f2){_0x4e9e50[_0x4647('0x3')](_0x1f4e2b,_0x5bf8f2);};}function removeListener(_0x3a6a5e,_0xeda970){return function(){SmsMessageEvents[_0x4647('0x4')](_0x3a6a5e,_0xeda970);};}exports[_0x4647('0x5')]=function(_0x562a73){for(var _0x36d2b8=0x0,_0x17ff47=events['length'];_0x36d2b8<_0x17ff47;_0x36d2b8++){var _0x3a95ce=events[_0x36d2b8];var _0x3a597f=createListener(_0x4647('0x6')+_0x3a95ce,_0x562a73);SmsMessageEvents['on'](_0x3a95ce,_0x3a597f);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 7e6d4bd..f263fe3 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 _0x6216=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/users','getAgents','create','/:id/teams','addTeams','post','addAgents','put','update','destroy','removeTeams','delete','removeAgents','multer','util','express','Router','fs-extra'];(function(_0x51790c,_0x452a6b){var _0x3c4aa5=function(_0x2c6328){while(--_0x2c6328){_0x51790c['push'](_0x51790c['shift']());}};_0x3c4aa5(++_0x452a6b);}(_0x6216,0x113));var _0x6621=function(_0x2bbbab,_0x53275f){_0x2bbbab=_0x2bbbab-0x0;var _0x18816b=_0x6216[_0x2bbbab];return _0x18816b;};'use strict';var multer=require(_0x6621('0x0'));var util=require(_0x6621('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6621('0x2'));var router=express[_0x6621('0x3')]();var fs_extra=require(_0x6621('0x4'));var auth=require(_0x6621('0x5'));var interaction=require(_0x6621('0x6'));var config=require(_0x6621('0x7'));var controller=require('./smsQueue.controller');router[_0x6621('0x8')]('/',auth[_0x6621('0x9')](),controller[_0x6621('0xa')]);router[_0x6621('0x8')](_0x6621('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x6621('0x8')](_0x6621('0xc'),auth[_0x6621('0x9')](),controller[_0x6621('0xd')]);router['get'](_0x6621('0xe'),auth[_0x6621('0x9')](),controller['getMembers']);router[_0x6621('0x8')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router[_0x6621('0x8')](_0x6621('0xf'),auth[_0x6621('0x9')](),controller[_0x6621('0x10')]);router['post']('/',auth[_0x6621('0x9')](),controller[_0x6621('0x11')]);router['post'](_0x6621('0x12'),auth[_0x6621('0x9')](),controller[_0x6621('0x13')]);router[_0x6621('0x14')](_0x6621('0xf'),auth[_0x6621('0x9')](),controller[_0x6621('0x15')]);router[_0x6621('0x16')](_0x6621('0xc'),auth[_0x6621('0x9')](),controller[_0x6621('0x17')]);router['delete']('/:id',auth[_0x6621('0x9')](),controller[_0x6621('0x18')]);router['delete'](_0x6621('0x12'),auth['isAuthenticated'](),controller[_0x6621('0x19')]);router[_0x6621('0x1a')]('/:id/users',auth[_0x6621('0x9')](),controller[_0x6621('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x0984=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/teams','getAgents','post','create','addTeams','addAgents','put','/:id','destroy','delete','removeTeams','/:id/users','exports','util','path','connect-timeout','express','Router'];(function(_0x31a5fb,_0x169885){var _0x56d4fa=function(_0x3fea13){while(--_0x3fea13){_0x31a5fb['push'](_0x31a5fb['shift']());}};_0x56d4fa(++_0x169885);}(_0x0984,0x1e9));var _0x4098=function(_0x1ad188,_0x12744d){_0x1ad188=_0x1ad188-0x0;var _0x5ab6e5=_0x0984[_0x1ad188];return _0x5ab6e5;};'use strict';var multer=require('multer');var util=require(_0x4098('0x0'));var path=require(_0x4098('0x1'));var timeout=require(_0x4098('0x2'));var express=require(_0x4098('0x3'));var router=express[_0x4098('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4098('0x5'));var config=require(_0x4098('0x6'));var controller=require('./smsQueue.controller');router[_0x4098('0x7')]('/',auth[_0x4098('0x8')](),controller[_0x4098('0x9')]);router[_0x4098('0x7')](_0x4098('0xa'),auth[_0x4098('0x8')](),controller[_0x4098('0xb')]);router[_0x4098('0x7')]('/:id',auth[_0x4098('0x8')](),controller[_0x4098('0xc')]);router[_0x4098('0x7')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router['get'](_0x4098('0xd'),auth[_0x4098('0x8')](),controller['getTeams']);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x4098('0xe')]);router[_0x4098('0xf')]('/',auth[_0x4098('0x8')](),controller[_0x4098('0x10')]);router['post'](_0x4098('0xd'),auth['isAuthenticated'](),controller[_0x4098('0x11')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x4098('0x12')]);router[_0x4098('0x13')](_0x4098('0x14'),auth[_0x4098('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x4098('0x15')]);router[_0x4098('0x16')](_0x4098('0xd'),auth['isAuthenticated'](),controller[_0x4098('0x17')]);router['delete'](_0x4098('0x18'),auth[_0x4098('0x8')](),controller['removeAgents']);module[_0x4098('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 8b5cd8b..db8a643 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 _0x880f=['roundrobin','sequelize','exports','STRING','name','INTEGER','rrmemory','beepall'];(function(_0xab9f3d,_0xb336fa){var _0x5283bf=function(_0x505e6c){while(--_0x505e6c){_0xab9f3d['push'](_0xab9f3d['shift']());}};_0x5283bf(++_0xb336fa);}(_0x880f,0xc1));var _0xf880=function(_0x361cfe,_0x2929be){_0x361cfe=_0x361cfe-0x0;var _0x1218bd=_0x880f[_0x361cfe];return _0x1218bd;};'use strict';var Sequelize=require(_0xf880('0x0'));module[_0xf880('0x1')]={'name':{'type':Sequelize[_0xf880('0x2')],'unique':_0xf880('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf880('0x2')]},'timeout':{'type':Sequelize[_0xf880('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xf880('0x5'),_0xf880('0x6'),_0xf880('0x7'))}}; \ No newline at end of file +var _0xeb81=['rrmemory','exports','STRING','name','ENUM'];(function(_0x2bc6ab,_0x5205ac){var _0x324704=function(_0x912fd8){while(--_0x912fd8){_0x2bc6ab['push'](_0x2bc6ab['shift']());}};_0x324704(++_0x5205ac);}(_0xeb81,0x1c3));var _0x1eb8=function(_0x2459fd,_0x575d9b){_0x2459fd=_0x2459fd-0x0;var _0x364cd2=_0xeb81[_0x2459fd];return _0x364cd2;};'use strict';var Sequelize=require('sequelize');module[_0x1eb8('0x0')]={'name':{'type':Sequelize[_0x1eb8('0x1')],'unique':_0x1eb8('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1eb8('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1eb8('0x3')](_0x1eb8('0x4'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index bf097f3..ce5d37d 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 _0x6b1e=['union','compact','value','isEmpty','userSmsQueue:remove','addAgents','omit','removeAgents','isArray','getAgents','hasOwnProperty','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','SmsQueues','UserProfileResource','end','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','type','filter','includeAll','include','findAll','rows','show','params','keys','options','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','User','UserId','agent','createdAt','format','%s/%s','smsPause','updatedAt','getTeams','Team','online','voicePause','interface','Agents','sequelize','transaction','addTeams','forEach','emit','userSmsQueue:save','removeTeams','ids','select','field','tq.TeamId','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','all'];(function(_0x4f33ee,_0x4d0f6d){var _0x307e2d=function(_0x2020aa){while(--_0x2020aa){_0x4f33ee['push'](_0x4f33ee['shift']());}};_0x307e2d(++_0x4d0f6d);}(_0x6b1e,0x9a));var _0xe6b1=function(_0x2d3141,_0x5969fb){_0x2d3141=_0x2d3141-0x0;var _0x21b6f7=_0x6b1e[_0x2d3141];return _0x21b6f7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe6b1('0x0'));var rp=require(_0xe6b1('0x1'));var moment=require(_0xe6b1('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe6b1('0x3'));var util=require(_0xe6b1('0x4'));var path=require('path');var sox=require(_0xe6b1('0x5'));var csv=require('to-csv');var ejs=require(_0xe6b1('0x6'));var fs=require('fs');var fs_extra=require(_0xe6b1('0x7'));var _=require(_0xe6b1('0x8'));var squel=require(_0xe6b1('0x9'));var crypto=require(_0xe6b1('0xa'));var jsforce=require(_0xe6b1('0xb'));var deskjs=require(_0xe6b1('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe6b1('0xd'));var Papa=require(_0xe6b1('0xe'));var Redis=require(_0xe6b1('0xf'));var authService=require(_0xe6b1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe6b1('0x11'));var hardwareService=require(_0xe6b1('0x12'));var logger=require('../../config/logger')(_0xe6b1('0x13'));var utils=require(_0xe6b1('0x14'));var config=require(_0xe6b1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe6b1('0x16'))['db'];config[_0xe6b1('0x17')]=_[_0xe6b1('0x18')](config['redis'],{'host':_0xe6b1('0x19'),'port':0x18eb});var socket=require(_0xe6b1('0x1a'))(new Redis(config['redis']));require(_0xe6b1('0x1b'))[_0xe6b1('0x1c')](socket);function respondWithStatusCode(_0x2e7475,_0x56c39a){_0x56c39a=_0x56c39a||0xcc;return function(_0x530e38){if(_0x530e38){return _0x2e7475[_0xe6b1('0x1d')](_0x56c39a);}return _0x2e7475[_0xe6b1('0x1e')](_0x56c39a)['end']();};}function respondWithResult(_0x197438,_0x49b0f1){_0x49b0f1=_0x49b0f1||0xc8;return function(_0x3bc7d8){if(_0x3bc7d8){return _0x197438[_0xe6b1('0x1e')](_0x49b0f1)[_0xe6b1('0x1f')](_0x3bc7d8);}};}function respondWithFilteredResult(_0x38502f,_0x2cf96a){return function(_0x146634){if(_0x146634){var _0xf2c902=typeof _0x2cf96a[_0xe6b1('0x20')]===_0xe6b1('0x21')&&typeof _0x2cf96a[_0xe6b1('0x22')]===_0xe6b1('0x21');var _0x3bc7c2=_0x146634['count'];var _0x4daa62=_0xf2c902?0x0:_0x2cf96a[_0xe6b1('0x20')];var _0x5b0c7d=_0xf2c902?_0x146634[_0xe6b1('0x23')]:_0x2cf96a['offset']+_0x2cf96a[_0xe6b1('0x22')];var _0x2773bf;if(_0x5b0c7d>=_0x3bc7c2){_0x5b0c7d=_0x3bc7c2;_0x2773bf=0xc8;}else{_0x2773bf=0xce;}_0x38502f[_0xe6b1('0x1e')](_0x2773bf);return _0x38502f[_0xe6b1('0x24')](_0xe6b1('0x25'),_0x4daa62+'-'+_0x5b0c7d+'/'+_0x3bc7c2)['json'](_0x146634);}return null;};}function patchUpdates(_0x27843f){return function(_0x262f34){try{jsonpatch[_0xe6b1('0x26')](_0x262f34,_0x27843f,!![]);}catch(_0x45334d){return BPromise[_0xe6b1('0x27')](_0x45334d);}return _0x262f34[_0xe6b1('0x28')]();};}function saveUpdates(_0x311d08,_0x511795){return function(_0x2580c2){if(_0x2580c2){return _0x2580c2['update'](_0x311d08)['then'](function(_0x4a7840){return _0x4a7840;});}return null;};}function removeEntity(_0x2532d6,_0x43a5e0){return function(_0x2112c7){if(_0x2112c7){return _0x2112c7[_0xe6b1('0x29')]()[_0xe6b1('0x2a')](function(){var _0x135477=_0x2112c7[_0xe6b1('0x2b')]({'plain':!![]});var _0xd6ed1b=_0xe6b1('0x2c');return db[_0xe6b1('0x2d')][_0xe6b1('0x29')]({'where':{'type':_0xd6ed1b,'resourceId':_0x135477['id']}})[_0xe6b1('0x2a')](function(){return _0x2112c7;});})['then'](function(){_0x2532d6[_0xe6b1('0x1e')](0xcc)[_0xe6b1('0x2e')]();});}};}function handleEntityNotFound(_0x5eb115,_0xfd5f90){return function(_0x9ed3e8){if(!_0x9ed3e8){_0x5eb115[_0xe6b1('0x1d')](0x194);}return _0x9ed3e8;};}function handleError(_0x5e8d73,_0x216b0a){_0x216b0a=_0x216b0a||0x1f4;return function(_0x1e5e1d){logger[_0xe6b1('0x2f')](_0x1e5e1d[_0xe6b1('0x30')]);if(_0x1e5e1d[_0xe6b1('0x31')]){delete _0x1e5e1d[_0xe6b1('0x31')];}_0x5e8d73['status'](_0x216b0a)[_0xe6b1('0x32')](_0x1e5e1d);};}exports[_0xe6b1('0x33')]=function(_0x8b8226,_0x548672){var _0xfe89e1={},_0x3db105={},_0x2988e5={'count':0x0,'rows':[]};var _0x72cb28=_[_0xe6b1('0x34')](db[_0xe6b1('0x35')][_0xe6b1('0x36')],function(_0x2d8709){return{'name':_0x2d8709[_0xe6b1('0x37')],'type':_0x2d8709['type']['key']};});_0x3db105[_0xe6b1('0x38')]=_[_0xe6b1('0x34')](_0x72cb28,_0xe6b1('0x31'));_0x3db105['query']=_['keys'](_0x8b8226[_0xe6b1('0x39')]);_0x3db105[_0xe6b1('0x3a')]=_['intersection'](_0x3db105[_0xe6b1('0x38')],_0x3db105[_0xe6b1('0x39')]);_0xfe89e1[_0xe6b1('0x3b')]=_[_0xe6b1('0x3c')](_0x3db105[_0xe6b1('0x38')],qs[_0xe6b1('0x3d')](_0x8b8226[_0xe6b1('0x39')][_0xe6b1('0x3d')]));_0xfe89e1['attributes']=_0xfe89e1[_0xe6b1('0x3b')][_0xe6b1('0x3e')]?_0xfe89e1[_0xe6b1('0x3b')]:_0x3db105[_0xe6b1('0x38')];if(!_0x8b8226['query']['hasOwnProperty'](_0xe6b1('0x3f'))){_0xfe89e1[_0xe6b1('0x22')]=qs[_0xe6b1('0x22')](_0x8b8226[_0xe6b1('0x39')][_0xe6b1('0x22')]);_0xfe89e1['offset']=qs[_0xe6b1('0x20')](_0x8b8226[_0xe6b1('0x39')][_0xe6b1('0x20')]);}_0xfe89e1[_0xe6b1('0x40')]=qs[_0xe6b1('0x41')](_0x8b8226[_0xe6b1('0x39')][_0xe6b1('0x41')]);_0xfe89e1[_0xe6b1('0x42')]=qs[_0xe6b1('0x3a')](_[_0xe6b1('0x43')](_0x8b8226[_0xe6b1('0x39')],_0x3db105['filters']),_0x72cb28);if(_0x8b8226[_0xe6b1('0x39')]['filter']){_0xfe89e1[_0xe6b1('0x42')]=_[_0xe6b1('0x44')](_0xfe89e1[_0xe6b1('0x42')],{'$or':_[_0xe6b1('0x34')](_0x72cb28,function(_0x32260d){if(_0x32260d[_0xe6b1('0x45')]!=='VIRTUAL'){var _0xf27b3a={};_0xf27b3a[_0x32260d[_0xe6b1('0x31')]]={'$like':'%'+_0x8b8226[_0xe6b1('0x39')][_0xe6b1('0x46')]+'%'};return _0xf27b3a;}})});}_0xfe89e1=_[_0xe6b1('0x44')]({},_0xfe89e1,_0x8b8226['options']);var _0x1ae074={'where':_0xfe89e1[_0xe6b1('0x42')]};return db[_0xe6b1('0x35')][_0xe6b1('0x23')](_0x1ae074)[_0xe6b1('0x2a')](function(_0x4b4e23){_0x2988e5[_0xe6b1('0x23')]=_0x4b4e23;if(_0x8b8226[_0xe6b1('0x39')][_0xe6b1('0x47')]){_0xfe89e1[_0xe6b1('0x48')]=[{'all':!![]}];}return db[_0xe6b1('0x35')][_0xe6b1('0x49')](_0xfe89e1);})[_0xe6b1('0x2a')](function(_0x319fa1){_0x2988e5[_0xe6b1('0x4a')]=_0x319fa1;return _0x2988e5;})[_0xe6b1('0x2a')](respondWithFilteredResult(_0x548672,_0xfe89e1))['catch'](handleError(_0x548672,null));};exports[_0xe6b1('0x4b')]=function(_0x11bd14,_0x2ac5d9){var _0x410004={'raw':!![],'where':{'id':_0x11bd14[_0xe6b1('0x4c')]['id']}},_0x1c9b6e={};_0x1c9b6e[_0xe6b1('0x38')]=_[_0xe6b1('0x4d')](db['SmsQueue'][_0xe6b1('0x36')]);_0x1c9b6e['query']=_[_0xe6b1('0x4d')](_0x11bd14[_0xe6b1('0x39')]);_0x1c9b6e[_0xe6b1('0x3a')]=_['intersection'](_0x1c9b6e[_0xe6b1('0x38')],_0x1c9b6e[_0xe6b1('0x39')]);_0x410004[_0xe6b1('0x3b')]=_[_0xe6b1('0x3c')](_0x1c9b6e[_0xe6b1('0x38')],qs[_0xe6b1('0x3d')](_0x11bd14['query']['fields']));_0x410004[_0xe6b1('0x3b')]=_0x410004[_0xe6b1('0x3b')]['length']?_0x410004[_0xe6b1('0x3b')]:_0x1c9b6e[_0xe6b1('0x38')];if(_0x11bd14[_0xe6b1('0x39')][_0xe6b1('0x47')]){_0x410004[_0xe6b1('0x48')]=[{'all':!![]}];}_0x410004=_[_0xe6b1('0x44')]({},_0x410004,_0x11bd14[_0xe6b1('0x4e')]);return db['SmsQueue']['find'](_0x410004)[_0xe6b1('0x2a')](handleEntityNotFound(_0x2ac5d9,null))['then'](respondWithResult(_0x2ac5d9,null))[_0xe6b1('0x4f')](handleError(_0x2ac5d9,null));};exports[_0xe6b1('0x50')]=function(_0x51c935,_0x532457){return db['SmsQueue'][_0xe6b1('0x50')](_0x51c935['body'],{})[_0xe6b1('0x2a')](function(_0x11b555){var _0x4e83f6=_0x51c935[_0xe6b1('0x51')][_0xe6b1('0x2b')]({'plain':!![]});if(!_0x4e83f6)throw new Error(_0xe6b1('0x52'));if(_0x4e83f6[_0xe6b1('0x53')]===_0xe6b1('0x51')){var _0x406f73=_0x11b555[_0xe6b1('0x2b')]({'plain':!![]});var _0x215da7=_0xe6b1('0x2c');return db[_0xe6b1('0x54')][_0xe6b1('0x55')]({'where':{'name':_0x215da7,'userProfileId':_0x4e83f6[_0xe6b1('0x56')]},'raw':!![]})[_0xe6b1('0x2a')](function(_0x104edd){if(_0x104edd&&_0x104edd[_0xe6b1('0x57')]===0x0){return db[_0xe6b1('0x2d')][_0xe6b1('0x50')]({'name':_0x406f73[_0xe6b1('0x31')],'resourceId':_0x406f73['id'],'type':_0x104edd['name'],'sectionId':_0x104edd['id']},{})[_0xe6b1('0x2a')](function(){return _0x11b555;});}else{return _0x11b555;}})[_0xe6b1('0x4f')](function(_0x1e5929){logger['error'](_0xe6b1('0x58'),_0x1e5929);throw _0x1e5929;});}return _0x11b555;})[_0xe6b1('0x2a')](respondWithResult(_0x532457,0xc9))[_0xe6b1('0x4f')](handleError(_0x532457,null));};exports['update']=function(_0x52b16c,_0x3c6d76){if(_0x52b16c['body']['id']){delete _0x52b16c[_0xe6b1('0x59')]['id'];}return db['SmsQueue'][_0xe6b1('0x55')]({'where':{'id':_0x52b16c[_0xe6b1('0x4c')]['id']}})[_0xe6b1('0x2a')](handleEntityNotFound(_0x3c6d76,null))[_0xe6b1('0x2a')](saveUpdates(_0x52b16c['body'],null))[_0xe6b1('0x2a')](respondWithResult(_0x3c6d76,null))[_0xe6b1('0x4f')](handleError(_0x3c6d76,null));};exports['destroy']=function(_0x304aa5,_0x26ea1a){return db[_0xe6b1('0x35')][_0xe6b1('0x55')]({'where':{'id':_0x304aa5[_0xe6b1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x26ea1a,null))['then'](removeEntity(_0x26ea1a,null))[_0xe6b1('0x4f')](handleError(_0x26ea1a,null));};exports[_0xe6b1('0x5a')]=function(_0x10247a,_0x547a18){return db[_0xe6b1('0x35')]['describe']()['then'](respondWithResult(_0x547a18,null))[_0xe6b1('0x4f')](handleError(_0x547a18,null));};exports[_0xe6b1('0x5b')]=function(_0x1776d1,_0x5e9638,_0x229203){var _0xfb7cf5={'raw':!![],'where':{}},_0x480f80={},_0x30be72;return db[_0xe6b1('0x35')][_0xe6b1('0x5c')]({'where':{'id':_0x1776d1[_0xe6b1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5e9638,null))['then'](function(_0x1bd913){if(_0x1bd913){_0x30be72=_0x1bd913[_0xe6b1('0x2b')]({'plain':!![]});_0x480f80[_0xe6b1('0x38')]=_[_0xe6b1('0x4d')](db[_0xe6b1('0x5d')]['rawAttributes']);_0x480f80['query']=_[_0xe6b1('0x4d')](_0x1776d1['query']);_0x480f80['filters']=_[_0xe6b1('0x3c')](_0x480f80['model'],_0x480f80[_0xe6b1('0x39')]);_0xfb7cf5[_0xe6b1('0x3b')]=_['intersection'](_0x480f80[_0xe6b1('0x38')],qs['fields'](_0x1776d1[_0xe6b1('0x39')][_0xe6b1('0x3d')]));_0xfb7cf5[_0xe6b1('0x3b')]=_0xfb7cf5['attributes']['length']?_0xfb7cf5[_0xe6b1('0x3b')]:_0x480f80['model'];if(!_0x1776d1[_0xe6b1('0x39')]['hasOwnProperty'](_0xe6b1('0x3f'))){_0xfb7cf5[_0xe6b1('0x22')]=qs[_0xe6b1('0x22')](_0x1776d1[_0xe6b1('0x39')][_0xe6b1('0x22')]);_0xfb7cf5[_0xe6b1('0x20')]=qs[_0xe6b1('0x20')](_0x1776d1[_0xe6b1('0x39')][_0xe6b1('0x20')]);}_0xfb7cf5[_0xe6b1('0x40')]=qs[_0xe6b1('0x41')](_0x1776d1[_0xe6b1('0x39')][_0xe6b1('0x41')]);_0xfb7cf5[_0xe6b1('0x42')]=qs[_0xe6b1('0x3a')](_[_0xe6b1('0x43')](_0x1776d1['query'],_0x480f80[_0xe6b1('0x3a')]));_0xfb7cf5[_0xe6b1('0x42')][_0xe6b1('0x5e')]=_0x1bd913['id'];if(_0x1776d1[_0xe6b1('0x39')][_0xe6b1('0x46')]){_0xfb7cf5[_0xe6b1('0x42')]=_['merge'](_0xfb7cf5[_0xe6b1('0x42')],{'$or':_[_0xe6b1('0x34')](_0xfb7cf5['attributes'],function(_0x6b6aa3){var _0x2d86ac={};_0x2d86ac[_0x6b6aa3]={'$like':'%'+_0x1776d1[_0xe6b1('0x39')][_0xe6b1('0x46')]+'%'};return _0x2d86ac;})});}_0xfb7cf5=_[_0xe6b1('0x44')]({},_0xfb7cf5,_0x1776d1[_0xe6b1('0x4e')]);return db[_0xe6b1('0x5d')][_0xe6b1('0x49')](_0xfb7cf5);}})[_0xe6b1('0x2a')](function(_0x53b4e8){if(_0x53b4e8){return db[_0xe6b1('0x5f')]['findAndCountAll']({'where':{'id':_[_0xe6b1('0x34')](_0x53b4e8,_0xe6b1('0x60')),'role':_0xe6b1('0x61')},'attributes':['id',_0xe6b1('0x31'),'smsPause','updatedAt',_0xe6b1('0x62')]});}})[_0xe6b1('0x2a')](function(_0x3c25e8){if(_0x3c25e8){return{'count':_0x3c25e8[_0xe6b1('0x23')],'rows':_['map'](_0x3c25e8['rows'],function(_0x47c712){return{'membername':_0x47c712[_0xe6b1('0x31')],'UserId':_0x47c712['id'],'queue_name':_0x30be72['name'],'SmsQueueId':_0x30be72['id'],'interface':util[_0xe6b1('0x63')](_0xe6b1('0x64'),'SIP',_0x47c712['name']),'penalty':0x0,'paused':_0x47c712[_0xe6b1('0x65')],'createdAt':_0x47c712[_0xe6b1('0x62')],'updatedAt':_0x47c712[_0xe6b1('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe6b1('0x2a')](respondWithFilteredResult(_0x5e9638,_0xfb7cf5))[_0xe6b1('0x4f')](handleError(_0x5e9638,null));};exports[_0xe6b1('0x67')]=function(_0x56bc64,_0x1cb403,_0x279180){var _0x4e6bca={};var _0x8c0357={};var _0x2698e4;var _0x5d3b93;return db[_0xe6b1('0x35')][_0xe6b1('0x5c')]({'where':{'id':_0x56bc64['params']['id']}})[_0xe6b1('0x2a')](handleEntityNotFound(_0x1cb403,null))[_0xe6b1('0x2a')](function(_0x4e7a67){if(_0x4e7a67){_0x2698e4=_0x4e7a67;_0x8c0357['model']=_[_0xe6b1('0x4d')](db[_0xe6b1('0x68')][_0xe6b1('0x36')]);_0x8c0357['query']=_[_0xe6b1('0x4d')](_0x56bc64[_0xe6b1('0x39')]);_0x8c0357[_0xe6b1('0x3a')]=_['intersection'](_0x8c0357[_0xe6b1('0x38')],_0x8c0357['query']);_0x4e6bca[_0xe6b1('0x3b')]=_[_0xe6b1('0x3c')](_0x8c0357['model'],qs[_0xe6b1('0x3d')](_0x56bc64['query']['fields']));_0x4e6bca[_0xe6b1('0x3b')]=_0x4e6bca[_0xe6b1('0x3b')][_0xe6b1('0x3e')]?_0x4e6bca['attributes']:_0x8c0357[_0xe6b1('0x38')];_0x4e6bca[_0xe6b1('0x40')]=qs[_0xe6b1('0x41')](_0x56bc64['query'][_0xe6b1('0x41')]);_0x4e6bca['where']=qs[_0xe6b1('0x3a')](_[_0xe6b1('0x43')](_0x56bc64[_0xe6b1('0x39')],_0x8c0357[_0xe6b1('0x3a')]));if(_0x56bc64['query'][_0xe6b1('0x46')]){_0x4e6bca[_0xe6b1('0x42')]=_[_0xe6b1('0x44')](_0x4e6bca[_0xe6b1('0x42')],{'$or':_[_0xe6b1('0x34')](_0x4e6bca['attributes'],function(_0x2daff4){var _0x533bbb={};_0x533bbb[_0x2daff4]={'$like':'%'+_0x56bc64['query']['filter']+'%'};return _0x533bbb;})});}_0x4e6bca=_[_0xe6b1('0x44')]({},_0x4e6bca,_0x56bc64[_0xe6b1('0x4e')]);return _0x2698e4[_0xe6b1('0x67')](_0x4e6bca);}})[_0xe6b1('0x2a')](function(_0x1f773e){if(_0x1f773e){_0x5d3b93=_0x1f773e[_0xe6b1('0x3e')];if(!_0x56bc64[_0xe6b1('0x39')]['hasOwnProperty'](_0xe6b1('0x3f'))){_0x4e6bca[_0xe6b1('0x22')]=qs[_0xe6b1('0x22')](_0x56bc64[_0xe6b1('0x39')][_0xe6b1('0x22')]);_0x4e6bca[_0xe6b1('0x20')]=qs[_0xe6b1('0x20')](_0x56bc64['query'][_0xe6b1('0x20')]);}return _0x2698e4['getTeams'](_0x4e6bca);}})['then'](function(_0x349aa2){if(_0x349aa2){return _0x349aa2?{'count':_0x5d3b93,'rows':_0x349aa2}:null;}})['then'](respondWithResult(_0x1cb403,null))[_0xe6b1('0x4f')](handleError(_0x1cb403,null));};exports['addTeams']=function(_0xc46f12,_0x4649bd,_0x5975d6){var _0x19ce55=_0xc46f12[_0xe6b1('0x59')]['ids'];return db['Team']['findAll']({'where':{'id':_0x19ce55},'attributes':['id'],'include':[{'model':db[_0xe6b1('0x5f')],'as':'Agents','attributes':['id','name',_0xe6b1('0x69'),_0xe6b1('0x6a'),_0xe6b1('0x6b')],'raw':!![]}]})[_0xe6b1('0x2a')](function(_0x418c74){if(_0x418c74){var _0x1cec7e=_['flatMap'](_0x418c74,function(_0x3ed66b){var _0x73ec2c=_0x3ed66b[_0xe6b1('0x2b')]({'plain':!![]});return _0x73ec2c[_0xe6b1('0x6c')];});return db['SmsQueue'][_0xe6b1('0x55')]({'where':{'id':_0xc46f12[_0xe6b1('0x4c')]['id']}})[_0xe6b1('0x2a')](function(_0x3c88b0){return db[_0xe6b1('0x6d')][_0xe6b1('0x6e')](function(_0x1d74e5){return _0x3c88b0[_0xe6b1('0x6f')](_0x19ce55,{'transaction':_0x1d74e5})[_0xe6b1('0x2a')](function(){return BPromise['each'](_0x1cec7e,function(_0x1acd10){return db[_0xe6b1('0x5d')]['findOrCreate']({'where':{'UserId':_0x1acd10['id'],'SmsQueueId':_0xc46f12[_0xe6b1('0x4c')]['id']},'transaction':_0x1d74e5});});})[_0xe6b1('0x2a')](function(){_0x1cec7e[_0xe6b1('0x70')](function(_0x1e52fc){socket[_0xe6b1('0x71')](_0xe6b1('0x72'),{'UserId':_0x1e52fc['id'],'SmsQueueId':_0x3c88b0['id']});});});});});}})[_0xe6b1('0x2a')](respondWithStatusCode(_0x4649bd,null))[_0xe6b1('0x4f')](handleError(_0x4649bd,null));};exports[_0xe6b1('0x73')]=function(_0x77d1ac,_0x336fc4,_0x147752){return db[_0xe6b1('0x68')][_0xe6b1('0x49')]({'where':{'id':_0x77d1ac['query'][_0xe6b1('0x74')]},'attributes':['id'],'include':[{'model':db[_0xe6b1('0x5f')],'as':_0xe6b1('0x6c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x336fc4,null))[_0xe6b1('0x2a')](function(_0x12b583){var _0x2d764b=_[_0xe6b1('0x34')](_0x12b583,'id');var _0x7f6f96=[];var _0x421527=[];var _0x3e82f5=squel[_0xe6b1('0x75')]();_0x3e82f5[_0xe6b1('0x76')](_0xe6b1('0x77'))['from'](_0xe6b1('0x78'),'tq')[_0xe6b1('0x79')](_0xe6b1('0x7a'),'ut',_0xe6b1('0x7b'))[_0xe6b1('0x42')](_0xe6b1('0x7c'),_0x77d1ac[_0xe6b1('0x4c')]['id']);for(var _0x5b196e=0x0;_0x5b196e<_0x12b583['length'];_0x5b196e+=0x1){let _0x14973c=_0x12b583[_0x5b196e];for(var _0x5144c5=0x0;_0x5144c5<_0x14973c[_0xe6b1('0x6c')][_0xe6b1('0x3e')];_0x5144c5+=0x1){let _0x29ac82=_0x14973c[_0xe6b1('0x6c')][_0x5144c5];var _0x4158e2=_0x3e82f5[_0xe6b1('0x7d')]();_0x4158e2[_0xe6b1('0x42')]('ut.UserId\x20=\x20?',_0x29ac82['id']);_0x421527['push'](db['sequelize'][_0xe6b1('0x39')](_0x4158e2[_0xe6b1('0x7e')](),{'type':db[_0xe6b1('0x6d')][_0xe6b1('0x7f')][_0xe6b1('0x80')]})[_0xe6b1('0x2a')](function(_0x31291d){if(_0x31291d['length']===0x1){return _0x29ac82['id'];}else{var _0x198c3c=_[_0xe6b1('0x81')](_['map'](_0x31291d,_0xe6b1('0x82')),function(_0xf8165f){return _['includes'](_0x2d764b,_0xf8165f);});if(_0x198c3c){return _0x29ac82['id'];}}}));}}return BPromise[_0xe6b1('0x83')](_0x421527)[_0xe6b1('0x2a')](function(_0x48bef5){_0x7f6f96=_(_0x7f6f96)[_0xe6b1('0x84')](_0x48bef5)[_0xe6b1('0x85')]()[_0xe6b1('0x86')]();return db[_0xe6b1('0x35')][_0xe6b1('0x55')]({'where':{'id':_0x77d1ac[_0xe6b1('0x4c')]['id']}})['then'](function(_0xf7a8b5){return db['sequelize'][_0xe6b1('0x6e')](function(_0x5530be){return _0xf7a8b5[_0xe6b1('0x73')](_0x77d1ac[_0xe6b1('0x39')][_0xe6b1('0x74')],{'transaction':_0x5530be})[_0xe6b1('0x2a')](function(){if(!_[_0xe6b1('0x87')](_0x7f6f96)){return _0xf7a8b5['removeAgents'](_0x7f6f96,{'transaction':_0x5530be});}})['then'](function(){_0x7f6f96[_0xe6b1('0x70')](function(_0x44b8ad){socket[_0xe6b1('0x71')](_0xe6b1('0x88'),{'UserId':_0x44b8ad,'SmsQueueId':_0xf7a8b5['id']});});});});});});})[_0xe6b1('0x2a')](respondWithStatusCode(_0x336fc4,null))['catch'](handleError(_0x336fc4,null));};exports[_0xe6b1('0x89')]=function(_0x3d8c0d,_0x22cc08,_0x139a98){return db[_0xe6b1('0x35')][_0xe6b1('0x55')]({'where':{'id':_0x3d8c0d[_0xe6b1('0x4c')]['id']}})[_0xe6b1('0x2a')](handleEntityNotFound(_0x22cc08,null))[_0xe6b1('0x2a')](function(_0x27f166){if(_0x27f166){return _0x27f166[_0xe6b1('0x89')](_0x3d8c0d[_0xe6b1('0x59')][_0xe6b1('0x74')],_[_0xe6b1('0x8a')](_0x3d8c0d[_0xe6b1('0x59')],[_0xe6b1('0x74'),'id'])||{})['spread'](function(_0x30dd76){for(var _0x2d84fa=0x0;_0x2d84fa<_0x3d8c0d['body'][_0xe6b1('0x74')]['length'];_0x2d84fa+=0x1){socket[_0xe6b1('0x71')]('userSmsQueue:save',{'UserId':Number(_0x3d8c0d['body'][_0xe6b1('0x74')][_0x2d84fa]),'SmsQueueId':Number(_0x3d8c0d['params']['id'])});}return _0x30dd76;});}})[_0xe6b1('0x2a')](respondWithResult(_0x22cc08,null))['catch'](handleError(_0x22cc08,null));};exports[_0xe6b1('0x8b')]=function(_0x5c3dcf,_0x4f171c,_0x39c207){return db[_0xe6b1('0x35')][_0xe6b1('0x55')]({'where':{'id':_0x5c3dcf['params']['id']}})[_0xe6b1('0x2a')](handleEntityNotFound(_0x4f171c,null))[_0xe6b1('0x2a')](function(_0x3197e3){if(_0x3197e3){return _0x3197e3[_0xe6b1('0x8b')](_0x5c3dcf[_0xe6b1('0x39')][_0xe6b1('0x74')])[_0xe6b1('0x2a')](function(){if(_[_0xe6b1('0x8c')](_0x5c3dcf[_0xe6b1('0x39')][_0xe6b1('0x74')])){for(var _0x2ac8ee=0x0;_0x2ac8ee<_0x5c3dcf[_0xe6b1('0x39')][_0xe6b1('0x74')][_0xe6b1('0x3e')];_0x2ac8ee+=0x1){socket[_0xe6b1('0x71')](_0xe6b1('0x88'),{'UserId':Number(_0x5c3dcf[_0xe6b1('0x39')][_0xe6b1('0x74')][_0x2ac8ee]),'SmsQueueId':Number(_0x5c3dcf['params']['id'])});}}else{socket[_0xe6b1('0x71')](_0xe6b1('0x88'),{'UserId':Number(_0x5c3dcf[_0xe6b1('0x39')][_0xe6b1('0x74')]),'SmsQueueId':Number(_0x5c3dcf[_0xe6b1('0x4c')]['id'])});}});}})[_0xe6b1('0x2a')](respondWithStatusCode(_0x4f171c,null))[_0xe6b1('0x4f')](handleError(_0x4f171c,null));};exports[_0xe6b1('0x8d')]=function(_0x547072,_0x2feed9,_0x477d1d){var _0x52d486={};var _0x2f019b={};var _0x13385e;var _0x44c112;return db[_0xe6b1('0x35')][_0xe6b1('0x5c')]({'where':{'id':_0x547072[_0xe6b1('0x4c')]['id']}})[_0xe6b1('0x2a')](handleEntityNotFound(_0x2feed9,null))['then'](function(_0x321101){if(_0x321101){_0x13385e=_0x321101;_0x2f019b['model']=_['keys'](db[_0xe6b1('0x5f')][_0xe6b1('0x36')]);_0x2f019b['query']=_[_0xe6b1('0x4d')](_0x547072[_0xe6b1('0x39')]);_0x2f019b[_0xe6b1('0x3a')]=_[_0xe6b1('0x3c')](_0x2f019b[_0xe6b1('0x38')],_0x2f019b[_0xe6b1('0x39')]);_0x52d486[_0xe6b1('0x3b')]=_[_0xe6b1('0x3c')](_0x2f019b[_0xe6b1('0x38')],qs['fields'](_0x547072[_0xe6b1('0x39')][_0xe6b1('0x3d')]));_0x52d486[_0xe6b1('0x3b')]=_0x52d486[_0xe6b1('0x3b')]['length']?_0x52d486[_0xe6b1('0x3b')]:_0x2f019b[_0xe6b1('0x38')];_0x52d486['order']=qs['sort'](_0x547072[_0xe6b1('0x39')][_0xe6b1('0x41')]);_0x52d486['where']=qs[_0xe6b1('0x3a')](_[_0xe6b1('0x43')](_0x547072[_0xe6b1('0x39')],_0x2f019b[_0xe6b1('0x3a')]));if(_0x547072[_0xe6b1('0x39')][_0xe6b1('0x46')]){_0x52d486[_0xe6b1('0x42')]=_[_0xe6b1('0x44')](_0x52d486[_0xe6b1('0x42')],{'$or':_[_0xe6b1('0x34')](_0x52d486[_0xe6b1('0x3b')],function(_0x39b9e7){var _0x5032a2={};_0x5032a2[_0x39b9e7]={'$like':'%'+_0x547072['query'][_0xe6b1('0x46')]+'%'};return _0x5032a2;})});}_0x52d486=_[_0xe6b1('0x44')]({},_0x52d486,_0x547072[_0xe6b1('0x4e')]);return _0x13385e[_0xe6b1('0x8d')](_0x52d486);}})[_0xe6b1('0x2a')](function(_0x3ef627){if(_0x3ef627){_0x44c112=_0x3ef627[_0xe6b1('0x3e')];if(!_0x547072[_0xe6b1('0x39')][_0xe6b1('0x8e')](_0xe6b1('0x3f'))){_0x52d486['limit']=qs[_0xe6b1('0x22')](_0x547072[_0xe6b1('0x39')][_0xe6b1('0x22')]);_0x52d486[_0xe6b1('0x20')]=qs[_0xe6b1('0x20')](_0x547072[_0xe6b1('0x39')][_0xe6b1('0x20')]);}return _0x13385e[_0xe6b1('0x8d')](_0x52d486);}})[_0xe6b1('0x2a')](function(_0x47e798){if(_0x47e798){return _0x47e798?{'count':_0x44c112,'rows':_0x47e798}:null;}})[_0xe6b1('0x2a')](respondWithResult(_0x2feed9,null))[_0xe6b1('0x4f')](handleError(_0x2feed9,null));}; \ No newline at end of file +var _0xfd4e=['includes','union','value','transaction','removeAgents','addAgents','isArray','userSmsQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsQueue.socket','sendStatus','end','status','json','offset','undefined','limit','Content-Range','reject','save','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','send','map','SmsQueue','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','findAll','rows','show','params','length','include','find','catch','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','SmsQueueId','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','hasOwnProperty','nolimit','addTeams','Agents','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','ids','field','tq.TeamId','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','push','toString','SELECT','every','TeamId'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfd4e,0x1b0));var _0xefd4=function(_0x8cdf49,_0x1550a2){_0x8cdf49=_0x8cdf49-0x0;var _0x5ae23f=_0xfd4e[_0x8cdf49];return _0x5ae23f;};'use strict';var emlformat=require(_0xefd4('0x0'));var rimraf=require(_0xefd4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xefd4('0x2'));var rp=require(_0xefd4('0x3'));var moment=require(_0xefd4('0x4'));var BPromise=require(_0xefd4('0x5'));var Mustache=require(_0xefd4('0x6'));var util=require(_0xefd4('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xefd4('0x8'));var ejs=require(_0xefd4('0x9'));var fs=require('fs');var fs_extra=require(_0xefd4('0xa'));var _=require(_0xefd4('0xb'));var squel=require(_0xefd4('0xc'));var crypto=require(_0xefd4('0xd'));var jsforce=require(_0xefd4('0xe'));var deskjs=require(_0xefd4('0xf'));var toCsv=require('to-csv');var querystring=require(_0xefd4('0x10'));var Papa=require(_0xefd4('0x11'));var Redis=require('ioredis');var authService=require(_0xefd4('0x12'));var qs=require(_0xefd4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xefd4('0x14'))(_0xefd4('0x15'));var utils=require(_0xefd4('0x16'));var config=require(_0xefd4('0x17'));var licenseUtil=require(_0xefd4('0x18'));var db=require(_0xefd4('0x19'))['db'];config[_0xefd4('0x1a')]=_[_0xefd4('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xefd4('0x1c'))(new Redis(config[_0xefd4('0x1a')]));require(_0xefd4('0x1d'))['register'](socket);function respondWithStatusCode(_0x1801e8,_0x3d5487){_0x3d5487=_0x3d5487||0xcc;return function(_0x704e3b){if(_0x704e3b){return _0x1801e8[_0xefd4('0x1e')](_0x3d5487);}return _0x1801e8['status'](_0x3d5487)[_0xefd4('0x1f')]();};}function respondWithResult(_0x594717,_0x2045ce){_0x2045ce=_0x2045ce||0xc8;return function(_0xf6300){if(_0xf6300){return _0x594717[_0xefd4('0x20')](_0x2045ce)[_0xefd4('0x21')](_0xf6300);}};}function respondWithFilteredResult(_0x1a7732,_0x4db021){return function(_0x2cb0df){if(_0x2cb0df){var _0x3057c0=typeof _0x4db021[_0xefd4('0x22')]===_0xefd4('0x23')&&typeof _0x4db021[_0xefd4('0x24')]==='undefined';var _0x4c97e6=_0x2cb0df['count'];var _0x4fb269=_0x3057c0?0x0:_0x4db021[_0xefd4('0x22')];var _0x58f56a=_0x3057c0?_0x2cb0df['count']:_0x4db021[_0xefd4('0x22')]+_0x4db021[_0xefd4('0x24')];var _0x5054ed;if(_0x58f56a>=_0x4c97e6){_0x58f56a=_0x4c97e6;_0x5054ed=0xc8;}else{_0x5054ed=0xce;}_0x1a7732[_0xefd4('0x20')](_0x5054ed);return _0x1a7732['set'](_0xefd4('0x25'),_0x4fb269+'-'+_0x58f56a+'/'+_0x4c97e6)[_0xefd4('0x21')](_0x2cb0df);}return null;};}function patchUpdates(_0x2687f5){return function(_0x13956c){try{jsonpatch['apply'](_0x13956c,_0x2687f5,!![]);}catch(_0x12689a){return BPromise[_0xefd4('0x26')](_0x12689a);}return _0x13956c[_0xefd4('0x27')]();};}function saveUpdates(_0x30a1bd,_0x6abbd2){return function(_0x1c4105){if(_0x1c4105){return _0x1c4105[_0xefd4('0x28')](_0x30a1bd)[_0xefd4('0x29')](function(_0x39c28f){return _0x39c28f;});}return null;};}function removeEntity(_0x1a59d9,_0x50303f){return function(_0x696d04){if(_0x696d04){return _0x696d04[_0xefd4('0x2a')]()['then'](function(){var _0x5bf83c=_0x696d04[_0xefd4('0x2b')]({'plain':!![]});var _0x477eb6=_0xefd4('0x2c');return db[_0xefd4('0x2d')][_0xefd4('0x2a')]({'where':{'type':_0x477eb6,'resourceId':_0x5bf83c['id']}})[_0xefd4('0x29')](function(){return _0x696d04;});})[_0xefd4('0x29')](function(){_0x1a59d9['status'](0xcc)[_0xefd4('0x1f')]();});}};}function handleEntityNotFound(_0x4eb8de,_0xe8ff2e){return function(_0x241dbe){if(!_0x241dbe){_0x4eb8de[_0xefd4('0x1e')](0x194);}return _0x241dbe;};}function handleError(_0x31c482,_0x2bae91){_0x2bae91=_0x2bae91||0x1f4;return function(_0x2c0a40){logger[_0xefd4('0x2e')](_0x2c0a40[_0xefd4('0x2f')]);if(_0x2c0a40[_0xefd4('0x30')]){delete _0x2c0a40[_0xefd4('0x30')];}_0x31c482[_0xefd4('0x20')](_0x2bae91)[_0xefd4('0x31')](_0x2c0a40);};}exports['index']=function(_0x4fbf72,_0x3f89cc){var _0x6aab7e={},_0x2cd58d={},_0x5c0b5b={'count':0x0,'rows':[]};var _0x412ede=_[_0xefd4('0x32')](db[_0xefd4('0x33')][_0xefd4('0x34')],function(_0x4716e0){return{'name':_0x4716e0[_0xefd4('0x35')],'type':_0x4716e0[_0xefd4('0x36')][_0xefd4('0x37')]};});_0x2cd58d[_0xefd4('0x38')]=_[_0xefd4('0x32')](_0x412ede,_0xefd4('0x30'));_0x2cd58d['query']=_[_0xefd4('0x39')](_0x4fbf72[_0xefd4('0x3a')]);_0x2cd58d[_0xefd4('0x3b')]=_[_0xefd4('0x3c')](_0x2cd58d[_0xefd4('0x38')],_0x2cd58d[_0xefd4('0x3a')]);_0x6aab7e[_0xefd4('0x3d')]=_[_0xefd4('0x3c')](_0x2cd58d[_0xefd4('0x38')],qs[_0xefd4('0x3e')](_0x4fbf72[_0xefd4('0x3a')][_0xefd4('0x3e')]));_0x6aab7e[_0xefd4('0x3d')]=_0x6aab7e[_0xefd4('0x3d')]['length']?_0x6aab7e['attributes']:_0x2cd58d[_0xefd4('0x38')];if(!_0x4fbf72[_0xefd4('0x3a')]['hasOwnProperty']('nolimit')){_0x6aab7e['limit']=qs[_0xefd4('0x24')](_0x4fbf72[_0xefd4('0x3a')][_0xefd4('0x24')]);_0x6aab7e[_0xefd4('0x22')]=qs['offset'](_0x4fbf72[_0xefd4('0x3a')][_0xefd4('0x22')]);}_0x6aab7e[_0xefd4('0x3f')]=qs[_0xefd4('0x40')](_0x4fbf72[_0xefd4('0x3a')][_0xefd4('0x40')]);_0x6aab7e[_0xefd4('0x41')]=qs[_0xefd4('0x3b')](_[_0xefd4('0x42')](_0x4fbf72[_0xefd4('0x3a')],_0x2cd58d[_0xefd4('0x3b')]),_0x412ede);if(_0x4fbf72[_0xefd4('0x3a')]['filter']){_0x6aab7e[_0xefd4('0x41')]=_[_0xefd4('0x43')](_0x6aab7e[_0xefd4('0x41')],{'$or':_[_0xefd4('0x32')](_0x412ede,function(_0x3ca83c){if(_0x3ca83c[_0xefd4('0x36')]!==_0xefd4('0x44')){var _0x1a9cde={};_0x1a9cde[_0x3ca83c['name']]={'$like':'%'+_0x4fbf72[_0xefd4('0x3a')][_0xefd4('0x45')]+'%'};return _0x1a9cde;}})});}_0x6aab7e=_[_0xefd4('0x43')]({},_0x6aab7e,_0x4fbf72[_0xefd4('0x46')]);var _0x22a3e4={'where':_0x6aab7e[_0xefd4('0x41')]};return db['SmsQueue'][_0xefd4('0x47')](_0x22a3e4)[_0xefd4('0x29')](function(_0x352f8d){_0x5c0b5b[_0xefd4('0x47')]=_0x352f8d;if(_0x4fbf72[_0xefd4('0x3a')][_0xefd4('0x48')]){_0x6aab7e['include']=[{'all':!![]}];}return db['SmsQueue'][_0xefd4('0x49')](_0x6aab7e);})['then'](function(_0x2c9592){_0x5c0b5b[_0xefd4('0x4a')]=_0x2c9592;return _0x5c0b5b;})[_0xefd4('0x29')](respondWithFilteredResult(_0x3f89cc,_0x6aab7e))['catch'](handleError(_0x3f89cc,null));};exports[_0xefd4('0x4b')]=function(_0x5896e5,_0x27930c){var _0x4e28e0={'raw':!![],'where':{'id':_0x5896e5[_0xefd4('0x4c')]['id']}},_0x3101e6={};_0x3101e6[_0xefd4('0x38')]=_[_0xefd4('0x39')](db[_0xefd4('0x33')][_0xefd4('0x34')]);_0x3101e6[_0xefd4('0x3a')]=_['keys'](_0x5896e5[_0xefd4('0x3a')]);_0x3101e6[_0xefd4('0x3b')]=_[_0xefd4('0x3c')](_0x3101e6[_0xefd4('0x38')],_0x3101e6['query']);_0x4e28e0[_0xefd4('0x3d')]=_['intersection'](_0x3101e6['model'],qs[_0xefd4('0x3e')](_0x5896e5[_0xefd4('0x3a')][_0xefd4('0x3e')]));_0x4e28e0[_0xefd4('0x3d')]=_0x4e28e0[_0xefd4('0x3d')][_0xefd4('0x4d')]?_0x4e28e0[_0xefd4('0x3d')]:_0x3101e6[_0xefd4('0x38')];if(_0x5896e5[_0xefd4('0x3a')][_0xefd4('0x48')]){_0x4e28e0[_0xefd4('0x4e')]=[{'all':!![]}];}_0x4e28e0=_['merge']({},_0x4e28e0,_0x5896e5[_0xefd4('0x46')]);return db[_0xefd4('0x33')][_0xefd4('0x4f')](_0x4e28e0)['then'](handleEntityNotFound(_0x27930c,null))[_0xefd4('0x29')](respondWithResult(_0x27930c,null))[_0xefd4('0x50')](handleError(_0x27930c,null));};exports[_0xefd4('0x51')]=function(_0x2074a8,_0x4fc878){return db[_0xefd4('0x33')][_0xefd4('0x51')](_0x2074a8[_0xefd4('0x52')],{})[_0xefd4('0x29')](function(_0x2297f4){var _0x3b1423=_0x2074a8[_0xefd4('0x53')][_0xefd4('0x2b')]({'plain':!![]});if(!_0x3b1423)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b1423[_0xefd4('0x54')]===_0xefd4('0x53')){var _0x19fb03=_0x2297f4[_0xefd4('0x2b')]({'plain':!![]});var _0x2c5051=_0xefd4('0x2c');return db[_0xefd4('0x55')][_0xefd4('0x4f')]({'where':{'name':_0x2c5051,'userProfileId':_0x3b1423['userProfileId']},'raw':!![]})[_0xefd4('0x29')](function(_0x1f34a0){if(_0x1f34a0&&_0x1f34a0[_0xefd4('0x56')]===0x0){return db[_0xefd4('0x2d')][_0xefd4('0x51')]({'name':_0x19fb03['name'],'resourceId':_0x19fb03['id'],'type':_0x1f34a0['name'],'sectionId':_0x1f34a0['id']},{})['then'](function(){return _0x2297f4;});}else{return _0x2297f4;}})['catch'](function(_0x11b7c9){logger[_0xefd4('0x2e')](_0xefd4('0x57'),_0x11b7c9);throw _0x11b7c9;});}return _0x2297f4;})[_0xefd4('0x29')](respondWithResult(_0x4fc878,0xc9))[_0xefd4('0x50')](handleError(_0x4fc878,null));};exports['update']=function(_0x3d1fe5,_0x5defda){if(_0x3d1fe5[_0xefd4('0x52')]['id']){delete _0x3d1fe5['body']['id'];}return db[_0xefd4('0x33')][_0xefd4('0x4f')]({'where':{'id':_0x3d1fe5[_0xefd4('0x4c')]['id']}})[_0xefd4('0x29')](handleEntityNotFound(_0x5defda,null))[_0xefd4('0x29')](saveUpdates(_0x3d1fe5[_0xefd4('0x52')],null))['then'](respondWithResult(_0x5defda,null))[_0xefd4('0x50')](handleError(_0x5defda,null));};exports[_0xefd4('0x2a')]=function(_0x3334a3,_0x285f0d){return db[_0xefd4('0x33')]['find']({'where':{'id':_0x3334a3['params']['id']}})[_0xefd4('0x29')](handleEntityNotFound(_0x285f0d,null))[_0xefd4('0x29')](removeEntity(_0x285f0d,null))[_0xefd4('0x50')](handleError(_0x285f0d,null));};exports['describe']=function(_0x575026,_0x46fa3a){return db[_0xefd4('0x33')][_0xefd4('0x58')]()['then'](respondWithResult(_0x46fa3a,null))[_0xefd4('0x50')](handleError(_0x46fa3a,null));};exports[_0xefd4('0x59')]=function(_0x21cb5e,_0x523b8c,_0x3e0e66){var _0x58cccb={'raw':!![],'where':{}},_0x62cae4={},_0x11d68b;return db[_0xefd4('0x33')]['findOne']({'where':{'id':_0x21cb5e[_0xefd4('0x4c')]['id']}})[_0xefd4('0x29')](handleEntityNotFound(_0x523b8c,null))[_0xefd4('0x29')](function(_0x14e31d){if(_0x14e31d){_0x11d68b=_0x14e31d[_0xefd4('0x2b')]({'plain':!![]});_0x62cae4['model']=_[_0xefd4('0x39')](db['UserSmsQueue'][_0xefd4('0x34')]);_0x62cae4[_0xefd4('0x3a')]=_[_0xefd4('0x39')](_0x21cb5e[_0xefd4('0x3a')]);_0x62cae4[_0xefd4('0x3b')]=_['intersection'](_0x62cae4[_0xefd4('0x38')],_0x62cae4['query']);_0x58cccb[_0xefd4('0x3d')]=_[_0xefd4('0x3c')](_0x62cae4[_0xefd4('0x38')],qs[_0xefd4('0x3e')](_0x21cb5e[_0xefd4('0x3a')]['fields']));_0x58cccb[_0xefd4('0x3d')]=_0x58cccb[_0xefd4('0x3d')][_0xefd4('0x4d')]?_0x58cccb[_0xefd4('0x3d')]:_0x62cae4[_0xefd4('0x38')];if(!_0x21cb5e[_0xefd4('0x3a')]['hasOwnProperty']('nolimit')){_0x58cccb['limit']=qs['limit'](_0x21cb5e['query'][_0xefd4('0x24')]);_0x58cccb['offset']=qs['offset'](_0x21cb5e[_0xefd4('0x3a')][_0xefd4('0x22')]);}_0x58cccb['order']=qs[_0xefd4('0x40')](_0x21cb5e[_0xefd4('0x3a')]['sort']);_0x58cccb[_0xefd4('0x41')]=qs[_0xefd4('0x3b')](_[_0xefd4('0x42')](_0x21cb5e[_0xefd4('0x3a')],_0x62cae4['filters']));_0x58cccb[_0xefd4('0x41')][_0xefd4('0x5a')]=_0x14e31d['id'];if(_0x21cb5e[_0xefd4('0x3a')][_0xefd4('0x45')]){_0x58cccb['where']=_[_0xefd4('0x43')](_0x58cccb[_0xefd4('0x41')],{'$or':_['map'](_0x58cccb[_0xefd4('0x3d')],function(_0x2254ec){var _0x5ec7a2={};_0x5ec7a2[_0x2254ec]={'$like':'%'+_0x21cb5e[_0xefd4('0x3a')]['filter']+'%'};return _0x5ec7a2;})});}_0x58cccb=_[_0xefd4('0x43')]({},_0x58cccb,_0x21cb5e[_0xefd4('0x46')]);return db[_0xefd4('0x5b')]['findAll'](_0x58cccb);}})[_0xefd4('0x29')](function(_0x2fbbb9){if(_0x2fbbb9){return db[_0xefd4('0x5c')][_0xefd4('0x5d')]({'where':{'id':_[_0xefd4('0x32')](_0x2fbbb9,_0xefd4('0x5e')),'role':_0xefd4('0x5f')},'attributes':['id',_0xefd4('0x30'),_0xefd4('0x60'),_0xefd4('0x61'),_0xefd4('0x62')]});}})['then'](function(_0x558428){if(_0x558428){return{'count':_0x558428[_0xefd4('0x47')],'rows':_['map'](_0x558428['rows'],function(_0x557245){return{'membername':_0x557245[_0xefd4('0x30')],'UserId':_0x557245['id'],'queue_name':_0x11d68b[_0xefd4('0x30')],'SmsQueueId':_0x11d68b['id'],'interface':util[_0xefd4('0x63')](_0xefd4('0x64'),_0xefd4('0x65'),_0x557245['name']),'penalty':0x0,'paused':_0x557245[_0xefd4('0x60')],'createdAt':_0x557245[_0xefd4('0x62')],'updatedAt':_0x557245[_0xefd4('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xefd4('0x29')](respondWithFilteredResult(_0x523b8c,_0x58cccb))['catch'](handleError(_0x523b8c,null));};exports[_0xefd4('0x66')]=function(_0x46b7fc,_0x224002,_0x2ab70d){var _0x597ec5={};var _0x232e4c={};var _0x1f6ea6;var _0x2454bf;return db[_0xefd4('0x33')][_0xefd4('0x67')]({'where':{'id':_0x46b7fc[_0xefd4('0x4c')]['id']}})[_0xefd4('0x29')](handleEntityNotFound(_0x224002,null))[_0xefd4('0x29')](function(_0x251580){if(_0x251580){_0x1f6ea6=_0x251580;_0x232e4c[_0xefd4('0x38')]=_[_0xefd4('0x39')](db[_0xefd4('0x68')][_0xefd4('0x34')]);_0x232e4c['query']=_[_0xefd4('0x39')](_0x46b7fc['query']);_0x232e4c[_0xefd4('0x3b')]=_[_0xefd4('0x3c')](_0x232e4c['model'],_0x232e4c[_0xefd4('0x3a')]);_0x597ec5[_0xefd4('0x3d')]=_[_0xefd4('0x3c')](_0x232e4c['model'],qs['fields'](_0x46b7fc[_0xefd4('0x3a')]['fields']));_0x597ec5[_0xefd4('0x3d')]=_0x597ec5[_0xefd4('0x3d')][_0xefd4('0x4d')]?_0x597ec5[_0xefd4('0x3d')]:_0x232e4c[_0xefd4('0x38')];_0x597ec5[_0xefd4('0x3f')]=qs[_0xefd4('0x40')](_0x46b7fc[_0xefd4('0x3a')][_0xefd4('0x40')]);_0x597ec5[_0xefd4('0x41')]=qs[_0xefd4('0x3b')](_['pick'](_0x46b7fc[_0xefd4('0x3a')],_0x232e4c[_0xefd4('0x3b')]));if(_0x46b7fc[_0xefd4('0x3a')]['filter']){_0x597ec5[_0xefd4('0x41')]=_[_0xefd4('0x43')](_0x597ec5['where'],{'$or':_[_0xefd4('0x32')](_0x597ec5['attributes'],function(_0x24a7fc){var _0x3dd874={};_0x3dd874[_0x24a7fc]={'$like':'%'+_0x46b7fc[_0xefd4('0x3a')][_0xefd4('0x45')]+'%'};return _0x3dd874;})});}_0x597ec5=_[_0xefd4('0x43')]({},_0x597ec5,_0x46b7fc['options']);return _0x1f6ea6[_0xefd4('0x66')](_0x597ec5);}})[_0xefd4('0x29')](function(_0x85a478){if(_0x85a478){_0x2454bf=_0x85a478[_0xefd4('0x4d')];if(!_0x46b7fc[_0xefd4('0x3a')][_0xefd4('0x69')](_0xefd4('0x6a'))){_0x597ec5[_0xefd4('0x24')]=qs[_0xefd4('0x24')](_0x46b7fc['query']['limit']);_0x597ec5[_0xefd4('0x22')]=qs[_0xefd4('0x22')](_0x46b7fc['query']['offset']);}return _0x1f6ea6[_0xefd4('0x66')](_0x597ec5);}})['then'](function(_0x2a1037){if(_0x2a1037){return _0x2a1037?{'count':_0x2454bf,'rows':_0x2a1037}:null;}})['then'](respondWithResult(_0x224002,null))[_0xefd4('0x50')](handleError(_0x224002,null));};exports[_0xefd4('0x6b')]=function(_0x27b24a,_0x20ccee,_0x31188c){var _0x3cbc3a=_0x27b24a[_0xefd4('0x52')]['ids'];return db['Team']['findAll']({'where':{'id':_0x3cbc3a},'attributes':['id'],'include':[{'model':db[_0xefd4('0x5c')],'as':_0xefd4('0x6c'),'attributes':['id',_0xefd4('0x30'),'online',_0xefd4('0x6d'),_0xefd4('0x6e')],'raw':!![]}]})[_0xefd4('0x29')](function(_0x1da97a){if(_0x1da97a){var _0x119ba0=_[_0xefd4('0x6f')](_0x1da97a,function(_0x229e0f){var _0x1fb1d6=_0x229e0f[_0xefd4('0x2b')]({'plain':!![]});return _0x1fb1d6['Agents'];});return db[_0xefd4('0x33')][_0xefd4('0x4f')]({'where':{'id':_0x27b24a['params']['id']}})['then'](function(_0x46ad80){return db[_0xefd4('0x70')]['transaction'](function(_0x5a518b){return _0x46ad80['addTeams'](_0x3cbc3a,{'transaction':_0x5a518b})[_0xefd4('0x29')](function(){return BPromise[_0xefd4('0x71')](_0x119ba0,function(_0x58646b){return db[_0xefd4('0x5b')][_0xefd4('0x72')]({'where':{'UserId':_0x58646b['id'],'SmsQueueId':_0x27b24a[_0xefd4('0x4c')]['id']},'transaction':_0x5a518b});});})[_0xefd4('0x29')](function(){_0x119ba0[_0xefd4('0x73')](function(_0x4e83f5){socket[_0xefd4('0x74')](_0xefd4('0x75'),{'UserId':_0x4e83f5['id'],'SmsQueueId':_0x46ad80['id']});});});});});}})[_0xefd4('0x29')](respondWithStatusCode(_0x20ccee,null))[_0xefd4('0x50')](handleError(_0x20ccee,null));};exports[_0xefd4('0x76')]=function(_0x3c506c,_0x532f87,_0x5042aa){return db['Team']['findAll']({'where':{'id':_0x3c506c[_0xefd4('0x3a')][_0xefd4('0x77')]},'attributes':['id'],'include':[{'model':db[_0xefd4('0x5c')],'as':_0xefd4('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xefd4('0x29')](handleEntityNotFound(_0x532f87,null))[_0xefd4('0x29')](function(_0x9cd732){var _0x52f2f8=_[_0xefd4('0x32')](_0x9cd732,'id');var _0x587d22=[];var _0x47f1cb=[];var _0x4e19e7=squel['select']();_0x4e19e7[_0xefd4('0x78')](_0xefd4('0x79'))['from'](_0xefd4('0x7a'),'tq')['join'](_0xefd4('0x7b'),'ut',_0xefd4('0x7c'))[_0xefd4('0x41')](_0xefd4('0x7d'),_0x3c506c[_0xefd4('0x4c')]['id']);for(var _0x395ddb=0x0;_0x395ddb<_0x9cd732[_0xefd4('0x4d')];_0x395ddb+=0x1){let _0x51ce31=_0x9cd732[_0x395ddb];for(var _0x47be11=0x0;_0x47be11<_0x51ce31[_0xefd4('0x6c')][_0xefd4('0x4d')];_0x47be11+=0x1){let _0x16b304=_0x51ce31[_0xefd4('0x6c')][_0x47be11];var _0x338b9b=_0x4e19e7[_0xefd4('0x7e')]();_0x338b9b['where']('ut.UserId\x20=\x20?',_0x16b304['id']);_0x47f1cb[_0xefd4('0x7f')](db[_0xefd4('0x70')][_0xefd4('0x3a')](_0x338b9b[_0xefd4('0x80')](),{'type':db[_0xefd4('0x70')]['QueryTypes'][_0xefd4('0x81')]})[_0xefd4('0x29')](function(_0x112583){if(_0x112583[_0xefd4('0x4d')]===0x1){return _0x16b304['id'];}else{var _0x170352=_[_0xefd4('0x82')](_[_0xefd4('0x32')](_0x112583,_0xefd4('0x83')),function(_0x39bc23){return _[_0xefd4('0x84')](_0x52f2f8,_0x39bc23);});if(_0x170352){return _0x16b304['id'];}}}));}}return BPromise['all'](_0x47f1cb)[_0xefd4('0x29')](function(_0x42ddba){_0x587d22=_(_0x587d22)[_0xefd4('0x85')](_0x42ddba)['compact']()[_0xefd4('0x86')]();return db[_0xefd4('0x33')][_0xefd4('0x4f')]({'where':{'id':_0x3c506c[_0xefd4('0x4c')]['id']}})[_0xefd4('0x29')](function(_0xa90c6a){return db[_0xefd4('0x70')][_0xefd4('0x87')](function(_0x499b63){return _0xa90c6a[_0xefd4('0x76')](_0x3c506c[_0xefd4('0x3a')][_0xefd4('0x77')],{'transaction':_0x499b63})[_0xefd4('0x29')](function(){if(!_['isEmpty'](_0x587d22)){return _0xa90c6a[_0xefd4('0x88')](_0x587d22,{'transaction':_0x499b63});}})[_0xefd4('0x29')](function(){_0x587d22[_0xefd4('0x73')](function(_0x4c499b){socket[_0xefd4('0x74')]('userSmsQueue:remove',{'UserId':_0x4c499b,'SmsQueueId':_0xa90c6a['id']});});});});});});})['then'](respondWithStatusCode(_0x532f87,null))[_0xefd4('0x50')](handleError(_0x532f87,null));};exports[_0xefd4('0x89')]=function(_0x449d47,_0x488a4f,_0x2a7472){return db[_0xefd4('0x33')][_0xefd4('0x4f')]({'where':{'id':_0x449d47[_0xefd4('0x4c')]['id']}})['then'](handleEntityNotFound(_0x488a4f,null))[_0xefd4('0x29')](function(_0x497c62){if(_0x497c62){return _0x497c62[_0xefd4('0x89')](_0x449d47[_0xefd4('0x52')]['ids'],_['omit'](_0x449d47[_0xefd4('0x52')],['ids','id'])||{})['spread'](function(_0x265cb9){for(var _0x20ca39=0x0;_0x20ca39<_0x449d47[_0xefd4('0x52')]['ids'][_0xefd4('0x4d')];_0x20ca39+=0x1){socket[_0xefd4('0x74')](_0xefd4('0x75'),{'UserId':Number(_0x449d47[_0xefd4('0x52')]['ids'][_0x20ca39]),'SmsQueueId':Number(_0x449d47[_0xefd4('0x4c')]['id'])});}return _0x265cb9;});}})['then'](respondWithResult(_0x488a4f,null))[_0xefd4('0x50')](handleError(_0x488a4f,null));};exports[_0xefd4('0x88')]=function(_0x3635e6,_0x44bd03,_0x33fe89){return db[_0xefd4('0x33')][_0xefd4('0x4f')]({'where':{'id':_0x3635e6[_0xefd4('0x4c')]['id']}})[_0xefd4('0x29')](handleEntityNotFound(_0x44bd03,null))[_0xefd4('0x29')](function(_0x3ac2d7){if(_0x3ac2d7){return _0x3ac2d7[_0xefd4('0x88')](_0x3635e6[_0xefd4('0x3a')]['ids'])['then'](function(){if(_[_0xefd4('0x8a')](_0x3635e6[_0xefd4('0x3a')][_0xefd4('0x77')])){for(var _0x79b783=0x0;_0x79b783<_0x3635e6[_0xefd4('0x3a')][_0xefd4('0x77')][_0xefd4('0x4d')];_0x79b783+=0x1){socket[_0xefd4('0x74')](_0xefd4('0x8b'),{'UserId':Number(_0x3635e6[_0xefd4('0x3a')]['ids'][_0x79b783]),'SmsQueueId':Number(_0x3635e6[_0xefd4('0x4c')]['id'])});}}else{socket[_0xefd4('0x74')](_0xefd4('0x8b'),{'UserId':Number(_0x3635e6[_0xefd4('0x3a')]['ids']),'SmsQueueId':Number(_0x3635e6['params']['id'])});}});}})[_0xefd4('0x29')](respondWithStatusCode(_0x44bd03,null))['catch'](handleError(_0x44bd03,null));};exports['getAgents']=function(_0x50dc7d,_0x4beb87,_0x3ec9b0){var _0x2b987b={};var _0x2ba570={};var _0xce247c;var _0x342e3c;return db[_0xefd4('0x33')][_0xefd4('0x67')]({'where':{'id':_0x50dc7d['params']['id']}})[_0xefd4('0x29')](handleEntityNotFound(_0x4beb87,null))['then'](function(_0x5de817){if(_0x5de817){_0xce247c=_0x5de817;_0x2ba570[_0xefd4('0x38')]=_[_0xefd4('0x39')](db['User'][_0xefd4('0x34')]);_0x2ba570[_0xefd4('0x3a')]=_[_0xefd4('0x39')](_0x50dc7d[_0xefd4('0x3a')]);_0x2ba570[_0xefd4('0x3b')]=_[_0xefd4('0x3c')](_0x2ba570[_0xefd4('0x38')],_0x2ba570[_0xefd4('0x3a')]);_0x2b987b[_0xefd4('0x3d')]=_['intersection'](_0x2ba570['model'],qs[_0xefd4('0x3e')](_0x50dc7d[_0xefd4('0x3a')][_0xefd4('0x3e')]));_0x2b987b['attributes']=_0x2b987b['attributes'][_0xefd4('0x4d')]?_0x2b987b[_0xefd4('0x3d')]:_0x2ba570[_0xefd4('0x38')];_0x2b987b[_0xefd4('0x3f')]=qs['sort'](_0x50dc7d[_0xefd4('0x3a')][_0xefd4('0x40')]);_0x2b987b[_0xefd4('0x41')]=qs[_0xefd4('0x3b')](_['pick'](_0x50dc7d['query'],_0x2ba570['filters']));if(_0x50dc7d[_0xefd4('0x3a')]['filter']){_0x2b987b[_0xefd4('0x41')]=_[_0xefd4('0x43')](_0x2b987b[_0xefd4('0x41')],{'$or':_[_0xefd4('0x32')](_0x2b987b[_0xefd4('0x3d')],function(_0x2b8512){var _0xd0e97={};_0xd0e97[_0x2b8512]={'$like':'%'+_0x50dc7d[_0xefd4('0x3a')]['filter']+'%'};return _0xd0e97;})});}_0x2b987b=_[_0xefd4('0x43')]({},_0x2b987b,_0x50dc7d[_0xefd4('0x46')]);return _0xce247c[_0xefd4('0x8c')](_0x2b987b);}})['then'](function(_0x39663c){if(_0x39663c){_0x342e3c=_0x39663c['length'];if(!_0x50dc7d['query'][_0xefd4('0x69')](_0xefd4('0x6a'))){_0x2b987b['limit']=qs[_0xefd4('0x24')](_0x50dc7d['query'][_0xefd4('0x24')]);_0x2b987b[_0xefd4('0x22')]=qs[_0xefd4('0x22')](_0x50dc7d[_0xefd4('0x3a')][_0xefd4('0x22')]);}return _0xce247c[_0xefd4('0x8c')](_0x2b987b);}})[_0xefd4('0x29')](function(_0x228d63){if(_0x228d63){return _0x228d63?{'count':_0x342e3c,'rows':_0x228d63}:null;}})[_0xefd4('0x29')](respondWithResult(_0x4beb87,null))[_0xefd4('0x50')](handleError(_0x4beb87,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index c11e575..7c997f8 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 _0x57f1=['exports','events','../../mysqldb','SmsQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x57f1,0x141));var _0x157f=function(_0x65f186,_0x5c6189){_0x65f186=_0x65f186-0x0;var _0x2f1122=_0x57f1[_0x65f186];return _0x2f1122;};'use strict';var EventEmitter=require(_0x157f('0x0'));var SmsQueue=require(_0x157f('0x1'))['db'][_0x157f('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x157f('0x3')](0x0);var events={'afterCreate':_0x157f('0x4'),'afterUpdate':_0x157f('0x5'),'afterDestroy':'remove'};function emitEvent(_0x57f35d){return function(_0x207a87,_0x2e39a5,_0x434746){SmsQueueEvents[_0x157f('0x6')](_0x57f35d+':'+_0x207a87['id'],_0x207a87);SmsQueueEvents[_0x157f('0x6')](_0x57f35d,_0x207a87);_0x434746(null);};}for(var e in events){if(events[_0x157f('0x7')](e)){var event=events[e];SmsQueue[_0x157f('0x8')](e,emitEvent(event));}}module[_0x157f('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0xd4db=['exports','events','../../mysqldb','SmsQueue','update','remove','emit','hook'];(function(_0x118162,_0xbf72be){var _0x58cefc=function(_0x2ec570){while(--_0x2ec570){_0x118162['push'](_0x118162['shift']());}};_0x58cefc(++_0xbf72be);}(_0xd4db,0x149));var _0xbd4d=function(_0x19461e,_0x4c961e){_0x19461e=_0x19461e-0x0;var _0x577907=_0xd4db[_0x19461e];return _0x577907;};'use strict';var EventEmitter=require(_0xbd4d('0x0'));var SmsQueue=require(_0xbd4d('0x1'))['db'][_0xbd4d('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xbd4d('0x3'),'afterDestroy':_0xbd4d('0x4')};function emitEvent(_0x89b6e8){return function(_0x2c94da,_0x2c4182,_0x4ce7a2){SmsQueueEvents['emit'](_0x89b6e8+':'+_0x2c94da['id'],_0x2c94da);SmsQueueEvents[_0xbd4d('0x5')](_0x89b6e8,_0x2c94da);_0x4ce7a2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xbd4d('0x6')](e,emitEvent(event));}}module[_0xbd4d('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 4c36d70..984c4d5 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 _0x5879=['../../config/environment','define','SmsQueue','sms_queues','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x1d9e73,_0xf601d5){var _0x3a9687=function(_0x5c020d){while(--_0x5c020d){_0x1d9e73['push'](_0x1d9e73['shift']());}};_0x3a9687(++_0xf601d5);}(_0x5879,0xca));var _0x9587=function(_0x2319a1,_0x211d4a){_0x2319a1=_0x2319a1-0x0;var _0x2baead=_0x5879[_0x2319a1];return _0x2baead;};'use strict';var _=require(_0x9587('0x0'));var util=require(_0x9587('0x1'));var logger=require('../../config/logger')(_0x9587('0x2'));var moment=require(_0x9587('0x3'));var BPromise=require('bluebird');var rp=require(_0x9587('0x4'));var fs=require('fs');var path=require(_0x9587('0x5'));var rimraf=require(_0x9587('0x6'));var config=require(_0x9587('0x7'));var attributes=require('./smsQueue.attributes');module['exports']=function(_0x6fc8a9,_0x381137){return _0x6fc8a9[_0x9587('0x8')](_0x9587('0x9'),attributes,{'tableName':_0x9587('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a0c=['exports','define','sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes'];(function(_0x55e3c0,_0x338418){var _0x119300=function(_0x215af2){while(--_0x215af2){_0x55e3c0['push'](_0x55e3c0['shift']());}};_0x119300(++_0x338418);}(_0x7a0c,0x1df));var _0xc7a0=function(_0x2f9780,_0x4a4f1b){_0x2f9780=_0x2f9780-0x0;var _0x51d13a=_0x7a0c[_0x2f9780];return _0x51d13a;};'use strict';var _=require(_0xc7a0('0x0'));var util=require(_0xc7a0('0x1'));var logger=require(_0xc7a0('0x2'))(_0xc7a0('0x3'));var moment=require(_0xc7a0('0x4'));var BPromise=require(_0xc7a0('0x5'));var rp=require(_0xc7a0('0x6'));var fs=require('fs');var path=require(_0xc7a0('0x7'));var rimraf=require(_0xc7a0('0x8'));var config=require(_0xc7a0('0x9'));var attributes=require(_0xc7a0('0xa'));module[_0xc7a0('0xb')]=function(_0x4303e2,_0xba80de){return _0x4303e2[_0xc7a0('0xc')]('SmsQueue',attributes,{'tableName':_0xc7a0('0xd'),'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 bc58195..7d0e647 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 _0xb7ad=['error','code','message','SmsQueue,\x20%s,\x20%s','request\x20sent','result','GetSmsQueue','SmsQueue','findAll','options','raw','attributes','limit','map','include','model','then','ShowSmsQueue','find','where','catch','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','register','info','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb7ad,0xa9));var _0xdb7a=function(_0x3fd8a1,_0x38e281){_0x3fd8a1=_0x3fd8a1-0x0;var _0xc9a56=_0xb7ad[_0x3fd8a1];return _0xc9a56;};'use strict';var _=require('lodash');var util=require(_0xdb7a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdb7a('0x1'));var db=require(_0xdb7a('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xdb7a('0x3'))(_0xdb7a('0x4'));var config=require(_0xdb7a('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xdb7a('0x6')][_0xdb7a('0x7')]({'port':0x232a});config[_0xdb7a('0x8')]=_[_0xdb7a('0x9')](config[_0xdb7a('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xdb7a('0xa'))(new Redis(config[_0xdb7a('0x8')]));require('./smsQueue.socket')[_0xdb7a('0xb')](socket);function respondWithRpcPromise(_0x55cfff,_0xb57a0c,_0x3d6ee3){return new BPromise(function(_0x13b039,_0x52b47b){return client['request'](_0x55cfff,_0x3d6ee3)['then'](function(_0x1fb806){logger[_0xdb7a('0xc')]('SmsQueue,\x20%s,\x20%s',_0xb57a0c,'request\x20sent');logger[_0xdb7a('0xd')](_0xdb7a('0xe'),_0xb57a0c,'request\x20sent',JSON[_0xdb7a('0xf')](_0x1fb806));if(_0x1fb806[_0xdb7a('0x10')]){if(_0x1fb806[_0xdb7a('0x10')][_0xdb7a('0x11')]===0x1f4){logger[_0xdb7a('0x10')]('SmsQueue,\x20%s,\x20%s',_0xb57a0c,_0x1fb806[_0xdb7a('0x10')]['message']);return _0x52b47b(_0x1fb806[_0xdb7a('0x10')][_0xdb7a('0x12')]);}logger[_0xdb7a('0x10')](_0xdb7a('0x13'),_0xb57a0c,_0x1fb806[_0xdb7a('0x10')][_0xdb7a('0x12')]);return _0x13b039(_0x1fb806[_0xdb7a('0x10')][_0xdb7a('0x12')]);}else{logger[_0xdb7a('0xc')](_0xdb7a('0x13'),_0xb57a0c,_0xdb7a('0x14'));_0x13b039(_0x1fb806[_0xdb7a('0x15')][_0xdb7a('0x12')]);}})['catch'](function(_0x1d8993){logger['error'](_0xdb7a('0x13'),_0xb57a0c,_0x1d8993);_0x52b47b(_0x1d8993);});});}exports[_0xdb7a('0x16')]=function(_0x20674b){var _0x3f90cc=this;return new Promise(function(_0x46ac0d,_0x49e9c7){return db[_0xdb7a('0x17')][_0xdb7a('0x18')]({'raw':_0x20674b[_0xdb7a('0x19')]?_0x20674b['options'][_0xdb7a('0x1a')]===undefined?!![]:![]:!![],'where':_0x20674b[_0xdb7a('0x19')]?_0x20674b['options']['where']||null:null,'attributes':_0x20674b[_0xdb7a('0x19')]?_0x20674b[_0xdb7a('0x19')][_0xdb7a('0x1b')]||null:null,'limit':_0x20674b[_0xdb7a('0x19')]?_0x20674b[_0xdb7a('0x19')][_0xdb7a('0x1c')]||null:null,'include':_0x20674b['options']?_0x20674b[_0xdb7a('0x19')]['include']?_[_0xdb7a('0x1d')](_0x20674b[_0xdb7a('0x19')][_0xdb7a('0x1e')],function(_0x550d02){return{'model':db[_0x550d02[_0xdb7a('0x1f')]],'as':_0x550d02['as'],'attributes':_0x550d02[_0xdb7a('0x1b')],'include':_0x550d02[_0xdb7a('0x1e')]?_[_0xdb7a('0x1d')](_0x550d02[_0xdb7a('0x1e')],function(_0x4ce062){return{'model':db[_0x4ce062[_0xdb7a('0x1f')]],'as':_0x4ce062['as'],'attributes':_0x4ce062[_0xdb7a('0x1b')],'include':_0x4ce062[_0xdb7a('0x1e')]?_[_0xdb7a('0x1d')](_0x4ce062[_0xdb7a('0x1e')],function(_0x454770){return{'model':db[_0x454770[_0xdb7a('0x1f')]],'as':_0x454770['as'],'attributes':_0x454770['attributes']};}):[]};}):[]};}):[]:[]})[_0xdb7a('0x20')](function(_0x3ced59){logger[_0xdb7a('0xc')](_0xdb7a('0x16'),_0x20674b);logger[_0xdb7a('0xd')]('GetSmsQueue',_0x20674b,JSON[_0xdb7a('0xf')](_0x3ced59));_0x46ac0d(_0x3ced59);})['catch'](function(_0x4db3c9){logger['error'](_0xdb7a('0x16'),_0x4db3c9['message'],_0x20674b);_0x49e9c7(_0x3f90cc['error'](0x1f4,_0x4db3c9[_0xdb7a('0x12')]));});});};exports[_0xdb7a('0x21')]=function(_0x3145f3){var _0x520977=this;return new Promise(function(_0x2db3b0,_0x354ba9){return db['SmsQueue'][_0xdb7a('0x22')]({'raw':_0x3145f3[_0xdb7a('0x19')]?_0x3145f3[_0xdb7a('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3145f3[_0xdb7a('0x19')]?_0x3145f3['options'][_0xdb7a('0x23')]||null:null,'attributes':_0x3145f3['options']?_0x3145f3[_0xdb7a('0x19')]['attributes']||null:null,'include':_0x3145f3[_0xdb7a('0x19')]?_0x3145f3[_0xdb7a('0x19')]['include']?_[_0xdb7a('0x1d')](_0x3145f3[_0xdb7a('0x19')][_0xdb7a('0x1e')],function(_0xf33f1c){return{'model':db[_0xf33f1c['model']],'as':_0xf33f1c['as'],'attributes':_0xf33f1c[_0xdb7a('0x1b')],'include':_0xf33f1c[_0xdb7a('0x1e')]?_[_0xdb7a('0x1d')](_0xf33f1c[_0xdb7a('0x1e')],function(_0xac76d2){return{'model':db[_0xac76d2[_0xdb7a('0x1f')]],'as':_0xac76d2['as'],'attributes':_0xac76d2[_0xdb7a('0x1b')],'include':_0xac76d2['include']?_[_0xdb7a('0x1d')](_0xac76d2['include'],function(_0x589d0c){return{'model':db[_0x589d0c['model']],'as':_0x589d0c['as'],'attributes':_0x589d0c[_0xdb7a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x30ae17){logger['info'](_0xdb7a('0x21'),_0x3145f3);logger[_0xdb7a('0xd')](_0xdb7a('0x21'),_0x3145f3,JSON[_0xdb7a('0xf')](_0x30ae17));_0x2db3b0(_0x30ae17);})[_0xdb7a('0x24')](function(_0x4e037d){logger[_0xdb7a('0x10')](_0xdb7a('0x21'),_0x4e037d[_0xdb7a('0x12')],_0x3145f3);_0x354ba9(_0x520977[_0xdb7a('0x10')](0x1f4,_0x4e037d['message']));});});}; \ No newline at end of file +var _0x6443=['socket.io-emitter','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsQueue','findAll','options','where','attributes','limit','map','include','model','GetSmsQueue','raw','ShowSmsQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost'];(function(_0x35493d,_0x17eabe){var _0x254db6=function(_0x22d1ca){while(--_0x22d1ca){_0x35493d['push'](_0x35493d['shift']());}};_0x254db6(++_0x17eabe);}(_0x6443,0x163));var _0x3644=function(_0x18b191,_0x4e0684){_0x18b191=_0x18b191-0x0;var _0x43e146=_0x6443[_0x18b191];return _0x43e146;};'use strict';var _=require(_0x3644('0x0'));var util=require(_0x3644('0x1'));var moment=require(_0x3644('0x2'));var BPromise=require('bluebird');var rs=require(_0x3644('0x3'));var fs=require('fs');var Redis=require(_0x3644('0x4'));var db=require(_0x3644('0x5'))['db'];var utils=require(_0x3644('0x6'));var logger=require(_0x3644('0x7'))(_0x3644('0x8'));var config=require('../../config/environment');var jayson=require(_0x3644('0x9'));var client=jayson[_0x3644('0xa')]['http']({'port':0x232a});config[_0x3644('0xb')]=_[_0x3644('0xc')](config[_0x3644('0xb')],{'host':_0x3644('0xd'),'port':0x18eb});var socket=require(_0x3644('0xe'))(new Redis(config['redis']));require('./smsQueue.socket')[_0x3644('0xf')](socket);function respondWithRpcPromise(_0x316934,_0x21df7d,_0x5e12db){return new BPromise(function(_0x1d0666,_0x2bc19b){return client[_0x3644('0x10')](_0x316934,_0x5e12db)[_0x3644('0x11')](function(_0x130901){logger[_0x3644('0x12')](_0x3644('0x13'),_0x21df7d,_0x3644('0x14'));logger[_0x3644('0x15')](_0x3644('0x16'),_0x21df7d,'request\x20sent',JSON[_0x3644('0x17')](_0x130901));if(_0x130901[_0x3644('0x18')]){if(_0x130901['error'][_0x3644('0x19')]===0x1f4){logger[_0x3644('0x18')](_0x3644('0x13'),_0x21df7d,_0x130901['error'][_0x3644('0x1a')]);return _0x2bc19b(_0x130901['error'][_0x3644('0x1a')]);}logger[_0x3644('0x18')]('SmsQueue,\x20%s,\x20%s',_0x21df7d,_0x130901[_0x3644('0x18')][_0x3644('0x1a')]);return _0x1d0666(_0x130901[_0x3644('0x18')]['message']);}else{logger['info'](_0x3644('0x13'),_0x21df7d,_0x3644('0x14'));_0x1d0666(_0x130901[_0x3644('0x1b')]['message']);}})[_0x3644('0x1c')](function(_0x5c5fb4){logger['error'](_0x3644('0x13'),_0x21df7d,_0x5c5fb4);_0x2bc19b(_0x5c5fb4);});});}exports['GetSmsQueue']=function(_0x2a9ffb){var _0x2181e2=this;return new Promise(function(_0x19b2f4,_0x41e988){return db[_0x3644('0x1d')][_0x3644('0x1e')]({'raw':_0x2a9ffb['options']?_0x2a9ffb['options']['raw']===undefined?!![]:![]:!![],'where':_0x2a9ffb[_0x3644('0x1f')]?_0x2a9ffb[_0x3644('0x1f')][_0x3644('0x20')]||null:null,'attributes':_0x2a9ffb[_0x3644('0x1f')]?_0x2a9ffb[_0x3644('0x1f')][_0x3644('0x21')]||null:null,'limit':_0x2a9ffb[_0x3644('0x1f')]?_0x2a9ffb[_0x3644('0x1f')][_0x3644('0x22')]||null:null,'include':_0x2a9ffb[_0x3644('0x1f')]?_0x2a9ffb['options']['include']?_[_0x3644('0x23')](_0x2a9ffb['options'][_0x3644('0x24')],function(_0x7ce11){return{'model':db[_0x7ce11[_0x3644('0x25')]],'as':_0x7ce11['as'],'attributes':_0x7ce11[_0x3644('0x21')],'include':_0x7ce11[_0x3644('0x24')]?_[_0x3644('0x23')](_0x7ce11[_0x3644('0x24')],function(_0x4652b9){return{'model':db[_0x4652b9[_0x3644('0x25')]],'as':_0x4652b9['as'],'attributes':_0x4652b9[_0x3644('0x21')],'include':_0x4652b9[_0x3644('0x24')]?_[_0x3644('0x23')](_0x4652b9[_0x3644('0x24')],function(_0x368a2c){return{'model':db[_0x368a2c[_0x3644('0x25')]],'as':_0x368a2c['as'],'attributes':_0x368a2c[_0x3644('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3644('0x11')](function(_0x4b3e32){logger[_0x3644('0x12')](_0x3644('0x26'),_0x2a9ffb);logger[_0x3644('0x15')]('GetSmsQueue',_0x2a9ffb,JSON[_0x3644('0x17')](_0x4b3e32));_0x19b2f4(_0x4b3e32);})[_0x3644('0x1c')](function(_0x4c1925){logger['error']('GetSmsQueue',_0x4c1925[_0x3644('0x1a')],_0x2a9ffb);_0x41e988(_0x2181e2[_0x3644('0x18')](0x1f4,_0x4c1925['message']));});});};exports['ShowSmsQueue']=function(_0x5b9c90){var _0x1a85fc=this;return new Promise(function(_0x579c3f,_0x5088f9){return db[_0x3644('0x1d')]['find']({'raw':_0x5b9c90[_0x3644('0x1f')]?_0x5b9c90[_0x3644('0x1f')][_0x3644('0x27')]===undefined?!![]:![]:!![],'where':_0x5b9c90[_0x3644('0x1f')]?_0x5b9c90['options'][_0x3644('0x20')]||null:null,'attributes':_0x5b9c90[_0x3644('0x1f')]?_0x5b9c90[_0x3644('0x1f')][_0x3644('0x21')]||null:null,'include':_0x5b9c90[_0x3644('0x1f')]?_0x5b9c90[_0x3644('0x1f')][_0x3644('0x24')]?_['map'](_0x5b9c90[_0x3644('0x1f')][_0x3644('0x24')],function(_0x936ccf){return{'model':db[_0x936ccf['model']],'as':_0x936ccf['as'],'attributes':_0x936ccf['attributes'],'include':_0x936ccf[_0x3644('0x24')]?_[_0x3644('0x23')](_0x936ccf[_0x3644('0x24')],function(_0x4fac4c){return{'model':db[_0x4fac4c[_0x3644('0x25')]],'as':_0x4fac4c['as'],'attributes':_0x4fac4c['attributes'],'include':_0x4fac4c[_0x3644('0x24')]?_['map'](_0x4fac4c['include'],function(_0x4f57e3){return{'model':db[_0x4f57e3[_0x3644('0x25')]],'as':_0x4f57e3['as'],'attributes':_0x4f57e3[_0x3644('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9fb8b4){logger[_0x3644('0x12')](_0x3644('0x28'),_0x5b9c90);logger[_0x3644('0x15')](_0x3644('0x28'),_0x5b9c90,JSON[_0x3644('0x17')](_0x9fb8b4));_0x579c3f(_0x9fb8b4);})[_0x3644('0x1c')](function(_0x3f366a){logger[_0x3644('0x18')](_0x3644('0x28'),_0x3f366a[_0x3644('0x1a')],_0x5b9c90);_0x5088f9(_0x1a85fc['error'](0x1f4,_0x3f366a[_0x3644('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 8e68f27..211cade 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 _0x2d43=['removeListener','register','length','smsQueue:','./smsQueue.events','save','remove','update','emit'];(function(_0x3fb021,_0x5563b0){var _0x3346d4=function(_0x2bd32c){while(--_0x2bd32c){_0x3fb021['push'](_0x3fb021['shift']());}};_0x3346d4(++_0x5563b0);}(_0x2d43,0x1bd));var _0x32d4=function(_0xf0ec6e,_0xa183d3){_0xf0ec6e=_0xf0ec6e-0x0;var _0x8bbc27=_0x2d43[_0xf0ec6e];return _0x8bbc27;};'use strict';var SmsQueueEvents=require(_0x32d4('0x0'));var events=[_0x32d4('0x1'),_0x32d4('0x2'),_0x32d4('0x3')];function createListener(_0x4f7ee6,_0x2e01d6){return function(_0xa6dae2){_0x2e01d6[_0x32d4('0x4')](_0x4f7ee6,_0xa6dae2);};}function removeListener(_0x2225f8,_0x718423){return function(){SmsQueueEvents[_0x32d4('0x5')](_0x2225f8,_0x718423);};}exports[_0x32d4('0x6')]=function(_0x5a91d1){for(var _0x5c31c8=0x0,_0x456eb7=events[_0x32d4('0x7')];_0x5c31c8<_0x456eb7;_0x5c31c8++){var _0x489829=events[_0x5c31c8];var _0x2d2167=createListener(_0x32d4('0x8')+_0x489829,_0x5a91d1);SmsQueueEvents['on'](_0x489829,_0x2d2167);}}; \ No newline at end of file +var _0x5637=['remove','emit','removeListener','register','length','smsQueue:','save'];(function(_0x5acbef,_0x36b414){var _0x5e9742=function(_0x1fac54){while(--_0x1fac54){_0x5acbef['push'](_0x5acbef['shift']());}};_0x5e9742(++_0x36b414);}(_0x5637,0x141));var _0x7563=function(_0x8d4f4,_0x5189c8){_0x8d4f4=_0x8d4f4-0x0;var _0x1b435c=_0x5637[_0x8d4f4];return _0x1b435c;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x7563('0x0'),_0x7563('0x1'),'update'];function createListener(_0x1798a4,_0x147034){return function(_0x18ac52){_0x147034[_0x7563('0x2')](_0x1798a4,_0x18ac52);};}function removeListener(_0x42e288,_0x2e44b5){return function(){SmsQueueEvents[_0x7563('0x3')](_0x42e288,_0x2e44b5);};}exports[_0x7563('0x4')]=function(_0x3d3785){for(var _0x319a2b=0x0,_0x49b599=events[_0x7563('0x5')];_0x319a2b<_0x49b599;_0x319a2b++){var _0x226892=events[_0x319a2b];var _0x4cebf1=createListener(_0x7563('0x6')+_0x226892,_0x3d3785);SmsQueueEvents['on'](_0x226892,_0x4cebf1);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 5539cc2..222f912 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 _0x9dd4=['post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x9dd4,0x157));var _0x49dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9dd4[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x49dd('0x0'));var util=require(_0x49dd('0x1'));var path=require('path');var timeout=require(_0x49dd('0x2'));var express=require(_0x49dd('0x3'));var router=express[_0x49dd('0x4')]();var fs_extra=require(_0x49dd('0x5'));var auth=require(_0x49dd('0x6'));var interaction=require(_0x49dd('0x7'));var config=require(_0x49dd('0x8'));var controller=require('./smsQueueReport.controller');router[_0x49dd('0x9')]('/',auth[_0x49dd('0xa')](),controller[_0x49dd('0xb')]);router[_0x49dd('0x9')]('/describe',auth[_0x49dd('0xa')](),controller[_0x49dd('0xc')]);router[_0x49dd('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x49dd('0xd')]);router[_0x49dd('0xe')]('/',auth[_0x49dd('0xa')](),controller[_0x49dd('0xf')]);router[_0x49dd('0x10')]('/:id',auth[_0x49dd('0xa')](),controller[_0x49dd('0x11')]);router[_0x49dd('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x49dd('0x13')]);module[_0x49dd('0x14')]=router; \ No newline at end of file +var _0xc180=['/describe','describe','/:id','post','create','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','index','get'];(function(_0x3ba2a0,_0x5453a5){var _0x575d6c=function(_0x122450){while(--_0x122450){_0x3ba2a0['push'](_0x3ba2a0['shift']());}};_0x575d6c(++_0x5453a5);}(_0xc180,0x185));var _0x0c18=function(_0x3c514b,_0x325bbc){_0x3c514b=_0x3c514b-0x0;var _0x32149c=_0xc180[_0x3c514b];return _0x32149c;};'use strict';var multer=require(_0x0c18('0x0'));var util=require(_0x0c18('0x1'));var path=require(_0x0c18('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0c18('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0c18('0x4'));var interaction=require(_0x0c18('0x5'));var config=require(_0x0c18('0x6'));var controller=require(_0x0c18('0x7'));router['get']('/',auth[_0x0c18('0x8')](),controller[_0x0c18('0x9')]);router[_0x0c18('0xa')](_0x0c18('0xb'),auth[_0x0c18('0x8')](),controller[_0x0c18('0xc')]);router[_0x0c18('0xa')](_0x0c18('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x0c18('0xe')]('/',auth[_0x0c18('0x8')](),controller[_0x0c18('0xf')]);router['put'](_0x0c18('0xd'),auth[_0x0c18('0x8')](),controller[_0x0c18('0x10')]);router[_0x0c18('0x11')](_0x0c18('0xd'),auth[_0x0c18('0x8')](),controller[_0x0c18('0x12')]);module[_0x0c18('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 40c5de0..9dd8961 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 _0x25ea=['DATE','moment','sequelize','exports','STRING'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x25ea,0xc4));var _0xa25e=function(_0xe4d6c6,_0x3bdbf2){_0xe4d6c6=_0xe4d6c6-0x0;var _0x3a8935=_0x25ea[_0xe4d6c6];return _0x3a8935;};'use strict';var moment=require(_0xa25e('0x0'));var Sequelize=require(_0xa25e('0x1'));module[_0xa25e('0x2')]={'uniqueid':{'type':Sequelize[_0xa25e('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xa25e('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa25e('0x4')]},'acceptAt':{'type':Sequelize[_0xa25e('0x4')]},'exitAt':{'type':Sequelize[_0xa25e('0x4')]},'reason':{'type':Sequelize[_0xa25e('0x3')]}}; \ No newline at end of file +var _0x4098=['sequelize','exports','STRING','DATE'];(function(_0x5c9397,_0xe6bc88){var _0x194baf=function(_0x50d093){while(--_0x50d093){_0x5c9397['push'](_0x5c9397['shift']());}};_0x194baf(++_0xe6bc88);}(_0x4098,0x120));var _0x8409=function(_0xba5feb,_0x35e770){_0xba5feb=_0xba5feb-0x0;var _0x1c23b3=_0x4098[_0xba5feb];return _0x1c23b3;};'use strict';var moment=require('moment');var Sequelize=require(_0x8409('0x0'));module[_0x8409('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x8409('0x2')]},'joinAt':{'type':Sequelize[_0x8409('0x3')]},'leaveAt':{'type':Sequelize[_0x8409('0x3')]},'acceptAt':{'type':Sequelize[_0x8409('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index d1d5158..14ae476 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 _0xfec8=['order','sort','where','pick','filter','merge','VIRTUAL','SmsQueueReport','includeAll','findAll','rows','show','params','keys','rawAttributes','options','create','body','catch','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','querystring','papaparse','../../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','reject','save','update','then','destroy','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit'];(function(_0xd32b91,_0x2b6353){var _0x146be7=function(_0x82e4f6){while(--_0x82e4f6){_0xd32b91['push'](_0xd32b91['shift']());}};_0x146be7(++_0x2b6353);}(_0xfec8,0x1e2));var _0x8fec=function(_0x146a85,_0x529b52){_0x146a85=_0x146a85-0x0;var _0x1b59bf=_0xfec8[_0x146a85];return _0x1b59bf;};'use strict';var emlformat=require(_0x8fec('0x0'));var rimraf=require(_0x8fec('0x1'));var zipdir=require(_0x8fec('0x2'));var jsonpatch=require(_0x8fec('0x3'));var rp=require(_0x8fec('0x4'));var moment=require(_0x8fec('0x5'));var BPromise=require(_0x8fec('0x6'));var Mustache=require(_0x8fec('0x7'));var util=require(_0x8fec('0x8'));var path=require(_0x8fec('0x9'));var sox=require(_0x8fec('0xa'));var csv=require(_0x8fec('0xb'));var ejs=require(_0x8fec('0xc'));var fs=require('fs');var fs_extra=require(_0x8fec('0xd'));var _=require(_0x8fec('0xe'));var squel=require(_0x8fec('0xf'));var crypto=require(_0x8fec('0x10'));var jsforce=require(_0x8fec('0x11'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8fec('0x12'));var Papa=require(_0x8fec('0x13'));var Redis=require('ioredis');var authService=require(_0x8fec('0x14'));var qs=require(_0x8fec('0x15'));var as=require(_0x8fec('0x16'));var hardwareService=require(_0x8fec('0x17'));var logger=require(_0x8fec('0x18'))(_0x8fec('0x19'));var utils=require('../../config/utils');var config=require(_0x8fec('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x8fec('0x1b'))['db'];function respondWithStatusCode(_0x47e85f,_0x33da51){_0x33da51=_0x33da51||0xcc;return function(_0x175d2a){if(_0x175d2a){return _0x47e85f[_0x8fec('0x1c')](_0x33da51);}return _0x47e85f[_0x8fec('0x1d')](_0x33da51)[_0x8fec('0x1e')]();};}function respondWithResult(_0x335dcf,_0x1c8dc6){_0x1c8dc6=_0x1c8dc6||0xc8;return function(_0x4ee4c0){if(_0x4ee4c0){return _0x335dcf[_0x8fec('0x1d')](_0x1c8dc6)[_0x8fec('0x1f')](_0x4ee4c0);}};}function respondWithFilteredResult(_0x388584,_0x3ddd2e){return function(_0x593734){if(_0x593734){var _0x4cf3cf=typeof _0x3ddd2e[_0x8fec('0x20')]===_0x8fec('0x21')&&typeof _0x3ddd2e[_0x8fec('0x22')]===_0x8fec('0x21');var _0x5bb254=_0x593734[_0x8fec('0x23')];var _0x308f74=_0x4cf3cf?0x0:_0x3ddd2e[_0x8fec('0x20')];var _0x13e0a8=_0x4cf3cf?_0x593734[_0x8fec('0x23')]:_0x3ddd2e[_0x8fec('0x20')]+_0x3ddd2e[_0x8fec('0x22')];var _0x8d84b7;if(_0x13e0a8>=_0x5bb254){_0x13e0a8=_0x5bb254;_0x8d84b7=0xc8;}else{_0x8d84b7=0xce;}_0x388584[_0x8fec('0x1d')](_0x8d84b7);return _0x388584['set'](_0x8fec('0x24'),_0x308f74+'-'+_0x13e0a8+'/'+_0x5bb254)[_0x8fec('0x1f')](_0x593734);}return null;};}function patchUpdates(_0x2ff688){return function(_0x4db21f){try{jsonpatch['apply'](_0x4db21f,_0x2ff688,!![]);}catch(_0x22932f){return BPromise[_0x8fec('0x25')](_0x22932f);}return _0x4db21f[_0x8fec('0x26')]();};}function saveUpdates(_0x20c908,_0x3e8550){return function(_0xb9db6a){if(_0xb9db6a){return _0xb9db6a[_0x8fec('0x27')](_0x20c908)[_0x8fec('0x28')](function(_0x51c76a){return _0x51c76a;});}return null;};}function removeEntity(_0x31d21b,_0x2998f1){return function(_0x13b32b){if(_0x13b32b){return _0x13b32b[_0x8fec('0x29')]()[_0x8fec('0x28')](function(){_0x31d21b[_0x8fec('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b1431,_0x475a4b){return function(_0x5e7eed){if(!_0x5e7eed){_0x5b1431[_0x8fec('0x1c')](0x194);}return _0x5e7eed;};}function handleError(_0xfeb6c8,_0x4d1e4e){_0x4d1e4e=_0x4d1e4e||0x1f4;return function(_0xd46525){logger['error'](_0xd46525['stack']);if(_0xd46525[_0x8fec('0x2a')]){delete _0xd46525[_0x8fec('0x2a')];}_0xfeb6c8[_0x8fec('0x1d')](_0x4d1e4e)[_0x8fec('0x2b')](_0xd46525);};}exports[_0x8fec('0x2c')]=function(_0x28bfa4,_0x50d6a9){var _0x3fd91a={},_0x591cc8={},_0x376e9f={'count':0x0,'rows':[]};var _0x4287cf=_[_0x8fec('0x2d')](db['SmsQueueReport']['rawAttributes'],function(_0x413b46){return{'name':_0x413b46[_0x8fec('0x2e')],'type':_0x413b46[_0x8fec('0x2f')][_0x8fec('0x30')]};});_0x591cc8[_0x8fec('0x31')]=_[_0x8fec('0x2d')](_0x4287cf,'name');_0x591cc8['query']=_['keys'](_0x28bfa4[_0x8fec('0x32')]);_0x591cc8[_0x8fec('0x33')]=_[_0x8fec('0x34')](_0x591cc8[_0x8fec('0x31')],_0x591cc8[_0x8fec('0x32')]);_0x3fd91a[_0x8fec('0x35')]=_[_0x8fec('0x34')](_0x591cc8[_0x8fec('0x31')],qs['fields'](_0x28bfa4[_0x8fec('0x32')][_0x8fec('0x36')]));_0x3fd91a[_0x8fec('0x35')]=_0x3fd91a[_0x8fec('0x35')][_0x8fec('0x37')]?_0x3fd91a[_0x8fec('0x35')]:_0x591cc8['model'];if(!_0x28bfa4[_0x8fec('0x32')]['hasOwnProperty'](_0x8fec('0x38'))){_0x3fd91a['limit']=qs[_0x8fec('0x22')](_0x28bfa4['query'][_0x8fec('0x22')]);_0x3fd91a['offset']=qs[_0x8fec('0x20')](_0x28bfa4[_0x8fec('0x32')][_0x8fec('0x20')]);}_0x3fd91a[_0x8fec('0x39')]=qs['sort'](_0x28bfa4[_0x8fec('0x32')][_0x8fec('0x3a')]);_0x3fd91a[_0x8fec('0x3b')]=qs[_0x8fec('0x33')](_[_0x8fec('0x3c')](_0x28bfa4[_0x8fec('0x32')],_0x591cc8[_0x8fec('0x33')]),_0x4287cf);if(_0x28bfa4[_0x8fec('0x32')][_0x8fec('0x3d')]){_0x3fd91a[_0x8fec('0x3b')]=_[_0x8fec('0x3e')](_0x3fd91a[_0x8fec('0x3b')],{'$or':_[_0x8fec('0x2d')](_0x4287cf,function(_0x243dad){if(_0x243dad[_0x8fec('0x2f')]!==_0x8fec('0x3f')){var _0x3bd108={};_0x3bd108[_0x243dad[_0x8fec('0x2a')]]={'$like':'%'+_0x28bfa4['query'][_0x8fec('0x3d')]+'%'};return _0x3bd108;}})});}_0x3fd91a=_[_0x8fec('0x3e')]({},_0x3fd91a,_0x28bfa4['options']);var _0x49d328={'where':_0x3fd91a['where']};return db[_0x8fec('0x40')][_0x8fec('0x23')](_0x49d328)[_0x8fec('0x28')](function(_0x29275){_0x376e9f['count']=_0x29275;if(_0x28bfa4[_0x8fec('0x32')][_0x8fec('0x41')]){_0x3fd91a['include']=[{'all':!![]}];}return db[_0x8fec('0x40')][_0x8fec('0x42')](_0x3fd91a);})[_0x8fec('0x28')](function(_0xbb74e6){_0x376e9f[_0x8fec('0x43')]=_0xbb74e6;return _0x376e9f;})[_0x8fec('0x28')](respondWithFilteredResult(_0x50d6a9,_0x3fd91a))['catch'](handleError(_0x50d6a9,null));};exports[_0x8fec('0x44')]=function(_0x176614,_0x5a829d){var _0x331d31={'raw':!![],'where':{'id':_0x176614[_0x8fec('0x45')]['id']}},_0x52de12={};_0x52de12[_0x8fec('0x31')]=_[_0x8fec('0x46')](db[_0x8fec('0x40')][_0x8fec('0x47')]);_0x52de12[_0x8fec('0x32')]=_['keys'](_0x176614[_0x8fec('0x32')]);_0x52de12['filters']=_[_0x8fec('0x34')](_0x52de12[_0x8fec('0x31')],_0x52de12['query']);_0x331d31[_0x8fec('0x35')]=_['intersection'](_0x52de12[_0x8fec('0x31')],qs[_0x8fec('0x36')](_0x176614[_0x8fec('0x32')]['fields']));_0x331d31[_0x8fec('0x35')]=_0x331d31[_0x8fec('0x35')][_0x8fec('0x37')]?_0x331d31[_0x8fec('0x35')]:_0x52de12[_0x8fec('0x31')];if(_0x176614[_0x8fec('0x32')]['includeAll']){_0x331d31['include']=[{'all':!![]}];}_0x331d31=_[_0x8fec('0x3e')]({},_0x331d31,_0x176614[_0x8fec('0x48')]);return db[_0x8fec('0x40')]['find'](_0x331d31)[_0x8fec('0x28')](handleEntityNotFound(_0x5a829d,null))[_0x8fec('0x28')](respondWithResult(_0x5a829d,null))['catch'](handleError(_0x5a829d,null));};exports[_0x8fec('0x49')]=function(_0x4ced54,_0x7bd3fa){return db['SmsQueueReport'][_0x8fec('0x49')](_0x4ced54[_0x8fec('0x4a')],{})['then'](respondWithResult(_0x7bd3fa,0xc9))[_0x8fec('0x4b')](handleError(_0x7bd3fa,null));};exports[_0x8fec('0x27')]=function(_0x8120e5,_0x546c83){if(_0x8120e5[_0x8fec('0x4a')]['id']){delete _0x8120e5['body']['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x8120e5[_0x8fec('0x45')]['id']}})[_0x8fec('0x28')](handleEntityNotFound(_0x546c83,null))[_0x8fec('0x28')](saveUpdates(_0x8120e5[_0x8fec('0x4a')],null))[_0x8fec('0x28')](respondWithResult(_0x546c83,null))[_0x8fec('0x4b')](handleError(_0x546c83,null));};exports[_0x8fec('0x29')]=function(_0x35c596,_0x29b7fd){return db[_0x8fec('0x40')]['find']({'where':{'id':_0x35c596[_0x8fec('0x45')]['id']}})[_0x8fec('0x28')](handleEntityNotFound(_0x29b7fd,null))[_0x8fec('0x28')](removeEntity(_0x29b7fd,null))[_0x8fec('0x4b')](handleError(_0x29b7fd,null));};exports[_0x8fec('0x4c')]=function(_0xb6c620,_0x37fc58){return db[_0x8fec('0x40')][_0x8fec('0x4c')]()[_0x8fec('0x28')](respondWithResult(_0x37fc58,null))[_0x8fec('0x4b')](handleError(_0x37fc58,null));}; \ No newline at end of file +var _0x0198=['status','end','json','offset','count','limit','set','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','SmsQueueReport','findAll','rows','show','params','keys','include','options','find','create','body','catch','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x5af516,_0x1511f2){var _0x25fe26=function(_0x2f6b5a){while(--_0x2f6b5a){_0x5af516['push'](_0x5af516['shift']());}};_0x25fe26(++_0x1511f2);}(_0x0198,0x117));var _0x8019=function(_0x2fd69d,_0xeb1037){_0x2fd69d=_0x2fd69d-0x0;var _0x5d5ef3=_0x0198[_0x2fd69d];return _0x5d5ef3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8019('0x0'));var zipdir=require(_0x8019('0x1'));var jsonpatch=require(_0x8019('0x2'));var rp=require(_0x8019('0x3'));var moment=require(_0x8019('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8019('0x5'));var util=require(_0x8019('0x6'));var path=require('path');var sox=require(_0x8019('0x7'));var csv=require(_0x8019('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8019('0x9'));var squel=require('squel');var crypto=require(_0x8019('0xa'));var jsforce=require(_0x8019('0xb'));var deskjs=require(_0x8019('0xc'));var toCsv=require(_0x8019('0x8'));var querystring=require(_0x8019('0xd'));var Papa=require(_0x8019('0xe'));var Redis=require(_0x8019('0xf'));var authService=require(_0x8019('0x10'));var qs=require(_0x8019('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8019('0x12'));var logger=require(_0x8019('0x13'))(_0x8019('0x14'));var utils=require(_0x8019('0x15'));var config=require(_0x8019('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8019('0x17'))['db'];function respondWithStatusCode(_0x521721,_0x2eacb4){_0x2eacb4=_0x2eacb4||0xcc;return function(_0x2259a7){if(_0x2259a7){return _0x521721[_0x8019('0x18')](_0x2eacb4);}return _0x521721[_0x8019('0x19')](_0x2eacb4)[_0x8019('0x1a')]();};}function respondWithResult(_0x3d6052,_0x32b073){_0x32b073=_0x32b073||0xc8;return function(_0x39a032){if(_0x39a032){return _0x3d6052['status'](_0x32b073)[_0x8019('0x1b')](_0x39a032);}};}function respondWithFilteredResult(_0x39ee46,_0x4abea0){return function(_0x5a7f00){if(_0x5a7f00){var _0x37ae50=typeof _0x4abea0[_0x8019('0x1c')]==='undefined'&&typeof _0x4abea0['limit']==='undefined';var _0x19d2e9=_0x5a7f00['count'];var _0x48c735=_0x37ae50?0x0:_0x4abea0[_0x8019('0x1c')];var _0x2cf7a8=_0x37ae50?_0x5a7f00[_0x8019('0x1d')]:_0x4abea0[_0x8019('0x1c')]+_0x4abea0[_0x8019('0x1e')];var _0x26ff2b;if(_0x2cf7a8>=_0x19d2e9){_0x2cf7a8=_0x19d2e9;_0x26ff2b=0xc8;}else{_0x26ff2b=0xce;}_0x39ee46['status'](_0x26ff2b);return _0x39ee46[_0x8019('0x1f')]('Content-Range',_0x48c735+'-'+_0x2cf7a8+'/'+_0x19d2e9)['json'](_0x5a7f00);}return null;};}function patchUpdates(_0x12a29e){return function(_0x4686a7){try{jsonpatch['apply'](_0x4686a7,_0x12a29e,!![]);}catch(_0x85974d){return BPromise[_0x8019('0x20')](_0x85974d);}return _0x4686a7[_0x8019('0x21')]();};}function saveUpdates(_0xa38090,_0x17fe14){return function(_0x58e21a){if(_0x58e21a){return _0x58e21a[_0x8019('0x22')](_0xa38090)[_0x8019('0x23')](function(_0x1af573){return _0x1af573;});}return null;};}function removeEntity(_0x4152d5,_0x54bbeb){return function(_0x5b1df8){if(_0x5b1df8){return _0x5b1df8[_0x8019('0x24')]()[_0x8019('0x23')](function(){_0x4152d5[_0x8019('0x19')](0xcc)[_0x8019('0x1a')]();});}};}function handleEntityNotFound(_0x9edb74,_0x54c9c6){return function(_0x5a4a6b){if(!_0x5a4a6b){_0x9edb74[_0x8019('0x18')](0x194);}return _0x5a4a6b;};}function handleError(_0x25816c,_0x3a3df2){_0x3a3df2=_0x3a3df2||0x1f4;return function(_0x25b341){logger[_0x8019('0x25')](_0x25b341[_0x8019('0x26')]);if(_0x25b341['name']){delete _0x25b341[_0x8019('0x27')];}_0x25816c['status'](_0x3a3df2)[_0x8019('0x28')](_0x25b341);};}exports['index']=function(_0x7c4cd4,_0x1a3179){var _0x48441a={},_0x411b66={},_0x4045b9={'count':0x0,'rows':[]};var _0x3c6712=_[_0x8019('0x29')](db['SmsQueueReport'][_0x8019('0x2a')],function(_0x5c1413){return{'name':_0x5c1413[_0x8019('0x2b')],'type':_0x5c1413[_0x8019('0x2c')][_0x8019('0x2d')]};});_0x411b66['model']=_['map'](_0x3c6712,_0x8019('0x27'));_0x411b66['query']=_['keys'](_0x7c4cd4[_0x8019('0x2e')]);_0x411b66[_0x8019('0x2f')]=_[_0x8019('0x30')](_0x411b66[_0x8019('0x31')],_0x411b66[_0x8019('0x2e')]);_0x48441a[_0x8019('0x32')]=_[_0x8019('0x30')](_0x411b66['model'],qs[_0x8019('0x33')](_0x7c4cd4['query']['fields']));_0x48441a['attributes']=_0x48441a['attributes'][_0x8019('0x34')]?_0x48441a[_0x8019('0x32')]:_0x411b66[_0x8019('0x31')];if(!_0x7c4cd4[_0x8019('0x2e')][_0x8019('0x35')](_0x8019('0x36'))){_0x48441a[_0x8019('0x1e')]=qs[_0x8019('0x1e')](_0x7c4cd4['query']['limit']);_0x48441a['offset']=qs[_0x8019('0x1c')](_0x7c4cd4[_0x8019('0x2e')]['offset']);}_0x48441a[_0x8019('0x37')]=qs[_0x8019('0x38')](_0x7c4cd4[_0x8019('0x2e')][_0x8019('0x38')]);_0x48441a[_0x8019('0x39')]=qs[_0x8019('0x2f')](_[_0x8019('0x3a')](_0x7c4cd4[_0x8019('0x2e')],_0x411b66['filters']),_0x3c6712);if(_0x7c4cd4[_0x8019('0x2e')][_0x8019('0x3b')]){_0x48441a['where']=_['merge'](_0x48441a[_0x8019('0x39')],{'$or':_[_0x8019('0x29')](_0x3c6712,function(_0x1ab0c3){if(_0x1ab0c3['type']!==_0x8019('0x3c')){var _0x116f66={};_0x116f66[_0x1ab0c3['name']]={'$like':'%'+_0x7c4cd4[_0x8019('0x2e')][_0x8019('0x3b')]+'%'};return _0x116f66;}})});}_0x48441a=_[_0x8019('0x3d')]({},_0x48441a,_0x7c4cd4['options']);var _0x4456bb={'where':_0x48441a[_0x8019('0x39')]};return db['SmsQueueReport'][_0x8019('0x1d')](_0x4456bb)[_0x8019('0x23')](function(_0x189dbc){_0x4045b9[_0x8019('0x1d')]=_0x189dbc;if(_0x7c4cd4[_0x8019('0x2e')][_0x8019('0x3e')]){_0x48441a['include']=[{'all':!![]}];}return db[_0x8019('0x3f')][_0x8019('0x40')](_0x48441a);})[_0x8019('0x23')](function(_0x319218){_0x4045b9[_0x8019('0x41')]=_0x319218;return _0x4045b9;})[_0x8019('0x23')](respondWithFilteredResult(_0x1a3179,_0x48441a))['catch'](handleError(_0x1a3179,null));};exports[_0x8019('0x42')]=function(_0x2aa455,_0x38d71c){var _0xd03dea={'raw':!![],'where':{'id':_0x2aa455[_0x8019('0x43')]['id']}},_0x2556f9={};_0x2556f9[_0x8019('0x31')]=_['keys'](db[_0x8019('0x3f')][_0x8019('0x2a')]);_0x2556f9['query']=_[_0x8019('0x44')](_0x2aa455['query']);_0x2556f9[_0x8019('0x2f')]=_[_0x8019('0x30')](_0x2556f9['model'],_0x2556f9[_0x8019('0x2e')]);_0xd03dea[_0x8019('0x32')]=_[_0x8019('0x30')](_0x2556f9['model'],qs[_0x8019('0x33')](_0x2aa455[_0x8019('0x2e')][_0x8019('0x33')]));_0xd03dea[_0x8019('0x32')]=_0xd03dea[_0x8019('0x32')]['length']?_0xd03dea[_0x8019('0x32')]:_0x2556f9[_0x8019('0x31')];if(_0x2aa455['query'][_0x8019('0x3e')]){_0xd03dea[_0x8019('0x45')]=[{'all':!![]}];}_0xd03dea=_[_0x8019('0x3d')]({},_0xd03dea,_0x2aa455[_0x8019('0x46')]);return db['SmsQueueReport'][_0x8019('0x47')](_0xd03dea)[_0x8019('0x23')](handleEntityNotFound(_0x38d71c,null))[_0x8019('0x23')](respondWithResult(_0x38d71c,null))['catch'](handleError(_0x38d71c,null));};exports[_0x8019('0x48')]=function(_0x1e2b56,_0x4d3ab6){return db[_0x8019('0x3f')][_0x8019('0x48')](_0x1e2b56[_0x8019('0x49')],{})['then'](respondWithResult(_0x4d3ab6,0xc9))['catch'](handleError(_0x4d3ab6,null));};exports[_0x8019('0x22')]=function(_0x307c2b,_0x1a6d55){if(_0x307c2b[_0x8019('0x49')]['id']){delete _0x307c2b[_0x8019('0x49')]['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x307c2b[_0x8019('0x43')]['id']}})[_0x8019('0x23')](handleEntityNotFound(_0x1a6d55,null))[_0x8019('0x23')](saveUpdates(_0x307c2b['body'],null))[_0x8019('0x23')](respondWithResult(_0x1a6d55,null))[_0x8019('0x4a')](handleError(_0x1a6d55,null));};exports[_0x8019('0x24')]=function(_0x56d6fe,_0x1a90f3){return db[_0x8019('0x3f')]['find']({'where':{'id':_0x56d6fe[_0x8019('0x43')]['id']}})['then'](handleEntityNotFound(_0x1a90f3,null))[_0x8019('0x23')](removeEntity(_0x1a90f3,null))[_0x8019('0x4a')](handleError(_0x1a90f3,null));};exports[_0x8019('0x4b')]=function(_0x29d7fa,_0x26b631){return db[_0x8019('0x3f')][_0x8019('0x4b')]()[_0x8019('0x23')](respondWithResult(_0x26b631,null))['catch'](handleError(_0x26b631,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 4bb43f0..becf1e4 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0x580b65,_0x39234f){var _0x6e3000=function(_0x1ad986){while(--_0x1ad986){_0x580b65['push'](_0x580b65['shift']());}};_0x6e3000(++_0x39234f);}(_0xb7e7,0x121));var _0x7b7e=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xb7e7[_0xaa0309];return _0x5de7ce;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index a4e0e2f..d2877d3 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 _0xa060=['UpdateSmsQueueReport','update','where','limit','catch','lodash','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateSmsQueueReport','SmsQueueReport','body','options','raw','then','stringify'];(function(_0x4532de,_0x3b275b){var _0x44172e=function(_0x4fff0e){while(--_0x4fff0e){_0x4532de['push'](_0x4532de['shift']());}};_0x44172e(++_0x3b275b);}(_0xa060,0xd7));var _0x0a06=function(_0x3c964f,_0x196ebb){_0x3c964f=_0x3c964f-0x0;var _0x34abae=_0xa060[_0x3c964f];return _0x34abae;};'use strict';var _=require(_0x0a06('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0a06('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0a06('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a06('0x3'))(_0x0a06('0x4'));var config=require(_0x0a06('0x5'));var jayson=require(_0x0a06('0x6'));var client=jayson[_0x0a06('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e64ac,_0x4692e7,_0x481a0b){return new BPromise(function(_0x1b0069,_0x955ca6){return client[_0x0a06('0x8')](_0x3e64ac,_0x481a0b)['then'](function(_0x1b165){logger[_0x0a06('0x9')](_0x0a06('0xa'),_0x4692e7,_0x0a06('0xb'));logger[_0x0a06('0xc')](_0x0a06('0xd'),_0x4692e7,'request\x20sent',JSON['stringify'](_0x1b165));if(_0x1b165[_0x0a06('0xe')]){if(_0x1b165[_0x0a06('0xe')][_0x0a06('0xf')]===0x1f4){logger[_0x0a06('0xe')](_0x0a06('0xa'),_0x4692e7,_0x1b165['error'][_0x0a06('0x10')]);return _0x955ca6(_0x1b165['error'][_0x0a06('0x10')]);}logger['error'](_0x0a06('0xa'),_0x4692e7,_0x1b165['error'][_0x0a06('0x10')]);return _0x1b0069(_0x1b165['error'][_0x0a06('0x10')]);}else{logger[_0x0a06('0x9')](_0x0a06('0xa'),_0x4692e7,_0x0a06('0xb'));_0x1b0069(_0x1b165[_0x0a06('0x11')][_0x0a06('0x10')]);}})['catch'](function(_0x27edad){logger['error'](_0x0a06('0xa'),_0x4692e7,_0x27edad);_0x955ca6(_0x27edad);});});}exports[_0x0a06('0x12')]=function(_0x2c7e62){var _0x4b7e5b=this;return new Promise(function(_0x27b746,_0x22a4ff){return db[_0x0a06('0x13')]['create'](_0x2c7e62[_0x0a06('0x14')],{'raw':_0x2c7e62[_0x0a06('0x15')]?_0x2c7e62[_0x0a06('0x15')][_0x0a06('0x16')]===undefined?!![]:![]:!![]})[_0x0a06('0x17')](function(_0x365da5){logger[_0x0a06('0x9')](_0x0a06('0x12'),_0x2c7e62);logger[_0x0a06('0xc')](_0x0a06('0x12'),_0x2c7e62,JSON[_0x0a06('0x18')](_0x365da5));_0x27b746(_0x365da5);})['catch'](function(_0x2c9b34){logger[_0x0a06('0xe')]('CreateSmsQueueReport',_0x2c9b34[_0x0a06('0x10')],_0x2c7e62);_0x22a4ff(_0x4b7e5b[_0x0a06('0xe')](0x1f4,_0x2c9b34[_0x0a06('0x10')]));});});};exports[_0x0a06('0x19')]=function(_0x39453){var _0xdbbdb9=this;return new Promise(function(_0x367d8b,_0x11ad8e){return db[_0x0a06('0x13')][_0x0a06('0x1a')](_0x39453[_0x0a06('0x14')],{'raw':_0x39453[_0x0a06('0x15')]?_0x39453['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39453[_0x0a06('0x15')]?_0x39453[_0x0a06('0x15')][_0x0a06('0x1b')]||null:null,'attributes':_0x39453['options']?_0x39453['options']['attributes']||null:null,'limit':_0x39453[_0x0a06('0x15')]?_0x39453[_0x0a06('0x15')][_0x0a06('0x1c')]||null:null})[_0x0a06('0x17')](function(_0x5a5115){logger[_0x0a06('0x9')]('UpdateSmsQueueReport',_0x39453);logger[_0x0a06('0xc')](_0x0a06('0x19'),_0x39453,JSON[_0x0a06('0x18')](_0x5a5115));_0x367d8b(_0x5a5115);})[_0x0a06('0x1d')](function(_0x2d4bc3){logger[_0x0a06('0xe')]('UpdateSmsQueueReport',_0x2d4bc3[_0x0a06('0x10')],_0x39453);_0x11ad8e(_0xdbbdb9[_0x0a06('0xe')](0x1f4,_0x2d4bc3[_0x0a06('0x10')]));});});}; \ No newline at end of file +var _0x87a7=['request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsQueueReport,\x20%s,\x20%s','result','catch','CreateSmsQueueReport','SmsQueueReport','create','options','UpdateSmsQueueReport','update','body','raw','where','limit','lodash','util','ioredis','../../mysqldb','rpc','../../config/environment','client','then','info'];(function(_0x293b78,_0x3c6625){var _0x6e7249=function(_0x41dac8){while(--_0x41dac8){_0x293b78['push'](_0x293b78['shift']());}};_0x6e7249(++_0x3c6625);}(_0x87a7,0xdf));var _0x787a=function(_0x4e2a53,_0x4100ea){_0x4e2a53=_0x4e2a53-0x0;var _0x4a2fd9=_0x87a7[_0x4e2a53];return _0x4a2fd9;};'use strict';var _=require(_0x787a('0x0'));var util=require(_0x787a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x787a('0x2'));var db=require(_0x787a('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x787a('0x4'));var config=require(_0x787a('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x787a('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x192e47,_0x638d3b,_0x1a0539){return new BPromise(function(_0x4543cf,_0x322ccf){return client['request'](_0x192e47,_0x1a0539)[_0x787a('0x7')](function(_0x565c69){logger[_0x787a('0x8')]('SmsQueueReport,\x20%s,\x20%s',_0x638d3b,_0x787a('0x9'));logger[_0x787a('0xa')](_0x787a('0xb'),_0x638d3b,_0x787a('0x9'),JSON[_0x787a('0xc')](_0x565c69));if(_0x565c69[_0x787a('0xd')]){if(_0x565c69[_0x787a('0xd')][_0x787a('0xe')]===0x1f4){logger[_0x787a('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x638d3b,_0x565c69[_0x787a('0xd')][_0x787a('0xf')]);return _0x322ccf(_0x565c69[_0x787a('0xd')]['message']);}logger['error'](_0x787a('0x10'),_0x638d3b,_0x565c69[_0x787a('0xd')][_0x787a('0xf')]);return _0x4543cf(_0x565c69[_0x787a('0xd')][_0x787a('0xf')]);}else{logger[_0x787a('0x8')]('SmsQueueReport,\x20%s,\x20%s',_0x638d3b,_0x787a('0x9'));_0x4543cf(_0x565c69[_0x787a('0x11')][_0x787a('0xf')]);}})[_0x787a('0x12')](function(_0x231f10){logger[_0x787a('0xd')](_0x787a('0x10'),_0x638d3b,_0x231f10);_0x322ccf(_0x231f10);});});}exports[_0x787a('0x13')]=function(_0x455dc4){var _0x5ae13a=this;return new Promise(function(_0x7a2b03,_0x1593a2){return db[_0x787a('0x14')][_0x787a('0x15')](_0x455dc4['body'],{'raw':_0x455dc4[_0x787a('0x16')]?_0x455dc4['options']['raw']===undefined?!![]:![]:!![]})[_0x787a('0x7')](function(_0x34fd7b){logger[_0x787a('0x8')]('CreateSmsQueueReport',_0x455dc4);logger[_0x787a('0xa')]('CreateSmsQueueReport',_0x455dc4,JSON[_0x787a('0xc')](_0x34fd7b));_0x7a2b03(_0x34fd7b);})[_0x787a('0x12')](function(_0x5bb4c7){logger['error'](_0x787a('0x13'),_0x5bb4c7[_0x787a('0xf')],_0x455dc4);_0x1593a2(_0x5ae13a[_0x787a('0xd')](0x1f4,_0x5bb4c7[_0x787a('0xf')]));});});};exports[_0x787a('0x17')]=function(_0x3d47e0){var _0x432f84=this;return new Promise(function(_0x1e671d,_0x4513c2){return db['SmsQueueReport'][_0x787a('0x18')](_0x3d47e0[_0x787a('0x19')],{'raw':_0x3d47e0[_0x787a('0x16')]?_0x3d47e0[_0x787a('0x16')][_0x787a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d47e0['options']?_0x3d47e0[_0x787a('0x16')][_0x787a('0x1b')]||null:null,'attributes':_0x3d47e0['options']?_0x3d47e0[_0x787a('0x16')]['attributes']||null:null,'limit':_0x3d47e0[_0x787a('0x16')]?_0x3d47e0[_0x787a('0x16')][_0x787a('0x1c')]||null:null})['then'](function(_0x242b23){logger['info']('UpdateSmsQueueReport',_0x3d47e0);logger['debug'](_0x787a('0x17'),_0x3d47e0,JSON['stringify'](_0x242b23));_0x1e671d(_0x242b23);})[_0x787a('0x12')](function(_0x36acb5){logger[_0x787a('0xd')](_0x787a('0x17'),_0x36acb5[_0x787a('0xf')],_0x3d47e0);_0x4513c2(_0x432f84[_0x787a('0xd')](0x1f4,_0x36acb5[_0x787a('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index c61870f..3eaa894 100644 --- a/server/api/smsTransferReport/index.js +++ b/server/api/smsTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe015=['../../components/interaction/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','index','describe','get','/:id','show','put','update','multer','util','path','Router','../../components/auth/service'];(function(_0x5e3f9c,_0x2aa1e4){var _0x4ffb8e=function(_0x3009e7){while(--_0x3009e7){_0x5e3f9c['push'](_0x5e3f9c['shift']());}};_0x4ffb8e(++_0x2aa1e4);}(_0xe015,0x13b));var _0x5e01=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xe015[_0x138adb];return _0x1b27f2;};'use strict';var multer=require(_0x5e01('0x0'));var util=require(_0x5e01('0x1'));var path=require(_0x5e01('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5e01('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5e01('0x4'));var interaction=require(_0x5e01('0x5'));var config=require(_0x5e01('0x6'));var controller=require(_0x5e01('0x7'));router['get']('/',auth[_0x5e01('0x8')](),controller[_0x5e01('0x9')]);router['get']('/describe',auth[_0x5e01('0x8')](),controller[_0x5e01('0xa')]);router[_0x5e01('0xb')](_0x5e01('0xc'),auth[_0x5e01('0x8')](),controller[_0x5e01('0xd')]);router['post']('/',auth[_0x5e01('0x8')](),controller['create']);router[_0x5e01('0xe')]('/:id',auth[_0x5e01('0x8')](),controller[_0x5e01('0xf')]);router['delete'](_0x5e01('0xc'),auth[_0x5e01('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x04de=['describe','get','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','/describe','isAuthenticated'];(function(_0xf1bff5,_0x22cb14){var _0x1efca6=function(_0x4d7616){while(--_0x4d7616){_0xf1bff5['push'](_0xf1bff5['shift']());}};_0x1efca6(++_0x22cb14);}(_0x04de,0x107));var _0xe04d=function(_0x496d67,_0x29bc5e){_0x496d67=_0x496d67-0x0;var _0x16fb91=_0x04de[_0x496d67];return _0x16fb91;};'use strict';var multer=require(_0xe04d('0x0'));var util=require(_0xe04d('0x1'));var path=require(_0xe04d('0x2'));var timeout=require(_0xe04d('0x3'));var express=require(_0xe04d('0x4'));var router=express[_0xe04d('0x5')]();var fs_extra=require(_0xe04d('0x6'));var auth=require(_0xe04d('0x7'));var interaction=require(_0xe04d('0x8'));var config=require(_0xe04d('0x9'));var controller=require(_0xe04d('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xe04d('0xb'),auth[_0xe04d('0xc')](),controller[_0xe04d('0xd')]);router[_0xe04d('0xe')](_0xe04d('0xf'),auth[_0xe04d('0xc')](),controller[_0xe04d('0x10')]);router[_0xe04d('0x11')]('/',auth['isAuthenticated'](),controller[_0xe04d('0x12')]);router[_0xe04d('0x13')](_0xe04d('0xf'),auth[_0xe04d('0xc')](),controller[_0xe04d('0x14')]);router[_0xe04d('0x15')](_0xe04d('0xf'),auth[_0xe04d('0xc')](),controller[_0xe04d('0x16')]);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 bf7a30a..59937a4 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x19044f,_0x35a8f7){var _0x2c3507=function(_0x452940){while(--_0x452940){_0x19044f['push'](_0x19044f['shift']());}};_0x2c3507(++_0x35a8f7);}(_0x00bb,0x1d8));var _0xb00b=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x00bb[_0x484e36];return _0xafc85d;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x35b87c,_0x166a8c){var _0x24795b=function(_0x2cb112){while(--_0x2cb112){_0x35b87c['push'](_0x35b87c['shift']());}};_0x24795b(++_0x166a8c);}(_0xf4eb,0xec));var _0xbf4e=function(_0x25eab7,_0x2ce211){_0x25eab7=_0x25eab7-0x0;var _0x19ceab=_0xf4eb[_0x25eab7];return _0x19ceab;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index ea19cab..5c636f4 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 _0x88d5=['fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','SmsTransferReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x88d5,0x12f));var _0x588d=function(_0x532ac3,_0x55e608){_0x532ac3=_0x532ac3-0x0;var _0x37bd3e=_0x88d5[_0x532ac3];return _0x37bd3e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x588d('0x0'));var jsonpatch=require(_0x588d('0x1'));var rp=require(_0x588d('0x2'));var moment=require(_0x588d('0x3'));var BPromise=require(_0x588d('0x4'));var Mustache=require(_0x588d('0x5'));var util=require(_0x588d('0x6'));var path=require('path');var sox=require(_0x588d('0x7'));var csv=require('to-csv');var ejs=require(_0x588d('0x8'));var fs=require('fs');var fs_extra=require(_0x588d('0x9'));var _=require(_0x588d('0xa'));var squel=require(_0x588d('0xb'));var crypto=require('crypto');var jsforce=require(_0x588d('0xc'));var deskjs=require(_0x588d('0xd'));var toCsv=require(_0x588d('0xe'));var querystring=require(_0x588d('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x588d('0x10'));var qs=require(_0x588d('0x11'));var as=require(_0x588d('0x12'));var hardwareService=require(_0x588d('0x13'));var logger=require(_0x588d('0x14'))(_0x588d('0x15'));var utils=require(_0x588d('0x16'));var config=require(_0x588d('0x17'));var licenseUtil=require(_0x588d('0x18'));var db=require(_0x588d('0x19'))['db'];function respondWithStatusCode(_0x221bee,_0x25be1b){_0x25be1b=_0x25be1b||0xcc;return function(_0x45e2b4){if(_0x45e2b4){return _0x221bee[_0x588d('0x1a')](_0x25be1b);}return _0x221bee[_0x588d('0x1b')](_0x25be1b)[_0x588d('0x1c')]();};}function respondWithResult(_0x42a17e,_0x38107f){_0x38107f=_0x38107f||0xc8;return function(_0x5c714b){if(_0x5c714b){return _0x42a17e[_0x588d('0x1b')](_0x38107f)[_0x588d('0x1d')](_0x5c714b);}};}function respondWithFilteredResult(_0x410599,_0x1e3708){return function(_0x15611c){if(_0x15611c){var _0x570120=typeof _0x1e3708[_0x588d('0x1e')]==='undefined'&&typeof _0x1e3708['limit']==='undefined';var _0x55765f=_0x15611c[_0x588d('0x1f')];var _0x566160=_0x570120?0x0:_0x1e3708['offset'];var _0x9d0767=_0x570120?_0x15611c[_0x588d('0x1f')]:_0x1e3708[_0x588d('0x1e')]+_0x1e3708['limit'];var _0x1e7b63;if(_0x9d0767>=_0x55765f){_0x9d0767=_0x55765f;_0x1e7b63=0xc8;}else{_0x1e7b63=0xce;}_0x410599[_0x588d('0x1b')](_0x1e7b63);return _0x410599[_0x588d('0x20')](_0x588d('0x21'),_0x566160+'-'+_0x9d0767+'/'+_0x55765f)[_0x588d('0x1d')](_0x15611c);}return null;};}function patchUpdates(_0x18cd25){return function(_0x5a6905){try{jsonpatch[_0x588d('0x22')](_0x5a6905,_0x18cd25,!![]);}catch(_0x36b9cc){return BPromise[_0x588d('0x23')](_0x36b9cc);}return _0x5a6905[_0x588d('0x24')]();};}function saveUpdates(_0x299c9f,_0x56538f){return function(_0x4e4f92){if(_0x4e4f92){return _0x4e4f92[_0x588d('0x25')](_0x299c9f)[_0x588d('0x26')](function(_0x3d77b0){return _0x3d77b0;});}return null;};}function removeEntity(_0x38b50b,_0x9cc20a){return function(_0x2baf2c){if(_0x2baf2c){return _0x2baf2c[_0x588d('0x27')]()[_0x588d('0x26')](function(){_0x38b50b[_0x588d('0x1b')](0xcc)[_0x588d('0x1c')]();});}};}function handleEntityNotFound(_0x2d84c5,_0x4d39ea){return function(_0x34de88){if(!_0x34de88){_0x2d84c5[_0x588d('0x1a')](0x194);}return _0x34de88;};}function handleError(_0x3e5e31,_0x500fcf){_0x500fcf=_0x500fcf||0x1f4;return function(_0x4a23a2){logger[_0x588d('0x28')](_0x4a23a2[_0x588d('0x29')]);if(_0x4a23a2[_0x588d('0x2a')]){delete _0x4a23a2[_0x588d('0x2a')];}_0x3e5e31['status'](_0x500fcf)[_0x588d('0x2b')](_0x4a23a2);};}exports['index']=function(_0x25222d,_0x1fd8cd){var _0x1be61b={},_0x16198d={},_0x2cb032={'count':0x0,'rows':[]};var _0x2f903b=_[_0x588d('0x2c')](db[_0x588d('0x2d')][_0x588d('0x2e')],function(_0x5425da){return{'name':_0x5425da[_0x588d('0x2f')],'type':_0x5425da[_0x588d('0x30')]['key']};});_0x16198d[_0x588d('0x31')]=_[_0x588d('0x2c')](_0x2f903b,'name');_0x16198d['query']=_['keys'](_0x25222d[_0x588d('0x32')]);_0x16198d[_0x588d('0x33')]=_[_0x588d('0x34')](_0x16198d[_0x588d('0x31')],_0x16198d[_0x588d('0x32')]);_0x1be61b[_0x588d('0x35')]=_[_0x588d('0x34')](_0x16198d[_0x588d('0x31')],qs[_0x588d('0x36')](_0x25222d[_0x588d('0x32')][_0x588d('0x36')]));_0x1be61b[_0x588d('0x35')]=_0x1be61b[_0x588d('0x35')][_0x588d('0x37')]?_0x1be61b['attributes']:_0x16198d['model'];if(!_0x25222d[_0x588d('0x32')][_0x588d('0x38')](_0x588d('0x39'))){_0x1be61b[_0x588d('0x3a')]=qs[_0x588d('0x3a')](_0x25222d[_0x588d('0x32')]['limit']);_0x1be61b['offset']=qs[_0x588d('0x1e')](_0x25222d[_0x588d('0x32')][_0x588d('0x1e')]);}_0x1be61b[_0x588d('0x3b')]=qs[_0x588d('0x3c')](_0x25222d['query'][_0x588d('0x3c')]);_0x1be61b[_0x588d('0x3d')]=qs['filters'](_[_0x588d('0x3e')](_0x25222d['query'],_0x16198d[_0x588d('0x33')]),_0x2f903b);if(_0x25222d[_0x588d('0x32')]['filter']){_0x1be61b[_0x588d('0x3d')]=_[_0x588d('0x3f')](_0x1be61b[_0x588d('0x3d')],{'$or':_[_0x588d('0x2c')](_0x2f903b,function(_0x81308b){if(_0x81308b[_0x588d('0x30')]!==_0x588d('0x40')){var _0x4cac73={};_0x4cac73[_0x81308b[_0x588d('0x2a')]]={'$like':'%'+_0x25222d[_0x588d('0x32')][_0x588d('0x41')]+'%'};return _0x4cac73;}})});}_0x1be61b=_['merge']({},_0x1be61b,_0x25222d[_0x588d('0x42')]);var _0x2ee006={'where':_0x1be61b['where']};return db['SmsTransferReport'][_0x588d('0x1f')](_0x2ee006)[_0x588d('0x26')](function(_0x669bd2){_0x2cb032[_0x588d('0x1f')]=_0x669bd2;if(_0x25222d['query'][_0x588d('0x43')]){_0x1be61b[_0x588d('0x44')]=[{'all':!![]}];}return db[_0x588d('0x2d')][_0x588d('0x45')](_0x1be61b);})[_0x588d('0x26')](function(_0x218bb2){_0x2cb032[_0x588d('0x46')]=_0x218bb2;return _0x2cb032;})[_0x588d('0x26')](respondWithFilteredResult(_0x1fd8cd,_0x1be61b))[_0x588d('0x47')](handleError(_0x1fd8cd,null));};exports[_0x588d('0x48')]=function(_0x842dfb,_0x22fd45){var _0x49c27e={'raw':!![],'where':{'id':_0x842dfb[_0x588d('0x49')]['id']}},_0x620eca={};_0x620eca[_0x588d('0x31')]=_[_0x588d('0x4a')](db[_0x588d('0x2d')][_0x588d('0x2e')]);_0x620eca[_0x588d('0x32')]=_['keys'](_0x842dfb[_0x588d('0x32')]);_0x620eca[_0x588d('0x33')]=_[_0x588d('0x34')](_0x620eca[_0x588d('0x31')],_0x620eca['query']);_0x49c27e['attributes']=_[_0x588d('0x34')](_0x620eca[_0x588d('0x31')],qs[_0x588d('0x36')](_0x842dfb[_0x588d('0x32')][_0x588d('0x36')]));_0x49c27e[_0x588d('0x35')]=_0x49c27e[_0x588d('0x35')][_0x588d('0x37')]?_0x49c27e[_0x588d('0x35')]:_0x620eca[_0x588d('0x31')];if(_0x842dfb[_0x588d('0x32')][_0x588d('0x43')]){_0x49c27e[_0x588d('0x44')]=[{'all':!![]}];}_0x49c27e=_[_0x588d('0x3f')]({},_0x49c27e,_0x842dfb[_0x588d('0x42')]);return db[_0x588d('0x2d')][_0x588d('0x4b')](_0x49c27e)['then'](handleEntityNotFound(_0x22fd45,null))['then'](respondWithResult(_0x22fd45,null))[_0x588d('0x47')](handleError(_0x22fd45,null));};exports['create']=function(_0xd8afba,_0x5ec0d6){return db['SmsTransferReport']['create'](_0xd8afba[_0x588d('0x4c')],{})['then'](respondWithResult(_0x5ec0d6,0xc9))[_0x588d('0x47')](handleError(_0x5ec0d6,null));};exports['update']=function(_0x3bdf2b,_0x265e34){if(_0x3bdf2b[_0x588d('0x4c')]['id']){delete _0x3bdf2b[_0x588d('0x4c')]['id'];}return db[_0x588d('0x2d')]['find']({'where':{'id':_0x3bdf2b[_0x588d('0x49')]['id']}})['then'](handleEntityNotFound(_0x265e34,null))[_0x588d('0x26')](saveUpdates(_0x3bdf2b['body'],null))[_0x588d('0x26')](respondWithResult(_0x265e34,null))['catch'](handleError(_0x265e34,null));};exports[_0x588d('0x27')]=function(_0x272496,_0x34ba46){return db[_0x588d('0x2d')]['find']({'where':{'id':_0x272496[_0x588d('0x49')]['id']}})[_0x588d('0x26')](handleEntityNotFound(_0x34ba46,null))[_0x588d('0x26')](removeEntity(_0x34ba46,null))[_0x588d('0x47')](handleError(_0x34ba46,null));};exports[_0x588d('0x4d')]=function(_0x2847e6,_0x5eb053){return db[_0x588d('0x2d')][_0x588d('0x4d')]()['then'](respondWithResult(_0x5eb053,null))[_0x588d('0x47')](handleError(_0x5eb053,null));}; \ No newline at end of file +var _0x2f7d=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','json','reject','save','update','then','stack','name','index','map','SmsTransferReport','rawAttributes','type','key','model','query','filters','intersection'];(function(_0x14e43e,_0x30ceec){var _0x56215b=function(_0x1f737c){while(--_0x1f737c){_0x14e43e['push'](_0x14e43e['shift']());}};_0x56215b(++_0x30ceec);}(_0x2f7d,0x1e2));var _0xd2f7=function(_0x4fea7b,_0x344493){_0x4fea7b=_0x4fea7b-0x0;var _0x4ceee0=_0x2f7d[_0x4fea7b];return _0x4ceee0;};'use strict';var emlformat=require(_0xd2f7('0x0'));var rimraf=require(_0xd2f7('0x1'));var zipdir=require(_0xd2f7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd2f7('0x3'));var moment=require('moment');var BPromise=require(_0xd2f7('0x4'));var Mustache=require('mustache');var util=require(_0xd2f7('0x5'));var path=require('path');var sox=require(_0xd2f7('0x6'));var csv=require('to-csv');var ejs=require(_0xd2f7('0x7'));var fs=require('fs');var fs_extra=require(_0xd2f7('0x8'));var _=require(_0xd2f7('0x9'));var squel=require(_0xd2f7('0xa'));var crypto=require(_0xd2f7('0xb'));var jsforce=require(_0xd2f7('0xc'));var deskjs=require(_0xd2f7('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd2f7('0xe'));var Redis=require(_0xd2f7('0xf'));var authService=require(_0xd2f7('0x10'));var qs=require(_0xd2f7('0x11'));var as=require(_0xd2f7('0x12'));var hardwareService=require(_0xd2f7('0x13'));var logger=require(_0xd2f7('0x14'))(_0xd2f7('0x15'));var utils=require(_0xd2f7('0x16'));var config=require(_0xd2f7('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd2f7('0x18'))['db'];function respondWithStatusCode(_0x59cf0a,_0x46353b){_0x46353b=_0x46353b||0xcc;return function(_0x2532b3){if(_0x2532b3){return _0x59cf0a[_0xd2f7('0x19')](_0x46353b);}return _0x59cf0a[_0xd2f7('0x1a')](_0x46353b)[_0xd2f7('0x1b')]();};}function respondWithResult(_0x505319,_0x41bc26){_0x41bc26=_0x41bc26||0xc8;return function(_0x58c7d8){if(_0x58c7d8){return _0x505319['status'](_0x41bc26)['json'](_0x58c7d8);}};}function respondWithFilteredResult(_0x5339c3,_0xeffbb5){return function(_0x1c65c8){if(_0x1c65c8){var _0x369573=typeof _0xeffbb5[_0xd2f7('0x1c')]===_0xd2f7('0x1d')&&typeof _0xeffbb5['limit']==='undefined';var _0x3061ac=_0x1c65c8[_0xd2f7('0x1e')];var _0x361202=_0x369573?0x0:_0xeffbb5['offset'];var _0x54e7ef=_0x369573?_0x1c65c8['count']:_0xeffbb5[_0xd2f7('0x1c')]+_0xeffbb5[_0xd2f7('0x1f')];var _0x425fd9;if(_0x54e7ef>=_0x3061ac){_0x54e7ef=_0x3061ac;_0x425fd9=0xc8;}else{_0x425fd9=0xce;}_0x5339c3[_0xd2f7('0x1a')](_0x425fd9);return _0x5339c3[_0xd2f7('0x20')]('Content-Range',_0x361202+'-'+_0x54e7ef+'/'+_0x3061ac)[_0xd2f7('0x21')](_0x1c65c8);}return null;};}function patchUpdates(_0x207fbb){return function(_0x30c4c1){try{jsonpatch['apply'](_0x30c4c1,_0x207fbb,!![]);}catch(_0x2736cb){return BPromise[_0xd2f7('0x22')](_0x2736cb);}return _0x30c4c1[_0xd2f7('0x23')]();};}function saveUpdates(_0x2566c8,_0x43d96a){return function(_0x24a478){if(_0x24a478){return _0x24a478[_0xd2f7('0x24')](_0x2566c8)[_0xd2f7('0x25')](function(_0x31df59){return _0x31df59;});}return null;};}function removeEntity(_0x1e9b0a,_0x1c433e){return function(_0x54faae){if(_0x54faae){return _0x54faae['destroy']()['then'](function(){_0x1e9b0a['status'](0xcc)[_0xd2f7('0x1b')]();});}};}function handleEntityNotFound(_0x103453,_0x3de4a9){return function(_0x32da0d){if(!_0x32da0d){_0x103453[_0xd2f7('0x19')](0x194);}return _0x32da0d;};}function handleError(_0x30bdc6,_0x16165a){_0x16165a=_0x16165a||0x1f4;return function(_0x2a1a7d){logger['error'](_0x2a1a7d[_0xd2f7('0x26')]);if(_0x2a1a7d[_0xd2f7('0x27')]){delete _0x2a1a7d['name'];}_0x30bdc6['status'](_0x16165a)['send'](_0x2a1a7d);};}exports[_0xd2f7('0x28')]=function(_0x9f5ad0,_0x267b5f){var _0x1b08f4={},_0x54ca98={},_0x5daa78={'count':0x0,'rows':[]};var _0x59c35d=_[_0xd2f7('0x29')](db[_0xd2f7('0x2a')][_0xd2f7('0x2b')],function(_0xb55717){return{'name':_0xb55717['fieldName'],'type':_0xb55717[_0xd2f7('0x2c')][_0xd2f7('0x2d')]};});_0x54ca98[_0xd2f7('0x2e')]=_[_0xd2f7('0x29')](_0x59c35d,'name');_0x54ca98[_0xd2f7('0x2f')]=_['keys'](_0x9f5ad0[_0xd2f7('0x2f')]);_0x54ca98[_0xd2f7('0x30')]=_[_0xd2f7('0x31')](_0x54ca98['model'],_0x54ca98[_0xd2f7('0x2f')]);_0x1b08f4[_0xd2f7('0x32')]=_[_0xd2f7('0x31')](_0x54ca98[_0xd2f7('0x2e')],qs[_0xd2f7('0x33')](_0x9f5ad0[_0xd2f7('0x2f')][_0xd2f7('0x33')]));_0x1b08f4[_0xd2f7('0x32')]=_0x1b08f4['attributes'][_0xd2f7('0x34')]?_0x1b08f4[_0xd2f7('0x32')]:_0x54ca98['model'];if(!_0x9f5ad0[_0xd2f7('0x2f')][_0xd2f7('0x35')](_0xd2f7('0x36'))){_0x1b08f4[_0xd2f7('0x1f')]=qs['limit'](_0x9f5ad0['query'][_0xd2f7('0x1f')]);_0x1b08f4['offset']=qs[_0xd2f7('0x1c')](_0x9f5ad0[_0xd2f7('0x2f')][_0xd2f7('0x1c')]);}_0x1b08f4[_0xd2f7('0x37')]=qs[_0xd2f7('0x38')](_0x9f5ad0[_0xd2f7('0x2f')][_0xd2f7('0x38')]);_0x1b08f4[_0xd2f7('0x39')]=qs[_0xd2f7('0x30')](_[_0xd2f7('0x3a')](_0x9f5ad0[_0xd2f7('0x2f')],_0x54ca98[_0xd2f7('0x30')]),_0x59c35d);if(_0x9f5ad0['query'][_0xd2f7('0x3b')]){_0x1b08f4[_0xd2f7('0x39')]=_['merge'](_0x1b08f4[_0xd2f7('0x39')],{'$or':_[_0xd2f7('0x29')](_0x59c35d,function(_0x2cc931){if(_0x2cc931[_0xd2f7('0x2c')]!==_0xd2f7('0x3c')){var _0x160401={};_0x160401[_0x2cc931[_0xd2f7('0x27')]]={'$like':'%'+_0x9f5ad0[_0xd2f7('0x2f')]['filter']+'%'};return _0x160401;}})});}_0x1b08f4=_[_0xd2f7('0x3d')]({},_0x1b08f4,_0x9f5ad0[_0xd2f7('0x3e')]);var _0x4a6750={'where':_0x1b08f4[_0xd2f7('0x39')]};return db[_0xd2f7('0x2a')][_0xd2f7('0x1e')](_0x4a6750)['then'](function(_0x466530){_0x5daa78[_0xd2f7('0x1e')]=_0x466530;if(_0x9f5ad0['query'][_0xd2f7('0x3f')]){_0x1b08f4[_0xd2f7('0x40')]=[{'all':!![]}];}return db['SmsTransferReport'][_0xd2f7('0x41')](_0x1b08f4);})[_0xd2f7('0x25')](function(_0x27b25a){_0x5daa78[_0xd2f7('0x42')]=_0x27b25a;return _0x5daa78;})[_0xd2f7('0x25')](respondWithFilteredResult(_0x267b5f,_0x1b08f4))[_0xd2f7('0x43')](handleError(_0x267b5f,null));};exports[_0xd2f7('0x44')]=function(_0x3663d3,_0x571fe9){var _0x5a9d82={'raw':!![],'where':{'id':_0x3663d3[_0xd2f7('0x45')]['id']}},_0x52900d={};_0x52900d[_0xd2f7('0x2e')]=_[_0xd2f7('0x46')](db['SmsTransferReport'][_0xd2f7('0x2b')]);_0x52900d[_0xd2f7('0x2f')]=_[_0xd2f7('0x46')](_0x3663d3[_0xd2f7('0x2f')]);_0x52900d[_0xd2f7('0x30')]=_[_0xd2f7('0x31')](_0x52900d[_0xd2f7('0x2e')],_0x52900d['query']);_0x5a9d82[_0xd2f7('0x32')]=_['intersection'](_0x52900d['model'],qs[_0xd2f7('0x33')](_0x3663d3['query']['fields']));_0x5a9d82[_0xd2f7('0x32')]=_0x5a9d82[_0xd2f7('0x32')][_0xd2f7('0x34')]?_0x5a9d82[_0xd2f7('0x32')]:_0x52900d[_0xd2f7('0x2e')];if(_0x3663d3[_0xd2f7('0x2f')]['includeAll']){_0x5a9d82['include']=[{'all':!![]}];}_0x5a9d82=_['merge']({},_0x5a9d82,_0x3663d3['options']);return db[_0xd2f7('0x2a')][_0xd2f7('0x47')](_0x5a9d82)[_0xd2f7('0x25')](handleEntityNotFound(_0x571fe9,null))['then'](respondWithResult(_0x571fe9,null))[_0xd2f7('0x43')](handleError(_0x571fe9,null));};exports[_0xd2f7('0x48')]=function(_0xacd659,_0x4d78da){return db[_0xd2f7('0x2a')]['create'](_0xacd659[_0xd2f7('0x49')],{})[_0xd2f7('0x25')](respondWithResult(_0x4d78da,0xc9))[_0xd2f7('0x43')](handleError(_0x4d78da,null));};exports['update']=function(_0x2122de,_0x565ea6){if(_0x2122de['body']['id']){delete _0x2122de[_0xd2f7('0x49')]['id'];}return db[_0xd2f7('0x2a')][_0xd2f7('0x47')]({'where':{'id':_0x2122de[_0xd2f7('0x45')]['id']}})[_0xd2f7('0x25')](handleEntityNotFound(_0x565ea6,null))[_0xd2f7('0x25')](saveUpdates(_0x2122de[_0xd2f7('0x49')],null))[_0xd2f7('0x25')](respondWithResult(_0x565ea6,null))[_0xd2f7('0x43')](handleError(_0x565ea6,null));};exports[_0xd2f7('0x4a')]=function(_0x587622,_0x1560fb){return db[_0xd2f7('0x2a')]['find']({'where':{'id':_0x587622['params']['id']}})[_0xd2f7('0x25')](handleEntityNotFound(_0x1560fb,null))['then'](removeEntity(_0x1560fb,null))[_0xd2f7('0x43')](handleError(_0x1560fb,null));};exports['describe']=function(_0x3c54ef,_0x4f6a72){return db[_0xd2f7('0x2a')][_0xd2f7('0x4b')]()['then'](respondWithResult(_0x4f6a72,null))[_0xd2f7('0x43')](handleError(_0x4f6a72,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 887164e..d649477 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 _0x44f6=['request-promise','path','rimraf','../../config/environment','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x2193d4,_0xf88f98){var _0x47dd1e=function(_0x1214b2){while(--_0x1214b2){_0x2193d4['push'](_0x2193d4['shift']());}};_0x47dd1e(++_0xf88f98);}(_0x44f6,0xa4));var _0x644f=function(_0x4d7379,_0x4b4e63){_0x4d7379=_0x4d7379-0x0;var _0x46d7cf=_0x44f6[_0x4d7379];return _0x46d7cf;};'use strict';var _=require(_0x644f('0x0'));var util=require(_0x644f('0x1'));var logger=require(_0x644f('0x2'))(_0x644f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x644f('0x4'));var fs=require('fs');var path=require(_0x644f('0x5'));var rimraf=require(_0x644f('0x6'));var config=require(_0x644f('0x7'));var attributes=require('./smsTransferReport.attributes');module['exports']=function(_0x1839b8,_0xb6b9b5){return _0x1839b8[_0x644f('0x8')](_0x644f('0x9'),attributes,{'tableName':_0x644f('0xa'),'paranoid':![],'indexes':[{'name':_0x644f('0xb'),'fields':[_0x644f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0d64=['report_sms_transfer','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport'];(function(_0x867b0a,_0x587ccf){var _0x137438=function(_0xbeafa6){while(--_0xbeafa6){_0x867b0a['push'](_0x867b0a['shift']());}};_0x137438(++_0x587ccf);}(_0x0d64,0x77));var _0x40d6=function(_0xb0975b,_0x93b0d6){_0xb0975b=_0xb0975b-0x0;var _0x320d30=_0x0d64[_0xb0975b];return _0x320d30;};'use strict';var _=require(_0x40d6('0x0'));var util=require('util');var logger=require(_0x40d6('0x1'))(_0x40d6('0x2'));var moment=require('moment');var BPromise=require(_0x40d6('0x3'));var rp=require(_0x40d6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x40d6('0x5'));var config=require(_0x40d6('0x6'));var attributes=require(_0x40d6('0x7'));module[_0x40d6('0x8')]=function(_0x1aace9,_0x2b8aae){return _0x1aace9[_0x40d6('0x9')](_0x40d6('0xa'),attributes,{'tableName':_0x40d6('0xb'),'paranoid':![],'indexes':[{'name':_0x40d6('0xc'),'fields':[_0x40d6('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index ec57171..a576fb8 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 _0x448b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x448b,0x125));var _0xb448=function(_0x26c4a5,_0xc6a23f){_0x26c4a5=_0x26c4a5-0x0;var _0x28183f=_0x448b[_0x26c4a5];return _0x28183f;};'use strict';var _=require(_0xb448('0x0'));var util=require(_0xb448('0x1'));var moment=require(_0xb448('0x2'));var BPromise=require(_0xb448('0x3'));var rs=require(_0xb448('0x4'));var fs=require('fs');var Redis=require(_0xb448('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb448('0x6'));var logger=require(_0xb448('0x7'))(_0xb448('0x8'));var config=require(_0xb448('0x9'));var jayson=require(_0xb448('0xa'));var client=jayson[_0xb448('0xb')][_0xb448('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5993ad,_0x2de6e5,_0x2f6f82){return new BPromise(function(_0x2c2bdd,_0x180c18){return client[_0xb448('0xd')](_0x5993ad,_0x2f6f82)[_0xb448('0xe')](function(_0x1e6e2f){logger[_0xb448('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x2de6e5,_0xb448('0x10'));logger[_0xb448('0x11')](_0xb448('0x12'),_0x2de6e5,_0xb448('0x10'),JSON[_0xb448('0x13')](_0x1e6e2f));if(_0x1e6e2f[_0xb448('0x14')]){if(_0x1e6e2f['error'][_0xb448('0x15')]===0x1f4){logger['error'](_0xb448('0x16'),_0x2de6e5,_0x1e6e2f[_0xb448('0x14')][_0xb448('0x17')]);return _0x180c18(_0x1e6e2f[_0xb448('0x14')][_0xb448('0x17')]);}logger[_0xb448('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x2de6e5,_0x1e6e2f[_0xb448('0x14')][_0xb448('0x17')]);return _0x2c2bdd(_0x1e6e2f[_0xb448('0x14')][_0xb448('0x17')]);}else{logger[_0xb448('0xf')](_0xb448('0x16'),_0x2de6e5,_0xb448('0x10'));_0x2c2bdd(_0x1e6e2f[_0xb448('0x18')][_0xb448('0x17')]);}})['catch'](function(_0x4a5fe5){logger[_0xb448('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x2de6e5,_0x4a5fe5);_0x180c18(_0x4a5fe5);});});} \ No newline at end of file +var _0xf4d9=['../../config/environment','client','http','then','info','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x1dfa63,_0x362bd4){var _0x26f2a9=function(_0x31cc52){while(--_0x31cc52){_0x1dfa63['push'](_0x1dfa63['shift']());}};_0x26f2a9(++_0x362bd4);}(_0xf4d9,0x7c));var _0x9f4d=function(_0x40c200,_0x1eeb4e){_0x40c200=_0x40c200-0x0;var _0x4a5c47=_0xf4d9[_0x40c200];return _0x4a5c47;};'use strict';var _=require(_0x9f4d('0x0'));var util=require('util');var moment=require(_0x9f4d('0x1'));var BPromise=require(_0x9f4d('0x2'));var rs=require(_0x9f4d('0x3'));var fs=require('fs');var Redis=require(_0x9f4d('0x4'));var db=require(_0x9f4d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9f4d('0x6'))(_0x9f4d('0x7'));var config=require(_0x9f4d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9f4d('0x9')][_0x9f4d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d7228,_0x4ee67d,_0x415499){return new BPromise(function(_0x55865b,_0x34fe3f){return client['request'](_0x2d7228,_0x415499)[_0x9f4d('0xb')](function(_0x451c00){logger[_0x9f4d('0xc')](_0x9f4d('0xd'),_0x4ee67d,'request\x20sent');logger[_0x9f4d('0xe')](_0x9f4d('0xf'),_0x4ee67d,_0x9f4d('0x10'),JSON[_0x9f4d('0x11')](_0x451c00));if(_0x451c00[_0x9f4d('0x12')]){if(_0x451c00[_0x9f4d('0x12')][_0x9f4d('0x13')]===0x1f4){logger[_0x9f4d('0x12')](_0x9f4d('0xd'),_0x4ee67d,_0x451c00[_0x9f4d('0x12')][_0x9f4d('0x14')]);return _0x34fe3f(_0x451c00['error'][_0x9f4d('0x14')]);}logger[_0x9f4d('0x12')](_0x9f4d('0xd'),_0x4ee67d,_0x451c00['error'][_0x9f4d('0x14')]);return _0x55865b(_0x451c00[_0x9f4d('0x12')][_0x9f4d('0x14')]);}else{logger[_0x9f4d('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x4ee67d,'request\x20sent');_0x55865b(_0x451c00['result'][_0x9f4d('0x14')]);}})[_0x9f4d('0x15')](function(_0x4526f0){logger[_0x9f4d('0x12')](_0x9f4d('0xd'),_0x4ee67d,_0x4526f0);_0x34fe3f(_0x4526f0);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 3362255..9cf7aa1 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 _0xdeac=['download','join','root','server/files/sounds/original/','originalname','replace','format','basename','now','extname','post','single','file','create','put','update','delete','multer','util','path','connect-timeout','express','Router','../../config/environment','./sound.controller','get','isAuthenticated','/:id','show','/:id/download'];(function(_0x147cb5,_0x3b4091){var _0x1eb3f0=function(_0x4a8737){while(--_0x4a8737){_0x147cb5['push'](_0x147cb5['shift']());}};_0x1eb3f0(++_0x3b4091);}(_0xdeac,0x1f1));var _0xcdea=function(_0x205030,_0x52652f){_0x205030=_0x205030-0x0;var _0x1a5831=_0xdeac[_0x205030];return _0x1a5831;};'use strict';var multer=require(_0xcdea('0x0'));var util=require(_0xcdea('0x1'));var path=require(_0xcdea('0x2'));var timeout=require(_0xcdea('0x3'));var express=require(_0xcdea('0x4'));var router=express[_0xcdea('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcdea('0x6'));var controller=require(_0xcdea('0x7'));router[_0xcdea('0x8')]('/',auth[_0xcdea('0x9')](),controller['index']);router[_0xcdea('0x8')](_0xcdea('0xa'),auth['isAuthenticated'](),controller[_0xcdea('0xb')]);router[_0xcdea('0x8')](_0xcdea('0xc'),auth[_0xcdea('0x9')](),controller[_0xcdea('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5275f4,_0x1b8dc8,_0x719903){_0x719903(null,path[_0xcdea('0xe')](config[_0xcdea('0xf')],_0xcdea('0x10')));},'filename':function(_0x10c13d,_0x5f5ae4,_0x600889){_0x5f5ae4[_0xcdea('0x11')]=_0x5f5ae4[_0xcdea('0x11')][_0xcdea('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x600889(null,util[_0xcdea('0x13')]('%s-%s%s',path[_0xcdea('0x14')](_0x5f5ae4[_0xcdea('0x11')],path['extname'](_0x5f5ae4[_0xcdea('0x11')])),Date[_0xcdea('0x15')](),path[_0xcdea('0x16')](_0x5f5ae4[_0xcdea('0x11')])));}})});router[_0xcdea('0x17')]('/',upload[_0xcdea('0x18')](_0xcdea('0x19')),controller[_0xcdea('0x1a')]);router[_0xcdea('0x1b')](_0xcdea('0xa'),auth['isAuthenticated'](),controller[_0xcdea('0x1c')]);router[_0xcdea('0x1d')](_0xcdea('0xa'),auth[_0xcdea('0x9')](),controller['delete']);module['exports']=router; \ No newline at end of file +var _0x14c6=['single','file','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/download','download','join','root','server/files/sounds/original/','originalname','replace','%s-%s%s','extname','now','post'];(function(_0x4eb2b5,_0x10d25c){var _0x305096=function(_0x4bde5f){while(--_0x4bde5f){_0x4eb2b5['push'](_0x4eb2b5['shift']());}};_0x305096(++_0x10d25c);}(_0x14c6,0x86));var _0x614c=function(_0x3a422c,_0x1c0e5d){_0x3a422c=_0x3a422c-0x0;var _0xbdde40=_0x14c6[_0x3a422c];return _0xbdde40;};'use strict';var multer=require(_0x614c('0x0'));var util=require(_0x614c('0x1'));var path=require(_0x614c('0x2'));var timeout=require(_0x614c('0x3'));var express=require(_0x614c('0x4'));var router=express[_0x614c('0x5')]();var fs_extra=require(_0x614c('0x6'));var auth=require(_0x614c('0x7'));var interaction=require(_0x614c('0x8'));var config=require(_0x614c('0x9'));var controller=require('./sound.controller');router['get']('/',auth[_0x614c('0xa')](),controller[_0x614c('0xb')]);router[_0x614c('0xc')](_0x614c('0xd'),auth[_0x614c('0xa')](),controller[_0x614c('0xe')]);router[_0x614c('0xc')](_0x614c('0xf'),auth['isAuthenticated'](),controller[_0x614c('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2e58e1,_0x1a4a14,_0x56de3f){_0x56de3f(null,path[_0x614c('0x11')](config[_0x614c('0x12')],_0x614c('0x13')));},'filename':function(_0x5386e6,_0x3c3f3e,_0x522777){_0x3c3f3e[_0x614c('0x14')]=_0x3c3f3e[_0x614c('0x14')][_0x614c('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x522777(null,util['format'](_0x614c('0x16'),path['basename'](_0x3c3f3e[_0x614c('0x14')],path[_0x614c('0x17')](_0x3c3f3e[_0x614c('0x14')])),Date[_0x614c('0x18')](),path[_0x614c('0x17')](_0x3c3f3e[_0x614c('0x14')])));}})});router[_0x614c('0x19')]('/',upload[_0x614c('0x1a')](_0x614c('0x1b')),controller['create']);router[_0x614c('0x1c')](_0x614c('0xd'),auth[_0x614c('0xa')](),controller[_0x614c('0x1d')]);router[_0x614c('0x1e')](_0x614c('0xd'),auth[_0x614c('0xa')](),controller['delete']);module[_0x614c('0x1f')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 83bd169..2a9f1ee 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 _0x5570=['STRING','name','BIGINT','INTEGER','FLOAT','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x5570,0x1cd));var _0x0557=function(_0x3b3295,_0x5d28d9){_0x3b3295=_0x3b3295-0x0;var _0x28f5e6=_0x5570[_0x3b3295];return _0x28f5e6;};'use strict';var Sequelize=require('sequelize');module[_0x0557('0x0')]={'name':{'type':Sequelize[_0x0557('0x1')],'unique':_0x0557('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x0557('0x1')]},'display_name':{'type':Sequelize[_0x0557('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x0557('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x0557('0x3')]},'original_channelCount':{'type':Sequelize[_0x0557('0x4')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x0557('0x1')]},'converted_duration':{'type':Sequelize[_0x0557('0x5')]},'converted_sampleCount':{'type':Sequelize[_0x0557('0x3')]},'converted_channelCount':{'type':Sequelize[_0x0557('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x0557('0x4')]}}; \ No newline at end of file +var _0x52d9=['exports','STRING','name','FLOAT','INTEGER','BIGINT','sequelize'];(function(_0x15e024,_0x552471){var _0x5747d5=function(_0x596a5d){while(--_0x596a5d){_0x15e024['push'](_0x15e024['shift']());}};_0x5747d5(++_0x552471);}(_0x52d9,0x68));var _0x952d=function(_0x4d8dc3,_0x585fd1){_0x4d8dc3=_0x4d8dc3-0x0;var _0x9b03d9=_0x52d9[_0x4d8dc3];return _0x9b03d9;};'use strict';var Sequelize=require(_0x952d('0x0'));module[_0x952d('0x1')]={'name':{'type':Sequelize[_0x952d('0x2')],'unique':_0x952d('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x952d('0x2')]},'display_name':{'type':Sequelize[_0x952d('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x952d('0x2')]},'original_format':{'type':Sequelize[_0x952d('0x2')]},'original_duration':{'type':Sequelize[_0x952d('0x4')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x952d('0x5')]},'original_bitRate':{'type':Sequelize[_0x952d('0x6')]},'original_sampleRate':{'type':Sequelize[_0x952d('0x5')]},'converted_format':{'type':Sequelize[_0x952d('0x2')]},'converted_duration':{'type':Sequelize[_0x952d('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x952d('0x6')]},'converted_channelCount':{'type':Sequelize[_0x952d('0x5')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x952d('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 672c8bf..ae48e84 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 _0x557c=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','then','destroy','get','Sounds','UserProfileResource','name','index','Sound','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','download','save_name','existsSync','join','root','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','format','converted_format','create','basename','file','extname','originalname','substring','server/files/sounds/original','filename','info','chmodSync','0777','transcode','wav','unlinkSync','send','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_bitRate','role','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','pick','description','delete','original_format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','fs-extra','squel','crypto'];(function(_0x33cfb4,_0x20e6e5){var _0x492910=function(_0x2c706d){while(--_0x2c706d){_0x33cfb4['push'](_0x33cfb4['shift']());}};_0x492910(++_0x20e6e5);}(_0x557c,0x70));var _0xc557=function(_0x1386a3,_0x13087c){_0x1386a3=_0x1386a3-0x0;var _0x3ba3c9=_0x557c[_0x1386a3];return _0x3ba3c9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc557('0x0'));var zipdir=require(_0xc557('0x1'));var jsonpatch=require(_0xc557('0x2'));var rp=require(_0xc557('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc557('0x4'));var path=require(_0xc557('0x5'));var sox=require('sox');var csv=require(_0xc557('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc557('0x7'));var _=require('lodash');var squel=require(_0xc557('0x8'));var crypto=require(_0xc557('0x9'));var jsforce=require(_0xc557('0xa'));var deskjs=require(_0xc557('0xb'));var toCsv=require(_0xc557('0x6'));var querystring=require(_0xc557('0xc'));var Papa=require(_0xc557('0xd'));var Redis=require(_0xc557('0xe'));var authService=require(_0xc557('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xc557('0x10'));var hardwareService=require(_0xc557('0x11'));var logger=require(_0xc557('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xc557('0x13'));var licenseUtil=require(_0xc557('0x14'));var db=require(_0xc557('0x15'))['db'];function respondWithStatusCode(_0x4793e4,_0x2fcdcd){_0x2fcdcd=_0x2fcdcd||0xcc;return function(_0x24b18e){if(_0x24b18e){return _0x4793e4[_0xc557('0x16')](_0x2fcdcd);}return _0x4793e4[_0xc557('0x17')](_0x2fcdcd)[_0xc557('0x18')]();};}function respondWithResult(_0x50859e,_0x4ffdf5){_0x4ffdf5=_0x4ffdf5||0xc8;return function(_0x25ab8f){if(_0x25ab8f){return _0x50859e[_0xc557('0x17')](_0x4ffdf5)['json'](_0x25ab8f);}};}function respondWithFilteredResult(_0x5b4986,_0x416e9a){return function(_0xf271cc){if(_0xf271cc){var _0xa7c240=typeof _0x416e9a[_0xc557('0x19')]===_0xc557('0x1a')&&typeof _0x416e9a[_0xc557('0x1b')]==='undefined';var _0x49d383=_0xf271cc[_0xc557('0x1c')];var _0x577643=_0xa7c240?0x0:_0x416e9a[_0xc557('0x19')];var _0x526c59=_0xa7c240?_0xf271cc[_0xc557('0x1c')]:_0x416e9a[_0xc557('0x19')]+_0x416e9a[_0xc557('0x1b')];var _0x47dc6b;if(_0x526c59>=_0x49d383){_0x526c59=_0x49d383;_0x47dc6b=0xc8;}else{_0x47dc6b=0xce;}_0x5b4986[_0xc557('0x17')](_0x47dc6b);return _0x5b4986['set'](_0xc557('0x1d'),_0x577643+'-'+_0x526c59+'/'+_0x49d383)[_0xc557('0x1e')](_0xf271cc);}return null;};}function patchUpdates(_0x57f8d5){return function(_0x4e52ac){try{jsonpatch[_0xc557('0x1f')](_0x4e52ac,_0x57f8d5,!![]);}catch(_0x32db4b){return BPromise[_0xc557('0x20')](_0x32db4b);}return _0x4e52ac['save']();};}function saveUpdates(_0x35899d,_0x450be6){return function(_0x39e539){if(_0x39e539){return _0x39e539['update'](_0x35899d)[_0xc557('0x21')](function(_0x3643f8){return _0x3643f8;});}return null;};}function removeEntity(_0x14fb36,_0x59315){return function(_0x1ac595){if(_0x1ac595){return _0x1ac595[_0xc557('0x22')]()[_0xc557('0x21')](function(){var _0x4522ba=_0x1ac595[_0xc557('0x23')]({'plain':!![]});var _0x2559ff=_0xc557('0x24');return db[_0xc557('0x25')][_0xc557('0x22')]({'where':{'type':_0x2559ff,'resourceId':_0x4522ba['id']}})[_0xc557('0x21')](function(){return _0x1ac595;});})[_0xc557('0x21')](function(){_0x14fb36[_0xc557('0x17')](0xcc)[_0xc557('0x18')]();});}};}function handleEntityNotFound(_0xc85d20,_0x3dcb02){return function(_0x33cc86){if(!_0x33cc86){_0xc85d20[_0xc557('0x16')](0x194);}return _0x33cc86;};}function handleError(_0x2c8e15,_0x1be31c){_0x1be31c=_0x1be31c||0x1f4;return function(_0x164ff8){logger['error'](_0x164ff8['stack']);if(_0x164ff8[_0xc557('0x26')]){delete _0x164ff8['name'];}_0x2c8e15[_0xc557('0x17')](_0x1be31c)['send'](_0x164ff8);};}exports[_0xc557('0x27')]=function(_0x58f3bc,_0x1030a2){var _0xebda30={},_0x7c67ba={},_0x49912a={'count':0x0,'rows':[]};var _0xf0e7e2=_['map'](db[_0xc557('0x28')]['rawAttributes'],function(_0x150802){return{'name':_0x150802[_0xc557('0x29')],'type':_0x150802[_0xc557('0x2a')][_0xc557('0x2b')]};});_0x7c67ba[_0xc557('0x2c')]=_['map'](_0xf0e7e2,_0xc557('0x26'));_0x7c67ba[_0xc557('0x2d')]=_['keys'](_0x58f3bc['query']);_0x7c67ba[_0xc557('0x2e')]=_[_0xc557('0x2f')](_0x7c67ba[_0xc557('0x2c')],_0x7c67ba['query']);_0xebda30[_0xc557('0x30')]=_[_0xc557('0x2f')](_0x7c67ba['model'],qs['fields'](_0x58f3bc[_0xc557('0x2d')][_0xc557('0x31')]));_0xebda30[_0xc557('0x30')]=_0xebda30[_0xc557('0x30')][_0xc557('0x32')]?_0xebda30['attributes']:_0x7c67ba[_0xc557('0x2c')];if(!_0x58f3bc[_0xc557('0x2d')][_0xc557('0x33')](_0xc557('0x34'))){_0xebda30[_0xc557('0x1b')]=qs[_0xc557('0x1b')](_0x58f3bc[_0xc557('0x2d')][_0xc557('0x1b')]);_0xebda30[_0xc557('0x19')]=qs[_0xc557('0x19')](_0x58f3bc[_0xc557('0x2d')][_0xc557('0x19')]);}_0xebda30[_0xc557('0x35')]=qs[_0xc557('0x36')](_0x58f3bc[_0xc557('0x2d')][_0xc557('0x36')]);_0xebda30[_0xc557('0x37')]=qs['filters'](_['pick'](_0x58f3bc[_0xc557('0x2d')],_0x7c67ba[_0xc557('0x2e')]),_0xf0e7e2);if(_0x58f3bc['query'][_0xc557('0x38')]){_0xebda30['where']=_['merge'](_0xebda30[_0xc557('0x37')],{'$or':_[_0xc557('0x39')](_0xf0e7e2,function(_0x353a53){if(_0x353a53[_0xc557('0x2a')]!==_0xc557('0x3a')){var _0x436595={};_0x436595[_0x353a53[_0xc557('0x26')]]={'$like':'%'+_0x58f3bc[_0xc557('0x2d')][_0xc557('0x38')]+'%'};return _0x436595;}})});}_0xebda30=_[_0xc557('0x3b')]({},_0xebda30,_0x58f3bc[_0xc557('0x3c')]);var _0x3fdaca={'where':_0xebda30[_0xc557('0x37')]};return db['Sound']['count'](_0x3fdaca)['then'](function(_0x28c798){_0x49912a['count']=_0x28c798;if(_0x58f3bc[_0xc557('0x2d')][_0xc557('0x3d')]){_0xebda30[_0xc557('0x3e')]=[{'all':!![]}];}return db[_0xc557('0x28')][_0xc557('0x3f')](_0xebda30);})[_0xc557('0x21')](function(_0x320580){_0x49912a[_0xc557('0x40')]=_0x320580;return _0x49912a;})[_0xc557('0x21')](respondWithFilteredResult(_0x1030a2,_0xebda30))[_0xc557('0x41')](handleError(_0x1030a2,null));};exports[_0xc557('0x42')]=function(_0x4aad05,_0x35a56e){var _0x1ee0cc={'raw':!![],'where':{'id':_0x4aad05[_0xc557('0x43')]['id']}},_0x910dc6={};_0x910dc6['model']=_[_0xc557('0x44')](db['Sound'][_0xc557('0x45')]);_0x910dc6['query']=_[_0xc557('0x44')](_0x4aad05['query']);_0x910dc6['filters']=_[_0xc557('0x2f')](_0x910dc6['model'],_0x910dc6[_0xc557('0x2d')]);_0x1ee0cc[_0xc557('0x30')]=_['intersection'](_0x910dc6[_0xc557('0x2c')],qs[_0xc557('0x31')](_0x4aad05[_0xc557('0x2d')][_0xc557('0x31')]));_0x1ee0cc[_0xc557('0x30')]=_0x1ee0cc['attributes'][_0xc557('0x32')]?_0x1ee0cc[_0xc557('0x30')]:_0x910dc6[_0xc557('0x2c')];if(_0x4aad05[_0xc557('0x2d')][_0xc557('0x3d')]){_0x1ee0cc[_0xc557('0x3e')]=[{'all':!![]}];}_0x1ee0cc=_['merge']({},_0x1ee0cc,_0x4aad05['options']);return db[_0xc557('0x28')][_0xc557('0x46')](_0x1ee0cc)['then'](handleEntityNotFound(_0x35a56e,null))[_0xc557('0x21')](respondWithResult(_0x35a56e,null))[_0xc557('0x41')](handleError(_0x35a56e,null));};exports[_0xc557('0x47')]=function(_0x43669d,_0x1ab464,_0x51284e){return db['Sound']['find']({'where':{'id':_0x43669d['params']['id']},'attributes':[_0xc557('0x26'),_0xc557('0x48'),'converted_format'],'raw':!![]})[_0xc557('0x21')](handleEntityNotFound(_0x1ab464,null))['then'](function(_0x1ecb05){if(_0x1ecb05){if(!fs[_0xc557('0x49')](path[_0xc557('0x4a')](config[_0xc557('0x4b')],_0xc557('0x4c'),_0x1ecb05[_0xc557('0x48')]+'.'+_0x1ecb05['converted_format']))){throw new db[(_0xc557('0x4d'))]['ValidationError'](_0xc557('0x4e'));}return _0x1ab464['download'](path[_0xc557('0x4a')](config['root'],_0xc557('0x4c'),util[_0xc557('0x4f')]('%s.%s',_0x1ecb05[_0xc557('0x48')],_0x1ecb05[_0xc557('0x50')])),util['format']('%s.%s',_0x1ecb05[_0xc557('0x26')],_0x1ecb05[_0xc557('0x50')]));}return null;})[_0xc557('0x41')](handleError(_0x1ab464,null));};exports[_0xc557('0x51')]=function(_0xc3b663,_0x48600c,_0xbd6051){var _0x4cbd76={'name':path[_0xc557('0x52')](_0xc3b663[_0xc557('0x53')]['originalname'],path[_0xc557('0x54')](_0xc3b663['file'][_0xc557('0x55')])),'save_name':path['basename'](_0xc3b663['file']['filename'],path[_0xc557('0x54')](_0xc3b663[_0xc557('0x53')]['filename'])),'original_format':path[_0xc557('0x54')](_0xc3b663[_0xc557('0x53')][_0xc557('0x55')])[_0xc557('0x56')](0x1),'converted_format':'wav'};var _0x22a118=path[_0xc557('0x4a')](config['root'],_0xc557('0x57'),_0xc3b663['file'][_0xc557('0x58')]);var _0xf81c34=path[_0xc557('0x4a')](config[_0xc557('0x4b')],'server/files/sounds/converted',util['format']('%s.%s',path[_0xc557('0x52')](_0xc3b663[_0xc557('0x53')][_0xc557('0x58')],path[_0xc557('0x54')](_0xc3b663['file']['filename'])),_0x4cbd76[_0xc557('0x50')]));logger[_0xc557('0x59')]('Sound\x20upload\x20filepath:\x20%s',_0x22a118);logger[_0xc557('0x59')]('Sound\x20upload\x20destination:\x20%s',_0xf81c34);try{fs[_0xc557('0x5a')](_0x22a118,parseInt(_0xc557('0x5b'),0x8));var _0x558102=sox[_0xc557('0x5c')](_0x22a118,_0xf81c34,{'sampleRate':0x1f40,'format':_0xc557('0x5d'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x558102['on']('error',function(_0x3d0551){fs[_0xc557('0x5e')](_0x22a118);_0x48600c[_0xc557('0x17')](0x1f4)[_0xc557('0x5f')](_0x3d0551);});_0x558102['on']('src',function(_0x1d755c){_0x4cbd76[_0xc557('0x60')]=isNaN(_0x1d755c['duration'])?null:_0x1d755c[_0xc557('0x61')]*0x3e8;_0x4cbd76[_0xc557('0x62')]=isNaN(_0x1d755c[_0xc557('0x63')])?null:_0x1d755c[_0xc557('0x63')];_0x4cbd76[_0xc557('0x64')]=isNaN(_0x1d755c[_0xc557('0x65')])?null:_0x1d755c[_0xc557('0x65')];_0x4cbd76[_0xc557('0x66')]=isNaN(_0x1d755c[_0xc557('0x67')])?null:_0x1d755c['bitRate'];_0x4cbd76[_0xc557('0x68')]=isNaN(_0x1d755c[_0xc557('0x69')])?null:_0x1d755c[_0xc557('0x69')];});_0x558102['on'](_0xc557('0x6a'),function(_0x2cb170){_0x4cbd76[_0xc557('0x6b')]=isNaN(_0x2cb170[_0xc557('0x61')])?null:_0x2cb170[_0xc557('0x61')]*0x3e8;_0x4cbd76['converted_sampleCount']=isNaN(_0x2cb170[_0xc557('0x63')])?null:_0x2cb170['sampleCount'];_0x4cbd76['converted_channelCount']=isNaN(_0x2cb170[_0xc557('0x65')])?null:_0x2cb170['channelCount'];_0x4cbd76[_0xc557('0x6c')]=isNaN(_0x2cb170[_0xc557('0x67')])?null:_0x2cb170[_0xc557('0x67')];_0x4cbd76['converted_sampleRate']=isNaN(_0x2cb170[_0xc557('0x69')])?null:_0x2cb170[_0xc557('0x69')];});_0x558102['on'](_0xc557('0x18'),function(){fs[_0xc557('0x5a')](_0xf81c34,parseInt(_0xc557('0x5b'),0x8));return db[_0xc557('0x28')][_0xc557('0x51')](_0x4cbd76)['then'](function(_0x5003b8){var _0x5a6b76={'role':_0xc3b663['body'][_0xc557('0x6d')],'userProfileId':_0xc3b663[_0xc557('0x6e')]['userProfileId']};if(!_0x5a6b76)throw new Error(_0xc557('0x6f'));if(_0x5a6b76[_0xc557('0x6d')]===_0xc557('0x70')){var _0x369323=_0x5003b8[_0xc557('0x23')]({'plain':!![]});return db['UserProfileSection'][_0xc557('0x46')]({'where':{'name':'Sounds','userProfileId':_0x5a6b76[_0xc557('0x71')]},'raw':!![]})[_0xc557('0x21')](function(_0x2e0759){if(_0x2e0759&&_0x2e0759[_0xc557('0x72')]===0x0){return db['UserProfileResource']['create']({'name':_0x369323[_0xc557('0x26')],'resourceId':_0x369323['id'],'type':_0x2e0759[_0xc557('0x26')],'sectionId':_0x2e0759['id']},{})[_0xc557('0x21')](function(){return _0x5003b8;});}else{return _0x5003b8;}})[_0xc557('0x41')](function(_0x3aaa61){logger['error'](_0xc557('0x73'),_0x3aaa61);throw _0x3aaa61;});}return _0x5003b8;})[_0xc557('0x21')](respondWithResult(_0x48600c,null))[_0xc557('0x41')](handleError(_0x48600c,null));});_0x558102[_0xc557('0x74')]();}catch(_0x55c000){_0x48600c['status'](0x1f4)[_0xc557('0x5f')](_0x55c000);}};exports[_0xc557('0x75')]=function(_0x5c9eee,_0x4f9873,_0x170a01){return db['Sound'][_0xc557('0x46')]({'where':{'id':_0x5c9eee['params']['id']}})[_0xc557('0x21')](handleEntityNotFound(_0x4f9873,null))[_0xc557('0x21')](saveUpdates(_[_0xc557('0x76')](_0x5c9eee[_0xc557('0x6e')],[_0xc557('0x26'),_0xc557('0x77')]),null))[_0xc557('0x21')](respondWithResult(_0x4f9873,null))[_0xc557('0x41')](handleError(_0x4f9873,null));};exports[_0xc557('0x78')]=function(_0x3abc20,_0x5057ff,_0x4b3ab7){return db[_0xc557('0x28')]['find']({'where':{'id':_0x3abc20['params']['id']}})['then'](function(_0x4f31f1){if(_0x4f31f1){return _0x4f31f1[_0xc557('0x22')]();}})[_0xc557('0x21')](function(_0x465467){var _0x39b503=path[_0xc557('0x4a')](config[_0xc557('0x4b')],_0xc557('0x57'),util[_0xc557('0x4f')]('%s.%s',_0x465467[_0xc557('0x48')],_0x465467[_0xc557('0x79')]));var _0x534153=path[_0xc557('0x4a')](config[_0xc557('0x4b')],_0xc557('0x4c'),util[_0xc557('0x4f')]('%s.%s',_0x465467[_0xc557('0x48')],_0x465467['converted_format']));fs['unlinkSync'](_0x39b503);fs['unlinkSync'](_0x534153);return _0x465467;})[_0xc557('0x21')](function(_0x36a608){if(_0x36a608){return _0x5057ff[_0xc557('0x17')](0xcc)[_0xc557('0x18')]();}})['then'](handleEntityNotFound(_0x5057ff,null))[_0xc557('0x41')](handleError(_0x5057ff,null));}; \ No newline at end of file +var _0xf3fa=['VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','format','%s.%s','basename','extname','file','filename','originalname','server/files/sounds/original','info','transcode','wav','unlinkSync','original_duration','duration','original_sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','sampleCount','converted_bitRate','converted_sampleRate','end','0777','create','body','role','userProfileId','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','ejs','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','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Sounds','UserProfileResource','sendStatus','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','type','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','sort','filters','pick','where','merge'];(function(_0x55fa9f,_0x22a9cd){var _0x185006=function(_0x2b6e63){while(--_0x2b6e63){_0x55fa9f['push'](_0x55fa9f['shift']());}};_0x185006(++_0x22a9cd);}(_0xf3fa,0x124));var _0xaf3f=function(_0x44c974,_0x1bcfde){_0x44c974=_0x44c974-0x0;var _0x5214c6=_0xf3fa[_0x44c974];return _0x5214c6;};'use strict';var emlformat=require(_0xaf3f('0x0'));var rimraf=require(_0xaf3f('0x1'));var zipdir=require(_0xaf3f('0x2'));var jsonpatch=require(_0xaf3f('0x3'));var rp=require(_0xaf3f('0x4'));var moment=require(_0xaf3f('0x5'));var BPromise=require(_0xaf3f('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xaf3f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xaf3f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xaf3f('0x9'));var crypto=require(_0xaf3f('0xa'));var jsforce=require(_0xaf3f('0xb'));var deskjs=require(_0xaf3f('0xc'));var toCsv=require('to-csv');var querystring=require(_0xaf3f('0xd'));var Papa=require(_0xaf3f('0xe'));var Redis=require(_0xaf3f('0xf'));var authService=require(_0xaf3f('0x10'));var qs=require(_0xaf3f('0x11'));var as=require(_0xaf3f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xaf3f('0x13'));var utils=require(_0xaf3f('0x14'));var config=require(_0xaf3f('0x15'));var licenseUtil=require(_0xaf3f('0x16'));var db=require(_0xaf3f('0x17'))['db'];function respondWithStatusCode(_0x3ea8f3,_0x5977c7){_0x5977c7=_0x5977c7||0xcc;return function(_0x147723){if(_0x147723){return _0x3ea8f3['sendStatus'](_0x5977c7);}return _0x3ea8f3[_0xaf3f('0x18')](_0x5977c7)['end']();};}function respondWithResult(_0xe6c85,_0x54275f){_0x54275f=_0x54275f||0xc8;return function(_0x3af852){if(_0x3af852){return _0xe6c85[_0xaf3f('0x18')](_0x54275f)[_0xaf3f('0x19')](_0x3af852);}};}function respondWithFilteredResult(_0x3d7009,_0x717229){return function(_0x2d5160){if(_0x2d5160){var _0x594aa5=typeof _0x717229[_0xaf3f('0x1a')]===_0xaf3f('0x1b')&&typeof _0x717229[_0xaf3f('0x1c')]===_0xaf3f('0x1b');var _0x2c6201=_0x2d5160[_0xaf3f('0x1d')];var _0x2327f6=_0x594aa5?0x0:_0x717229[_0xaf3f('0x1a')];var _0x1f0ad2=_0x594aa5?_0x2d5160[_0xaf3f('0x1d')]:_0x717229['offset']+_0x717229['limit'];var _0x3ada9f;if(_0x1f0ad2>=_0x2c6201){_0x1f0ad2=_0x2c6201;_0x3ada9f=0xc8;}else{_0x3ada9f=0xce;}_0x3d7009[_0xaf3f('0x18')](_0x3ada9f);return _0x3d7009[_0xaf3f('0x1e')](_0xaf3f('0x1f'),_0x2327f6+'-'+_0x1f0ad2+'/'+_0x2c6201)[_0xaf3f('0x19')](_0x2d5160);}return null;};}function patchUpdates(_0x37cd4d){return function(_0x5170f3){try{jsonpatch[_0xaf3f('0x20')](_0x5170f3,_0x37cd4d,!![]);}catch(_0x31c48b){return BPromise[_0xaf3f('0x21')](_0x31c48b);}return _0x5170f3[_0xaf3f('0x22')]();};}function saveUpdates(_0x5c8217,_0x535baf){return function(_0x466281){if(_0x466281){return _0x466281[_0xaf3f('0x23')](_0x5c8217)[_0xaf3f('0x24')](function(_0x17c677){return _0x17c677;});}return null;};}function removeEntity(_0x10efda,_0x10f713){return function(_0x3ac4a7){if(_0x3ac4a7){return _0x3ac4a7[_0xaf3f('0x25')]()[_0xaf3f('0x24')](function(){var _0x13a404=_0x3ac4a7[_0xaf3f('0x26')]({'plain':!![]});var _0x5127ee=_0xaf3f('0x27');return db[_0xaf3f('0x28')][_0xaf3f('0x25')]({'where':{'type':_0x5127ee,'resourceId':_0x13a404['id']}})[_0xaf3f('0x24')](function(){return _0x3ac4a7;});})[_0xaf3f('0x24')](function(){_0x10efda['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x8d1954,_0x4470e9){return function(_0x485996){if(!_0x485996){_0x8d1954[_0xaf3f('0x29')](0x194);}return _0x485996;};}function handleError(_0xcbde6e,_0x276f16){_0x276f16=_0x276f16||0x1f4;return function(_0x25663b){logger[_0xaf3f('0x2a')](_0x25663b[_0xaf3f('0x2b')]);if(_0x25663b[_0xaf3f('0x2c')]){delete _0x25663b[_0xaf3f('0x2c')];}_0xcbde6e[_0xaf3f('0x18')](_0x276f16)[_0xaf3f('0x2d')](_0x25663b);};}exports[_0xaf3f('0x2e')]=function(_0x47b35d,_0x26768d){var _0x4cf6d5={},_0x117e3a={},_0x153ae1={'count':0x0,'rows':[]};var _0x4e2048=_[_0xaf3f('0x2f')](db[_0xaf3f('0x30')][_0xaf3f('0x31')],function(_0x2af8af){return{'name':_0x2af8af[_0xaf3f('0x32')],'type':_0x2af8af[_0xaf3f('0x33')]['key']};});_0x117e3a['model']=_['map'](_0x4e2048,_0xaf3f('0x2c'));_0x117e3a[_0xaf3f('0x34')]=_[_0xaf3f('0x35')](_0x47b35d[_0xaf3f('0x34')]);_0x117e3a['filters']=_['intersection'](_0x117e3a[_0xaf3f('0x36')],_0x117e3a[_0xaf3f('0x34')]);_0x4cf6d5[_0xaf3f('0x37')]=_[_0xaf3f('0x38')](_0x117e3a['model'],qs[_0xaf3f('0x39')](_0x47b35d[_0xaf3f('0x34')]['fields']));_0x4cf6d5[_0xaf3f('0x37')]=_0x4cf6d5['attributes'][_0xaf3f('0x3a')]?_0x4cf6d5['attributes']:_0x117e3a['model'];if(!_0x47b35d['query'][_0xaf3f('0x3b')]('nolimit')){_0x4cf6d5['limit']=qs[_0xaf3f('0x1c')](_0x47b35d[_0xaf3f('0x34')]['limit']);_0x4cf6d5['offset']=qs['offset'](_0x47b35d['query'][_0xaf3f('0x1a')]);}_0x4cf6d5['order']=qs[_0xaf3f('0x3c')](_0x47b35d[_0xaf3f('0x34')][_0xaf3f('0x3c')]);_0x4cf6d5['where']=qs[_0xaf3f('0x3d')](_[_0xaf3f('0x3e')](_0x47b35d[_0xaf3f('0x34')],_0x117e3a[_0xaf3f('0x3d')]),_0x4e2048);if(_0x47b35d[_0xaf3f('0x34')]['filter']){_0x4cf6d5[_0xaf3f('0x3f')]=_[_0xaf3f('0x40')](_0x4cf6d5['where'],{'$or':_['map'](_0x4e2048,function(_0x37d6b4){if(_0x37d6b4[_0xaf3f('0x33')]!==_0xaf3f('0x41')){var _0x583671={};_0x583671[_0x37d6b4['name']]={'$like':'%'+_0x47b35d['query'][_0xaf3f('0x42')]+'%'};return _0x583671;}})});}_0x4cf6d5=_['merge']({},_0x4cf6d5,_0x47b35d[_0xaf3f('0x43')]);var _0x15ad54={'where':_0x4cf6d5['where']};return db[_0xaf3f('0x30')][_0xaf3f('0x1d')](_0x15ad54)[_0xaf3f('0x24')](function(_0x353ca8){_0x153ae1[_0xaf3f('0x1d')]=_0x353ca8;if(_0x47b35d[_0xaf3f('0x34')][_0xaf3f('0x44')]){_0x4cf6d5[_0xaf3f('0x45')]=[{'all':!![]}];}return db[_0xaf3f('0x30')][_0xaf3f('0x46')](_0x4cf6d5);})[_0xaf3f('0x24')](function(_0xe911bf){_0x153ae1[_0xaf3f('0x47')]=_0xe911bf;return _0x153ae1;})['then'](respondWithFilteredResult(_0x26768d,_0x4cf6d5))[_0xaf3f('0x48')](handleError(_0x26768d,null));};exports['show']=function(_0x100c62,_0x2970cb){var _0x4fb393={'raw':!![],'where':{'id':_0x100c62[_0xaf3f('0x49')]['id']}},_0x2e6808={};_0x2e6808['model']=_['keys'](db[_0xaf3f('0x30')][_0xaf3f('0x31')]);_0x2e6808[_0xaf3f('0x34')]=_[_0xaf3f('0x35')](_0x100c62[_0xaf3f('0x34')]);_0x2e6808[_0xaf3f('0x3d')]=_[_0xaf3f('0x38')](_0x2e6808[_0xaf3f('0x36')],_0x2e6808['query']);_0x4fb393[_0xaf3f('0x37')]=_[_0xaf3f('0x38')](_0x2e6808['model'],qs['fields'](_0x100c62[_0xaf3f('0x34')]['fields']));_0x4fb393[_0xaf3f('0x37')]=_0x4fb393[_0xaf3f('0x37')][_0xaf3f('0x3a')]?_0x4fb393[_0xaf3f('0x37')]:_0x2e6808[_0xaf3f('0x36')];if(_0x100c62[_0xaf3f('0x34')]['includeAll']){_0x4fb393[_0xaf3f('0x45')]=[{'all':!![]}];}_0x4fb393=_[_0xaf3f('0x40')]({},_0x4fb393,_0x100c62[_0xaf3f('0x43')]);return db[_0xaf3f('0x30')]['find'](_0x4fb393)[_0xaf3f('0x24')](handleEntityNotFound(_0x2970cb,null))['then'](respondWithResult(_0x2970cb,null))[_0xaf3f('0x48')](handleError(_0x2970cb,null));};exports[_0xaf3f('0x4a')]=function(_0x2ce68f,_0x5c356a,_0x35b817){return db['Sound']['find']({'where':{'id':_0x2ce68f['params']['id']},'attributes':['name',_0xaf3f('0x4b'),_0xaf3f('0x4c')],'raw':!![]})['then'](handleEntityNotFound(_0x5c356a,null))[_0xaf3f('0x24')](function(_0x4d594e){if(_0x4d594e){if(!fs[_0xaf3f('0x4d')](path[_0xaf3f('0x4e')](config[_0xaf3f('0x4f')],_0xaf3f('0x50'),_0x4d594e[_0xaf3f('0x4b')]+'.'+_0x4d594e[_0xaf3f('0x4c')]))){throw new db['Sequelize']['ValidationError']('Sound\x20not\x20found');}return _0x5c356a[_0xaf3f('0x4a')](path['join'](config[_0xaf3f('0x4f')],_0xaf3f('0x50'),util[_0xaf3f('0x51')](_0xaf3f('0x52'),_0x4d594e['save_name'],_0x4d594e['converted_format'])),util['format']('%s.%s',_0x4d594e['name'],_0x4d594e[_0xaf3f('0x4c')]));}return null;})[_0xaf3f('0x48')](handleError(_0x5c356a,null));};exports['create']=function(_0x2cdae8,_0x50f852,_0x46337e){var _0x1309b4={'name':path[_0xaf3f('0x53')](_0x2cdae8['file']['originalname'],path[_0xaf3f('0x54')](_0x2cdae8[_0xaf3f('0x55')]['originalname'])),'save_name':path[_0xaf3f('0x53')](_0x2cdae8[_0xaf3f('0x55')][_0xaf3f('0x56')],path[_0xaf3f('0x54')](_0x2cdae8[_0xaf3f('0x55')][_0xaf3f('0x56')])),'original_format':path[_0xaf3f('0x54')](_0x2cdae8[_0xaf3f('0x55')][_0xaf3f('0x57')])['substring'](0x1),'converted_format':'wav'};var _0x24bf5d=path[_0xaf3f('0x4e')](config['root'],_0xaf3f('0x58'),_0x2cdae8[_0xaf3f('0x55')][_0xaf3f('0x56')]);var _0x156c6f=path[_0xaf3f('0x4e')](config[_0xaf3f('0x4f')],_0xaf3f('0x50'),util['format']('%s.%s',path['basename'](_0x2cdae8['file'][_0xaf3f('0x56')],path[_0xaf3f('0x54')](_0x2cdae8[_0xaf3f('0x55')][_0xaf3f('0x56')])),_0x1309b4[_0xaf3f('0x4c')]));logger[_0xaf3f('0x59')]('Sound\x20upload\x20filepath:\x20%s',_0x24bf5d);logger[_0xaf3f('0x59')]('Sound\x20upload\x20destination:\x20%s',_0x156c6f);try{fs['chmodSync'](_0x24bf5d,parseInt('0777',0x8));var _0x55ffa8=sox[_0xaf3f('0x5a')](_0x24bf5d,_0x156c6f,{'sampleRate':0x1f40,'format':_0xaf3f('0x5b'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x55ffa8['on']('error',function(_0x65c0ed){fs[_0xaf3f('0x5c')](_0x24bf5d);_0x50f852[_0xaf3f('0x18')](0x1f4)[_0xaf3f('0x2d')](_0x65c0ed);});_0x55ffa8['on']('src',function(_0x1e7323){_0x1309b4[_0xaf3f('0x5d')]=isNaN(_0x1e7323['duration'])?null:_0x1e7323[_0xaf3f('0x5e')]*0x3e8;_0x1309b4[_0xaf3f('0x5f')]=isNaN(_0x1e7323['sampleCount'])?null:_0x1e7323['sampleCount'];_0x1309b4[_0xaf3f('0x60')]=isNaN(_0x1e7323[_0xaf3f('0x61')])?null:_0x1e7323[_0xaf3f('0x61')];_0x1309b4[_0xaf3f('0x62')]=isNaN(_0x1e7323[_0xaf3f('0x63')])?null:_0x1e7323[_0xaf3f('0x63')];_0x1309b4[_0xaf3f('0x64')]=isNaN(_0x1e7323[_0xaf3f('0x65')])?null:_0x1e7323[_0xaf3f('0x65')];});_0x55ffa8['on'](_0xaf3f('0x66'),function(_0x2daf52){_0x1309b4[_0xaf3f('0x67')]=isNaN(_0x2daf52[_0xaf3f('0x5e')])?null:_0x2daf52[_0xaf3f('0x5e')]*0x3e8;_0x1309b4[_0xaf3f('0x68')]=isNaN(_0x2daf52[_0xaf3f('0x69')])?null:_0x2daf52[_0xaf3f('0x69')];_0x1309b4['converted_channelCount']=isNaN(_0x2daf52[_0xaf3f('0x61')])?null:_0x2daf52[_0xaf3f('0x61')];_0x1309b4[_0xaf3f('0x6a')]=isNaN(_0x2daf52[_0xaf3f('0x63')])?null:_0x2daf52[_0xaf3f('0x63')];_0x1309b4[_0xaf3f('0x6b')]=isNaN(_0x2daf52[_0xaf3f('0x65')])?null:_0x2daf52['sampleRate'];});_0x55ffa8['on'](_0xaf3f('0x6c'),function(){fs['chmodSync'](_0x156c6f,parseInt(_0xaf3f('0x6d'),0x8));return db['Sound'][_0xaf3f('0x6e')](_0x1309b4)[_0xaf3f('0x24')](function(_0x305621){var _0x2502f4={'role':_0x2cdae8[_0xaf3f('0x6f')][_0xaf3f('0x70')],'userProfileId':_0x2cdae8['body'][_0xaf3f('0x71')]};if(!_0x2502f4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2502f4[_0xaf3f('0x70')]==='user'){var _0xed87ac=_0x305621[_0xaf3f('0x26')]({'plain':!![]});return db['UserProfileSection'][_0xaf3f('0x72')]({'where':{'name':_0xaf3f('0x27'),'userProfileId':_0x2502f4[_0xaf3f('0x71')]},'raw':!![]})[_0xaf3f('0x24')](function(_0x383526){if(_0x383526&&_0x383526[_0xaf3f('0x73')]===0x0){return db[_0xaf3f('0x28')][_0xaf3f('0x6e')]({'name':_0xed87ac[_0xaf3f('0x2c')],'resourceId':_0xed87ac['id'],'type':_0x383526['name'],'sectionId':_0x383526['id']},{})['then'](function(){return _0x305621;});}else{return _0x305621;}})[_0xaf3f('0x48')](function(_0x44d4aa){logger['error'](_0xaf3f('0x74'),_0x44d4aa);throw _0x44d4aa;});}return _0x305621;})[_0xaf3f('0x24')](respondWithResult(_0x50f852,null))[_0xaf3f('0x48')](handleError(_0x50f852,null));});_0x55ffa8[_0xaf3f('0x75')]();}catch(_0x2e62ed){_0x50f852['status'](0x1f4)[_0xaf3f('0x2d')](_0x2e62ed);}};exports[_0xaf3f('0x23')]=function(_0x566a79,_0x2493d5,_0x1f88e2){return db[_0xaf3f('0x30')][_0xaf3f('0x72')]({'where':{'id':_0x566a79[_0xaf3f('0x49')]['id']}})['then'](handleEntityNotFound(_0x2493d5,null))['then'](saveUpdates(_['pick'](_0x566a79[_0xaf3f('0x6f')],[_0xaf3f('0x2c'),_0xaf3f('0x76')]),null))[_0xaf3f('0x24')](respondWithResult(_0x2493d5,null))['catch'](handleError(_0x2493d5,null));};exports['delete']=function(_0x23c98c,_0x46d3b3,_0x3aac9c){return db['Sound'][_0xaf3f('0x72')]({'where':{'id':_0x23c98c[_0xaf3f('0x49')]['id']}})['then'](function(_0x29e47f){if(_0x29e47f){return _0x29e47f[_0xaf3f('0x25')]();}})[_0xaf3f('0x24')](function(_0x1424a9){var _0x2a3a3d=path[_0xaf3f('0x4e')](config[_0xaf3f('0x4f')],'server/files/sounds/original',util['format']('%s.%s',_0x1424a9[_0xaf3f('0x4b')],_0x1424a9['original_format']));var _0x45fe57=path[_0xaf3f('0x4e')](config[_0xaf3f('0x4f')],_0xaf3f('0x50'),util[_0xaf3f('0x51')](_0xaf3f('0x52'),_0x1424a9['save_name'],_0x1424a9['converted_format']));fs[_0xaf3f('0x5c')](_0x2a3a3d);fs[_0xaf3f('0x5c')](_0x45fe57);return _0x1424a9;})[_0xaf3f('0x24')](function(_0x281238){if(_0x281238){return _0x46d3b3[_0xaf3f('0x18')](0xcc)[_0xaf3f('0x6c')]();}})[_0xaf3f('0x24')](handleEntityNotFound(_0x46d3b3,null))['catch'](handleError(_0x46d3b3,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index f3cadf1..a1aaaaa 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 _0xf7be=['Sound','bluebird','path','./sound.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf7be,0x1f3));var _0xef7b=function(_0x4becbc,_0x175cf4){_0x4becbc=_0x4becbc-0x0;var _0x2f160d=_0xf7be[_0x4becbc];return _0x2f160d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xef7b('0x0'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xef7b('0x1'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xef7b('0x2'));module[_0xef7b('0x3')]=function(_0x31d50f,_0x3e9560){return _0x31d50f[_0xef7b('0x4')](_0xef7b('0x5'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2994=['rimraf','../../config/environment','./sound.attributes','Sound','tools_sounds','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xecf3e8,_0x3be976){var _0x41d60c=function(_0x4ae923){while(--_0x4ae923){_0xecf3e8['push'](_0xecf3e8['shift']());}};_0x41d60c(++_0x3be976);}(_0x2994,0x164));var _0x4299=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x2994[_0x5317b5];return _0x3b7ce2;};'use strict';var _=require(_0x4299('0x0'));var util=require(_0x4299('0x1'));var logger=require(_0x4299('0x2'))(_0x4299('0x3'));var moment=require(_0x4299('0x4'));var BPromise=require(_0x4299('0x5'));var rp=require(_0x4299('0x6'));var fs=require('fs');var path=require(_0x4299('0x7'));var rimraf=require(_0x4299('0x8'));var config=require(_0x4299('0x9'));var attributes=require(_0x4299('0xa'));module['exports']=function(_0x233b87,_0x28c301){return _0x233b87['define'](_0x4299('0xb'),attributes,{'tableName':_0x4299('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index ecb73ea..b3aa709 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 _0xfeb6=['request','then','info','Sound,\x20%s,\x20%s','debug','request\x20sent','error','code','message','ShowSound','Sound','find','options','where','attributes','include','map','model','stringify','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xfeb6,0xaa));var _0x6feb=function(_0x1a68fc,_0x5e4468){_0x1a68fc=_0x1a68fc-0x0;var _0x19afc2=_0xfeb6[_0x1a68fc];return _0x19afc2;};'use strict';var _=require(_0x6feb('0x0'));var util=require(_0x6feb('0x1'));var moment=require(_0x6feb('0x2'));var BPromise=require('bluebird');var rs=require(_0x6feb('0x3'));var fs=require('fs');var Redis=require(_0x6feb('0x4'));var db=require(_0x6feb('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x6feb('0x6'));var jayson=require(_0x6feb('0x7'));var client=jayson[_0x6feb('0x8')][_0x6feb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1114f0,_0x451c4c,_0x356dcb){return new BPromise(function(_0x1f0642,_0x12a5da){return client[_0x6feb('0xa')](_0x1114f0,_0x356dcb)[_0x6feb('0xb')](function(_0x4d9889){logger[_0x6feb('0xc')](_0x6feb('0xd'),_0x451c4c,'request\x20sent');logger[_0x6feb('0xe')]('Sound,\x20%s,\x20%s,\x20%s',_0x451c4c,_0x6feb('0xf'),JSON['stringify'](_0x4d9889));if(_0x4d9889[_0x6feb('0x10')]){if(_0x4d9889[_0x6feb('0x10')][_0x6feb('0x11')]===0x1f4){logger[_0x6feb('0x10')](_0x6feb('0xd'),_0x451c4c,_0x4d9889['error'][_0x6feb('0x12')]);return _0x12a5da(_0x4d9889['error'][_0x6feb('0x12')]);}logger[_0x6feb('0x10')]('Sound,\x20%s,\x20%s',_0x451c4c,_0x4d9889[_0x6feb('0x10')][_0x6feb('0x12')]);return _0x1f0642(_0x4d9889[_0x6feb('0x10')][_0x6feb('0x12')]);}else{logger[_0x6feb('0xc')](_0x6feb('0xd'),_0x451c4c,_0x6feb('0xf'));_0x1f0642(_0x4d9889['result'][_0x6feb('0x12')]);}})['catch'](function(_0x207465){logger[_0x6feb('0x10')](_0x6feb('0xd'),_0x451c4c,_0x207465);_0x12a5da(_0x207465);});});}exports[_0x6feb('0x13')]=function(_0x44da17){var _0x48408b=this;return new Promise(function(_0x421d19,_0x56e92f){return db[_0x6feb('0x14')][_0x6feb('0x15')]({'raw':_0x44da17[_0x6feb('0x16')]?_0x44da17['options']['raw']===undefined?!![]:![]:!![],'where':_0x44da17[_0x6feb('0x16')]?_0x44da17[_0x6feb('0x16')][_0x6feb('0x17')]||null:null,'attributes':_0x44da17['options']?_0x44da17[_0x6feb('0x16')][_0x6feb('0x18')]||null:null,'include':_0x44da17[_0x6feb('0x16')]?_0x44da17[_0x6feb('0x16')][_0x6feb('0x19')]?_[_0x6feb('0x1a')](_0x44da17[_0x6feb('0x16')][_0x6feb('0x19')],function(_0x1f75a2){return{'model':db[_0x1f75a2[_0x6feb('0x1b')]],'as':_0x1f75a2['as'],'attributes':_0x1f75a2[_0x6feb('0x18')],'include':_0x1f75a2[_0x6feb('0x19')]?_['map'](_0x1f75a2['include'],function(_0x2f9d93){return{'model':db[_0x2f9d93[_0x6feb('0x1b')]],'as':_0x2f9d93['as'],'attributes':_0x2f9d93[_0x6feb('0x18')],'include':_0x2f9d93[_0x6feb('0x19')]?_['map'](_0x2f9d93[_0x6feb('0x19')],function(_0x205667){return{'model':db[_0x205667['model']],'as':_0x205667['as'],'attributes':_0x205667[_0x6feb('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6feb('0xb')](function(_0x264e31){logger[_0x6feb('0xc')]('ShowSound',_0x44da17);logger['debug'](_0x6feb('0x13'),_0x44da17,JSON[_0x6feb('0x1c')](_0x264e31));_0x421d19(_0x264e31);})[_0x6feb('0x1d')](function(_0x5d2a99){logger[_0x6feb('0x10')](_0x6feb('0x13'),_0x5d2a99[_0x6feb('0x12')],_0x44da17);_0x56e92f(_0x48408b[_0x6feb('0x10')](0x1f4,_0x5d2a99[_0x6feb('0x12')]));});});}; \ No newline at end of file +var _0x7cc2=['util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','info','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','Sound,\x20%s,\x20%s','message','request\x20sent','catch','Sound','options','raw','attributes','include','model','map','then','ShowSound'];(function(_0x28407a,_0x2a7269){var _0x8bd6ef=function(_0x3c886f){while(--_0x3c886f){_0x28407a['push'](_0x28407a['shift']());}};_0x8bd6ef(++_0x2a7269);}(_0x7cc2,0x1cb));var _0x27cc=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x7cc2[_0x1928c9];return _0x51b5fb;};'use strict';var _=require('lodash');var util=require(_0x27cc('0x0'));var moment=require(_0x27cc('0x1'));var BPromise=require(_0x27cc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x27cc('0x3'));var db=require(_0x27cc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x27cc('0x5'))(_0x27cc('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x27cc('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3edd8d,_0x553572,_0x186cfa){return new BPromise(function(_0x1d6f27,_0x4fa353){return client['request'](_0x3edd8d,_0x186cfa)['then'](function(_0x5af9e4){logger[_0x27cc('0x8')]('Sound,\x20%s,\x20%s',_0x553572,'request\x20sent');logger[_0x27cc('0x9')](_0x27cc('0xa'),_0x553572,'request\x20sent',JSON[_0x27cc('0xb')](_0x5af9e4));if(_0x5af9e4[_0x27cc('0xc')]){if(_0x5af9e4[_0x27cc('0xc')][_0x27cc('0xd')]===0x1f4){logger[_0x27cc('0xc')](_0x27cc('0xe'),_0x553572,_0x5af9e4[_0x27cc('0xc')]['message']);return _0x4fa353(_0x5af9e4[_0x27cc('0xc')][_0x27cc('0xf')]);}logger['error'](_0x27cc('0xe'),_0x553572,_0x5af9e4[_0x27cc('0xc')][_0x27cc('0xf')]);return _0x1d6f27(_0x5af9e4[_0x27cc('0xc')][_0x27cc('0xf')]);}else{logger[_0x27cc('0x8')]('Sound,\x20%s,\x20%s',_0x553572,_0x27cc('0x10'));_0x1d6f27(_0x5af9e4['result'][_0x27cc('0xf')]);}})[_0x27cc('0x11')](function(_0x2b2bde){logger[_0x27cc('0xc')](_0x27cc('0xe'),_0x553572,_0x2b2bde);_0x4fa353(_0x2b2bde);});});}exports['ShowSound']=function(_0x249abb){var _0x21ffc2=this;return new Promise(function(_0xaeb0e9,_0x21897c){return db[_0x27cc('0x12')]['find']({'raw':_0x249abb[_0x27cc('0x13')]?_0x249abb[_0x27cc('0x13')][_0x27cc('0x14')]===undefined?!![]:![]:!![],'where':_0x249abb['options']?_0x249abb[_0x27cc('0x13')]['where']||null:null,'attributes':_0x249abb[_0x27cc('0x13')]?_0x249abb[_0x27cc('0x13')][_0x27cc('0x15')]||null:null,'include':_0x249abb[_0x27cc('0x13')]?_0x249abb[_0x27cc('0x13')][_0x27cc('0x16')]?_['map'](_0x249abb['options']['include'],function(_0x1b1c79){return{'model':db[_0x1b1c79[_0x27cc('0x17')]],'as':_0x1b1c79['as'],'attributes':_0x1b1c79[_0x27cc('0x15')],'include':_0x1b1c79[_0x27cc('0x16')]?_[_0x27cc('0x18')](_0x1b1c79['include'],function(_0x438954){return{'model':db[_0x438954[_0x27cc('0x17')]],'as':_0x438954['as'],'attributes':_0x438954[_0x27cc('0x15')],'include':_0x438954[_0x27cc('0x16')]?_['map'](_0x438954[_0x27cc('0x16')],function(_0x16385f){return{'model':db[_0x16385f[_0x27cc('0x17')]],'as':_0x16385f['as'],'attributes':_0x16385f[_0x27cc('0x15')]};}):[]};}):[]};}):[]:[]})[_0x27cc('0x19')](function(_0x2af1a8){logger[_0x27cc('0x8')](_0x27cc('0x1a'),_0x249abb);logger[_0x27cc('0x9')](_0x27cc('0x1a'),_0x249abb,JSON[_0x27cc('0xb')](_0x2af1a8));_0xaeb0e9(_0x2af1a8);})[_0x27cc('0x11')](function(_0x546343){logger[_0x27cc('0xc')](_0x27cc('0x1a'),_0x546343[_0x27cc('0xf')],_0x249abb);_0x21897c(_0x21ffc2[_0x27cc('0xc')](0x1f4,_0x546343[_0x27cc('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 9ede6fe..1e1601c 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 _0xbaf0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x4fd14f,_0x4f40e5){var _0x377eb0=function(_0x127e9e){while(--_0x127e9e){_0x4fd14f['push'](_0x4fd14f['shift']());}};_0x377eb0(++_0x4f40e5);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0xd')]('/',auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);module[_0x0baf('0x13')]=router; \ No newline at end of file +var _0x5eb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0x2486a2,_0x206896){var _0x2248fa=function(_0x4b4bcb){while(--_0x4b4bcb){_0x2486a2['push'](_0x2486a2['shift']());}};_0x2248fa(++_0x206896);}(_0x5eb8,0xb0));var _0x85eb=function(_0x1fd9e7,_0x24cdbe){_0x1fd9e7=_0x1fd9e7-0x0;var _0x1781f2=_0x5eb8[_0x1fd9e7];return _0x1781f2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['post']('/',auth[_0x85eb('0xa')](),controller['create']);router[_0x85eb('0xe')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xf')]);router[_0x85eb('0x10')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['destroy']);module[_0x85eb('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 9b2bf0b..c188913 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 _0x0ff1=['ENUM','STRING','medium'];(function(_0x58b2d5,_0x1817a2){var _0x5d3b6f=function(_0x52781b){while(--_0x52781b){_0x58b2d5['push'](_0x58b2d5['shift']());}};_0x5d3b6f(++_0x1817a2);}(_0x0ff1,0xb2));var _0x10ff=function(_0x31bab3,_0x44554f){_0x31bab3=_0x31bab3-0x0;var _0x4fd382=_0x0ff1[_0x31bab3];return _0x4fd382;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x10ff('0x0')]},'body':{'type':Sequelize['TEXT'](_0x10ff('0x1')),'allowNull':![]},'direction':{'type':Sequelize[_0x10ff('0x2')]('in','out'),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x1ef6=['exports','STRING','TEXT','medium','ENUM','out','sequelize'];(function(_0x3d736f,_0x102c06){var _0x5338b8=function(_0x4cfb5a){while(--_0x4cfb5a){_0x3d736f['push'](_0x3d736f['shift']());}};_0x5338b8(++_0x102c06);}(_0x1ef6,0x1d4));var _0x61ef=function(_0x3ea192,_0x4997c3){_0x3ea192=_0x3ea192-0x0;var _0x4b255c=_0x1ef6[_0x3ea192];return _0x4b255c;};'use strict';var Sequelize=require(_0x61ef('0x0'));module[_0x61ef('0x1')]={'uniqueid':{'type':Sequelize[_0x61ef('0x2')]},'body':{'type':Sequelize[_0x61ef('0x3')](_0x61ef('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x61ef('0x5')]('in',_0x61ef('0x6')),'defaultValue':_0x61ef('0x6'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x61ef('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 3253c91..6bca752 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 _0x8747=['hasOwnProperty','nolimit','order','sort','filter','where','merge','map','options','SquareMessage','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','query','filters','model','intersection','fields','attributes'];(function(_0x16629d,_0x492375){var _0x56ccee=function(_0xa982b7){while(--_0xa982b7){_0x16629d['push'](_0x16629d['shift']());}};_0x56ccee(++_0x492375);}(_0x8747,0xab));var _0x7874=function(_0x220610,_0x3b80b4){_0x220610=_0x220610-0x0;var _0x42f444=_0x8747[_0x220610];return _0x42f444;};'use strict';var emlformat=require(_0x7874('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7874('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7874('0x2'));var moment=require(_0x7874('0x3'));var BPromise=require(_0x7874('0x4'));var Mustache=require(_0x7874('0x5'));var util=require(_0x7874('0x6'));var path=require(_0x7874('0x7'));var sox=require(_0x7874('0x8'));var csv=require('to-csv');var ejs=require(_0x7874('0x9'));var fs=require('fs');var fs_extra=require(_0x7874('0xa'));var _=require(_0x7874('0xb'));var squel=require(_0x7874('0xc'));var crypto=require(_0x7874('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7874('0xe'));var toCsv=require(_0x7874('0xf'));var querystring=require(_0x7874('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7874('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7874('0x12'));var hardwareService=require(_0x7874('0x13'));var logger=require(_0x7874('0x14'))(_0x7874('0x15'));var utils=require(_0x7874('0x16'));var config=require(_0x7874('0x17'));var licenseUtil=require(_0x7874('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54b095,_0x3993ca){_0x3993ca=_0x3993ca||0xcc;return function(_0x26a13d){if(_0x26a13d){return _0x54b095[_0x7874('0x19')](_0x3993ca);}return _0x54b095[_0x7874('0x1a')](_0x3993ca)[_0x7874('0x1b')]();};}function respondWithResult(_0x27485a,_0x7270b){_0x7270b=_0x7270b||0xc8;return function(_0x1f495d){if(_0x1f495d){return _0x27485a['status'](_0x7270b)[_0x7874('0x1c')](_0x1f495d);}};}function respondWithFilteredResult(_0x54a8ac,_0x55c050){return function(_0x8908b2){if(_0x8908b2){var _0x7ebfef=typeof _0x55c050['offset']===_0x7874('0x1d')&&typeof _0x55c050[_0x7874('0x1e')]===_0x7874('0x1d');var _0x137842=_0x8908b2['count'];var _0x284d4a=_0x7ebfef?0x0:_0x55c050[_0x7874('0x1f')];var _0x74b34=_0x7ebfef?_0x8908b2[_0x7874('0x20')]:_0x55c050[_0x7874('0x1f')]+_0x55c050[_0x7874('0x1e')];var _0x1397b3;if(_0x74b34>=_0x137842){_0x74b34=_0x137842;_0x1397b3=0xc8;}else{_0x1397b3=0xce;}_0x54a8ac[_0x7874('0x1a')](_0x1397b3);return _0x54a8ac['set'](_0x7874('0x21'),_0x284d4a+'-'+_0x74b34+'/'+_0x137842)[_0x7874('0x1c')](_0x8908b2);}return null;};}function patchUpdates(_0x2c4229){return function(_0x5bd7b3){try{jsonpatch[_0x7874('0x22')](_0x5bd7b3,_0x2c4229,!![]);}catch(_0x2cc510){return BPromise[_0x7874('0x23')](_0x2cc510);}return _0x5bd7b3['save']();};}function saveUpdates(_0x158860,_0x42bacc){return function(_0x53238b){if(_0x53238b){return _0x53238b[_0x7874('0x24')](_0x158860)['then'](function(_0xbcceb){return _0xbcceb;});}return null;};}function removeEntity(_0x4223e7,_0x5dad45){return function(_0x5eb82c){if(_0x5eb82c){return _0x5eb82c[_0x7874('0x25')]()[_0x7874('0x26')](function(){_0x4223e7[_0x7874('0x1a')](0xcc)[_0x7874('0x1b')]();});}};}function handleEntityNotFound(_0x10ad9f,_0x37be21){return function(_0x321f05){if(!_0x321f05){_0x10ad9f['sendStatus'](0x194);}return _0x321f05;};}function handleError(_0x5cf375,_0x3e359e){_0x3e359e=_0x3e359e||0x1f4;return function(_0x1eb494){logger[_0x7874('0x27')](_0x1eb494[_0x7874('0x28')]);if(_0x1eb494[_0x7874('0x29')]){delete _0x1eb494['name'];}_0x5cf375[_0x7874('0x1a')](_0x3e359e)[_0x7874('0x2a')](_0x1eb494);};}exports[_0x7874('0x2b')]=function(_0x4ecec2,_0x3957a4){var _0x33f244={},_0x452887={},_0x216204={'count':0x0,'rows':[]};var _0x2f7d48=_['map'](db['SquareMessage'][_0x7874('0x2c')],function(_0x14681e){return{'name':_0x14681e[_0x7874('0x2d')],'type':_0x14681e[_0x7874('0x2e')][_0x7874('0x2f')]};});_0x452887['model']=_['map'](_0x2f7d48,'name');_0x452887[_0x7874('0x30')]=_['keys'](_0x4ecec2['query']);_0x452887[_0x7874('0x31')]=_['intersection'](_0x452887[_0x7874('0x32')],_0x452887['query']);_0x33f244['attributes']=_[_0x7874('0x33')](_0x452887[_0x7874('0x32')],qs['fields'](_0x4ecec2['query'][_0x7874('0x34')]));_0x33f244[_0x7874('0x35')]=_0x33f244[_0x7874('0x35')]['length']?_0x33f244[_0x7874('0x35')]:_0x452887[_0x7874('0x32')];if(!_0x4ecec2[_0x7874('0x30')][_0x7874('0x36')](_0x7874('0x37'))){_0x33f244[_0x7874('0x1e')]=qs[_0x7874('0x1e')](_0x4ecec2[_0x7874('0x30')][_0x7874('0x1e')]);_0x33f244['offset']=qs['offset'](_0x4ecec2[_0x7874('0x30')][_0x7874('0x1f')]);}_0x33f244[_0x7874('0x38')]=qs[_0x7874('0x39')](_0x4ecec2[_0x7874('0x30')][_0x7874('0x39')]);_0x33f244['where']=qs[_0x7874('0x31')](_['pick'](_0x4ecec2['query'],_0x452887[_0x7874('0x31')]),_0x2f7d48);if(_0x4ecec2['query'][_0x7874('0x3a')]){_0x33f244[_0x7874('0x3b')]=_[_0x7874('0x3c')](_0x33f244[_0x7874('0x3b')],{'$or':_[_0x7874('0x3d')](_0x2f7d48,function(_0x28274e){if(_0x28274e[_0x7874('0x2e')]!=='VIRTUAL'){var _0x5bd7a1={};_0x5bd7a1[_0x28274e[_0x7874('0x29')]]={'$like':'%'+_0x4ecec2[_0x7874('0x30')][_0x7874('0x3a')]+'%'};return _0x5bd7a1;}})});}_0x33f244=_[_0x7874('0x3c')]({},_0x33f244,_0x4ecec2[_0x7874('0x3e')]);var _0x25e6c7={'where':_0x33f244[_0x7874('0x3b')]};return db[_0x7874('0x3f')][_0x7874('0x20')](_0x25e6c7)[_0x7874('0x26')](function(_0x5676cf){_0x216204['count']=_0x5676cf;if(_0x4ecec2[_0x7874('0x30')][_0x7874('0x40')]){_0x33f244[_0x7874('0x41')]=[{'all':!![]}];}return db['SquareMessage'][_0x7874('0x42')](_0x33f244);})[_0x7874('0x26')](function(_0x1a8db6){_0x216204[_0x7874('0x43')]=_0x1a8db6;return _0x216204;})[_0x7874('0x26')](respondWithFilteredResult(_0x3957a4,_0x33f244))[_0x7874('0x44')](handleError(_0x3957a4,null));};exports[_0x7874('0x45')]=function(_0x48bf38,_0xb76ad9){var _0x8dc916={'raw':!![],'where':{'id':_0x48bf38[_0x7874('0x46')]['id']}},_0x43f96d={};_0x43f96d[_0x7874('0x32')]=_['keys'](db['SquareMessage'][_0x7874('0x2c')]);_0x43f96d[_0x7874('0x30')]=_[_0x7874('0x47')](_0x48bf38[_0x7874('0x30')]);_0x43f96d[_0x7874('0x31')]=_[_0x7874('0x33')](_0x43f96d[_0x7874('0x32')],_0x43f96d[_0x7874('0x30')]);_0x8dc916[_0x7874('0x35')]=_[_0x7874('0x33')](_0x43f96d[_0x7874('0x32')],qs[_0x7874('0x34')](_0x48bf38[_0x7874('0x30')][_0x7874('0x34')]));_0x8dc916[_0x7874('0x35')]=_0x8dc916['attributes']['length']?_0x8dc916[_0x7874('0x35')]:_0x43f96d[_0x7874('0x32')];if(_0x48bf38[_0x7874('0x30')][_0x7874('0x40')]){_0x8dc916['include']=[{'all':!![]}];}_0x8dc916=_['merge']({},_0x8dc916,_0x48bf38[_0x7874('0x3e')]);return db[_0x7874('0x3f')][_0x7874('0x48')](_0x8dc916)[_0x7874('0x26')](handleEntityNotFound(_0xb76ad9,null))[_0x7874('0x26')](respondWithResult(_0xb76ad9,null))[_0x7874('0x44')](handleError(_0xb76ad9,null));};exports[_0x7874('0x49')]=function(_0x4f998d,_0x494f2b){return db['SquareMessage'][_0x7874('0x49')](_0x4f998d['body'],{})[_0x7874('0x26')](respondWithResult(_0x494f2b,0xc9))[_0x7874('0x44')](handleError(_0x494f2b,null));};exports[_0x7874('0x24')]=function(_0x12b975,_0x4c4c2c){if(_0x12b975['body']['id']){delete _0x12b975[_0x7874('0x4a')]['id'];}return db['SquareMessage'][_0x7874('0x48')]({'where':{'id':_0x12b975[_0x7874('0x46')]['id']}})['then'](handleEntityNotFound(_0x4c4c2c,null))[_0x7874('0x26')](saveUpdates(_0x12b975[_0x7874('0x4a')],null))[_0x7874('0x26')](respondWithResult(_0x4c4c2c,null))['catch'](handleError(_0x4c4c2c,null));};exports[_0x7874('0x25')]=function(_0x8c3591,_0x463c6e){return db[_0x7874('0x3f')][_0x7874('0x48')]({'where':{'id':_0x8c3591[_0x7874('0x46')]['id']}})[_0x7874('0x26')](handleEntityNotFound(_0x463c6e,null))[_0x7874('0x26')](removeEntity(_0x463c6e,null))[_0x7874('0x44')](handleError(_0x463c6e,null));}; \ No newline at end of file +var _0xc113=['fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','update','then','sendStatus','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll','catch','show','params','length','includeAll','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc113,0x1ab));var _0x3c11=function(_0x3fc4b4,_0x11e339){_0x3fc4b4=_0x3fc4b4-0x0;var _0x14ec03=_0xc113[_0x3fc4b4];return _0x14ec03;};'use strict';var emlformat=require(_0x3c11('0x0'));var rimraf=require(_0x3c11('0x1'));var zipdir=require(_0x3c11('0x2'));var jsonpatch=require(_0x3c11('0x3'));var rp=require(_0x3c11('0x4'));var moment=require(_0x3c11('0x5'));var BPromise=require(_0x3c11('0x6'));var Mustache=require(_0x3c11('0x7'));var util=require(_0x3c11('0x8'));var path=require('path');var sox=require(_0x3c11('0x9'));var csv=require(_0x3c11('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3c11('0xb'));var _=require(_0x3c11('0xc'));var squel=require(_0x3c11('0xd'));var crypto=require('crypto');var jsforce=require(_0x3c11('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3c11('0xf'));var Redis=require(_0x3c11('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3c11('0x11'));var as=require(_0x3c11('0x12'));var hardwareService=require(_0x3c11('0x13'));var logger=require('../../config/logger')(_0x3c11('0x14'));var utils=require(_0x3c11('0x15'));var config=require(_0x3c11('0x16'));var licenseUtil=require(_0x3c11('0x17'));var db=require(_0x3c11('0x18'))['db'];function respondWithStatusCode(_0x58c7c8,_0x28daef){_0x28daef=_0x28daef||0xcc;return function(_0x2d997c){if(_0x2d997c){return _0x58c7c8['sendStatus'](_0x28daef);}return _0x58c7c8[_0x3c11('0x19')](_0x28daef)[_0x3c11('0x1a')]();};}function respondWithResult(_0x1c0b32,_0x822ef3){_0x822ef3=_0x822ef3||0xc8;return function(_0x30b11b){if(_0x30b11b){return _0x1c0b32['status'](_0x822ef3)[_0x3c11('0x1b')](_0x30b11b);}};}function respondWithFilteredResult(_0x2ba437,_0x2259f7){return function(_0x14c05d){if(_0x14c05d){var _0x1d05f2=typeof _0x2259f7['offset']==='undefined'&&typeof _0x2259f7['limit']===_0x3c11('0x1c');var _0x3a0626=_0x14c05d[_0x3c11('0x1d')];var _0x42db8d=_0x1d05f2?0x0:_0x2259f7[_0x3c11('0x1e')];var _0x35d32f=_0x1d05f2?_0x14c05d[_0x3c11('0x1d')]:_0x2259f7[_0x3c11('0x1e')]+_0x2259f7[_0x3c11('0x1f')];var _0x539ee1;if(_0x35d32f>=_0x3a0626){_0x35d32f=_0x3a0626;_0x539ee1=0xc8;}else{_0x539ee1=0xce;}_0x2ba437['status'](_0x539ee1);return _0x2ba437[_0x3c11('0x20')]('Content-Range',_0x42db8d+'-'+_0x35d32f+'/'+_0x3a0626)[_0x3c11('0x1b')](_0x14c05d);}return null;};}function patchUpdates(_0x5540b7){return function(_0x3ab7af){try{jsonpatch['apply'](_0x3ab7af,_0x5540b7,!![]);}catch(_0xe243c){return BPromise['reject'](_0xe243c);}return _0x3ab7af['save']();};}function saveUpdates(_0x160831,_0x49b827){return function(_0x189ba9){if(_0x189ba9){return _0x189ba9[_0x3c11('0x21')](_0x160831)[_0x3c11('0x22')](function(_0x2a7687){return _0x2a7687;});}return null;};}function removeEntity(_0x1a8fd4,_0x4e456a){return function(_0x36bb91){if(_0x36bb91){return _0x36bb91['destroy']()[_0x3c11('0x22')](function(){_0x1a8fd4[_0x3c11('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29f3cd,_0x20ec9b){return function(_0x2ff8bc){if(!_0x2ff8bc){_0x29f3cd[_0x3c11('0x23')](0x194);}return _0x2ff8bc;};}function handleError(_0xd42228,_0x243659){_0x243659=_0x243659||0x1f4;return function(_0x1af1fb){logger[_0x3c11('0x24')](_0x1af1fb[_0x3c11('0x25')]);if(_0x1af1fb[_0x3c11('0x26')]){delete _0x1af1fb['name'];}_0xd42228[_0x3c11('0x19')](_0x243659)[_0x3c11('0x27')](_0x1af1fb);};}exports[_0x3c11('0x28')]=function(_0x9cc373,_0x50aec6){var _0x25b25d={},_0x21401c={},_0x5151b0={'count':0x0,'rows':[]};var _0x1078b8=_[_0x3c11('0x29')](db[_0x3c11('0x2a')][_0x3c11('0x2b')],function(_0x36a5b4){return{'name':_0x36a5b4[_0x3c11('0x2c')],'type':_0x36a5b4[_0x3c11('0x2d')][_0x3c11('0x2e')]};});_0x21401c['model']=_[_0x3c11('0x29')](_0x1078b8,_0x3c11('0x26'));_0x21401c[_0x3c11('0x2f')]=_[_0x3c11('0x30')](_0x9cc373[_0x3c11('0x2f')]);_0x21401c[_0x3c11('0x31')]=_[_0x3c11('0x32')](_0x21401c['model'],_0x21401c[_0x3c11('0x2f')]);_0x25b25d[_0x3c11('0x33')]=_[_0x3c11('0x32')](_0x21401c[_0x3c11('0x34')],qs[_0x3c11('0x35')](_0x9cc373[_0x3c11('0x2f')]['fields']));_0x25b25d[_0x3c11('0x33')]=_0x25b25d['attributes']['length']?_0x25b25d[_0x3c11('0x33')]:_0x21401c[_0x3c11('0x34')];if(!_0x9cc373['query'][_0x3c11('0x36')](_0x3c11('0x37'))){_0x25b25d[_0x3c11('0x1f')]=qs['limit'](_0x9cc373[_0x3c11('0x2f')][_0x3c11('0x1f')]);_0x25b25d[_0x3c11('0x1e')]=qs[_0x3c11('0x1e')](_0x9cc373['query'][_0x3c11('0x1e')]);}_0x25b25d[_0x3c11('0x38')]=qs['sort'](_0x9cc373[_0x3c11('0x2f')][_0x3c11('0x39')]);_0x25b25d[_0x3c11('0x3a')]=qs['filters'](_[_0x3c11('0x3b')](_0x9cc373['query'],_0x21401c[_0x3c11('0x31')]),_0x1078b8);if(_0x9cc373['query']['filter']){_0x25b25d[_0x3c11('0x3a')]=_['merge'](_0x25b25d[_0x3c11('0x3a')],{'$or':_['map'](_0x1078b8,function(_0x32766e){if(_0x32766e[_0x3c11('0x2d')]!=='VIRTUAL'){var _0x20bf47={};_0x20bf47[_0x32766e['name']]={'$like':'%'+_0x9cc373[_0x3c11('0x2f')][_0x3c11('0x3c')]+'%'};return _0x20bf47;}})});}_0x25b25d=_[_0x3c11('0x3d')]({},_0x25b25d,_0x9cc373['options']);var _0x3e1ec3={'where':_0x25b25d[_0x3c11('0x3a')]};return db[_0x3c11('0x2a')][_0x3c11('0x1d')](_0x3e1ec3)[_0x3c11('0x22')](function(_0x2ccc27){_0x5151b0[_0x3c11('0x1d')]=_0x2ccc27;if(_0x9cc373[_0x3c11('0x2f')]['includeAll']){_0x25b25d[_0x3c11('0x3e')]=[{'all':!![]}];}return db[_0x3c11('0x2a')][_0x3c11('0x3f')](_0x25b25d);})['then'](function(_0x4ed063){_0x5151b0['rows']=_0x4ed063;return _0x5151b0;})[_0x3c11('0x22')](respondWithFilteredResult(_0x50aec6,_0x25b25d))[_0x3c11('0x40')](handleError(_0x50aec6,null));};exports[_0x3c11('0x41')]=function(_0x5eef87,_0x533cb8){var _0x3eea03={'raw':!![],'where':{'id':_0x5eef87[_0x3c11('0x42')]['id']}},_0x39b0ed={};_0x39b0ed[_0x3c11('0x34')]=_[_0x3c11('0x30')](db[_0x3c11('0x2a')][_0x3c11('0x2b')]);_0x39b0ed[_0x3c11('0x2f')]=_[_0x3c11('0x30')](_0x5eef87['query']);_0x39b0ed[_0x3c11('0x31')]=_[_0x3c11('0x32')](_0x39b0ed[_0x3c11('0x34')],_0x39b0ed[_0x3c11('0x2f')]);_0x3eea03[_0x3c11('0x33')]=_[_0x3c11('0x32')](_0x39b0ed[_0x3c11('0x34')],qs[_0x3c11('0x35')](_0x5eef87[_0x3c11('0x2f')][_0x3c11('0x35')]));_0x3eea03['attributes']=_0x3eea03[_0x3c11('0x33')][_0x3c11('0x43')]?_0x3eea03[_0x3c11('0x33')]:_0x39b0ed['model'];if(_0x5eef87[_0x3c11('0x2f')][_0x3c11('0x44')]){_0x3eea03[_0x3c11('0x3e')]=[{'all':!![]}];}_0x3eea03=_[_0x3c11('0x3d')]({},_0x3eea03,_0x5eef87['options']);return db['SquareMessage'][_0x3c11('0x45')](_0x3eea03)[_0x3c11('0x22')](handleEntityNotFound(_0x533cb8,null))['then'](respondWithResult(_0x533cb8,null))[_0x3c11('0x40')](handleError(_0x533cb8,null));};exports[_0x3c11('0x46')]=function(_0x2e2398,_0x2b3224){return db['SquareMessage']['create'](_0x2e2398[_0x3c11('0x47')],{})[_0x3c11('0x22')](respondWithResult(_0x2b3224,0xc9))[_0x3c11('0x40')](handleError(_0x2b3224,null));};exports[_0x3c11('0x21')]=function(_0x4da7b4,_0x1846b2){if(_0x4da7b4[_0x3c11('0x47')]['id']){delete _0x4da7b4[_0x3c11('0x47')]['id'];}return db[_0x3c11('0x2a')][_0x3c11('0x45')]({'where':{'id':_0x4da7b4[_0x3c11('0x42')]['id']}})['then'](handleEntityNotFound(_0x1846b2,null))['then'](saveUpdates(_0x4da7b4['body'],null))['then'](respondWithResult(_0x1846b2,null))['catch'](handleError(_0x1846b2,null));};exports[_0x3c11('0x48')]=function(_0x559f54,_0x5a7efe){return db[_0x3c11('0x2a')][_0x3c11('0x45')]({'where':{'id':_0x559f54['params']['id']}})[_0x3c11('0x22')](handleEntityNotFound(_0x5a7efe,null))['then'](removeEntity(_0x5a7efe,null))[_0x3c11('0x40')](handleError(_0x5a7efe,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 7b55acd..cfc51a9 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 _0x8d49=['SquareMessage','square_messages','lodash','util','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x2abe3c,_0x3fb781){var _0x52ea50=function(_0x1ecbcf){while(--_0x1ecbcf){_0x2abe3c['push'](_0x2abe3c['shift']());}};_0x52ea50(++_0x3fb781);}(_0x8d49,0xf4));var _0x98d4=function(_0x41c829,_0x2c6986){_0x41c829=_0x41c829-0x0;var _0x12ad1a=_0x8d49[_0x41c829];return _0x12ad1a;};'use strict';var _=require(_0x98d4('0x0'));var util=require(_0x98d4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x98d4('0x2'));var BPromise=require(_0x98d4('0x3'));var rp=require(_0x98d4('0x4'));var fs=require('fs');var path=require(_0x98d4('0x5'));var rimraf=require(_0x98d4('0x6'));var config=require('../../config/environment');var attributes=require('./squareMessage.attributes');module[_0x98d4('0x7')]=function(_0x1f79e0,_0x4f236e){return _0x1f79e0[_0x98d4('0x8')](_0x98d4('0x9'),attributes,{'tableName':_0x98d4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4ed=['define','SquareMessage','square_messages','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x15cbce,_0xda8402){var _0x257f29=function(_0x388132){while(--_0x388132){_0x15cbce['push'](_0x15cbce['shift']());}};_0x257f29(++_0xda8402);}(_0xe4ed,0xd5));var _0xde4e=function(_0x3c2b34,_0x288043){_0x3c2b34=_0x3c2b34-0x0;var _0x263f8c=_0xe4ed[_0x3c2b34];return _0x263f8c;};'use strict';var _=require(_0xde4e('0x0'));var util=require(_0xde4e('0x1'));var logger=require(_0xde4e('0x2'))(_0xde4e('0x3'));var moment=require(_0xde4e('0x4'));var BPromise=require(_0xde4e('0x5'));var rp=require(_0xde4e('0x6'));var fs=require('fs');var path=require(_0xde4e('0x7'));var rimraf=require(_0xde4e('0x8'));var config=require(_0xde4e('0x9'));var attributes=require('./squareMessage.attributes');module[_0xde4e('0xa')]=function(_0x2f301b,_0x112136){return _0x2f301b[_0xde4e('0xb')](_0xde4e('0xc'),attributes,{'tableName':_0xde4e('0xd'),'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 7668065..19d544f 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 _0x94c7=['create','body','options','raw','then','stringify','util','moment','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSquareMessage','SquareMessage'];(function(_0x4da7da,_0x17974b){var _0x30485d=function(_0x1d654e){while(--_0x1d654e){_0x4da7da['push'](_0x4da7da['shift']());}};_0x30485d(++_0x17974b);}(_0x94c7,0xa2));var _0x794c=function(_0x4fb2ca,_0x28a5ac){_0x4fb2ca=_0x4fb2ca-0x0;var _0x1e16a6=_0x94c7[_0x4fb2ca];return _0x1e16a6;};'use strict';var _=require('lodash');var util=require(_0x794c('0x0'));var moment=require(_0x794c('0x1'));var BPromise=require('bluebird');var rs=require(_0x794c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x794c('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x794c('0x4'));var jayson=require(_0x794c('0x5'));var client=jayson[_0x794c('0x6')][_0x794c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3e0fac,_0x142a66,_0x8e5826){return new BPromise(function(_0x12248e,_0x2e4f83){return client['request'](_0x3e0fac,_0x8e5826)['then'](function(_0x8e2bae){logger[_0x794c('0x8')](_0x794c('0x9'),_0x142a66,_0x794c('0xa'));logger[_0x794c('0xb')](_0x794c('0xc'),_0x142a66,'request\x20sent',JSON['stringify'](_0x8e2bae));if(_0x8e2bae[_0x794c('0xd')]){if(_0x8e2bae['error'][_0x794c('0xe')]===0x1f4){logger[_0x794c('0xd')]('SquareMessage,\x20%s,\x20%s',_0x142a66,_0x8e2bae[_0x794c('0xd')][_0x794c('0xf')]);return _0x2e4f83(_0x8e2bae[_0x794c('0xd')][_0x794c('0xf')]);}logger[_0x794c('0xd')](_0x794c('0x9'),_0x142a66,_0x8e2bae[_0x794c('0xd')]['message']);return _0x12248e(_0x8e2bae['error'][_0x794c('0xf')]);}else{logger[_0x794c('0x8')](_0x794c('0x9'),_0x142a66,_0x794c('0xa'));_0x12248e(_0x8e2bae[_0x794c('0x10')][_0x794c('0xf')]);}})[_0x794c('0x11')](function(_0x31f2b8){logger[_0x794c('0xd')](_0x794c('0x9'),_0x142a66,_0x31f2b8);_0x2e4f83(_0x31f2b8);});});}exports[_0x794c('0x12')]=function(_0x173f71){var _0x1f6893=this;return new Promise(function(_0x201adc,_0x2d6190){return db[_0x794c('0x13')][_0x794c('0x14')](_0x173f71[_0x794c('0x15')],{'raw':_0x173f71[_0x794c('0x16')]?_0x173f71[_0x794c('0x16')][_0x794c('0x17')]===undefined?!![]:![]:!![]})[_0x794c('0x18')](function(_0x5357a2){logger[_0x794c('0x8')](_0x794c('0x12'),_0x173f71);logger[_0x794c('0xb')]('CreateSquareMessage',_0x173f71,JSON[_0x794c('0x19')](_0x5357a2));_0x201adc(_0x5357a2);})[_0x794c('0x11')](function(_0x3dd2d8){logger[_0x794c('0xd')](_0x794c('0x12'),_0x3dd2d8['message'],_0x173f71);_0x2d6190(_0x1f6893['error'](0x1f4,_0x3dd2d8['message']));});});}; \ No newline at end of file +var _0x9f0d=['request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSquareMessage','SquareMessage','body','options','raw','then','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareMessage,\x20%s,\x20%s'];(function(_0x35b97b,_0x27b581){var _0x40c299=function(_0x5b6c85){while(--_0x5b6c85){_0x35b97b['push'](_0x35b97b['shift']());}};_0x40c299(++_0x27b581);}(_0x9f0d,0x65));var _0xd9f0=function(_0x1d4bb6,_0x45885e){_0x1d4bb6=_0x1d4bb6-0x0;var _0x5588a3=_0x9f0d[_0x1d4bb6];return _0x5588a3;};'use strict';var _=require(_0xd9f0('0x0'));var util=require(_0xd9f0('0x1'));var moment=require(_0xd9f0('0x2'));var BPromise=require(_0xd9f0('0x3'));var rs=require(_0xd9f0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd9f0('0x5'))['db'];var utils=require(_0xd9f0('0x6'));var logger=require('../../config/logger')(_0xd9f0('0x7'));var config=require(_0xd9f0('0x8'));var jayson=require(_0xd9f0('0x9'));var client=jayson[_0xd9f0('0xa')][_0xd9f0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x538690,_0x25f666,_0x5714ba){return new BPromise(function(_0x16eaec,_0x316ee9){return client[_0xd9f0('0xc')](_0x538690,_0x5714ba)['then'](function(_0x32fa9b){logger[_0xd9f0('0xd')](_0xd9f0('0xe'),_0x25f666,_0xd9f0('0xf'));logger[_0xd9f0('0x10')](_0xd9f0('0x11'),_0x25f666,_0xd9f0('0xf'),JSON['stringify'](_0x32fa9b));if(_0x32fa9b['error']){if(_0x32fa9b[_0xd9f0('0x12')][_0xd9f0('0x13')]===0x1f4){logger[_0xd9f0('0x12')](_0xd9f0('0xe'),_0x25f666,_0x32fa9b['error'][_0xd9f0('0x14')]);return _0x316ee9(_0x32fa9b['error']['message']);}logger['error'](_0xd9f0('0xe'),_0x25f666,_0x32fa9b['error'][_0xd9f0('0x14')]);return _0x16eaec(_0x32fa9b[_0xd9f0('0x12')]['message']);}else{logger[_0xd9f0('0xd')](_0xd9f0('0xe'),_0x25f666,_0xd9f0('0xf'));_0x16eaec(_0x32fa9b[_0xd9f0('0x15')]['message']);}})[_0xd9f0('0x16')](function(_0x521706){logger['error'](_0xd9f0('0xe'),_0x25f666,_0x521706);_0x316ee9(_0x521706);});});}exports[_0xd9f0('0x17')]=function(_0x557b2c){var _0x1d2c74=this;return new Promise(function(_0x2d7b3c,_0x5d0ef7){return db[_0xd9f0('0x18')]['create'](_0x557b2c[_0xd9f0('0x19')],{'raw':_0x557b2c[_0xd9f0('0x1a')]?_0x557b2c[_0xd9f0('0x1a')][_0xd9f0('0x1b')]===undefined?!![]:![]:!![]})[_0xd9f0('0x1c')](function(_0x4c8d7b){logger[_0xd9f0('0xd')](_0xd9f0('0x17'),_0x557b2c);logger[_0xd9f0('0x10')](_0xd9f0('0x17'),_0x557b2c,JSON['stringify'](_0x4c8d7b));_0x2d7b3c(_0x4c8d7b);})[_0xd9f0('0x16')](function(_0x637696){logger['error'](_0xd9f0('0x17'),_0x637696['message'],_0x557b2c);_0x5d0ef7(_0x1d2c74[_0xd9f0('0x12')](0x1f4,_0x637696[_0xd9f0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index a65ec4d..7d5e341 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 _0x7b43=['delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','test','post','put','/:id','update'];(function(_0x4a5a0a,_0x1597fc){var _0x560c97=function(_0x470fe4){while(--_0x470fe4){_0x4a5a0a['push'](_0x4a5a0a['shift']());}};_0x560c97(++_0x1597fc);}(_0x7b43,0x16b));var _0x37b4=function(_0x2536a6,_0x4f453e){_0x2536a6=_0x2536a6-0x0;var _0x2ba3fb=_0x7b43[_0x2536a6];return _0x2ba3fb;};'use strict';var multer=require(_0x37b4('0x0'));var util=require(_0x37b4('0x1'));var path=require(_0x37b4('0x2'));var timeout=require(_0x37b4('0x3'));var express=require(_0x37b4('0x4'));var router=express['Router']();var fs_extra=require(_0x37b4('0x5'));var auth=require(_0x37b4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x37b4('0x7'));var controller=require(_0x37b4('0x8'));router[_0x37b4('0x9')]('/',auth[_0x37b4('0xa')](),controller[_0x37b4('0xb')]);router['get']('/:id',auth[_0x37b4('0xa')](),controller['show']);router['get']('/:id/test',auth[_0x37b4('0xa')](),timeout('15s'),controller[_0x37b4('0xc')]);router[_0x37b4('0xd')]('/',auth[_0x37b4('0xa')](),controller['create']);router[_0x37b4('0xe')](_0x37b4('0xf'),auth[_0x37b4('0xa')](),controller[_0x37b4('0x10')]);router[_0x37b4('0x11')](_0x37b4('0xf'),auth[_0x37b4('0xa')](),controller['destroy']);module[_0x37b4('0x12')]=router; \ No newline at end of file +var _0x1bec=['../../components/auth/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','/:id','15s','test','post','create','put','update','delete','destroy','exports','util','path','fs-extra'];(function(_0x1bef1f,_0x93ecb1){var _0x53af7c=function(_0xf1db5e){while(--_0xf1db5e){_0x1bef1f['push'](_0x1bef1f['shift']());}};_0x53af7c(++_0x93ecb1);}(_0x1bec,0xd5));var _0xc1be=function(_0x9f3e89,_0x39b12c){_0x9f3e89=_0x9f3e89-0x0;var _0x12d365=_0x1bec[_0x9f3e89];return _0x12d365;};'use strict';var multer=require('multer');var util=require(_0xc1be('0x0'));var path=require(_0xc1be('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xc1be('0x2'));var auth=require(_0xc1be('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xc1be('0x4'));var controller=require(_0xc1be('0x5'));router[_0xc1be('0x6')]('/',auth[_0xc1be('0x7')](),controller['index']);router['get'](_0xc1be('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xc1be('0x6')]('/:id/test',auth[_0xc1be('0x7')](),timeout(_0xc1be('0x9')),controller[_0xc1be('0xa')]);router[_0xc1be('0xb')]('/',auth['isAuthenticated'](),controller[_0xc1be('0xc')]);router[_0xc1be('0xd')]('/:id',auth[_0xc1be('0x7')](),controller[_0xc1be('0xe')]);router[_0xc1be('0xf')](_0xc1be('0x8'),auth[_0xc1be('0x7')](),controller[_0xc1be('0x10')]);module[_0xc1be('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 3067ffa..ed936f1 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 _0xdf94=['STRING','name','sequelize','exports'];(function(_0x1b6dde,_0x256aea){var _0x522e62=function(_0x4a02d7){while(--_0x4a02d7){_0x1b6dde['push'](_0x1b6dde['shift']());}};_0x522e62(++_0x256aea);}(_0xdf94,0x15e));var _0x4df9=function(_0x86f27e,_0x16ee71){_0x86f27e=_0x86f27e-0x0;var _0x2a5f11=_0xdf94[_0x86f27e];return _0x2a5f11;};'use strict';var Sequelize=require(_0x4df9('0x0'));module[_0x4df9('0x1')]={'name':{'type':Sequelize[_0x4df9('0x2')],'unique':_0x4df9('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x4df9('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x662f=['exports','STRING','name'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x662f,0x156));var _0xf662=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x662f[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');module[_0xf662('0x0')]={'name':{'type':Sequelize[_0xf662('0x1')],'unique':_0xf662('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0xf662('0x1')]},'description':{'type':Sequelize[_0xf662('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 1f7f0dd..72cceab 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 _0xea93=['openSync','dsn','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','get','ODBC','UserProfileResource','error','stack','send','SquareOdbc','rawAttributes','fieldName','key','model','name','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','filter','where','map','type','VIRTUAL','includeAll','include','catch','show','merge','options','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','odbc'];(function(_0x33ed8d,_0x3087d5){var _0x517aea=function(_0x12357b){while(--_0x12357b){_0x33ed8d['push'](_0x33ed8d['shift']());}};_0x517aea(++_0x3087d5);}(_0xea93,0x1ac));var _0x3ea9=function(_0x383dbb,_0x17d41b){_0x383dbb=_0x383dbb-0x0;var _0x6e8bde=_0xea93[_0x383dbb];return _0x6e8bde;};'use strict';var emlformat=require(_0x3ea9('0x0'));var rimraf=require(_0x3ea9('0x1'));var zipdir=require(_0x3ea9('0x2'));var jsonpatch=require(_0x3ea9('0x3'));var rp=require(_0x3ea9('0x4'));var moment=require(_0x3ea9('0x5'));var BPromise=require(_0x3ea9('0x6'));var Mustache=require('mustache');var util=require(_0x3ea9('0x7'));var path=require(_0x3ea9('0x8'));var sox=require('sox');var csv=require(_0x3ea9('0x9'));var ejs=require(_0x3ea9('0xa'));var fs=require('fs');var fs_extra=require(_0x3ea9('0xb'));var _=require(_0x3ea9('0xc'));var squel=require('squel');var crypto=require(_0x3ea9('0xd'));var jsforce=require(_0x3ea9('0xe'));var deskjs=require(_0x3ea9('0xf'));var toCsv=require(_0x3ea9('0x9'));var querystring=require('querystring');var Papa=require(_0x3ea9('0x10'));var Redis=require(_0x3ea9('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3ea9('0x12'));var as=require(_0x3ea9('0x13'));var hardwareService=require(_0x3ea9('0x14'));var logger=require('../../config/logger')(_0x3ea9('0x15'));var utils=require(_0x3ea9('0x16'));var config=require(_0x3ea9('0x17'));var licenseUtil=require(_0x3ea9('0x18'));var db=require(_0x3ea9('0x19'))['db'];function respondWithStatusCode(_0x1e38da,_0x22e2a0){_0x22e2a0=_0x22e2a0||0xcc;return function(_0x3baec2){if(_0x3baec2){return _0x1e38da[_0x3ea9('0x1a')](_0x22e2a0);}return _0x1e38da[_0x3ea9('0x1b')](_0x22e2a0)[_0x3ea9('0x1c')]();};}function respondWithResult(_0x15419a,_0x26e604){_0x26e604=_0x26e604||0xc8;return function(_0x2c047b){if(_0x2c047b){return _0x15419a[_0x3ea9('0x1b')](_0x26e604)[_0x3ea9('0x1d')](_0x2c047b);}};}function respondWithFilteredResult(_0x520961,_0x195899){return function(_0xadac28){if(_0xadac28){var _0x1db48c=typeof _0x195899[_0x3ea9('0x1e')]===_0x3ea9('0x1f')&&typeof _0x195899[_0x3ea9('0x20')]===_0x3ea9('0x1f');var _0x42c3f8=_0xadac28[_0x3ea9('0x21')];var _0x31bad0=_0x1db48c?0x0:_0x195899['offset'];var _0x2270d3=_0x1db48c?_0xadac28['count']:_0x195899[_0x3ea9('0x1e')]+_0x195899[_0x3ea9('0x20')];var _0x34448b;if(_0x2270d3>=_0x42c3f8){_0x2270d3=_0x42c3f8;_0x34448b=0xc8;}else{_0x34448b=0xce;}_0x520961['status'](_0x34448b);return _0x520961[_0x3ea9('0x22')](_0x3ea9('0x23'),_0x31bad0+'-'+_0x2270d3+'/'+_0x42c3f8)[_0x3ea9('0x1d')](_0xadac28);}return null;};}function patchUpdates(_0x1aa414){return function(_0x34253f){try{jsonpatch['apply'](_0x34253f,_0x1aa414,!![]);}catch(_0x51d9be){return BPromise['reject'](_0x51d9be);}return _0x34253f[_0x3ea9('0x24')]();};}function saveUpdates(_0x12fb7b,_0x5cf310){return function(_0x4c3c21){if(_0x4c3c21){return _0x4c3c21[_0x3ea9('0x25')](_0x12fb7b)[_0x3ea9('0x26')](function(_0xc691fb){return _0xc691fb;});}return null;};}function removeEntity(_0x3f5cd1,_0x183634){return function(_0xc6eed1){if(_0xc6eed1){return _0xc6eed1[_0x3ea9('0x27')]()[_0x3ea9('0x26')](function(){var _0x3812ba=_0xc6eed1[_0x3ea9('0x28')]({'plain':!![]});var _0x54b9c0=_0x3ea9('0x29');return db[_0x3ea9('0x2a')][_0x3ea9('0x27')]({'where':{'type':_0x54b9c0,'resourceId':_0x3812ba['id']}})[_0x3ea9('0x26')](function(){return _0xc6eed1;});})[_0x3ea9('0x26')](function(){_0x3f5cd1[_0x3ea9('0x1b')](0xcc)[_0x3ea9('0x1c')]();});}};}function handleEntityNotFound(_0x4ed383,_0x20da48){return function(_0x174bbb){if(!_0x174bbb){_0x4ed383[_0x3ea9('0x1a')](0x194);}return _0x174bbb;};}function handleError(_0x5083ad,_0x4b611a){_0x4b611a=_0x4b611a||0x1f4;return function(_0x215869){logger[_0x3ea9('0x2b')](_0x215869[_0x3ea9('0x2c')]);if(_0x215869['name']){delete _0x215869['name'];}_0x5083ad['status'](_0x4b611a)[_0x3ea9('0x2d')](_0x215869);};}exports['index']=function(_0x34e42f,_0x255924){var _0x3cfdf7={},_0x5d938e={},_0x883b08={'count':0x0,'rows':[]};var _0x4b3ece=_['map'](db[_0x3ea9('0x2e')][_0x3ea9('0x2f')],function(_0x3928e4){return{'name':_0x3928e4[_0x3ea9('0x30')],'type':_0x3928e4['type'][_0x3ea9('0x31')]};});_0x5d938e[_0x3ea9('0x32')]=_['map'](_0x4b3ece,_0x3ea9('0x33'));_0x5d938e[_0x3ea9('0x34')]=_['keys'](_0x34e42f[_0x3ea9('0x34')]);_0x5d938e[_0x3ea9('0x35')]=_['intersection'](_0x5d938e['model'],_0x5d938e[_0x3ea9('0x34')]);_0x3cfdf7[_0x3ea9('0x36')]=_[_0x3ea9('0x37')](_0x5d938e[_0x3ea9('0x32')],qs[_0x3ea9('0x38')](_0x34e42f[_0x3ea9('0x34')][_0x3ea9('0x38')]));_0x3cfdf7[_0x3ea9('0x36')]=_0x3cfdf7['attributes'][_0x3ea9('0x39')]?_0x3cfdf7[_0x3ea9('0x36')]:_0x5d938e['model'];if(!_0x34e42f[_0x3ea9('0x34')][_0x3ea9('0x3a')]('nolimit')){_0x3cfdf7[_0x3ea9('0x20')]=qs[_0x3ea9('0x20')](_0x34e42f[_0x3ea9('0x34')][_0x3ea9('0x20')]);_0x3cfdf7[_0x3ea9('0x1e')]=qs[_0x3ea9('0x1e')](_0x34e42f[_0x3ea9('0x34')][_0x3ea9('0x1e')]);}_0x3cfdf7[_0x3ea9('0x3b')]=qs[_0x3ea9('0x3c')](_0x34e42f[_0x3ea9('0x34')][_0x3ea9('0x3c')]);_0x3cfdf7['where']=qs[_0x3ea9('0x35')](_['pick'](_0x34e42f[_0x3ea9('0x34')],_0x5d938e['filters']),_0x4b3ece);if(_0x34e42f[_0x3ea9('0x34')][_0x3ea9('0x3d')]){_0x3cfdf7[_0x3ea9('0x3e')]=_['merge'](_0x3cfdf7[_0x3ea9('0x3e')],{'$or':_[_0x3ea9('0x3f')](_0x4b3ece,function(_0x1b34f1){if(_0x1b34f1[_0x3ea9('0x40')]!==_0x3ea9('0x41')){var _0x122a1c={};_0x122a1c[_0x1b34f1[_0x3ea9('0x33')]]={'$like':'%'+_0x34e42f[_0x3ea9('0x34')][_0x3ea9('0x3d')]+'%'};return _0x122a1c;}})});}_0x3cfdf7=_['merge']({},_0x3cfdf7,_0x34e42f['options']);var _0x26e700={'where':_0x3cfdf7['where']};return db[_0x3ea9('0x2e')]['count'](_0x26e700)[_0x3ea9('0x26')](function(_0x2c6bf4){_0x883b08[_0x3ea9('0x21')]=_0x2c6bf4;if(_0x34e42f[_0x3ea9('0x34')][_0x3ea9('0x42')]){_0x3cfdf7[_0x3ea9('0x43')]=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0x3cfdf7);})[_0x3ea9('0x26')](function(_0x4d48ca){_0x883b08['rows']=_0x4d48ca;return _0x883b08;})[_0x3ea9('0x26')](respondWithFilteredResult(_0x255924,_0x3cfdf7))[_0x3ea9('0x44')](handleError(_0x255924,null));};exports[_0x3ea9('0x45')]=function(_0x5de7f9,_0x5deffa){var _0x5d18df={'raw':!![],'where':{'id':_0x5de7f9['params']['id']}},_0x399ecb={};_0x399ecb['model']=_['keys'](db[_0x3ea9('0x2e')][_0x3ea9('0x2f')]);_0x399ecb[_0x3ea9('0x34')]=_['keys'](_0x5de7f9[_0x3ea9('0x34')]);_0x399ecb[_0x3ea9('0x35')]=_[_0x3ea9('0x37')](_0x399ecb['model'],_0x399ecb[_0x3ea9('0x34')]);_0x5d18df['attributes']=_[_0x3ea9('0x37')](_0x399ecb[_0x3ea9('0x32')],qs[_0x3ea9('0x38')](_0x5de7f9['query'][_0x3ea9('0x38')]));_0x5d18df[_0x3ea9('0x36')]=_0x5d18df[_0x3ea9('0x36')][_0x3ea9('0x39')]?_0x5d18df[_0x3ea9('0x36')]:_0x399ecb['model'];if(_0x5de7f9[_0x3ea9('0x34')][_0x3ea9('0x42')]){_0x5d18df[_0x3ea9('0x43')]=[{'all':!![]}];}_0x5d18df=_[_0x3ea9('0x46')]({},_0x5d18df,_0x5de7f9[_0x3ea9('0x47')]);return db[_0x3ea9('0x2e')][_0x3ea9('0x48')](_0x5d18df)[_0x3ea9('0x26')](handleEntityNotFound(_0x5deffa,null))['then'](respondWithResult(_0x5deffa,null))[_0x3ea9('0x44')](handleError(_0x5deffa,null));};exports[_0x3ea9('0x49')]=function(_0x59c36e,_0xdeea9e){return db[_0x3ea9('0x2e')][_0x3ea9('0x49')](_0x59c36e[_0x3ea9('0x4a')],{})[_0x3ea9('0x26')](function(_0xf2334a){var _0xffcb7b=_0x59c36e[_0x3ea9('0x4b')]['get']({'plain':!![]});if(!_0xffcb7b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xffcb7b['role']===_0x3ea9('0x4b')){var _0x1f9eac=_0xf2334a[_0x3ea9('0x28')]({'plain':!![]});var _0x369eda=_0x3ea9('0x29');return db[_0x3ea9('0x4c')][_0x3ea9('0x48')]({'where':{'name':_0x369eda,'userProfileId':_0xffcb7b[_0x3ea9('0x4d')]},'raw':!![]})[_0x3ea9('0x26')](function(_0x4116d5){if(_0x4116d5&&_0x4116d5[_0x3ea9('0x4e')]===0x0){return db[_0x3ea9('0x2a')][_0x3ea9('0x49')]({'name':_0x1f9eac[_0x3ea9('0x33')],'resourceId':_0x1f9eac['id'],'type':_0x4116d5['name'],'sectionId':_0x4116d5['id']},{})[_0x3ea9('0x26')](function(){return _0xf2334a;});}else{return _0xf2334a;}})[_0x3ea9('0x44')](function(_0x2b310a){logger[_0x3ea9('0x2b')](_0x3ea9('0x4f'),_0x2b310a);throw _0x2b310a;});}return _0xf2334a;})[_0x3ea9('0x26')](respondWithResult(_0xdeea9e,0xc9))['catch'](handleError(_0xdeea9e,null));};exports[_0x3ea9('0x25')]=function(_0x186a3c,_0x2e4f31){if(_0x186a3c[_0x3ea9('0x4a')]['id']){delete _0x186a3c[_0x3ea9('0x4a')]['id'];}return db['SquareOdbc'][_0x3ea9('0x48')]({'where':{'id':_0x186a3c[_0x3ea9('0x50')]['id']}})[_0x3ea9('0x26')](handleEntityNotFound(_0x2e4f31,null))[_0x3ea9('0x26')](saveUpdates(_0x186a3c[_0x3ea9('0x4a')],null))[_0x3ea9('0x26')](respondWithResult(_0x2e4f31,null))[_0x3ea9('0x44')](handleError(_0x2e4f31,null));};exports['destroy']=function(_0x2fdf33,_0x4b58ba){return db[_0x3ea9('0x2e')][_0x3ea9('0x48')]({'where':{'id':_0x2fdf33[_0x3ea9('0x50')]['id']}})[_0x3ea9('0x26')](handleEntityNotFound(_0x4b58ba,null))['then'](removeEntity(_0x4b58ba,null))[_0x3ea9('0x44')](handleError(_0x4b58ba,null));};exports['test']=function(_0x5bbe39,_0x47b97e,_0x441fe6){var _0x3388b1;return db[_0x3ea9('0x2e')]['find']({'where':{'id':_0x5bbe39[_0x3ea9('0x50')]['id']},'attributes':['id','dsn']})[_0x3ea9('0x26')](handleEntityNotFound(_0x47b97e,null))[_0x3ea9('0x26')](function(_0x484879){if(_0x484879){var _0x136452=require(_0x3ea9('0x51'))();_0x136452[_0x3ea9('0x52')](_0x484879[_0x3ea9('0x53')]);_0x136452[_0x3ea9('0x54')]();return _0x484879;}})[_0x3ea9('0x26')](respondWithResult(_0x47b97e,null))['catch'](handleError(_0x47b97e,null));}; \ No newline at end of file +var _0x4b46=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','error','stack','name','SquareOdbc','rawAttributes','fieldName','type','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','merge','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','body','destroy','test','dsn','odbc','closeSync','eml-format','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis'];(function(_0x54a198,_0x20e8c2){var _0x2f019c=function(_0x910766){while(--_0x910766){_0x54a198['push'](_0x54a198['shift']());}};_0x2f019c(++_0x20e8c2);}(_0x4b46,0x9e));var _0x64b4=function(_0x1ca5e9,_0xf14ec4){_0x1ca5e9=_0x1ca5e9-0x0;var _0x51b89d=_0x4b46[_0x1ca5e9];return _0x51b89d;};'use strict';var emlformat=require(_0x64b4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x64b4('0x1'));var BPromise=require(_0x64b4('0x2'));var Mustache=require('mustache');var util=require(_0x64b4('0x3'));var path=require('path');var sox=require(_0x64b4('0x4'));var csv=require(_0x64b4('0x5'));var ejs=require(_0x64b4('0x6'));var fs=require('fs');var fs_extra=require(_0x64b4('0x7'));var _=require(_0x64b4('0x8'));var squel=require(_0x64b4('0x9'));var crypto=require('crypto');var jsforce=require(_0x64b4('0xa'));var deskjs=require(_0x64b4('0xb'));var toCsv=require(_0x64b4('0x5'));var querystring=require(_0x64b4('0xc'));var Papa=require('papaparse');var Redis=require(_0x64b4('0xd'));var authService=require(_0x64b4('0xe'));var qs=require(_0x64b4('0xf'));var as=require(_0x64b4('0x10'));var hardwareService=require(_0x64b4('0x11'));var logger=require(_0x64b4('0x12'))('api');var utils=require(_0x64b4('0x13'));var config=require(_0x64b4('0x14'));var licenseUtil=require(_0x64b4('0x15'));var db=require(_0x64b4('0x16'))['db'];function respondWithStatusCode(_0x1a322b,_0x54c826){_0x54c826=_0x54c826||0xcc;return function(_0x47c69c){if(_0x47c69c){return _0x1a322b[_0x64b4('0x17')](_0x54c826);}return _0x1a322b['status'](_0x54c826)[_0x64b4('0x18')]();};}function respondWithResult(_0x38a200,_0x280580){_0x280580=_0x280580||0xc8;return function(_0x3efd0d){if(_0x3efd0d){return _0x38a200[_0x64b4('0x19')](_0x280580)[_0x64b4('0x1a')](_0x3efd0d);}};}function respondWithFilteredResult(_0x5dc2b7,_0x33bb07){return function(_0x4cf6e7){if(_0x4cf6e7){var _0xded014=typeof _0x33bb07[_0x64b4('0x1b')]===_0x64b4('0x1c')&&typeof _0x33bb07[_0x64b4('0x1d')]===_0x64b4('0x1c');var _0x56e5b5=_0x4cf6e7[_0x64b4('0x1e')];var _0x109219=_0xded014?0x0:_0x33bb07[_0x64b4('0x1b')];var _0x51bdb2=_0xded014?_0x4cf6e7['count']:_0x33bb07[_0x64b4('0x1b')]+_0x33bb07[_0x64b4('0x1d')];var _0x250449;if(_0x51bdb2>=_0x56e5b5){_0x51bdb2=_0x56e5b5;_0x250449=0xc8;}else{_0x250449=0xce;}_0x5dc2b7['status'](_0x250449);return _0x5dc2b7[_0x64b4('0x1f')](_0x64b4('0x20'),_0x109219+'-'+_0x51bdb2+'/'+_0x56e5b5)[_0x64b4('0x1a')](_0x4cf6e7);}return null;};}function patchUpdates(_0x383788){return function(_0x47fc85){try{jsonpatch[_0x64b4('0x21')](_0x47fc85,_0x383788,!![]);}catch(_0x874f17){return BPromise[_0x64b4('0x22')](_0x874f17);}return _0x47fc85[_0x64b4('0x23')]();};}function saveUpdates(_0x2a15f7,_0x45f2ff){return function(_0x37674e){if(_0x37674e){return _0x37674e[_0x64b4('0x24')](_0x2a15f7)[_0x64b4('0x25')](function(_0x4daf19){return _0x4daf19;});}return null;};}function removeEntity(_0x3d6728,_0x57db91){return function(_0x52adf9){if(_0x52adf9){return _0x52adf9['destroy']()['then'](function(){var _0x473457=_0x52adf9[_0x64b4('0x26')]({'plain':!![]});var _0x38e9f4='ODBC';return db[_0x64b4('0x27')]['destroy']({'where':{'type':_0x38e9f4,'resourceId':_0x473457['id']}})[_0x64b4('0x25')](function(){return _0x52adf9;});})[_0x64b4('0x25')](function(){_0x3d6728['status'](0xcc)[_0x64b4('0x18')]();});}};}function handleEntityNotFound(_0x53a05f,_0x82789d){return function(_0x2db5fe){if(!_0x2db5fe){_0x53a05f['sendStatus'](0x194);}return _0x2db5fe;};}function handleError(_0x41e6a5,_0x45634d){_0x45634d=_0x45634d||0x1f4;return function(_0x674ef2){logger[_0x64b4('0x28')](_0x674ef2[_0x64b4('0x29')]);if(_0x674ef2[_0x64b4('0x2a')]){delete _0x674ef2[_0x64b4('0x2a')];}_0x41e6a5[_0x64b4('0x19')](_0x45634d)['send'](_0x674ef2);};}exports['index']=function(_0x2da86b,_0x2ba13b){var _0x15edc3={},_0x4a844a={},_0x29853b={'count':0x0,'rows':[]};var _0x299f8a=_['map'](db[_0x64b4('0x2b')][_0x64b4('0x2c')],function(_0x5027c5){return{'name':_0x5027c5[_0x64b4('0x2d')],'type':_0x5027c5[_0x64b4('0x2e')][_0x64b4('0x2f')]};});_0x4a844a[_0x64b4('0x30')]=_[_0x64b4('0x31')](_0x299f8a,_0x64b4('0x2a'));_0x4a844a[_0x64b4('0x32')]=_['keys'](_0x2da86b[_0x64b4('0x32')]);_0x4a844a['filters']=_[_0x64b4('0x33')](_0x4a844a[_0x64b4('0x30')],_0x4a844a[_0x64b4('0x32')]);_0x15edc3['attributes']=_['intersection'](_0x4a844a[_0x64b4('0x30')],qs['fields'](_0x2da86b[_0x64b4('0x32')][_0x64b4('0x34')]));_0x15edc3[_0x64b4('0x35')]=_0x15edc3['attributes'][_0x64b4('0x36')]?_0x15edc3[_0x64b4('0x35')]:_0x4a844a[_0x64b4('0x30')];if(!_0x2da86b['query'][_0x64b4('0x37')](_0x64b4('0x38'))){_0x15edc3[_0x64b4('0x1d')]=qs['limit'](_0x2da86b['query']['limit']);_0x15edc3[_0x64b4('0x1b')]=qs[_0x64b4('0x1b')](_0x2da86b[_0x64b4('0x32')][_0x64b4('0x1b')]);}_0x15edc3[_0x64b4('0x39')]=qs['sort'](_0x2da86b[_0x64b4('0x32')][_0x64b4('0x3a')]);_0x15edc3[_0x64b4('0x3b')]=qs[_0x64b4('0x3c')](_[_0x64b4('0x3d')](_0x2da86b[_0x64b4('0x32')],_0x4a844a[_0x64b4('0x3c')]),_0x299f8a);if(_0x2da86b[_0x64b4('0x32')][_0x64b4('0x3e')]){_0x15edc3[_0x64b4('0x3b')]=_['merge'](_0x15edc3['where'],{'$or':_[_0x64b4('0x31')](_0x299f8a,function(_0x245202){if(_0x245202[_0x64b4('0x2e')]!=='VIRTUAL'){var _0x5dcfac={};_0x5dcfac[_0x245202[_0x64b4('0x2a')]]={'$like':'%'+_0x2da86b[_0x64b4('0x32')][_0x64b4('0x3e')]+'%'};return _0x5dcfac;}})});}_0x15edc3=_['merge']({},_0x15edc3,_0x2da86b[_0x64b4('0x3f')]);var _0x38d457={'where':_0x15edc3[_0x64b4('0x3b')]};return db[_0x64b4('0x2b')]['count'](_0x38d457)[_0x64b4('0x25')](function(_0x524e24){_0x29853b[_0x64b4('0x1e')]=_0x524e24;if(_0x2da86b[_0x64b4('0x32')][_0x64b4('0x40')]){_0x15edc3[_0x64b4('0x41')]=[{'all':!![]}];}return db[_0x64b4('0x2b')][_0x64b4('0x42')](_0x15edc3);})[_0x64b4('0x25')](function(_0x4b5866){_0x29853b[_0x64b4('0x43')]=_0x4b5866;return _0x29853b;})[_0x64b4('0x25')](respondWithFilteredResult(_0x2ba13b,_0x15edc3))[_0x64b4('0x44')](handleError(_0x2ba13b,null));};exports[_0x64b4('0x45')]=function(_0x34aa15,_0x4e6c31){var _0x3129a6={'raw':!![],'where':{'id':_0x34aa15[_0x64b4('0x46')]['id']}},_0x554d79={};_0x554d79[_0x64b4('0x30')]=_[_0x64b4('0x47')](db[_0x64b4('0x2b')][_0x64b4('0x2c')]);_0x554d79['query']=_['keys'](_0x34aa15['query']);_0x554d79[_0x64b4('0x3c')]=_[_0x64b4('0x33')](_0x554d79[_0x64b4('0x30')],_0x554d79['query']);_0x3129a6[_0x64b4('0x35')]=_[_0x64b4('0x33')](_0x554d79[_0x64b4('0x30')],qs[_0x64b4('0x34')](_0x34aa15[_0x64b4('0x32')]['fields']));_0x3129a6[_0x64b4('0x35')]=_0x3129a6[_0x64b4('0x35')]['length']?_0x3129a6[_0x64b4('0x35')]:_0x554d79[_0x64b4('0x30')];if(_0x34aa15['query']['includeAll']){_0x3129a6['include']=[{'all':!![]}];}_0x3129a6=_[_0x64b4('0x48')]({},_0x3129a6,_0x34aa15[_0x64b4('0x3f')]);return db[_0x64b4('0x2b')][_0x64b4('0x49')](_0x3129a6)[_0x64b4('0x25')](handleEntityNotFound(_0x4e6c31,null))[_0x64b4('0x25')](respondWithResult(_0x4e6c31,null))[_0x64b4('0x44')](handleError(_0x4e6c31,null));};exports[_0x64b4('0x4a')]=function(_0x28f210,_0x5917e8){return db['SquareOdbc'][_0x64b4('0x4a')](_0x28f210['body'],{})['then'](function(_0x457a75){var _0x257c2a=_0x28f210[_0x64b4('0x4b')]['get']({'plain':!![]});if(!_0x257c2a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x257c2a[_0x64b4('0x4c')]===_0x64b4('0x4b')){var _0x532de9=_0x457a75[_0x64b4('0x26')]({'plain':!![]});var _0x4ae803='ODBC';return db[_0x64b4('0x4d')]['find']({'where':{'name':_0x4ae803,'userProfileId':_0x257c2a[_0x64b4('0x4e')]},'raw':!![]})[_0x64b4('0x25')](function(_0x184753){if(_0x184753&&_0x184753[_0x64b4('0x4f')]===0x0){return db[_0x64b4('0x27')][_0x64b4('0x4a')]({'name':_0x532de9[_0x64b4('0x2a')],'resourceId':_0x532de9['id'],'type':_0x184753[_0x64b4('0x2a')],'sectionId':_0x184753['id']},{})[_0x64b4('0x25')](function(){return _0x457a75;});}else{return _0x457a75;}})[_0x64b4('0x44')](function(_0x44f084){logger[_0x64b4('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44f084);throw _0x44f084;});}return _0x457a75;})['then'](respondWithResult(_0x5917e8,0xc9))['catch'](handleError(_0x5917e8,null));};exports[_0x64b4('0x24')]=function(_0x4e0e83,_0x56b985){if(_0x4e0e83[_0x64b4('0x50')]['id']){delete _0x4e0e83[_0x64b4('0x50')]['id'];}return db[_0x64b4('0x2b')]['find']({'where':{'id':_0x4e0e83[_0x64b4('0x46')]['id']}})[_0x64b4('0x25')](handleEntityNotFound(_0x56b985,null))['then'](saveUpdates(_0x4e0e83[_0x64b4('0x50')],null))['then'](respondWithResult(_0x56b985,null))['catch'](handleError(_0x56b985,null));};exports[_0x64b4('0x51')]=function(_0x132196,_0x5a1994){return db[_0x64b4('0x2b')][_0x64b4('0x49')]({'where':{'id':_0x132196['params']['id']}})['then'](handleEntityNotFound(_0x5a1994,null))[_0x64b4('0x25')](removeEntity(_0x5a1994,null))[_0x64b4('0x44')](handleError(_0x5a1994,null));};exports[_0x64b4('0x52')]=function(_0x396b26,_0x13a7d5,_0x130b68){var _0xf2d44d;return db[_0x64b4('0x2b')][_0x64b4('0x49')]({'where':{'id':_0x396b26[_0x64b4('0x46')]['id']},'attributes':['id',_0x64b4('0x53')]})['then'](handleEntityNotFound(_0x13a7d5,null))[_0x64b4('0x25')](function(_0x3c9d42){if(_0x3c9d42){var _0x15741a=require(_0x64b4('0x54'))();_0x15741a['openSync'](_0x3c9d42[_0x64b4('0x53')]);_0x15741a[_0x64b4('0x55')]();return _0x3c9d42;}})[_0x64b4('0x25')](respondWithResult(_0x13a7d5,null))['catch'](handleError(_0x13a7d5,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 4a22fa8..9c561d0 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 _0xbfe6=['util','../../config/logger','moment','request-promise','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash'];(function(_0x14f3f4,_0x33e4cc){var _0x14931c=function(_0x2bd570){while(--_0x2bd570){_0x14f3f4['push'](_0x14f3f4['shift']());}};_0x14931c(++_0x33e4cc);}(_0xbfe6,0x112));var _0x6bfe=function(_0x4940c4,_0x44bf9e){_0x4940c4=_0x4940c4-0x0;var _0x1f8347=_0xbfe6[_0x4940c4];return _0x1f8347;};'use strict';var _=require(_0x6bfe('0x0'));var util=require(_0x6bfe('0x1'));var logger=require(_0x6bfe('0x2'))('api');var moment=require(_0x6bfe('0x3'));var BPromise=require('bluebird');var rp=require(_0x6bfe('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6bfe('0x5'));var attributes=require(_0x6bfe('0x6'));module[_0x6bfe('0x7')]=function(_0x7cf64c,_0x4587f5){return _0x7cf64c[_0x6bfe('0x8')](_0x6bfe('0x9'),attributes,{'tableName':_0x6bfe('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a6f=['path','rimraf','../../config/environment','exports','SquareOdbc','square_odbc','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x227b06,_0x40c8fb){var _0x56efef=function(_0x344e51){while(--_0x344e51){_0x227b06['push'](_0x227b06['shift']());}};_0x56efef(++_0x40c8fb);}(_0x0a6f,0xea));var _0xf0a6=function(_0x2977e8,_0x257939){_0x2977e8=_0x2977e8-0x0;var _0x9da807=_0x0a6f[_0x2977e8];return _0x9da807;};'use strict';var _=require('lodash');var util=require(_0xf0a6('0x0'));var logger=require(_0xf0a6('0x1'))(_0xf0a6('0x2'));var moment=require(_0xf0a6('0x3'));var BPromise=require(_0xf0a6('0x4'));var rp=require(_0xf0a6('0x5'));var fs=require('fs');var path=require(_0xf0a6('0x6'));var rimraf=require(_0xf0a6('0x7'));var config=require(_0xf0a6('0x8'));var attributes=require('./squareOdbc.attributes');module[_0xf0a6('0x9')]=function(_0x22530b,_0x1703f2){return _0x22530b['define'](_0xf0a6('0xa'),attributes,{'tableName':_0xf0a6('0xb'),'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 cdf8a2f..00ae7bf 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 _0x7c4c=['include','map','model','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','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','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','raw','options','where','attributes'];(function(_0xe87fcb,_0x290f06){var _0x38f676=function(_0x314a86){while(--_0x314a86){_0xe87fcb['push'](_0xe87fcb['shift']());}};_0x38f676(++_0x290f06);}(_0x7c4c,0x1bd));var _0xc7c4=function(_0x126fb9,_0x122c59){_0x126fb9=_0x126fb9-0x0;var _0xc8a3b1=_0x7c4c[_0x126fb9];return _0xc8a3b1;};'use strict';var _=require('lodash');var util=require(_0xc7c4('0x0'));var moment=require(_0xc7c4('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc7c4('0x2'));var db=require(_0xc7c4('0x3'))['db'];var utils=require(_0xc7c4('0x4'));var logger=require(_0xc7c4('0x5'))(_0xc7c4('0x6'));var config=require(_0xc7c4('0x7'));var jayson=require(_0xc7c4('0x8'));var client=jayson[_0xc7c4('0x9')][_0xc7c4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55fa73,_0x3e0160,_0x5441b2){return new BPromise(function(_0x8b417,_0x47bd46){return client[_0xc7c4('0xb')](_0x55fa73,_0x5441b2)[_0xc7c4('0xc')](function(_0x26adf1){logger[_0xc7c4('0xd')](_0xc7c4('0xe'),_0x3e0160,_0xc7c4('0xf'));logger[_0xc7c4('0x10')](_0xc7c4('0x11'),_0x3e0160,_0xc7c4('0xf'),JSON[_0xc7c4('0x12')](_0x26adf1));if(_0x26adf1[_0xc7c4('0x13')]){if(_0x26adf1[_0xc7c4('0x13')][_0xc7c4('0x14')]===0x1f4){logger[_0xc7c4('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x3e0160,_0x26adf1['error'][_0xc7c4('0x15')]);return _0x47bd46(_0x26adf1['error']['message']);}logger[_0xc7c4('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x3e0160,_0x26adf1[_0xc7c4('0x13')][_0xc7c4('0x15')]);return _0x8b417(_0x26adf1[_0xc7c4('0x13')][_0xc7c4('0x15')]);}else{logger['info'](_0xc7c4('0xe'),_0x3e0160,_0xc7c4('0xf'));_0x8b417(_0x26adf1[_0xc7c4('0x16')][_0xc7c4('0x15')]);}})[_0xc7c4('0x17')](function(_0xbc62e9){logger[_0xc7c4('0x13')](_0xc7c4('0xe'),_0x3e0160,_0xbc62e9);_0x47bd46(_0xbc62e9);});});}exports[_0xc7c4('0x18')]=function(_0xc4b571){var _0x1137de=this;return new Promise(function(_0x43348e,_0x2f4a3c){return db[_0xc7c4('0x19')][_0xc7c4('0x1a')]({'raw':_0xc4b571['options']?_0xc4b571['options'][_0xc7c4('0x1b')]===undefined?!![]:![]:!![],'where':_0xc4b571['options']?_0xc4b571[_0xc7c4('0x1c')][_0xc7c4('0x1d')]||null:null,'attributes':_0xc4b571[_0xc7c4('0x1c')]?_0xc4b571['options'][_0xc7c4('0x1e')]||null:null,'include':_0xc4b571[_0xc7c4('0x1c')]?_0xc4b571[_0xc7c4('0x1c')][_0xc7c4('0x1f')]?_[_0xc7c4('0x20')](_0xc4b571['options'][_0xc7c4('0x1f')],function(_0x31f862){return{'model':db[_0x31f862[_0xc7c4('0x21')]],'as':_0x31f862['as'],'attributes':_0x31f862[_0xc7c4('0x1e')],'include':_0x31f862['include']?_[_0xc7c4('0x20')](_0x31f862[_0xc7c4('0x1f')],function(_0x22cd97){return{'model':db[_0x22cd97[_0xc7c4('0x21')]],'as':_0x22cd97['as'],'attributes':_0x22cd97[_0xc7c4('0x1e')],'include':_0x22cd97[_0xc7c4('0x1f')]?_[_0xc7c4('0x20')](_0x22cd97[_0xc7c4('0x1f')],function(_0x4875b7){return{'model':db[_0x4875b7[_0xc7c4('0x21')]],'as':_0x4875b7['as'],'attributes':_0x4875b7[_0xc7c4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc7c4('0xc')](function(_0x13e266){logger[_0xc7c4('0xd')](_0xc7c4('0x18'),_0xc4b571);logger[_0xc7c4('0x10')]('ShowSquareOdbc',_0xc4b571,JSON[_0xc7c4('0x12')](_0x13e266));_0x43348e(_0x13e266);})[_0xc7c4('0x17')](function(_0x5589ca){logger[_0xc7c4('0x13')]('ShowSquareOdbc',_0x5589ca[_0xc7c4('0x15')],_0xc4b571);_0x2f4a3c(_0x1137de[_0xc7c4('0x13')](0x1f4,_0x5589ca[_0xc7c4('0x15')]));});});}; \ No newline at end of file +var _0x5072=['../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','attributes','include','model','map','lodash','randomstring'];(function(_0x5a5505,_0x27fc49){var _0x383f4d=function(_0x3180ab){while(--_0x3180ab){_0x5a5505['push'](_0x5a5505['shift']());}};_0x383f4d(++_0x27fc49);}(_0x5072,0x103));var _0x2507=function(_0x2912b9,_0x55e6e1){_0x2912b9=_0x2912b9-0x0;var _0x154da8=_0x5072[_0x2912b9];return _0x154da8;};'use strict';var _=require(_0x2507('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2507('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2507('0x2'));var logger=require(_0x2507('0x3'))(_0x2507('0x4'));var config=require('../../config/environment');var jayson=require(_0x2507('0x5'));var client=jayson['client'][_0x2507('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x22196e,_0x57c5bc,_0x4c4324){return new BPromise(function(_0x1a6e5b,_0x1ae2a9){return client[_0x2507('0x7')](_0x22196e,_0x4c4324)[_0x2507('0x8')](function(_0x238b9e){logger['info'](_0x2507('0x9'),_0x57c5bc,_0x2507('0xa'));logger[_0x2507('0xb')](_0x2507('0xc'),_0x57c5bc,_0x2507('0xa'),JSON[_0x2507('0xd')](_0x238b9e));if(_0x238b9e[_0x2507('0xe')]){if(_0x238b9e['error'][_0x2507('0xf')]===0x1f4){logger['error'](_0x2507('0x9'),_0x57c5bc,_0x238b9e[_0x2507('0xe')][_0x2507('0x10')]);return _0x1ae2a9(_0x238b9e[_0x2507('0xe')][_0x2507('0x10')]);}logger[_0x2507('0xe')](_0x2507('0x9'),_0x57c5bc,_0x238b9e[_0x2507('0xe')][_0x2507('0x10')]);return _0x1a6e5b(_0x238b9e[_0x2507('0xe')][_0x2507('0x10')]);}else{logger[_0x2507('0x11')](_0x2507('0x9'),_0x57c5bc,_0x2507('0xa'));_0x1a6e5b(_0x238b9e[_0x2507('0x12')]['message']);}})[_0x2507('0x13')](function(_0xc53150){logger[_0x2507('0xe')](_0x2507('0x9'),_0x57c5bc,_0xc53150);_0x1ae2a9(_0xc53150);});});}exports[_0x2507('0x14')]=function(_0x2a64c8){var _0x1a451e=this;return new Promise(function(_0x488e8e,_0x53263d){return db[_0x2507('0x15')][_0x2507('0x16')]({'raw':_0x2a64c8['options']?_0x2a64c8[_0x2507('0x17')][_0x2507('0x18')]===undefined?!![]:![]:!![],'where':_0x2a64c8[_0x2507('0x17')]?_0x2a64c8['options']['where']||null:null,'attributes':_0x2a64c8['options']?_0x2a64c8[_0x2507('0x17')][_0x2507('0x19')]||null:null,'include':_0x2a64c8['options']?_0x2a64c8['options'][_0x2507('0x1a')]?_['map'](_0x2a64c8[_0x2507('0x17')][_0x2507('0x1a')],function(_0x3f95c6){return{'model':db[_0x3f95c6[_0x2507('0x1b')]],'as':_0x3f95c6['as'],'attributes':_0x3f95c6['attributes'],'include':_0x3f95c6['include']?_['map'](_0x3f95c6[_0x2507('0x1a')],function(_0x5bd445){return{'model':db[_0x5bd445[_0x2507('0x1b')]],'as':_0x5bd445['as'],'attributes':_0x5bd445[_0x2507('0x19')],'include':_0x5bd445[_0x2507('0x1a')]?_[_0x2507('0x1c')](_0x5bd445[_0x2507('0x1a')],function(_0xcc1108){return{'model':db[_0xcc1108[_0x2507('0x1b')]],'as':_0xcc1108['as'],'attributes':_0xcc1108[_0x2507('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ac17d){logger[_0x2507('0x11')](_0x2507('0x14'),_0x2a64c8);logger['debug'](_0x2507('0x14'),_0x2a64c8,JSON[_0x2507('0xd')](_0x4ac17d));_0x488e8e(_0x4ac17d);})[_0x2507('0x13')](function(_0x3ef69){logger['error'](_0x2507('0x14'),_0x3ef69[_0x2507('0x10')],_0x2a64c8);_0x53263d(_0x1a451e[_0x2507('0xe')](0x1f4,_0x3ef69[_0x2507('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index a615574..585c805 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 _0x96f2=['fs-extra','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','/:id','isAuthenticated','show','/:id/users','getUsers','post','put','update','destroy','delete','exports','multer','path','connect-timeout','express'];(function(_0x3e50bd,_0x47b16f){var _0x18866=function(_0xa90213){while(--_0xa90213){_0x3e50bd['push'](_0x3e50bd['shift']());}};_0x18866(++_0x47b16f);}(_0x96f2,0xb0));var _0x296f=function(_0x956cb,_0x4f0365){_0x956cb=_0x956cb-0x0;var _0x49954a=_0x96f2[_0x956cb];return _0x49954a;};'use strict';var multer=require(_0x296f('0x0'));var util=require('util');var path=require(_0x296f('0x1'));var timeout=require(_0x296f('0x2'));var express=require(_0x296f('0x3'));var router=express['Router']();var fs_extra=require(_0x296f('0x4'));var auth=require(_0x296f('0x5'));var interaction=require(_0x296f('0x6'));var config=require('../../config/environment');var controller=require(_0x296f('0x7'));router[_0x296f('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x296f('0x8')](_0x296f('0x9'),auth[_0x296f('0xa')](),controller[_0x296f('0xb')]);router[_0x296f('0x8')](_0x296f('0xc'),auth[_0x296f('0xa')](),controller[_0x296f('0xd')]);router[_0x296f('0xe')]('/',auth[_0x296f('0xa')](),controller['create']);router[_0x296f('0xe')](_0x296f('0xc'),auth[_0x296f('0xa')](),controller['addUsers']);router[_0x296f('0xf')](_0x296f('0x9'),auth[_0x296f('0xa')](),controller[_0x296f('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x296f('0x11')]);router[_0x296f('0x12')](_0x296f('0xc'),auth[_0x296f('0xa')](),controller['removeUsers']);module[_0x296f('0x13')]=router; \ No newline at end of file +var _0x4813=['multer','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','show','/:id/users','getUsers','post','create','addUsers','put','/:id','update','destroy','delete','exports'];(function(_0x5cc7fb,_0x306aea){var _0x449f75=function(_0xb5b19f){while(--_0xb5b19f){_0x5cc7fb['push'](_0x5cc7fb['shift']());}};_0x449f75(++_0x306aea);}(_0x4813,0xdc));var _0x3481=function(_0x25e2c0,_0x556825){_0x25e2c0=_0x25e2c0-0x0;var _0x431dc2=_0x4813[_0x25e2c0];return _0x431dc2;};'use strict';var multer=require(_0x3481('0x0'));var util=require('util');var path=require(_0x3481('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3481('0x2')]();var fs_extra=require(_0x3481('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x3481('0x4'));var config=require(_0x3481('0x5'));var controller=require(_0x3481('0x6'));router[_0x3481('0x7')]('/',auth[_0x3481('0x8')](),controller[_0x3481('0x9')]);router[_0x3481('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x3481('0xa')]);router['get'](_0x3481('0xb'),auth[_0x3481('0x8')](),controller[_0x3481('0xc')]);router[_0x3481('0xd')]('/',auth[_0x3481('0x8')](),controller[_0x3481('0xe')]);router[_0x3481('0xd')]('/:id/users',auth['isAuthenticated'](),controller[_0x3481('0xf')]);router[_0x3481('0x10')](_0x3481('0x11'),auth[_0x3481('0x8')](),controller[_0x3481('0x12')]);router['delete'](_0x3481('0x11'),auth[_0x3481('0x8')](),controller[_0x3481('0x13')]);router[_0x3481('0x14')](_0x3481('0xb'),auth['isAuthenticated'](),controller['removeUsers']);module[_0x3481('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index f1870d9..ecd0b5c 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 _0xdfdb=['production','DATE','sequelize','STRING','BLOB','long','preproduction','getDataValue','toString'];(function(_0x273c0a,_0x25e14c){var _0x3b67eb=function(_0x1230b7){while(--_0x1230b7){_0x273c0a['push'](_0x273c0a['shift']());}};_0x3b67eb(++_0x25e14c);}(_0xdfdb,0xa4));var _0xbdfd=function(_0x1712d2,_0x493af7){_0x1712d2=_0x1712d2-0x0;var _0x4538d6=_0xdfdb[_0x1712d2];return _0x4538d6;};'use strict';var Sequelize=require(_0xbdfd('0x0'));module['exports']={'name':{'type':Sequelize[_0xbdfd('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xbdfd('0x1')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0xbdfd('0x2')](_0xbdfd('0x3')),'get':function(){if(this['getDataValue'](_0xbdfd('0x4'))){return this[_0xbdfd('0x5')](_0xbdfd('0x4'))[_0xbdfd('0x6')]('utf8');}}},'production':{'type':Sequelize[_0xbdfd('0x2')](_0xbdfd('0x3')),'get':function(){if(this[_0xbdfd('0x5')](_0xbdfd('0x7'))){return this[_0xbdfd('0x5')](_0xbdfd('0x7'))[_0xbdfd('0x6')]('utf8');}}},'savedAt':{'type':Sequelize[_0xbdfd('0x8')]},'publishedAt':{'type':Sequelize[_0xbdfd('0x8')]}}; \ No newline at end of file +var _0x8c9c=['long','preproduction','getDataValue','utf8','production','toString','DATE','sequelize','STRING','TEXT','BLOB'];(function(_0x4d8521,_0x369f71){var _0x2dd57d=function(_0x1ad7a0){while(--_0x1ad7a0){_0x4d8521['push'](_0x4d8521['shift']());}};_0x2dd57d(++_0x369f71);}(_0x8c9c,0xf9));var _0xc8c9=function(_0x313cc4,_0x5ab68f){_0x313cc4=_0x313cc4-0x0;var _0xd252dd=_0x8c9c[_0x313cc4];return _0xd252dd;};'use strict';var Sequelize=require(_0xc8c9('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xc8c9('0x1')]},'notes':{'type':Sequelize[_0xc8c9('0x2')]},'preproduction':{'type':Sequelize[_0xc8c9('0x3')](_0xc8c9('0x4')),'get':function(){if(this['getDataValue'](_0xc8c9('0x5'))){return this[_0xc8c9('0x6')](_0xc8c9('0x5'))['toString'](_0xc8c9('0x7'));}}},'production':{'type':Sequelize[_0xc8c9('0x3')](_0xc8c9('0x4')),'get':function(){if(this['getDataValue'](_0xc8c9('0x8'))){return this[_0xc8c9('0x6')](_0xc8c9('0x8'))[_0xc8c9('0x9')](_0xc8c9('0x7'));}}},'savedAt':{'type':Sequelize[_0xc8c9('0xa')]},'publishedAt':{'type':Sequelize[_0xc8c9('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 6a48598..446d81c 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 _0x5be6=['count','set','Content-Range','apply','reject','update','then','destroy','SquareProjects','error','stack','name','send','index','map','SquareProject','fieldName','type','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','rows','catch','show','params','keys','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','omit','removeUsers','isArray','userSquareProject:remove','findOne','User','pick','options','getUsers','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x5be6,0x164));var _0x65be=function(_0xc0cee7,_0x13b9fd){_0xc0cee7=_0xc0cee7-0x0;var _0x5d8b3c=_0x5be6[_0xc0cee7];return _0x5d8b3c;};'use strict';var emlformat=require(_0x65be('0x0'));var rimraf=require(_0x65be('0x1'));var zipdir=require(_0x65be('0x2'));var jsonpatch=require(_0x65be('0x3'));var rp=require('request-promise');var moment=require(_0x65be('0x4'));var BPromise=require(_0x65be('0x5'));var Mustache=require('mustache');var util=require(_0x65be('0x6'));var path=require(_0x65be('0x7'));var sox=require(_0x65be('0x8'));var csv=require(_0x65be('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x65be('0xa'));var _=require(_0x65be('0xb'));var squel=require('squel');var crypto=require(_0x65be('0xc'));var jsforce=require(_0x65be('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x65be('0x9'));var querystring=require(_0x65be('0xe'));var Papa=require('papaparse');var Redis=require(_0x65be('0xf'));var authService=require(_0x65be('0x10'));var qs=require(_0x65be('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x65be('0x12'));var logger=require(_0x65be('0x13'))('api');var utils=require(_0x65be('0x14'));var config=require(_0x65be('0x15'));var licenseUtil=require(_0x65be('0x16'));var db=require('../../mysqldb')['db'];config[_0x65be('0x17')]=_[_0x65be('0x18')](config[_0x65be('0x17')],{'host':_0x65be('0x19'),'port':0x18eb});var socket=require(_0x65be('0x1a'))(new Redis(config[_0x65be('0x17')]));require(_0x65be('0x1b'))[_0x65be('0x1c')](socket);function respondWithStatusCode(_0x58be1d,_0x5e2f24){_0x5e2f24=_0x5e2f24||0xcc;return function(_0x10cf90){if(_0x10cf90){return _0x58be1d[_0x65be('0x1d')](_0x5e2f24);}return _0x58be1d[_0x65be('0x1e')](_0x5e2f24)[_0x65be('0x1f')]();};}function respondWithResult(_0x31845b,_0x25a502){_0x25a502=_0x25a502||0xc8;return function(_0x18a03c){if(_0x18a03c){return _0x31845b[_0x65be('0x1e')](_0x25a502)[_0x65be('0x20')](_0x18a03c);}};}function respondWithFilteredResult(_0x26bbb5,_0x3e9fe1){return function(_0x1c4c48){if(_0x1c4c48){var _0x1e9357=typeof _0x3e9fe1[_0x65be('0x21')]===_0x65be('0x22')&&typeof _0x3e9fe1[_0x65be('0x23')]===_0x65be('0x22');var _0x2c728d=_0x1c4c48['count'];var _0x88346f=_0x1e9357?0x0:_0x3e9fe1['offset'];var _0x4b4d9d=_0x1e9357?_0x1c4c48[_0x65be('0x24')]:_0x3e9fe1[_0x65be('0x21')]+_0x3e9fe1[_0x65be('0x23')];var _0x534915;if(_0x4b4d9d>=_0x2c728d){_0x4b4d9d=_0x2c728d;_0x534915=0xc8;}else{_0x534915=0xce;}_0x26bbb5['status'](_0x534915);return _0x26bbb5[_0x65be('0x25')](_0x65be('0x26'),_0x88346f+'-'+_0x4b4d9d+'/'+_0x2c728d)[_0x65be('0x20')](_0x1c4c48);}return null;};}function patchUpdates(_0x3c474d){return function(_0x11dd9a){try{jsonpatch[_0x65be('0x27')](_0x11dd9a,_0x3c474d,!![]);}catch(_0x49c50e){return BPromise[_0x65be('0x28')](_0x49c50e);}return _0x11dd9a['save']();};}function saveUpdates(_0x1cfe59,_0x391077){return function(_0x4c1ec1){if(_0x4c1ec1){return _0x4c1ec1[_0x65be('0x29')](_0x1cfe59)[_0x65be('0x2a')](function(_0x4837e1){return _0x4837e1;});}return null;};}function removeEntity(_0x4c8002,_0x7f9cc){return function(_0x1b7a95){if(_0x1b7a95){return _0x1b7a95[_0x65be('0x2b')]()[_0x65be('0x2a')](function(){var _0x3d01fb=_0x1b7a95['get']({'plain':!![]});var _0x5fcf5b=_0x65be('0x2c');return db['UserProfileResource'][_0x65be('0x2b')]({'where':{'type':_0x5fcf5b,'resourceId':_0x3d01fb['id']}})['then'](function(){return _0x1b7a95;});})[_0x65be('0x2a')](function(){_0x4c8002['status'](0xcc)[_0x65be('0x1f')]();});}};}function handleEntityNotFound(_0x2db2a4,_0x5c0954){return function(_0x59d549){if(!_0x59d549){_0x2db2a4['sendStatus'](0x194);}return _0x59d549;};}function handleError(_0x3d4215,_0x40ffc5){_0x40ffc5=_0x40ffc5||0x1f4;return function(_0x5a3d9d){logger[_0x65be('0x2d')](_0x5a3d9d[_0x65be('0x2e')]);if(_0x5a3d9d[_0x65be('0x2f')]){delete _0x5a3d9d['name'];}_0x3d4215['status'](_0x40ffc5)[_0x65be('0x30')](_0x5a3d9d);};}exports[_0x65be('0x31')]=function(_0x54d25c,_0x22387c){var _0x210a96={},_0x4ef4e6={},_0x566456={'count':0x0,'rows':[]};var _0x332807=_[_0x65be('0x32')](db[_0x65be('0x33')]['rawAttributes'],function(_0x6c4add){return{'name':_0x6c4add[_0x65be('0x34')],'type':_0x6c4add[_0x65be('0x35')]['key']};});_0x4ef4e6[_0x65be('0x36')]=_[_0x65be('0x32')](_0x332807,'name');_0x4ef4e6['query']=_['keys'](_0x54d25c['query']);_0x4ef4e6[_0x65be('0x37')]=_[_0x65be('0x38')](_0x4ef4e6['model'],_0x4ef4e6[_0x65be('0x39')]);_0x210a96[_0x65be('0x3a')]=_[_0x65be('0x38')](_0x4ef4e6[_0x65be('0x36')],qs[_0x65be('0x3b')](_0x54d25c[_0x65be('0x39')][_0x65be('0x3b')]));_0x210a96[_0x65be('0x3a')]=_0x210a96[_0x65be('0x3a')][_0x65be('0x3c')]?_0x210a96[_0x65be('0x3a')]:_0x4ef4e6['model'];if(!_0x54d25c[_0x65be('0x39')][_0x65be('0x3d')](_0x65be('0x3e'))){_0x210a96[_0x65be('0x23')]=qs['limit'](_0x54d25c[_0x65be('0x39')][_0x65be('0x23')]);_0x210a96['offset']=qs[_0x65be('0x21')](_0x54d25c[_0x65be('0x39')][_0x65be('0x21')]);}_0x210a96[_0x65be('0x3f')]=qs[_0x65be('0x40')](_0x54d25c['query']['sort']);_0x210a96[_0x65be('0x41')]=qs[_0x65be('0x37')](_['pick'](_0x54d25c['query'],_0x4ef4e6['filters']),_0x332807);if(_0x54d25c[_0x65be('0x39')][_0x65be('0x42')]){_0x210a96['where']=_[_0x65be('0x43')](_0x210a96[_0x65be('0x41')],{'$or':_[_0x65be('0x32')](_0x332807,function(_0x3a2884){if(_0x3a2884[_0x65be('0x35')]!=='VIRTUAL'){var _0x18f6be={};_0x18f6be[_0x3a2884[_0x65be('0x2f')]]={'$like':'%'+_0x54d25c[_0x65be('0x39')]['filter']+'%'};return _0x18f6be;}})});}_0x210a96=_[_0x65be('0x43')]({},_0x210a96,_0x54d25c['options']);var _0x424615={'where':_0x210a96[_0x65be('0x41')]};return db[_0x65be('0x33')][_0x65be('0x24')](_0x424615)[_0x65be('0x2a')](function(_0xf2a20b){_0x566456['count']=_0xf2a20b;if(_0x54d25c[_0x65be('0x39')][_0x65be('0x44')]){_0x210a96[_0x65be('0x45')]=[{'all':!![]}];}return db[_0x65be('0x33')]['findAll'](_0x210a96);})[_0x65be('0x2a')](function(_0x5c8e47){_0x566456[_0x65be('0x46')]=_0x5c8e47;return _0x566456;})['then'](respondWithFilteredResult(_0x22387c,_0x210a96))[_0x65be('0x47')](handleError(_0x22387c,null));};exports[_0x65be('0x48')]=function(_0x8673fe,_0x1aa98a){var _0x5dccb7={'raw':![],'where':{'id':_0x8673fe[_0x65be('0x49')]['id']}},_0x43b688={};_0x43b688[_0x65be('0x36')]=_[_0x65be('0x4a')](db[_0x65be('0x33')][_0x65be('0x4b')]);_0x43b688['query']=_[_0x65be('0x4a')](_0x8673fe[_0x65be('0x39')]);_0x43b688['filters']=_[_0x65be('0x38')](_0x43b688[_0x65be('0x36')],_0x43b688[_0x65be('0x39')]);_0x5dccb7['attributes']=_[_0x65be('0x38')](_0x43b688[_0x65be('0x36')],qs[_0x65be('0x3b')](_0x8673fe[_0x65be('0x39')][_0x65be('0x3b')]));_0x5dccb7[_0x65be('0x3a')]=_0x5dccb7[_0x65be('0x3a')]['length']?_0x5dccb7[_0x65be('0x3a')]:_0x43b688[_0x65be('0x36')];if(_0x8673fe['query'][_0x65be('0x44')]){_0x5dccb7[_0x65be('0x45')]=[{'all':!![]}];}_0x5dccb7=_[_0x65be('0x43')]({},_0x5dccb7,_0x8673fe['options']);return db[_0x65be('0x33')][_0x65be('0x4c')](_0x5dccb7)[_0x65be('0x2a')](handleEntityNotFound(_0x1aa98a,null))[_0x65be('0x2a')](respondWithResult(_0x1aa98a,null))['catch'](handleError(_0x1aa98a,null));};exports[_0x65be('0x4d')]=function(_0x625b35,_0x13d366){return db[_0x65be('0x33')]['create'](_0x625b35[_0x65be('0x4e')],{})[_0x65be('0x2a')](function(_0x3d1684){var _0x48b22d=_0x625b35[_0x65be('0x4f')][_0x65be('0x50')]({'plain':!![]});if(!_0x48b22d)throw new Error(_0x65be('0x51'));if(_0x48b22d[_0x65be('0x52')]===_0x65be('0x4f')){var _0x180b44=_0x3d1684[_0x65be('0x50')]({'plain':!![]});var _0x1782ec=_0x65be('0x2c');return db[_0x65be('0x53')]['find']({'where':{'name':_0x1782ec,'userProfileId':_0x48b22d[_0x65be('0x54')]},'raw':!![]})[_0x65be('0x2a')](function(_0x19abc7){if(_0x19abc7&&_0x19abc7[_0x65be('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x180b44[_0x65be('0x2f')],'resourceId':_0x180b44['id'],'type':_0x19abc7[_0x65be('0x2f')],'sectionId':_0x19abc7['id']},{})['then'](function(){return _0x3d1684;});}else{return _0x3d1684;}})[_0x65be('0x47')](function(_0x1e3c88){logger[_0x65be('0x2d')](_0x65be('0x56'),_0x1e3c88);throw _0x1e3c88;});}return _0x3d1684;})[_0x65be('0x2a')](respondWithResult(_0x13d366,0xc9))[_0x65be('0x47')](handleError(_0x13d366,null));};exports[_0x65be('0x29')]=function(_0x54a014,_0x3dbc2b){if(_0x54a014[_0x65be('0x4e')]['id']){delete _0x54a014[_0x65be('0x4e')]['id'];}return db[_0x65be('0x33')][_0x65be('0x4c')]({'where':{'id':_0x54a014[_0x65be('0x49')]['id']}})[_0x65be('0x2a')](handleEntityNotFound(_0x3dbc2b,null))[_0x65be('0x2a')](saveUpdates(_0x54a014['body'],null))[_0x65be('0x2a')](respondWithResult(_0x3dbc2b,null))[_0x65be('0x47')](handleError(_0x3dbc2b,null));};exports['destroy']=function(_0x2aae3e,_0x5aa3df){return db[_0x65be('0x33')][_0x65be('0x4c')]({'where':{'id':_0x2aae3e[_0x65be('0x49')]['id']}})[_0x65be('0x2a')](handleEntityNotFound(_0x5aa3df,null))['then'](removeEntity(_0x5aa3df,null))[_0x65be('0x47')](handleError(_0x5aa3df,null));};exports['addUsers']=function(_0x264d73,_0x1917f3,_0x434c9d){return db['SquareProject'][_0x65be('0x4c')]({'where':{'id':_0x264d73[_0x65be('0x49')]['id']}})['then'](handleEntityNotFound(_0x1917f3,null))[_0x65be('0x2a')](function(_0x2166ff){if(_0x2166ff){return _0x2166ff[_0x65be('0x57')](_0x264d73[_0x65be('0x4e')][_0x65be('0x58')],_[_0x65be('0x59')](_0x264d73['body'],['ids','id'])||{});}})[_0x65be('0x2a')](respondWithResult(_0x1917f3,null))['catch'](handleError(_0x1917f3,null));};exports[_0x65be('0x5a')]=function(_0x1af538,_0x20f2cb,_0x5f4be8){return db['SquareProject'][_0x65be('0x4c')]({'where':{'id':_0x1af538[_0x65be('0x49')]['id']}})['then'](handleEntityNotFound(_0x20f2cb,null))[_0x65be('0x2a')](function(_0x2895d8){if(_0x2895d8){return _0x2895d8['removeUsers'](_0x1af538[_0x65be('0x39')]['ids'])[_0x65be('0x2a')](function(){if(_[_0x65be('0x5b')](_0x1af538[_0x65be('0x39')][_0x65be('0x58')])){for(var _0x4d069b=0x0;_0x4d069b<_0x1af538[_0x65be('0x39')][_0x65be('0x58')]['length'];_0x4d069b+=0x1){socket['emit'](_0x65be('0x5c'),{'UserId':Number(_0x1af538[_0x65be('0x39')]['ids'][_0x4d069b]),'SquareProjectId':Number(_0x1af538[_0x65be('0x49')]['id'])});}}else{socket['emit']('userSquareProject:remove',{'UserId':Number(_0x1af538[_0x65be('0x39')][_0x65be('0x58')]),'SquareProjectId':Number(_0x1af538[_0x65be('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x20f2cb,null))[_0x65be('0x47')](handleError(_0x20f2cb,null));};exports['getUsers']=function(_0x393ced,_0x3d5e48,_0xfd69d){var _0x2b776d={};var _0x16d874={};var _0x57ca15;var _0x510b87;return db['SquareProject'][_0x65be('0x5d')]({'where':{'id':_0x393ced['params']['id']}})[_0x65be('0x2a')](handleEntityNotFound(_0x3d5e48,null))['then'](function(_0x17feb1){if(_0x17feb1){_0x57ca15=_0x17feb1;_0x16d874[_0x65be('0x36')]=_[_0x65be('0x4a')](db[_0x65be('0x5e')][_0x65be('0x4b')]);_0x16d874[_0x65be('0x39')]=_['keys'](_0x393ced[_0x65be('0x39')]);_0x16d874[_0x65be('0x37')]=_['intersection'](_0x16d874['model'],_0x16d874[_0x65be('0x39')]);_0x2b776d[_0x65be('0x3a')]=_[_0x65be('0x38')](_0x16d874[_0x65be('0x36')],qs[_0x65be('0x3b')](_0x393ced[_0x65be('0x39')][_0x65be('0x3b')]));_0x2b776d[_0x65be('0x3a')]=_0x2b776d[_0x65be('0x3a')][_0x65be('0x3c')]?_0x2b776d[_0x65be('0x3a')]:_0x16d874[_0x65be('0x36')];_0x2b776d[_0x65be('0x3f')]=qs[_0x65be('0x40')](_0x393ced['query'][_0x65be('0x40')]);_0x2b776d[_0x65be('0x41')]=qs[_0x65be('0x37')](_[_0x65be('0x5f')](_0x393ced[_0x65be('0x39')],_0x16d874[_0x65be('0x37')]));if(_0x393ced[_0x65be('0x39')][_0x65be('0x42')]){_0x2b776d[_0x65be('0x41')]=_['merge'](_0x2b776d[_0x65be('0x41')],{'$or':_['map'](_0x2b776d[_0x65be('0x3a')],function(_0x11ef8f){var _0x3018a5={};_0x3018a5[_0x11ef8f]={'$like':'%'+_0x393ced['query'][_0x65be('0x42')]+'%'};return _0x3018a5;})});}_0x2b776d=_[_0x65be('0x43')]({},_0x2b776d,_0x393ced[_0x65be('0x60')]);return _0x57ca15[_0x65be('0x61')](_0x2b776d);}})[_0x65be('0x2a')](function(_0x1b9f4a){if(_0x1b9f4a){_0x510b87=_0x1b9f4a[_0x65be('0x3c')];if(!_0x393ced[_0x65be('0x39')]['hasOwnProperty'](_0x65be('0x3e'))){_0x2b776d[_0x65be('0x23')]=qs[_0x65be('0x23')](_0x393ced['query']['limit']);_0x2b776d[_0x65be('0x21')]=qs['offset'](_0x393ced[_0x65be('0x39')][_0x65be('0x21')]);}return _0x57ca15[_0x65be('0x61')](_0x2b776d);}})[_0x65be('0x2a')](function(_0x1d334f){if(_0x1d334f){return _0x1d334f?{'count':_0x510b87,'rows':_0x1d334f}:null;}})[_0x65be('0x2a')](respondWithResult(_0x3d5e48,null))[_0x65be('0x47')](handleError(_0x3d5e48,null));}; \ No newline at end of file +var _0xda08=['VIRTUAL','merge','options','includeAll','include','findAll','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','removeUsers','ids','isArray','userSquareProject:remove','emit','findOne','User','getUsers','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','SquareProjects','UserProfileResource','sendStatus','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','type'];(function(_0x3e4dcd,_0x2861ce){var _0x47a21a=function(_0x262172){while(--_0x262172){_0x3e4dcd['push'](_0x3e4dcd['shift']());}};_0x47a21a(++_0x2861ce);}(_0xda08,0x7d));var _0x8da0=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0xda08[_0x12f688];return _0x59c3de;};'use strict';var emlformat=require(_0x8da0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8da0('0x1'));var rp=require(_0x8da0('0x2'));var moment=require(_0x8da0('0x3'));var BPromise=require(_0x8da0('0x4'));var Mustache=require(_0x8da0('0x5'));var util=require(_0x8da0('0x6'));var path=require(_0x8da0('0x7'));var sox=require('sox');var csv=require(_0x8da0('0x8'));var ejs=require(_0x8da0('0x9'));var fs=require('fs');var fs_extra=require(_0x8da0('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8da0('0xb'));var jsforce=require(_0x8da0('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8da0('0x8'));var querystring=require(_0x8da0('0xd'));var Papa=require(_0x8da0('0xe'));var Redis=require(_0x8da0('0xf'));var authService=require(_0x8da0('0x10'));var qs=require(_0x8da0('0x11'));var as=require(_0x8da0('0x12'));var hardwareService=require(_0x8da0('0x13'));var logger=require(_0x8da0('0x14'))('api');var utils=require(_0x8da0('0x15'));var config=require(_0x8da0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8da0('0x17'))['db'];config[_0x8da0('0x18')]=_[_0x8da0('0x19')](config[_0x8da0('0x18')],{'host':_0x8da0('0x1a'),'port':0x18eb});var socket=require(_0x8da0('0x1b'))(new Redis(config[_0x8da0('0x18')]));require('./squareProject.socket')[_0x8da0('0x1c')](socket);function respondWithStatusCode(_0x15aeb6,_0x466b7f){_0x466b7f=_0x466b7f||0xcc;return function(_0x500bdc){if(_0x500bdc){return _0x15aeb6['sendStatus'](_0x466b7f);}return _0x15aeb6[_0x8da0('0x1d')](_0x466b7f)[_0x8da0('0x1e')]();};}function respondWithResult(_0x617efa,_0x142bed){_0x142bed=_0x142bed||0xc8;return function(_0x5a1b17){if(_0x5a1b17){return _0x617efa[_0x8da0('0x1d')](_0x142bed)[_0x8da0('0x1f')](_0x5a1b17);}};}function respondWithFilteredResult(_0x5a1013,_0x5b9b92){return function(_0x360b90){if(_0x360b90){var _0x12e785=typeof _0x5b9b92[_0x8da0('0x20')]===_0x8da0('0x21')&&typeof _0x5b9b92[_0x8da0('0x22')]===_0x8da0('0x21');var _0x2b8bc4=_0x360b90[_0x8da0('0x23')];var _0x42b643=_0x12e785?0x0:_0x5b9b92[_0x8da0('0x20')];var _0x37b1af=_0x12e785?_0x360b90['count']:_0x5b9b92[_0x8da0('0x20')]+_0x5b9b92[_0x8da0('0x22')];var _0x1a74c5;if(_0x37b1af>=_0x2b8bc4){_0x37b1af=_0x2b8bc4;_0x1a74c5=0xc8;}else{_0x1a74c5=0xce;}_0x5a1013[_0x8da0('0x1d')](_0x1a74c5);return _0x5a1013[_0x8da0('0x24')](_0x8da0('0x25'),_0x42b643+'-'+_0x37b1af+'/'+_0x2b8bc4)[_0x8da0('0x1f')](_0x360b90);}return null;};}function patchUpdates(_0x2659f0){return function(_0x3c4030){try{jsonpatch[_0x8da0('0x26')](_0x3c4030,_0x2659f0,!![]);}catch(_0x2a1641){return BPromise[_0x8da0('0x27')](_0x2a1641);}return _0x3c4030[_0x8da0('0x28')]();};}function saveUpdates(_0x37c584,_0x3ea13f){return function(_0x12d02c){if(_0x12d02c){return _0x12d02c[_0x8da0('0x29')](_0x37c584)['then'](function(_0x5c2a71){return _0x5c2a71;});}return null;};}function removeEntity(_0x3390f3,_0x5016c3){return function(_0x31369e){if(_0x31369e){return _0x31369e[_0x8da0('0x2a')]()[_0x8da0('0x2b')](function(){var _0x3d083c=_0x31369e[_0x8da0('0x2c')]({'plain':!![]});var _0x39c60f=_0x8da0('0x2d');return db[_0x8da0('0x2e')]['destroy']({'where':{'type':_0x39c60f,'resourceId':_0x3d083c['id']}})['then'](function(){return _0x31369e;});})[_0x8da0('0x2b')](function(){_0x3390f3[_0x8da0('0x1d')](0xcc)[_0x8da0('0x1e')]();});}};}function handleEntityNotFound(_0x155d64,_0x4f8269){return function(_0x3ace83){if(!_0x3ace83){_0x155d64[_0x8da0('0x2f')](0x194);}return _0x3ace83;};}function handleError(_0xed1d8c,_0x539276){_0x539276=_0x539276||0x1f4;return function(_0x5ec39d){logger[_0x8da0('0x30')](_0x5ec39d[_0x8da0('0x31')]);if(_0x5ec39d[_0x8da0('0x32')]){delete _0x5ec39d[_0x8da0('0x32')];}_0xed1d8c['status'](_0x539276)[_0x8da0('0x33')](_0x5ec39d);};}exports[_0x8da0('0x34')]=function(_0x25cbc7,_0x401a6d){var _0x449b14={},_0x95f52c={},_0x5aa538={'count':0x0,'rows':[]};var _0x50da7c=_[_0x8da0('0x35')](db[_0x8da0('0x36')][_0x8da0('0x37')],function(_0x41f60c){return{'name':_0x41f60c[_0x8da0('0x38')],'type':_0x41f60c['type']['key']};});_0x95f52c[_0x8da0('0x39')]=_[_0x8da0('0x35')](_0x50da7c,_0x8da0('0x32'));_0x95f52c[_0x8da0('0x3a')]=_[_0x8da0('0x3b')](_0x25cbc7[_0x8da0('0x3a')]);_0x95f52c['filters']=_[_0x8da0('0x3c')](_0x95f52c[_0x8da0('0x39')],_0x95f52c[_0x8da0('0x3a')]);_0x449b14[_0x8da0('0x3d')]=_['intersection'](_0x95f52c[_0x8da0('0x39')],qs[_0x8da0('0x3e')](_0x25cbc7[_0x8da0('0x3a')][_0x8da0('0x3e')]));_0x449b14[_0x8da0('0x3d')]=_0x449b14[_0x8da0('0x3d')][_0x8da0('0x3f')]?_0x449b14[_0x8da0('0x3d')]:_0x95f52c[_0x8da0('0x39')];if(!_0x25cbc7[_0x8da0('0x3a')][_0x8da0('0x40')](_0x8da0('0x41'))){_0x449b14[_0x8da0('0x22')]=qs[_0x8da0('0x22')](_0x25cbc7[_0x8da0('0x3a')][_0x8da0('0x22')]);_0x449b14['offset']=qs[_0x8da0('0x20')](_0x25cbc7[_0x8da0('0x3a')][_0x8da0('0x20')]);}_0x449b14[_0x8da0('0x42')]=qs['sort'](_0x25cbc7[_0x8da0('0x3a')][_0x8da0('0x43')]);_0x449b14[_0x8da0('0x44')]=qs['filters'](_[_0x8da0('0x45')](_0x25cbc7[_0x8da0('0x3a')],_0x95f52c[_0x8da0('0x46')]),_0x50da7c);if(_0x25cbc7[_0x8da0('0x3a')][_0x8da0('0x47')]){_0x449b14[_0x8da0('0x44')]=_['merge'](_0x449b14[_0x8da0('0x44')],{'$or':_['map'](_0x50da7c,function(_0x5d2582){if(_0x5d2582[_0x8da0('0x48')]!==_0x8da0('0x49')){var _0x407c81={};_0x407c81[_0x5d2582[_0x8da0('0x32')]]={'$like':'%'+_0x25cbc7[_0x8da0('0x3a')][_0x8da0('0x47')]+'%'};return _0x407c81;}})});}_0x449b14=_[_0x8da0('0x4a')]({},_0x449b14,_0x25cbc7[_0x8da0('0x4b')]);var _0x5656be={'where':_0x449b14[_0x8da0('0x44')]};return db[_0x8da0('0x36')]['count'](_0x5656be)['then'](function(_0x3131a4){_0x5aa538[_0x8da0('0x23')]=_0x3131a4;if(_0x25cbc7['query'][_0x8da0('0x4c')]){_0x449b14[_0x8da0('0x4d')]=[{'all':!![]}];}return db[_0x8da0('0x36')][_0x8da0('0x4e')](_0x449b14);})[_0x8da0('0x2b')](function(_0x791a6){_0x5aa538['rows']=_0x791a6;return _0x5aa538;})[_0x8da0('0x2b')](respondWithFilteredResult(_0x401a6d,_0x449b14))[_0x8da0('0x4f')](handleError(_0x401a6d,null));};exports['show']=function(_0x43c435,_0x4a57c3){var _0x1d22fd={'raw':![],'where':{'id':_0x43c435[_0x8da0('0x50')]['id']}},_0x3bddd4={};_0x3bddd4[_0x8da0('0x39')]=_['keys'](db[_0x8da0('0x36')]['rawAttributes']);_0x3bddd4[_0x8da0('0x3a')]=_[_0x8da0('0x3b')](_0x43c435[_0x8da0('0x3a')]);_0x3bddd4[_0x8da0('0x46')]=_[_0x8da0('0x3c')](_0x3bddd4['model'],_0x3bddd4['query']);_0x1d22fd[_0x8da0('0x3d')]=_[_0x8da0('0x3c')](_0x3bddd4['model'],qs['fields'](_0x43c435[_0x8da0('0x3a')][_0x8da0('0x3e')]));_0x1d22fd[_0x8da0('0x3d')]=_0x1d22fd[_0x8da0('0x3d')]['length']?_0x1d22fd[_0x8da0('0x3d')]:_0x3bddd4['model'];if(_0x43c435[_0x8da0('0x3a')][_0x8da0('0x4c')]){_0x1d22fd[_0x8da0('0x4d')]=[{'all':!![]}];}_0x1d22fd=_['merge']({},_0x1d22fd,_0x43c435[_0x8da0('0x4b')]);return db['SquareProject'][_0x8da0('0x51')](_0x1d22fd)[_0x8da0('0x2b')](handleEntityNotFound(_0x4a57c3,null))[_0x8da0('0x2b')](respondWithResult(_0x4a57c3,null))[_0x8da0('0x4f')](handleError(_0x4a57c3,null));};exports[_0x8da0('0x52')]=function(_0x5a9015,_0x3d0a0b){return db[_0x8da0('0x36')][_0x8da0('0x52')](_0x5a9015[_0x8da0('0x53')],{})[_0x8da0('0x2b')](function(_0x14df56){var _0x4f44a1=_0x5a9015[_0x8da0('0x54')][_0x8da0('0x2c')]({'plain':!![]});if(!_0x4f44a1)throw new Error(_0x8da0('0x55'));if(_0x4f44a1['role']===_0x8da0('0x54')){var _0x32d62d=_0x14df56[_0x8da0('0x2c')]({'plain':!![]});var _0x1adecd=_0x8da0('0x2d');return db[_0x8da0('0x56')]['find']({'where':{'name':_0x1adecd,'userProfileId':_0x4f44a1[_0x8da0('0x57')]},'raw':!![]})[_0x8da0('0x2b')](function(_0xfa03c7){if(_0xfa03c7&&_0xfa03c7[_0x8da0('0x58')]===0x0){return db[_0x8da0('0x2e')][_0x8da0('0x52')]({'name':_0x32d62d[_0x8da0('0x32')],'resourceId':_0x32d62d['id'],'type':_0xfa03c7[_0x8da0('0x32')],'sectionId':_0xfa03c7['id']},{})['then'](function(){return _0x14df56;});}else{return _0x14df56;}})['catch'](function(_0xbf8cb7){logger[_0x8da0('0x30')](_0x8da0('0x59'),_0xbf8cb7);throw _0xbf8cb7;});}return _0x14df56;})['then'](respondWithResult(_0x3d0a0b,0xc9))[_0x8da0('0x4f')](handleError(_0x3d0a0b,null));};exports['update']=function(_0x5aae55,_0x2a9406){if(_0x5aae55[_0x8da0('0x53')]['id']){delete _0x5aae55['body']['id'];}return db['SquareProject']['find']({'where':{'id':_0x5aae55[_0x8da0('0x50')]['id']}})[_0x8da0('0x2b')](handleEntityNotFound(_0x2a9406,null))[_0x8da0('0x2b')](saveUpdates(_0x5aae55['body'],null))[_0x8da0('0x2b')](respondWithResult(_0x2a9406,null))[_0x8da0('0x4f')](handleError(_0x2a9406,null));};exports[_0x8da0('0x2a')]=function(_0x1f176b,_0x561ac4){return db[_0x8da0('0x36')][_0x8da0('0x51')]({'where':{'id':_0x1f176b[_0x8da0('0x50')]['id']}})[_0x8da0('0x2b')](handleEntityNotFound(_0x561ac4,null))[_0x8da0('0x2b')](removeEntity(_0x561ac4,null))[_0x8da0('0x4f')](handleError(_0x561ac4,null));};exports[_0x8da0('0x5a')]=function(_0x4aa06a,_0x36c24f,_0x1ef699){return db[_0x8da0('0x36')][_0x8da0('0x51')]({'where':{'id':_0x4aa06a[_0x8da0('0x50')]['id']}})['then'](handleEntityNotFound(_0x36c24f,null))[_0x8da0('0x2b')](function(_0x4ab583){if(_0x4ab583){return _0x4ab583[_0x8da0('0x5a')](_0x4aa06a[_0x8da0('0x53')]['ids'],_['omit'](_0x4aa06a[_0x8da0('0x53')],['ids','id'])||{});}})[_0x8da0('0x2b')](respondWithResult(_0x36c24f,null))[_0x8da0('0x4f')](handleError(_0x36c24f,null));};exports[_0x8da0('0x5b')]=function(_0x5d5daa,_0x5d867b,_0x29dc99){return db['SquareProject'][_0x8da0('0x51')]({'where':{'id':_0x5d5daa[_0x8da0('0x50')]['id']}})[_0x8da0('0x2b')](handleEntityNotFound(_0x5d867b,null))['then'](function(_0x571019){if(_0x571019){return _0x571019[_0x8da0('0x5b')](_0x5d5daa['query'][_0x8da0('0x5c')])[_0x8da0('0x2b')](function(){if(_[_0x8da0('0x5d')](_0x5d5daa[_0x8da0('0x3a')][_0x8da0('0x5c')])){for(var _0xb247b1=0x0;_0xb247b1<_0x5d5daa[_0x8da0('0x3a')][_0x8da0('0x5c')][_0x8da0('0x3f')];_0xb247b1+=0x1){socket['emit'](_0x8da0('0x5e'),{'UserId':Number(_0x5d5daa[_0x8da0('0x3a')]['ids'][_0xb247b1]),'SquareProjectId':Number(_0x5d5daa['params']['id'])});}}else{socket[_0x8da0('0x5f')](_0x8da0('0x5e'),{'UserId':Number(_0x5d5daa[_0x8da0('0x3a')][_0x8da0('0x5c')]),'SquareProjectId':Number(_0x5d5daa['params']['id'])});}});}})[_0x8da0('0x2b')](respondWithStatusCode(_0x5d867b,null))[_0x8da0('0x4f')](handleError(_0x5d867b,null));};exports['getUsers']=function(_0x3673a8,_0x4a02b6,_0x2c2357){var _0x4fd882={};var _0x4d383a={};var _0x13a7f1;var _0x22a9b7;return db[_0x8da0('0x36')][_0x8da0('0x60')]({'where':{'id':_0x3673a8[_0x8da0('0x50')]['id']}})['then'](handleEntityNotFound(_0x4a02b6,null))['then'](function(_0x1ee1d1){if(_0x1ee1d1){_0x13a7f1=_0x1ee1d1;_0x4d383a[_0x8da0('0x39')]=_['keys'](db[_0x8da0('0x61')]['rawAttributes']);_0x4d383a[_0x8da0('0x3a')]=_[_0x8da0('0x3b')](_0x3673a8['query']);_0x4d383a[_0x8da0('0x46')]=_[_0x8da0('0x3c')](_0x4d383a[_0x8da0('0x39')],_0x4d383a[_0x8da0('0x3a')]);_0x4fd882['attributes']=_[_0x8da0('0x3c')](_0x4d383a[_0x8da0('0x39')],qs[_0x8da0('0x3e')](_0x3673a8['query'][_0x8da0('0x3e')]));_0x4fd882['attributes']=_0x4fd882['attributes'][_0x8da0('0x3f')]?_0x4fd882[_0x8da0('0x3d')]:_0x4d383a[_0x8da0('0x39')];_0x4fd882[_0x8da0('0x42')]=qs[_0x8da0('0x43')](_0x3673a8['query'][_0x8da0('0x43')]);_0x4fd882[_0x8da0('0x44')]=qs[_0x8da0('0x46')](_[_0x8da0('0x45')](_0x3673a8['query'],_0x4d383a['filters']));if(_0x3673a8['query'][_0x8da0('0x47')]){_0x4fd882[_0x8da0('0x44')]=_[_0x8da0('0x4a')](_0x4fd882['where'],{'$or':_[_0x8da0('0x35')](_0x4fd882[_0x8da0('0x3d')],function(_0x210122){var _0x47ff31={};_0x47ff31[_0x210122]={'$like':'%'+_0x3673a8['query']['filter']+'%'};return _0x47ff31;})});}_0x4fd882=_[_0x8da0('0x4a')]({},_0x4fd882,_0x3673a8[_0x8da0('0x4b')]);return _0x13a7f1['getUsers'](_0x4fd882);}})[_0x8da0('0x2b')](function(_0x2bbfb8){if(_0x2bbfb8){_0x22a9b7=_0x2bbfb8[_0x8da0('0x3f')];if(!_0x3673a8[_0x8da0('0x3a')][_0x8da0('0x40')](_0x8da0('0x41'))){_0x4fd882[_0x8da0('0x22')]=qs[_0x8da0('0x22')](_0x3673a8['query'][_0x8da0('0x22')]);_0x4fd882[_0x8da0('0x20')]=qs['offset'](_0x3673a8[_0x8da0('0x3a')][_0x8da0('0x20')]);}return _0x13a7f1[_0x8da0('0x62')](_0x4fd882);}})[_0x8da0('0x2b')](function(_0x8b5d50){if(_0x8b5d50){return _0x8b5d50?{'count':_0x22a9b7,'rows':_0x8b5d50}:null;}})[_0x8da0('0x2b')](respondWithResult(_0x4a02b6,null))[_0x8da0('0x4f')](handleError(_0x4a02b6,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index fe223c6..fa211a5 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 _0x6ed9=['../../mysqldb','SquareProject','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x429d9e,_0x35a02f){var _0x4ced0d=function(_0x5a7868){while(--_0x5a7868){_0x429d9e['push'](_0x429d9e['shift']());}};_0x4ced0d(++_0x35a02f);}(_0x6ed9,0x1e9));var _0x96ed=function(_0x26cbb1,_0x48349d){_0x26cbb1=_0x26cbb1-0x0;var _0x608bee=_0x6ed9[_0x26cbb1];return _0x608bee;};'use strict';var EventEmitter=require(_0x96ed('0x0'));var SquareProject=require(_0x96ed('0x1'))['db'][_0x96ed('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x96ed('0x3')](0x0);var events={'afterCreate':_0x96ed('0x4'),'afterUpdate':'update','afterDestroy':_0x96ed('0x5')};function emitEvent(_0x206d40){return function(_0x1e0816,_0x53581a,_0x34b689){SquareProjectEvents[_0x96ed('0x6')](_0x206d40+':'+_0x1e0816['id'],_0x1e0816);SquareProjectEvents['emit'](_0x206d40,_0x1e0816);_0x34b689(null);};}for(var e in events){if(events[_0x96ed('0x7')](e)){var event=events[e];SquareProject[_0x96ed('0x8')](e,emitEvent(event));}}module[_0x96ed('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0x7b1a=['exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x14ab3a,_0x49317f){var _0x325be7=function(_0x4f3335){while(--_0x4f3335){_0x14ab3a['push'](_0x14ab3a['shift']());}};_0x325be7(++_0x49317f);}(_0x7b1a,0x1c3));var _0xa7b1=function(_0x4ffd57,_0x2fe246){_0x4ffd57=_0x4ffd57-0x0;var _0x1e4100=_0x7b1a[_0x4ffd57];return _0x1e4100;};'use strict';var EventEmitter=require(_0xa7b1('0x0'));var SquareProject=require(_0xa7b1('0x1'))['db'][_0xa7b1('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xa7b1('0x3')](0x0);var events={'afterCreate':_0xa7b1('0x4'),'afterUpdate':_0xa7b1('0x5'),'afterDestroy':'remove'};function emitEvent(_0xcc51d2){return function(_0x25f68f,_0x22e739,_0x4c1034){SquareProjectEvents[_0xa7b1('0x6')](_0xcc51d2+':'+_0x25f68f['id'],_0x25f68f);SquareProjectEvents[_0xa7b1('0x6')](_0xcc51d2,_0x25f68f);_0x4c1034(null);};}for(var e in events){if(events[_0xa7b1('0x7')](e)){var event=events[e];SquareProject[_0xa7b1('0x8')](e,emitEvent(event));}}module[_0xa7b1('0x9')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 1177851..ed77a36 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 _0xdee6=['../../config/environment','exports','define','square_projects','changed','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x250f93,_0x4d6d01){var _0x55d6f3=function(_0x273605){while(--_0x273605){_0x250f93['push'](_0x250f93['shift']());}};_0x55d6f3(++_0x4d6d01);}(_0xdee6,0x169));var _0x6dee=function(_0x6ec4b,_0x1eacad){_0x6ec4b=_0x6ec4b-0x0;var _0x3ddf9c=_0xdee6[_0x6ec4b];return _0x3ddf9c;};'use strict';var _=require(_0x6dee('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6dee('0x1'));var moment=require(_0x6dee('0x2'));var BPromise=require(_0x6dee('0x3'));var rp=require(_0x6dee('0x4'));var fs=require('fs');var path=require(_0x6dee('0x5'));var rimraf=require(_0x6dee('0x6'));var config=require(_0x6dee('0x7'));var attributes=require('./squareProject.attributes');module[_0x6dee('0x8')]=function(_0x521130,_0x1905c1){return _0x521130[_0x6dee('0x9')]('SquareProject',attributes,{'tableName':_0x6dee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5b0de2,_0xbb4c54,_0x136077){if(_0x5b0de2[_0x6dee('0xb')]('preproduction')){_0x5b0de2['savedAt']=moment()[_0x6dee('0xc')](_0x6dee('0xd'));}if(_0x5b0de2[_0x6dee('0xb')](_0x6dee('0xe'))){_0x5b0de2[_0x6dee('0xf')]=moment()[_0x6dee('0xc')](_0x6dee('0xd'));}_0x136077(null,_0x5b0de2);}}});}; \ No newline at end of file +var _0xc5d3=['../../config/environment','./squareProject.attributes','define','SquareProject','square_projects','changed','preproduction','YYYY-MM-DD\x20HH:mm:ss','publishedAt','format','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1b6246,_0x51cf7e){var _0x5d1725=function(_0x1e21c2){while(--_0x1e21c2){_0x1b6246['push'](_0x1b6246['shift']());}};_0x5d1725(++_0x51cf7e);}(_0xc5d3,0x9a));var _0x3c5d=function(_0x1344d6,_0x2181e6){_0x1344d6=_0x1344d6-0x0;var _0xf45b24=_0xc5d3[_0x1344d6];return _0xf45b24;};'use strict';var _=require(_0x3c5d('0x0'));var util=require(_0x3c5d('0x1'));var logger=require(_0x3c5d('0x2'))(_0x3c5d('0x3'));var moment=require(_0x3c5d('0x4'));var BPromise=require(_0x3c5d('0x5'));var rp=require(_0x3c5d('0x6'));var fs=require('fs');var path=require(_0x3c5d('0x7'));var rimraf=require('rimraf');var config=require(_0x3c5d('0x8'));var attributes=require(_0x3c5d('0x9'));module['exports']=function(_0x8a43,_0x148431){return _0x8a43[_0x3c5d('0xa')](_0x3c5d('0xb'),attributes,{'tableName':_0x3c5d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x29faa3,_0x4fcb41,_0x179ff6){if(_0x29faa3[_0x3c5d('0xd')](_0x3c5d('0xe'))){_0x29faa3['savedAt']=moment()['format'](_0x3c5d('0xf'));}if(_0x29faa3[_0x3c5d('0xd')]('production')){_0x29faa3[_0x3c5d('0x10')]=moment()[_0x3c5d('0x11')](_0x3c5d('0xf'));}_0x179ff6(null,_0x29faa3);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 11bca95..6201a6d 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 _0xb01c=['socket.io-emitter','redis','./squareProject.socket','register','request','then','SquareProject,\x20%s,\x20%s','debug','SquareProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','find','options','where','include','map','attributes','model','ShowSquareProject','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','localhost'];(function(_0x39a1be,_0x598284){var _0x2d4f3d=function(_0x29dd97){while(--_0x29dd97){_0x39a1be['push'](_0x39a1be['shift']());}};_0x2d4f3d(++_0x598284);}(_0xb01c,0x1e0));var _0xcb01=function(_0x3e08e1,_0x408343){_0x3e08e1=_0x3e08e1-0x0;var _0x4626fb=_0xb01c[_0x3e08e1];return _0x4626fb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcb01('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb01('0x1'));var db=require(_0xcb01('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb01('0x3'))(_0xcb01('0x4'));var config=require('../../config/environment');var jayson=require(_0xcb01('0x5'));var client=jayson[_0xcb01('0x6')][_0xcb01('0x7')]({'port':0x232a});config['redis']=_[_0xcb01('0x8')](config['redis'],{'host':_0xcb01('0x9'),'port':0x18eb});var socket=require(_0xcb01('0xa'))(new Redis(config[_0xcb01('0xb')]));require(_0xcb01('0xc'))[_0xcb01('0xd')](socket);function respondWithRpcPromise(_0x3b23b7,_0x5c3ef2,_0x10d20a){return new BPromise(function(_0x4e9a24,_0xefe0ea){return client[_0xcb01('0xe')](_0x3b23b7,_0x10d20a)[_0xcb01('0xf')](function(_0x50f11b){logger['info'](_0xcb01('0x10'),_0x5c3ef2,'request\x20sent');logger[_0xcb01('0x11')](_0xcb01('0x12'),_0x5c3ef2,_0xcb01('0x13'),JSON[_0xcb01('0x14')](_0x50f11b));if(_0x50f11b['error']){if(_0x50f11b[_0xcb01('0x15')][_0xcb01('0x16')]===0x1f4){logger['error'](_0xcb01('0x10'),_0x5c3ef2,_0x50f11b[_0xcb01('0x15')]['message']);return _0xefe0ea(_0x50f11b[_0xcb01('0x15')][_0xcb01('0x17')]);}logger[_0xcb01('0x15')](_0xcb01('0x10'),_0x5c3ef2,_0x50f11b[_0xcb01('0x15')][_0xcb01('0x17')]);return _0x4e9a24(_0x50f11b[_0xcb01('0x15')]['message']);}else{logger[_0xcb01('0x18')](_0xcb01('0x10'),_0x5c3ef2,_0xcb01('0x13'));_0x4e9a24(_0x50f11b[_0xcb01('0x19')][_0xcb01('0x17')]);}})[_0xcb01('0x1a')](function(_0x48767d){logger[_0xcb01('0x15')](_0xcb01('0x10'),_0x5c3ef2,_0x48767d);_0xefe0ea(_0x48767d);});});}exports['ShowSquareProject']=function(_0x87d91a){var _0x1efcad=this;return new Promise(function(_0x5a6221,_0x272fd5){return db['SquareProject'][_0xcb01('0x1b')]({'raw':_0x87d91a['options']?_0x87d91a[_0xcb01('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x87d91a[_0xcb01('0x1c')]?_0x87d91a[_0xcb01('0x1c')][_0xcb01('0x1d')]||null:null,'attributes':_0x87d91a['options']?_0x87d91a[_0xcb01('0x1c')]['attributes']||null:null,'include':_0x87d91a[_0xcb01('0x1c')]?_0x87d91a[_0xcb01('0x1c')][_0xcb01('0x1e')]?_[_0xcb01('0x1f')](_0x87d91a['options'][_0xcb01('0x1e')],function(_0x2a1316){return{'model':db[_0x2a1316['model']],'as':_0x2a1316['as'],'attributes':_0x2a1316[_0xcb01('0x20')],'include':_0x2a1316[_0xcb01('0x1e')]?_[_0xcb01('0x1f')](_0x2a1316[_0xcb01('0x1e')],function(_0x46adf3){return{'model':db[_0x46adf3[_0xcb01('0x21')]],'as':_0x46adf3['as'],'attributes':_0x46adf3[_0xcb01('0x20')],'include':_0x46adf3[_0xcb01('0x1e')]?_['map'](_0x46adf3[_0xcb01('0x1e')],function(_0x4bf7d2){return{'model':db[_0x4bf7d2['model']],'as':_0x4bf7d2['as'],'attributes':_0x4bf7d2[_0xcb01('0x20')]};}):[]};}):[]};}):[]:[]})[_0xcb01('0xf')](function(_0x348bd1){logger[_0xcb01('0x18')](_0xcb01('0x22'),_0x87d91a);logger['debug'](_0xcb01('0x22'),_0x87d91a,JSON[_0xcb01('0x14')](_0x348bd1));_0x5a6221(_0x348bd1);})[_0xcb01('0x1a')](function(_0x29962a){logger[_0xcb01('0x15')]('ShowSquareProject',_0x29962a[_0xcb01('0x17')],_0x87d91a);_0x272fd5(_0x1efcad[_0xcb01('0x15')](0x1f4,_0x29962a[_0xcb01('0x17')]));});});}; \ No newline at end of file +var _0xf0be=['catch','ShowSquareProject','SquareProject','find','options','raw','where','attributes','include','model','stringify','lodash','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x46f8a5,_0x4fc35a){var _0x51667b=function(_0x3b609d){while(--_0x3b609d){_0x46f8a5['push'](_0x46f8a5['shift']());}};_0x51667b(++_0x4fc35a);}(_0xf0be,0x9b));var _0xef0b=function(_0x379f9a,_0x2aed6d){_0x379f9a=_0x379f9a-0x0;var _0x5f62c5=_0xf0be[_0x379f9a];return _0x5f62c5;};'use strict';var _=require(_0xef0b('0x0'));var util=require(_0xef0b('0x1'));var moment=require(_0xef0b('0x2'));var BPromise=require('bluebird');var rs=require(_0xef0b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xef0b('0x4'));var logger=require(_0xef0b('0x5'))('rpc');var config=require(_0xef0b('0x6'));var jayson=require(_0xef0b('0x7'));var client=jayson[_0xef0b('0x8')][_0xef0b('0x9')]({'port':0x232a});config['redis']=_[_0xef0b('0xa')](config[_0xef0b('0xb')],{'host':_0xef0b('0xc'),'port':0x18eb});var socket=require(_0xef0b('0xd'))(new Redis(config[_0xef0b('0xb')]));require(_0xef0b('0xe'))[_0xef0b('0xf')](socket);function respondWithRpcPromise(_0xb88d8,_0x4a2a4e,_0x260129){return new BPromise(function(_0x57e9d2,_0x3fe820){return client['request'](_0xb88d8,_0x260129)[_0xef0b('0x10')](function(_0x24a549){logger[_0xef0b('0x11')](_0xef0b('0x12'),_0x4a2a4e,_0xef0b('0x13'));logger[_0xef0b('0x14')](_0xef0b('0x15'),_0x4a2a4e,_0xef0b('0x13'),JSON['stringify'](_0x24a549));if(_0x24a549['error']){if(_0x24a549['error']['code']===0x1f4){logger[_0xef0b('0x16')](_0xef0b('0x12'),_0x4a2a4e,_0x24a549[_0xef0b('0x16')][_0xef0b('0x17')]);return _0x3fe820(_0x24a549[_0xef0b('0x16')][_0xef0b('0x17')]);}logger[_0xef0b('0x16')](_0xef0b('0x12'),_0x4a2a4e,_0x24a549['error'][_0xef0b('0x17')]);return _0x57e9d2(_0x24a549[_0xef0b('0x16')][_0xef0b('0x17')]);}else{logger['info'](_0xef0b('0x12'),_0x4a2a4e,_0xef0b('0x13'));_0x57e9d2(_0x24a549[_0xef0b('0x18')]['message']);}})[_0xef0b('0x19')](function(_0x32b502){logger[_0xef0b('0x16')](_0xef0b('0x12'),_0x4a2a4e,_0x32b502);_0x3fe820(_0x32b502);});});}exports[_0xef0b('0x1a')]=function(_0x47c680){var _0x29fb21=this;return new Promise(function(_0x4fe273,_0x1b03ce){return db[_0xef0b('0x1b')][_0xef0b('0x1c')]({'raw':_0x47c680['options']?_0x47c680[_0xef0b('0x1d')][_0xef0b('0x1e')]===undefined?!![]:![]:!![],'where':_0x47c680[_0xef0b('0x1d')]?_0x47c680[_0xef0b('0x1d')][_0xef0b('0x1f')]||null:null,'attributes':_0x47c680[_0xef0b('0x1d')]?_0x47c680[_0xef0b('0x1d')][_0xef0b('0x20')]||null:null,'include':_0x47c680[_0xef0b('0x1d')]?_0x47c680['options'][_0xef0b('0x21')]?_['map'](_0x47c680[_0xef0b('0x1d')][_0xef0b('0x21')],function(_0x1e7e38){return{'model':db[_0x1e7e38[_0xef0b('0x22')]],'as':_0x1e7e38['as'],'attributes':_0x1e7e38[_0xef0b('0x20')],'include':_0x1e7e38['include']?_['map'](_0x1e7e38[_0xef0b('0x21')],function(_0x244164){return{'model':db[_0x244164[_0xef0b('0x22')]],'as':_0x244164['as'],'attributes':_0x244164['attributes'],'include':_0x244164[_0xef0b('0x21')]?_['map'](_0x244164[_0xef0b('0x21')],function(_0x3d9042){return{'model':db[_0x3d9042[_0xef0b('0x22')]],'as':_0x3d9042['as'],'attributes':_0x3d9042['attributes']};}):[]};}):[]};}):[]:[]})[_0xef0b('0x10')](function(_0x127a35){logger[_0xef0b('0x11')](_0xef0b('0x1a'),_0x47c680);logger[_0xef0b('0x14')](_0xef0b('0x1a'),_0x47c680,JSON[_0xef0b('0x23')](_0x127a35));_0x4fe273(_0x127a35);})[_0xef0b('0x19')](function(_0x127ece){logger['error'](_0xef0b('0x1a'),_0x127ece[_0xef0b('0x17')],_0x47c680);_0x1b03ce(_0x29fb21['error'](0x1f4,_0x127ece[_0xef0b('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 53afe76..71d41c1 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 _0x065e=['register','length','squareProject:','./squareProject.events','remove','update','emit','removeListener'];(function(_0x265aa2,_0x220072){var _0x447a3a=function(_0x1512cc){while(--_0x1512cc){_0x265aa2['push'](_0x265aa2['shift']());}};_0x447a3a(++_0x220072);}(_0x065e,0xeb));var _0xe065=function(_0x515e90,_0x386b65){_0x515e90=_0x515e90-0x0;var _0x58b5e1=_0x065e[_0x515e90];return _0x58b5e1;};'use strict';var SquareProjectEvents=require(_0xe065('0x0'));var events=['save',_0xe065('0x1'),_0xe065('0x2')];function createListener(_0x53f66e,_0x506251){return function(_0x3019bb){_0x506251[_0xe065('0x3')](_0x53f66e,_0x3019bb);};}function removeListener(_0x399f47,_0x5894c2){return function(){SquareProjectEvents[_0xe065('0x4')](_0x399f47,_0x5894c2);};}exports[_0xe065('0x5')]=function(_0x1749af){for(var _0x2110eb=0x0,_0x550308=events[_0xe065('0x6')];_0x2110eb<_0x550308;_0x2110eb++){var _0x15fd1d=events[_0x2110eb];var _0x5020ce=createListener(_0xe065('0x7')+_0x15fd1d,_0x1749af);SquareProjectEvents['on'](_0x15fd1d,_0x5020ce);}}; \ No newline at end of file +var _0x3d13=['remove','update','register','squareProject:','./squareProject.events','save'];(function(_0x3aec88,_0x4440f4){var _0x841404=function(_0x16f205){while(--_0x16f205){_0x3aec88['push'](_0x3aec88['shift']());}};_0x841404(++_0x4440f4);}(_0x3d13,0x6a));var _0x33d1=function(_0x3e9659,_0x205a75){_0x3e9659=_0x3e9659-0x0;var _0x1a8209=_0x3d13[_0x3e9659];return _0x1a8209;};'use strict';var SquareProjectEvents=require(_0x33d1('0x0'));var events=[_0x33d1('0x1'),_0x33d1('0x2'),_0x33d1('0x3')];function createListener(_0x36764f,_0x124bbd){return function(_0x17ec33){_0x124bbd['emit'](_0x36764f,_0x17ec33);};}function removeListener(_0x464f92,_0x367607){return function(){SquareProjectEvents['removeListener'](_0x464f92,_0x367607);};}exports[_0x33d1('0x4')]=function(_0x35d162){for(var _0x2c2265=0x0,_0x61a506=events['length'];_0x2c2265<_0x61a506;_0x2c2265++){var _0x13c8ea=events[_0x2c2265];var _0x41e0a1=createListener(_0x33d1('0x5')+_0x13c8ea,_0x35d162);SquareProjectEvents['on'](_0x13c8ea,_0x41e0a1);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index e1cc9d8..0ea262a 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 _0x0295=['isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x0295,0x1f0));var _0x5029=function(_0x2caf41,_0x5b398e){_0x2caf41=_0x2caf41-0x0;var _0x5ca4de=_0x0295[_0x2caf41];return _0x5ca4de;};'use strict';var multer=require(_0x5029('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5029('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5029('0x2'));var auth=require(_0x5029('0x3'));var interaction=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var controller=require(_0x5029('0x6'));router[_0x5029('0x7')]('/',auth[_0x5029('0x8')](),controller[_0x5029('0x9')]);router[_0x5029('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5029('0x7')]('/:id/download',auth[_0x5029('0x8')](),controller['download']);router[_0x5029('0xa')]('/',auth['isAuthenticated'](),controller[_0x5029('0xb')]);router[_0x5029('0xc')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0xe')]);router[_0x5029('0xf')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0x10')]);module[_0x5029('0x11')]=router; \ No newline at end of file +var _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x23894d,_0x543b7f){var _0xa2f64c=function(_0x34e7d2){while(--_0x34e7d2){_0x23894d['push'](_0x23894d['shift']());}};_0xa2f64c(++_0x543b7f);}(_0x4975,0x86));var _0x5497=function(_0x4aa648,_0x28983a){_0x4aa648=_0x4aa648-0x0;var _0x2234e9=_0x4975[_0x4aa648];return _0x2234e9;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0x11')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 57fe925..7b32545 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 _0x038b=['lastIndexOf','exports','STRING','VIRTUAL','substring'];(function(_0x24c279,_0x22009b){var _0x32fcea=function(_0xbe254c){while(--_0xbe254c){_0x24c279['push'](_0x24c279['shift']());}};_0x32fcea(++_0x22009b);}(_0x038b,0x114));var _0xb038=function(_0x1ba1c2,_0x290640){_0x1ba1c2=_0x1ba1c2-0x0;var _0x3bc0c2=_0x038b[_0x1ba1c2];return _0x3bc0c2;};'use strict';var Sequelize=require('sequelize');module[_0xb038('0x0')]={'uniqueid':{'type':Sequelize[_0xb038('0x1')]},'callerid':{'type':Sequelize[_0xb038('0x1')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xb038('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb038('0x1')]},'accountcode':{'type':Sequelize[_0xb038('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xb038('0x1')]},'saveName':{'type':Sequelize[_0xb038('0x1')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xb038('0x2')],'get':function(){var _0x1b077a='';var _0x1534a9=this['getDataValue']('savePath');if(_0x1534a9){_0x1b077a=_0x1534a9[_0xb038('0x3')](_0x1534a9[_0xb038('0x4')]('.'));}return _0x1b077a;}}}; \ No newline at end of file +var _0x31f0=['getDataValue','savePath','substring','sequelize','STRING','VIRTUAL'];(function(_0x5d61c0,_0x39e7cb){var _0x5d0d03=function(_0x523f11){while(--_0x523f11){_0x5d61c0['push'](_0x5d61c0['shift']());}};_0x5d0d03(++_0x39e7cb);}(_0x31f0,0xb7));var _0x031f=function(_0x2a2931,_0x6f3611){_0x2a2931=_0x2a2931-0x0;var _0x41f43d=_0x31f0[_0x2a2931];return _0x41f43d;};'use strict';var Sequelize=require(_0x031f('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x031f('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x031f('0x1')]},'context':{'type':Sequelize[_0x031f('0x1')]},'extension':{'type':Sequelize[_0x031f('0x1')]},'priority':{'type':Sequelize[_0x031f('0x1')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x031f('0x1')]},'projectName':{'type':Sequelize[_0x031f('0x1')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x031f('0x2')],'get':function(){var _0x487e65='';var _0x365f59=this[_0x031f('0x3')](_0x031f('0x4'));if(_0x365f59){_0x487e65=_0x365f59[_0x031f('0x5')](_0x365f59['lastIndexOf']('.'));}return _0x487e65;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 5d7734f..613f3b7 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 _0x2d8c=['desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','includeAll','findAll','rows','catch','params','include','options','create','body','find','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','send','Not\x20found','isNil','cancellazione\x20fisica\x20documento\x20%s','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce'];(function(_0x844da8,_0x1372c3){var _0x53495a=function(_0x4347ab){while(--_0x4347ab){_0x844da8['push'](_0x844da8['shift']());}};_0x53495a(++_0x1372c3);}(_0x2d8c,0x1e6));var _0xc2d8=function(_0x59616b,_0x38e534){_0x59616b=_0x59616b-0x0;var _0x5c4523=_0x2d8c[_0x59616b];return _0x5c4523;};'use strict';var emlformat=require(_0xc2d8('0x0'));var rimraf=require(_0xc2d8('0x1'));var zipdir=require(_0xc2d8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc2d8('0x3'));var moment=require(_0xc2d8('0x4'));var BPromise=require(_0xc2d8('0x5'));var Mustache=require(_0xc2d8('0x6'));var util=require(_0xc2d8('0x7'));var path=require(_0xc2d8('0x8'));var sox=require(_0xc2d8('0x9'));var csv=require(_0xc2d8('0xa'));var ejs=require(_0xc2d8('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc2d8('0xc'));var crypto=require('crypto');var jsforce=require(_0xc2d8('0xd'));var deskjs=require(_0xc2d8('0xe'));var toCsv=require(_0xc2d8('0xa'));var querystring=require(_0xc2d8('0xf'));var Papa=require('papaparse');var Redis=require(_0xc2d8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc2d8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc2d8('0x12'));var logger=require(_0xc2d8('0x13'))('api');var utils=require(_0xc2d8('0x14'));var config=require(_0xc2d8('0x15'));var licenseUtil=require(_0xc2d8('0x16'));var db=require(_0xc2d8('0x17'))['db'];function respondWithStatusCode(_0x3e93f3,_0x2bd00c){_0x2bd00c=_0x2bd00c||0xcc;return function(_0x1ad066){if(_0x1ad066){return _0x3e93f3[_0xc2d8('0x18')](_0x2bd00c);}return _0x3e93f3[_0xc2d8('0x19')](_0x2bd00c)[_0xc2d8('0x1a')]();};}function respondWithResult(_0xbbf048,_0x22b77e){_0x22b77e=_0x22b77e||0xc8;return function(_0x159b52){if(_0x159b52){return _0xbbf048[_0xc2d8('0x19')](_0x22b77e)[_0xc2d8('0x1b')](_0x159b52);}};}function respondWithFilteredResult(_0x3a8c30,_0x551f36){return function(_0xf721c0){if(_0xf721c0){var _0x27c11a=typeof _0x551f36[_0xc2d8('0x1c')]==='undefined'&&typeof _0x551f36[_0xc2d8('0x1d')]===_0xc2d8('0x1e');var _0x4ed6b7=_0xf721c0[_0xc2d8('0x1f')];var _0x14f126=_0x27c11a?0x0:_0x551f36[_0xc2d8('0x1c')];var _0x5c9652=_0x27c11a?_0xf721c0[_0xc2d8('0x1f')]:_0x551f36['offset']+_0x551f36[_0xc2d8('0x1d')];var _0x2c7ffd;if(_0x5c9652>=_0x4ed6b7){_0x5c9652=_0x4ed6b7;_0x2c7ffd=0xc8;}else{_0x2c7ffd=0xce;}_0x3a8c30[_0xc2d8('0x19')](_0x2c7ffd);return _0x3a8c30['set'](_0xc2d8('0x20'),_0x14f126+'-'+_0x5c9652+'/'+_0x4ed6b7)[_0xc2d8('0x1b')](_0xf721c0);}return null;};}function patchUpdates(_0x50a039){return function(_0x2dbde1){try{jsonpatch[_0xc2d8('0x21')](_0x2dbde1,_0x50a039,!![]);}catch(_0x33cd6d){return BPromise[_0xc2d8('0x22')](_0x33cd6d);}return _0x2dbde1[_0xc2d8('0x23')]();};}function saveUpdates(_0xccdac8,_0x44a406){return function(_0x156706){if(_0x156706){return _0x156706[_0xc2d8('0x24')](_0xccdac8)[_0xc2d8('0x25')](function(_0x4e117b){return _0x4e117b;});}return null;};}function removeEntity(_0x4e3e7f,_0x43fb2a){return function(_0x104c7a){if(_0x104c7a){return _0x104c7a[_0xc2d8('0x26')]()[_0xc2d8('0x25')](function(){_0x4e3e7f[_0xc2d8('0x19')](0xcc)[_0xc2d8('0x1a')]();});}};}function handleEntityNotFound(_0x106a38,_0xfbbc00){return function(_0x5bcda3){if(!_0x5bcda3){_0x106a38[_0xc2d8('0x18')](0x194);}return _0x5bcda3;};}function handleError(_0x42f82e,_0x215fc5){_0x215fc5=_0x215fc5||0x1f4;return function(_0x237e4b){logger[_0xc2d8('0x27')](_0x237e4b[_0xc2d8('0x28')]);if(_0x237e4b[_0xc2d8('0x29')]){delete _0x237e4b[_0xc2d8('0x29')];}_0x42f82e[_0xc2d8('0x19')](_0x215fc5)['send'](_0x237e4b);};}exports[_0xc2d8('0x2a')]=function(_0x13fc76,_0x3f8f76){var _0x2e7502={},_0xee91a8={},_0x459d19={'count':0x0,'rows':[]};var _0x4e5488=_[_0xc2d8('0x2b')](db[_0xc2d8('0x2c')][_0xc2d8('0x2d')],function(_0x428da3){return{'name':_0x428da3[_0xc2d8('0x2e')],'type':_0x428da3[_0xc2d8('0x2f')][_0xc2d8('0x30')]};});_0xee91a8[_0xc2d8('0x31')]=_[_0xc2d8('0x2b')](_0x4e5488,'name');_0xee91a8['query']=_[_0xc2d8('0x32')](_0x13fc76['query']);_0xee91a8['filters']=_['intersection'](_0xee91a8[_0xc2d8('0x31')],_0xee91a8[_0xc2d8('0x33')]);_0x2e7502[_0xc2d8('0x34')]=_[_0xc2d8('0x35')](_0xee91a8[_0xc2d8('0x31')],qs[_0xc2d8('0x36')](_0x13fc76[_0xc2d8('0x33')][_0xc2d8('0x36')]));_0x2e7502[_0xc2d8('0x34')]=_0x2e7502[_0xc2d8('0x34')][_0xc2d8('0x37')]?_0x2e7502[_0xc2d8('0x34')]:_0xee91a8[_0xc2d8('0x31')];if(!_0x13fc76['query'][_0xc2d8('0x38')]('nolimit')){_0x2e7502['limit']=qs['limit'](_0x13fc76[_0xc2d8('0x33')][_0xc2d8('0x1d')]);_0x2e7502[_0xc2d8('0x1c')]=qs[_0xc2d8('0x1c')](_0x13fc76[_0xc2d8('0x33')]['offset']);}_0x2e7502[_0xc2d8('0x39')]=qs[_0xc2d8('0x3a')](_0x13fc76[_0xc2d8('0x33')][_0xc2d8('0x3a')]);_0x2e7502[_0xc2d8('0x3b')]=qs[_0xc2d8('0x3c')](_[_0xc2d8('0x3d')](_0x13fc76['query'],_0xee91a8[_0xc2d8('0x3c')]),_0x4e5488);if(_0x13fc76[_0xc2d8('0x33')][_0xc2d8('0x3e')]){_0x2e7502[_0xc2d8('0x3b')]=_[_0xc2d8('0x3f')](_0x2e7502['where'],{'$or':_[_0xc2d8('0x2b')](_0x4e5488,function(_0x1a0b57){if(_0x1a0b57[_0xc2d8('0x2f')]!=='VIRTUAL'){var _0x2a8099={};_0x2a8099[_0x1a0b57[_0xc2d8('0x29')]]={'$like':'%'+_0x13fc76[_0xc2d8('0x33')][_0xc2d8('0x3e')]+'%'};return _0x2a8099;}})});}_0x2e7502=_['merge']({},_0x2e7502,_0x13fc76['options']);var _0x257d24={'where':_0x2e7502[_0xc2d8('0x3b')]};return db['SquareRecording'][_0xc2d8('0x1f')](_0x257d24)[_0xc2d8('0x25')](function(_0x57730c){_0x459d19[_0xc2d8('0x1f')]=_0x57730c;if(_0x13fc76[_0xc2d8('0x33')][_0xc2d8('0x40')]){_0x2e7502['include']=[{'all':!![]}];}return db[_0xc2d8('0x2c')][_0xc2d8('0x41')](_0x2e7502);})[_0xc2d8('0x25')](function(_0x4e9ff8){_0x459d19[_0xc2d8('0x42')]=_0x4e9ff8;return _0x459d19;})[_0xc2d8('0x25')](respondWithFilteredResult(_0x3f8f76,_0x2e7502))[_0xc2d8('0x43')](handleError(_0x3f8f76,null));};exports['show']=function(_0x214029,_0x59ba72){var _0x1ca3d4={'raw':!![],'where':{'id':_0x214029[_0xc2d8('0x44')]['id']}},_0x38cf52={};_0x38cf52[_0xc2d8('0x31')]=_[_0xc2d8('0x32')](db[_0xc2d8('0x2c')][_0xc2d8('0x2d')]);_0x38cf52['query']=_[_0xc2d8('0x32')](_0x214029['query']);_0x38cf52['filters']=_['intersection'](_0x38cf52[_0xc2d8('0x31')],_0x38cf52[_0xc2d8('0x33')]);_0x1ca3d4[_0xc2d8('0x34')]=_[_0xc2d8('0x35')](_0x38cf52[_0xc2d8('0x31')],qs[_0xc2d8('0x36')](_0x214029[_0xc2d8('0x33')][_0xc2d8('0x36')]));_0x1ca3d4[_0xc2d8('0x34')]=_0x1ca3d4[_0xc2d8('0x34')]['length']?_0x1ca3d4[_0xc2d8('0x34')]:_0x38cf52[_0xc2d8('0x31')];if(_0x214029[_0xc2d8('0x33')][_0xc2d8('0x40')]){_0x1ca3d4[_0xc2d8('0x45')]=[{'all':!![]}];}_0x1ca3d4=_['merge']({},_0x1ca3d4,_0x214029[_0xc2d8('0x46')]);return db[_0xc2d8('0x2c')]['find'](_0x1ca3d4)[_0xc2d8('0x25')](handleEntityNotFound(_0x59ba72,null))[_0xc2d8('0x25')](respondWithResult(_0x59ba72,null))['catch'](handleError(_0x59ba72,null));};exports[_0xc2d8('0x47')]=function(_0x525803,_0x265205){return db[_0xc2d8('0x2c')][_0xc2d8('0x47')](_0x525803[_0xc2d8('0x48')],{})[_0xc2d8('0x25')](respondWithResult(_0x265205,0xc9))[_0xc2d8('0x43')](handleError(_0x265205,null));};exports[_0xc2d8('0x24')]=function(_0x50acf0,_0x55221f){if(_0x50acf0[_0xc2d8('0x48')]['id']){delete _0x50acf0['body']['id'];}return db[_0xc2d8('0x2c')][_0xc2d8('0x49')]({'where':{'id':_0x50acf0[_0xc2d8('0x44')]['id']}})['then'](handleEntityNotFound(_0x55221f,null))[_0xc2d8('0x25')](saveUpdates(_0x50acf0[_0xc2d8('0x48')],null))['then'](respondWithResult(_0x55221f,null))[_0xc2d8('0x43')](handleError(_0x55221f,null));};exports[_0xc2d8('0x4a')]=function(_0x1b05ba,_0x39494b,_0x2d7425){var _0x3273ed=require(_0xc2d8('0x4b'));var _0xd11425=![];var _0x5c677f={};if(_0x1b05ba[_0xc2d8('0x33')][_0xc2d8('0x2f')]&&_0x1b05ba[_0xc2d8('0x33')][_0xc2d8('0x2f')]===_0xc2d8('0x4c')){_0x5c677f['uniqueid']=_0x1b05ba[_0xc2d8('0x44')]['id'];}else{_0x5c677f['id']=_0x1b05ba['params']['id'];}return db[_0xc2d8('0x2c')][_0xc2d8('0x49')]({'where':_0x5c677f,'attributes':['id',_0xc2d8('0x4d'),_0xc2d8('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x39494b,null))[_0xc2d8('0x25')](function(_0x44e66c){if(_0x44e66c){var _0xa6ad41=_0x44e66c[_0xc2d8('0x4d')];var _0x273b18=util[_0xc2d8('0x4f')](_0xc2d8('0x50'),_0xa6ad41);if(fs[_0xc2d8('0x51')](_0x273b18)){_0xd11425=!![];return _0x3273ed[_0xc2d8('0x52')](_0x273b18,_0xa6ad41,config[_0xc2d8('0x53')][_0xc2d8('0x54')])[_0xc2d8('0x25')](function(){return _0x44e66c;});}return _0x44e66c;}})[_0xc2d8('0x25')](function(_0x5a7b86){if(_0x5a7b86){var _0x2c8c23=_0x5a7b86[_0xc2d8('0x4d')];if(!fs[_0xc2d8('0x51')](_0x2c8c23)){throw new db[(_0xc2d8('0x55'))][(_0xc2d8('0x56'))](_0xc2d8('0x57'));}if(_0x5a7b86['filename']){return _0x39494b[_0xc2d8('0x4a')](_0x2c8c23,_0x5a7b86[_0xc2d8('0x4e')]+path[_0xc2d8('0x58')](_0x2c8c23),function(){if(_0xd11425){fs[_0xc2d8('0x59')](_0x2c8c23);}});}else{return _0x39494b[_0xc2d8('0x4a')](_0x2c8c23,function(_0x4d84ee){if(_0xd11425){fs[_0xc2d8('0x59')](_0x2c8c23);}});}}})[_0xc2d8('0x43')](function(_0x1f1d0e){if(_0x1f1d0e[_0xc2d8('0x5a')]==='SquareRecording\x20not\x20found'){_0x39494b[_0xc2d8('0x19')](0x194)[_0xc2d8('0x5b')](_0xc2d8('0x5c'));}else{return handleError(_0x39494b,null);}});};exports['destroy']=function(_0x56731f,_0x2d68dd){return db['SquareRecording'][_0xc2d8('0x49')]({'where':{'id':_0x56731f[_0xc2d8('0x44')]['id']}})[_0xc2d8('0x25')](function(_0x3b937c){if(_[_0xc2d8('0x5d')](_0x3b937c)){throw new ReferenceError('Entity\x20not\x20found');}return _0x3b937c;})[_0xc2d8('0x25')](function(_0xbdf9c4){var _0x364c51=_0xbdf9c4[_0xc2d8('0x4d')];logger['info'](_0xc2d8('0x5e'),_0x364c51);if(!_[_0xc2d8('0x5d')](_0xbdf9c4[_0xc2d8('0x4d')])&&fs[_0xc2d8('0x51')](_0x364c51)){logger[_0xc2d8('0x5f')]('File:\x20\x22'+_0x364c51+_0xc2d8('0x60'));fs[_0xc2d8('0x61')](_0x364c51);}_0x364c51=_0x364c51+_0xc2d8('0x62');if(!_[_0xc2d8('0x5d')](_0xbdf9c4['savePath'])&&fs['existsSync'](_0x364c51)){logger['info'](_0xc2d8('0x63')+_0x364c51+_0xc2d8('0x60'));fs[_0xc2d8('0x61')](_0x364c51);}return _0xbdf9c4;})[_0xc2d8('0x25')](function(_0x460d27){if(!_0x460d27)throw new InternalError();return _0x460d27[_0xc2d8('0x26')]();})[_0xc2d8('0x25')](function(){_0x2d68dd[_0xc2d8('0x19')](0xcc)[_0xc2d8('0x1a')]();})[_0xc2d8('0x43')](handleError(_0x2d68dd,null));}; \ No newline at end of file +var _0xcad5=['create','body','find','../../components/encryptor','uniqueid','savePath','filename','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','SquareRecording\x20not\x20found','download','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','error','stack','name','send','SquareRecording','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','filter','where','merge','map','options','includeAll','include','rows','catch','show','params'];(function(_0x11df66,_0x9eabf){var _0xc2dca1=function(_0x2f8c9a){while(--_0x2f8c9a){_0x11df66['push'](_0x11df66['shift']());}};_0xc2dca1(++_0x9eabf);}(_0xcad5,0x1a3));var _0x5cad=function(_0x2b519d,_0x23b1a2){_0x2b519d=_0x2b519d-0x0;var _0x4eb64d=_0xcad5[_0x2b519d];return _0x4eb64d;};'use strict';var emlformat=require(_0x5cad('0x0'));var rimraf=require(_0x5cad('0x1'));var zipdir=require(_0x5cad('0x2'));var jsonpatch=require(_0x5cad('0x3'));var rp=require(_0x5cad('0x4'));var moment=require(_0x5cad('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5cad('0x6'));var util=require(_0x5cad('0x7'));var path=require('path');var sox=require(_0x5cad('0x8'));var csv=require('to-csv');var ejs=require(_0x5cad('0x9'));var fs=require('fs');var fs_extra=require(_0x5cad('0xa'));var _=require(_0x5cad('0xb'));var squel=require(_0x5cad('0xc'));var crypto=require(_0x5cad('0xd'));var jsforce=require(_0x5cad('0xe'));var deskjs=require(_0x5cad('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5cad('0x10'));var Papa=require(_0x5cad('0x11'));var Redis=require(_0x5cad('0x12'));var authService=require(_0x5cad('0x13'));var qs=require(_0x5cad('0x14'));var as=require(_0x5cad('0x15'));var hardwareService=require(_0x5cad('0x16'));var logger=require(_0x5cad('0x17'))('api');var utils=require(_0x5cad('0x18'));var config=require(_0x5cad('0x19'));var licenseUtil=require(_0x5cad('0x1a'));var db=require(_0x5cad('0x1b'))['db'];function respondWithStatusCode(_0x96c4ea,_0x23bf5a){_0x23bf5a=_0x23bf5a||0xcc;return function(_0x57224e){if(_0x57224e){return _0x96c4ea[_0x5cad('0x1c')](_0x23bf5a);}return _0x96c4ea[_0x5cad('0x1d')](_0x23bf5a)[_0x5cad('0x1e')]();};}function respondWithResult(_0x142f21,_0x40e7d6){_0x40e7d6=_0x40e7d6||0xc8;return function(_0x47fafe){if(_0x47fafe){return _0x142f21['status'](_0x40e7d6)['json'](_0x47fafe);}};}function respondWithFilteredResult(_0x1ba98f,_0x207e2b){return function(_0x72e54){if(_0x72e54){var _0x3aa594=typeof _0x207e2b[_0x5cad('0x1f')]===_0x5cad('0x20')&&typeof _0x207e2b[_0x5cad('0x21')]===_0x5cad('0x20');var _0x21c036=_0x72e54[_0x5cad('0x22')];var _0x245747=_0x3aa594?0x0:_0x207e2b[_0x5cad('0x1f')];var _0x27028e=_0x3aa594?_0x72e54[_0x5cad('0x22')]:_0x207e2b[_0x5cad('0x1f')]+_0x207e2b[_0x5cad('0x21')];var _0x27cfcf;if(_0x27028e>=_0x21c036){_0x27028e=_0x21c036;_0x27cfcf=0xc8;}else{_0x27cfcf=0xce;}_0x1ba98f['status'](_0x27cfcf);return _0x1ba98f[_0x5cad('0x23')](_0x5cad('0x24'),_0x245747+'-'+_0x27028e+'/'+_0x21c036)[_0x5cad('0x25')](_0x72e54);}return null;};}function patchUpdates(_0x139602){return function(_0x4c2fc0){try{jsonpatch['apply'](_0x4c2fc0,_0x139602,!![]);}catch(_0x5eb5d6){return BPromise['reject'](_0x5eb5d6);}return _0x4c2fc0['save']();};}function saveUpdates(_0x51b279,_0xc0ae4d){return function(_0xd1b9a6){if(_0xd1b9a6){return _0xd1b9a6[_0x5cad('0x26')](_0x51b279)[_0x5cad('0x27')](function(_0x34286e){return _0x34286e;});}return null;};}function removeEntity(_0x158dfa,_0x4d2e9c){return function(_0x49f6a6){if(_0x49f6a6){return _0x49f6a6[_0x5cad('0x28')]()[_0x5cad('0x27')](function(){_0x158dfa[_0x5cad('0x1d')](0xcc)[_0x5cad('0x1e')]();});}};}function handleEntityNotFound(_0xca4b86,_0x137fe0){return function(_0x54dbd3){if(!_0x54dbd3){_0xca4b86['sendStatus'](0x194);}return _0x54dbd3;};}function handleError(_0x2ac19f,_0x252d20){_0x252d20=_0x252d20||0x1f4;return function(_0x194604){logger[_0x5cad('0x29')](_0x194604[_0x5cad('0x2a')]);if(_0x194604[_0x5cad('0x2b')]){delete _0x194604[_0x5cad('0x2b')];}_0x2ac19f[_0x5cad('0x1d')](_0x252d20)[_0x5cad('0x2c')](_0x194604);};}exports['index']=function(_0x2ffbea,_0x44845d){var _0x197ffb={},_0x550913={},_0x35b4ec={'count':0x0,'rows':[]};var _0xac1cad=_['map'](db[_0x5cad('0x2d')][_0x5cad('0x2e')],function(_0x5789d2){return{'name':_0x5789d2[_0x5cad('0x2f')],'type':_0x5789d2[_0x5cad('0x30')][_0x5cad('0x31')]};});_0x550913[_0x5cad('0x32')]=_['map'](_0xac1cad,_0x5cad('0x2b'));_0x550913[_0x5cad('0x33')]=_[_0x5cad('0x34')](_0x2ffbea[_0x5cad('0x33')]);_0x550913[_0x5cad('0x35')]=_[_0x5cad('0x36')](_0x550913[_0x5cad('0x32')],_0x550913[_0x5cad('0x33')]);_0x197ffb[_0x5cad('0x37')]=_[_0x5cad('0x36')](_0x550913[_0x5cad('0x32')],qs[_0x5cad('0x38')](_0x2ffbea[_0x5cad('0x33')]['fields']));_0x197ffb['attributes']=_0x197ffb['attributes'][_0x5cad('0x39')]?_0x197ffb[_0x5cad('0x37')]:_0x550913[_0x5cad('0x32')];if(!_0x2ffbea[_0x5cad('0x33')]['hasOwnProperty'](_0x5cad('0x3a'))){_0x197ffb[_0x5cad('0x21')]=qs[_0x5cad('0x21')](_0x2ffbea[_0x5cad('0x33')][_0x5cad('0x21')]);_0x197ffb[_0x5cad('0x1f')]=qs[_0x5cad('0x1f')](_0x2ffbea[_0x5cad('0x33')]['offset']);}_0x197ffb['order']=qs[_0x5cad('0x3b')](_0x2ffbea['query'][_0x5cad('0x3b')]);_0x197ffb['where']=qs['filters'](_['pick'](_0x2ffbea[_0x5cad('0x33')],_0x550913[_0x5cad('0x35')]),_0xac1cad);if(_0x2ffbea[_0x5cad('0x33')][_0x5cad('0x3c')]){_0x197ffb[_0x5cad('0x3d')]=_[_0x5cad('0x3e')](_0x197ffb[_0x5cad('0x3d')],{'$or':_[_0x5cad('0x3f')](_0xac1cad,function(_0x20c48a){if(_0x20c48a[_0x5cad('0x30')]!=='VIRTUAL'){var _0xda4ac2={};_0xda4ac2[_0x20c48a[_0x5cad('0x2b')]]={'$like':'%'+_0x2ffbea[_0x5cad('0x33')][_0x5cad('0x3c')]+'%'};return _0xda4ac2;}})});}_0x197ffb=_[_0x5cad('0x3e')]({},_0x197ffb,_0x2ffbea[_0x5cad('0x40')]);var _0x455611={'where':_0x197ffb[_0x5cad('0x3d')]};return db[_0x5cad('0x2d')][_0x5cad('0x22')](_0x455611)[_0x5cad('0x27')](function(_0x465feb){_0x35b4ec[_0x5cad('0x22')]=_0x465feb;if(_0x2ffbea['query'][_0x5cad('0x41')]){_0x197ffb[_0x5cad('0x42')]=[{'all':!![]}];}return db[_0x5cad('0x2d')]['findAll'](_0x197ffb);})['then'](function(_0x3c9aec){_0x35b4ec[_0x5cad('0x43')]=_0x3c9aec;return _0x35b4ec;})[_0x5cad('0x27')](respondWithFilteredResult(_0x44845d,_0x197ffb))[_0x5cad('0x44')](handleError(_0x44845d,null));};exports[_0x5cad('0x45')]=function(_0x4eab8f,_0x28c424){var _0x5122c7={'raw':!![],'where':{'id':_0x4eab8f[_0x5cad('0x46')]['id']}},_0x3d4a80={};_0x3d4a80[_0x5cad('0x32')]=_[_0x5cad('0x34')](db[_0x5cad('0x2d')][_0x5cad('0x2e')]);_0x3d4a80[_0x5cad('0x33')]=_[_0x5cad('0x34')](_0x4eab8f['query']);_0x3d4a80[_0x5cad('0x35')]=_[_0x5cad('0x36')](_0x3d4a80['model'],_0x3d4a80[_0x5cad('0x33')]);_0x5122c7['attributes']=_[_0x5cad('0x36')](_0x3d4a80[_0x5cad('0x32')],qs[_0x5cad('0x38')](_0x4eab8f[_0x5cad('0x33')][_0x5cad('0x38')]));_0x5122c7[_0x5cad('0x37')]=_0x5122c7[_0x5cad('0x37')][_0x5cad('0x39')]?_0x5122c7[_0x5cad('0x37')]:_0x3d4a80[_0x5cad('0x32')];if(_0x4eab8f[_0x5cad('0x33')][_0x5cad('0x41')]){_0x5122c7['include']=[{'all':!![]}];}_0x5122c7=_[_0x5cad('0x3e')]({},_0x5122c7,_0x4eab8f[_0x5cad('0x40')]);return db[_0x5cad('0x2d')]['find'](_0x5122c7)[_0x5cad('0x27')](handleEntityNotFound(_0x28c424,null))['then'](respondWithResult(_0x28c424,null))['catch'](handleError(_0x28c424,null));};exports[_0x5cad('0x47')]=function(_0x21e2a6,_0x141982){return db[_0x5cad('0x2d')]['create'](_0x21e2a6['body'],{})[_0x5cad('0x27')](respondWithResult(_0x141982,0xc9))[_0x5cad('0x44')](handleError(_0x141982,null));};exports[_0x5cad('0x26')]=function(_0x247ca5,_0x5adbd7){if(_0x247ca5['body']['id']){delete _0x247ca5[_0x5cad('0x48')]['id'];}return db[_0x5cad('0x2d')][_0x5cad('0x49')]({'where':{'id':_0x247ca5[_0x5cad('0x46')]['id']}})[_0x5cad('0x27')](handleEntityNotFound(_0x5adbd7,null))[_0x5cad('0x27')](saveUpdates(_0x247ca5[_0x5cad('0x48')],null))[_0x5cad('0x27')](respondWithResult(_0x5adbd7,null))[_0x5cad('0x44')](handleError(_0x5adbd7,null));};exports['download']=function(_0x211f02,_0x4576e0,_0x425384){var _0x10db66=require(_0x5cad('0x4a'));var _0x25f32f=![];var _0x40d939={};if(_0x211f02[_0x5cad('0x33')][_0x5cad('0x30')]&&_0x211f02['query']['type']===_0x5cad('0x4b')){_0x40d939['uniqueid']=_0x211f02['params']['id'];}else{_0x40d939['id']=_0x211f02[_0x5cad('0x46')]['id'];}return db[_0x5cad('0x2d')]['find']({'where':_0x40d939,'attributes':['id',_0x5cad('0x4c'),_0x5cad('0x4d')],'raw':!![]})[_0x5cad('0x27')](handleEntityNotFound(_0x4576e0,null))['then'](function(_0x1870bb){if(_0x1870bb){var _0x180e6a=_0x1870bb['savePath'];var _0x19ab0c=util['format'](_0x5cad('0x4e'),_0x180e6a);if(fs[_0x5cad('0x4f')](_0x19ab0c)){_0x25f32f=!![];return _0x10db66[_0x5cad('0x50')](_0x19ab0c,_0x180e6a,config[_0x5cad('0x51')][_0x5cad('0x52')])[_0x5cad('0x27')](function(){return _0x1870bb;});}return _0x1870bb;}})[_0x5cad('0x27')](function(_0x580c12){if(_0x580c12){var _0x56d66a=_0x580c12[_0x5cad('0x4c')];if(!fs[_0x5cad('0x4f')](_0x56d66a)){throw new db[(_0x5cad('0x53'))]['ValidationError'](_0x5cad('0x54'));}if(_0x580c12['filename']){return _0x4576e0[_0x5cad('0x55')](_0x56d66a,_0x580c12['filename']+path[_0x5cad('0x56')](_0x56d66a),function(){if(_0x25f32f){fs[_0x5cad('0x57')](_0x56d66a);}});}else{return _0x4576e0[_0x5cad('0x55')](_0x56d66a,function(_0x2faa61){if(_0x25f32f){fs[_0x5cad('0x57')](_0x56d66a);}});}}})[_0x5cad('0x44')](function(_0x90fc4b){if(_0x90fc4b[_0x5cad('0x58')]==='SquareRecording\x20not\x20found'){_0x4576e0[_0x5cad('0x1d')](0x194)['send'](_0x5cad('0x59'));}else{return handleError(_0x4576e0,null);}});};exports[_0x5cad('0x28')]=function(_0xf59aa2,_0x564094){return db[_0x5cad('0x2d')][_0x5cad('0x49')]({'where':{'id':_0xf59aa2[_0x5cad('0x46')]['id']}})[_0x5cad('0x27')](function(_0x3a671f){if(_[_0x5cad('0x5a')](_0x3a671f)){throw new ReferenceError(_0x5cad('0x5b'));}return _0x3a671f;})[_0x5cad('0x27')](function(_0x325160){var _0x2b88f4=_0x325160[_0x5cad('0x4c')];logger[_0x5cad('0x5c')](_0x5cad('0x5d'),_0x2b88f4);if(!_[_0x5cad('0x5a')](_0x325160[_0x5cad('0x4c')])&&fs['existsSync'](_0x2b88f4)){logger[_0x5cad('0x5c')](_0x5cad('0x5e')+_0x2b88f4+_0x5cad('0x5f'));fs['unlinkSync'](_0x2b88f4);}_0x2b88f4=_0x2b88f4+_0x5cad('0x60');if(!_[_0x5cad('0x5a')](_0x325160[_0x5cad('0x4c')])&&fs[_0x5cad('0x4f')](_0x2b88f4)){logger[_0x5cad('0x5c')](_0x5cad('0x5e')+_0x2b88f4+_0x5cad('0x5f'));fs[_0x5cad('0x61')](_0x2b88f4);}return _0x325160;})[_0x5cad('0x27')](function(_0x3cc5c0){if(!_0x3cc5c0)throw new InternalError();return _0x3cc5c0[_0x5cad('0x28')]();})[_0x5cad('0x27')](function(){_0x564094[_0x5cad('0x1d')](0xcc)[_0x5cad('0x1e')]();})[_0x5cad('0x44')](handleError(_0x564094,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index c3be376..4ba052d 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 _0x3d04=['../../config/environment','./squareRecording.attributes','exports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x3d04,0xbe));var _0x43d0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3d04[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var logger=require(_0x43d0('0x2'))(_0x43d0('0x3'));var moment=require(_0x43d0('0x4'));var BPromise=require(_0x43d0('0x5'));var rp=require(_0x43d0('0x6'));var fs=require('fs');var path=require(_0x43d0('0x7'));var rimraf=require('rimraf');var config=require(_0x43d0('0x8'));var attributes=require(_0x43d0('0x9'));module[_0x43d0('0xa')]=function(_0x617bf,_0x5e284f){return _0x617bf['define']('SquareRecording',attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39d2=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','square_recordings','lodash','../../config/logger'];(function(_0x2fe600,_0x37185c){var _0x1be4c2=function(_0x438b0b){while(--_0x438b0b){_0x2fe600['push'](_0x2fe600['shift']());}};_0x1be4c2(++_0x37185c);}(_0x39d2,0xf5));var _0x239d=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x39d2[_0x186376];return _0x2dbdd9;};'use strict';var _=require(_0x239d('0x0'));var util=require('util');var logger=require(_0x239d('0x1'))(_0x239d('0x2'));var moment=require(_0x239d('0x3'));var BPromise=require(_0x239d('0x4'));var rp=require(_0x239d('0x5'));var fs=require('fs');var path=require(_0x239d('0x6'));var rimraf=require(_0x239d('0x7'));var config=require(_0x239d('0x8'));var attributes=require(_0x239d('0x9'));module[_0x239d('0xa')]=function(_0x12302d,_0x1504c1){return _0x12302d[_0x239d('0xb')]('SquareRecording',attributes,{'tableName':_0x239d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index b7c5140..935e905 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 _0x3c01=['options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateSquareRecording','SquareRecording','create','body'];(function(_0x1ee04b,_0x554b3d){var _0x412848=function(_0x11917a){while(--_0x11917a){_0x1ee04b['push'](_0x1ee04b['shift']());}};_0x412848(++_0x554b3d);}(_0x3c01,0x16a));var _0x13c0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3c01[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x13c0('0x0'));var moment=require(_0x13c0('0x1'));var BPromise=require(_0x13c0('0x2'));var rs=require(_0x13c0('0x3'));var fs=require('fs');var Redis=require(_0x13c0('0x4'));var db=require(_0x13c0('0x5'))['db'];var utils=require(_0x13c0('0x6'));var logger=require(_0x13c0('0x7'))(_0x13c0('0x8'));var config=require(_0x13c0('0x9'));var jayson=require(_0x13c0('0xa'));var client=jayson[_0x13c0('0xb')][_0x13c0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x589088,_0x3ffeec,_0xd62bc2){return new BPromise(function(_0x5ad515,_0x2baaf6){return client[_0x13c0('0xd')](_0x589088,_0xd62bc2)[_0x13c0('0xe')](function(_0x1e9939){logger[_0x13c0('0xf')](_0x13c0('0x10'),_0x3ffeec,_0x13c0('0x11'));logger[_0x13c0('0x12')](_0x13c0('0x13'),_0x3ffeec,_0x13c0('0x11'),JSON[_0x13c0('0x14')](_0x1e9939));if(_0x1e9939[_0x13c0('0x15')]){if(_0x1e9939[_0x13c0('0x15')]['code']===0x1f4){logger['error']('SquareRecording,\x20%s,\x20%s',_0x3ffeec,_0x1e9939[_0x13c0('0x15')][_0x13c0('0x16')]);return _0x2baaf6(_0x1e9939[_0x13c0('0x15')][_0x13c0('0x16')]);}logger['error'](_0x13c0('0x10'),_0x3ffeec,_0x1e9939['error'][_0x13c0('0x16')]);return _0x5ad515(_0x1e9939[_0x13c0('0x15')][_0x13c0('0x16')]);}else{logger['info'](_0x13c0('0x10'),_0x3ffeec,'request\x20sent');_0x5ad515(_0x1e9939['result'][_0x13c0('0x16')]);}})[_0x13c0('0x17')](function(_0x2a5764){logger[_0x13c0('0x15')](_0x13c0('0x10'),_0x3ffeec,_0x2a5764);_0x2baaf6(_0x2a5764);});});}exports[_0x13c0('0x18')]=function(_0x2f7a5f){var _0x435b16=this;return new Promise(function(_0x2b8228,_0x3ad89f){return db[_0x13c0('0x19')][_0x13c0('0x1a')](_0x2f7a5f[_0x13c0('0x1b')],{'raw':_0x2f7a5f[_0x13c0('0x1c')]?_0x2f7a5f[_0x13c0('0x1c')][_0x13c0('0x1d')]===undefined?!![]:![]:!![]})[_0x13c0('0xe')](function(_0x406ed3){logger['info']('CreateSquareRecording',_0x2f7a5f);logger[_0x13c0('0x12')]('CreateSquareRecording',_0x2f7a5f,JSON[_0x13c0('0x14')](_0x406ed3));_0x2b8228(_0x406ed3);})[_0x13c0('0x17')](function(_0x4d21bd){logger['error'](_0x13c0('0x18'),_0x4d21bd['message'],_0x2f7a5f);_0x3ad89f(_0x435b16[_0x13c0('0x15')](0x1f4,_0x4d21bd[_0x13c0('0x16')]));});});}; \ No newline at end of file +var _0xd572=['client','http','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','CreateSquareRecording','create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xd572,0xc7));var _0x2d57=function(_0x2bb47b,_0x14df3){_0x2bb47b=_0x2bb47b-0x0;var _0x42edfa=_0xd572[_0x2bb47b];return _0x42edfa;};'use strict';var _=require('lodash');var util=require(_0x2d57('0x0'));var moment=require(_0x2d57('0x1'));var BPromise=require(_0x2d57('0x2'));var rs=require(_0x2d57('0x3'));var fs=require('fs');var Redis=require(_0x2d57('0x4'));var db=require(_0x2d57('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2d57('0x6'))('rpc');var config=require(_0x2d57('0x7'));var jayson=require(_0x2d57('0x8'));var client=jayson[_0x2d57('0x9')][_0x2d57('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54c7af,_0x36fedb,_0x3454a1){return new BPromise(function(_0x52db0e,_0x26e510){return client[_0x2d57('0xb')](_0x54c7af,_0x3454a1)[_0x2d57('0xc')](function(_0x381833){logger['info'](_0x2d57('0xd'),_0x36fedb,_0x2d57('0xe'));logger[_0x2d57('0xf')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x36fedb,'request\x20sent',JSON[_0x2d57('0x10')](_0x381833));if(_0x381833['error']){if(_0x381833[_0x2d57('0x11')][_0x2d57('0x12')]===0x1f4){logger['error']('SquareRecording,\x20%s,\x20%s',_0x36fedb,_0x381833[_0x2d57('0x11')][_0x2d57('0x13')]);return _0x26e510(_0x381833['error'][_0x2d57('0x13')]);}logger['error'](_0x2d57('0xd'),_0x36fedb,_0x381833[_0x2d57('0x11')][_0x2d57('0x13')]);return _0x52db0e(_0x381833['error'][_0x2d57('0x13')]);}else{logger[_0x2d57('0x14')](_0x2d57('0xd'),_0x36fedb,_0x2d57('0xe'));_0x52db0e(_0x381833['result']['message']);}})['catch'](function(_0x583a20){logger[_0x2d57('0x11')](_0x2d57('0xd'),_0x36fedb,_0x583a20);_0x26e510(_0x583a20);});});}exports[_0x2d57('0x15')]=function(_0x589704){var _0x5edd84=this;return new Promise(function(_0x12d516,_0x3515df){return db['SquareRecording'][_0x2d57('0x16')](_0x589704[_0x2d57('0x17')],{'raw':_0x589704[_0x2d57('0x18')]?_0x589704[_0x2d57('0x18')][_0x2d57('0x19')]===undefined?!![]:![]:!![]})[_0x2d57('0xc')](function(_0x13e5e2){logger[_0x2d57('0x14')](_0x2d57('0x15'),_0x589704);logger[_0x2d57('0xf')](_0x2d57('0x15'),_0x589704,JSON[_0x2d57('0x10')](_0x13e5e2));_0x12d516(_0x13e5e2);})['catch'](function(_0xcd73a4){logger[_0x2d57('0x11')](_0x2d57('0x15'),_0xcd73a4[_0x2d57('0x13')],_0x589704);_0x3515df(_0x5edd84[_0x2d57('0x11')](0x1f4,_0xcd73a4[_0x2d57('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 7489c76..6dc04dc 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x542f45,_0x58705f){var _0x499fc8=function(_0x4d2fbb){while(--_0x4d2fbb){_0x542f45['push'](_0x542f45['shift']());}};_0x499fc8(++_0x58705f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _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(_0x155001,_0x42199c){var _0x3dad1e=function(_0x5a9461){while(--_0x5a9461){_0x155001['push'](_0x155001['shift']());}};_0x3dad1e(++_0x42199c);}(_0xe706,0xa3));var _0x6e70=function(_0x2d8d86,_0x16e75d){_0x2d8d86=_0x2d8d86-0x0;var _0x4d91a4=_0xe706[_0x2d8d86];return _0x4d91a4;};'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 diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 2c1a3c6..da60e7c 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 _0x74d5=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x206e79,_0x5e5cf2){var _0x89597c=function(_0x581ea1){while(--_0x581ea1){_0x206e79['push'](_0x206e79['shift']());}};_0x89597c(++_0x5e5cf2);}(_0x74d5,0x13b));var _0x574d=function(_0x4266b4,_0x4859ad){_0x4266b4=_0x4266b4-0x0;var _0x1442aa=_0x74d5[_0x4266b4];return _0x1442aa;};'use strict';var Sequelize=require(_0x574d('0x0'));module[_0x574d('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x574d('0x2')]},'request':{'type':Sequelize[_0x574d('0x2')]},'channel':{'type':Sequelize[_0x574d('0x2')]},'language':{'type':Sequelize[_0x574d('0x2')]},'type':{'type':Sequelize[_0x574d('0x2')]},'uniqueid':{'type':Sequelize[_0x574d('0x2')]},'version':{'type':Sequelize[_0x574d('0x2')]},'callerid':{'type':Sequelize[_0x574d('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x574d('0x2')]},'callingani2':{'type':Sequelize[_0x574d('0x2')]},'callington':{'type':Sequelize[_0x574d('0x2')]},'callingtns':{'type':Sequelize[_0x574d('0x2')]},'dnid':{'type':Sequelize[_0x574d('0x2')]},'rdnis':{'type':Sequelize[_0x574d('0x2')]},'context':{'type':Sequelize[_0x574d('0x2')]},'extension':{'type':Sequelize[_0x574d('0x2')]},'priority':{'type':Sequelize[_0x574d('0x2')]},'enhanced':{'type':Sequelize[_0x574d('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x574d('0x2')]},'project_name':{'type':Sequelize[_0x574d('0x2')]},'joinAt':{'type':Sequelize[_0x574d('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x574d('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x3c91=['exports','STRING','BOOLEAN','sequelize'];(function(_0x1314d0,_0x5257a7){var _0x54bf7d=function(_0x5aeb9c){while(--_0x5aeb9c){_0x1314d0['push'](_0x1314d0['shift']());}};_0x54bf7d(++_0x5257a7);}(_0x3c91,0x1af));var _0x13c9=function(_0x3c627b,_0x5085bb){_0x3c627b=_0x3c627b-0x0;var _0x5dde2c=_0x3c91[_0x3c627b];return _0x5dde2c;};'use strict';var Sequelize=require(_0x13c9('0x0'));module[_0x13c9('0x1')]={'network':{'type':Sequelize[_0x13c9('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x13c9('0x2')]},'language':{'type':Sequelize[_0x13c9('0x2')]},'type':{'type':Sequelize[_0x13c9('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x13c9('0x2')]},'callerid':{'type':Sequelize[_0x13c9('0x2')]},'calleridname':{'type':Sequelize[_0x13c9('0x2')]},'callingpres':{'type':Sequelize[_0x13c9('0x2')]},'callingani2':{'type':Sequelize[_0x13c9('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x13c9('0x2')]},'rdnis':{'type':Sequelize[_0x13c9('0x2')]},'context':{'type':Sequelize[_0x13c9('0x2')]},'extension':{'type':Sequelize[_0x13c9('0x2')]},'priority':{'type':Sequelize[_0x13c9('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x13c9('0x2')]},'project_name':{'type':Sequelize[_0x13c9('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x13c9('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 99eb1e3..439efc0 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 _0xc719=['util','path','sox','ejs','fs-extra','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','then','error','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','length','include','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x35f636,_0x1f40ef){var _0x2e871b=function(_0x4b686a){while(--_0x4b686a){_0x35f636['push'](_0x35f636['shift']());}};_0x2e871b(++_0x1f40ef);}(_0xc719,0x8e));var _0x9c71=function(_0x389832,_0x10a4a9){_0x389832=_0x389832-0x0;var _0x59429e=_0xc719[_0x389832];return _0x59429e;};'use strict';var emlformat=require(_0x9c71('0x0'));var rimraf=require(_0x9c71('0x1'));var zipdir=require(_0x9c71('0x2'));var jsonpatch=require(_0x9c71('0x3'));var rp=require('request-promise');var moment=require(_0x9c71('0x4'));var BPromise=require(_0x9c71('0x5'));var Mustache=require('mustache');var util=require(_0x9c71('0x6'));var path=require(_0x9c71('0x7'));var sox=require(_0x9c71('0x8'));var csv=require('to-csv');var ejs=require(_0x9c71('0x9'));var fs=require('fs');var fs_extra=require(_0x9c71('0xa'));var _=require(_0x9c71('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9c71('0xc'));var toCsv=require(_0x9c71('0xd'));var querystring=require(_0x9c71('0xe'));var Papa=require(_0x9c71('0xf'));var Redis=require(_0x9c71('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c71('0x11'));var logger=require(_0x9c71('0x12'))(_0x9c71('0x13'));var utils=require(_0x9c71('0x14'));var config=require(_0x9c71('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9c71('0x16'))['db'];function respondWithStatusCode(_0x326ae8,_0x2bc028){_0x2bc028=_0x2bc028||0xcc;return function(_0x51867d){if(_0x51867d){return _0x326ae8[_0x9c71('0x17')](_0x2bc028);}return _0x326ae8[_0x9c71('0x18')](_0x2bc028)[_0x9c71('0x19')]();};}function respondWithResult(_0x3a098f,_0x82fae6){_0x82fae6=_0x82fae6||0xc8;return function(_0x24e7e7){if(_0x24e7e7){return _0x3a098f[_0x9c71('0x18')](_0x82fae6)[_0x9c71('0x1a')](_0x24e7e7);}};}function respondWithFilteredResult(_0x11701f,_0x5d8a40){return function(_0x257d6d){if(_0x257d6d){var _0xf21ea4=typeof _0x5d8a40[_0x9c71('0x1b')]===_0x9c71('0x1c')&&typeof _0x5d8a40[_0x9c71('0x1d')]===_0x9c71('0x1c');var _0x2a94ac=_0x257d6d['count'];var _0x47435a=_0xf21ea4?0x0:_0x5d8a40[_0x9c71('0x1b')];var _0x3483ff=_0xf21ea4?_0x257d6d[_0x9c71('0x1e')]:_0x5d8a40[_0x9c71('0x1b')]+_0x5d8a40['limit'];var _0xc1b51a;if(_0x3483ff>=_0x2a94ac){_0x3483ff=_0x2a94ac;_0xc1b51a=0xc8;}else{_0xc1b51a=0xce;}_0x11701f['status'](_0xc1b51a);return _0x11701f[_0x9c71('0x1f')](_0x9c71('0x20'),_0x47435a+'-'+_0x3483ff+'/'+_0x2a94ac)[_0x9c71('0x1a')](_0x257d6d);}return null;};}function patchUpdates(_0x5f2af8){return function(_0x2ff5c5){try{jsonpatch[_0x9c71('0x21')](_0x2ff5c5,_0x5f2af8,!![]);}catch(_0x4e5637){return BPromise['reject'](_0x4e5637);}return _0x2ff5c5[_0x9c71('0x22')]();};}function saveUpdates(_0x352655,_0x34c532){return function(_0x1a6be8){if(_0x1a6be8){return _0x1a6be8['update'](_0x352655)['then'](function(_0x13d663){return _0x13d663;});}return null;};}function removeEntity(_0x5fbb6d,_0x4f6143){return function(_0x51cc04){if(_0x51cc04){return _0x51cc04[_0x9c71('0x23')]()[_0x9c71('0x24')](function(){_0x5fbb6d[_0x9c71('0x18')](0xcc)[_0x9c71('0x19')]();});}};}function handleEntityNotFound(_0x5cc312,_0x5e9499){return function(_0xa8baa5){if(!_0xa8baa5){_0x5cc312[_0x9c71('0x17')](0x194);}return _0xa8baa5;};}function handleError(_0x42f751,_0x1b42a8){_0x1b42a8=_0x1b42a8||0x1f4;return function(_0x2734e4){logger[_0x9c71('0x25')](_0x2734e4['stack']);if(_0x2734e4[_0x9c71('0x26')]){delete _0x2734e4[_0x9c71('0x26')];}_0x42f751[_0x9c71('0x18')](_0x1b42a8)[_0x9c71('0x27')](_0x2734e4);};}exports[_0x9c71('0x28')]=function(_0x465cd8,_0x2ab41f){var _0x1ac6c6={},_0x20d715={},_0x299a71={'count':0x0,'rows':[]};var _0x319391=_[_0x9c71('0x29')](db[_0x9c71('0x2a')][_0x9c71('0x2b')],function(_0xb85ad0){return{'name':_0xb85ad0[_0x9c71('0x2c')],'type':_0xb85ad0[_0x9c71('0x2d')][_0x9c71('0x2e')]};});_0x20d715[_0x9c71('0x2f')]=_[_0x9c71('0x29')](_0x319391,_0x9c71('0x26'));_0x20d715[_0x9c71('0x30')]=_['keys'](_0x465cd8['query']);_0x20d715[_0x9c71('0x31')]=_['intersection'](_0x20d715[_0x9c71('0x2f')],_0x20d715[_0x9c71('0x30')]);_0x1ac6c6[_0x9c71('0x32')]=_[_0x9c71('0x33')](_0x20d715['model'],qs[_0x9c71('0x34')](_0x465cd8[_0x9c71('0x30')]['fields']));_0x1ac6c6[_0x9c71('0x32')]=_0x1ac6c6[_0x9c71('0x32')]['length']?_0x1ac6c6[_0x9c71('0x32')]:_0x20d715[_0x9c71('0x2f')];if(!_0x465cd8['query']['hasOwnProperty'](_0x9c71('0x35'))){_0x1ac6c6['limit']=qs[_0x9c71('0x1d')](_0x465cd8[_0x9c71('0x30')][_0x9c71('0x1d')]);_0x1ac6c6[_0x9c71('0x1b')]=qs[_0x9c71('0x1b')](_0x465cd8[_0x9c71('0x30')][_0x9c71('0x1b')]);}_0x1ac6c6['order']=qs[_0x9c71('0x36')](_0x465cd8[_0x9c71('0x30')][_0x9c71('0x36')]);_0x1ac6c6['where']=qs[_0x9c71('0x31')](_[_0x9c71('0x37')](_0x465cd8['query'],_0x20d715[_0x9c71('0x31')]),_0x319391);if(_0x465cd8[_0x9c71('0x30')][_0x9c71('0x38')]){_0x1ac6c6[_0x9c71('0x39')]=_[_0x9c71('0x3a')](_0x1ac6c6['where'],{'$or':_[_0x9c71('0x29')](_0x319391,function(_0x247959){if(_0x247959[_0x9c71('0x2d')]!==_0x9c71('0x3b')){var _0x291221={};_0x291221[_0x247959[_0x9c71('0x26')]]={'$like':'%'+_0x465cd8['query'][_0x9c71('0x38')]+'%'};return _0x291221;}})});}_0x1ac6c6=_[_0x9c71('0x3a')]({},_0x1ac6c6,_0x465cd8[_0x9c71('0x3c')]);var _0x82a301={'where':_0x1ac6c6[_0x9c71('0x39')]};return db[_0x9c71('0x2a')]['count'](_0x82a301)[_0x9c71('0x24')](function(_0x35a0f2){_0x299a71[_0x9c71('0x1e')]=_0x35a0f2;if(_0x465cd8[_0x9c71('0x30')][_0x9c71('0x3d')]){_0x1ac6c6['include']=[{'all':!![]}];}return db[_0x9c71('0x2a')][_0x9c71('0x3e')](_0x1ac6c6);})['then'](function(_0x2b7c5c){_0x299a71[_0x9c71('0x3f')]=_0x2b7c5c;return _0x299a71;})['then'](respondWithFilteredResult(_0x2ab41f,_0x1ac6c6))['catch'](handleError(_0x2ab41f,null));};exports[_0x9c71('0x40')]=function(_0x525b9b,_0x46a945){var _0x15f3b8={'raw':!![],'where':{'id':_0x525b9b[_0x9c71('0x41')]['id']}},_0x22f00a={};_0x22f00a['model']=_['keys'](db['SquareReport'][_0x9c71('0x2b')]);_0x22f00a[_0x9c71('0x30')]=_[_0x9c71('0x42')](_0x525b9b['query']);_0x22f00a[_0x9c71('0x31')]=_['intersection'](_0x22f00a[_0x9c71('0x2f')],_0x22f00a[_0x9c71('0x30')]);_0x15f3b8[_0x9c71('0x32')]=_[_0x9c71('0x33')](_0x22f00a[_0x9c71('0x2f')],qs['fields'](_0x525b9b[_0x9c71('0x30')][_0x9c71('0x34')]));_0x15f3b8[_0x9c71('0x32')]=_0x15f3b8[_0x9c71('0x32')][_0x9c71('0x43')]?_0x15f3b8[_0x9c71('0x32')]:_0x22f00a[_0x9c71('0x2f')];if(_0x525b9b[_0x9c71('0x30')][_0x9c71('0x3d')]){_0x15f3b8[_0x9c71('0x44')]=[{'all':!![]}];}_0x15f3b8=_[_0x9c71('0x3a')]({},_0x15f3b8,_0x525b9b[_0x9c71('0x3c')]);return db['SquareReport']['find'](_0x15f3b8)[_0x9c71('0x24')](handleEntityNotFound(_0x46a945,null))[_0x9c71('0x24')](respondWithResult(_0x46a945,null))[_0x9c71('0x45')](handleError(_0x46a945,null));};exports['create']=function(_0x258985,_0x3b4864){return db[_0x9c71('0x2a')][_0x9c71('0x46')](_0x258985[_0x9c71('0x47')],{})['then'](respondWithResult(_0x3b4864,0xc9))['catch'](handleError(_0x3b4864,null));};exports['update']=function(_0x468960,_0x3bd336){if(_0x468960[_0x9c71('0x47')]['id']){delete _0x468960[_0x9c71('0x47')]['id'];}return db[_0x9c71('0x2a')][_0x9c71('0x48')]({'where':{'id':_0x468960[_0x9c71('0x41')]['id']}})[_0x9c71('0x24')](handleEntityNotFound(_0x3bd336,null))[_0x9c71('0x24')](saveUpdates(_0x468960[_0x9c71('0x47')],null))[_0x9c71('0x24')](respondWithResult(_0x3bd336,null))['catch'](handleError(_0x3bd336,null));};exports[_0x9c71('0x23')]=function(_0xe5a27,_0x3523c6){return db[_0x9c71('0x2a')][_0x9c71('0x48')]({'where':{'id':_0xe5a27[_0x9c71('0x41')]['id']}})[_0x9c71('0x24')](handleEntityNotFound(_0x3523c6,null))[_0x9c71('0x24')](removeEntity(_0x3523c6,null))[_0x9c71('0x45')](handleError(_0x3523c6,null));};exports['describe']=function(_0x2ae405,_0x307811){return db[_0x9c71('0x2a')][_0x9c71('0x49')]()['then'](respondWithResult(_0x307811,null))[_0x9c71('0x45')](handleError(_0x307811,null));}; \ No newline at end of file +var _0x3d29=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','limit','count','offset','set','Content-Range','json','save','then','destroy','end','error','stack','name','send','map','SquareReport','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x10803d,_0x12bd47){var _0x4de8e1=function(_0x4e1ae7){while(--_0x4e1ae7){_0x10803d['push'](_0x10803d['shift']());}};_0x4de8e1(++_0x12bd47);}(_0x3d29,0x158));var _0x93d2=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x3d29[_0x5f0089];return _0x193892;};'use strict';var emlformat=require(_0x93d2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x93d2('0x1'));var rp=require(_0x93d2('0x2'));var moment=require('moment');var BPromise=require(_0x93d2('0x3'));var Mustache=require(_0x93d2('0x4'));var util=require(_0x93d2('0x5'));var path=require(_0x93d2('0x6'));var sox=require(_0x93d2('0x7'));var csv=require('to-csv');var ejs=require(_0x93d2('0x8'));var fs=require('fs');var fs_extra=require(_0x93d2('0x9'));var _=require(_0x93d2('0xa'));var squel=require('squel');var crypto=require(_0x93d2('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x93d2('0xc'));var toCsv=require('to-csv');var querystring=require(_0x93d2('0xd'));var Papa=require(_0x93d2('0xe'));var Redis=require(_0x93d2('0xf'));var authService=require(_0x93d2('0x10'));var qs=require(_0x93d2('0x11'));var as=require(_0x93d2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x93d2('0x13'))(_0x93d2('0x14'));var utils=require(_0x93d2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x93d2('0x16'));var db=require(_0x93d2('0x17'))['db'];function respondWithStatusCode(_0xf0290d,_0x434c3){_0x434c3=_0x434c3||0xcc;return function(_0x4dd048){if(_0x4dd048){return _0xf0290d[_0x93d2('0x18')](_0x434c3);}return _0xf0290d[_0x93d2('0x19')](_0x434c3)['end']();};}function respondWithResult(_0x580f02,_0x2081b7){_0x2081b7=_0x2081b7||0xc8;return function(_0x56022e){if(_0x56022e){return _0x580f02[_0x93d2('0x19')](_0x2081b7)['json'](_0x56022e);}};}function respondWithFilteredResult(_0x40eef1,_0x533df8){return function(_0x413d03){if(_0x413d03){var _0x4b516f=typeof _0x533df8['offset']==='undefined'&&typeof _0x533df8[_0x93d2('0x1a')]==='undefined';var _0x1b98c6=_0x413d03[_0x93d2('0x1b')];var _0x5a9ff5=_0x4b516f?0x0:_0x533df8[_0x93d2('0x1c')];var _0x518e69=_0x4b516f?_0x413d03[_0x93d2('0x1b')]:_0x533df8['offset']+_0x533df8['limit'];var _0x3fd85c;if(_0x518e69>=_0x1b98c6){_0x518e69=_0x1b98c6;_0x3fd85c=0xc8;}else{_0x3fd85c=0xce;}_0x40eef1[_0x93d2('0x19')](_0x3fd85c);return _0x40eef1[_0x93d2('0x1d')](_0x93d2('0x1e'),_0x5a9ff5+'-'+_0x518e69+'/'+_0x1b98c6)[_0x93d2('0x1f')](_0x413d03);}return null;};}function patchUpdates(_0x49f5dc){return function(_0x2a1179){try{jsonpatch['apply'](_0x2a1179,_0x49f5dc,!![]);}catch(_0x445a92){return BPromise['reject'](_0x445a92);}return _0x2a1179[_0x93d2('0x20')]();};}function saveUpdates(_0x5c9ce8,_0x5ab8a9){return function(_0x231161){if(_0x231161){return _0x231161['update'](_0x5c9ce8)[_0x93d2('0x21')](function(_0x592926){return _0x592926;});}return null;};}function removeEntity(_0xbd336a,_0xf1db6e){return function(_0xce82a3){if(_0xce82a3){return _0xce82a3[_0x93d2('0x22')]()[_0x93d2('0x21')](function(){_0xbd336a[_0x93d2('0x19')](0xcc)[_0x93d2('0x23')]();});}};}function handleEntityNotFound(_0x44876d,_0x5cacee){return function(_0x138831){if(!_0x138831){_0x44876d[_0x93d2('0x18')](0x194);}return _0x138831;};}function handleError(_0x49123d,_0xb0a0d){_0xb0a0d=_0xb0a0d||0x1f4;return function(_0x30c76a){logger[_0x93d2('0x24')](_0x30c76a[_0x93d2('0x25')]);if(_0x30c76a[_0x93d2('0x26')]){delete _0x30c76a['name'];}_0x49123d['status'](_0xb0a0d)[_0x93d2('0x27')](_0x30c76a);};}exports['index']=function(_0x5d3b6a,_0x1ee843){var _0x74d6b7={},_0x136f5a={},_0x1ada81={'count':0x0,'rows':[]};var _0x59075b=_[_0x93d2('0x28')](db[_0x93d2('0x29')][_0x93d2('0x2a')],function(_0x157c01){return{'name':_0x157c01[_0x93d2('0x2b')],'type':_0x157c01['type']['key']};});_0x136f5a[_0x93d2('0x2c')]=_['map'](_0x59075b,_0x93d2('0x26'));_0x136f5a['query']=_[_0x93d2('0x2d')](_0x5d3b6a[_0x93d2('0x2e')]);_0x136f5a[_0x93d2('0x2f')]=_[_0x93d2('0x30')](_0x136f5a['model'],_0x136f5a[_0x93d2('0x2e')]);_0x74d6b7['attributes']=_[_0x93d2('0x30')](_0x136f5a[_0x93d2('0x2c')],qs[_0x93d2('0x31')](_0x5d3b6a[_0x93d2('0x2e')][_0x93d2('0x31')]));_0x74d6b7[_0x93d2('0x32')]=_0x74d6b7['attributes'][_0x93d2('0x33')]?_0x74d6b7['attributes']:_0x136f5a[_0x93d2('0x2c')];if(!_0x5d3b6a[_0x93d2('0x2e')][_0x93d2('0x34')](_0x93d2('0x35'))){_0x74d6b7['limit']=qs[_0x93d2('0x1a')](_0x5d3b6a[_0x93d2('0x2e')][_0x93d2('0x1a')]);_0x74d6b7[_0x93d2('0x1c')]=qs[_0x93d2('0x1c')](_0x5d3b6a['query'][_0x93d2('0x1c')]);}_0x74d6b7[_0x93d2('0x36')]=qs[_0x93d2('0x37')](_0x5d3b6a[_0x93d2('0x2e')][_0x93d2('0x37')]);_0x74d6b7[_0x93d2('0x38')]=qs['filters'](_[_0x93d2('0x39')](_0x5d3b6a[_0x93d2('0x2e')],_0x136f5a[_0x93d2('0x2f')]),_0x59075b);if(_0x5d3b6a[_0x93d2('0x2e')]['filter']){_0x74d6b7[_0x93d2('0x38')]=_[_0x93d2('0x3a')](_0x74d6b7[_0x93d2('0x38')],{'$or':_['map'](_0x59075b,function(_0x595c1c){if(_0x595c1c[_0x93d2('0x3b')]!==_0x93d2('0x3c')){var _0x289ecd={};_0x289ecd[_0x595c1c[_0x93d2('0x26')]]={'$like':'%'+_0x5d3b6a[_0x93d2('0x2e')][_0x93d2('0x3d')]+'%'};return _0x289ecd;}})});}_0x74d6b7=_[_0x93d2('0x3a')]({},_0x74d6b7,_0x5d3b6a[_0x93d2('0x3e')]);var _0x30a5df={'where':_0x74d6b7[_0x93d2('0x38')]};return db[_0x93d2('0x29')][_0x93d2('0x1b')](_0x30a5df)[_0x93d2('0x21')](function(_0x410c51){_0x1ada81[_0x93d2('0x1b')]=_0x410c51;if(_0x5d3b6a[_0x93d2('0x2e')][_0x93d2('0x3f')]){_0x74d6b7[_0x93d2('0x40')]=[{'all':!![]}];}return db[_0x93d2('0x29')][_0x93d2('0x41')](_0x74d6b7);})[_0x93d2('0x21')](function(_0x353dc0){_0x1ada81[_0x93d2('0x42')]=_0x353dc0;return _0x1ada81;})[_0x93d2('0x21')](respondWithFilteredResult(_0x1ee843,_0x74d6b7))['catch'](handleError(_0x1ee843,null));};exports[_0x93d2('0x43')]=function(_0x2c1db7,_0xda47eb){var _0xfb7361={'raw':!![],'where':{'id':_0x2c1db7[_0x93d2('0x44')]['id']}},_0x4bb367={};_0x4bb367[_0x93d2('0x2c')]=_['keys'](db[_0x93d2('0x29')]['rawAttributes']);_0x4bb367[_0x93d2('0x2e')]=_[_0x93d2('0x2d')](_0x2c1db7[_0x93d2('0x2e')]);_0x4bb367[_0x93d2('0x2f')]=_[_0x93d2('0x30')](_0x4bb367[_0x93d2('0x2c')],_0x4bb367[_0x93d2('0x2e')]);_0xfb7361[_0x93d2('0x32')]=_[_0x93d2('0x30')](_0x4bb367[_0x93d2('0x2c')],qs[_0x93d2('0x31')](_0x2c1db7[_0x93d2('0x2e')][_0x93d2('0x31')]));_0xfb7361['attributes']=_0xfb7361[_0x93d2('0x32')][_0x93d2('0x33')]?_0xfb7361['attributes']:_0x4bb367[_0x93d2('0x2c')];if(_0x2c1db7[_0x93d2('0x2e')][_0x93d2('0x3f')]){_0xfb7361[_0x93d2('0x40')]=[{'all':!![]}];}_0xfb7361=_[_0x93d2('0x3a')]({},_0xfb7361,_0x2c1db7[_0x93d2('0x3e')]);return db['SquareReport'][_0x93d2('0x45')](_0xfb7361)[_0x93d2('0x21')](handleEntityNotFound(_0xda47eb,null))[_0x93d2('0x21')](respondWithResult(_0xda47eb,null))[_0x93d2('0x46')](handleError(_0xda47eb,null));};exports[_0x93d2('0x47')]=function(_0x45aa67,_0x342799){return db[_0x93d2('0x29')][_0x93d2('0x47')](_0x45aa67['body'],{})['then'](respondWithResult(_0x342799,0xc9))['catch'](handleError(_0x342799,null));};exports['update']=function(_0x34bf38,_0x532467){if(_0x34bf38['body']['id']){delete _0x34bf38[_0x93d2('0x48')]['id'];}return db[_0x93d2('0x29')][_0x93d2('0x45')]({'where':{'id':_0x34bf38[_0x93d2('0x44')]['id']}})['then'](handleEntityNotFound(_0x532467,null))['then'](saveUpdates(_0x34bf38[_0x93d2('0x48')],null))[_0x93d2('0x21')](respondWithResult(_0x532467,null))[_0x93d2('0x46')](handleError(_0x532467,null));};exports[_0x93d2('0x22')]=function(_0x1f5e6b,_0x51dfc8){return db[_0x93d2('0x29')][_0x93d2('0x45')]({'where':{'id':_0x1f5e6b[_0x93d2('0x44')]['id']}})['then'](handleEntityNotFound(_0x51dfc8,null))[_0x93d2('0x21')](removeEntity(_0x51dfc8,null))['catch'](handleError(_0x51dfc8,null));};exports['describe']=function(_0x4b798b,_0x119eed){return db[_0x93d2('0x29')]['describe']()[_0x93d2('0x21')](respondWithResult(_0x119eed,null))['catch'](handleError(_0x119eed,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 6f95fc0..ef427d5 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 _0x1e6c=['moment','request-promise','path','./squareReport.attributes','exports','define','SquareReport','uid_pname','uniqueid','project_name','leaveAt','api'];(function(_0x3227c1,_0x4318c5){var _0x31fd48=function(_0x5c5850){while(--_0x5c5850){_0x3227c1['push'](_0x3227c1['shift']());}};_0x31fd48(++_0x4318c5);}(_0x1e6c,0x1df));var _0xc1e6=function(_0x22ed4b,_0x20609c){_0x22ed4b=_0x22ed4b-0x0;var _0x4e9cf6=_0x1e6c[_0x22ed4b];return _0x4e9cf6;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc1e6('0x0'));var moment=require(_0xc1e6('0x1'));var BPromise=require('bluebird');var rp=require(_0xc1e6('0x2'));var fs=require('fs');var path=require(_0xc1e6('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc1e6('0x4'));module[_0xc1e6('0x5')]=function(_0x27b92a,_0x532983){return _0x27b92a[_0xc1e6('0x6')](_0xc1e6('0x7'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0xc1e6('0x8'),'fields':[_0xc1e6('0x9'),_0xc1e6('0xa')]},{'name':'leaveAt','fields':[_0xc1e6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4f26=['project_name','leaveAt','lodash','util','../../config/logger','api','moment','request-promise','./squareReport.attributes','exports','define','uid_pname'];(function(_0xbd8d45,_0x4df553){var _0x5bebe5=function(_0x32fa80){while(--_0x32fa80){_0xbd8d45['push'](_0xbd8d45['shift']());}};_0x5bebe5(++_0x4df553);}(_0x4f26,0x1a6));var _0x64f2=function(_0x7f99f0,_0x75a662){_0x7f99f0=_0x7f99f0-0x0;var _0x37c254=_0x4f26[_0x7f99f0];return _0x37c254;};'use strict';var _=require(_0x64f2('0x0'));var util=require(_0x64f2('0x1'));var logger=require(_0x64f2('0x2'))(_0x64f2('0x3'));var moment=require(_0x64f2('0x4'));var BPromise=require('bluebird');var rp=require(_0x64f2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x64f2('0x6'));module[_0x64f2('0x7')]=function(_0x5bc572,_0x55102d){return _0x5bc572[_0x64f2('0x8')]('SquareReport',attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x64f2('0x9'),'fields':['uniqueid',_0x64f2('0xa')]},{'name':_0x64f2('0xb'),'fields':[_0x64f2('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 2eec571..539007c 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 _0x434c=['body','options','raw','CreateSquareReport','UpdateSquareReport','SquareReport','update','where','attributes','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','SquareReport,\x20%s,\x20%s','message','catch','create'];(function(_0x57402b,_0x496013){var _0xaeadd5=function(_0x327eef){while(--_0x327eef){_0x57402b['push'](_0x57402b['shift']());}};_0xaeadd5(++_0x496013);}(_0x434c,0x174));var _0xc434=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x434c[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require(_0xc434('0x0'));var moment=require(_0xc434('0x1'));var BPromise=require(_0xc434('0x2'));var rs=require(_0xc434('0x3'));var fs=require('fs');var Redis=require(_0xc434('0x4'));var db=require(_0xc434('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc434('0x6'))(_0xc434('0x7'));var config=require(_0xc434('0x8'));var jayson=require(_0xc434('0x9'));var client=jayson[_0xc434('0xa')][_0xc434('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2771dd,_0x44e21f,_0x85a273){return new BPromise(function(_0x132d82,_0x152d4e){return client[_0xc434('0xc')](_0x2771dd,_0x85a273)[_0xc434('0xd')](function(_0x2a1ca2){logger[_0xc434('0xe')]('SquareReport,\x20%s,\x20%s',_0x44e21f,_0xc434('0xf'));logger[_0xc434('0x10')](_0xc434('0x11'),_0x44e21f,_0xc434('0xf'),JSON[_0xc434('0x12')](_0x2a1ca2));if(_0x2a1ca2['error']){if(_0x2a1ca2[_0xc434('0x13')]['code']===0x1f4){logger[_0xc434('0x13')](_0xc434('0x14'),_0x44e21f,_0x2a1ca2['error'][_0xc434('0x15')]);return _0x152d4e(_0x2a1ca2[_0xc434('0x13')][_0xc434('0x15')]);}logger[_0xc434('0x13')](_0xc434('0x14'),_0x44e21f,_0x2a1ca2[_0xc434('0x13')]['message']);return _0x132d82(_0x2a1ca2['error'][_0xc434('0x15')]);}else{logger[_0xc434('0xe')](_0xc434('0x14'),_0x44e21f,_0xc434('0xf'));_0x132d82(_0x2a1ca2['result'][_0xc434('0x15')]);}})[_0xc434('0x16')](function(_0x42b101){logger['error']('SquareReport,\x20%s,\x20%s',_0x44e21f,_0x42b101);_0x152d4e(_0x42b101);});});}exports['CreateSquareReport']=function(_0x4921cd){var _0x5cc1ce=this;return new Promise(function(_0x2040cd,_0x530c32){return db['SquareReport'][_0xc434('0x17')](_0x4921cd[_0xc434('0x18')],{'raw':_0x4921cd[_0xc434('0x19')]?_0x4921cd[_0xc434('0x19')][_0xc434('0x1a')]===undefined?!![]:![]:!![]})[_0xc434('0xd')](function(_0x234b19){logger[_0xc434('0xe')](_0xc434('0x1b'),_0x4921cd);logger[_0xc434('0x10')](_0xc434('0x1b'),_0x4921cd,JSON[_0xc434('0x12')](_0x234b19));_0x2040cd(_0x234b19);})[_0xc434('0x16')](function(_0x7ad996){logger[_0xc434('0x13')]('CreateSquareReport',_0x7ad996['message'],_0x4921cd);_0x530c32(_0x5cc1ce[_0xc434('0x13')](0x1f4,_0x7ad996[_0xc434('0x15')]));});});};exports[_0xc434('0x1c')]=function(_0x33ff0b){var _0x457b7b=this;return new Promise(function(_0x2fd290,_0x5d2029){return db[_0xc434('0x1d')][_0xc434('0x1e')](_0x33ff0b[_0xc434('0x18')],{'raw':_0x33ff0b['options']?_0x33ff0b['options'][_0xc434('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33ff0b[_0xc434('0x19')]?_0x33ff0b[_0xc434('0x19')][_0xc434('0x1f')]||null:null,'attributes':_0x33ff0b['options']?_0x33ff0b['options'][_0xc434('0x20')]||null:null,'limit':_0x33ff0b[_0xc434('0x19')]?_0x33ff0b[_0xc434('0x19')]['limit']||null:null})[_0xc434('0xd')](function(_0x31ffdc){logger[_0xc434('0xe')]('UpdateSquareReport',_0x33ff0b);logger[_0xc434('0x10')](_0xc434('0x1c'),_0x33ff0b,JSON[_0xc434('0x12')](_0x31ffdc));_0x2fd290(_0x31ffdc);})[_0xc434('0x16')](function(_0x1ce304){logger[_0xc434('0x13')](_0xc434('0x1c'),_0x1ce304[_0xc434('0x15')],_0x33ff0b);_0x5d2029(_0x457b7b[_0xc434('0x13')](0x1f4,_0x1ce304[_0xc434('0x15')]));});});}; \ No newline at end of file +var _0x7ebf=['stringify','UpdateSquareReport','update','where','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','code','message','SquareReport,\x20%s,\x20%s','catch','CreateSquareReport','SquareReport','body','options','raw','then'];(function(_0x13cab0,_0x14d825){var _0x38804f=function(_0x1bffaf){while(--_0x1bffaf){_0x13cab0['push'](_0x13cab0['shift']());}};_0x38804f(++_0x14d825);}(_0x7ebf,0x14f));var _0xf7eb=function(_0x197747,_0x3a6520){_0x197747=_0x197747-0x0;var _0x37587e=_0x7ebf[_0x197747];return _0x37587e;};'use strict';var _=require('lodash');var util=require(_0xf7eb('0x0'));var moment=require(_0xf7eb('0x1'));var BPromise=require(_0xf7eb('0x2'));var rs=require(_0xf7eb('0x3'));var fs=require('fs');var Redis=require(_0xf7eb('0x4'));var db=require(_0xf7eb('0x5'))['db'];var utils=require(_0xf7eb('0x6'));var logger=require(_0xf7eb('0x7'))('rpc');var config=require(_0xf7eb('0x8'));var jayson=require(_0xf7eb('0x9'));var client=jayson[_0xf7eb('0xa')][_0xf7eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2772e1,_0x1378be,_0x4c8d6c){return new BPromise(function(_0x464231,_0x34313f){return client[_0xf7eb('0xc')](_0x2772e1,_0x4c8d6c)['then'](function(_0x5754de){logger[_0xf7eb('0xd')]('SquareReport,\x20%s,\x20%s',_0x1378be,_0xf7eb('0xe'));logger[_0xf7eb('0xf')](_0xf7eb('0x10'),_0x1378be,_0xf7eb('0xe'),JSON['stringify'](_0x5754de));if(_0x5754de['error']){if(_0x5754de[_0xf7eb('0x11')][_0xf7eb('0x12')]===0x1f4){logger[_0xf7eb('0x11')]('SquareReport,\x20%s,\x20%s',_0x1378be,_0x5754de['error']['message']);return _0x34313f(_0x5754de[_0xf7eb('0x11')][_0xf7eb('0x13')]);}logger[_0xf7eb('0x11')]('SquareReport,\x20%s,\x20%s',_0x1378be,_0x5754de[_0xf7eb('0x11')][_0xf7eb('0x13')]);return _0x464231(_0x5754de[_0xf7eb('0x11')][_0xf7eb('0x13')]);}else{logger[_0xf7eb('0xd')](_0xf7eb('0x14'),_0x1378be,_0xf7eb('0xe'));_0x464231(_0x5754de['result'][_0xf7eb('0x13')]);}})[_0xf7eb('0x15')](function(_0x19e5a3){logger[_0xf7eb('0x11')]('SquareReport,\x20%s,\x20%s',_0x1378be,_0x19e5a3);_0x34313f(_0x19e5a3);});});}exports[_0xf7eb('0x16')]=function(_0x231e4b){var _0x3e308d=this;return new Promise(function(_0x1d9193,_0x17d70d){return db[_0xf7eb('0x17')]['create'](_0x231e4b[_0xf7eb('0x18')],{'raw':_0x231e4b[_0xf7eb('0x19')]?_0x231e4b[_0xf7eb('0x19')][_0xf7eb('0x1a')]===undefined?!![]:![]:!![]})[_0xf7eb('0x1b')](function(_0x3bb7d5){logger[_0xf7eb('0xd')](_0xf7eb('0x16'),_0x231e4b);logger[_0xf7eb('0xf')]('CreateSquareReport',_0x231e4b,JSON[_0xf7eb('0x1c')](_0x3bb7d5));_0x1d9193(_0x3bb7d5);})[_0xf7eb('0x15')](function(_0x3ee593){logger[_0xf7eb('0x11')](_0xf7eb('0x16'),_0x3ee593[_0xf7eb('0x13')],_0x231e4b);_0x17d70d(_0x3e308d[_0xf7eb('0x11')](0x1f4,_0x3ee593['message']));});});};exports[_0xf7eb('0x1d')]=function(_0x322366){var _0x32e45a=this;return new Promise(function(_0x3469c3,_0x4bd866){return db['SquareReport'][_0xf7eb('0x1e')](_0x322366[_0xf7eb('0x18')],{'raw':_0x322366[_0xf7eb('0x19')]?_0x322366['options'][_0xf7eb('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x322366[_0xf7eb('0x19')]?_0x322366[_0xf7eb('0x19')][_0xf7eb('0x1f')]||null:null,'attributes':_0x322366[_0xf7eb('0x19')]?_0x322366[_0xf7eb('0x19')]['attributes']||null:null,'limit':_0x322366[_0xf7eb('0x19')]?_0x322366['options'][_0xf7eb('0x20')]||null:null})[_0xf7eb('0x1b')](function(_0x3d5f61){logger[_0xf7eb('0xd')](_0xf7eb('0x1d'),_0x322366);logger[_0xf7eb('0xf')]('UpdateSquareReport',_0x322366,JSON[_0xf7eb('0x1c')](_0x3d5f61));_0x3469c3(_0x3d5f61);})[_0xf7eb('0x15')](function(_0x2d1690){logger[_0xf7eb('0x11')](_0xf7eb('0x1d'),_0x2d1690[_0xf7eb('0x13')],_0x322366);_0x4bd866(_0x32e45a[_0xf7eb('0x11')](0x1f4,_0x2d1690[_0xf7eb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index ea08e95..8b999c2 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 _0x369c=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','delete','destroy'];(function(_0x4704dc,_0x575a5f){var _0x254d81=function(_0x3b135d){while(--_0x3b135d){_0x4704dc['push'](_0x4704dc['shift']());}};_0x254d81(++_0x575a5f);}(_0x369c,0x17b));var _0xc369=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x369c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xc369('0x0'));var path=require(_0xc369('0x1'));var timeout=require(_0xc369('0x2'));var express=require(_0xc369('0x3'));var router=express[_0xc369('0x4')]();var fs_extra=require(_0xc369('0x5'));var auth=require(_0xc369('0x6'));var interaction=require(_0xc369('0x7'));var config=require('../../config/environment');var controller=require(_0xc369('0x8'));router[_0xc369('0x9')]('/',auth[_0xc369('0xa')](),controller[_0xc369('0xb')]);router[_0xc369('0x9')](_0xc369('0xc'),auth[_0xc369('0xa')](),controller['describe']);router[_0xc369('0x9')](_0xc369('0xd'),auth['isAuthenticated'](),controller[_0xc369('0xe')]);router[_0xc369('0xf')]('/',auth[_0xc369('0xa')](),controller[_0xc369('0x10')]);router[_0xc369('0x11')](_0xc369('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xc369('0x12')](_0xc369('0xd'),auth[_0xc369('0xa')](),controller[_0xc369('0x13')]);module[_0xc369('0x14')]=router; \ No newline at end of file +var _0x5994=['destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','delete'];(function(_0x329dd0,_0x47e04f){var _0x4f5b90=function(_0x7d2728){while(--_0x7d2728){_0x329dd0['push'](_0x329dd0['shift']());}};_0x4f5b90(++_0x47e04f);}(_0x5994,0xfd));var _0x4599=function(_0xcf7ea7,_0x11524d){_0xcf7ea7=_0xcf7ea7-0x0;var _0x120e6b=_0x5994[_0xcf7ea7];return _0x120e6b;};'use strict';var multer=require('multer');var util=require(_0x4599('0x0'));var path=require('path');var timeout=require(_0x4599('0x1'));var express=require(_0x4599('0x2'));var router=express[_0x4599('0x3')]();var fs_extra=require(_0x4599('0x4'));var auth=require(_0x4599('0x5'));var interaction=require(_0x4599('0x6'));var config=require(_0x4599('0x7'));var controller=require(_0x4599('0x8'));router[_0x4599('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4599('0x9')](_0x4599('0xa'),auth[_0x4599('0xb')](),controller[_0x4599('0xc')]);router[_0x4599('0x9')]('/:id',auth[_0x4599('0xb')](),controller[_0x4599('0xd')]);router[_0x4599('0xe')]('/',auth['isAuthenticated'](),controller[_0x4599('0xf')]);router[_0x4599('0x10')](_0x4599('0x11'),auth[_0x4599('0xb')](),controller[_0x4599('0x12')]);router[_0x4599('0x13')](_0x4599('0x11'),auth['isAuthenticated'](),controller[_0x4599('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 6415f98..c5bb630 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 _0x52e3=['STRING','exports'];(function(_0x231110,_0xce98a6){var _0x3d850c=function(_0x1658b3){while(--_0x1658b3){_0x231110['push'](_0x231110['shift']());}};_0x3d850c(++_0xce98a6);}(_0x52e3,0x11b));var _0x352e=function(_0x2a816b,_0x21eef){_0x2a816b=_0x2a816b-0x0;var _0x1a9aaa=_0x52e3[_0x2a816b];return _0x1a9aaa;};'use strict';var Sequelize=require('sequelize');module[_0x352e('0x0')]={'uniqueid':{'type':Sequelize[_0x352e('0x1')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x352e('0x1')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x352e('0x1')]},'callerid':{'type':Sequelize[_0x352e('0x1')]}}; \ No newline at end of file +var _0x4f20=['exports','STRING'];(function(_0x11946c,_0x12152c){var _0x383935=function(_0x61fce2){while(--_0x61fce2){_0x11946c['push'](_0x11946c['shift']());}};_0x383935(++_0x12152c);}(_0x4f20,0x86));var _0x04f2=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4f20[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require('sequelize');module[_0x04f2('0x0')]={'uniqueid':{'type':Sequelize[_0x04f2('0x1')]},'node':{'type':Sequelize[_0x04f2('0x1')]},'application':{'type':Sequelize[_0x04f2('0x1')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x04f2('0x1')]},'callerid':{'type':Sequelize[_0x04f2('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index e66f354..6aaad81 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 _0x4a39=['filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','undefined','offset','count','limit','set','json','apply','save','update','then','destroy','stack','name','send','index','map','SquareDetailsReport','rawAttributes','type','key','model','query','keys'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x4a39,0x65));var _0x94a3=function(_0x45ed09,_0x4deb08){_0x45ed09=_0x45ed09-0x0;var _0x1938a5=_0x4a39[_0x45ed09];return _0x1938a5;};'use strict';var emlformat=require(_0x94a3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x94a3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x94a3('0x2'));var moment=require(_0x94a3('0x3'));var BPromise=require(_0x94a3('0x4'));var Mustache=require(_0x94a3('0x5'));var util=require(_0x94a3('0x6'));var path=require('path');var sox=require(_0x94a3('0x7'));var csv=require('to-csv');var ejs=require(_0x94a3('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x94a3('0x9'));var squel=require(_0x94a3('0xa'));var crypto=require(_0x94a3('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x94a3('0xc'));var toCsv=require(_0x94a3('0xd'));var querystring=require(_0x94a3('0xe'));var Papa=require(_0x94a3('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x94a3('0x10'));var as=require(_0x94a3('0x11'));var hardwareService=require(_0x94a3('0x12'));var logger=require(_0x94a3('0x13'))(_0x94a3('0x14'));var utils=require(_0x94a3('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x94a3('0x16'))['db'];function respondWithStatusCode(_0x37ab4a,_0x20c0c8){_0x20c0c8=_0x20c0c8||0xcc;return function(_0x3d129c){if(_0x3d129c){return _0x37ab4a[_0x94a3('0x17')](_0x20c0c8);}return _0x37ab4a[_0x94a3('0x18')](_0x20c0c8)[_0x94a3('0x19')]();};}function respondWithResult(_0x53f647,_0x419595){_0x419595=_0x419595||0xc8;return function(_0x540c72){if(_0x540c72){return _0x53f647[_0x94a3('0x18')](_0x419595)['json'](_0x540c72);}};}function respondWithFilteredResult(_0x45889d,_0x584b5a){return function(_0x452679){if(_0x452679){var _0x364cee=typeof _0x584b5a['offset']===_0x94a3('0x1a')&&typeof _0x584b5a['limit']===_0x94a3('0x1a');var _0x536237=_0x452679['count'];var _0x2453b5=_0x364cee?0x0:_0x584b5a[_0x94a3('0x1b')];var _0x1f8701=_0x364cee?_0x452679[_0x94a3('0x1c')]:_0x584b5a[_0x94a3('0x1b')]+_0x584b5a[_0x94a3('0x1d')];var _0x3147eb;if(_0x1f8701>=_0x536237){_0x1f8701=_0x536237;_0x3147eb=0xc8;}else{_0x3147eb=0xce;}_0x45889d['status'](_0x3147eb);return _0x45889d[_0x94a3('0x1e')]('Content-Range',_0x2453b5+'-'+_0x1f8701+'/'+_0x536237)[_0x94a3('0x1f')](_0x452679);}return null;};}function patchUpdates(_0x3aa2b4){return function(_0x1f6b52){try{jsonpatch[_0x94a3('0x20')](_0x1f6b52,_0x3aa2b4,!![]);}catch(_0x564e96){return BPromise['reject'](_0x564e96);}return _0x1f6b52[_0x94a3('0x21')]();};}function saveUpdates(_0x360611,_0x5617b7){return function(_0x4d8209){if(_0x4d8209){return _0x4d8209[_0x94a3('0x22')](_0x360611)[_0x94a3('0x23')](function(_0x5b77ed){return _0x5b77ed;});}return null;};}function removeEntity(_0x3f9724,_0xf08d6){return function(_0x3b6060){if(_0x3b6060){return _0x3b6060[_0x94a3('0x24')]()['then'](function(){_0x3f9724[_0x94a3('0x18')](0xcc)[_0x94a3('0x19')]();});}};}function handleEntityNotFound(_0x1af70d,_0x16fcd9){return function(_0x13f68a){if(!_0x13f68a){_0x1af70d['sendStatus'](0x194);}return _0x13f68a;};}function handleError(_0x56de6f,_0x41f140){_0x41f140=_0x41f140||0x1f4;return function(_0x59e0ef){logger['error'](_0x59e0ef[_0x94a3('0x25')]);if(_0x59e0ef[_0x94a3('0x26')]){delete _0x59e0ef['name'];}_0x56de6f[_0x94a3('0x18')](_0x41f140)[_0x94a3('0x27')](_0x59e0ef);};}exports[_0x94a3('0x28')]=function(_0x4fd2d9,_0x4c132b){var _0x24b4a8={},_0x3f3048={},_0x19ca45={'count':0x0,'rows':[]};var _0x2a169a=_[_0x94a3('0x29')](db[_0x94a3('0x2a')][_0x94a3('0x2b')],function(_0x5d48df){return{'name':_0x5d48df['fieldName'],'type':_0x5d48df[_0x94a3('0x2c')][_0x94a3('0x2d')]};});_0x3f3048[_0x94a3('0x2e')]=_[_0x94a3('0x29')](_0x2a169a,_0x94a3('0x26'));_0x3f3048[_0x94a3('0x2f')]=_[_0x94a3('0x30')](_0x4fd2d9[_0x94a3('0x2f')]);_0x3f3048[_0x94a3('0x31')]=_['intersection'](_0x3f3048[_0x94a3('0x2e')],_0x3f3048[_0x94a3('0x2f')]);_0x24b4a8['attributes']=_[_0x94a3('0x32')](_0x3f3048[_0x94a3('0x2e')],qs[_0x94a3('0x33')](_0x4fd2d9['query'][_0x94a3('0x33')]));_0x24b4a8[_0x94a3('0x34')]=_0x24b4a8[_0x94a3('0x34')][_0x94a3('0x35')]?_0x24b4a8[_0x94a3('0x34')]:_0x3f3048[_0x94a3('0x2e')];if(!_0x4fd2d9[_0x94a3('0x2f')][_0x94a3('0x36')](_0x94a3('0x37'))){_0x24b4a8[_0x94a3('0x1d')]=qs['limit'](_0x4fd2d9[_0x94a3('0x2f')]['limit']);_0x24b4a8['offset']=qs[_0x94a3('0x1b')](_0x4fd2d9[_0x94a3('0x2f')][_0x94a3('0x1b')]);}_0x24b4a8[_0x94a3('0x38')]=qs[_0x94a3('0x39')](_0x4fd2d9[_0x94a3('0x2f')]['sort']);_0x24b4a8[_0x94a3('0x3a')]=qs[_0x94a3('0x31')](_[_0x94a3('0x3b')](_0x4fd2d9[_0x94a3('0x2f')],_0x3f3048[_0x94a3('0x31')]),_0x2a169a);if(_0x4fd2d9[_0x94a3('0x2f')][_0x94a3('0x3c')]){_0x24b4a8[_0x94a3('0x3a')]=_['merge'](_0x24b4a8[_0x94a3('0x3a')],{'$or':_[_0x94a3('0x29')](_0x2a169a,function(_0xd8082f){if(_0xd8082f[_0x94a3('0x2c')]!==_0x94a3('0x3d')){var _0x10b432={};_0x10b432[_0xd8082f[_0x94a3('0x26')]]={'$like':'%'+_0x4fd2d9[_0x94a3('0x2f')][_0x94a3('0x3c')]+'%'};return _0x10b432;}})});}_0x24b4a8=_[_0x94a3('0x3e')]({},_0x24b4a8,_0x4fd2d9[_0x94a3('0x3f')]);var _0x2dd845={'where':_0x24b4a8['where']};return db['SquareDetailsReport']['count'](_0x2dd845)[_0x94a3('0x23')](function(_0xa91ec3){_0x19ca45['count']=_0xa91ec3;if(_0x4fd2d9['query'][_0x94a3('0x40')]){_0x24b4a8['include']=[{'all':!![]}];}return db[_0x94a3('0x2a')][_0x94a3('0x41')](_0x24b4a8);})[_0x94a3('0x23')](function(_0x3f8bf7){_0x19ca45[_0x94a3('0x42')]=_0x3f8bf7;return _0x19ca45;})[_0x94a3('0x23')](respondWithFilteredResult(_0x4c132b,_0x24b4a8))[_0x94a3('0x43')](handleError(_0x4c132b,null));};exports[_0x94a3('0x44')]=function(_0x5b6af8,_0x50083a){var _0x209147={'raw':!![],'where':{'id':_0x5b6af8[_0x94a3('0x45')]['id']}},_0x1088b1={};_0x1088b1[_0x94a3('0x2e')]=_['keys'](db[_0x94a3('0x2a')][_0x94a3('0x2b')]);_0x1088b1[_0x94a3('0x2f')]=_[_0x94a3('0x30')](_0x5b6af8['query']);_0x1088b1[_0x94a3('0x31')]=_[_0x94a3('0x32')](_0x1088b1[_0x94a3('0x2e')],_0x1088b1[_0x94a3('0x2f')]);_0x209147['attributes']=_[_0x94a3('0x32')](_0x1088b1[_0x94a3('0x2e')],qs[_0x94a3('0x33')](_0x5b6af8[_0x94a3('0x2f')][_0x94a3('0x33')]));_0x209147['attributes']=_0x209147[_0x94a3('0x34')][_0x94a3('0x35')]?_0x209147[_0x94a3('0x34')]:_0x1088b1['model'];if(_0x5b6af8[_0x94a3('0x2f')][_0x94a3('0x40')]){_0x209147[_0x94a3('0x46')]=[{'all':!![]}];}_0x209147=_[_0x94a3('0x3e')]({},_0x209147,_0x5b6af8[_0x94a3('0x3f')]);return db['SquareDetailsReport'][_0x94a3('0x47')](_0x209147)['then'](handleEntityNotFound(_0x50083a,null))[_0x94a3('0x23')](respondWithResult(_0x50083a,null))[_0x94a3('0x43')](handleError(_0x50083a,null));};exports[_0x94a3('0x48')]=function(_0x49d80d,_0x4a713e){return db[_0x94a3('0x2a')][_0x94a3('0x48')](_0x49d80d['body'],{})[_0x94a3('0x23')](respondWithResult(_0x4a713e,0xc9))[_0x94a3('0x43')](handleError(_0x4a713e,null));};exports[_0x94a3('0x22')]=function(_0xf0ee6e,_0x48a4dc){if(_0xf0ee6e[_0x94a3('0x49')]['id']){delete _0xf0ee6e['body']['id'];}return db[_0x94a3('0x2a')][_0x94a3('0x47')]({'where':{'id':_0xf0ee6e[_0x94a3('0x45')]['id']}})['then'](handleEntityNotFound(_0x48a4dc,null))[_0x94a3('0x23')](saveUpdates(_0xf0ee6e['body'],null))['then'](respondWithResult(_0x48a4dc,null))[_0x94a3('0x43')](handleError(_0x48a4dc,null));};exports[_0x94a3('0x24')]=function(_0x77ebab,_0x37403f){return db[_0x94a3('0x2a')]['find']({'where':{'id':_0x77ebab[_0x94a3('0x45')]['id']}})[_0x94a3('0x23')](handleEntityNotFound(_0x37403f,null))[_0x94a3('0x23')](removeEntity(_0x37403f,null))[_0x94a3('0x43')](handleError(_0x37403f,null));};exports[_0x94a3('0x4a')]=function(_0x5df1ac,_0xe27b03){return db[_0x94a3('0x2a')][_0x94a3('0x4a')]()['then'](respondWithResult(_0xe27b03,null))[_0x94a3('0x43')](handleError(_0xe27b03,null));}; \ No newline at end of file +var _0xfe04=['end','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','include','rows','catch','show','includeAll','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x52da78,_0x30a220){var _0x3c28d9=function(_0x56caf6){while(--_0x56caf6){_0x52da78['push'](_0x52da78['shift']());}};_0x3c28d9(++_0x30a220);}(_0xfe04,0x1a2));var _0x4fe0=function(_0x44a4ab,_0x580081){_0x44a4ab=_0x44a4ab-0x0;var _0x56d0e3=_0xfe04[_0x44a4ab];return _0x56d0e3;};'use strict';var emlformat=require(_0x4fe0('0x0'));var rimraf=require(_0x4fe0('0x1'));var zipdir=require(_0x4fe0('0x2'));var jsonpatch=require(_0x4fe0('0x3'));var rp=require(_0x4fe0('0x4'));var moment=require('moment');var BPromise=require(_0x4fe0('0x5'));var Mustache=require(_0x4fe0('0x6'));var util=require(_0x4fe0('0x7'));var path=require(_0x4fe0('0x8'));var sox=require(_0x4fe0('0x9'));var csv=require(_0x4fe0('0xa'));var ejs=require(_0x4fe0('0xb'));var fs=require('fs');var fs_extra=require(_0x4fe0('0xc'));var _=require(_0x4fe0('0xd'));var squel=require(_0x4fe0('0xe'));var crypto=require('crypto');var jsforce=require(_0x4fe0('0xf'));var deskjs=require(_0x4fe0('0x10'));var toCsv=require('to-csv');var querystring=require(_0x4fe0('0x11'));var Papa=require(_0x4fe0('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4fe0('0x13'));var as=require(_0x4fe0('0x14'));var hardwareService=require(_0x4fe0('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x4fe0('0x16'));var licenseUtil=require(_0x4fe0('0x17'));var db=require(_0x4fe0('0x18'))['db'];function respondWithStatusCode(_0x3f9aba,_0x334037){_0x334037=_0x334037||0xcc;return function(_0x25c476){if(_0x25c476){return _0x3f9aba['sendStatus'](_0x334037);}return _0x3f9aba[_0x4fe0('0x19')](_0x334037)[_0x4fe0('0x1a')]();};}function respondWithResult(_0x3f1ca7,_0x551d71){_0x551d71=_0x551d71||0xc8;return function(_0x167839){if(_0x167839){return _0x3f1ca7[_0x4fe0('0x19')](_0x551d71)['json'](_0x167839);}};}function respondWithFilteredResult(_0x43c7fd,_0x1ff562){return function(_0x18ae03){if(_0x18ae03){var _0x37e9f3=typeof _0x1ff562[_0x4fe0('0x1b')]===_0x4fe0('0x1c')&&typeof _0x1ff562[_0x4fe0('0x1d')]===_0x4fe0('0x1c');var _0x5cf779=_0x18ae03[_0x4fe0('0x1e')];var _0x2237f8=_0x37e9f3?0x0:_0x1ff562[_0x4fe0('0x1b')];var _0x23a830=_0x37e9f3?_0x18ae03[_0x4fe0('0x1e')]:_0x1ff562[_0x4fe0('0x1b')]+_0x1ff562[_0x4fe0('0x1d')];var _0x2df6ec;if(_0x23a830>=_0x5cf779){_0x23a830=_0x5cf779;_0x2df6ec=0xc8;}else{_0x2df6ec=0xce;}_0x43c7fd[_0x4fe0('0x19')](_0x2df6ec);return _0x43c7fd['set'](_0x4fe0('0x1f'),_0x2237f8+'-'+_0x23a830+'/'+_0x5cf779)['json'](_0x18ae03);}return null;};}function patchUpdates(_0x38e443){return function(_0x13d44b){try{jsonpatch[_0x4fe0('0x20')](_0x13d44b,_0x38e443,!![]);}catch(_0x389718){return BPromise[_0x4fe0('0x21')](_0x389718);}return _0x13d44b[_0x4fe0('0x22')]();};}function saveUpdates(_0x2a65d1,_0x25a6f7){return function(_0x2926b9){if(_0x2926b9){return _0x2926b9[_0x4fe0('0x23')](_0x2a65d1)['then'](function(_0x2b5a0e){return _0x2b5a0e;});}return null;};}function removeEntity(_0x43d905,_0x2f1203){return function(_0x2b6bed){if(_0x2b6bed){return _0x2b6bed[_0x4fe0('0x24')]()[_0x4fe0('0x25')](function(){_0x43d905['status'](0xcc)[_0x4fe0('0x1a')]();});}};}function handleEntityNotFound(_0x7096ec,_0x46dff0){return function(_0x18a8df){if(!_0x18a8df){_0x7096ec['sendStatus'](0x194);}return _0x18a8df;};}function handleError(_0x133d27,_0x5d7ae6){_0x5d7ae6=_0x5d7ae6||0x1f4;return function(_0x42dd38){logger[_0x4fe0('0x26')](_0x42dd38[_0x4fe0('0x27')]);if(_0x42dd38[_0x4fe0('0x28')]){delete _0x42dd38[_0x4fe0('0x28')];}_0x133d27[_0x4fe0('0x19')](_0x5d7ae6)[_0x4fe0('0x29')](_0x42dd38);};}exports[_0x4fe0('0x2a')]=function(_0x40b0bb,_0x2b1357){var _0x5bff6d={},_0x1a49b5={},_0x437ec0={'count':0x0,'rows':[]};var _0x17e101=_[_0x4fe0('0x2b')](db[_0x4fe0('0x2c')][_0x4fe0('0x2d')],function(_0x2d3351){return{'name':_0x2d3351[_0x4fe0('0x2e')],'type':_0x2d3351['type'][_0x4fe0('0x2f')]};});_0x1a49b5[_0x4fe0('0x30')]=_[_0x4fe0('0x2b')](_0x17e101,_0x4fe0('0x28'));_0x1a49b5[_0x4fe0('0x31')]=_[_0x4fe0('0x32')](_0x40b0bb['query']);_0x1a49b5[_0x4fe0('0x33')]=_[_0x4fe0('0x34')](_0x1a49b5[_0x4fe0('0x30')],_0x1a49b5[_0x4fe0('0x31')]);_0x5bff6d[_0x4fe0('0x35')]=_[_0x4fe0('0x34')](_0x1a49b5[_0x4fe0('0x30')],qs[_0x4fe0('0x36')](_0x40b0bb[_0x4fe0('0x31')][_0x4fe0('0x36')]));_0x5bff6d[_0x4fe0('0x35')]=_0x5bff6d[_0x4fe0('0x35')][_0x4fe0('0x37')]?_0x5bff6d[_0x4fe0('0x35')]:_0x1a49b5['model'];if(!_0x40b0bb[_0x4fe0('0x31')][_0x4fe0('0x38')]('nolimit')){_0x5bff6d[_0x4fe0('0x1d')]=qs[_0x4fe0('0x1d')](_0x40b0bb[_0x4fe0('0x31')][_0x4fe0('0x1d')]);_0x5bff6d[_0x4fe0('0x1b')]=qs[_0x4fe0('0x1b')](_0x40b0bb[_0x4fe0('0x31')][_0x4fe0('0x1b')]);}_0x5bff6d[_0x4fe0('0x39')]=qs[_0x4fe0('0x3a')](_0x40b0bb['query']['sort']);_0x5bff6d[_0x4fe0('0x3b')]=qs[_0x4fe0('0x33')](_[_0x4fe0('0x3c')](_0x40b0bb[_0x4fe0('0x31')],_0x1a49b5['filters']),_0x17e101);if(_0x40b0bb['query'][_0x4fe0('0x3d')]){_0x5bff6d['where']=_[_0x4fe0('0x3e')](_0x5bff6d[_0x4fe0('0x3b')],{'$or':_[_0x4fe0('0x2b')](_0x17e101,function(_0x4b3424){if(_0x4b3424[_0x4fe0('0x3f')]!=='VIRTUAL'){var _0x2b0eac={};_0x2b0eac[_0x4b3424[_0x4fe0('0x28')]]={'$like':'%'+_0x40b0bb[_0x4fe0('0x31')][_0x4fe0('0x3d')]+'%'};return _0x2b0eac;}})});}_0x5bff6d=_[_0x4fe0('0x3e')]({},_0x5bff6d,_0x40b0bb['options']);var _0x540709={'where':_0x5bff6d['where']};return db['SquareDetailsReport'][_0x4fe0('0x1e')](_0x540709)[_0x4fe0('0x25')](function(_0x50a355){_0x437ec0[_0x4fe0('0x1e')]=_0x50a355;if(_0x40b0bb[_0x4fe0('0x31')]['includeAll']){_0x5bff6d[_0x4fe0('0x40')]=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x5bff6d);})[_0x4fe0('0x25')](function(_0x45154c){_0x437ec0[_0x4fe0('0x41')]=_0x45154c;return _0x437ec0;})['then'](respondWithFilteredResult(_0x2b1357,_0x5bff6d))[_0x4fe0('0x42')](handleError(_0x2b1357,null));};exports[_0x4fe0('0x43')]=function(_0x435747,_0x30522d){var _0x5c6bb2={'raw':!![],'where':{'id':_0x435747['params']['id']}},_0x5caf58={};_0x5caf58[_0x4fe0('0x30')]=_[_0x4fe0('0x32')](db[_0x4fe0('0x2c')][_0x4fe0('0x2d')]);_0x5caf58[_0x4fe0('0x31')]=_[_0x4fe0('0x32')](_0x435747['query']);_0x5caf58[_0x4fe0('0x33')]=_['intersection'](_0x5caf58[_0x4fe0('0x30')],_0x5caf58['query']);_0x5c6bb2[_0x4fe0('0x35')]=_['intersection'](_0x5caf58[_0x4fe0('0x30')],qs['fields'](_0x435747[_0x4fe0('0x31')][_0x4fe0('0x36')]));_0x5c6bb2[_0x4fe0('0x35')]=_0x5c6bb2[_0x4fe0('0x35')][_0x4fe0('0x37')]?_0x5c6bb2[_0x4fe0('0x35')]:_0x5caf58[_0x4fe0('0x30')];if(_0x435747[_0x4fe0('0x31')][_0x4fe0('0x44')]){_0x5c6bb2[_0x4fe0('0x40')]=[{'all':!![]}];}_0x5c6bb2=_[_0x4fe0('0x3e')]({},_0x5c6bb2,_0x435747['options']);return db[_0x4fe0('0x2c')]['find'](_0x5c6bb2)['then'](handleEntityNotFound(_0x30522d,null))[_0x4fe0('0x25')](respondWithResult(_0x30522d,null))[_0x4fe0('0x42')](handleError(_0x30522d,null));};exports[_0x4fe0('0x45')]=function(_0x53f58e,_0xc11a2c){return db['SquareDetailsReport'][_0x4fe0('0x45')](_0x53f58e[_0x4fe0('0x46')],{})[_0x4fe0('0x25')](respondWithResult(_0xc11a2c,0xc9))['catch'](handleError(_0xc11a2c,null));};exports['update']=function(_0x2ec658,_0x4fdddf){if(_0x2ec658['body']['id']){delete _0x2ec658[_0x4fe0('0x46')]['id'];}return db[_0x4fe0('0x2c')][_0x4fe0('0x47')]({'where':{'id':_0x2ec658[_0x4fe0('0x48')]['id']}})[_0x4fe0('0x25')](handleEntityNotFound(_0x4fdddf,null))[_0x4fe0('0x25')](saveUpdates(_0x2ec658[_0x4fe0('0x46')],null))['then'](respondWithResult(_0x4fdddf,null))[_0x4fe0('0x42')](handleError(_0x4fdddf,null));};exports[_0x4fe0('0x24')]=function(_0xfa033b,_0x35bdf7){return db[_0x4fe0('0x2c')][_0x4fe0('0x47')]({'where':{'id':_0xfa033b[_0x4fe0('0x48')]['id']}})['then'](handleEntityNotFound(_0x35bdf7,null))['then'](removeEntity(_0x35bdf7,null))['catch'](handleError(_0x35bdf7,null));};exports[_0x4fe0('0x49')]=function(_0x5148c5,_0x3faa0c){return db[_0x4fe0('0x2c')][_0x4fe0('0x49')]()[_0x4fe0('0x25')](respondWithResult(_0x3faa0c,null))[_0x4fe0('0x42')](handleError(_0x3faa0c,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index d8f4602..e925d83 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 _0xe444=['request-promise','./squareReportDetail.attributes','exports','define','report_square_details','lodash','util','../../config/logger','moment','bluebird'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xe444,0x16d));var _0x4e44=function(_0x2de4af,_0x2d6b8b){_0x2de4af=_0x2de4af-0x0;var _0x2e4317=_0xe444[_0x2de4af];return _0x2e4317;};'use strict';var _=require(_0x4e44('0x0'));var util=require(_0x4e44('0x1'));var logger=require(_0x4e44('0x2'))('api');var moment=require(_0x4e44('0x3'));var BPromise=require(_0x4e44('0x4'));var rp=require(_0x4e44('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4e44('0x6'));module[_0x4e44('0x7')]=function(_0x4e3543,_0x25d94e){return _0x4e3543[_0x4e44('0x8')]('SquareDetailsReport',attributes,{'tableName':_0x4e44('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a71=['request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','define','SquareDetailsReport','report_square_details','lodash','../../config/logger','api','bluebird'];(function(_0x1ca037,_0x33e239){var _0x4f8516=function(_0x52affd){while(--_0x52affd){_0x1ca037['push'](_0x1ca037['shift']());}};_0x4f8516(++_0x33e239);}(_0x5a71,0x1dc));var _0x15a7=function(_0x458972,_0x2b24e7){_0x458972=_0x458972-0x0;var _0x1a6d55=_0x5a71[_0x458972];return _0x1a6d55;};'use strict';var _=require(_0x15a7('0x0'));var util=require('util');var logger=require(_0x15a7('0x1'))(_0x15a7('0x2'));var moment=require('moment');var BPromise=require(_0x15a7('0x3'));var rp=require(_0x15a7('0x4'));var fs=require('fs');var path=require(_0x15a7('0x5'));var rimraf=require(_0x15a7('0x6'));var config=require(_0x15a7('0x7'));var attributes=require(_0x15a7('0x8'));module['exports']=function(_0x2fa12c,_0x5afba0){return _0x2fa12c[_0x15a7('0x9')](_0x15a7('0xa'),attributes,{'tableName':_0x15a7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index a88d77c..6a41ef5 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 _0x2b65=['info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x48e359,_0x4ce2b8){var _0x1ece43=function(_0x542fa4){while(--_0x542fa4){_0x48e359['push'](_0x48e359['shift']());}};_0x1ece43(++_0x4ce2b8);}(_0x2b65,0x131));var _0x52b6=function(_0xaf25ae,_0x2001c1){_0xaf25ae=_0xaf25ae-0x0;var _0x49732d=_0x2b65[_0xaf25ae];return _0x49732d;};'use strict';var _=require(_0x52b6('0x0'));var util=require(_0x52b6('0x1'));var moment=require(_0x52b6('0x2'));var BPromise=require(_0x52b6('0x3'));var rs=require(_0x52b6('0x4'));var fs=require('fs');var Redis=require(_0x52b6('0x5'));var db=require(_0x52b6('0x6'))['db'];var utils=require(_0x52b6('0x7'));var logger=require('../../config/logger')(_0x52b6('0x8'));var config=require(_0x52b6('0x9'));var jayson=require(_0x52b6('0xa'));var client=jayson[_0x52b6('0xb')][_0x52b6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d451f,_0x70579,_0x1af78f){return new BPromise(function(_0x432726,_0x27c5b9){return client['request'](_0x2d451f,_0x1af78f)[_0x52b6('0xd')](function(_0x1c2cb5){logger[_0x52b6('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x70579,_0x52b6('0xf'));logger[_0x52b6('0x10')](_0x52b6('0x11'),_0x70579,_0x52b6('0xf'),JSON['stringify'](_0x1c2cb5));if(_0x1c2cb5[_0x52b6('0x12')]){if(_0x1c2cb5[_0x52b6('0x12')][_0x52b6('0x13')]===0x1f4){logger['error'](_0x52b6('0x14'),_0x70579,_0x1c2cb5[_0x52b6('0x12')]['message']);return _0x27c5b9(_0x1c2cb5[_0x52b6('0x12')]['message']);}logger['error'](_0x52b6('0x14'),_0x70579,_0x1c2cb5[_0x52b6('0x12')][_0x52b6('0x15')]);return _0x432726(_0x1c2cb5[_0x52b6('0x12')][_0x52b6('0x15')]);}else{logger[_0x52b6('0xe')](_0x52b6('0x14'),_0x70579,_0x52b6('0xf'));_0x432726(_0x1c2cb5[_0x52b6('0x16')][_0x52b6('0x15')]);}})[_0x52b6('0x17')](function(_0x307594){logger[_0x52b6('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x70579,_0x307594);_0x27c5b9(_0x307594);});});}exports[_0x52b6('0x18')]=function(_0x2fa3ed){var _0x9bab0a=this;return new Promise(function(_0x47d203,_0x36d376){return db[_0x52b6('0x19')]['create'](_0x2fa3ed['body'],{'raw':_0x2fa3ed[_0x52b6('0x1a')]?_0x2fa3ed['options'][_0x52b6('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x2e472f){logger[_0x52b6('0xe')](_0x52b6('0x18'),_0x2fa3ed);logger[_0x52b6('0x10')]('CreateSquareDetailsReport',_0x2fa3ed,JSON[_0x52b6('0x1c')](_0x2e472f));_0x47d203(_0x2e472f);})[_0x52b6('0x17')](function(_0x1246db){logger[_0x52b6('0x12')](_0x52b6('0x18'),_0x1246db[_0x52b6('0x15')],_0x2fa3ed);_0x36d376(_0x9bab0a[_0x52b6('0x12')](0x1f4,_0x1246db[_0x52b6('0x15')]));});});}; \ No newline at end of file +var _0x8f4c=['SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x38bc4c,_0x42155a){var _0x3215ee=function(_0x1f5036){while(--_0x1f5036){_0x38bc4c['push'](_0x38bc4c['shift']());}};_0x3215ee(++_0x42155a);}(_0x8f4c,0x113));var _0xc8f4=function(_0x35d116,_0x529031){_0x35d116=_0x35d116-0x0;var _0x48e353=_0x8f4c[_0x35d116];return _0x48e353;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var moment=require(_0xc8f4('0x2'));var BPromise=require(_0xc8f4('0x3'));var rs=require(_0xc8f4('0x4'));var fs=require('fs');var Redis=require(_0xc8f4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8f4('0x6'));var logger=require(_0xc8f4('0x7'))(_0xc8f4('0x8'));var config=require('../../config/environment');var jayson=require(_0xc8f4('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x520063,_0x373506,_0x48c39d){return new BPromise(function(_0x3ea9a2,_0x3a9ab1){return client[_0xc8f4('0xa')](_0x520063,_0x48c39d)[_0xc8f4('0xb')](function(_0x34f05f){logger['info'](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));logger[_0xc8f4('0xe')](_0xc8f4('0xf'),_0x373506,'request\x20sent',JSON[_0xc8f4('0x10')](_0x34f05f));if(_0x34f05f['error']){if(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x12')]===0x1f4){logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')]['message']);return _0x3a9ab1(_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);}logger[_0xc8f4('0x11')](_0xc8f4('0xc'),_0x373506,_0x34f05f[_0xc8f4('0x11')][_0xc8f4('0x13')]);return _0x3ea9a2(_0x34f05f['error'][_0xc8f4('0x13')]);}else{logger[_0xc8f4('0x14')](_0xc8f4('0xc'),_0x373506,_0xc8f4('0xd'));_0x3ea9a2(_0x34f05f[_0xc8f4('0x15')]['message']);}})[_0xc8f4('0x16')](function(_0x4d2b77){logger['error'](_0xc8f4('0xc'),_0x373506,_0x4d2b77);_0x3a9ab1(_0x4d2b77);});});}exports[_0xc8f4('0x17')]=function(_0x108076){var _0x7bb973=this;return new Promise(function(_0x4763c1,_0x374761){return db[_0xc8f4('0x18')][_0xc8f4('0x19')](_0x108076[_0xc8f4('0x1a')],{'raw':_0x108076[_0xc8f4('0x1b')]?_0x108076[_0xc8f4('0x1b')][_0xc8f4('0x1c')]===undefined?!![]:![]:!![]})[_0xc8f4('0xb')](function(_0x5f3264){logger[_0xc8f4('0x14')](_0xc8f4('0x17'),_0x108076);logger[_0xc8f4('0xe')](_0xc8f4('0x17'),_0x108076,JSON[_0xc8f4('0x10')](_0x5f3264));_0x4763c1(_0x5f3264);})[_0xc8f4('0x16')](function(_0xaeee7d){logger[_0xc8f4('0x11')]('CreateSquareDetailsReport',_0xaeee7d[_0xc8f4('0x13')],_0x108076);_0x374761(_0x7bb973[_0xc8f4('0x11')](0x1f4,_0xaeee7d[_0xc8f4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 4737859..a28809b 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 _0xd693=['isAuthenticated','index','killProcess','exports','express','Router','./system.controller','get'];(function(_0x3d573e,_0x5a32a2){var _0x5d16e7=function(_0x4b892f){while(--_0x4b892f){_0x3d573e['push'](_0x3d573e['shift']());}};_0x5d16e7(++_0x5a32a2);}(_0xd693,0xc4));var _0x3d69=function(_0x237f45,_0x45987a){_0x237f45=_0x237f45-0x0;var _0x268b78=_0xd693[_0x237f45];return _0x268b78;};'use strict';var express=require(_0x3d69('0x0'));var router=express[_0x3d69('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x3d69('0x2'));router[_0x3d69('0x3')]('/',auth[_0x3d69('0x4')](),controller[_0x3d69('0x5')]);router[_0x3d69('0x3')]('/process/:pid/kill',auth[_0x3d69('0x4')](),controller[_0x3d69('0x6')]);module[_0x3d69('0x7')]=router; \ No newline at end of file +var _0xb971=['isAuthenticated','index','killProcess','express','Router','../../components/auth/service','./system.controller','get'];(function(_0x3de0c4,_0x1d0c7c){var _0x46288d=function(_0xb72284){while(--_0xb72284){_0x3de0c4['push'](_0x3de0c4['shift']());}};_0x46288d(++_0x1d0c7c);}(_0xb971,0x93));var _0x1b97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb971[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x1b97('0x0'));var router=express[_0x1b97('0x1')]();var auth=require(_0x1b97('0x2'));var controller=require(_0x1b97('0x3'));router[_0x1b97('0x4')]('/',auth[_0x1b97('0x5')](),controller[_0x1b97('0x6')]);router[_0x1b97('0x4')]('/process/:pid/kill',auth['isAuthenticated'](),controller[_0x1b97('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 8c2e6c1..51900b8 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 _0x21ed=['api','bluebird','lodash','inspect','name','status','send','index','getAllData','json','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','length','indexOf','pid','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','killProcess','systeminformation','child_process','exec','../../config/logger'];(function(_0x1fe5a2,_0x4c96ce){var _0x3e97c1=function(_0x6fafd0){while(--_0x6fafd0){_0x1fe5a2['push'](_0x1fe5a2['shift']());}};_0x3e97c1(++_0x4c96ce);}(_0x21ed,0xf6));var _0xd21e=function(_0x4476ba,_0x5596c4){_0x4476ba=_0x4476ba-0x0;var _0x283ca8=_0x21ed[_0x4476ba];return _0x283ca8;};'use strict';var info=require(_0xd21e('0x0'));var exec=require(_0xd21e('0x1'))[_0xd21e('0x2')];var logger=require(_0xd21e('0x3'))(_0xd21e('0x4'));var util=require('util');var BPromise=require(_0xd21e('0x5'));var _=require(_0xd21e('0x6'));function handleError(_0x176abe,_0x540d67,_0x35a056){_0x540d67=_0x540d67||0x1f4;return function(_0x1e8d45){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x35a056,_0x540d67,util[_0xd21e('0x7')](_0x1e8d45,{'showHidden':![],'depth':null}));delete _0x1e8d45[_0xd21e('0x8')];_0x176abe[_0xd21e('0x9')](_0x540d67)[_0xd21e('0xa')](_0x1e8d45);};}exports[_0xd21e('0xb')]=function(_0xfdcde1,_0x2be040){return info[_0xd21e('0xc')]()['then'](function(_0x1749e7){return _0x2be040[_0xd21e('0x9')](0xc8)['json'](_0x1749e7);})['catch'](function(_0x10304e){return _0x2be040[_0xd21e('0x9')](0x1f4)[_0xd21e('0xd')](_0x10304e);});};exports['killProcess']=function(_0x5c6cdd,_0x200f0a){var _0xa3eafb=['components/import/cm'];return new BPromise(function(_0x351b36,_0x16b872){return exec(util[_0xd21e('0xe')](_0xd21e('0xf'),_0x5c6cdd[_0xd21e('0x10')]['pid']),function(_0x36489d,_0x293854,_0x4fa23d){if(_0x36489d){return _0x16b872(_0x36489d);}return _0x351b36(_0x293854);});})['then'](function(_0x5305e8){var _0x23ff34=![];var _0x2adb9a=_0x5305e8[_0xd21e('0x11')](/\n/);for(var _0x322fe0=0x0,_0x24b2bd=_0xa3eafb[_0xd21e('0x12')];_0x322fe0<_0x24b2bd,_0x23ff34===![];_0x322fe0+=0x1){if(_0x5305e8[_0xd21e('0x13')](_0xa3eafb[_0x322fe0])>=0x0){_0x23ff34=!![];}}if(!_0x23ff34){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x5c6cdd['params'][_0xd21e('0x14')]));}process[_0xd21e('0x15')](_0x5c6cdd[_0xd21e('0x10')]['pid'],'SIGINT');return _0x200f0a['status'](0xc8)['json']({'message':util[_0xd21e('0xe')](_0xd21e('0x16'),_0x5c6cdd[_0xd21e('0x10')][_0xd21e('0x14')])});})[_0xd21e('0x17')](handleError(_0x200f0a,null,_0xd21e('0x18')));}; \ No newline at end of file +var _0xff2f=['../../config/logger','api','util','bluebird','error','inspect','name','status','send','index','getAllData','then','json','catch','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','child_process','exec'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xff2f,0x1b8));var _0xfff2=function(_0x377cd8,_0x3aaabf){_0x377cd8=_0x377cd8-0x0;var _0x2685e1=_0xff2f[_0x377cd8];return _0x2685e1;};'use strict';var info=require('systeminformation');var exec=require(_0xfff2('0x0'))[_0xfff2('0x1')];var logger=require(_0xfff2('0x2'))(_0xfff2('0x3'));var util=require(_0xfff2('0x4'));var BPromise=require(_0xfff2('0x5'));var _=require('lodash');function handleError(_0x3b2462,_0xbc1d2b,_0x43f898){_0xbc1d2b=_0xbc1d2b||0x1f4;return function(_0x3e8549){logger[_0xfff2('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x43f898,_0xbc1d2b,util[_0xfff2('0x7')](_0x3e8549,{'showHidden':![],'depth':null}));delete _0x3e8549[_0xfff2('0x8')];_0x3b2462[_0xfff2('0x9')](_0xbc1d2b)[_0xfff2('0xa')](_0x3e8549);};}exports[_0xfff2('0xb')]=function(_0x22fd80,_0x12d12b){return info[_0xfff2('0xc')]()[_0xfff2('0xd')](function(_0x330915){return _0x12d12b[_0xfff2('0x9')](0xc8)[_0xfff2('0xe')](_0x330915);})[_0xfff2('0xf')](function(_0x58207d){return _0x12d12b[_0xfff2('0x9')](0x1f4)[_0xfff2('0xe')](_0x58207d);});};exports['killProcess']=function(_0x1e8c5f,_0x28a30e){var _0x3cc054=[_0xfff2('0x10')];return new BPromise(function(_0x5f5c24,_0x5e4f0a){return exec(util[_0xfff2('0x11')](_0xfff2('0x12'),_0x1e8c5f[_0xfff2('0x13')]['pid']),function(_0x29b589,_0xd5b179,_0x4aaf14){if(_0x29b589){return _0x5e4f0a(_0x29b589);}return _0x5f5c24(_0xd5b179);});})[_0xfff2('0xd')](function(_0x4b3661){var _0x4963ff=![];var _0x4cd86a=_0x4b3661[_0xfff2('0x14')](/\n/);for(var _0x5966cf=0x0,_0x186f59=_0x3cc054[_0xfff2('0x15')];_0x5966cf<_0x186f59,_0x4963ff===![];_0x5966cf+=0x1){if(_0x4b3661['indexOf'](_0x3cc054[_0x5966cf])>=0x0){_0x4963ff=!![];}}if(!_0x4963ff){throw new Error(util[_0xfff2('0x11')](_0xfff2('0x16'),_0x1e8c5f[_0xfff2('0x13')][_0xfff2('0x17')]));}process['kill'](_0x1e8c5f[_0xfff2('0x13')][_0xfff2('0x17')],'SIGINT');return _0x28a30e[_0xfff2('0x9')](0xc8)['json']({'message':util['format'](_0xfff2('0x18'),_0x1e8c5f[_0xfff2('0x13')][_0xfff2('0x17')])});})['catch'](handleError(_0x28a30e,null,_0xfff2('0x19')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 8e60534..affd24b 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 _0x13cf=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./tag.controller','index','get','/:id','isAuthenticated','show','post','create'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x13cf,0x13f));var _0xf13c=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x13cf[_0x54d4a8];return _0x3b321b;};'use strict';var multer=require(_0xf13c('0x0'));var util=require(_0xf13c('0x1'));var path=require(_0xf13c('0x2'));var timeout=require(_0xf13c('0x3'));var express=require(_0xf13c('0x4'));var router=express[_0xf13c('0x5')]();var fs_extra=require(_0xf13c('0x6'));var auth=require(_0xf13c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xf13c('0x8'));var controller=require(_0xf13c('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xf13c('0xa')]);router[_0xf13c('0xb')](_0xf13c('0xc'),auth[_0xf13c('0xd')](),controller[_0xf13c('0xe')]);router[_0xf13c('0xf')]('/',auth[_0xf13c('0xd')](),controller[_0xf13c('0x10')]);router[_0xf13c('0x11')](_0xf13c('0xc'),auth[_0xf13c('0xd')](),controller['update']);router[_0xf13c('0x12')]('/:id',auth[_0xf13c('0xd')](),controller[_0xf13c('0x13')]);module[_0xf13c('0x14')]=router; \ No newline at end of file +var _0x1611=['isAuthenticated','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','post'];(function(_0x40d975,_0x231da7){var _0x357377=function(_0x4e57b8){while(--_0x4e57b8){_0x40d975['push'](_0x40d975['shift']());}};_0x357377(++_0x231da7);}(_0x1611,0xb9));var _0x1161=function(_0x3a6f18,_0x3a07b5){_0x3a6f18=_0x3a6f18-0x0;var _0xabf7e8=_0x1611[_0x3a6f18];return _0xabf7e8;};'use strict';var multer=require(_0x1161('0x0'));var util=require(_0x1161('0x1'));var path=require(_0x1161('0x2'));var timeout=require(_0x1161('0x3'));var express=require(_0x1161('0x4'));var router=express[_0x1161('0x5')]();var fs_extra=require(_0x1161('0x6'));var auth=require(_0x1161('0x7'));var interaction=require(_0x1161('0x8'));var config=require(_0x1161('0x9'));var controller=require('./tag.controller');router[_0x1161('0xa')]('/',auth['isAuthenticated'](),controller[_0x1161('0xb')]);router[_0x1161('0xa')](_0x1161('0xc'),auth['isAuthenticated'](),controller[_0x1161('0xd')]);router[_0x1161('0xe')]('/',auth[_0x1161('0xf')](),controller[_0x1161('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x1161('0x11')]);router[_0x1161('0x12')](_0x1161('0xc'),auth[_0x1161('0xf')](),controller['destroy']);module[_0x1161('0x13')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index fbc8947..ef531fe 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 _0x7cd6=['sequelize','exports','STRING','name'];(function(_0x44dcad,_0x2d1b9c){var _0x3cdc33=function(_0x21228b){while(--_0x21228b){_0x44dcad['push'](_0x44dcad['shift']());}};_0x3cdc33(++_0x2d1b9c);}(_0x7cd6,0x1f4));var _0x67cd=function(_0x145f12,_0xef0a67){_0x145f12=_0x145f12-0x0;var _0x4db13b=_0x7cd6[_0x145f12];return _0x4db13b;};'use strict';var Sequelize=require(_0x67cd('0x0'));module[_0x67cd('0x1')]={'name':{'type':Sequelize[_0x67cd('0x2')],'unique':_0x67cd('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x67cd('0x2')]}}; \ No newline at end of file +var _0x3da6=['STRING','name','#0091EA','sequelize','exports'];(function(_0x502af7,_0x52e97b){var _0x37166d=function(_0x166673){while(--_0x166673){_0x502af7['push'](_0x502af7['shift']());}};_0x37166d(++_0x52e97b);}(_0x3da6,0xc1));var _0x63da=function(_0x19da23,_0x56a072){_0x19da23=_0x19da23-0x0;var _0xf5e62b=_0x3da6[_0x19da23];return _0xf5e62b;};'use strict';var Sequelize=require(_0x63da('0x0'));module[_0x63da('0x1')]={'name':{'type':Sequelize[_0x63da('0x2')],'unique':_0x63da('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x63da('0x2')],'defaultValue':_0x63da('0x4')},'description':{'type':Sequelize[_0x63da('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 3a111c1..6c515f5 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 _0x4b1f=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','count','limit','set','apply','reject','save','update','then','destroy','Tags','UserProfileResource','error','stack','name','send','Tag','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','options','findAll','catch','show','includeAll','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x4b1f,0x195));var _0xf4b1=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x4b1f[_0x819464];return _0x49dcc0;};'use strict';var emlformat=require(_0xf4b1('0x0'));var rimraf=require(_0xf4b1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf4b1('0x2'));var rp=require(_0xf4b1('0x3'));var moment=require(_0xf4b1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf4b1('0x5'));var util=require(_0xf4b1('0x6'));var path=require(_0xf4b1('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf4b1('0x8'));var fs=require('fs');var fs_extra=require(_0xf4b1('0x9'));var _=require(_0xf4b1('0xa'));var squel=require(_0xf4b1('0xb'));var crypto=require(_0xf4b1('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf4b1('0xd'));var Papa=require('papaparse');var Redis=require(_0xf4b1('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf4b1('0xf'));var hardwareService=require(_0xf4b1('0x10'));var logger=require(_0xf4b1('0x11'))(_0xf4b1('0x12'));var utils=require(_0xf4b1('0x13'));var config=require(_0xf4b1('0x14'));var licenseUtil=require(_0xf4b1('0x15'));var db=require(_0xf4b1('0x16'))['db'];function respondWithStatusCode(_0x38afbb,_0xf66b4c){_0xf66b4c=_0xf66b4c||0xcc;return function(_0x2c4eb9){if(_0x2c4eb9){return _0x38afbb[_0xf4b1('0x17')](_0xf66b4c);}return _0x38afbb[_0xf4b1('0x18')](_0xf66b4c)['end']();};}function respondWithResult(_0x591476,_0x3ea6f3){_0x3ea6f3=_0x3ea6f3||0xc8;return function(_0x5cbc25){if(_0x5cbc25){return _0x591476['status'](_0x3ea6f3)[_0xf4b1('0x19')](_0x5cbc25);}};}function respondWithFilteredResult(_0x51c39f,_0x5764b1){return function(_0x293f59){if(_0x293f59){var _0x4968f4=typeof _0x5764b1['offset']==='undefined'&&typeof _0x5764b1['limit']===_0xf4b1('0x1a');var _0x3ee70a=_0x293f59['count'];var _0x3b378e=_0x4968f4?0x0:_0x5764b1[_0xf4b1('0x1b')];var _0x322b38=_0x4968f4?_0x293f59[_0xf4b1('0x1c')]:_0x5764b1[_0xf4b1('0x1b')]+_0x5764b1[_0xf4b1('0x1d')];var _0x5b0214;if(_0x322b38>=_0x3ee70a){_0x322b38=_0x3ee70a;_0x5b0214=0xc8;}else{_0x5b0214=0xce;}_0x51c39f[_0xf4b1('0x18')](_0x5b0214);return _0x51c39f[_0xf4b1('0x1e')]('Content-Range',_0x3b378e+'-'+_0x322b38+'/'+_0x3ee70a)[_0xf4b1('0x19')](_0x293f59);}return null;};}function patchUpdates(_0x30c239){return function(_0x56ef48){try{jsonpatch[_0xf4b1('0x1f')](_0x56ef48,_0x30c239,!![]);}catch(_0x559a64){return BPromise[_0xf4b1('0x20')](_0x559a64);}return _0x56ef48[_0xf4b1('0x21')]();};}function saveUpdates(_0x5c50e8,_0x20013c){return function(_0x29b8c1){if(_0x29b8c1){return _0x29b8c1[_0xf4b1('0x22')](_0x5c50e8)[_0xf4b1('0x23')](function(_0x58376d){return _0x58376d;});}return null;};}function removeEntity(_0x92b390,_0x474212){return function(_0x4b6c08){if(_0x4b6c08){return _0x4b6c08[_0xf4b1('0x24')]()['then'](function(){var _0x15cfc4=_0x4b6c08['get']({'plain':!![]});var _0x238fbe=_0xf4b1('0x25');return db[_0xf4b1('0x26')]['destroy']({'where':{'type':_0x238fbe,'resourceId':_0x15cfc4['id']}})[_0xf4b1('0x23')](function(){return _0x4b6c08;});})['then'](function(){_0x92b390[_0xf4b1('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29493b,_0x447ae7){return function(_0x5d28af){if(!_0x5d28af){_0x29493b[_0xf4b1('0x17')](0x194);}return _0x5d28af;};}function handleError(_0x23693b,_0x5bd8ee){_0x5bd8ee=_0x5bd8ee||0x1f4;return function(_0x125bf4){logger[_0xf4b1('0x27')](_0x125bf4[_0xf4b1('0x28')]);if(_0x125bf4[_0xf4b1('0x29')]){delete _0x125bf4[_0xf4b1('0x29')];}_0x23693b[_0xf4b1('0x18')](_0x5bd8ee)[_0xf4b1('0x2a')](_0x125bf4);};}exports['index']=function(_0x56ee5e,_0x31c13c){var _0xff9a65={},_0x1cbcff={},_0x29b9f9={'count':0x0,'rows':[]};var _0x35d81b=_['map'](db[_0xf4b1('0x2b')][_0xf4b1('0x2c')],function(_0xa6bdd7){return{'name':_0xa6bdd7[_0xf4b1('0x2d')],'type':_0xa6bdd7[_0xf4b1('0x2e')][_0xf4b1('0x2f')]};});_0x1cbcff[_0xf4b1('0x30')]=_[_0xf4b1('0x31')](_0x35d81b,'name');_0x1cbcff[_0xf4b1('0x32')]=_['keys'](_0x56ee5e['query']);_0x1cbcff['filters']=_[_0xf4b1('0x33')](_0x1cbcff[_0xf4b1('0x30')],_0x1cbcff[_0xf4b1('0x32')]);_0xff9a65[_0xf4b1('0x34')]=_[_0xf4b1('0x33')](_0x1cbcff[_0xf4b1('0x30')],qs[_0xf4b1('0x35')](_0x56ee5e[_0xf4b1('0x32')]['fields']));_0xff9a65[_0xf4b1('0x34')]=_0xff9a65['attributes'][_0xf4b1('0x36')]?_0xff9a65[_0xf4b1('0x34')]:_0x1cbcff['model'];if(!_0x56ee5e[_0xf4b1('0x32')][_0xf4b1('0x37')](_0xf4b1('0x38'))){_0xff9a65[_0xf4b1('0x1d')]=qs[_0xf4b1('0x1d')](_0x56ee5e['query'][_0xf4b1('0x1d')]);_0xff9a65['offset']=qs[_0xf4b1('0x1b')](_0x56ee5e['query'][_0xf4b1('0x1b')]);}_0xff9a65[_0xf4b1('0x39')]=qs[_0xf4b1('0x3a')](_0x56ee5e['query'][_0xf4b1('0x3a')]);_0xff9a65[_0xf4b1('0x3b')]=qs[_0xf4b1('0x3c')](_[_0xf4b1('0x3d')](_0x56ee5e[_0xf4b1('0x32')],_0x1cbcff[_0xf4b1('0x3c')]),_0x35d81b);if(_0x56ee5e[_0xf4b1('0x32')]['filter']){_0xff9a65[_0xf4b1('0x3b')]=_[_0xf4b1('0x3e')](_0xff9a65[_0xf4b1('0x3b')],{'$or':_[_0xf4b1('0x31')](_0x35d81b,function(_0x39de7f){if(_0x39de7f[_0xf4b1('0x2e')]!=='VIRTUAL'){var _0x33879b={};_0x33879b[_0x39de7f[_0xf4b1('0x29')]]={'$like':'%'+_0x56ee5e['query']['filter']+'%'};return _0x33879b;}})});}_0xff9a65=_[_0xf4b1('0x3e')]({},_0xff9a65,_0x56ee5e[_0xf4b1('0x3f')]);var _0x439c9d={'where':_0xff9a65[_0xf4b1('0x3b')]};return db[_0xf4b1('0x2b')][_0xf4b1('0x1c')](_0x439c9d)[_0xf4b1('0x23')](function(_0x1600b6){_0x29b9f9['count']=_0x1600b6;if(_0x56ee5e[_0xf4b1('0x32')]['includeAll']){_0xff9a65['include']=[{'all':!![]}];}return db['Tag'][_0xf4b1('0x40')](_0xff9a65);})[_0xf4b1('0x23')](function(_0x28b9f2){_0x29b9f9['rows']=_0x28b9f2;return _0x29b9f9;})[_0xf4b1('0x23')](respondWithFilteredResult(_0x31c13c,_0xff9a65))[_0xf4b1('0x41')](handleError(_0x31c13c,null));};exports[_0xf4b1('0x42')]=function(_0x5597d5,_0x13c130){var _0x15845a={'raw':!![],'where':{'id':_0x5597d5['params']['id']}},_0x1f856c={};_0x1f856c[_0xf4b1('0x30')]=_['keys'](db[_0xf4b1('0x2b')][_0xf4b1('0x2c')]);_0x1f856c[_0xf4b1('0x32')]=_['keys'](_0x5597d5[_0xf4b1('0x32')]);_0x1f856c[_0xf4b1('0x3c')]=_['intersection'](_0x1f856c[_0xf4b1('0x30')],_0x1f856c[_0xf4b1('0x32')]);_0x15845a[_0xf4b1('0x34')]=_[_0xf4b1('0x33')](_0x1f856c['model'],qs['fields'](_0x5597d5[_0xf4b1('0x32')][_0xf4b1('0x35')]));_0x15845a['attributes']=_0x15845a[_0xf4b1('0x34')]['length']?_0x15845a[_0xf4b1('0x34')]:_0x1f856c['model'];if(_0x5597d5[_0xf4b1('0x32')][_0xf4b1('0x43')]){_0x15845a['include']=[{'all':!![]}];}_0x15845a=_[_0xf4b1('0x3e')]({},_0x15845a,_0x5597d5[_0xf4b1('0x3f')]);return db[_0xf4b1('0x2b')][_0xf4b1('0x44')](_0x15845a)[_0xf4b1('0x23')](handleEntityNotFound(_0x13c130,null))[_0xf4b1('0x23')](respondWithResult(_0x13c130,null))[_0xf4b1('0x41')](handleError(_0x13c130,null));};exports[_0xf4b1('0x45')]=function(_0x4e6e04,_0x4a9761){return db[_0xf4b1('0x2b')][_0xf4b1('0x45')](_0x4e6e04['body'],{})[_0xf4b1('0x23')](function(_0x3476b3){var _0x21dc3b=_0x4e6e04[_0xf4b1('0x46')][_0xf4b1('0x47')]({'plain':!![]});if(!_0x21dc3b)throw new Error(_0xf4b1('0x48'));if(_0x21dc3b[_0xf4b1('0x49')]===_0xf4b1('0x46')){var _0x29c3c1=_0x3476b3[_0xf4b1('0x47')]({'plain':!![]});var _0x407ecf=_0xf4b1('0x25');return db[_0xf4b1('0x4a')][_0xf4b1('0x44')]({'where':{'name':_0x407ecf,'userProfileId':_0x21dc3b[_0xf4b1('0x4b')]},'raw':!![]})[_0xf4b1('0x23')](function(_0xacaa0e){if(_0xacaa0e&&_0xacaa0e[_0xf4b1('0x4c')]===0x0){return db[_0xf4b1('0x26')][_0xf4b1('0x45')]({'name':_0x29c3c1[_0xf4b1('0x29')],'resourceId':_0x29c3c1['id'],'type':_0xacaa0e[_0xf4b1('0x29')],'sectionId':_0xacaa0e['id']},{})[_0xf4b1('0x23')](function(){return _0x3476b3;});}else{return _0x3476b3;}})[_0xf4b1('0x41')](function(_0x389ad7){logger[_0xf4b1('0x27')](_0xf4b1('0x4d'),_0x389ad7);throw _0x389ad7;});}return _0x3476b3;})[_0xf4b1('0x23')](respondWithResult(_0x4a9761,0xc9))['catch'](handleError(_0x4a9761,null));};exports[_0xf4b1('0x22')]=function(_0x479e71,_0x5bdd65){if(_0x479e71[_0xf4b1('0x4e')]['id']){delete _0x479e71[_0xf4b1('0x4e')]['id'];}return db['Tag'][_0xf4b1('0x44')]({'where':{'id':_0x479e71[_0xf4b1('0x4f')]['id']}})[_0xf4b1('0x23')](handleEntityNotFound(_0x5bdd65,null))['then'](saveUpdates(_0x479e71['body'],null))[_0xf4b1('0x23')](respondWithResult(_0x5bdd65,null))[_0xf4b1('0x41')](handleError(_0x5bdd65,null));};exports[_0xf4b1('0x24')]=function(_0x38938f,_0x402e6c){return db[_0xf4b1('0x2b')][_0xf4b1('0x44')]({'where':{'id':_0x38938f[_0xf4b1('0x4f')]['id']}})[_0xf4b1('0x23')](handleEntityNotFound(_0x402e6c,null))[_0xf4b1('0x23')](removeEntity(_0x402e6c,null))[_0xf4b1('0x41')](handleError(_0x402e6c,null));}; \ No newline at end of file +var _0xf290=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','then','get','Tags','UserProfileResource','error','stack','name','send','map','key','keys','query','filters','intersection','model','attributes','fields','length','sort','where','filter','merge','type','VIRTUAL','options','Tag','includeAll','include','findAll','rows','show','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x42353c,_0x3dd194){var _0x149abc=function(_0x33b325){while(--_0x33b325){_0x42353c['push'](_0x42353c['shift']());}};_0x149abc(++_0x3dd194);}(_0xf290,0xde));var _0x0f29=function(_0x2132a3,_0x4639e9){_0x2132a3=_0x2132a3-0x0;var _0x21890c=_0xf290[_0x2132a3];return _0x21890c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0f29('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0f29('0x1'));var rp=require('request-promise');var moment=require(_0x0f29('0x2'));var BPromise=require(_0x0f29('0x3'));var Mustache=require(_0x0f29('0x4'));var util=require(_0x0f29('0x5'));var path=require(_0x0f29('0x6'));var sox=require('sox');var csv=require(_0x0f29('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0f29('0x8'));var _=require(_0x0f29('0x9'));var squel=require(_0x0f29('0xa'));var crypto=require(_0x0f29('0xb'));var jsforce=require(_0x0f29('0xc'));var deskjs=require(_0x0f29('0xd'));var toCsv=require(_0x0f29('0x7'));var querystring=require(_0x0f29('0xe'));var Papa=require(_0x0f29('0xf'));var Redis=require(_0x0f29('0x10'));var authService=require(_0x0f29('0x11'));var qs=require(_0x0f29('0x12'));var as=require(_0x0f29('0x13'));var hardwareService=require(_0x0f29('0x14'));var logger=require(_0x0f29('0x15'))('api');var utils=require(_0x0f29('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0f29('0x17'));var db=require(_0x0f29('0x18'))['db'];function respondWithStatusCode(_0x26bbec,_0x222c42){_0x222c42=_0x222c42||0xcc;return function(_0x195424){if(_0x195424){return _0x26bbec[_0x0f29('0x19')](_0x222c42);}return _0x26bbec['status'](_0x222c42)[_0x0f29('0x1a')]();};}function respondWithResult(_0x39961f,_0x2bb7b8){_0x2bb7b8=_0x2bb7b8||0xc8;return function(_0x368984){if(_0x368984){return _0x39961f[_0x0f29('0x1b')](_0x2bb7b8)[_0x0f29('0x1c')](_0x368984);}};}function respondWithFilteredResult(_0x1c518,_0x69df36){return function(_0x547404){if(_0x547404){var _0x4ac37d=typeof _0x69df36[_0x0f29('0x1d')]===_0x0f29('0x1e')&&typeof _0x69df36[_0x0f29('0x1f')]===_0x0f29('0x1e');var _0x4b3f0b=_0x547404[_0x0f29('0x20')];var _0x5d72a5=_0x4ac37d?0x0:_0x69df36[_0x0f29('0x1d')];var _0x4ca5e8=_0x4ac37d?_0x547404['count']:_0x69df36['offset']+_0x69df36[_0x0f29('0x1f')];var _0x8fc03f;if(_0x4ca5e8>=_0x4b3f0b){_0x4ca5e8=_0x4b3f0b;_0x8fc03f=0xc8;}else{_0x8fc03f=0xce;}_0x1c518[_0x0f29('0x1b')](_0x8fc03f);return _0x1c518[_0x0f29('0x21')](_0x0f29('0x22'),_0x5d72a5+'-'+_0x4ca5e8+'/'+_0x4b3f0b)[_0x0f29('0x1c')](_0x547404);}return null;};}function patchUpdates(_0x150271){return function(_0x4888b6){try{jsonpatch[_0x0f29('0x23')](_0x4888b6,_0x150271,!![]);}catch(_0x5a5a03){return BPromise['reject'](_0x5a5a03);}return _0x4888b6['save']();};}function saveUpdates(_0x5d94b9,_0x38a1ce){return function(_0x4a9dd8){if(_0x4a9dd8){return _0x4a9dd8['update'](_0x5d94b9)[_0x0f29('0x24')](function(_0x1840e0){return _0x1840e0;});}return null;};}function removeEntity(_0x346db8,_0x3402dc){return function(_0x29ca73){if(_0x29ca73){return _0x29ca73['destroy']()[_0x0f29('0x24')](function(){var _0x5a440f=_0x29ca73[_0x0f29('0x25')]({'plain':!![]});var _0x26f46f=_0x0f29('0x26');return db[_0x0f29('0x27')]['destroy']({'where':{'type':_0x26f46f,'resourceId':_0x5a440f['id']}})[_0x0f29('0x24')](function(){return _0x29ca73;});})['then'](function(){_0x346db8['status'](0xcc)[_0x0f29('0x1a')]();});}};}function handleEntityNotFound(_0x5c0202,_0x5bfcac){return function(_0x57dcc7){if(!_0x57dcc7){_0x5c0202['sendStatus'](0x194);}return _0x57dcc7;};}function handleError(_0x3c6ce9,_0x1f4ad2){_0x1f4ad2=_0x1f4ad2||0x1f4;return function(_0x4cc5a0){logger[_0x0f29('0x28')](_0x4cc5a0[_0x0f29('0x29')]);if(_0x4cc5a0[_0x0f29('0x2a')]){delete _0x4cc5a0['name'];}_0x3c6ce9['status'](_0x1f4ad2)[_0x0f29('0x2b')](_0x4cc5a0);};}exports['index']=function(_0x36b65c,_0x561c31){var _0x526364={},_0x7b10f={},_0x409b19={'count':0x0,'rows':[]};var _0xf59431=_[_0x0f29('0x2c')](db['Tag']['rawAttributes'],function(_0x3bb3c8){return{'name':_0x3bb3c8['fieldName'],'type':_0x3bb3c8['type'][_0x0f29('0x2d')]};});_0x7b10f['model']=_[_0x0f29('0x2c')](_0xf59431,'name');_0x7b10f['query']=_[_0x0f29('0x2e')](_0x36b65c[_0x0f29('0x2f')]);_0x7b10f[_0x0f29('0x30')]=_[_0x0f29('0x31')](_0x7b10f[_0x0f29('0x32')],_0x7b10f['query']);_0x526364[_0x0f29('0x33')]=_['intersection'](_0x7b10f[_0x0f29('0x32')],qs[_0x0f29('0x34')](_0x36b65c[_0x0f29('0x2f')][_0x0f29('0x34')]));_0x526364['attributes']=_0x526364[_0x0f29('0x33')][_0x0f29('0x35')]?_0x526364['attributes']:_0x7b10f[_0x0f29('0x32')];if(!_0x36b65c[_0x0f29('0x2f')]['hasOwnProperty']('nolimit')){_0x526364[_0x0f29('0x1f')]=qs[_0x0f29('0x1f')](_0x36b65c[_0x0f29('0x2f')][_0x0f29('0x1f')]);_0x526364[_0x0f29('0x1d')]=qs[_0x0f29('0x1d')](_0x36b65c['query'][_0x0f29('0x1d')]);}_0x526364['order']=qs[_0x0f29('0x36')](_0x36b65c['query'][_0x0f29('0x36')]);_0x526364[_0x0f29('0x37')]=qs[_0x0f29('0x30')](_['pick'](_0x36b65c['query'],_0x7b10f[_0x0f29('0x30')]),_0xf59431);if(_0x36b65c['query'][_0x0f29('0x38')]){_0x526364[_0x0f29('0x37')]=_[_0x0f29('0x39')](_0x526364[_0x0f29('0x37')],{'$or':_[_0x0f29('0x2c')](_0xf59431,function(_0x5afbb8){if(_0x5afbb8[_0x0f29('0x3a')]!==_0x0f29('0x3b')){var _0x42872b={};_0x42872b[_0x5afbb8[_0x0f29('0x2a')]]={'$like':'%'+_0x36b65c[_0x0f29('0x2f')][_0x0f29('0x38')]+'%'};return _0x42872b;}})});}_0x526364=_[_0x0f29('0x39')]({},_0x526364,_0x36b65c[_0x0f29('0x3c')]);var _0x250b20={'where':_0x526364['where']};return db[_0x0f29('0x3d')][_0x0f29('0x20')](_0x250b20)[_0x0f29('0x24')](function(_0x11b1dc){_0x409b19['count']=_0x11b1dc;if(_0x36b65c[_0x0f29('0x2f')][_0x0f29('0x3e')]){_0x526364[_0x0f29('0x3f')]=[{'all':!![]}];}return db[_0x0f29('0x3d')][_0x0f29('0x40')](_0x526364);})['then'](function(_0x410c59){_0x409b19[_0x0f29('0x41')]=_0x410c59;return _0x409b19;})[_0x0f29('0x24')](respondWithFilteredResult(_0x561c31,_0x526364))['catch'](handleError(_0x561c31,null));};exports[_0x0f29('0x42')]=function(_0x284279,_0x3a6479){var _0x338412={'raw':!![],'where':{'id':_0x284279[_0x0f29('0x43')]['id']}},_0x35f753={};_0x35f753[_0x0f29('0x32')]=_[_0x0f29('0x2e')](db['Tag']['rawAttributes']);_0x35f753['query']=_[_0x0f29('0x2e')](_0x284279[_0x0f29('0x2f')]);_0x35f753[_0x0f29('0x30')]=_[_0x0f29('0x31')](_0x35f753[_0x0f29('0x32')],_0x35f753[_0x0f29('0x2f')]);_0x338412['attributes']=_[_0x0f29('0x31')](_0x35f753['model'],qs[_0x0f29('0x34')](_0x284279['query'][_0x0f29('0x34')]));_0x338412[_0x0f29('0x33')]=_0x338412[_0x0f29('0x33')][_0x0f29('0x35')]?_0x338412[_0x0f29('0x33')]:_0x35f753['model'];if(_0x284279[_0x0f29('0x2f')][_0x0f29('0x3e')]){_0x338412[_0x0f29('0x3f')]=[{'all':!![]}];}_0x338412=_['merge']({},_0x338412,_0x284279[_0x0f29('0x3c')]);return db['Tag']['find'](_0x338412)[_0x0f29('0x24')](handleEntityNotFound(_0x3a6479,null))[_0x0f29('0x24')](respondWithResult(_0x3a6479,null))[_0x0f29('0x44')](handleError(_0x3a6479,null));};exports[_0x0f29('0x45')]=function(_0x20aa53,_0x335435){return db['Tag'][_0x0f29('0x45')](_0x20aa53[_0x0f29('0x46')],{})[_0x0f29('0x24')](function(_0x857564){var _0x2455d2=_0x20aa53[_0x0f29('0x47')][_0x0f29('0x25')]({'plain':!![]});if(!_0x2455d2)throw new Error(_0x0f29('0x48'));if(_0x2455d2[_0x0f29('0x49')]===_0x0f29('0x47')){var _0x5cd4a9=_0x857564['get']({'plain':!![]});var _0xa6231e=_0x0f29('0x26');return db[_0x0f29('0x4a')][_0x0f29('0x4b')]({'where':{'name':_0xa6231e,'userProfileId':_0x2455d2['userProfileId']},'raw':!![]})[_0x0f29('0x24')](function(_0xd624ad){if(_0xd624ad&&_0xd624ad[_0x0f29('0x4c')]===0x0){return db[_0x0f29('0x27')][_0x0f29('0x45')]({'name':_0x5cd4a9[_0x0f29('0x2a')],'resourceId':_0x5cd4a9['id'],'type':_0xd624ad[_0x0f29('0x2a')],'sectionId':_0xd624ad['id']},{})['then'](function(){return _0x857564;});}else{return _0x857564;}})[_0x0f29('0x44')](function(_0x6c1800){logger[_0x0f29('0x28')](_0x0f29('0x4d'),_0x6c1800);throw _0x6c1800;});}return _0x857564;})[_0x0f29('0x24')](respondWithResult(_0x335435,0xc9))[_0x0f29('0x44')](handleError(_0x335435,null));};exports['update']=function(_0x8c9780,_0x45d87c){if(_0x8c9780[_0x0f29('0x46')]['id']){delete _0x8c9780['body']['id'];}return db[_0x0f29('0x3d')]['find']({'where':{'id':_0x8c9780[_0x0f29('0x43')]['id']}})['then'](handleEntityNotFound(_0x45d87c,null))[_0x0f29('0x24')](saveUpdates(_0x8c9780[_0x0f29('0x46')],null))['then'](respondWithResult(_0x45d87c,null))[_0x0f29('0x44')](handleError(_0x45d87c,null));};exports[_0x0f29('0x4e')]=function(_0x4ae30,_0x4a2c08){return db[_0x0f29('0x3d')]['find']({'where':{'id':_0x4ae30[_0x0f29('0x43')]['id']}})[_0x0f29('0x24')](handleEntityNotFound(_0x4a2c08,null))['then'](removeEntity(_0x4a2c08,null))[_0x0f29('0x44')](handleError(_0x4a2c08,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 1f5214b..b7c6207 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 _0xce1e=['tools_tags','lodash','util','api','bluebird','request-promise','path','../../config/environment','./tag.attributes','Tag'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xce1e,0x97));var _0xece1=function(_0x59d024,_0x579b1f){_0x59d024=_0x59d024-0x0;var _0x1f6149=_0xce1e[_0x59d024];return _0x1f6149;};'use strict';var _=require(_0xece1('0x0'));var util=require(_0xece1('0x1'));var logger=require('../../config/logger')(_0xece1('0x2'));var moment=require('moment');var BPromise=require(_0xece1('0x3'));var rp=require(_0xece1('0x4'));var fs=require('fs');var path=require(_0xece1('0x5'));var rimraf=require('rimraf');var config=require(_0xece1('0x6'));var attributes=require(_0xece1('0x7'));module['exports']=function(_0x5f1a12,_0x53a3c1){return _0x5f1a12['define'](_0xece1('0x8'),attributes,{'tableName':_0xece1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb071=['path','rimraf','./tag.attributes','exports','Tag','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2f2f66,_0x36c616){var _0x43f3da=function(_0x57a85a){while(--_0x57a85a){_0x2f2f66['push'](_0x2f2f66['shift']());}};_0x43f3da(++_0x36c616);}(_0xb071,0x1da));var _0x1b07=function(_0x293de7,_0x5e3188){_0x293de7=_0x293de7-0x0;var _0x4d29de=_0xb071[_0x293de7];return _0x4d29de;};'use strict';var _=require(_0x1b07('0x0'));var util=require(_0x1b07('0x1'));var logger=require(_0x1b07('0x2'))(_0x1b07('0x3'));var moment=require(_0x1b07('0x4'));var BPromise=require(_0x1b07('0x5'));var rp=require(_0x1b07('0x6'));var fs=require('fs');var path=require(_0x1b07('0x7'));var rimraf=require(_0x1b07('0x8'));var config=require('../../config/environment');var attributes=require(_0x1b07('0x9'));module[_0x1b07('0xa')]=function(_0x3e5275,_0x5a4fec){return _0x3e5275['define'](_0x1b07('0xb'),attributes,{'tableName':_0x1b07('0xc'),'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 1d43ff1..ed5a750 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 _0x0f9f=['message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Tag,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x1b2b63,_0x52b35f){var _0x3e59e5=function(_0x50f119){while(--_0x50f119){_0x1b2b63['push'](_0x1b2b63['shift']());}};_0x3e59e5(++_0x52b35f);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0x30a006,_0x143f3a){_0x30a006=_0x30a006-0x0;var _0x393403=_0x0f9f[_0x30a006];return _0x393403;};'use strict';var _=require('lodash');var util=require(_0xf0f9('0x0'));var moment=require(_0xf0f9('0x1'));var BPromise=require(_0xf0f9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0f9('0x3'));var db=require(_0xf0f9('0x4'))['db'];var utils=require(_0xf0f9('0x5'));var logger=require(_0xf0f9('0x6'))(_0xf0f9('0x7'));var config=require(_0xf0f9('0x8'));var jayson=require(_0xf0f9('0x9'));var client=jayson[_0xf0f9('0xa')][_0xf0f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45694e,_0x51a0ed,_0x448cf5){return new BPromise(function(_0x294b42,_0x5d1753){return client[_0xf0f9('0xc')](_0x45694e,_0x448cf5)[_0xf0f9('0xd')](function(_0x2d72c9){logger['info'](_0xf0f9('0xe'),_0x51a0ed,_0xf0f9('0xf'));logger[_0xf0f9('0x10')]('Tag,\x20%s,\x20%s,\x20%s',_0x51a0ed,'request\x20sent',JSON[_0xf0f9('0x11')](_0x2d72c9));if(_0x2d72c9[_0xf0f9('0x12')]){if(_0x2d72c9[_0xf0f9('0x12')][_0xf0f9('0x13')]===0x1f4){logger[_0xf0f9('0x12')](_0xf0f9('0xe'),_0x51a0ed,_0x2d72c9[_0xf0f9('0x12')]['message']);return _0x5d1753(_0x2d72c9[_0xf0f9('0x12')][_0xf0f9('0x14')]);}logger[_0xf0f9('0x12')](_0xf0f9('0xe'),_0x51a0ed,_0x2d72c9[_0xf0f9('0x12')]['message']);return _0x294b42(_0x2d72c9[_0xf0f9('0x12')][_0xf0f9('0x14')]);}else{logger[_0xf0f9('0x15')](_0xf0f9('0xe'),_0x51a0ed,_0xf0f9('0xf'));_0x294b42(_0x2d72c9[_0xf0f9('0x16')][_0xf0f9('0x14')]);}})[_0xf0f9('0x17')](function(_0x677b32){logger[_0xf0f9('0x12')]('Tag,\x20%s,\x20%s',_0x51a0ed,_0x677b32);_0x5d1753(_0x677b32);});});} \ No newline at end of file +var _0x4f17=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then','info','request\x20sent','debug','stringify','error','code','Tag,\x20%s,\x20%s','message','result','catch','lodash','moment'];(function(_0x23f7c9,_0x1cefbe){var _0x196df6=function(_0x335598){while(--_0x335598){_0x23f7c9['push'](_0x23f7c9['shift']());}};_0x196df6(++_0x1cefbe);}(_0x4f17,0x9e));var _0x74f1=function(_0x4b4865,_0xb43449){_0x4b4865=_0x4b4865-0x0;var _0x190dc2=_0x4f17[_0x4b4865];return _0x190dc2;};'use strict';var _=require(_0x74f1('0x0'));var util=require('util');var moment=require(_0x74f1('0x1'));var BPromise=require(_0x74f1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x74f1('0x3'));var db=require(_0x74f1('0x4'))['db'];var utils=require(_0x74f1('0x5'));var logger=require(_0x74f1('0x6'))(_0x74f1('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x74f1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe54c30,_0x51effb,_0x34ec03){return new BPromise(function(_0x339d55,_0x3b4914){return client['request'](_0xe54c30,_0x34ec03)[_0x74f1('0x9')](function(_0x4c4e41){logger[_0x74f1('0xa')]('Tag,\x20%s,\x20%s',_0x51effb,_0x74f1('0xb'));logger[_0x74f1('0xc')]('Tag,\x20%s,\x20%s,\x20%s',_0x51effb,'request\x20sent',JSON[_0x74f1('0xd')](_0x4c4e41));if(_0x4c4e41[_0x74f1('0xe')]){if(_0x4c4e41[_0x74f1('0xe')][_0x74f1('0xf')]===0x1f4){logger[_0x74f1('0xe')](_0x74f1('0x10'),_0x51effb,_0x4c4e41[_0x74f1('0xe')][_0x74f1('0x11')]);return _0x3b4914(_0x4c4e41[_0x74f1('0xe')][_0x74f1('0x11')]);}logger['error'](_0x74f1('0x10'),_0x51effb,_0x4c4e41['error'][_0x74f1('0x11')]);return _0x339d55(_0x4c4e41['error'][_0x74f1('0x11')]);}else{logger[_0x74f1('0xa')](_0x74f1('0x10'),_0x51effb,_0x74f1('0xb'));_0x339d55(_0x4c4e41[_0x74f1('0x12')]['message']);}})[_0x74f1('0x13')](function(_0x10a0b1){logger['error'](_0x74f1('0x10'),_0x51effb,_0x10a0b1);_0x3b4914(_0x10a0b1);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 19f824a..ab9d0f8 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 24e3daf..02362c7 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 _0x2032=['name','exports','STRING'];(function(_0x2b9148,_0x48a4a6){var _0xfcaeae=function(_0x16abc4){while(--_0x16abc4){_0x2b9148['push'](_0x2b9148['shift']());}};_0xfcaeae(++_0x48a4a6);}(_0x2032,0xd9));var _0x2203=function(_0x4a0500,_0xeb95fe){_0x4a0500=_0x4a0500-0x0;var _0x2a7b9a=_0x2032[_0x4a0500];return _0x2a7b9a;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x358b6b,_0x120a51){var _0x2237f4=function(_0x17184b){while(--_0x17184b){_0x358b6b['push'](_0x358b6b['shift']());}};_0x2237f4(++_0x120a51);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 9fe8db6..9407ef4 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 _0xa141=['where','merge','type','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','Sequelize','QueryTypes','SELECT','UserId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','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','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','Teams','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','pick','Queues','add','ids','removeQueues','remove','addAgents','Chat','Mail','Sms','Openchannel','Whatsapp','transaction','through','penalty','QueueId','Voice','TeamVoiceQueue','emit','User','online','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','spread','removeAgents','isArray','Queue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./team.socket','register','sendStatus','end','status','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','Team','rawAttributes','fieldName','key','map','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','filter'];(function(_0x3fa78c,_0x18b0f2){var _0x4cbcc9=function(_0x5163b6){while(--_0x5163b6){_0x3fa78c['push'](_0x3fa78c['shift']());}};_0x4cbcc9(++_0x18b0f2);}(_0xa141,0xfc));var _0x1a14=function(_0x1637df,_0x20b9f9){_0x1637df=_0x1637df-0x0;var _0x2dd4ae=_0xa141[_0x1637df];return _0x2dd4ae;};'use strict';var emlformat=require(_0x1a14('0x0'));var rimraf=require(_0x1a14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1a14('0x2'));var rp=require(_0x1a14('0x3'));var moment=require(_0x1a14('0x4'));var BPromise=require(_0x1a14('0x5'));var Mustache=require(_0x1a14('0x6'));var util=require(_0x1a14('0x7'));var path=require(_0x1a14('0x8'));var sox=require(_0x1a14('0x9'));var csv=require(_0x1a14('0xa'));var ejs=require(_0x1a14('0xb'));var fs=require('fs');var fs_extra=require(_0x1a14('0xc'));var _=require(_0x1a14('0xd'));var squel=require(_0x1a14('0xe'));var crypto=require(_0x1a14('0xf'));var jsforce=require(_0x1a14('0x10'));var deskjs=require(_0x1a14('0x11'));var toCsv=require(_0x1a14('0xa'));var querystring=require(_0x1a14('0x12'));var Papa=require(_0x1a14('0x13'));var Redis=require(_0x1a14('0x14'));var authService=require(_0x1a14('0x15'));var qs=require(_0x1a14('0x16'));var as=require(_0x1a14('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1a14('0x18'))(_0x1a14('0x19'));var utils=require(_0x1a14('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1a14('0x1b'))['db'];config[_0x1a14('0x1c')]=_[_0x1a14('0x1d')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1a14('0x1e'))(new Redis(config[_0x1a14('0x1c')]));require(_0x1a14('0x1f'))[_0x1a14('0x20')](socket);function respondWithStatusCode(_0x15196c,_0x1bda11){_0x1bda11=_0x1bda11||0xcc;return function(_0xba448f){if(_0xba448f){return _0x15196c[_0x1a14('0x21')](_0x1bda11);}return _0x15196c['status'](_0x1bda11)[_0x1a14('0x22')]();};}function respondWithResult(_0x1127ce,_0x4214b6){_0x4214b6=_0x4214b6||0xc8;return function(_0x2234c1){if(_0x2234c1){return _0x1127ce[_0x1a14('0x23')](_0x4214b6)[_0x1a14('0x24')](_0x2234c1);}};}function respondWithFilteredResult(_0x5a8322,_0x51cff5){return function(_0x4c530e){if(_0x4c530e){var _0x333aac=typeof _0x51cff5['offset']===_0x1a14('0x25')&&typeof _0x51cff5['limit']===_0x1a14('0x25');var _0x39e97=_0x4c530e['count'];var _0x41a4fa=_0x333aac?0x0:_0x51cff5[_0x1a14('0x26')];var _0x18edf8=_0x333aac?_0x4c530e[_0x1a14('0x27')]:_0x51cff5[_0x1a14('0x26')]+_0x51cff5[_0x1a14('0x28')];var _0x5e63f6;if(_0x18edf8>=_0x39e97){_0x18edf8=_0x39e97;_0x5e63f6=0xc8;}else{_0x5e63f6=0xce;}_0x5a8322[_0x1a14('0x23')](_0x5e63f6);return _0x5a8322[_0x1a14('0x29')](_0x1a14('0x2a'),_0x41a4fa+'-'+_0x18edf8+'/'+_0x39e97)['json'](_0x4c530e);}return null;};}function patchUpdates(_0x522eba){return function(_0x1855cf){try{jsonpatch[_0x1a14('0x2b')](_0x1855cf,_0x522eba,!![]);}catch(_0x36eeb5){return BPromise[_0x1a14('0x2c')](_0x36eeb5);}return _0x1855cf[_0x1a14('0x2d')]();};}function saveUpdates(_0xccf6fb,_0x33206e){return function(_0x5e1af0){if(_0x5e1af0){return _0x5e1af0[_0x1a14('0x2e')](_0xccf6fb)[_0x1a14('0x2f')](function(_0x46c6db){return _0x46c6db;});}return null;};}function handleEntityNotFound(_0x4a86ba,_0x1e80df){return function(_0x41aaac){if(!_0x41aaac){_0x4a86ba[_0x1a14('0x21')](0x194);}return _0x41aaac;};}function handleError(_0x5198b3,_0x5dca82){_0x5dca82=_0x5dca82||0x1f4;return function(_0x1a4be1){logger[_0x1a14('0x30')](_0x1a4be1[_0x1a14('0x31')]);if(_0x1a4be1['name']){delete _0x1a4be1[_0x1a14('0x32')];}_0x5198b3[_0x1a14('0x23')](_0x5dca82)[_0x1a14('0x33')](_0x1a4be1);};}exports[_0x1a14('0x34')]=function(_0x44cde9,_0x41b5f7){var _0x224a47={},_0x2ed67e={},_0xc3ca94={'count':0x0,'rows':[]};var _0x48390c=_['map'](db[_0x1a14('0x35')][_0x1a14('0x36')],function(_0x1ec461){return{'name':_0x1ec461[_0x1a14('0x37')],'type':_0x1ec461['type'][_0x1a14('0x38')]};});_0x2ed67e['model']=_[_0x1a14('0x39')](_0x48390c,_0x1a14('0x32'));_0x2ed67e['query']=_[_0x1a14('0x3a')](_0x44cde9[_0x1a14('0x3b')]);_0x2ed67e[_0x1a14('0x3c')]=_[_0x1a14('0x3d')](_0x2ed67e[_0x1a14('0x3e')],_0x2ed67e['query']);_0x224a47[_0x1a14('0x3f')]=_['intersection'](_0x2ed67e['model'],qs['fields'](_0x44cde9[_0x1a14('0x3b')][_0x1a14('0x40')]));_0x224a47[_0x1a14('0x3f')]=_0x224a47[_0x1a14('0x3f')][_0x1a14('0x41')]?_0x224a47[_0x1a14('0x3f')]:_0x2ed67e[_0x1a14('0x3e')];if(!_0x44cde9[_0x1a14('0x3b')]['hasOwnProperty'](_0x1a14('0x42'))){_0x224a47[_0x1a14('0x28')]=qs[_0x1a14('0x28')](_0x44cde9[_0x1a14('0x3b')][_0x1a14('0x28')]);_0x224a47[_0x1a14('0x26')]=qs[_0x1a14('0x26')](_0x44cde9[_0x1a14('0x3b')]['offset']);}_0x224a47[_0x1a14('0x43')]=qs[_0x1a14('0x44')](_0x44cde9[_0x1a14('0x3b')][_0x1a14('0x44')]);_0x224a47['where']=qs[_0x1a14('0x3c')](_['pick'](_0x44cde9[_0x1a14('0x3b')],_0x2ed67e[_0x1a14('0x3c')]),_0x48390c);if(_0x44cde9[_0x1a14('0x3b')][_0x1a14('0x45')]){_0x224a47[_0x1a14('0x46')]=_[_0x1a14('0x47')](_0x224a47[_0x1a14('0x46')],{'$or':_[_0x1a14('0x39')](_0x48390c,function(_0x34ba0e){if(_0x34ba0e[_0x1a14('0x48')]!==_0x1a14('0x49')){var _0x59a876={};_0x59a876[_0x34ba0e[_0x1a14('0x32')]]={'$like':'%'+_0x44cde9['query'][_0x1a14('0x45')]+'%'};return _0x59a876;}})});}_0x224a47=_['merge']({},_0x224a47,_0x44cde9['options']);var _0x40a18d={'where':_0x224a47['where']};return db[_0x1a14('0x35')][_0x1a14('0x27')](_0x40a18d)[_0x1a14('0x2f')](function(_0x4eebb5){_0xc3ca94[_0x1a14('0x27')]=_0x4eebb5;if(_0x44cde9[_0x1a14('0x3b')]['includeAll']){_0x224a47[_0x1a14('0x4a')]=[{'all':!![]}];}return db[_0x1a14('0x35')][_0x1a14('0x4b')](_0x224a47);})[_0x1a14('0x2f')](function(_0x30f227){_0xc3ca94[_0x1a14('0x4c')]=_0x30f227;return _0xc3ca94;})[_0x1a14('0x2f')](respondWithFilteredResult(_0x41b5f7,_0x224a47))[_0x1a14('0x4d')](handleError(_0x41b5f7,null));};exports[_0x1a14('0x4e')]=function(_0x136ab6,_0x3c92b7){var _0x3144a6={'raw':![],'where':{'id':_0x136ab6[_0x1a14('0x4f')]['id']}},_0x26a42f={};_0x26a42f[_0x1a14('0x3e')]=_[_0x1a14('0x3a')](db['Team']['rawAttributes']);_0x26a42f[_0x1a14('0x3b')]=_[_0x1a14('0x3a')](_0x136ab6[_0x1a14('0x3b')]);_0x26a42f[_0x1a14('0x3c')]=_[_0x1a14('0x3d')](_0x26a42f[_0x1a14('0x3e')],_0x26a42f[_0x1a14('0x3b')]);_0x3144a6['attributes']=_[_0x1a14('0x3d')](_0x26a42f['model'],qs[_0x1a14('0x40')](_0x136ab6['query'][_0x1a14('0x40')]));_0x3144a6[_0x1a14('0x3f')]=_0x3144a6[_0x1a14('0x3f')][_0x1a14('0x41')]?_0x3144a6['attributes']:_0x26a42f[_0x1a14('0x3e')];if(_0x136ab6[_0x1a14('0x3b')][_0x1a14('0x50')]){_0x3144a6[_0x1a14('0x4a')]=[{'all':!![]}];}_0x3144a6=_[_0x1a14('0x47')]({},_0x3144a6,_0x136ab6[_0x1a14('0x51')]);return db[_0x1a14('0x35')][_0x1a14('0x52')](_0x3144a6)[_0x1a14('0x2f')](handleEntityNotFound(_0x3c92b7,null))[_0x1a14('0x2f')](respondWithResult(_0x3c92b7,null))[_0x1a14('0x4d')](handleError(_0x3c92b7,null));};exports[_0x1a14('0x53')]=function(_0x5c671d,_0x2e1fd8){return db['Team'][_0x1a14('0x53')](_0x5c671d[_0x1a14('0x54')],{})[_0x1a14('0x2f')](function(_0x5a0f63){var _0x3d013d=_0x5c671d[_0x1a14('0x55')][_0x1a14('0x56')]({'plain':!![]});if(!_0x3d013d)throw new Error(_0x1a14('0x57'));if(_0x3d013d[_0x1a14('0x58')]===_0x1a14('0x55')){var _0x56d41d=_0x5a0f63['get']({'plain':!![]});var _0x3ab086='Teams';return db['UserProfileSection'][_0x1a14('0x52')]({'where':{'name':_0x3ab086,'userProfileId':_0x3d013d[_0x1a14('0x59')]},'raw':!![]})[_0x1a14('0x2f')](function(_0xae961d){if(_0xae961d&&_0xae961d[_0x1a14('0x5a')]===0x0){return db[_0x1a14('0x5b')][_0x1a14('0x53')]({'name':_0x56d41d[_0x1a14('0x32')],'resourceId':_0x56d41d['id'],'type':_0xae961d[_0x1a14('0x32')],'sectionId':_0xae961d['id']},{})[_0x1a14('0x2f')](function(){return _0x5a0f63;});}else{return _0x5a0f63;}})[_0x1a14('0x4d')](function(_0x5ecfc2){logger[_0x1a14('0x30')](_0x1a14('0x5c'),_0x5ecfc2);throw _0x5ecfc2;});}return _0x5a0f63;})[_0x1a14('0x2f')](respondWithResult(_0x2e1fd8,0xc9))[_0x1a14('0x4d')](handleError(_0x2e1fd8,null));};exports[_0x1a14('0x2e')]=function(_0x189ec2,_0x3880e7){if(_0x189ec2[_0x1a14('0x54')]['id']){delete _0x189ec2[_0x1a14('0x54')]['id'];}return db[_0x1a14('0x35')][_0x1a14('0x52')]({'where':{'id':_0x189ec2[_0x1a14('0x4f')]['id']}})[_0x1a14('0x2f')](handleEntityNotFound(_0x3880e7,null))[_0x1a14('0x2f')](saveUpdates(_0x189ec2[_0x1a14('0x54')],null))[_0x1a14('0x2f')](respondWithResult(_0x3880e7,null))[_0x1a14('0x4d')](handleError(_0x3880e7,null));};exports[_0x1a14('0x5d')]=function(_0x1b25ce,_0x56544e){var _0x531abc=_0x1b25ce['params']['id'];var _0x4c9ac8=[];return db['sequelize']['transaction'](function(_0x3edabb){var _0x55952f='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x531abc;return db[_0x1a14('0x5e')]['query'](_0x55952f,{'type':db[_0x1a14('0x5f')][_0x1a14('0x60')][_0x1a14('0x61')],'raw':!![],'transaction':_0x3edabb})['then'](function(_0x2fbfee){_0x4c9ac8=_[_0x1a14('0x39')](_0x2fbfee,function(_0x35bd5a){return Number(_0x35bd5a[_0x1a14('0x62')]);});})[_0x1a14('0x2f')](function(){var _0xd54342='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x531abc;return db[_0x1a14('0x5e')][_0x1a14('0x3b')](_0xd54342,{'type':db[_0x1a14('0x5f')][_0x1a14('0x60')][_0x1a14('0x61')],'raw':!![],'transaction':_0x3edabb});})['then'](function(_0x4bc2a8){var _0x38bcff=_[_0x1a14('0x39')](_0x4bc2a8,function(_0x204b95){return Number(_0x204b95['VoiceQueueId']);});return db[_0x1a14('0x63')]['destroy']({'where':{'UserId':{'$in':_0x4c9ac8},'VoiceQueueId':{'$in':_0x38bcff}},'transaction':_0x3edabb});})[_0x1a14('0x2f')](function(){var _0xfad1f8=_0x1a14('0x64')+_0x531abc;return db['sequelize'][_0x1a14('0x3b')](_0xfad1f8,{'type':db[_0x1a14('0x5f')][_0x1a14('0x60')][_0x1a14('0x61')],'raw':!![],'transaction':_0x3edabb});})[_0x1a14('0x2f')](function(_0x43f01f){var _0x142773=_['map'](_0x43f01f,function(_0x35ce05){return Number(_0x35ce05[_0x1a14('0x65')]);});return db[_0x1a14('0x66')][_0x1a14('0x5d')]({'where':{'UserId':{'$in':_0x4c9ac8},'MailQueueId':{'$in':_0x142773}},'transaction':_0x3edabb});})['then'](function(){var _0x62e232=_0x1a14('0x67')+_0x531abc;return db['sequelize']['query'](_0x62e232,{'type':db[_0x1a14('0x5f')]['QueryTypes'][_0x1a14('0x61')],'raw':!![],'transaction':_0x3edabb});})[_0x1a14('0x2f')](function(_0x76326a){var _0xdc0590=_['map'](_0x76326a,function(_0xe14541){return Number(_0xe14541[_0x1a14('0x68')]);});return db[_0x1a14('0x69')][_0x1a14('0x5d')]({'where':{'UserId':{'$in':_0x4c9ac8},'SmsQueueId':{'$in':_0xdc0590}},'transaction':_0x3edabb});})[_0x1a14('0x2f')](function(){var _0x496789=_0x1a14('0x6a')+_0x531abc;return db[_0x1a14('0x5e')]['query'](_0x496789,{'type':db[_0x1a14('0x5f')]['QueryTypes'][_0x1a14('0x61')],'raw':!![],'transaction':_0x3edabb});})['then'](function(_0x5876a2){var _0x23c4a8=_['map'](_0x5876a2,function(_0x184d24){return Number(_0x184d24[_0x1a14('0x6b')]);});return db['UserChatQueue'][_0x1a14('0x5d')]({'where':{'UserId':{'$in':_0x4c9ac8},'ChatQueueId':{'$in':_0x23c4a8}},'transaction':_0x3edabb});})[_0x1a14('0x2f')](function(){var _0x15e761='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x531abc;return db[_0x1a14('0x5e')]['query'](_0x15e761,{'type':db['Sequelize'][_0x1a14('0x60')][_0x1a14('0x61')],'raw':!![],'transaction':_0x3edabb});})[_0x1a14('0x2f')](function(_0x3adbde){var _0x1a3148=_[_0x1a14('0x39')](_0x3adbde,function(_0x3a5c59){return Number(_0x3a5c59[_0x1a14('0x6c')]);});return db[_0x1a14('0x6d')][_0x1a14('0x5d')]({'where':{'UserId':{'$in':_0x4c9ac8},'FaxQueueId':{'$in':_0x1a3148}},'transaction':_0x3edabb});})[_0x1a14('0x2f')](function(){var _0x21c266=_0x1a14('0x6e')+_0x531abc;return db[_0x1a14('0x5e')][_0x1a14('0x3b')](_0x21c266,{'type':db[_0x1a14('0x5f')][_0x1a14('0x60')]['SELECT'],'raw':!![],'transaction':_0x3edabb});})[_0x1a14('0x2f')](function(_0x20914b){var _0x2936e6=_[_0x1a14('0x39')](_0x20914b,function(_0x270068){return Number(_0x270068[_0x1a14('0x6f')]);});return db[_0x1a14('0x70')][_0x1a14('0x5d')]({'where':{'UserId':{'$in':_0x4c9ac8},'OpenchannelQueueId':{'$in':_0x2936e6}},'transaction':_0x3edabb});})[_0x1a14('0x2f')](function(){var _0x43189=_0x1a14('0x71')+_0x531abc;return db[_0x1a14('0x5e')]['query'](_0x43189,{'type':db[_0x1a14('0x5f')][_0x1a14('0x60')][_0x1a14('0x61')],'raw':!![],'transaction':_0x3edabb});})[_0x1a14('0x2f')](function(_0x2607ca){var _0x27a669=_['map'](_0x2607ca,function(_0x69193c){return Number(_0x69193c[_0x1a14('0x72')]);});return db['UserWhatsappQueue'][_0x1a14('0x5d')]({'where':{'UserId':{'$in':_0x4c9ac8},'WhatsappQueueId':{'$in':_0x27a669}},'transaction':_0x3edabb});})[_0x1a14('0x2f')](function(){return db[_0x1a14('0x73')][_0x1a14('0x52')]({'where':{'TeamId':_0x531abc}});})[_0x1a14('0x2f')](function(_0x2408c2){if(_0x2408c2===null){return;}return db[_0x1a14('0x74')][_0x1a14('0x5d')]({'where':{'UserId':{'$in':_0x4c9ac8},'VoicePrefixId':_0x2408c2[_0x1a14('0x75')]},'transaction':_0x3edabb});})[_0x1a14('0x2f')](function(){return db[_0x1a14('0x35')][_0x1a14('0x5d')]({'where':{'id':_0x531abc},'cascade':!![],'transaction':_0x3edabb});})[_0x1a14('0x2f')](function(_0x4287f5){if(_0x4287f5===0x0){_0x56544e[_0x1a14('0x21')](0x194);}else{return db[_0x1a14('0x5b')][_0x1a14('0x5d')]({'where':{'type':_0x1a14('0x76'),'resourceId':_0x531abc},'cascade':!![],'transaction':_0x3edabb})[_0x1a14('0x2f')](function(){_0x56544e[_0x1a14('0x23')](0xcc)[_0x1a14('0x22')]();});}})[_0x1a14('0x4d')](function(_0x4abc69){_0x56544e['status'](0x1f4)['send'](_0x4abc69);});});};exports[_0x1a14('0x77')]=function(_0x4bd83f,_0x2fba13,_0x54d97b){return db[_0x1a14('0x35')][_0x1a14('0x78')]({'where':{'id':_0x4bd83f[_0x1a14('0x4f')]['id']}})[_0x1a14('0x2f')](handleEntityNotFound(_0x2fba13,null))[_0x1a14('0x2f')](function(_0x312436){if(!_0x4bd83f[_0x1a14('0x3b')][_0x1a14('0x79')]||!utils[_0x1a14('0x7a')](_0x4bd83f[_0x1a14('0x3b')][_0x1a14('0x79')])){throw new db[(_0x1a14('0x5f'))][(_0x1a14('0x7b'))](_0x1a14('0x7c'));}var _0x257160={};var _0x11ca43={};_0x11ca43[_0x1a14('0x3e')]=_['keys'](db[_[_0x1a14('0x7d')](_0x4bd83f[_0x1a14('0x3b')][_0x1a14('0x79')][_0x1a14('0x7e')]())+_0x1a14('0x7f')][_0x1a14('0x36')]);_0x11ca43[_0x1a14('0x3b')]=_[_0x1a14('0x3a')](_0x4bd83f[_0x1a14('0x3b')]);_0x11ca43['filters']=_[_0x1a14('0x3d')](_0x11ca43[_0x1a14('0x3e')],_0x11ca43['query']);_0x257160[_0x1a14('0x3f')]=_[_0x1a14('0x3d')](_0x11ca43[_0x1a14('0x3e')],qs[_0x1a14('0x40')](_0x4bd83f['query'][_0x1a14('0x40')]));_0x257160[_0x1a14('0x3f')]=_0x257160[_0x1a14('0x3f')]['length']?_0x257160[_0x1a14('0x3f')]:_0x11ca43[_0x1a14('0x3e')];_0x257160['limit']=qs[_0x1a14('0x28')](_0x4bd83f[_0x1a14('0x3b')][_0x1a14('0x28')]);_0x257160['offset']=qs['offset'](_0x4bd83f[_0x1a14('0x3b')][_0x1a14('0x26')]);_0x257160[_0x1a14('0x43')]=qs[_0x1a14('0x44')](_0x4bd83f[_0x1a14('0x3b')]['sort']);_0x257160[_0x1a14('0x46')]=qs[_0x1a14('0x3c')](_[_0x1a14('0x80')](_0x4bd83f['query'],_0x11ca43['filters']));_0x257160=_[_0x1a14('0x47')]({},_0x257160,_0x4bd83f[_0x1a14('0x51')]);return _0x312436['get'+_[_0x1a14('0x7d')](_0x4bd83f[_0x1a14('0x3b')]['channel'][_0x1a14('0x7e')]())+_0x1a14('0x81')](_0x257160);})[_0x1a14('0x2f')](respondWithResult(_0x2fba13,null))[_0x1a14('0x4d')](handleError(_0x2fba13,null));};exports['addQueues']=function(_0x52cf6e,_0x3c19eb,_0x4bb095){return db['Team'][_0x1a14('0x78')]({'where':{'id':_0x52cf6e[_0x1a14('0x4f')]['id']}})[_0x1a14('0x2f')](function(_0x56ef2c){if(_0x56ef2c){if(!_0x52cf6e[_0x1a14('0x54')]['channel']||!utils[_0x1a14('0x7a')](_0x52cf6e[_0x1a14('0x54')][_0x1a14('0x79')])){throw new db[(_0x1a14('0x5f'))][(_0x1a14('0x7b'))](_0x1a14('0x7c'));}return _0x56ef2c[_0x1a14('0x82')+_[_0x1a14('0x7d')](_0x52cf6e['body']['channel']['toLowerCase']())+_0x1a14('0x81')](_0x52cf6e['body'][_0x1a14('0x83')]);}return null;})['then'](handleEntityNotFound(_0x3c19eb,null))[_0x1a14('0x2f')](respondWithStatusCode(_0x3c19eb,null))[_0x1a14('0x4d')](handleError(_0x3c19eb,null));};exports[_0x1a14('0x84')]=function(_0x4933fe,_0x12b12b,_0x5f3e60){return db[_0x1a14('0x35')][_0x1a14('0x78')]({'where':{'id':_0x4933fe[_0x1a14('0x4f')]['id']}})[_0x1a14('0x2f')](function(_0x528aa9){if(_0x528aa9){if(!_0x4933fe[_0x1a14('0x3b')][_0x1a14('0x79')]||!utils['isValidChannel'](_0x4933fe[_0x1a14('0x3b')][_0x1a14('0x79')])){throw new db['Sequelize']['ValidationError'](_0x1a14('0x7c'));}return _0x528aa9[_0x1a14('0x85')+_[_0x1a14('0x7d')](_0x4933fe['query']['channel'][_0x1a14('0x7e')]())+_0x1a14('0x81')](_0x4933fe['query'][_0x1a14('0x83')]);}return null;})[_0x1a14('0x2f')](handleEntityNotFound(_0x12b12b,null))[_0x1a14('0x2f')](respondWithStatusCode(_0x12b12b,null))['catch'](handleError(_0x12b12b,null));};exports[_0x1a14('0x86')]=function(_0x1dc825,_0xc3cf79){var _0xa6cc90=_['isArray'](_0x1dc825[_0x1a14('0x54')]['ids'])?_0x1dc825['body'][_0x1a14('0x83')]:[_0x1dc825['body']['ids']];var _0x4ebc33=_0x1dc825[_0x1a14('0x4f')]['id'];return db[_0x1a14('0x35')][_0x1a14('0x52')]({'where':{'id':_0x4ebc33}})[_0x1a14('0x2f')](handleEntityNotFound(_0xc3cf79,null))[_0x1a14('0x2f')](function(_0x21aa7d){if(_0x21aa7d){var _0x9498f1=['Voice',_0x1a14('0x87'),_0x1a14('0x88'),_0x1a14('0x89'),'Fax',_0x1a14('0x8a'),_0x1a14('0x8b')];return db[_0x1a14('0x5e')][_0x1a14('0x8c')](function(_0x5a38a0){var _0x48f288=_[_0x1a14('0x39')](_0x9498f1,function(_0x4f16ed){var _0xc0df3c={'attributes':['id','name']};if(_0x4f16ed==='Voice'){_0xc0df3c[_0x1a14('0x8d')]={'attributes':[_0x1a14('0x8e')]};}return _0x21aa7d[_0x1a14('0x56')+_0x4f16ed+'Queues'](_0xc0df3c)[_0x1a14('0x2f')](function(_0x2431de){var _0x372cb7=_[_0x1a14('0x39')](_0x2431de,function(_0x168645){var _0x406558=_['map'](_0xa6cc90,function(_0x3df0ec){var _0x16aa40={'where':{'UserId':_0x3df0ec,[_0x4f16ed+_0x1a14('0x8f')]:_0x168645['id']},'transaction':_0x5a38a0};if(_0x4f16ed===_0x1a14('0x90')){_0x16aa40[_0x1a14('0x1d')]={'penalty':_0x168645[_0x1a14('0x91')]['penalty']};}return db['User'+_0x4f16ed+'Queue']['findOrCreate'](_0x16aa40)[_0x1a14('0x2f')](function(){socket[_0x1a14('0x92')](_0x1a14('0x55')+_0x4f16ed+'Queue:save',{'UserId':_0x3df0ec,[_0x4f16ed+_0x1a14('0x8f')]:_0x168645['id']});if(_0x4f16ed!==_0x1a14('0x90')){return;}return db[_0x1a14('0x93')][_0x1a14('0x4b')]({'where':{'id':_0xa6cc90,'online':0x1},'attributes':['id','name',_0x1a14('0x94'),'voicePause',_0x1a14('0x95')],'raw':!![]})[_0x1a14('0x2f')](function(_0x38a231){var _0x22de36=_[_0x1a14('0x39')](_0x38a231,function(_0x5e42ea){return db[_0x1a14('0x96')][_0x1a14('0x97')]({'membername':_0x5e42ea[_0x1a14('0x32')],'UserId':_0x5e42ea['id'],'queue_name':_0x168645[_0x1a14('0x32')],'VoiceQueueId':_0x168645['id'],'interface':_[_0x1a14('0x98')](_0x5e42ea['interface'])?util[_0x1a14('0x99')](_0x1a14('0x9a'),_0x5e42ea[_0x1a14('0x32')]):_0x5e42ea['interface'],'paused':_0x5e42ea['voicePause']||![],'penalty':_0x168645['TeamVoiceQueue'][_0x1a14('0x8e')]},{'transaction':_0x5a38a0});});return Promise['all'](_0x22de36);});});});return Promise[_0x1a14('0x9b')](_0x406558);});return Promise[_0x1a14('0x9b')](_0x372cb7);})['then'](function(){return db[_0x1a14('0x73')][_0x1a14('0x78')]({'where':{'teamId':_0x4ebc33}})[_0x1a14('0x2f')](function(_0x245f18){if(_0x245f18){var _0x107886=_['map'](_0xa6cc90,function(_0x2a9ec2){db[_0x1a14('0x74')]['upsert']({'UserId':_0x2a9ec2,'VoicePrefixId':_0x245f18[_0x1a14('0x75')]});});return Promise[_0x1a14('0x9b')](_0x107886);}});});});return Promise[_0x1a14('0x9b')](_0x48f288)[_0x1a14('0x2f')](function(){return _0x21aa7d[_0x1a14('0x86')](_0xa6cc90,{'transaction':_0x5a38a0})[_0x1a14('0x9c')](function(_0x391aec){return _0x391aec;});});});}})[_0x1a14('0x2f')](respondWithResult(_0xc3cf79,null))[_0x1a14('0x4d')](handleError(_0xc3cf79,null));};exports[_0x1a14('0x9d')]=function(_0x5e37bd,_0x4c9290){var _0x47c00a=_[_0x1a14('0x9e')](_0x5e37bd[_0x1a14('0x3b')]['ids'])?_0x5e37bd['query'][_0x1a14('0x83')]:[_0x5e37bd[_0x1a14('0x3b')][_0x1a14('0x83')]];var _0x49ca13=_0x5e37bd[_0x1a14('0x4f')]['id'];return db['Team'][_0x1a14('0x52')]({'where':{'id':_0x49ca13}})[_0x1a14('0x2f')](handleEntityNotFound(_0x4c9290,null))[_0x1a14('0x2f')](function(_0xf57085){if(_0xf57085){var _0x1f24b8=[_0x1a14('0x90'),'Chat',_0x1a14('0x88'),_0x1a14('0x89'),'Fax',_0x1a14('0x8a'),'Whatsapp'];return db[_0x1a14('0x5e')][_0x1a14('0x8c')](function(_0x20e151){var _0x485273=_['map'](_0x1f24b8,function(_0x526d54){var _0x316d19={'attributes':['id',_0x1a14('0x32')]};return _0xf57085[_0x1a14('0x56')+_0x526d54+_0x1a14('0x81')](_0x316d19)[_0x1a14('0x2f')](function(_0x74943c){var _0x7b0cdc=_['map'](_0x74943c,function(_0x59d005){return _0x59d005['removeAgents'](_0x47c00a,{'transaction':_0x20e151})['then'](function(){var _0x50bbd6=_['map'](_0x47c00a,function(_0x2b57a3){socket[_0x1a14('0x92')](_0x1a14('0x55')+_0x526d54+_0x1a14('0x9f'),{'UserId':Number(_0x2b57a3),[_0x526d54+_0x1a14('0x8f')]:_0x59d005['id']});if(_0x526d54!=='Voice'){return;}return db['UserVoiceQueueRt'][_0x1a14('0x5d')]({'where':{'VoiceQueueId':_0x59d005['id'],'UserId':_0x2b57a3},'transaction':_0x20e151});});return Promise[_0x1a14('0x9b')](_0x50bbd6);});});return Promise['all'](_0x7b0cdc);});});return Promise[_0x1a14('0x9b')](_0x485273)[_0x1a14('0x2f')](function(){return _0xf57085[_0x1a14('0x9d')](_0x47c00a,{'transaction':_0x20e151});})['then'](function(){return db[_0x1a14('0x73')][_0x1a14('0x78')]({'where':{'teamId':_0x49ca13}})[_0x1a14('0x2f')](function(_0x2a9c46){if(_0x2a9c46){var _0x69e732=_['map'](_0x47c00a,function(_0x5d08f3){db[_0x1a14('0x74')][_0x1a14('0x5d')]({'where':{'UserId':_0x5d08f3,'VoicePrefixId':_0x2a9c46[_0x1a14('0x75')]}});});return Promise['all'](_0x69e732);}});});});}})[_0x1a14('0x2f')](respondWithStatusCode(_0x4c9290,null))[_0x1a14('0x4d')](handleError(_0x4c9290,null));};exports[_0x1a14('0xa0')]=function(_0x551380,_0x4d4480,_0x5f3a86){var _0x52b6cc={};var _0xb365d2={};var _0xf3c854;var _0x401be0;return db[_0x1a14('0x35')][_0x1a14('0x78')]({'where':{'id':_0x551380[_0x1a14('0x4f')]['id']}})[_0x1a14('0x2f')](handleEntityNotFound(_0x4d4480,null))[_0x1a14('0x2f')](function(_0x45e12c){if(_0x45e12c){_0xf3c854=_0x45e12c;_0xb365d2['model']=_['keys'](db['User'][_0x1a14('0x36')]);_0xb365d2[_0x1a14('0x3b')]=_[_0x1a14('0x3a')](_0x551380[_0x1a14('0x3b')]);_0xb365d2[_0x1a14('0x3c')]=_[_0x1a14('0x3d')](_0xb365d2[_0x1a14('0x3e')],_0xb365d2[_0x1a14('0x3b')]);_0x52b6cc['attributes']=_[_0x1a14('0x3d')](_0xb365d2[_0x1a14('0x3e')],qs[_0x1a14('0x40')](_0x551380[_0x1a14('0x3b')][_0x1a14('0x40')]));_0x52b6cc['attributes']=_0x52b6cc[_0x1a14('0x3f')]['length']?_0x52b6cc[_0x1a14('0x3f')]:_0xb365d2['model'];_0x52b6cc['order']=qs[_0x1a14('0x44')](_0x551380['query'][_0x1a14('0x44')]);_0x52b6cc['where']=qs['filters'](_['pick'](_0x551380[_0x1a14('0x3b')],_0xb365d2[_0x1a14('0x3c')]));if(_0x551380[_0x1a14('0x3b')]['filter']){_0x52b6cc[_0x1a14('0x46')]=_['merge'](_0x52b6cc[_0x1a14('0x46')],{'$or':_[_0x1a14('0x39')](_0x52b6cc[_0x1a14('0x3f')],function(_0x3517aa){var _0x619759={};_0x619759[_0x3517aa]={'$like':'%'+_0x551380[_0x1a14('0x3b')][_0x1a14('0x45')]+'%'};return _0x619759;})});}_0x52b6cc=_[_0x1a14('0x47')]({},_0x52b6cc,_0x551380['options']);return _0xf3c854[_0x1a14('0xa0')](_0x52b6cc);}})[_0x1a14('0x2f')](function(_0x278f15){if(_0x278f15){_0x401be0=_0x278f15[_0x1a14('0x41')];if(!_0x551380[_0x1a14('0x3b')]['hasOwnProperty'](_0x1a14('0x42'))){_0x52b6cc[_0x1a14('0x28')]=qs[_0x1a14('0x28')](_0x551380[_0x1a14('0x3b')]['limit']);_0x52b6cc[_0x1a14('0x26')]=qs[_0x1a14('0x26')](_0x551380[_0x1a14('0x3b')][_0x1a14('0x26')]);}return _0xf3c854['getAgents'](_0x52b6cc);}})[_0x1a14('0x2f')](function(_0x5014de){if(_0x5014de){return _0x5014de?{'count':_0x401be0,'rows':_0x5014de}:null;}})['then'](respondWithResult(_0x4d4480,null))[_0x1a14('0x4d')](handleError(_0x4d4480,null));}; \ No newline at end of file +var _0x6db9=['apply','save','update','name','send','index','map','Team','rawAttributes','fieldName','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','then','includeAll','findAll','show','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','error','params','destroy','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','Sequelize','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','getQueues','findOne','channel','ValidationError','Queue','capitalize','toLowerCase','Queues','isValidChannel','Unknown\x20channel','add','remove','ids','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','through','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','all','spread','removeAgents','transaction','Queue:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','end','undefined','limit','offset','count','status','set','Content-Range','json'];(function(_0x399814,_0x5066c7){var _0x1e3449=function(_0x2b6e11){while(--_0x2b6e11){_0x399814['push'](_0x399814['shift']());}};_0x1e3449(++_0x5066c7);}(_0x6db9,0x1ac));var _0x96db=function(_0x2203af,_0xe2919){_0x2203af=_0x2203af-0x0;var _0x307157=_0x6db9[_0x2203af];return _0x307157;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x96db('0x0'));var zipdir=require(_0x96db('0x1'));var jsonpatch=require(_0x96db('0x2'));var rp=require(_0x96db('0x3'));var moment=require(_0x96db('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x96db('0x5'));var util=require(_0x96db('0x6'));var path=require(_0x96db('0x7'));var sox=require('sox');var csv=require(_0x96db('0x8'));var ejs=require(_0x96db('0x9'));var fs=require('fs');var fs_extra=require(_0x96db('0xa'));var _=require(_0x96db('0xb'));var squel=require(_0x96db('0xc'));var crypto=require(_0x96db('0xd'));var jsforce=require(_0x96db('0xe'));var deskjs=require(_0x96db('0xf'));var toCsv=require('to-csv');var querystring=require(_0x96db('0x10'));var Papa=require(_0x96db('0x11'));var Redis=require('ioredis');var authService=require(_0x96db('0x12'));var qs=require(_0x96db('0x13'));var as=require(_0x96db('0x14'));var hardwareService=require(_0x96db('0x15'));var logger=require(_0x96db('0x16'))(_0x96db('0x17'));var utils=require(_0x96db('0x18'));var config=require(_0x96db('0x19'));var licenseUtil=require(_0x96db('0x1a'));var db=require(_0x96db('0x1b'))['db'];config[_0x96db('0x1c')]=_['defaults'](config['redis'],{'host':_0x96db('0x1d'),'port':0x18eb});var socket=require(_0x96db('0x1e'))(new Redis(config['redis']));require(_0x96db('0x1f'))[_0x96db('0x20')](socket);function respondWithStatusCode(_0x43964e,_0xf4e292){_0xf4e292=_0xf4e292||0xcc;return function(_0x45fb4b){if(_0x45fb4b){return _0x43964e[_0x96db('0x21')](_0xf4e292);}return _0x43964e['status'](_0xf4e292)[_0x96db('0x22')]();};}function respondWithResult(_0x7294f0,_0x295059){_0x295059=_0x295059||0xc8;return function(_0x320b6e){if(_0x320b6e){return _0x7294f0['status'](_0x295059)['json'](_0x320b6e);}};}function respondWithFilteredResult(_0x62707,_0x3bcfca){return function(_0x43f108){if(_0x43f108){var _0x220cbc=typeof _0x3bcfca['offset']===_0x96db('0x23')&&typeof _0x3bcfca[_0x96db('0x24')]===_0x96db('0x23');var _0x359c2e=_0x43f108['count'];var _0xdae3ff=_0x220cbc?0x0:_0x3bcfca[_0x96db('0x25')];var _0x18f1eb=_0x220cbc?_0x43f108[_0x96db('0x26')]:_0x3bcfca[_0x96db('0x25')]+_0x3bcfca['limit'];var _0x50fb81;if(_0x18f1eb>=_0x359c2e){_0x18f1eb=_0x359c2e;_0x50fb81=0xc8;}else{_0x50fb81=0xce;}_0x62707[_0x96db('0x27')](_0x50fb81);return _0x62707[_0x96db('0x28')](_0x96db('0x29'),_0xdae3ff+'-'+_0x18f1eb+'/'+_0x359c2e)[_0x96db('0x2a')](_0x43f108);}return null;};}function patchUpdates(_0x25c98b){return function(_0x11da8e){try{jsonpatch[_0x96db('0x2b')](_0x11da8e,_0x25c98b,!![]);}catch(_0x381bc2){return BPromise['reject'](_0x381bc2);}return _0x11da8e[_0x96db('0x2c')]();};}function saveUpdates(_0x224562,_0x45a2b5){return function(_0x513aee){if(_0x513aee){return _0x513aee[_0x96db('0x2d')](_0x224562)['then'](function(_0x1fdaa8){return _0x1fdaa8;});}return null;};}function handleEntityNotFound(_0x1ac173,_0x3dce7f){return function(_0x4fbef1){if(!_0x4fbef1){_0x1ac173[_0x96db('0x21')](0x194);}return _0x4fbef1;};}function handleError(_0x12ed4c,_0x703caa){_0x703caa=_0x703caa||0x1f4;return function(_0x5939c9){logger['error'](_0x5939c9['stack']);if(_0x5939c9[_0x96db('0x2e')]){delete _0x5939c9[_0x96db('0x2e')];}_0x12ed4c[_0x96db('0x27')](_0x703caa)[_0x96db('0x2f')](_0x5939c9);};}exports[_0x96db('0x30')]=function(_0x47adbc,_0x354fcf){var _0x5accb2={},_0x436f2b={},_0x2e82a3={'count':0x0,'rows':[]};var _0x3e06c0=_[_0x96db('0x31')](db[_0x96db('0x32')][_0x96db('0x33')],function(_0x1a5b92){return{'name':_0x1a5b92[_0x96db('0x34')],'type':_0x1a5b92['type']['key']};});_0x436f2b['model']=_[_0x96db('0x31')](_0x3e06c0,_0x96db('0x2e'));_0x436f2b[_0x96db('0x35')]=_[_0x96db('0x36')](_0x47adbc[_0x96db('0x35')]);_0x436f2b['filters']=_[_0x96db('0x37')](_0x436f2b[_0x96db('0x38')],_0x436f2b['query']);_0x5accb2[_0x96db('0x39')]=_[_0x96db('0x37')](_0x436f2b[_0x96db('0x38')],qs['fields'](_0x47adbc[_0x96db('0x35')][_0x96db('0x3a')]));_0x5accb2[_0x96db('0x39')]=_0x5accb2['attributes'][_0x96db('0x3b')]?_0x5accb2[_0x96db('0x39')]:_0x436f2b[_0x96db('0x38')];if(!_0x47adbc[_0x96db('0x35')][_0x96db('0x3c')](_0x96db('0x3d'))){_0x5accb2[_0x96db('0x24')]=qs['limit'](_0x47adbc[_0x96db('0x35')][_0x96db('0x24')]);_0x5accb2[_0x96db('0x25')]=qs['offset'](_0x47adbc[_0x96db('0x35')][_0x96db('0x25')]);}_0x5accb2[_0x96db('0x3e')]=qs[_0x96db('0x3f')](_0x47adbc[_0x96db('0x35')][_0x96db('0x3f')]);_0x5accb2[_0x96db('0x40')]=qs[_0x96db('0x41')](_[_0x96db('0x42')](_0x47adbc['query'],_0x436f2b[_0x96db('0x41')]),_0x3e06c0);if(_0x47adbc[_0x96db('0x35')][_0x96db('0x43')]){_0x5accb2[_0x96db('0x40')]=_[_0x96db('0x44')](_0x5accb2['where'],{'$or':_['map'](_0x3e06c0,function(_0x46d530){if(_0x46d530['type']!==_0x96db('0x45')){var _0x3c0a83={};_0x3c0a83[_0x46d530[_0x96db('0x2e')]]={'$like':'%'+_0x47adbc[_0x96db('0x35')][_0x96db('0x43')]+'%'};return _0x3c0a83;}})});}_0x5accb2=_[_0x96db('0x44')]({},_0x5accb2,_0x47adbc[_0x96db('0x46')]);var _0x5a6f4a={'where':_0x5accb2['where']};return db[_0x96db('0x32')]['count'](_0x5a6f4a)[_0x96db('0x47')](function(_0x4f2113){_0x2e82a3[_0x96db('0x26')]=_0x4f2113;if(_0x47adbc[_0x96db('0x35')][_0x96db('0x48')]){_0x5accb2['include']=[{'all':!![]}];}return db[_0x96db('0x32')][_0x96db('0x49')](_0x5accb2);})[_0x96db('0x47')](function(_0x9aa76f){_0x2e82a3['rows']=_0x9aa76f;return _0x2e82a3;})[_0x96db('0x47')](respondWithFilteredResult(_0x354fcf,_0x5accb2))['catch'](handleError(_0x354fcf,null));};exports[_0x96db('0x4a')]=function(_0x51404a,_0x20b03e){var _0x1da62e={'raw':![],'where':{'id':_0x51404a['params']['id']}},_0x978a70={};_0x978a70[_0x96db('0x38')]=_[_0x96db('0x36')](db[_0x96db('0x32')][_0x96db('0x33')]);_0x978a70[_0x96db('0x35')]=_['keys'](_0x51404a[_0x96db('0x35')]);_0x978a70[_0x96db('0x41')]=_['intersection'](_0x978a70[_0x96db('0x38')],_0x978a70[_0x96db('0x35')]);_0x1da62e[_0x96db('0x39')]=_[_0x96db('0x37')](_0x978a70[_0x96db('0x38')],qs[_0x96db('0x3a')](_0x51404a[_0x96db('0x35')][_0x96db('0x3a')]));_0x1da62e['attributes']=_0x1da62e[_0x96db('0x39')]['length']?_0x1da62e[_0x96db('0x39')]:_0x978a70['model'];if(_0x51404a['query'][_0x96db('0x48')]){_0x1da62e[_0x96db('0x4b')]=[{'all':!![]}];}_0x1da62e=_['merge']({},_0x1da62e,_0x51404a['options']);return db[_0x96db('0x32')][_0x96db('0x4c')](_0x1da62e)['then'](handleEntityNotFound(_0x20b03e,null))[_0x96db('0x47')](respondWithResult(_0x20b03e,null))['catch'](handleError(_0x20b03e,null));};exports['create']=function(_0x1b089b,_0x2e1a44){return db['Team'][_0x96db('0x4d')](_0x1b089b[_0x96db('0x4e')],{})[_0x96db('0x47')](function(_0x40d9e0){var _0x57fdcb=_0x1b089b[_0x96db('0x4f')]['get']({'plain':!![]});if(!_0x57fdcb)throw new Error(_0x96db('0x50'));if(_0x57fdcb[_0x96db('0x51')]===_0x96db('0x4f')){var _0x44018c=_0x40d9e0[_0x96db('0x52')]({'plain':!![]});var _0x119a97=_0x96db('0x53');return db[_0x96db('0x54')]['find']({'where':{'name':_0x119a97,'userProfileId':_0x57fdcb[_0x96db('0x55')]},'raw':!![]})['then'](function(_0x132e64){if(_0x132e64&&_0x132e64[_0x96db('0x56')]===0x0){return db[_0x96db('0x57')][_0x96db('0x4d')]({'name':_0x44018c[_0x96db('0x2e')],'resourceId':_0x44018c['id'],'type':_0x132e64[_0x96db('0x2e')],'sectionId':_0x132e64['id']},{})['then'](function(){return _0x40d9e0;});}else{return _0x40d9e0;}})[_0x96db('0x58')](function(_0x98ebcc){logger[_0x96db('0x59')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x98ebcc);throw _0x98ebcc;});}return _0x40d9e0;})[_0x96db('0x47')](respondWithResult(_0x2e1a44,0xc9))[_0x96db('0x58')](handleError(_0x2e1a44,null));};exports[_0x96db('0x2d')]=function(_0x31eae7,_0x14e440){if(_0x31eae7[_0x96db('0x4e')]['id']){delete _0x31eae7[_0x96db('0x4e')]['id'];}return db[_0x96db('0x32')][_0x96db('0x4c')]({'where':{'id':_0x31eae7[_0x96db('0x5a')]['id']}})[_0x96db('0x47')](handleEntityNotFound(_0x14e440,null))['then'](saveUpdates(_0x31eae7['body'],null))['then'](respondWithResult(_0x14e440,null))[_0x96db('0x58')](handleError(_0x14e440,null));};exports[_0x96db('0x5b')]=function(_0x1391d4,_0x4b4470){var _0x217f8b=_0x1391d4[_0x96db('0x5a')]['id'];var _0x56c7ed=[];return db['sequelize']['transaction'](function(_0x4d82fa){var _0x58d411=_0x96db('0x5c')+_0x217f8b;return db[_0x96db('0x5d')][_0x96db('0x35')](_0x58d411,{'type':db[_0x96db('0x5e')]['QueryTypes'][_0x96db('0x5f')],'raw':!![],'transaction':_0x4d82fa})['then'](function(_0x20fd5e){_0x56c7ed=_[_0x96db('0x31')](_0x20fd5e,function(_0x4601b1){return Number(_0x4601b1[_0x96db('0x60')]);});})[_0x96db('0x47')](function(){var _0x1922cf=_0x96db('0x61')+_0x217f8b;return db[_0x96db('0x5d')]['query'](_0x1922cf,{'type':db[_0x96db('0x5e')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x4d82fa});})[_0x96db('0x47')](function(_0x12fb8b){var _0x1c9696=_['map'](_0x12fb8b,function(_0x27cf6f){return Number(_0x27cf6f[_0x96db('0x62')]);});return db['UserVoiceQueue']['destroy']({'where':{'UserId':{'$in':_0x56c7ed},'VoiceQueueId':{'$in':_0x1c9696}},'transaction':_0x4d82fa});})['then'](function(){var _0x2119dc=_0x96db('0x63')+_0x217f8b;return db[_0x96db('0x5d')][_0x96db('0x35')](_0x2119dc,{'type':db['Sequelize'][_0x96db('0x64')]['SELECT'],'raw':!![],'transaction':_0x4d82fa});})['then'](function(_0x33712b){var _0x3adc2e=_[_0x96db('0x31')](_0x33712b,function(_0x5c6986){return Number(_0x5c6986[_0x96db('0x65')]);});return db['UserMailQueue'][_0x96db('0x5b')]({'where':{'UserId':{'$in':_0x56c7ed},'MailQueueId':{'$in':_0x3adc2e}},'transaction':_0x4d82fa});})[_0x96db('0x47')](function(){var _0x530b7d=_0x96db('0x66')+_0x217f8b;return db[_0x96db('0x5d')][_0x96db('0x35')](_0x530b7d,{'type':db[_0x96db('0x5e')][_0x96db('0x64')]['SELECT'],'raw':!![],'transaction':_0x4d82fa});})[_0x96db('0x47')](function(_0x5ba761){var _0x14f94f=_[_0x96db('0x31')](_0x5ba761,function(_0x1154a2){return Number(_0x1154a2[_0x96db('0x67')]);});return db[_0x96db('0x68')]['destroy']({'where':{'UserId':{'$in':_0x56c7ed},'SmsQueueId':{'$in':_0x14f94f}},'transaction':_0x4d82fa});})[_0x96db('0x47')](function(){var _0x7681de=_0x96db('0x69')+_0x217f8b;return db[_0x96db('0x5d')]['query'](_0x7681de,{'type':db[_0x96db('0x5e')][_0x96db('0x64')]['SELECT'],'raw':!![],'transaction':_0x4d82fa});})['then'](function(_0x45c79a){var _0x302eba=_[_0x96db('0x31')](_0x45c79a,function(_0x2bfceb){return Number(_0x2bfceb['ChatQueueId']);});return db['UserChatQueue']['destroy']({'where':{'UserId':{'$in':_0x56c7ed},'ChatQueueId':{'$in':_0x302eba}},'transaction':_0x4d82fa});})[_0x96db('0x47')](function(){var _0x52a272=_0x96db('0x6a')+_0x217f8b;return db[_0x96db('0x5d')][_0x96db('0x35')](_0x52a272,{'type':db[_0x96db('0x5e')][_0x96db('0x64')][_0x96db('0x5f')],'raw':!![],'transaction':_0x4d82fa});})[_0x96db('0x47')](function(_0xc599ee){var _0x4da08d=_[_0x96db('0x31')](_0xc599ee,function(_0x1b4927){return Number(_0x1b4927[_0x96db('0x6b')]);});return db['UserFaxQueue'][_0x96db('0x5b')]({'where':{'UserId':{'$in':_0x56c7ed},'FaxQueueId':{'$in':_0x4da08d}},'transaction':_0x4d82fa});})[_0x96db('0x47')](function(){var _0x82e616='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x217f8b;return db[_0x96db('0x5d')][_0x96db('0x35')](_0x82e616,{'type':db[_0x96db('0x5e')]['QueryTypes'][_0x96db('0x5f')],'raw':!![],'transaction':_0x4d82fa});})[_0x96db('0x47')](function(_0x31355b){var _0x3daa47=_['map'](_0x31355b,function(_0x1bcff8){return Number(_0x1bcff8[_0x96db('0x6c')]);});return db[_0x96db('0x6d')]['destroy']({'where':{'UserId':{'$in':_0x56c7ed},'OpenchannelQueueId':{'$in':_0x3daa47}},'transaction':_0x4d82fa});})[_0x96db('0x47')](function(){var _0x5b36af=_0x96db('0x6e')+_0x217f8b;return db['sequelize'][_0x96db('0x35')](_0x5b36af,{'type':db['Sequelize'][_0x96db('0x64')][_0x96db('0x5f')],'raw':!![],'transaction':_0x4d82fa});})[_0x96db('0x47')](function(_0x604d67){var _0x304fb5=_['map'](_0x604d67,function(_0x50bbff){return Number(_0x50bbff[_0x96db('0x6f')]);});return db[_0x96db('0x70')][_0x96db('0x5b')]({'where':{'UserId':{'$in':_0x56c7ed},'WhatsappQueueId':{'$in':_0x304fb5}},'transaction':_0x4d82fa});})[_0x96db('0x47')](function(){return db[_0x96db('0x71')]['find']({'where':{'TeamId':_0x217f8b}});})[_0x96db('0x47')](function(_0x2bad1b){if(_0x2bad1b===null){return;}return db[_0x96db('0x72')]['destroy']({'where':{'UserId':{'$in':_0x56c7ed},'VoicePrefixId':_0x2bad1b['VoicePrefixId']},'transaction':_0x4d82fa});})['then'](function(){return db[_0x96db('0x32')][_0x96db('0x5b')]({'where':{'id':_0x217f8b},'cascade':!![],'transaction':_0x4d82fa});})['then'](function(_0x1704cf){if(_0x1704cf===0x0){_0x4b4470[_0x96db('0x21')](0x194);}else{return db[_0x96db('0x57')][_0x96db('0x5b')]({'where':{'type':_0x96db('0x53'),'resourceId':_0x217f8b},'cascade':!![],'transaction':_0x4d82fa})[_0x96db('0x47')](function(){_0x4b4470[_0x96db('0x27')](0xcc)[_0x96db('0x22')]();});}})[_0x96db('0x58')](function(_0x5e4d9b){_0x4b4470[_0x96db('0x27')](0x1f4)[_0x96db('0x2f')](_0x5e4d9b);});});};exports[_0x96db('0x73')]=function(_0x28fda5,_0x11185b,_0x2fc248){return db[_0x96db('0x32')][_0x96db('0x74')]({'where':{'id':_0x28fda5[_0x96db('0x5a')]['id']}})[_0x96db('0x47')](handleEntityNotFound(_0x11185b,null))[_0x96db('0x47')](function(_0x1a610d){if(!_0x28fda5[_0x96db('0x35')][_0x96db('0x75')]||!utils['isValidChannel'](_0x28fda5[_0x96db('0x35')][_0x96db('0x75')])){throw new db[(_0x96db('0x5e'))][(_0x96db('0x76'))]('Unknown\x20channel');}var _0x3ae943={};var _0x1b4cf4={};_0x1b4cf4[_0x96db('0x38')]=_['keys'](db[_['capitalize'](_0x28fda5[_0x96db('0x35')]['channel']['toLowerCase']())+_0x96db('0x77')][_0x96db('0x33')]);_0x1b4cf4[_0x96db('0x35')]=_['keys'](_0x28fda5[_0x96db('0x35')]);_0x1b4cf4[_0x96db('0x41')]=_[_0x96db('0x37')](_0x1b4cf4[_0x96db('0x38')],_0x1b4cf4['query']);_0x3ae943['attributes']=_['intersection'](_0x1b4cf4['model'],qs[_0x96db('0x3a')](_0x28fda5[_0x96db('0x35')][_0x96db('0x3a')]));_0x3ae943[_0x96db('0x39')]=_0x3ae943[_0x96db('0x39')]['length']?_0x3ae943[_0x96db('0x39')]:_0x1b4cf4['model'];_0x3ae943[_0x96db('0x24')]=qs[_0x96db('0x24')](_0x28fda5[_0x96db('0x35')]['limit']);_0x3ae943[_0x96db('0x25')]=qs['offset'](_0x28fda5[_0x96db('0x35')]['offset']);_0x3ae943['order']=qs[_0x96db('0x3f')](_0x28fda5[_0x96db('0x35')][_0x96db('0x3f')]);_0x3ae943['where']=qs[_0x96db('0x41')](_[_0x96db('0x42')](_0x28fda5[_0x96db('0x35')],_0x1b4cf4[_0x96db('0x41')]));_0x3ae943=_[_0x96db('0x44')]({},_0x3ae943,_0x28fda5[_0x96db('0x46')]);return _0x1a610d[_0x96db('0x52')+_[_0x96db('0x78')](_0x28fda5['query'][_0x96db('0x75')][_0x96db('0x79')]())+_0x96db('0x7a')](_0x3ae943);})[_0x96db('0x47')](respondWithResult(_0x11185b,null))[_0x96db('0x58')](handleError(_0x11185b,null));};exports['addQueues']=function(_0x24cff8,_0x8215f5,_0x5ec80a){return db[_0x96db('0x32')][_0x96db('0x74')]({'where':{'id':_0x24cff8['params']['id']}})[_0x96db('0x47')](function(_0x217fa7){if(_0x217fa7){if(!_0x24cff8[_0x96db('0x4e')][_0x96db('0x75')]||!utils[_0x96db('0x7b')](_0x24cff8[_0x96db('0x4e')][_0x96db('0x75')])){throw new db[(_0x96db('0x5e'))][(_0x96db('0x76'))](_0x96db('0x7c'));}return _0x217fa7[_0x96db('0x7d')+_[_0x96db('0x78')](_0x24cff8[_0x96db('0x4e')]['channel'][_0x96db('0x79')]())+'Queues'](_0x24cff8['body']['ids']);}return null;})[_0x96db('0x47')](handleEntityNotFound(_0x8215f5,null))[_0x96db('0x47')](respondWithStatusCode(_0x8215f5,null))[_0x96db('0x58')](handleError(_0x8215f5,null));};exports['removeQueues']=function(_0x1caa62,_0x2a8dcb,_0x47a244){return db[_0x96db('0x32')][_0x96db('0x74')]({'where':{'id':_0x1caa62[_0x96db('0x5a')]['id']}})['then'](function(_0x4355d0){if(_0x4355d0){if(!_0x1caa62['query']['channel']||!utils[_0x96db('0x7b')](_0x1caa62['query'][_0x96db('0x75')])){throw new db[(_0x96db('0x5e'))][(_0x96db('0x76'))](_0x96db('0x7c'));}return _0x4355d0[_0x96db('0x7e')+_[_0x96db('0x78')](_0x1caa62['query'][_0x96db('0x75')][_0x96db('0x79')]())+_0x96db('0x7a')](_0x1caa62[_0x96db('0x35')][_0x96db('0x7f')]);}return null;})['then'](handleEntityNotFound(_0x2a8dcb,null))[_0x96db('0x47')](respondWithStatusCode(_0x2a8dcb,null))['catch'](handleError(_0x2a8dcb,null));};exports[_0x96db('0x80')]=function(_0x1037c,_0x381202){var _0x1cacbf=_[_0x96db('0x81')](_0x1037c[_0x96db('0x4e')][_0x96db('0x7f')])?_0x1037c[_0x96db('0x4e')][_0x96db('0x7f')]:[_0x1037c['body'][_0x96db('0x7f')]];var _0x1143b6=_0x1037c[_0x96db('0x5a')]['id'];return db[_0x96db('0x32')][_0x96db('0x4c')]({'where':{'id':_0x1143b6}})[_0x96db('0x47')](handleEntityNotFound(_0x381202,null))['then'](function(_0xaf9375){if(_0xaf9375){var _0x3e6bcf=[_0x96db('0x82'),_0x96db('0x83'),_0x96db('0x84'),_0x96db('0x85'),_0x96db('0x86'),_0x96db('0x87'),_0x96db('0x88')];return db[_0x96db('0x5d')]['transaction'](function(_0x2cfc68){var _0x1300ab=_[_0x96db('0x31')](_0x3e6bcf,function(_0x2fd3cc){var _0x145602={'attributes':['id',_0x96db('0x2e')]};if(_0x2fd3cc==='Voice'){_0x145602[_0x96db('0x89')]={'attributes':[_0x96db('0x8a')]};}return _0xaf9375[_0x96db('0x52')+_0x2fd3cc+_0x96db('0x7a')](_0x145602)['then'](function(_0x59b481){var _0x2cc189=_[_0x96db('0x31')](_0x59b481,function(_0x5abd07){var _0x5387c5=_['map'](_0x1cacbf,function(_0x4efae9){var _0x949885={'where':{'UserId':_0x4efae9,[_0x2fd3cc+_0x96db('0x8b')]:_0x5abd07['id']},'transaction':_0x2cfc68};if(_0x2fd3cc===_0x96db('0x82')){_0x949885['defaults']={'penalty':_0x5abd07[_0x96db('0x8c')][_0x96db('0x8a')]};}return db[_0x96db('0x8d')+_0x2fd3cc+'Queue'][_0x96db('0x8e')](_0x949885)[_0x96db('0x47')](function(){socket[_0x96db('0x8f')](_0x96db('0x4f')+_0x2fd3cc+_0x96db('0x90'),{'UserId':_0x4efae9,[_0x2fd3cc+_0x96db('0x8b')]:_0x5abd07['id']});if(_0x2fd3cc!=='Voice'){return;}return db[_0x96db('0x8d')][_0x96db('0x49')]({'where':{'id':_0x1cacbf,'online':0x1},'attributes':['id','name',_0x96db('0x91'),_0x96db('0x92'),_0x96db('0x93')],'raw':!![]})[_0x96db('0x47')](function(_0x3c817d){var _0x22539c=_[_0x96db('0x31')](_0x3c817d,function(_0x2db8ed){return db[_0x96db('0x94')][_0x96db('0x95')]({'membername':_0x2db8ed['name'],'UserId':_0x2db8ed['id'],'queue_name':_0x5abd07[_0x96db('0x2e')],'VoiceQueueId':_0x5abd07['id'],'interface':_[_0x96db('0x96')](_0x2db8ed[_0x96db('0x93')])?util['format']('SIP/%s',_0x2db8ed[_0x96db('0x2e')]):_0x2db8ed[_0x96db('0x93')],'paused':_0x2db8ed[_0x96db('0x92')]||![],'penalty':_0x5abd07['TeamVoiceQueue'][_0x96db('0x8a')]},{'transaction':_0x2cfc68});});return Promise[_0x96db('0x97')](_0x22539c);});});});return Promise[_0x96db('0x97')](_0x5387c5);});return Promise[_0x96db('0x97')](_0x2cc189);})[_0x96db('0x47')](function(){return db[_0x96db('0x71')][_0x96db('0x74')]({'where':{'teamId':_0x1143b6}})['then'](function(_0x49c952){if(_0x49c952){var _0x4d4012=_[_0x96db('0x31')](_0x1cacbf,function(_0x1873d6){db[_0x96db('0x72')]['upsert']({'UserId':_0x1873d6,'VoicePrefixId':_0x49c952['VoicePrefixId']});});return Promise[_0x96db('0x97')](_0x4d4012);}});});});return Promise[_0x96db('0x97')](_0x1300ab)['then'](function(){return _0xaf9375[_0x96db('0x80')](_0x1cacbf,{'transaction':_0x2cfc68})[_0x96db('0x98')](function(_0x4f1ec0){return _0x4f1ec0;});});});}})[_0x96db('0x47')](respondWithResult(_0x381202,null))['catch'](handleError(_0x381202,null));};exports[_0x96db('0x99')]=function(_0x2ff188,_0x53cc06){var _0xb75f67=_[_0x96db('0x81')](_0x2ff188[_0x96db('0x35')][_0x96db('0x7f')])?_0x2ff188[_0x96db('0x35')]['ids']:[_0x2ff188[_0x96db('0x35')][_0x96db('0x7f')]];var _0x3c3901=_0x2ff188[_0x96db('0x5a')]['id'];return db[_0x96db('0x32')][_0x96db('0x4c')]({'where':{'id':_0x3c3901}})[_0x96db('0x47')](handleEntityNotFound(_0x53cc06,null))[_0x96db('0x47')](function(_0x576536){if(_0x576536){var _0x315fd8=['Voice',_0x96db('0x83'),'Mail','Sms',_0x96db('0x86'),_0x96db('0x87'),_0x96db('0x88')];return db[_0x96db('0x5d')][_0x96db('0x9a')](function(_0x59e65e){var _0x5e7a47=_[_0x96db('0x31')](_0x315fd8,function(_0xee8214){var _0x3f9c14={'attributes':['id',_0x96db('0x2e')]};return _0x576536['get'+_0xee8214+_0x96db('0x7a')](_0x3f9c14)[_0x96db('0x47')](function(_0x24fcfc){var _0x48a042=_[_0x96db('0x31')](_0x24fcfc,function(_0x595d88){return _0x595d88[_0x96db('0x99')](_0xb75f67,{'transaction':_0x59e65e})[_0x96db('0x47')](function(){var _0x1e6a3f=_[_0x96db('0x31')](_0xb75f67,function(_0x1acdda){socket[_0x96db('0x8f')](_0x96db('0x4f')+_0xee8214+_0x96db('0x9b'),{'UserId':Number(_0x1acdda),[_0xee8214+'QueueId']:_0x595d88['id']});if(_0xee8214!==_0x96db('0x82')){return;}return db[_0x96db('0x94')]['destroy']({'where':{'VoiceQueueId':_0x595d88['id'],'UserId':_0x1acdda},'transaction':_0x59e65e});});return Promise[_0x96db('0x97')](_0x1e6a3f);});});return Promise['all'](_0x48a042);});});return Promise['all'](_0x5e7a47)[_0x96db('0x47')](function(){return _0x576536['removeAgents'](_0xb75f67,{'transaction':_0x59e65e});})[_0x96db('0x47')](function(){return db[_0x96db('0x71')][_0x96db('0x74')]({'where':{'teamId':_0x3c3901}})[_0x96db('0x47')](function(_0x326f48){if(_0x326f48){var _0x3002df=_[_0x96db('0x31')](_0xb75f67,function(_0x3a20d2){db[_0x96db('0x72')][_0x96db('0x5b')]({'where':{'UserId':_0x3a20d2,'VoicePrefixId':_0x326f48['VoicePrefixId']}});});return Promise[_0x96db('0x97')](_0x3002df);}});});});}})[_0x96db('0x47')](respondWithStatusCode(_0x53cc06,null))[_0x96db('0x58')](handleError(_0x53cc06,null));};exports[_0x96db('0x9c')]=function(_0x5c18aa,_0x3cce5a,_0x2e08d6){var _0x29fdb5={};var _0x2ca151={};var _0x37747c;var _0x475b4f;return db['Team'][_0x96db('0x74')]({'where':{'id':_0x5c18aa[_0x96db('0x5a')]['id']}})[_0x96db('0x47')](handleEntityNotFound(_0x3cce5a,null))['then'](function(_0x4db6e7){if(_0x4db6e7){_0x37747c=_0x4db6e7;_0x2ca151[_0x96db('0x38')]=_[_0x96db('0x36')](db['User'][_0x96db('0x33')]);_0x2ca151['query']=_[_0x96db('0x36')](_0x5c18aa[_0x96db('0x35')]);_0x2ca151[_0x96db('0x41')]=_[_0x96db('0x37')](_0x2ca151[_0x96db('0x38')],_0x2ca151[_0x96db('0x35')]);_0x29fdb5[_0x96db('0x39')]=_[_0x96db('0x37')](_0x2ca151[_0x96db('0x38')],qs[_0x96db('0x3a')](_0x5c18aa[_0x96db('0x35')][_0x96db('0x3a')]));_0x29fdb5['attributes']=_0x29fdb5['attributes'][_0x96db('0x3b')]?_0x29fdb5[_0x96db('0x39')]:_0x2ca151['model'];_0x29fdb5['order']=qs[_0x96db('0x3f')](_0x5c18aa[_0x96db('0x35')][_0x96db('0x3f')]);_0x29fdb5[_0x96db('0x40')]=qs[_0x96db('0x41')](_[_0x96db('0x42')](_0x5c18aa[_0x96db('0x35')],_0x2ca151[_0x96db('0x41')]));if(_0x5c18aa[_0x96db('0x35')]['filter']){_0x29fdb5[_0x96db('0x40')]=_[_0x96db('0x44')](_0x29fdb5[_0x96db('0x40')],{'$or':_[_0x96db('0x31')](_0x29fdb5['attributes'],function(_0x2217e7){var _0x52e751={};_0x52e751[_0x2217e7]={'$like':'%'+_0x5c18aa[_0x96db('0x35')][_0x96db('0x43')]+'%'};return _0x52e751;})});}_0x29fdb5=_['merge']({},_0x29fdb5,_0x5c18aa[_0x96db('0x46')]);return _0x37747c[_0x96db('0x9c')](_0x29fdb5);}})[_0x96db('0x47')](function(_0x4de9a8){if(_0x4de9a8){_0x475b4f=_0x4de9a8[_0x96db('0x3b')];if(!_0x5c18aa[_0x96db('0x35')]['hasOwnProperty']('nolimit')){_0x29fdb5[_0x96db('0x24')]=qs[_0x96db('0x24')](_0x5c18aa[_0x96db('0x35')]['limit']);_0x29fdb5['offset']=qs[_0x96db('0x25')](_0x5c18aa[_0x96db('0x35')]['offset']);}return _0x37747c[_0x96db('0x9c')](_0x29fdb5);}})[_0x96db('0x47')](function(_0x2c0789){if(_0x2c0789){return _0x2c0789?{'count':_0x475b4f,'rows':_0x2c0789}:null;}})['then'](respondWithResult(_0x3cce5a,null))['catch'](handleError(_0x3cce5a,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 72767c6..b293b22 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 _0x26a1=['remove','emit','hasOwnProperty','hook','Team','save','update'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x26a1,0x115));var _0x126a=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x26a1[_0x397e5f];return _0x5302b8;};'use strict';var EventEmitter=require('events');var Team=require('../../mysqldb')['db'][_0x126a('0x0')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x126a('0x1'),'afterUpdate':_0x126a('0x2'),'afterDestroy':_0x126a('0x3')};function emitEvent(_0x50b957){return function(_0x2376c5,_0x3149c1,_0x3f4abf){TeamEvents[_0x126a('0x4')](_0x50b957+':'+_0x2376c5['id'],_0x2376c5);TeamEvents['emit'](_0x50b957,_0x2376c5);_0x3f4abf(null);};}for(var e in events){if(events[_0x126a('0x5')](e)){var event=events[e];Team[_0x126a('0x6')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0x2369=['Team','remove','emit','hook','events','../../mysqldb'];(function(_0x4936fb,_0x10fda9){var _0x4430ab=function(_0xd722c3){while(--_0xd722c3){_0x4936fb['push'](_0x4936fb['shift']());}};_0x4430ab(++_0x10fda9);}(_0x2369,0x1b4));var _0x9236=function(_0x447852,_0x202f59){_0x447852=_0x447852-0x0;var _0x1bfc45=_0x2369[_0x447852];return _0x1bfc45;};'use strict';var EventEmitter=require(_0x9236('0x0'));var Team=require(_0x9236('0x1'))['db'][_0x9236('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x9236('0x3')};function emitEvent(_0x1b949c){return function(_0x10ceff,_0x44b60a,_0x3d1a05){TeamEvents['emit'](_0x1b949c+':'+_0x10ceff['id'],_0x10ceff);TeamEvents[_0x9236('0x4')](_0x1b949c,_0x10ceff);_0x3d1a05(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x9236('0x5')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index bd7aa44..3fb3225 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 _0x980f=['./team.attributes','exports','define','Team','teams','lodash','../../config/logger','moment','rimraf','../../config/environment'];(function(_0x550d42,_0xfc363c){var _0x450795=function(_0x3bb9a0){while(--_0x3bb9a0){_0x550d42['push'](_0x550d42['shift']());}};_0x450795(++_0xfc363c);}(_0x980f,0x91));var _0xf980=function(_0x3db17b,_0x154758){_0x3db17b=_0x3db17b-0x0;var _0x40035f=_0x980f[_0x3db17b];return _0x40035f;};'use strict';var _=require(_0xf980('0x0'));var util=require('util');var logger=require(_0xf980('0x1'))('api');var moment=require(_0xf980('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf980('0x3'));var config=require(_0xf980('0x4'));var attributes=require(_0xf980('0x5'));module[_0xf980('0x6')]=function(_0x5c21c4,_0x117e74){return _0x5c21c4[_0xf980('0x7')](_0xf980('0x8'),attributes,{'tableName':_0xf980('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c7d=['define','Team','teams','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./team.attributes','exports'];(function(_0x49b1ed,_0x5e41b2){var _0x39fe60=function(_0xed5635){while(--_0xed5635){_0x49b1ed['push'](_0x49b1ed['shift']());}};_0x39fe60(++_0x5e41b2);}(_0x6c7d,0xd5));var _0xd6c7=function(_0x1fb865,_0x19dccc){_0x1fb865=_0x1fb865-0x0;var _0x39f585=_0x6c7d[_0x1fb865];return _0x39f585;};'use strict';var _=require(_0xd6c7('0x0'));var util=require(_0xd6c7('0x1'));var logger=require('../../config/logger')(_0xd6c7('0x2'));var moment=require(_0xd6c7('0x3'));var BPromise=require(_0xd6c7('0x4'));var rp=require(_0xd6c7('0x5'));var fs=require('fs');var path=require(_0xd6c7('0x6'));var rimraf=require(_0xd6c7('0x7'));var config=require(_0xd6c7('0x8'));var attributes=require(_0xd6c7('0x9'));module[_0xd6c7('0xa')]=function(_0x5469c2,_0x29303e){return _0x5469c2[_0xd6c7('0xb')](_0xd6c7('0xc'),attributes,{'tableName':_0xd6c7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 3363717..657a9e1 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 _0x84dd=['socket.io-emitter','request','then','info','request\x20sent','stringify','error','Team,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost'];(function(_0x42226a,_0x53a100){var _0x46f24b=function(_0x40c7ef){while(--_0x40c7ef){_0x42226a['push'](_0x42226a['shift']());}};_0x46f24b(++_0x53a100);}(_0x84dd,0x1cd));var _0xd84d=function(_0x1efe89,_0x33e4b1){_0x1efe89=_0x1efe89-0x0;var _0x203b94=_0x84dd[_0x1efe89];return _0x203b94;};'use strict';var _=require(_0xd84d('0x0'));var util=require(_0xd84d('0x1'));var moment=require(_0xd84d('0x2'));var BPromise=require(_0xd84d('0x3'));var rs=require(_0xd84d('0x4'));var fs=require('fs');var Redis=require(_0xd84d('0x5'));var db=require(_0xd84d('0x6'))['db'];var utils=require(_0xd84d('0x7'));var logger=require('../../config/logger')(_0xd84d('0x8'));var config=require('../../config/environment');var jayson=require(_0xd84d('0x9'));var client=jayson[_0xd84d('0xa')]['http']({'port':0x232a});config[_0xd84d('0xb')]=_[_0xd84d('0xc')](config[_0xd84d('0xb')],{'host':_0xd84d('0xd'),'port':0x18eb});var socket=require(_0xd84d('0xe'))(new Redis(config[_0xd84d('0xb')]));require('./team.socket')['register'](socket);function respondWithRpcPromise(_0x17d803,_0x1a5ee6,_0x445764){return new BPromise(function(_0x59865b,_0x5280ea){return client[_0xd84d('0xf')](_0x17d803,_0x445764)[_0xd84d('0x10')](function(_0x35282f){logger[_0xd84d('0x11')]('Team,\x20%s,\x20%s',_0x1a5ee6,_0xd84d('0x12'));logger['debug']('Team,\x20%s,\x20%s,\x20%s',_0x1a5ee6,_0xd84d('0x12'),JSON[_0xd84d('0x13')](_0x35282f));if(_0x35282f[_0xd84d('0x14')]){if(_0x35282f['error']['code']===0x1f4){logger['error'](_0xd84d('0x15'),_0x1a5ee6,_0x35282f[_0xd84d('0x14')][_0xd84d('0x16')]);return _0x5280ea(_0x35282f[_0xd84d('0x14')]['message']);}logger[_0xd84d('0x14')](_0xd84d('0x15'),_0x1a5ee6,_0x35282f['error']['message']);return _0x59865b(_0x35282f[_0xd84d('0x14')]['message']);}else{logger['info'](_0xd84d('0x15'),_0x1a5ee6,'request\x20sent');_0x59865b(_0x35282f[_0xd84d('0x17')]['message']);}})[_0xd84d('0x18')](function(_0x2d5614){logger[_0xd84d('0x14')](_0xd84d('0x15'),_0x1a5ee6,_0x2d5614);_0x5280ea(_0x2d5614);});});} \ No newline at end of file +var _0x42c6=['client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','Team,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x47b1a9,_0x694d93){var _0x350f55=function(_0x401399){while(--_0x401399){_0x47b1a9['push'](_0x47b1a9['shift']());}};_0x350f55(++_0x694d93);}(_0x42c6,0xd5));var _0x642c=function(_0x1b880d,_0x271eff){_0x1b880d=_0x1b880d-0x0;var _0x4d85d1=_0x42c6[_0x1b880d];return _0x4d85d1;};'use strict';var _=require(_0x642c('0x0'));var util=require(_0x642c('0x1'));var moment=require(_0x642c('0x2'));var BPromise=require(_0x642c('0x3'));var rs=require(_0x642c('0x4'));var fs=require('fs');var Redis=require(_0x642c('0x5'));var db=require(_0x642c('0x6'))['db'];var utils=require(_0x642c('0x7'));var logger=require('../../config/logger')(_0x642c('0x8'));var config=require(_0x642c('0x9'));var jayson=require(_0x642c('0xa'));var client=jayson[_0x642c('0xb')][_0x642c('0xc')]({'port':0x232a});config[_0x642c('0xd')]=_[_0x642c('0xe')](config['redis'],{'host':_0x642c('0xf'),'port':0x18eb});var socket=require(_0x642c('0x10'))(new Redis(config['redis']));require(_0x642c('0x11'))[_0x642c('0x12')](socket);function respondWithRpcPromise(_0x4de38e,_0x56c487,_0xff0d68){return new BPromise(function(_0x4f6304,_0x23913b){return client[_0x642c('0x13')](_0x4de38e,_0xff0d68)[_0x642c('0x14')](function(_0x483084){logger[_0x642c('0x15')]('Team,\x20%s,\x20%s',_0x56c487,'request\x20sent');logger[_0x642c('0x16')](_0x642c('0x17'),_0x56c487,_0x642c('0x18'),JSON[_0x642c('0x19')](_0x483084));if(_0x483084['error']){if(_0x483084['error'][_0x642c('0x1a')]===0x1f4){logger[_0x642c('0x1b')](_0x642c('0x1c'),_0x56c487,_0x483084[_0x642c('0x1b')]['message']);return _0x23913b(_0x483084['error'][_0x642c('0x1d')]);}logger[_0x642c('0x1b')]('Team,\x20%s,\x20%s',_0x56c487,_0x483084[_0x642c('0x1b')][_0x642c('0x1d')]);return _0x4f6304(_0x483084[_0x642c('0x1b')]['message']);}else{logger[_0x642c('0x15')](_0x642c('0x1c'),_0x56c487,_0x642c('0x18'));_0x4f6304(_0x483084[_0x642c('0x1e')][_0x642c('0x1d')]);}})[_0x642c('0x1f')](function(_0x51e23f){logger[_0x642c('0x1b')](_0x642c('0x1c'),_0x56c487,_0x51e23f);_0x23913b(_0x51e23f);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index c814806..e9dde5a 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 _0x8f5d=['team:','./team.events','remove','emit','removeListener','register','length'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x8f5d,0x10b));var _0xd8f5=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x8f5d[_0x5d6456];return _0x4d66c1;};'use strict';var TeamEvents=require(_0xd8f5('0x0'));var events=['save',_0xd8f5('0x1'),'update'];function createListener(_0x420cf0,_0x5dd77f){return function(_0x481ffc){_0x5dd77f[_0xd8f5('0x2')](_0x420cf0,_0x481ffc);};}function removeListener(_0x288a7a,_0x398075){return function(){TeamEvents[_0xd8f5('0x3')](_0x288a7a,_0x398075);};}exports[_0xd8f5('0x4')]=function(_0x407db3){for(var _0x2f8a1a=0x0,_0x2a28a0=events[_0xd8f5('0x5')];_0x2f8a1a<_0x2a28a0;_0x2f8a1a++){var _0xdbc726=events[_0x2f8a1a];var _0x3aff4e=createListener(_0xd8f5('0x6')+_0xdbc726,_0x407db3);TeamEvents['on'](_0xdbc726,_0x3aff4e);}}; \ No newline at end of file +var _0xc069=['save','remove','emit','removeListener','register','length','./team.events'];(function(_0x43f084,_0xb48804){var _0x2a6dde=function(_0x1fab7f){while(--_0x1fab7f){_0x43f084['push'](_0x43f084['shift']());}};_0x2a6dde(++_0xb48804);}(_0xc069,0x1cd));var _0x9c06=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc069[_0x321bb2];return _0x9c12ed;};'use strict';var TeamEvents=require(_0x9c06('0x0'));var events=[_0x9c06('0x1'),_0x9c06('0x2'),'update'];function createListener(_0x2df9ab,_0x20086f){return function(_0x169201){_0x20086f[_0x9c06('0x3')](_0x2df9ab,_0x169201);};}function removeListener(_0x3d5c7c,_0x1ae793){return function(){TeamEvents[_0x9c06('0x4')](_0x3d5c7c,_0x1ae793);};}exports[_0x9c06('0x5')]=function(_0xf640c9){for(var _0x41c32e=0x0,_0x449a6c=events[_0x9c06('0x6')];_0x41c32e<_0x449a6c;_0x41c32e++){var _0x3d1d4e=events[_0x41c32e];var _0x121006=createListener('team:'+_0x3d1d4e,_0xf640c9);TeamEvents['on'](_0x3d1d4e,_0x121006);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 00d21c7..b57509e 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 _0xe860=['exports','INTEGER','sequelize'];(function(_0x54f7c0,_0x27af83){var _0x245d03=function(_0x1ad6c4){while(--_0x1ad6c4){_0x54f7c0['push'](_0x54f7c0['shift']());}};_0x245d03(++_0x27af83);}(_0xe860,0x188));var _0x0e86=function(_0x1c9ae7,_0x4818bb){_0x1c9ae7=_0x1c9ae7-0x0;var _0x2d400d=_0xe860[_0x1c9ae7];return _0x2d400d;};'use strict';var Sequelize=require(_0x0e86('0x0'));module[_0x0e86('0x1')]={'TeamId':{'type':Sequelize[_0x0e86('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x0e86('0x2')]}}; \ No newline at end of file +var _0xf6a9=['INTEGER'];(function(_0x29311d,_0x3f9e23){var _0xa29b8f=function(_0x2bb490){while(--_0x2bb490){_0x29311d['push'](_0x29311d['shift']());}};_0xa29b8f(++_0x3f9e23);}(_0xf6a9,0x176));var _0x9f6a=function(_0x1002f2,_0x5923b7){_0x1002f2=_0x1002f2-0x0;var _0x300bb6=_0xf6a9[_0x1002f2];return _0x300bb6;};'use strict';var Sequelize=require('sequelize');module['exports']={'TeamId':{'type':Sequelize[_0x9f6a('0x0')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 2a52ab3..4e4a3e2 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 _0xb574=['./teamVoicePrefix.attributes','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x126261,_0x2854fe){var _0x416163=function(_0xdb10b1){while(--_0xdb10b1){_0x126261['push'](_0x126261['shift']());}};_0x416163(++_0x2854fe);}(_0xb574,0x106));var _0x4b57=function(_0x390b49,_0x480451){_0x390b49=_0x390b49-0x0;var _0x5a98a5=_0xb574[_0x390b49];return _0x5a98a5;};'use strict';var _=require(_0x4b57('0x0'));var util=require(_0x4b57('0x1'));var logger=require('../../config/logger')(_0x4b57('0x2'));var moment=require(_0x4b57('0x3'));var BPromise=require('bluebird');var rp=require(_0x4b57('0x4'));var fs=require('fs');var path=require(_0x4b57('0x5'));var rimraf=require(_0x4b57('0x6'));var config=require(_0x4b57('0x7'));var attributes=require(_0x4b57('0x8'));module['exports']=function(_0x4eb019,_0x1c97e5){return _0x4eb019['define']('TeamVoicePrefix',attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb01a=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','lodash','util','../../config/logger'];(function(_0x2d2bf1,_0x3b66f9){var _0xdcb63c=function(_0x24515d){while(--_0x24515d){_0x2d2bf1['push'](_0x2d2bf1['shift']());}};_0xdcb63c(++_0x3b66f9);}(_0xb01a,0x1a1));var _0xab01=function(_0x3c05be,_0x5cd7c6){_0x3c05be=_0x3c05be-0x0;var _0x1453b9=_0xb01a[_0x3c05be];return _0x1453b9;};'use strict';var _=require(_0xab01('0x0'));var util=require(_0xab01('0x1'));var logger=require(_0xab01('0x2'))(_0xab01('0x3'));var moment=require(_0xab01('0x4'));var BPromise=require(_0xab01('0x5'));var rp=require(_0xab01('0x6'));var fs=require('fs');var path=require(_0xab01('0x7'));var rimraf=require(_0xab01('0x8'));var config=require(_0xab01('0x9'));var attributes=require(_0xab01('0xa'));module[_0xab01('0xb')]=function(_0x22db85,_0x5d8dd9){return _0x22db85[_0xab01('0xc')](_0xab01('0xd'),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 889f616..b3abe25 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xccb24f,_0x2285f8){var _0x15b8cc=function(_0x13bd1a){while(--_0x13bd1a){_0xccb24f['push'](_0xccb24f['shift']());}};_0x15b8cc(++_0x2285f8);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5774be,_0x2259d3){_0x5774be=_0x5774be-0x0;var _0x4914b4=_0xcb91[_0x5774be];return _0x4914b4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2f50bd,_0x254c00){var _0x406dbe=function(_0x5b9503){while(--_0x5b9503){_0x2f50bd['push'](_0x2f50bd['shift']());}};_0x406dbe(++_0x254c00);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x35e75a,_0x5ed225){_0x35e75a=_0x35e75a-0x0;var _0xb23c7f=_0xcb91[_0x35e75a];return _0xb23c7f;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 068b01e..8eb75f7 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 _0xbf48=['exports'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xbf48,0x1d0));var _0x8bf4=function(_0x1cd7bd,_0x342c01){_0x1cd7bd=_0x1cd7bd-0x0;var _0x8e474b=_0xbf48[_0x1cd7bd];return _0x8e474b;};'use strict';var Sequelize=require('sequelize');module[_0x8bf4('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x81bb=['sequelize','INTEGER'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x81bb,0x74));var _0xb81b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x81bb[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb81b('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xb81b('0x1')],'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 f95f347..6906c64 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 _0x562d=['path','../../config/environment','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x481bd9,_0x522cbf){var _0x16d271=function(_0x48cf50){while(--_0x48cf50){_0x481bd9['push'](_0x481bd9['shift']());}};_0x16d271(++_0x522cbf);}(_0x562d,0xe1));var _0xd562=function(_0x4fa438,_0x1f15a7){_0x4fa438=_0x4fa438-0x0;var _0x4e3958=_0x562d[_0x4fa438];return _0x4e3958;};'use strict';var _=require(_0xd562('0x0'));var util=require(_0xd562('0x1'));var logger=require(_0xd562('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd562('0x3'));var rp=require(_0xd562('0x4'));var fs=require('fs');var path=require(_0xd562('0x5'));var rimraf=require('rimraf');var config=require(_0xd562('0x6'));var attributes=require('./teamVoiceQueue.attributes');module['exports']=function(_0x1d05e9,_0x46bf9b){return _0x1d05e9[_0xd562('0x7')](_0xd562('0x8'),attributes,{'tableName':_0xd562('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1da1=['lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','team_has_voice_queues'];(function(_0x2e449a,_0x3b0a32){var _0x278c0d=function(_0x6231fb){while(--_0x6231fb){_0x2e449a['push'](_0x2e449a['shift']());}};_0x278c0d(++_0x3b0a32);}(_0x1da1,0x1a4));var _0x11da=function(_0x1dca98,_0x1f9847){_0x1dca98=_0x1dca98-0x0;var _0x1faa57=_0x1da1[_0x1dca98];return _0x1faa57;};'use strict';var _=require(_0x11da('0x0'));var util=require(_0x11da('0x1'));var logger=require(_0x11da('0x2'))(_0x11da('0x3'));var moment=require(_0x11da('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x11da('0x5'));var rimraf=require(_0x11da('0x6'));var config=require(_0x11da('0x7'));var attributes=require('./teamVoiceQueue.attributes');module[_0x11da('0x8')]=function(_0x209cbb,_0x15c324){return _0x209cbb['define']('TeamVoiceQueue',attributes,{'tableName':_0x11da('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 2e4ffe7..0243c3b 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 _0x2b84=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x5169ca,_0x2356e5){var _0x13f00d=function(_0xd31006){while(--_0xd31006){_0x5169ca['push'](_0x5169ca['shift']());}};_0x13f00d(++_0x2356e5);}(_0x2b84,0x105));var _0x42b8=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x2b84[_0x3054be];return _0x3df150;};'use strict';var _=require(_0x42b8('0x0'));var util=require('util');var moment=require(_0x42b8('0x1'));var BPromise=require(_0x42b8('0x2'));var rs=require(_0x42b8('0x3'));var fs=require('fs');var Redis=require(_0x42b8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x42b8('0x5'));var logger=require(_0x42b8('0x6'))(_0x42b8('0x7'));var config=require(_0x42b8('0x8'));var jayson=require(_0x42b8('0x9'));var client=jayson[_0x42b8('0xa')][_0x42b8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57e9a,_0x593975,_0x17bf95){return new BPromise(function(_0x57830c,_0x213fec){return client['request'](_0x57e9a,_0x17bf95)['then'](function(_0x3f79f6){logger[_0x42b8('0xc')](_0x42b8('0xd'),_0x593975,_0x42b8('0xe'));logger[_0x42b8('0xf')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x593975,_0x42b8('0xe'),JSON[_0x42b8('0x10')](_0x3f79f6));if(_0x3f79f6[_0x42b8('0x11')]){if(_0x3f79f6['error'][_0x42b8('0x12')]===0x1f4){logger[_0x42b8('0x11')](_0x42b8('0xd'),_0x593975,_0x3f79f6['error'][_0x42b8('0x13')]);return _0x213fec(_0x3f79f6[_0x42b8('0x11')]['message']);}logger[_0x42b8('0x11')](_0x42b8('0xd'),_0x593975,_0x3f79f6[_0x42b8('0x11')][_0x42b8('0x13')]);return _0x57830c(_0x3f79f6[_0x42b8('0x11')][_0x42b8('0x13')]);}else{logger[_0x42b8('0xc')]('TeamVoiceQueue,\x20%s,\x20%s',_0x593975,'request\x20sent');_0x57830c(_0x3f79f6[_0x42b8('0x14')][_0x42b8('0x13')]);}})[_0x42b8('0x15')](function(_0x59be69){logger[_0x42b8('0x11')](_0x42b8('0xd'),_0x593975,_0x59be69);_0x213fec(_0x59be69);});});} \ No newline at end of file +var _0x4a97=['randomstring','ioredis','../../config/utils','rpc','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x4a97,0x1eb));var _0x74a9=function(_0x2a6fd5,_0x3d6deb){_0x2a6fd5=_0x2a6fd5-0x0;var _0x43c6a4=_0x4a97[_0x2a6fd5];return _0x43c6a4;};'use strict';var _=require(_0x74a9('0x0'));var util=require('util');var moment=require(_0x74a9('0x1'));var BPromise=require(_0x74a9('0x2'));var rs=require(_0x74a9('0x3'));var fs=require('fs');var Redis=require(_0x74a9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x74a9('0x5'));var logger=require('../../config/logger')(_0x74a9('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x74a9('0x7')][_0x74a9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x15198f,_0x412d0c,_0x7d2b3b){return new BPromise(function(_0x4e8873,_0xb20f78){return client[_0x74a9('0x9')](_0x15198f,_0x7d2b3b)[_0x74a9('0xa')](function(_0x217844){logger[_0x74a9('0xb')](_0x74a9('0xc'),_0x412d0c,_0x74a9('0xd'));logger['debug'](_0x74a9('0xe'),_0x412d0c,_0x74a9('0xd'),JSON['stringify'](_0x217844));if(_0x217844[_0x74a9('0xf')]){if(_0x217844['error'][_0x74a9('0x10')]===0x1f4){logger['error'](_0x74a9('0xc'),_0x412d0c,_0x217844[_0x74a9('0xf')][_0x74a9('0x11')]);return _0xb20f78(_0x217844[_0x74a9('0xf')][_0x74a9('0x11')]);}logger[_0x74a9('0xf')](_0x74a9('0xc'),_0x412d0c,_0x217844[_0x74a9('0xf')][_0x74a9('0x11')]);return _0x4e8873(_0x217844[_0x74a9('0xf')][_0x74a9('0x11')]);}else{logger[_0x74a9('0xb')](_0x74a9('0xc'),_0x412d0c,_0x74a9('0xd'));_0x4e8873(_0x217844[_0x74a9('0x12')][_0x74a9('0x11')]);}})['catch'](function(_0x71ec18){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x412d0c,_0x71ec18);_0xb20f78(_0x71ec18);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 98aa69c..124746c 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 _0x002d=['./template.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x151381,_0x97b314){var _0x2afab6=function(_0x4b3941){while(--_0x4b3941){_0x151381['push'](_0x151381['shift']());}};_0x2afab6(++_0x97b314);}(_0x002d,0xca));var _0xd002=function(_0x32755b,_0x4268f6){_0x32755b=_0x32755b-0x0;var _0x147662=_0x002d[_0x32755b];return _0x147662;};'use strict';var multer=require(_0xd002('0x0'));var util=require(_0xd002('0x1'));var path=require(_0xd002('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd002('0x3')]();var fs_extra=require(_0xd002('0x4'));var auth=require(_0xd002('0x5'));var interaction=require(_0xd002('0x6'));var config=require(_0xd002('0x7'));var controller=require(_0xd002('0x8'));router[_0xd002('0x9')]('/',auth[_0xd002('0xa')](),controller[_0xd002('0xb')]);router[_0xd002('0x9')](_0xd002('0xc'),auth[_0xd002('0xa')](),controller[_0xd002('0xd')]);router[_0xd002('0xe')]('/',auth[_0xd002('0xa')](),controller[_0xd002('0xf')]);router[_0xd002('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xd002('0x11')]);router[_0xd002('0x12')](_0xd002('0xc'),auth['isAuthenticated'](),controller[_0xd002('0x13')]);module[_0xd002('0x14')]=router; \ No newline at end of file +var _0xeca8=['../../components/auth/service','../../config/environment','./template.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3165ac,_0x355f00){var _0x412930=function(_0x4a7a3a){while(--_0x4a7a3a){_0x3165ac['push'](_0x3165ac['shift']());}};_0x412930(++_0x355f00);}(_0xeca8,0x1f2));var _0x8eca=function(_0x5bd3c7,_0x28376a){_0x5bd3c7=_0x5bd3c7-0x0;var _0x29151e=_0xeca8[_0x5bd3c7];return _0x29151e;};'use strict';var multer=require(_0x8eca('0x0'));var util=require(_0x8eca('0x1'));var path=require(_0x8eca('0x2'));var timeout=require(_0x8eca('0x3'));var express=require(_0x8eca('0x4'));var router=express[_0x8eca('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8eca('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8eca('0x7'));var controller=require(_0x8eca('0x8'));router[_0x8eca('0x9')]('/',auth['isAuthenticated'](),controller[_0x8eca('0xa')]);router[_0x8eca('0x9')](_0x8eca('0xb'),auth[_0x8eca('0xc')](),controller[_0x8eca('0xd')]);router[_0x8eca('0xe')]('/',auth['isAuthenticated'](),controller[_0x8eca('0xf')]);router[_0x8eca('0x10')](_0x8eca('0xb'),auth[_0x8eca('0xc')](),controller[_0x8eca('0x11')]);router[_0x8eca('0x12')](_0x8eca('0xb'),auth[_0x8eca('0xc')](),controller[_0x8eca('0x13')]);module[_0x8eca('0x14')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index aa9c098..9a79722 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 _0x8d24=['TEXT','sequelize','exports','STRING'];(function(_0x1079b6,_0x573618){var _0x2acc84=function(_0x42e4ee){while(--_0x42e4ee){_0x1079b6['push'](_0x1079b6['shift']());}};_0x2acc84(++_0x573618);}(_0x8d24,0x155));var _0x48d2=function(_0x55c06b,_0x1ab2da){_0x55c06b=_0x55c06b-0x0;var _0x12eb36=_0x8d24[_0x55c06b];return _0x12eb36;};'use strict';var Sequelize=require(_0x48d2('0x0'));module[_0x48d2('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x48d2('0x2')]},'html':{'type':Sequelize[_0x48d2('0x3')]}}; \ No newline at end of file +var _0xd902=['STRING','TEXT','sequelize'];(function(_0x5483cc,_0x51b228){var _0x253a94=function(_0x58d73b){while(--_0x58d73b){_0x5483cc['push'](_0x5483cc['shift']());}};_0x253a94(++_0x51b228);}(_0xd902,0x110));var _0x2d90=function(_0x327cbf,_0x114362){_0x327cbf=_0x327cbf-0x0;var _0x409cb8=_0xd902[_0x327cbf];return _0x409cb8;};'use strict';var Sequelize=require(_0x2d90('0x0'));module['exports']={'name':{'type':Sequelize[_0x2d90('0x1')]},'description':{'type':Sequelize[_0x2d90('0x1')]},'html':{'type':Sequelize[_0x2d90('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index e684065..706d9ea 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 _0x05ef=['intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','Template','fieldName','model','query','keys'];(function(_0x2584b8,_0x5e096c){var _0x28a489=function(_0x438912){while(--_0x438912){_0x2584b8['push'](_0x2584b8['shift']());}};_0x28a489(++_0x5e096c);}(_0x05ef,0x175));var _0xf05e=function(_0x39d024,_0x5c5797){_0x39d024=_0x39d024-0x0;var _0x311bdd=_0x05ef[_0x39d024];return _0x311bdd;};'use strict';var emlformat=require(_0xf05e('0x0'));var rimraf=require(_0xf05e('0x1'));var zipdir=require(_0xf05e('0x2'));var jsonpatch=require(_0xf05e('0x3'));var rp=require(_0xf05e('0x4'));var moment=require(_0xf05e('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf05e('0x6'));var path=require(_0xf05e('0x7'));var sox=require(_0xf05e('0x8'));var csv=require(_0xf05e('0x9'));var ejs=require(_0xf05e('0xa'));var fs=require('fs');var fs_extra=require(_0xf05e('0xb'));var _=require(_0xf05e('0xc'));var squel=require('squel');var crypto=require(_0xf05e('0xd'));var jsforce=require(_0xf05e('0xe'));var deskjs=require(_0xf05e('0xf'));var toCsv=require(_0xf05e('0x9'));var querystring=require(_0xf05e('0x10'));var Papa=require(_0xf05e('0x11'));var Redis=require(_0xf05e('0x12'));var authService=require(_0xf05e('0x13'));var qs=require(_0xf05e('0x14'));var as=require(_0xf05e('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf05e('0x16'));var utils=require(_0xf05e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xf05e('0x18'));var db=require(_0xf05e('0x19'))['db'];function respondWithStatusCode(_0x1529a4,_0x3f4c2e){_0x3f4c2e=_0x3f4c2e||0xcc;return function(_0x5a07da){if(_0x5a07da){return _0x1529a4[_0xf05e('0x1a')](_0x3f4c2e);}return _0x1529a4[_0xf05e('0x1b')](_0x3f4c2e)[_0xf05e('0x1c')]();};}function respondWithResult(_0x54cc02,_0x49ce4e){_0x49ce4e=_0x49ce4e||0xc8;return function(_0x596483){if(_0x596483){return _0x54cc02['status'](_0x49ce4e)[_0xf05e('0x1d')](_0x596483);}};}function respondWithFilteredResult(_0x359a99,_0x44f837){return function(_0x245968){if(_0x245968){var _0x375af2=typeof _0x44f837[_0xf05e('0x1e')]===_0xf05e('0x1f')&&typeof _0x44f837[_0xf05e('0x20')]==='undefined';var _0x546ba1=_0x245968[_0xf05e('0x21')];var _0x767218=_0x375af2?0x0:_0x44f837[_0xf05e('0x1e')];var _0x493e3d=_0x375af2?_0x245968['count']:_0x44f837[_0xf05e('0x1e')]+_0x44f837[_0xf05e('0x20')];var _0xd61178;if(_0x493e3d>=_0x546ba1){_0x493e3d=_0x546ba1;_0xd61178=0xc8;}else{_0xd61178=0xce;}_0x359a99[_0xf05e('0x1b')](_0xd61178);return _0x359a99[_0xf05e('0x22')](_0xf05e('0x23'),_0x767218+'-'+_0x493e3d+'/'+_0x546ba1)[_0xf05e('0x1d')](_0x245968);}return null;};}function patchUpdates(_0x25567a){return function(_0x4b5990){try{jsonpatch[_0xf05e('0x24')](_0x4b5990,_0x25567a,!![]);}catch(_0x423f72){return BPromise[_0xf05e('0x25')](_0x423f72);}return _0x4b5990[_0xf05e('0x26')]();};}function saveUpdates(_0x46351a,_0x5b5f41){return function(_0x10f95e){if(_0x10f95e){return _0x10f95e[_0xf05e('0x27')](_0x46351a)['then'](function(_0x3dad5c){return _0x3dad5c;});}return null;};}function removeEntity(_0x1bafb6,_0x538a36){return function(_0x3415b7){if(_0x3415b7){return _0x3415b7['destroy']()['then'](function(){var _0xaaadcb=_0x3415b7['get']({'plain':!![]});var _0x3e33ab='Templates';return db['UserProfileResource'][_0xf05e('0x28')]({'where':{'type':_0x3e33ab,'resourceId':_0xaaadcb['id']}})[_0xf05e('0x29')](function(){return _0x3415b7;});})[_0xf05e('0x29')](function(){_0x1bafb6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x305bed,_0x424060){return function(_0x4d92f1){if(!_0x4d92f1){_0x305bed[_0xf05e('0x1a')](0x194);}return _0x4d92f1;};}function handleError(_0x473774,_0x4218b2){_0x4218b2=_0x4218b2||0x1f4;return function(_0x43d46f){logger[_0xf05e('0x2a')](_0x43d46f[_0xf05e('0x2b')]);if(_0x43d46f[_0xf05e('0x2c')]){delete _0x43d46f['name'];}_0x473774[_0xf05e('0x1b')](_0x4218b2)['send'](_0x43d46f);};}exports[_0xf05e('0x2d')]=function(_0x11ab82,_0x4bc362){var _0x2afd94={},_0x302c21={},_0x3fec78={'count':0x0,'rows':[]};var _0x5342c8=_[_0xf05e('0x2e')](db[_0xf05e('0x2f')]['rawAttributes'],function(_0x4d40c9){return{'name':_0x4d40c9[_0xf05e('0x30')],'type':_0x4d40c9['type']['key']};});_0x302c21[_0xf05e('0x31')]=_['map'](_0x5342c8,_0xf05e('0x2c'));_0x302c21[_0xf05e('0x32')]=_[_0xf05e('0x33')](_0x11ab82[_0xf05e('0x32')]);_0x302c21['filters']=_[_0xf05e('0x34')](_0x302c21[_0xf05e('0x31')],_0x302c21[_0xf05e('0x32')]);_0x2afd94[_0xf05e('0x35')]=_['intersection'](_0x302c21[_0xf05e('0x31')],qs[_0xf05e('0x36')](_0x11ab82[_0xf05e('0x32')]['fields']));_0x2afd94['attributes']=_0x2afd94[_0xf05e('0x35')][_0xf05e('0x37')]?_0x2afd94[_0xf05e('0x35')]:_0x302c21[_0xf05e('0x31')];if(!_0x11ab82[_0xf05e('0x32')][_0xf05e('0x38')](_0xf05e('0x39'))){_0x2afd94[_0xf05e('0x20')]=qs[_0xf05e('0x20')](_0x11ab82[_0xf05e('0x32')][_0xf05e('0x20')]);_0x2afd94[_0xf05e('0x1e')]=qs[_0xf05e('0x1e')](_0x11ab82[_0xf05e('0x32')]['offset']);}_0x2afd94['order']=qs[_0xf05e('0x3a')](_0x11ab82[_0xf05e('0x32')]['sort']);_0x2afd94[_0xf05e('0x3b')]=qs['filters'](_['pick'](_0x11ab82['query'],_0x302c21[_0xf05e('0x3c')]),_0x5342c8);if(_0x11ab82[_0xf05e('0x32')][_0xf05e('0x3d')]){_0x2afd94[_0xf05e('0x3b')]=_[_0xf05e('0x3e')](_0x2afd94[_0xf05e('0x3b')],{'$or':_[_0xf05e('0x2e')](_0x5342c8,function(_0x4d1a39){if(_0x4d1a39[_0xf05e('0x3f')]!=='VIRTUAL'){var _0x25e130={};_0x25e130[_0x4d1a39[_0xf05e('0x2c')]]={'$like':'%'+_0x11ab82[_0xf05e('0x32')][_0xf05e('0x3d')]+'%'};return _0x25e130;}})});}_0x2afd94=_[_0xf05e('0x3e')]({},_0x2afd94,_0x11ab82[_0xf05e('0x40')]);var _0x386ccd={'where':_0x2afd94['where']};return db['Template']['count'](_0x386ccd)['then'](function(_0x5d5b8a){_0x3fec78['count']=_0x5d5b8a;if(_0x11ab82[_0xf05e('0x32')][_0xf05e('0x41')]){_0x2afd94[_0xf05e('0x42')]=[{'all':!![]}];}return db[_0xf05e('0x2f')][_0xf05e('0x43')](_0x2afd94);})[_0xf05e('0x29')](function(_0x5614b8){_0x3fec78[_0xf05e('0x44')]=_0x5614b8;return _0x3fec78;})[_0xf05e('0x29')](respondWithFilteredResult(_0x4bc362,_0x2afd94))[_0xf05e('0x45')](handleError(_0x4bc362,null));};exports[_0xf05e('0x46')]=function(_0x24c99c,_0x33b81d){var _0x288f10={'raw':!![],'where':{'id':_0x24c99c[_0xf05e('0x47')]['id']}},_0x269e25={};_0x269e25['model']=_[_0xf05e('0x33')](db[_0xf05e('0x2f')][_0xf05e('0x48')]);_0x269e25['query']=_[_0xf05e('0x33')](_0x24c99c[_0xf05e('0x32')]);_0x269e25[_0xf05e('0x3c')]=_[_0xf05e('0x34')](_0x269e25[_0xf05e('0x31')],_0x269e25[_0xf05e('0x32')]);_0x288f10[_0xf05e('0x35')]=_[_0xf05e('0x34')](_0x269e25[_0xf05e('0x31')],qs[_0xf05e('0x36')](_0x24c99c[_0xf05e('0x32')]['fields']));_0x288f10[_0xf05e('0x35')]=_0x288f10[_0xf05e('0x35')]['length']?_0x288f10[_0xf05e('0x35')]:_0x269e25[_0xf05e('0x31')];if(_0x24c99c[_0xf05e('0x32')][_0xf05e('0x41')]){_0x288f10[_0xf05e('0x42')]=[{'all':!![]}];}_0x288f10=_[_0xf05e('0x3e')]({},_0x288f10,_0x24c99c[_0xf05e('0x40')]);return db['Template']['find'](_0x288f10)['then'](handleEntityNotFound(_0x33b81d,null))['then'](respondWithResult(_0x33b81d,null))[_0xf05e('0x45')](handleError(_0x33b81d,null));};exports[_0xf05e('0x49')]=function(_0x410a6d,_0x245a3f){return db[_0xf05e('0x2f')][_0xf05e('0x49')](_0x410a6d[_0xf05e('0x4a')],{})[_0xf05e('0x29')](function(_0x23d293){var _0x181d13=_0x410a6d[_0xf05e('0x4b')][_0xf05e('0x4c')]({'plain':!![]});if(!_0x181d13)throw new Error(_0xf05e('0x4d'));if(_0x181d13[_0xf05e('0x4e')]===_0xf05e('0x4b')){var _0x5bbc10=_0x23d293[_0xf05e('0x4c')]({'plain':!![]});var _0x5720f2=_0xf05e('0x4f');return db[_0xf05e('0x50')][_0xf05e('0x51')]({'where':{'name':_0x5720f2,'userProfileId':_0x181d13[_0xf05e('0x52')]},'raw':!![]})[_0xf05e('0x29')](function(_0xbef5c0){if(_0xbef5c0&&_0xbef5c0['autoAssociation']===0x0){return db[_0xf05e('0x53')]['create']({'name':_0x5bbc10[_0xf05e('0x2c')],'resourceId':_0x5bbc10['id'],'type':_0xbef5c0[_0xf05e('0x2c')],'sectionId':_0xbef5c0['id']},{})['then'](function(){return _0x23d293;});}else{return _0x23d293;}})[_0xf05e('0x45')](function(_0x28e84e){logger['error'](_0xf05e('0x54'),_0x28e84e);throw _0x28e84e;});}return _0x23d293;})[_0xf05e('0x29')](respondWithResult(_0x245a3f,0xc9))['catch'](handleError(_0x245a3f,null));};exports[_0xf05e('0x27')]=function(_0x23ef70,_0x1c05a6){if(_0x23ef70[_0xf05e('0x4a')]['id']){delete _0x23ef70['body']['id'];}return db[_0xf05e('0x2f')]['find']({'where':{'id':_0x23ef70[_0xf05e('0x47')]['id']}})[_0xf05e('0x29')](handleEntityNotFound(_0x1c05a6,null))[_0xf05e('0x29')](saveUpdates(_0x23ef70[_0xf05e('0x4a')],null))[_0xf05e('0x29')](respondWithResult(_0x1c05a6,null))[_0xf05e('0x45')](handleError(_0x1c05a6,null));};exports['destroy']=function(_0x120f88,_0x2aa667){return db[_0xf05e('0x2f')][_0xf05e('0x51')]({'where':{'id':_0x120f88[_0xf05e('0x47')]['id']}})[_0xf05e('0x29')](handleEntityNotFound(_0x2aa667,null))[_0xf05e('0x29')](removeEntity(_0x2aa667,null))['catch'](handleError(_0x2aa667,null));}; \ No newline at end of file +var _0x4b60=['offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','get','Templates','UserProfileResource','then','sendStatus','error','send','index','Template','rawAttributes','fieldName','type','key','model','map','name','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','length','include','find','create','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json'];(function(_0x24bcd8,_0x54f8d6){var _0x2cabab=function(_0x18bb81){while(--_0x18bb81){_0x24bcd8['push'](_0x24bcd8['shift']());}};_0x2cabab(++_0x54f8d6);}(_0x4b60,0x187));var _0x04b6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4b60[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x04b6('0x0'));var rimraf=require(_0x04b6('0x1'));var zipdir=require(_0x04b6('0x2'));var jsonpatch=require(_0x04b6('0x3'));var rp=require(_0x04b6('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x04b6('0x5'));var util=require(_0x04b6('0x6'));var path=require(_0x04b6('0x7'));var sox=require(_0x04b6('0x8'));var csv=require('to-csv');var ejs=require(_0x04b6('0x9'));var fs=require('fs');var fs_extra=require(_0x04b6('0xa'));var _=require(_0x04b6('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x04b6('0xc'));var deskjs=require(_0x04b6('0xd'));var toCsv=require(_0x04b6('0xe'));var querystring=require(_0x04b6('0xf'));var Papa=require('papaparse');var Redis=require(_0x04b6('0x10'));var authService=require(_0x04b6('0x11'));var qs=require(_0x04b6('0x12'));var as=require(_0x04b6('0x13'));var hardwareService=require(_0x04b6('0x14'));var logger=require('../../config/logger')(_0x04b6('0x15'));var utils=require(_0x04b6('0x16'));var config=require(_0x04b6('0x17'));var licenseUtil=require(_0x04b6('0x18'));var db=require(_0x04b6('0x19'))['db'];function respondWithStatusCode(_0x4a8b9e,_0x33ff0c){_0x33ff0c=_0x33ff0c||0xcc;return function(_0x1fdded){if(_0x1fdded){return _0x4a8b9e['sendStatus'](_0x33ff0c);}return _0x4a8b9e[_0x04b6('0x1a')](_0x33ff0c)[_0x04b6('0x1b')]();};}function respondWithResult(_0x4e574c,_0x340bac){_0x340bac=_0x340bac||0xc8;return function(_0x384e63){if(_0x384e63){return _0x4e574c[_0x04b6('0x1a')](_0x340bac)[_0x04b6('0x1c')](_0x384e63);}};}function respondWithFilteredResult(_0x2e7587,_0x314611){return function(_0x33f51f){if(_0x33f51f){var _0x24798d=typeof _0x314611[_0x04b6('0x1d')]===_0x04b6('0x1e')&&typeof _0x314611['limit']===_0x04b6('0x1e');var _0x1b5e13=_0x33f51f['count'];var _0x395be5=_0x24798d?0x0:_0x314611[_0x04b6('0x1d')];var _0x4930de=_0x24798d?_0x33f51f[_0x04b6('0x1f')]:_0x314611['offset']+_0x314611['limit'];var _0x59d15b;if(_0x4930de>=_0x1b5e13){_0x4930de=_0x1b5e13;_0x59d15b=0xc8;}else{_0x59d15b=0xce;}_0x2e7587[_0x04b6('0x1a')](_0x59d15b);return _0x2e7587[_0x04b6('0x20')](_0x04b6('0x21'),_0x395be5+'-'+_0x4930de+'/'+_0x1b5e13)[_0x04b6('0x1c')](_0x33f51f);}return null;};}function patchUpdates(_0x2608cf){return function(_0x340cec){try{jsonpatch[_0x04b6('0x22')](_0x340cec,_0x2608cf,!![]);}catch(_0x573396){return BPromise[_0x04b6('0x23')](_0x573396);}return _0x340cec[_0x04b6('0x24')]();};}function saveUpdates(_0x4a4655,_0x26a749){return function(_0x466f93){if(_0x466f93){return _0x466f93[_0x04b6('0x25')](_0x4a4655)['then'](function(_0x26e696){return _0x26e696;});}return null;};}function removeEntity(_0xe4ebb4,_0x42db9f){return function(_0x4153ea){if(_0x4153ea){return _0x4153ea[_0x04b6('0x26')]()['then'](function(){var _0x2ea730=_0x4153ea[_0x04b6('0x27')]({'plain':!![]});var _0x25d4c4=_0x04b6('0x28');return db[_0x04b6('0x29')][_0x04b6('0x26')]({'where':{'type':_0x25d4c4,'resourceId':_0x2ea730['id']}})[_0x04b6('0x2a')](function(){return _0x4153ea;});})[_0x04b6('0x2a')](function(){_0xe4ebb4[_0x04b6('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47ffdd,_0x2efce3){return function(_0x3ec3df){if(!_0x3ec3df){_0x47ffdd[_0x04b6('0x2b')](0x194);}return _0x3ec3df;};}function handleError(_0x2ddbde,_0x45371c){_0x45371c=_0x45371c||0x1f4;return function(_0x358c3f){logger[_0x04b6('0x2c')](_0x358c3f['stack']);if(_0x358c3f['name']){delete _0x358c3f['name'];}_0x2ddbde['status'](_0x45371c)[_0x04b6('0x2d')](_0x358c3f);};}exports[_0x04b6('0x2e')]=function(_0x526ed1,_0x4536c8){var _0x2cb7df={},_0x23b29e={},_0x26d1c7={'count':0x0,'rows':[]};var _0x24bddd=_['map'](db[_0x04b6('0x2f')][_0x04b6('0x30')],function(_0x4455e7){return{'name':_0x4455e7[_0x04b6('0x31')],'type':_0x4455e7[_0x04b6('0x32')][_0x04b6('0x33')]};});_0x23b29e[_0x04b6('0x34')]=_[_0x04b6('0x35')](_0x24bddd,_0x04b6('0x36'));_0x23b29e['query']=_[_0x04b6('0x37')](_0x526ed1[_0x04b6('0x38')]);_0x23b29e[_0x04b6('0x39')]=_[_0x04b6('0x3a')](_0x23b29e['model'],_0x23b29e[_0x04b6('0x38')]);_0x2cb7df[_0x04b6('0x3b')]=_['intersection'](_0x23b29e[_0x04b6('0x34')],qs[_0x04b6('0x3c')](_0x526ed1[_0x04b6('0x38')]['fields']));_0x2cb7df[_0x04b6('0x3b')]=_0x2cb7df[_0x04b6('0x3b')]['length']?_0x2cb7df['attributes']:_0x23b29e['model'];if(!_0x526ed1[_0x04b6('0x38')][_0x04b6('0x3d')](_0x04b6('0x3e'))){_0x2cb7df['limit']=qs['limit'](_0x526ed1[_0x04b6('0x38')]['limit']);_0x2cb7df[_0x04b6('0x1d')]=qs['offset'](_0x526ed1[_0x04b6('0x38')]['offset']);}_0x2cb7df[_0x04b6('0x3f')]=qs['sort'](_0x526ed1[_0x04b6('0x38')][_0x04b6('0x40')]);_0x2cb7df[_0x04b6('0x41')]=qs[_0x04b6('0x39')](_[_0x04b6('0x42')](_0x526ed1[_0x04b6('0x38')],_0x23b29e[_0x04b6('0x39')]),_0x24bddd);if(_0x526ed1[_0x04b6('0x38')]['filter']){_0x2cb7df[_0x04b6('0x41')]=_[_0x04b6('0x43')](_0x2cb7df['where'],{'$or':_[_0x04b6('0x35')](_0x24bddd,function(_0x1390f7){if(_0x1390f7[_0x04b6('0x32')]!==_0x04b6('0x44')){var _0x298fd6={};_0x298fd6[_0x1390f7[_0x04b6('0x36')]]={'$like':'%'+_0x526ed1[_0x04b6('0x38')]['filter']+'%'};return _0x298fd6;}})});}_0x2cb7df=_[_0x04b6('0x43')]({},_0x2cb7df,_0x526ed1[_0x04b6('0x45')]);var _0x3a47d1={'where':_0x2cb7df['where']};return db['Template'][_0x04b6('0x1f')](_0x3a47d1)[_0x04b6('0x2a')](function(_0x5cfd9a){_0x26d1c7[_0x04b6('0x1f')]=_0x5cfd9a;if(_0x526ed1[_0x04b6('0x38')][_0x04b6('0x46')]){_0x2cb7df['include']=[{'all':!![]}];}return db[_0x04b6('0x2f')][_0x04b6('0x47')](_0x2cb7df);})[_0x04b6('0x2a')](function(_0x5c4706){_0x26d1c7[_0x04b6('0x48')]=_0x5c4706;return _0x26d1c7;})[_0x04b6('0x2a')](respondWithFilteredResult(_0x4536c8,_0x2cb7df))[_0x04b6('0x49')](handleError(_0x4536c8,null));};exports['show']=function(_0x145a82,_0x39a437){var _0x3971ed={'raw':!![],'where':{'id':_0x145a82['params']['id']}},_0x2d61dd={};_0x2d61dd['model']=_[_0x04b6('0x37')](db[_0x04b6('0x2f')][_0x04b6('0x30')]);_0x2d61dd[_0x04b6('0x38')]=_[_0x04b6('0x37')](_0x145a82['query']);_0x2d61dd[_0x04b6('0x39')]=_[_0x04b6('0x3a')](_0x2d61dd[_0x04b6('0x34')],_0x2d61dd[_0x04b6('0x38')]);_0x3971ed[_0x04b6('0x3b')]=_['intersection'](_0x2d61dd['model'],qs[_0x04b6('0x3c')](_0x145a82['query'][_0x04b6('0x3c')]));_0x3971ed[_0x04b6('0x3b')]=_0x3971ed[_0x04b6('0x3b')][_0x04b6('0x4a')]?_0x3971ed[_0x04b6('0x3b')]:_0x2d61dd[_0x04b6('0x34')];if(_0x145a82[_0x04b6('0x38')][_0x04b6('0x46')]){_0x3971ed[_0x04b6('0x4b')]=[{'all':!![]}];}_0x3971ed=_[_0x04b6('0x43')]({},_0x3971ed,_0x145a82[_0x04b6('0x45')]);return db[_0x04b6('0x2f')][_0x04b6('0x4c')](_0x3971ed)[_0x04b6('0x2a')](handleEntityNotFound(_0x39a437,null))['then'](respondWithResult(_0x39a437,null))[_0x04b6('0x49')](handleError(_0x39a437,null));};exports[_0x04b6('0x4d')]=function(_0x1a77aa,_0x54c94b){return db[_0x04b6('0x2f')][_0x04b6('0x4d')](_0x1a77aa['body'],{})[_0x04b6('0x2a')](function(_0x5ee0ba){var _0x90841=_0x1a77aa[_0x04b6('0x4e')][_0x04b6('0x27')]({'plain':!![]});if(!_0x90841)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x90841['role']===_0x04b6('0x4e')){var _0x3c7996=_0x5ee0ba['get']({'plain':!![]});var _0x51ca3f=_0x04b6('0x28');return db[_0x04b6('0x4f')][_0x04b6('0x4c')]({'where':{'name':_0x51ca3f,'userProfileId':_0x90841['userProfileId']},'raw':!![]})['then'](function(_0x20fd12){if(_0x20fd12&&_0x20fd12[_0x04b6('0x50')]===0x0){return db[_0x04b6('0x29')][_0x04b6('0x4d')]({'name':_0x3c7996[_0x04b6('0x36')],'resourceId':_0x3c7996['id'],'type':_0x20fd12[_0x04b6('0x36')],'sectionId':_0x20fd12['id']},{})[_0x04b6('0x2a')](function(){return _0x5ee0ba;});}else{return _0x5ee0ba;}})[_0x04b6('0x49')](function(_0x39e097){logger['error'](_0x04b6('0x51'),_0x39e097);throw _0x39e097;});}return _0x5ee0ba;})[_0x04b6('0x2a')](respondWithResult(_0x54c94b,0xc9))[_0x04b6('0x49')](handleError(_0x54c94b,null));};exports[_0x04b6('0x25')]=function(_0x5511a7,_0x2ffc93){if(_0x5511a7[_0x04b6('0x52')]['id']){delete _0x5511a7['body']['id'];}return db[_0x04b6('0x2f')]['find']({'where':{'id':_0x5511a7[_0x04b6('0x53')]['id']}})[_0x04b6('0x2a')](handleEntityNotFound(_0x2ffc93,null))[_0x04b6('0x2a')](saveUpdates(_0x5511a7['body'],null))[_0x04b6('0x2a')](respondWithResult(_0x2ffc93,null))['catch'](handleError(_0x2ffc93,null));};exports[_0x04b6('0x26')]=function(_0x2adaaa,_0x18f29e){return db[_0x04b6('0x2f')][_0x04b6('0x4c')]({'where':{'id':_0x2adaaa[_0x04b6('0x53')]['id']}})[_0x04b6('0x2a')](handleEntityNotFound(_0x18f29e,null))[_0x04b6('0x2a')](removeEntity(_0x18f29e,null))[_0x04b6('0x49')](handleError(_0x18f29e,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index e8d9e8c..00a4ad3 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 _0xcf52=['tools_templates','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./template.attributes','exports','define'];(function(_0x469da9,_0x37a5e0){var _0x63f0ca=function(_0x427913){while(--_0x427913){_0x469da9['push'](_0x469da9['shift']());}};_0x63f0ca(++_0x37a5e0);}(_0xcf52,0xb5));var _0x2cf5=function(_0x5a0aa6,_0x399b13){_0x5a0aa6=_0x5a0aa6-0x0;var _0x577dea=_0xcf52[_0x5a0aa6];return _0x577dea;};'use strict';var _=require(_0x2cf5('0x0'));var util=require(_0x2cf5('0x1'));var logger=require(_0x2cf5('0x2'))(_0x2cf5('0x3'));var moment=require(_0x2cf5('0x4'));var BPromise=require(_0x2cf5('0x5'));var rp=require(_0x2cf5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2cf5('0x7'));var attributes=require(_0x2cf5('0x8'));module[_0x2cf5('0x9')]=function(_0x1d93b4,_0x35c176){return _0x1d93b4[_0x2cf5('0xa')]('Template',attributes,{'tableName':_0x2cf5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80e4=['tools_templates','lodash','util','api','moment','path','rimraf','../../config/environment','./template.attributes','define'];(function(_0x4a6856,_0x51976d){var _0x537bbb=function(_0x1db2bd){while(--_0x1db2bd){_0x4a6856['push'](_0x4a6856['shift']());}};_0x537bbb(++_0x51976d);}(_0x80e4,0x169));var _0x480e=function(_0x6dd5c,_0x4bfc19){_0x6dd5c=_0x6dd5c-0x0;var _0x5a87fa=_0x80e4[_0x6dd5c];return _0x5a87fa;};'use strict';var _=require(_0x480e('0x0'));var util=require(_0x480e('0x1'));var logger=require('../../config/logger')(_0x480e('0x2'));var moment=require(_0x480e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x480e('0x4'));var rimraf=require(_0x480e('0x5'));var config=require(_0x480e('0x6'));var attributes=require(_0x480e('0x7'));module['exports']=function(_0x3c0ab8,_0x520cec){return _0x3c0ab8[_0x480e('0x8')]('Template',attributes,{'tableName':_0x480e('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 9fc7d3c..a702c30 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 _0x7f39=['then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetTemplate','Template','options','where','attributes','limit','include','map','model','stringify','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x3d351f,_0xf83131){var _0x2717c7=function(_0x44203e){while(--_0x44203e){_0x3d351f['push'](_0x3d351f['shift']());}};_0x2717c7(++_0xf83131);}(_0x7f39,0xfc));var _0x97f3=function(_0x23cd34,_0xe7e8f7){_0x23cd34=_0x23cd34-0x0;var _0x1e1e48=_0x7f39[_0x23cd34];return _0x1e1e48;};'use strict';var _=require(_0x97f3('0x0'));var util=require('util');var moment=require(_0x97f3('0x1'));var BPromise=require('bluebird');var rs=require(_0x97f3('0x2'));var fs=require('fs');var Redis=require(_0x97f3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x97f3('0x4'));var logger=require(_0x97f3('0x5'))('rpc');var config=require(_0x97f3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x97f3('0x7')][_0x97f3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d0ec1,_0x9a27bd,_0x54958d){return new BPromise(function(_0x9894a1,_0x6985a9){return client['request'](_0x5d0ec1,_0x54958d)[_0x97f3('0x9')](function(_0x91fc07){logger[_0x97f3('0xa')](_0x97f3('0xb'),_0x9a27bd,_0x97f3('0xc'));logger[_0x97f3('0xd')](_0x97f3('0xe'),_0x9a27bd,_0x97f3('0xc'),JSON['stringify'](_0x91fc07));if(_0x91fc07[_0x97f3('0xf')]){if(_0x91fc07[_0x97f3('0xf')]['code']===0x1f4){logger[_0x97f3('0xf')](_0x97f3('0xb'),_0x9a27bd,_0x91fc07[_0x97f3('0xf')][_0x97f3('0x10')]);return _0x6985a9(_0x91fc07[_0x97f3('0xf')][_0x97f3('0x10')]);}logger[_0x97f3('0xf')]('Template,\x20%s,\x20%s',_0x9a27bd,_0x91fc07[_0x97f3('0xf')]['message']);return _0x9894a1(_0x91fc07[_0x97f3('0xf')][_0x97f3('0x10')]);}else{logger[_0x97f3('0xa')]('Template,\x20%s,\x20%s',_0x9a27bd,_0x97f3('0xc'));_0x9894a1(_0x91fc07[_0x97f3('0x11')]['message']);}})[_0x97f3('0x12')](function(_0x5a4eff){logger['error']('Template,\x20%s,\x20%s',_0x9a27bd,_0x5a4eff);_0x6985a9(_0x5a4eff);});});}exports[_0x97f3('0x13')]=function(_0x584aa1){var _0x3a29fa=this;return new Promise(function(_0x3ccaf6,_0x318531){return db[_0x97f3('0x14')]['findAll']({'raw':_0x584aa1['options']?_0x584aa1[_0x97f3('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x584aa1[_0x97f3('0x15')]?_0x584aa1['options'][_0x97f3('0x16')]||null:null,'attributes':_0x584aa1[_0x97f3('0x15')]?_0x584aa1[_0x97f3('0x15')][_0x97f3('0x17')]||null:null,'limit':_0x584aa1[_0x97f3('0x15')]?_0x584aa1[_0x97f3('0x15')][_0x97f3('0x18')]||null:null,'include':_0x584aa1[_0x97f3('0x15')]?_0x584aa1[_0x97f3('0x15')][_0x97f3('0x19')]?_[_0x97f3('0x1a')](_0x584aa1[_0x97f3('0x15')][_0x97f3('0x19')],function(_0x40be5b){return{'model':db[_0x40be5b[_0x97f3('0x1b')]],'as':_0x40be5b['as'],'attributes':_0x40be5b[_0x97f3('0x17')],'include':_0x40be5b[_0x97f3('0x19')]?_[_0x97f3('0x1a')](_0x40be5b[_0x97f3('0x19')],function(_0x515127){return{'model':db[_0x515127[_0x97f3('0x1b')]],'as':_0x515127['as'],'attributes':_0x515127['attributes'],'include':_0x515127[_0x97f3('0x19')]?_[_0x97f3('0x1a')](_0x515127[_0x97f3('0x19')],function(_0x58b286){return{'model':db[_0x58b286[_0x97f3('0x1b')]],'as':_0x58b286['as'],'attributes':_0x58b286[_0x97f3('0x17')]};}):[]};}):[]};}):[]:[]})[_0x97f3('0x9')](function(_0x4ca36e){logger[_0x97f3('0xa')](_0x97f3('0x13'),_0x584aa1);logger[_0x97f3('0xd')](_0x97f3('0x13'),_0x584aa1,JSON[_0x97f3('0x1c')](_0x4ca36e));_0x3ccaf6(_0x4ca36e);})[_0x97f3('0x12')](function(_0x4cc1ec){logger[_0x97f3('0xf')](_0x97f3('0x13'),_0x4cc1ec['message'],_0x584aa1);_0x318531(_0x3a29fa[_0x97f3('0xf')](0x1f4,_0x4cc1ec[_0x97f3('0x10')]));});});}; \ No newline at end of file +var _0x8d00=['model','attributes','map','GetTemplate','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code','Template,\x20%s,\x20%s','message','result','Template','options','raw','limit','include'];(function(_0x33677a,_0x2af28a){var _0x81ded8=function(_0x1aa6d9){while(--_0x1aa6d9){_0x33677a['push'](_0x33677a['shift']());}};_0x81ded8(++_0x2af28a);}(_0x8d00,0x198));var _0x08d0=function(_0x53054e,_0x454c8e){_0x53054e=_0x53054e-0x0;var _0x147b3f=_0x8d00[_0x53054e];return _0x147b3f;};'use strict';var _=require(_0x08d0('0x0'));var util=require('util');var moment=require(_0x08d0('0x1'));var BPromise=require(_0x08d0('0x2'));var rs=require(_0x08d0('0x3'));var fs=require('fs');var Redis=require(_0x08d0('0x4'));var db=require(_0x08d0('0x5'))['db'];var utils=require(_0x08d0('0x6'));var logger=require(_0x08d0('0x7'))(_0x08d0('0x8'));var config=require(_0x08d0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x08d0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a11e,_0xe82e61,_0x32c50c){return new BPromise(function(_0x50c5b5,_0x32cadd){return client[_0x08d0('0xb')](_0x41a11e,_0x32c50c)['then'](function(_0x17c6e8){logger[_0x08d0('0xc')]('Template,\x20%s,\x20%s',_0xe82e61,_0x08d0('0xd'));logger[_0x08d0('0xe')](_0x08d0('0xf'),_0xe82e61,_0x08d0('0xd'),JSON['stringify'](_0x17c6e8));if(_0x17c6e8[_0x08d0('0x10')]){if(_0x17c6e8['error'][_0x08d0('0x11')]===0x1f4){logger['error'](_0x08d0('0x12'),_0xe82e61,_0x17c6e8['error'][_0x08d0('0x13')]);return _0x32cadd(_0x17c6e8['error'][_0x08d0('0x13')]);}logger['error'](_0x08d0('0x12'),_0xe82e61,_0x17c6e8['error'][_0x08d0('0x13')]);return _0x50c5b5(_0x17c6e8[_0x08d0('0x10')][_0x08d0('0x13')]);}else{logger['info'](_0x08d0('0x12'),_0xe82e61,_0x08d0('0xd'));_0x50c5b5(_0x17c6e8[_0x08d0('0x14')][_0x08d0('0x13')]);}})['catch'](function(_0x808a83){logger['error']('Template,\x20%s,\x20%s',_0xe82e61,_0x808a83);_0x32cadd(_0x808a83);});});}exports['GetTemplate']=function(_0x1da030){var _0x5c27bc=this;return new Promise(function(_0xf3a92b,_0x501efd){return db[_0x08d0('0x15')]['findAll']({'raw':_0x1da030[_0x08d0('0x16')]?_0x1da030[_0x08d0('0x16')][_0x08d0('0x17')]===undefined?!![]:![]:!![],'where':_0x1da030['options']?_0x1da030[_0x08d0('0x16')]['where']||null:null,'attributes':_0x1da030['options']?_0x1da030[_0x08d0('0x16')]['attributes']||null:null,'limit':_0x1da030['options']?_0x1da030['options'][_0x08d0('0x18')]||null:null,'include':_0x1da030['options']?_0x1da030[_0x08d0('0x16')][_0x08d0('0x19')]?_['map'](_0x1da030[_0x08d0('0x16')][_0x08d0('0x19')],function(_0x36323f){return{'model':db[_0x36323f[_0x08d0('0x1a')]],'as':_0x36323f['as'],'attributes':_0x36323f[_0x08d0('0x1b')],'include':_0x36323f[_0x08d0('0x19')]?_[_0x08d0('0x1c')](_0x36323f[_0x08d0('0x19')],function(_0x150222){return{'model':db[_0x150222[_0x08d0('0x1a')]],'as':_0x150222['as'],'attributes':_0x150222[_0x08d0('0x1b')],'include':_0x150222['include']?_['map'](_0x150222['include'],function(_0x3168d6){return{'model':db[_0x3168d6[_0x08d0('0x1a')]],'as':_0x3168d6['as'],'attributes':_0x3168d6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x193c43){logger[_0x08d0('0xc')](_0x08d0('0x1d'),_0x1da030);logger[_0x08d0('0xe')](_0x08d0('0x1d'),_0x1da030,JSON['stringify'](_0x193c43));_0xf3a92b(_0x193c43);})[_0x08d0('0x1e')](function(_0x1f1222){logger[_0x08d0('0x10')]('GetTemplate',_0x1f1222[_0x08d0('0x13')],_0x1da030);_0x501efd(_0x5c27bc['error'](0x1f4,_0x1f1222['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index fa64a84..db15e36 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 _0x9a89=['index','show','/:id/all_conditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','addAction','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x30faee,_0x1c3794){var _0x3a90ab=function(_0x11129b){while(--_0x11129b){_0x30faee['push'](_0x30faee['shift']());}};_0x3a90ab(++_0x1c3794);}(_0x9a89,0xce));var _0x99a8=function(_0x13bf1f,_0x257897){_0x13bf1f=_0x13bf1f-0x0;var _0x195dc5=_0x9a89[_0x13bf1f];return _0x195dc5;};'use strict';var multer=require(_0x99a8('0x0'));var util=require(_0x99a8('0x1'));var path=require(_0x99a8('0x2'));var timeout=require(_0x99a8('0x3'));var express=require(_0x99a8('0x4'));var router=express['Router']();var fs_extra=require(_0x99a8('0x5'));var auth=require(_0x99a8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x99a8('0x7'));var controller=require('./trigger.controller');router[_0x99a8('0x8')]('/',auth[_0x99a8('0x9')](),controller[_0x99a8('0xa')]);router[_0x99a8('0x8')]('/:id',auth[_0x99a8('0x9')](),controller[_0x99a8('0xb')]);router['get'](_0x99a8('0xc'),auth['isAuthenticated'](),controller['getAllConditions']);router[_0x99a8('0x8')](_0x99a8('0xd'),auth[_0x99a8('0x9')](),controller[_0x99a8('0xe')]);router[_0x99a8('0x8')](_0x99a8('0xf'),auth[_0x99a8('0x9')](),controller[_0x99a8('0x10')]);router[_0x99a8('0x11')]('/',auth[_0x99a8('0x9')](),controller[_0x99a8('0x12')]);router['post'](_0x99a8('0xc'),auth[_0x99a8('0x9')](),controller[_0x99a8('0x13')]);router['post'](_0x99a8('0xd'),auth[_0x99a8('0x9')](),controller[_0x99a8('0x14')]);router[_0x99a8('0x11')](_0x99a8('0xf'),auth[_0x99a8('0x9')](),controller[_0x99a8('0x15')]);router[_0x99a8('0x16')](_0x99a8('0x17'),auth[_0x99a8('0x9')](),controller[_0x99a8('0x18')]);router[_0x99a8('0x19')](_0x99a8('0x17'),auth['isAuthenticated'](),controller['destroy']);module[_0x99a8('0x1a')]=router; \ No newline at end of file +var _0x0d40=['get','/:id','isAuthenticated','show','/:id/all_conditions','getAllConditions','getAnyConditions','/:id/actions','getActions','post','create','addAnyCondition','addAction','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller'];(function(_0x15de6a,_0xb1b042){var _0x66bfc0=function(_0x148bb4){while(--_0x148bb4){_0x15de6a['push'](_0x15de6a['shift']());}};_0x66bfc0(++_0xb1b042);}(_0x0d40,0xac));var _0x00d4=function(_0x493c7a,_0x30ea93){_0x493c7a=_0x493c7a-0x0;var _0x1ad499=_0x0d40[_0x493c7a];return _0x1ad499;};'use strict';var multer=require(_0x00d4('0x0'));var util=require(_0x00d4('0x1'));var path=require(_0x00d4('0x2'));var timeout=require('connect-timeout');var express=require(_0x00d4('0x3'));var router=express[_0x00d4('0x4')]();var fs_extra=require(_0x00d4('0x5'));var auth=require(_0x00d4('0x6'));var interaction=require(_0x00d4('0x7'));var config=require(_0x00d4('0x8'));var controller=require(_0x00d4('0x9'));router[_0x00d4('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x00d4('0xa')](_0x00d4('0xb'),auth[_0x00d4('0xc')](),controller[_0x00d4('0xd')]);router['get'](_0x00d4('0xe'),auth['isAuthenticated'](),controller[_0x00d4('0xf')]);router[_0x00d4('0xa')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0x00d4('0x10')]);router[_0x00d4('0xa')](_0x00d4('0x11'),auth['isAuthenticated'](),controller[_0x00d4('0x12')]);router[_0x00d4('0x13')]('/',auth[_0x00d4('0xc')](),controller[_0x00d4('0x14')]);router[_0x00d4('0x13')]('/:id/all_conditions',auth[_0x00d4('0xc')](),controller['addAllCondition']);router['post']('/:id/any_conditions',auth[_0x00d4('0xc')](),controller[_0x00d4('0x15')]);router[_0x00d4('0x13')](_0x00d4('0x11'),auth[_0x00d4('0xc')](),controller[_0x00d4('0x16')]);router[_0x00d4('0x17')](_0x00d4('0xb'),auth[_0x00d4('0xc')](),controller['update']);router['delete'](_0x00d4('0xb'),auth['isAuthenticated'](),controller[_0x00d4('0x18')]);module[_0x00d4('0x19')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index a46c473..459d88d 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 _0xffbc=['STRING','sequelize','exports'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xffbc,0x142));var _0xcffb=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xffbc[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0xcffb('0x0'));module[_0xcffb('0x1')]={'name':{'type':Sequelize[_0xcffb('0x2')]},'channel':{'type':Sequelize[_0xcffb('0x2')]},'description':{'type':Sequelize[_0xcffb('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xd9ce=['exports','STRING','BOOLEAN'];(function(_0x163bc9,_0x4b6796){var _0xb94e42=function(_0x3529e3){while(--_0x3529e3){_0x163bc9['push'](_0x163bc9['shift']());}};_0xb94e42(++_0x4b6796);}(_0xd9ce,0x1da));var _0xed9c=function(_0xcfeff4,_0x3f2e19){_0xcfeff4=_0xcfeff4-0x0;var _0xb2fadc=_0xd9ce[_0xcfeff4];return _0xb2fadc;};'use strict';var Sequelize=require('sequelize');module[_0xed9c('0x0')]={'name':{'type':Sequelize[_0xed9c('0x1')]},'channel':{'type':Sequelize[_0xed9c('0x1')]},'description':{'type':Sequelize[_0xed9c('0x1')]},'status':{'type':Sequelize[_0xed9c('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 0d168be..dc1ca1d 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 _0xe0ca=['path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','destroy','get','Triggers','UserProfileResource','error','stack','name','send','map','Trigger','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','merge','options','includeAll','include','catch','rawAttributes','find','create','user','role','UserProfileSection','autoAssociation','body','addAllCondition','params','TriggerAllId','Condition','TriggerAnyId','getAllConditions','findOne','order','hasOwnProperty','getAnyConditions','addAction','TriggerId','getActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x553956,_0x57a991){var _0x2e4172=function(_0x2b5dda){while(--_0x2b5dda){_0x553956['push'](_0x553956['shift']());}};_0x2e4172(++_0x57a991);}(_0xe0ca,0xab));var _0xae0c=function(_0x20c893,_0xbef2b4){_0x20c893=_0x20c893-0x0;var _0xc705e8=_0xe0ca[_0x20c893];return _0xc705e8;};'use strict';var emlformat=require(_0xae0c('0x0'));var rimraf=require(_0xae0c('0x1'));var zipdir=require(_0xae0c('0x2'));var jsonpatch=require(_0xae0c('0x3'));var rp=require(_0xae0c('0x4'));var moment=require(_0xae0c('0x5'));var BPromise=require(_0xae0c('0x6'));var Mustache=require(_0xae0c('0x7'));var util=require(_0xae0c('0x8'));var path=require(_0xae0c('0x9'));var sox=require(_0xae0c('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xae0c('0xb'));var _=require('lodash');var squel=require(_0xae0c('0xc'));var crypto=require(_0xae0c('0xd'));var jsforce=require(_0xae0c('0xe'));var deskjs=require(_0xae0c('0xf'));var toCsv=require(_0xae0c('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xae0c('0x11'));var qs=require(_0xae0c('0x12'));var as=require(_0xae0c('0x13'));var hardwareService=require(_0xae0c('0x14'));var logger=require('../../config/logger')(_0xae0c('0x15'));var utils=require(_0xae0c('0x16'));var config=require(_0xae0c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xae0c('0x18'))['db'];function respondWithStatusCode(_0x5c1314,_0x2bff7e){_0x2bff7e=_0x2bff7e||0xcc;return function(_0x4fc8c6){if(_0x4fc8c6){return _0x5c1314[_0xae0c('0x19')](_0x2bff7e);}return _0x5c1314['status'](_0x2bff7e)[_0xae0c('0x1a')]();};}function respondWithResult(_0x40ea45,_0x2d0962){_0x2d0962=_0x2d0962||0xc8;return function(_0xd0d8f3){if(_0xd0d8f3){return _0x40ea45[_0xae0c('0x1b')](_0x2d0962)['json'](_0xd0d8f3);}};}function respondWithFilteredResult(_0x123ea0,_0x25e787){return function(_0x13fc86){if(_0x13fc86){var _0x241cea=typeof _0x25e787[_0xae0c('0x1c')]===_0xae0c('0x1d')&&typeof _0x25e787[_0xae0c('0x1e')]===_0xae0c('0x1d');var _0x3496b2=_0x13fc86['count'];var _0x1b8af8=_0x241cea?0x0:_0x25e787['offset'];var _0x5a4b09=_0x241cea?_0x13fc86[_0xae0c('0x1f')]:_0x25e787[_0xae0c('0x1c')]+_0x25e787['limit'];var _0x29e076;if(_0x5a4b09>=_0x3496b2){_0x5a4b09=_0x3496b2;_0x29e076=0xc8;}else{_0x29e076=0xce;}_0x123ea0[_0xae0c('0x1b')](_0x29e076);return _0x123ea0[_0xae0c('0x20')](_0xae0c('0x21'),_0x1b8af8+'-'+_0x5a4b09+'/'+_0x3496b2)[_0xae0c('0x22')](_0x13fc86);}return null;};}function patchUpdates(_0xfc8a09){return function(_0x1bf3e0){try{jsonpatch[_0xae0c('0x23')](_0x1bf3e0,_0xfc8a09,!![]);}catch(_0x401098){return BPromise[_0xae0c('0x24')](_0x401098);}return _0x1bf3e0['save']();};}function saveUpdates(_0x4db30a,_0x1237dc){return function(_0x4c4217){if(_0x4c4217){return _0x4c4217['update'](_0x4db30a)[_0xae0c('0x25')](function(_0x9fa298){return _0x9fa298;});}return null;};}function removeEntity(_0xb56d4a,_0x3e6619){return function(_0x4e4ebd){if(_0x4e4ebd){return _0x4e4ebd[_0xae0c('0x26')]()[_0xae0c('0x25')](function(){var _0xe1fe1e=_0x4e4ebd[_0xae0c('0x27')]({'plain':!![]});var _0x380a4b=_0xae0c('0x28');return db[_0xae0c('0x29')][_0xae0c('0x26')]({'where':{'type':_0x380a4b,'resourceId':_0xe1fe1e['id']}})['then'](function(){return _0x4e4ebd;});})[_0xae0c('0x25')](function(){_0xb56d4a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5fc061,_0x76e6d4){return function(_0x5ece28){if(!_0x5ece28){_0x5fc061[_0xae0c('0x19')](0x194);}return _0x5ece28;};}function handleError(_0x5d0c77,_0x4d0bc1){_0x4d0bc1=_0x4d0bc1||0x1f4;return function(_0x250057){logger[_0xae0c('0x2a')](_0x250057[_0xae0c('0x2b')]);if(_0x250057['name']){delete _0x250057[_0xae0c('0x2c')];}_0x5d0c77[_0xae0c('0x1b')](_0x4d0bc1)[_0xae0c('0x2d')](_0x250057);};}exports['index']=function(_0x3b5267,_0x342560){var _0x325369={},_0x5c0a8e={},_0x331ca2={'count':0x0,'rows':[]};var _0x3de5bf=_[_0xae0c('0x2e')](db[_0xae0c('0x2f')]['rawAttributes'],function(_0xdcb34c){return{'name':_0xdcb34c[_0xae0c('0x30')],'type':_0xdcb34c[_0xae0c('0x31')]['key']};});_0x5c0a8e[_0xae0c('0x32')]=_[_0xae0c('0x2e')](_0x3de5bf,_0xae0c('0x2c'));_0x5c0a8e[_0xae0c('0x33')]=_[_0xae0c('0x34')](_0x3b5267[_0xae0c('0x33')]);_0x5c0a8e[_0xae0c('0x35')]=_[_0xae0c('0x36')](_0x5c0a8e['model'],_0x5c0a8e[_0xae0c('0x33')]);_0x325369[_0xae0c('0x37')]=_['intersection'](_0x5c0a8e[_0xae0c('0x32')],qs[_0xae0c('0x38')](_0x3b5267['query'][_0xae0c('0x38')]));_0x325369[_0xae0c('0x37')]=_0x325369[_0xae0c('0x37')][_0xae0c('0x39')]?_0x325369[_0xae0c('0x37')]:_0x5c0a8e[_0xae0c('0x32')];if(!_0x3b5267['query']['hasOwnProperty'](_0xae0c('0x3a'))){_0x325369[_0xae0c('0x1e')]=qs[_0xae0c('0x1e')](_0x3b5267[_0xae0c('0x33')][_0xae0c('0x1e')]);_0x325369[_0xae0c('0x1c')]=qs[_0xae0c('0x1c')](_0x3b5267['query'][_0xae0c('0x1c')]);}_0x325369['order']=qs[_0xae0c('0x3b')](_0x3b5267[_0xae0c('0x33')][_0xae0c('0x3b')]);_0x325369['where']=qs['filters'](_[_0xae0c('0x3c')](_0x3b5267[_0xae0c('0x33')],_0x5c0a8e[_0xae0c('0x35')]),_0x3de5bf);if(_0x3b5267[_0xae0c('0x33')][_0xae0c('0x3d')]){_0x325369[_0xae0c('0x3e')]=_[_0xae0c('0x3f')](_0x325369['where'],{'$or':_[_0xae0c('0x2e')](_0x3de5bf,function(_0x8471d4){if(_0x8471d4[_0xae0c('0x31')]!=='VIRTUAL'){var _0x135615={};_0x135615[_0x8471d4[_0xae0c('0x2c')]]={'$like':'%'+_0x3b5267[_0xae0c('0x33')][_0xae0c('0x3d')]+'%'};return _0x135615;}})});}_0x325369=_[_0xae0c('0x3f')]({},_0x325369,_0x3b5267[_0xae0c('0x40')]);var _0x392041={'where':_0x325369[_0xae0c('0x3e')]};return db[_0xae0c('0x2f')][_0xae0c('0x1f')](_0x392041)[_0xae0c('0x25')](function(_0x53f6d0){_0x331ca2[_0xae0c('0x1f')]=_0x53f6d0;if(_0x3b5267[_0xae0c('0x33')][_0xae0c('0x41')]){_0x325369[_0xae0c('0x42')]=[{'all':!![]}];}return db['Trigger']['findAll'](_0x325369);})[_0xae0c('0x25')](function(_0x2de871){_0x331ca2['rows']=_0x2de871;return _0x331ca2;})[_0xae0c('0x25')](respondWithFilteredResult(_0x342560,_0x325369))[_0xae0c('0x43')](handleError(_0x342560,null));};exports['show']=function(_0x2a0dc0,_0x3f2d86){var _0xf29d03={'raw':![],'where':{'id':_0x2a0dc0['params']['id']}},_0x50b712={};_0x50b712[_0xae0c('0x32')]=_[_0xae0c('0x34')](db[_0xae0c('0x2f')][_0xae0c('0x44')]);_0x50b712[_0xae0c('0x33')]=_[_0xae0c('0x34')](_0x2a0dc0[_0xae0c('0x33')]);_0x50b712['filters']=_[_0xae0c('0x36')](_0x50b712['model'],_0x50b712[_0xae0c('0x33')]);_0xf29d03[_0xae0c('0x37')]=_[_0xae0c('0x36')](_0x50b712[_0xae0c('0x32')],qs['fields'](_0x2a0dc0['query']['fields']));_0xf29d03['attributes']=_0xf29d03[_0xae0c('0x37')][_0xae0c('0x39')]?_0xf29d03[_0xae0c('0x37')]:_0x50b712[_0xae0c('0x32')];if(_0x2a0dc0['query'][_0xae0c('0x41')]){_0xf29d03[_0xae0c('0x42')]=[{'all':!![]}];}_0xf29d03=_[_0xae0c('0x3f')]({},_0xf29d03,_0x2a0dc0[_0xae0c('0x40')]);return db['Trigger'][_0xae0c('0x45')](_0xf29d03)[_0xae0c('0x25')](handleEntityNotFound(_0x3f2d86,null))[_0xae0c('0x25')](respondWithResult(_0x3f2d86,null))['catch'](handleError(_0x3f2d86,null));};exports[_0xae0c('0x46')]=function(_0x541c6f,_0x5ac3ec){return db[_0xae0c('0x2f')][_0xae0c('0x46')](_0x541c6f['body'],{})[_0xae0c('0x25')](function(_0x84985e){var _0x218950=_0x541c6f[_0xae0c('0x47')]['get']({'plain':!![]});if(!_0x218950)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x218950[_0xae0c('0x48')]==='user'){var _0x2e4295=_0x84985e[_0xae0c('0x27')]({'plain':!![]});var _0x287698='Triggers';return db[_0xae0c('0x49')][_0xae0c('0x45')]({'where':{'name':_0x287698,'userProfileId':_0x218950['userProfileId']},'raw':!![]})[_0xae0c('0x25')](function(_0x437c86){if(_0x437c86&&_0x437c86[_0xae0c('0x4a')]===0x0){return db['UserProfileResource']['create']({'name':_0x2e4295[_0xae0c('0x2c')],'resourceId':_0x2e4295['id'],'type':_0x437c86[_0xae0c('0x2c')],'sectionId':_0x437c86['id']},{})[_0xae0c('0x25')](function(){return _0x84985e;});}else{return _0x84985e;}})['catch'](function(_0x378b60){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x378b60);throw _0x378b60;});}return _0x84985e;})['then'](respondWithResult(_0x5ac3ec,0xc9))[_0xae0c('0x43')](handleError(_0x5ac3ec,null));};exports['update']=function(_0x5f26ca,_0x3e822b){if(_0x5f26ca[_0xae0c('0x4b')]['id']){delete _0x5f26ca[_0xae0c('0x4b')]['id'];}return db[_0xae0c('0x2f')]['find']({'where':{'id':_0x5f26ca['params']['id']}})['then'](handleEntityNotFound(_0x3e822b,null))[_0xae0c('0x25')](saveUpdates(_0x5f26ca['body'],null))[_0xae0c('0x25')](respondWithResult(_0x3e822b,null))[_0xae0c('0x43')](handleError(_0x3e822b,null));};exports['destroy']=function(_0x4b7af2,_0x1afb23){return db[_0xae0c('0x2f')]['find']({'where':{'id':_0x4b7af2['params']['id']}})['then'](handleEntityNotFound(_0x1afb23,null))[_0xae0c('0x25')](removeEntity(_0x1afb23,null))[_0xae0c('0x43')](handleError(_0x1afb23,null));};exports[_0xae0c('0x4c')]=function(_0xa1553f,_0x44c691,_0x1452a1){if(_0xa1553f[_0xae0c('0x4b')]['id']){delete _0xa1553f[_0xae0c('0x4b')]['id'];}return db[_0xae0c('0x2f')][_0xae0c('0x45')]({'where':{'id':_0xa1553f[_0xae0c('0x4d')]['id']}})[_0xae0c('0x25')](handleEntityNotFound(_0x44c691,null))[_0xae0c('0x25')](function(_0x55ec3e){if(_0x55ec3e){_0xa1553f[_0xae0c('0x4b')][_0xae0c('0x4e')]=_0x55ec3e['id'];return db[_0xae0c('0x4f')][_0xae0c('0x46')](_0xa1553f[_0xae0c('0x4b')]);}})['then'](respondWithResult(_0x44c691,null))[_0xae0c('0x43')](handleError(_0x44c691,null));};exports['addAnyCondition']=function(_0x26473e,_0x5d1813,_0xb9744d){if(_0x26473e['body']['id']){delete _0x26473e['body']['id'];}return db['Trigger'][_0xae0c('0x45')]({'where':{'id':_0x26473e[_0xae0c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5d1813,null))[_0xae0c('0x25')](function(_0x49bb2a){if(_0x49bb2a){_0x26473e[_0xae0c('0x4b')][_0xae0c('0x50')]=_0x49bb2a['id'];return db[_0xae0c('0x4f')][_0xae0c('0x46')](_0x26473e[_0xae0c('0x4b')]);}})[_0xae0c('0x25')](respondWithResult(_0x5d1813,null))[_0xae0c('0x43')](handleError(_0x5d1813,null));};exports[_0xae0c('0x51')]=function(_0x3ece4b,_0x5a4f73,_0x2ff95a){var _0x4f8318={};var _0x505b82={};var _0x1440f1;var _0x5ad881;return db[_0xae0c('0x2f')][_0xae0c('0x52')]({'where':{'id':_0x3ece4b[_0xae0c('0x4d')]['id']}})[_0xae0c('0x25')](handleEntityNotFound(_0x5a4f73,null))[_0xae0c('0x25')](function(_0x734603){if(_0x734603){_0x1440f1=_0x734603;_0x505b82[_0xae0c('0x32')]=_[_0xae0c('0x34')](db['Condition'][_0xae0c('0x44')]);_0x505b82['query']=_[_0xae0c('0x34')](_0x3ece4b['query']);_0x505b82[_0xae0c('0x35')]=_[_0xae0c('0x36')](_0x505b82[_0xae0c('0x32')],_0x505b82[_0xae0c('0x33')]);_0x4f8318[_0xae0c('0x37')]=_[_0xae0c('0x36')](_0x505b82[_0xae0c('0x32')],qs[_0xae0c('0x38')](_0x3ece4b['query']['fields']));_0x4f8318[_0xae0c('0x37')]=_0x4f8318['attributes'][_0xae0c('0x39')]?_0x4f8318['attributes']:_0x505b82[_0xae0c('0x32')];_0x4f8318[_0xae0c('0x53')]=qs[_0xae0c('0x3b')](_0x3ece4b[_0xae0c('0x33')][_0xae0c('0x3b')]);_0x4f8318['where']=qs[_0xae0c('0x35')](_[_0xae0c('0x3c')](_0x3ece4b[_0xae0c('0x33')],_0x505b82[_0xae0c('0x35')]));if(_0x3ece4b[_0xae0c('0x33')]['filter']){_0x4f8318[_0xae0c('0x3e')]=_[_0xae0c('0x3f')](_0x4f8318[_0xae0c('0x3e')],{'$or':_['map'](_0x4f8318['attributes'],function(_0x577a5b){var _0x2c91ba={};_0x2c91ba[_0x577a5b]={'$like':'%'+_0x3ece4b[_0xae0c('0x33')][_0xae0c('0x3d')]+'%'};return _0x2c91ba;})});}_0x4f8318=_[_0xae0c('0x3f')]({},_0x4f8318,_0x3ece4b[_0xae0c('0x40')]);return _0x1440f1[_0xae0c('0x51')](_0x4f8318);}})['then'](function(_0x171af2){if(_0x171af2){_0x5ad881=_0x171af2[_0xae0c('0x39')];if(!_0x3ece4b[_0xae0c('0x33')][_0xae0c('0x54')](_0xae0c('0x3a'))){_0x4f8318['limit']=qs[_0xae0c('0x1e')](_0x3ece4b[_0xae0c('0x33')][_0xae0c('0x1e')]);_0x4f8318['offset']=qs[_0xae0c('0x1c')](_0x3ece4b[_0xae0c('0x33')][_0xae0c('0x1c')]);}return _0x1440f1[_0xae0c('0x51')](_0x4f8318);}})[_0xae0c('0x25')](function(_0xa7ea15){if(_0xa7ea15){return _0xa7ea15?{'count':_0x5ad881,'rows':_0xa7ea15}:null;}})[_0xae0c('0x25')](respondWithResult(_0x5a4f73,null))[_0xae0c('0x43')](handleError(_0x5a4f73,null));};exports['getAnyConditions']=function(_0x5b3f14,_0x4d98e1,_0x245451){var _0x176cab={};var _0x3c8204={};var _0x209d73;var _0x4c79c6;return db['Trigger']['findOne']({'where':{'id':_0x5b3f14[_0xae0c('0x4d')]['id']}})[_0xae0c('0x25')](handleEntityNotFound(_0x4d98e1,null))['then'](function(_0x4fb4c9){if(_0x4fb4c9){_0x209d73=_0x4fb4c9;_0x3c8204[_0xae0c('0x32')]=_[_0xae0c('0x34')](db['Condition'][_0xae0c('0x44')]);_0x3c8204['query']=_[_0xae0c('0x34')](_0x5b3f14[_0xae0c('0x33')]);_0x3c8204['filters']=_[_0xae0c('0x36')](_0x3c8204['model'],_0x3c8204['query']);_0x176cab['attributes']=_[_0xae0c('0x36')](_0x3c8204[_0xae0c('0x32')],qs[_0xae0c('0x38')](_0x5b3f14[_0xae0c('0x33')]['fields']));_0x176cab['attributes']=_0x176cab[_0xae0c('0x37')][_0xae0c('0x39')]?_0x176cab[_0xae0c('0x37')]:_0x3c8204['model'];_0x176cab[_0xae0c('0x53')]=qs[_0xae0c('0x3b')](_0x5b3f14[_0xae0c('0x33')][_0xae0c('0x3b')]);_0x176cab[_0xae0c('0x3e')]=qs[_0xae0c('0x35')](_[_0xae0c('0x3c')](_0x5b3f14[_0xae0c('0x33')],_0x3c8204[_0xae0c('0x35')]));if(_0x5b3f14[_0xae0c('0x33')][_0xae0c('0x3d')]){_0x176cab[_0xae0c('0x3e')]=_[_0xae0c('0x3f')](_0x176cab[_0xae0c('0x3e')],{'$or':_['map'](_0x176cab[_0xae0c('0x37')],function(_0xa78aef){var _0x32e779={};_0x32e779[_0xa78aef]={'$like':'%'+_0x5b3f14[_0xae0c('0x33')][_0xae0c('0x3d')]+'%'};return _0x32e779;})});}_0x176cab=_['merge']({},_0x176cab,_0x5b3f14[_0xae0c('0x40')]);return _0x209d73['getAnyConditions'](_0x176cab);}})['then'](function(_0x2d67e7){if(_0x2d67e7){_0x4c79c6=_0x2d67e7[_0xae0c('0x39')];if(!_0x5b3f14[_0xae0c('0x33')][_0xae0c('0x54')](_0xae0c('0x3a'))){_0x176cab[_0xae0c('0x1e')]=qs['limit'](_0x5b3f14['query'][_0xae0c('0x1e')]);_0x176cab[_0xae0c('0x1c')]=qs['offset'](_0x5b3f14[_0xae0c('0x33')][_0xae0c('0x1c')]);}return _0x209d73[_0xae0c('0x55')](_0x176cab);}})[_0xae0c('0x25')](function(_0x4a659e){if(_0x4a659e){return _0x4a659e?{'count':_0x4c79c6,'rows':_0x4a659e}:null;}})[_0xae0c('0x25')](respondWithResult(_0x4d98e1,null))[_0xae0c('0x43')](handleError(_0x4d98e1,null));};exports[_0xae0c('0x56')]=function(_0x3d8bd9,_0x165e0a,_0x19b161){if(_0x3d8bd9[_0xae0c('0x4b')]['id']){delete _0x3d8bd9['body']['id'];}return db[_0xae0c('0x2f')]['find']({'where':{'id':_0x3d8bd9[_0xae0c('0x4d')]['id']}})[_0xae0c('0x25')](handleEntityNotFound(_0x165e0a,null))[_0xae0c('0x25')](function(_0x5e238d){if(_0x5e238d){_0x3d8bd9['body'][_0xae0c('0x57')]=_0x5e238d['id'];return db['Action'][_0xae0c('0x46')](_0x3d8bd9[_0xae0c('0x4b')]);}})['then'](respondWithResult(_0x165e0a,null))[_0xae0c('0x43')](handleError(_0x165e0a,null));};exports[_0xae0c('0x58')]=function(_0x105e05,_0x1e5aa0,_0x2710cf){var _0xa61b7c={};var _0x10edb5={};var _0x21a264;var _0x31c268;return db[_0xae0c('0x2f')]['findOne']({'where':{'id':_0x105e05[_0xae0c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1e5aa0,null))[_0xae0c('0x25')](function(_0x3bfc2d){if(_0x3bfc2d){_0x21a264=_0x3bfc2d;_0x10edb5[_0xae0c('0x32')]=_[_0xae0c('0x34')](db[_0xae0c('0x59')][_0xae0c('0x44')]);_0x10edb5['query']=_[_0xae0c('0x34')](_0x105e05[_0xae0c('0x33')]);_0x10edb5[_0xae0c('0x35')]=_[_0xae0c('0x36')](_0x10edb5[_0xae0c('0x32')],_0x10edb5[_0xae0c('0x33')]);_0xa61b7c[_0xae0c('0x37')]=_[_0xae0c('0x36')](_0x10edb5[_0xae0c('0x32')],qs[_0xae0c('0x38')](_0x105e05[_0xae0c('0x33')][_0xae0c('0x38')]));_0xa61b7c['attributes']=_0xa61b7c[_0xae0c('0x37')][_0xae0c('0x39')]?_0xa61b7c[_0xae0c('0x37')]:_0x10edb5[_0xae0c('0x32')];_0xa61b7c[_0xae0c('0x53')]=qs[_0xae0c('0x3b')](_0x105e05['query'][_0xae0c('0x3b')]);_0xa61b7c[_0xae0c('0x3e')]=qs[_0xae0c('0x35')](_[_0xae0c('0x3c')](_0x105e05[_0xae0c('0x33')],_0x10edb5[_0xae0c('0x35')]));if(_0x105e05[_0xae0c('0x33')][_0xae0c('0x3d')]){_0xa61b7c[_0xae0c('0x3e')]=_[_0xae0c('0x3f')](_0xa61b7c[_0xae0c('0x3e')],{'$or':_[_0xae0c('0x2e')](_0xa61b7c[_0xae0c('0x37')],function(_0x3219b1){var _0x2906b6={};_0x2906b6[_0x3219b1]={'$like':'%'+_0x105e05[_0xae0c('0x33')][_0xae0c('0x3d')]+'%'};return _0x2906b6;})});}_0xa61b7c=_['merge']({},_0xa61b7c,_0x105e05[_0xae0c('0x40')]);return _0x21a264['getActions'](_0xa61b7c);}})[_0xae0c('0x25')](function(_0x424aa2){if(_0x424aa2){_0x31c268=_0x424aa2['length'];if(!_0x105e05['query'][_0xae0c('0x54')](_0xae0c('0x3a'))){_0xa61b7c[_0xae0c('0x1e')]=qs[_0xae0c('0x1e')](_0x105e05[_0xae0c('0x33')][_0xae0c('0x1e')]);_0xa61b7c[_0xae0c('0x1c')]=qs[_0xae0c('0x1c')](_0x105e05['query'][_0xae0c('0x1c')]);}return _0x21a264[_0xae0c('0x58')](_0xa61b7c);}})[_0xae0c('0x25')](function(_0x7c717d){if(_0x7c717d){return _0x7c717d?{'count':_0x31c268,'rows':_0x7c717d}:null;}})['then'](respondWithResult(_0x1e5aa0,null))[_0xae0c('0x43')](handleError(_0x1e5aa0,null));}; \ No newline at end of file +var _0x00d0=['includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','TriggerId','Action','getActions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','save','update','then','destroy','get','Triggers','UserProfileResource','stack','index','map','fieldName','type','key','name','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','Trigger','include','findAll','catch','show','params','rawAttributes','length'];(function(_0x5aa310,_0x2cbf8f){var _0x43ea38=function(_0x44237d){while(--_0x44237d){_0x5aa310['push'](_0x5aa310['shift']());}};_0x43ea38(++_0x2cbf8f);}(_0x00d0,0xd3));var _0x000d=function(_0x160767,_0x1a10c8){_0x160767=_0x160767-0x0;var _0x327818=_0x00d0[_0x160767];return _0x327818;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x000d('0x0'));var zipdir=require(_0x000d('0x1'));var jsonpatch=require(_0x000d('0x2'));var rp=require(_0x000d('0x3'));var moment=require(_0x000d('0x4'));var BPromise=require(_0x000d('0x5'));var Mustache=require(_0x000d('0x6'));var util=require(_0x000d('0x7'));var path=require(_0x000d('0x8'));var sox=require('sox');var csv=require(_0x000d('0x9'));var ejs=require(_0x000d('0xa'));var fs=require('fs');var fs_extra=require(_0x000d('0xb'));var _=require(_0x000d('0xc'));var squel=require(_0x000d('0xd'));var crypto=require(_0x000d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x000d('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x000d('0x10'));var Redis=require(_0x000d('0x11'));var authService=require(_0x000d('0x12'));var qs=require(_0x000d('0x13'));var as=require(_0x000d('0x14'));var hardwareService=require(_0x000d('0x15'));var logger=require(_0x000d('0x16'))(_0x000d('0x17'));var utils=require('../../config/utils');var config=require(_0x000d('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bd6a5,_0x23c78e){_0x23c78e=_0x23c78e||0xcc;return function(_0x2cfb15){if(_0x2cfb15){return _0x4bd6a5[_0x000d('0x19')](_0x23c78e);}return _0x4bd6a5[_0x000d('0x1a')](_0x23c78e)[_0x000d('0x1b')]();};}function respondWithResult(_0x3c8d8e,_0x5b0694){_0x5b0694=_0x5b0694||0xc8;return function(_0x435c1e){if(_0x435c1e){return _0x3c8d8e[_0x000d('0x1a')](_0x5b0694)[_0x000d('0x1c')](_0x435c1e);}};}function respondWithFilteredResult(_0x1db4d1,_0x2e1d59){return function(_0x365af8){if(_0x365af8){var _0x143503=typeof _0x2e1d59[_0x000d('0x1d')]===_0x000d('0x1e')&&typeof _0x2e1d59['limit']===_0x000d('0x1e');var _0x2e55ca=_0x365af8['count'];var _0x57dba2=_0x143503?0x0:_0x2e1d59[_0x000d('0x1d')];var _0x5a7082=_0x143503?_0x365af8[_0x000d('0x1f')]:_0x2e1d59[_0x000d('0x1d')]+_0x2e1d59['limit'];var _0x749286;if(_0x5a7082>=_0x2e55ca){_0x5a7082=_0x2e55ca;_0x749286=0xc8;}else{_0x749286=0xce;}_0x1db4d1[_0x000d('0x1a')](_0x749286);return _0x1db4d1[_0x000d('0x20')](_0x000d('0x21'),_0x57dba2+'-'+_0x5a7082+'/'+_0x2e55ca)[_0x000d('0x1c')](_0x365af8);}return null;};}function patchUpdates(_0x9e6c13){return function(_0x20c655){try{jsonpatch['apply'](_0x20c655,_0x9e6c13,!![]);}catch(_0x40797c){return BPromise['reject'](_0x40797c);}return _0x20c655[_0x000d('0x22')]();};}function saveUpdates(_0x265d8f,_0x1fdbb3){return function(_0x53e447){if(_0x53e447){return _0x53e447[_0x000d('0x23')](_0x265d8f)[_0x000d('0x24')](function(_0x1f0948){return _0x1f0948;});}return null;};}function removeEntity(_0x53d470,_0x5b6b52){return function(_0x4527f4){if(_0x4527f4){return _0x4527f4[_0x000d('0x25')]()[_0x000d('0x24')](function(){var _0x534ade=_0x4527f4[_0x000d('0x26')]({'plain':!![]});var _0x19a78a=_0x000d('0x27');return db[_0x000d('0x28')][_0x000d('0x25')]({'where':{'type':_0x19a78a,'resourceId':_0x534ade['id']}})[_0x000d('0x24')](function(){return _0x4527f4;});})[_0x000d('0x24')](function(){_0x53d470[_0x000d('0x1a')](0xcc)[_0x000d('0x1b')]();});}};}function handleEntityNotFound(_0x4d8624,_0x38d162){return function(_0x3a5624){if(!_0x3a5624){_0x4d8624[_0x000d('0x19')](0x194);}return _0x3a5624;};}function handleError(_0x58e7ec,_0x45dda5){_0x45dda5=_0x45dda5||0x1f4;return function(_0x76602d){logger['error'](_0x76602d[_0x000d('0x29')]);if(_0x76602d['name']){delete _0x76602d['name'];}_0x58e7ec[_0x000d('0x1a')](_0x45dda5)['send'](_0x76602d);};}exports[_0x000d('0x2a')]=function(_0x5aa640,_0xcdda47){var _0x4b0cb8={},_0x28d1e6={},_0x1a7e77={'count':0x0,'rows':[]};var _0x41878a=_[_0x000d('0x2b')](db['Trigger']['rawAttributes'],function(_0x219c6a){return{'name':_0x219c6a[_0x000d('0x2c')],'type':_0x219c6a[_0x000d('0x2d')][_0x000d('0x2e')]};});_0x28d1e6['model']=_[_0x000d('0x2b')](_0x41878a,_0x000d('0x2f'));_0x28d1e6[_0x000d('0x30')]=_[_0x000d('0x31')](_0x5aa640[_0x000d('0x30')]);_0x28d1e6[_0x000d('0x32')]=_[_0x000d('0x33')](_0x28d1e6[_0x000d('0x34')],_0x28d1e6['query']);_0x4b0cb8[_0x000d('0x35')]=_[_0x000d('0x33')](_0x28d1e6[_0x000d('0x34')],qs[_0x000d('0x36')](_0x5aa640[_0x000d('0x30')]['fields']));_0x4b0cb8[_0x000d('0x35')]=_0x4b0cb8[_0x000d('0x35')]['length']?_0x4b0cb8[_0x000d('0x35')]:_0x28d1e6[_0x000d('0x34')];if(!_0x5aa640['query'][_0x000d('0x37')](_0x000d('0x38'))){_0x4b0cb8[_0x000d('0x39')]=qs['limit'](_0x5aa640[_0x000d('0x30')][_0x000d('0x39')]);_0x4b0cb8[_0x000d('0x1d')]=qs['offset'](_0x5aa640[_0x000d('0x30')]['offset']);}_0x4b0cb8[_0x000d('0x3a')]=qs[_0x000d('0x3b')](_0x5aa640['query'][_0x000d('0x3b')]);_0x4b0cb8[_0x000d('0x3c')]=qs['filters'](_[_0x000d('0x3d')](_0x5aa640[_0x000d('0x30')],_0x28d1e6[_0x000d('0x32')]),_0x41878a);if(_0x5aa640[_0x000d('0x30')][_0x000d('0x3e')]){_0x4b0cb8[_0x000d('0x3c')]=_[_0x000d('0x3f')](_0x4b0cb8[_0x000d('0x3c')],{'$or':_[_0x000d('0x2b')](_0x41878a,function(_0x3c3f44){if(_0x3c3f44['type']!==_0x000d('0x40')){var _0x553222={};_0x553222[_0x3c3f44[_0x000d('0x2f')]]={'$like':'%'+_0x5aa640[_0x000d('0x30')][_0x000d('0x3e')]+'%'};return _0x553222;}})});}_0x4b0cb8=_[_0x000d('0x3f')]({},_0x4b0cb8,_0x5aa640[_0x000d('0x41')]);var _0xfd3401={'where':_0x4b0cb8[_0x000d('0x3c')]};return db[_0x000d('0x42')][_0x000d('0x1f')](_0xfd3401)[_0x000d('0x24')](function(_0x54d083){_0x1a7e77[_0x000d('0x1f')]=_0x54d083;if(_0x5aa640[_0x000d('0x30')]['includeAll']){_0x4b0cb8[_0x000d('0x43')]=[{'all':!![]}];}return db[_0x000d('0x42')][_0x000d('0x44')](_0x4b0cb8);})[_0x000d('0x24')](function(_0x144eb8){_0x1a7e77['rows']=_0x144eb8;return _0x1a7e77;})[_0x000d('0x24')](respondWithFilteredResult(_0xcdda47,_0x4b0cb8))[_0x000d('0x45')](handleError(_0xcdda47,null));};exports[_0x000d('0x46')]=function(_0x6775f0,_0x3eccb5){var _0xa28017={'raw':![],'where':{'id':_0x6775f0[_0x000d('0x47')]['id']}},_0x3100da={};_0x3100da[_0x000d('0x34')]=_[_0x000d('0x31')](db[_0x000d('0x42')][_0x000d('0x48')]);_0x3100da[_0x000d('0x30')]=_['keys'](_0x6775f0[_0x000d('0x30')]);_0x3100da['filters']=_[_0x000d('0x33')](_0x3100da['model'],_0x3100da['query']);_0xa28017[_0x000d('0x35')]=_[_0x000d('0x33')](_0x3100da[_0x000d('0x34')],qs[_0x000d('0x36')](_0x6775f0[_0x000d('0x30')][_0x000d('0x36')]));_0xa28017[_0x000d('0x35')]=_0xa28017['attributes'][_0x000d('0x49')]?_0xa28017[_0x000d('0x35')]:_0x3100da[_0x000d('0x34')];if(_0x6775f0[_0x000d('0x30')][_0x000d('0x4a')]){_0xa28017['include']=[{'all':!![]}];}_0xa28017=_['merge']({},_0xa28017,_0x6775f0[_0x000d('0x41')]);return db[_0x000d('0x42')]['find'](_0xa28017)[_0x000d('0x24')](handleEntityNotFound(_0x3eccb5,null))[_0x000d('0x24')](respondWithResult(_0x3eccb5,null))[_0x000d('0x45')](handleError(_0x3eccb5,null));};exports[_0x000d('0x4b')]=function(_0x4e7d7a,_0x5375f0){return db[_0x000d('0x42')][_0x000d('0x4b')](_0x4e7d7a[_0x000d('0x4c')],{})[_0x000d('0x24')](function(_0x392507){var _0x4e3005=_0x4e7d7a['user'][_0x000d('0x26')]({'plain':!![]});if(!_0x4e3005)throw new Error(_0x000d('0x4d'));if(_0x4e3005['role']===_0x000d('0x4e')){var _0x42e85e=_0x392507[_0x000d('0x26')]({'plain':!![]});var _0x420a7f=_0x000d('0x27');return db[_0x000d('0x4f')][_0x000d('0x50')]({'where':{'name':_0x420a7f,'userProfileId':_0x4e3005[_0x000d('0x51')]},'raw':!![]})[_0x000d('0x24')](function(_0x2394f9){if(_0x2394f9&&_0x2394f9[_0x000d('0x52')]===0x0){return db[_0x000d('0x28')][_0x000d('0x4b')]({'name':_0x42e85e[_0x000d('0x2f')],'resourceId':_0x42e85e['id'],'type':_0x2394f9[_0x000d('0x2f')],'sectionId':_0x2394f9['id']},{})[_0x000d('0x24')](function(){return _0x392507;});}else{return _0x392507;}})[_0x000d('0x45')](function(_0x17f8d2){logger[_0x000d('0x53')](_0x000d('0x54'),_0x17f8d2);throw _0x17f8d2;});}return _0x392507;})[_0x000d('0x24')](respondWithResult(_0x5375f0,0xc9))[_0x000d('0x45')](handleError(_0x5375f0,null));};exports[_0x000d('0x23')]=function(_0x1d5f6f,_0x3f120a){if(_0x1d5f6f['body']['id']){delete _0x1d5f6f[_0x000d('0x4c')]['id'];}return db[_0x000d('0x42')][_0x000d('0x50')]({'where':{'id':_0x1d5f6f[_0x000d('0x47')]['id']}})[_0x000d('0x24')](handleEntityNotFound(_0x3f120a,null))[_0x000d('0x24')](saveUpdates(_0x1d5f6f[_0x000d('0x4c')],null))[_0x000d('0x24')](respondWithResult(_0x3f120a,null))[_0x000d('0x45')](handleError(_0x3f120a,null));};exports[_0x000d('0x25')]=function(_0x4c78f6,_0x5adf7e){return db['Trigger'][_0x000d('0x50')]({'where':{'id':_0x4c78f6[_0x000d('0x47')]['id']}})['then'](handleEntityNotFound(_0x5adf7e,null))[_0x000d('0x24')](removeEntity(_0x5adf7e,null))[_0x000d('0x45')](handleError(_0x5adf7e,null));};exports[_0x000d('0x55')]=function(_0xbc3f85,_0x51c9bb,_0x14bf31){if(_0xbc3f85[_0x000d('0x4c')]['id']){delete _0xbc3f85[_0x000d('0x4c')]['id'];}return db[_0x000d('0x42')][_0x000d('0x50')]({'where':{'id':_0xbc3f85[_0x000d('0x47')]['id']}})[_0x000d('0x24')](handleEntityNotFound(_0x51c9bb,null))['then'](function(_0x26af2b){if(_0x26af2b){_0xbc3f85['body']['TriggerAllId']=_0x26af2b['id'];return db[_0x000d('0x56')][_0x000d('0x4b')](_0xbc3f85['body']);}})[_0x000d('0x24')](respondWithResult(_0x51c9bb,null))[_0x000d('0x45')](handleError(_0x51c9bb,null));};exports[_0x000d('0x57')]=function(_0x18ee43,_0x3849f6,_0x4b3c0f){if(_0x18ee43[_0x000d('0x4c')]['id']){delete _0x18ee43['body']['id'];}return db[_0x000d('0x42')][_0x000d('0x50')]({'where':{'id':_0x18ee43[_0x000d('0x47')]['id']}})['then'](handleEntityNotFound(_0x3849f6,null))[_0x000d('0x24')](function(_0x52419a){if(_0x52419a){_0x18ee43[_0x000d('0x4c')][_0x000d('0x58')]=_0x52419a['id'];return db[_0x000d('0x56')]['create'](_0x18ee43[_0x000d('0x4c')]);}})[_0x000d('0x24')](respondWithResult(_0x3849f6,null))[_0x000d('0x45')](handleError(_0x3849f6,null));};exports[_0x000d('0x59')]=function(_0x930117,_0x5d1333,_0x501f01){var _0x198ef3={};var _0x662b60={};var _0x36b45c;var _0x2838b0;return db[_0x000d('0x42')][_0x000d('0x5a')]({'where':{'id':_0x930117[_0x000d('0x47')]['id']}})[_0x000d('0x24')](handleEntityNotFound(_0x5d1333,null))['then'](function(_0x473579){if(_0x473579){_0x36b45c=_0x473579;_0x662b60[_0x000d('0x34')]=_[_0x000d('0x31')](db['Condition'][_0x000d('0x48')]);_0x662b60[_0x000d('0x30')]=_[_0x000d('0x31')](_0x930117[_0x000d('0x30')]);_0x662b60[_0x000d('0x32')]=_[_0x000d('0x33')](_0x662b60[_0x000d('0x34')],_0x662b60['query']);_0x198ef3[_0x000d('0x35')]=_[_0x000d('0x33')](_0x662b60[_0x000d('0x34')],qs[_0x000d('0x36')](_0x930117[_0x000d('0x30')][_0x000d('0x36')]));_0x198ef3[_0x000d('0x35')]=_0x198ef3[_0x000d('0x35')][_0x000d('0x49')]?_0x198ef3[_0x000d('0x35')]:_0x662b60[_0x000d('0x34')];_0x198ef3[_0x000d('0x3a')]=qs[_0x000d('0x3b')](_0x930117[_0x000d('0x30')][_0x000d('0x3b')]);_0x198ef3[_0x000d('0x3c')]=qs[_0x000d('0x32')](_[_0x000d('0x3d')](_0x930117[_0x000d('0x30')],_0x662b60[_0x000d('0x32')]));if(_0x930117[_0x000d('0x30')][_0x000d('0x3e')]){_0x198ef3[_0x000d('0x3c')]=_['merge'](_0x198ef3[_0x000d('0x3c')],{'$or':_[_0x000d('0x2b')](_0x198ef3['attributes'],function(_0x23aa19){var _0x5d2b1a={};_0x5d2b1a[_0x23aa19]={'$like':'%'+_0x930117[_0x000d('0x30')]['filter']+'%'};return _0x5d2b1a;})});}_0x198ef3=_['merge']({},_0x198ef3,_0x930117[_0x000d('0x41')]);return _0x36b45c[_0x000d('0x59')](_0x198ef3);}})[_0x000d('0x24')](function(_0xc609ca){if(_0xc609ca){_0x2838b0=_0xc609ca[_0x000d('0x49')];if(!_0x930117[_0x000d('0x30')]['hasOwnProperty']('nolimit')){_0x198ef3[_0x000d('0x39')]=qs[_0x000d('0x39')](_0x930117['query']['limit']);_0x198ef3['offset']=qs[_0x000d('0x1d')](_0x930117[_0x000d('0x30')][_0x000d('0x1d')]);}return _0x36b45c['getAllConditions'](_0x198ef3);}})[_0x000d('0x24')](function(_0x31703c){if(_0x31703c){return _0x31703c?{'count':_0x2838b0,'rows':_0x31703c}:null;}})[_0x000d('0x24')](respondWithResult(_0x5d1333,null))[_0x000d('0x45')](handleError(_0x5d1333,null));};exports[_0x000d('0x5b')]=function(_0x3228ad,_0x18ac3a,_0x1e21c6){var _0x4fadbd={};var _0x1c8a5c={};var _0x5845c1;var _0x854f47;return db['Trigger'][_0x000d('0x5a')]({'where':{'id':_0x3228ad[_0x000d('0x47')]['id']}})['then'](handleEntityNotFound(_0x18ac3a,null))[_0x000d('0x24')](function(_0x14cddd){if(_0x14cddd){_0x5845c1=_0x14cddd;_0x1c8a5c['model']=_[_0x000d('0x31')](db[_0x000d('0x56')][_0x000d('0x48')]);_0x1c8a5c[_0x000d('0x30')]=_['keys'](_0x3228ad['query']);_0x1c8a5c[_0x000d('0x32')]=_[_0x000d('0x33')](_0x1c8a5c[_0x000d('0x34')],_0x1c8a5c[_0x000d('0x30')]);_0x4fadbd['attributes']=_[_0x000d('0x33')](_0x1c8a5c[_0x000d('0x34')],qs['fields'](_0x3228ad[_0x000d('0x30')][_0x000d('0x36')]));_0x4fadbd['attributes']=_0x4fadbd[_0x000d('0x35')]['length']?_0x4fadbd[_0x000d('0x35')]:_0x1c8a5c['model'];_0x4fadbd['order']=qs[_0x000d('0x3b')](_0x3228ad['query'][_0x000d('0x3b')]);_0x4fadbd[_0x000d('0x3c')]=qs[_0x000d('0x32')](_['pick'](_0x3228ad[_0x000d('0x30')],_0x1c8a5c['filters']));if(_0x3228ad[_0x000d('0x30')]['filter']){_0x4fadbd[_0x000d('0x3c')]=_[_0x000d('0x3f')](_0x4fadbd[_0x000d('0x3c')],{'$or':_[_0x000d('0x2b')](_0x4fadbd[_0x000d('0x35')],function(_0x173358){var _0xfd71c1={};_0xfd71c1[_0x173358]={'$like':'%'+_0x3228ad['query'][_0x000d('0x3e')]+'%'};return _0xfd71c1;})});}_0x4fadbd=_['merge']({},_0x4fadbd,_0x3228ad['options']);return _0x5845c1[_0x000d('0x5b')](_0x4fadbd);}})[_0x000d('0x24')](function(_0x3da588){if(_0x3da588){_0x854f47=_0x3da588[_0x000d('0x49')];if(!_0x3228ad['query'][_0x000d('0x37')]('nolimit')){_0x4fadbd['limit']=qs[_0x000d('0x39')](_0x3228ad[_0x000d('0x30')][_0x000d('0x39')]);_0x4fadbd[_0x000d('0x1d')]=qs[_0x000d('0x1d')](_0x3228ad[_0x000d('0x30')]['offset']);}return _0x5845c1[_0x000d('0x5b')](_0x4fadbd);}})[_0x000d('0x24')](function(_0xc71a5b){if(_0xc71a5b){return _0xc71a5b?{'count':_0x854f47,'rows':_0xc71a5b}:null;}})[_0x000d('0x24')](respondWithResult(_0x18ac3a,null))['catch'](handleError(_0x18ac3a,null));};exports['addAction']=function(_0x3a3da1,_0x48eec4,_0x1941d6){if(_0x3a3da1[_0x000d('0x4c')]['id']){delete _0x3a3da1[_0x000d('0x4c')]['id'];}return db[_0x000d('0x42')][_0x000d('0x50')]({'where':{'id':_0x3a3da1['params']['id']}})['then'](handleEntityNotFound(_0x48eec4,null))['then'](function(_0x34e4b6){if(_0x34e4b6){_0x3a3da1[_0x000d('0x4c')][_0x000d('0x5c')]=_0x34e4b6['id'];return db[_0x000d('0x5d')]['create'](_0x3a3da1['body']);}})[_0x000d('0x24')](respondWithResult(_0x48eec4,null))[_0x000d('0x45')](handleError(_0x48eec4,null));};exports[_0x000d('0x5e')]=function(_0xd36b80,_0x5c37c8,_0x431981){var _0x3164ed={};var _0x174095={};var _0x4c3a37;var _0x34bd2e;return db[_0x000d('0x42')]['findOne']({'where':{'id':_0xd36b80[_0x000d('0x47')]['id']}})[_0x000d('0x24')](handleEntityNotFound(_0x5c37c8,null))[_0x000d('0x24')](function(_0x5d5906){if(_0x5d5906){_0x4c3a37=_0x5d5906;_0x174095[_0x000d('0x34')]=_[_0x000d('0x31')](db['Action'][_0x000d('0x48')]);_0x174095['query']=_['keys'](_0xd36b80[_0x000d('0x30')]);_0x174095[_0x000d('0x32')]=_['intersection'](_0x174095['model'],_0x174095[_0x000d('0x30')]);_0x3164ed[_0x000d('0x35')]=_['intersection'](_0x174095['model'],qs[_0x000d('0x36')](_0xd36b80['query']['fields']));_0x3164ed['attributes']=_0x3164ed[_0x000d('0x35')][_0x000d('0x49')]?_0x3164ed[_0x000d('0x35')]:_0x174095[_0x000d('0x34')];_0x3164ed[_0x000d('0x3a')]=qs['sort'](_0xd36b80['query'][_0x000d('0x3b')]);_0x3164ed[_0x000d('0x3c')]=qs['filters'](_[_0x000d('0x3d')](_0xd36b80['query'],_0x174095[_0x000d('0x32')]));if(_0xd36b80[_0x000d('0x30')]['filter']){_0x3164ed[_0x000d('0x3c')]=_['merge'](_0x3164ed[_0x000d('0x3c')],{'$or':_[_0x000d('0x2b')](_0x3164ed['attributes'],function(_0x45b9fd){var _0x18e605={};_0x18e605[_0x45b9fd]={'$like':'%'+_0xd36b80[_0x000d('0x30')][_0x000d('0x3e')]+'%'};return _0x18e605;})});}_0x3164ed=_[_0x000d('0x3f')]({},_0x3164ed,_0xd36b80['options']);return _0x4c3a37['getActions'](_0x3164ed);}})[_0x000d('0x24')](function(_0x1c0236){if(_0x1c0236){_0x34bd2e=_0x1c0236[_0x000d('0x49')];if(!_0xd36b80['query'][_0x000d('0x37')]('nolimit')){_0x3164ed[_0x000d('0x39')]=qs[_0x000d('0x39')](_0xd36b80[_0x000d('0x30')]['limit']);_0x3164ed['offset']=qs['offset'](_0xd36b80[_0x000d('0x30')][_0x000d('0x1d')]);}return _0x4c3a37[_0x000d('0x5e')](_0x3164ed);}})[_0x000d('0x24')](function(_0x5469dd){if(_0x5469dd){return _0x5469dd?{'count':_0x34bd2e,'rows':_0x5469dd}:null;}})[_0x000d('0x24')](respondWithResult(_0x5c37c8,null))[_0x000d('0x45')](handleError(_0x5c37c8,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index dc8010f..54b153f 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 _0x758e=['Trigger','lodash','api','moment','bluebird','rimraf','../../config/environment','./trigger.attributes','exports','define'];(function(_0x2a20a5,_0x3ac660){var _0x37bd9b=function(_0xa8a2c){while(--_0xa8a2c){_0x2a20a5['push'](_0x2a20a5['shift']());}};_0x37bd9b(++_0x3ac660);}(_0x758e,0x1af));var _0xe758=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x758e[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xe758('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe758('0x1'));var moment=require(_0xe758('0x2'));var BPromise=require(_0xe758('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe758('0x4'));var config=require(_0xe758('0x5'));var attributes=require(_0xe758('0x6'));module[_0xe758('0x7')]=function(_0x5a2226,_0x2cdf89){return _0x5a2226[_0xe758('0x8')](_0xe758('0x9'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35aa=['./trigger.attributes','exports','Trigger','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x4063a4,_0x19d730){var _0x17908d=function(_0x3ce714){while(--_0x3ce714){_0x4063a4['push'](_0x4063a4['shift']());}};_0x17908d(++_0x19d730);}(_0x35aa,0xbe));var _0xa35a=function(_0x4bed75,_0x211cc7){_0x4bed75=_0x4bed75-0x0;var _0x2dd8e8=_0x35aa[_0x4bed75];return _0x2dd8e8;};'use strict';var _=require('lodash');var util=require(_0xa35a('0x0'));var logger=require(_0xa35a('0x1'))(_0xa35a('0x2'));var moment=require(_0xa35a('0x3'));var BPromise=require('bluebird');var rp=require(_0xa35a('0x4'));var fs=require('fs');var path=require(_0xa35a('0x5'));var rimraf=require(_0xa35a('0x6'));var config=require(_0xa35a('0x7'));var attributes=require(_0xa35a('0x8'));module[_0xa35a('0x9')]=function(_0x449cfe,_0x10917d){return _0x449cfe['define'](_0xa35a('0xa'),attributes,{'tableName':'tools_triggers','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 5dc604b..ff45d22 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 _0x354b=['error','message','info','result','catch','GetTrigger','findAll','options','where','map','include','model','attributes','debug','ShowTrigger','Trigger','find','raw','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','Trigger,\x20%s,\x20%s','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x33de28,_0x542c6d){var _0x49605d=function(_0x20e139){while(--_0x20e139){_0x33de28['push'](_0x33de28['shift']());}};_0x49605d(++_0x542c6d);}(_0x354b,0xad));var _0xb354=function(_0x107aaa,_0x2dafc4){_0x107aaa=_0x107aaa-0x0;var _0x13154a=_0x354b[_0x107aaa];return _0x13154a;};'use strict';var _=require('lodash');var util=require(_0xb354('0x0'));var moment=require('moment');var BPromise=require(_0xb354('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb354('0x2'));var logger=require(_0xb354('0x3'))(_0xb354('0x4'));var config=require(_0xb354('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb354('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1ac3e2,_0xb1a55c,_0x457812){return new BPromise(function(_0x136a8b,_0x8b8553){return client[_0xb354('0x7')](_0x1ac3e2,_0x457812)[_0xb354('0x8')](function(_0x5e7c2a){logger['info'](_0xb354('0x9'),_0xb1a55c,'request\x20sent');logger['debug'](_0xb354('0xa'),_0xb1a55c,_0xb354('0xb'),JSON[_0xb354('0xc')](_0x5e7c2a));if(_0x5e7c2a[_0xb354('0xd')]){if(_0x5e7c2a[_0xb354('0xd')]['code']===0x1f4){logger[_0xb354('0xd')](_0xb354('0x9'),_0xb1a55c,_0x5e7c2a[_0xb354('0xd')][_0xb354('0xe')]);return _0x8b8553(_0x5e7c2a['error'][_0xb354('0xe')]);}logger['error'](_0xb354('0x9'),_0xb1a55c,_0x5e7c2a['error'][_0xb354('0xe')]);return _0x136a8b(_0x5e7c2a[_0xb354('0xd')]['message']);}else{logger[_0xb354('0xf')](_0xb354('0x9'),_0xb1a55c,'request\x20sent');_0x136a8b(_0x5e7c2a[_0xb354('0x10')]['message']);}})[_0xb354('0x11')](function(_0x4893c0){logger[_0xb354('0xd')](_0xb354('0x9'),_0xb1a55c,_0x4893c0);_0x8b8553(_0x4893c0);});});}exports[_0xb354('0x12')]=function(_0xbe6a55){var _0x208d39=this;return new Promise(function(_0x23af8d,_0x2fca36){return db['Trigger'][_0xb354('0x13')]({'raw':_0xbe6a55[_0xb354('0x14')]?_0xbe6a55[_0xb354('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0xbe6a55[_0xb354('0x14')]?_0xbe6a55[_0xb354('0x14')][_0xb354('0x15')]||null:null,'attributes':_0xbe6a55[_0xb354('0x14')]?_0xbe6a55[_0xb354('0x14')]['attributes']||null:null,'limit':_0xbe6a55[_0xb354('0x14')]?_0xbe6a55[_0xb354('0x14')]['limit']||null:null,'include':_0xbe6a55['options']?_0xbe6a55[_0xb354('0x14')]['include']?_[_0xb354('0x16')](_0xbe6a55[_0xb354('0x14')][_0xb354('0x17')],function(_0x20dd35){return{'model':db[_0x20dd35[_0xb354('0x18')]],'as':_0x20dd35['as'],'attributes':_0x20dd35[_0xb354('0x19')],'include':_0x20dd35[_0xb354('0x17')]?_[_0xb354('0x16')](_0x20dd35[_0xb354('0x17')],function(_0x5cd1af){return{'model':db[_0x5cd1af[_0xb354('0x18')]],'as':_0x5cd1af['as'],'attributes':_0x5cd1af['attributes'],'include':_0x5cd1af[_0xb354('0x17')]?_['map'](_0x5cd1af[_0xb354('0x17')],function(_0x550b88){return{'model':db[_0x550b88[_0xb354('0x18')]],'as':_0x550b88['as'],'attributes':_0x550b88[_0xb354('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb354('0x8')](function(_0x4b6836){logger[_0xb354('0xf')]('GetTrigger',_0xbe6a55);logger[_0xb354('0x1a')]('GetTrigger',_0xbe6a55,JSON[_0xb354('0xc')](_0x4b6836));_0x23af8d(_0x4b6836);})[_0xb354('0x11')](function(_0x101895){logger[_0xb354('0xd')](_0xb354('0x12'),_0x101895['message'],_0xbe6a55);_0x2fca36(_0x208d39[_0xb354('0xd')](0x1f4,_0x101895[_0xb354('0xe')]));});});};exports[_0xb354('0x1b')]=function(_0xdd8335){var _0x28fd4d=this;return new Promise(function(_0x4054c0,_0x5ad0f1){return db[_0xb354('0x1c')][_0xb354('0x1d')]({'raw':_0xdd8335[_0xb354('0x14')]?_0xdd8335['options'][_0xb354('0x1e')]===undefined?!![]:![]:!![],'where':_0xdd8335[_0xb354('0x14')]?_0xdd8335[_0xb354('0x14')]['where']||null:null,'attributes':_0xdd8335[_0xb354('0x14')]?_0xdd8335[_0xb354('0x14')]['attributes']||null:null,'include':_0xdd8335[_0xb354('0x14')]?_0xdd8335[_0xb354('0x14')][_0xb354('0x17')]?_[_0xb354('0x16')](_0xdd8335[_0xb354('0x14')][_0xb354('0x17')],function(_0x226a97){return{'model':db[_0x226a97['model']],'as':_0x226a97['as'],'attributes':_0x226a97[_0xb354('0x19')],'include':_0x226a97['include']?_[_0xb354('0x16')](_0x226a97[_0xb354('0x17')],function(_0x44f7eb){return{'model':db[_0x44f7eb[_0xb354('0x18')]],'as':_0x44f7eb['as'],'attributes':_0x44f7eb['attributes'],'include':_0x44f7eb[_0xb354('0x17')]?_['map'](_0x44f7eb[_0xb354('0x17')],function(_0x678a22){return{'model':db[_0x678a22[_0xb354('0x18')]],'as':_0x678a22['as'],'attributes':_0x678a22[_0xb354('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb354('0x8')](function(_0x263f9b){logger[_0xb354('0xf')](_0xb354('0x1b'),_0xdd8335);logger[_0xb354('0x1a')]('ShowTrigger',_0xdd8335,JSON[_0xb354('0xc')](_0x263f9b));_0x4054c0(_0x263f9b);})['catch'](function(_0x25f3ad){logger['error'](_0xb354('0x1b'),_0x25f3ad[_0xb354('0xe')],_0xdd8335);_0x5ad0f1(_0x28fd4d['error'](0x1f4,_0x25f3ad[_0xb354('0xe')]));});});}; \ No newline at end of file +var _0x4450=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','request\x20sent','stringify','error','code','message','Trigger,\x20%s,\x20%s','result','catch','GetTrigger','Trigger','findAll','options','raw','attributes','limit','include','map','model','ShowTrigger','find','bluebird'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x4450,0x15f));var _0x0445=function(_0x1f2a76,_0x23aca3){_0x1f2a76=_0x1f2a76-0x0;var _0x249203=_0x4450[_0x1f2a76];return _0x249203;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x0445('0x0'));var rs=require(_0x0445('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0445('0x2'))['db'];var utils=require(_0x0445('0x3'));var logger=require('../../config/logger')(_0x0445('0x4'));var config=require(_0x0445('0x5'));var jayson=require(_0x0445('0x6'));var client=jayson[_0x0445('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2aedee,_0x4bdad4,_0x4d1080){return new BPromise(function(_0x5af986,_0x346ca0){return client[_0x0445('0x8')](_0x2aedee,_0x4d1080)[_0x0445('0x9')](function(_0x560507){logger[_0x0445('0xa')]('Trigger,\x20%s,\x20%s',_0x4bdad4,'request\x20sent');logger[_0x0445('0xb')]('Trigger,\x20%s,\x20%s,\x20%s',_0x4bdad4,_0x0445('0xc'),JSON[_0x0445('0xd')](_0x560507));if(_0x560507[_0x0445('0xe')]){if(_0x560507[_0x0445('0xe')][_0x0445('0xf')]===0x1f4){logger[_0x0445('0xe')]('Trigger,\x20%s,\x20%s',_0x4bdad4,_0x560507[_0x0445('0xe')][_0x0445('0x10')]);return _0x346ca0(_0x560507[_0x0445('0xe')][_0x0445('0x10')]);}logger[_0x0445('0xe')](_0x0445('0x11'),_0x4bdad4,_0x560507['error'][_0x0445('0x10')]);return _0x5af986(_0x560507[_0x0445('0xe')][_0x0445('0x10')]);}else{logger[_0x0445('0xa')](_0x0445('0x11'),_0x4bdad4,_0x0445('0xc'));_0x5af986(_0x560507[_0x0445('0x12')][_0x0445('0x10')]);}})[_0x0445('0x13')](function(_0x248bf9){logger[_0x0445('0xe')](_0x0445('0x11'),_0x4bdad4,_0x248bf9);_0x346ca0(_0x248bf9);});});}exports[_0x0445('0x14')]=function(_0x93a42){var _0x582895=this;return new Promise(function(_0x1ec768,_0x4c875a){return db[_0x0445('0x15')][_0x0445('0x16')]({'raw':_0x93a42[_0x0445('0x17')]?_0x93a42[_0x0445('0x17')][_0x0445('0x18')]===undefined?!![]:![]:!![],'where':_0x93a42[_0x0445('0x17')]?_0x93a42[_0x0445('0x17')]['where']||null:null,'attributes':_0x93a42[_0x0445('0x17')]?_0x93a42[_0x0445('0x17')][_0x0445('0x19')]||null:null,'limit':_0x93a42[_0x0445('0x17')]?_0x93a42[_0x0445('0x17')][_0x0445('0x1a')]||null:null,'include':_0x93a42[_0x0445('0x17')]?_0x93a42[_0x0445('0x17')][_0x0445('0x1b')]?_[_0x0445('0x1c')](_0x93a42[_0x0445('0x17')][_0x0445('0x1b')],function(_0x3f0693){return{'model':db[_0x3f0693[_0x0445('0x1d')]],'as':_0x3f0693['as'],'attributes':_0x3f0693['attributes'],'include':_0x3f0693[_0x0445('0x1b')]?_[_0x0445('0x1c')](_0x3f0693[_0x0445('0x1b')],function(_0x4758b8){return{'model':db[_0x4758b8[_0x0445('0x1d')]],'as':_0x4758b8['as'],'attributes':_0x4758b8[_0x0445('0x19')],'include':_0x4758b8[_0x0445('0x1b')]?_['map'](_0x4758b8[_0x0445('0x1b')],function(_0x26cf36){return{'model':db[_0x26cf36['model']],'as':_0x26cf36['as'],'attributes':_0x26cf36[_0x0445('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1fe4c0){logger[_0x0445('0xa')](_0x0445('0x14'),_0x93a42);logger[_0x0445('0xb')](_0x0445('0x14'),_0x93a42,JSON[_0x0445('0xd')](_0x1fe4c0));_0x1ec768(_0x1fe4c0);})[_0x0445('0x13')](function(_0x3b7d59){logger[_0x0445('0xe')]('GetTrigger',_0x3b7d59[_0x0445('0x10')],_0x93a42);_0x4c875a(_0x582895[_0x0445('0xe')](0x1f4,_0x3b7d59[_0x0445('0x10')]));});});};exports[_0x0445('0x1e')]=function(_0x1056ee){var _0x28c0dd=this;return new Promise(function(_0x210e0d,_0x5d4d56){return db['Trigger'][_0x0445('0x1f')]({'raw':_0x1056ee[_0x0445('0x17')]?_0x1056ee[_0x0445('0x17')][_0x0445('0x18')]===undefined?!![]:![]:!![],'where':_0x1056ee[_0x0445('0x17')]?_0x1056ee['options']['where']||null:null,'attributes':_0x1056ee[_0x0445('0x17')]?_0x1056ee['options'][_0x0445('0x19')]||null:null,'include':_0x1056ee[_0x0445('0x17')]?_0x1056ee['options'][_0x0445('0x1b')]?_[_0x0445('0x1c')](_0x1056ee[_0x0445('0x17')]['include'],function(_0x2147b6){return{'model':db[_0x2147b6[_0x0445('0x1d')]],'as':_0x2147b6['as'],'attributes':_0x2147b6[_0x0445('0x19')],'include':_0x2147b6[_0x0445('0x1b')]?_['map'](_0x2147b6[_0x0445('0x1b')],function(_0x14825c){return{'model':db[_0x14825c['model']],'as':_0x14825c['as'],'attributes':_0x14825c['attributes'],'include':_0x14825c[_0x0445('0x1b')]?_[_0x0445('0x1c')](_0x14825c[_0x0445('0x1b')],function(_0x5c4578){return{'model':db[_0x5c4578[_0x0445('0x1d')]],'as':_0x5c4578['as'],'attributes':_0x5c4578[_0x0445('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0445('0x9')](function(_0x2861d5){logger[_0x0445('0xa')](_0x0445('0x1e'),_0x1056ee);logger[_0x0445('0xb')](_0x0445('0x1e'),_0x1056ee,JSON[_0x0445('0xd')](_0x2861d5));_0x210e0d(_0x2861d5);})[_0x0445('0x13')](function(_0x25c64f){logger[_0x0445('0xe')](_0x0445('0x1e'),_0x25c64f[_0x0445('0x10')],_0x1056ee);_0x5d4d56(_0x28c0dd[_0x0445('0xe')](0x1f4,_0x25c64f[_0x0445('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 5099dbb..090bd27 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 _0x7cba=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','clone','post','create','put','update','delete'];(function(_0x2d2949,_0x397ca6){var _0x2eab93=function(_0x127984){while(--_0x127984){_0x2d2949['push'](_0x2d2949['shift']());}};_0x2eab93(++_0x397ca6);}(_0x7cba,0xfd));var _0xa7cb=function(_0x52de97,_0xfb3572){_0x52de97=_0x52de97-0x0;var _0x1ed4e9=_0x7cba[_0x52de97];return _0x1ed4e9;};'use strict';var multer=require(_0xa7cb('0x0'));var util=require(_0xa7cb('0x1'));var path=require('path');var timeout=require(_0xa7cb('0x2'));var express=require(_0xa7cb('0x3'));var router=express[_0xa7cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa7cb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa7cb('0x6'));var controller=require('./trunk.controller');router[_0xa7cb('0x7')]('/',auth[_0xa7cb('0x8')](),controller['index']);router[_0xa7cb('0x7')](_0xa7cb('0x9'),auth[_0xa7cb('0x8')](),controller[_0xa7cb('0xa')]);router['post']('/:id/clone',auth[_0xa7cb('0x8')](),controller[_0xa7cb('0xb')]);router[_0xa7cb('0xc')]('/',auth[_0xa7cb('0x8')](),controller[_0xa7cb('0xd')]);router[_0xa7cb('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xa7cb('0xf')]);router[_0xa7cb('0x10')](_0xa7cb('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xa7cb('0x11')]=router; \ No newline at end of file +var _0x320a=['multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/clone','clone','post','create','put','update','destroy','exports'];(function(_0x640ac3,_0x2dce71){var _0x3c801e=function(_0x2f2f38){while(--_0x2f2f38){_0x640ac3['push'](_0x640ac3['shift']());}};_0x3c801e(++_0x2dce71);}(_0x320a,0x1c2));var _0xa320=function(_0x3452df,_0x492afc){_0x3452df=_0x3452df-0x0;var _0x2081c2=_0x320a[_0x3452df];return _0x2081c2;};'use strict';var multer=require(_0xa320('0x0'));var util=require(_0xa320('0x1'));var path=require('path');var timeout=require(_0xa320('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa320('0x3'));var auth=require(_0xa320('0x4'));var interaction=require(_0xa320('0x5'));var config=require('../../config/environment');var controller=require('./trunk.controller');router[_0xa320('0x6')]('/',auth[_0xa320('0x7')](),controller['index']);router[_0xa320('0x6')](_0xa320('0x8'),auth[_0xa320('0x7')](),controller[_0xa320('0x9')]);router['post'](_0xa320('0xa'),auth[_0xa320('0x7')](),controller[_0xa320('0xb')]);router[_0xa320('0xc')]('/',auth[_0xa320('0x7')](),controller[_0xa320('0xd')]);router[_0xa320('0xe')](_0xa320('0x8'),auth[_0xa320('0x7')](),controller[_0xa320('0xf')]);router['delete']('/:id',auth[_0xa320('0x7')](),controller[_0xa320('0x10')]);module[_0xa320('0x11')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index ba1ca36..03359fd 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 _0x47ee=['PROHIB_FAILED_SCREEN','PROHIB','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','yes','nonat','update','force_rport,comedia','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','ENUM','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN'];(function(_0x4607e1,_0x596f78){var _0x22f1b2=function(_0x122dcc){while(--_0x122dcc){_0x4607e1['push'](_0x4607e1['shift']());}};_0x22f1b2(++_0x596f78);}(_0x47ee,0x19c));var _0xe47e=function(_0x4fc4ff,_0xce32e3){_0x4fc4ff=_0x4fc4ff-0x0;var _0x1e9495=_0x47ee[_0x4fc4ff];return _0x1e9495;};'use strict';var Sequelize=require(_0xe47e('0x0'));module[_0xe47e('0x1')]={'name':{'type':Sequelize[_0xe47e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xe47e('0x3')]('friend','user',_0xe47e('0x4')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xe47e('0x2')],'allowNull':![],'defaultValue':_0xe47e('0x5')},'callingpres':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x6'),_0xe47e('0x7'),_0xe47e('0x8'),_0xe47e('0x9'),_0xe47e('0xa'),_0xe47e('0xb'),_0xe47e('0xc'),_0xe47e('0xd'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xe47e('0x2')]},'md5secret':{'type':Sequelize[_0xe47e('0x2')]},'remotesecret':{'type':Sequelize[_0xe47e('0x2')]},'transport':{'type':Sequelize[_0xe47e('0x2')],'defaultValue':'udp','set':function(_0x152775){this['setDataValue']('transport',_0x152775?_0x152775[_0xe47e('0xe')](','):null);},'get':function(){return this[_0xe47e('0xf')]('transport')?this['getDataValue'](_0xe47e('0x10'))[_0xe47e('0x11')](','):null;},'comment':_0xe47e('0x12')},'dtmfmode':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x13'),_0xe47e('0x14'),_0xe47e('0x15'),'inband',_0xe47e('0x16')),'defaultValue':_0xe47e('0x13')},'directmedia':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no',_0xe47e('0x18'),_0xe47e('0x19'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xe47e('0x2')]},'directmediadeny':{'type':Sequelize[_0xe47e('0x2')]},'nat':{'type':Sequelize[_0xe47e('0x2')],'defaultValue':_0xe47e('0x1a'),'set':function(_0x26424a){this[_0xe47e('0x1b')]('nat',_0x26424a?_0x26424a[_0xe47e('0xe')](','):null);},'get':function(){return this[_0xe47e('0xf')](_0xe47e('0x1c'))?this['getDataValue'](_0xe47e('0x1c'))[_0xe47e('0x11')](','):null;},'comment':_0xe47e('0x1d')},'callgroup':{'type':Sequelize[_0xe47e('0x2')]},'namedcallgroup':{'type':Sequelize[_0xe47e('0x2')]},'pickupgroup':{'type':Sequelize[_0xe47e('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xe47e('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0xe47e('0x1e')},'allow':{'type':Sequelize[_0xe47e('0x2')],'allowNull':![],'defaultValue':_0xe47e('0x1f'),'set':function(_0x1a22dd){this[_0xe47e('0x1b')](_0xe47e('0x20'),_0x1a22dd?_0x1a22dd['join'](';'):_0xe47e('0x1f'));},'get':function(){return this[_0xe47e('0xf')](_0xe47e('0x20'))?this[_0xe47e('0xf')](_0xe47e('0x20'))[_0xe47e('0x11')](';'):null;},'comment':_0xe47e('0x21')},'autoframing':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0xe47e('0x22'),'set':function(_0x280f83){this[_0xe47e('0x1b')]('insecure',_0x280f83?_0x280f83['join'](','):null);},'get':function(){return this[_0xe47e('0xf')]('insecure')?this[_0xe47e('0xf')](_0xe47e('0x23'))[_0xe47e('0x11')](','):null;},'comment':_0xe47e('0x24')},'trustrpid':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no',_0xe47e('0x25'))},'promiscredir':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no')},'useclientcode':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no')},'accountcode':{'type':Sequelize[_0xe47e('0x26')](0xb)},'setvar':{'type':Sequelize[_0xe47e('0x2')]},'callerid':{'type':Sequelize[_0xe47e('0x2')],'defaultValue':_0xe47e('0x27')},'amaflags':{'type':Sequelize[_0xe47e('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0xe47e('0x17'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xe47e('0x26')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0xe47e('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no')},'allowtransfer':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no')},'ignoresdpversion':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no')},'subscribecontext':{'type':Sequelize[_0xe47e('0x2')]},'template':{'type':Sequelize[_0xe47e('0x2')]},'videosupport':{'type':Sequelize[_0xe47e('0x3')]('yes','no',_0xe47e('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xe47e('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xe47e('0x3')]('yes','no')},'mailbox':{'type':Sequelize[_0xe47e('0x2')]},'session_timers':{'type':Sequelize[_0xe47e('0x3')]('accept','refuse',_0xe47e('0x29'))},'session_expires':{'type':Sequelize[_0xe47e('0x26')](0xb)},'session_minse':{'type':Sequelize[_0xe47e('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x2a'),_0xe47e('0x2b')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xe47e('0x2')]},'regexten':{'type':Sequelize[_0xe47e('0x2')]},'fromdomain':{'type':Sequelize[_0xe47e('0x2')]},'fromuser':{'type':Sequelize[_0xe47e('0x2')]},'port':{'type':Sequelize[_0xe47e('0x26')](0x5)},'qualify':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xe47e('0x2')]},'defaultuser':{'type':Sequelize[_0xe47e('0x2')]},'rtptimeout':{'type':Sequelize[_0xe47e('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xe47e('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xe47e('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0xe47e('0x3')]('yes','no',_0xe47e('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xe47e('0x2')]},'callbackextension':{'type':Sequelize[_0xe47e('0x2')]},'timert1':{'type':Sequelize[_0xe47e('0x26')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xe47e('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0xe47e('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xe47e('0x2')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0xe47e('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no')},'force_avp':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no')},'icesupport':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no')},'dtlsenable':{'type':Sequelize[_0xe47e('0x3')]('yes','no')},'dtlsverify':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no',_0xe47e('0x2d'),_0xe47e('0x2e'))},'dtlsrekey':{'type':Sequelize[_0xe47e('0x26')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0xe47e('0x2')]},'dtlscipher':{'type':Sequelize[_0xe47e('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x2f'),_0xe47e('0x30'),_0xe47e('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xe47e('0x2')]},'usereqphone':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xe47e('0x2')]},'recordofffeature':{'type':Sequelize[_0xe47e('0x2')]},'call_limit':{'type':Sequelize[_0xe47e('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xe47e('0x17'),'no')},'subscribemwi':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no')},'vmexten':{'type':Sequelize[_0xe47e('0x2')]},'mohinterpret':{'type':Sequelize[_0xe47e('0x2')]},'mohsuggest':{'type':Sequelize[_0xe47e('0x2')]},'parkinglot':{'type':Sequelize[_0xe47e('0x2')]},'description':{'type':Sequelize[_0xe47e('0x2')]},'host':{'type':Sequelize[_0xe47e('0x2')],'defaultValue':_0xe47e('0x32')},'canreinvite':{'type':Sequelize[_0xe47e('0x3')](_0xe47e('0x17'),'no',_0xe47e('0x18'),'update',_0xe47e('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xe47e('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xe47e('0x34')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xe47e('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0xc87e=['outgoing','force_rport,comedia','nat','join','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','\x22\x22\x20<>','INTEGER','always','accept','originate','uac','pai','active','passive','actpass','dynamic','nonat','update','BOOLEAN','sequelize','exports','STRING','name','ENUM','user','peer','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','yes'];(function(_0x9bca53,_0x59b4f8){var _0x3894bc=function(_0x1ae67d){while(--_0x1ae67d){_0x9bca53['push'](_0x9bca53['shift']());}};_0x3894bc(++_0x59b4f8);}(_0xc87e,0xb1));var _0xec87=function(_0x24509f,_0x521970){_0x24509f=_0x24509f-0x0;var _0x25f0ef=_0xc87e[_0x24509f];return _0x25f0ef;};'use strict';var Sequelize=require(_0xec87('0x0'));module[_0xec87('0x1')]={'name':{'type':Sequelize[_0xec87('0x2')],'allowNull':![],'unique':_0xec87('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xec87('0x4')]('friend',_0xec87('0x5'),_0xec87('0x6')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xec87('0x2')],'allowNull':![],'defaultValue':_0xec87('0x7')},'callingpres':{'type':Sequelize[_0xec87('0x4')]('ALLOWED_NOT_SCREENED',_0xec87('0x8'),_0xec87('0x9'),'ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0xec87('0xa'),_0xec87('0xb'))},'deny':{'type':Sequelize[_0xec87('0x2')]},'permit':{'type':Sequelize[_0xec87('0x2')]},'secret':{'type':Sequelize[_0xec87('0x2')]},'md5secret':{'type':Sequelize[_0xec87('0x2')]},'remotesecret':{'type':Sequelize[_0xec87('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0xec87('0xc'),'set':function(_0x107659){this[_0xec87('0xd')](_0xec87('0xe'),_0x107659?_0x107659['join'](','):null);},'get':function(){return this[_0xec87('0xf')](_0xec87('0xe'))?this['getDataValue'](_0xec87('0xe'))[_0xec87('0x10')](','):null;},'comment':_0xec87('0x11')},'dtmfmode':{'type':Sequelize['ENUM'](_0xec87('0x12'),'info',_0xec87('0x13'),_0xec87('0x14'),_0xec87('0x15')),'defaultValue':_0xec87('0x12')},'directmedia':{'type':Sequelize['ENUM'](_0xec87('0x16'),'no','nonat','update',_0xec87('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xec87('0x4')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xec87('0x2')]},'directmediadeny':{'type':Sequelize[_0xec87('0x2')]},'nat':{'type':Sequelize[_0xec87('0x2')],'defaultValue':_0xec87('0x18'),'set':function(_0x4c6983){this[_0xec87('0xd')](_0xec87('0x19'),_0x4c6983?_0x4c6983[_0xec87('0x1a')](','):null);},'get':function(){return this['getDataValue'](_0xec87('0x19'))?this[_0xec87('0xf')]('nat')[_0xec87('0x10')](','):null;},'comment':_0xec87('0x1b')},'callgroup':{'type':Sequelize[_0xec87('0x2')]},'namedcallgroup':{'type':Sequelize[_0xec87('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xec87('0x2')]},'language':{'type':Sequelize[_0xec87('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xec87('0x2')],'defaultValue':_0xec87('0x1c')},'allow':{'type':Sequelize[_0xec87('0x2')],'allowNull':![],'defaultValue':_0xec87('0x1d'),'set':function(_0x5d6c50){this[_0xec87('0xd')](_0xec87('0x1e'),_0x5d6c50?_0x5d6c50[_0xec87('0x1a')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0xec87('0x1e'))?this[_0xec87('0xf')](_0xec87('0x1e'))['split'](';'):null;},'comment':_0xec87('0x1f')},'autoframing':{'type':Sequelize[_0xec87('0x4')](_0xec87('0x16'),'no')},'insecure':{'type':Sequelize[_0xec87('0x2')],'defaultValue':_0xec87('0x20'),'set':function(_0x1f4acd){this[_0xec87('0xd')](_0xec87('0x21'),_0x1f4acd?_0x1f4acd[_0xec87('0x1a')](','):null);},'get':function(){return this[_0xec87('0xf')](_0xec87('0x21'))?this[_0xec87('0xf')]('insecure')[_0xec87('0x10')](','):null;},'comment':_0xec87('0x22')},'trustrpid':{'type':Sequelize[_0xec87('0x4')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xec87('0x4')](_0xec87('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xec87('0x4')](_0xec87('0x16'),'no',_0xec87('0x23'))},'promiscredir':{'type':Sequelize[_0xec87('0x4')](_0xec87('0x16'),'no')},'useclientcode':{'type':Sequelize[_0xec87('0x4')](_0xec87('0x16'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xec87('0x2')],'defaultValue':_0xec87('0x24')},'amaflags':{'type':Sequelize[_0xec87('0x2')]},'callcounter':{'type':Sequelize[_0xec87('0x4')](_0xec87('0x16'),'no'),'defaultValue':_0xec87('0x16')},'busylevel':{'type':Sequelize[_0xec87('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0xec87('0x4')](_0xec87('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0xec87('0x4')](_0xec87('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0xec87('0x4')](_0xec87('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0xec87('0x4')](_0xec87('0x16'),'no')},'subscribecontext':{'type':Sequelize[_0xec87('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xec87('0x4')](_0xec87('0x16'),'no',_0xec87('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xec87('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no')},'mailbox':{'type':Sequelize[_0xec87('0x2')]},'session_timers':{'type':Sequelize[_0xec87('0x4')](_0xec87('0x27'),'refuse',_0xec87('0x28'))},'session_expires':{'type':Sequelize[_0xec87('0x25')](0xb)},'session_minse':{'type':Sequelize[_0xec87('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0xec87('0x4')](_0xec87('0x29'),'uas'),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xec87('0x2')]},'regexten':{'type':Sequelize[_0xec87('0x2')]},'fromdomain':{'type':Sequelize[_0xec87('0x2')]},'fromuser':{'type':Sequelize[_0xec87('0x2')]},'port':{'type':Sequelize[_0xec87('0x25')](0x5)},'qualify':{'type':Sequelize[_0xec87('0x4')](_0xec87('0x16'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xec87('0x25')](0xb)},'defaultip':{'type':Sequelize[_0xec87('0x2')]},'defaultuser':{'type':Sequelize[_0xec87('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0xec87('0x4')](_0xec87('0x16'),'no',_0xec87('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xec87('0x2')]},'callbackextension':{'type':Sequelize[_0xec87('0x2')]},'timert1':{'type':Sequelize[_0xec87('0x25')](0xb)},'timerb':{'type':Sequelize[_0xec87('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0xec87('0x25')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xec87('0x2')]},'contactacl':{'type':Sequelize[_0xec87('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xec87('0x2')]},'use_q850_reason':{'type':Sequelize[_0xec87('0x2')]},'maxforwards':{'type':Sequelize[_0xec87('0x25')](0xb)},'encryption':{'type':Sequelize[_0xec87('0x4')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no')},'force_avp':{'type':Sequelize[_0xec87('0x4')](_0xec87('0x16'),'no')},'icesupport':{'type':Sequelize[_0xec87('0x4')](_0xec87('0x16'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xec87('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0xec87('0x4')]('yes','no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize[_0xec87('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0xec87('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xec87('0x2')]},'dtlscipher':{'type':Sequelize[_0xec87('0x2')]},'dtlscafile':{'type':Sequelize[_0xec87('0x2')]},'dtlscapath':{'type':Sequelize[_0xec87('0x2')]},'dtlssetup':{'type':Sequelize[_0xec87('0x4')](_0xec87('0x2b'),_0xec87('0x2c'),_0xec87('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xec87('0x2')]},'usereqphone':{'type':Sequelize['ENUM'](_0xec87('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xec87('0x2')]},'recordofffeature':{'type':Sequelize[_0xec87('0x2')]},'call_limit':{'type':Sequelize[_0xec87('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xec87('0x4')]('yes','no')},'subscribemwi':{'type':Sequelize['ENUM'](_0xec87('0x16'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xec87('0x2')]},'mohsuggest':{'type':Sequelize[_0xec87('0x2')]},'parkinglot':{'type':Sequelize[_0xec87('0x2')]},'description':{'type':Sequelize[_0xec87('0x2')]},'host':{'type':Sequelize[_0xec87('0x2')],'defaultValue':_0xec87('0x2e')},'canreinvite':{'type':Sequelize[_0xec87('0x4')](_0xec87('0x16'),'no',_0xec87('0x2f'),_0xec87('0x30'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0xec87('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xec87('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xec87('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 7d35b6e..aab0744 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 _0xedd9=['body','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','create','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Trunk,\x20%s,\x20%s','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','get','Trunks','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','Trunk','findAll','rows','show','params','length','find','omit'];(function(_0x1c9b47,_0x3de6e1){var _0x500213=function(_0x3b0429){while(--_0x3b0429){_0x1c9b47['push'](_0x1c9b47['shift']());}};_0x500213(++_0x3de6e1);}(_0xedd9,0xfc));var _0x9edd=function(_0x85e229,_0x36af95){_0x85e229=_0x85e229-0x0;var _0x440d7c=_0xedd9[_0x85e229];return _0x440d7c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];var jayson=require(_0x9edd('0x18'));var client=jayson[_0x9edd('0x19')][_0x9edd('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xfca576,_0xef5498,_0x47eb64,_0x176bfa){return new BPromise(function(_0x44fc7c,_0x891832){var _0x4d9a7=_0x176bfa||client;return _0x4d9a7[_0x9edd('0x1b')](_0xfca576,_0x47eb64)[_0x9edd('0x1c')](function(_0x1042aa){logger[_0x9edd('0x1d')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x9edd('0x1e'));logger[_0x9edd('0x1f')](_0x9edd('0x20'),_0xef5498,'request\x20sent',JSON[_0x9edd('0x21')](_0x1042aa));if(_0x1042aa[_0x9edd('0x22')]){if(_0x1042aa[_0x9edd('0x22')]['code']===0x1f4){logger[_0x9edd('0x22')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x1042aa[_0x9edd('0x22')][_0x9edd('0x23')]);return _0x891832(_0x1042aa['error']['message']);}logger[_0x9edd('0x22')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x1042aa[_0x9edd('0x22')]['message']);return _0x44fc7c(_0x1042aa['error'][_0x9edd('0x23')]);}else{logger[_0x9edd('0x1d')]('Trunk,\x20%s,\x20%s',_0xef5498,'request\x20sent');_0x44fc7c(_0x1042aa[_0x9edd('0x24')][_0x9edd('0x23')]);}})[_0x9edd('0x25')](function(_0x542172){logger[_0x9edd('0x22')](_0x9edd('0x26'),_0xef5498,_0x542172);_0x891832(_0x542172);});});}function respondWithStatusCode(_0x44a6c1,_0x2ca65f){_0x2ca65f=_0x2ca65f||0xcc;return function(_0x339a0d){if(_0x339a0d){return _0x44a6c1['sendStatus'](_0x2ca65f);}return _0x44a6c1[_0x9edd('0x27')](_0x2ca65f)[_0x9edd('0x28')]();};}function respondWithResult(_0x3a1ea5,_0x2f9f86){_0x2f9f86=_0x2f9f86||0xc8;return function(_0x310a4d){if(_0x310a4d){return _0x3a1ea5['status'](_0x2f9f86)['json'](_0x310a4d);}};}function respondWithFilteredResult(_0x3276ee,_0xfeca7b){return function(_0x8d67aa){if(_0x8d67aa){var _0x25e135=typeof _0xfeca7b[_0x9edd('0x29')]==='undefined'&&typeof _0xfeca7b['limit']===_0x9edd('0x2a');var _0x257a26=_0x8d67aa[_0x9edd('0x2b')];var _0x52746a=_0x25e135?0x0:_0xfeca7b[_0x9edd('0x29')];var _0x28cfae=_0x25e135?_0x8d67aa[_0x9edd('0x2b')]:_0xfeca7b[_0x9edd('0x29')]+_0xfeca7b['limit'];var _0x2155a1;if(_0x28cfae>=_0x257a26){_0x28cfae=_0x257a26;_0x2155a1=0xc8;}else{_0x2155a1=0xce;}_0x3276ee[_0x9edd('0x27')](_0x2155a1);return _0x3276ee[_0x9edd('0x2c')](_0x9edd('0x2d'),_0x52746a+'-'+_0x28cfae+'/'+_0x257a26)[_0x9edd('0x2e')](_0x8d67aa);}return null;};}function patchUpdates(_0x42e664){return function(_0x209aba){try{jsonpatch[_0x9edd('0x2f')](_0x209aba,_0x42e664,!![]);}catch(_0x19b6c1){return BPromise[_0x9edd('0x30')](_0x19b6c1);}return _0x209aba[_0x9edd('0x31')]();};}function saveUpdates(_0x138002,_0x6907a5){return function(_0xa55906){if(_0xa55906){return _0xa55906[_0x9edd('0x32')](_0x138002)['then'](function(_0x1453d2){return _0x1453d2;});}return null;};}function removeEntity(_0x259259,_0x267c74){return function(_0x5d1707){if(_0x5d1707){return _0x5d1707[_0x9edd('0x33')]()[_0x9edd('0x1c')](function(){var _0xde9b13=_0x5d1707[_0x9edd('0x34')]({'plain':!![]});var _0x21bc30=_0x9edd('0x35');return db[_0x9edd('0x36')][_0x9edd('0x33')]({'where':{'type':_0x21bc30,'resourceId':_0xde9b13['id']}})[_0x9edd('0x1c')](function(){return _0x5d1707;});})[_0x9edd('0x1c')](function(){_0x259259[_0x9edd('0x27')](0xcc)[_0x9edd('0x28')]();});}};}function handleEntityNotFound(_0x27eb7e,_0x14f780){return function(_0x5757fc){if(!_0x5757fc){_0x27eb7e[_0x9edd('0x37')](0x194);}return _0x5757fc;};}function handleError(_0x5ed62d,_0x968303){_0x968303=_0x968303||0x1f4;return function(_0x148630){logger[_0x9edd('0x22')](_0x148630[_0x9edd('0x38')]);if(_0x148630[_0x9edd('0x39')]){delete _0x148630['name'];}_0x5ed62d[_0x9edd('0x27')](_0x968303)[_0x9edd('0x3a')](_0x148630);};}exports[_0x9edd('0x3b')]=function(_0x38e9be,_0x1be77f){var _0x337e6c={},_0x5c0627={},_0x1cbbac={'count':0x0,'rows':[]};var _0x1ccee8=_[_0x9edd('0x3c')](db['Trunk'][_0x9edd('0x3d')],function(_0x56a228){return{'name':_0x56a228[_0x9edd('0x3e')],'type':_0x56a228['type'][_0x9edd('0x3f')]};});_0x5c0627[_0x9edd('0x40')]=_[_0x9edd('0x3c')](_0x1ccee8,'name');_0x5c0627[_0x9edd('0x41')]=_[_0x9edd('0x42')](_0x38e9be[_0x9edd('0x41')]);_0x5c0627['filters']=_[_0x9edd('0x43')](_0x5c0627['model'],_0x5c0627[_0x9edd('0x41')]);_0x337e6c[_0x9edd('0x44')]=_['intersection'](_0x5c0627[_0x9edd('0x40')],qs[_0x9edd('0x45')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x45')]));_0x337e6c['attributes']=_0x337e6c[_0x9edd('0x44')]['length']?_0x337e6c[_0x9edd('0x44')]:_0x5c0627[_0x9edd('0x40')];if(!_0x38e9be['query'][_0x9edd('0x46')]('nolimit')){_0x337e6c['limit']=qs[_0x9edd('0x47')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x47')]);_0x337e6c[_0x9edd('0x29')]=qs[_0x9edd('0x29')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x29')]);}_0x337e6c[_0x9edd('0x48')]=qs[_0x9edd('0x49')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x49')]);_0x337e6c[_0x9edd('0x4a')]=qs[_0x9edd('0x4b')](_[_0x9edd('0x4c')](_0x38e9be[_0x9edd('0x41')],_0x5c0627['filters']),_0x1ccee8);if(_0x38e9be[_0x9edd('0x41')][_0x9edd('0x4d')]){_0x337e6c[_0x9edd('0x4a')]=_[_0x9edd('0x4e')](_0x337e6c[_0x9edd('0x4a')],{'$or':_[_0x9edd('0x3c')](_0x1ccee8,function(_0x10d41e){if(_0x10d41e['type']!=='VIRTUAL'){var _0x4bc7a1={};_0x4bc7a1[_0x10d41e[_0x9edd('0x39')]]={'$like':'%'+_0x38e9be['query'][_0x9edd('0x4d')]+'%'};return _0x4bc7a1;}})});}_0x337e6c=_[_0x9edd('0x4e')]({},_0x337e6c,_0x38e9be[_0x9edd('0x4f')]);var _0x8db801={'where':_0x337e6c[_0x9edd('0x4a')]};return db['Trunk'][_0x9edd('0x2b')](_0x8db801)[_0x9edd('0x1c')](function(_0x40e33d){_0x1cbbac['count']=_0x40e33d;if(_0x38e9be[_0x9edd('0x41')][_0x9edd('0x50')]){_0x337e6c[_0x9edd('0x51')]=[{'all':!![]}];}return db[_0x9edd('0x52')][_0x9edd('0x53')](_0x337e6c);})[_0x9edd('0x1c')](function(_0x4d4f33){_0x1cbbac[_0x9edd('0x54')]=_0x4d4f33;return _0x1cbbac;})[_0x9edd('0x1c')](respondWithFilteredResult(_0x1be77f,_0x337e6c))['catch'](handleError(_0x1be77f,null));};exports[_0x9edd('0x55')]=function(_0x8d8701,_0x4bb324){var _0x2bd089={'raw':![],'where':{'id':_0x8d8701[_0x9edd('0x56')]['id']}},_0x8134cd={};_0x8134cd['model']=_[_0x9edd('0x42')](db[_0x9edd('0x52')][_0x9edd('0x3d')]);_0x8134cd[_0x9edd('0x41')]=_['keys'](_0x8d8701[_0x9edd('0x41')]);_0x8134cd[_0x9edd('0x4b')]=_[_0x9edd('0x43')](_0x8134cd['model'],_0x8134cd[_0x9edd('0x41')]);_0x2bd089[_0x9edd('0x44')]=_['intersection'](_0x8134cd[_0x9edd('0x40')],qs['fields'](_0x8d8701[_0x9edd('0x41')][_0x9edd('0x45')]));_0x2bd089[_0x9edd('0x44')]=_0x2bd089[_0x9edd('0x44')][_0x9edd('0x57')]?_0x2bd089[_0x9edd('0x44')]:_0x8134cd[_0x9edd('0x40')];if(_0x8d8701[_0x9edd('0x41')][_0x9edd('0x50')]){_0x2bd089[_0x9edd('0x51')]=[{'all':!![]}];}_0x2bd089=_[_0x9edd('0x4e')]({},_0x2bd089,_0x8d8701['options']);return db[_0x9edd('0x52')][_0x9edd('0x58')](_0x2bd089)[_0x9edd('0x1c')](handleEntityNotFound(_0x4bb324,null))['then'](respondWithResult(_0x4bb324,null))[_0x9edd('0x25')](handleError(_0x4bb324,null));};exports['clone']=function(_0x54d83d,_0x54ecfa){var _0x1348a7={'where':{'id':_0x54d83d[_0x9edd('0x56')]['id']}},_0x45f47c={};_0x45f47c[_0x9edd('0x40')]=_['keys'](db['Trunk']['rawAttributes']);_0x1348a7[_0x9edd('0x44')]=_[_0x9edd('0x43')](_0x45f47c[_0x9edd('0x40')],qs[_0x9edd('0x45')](_0x54d83d[_0x9edd('0x41')][_0x9edd('0x45')]));_0x1348a7[_0x9edd('0x44')]=_0x1348a7[_0x9edd('0x44')]['length']?_0x1348a7[_0x9edd('0x44')]:_0x45f47c['model'];if(_0x54d83d[_0x9edd('0x41')][_0x9edd('0x50')]){_0x1348a7['include']=[{'all':!![]}];}_0x1348a7=_[_0x9edd('0x4e')]({},_0x1348a7,_0x54d83d[_0x9edd('0x4f')]);return db[_0x9edd('0x52')]['find'](_0x1348a7)[_0x9edd('0x1c')](handleEntityNotFound(_0x54ecfa,null))[_0x9edd('0x1c')](function(_0x430eb4){if(_0x430eb4){var _0x15ebfa=_0x430eb4[_0x9edd('0x34')]({'plain':!![]});_0x15ebfa=qs[_0x9edd('0x59')](_0x15ebfa,['id','createdAt','updatedAt']);_0x54d83d[_0x9edd('0x5a')]=_['omit'](_0x54d83d[_0x9edd('0x5a')],['id',_0x9edd('0x5b'),_0x9edd('0x5c')]);return db[_0x9edd('0x52')]['create'](_[_0x9edd('0x4e')](_0x15ebfa,_0x54d83d['body']),{'include':_0x54d83d[_0x9edd('0x41')][_0x9edd('0x50')]?[{'all':!![]}]:undefined})[_0x9edd('0x1c')](function(_0x5ca123){var _0x2651a2=_0x54d83d['user'][_0x9edd('0x34')]({'plain':!![]});if(!_0x2651a2)throw new Error(_0x9edd('0x5d'));if(_0x2651a2['role']===_0x9edd('0x5e')){var _0x4a72d0=_0x5ca123[_0x9edd('0x34')]({'plain':!![]});var _0x134c9c=_0x9edd('0x35');return db['UserProfileSection'][_0x9edd('0x58')]({'where':{'name':_0x134c9c,'userProfileId':_0x2651a2[_0x9edd('0x5f')]},'raw':!![]})[_0x9edd('0x1c')](function(_0x2015fc){if(_0x2015fc&&_0x2015fc[_0x9edd('0x60')]===0x0){return db['UserProfileResource']['create']({'name':_0x4a72d0[_0x9edd('0x39')],'resourceId':_0x4a72d0['id'],'type':_0x2015fc[_0x9edd('0x39')],'sectionId':_0x2015fc['id']},{})['then'](function(){return _0x5ca123;});}else{return _0x5ca123;}})['catch'](function(_0x52afd7){logger[_0x9edd('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x52afd7);throw _0x52afd7;});}return _0x5ca123;});}})['then'](respondWithResult(_0x54ecfa,0xc9))[_0x9edd('0x25')](handleError(_0x54ecfa,null));};exports[_0x9edd('0x61')]=function(_0x589348,_0xb9ebeb,_0x11e082){var _0x34dff5;return db['Trunk'][_0x9edd('0x61')](_0x589348['body'],{'raw':!![]})[_0x9edd('0x1c')](function(_0x18d1a0){_0x34dff5=_0x18d1a0;return db['Trunk'][_0x9edd('0x53')]({'raw':!![]});})[_0x9edd('0x1c')](function(_0x5c1746){var _0x2bd6d1=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],'server/files/templates/trunk.ejs'),_0x9edd('0x65'));var _0x58330c=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],'server/files/templates/registry.ejs'),_0x9edd('0x65'));var _0x286593=ejs[_0x9edd('0x66')](_0x2bd6d1,{'trunks':_0x5c1746||[]});fs[_0x9edd('0x67')](_0x9edd('0x68'),_0x286593);if(_0x34dff5[_0x9edd('0x69')]){var _0x3fa4a9=ejs['render'](_0x58330c,{'trunks':_0x5c1746||[]});fs['writeFileSync'](_0x9edd('0x6a'),_0x3fa4a9);}})[_0x9edd('0x1c')](function(){return respondWithRpcPromise(_0x9edd('0x6b'),_0x9edd('0x61'),{'module':_0x9edd('0x6c')});})['then'](function(){var _0x2e40c8=_0x589348[_0x9edd('0x5e')][_0x9edd('0x34')]({'plain':!![]});if(!_0x2e40c8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e40c8[_0x9edd('0x6d')]===_0x9edd('0x5e')){var _0x4b1c12=_0x34dff5[_0x9edd('0x34')]({'plain':!![]});return db[_0x9edd('0x6e')]['find']({'where':{'name':_0x9edd('0x35'),'userProfileId':_0x2e40c8[_0x9edd('0x5f')]},'raw':!![]})['then'](function(_0x3f08ac){if(_0x3f08ac&&_0x3f08ac['autoAssociation']===0x0){return db['UserProfileResource'][_0x9edd('0x61')]({'name':_0x4b1c12[_0x9edd('0x39')],'resourceId':_0x4b1c12['id'],'type':_0x3f08ac[_0x9edd('0x39')],'sectionId':_0x3f08ac['id']},{})['then'](function(){return _0x34dff5;});}else{return _0x34dff5;}})[_0x9edd('0x25')](function(_0x286e47){logger['error'](_0x9edd('0x6f'),_0x286e47);throw _0x286e47;});}return _0x34dff5;})[_0x9edd('0x1c')](respondWithResult(_0xb9ebeb,0xc9))[_0x9edd('0x25')](handleError(_0xb9ebeb,null));};exports[_0x9edd('0x32')]=function(_0x54ac71,_0x5e68db,_0x1129b7){var _0x5bb28c;return db[_0x9edd('0x52')][_0x9edd('0x58')]({'where':{'id':_0x54ac71[_0x9edd('0x56')]['id']}})[_0x9edd('0x1c')](handleEntityNotFound(_0x5e68db,null))[_0x9edd('0x1c')](saveUpdates(_0x54ac71[_0x9edd('0x5a')],null))[_0x9edd('0x1c')](function(_0x5a4d4b){if(_0x5a4d4b){_0x5bb28c=_0x5a4d4b;return db[_0x9edd('0x52')]['findAll']({'raw':!![]});}})[_0x9edd('0x1c')](function(_0x3c4db7){if(_0x3c4db7){var _0x2c7562=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],_0x9edd('0x70')),'utf8');var _0x25e3e7=fs[_0x9edd('0x62')](path['join'](config[_0x9edd('0x64')],_0x9edd('0x71')),'utf8');var _0x304e56=ejs[_0x9edd('0x66')](_0x2c7562,{'trunks':_0x3c4db7||[]});fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_trunks.conf',_0x304e56);var _0x41cd76=ejs[_0x9edd('0x66')](_0x25e3e7,{'trunks':_0x3c4db7||[]});fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_registers.conf',_0x41cd76);return respondWithRpcPromise('Reload','update',{'module':'chan_sip.so'});}return null;})[_0x9edd('0x1c')](function(_0x1a6d3d){if(_0x1a6d3d){return _0x5bb28c;}})[_0x9edd('0x1c')](respondWithResult(_0x5e68db,null))['catch'](handleError(_0x5e68db,null));};exports['destroy']=function(_0x49dc1d,_0x56d794,_0x388252){var _0x20762d;return db[_0x9edd('0x52')][_0x9edd('0x58')]({'where':{'id':_0x49dc1d[_0x9edd('0x56')]['id']}})[_0x9edd('0x1c')](handleEntityNotFound(_0x56d794,null))[_0x9edd('0x1c')](removeEntity(_0x56d794,null))[_0x9edd('0x1c')](function(){return db[_0x9edd('0x52')][_0x9edd('0x53')]({'raw':!![]});})[_0x9edd('0x1c')](function(_0x4cfa99){var _0x367fc6=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],_0x9edd('0x70')),_0x9edd('0x65'));var _0x3d4890=fs[_0x9edd('0x62')](path['join'](config['root'],_0x9edd('0x71')),'utf8');var _0x35950b=ejs['render'](_0x367fc6,{'trunks':_0x4cfa99});var _0x21c35f=ejs[_0x9edd('0x66')](_0x3d4890,{'trunks':_0x4cfa99});fs['writeFileSync'](_0x9edd('0x68'),_0x35950b);fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_registers.conf',_0x21c35f);return respondWithRpcPromise(_0x9edd('0x6b'),_0x9edd('0x33'),{'module':_0x9edd('0x6c')});})[_0x9edd('0x25')](handleError(_0x56d794,null));}; \ No newline at end of file +var _0xf3cd=['length','limit','sort','where','filter','merge','options','Trunk','includeAll','include','findAll','show','find','clone','createdAt','updatedAt','omit','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','utf8','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','userProfileId','autoAssociation','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','undefined','offset','count','json','reject','save','update','get','UserProfileResource','destroy','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields'];(function(_0x524a18,_0x2a7598){var _0x2ca9c6=function(_0x5ba5bc){while(--_0x5ba5bc){_0x524a18['push'](_0x524a18['shift']());}};_0x2ca9c6(++_0x2a7598);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x4322c6,_0x28f126){_0x4322c6=_0x4322c6-0x0;var _0x4e7537=_0xf3cd[_0x4322c6];return _0x4e7537;};'use strict';var emlformat=require(_0xdf3c('0x0'));var rimraf=require(_0xdf3c('0x1'));var zipdir=require(_0xdf3c('0x2'));var jsonpatch=require(_0xdf3c('0x3'));var rp=require(_0xdf3c('0x4'));var moment=require(_0xdf3c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdf3c('0x6'));var util=require(_0xdf3c('0x7'));var path=require(_0xdf3c('0x8'));var sox=require('sox');var csv=require(_0xdf3c('0x9'));var ejs=require(_0xdf3c('0xa'));var fs=require('fs');var fs_extra=require(_0xdf3c('0xb'));var _=require(_0xdf3c('0xc'));var squel=require(_0xdf3c('0xd'));var crypto=require(_0xdf3c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdf3c('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdf3c('0x10'));var Redis=require(_0xdf3c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdf3c('0x12'));var as=require(_0xdf3c('0x13'));var hardwareService=require(_0xdf3c('0x14'));var logger=require(_0xdf3c('0x15'))(_0xdf3c('0x16'));var utils=require(_0xdf3c('0x17'));var config=require(_0xdf3c('0x18'));var licenseUtil=require(_0xdf3c('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0xdf3c('0x1a'));var client=jayson[_0xdf3c('0x1b')][_0xdf3c('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x17319c,_0x59e431,_0x2ae4ad,_0x461079){return new BPromise(function(_0x13ea5f,_0x5e0047){var _0x18aafa=_0x461079||client;return _0x18aafa[_0xdf3c('0x1d')](_0x17319c,_0x2ae4ad)[_0xdf3c('0x1e')](function(_0x4274fd){logger[_0xdf3c('0x1f')](_0xdf3c('0x20'),_0x59e431,_0xdf3c('0x21'));logger[_0xdf3c('0x22')](_0xdf3c('0x23'),_0x59e431,_0xdf3c('0x21'),JSON['stringify'](_0x4274fd));if(_0x4274fd[_0xdf3c('0x24')]){if(_0x4274fd[_0xdf3c('0x24')][_0xdf3c('0x25')]===0x1f4){logger[_0xdf3c('0x24')](_0xdf3c('0x20'),_0x59e431,_0x4274fd[_0xdf3c('0x24')][_0xdf3c('0x26')]);return _0x5e0047(_0x4274fd[_0xdf3c('0x24')][_0xdf3c('0x26')]);}logger[_0xdf3c('0x24')](_0xdf3c('0x20'),_0x59e431,_0x4274fd[_0xdf3c('0x24')][_0xdf3c('0x26')]);return _0x13ea5f(_0x4274fd['error']['message']);}else{logger[_0xdf3c('0x1f')]('Trunk,\x20%s,\x20%s',_0x59e431,_0xdf3c('0x21'));_0x13ea5f(_0x4274fd[_0xdf3c('0x27')][_0xdf3c('0x26')]);}})[_0xdf3c('0x28')](function(_0x33652f){logger[_0xdf3c('0x24')]('Trunk,\x20%s,\x20%s',_0x59e431,_0x33652f);_0x5e0047(_0x33652f);});});}function respondWithStatusCode(_0x22a164,_0x213d75){_0x213d75=_0x213d75||0xcc;return function(_0x13e3ca){if(_0x13e3ca){return _0x22a164[_0xdf3c('0x29')](_0x213d75);}return _0x22a164[_0xdf3c('0x2a')](_0x213d75)[_0xdf3c('0x2b')]();};}function respondWithResult(_0xef54cb,_0x155f54){_0x155f54=_0x155f54||0xc8;return function(_0x18cb46){if(_0x18cb46){return _0xef54cb[_0xdf3c('0x2a')](_0x155f54)['json'](_0x18cb46);}};}function respondWithFilteredResult(_0xd284d7,_0x153daa){return function(_0x4b57a4){if(_0x4b57a4){var _0xdc8962=typeof _0x153daa['offset']==='undefined'&&typeof _0x153daa['limit']===_0xdf3c('0x2c');var _0x186bba=_0x4b57a4['count'];var _0x5c3b5a=_0xdc8962?0x0:_0x153daa[_0xdf3c('0x2d')];var _0x1f2ce4=_0xdc8962?_0x4b57a4[_0xdf3c('0x2e')]:_0x153daa[_0xdf3c('0x2d')]+_0x153daa['limit'];var _0x43ce06;if(_0x1f2ce4>=_0x186bba){_0x1f2ce4=_0x186bba;_0x43ce06=0xc8;}else{_0x43ce06=0xce;}_0xd284d7[_0xdf3c('0x2a')](_0x43ce06);return _0xd284d7['set']('Content-Range',_0x5c3b5a+'-'+_0x1f2ce4+'/'+_0x186bba)[_0xdf3c('0x2f')](_0x4b57a4);}return null;};}function patchUpdates(_0x46f0e3){return function(_0x36937e){try{jsonpatch['apply'](_0x36937e,_0x46f0e3,!![]);}catch(_0x2355f6){return BPromise[_0xdf3c('0x30')](_0x2355f6);}return _0x36937e[_0xdf3c('0x31')]();};}function saveUpdates(_0x10099e,_0x575ae1){return function(_0xda0de0){if(_0xda0de0){return _0xda0de0[_0xdf3c('0x32')](_0x10099e)['then'](function(_0x40ae3d){return _0x40ae3d;});}return null;};}function removeEntity(_0x3daeda,_0x217a65){return function(_0x2287f){if(_0x2287f){return _0x2287f['destroy']()[_0xdf3c('0x1e')](function(){var _0x360d5c=_0x2287f[_0xdf3c('0x33')]({'plain':!![]});var _0x3b9ce8='Trunks';return db[_0xdf3c('0x34')][_0xdf3c('0x35')]({'where':{'type':_0x3b9ce8,'resourceId':_0x360d5c['id']}})['then'](function(){return _0x2287f;});})['then'](function(){_0x3daeda[_0xdf3c('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x216115,_0x5e8130){return function(_0x57faba){if(!_0x57faba){_0x216115['sendStatus'](0x194);}return _0x57faba;};}function handleError(_0x44a478,_0x2ee9ad){_0x2ee9ad=_0x2ee9ad||0x1f4;return function(_0x1d0b8a){logger[_0xdf3c('0x24')](_0x1d0b8a['stack']);if(_0x1d0b8a['name']){delete _0x1d0b8a[_0xdf3c('0x36')];}_0x44a478['status'](_0x2ee9ad)[_0xdf3c('0x37')](_0x1d0b8a);};}exports[_0xdf3c('0x38')]=function(_0x3628ae,_0xcdd731){var _0x1004e9={},_0x1e0cf2={},_0x1c7335={'count':0x0,'rows':[]};var _0x809f3d=_[_0xdf3c('0x39')](db['Trunk'][_0xdf3c('0x3a')],function(_0x54e689){return{'name':_0x54e689['fieldName'],'type':_0x54e689[_0xdf3c('0x3b')]['key']};});_0x1e0cf2[_0xdf3c('0x3c')]=_['map'](_0x809f3d,_0xdf3c('0x36'));_0x1e0cf2[_0xdf3c('0x3d')]=_[_0xdf3c('0x3e')](_0x3628ae[_0xdf3c('0x3d')]);_0x1e0cf2[_0xdf3c('0x3f')]=_[_0xdf3c('0x40')](_0x1e0cf2[_0xdf3c('0x3c')],_0x1e0cf2[_0xdf3c('0x3d')]);_0x1004e9[_0xdf3c('0x41')]=_[_0xdf3c('0x40')](_0x1e0cf2[_0xdf3c('0x3c')],qs[_0xdf3c('0x42')](_0x3628ae['query']['fields']));_0x1004e9[_0xdf3c('0x41')]=_0x1004e9['attributes'][_0xdf3c('0x43')]?_0x1004e9[_0xdf3c('0x41')]:_0x1e0cf2[_0xdf3c('0x3c')];if(!_0x3628ae[_0xdf3c('0x3d')]['hasOwnProperty']('nolimit')){_0x1004e9[_0xdf3c('0x44')]=qs[_0xdf3c('0x44')](_0x3628ae[_0xdf3c('0x3d')]['limit']);_0x1004e9[_0xdf3c('0x2d')]=qs[_0xdf3c('0x2d')](_0x3628ae[_0xdf3c('0x3d')][_0xdf3c('0x2d')]);}_0x1004e9['order']=qs[_0xdf3c('0x45')](_0x3628ae[_0xdf3c('0x3d')][_0xdf3c('0x45')]);_0x1004e9[_0xdf3c('0x46')]=qs[_0xdf3c('0x3f')](_['pick'](_0x3628ae[_0xdf3c('0x3d')],_0x1e0cf2[_0xdf3c('0x3f')]),_0x809f3d);if(_0x3628ae[_0xdf3c('0x3d')][_0xdf3c('0x47')]){_0x1004e9[_0xdf3c('0x46')]=_[_0xdf3c('0x48')](_0x1004e9['where'],{'$or':_['map'](_0x809f3d,function(_0x2c6c6d){if(_0x2c6c6d[_0xdf3c('0x3b')]!=='VIRTUAL'){var _0x5c9885={};_0x5c9885[_0x2c6c6d[_0xdf3c('0x36')]]={'$like':'%'+_0x3628ae[_0xdf3c('0x3d')][_0xdf3c('0x47')]+'%'};return _0x5c9885;}})});}_0x1004e9=_[_0xdf3c('0x48')]({},_0x1004e9,_0x3628ae[_0xdf3c('0x49')]);var _0x2dbf54={'where':_0x1004e9[_0xdf3c('0x46')]};return db[_0xdf3c('0x4a')][_0xdf3c('0x2e')](_0x2dbf54)['then'](function(_0x129c2a){_0x1c7335[_0xdf3c('0x2e')]=_0x129c2a;if(_0x3628ae[_0xdf3c('0x3d')][_0xdf3c('0x4b')]){_0x1004e9[_0xdf3c('0x4c')]=[{'all':!![]}];}return db[_0xdf3c('0x4a')][_0xdf3c('0x4d')](_0x1004e9);})['then'](function(_0x1751a8){_0x1c7335['rows']=_0x1751a8;return _0x1c7335;})[_0xdf3c('0x1e')](respondWithFilteredResult(_0xcdd731,_0x1004e9))['catch'](handleError(_0xcdd731,null));};exports[_0xdf3c('0x4e')]=function(_0x28144f,_0x2ec575){var _0x94c5b9={'raw':![],'where':{'id':_0x28144f['params']['id']}},_0x5eef94={};_0x5eef94['model']=_[_0xdf3c('0x3e')](db['Trunk'][_0xdf3c('0x3a')]);_0x5eef94[_0xdf3c('0x3d')]=_[_0xdf3c('0x3e')](_0x28144f[_0xdf3c('0x3d')]);_0x5eef94[_0xdf3c('0x3f')]=_['intersection'](_0x5eef94['model'],_0x5eef94[_0xdf3c('0x3d')]);_0x94c5b9[_0xdf3c('0x41')]=_['intersection'](_0x5eef94[_0xdf3c('0x3c')],qs[_0xdf3c('0x42')](_0x28144f[_0xdf3c('0x3d')][_0xdf3c('0x42')]));_0x94c5b9[_0xdf3c('0x41')]=_0x94c5b9[_0xdf3c('0x41')][_0xdf3c('0x43')]?_0x94c5b9['attributes']:_0x5eef94['model'];if(_0x28144f[_0xdf3c('0x3d')][_0xdf3c('0x4b')]){_0x94c5b9[_0xdf3c('0x4c')]=[{'all':!![]}];}_0x94c5b9=_[_0xdf3c('0x48')]({},_0x94c5b9,_0x28144f[_0xdf3c('0x49')]);return db[_0xdf3c('0x4a')][_0xdf3c('0x4f')](_0x94c5b9)[_0xdf3c('0x1e')](handleEntityNotFound(_0x2ec575,null))[_0xdf3c('0x1e')](respondWithResult(_0x2ec575,null))[_0xdf3c('0x28')](handleError(_0x2ec575,null));};exports[_0xdf3c('0x50')]=function(_0x4cb28f,_0x1eebcf){var _0x47cb74={'where':{'id':_0x4cb28f['params']['id']}},_0x5e7247={};_0x5e7247['model']=_['keys'](db[_0xdf3c('0x4a')][_0xdf3c('0x3a')]);_0x47cb74['attributes']=_[_0xdf3c('0x40')](_0x5e7247[_0xdf3c('0x3c')],qs['fields'](_0x4cb28f[_0xdf3c('0x3d')][_0xdf3c('0x42')]));_0x47cb74[_0xdf3c('0x41')]=_0x47cb74[_0xdf3c('0x41')][_0xdf3c('0x43')]?_0x47cb74[_0xdf3c('0x41')]:_0x5e7247[_0xdf3c('0x3c')];if(_0x4cb28f[_0xdf3c('0x3d')][_0xdf3c('0x4b')]){_0x47cb74[_0xdf3c('0x4c')]=[{'all':!![]}];}_0x47cb74=_[_0xdf3c('0x48')]({},_0x47cb74,_0x4cb28f['options']);return db[_0xdf3c('0x4a')][_0xdf3c('0x4f')](_0x47cb74)[_0xdf3c('0x1e')](handleEntityNotFound(_0x1eebcf,null))['then'](function(_0x245c68){if(_0x245c68){var _0x3e327e=_0x245c68[_0xdf3c('0x33')]({'plain':!![]});_0x3e327e=qs['omit'](_0x3e327e,['id',_0xdf3c('0x51'),_0xdf3c('0x52')]);_0x4cb28f['body']=_[_0xdf3c('0x53')](_0x4cb28f['body'],['id',_0xdf3c('0x51'),_0xdf3c('0x52')]);return db[_0xdf3c('0x4a')][_0xdf3c('0x54')](_[_0xdf3c('0x48')](_0x3e327e,_0x4cb28f[_0xdf3c('0x55')]),{'include':_0x4cb28f[_0xdf3c('0x3d')][_0xdf3c('0x4b')]?[{'all':!![]}]:undefined})[_0xdf3c('0x1e')](function(_0x330730){var _0x283be2=_0x4cb28f[_0xdf3c('0x56')][_0xdf3c('0x33')]({'plain':!![]});if(!_0x283be2)throw new Error(_0xdf3c('0x57'));if(_0x283be2[_0xdf3c('0x58')]===_0xdf3c('0x56')){var _0xd7fb2d=_0x330730['get']({'plain':!![]});var _0x4dade5=_0xdf3c('0x59');return db[_0xdf3c('0x5a')][_0xdf3c('0x4f')]({'where':{'name':_0x4dade5,'userProfileId':_0x283be2['userProfileId']},'raw':!![]})[_0xdf3c('0x1e')](function(_0x5f2765){if(_0x5f2765&&_0x5f2765['autoAssociation']===0x0){return db[_0xdf3c('0x34')][_0xdf3c('0x54')]({'name':_0xd7fb2d[_0xdf3c('0x36')],'resourceId':_0xd7fb2d['id'],'type':_0x5f2765[_0xdf3c('0x36')],'sectionId':_0x5f2765['id']},{})[_0xdf3c('0x1e')](function(){return _0x330730;});}else{return _0x330730;}})[_0xdf3c('0x28')](function(_0x1a31d7){logger[_0xdf3c('0x24')](_0xdf3c('0x5b'),_0x1a31d7);throw _0x1a31d7;});}return _0x330730;});}})[_0xdf3c('0x1e')](respondWithResult(_0x1eebcf,0xc9))[_0xdf3c('0x28')](handleError(_0x1eebcf,null));};exports[_0xdf3c('0x54')]=function(_0x34000c,_0x4be79a,_0x3febac){var _0x2cb0f5;return db[_0xdf3c('0x4a')][_0xdf3c('0x54')](_0x34000c[_0xdf3c('0x55')],{'raw':!![]})['then'](function(_0x18bf4f){_0x2cb0f5=_0x18bf4f;return db[_0xdf3c('0x4a')][_0xdf3c('0x4d')]({'raw':!![]});})[_0xdf3c('0x1e')](function(_0x1efa9c){var _0x50805c=fs[_0xdf3c('0x5c')](path[_0xdf3c('0x5d')](config[_0xdf3c('0x5e')],_0xdf3c('0x5f')),'utf8');var _0xb867a1=fs[_0xdf3c('0x5c')](path[_0xdf3c('0x5d')](config[_0xdf3c('0x5e')],_0xdf3c('0x60')),_0xdf3c('0x61'));var _0x19c851=ejs['render'](_0x50805c,{'trunks':_0x1efa9c||[]});fs[_0xdf3c('0x62')](_0xdf3c('0x63'),_0x19c851);if(_0x2cb0f5['registry']){var _0x52a2e1=ejs[_0xdf3c('0x64')](_0xb867a1,{'trunks':_0x1efa9c||[]});fs[_0xdf3c('0x62')](_0xdf3c('0x65'),_0x52a2e1);}})[_0xdf3c('0x1e')](function(){return respondWithRpcPromise(_0xdf3c('0x66'),_0xdf3c('0x54'),{'module':_0xdf3c('0x67')});})[_0xdf3c('0x1e')](function(){var _0x5e6606=_0x34000c[_0xdf3c('0x56')][_0xdf3c('0x33')]({'plain':!![]});if(!_0x5e6606)throw new Error(_0xdf3c('0x57'));if(_0x5e6606['role']===_0xdf3c('0x56')){var _0x354ff4=_0x2cb0f5[_0xdf3c('0x33')]({'plain':!![]});return db['UserProfileSection'][_0xdf3c('0x4f')]({'where':{'name':_0xdf3c('0x59'),'userProfileId':_0x5e6606[_0xdf3c('0x68')]},'raw':!![]})[_0xdf3c('0x1e')](function(_0xe01538){if(_0xe01538&&_0xe01538[_0xdf3c('0x69')]===0x0){return db['UserProfileResource']['create']({'name':_0x354ff4['name'],'resourceId':_0x354ff4['id'],'type':_0xe01538['name'],'sectionId':_0xe01538['id']},{})['then'](function(){return _0x2cb0f5;});}else{return _0x2cb0f5;}})[_0xdf3c('0x28')](function(_0x3f43a0){logger[_0xdf3c('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f43a0);throw _0x3f43a0;});}return _0x2cb0f5;})[_0xdf3c('0x1e')](respondWithResult(_0x4be79a,0xc9))[_0xdf3c('0x28')](handleError(_0x4be79a,null));};exports[_0xdf3c('0x32')]=function(_0x51e8c6,_0x591936,_0x233718){var _0x4e3517;return db[_0xdf3c('0x4a')]['find']({'where':{'id':_0x51e8c6[_0xdf3c('0x6a')]['id']}})[_0xdf3c('0x1e')](handleEntityNotFound(_0x591936,null))[_0xdf3c('0x1e')](saveUpdates(_0x51e8c6[_0xdf3c('0x55')],null))['then'](function(_0x5148f6){if(_0x5148f6){_0x4e3517=_0x5148f6;return db[_0xdf3c('0x4a')][_0xdf3c('0x4d')]({'raw':!![]});}})[_0xdf3c('0x1e')](function(_0x12a7b0){if(_0x12a7b0){var _0x39d9f0=fs[_0xdf3c('0x5c')](path['join'](config[_0xdf3c('0x5e')],'server/files/templates/trunk.ejs'),_0xdf3c('0x61'));var _0x9c761a=fs[_0xdf3c('0x5c')](path[_0xdf3c('0x5d')](config[_0xdf3c('0x5e')],'server/files/templates/registry.ejs'),_0xdf3c('0x61'));var _0x5c27cc=ejs[_0xdf3c('0x64')](_0x39d9f0,{'trunks':_0x12a7b0||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x5c27cc);var _0x53b0c3=ejs['render'](_0x9c761a,{'trunks':_0x12a7b0||[]});fs[_0xdf3c('0x62')](_0xdf3c('0x65'),_0x53b0c3);return respondWithRpcPromise(_0xdf3c('0x66'),_0xdf3c('0x32'),{'module':_0xdf3c('0x67')});}return null;})[_0xdf3c('0x1e')](function(_0x5c8e5e){if(_0x5c8e5e){return _0x4e3517;}})[_0xdf3c('0x1e')](respondWithResult(_0x591936,null))['catch'](handleError(_0x591936,null));};exports[_0xdf3c('0x35')]=function(_0x389708,_0x2e5f82,_0x15a057){var _0x320452;return db[_0xdf3c('0x4a')][_0xdf3c('0x4f')]({'where':{'id':_0x389708[_0xdf3c('0x6a')]['id']}})[_0xdf3c('0x1e')](handleEntityNotFound(_0x2e5f82,null))[_0xdf3c('0x1e')](removeEntity(_0x2e5f82,null))[_0xdf3c('0x1e')](function(){return db[_0xdf3c('0x4a')][_0xdf3c('0x4d')]({'raw':!![]});})[_0xdf3c('0x1e')](function(_0x55fd73){var _0x118ab5=fs[_0xdf3c('0x5c')](path[_0xdf3c('0x5d')](config[_0xdf3c('0x5e')],'server/files/templates/trunk.ejs'),_0xdf3c('0x61'));var _0x1c8fe4=fs['readFileSync'](path['join'](config[_0xdf3c('0x5e')],_0xdf3c('0x60')),_0xdf3c('0x61'));var _0x1aaf8b=ejs[_0xdf3c('0x64')](_0x118ab5,{'trunks':_0x55fd73});var _0x56fc77=ejs[_0xdf3c('0x64')](_0x1c8fe4,{'trunks':_0x55fd73});fs[_0xdf3c('0x62')](_0xdf3c('0x63'),_0x1aaf8b);fs[_0xdf3c('0x62')](_0xdf3c('0x65'),_0x56fc77);return respondWithRpcPromise(_0xdf3c('0x66'),'destroy',{'module':_0xdf3c('0x67')});})[_0xdf3c('0x28')](handleError(_0x2e5f82,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index daf4b30..bbb66e5 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 _0xe8e4=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk'];(function(_0x38db3a,_0x244702){var _0x2ead95=function(_0x558eab){while(--_0x558eab){_0x38db3a['push'](_0x38db3a['shift']());}};_0x2ead95(++_0x244702);}(_0xe8e4,0x1e1));var _0x4e8e=function(_0x5c73ca,_0x39cd89){_0x5c73ca=_0x5c73ca-0x0;var _0x38d017=_0xe8e4[_0x5c73ca];return _0x38d017;};'use strict';var _=require(_0x4e8e('0x0'));var util=require(_0x4e8e('0x1'));var logger=require(_0x4e8e('0x2'))('api');var moment=require(_0x4e8e('0x3'));var BPromise=require(_0x4e8e('0x4'));var rp=require(_0x4e8e('0x5'));var fs=require('fs');var path=require(_0x4e8e('0x6'));var rimraf=require(_0x4e8e('0x7'));var config=require(_0x4e8e('0x8'));var attributes=require(_0x4e8e('0x9'));module[_0x4e8e('0xa')]=function(_0x42a789,_0x33138f){return _0x42a789[_0x4e8e('0xb')](_0x4e8e('0xc'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d09=['tools_trunks','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','define','Trunk'];(function(_0x432467,_0x41c621){var _0x340ee1=function(_0x4582d1){while(--_0x4582d1){_0x432467['push'](_0x432467['shift']());}};_0x340ee1(++_0x41c621);}(_0x9d09,0x69));var _0x99d0=function(_0x54febf,_0x271ed3){_0x54febf=_0x54febf-0x0;var _0x135916=_0x9d09[_0x54febf];return _0x135916;};'use strict';var _=require(_0x99d0('0x0'));var util=require(_0x99d0('0x1'));var logger=require('../../config/logger')(_0x99d0('0x2'));var moment=require(_0x99d0('0x3'));var BPromise=require(_0x99d0('0x4'));var rp=require(_0x99d0('0x5'));var fs=require('fs');var path=require(_0x99d0('0x6'));var rimraf=require(_0x99d0('0x7'));var config=require(_0x99d0('0x8'));var attributes=require(_0x99d0('0x9'));module['exports']=function(_0x26a882,_0x508ee7){return _0x26a882[_0x99d0('0xa')](_0x99d0('0xb'),attributes,{'tableName':_0x99d0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 77c3de0..c795586 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 _0xde68=['Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','message','catch','GetTrunk','Trunk','options','raw','where','attributes','limit','include','model','map','stringify','ShowTrunk','find','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info'];(function(_0x193e28,_0x3dac1d){var _0x20ef59=function(_0x48047e){while(--_0x48047e){_0x193e28['push'](_0x193e28['shift']());}};_0x20ef59(++_0x3dac1d);}(_0xde68,0x94));var _0x8de6=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xde68[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0x8de6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8de6('0x1'));var fs=require('fs');var Redis=require(_0x8de6('0x2'));var db=require(_0x8de6('0x3'))['db'];var utils=require(_0x8de6('0x4'));var logger=require('../../config/logger')(_0x8de6('0x5'));var config=require('../../config/environment');var jayson=require(_0x8de6('0x6'));var client=jayson[_0x8de6('0x7')][_0x8de6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x11ef32,_0x4f5186,_0x26c356){return new BPromise(function(_0x333612,_0x56c3dc){return client[_0x8de6('0x9')](_0x11ef32,_0x26c356)[_0x8de6('0xa')](function(_0x182717){logger[_0x8de6('0xb')](_0x8de6('0xc'),_0x4f5186,_0x8de6('0xd'));logger[_0x8de6('0xe')](_0x8de6('0xf'),_0x4f5186,_0x8de6('0xd'),JSON['stringify'](_0x182717));if(_0x182717['error']){if(_0x182717['error']['code']===0x1f4){logger[_0x8de6('0x10')]('Trunk,\x20%s,\x20%s',_0x4f5186,_0x182717[_0x8de6('0x10')]['message']);return _0x56c3dc(_0x182717[_0x8de6('0x10')][_0x8de6('0x11')]);}logger[_0x8de6('0x10')]('Trunk,\x20%s,\x20%s',_0x4f5186,_0x182717[_0x8de6('0x10')][_0x8de6('0x11')]);return _0x333612(_0x182717[_0x8de6('0x10')][_0x8de6('0x11')]);}else{logger['info'](_0x8de6('0xc'),_0x4f5186,'request\x20sent');_0x333612(_0x182717['result'][_0x8de6('0x11')]);}})[_0x8de6('0x12')](function(_0x211f08){logger[_0x8de6('0x10')](_0x8de6('0xc'),_0x4f5186,_0x211f08);_0x56c3dc(_0x211f08);});});}exports[_0x8de6('0x13')]=function(_0x1e0774){var _0x201517=this;return new Promise(function(_0x5929bb,_0x388f74){return db[_0x8de6('0x14')]['findAll']({'raw':_0x1e0774['options']?_0x1e0774[_0x8de6('0x15')][_0x8de6('0x16')]===undefined?!![]:![]:!![],'where':_0x1e0774[_0x8de6('0x15')]?_0x1e0774[_0x8de6('0x15')][_0x8de6('0x17')]||null:null,'attributes':_0x1e0774[_0x8de6('0x15')]?_0x1e0774[_0x8de6('0x15')][_0x8de6('0x18')]||null:null,'limit':_0x1e0774[_0x8de6('0x15')]?_0x1e0774['options'][_0x8de6('0x19')]||null:null,'include':_0x1e0774[_0x8de6('0x15')]?_0x1e0774[_0x8de6('0x15')][_0x8de6('0x1a')]?_['map'](_0x1e0774[_0x8de6('0x15')][_0x8de6('0x1a')],function(_0x123c4f){return{'model':db[_0x123c4f[_0x8de6('0x1b')]],'as':_0x123c4f['as'],'attributes':_0x123c4f[_0x8de6('0x18')],'include':_0x123c4f[_0x8de6('0x1a')]?_[_0x8de6('0x1c')](_0x123c4f[_0x8de6('0x1a')],function(_0x3a0387){return{'model':db[_0x3a0387[_0x8de6('0x1b')]],'as':_0x3a0387['as'],'attributes':_0x3a0387[_0x8de6('0x18')],'include':_0x3a0387[_0x8de6('0x1a')]?_[_0x8de6('0x1c')](_0x3a0387['include'],function(_0x381c0c){return{'model':db[_0x381c0c[_0x8de6('0x1b')]],'as':_0x381c0c['as'],'attributes':_0x381c0c[_0x8de6('0x18')]};}):[]};}):[]};}):[]:[]})[_0x8de6('0xa')](function(_0x428711){logger['info'](_0x8de6('0x13'),_0x1e0774);logger[_0x8de6('0xe')](_0x8de6('0x13'),_0x1e0774,JSON[_0x8de6('0x1d')](_0x428711));_0x5929bb(_0x428711);})['catch'](function(_0x277218){logger[_0x8de6('0x10')]('GetTrunk',_0x277218[_0x8de6('0x11')],_0x1e0774);_0x388f74(_0x201517[_0x8de6('0x10')](0x1f4,_0x277218['message']));});});};exports[_0x8de6('0x1e')]=function(_0x167b7c){var _0xba9801=this;return new Promise(function(_0x550729,_0x32c4ac){return db[_0x8de6('0x14')][_0x8de6('0x1f')]({'raw':_0x167b7c['options']?_0x167b7c['options'][_0x8de6('0x16')]===undefined?!![]:![]:!![],'where':_0x167b7c[_0x8de6('0x15')]?_0x167b7c[_0x8de6('0x15')][_0x8de6('0x17')]||null:null,'attributes':_0x167b7c['options']?_0x167b7c[_0x8de6('0x15')]['attributes']||null:null,'include':_0x167b7c[_0x8de6('0x15')]?_0x167b7c[_0x8de6('0x15')]['include']?_[_0x8de6('0x1c')](_0x167b7c[_0x8de6('0x15')]['include'],function(_0x23efc5){return{'model':db[_0x23efc5[_0x8de6('0x1b')]],'as':_0x23efc5['as'],'attributes':_0x23efc5['attributes'],'include':_0x23efc5[_0x8de6('0x1a')]?_['map'](_0x23efc5[_0x8de6('0x1a')],function(_0xbabf99){return{'model':db[_0xbabf99[_0x8de6('0x1b')]],'as':_0xbabf99['as'],'attributes':_0xbabf99['attributes'],'include':_0xbabf99['include']?_[_0x8de6('0x1c')](_0xbabf99[_0x8de6('0x1a')],function(_0x2c7808){return{'model':db[_0x2c7808['model']],'as':_0x2c7808['as'],'attributes':_0x2c7808['attributes']};}):[]};}):[]};}):[]:[]})[_0x8de6('0xa')](function(_0x17de34){logger[_0x8de6('0xb')](_0x8de6('0x1e'),_0x167b7c);logger[_0x8de6('0xe')](_0x8de6('0x1e'),_0x167b7c,JSON[_0x8de6('0x1d')](_0x17de34));_0x550729(_0x17de34);})['catch'](function(_0x5bb0ae){logger[_0x8de6('0x10')](_0x8de6('0x1e'),_0x5bb0ae[_0x8de6('0x11')],_0x167b7c);_0x32c4ac(_0xba9801[_0x8de6('0x10')](0x1f4,_0x5bb0ae[_0x8de6('0x11')]));});});}; \ No newline at end of file +var _0x9a65=['GetTrunk','options','raw','where','attributes','limit','include','map','model','ShowTrunk','find','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch'];(function(_0x161c0c,_0xc28d7){var _0x14d763=function(_0x560e31){while(--_0x560e31){_0x161c0c['push'](_0x161c0c['shift']());}};_0x14d763(++_0xc28d7);}(_0x9a65,0x1cd));var _0x59a6=function(_0x209fcd,_0x1ecccc){_0x209fcd=_0x209fcd-0x0;var _0x501d5e=_0x9a65[_0x209fcd];return _0x501d5e;};'use strict';var _=require('lodash');var util=require(_0x59a6('0x0'));var moment=require(_0x59a6('0x1'));var BPromise=require(_0x59a6('0x2'));var rs=require(_0x59a6('0x3'));var fs=require('fs');var Redis=require(_0x59a6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x59a6('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x59a6('0x6'));var jayson=require(_0x59a6('0x7'));var client=jayson[_0x59a6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f035a,_0x3e152f,_0x431374){return new BPromise(function(_0x5f5150,_0x31a52f){return client['request'](_0x2f035a,_0x431374)[_0x59a6('0x9')](function(_0x435a4f){logger[_0x59a6('0xa')](_0x59a6('0xb'),_0x3e152f,_0x59a6('0xc'));logger[_0x59a6('0xd')]('Trunk,\x20%s,\x20%s,\x20%s',_0x3e152f,_0x59a6('0xc'),JSON[_0x59a6('0xe')](_0x435a4f));if(_0x435a4f[_0x59a6('0xf')]){if(_0x435a4f[_0x59a6('0xf')][_0x59a6('0x10')]===0x1f4){logger[_0x59a6('0xf')]('Trunk,\x20%s,\x20%s',_0x3e152f,_0x435a4f[_0x59a6('0xf')][_0x59a6('0x11')]);return _0x31a52f(_0x435a4f['error']['message']);}logger[_0x59a6('0xf')](_0x59a6('0xb'),_0x3e152f,_0x435a4f[_0x59a6('0xf')][_0x59a6('0x11')]);return _0x5f5150(_0x435a4f[_0x59a6('0xf')][_0x59a6('0x11')]);}else{logger['info'](_0x59a6('0xb'),_0x3e152f,'request\x20sent');_0x5f5150(_0x435a4f['result'][_0x59a6('0x11')]);}})[_0x59a6('0x12')](function(_0x5512cc){logger['error'](_0x59a6('0xb'),_0x3e152f,_0x5512cc);_0x31a52f(_0x5512cc);});});}exports[_0x59a6('0x13')]=function(_0x3c47f9){var _0x2ca39b=this;return new Promise(function(_0x3e0852,_0x234c42){return db['Trunk']['findAll']({'raw':_0x3c47f9['options']?_0x3c47f9[_0x59a6('0x14')][_0x59a6('0x15')]===undefined?!![]:![]:!![],'where':_0x3c47f9[_0x59a6('0x14')]?_0x3c47f9[_0x59a6('0x14')][_0x59a6('0x16')]||null:null,'attributes':_0x3c47f9[_0x59a6('0x14')]?_0x3c47f9['options'][_0x59a6('0x17')]||null:null,'limit':_0x3c47f9[_0x59a6('0x14')]?_0x3c47f9['options'][_0x59a6('0x18')]||null:null,'include':_0x3c47f9['options']?_0x3c47f9[_0x59a6('0x14')][_0x59a6('0x19')]?_[_0x59a6('0x1a')](_0x3c47f9['options'][_0x59a6('0x19')],function(_0x91405c){return{'model':db[_0x91405c[_0x59a6('0x1b')]],'as':_0x91405c['as'],'attributes':_0x91405c[_0x59a6('0x17')],'include':_0x91405c[_0x59a6('0x19')]?_[_0x59a6('0x1a')](_0x91405c[_0x59a6('0x19')],function(_0x3dc193){return{'model':db[_0x3dc193[_0x59a6('0x1b')]],'as':_0x3dc193['as'],'attributes':_0x3dc193[_0x59a6('0x17')],'include':_0x3dc193[_0x59a6('0x19')]?_[_0x59a6('0x1a')](_0x3dc193[_0x59a6('0x19')],function(_0x595418){return{'model':db[_0x595418[_0x59a6('0x1b')]],'as':_0x595418['as'],'attributes':_0x595418[_0x59a6('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57d1b6){logger['info'](_0x59a6('0x13'),_0x3c47f9);logger[_0x59a6('0xd')](_0x59a6('0x13'),_0x3c47f9,JSON[_0x59a6('0xe')](_0x57d1b6));_0x3e0852(_0x57d1b6);})[_0x59a6('0x12')](function(_0x439acb){logger['error']('GetTrunk',_0x439acb[_0x59a6('0x11')],_0x3c47f9);_0x234c42(_0x2ca39b[_0x59a6('0xf')](0x1f4,_0x439acb[_0x59a6('0x11')]));});});};exports[_0x59a6('0x1c')]=function(_0x2d9747){var _0x5b4d30=this;return new Promise(function(_0x38ecc5,_0x1a028e){return db['Trunk'][_0x59a6('0x1d')]({'raw':_0x2d9747[_0x59a6('0x14')]?_0x2d9747[_0x59a6('0x14')][_0x59a6('0x15')]===undefined?!![]:![]:!![],'where':_0x2d9747[_0x59a6('0x14')]?_0x2d9747[_0x59a6('0x14')][_0x59a6('0x16')]||null:null,'attributes':_0x2d9747[_0x59a6('0x14')]?_0x2d9747[_0x59a6('0x14')][_0x59a6('0x17')]||null:null,'include':_0x2d9747['options']?_0x2d9747[_0x59a6('0x14')][_0x59a6('0x19')]?_[_0x59a6('0x1a')](_0x2d9747[_0x59a6('0x14')][_0x59a6('0x19')],function(_0x56f3fc){return{'model':db[_0x56f3fc[_0x59a6('0x1b')]],'as':_0x56f3fc['as'],'attributes':_0x56f3fc['attributes'],'include':_0x56f3fc[_0x59a6('0x19')]?_[_0x59a6('0x1a')](_0x56f3fc['include'],function(_0x79bdca){return{'model':db[_0x79bdca['model']],'as':_0x79bdca['as'],'attributes':_0x79bdca[_0x59a6('0x17')],'include':_0x79bdca[_0x59a6('0x19')]?_[_0x59a6('0x1a')](_0x79bdca[_0x59a6('0x19')],function(_0x59f898){return{'model':db[_0x59f898[_0x59a6('0x1b')]],'as':_0x59f898['as'],'attributes':_0x59f898['attributes']};}):[]};}):[]};}):[]:[]})[_0x59a6('0x9')](function(_0x4d91f6){logger[_0x59a6('0xa')](_0x59a6('0x1c'),_0x2d9747);logger['debug'](_0x59a6('0x1c'),_0x2d9747,JSON[_0x59a6('0xe')](_0x4d91f6));_0x38ecc5(_0x4d91f6);})[_0x59a6('0x12')](function(_0x24d3da){logger[_0x59a6('0xf')](_0x59a6('0x1c'),_0x24d3da['message'],_0x2d9747);_0x1a028e(_0x5b4d30[_0x59a6('0xf')](0x1f4,_0x24d3da['message']));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index d02cdee..8aa59c5 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 _0xe136=['/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','/:id/whatsapp_accounts','addSquareProjects','createApiKey','update','put','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','/presence','/:id','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getChatWebsites','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','/:id/avatar','single','file','addAvatar','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions'];(function(_0x4b2478,_0x585c05){var _0x44a043=function(_0x34faa2){while(--_0x34faa2){_0x4b2478['push'](_0x4b2478['shift']());}};_0x44a043(++_0x585c05);}(_0xe136,0x96));var _0x6e13=function(_0xc1ed4b,_0x5ea4fc){_0xc1ed4b=_0xc1ed4b-0x0;var _0x49a6db=_0xe136[_0xc1ed4b];return _0x49a6db;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6e13('0x0'));var timeout=require(_0x6e13('0x1'));var express=require(_0x6e13('0x2'));var router=express[_0x6e13('0x3')]();var fs_extra=require(_0x6e13('0x4'));var auth=require(_0x6e13('0x5'));var interaction=require(_0x6e13('0x6'));var config=require(_0x6e13('0x7'));var controller=require(_0x6e13('0x8'));router[_0x6e13('0x9')]('/',auth[_0x6e13('0xa')](),controller[_0x6e13('0xb')]);router[_0x6e13('0x9')](_0x6e13('0xc'),auth[_0x6e13('0xa')](),controller[_0x6e13('0xd')]);router[_0x6e13('0x9')](_0x6e13('0xe'),auth['isAuthenticated'](),controller['whoami']);router[_0x6e13('0x9')](_0x6e13('0xf'),auth[_0x6e13('0xa')](),controller['getPresence']);router[_0x6e13('0x9')](_0x6e13('0x10'),auth['isAuthenticated'](),controller['show']);router[_0x6e13('0x9')]('/:id/avatar',controller['getAvatar']);router[_0x6e13('0x9')](_0x6e13('0x11'),auth[_0x6e13('0xa')](),controller['getOpenTabs']);router['get'](_0x6e13('0x12'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x13')]);router['get'](_0x6e13('0x14'),auth[_0x6e13('0xa')](),controller['getQueues']);router[_0x6e13('0x9')](_0x6e13('0x15'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x16')]);router['get'](_0x6e13('0x17'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x18')]);router[_0x6e13('0x9')](_0x6e13('0x19'),auth['isAuthenticated'](),controller[_0x6e13('0x1a')]);router[_0x6e13('0x9')](_0x6e13('0x1b'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x1c')]);router[_0x6e13('0x9')](_0x6e13('0x1d'),auth['isAuthenticated'](),controller['getChatInteractions']);router[_0x6e13('0x9')](_0x6e13('0x1e'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x1f')]);router[_0x6e13('0x9')](_0x6e13('0x20'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x21')]);router[_0x6e13('0x9')](_0x6e13('0x22'),auth['isAuthenticated'](),controller[_0x6e13('0x23')]);router['get'](_0x6e13('0x24'),auth[_0x6e13('0xa')](),controller['getFaxInteractions']);router[_0x6e13('0x9')](_0x6e13('0x25'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x26')]);router['get'](_0x6e13('0x27'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x28')]);router['get'](_0x6e13('0x29'),auth['isAuthenticated'](),controller[_0x6e13('0x2a')]);router[_0x6e13('0x9')](_0x6e13('0x2b'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x2c')]);router[_0x6e13('0x9')]('/:id/prefixes',auth[_0x6e13('0xa')](),controller[_0x6e13('0x2d')]);router['get'](_0x6e13('0x2e'),auth[_0x6e13('0xa')](),controller['getFaxAccounts']);router[_0x6e13('0x9')](_0x6e13('0x2f'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x30')]);router[_0x6e13('0x9')](_0x6e13('0x31'),auth['isAuthenticated'](),controller[_0x6e13('0x32')]);router['get'](_0x6e13('0x33'),auth[_0x6e13('0xa')](),controller['getSmsAccounts']);router['get']('/:id/chat_websites',auth[_0x6e13('0xa')](),controller[_0x6e13('0x34')]);router[_0x6e13('0x9')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x6e13('0x35')]);router[_0x6e13('0x9')](_0x6e13('0x36'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x37')]);router[_0x6e13('0x9')](_0x6e13('0x38'),auth['isAuthenticated'](),controller[_0x6e13('0x39')]);router[_0x6e13('0x9')](_0x6e13('0x3a'),auth['isAuthenticated'](),controller[_0x6e13('0x3b')]);router[_0x6e13('0x3c')](_0x6e13('0x12'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x3d')]);router[_0x6e13('0x3c')]('/',auth[_0x6e13('0xa')](),controller[_0x6e13('0x3e')]);router[_0x6e13('0x3c')]('/create_many',auth['isAuthenticated'](),controller[_0x6e13('0x3f')]);router[_0x6e13('0x3c')](_0x6e13('0x14'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x40')]);var upload=multer({'storage':multer[_0x6e13('0x41')]({'destination':function(_0x25248c,_0x472cc8,_0xbf86c6){_0xbf86c6(null,path[_0x6e13('0x42')](config[_0x6e13('0x43')],_0x6e13('0x44')));},'filename':function(_0x764538,_0x1d9779,_0x180fc9){_0x180fc9(null,util[_0x6e13('0x45')](_0x6e13('0x46'),Date[_0x6e13('0x47')](),_0x1d9779[_0x6e13('0x48')]));}})});router['post'](_0x6e13('0x49'),upload[_0x6e13('0x4a')](_0x6e13('0x4b')),controller[_0x6e13('0x4c')]);router[_0x6e13('0x3c')]('/:id/login',auth['isAuthenticated'](),controller[_0x6e13('0x4d')]);router['post'](_0x6e13('0x4e'),auth['isAuthenticated'](),controller[_0x6e13('0x4f')]);router[_0x6e13('0x3c')](_0x6e13('0x50'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x51')]);router['post'](_0x6e13('0x52'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x53')]);router[_0x6e13('0x3c')]('/:id/teams',auth[_0x6e13('0xa')](),controller[_0x6e13('0x54')]);router[_0x6e13('0x3c')](_0x6e13('0x55'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x56')]);router[_0x6e13('0x3c')](_0x6e13('0x57'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x58')]);router[_0x6e13('0x3c')](_0x6e13('0x59'),auth['isAuthenticated'](),controller['addFaxInteractions']);router['post'](_0x6e13('0x5a'),auth[_0x6e13('0xa')](),controller['addSmsInteractions']);router[_0x6e13('0x3c')](_0x6e13('0x5b'),auth['isAuthenticated'](),controller[_0x6e13('0x5c')]);router[_0x6e13('0x3c')](_0x6e13('0x5d'),auth[_0x6e13('0xa')](),controller['addWhatsappInteractions']);router[_0x6e13('0x3c')]('/:id/fax_accounts',auth[_0x6e13('0xa')](),controller[_0x6e13('0x5e')]);router[_0x6e13('0x3c')](_0x6e13('0x2f'),auth[_0x6e13('0xa')](),controller['addMailAccounts']);router[_0x6e13('0x3c')](_0x6e13('0x31'),auth[_0x6e13('0xa')](),controller['addOpenchannelAccounts']);router['post'](_0x6e13('0x33'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x5f')]);router[_0x6e13('0x3c')](_0x6e13('0x60'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x61')]);router[_0x6e13('0x3c')](_0x6e13('0x62'),auth[_0x6e13('0xa')](),controller['addWhatsappAccounts']);router[_0x6e13('0x3c')](_0x6e13('0x36'),auth['isAuthenticated'](),controller[_0x6e13('0x63')]);router[_0x6e13('0x3c')](_0x6e13('0x3a'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x64')]);router['put'](_0x6e13('0x10'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x65')]);router[_0x6e13('0x66')](_0x6e13('0x67'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x68')]);router[_0x6e13('0x69')]('/:id/queues',auth[_0x6e13('0xa')](),controller[_0x6e13('0x6a')]);router['delete']('/:id/teams',auth[_0x6e13('0xa')](),controller[_0x6e13('0x6b')]);router[_0x6e13('0x69')](_0x6e13('0x10'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x6c')]);router[_0x6e13('0x69')]('/:id/chat_interactions',auth[_0x6e13('0xa')](),controller[_0x6e13('0x6d')]);router[_0x6e13('0x69')](_0x6e13('0x57'),auth[_0x6e13('0xa')](),controller['removeMailInteractions']);router['delete'](_0x6e13('0x59'),auth[_0x6e13('0xa')](),controller['removeFaxInteractions']);router[_0x6e13('0x69')](_0x6e13('0x5a'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x6e')]);router[_0x6e13('0x69')](_0x6e13('0x5b'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x6f')]);router[_0x6e13('0x69')]('/:id/whatsapp_interactions',auth[_0x6e13('0xa')](),controller[_0x6e13('0x70')]);router[_0x6e13('0x69')]('/:id/fax_accounts',auth[_0x6e13('0xa')](),controller[_0x6e13('0x71')]);router['delete']('/:id/mail_accounts',auth[_0x6e13('0xa')](),controller['removeMailAccounts']);router['delete'](_0x6e13('0x31'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x72')]);router[_0x6e13('0x69')](_0x6e13('0x33'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x73')]);router[_0x6e13('0x69')](_0x6e13('0x60'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x74')]);router['delete'](_0x6e13('0x62'),auth['isAuthenticated'](),controller[_0x6e13('0x75')]);router[_0x6e13('0x69')](_0x6e13('0x36'),auth[_0x6e13('0xa')](),controller[_0x6e13('0x76')]);router[_0x6e13('0x69')](_0x6e13('0x3a'),auth['isAuthenticated'](),controller[_0x6e13('0x77')]);module['exports']=router; \ No newline at end of file +var _0xdac0=['/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','create','/create_many','bulkCreate','/:id/queues','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','single','file','login','logout','pause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','/:id/square_projects','addSquareProjects','put','update','changePassword','delete','removeQueues','removeTeams','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/whoami','whoami','getPresence','/:id','show','getOpenTabs','getQueues','getVoiceQueuesRt','/:id/recordings','getRecordings','getScreenRecordings','getChatInteractions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts'];(function(_0x425dc4,_0x175d99){var _0x1c9bf1=function(_0x54f02e){while(--_0x54f02e){_0x425dc4['push'](_0x425dc4['shift']());}};_0x1c9bf1(++_0x175d99);}(_0xdac0,0x17e));var _0x0dac=function(_0x42613f,_0x5a2454){_0x42613f=_0x42613f-0x0;var _0x650f3f=_0xdac0[_0x42613f];return _0x650f3f;};'use strict';var multer=require(_0x0dac('0x0'));var util=require(_0x0dac('0x1'));var path=require(_0x0dac('0x2'));var timeout=require(_0x0dac('0x3'));var express=require('express');var router=express[_0x0dac('0x4')]();var fs_extra=require(_0x0dac('0x5'));var auth=require(_0x0dac('0x6'));var interaction=require(_0x0dac('0x7'));var config=require('../../config/environment');var controller=require('./user.controller');router[_0x0dac('0x8')]('/',auth[_0x0dac('0x9')](),controller[_0x0dac('0xa')]);router[_0x0dac('0x8')](_0x0dac('0xb'),auth['isAuthenticated'](),controller[_0x0dac('0xc')]);router[_0x0dac('0x8')](_0x0dac('0xd'),auth[_0x0dac('0x9')](),controller[_0x0dac('0xe')]);router[_0x0dac('0x8')]('/presence',auth[_0x0dac('0x9')](),controller[_0x0dac('0xf')]);router[_0x0dac('0x8')](_0x0dac('0x10'),auth[_0x0dac('0x9')](),controller[_0x0dac('0x11')]);router[_0x0dac('0x8')]('/:id/avatar',controller['getAvatar']);router[_0x0dac('0x8')]('/:id/open_tabs',auth['isAuthenticated'](),controller[_0x0dac('0x12')]);router['get']('/:id/contacts',auth[_0x0dac('0x9')](),controller['getContacts']);router['get']('/:id/queues',auth['isAuthenticated'](),controller[_0x0dac('0x13')]);router[_0x0dac('0x8')]('/:id/queues_rt',auth[_0x0dac('0x9')](),controller[_0x0dac('0x14')]);router[_0x0dac('0x8')]('/:id/groups',auth[_0x0dac('0x9')](),controller['getGroups']);router[_0x0dac('0x8')](_0x0dac('0x15'),auth[_0x0dac('0x9')](),controller[_0x0dac('0x16')]);router[_0x0dac('0x8')]('/:id/screen_recordings',auth['isAuthenticated'](),controller[_0x0dac('0x17')]);router[_0x0dac('0x8')]('/:id/chat/interactions',auth['isAuthenticated'](),controller[_0x0dac('0x18')]);router[_0x0dac('0x8')]('/:id/openchannel/interactions',auth[_0x0dac('0x9')](),controller[_0x0dac('0x19')]);router['get']('/:id/mail/interactions',auth[_0x0dac('0x9')](),controller[_0x0dac('0x1a')]);router['get'](_0x0dac('0x1b'),auth[_0x0dac('0x9')](),controller[_0x0dac('0x1c')]);router[_0x0dac('0x8')](_0x0dac('0x1d'),auth[_0x0dac('0x9')](),controller[_0x0dac('0x1e')]);router[_0x0dac('0x8')](_0x0dac('0x1f'),auth[_0x0dac('0x9')](),controller[_0x0dac('0x20')]);router[_0x0dac('0x8')](_0x0dac('0x21'),auth[_0x0dac('0x9')](),controller[_0x0dac('0x22')]);router[_0x0dac('0x8')]('/:id/lists',auth[_0x0dac('0x9')](),controller['getLists']);router[_0x0dac('0x8')](_0x0dac('0x23'),auth[_0x0dac('0x9')](),controller[_0x0dac('0x24')]);router[_0x0dac('0x8')](_0x0dac('0x25'),auth['isAuthenticated'](),controller[_0x0dac('0x26')]);router[_0x0dac('0x8')](_0x0dac('0x27'),auth[_0x0dac('0x9')](),controller['getFaxAccounts']);router[_0x0dac('0x8')](_0x0dac('0x28'),auth[_0x0dac('0x9')](),controller[_0x0dac('0x29')]);router[_0x0dac('0x8')](_0x0dac('0x2a'),auth[_0x0dac('0x9')](),controller[_0x0dac('0x2b')]);router['get'](_0x0dac('0x2c'),auth[_0x0dac('0x9')](),controller[_0x0dac('0x2d')]);router[_0x0dac('0x8')](_0x0dac('0x2e'),auth[_0x0dac('0x9')](),controller[_0x0dac('0x2f')]);router[_0x0dac('0x8')]('/:id/whatsapp_accounts',auth[_0x0dac('0x9')](),controller['getWhatsappAccounts']);router[_0x0dac('0x8')]('/:id/square_projects',auth[_0x0dac('0x9')](),controller['getSquareProjects']);router[_0x0dac('0x8')](_0x0dac('0x30'),auth[_0x0dac('0x9')](),controller[_0x0dac('0x31')]);router[_0x0dac('0x8')](_0x0dac('0x32'),auth[_0x0dac('0x9')](),controller[_0x0dac('0x33')]);router[_0x0dac('0x34')]('/:id/contacts',auth[_0x0dac('0x9')](),controller['addContacts']);router[_0x0dac('0x34')]('/',auth[_0x0dac('0x9')](),controller[_0x0dac('0x35')]);router[_0x0dac('0x34')](_0x0dac('0x36'),auth[_0x0dac('0x9')](),controller[_0x0dac('0x37')]);router[_0x0dac('0x34')](_0x0dac('0x38'),auth[_0x0dac('0x9')](),controller[_0x0dac('0x39')]);var upload=multer({'storage':multer[_0x0dac('0x3a')]({'destination':function(_0x25d802,_0x2347ca,_0x2c8249){_0x2c8249(null,path[_0x0dac('0x3b')](config[_0x0dac('0x3c')],_0x0dac('0x3d')));},'filename':function(_0x2d0cf6,_0x33b03c,_0x1caa70){_0x1caa70(null,util[_0x0dac('0x3e')](_0x0dac('0x3f'),Date[_0x0dac('0x40')](),_0x33b03c['originalname']));}})});router[_0x0dac('0x34')]('/:id/avatar',upload[_0x0dac('0x41')](_0x0dac('0x42')),controller['addAvatar']);router[_0x0dac('0x34')]('/:id/login',auth[_0x0dac('0x9')](),controller[_0x0dac('0x43')]);router[_0x0dac('0x34')]('/:id/logout',auth[_0x0dac('0x9')](),controller[_0x0dac('0x44')]);router[_0x0dac('0x34')]('/:id/pause',auth[_0x0dac('0x9')](),controller[_0x0dac('0x45')]);router['post']('/:id/unpause',auth[_0x0dac('0x9')](),controller['unpause']);router[_0x0dac('0x34')](_0x0dac('0x21'),auth[_0x0dac('0x9')](),controller['addTeams']);router['post'](_0x0dac('0x46'),auth[_0x0dac('0x9')](),controller[_0x0dac('0x47')]);router['post'](_0x0dac('0x48'),auth[_0x0dac('0x9')](),controller['addMailInteractions']);router[_0x0dac('0x34')]('/:id/fax_interactions',auth[_0x0dac('0x9')](),controller[_0x0dac('0x49')]);router[_0x0dac('0x34')](_0x0dac('0x4a'),auth['isAuthenticated'](),controller[_0x0dac('0x4b')]);router[_0x0dac('0x34')](_0x0dac('0x4c'),auth[_0x0dac('0x9')](),controller[_0x0dac('0x4d')]);router[_0x0dac('0x34')]('/:id/whatsapp_interactions',auth[_0x0dac('0x9')](),controller[_0x0dac('0x4e')]);router[_0x0dac('0x34')]('/:id/fax_accounts',auth[_0x0dac('0x9')](),controller['addFaxAccounts']);router[_0x0dac('0x34')](_0x0dac('0x28'),auth['isAuthenticated'](),controller[_0x0dac('0x4f')]);router[_0x0dac('0x34')](_0x0dac('0x2a'),auth[_0x0dac('0x9')](),controller[_0x0dac('0x50')]);router[_0x0dac('0x34')]('/:id/sms_accounts',auth[_0x0dac('0x9')](),controller[_0x0dac('0x51')]);router[_0x0dac('0x34')](_0x0dac('0x2e'),auth[_0x0dac('0x9')](),controller[_0x0dac('0x52')]);router[_0x0dac('0x34')](_0x0dac('0x53'),auth[_0x0dac('0x9')](),controller[_0x0dac('0x54')]);router[_0x0dac('0x34')](_0x0dac('0x55'),auth[_0x0dac('0x9')](),controller[_0x0dac('0x56')]);router['post'](_0x0dac('0x32'),auth[_0x0dac('0x9')](),controller['createApiKey']);router[_0x0dac('0x57')](_0x0dac('0x10'),auth['isAuthenticated'](),controller[_0x0dac('0x58')]);router['put']('/:id/password',auth[_0x0dac('0x9')](),controller[_0x0dac('0x59')]);router[_0x0dac('0x5a')](_0x0dac('0x38'),auth[_0x0dac('0x9')](),controller[_0x0dac('0x5b')]);router[_0x0dac('0x5a')](_0x0dac('0x21'),auth['isAuthenticated'](),controller[_0x0dac('0x5c')]);router[_0x0dac('0x5a')](_0x0dac('0x10'),auth[_0x0dac('0x9')](),controller['destroy']);router[_0x0dac('0x5a')](_0x0dac('0x46'),auth['isAuthenticated'](),controller[_0x0dac('0x5d')]);router[_0x0dac('0x5a')](_0x0dac('0x48'),auth[_0x0dac('0x9')](),controller['removeMailInteractions']);router[_0x0dac('0x5a')]('/:id/fax_interactions',auth[_0x0dac('0x9')](),controller[_0x0dac('0x5e')]);router[_0x0dac('0x5a')](_0x0dac('0x4a'),auth[_0x0dac('0x9')](),controller[_0x0dac('0x5f')]);router['delete'](_0x0dac('0x4c'),auth[_0x0dac('0x9')](),controller['removeOpenchannelInteractions']);router['delete'](_0x0dac('0x60'),auth[_0x0dac('0x9')](),controller[_0x0dac('0x61')]);router[_0x0dac('0x5a')](_0x0dac('0x27'),auth['isAuthenticated'](),controller[_0x0dac('0x62')]);router[_0x0dac('0x5a')](_0x0dac('0x28'),auth[_0x0dac('0x9')](),controller[_0x0dac('0x63')]);router[_0x0dac('0x5a')](_0x0dac('0x2a'),auth['isAuthenticated'](),controller[_0x0dac('0x64')]);router[_0x0dac('0x5a')]('/:id/sms_accounts',auth[_0x0dac('0x9')](),controller[_0x0dac('0x65')]);router['delete'](_0x0dac('0x2e'),auth[_0x0dac('0x9')](),controller[_0x0dac('0x66')]);router[_0x0dac('0x5a')](_0x0dac('0x53'),auth[_0x0dac('0x9')](),controller[_0x0dac('0x67')]);router[_0x0dac('0x5a')](_0x0dac('0x55'),auth['isAuthenticated'](),controller['removeSquareProjects']);router[_0x0dac('0x5a')](_0x0dac('0x32'),auth[_0x0dac('0x9')](),controller[_0x0dac('0x68')]);module[_0x0dac('0x69')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 7c455c4..d7cf76c 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 _0x0245=['force_rport,comedia','nat','join','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\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','uac','uas','fingerprint','certificate','active','actpass','TEXT','showWebBar','get','isArray','encryption','avpf','force_avp','icesupport','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','wss','dtlsenable','dtlscertfile','/etc/pki/tls/certs/motion.crt','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','STRING','setDataValue','name','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','internal','email','toLowerCase','ENUM','agent','telephone','\x22%s\x22\x20<%s>','getDataValue','BOOLEAN','DATE','INTEGER','dynamic','friend','user','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','shortinfo','inband','auto','rfc2833','yes','nonat','update','outgoing'];(function(_0xeb4208,_0x26c08c){var _0x317fc8=function(_0x36e15e){while(--_0x36e15e){_0xeb4208['push'](_0xeb4208['shift']());}};_0x317fc8(++_0x26c08c);}(_0x0245,0x14a));var _0x5024=function(_0x38f705,_0x7ad8e){_0x38f705=_0x38f705-0x0;var _0x4d512b=_0x0245[_0x38f705];return _0x4d512b;};'use strict';var Sequelize=require(_0x5024('0x0'));var moment=require(_0x5024('0x1'));var util=require(_0x5024('0x2'));var _=require(_0x5024('0x3'));module[_0x5024('0x4')]={'name':{'type':Sequelize[_0x5024('0x5')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2a51d0){this[_0x5024('0x6')](_0x5024('0x7'),_0x2a51d0);this[_0x5024('0x6')](_0x5024('0x8'),_0x2a51d0);},'comment':_0x5024('0x9')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x39c896){this[_0x5024('0x6')](_0x5024('0xa'),_0x39c896);this[_0x5024('0x6')](_0x5024('0xb'),util[_0x5024('0xc')]('\x22%s\x22\x20<%s>',_0x39c896,this['getDataValue'](_0x5024('0xd'))));}},'alias':{'type':Sequelize[_0x5024('0x5')]},'email':{'type':Sequelize[_0x5024('0x5')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x3dd588){if(_0x3dd588){this[_0x5024('0x6')](_0x5024('0xe'),_0x3dd588[_0x5024('0xf')]());}}},'role':{'type':Sequelize[_0x5024('0x10')]('admin','user',_0x5024('0x11'),_0x5024('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x5024('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x5024('0x5')],'defaultValue':'local'},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x5024('0xd'),'set':function(_0x3179aa){this[_0x5024('0x6')]('internal',_0x3179aa);this[_0x5024('0x6')]('accountcode',_0x3179aa);this[_0x5024('0x6')](_0x5024('0xb'),util['format'](_0x5024('0x13'),this[_0x5024('0x14')]('fullname'),_0x3179aa));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x5024('0x5')]},'mobile':{'type':Sequelize[_0x5024('0x5')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x5024('0x5')]},'userpic':{'type':Sequelize[_0x5024('0x5')]},'city':{'type':Sequelize[_0x5024('0x5')]},'country':{'type':Sequelize[_0x5024('0x5')]},'online':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x5024('0x16')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x5024('0x5')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x5024('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x5024('0x17')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x5024('0x17')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x5024('0x17')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x5024('0x17')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x5024('0x17')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x5024('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x5024('0x17')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x5024('0x17')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x5024('0x17')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![],'defaultValue':_0x5024('0x18')},'ipaddr':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0x5024('0x17')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x5024('0x17')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x5024('0x17')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x5024('0x19'),_0x5024('0x1a'),_0x5024('0x1b')),'allowNull':!![],'defaultValue':_0x5024('0x19')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x1c'),_0x5024('0x1d'),_0x5024('0x1e'),_0x5024('0x1f'),_0x5024('0x20'),_0x5024('0x21'),_0x5024('0x22'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![],'defaultValue':_0x5024('0x23'),'set':function(_0x109fc8){this['setDataValue']('transport',_0x109fc8?_0x109fc8['join'](','):null);},'get':function(){return this[_0x5024('0x14')](_0x5024('0x24'))?this[_0x5024('0x14')]('transport')['split'](','):null;},'comment':_0x5024('0x25')},'dtmfmode':{'type':Sequelize[_0x5024('0x10')]('rfc2833','info',_0x5024('0x26'),_0x5024('0x27'),_0x5024('0x28')),'allowNull':!![],'defaultValue':_0x5024('0x29')},'directmedia':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x2a'),'no',_0x5024('0x2b'),_0x5024('0x2c'),_0x5024('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![],'defaultValue':_0x5024('0x2e'),'set':function(_0x66bfe4){this['setDataValue'](_0x5024('0x2f'),_0x66bfe4?_0x66bfe4[_0x5024('0x30')](','):null);},'get':function(){return this[_0x5024('0x14')](_0x5024('0x2f'))?this[_0x5024('0x14')](_0x5024('0x2f'))[_0x5024('0x31')](','):null;},'comment':_0x5024('0x32')},'callgroup':{'type':Sequelize[_0x5024('0x5')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x5024('0x5')]},'namedpickupgroup':{'type':Sequelize[_0x5024('0x5')]},'language':{'type':Sequelize[_0x5024('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x5024('0x5')],'allowNull':![],'defaultValue':_0x5024('0x33')},'allow':{'type':Sequelize[_0x5024('0x5')],'allowNull':![],'defaultValue':_0x5024('0x34'),'set':function(_0x4f377e){this[_0x5024('0x6')](_0x5024('0x35'),_0x4f377e?_0x4f377e['join'](';'):_0x5024('0x34'));},'get':function(){return this[_0x5024('0x14')](_0x5024('0x35'))?this[_0x5024('0x14')]('allow')['split'](';'):null;},'comment':_0x5024('0x36')},'autoframing':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![],'set':function(_0x423d17){this['setDataValue'](_0x5024('0x37'),_0x423d17?_0x423d17[_0x5024('0x30')](','):null);},'get':function(){return this[_0x5024('0x14')](_0x5024('0x37'))?this[_0x5024('0x14')](_0x5024('0x37'))[_0x5024('0x31')](','):null;},'comment':_0x5024('0x38')},'trustrpid':{'type':Sequelize[_0x5024('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x5024('0x10')]('yes','no',_0x5024('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x5024('0x17')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![],'defaultValue':_0x5024('0x3a')},'amaflags':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x5024('0x2a')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x5024('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x5024('0x10')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x5024('0x10')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x5024('0x10')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x2a'),'no',_0x5024('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x5024('0x17')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x3c'),_0x5024('0x3d'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x5024('0x17')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x3e'),_0x5024('0x3f')),'allowNull':!![],'defaultValue':_0x5024('0x3f')},'t38pt_usertpsource':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x5024('0x2a')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x5024('0x17')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x5024('0x17')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x5024('0x17')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x5024('0x17')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x5024('0x17')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x2a'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x5024('0x2a'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x2a'),'no',_0x5024('0x40'),_0x5024('0x41')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x5024('0x42'),'passive',_0x5024('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x5024('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x5024('0x17')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x5024('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x5024('0x2a'),'no',_0x5024('0x2b'),_0x5024('0x2c'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x5024('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0x5024('0x16')]},'passwordResetAt':{'type':Sequelize[_0x5024('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x5024('0x44')]},'showWebBar':{'type':Sequelize[_0x5024('0x17')],'defaultValue':0x0,'set':function(_0xfa86d5){this['setDataValue'](_0x5024('0x45'),_0xfa86d5);var _0x58d18c=this[_0x5024('0x46')]({'plain':!![]});switch(_0xfa86d5){case 0x0:case 0x1:var _0x526d38=_0x58d18c[_0x5024('0x24')]?_[_0x5024('0x47')](_0x58d18c[_0x5024('0x24')])?_0x58d18c[_0x5024('0x24')]['join']():_0x58d18c[_0x5024('0x24')]:_0x5024('0x23');if(_0x526d38==='wss'){_0x526d38=_0x5024('0x23');}this[_0x5024('0x6')](_0x5024('0x24'),_0x526d38);this[_0x5024('0x6')](_0x5024('0x48'),'no');this[_0x5024('0x6')](_0x5024('0x49'),null);this[_0x5024('0x6')](_0x5024('0x4a'),null);this['setDataValue'](_0x5024('0x4b'),null);this[_0x5024('0x6')]('dtlsenable',null);this[_0x5024('0x6')](_0x5024('0x4c'),null);this['setDataValue'](_0x5024('0x4d'),null);this['setDataValue']('dtlscertfile',null);this[_0x5024('0x6')](_0x5024('0x4e'),null);this[_0x5024('0x6')](_0x5024('0x4f'),'no');break;case 0x2:this['setDataValue'](_0x5024('0x24'),_0x5024('0x50'));this['setDataValue'](_0x5024('0x48'),_0x5024('0x2a'));this['setDataValue'](_0x5024('0x49'),_0x5024('0x2a'));this[_0x5024('0x6')](_0x5024('0x4a'),_0x5024('0x2a'));this['setDataValue']('icesupport',_0x5024('0x2a'));this[_0x5024('0x6')](_0x5024('0x51'),_0x5024('0x2a'));this[_0x5024('0x6')](_0x5024('0x4c'),'no');this[_0x5024('0x6')]('dtlssetup',_0x5024('0x43'));this[_0x5024('0x6')](_0x5024('0x52'),_0x58d18c[_0x5024('0x52')]||_0x5024('0x53'));this[_0x5024('0x6')](_0x5024('0x4e'),_0x58d18c[_0x5024('0x4e')]||'/etc/pki/tls/private/motion.key');this[_0x5024('0x6')](_0x5024('0x4f'),_0x5024('0x2a'));break;default:}}},'permissions':{'type':Sequelize[_0x5024('0x44')],'set':function(_0x4308ec){this[_0x5024('0x6')](_0x5024('0x54'),_0x4308ec?_0x4308ec[_0x5024('0x30')](','):[]);},'get':function(){return this[_0x5024('0x14')](_0x5024('0x54'))?_['map'](this[_0x5024('0x14')](_0x5024('0x54'))['split'](','),function(_0x2235ca){return parseInt(_0x2235ca,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x5024('0x5')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x5024('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x5024('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x5024('0x17')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x5024('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x5024('0x17')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x5024('0x10')](_0x5024('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x5024('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x5024('0x55')],'get':function(){return this[_0x5024('0x14')](_0x5024('0x56'))?this[_0x5024('0x14')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x5024('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![],'set':function(_0x39eb7b){if(typeof _0x39eb7b===_0x5024('0x57')){var _0x57fed0=_0x39eb7b==='1'?!![]:_0x39eb7b==='0'?![]:_0x39eb7b===_0x5024('0x58')?!![]:_0x39eb7b===_0x5024('0x59')?![]:![];this[_0x5024('0x6')](_0x5024('0x5a'),_0x57fed0);}else{this[_0x5024('0x6')]('screenrecording',_0x39eb7b);}}},'blocked':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![],'set':function(_0x2b49d6){this[_0x5024('0x6')](_0x5024('0x5b'),_0x2b49d6);if(_0x2b49d6===!![]){this['setDataValue']('blockedAt',moment());this[_0x5024('0x6')](_0x5024('0x5c'),0x0);}else{this['setDataValue']('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x5024('0x17')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x5024('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x5024('0x17')](0x5)[_0x5024('0x5d')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x5024('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x5024('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x5024('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x367a=['VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','STRING','setDataValue','fullname','callerid','\x22%s\x22\x20<%s>','getDataValue','email','ENUM','admin','agent','telephone','INTEGER','internal','accountcode','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','friend','user','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','nonat','update','outgoing','yes','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','accept','originate','uac','uas','fingerprint','certificate','active','passive','update,nonat','TEXT','showWebBar','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsenable','rtcp_mux','dtlsverify','dtlssetup','actpass','dtlscertfile','dtlsprivatekey','permissions','map'];(function(_0x4c4042,_0x1ea485){var _0xbd10dc=function(_0x164b20){while(--_0x164b20){_0x4c4042['push'](_0x4c4042['shift']());}};_0xbd10dc(++_0x1ea485);}(_0x367a,0x67));var _0xa367=function(_0x46c5ec,_0x270606){_0x46c5ec=_0x46c5ec-0x0;var _0x3d29f1=_0x367a[_0x46c5ec];return _0x3d29f1;};'use strict';var Sequelize=require(_0xa367('0x0'));var moment=require(_0xa367('0x1'));var util=require(_0xa367('0x2'));var _=require(_0xa367('0x3'));module[_0xa367('0x4')]={'name':{'type':Sequelize[_0xa367('0x5')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x28f27e){this['setDataValue']('name',_0x28f27e);this[_0xa367('0x6')]('defaultuser',_0x28f27e);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0xa367('0x5')],'allowNull':![],'set':function(_0x356ee9){this[_0xa367('0x6')](_0xa367('0x7'),_0x356ee9);this['setDataValue'](_0xa367('0x8'),util['format'](_0xa367('0x9'),_0x356ee9,this[_0xa367('0xa')]('internal')));}},'alias':{'type':Sequelize[_0xa367('0x5')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa367('0xb'),'validate':{'isEmail':!![]},'set':function(_0x40c122){if(_0x40c122){this[_0xa367('0x6')](_0xa367('0xb'),_0x40c122['toLowerCase']());}}},'role':{'type':Sequelize[_0xa367('0xc')](_0xa367('0xd'),'user',_0xa367('0xe'),_0xa367('0xf')),'allowNull':![]},'password':{'type':Sequelize[_0xa367('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0xa367('0x10')](0xb),'allowNull':![],'unique':_0xa367('0x11'),'set':function(_0x45d20d){this[_0xa367('0x6')](_0xa367('0x11'),_0x45d20d);this[_0xa367('0x6')](_0xa367('0x12'),_0x45d20d);this[_0xa367('0x6')](_0xa367('0x8'),util['format'](_0xa367('0x9'),this[_0xa367('0xa')](_0xa367('0x7')),_0x45d20d));}},'salt':{'type':Sequelize[_0xa367('0x5')]},'phone':{'type':Sequelize[_0xa367('0x5')]},'mobile':{'type':Sequelize[_0xa367('0x5')]},'address':{'type':Sequelize[_0xa367('0x5')]},'zipcode':{'type':Sequelize[_0xa367('0x5')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xa367('0x5')]},'country':{'type':Sequelize[_0xa367('0x5')]},'online':{'type':Sequelize[_0xa367('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0xa367('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xa367('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xa367('0x13')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xa367('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xa367('0x13')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xa367('0x5')],'defaultValue':_0xa367('0x14')},'lastPauseAt':{'type':Sequelize[_0xa367('0x15')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xa367('0x10')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xa367('0x10')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xa367('0x10')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xa367('0x10')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xa367('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xa367('0x10')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xa367('0x10')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xa367('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xa367('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xa367('0x13')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![],'defaultValue':_0xa367('0x16')},'ipaddr':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0xa367('0x10')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xa367('0x10')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0xa367('0x10')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xa367('0xc')](_0xa367('0x17'),_0xa367('0x18'),_0xa367('0x19')),'allowNull':!![],'defaultValue':_0xa367('0x17')},'context':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0xa367('0xc')](_0xa367('0x1a'),_0xa367('0x1b'),'ALLOWED_FAILED_SCREEN',_0xa367('0x1c'),_0xa367('0x1d'),_0xa367('0x1e'),_0xa367('0x1f'),_0xa367('0x20')),'allowNull':!![]},'deny':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![],'defaultValue':_0xa367('0x21'),'set':function(_0x262723){this[_0xa367('0x6')](_0xa367('0x22'),_0x262723?_0x262723['join'](','):null);},'get':function(){return this[_0xa367('0xa')](_0xa367('0x22'))?this[_0xa367('0xa')](_0xa367('0x22'))[_0xa367('0x23')](','):null;},'comment':_0xa367('0x24')},'dtmfmode':{'type':Sequelize[_0xa367('0xc')](_0xa367('0x25'),_0xa367('0x26'),_0xa367('0x27'),_0xa367('0x28'),_0xa367('0x29')),'allowNull':!![],'defaultValue':_0xa367('0x25')},'directmedia':{'type':Sequelize[_0xa367('0xc')]('yes','no',_0xa367('0x2a'),_0xa367('0x2b'),_0xa367('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xa367('0xc')](_0xa367('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![],'defaultValue':_0xa367('0x2e'),'set':function(_0x50edac){this['setDataValue'](_0xa367('0x2f'),_0x50edac?_0x50edac[_0xa367('0x30')](','):null);},'get':function(){return this[_0xa367('0xa')]('nat')?this['getDataValue']('nat')[_0xa367('0x23')](','):null;},'comment':_0xa367('0x31')},'callgroup':{'type':Sequelize[_0xa367('0x5')]},'namedcallgroup':{'type':Sequelize[_0xa367('0x5')]},'pickupgroup':{'type':Sequelize[_0xa367('0x5')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xa367('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xa367('0x5')]},'disallow':{'type':Sequelize[_0xa367('0x5')],'allowNull':![],'defaultValue':_0xa367('0x32')},'allow':{'type':Sequelize[_0xa367('0x5')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x5a70b4){this['setDataValue'](_0xa367('0x33'),_0x5a70b4?_0x5a70b4[_0xa367('0x30')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xa367('0xa')](_0xa367('0x33'))?this[_0xa367('0xa')](_0xa367('0x33'))[_0xa367('0x23')](';'):null;},'comment':_0xa367('0x34')},'autoframing':{'type':Sequelize[_0xa367('0xc')](_0xa367('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![],'set':function(_0x3423a7){this['setDataValue']('insecure',_0x3423a7?_0x3423a7[_0xa367('0x30')](','):null);},'get':function(){return this[_0xa367('0xa')](_0xa367('0x35'))?this[_0xa367('0xa')]('insecure')[_0xa367('0x23')](','):null;},'comment':_0xa367('0x36')},'trustrpid':{'type':Sequelize[_0xa367('0xc')](_0xa367('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xa367('0xc')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0xa367('0x37')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xa367('0xc')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xa367('0xc')](_0xa367('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xa367('0x10')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xa367('0xc')](_0xa367('0x2d'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xa367('0x10')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0xa367('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xa367('0xc')](_0xa367('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0xa367('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xa367('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xa367('0xc')]('yes','no',_0xa367('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xa367('0x10')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xa367('0xc')](_0xa367('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xa367('0xc')](_0xa367('0x39'),'refuse',_0xa367('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xa367('0x10')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xa367('0x10')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xa367('0xc')](_0xa367('0x3b'),_0xa367('0x3c')),'allowNull':!![],'defaultValue':_0xa367('0x3c')},'t38pt_usertpsource':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0xa367('0x2d'),'no'),'allowNull':!![],'defaultValue':_0xa367('0x2d')},'keepalive':{'type':Sequelize[_0xa367('0x10')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xa367('0x10')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xa367('0x10')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xa367('0x10')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xa367('0x10')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xa367('0x10')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xa367('0x10')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xa367('0xc')](_0xa367('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xa367('0xc')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xa367('0xc')](_0xa367('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xa367('0xc')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xa367('0xc')](_0xa367('0x2d'),'no',_0xa367('0x3d'),_0xa367('0x3e')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xa367('0x10')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xa367('0xc')](_0xa367('0x3f'),_0xa367('0x40'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xa367('0xc')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xa367('0x10')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xa367('0xc')](_0xa367('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xa367('0xc')](_0xa367('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0xa367('0x2d'),'no',_0xa367('0x2a'),_0xa367('0x2b'),_0xa367('0x41')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xa367('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0xa367('0x15')]},'passwordResetAt':{'type':Sequelize[_0xa367('0x15')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xa367('0x42')]},'showWebBar':{'type':Sequelize[_0xa367('0x10')],'defaultValue':0x0,'set':function(_0x10c51b){this[_0xa367('0x6')](_0xa367('0x43'),_0x10c51b);var _0x52166a=this['get']({'plain':!![]});switch(_0x10c51b){case 0x0:case 0x1:var _0x576a7d=_0x52166a['transport']?_[_0xa367('0x44')](_0x52166a['transport'])?_0x52166a[_0xa367('0x22')][_0xa367('0x30')]():_0x52166a[_0xa367('0x22')]:'udp';if(_0x576a7d===_0xa367('0x45')){_0x576a7d=_0xa367('0x21');}this['setDataValue']('transport',_0x576a7d);this['setDataValue'](_0xa367('0x46'),'no');this[_0xa367('0x6')](_0xa367('0x47'),null);this['setDataValue'](_0xa367('0x48'),null);this['setDataValue'](_0xa367('0x49'),null);this[_0xa367('0x6')](_0xa367('0x4a'),null);this['setDataValue']('dtlsverify',null);this['setDataValue']('dtlssetup',null);this[_0xa367('0x6')]('dtlscertfile',null);this[_0xa367('0x6')]('dtlsprivatekey',null);this[_0xa367('0x6')](_0xa367('0x4b'),'no');break;case 0x2:this['setDataValue'](_0xa367('0x22'),'wss');this[_0xa367('0x6')](_0xa367('0x46'),_0xa367('0x2d'));this[_0xa367('0x6')](_0xa367('0x47'),_0xa367('0x2d'));this[_0xa367('0x6')](_0xa367('0x48'),'yes');this[_0xa367('0x6')](_0xa367('0x49'),'yes');this[_0xa367('0x6')]('dtlsenable','yes');this[_0xa367('0x6')](_0xa367('0x4c'),'no');this[_0xa367('0x6')](_0xa367('0x4d'),_0xa367('0x4e'));this[_0xa367('0x6')](_0xa367('0x4f'),_0x52166a[_0xa367('0x4f')]||'/etc/pki/tls/certs/motion.crt');this['setDataValue'](_0xa367('0x50'),_0x52166a['dtlsprivatekey']||'/etc/pki/tls/private/motion.key');this[_0xa367('0x6')](_0xa367('0x4b'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0xa367('0x42')],'set':function(_0x44c6f6){this['setDataValue'](_0xa367('0x51'),_0x44c6f6?_0x44c6f6[_0xa367('0x30')](','):[]);},'get':function(){return this[_0xa367('0xa')]('permissions')?_[_0xa367('0x52')](this[_0xa367('0xa')](_0xa367('0x51'))[_0xa367('0x23')](','),function(_0x2cf242){return parseInt(_0x2cf242,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xa367('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xa367('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xa367('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xa367('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xa367('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xa367('0x13')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xa367('0x10')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xa367('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xa367('0xc')](_0xa367('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xa367('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xa367('0x5')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xa367('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xa367('0x53')],'get':function(){return this['getDataValue'](_0xa367('0x54'))?this[_0xa367('0xa')](_0xa367('0x54')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xa367('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xa367('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xa367('0x13')],'defaultValue':![]},'interface':{'type':Sequelize[_0xa367('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xa367('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xa367('0x13')],'defaultValue':![],'set':function(_0x58372f){if(typeof _0x58372f===_0xa367('0x55')){var _0x1ffa6f=_0x58372f==='1'?!![]:_0x58372f==='0'?![]:_0x58372f===_0xa367('0x56')?!![]:_0x58372f===_0xa367('0x57')?![]:![];this['setDataValue'](_0xa367('0x58'),_0x1ffa6f);}else{this[_0xa367('0x6')](_0xa367('0x58'),_0x58372f);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x35f426){this[_0xa367('0x6')](_0xa367('0x59'),_0x35f426);if(_0x35f426===!![]){this[_0xa367('0x6')](_0xa367('0x5a'),moment());this[_0xa367('0x6')](_0xa367('0x5b'),0x0);}else{this['setDataValue'](_0xa367('0x5a'),null);}}},'blockedAt':{'type':Sequelize[_0xa367('0x15')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xa367('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xa367('0x10')](0x5)[_0xa367('0x5c')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xa367('0x13')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xa367('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xa367('0x13')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xa367('0x13')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xa367('0x13')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 847d434..205fd22 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 _0xadb5=['User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','PAUSE','isMiddleware','resolve','logout','pause','updateAttributes','getChannels','type','DEFAULT\x20PAUSE','unpause','chatPause','openchannelPause','whatsapppause','pauseType','lastPauseAt','QueuePause','manual','whatsapp','%s%s','Pause','Team','getTeams','addTeams','getVoiceQueues','Voice','setDataValue','Chat','getMailQueues','getWhatsappQueues','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','online','getDataValue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getChatQueues','getSmsQueues','removeAgent','CmList','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','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','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','SquareProject','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contained','$any','lastName','Contact','dialActive','VoiceQueue','getApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','removeApiKey','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','queues','teams','inbound','col','toString','desc','asc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','http','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','busy','slice','charAt','toUpperCase','QueryTypes','select','field','ui.','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','bluebird','path','lodash','squel','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','redis','./user.socket','register','defaults','localhost','client','request','info','User,\x20%s,\x20%s','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','status','end','json','offset','undefined','limit','set','Content-Range','update','then','get','role','admin','Users','user','Agents','agent','telephone','filter','ignore','value','includes','find','name','destroy','sendStatus','stack','send','User','map','fieldName','key','password','where','count','query','attributes','push','findAll','rows','true','length','chat','dataValues','fax','mail','openchannel','all','show','model','differenceBy','keys','rawAttributes','salt','filters','intersection','fields','includeAll','include','merge','openTabs','sms','body','describe','addContacts','omit','ids','internal','Setting','findById','securePassword','validatePasswordPattern','min_internal','sequelize','SELECT','isNil','from','voicemail','email','permissions','101','102','103','110','104','105','108','100','111','114','create','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','checkUserLimits','settingsEnabled','userProfileId','VoiceMail','UserProfileSection','Telephones','autoAssociation','UserProfileResource','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each','isEmpty','changePassword','params','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','updatePasswordsHistory','addQueues','loginInPause','voicePause','interface','add','capitalize','Queues','spread','toLowerCase','QueueId','Queue:save','voice','format','SIP/%s','penalty','upsert','removeQueues','channel','isValidChannel','Unknown\x20channel','remove','isArray','emit','Queue:remove','UserVoiceQueueRt','addAvatar','userpic','getAvatar','root','server/files/images/logos/default_profile.png','download','existsSync','join','server/files/images/','getOpenTabs','ChatOpenTabs','FaxOpenTabs','FAX','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','getContacts','CmContact','order','sort','options','hasOwnProperty','List','Tag','color','tag','pick','Unknown\x20role','Queue','getVoiceQueuesRt','getGroups','nolimit','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','FaxInteraction','getFaxInteractions','getWhatsappInteractions','login','phone','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','socket','remoteAddress'];(function(_0x207a30,_0x19066f){var _0x57af2a=function(_0x5ebdb6){while(--_0x5ebdb6){_0x207a30['push'](_0x207a30['shift']());}};_0x57af2a(++_0x19066f);}(_0xadb5,0xad));var _0x5adb=function(_0x3015ce,_0x2d0d0f){_0x3015ce=_0x3015ce-0x0;var _0x7f4d42=_0xadb5[_0x3015ce];return _0x7f4d42;};'use strict';var moment=require('moment');var BPromise=require(_0x5adb('0x0'));var util=require('util');var path=require(_0x5adb('0x1'));var fs=require('fs');var _=require(_0x5adb('0x2'));var squel=require(_0x5adb('0x3'));var jayson=require('jayson/promise');var Redis=require(_0x5adb('0x4'));var authService=require(_0x5adb('0x5'));var qs=require(_0x5adb('0x6'));var logger=require('../../config/logger')(_0x5adb('0x7'));var utils=require(_0x5adb('0x8'));var config=require(_0x5adb('0x9'));var licenseUtil=require(_0x5adb('0xa'));var db=require(_0x5adb('0xb'))['db'];var socket=require(_0x5adb('0xc'))(new Redis(config[_0x5adb('0xd')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);config[_0x5adb('0xd')]=_[_0x5adb('0x10')](config[_0x5adb('0xd')],{'host':_0x5adb('0x11'),'port':0x18eb});var client=jayson[_0x5adb('0x12')]['http']({'port':0x232a});var values;function respondWithRpcPromise(_0x4c268d,_0x1a8f66,_0x1ea238,_0x82e67e){return new BPromise(function(_0x53b772,_0x29f0d5){var _0x56012f=_0x82e67e||client;return _0x56012f[_0x5adb('0x13')](_0x4c268d,_0x1ea238)['then'](function(_0x8cfcc6){logger[_0x5adb('0x14')](_0x5adb('0x15'),_0x1a8f66,'request\x20sent');logger[_0x5adb('0x16')](_0x5adb('0x17'),_0x1a8f66,_0x5adb('0x18'),JSON['stringify'](_0x8cfcc6));if(_0x8cfcc6[_0x5adb('0x19')]){if(_0x8cfcc6['error'][_0x5adb('0x1a')]===0x1f4){logger[_0x5adb('0x19')](_0x5adb('0x15'),_0x1a8f66,_0x8cfcc6[_0x5adb('0x19')][_0x5adb('0x1b')]);return _0x29f0d5(_0x8cfcc6[_0x5adb('0x19')][_0x5adb('0x1b')]);}logger[_0x5adb('0x19')](_0x5adb('0x15'),_0x1a8f66,_0x8cfcc6['error'][_0x5adb('0x1b')]);return _0x53b772(_0x8cfcc6['error'][_0x5adb('0x1b')]);}else{logger['info'](_0x5adb('0x15'),_0x1a8f66,'request\x20sent');_0x53b772(_0x8cfcc6['result'][_0x5adb('0x1b')]);}})[_0x5adb('0x1c')](function(_0x438671){logger[_0x5adb('0x19')](_0x5adb('0x15'),_0x1a8f66,_0x438671);_0x29f0d5(_0x438671);});});}function respondWithStatusCode(_0x5af69d,_0x3255b3){_0x3255b3=_0x3255b3||0xcc;return function(_0x5c296e){if(_0x5c296e){return _0x5af69d['sendStatus'](_0x3255b3);}return _0x5af69d[_0x5adb('0x1d')](_0x3255b3)[_0x5adb('0x1e')]();};}function respondWithResult(_0x1a38d3,_0x1a8014){_0x1a8014=_0x1a8014||0xc8;return function(_0x1e9ccf){if(_0x1e9ccf){return _0x1a38d3[_0x5adb('0x1d')](_0x1a8014)[_0x5adb('0x1f')](_0x1e9ccf);}};}function respondWithFilteredResult(_0x4ca150,_0x4b1957){return function(_0x373cc3){if(_0x373cc3){var _0x3220cd=typeof _0x4b1957[_0x5adb('0x20')]===_0x5adb('0x21')&&typeof _0x4b1957['limit']===_0x5adb('0x21');var _0x2e1e63=_0x373cc3['count'];var _0x1feecf=_0x3220cd?0x0:_0x4b1957[_0x5adb('0x20')];var _0x1a0acd=_0x3220cd?_0x373cc3['count']:_0x4b1957[_0x5adb('0x20')]+_0x4b1957[_0x5adb('0x22')];var _0x3a4fca;if(_0x1a0acd>=_0x2e1e63){_0x1a0acd=_0x2e1e63;_0x3a4fca=0xc8;}else{_0x3a4fca=0xce;}_0x4ca150[_0x5adb('0x1d')](_0x3a4fca);return _0x4ca150[_0x5adb('0x23')](_0x5adb('0x24'),_0x1feecf+'-'+_0x1a0acd+'/'+_0x2e1e63)['json'](_0x373cc3);}return null;};}function saveUpdates(_0x49992e){return function(_0x5d457e){if(_0x5d457e){return _0x5d457e[_0x5adb('0x25')](_0x49992e)[_0x5adb('0x26')](function(_0x60a672){return _0x60a672;});}return null;};}function removeEntity(_0x512bab){return function(_0x137a5c){if(_0x137a5c){return _0x137a5c['destroy']()[_0x5adb('0x26')](function(){var _0x34b793=_0x137a5c[_0x5adb('0x27')]({'plain':!![]});if(_0x34b793[_0x5adb('0x28')]===_0x5adb('0x29'))return;var _0x3145f2=[{'name':_0x5adb('0x2a'),'value':_0x5adb('0x2b'),'ignore':!![]},{'name':_0x5adb('0x2c'),'value':_0x5adb('0x2d'),'ignore':![]},{'name':'Telephones','value':_0x5adb('0x2e'),'ignore':![]}];var _0x4c8b2e=_(_0x3145f2)[_0x5adb('0x2f')](_0x5adb('0x30'))['map'](_0x5adb('0x31'))[_0x5adb('0x31')]();if(_[_0x5adb('0x32')](_0x4c8b2e,_0x34b793['role'])){return;}var _0x173789=_[_0x5adb('0x33')](_0x3145f2,['value',_0x34b793['role']])[_0x5adb('0x34')];return db['UserProfileResource'][_0x5adb('0x35')]({'where':{'type':_0x173789,'resourceId':_0x34b793['id']}})[_0x5adb('0x26')](function(){return _0x137a5c;});})[_0x5adb('0x26')](function(){_0x512bab[_0x5adb('0x1d')](0xcc)[_0x5adb('0x1e')]();});}};}function handleEntityNotFound(_0x5ece39){return function(_0x2f7abe){if(!_0x2f7abe){_0x5ece39[_0x5adb('0x36')](0x194);}return _0x2f7abe;};}function handleError(_0x1c3a5c,_0x54851b){_0x54851b=_0x54851b||0x1f4;return function(_0x4c8870){logger[_0x5adb('0x19')](_0x4c8870[_0x5adb('0x37')]);if(_0x4c8870['name']){delete _0x4c8870[_0x5adb('0x34')];}_0x1c3a5c['status'](_0x54851b)[_0x5adb('0x38')](_0x4c8870);};}exports['index']=function(_0x11cb37,_0x4d052f){var _0x1d9681={},_0x23a1db={'count':0x0,'rows':[]};var _0x4ccb27=_(db[_0x5adb('0x39')]['rawAttributes'])[_0x5adb('0x3a')](function(_0x34e828){return{'name':_0x34e828[_0x5adb('0x3b')],'type':_0x34e828['type'][_0x5adb('0x3c')]};})[_0x5adb('0x2f')](function(_0xcdaf8e){return!_[_0x5adb('0x32')]([_0x5adb('0x3d'),'salt'],_0xcdaf8e['name']);})['value']();_0x1d9681=qs['getOptions'](_0x4ccb27,_0x11cb37);var _0x427c71={'where':_0x1d9681[_0x5adb('0x3e')]};return db[_0x5adb('0x39')][_0x5adb('0x3f')](_0x427c71)[_0x5adb('0x26')](function(_0xd1c3c2){_0x23a1db[_0x5adb('0x3f')]=_0xd1c3c2;if(_0x11cb37[_0x5adb('0x40')]['includeAll']){_0x1d9681['include']=[{'all':!![]}];}if(!_[_0x5adb('0x32')](_0x1d9681['attributes'],'id')){_0x1d9681[_0x5adb('0x41')][_0x5adb('0x42')]('id');}return db[_0x5adb('0x39')][_0x5adb('0x43')](_0x1d9681);})[_0x5adb('0x26')](function(_0x522ee5){_0x23a1db[_0x5adb('0x44')]=_0x522ee5;if(_0x11cb37[_0x5adb('0x40')]['openTabs']===_0x5adb('0x45')){var _0x1a256c=[];for(var _0x5833c8=0x0;_0x5833c8<_0x23a1db[_0x5adb('0x44')][_0x5adb('0x46')];_0x5833c8++){_0x1a256c[_0x5adb('0x42')](get_open_tabs(_0x5adb('0x47'),_0x23a1db[_0x5adb('0x44')][_0x5833c8][_0x5adb('0x48')]));_0x1a256c[_0x5adb('0x42')](get_open_tabs('sms',_0x23a1db['rows'][_0x5833c8][_0x5adb('0x48')]));_0x1a256c[_0x5adb('0x42')](get_open_tabs(_0x5adb('0x49'),_0x23a1db[_0x5adb('0x44')][_0x5833c8]['dataValues']));_0x1a256c['push'](get_open_tabs(_0x5adb('0x4a'),_0x23a1db[_0x5adb('0x44')][_0x5833c8][_0x5adb('0x48')]));_0x1a256c[_0x5adb('0x42')](get_open_tabs(_0x5adb('0x4b'),_0x23a1db['rows'][_0x5833c8][_0x5adb('0x48')]));_0x1a256c[_0x5adb('0x42')](get_open_tabs('whatsapp',_0x23a1db[_0x5adb('0x44')][_0x5833c8][_0x5adb('0x48')]));}return BPromise[_0x5adb('0x4c')](_0x1a256c)[_0x5adb('0x26')](function(_0x186bd2){return _0x23a1db;});}else{return _0x23a1db;}})[_0x5adb('0x26')](respondWithFilteredResult(_0x4d052f,_0x1d9681))[_0x5adb('0x1c')](handleError(_0x4d052f,null));};exports[_0x5adb('0x4d')]=function(_0x49e1a1,_0x3a925b){var _0x57dc8b={'raw':![],'where':{'id':_0x49e1a1['params']['id']}},_0x51bc49={};_0x51bc49[_0x5adb('0x4e')]=_[_0x5adb('0x4f')](_[_0x5adb('0x50')](db['User'][_0x5adb('0x51')]),['password',_0x5adb('0x52')]);_0x51bc49[_0x5adb('0x40')]=_[_0x5adb('0x50')](_0x49e1a1['query']);_0x51bc49[_0x5adb('0x53')]=_['intersection'](_0x51bc49[_0x5adb('0x4e')],_0x51bc49[_0x5adb('0x40')]);_0x57dc8b['attributes']=_[_0x5adb('0x54')](_0x51bc49[_0x5adb('0x4e')],qs[_0x5adb('0x55')](_0x49e1a1[_0x5adb('0x40')][_0x5adb('0x55')]));_0x57dc8b['attributes']=_0x57dc8b[_0x5adb('0x41')][_0x5adb('0x46')]?_0x57dc8b[_0x5adb('0x41')]:_0x51bc49[_0x5adb('0x4e')];if(_0x49e1a1['query'][_0x5adb('0x56')]){_0x57dc8b[_0x5adb('0x57')]=[{'all':!![]}];}_0x57dc8b=_[_0x5adb('0x58')]({},_0x57dc8b,_0x49e1a1['options']);if(!_[_0x5adb('0x32')](_0x57dc8b[_0x5adb('0x41')],'id')){_0x57dc8b[_0x5adb('0x41')][_0x5adb('0x42')]('id');}return db['User'][_0x5adb('0x33')](_0x57dc8b)[_0x5adb('0x26')](handleEntityNotFound(_0x3a925b,null))[_0x5adb('0x26')](function(_0x2cee37){var _0xa25ac3=[];values=_0x2cee37;if(_0x49e1a1['query'][_0x5adb('0x59')]==='true'){_0xa25ac3[_0x5adb('0x42')](get_open_tabs('chat',_0x2cee37[_0x5adb('0x48')]));_0xa25ac3[_0x5adb('0x42')](get_open_tabs(_0x5adb('0x5a'),_0x2cee37[_0x5adb('0x48')]));_0xa25ac3['push'](get_open_tabs(_0x5adb('0x4b'),_0x2cee37[_0x5adb('0x48')]));_0xa25ac3[_0x5adb('0x42')](get_open_tabs('whatsapp',_0x2cee37['dataValues']));_0xa25ac3['push'](get_open_tabs(_0x5adb('0x49'),_0x2cee37[_0x5adb('0x48')]));_0xa25ac3[_0x5adb('0x42')](get_open_tabs(_0x5adb('0x4a'),_0x2cee37[_0x5adb('0x48')]));return BPromise[_0x5adb('0x4c')](_0xa25ac3);}else{return values;}})[_0x5adb('0x26')](function(_0x8d7810){return values;})[_0x5adb('0x26')](respondWithResult(_0x3a925b,null))[_0x5adb('0x1c')](handleError(_0x3a925b,null));};exports[_0x5adb('0x25')]=function(_0x1df439,_0x2c2357){if(_0x1df439['body']['id']){delete _0x1df439['body']['id'];}delete _0x1df439[_0x5adb('0x5b')][_0x5adb('0x28')];return db[_0x5adb('0x39')][_0x5adb('0x33')]({'where':{'id':_0x1df439['params']['id']}})[_0x5adb('0x26')](handleEntityNotFound(_0x2c2357,null))[_0x5adb('0x26')](saveUpdates(_0x1df439['body'],null))[_0x5adb('0x26')](respondWithResult(_0x2c2357,null))[_0x5adb('0x1c')](handleError(_0x2c2357,null));};exports[_0x5adb('0x5c')]=function(_0x5edd60,_0x30d185){return db[_0x5adb('0x39')][_0x5adb('0x5c')]()[_0x5adb('0x26')](respondWithResult(_0x30d185,null))[_0x5adb('0x1c')](handleError(_0x30d185,null));};exports[_0x5adb('0x5d')]=function(_0x513f26,_0x836b91){return db[_0x5adb('0x39')][_0x5adb('0x33')]({'where':{'id':_0x513f26['params']['id']}})[_0x5adb('0x26')](handleEntityNotFound(_0x836b91,null))[_0x5adb('0x26')](function(_0x343aa4){if(_0x343aa4){return _0x343aa4['addContacts'](_0x513f26[_0x5adb('0x5b')]['ids'],_[_0x5adb('0x5e')](_0x513f26[_0x5adb('0x5b')],[_0x5adb('0x5f'),'id'])||{});}})['then'](respondWithResult(_0x836b91,null))[_0x5adb('0x1c')](handleError(_0x836b91,null));};function validateUser(_0x3627d1){return new BPromise(function(_0x539814,_0x12711e){if(_0x3627d1[_0x5adb('0x60')])return _0x539814(_0x3627d1);return db[_0x5adb('0x61')][_0x5adb('0x62')](0x1)['then'](function(_0x4290bb){if(_0x4290bb[_0x5adb('0x63')])authService[_0x5adb('0x64')](_0x3627d1[_0x5adb('0x3d')]);db['User']['max'](_0x5adb('0x60'))['then'](function(_0x4d635f){if(_['isNil'](_0x4d635f)){_0x3627d1[_0x5adb('0x60')]=_0x4290bb[_0x5adb('0x65')]||0x1;return;}if(_['isNil'](_0x4290bb[_0x5adb('0x65')])||_0x4290bb[_0x5adb('0x65')]===_0x4d635f){_0x3627d1[_0x5adb('0x60')]=_0x4d635f+0x1;return;}if(_0x4290bb[_0x5adb('0x65')]>_0x4d635f){_0x3627d1[_0x5adb('0x60')]=_0x4290bb[_0x5adb('0x65')];return;}return db[_0x5adb('0x66')][_0x5adb('0x40')]('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['sequelize']['QueryTypes'][_0x5adb('0x67')]})[_0x5adb('0x26')](function(_0x3a0d1b){if(_0x3a0d1b&&_0x3a0d1b[_0x5adb('0x46')]){for(var _0x1f59bb=0x0,_0x2f6ef7=_0x3a0d1b[_0x5adb('0x46')];_0x1f59bb<_0x2f6ef7&&_[_0x5adb('0x68')](_0x3627d1['internal']);_0x1f59bb++){if(_0x4290bb['min_internal']<=_0x3a0d1b[_0x1f59bb][_0x5adb('0x69')]){_0x3627d1[_0x5adb('0x60')]=_0x3a0d1b[_0x1f59bb][_0x5adb('0x69')];}else if(_0x4290bb[_0x5adb('0x65')]>_0x3a0d1b[_0x1f59bb][_0x5adb('0x69')]&&_0x4290bb[_0x5adb('0x65')]<=_0x3a0d1b[_0x1f59bb]['to']){_0x3627d1[_0x5adb('0x60')]=_0x4290bb[_0x5adb('0x65')];}}}if(_[_0x5adb('0x68')](_0x3627d1[_0x5adb('0x60')])){_0x3627d1['internal']=_0x4d635f+0x1;}return _0x539814(_0x3627d1);});});})[_0x5adb('0x1c')](function(_0x294a24){_0x12711e(_0x294a24);});});}function updateUser(_0x25ac26){return new BPromise(function(_0x5d3aa4,_0x31f041){try{if(_0x25ac26[_0x5adb('0x6a')]){_0x25ac26['mailbox']=_0x25ac26[_0x5adb('0x60')];_0x25ac26['VoiceMail']={'mailbox':_0x25ac26[_0x5adb('0x60')],'password':_0x25ac26[_0x5adb('0x3d')],'fullname':_0x25ac26['fullname'],'email':_0x25ac26[_0x5adb('0x6b')]};}if(_0x25ac26[_0x5adb('0x28')]===_0x5adb('0x2d')){if(!_0x25ac26[_0x5adb('0x6c')])_0x25ac26[_0x5adb('0x6c')]=[_0x5adb('0x6d'),_0x5adb('0x6e'),_0x5adb('0x6f'),'113',_0x5adb('0x70'),_0x5adb('0x71'),_0x5adb('0x72'),'106','107',_0x5adb('0x73'),'109',_0x5adb('0x74'),_0x5adb('0x75'),_0x5adb('0x76'),'115'];}_0x5d3aa4(_0x25ac26);}catch(_0x3a9735){_0x31f041(_0x3a9735);}});}exports[_0x5adb('0x77')]=function(_0x2e3df9,_0x3ecc56){if(_0x2e3df9[_0x5adb('0x2b')]['role']===_0x5adb('0x2d'))throw new Error(_0x5adb('0x78'));if(_0x2e3df9[_0x5adb('0x5b')][_0x5adb('0x28')]==='user'&&_0x2e3df9[_0x5adb('0x2b')][_0x5adb('0x28')]!==_0x5adb('0x29')){throw new Error(_0x5adb('0x79'));}if(_0x2e3df9[_0x5adb('0x5b')][_0x5adb('0x28')]===_0x5adb('0x29')&&_0x2e3df9['user'][_0x5adb('0x28')]!==_0x5adb('0x29')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x5adb('0x7a')]([_0x2e3df9[_0x5adb('0x5b')]])['then'](function(){return validateUser(_0x2e3df9[_0x5adb('0x5b')]);})['then'](function(_0x372354){return updateUser(_0x372354)[_0x5adb('0x26')](function(_0x4a2ebc){if(_0x4a2ebc[_0x5adb('0x28')]==='admin'){_0x4a2ebc[_0x5adb('0x7b')]=_0x2e3df9[_0x5adb('0x2b')][_0x5adb('0x7b')];delete _0x4a2ebc[_0x5adb('0x7c')];}return _0x4a2ebc;});})[_0x5adb('0x26')](function(_0x4dbcd9){return db[_0x5adb('0x39')][_0x5adb('0x77')](_0x4dbcd9,{'include':[{'model':db[_0x5adb('0x7d')],'as':_0x5adb('0x7d')}]});})['then'](function(_0x5e875c){if(_0x2e3df9[_0x5adb('0x5b')][_0x5adb('0x28')]===_0x5adb('0x2b'))return _0x5e875c;if(_0x2e3df9[_0x5adb('0x2b')][_0x5adb('0x28')]!==_0x5adb('0x2b'))return _0x5e875c;return db[_0x5adb('0x7e')]['find']({'where':{'name':_0x5e875c[_0x5adb('0x28')]===_0x5adb('0x2d')?_0x5adb('0x2c'):_0x5adb('0x7f'),'userProfileId':_0x2e3df9['user'][_0x5adb('0x7c')]},'raw':!![]})[_0x5adb('0x26')](function(_0x243016){if(!_0x243016||_0x243016[_0x5adb('0x80')]!=0x0)return _0x5e875c;return db[_0x5adb('0x81')][_0x5adb('0x77')]({'name':_0x5e875c[_0x5adb('0x34')],'resourceId':_0x5e875c['id'],'type':_0x243016[_0x5adb('0x34')],'sectionId':_0x243016['id']},{})[_0x5adb('0x26')](function(){return _0x5e875c;});})['catch'](function(_0x2a3e17){logger[_0x5adb('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a3e17);throw _0x2a3e17;});})[_0x5adb('0x26')](respondWithResult(_0x3ecc56,0xc9))[_0x5adb('0x1c')](handleError(_0x3ecc56,null));};exports[_0x5adb('0x82')]=function(_0x3bb3fc,_0x200221){var _0x1bbc2e=_0x3bb3fc[_0x5adb('0x5b')];var _0x350bb1=[];if(_0x3bb3fc['user'][_0x5adb('0x28')]===_0x5adb('0x2d'))throw new Error('Unauthorized');if(_[_0x5adb('0x83')](_0x1bbc2e,[_0x5adb('0x28'),_0x5adb('0x2b')])&&_0x3bb3fc['user']['role']!==_0x5adb('0x29')){throw new Error(_0x5adb('0x79'));}if(_[_0x5adb('0x83')](_0x1bbc2e,['role',_0x5adb('0x29')])&&_0x3bb3fc[_0x5adb('0x2b')][_0x5adb('0x28')]!==_0x5adb('0x29')){throw new Error(_0x5adb('0x84'));}return licenseUtil[_0x5adb('0x7a')](_0x1bbc2e)[_0x5adb('0x26')](function(){return validateUser(_0x1bbc2e[0x0]);})[_0x5adb('0x26')](function(){for(var _0x28bd33=0x1;_0x28bd33<_0x1bbc2e[_0x5adb('0x46')];_0x28bd33++){var _0x423b80=_0x1bbc2e[_0x28bd33-0x1][_0x5adb('0x60')];if(!_0x1bbc2e[_0x28bd33]['internal'])_0x1bbc2e[_0x28bd33]['internal']=_0x423b80+0x1;_0x350bb1[_0x5adb('0x42')](validateUser(_0x1bbc2e[_0x28bd33]));}return BPromise[_0x5adb('0x4c')](_0x350bb1);})['then'](function(){_0x350bb1=[];for(var _0x3f6975=0x0;_0x3f6975<_0x1bbc2e[_0x5adb('0x46')];_0x3f6975++){_0x350bb1[_0x5adb('0x42')](updateUser(_0x1bbc2e[_0x3f6975]));}return BPromise[_0x5adb('0x4c')](_0x350bb1);})[_0x5adb('0x26')](function(){return BPromise[_0x5adb('0x85')](_0x1bbc2e,function(_0x15626b){return db[_0x5adb('0x39')][_0x5adb('0x77')](_0x15626b,{'include':[{'model':db['VoiceMail'],'as':_0x5adb('0x7d')}]})[_0x5adb('0x26')](function(_0x273785){_0x15626b['id']=_0x273785['id'];return _0x15626b;});});})['then'](function(_0x312a90){if(_0x3bb3fc[_0x5adb('0x5b')][_0x5adb('0x28')]===_0x5adb('0x2b'))return _0x312a90;if(_0x3bb3fc[_0x5adb('0x2b')][_0x5adb('0x28')]!=='user')return _0x312a90;var _0x13a4aa=_[_0x5adb('0x83')](_0x312a90,function(_0x3fb91b){return _0x3fb91b[_0x5adb('0x28')]===_0x5adb('0x2d')||_0x3fb91b[_0x5adb('0x28')]===_0x5adb('0x2e');});if(!_0x13a4aa)return _0x312a90;return db[_0x5adb('0x7e')][_0x5adb('0x43')]({'where':{'name':{'$or':[_0x5adb('0x2c'),'Telephones']},'userProfileId':_0x3bb3fc[_0x5adb('0x2b')]['userProfileId']},'raw':!![]})[_0x5adb('0x26')](function(_0x2e0a49){if(_[_0x5adb('0x86')](_0x2e0a49)||!_[_0x5adb('0x83')](_0x2e0a49,[_0x5adb('0x80'),0x0]))return _0x312a90;_0x350bb1=[];var _0x5c7b1b=_(_0x2e0a49)['map'](function(_0x1aa301){if(_0x1aa301[_0x5adb('0x80')]===0x1)return;return _0x1aa301[_0x5adb('0x34')]===_0x5adb('0x2c')?_0x5adb('0x2d'):_0x5adb('0x2e');})['compact']()['value']();for(var _0x38c4a5=0x0;_0x38c4a5<_0x312a90[_0x5adb('0x46')];_0x38c4a5++){if(!_[_0x5adb('0x32')](_0x5c7b1b,_0x312a90[_0x38c4a5]['role']))return;var _0x542626=_0x312a90[_0x38c4a5][_0x5adb('0x28')]==='agent'?_0x5adb('0x2c'):_0x5adb('0x7f');_0x350bb1['push'](db['UserProfileResource'][_0x5adb('0x77')]({'name':_0x312a90[_0x38c4a5]['name'],'resourceId':_0x312a90[_0x38c4a5]['id'],'type':_0x542626,'sectionId':_['find'](_0x2e0a49,[_0x5adb('0x34'),_0x542626])['id']},{}));}return BPromise[_0x5adb('0x4c')](_0x350bb1);});})[_0x5adb('0x26')](respondWithResult(_0x200221,0xc9))[_0x5adb('0x1c')](handleError(_0x200221,null));};exports[_0x5adb('0x87')]=function(_0x133ea9,_0xa51ffc){if(_0x133ea9[_0x5adb('0x5b')]['id']){delete _0x133ea9[_0x5adb('0x5b')]['id'];}return db[_0x5adb('0x39')][_0x5adb('0x33')]({'where':{'id':_0x133ea9[_0x5adb('0x88')]['id']}})[_0x5adb('0x26')](function(_0x4f4898){if(!_0x4f4898)return null;if(_0x4f4898['id']===_0x133ea9[_0x5adb('0x2b')]['id']){if(!_0x133ea9['body'][_0x5adb('0x89')]||!_0x133ea9[_0x5adb('0x5b')][_0x5adb('0x8a')]){throw new db[(_0x5adb('0x8b'))][(_0x5adb('0x8c'))](_0x5adb('0x8d'));}if(!_0x4f4898[_0x5adb('0x8e')](_0x133ea9[_0x5adb('0x5b')][_0x5adb('0x89')])){throw new db[(_0x5adb('0x8b'))][(_0x5adb('0x8c'))](_0x5adb('0x8f'));}if(_0x133ea9['body'][_0x5adb('0x89')]===_0x133ea9[_0x5adb('0x5b')][_0x5adb('0x8a')]){throw new db[(_0x5adb('0x8b'))][(_0x5adb('0x8c'))](_0x5adb('0x90'));}}else if(_0x133ea9[_0x5adb('0x2b')][_0x5adb('0x28')]==='admin'){if(!_0x133ea9[_0x5adb('0x5b')][_0x5adb('0x8a')]){throw new db[(_0x5adb('0x8b'))]['ValidationError'](_0x5adb('0x91'));}}else if(_0x133ea9['user'][_0x5adb('0x28')]==='user'){if(!_0x133ea9['body'][_0x5adb('0x8a')]){throw new db[(_0x5adb('0x8b'))][(_0x5adb('0x8c'))](_0x5adb('0x91'));}if(_0x4f4898[_0x5adb('0x28')]!==_0x5adb('0x2d')){throw new db[(_0x5adb('0x8b'))][(_0x5adb('0x8c'))](_0x5adb('0x78'));}}else{throw new db[(_0x5adb('0x8b'))][(_0x5adb('0x8c'))](_0x5adb('0x78'));}return _0x4f4898;})['then'](handleEntityNotFound(_0xa51ffc,null))[_0x5adb('0x26')](function(_0x521dde){return db[_0x5adb('0x61')][_0x5adb('0x92')]({'attributes':['id','securePassword',_0x5adb('0x93'),_0x5adb('0x94')]})['then'](function(_0x4b367d){if(_0x4b367d[_0x5adb('0x63')])authService[_0x5adb('0x64')](_0x133ea9[_0x5adb('0x5b')][_0x5adb('0x8a')]);if(!_0x4b367d[_0x5adb('0x93')]||!_0x521dde[_0x5adb('0x95')])return _0x521dde;authService['validatePasswordHistory'](_0x133ea9[_0x5adb('0x5b')][_0x5adb('0x8a')],_0x521dde[_0x5adb('0x95')],_0x4b367d[_0x5adb('0x94')]);return _0x521dde;})[_0x5adb('0x26')](saveUpdates({'password':_0x133ea9['body']['newPassword'],'passwordResetAt':_0x133ea9[_0x5adb('0x2b')]['id']==_0x133ea9[_0x5adb('0x88')]['id']?moment():null,'previousPasswords':authService[_0x5adb('0x96')](_0x133ea9[_0x5adb('0x5b')][_0x5adb('0x8a')],_0x521dde[_0x5adb('0x95')])},null));})[_0x5adb('0x26')](respondWithResult(_0xa51ffc,null))[_0x5adb('0x1c')](handleError(_0xa51ffc,null));};exports[_0x5adb('0x97')]=function(_0x4fedea,_0x2102f3){var _0x2d7264=_0x4fedea['body']['channel'];return db['User'][_0x5adb('0x33')]({'where':{'id':_0x4fedea[_0x5adb('0x88')]['id']},'attributes':['id',_0x5adb('0x34'),'role','online',_0x5adb('0x98'),_0x5adb('0x99'),_0x5adb('0x9a')]})[_0x5adb('0x26')](handleEntityNotFound(_0x2102f3,null))[_0x5adb('0x26')](function(_0x44cd22){if(_0x44cd22){if(!utils['isValidChannel'](_0x2d7264)){throw new db['Sequelize'][(_0x5adb('0x8c'))]('Unknown\x20channel');}return _0x44cd22[_0x5adb('0x9b')+_[_0x5adb('0x9c')](_0x2d7264['toLowerCase']())+_0x5adb('0x9d')](_0x4fedea[_0x5adb('0x5b')][_0x5adb('0x5f')],{'penalty':_0x4fedea[_0x5adb('0x5b')]['penalty']||0x0})[_0x5adb('0x9e')](function(_0x398188){for(var _0x21a51f=0x0;_0x21a51f<_0x4fedea[_0x5adb('0x5b')]['ids'][_0x5adb('0x46')];_0x21a51f+=0x1){var _0x559938={'UserId':Number(_0x4fedea[_0x5adb('0x88')]['id'])};_0x559938[_[_0x5adb('0x9c')](_0x2d7264[_0x5adb('0x9f')]())+_0x5adb('0xa0')]=Number(_0x4fedea[_0x5adb('0x5b')][_0x5adb('0x5f')][_0x21a51f]);socket['emit'](_0x5adb('0x2b')+_[_0x5adb('0x9c')](_0x2d7264[_0x5adb('0x9f')]())+_0x5adb('0xa1'),_0x559938);}return _0x398188;})['then'](function(){if(_0x2d7264===_0x5adb('0xa2')){return db['VoiceQueue']['findAll']({'where':{'id':_0x4fedea['body'][_0x5adb('0x5f')]||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x1d3771){var _0x143f33=_0x44cd22[_0x5adb('0x27')]({'plain':!![]});var _0x2d6898=[];if(_0x2d7264===_0x5adb('0xa2')&&_0x143f33[_0x5adb('0x28')]===_0x5adb('0x2d')&&_0x143f33['online']){for(var _0x59d227=0x0;_0x59d227<_0x1d3771[_0x5adb('0x46')];_0x59d227+=0x1){_0x2d6898['push']({'membername':_0x143f33[_0x5adb('0x34')],'UserId':_0x143f33['id'],'queue_name':_0x1d3771[_0x59d227][_0x5adb('0x34')],'VoiceQueueId':_0x1d3771[_0x59d227]['id'],'interface':_[_0x5adb('0x68')](_0x143f33[_0x5adb('0x9a')])?util[_0x5adb('0xa3')](_0x5adb('0xa4'),_0x143f33[_0x5adb('0x34')]):_0x143f33[_0x5adb('0x9a')],'paused':_0x143f33[_0x5adb('0x99')]||![],'penalty':_0x4fedea[_0x5adb('0x5b')][_0x5adb('0xa5')]||0x0});}return BPromise[_0x5adb('0x85')](_0x2d6898,function(_0x4871b1){return db['UserVoiceQueueRt'][_0x5adb('0xa6')](_0x4871b1);});}return _0x44cd22;});}})[_0x5adb('0x26')](respondWithStatusCode(_0x2102f3,null))[_0x5adb('0x1c')](handleError(_0x2102f3,null));};exports[_0x5adb('0xa7')]=function(_0x587101,_0x477b6d){var _0x380ccc;return db[_0x5adb('0x39')][_0x5adb('0x33')]({'where':{'id':_0x587101[_0x5adb('0x88')]['id']},'attributes':['id','name','role']})[_0x5adb('0x26')](handleEntityNotFound(_0x477b6d,null))['then'](function(_0x182975){if(_0x182975){_0x380ccc=_0x182975;if(!_0x587101[_0x5adb('0x40')][_0x5adb('0xa8')]||!utils[_0x5adb('0xa9')](_0x587101[_0x5adb('0x40')][_0x5adb('0xa8')])){throw new db['Sequelize'][(_0x5adb('0x8c'))](_0x5adb('0xaa'));}return _0x182975[_0x5adb('0xab')+_[_0x5adb('0x9c')](_0x587101[_0x5adb('0x40')][_0x5adb('0xa8')][_0x5adb('0x9f')]())+'Queues'](_0x587101['query']['ids']);}})[_0x5adb('0x26')](function(_0x5ae730){if(_[_0x5adb('0xac')](_0x587101['query']['ids'])){for(var _0x3420fa=0x0;_0x3420fa<_0x587101[_0x5adb('0x40')]['ids']['length'];_0x3420fa+=0x1){var _0x272f92={'UserId':Number(_0x587101[_0x5adb('0x88')]['id'])};_0x272f92[_[_0x5adb('0x9c')](_0x587101['query'][_0x5adb('0xa8')]['toLowerCase']())+'QueueId']=Number(_0x587101[_0x5adb('0x40')][_0x5adb('0x5f')][_0x3420fa]);socket[_0x5adb('0xad')]('user'+_['capitalize'](_0x587101[_0x5adb('0x40')][_0x5adb('0xa8')]['toLowerCase']())+'Queue:remove',_0x272f92);}}else{var _0x272f92={'UserId':Number(_0x587101[_0x5adb('0x88')]['id'])};_0x272f92[_['capitalize'](_0x587101[_0x5adb('0x40')]['channel'][_0x5adb('0x9f')]())+'QueueId']=Number(_0x587101[_0x5adb('0x40')][_0x5adb('0x5f')]);socket[_0x5adb('0xad')](_0x5adb('0x2b')+_[_0x5adb('0x9c')](_0x587101['query'][_0x5adb('0xa8')][_0x5adb('0x9f')]())+_0x5adb('0xae'),_0x272f92);}return _0x5ae730;})['then'](function(){if(_0x587101[_0x5adb('0x40')][_0x5adb('0xa8')]===_0x5adb('0xa2')){return db[_0x5adb('0xaf')]['destroy']({'where':{'UserId':_0x587101[_0x5adb('0x88')]['id'],'VoiceQueueId':_0x587101[_0x5adb('0x40')][_0x5adb('0x5f')]},'individualHooks':!![]})['then'](function(){return _0x380ccc;});}return _0x380ccc;})[_0x5adb('0x26')](respondWithStatusCode(_0x477b6d,null))['catch'](handleError(_0x477b6d,null));};exports[_0x5adb('0xb0')]=function(_0x2ccc31,_0x20ad43){_0x2ccc31[_0x5adb('0x5b')][_0x5adb('0xb1')]=_0x2ccc31['file']['filename'];return db['User'][_0x5adb('0x33')]({'where':{'id':_0x2ccc31['params']['id']}})['then'](handleEntityNotFound(_0x20ad43,null))[_0x5adb('0x26')](saveUpdates(_0x2ccc31[_0x5adb('0x5b')],null))[_0x5adb('0x26')](respondWithResult(_0x20ad43,null))[_0x5adb('0x1c')](handleError(_0x20ad43,null));};exports[_0x5adb('0xb2')]=function(_0x2d58b8,_0x2a9cc9){var _0x338404=path['join'](config[_0x5adb('0xb3')],_0x5adb('0xb4'));return db['User'][_0x5adb('0x33')]({'where':{'id':_0x2d58b8[_0x5adb('0x88')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x5adb('0x26')](handleEntityNotFound(_0x2a9cc9,null))['then'](function(_0x3bff0c){if(_0x3bff0c){if(_[_0x5adb('0x68')](_0x3bff0c[_0x5adb('0xb1')])){return _0x2a9cc9[_0x5adb('0xb5')](_0x338404);}else{if(!fs[_0x5adb('0xb6')](path[_0x5adb('0xb7')](config[_0x5adb('0xb3')],_0x5adb('0xb8'),_0x3bff0c['userpic']))){return _0x2a9cc9[_0x5adb('0xb5')](_0x338404);}return _0x2a9cc9['download'](path[_0x5adb('0xb7')](config['root'],_0x5adb('0xb8'),_0x3bff0c['userpic']));}}})[_0x5adb('0x1c')](handleError(_0x2a9cc9,null));};exports[_0x5adb('0xb9')]=function(_0x123e79,_0x759016){return db[_0x5adb('0x39')][_0x5adb('0x33')]({'where':{'id':_0x123e79[_0x5adb('0x88')]['id']},'attributes':['id']})[_0x5adb('0x26')](handleEntityNotFound(_0x759016,null))[_0x5adb('0x26')](function(_0x1ee4c8){var _0x35e182=[];values=_0x1ee4c8[_0x5adb('0x48')];_0x35e182[_0x5adb('0x42')](get_open_tabs('chat',_0x1ee4c8[_0x5adb('0x48')]));_0x35e182['push'](get_open_tabs(_0x5adb('0x5a'),_0x1ee4c8[_0x5adb('0x48')]));_0x35e182[_0x5adb('0x42')](get_open_tabs('openchannel',_0x1ee4c8['dataValues']));_0x35e182['push'](get_open_tabs('whatsapp',_0x1ee4c8[_0x5adb('0x48')]));_0x35e182[_0x5adb('0x42')](get_open_tabs(_0x5adb('0x49'),_0x1ee4c8[_0x5adb('0x48')]));_0x35e182[_0x5adb('0x42')](get_open_tabs(_0x5adb('0x4a'),_0x1ee4c8[_0x5adb('0x48')]));return BPromise[_0x5adb('0x4c')](_0x35e182);})[_0x5adb('0x26')](function(_0x5c6ef6){var _0x39bf82=[];if(_0x5c6ef6){for(var _0x5100a3=0x0;_0x5100a3=_0x80bc05){_0x5f4568=_0x80bc05;_0x4c23f8=0xc8;}else{_0x4c23f8=0xce;}_0x12c638[_0x6c1c('0x1f')](_0x4c23f8);return _0x12c638['set'](_0x6c1c('0x26'),_0x1b9d7d+'-'+_0x5f4568+'/'+_0x80bc05)[_0x6c1c('0x21')](_0x1dba08);}return null;};}function saveUpdates(_0x504348){return function(_0x3b1a4f){if(_0x3b1a4f){return _0x3b1a4f[_0x6c1c('0x27')](_0x504348)['then'](function(_0x3b319a){return _0x3b319a;});}return null;};}function removeEntity(_0x19a8f1){return function(_0xdcef7){if(_0xdcef7){return _0xdcef7[_0x6c1c('0x28')]()['then'](function(){var _0x52c036=_0xdcef7[_0x6c1c('0x29')]({'plain':!![]});if(_0x52c036[_0x6c1c('0x2a')]===_0x6c1c('0x2b'))return;var _0x30cec5=[{'name':_0x6c1c('0x2c'),'value':_0x6c1c('0x2d'),'ignore':!![]},{'name':'Agents','value':_0x6c1c('0x2e'),'ignore':![]},{'name':_0x6c1c('0x2f'),'value':'telephone','ignore':![]}];var _0x1b371d=_(_0x30cec5)[_0x6c1c('0x30')](_0x6c1c('0x31'))[_0x6c1c('0x32')]('value')[_0x6c1c('0x33')]();if(_[_0x6c1c('0x34')](_0x1b371d,_0x52c036[_0x6c1c('0x2a')])){return;}var _0x5adddc=_[_0x6c1c('0x35')](_0x30cec5,['value',_0x52c036[_0x6c1c('0x2a')]])['name'];return db[_0x6c1c('0x36')][_0x6c1c('0x28')]({'where':{'type':_0x5adddc,'resourceId':_0x52c036['id']}})[_0x6c1c('0x12')](function(){return _0xdcef7;});})['then'](function(){_0x19a8f1['status'](0xcc)[_0x6c1c('0x20')]();});}};}function handleEntityNotFound(_0x3264e6){return function(_0x3ab64d){if(!_0x3ab64d){_0x3264e6['sendStatus'](0x194);}return _0x3ab64d;};}function handleError(_0x1a9132,_0x4c1591){_0x4c1591=_0x4c1591||0x1f4;return function(_0x5ba362){logger[_0x6c1c('0x18')](_0x5ba362[_0x6c1c('0x37')]);if(_0x5ba362[_0x6c1c('0x38')]){delete _0x5ba362[_0x6c1c('0x38')];}_0x1a9132['status'](_0x4c1591)[_0x6c1c('0x39')](_0x5ba362);};}exports[_0x6c1c('0x3a')]=function(_0x387d62,_0x18da02){var _0x173a54={},_0x398e95={'count':0x0,'rows':[]};var _0x4ae7dc=_(db[_0x6c1c('0x3b')][_0x6c1c('0x3c')])[_0x6c1c('0x32')](function(_0x47d75e){return{'name':_0x47d75e[_0x6c1c('0x3d')],'type':_0x47d75e[_0x6c1c('0x3e')][_0x6c1c('0x3f')]};})[_0x6c1c('0x30')](function(_0x1cb3b4){return!_['includes'](['password','salt'],_0x1cb3b4[_0x6c1c('0x38')]);})['value']();_0x173a54=qs['getOptions'](_0x4ae7dc,_0x387d62);var _0xc26c76={'where':_0x173a54[_0x6c1c('0x40')]};return db['User'][_0x6c1c('0x25')](_0xc26c76)[_0x6c1c('0x12')](function(_0x3d61aa){_0x398e95['count']=_0x3d61aa;if(_0x387d62[_0x6c1c('0x41')][_0x6c1c('0x42')]){_0x173a54['include']=[{'all':!![]}];}if(!_[_0x6c1c('0x34')](_0x173a54['attributes'],'id')){_0x173a54[_0x6c1c('0x43')][_0x6c1c('0x44')]('id');}return db[_0x6c1c('0x3b')][_0x6c1c('0x45')](_0x173a54);})[_0x6c1c('0x12')](function(_0x595ba2){_0x398e95[_0x6c1c('0x46')]=_0x595ba2;if(_0x387d62[_0x6c1c('0x41')][_0x6c1c('0x47')]==='true'){var _0x39c013=[];for(var _0x52866c=0x0;_0x52866c<_0x398e95[_0x6c1c('0x46')][_0x6c1c('0x48')];_0x52866c++){_0x39c013[_0x6c1c('0x44')](get_open_tabs('chat',_0x398e95[_0x6c1c('0x46')][_0x52866c]['dataValues']));_0x39c013['push'](get_open_tabs('sms',_0x398e95[_0x6c1c('0x46')][_0x52866c][_0x6c1c('0x49')]));_0x39c013[_0x6c1c('0x44')](get_open_tabs(_0x6c1c('0x4a'),_0x398e95[_0x6c1c('0x46')][_0x52866c][_0x6c1c('0x49')]));_0x39c013[_0x6c1c('0x44')](get_open_tabs(_0x6c1c('0x4b'),_0x398e95['rows'][_0x52866c][_0x6c1c('0x49')]));_0x39c013[_0x6c1c('0x44')](get_open_tabs('openchannel',_0x398e95[_0x6c1c('0x46')][_0x52866c]['dataValues']));_0x39c013[_0x6c1c('0x44')](get_open_tabs(_0x6c1c('0x4c'),_0x398e95[_0x6c1c('0x46')][_0x52866c][_0x6c1c('0x49')]));}return BPromise[_0x6c1c('0x4d')](_0x39c013)['then'](function(_0x1fe6e8){return _0x398e95;});}else{return _0x398e95;}})['then'](respondWithFilteredResult(_0x18da02,_0x173a54))[_0x6c1c('0x1d')](handleError(_0x18da02,null));};exports[_0x6c1c('0x4e')]=function(_0x2f6ce0,_0xa06377){var _0x8d614={'raw':![],'where':{'id':_0x2f6ce0['params']['id']}},_0x26cf7f={};_0x26cf7f[_0x6c1c('0x4f')]=_[_0x6c1c('0x50')](_['keys'](db[_0x6c1c('0x3b')][_0x6c1c('0x3c')]),[_0x6c1c('0x51'),_0x6c1c('0x52')]);_0x26cf7f['query']=_[_0x6c1c('0x53')](_0x2f6ce0[_0x6c1c('0x41')]);_0x26cf7f[_0x6c1c('0x54')]=_['intersection'](_0x26cf7f['model'],_0x26cf7f['query']);_0x8d614['attributes']=_['intersection'](_0x26cf7f[_0x6c1c('0x4f')],qs[_0x6c1c('0x55')](_0x2f6ce0['query'][_0x6c1c('0x55')]));_0x8d614[_0x6c1c('0x43')]=_0x8d614[_0x6c1c('0x43')]['length']?_0x8d614['attributes']:_0x26cf7f[_0x6c1c('0x4f')];if(_0x2f6ce0[_0x6c1c('0x41')]['includeAll']){_0x8d614[_0x6c1c('0x56')]=[{'all':!![]}];}_0x8d614=_[_0x6c1c('0x57')]({},_0x8d614,_0x2f6ce0[_0x6c1c('0x58')]);if(!_[_0x6c1c('0x34')](_0x8d614[_0x6c1c('0x43')],'id')){_0x8d614[_0x6c1c('0x43')]['push']('id');}return db[_0x6c1c('0x3b')][_0x6c1c('0x35')](_0x8d614)['then'](handleEntityNotFound(_0xa06377,null))['then'](function(_0x69f90b){var _0x1c6432=[];values=_0x69f90b;if(_0x2f6ce0[_0x6c1c('0x41')]['openTabs']===_0x6c1c('0x59')){_0x1c6432[_0x6c1c('0x44')](get_open_tabs(_0x6c1c('0x5a'),_0x69f90b[_0x6c1c('0x49')]));_0x1c6432['push'](get_open_tabs('sms',_0x69f90b[_0x6c1c('0x49')]));_0x1c6432[_0x6c1c('0x44')](get_open_tabs(_0x6c1c('0x5b'),_0x69f90b['dataValues']));_0x1c6432['push'](get_open_tabs(_0x6c1c('0x4c'),_0x69f90b[_0x6c1c('0x49')]));_0x1c6432['push'](get_open_tabs(_0x6c1c('0x4a'),_0x69f90b[_0x6c1c('0x49')]));_0x1c6432[_0x6c1c('0x44')](get_open_tabs(_0x6c1c('0x4b'),_0x69f90b[_0x6c1c('0x49')]));return BPromise[_0x6c1c('0x4d')](_0x1c6432);}else{return values;}})['then'](function(_0x398bca){return values;})['then'](respondWithResult(_0xa06377,null))[_0x6c1c('0x1d')](handleError(_0xa06377,null));};exports[_0x6c1c('0x27')]=function(_0x117240,_0x319820){if(_0x117240['body']['id']){delete _0x117240['body']['id'];}delete _0x117240[_0x6c1c('0x5c')][_0x6c1c('0x2a')];return db[_0x6c1c('0x3b')]['find']({'where':{'id':_0x117240[_0x6c1c('0x5d')]['id']}})[_0x6c1c('0x12')](handleEntityNotFound(_0x319820,null))[_0x6c1c('0x12')](saveUpdates(_0x117240[_0x6c1c('0x5c')],null))[_0x6c1c('0x12')](respondWithResult(_0x319820,null))[_0x6c1c('0x1d')](handleError(_0x319820,null));};exports[_0x6c1c('0x5e')]=function(_0x4d51dc,_0x268fec){return db['User'][_0x6c1c('0x5e')]()[_0x6c1c('0x12')](respondWithResult(_0x268fec,null))[_0x6c1c('0x1d')](handleError(_0x268fec,null));};exports[_0x6c1c('0x5f')]=function(_0x54b80a,_0x43423e){return db[_0x6c1c('0x3b')][_0x6c1c('0x35')]({'where':{'id':_0x54b80a[_0x6c1c('0x5d')]['id']}})[_0x6c1c('0x12')](handleEntityNotFound(_0x43423e,null))[_0x6c1c('0x12')](function(_0x1fd3c1){if(_0x1fd3c1){return _0x1fd3c1[_0x6c1c('0x5f')](_0x54b80a[_0x6c1c('0x5c')][_0x6c1c('0x60')],_[_0x6c1c('0x61')](_0x54b80a['body'],[_0x6c1c('0x60'),'id'])||{});}})[_0x6c1c('0x12')](respondWithResult(_0x43423e,null))[_0x6c1c('0x1d')](handleError(_0x43423e,null));};function validateUser(_0x321997){return new BPromise(function(_0x441648,_0x59bd3f){if(_0x321997[_0x6c1c('0x62')])return _0x441648(_0x321997);return db[_0x6c1c('0x63')]['findById'](0x1)[_0x6c1c('0x12')](function(_0x14054d){if(_0x14054d[_0x6c1c('0x64')])authService['validatePasswordPattern'](_0x321997[_0x6c1c('0x51')]);db[_0x6c1c('0x3b')][_0x6c1c('0x65')](_0x6c1c('0x62'))[_0x6c1c('0x12')](function(_0x374b22){if(_['isNil'](_0x374b22)){_0x321997['internal']=_0x14054d[_0x6c1c('0x66')]||0x1;return;}if(_[_0x6c1c('0x67')](_0x14054d['min_internal'])||_0x14054d['min_internal']===_0x374b22){_0x321997['internal']=_0x374b22+0x1;return;}if(_0x14054d[_0x6c1c('0x66')]>_0x374b22){_0x321997[_0x6c1c('0x62')]=_0x14054d[_0x6c1c('0x66')];return;}return db[_0x6c1c('0x68')]['query'](_0x6c1c('0x69'),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0x6c1c('0x12')](function(_0x1e20a9){if(_0x1e20a9&&_0x1e20a9[_0x6c1c('0x48')]){for(var _0x42ae1b=0x0,_0x10bfb4=_0x1e20a9[_0x6c1c('0x48')];_0x42ae1b<_0x10bfb4&&_['isNil'](_0x321997[_0x6c1c('0x62')]);_0x42ae1b++){if(_0x14054d[_0x6c1c('0x66')]<=_0x1e20a9[_0x42ae1b][_0x6c1c('0x6a')]){_0x321997['internal']=_0x1e20a9[_0x42ae1b]['from'];}else if(_0x14054d['min_internal']>_0x1e20a9[_0x42ae1b][_0x6c1c('0x6a')]&&_0x14054d[_0x6c1c('0x66')]<=_0x1e20a9[_0x42ae1b]['to']){_0x321997['internal']=_0x14054d[_0x6c1c('0x66')];}}}if(_['isNil'](_0x321997[_0x6c1c('0x62')])){_0x321997[_0x6c1c('0x62')]=_0x374b22+0x1;}return _0x441648(_0x321997);});});})[_0x6c1c('0x1d')](function(_0x42a468){_0x59bd3f(_0x42a468);});});}function updateUser(_0x4b1cac){return new BPromise(function(_0x13ff56,_0x41f3d9){try{if(_0x4b1cac['voicemail']){_0x4b1cac['mailbox']=_0x4b1cac[_0x6c1c('0x62')];_0x4b1cac[_0x6c1c('0x6b')]={'mailbox':_0x4b1cac[_0x6c1c('0x62')],'password':_0x4b1cac['password'],'fullname':_0x4b1cac[_0x6c1c('0x6c')],'email':_0x4b1cac[_0x6c1c('0x6d')]};}if(_0x4b1cac['role']==='agent'){if(!_0x4b1cac['permissions'])_0x4b1cac['permissions']=[_0x6c1c('0x6e'),'102',_0x6c1c('0x6f'),_0x6c1c('0x70'),_0x6c1c('0x71'),'104',_0x6c1c('0x72'),_0x6c1c('0x73'),_0x6c1c('0x74'),_0x6c1c('0x75'),_0x6c1c('0x76'),'100',_0x6c1c('0x77'),'114',_0x6c1c('0x78')];}_0x13ff56(_0x4b1cac);}catch(_0x11c901){_0x41f3d9(_0x11c901);}});}exports[_0x6c1c('0x79')]=function(_0x458316,_0x31eac6){if(_0x458316[_0x6c1c('0x2d')][_0x6c1c('0x2a')]===_0x6c1c('0x2e'))throw new Error('Unauthorized');if(_0x458316[_0x6c1c('0x5c')]['role']==='user'&&_0x458316[_0x6c1c('0x2d')][_0x6c1c('0x2a')]!==_0x6c1c('0x2b')){throw new Error(_0x6c1c('0x7a'));}if(_0x458316['body'][_0x6c1c('0x2a')]==='admin'&&_0x458316[_0x6c1c('0x2d')]['role']!==_0x6c1c('0x2b')){throw new Error(_0x6c1c('0x7b'));}return licenseUtil[_0x6c1c('0x7c')]([_0x458316['body']])[_0x6c1c('0x12')](function(){return validateUser(_0x458316[_0x6c1c('0x5c')]);})[_0x6c1c('0x12')](function(_0x4b5801){return updateUser(_0x4b5801)[_0x6c1c('0x12')](function(_0x2f9a4d){if(_0x2f9a4d[_0x6c1c('0x2a')]===_0x6c1c('0x2b')){_0x2f9a4d['settingsEnabled']=_0x458316[_0x6c1c('0x2d')][_0x6c1c('0x7d')];delete _0x2f9a4d[_0x6c1c('0x7e')];}return _0x2f9a4d;});})[_0x6c1c('0x12')](function(_0x3f87db){return db['User'][_0x6c1c('0x79')](_0x3f87db,{'include':[{'model':db[_0x6c1c('0x6b')],'as':_0x6c1c('0x6b')}]});})[_0x6c1c('0x12')](function(_0x587309){if(_0x458316[_0x6c1c('0x5c')][_0x6c1c('0x2a')]===_0x6c1c('0x2d'))return _0x587309;if(_0x458316['user'][_0x6c1c('0x2a')]!==_0x6c1c('0x2d'))return _0x587309;return db['UserProfileSection'][_0x6c1c('0x35')]({'where':{'name':_0x587309['role']===_0x6c1c('0x2e')?_0x6c1c('0x7f'):_0x6c1c('0x2f'),'userProfileId':_0x458316[_0x6c1c('0x2d')]['userProfileId']},'raw':!![]})[_0x6c1c('0x12')](function(_0x442431){if(!_0x442431||_0x442431[_0x6c1c('0x80')]!=0x0)return _0x587309;return db['UserProfileResource'][_0x6c1c('0x79')]({'name':_0x587309[_0x6c1c('0x38')],'resourceId':_0x587309['id'],'type':_0x442431[_0x6c1c('0x38')],'sectionId':_0x442431['id']},{})[_0x6c1c('0x12')](function(){return _0x587309;});})['catch'](function(_0x165839){logger[_0x6c1c('0x18')](_0x6c1c('0x81'),_0x165839);throw _0x165839;});})['then'](respondWithResult(_0x31eac6,0xc9))[_0x6c1c('0x1d')](handleError(_0x31eac6,null));};exports['bulkCreate']=function(_0x29c5c8,_0x27a9ea){var _0x1dfb61=_0x29c5c8[_0x6c1c('0x5c')];var _0x29da07=[];if(_0x29c5c8[_0x6c1c('0x2d')][_0x6c1c('0x2a')]===_0x6c1c('0x2e'))throw new Error('Unauthorized');if(_[_0x6c1c('0x82')](_0x1dfb61,['role',_0x6c1c('0x2d')])&&_0x29c5c8[_0x6c1c('0x2d')][_0x6c1c('0x2a')]!==_0x6c1c('0x2b')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x6c1c('0x82')](_0x1dfb61,[_0x6c1c('0x2a'),_0x6c1c('0x2b')])&&_0x29c5c8['user'][_0x6c1c('0x2a')]!==_0x6c1c('0x2b')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil['checkUserLimits'](_0x1dfb61)[_0x6c1c('0x12')](function(){return validateUser(_0x1dfb61[0x0]);})[_0x6c1c('0x12')](function(){for(var _0x8e8ee2=0x1;_0x8e8ee2<_0x1dfb61[_0x6c1c('0x48')];_0x8e8ee2++){var _0x305cc2=_0x1dfb61[_0x8e8ee2-0x1][_0x6c1c('0x62')];if(!_0x1dfb61[_0x8e8ee2][_0x6c1c('0x62')])_0x1dfb61[_0x8e8ee2][_0x6c1c('0x62')]=_0x305cc2+0x1;_0x29da07[_0x6c1c('0x44')](validateUser(_0x1dfb61[_0x8e8ee2]));}return BPromise[_0x6c1c('0x4d')](_0x29da07);})[_0x6c1c('0x12')](function(){_0x29da07=[];for(var _0x3f9697=0x0;_0x3f9697<_0x1dfb61['length'];_0x3f9697++){_0x29da07[_0x6c1c('0x44')](updateUser(_0x1dfb61[_0x3f9697]));}return BPromise[_0x6c1c('0x4d')](_0x29da07);})[_0x6c1c('0x12')](function(){return BPromise[_0x6c1c('0x83')](_0x1dfb61,function(_0x40415d){return db[_0x6c1c('0x3b')][_0x6c1c('0x79')](_0x40415d,{'include':[{'model':db['VoiceMail'],'as':_0x6c1c('0x6b')}]})['then'](function(_0x4df859){_0x40415d['id']=_0x4df859['id'];return _0x40415d;});});})[_0x6c1c('0x12')](function(_0x3a2cb8){if(_0x29c5c8[_0x6c1c('0x5c')][_0x6c1c('0x2a')]===_0x6c1c('0x2d'))return _0x3a2cb8;if(_0x29c5c8[_0x6c1c('0x2d')][_0x6c1c('0x2a')]!==_0x6c1c('0x2d'))return _0x3a2cb8;var _0x3543c8=_[_0x6c1c('0x82')](_0x3a2cb8,function(_0x4eac13){return _0x4eac13[_0x6c1c('0x2a')]===_0x6c1c('0x2e')||_0x4eac13[_0x6c1c('0x2a')]===_0x6c1c('0x84');});if(!_0x3543c8)return _0x3a2cb8;return db[_0x6c1c('0x85')][_0x6c1c('0x45')]({'where':{'name':{'$or':[_0x6c1c('0x7f'),_0x6c1c('0x2f')]},'userProfileId':_0x29c5c8['user'][_0x6c1c('0x7e')]},'raw':!![]})[_0x6c1c('0x12')](function(_0x232e9f){if(_[_0x6c1c('0x86')](_0x232e9f)||!_[_0x6c1c('0x82')](_0x232e9f,[_0x6c1c('0x80'),0x0]))return _0x3a2cb8;_0x29da07=[];var _0x152fef=_(_0x232e9f)[_0x6c1c('0x32')](function(_0xc5a79b){if(_0xc5a79b[_0x6c1c('0x80')]===0x1)return;return _0xc5a79b[_0x6c1c('0x38')]===_0x6c1c('0x7f')?_0x6c1c('0x2e'):_0x6c1c('0x84');})['compact']()['value']();for(var _0x3a4abd=0x0;_0x3a4abd<_0x3a2cb8['length'];_0x3a4abd++){if(!_[_0x6c1c('0x34')](_0x152fef,_0x3a2cb8[_0x3a4abd][_0x6c1c('0x2a')]))return;var _0x70b6c2=_0x3a2cb8[_0x3a4abd][_0x6c1c('0x2a')]===_0x6c1c('0x2e')?'Agents':_0x6c1c('0x2f');_0x29da07[_0x6c1c('0x44')](db[_0x6c1c('0x36')][_0x6c1c('0x79')]({'name':_0x3a2cb8[_0x3a4abd]['name'],'resourceId':_0x3a2cb8[_0x3a4abd]['id'],'type':_0x70b6c2,'sectionId':_['find'](_0x232e9f,[_0x6c1c('0x38'),_0x70b6c2])['id']},{}));}return BPromise[_0x6c1c('0x4d')](_0x29da07);});})['then'](respondWithResult(_0x27a9ea,0xc9))['catch'](handleError(_0x27a9ea,null));};exports[_0x6c1c('0x87')]=function(_0x3d272d,_0x13154a){if(_0x3d272d['body']['id']){delete _0x3d272d[_0x6c1c('0x5c')]['id'];}return db[_0x6c1c('0x3b')][_0x6c1c('0x35')]({'where':{'id':_0x3d272d['params']['id']}})[_0x6c1c('0x12')](function(_0x1ac1c1){if(!_0x1ac1c1)return null;if(_0x1ac1c1['id']===_0x3d272d[_0x6c1c('0x2d')]['id']){if(!_0x3d272d[_0x6c1c('0x5c')][_0x6c1c('0x88')]||!_0x3d272d[_0x6c1c('0x5c')]['newPassword']){throw new db['Sequelize'][(_0x6c1c('0x89'))](_0x6c1c('0x8a'));}if(!_0x1ac1c1['authenticate'](_0x3d272d['body'][_0x6c1c('0x88')])){throw new db[(_0x6c1c('0x8b'))][(_0x6c1c('0x89'))](_0x6c1c('0x8c'));}if(_0x3d272d[_0x6c1c('0x5c')][_0x6c1c('0x88')]===_0x3d272d[_0x6c1c('0x5c')]['newPassword']){throw new db['Sequelize'][(_0x6c1c('0x89'))](_0x6c1c('0x8d'));}}else if(_0x3d272d[_0x6c1c('0x2d')][_0x6c1c('0x2a')]===_0x6c1c('0x2b')){if(!_0x3d272d[_0x6c1c('0x5c')][_0x6c1c('0x8e')]){throw new db[(_0x6c1c('0x8b'))]['ValidationError'](_0x6c1c('0x8f'));}}else if(_0x3d272d[_0x6c1c('0x2d')][_0x6c1c('0x2a')]==='user'){if(!_0x3d272d['body'][_0x6c1c('0x8e')]){throw new db[(_0x6c1c('0x8b'))][(_0x6c1c('0x89'))](_0x6c1c('0x8f'));}if(_0x1ac1c1[_0x6c1c('0x2a')]!==_0x6c1c('0x2e')){throw new db[(_0x6c1c('0x8b'))]['ValidationError']('Unauthorized');}}else{throw new db[(_0x6c1c('0x8b'))][(_0x6c1c('0x89'))](_0x6c1c('0x90'));}return _0x1ac1c1;})[_0x6c1c('0x12')](handleEntityNotFound(_0x13154a,null))[_0x6c1c('0x12')](function(_0x1b75ed){return db[_0x6c1c('0x63')][_0x6c1c('0x91')]({'attributes':['id',_0x6c1c('0x64'),_0x6c1c('0x92'),_0x6c1c('0x93')]})[_0x6c1c('0x12')](function(_0x597350){if(_0x597350[_0x6c1c('0x64')])authService['validatePasswordPattern'](_0x3d272d['body'][_0x6c1c('0x8e')]);if(!_0x597350[_0x6c1c('0x92')]||!_0x1b75ed['previousPasswords'])return _0x1b75ed;authService[_0x6c1c('0x94')](_0x3d272d[_0x6c1c('0x5c')]['newPassword'],_0x1b75ed[_0x6c1c('0x95')],_0x597350[_0x6c1c('0x93')]);return _0x1b75ed;})[_0x6c1c('0x12')](saveUpdates({'password':_0x3d272d[_0x6c1c('0x5c')]['newPassword'],'passwordResetAt':_0x3d272d[_0x6c1c('0x2d')]['id']==_0x3d272d['params']['id']?moment():null,'previousPasswords':authService[_0x6c1c('0x96')](_0x3d272d[_0x6c1c('0x5c')][_0x6c1c('0x8e')],_0x1b75ed[_0x6c1c('0x95')])},null));})[_0x6c1c('0x12')](respondWithResult(_0x13154a,null))['catch'](handleError(_0x13154a,null));};exports[_0x6c1c('0x97')]=function(_0x20f9c5,_0x5f57e8){var _0x38770f=_0x20f9c5[_0x6c1c('0x5c')][_0x6c1c('0x98')];return db[_0x6c1c('0x3b')][_0x6c1c('0x35')]({'where':{'id':_0x20f9c5[_0x6c1c('0x5d')]['id']},'attributes':['id','name',_0x6c1c('0x2a'),_0x6c1c('0x99'),'loginInPause',_0x6c1c('0x9a'),_0x6c1c('0x9b')]})['then'](handleEntityNotFound(_0x5f57e8,null))[_0x6c1c('0x12')](function(_0x1c7dfb){if(_0x1c7dfb){if(!utils[_0x6c1c('0x9c')](_0x38770f)){throw new db[(_0x6c1c('0x8b'))][(_0x6c1c('0x89'))](_0x6c1c('0x9d'));}return _0x1c7dfb[_0x6c1c('0x9e')+_['capitalize'](_0x38770f[_0x6c1c('0x9f')]())+'Queues'](_0x20f9c5['body'][_0x6c1c('0x60')],{'penalty':_0x20f9c5[_0x6c1c('0x5c')][_0x6c1c('0xa0')]||0x0})[_0x6c1c('0xa1')](function(_0x17720e){for(var _0x456fa6=0x0;_0x456fa6<_0x20f9c5[_0x6c1c('0x5c')]['ids'][_0x6c1c('0x48')];_0x456fa6+=0x1){var _0x375e61={'UserId':Number(_0x20f9c5[_0x6c1c('0x5d')]['id'])};_0x375e61[_[_0x6c1c('0xa2')](_0x38770f[_0x6c1c('0x9f')]())+_0x6c1c('0xa3')]=Number(_0x20f9c5[_0x6c1c('0x5c')]['ids'][_0x456fa6]);socket[_0x6c1c('0xa4')](_0x6c1c('0x2d')+_[_0x6c1c('0xa2')](_0x38770f['toLowerCase']())+_0x6c1c('0xa5'),_0x375e61);}return _0x17720e;})['then'](function(){if(_0x38770f==='voice'){return db['VoiceQueue'][_0x6c1c('0x45')]({'where':{'id':_0x20f9c5['body'][_0x6c1c('0x60')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x6c1c('0x12')](function(_0x22419a){var _0x4ab385=_0x1c7dfb['get']({'plain':!![]});var _0x46b8e1=[];if(_0x38770f===_0x6c1c('0xa6')&&_0x4ab385[_0x6c1c('0x2a')]===_0x6c1c('0x2e')&&_0x4ab385[_0x6c1c('0x99')]){for(var _0x338919=0x0;_0x338919<_0x22419a['length'];_0x338919+=0x1){_0x46b8e1[_0x6c1c('0x44')]({'membername':_0x4ab385[_0x6c1c('0x38')],'UserId':_0x4ab385['id'],'queue_name':_0x22419a[_0x338919]['name'],'VoiceQueueId':_0x22419a[_0x338919]['id'],'interface':_['isNil'](_0x4ab385['interface'])?util[_0x6c1c('0xa7')](_0x6c1c('0xa8'),_0x4ab385['name']):_0x4ab385[_0x6c1c('0x9b')],'paused':_0x4ab385[_0x6c1c('0x9a')]||![],'penalty':_0x20f9c5[_0x6c1c('0x5c')][_0x6c1c('0xa0')]||0x0});}return BPromise[_0x6c1c('0x83')](_0x46b8e1,function(_0x48ad83){return db[_0x6c1c('0xa9')][_0x6c1c('0xaa')](_0x48ad83);});}return _0x1c7dfb;});}})[_0x6c1c('0x12')](respondWithStatusCode(_0x5f57e8,null))[_0x6c1c('0x1d')](handleError(_0x5f57e8,null));};exports['removeQueues']=function(_0x32028b,_0x270f01){var _0x1df0fb;return db[_0x6c1c('0x3b')]['find']({'where':{'id':_0x32028b[_0x6c1c('0x5d')]['id']},'attributes':['id',_0x6c1c('0x38'),'role']})[_0x6c1c('0x12')](handleEntityNotFound(_0x270f01,null))[_0x6c1c('0x12')](function(_0x4e71ac){if(_0x4e71ac){_0x1df0fb=_0x4e71ac;if(!_0x32028b[_0x6c1c('0x41')][_0x6c1c('0x98')]||!utils[_0x6c1c('0x9c')](_0x32028b['query']['channel'])){throw new db['Sequelize'][(_0x6c1c('0x89'))](_0x6c1c('0x9d'));}return _0x4e71ac[_0x6c1c('0xab')+_['capitalize'](_0x32028b['query'][_0x6c1c('0x98')][_0x6c1c('0x9f')]())+'Queues'](_0x32028b['query'][_0x6c1c('0x60')]);}})[_0x6c1c('0x12')](function(_0x5d4003){if(_['isArray'](_0x32028b[_0x6c1c('0x41')][_0x6c1c('0x60')])){for(var _0x5eedbf=0x0;_0x5eedbf<_0x32028b['query']['ids'][_0x6c1c('0x48')];_0x5eedbf+=0x1){var _0x31bcbe={'UserId':Number(_0x32028b['params']['id'])};_0x31bcbe[_['capitalize'](_0x32028b['query'][_0x6c1c('0x98')][_0x6c1c('0x9f')]())+_0x6c1c('0xa3')]=Number(_0x32028b[_0x6c1c('0x41')][_0x6c1c('0x60')][_0x5eedbf]);socket[_0x6c1c('0xa4')]('user'+_[_0x6c1c('0xa2')](_0x32028b['query'][_0x6c1c('0x98')][_0x6c1c('0x9f')]())+_0x6c1c('0xac'),_0x31bcbe);}}else{var _0x31bcbe={'UserId':Number(_0x32028b[_0x6c1c('0x5d')]['id'])};_0x31bcbe[_[_0x6c1c('0xa2')](_0x32028b[_0x6c1c('0x41')][_0x6c1c('0x98')]['toLowerCase']())+_0x6c1c('0xa3')]=Number(_0x32028b[_0x6c1c('0x41')]['ids']);socket['emit'](_0x6c1c('0x2d')+_[_0x6c1c('0xa2')](_0x32028b[_0x6c1c('0x41')][_0x6c1c('0x98')][_0x6c1c('0x9f')]())+_0x6c1c('0xac'),_0x31bcbe);}return _0x5d4003;})['then'](function(){if(_0x32028b['query']['channel']===_0x6c1c('0xa6')){return db['UserVoiceQueueRt'][_0x6c1c('0x28')]({'where':{'UserId':_0x32028b[_0x6c1c('0x5d')]['id'],'VoiceQueueId':_0x32028b['query'][_0x6c1c('0x60')]},'individualHooks':!![]})['then'](function(){return _0x1df0fb;});}return _0x1df0fb;})['then'](respondWithStatusCode(_0x270f01,null))[_0x6c1c('0x1d')](handleError(_0x270f01,null));};exports[_0x6c1c('0xad')]=function(_0x11ca6a,_0x25879e){_0x11ca6a[_0x6c1c('0x5c')][_0x6c1c('0xae')]=_0x11ca6a[_0x6c1c('0xaf')]['filename'];return db[_0x6c1c('0x3b')][_0x6c1c('0x35')]({'where':{'id':_0x11ca6a[_0x6c1c('0x5d')]['id']}})[_0x6c1c('0x12')](handleEntityNotFound(_0x25879e,null))[_0x6c1c('0x12')](saveUpdates(_0x11ca6a[_0x6c1c('0x5c')],null))[_0x6c1c('0x12')](respondWithResult(_0x25879e,null))[_0x6c1c('0x1d')](handleError(_0x25879e,null));};exports[_0x6c1c('0xb0')]=function(_0x1e288e,_0x2ea532){var _0x59a052=path['join'](config[_0x6c1c('0xb1')],'server/files/images/logos/default_profile.png');return db[_0x6c1c('0x3b')][_0x6c1c('0x35')]({'where':{'id':_0x1e288e[_0x6c1c('0x5d')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x6c1c('0x12')](handleEntityNotFound(_0x2ea532,null))['then'](function(_0x611bd6){if(_0x611bd6){if(_[_0x6c1c('0x67')](_0x611bd6[_0x6c1c('0xae')])){return _0x2ea532[_0x6c1c('0xb2')](_0x59a052);}else{if(!fs[_0x6c1c('0xb3')](path['join'](config['root'],'server/files/images/',_0x611bd6['userpic']))){return _0x2ea532[_0x6c1c('0xb2')](_0x59a052);}return _0x2ea532[_0x6c1c('0xb2')](path[_0x6c1c('0xb4')](config[_0x6c1c('0xb1')],'server/files/images/',_0x611bd6[_0x6c1c('0xae')]));}}})['catch'](handleError(_0x2ea532,null));};exports['getOpenTabs']=function(_0x4012c4,_0x1f65aa){return db['User'][_0x6c1c('0x35')]({'where':{'id':_0x4012c4[_0x6c1c('0x5d')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x1f65aa,null))[_0x6c1c('0x12')](function(_0x4d3198){var _0x5ddb1a=[];values=_0x4d3198['dataValues'];_0x5ddb1a[_0x6c1c('0x44')](get_open_tabs('chat',_0x4d3198['dataValues']));_0x5ddb1a[_0x6c1c('0x44')](get_open_tabs(_0x6c1c('0xb5'),_0x4d3198[_0x6c1c('0x49')]));_0x5ddb1a[_0x6c1c('0x44')](get_open_tabs(_0x6c1c('0x5b'),_0x4d3198['dataValues']));_0x5ddb1a['push'](get_open_tabs(_0x6c1c('0x4c'),_0x4d3198['dataValues']));_0x5ddb1a[_0x6c1c('0x44')](get_open_tabs(_0x6c1c('0x4a'),_0x4d3198[_0x6c1c('0x49')]));_0x5ddb1a[_0x6c1c('0x44')](get_open_tabs('mail',_0x4d3198[_0x6c1c('0x49')]));return BPromise[_0x6c1c('0x4d')](_0x5ddb1a);})[_0x6c1c('0x12')](function(_0x3405e1){var _0x327bd4=[];if(_0x3405e1){for(var _0x154412=0x0;_0x154412=_0x30972b[_0xa492('0x56')]){throw new Error(_0xa492('0x57'));}})[_0xa492('0x13')](function(){if(_0x48947b){return db[_0xa492('0x4a')][_0xa492('0x4e')]({'where':{'membername':_0x48947b[_0xa492('0x2d')]},'individualHooks':!![]});}})[_0xa492('0x13')](function(){if(_0x48947b){return _0x48947b[_0xa492('0x58')]({'raw':!![]});}})['then'](function(_0x25c039){if(_0x48947b){if(_0x25c039){var _0x2c4004=[];_0x292351=_0x25c039;if(_0x292351[_0xa492('0x32')]){for(var _0x35e251=0x0;_0x35e251<_0x292351[_0xa492('0x32')];_0x35e251++){_0x2c4004[_0xa492('0x37')](db[_0xa492('0x4a')]['upsert']({'membername':_0x48947b['name'],'UserId':_0x48947b['id'],'queue_name':_0x292351[_0x35e251][_0xa492('0x2d')],'VoiceQueueId':_0x292351[_0x35e251]['id'],'interface':_0x180150,'paused':_0x48947b['loginInPause']||![],'penalty':_0x292351[_0x35e251][_0xa492('0x59')]||0x0}));}return BPromise[_0xa492('0x4b')](_0x2c4004);}}}})[_0xa492('0x13')](function(){if(_0x48947b){return db[_0xa492('0x31')][_0xa492('0x20')]({'where':{'membername':_0x48947b['name'],'exitAt':null}});}})[_0xa492('0x13')](function(_0x2efb8f){if(_0x48947b){if(_0x2efb8f&&_0x2efb8f[_0xa492('0x32')]){var _0x1940e4=[];_0x2efb8f[_0xa492('0x36')](function(_0x1cbc83){_0x1940e4[_0xa492('0x37')](_0x1cbc83[_0xa492('0x30')]({'exitAt':moment()[_0xa492('0x39')](_0xa492('0x33'))}));});return BPromise[_0xa492('0x4b')](_0x1940e4);}}})[_0xa492('0x13')](function(_0x96e2d2){if(_0x48947b){var _0x383ef3=[];var _0x24c085=[];var _0x82e782=utils['getChannels']();var _0x35547d={'membername':_0x48947b[_0xa492('0x2d')],'interface':_0x180150,'enterAt':moment()[_0xa492('0x39')](_0xa492('0x33')),'role':_0x48947b[_0xa492('0x3e')],'internal':_0x48947b['internal']};_0x82e782[_0xa492('0x36')](function(_0x34db30){_0x383ef3['push'](_[_0xa492('0x5a')]({'channel':_0x34db30,'type':_0xa492('0x5b'),'data1':_0xa492('0x5c'),'data2':_0x180150},_0x35547d));if(_0x48947b['loginInPause']){_0x24c085['push'](_[_0xa492('0x5a')]({'channel':_0x34db30,'type':_0xa492('0x3b'),'data1':_0xa492('0x5d')},_0x35547d));}});return db['MemberReport'][_0xa492('0x3f')](_0x383ef3['concat'](_0x24c085),{'individualHooks':!![]});}})[_0xa492('0x13')](function(){if(_0x48947b){return _0x48947b[_0xa492('0x30')]({'online':!![],'lastLoginAt':moment()[_0xa492('0x39')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x48947b['loginInPause']||![],'mailPause':_0x48947b[_0xa492('0x52')]||![],'chatPause':_0x48947b[_0xa492('0x52')]||![],'faxPause':_0x48947b[_0xa492('0x52')]||![],'smsPause':_0x48947b[_0xa492('0x52')]||![],'openchannelPause':_0x48947b[_0xa492('0x52')]||![],'pauseType':_0x48947b['loginInPause']?_0xa492('0x5d'):null,'lastPauseAt':moment()['format'](_0xa492('0x33')),'interface':_0x180150});}})[_0xa492('0x13')](function(_0x3500a7){_0x6d8c71(_0x3500a7);})[_0xa492('0x1e')](function(_0x258744){_0x5015ee(_0x306747[_0xa492('0x1a')](0x1f4,_0x258744[_0xa492('0x1c')]));});});}; \ No newline at end of file +var _0x8cde=['raw','attributes','limit','include','map','model','GetUser','ShowUser','where','debug','PauseUser','find','name','role','internal','interface','UserVoiceQueueRt','update','MemberReport','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','SIP/%s','body','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','UnpauseUser','findOne','channel','isValidChannel','Unknown\x20channel','voice','mail','chat','fax','openchannel','system','%s%s','Pause','forEach','push','all','LogoutUser','destroy','phone','loginInPause','agent','../../config/license/util','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','concat','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./user.socket','register','then','info','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','User,\x20%s,\x20%s','result','catch','User','findAll','options'];(function(_0x4ac90a,_0xbda41c){var _0x2103d0=function(_0x81639){while(--_0x81639){_0x4ac90a['push'](_0x4ac90a['shift']());}};_0x2103d0(++_0xbda41c);}(_0x8cde,0x1ad));var _0xe8cd=function(_0x4cbf20,_0x1bfa66){_0x4cbf20=_0x4cbf20-0x0;var _0x582ae4=_0x8cde[_0x4cbf20];return _0x582ae4;};'use strict';var _=require(_0xe8cd('0x0'));var util=require(_0xe8cd('0x1'));var moment=require(_0xe8cd('0x2'));var BPromise=require(_0xe8cd('0x3'));var rs=require(_0xe8cd('0x4'));var fs=require('fs');var Redis=require(_0xe8cd('0x5'));var db=require(_0xe8cd('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe8cd('0x7'))(_0xe8cd('0x8'));var config=require(_0xe8cd('0x9'));var jayson=require(_0xe8cd('0xa'));var client=jayson[_0xe8cd('0xb')][_0xe8cd('0xc')]({'port':0x232a});config[_0xe8cd('0xd')]=_[_0xe8cd('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe8cd('0xd')]));require(_0xe8cd('0xf'))[_0xe8cd('0x10')](socket);function respondWithRpcPromise(_0x150711,_0x2b8bb4,_0x483c89){return new BPromise(function(_0x1ef602,_0x450c79){return client['request'](_0x150711,_0x483c89)[_0xe8cd('0x11')](function(_0x3928c0){logger[_0xe8cd('0x12')]('User,\x20%s,\x20%s',_0x2b8bb4,'request\x20sent');logger['debug'](_0xe8cd('0x13'),_0x2b8bb4,_0xe8cd('0x14'),JSON[_0xe8cd('0x15')](_0x3928c0));if(_0x3928c0[_0xe8cd('0x16')]){if(_0x3928c0['error'][_0xe8cd('0x17')]===0x1f4){logger[_0xe8cd('0x16')]('User,\x20%s,\x20%s',_0x2b8bb4,_0x3928c0['error'][_0xe8cd('0x18')]);return _0x450c79(_0x3928c0[_0xe8cd('0x16')]['message']);}logger[_0xe8cd('0x16')](_0xe8cd('0x19'),_0x2b8bb4,_0x3928c0[_0xe8cd('0x16')][_0xe8cd('0x18')]);return _0x1ef602(_0x3928c0[_0xe8cd('0x16')][_0xe8cd('0x18')]);}else{logger[_0xe8cd('0x12')]('User,\x20%s,\x20%s',_0x2b8bb4,'request\x20sent');_0x1ef602(_0x3928c0[_0xe8cd('0x1a')][_0xe8cd('0x18')]);}})[_0xe8cd('0x1b')](function(_0x58d03a){logger[_0xe8cd('0x16')]('User,\x20%s,\x20%s',_0x2b8bb4,_0x58d03a);_0x450c79(_0x58d03a);});});}exports['GetUser']=function(_0x56f2a2){var _0x13dd99=this;return new Promise(function(_0x4aacff,_0x548415){return db[_0xe8cd('0x1c')][_0xe8cd('0x1d')]({'raw':_0x56f2a2[_0xe8cd('0x1e')]?_0x56f2a2[_0xe8cd('0x1e')][_0xe8cd('0x1f')]===undefined?!![]:![]:!![],'where':_0x56f2a2[_0xe8cd('0x1e')]?_0x56f2a2[_0xe8cd('0x1e')]['where']||null:null,'attributes':_0x56f2a2[_0xe8cd('0x1e')]?_0x56f2a2['options'][_0xe8cd('0x20')]||null:null,'limit':_0x56f2a2[_0xe8cd('0x1e')]?_0x56f2a2[_0xe8cd('0x1e')][_0xe8cd('0x21')]||null:null,'include':_0x56f2a2[_0xe8cd('0x1e')]?_0x56f2a2['options'][_0xe8cd('0x22')]?_[_0xe8cd('0x23')](_0x56f2a2['options']['include'],function(_0x576a43){return{'model':db[_0x576a43['model']],'as':_0x576a43['as'],'attributes':_0x576a43[_0xe8cd('0x20')],'include':_0x576a43[_0xe8cd('0x22')]?_[_0xe8cd('0x23')](_0x576a43[_0xe8cd('0x22')],function(_0x294bb2){return{'model':db[_0x294bb2[_0xe8cd('0x24')]],'as':_0x294bb2['as'],'attributes':_0x294bb2[_0xe8cd('0x20')],'include':_0x294bb2[_0xe8cd('0x22')]?_[_0xe8cd('0x23')](_0x294bb2[_0xe8cd('0x22')],function(_0x46fd92){return{'model':db[_0x46fd92[_0xe8cd('0x24')]],'as':_0x46fd92['as'],'attributes':_0x46fd92[_0xe8cd('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x386ce3){logger[_0xe8cd('0x12')]('GetUser',_0x56f2a2);logger['debug'](_0xe8cd('0x25'),_0x56f2a2,JSON[_0xe8cd('0x15')](_0x386ce3));_0x4aacff(_0x386ce3);})[_0xe8cd('0x1b')](function(_0x29ccce){logger['error'](_0xe8cd('0x25'),_0x29ccce['message'],_0x56f2a2);_0x548415(_0x13dd99[_0xe8cd('0x16')](0x1f4,_0x29ccce[_0xe8cd('0x18')]));});});};exports[_0xe8cd('0x26')]=function(_0x50197f){var _0x8e3d3b=this;return new Promise(function(_0x2558e9,_0x45a3a0){return db[_0xe8cd('0x1c')]['find']({'raw':_0x50197f[_0xe8cd('0x1e')]?_0x50197f[_0xe8cd('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x50197f[_0xe8cd('0x1e')]?_0x50197f[_0xe8cd('0x1e')][_0xe8cd('0x27')]||null:null,'attributes':_0x50197f['options']?_0x50197f[_0xe8cd('0x1e')][_0xe8cd('0x20')]||null:null,'include':_0x50197f[_0xe8cd('0x1e')]?_0x50197f[_0xe8cd('0x1e')]['include']?_[_0xe8cd('0x23')](_0x50197f['options'][_0xe8cd('0x22')],function(_0x2b758d){return{'model':db[_0x2b758d[_0xe8cd('0x24')]],'as':_0x2b758d['as'],'attributes':_0x2b758d[_0xe8cd('0x20')],'include':_0x2b758d[_0xe8cd('0x22')]?_['map'](_0x2b758d[_0xe8cd('0x22')],function(_0x2711a8){return{'model':db[_0x2711a8[_0xe8cd('0x24')]],'as':_0x2711a8['as'],'attributes':_0x2711a8[_0xe8cd('0x20')],'include':_0x2711a8[_0xe8cd('0x22')]?_['map'](_0x2711a8[_0xe8cd('0x22')],function(_0x35dfcc){return{'model':db[_0x35dfcc[_0xe8cd('0x24')]],'as':_0x35dfcc['as'],'attributes':_0x35dfcc[_0xe8cd('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe8cd('0x11')](function(_0x1f0bdc){logger[_0xe8cd('0x12')](_0xe8cd('0x26'),_0x50197f);logger[_0xe8cd('0x28')](_0xe8cd('0x26'),_0x50197f,JSON[_0xe8cd('0x15')](_0x1f0bdc));_0x2558e9(_0x1f0bdc);})[_0xe8cd('0x1b')](function(_0x2b7fee){logger[_0xe8cd('0x16')](_0xe8cd('0x26'),_0x2b7fee['message'],_0x50197f);_0x45a3a0(_0x8e3d3b[_0xe8cd('0x16')](0x1f4,_0x2b7fee[_0xe8cd('0x18')]));});});};exports[_0xe8cd('0x29')]=function(_0x21b19d){var _0x4dd195=this;return new Promise(function(_0x1fc7d9,_0x318387){var _0x54262f;return db[_0xe8cd('0x1c')][_0xe8cd('0x2a')]({'where':_0x21b19d[_0xe8cd('0x1e')][_0xe8cd('0x27')]||{},'attributes':['id',_0xe8cd('0x2b'),_0xe8cd('0x2c'),_0xe8cd('0x2d'),_0xe8cd('0x2e')]})['then'](function(_0x13e82f){if(_0x13e82f){_0x54262f=_0x13e82f;return db[_0xe8cd('0x2f')][_0xe8cd('0x30')]({'paused':0x1},{'where':{'UserId':_0x54262f['id']},'individualHooks':!![]});}})[_0xe8cd('0x11')](function(){if(_0x54262f){return db[_0xe8cd('0x31')][_0xe8cd('0x1d')]({'where':{'membername':_0x54262f[_0xe8cd('0x2b')],'type':_0xe8cd('0x32'),'exitAt':null}});}})[_0xe8cd('0x11')](function(_0xc63149){if(_0x54262f){if(_0xc63149&&_0xc63149[_0xe8cd('0x33')]){var _0x19dd38=moment()[_0xe8cd('0x34')](_0xe8cd('0x35'));for(var _0x4b1c29=0x0,_0x192328=_0xc63149[_0xe8cd('0x33')];_0x4b1c29<_0x192328;_0x4b1c29++){_0xc63149[_0x4b1c29][_0xe8cd('0x36')]({'exitAt':_0x19dd38});}}}})['then'](function(){if(_0x54262f){var _0x3851e5=[];var _0x255bdd=utils[_0xe8cd('0x37')]();_0x255bdd['forEach'](function(_0x2ac6e0){_0x3851e5['push']({'channel':_0x2ac6e0,'membername':_0x54262f[_0xe8cd('0x2b')],'interface':_['isNil'](_0x54262f[_0xe8cd('0x2e')])?util[_0xe8cd('0x34')](_0xe8cd('0x38'),_0x54262f[_0xe8cd('0x2b')]):_0x54262f[_0xe8cd('0x2e')],'type':_0xe8cd('0x32'),'enterAt':moment()['format'](_0xe8cd('0x35')),'data1':_0x21b19d[_0xe8cd('0x39')][_0xe8cd('0x3a')]||_0xe8cd('0x3b'),'role':_0x54262f[_0xe8cd('0x2c')],'internal':_0x54262f[_0xe8cd('0x2d')],'uniqueid':_0x21b19d[_0xe8cd('0x39')][_0xe8cd('0x3c')]||null});});return db[_0xe8cd('0x31')][_0xe8cd('0x3d')](_0x3851e5,{'individualHooks':!![]});}})[_0xe8cd('0x11')](function(){if(_0x54262f){return _0x54262f['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x21b19d[_0xe8cd('0x39')]['type']||_0xe8cd('0x3b'),'lastPauseAt':moment()[_0xe8cd('0x34')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xe8cd('0x11')](function(_0x25083d){_0x1fc7d9(_0x25083d);})[_0xe8cd('0x1b')](function(_0x5eb1f0){_0x318387(_0x4dd195[_0xe8cd('0x16')](0x1f4,_0x5eb1f0[_0xe8cd('0x18')]));});});};exports[_0xe8cd('0x3e')]=function(_0x46ea43){var _0x393055=this;return new Promise(function(_0x3b4e0b,_0x563b21){var _0x3e2a00;return db[_0xe8cd('0x1c')][_0xe8cd('0x3f')]({'where':_0x46ea43['options'][_0xe8cd('0x27')]||{},'attributes':['id',_0xe8cd('0x2b')]})['then'](function(_0x409061){if(_0x409061){_0x3e2a00=_0x409061;if(_0x46ea43[_0xe8cd('0x39')][_0xe8cd('0x40')]&&!utils[_0xe8cd('0x41')](_0x46ea43[_0xe8cd('0x39')]['channel'])){throw new Error(_0xe8cd('0x42'));}switch(_0x46ea43[_0xe8cd('0x39')][_0xe8cd('0x40')]){case _0xe8cd('0x43'):return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x3e2a00['id']}})[_0xe8cd('0x11')](function(){return db[_0xe8cd('0x31')][_0xe8cd('0x2a')]({'where':{'channel':_0x46ea43[_0xe8cd('0x39')]['channel'],'membername':_0x3e2a00[_0xe8cd('0x2b')],'type':_0xe8cd('0x32'),'exitAt':null}});})['then'](function(_0x758fbc){if(_0x758fbc){return _0x758fbc['update']({'exitAt':moment()[_0xe8cd('0x34')](_0xe8cd('0x35')),'data2':'system'},{'individualHooks':!![]});}return null;})['then'](function(){return _0x3e2a00[_0xe8cd('0x30')]({'voicePause':![]});});case _0xe8cd('0x44'):case _0xe8cd('0x45'):case _0xe8cd('0x46'):case'sms':case _0xe8cd('0x47'):case'whatsapp':return db[_0xe8cd('0x31')][_0xe8cd('0x2a')]({'where':{'channel':_0x46ea43[_0xe8cd('0x39')][_0xe8cd('0x40')],'membername':_0x3e2a00[_0xe8cd('0x2b')],'type':'PAUSE','exitAt':null}})[_0xe8cd('0x11')](function(_0x57a9b0){return _0x57a9b0[_0xe8cd('0x30')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xe8cd('0x48')},{'individualHooks':!![]});})[_0xe8cd('0x11')](function(){var _0x55913a={};_['set'](_0x55913a,util['format'](_0xe8cd('0x49'),_0x46ea43['body'][_0xe8cd('0x40')],_0xe8cd('0x4a')),![]);return _0x3e2a00[_0xe8cd('0x30')](_0x55913a);});default:return db[_0xe8cd('0x2f')][_0xe8cd('0x30')]({'paused':0x0},{'where':{'UserId':_0x3e2a00['id']}})[_0xe8cd('0x11')](function(){return db['MemberReport'][_0xe8cd('0x1d')]({'where':{'membername':_0x3e2a00[_0xe8cd('0x2b')],'type':_0xe8cd('0x32'),'exitAt':null}});})[_0xe8cd('0x11')](function(_0x2e3cdb){var _0x23ad61=[];_0x2e3cdb[_0xe8cd('0x4b')](function(_0x1dd120){_0x23ad61[_0xe8cd('0x4c')](_0x1dd120['update']({'exitAt':moment()[_0xe8cd('0x34')](_0xe8cd('0x35')),'data2':_0xe8cd('0x48')}));});return BPromise[_0xe8cd('0x4d')](_0x23ad61);})[_0xe8cd('0x11')](function(){return _0x3e2a00[_0xe8cd('0x30')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0xe8cd('0x11')](function(_0x1717e6){_0x3b4e0b(_0x1717e6);})[_0xe8cd('0x1b')](function(_0x5ee4fa){_0x563b21(_0x393055[_0xe8cd('0x16')](0x1f4,_0x5ee4fa[_0xe8cd('0x18')]));});});};exports[_0xe8cd('0x4e')]=function(_0x218b44){var _0x133222=this;return new Promise(function(_0xba1db4,_0x2f9961){var _0x20e987;return db['User'][_0xe8cd('0x3f')]({'where':_0x218b44['options'][_0xe8cd('0x27')]||{},'attributes':['id',_0xe8cd('0x2b')]})['then'](function(_0x1c14eb){if(_0x1c14eb){_0x20e987=_0x1c14eb;return db[_0xe8cd('0x2f')][_0xe8cd('0x4f')]({'where':{'membername':_0x20e987[_0xe8cd('0x2b')]},'individualHooks':!![]});}})[_0xe8cd('0x11')](function(){if(_0x20e987){return db[_0xe8cd('0x31')][_0xe8cd('0x1d')]({'where':{'membername':_0x20e987[_0xe8cd('0x2b')],'exitAt':null}});}})[_0xe8cd('0x11')](function(_0x569ab3){if(_0x20e987){if(_0x569ab3&&_0x569ab3[_0xe8cd('0x33')]){var _0x4b39b1=[];_0x569ab3[_0xe8cd('0x4b')](function(_0x1ec690){_0x4b39b1[_0xe8cd('0x4c')](_0x1ec690[_0xe8cd('0x30')]({'exitAt':moment()[_0xe8cd('0x34')](_0xe8cd('0x35'))}));});return BPromise[_0xe8cd('0x4d')](_0x4b39b1);}}})[_0xe8cd('0x11')](function(){if(_0x20e987){return _0x20e987['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0xaa5cdb){_0xba1db4(_0xaa5cdb);})['catch'](function(_0x28e6a6){_0x2f9961(_0x133222['error'](0x1f4,_0x28e6a6[_0xe8cd('0x18')]));});});};exports['LoginUser']=function(_0x2f3cbd){var _0x3112aa=this;return new Promise(function(_0x56e510,_0x43da2f){var _0x4d7a4b;var _0x1736bd;var _0x39a597;var _0x5d113e;return db['User'][_0xe8cd('0x3f')]({'where':_0x2f3cbd[_0xe8cd('0x1e')]['where']||{},'attributes':['id',_0xe8cd('0x2b'),'role','mobile',_0xe8cd('0x50'),_0xe8cd('0x2d'),_0xe8cd('0x51'),_0xe8cd('0x2e')]})[_0xe8cd('0x11')](function(_0x271443){if(_0x271443){_0x4d7a4b=_0x271443;_0x5d113e=_0x2f3cbd[_0xe8cd('0x39')][_0xe8cd('0x2e')]?_0x2f3cbd[_0xe8cd('0x39')]['interface']:util['format'](_0xe8cd('0x38'),_0x4d7a4b['name']);return db[_0xe8cd('0x1c')]['count']({'where':{'role':_0xe8cd('0x52'),'online':!![],'id':{'$ne':_0x4d7a4b['id']}}});}})[_0xe8cd('0x11')](function(_0x36ff4a){if(_0x36ff4a){_0x39a597=_0x36ff4a;return require(_0xe8cd('0x53'))['getLicense']();}})['then'](function(_0x198481){if(_0x198481&&_0x198481['agents']&&_0x39a597>=_0x198481[_0xe8cd('0x54')]){throw new Error(_0xe8cd('0x55'));}})[_0xe8cd('0x11')](function(){if(_0x4d7a4b){return db['UserVoiceQueueRt'][_0xe8cd('0x4f')]({'where':{'membername':_0x4d7a4b[_0xe8cd('0x2b')]},'individualHooks':!![]});}})['then'](function(){if(_0x4d7a4b){return _0x4d7a4b[_0xe8cd('0x56')]({'raw':!![]});}})[_0xe8cd('0x11')](function(_0x44cf3b){if(_0x4d7a4b){if(_0x44cf3b){var _0x2219b5=[];_0x1736bd=_0x44cf3b;if(_0x1736bd[_0xe8cd('0x33')]){for(var _0x147c90=0x0;_0x147c90<_0x1736bd[_0xe8cd('0x33')];_0x147c90++){_0x2219b5[_0xe8cd('0x4c')](db['UserVoiceQueueRt'][_0xe8cd('0x57')]({'membername':_0x4d7a4b['name'],'UserId':_0x4d7a4b['id'],'queue_name':_0x1736bd[_0x147c90][_0xe8cd('0x2b')],'VoiceQueueId':_0x1736bd[_0x147c90]['id'],'interface':_0x5d113e,'paused':_0x4d7a4b[_0xe8cd('0x51')]||![],'penalty':_0x1736bd[_0x147c90][_0xe8cd('0x58')]||0x0}));}return BPromise[_0xe8cd('0x4d')](_0x2219b5);}}}})['then'](function(){if(_0x4d7a4b){return db[_0xe8cd('0x31')]['findAll']({'where':{'membername':_0x4d7a4b[_0xe8cd('0x2b')],'exitAt':null}});}})['then'](function(_0x578fe8){if(_0x4d7a4b){if(_0x578fe8&&_0x578fe8['length']){var _0x5c4c40=[];_0x578fe8[_0xe8cd('0x4b')](function(_0x23b5d8){_0x5c4c40[_0xe8cd('0x4c')](_0x23b5d8['update']({'exitAt':moment()[_0xe8cd('0x34')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xe8cd('0x4d')](_0x5c4c40);}}})['then'](function(_0x4258f7){if(_0x4d7a4b){var _0x16e3c7=[];var _0x251f89=[];var _0x3c395a=utils[_0xe8cd('0x37')]();var _0x511505={'membername':_0x4d7a4b[_0xe8cd('0x2b')],'interface':_0x5d113e,'enterAt':moment()[_0xe8cd('0x34')](_0xe8cd('0x35')),'role':_0x4d7a4b[_0xe8cd('0x2c')],'internal':_0x4d7a4b[_0xe8cd('0x2d')]};_0x3c395a['forEach'](function(_0x1d23f8){_0x16e3c7[_0xe8cd('0x4c')](_[_0xe8cd('0x59')]({'channel':_0x1d23f8,'type':_0xe8cd('0x5a'),'data1':'callysquare','data2':_0x5d113e},_0x511505));if(_0x4d7a4b[_0xe8cd('0x51')]){_0x251f89[_0xe8cd('0x4c')](_[_0xe8cd('0x59')]({'channel':_0x1d23f8,'type':_0xe8cd('0x32'),'data1':'LOGININPAUSE'},_0x511505));}});return db[_0xe8cd('0x31')][_0xe8cd('0x3d')](_0x16e3c7[_0xe8cd('0x5b')](_0x251f89),{'individualHooks':!![]});}})[_0xe8cd('0x11')](function(){if(_0x4d7a4b){return _0x4d7a4b[_0xe8cd('0x30')]({'online':!![],'lastLoginAt':moment()[_0xe8cd('0x34')](_0xe8cd('0x35')),'voicePause':_0x4d7a4b['loginInPause']||![],'mailPause':_0x4d7a4b['loginInPause']||![],'chatPause':_0x4d7a4b[_0xe8cd('0x51')]||![],'faxPause':_0x4d7a4b[_0xe8cd('0x51')]||![],'smsPause':_0x4d7a4b[_0xe8cd('0x51')]||![],'openchannelPause':_0x4d7a4b[_0xe8cd('0x51')]||![],'pauseType':_0x4d7a4b['loginInPause']?'LOGININPAUSE':null,'lastPauseAt':moment()[_0xe8cd('0x34')](_0xe8cd('0x35')),'interface':_0x5d113e});}})[_0xe8cd('0x11')](function(_0x4234f7){_0x56e510(_0x4234f7);})[_0xe8cd('0x1b')](function(_0x43e5ee){_0x43da2f(_0x3112aa[_0xe8cd('0x16')](0x1f4,_0x43e5ee[_0xe8cd('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 0d9085b..828304d 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 _0x6675=['./user.events','save','remove','emit','removeListener','register','length','user:'];(function(_0x54b03a,_0x7e31af){var _0x3f4388=function(_0x451e6d){while(--_0x451e6d){_0x54b03a['push'](_0x54b03a['shift']());}};_0x3f4388(++_0x7e31af);}(_0x6675,0x130));var _0x5667=function(_0x2b4575,_0x398753){_0x2b4575=_0x2b4575-0x0;var _0x30ad1c=_0x6675[_0x2b4575];return _0x30ad1c;};'use strict';var UserEvents=require(_0x5667('0x0'));var events=[_0x5667('0x1'),_0x5667('0x2'),'update'];function createListener(_0x55e53b,_0x5df881){return function(_0x4e3946){_0x5df881[_0x5667('0x3')](_0x55e53b,_0x4e3946);};}function removeListener(_0x50ad36,_0x490448){return function(){UserEvents[_0x5667('0x4')](_0x50ad36,_0x490448);};}exports[_0x5667('0x5')]=function(_0x69af2c){for(var _0x2f432f=0x0,_0x2e607f=events[_0x5667('0x6')];_0x2f432f<_0x2e607f;_0x2f432f++){var _0x4eb341=events[_0x2f432f];var _0x4caac5=createListener(_0x5667('0x7')+_0x4eb341,_0x69af2c);UserEvents['on'](_0x4eb341,_0x4caac5);}}; \ No newline at end of file +var _0x5bc2=['save','update','emit','removeListener','register','user:','./user.events'];(function(_0x3a980f,_0x49e4d6){var _0x36010f=function(_0x2835e6){while(--_0x2835e6){_0x3a980f['push'](_0x3a980f['shift']());}};_0x36010f(++_0x49e4d6);}(_0x5bc2,0xbc));var _0x25bc=function(_0x5bf420,_0x2d068d){_0x5bf420=_0x5bf420-0x0;var _0x1c5255=_0x5bc2[_0x5bf420];return _0x1c5255;};'use strict';var UserEvents=require(_0x25bc('0x0'));var events=[_0x25bc('0x1'),'remove',_0x25bc('0x2')];function createListener(_0x2044b9,_0x5ca1a7){return function(_0x46e1a8){_0x5ca1a7[_0x25bc('0x3')](_0x2044b9,_0x46e1a8);};}function removeListener(_0x5a711d,_0x9281e0){return function(){UserEvents[_0x25bc('0x4')](_0x5a711d,_0x9281e0);};}exports[_0x25bc('0x5')]=function(_0x156f9d){for(var _0x3ebf0e=0x0,_0x271b6a=events['length'];_0x3ebf0e<_0x271b6a;_0x3ebf0e++){var _0x9aa8f7=events[_0x3ebf0e];var _0x664ec2=createListener(_0x25bc('0x6')+_0x9aa8f7,_0x156f9d);UserEvents['on'](_0x9aa8f7,_0x664ec2);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 4bf0df5..82fd46f 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2562c6,_0x5e6df4){var _0x50f5e6=function(_0x20a555){while(--_0x20a555){_0x2562c6['push'](_0x2562c6['shift']());}};_0x50f5e6(++_0x5e6df4);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x45967a,_0x474c44){var _0xf97e90=function(_0x207c36){while(--_0x207c36){_0x45967a['push'](_0x45967a['shift']());}};_0xf97e90(++_0x474c44);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 48d9fc5..31da538 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 _0x18b8=['sequelize','exports','INTEGER'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x18b8,0x10e));var _0x818b=function(_0x3d35cf,_0x4b13b2){_0x3d35cf=_0x3d35cf-0x0;var _0x323c68=_0x18b8[_0x3d35cf];return _0x323c68;};'use strict';var Sequelize=require(_0x818b('0x0'));module[_0x818b('0x1')]={'penalty':{'type':Sequelize[_0x818b('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa85f=['exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa85f,0x144));var _0xfa85=function(_0x5a613e,_0x2849a5){_0x5a613e=_0x5a613e-0x0;var _0x249732=_0xa85f[_0x5a613e];return _0x249732;};'use strict';var Sequelize=require('sequelize');module[_0xfa85('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 3ed0d29..99ff4ea 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 _0xffb0=['api','moment','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger'];(function(_0x359622,_0xb98516){var _0x26a55e=function(_0x1515b8){while(--_0x1515b8){_0x359622['push'](_0x359622['shift']());}};_0x26a55e(++_0xb98516);}(_0xffb0,0x1d1));var _0x0ffb=function(_0x4b7681,_0x42def1){_0x4b7681=_0x4b7681-0x0;var _0x3eb020=_0xffb0[_0x4b7681];return _0x3eb020;};'use strict';var _=require(_0x0ffb('0x0'));var util=require(_0x0ffb('0x1'));var logger=require(_0x0ffb('0x2'))(_0x0ffb('0x3'));var moment=require(_0x0ffb('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0ffb('0x5'));var config=require(_0x0ffb('0x6'));var attributes=require(_0x0ffb('0x7'));module[_0x0ffb('0x8')]=function(_0x310d2c,_0x524280){return _0x310d2c[_0x0ffb('0x9')](_0x0ffb('0xa'),attributes,{'tableName':_0x0ffb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x69e5=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','user_has_chat_queues','lodash','util','../../config/logger'];(function(_0x4c08a2,_0x3c808f){var _0x1f1fd6=function(_0x23cc9e){while(--_0x23cc9e){_0x4c08a2['push'](_0x4c08a2['shift']());}};_0x1f1fd6(++_0x3c808f);}(_0x69e5,0x1b9));var _0x569e=function(_0x36bc58,_0x27f03c){_0x36bc58=_0x36bc58-0x0;var _0x4a547e=_0x69e5[_0x36bc58];return _0x4a547e;};'use strict';var _=require(_0x569e('0x0'));var util=require(_0x569e('0x1'));var logger=require(_0x569e('0x2'))(_0x569e('0x3'));var moment=require(_0x569e('0x4'));var BPromise=require(_0x569e('0x5'));var rp=require(_0x569e('0x6'));var fs=require('fs');var path=require(_0x569e('0x7'));var rimraf=require(_0x569e('0x8'));var config=require(_0x569e('0x9'));var attributes=require('./userChatQueue.attributes');module[_0x569e('0xa')]=function(_0x214e4d,_0x4d1f5e){return _0x214e4d['define']('UserChatQueue',attributes,{'tableName':_0x569e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 9f5e18e..d45c009 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 _0x5d78=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s'];(function(_0x81d395,_0x45d7a9){var _0xed9574=function(_0x3b9044){while(--_0x3b9044){_0x81d395['push'](_0x81d395['shift']());}};_0xed9574(++_0x45d7a9);}(_0x5d78,0x1d2));var _0x85d7=function(_0x4ac937,_0x13f2a0){_0x4ac937=_0x4ac937-0x0;var _0x53a0bd=_0x5d78[_0x4ac937];return _0x53a0bd;};'use strict';var _=require(_0x85d7('0x0'));var util=require(_0x85d7('0x1'));var moment=require(_0x85d7('0x2'));var BPromise=require(_0x85d7('0x3'));var rs=require(_0x85d7('0x4'));var fs=require('fs');var Redis=require(_0x85d7('0x5'));var db=require(_0x85d7('0x6'))['db'];var utils=require(_0x85d7('0x7'));var logger=require(_0x85d7('0x8'))(_0x85d7('0x9'));var config=require('../../config/environment');var jayson=require(_0x85d7('0xa'));var client=jayson[_0x85d7('0xb')][_0x85d7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x37b351,_0x2d63a5,_0x205e47){return new BPromise(function(_0x6ac8db,_0x2ec342){return client[_0x85d7('0xd')](_0x37b351,_0x205e47)['then'](function(_0x2266b9){logger['info'](_0x85d7('0xe'),_0x2d63a5,_0x85d7('0xf'));logger['debug'](_0x85d7('0x10'),_0x2d63a5,_0x85d7('0xf'),JSON[_0x85d7('0x11')](_0x2266b9));if(_0x2266b9[_0x85d7('0x12')]){if(_0x2266b9[_0x85d7('0x12')][_0x85d7('0x13')]===0x1f4){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x2d63a5,_0x2266b9['error']['message']);return _0x2ec342(_0x2266b9['error'][_0x85d7('0x14')]);}logger['error'](_0x85d7('0xe'),_0x2d63a5,_0x2266b9[_0x85d7('0x12')]['message']);return _0x6ac8db(_0x2266b9[_0x85d7('0x12')][_0x85d7('0x14')]);}else{logger['info'](_0x85d7('0xe'),_0x2d63a5,_0x85d7('0xf'));_0x6ac8db(_0x2266b9[_0x85d7('0x15')][_0x85d7('0x14')]);}})[_0x85d7('0x16')](function(_0x1b5679){logger['error'](_0x85d7('0xe'),_0x2d63a5,_0x1b5679);_0x2ec342(_0x1b5679);});});} \ No newline at end of file +var _0xec86=['lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','result','catch'];(function(_0x11a220,_0x4e470a){var _0x20d8fe=function(_0xbedfd){while(--_0xbedfd){_0x11a220['push'](_0x11a220['shift']());}};_0x20d8fe(++_0x4e470a);}(_0xec86,0xb8));var _0x6ec8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xec86[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6ec8('0x0'));var util=require(_0x6ec8('0x1'));var moment=require(_0x6ec8('0x2'));var BPromise=require(_0x6ec8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6ec8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6ec8('0x5'))(_0x6ec8('0x6'));var config=require(_0x6ec8('0x7'));var jayson=require(_0x6ec8('0x8'));var client=jayson[_0x6ec8('0x9')][_0x6ec8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x212802,_0x2c14f3,_0x58336d){return new BPromise(function(_0x1b465c,_0x57b4b6){return client['request'](_0x212802,_0x58336d)[_0x6ec8('0xb')](function(_0x76df94){logger[_0x6ec8('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x2c14f3,_0x6ec8('0xd'));logger[_0x6ec8('0xe')](_0x6ec8('0xf'),_0x2c14f3,'request\x20sent',JSON[_0x6ec8('0x10')](_0x76df94));if(_0x76df94[_0x6ec8('0x11')]){if(_0x76df94[_0x6ec8('0x11')][_0x6ec8('0x12')]===0x1f4){logger[_0x6ec8('0x11')](_0x6ec8('0x13'),_0x2c14f3,_0x76df94[_0x6ec8('0x11')][_0x6ec8('0x14')]);return _0x57b4b6(_0x76df94[_0x6ec8('0x11')][_0x6ec8('0x14')]);}logger[_0x6ec8('0x11')](_0x6ec8('0x13'),_0x2c14f3,_0x76df94[_0x6ec8('0x11')][_0x6ec8('0x14')]);return _0x1b465c(_0x76df94[_0x6ec8('0x11')][_0x6ec8('0x14')]);}else{logger[_0x6ec8('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x2c14f3,_0x6ec8('0xd'));_0x1b465c(_0x76df94[_0x6ec8('0x15')][_0x6ec8('0x14')]);}})[_0x6ec8('0x16')](function(_0x19dc3f){logger[_0x6ec8('0x11')](_0x6ec8('0x13'),_0x2c14f3,_0x19dc3f);_0x57b4b6(_0x19dc3f);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 90085e5..b2d0dde 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x17a8dd,_0x5d6331){var _0x1d370d=function(_0x722a79){while(--_0x722a79){_0x17a8dd['push'](_0x17a8dd['shift']());}};_0x1d370d(++_0x5d6331);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x16b1a5,_0x318267){_0x16b1a5=_0x16b1a5-0x0;var _0x475e25=_0xcb91[_0x16b1a5];return _0x475e25;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2b91a8,_0x5882c5){var _0x1d63e4=function(_0x28d08a){while(--_0x28d08a){_0x2b91a8['push'](_0x2b91a8['shift']());}};_0x1d63e4(++_0x5882c5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2bfe52,_0x43946e){_0x2bfe52=_0x2bfe52-0x0;var _0x1cf649=_0xcb91[_0x2bfe52];return _0x1cf649;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 426586e..e541dcb 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 _0xcdb4=['exports','STRING','sequelize'];(function(_0x58d16d,_0x4ece6f){var _0x223288=function(_0x2862b7){while(--_0x2862b7){_0x58d16d['push'](_0x58d16d['shift']());}};_0x223288(++_0x4ece6f);}(_0xcdb4,0x104));var _0x4cdb=function(_0x55e994,_0x188ba5){_0x55e994=_0x55e994-0x0;var _0x6d575=_0xcdb4[_0x55e994];return _0x6d575;};'use strict';var Sequelize=require(_0x4cdb('0x0'));module[_0x4cdb('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x4cdb('0x2')]}}; \ No newline at end of file +var _0xc5dc=['INTEGER','STRING','sequelize','exports'];(function(_0x4eee9e,_0x57aa9f){var _0x37bc2b=function(_0x34f107){while(--_0x34f107){_0x4eee9e['push'](_0x4eee9e['shift']());}};_0x37bc2b(++_0x57aa9f);}(_0xc5dc,0x18a));var _0xcc5d=function(_0x4b6ab3,_0x203dee){_0x4b6ab3=_0x4b6ab3-0x0;var _0x13be88=_0xc5dc[_0x4b6ab3];return _0x13be88;};'use strict';var Sequelize=require(_0xcc5d('0x0'));module[_0xcc5d('0x1')]={'penalty':{'type':Sequelize[_0xcc5d('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xcc5d('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xcc5d('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index e5f1f88..bbbaa56 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 _0xe213=['../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xe56a1e,_0x39967a){var _0xd2443d=function(_0xda6b71){while(--_0xda6b71){_0xe56a1e['push'](_0xe56a1e['shift']());}};_0xd2443d(++_0x39967a);}(_0xe213,0x19b));var _0x3e21=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0xe213[_0x1573ea];return _0x51c0e2;};'use strict';var _=require(_0x3e21('0x0'));var util=require(_0x3e21('0x1'));var logger=require(_0x3e21('0x2'))(_0x3e21('0x3'));var moment=require(_0x3e21('0x4'));var BPromise=require(_0x3e21('0x5'));var rp=require(_0x3e21('0x6'));var fs=require('fs');var path=require(_0x3e21('0x7'));var rimraf=require(_0x3e21('0x8'));var config=require(_0x3e21('0x9'));var attributes=require(_0x3e21('0xa'));module[_0x3e21('0xb')]=function(_0x3980f0,_0x6302ad){return _0x3980f0[_0x3e21('0xc')](_0x3e21('0xd'),attributes,{'tableName':_0x3e21('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd5d3=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0xd5d3,0x81));var _0x3d5d=function(_0x1b5d43,_0x1b6339){_0x1b5d43=_0x1b5d43-0x0;var _0x3d6408=_0xd5d3[_0x1b5d43];return _0x3d6408;};'use strict';var _=require(_0x3d5d('0x0'));var util=require(_0x3d5d('0x1'));var logger=require(_0x3d5d('0x2'))(_0x3d5d('0x3'));var moment=require('moment');var BPromise=require(_0x3d5d('0x4'));var rp=require(_0x3d5d('0x5'));var fs=require('fs');var path=require(_0x3d5d('0x6'));var rimraf=require(_0x3d5d('0x7'));var config=require('../../config/environment');var attributes=require(_0x3d5d('0x8'));module[_0x3d5d('0x9')]=function(_0x1b50e3,_0x4ad8cd){return _0x1b50e3[_0x3d5d('0xa')](_0x3d5d('0xb'),attributes,{'tableName':_0x3d5d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index df04731..bde964d 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 _0xa082=['jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserFaxQueue,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x462c58,_0x16026f){var _0x967300=function(_0x3ad41c){while(--_0x3ad41c){_0x462c58['push'](_0x462c58['shift']());}};_0x967300(++_0x16026f);}(_0xa082,0x122));var _0x2a08=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xa082[_0x1969a7];return _0x3d665f;};'use strict';var _=require(_0x2a08('0x0'));var util=require('util');var moment=require(_0x2a08('0x1'));var BPromise=require(_0x2a08('0x2'));var rs=require(_0x2a08('0x3'));var fs=require('fs');var Redis=require(_0x2a08('0x4'));var db=require(_0x2a08('0x5'))['db'];var utils=require(_0x2a08('0x6'));var logger=require(_0x2a08('0x7'))(_0x2a08('0x8'));var config=require('../../config/environment');var jayson=require(_0x2a08('0x9'));var client=jayson[_0x2a08('0xa')][_0x2a08('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b264d,_0x2546df,_0x8b5c38){return new BPromise(function(_0x38dfbf,_0x1fc913){return client[_0x2a08('0xc')](_0x2b264d,_0x8b5c38)[_0x2a08('0xd')](function(_0x2c98a4){logger[_0x2a08('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x2546df,'request\x20sent');logger['debug'](_0x2a08('0xf'),_0x2546df,_0x2a08('0x10'),JSON['stringify'](_0x2c98a4));if(_0x2c98a4[_0x2a08('0x11')]){if(_0x2c98a4[_0x2a08('0x11')][_0x2a08('0x12')]===0x1f4){logger[_0x2a08('0x11')](_0x2a08('0x13'),_0x2546df,_0x2c98a4[_0x2a08('0x11')][_0x2a08('0x14')]);return _0x1fc913(_0x2c98a4[_0x2a08('0x11')][_0x2a08('0x14')]);}logger['error'](_0x2a08('0x13'),_0x2546df,_0x2c98a4[_0x2a08('0x11')][_0x2a08('0x14')]);return _0x38dfbf(_0x2c98a4[_0x2a08('0x11')]['message']);}else{logger['info'](_0x2a08('0x13'),_0x2546df,'request\x20sent');_0x38dfbf(_0x2c98a4[_0x2a08('0x15')]['message']);}})[_0x2a08('0x16')](function(_0x5e0724){logger[_0x2a08('0x11')](_0x2a08('0x13'),_0x2546df,_0x5e0724);_0x1fc913(_0x5e0724);});});} \ No newline at end of file +var _0x08cf=['jayson/promise','client','http','info','request\x20sent','debug','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0x257280,_0x2921df){var _0xc4550e=function(_0x35bcfd){while(--_0x35bcfd){_0x257280['push'](_0x257280['shift']());}};_0xc4550e(++_0x2921df);}(_0x08cf,0xca));var _0xf08c=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x08cf[_0xdea41a];return _0x15d0d8;};'use strict';var _=require('lodash');var util=require(_0xf08c('0x0'));var moment=require(_0xf08c('0x1'));var BPromise=require(_0xf08c('0x2'));var rs=require(_0xf08c('0x3'));var fs=require('fs');var Redis=require(_0xf08c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf08c('0x5'))(_0xf08c('0x6'));var config=require(_0xf08c('0x7'));var jayson=require(_0xf08c('0x8'));var client=jayson[_0xf08c('0x9')][_0xf08c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x268d24,_0x3a0459,_0x399caa){return new BPromise(function(_0x5c763e,_0x428206){return client['request'](_0x268d24,_0x399caa)['then'](function(_0x275791){logger[_0xf08c('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x3a0459,_0xf08c('0xc'));logger[_0xf08c('0xd')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x3a0459,_0xf08c('0xc'),JSON[_0xf08c('0xe')](_0x275791));if(_0x275791[_0xf08c('0xf')]){if(_0x275791[_0xf08c('0xf')][_0xf08c('0x10')]===0x1f4){logger[_0xf08c('0xf')](_0xf08c('0x11'),_0x3a0459,_0x275791[_0xf08c('0xf')][_0xf08c('0x12')]);return _0x428206(_0x275791[_0xf08c('0xf')][_0xf08c('0x12')]);}logger[_0xf08c('0xf')](_0xf08c('0x11'),_0x3a0459,_0x275791['error'][_0xf08c('0x12')]);return _0x5c763e(_0x275791[_0xf08c('0xf')][_0xf08c('0x12')]);}else{logger[_0xf08c('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x3a0459,'request\x20sent');_0x5c763e(_0x275791[_0xf08c('0x13')]['message']);}})[_0xf08c('0x14')](function(_0x2825dd){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x3a0459,_0x2825dd);_0x428206(_0x2825dd);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 44c5356..c636342 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x47a4af,_0x4ef90b){var _0x25a0b1=function(_0x385630){while(--_0x385630){_0x47a4af['push'](_0x47a4af['shift']());}};_0x25a0b1(++_0x4ef90b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x58f65e,_0x467d61){var _0x35684b=function(_0x17cafe){while(--_0x17cafe){_0x58f65e['push'](_0x58f65e['shift']());}};_0x35684b(++_0x467d61);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index d41bd10..59b0728 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 _0xece2=['sequelize','INTEGER'];(function(_0x1b948b,_0x5c0ad3){var _0x17a451=function(_0x143d58){while(--_0x143d58){_0x1b948b['push'](_0x1b948b['shift']());}};_0x17a451(++_0x5c0ad3);}(_0xece2,0x1f2));var _0x2ece=function(_0xa9478f,_0x3717ee){_0xa9478f=_0xa9478f-0x0;var _0x332c0a=_0xece2[_0xa9478f];return _0x332c0a;};'use strict';var Sequelize=require(_0x2ece('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x2ece('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x526d=['sequelize'];(function(_0x26d6c8,_0x29f425){var _0x57e7f6=function(_0x28afb0){while(--_0x28afb0){_0x26d6c8['push'](_0x26d6c8['shift']());}};_0x57e7f6(++_0x29f425);}(_0x526d,0xce));var _0xd526=function(_0x3cea7b,_0x328f7b){_0x3cea7b=_0x3cea7b-0x0;var _0x430e18=_0x526d[_0x3cea7b];return _0x430e18;};'use strict';var Sequelize=require(_0xd526('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 3dfb6a4..d717b8e 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 _0x41d6=['bluebird','request-promise','path','../../config/environment','define','UserMailQueue','user_has_mail_queues','util','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x41d6,0x1c9));var _0x641d=function(_0x16b992,_0x43d74c){_0x16b992=_0x16b992-0x0;var _0x385c78=_0x41d6[_0x16b992];return _0x385c78;};'use strict';var _=require('lodash');var util=require(_0x641d('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x641d('0x1'));var BPromise=require(_0x641d('0x2'));var rp=require(_0x641d('0x3'));var fs=require('fs');var path=require(_0x641d('0x4'));var rimraf=require('rimraf');var config=require(_0x641d('0x5'));var attributes=require('./userMailQueue.attributes');module['exports']=function(_0x2eff03,_0x1b1d62){return _0x2eff03[_0x641d('0x6')](_0x641d('0x7'),attributes,{'tableName':_0x641d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f89=['lodash','util','api','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','UserMailQueue','user_has_mail_queues'];(function(_0x1cb690,_0x5592e3){var _0x3bebd4=function(_0x266301){while(--_0x266301){_0x1cb690['push'](_0x1cb690['shift']());}};_0x3bebd4(++_0x5592e3);}(_0x9f89,0x18c));var _0x99f8=function(_0x379d94,_0x1ebc1e){_0x379d94=_0x379d94-0x0;var _0xf3b9d2=_0x9f89[_0x379d94];return _0xf3b9d2;};'use strict';var _=require(_0x99f8('0x0'));var util=require(_0x99f8('0x1'));var logger=require('../../config/logger')(_0x99f8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x99f8('0x3'));var fs=require('fs');var path=require(_0x99f8('0x4'));var rimraf=require(_0x99f8('0x5'));var config=require(_0x99f8('0x6'));var attributes=require(_0x99f8('0x7'));module[_0x99f8('0x8')]=function(_0x47decb,_0x5be2b3){return _0x47decb['define'](_0x99f8('0x9'),attributes,{'tableName':_0x99f8('0xa'),'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 ecafe5c..915fe99 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 _0x7fbe=['request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x114abb,_0x12461f){var _0x2502b1=function(_0x84baf9){while(--_0x84baf9){_0x114abb['push'](_0x114abb['shift']());}};_0x2502b1(++_0x12461f);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x26da89,_0x264785){_0x26da89=_0x26da89-0x0;var _0xc95b7b=_0x7fbe[_0x26da89];return _0xc95b7b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});} \ No newline at end of file +var _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','UserMailQueue,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x6f6fb2,_0x5d19b2){var _0x32597b=function(_0xd7a59b){while(--_0xd7a59b){_0x6f6fb2['push'](_0x6f6fb2['shift']());}};_0x32597b(++_0x5d19b2);}(_0x5fc3,0xa8));var _0x35fc=function(_0x188a93,_0xaf57db){_0x188a93=_0x188a93-0x0;var _0x23b40d=_0x5fc3[_0x188a93];return _0x23b40d;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('UserMailQueue,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 72d3fd1..4a69f68 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 _0x898f=['sendUserNotification','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','post','isAuthenticated'];(function(_0x4f7de8,_0x22a44d){var _0x2b10b9=function(_0x48ab2d){while(--_0x48ab2d){_0x4f7de8['push'](_0x4f7de8['shift']());}};_0x2b10b9(++_0x22a44d);}(_0x898f,0x151));var _0xf898=function(_0x80260a,_0x22f959){_0x80260a=_0x80260a-0x0;var _0x53bd2f=_0x898f[_0x80260a];return _0x53bd2f;};'use strict';var multer=require(_0xf898('0x0'));var util=require(_0xf898('0x1'));var path=require('path');var timeout=require(_0xf898('0x2'));var express=require(_0xf898('0x3'));var router=express[_0xf898('0x4')]();var fs_extra=require(_0xf898('0x5'));var auth=require(_0xf898('0x6'));var interaction=require(_0xf898('0x7'));var config=require(_0xf898('0x8'));var controller=require('./userNotification.controller');router[_0xf898('0x9')]('/',auth[_0xf898('0xa')](),controller[_0xf898('0xb')]);module['exports']=router; \ No newline at end of file +var _0x3da2=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','util'];(function(_0x25b62a,_0x4964d5){var _0xf3a0b1=function(_0x58dae8){while(--_0x58dae8){_0x25b62a['push'](_0x25b62a['shift']());}};_0xf3a0b1(++_0x4964d5);}(_0x3da2,0x19e));var _0x23da=function(_0x1122bf,_0x3ae33f){_0x1122bf=_0x1122bf-0x0;var _0x56eb03=_0x3da2[_0x1122bf];return _0x56eb03;};'use strict';var multer=require(_0x23da('0x0'));var util=require(_0x23da('0x1'));var path=require('path');var timeout=require(_0x23da('0x2'));var express=require(_0x23da('0x3'));var router=express[_0x23da('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x23da('0x5'));var interaction=require(_0x23da('0x6'));var config=require(_0x23da('0x7'));var controller=require(_0x23da('0x8'));router[_0x23da('0x9')]('/',auth[_0x23da('0xa')](),controller[_0x23da('0xb')]);module[_0x23da('0xc')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index e98965c..fe11560 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 _0xab3e=['sequelize','exports','STRING','TEXT','BOOLEAN'];(function(_0x3daa8c,_0x388a87){var _0x2b1bd7=function(_0xdb2963){while(--_0xdb2963){_0x3daa8c['push'](_0x3daa8c['shift']());}};_0x2b1bd7(++_0x388a87);}(_0xab3e,0xc3));var _0xeab3=function(_0x1a3ce1,_0x53014d){_0x1a3ce1=_0x1a3ce1-0x0;var _0x2ea09f=_0xab3e[_0x1a3ce1];return _0x2ea09f;};'use strict';var Sequelize=require(_0xeab3('0x0'));module[_0xeab3('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xeab3('0x2')]},'recipientsId':{'type':Sequelize[_0xeab3('0x3')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0xeab3('0x4')]}}; \ No newline at end of file +var _0x36f2=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x18b02e,_0x29e6c0){var _0x5d2823=function(_0x4de8ee){while(--_0x4de8ee){_0x18b02e['push'](_0x18b02e['shift']());}};_0x5d2823(++_0x29e6c0);}(_0x36f2,0xf6));var _0x236f=function(_0x1e9c37,_0x18c10a){_0x1e9c37=_0x1e9c37-0x0;var _0x3d7cd0=_0x36f2[_0x1e9c37];return _0x3d7cd0;};'use strict';var Sequelize=require(_0x236f('0x0'));module[_0x236f('0x1')]={'body':{'type':Sequelize[_0x236f('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x236f('0x2')]},'recipientsDescription':{'type':Sequelize[_0x236f('0x3')]},'beep':{'type':Sequelize[_0x236f('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 5a52e0a..99dd231 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 _0x4593=['status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','error','stack','name','send','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','smsqueue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','create','forEach','recipient','emit','catch','Template','findOne','render','html','startCase','User','union','ids','queue','Queue','push','all','getAgents','map','eml-format','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./userNotification.socket','register'];(function(_0x3383b1,_0x4866e8){var _0x1f0df1=function(_0x2e3f89){while(--_0x2e3f89){_0x3383b1['push'](_0x3383b1['shift']());}};_0x1f0df1(++_0x4866e8);}(_0x4593,0x10d));var _0x3459=function(_0x9c8b4a,_0x2387ff){_0x9c8b4a=_0x9c8b4a-0x0;var _0x198bef=_0x4593[_0x9c8b4a];return _0x198bef;};'use strict';var emlformat=require(_0x3459('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3459('0x1'));var moment=require(_0x3459('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3459('0x3'));var util=require('util');var path=require(_0x3459('0x4'));var sox=require(_0x3459('0x5'));var csv=require(_0x3459('0x6'));var ejs=require(_0x3459('0x7'));var fs=require('fs');var fs_extra=require(_0x3459('0x8'));var _=require('lodash');var squel=require(_0x3459('0x9'));var crypto=require(_0x3459('0xa'));var jsforce=require(_0x3459('0xb'));var deskjs=require(_0x3459('0xc'));var toCsv=require(_0x3459('0x6'));var querystring=require('querystring');var Papa=require(_0x3459('0xd'));var Redis=require(_0x3459('0xe'));var authService=require(_0x3459('0xf'));var qs=require(_0x3459('0x10'));var as=require(_0x3459('0x11'));var hardwareService=require(_0x3459('0x12'));var logger=require(_0x3459('0x13'))(_0x3459('0x14'));var utils=require('../../config/utils');var config=require(_0x3459('0x15'));var licenseUtil=require(_0x3459('0x16'));var db=require(_0x3459('0x17'))['db'];config[_0x3459('0x18')]=_['defaults'](config[_0x3459('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x3459('0x19'))(new Redis(config['redis']));require(_0x3459('0x1a'))[_0x3459('0x1b')](socket);function respondWithStatusCode(_0x1f4e89,_0x2cd344){_0x2cd344=_0x2cd344||0xcc;return function(_0x3483bc){if(_0x3483bc){return _0x1f4e89['sendStatus'](_0x2cd344);}return _0x1f4e89[_0x3459('0x1c')](_0x2cd344)[_0x3459('0x1d')]();};}function respondWithResult(_0x51e304,_0x8a15c4){_0x8a15c4=_0x8a15c4||0xc8;return function(_0x25b715){if(_0x25b715){return _0x51e304[_0x3459('0x1c')](_0x8a15c4)['json'](_0x25b715);}};}function respondWithFilteredResult(_0xb7d8e1,_0x39e991){return function(_0x357617){if(_0x357617){var _0x51bbbb=typeof _0x39e991[_0x3459('0x1e')]===_0x3459('0x1f')&&typeof _0x39e991[_0x3459('0x20')]==='undefined';var _0x329881=_0x357617[_0x3459('0x21')];var _0x6ea335=_0x51bbbb?0x0:_0x39e991['offset'];var _0x25c3a2=_0x51bbbb?_0x357617[_0x3459('0x21')]:_0x39e991[_0x3459('0x1e')]+_0x39e991[_0x3459('0x20')];var _0x4f79eb;if(_0x25c3a2>=_0x329881){_0x25c3a2=_0x329881;_0x4f79eb=0xc8;}else{_0x4f79eb=0xce;}_0xb7d8e1[_0x3459('0x1c')](_0x4f79eb);return _0xb7d8e1[_0x3459('0x22')](_0x3459('0x23'),_0x6ea335+'-'+_0x25c3a2+'/'+_0x329881)[_0x3459('0x24')](_0x357617);}return null;};}function patchUpdates(_0x511e52){return function(_0x59e9ad){try{jsonpatch['apply'](_0x59e9ad,_0x511e52,!![]);}catch(_0x53c853){return BPromise[_0x3459('0x25')](_0x53c853);}return _0x59e9ad[_0x3459('0x26')]();};}function saveUpdates(_0xc57a6e,_0x301dd2){return function(_0x473933){if(_0x473933){return _0x473933[_0x3459('0x27')](_0xc57a6e)[_0x3459('0x28')](function(_0xc96821){return _0xc96821;});}return null;};}function removeEntity(_0x1a0bee,_0x259c75){return function(_0x4e1bc0){if(_0x4e1bc0){return _0x4e1bc0['destroy']()[_0x3459('0x28')](function(){_0x1a0bee['status'](0xcc)[_0x3459('0x1d')]();});}};}function handleEntityNotFound(_0x2fecbd,_0xc5d4a1){return function(_0x5a22b2){if(!_0x5a22b2){_0x2fecbd['sendStatus'](0x194);}return _0x5a22b2;};}function handleError(_0x1f49fd,_0x9f27cc){_0x9f27cc=_0x9f27cc||0x1f4;return function(_0x247bad){logger[_0x3459('0x29')](_0x247bad[_0x3459('0x2a')]);if(_0x247bad[_0x3459('0x2b')]){delete _0x247bad[_0x3459('0x2b')];}_0x1f49fd['status'](_0x9f27cc)[_0x3459('0x2c')](_0x247bad);};}exports['sendUserNotification']=function(_0xcff0df,_0x128ca7,_0x4aab64){if(!_0xcff0df[_0x3459('0x2d')][_0x3459('0x2e')](_0x3459('0x2f'))&&!_0xcff0df[_0x3459('0x2d')][_0x3459('0x2e')](_0x3459('0x30'))){throw new db[(_0x3459('0x31'))][(_0x3459('0x32'))](_0x3459('0x33'));}else{if(_0xcff0df[_0x3459('0x2d')]['hasOwnProperty'](_0x3459('0x30'))&&!_0xcff0df[_0x3459('0x2d')][_0x3459('0x2e')](_0x3459('0x34'))){throw new db[(_0x3459('0x31'))][(_0x3459('0x32'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0xcff0df[_0x3459('0x2d')][_0x3459('0x2e')](_0x3459('0x35'))){throw new db[(_0x3459('0x31'))][(_0x3459('0x32'))](_0x3459('0x36'));}else{try{var _0x437185=JSON[_0x3459('0x37')](_0xcff0df['body']['recipients']);}catch(_0x11d785){logger[_0x3459('0x29')](_0x11d785);throw new db[(_0x3459('0x31'))][(_0x3459('0x32'))](_0x3459('0x38'));}var _0xbde364=['chatqueue',_0x3459('0x39'),_0x3459('0x3a'),_0x3459('0x3b'),_0x3459('0x3c'),'voicequeue',_0x3459('0x3d'),_0x3459('0x3e'),_0x3459('0x3f')];if(_[_0x3459('0x40')](_0x437185,function(_0x1b4282){return!_[_0x3459('0x41')](_0xbde364,_0x1b4282[_0x3459('0x42')][_0x3459('0x43')]());})){throw new db['Sequelize'][(_0x3459('0x32'))](_0x3459('0x44'));}}}var _0x3040c1={};_0x3040c1[_0x3459('0x45')]=_0xcff0df[_0x3459('0x2d')][_0x3459('0x2e')]('senderName')?_0xcff0df[_0x3459('0x2d')][_0x3459('0x45')]:_0xcff0df[_0x3459('0x3f')][_0x3459('0x46')];_0x3040c1[_0x3459('0x47')]=_[_0x3459('0x48')](_0xcff0df[_0x3459('0x2d')][_0x3459('0x47')])?null:_0xcff0df[_0x3459('0x2d')][_0x3459('0x47')];_0x3040c1[_0x3459('0x49')]=_0xcff0df['body'][_0x3459('0x49')]||![];_0x3040c1[_0x3459('0x4a')]=_0xcff0df[_0x3459('0x3f')]['id'];return getContent(_0xcff0df['body'])[_0x3459('0x28')](function(_0x39f3c2){_0x3040c1['body']=_0x39f3c2;return getRecipients(_0x437185);})[_0x3459('0x28')](function(_0x5bd214){_0x3040c1[_0x3459('0x4b')]=_[_0x3459('0x4c')](_0x5bd214)[_0x3459('0x4d')](',');return db[_0x3459('0x4e')][_0x3459('0x4f')](function(_0x4b7408){return db['UserNotification'][_0x3459('0x50')](_0x3040c1,{'raw':!![],'transaction':_0x4b7408})[_0x3459('0x28')](function(_0x47692d){var _0x58b2fa={'sender':_0x3040c1['senderName'],'description':_0x3040c1[_0x3459('0x47')],'content':_0x3040c1['body'],'beep':_0x3040c1[_0x3459('0x49')]};_0x5bd214[_0x3459('0x51')](function(_0x5922f7){_0x58b2fa[_0x3459('0x52')]=_0x5922f7;socket[_0x3459('0x53')]('userNotification:send',_0x58b2fa);});return _0x47692d;});});})[_0x3459('0x28')](respondWithResult(_0x128ca7,0xc9))[_0x3459('0x54')](handleError(_0x128ca7,null));};function getContent(_0x4be2d3){return new BPromise(function(_0xf6ad8,_0xf94651){if(_0x4be2d3['text']){_0xf6ad8(_0x4be2d3['text']);return;}return db[_0x3459('0x55')][_0x3459('0x56')]({'attributes':['html'],'where':{'id':_0x4be2d3[_0x3459('0x30')]},'raw':!![]})[_0x3459('0x28')](function(_0x442892){if(!_0x442892)throw new db['Sequelize'][(_0x3459('0x32'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x3656b2=Mustache[_0x3459('0x57')](_0x442892[_0x3459('0x58')],_0x4be2d3[_0x3459('0x34')]);_0xf6ad8(_0x3656b2);})[_0x3459('0x54')](function(_0x39b34e){_0xf94651(_0x39b34e);});});}function getRecipients(_0x3312a7){return new BPromise(function(_0x7b76c3,_0x132db0){var _0x82f23b=[];var _0x475cb2=[];_0x3312a7[_0x3459('0x51')](function(_0x57c534){var _0x187e4b=_[_0x3459('0x59')](_0x57c534[_0x3459('0x42')][_0x3459('0x43')]());if(_0x187e4b===_0x3459('0x5a')){_0x82f23b=_[_0x3459('0x5b')](_0x82f23b,_0x57c534[_0x3459('0x5c')]);}else{if(_['includes'](_0x187e4b,'queue'))_0x187e4b=_0x187e4b['replace'](_0x3459('0x5d'),_0x3459('0x5e'));_0x57c534[_0x3459('0x5c')][_0x3459('0x51')](function(_0x26481d){_0x475cb2[_0x3459('0x5f')](getAgents(_0x187e4b,_0x26481d));});}});return BPromise[_0x3459('0x60')](_0x475cb2)[_0x3459('0x28')](function(_0x5c706b){_0x82f23b=_[_0x3459('0x5b')](_0x82f23b,_['flatten'](_0x5c706b));_0x7b76c3(_0x82f23b);})[_0x3459('0x54')](function(_0x1b2715){_0x132db0(_0x1b2715);});});}function getAgents(_0x5e00f6,_0x55e8e3){return new BPromise(function(_0x587913,_0x75be59){return db[_0x5e00f6][_0x3459('0x56')]({'where':{'id':_0x55e8e3}})[_0x3459('0x28')](function(_0x111dc9){return _0x111dc9[_0x3459('0x61')]({'attributes':['id'],'raw':!![]})[_0x3459('0x28')](function(_0x31e37f){var _0x1fc7ab=_[_0x3459('0x62')](_0x31e37f,'id');_0x587913(_0x1fc7ab);});})[_0x3459('0x54')](function(_0x47091d){_0x75be59(_0x47091d);});});} \ No newline at end of file +var _0x2002=['userNotification:send','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','catch','User','union','ids','queue','replace','Queue','push','map','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','body','hasOwnProperty','text','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','ValidationError','Missing\x20\x27view\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','user','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','create','forEach','recipient','emit'];(function(_0x227ec9,_0xb9427c){var _0x3711cd=function(_0x1ac88c){while(--_0x1ac88c){_0x227ec9['push'](_0x227ec9['shift']());}};_0x3711cd(++_0xb9427c);}(_0x2002,0xd3));var _0x2200=function(_0x211087,_0x354fdd){_0x211087=_0x211087-0x0;var _0x2a581f=_0x2002[_0x211087];return _0x2a581f;};'use strict';var emlformat=require(_0x2200('0x0'));var rimraf=require(_0x2200('0x1'));var zipdir=require(_0x2200('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2200('0x3'));var Mustache=require(_0x2200('0x4'));var util=require(_0x2200('0x5'));var path=require(_0x2200('0x6'));var sox=require(_0x2200('0x7'));var csv=require(_0x2200('0x8'));var ejs=require(_0x2200('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2200('0xa'));var squel=require(_0x2200('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2200('0xc'));var toCsv=require(_0x2200('0x8'));var querystring=require(_0x2200('0xd'));var Papa=require(_0x2200('0xe'));var Redis=require('ioredis');var authService=require(_0x2200('0xf'));var qs=require(_0x2200('0x10'));var as=require(_0x2200('0x11'));var hardwareService=require(_0x2200('0x12'));var logger=require(_0x2200('0x13'))(_0x2200('0x14'));var utils=require(_0x2200('0x15'));var config=require(_0x2200('0x16'));var licenseUtil=require(_0x2200('0x17'));var db=require(_0x2200('0x18'))['db'];config[_0x2200('0x19')]=_['defaults'](config[_0x2200('0x19')],{'host':_0x2200('0x1a'),'port':0x18eb});var socket=require(_0x2200('0x1b'))(new Redis(config['redis']));require('./userNotification.socket')[_0x2200('0x1c')](socket);function respondWithStatusCode(_0x1f5b6a,_0x5f07c5){_0x5f07c5=_0x5f07c5||0xcc;return function(_0x24e9ff){if(_0x24e9ff){return _0x1f5b6a[_0x2200('0x1d')](_0x5f07c5);}return _0x1f5b6a['status'](_0x5f07c5)[_0x2200('0x1e')]();};}function respondWithResult(_0x5939ed,_0x1afd0b){_0x1afd0b=_0x1afd0b||0xc8;return function(_0xf50ba7){if(_0xf50ba7){return _0x5939ed[_0x2200('0x1f')](_0x1afd0b)[_0x2200('0x20')](_0xf50ba7);}};}function respondWithFilteredResult(_0x1cc380,_0x9a26b3){return function(_0x3b809d){if(_0x3b809d){var _0x325a14=typeof _0x9a26b3[_0x2200('0x21')]==='undefined'&&typeof _0x9a26b3[_0x2200('0x22')]===_0x2200('0x23');var _0x5a1d02=_0x3b809d['count'];var _0x45dc08=_0x325a14?0x0:_0x9a26b3[_0x2200('0x21')];var _0x4ff0b7=_0x325a14?_0x3b809d[_0x2200('0x24')]:_0x9a26b3['offset']+_0x9a26b3[_0x2200('0x22')];var _0x25caf2;if(_0x4ff0b7>=_0x5a1d02){_0x4ff0b7=_0x5a1d02;_0x25caf2=0xc8;}else{_0x25caf2=0xce;}_0x1cc380[_0x2200('0x1f')](_0x25caf2);return _0x1cc380[_0x2200('0x25')](_0x2200('0x26'),_0x45dc08+'-'+_0x4ff0b7+'/'+_0x5a1d02)['json'](_0x3b809d);}return null;};}function patchUpdates(_0x354a3a){return function(_0x37c592){try{jsonpatch[_0x2200('0x27')](_0x37c592,_0x354a3a,!![]);}catch(_0x3ad7af){return BPromise['reject'](_0x3ad7af);}return _0x37c592[_0x2200('0x28')]();};}function saveUpdates(_0x403a7a,_0x5bb3ad){return function(_0x52d53e){if(_0x52d53e){return _0x52d53e[_0x2200('0x29')](_0x403a7a)[_0x2200('0x2a')](function(_0x1a57df){return _0x1a57df;});}return null;};}function removeEntity(_0x427477,_0x32384f){return function(_0x341f6f){if(_0x341f6f){return _0x341f6f[_0x2200('0x2b')]()['then'](function(){_0x427477['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x57802c,_0xce0cc1){return function(_0x1191b2){if(!_0x1191b2){_0x57802c[_0x2200('0x1d')](0x194);}return _0x1191b2;};}function handleError(_0x1373ad,_0x30e24a){_0x30e24a=_0x30e24a||0x1f4;return function(_0xe05cf9){logger[_0x2200('0x2c')](_0xe05cf9[_0x2200('0x2d')]);if(_0xe05cf9[_0x2200('0x2e')]){delete _0xe05cf9[_0x2200('0x2e')];}_0x1373ad[_0x2200('0x1f')](_0x30e24a)[_0x2200('0x2f')](_0xe05cf9);};}exports['sendUserNotification']=function(_0x4c61f7,_0x58f424,_0x627b9b){if(!_0x4c61f7[_0x2200('0x30')][_0x2200('0x31')](_0x2200('0x32'))&&!_0x4c61f7[_0x2200('0x30')][_0x2200('0x31')](_0x2200('0x33'))){throw new db[(_0x2200('0x34'))]['ValidationError'](_0x2200('0x35'));}else{if(_0x4c61f7['body']['hasOwnProperty'](_0x2200('0x33'))&&!_0x4c61f7[_0x2200('0x30')]['hasOwnProperty']('view')){throw new db[(_0x2200('0x34'))][(_0x2200('0x36'))](_0x2200('0x37'));}if(!_0x4c61f7[_0x2200('0x30')][_0x2200('0x31')]('recipients')){throw new db[(_0x2200('0x34'))]['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x2d7fb2=JSON[_0x2200('0x38')](_0x4c61f7[_0x2200('0x30')][_0x2200('0x39')]);}catch(_0x2044be){logger[_0x2200('0x2c')](_0x2044be);throw new db[(_0x2200('0x34'))][(_0x2200('0x36'))](_0x2200('0x3a'));}var _0x4aa865=['chatqueue','faxqueue',_0x2200('0x3b'),_0x2200('0x3c'),_0x2200('0x3d'),_0x2200('0x3e'),_0x2200('0x3f'),'team',_0x2200('0x40')];if(_['some'](_0x2d7fb2,function(_0xcce59f){return!_[_0x2200('0x41')](_0x4aa865,_0xcce59f[_0x2200('0x42')][_0x2200('0x43')]());})){throw new db[(_0x2200('0x34'))][(_0x2200('0x36'))](_0x2200('0x44'));}}}var _0xcb379e={};_0xcb379e[_0x2200('0x45')]=_0x4c61f7[_0x2200('0x30')]['hasOwnProperty'](_0x2200('0x45'))?_0x4c61f7[_0x2200('0x30')][_0x2200('0x45')]:_0x4c61f7[_0x2200('0x40')][_0x2200('0x46')];_0xcb379e[_0x2200('0x47')]=_[_0x2200('0x48')](_0x4c61f7[_0x2200('0x30')][_0x2200('0x47')])?null:_0x4c61f7['body'][_0x2200('0x47')];_0xcb379e[_0x2200('0x49')]=_0x4c61f7[_0x2200('0x30')][_0x2200('0x49')]||![];_0xcb379e[_0x2200('0x4a')]=_0x4c61f7[_0x2200('0x40')]['id'];return getContent(_0x4c61f7[_0x2200('0x30')])[_0x2200('0x2a')](function(_0xdb05c5){_0xcb379e[_0x2200('0x30')]=_0xdb05c5;return getRecipients(_0x2d7fb2);})[_0x2200('0x2a')](function(_0x336980){_0xcb379e[_0x2200('0x4b')]=_[_0x2200('0x4c')](_0x336980)[_0x2200('0x4d')](',');return db[_0x2200('0x4e')]['transaction'](function(_0x2a6602){return db['UserNotification'][_0x2200('0x4f')](_0xcb379e,{'raw':!![],'transaction':_0x2a6602})[_0x2200('0x2a')](function(_0x446b10){var _0x58492d={'sender':_0xcb379e[_0x2200('0x45')],'description':_0xcb379e[_0x2200('0x47')],'content':_0xcb379e[_0x2200('0x30')],'beep':_0xcb379e['beep']};_0x336980[_0x2200('0x50')](function(_0x48b508){_0x58492d[_0x2200('0x51')]=_0x48b508;socket[_0x2200('0x52')](_0x2200('0x53'),_0x58492d);});return _0x446b10;});});})[_0x2200('0x2a')](respondWithResult(_0x58f424,0xc9))['catch'](handleError(_0x58f424,null));};function getContent(_0x3aaf40){return new BPromise(function(_0x2577b6,_0x224f7a){if(_0x3aaf40[_0x2200('0x32')]){_0x2577b6(_0x3aaf40['text']);return;}return db['Template'][_0x2200('0x54')]({'attributes':[_0x2200('0x55')],'where':{'id':_0x3aaf40[_0x2200('0x33')]},'raw':!![]})[_0x2200('0x2a')](function(_0x5a9288){if(!_0x5a9288)throw new db[(_0x2200('0x34'))]['ValidationError'](_0x2200('0x56'));var _0x4cd09e=Mustache[_0x2200('0x57')](_0x5a9288['html'],_0x3aaf40[_0x2200('0x58')]);_0x2577b6(_0x4cd09e);})[_0x2200('0x59')](function(_0x134412){_0x224f7a(_0x134412);});});}function getRecipients(_0x51f23b){return new BPromise(function(_0x26f0e0,_0x5b6ff3){var _0x3bb191=[];var _0x4ca024=[];_0x51f23b[_0x2200('0x50')](function(_0x1a81e9){var _0x2526d7=_['startCase'](_0x1a81e9['model'][_0x2200('0x43')]());if(_0x2526d7===_0x2200('0x5a')){_0x3bb191=_[_0x2200('0x5b')](_0x3bb191,_0x1a81e9[_0x2200('0x5c')]);}else{if(_[_0x2200('0x41')](_0x2526d7,_0x2200('0x5d')))_0x2526d7=_0x2526d7[_0x2200('0x5e')](_0x2200('0x5d'),_0x2200('0x5f'));_0x1a81e9['ids'][_0x2200('0x50')](function(_0x5e4003){_0x4ca024[_0x2200('0x60')](getAgents(_0x2526d7,_0x5e4003));});}});return BPromise['all'](_0x4ca024)[_0x2200('0x2a')](function(_0x50bc76){_0x3bb191=_['union'](_0x3bb191,_['flatten'](_0x50bc76));_0x26f0e0(_0x3bb191);})[_0x2200('0x59')](function(_0x59f97d){_0x5b6ff3(_0x59f97d);});});}function getAgents(_0xcbbd0c,_0x1904b9){return new BPromise(function(_0x4e98e7,_0x353a50){return db[_0xcbbd0c][_0x2200('0x54')]({'where':{'id':_0x1904b9}})[_0x2200('0x2a')](function(_0xb6a971){return _0xb6a971['getAgents']({'attributes':['id'],'raw':!![]})[_0x2200('0x2a')](function(_0x35e465){var _0xd0f25e=_[_0x2200('0x61')](_0x35e465,'id');_0x4e98e7(_0xd0f25e);});})[_0x2200('0x59')](function(_0x419e46){_0x353a50(_0x419e46);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index dd5b52d..9873860 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 _0x8023=['save','remove','emit','hasOwnProperty','exports','../../mysqldb','UserNotification','setMaxListeners'];(function(_0x2fb98a,_0x28ceb6){var _0x5f561a=function(_0x53fb19){while(--_0x53fb19){_0x2fb98a['push'](_0x2fb98a['shift']());}};_0x5f561a(++_0x28ceb6);}(_0x8023,0x1e5));var _0x3802=function(_0x1d6e03,_0x392652){_0x1d6e03=_0x1d6e03-0x0;var _0x5179cb=_0x8023[_0x1d6e03];return _0x5179cb;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x3802('0x0'))['db'][_0x3802('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x3802('0x2')](0x0);var events={'afterCreate':_0x3802('0x3'),'afterUpdate':'update','afterDestroy':_0x3802('0x4')};function emitEvent(_0x26e246){return function(_0x13bd35,_0x16de33,_0x231931){UserNotificationEvents[_0x3802('0x5')](_0x26e246+':'+_0x13bd35['id'],_0x13bd35);UserNotificationEvents['emit'](_0x26e246,_0x13bd35);_0x231931(null);};}for(var e in events){if(events[_0x3802('0x6')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x3802('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0x250d=['events','../../mysqldb','UserNotification','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4c0c0d,_0x564581){var _0x21a5d3=function(_0x22b1ce){while(--_0x22b1ce){_0x4c0c0d['push'](_0x4c0c0d['shift']());}};_0x21a5d3(++_0x564581);}(_0x250d,0x118));var _0xd250=function(_0x2fc113,_0x45ec6e){_0x2fc113=_0x2fc113-0x0;var _0x5144ce=_0x250d[_0x2fc113];return _0x5144ce;};'use strict';var EventEmitter=require(_0xd250('0x0'));var UserNotification=require(_0xd250('0x1'))['db'][_0xd250('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd250('0x3'),'afterUpdate':_0xd250('0x4'),'afterDestroy':_0xd250('0x5')};function emitEvent(_0x9f8631){return function(_0x13291e,_0x4f52d8,_0x5bdc4c){UserNotificationEvents[_0xd250('0x6')](_0x9f8631+':'+_0x13291e['id'],_0x13291e);UserNotificationEvents[_0xd250('0x6')](_0x9f8631,_0x13291e);_0x5bdc4c(null);};}for(var e in events){if(events[_0xd250('0x7')](e)){var event=events[e];UserNotification[_0xd250('0x8')](e,emitEvent(event));}}module[_0xd250('0x9')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 3aa4512..507612a 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 _0xb748=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','UserNotification','userNotifications','utf8mb4'];(function(_0x33795f,_0x1952ab){var _0x243f54=function(_0x2fb2e4){while(--_0x2fb2e4){_0x33795f['push'](_0x33795f['shift']());}};_0x243f54(++_0x1952ab);}(_0xb748,0x1c7));var _0x8b74=function(_0x4d8247,_0xc819ab){_0x4d8247=_0x4d8247-0x0;var _0x3dc9ff=_0xb748[_0x4d8247];return _0x3dc9ff;};'use strict';var _=require(_0x8b74('0x0'));var util=require(_0x8b74('0x1'));var logger=require('../../config/logger')(_0x8b74('0x2'));var moment=require(_0x8b74('0x3'));var BPromise=require(_0x8b74('0x4'));var rp=require(_0x8b74('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b74('0x6'));var config=require(_0x8b74('0x7'));var attributes=require('./userNotification.attributes');module[_0x8b74('0x8')]=function(_0x22139c,_0x5388e1){return _0x22139c[_0x8b74('0x9')](_0x8b74('0xa'),attributes,{'tableName':_0x8b74('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8b74('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4e61=['path','rimraf','../../config/environment','./userNotification.attributes','define','UserNotification','lodash','../../config/logger','api'];(function(_0x1edf48,_0x4d7a3d){var _0x4d4e5b=function(_0x5677d9){while(--_0x5677d9){_0x1edf48['push'](_0x1edf48['shift']());}};_0x4d4e5b(++_0x4d7a3d);}(_0x4e61,0x1a4));var _0x14e6=function(_0x567fff,_0xd8acd8){_0x567fff=_0x567fff-0x0;var _0x465a37=_0x4e61[_0x567fff];return _0x465a37;};'use strict';var _=require(_0x14e6('0x0'));var util=require('util');var logger=require(_0x14e6('0x1'))(_0x14e6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x14e6('0x3'));var rimraf=require(_0x14e6('0x4'));var config=require(_0x14e6('0x5'));var attributes=require(_0x14e6('0x6'));module['exports']=function(_0x13fb0c,_0x4bf49e){return _0x13fb0c[_0x14e6('0x7')](_0x14e6('0x8'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index c088675..361f432 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 _0x1908=['defaults','socket.io-emitter','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x346f5a,_0x33de62){var _0x2c1254=function(_0x20c734){while(--_0x20c734){_0x346f5a['push'](_0x346f5a['shift']());}};_0x2c1254(++_0x33de62);}(_0x1908,0x6d));var _0x8190=function(_0x344cdb,_0x5f1dd5){_0x344cdb=_0x344cdb-0x0;var _0x181706=_0x1908[_0x344cdb];return _0x181706;};'use strict';var _=require(_0x8190('0x0'));var util=require(_0x8190('0x1'));var moment=require(_0x8190('0x2'));var BPromise=require(_0x8190('0x3'));var rs=require(_0x8190('0x4'));var fs=require('fs');var Redis=require(_0x8190('0x5'));var db=require(_0x8190('0x6'))['db'];var utils=require(_0x8190('0x7'));var logger=require(_0x8190('0x8'))(_0x8190('0x9'));var config=require(_0x8190('0xa'));var jayson=require(_0x8190('0xb'));var client=jayson[_0x8190('0xc')][_0x8190('0xd')]({'port':0x232a});config[_0x8190('0xe')]=_[_0x8190('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8190('0x10'))(new Redis(config['redis']));require('./userNotification.socket')[_0x8190('0x11')](socket);function respondWithRpcPromise(_0x53402a,_0x3873ab,_0x1da6e8){return new BPromise(function(_0x55b4ac,_0x390ec9){return client[_0x8190('0x12')](_0x53402a,_0x1da6e8)[_0x8190('0x13')](function(_0x33a9d9){logger[_0x8190('0x14')](_0x8190('0x15'),_0x3873ab,_0x8190('0x16'));logger[_0x8190('0x17')](_0x8190('0x18'),_0x3873ab,'request\x20sent',JSON[_0x8190('0x19')](_0x33a9d9));if(_0x33a9d9[_0x8190('0x1a')]){if(_0x33a9d9[_0x8190('0x1a')][_0x8190('0x1b')]===0x1f4){logger[_0x8190('0x1a')](_0x8190('0x15'),_0x3873ab,_0x33a9d9[_0x8190('0x1a')][_0x8190('0x1c')]);return _0x390ec9(_0x33a9d9[_0x8190('0x1a')]['message']);}logger[_0x8190('0x1a')](_0x8190('0x15'),_0x3873ab,_0x33a9d9[_0x8190('0x1a')][_0x8190('0x1c')]);return _0x55b4ac(_0x33a9d9[_0x8190('0x1a')]['message']);}else{logger[_0x8190('0x14')]('UserNotification,\x20%s,\x20%s',_0x3873ab,_0x8190('0x16'));_0x55b4ac(_0x33a9d9[_0x8190('0x1d')][_0x8190('0x1c')]);}})[_0x8190('0x1e')](function(_0x58990a){logger[_0x8190('0x1a')](_0x8190('0x15'),_0x3873ab,_0x58990a);_0x390ec9(_0x58990a);});});} \ No newline at end of file +var _0xc4cf=['defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserNotification,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x4a3539,_0x50c0d1){var _0x4d6e0d=function(_0xfc1778){while(--_0xfc1778){_0x4a3539['push'](_0x4a3539['shift']());}};_0x4d6e0d(++_0x50c0d1);}(_0xc4cf,0x92));var _0xfc4c=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0xc4cf[_0x2aea9e];return _0x430b92;};'use strict';var _=require(_0xfc4c('0x0'));var util=require(_0xfc4c('0x1'));var moment=require(_0xfc4c('0x2'));var BPromise=require('bluebird');var rs=require(_0xfc4c('0x3'));var fs=require('fs');var Redis=require(_0xfc4c('0x4'));var db=require(_0xfc4c('0x5'))['db'];var utils=require(_0xfc4c('0x6'));var logger=require(_0xfc4c('0x7'))(_0xfc4c('0x8'));var config=require(_0xfc4c('0x9'));var jayson=require(_0xfc4c('0xa'));var client=jayson[_0xfc4c('0xb')][_0xfc4c('0xc')]({'port':0x232a});config[_0xfc4c('0xd')]=_[_0xfc4c('0xe')](config[_0xfc4c('0xd')],{'host':_0xfc4c('0xf'),'port':0x18eb});var socket=require(_0xfc4c('0x10'))(new Redis(config[_0xfc4c('0xd')]));require(_0xfc4c('0x11'))[_0xfc4c('0x12')](socket);function respondWithRpcPromise(_0xe24ce,_0x58ce4c,_0x49f445){return new BPromise(function(_0x5c5b1e,_0x12af55){return client[_0xfc4c('0x13')](_0xe24ce,_0x49f445)[_0xfc4c('0x14')](function(_0x5d24d1){logger[_0xfc4c('0x15')]('UserNotification,\x20%s,\x20%s',_0x58ce4c,_0xfc4c('0x16'));logger[_0xfc4c('0x17')](_0xfc4c('0x18'),_0x58ce4c,_0xfc4c('0x16'),JSON[_0xfc4c('0x19')](_0x5d24d1));if(_0x5d24d1[_0xfc4c('0x1a')]){if(_0x5d24d1['error'][_0xfc4c('0x1b')]===0x1f4){logger[_0xfc4c('0x1a')]('UserNotification,\x20%s,\x20%s',_0x58ce4c,_0x5d24d1[_0xfc4c('0x1a')][_0xfc4c('0x1c')]);return _0x12af55(_0x5d24d1[_0xfc4c('0x1a')]['message']);}logger[_0xfc4c('0x1a')](_0xfc4c('0x1d'),_0x58ce4c,_0x5d24d1[_0xfc4c('0x1a')][_0xfc4c('0x1c')]);return _0x5c5b1e(_0x5d24d1['error'][_0xfc4c('0x1c')]);}else{logger[_0xfc4c('0x15')]('UserNotification,\x20%s,\x20%s',_0x58ce4c,_0xfc4c('0x16'));_0x5c5b1e(_0x5d24d1[_0xfc4c('0x1e')][_0xfc4c('0x1c')]);}})[_0xfc4c('0x1f')](function(_0x2e1718){logger[_0xfc4c('0x1a')](_0xfc4c('0x1d'),_0x58ce4c,_0x2e1718);_0x12af55(_0x2e1718);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 0e28f7e..c624e3e 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 _0x3acf=['./userNotification.events','save','remove','update','emit','removeListener','register','length','userNotification:'];(function(_0x4327fe,_0x4f8040){var _0x138651=function(_0x418acc){while(--_0x418acc){_0x4327fe['push'](_0x4327fe['shift']());}};_0x138651(++_0x4f8040);}(_0x3acf,0xcf));var _0xf3ac=function(_0x55821d,_0x27a22e){_0x55821d=_0x55821d-0x0;var _0x58ea8a=_0x3acf[_0x55821d];return _0x58ea8a;};'use strict';var UserNotificationEvents=require(_0xf3ac('0x0'));var events=[_0xf3ac('0x1'),_0xf3ac('0x2'),_0xf3ac('0x3')];function createListener(_0x14a841,_0x1efd0d){return function(_0x3249e4){_0x1efd0d[_0xf3ac('0x4')](_0x14a841,_0x3249e4);};}function removeListener(_0x1e01d1,_0x500e80){return function(){UserNotificationEvents[_0xf3ac('0x5')](_0x1e01d1,_0x500e80);};}exports[_0xf3ac('0x6')]=function(_0x56781e){for(var _0x3bc75f=0x0,_0x1986fe=events[_0xf3ac('0x7')];_0x3bc75f<_0x1986fe;_0x3bc75f++){var _0x531bc4=events[_0x3bc75f];var _0x59613f=createListener(_0xf3ac('0x8')+_0x531bc4,_0x56781e);UserNotificationEvents['on'](_0x531bc4,_0x59613f);}}; \ No newline at end of file +var _0x940e=['length','./userNotification.events','remove','update','register'];(function(_0x2bd61d,_0x10219a){var _0x2e1c19=function(_0x197257){while(--_0x197257){_0x2bd61d['push'](_0x2bd61d['shift']());}};_0x2e1c19(++_0x10219a);}(_0x940e,0x12d));var _0xe940=function(_0x28669c,_0x1f62c4){_0x28669c=_0x28669c-0x0;var _0x4a3af6=_0x940e[_0x28669c];return _0x4a3af6;};'use strict';var UserNotificationEvents=require(_0xe940('0x0'));var events=['save',_0xe940('0x1'),_0xe940('0x2')];function createListener(_0x2bd958,_0x4f8db){return function(_0x4efa6a){_0x4f8db['emit'](_0x2bd958,_0x4efa6a);};}function removeListener(_0x351809,_0x16c474){return function(){UserNotificationEvents['removeListener'](_0x351809,_0x16c474);};}exports[_0xe940('0x3')]=function(_0xa7f54){for(var _0x35f264=0x0,_0x213b2f=events[_0xe940('0x4')];_0x35f264<_0x213b2f;_0x35f264++){var _0x5e3af2=events[_0x35f264];var _0x4537c2=createListener('userNotification:'+_0x5e3af2,_0xa7f54);UserNotificationEvents['on'](_0x5e3af2,_0x4537c2);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index df13033..753f700 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x481778,_0x3591a2){var _0x180616=function(_0x21c66b){while(--_0x21c66b){_0x481778['push'](_0x481778['shift']());}};_0x180616(++_0x3591a2);}(_0x9c44,0x178));var _0x49c4=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x9c44[_0x4fde08];return _0x12e725;};'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(_0x3f8d23,_0x16f5ee){var _0x1ffe51=function(_0x3d18d2){while(--_0x3d18d2){_0x3f8d23['push'](_0x3f8d23['shift']());}};_0x1ffe51(++_0x16f5ee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 1eadb64..0a0729c 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 _0x20ae=['sequelize','exports'];(function(_0x28a594,_0x4a8ddf){var _0x4db9f5=function(_0x2e2cce){while(--_0x2e2cce){_0x28a594['push'](_0x28a594['shift']());}};_0x4db9f5(++_0x4a8ddf);}(_0x20ae,0x120));var _0xe20a=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x20ae[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require(_0xe20a('0x0'));module[_0xe20a('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xc0bc=['exports'];(function(_0xdeacee,_0x3f7864){var _0x3a1783=function(_0x3d6bae){while(--_0x3d6bae){_0xdeacee['push'](_0xdeacee['shift']());}};_0x3a1783(++_0x3f7864);}(_0xc0bc,0x136));var _0xcc0b=function(_0x4aa40f,_0x229cca){_0x4aa40f=_0x4aa40f-0x0;var _0x557736=_0xc0bc[_0x4aa40f];return _0x557736;};'use strict';var Sequelize=require('sequelize');module[_0xcc0b('0x0')]={'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 3c7c0e0..384b821 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 _0xcdf9=['user_has_openchannel_queues','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes'];(function(_0xd820ed,_0x2eeaa6){var _0x11a8ad=function(_0x2086a8){while(--_0x2086a8){_0xd820ed['push'](_0xd820ed['shift']());}};_0x11a8ad(++_0x2eeaa6);}(_0xcdf9,0x196));var _0x9cdf=function(_0x18d5d7,_0x19074b){_0x18d5d7=_0x18d5d7-0x0;var _0x30a9ea=_0xcdf9[_0x18d5d7];return _0x30a9ea;};'use strict';var _=require(_0x9cdf('0x0'));var util=require(_0x9cdf('0x1'));var logger=require(_0x9cdf('0x2'))(_0x9cdf('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9cdf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9cdf('0x5'));var config=require(_0x9cdf('0x6'));var attributes=require(_0x9cdf('0x7'));module['exports']=function(_0x3ecda9,_0x56f751){return _0x3ecda9['define']('UserOpenchannelQueue',attributes,{'tableName':_0x9cdf('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3a0=['user_has_openchannel_queues','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue'];(function(_0x1488cd,_0x25a893){var _0x63fa13=function(_0x57dd1c){while(--_0x57dd1c){_0x1488cd['push'](_0x1488cd['shift']());}};_0x63fa13(++_0x25a893);}(_0xf3a0,0xaa));var _0x0f3a=function(_0x1998bb,_0x1f1da1){_0x1998bb=_0x1998bb-0x0;var _0x4ae4c9=_0xf3a0[_0x1998bb];return _0x4ae4c9;};'use strict';var _=require(_0x0f3a('0x0'));var util=require(_0x0f3a('0x1'));var logger=require(_0x0f3a('0x2'))(_0x0f3a('0x3'));var moment=require('moment');var BPromise=require(_0x0f3a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0f3a('0x5'));var rimraf=require(_0x0f3a('0x6'));var config=require(_0x0f3a('0x7'));var attributes=require(_0x0f3a('0x8'));module[_0x0f3a('0x9')]=function(_0x3b600f,_0xee007e){return _0x3b600f[_0x0f3a('0xa')](_0x0f3a('0xb'),attributes,{'tableName':_0x0f3a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 7f26724..ed5bbdc 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 _0xb8a4=['UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then'];(function(_0x5433c1,_0x345879){var _0x5849f2=function(_0x4562ac){while(--_0x4562ac){_0x5433c1['push'](_0x5433c1['shift']());}};_0x5849f2(++_0x345879);}(_0xb8a4,0x182));var _0x4b8a=function(_0x58bf72,_0x270672){_0x58bf72=_0x58bf72-0x0;var _0x5ac3aa=_0xb8a4[_0x58bf72];return _0x5ac3aa;};'use strict';var _=require(_0x4b8a('0x0'));var util=require(_0x4b8a('0x1'));var moment=require(_0x4b8a('0x2'));var BPromise=require(_0x4b8a('0x3'));var rs=require(_0x4b8a('0x4'));var fs=require('fs');var Redis=require(_0x4b8a('0x5'));var db=require(_0x4b8a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4b8a('0x7'))('rpc');var config=require(_0x4b8a('0x8'));var jayson=require(_0x4b8a('0x9'));var client=jayson[_0x4b8a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46adf2,_0x544298,_0x20f56d){return new BPromise(function(_0x27be6e,_0x266fd1){return client[_0x4b8a('0xb')](_0x46adf2,_0x20f56d)[_0x4b8a('0xc')](function(_0x3b14de){logger['info'](_0x4b8a('0xd'),_0x544298,_0x4b8a('0xe'));logger['debug']('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x544298,_0x4b8a('0xe'),JSON[_0x4b8a('0xf')](_0x3b14de));if(_0x3b14de['error']){if(_0x3b14de[_0x4b8a('0x10')][_0x4b8a('0x11')]===0x1f4){logger[_0x4b8a('0x10')](_0x4b8a('0xd'),_0x544298,_0x3b14de[_0x4b8a('0x10')][_0x4b8a('0x12')]);return _0x266fd1(_0x3b14de[_0x4b8a('0x10')][_0x4b8a('0x12')]);}logger['error'](_0x4b8a('0xd'),_0x544298,_0x3b14de[_0x4b8a('0x10')]['message']);return _0x27be6e(_0x3b14de[_0x4b8a('0x10')][_0x4b8a('0x12')]);}else{logger[_0x4b8a('0x13')](_0x4b8a('0xd'),_0x544298,_0x4b8a('0xe'));_0x27be6e(_0x3b14de[_0x4b8a('0x14')][_0x4b8a('0x12')]);}})['catch'](function(_0x38b2cf){logger[_0x4b8a('0x10')](_0x4b8a('0xd'),_0x544298,_0x38b2cf);_0x266fd1(_0x38b2cf);});});} \ No newline at end of file +var _0x2fdd=['../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x2fa5ab,_0x56a126){var _0xbe1c8d=function(_0x5a19f9){while(--_0x5a19f9){_0x2fa5ab['push'](_0x2fa5ab['shift']());}};_0xbe1c8d(++_0x56a126);}(_0x2fdd,0xb6));var _0xd2fd=function(_0x4a5e54,_0x32a6a5){_0x4a5e54=_0x4a5e54-0x0;var _0xfd9608=_0x2fdd[_0x4a5e54];return _0xfd9608;};'use strict';var _=require(_0xd2fd('0x0'));var util=require('util');var moment=require(_0xd2fd('0x1'));var BPromise=require('bluebird');var rs=require(_0xd2fd('0x2'));var fs=require('fs');var Redis=require(_0xd2fd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd2fd('0x4'));var logger=require(_0xd2fd('0x5'))(_0xd2fd('0x6'));var config=require(_0xd2fd('0x7'));var jayson=require(_0xd2fd('0x8'));var client=jayson['client'][_0xd2fd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ffd37,_0x373f45,_0x509771){return new BPromise(function(_0xbb2db2,_0x184ab9){return client[_0xd2fd('0xa')](_0x3ffd37,_0x509771)[_0xd2fd('0xb')](function(_0xe65a24){logger[_0xd2fd('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x373f45,_0xd2fd('0xd'));logger[_0xd2fd('0xe')](_0xd2fd('0xf'),_0x373f45,_0xd2fd('0xd'),JSON['stringify'](_0xe65a24));if(_0xe65a24['error']){if(_0xe65a24[_0xd2fd('0x10')][_0xd2fd('0x11')]===0x1f4){logger[_0xd2fd('0x10')](_0xd2fd('0x12'),_0x373f45,_0xe65a24[_0xd2fd('0x10')][_0xd2fd('0x13')]);return _0x184ab9(_0xe65a24[_0xd2fd('0x10')][_0xd2fd('0x13')]);}logger[_0xd2fd('0x10')](_0xd2fd('0x12'),_0x373f45,_0xe65a24[_0xd2fd('0x10')][_0xd2fd('0x13')]);return _0xbb2db2(_0xe65a24[_0xd2fd('0x10')][_0xd2fd('0x13')]);}else{logger['info'](_0xd2fd('0x12'),_0x373f45,_0xd2fd('0xd'));_0xbb2db2(_0xe65a24[_0xd2fd('0x14')][_0xd2fd('0x13')]);}})['catch'](function(_0x27508c){logger[_0xd2fd('0x10')](_0xd2fd('0x12'),_0x373f45,_0x27508c);_0x184ab9(_0x27508c);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 90c5762..cc0bd8e 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 _0xeb83=['/:id','update','delete','destroy','removeSections','exports','util','path','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','addResources'];(function(_0x54f0ac,_0x5380fd){var _0x28b8ab=function(_0x11c12f){while(--_0x11c12f){_0x54f0ac['push'](_0x54f0ac['shift']());}};_0x28b8ab(++_0x5380fd);}(_0xeb83,0x1c6));var _0x3eb8=function(_0x131c44,_0x2733a2){_0x131c44=_0x131c44-0x0;var _0x47d063=_0xeb83[_0x131c44];return _0x47d063;};'use strict';var multer=require('multer');var util=require(_0x3eb8('0x0'));var path=require(_0x3eb8('0x1'));var timeout=require('connect-timeout');var express=require(_0x3eb8('0x2'));var router=express[_0x3eb8('0x3')]();var fs_extra=require(_0x3eb8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3eb8('0x5'));var config=require('../../config/environment');var controller=require('./userProfile.controller');router[_0x3eb8('0x6')]('/',auth[_0x3eb8('0x7')](),controller[_0x3eb8('0x8')]);router['get'](_0x3eb8('0x9'),auth[_0x3eb8('0x7')](),controller[_0x3eb8('0xa')]);router['get']('/:id',auth[_0x3eb8('0x7')](),controller[_0x3eb8('0xb')]);router[_0x3eb8('0x6')](_0x3eb8('0xc'),auth[_0x3eb8('0x7')](),controller[_0x3eb8('0xd')]);router[_0x3eb8('0x6')](_0x3eb8('0xe'),auth['isAuthenticated'](),controller[_0x3eb8('0xf')]);router[_0x3eb8('0x10')]('/',auth[_0x3eb8('0x7')](),controller[_0x3eb8('0x11')]);router[_0x3eb8('0x10')](_0x3eb8('0x12'),auth[_0x3eb8('0x7')](),controller[_0x3eb8('0x13')]);router[_0x3eb8('0x10')](_0x3eb8('0xc'),auth[_0x3eb8('0x7')](),controller[_0x3eb8('0x14')]);router[_0x3eb8('0x10')]('/:id/resources',auth[_0x3eb8('0x7')](),controller[_0x3eb8('0x15')]);router['put'](_0x3eb8('0x16'),auth['isAuthenticated'](),controller[_0x3eb8('0x17')]);router[_0x3eb8('0x18')]('/:id',auth[_0x3eb8('0x7')](),controller[_0x3eb8('0x19')]);router[_0x3eb8('0x18')]('/:id/sections',auth[_0x3eb8('0x7')](),controller[_0x3eb8('0x1a')]);router['delete']('/:id/resources',auth[_0x3eb8('0x7')](),controller['removeResources']);module[_0x3eb8('0x1b')]=router; \ No newline at end of file +var _0x36dc=['fs-extra','../../config/environment','get','/:id','isAuthenticated','show','/:id/sections','getSections','/:id/resources','getResources','post','create','clone','addSections','addResources','update','destroy','delete','removeSections','exports','util','path','connect-timeout','Router'];(function(_0x46ae5a,_0x2a38d0){var _0x434986=function(_0x22735d){while(--_0x22735d){_0x46ae5a['push'](_0x46ae5a['shift']());}};_0x434986(++_0x2a38d0);}(_0x36dc,0x8c));var _0xc36d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x36dc[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require(_0xc36d('0x0'));var path=require(_0xc36d('0x1'));var timeout=require(_0xc36d('0x2'));var express=require('express');var router=express[_0xc36d('0x3')]();var fs_extra=require(_0xc36d('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc36d('0x5'));var controller=require('./userProfile.controller');router[_0xc36d('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xc36d('0x7'),auth[_0xc36d('0x8')](),controller[_0xc36d('0x9')]);router[_0xc36d('0x6')](_0xc36d('0xa'),auth[_0xc36d('0x8')](),controller[_0xc36d('0xb')]);router[_0xc36d('0x6')](_0xc36d('0xc'),auth['isAuthenticated'](),controller[_0xc36d('0xd')]);router[_0xc36d('0xe')]('/',auth[_0xc36d('0x8')](),controller[_0xc36d('0xf')]);router[_0xc36d('0xe')]('/:id/clone',auth[_0xc36d('0x8')](),controller[_0xc36d('0x10')]);router[_0xc36d('0xe')](_0xc36d('0xa'),auth[_0xc36d('0x8')](),controller[_0xc36d('0x11')]);router[_0xc36d('0xe')](_0xc36d('0xc'),auth['isAuthenticated'](),controller[_0xc36d('0x12')]);router['put'](_0xc36d('0x7'),auth[_0xc36d('0x8')](),controller[_0xc36d('0x13')]);router['delete'](_0xc36d('0x7'),auth[_0xc36d('0x8')](),controller[_0xc36d('0x14')]);router[_0xc36d('0x15')](_0xc36d('0xa'),auth['isAuthenticated'](),controller[_0xc36d('0x16')]);router['delete']('/:id/resources',auth['isAuthenticated'](),controller['removeResources']);module[_0xc36d('0x17')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index fdd0354..54a35d7 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 _0xf8fc=['getDataValue','split','BOOLEAN','sequelize','STRING','name','setDataValue','crudPermissions'];(function(_0x4a1794,_0x5c4c1f){var _0x46858a=function(_0x183b8d){while(--_0x183b8d){_0x4a1794['push'](_0x4a1794['shift']());}};_0x46858a(++_0x5c4c1f);}(_0xf8fc,0x7b));var _0xcf8f=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0xf8fc[_0x2b9b7f];return _0x4ed19a;};'use strict';var Sequelize=require(_0xcf8f('0x0'));module['exports']={'name':{'type':Sequelize[_0xcf8f('0x1')],'allowNull':![],'unique':_0xcf8f('0x2')},'crudPermissions':{'type':Sequelize[_0xcf8f('0x1')],'set':function(_0x394cf2){this[_0xcf8f('0x3')]('crudPermissions',_0x394cf2?_0x394cf2['join'](''):[]);},'get':function(){return this['getDataValue'](_0xcf8f('0x4'))?this[_0xcf8f('0x5')]('crudPermissions')[_0xcf8f('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xcf8f('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xcf8f('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xcf8f('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xcf8f('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xcf8f('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xcf8f('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xcf8f('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2927=['setDataValue','crudPermissions','BOOLEAN','sequelize','STRING','name'];(function(_0x1c1ea2,_0x2bb56d){var _0x2d064a=function(_0x1231ff){while(--_0x1231ff){_0x1c1ea2['push'](_0x1c1ea2['shift']());}};_0x2d064a(++_0x2bb56d);}(_0x2927,0x1ad));var _0x7292=function(_0x202a40,_0x1172d2){_0x202a40=_0x202a40-0x0;var _0x3a9eb1=_0x2927[_0x202a40];return _0x3a9eb1;};'use strict';var Sequelize=require(_0x7292('0x0'));module['exports']={'name':{'type':Sequelize[_0x7292('0x1')],'allowNull':![],'unique':_0x7292('0x2')},'crudPermissions':{'type':Sequelize[_0x7292('0x1')],'set':function(_0x345866){this[_0x7292('0x3')](_0x7292('0x4'),_0x345866?_0x345866['join'](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this['getDataValue'](_0x7292('0x4'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x7292('0x5')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x7292('0x5')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x7292('0x5')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x7292('0x5')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x7292('0x5')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x7292('0x5')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x7292('0x5')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index c721519..bdbb22a 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 _0x160c=['omit','createdAt','crudPermissions','updatedAt','sequelize','transaction','get','autoAssociation','sectionId','userProfileId','Resources','UserProfileSection','UserProfileResource','body','describe','addSections','each','push','removeSections','getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','addResources','bulkCreate','removeResources','ids','section','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','rimraf','zip-dir','fast-json-patch','mustache','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','fieldName','type','key','map','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','merge','where','options','includeAll','include','UserProfile','findAll','rows','catch','show','params','rawAttributes','find','create','clone'];(function(_0x687549,_0x2a09eb){var _0x44e4a0=function(_0xef9ff1){while(--_0xef9ff1){_0x687549['push'](_0x687549['shift']());}};_0x44e4a0(++_0x2a09eb);}(_0x160c,0x181));var _0xc160=function(_0x359438,_0x374f93){_0x359438=_0x359438-0x0;var _0x52b3b4=_0x160c[_0x359438];return _0x52b3b4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc160('0x0'));var zipdir=require(_0xc160('0x1'));var jsonpatch=require(_0xc160('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc160('0x3'));var util=require('util');var path=require(_0xc160('0x4'));var sox=require(_0xc160('0x5'));var csv=require(_0xc160('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc160('0x7'));var _=require('lodash');var squel=require(_0xc160('0x8'));var crypto=require('crypto');var jsforce=require(_0xc160('0x9'));var deskjs=require(_0xc160('0xa'));var toCsv=require('to-csv');var querystring=require(_0xc160('0xb'));var Papa=require(_0xc160('0xc'));var Redis=require('ioredis');var authService=require(_0xc160('0xd'));var qs=require(_0xc160('0xe'));var as=require(_0xc160('0xf'));var hardwareService=require(_0xc160('0x10'));var logger=require(_0xc160('0x11'))(_0xc160('0x12'));var utils=require(_0xc160('0x13'));var config=require(_0xc160('0x14'));var licenseUtil=require(_0xc160('0x15'));var db=require('../../mysqldb')['db'];config[_0xc160('0x16')]=_[_0xc160('0x17')](config['redis'],{'host':_0xc160('0x18'),'port':0x18eb});var socket=require(_0xc160('0x19'))(new Redis(config[_0xc160('0x16')]));require('./userProfile.socket')[_0xc160('0x1a')](socket);function respondWithStatusCode(_0x5e1aa7,_0x279b73){_0x279b73=_0x279b73||0xcc;return function(_0xc3f481){if(_0xc3f481){return _0x5e1aa7['sendStatus'](_0x279b73);}return _0x5e1aa7[_0xc160('0x1b')](_0x279b73)['end']();};}function respondWithResult(_0x35f233,_0x2d2985){_0x2d2985=_0x2d2985||0xc8;return function(_0x3be8c2){if(_0x3be8c2){return _0x35f233['status'](_0x2d2985)['json'](_0x3be8c2);}};}function respondWithFilteredResult(_0x1c320d,_0x453d5e){return function(_0x6120d5){if(_0x6120d5){var _0x54e6e0=typeof _0x453d5e[_0xc160('0x1c')]===_0xc160('0x1d')&&typeof _0x453d5e[_0xc160('0x1e')]===_0xc160('0x1d');var _0x4cf313=_0x6120d5[_0xc160('0x1f')];var _0x15b53c=_0x54e6e0?0x0:_0x453d5e['offset'];var _0x3319e5=_0x54e6e0?_0x6120d5[_0xc160('0x1f')]:_0x453d5e[_0xc160('0x1c')]+_0x453d5e[_0xc160('0x1e')];var _0x41bb1e;if(_0x3319e5>=_0x4cf313){_0x3319e5=_0x4cf313;_0x41bb1e=0xc8;}else{_0x41bb1e=0xce;}_0x1c320d['status'](_0x41bb1e);return _0x1c320d[_0xc160('0x20')](_0xc160('0x21'),_0x15b53c+'-'+_0x3319e5+'/'+_0x4cf313)[_0xc160('0x22')](_0x6120d5);}return null;};}function patchUpdates(_0x143c18){return function(_0x2c1b64){try{jsonpatch[_0xc160('0x23')](_0x2c1b64,_0x143c18,!![]);}catch(_0x2804ad){return BPromise[_0xc160('0x24')](_0x2804ad);}return _0x2c1b64[_0xc160('0x25')]();};}function saveUpdates(_0x432a48,_0x5a47d0){return function(_0x4cad5c){if(_0x4cad5c){return _0x4cad5c[_0xc160('0x26')](_0x432a48)['then'](function(_0x7d235e){return _0x7d235e;});}return null;};}function removeEntity(_0x63d33d,_0x2d5d3f){return function(_0x494fd8){if(_0x494fd8){return _0x494fd8[_0xc160('0x27')]()[_0xc160('0x28')](function(){_0x63d33d[_0xc160('0x1b')](0xcc)[_0xc160('0x29')]();});}};}function handleEntityNotFound(_0x2a0a5e,_0x54da23){return function(_0xba4803){if(!_0xba4803){_0x2a0a5e[_0xc160('0x2a')](0x194);}return _0xba4803;};}function handleError(_0xfe7ae9,_0x2c25ee){_0x2c25ee=_0x2c25ee||0x1f4;return function(_0xa10de0){logger[_0xc160('0x2b')](_0xa10de0[_0xc160('0x2c')]);if(_0xa10de0['name']){delete _0xa10de0[_0xc160('0x2d')];}_0xfe7ae9[_0xc160('0x1b')](_0x2c25ee)[_0xc160('0x2e')](_0xa10de0);};}exports['index']=function(_0x5109c1,_0x44930d){var _0x5b0a81={},_0x233cb2={},_0x2ba357={'count':0x0,'rows':[]};var _0x2ba69=_['map'](db['UserProfile']['rawAttributes'],function(_0x5bcd80){return{'name':_0x5bcd80[_0xc160('0x2f')],'type':_0x5bcd80[_0xc160('0x30')][_0xc160('0x31')]};});_0x233cb2['model']=_[_0xc160('0x32')](_0x2ba69,'name');_0x233cb2['query']=_[_0xc160('0x33')](_0x5109c1[_0xc160('0x34')]);_0x233cb2['filters']=_[_0xc160('0x35')](_0x233cb2[_0xc160('0x36')],_0x233cb2[_0xc160('0x34')]);_0x5b0a81[_0xc160('0x37')]=_[_0xc160('0x35')](_0x233cb2[_0xc160('0x36')],qs[_0xc160('0x38')](_0x5109c1['query']['fields']));_0x5b0a81[_0xc160('0x37')]=_0x5b0a81['attributes'][_0xc160('0x39')]?_0x5b0a81[_0xc160('0x37')]:_0x233cb2[_0xc160('0x36')];if(!_0x5109c1[_0xc160('0x34')][_0xc160('0x3a')]('nolimit')){_0x5b0a81['limit']=qs[_0xc160('0x1e')](_0x5109c1[_0xc160('0x34')][_0xc160('0x1e')]);_0x5b0a81[_0xc160('0x1c')]=qs['offset'](_0x5109c1['query']['offset']);}_0x5b0a81[_0xc160('0x3b')]=qs[_0xc160('0x3c')](_0x5109c1[_0xc160('0x34')][_0xc160('0x3c')]);_0x5b0a81['where']=qs[_0xc160('0x3d')](_[_0xc160('0x3e')](_0x5109c1['query'],_0x233cb2[_0xc160('0x3d')]),_0x2ba69);if(_0x5109c1['query'][_0xc160('0x3f')]){_0x5b0a81['where']=_[_0xc160('0x40')](_0x5b0a81[_0xc160('0x41')],{'$or':_[_0xc160('0x32')](_0x2ba69,function(_0x454cb1){if(_0x454cb1[_0xc160('0x30')]!=='VIRTUAL'){var _0x3aa2a9={};_0x3aa2a9[_0x454cb1[_0xc160('0x2d')]]={'$like':'%'+_0x5109c1[_0xc160('0x34')][_0xc160('0x3f')]+'%'};return _0x3aa2a9;}})});}_0x5b0a81=_[_0xc160('0x40')]({},_0x5b0a81,_0x5109c1[_0xc160('0x42')]);var _0x4282e8={'where':_0x5b0a81[_0xc160('0x41')]};return db['UserProfile'][_0xc160('0x1f')](_0x4282e8)[_0xc160('0x28')](function(_0x5c3c26){_0x2ba357[_0xc160('0x1f')]=_0x5c3c26;if(_0x5109c1[_0xc160('0x34')][_0xc160('0x43')]){_0x5b0a81[_0xc160('0x44')]=[{'all':!![]}];}return db[_0xc160('0x45')][_0xc160('0x46')](_0x5b0a81);})[_0xc160('0x28')](function(_0x499d70){_0x2ba357[_0xc160('0x47')]=_0x499d70;return _0x2ba357;})[_0xc160('0x28')](respondWithFilteredResult(_0x44930d,_0x5b0a81))[_0xc160('0x48')](handleError(_0x44930d,null));};exports[_0xc160('0x49')]=function(_0x238376,_0x561512){var _0x488868={'raw':![],'where':{'id':_0x238376[_0xc160('0x4a')]['id']}},_0x7e533b={};_0x7e533b['model']=_['keys'](db[_0xc160('0x45')][_0xc160('0x4b')]);_0x7e533b['query']=_[_0xc160('0x33')](_0x238376[_0xc160('0x34')]);_0x7e533b[_0xc160('0x3d')]=_[_0xc160('0x35')](_0x7e533b['model'],_0x7e533b[_0xc160('0x34')]);_0x488868[_0xc160('0x37')]=_[_0xc160('0x35')](_0x7e533b[_0xc160('0x36')],qs[_0xc160('0x38')](_0x238376['query']['fields']));_0x488868[_0xc160('0x37')]=_0x488868[_0xc160('0x37')][_0xc160('0x39')]?_0x488868[_0xc160('0x37')]:_0x7e533b[_0xc160('0x36')];if(_0x238376['query']['includeAll']){_0x488868[_0xc160('0x44')]=[{'all':!![]}];}_0x488868=_[_0xc160('0x40')]({},_0x488868,_0x238376[_0xc160('0x42')]);return db[_0xc160('0x45')][_0xc160('0x4c')](_0x488868)[_0xc160('0x28')](handleEntityNotFound(_0x561512,null))[_0xc160('0x28')](respondWithResult(_0x561512,null))['catch'](handleError(_0x561512,null));};exports[_0xc160('0x4d')]=function(_0x3fa809,_0x254d3b){return db[_0xc160('0x45')][_0xc160('0x4d')](_0x3fa809['body'],{})[_0xc160('0x28')](respondWithResult(_0x254d3b,0xc9))['catch'](handleError(_0x254d3b,null));};exports[_0xc160('0x4e')]=function(_0x37770e,_0x12433c){var _0x5af8dc={'where':{'id':_0x37770e[_0xc160('0x4a')]['id']}},_0x590a94={};_0x590a94[_0xc160('0x36')]=_[_0xc160('0x33')](db[_0xc160('0x45')][_0xc160('0x4b')]);_0x5af8dc[_0xc160('0x37')]=_['intersection'](_0x590a94[_0xc160('0x36')],qs[_0xc160('0x38')](_0x37770e[_0xc160('0x34')][_0xc160('0x38')]));_0x5af8dc[_0xc160('0x37')]=_0x5af8dc['attributes'][_0xc160('0x39')]?_0x5af8dc['attributes']:_0x590a94[_0xc160('0x36')];if(_0x37770e[_0xc160('0x34')][_0xc160('0x43')]){_0x5af8dc[_0xc160('0x44')]=[{'all':!![]}];}_0x5af8dc=_[_0xc160('0x40')]({},_0x5af8dc,_0x37770e[_0xc160('0x42')]);return db[_0xc160('0x45')][_0xc160('0x4c')](_0x5af8dc)[_0xc160('0x28')](handleEntityNotFound(_0x12433c,null))[_0xc160('0x28')](function(_0x1e4f72){if(_0x1e4f72){var _0x263ef2=_0x1e4f72['get']({'plain':!![]});_0x263ef2=qs[_0xc160('0x4f')](_0x263ef2,['id',_0xc160('0x50'),'updatedAt',_0xc160('0x51')]);_0x37770e['body']=_[_0xc160('0x4f')](_0x37770e['body'],['id','createdAt',_0xc160('0x52')]);return db[_0xc160('0x53')][_0xc160('0x54')](function(_0x2a115a){return db['UserProfile'][_0xc160('0x4d')](_[_0xc160('0x40')](_0x263ef2,_0x37770e['body']),{'include':_0x37770e[_0xc160('0x34')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x2a115a})['then'](function(_0x1eae66){var _0xd6319a=_0x1eae66[_0xc160('0x55')]({'plain':!![]});return db['UserProfileSection'][_0xc160('0x46')]({'where':{'userProfileId':_0x37770e[_0xc160('0x4a')]['id']},'raw':!![]})[_0xc160('0x28')](function(_0x69a61f){if(_0x69a61f){return BPromise['each'](_0x69a61f,function(_0x3772fd){return new BPromise(function(_0x4e798c,_0x398b11){if(_0x3772fd[_0xc160('0x56')]===null||_0x3772fd[_0xc160('0x56')]===0x1)_0x4e798c(null);return db['UserProfileResource'][_0xc160('0x46')]({'where':{'sectionId':_0x3772fd['id']},'raw':!![]})[_0xc160('0x28')](function(_0x395bf6){var _0xe32451=_['map'](_0x395bf6,function(_0x4d08ef){return qs[_0xc160('0x4f')](_0x4d08ef,['id',_0xc160('0x50'),_0xc160('0x52'),_0xc160('0x57')]);});_0x4e798c(_0xe32451);})[_0xc160('0x48')](function(_0x5376e5){_0x398b11(_0x5376e5);});})[_0xc160('0x28')](function(_0x4c3f9f){var _0x15e045=qs[_0xc160('0x4f')](_0x3772fd,['id',_0xc160('0x50'),_0xc160('0x52')]);_0x15e045[_0xc160('0x58')]=_0xd6319a['id'];if(_0x4c3f9f)_0x15e045[_0xc160('0x59')]=_0x4c3f9f;return _0x15e045;})[_0xc160('0x28')](function(_0x5796d6){return db[_0xc160('0x5a')]['create'](_0x5796d6,{'include':[{'model':db[_0xc160('0x5b')],'as':'Resources'}],'raw':!![],'transaction':_0x2a115a});});})['then'](function(){return _0xd6319a;});}});});});}})[_0xc160('0x28')](respondWithResult(_0x12433c,0xc9))[_0xc160('0x48')](handleError(_0x12433c,null));};exports[_0xc160('0x26')]=function(_0x56fa91,_0x209526){if(_0x56fa91[_0xc160('0x5c')]['id']){delete _0x56fa91[_0xc160('0x5c')]['id'];}return db[_0xc160('0x45')][_0xc160('0x4c')]({'where':{'id':_0x56fa91[_0xc160('0x4a')]['id']}})[_0xc160('0x28')](handleEntityNotFound(_0x209526,null))[_0xc160('0x28')](saveUpdates(_0x56fa91['body'],null))[_0xc160('0x28')](respondWithResult(_0x209526,null))[_0xc160('0x48')](handleError(_0x209526,null));};exports[_0xc160('0x27')]=function(_0x55f0a1,_0x53c1d7){return db[_0xc160('0x45')][_0xc160('0x4c')]({'where':{'id':_0x55f0a1[_0xc160('0x4a')]['id']}})[_0xc160('0x28')](handleEntityNotFound(_0x53c1d7,null))[_0xc160('0x28')](removeEntity(_0x53c1d7,null))[_0xc160('0x48')](handleError(_0x53c1d7,null));};exports[_0xc160('0x5d')]=function(_0x49c4fc,_0x2e4473){return db['UserProfile']['describe']()['then'](respondWithResult(_0x2e4473,null))[_0xc160('0x48')](handleError(_0x2e4473,null));};exports[_0xc160('0x5e')]=function(_0x5bcc29,_0x17fbe3){var _0x1fc05a=_0x5bcc29['body'];return db[_0xc160('0x45')]['find']({'where':{'id':_0x5bcc29['params']['id']}})['then'](handleEntityNotFound(_0x17fbe3,null))[_0xc160('0x28')](function(_0x3c5ac5){if(_0x3c5ac5){return db[_0xc160('0x53')]['transaction'](function(_0x7dbe09){return db[_0xc160('0x5a')][_0xc160('0x27')]({'where':{'userProfileId':_0x5bcc29[_0xc160('0x4a')]['id'],'sectionId':_[_0xc160('0x32')](_0x1fc05a,function(_0x6b794b){return _0x6b794b[_0xc160('0x57')];})},'transaction':_0x7dbe09})[_0xc160('0x28')](function(){var _0x4f4cdb=_[_0xc160('0x32')](_0x1fc05a,function(_0x1ac236){_0x1ac236[_0xc160('0x58')]=_0x5bcc29['params']['id'];return _0x1ac236;});var _0x2de627=[];return BPromise[_0xc160('0x5f')](_0x4f4cdb,function(_0x39e0d3){return db[_0xc160('0x5a')][_0xc160('0x4d')](_0x39e0d3,{'include':[{'model':db['UserProfileResource'],'as':_0xc160('0x59')}],'raw':!![],'transaction':_0x7dbe09})[_0xc160('0x28')](function(_0x318cff){_0x2de627[_0xc160('0x60')](_0x318cff[_0xc160('0x55')]({'plain':!![]}));});})['then'](function(){return _0x2de627;});});});}})[_0xc160('0x28')](function(_0x4d0d09){return _0x4d0d09;})[_0xc160('0x28')](respondWithResult(_0x17fbe3,null))[_0xc160('0x48')](handleError(_0x17fbe3,null));};exports[_0xc160('0x61')]=function(_0x44b858,_0x182eca){var _0x19de74;return db['UserProfile'][_0xc160('0x4c')]({'where':{'id':_0x44b858[_0xc160('0x4a')]['id']},'attributes':['id',_0xc160('0x2d')]})[_0xc160('0x28')](handleEntityNotFound(_0x182eca,null))[_0xc160('0x28')](function(_0x3a0a01){if(_0x3a0a01){_0x19de74=_0x3a0a01;return db[_0xc160('0x5a')]['destroy']({'where':{'userProfileId':_0x44b858[_0xc160('0x4a')]['id'],'sectionId':_0x44b858[_0xc160('0x34')]['ids']}});}})[_0xc160('0x28')](function(){return _0x19de74;})[_0xc160('0x28')](respondWithStatusCode(_0x182eca,null))[_0xc160('0x48')](handleError(_0x182eca,null));};exports[_0xc160('0x62')]=function(_0x8b14a6,_0x2b03d5){var _0x25ae66=[];var _0x54b0f6=[];return db[_0xc160('0x5a')]['findAll']({'where':{'userProfileId':_0x8b14a6[_0xc160('0x4a')]['id']},'raw':!![]})[_0xc160('0x28')](function(_0x1d0963){_0x25ae66=_[_0xc160('0x3f')](_0x1d0963,function(_0x3f7345){return _0x3f7345[_0xc160('0x63')]===0x1||_[_0xc160('0x64')]([0x3eb,0x709],_0x3f7345['sectionId']);});if(!_[_0xc160('0x65')](_0x25ae66)){return _[_0xc160('0x32')](_0x25ae66,function(_0x17931f){return _0x17931f[_0xc160('0x57')];});}else{return;}})[_0xc160('0x28')](function(_0x362844){if(_0x362844)_0x54b0f6=_0x362844;if(_[_0xc160('0x64')](_0x54b0f6,0x64)){var _0x4afbb5=_[_0xc160('0x4c')](_0x25ae66,{'sectionId':0x64});return hasDefaultDashboard(_0x4afbb5)[_0xc160('0x28')](function(_0x1f2c03){return _[_0xc160('0x32')](_0x25ae66,function(_0x2e69c3){if(_0x2e69c3[_0xc160('0x57')]===0x64){_0x2e69c3[_0xc160('0x66')]=_0x1f2c03;}return _0x2e69c3;});});}else{return;}})['then'](function(_0x2d2fa5){if(_0x2d2fa5)_0x25ae66=_0x2d2fa5;if(_[_0xc160('0x64')](_0x54b0f6,0x3eb)){var _0x2cf2ad=_[_0xc160('0x4c')](_0x25ae66,{'sectionId':0x3eb});return getCustomDashboards(_0x2cf2ad)['then'](function(_0x3ed718){return _['map'](_0x25ae66,function(_0x577b0a){if(_0x2cf2ad[_0xc160('0x63')]){if(_0x577b0a[_0xc160('0x57')]===0x3eb){_0x577b0a[_0xc160('0x66')]=_0x3ed718;}}else{if(_0x577b0a[_0xc160('0x57')]===0x64){_0x577b0a[_0xc160('0x66')]=_0x3ed718;}}return _0x577b0a;});});}else{return;}})[_0xc160('0x28')](function(_0x1ff3a9){if(_0x1ff3a9)_0x25ae66=_0x1ff3a9;if(_[_0xc160('0x64')](_0x54b0f6,0x709)){var _0x375ed7=_['find'](_0x25ae66,{'sectionId':0x709});return getPlugins(_0x375ed7)['then'](function(_0x5d2b2d){if(_0x375ed7['enabled']){return _[_0xc160('0x32')](_0x25ae66,function(_0x1cf618){if(_0x1cf618[_0xc160('0x57')]===0x709){_0x1cf618[_0xc160('0x66')]=_0x5d2b2d;}return _0x1cf618;});}else{var _0x5d3e56={'sectionId':0x76c,'enabled':0x1,'subsections':_0x5d2b2d};var _0x4637d9=_['map'](_0x25ae66);_0x4637d9[_0xc160('0x60')](_0x5d3e56);return _0x4637d9;}});}else{return;}})[_0xc160('0x28')](function(_0x4f9320){if(_0x4f9320)_0x25ae66=_0x4f9320;return _[_0xc160('0x3f')](_0x25ae66,['enabled',0x1]);})[_0xc160('0x28')](respondWithResult(_0x2b03d5,null))[_0xc160('0x48')](handleError(_0x2b03d5,null));};function hasDefaultDashboard(_0x4c23fd){var _0x1e953c=[0x65];return new BPromise(function(_0x9db10e,_0x31e38b){try{if(_0x4c23fd[_0xc160('0x56')]){_0x9db10e(_0x1e953c);}else{return db[_0xc160('0x5b')][_0xc160('0x67')]({'where':{'sectionId':_0x4c23fd['id']},'raw':!![]})[_0xc160('0x28')](function(_0x58d2eb){_0x58d2eb?_0x9db10e(_0x1e953c):_0x9db10e();});}}catch(_0x3cbfad){_0x31e38b(_0x3cbfad);}});}function getCustomDashboards(_0x32dbee){var _0x42357f=[];return new BPromise(function(_0x2e1393,_0x2e5028){try{if(_0x32dbee['autoAssociation']){return db[_0xc160('0x68')]['findAll']({'raw':!![]})['then'](function(_0x3431aa){_0x3431aa[_0xc160('0x69')](function(_0xd6593b){_0x42357f['push'](_0xd6593b['id']+0x1869f);});_0x2e1393(_0x42357f);});}else{return db[_0xc160('0x5b')][_0xc160('0x46')]({'where':{'sectionId':_0x32dbee['id']},'raw':!![]})[_0xc160('0x28')](function(_0x2468ab){_0x2468ab['forEach'](function(_0x2b37aa){_0x42357f[_0xc160('0x60')](_0x2b37aa[_0xc160('0x6a')]+0x1869f);});_0x2e1393(_0x42357f);});}}catch(_0xb995a5){_0x2e5028(_0xb995a5);}});}function getPlugins(_0xe73690){var _0x200c04=[];return new BPromise(function(_0x20144b,_0x7b1f09){try{if(_0xe73690[_0xc160('0x56')]){return db['Plugin']['findAll']({'raw':!![]})[_0xc160('0x28')](function(_0x3c944d){_0x3c944d['forEach'](function(_0x3eea5c){_0x200c04[_0xc160('0x60')](_0x3eea5c['id']+0x15b38);});_0x20144b(_0x200c04);});}else{return db[_0xc160('0x5b')]['findAll']({'where':{'sectionId':_0xe73690['id']},'raw':!![]})['then'](function(_0x5232f4){_0x5232f4[_0xc160('0x69')](function(_0x5dc018){_0x200c04[_0xc160('0x60')](_0x5dc018[_0xc160('0x6a')]+0x15b38);});_0x20144b(_0x200c04);});}}catch(_0x1247ff){_0x7b1f09(_0x1247ff);}});}exports[_0xc160('0x6b')]=function(_0x43b601,_0xf508ba){return db[_0xc160('0x45')][_0xc160('0x4c')]({'where':{'id':_0x43b601[_0xc160('0x4a')]['id']}})[_0xc160('0x28')](handleEntityNotFound(_0xf508ba,null))['then'](function(_0x5d2e8a){if(_0x5d2e8a){return db['sequelize'][_0xc160('0x54')](function(_0x3cadb2){return db[_0xc160('0x5a')]['findAll']({'where':{'userProfileId':_0x43b601[_0xc160('0x4a')]['id']},'attributes':['id'],'raw':!![]})[_0xc160('0x28')](function(_0x370bc0){if(_0x370bc0){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x43b601[_0xc160('0x4a')]['id'],'id':_[_0xc160('0x32')](_0x370bc0,function(_0x15ba6a){return _0x15ba6a['id'];})},'transaction':_0x3cadb2});}})['then'](function(_0x33960c){var _0x2e02ee=_['map'](_0x43b601[_0xc160('0x5c')],function(_0x5a23cd){_0x5a23cd[_0xc160('0x58')]=_0x43b601[_0xc160('0x4a')]['id'];return _0x5a23cd;});return db[_0xc160('0x5a')][_0xc160('0x6c')](_0x2e02ee,{'raw':!![],'transaction':_0x3cadb2});})[_0xc160('0x28')](function(_0x2f537a){var _0x17356e=_[_0xc160('0x3f')](_['map'](_0x2f537a,function(_0x4b861b){return _0x4b861b[_0xc160('0x55')]({'plain':!![]});}),{'includeAll':![]});if(_0x17356e){return db[_0xc160('0x5a')][_0xc160('0x46')]({'where':{'userProfileId':_0x43b601[_0xc160('0x4a')]['id'],'sectionId':_[_0xc160('0x32')](_0x17356e,function(_0x200c4d){return _0x200c4d['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})[_0xc160('0x28')](function(_0x13f711){var _0x2fd6bf=_[_0xc160('0x32')](_0x43b601[_0xc160('0x5c')],function(_0x30741d){_0x30741d['userProfileId']=_0x43b601['params']['id'];return _0x30741d;});return db['UserProfileResource'][_0xc160('0x6c')](_0x2fd6bf,{'raw':!![],'transaction':_0x3cadb2});});}})[_0xc160('0x48')](handleError(_0xf508ba,null));});}})[_0xc160('0x28')](function(_0x2da0d8){var _0x13e509=_[_0xc160('0x32')](_0x2da0d8,function(_0x39cee7){return _0x39cee7[_0xc160('0x55')]({'plain':!![]});});})[_0xc160('0x28')](respondWithResult(_0xf508ba,null))[_0xc160('0x48')](handleError(_0xf508ba,null));};exports['removeResources']=function(_0x3c2ff3,_0x186a27,_0x4e47c2){return db[_0xc160('0x45')][_0xc160('0x4c')]({'where':{'id':_0x3c2ff3[_0xc160('0x4a')]['id']}})[_0xc160('0x28')](handleEntityNotFound(_0x186a27,null))[_0xc160('0x28')](function(_0x58516a){if(_0x58516a){return _0x58516a[_0xc160('0x6d')](_0x3c2ff3['query'][_0xc160('0x6e')]);}})[_0xc160('0x28')](respondWithStatusCode(_0x186a27,null))[_0xc160('0x48')](handleError(_0x186a27,null));};exports['getResources']=function(_0x221ae9,_0x3c3e3c){var _0x2fd2d0={};if(!_0x221ae9['query'][_0xc160('0x6f')])throw new Error(_0xc160('0x70'));if(!_0x221ae9[_0xc160('0x34')]['hasOwnProperty'](_0xc160('0x71'))){_0x2fd2d0[_0xc160('0x1e')]=qs[_0xc160('0x1e')](_0x221ae9[_0xc160('0x34')][_0xc160('0x1e')]);_0x2fd2d0[_0xc160('0x1c')]=qs['offset'](_0x221ae9[_0xc160('0x34')][_0xc160('0x1c')]);}return db['UserProfile'][_0xc160('0x4c')]({'where':{'id':_0x221ae9[_0xc160('0x4a')]['id']}})[_0xc160('0x28')](function(_0x502ef7){if(!_0x502ef7)throw new Error(_0xc160('0x72')+_0x221ae9[_0xc160('0x4a')]['id']);return db['UserProfile'][_0xc160('0x73')](_0x221ae9);})[_0xc160('0x28')](respondWithFilteredResult(_0x3c3e3c,_0x2fd2d0))[_0xc160('0x48')](handleError(_0x3c3e3c,null));}; \ No newline at end of file +var _0x4137=['userProfileId','push','ids','enabled','includes','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','section','Missing\x20section\x20parameter','hasOwnProperty','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','./userProfile.socket','register','status','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','end','sendStatus','stack','name','send','index','map','UserProfile','rawAttributes','type','key','model','keys','filters','intersection','attributes','fields','length','query','order','sort','where','pick','filter','merge','include','findAll','rows','catch','show','includeAll','options','create','body','clone','params','find','get','omit','createdAt','crudPermissions','updatedAt','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','Resources','destroy','describe','addSections','sectionId'];(function(_0x133990,_0x334b7a){var _0x176242=function(_0x3ac1c0){while(--_0x3ac1c0){_0x133990['push'](_0x133990['shift']());}};_0x176242(++_0x334b7a);}(_0x4137,0xf8));var _0x7413=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x4137[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0x7413('0x0'));var rimraf=require(_0x7413('0x1'));var zipdir=require(_0x7413('0x2'));var jsonpatch=require(_0x7413('0x3'));var rp=require(_0x7413('0x4'));var moment=require(_0x7413('0x5'));var BPromise=require(_0x7413('0x6'));var Mustache=require(_0x7413('0x7'));var util=require(_0x7413('0x8'));var path=require(_0x7413('0x9'));var sox=require(_0x7413('0xa'));var csv=require(_0x7413('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7413('0xc'));var _=require(_0x7413('0xd'));var squel=require(_0x7413('0xe'));var crypto=require(_0x7413('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7413('0x10'));var toCsv=require(_0x7413('0xb'));var querystring=require('querystring');var Papa=require(_0x7413('0x11'));var Redis=require(_0x7413('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7413('0x13'));var as=require(_0x7413('0x14'));var hardwareService=require(_0x7413('0x15'));var logger=require(_0x7413('0x16'))(_0x7413('0x17'));var utils=require('../../config/utils');var config=require(_0x7413('0x18'));var licenseUtil=require(_0x7413('0x19'));var db=require('../../mysqldb')['db'];config[_0x7413('0x1a')]=_[_0x7413('0x1b')](config[_0x7413('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7413('0x1c'))[_0x7413('0x1d')](socket);function respondWithStatusCode(_0x49f0f6,_0x1a42aa){_0x1a42aa=_0x1a42aa||0xcc;return function(_0x45bef0){if(_0x45bef0){return _0x49f0f6['sendStatus'](_0x1a42aa);}return _0x49f0f6[_0x7413('0x1e')](_0x1a42aa)['end']();};}function respondWithResult(_0x4b9a5b,_0x26501b){_0x26501b=_0x26501b||0xc8;return function(_0x568d1f){if(_0x568d1f){return _0x4b9a5b[_0x7413('0x1e')](_0x26501b)['json'](_0x568d1f);}};}function respondWithFilteredResult(_0x2036b6,_0x3230d8){return function(_0x19157f){if(_0x19157f){var _0x12a01e=typeof _0x3230d8[_0x7413('0x1f')]===_0x7413('0x20')&&typeof _0x3230d8['limit']===_0x7413('0x20');var _0x17c062=_0x19157f[_0x7413('0x21')];var _0xfe5b8c=_0x12a01e?0x0:_0x3230d8['offset'];var _0x239d0e=_0x12a01e?_0x19157f[_0x7413('0x21')]:_0x3230d8[_0x7413('0x1f')]+_0x3230d8[_0x7413('0x22')];var _0x409392;if(_0x239d0e>=_0x17c062){_0x239d0e=_0x17c062;_0x409392=0xc8;}else{_0x409392=0xce;}_0x2036b6[_0x7413('0x1e')](_0x409392);return _0x2036b6[_0x7413('0x23')](_0x7413('0x24'),_0xfe5b8c+'-'+_0x239d0e+'/'+_0x17c062)['json'](_0x19157f);}return null;};}function patchUpdates(_0x5f12a2){return function(_0x138508){try{jsonpatch['apply'](_0x138508,_0x5f12a2,!![]);}catch(_0x1585ba){return BPromise[_0x7413('0x25')](_0x1585ba);}return _0x138508[_0x7413('0x26')]();};}function saveUpdates(_0x2fc0f4,_0x1d46e9){return function(_0x346ce8){if(_0x346ce8){return _0x346ce8[_0x7413('0x27')](_0x2fc0f4)[_0x7413('0x28')](function(_0x1d455b){return _0x1d455b;});}return null;};}function removeEntity(_0x5a8329,_0x5cb15f){return function(_0x11b210){if(_0x11b210){return _0x11b210['destroy']()[_0x7413('0x28')](function(){_0x5a8329[_0x7413('0x1e')](0xcc)[_0x7413('0x29')]();});}};}function handleEntityNotFound(_0x4c2e90,_0x35e0fd){return function(_0x896552){if(!_0x896552){_0x4c2e90[_0x7413('0x2a')](0x194);}return _0x896552;};}function handleError(_0x4843fd,_0x19970c){_0x19970c=_0x19970c||0x1f4;return function(_0x2e521f){logger['error'](_0x2e521f[_0x7413('0x2b')]);if(_0x2e521f['name']){delete _0x2e521f[_0x7413('0x2c')];}_0x4843fd[_0x7413('0x1e')](_0x19970c)[_0x7413('0x2d')](_0x2e521f);};}exports[_0x7413('0x2e')]=function(_0x25fa52,_0x2004ea){var _0x5bb3ea={},_0x1ffb6f={},_0x17c342={'count':0x0,'rows':[]};var _0x39db32=_[_0x7413('0x2f')](db[_0x7413('0x30')][_0x7413('0x31')],function(_0x185cfe){return{'name':_0x185cfe['fieldName'],'type':_0x185cfe[_0x7413('0x32')][_0x7413('0x33')]};});_0x1ffb6f[_0x7413('0x34')]=_[_0x7413('0x2f')](_0x39db32,_0x7413('0x2c'));_0x1ffb6f['query']=_[_0x7413('0x35')](_0x25fa52['query']);_0x1ffb6f[_0x7413('0x36')]=_[_0x7413('0x37')](_0x1ffb6f[_0x7413('0x34')],_0x1ffb6f['query']);_0x5bb3ea[_0x7413('0x38')]=_['intersection'](_0x1ffb6f[_0x7413('0x34')],qs[_0x7413('0x39')](_0x25fa52['query']['fields']));_0x5bb3ea[_0x7413('0x38')]=_0x5bb3ea[_0x7413('0x38')][_0x7413('0x3a')]?_0x5bb3ea['attributes']:_0x1ffb6f['model'];if(!_0x25fa52[_0x7413('0x3b')]['hasOwnProperty']('nolimit')){_0x5bb3ea[_0x7413('0x22')]=qs['limit'](_0x25fa52[_0x7413('0x3b')][_0x7413('0x22')]);_0x5bb3ea[_0x7413('0x1f')]=qs[_0x7413('0x1f')](_0x25fa52[_0x7413('0x3b')]['offset']);}_0x5bb3ea[_0x7413('0x3c')]=qs[_0x7413('0x3d')](_0x25fa52[_0x7413('0x3b')][_0x7413('0x3d')]);_0x5bb3ea[_0x7413('0x3e')]=qs[_0x7413('0x36')](_[_0x7413('0x3f')](_0x25fa52[_0x7413('0x3b')],_0x1ffb6f[_0x7413('0x36')]),_0x39db32);if(_0x25fa52[_0x7413('0x3b')][_0x7413('0x40')]){_0x5bb3ea[_0x7413('0x3e')]=_['merge'](_0x5bb3ea[_0x7413('0x3e')],{'$or':_['map'](_0x39db32,function(_0x56cb6f){if(_0x56cb6f['type']!=='VIRTUAL'){var _0x5c86ad={};_0x5c86ad[_0x56cb6f[_0x7413('0x2c')]]={'$like':'%'+_0x25fa52['query']['filter']+'%'};return _0x5c86ad;}})});}_0x5bb3ea=_[_0x7413('0x41')]({},_0x5bb3ea,_0x25fa52['options']);var _0x4c6746={'where':_0x5bb3ea[_0x7413('0x3e')]};return db[_0x7413('0x30')][_0x7413('0x21')](_0x4c6746)[_0x7413('0x28')](function(_0x8049c0){_0x17c342['count']=_0x8049c0;if(_0x25fa52[_0x7413('0x3b')]['includeAll']){_0x5bb3ea[_0x7413('0x42')]=[{'all':!![]}];}return db[_0x7413('0x30')][_0x7413('0x43')](_0x5bb3ea);})[_0x7413('0x28')](function(_0x3f7da2){_0x17c342[_0x7413('0x44')]=_0x3f7da2;return _0x17c342;})[_0x7413('0x28')](respondWithFilteredResult(_0x2004ea,_0x5bb3ea))[_0x7413('0x45')](handleError(_0x2004ea,null));};exports[_0x7413('0x46')]=function(_0x1dd908,_0x38cd61){var _0x1e8bbd={'raw':![],'where':{'id':_0x1dd908['params']['id']}},_0x3fbec4={};_0x3fbec4[_0x7413('0x34')]=_[_0x7413('0x35')](db[_0x7413('0x30')][_0x7413('0x31')]);_0x3fbec4[_0x7413('0x3b')]=_[_0x7413('0x35')](_0x1dd908[_0x7413('0x3b')]);_0x3fbec4[_0x7413('0x36')]=_[_0x7413('0x37')](_0x3fbec4[_0x7413('0x34')],_0x3fbec4[_0x7413('0x3b')]);_0x1e8bbd['attributes']=_[_0x7413('0x37')](_0x3fbec4['model'],qs[_0x7413('0x39')](_0x1dd908[_0x7413('0x3b')][_0x7413('0x39')]));_0x1e8bbd[_0x7413('0x38')]=_0x1e8bbd[_0x7413('0x38')][_0x7413('0x3a')]?_0x1e8bbd[_0x7413('0x38')]:_0x3fbec4[_0x7413('0x34')];if(_0x1dd908[_0x7413('0x3b')][_0x7413('0x47')]){_0x1e8bbd['include']=[{'all':!![]}];}_0x1e8bbd=_['merge']({},_0x1e8bbd,_0x1dd908[_0x7413('0x48')]);return db['UserProfile']['find'](_0x1e8bbd)[_0x7413('0x28')](handleEntityNotFound(_0x38cd61,null))[_0x7413('0x28')](respondWithResult(_0x38cd61,null))['catch'](handleError(_0x38cd61,null));};exports[_0x7413('0x49')]=function(_0x586d25,_0x562bae){return db[_0x7413('0x30')]['create'](_0x586d25[_0x7413('0x4a')],{})[_0x7413('0x28')](respondWithResult(_0x562bae,0xc9))[_0x7413('0x45')](handleError(_0x562bae,null));};exports[_0x7413('0x4b')]=function(_0x1b8859,_0x6f1d2d){var _0x153a9c={'where':{'id':_0x1b8859[_0x7413('0x4c')]['id']}},_0xde6773={};_0xde6773[_0x7413('0x34')]=_['keys'](db[_0x7413('0x30')]['rawAttributes']);_0x153a9c['attributes']=_['intersection'](_0xde6773[_0x7413('0x34')],qs[_0x7413('0x39')](_0x1b8859[_0x7413('0x3b')][_0x7413('0x39')]));_0x153a9c['attributes']=_0x153a9c['attributes'][_0x7413('0x3a')]?_0x153a9c['attributes']:_0xde6773[_0x7413('0x34')];if(_0x1b8859['query']['includeAll']){_0x153a9c['include']=[{'all':!![]}];}_0x153a9c=_['merge']({},_0x153a9c,_0x1b8859['options']);return db[_0x7413('0x30')][_0x7413('0x4d')](_0x153a9c)[_0x7413('0x28')](handleEntityNotFound(_0x6f1d2d,null))[_0x7413('0x28')](function(_0x606e03){if(_0x606e03){var _0x5a3a60=_0x606e03[_0x7413('0x4e')]({'plain':!![]});_0x5a3a60=qs[_0x7413('0x4f')](_0x5a3a60,['id',_0x7413('0x50'),'updatedAt',_0x7413('0x51')]);_0x1b8859['body']=_['omit'](_0x1b8859[_0x7413('0x4a')],['id',_0x7413('0x50'),_0x7413('0x52')]);return db[_0x7413('0x53')][_0x7413('0x54')](function(_0x2e0c7e){return db['UserProfile'][_0x7413('0x49')](_['merge'](_0x5a3a60,_0x1b8859[_0x7413('0x4a')]),{'include':_0x1b8859['query'][_0x7413('0x47')]?[{'all':!![]}]:undefined,'transaction':_0x2e0c7e})['then'](function(_0x400dfc){var _0x262f77=_0x400dfc['get']({'plain':!![]});return db[_0x7413('0x55')]['findAll']({'where':{'userProfileId':_0x1b8859[_0x7413('0x4c')]['id']},'raw':!![]})[_0x7413('0x28')](function(_0x5163ca){if(_0x5163ca){return BPromise[_0x7413('0x56')](_0x5163ca,function(_0x12048c){return new BPromise(function(_0x59d639,_0x3ce34c){if(_0x12048c[_0x7413('0x57')]===null||_0x12048c['autoAssociation']===0x1)_0x59d639(null);return db[_0x7413('0x58')][_0x7413('0x43')]({'where':{'sectionId':_0x12048c['id']},'raw':!![]})[_0x7413('0x28')](function(_0x395e3b){var _0x40fcc8=_[_0x7413('0x2f')](_0x395e3b,function(_0x3df7ba){return qs[_0x7413('0x4f')](_0x3df7ba,['id','createdAt',_0x7413('0x52'),'sectionId']);});_0x59d639(_0x40fcc8);})[_0x7413('0x45')](function(_0x37a55c){_0x3ce34c(_0x37a55c);});})[_0x7413('0x28')](function(_0x3e7058){var _0x4c8996=qs['omit'](_0x12048c,['id','createdAt','updatedAt']);_0x4c8996['userProfileId']=_0x262f77['id'];if(_0x3e7058)_0x4c8996[_0x7413('0x59')]=_0x3e7058;return _0x4c8996;})[_0x7413('0x28')](function(_0x1f023f){return db['UserProfileSection'][_0x7413('0x49')](_0x1f023f,{'include':[{'model':db[_0x7413('0x58')],'as':_0x7413('0x59')}],'raw':!![],'transaction':_0x2e0c7e});});})[_0x7413('0x28')](function(){return _0x262f77;});}});});});}})[_0x7413('0x28')](respondWithResult(_0x6f1d2d,0xc9))[_0x7413('0x45')](handleError(_0x6f1d2d,null));};exports[_0x7413('0x27')]=function(_0x295a0a,_0x1ec131){if(_0x295a0a[_0x7413('0x4a')]['id']){delete _0x295a0a[_0x7413('0x4a')]['id'];}return db[_0x7413('0x30')][_0x7413('0x4d')]({'where':{'id':_0x295a0a['params']['id']}})[_0x7413('0x28')](handleEntityNotFound(_0x1ec131,null))[_0x7413('0x28')](saveUpdates(_0x295a0a['body'],null))[_0x7413('0x28')](respondWithResult(_0x1ec131,null))[_0x7413('0x45')](handleError(_0x1ec131,null));};exports[_0x7413('0x5a')]=function(_0x5e4aa1,_0x102fd2){return db[_0x7413('0x30')]['find']({'where':{'id':_0x5e4aa1[_0x7413('0x4c')]['id']}})[_0x7413('0x28')](handleEntityNotFound(_0x102fd2,null))['then'](removeEntity(_0x102fd2,null))[_0x7413('0x45')](handleError(_0x102fd2,null));};exports['describe']=function(_0x537458,_0xbb819a){return db[_0x7413('0x30')][_0x7413('0x5b')]()[_0x7413('0x28')](respondWithResult(_0xbb819a,null))[_0x7413('0x45')](handleError(_0xbb819a,null));};exports[_0x7413('0x5c')]=function(_0x6171a9,_0x2f8637){var _0x5bed58=_0x6171a9[_0x7413('0x4a')];return db['UserProfile'][_0x7413('0x4d')]({'where':{'id':_0x6171a9[_0x7413('0x4c')]['id']}})[_0x7413('0x28')](handleEntityNotFound(_0x2f8637,null))[_0x7413('0x28')](function(_0x2c4664){if(_0x2c4664){return db[_0x7413('0x53')][_0x7413('0x54')](function(_0x46983f){return db[_0x7413('0x55')]['destroy']({'where':{'userProfileId':_0x6171a9[_0x7413('0x4c')]['id'],'sectionId':_[_0x7413('0x2f')](_0x5bed58,function(_0x53354b){return _0x53354b[_0x7413('0x5d')];})},'transaction':_0x46983f})[_0x7413('0x28')](function(){var _0x599a91=_[_0x7413('0x2f')](_0x5bed58,function(_0x4b676a){_0x4b676a[_0x7413('0x5e')]=_0x6171a9[_0x7413('0x4c')]['id'];return _0x4b676a;});var _0x54f03d=[];return BPromise['each'](_0x599a91,function(_0x227a66){return db[_0x7413('0x55')][_0x7413('0x49')](_0x227a66,{'include':[{'model':db['UserProfileResource'],'as':_0x7413('0x59')}],'raw':!![],'transaction':_0x46983f})[_0x7413('0x28')](function(_0x25c93a){_0x54f03d[_0x7413('0x5f')](_0x25c93a[_0x7413('0x4e')]({'plain':!![]}));});})[_0x7413('0x28')](function(){return _0x54f03d;});});});}})['then'](function(_0x3b6975){return _0x3b6975;})[_0x7413('0x28')](respondWithResult(_0x2f8637,null))[_0x7413('0x45')](handleError(_0x2f8637,null));};exports['removeSections']=function(_0x350b01,_0x18d2e7){var _0x82869a;return db[_0x7413('0x30')][_0x7413('0x4d')]({'where':{'id':_0x350b01[_0x7413('0x4c')]['id']},'attributes':['id',_0x7413('0x2c')]})[_0x7413('0x28')](handleEntityNotFound(_0x18d2e7,null))[_0x7413('0x28')](function(_0x5c68de){if(_0x5c68de){_0x82869a=_0x5c68de;return db[_0x7413('0x55')][_0x7413('0x5a')]({'where':{'userProfileId':_0x350b01[_0x7413('0x4c')]['id'],'sectionId':_0x350b01[_0x7413('0x3b')][_0x7413('0x60')]}});}})[_0x7413('0x28')](function(){return _0x82869a;})['then'](respondWithStatusCode(_0x18d2e7,null))[_0x7413('0x45')](handleError(_0x18d2e7,null));};exports['getSections']=function(_0x4af607,_0xefd1e7){var _0x19ff87=[];var _0x4e49ff=[];return db[_0x7413('0x55')][_0x7413('0x43')]({'where':{'userProfileId':_0x4af607[_0x7413('0x4c')]['id']},'raw':!![]})[_0x7413('0x28')](function(_0x33b279){_0x19ff87=_[_0x7413('0x40')](_0x33b279,function(_0x2d361c){return _0x2d361c[_0x7413('0x61')]===0x1||_['includes']([0x3eb,0x709],_0x2d361c[_0x7413('0x5d')]);});if(!_['isEmpty'](_0x19ff87)){return _[_0x7413('0x2f')](_0x19ff87,function(_0x3ad956){return _0x3ad956['sectionId'];});}else{return;}})[_0x7413('0x28')](function(_0x1f4ce0){if(_0x1f4ce0)_0x4e49ff=_0x1f4ce0;if(_[_0x7413('0x62')](_0x4e49ff,0x64)){var _0x300a17=_[_0x7413('0x4d')](_0x19ff87,{'sectionId':0x64});return hasDefaultDashboard(_0x300a17)[_0x7413('0x28')](function(_0x3dcbfb){return _[_0x7413('0x2f')](_0x19ff87,function(_0x2661b2){if(_0x2661b2[_0x7413('0x5d')]===0x64){_0x2661b2['subsections']=_0x3dcbfb;}return _0x2661b2;});});}else{return;}})[_0x7413('0x28')](function(_0x290acf){if(_0x290acf)_0x19ff87=_0x290acf;if(_['includes'](_0x4e49ff,0x3eb)){var _0x55d7a8=_['find'](_0x19ff87,{'sectionId':0x3eb});return getCustomDashboards(_0x55d7a8)[_0x7413('0x28')](function(_0x521f0c){return _[_0x7413('0x2f')](_0x19ff87,function(_0x44e22d){if(_0x55d7a8[_0x7413('0x61')]){if(_0x44e22d[_0x7413('0x5d')]===0x3eb){_0x44e22d[_0x7413('0x63')]=_0x521f0c;}}else{if(_0x44e22d[_0x7413('0x5d')]===0x64){_0x44e22d[_0x7413('0x63')]=_0x521f0c;}}return _0x44e22d;});});}else{return;}})[_0x7413('0x28')](function(_0x3efa75){if(_0x3efa75)_0x19ff87=_0x3efa75;if(_['includes'](_0x4e49ff,0x709)){var _0x1c0800=_[_0x7413('0x4d')](_0x19ff87,{'sectionId':0x709});return getPlugins(_0x1c0800)[_0x7413('0x28')](function(_0x4ea60e){if(_0x1c0800[_0x7413('0x61')]){return _[_0x7413('0x2f')](_0x19ff87,function(_0x337180){if(_0x337180[_0x7413('0x5d')]===0x709){_0x337180[_0x7413('0x63')]=_0x4ea60e;}return _0x337180;});}else{var _0x19a777={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4ea60e};var _0x1521ad=_[_0x7413('0x2f')](_0x19ff87);_0x1521ad[_0x7413('0x5f')](_0x19a777);return _0x1521ad;}});}else{return;}})[_0x7413('0x28')](function(_0x4f998b){if(_0x4f998b)_0x19ff87=_0x4f998b;return _[_0x7413('0x40')](_0x19ff87,[_0x7413('0x61'),0x1]);})['then'](respondWithResult(_0xefd1e7,null))[_0x7413('0x45')](handleError(_0xefd1e7,null));};function hasDefaultDashboard(_0x96bdbb){var _0x4d4fec=[0x65];return new BPromise(function(_0x33232d,_0x193d54){try{if(_0x96bdbb[_0x7413('0x57')]){_0x33232d(_0x4d4fec);}else{return db['UserProfileResource'][_0x7413('0x64')]({'where':{'sectionId':_0x96bdbb['id']},'raw':!![]})['then'](function(_0x466ec8){_0x466ec8?_0x33232d(_0x4d4fec):_0x33232d();});}}catch(_0x35f721){_0x193d54(_0x35f721);}});}function getCustomDashboards(_0x4537b5){var _0x20ba75=[];return new BPromise(function(_0x2675ad,_0x371464){try{if(_0x4537b5['autoAssociation']){return db[_0x7413('0x65')][_0x7413('0x43')]({'raw':!![]})[_0x7413('0x28')](function(_0x43991d){_0x43991d[_0x7413('0x66')](function(_0x55059e){_0x20ba75[_0x7413('0x5f')](_0x55059e['id']+0x1869f);});_0x2675ad(_0x20ba75);});}else{return db[_0x7413('0x58')][_0x7413('0x43')]({'where':{'sectionId':_0x4537b5['id']},'raw':!![]})[_0x7413('0x28')](function(_0x38c966){_0x38c966['forEach'](function(_0x517b6e){_0x20ba75[_0x7413('0x5f')](_0x517b6e[_0x7413('0x67')]+0x1869f);});_0x2675ad(_0x20ba75);});}}catch(_0x389ce1){_0x371464(_0x389ce1);}});}function getPlugins(_0x14a968){var _0x4ec202=[];return new BPromise(function(_0x4c7787,_0x41bb34){try{if(_0x14a968[_0x7413('0x57')]){return db[_0x7413('0x68')]['findAll']({'raw':!![]})['then'](function(_0x2d71c8){_0x2d71c8[_0x7413('0x66')](function(_0x312894){_0x4ec202[_0x7413('0x5f')](_0x312894['id']+0x15b38);});_0x4c7787(_0x4ec202);});}else{return db[_0x7413('0x58')][_0x7413('0x43')]({'where':{'sectionId':_0x14a968['id']},'raw':!![]})[_0x7413('0x28')](function(_0x4b2b7c){_0x4b2b7c['forEach'](function(_0x396a6a){_0x4ec202[_0x7413('0x5f')](_0x396a6a['resourceId']+0x15b38);});_0x4c7787(_0x4ec202);});}}catch(_0x2016de){_0x41bb34(_0x2016de);}});}exports[_0x7413('0x69')]=function(_0x35389e,_0x23173c){return db[_0x7413('0x30')][_0x7413('0x4d')]({'where':{'id':_0x35389e[_0x7413('0x4c')]['id']}})[_0x7413('0x28')](handleEntityNotFound(_0x23173c,null))[_0x7413('0x28')](function(_0x5802e0){if(_0x5802e0){return db[_0x7413('0x53')][_0x7413('0x54')](function(_0x59d665){return db[_0x7413('0x55')][_0x7413('0x43')]({'where':{'userProfileId':_0x35389e[_0x7413('0x4c')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x519112){if(_0x519112){return db['UserProfileSection'][_0x7413('0x5a')]({'where':{'userProfileId':_0x35389e[_0x7413('0x4c')]['id'],'id':_[_0x7413('0x2f')](_0x519112,function(_0x591e99){return _0x591e99['id'];})},'transaction':_0x59d665});}})[_0x7413('0x28')](function(_0xbac7e8){var _0x207293=_[_0x7413('0x2f')](_0x35389e['body'],function(_0x11f5a3){_0x11f5a3['userProfileId']=_0x35389e[_0x7413('0x4c')]['id'];return _0x11f5a3;});return db[_0x7413('0x55')][_0x7413('0x6a')](_0x207293,{'raw':!![],'transaction':_0x59d665});})[_0x7413('0x28')](function(_0x2fad79){var _0x5881d6=_[_0x7413('0x40')](_[_0x7413('0x2f')](_0x2fad79,function(_0x1455b4){return _0x1455b4[_0x7413('0x4e')]({'plain':!![]});}),{'includeAll':![]});if(_0x5881d6){return db[_0x7413('0x55')][_0x7413('0x43')]({'where':{'userProfileId':_0x35389e[_0x7413('0x4c')]['id'],'sectionId':_[_0x7413('0x2f')](_0x5881d6,function(_0x35d5e2){return _0x35d5e2[_0x7413('0x5d')];})},'attributes':['id',_0x7413('0x5d')],'raw':!![]})[_0x7413('0x28')](function(_0xd39475){var _0x398823=_[_0x7413('0x2f')](_0x35389e['body'],function(_0x4d5046){_0x4d5046[_0x7413('0x5e')]=_0x35389e[_0x7413('0x4c')]['id'];return _0x4d5046;});return db['UserProfileResource'][_0x7413('0x6a')](_0x398823,{'raw':!![],'transaction':_0x59d665});});}})['catch'](handleError(_0x23173c,null));});}})[_0x7413('0x28')](function(_0x26536c){var _0x3b5ad6=_[_0x7413('0x2f')](_0x26536c,function(_0x32cd2d){return _0x32cd2d[_0x7413('0x4e')]({'plain':!![]});});})[_0x7413('0x28')](respondWithResult(_0x23173c,null))[_0x7413('0x45')](handleError(_0x23173c,null));};exports['removeResources']=function(_0x4089fe,_0x4c03be,_0x4390ed){return db['UserProfile'][_0x7413('0x4d')]({'where':{'id':_0x4089fe[_0x7413('0x4c')]['id']}})[_0x7413('0x28')](handleEntityNotFound(_0x4c03be,null))['then'](function(_0x1883a9){if(_0x1883a9){return _0x1883a9[_0x7413('0x6b')](_0x4089fe[_0x7413('0x3b')][_0x7413('0x60')]);}})[_0x7413('0x28')](respondWithStatusCode(_0x4c03be,null))[_0x7413('0x45')](handleError(_0x4c03be,null));};exports['getResources']=function(_0x4f01f8,_0x4b40b1){var _0x5539de={};if(!_0x4f01f8[_0x7413('0x3b')][_0x7413('0x6c')])throw new Error(_0x7413('0x6d'));if(!_0x4f01f8['query'][_0x7413('0x6e')](_0x7413('0x6f'))){_0x5539de[_0x7413('0x22')]=qs[_0x7413('0x22')](_0x4f01f8[_0x7413('0x3b')][_0x7413('0x22')]);_0x5539de['offset']=qs['offset'](_0x4f01f8['query'][_0x7413('0x1f')]);}return db[_0x7413('0x30')]['find']({'where':{'id':_0x4f01f8[_0x7413('0x4c')]['id']}})[_0x7413('0x28')](function(_0x9a92b8){if(!_0x9a92b8)throw new Error(_0x7413('0x70')+_0x4f01f8['params']['id']);return db[_0x7413('0x30')][_0x7413('0x71')](_0x4f01f8);})['then'](respondWithFilteredResult(_0x4b40b1,_0x5539de))[_0x7413('0x45')](handleError(_0x4b40b1,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index e632db0..e3291c3 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 _0x565e=['UserProfile','setMaxListeners','save','emit','hasOwnProperty','hook','exports','events'];(function(_0x16e5a2,_0x32f03d){var _0x20ba84=function(_0x3ab02b){while(--_0x3ab02b){_0x16e5a2['push'](_0x16e5a2['shift']());}};_0x20ba84(++_0x32f03d);}(_0x565e,0x7f));var _0xe565=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x565e[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xe565('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xe565('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xe565('0x2')](0x0);var events={'afterCreate':_0xe565('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x42e589){return function(_0x33fd83,_0x14f472,_0x1b6e64){UserProfileEvents[_0xe565('0x4')](_0x42e589+':'+_0x33fd83['id'],_0x33fd83);UserProfileEvents[_0xe565('0x4')](_0x42e589,_0x33fd83);_0x1b6e64(null);};}for(var e in events){if(events[_0xe565('0x5')](e)){var event=events[e];UserProfile[_0xe565('0x6')](e,emitEvent(event));}}module[_0xe565('0x7')]=UserProfileEvents; \ No newline at end of file +var _0xe1d7=['update','remove','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x974a43,_0x4fbdc8){var _0x43c41a=function(_0x3db3cc){while(--_0x3db3cc){_0x974a43['push'](_0x974a43['shift']());}};_0x43c41a(++_0x4fbdc8);}(_0xe1d7,0x1a9));var _0x7e1d=function(_0x502417,_0x3b4a19){_0x502417=_0x502417-0x0;var _0x32e1f8=_0xe1d7[_0x502417];return _0x32e1f8;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x7e1d('0x0'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x7e1d('0x1'),'afterDestroy':_0x7e1d('0x2')};function emitEvent(_0x416747){return function(_0x57e913,_0x347f78,_0x882bec){UserProfileEvents[_0x7e1d('0x3')](_0x416747+':'+_0x57e913['id'],_0x57e913);UserProfileEvents[_0x7e1d('0x3')](_0x416747,_0x57e913);_0x882bec(null);};}for(var e in events){if(events[_0x7e1d('0x4')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x7e1d('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 101ff78..2d663ee 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 _0xa6b0=['filter','field','value','findAll','associatedResources','map','catch','then','name','UserProfileResource','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','parentSections','projectName','projects','contacts','CmContact','Lists','ListId','CmList','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue','FaxAccount','outboundroutes','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','User','role','Telephones','membername','telephone','VoiceQueues','queue','type','inbound','QueueCampaigns','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','mailqueues','mailaccounts','mailsubstatuses','MailSubstatus','smsqueues','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','pauses','Pause','scheduler','sounds','tags','Tag','templates','Template','Trigger','trunks','Trunk','variables','Variable','plugins','Reports','reportId','charAt','toUpperCase','slice','select','ui.','InteractionId','ui.createdAt','from','_interactions','where','ui.UserId\x20=\x20?','sequelize','toString','OpenTabs','define','UserProfile','user_profiles','section','query','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','autoAssociation','rawAttributes','model','keys','filters','intersection','attributes','fields','limit','offset','sort','merge','VIRTUAL','foreignKey','forEach','options','includeAll','include','default','custom','CustomReports','count','rows','Tags','color','tag','openTabs','chat','sms','dataValues','fax','mail','whatsapp','lodash','./userProfile.attributes','exports'];(function(_0x46f6d4,_0x5e0d7a){var _0x1f016b=function(_0x27756){while(--_0x27756){_0x46f6d4['push'](_0x46f6d4['shift']());}};_0x1f016b(++_0x5e0d7a);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x3daebc,_0x9cb8da){_0x3daebc=_0x3daebc-0x0;var _0x29eef1=_0xa6b0[_0x3daebc];return _0x29eef1;};'use strict';var _=require(_0x0a6b('0x0'));var attributes=require(_0x0a6b('0x1'));var qs=require('../../components/parsers/qs');var squel=require('squel');module[_0x0a6b('0x2')]=function(_0x2c0d7f){var _0x13d4d5=_0x2c0d7f['models'];function _0x29ff80(_0x33e8c3,_0x195697){return new Promise(function(_0xc7140c,_0x3dc2b0){if(!_0x195697)return _0xc7140c(null);var _0x3b6967=_0x195697[_0x0a6b('0x3')]?{[_0x195697[_0x0a6b('0x3')][_0x0a6b('0x4')]]:_0x195697[_0x0a6b('0x3')][_0x0a6b('0x5')]}:undefined;return _0x13d4d5[_0x33e8c3][_0x0a6b('0x6')]({'where':_0x3b6967,'raw':!![]})['then'](function(_0x493948){_0x195697[_0x0a6b('0x7')]=_[_0x0a6b('0x8')](_0x493948,'id');_0xc7140c(_0x195697);})[_0x0a6b('0x9')](function(_0x25ad47){_0x3dc2b0(_0x25ad47);});});}function _0x81a412(_0xe681c9,_0x1489c5){return new Promise(function(_0x405046,_0x8bbed9){var _0x354e10=_0xe681c9[_0x0a6b('0x3')]?{[_0xe681c9[_0x0a6b('0x3')][_0x0a6b('0x4')]]:_0xe681c9[_0x0a6b('0x3')]['value']}:undefined;return _0x13d4d5[_0xe681c9['model']][_0x0a6b('0x6')]({'where':_0x354e10,'raw':!![]})[_0x0a6b('0xa')](function(_0x2abc4e){_0x1489c5[_0x0a6b('0x7')]=_[_0x0a6b('0x8')](_0x2abc4e,function(_0x45fc9f){return _0x45fc9f[_0x0a6b('0xb')];});_0x405046(_0x1489c5);})[_0x0a6b('0x9')](function(_0x1205a3){_0x8bbed9(_0x1205a3);});});}function _0x9d7aba(_0x4797d1,_0xa36d75,_0x1538f4){if(!_0xa36d75)return Promise['resolve'](null);return new Promise(function(_0x290f7f,_0x4d0e3b){return _0x13d4d5[_0x0a6b('0xc')][_0x0a6b('0x6')]({'where':{'sectionId':_0xa36d75['id']},'raw':!![]})[_0x0a6b('0xa')](function(_0x1ad45d){if(_0x4797d1['field']&&_0x4797d1[_0x0a6b('0x4')]!=='id'){_0xa36d75[_0x0a6b('0x7')]=_['map'](_0x1ad45d,function(_0x19848c){return _0x19848c[_0x4797d1[_0x0a6b('0x4')]];});}else{if(_0x1538f4===_0x0a6b('0xd')){_0xa36d75['associatedResources']=_[_0x0a6b('0x8')](_0x1ad45d,function(_0x93a465){return{'id':_0x93a465[_0x0a6b('0xe')],'type':_0x93a465['type']};});}else{_0xa36d75[_0x0a6b('0x7')]=_[_0x0a6b('0x8')](_0x1ad45d,function(_0xe4c2b9){return _0xe4c2b9[_0x0a6b('0xe')];});}}_0x290f7f(_0xa36d75);})[_0x0a6b('0x9')](function(_0x53848c){_0x4d0e3b(_0x53848c);});});}function _0x1e5065(_0xdda188,_0x3d153f){var _0x5c77fb={'parentSections':[]};switch(_0xdda188[_0x0a6b('0xf')]()){case _0x0a6b('0x10'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x12');break;case _0x0a6b('0x13'):_0x5c77fb['childModel']=_0x0a6b('0x14');break;case _0x0a6b('0x15'):_0x5c77fb[_0x0a6b('0x11')]='SquareRecording';_0x5c77fb[_0x0a6b('0x16')]=[{'name':'SquareProjects','field':_0x0a6b('0xb'),'foreignKey':_0x0a6b('0x17')}];break;case _0x0a6b('0x18'):_0x5c77fb['childModel']='JscriptyProject';break;case _0x0a6b('0x19'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x1a');_0x5c77fb[_0x0a6b('0x16')]=[{'name':_0x0a6b('0x1b'),'field':'id','foreignKey':_0x0a6b('0x1c')}];break;case'lists':_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x1d');break;case'companies':_0x5c77fb[_0x0a6b('0x11')]='CmCompany';break;case'globalcustomfields':_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x1e');break;case _0x0a6b('0x1f'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x20');break;case'chatwebsites':_0x5c77fb['childModel']=_0x0a6b('0x21');break;case _0x0a6b('0x22'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x23');break;case'faxaccounts':_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x24');break;case'inboundroutes':case'internalroutes':case _0x0a6b('0x25'):_0x5c77fb[_0x0a6b('0x11')]='VoiceExtension';break;case _0x0a6b('0x26'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x27');break;case _0x0a6b('0x28'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x29');break;case _0x0a6b('0x2a'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x2b');_0x5c77fb[_0x0a6b('0x16')]=[{'name':_0x0a6b('0x2c'),'field':_0x0a6b('0xb'),'foreignKey':'membername','model':_0x0a6b('0x2d'),'filter':{'field':_0x0a6b('0x2e'),'value':['agent']}},{'name':_0x0a6b('0x2f'),'field':_0x0a6b('0xb'),'foreignKey':_0x0a6b('0x30'),'model':_0x0a6b('0x2d'),'filter':{'field':_0x0a6b('0x2e'),'value':[_0x0a6b('0x31')]}},{'name':_0x0a6b('0x32'),'field':_0x0a6b('0xb'),'foreignKey':_0x0a6b('0x33'),'model':'VoiceQueue','filter':{'field':_0x0a6b('0x34'),'value':[_0x0a6b('0x35')]}},{'name':_0x0a6b('0x36'),'field':_0x0a6b('0xb'),'foreignKey':_0x0a6b('0x33'),'model':_0x0a6b('0x37'),'filter':{'field':_0x0a6b('0x34'),'value':[_0x0a6b('0x38')]}}];break;case _0x0a6b('0x39'):_0x5c77fb['childModel']=_0x0a6b('0x3a');break;case _0x0a6b('0x3b'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x3c');break;case _0x0a6b('0x3d'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x3e');break;case _0x0a6b('0x3f'):_0x5c77fb[_0x0a6b('0x11')]='Campaign';break;case _0x0a6b('0x40'):_0x5c77fb['childModel']='MailQueue';break;case _0x0a6b('0x41'):_0x5c77fb['childModel']='MailAccount';break;case _0x0a6b('0x42'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x43');break;case'openchannelqueues':_0x5c77fb[_0x0a6b('0x11')]='OpenchannelQueue';break;case'openchannelaccounts':_0x5c77fb[_0x0a6b('0x11')]='OpenchannelAccount';break;case _0x0a6b('0x44'):_0x5c77fb['childModel']=_0x0a6b('0x45');break;case'smsaccounts':_0x5c77fb['childModel']=_0x0a6b('0x46');break;case _0x0a6b('0x47'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x48');break;case'whatsappaccounts':_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x49');break;case _0x0a6b('0x4a'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x4b');break;case _0x0a6b('0x4c'):case _0x0a6b('0x4d'):_0x5c77fb['childModel']=_0x0a6b('0x37');if(_0x3d153f){_0x5c77fb[_0x0a6b('0x16')]=[{'name':_0x0a6b('0x32')},{'name':_0x0a6b('0x36')}];}break;case _0x0a6b('0x4e'):case _0x0a6b('0x4f'):case _0x0a6b('0x50'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x2d');if(_0x3d153f){_0x5c77fb['parentSections']=[{'name':_0x0a6b('0x51'),'filter':{'field':_0x0a6b('0x2e'),'value':[_0x0a6b('0x52'),_0x0a6b('0x53')]},'ignore':!![]},{'name':_0x0a6b('0x2c')},{'name':_0x0a6b('0x2f')}];}break;case _0x0a6b('0x54'):_0x5c77fb['childModel']='ZendeskAccount';break;case _0x0a6b('0x55'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x56');break;case _0x0a6b('0x57'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x58');break;case _0x0a6b('0x59'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x5a');break;case'deskaccounts':_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x5b');break;case _0x0a6b('0x5c'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x5d');break;case'vtigeraccounts':_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x2d');break;case _0x0a6b('0x5e'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x5f');break;case _0x0a6b('0x60'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x61');break;case _0x0a6b('0x62'):_0x5c77fb[_0x0a6b('0x11')]='Dashboard';break;case'intervals':_0x5c77fb[_0x0a6b('0x11')]='Interval';break;case _0x0a6b('0x63'):_0x5c77fb['childModel']=_0x0a6b('0x64');break;case _0x0a6b('0x65'):_0x5c77fb[_0x0a6b('0x11')]='Schedule';break;case _0x0a6b('0x66'):_0x5c77fb[_0x0a6b('0x11')]='Sound';break;case _0x0a6b('0x67'):_0x5c77fb['childModel']=_0x0a6b('0x68');break;case _0x0a6b('0x69'):_0x5c77fb['childModel']=_0x0a6b('0x6a');break;case'triggers':_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x6b');break;case _0x0a6b('0x6c'):_0x5c77fb['childModel']=_0x0a6b('0x6d');break;case _0x0a6b('0x6e'):_0x5c77fb[_0x0a6b('0x11')]=_0x0a6b('0x6f');break;case _0x0a6b('0x70'):_0x5c77fb[_0x0a6b('0x11')]='Plugin';break;case'extractedreports':_0x5c77fb['childModel']=_0x0a6b('0xd');_0x5c77fb['parentSections']=[{'name':_0x0a6b('0x71'),'field':'id','foreignKey':_0x0a6b('0x72')}];break;case'metrics':_0x5c77fb['childModel']='AnalyticMetric';break;}return _0x5c77fb;}function _0x19e9a6(_0x187c12,_0x4b7f32){var _0xb84ccf=_0x187c12[_0x0a6b('0x73')](0x0)[_0x0a6b('0x74')]()+_0x187c12[_0x0a6b('0x75')](0x1);var _0x2ebd68={'type':_0x13d4d5['Sequelize']['QueryTypes']['SELECT'],'raw':!![]};return new Promise(function(_0x40cba9,_0x2fb572){var _0x58d4ce=squel[_0x0a6b('0x76')]()['field'](_0x0a6b('0x77')+_0xb84ccf+_0x0a6b('0x78'),'id')[_0x0a6b('0x4')](_0x0a6b('0x79'))[_0x0a6b('0x7a')]('user_has_'+_0x187c12+_0x0a6b('0x7b'),'ui')[_0x0a6b('0x7c')](_0x0a6b('0x7d'),_0x4b7f32['id']);return _0x13d4d5[_0x0a6b('0x7e')]['query'](_0x58d4ce[_0x0a6b('0x7f')](),_0x2ebd68)[_0x0a6b('0xa')](function(_0x292c87){_0x4b7f32[_0xb84ccf+_0x0a6b('0x80')]=_0x292c87;_0x40cba9(_0x292c87);})[_0x0a6b('0x9')](function(_0x581738){_0x2fb572(_0x581738);});});}return _0x2c0d7f[_0x0a6b('0x81')](_0x0a6b('0x82'),attributes,{'tableName':_0x0a6b('0x83'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x24b829){var _0x16c13a={'raw':![],'where':{}};var _0x1f4e0d={};var _0x1f715b={'count':0x0,'rows':[]};var _0xa1b7e7=_0x24b829['query'][_0x0a6b('0x84')];var _0x10830a=_0x24b829[_0x0a6b('0x85')][_0x0a6b('0x86')]||![];var _0x583b01=_0x1e5065(_0xa1b7e7,_0x10830a);if(!_0x583b01[_0x0a6b('0x11')])throw new Error(_0x0a6b('0x87')+_0xa1b7e7+'\x27');var _0x3b2a20=[{'name':_0xa1b7e7}];if(!_[_0x0a6b('0x88')](_0x583b01[_0x0a6b('0x16')]))_0x3b2a20=_0x583b01[_0x0a6b('0x16')];var _0x3db026=[];for(var _0x45f990=0x0;_0x45f990<_0x3b2a20[_0x0a6b('0x89')];_0x45f990++){_0x3db026[_0x0a6b('0x8a')](_0x13d4d5[_0x0a6b('0x8b')][_0x0a6b('0x8c')]({'where':{'userProfileId':_0x24b829[_0x0a6b('0x8d')]['id'],'name':_0x3b2a20[_0x45f990][_0x0a6b('0xb')]},'raw':!![]}));}return Promise[_0x0a6b('0x8e')](_0x3db026)['then'](function(_0x55b386){var _0x3703c3=_[_0x0a6b('0x3')](_0x55b386,function(_0x4a3161){return _0x4a3161?_0x4a3161:undefined;});var _0x4502aa=_[_0x0a6b('0x3')](_0x3b2a20,[_0x0a6b('0x8f'),!![]]);var _0x21b9dc=_[_0x0a6b('0x88')](_0x3703c3)&&_[_0x0a6b('0x88')](_0x4502aa)?null:_[_0x0a6b('0x90')](_0x4502aa,_0x3703c3);if(!_0x21b9dc)return null;var _0x47d2c7=[];for(var _0x16f42f=0x0;_0x16f42f<_0x21b9dc[_0x0a6b('0x89')];_0x16f42f++){var _0x240426=_['find'](_0x3b2a20,function(_0x3b6b10){return _0x21b9dc[_0x16f42f]?_0x3b6b10['name']===_0x21b9dc[_0x16f42f][_0x0a6b('0xb')]:null;});if(_0x240426){if(_0x21b9dc[_0x16f42f][_0x0a6b('0x8f')]){_0x47d2c7[_0x0a6b('0x8a')](_0x29ff80(_0x583b01[_0x0a6b('0x11')],_0x21b9dc[_0x16f42f]));}else{if(!_0x21b9dc[_0x16f42f][_0x0a6b('0x91')]){_0x47d2c7[_0x0a6b('0x8a')](_0x9d7aba(_0x240426,_0x21b9dc[_0x16f42f],_0x583b01[_0x0a6b('0x11')]));}else{if(_0x240426['model']){_0x47d2c7[_0x0a6b('0x8a')](_0x81a412(_0x240426,_0x21b9dc[_0x16f42f]));}}}}}return Promise[_0x0a6b('0x8e')](_0x47d2c7);})[_0x0a6b('0xa')](function(_0x356d70){var _0x374dbd=_0x356d70;var _0x56db5d=null;if(_0x374dbd){_0x56db5d=_0x374dbd[_0x0a6b('0x89')]===0x1?_0x374dbd[0x0]:null;}if(!_0x56db5d&&!_0x374dbd)return _0x1f715b;var _0x5bf4d7=_0x13d4d5[_0x583b01['childModel']][_0x0a6b('0x92')];_0x1f4e0d[_0x0a6b('0x93')]=_[_0x0a6b('0x94')](_0x5bf4d7);_0x1f4e0d[_0x0a6b('0x85')]=_[_0x0a6b('0x94')](_0x24b829[_0x0a6b('0x85')]);_0x1f4e0d[_0x0a6b('0x95')]=_[_0x0a6b('0x96')](_0x1f4e0d[_0x0a6b('0x93')],_0x1f4e0d[_0x0a6b('0x85')]);_0x16c13a[_0x0a6b('0x97')]=_[_0x0a6b('0x96')](_0x1f4e0d['model'],qs[_0x0a6b('0x98')](_0x24b829[_0x0a6b('0x85')][_0x0a6b('0x98')]));_0x16c13a[_0x0a6b('0x97')]=_0x16c13a['attributes'][_0x0a6b('0x89')]?_0x16c13a['attributes']:_0x1f4e0d[_0x0a6b('0x93')];if(!_0x24b829[_0x0a6b('0x85')]['hasOwnProperty']('nolimit')){_0x16c13a[_0x0a6b('0x99')]=qs['limit'](_0x24b829[_0x0a6b('0x85')]['limit']);_0x16c13a[_0x0a6b('0x9a')]=qs['offset'](_0x24b829[_0x0a6b('0x85')][_0x0a6b('0x9a')]);}_0x16c13a['order']=qs['sort'](_0x24b829[_0x0a6b('0x85')][_0x0a6b('0x9b')]);_0x16c13a[_0x0a6b('0x7c')]=qs[_0x0a6b('0x95')](_['pick'](_0x24b829[_0x0a6b('0x85')],_0x1f4e0d['filters']));if(_0x24b829[_0x0a6b('0x85')][_0x0a6b('0x3')]){_0x16c13a[_0x0a6b('0x7c')]=_[_0x0a6b('0x9c')](_0x16c13a[_0x0a6b('0x7c')],{'$or':_[_0x0a6b('0x8')](_0x5bf4d7,function(_0x157c6f){if(_0x157c6f[_0x0a6b('0x34')]['key']!==_0x0a6b('0x9d')){var _0x5e565a={};_0x5e565a[_0x157c6f[_0x0a6b('0x4')]]={'$like':'%'+_0x24b829[_0x0a6b('0x85')][_0x0a6b('0x3')]+'%'};return _0x5e565a;}})});}var _0x3ea550=[];var _0x4d9cfe=null;var _0x94db76={};if(_0x56db5d){_0x4d9cfe=_[_0x0a6b('0x8c')](_0x3b2a20,['name',_0x56db5d[_0x0a6b('0xb')]]);if(_0x4d9cfe['field']){_0x94db76={};if(_0x583b01[_0x0a6b('0x11')]===_0x0a6b('0xd')){_0x94db76[_0x4d9cfe['foreignKey']]=_['map'](_0x56db5d[_0x0a6b('0x7')],'id');}else{_0x94db76[_0x4d9cfe[_0x0a6b('0x9e')]]=_0x56db5d['associatedResources'];}_0x3ea550[_0x0a6b('0x8a')](_0x94db76);}else{_0x16c13a[_0x0a6b('0x7c')]['id']=_0x56db5d['associatedResources'];}}else{for(var _0x33231d=0x0;_0x33231d<_0x374dbd[_0x0a6b('0x89')];_0x33231d++){_0x4d9cfe=_[_0x0a6b('0x8c')](_0x3b2a20,['name',_0x374dbd[_0x33231d][_0x0a6b('0xb')]]);if(_0x4d9cfe[_0x0a6b('0x4')]){_0x94db76={};_0x94db76[_0x4d9cfe[_0x0a6b('0x9e')]]=_0x374dbd[_0x33231d][_0x0a6b('0x7')];_0x3ea550['push'](_0x94db76);}else{if(!_0x16c13a[_0x0a6b('0x7c')]['id'])_0x16c13a['where']['id']=[];_0x374dbd[_0x33231d]['associatedResources'][_0x0a6b('0x9f')](function(_0x204626){_0x16c13a[_0x0a6b('0x7c')]['id'][_0x0a6b('0x8a')](_0x204626);});}}}if(!_['isEmpty'](_0x3ea550)){_0x16c13a[_0x0a6b('0x7c')]=_[_0x0a6b('0x9c')](_0x16c13a[_0x0a6b('0x7c')],{'$and':{'$or':_0x3ea550}});}_0x16c13a=_[_0x0a6b('0x9c')]({},_0x16c13a,_0x24b829[_0x0a6b('0xa0')]);if(_0x56db5d&&!_0x56db5d[_0x0a6b('0x91')]&&_0x583b01[_0x0a6b('0x11')]===_0x0a6b('0xd')){if(_0x24b829[_0x0a6b('0x85')][_0x0a6b('0xa1')]){_0x16c13a[_0x0a6b('0xa2')]=[{'all':!![]}];}return _0x13d4d5[_0x583b01[_0x0a6b('0x11')]][_0x0a6b('0x6')](_0x16c13a)['then'](function(_0x482878){var _0x38c60d=[];_0x482878['forEach'](function(_0x2d73c2){var _0xb5e93d;switch(_0x2d73c2['reportType']){case _0x0a6b('0xa3'):_0xb5e93d=_[_0x0a6b('0x8c')](_0x56db5d[_0x0a6b('0x7')],function(_0x3158e9){return _0x3158e9['id']===_0x2d73c2['reportId']&&_0x3158e9[_0x0a6b('0x34')]==='DefaultReports';});break;case _0x0a6b('0xa4'):_0xb5e93d=_[_0x0a6b('0x8c')](_0x56db5d[_0x0a6b('0x7')],function(_0x74ce8d){return _0x74ce8d['id']===_0x2d73c2[_0x0a6b('0x72')]&&_0x74ce8d[_0x0a6b('0x34')]===_0x0a6b('0xa5');});break;}if(_0xb5e93d)_0x38c60d[_0x0a6b('0x8a')](_0x2d73c2);});_0x1f715b[_0x0a6b('0xa6')]=_0x38c60d[_0x0a6b('0x89')];_0x1f715b[_0x0a6b('0xa7')]=_0x38c60d;return _0x1f715b;});}else{return _0x13d4d5[_0x583b01[_0x0a6b('0x11')]][_0x0a6b('0xa6')]({'where':_0x16c13a[_0x0a6b('0x7c')]})['then'](function(_0x4387d0){_0x1f715b[_0x0a6b('0xa6')]=_0x4387d0;if(_0x24b829['query'][_0x0a6b('0xa1')]){if(_0x583b01[_0x0a6b('0x11')]===_0x0a6b('0x1a')){_0x16c13a['include']=[{'model':_0x13d4d5[_0x0a6b('0x68')],'as':_0x0a6b('0xa8'),'attributes':['id',_0x0a6b('0xb'),'color'],'required':_0x24b829[_0x0a6b('0x85')]['tag']?!![]:![]},{'model':_0x13d4d5[_0x0a6b('0x68')],'as':'ThroughTags','attributes':['id',_0x0a6b('0xb'),_0x0a6b('0xa9')],'through':_0x24b829['query']['tag']?{'attributes':[],'where':{'TagId':_0x24b829['query'][_0x0a6b('0xaa')]||undefined}}:{},'required':_0x24b829[_0x0a6b('0x85')][_0x0a6b('0xaa')]?!![]:![]}];}else{_0x16c13a[_0x0a6b('0xa2')]=[{'all':!![]}];}}return _0x13d4d5[_0x583b01[_0x0a6b('0x11')]][_0x0a6b('0x6')](_0x16c13a);})[_0x0a6b('0xa')](function(_0x4b9e79){_0x1f715b[_0x0a6b('0xa7')]=_0x4b9e79;if(_0xa1b7e7===_0x0a6b('0x2c')&&_0x24b829['query'][_0x0a6b('0xab')]==='true'){var _0x5b8e37=[];for(var _0x25a602=0x0;_0x25a602<_0x1f715b[_0x0a6b('0xa7')]['length'];_0x25a602++){_0x5b8e37[_0x0a6b('0x8a')](_0x19e9a6(_0x0a6b('0xac'),_0x1f715b[_0x0a6b('0xa7')][_0x25a602]['dataValues']));_0x5b8e37[_0x0a6b('0x8a')](_0x19e9a6(_0x0a6b('0xad'),_0x1f715b[_0x0a6b('0xa7')][_0x25a602][_0x0a6b('0xae')]));_0x5b8e37[_0x0a6b('0x8a')](_0x19e9a6(_0x0a6b('0xaf'),_0x1f715b['rows'][_0x25a602][_0x0a6b('0xae')]));_0x5b8e37['push'](_0x19e9a6(_0x0a6b('0xb0'),_0x1f715b[_0x0a6b('0xa7')][_0x25a602][_0x0a6b('0xae')]));_0x5b8e37[_0x0a6b('0x8a')](_0x19e9a6('openchannel',_0x1f715b[_0x0a6b('0xa7')][_0x25a602][_0x0a6b('0xae')]));_0x5b8e37['push'](_0x19e9a6(_0x0a6b('0xb1'),_0x1f715b[_0x0a6b('0xa7')][_0x25a602][_0x0a6b('0xae')]));}return Promise[_0x0a6b('0x8e')](_0x5b8e37)['then'](function(){return _0x1f715b;});}return _0x1f715b;});}});}}});}; \ No newline at end of file +var _0x627e=['toLowerCase','childModel','SquareProject','odbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','contacts','Lists','lists','CmList','CmCompany','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','internalroutes','VoiceMail','voicerecordings','Agents','membername','User','agent','Telephones','role','telephone','VoiceQueues','VoiceQueue','inbound','queue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','MailQueue','mailsubstatuses','MailSubstatus','OpenchannelQueue','OpenchannelAccount','SmsAccount','whatsappqueues','whatsappaccounts','teams','Team','voicequeues','queuecampaigns','agents','telephones','Users','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','Disposition','Dashboard','Interval','Sound','tags','Tag','templates','Template','triggers','Trunk','variables','Variable','plugins','Plugin','reportId','metrics','AnalyticMetric','charAt','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','sequelize','toString','then','OpenTabs','define','UserProfile','mergeResources','isEmpty','length','push','find','all','ignore','autoAssociation','rawAttributes','keys','query','filters','intersection','fields','attributes','nolimit','limit','offset','order','sort','pick','key','foreignKey','forEach','merge','options','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','count','rows','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','findAll','associatedResources','map','value','model','name','catch','resolve','UserProfileResource','AnalyticExtractedReport','type','resourceId'];(function(_0x105b7b,_0x22ad08){var _0x52638c=function(_0x55d622){while(--_0x55d622){_0x105b7b['push'](_0x105b7b['shift']());}};_0x52638c(++_0x22ad08);}(_0x627e,0x14a));var _0xe627=function(_0x4c61dc,_0x48f866){_0x4c61dc=_0x4c61dc-0x0;var _0x4ab30b=_0x627e[_0x4c61dc];return _0x4ab30b;};'use strict';var _=require(_0xe627('0x0'));var attributes=require(_0xe627('0x1'));var qs=require(_0xe627('0x2'));var squel=require(_0xe627('0x3'));module[_0xe627('0x4')]=function(_0x48b97a){var _0x2b7158=_0x48b97a[_0xe627('0x5')];function _0x2abdc7(_0x59a2c8,_0x52923f){return new Promise(function(_0x4efcad,_0x1a1a3d){if(!_0x52923f)return _0x4efcad(null);var _0x3f2791=_0x52923f[_0xe627('0x6')]?{[_0x52923f[_0xe627('0x6')][_0xe627('0x7')]]:_0x52923f[_0xe627('0x6')]['value']}:undefined;return _0x2b7158[_0x59a2c8][_0xe627('0x8')]({'where':_0x3f2791,'raw':!![]})['then'](function(_0x56549e){_0x52923f[_0xe627('0x9')]=_[_0xe627('0xa')](_0x56549e,'id');_0x4efcad(_0x52923f);})['catch'](function(_0x4a85ba){_0x1a1a3d(_0x4a85ba);});});}function _0x16db2f(_0x2c1820,_0x1a3e35){return new Promise(function(_0x4543f5,_0x3d3c22){var _0x22ebea=_0x2c1820[_0xe627('0x6')]?{[_0x2c1820[_0xe627('0x6')][_0xe627('0x7')]]:_0x2c1820['filter'][_0xe627('0xb')]}:undefined;return _0x2b7158[_0x2c1820[_0xe627('0xc')]][_0xe627('0x8')]({'where':_0x22ebea,'raw':!![]})['then'](function(_0x42dd1c){_0x1a3e35[_0xe627('0x9')]=_[_0xe627('0xa')](_0x42dd1c,function(_0x119d9c){return _0x119d9c[_0xe627('0xd')];});_0x4543f5(_0x1a3e35);})[_0xe627('0xe')](function(_0x271325){_0x3d3c22(_0x271325);});});}function _0x54720a(_0x241544,_0x29b41c,_0x16c2d7){if(!_0x29b41c)return Promise[_0xe627('0xf')](null);return new Promise(function(_0x403982,_0x30da02){return _0x2b7158[_0xe627('0x10')][_0xe627('0x8')]({'where':{'sectionId':_0x29b41c['id']},'raw':!![]})['then'](function(_0x24fddd){if(_0x241544['field']&&_0x241544[_0xe627('0x7')]!=='id'){_0x29b41c['associatedResources']=_['map'](_0x24fddd,function(_0x3dde00){return _0x3dde00[_0x241544['field']];});}else{if(_0x16c2d7===_0xe627('0x11')){_0x29b41c[_0xe627('0x9')]=_['map'](_0x24fddd,function(_0x4c9b97){return{'id':_0x4c9b97['resourceId'],'type':_0x4c9b97[_0xe627('0x12')]};});}else{_0x29b41c[_0xe627('0x9')]=_['map'](_0x24fddd,function(_0x708a8a){return _0x708a8a[_0xe627('0x13')];});}}_0x403982(_0x29b41c);})['catch'](function(_0x44861b){_0x30da02(_0x44861b);});});}function _0x29221b(_0x52d492,_0x42f3d1){var _0x19adbc={'parentSections':[]};switch(_0x52d492[_0xe627('0x14')]()){case'squareprojects':_0x19adbc[_0xe627('0x15')]=_0xe627('0x16');break;case _0xe627('0x17'):_0x19adbc[_0xe627('0x15')]='SquareOdbc';break;case _0xe627('0x18'):_0x19adbc[_0xe627('0x15')]=_0xe627('0x19');_0x19adbc[_0xe627('0x1a')]=[{'name':_0xe627('0x1b'),'field':_0xe627('0xd'),'foreignKey':_0xe627('0x1c')}];break;case _0xe627('0x1d'):_0x19adbc[_0xe627('0x15')]='JscriptyProject';break;case _0xe627('0x1e'):_0x19adbc['childModel']='CmContact';_0x19adbc[_0xe627('0x1a')]=[{'name':_0xe627('0x1f'),'field':'id','foreignKey':'ListId'}];break;case _0xe627('0x20'):_0x19adbc['childModel']=_0xe627('0x21');break;case'companies':_0x19adbc[_0xe627('0x15')]=_0xe627('0x22');break;case'globalcustomfields':_0x19adbc[_0xe627('0x15')]='CmCustomField';break;case _0xe627('0x23'):_0x19adbc[_0xe627('0x15')]=_0xe627('0x24');break;case _0xe627('0x25'):_0x19adbc[_0xe627('0x15')]=_0xe627('0x26');break;case _0xe627('0x27'):_0x19adbc[_0xe627('0x15')]=_0xe627('0x28');break;case _0xe627('0x29'):_0x19adbc[_0xe627('0x15')]='FaxAccount';break;case'inboundroutes':case _0xe627('0x2a'):case'outboundroutes':_0x19adbc[_0xe627('0x15')]='VoiceExtension';break;case'contexts':_0x19adbc[_0xe627('0x15')]='VoiceContext';break;case'voicemails':_0x19adbc[_0xe627('0x15')]=_0xe627('0x2b');break;case _0xe627('0x2c'):_0x19adbc['childModel']='VoiceRecording';_0x19adbc['parentSections']=[{'name':_0xe627('0x2d'),'field':'name','foreignKey':_0xe627('0x2e'),'model':_0xe627('0x2f'),'filter':{'field':'role','value':[_0xe627('0x30')]}},{'name':_0xe627('0x31'),'field':'name','foreignKey':_0xe627('0x2e'),'model':_0xe627('0x2f'),'filter':{'field':_0xe627('0x32'),'value':[_0xe627('0x33')]}},{'name':_0xe627('0x34'),'field':_0xe627('0xd'),'foreignKey':'queue','model':_0xe627('0x35'),'filter':{'field':'type','value':[_0xe627('0x36')]}},{'name':'QueueCampaigns','field':_0xe627('0xd'),'foreignKey':_0xe627('0x37'),'model':_0xe627('0x35'),'filter':{'field':_0xe627('0x12'),'value':[_0xe627('0x38')]}}];break;case _0xe627('0x39'):_0x19adbc[_0xe627('0x15')]=_0xe627('0x3a');break;case _0xe627('0x3b'):_0x19adbc[_0xe627('0x15')]=_0xe627('0x3c');break;case _0xe627('0x3d'):_0x19adbc[_0xe627('0x15')]='VoicePrefix';break;case'ivrcampaigns':_0x19adbc['childModel']='Campaign';break;case'mailqueues':_0x19adbc['childModel']=_0xe627('0x3e');break;case'mailaccounts':_0x19adbc[_0xe627('0x15')]='MailAccount';break;case _0xe627('0x3f'):_0x19adbc[_0xe627('0x15')]=_0xe627('0x40');break;case'openchannelqueues':_0x19adbc['childModel']=_0xe627('0x41');break;case'openchannelaccounts':_0x19adbc['childModel']=_0xe627('0x42');break;case'smsqueues':_0x19adbc[_0xe627('0x15')]='SmsQueue';break;case'smsaccounts':_0x19adbc[_0xe627('0x15')]=_0xe627('0x43');break;case _0xe627('0x44'):_0x19adbc['childModel']='WhatsappQueue';break;case _0xe627('0x45'):_0x19adbc['childModel']='WhatsappAccount';break;case _0xe627('0x46'):_0x19adbc[_0xe627('0x15')]=_0xe627('0x47');break;case _0xe627('0x48'):case _0xe627('0x49'):_0x19adbc[_0xe627('0x15')]='VoiceQueue';if(_0x42f3d1){_0x19adbc[_0xe627('0x1a')]=[{'name':_0xe627('0x34')},{'name':'QueueCampaigns'}];}break;case'users':case _0xe627('0x4a'):case _0xe627('0x4b'):_0x19adbc[_0xe627('0x15')]=_0xe627('0x2f');if(_0x42f3d1){_0x19adbc[_0xe627('0x1a')]=[{'name':_0xe627('0x4c'),'filter':{'field':_0xe627('0x32'),'value':['admin',_0xe627('0x4d')]},'ignore':!![]},{'name':'Agents'},{'name':_0xe627('0x31')}];}break;case _0xe627('0x4e'):_0x19adbc[_0xe627('0x15')]='ZendeskAccount';break;case _0xe627('0x4f'):_0x19adbc['childModel']=_0xe627('0x50');break;case _0xe627('0x51'):_0x19adbc[_0xe627('0x15')]=_0xe627('0x52');break;case _0xe627('0x53'):_0x19adbc['childModel']=_0xe627('0x54');break;case _0xe627('0x55'):_0x19adbc[_0xe627('0x15')]=_0xe627('0x56');break;case _0xe627('0x57'):_0x19adbc[_0xe627('0x15')]=_0xe627('0x58');break;case _0xe627('0x59'):_0x19adbc[_0xe627('0x15')]=_0xe627('0x2f');break;case'cannedanswers':_0x19adbc[_0xe627('0x15')]=_0xe627('0x5a');break;case'dispositions':_0x19adbc[_0xe627('0x15')]=_0xe627('0x5b');break;case'customdashboards':_0x19adbc[_0xe627('0x15')]=_0xe627('0x5c');break;case'intervals':_0x19adbc[_0xe627('0x15')]=_0xe627('0x5d');break;case'pauses':_0x19adbc[_0xe627('0x15')]='Pause';break;case'scheduler':_0x19adbc['childModel']='Schedule';break;case'sounds':_0x19adbc[_0xe627('0x15')]=_0xe627('0x5e');break;case _0xe627('0x5f'):_0x19adbc[_0xe627('0x15')]=_0xe627('0x60');break;case _0xe627('0x61'):_0x19adbc['childModel']=_0xe627('0x62');break;case _0xe627('0x63'):_0x19adbc['childModel']='Trigger';break;case'trunks':_0x19adbc[_0xe627('0x15')]=_0xe627('0x64');break;case _0xe627('0x65'):_0x19adbc[_0xe627('0x15')]=_0xe627('0x66');break;case _0xe627('0x67'):_0x19adbc[_0xe627('0x15')]=_0xe627('0x68');break;case'extractedreports':_0x19adbc[_0xe627('0x15')]='AnalyticExtractedReport';_0x19adbc[_0xe627('0x1a')]=[{'name':'Reports','field':'id','foreignKey':_0xe627('0x69')}];break;case _0xe627('0x6a'):_0x19adbc[_0xe627('0x15')]=_0xe627('0x6b');break;}return _0x19adbc;}function _0x42706c(_0x27c269,_0x1cff67){var _0x36c13e=_0x27c269[_0xe627('0x6c')](0x0)['toUpperCase']()+_0x27c269[_0xe627('0x6d')](0x1);var _0x45cc2e={'type':_0x2b7158[_0xe627('0x6e')][_0xe627('0x6f')][_0xe627('0x70')],'raw':!![]};return new Promise(function(_0x5cbaa4,_0x503272){var _0x2a7ab9=squel[_0xe627('0x71')]()['field'](_0xe627('0x72')+_0x36c13e+_0xe627('0x73'),'id')[_0xe627('0x7')](_0xe627('0x74'))[_0xe627('0x75')](_0xe627('0x76')+_0x27c269+_0xe627('0x77'),'ui')[_0xe627('0x78')]('ui.UserId\x20=\x20?',_0x1cff67['id']);return _0x2b7158[_0xe627('0x79')]['query'](_0x2a7ab9[_0xe627('0x7a')](),_0x45cc2e)[_0xe627('0x7b')](function(_0x2a2c73){_0x1cff67[_0x36c13e+_0xe627('0x7c')]=_0x2a2c73;_0x5cbaa4(_0x2a2c73);})['catch'](function(_0x4c04cc){_0x503272(_0x4c04cc);});});}return _0x48b97a[_0xe627('0x7d')](_0xe627('0x7e'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3434a1){var _0xc4f431={'raw':![],'where':{}};var _0x5a81a8={};var _0x3d5b51={'count':0x0,'rows':[]};var _0x1c9628=_0x3434a1['query']['section'];var _0x364496=_0x3434a1['query'][_0xe627('0x7f')]||![];var _0x3e37cc=_0x29221b(_0x1c9628,_0x364496);if(!_0x3e37cc[_0xe627('0x15')])throw new Error('Invalid\x20section\x20\x27'+_0x1c9628+'\x27');var _0x36579d=[{'name':_0x1c9628}];if(!_[_0xe627('0x80')](_0x3e37cc[_0xe627('0x1a')]))_0x36579d=_0x3e37cc[_0xe627('0x1a')];var _0x54ffa6=[];for(var _0x57e4fd=0x0;_0x57e4fd<_0x36579d[_0xe627('0x81')];_0x57e4fd++){_0x54ffa6[_0xe627('0x82')](_0x2b7158['UserProfileSection'][_0xe627('0x83')]({'where':{'userProfileId':_0x3434a1['params']['id'],'name':_0x36579d[_0x57e4fd]['name']},'raw':!![]}));}return Promise[_0xe627('0x84')](_0x54ffa6)[_0xe627('0x7b')](function(_0x4c58ee){var _0x4edbc8=_[_0xe627('0x6')](_0x4c58ee,function(_0x415524){return _0x415524?_0x415524:undefined;});var _0x99536f=_[_0xe627('0x6')](_0x36579d,[_0xe627('0x85'),!![]]);var _0x17d03b=_['isEmpty'](_0x4edbc8)&&_['isEmpty'](_0x99536f)?null:_['union'](_0x99536f,_0x4edbc8);if(!_0x17d03b)return null;var _0x1e92de=[];for(var _0x308bb2=0x0;_0x308bb2<_0x17d03b['length'];_0x308bb2++){var _0x25c89d=_[_0xe627('0x83')](_0x36579d,function(_0x33b7b6){return _0x17d03b[_0x308bb2]?_0x33b7b6[_0xe627('0xd')]===_0x17d03b[_0x308bb2]['name']:null;});if(_0x25c89d){if(_0x17d03b[_0x308bb2][_0xe627('0x85')]){_0x1e92de[_0xe627('0x82')](_0x2abdc7(_0x3e37cc[_0xe627('0x15')],_0x17d03b[_0x308bb2]));}else{if(!_0x17d03b[_0x308bb2][_0xe627('0x86')]){_0x1e92de['push'](_0x54720a(_0x25c89d,_0x17d03b[_0x308bb2],_0x3e37cc[_0xe627('0x15')]));}else{if(_0x25c89d[_0xe627('0xc')]){_0x1e92de[_0xe627('0x82')](_0x16db2f(_0x25c89d,_0x17d03b[_0x308bb2]));}}}}}return Promise['all'](_0x1e92de);})['then'](function(_0x4ff0ee){var _0x58cbd8=_0x4ff0ee;var _0x4cafb7=null;if(_0x58cbd8){_0x4cafb7=_0x58cbd8[_0xe627('0x81')]===0x1?_0x58cbd8[0x0]:null;}if(!_0x4cafb7&&!_0x58cbd8)return _0x3d5b51;var _0x3e09c7=_0x2b7158[_0x3e37cc[_0xe627('0x15')]][_0xe627('0x87')];_0x5a81a8[_0xe627('0xc')]=_[_0xe627('0x88')](_0x3e09c7);_0x5a81a8['query']=_[_0xe627('0x88')](_0x3434a1[_0xe627('0x89')]);_0x5a81a8[_0xe627('0x8a')]=_[_0xe627('0x8b')](_0x5a81a8[_0xe627('0xc')],_0x5a81a8['query']);_0xc4f431['attributes']=_['intersection'](_0x5a81a8[_0xe627('0xc')],qs[_0xe627('0x8c')](_0x3434a1['query'][_0xe627('0x8c')]));_0xc4f431[_0xe627('0x8d')]=_0xc4f431[_0xe627('0x8d')][_0xe627('0x81')]?_0xc4f431['attributes']:_0x5a81a8['model'];if(!_0x3434a1[_0xe627('0x89')]['hasOwnProperty'](_0xe627('0x8e'))){_0xc4f431[_0xe627('0x8f')]=qs[_0xe627('0x8f')](_0x3434a1['query']['limit']);_0xc4f431[_0xe627('0x90')]=qs['offset'](_0x3434a1['query']['offset']);}_0xc4f431[_0xe627('0x91')]=qs[_0xe627('0x92')](_0x3434a1['query'][_0xe627('0x92')]);_0xc4f431[_0xe627('0x78')]=qs['filters'](_[_0xe627('0x93')](_0x3434a1[_0xe627('0x89')],_0x5a81a8[_0xe627('0x8a')]));if(_0x3434a1[_0xe627('0x89')][_0xe627('0x6')]){_0xc4f431[_0xe627('0x78')]=_['merge'](_0xc4f431[_0xe627('0x78')],{'$or':_[_0xe627('0xa')](_0x3e09c7,function(_0x4a69dc){if(_0x4a69dc[_0xe627('0x12')][_0xe627('0x94')]!=='VIRTUAL'){var _0x2a5757={};_0x2a5757[_0x4a69dc[_0xe627('0x7')]]={'$like':'%'+_0x3434a1[_0xe627('0x89')]['filter']+'%'};return _0x2a5757;}})});}var _0x4cb71c=[];var _0x471058=null;var _0x30ec1e={};if(_0x4cafb7){_0x471058=_[_0xe627('0x83')](_0x36579d,[_0xe627('0xd'),_0x4cafb7[_0xe627('0xd')]]);if(_0x471058[_0xe627('0x7')]){_0x30ec1e={};if(_0x3e37cc[_0xe627('0x15')]===_0xe627('0x11')){_0x30ec1e[_0x471058[_0xe627('0x95')]]=_[_0xe627('0xa')](_0x4cafb7[_0xe627('0x9')],'id');}else{_0x30ec1e[_0x471058['foreignKey']]=_0x4cafb7[_0xe627('0x9')];}_0x4cb71c[_0xe627('0x82')](_0x30ec1e);}else{_0xc4f431[_0xe627('0x78')]['id']=_0x4cafb7[_0xe627('0x9')];}}else{for(var _0x421821=0x0;_0x421821<_0x58cbd8[_0xe627('0x81')];_0x421821++){_0x471058=_[_0xe627('0x83')](_0x36579d,['name',_0x58cbd8[_0x421821][_0xe627('0xd')]]);if(_0x471058[_0xe627('0x7')]){_0x30ec1e={};_0x30ec1e[_0x471058[_0xe627('0x95')]]=_0x58cbd8[_0x421821]['associatedResources'];_0x4cb71c[_0xe627('0x82')](_0x30ec1e);}else{if(!_0xc4f431['where']['id'])_0xc4f431['where']['id']=[];_0x58cbd8[_0x421821][_0xe627('0x9')][_0xe627('0x96')](function(_0x203e4e){_0xc4f431['where']['id'][_0xe627('0x82')](_0x203e4e);});}}}if(!_[_0xe627('0x80')](_0x4cb71c)){_0xc4f431['where']=_[_0xe627('0x97')](_0xc4f431['where'],{'$and':{'$or':_0x4cb71c}});}_0xc4f431=_['merge']({},_0xc4f431,_0x3434a1[_0xe627('0x98')]);if(_0x4cafb7&&!_0x4cafb7[_0xe627('0x86')]&&_0x3e37cc[_0xe627('0x15')]==='AnalyticExtractedReport'){if(_0x3434a1[_0xe627('0x89')][_0xe627('0x99')]){_0xc4f431[_0xe627('0x9a')]=[{'all':!![]}];}return _0x2b7158[_0x3e37cc[_0xe627('0x15')]][_0xe627('0x8')](_0xc4f431)['then'](function(_0x339996){var _0x12c4c5=[];_0x339996[_0xe627('0x96')](function(_0x40f7b7){var _0x4658b4;switch(_0x40f7b7[_0xe627('0x9b')]){case _0xe627('0x9c'):_0x4658b4=_[_0xe627('0x83')](_0x4cafb7[_0xe627('0x9')],function(_0x106a38){return _0x106a38['id']===_0x40f7b7['reportId']&&_0x106a38['type']===_0xe627('0x9d');});break;case _0xe627('0x9e'):_0x4658b4=_['find'](_0x4cafb7[_0xe627('0x9')],function(_0x21ea37){return _0x21ea37['id']===_0x40f7b7[_0xe627('0x69')]&&_0x21ea37[_0xe627('0x12')]===_0xe627('0x9f');});break;}if(_0x4658b4)_0x12c4c5[_0xe627('0x82')](_0x40f7b7);});_0x3d5b51[_0xe627('0xa0')]=_0x12c4c5[_0xe627('0x81')];_0x3d5b51[_0xe627('0xa1')]=_0x12c4c5;return _0x3d5b51;});}else{return _0x2b7158[_0x3e37cc[_0xe627('0x15')]][_0xe627('0xa0')]({'where':_0xc4f431[_0xe627('0x78')]})[_0xe627('0x7b')](function(_0x562550){_0x3d5b51[_0xe627('0xa0')]=_0x562550;if(_0x3434a1[_0xe627('0x89')][_0xe627('0x99')]){if(_0x3e37cc['childModel']==='CmContact'){_0xc4f431[_0xe627('0x9a')]=[{'model':_0x2b7158['Tag'],'as':_0xe627('0xa2'),'attributes':['id',_0xe627('0xd'),_0xe627('0xa3')],'required':_0x3434a1['query'][_0xe627('0xa4')]?!![]:![]},{'model':_0x2b7158['Tag'],'as':_0xe627('0xa5'),'attributes':['id',_0xe627('0xd'),_0xe627('0xa3')],'through':_0x3434a1['query'][_0xe627('0xa4')]?{'attributes':[],'where':{'TagId':_0x3434a1[_0xe627('0x89')]['tag']||undefined}}:{},'required':_0x3434a1[_0xe627('0x89')][_0xe627('0xa4')]?!![]:![]}];}else{_0xc4f431[_0xe627('0x9a')]=[{'all':!![]}];}}return _0x2b7158[_0x3e37cc['childModel']][_0xe627('0x8')](_0xc4f431);})['then'](function(_0x5d5aaa){_0x3d5b51[_0xe627('0xa1')]=_0x5d5aaa;if(_0x1c9628===_0xe627('0x2d')&&_0x3434a1[_0xe627('0x89')][_0xe627('0xa6')]===_0xe627('0xa7')){var _0x17ca45=[];for(var _0x5c424a=0x0;_0x5c424a<_0x3d5b51[_0xe627('0xa1')][_0xe627('0x81')];_0x5c424a++){_0x17ca45[_0xe627('0x82')](_0x42706c(_0xe627('0xa8'),_0x3d5b51['rows'][_0x5c424a][_0xe627('0xa9')]));_0x17ca45[_0xe627('0x82')](_0x42706c(_0xe627('0xaa'),_0x3d5b51[_0xe627('0xa1')][_0x5c424a][_0xe627('0xa9')]));_0x17ca45[_0xe627('0x82')](_0x42706c(_0xe627('0xab'),_0x3d5b51['rows'][_0x5c424a]['dataValues']));_0x17ca45['push'](_0x42706c(_0xe627('0xac'),_0x3d5b51[_0xe627('0xa1')][_0x5c424a]['dataValues']));_0x17ca45[_0xe627('0x82')](_0x42706c(_0xe627('0xad'),_0x3d5b51['rows'][_0x5c424a]['dataValues']));_0x17ca45['push'](_0x42706c(_0xe627('0xae'),_0x3d5b51[_0xe627('0xa1')][_0x5c424a]['dataValues']));}return Promise[_0xe627('0x84')](_0x17ca45)['then'](function(){return _0x3d5b51;});}return _0x3d5b51;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 4e7e54c..2f3effd 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 _0x4888=['../../config/environment','jayson/promise','client','http','redis','./userProfile.socket','request','then','info','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x19543c,_0x3d0c26){var _0x41e0de=function(_0x1bd03a){while(--_0x1bd03a){_0x19543c['push'](_0x19543c['shift']());}};_0x41e0de(++_0x3d0c26);}(_0x4888,0x198));var _0x8488=function(_0x4989fe,_0x201e34){_0x4989fe=_0x4989fe-0x0;var _0x4afd24=_0x4888[_0x4989fe];return _0x4afd24;};'use strict';var _=require('lodash');var util=require(_0x8488('0x0'));var moment=require(_0x8488('0x1'));var BPromise=require(_0x8488('0x2'));var rs=require(_0x8488('0x3'));var fs=require('fs');var Redis=require(_0x8488('0x4'));var db=require(_0x8488('0x5'))['db'];var utils=require(_0x8488('0x6'));var logger=require('../../config/logger')(_0x8488('0x7'));var config=require(_0x8488('0x8'));var jayson=require(_0x8488('0x9'));var client=jayson[_0x8488('0xa')][_0x8488('0xb')]({'port':0x232a});config[_0x8488('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8488('0xc')]));require(_0x8488('0xd'))['register'](socket);function respondWithRpcPromise(_0x19c994,_0x1334fe,_0x98223){return new BPromise(function(_0x19a2ee,_0x515ea8){return client[_0x8488('0xe')](_0x19c994,_0x98223)[_0x8488('0xf')](function(_0x468896){logger[_0x8488('0x10')](_0x8488('0x11'),_0x1334fe,'request\x20sent');logger[_0x8488('0x12')](_0x8488('0x13'),_0x1334fe,'request\x20sent',JSON['stringify'](_0x468896));if(_0x468896[_0x8488('0x14')]){if(_0x468896['error'][_0x8488('0x15')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x1334fe,_0x468896[_0x8488('0x14')][_0x8488('0x16')]);return _0x515ea8(_0x468896[_0x8488('0x14')][_0x8488('0x16')]);}logger[_0x8488('0x14')](_0x8488('0x11'),_0x1334fe,_0x468896[_0x8488('0x14')]['message']);return _0x19a2ee(_0x468896[_0x8488('0x14')][_0x8488('0x16')]);}else{logger[_0x8488('0x10')](_0x8488('0x11'),_0x1334fe,_0x8488('0x17'));_0x19a2ee(_0x468896[_0x8488('0x18')][_0x8488('0x16')]);}})[_0x8488('0x19')](function(_0x514c31){logger[_0x8488('0x14')](_0x8488('0x11'),_0x1334fe,_0x514c31);_0x515ea8(_0x514c31);});});} \ No newline at end of file +var _0xacc6=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','./userProfile.socket','request','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch'];(function(_0x260e07,_0x2dd0e4){var _0x28ba4e=function(_0x237146){while(--_0x237146){_0x260e07['push'](_0x260e07['shift']());}};_0x28ba4e(++_0x2dd0e4);}(_0xacc6,0x150));var _0x6acc=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xacc6[_0x1caf6a];return _0x1bf493;};'use strict';var _=require(_0x6acc('0x0'));var util=require(_0x6acc('0x1'));var moment=require(_0x6acc('0x2'));var BPromise=require(_0x6acc('0x3'));var rs=require(_0x6acc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6acc('0x5'))['db'];var utils=require(_0x6acc('0x6'));var logger=require(_0x6acc('0x7'))('rpc');var config=require(_0x6acc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6acc('0x9')][_0x6acc('0xa')]({'port':0x232a});config['redis']=_[_0x6acc('0xb')](config['redis'],{'host':_0x6acc('0xc'),'port':0x18eb});var socket=require(_0x6acc('0xd'))(new Redis(config[_0x6acc('0xe')]));require(_0x6acc('0xf'))['register'](socket);function respondWithRpcPromise(_0x1343cb,_0x4cf4c7,_0x3c1a24){return new BPromise(function(_0x21b624,_0xb8647d){return client[_0x6acc('0x10')](_0x1343cb,_0x3c1a24)[_0x6acc('0x11')](function(_0x15b64b){logger['info'](_0x6acc('0x12'),_0x4cf4c7,_0x6acc('0x13'));logger[_0x6acc('0x14')](_0x6acc('0x15'),_0x4cf4c7,_0x6acc('0x13'),JSON['stringify'](_0x15b64b));if(_0x15b64b['error']){if(_0x15b64b[_0x6acc('0x16')][_0x6acc('0x17')]===0x1f4){logger[_0x6acc('0x16')](_0x6acc('0x12'),_0x4cf4c7,_0x15b64b[_0x6acc('0x16')][_0x6acc('0x18')]);return _0xb8647d(_0x15b64b[_0x6acc('0x16')][_0x6acc('0x18')]);}logger[_0x6acc('0x16')](_0x6acc('0x12'),_0x4cf4c7,_0x15b64b[_0x6acc('0x16')][_0x6acc('0x18')]);return _0x21b624(_0x15b64b[_0x6acc('0x16')][_0x6acc('0x18')]);}else{logger[_0x6acc('0x19')](_0x6acc('0x12'),_0x4cf4c7,_0x6acc('0x13'));_0x21b624(_0x15b64b[_0x6acc('0x1a')]['message']);}})[_0x6acc('0x1b')](function(_0x43b8ca){logger[_0x6acc('0x16')](_0x6acc('0x12'),_0x4cf4c7,_0x43b8ca);_0xb8647d(_0x43b8ca);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index dcb3602..49e517a 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 _0x8c1e=['length','userProfile:','./userProfile.events','save','remove','update','register'];(function(_0x4bcd6a,_0x413d41){var _0x28b6b=function(_0x4c857e){while(--_0x4c857e){_0x4bcd6a['push'](_0x4bcd6a['shift']());}};_0x28b6b(++_0x413d41);}(_0x8c1e,0xf7));var _0xe8c1=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x8c1e[_0x599f41];return _0x2e4d58;};'use strict';var UserProfileEvents=require(_0xe8c1('0x0'));var events=[_0xe8c1('0x1'),_0xe8c1('0x2'),_0xe8c1('0x3')];function createListener(_0x586aa5,_0x48203f){return function(_0x490c7e){_0x48203f['emit'](_0x586aa5,_0x490c7e);};}function removeListener(_0x1e3406,_0x4aca1a){return function(){UserProfileEvents['removeListener'](_0x1e3406,_0x4aca1a);};}exports[_0xe8c1('0x4')]=function(_0x10670a){for(var _0x55aac2=0x0,_0x1e60d5=events[_0xe8c1('0x5')];_0x55aac2<_0x1e60d5;_0x55aac2++){var _0x3fd9b1=events[_0x55aac2];var _0x1fce07=createListener(_0xe8c1('0x6')+_0x3fd9b1,_0x10670a);UserProfileEvents['on'](_0x3fd9b1,_0x1fce07);}}; \ No newline at end of file +var _0xbc6e=['register','length','userProfile:','remove','update','emit'];(function(_0x47ae2e,_0x374292){var _0x26c909=function(_0x48e3a2){while(--_0x48e3a2){_0x47ae2e['push'](_0x47ae2e['shift']());}};_0x26c909(++_0x374292);}(_0xbc6e,0xa5));var _0xebc6=function(_0x3c3cad,_0x51e709){_0x3c3cad=_0x3c3cad-0x0;var _0x27d5e6=_0xbc6e[_0x3c3cad];return _0x27d5e6;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save',_0xebc6('0x0'),_0xebc6('0x1')];function createListener(_0x268dfb,_0x41f4a9){return function(_0x678dca){_0x41f4a9[_0xebc6('0x2')](_0x268dfb,_0x678dca);};}function removeListener(_0x250fda,_0x22c9a7){return function(){UserProfileEvents['removeListener'](_0x250fda,_0x22c9a7);};}exports[_0xebc6('0x3')]=function(_0x495de3){for(var _0x1db72c=0x0,_0xf47146=events[_0xebc6('0x4')];_0x1db72c<_0xf47146;_0x1db72c++){var _0x515b99=events[_0x1db72c];var _0x4733a7=createListener(_0xebc6('0x5')+_0x515b99,_0x495de3);UserProfileEvents['on'](_0x515b99,_0x4733a7);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index f233bbb..a8292c7 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 _0x2352=['create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','show','post'];(function(_0x40e402,_0x1e59cd){var _0x4738d7=function(_0xfc213d){while(--_0xfc213d){_0x40e402['push'](_0x40e402['shift']());}};_0x4738d7(++_0x1e59cd);}(_0x2352,0x156));var _0x2235=function(_0x27839b,_0x387853){_0x27839b=_0x27839b-0x0;var _0x46fad9=_0x2352[_0x27839b];return _0x46fad9;};'use strict';var multer=require(_0x2235('0x0'));var util=require(_0x2235('0x1'));var path=require(_0x2235('0x2'));var timeout=require(_0x2235('0x3'));var express=require(_0x2235('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2235('0x5'));var config=require(_0x2235('0x6'));var controller=require(_0x2235('0x7'));router[_0x2235('0x8')]('/',auth[_0x2235('0x9')](),controller[_0x2235('0xa')]);router['get'](_0x2235('0xb'),auth[_0x2235('0x9')](),controller[_0x2235('0xc')]);router[_0x2235('0x8')]('/:id',auth[_0x2235('0x9')](),controller[_0x2235('0xd')]);router[_0x2235('0xe')]('/',auth[_0x2235('0x9')](),controller[_0x2235('0xf')]);router[_0x2235('0x10')](_0x2235('0x11'),auth['isAuthenticated'](),controller[_0x2235('0x12')]);router[_0x2235('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x2235('0x14')]);module['exports']=router; \ No newline at end of file +var _0x1b3a=['exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','delete'];(function(_0x4a231f,_0x1989a6){var _0x7ea6bf=function(_0x2d179c){while(--_0x2d179c){_0x4a231f['push'](_0x4a231f['shift']());}};_0x7ea6bf(++_0x1989a6);}(_0x1b3a,0x119));var _0xa1b3=function(_0x39f1a9,_0x385632){_0x39f1a9=_0x39f1a9-0x0;var _0x56b1f6=_0x1b3a[_0x39f1a9];return _0x56b1f6;};'use strict';var multer=require(_0xa1b3('0x0'));var util=require('util');var path=require(_0xa1b3('0x1'));var timeout=require(_0xa1b3('0x2'));var express=require('express');var router=express[_0xa1b3('0x3')]();var fs_extra=require(_0xa1b3('0x4'));var auth=require(_0xa1b3('0x5'));var interaction=require(_0xa1b3('0x6'));var config=require(_0xa1b3('0x7'));var controller=require(_0xa1b3('0x8'));router[_0xa1b3('0x9')]('/',auth[_0xa1b3('0xa')](),controller[_0xa1b3('0xb')]);router[_0xa1b3('0x9')](_0xa1b3('0xc'),auth[_0xa1b3('0xa')](),controller['describe']);router[_0xa1b3('0x9')](_0xa1b3('0xd'),auth[_0xa1b3('0xa')](),controller[_0xa1b3('0xe')]);router[_0xa1b3('0xf')]('/',auth[_0xa1b3('0xa')](),controller[_0xa1b3('0x10')]);router[_0xa1b3('0x11')](_0xa1b3('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xa1b3('0x12')]('/:id',auth[_0xa1b3('0xa')](),controller['destroy']);module[_0xa1b3('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index ccc8893..6202f3b 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 _0x365e=['STRING','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x365e,0xcd));var _0xe365=function(_0x14d2c7,_0x468f7c){_0x14d2c7=_0x14d2c7-0x0;var _0x1a9801=_0x365e[_0x14d2c7];return _0x1a9801;};'use strict';var Sequelize=require('sequelize');module[_0xe365('0x0')]={'name':{'type':Sequelize[_0xe365('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xe365('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x3882=['sequelize','INTEGER','STRING'];(function(_0x48a801,_0x5b1ee8){var _0x400a17=function(_0x371bbc){while(--_0x371bbc){_0x48a801['push'](_0x48a801['shift']());}};_0x400a17(++_0x5b1ee8);}(_0x3882,0x87));var _0x2388=function(_0x1b258a,_0x481d57){_0x1b258a=_0x1b258a-0x0;var _0x514815=_0x3882[_0x1b258a];return _0x514815;};'use strict';var Sequelize=require(_0x2388('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x2388('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x2388('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 ab78f27..05f034b 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 _0x1261=['end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','send','UserProfileResource','model','map','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filters','where','type','VIRTUAL','filter','merge','options','findAll','rows','params','include','find','create','catch','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0xbcb528,_0x1deefc){var _0x5f5446=function(_0x2837a9){while(--_0x2837a9){_0xbcb528['push'](_0xbcb528['shift']());}};_0x5f5446(++_0x1deefc);}(_0x1261,0x144));var _0x1126=function(_0x132fb6,_0x7a257b){_0x132fb6=_0x132fb6-0x0;var _0x2ca9d5=_0x1261[_0x132fb6];return _0x2ca9d5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];function respondWithStatusCode(_0xd26a32,_0x273896){_0x273896=_0x273896||0xcc;return function(_0xca0355){if(_0xca0355){return _0xd26a32[_0x1126('0x18')](_0x273896);}return _0xd26a32[_0x1126('0x19')](_0x273896)[_0x1126('0x1a')]();};}function respondWithResult(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xc8;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x19')](_0x53a8f0)[_0x1126('0x1b')](_0x5de9a7);}};}function respondWithFilteredResult(_0x279455,_0x4be0c6){return function(_0x45149c){if(_0x45149c){var _0x4794a7=typeof _0x4be0c6[_0x1126('0x1c')]===_0x1126('0x1d')&&typeof _0x4be0c6[_0x1126('0x1e')]==='undefined';var _0x245cd7=_0x45149c[_0x1126('0x1f')];var _0x4a7b49=_0x4794a7?0x0:_0x4be0c6['offset'];var _0x22ae0b=_0x4794a7?_0x45149c[_0x1126('0x1f')]:_0x4be0c6['offset']+_0x4be0c6['limit'];var _0x4564c0;if(_0x22ae0b>=_0x245cd7){_0x22ae0b=_0x245cd7;_0x4564c0=0xc8;}else{_0x4564c0=0xce;}_0x279455['status'](_0x4564c0);return _0x279455[_0x1126('0x20')](_0x1126('0x21'),_0x4a7b49+'-'+_0x22ae0b+'/'+_0x245cd7)[_0x1126('0x1b')](_0x45149c);}return null;};}function patchUpdates(_0x54400a){return function(_0x2a08ba){try{jsonpatch['apply'](_0x2a08ba,_0x54400a,!![]);}catch(_0x56efeb){return BPromise[_0x1126('0x22')](_0x56efeb);}return _0x2a08ba[_0x1126('0x23')]();};}function saveUpdates(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x24')](_0x25b24b)[_0x1126('0x25')](function(_0x48a08d){return _0x48a08d;});}return null;};}function removeEntity(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(_0x529dd9){return _0x529dd9['destroy']()[_0x1126('0x25')](function(){_0x2175fa[_0x1126('0x19')](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0x34bcf1,_0x566c09){return function(_0x1b07a7){if(!_0x1b07a7){_0x34bcf1[_0x1126('0x18')](0x194);}return _0x1b07a7;};}function handleError(_0x38119d,_0x589725){_0x589725=_0x589725||0x1f4;return function(_0x35eec3){logger[_0x1126('0x26')](_0x35eec3[_0x1126('0x27')]);if(_0x35eec3['name']){delete _0x35eec3['name'];}_0x38119d[_0x1126('0x19')](_0x589725)[_0x1126('0x28')](_0x35eec3);};}exports['index']=function(_0x2fb797,_0x23d2bc){var _0x4a334a={},_0x3fa694={},_0x4bf807={'count':0x0,'rows':[]};var _0xc62460=_['map'](db[_0x1126('0x29')]['rawAttributes'],function(_0x378f4d){return{'name':_0x378f4d['fieldName'],'type':_0x378f4d['type']['key']};});_0x3fa694[_0x1126('0x2a')]=_[_0x1126('0x2b')](_0xc62460,_0x1126('0x2c'));_0x3fa694['query']=_[_0x1126('0x2d')](_0x2fb797[_0x1126('0x2e')]);_0x3fa694['filters']=_[_0x1126('0x2f')](_0x3fa694[_0x1126('0x2a')],_0x3fa694[_0x1126('0x2e')]);_0x4a334a[_0x1126('0x30')]=_['intersection'](_0x3fa694['model'],qs[_0x1126('0x31')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x31')]));_0x4a334a[_0x1126('0x30')]=_0x4a334a['attributes'][_0x1126('0x32')]?_0x4a334a[_0x1126('0x30')]:_0x3fa694[_0x1126('0x2a')];if(!_0x2fb797[_0x1126('0x2e')][_0x1126('0x33')]('nolimit')){_0x4a334a[_0x1126('0x1e')]=qs[_0x1126('0x1e')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1e')]);_0x4a334a['offset']=qs['offset'](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1c')]);}_0x4a334a['order']=qs[_0x1126('0x34')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x34')]);_0x4a334a['where']=qs['filters'](_[_0x1126('0x35')](_0x2fb797[_0x1126('0x2e')],_0x3fa694[_0x1126('0x36')]),_0xc62460);if(_0x2fb797[_0x1126('0x2e')]['filter']){_0x4a334a[_0x1126('0x37')]=_['merge'](_0x4a334a[_0x1126('0x37')],{'$or':_[_0x1126('0x2b')](_0xc62460,function(_0xfa96e0){if(_0xfa96e0[_0x1126('0x38')]!==_0x1126('0x39')){var _0x5746f6={};_0x5746f6[_0xfa96e0[_0x1126('0x2c')]]={'$like':'%'+_0x2fb797[_0x1126('0x2e')][_0x1126('0x3a')]+'%'};return _0x5746f6;}})});}_0x4a334a=_[_0x1126('0x3b')]({},_0x4a334a,_0x2fb797[_0x1126('0x3c')]);var _0x3442b8={'where':_0x4a334a[_0x1126('0x37')]};return db['UserProfileResource'][_0x1126('0x1f')](_0x3442b8)[_0x1126('0x25')](function(_0x227a6b){_0x4bf807[_0x1126('0x1f')]=_0x227a6b;if(_0x2fb797[_0x1126('0x2e')]['includeAll']){_0x4a334a['include']=[{'all':!![]}];}return db[_0x1126('0x29')][_0x1126('0x3d')](_0x4a334a);})[_0x1126('0x25')](function(_0x21c38e){_0x4bf807[_0x1126('0x3e')]=_0x21c38e;return _0x4bf807;})[_0x1126('0x25')](respondWithFilteredResult(_0x23d2bc,_0x4a334a))['catch'](handleError(_0x23d2bc,null));};exports['show']=function(_0x4cb1db,_0xb8054e){var _0x5d4194={'raw':![],'where':{'id':_0x4cb1db[_0x1126('0x3f')]['id']}},_0xf84005={};_0xf84005[_0x1126('0x2a')]=_[_0x1126('0x2d')](db['UserProfileResource']['rawAttributes']);_0xf84005[_0x1126('0x2e')]=_[_0x1126('0x2d')](_0x4cb1db[_0x1126('0x2e')]);_0xf84005['filters']=_[_0x1126('0x2f')](_0xf84005['model'],_0xf84005[_0x1126('0x2e')]);_0x5d4194['attributes']=_[_0x1126('0x2f')](_0xf84005[_0x1126('0x2a')],qs[_0x1126('0x31')](_0x4cb1db['query'][_0x1126('0x31')]));_0x5d4194[_0x1126('0x30')]=_0x5d4194[_0x1126('0x30')]['length']?_0x5d4194['attributes']:_0xf84005['model'];if(_0x4cb1db[_0x1126('0x2e')]['includeAll']){_0x5d4194[_0x1126('0x40')]=[{'all':!![]}];}_0x5d4194=_['merge']({},_0x5d4194,_0x4cb1db[_0x1126('0x3c')]);return db[_0x1126('0x29')][_0x1126('0x41')](_0x5d4194)[_0x1126('0x25')](handleEntityNotFound(_0xb8054e,null))[_0x1126('0x25')](respondWithResult(_0xb8054e,null))['catch'](handleError(_0xb8054e,null));};exports[_0x1126('0x42')]=function(_0x512f60,_0x5111d3){return db[_0x1126('0x29')][_0x1126('0x42')](_0x512f60['body'],{})[_0x1126('0x25')](respondWithResult(_0x5111d3,0xc9))[_0x1126('0x43')](handleError(_0x5111d3,null));};exports['update']=function(_0x3e4eeb,_0xbdde58){if(_0x3e4eeb[_0x1126('0x44')]['id']){delete _0x3e4eeb['body']['id'];}return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'id':_0x3e4eeb[_0x1126('0x3f')]['id']}})[_0x1126('0x25')](handleEntityNotFound(_0xbdde58,null))[_0x1126('0x25')](saveUpdates(_0x3e4eeb[_0x1126('0x44')],null))[_0x1126('0x25')](respondWithResult(_0xbdde58,null))[_0x1126('0x43')](handleError(_0xbdde58,null));};exports['destroy']=function(_0x1b8b83,_0x5a2287){return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'id':_0x1b8b83['params']['id']}})['then'](handleEntityNotFound(_0x5a2287,null))[_0x1126('0x25')](removeEntity(_0x5a2287,null))[_0x1126('0x43')](handleError(_0x5a2287,null));};exports[_0x1126('0x45')]=function(_0x52a9a4,_0x3cb44c){return db[_0x1126('0x29')][_0x1126('0x45')]()[_0x1126('0x25')](respondWithResult(_0x3cb44c,null))['catch'](handleError(_0x3cb44c,null));}; \ No newline at end of file +var _0x0295=['params','intersection','include','find','create','body','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','UserProfileResource','includeAll','rows','catch','show'];(function(_0x1fdb40,_0x51351c){var _0x281f93=function(_0x35eebe){while(--_0x35eebe){_0x1fdb40['push'](_0x1fdb40['shift']());}};_0x281f93(++_0x51351c);}(_0x0295,0x1f0));var _0x5029=function(_0x69d91e,_0x12fec6){_0x69d91e=_0x69d91e-0x0;var _0x381436=_0x0295[_0x69d91e];return _0x381436;};'use strict';var emlformat=require(_0x5029('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5029('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5029('0x2'));var Mustache=require(_0x5029('0x3'));var util=require(_0x5029('0x4'));var path=require(_0x5029('0x5'));var sox=require(_0x5029('0x6'));var csv=require(_0x5029('0x7'));var ejs=require(_0x5029('0x8'));var fs=require('fs');var fs_extra=require(_0x5029('0x9'));var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];function respondWithStatusCode(_0x2442b2,_0x4cced9){_0x4cced9=_0x4cced9||0xcc;return function(_0x4fa22d){if(_0x4fa22d){return _0x2442b2['sendStatus'](_0x4cced9);}return _0x2442b2['status'](_0x4cced9)[_0x5029('0x15')]();};}function respondWithResult(_0x2e0369,_0x12c237){_0x12c237=_0x12c237||0xc8;return function(_0x434630){if(_0x434630){return _0x2e0369[_0x5029('0x16')](_0x12c237)[_0x5029('0x17')](_0x434630);}};}function respondWithFilteredResult(_0xe278b7,_0x317c20){return function(_0x10bf55){if(_0x10bf55){var _0x326923=typeof _0x317c20[_0x5029('0x18')]===_0x5029('0x19')&&typeof _0x317c20[_0x5029('0x1a')]===_0x5029('0x19');var _0x343918=_0x10bf55['count'];var _0x1ed567=_0x326923?0x0:_0x317c20[_0x5029('0x18')];var _0x35de81=_0x326923?_0x10bf55[_0x5029('0x1b')]:_0x317c20[_0x5029('0x18')]+_0x317c20[_0x5029('0x1a')];var _0xaba461;if(_0x35de81>=_0x343918){_0x35de81=_0x343918;_0xaba461=0xc8;}else{_0xaba461=0xce;}_0xe278b7['status'](_0xaba461);return _0xe278b7[_0x5029('0x1c')]('Content-Range',_0x1ed567+'-'+_0x35de81+'/'+_0x343918)[_0x5029('0x17')](_0x10bf55);}return null;};}function patchUpdates(_0x8a414c){return function(_0x2710aa){try{jsonpatch[_0x5029('0x1d')](_0x2710aa,_0x8a414c,!![]);}catch(_0x4b5854){return BPromise['reject'](_0x4b5854);}return _0x2710aa[_0x5029('0x1e')]();};}function saveUpdates(_0x4a49b6,_0x3f657d){return function(_0x853a34){if(_0x853a34){return _0x853a34[_0x5029('0x1f')](_0x4a49b6)[_0x5029('0x20')](function(_0x16bd22){return _0x16bd22;});}return null;};}function removeEntity(_0x3a3e52,_0x125c26){return function(_0x356dac){if(_0x356dac){return _0x356dac[_0x5029('0x21')]()['then'](function(){_0x3a3e52['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x588d90,_0x45666c){return function(_0x51093c){if(!_0x51093c){_0x588d90['sendStatus'](0x194);}return _0x51093c;};}function handleError(_0x181da0,_0x1e7e61){_0x1e7e61=_0x1e7e61||0x1f4;return function(_0x36d810){logger['error'](_0x36d810[_0x5029('0x22')]);if(_0x36d810[_0x5029('0x23')]){delete _0x36d810['name'];}_0x181da0[_0x5029('0x16')](_0x1e7e61)[_0x5029('0x24')](_0x36d810);};}exports[_0x5029('0x25')]=function(_0x4a24b9,_0x32da06){var _0x251f99={},_0xe5313e={},_0x4b6f92={'count':0x0,'rows':[]};var _0x2cedf6=_[_0x5029('0x26')](db['UserProfileResource'][_0x5029('0x27')],function(_0x25032b){return{'name':_0x25032b[_0x5029('0x28')],'type':_0x25032b[_0x5029('0x29')][_0x5029('0x2a')]};});_0xe5313e[_0x5029('0x2b')]=_[_0x5029('0x26')](_0x2cedf6,_0x5029('0x23'));_0xe5313e[_0x5029('0x2c')]=_[_0x5029('0x2d')](_0x4a24b9[_0x5029('0x2c')]);_0xe5313e[_0x5029('0x2e')]=_['intersection'](_0xe5313e[_0x5029('0x2b')],_0xe5313e['query']);_0x251f99[_0x5029('0x2f')]=_['intersection'](_0xe5313e['model'],qs[_0x5029('0x30')](_0x4a24b9[_0x5029('0x2c')][_0x5029('0x30')]));_0x251f99['attributes']=_0x251f99[_0x5029('0x2f')][_0x5029('0x31')]?_0x251f99[_0x5029('0x2f')]:_0xe5313e[_0x5029('0x2b')];if(!_0x4a24b9[_0x5029('0x2c')][_0x5029('0x32')](_0x5029('0x33'))){_0x251f99[_0x5029('0x1a')]=qs[_0x5029('0x1a')](_0x4a24b9['query'][_0x5029('0x1a')]);_0x251f99[_0x5029('0x18')]=qs[_0x5029('0x18')](_0x4a24b9[_0x5029('0x2c')]['offset']);}_0x251f99[_0x5029('0x34')]=qs[_0x5029('0x35')](_0x4a24b9[_0x5029('0x2c')]['sort']);_0x251f99['where']=qs[_0x5029('0x2e')](_[_0x5029('0x36')](_0x4a24b9['query'],_0xe5313e['filters']),_0x2cedf6);if(_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]){_0x251f99[_0x5029('0x38')]=_[_0x5029('0x39')](_0x251f99[_0x5029('0x38')],{'$or':_[_0x5029('0x26')](_0x2cedf6,function(_0x3cb84e){if(_0x3cb84e[_0x5029('0x29')]!==_0x5029('0x3a')){var _0x3effa4={};_0x3effa4[_0x3cb84e[_0x5029('0x23')]]={'$like':'%'+_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]+'%'};return _0x3effa4;}})});}_0x251f99=_[_0x5029('0x39')]({},_0x251f99,_0x4a24b9['options']);var _0x57c2b5={'where':_0x251f99[_0x5029('0x38')]};return db[_0x5029('0x3b')][_0x5029('0x1b')](_0x57c2b5)['then'](function(_0x32d8a3){_0x4b6f92[_0x5029('0x1b')]=_0x32d8a3;if(_0x4a24b9['query'][_0x5029('0x3c')]){_0x251f99['include']=[{'all':!![]}];}return db[_0x5029('0x3b')]['findAll'](_0x251f99);})[_0x5029('0x20')](function(_0x359838){_0x4b6f92[_0x5029('0x3d')]=_0x359838;return _0x4b6f92;})[_0x5029('0x20')](respondWithFilteredResult(_0x32da06,_0x251f99))[_0x5029('0x3e')](handleError(_0x32da06,null));};exports[_0x5029('0x3f')]=function(_0x4b2219,_0x1021ea){var _0x2ae047={'raw':![],'where':{'id':_0x4b2219[_0x5029('0x40')]['id']}},_0x5a3e4d={};_0x5a3e4d[_0x5029('0x2b')]=_[_0x5029('0x2d')](db[_0x5029('0x3b')][_0x5029('0x27')]);_0x5a3e4d[_0x5029('0x2c')]=_['keys'](_0x4b2219[_0x5029('0x2c')]);_0x5a3e4d[_0x5029('0x2e')]=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],_0x5a3e4d[_0x5029('0x2c')]);_0x2ae047['attributes']=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],qs[_0x5029('0x30')](_0x4b2219[_0x5029('0x2c')][_0x5029('0x30')]));_0x2ae047[_0x5029('0x2f')]=_0x2ae047[_0x5029('0x2f')][_0x5029('0x31')]?_0x2ae047[_0x5029('0x2f')]:_0x5a3e4d['model'];if(_0x4b2219[_0x5029('0x2c')][_0x5029('0x3c')]){_0x2ae047[_0x5029('0x42')]=[{'all':!![]}];}_0x2ae047=_[_0x5029('0x39')]({},_0x2ae047,_0x4b2219['options']);return db['UserProfileResource'][_0x5029('0x43')](_0x2ae047)[_0x5029('0x20')](handleEntityNotFound(_0x1021ea,null))[_0x5029('0x20')](respondWithResult(_0x1021ea,null))[_0x5029('0x3e')](handleError(_0x1021ea,null));};exports[_0x5029('0x44')]=function(_0x3dfc08,_0x2bb7fc){return db[_0x5029('0x3b')][_0x5029('0x44')](_0x3dfc08[_0x5029('0x45')],{})[_0x5029('0x20')](respondWithResult(_0x2bb7fc,0xc9))[_0x5029('0x3e')](handleError(_0x2bb7fc,null));};exports[_0x5029('0x1f')]=function(_0x18f1f5,_0x3168bd){if(_0x18f1f5[_0x5029('0x45')]['id']){delete _0x18f1f5[_0x5029('0x45')]['id'];}return db[_0x5029('0x3b')][_0x5029('0x43')]({'where':{'id':_0x18f1f5[_0x5029('0x40')]['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x3168bd,null))['then'](saveUpdates(_0x18f1f5[_0x5029('0x45')],null))['then'](respondWithResult(_0x3168bd,null))[_0x5029('0x3e')](handleError(_0x3168bd,null));};exports[_0x5029('0x21')]=function(_0x4d788a,_0x5343c6){return db[_0x5029('0x3b')]['find']({'where':{'id':_0x4d788a['params']['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x5343c6,null))[_0x5029('0x20')](removeEntity(_0x5343c6,null))[_0x5029('0x3e')](handleError(_0x5343c6,null));};exports['describe']=function(_0x544fb3,_0x1510bb){return db[_0x5029('0x3b')]['describe']()[_0x5029('0x20')](respondWithResult(_0x1510bb,null))['catch'](handleError(_0x1510bb,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index a33ece6..5f1c797 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 _0xfa41=['resourceId','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','UserProfileResource','compositeIndex'];(function(_0x21949f,_0x4a61ab){var _0xff3003=function(_0x194af5){while(--_0x194af5){_0x21949f['push'](_0x21949f['shift']());}};_0xff3003(++_0x4a61ab);}(_0xfa41,0x16d));var _0x1fa4=function(_0xf02353,_0x5d599b){_0xf02353=_0xf02353-0x0;var _0x59f7df=_0xfa41[_0xf02353];return _0x59f7df;};'use strict';var _=require(_0x1fa4('0x0'));var util=require(_0x1fa4('0x1'));var logger=require('../../config/logger')(_0x1fa4('0x2'));var moment=require(_0x1fa4('0x3'));var BPromise=require(_0x1fa4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1fa4('0x5'));var rimraf=require(_0x1fa4('0x6'));var config=require(_0x1fa4('0x7'));var attributes=require(_0x1fa4('0x8'));module[_0x1fa4('0x9')]=function(_0x280c2b,_0x19135c){return _0x280c2b['define'](_0x1fa4('0xa'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x1fa4('0xb'),'fields':[_0x1fa4('0xc'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb376=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','compositeIndex','resourceId'];(function(_0x4ffd20,_0x1e83b6){var _0x49b5e2=function(_0xfdd1a6){while(--_0xfdd1a6){_0x4ffd20['push'](_0x4ffd20['shift']());}};_0x49b5e2(++_0x1e83b6);}(_0xb376,0x1d4));var _0x6b37=function(_0xdfd7dc,_0x2f45a1){_0xdfd7dc=_0xdfd7dc-0x0;var _0x5e2f73=_0xb376[_0xdfd7dc];return _0x5e2f73;};'use strict';var _=require(_0x6b37('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6b37('0x1'));var moment=require(_0x6b37('0x2'));var BPromise=require(_0x6b37('0x3'));var rp=require(_0x6b37('0x4'));var fs=require('fs');var path=require(_0x6b37('0x5'));var rimraf=require(_0x6b37('0x6'));var config=require(_0x6b37('0x7'));var attributes=require(_0x6b37('0x8'));module[_0x6b37('0x9')]=function(_0x3c155c,_0xdfbce4){return _0x3c155c[_0x6b37('0xa')]('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x6b37('0xb'),'fields':[_0x6b37('0xc'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 631d6aa..9616ada 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 _0x4546=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x23cd42,_0x2f7c60){var _0x5bd4ed=function(_0x2cdfb2){while(--_0x2cdfb2){_0x23cd42['push'](_0x23cd42['shift']());}};_0x5bd4ed(++_0x2f7c60);}(_0x4546,0x101));var _0x6454=function(_0x3b9b2e,_0x2b4045){_0x3b9b2e=_0x3b9b2e-0x0;var _0x49d29f=_0x4546[_0x3b9b2e];return _0x49d29f;};'use strict';var _=require(_0x6454('0x0'));var util=require('util');var moment=require(_0x6454('0x1'));var BPromise=require(_0x6454('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6454('0x3'));var db=require(_0x6454('0x4'))['db'];var utils=require(_0x6454('0x5'));var logger=require(_0x6454('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6454('0x7'));var client=jayson[_0x6454('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xadba89,_0x2fd82c,_0x4ddb69){return new BPromise(function(_0x8a9eb5,_0x2b4fe9){return client[_0x6454('0x9')](_0xadba89,_0x4ddb69)[_0x6454('0xa')](function(_0x4b491a){logger[_0x6454('0xb')](_0x6454('0xc'),_0x2fd82c,_0x6454('0xd'));logger['debug']('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x2fd82c,_0x6454('0xd'),JSON[_0x6454('0xe')](_0x4b491a));if(_0x4b491a[_0x6454('0xf')]){if(_0x4b491a[_0x6454('0xf')][_0x6454('0x10')]===0x1f4){logger[_0x6454('0xf')](_0x6454('0xc'),_0x2fd82c,_0x4b491a[_0x6454('0xf')][_0x6454('0x11')]);return _0x2b4fe9(_0x4b491a['error'][_0x6454('0x11')]);}logger[_0x6454('0xf')](_0x6454('0xc'),_0x2fd82c,_0x4b491a['error']['message']);return _0x8a9eb5(_0x4b491a[_0x6454('0xf')]['message']);}else{logger[_0x6454('0xb')](_0x6454('0xc'),_0x2fd82c,_0x6454('0xd'));_0x8a9eb5(_0x4b491a[_0x6454('0x12')][_0x6454('0x11')]);}})[_0x6454('0x13')](function(_0x4d6e63){logger['error'](_0x6454('0xc'),_0x2fd82c,_0x4d6e63);_0x2b4fe9(_0x4d6e63);});});} \ No newline at end of file +var _0x70eb=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','result','lodash','util','moment'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x70eb,0x9e));var _0xb70e=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x70eb[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0xb70e('0x0'));var util=require(_0xb70e('0x1'));var moment=require(_0xb70e('0x2'));var BPromise=require('bluebird');var rs=require(_0xb70e('0x3'));var fs=require('fs');var Redis=require(_0xb70e('0x4'));var db=require(_0xb70e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb70e('0x6'))(_0xb70e('0x7'));var config=require(_0xb70e('0x8'));var jayson=require(_0xb70e('0x9'));var client=jayson[_0xb70e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8bc023,_0x113cdc,_0x33a87b){return new BPromise(function(_0x3c5ffc,_0x4bd51a){return client[_0xb70e('0xb')](_0x8bc023,_0x33a87b)[_0xb70e('0xc')](function(_0x2de3a9){logger[_0xb70e('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x113cdc,_0xb70e('0xe'));logger[_0xb70e('0xf')](_0xb70e('0x10'),_0x113cdc,_0xb70e('0xe'),JSON[_0xb70e('0x11')](_0x2de3a9));if(_0x2de3a9[_0xb70e('0x12')]){if(_0x2de3a9['error'][_0xb70e('0x13')]===0x1f4){logger[_0xb70e('0x12')](_0xb70e('0x14'),_0x113cdc,_0x2de3a9[_0xb70e('0x12')][_0xb70e('0x15')]);return _0x4bd51a(_0x2de3a9[_0xb70e('0x12')][_0xb70e('0x15')]);}logger[_0xb70e('0x12')](_0xb70e('0x14'),_0x113cdc,_0x2de3a9[_0xb70e('0x12')][_0xb70e('0x15')]);return _0x3c5ffc(_0x2de3a9[_0xb70e('0x12')][_0xb70e('0x15')]);}else{logger[_0xb70e('0xd')](_0xb70e('0x14'),_0x113cdc,_0xb70e('0xe'));_0x3c5ffc(_0x2de3a9[_0xb70e('0x16')][_0xb70e('0x15')]);}})['catch'](function(_0x57bd07){logger[_0xb70e('0x12')](_0xb70e('0x14'),_0x113cdc,_0x57bd07);_0x4bd51a(_0x57bd07);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index acda79e..7b81464 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 _0x7f7e=['isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','index','/describe'];(function(_0x43f0d2,_0x231789){var _0x53cc0b=function(_0x490802){while(--_0x490802){_0x43f0d2['push'](_0x43f0d2['shift']());}};_0x53cc0b(++_0x231789);}(_0x7f7e,0x8e));var _0xe7f7=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x7f7e[_0x46698a];return _0x356db0;};'use strict';var multer=require(_0xe7f7('0x0'));var util=require(_0xe7f7('0x1'));var path=require(_0xe7f7('0x2'));var timeout=require(_0xe7f7('0x3'));var express=require('express');var router=express[_0xe7f7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe7f7('0x5'));var interaction=require(_0xe7f7('0x6'));var config=require(_0xe7f7('0x7'));var controller=require(_0xe7f7('0x8'));router[_0xe7f7('0x9')]('/',auth['isAuthenticated'](),controller[_0xe7f7('0xa')]);router[_0xe7f7('0x9')](_0xe7f7('0xb'),auth[_0xe7f7('0xc')](),controller[_0xe7f7('0xd')]);router[_0xe7f7('0x9')](_0xe7f7('0xe'),auth['isAuthenticated'](),controller[_0xe7f7('0xf')]);router[_0xe7f7('0x10')]('/',auth[_0xe7f7('0xc')](),controller[_0xe7f7('0x11')]);router[_0xe7f7('0x12')](_0xe7f7('0xe'),auth[_0xe7f7('0xc')](),controller['update']);router[_0xe7f7('0x13')](_0xe7f7('0xe'),auth[_0xe7f7('0xc')](),controller[_0xe7f7('0x14')]);module[_0xe7f7('0x15')]=router; \ No newline at end of file +var _0xe0a8=['util','path','express','Router','fs-extra','../../components/auth/service','./userProfileSection.controller','isAuthenticated','index','get','describe','/:id','show','post','put','delete','destroy'];(function(_0x258bbc,_0x481311){var _0x42f135=function(_0x8ec3be){while(--_0x8ec3be){_0x258bbc['push'](_0x258bbc['shift']());}};_0x42f135(++_0x481311);}(_0xe0a8,0x1a9));var _0x8e0a=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe0a8[_0x40a045];return _0x1a687c;};'use strict';var multer=require('multer');var util=require(_0x8e0a('0x0'));var path=require(_0x8e0a('0x1'));var timeout=require('connect-timeout');var express=require(_0x8e0a('0x2'));var router=express[_0x8e0a('0x3')]();var fs_extra=require(_0x8e0a('0x4'));var auth=require(_0x8e0a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8e0a('0x6'));router['get']('/',auth[_0x8e0a('0x7')](),controller[_0x8e0a('0x8')]);router[_0x8e0a('0x9')]('/describe',auth[_0x8e0a('0x7')](),controller[_0x8e0a('0xa')]);router['get'](_0x8e0a('0xb'),auth[_0x8e0a('0x7')](),controller[_0x8e0a('0xc')]);router[_0x8e0a('0xd')]('/',auth[_0x8e0a('0x7')](),controller['create']);router[_0x8e0a('0xe')](_0x8e0a('0xb'),auth[_0x8e0a('0x7')](),controller['update']);router[_0x8e0a('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x8e0a('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 7f29f96..9efb847 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 _0xb7e7=['crudPermissions','getDataValue','sequelize','STRING','INTEGER','BOOLEAN','setDataValue'];(function(_0x154544,_0x1b0f6c){var _0x7b4302=function(_0xa52974){while(--_0xa52974){_0x154544['push'](_0x154544['shift']());}};_0x7b4302(++_0x1b0f6c);}(_0xb7e7,0x121));var _0x7b7e=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0xb7e7[_0xac151d];return _0x111dba;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x7b7e('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x7b7e('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x31d0ed){this[_0x7b7e('0x4')](_0x7b7e('0x5'),_0x31d0ed?_0x31d0ed['join'](''):[]);},'get':function(){return this['getDataValue'](_0x7b7e('0x5'))?this[_0x7b7e('0x6')](_0x7b7e('0x5'))['split'](''):[];}}}; \ No newline at end of file +var _0x58a4=['split','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue'];(function(_0x3cee87,_0x52fafd){var _0x265906=function(_0x295900){while(--_0x295900){_0x3cee87['push'](_0x3cee87['shift']());}};_0x265906(++_0x52fafd);}(_0x58a4,0xbf));var _0x458a=function(_0x1e76e8,_0x41ec55){_0x1e76e8=_0x1e76e8-0x0;var _0x2d7a1f=_0x58a4[_0x1e76e8];return _0x2d7a1f;};'use strict';var Sequelize=require(_0x458a('0x0'));module[_0x458a('0x1')]={'name':{'type':Sequelize[_0x458a('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x458a('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x458a('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x458a('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x458a('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x458a('0x2')],'set':function(_0x362079){this[_0x458a('0x5')](_0x458a('0x6'),_0x362079?_0x362079[_0x458a('0x7')](''):[]);},'get':function(){return this[_0x458a('0x8')]('crudPermissions')?this['getDataValue'](_0x458a('0x6'))[_0x458a('0x9')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 63bfed7..3c6070f 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 _0x899f=['moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','apply','reject','save','update','then','destroy','error','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','name','merge','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','describe','eml-format','zip-dir','request-promise'];(function(_0x24279b,_0x11d28b){var _0x54c150=function(_0x44c305){while(--_0x44c305){_0x24279b['push'](_0x24279b['shift']());}};_0x54c150(++_0x11d28b);}(_0x899f,0xd5));var _0xf899=function(_0x100d58,_0x50e00d){_0x100d58=_0x100d58-0x0;var _0xc4e7c1=_0x899f[_0x100d58];return _0xc4e7c1;};'use strict';var emlformat=require(_0xf899('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf899('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf899('0x2'));var moment=require(_0xf899('0x3'));var BPromise=require(_0xf899('0x4'));var Mustache=require(_0xf899('0x5'));var util=require(_0xf899('0x6'));var path=require(_0xf899('0x7'));var sox=require(_0xf899('0x8'));var csv=require(_0xf899('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf899('0xa'));var _=require(_0xf899('0xb'));var squel=require(_0xf899('0xc'));var crypto=require(_0xf899('0xd'));var jsforce=require(_0xf899('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf899('0xf'));var authService=require(_0xf899('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf899('0x11'));var logger=require(_0xf899('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xf899('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4db27e,_0x39893b){_0x39893b=_0x39893b||0xcc;return function(_0x44a3dc){if(_0x44a3dc){return _0x4db27e[_0xf899('0x14')](_0x39893b);}return _0x4db27e[_0xf899('0x15')](_0x39893b)[_0xf899('0x16')]();};}function respondWithResult(_0x33c48e,_0x2ca9cc){_0x2ca9cc=_0x2ca9cc||0xc8;return function(_0x33f186){if(_0x33f186){return _0x33c48e[_0xf899('0x15')](_0x2ca9cc)[_0xf899('0x17')](_0x33f186);}};}function respondWithFilteredResult(_0x335ca5,_0x316bc0){return function(_0x559e1f){if(_0x559e1f){var _0x52a3bb=typeof _0x316bc0[_0xf899('0x18')]==='undefined'&&typeof _0x316bc0[_0xf899('0x19')]===_0xf899('0x1a');var _0x56505e=_0x559e1f[_0xf899('0x1b')];var _0x507671=_0x52a3bb?0x0:_0x316bc0['offset'];var _0xc4351f=_0x52a3bb?_0x559e1f[_0xf899('0x1b')]:_0x316bc0[_0xf899('0x18')]+_0x316bc0[_0xf899('0x19')];var _0x563b66;if(_0xc4351f>=_0x56505e){_0xc4351f=_0x56505e;_0x563b66=0xc8;}else{_0x563b66=0xce;}_0x335ca5['status'](_0x563b66);return _0x335ca5['set']('Content-Range',_0x507671+'-'+_0xc4351f+'/'+_0x56505e)['json'](_0x559e1f);}return null;};}function patchUpdates(_0x188a50){return function(_0x8ffab1){try{jsonpatch[_0xf899('0x1c')](_0x8ffab1,_0x188a50,!![]);}catch(_0x1f37aa){return BPromise[_0xf899('0x1d')](_0x1f37aa);}return _0x8ffab1[_0xf899('0x1e')]();};}function saveUpdates(_0xf6a9fb,_0x5e4460){return function(_0x9bddf9){if(_0x9bddf9){return _0x9bddf9[_0xf899('0x1f')](_0xf6a9fb)[_0xf899('0x20')](function(_0x515404){return _0x515404;});}return null;};}function removeEntity(_0x4dc0e8,_0x15410c){return function(_0x271fba){if(_0x271fba){return _0x271fba[_0xf899('0x21')]()[_0xf899('0x20')](function(){_0x4dc0e8[_0xf899('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b4996,_0x596db6){return function(_0x2368ec){if(!_0x2368ec){_0x2b4996[_0xf899('0x14')](0x194);}return _0x2368ec;};}function handleError(_0x27a579,_0x66f8a8){_0x66f8a8=_0x66f8a8||0x1f4;return function(_0x135436){logger[_0xf899('0x22')](_0x135436['stack']);if(_0x135436['name']){delete _0x135436['name'];}_0x27a579[_0xf899('0x15')](_0x66f8a8)[_0xf899('0x23')](_0x135436);};}exports[_0xf899('0x24')]=function(_0xfacb01,_0xd8c532){var _0x13eed0={},_0x1df120={},_0xea8065={'count':0x0,'rows':[]};var _0xcf8709=_[_0xf899('0x25')](db[_0xf899('0x26')][_0xf899('0x27')],function(_0x581865){return{'name':_0x581865[_0xf899('0x28')],'type':_0x581865[_0xf899('0x29')][_0xf899('0x2a')]};});_0x1df120[_0xf899('0x2b')]=_[_0xf899('0x25')](_0xcf8709,'name');_0x1df120['query']=_[_0xf899('0x2c')](_0xfacb01[_0xf899('0x2d')]);_0x1df120[_0xf899('0x2e')]=_[_0xf899('0x2f')](_0x1df120[_0xf899('0x2b')],_0x1df120[_0xf899('0x2d')]);_0x13eed0[_0xf899('0x30')]=_[_0xf899('0x2f')](_0x1df120[_0xf899('0x2b')],qs['fields'](_0xfacb01[_0xf899('0x2d')][_0xf899('0x31')]));_0x13eed0[_0xf899('0x30')]=_0x13eed0[_0xf899('0x30')][_0xf899('0x32')]?_0x13eed0[_0xf899('0x30')]:_0x1df120['model'];if(!_0xfacb01[_0xf899('0x2d')][_0xf899('0x33')](_0xf899('0x34'))){_0x13eed0['limit']=qs['limit'](_0xfacb01[_0xf899('0x2d')]['limit']);_0x13eed0[_0xf899('0x18')]=qs[_0xf899('0x18')](_0xfacb01[_0xf899('0x2d')][_0xf899('0x18')]);}_0x13eed0['order']=qs[_0xf899('0x35')](_0xfacb01['query'][_0xf899('0x35')]);_0x13eed0[_0xf899('0x36')]=qs[_0xf899('0x2e')](_[_0xf899('0x37')](_0xfacb01[_0xf899('0x2d')],_0x1df120['filters']),_0xcf8709);if(_0xfacb01[_0xf899('0x2d')][_0xf899('0x38')]){_0x13eed0[_0xf899('0x36')]=_['merge'](_0x13eed0['where'],{'$or':_[_0xf899('0x25')](_0xcf8709,function(_0x5520d8){if(_0x5520d8[_0xf899('0x29')]!==_0xf899('0x39')){var _0x14f09e={};_0x14f09e[_0x5520d8[_0xf899('0x3a')]]={'$like':'%'+_0xfacb01[_0xf899('0x2d')][_0xf899('0x38')]+'%'};return _0x14f09e;}})});}_0x13eed0=_[_0xf899('0x3b')]({},_0x13eed0,_0xfacb01['options']);var _0x478626={'where':_0x13eed0[_0xf899('0x36')]};return db[_0xf899('0x26')]['count'](_0x478626)[_0xf899('0x20')](function(_0xb838a5){_0xea8065[_0xf899('0x1b')]=_0xb838a5;if(_0xfacb01['query'][_0xf899('0x3c')]){_0x13eed0['include']=[{'all':!![]}];}return db[_0xf899('0x26')][_0xf899('0x3d')](_0x13eed0);})[_0xf899('0x20')](function(_0x140a4e){_0xea8065[_0xf899('0x3e')]=_0x140a4e;return _0xea8065;})[_0xf899('0x20')](respondWithFilteredResult(_0xd8c532,_0x13eed0))[_0xf899('0x3f')](handleError(_0xd8c532,null));};exports[_0xf899('0x40')]=function(_0x39d7de,_0x4e3766){var _0x562f81={'raw':![],'where':{'id':_0x39d7de[_0xf899('0x41')]['id']}},_0x4bfc68={};_0x4bfc68[_0xf899('0x2b')]=_[_0xf899('0x2c')](db[_0xf899('0x26')][_0xf899('0x27')]);_0x4bfc68[_0xf899('0x2d')]=_[_0xf899('0x2c')](_0x39d7de['query']);_0x4bfc68[_0xf899('0x2e')]=_[_0xf899('0x2f')](_0x4bfc68[_0xf899('0x2b')],_0x4bfc68['query']);_0x562f81['attributes']=_[_0xf899('0x2f')](_0x4bfc68[_0xf899('0x2b')],qs[_0xf899('0x31')](_0x39d7de['query'][_0xf899('0x31')]));_0x562f81[_0xf899('0x30')]=_0x562f81[_0xf899('0x30')]['length']?_0x562f81[_0xf899('0x30')]:_0x4bfc68[_0xf899('0x2b')];if(_0x39d7de[_0xf899('0x2d')][_0xf899('0x3c')]){_0x562f81[_0xf899('0x42')]=[{'all':!![]}];}_0x562f81=_[_0xf899('0x3b')]({},_0x562f81,_0x39d7de[_0xf899('0x43')]);return db[_0xf899('0x26')][_0xf899('0x44')](_0x562f81)[_0xf899('0x20')](handleEntityNotFound(_0x4e3766,null))[_0xf899('0x20')](respondWithResult(_0x4e3766,null))['catch'](handleError(_0x4e3766,null));};exports['create']=function(_0x19095a,_0x9f0737){return db[_0xf899('0x26')][_0xf899('0x45')](_0x19095a['body'],{})[_0xf899('0x20')](respondWithResult(_0x9f0737,0xc9))['catch'](handleError(_0x9f0737,null));};exports[_0xf899('0x1f')]=function(_0x3c3e1b,_0x117435){if(_0x3c3e1b[_0xf899('0x46')]['id']){delete _0x3c3e1b[_0xf899('0x46')]['id'];}return db[_0xf899('0x26')][_0xf899('0x44')]({'where':{'id':_0x3c3e1b[_0xf899('0x41')]['id']}})[_0xf899('0x20')](handleEntityNotFound(_0x117435,null))[_0xf899('0x20')](saveUpdates(_0x3c3e1b[_0xf899('0x46')],null))['then'](respondWithResult(_0x117435,null))[_0xf899('0x3f')](handleError(_0x117435,null));};exports[_0xf899('0x21')]=function(_0x515934,_0xc7e3fc){return db['UserProfileSection']['find']({'where':{'id':_0x515934['params']['id']}})['then'](handleEntityNotFound(_0xc7e3fc,null))['then'](removeEntity(_0xc7e3fc,null))[_0xf899('0x3f')](handleError(_0xc7e3fc,null));};exports[_0xf899('0x47')]=function(_0x35dbf6,_0x32be3e){return db[_0xf899('0x26')][_0xf899('0x47')]()[_0xf899('0x20')](respondWithResult(_0x32be3e,null))['catch'](handleError(_0x32be3e,null));}; \ No newline at end of file +var _0xefba=['apply','reject','update','then','error','stack','name','send','index','map','fieldName','key','keys','filters','intersection','query','model','fields','attributes','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','UserProfileSection','includeAll','include','findAll','rows','show','rawAttributes','length','find','catch','create','body','params','destroy','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range'];(function(_0x52c57b,_0x1fed8e){var _0x436686=function(_0x4c1c4b){while(--_0x4c1c4b){_0x52c57b['push'](_0x52c57b['shift']());}};_0x436686(++_0x1fed8e);}(_0xefba,0x154));var _0xaefb=function(_0x38a162,_0x4396b2){_0x38a162=_0x38a162-0x0;var _0x1f622b=_0xefba[_0x38a162];return _0x1f622b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaefb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaefb('0x1'));var rp=require(_0xaefb('0x2'));var moment=require(_0xaefb('0x3'));var BPromise=require(_0xaefb('0x4'));var Mustache=require(_0xaefb('0x5'));var util=require(_0xaefb('0x6'));var path=require(_0xaefb('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaefb('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xaefb('0x9'));var deskjs=require(_0xaefb('0xa'));var toCsv=require(_0xaefb('0xb'));var querystring=require(_0xaefb('0xc'));var Papa=require(_0xaefb('0xd'));var Redis=require(_0xaefb('0xe'));var authService=require(_0xaefb('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xaefb('0x10'));var hardwareService=require(_0xaefb('0x11'));var logger=require(_0xaefb('0x12'))(_0xaefb('0x13'));var utils=require('../../config/utils');var config=require(_0xaefb('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xaefb('0x15'))['db'];function respondWithStatusCode(_0x331a65,_0x409427){_0x409427=_0x409427||0xcc;return function(_0xed58ee){if(_0xed58ee){return _0x331a65[_0xaefb('0x16')](_0x409427);}return _0x331a65[_0xaefb('0x17')](_0x409427)['end']();};}function respondWithResult(_0x4f735c,_0x4d776c){_0x4d776c=_0x4d776c||0xc8;return function(_0x1c0daf){if(_0x1c0daf){return _0x4f735c['status'](_0x4d776c)[_0xaefb('0x18')](_0x1c0daf);}};}function respondWithFilteredResult(_0x47d592,_0x16d211){return function(_0x12e2eb){if(_0x12e2eb){var _0x3bbdbc=typeof _0x16d211[_0xaefb('0x19')]==='undefined'&&typeof _0x16d211[_0xaefb('0x1a')]===_0xaefb('0x1b');var _0x227450=_0x12e2eb['count'];var _0x1b2cb2=_0x3bbdbc?0x0:_0x16d211['offset'];var _0x219ace=_0x3bbdbc?_0x12e2eb[_0xaefb('0x1c')]:_0x16d211[_0xaefb('0x19')]+_0x16d211[_0xaefb('0x1a')];var _0x44c217;if(_0x219ace>=_0x227450){_0x219ace=_0x227450;_0x44c217=0xc8;}else{_0x44c217=0xce;}_0x47d592[_0xaefb('0x17')](_0x44c217);return _0x47d592['set'](_0xaefb('0x1d'),_0x1b2cb2+'-'+_0x219ace+'/'+_0x227450)[_0xaefb('0x18')](_0x12e2eb);}return null;};}function patchUpdates(_0x1169da){return function(_0x50b0fd){try{jsonpatch[_0xaefb('0x1e')](_0x50b0fd,_0x1169da,!![]);}catch(_0x32af2e){return BPromise[_0xaefb('0x1f')](_0x32af2e);}return _0x50b0fd['save']();};}function saveUpdates(_0x73a45a,_0x377e2b){return function(_0x5c7035){if(_0x5c7035){return _0x5c7035[_0xaefb('0x20')](_0x73a45a)['then'](function(_0x2a8160){return _0x2a8160;});}return null;};}function removeEntity(_0x59f3f1,_0x459dc6){return function(_0x10195a){if(_0x10195a){return _0x10195a['destroy']()[_0xaefb('0x21')](function(){_0x59f3f1[_0xaefb('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdad3f3,_0x3a1758){return function(_0x275d69){if(!_0x275d69){_0xdad3f3['sendStatus'](0x194);}return _0x275d69;};}function handleError(_0x53fe97,_0x375956){_0x375956=_0x375956||0x1f4;return function(_0x18649a){logger[_0xaefb('0x22')](_0x18649a[_0xaefb('0x23')]);if(_0x18649a[_0xaefb('0x24')]){delete _0x18649a[_0xaefb('0x24')];}_0x53fe97[_0xaefb('0x17')](_0x375956)[_0xaefb('0x25')](_0x18649a);};}exports[_0xaefb('0x26')]=function(_0x48b3af,_0x5b7bc1){var _0x401b79={},_0x273e8e={},_0x1084cd={'count':0x0,'rows':[]};var _0x24fcb8=_[_0xaefb('0x27')](db['UserProfileSection']['rawAttributes'],function(_0x23d6bc){return{'name':_0x23d6bc[_0xaefb('0x28')],'type':_0x23d6bc['type'][_0xaefb('0x29')]};});_0x273e8e['model']=_['map'](_0x24fcb8,_0xaefb('0x24'));_0x273e8e['query']=_[_0xaefb('0x2a')](_0x48b3af['query']);_0x273e8e[_0xaefb('0x2b')]=_[_0xaefb('0x2c')](_0x273e8e['model'],_0x273e8e[_0xaefb('0x2d')]);_0x401b79['attributes']=_[_0xaefb('0x2c')](_0x273e8e[_0xaefb('0x2e')],qs['fields'](_0x48b3af['query'][_0xaefb('0x2f')]));_0x401b79['attributes']=_0x401b79[_0xaefb('0x30')]['length']?_0x401b79[_0xaefb('0x30')]:_0x273e8e[_0xaefb('0x2e')];if(!_0x48b3af[_0xaefb('0x2d')]['hasOwnProperty'](_0xaefb('0x31'))){_0x401b79['limit']=qs['limit'](_0x48b3af[_0xaefb('0x2d')][_0xaefb('0x1a')]);_0x401b79['offset']=qs[_0xaefb('0x19')](_0x48b3af['query']['offset']);}_0x401b79[_0xaefb('0x32')]=qs[_0xaefb('0x33')](_0x48b3af[_0xaefb('0x2d')][_0xaefb('0x33')]);_0x401b79[_0xaefb('0x34')]=qs[_0xaefb('0x2b')](_[_0xaefb('0x35')](_0x48b3af[_0xaefb('0x2d')],_0x273e8e['filters']),_0x24fcb8);if(_0x48b3af[_0xaefb('0x2d')][_0xaefb('0x36')]){_0x401b79[_0xaefb('0x34')]=_[_0xaefb('0x37')](_0x401b79[_0xaefb('0x34')],{'$or':_[_0xaefb('0x27')](_0x24fcb8,function(_0x2bb8c0){if(_0x2bb8c0[_0xaefb('0x38')]!==_0xaefb('0x39')){var _0x3bf000={};_0x3bf000[_0x2bb8c0[_0xaefb('0x24')]]={'$like':'%'+_0x48b3af[_0xaefb('0x2d')][_0xaefb('0x36')]+'%'};return _0x3bf000;}})});}_0x401b79=_[_0xaefb('0x37')]({},_0x401b79,_0x48b3af[_0xaefb('0x3a')]);var _0x2588cb={'where':_0x401b79[_0xaefb('0x34')]};return db[_0xaefb('0x3b')][_0xaefb('0x1c')](_0x2588cb)[_0xaefb('0x21')](function(_0x192e96){_0x1084cd[_0xaefb('0x1c')]=_0x192e96;if(_0x48b3af[_0xaefb('0x2d')][_0xaefb('0x3c')]){_0x401b79[_0xaefb('0x3d')]=[{'all':!![]}];}return db['UserProfileSection'][_0xaefb('0x3e')](_0x401b79);})['then'](function(_0x296344){_0x1084cd[_0xaefb('0x3f')]=_0x296344;return _0x1084cd;})['then'](respondWithFilteredResult(_0x5b7bc1,_0x401b79))['catch'](handleError(_0x5b7bc1,null));};exports[_0xaefb('0x40')]=function(_0x5ec1e9,_0x54b907){var _0x2d9135={'raw':![],'where':{'id':_0x5ec1e9['params']['id']}},_0x31b92f={};_0x31b92f[_0xaefb('0x2e')]=_['keys'](db[_0xaefb('0x3b')][_0xaefb('0x41')]);_0x31b92f[_0xaefb('0x2d')]=_['keys'](_0x5ec1e9[_0xaefb('0x2d')]);_0x31b92f[_0xaefb('0x2b')]=_[_0xaefb('0x2c')](_0x31b92f['model'],_0x31b92f['query']);_0x2d9135[_0xaefb('0x30')]=_[_0xaefb('0x2c')](_0x31b92f[_0xaefb('0x2e')],qs[_0xaefb('0x2f')](_0x5ec1e9['query'][_0xaefb('0x2f')]));_0x2d9135[_0xaefb('0x30')]=_0x2d9135[_0xaefb('0x30')][_0xaefb('0x42')]?_0x2d9135[_0xaefb('0x30')]:_0x31b92f[_0xaefb('0x2e')];if(_0x5ec1e9[_0xaefb('0x2d')][_0xaefb('0x3c')]){_0x2d9135[_0xaefb('0x3d')]=[{'all':!![]}];}_0x2d9135=_[_0xaefb('0x37')]({},_0x2d9135,_0x5ec1e9[_0xaefb('0x3a')]);return db['UserProfileSection'][_0xaefb('0x43')](_0x2d9135)[_0xaefb('0x21')](handleEntityNotFound(_0x54b907,null))['then'](respondWithResult(_0x54b907,null))[_0xaefb('0x44')](handleError(_0x54b907,null));};exports[_0xaefb('0x45')]=function(_0x25a129,_0x20ec47){return db[_0xaefb('0x3b')][_0xaefb('0x45')](_0x25a129[_0xaefb('0x46')],{})[_0xaefb('0x21')](respondWithResult(_0x20ec47,0xc9))[_0xaefb('0x44')](handleError(_0x20ec47,null));};exports[_0xaefb('0x20')]=function(_0x35a863,_0x588712){if(_0x35a863[_0xaefb('0x46')]['id']){delete _0x35a863[_0xaefb('0x46')]['id'];}return db['UserProfileSection'][_0xaefb('0x43')]({'where':{'id':_0x35a863[_0xaefb('0x47')]['id']}})[_0xaefb('0x21')](handleEntityNotFound(_0x588712,null))[_0xaefb('0x21')](saveUpdates(_0x35a863['body'],null))[_0xaefb('0x21')](respondWithResult(_0x588712,null))[_0xaefb('0x44')](handleError(_0x588712,null));};exports[_0xaefb('0x48')]=function(_0x2f7603,_0x4f7601){return db[_0xaefb('0x3b')][_0xaefb('0x43')]({'where':{'id':_0x2f7603[_0xaefb('0x47')]['id']}})[_0xaefb('0x21')](handleEntityNotFound(_0x4f7601,null))[_0xaefb('0x21')](removeEntity(_0x4f7601,null))['catch'](handleError(_0x4f7601,null));};exports[_0xaefb('0x49')]=function(_0x3efe90,_0x122f45){return db[_0xaefb('0x3b')][_0xaefb('0x49')]()[_0xaefb('0x21')](respondWithResult(_0x122f45,null))[_0xaefb('0x44')](handleError(_0x122f45,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 14b384a..c96473e 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 _0xf1a9=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','user_profile_has_sections','compositeIndex','sectionId','util','../../config/logger'];(function(_0x26618e,_0xbe9238){var _0x5dec4c=function(_0x15016d){while(--_0x15016d){_0x26618e['push'](_0x26618e['shift']());}};_0x5dec4c(++_0xbe9238);}(_0xf1a9,0xdb));var _0x9f1a=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xf1a9[_0x491a7f];return _0x3d8f44;};'use strict';var _=require('lodash');var util=require(_0x9f1a('0x0'));var logger=require(_0x9f1a('0x1'))('api');var moment=require(_0x9f1a('0x2'));var BPromise=require(_0x9f1a('0x3'));var rp=require(_0x9f1a('0x4'));var fs=require('fs');var path=require(_0x9f1a('0x5'));var rimraf=require(_0x9f1a('0x6'));var config=require(_0x9f1a('0x7'));var attributes=require(_0x9f1a('0x8'));module[_0x9f1a('0x9')]=function(_0x42d2d6,_0x532956){return _0x42d2d6['define']('UserProfileSection',attributes,{'tableName':_0x9f1a('0xa'),'paranoid':![],'indexes':[{'name':_0x9f1a('0xb'),'fields':[_0x9f1a('0xc'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x157a=['define','UserProfileSection','sectionId','userProfileId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports'];(function(_0x28f8f8,_0x43043a){var _0x31604e=function(_0x41eb5f){while(--_0x41eb5f){_0x28f8f8['push'](_0x28f8f8['shift']());}};_0x31604e(++_0x43043a);}(_0x157a,0x7c));var _0xa157=function(_0x1aecdc,_0x522a27){_0x1aecdc=_0x1aecdc-0x0;var _0xef638b=_0x157a[_0x1aecdc];return _0xef638b;};'use strict';var _=require(_0xa157('0x0'));var util=require(_0xa157('0x1'));var logger=require(_0xa157('0x2'))(_0xa157('0x3'));var moment=require(_0xa157('0x4'));var BPromise=require('bluebird');var rp=require(_0xa157('0x5'));var fs=require('fs');var path=require(_0xa157('0x6'));var rimraf=require(_0xa157('0x7'));var config=require(_0xa157('0x8'));var attributes=require(_0xa157('0x9'));module[_0xa157('0xa')]=function(_0x3c4c6f,_0x446a8f){return _0x3c4c6f[_0xa157('0xb')](_0xa157('0xc'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xa157('0xd'),_0xa157('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 7f68ec9..aeb9ace 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 _0xa9c0=['UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','ioredis','../../config/utils','../../config/logger','client','http','request','UserProfileSection,\x20%s,\x20%s','debug'];(function(_0x246890,_0x46b964){var _0x2b2a5a=function(_0x4f1232){while(--_0x4f1232){_0x246890['push'](_0x246890['shift']());}};_0x2b2a5a(++_0x46b964);}(_0xa9c0,0x19f));var _0x0a9c=function(_0x376d95,_0x9fe843){_0x376d95=_0x376d95-0x0;var _0x159820=_0xa9c0[_0x376d95];return _0x159820;};'use strict';var _=require('lodash');var util=require(_0x0a9c('0x0'));var moment=require(_0x0a9c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9c('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9c('0x3'));var logger=require(_0x0a9c('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0a9c('0x5')][_0x0a9c('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x45ec54,_0x568b35,_0x51f1ff){return new BPromise(function(_0x2e9551,_0x430134){return client[_0x0a9c('0x7')](_0x45ec54,_0x51f1ff)['then'](function(_0x296b9b){logger['info'](_0x0a9c('0x8'),_0x568b35,'request\x20sent');logger[_0x0a9c('0x9')](_0x0a9c('0xa'),_0x568b35,'request\x20sent',JSON['stringify'](_0x296b9b));if(_0x296b9b[_0x0a9c('0xb')]){if(_0x296b9b['error'][_0x0a9c('0xc')]===0x1f4){logger[_0x0a9c('0xb')](_0x0a9c('0x8'),_0x568b35,_0x296b9b['error'][_0x0a9c('0xd')]);return _0x430134(_0x296b9b[_0x0a9c('0xb')][_0x0a9c('0xd')]);}logger[_0x0a9c('0xb')](_0x0a9c('0x8'),_0x568b35,_0x296b9b[_0x0a9c('0xb')][_0x0a9c('0xd')]);return _0x2e9551(_0x296b9b[_0x0a9c('0xb')][_0x0a9c('0xd')]);}else{logger[_0x0a9c('0xe')](_0x0a9c('0x8'),_0x568b35,'request\x20sent');_0x2e9551(_0x296b9b[_0x0a9c('0xf')][_0x0a9c('0xd')]);}})[_0x0a9c('0x10')](function(_0x8066d4){logger[_0x0a9c('0xb')](_0x0a9c('0x8'),_0x568b35,_0x8066d4);_0x430134(_0x8066d4);});});} \ No newline at end of file +var _0xc8ba=['../../config/logger','../../config/environment','jayson/promise','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x509880,_0x462c05){var _0x243e82=function(_0x4d88a8){while(--_0x4d88a8){_0x509880['push'](_0x509880['shift']());}};_0x243e82(++_0x462c05);}(_0xc8ba,0x186));var _0xac8b=function(_0xbe40ad,_0x44343c){_0xbe40ad=_0xbe40ad-0x0;var _0x50fac9=_0xc8ba[_0xbe40ad];return _0x50fac9;};'use strict';var _=require(_0xac8b('0x0'));var util=require(_0xac8b('0x1'));var moment=require(_0xac8b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xac8b('0x3'));var db=require(_0xac8b('0x4'))['db'];var utils=require(_0xac8b('0x5'));var logger=require(_0xac8b('0x6'))('rpc');var config=require(_0xac8b('0x7'));var jayson=require(_0xac8b('0x8'));var client=jayson['client'][_0xac8b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5375a2,_0x689678,_0x26d3d7){return new BPromise(function(_0xe63b93,_0x58c7fe){return client[_0xac8b('0xa')](_0x5375a2,_0x26d3d7)[_0xac8b('0xb')](function(_0x17c430){logger[_0xac8b('0xc')](_0xac8b('0xd'),_0x689678,_0xac8b('0xe'));logger[_0xac8b('0xf')](_0xac8b('0x10'),_0x689678,_0xac8b('0xe'),JSON[_0xac8b('0x11')](_0x17c430));if(_0x17c430[_0xac8b('0x12')]){if(_0x17c430[_0xac8b('0x12')]['code']===0x1f4){logger[_0xac8b('0x12')](_0xac8b('0xd'),_0x689678,_0x17c430[_0xac8b('0x12')][_0xac8b('0x13')]);return _0x58c7fe(_0x17c430[_0xac8b('0x12')]['message']);}logger[_0xac8b('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x689678,_0x17c430['error'][_0xac8b('0x13')]);return _0xe63b93(_0x17c430[_0xac8b('0x12')]['message']);}else{logger[_0xac8b('0xc')](_0xac8b('0xd'),_0x689678,_0xac8b('0xe'));_0xe63b93(_0x17c430[_0xac8b('0x14')][_0xac8b('0x13')]);}})[_0xac8b('0x15')](function(_0x58b260){logger['error'](_0xac8b('0xd'),_0x689678,_0x58b260);_0x58c7fe(_0x58b260);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 1117695..82ab4af 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x582ff9,_0x387072){var _0x393292=function(_0x434f86){while(--_0x434f86){_0x582ff9['push'](_0x582ff9['shift']());}};_0x393292(++_0x387072);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x376db5,_0x2b8874){_0x376db5=_0x376db5-0x0;var _0x304c17=_0xcb91[_0x376db5];return _0x304c17;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1b4ca6,_0x37f5d0){var _0x189463=function(_0x24567b){while(--_0x24567b){_0x1b4ca6['push'](_0x1b4ca6['shift']());}};_0x189463(++_0x37f5d0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index f15ecee..9a803a3 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 _0x79fd=['exports'];(function(_0x5d30b4,_0x199248){var _0x1acfb8=function(_0x3544b2){while(--_0x3544b2){_0x5d30b4['push'](_0x5d30b4['shift']());}};_0x1acfb8(++_0x199248);}(_0x79fd,0x1bd));var _0xd79f=function(_0x583760,_0x562849){_0x583760=_0x583760-0x0;var _0x5bc274=_0x79fd[_0x583760];return _0x5bc274;};'use strict';var Sequelize=require('sequelize');module[_0xd79f('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x26d4=['INTEGER','sequelize'];(function(_0x31ead7,_0x2e9a7c){var _0x3516f0=function(_0x47fa36){while(--_0x47fa36){_0x31ead7['push'](_0x31ead7['shift']());}};_0x3516f0(++_0x2e9a7c);}(_0x26d4,0xab));var _0x426d=function(_0x28dc90,_0x117d06){_0x28dc90=_0x28dc90-0x0;var _0x4b6ee2=_0x26d4[_0x28dc90];return _0x4b6ee2;};'use strict';var Sequelize=require(_0x426d('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x426d('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 34cc9cd..a9711bd 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 _0x4317=['./userSmsQueue.attributes','define','UserSmsQueue','user_has_sms_queues','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x76ef31,_0x2825ce){var _0x1c80b3=function(_0x3e15bf){while(--_0x3e15bf){_0x76ef31['push'](_0x76ef31['shift']());}};_0x1c80b3(++_0x2825ce);}(_0x4317,0x7c));var _0x7431=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4317[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x7431('0x0'));var logger=require(_0x7431('0x1'))(_0x7431('0x2'));var moment=require('moment');var BPromise=require(_0x7431('0x3'));var rp=require(_0x7431('0x4'));var fs=require('fs');var path=require(_0x7431('0x5'));var rimraf=require(_0x7431('0x6'));var config=require(_0x7431('0x7'));var attributes=require(_0x7431('0x8'));module['exports']=function(_0x57adc1,_0x1e1f35){return _0x57adc1[_0x7431('0x9')](_0x7431('0xa'),attributes,{'tableName':_0x7431('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d38=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes','define','UserSmsQueue'];(function(_0x2601e0,_0x4c8cc8){var _0x111809=function(_0x127c78){while(--_0x127c78){_0x2601e0['push'](_0x2601e0['shift']());}};_0x111809(++_0x4c8cc8);}(_0x6d38,0x1ef));var _0x86d3=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x6d38[_0x31e29a];return _0x32d892;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var logger=require(_0x86d3('0x1'))(_0x86d3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x86d3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var attributes=require(_0x86d3('0x6'));module['exports']=function(_0x2d8272,_0xfbbc15){return _0x2d8272[_0x86d3('0x7')](_0x86d3('0x8'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 4250222..fecab62 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 _0x6bc0=['randomstring','../../config/logger','../../config/environment','http','then','info','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','code','UserSmsQueue,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x6bc0,0x152));var _0x06bc=function(_0x2fdb3e,_0x29af7f){_0x2fdb3e=_0x2fdb3e-0x0;var _0x2dd4ed=_0x6bc0[_0x2fdb3e];return _0x2dd4ed;};'use strict';var _=require(_0x06bc('0x0'));var util=require(_0x06bc('0x1'));var moment=require(_0x06bc('0x2'));var BPromise=require(_0x06bc('0x3'));var rs=require(_0x06bc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x06bc('0x5'))('rpc');var config=require(_0x06bc('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x06bc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4f83af,_0x11a50f,_0x1ead88){return new BPromise(function(_0x5059fb,_0x419503){return client['request'](_0x4f83af,_0x1ead88)[_0x06bc('0x8')](function(_0x2d532e){logger[_0x06bc('0x9')]('UserSmsQueue,\x20%s,\x20%s',_0x11a50f,_0x06bc('0xa'));logger[_0x06bc('0xb')](_0x06bc('0xc'),_0x11a50f,_0x06bc('0xa'),JSON['stringify'](_0x2d532e));if(_0x2d532e['error']){if(_0x2d532e['error'][_0x06bc('0xd')]===0x1f4){logger['error'](_0x06bc('0xe'),_0x11a50f,_0x2d532e[_0x06bc('0xf')][_0x06bc('0x10')]);return _0x419503(_0x2d532e['error'][_0x06bc('0x10')]);}logger[_0x06bc('0xf')](_0x06bc('0xe'),_0x11a50f,_0x2d532e[_0x06bc('0xf')][_0x06bc('0x10')]);return _0x5059fb(_0x2d532e['error'][_0x06bc('0x10')]);}else{logger[_0x06bc('0x9')]('UserSmsQueue,\x20%s,\x20%s',_0x11a50f,_0x06bc('0xa'));_0x5059fb(_0x2d532e['result'][_0x06bc('0x10')]);}})[_0x06bc('0x11')](function(_0x5491d6){logger[_0x06bc('0xf')](_0x06bc('0xe'),_0x11a50f,_0x5491d6);_0x419503(_0x5491d6);});});} \ No newline at end of file +var _0xbbfc=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','UserSmsQueue,\x20%s,\x20%s'];(function(_0x483657,_0x4c9172){var _0xe9877c=function(_0x1b02af){while(--_0x1b02af){_0x483657['push'](_0x483657['shift']());}};_0xe9877c(++_0x4c9172);}(_0xbbfc,0x18a));var _0xcbbf=function(_0x3a8db5,_0x31cff7){_0x3a8db5=_0x3a8db5-0x0;var _0x2c03cd=_0xbbfc[_0x3a8db5];return _0x2c03cd;};'use strict';var _=require(_0xcbbf('0x0'));var util=require(_0xcbbf('0x1'));var moment=require(_0xcbbf('0x2'));var BPromise=require(_0xcbbf('0x3'));var rs=require(_0xcbbf('0x4'));var fs=require('fs');var Redis=require(_0xcbbf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xcbbf('0x6'));var logger=require(_0xcbbf('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcbbf('0x8'));var client=jayson[_0xcbbf('0x9')][_0xcbbf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a6919,_0x552d37,_0x50ed8f){return new BPromise(function(_0x5f3182,_0x3f14ab){return client[_0xcbbf('0xb')](_0x3a6919,_0x50ed8f)[_0xcbbf('0xc')](function(_0x298763){logger[_0xcbbf('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x552d37,'request\x20sent');logger[_0xcbbf('0xe')](_0xcbbf('0xf'),_0x552d37,_0xcbbf('0x10'),JSON['stringify'](_0x298763));if(_0x298763['error']){if(_0x298763['error'][_0xcbbf('0x11')]===0x1f4){logger[_0xcbbf('0x12')](_0xcbbf('0x13'),_0x552d37,_0x298763[_0xcbbf('0x12')][_0xcbbf('0x14')]);return _0x3f14ab(_0x298763[_0xcbbf('0x12')][_0xcbbf('0x14')]);}logger[_0xcbbf('0x12')](_0xcbbf('0x13'),_0x552d37,_0x298763[_0xcbbf('0x12')][_0xcbbf('0x14')]);return _0x5f3182(_0x298763[_0xcbbf('0x12')][_0xcbbf('0x14')]);}else{logger[_0xcbbf('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x552d37,_0xcbbf('0x10'));_0x5f3182(_0x298763[_0xcbbf('0x15')][_0xcbbf('0x14')]);}})[_0xcbbf('0x16')](function(_0x24e628){logger[_0xcbbf('0x12')](_0xcbbf('0x13'),_0x552d37,_0x24e628);_0x3f14ab(_0x24e628);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 4f75778..3851738 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 _0x65f2=['sequelize','exports','INTEGER'];(function(_0x3f8743,_0x33973f){var _0x1f844c=function(_0x568841){while(--_0x568841){_0x3f8743['push'](_0x3f8743['shift']());}};_0x1f844c(++_0x33973f);}(_0x65f2,0x144));var _0x265f=function(_0x53bbcb,_0x33f004){_0x53bbcb=_0x53bbcb-0x0;var _0x4abaf8=_0x65f2[_0x53bbcb];return _0x4abaf8;};'use strict';var Sequelize=require(_0x265f('0x0'));module[_0x265f('0x1')]={'UserId':{'type':Sequelize[_0x265f('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x265f('0x2')]}}; \ No newline at end of file +var _0xe507=['exports','INTEGER'];(function(_0x3ffd8b,_0x1f89b9){var _0x29d491=function(_0x2dac02){while(--_0x2dac02){_0x3ffd8b['push'](_0x3ffd8b['shift']());}};_0x29d491(++_0x1f89b9);}(_0xe507,0xb4));var _0x7e50=function(_0x1f7120,_0x53456a){_0x1f7120=_0x1f7120-0x0;var _0x512142=_0xe507[_0x1f7120];return _0x512142;};'use strict';var Sequelize=require('sequelize');module[_0x7e50('0x0')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x7e50('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index fa26006..3bb890c 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(_0x26246c,_0xe9658e){var _0x394b08=function(_0x47620c){while(--_0x47620c){_0x26246c['push'](_0x26246c['shift']());}};_0x394b08(++_0xe9658e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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(_0x25ef07,_0x5dd09c){var _0x4f0cca=function(_0xe73faf){while(--_0xe73faf){_0x25ef07['push'](_0x25ef07['shift']());}};_0x4f0cca(++_0x5dd09c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index e76029b..b4d126b 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5a5cfb,_0x37ed01){var _0x334936=function(_0x344895){while(--_0x344895){_0x5a5cfb['push'](_0x5a5cfb['shift']());}};_0x334936(++_0x37ed01);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x220b0b,_0x492350){var _0x44980c=function(_0x5b44d2){while(--_0x5b44d2){_0x220b0b['push'](_0x220b0b['shift']());}};_0x44980c(++_0x492350);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x33554b,_0x48162b){_0x33554b=_0x33554b-0x0;var _0x256954=_0xcb91[_0x33554b];return _0x256954;};'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 7391922..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 _0xe900=['exports','sequelize'];(function(_0x165fd9,_0x211612){var _0x536cdf=function(_0x350c6a){while(--_0x350c6a){_0x165fd9['push'](_0x165fd9['shift']());}};_0x536cdf(++_0x211612);}(_0xe900,0x14b));var _0x0e90=function(_0x1ada4c,_0xa8b56b){_0x1ada4c=_0x1ada4c-0x0;var _0x56d384=_0xe900[_0x1ada4c];return _0x56d384;};'use strict';var Sequelize=require(_0x0e90('0x0'));module[_0x0e90('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 57a3abf..b250404 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 _0x8459=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues'];(function(_0x5abc05,_0x3034a3){var _0x38ff18=function(_0x12fac4){while(--_0x12fac4){_0x5abc05['push'](_0x5abc05['shift']());}};_0x38ff18(++_0x3034a3);}(_0x8459,0x12b));var _0x9845=function(_0x1d51e3,_0x1efd27){_0x1d51e3=_0x1d51e3-0x0;var _0x27807d=_0x8459[_0x1d51e3];return _0x27807d;};'use strict';var _=require('lodash');var util=require(_0x9845('0x0'));var logger=require(_0x9845('0x1'))(_0x9845('0x2'));var moment=require('moment');var BPromise=require(_0x9845('0x3'));var rp=require(_0x9845('0x4'));var fs=require('fs');var path=require(_0x9845('0x5'));var rimraf=require(_0x9845('0x6'));var config=require(_0x9845('0x7'));var attributes=require(_0x9845('0x8'));module[_0x9845('0x9')]=function(_0x300cb9,_0x4f2635){return _0x300cb9[_0x9845('0xa')](_0x9845('0xb'),attributes,{'tableName':_0x9845('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb0b1=['api','moment','bluebird','rimraf','../../config/environment','exports','UserVoiceQueue'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xb0b1,0x1f1));var _0x1b0b=function(_0x233de4,_0x5ae940){_0x233de4=_0x233de4-0x0;var _0x4dfa5c=_0xb0b1[_0x233de4];return _0x4dfa5c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x1b0b('0x0'));var moment=require(_0x1b0b('0x1'));var BPromise=require(_0x1b0b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b0b('0x3'));var config=require(_0x1b0b('0x4'));var attributes=require('./userVoiceQueue.attributes');module[_0x1b0b('0x5')]=function(_0x4ea414,_0xfa4665){return _0x4ea414['define'](_0x1b0b('0x6'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index ea831c3..676e808 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 _0x51a3=['stringify','error','message','result','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','http','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x51a3,0x125));var _0x351a=function(_0x4ec6d3,_0xb6b27a){_0x4ec6d3=_0x4ec6d3-0x0;var _0xe46287=_0x51a3[_0x4ec6d3];return _0xe46287;};'use strict';var _=require('lodash');var util=require(_0x351a('0x0'));var moment=require(_0x351a('0x1'));var BPromise=require(_0x351a('0x2'));var rs=require(_0x351a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x351a('0x4'));var logger=require(_0x351a('0x5'))(_0x351a('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x351a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xd53691,_0x163bd2,_0x3f81e9){return new BPromise(function(_0x54e690,_0xb8c2cf){return client['request'](_0xd53691,_0x3f81e9)['then'](function(_0x3aad10){logger[_0x351a('0x8')](_0x351a('0x9'),_0x163bd2,_0x351a('0xa'));logger[_0x351a('0xb')](_0x351a('0xc'),_0x163bd2,'request\x20sent',JSON[_0x351a('0xd')](_0x3aad10));if(_0x3aad10[_0x351a('0xe')]){if(_0x3aad10[_0x351a('0xe')]['code']===0x1f4){logger[_0x351a('0xe')](_0x351a('0x9'),_0x163bd2,_0x3aad10[_0x351a('0xe')]['message']);return _0xb8c2cf(_0x3aad10['error'][_0x351a('0xf')]);}logger[_0x351a('0xe')](_0x351a('0x9'),_0x163bd2,_0x3aad10['error']['message']);return _0x54e690(_0x3aad10[_0x351a('0xe')][_0x351a('0xf')]);}else{logger[_0x351a('0x8')](_0x351a('0x9'),_0x163bd2,'request\x20sent');_0x54e690(_0x3aad10[_0x351a('0x10')][_0x351a('0xf')]);}})['catch'](function(_0x3dc6e3){logger[_0x351a('0xe')](_0x351a('0x9'),_0x163bd2,_0x3dc6e3);_0xb8c2cf(_0x3dc6e3);});});} \ No newline at end of file +var _0x29c3=['http','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x434783,_0xff395d){var _0x13efcf=function(_0x235dac){while(--_0x235dac){_0x434783['push'](_0x434783['shift']());}};_0x13efcf(++_0xff395d);}(_0x29c3,0xdc));var _0x329c=function(_0x1dbf28,_0x4ea005){_0x1dbf28=_0x1dbf28-0x0;var _0x55aee8=_0x29c3[_0x1dbf28];return _0x55aee8;};'use strict';var _=require(_0x329c('0x0'));var util=require(_0x329c('0x1'));var moment=require(_0x329c('0x2'));var BPromise=require(_0x329c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x329c('0x4'));var db=require(_0x329c('0x5'))['db'];var utils=require(_0x329c('0x6'));var logger=require(_0x329c('0x7'))('rpc');var config=require(_0x329c('0x8'));var jayson=require(_0x329c('0x9'));var client=jayson[_0x329c('0xa')][_0x329c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x326140,_0x328e2a,_0x5131ac){return new BPromise(function(_0x532576,_0x5f191c){return client[_0x329c('0xc')](_0x326140,_0x5131ac)[_0x329c('0xd')](function(_0x5d8011){logger['info'](_0x329c('0xe'),_0x328e2a,_0x329c('0xf'));logger[_0x329c('0x10')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x328e2a,_0x329c('0xf'),JSON['stringify'](_0x5d8011));if(_0x5d8011[_0x329c('0x11')]){if(_0x5d8011[_0x329c('0x11')][_0x329c('0x12')]===0x1f4){logger[_0x329c('0x11')](_0x329c('0xe'),_0x328e2a,_0x5d8011[_0x329c('0x11')][_0x329c('0x13')]);return _0x5f191c(_0x5d8011['error'][_0x329c('0x13')]);}logger[_0x329c('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x328e2a,_0x5d8011[_0x329c('0x11')]['message']);return _0x532576(_0x5d8011['error']['message']);}else{logger['info'](_0x329c('0xe'),_0x328e2a,_0x329c('0xf'));_0x532576(_0x5d8011[_0x329c('0x14')][_0x329c('0x13')]);}})['catch'](function(_0x791d14){logger[_0x329c('0x11')](_0x329c('0xe'),_0x328e2a,_0x791d14);_0x5f191c(_0x791d14);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 519056f..e23b57c 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x45a869,_0x109443){var _0x48af40=function(_0x420a94){while(--_0x420a94){_0x45a869['push'](_0x45a869['shift']());}};_0x48af40(++_0x109443);}(_0x70e0,0x17b));var _0x070e=function(_0x5bb17c,_0x5c6d2c){_0x5bb17c=_0x5bb17c-0x0;var _0x2bfff6=_0x70e0[_0x5bb17c];return _0x2bfff6;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x8e5172,_0x2fb72e){var _0xf0595e=function(_0x55282a){while(--_0x55282a){_0x8e5172['push'](_0x8e5172['shift']());}};_0xf0595e(++_0x2fb72e);}(_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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 01d28c4..fe29c68 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 _0xd484=['STRING','queue_interface','Required\x20by\x20Asterisk','sequelize','exports','INTEGER'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd484,0xff));var _0x4d48=function(_0x1f3b69,_0x2ea063){_0x1f3b69=_0x1f3b69-0x0;var _0x3f84c4=_0xd484[_0x1f3b69];return _0x3f84c4;};'use strict';var Sequelize=require(_0x4d48('0x0'));module[_0x4d48('0x1')]={'uniqueid':{'type':Sequelize[_0x4d48('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x4d48('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x4d48('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x4d48('0x3')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x4d48('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x4d48('0x3')],'allowNull':![],'unique':_0x4d48('0x4'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x4d48('0x2')](0xb),'defaultValue':0x0,'comment':_0x4d48('0x5')},'paused':{'type':Sequelize[_0x4d48('0x2')](0xb),'defaultValue':0x0,'comment':_0x4d48('0x5')}}; \ No newline at end of file +var _0x1250=['STRING','queue_interface','sequelize','INTEGER','Required\x20by\x20Asterisk'];(function(_0x4033c2,_0x2d5d6e){var _0x82cb1=function(_0x53c832){while(--_0x53c832){_0x4033c2['push'](_0x4033c2['shift']());}};_0x82cb1(++_0x2d5d6e);}(_0x1250,0xde));var _0x0125=function(_0x3e502d,_0x3f27b4){_0x3e502d=_0x3e502d-0x0;var _0xe927ad=_0x1250[_0x3e502d];return _0xe927ad;};'use strict';var Sequelize=require(_0x0125('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x0125('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x0125('0x2')},'membername':{'type':Sequelize[_0x0125('0x3')],'allowNull':![],'comment':_0x0125('0x2')},'UserId':{'type':Sequelize[_0x0125('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0x0125('0x2')},'VoiceQueueId':{'type':Sequelize[_0x0125('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x0125('0x3')],'allowNull':![],'unique':_0x0125('0x4'),'comment':_0x0125('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x0125('0x2')},'paused':{'type':Sequelize[_0x0125('0x1')](0xb),'defaultValue':0x0,'comment':_0x0125('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 9678b0f..c3fcc55 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 _0x826e=['events','UserVoiceQueueRt','emit','hasOwnProperty','hook','exports'];(function(_0xa45395,_0x5579e6){var _0x3c83d2=function(_0x5d013c){while(--_0x5d013c){_0xa45395['push'](_0xa45395['shift']());}};_0x3c83d2(++_0x5579e6);}(_0x826e,0x72));var _0xe826=function(_0x462a54,_0x373b1c){_0x462a54=_0x462a54-0x0;var _0x4df2b0=_0x826e[_0x462a54];return _0x4df2b0;};'use strict';var EventEmitter=require(_0xe826('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xe826('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5872f4){return function(_0x47d89b,_0x49bcdc,_0x5256c2){UserVoiceQueueRtEvents[_0xe826('0x2')](_0x5872f4+':'+_0x47d89b['id'],_0x47d89b);UserVoiceQueueRtEvents[_0xe826('0x2')](_0x5872f4,_0x47d89b);_0x5256c2(null);};}for(var e in events){if(events[_0xe826('0x3')](e)){var event=events[e];UserVoiceQueueRt[_0xe826('0x4')](e,emitEvent(event));}}module[_0xe826('0x5')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x8970=['hasOwnProperty','exports','UserVoiceQueueRt','save','remove','emit'];(function(_0x1e09ba,_0x4c3939){var _0x2e551f=function(_0x4a447b){while(--_0x4a447b){_0x1e09ba['push'](_0x1e09ba['shift']());}};_0x2e551f(++_0x4c3939);}(_0x8970,0x1dc));var _0x0897=function(_0x1f6dba,_0x5c79e1){_0x1f6dba=_0x1f6dba-0x0;var _0x5175d6=_0x8970[_0x1f6dba];return _0x5175d6;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x0897('0x0')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0897('0x1'),'afterUpdate':'update','afterDestroy':_0x0897('0x2')};function emitEvent(_0x413402){return function(_0x2c8633,_0x3c7a8d,_0x5137c7){UserVoiceQueueRtEvents[_0x0897('0x3')](_0x413402+':'+_0x2c8633['id'],_0x2c8633);UserVoiceQueueRtEvents['emit'](_0x413402,_0x2c8633);_0x5137c7(null);};}for(var e in events){if(events[_0x0897('0x4')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x0897('0x5')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index ab8800c..2bad315 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 _0x0e50=['user_has_voice_queues_rt','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt'];(function(_0x277107,_0x3420dc){var _0x1da046=function(_0x47122d){while(--_0x47122d){_0x277107['push'](_0x277107['shift']());}};_0x1da046(++_0x3420dc);}(_0x0e50,0x151));var _0x00e5=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x0e50[_0x29d915];return _0x160f86;};'use strict';var _=require(_0x00e5('0x0'));var util=require('util');var logger=require(_0x00e5('0x1'))(_0x00e5('0x2'));var moment=require(_0x00e5('0x3'));var BPromise=require(_0x00e5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x00e5('0x5'));var rimraf=require(_0x00e5('0x6'));var config=require(_0x00e5('0x7'));var attributes=require(_0x00e5('0x8'));module[_0x00e5('0x9')]=function(_0x2e8d06,_0x1f82ea){return _0x2e8d06['define'](_0x00e5('0xa'),attributes,{'tableName':_0x00e5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x74e6=['exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes'];(function(_0x109cd2,_0x31fc93){var _0x6c91f6=function(_0x2f614f){while(--_0x2f614f){_0x109cd2['push'](_0x109cd2['shift']());}};_0x6c91f6(++_0x31fc93);}(_0x74e6,0x17d));var _0x674e=function(_0x59b3b7,_0x5ad135){_0x59b3b7=_0x59b3b7-0x0;var _0x47c030=_0x74e6[_0x59b3b7];return _0x47c030;};'use strict';var _=require(_0x674e('0x0'));var util=require(_0x674e('0x1'));var logger=require(_0x674e('0x2'))(_0x674e('0x3'));var moment=require('moment');var BPromise=require(_0x674e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x674e('0x5'));var rimraf=require(_0x674e('0x6'));var config=require(_0x674e('0x7'));var attributes=require(_0x674e('0x8'));module[_0x674e('0x9')]=function(_0x431c0c,_0x4b3777){return _0x431c0c[_0x674e('0xa')](_0x674e('0xb'),attributes,{'tableName':_0x674e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index d922880..f263543 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 _0x479f=['literal','`paused`\x20=\x201,\x201,\x20null','then','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','./userVoiceQueueRt.socket','register','request','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceQueueRtPauses','findAll','options','raw','sequelize','COUNT'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x479f,0x6f));var _0xf479=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x479f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf479('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf479('0x1'));var fs=require('fs');var Redis=require(_0xf479('0x2'));var db=require(_0xf479('0x3'))['db'];var utils=require(_0xf479('0x4'));var logger=require(_0xf479('0x5'))(_0xf479('0x6'));var config=require(_0xf479('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf479('0x8')][_0xf479('0x9')]({'port':0x232a});config['redis']=_[_0xf479('0xa')](config[_0xf479('0xb')],{'host':_0xf479('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf479('0xb')]));require(_0xf479('0xd'))[_0xf479('0xe')](socket);function respondWithRpcPromise(_0xade841,_0x467bb8,_0x987636){return new BPromise(function(_0xfcf146,_0x5adb70){return client[_0xf479('0xf')](_0xade841,_0x987636)['then'](function(_0x6af595){logger['info'](_0xf479('0x10'),_0x467bb8,_0xf479('0x11'));logger[_0xf479('0x12')](_0xf479('0x13'),_0x467bb8,_0xf479('0x11'),JSON[_0xf479('0x14')](_0x6af595));if(_0x6af595[_0xf479('0x15')]){if(_0x6af595[_0xf479('0x15')][_0xf479('0x16')]===0x1f4){logger[_0xf479('0x15')](_0xf479('0x10'),_0x467bb8,_0x6af595['error'][_0xf479('0x17')]);return _0x5adb70(_0x6af595['error'][_0xf479('0x17')]);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x467bb8,_0x6af595[_0xf479('0x15')][_0xf479('0x17')]);return _0xfcf146(_0x6af595[_0xf479('0x15')][_0xf479('0x17')]);}else{logger[_0xf479('0x18')](_0xf479('0x10'),_0x467bb8,_0xf479('0x11'));_0xfcf146(_0x6af595[_0xf479('0x19')][_0xf479('0x17')]);}})[_0xf479('0x1a')](function(_0xdbecc5){logger[_0xf479('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x467bb8,_0xdbecc5);_0x5adb70(_0xdbecc5);});});}exports[_0xf479('0x1b')]=function(_0x2aa31e){var _0x171465=this;return new Promise(function(_0xf634a7,_0x18c01f){return db['UserVoiceQueueRt'][_0xf479('0x1c')]({'raw':_0x2aa31e[_0xf479('0x1d')]?_0x2aa31e[_0xf479('0x1d')][_0xf479('0x1e')]===undefined?!![]:![]:!![],'where':_0x2aa31e[_0xf479('0x1d')]?_0x2aa31e['options']['where']||null:null,'attributes':[[db[_0xf479('0x1f')]['fn'](_0xf479('0x20'),db[_0xf479('0x1f')]['fn']('IF',db[_0xf479('0x1f')][_0xf479('0x21')](_0xf479('0x22')))),'outboundQueuePauses']]})[_0xf479('0x23')](function(_0x41274f){logger['info'](_0xf479('0x1b'),_0x2aa31e);logger[_0xf479('0x12')](_0xf479('0x1b'),_0x2aa31e,JSON[_0xf479('0x14')](_0x41274f));_0xf634a7(_0x41274f);})['catch'](function(_0x22f4b8){logger[_0xf479('0x15')](_0xf479('0x1b'),_0x22f4b8[_0xf479('0x17')],_0x2aa31e);_0x18c01f(_0x171465['error'](0x1f4,_0x22f4b8[_0xf479('0x17')]));});});}; \ No newline at end of file +var _0x805a=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','lodash','util','bluebird','randomstring'];(function(_0x180254,_0x522c85){var _0x14670c=function(_0xaef954){while(--_0xaef954){_0x180254['push'](_0x180254['shift']());}};_0x14670c(++_0x522c85);}(_0x805a,0x152));var _0xa805=function(_0x505dcb,_0x3d3646){_0x505dcb=_0x505dcb-0x0;var _0x3f1944=_0x805a[_0x505dcb];return _0x3f1944;};'use strict';var _=require(_0xa805('0x0'));var util=require(_0xa805('0x1'));var moment=require('moment');var BPromise=require(_0xa805('0x2'));var rs=require(_0xa805('0x3'));var fs=require('fs');var Redis=require(_0xa805('0x4'));var db=require(_0xa805('0x5'))['db'];var utils=require(_0xa805('0x6'));var logger=require(_0xa805('0x7'))(_0xa805('0x8'));var config=require(_0xa805('0x9'));var jayson=require(_0xa805('0xa'));var client=jayson[_0xa805('0xb')][_0xa805('0xc')]({'port':0x232a});config[_0xa805('0xd')]=_[_0xa805('0xe')](config[_0xa805('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xa805('0xf'))(new Redis(config[_0xa805('0xd')]));require(_0xa805('0x10'))[_0xa805('0x11')](socket);function respondWithRpcPromise(_0x27b6d6,_0x2df132,_0x533f40){return new BPromise(function(_0x57ac11,_0x6fcd70){return client[_0xa805('0x12')](_0x27b6d6,_0x533f40)[_0xa805('0x13')](function(_0x53ced6){logger[_0xa805('0x14')](_0xa805('0x15'),_0x2df132,_0xa805('0x16'));logger[_0xa805('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x2df132,'request\x20sent',JSON[_0xa805('0x18')](_0x53ced6));if(_0x53ced6[_0xa805('0x19')]){if(_0x53ced6[_0xa805('0x19')][_0xa805('0x1a')]===0x1f4){logger[_0xa805('0x19')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2df132,_0x53ced6[_0xa805('0x19')][_0xa805('0x1b')]);return _0x6fcd70(_0x53ced6[_0xa805('0x19')][_0xa805('0x1b')]);}logger[_0xa805('0x19')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x2df132,_0x53ced6[_0xa805('0x19')]['message']);return _0x57ac11(_0x53ced6[_0xa805('0x19')][_0xa805('0x1b')]);}else{logger[_0xa805('0x14')](_0xa805('0x15'),_0x2df132,_0xa805('0x16'));_0x57ac11(_0x53ced6[_0xa805('0x1c')][_0xa805('0x1b')]);}})[_0xa805('0x1d')](function(_0x3e00ef){logger['error'](_0xa805('0x15'),_0x2df132,_0x3e00ef);_0x6fcd70(_0x3e00ef);});});}exports[_0xa805('0x1e')]=function(_0x1c4394){var _0x4653fb=this;return new Promise(function(_0x3cf52c,_0x2c33db){return db[_0xa805('0x1f')]['findAll']({'raw':_0x1c4394[_0xa805('0x20')]?_0x1c4394['options'][_0xa805('0x21')]===undefined?!![]:![]:!![],'where':_0x1c4394[_0xa805('0x20')]?_0x1c4394[_0xa805('0x20')]['where']||null:null,'attributes':[[db[_0xa805('0x22')]['fn'](_0xa805('0x23'),db[_0xa805('0x22')]['fn']('IF',db[_0xa805('0x22')][_0xa805('0x24')](_0xa805('0x25')))),'outboundQueuePauses']]})[_0xa805('0x13')](function(_0x24f153){logger[_0xa805('0x14')](_0xa805('0x1e'),_0x1c4394);logger['debug'](_0xa805('0x1e'),_0x1c4394,JSON['stringify'](_0x24f153));_0x3cf52c(_0x24f153);})[_0xa805('0x1d')](function(_0x4154c6){logger[_0xa805('0x19')](_0xa805('0x1e'),_0x4154c6[_0xa805('0x1b')],_0x1c4394);_0x2c33db(_0x4653fb['error'](0x1f4,_0x4154c6[_0xa805('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 2b89214..764ee63 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 _0xea31=['register','userVoiceQueueRt:','./userVoiceQueueRt.events','remove','update','emit','removeListener'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xea31,0x6b));var _0x1ea3=function(_0x320932,_0x592a84){_0x320932=_0x320932-0x0;var _0xb5908=_0xea31[_0x320932];return _0xb5908;};'use strict';var UserVoiceQueueRtEvents=require(_0x1ea3('0x0'));var events=['save',_0x1ea3('0x1'),_0x1ea3('0x2')];function createListener(_0x3b1d99,_0x153625){return function(_0x2dc24e){_0x153625[_0x1ea3('0x3')](_0x3b1d99,_0x2dc24e);};}function removeListener(_0x1142f1,_0x555620){return function(){UserVoiceQueueRtEvents[_0x1ea3('0x4')](_0x1142f1,_0x555620);};}exports[_0x1ea3('0x5')]=function(_0x6810da){for(var _0x27c695=0x0,_0x13e6fb=events['length'];_0x27c695<_0x13e6fb;_0x27c695++){var _0x1fa3a8=events[_0x27c695];var _0x1b578e=createListener(_0x1ea3('0x6')+_0x1fa3a8,_0x6810da);UserVoiceQueueRtEvents['on'](_0x1fa3a8,_0x1b578e);}}; \ No newline at end of file +var _0x8917=['emit','removeListener','length','./userVoiceQueueRt.events','remove','update'];(function(_0x509b57,_0x209bcc){var _0x703b96=function(_0x4d07b0){while(--_0x4d07b0){_0x509b57['push'](_0x509b57['shift']());}};_0x703b96(++_0x209bcc);}(_0x8917,0x1d7));var _0x7891=function(_0x1b64e6,_0x5bf121){_0x1b64e6=_0x1b64e6-0x0;var _0x234c4a=_0x8917[_0x1b64e6];return _0x234c4a;};'use strict';var UserVoiceQueueRtEvents=require(_0x7891('0x0'));var events=['save',_0x7891('0x1'),_0x7891('0x2')];function createListener(_0xfc1628,_0x129608){return function(_0xdf5de1){_0x129608[_0x7891('0x3')](_0xfc1628,_0xdf5de1);};}function removeListener(_0x2b5570,_0x24234b){return function(){UserVoiceQueueRtEvents[_0x7891('0x4')](_0x2b5570,_0x24234b);};}exports['register']=function(_0x46b52a){for(var _0x43a48e=0x0,_0x442944=events[_0x7891('0x5')];_0x43a48e<_0x442944;_0x43a48e++){var _0x4722b7=events[_0x43a48e];var _0x452a6d=createListener('userVoiceQueueRt:'+_0x4722b7,_0x46b52a);UserVoiceQueueRtEvents['on'](_0x4722b7,_0x452a6d);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 5942c40..117e9c2 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x285c4d,_0x31cef6){var _0x538a56=function(_0x5adbc0){while(--_0x5adbc0){_0x285c4d['push'](_0x285c4d['shift']());}};_0x538a56(++_0x31cef6);}(_0x70e0,0x17b));var _0x070e=function(_0x2e5173,_0x8af9db){_0x2e5173=_0x2e5173-0x0;var _0x18c805=_0x70e0[_0x2e5173];return _0x18c805;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x28875d,_0x224d95){var _0x217893=function(_0x5bc32e){while(--_0x5bc32e){_0x28875d['push'](_0x28875d['shift']());}};_0x217893(++_0x224d95);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1e91eb,_0x5829a3){_0x1e91eb=_0x1e91eb-0x0;var _0x2af75a=_0xcb91[_0x1e91eb];return _0x2af75a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 6a95bee..e333f3d 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 _0xe057=['sequelize'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe057,0x8e));var _0x7e05=function(_0x38c632,_0x14e8e6){_0x38c632=_0x38c632-0x0;var _0x12737e=_0xe057[_0x38c632];return _0x12737e;};'use strict';var Sequelize=require(_0x7e05('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x071a=['INTEGER','exports'];(function(_0x43d3f8,_0xe3453d){var _0x113424=function(_0x142264){while(--_0x142264){_0x43d3f8['push'](_0x43d3f8['shift']());}};_0x113424(++_0xe3453d);}(_0x071a,0x1af));var _0xa071=function(_0x5cbace,_0x33943c){_0x5cbace=_0x5cbace-0x0;var _0x6de5b8=_0x071a[_0x5cbace];return _0x6de5b8;};'use strict';var Sequelize=require('sequelize');module[_0xa071('0x0')]={'penalty':{'type':Sequelize[_0xa071('0x1')],'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 8c4bfbb..7963649 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 _0x588e=['bluebird','request-promise','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','user_has_whatsapp_queues','lodash','util','../../config/logger','api'];(function(_0x51eb77,_0x436673){var _0x4b26fe=function(_0x4db9dc){while(--_0x4db9dc){_0x51eb77['push'](_0x51eb77['shift']());}};_0x4b26fe(++_0x436673);}(_0x588e,0x188));var _0xe588=function(_0x17e3c7,_0x1cfc59){_0x17e3c7=_0x17e3c7-0x0;var _0x4e0af9=_0x588e[_0x17e3c7];return _0x4e0af9;};'use strict';var _=require(_0xe588('0x0'));var util=require(_0xe588('0x1'));var logger=require(_0xe588('0x2'))(_0xe588('0x3'));var moment=require('moment');var BPromise=require(_0xe588('0x4'));var rp=require(_0xe588('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe588('0x6'));var config=require(_0xe588('0x7'));var attributes=require(_0xe588('0x8'));module[_0xe588('0x9')]=function(_0x392528,_0x15ea1a){return _0x392528[_0xe588('0xa')]('UserWhatsappQueue',attributes,{'tableName':_0xe588('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x26a2=['rimraf','../../config/environment','exports','define','user_has_whatsapp_queues','util','../../config/logger','api','request-promise','path'];(function(_0xf4add4,_0x5b9cc1){var _0x1c42fb=function(_0x2674c1){while(--_0x2674c1){_0xf4add4['push'](_0xf4add4['shift']());}};_0x1c42fb(++_0x5b9cc1);}(_0x26a2,0xd7));var _0x226a=function(_0x36a928,_0x43ff8f){_0x36a928=_0x36a928-0x0;var _0x16d07b=_0x26a2[_0x36a928];return _0x16d07b;};'use strict';var _=require('lodash');var util=require(_0x226a('0x0'));var logger=require(_0x226a('0x1'))(_0x226a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x226a('0x3'));var fs=require('fs');var path=require(_0x226a('0x4'));var rimraf=require(_0x226a('0x5'));var config=require(_0x226a('0x6'));var attributes=require('./userWhatsappQueue.attributes');module[_0x226a('0x7')]=function(_0x43855d,_0xc2b24a){return _0x43855d[_0x226a('0x8')]('UserWhatsappQueue',attributes,{'tableName':_0x226a('0x9'),'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 e860c1c..0213681 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 _0xd56c=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xd56c,0xd2));var _0xcd56=function(_0x4ac5c0,_0x575aae){_0x4ac5c0=_0x4ac5c0-0x0;var _0x26154c=_0xd56c[_0x4ac5c0];return _0x26154c;};'use strict';var _=require(_0xcd56('0x0'));var util=require('util');var moment=require(_0xcd56('0x1'));var BPromise=require(_0xcd56('0x2'));var rs=require(_0xcd56('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcd56('0x4'))['db'];var utils=require(_0xcd56('0x5'));var logger=require(_0xcd56('0x6'))('rpc');var config=require(_0xcd56('0x7'));var jayson=require(_0xcd56('0x8'));var client=jayson[_0xcd56('0x9')][_0xcd56('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c0f34,_0x12273e,_0x52f376){return new BPromise(function(_0xe22576,_0x5cc0aa){return client[_0xcd56('0xb')](_0x2c0f34,_0x52f376)[_0xcd56('0xc')](function(_0x227f1d){logger[_0xcd56('0xd')](_0xcd56('0xe'),_0x12273e,_0xcd56('0xf'));logger['debug'](_0xcd56('0x10'),_0x12273e,_0xcd56('0xf'),JSON['stringify'](_0x227f1d));if(_0x227f1d[_0xcd56('0x11')]){if(_0x227f1d['error'][_0xcd56('0x12')]===0x1f4){logger[_0xcd56('0x11')](_0xcd56('0xe'),_0x12273e,_0x227f1d[_0xcd56('0x11')][_0xcd56('0x13')]);return _0x5cc0aa(_0x227f1d[_0xcd56('0x11')][_0xcd56('0x13')]);}logger[_0xcd56('0x11')](_0xcd56('0xe'),_0x12273e,_0x227f1d[_0xcd56('0x11')][_0xcd56('0x13')]);return _0xe22576(_0x227f1d[_0xcd56('0x11')][_0xcd56('0x13')]);}else{logger[_0xcd56('0xd')](_0xcd56('0xe'),_0x12273e,_0xcd56('0xf'));_0xe22576(_0x227f1d[_0xcd56('0x14')][_0xcd56('0x13')]);}})['catch'](function(_0x2a9ba8){logger['error'](_0xcd56('0xe'),_0x12273e,_0x2a9ba8);_0x5cc0aa(_0x2a9ba8);});});} \ No newline at end of file +var _0x8c08=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x8c08,0x8e));var _0x88c0=function(_0xb66df,_0x4fb5ce){_0xb66df=_0xb66df-0x0;var _0x42a702=_0x8c08[_0xb66df];return _0x42a702;};'use strict';var _=require(_0x88c0('0x0'));var util=require(_0x88c0('0x1'));var moment=require(_0x88c0('0x2'));var BPromise=require(_0x88c0('0x3'));var rs=require(_0x88c0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x88c0('0x5'))['db'];var utils=require(_0x88c0('0x6'));var logger=require(_0x88c0('0x7'))(_0x88c0('0x8'));var config=require('../../config/environment');var jayson=require(_0x88c0('0x9'));var client=jayson['client'][_0x88c0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18c420,_0x62bc85,_0xf15c91){return new BPromise(function(_0x40921f,_0x53ab55){return client[_0x88c0('0xb')](_0x18c420,_0xf15c91)[_0x88c0('0xc')](function(_0x1b466c){logger[_0x88c0('0xd')](_0x88c0('0xe'),_0x62bc85,_0x88c0('0xf'));logger['debug']('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x62bc85,_0x88c0('0xf'),JSON[_0x88c0('0x10')](_0x1b466c));if(_0x1b466c[_0x88c0('0x11')]){if(_0x1b466c['error'][_0x88c0('0x12')]===0x1f4){logger['error'](_0x88c0('0xe'),_0x62bc85,_0x1b466c['error'][_0x88c0('0x13')]);return _0x53ab55(_0x1b466c[_0x88c0('0x11')][_0x88c0('0x13')]);}logger[_0x88c0('0x11')](_0x88c0('0xe'),_0x62bc85,_0x1b466c[_0x88c0('0x11')][_0x88c0('0x13')]);return _0x40921f(_0x1b466c[_0x88c0('0x11')][_0x88c0('0x13')]);}else{logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0x62bc85,_0x88c0('0xf'));_0x40921f(_0x1b466c[_0x88c0('0x14')][_0x88c0('0x13')]);}})['catch'](function(_0x50e42e){logger[_0x88c0('0x11')](_0x88c0('0xe'),_0x62bc85,_0x50e42e);_0x53ab55(_0x50e42e);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index e9e628a..e711e9a 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 _0x1306=['put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x260f7b,_0x55199e){var _0x555862=function(_0x12259f){while(--_0x12259f){_0x260f7b['push'](_0x260f7b['shift']());}};_0x555862(++_0x55199e);}(_0x1306,0x17a));var _0x6130=function(_0x5e091d,_0xc1d2a4){_0x5e091d=_0x5e091d-0x0;var _0x2d799f=_0x1306[_0x5e091d];return _0x2d799f;};'use strict';var multer=require(_0x6130('0x0'));var util=require(_0x6130('0x1'));var path=require(_0x6130('0x2'));var timeout=require(_0x6130('0x3'));var express=require(_0x6130('0x4'));var router=express[_0x6130('0x5')]();var fs_extra=require(_0x6130('0x6'));var auth=require(_0x6130('0x7'));var interaction=require(_0x6130('0x8'));var config=require(_0x6130('0x9'));var controller=require(_0x6130('0xa'));router[_0x6130('0xb')]('/',auth[_0x6130('0xc')](),controller[_0x6130('0xd')]);router[_0x6130('0xb')](_0x6130('0xe'),auth[_0x6130('0xc')](),controller[_0x6130('0xf')]);router[_0x6130('0x10')]('/',auth[_0x6130('0xc')](),controller[_0x6130('0x11')]);router[_0x6130('0x12')](_0x6130('0xe'),auth[_0x6130('0xc')](),controller[_0x6130('0x13')]);router[_0x6130('0x14')](_0x6130('0xe'),auth[_0x6130('0xc')](),controller[_0x6130('0x15')]);module['exports']=router; \ No newline at end of file +var _0xfd7b=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x4c8e2e,_0x534014){var _0x5b44e0=function(_0x213955){while(--_0x213955){_0x4c8e2e['push'](_0x4c8e2e['shift']());}};_0x5b44e0(++_0x534014);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x286726,_0x20a337){_0x286726=_0x286726-0x0;var _0xcd4fe9=_0xfd7b[_0x286726];return _0xcd4fe9;};'use strict';var multer=require('multer');var util=require(_0xbfd7('0x0'));var path=require(_0xbfd7('0x1'));var timeout=require(_0xbfd7('0x2'));var express=require(_0xbfd7('0x3'));var router=express[_0xbfd7('0x4')]();var fs_extra=require(_0xbfd7('0x5'));var auth=require(_0xbfd7('0x6'));var interaction=require(_0xbfd7('0x7'));var config=require(_0xbfd7('0x8'));var controller=require(_0xbfd7('0x9'));router[_0xbfd7('0xa')]('/',auth[_0xbfd7('0xb')](),controller[_0xbfd7('0xc')]);router['get'](_0xbfd7('0xd'),auth['isAuthenticated'](),controller[_0xbfd7('0xe')]);router['post']('/',auth[_0xbfd7('0xb')](),controller[_0xbfd7('0xf')]);router[_0xbfd7('0x10')](_0xbfd7('0xd'),auth['isAuthenticated'](),controller[_0xbfd7('0x11')]);router[_0xbfd7('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xbfd7('0x13')]);module[_0xbfd7('0x14')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 03487fc..5423a00 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 _0x2a2f=['STRING','sequelize','exports'];(function(_0x58d13b,_0x1aac94){var _0x1ca85d=function(_0x1205bd){while(--_0x1205bd){_0x58d13b['push'](_0x58d13b['shift']());}};_0x1ca85d(++_0x1aac94);}(_0x2a2f,0x1c6));var _0xf2a2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x2a2f[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xf2a2('0x0'));module[_0xf2a2('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf2a2('0x2')]}}; \ No newline at end of file +var _0x8cd9=['STRING','sequelize','exports'];(function(_0x36b037,_0x2b234e){var _0x409194=function(_0xddc9dc){while(--_0xddc9dc){_0x36b037['push'](_0x36b037['shift']());}};_0x409194(++_0x2b234e);}(_0x8cd9,0x112));var _0x98cd=function(_0x2340fe,_0x1adfe6){_0x2340fe=_0x2340fe-0x0;var _0x437822=_0x8cd9[_0x2340fe];return _0x437822;};'use strict';var Sequelize=require(_0x98cd('0x0'));module[_0x98cd('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x98cd('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index cb48b71..96c5230 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 _0xec9b=['name','index','map','rawAttributes','type','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','Variable','include','rows','catch','show','params','length','includeAll','options','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','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','Variables','UserProfileResource','destroy','error'];(function(_0x140ff2,_0x11f760){var _0x54ebe8=function(_0x6dc17c){while(--_0x6dc17c){_0x140ff2['push'](_0x140ff2['shift']());}};_0x54ebe8(++_0x11f760);}(_0xec9b,0x1b3));var _0xbec9=function(_0x407bd8,_0x277add){_0x407bd8=_0x407bd8-0x0;var _0x20b6c9=_0xec9b[_0x407bd8];return _0x20b6c9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbec9('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbec9('0x1'));var moment=require(_0xbec9('0x2'));var BPromise=require(_0xbec9('0x3'));var Mustache=require(_0xbec9('0x4'));var util=require(_0xbec9('0x5'));var path=require(_0xbec9('0x6'));var sox=require('sox');var csv=require(_0xbec9('0x7'));var ejs=require(_0xbec9('0x8'));var fs=require('fs');var fs_extra=require(_0xbec9('0x9'));var _=require(_0xbec9('0xa'));var squel=require(_0xbec9('0xb'));var crypto=require(_0xbec9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbec9('0xd'));var toCsv=require(_0xbec9('0x7'));var querystring=require(_0xbec9('0xe'));var Papa=require(_0xbec9('0xf'));var Redis=require('ioredis');var authService=require(_0xbec9('0x10'));var qs=require(_0xbec9('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbec9('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xbec9('0x13'));var config=require(_0xbec9('0x14'));var licenseUtil=require(_0xbec9('0x15'));var db=require(_0xbec9('0x16'))['db'];function respondWithStatusCode(_0x1eae02,_0x1b03de){_0x1b03de=_0x1b03de||0xcc;return function(_0x27ea64){if(_0x27ea64){return _0x1eae02[_0xbec9('0x17')](_0x1b03de);}return _0x1eae02[_0xbec9('0x18')](_0x1b03de)['end']();};}function respondWithResult(_0x24215a,_0x4ebf57){_0x4ebf57=_0x4ebf57||0xc8;return function(_0xe7ee38){if(_0xe7ee38){return _0x24215a[_0xbec9('0x18')](_0x4ebf57)[_0xbec9('0x19')](_0xe7ee38);}};}function respondWithFilteredResult(_0x2419a8,_0xe5b2ae){return function(_0x20e595){if(_0x20e595){var _0x42b836=typeof _0xe5b2ae[_0xbec9('0x1a')]==='undefined'&&typeof _0xe5b2ae['limit']===_0xbec9('0x1b');var _0x2d7f8f=_0x20e595['count'];var _0x4b8d6b=_0x42b836?0x0:_0xe5b2ae[_0xbec9('0x1a')];var _0x14cd51=_0x42b836?_0x20e595[_0xbec9('0x1c')]:_0xe5b2ae[_0xbec9('0x1a')]+_0xe5b2ae[_0xbec9('0x1d')];var _0x4c5d8f;if(_0x14cd51>=_0x2d7f8f){_0x14cd51=_0x2d7f8f;_0x4c5d8f=0xc8;}else{_0x4c5d8f=0xce;}_0x2419a8[_0xbec9('0x18')](_0x4c5d8f);return _0x2419a8[_0xbec9('0x1e')](_0xbec9('0x1f'),_0x4b8d6b+'-'+_0x14cd51+'/'+_0x2d7f8f)[_0xbec9('0x19')](_0x20e595);}return null;};}function patchUpdates(_0x3b240e){return function(_0x560760){try{jsonpatch['apply'](_0x560760,_0x3b240e,!![]);}catch(_0x365c08){return BPromise[_0xbec9('0x20')](_0x365c08);}return _0x560760['save']();};}function saveUpdates(_0x1aa5e3,_0x160edb){return function(_0x3e4a7a){if(_0x3e4a7a){return _0x3e4a7a[_0xbec9('0x21')](_0x1aa5e3)[_0xbec9('0x22')](function(_0x3758b8){return _0x3758b8;});}return null;};}function removeEntity(_0x415852,_0x2f1b36){return function(_0xc9e10a){if(_0xc9e10a){return _0xc9e10a['destroy']()['then'](function(){var _0x2428d4=_0xc9e10a['get']({'plain':!![]});var _0x23518a=_0xbec9('0x23');return db[_0xbec9('0x24')][_0xbec9('0x25')]({'where':{'type':_0x23518a,'resourceId':_0x2428d4['id']}})[_0xbec9('0x22')](function(){return _0xc9e10a;});})[_0xbec9('0x22')](function(){_0x415852[_0xbec9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5064c3,_0x3b206b){return function(_0x236da0){if(!_0x236da0){_0x5064c3[_0xbec9('0x17')](0x194);}return _0x236da0;};}function handleError(_0x3ff49b,_0x3a08d4){_0x3a08d4=_0x3a08d4||0x1f4;return function(_0x362dd4){logger[_0xbec9('0x26')](_0x362dd4['stack']);if(_0x362dd4[_0xbec9('0x27')]){delete _0x362dd4[_0xbec9('0x27')];}_0x3ff49b[_0xbec9('0x18')](_0x3a08d4)['send'](_0x362dd4);};}exports[_0xbec9('0x28')]=function(_0x1dad6e,_0x442cee){var _0x19d560={},_0x5969c7={},_0x1bf33b={'count':0x0,'rows':[]};var _0x2430ee=_[_0xbec9('0x29')](db['Variable'][_0xbec9('0x2a')],function(_0x14087b){return{'name':_0x14087b['fieldName'],'type':_0x14087b[_0xbec9('0x2b')]['key']};});_0x5969c7[_0xbec9('0x2c')]=_[_0xbec9('0x29')](_0x2430ee,_0xbec9('0x27'));_0x5969c7['query']=_[_0xbec9('0x2d')](_0x1dad6e[_0xbec9('0x2e')]);_0x5969c7['filters']=_[_0xbec9('0x2f')](_0x5969c7['model'],_0x5969c7[_0xbec9('0x2e')]);_0x19d560['attributes']=_[_0xbec9('0x2f')](_0x5969c7[_0xbec9('0x2c')],qs[_0xbec9('0x30')](_0x1dad6e['query'][_0xbec9('0x30')]));_0x19d560[_0xbec9('0x31')]=_0x19d560[_0xbec9('0x31')]['length']?_0x19d560['attributes']:_0x5969c7[_0xbec9('0x2c')];if(!_0x1dad6e[_0xbec9('0x2e')][_0xbec9('0x32')](_0xbec9('0x33'))){_0x19d560[_0xbec9('0x1d')]=qs[_0xbec9('0x1d')](_0x1dad6e[_0xbec9('0x2e')]['limit']);_0x19d560[_0xbec9('0x1a')]=qs[_0xbec9('0x1a')](_0x1dad6e[_0xbec9('0x2e')][_0xbec9('0x1a')]);}_0x19d560[_0xbec9('0x34')]=qs[_0xbec9('0x35')](_0x1dad6e[_0xbec9('0x2e')]['sort']);_0x19d560['where']=qs[_0xbec9('0x36')](_[_0xbec9('0x37')](_0x1dad6e[_0xbec9('0x2e')],_0x5969c7['filters']),_0x2430ee);if(_0x1dad6e[_0xbec9('0x2e')][_0xbec9('0x38')]){_0x19d560[_0xbec9('0x39')]=_[_0xbec9('0x3a')](_0x19d560[_0xbec9('0x39')],{'$or':_[_0xbec9('0x29')](_0x2430ee,function(_0x4da78b){if(_0x4da78b[_0xbec9('0x2b')]!==_0xbec9('0x3b')){var _0x285c4d={};_0x285c4d[_0x4da78b[_0xbec9('0x27')]]={'$like':'%'+_0x1dad6e[_0xbec9('0x2e')][_0xbec9('0x38')]+'%'};return _0x285c4d;}})});}_0x19d560=_[_0xbec9('0x3a')]({},_0x19d560,_0x1dad6e['options']);var _0xac97b5={'where':_0x19d560[_0xbec9('0x39')]};return db[_0xbec9('0x3c')][_0xbec9('0x1c')](_0xac97b5)['then'](function(_0xd3c98d){_0x1bf33b[_0xbec9('0x1c')]=_0xd3c98d;if(_0x1dad6e[_0xbec9('0x2e')]['includeAll']){_0x19d560[_0xbec9('0x3d')]=[{'all':!![]}];}return db['Variable']['findAll'](_0x19d560);})[_0xbec9('0x22')](function(_0x278e36){_0x1bf33b[_0xbec9('0x3e')]=_0x278e36;return _0x1bf33b;})['then'](respondWithFilteredResult(_0x442cee,_0x19d560))[_0xbec9('0x3f')](handleError(_0x442cee,null));};exports[_0xbec9('0x40')]=function(_0x59cc28,_0x2a0123){var _0x47dcd6={'raw':!![],'where':{'id':_0x59cc28[_0xbec9('0x41')]['id']}},_0x353b50={};_0x353b50[_0xbec9('0x2c')]=_['keys'](db[_0xbec9('0x3c')][_0xbec9('0x2a')]);_0x353b50[_0xbec9('0x2e')]=_['keys'](_0x59cc28[_0xbec9('0x2e')]);_0x353b50[_0xbec9('0x36')]=_['intersection'](_0x353b50[_0xbec9('0x2c')],_0x353b50[_0xbec9('0x2e')]);_0x47dcd6['attributes']=_['intersection'](_0x353b50[_0xbec9('0x2c')],qs[_0xbec9('0x30')](_0x59cc28[_0xbec9('0x2e')][_0xbec9('0x30')]));_0x47dcd6[_0xbec9('0x31')]=_0x47dcd6[_0xbec9('0x31')][_0xbec9('0x42')]?_0x47dcd6[_0xbec9('0x31')]:_0x353b50['model'];if(_0x59cc28[_0xbec9('0x2e')][_0xbec9('0x43')]){_0x47dcd6[_0xbec9('0x3d')]=[{'all':!![]}];}_0x47dcd6=_[_0xbec9('0x3a')]({},_0x47dcd6,_0x59cc28[_0xbec9('0x44')]);return db[_0xbec9('0x3c')][_0xbec9('0x45')](_0x47dcd6)[_0xbec9('0x22')](handleEntityNotFound(_0x2a0123,null))[_0xbec9('0x22')](respondWithResult(_0x2a0123,null))[_0xbec9('0x3f')](handleError(_0x2a0123,null));};exports['create']=function(_0x2168d7,_0x317564){return db['Variable'][_0xbec9('0x46')](_0x2168d7[_0xbec9('0x47')],{})[_0xbec9('0x22')](function(_0x166b1d){var _0x33cdff=_0x2168d7[_0xbec9('0x48')][_0xbec9('0x49')]({'plain':!![]});if(!_0x33cdff)throw new Error(_0xbec9('0x4a'));if(_0x33cdff['role']==='user'){var _0x328628=_0x166b1d[_0xbec9('0x49')]({'plain':!![]});var _0x3f808b=_0xbec9('0x23');return db[_0xbec9('0x4b')][_0xbec9('0x45')]({'where':{'name':_0x3f808b,'userProfileId':_0x33cdff[_0xbec9('0x4c')]},'raw':!![]})[_0xbec9('0x22')](function(_0x2df16a){if(_0x2df16a&&_0x2df16a[_0xbec9('0x4d')]===0x0){return db[_0xbec9('0x24')][_0xbec9('0x46')]({'name':_0x328628[_0xbec9('0x27')],'resourceId':_0x328628['id'],'type':_0x2df16a[_0xbec9('0x27')],'sectionId':_0x2df16a['id']},{})[_0xbec9('0x22')](function(){return _0x166b1d;});}else{return _0x166b1d;}})[_0xbec9('0x3f')](function(_0x3a0cbe){logger[_0xbec9('0x26')](_0xbec9('0x4e'),_0x3a0cbe);throw _0x3a0cbe;});}return _0x166b1d;})['then'](respondWithResult(_0x317564,0xc9))[_0xbec9('0x3f')](handleError(_0x317564,null));};exports[_0xbec9('0x21')]=function(_0x5ea532,_0x31217d){if(_0x5ea532[_0xbec9('0x47')]['id']){delete _0x5ea532[_0xbec9('0x47')]['id'];}return db[_0xbec9('0x3c')][_0xbec9('0x45')]({'where':{'id':_0x5ea532[_0xbec9('0x41')]['id']}})[_0xbec9('0x22')](handleEntityNotFound(_0x31217d,null))['then'](saveUpdates(_0x5ea532[_0xbec9('0x47')],null))['then'](respondWithResult(_0x31217d,null))[_0xbec9('0x3f')](handleError(_0x31217d,null));};exports[_0xbec9('0x25')]=function(_0x47093f,_0x2335c3){return db[_0xbec9('0x3c')][_0xbec9('0x45')]({'where':{'id':_0x47093f[_0xbec9('0x41')]['id']}})['then'](handleEntityNotFound(_0x2335c3,null))[_0xbec9('0x22')](removeEntity(_0x2335c3,null))[_0xbec9('0x3f')](handleError(_0x2335c3,null));}; \ No newline at end of file +var _0xac88=['eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','get','Variables','error','name','map','Variable','rawAttributes','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','include','findAll','rows','show','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params'];(function(_0x355dd1,_0x23770b){var _0x3110f1=function(_0x3de9b7){while(--_0x3de9b7){_0x355dd1['push'](_0x355dd1['shift']());}};_0x3110f1(++_0x23770b);}(_0xac88,0x1da));var _0x8ac8=function(_0x28abc4,_0x46fe94){_0x28abc4=_0x28abc4-0x0;var _0x518850=_0xac88[_0x28abc4];return _0x518850;};'use strict';var emlformat=require(_0x8ac8('0x0'));var rimraf=require(_0x8ac8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8ac8('0x2'));var moment=require('moment');var BPromise=require(_0x8ac8('0x3'));var Mustache=require(_0x8ac8('0x4'));var util=require(_0x8ac8('0x5'));var path=require(_0x8ac8('0x6'));var sox=require(_0x8ac8('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ac8('0x8'));var _=require('lodash');var squel=require(_0x8ac8('0x9'));var crypto=require(_0x8ac8('0xa'));var jsforce=require(_0x8ac8('0xb'));var deskjs=require(_0x8ac8('0xc'));var toCsv=require(_0x8ac8('0xd'));var querystring=require(_0x8ac8('0xe'));var Papa=require(_0x8ac8('0xf'));var Redis=require(_0x8ac8('0x10'));var authService=require(_0x8ac8('0x11'));var qs=require(_0x8ac8('0x12'));var as=require(_0x8ac8('0x13'));var hardwareService=require(_0x8ac8('0x14'));var logger=require('../../config/logger')(_0x8ac8('0x15'));var utils=require(_0x8ac8('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8ac8('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5fcd50,_0x2f240e){_0x2f240e=_0x2f240e||0xcc;return function(_0x348bd9){if(_0x348bd9){return _0x5fcd50[_0x8ac8('0x18')](_0x2f240e);}return _0x5fcd50[_0x8ac8('0x19')](_0x2f240e)[_0x8ac8('0x1a')]();};}function respondWithResult(_0x46aa3d,_0xb64ae1){_0xb64ae1=_0xb64ae1||0xc8;return function(_0x43dd63){if(_0x43dd63){return _0x46aa3d[_0x8ac8('0x19')](_0xb64ae1)[_0x8ac8('0x1b')](_0x43dd63);}};}function respondWithFilteredResult(_0x6f417b,_0x563208){return function(_0x2f177b){if(_0x2f177b){var _0x2a9311=typeof _0x563208[_0x8ac8('0x1c')]===_0x8ac8('0x1d')&&typeof _0x563208[_0x8ac8('0x1e')]==='undefined';var _0x25c3df=_0x2f177b[_0x8ac8('0x1f')];var _0x2f8ebc=_0x2a9311?0x0:_0x563208[_0x8ac8('0x1c')];var _0x39b28f=_0x2a9311?_0x2f177b['count']:_0x563208[_0x8ac8('0x1c')]+_0x563208[_0x8ac8('0x1e')];var _0x3c46bd;if(_0x39b28f>=_0x25c3df){_0x39b28f=_0x25c3df;_0x3c46bd=0xc8;}else{_0x3c46bd=0xce;}_0x6f417b[_0x8ac8('0x19')](_0x3c46bd);return _0x6f417b[_0x8ac8('0x20')](_0x8ac8('0x21'),_0x2f8ebc+'-'+_0x39b28f+'/'+_0x25c3df)['json'](_0x2f177b);}return null;};}function patchUpdates(_0xab4608){return function(_0x5a37a8){try{jsonpatch[_0x8ac8('0x22')](_0x5a37a8,_0xab4608,!![]);}catch(_0x5d347f){return BPromise['reject'](_0x5d347f);}return _0x5a37a8[_0x8ac8('0x23')]();};}function saveUpdates(_0x1d1de6,_0x2575ac){return function(_0x125232){if(_0x125232){return _0x125232[_0x8ac8('0x24')](_0x1d1de6)['then'](function(_0x460384){return _0x460384;});}return null;};}function removeEntity(_0x3be57d,_0x10193a){return function(_0xbaa873){if(_0xbaa873){return _0xbaa873[_0x8ac8('0x25')]()[_0x8ac8('0x26')](function(){var _0x262e35=_0xbaa873[_0x8ac8('0x27')]({'plain':!![]});var _0x25cccb=_0x8ac8('0x28');return db['UserProfileResource'][_0x8ac8('0x25')]({'where':{'type':_0x25cccb,'resourceId':_0x262e35['id']}})[_0x8ac8('0x26')](function(){return _0xbaa873;});})[_0x8ac8('0x26')](function(){_0x3be57d[_0x8ac8('0x19')](0xcc)[_0x8ac8('0x1a')]();});}};}function handleEntityNotFound(_0x2f7a3f,_0x555868){return function(_0x32f7af){if(!_0x32f7af){_0x2f7a3f['sendStatus'](0x194);}return _0x32f7af;};}function handleError(_0x4cf199,_0x3e4ba3){_0x3e4ba3=_0x3e4ba3||0x1f4;return function(_0xc9a73b){logger[_0x8ac8('0x29')](_0xc9a73b['stack']);if(_0xc9a73b[_0x8ac8('0x2a')]){delete _0xc9a73b[_0x8ac8('0x2a')];}_0x4cf199[_0x8ac8('0x19')](_0x3e4ba3)['send'](_0xc9a73b);};}exports['index']=function(_0x18023a,_0x294a1e){var _0x2b5e39={},_0x1ad51f={},_0x1d3e8f={'count':0x0,'rows':[]};var _0x45ffd5=_[_0x8ac8('0x2b')](db[_0x8ac8('0x2c')][_0x8ac8('0x2d')],function(_0x13457b){return{'name':_0x13457b['fieldName'],'type':_0x13457b[_0x8ac8('0x2e')][_0x8ac8('0x2f')]};});_0x1ad51f['model']=_[_0x8ac8('0x2b')](_0x45ffd5,_0x8ac8('0x2a'));_0x1ad51f[_0x8ac8('0x30')]=_[_0x8ac8('0x31')](_0x18023a[_0x8ac8('0x30')]);_0x1ad51f['filters']=_[_0x8ac8('0x32')](_0x1ad51f[_0x8ac8('0x33')],_0x1ad51f[_0x8ac8('0x30')]);_0x2b5e39['attributes']=_['intersection'](_0x1ad51f[_0x8ac8('0x33')],qs['fields'](_0x18023a[_0x8ac8('0x30')][_0x8ac8('0x34')]));_0x2b5e39[_0x8ac8('0x35')]=_0x2b5e39['attributes'][_0x8ac8('0x36')]?_0x2b5e39[_0x8ac8('0x35')]:_0x1ad51f[_0x8ac8('0x33')];if(!_0x18023a[_0x8ac8('0x30')][_0x8ac8('0x37')](_0x8ac8('0x38'))){_0x2b5e39[_0x8ac8('0x1e')]=qs['limit'](_0x18023a[_0x8ac8('0x30')][_0x8ac8('0x1e')]);_0x2b5e39[_0x8ac8('0x1c')]=qs[_0x8ac8('0x1c')](_0x18023a[_0x8ac8('0x30')][_0x8ac8('0x1c')]);}_0x2b5e39['order']=qs['sort'](_0x18023a[_0x8ac8('0x30')][_0x8ac8('0x39')]);_0x2b5e39[_0x8ac8('0x3a')]=qs[_0x8ac8('0x3b')](_[_0x8ac8('0x3c')](_0x18023a[_0x8ac8('0x30')],_0x1ad51f['filters']),_0x45ffd5);if(_0x18023a['query'][_0x8ac8('0x3d')]){_0x2b5e39[_0x8ac8('0x3a')]=_[_0x8ac8('0x3e')](_0x2b5e39['where'],{'$or':_['map'](_0x45ffd5,function(_0x28ba21){if(_0x28ba21[_0x8ac8('0x2e')]!=='VIRTUAL'){var _0x592621={};_0x592621[_0x28ba21[_0x8ac8('0x2a')]]={'$like':'%'+_0x18023a[_0x8ac8('0x30')][_0x8ac8('0x3d')]+'%'};return _0x592621;}})});}_0x2b5e39=_['merge']({},_0x2b5e39,_0x18023a[_0x8ac8('0x3f')]);var _0x5de9ac={'where':_0x2b5e39[_0x8ac8('0x3a')]};return db[_0x8ac8('0x2c')][_0x8ac8('0x1f')](_0x5de9ac)[_0x8ac8('0x26')](function(_0x1a1387){_0x1d3e8f[_0x8ac8('0x1f')]=_0x1a1387;if(_0x18023a['query']['includeAll']){_0x2b5e39[_0x8ac8('0x40')]=[{'all':!![]}];}return db['Variable'][_0x8ac8('0x41')](_0x2b5e39);})['then'](function(_0x26f614){_0x1d3e8f[_0x8ac8('0x42')]=_0x26f614;return _0x1d3e8f;})[_0x8ac8('0x26')](respondWithFilteredResult(_0x294a1e,_0x2b5e39))['catch'](handleError(_0x294a1e,null));};exports[_0x8ac8('0x43')]=function(_0x3cb3cd,_0x111cf6){var _0x30226d={'raw':!![],'where':{'id':_0x3cb3cd['params']['id']}},_0x166a89={};_0x166a89[_0x8ac8('0x33')]=_[_0x8ac8('0x31')](db[_0x8ac8('0x2c')][_0x8ac8('0x2d')]);_0x166a89['query']=_['keys'](_0x3cb3cd[_0x8ac8('0x30')]);_0x166a89[_0x8ac8('0x3b')]=_['intersection'](_0x166a89[_0x8ac8('0x33')],_0x166a89[_0x8ac8('0x30')]);_0x30226d[_0x8ac8('0x35')]=_['intersection'](_0x166a89[_0x8ac8('0x33')],qs[_0x8ac8('0x34')](_0x3cb3cd['query'][_0x8ac8('0x34')]));_0x30226d[_0x8ac8('0x35')]=_0x30226d[_0x8ac8('0x35')][_0x8ac8('0x36')]?_0x30226d[_0x8ac8('0x35')]:_0x166a89[_0x8ac8('0x33')];if(_0x3cb3cd[_0x8ac8('0x30')]['includeAll']){_0x30226d[_0x8ac8('0x40')]=[{'all':!![]}];}_0x30226d=_[_0x8ac8('0x3e')]({},_0x30226d,_0x3cb3cd['options']);return db['Variable'][_0x8ac8('0x44')](_0x30226d)[_0x8ac8('0x26')](handleEntityNotFound(_0x111cf6,null))[_0x8ac8('0x26')](respondWithResult(_0x111cf6,null))[_0x8ac8('0x45')](handleError(_0x111cf6,null));};exports[_0x8ac8('0x46')]=function(_0x1e0749,_0x3dd125){return db[_0x8ac8('0x2c')]['create'](_0x1e0749[_0x8ac8('0x47')],{})[_0x8ac8('0x26')](function(_0x92fa8e){var _0xf35429=_0x1e0749[_0x8ac8('0x48')][_0x8ac8('0x27')]({'plain':!![]});if(!_0xf35429)throw new Error(_0x8ac8('0x49'));if(_0xf35429[_0x8ac8('0x4a')]===_0x8ac8('0x48')){var _0x5f52f0=_0x92fa8e[_0x8ac8('0x27')]({'plain':!![]});var _0x50dc5a=_0x8ac8('0x28');return db['UserProfileSection'][_0x8ac8('0x44')]({'where':{'name':_0x50dc5a,'userProfileId':_0xf35429['userProfileId']},'raw':!![]})['then'](function(_0x4c2bd9){if(_0x4c2bd9&&_0x4c2bd9[_0x8ac8('0x4b')]===0x0){return db[_0x8ac8('0x4c')][_0x8ac8('0x46')]({'name':_0x5f52f0[_0x8ac8('0x2a')],'resourceId':_0x5f52f0['id'],'type':_0x4c2bd9['name'],'sectionId':_0x4c2bd9['id']},{})['then'](function(){return _0x92fa8e;});}else{return _0x92fa8e;}})[_0x8ac8('0x45')](function(_0x612ff2){logger[_0x8ac8('0x29')](_0x8ac8('0x4d'),_0x612ff2);throw _0x612ff2;});}return _0x92fa8e;})['then'](respondWithResult(_0x3dd125,0xc9))[_0x8ac8('0x45')](handleError(_0x3dd125,null));};exports[_0x8ac8('0x24')]=function(_0x3cf824,_0x4ca6c2){if(_0x3cf824[_0x8ac8('0x47')]['id']){delete _0x3cf824[_0x8ac8('0x47')]['id'];}return db[_0x8ac8('0x2c')]['find']({'where':{'id':_0x3cf824[_0x8ac8('0x4e')]['id']}})[_0x8ac8('0x26')](handleEntityNotFound(_0x4ca6c2,null))['then'](saveUpdates(_0x3cf824['body'],null))[_0x8ac8('0x26')](respondWithResult(_0x4ca6c2,null))[_0x8ac8('0x45')](handleError(_0x4ca6c2,null));};exports[_0x8ac8('0x25')]=function(_0xf1855f,_0x39ccfa){return db[_0x8ac8('0x2c')][_0x8ac8('0x44')]({'where':{'id':_0xf1855f[_0x8ac8('0x4e')]['id']}})[_0x8ac8('0x26')](handleEntityNotFound(_0x39ccfa,null))['then'](removeEntity(_0x39ccfa,null))[_0x8ac8('0x45')](handleError(_0x39ccfa,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 77c1ef9..412ba09 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 _0xa06b=['lodash','util','../../config/logger','api','request-promise','rimraf','./variable.attributes','exports','define','Variable'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa06b,0x1a4));var _0xba06=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xa06b[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xba06('0x0'));var util=require(_0xba06('0x1'));var logger=require(_0xba06('0x2'))(_0xba06('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xba06('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xba06('0x5'));var config=require('../../config/environment');var attributes=require(_0xba06('0x6'));module[_0xba06('0x7')]=function(_0x5f0de9,_0x237a98){return _0x5f0de9[_0xba06('0x8')](_0xba06('0x9'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95b2=['rimraf','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x5c48ea,_0x2191a2){var _0x1262dc=function(_0x394829){while(--_0x394829){_0x5c48ea['push'](_0x5c48ea['shift']());}};_0x1262dc(++_0x2191a2);}(_0x95b2,0x13f));var _0x295b=function(_0x15c298,_0x8169d5){_0x15c298=_0x15c298-0x0;var _0x4d1fa4=_0x95b2[_0x15c298];return _0x4d1fa4;};'use strict';var _=require(_0x295b('0x0'));var util=require(_0x295b('0x1'));var logger=require(_0x295b('0x2'))('api');var moment=require(_0x295b('0x3'));var BPromise=require(_0x295b('0x4'));var rp=require(_0x295b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x295b('0x6'));var config=require(_0x295b('0x7'));var attributes=require(_0x295b('0x8'));module[_0x295b('0x9')]=function(_0x34b9ba,_0x7ab333){return _0x34b9ba[_0x295b('0xa')](_0x295b('0xb'),attributes,{'tableName':_0x295b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 7b99a91..061b8f7 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 _0x9957=['stringify','error','code','message','result','catch','ShowVariable','find','raw','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0x3c74c1,_0x375ac5){var _0x6c4d44=function(_0x48b826){while(--_0x48b826){_0x3c74c1['push'](_0x3c74c1['shift']());}};_0x6c4d44(++_0x375ac5);}(_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']('Variable,\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);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Variable'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')]['include'],function(_0x32a09a){return{'model':db[_0x32a09a[_0x7995('0x20')]],'as':_0x32a09a['as'],'attributes':_0x32a09a[_0x7995('0x1d')],'include':_0x32a09a[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x32a09a[_0x7995('0x1e')],function(_0x475351){return{'model':db[_0x475351[_0x7995('0x20')]],'as':_0x475351['as'],'attributes':_0x475351['attributes'],'include':_0x475351[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x475351[_0x7995('0x1e')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x20')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47625f){logger['info'](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x47625f));_0x37a7d4(_0x47625f);})[_0x7995('0x17')](function(_0x4b6f99){logger[_0x7995('0x13')]('ShowVariable',_0x4b6f99[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x4b6f99[_0x7995('0x15')]));});});}; \ No newline at end of file +var _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','Variable,\x20%s,\x20%s','result','catch','ShowVariable','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x2c4949,_0x2476d2){var _0x5e9161=function(_0x436268){while(--_0x436268){_0x2c4949['push'](_0x2c4949['shift']());}};_0x5e9161(++_0x2476d2);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4de1b1,_0x18c64c){_0x4de1b1=_0x4de1b1-0x0;var _0x639f27=_0x5fc3[_0x4de1b1];return _0x639f27;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Variable,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Variable,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Variable,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['Variable'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 4fafa5b..186fc2a 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 _0xfc85=['index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','/restart','restart','migrations','exports','express','Router','./version.controller','get'];(function(_0x560481,_0x355f78){var _0x208896=function(_0x3e1ba1){while(--_0x3e1ba1){_0x560481['push'](_0x560481['shift']());}};_0x208896(++_0x355f78);}(_0xfc85,0x95));var _0x5fc8=function(_0x45d8eb,_0x37959c){_0x45d8eb=_0x45d8eb-0x0;var _0xb86014=_0xfc85[_0x45d8eb];return _0xb86014;};'use strict';var express=require(_0x5fc8('0x0'));var router=express[_0x5fc8('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x5fc8('0x2'));router[_0x5fc8('0x3')]('/',controller[_0x5fc8('0x4')]);router[_0x5fc8('0x3')](_0x5fc8('0x5'),auth[_0x5fc8('0x6')](),auth[_0x5fc8('0x7')](),controller[_0x5fc8('0x8')]);router[_0x5fc8('0x3')](_0x5fc8('0x9'),auth['isAuthenticated'](),auth[_0x5fc8('0x7')](),controller[_0x5fc8('0xa')]);router[_0x5fc8('0x3')](_0x5fc8('0xb'),auth[_0x5fc8('0x6')](),auth[_0x5fc8('0x7')](),controller[_0x5fc8('0xc')]);router[_0x5fc8('0x3')](_0x5fc8('0xd'),auth['isAuthenticated'](),controller[_0x5fc8('0xe')]);router[_0x5fc8('0x3')]('/migrations',controller[_0x5fc8('0xf')]);module[_0x5fc8('0x10')]=router; \ No newline at end of file +var _0xf254=['express','Router','../../components/auth/service','get','index','/fetch','isAuthenticated','canUpdate','/reset','reset','/pull','/restart','restart','/migrations','migrations','exports'];(function(_0x57f8c0,_0x136cf6){var _0x117f08=function(_0x426cd4){while(--_0x426cd4){_0x57f8c0['push'](_0x57f8c0['shift']());}};_0x117f08(++_0x136cf6);}(_0xf254,0xe0));var _0x4f25=function(_0x3f1a8a,_0x5e6b68){_0x3f1a8a=_0x3f1a8a-0x0;var _0x3e34da=_0xf254[_0x3f1a8a];return _0x3e34da;};'use strict';var express=require(_0x4f25('0x0'));var router=express[_0x4f25('0x1')]();var auth=require(_0x4f25('0x2'));var controller=require('./version.controller');router[_0x4f25('0x3')]('/',controller[_0x4f25('0x4')]);router['get'](_0x4f25('0x5'),auth[_0x4f25('0x6')](),auth[_0x4f25('0x7')](),controller['fetch']);router['get'](_0x4f25('0x8'),auth[_0x4f25('0x6')](),auth['canUpdate'](),controller[_0x4f25('0x9')]);router[_0x4f25('0x3')](_0x4f25('0xa'),auth['isAuthenticated'](),auth[_0x4f25('0x7')](),controller['pull']);router[_0x4f25('0x3')](_0x4f25('0xb'),auth['isAuthenticated'](),controller[_0x4f25('0xc')]);router[_0x4f25('0x3')](_0x4f25('0xd'),controller[_0x4f25('0xe')]);module[_0x4f25('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 807488c..e44c8d4 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 _0xcd45=['pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','join','server','replace','.js','push','length','sort','sequelize','Migration','getQueryInterface','constructor','map','Database\x20migrated\x20successfully\x20from\x20version\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','latest','fetch','2.0.0','status','json','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard'];(function(_0x203766,_0x3c6972){var _0x1548d7=function(_0x192f2d){while(--_0x192f2d){_0x203766['push'](_0x203766['shift']());}};_0x1548d7(++_0x3c6972);}(_0xcd45,0x1a0));var _0x5cd4=function(_0x1055dc,_0x204903){_0x1055dc=_0x1055dc-0x0;var _0x3c50c1=_0xcd45[_0x1055dc];return _0x3c50c1;};'use strict';var Umzug=require(_0x5cd4('0x0'));var path=require(_0x5cd4('0x1'));var fs=require('fs');var _=require(_0x5cd4('0x2'));var pkginfo=require(_0x5cd4('0x3'))(module,_0x5cd4('0x4'));var compareVersions=require(_0x5cd4('0x5'));var exec=require(_0x5cd4('0x6'))[_0x5cd4('0x7')];var db=require(_0x5cd4('0x8'))['db'];var config=require(_0x5cd4('0x9'));var pm2=require(_0x5cd4('0xa'));var logger=require(_0x5cd4('0xb'))(_0x5cd4('0xc'));var git=require(_0x5cd4('0xd'))(config[_0x5cd4('0xe')]);exports[_0x5cd4('0xf')]=function(_0x9a905,_0x3bcbba){var _0x59f697={'current':module[_0x5cd4('0x10')][_0x5cd4('0x4')],'phonebar':0x2};if(_0x9a905[_0x5cd4('0x11')]&&_0x9a905[_0x5cd4('0x11')][_0x5cd4('0x12')]){return git[_0x5cd4('0x13')]()['tags'](function(_0x2169ec,_0x484423){_0x59f697[_0x5cd4('0x12')]=(_0x2169ec?module['exports'][_0x5cd4('0x4')]:_0x484423[_0x5cd4('0x12')])||_0x5cd4('0x14');return _0x3bcbba[_0x5cd4('0x15')](0xc8)[_0x5cd4('0x16')](_0x59f697);});}else{return _0x3bcbba[_0x5cd4('0x15')](0xc8)[_0x5cd4('0x16')](_0x59f697);}};exports[_0x5cd4('0x13')]=function(_0x20ca83,_0x2d9cfe){return git[_0x5cd4('0x13')](['origin',_0x5cd4('0x17')],function(_0x23b55a){if(_0x23b55a){logger[_0x5cd4('0x18')](_0x23b55a);return _0x2d9cfe[_0x5cd4('0x15')](0x1f4)[_0x5cd4('0x16')](_0x23b55a);}logger[_0x5cd4('0x19')](_0x5cd4('0x1a'));return _0x2d9cfe[_0x5cd4('0x15')](0xc8)['json']({'output':_0x5cd4('0x1b')});});};exports[_0x5cd4('0x1c')]=function(_0x3af3d4,_0x38c3d6){return git[_0x5cd4('0x1c')](['--hard',_0x5cd4('0x1d')],function(_0x10ffe8){if(_0x10ffe8){logger['error'](_0x10ffe8);return _0x38c3d6[_0x5cd4('0x15')](0x1f4)[_0x5cd4('0x16')](_0x10ffe8);}logger[_0x5cd4('0x19')](_0x5cd4('0x1e'));return _0x38c3d6[_0x5cd4('0x15')](0xc8)[_0x5cd4('0x16')]({'output':_0x5cd4('0x1f')});});};exports[_0x5cd4('0x20')]=function(_0x2eb51e,_0xa70d25){exec('npm\x20install\x20--production',function(_0x5c9208,_0x1ae517,_0x59e60b){logger[_0x5cd4('0x19')](_0x1ae517);logger[_0x5cd4('0x19')](_0x59e60b);if(_0x5c9208){logger[_0x5cd4('0x18')](_0x5c9208);return _0xa70d25[_0x5cd4('0x15')](0x1f4)[_0x5cd4('0x16')](_0x5c9208);}return _0xa70d25[_0x5cd4('0x15')](0xc8)[_0x5cd4('0x16')]({'output':_0x1ae517});});};exports[_0x5cd4('0x21')]=function(_0x3fbac5,_0x4982d1){return pm2[_0x5cd4('0x21')](_0x5cd4('0x22'))[_0x5cd4('0x23')](function(_0x1869c5){logger[_0x5cd4('0x19')](_0x5cd4('0x24'),_0x1869c5);return _0x4982d1[_0x5cd4('0x15')](0xc8)[_0x5cd4('0x16')]({'output':_0x5cd4('0x25')});})[_0x5cd4('0x26')](function(_0x1d4bd9){logger['error'](_0x1d4bd9);return _0x4982d1[_0x5cd4('0x15')](0x1f4)['json'](_0x1d4bd9);});};exports[_0x5cd4('0x27')]=function(_0x14a83b,_0xeddd15){var _0x2ae974=fs['readdirSync'](path[_0x5cd4('0x28')](config[_0x5cd4('0xe')],_0x5cd4('0x29'),'migrations'));var _0x440d3=[];for(var _0x284a10=0x0;_0x284a10<_0x2ae974['length'];_0x284a10++){var _0x2f7a1b=_0x2ae974[_0x284a10][_0x5cd4('0x2a')](_0x5cd4('0x2b'),'');if(compareVersions(module['exports']['version'],_0x2f7a1b)===-0x1){_0x440d3[_0x5cd4('0x2c')](_0x2f7a1b);}}if(_0x440d3[_0x5cd4('0x2d')]){var _0x114030=_0x440d3[_0x5cd4('0x2e')](compareVersions);var _0x996c7a=new Umzug({'storage':_0x5cd4('0x2f'),'storageOptions':{'model':db[_0x5cd4('0x30')],'modelName':_0x5cd4('0x30'),'columnName':_0x5cd4('0x4')},'migrations':{'params':[db['sequelize'][_0x5cd4('0x31')](),db['sequelize'][_0x5cd4('0x32')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0x5cd4('0x28')](config[_0x5cd4('0xe')],'server','migrations'),'pattern':/\.js$/}});_0x996c7a['up']({'migrations':_[_0x5cd4('0x33')](_0x114030,function(_0x3657a6){return _0x3657a6+_0x5cd4('0x2b');})})['then'](function(){return _0xeddd15[_0x5cd4('0x15')](0xc8)['json']({'output':_0x5cd4('0x34')+module['exports'][_0x5cd4('0x4')]+'\x20to\x20'+_[_0x5cd4('0x35')](_0x114030),'migrations':_['join'](_0x114030)});})[_0x5cd4('0x26')](function(_0x5a39e9){if(_0x5a39e9 instanceof db['sequelize'][_0x5cd4('0x36')]){return _0xeddd15[_0x5cd4('0x15')](0xc8)[_0x5cd4('0x16')]({'output':_0x5cd4('0x37')});}else{return _0xeddd15['status'](0x1f4)[_0x5cd4('0x16')](_0x5a39e9);}});}else{return _0xeddd15[_0x5cd4('0x15')](0xc8)[_0x5cd4('0x16')]({'output':_0x5cd4('0x37')});}}; \ No newline at end of file +var _0x5967=['reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','server','.js','push','sort','Migration','sequelize','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','latest','2.0.0','json','status','fetch','origin','master','error','info','git\x20fetch\x20origin\x20master'];(function(_0x5a622f,_0x215986){var _0x2cb85e=function(_0x1dc3a3){while(--_0x1dc3a3){_0x5a622f['push'](_0x5a622f['shift']());}};_0x2cb85e(++_0x215986);}(_0x5967,0x85));var _0x7596=function(_0x575050,_0x18afa1){_0x575050=_0x575050-0x0;var _0x4f5857=_0x5967[_0x575050];return _0x4f5857;};'use strict';var Umzug=require(_0x7596('0x0'));var path=require(_0x7596('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x7596('0x2'))(module,_0x7596('0x3'));var compareVersions=require(_0x7596('0x4'));var exec=require(_0x7596('0x5'))['exec'];var db=require(_0x7596('0x6'))['db'];var config=require(_0x7596('0x7'));var pm2=require(_0x7596('0x8'));var logger=require(_0x7596('0x9'))(_0x7596('0xa'));var git=require(_0x7596('0xb'))(config[_0x7596('0xc')]);exports[_0x7596('0xd')]=function(_0x4abe54,_0x3eee7a){var _0x1c6976={'current':module[_0x7596('0xe')][_0x7596('0x3')],'phonebar':0x2};if(_0x4abe54[_0x7596('0xf')]&&_0x4abe54[_0x7596('0xf')][_0x7596('0x10')]){return git['fetch']()['tags'](function(_0x37de9e,_0x1e7f18){_0x1c6976[_0x7596('0x10')]=(_0x37de9e?module[_0x7596('0xe')][_0x7596('0x3')]:_0x1e7f18[_0x7596('0x10')])||_0x7596('0x11');return _0x3eee7a['status'](0xc8)[_0x7596('0x12')](_0x1c6976);});}else{return _0x3eee7a[_0x7596('0x13')](0xc8)[_0x7596('0x12')](_0x1c6976);}};exports['fetch']=function(_0x3acbe3,_0x3c01b8){return git[_0x7596('0x14')]([_0x7596('0x15'),_0x7596('0x16')],function(_0x505d72){if(_0x505d72){logger[_0x7596('0x17')](_0x505d72);return _0x3c01b8['status'](0x1f4)[_0x7596('0x12')](_0x505d72);}logger[_0x7596('0x18')]('git\x20fetch');return _0x3c01b8[_0x7596('0x13')](0xc8)[_0x7596('0x12')]({'output':_0x7596('0x19')});});};exports['reset']=function(_0x1b8a38,_0x1c4096){return git[_0x7596('0x1a')]([_0x7596('0x1b'),_0x7596('0x1c')],function(_0x2a544d){if(_0x2a544d){logger[_0x7596('0x17')](_0x2a544d);return _0x1c4096['status'](0x1f4)[_0x7596('0x12')](_0x2a544d);}logger['info'](_0x7596('0x1d'));return _0x1c4096[_0x7596('0x13')](0xc8)[_0x7596('0x12')]({'output':_0x7596('0x1e')});});};exports['pull']=function(_0x34030c,_0x103fba){exec(_0x7596('0x1f'),function(_0x53d794,_0x29d4c7,_0x4f299c){logger[_0x7596('0x18')](_0x29d4c7);logger[_0x7596('0x18')](_0x4f299c);if(_0x53d794){logger['error'](_0x53d794);return _0x103fba['status'](0x1f4)['json'](_0x53d794);}return _0x103fba[_0x7596('0x13')](0xc8)[_0x7596('0x12')]({'output':_0x29d4c7});});};exports[_0x7596('0x20')]=function(_0x54c684,_0x32387c){return pm2[_0x7596('0x20')](_0x7596('0x21'))[_0x7596('0x22')](function(_0x4d7015){logger[_0x7596('0x18')]('pm2\x20restart\x20motion\x20%s',_0x4d7015);return _0x32387c[_0x7596('0x13')](0xc8)['json']({'output':_0x7596('0x23')});})[_0x7596('0x24')](function(_0x2d476f){logger[_0x7596('0x17')](_0x2d476f);return _0x32387c[_0x7596('0x13')](0x1f4)[_0x7596('0x12')](_0x2d476f);});};exports[_0x7596('0x25')]=function(_0x23c582,_0xe4a0ea){var _0x566fe0=fs['readdirSync'](path['join'](config[_0x7596('0xc')],_0x7596('0x26'),_0x7596('0x25')));var _0x5bd730=[];for(var _0x5215d1=0x0;_0x5215d1<_0x566fe0['length'];_0x5215d1++){var _0x436f44=_0x566fe0[_0x5215d1]['replace'](_0x7596('0x27'),'');if(compareVersions(module[_0x7596('0xe')][_0x7596('0x3')],_0x436f44)===-0x1){_0x5bd730[_0x7596('0x28')](_0x436f44);}}if(_0x5bd730['length']){var _0xb9bb34=_0x5bd730[_0x7596('0x29')](compareVersions);var _0x26d6b5=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':_0x7596('0x2a'),'columnName':_0x7596('0x3')},'migrations':{'params':[db[_0x7596('0x2b')][_0x7596('0x2c')](),db[_0x7596('0x2b')][_0x7596('0x2d')],function(){throw new Error(_0x7596('0x2e'));}],'path':path[_0x7596('0x2f')](config[_0x7596('0xc')],_0x7596('0x26'),'migrations'),'pattern':/\.js$/}});_0x26d6b5['up']({'migrations':_['map'](_0xb9bb34,function(_0x92e6c1){return _0x92e6c1+_0x7596('0x27');})})[_0x7596('0x22')](function(){return _0xe4a0ea[_0x7596('0x13')](0xc8)[_0x7596('0x12')]({'output':_0x7596('0x30')+module[_0x7596('0xe')]['version']+_0x7596('0x31')+_[_0x7596('0x32')](_0xb9bb34),'migrations':_[_0x7596('0x2f')](_0xb9bb34)});})[_0x7596('0x24')](function(_0xd54238){if(_0xd54238 instanceof db['sequelize'][_0x7596('0x33')]){return _0xe4a0ea['status'](0xc8)[_0x7596('0x12')]({'output':_0x7596('0x34')});}else{return _0xe4a0ea[_0x7596('0x13')](0x1f4)[_0x7596('0x12')](_0xd54238);}});}else{return _0xe4a0ea[_0x7596('0x13')](0xc8)['json']({'output':_0x7596('0x34')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index f9d6138..447fcb3 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 _0x6cf9=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update'];(function(_0x5516c7,_0x3d46e4){var _0x314076=function(_0x3e3b38){while(--_0x3e3b38){_0x5516c7['push'](_0x5516c7['shift']());}};_0x314076(++_0x3d46e4);}(_0x6cf9,0xde));var _0x96cf=function(_0xe4bb3d,_0x21e87e){_0xe4bb3d=_0xe4bb3d-0x0;var _0xd9e51=_0x6cf9[_0xe4bb3d];return _0xd9e51;};'use strict';var multer=require(_0x96cf('0x0'));var util=require('util');var path=require(_0x96cf('0x1'));var timeout=require(_0x96cf('0x2'));var express=require(_0x96cf('0x3'));var router=express[_0x96cf('0x4')]();var fs_extra=require(_0x96cf('0x5'));var auth=require(_0x96cf('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceAgentReport.controller');router[_0x96cf('0x7')]('/',auth[_0x96cf('0x8')](),controller[_0x96cf('0x9')]);router[_0x96cf('0x7')](_0x96cf('0xa'),auth[_0x96cf('0x8')](),controller[_0x96cf('0xb')]);router[_0x96cf('0x7')](_0x96cf('0xc'),auth['isAuthenticated'](),controller[_0x96cf('0xd')]);router[_0x96cf('0xe')]('/',auth[_0x96cf('0x8')](),controller[_0x96cf('0xf')]);router[_0x96cf('0x10')]('/:id',auth[_0x96cf('0x8')](),controller[_0x96cf('0x11')]);router['delete'](_0x96cf('0xc'),auth['isAuthenticated'](),controller[_0x96cf('0x12')]);module[_0x96cf('0x13')]=router; \ No newline at end of file +var _0x746b=['get','isAuthenticated','index','/describe','/:id','create','put','update','destroy','util','Router','fs-extra','../../components/auth/service','./voiceAgentReport.controller'];(function(_0x15eaf0,_0x3fd5bc){var _0x19caeb=function(_0x2888ae){while(--_0x2888ae){_0x15eaf0['push'](_0x15eaf0['shift']());}};_0x19caeb(++_0x3fd5bc);}(_0x746b,0x1ad));var _0xb746=function(_0x2637a3,_0x24b0e5){_0x2637a3=_0x2637a3-0x0;var _0x263b62=_0x746b[_0x2637a3];return _0x263b62;};'use strict';var multer=require('multer');var util=require(_0xb746('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb746('0x1')]();var fs_extra=require(_0xb746('0x2'));var auth=require(_0xb746('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb746('0x4'));router[_0xb746('0x5')]('/',auth[_0xb746('0x6')](),controller[_0xb746('0x7')]);router[_0xb746('0x5')](_0xb746('0x8'),auth[_0xb746('0x6')](),controller['describe']);router['get'](_0xb746('0x9'),auth[_0xb746('0x6')](),controller['show']);router['post']('/',auth[_0xb746('0x6')](),controller[_0xb746('0xa')]);router[_0xb746('0xb')](_0xb746('0x9'),auth[_0xb746('0x6')](),controller[_0xb746('0xc')]);router['delete'](_0xb746('0x9'),auth[_0xb746('0x6')](),controller[_0xb746('0xd')]);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 85fb334..e7030a8 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 _0xefe2=['BOOLEAN','sequelize','exports','STRING','DATE','INTEGER'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xefe2,0xd9));var _0x2efe=function(_0x32d087,_0x2d46bb){_0x32d087=_0x32d087-0x0;var _0x43fd15=_0xefe2[_0x32d087];return _0x43fd15;};'use strict';var Sequelize=require(_0x2efe('0x0'));module[_0x2efe('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x2efe('0x2')]},'calleridnum':{'type':Sequelize[_0x2efe('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x2efe('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x2efe('0x2')]},'agentcalledAt':{'type':Sequelize[_0x2efe('0x3')]},'agentconnectAt':{'type':Sequelize[_0x2efe('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x2efe('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x2efe('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x2efe('0x4')]},'agentcomplete':{'type':Sequelize[_0x2efe('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x2efe('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x2efe('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x2efe('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x2efe('0x4')]},'reason':{'type':Sequelize[_0x2efe('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x2efe('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x2efe('0x2')]},'language':{'type':Sequelize[_0x2efe('0x2')]},'accountcode':{'type':Sequelize[_0x2efe('0x2')]},'context':{'type':Sequelize[_0x2efe('0x2')]},'exten':{'type':Sequelize[_0x2efe('0x2')]},'priority':{'type':Sequelize[_0x2efe('0x2')]},'destchannel':{'type':Sequelize[_0x2efe('0x2')]},'destchannelstate':{'type':Sequelize[_0x2efe('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x2efe('0x2')]},'destcalleridnum':{'type':Sequelize[_0x2efe('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x2efe('0x2')]},'destlanguage':{'type':Sequelize[_0x2efe('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x2efe('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x2efe('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x2efe('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x2efe('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x2efe('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x2efe('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xb78e=['BOOLEAN','sequelize','exports','STRING','DATE','INTEGER'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb78e,0x1c9));var _0xeb78=function(_0x13df5e,_0x2a1b37){_0x13df5e=_0x13df5e-0x0;var _0x4067b4=_0xb78e[_0x13df5e];return _0x4067b4;};'use strict';var Sequelize=require(_0xeb78('0x0'));module[_0xeb78('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xeb78('0x2')]},'calleridnum':{'type':Sequelize[_0xeb78('0x2')]},'calleridname':{'type':Sequelize[_0xeb78('0x2')]},'queue':{'type':Sequelize[_0xeb78('0x2')]},'interface':{'type':Sequelize[_0xeb78('0x2')]},'membername':{'type':Sequelize[_0xeb78('0x2')]},'agentcalledAt':{'type':Sequelize[_0xeb78('0x3')]},'agentconnectAt':{'type':Sequelize[_0xeb78('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xeb78('0x3')]},'agentdumpAt':{'type':Sequelize[_0xeb78('0x3')]},'holdtime':{'type':Sequelize[_0xeb78('0x4')]},'agentcomplete':{'type':Sequelize[_0xeb78('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xeb78('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xeb78('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xeb78('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xeb78('0x4')]},'reason':{'type':Sequelize[_0xeb78('0x2')]},'lastevent':{'type':Sequelize[_0xeb78('0x2')]},'channel':{'type':Sequelize[_0xeb78('0x2')]},'channelstate':{'type':Sequelize[_0xeb78('0x4')]},'channelstatedesc':{'type':Sequelize[_0xeb78('0x2')]},'connectedlinenum':{'type':Sequelize[_0xeb78('0x2')]},'connectedlinename':{'type':Sequelize[_0xeb78('0x2')]},'language':{'type':Sequelize[_0xeb78('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xeb78('0x2')]},'exten':{'type':Sequelize[_0xeb78('0x2')]},'priority':{'type':Sequelize[_0xeb78('0x2')]},'destchannel':{'type':Sequelize[_0xeb78('0x2')]},'destchannelstate':{'type':Sequelize[_0xeb78('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xeb78('0x2')]},'destcalleridnum':{'type':Sequelize[_0xeb78('0x2')]},'destcalleridname':{'type':Sequelize[_0xeb78('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xeb78('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xeb78('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xeb78('0x2')]},'destcontext':{'type':Sequelize[_0xeb78('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xeb78('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xeb78('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xeb78('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xeb78('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xeb78('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 3479ab8..26444fb 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(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file +var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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 48ee68a..876f68b 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 _0x24ca=['request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','destuniqueid','lodash','../../config/logger','api','moment'];(function(_0x2b5ee5,_0x3741bf){var _0x1c480b=function(_0x437a18){while(--_0x437a18){_0x2b5ee5['push'](_0x2b5ee5['shift']());}};_0x1c480b(++_0x3741bf);}(_0x24ca,0x1bc));var _0xa24c=function(_0x2de020,_0x252df0){_0x2de020=_0x2de020-0x0;var _0x182b7c=_0x24ca[_0x2de020];return _0x182b7c;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var logger=require(_0xa24c('0x1'))(_0xa24c('0x2'));var moment=require(_0xa24c('0x3'));var BPromise=require('bluebird');var rp=require(_0xa24c('0x4'));var fs=require('fs');var path=require(_0xa24c('0x5'));var rimraf=require(_0xa24c('0x6'));var config=require(_0xa24c('0x7'));var attributes=require(_0xa24c('0x8'));module[_0xa24c('0x9')]=function(_0xf0511,_0x3c0aaa){return _0xf0511[_0xa24c('0xa')](_0xa24c('0xb'),attributes,{'tableName':_0xa24c('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0xa24c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x13a0d6,_0x9a1972){var _0x241df1=function(_0x44fd40){while(--_0x44fd40){_0x13a0d6['push'](_0x13a0d6['shift']());}};_0x241df1(++_0x9a1972);}(_0x7217,0x19e));var _0x7721=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x7217[_0x2b10c6];return _0x3789d2;};'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':[{'fields':[_0x7721('0xc'),_0x7721('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index f9edcb2..c009ed4 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 _0xa424=['VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateVoiceAgentReport','VoiceAgentReport','body','then','debug','UpdateVoiceAgentReport','options','raw','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x4b6eb8,_0x35e7e5){var _0x2f1bb4=function(_0x47ff87){while(--_0x47ff87){_0x4b6eb8['push'](_0x4b6eb8['shift']());}};_0x2f1bb4(++_0x35e7e5);}(_0xa424,0xd4));var _0x4a42=function(_0xc500dd,_0x4806cd){_0xc500dd=_0xc500dd-0x0;var _0x50956e=_0xa424[_0xc500dd];return _0x50956e;};'use strict';var _=require(_0x4a42('0x0'));var util=require(_0x4a42('0x1'));var moment=require(_0x4a42('0x2'));var BPromise=require(_0x4a42('0x3'));var rs=require(_0x4a42('0x4'));var fs=require('fs');var Redis=require(_0x4a42('0x5'));var db=require(_0x4a42('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4a42('0x7'))(_0x4a42('0x8'));var config=require('../../config/environment');var jayson=require(_0x4a42('0x9'));var client=jayson[_0x4a42('0xa')][_0x4a42('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ddcaf,_0x52ac8c,_0x13f4cc){return new BPromise(function(_0x254166,_0x5f328b){return client['request'](_0x5ddcaf,_0x13f4cc)['then'](function(_0x3c5f5f){logger['info'](_0x4a42('0xc'),_0x52ac8c,_0x4a42('0xd'));logger['debug'](_0x4a42('0xe'),_0x52ac8c,_0x4a42('0xd'),JSON[_0x4a42('0xf')](_0x3c5f5f));if(_0x3c5f5f[_0x4a42('0x10')]){if(_0x3c5f5f[_0x4a42('0x10')][_0x4a42('0x11')]===0x1f4){logger[_0x4a42('0x10')](_0x4a42('0xc'),_0x52ac8c,_0x3c5f5f['error'][_0x4a42('0x12')]);return _0x5f328b(_0x3c5f5f['error'][_0x4a42('0x12')]);}logger[_0x4a42('0x10')](_0x4a42('0xc'),_0x52ac8c,_0x3c5f5f[_0x4a42('0x10')][_0x4a42('0x12')]);return _0x254166(_0x3c5f5f[_0x4a42('0x10')][_0x4a42('0x12')]);}else{logger[_0x4a42('0x13')](_0x4a42('0xc'),_0x52ac8c,'request\x20sent');_0x254166(_0x3c5f5f[_0x4a42('0x14')][_0x4a42('0x12')]);}})[_0x4a42('0x15')](function(_0x277841){logger[_0x4a42('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x52ac8c,_0x277841);_0x5f328b(_0x277841);});});}exports[_0x4a42('0x16')]=function(_0x59b60c){var _0xc8ba59=this;return new Promise(function(_0x2622af,_0x23476e){return db[_0x4a42('0x17')]['create'](_0x59b60c[_0x4a42('0x18')],{'raw':_0x59b60c['options']?_0x59b60c['options']['raw']===undefined?!![]:![]:!![]})[_0x4a42('0x19')](function(_0x128fbc){logger[_0x4a42('0x13')]('CreateVoiceAgentReport',_0x59b60c);logger[_0x4a42('0x1a')](_0x4a42('0x16'),_0x59b60c,JSON[_0x4a42('0xf')](_0x128fbc));_0x2622af(_0x128fbc);})[_0x4a42('0x15')](function(_0x59226b){logger[_0x4a42('0x10')]('CreateVoiceAgentReport',_0x59226b[_0x4a42('0x12')],_0x59b60c);_0x23476e(_0xc8ba59[_0x4a42('0x10')](0x1f4,_0x59226b[_0x4a42('0x12')]));});});};exports[_0x4a42('0x1b')]=function(_0x1f7abe){var _0x1fc9d5=this;return new Promise(function(_0x496292,_0x5145c2){return db[_0x4a42('0x17')]['update'](_0x1f7abe['body'],{'raw':_0x1f7abe['options']?_0x1f7abe[_0x4a42('0x1c')][_0x4a42('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f7abe[_0x4a42('0x1c')]?_0x1f7abe['options'][_0x4a42('0x1e')]||null:null,'attributes':_0x1f7abe['options']?_0x1f7abe[_0x4a42('0x1c')][_0x4a42('0x1f')]||null:null,'limit':_0x1f7abe['options']?_0x1f7abe[_0x4a42('0x1c')]['limit']||null:null})[_0x4a42('0x19')](function(_0x3ef774){logger[_0x4a42('0x13')](_0x4a42('0x1b'),_0x1f7abe);logger['debug'](_0x4a42('0x1b'),_0x1f7abe,JSON['stringify'](_0x3ef774));_0x496292(_0x3ef774);})['catch'](function(_0x4bd613){logger[_0x4a42('0x10')](_0x4a42('0x1b'),_0x4bd613['message'],_0x1f7abe);_0x5145c2(_0x1fc9d5[_0x4a42('0x10')](0x1f4,_0x4bd613[_0x4a42('0x12')]));});});}; \ No newline at end of file +var _0xba26=['raw','debug','catch','UpdateVoiceAgentReport','update','where','attributes','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','request\x20sent','stringify','error','VoiceAgentReport,\x20%s,\x20%s','message','info','result','CreateVoiceAgentReport','VoiceAgentReport','create','body','options'];(function(_0x590d15,_0x26d156){var _0x16377e=function(_0x281738){while(--_0x281738){_0x590d15['push'](_0x590d15['shift']());}};_0x16377e(++_0x26d156);}(_0xba26,0x1e7));var _0x6ba2=function(_0x26b4f3,_0x5473bd){_0x26b4f3=_0x26b4f3-0x0;var _0xf1d39=_0xba26[_0x26b4f3];return _0xf1d39;};'use strict';var _=require(_0x6ba2('0x0'));var util=require('util');var moment=require(_0x6ba2('0x1'));var BPromise=require('bluebird');var rs=require(_0x6ba2('0x2'));var fs=require('fs');var Redis=require(_0x6ba2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ba2('0x4'));var logger=require(_0x6ba2('0x5'))('rpc');var config=require(_0x6ba2('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6ba2('0x7')][_0x6ba2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x528fb3,_0x2ac087,_0x5d55d2){return new BPromise(function(_0x2f3142,_0xcb333b){return client[_0x6ba2('0x9')](_0x528fb3,_0x5d55d2)[_0x6ba2('0xa')](function(_0x3aa05f){logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x2ac087,_0x6ba2('0xb'));logger['debug']('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x2ac087,_0x6ba2('0xb'),JSON[_0x6ba2('0xc')](_0x3aa05f));if(_0x3aa05f[_0x6ba2('0xd')]){if(_0x3aa05f['error']['code']===0x1f4){logger[_0x6ba2('0xd')](_0x6ba2('0xe'),_0x2ac087,_0x3aa05f[_0x6ba2('0xd')][_0x6ba2('0xf')]);return _0xcb333b(_0x3aa05f[_0x6ba2('0xd')]['message']);}logger[_0x6ba2('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x2ac087,_0x3aa05f[_0x6ba2('0xd')]['message']);return _0x2f3142(_0x3aa05f['error'][_0x6ba2('0xf')]);}else{logger[_0x6ba2('0x10')](_0x6ba2('0xe'),_0x2ac087,'request\x20sent');_0x2f3142(_0x3aa05f[_0x6ba2('0x11')][_0x6ba2('0xf')]);}})['catch'](function(_0x3c0a80){logger[_0x6ba2('0xd')](_0x6ba2('0xe'),_0x2ac087,_0x3c0a80);_0xcb333b(_0x3c0a80);});});}exports[_0x6ba2('0x12')]=function(_0x57ad95){var _0x599363=this;return new Promise(function(_0x4e607a,_0x47470f){return db[_0x6ba2('0x13')][_0x6ba2('0x14')](_0x57ad95[_0x6ba2('0x15')],{'raw':_0x57ad95['options']?_0x57ad95[_0x6ba2('0x16')][_0x6ba2('0x17')]===undefined?!![]:![]:!![]})[_0x6ba2('0xa')](function(_0x10afdb){logger[_0x6ba2('0x10')](_0x6ba2('0x12'),_0x57ad95);logger[_0x6ba2('0x18')]('CreateVoiceAgentReport',_0x57ad95,JSON['stringify'](_0x10afdb));_0x4e607a(_0x10afdb);})[_0x6ba2('0x19')](function(_0xd75003){logger['error'](_0x6ba2('0x12'),_0xd75003[_0x6ba2('0xf')],_0x57ad95);_0x47470f(_0x599363['error'](0x1f4,_0xd75003['message']));});});};exports[_0x6ba2('0x1a')]=function(_0x32e1fb){var _0x52882b=this;return new Promise(function(_0x109767,_0x1dd9df){return db[_0x6ba2('0x13')][_0x6ba2('0x1b')](_0x32e1fb[_0x6ba2('0x15')],{'raw':_0x32e1fb[_0x6ba2('0x16')]?_0x32e1fb[_0x6ba2('0x16')][_0x6ba2('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32e1fb['options']?_0x32e1fb['options'][_0x6ba2('0x1c')]||null:null,'attributes':_0x32e1fb[_0x6ba2('0x16')]?_0x32e1fb[_0x6ba2('0x16')][_0x6ba2('0x1d')]||null:null,'limit':_0x32e1fb['options']?_0x32e1fb[_0x6ba2('0x16')]['limit']||null:null})[_0x6ba2('0xa')](function(_0x448cf2){logger[_0x6ba2('0x10')]('UpdateVoiceAgentReport',_0x32e1fb);logger[_0x6ba2('0x18')](_0x6ba2('0x1a'),_0x32e1fb,JSON['stringify'](_0x448cf2));_0x109767(_0x448cf2);})[_0x6ba2('0x19')](function(_0x498637){logger[_0x6ba2('0xd')](_0x6ba2('0x1a'),_0x498637[_0x6ba2('0xf')],_0x32e1fb);_0x1dd9df(_0x52882b[_0x6ba2('0xd')](0x1f4,_0x498637[_0x6ba2('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 42a064c..3a0042c 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 _0xbd50=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','/:id','show','create','delete','exports','multer','util'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xbd50,0x196));var _0x0bd5=function(_0x20e552,_0x62c0ec){_0x20e552=_0x20e552-0x0;var _0x40fe1a=_0xbd50[_0x20e552];return _0x40fe1a;};'use strict';var multer=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var path=require(_0x0bd5('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bd5('0x3'));var router=express[_0x0bd5('0x4')]();var fs_extra=require(_0x0bd5('0x5'));var auth=require(_0x0bd5('0x6'));var interaction=require(_0x0bd5('0x7'));var config=require('../../config/environment');var controller=require('./voiceCallReport.controller');router['get']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x9')]);router[_0x0bd5('0xa')](_0x0bd5('0xb'),auth[_0x0bd5('0x8')](),controller['describe']);router['get'](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xd')]);router['post']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xe')]);router['put'](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller['update']);router[_0x0bd5('0xf')](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller['destroy']);module[_0x0bd5('0x10')]=router; \ No newline at end of file +var _0x44e8=['show','post','put','update','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','index','/describe','isAuthenticated','/:id'];(function(_0x681ca3,_0x19e409){var _0x42435d=function(_0x5426a4){while(--_0x5426a4){_0x681ca3['push'](_0x681ca3['shift']());}};_0x42435d(++_0x19e409);}(_0x44e8,0xd7));var _0x844e=function(_0x47c0d8,_0x1c70f1){_0x47c0d8=_0x47c0d8-0x0;var _0x4cd3fa=_0x44e8[_0x47c0d8];return _0x4cd3fa;};'use strict';var multer=require(_0x844e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x844e('0x1'));var express=require(_0x844e('0x2'));var router=express[_0x844e('0x3')]();var fs_extra=require(_0x844e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x844e('0x5'));var config=require(_0x844e('0x6'));var controller=require(_0x844e('0x7'));router[_0x844e('0x8')]('/',auth['isAuthenticated'](),controller[_0x844e('0x9')]);router[_0x844e('0x8')](_0x844e('0xa'),auth[_0x844e('0xb')](),controller['describe']);router[_0x844e('0x8')](_0x844e('0xc'),auth[_0x844e('0xb')](),controller[_0x844e('0xd')]);router[_0x844e('0xe')]('/',auth[_0x844e('0xb')](),controller['create']);router[_0x844e('0xf')](_0x844e('0xc'),auth[_0x844e('0xb')](),controller[_0x844e('0x10')]);router[_0x844e('0x11')](_0x844e('0xc'),auth[_0x844e('0xb')](),controller['destroy']);module[_0x844e('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 397595c..7899393 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 _0x4f34=['outbound','inbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','internal'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x4f34,0xae));var _0x44f3=function(_0x132ae4,_0x4e601f){_0x132ae4=_0x132ae4-0x0;var _0x488478=_0x4f34[_0x132ae4];return _0x488478;};'use strict';var Sequelize=require(_0x44f3('0x0'));module[_0x44f3('0x1')]={'uniqueid':{'type':Sequelize[_0x44f3('0x2')]},'type':{'type':Sequelize[_0x44f3('0x3')](_0x44f3('0x4'),_0x44f3('0x5'),_0x44f3('0x6'),_0x44f3('0x7'),'outbound-fax',_0x44f3('0x8'))},'tag':{'type':Sequelize[_0x44f3('0x2')]},'accountcode':{'type':Sequelize[_0x44f3('0x2')]},'source':{'type':Sequelize[_0x44f3('0x2')]},'destination':{'type':Sequelize[_0x44f3('0x2')]},'destinationcontext':{'type':Sequelize[_0x44f3('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x44f3('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x44f3('0x2')]},'lastdata':{'type':Sequelize[_0x44f3('0x9')]},'starttime':{'type':Sequelize[_0x44f3('0xa')]},'systemanswertime':{'type':Sequelize[_0x44f3('0xa')]},'answertime':{'type':Sequelize[_0x44f3('0xa')]},'endtime':{'type':Sequelize[_0x44f3('0xa')]},'duration':{'type':Sequelize[_0x44f3('0xb')]},'billableseconds':{'type':Sequelize[_0x44f3('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x44f3('0x2')]},'userDisposition':{'type':Sequelize[_0x44f3('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x44f3('0x2')]},'note':{'type':Sequelize[_0x44f3('0x2')]},'prefix':{'type':Sequelize[_0x44f3('0x2')]},'routeid':{'type':Sequelize[_0x44f3('0xb')]},'sipcallid':{'type':Sequelize[_0x44f3('0x2')]}}; \ No newline at end of file +var _0x2d03=['internal','outbound','inbound-fax','outbound-fax','TEXT','DATE','INTEGER','exports','STRING','ENUM'];(function(_0x24ea9c,_0x2785ce){var _0x3bf70f=function(_0x562ae8){while(--_0x562ae8){_0x24ea9c['push'](_0x24ea9c['shift']());}};_0x3bf70f(++_0x2785ce);}(_0x2d03,0x1e7));var _0x32d0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2d03[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x32d0('0x0')]={'uniqueid':{'type':Sequelize[_0x32d0('0x1')]},'type':{'type':Sequelize[_0x32d0('0x2')]('inbound',_0x32d0('0x3'),_0x32d0('0x4'),_0x32d0('0x5'),_0x32d0('0x6'),'dialer')},'tag':{'type':Sequelize[_0x32d0('0x1')]},'accountcode':{'type':Sequelize[_0x32d0('0x1')]},'source':{'type':Sequelize[_0x32d0('0x1')]},'destination':{'type':Sequelize[_0x32d0('0x1')]},'destinationcontext':{'type':Sequelize[_0x32d0('0x1')]},'callerid':{'type':Sequelize[_0x32d0('0x1')]},'channel':{'type':Sequelize[_0x32d0('0x1')]},'destinationchannel':{'type':Sequelize[_0x32d0('0x1')]},'lastapplication':{'type':Sequelize[_0x32d0('0x1')]},'lastdata':{'type':Sequelize[_0x32d0('0x7')]},'starttime':{'type':Sequelize[_0x32d0('0x8')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x32d0('0x8')]},'endtime':{'type':Sequelize[_0x32d0('0x8')]},'duration':{'type':Sequelize[_0x32d0('0x9')]},'billableseconds':{'type':Sequelize[_0x32d0('0x9')]},'mohtime':{'type':Sequelize[_0x32d0('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x32d0('0x1')]},'amaflags':{'type':Sequelize[_0x32d0('0x1')]},'userfield':{'type':Sequelize[_0x32d0('0x1')]},'userDisposition':{'type':Sequelize[_0x32d0('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x32d0('0x1')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x32d0('0x1')]},'prefix':{'type':Sequelize[_0x32d0('0x1')]},'routeid':{'type':Sequelize[_0x32d0('0x9')]},'sipcallid':{'type':Sequelize[_0x32d0('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 1a9d8ba..247d562 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x4009e0,_0x59c4f5){_0x4009e0=_0x4009e0-0x0;var _0x54a1b7=_0x2032[_0x4009e0];return _0x54a1b7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file +var _0x5f2f=['stack','name','send','index','VoiceCallReport','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','fullname','alias','User','findAll','catch','params','keys','find','create','body','destroy','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x45b29d,_0x44ce43){var _0x32d74=function(_0x559eff){while(--_0x559eff){_0x45b29d['push'](_0x45b29d['shift']());}};_0x32d74(++_0x44ce43);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3fd222,_0xb1b01){_0x3fd222=_0x3fd222-0x0;var _0x2d9d3a=_0x5f2f[_0x3fd222];return _0x2d9d3a;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'attributes':['id',_0xf5f2('0x26'),_0xf5f2('0x3e'),_0xf5f2('0x3f')],'model':db['User'],'as':_0xf5f2('0x40')}];}return db[_0xf5f2('0x29')][_0xf5f2('0x41')](_0x22c826);})['then'](function(_0x509dbc){_0x11c771['rows']=_0x509dbc;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x42')](handleError(_0x53cb96,null));};exports['show']=function(_0x106272,_0xeed03d){var _0x28e33f={'raw':!![],'where':{'id':_0x106272[_0xf5f2('0x43')]['id']}},_0x31f86c={};_0x31f86c[_0xf5f2('0x31')]=_[_0xf5f2('0x44')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x31f86c[_0xf5f2('0x2e')]=_[_0xf5f2('0x44')](_0x106272[_0xf5f2('0x2e')]);_0x31f86c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x31f86c['model'],_0x31f86c[_0xf5f2('0x2e')]);_0x28e33f['attributes']=_[_0xf5f2('0x30')](_0x31f86c[_0xf5f2('0x31')],qs[_0xf5f2('0x33')](_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x28e33f[_0xf5f2('0x32')]=_0x28e33f['attributes'][_0xf5f2('0x34')]?_0x28e33f[_0xf5f2('0x32')]:_0x31f86c[_0xf5f2('0x31')];if(_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x28e33f[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x28e33f=_[_0xf5f2('0x39')]({},_0x28e33f,_0x106272[_0xf5f2('0x3b')]);return db['VoiceCallReport'][_0xf5f2('0x45')](_0x28e33f)[_0xf5f2('0x24')](handleEntityNotFound(_0xeed03d,null))[_0xf5f2('0x24')](respondWithResult(_0xeed03d,null))['catch'](handleError(_0xeed03d,null));};exports[_0xf5f2('0x46')]=function(_0xc91b64,_0x3179a9){return db['VoiceCallReport']['create'](_0xc91b64[_0xf5f2('0x47')],{})[_0xf5f2('0x24')](respondWithResult(_0x3179a9,0xc9))['catch'](handleError(_0x3179a9,null));};exports[_0xf5f2('0x48')]=function(_0x533cca,_0x740321){return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'id':_0x533cca['params']['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x740321,null))[_0xf5f2('0x24')](removeEntity(_0x740321,null))[_0xf5f2('0x42')](handleError(_0x740321,null));};exports[_0xf5f2('0x49')]=function(_0x4fa738,_0x3154c1){return db[_0xf5f2('0x29')]['describe']()['then'](respondWithResult(_0x3154c1,null))[_0xf5f2('0x42')](handleError(_0x3154c1,null));};exports[_0xf5f2('0x4a')]=function(_0x57782c,_0x22b645){if(_0x57782c[_0xf5f2('0x47')][_0xf5f2('0x4b')]){delete _0x57782c[_0xf5f2('0x47')]['uniqueid'];}return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'uniqueid':_0x57782c[_0xf5f2('0x43')]['id'],'UserId':{'$or':[null,_0x57782c['user']['id']]}}})[_0xf5f2('0x24')](handleEntityNotFound(_0x22b645,null))[_0xf5f2('0x24')](saveUpdates(_0x57782c[_0xf5f2('0x47')],null))[_0xf5f2('0x24')](respondWithResult(_0x22b645,null))[_0xf5f2('0x42')](handleError(_0x22b645,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index bdef1a2..3857275 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 _0x8cec=['lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid'];(function(_0x487131,_0x2c86e8){var _0xf320ff=function(_0x2a9a17){while(--_0x2a9a17){_0x487131['push'](_0x487131['shift']());}};_0xf320ff(++_0x2c86e8);}(_0x8cec,0x104));var _0xc8ce=function(_0x86e192,_0x47bc2e){_0x86e192=_0x86e192-0x0;var _0x4c2866=_0x8cec[_0x86e192];return _0x4c2866;};'use strict';var _=require(_0xc8ce('0x0'));var util=require('util');var logger=require(_0xc8ce('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc8ce('0x2'));var rp=require(_0xc8ce('0x3'));var fs=require('fs');var path=require(_0xc8ce('0x4'));var rimraf=require(_0xc8ce('0x5'));var config=require(_0xc8ce('0x6'));var attributes=require(_0xc8ce('0x7'));module[_0xc8ce('0x8')]=function(_0x8f677c,_0x4662bb){return _0x8f677c[_0xc8ce('0x9')](_0xc8ce('0xa'),attributes,{'tableName':_0xc8ce('0xb'),'paranoid':![],'indexes':[{'fields':[_0xc8ce('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xec05=['report_call','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','rimraf','./voiceCallReport.attributes','exports','VoiceCallReport'];(function(_0x1d1b2b,_0x3623ab){var _0x1693d2=function(_0x423304){while(--_0x423304){_0x1d1b2b['push'](_0x1d1b2b['shift']());}};_0x1693d2(++_0x3623ab);}(_0xec05,0xe6));var _0x5ec0=function(_0x7aa4cf,_0x4fe1aa){_0x7aa4cf=_0x7aa4cf-0x0;var _0x36eb0f=_0xec05[_0x7aa4cf];return _0x36eb0f;};'use strict';var _=require(_0x5ec0('0x0'));var util=require(_0x5ec0('0x1'));var logger=require(_0x5ec0('0x2'))(_0x5ec0('0x3'));var moment=require(_0x5ec0('0x4'));var BPromise=require(_0x5ec0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5ec0('0x6'));var config=require('../../config/environment');var attributes=require(_0x5ec0('0x7'));module[_0x5ec0('0x8')]=function(_0x34949b,_0xcad5cd){return _0x34949b['define'](_0x5ec0('0x9'),attributes,{'tableName':_0x5ec0('0xa'),'paranoid':![],'indexes':[{'fields':[_0x5ec0('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index a29b602..a66f40d 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 _0xd418=['stringify','error','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','where','limit','include','map','attributes','model','CreateVoiceCallReport','create','body','raw','then','UpdateVoiceCallReport','update','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x27a900,_0x1cc305){var _0xea9b1f=function(_0xaddd55){while(--_0xaddd55){_0x27a900['push'](_0x27a900['shift']());}};_0xea9b1f(++_0x1cc305);}(_0xd418,0x1d2));var _0x8d41=function(_0x195ecd,_0x1a7e22){_0x195ecd=_0x195ecd-0x0;var _0x305181=_0xd418[_0x195ecd];return _0x305181;};'use strict';var _=require(_0x8d41('0x0'));var util=require('util');var moment=require(_0x8d41('0x1'));var BPromise=require('bluebird');var rs=require(_0x8d41('0x2'));var fs=require('fs');var Redis=require(_0x8d41('0x3'));var db=require(_0x8d41('0x4'))['db'];var utils=require(_0x8d41('0x5'));var logger=require('../../config/logger')(_0x8d41('0x6'));var config=require(_0x8d41('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8d41('0x8')][_0x8d41('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f63fe,_0x1f2c3d,_0x21bbe3){return new BPromise(function(_0x4d44a7,_0x5288ae){return client[_0x8d41('0xa')](_0x4f63fe,_0x21bbe3)['then'](function(_0x404f8a){logger[_0x8d41('0xb')](_0x8d41('0xc'),_0x1f2c3d,_0x8d41('0xd'));logger[_0x8d41('0xe')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x1f2c3d,_0x8d41('0xd'),JSON[_0x8d41('0xf')](_0x404f8a));if(_0x404f8a['error']){if(_0x404f8a['error']['code']===0x1f4){logger['error'](_0x8d41('0xc'),_0x1f2c3d,_0x404f8a[_0x8d41('0x10')][_0x8d41('0x11')]);return _0x5288ae(_0x404f8a[_0x8d41('0x10')]['message']);}logger['error'](_0x8d41('0xc'),_0x1f2c3d,_0x404f8a['error'][_0x8d41('0x11')]);return _0x4d44a7(_0x404f8a[_0x8d41('0x10')]['message']);}else{logger[_0x8d41('0xb')]('VoiceCallReport,\x20%s,\x20%s',_0x1f2c3d,_0x8d41('0xd'));_0x4d44a7(_0x404f8a[_0x8d41('0x12')][_0x8d41('0x11')]);}})[_0x8d41('0x13')](function(_0x5f517b){logger[_0x8d41('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x1f2c3d,_0x5f517b);_0x5288ae(_0x5f517b);});});}exports[_0x8d41('0x14')]=function(_0x46e9b1){var _0x3f7da6=this;return new Promise(function(_0x3ab4e2,_0x53dc1b){return db[_0x8d41('0x15')][_0x8d41('0x16')]({'raw':_0x46e9b1[_0x8d41('0x17')]?_0x46e9b1[_0x8d41('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x46e9b1[_0x8d41('0x17')]?_0x46e9b1[_0x8d41('0x17')][_0x8d41('0x18')]||null:null,'attributes':_0x46e9b1[_0x8d41('0x17')]?_0x46e9b1[_0x8d41('0x17')]['attributes']||null:null,'limit':_0x46e9b1['options']?_0x46e9b1[_0x8d41('0x17')][_0x8d41('0x19')]||null:null,'include':_0x46e9b1[_0x8d41('0x17')]?_0x46e9b1[_0x8d41('0x17')][_0x8d41('0x1a')]?_[_0x8d41('0x1b')](_0x46e9b1[_0x8d41('0x17')][_0x8d41('0x1a')],function(_0x3b1520){return{'model':db[_0x3b1520['model']],'as':_0x3b1520['as'],'attributes':_0x3b1520[_0x8d41('0x1c')],'include':_0x3b1520[_0x8d41('0x1a')]?_['map'](_0x3b1520[_0x8d41('0x1a')],function(_0xafe25b){return{'model':db[_0xafe25b[_0x8d41('0x1d')]],'as':_0xafe25b['as'],'attributes':_0xafe25b[_0x8d41('0x1c')],'include':_0xafe25b['include']?_['map'](_0xafe25b[_0x8d41('0x1a')],function(_0x27c1e4){return{'model':db[_0x27c1e4[_0x8d41('0x1d')]],'as':_0x27c1e4['as'],'attributes':_0x27c1e4[_0x8d41('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x112e29){logger[_0x8d41('0xb')](_0x8d41('0x14'),_0x46e9b1);logger['debug']('GetVoiceCallReport',_0x46e9b1,JSON['stringify'](_0x112e29));_0x3ab4e2(_0x112e29);})[_0x8d41('0x13')](function(_0x12b5d2){logger[_0x8d41('0x10')](_0x8d41('0x14'),_0x12b5d2[_0x8d41('0x11')],_0x46e9b1);_0x53dc1b(_0x3f7da6['error'](0x1f4,_0x12b5d2['message']));});});};exports[_0x8d41('0x1e')]=function(_0x2e7427){var _0x514a80=this;return new Promise(function(_0x39d1d8,_0x3639d1){return db[_0x8d41('0x15')][_0x8d41('0x1f')](_0x2e7427[_0x8d41('0x20')],{'raw':_0x2e7427[_0x8d41('0x17')]?_0x2e7427[_0x8d41('0x17')][_0x8d41('0x21')]===undefined?!![]:![]:!![]})[_0x8d41('0x22')](function(_0x254603){logger[_0x8d41('0xb')](_0x8d41('0x1e'),_0x2e7427);logger['debug'](_0x8d41('0x1e'),_0x2e7427,JSON[_0x8d41('0xf')](_0x254603));_0x39d1d8(_0x254603);})[_0x8d41('0x13')](function(_0x12de66){logger[_0x8d41('0x10')]('CreateVoiceCallReport',_0x12de66['message'],_0x2e7427);_0x3639d1(_0x514a80[_0x8d41('0x10')](0x1f4,_0x12de66[_0x8d41('0x11')]));});});};exports[_0x8d41('0x23')]=function(_0x480539){var _0x41eec0=this;return new Promise(function(_0x3c0a75,_0x40a57d){return db[_0x8d41('0x15')][_0x8d41('0x24')](_0x480539['body'],{'raw':_0x480539['options']?_0x480539[_0x8d41('0x17')][_0x8d41('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x480539[_0x8d41('0x17')]?_0x480539['options'][_0x8d41('0x18')]||null:null,'attributes':_0x480539[_0x8d41('0x17')]?_0x480539[_0x8d41('0x17')]['attributes']||null:null,'limit':_0x480539[_0x8d41('0x17')]?_0x480539[_0x8d41('0x17')]['limit']||null:null})[_0x8d41('0x22')](function(_0x12ebde){logger['info'](_0x8d41('0x23'),_0x480539);logger[_0x8d41('0xe')](_0x8d41('0x23'),_0x480539,JSON['stringify'](_0x12ebde));_0x3c0a75(_0x12ebde);})['catch'](function(_0x4b7d10){logger[_0x8d41('0x10')](_0x8d41('0x23'),_0x4b7d10[_0x8d41('0x11')],_0x480539);_0x40a57d(_0x41eec0[_0x8d41('0x10')](0x1f4,_0x4b7d10[_0x8d41('0x11')]));});});}; \ No newline at end of file +var _0x861f=['../../mysqldb','../../config/utils','jayson/promise','client','http','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','attributes','limit','include','map','model','debug','stringify','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','where','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4cecfc,_0x6263c1){var _0x10cfb2=function(_0xeb2658){while(--_0xeb2658){_0x4cecfc['push'](_0x4cecfc['shift']());}};_0x10cfb2(++_0x6263c1);}(_0x861f,0xe4));var _0xf861=function(_0x1f5887,_0x2fa1f1){_0x1f5887=_0x1f5887-0x0;var _0x21774b=_0x861f[_0x1f5887];return _0x21774b;};'use strict';var _=require(_0xf861('0x0'));var util=require(_0xf861('0x1'));var moment=require(_0xf861('0x2'));var BPromise=require(_0xf861('0x3'));var rs=require(_0xf861('0x4'));var fs=require('fs');var Redis=require(_0xf861('0x5'));var db=require(_0xf861('0x6'))['db'];var utils=require(_0xf861('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf861('0x8'));var client=jayson[_0xf861('0x9')][_0xf861('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32233a,_0x115b10,_0xa98944){return new BPromise(function(_0xa7eae5,_0x518641){return client['request'](_0x32233a,_0xa98944)[_0xf861('0xb')](function(_0x29a847){logger[_0xf861('0xc')](_0xf861('0xd'),_0x115b10,_0xf861('0xe'));logger['debug'](_0xf861('0xf'),_0x115b10,'request\x20sent',JSON['stringify'](_0x29a847));if(_0x29a847[_0xf861('0x10')]){if(_0x29a847[_0xf861('0x10')][_0xf861('0x11')]===0x1f4){logger[_0xf861('0x10')](_0xf861('0xd'),_0x115b10,_0x29a847[_0xf861('0x10')][_0xf861('0x12')]);return _0x518641(_0x29a847[_0xf861('0x10')][_0xf861('0x12')]);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x115b10,_0x29a847['error']['message']);return _0xa7eae5(_0x29a847['error'][_0xf861('0x12')]);}else{logger['info'](_0xf861('0xd'),_0x115b10,_0xf861('0xe'));_0xa7eae5(_0x29a847[_0xf861('0x13')][_0xf861('0x12')]);}})[_0xf861('0x14')](function(_0x4365d1){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x115b10,_0x4365d1);_0x518641(_0x4365d1);});});}exports[_0xf861('0x15')]=function(_0x28d85f){var _0x13fde3=this;return new Promise(function(_0x4f3ee8,_0x15cf44){return db[_0xf861('0x16')][_0xf861('0x17')]({'raw':_0x28d85f['options']?_0x28d85f[_0xf861('0x18')][_0xf861('0x19')]===undefined?!![]:![]:!![],'where':_0x28d85f[_0xf861('0x18')]?_0x28d85f[_0xf861('0x18')]['where']||null:null,'attributes':_0x28d85f[_0xf861('0x18')]?_0x28d85f['options'][_0xf861('0x1a')]||null:null,'limit':_0x28d85f[_0xf861('0x18')]?_0x28d85f[_0xf861('0x18')][_0xf861('0x1b')]||null:null,'include':_0x28d85f[_0xf861('0x18')]?_0x28d85f[_0xf861('0x18')][_0xf861('0x1c')]?_[_0xf861('0x1d')](_0x28d85f[_0xf861('0x18')][_0xf861('0x1c')],function(_0x598665){return{'model':db[_0x598665[_0xf861('0x1e')]],'as':_0x598665['as'],'attributes':_0x598665[_0xf861('0x1a')],'include':_0x598665[_0xf861('0x1c')]?_['map'](_0x598665[_0xf861('0x1c')],function(_0x3150fb){return{'model':db[_0x3150fb[_0xf861('0x1e')]],'as':_0x3150fb['as'],'attributes':_0x3150fb['attributes'],'include':_0x3150fb[_0xf861('0x1c')]?_['map'](_0x3150fb[_0xf861('0x1c')],function(_0x48b1c5){return{'model':db[_0x48b1c5[_0xf861('0x1e')]],'as':_0x48b1c5['as'],'attributes':_0x48b1c5[_0xf861('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf861('0xb')](function(_0x162731){logger[_0xf861('0xc')]('GetVoiceCallReport',_0x28d85f);logger[_0xf861('0x1f')](_0xf861('0x15'),_0x28d85f,JSON[_0xf861('0x20')](_0x162731));_0x4f3ee8(_0x162731);})['catch'](function(_0x37a2a1){logger['error'](_0xf861('0x15'),_0x37a2a1['message'],_0x28d85f);_0x15cf44(_0x13fde3[_0xf861('0x10')](0x1f4,_0x37a2a1['message']));});});};exports[_0xf861('0x21')]=function(_0x4082ee){var _0x30c45a=this;return new Promise(function(_0x3ed7f0,_0x4e4f4f){return db[_0xf861('0x16')][_0xf861('0x22')](_0x4082ee[_0xf861('0x23')],{'raw':_0x4082ee[_0xf861('0x18')]?_0x4082ee[_0xf861('0x18')][_0xf861('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x5bf740){logger[_0xf861('0xc')](_0xf861('0x21'),_0x4082ee);logger['debug'](_0xf861('0x21'),_0x4082ee,JSON['stringify'](_0x5bf740));_0x3ed7f0(_0x5bf740);})[_0xf861('0x14')](function(_0x5999b3){logger['error']('CreateVoiceCallReport',_0x5999b3[_0xf861('0x12')],_0x4082ee);_0x4e4f4f(_0x30c45a[_0xf861('0x10')](0x1f4,_0x5999b3['message']));});});};exports[_0xf861('0x24')]=function(_0x528e40){var _0xf95a54=this;return new Promise(function(_0x49fb53,_0x1b320b){return db['VoiceCallReport'][_0xf861('0x25')](_0x528e40[_0xf861('0x23')],{'raw':_0x528e40['options']?_0x528e40[_0xf861('0x18')][_0xf861('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x528e40['options']?_0x528e40[_0xf861('0x18')][_0xf861('0x26')]||null:null,'attributes':_0x528e40['options']?_0x528e40[_0xf861('0x18')]['attributes']||null:null,'limit':_0x528e40['options']?_0x528e40[_0xf861('0x18')][_0xf861('0x1b')]||null:null})[_0xf861('0xb')](function(_0x26df14){logger['info']('UpdateVoiceCallReport',_0x528e40);logger[_0xf861('0x1f')](_0xf861('0x24'),_0x528e40,JSON[_0xf861('0x20')](_0x26df14));_0x49fb53(_0x26df14);})[_0xf861('0x14')](function(_0x2618a8){logger[_0xf861('0x10')](_0xf861('0x24'),_0x2618a8[_0xf861('0x12')],_0x528e40);_0x1b320b(_0xf95a54[_0xf861('0x10')](0x1f4,_0x2618a8[_0xf861('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 424fd95..1141671 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 _0x34ec=['post','put','update','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','index','/:id','isAuthenticated','show'];(function(_0x4df748,_0x3589b0){var _0x34fb47=function(_0x33446a){while(--_0x33446a){_0x4df748['push'](_0x4df748['shift']());}};_0x34fb47(++_0x3589b0);}(_0x34ec,0x125));var _0xc34e=function(_0x2068b0,_0x5f1aca){_0x2068b0=_0x2068b0-0x0;var _0x3970d3=_0x34ec[_0x2068b0];return _0x3970d3;};'use strict';var multer=require(_0xc34e('0x0'));var util=require('util');var path=require(_0xc34e('0x1'));var timeout=require(_0xc34e('0x2'));var express=require('express');var router=express[_0xc34e('0x3')]();var fs_extra=require(_0xc34e('0x4'));var auth=require(_0xc34e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc34e('0x6'));var controller=require(_0xc34e('0x7'));router[_0xc34e('0x8')]('/',auth['isAuthenticated'](),controller[_0xc34e('0x9')]);router['get'](_0xc34e('0xa'),auth[_0xc34e('0xb')](),controller[_0xc34e('0xc')]);router[_0xc34e('0xd')]('/',auth[_0xc34e('0xb')](),controller['create']);router[_0xc34e('0xe')](_0xc34e('0xa'),auth['isAuthenticated'](),controller[_0xc34e('0xf')]);router['delete'](_0xc34e('0xa'),auth[_0xc34e('0xb')](),controller[_0xc34e('0x10')]);module['exports']=router; \ No newline at end of file +var _0xcfa4=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','show','post','create','put','/:id','delete','destroy','multer','util','connect-timeout'];(function(_0x1a55c5,_0x4949a8){var _0x5eeeb2=function(_0x567038){while(--_0x567038){_0x1a55c5['push'](_0x1a55c5['shift']());}};_0x5eeeb2(++_0x4949a8);}(_0xcfa4,0xe7));var _0x4cfa=function(_0x14790b,_0x31f4fa){_0x14790b=_0x14790b-0x0;var _0x139221=_0xcfa4[_0x14790b];return _0x139221;};'use strict';var multer=require(_0x4cfa('0x0'));var util=require(_0x4cfa('0x1'));var path=require('path');var timeout=require(_0x4cfa('0x2'));var express=require('express');var router=express[_0x4cfa('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4cfa('0x4'));var interaction=require(_0x4cfa('0x5'));var config=require(_0x4cfa('0x6'));var controller=require(_0x4cfa('0x7'));router[_0x4cfa('0x8')]('/',auth[_0x4cfa('0x9')](),controller[_0x4cfa('0xa')]);router[_0x4cfa('0x8')]('/:id',auth[_0x4cfa('0x9')](),controller[_0x4cfa('0xb')]);router[_0x4cfa('0xc')]('/',auth[_0x4cfa('0x9')](),controller[_0x4cfa('0xd')]);router[_0x4cfa('0xe')](_0x4cfa('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x4cfa('0x10')]('/:id',auth[_0x4cfa('0x9')](),controller[_0x4cfa('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 43da56b..593ffb2 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 _0x3ddc=['STRING','name','options','join','getDataValue','BOOLEAN','sequelize','exports'];(function(_0x443031,_0x3e7084){var _0x1bb046=function(_0x4b8ddf){while(--_0x4b8ddf){_0x443031['push'](_0x443031['shift']());}};_0x1bb046(++_0x3e7084);}(_0x3ddc,0x1be));var _0xc3dd=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x3ddc[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0xc3dd('0x0'));module[_0xc3dd('0x1')]={'name':{'type':Sequelize[_0xc3dd('0x2')]},'prefix':{'type':Sequelize[_0xc3dd('0x2')],'unique':_0xc3dd('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xc3dd('0x2')],'set':function(_0x3eba4a){this['setDataValue'](_0xc3dd('0x4'),_0x3eba4a?_0x3eba4a[_0xc3dd('0x5')](''):[]);},'get':function(){return this[_0xc3dd('0x6')](_0xc3dd('0x4'))?this[_0xc3dd('0x6')](_0xc3dd('0x4'))['split'](''):[];}},'auth':{'type':Sequelize[_0xc3dd('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0xc3dd('0x2')]},'record':{'type':Sequelize[_0xc3dd('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xc3dd('0x2')]},'description':{'type':Sequelize[_0xc3dd('0x2')]}}; \ No newline at end of file +var _0x9ccd=['STRING','name','setDataValue','options','getDataValue','split','BOOLEAN','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9ccd,0x1ef));var _0xd9cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ccd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xd9cc('0x0')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xd9cc('0x1')],'unique':_0xd9cc('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x11e47a){this[_0xd9cc('0x3')](_0xd9cc('0x4'),_0x11e47a?_0x11e47a['join'](''):[]);},'get':function(){return this[_0xd9cc('0x5')](_0xd9cc('0x4'))?this[_0xd9cc('0x5')](_0xd9cc('0x4'))[_0xd9cc('0x6')](''):[];}},'auth':{'type':Sequelize[_0xd9cc('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0xd9cc('0x1')]},'record':{'type':Sequelize[_0xd9cc('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xd9cc('0x1')]},'description':{'type':Sequelize[_0xd9cc('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 0e8f667..4229feb 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 _0x0a34=['then','destroy','ChanSpies','name','send','index','VoiceChanSpy','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','get','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','undefined','limit','count','offset','status','set','Content-Range','json','apply','reject','save'];(function(_0x3e63e5,_0x34ef86){var _0x2523dd=function(_0x27c2cd){while(--_0x27c2cd){_0x3e63e5['push'](_0x3e63e5['shift']());}};_0x2523dd(++_0x34ef86);}(_0x0a34,0x12a));var _0x40a3=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x0a34[_0x53ccf2];return _0x5a2964;};'use strict';var emlformat=require(_0x40a3('0x0'));var rimraf=require(_0x40a3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x40a3('0x2'));var rp=require(_0x40a3('0x3'));var moment=require(_0x40a3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x40a3('0x5'));var util=require(_0x40a3('0x6'));var path=require(_0x40a3('0x7'));var sox=require('sox');var csv=require(_0x40a3('0x8'));var ejs=require(_0x40a3('0x9'));var fs=require('fs');var fs_extra=require(_0x40a3('0xa'));var _=require(_0x40a3('0xb'));var squel=require(_0x40a3('0xc'));var crypto=require(_0x40a3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x40a3('0xe'));var toCsv=require(_0x40a3('0x8'));var querystring=require(_0x40a3('0xf'));var Papa=require(_0x40a3('0x10'));var Redis=require(_0x40a3('0x11'));var authService=require(_0x40a3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x40a3('0x13'));var hardwareService=require(_0x40a3('0x14'));var logger=require(_0x40a3('0x15'))('api');var utils=require(_0x40a3('0x16'));var config=require(_0x40a3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x40a3('0x18'))['db'];function respondWithStatusCode(_0x36c29c,_0x4b809b){_0x4b809b=_0x4b809b||0xcc;return function(_0x2b3122){if(_0x2b3122){return _0x36c29c[_0x40a3('0x19')](_0x4b809b);}return _0x36c29c['status'](_0x4b809b)[_0x40a3('0x1a')]();};}function respondWithResult(_0x3ced7b,_0x13ac55){_0x13ac55=_0x13ac55||0xc8;return function(_0x476c82){if(_0x476c82){return _0x3ced7b['status'](_0x13ac55)['json'](_0x476c82);}};}function respondWithFilteredResult(_0x561554,_0x28bb05){return function(_0x19e09e){if(_0x19e09e){var _0x20d6cf=typeof _0x28bb05['offset']===_0x40a3('0x1b')&&typeof _0x28bb05[_0x40a3('0x1c')]==='undefined';var _0x4d6499=_0x19e09e[_0x40a3('0x1d')];var _0x31aef5=_0x20d6cf?0x0:_0x28bb05[_0x40a3('0x1e')];var _0x1c5102=_0x20d6cf?_0x19e09e['count']:_0x28bb05[_0x40a3('0x1e')]+_0x28bb05[_0x40a3('0x1c')];var _0x3b4b67;if(_0x1c5102>=_0x4d6499){_0x1c5102=_0x4d6499;_0x3b4b67=0xc8;}else{_0x3b4b67=0xce;}_0x561554[_0x40a3('0x1f')](_0x3b4b67);return _0x561554[_0x40a3('0x20')](_0x40a3('0x21'),_0x31aef5+'-'+_0x1c5102+'/'+_0x4d6499)[_0x40a3('0x22')](_0x19e09e);}return null;};}function patchUpdates(_0xb723d3){return function(_0x975ca){try{jsonpatch[_0x40a3('0x23')](_0x975ca,_0xb723d3,!![]);}catch(_0x2d18d6){return BPromise[_0x40a3('0x24')](_0x2d18d6);}return _0x975ca[_0x40a3('0x25')]();};}function saveUpdates(_0x1416d2,_0x1dbc00){return function(_0x1daace){if(_0x1daace){return _0x1daace['update'](_0x1416d2)[_0x40a3('0x26')](function(_0x46fbbe){return _0x46fbbe;});}return null;};}function removeEntity(_0x1d0cf0,_0x1e11fb){return function(_0x1d034a){if(_0x1d034a){return _0x1d034a[_0x40a3('0x27')]()['then'](function(){var _0x4316be=_0x1d034a['get']({'plain':!![]});var _0x37321a=_0x40a3('0x28');return db['UserProfileResource'][_0x40a3('0x27')]({'where':{'type':_0x37321a,'resourceId':_0x4316be['id']}})[_0x40a3('0x26')](function(){return _0x1d034a;});})[_0x40a3('0x26')](function(){_0x1d0cf0['status'](0xcc)[_0x40a3('0x1a')]();});}};}function handleEntityNotFound(_0x3fc059,_0x966c){return function(_0x4456f1){if(!_0x4456f1){_0x3fc059[_0x40a3('0x19')](0x194);}return _0x4456f1;};}function handleError(_0x1aca83,_0x2b39a5){_0x2b39a5=_0x2b39a5||0x1f4;return function(_0x3d50d7){logger['error'](_0x3d50d7['stack']);if(_0x3d50d7[_0x40a3('0x29')]){delete _0x3d50d7['name'];}_0x1aca83['status'](_0x2b39a5)[_0x40a3('0x2a')](_0x3d50d7);};}exports[_0x40a3('0x2b')]=function(_0x12ad99,_0x4fdf27){var _0x17a7e1={},_0x41bf52={},_0x2080cd={'count':0x0,'rows':[]};var _0x2f1ac0=_['map'](db[_0x40a3('0x2c')][_0x40a3('0x2d')],function(_0x444a43){return{'name':_0x444a43[_0x40a3('0x2e')],'type':_0x444a43[_0x40a3('0x2f')][_0x40a3('0x30')]};});_0x41bf52[_0x40a3('0x31')]=_[_0x40a3('0x32')](_0x2f1ac0,_0x40a3('0x29'));_0x41bf52[_0x40a3('0x33')]=_[_0x40a3('0x34')](_0x12ad99[_0x40a3('0x33')]);_0x41bf52[_0x40a3('0x35')]=_[_0x40a3('0x36')](_0x41bf52[_0x40a3('0x31')],_0x41bf52[_0x40a3('0x33')]);_0x17a7e1[_0x40a3('0x37')]=_[_0x40a3('0x36')](_0x41bf52[_0x40a3('0x31')],qs[_0x40a3('0x38')](_0x12ad99[_0x40a3('0x33')][_0x40a3('0x38')]));_0x17a7e1[_0x40a3('0x37')]=_0x17a7e1[_0x40a3('0x37')]['length']?_0x17a7e1[_0x40a3('0x37')]:_0x41bf52[_0x40a3('0x31')];if(!_0x12ad99[_0x40a3('0x33')][_0x40a3('0x39')](_0x40a3('0x3a'))){_0x17a7e1[_0x40a3('0x1c')]=qs[_0x40a3('0x1c')](_0x12ad99['query'][_0x40a3('0x1c')]);_0x17a7e1[_0x40a3('0x1e')]=qs[_0x40a3('0x1e')](_0x12ad99['query'][_0x40a3('0x1e')]);}_0x17a7e1[_0x40a3('0x3b')]=qs[_0x40a3('0x3c')](_0x12ad99[_0x40a3('0x33')][_0x40a3('0x3c')]);_0x17a7e1[_0x40a3('0x3d')]=qs[_0x40a3('0x35')](_[_0x40a3('0x3e')](_0x12ad99['query'],_0x41bf52['filters']),_0x2f1ac0);if(_0x12ad99[_0x40a3('0x33')][_0x40a3('0x3f')]){_0x17a7e1[_0x40a3('0x3d')]=_[_0x40a3('0x40')](_0x17a7e1['where'],{'$or':_[_0x40a3('0x32')](_0x2f1ac0,function(_0xc77ab3){if(_0xc77ab3[_0x40a3('0x2f')]!==_0x40a3('0x41')){var _0x19d2dc={};_0x19d2dc[_0xc77ab3[_0x40a3('0x29')]]={'$like':'%'+_0x12ad99[_0x40a3('0x33')]['filter']+'%'};return _0x19d2dc;}})});}_0x17a7e1=_[_0x40a3('0x40')]({},_0x17a7e1,_0x12ad99[_0x40a3('0x42')]);var _0x3ca599={'where':_0x17a7e1[_0x40a3('0x3d')]};return db[_0x40a3('0x2c')][_0x40a3('0x1d')](_0x3ca599)[_0x40a3('0x26')](function(_0x483819){_0x2080cd[_0x40a3('0x1d')]=_0x483819;if(_0x12ad99[_0x40a3('0x33')][_0x40a3('0x43')]){_0x17a7e1[_0x40a3('0x44')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x40a3('0x45')](_0x17a7e1);})[_0x40a3('0x26')](function(_0x265d58){_0x2080cd[_0x40a3('0x46')]=_0x265d58;return _0x2080cd;})[_0x40a3('0x26')](respondWithFilteredResult(_0x4fdf27,_0x17a7e1))[_0x40a3('0x47')](handleError(_0x4fdf27,null));};exports['show']=function(_0x340304,_0x2f627f){var _0x57c5d7={'raw':![],'where':{'id':_0x340304[_0x40a3('0x48')]['id']}},_0x57f2e9={};_0x57f2e9[_0x40a3('0x31')]=_[_0x40a3('0x34')](db[_0x40a3('0x2c')][_0x40a3('0x2d')]);_0x57f2e9['query']=_[_0x40a3('0x34')](_0x340304['query']);_0x57f2e9[_0x40a3('0x35')]=_[_0x40a3('0x36')](_0x57f2e9[_0x40a3('0x31')],_0x57f2e9[_0x40a3('0x33')]);_0x57c5d7[_0x40a3('0x37')]=_[_0x40a3('0x36')](_0x57f2e9[_0x40a3('0x31')],qs[_0x40a3('0x38')](_0x340304['query'][_0x40a3('0x38')]));_0x57c5d7[_0x40a3('0x37')]=_0x57c5d7[_0x40a3('0x37')]['length']?_0x57c5d7['attributes']:_0x57f2e9[_0x40a3('0x31')];if(_0x340304[_0x40a3('0x33')][_0x40a3('0x43')]){_0x57c5d7[_0x40a3('0x44')]=[{'all':!![]}];}_0x57c5d7=_['merge']({},_0x57c5d7,_0x340304[_0x40a3('0x42')]);return db[_0x40a3('0x2c')][_0x40a3('0x49')](_0x57c5d7)[_0x40a3('0x26')](handleEntityNotFound(_0x2f627f,null))['then'](respondWithResult(_0x2f627f,null))[_0x40a3('0x47')](handleError(_0x2f627f,null));};exports[_0x40a3('0x4a')]=function(_0x12889d,_0x35d952){return db[_0x40a3('0x2c')][_0x40a3('0x4a')](_0x12889d[_0x40a3('0x4b')],{})['then'](function(_0x2e666d){var _0x31019a=_0x12889d['user'][_0x40a3('0x4c')]({'plain':!![]});if(!_0x31019a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x31019a[_0x40a3('0x4d')]==='user'){var _0x2a9bd1=_0x2e666d[_0x40a3('0x4c')]({'plain':!![]});var _0x52b5a5='ChanSpies';return db[_0x40a3('0x4e')][_0x40a3('0x49')]({'where':{'name':_0x52b5a5,'userProfileId':_0x31019a[_0x40a3('0x4f')]},'raw':!![]})[_0x40a3('0x26')](function(_0x2e1211){if(_0x2e1211&&_0x2e1211[_0x40a3('0x50')]===0x0){return db[_0x40a3('0x51')][_0x40a3('0x4a')]({'name':_0x2a9bd1[_0x40a3('0x29')],'resourceId':_0x2a9bd1['id'],'type':_0x2e1211[_0x40a3('0x29')],'sectionId':_0x2e1211['id']},{})[_0x40a3('0x26')](function(){return _0x2e666d;});}else{return _0x2e666d;}})[_0x40a3('0x47')](function(_0x4d84cd){logger[_0x40a3('0x52')](_0x40a3('0x53'),_0x4d84cd);throw _0x4d84cd;});}return _0x2e666d;})[_0x40a3('0x26')](respondWithResult(_0x35d952,0xc9))[_0x40a3('0x47')](handleError(_0x35d952,null));};exports['update']=function(_0x26644e,_0x558b77){if(_0x26644e[_0x40a3('0x4b')]['id']){delete _0x26644e['body']['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0x26644e[_0x40a3('0x48')]['id']}})[_0x40a3('0x26')](handleEntityNotFound(_0x558b77,null))[_0x40a3('0x26')](saveUpdates(_0x26644e[_0x40a3('0x4b')],null))[_0x40a3('0x26')](respondWithResult(_0x558b77,null))[_0x40a3('0x47')](handleError(_0x558b77,null));};exports[_0x40a3('0x27')]=function(_0x2e4eec,_0x4ed27b){return db['VoiceChanSpy']['find']({'where':{'id':_0x2e4eec[_0x40a3('0x48')]['id']}})[_0x40a3('0x26')](handleEntityNotFound(_0x4ed27b,null))[_0x40a3('0x26')](removeEntity(_0x4ed27b,null))['catch'](handleError(_0x4ed27b,null));}; \ No newline at end of file +var _0x8d9b=['filter','type','options','VoiceChanSpy','rows','params','length','includeAll','include','merge','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChanSpies','UserProfileSection','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick'];(function(_0x9ca549,_0x307b85){var _0x154d7b=function(_0x467d61){while(--_0x467d61){_0x9ca549['push'](_0x9ca549['shift']());}};_0x154d7b(++_0x307b85);}(_0x8d9b,0x104));var _0xb8d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d9b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb8d9('0x0'));var rimraf=require(_0xb8d9('0x1'));var zipdir=require(_0xb8d9('0x2'));var jsonpatch=require(_0xb8d9('0x3'));var rp=require(_0xb8d9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb8d9('0x5'));var util=require('util');var path=require(_0xb8d9('0x6'));var sox=require(_0xb8d9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb8d9('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb8d9('0x9'));var toCsv=require(_0xb8d9('0xa'));var querystring=require(_0xb8d9('0xb'));var Papa=require(_0xb8d9('0xc'));var Redis=require(_0xb8d9('0xd'));var authService=require(_0xb8d9('0xe'));var qs=require(_0xb8d9('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb8d9('0x10'));var logger=require('../../config/logger')(_0xb8d9('0x11'));var utils=require(_0xb8d9('0x12'));var config=require(_0xb8d9('0x13'));var licenseUtil=require(_0xb8d9('0x14'));var db=require(_0xb8d9('0x15'))['db'];function respondWithStatusCode(_0x13b1d8,_0x10b7fe){_0x10b7fe=_0x10b7fe||0xcc;return function(_0x265472){if(_0x265472){return _0x13b1d8[_0xb8d9('0x16')](_0x10b7fe);}return _0x13b1d8[_0xb8d9('0x17')](_0x10b7fe)[_0xb8d9('0x18')]();};}function respondWithResult(_0x4b0f9,_0x1bcb02){_0x1bcb02=_0x1bcb02||0xc8;return function(_0xb3fa68){if(_0xb3fa68){return _0x4b0f9['status'](_0x1bcb02)[_0xb8d9('0x19')](_0xb3fa68);}};}function respondWithFilteredResult(_0x2c5265,_0x513edf){return function(_0x24f33a){if(_0x24f33a){var _0x283780=typeof _0x513edf['offset']==='undefined'&&typeof _0x513edf['limit']===_0xb8d9('0x1a');var _0x2d1b34=_0x24f33a[_0xb8d9('0x1b')];var _0x1183e4=_0x283780?0x0:_0x513edf['offset'];var _0x31b33f=_0x283780?_0x24f33a['count']:_0x513edf[_0xb8d9('0x1c')]+_0x513edf[_0xb8d9('0x1d')];var _0x447367;if(_0x31b33f>=_0x2d1b34){_0x31b33f=_0x2d1b34;_0x447367=0xc8;}else{_0x447367=0xce;}_0x2c5265[_0xb8d9('0x17')](_0x447367);return _0x2c5265[_0xb8d9('0x1e')]('Content-Range',_0x1183e4+'-'+_0x31b33f+'/'+_0x2d1b34)['json'](_0x24f33a);}return null;};}function patchUpdates(_0x5444a5){return function(_0x42f600){try{jsonpatch[_0xb8d9('0x1f')](_0x42f600,_0x5444a5,!![]);}catch(_0x15495f){return BPromise[_0xb8d9('0x20')](_0x15495f);}return _0x42f600[_0xb8d9('0x21')]();};}function saveUpdates(_0x48c504,_0x963afa){return function(_0x430794){if(_0x430794){return _0x430794[_0xb8d9('0x22')](_0x48c504)[_0xb8d9('0x23')](function(_0x3cefe3){return _0x3cefe3;});}return null;};}function removeEntity(_0x1d94aa,_0x3f4b9d){return function(_0x3d1659){if(_0x3d1659){return _0x3d1659[_0xb8d9('0x24')]()[_0xb8d9('0x23')](function(){var _0x52df47=_0x3d1659[_0xb8d9('0x25')]({'plain':!![]});var _0x49380d='ChanSpies';return db[_0xb8d9('0x26')][_0xb8d9('0x24')]({'where':{'type':_0x49380d,'resourceId':_0x52df47['id']}})[_0xb8d9('0x23')](function(){return _0x3d1659;});})[_0xb8d9('0x23')](function(){_0x1d94aa[_0xb8d9('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x241041,_0x282db6){return function(_0x3111aa){if(!_0x3111aa){_0x241041['sendStatus'](0x194);}return _0x3111aa;};}function handleError(_0x2d1439,_0x1c9bd4){_0x1c9bd4=_0x1c9bd4||0x1f4;return function(_0x336918){logger['error'](_0x336918[_0xb8d9('0x27')]);if(_0x336918[_0xb8d9('0x28')]){delete _0x336918['name'];}_0x2d1439[_0xb8d9('0x17')](_0x1c9bd4)[_0xb8d9('0x29')](_0x336918);};}exports[_0xb8d9('0x2a')]=function(_0x1b1212,_0x358e4d){var _0x84b01c={},_0x13120c={},_0x27ed72={'count':0x0,'rows':[]};var _0x8674fc=_[_0xb8d9('0x2b')](db['VoiceChanSpy'][_0xb8d9('0x2c')],function(_0x374def){return{'name':_0x374def[_0xb8d9('0x2d')],'type':_0x374def['type'][_0xb8d9('0x2e')]};});_0x13120c[_0xb8d9('0x2f')]=_[_0xb8d9('0x2b')](_0x8674fc,_0xb8d9('0x28'));_0x13120c[_0xb8d9('0x30')]=_[_0xb8d9('0x31')](_0x1b1212['query']);_0x13120c['filters']=_[_0xb8d9('0x32')](_0x13120c[_0xb8d9('0x2f')],_0x13120c[_0xb8d9('0x30')]);_0x84b01c[_0xb8d9('0x33')]=_[_0xb8d9('0x32')](_0x13120c[_0xb8d9('0x2f')],qs['fields'](_0x1b1212['query'][_0xb8d9('0x34')]));_0x84b01c[_0xb8d9('0x33')]=_0x84b01c[_0xb8d9('0x33')]['length']?_0x84b01c[_0xb8d9('0x33')]:_0x13120c['model'];if(!_0x1b1212[_0xb8d9('0x30')][_0xb8d9('0x35')](_0xb8d9('0x36'))){_0x84b01c['limit']=qs[_0xb8d9('0x1d')](_0x1b1212[_0xb8d9('0x30')]['limit']);_0x84b01c['offset']=qs[_0xb8d9('0x1c')](_0x1b1212[_0xb8d9('0x30')][_0xb8d9('0x1c')]);}_0x84b01c[_0xb8d9('0x37')]=qs[_0xb8d9('0x38')](_0x1b1212[_0xb8d9('0x30')][_0xb8d9('0x38')]);_0x84b01c[_0xb8d9('0x39')]=qs[_0xb8d9('0x3a')](_[_0xb8d9('0x3b')](_0x1b1212[_0xb8d9('0x30')],_0x13120c[_0xb8d9('0x3a')]),_0x8674fc);if(_0x1b1212[_0xb8d9('0x30')][_0xb8d9('0x3c')]){_0x84b01c['where']=_['merge'](_0x84b01c[_0xb8d9('0x39')],{'$or':_[_0xb8d9('0x2b')](_0x8674fc,function(_0x364bb1){if(_0x364bb1[_0xb8d9('0x3d')]!=='VIRTUAL'){var _0x4b1d71={};_0x4b1d71[_0x364bb1[_0xb8d9('0x28')]]={'$like':'%'+_0x1b1212['query'][_0xb8d9('0x3c')]+'%'};return _0x4b1d71;}})});}_0x84b01c=_['merge']({},_0x84b01c,_0x1b1212[_0xb8d9('0x3e')]);var _0x5ae97b={'where':_0x84b01c[_0xb8d9('0x39')]};return db[_0xb8d9('0x3f')][_0xb8d9('0x1b')](_0x5ae97b)['then'](function(_0x40fd3e){_0x27ed72[_0xb8d9('0x1b')]=_0x40fd3e;if(_0x1b1212[_0xb8d9('0x30')]['includeAll']){_0x84b01c['include']=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x84b01c);})['then'](function(_0xc1816a){_0x27ed72[_0xb8d9('0x40')]=_0xc1816a;return _0x27ed72;})[_0xb8d9('0x23')](respondWithFilteredResult(_0x358e4d,_0x84b01c))['catch'](handleError(_0x358e4d,null));};exports['show']=function(_0x142e54,_0x496d4f){var _0x13f7ce={'raw':![],'where':{'id':_0x142e54[_0xb8d9('0x41')]['id']}},_0x25ae38={};_0x25ae38[_0xb8d9('0x2f')]=_[_0xb8d9('0x31')](db['VoiceChanSpy'][_0xb8d9('0x2c')]);_0x25ae38[_0xb8d9('0x30')]=_['keys'](_0x142e54[_0xb8d9('0x30')]);_0x25ae38[_0xb8d9('0x3a')]=_['intersection'](_0x25ae38['model'],_0x25ae38[_0xb8d9('0x30')]);_0x13f7ce[_0xb8d9('0x33')]=_[_0xb8d9('0x32')](_0x25ae38[_0xb8d9('0x2f')],qs[_0xb8d9('0x34')](_0x142e54['query'][_0xb8d9('0x34')]));_0x13f7ce[_0xb8d9('0x33')]=_0x13f7ce[_0xb8d9('0x33')][_0xb8d9('0x42')]?_0x13f7ce[_0xb8d9('0x33')]:_0x25ae38[_0xb8d9('0x2f')];if(_0x142e54['query'][_0xb8d9('0x43')]){_0x13f7ce[_0xb8d9('0x44')]=[{'all':!![]}];}_0x13f7ce=_[_0xb8d9('0x45')]({},_0x13f7ce,_0x142e54[_0xb8d9('0x3e')]);return db[_0xb8d9('0x3f')][_0xb8d9('0x46')](_0x13f7ce)['then'](handleEntityNotFound(_0x496d4f,null))[_0xb8d9('0x23')](respondWithResult(_0x496d4f,null))[_0xb8d9('0x47')](handleError(_0x496d4f,null));};exports['create']=function(_0x212310,_0x41f38b){return db['VoiceChanSpy']['create'](_0x212310[_0xb8d9('0x48')],{})[_0xb8d9('0x23')](function(_0x3c2a57){var _0xca2c82=_0x212310[_0xb8d9('0x49')][_0xb8d9('0x25')]({'plain':!![]});if(!_0xca2c82)throw new Error(_0xb8d9('0x4a'));if(_0xca2c82['role']===_0xb8d9('0x49')){var _0x431c21=_0x3c2a57[_0xb8d9('0x25')]({'plain':!![]});var _0x53575d=_0xb8d9('0x4b');return db[_0xb8d9('0x4c')]['find']({'where':{'name':_0x53575d,'userProfileId':_0xca2c82['userProfileId']},'raw':!![]})[_0xb8d9('0x23')](function(_0x213915){if(_0x213915&&_0x213915['autoAssociation']===0x0){return db[_0xb8d9('0x26')][_0xb8d9('0x4d')]({'name':_0x431c21[_0xb8d9('0x28')],'resourceId':_0x431c21['id'],'type':_0x213915[_0xb8d9('0x28')],'sectionId':_0x213915['id']},{})['then'](function(){return _0x3c2a57;});}else{return _0x3c2a57;}})[_0xb8d9('0x47')](function(_0x3d7ea6){logger[_0xb8d9('0x4e')](_0xb8d9('0x4f'),_0x3d7ea6);throw _0x3d7ea6;});}return _0x3c2a57;})[_0xb8d9('0x23')](respondWithResult(_0x41f38b,0xc9))[_0xb8d9('0x47')](handleError(_0x41f38b,null));};exports[_0xb8d9('0x22')]=function(_0x518bb4,_0x3101da){if(_0x518bb4['body']['id']){delete _0x518bb4[_0xb8d9('0x48')]['id'];}return db[_0xb8d9('0x3f')][_0xb8d9('0x46')]({'where':{'id':_0x518bb4['params']['id']}})[_0xb8d9('0x23')](handleEntityNotFound(_0x3101da,null))[_0xb8d9('0x23')](saveUpdates(_0x518bb4[_0xb8d9('0x48')],null))[_0xb8d9('0x23')](respondWithResult(_0x3101da,null))[_0xb8d9('0x47')](handleError(_0x3101da,null));};exports[_0xb8d9('0x24')]=function(_0x4533e5,_0x3480d1){return db[_0xb8d9('0x3f')][_0xb8d9('0x46')]({'where':{'id':_0x4533e5[_0xb8d9('0x41')]['id']}})['then'](handleEntityNotFound(_0x3480d1,null))[_0xb8d9('0x23')](removeEntity(_0x3480d1,null))[_0xb8d9('0x47')](handleError(_0x3480d1,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 6e1871e..f7e687e 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 _0x504c=['VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','catch','destroy','length','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','prefix','system','push','Set','CDR(type)=%s','chanspy','record','merge','MixMonitor','${UNIQUEID}.%s,a','Authenticate','password','ChanSpy','SIP/%s,%s','options','internal','name','concat','User','findAll','agent','then','exports','models','define'];(function(_0x378830,_0xb532d7){var _0x4e4348=function(_0x496bc4){while(--_0x496bc4){_0x378830['push'](_0x378830['shift']());}};_0x4e4348(++_0xb532d7);}(_0x504c,0x13f));var _0xc504=function(_0x58efa6,_0x2c00bd){_0x58efa6=_0x58efa6-0x0;var _0x5d643c=_0x504c[_0x58efa6];return _0x5d643c;};'use strict';var _=require(_0xc504('0x0'));var util=require(_0xc504('0x1'));var BPromise=require(_0xc504('0x2'));var attributes=require(_0xc504('0x3'));var getUserApplications=function(_0x1f6d82,_0x2c3dea,_0xe292a1){var _0x29cd8=0x1;var _0x590521=[];var _0x4f4481={'context':_0x2c3dea[_0xc504('0x4')]||_0xc504('0x5'),'exten':util[_0xc504('0x6')]('%s%s',_0x1f6d82[_0xc504('0x7')],_0xe292a1),'type':_0xc504('0x8'),'isApp':![],'ChanSpyId':_0x1f6d82['id'],'UserId':_0x2c3dea['id']};_0x590521[_0xc504('0x9')](_['merge']({'app':_0xc504('0xa'),'appdata':util[_0xc504('0x6')](_0xc504('0xb'),_0xc504('0xc')),'priority':_0x29cd8++},_0x4f4481));if(_0x1f6d82[_0xc504('0xd')]){_0x590521['push'](_[_0xc504('0xe')]({'app':_0xc504('0xf'),'appdata':util[_0xc504('0x6')](_0xc504('0x10'),_0x1f6d82['recordingFormat']),'priority':_0x29cd8++},_0x4f4481));}if(_0x1f6d82['auth']){_0x590521[_0xc504('0x9')](_['merge']({'app':_0xc504('0x11'),'appdata':_0x1f6d82[_0xc504('0x12')],'priority':_0x29cd8++},_0x4f4481));}_0x590521[_0xc504('0x9')](_[_0xc504('0xe')]({'app':_0xc504('0x13'),'appdata':util[_0xc504('0x6')](_0xc504('0x14'),_0x2c3dea['name'],_0x1f6d82[_0xc504('0x15')]?_0x1f6d82[_0xc504('0x15')]['join'](''):''),'priority':_0x29cd8++},_0x4f4481));if(_0x1f6d82['record']){_0x590521[_0xc504('0x9')](_[_0xc504('0xe')]({'app':'StopMixMonitor','priority':_0x29cd8++},_0x4f4481));}return _0x590521;};var getChanSpyApplications=function(_0x504907,_0x65fbef){var _0xd92bb5=[];for(var _0x3d11e3=0x0,_0x51cda7=0x1;_0x3d11e3<_0x65fbef['length'];_0x3d11e3++,_0x51cda7=0x1){_0xd92bb5=_0xd92bb5['concat'](getUserApplications(_0x504907,_0x65fbef[_0x3d11e3],_0x65fbef[_0x3d11e3][_0xc504('0x16')]));if(_0x65fbef[_0x3d11e3][_0xc504('0x16')]!=_0x65fbef[_0x3d11e3][_0xc504('0x17')]){_0xd92bb5=_0xd92bb5[_0xc504('0x18')](getUserApplications(_0x504907,_0x65fbef[_0x3d11e3],_0x65fbef[_0x3d11e3][_0xc504('0x17')]));}}return _0xd92bb5;};var getChanSpyPromise=function(_0xd2de07,_0x716e07){return new BPromise(function(_0x4b4c0e,_0x563b6f){return _0xd2de07[_0xc504('0x19')][_0xc504('0x1a')]({'attributes':['id',_0xc504('0x17'),'internal'],'where':{'role':_0xc504('0x1b'),'chanspy':!![]},'raw':!![]})[_0xc504('0x1c')](function(_0x840d20){if(_0x840d20){return _0x4b4c0e(getChanSpyApplications(_0x716e07,_0x840d20));}return _0x4b4c0e([]);})['catch'](function(_0x1d208e){_0x563b6f(_0x1d208e);});});};module[_0xc504('0x1d')]=function(_0x20b047,_0x5a2020){var _0x2ad34e=_0x20b047[_0xc504('0x1e')];return _0x20b047[_0xc504('0x1f')](_0xc504('0x20'),attributes,{'tableName':_0xc504('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2a6b87,_0x3d8490,_0x13b85c){return getChanSpyPromise(_0x2ad34e,_0x2a6b87)[_0xc504('0x1c')](function(_0x28304b){if(_0x28304b&&_0x28304b['length']){return _0x2ad34e[_0xc504('0x22')][_0xc504('0x23')](_0x28304b);}})[_0xc504('0x1c')](function(){_0x13b85c();})[_0xc504('0x24')](function(_0x1701ca){_0x13b85c(_0x1701ca);});},'afterUpdate':function(_0x2df89d,_0x125079,_0x5bbe5a){return _0x2ad34e[_0xc504('0x22')][_0xc504('0x25')]({'where':{'ChanSpyId':_0x2df89d['id']}})[_0xc504('0x1c')](function(){return getChanSpyPromise(_0x2ad34e,_0x2df89d);})['then'](function(_0x46ab36){if(_0x46ab36&&_0x46ab36[_0xc504('0x26')]){return _0x2ad34e[_0xc504('0x22')][_0xc504('0x23')](_0x46ab36);}})[_0xc504('0x1c')](function(){_0x5bbe5a();})[_0xc504('0x24')](function(_0x5904aa){_0x5bbe5a(_0x5904aa);});},'afterDestroy':function(_0x35a84d,_0x1970c1,_0x2680d3){return _0x2ad34e[_0xc504('0x22')][_0xc504('0x25')]({'where':{'ChanSpyId':_0x35a84d['id']}})[_0xc504('0x1c')](function(){_0x2680d3();})['catch'](function(_0x1385cb){_0x2680d3(_0x1385cb);});}}});}; \ No newline at end of file +var _0xc909=['%s%s','prefix','push','Set','format','CDR(type)=%s','chanspy','record','merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','findAll','catch','exports','models','define','voice_chanspy','then','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip'];(function(_0x5e1098,_0x33a916){var _0x54cc78=function(_0x53aee2){while(--_0x53aee2){_0x5e1098['push'](_0x5e1098['shift']());}};_0x54cc78(++_0x33a916);}(_0xc909,0xc2));var _0x9c90=function(_0x38eb23,_0x196e8b){_0x38eb23=_0x38eb23-0x0;var _0x48506a=_0xc909[_0x38eb23];return _0x48506a;};'use strict';var _=require(_0x9c90('0x0'));var util=require(_0x9c90('0x1'));var BPromise=require(_0x9c90('0x2'));var attributes=require(_0x9c90('0x3'));var getUserApplications=function(_0x397c76,_0x40c67e,_0x4e3229){var _0x3998b0=0x1;var _0x36f033=[];var _0x57b2c0={'context':_0x40c67e[_0x9c90('0x4')]||_0x9c90('0x5'),'exten':util['format'](_0x9c90('0x6'),_0x397c76[_0x9c90('0x7')],_0x4e3229),'type':'system','isApp':![],'ChanSpyId':_0x397c76['id'],'UserId':_0x40c67e['id']};_0x36f033[_0x9c90('0x8')](_['merge']({'app':_0x9c90('0x9'),'appdata':util[_0x9c90('0xa')](_0x9c90('0xb'),_0x9c90('0xc')),'priority':_0x3998b0++},_0x57b2c0));if(_0x397c76[_0x9c90('0xd')]){_0x36f033[_0x9c90('0x8')](_[_0x9c90('0xe')]({'app':_0x9c90('0xf'),'appdata':util[_0x9c90('0xa')](_0x9c90('0x10'),_0x397c76[_0x9c90('0x11')]),'priority':_0x3998b0++},_0x57b2c0));}if(_0x397c76[_0x9c90('0x12')]){_0x36f033[_0x9c90('0x8')](_['merge']({'app':_0x9c90('0x13'),'appdata':_0x397c76[_0x9c90('0x14')],'priority':_0x3998b0++},_0x57b2c0));}_0x36f033[_0x9c90('0x8')](_[_0x9c90('0xe')]({'app':_0x9c90('0x15'),'appdata':util[_0x9c90('0xa')](_0x9c90('0x16'),_0x40c67e[_0x9c90('0x17')],_0x397c76[_0x9c90('0x18')]?_0x397c76[_0x9c90('0x18')][_0x9c90('0x19')](''):''),'priority':_0x3998b0++},_0x57b2c0));if(_0x397c76[_0x9c90('0xd')]){_0x36f033[_0x9c90('0x8')](_[_0x9c90('0xe')]({'app':_0x9c90('0x1a'),'priority':_0x3998b0++},_0x57b2c0));}return _0x36f033;};var getChanSpyApplications=function(_0x1c28ab,_0x31d5b0){var _0x8762a8=[];for(var _0x3cc0f9=0x0,_0xb4ea21=0x1;_0x3cc0f9<_0x31d5b0[_0x9c90('0x1b')];_0x3cc0f9++,_0xb4ea21=0x1){_0x8762a8=_0x8762a8[_0x9c90('0x1c')](getUserApplications(_0x1c28ab,_0x31d5b0[_0x3cc0f9],_0x31d5b0[_0x3cc0f9][_0x9c90('0x1d')]));if(_0x31d5b0[_0x3cc0f9][_0x9c90('0x1d')]!=_0x31d5b0[_0x3cc0f9][_0x9c90('0x17')]){_0x8762a8=_0x8762a8['concat'](getUserApplications(_0x1c28ab,_0x31d5b0[_0x3cc0f9],_0x31d5b0[_0x3cc0f9]['name']));}}return _0x8762a8;};var getChanSpyPromise=function(_0x819531,_0x22a92a){return new BPromise(function(_0x3d2160,_0x3b2a29){return _0x819531['User'][_0x9c90('0x1e')]({'attributes':['id',_0x9c90('0x17'),'internal'],'where':{'role':'agent','chanspy':!![]},'raw':!![]})['then'](function(_0x3a67d4){if(_0x3a67d4){return _0x3d2160(getChanSpyApplications(_0x22a92a,_0x3a67d4));}return _0x3d2160([]);})[_0x9c90('0x1f')](function(_0x43b0ff){_0x3b2a29(_0x43b0ff);});});};module[_0x9c90('0x20')]=function(_0x54f006,_0x2437f2){var _0xcab400=_0x54f006[_0x9c90('0x21')];return _0x54f006[_0x9c90('0x22')]('VoiceChanSpy',attributes,{'tableName':_0x9c90('0x23'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5ef9bb,_0x4fe6e5,_0x158902){return getChanSpyPromise(_0xcab400,_0x5ef9bb)[_0x9c90('0x24')](function(_0x7b4e96){if(_0x7b4e96&&_0x7b4e96[_0x9c90('0x1b')]){return _0xcab400[_0x9c90('0x25')][_0x9c90('0x26')](_0x7b4e96);}})[_0x9c90('0x24')](function(){_0x158902();})[_0x9c90('0x1f')](function(_0x3d854b){_0x158902(_0x3d854b);});},'afterUpdate':function(_0x1320d5,_0x5e7672,_0x472d1c){return _0xcab400['VoiceExtension'][_0x9c90('0x27')]({'where':{'ChanSpyId':_0x1320d5['id']}})[_0x9c90('0x24')](function(){return getChanSpyPromise(_0xcab400,_0x1320d5);})[_0x9c90('0x24')](function(_0x3c1eba){if(_0x3c1eba&&_0x3c1eba[_0x9c90('0x1b')]){return _0xcab400[_0x9c90('0x25')][_0x9c90('0x26')](_0x3c1eba);}})[_0x9c90('0x24')](function(){_0x472d1c();})[_0x9c90('0x1f')](function(_0x298b9e){_0x472d1c(_0x298b9e);});},'afterDestroy':function(_0x5136f3,_0x468b60,_0x4f4278){return _0xcab400[_0x9c90('0x25')][_0x9c90('0x27')]({'where':{'ChanSpyId':_0x5136f3['id']}})[_0x9c90('0x24')](function(){_0x4f4278();})[_0x9c90('0x1f')](function(_0x55cae3){_0x4f4278(_0x55cae3);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 93a2f40..8fc5eb7 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 _0xac4a=['VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xac4a,0x13f));var _0xaac4=function(_0x3a0be9,_0x4cb812){_0x3a0be9=_0x3a0be9-0x0;var _0x31a9de=_0xac4a[_0x3a0be9];return _0x31a9de;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('VoiceChanSpy,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file +var _0x693f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','debug','request\x20sent','stringify','error','code','message','info','VoiceChanSpy,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird'];(function(_0x2cedc5,_0x2fabcd){var _0x22032d=function(_0x3543dc){while(--_0x3543dc){_0x2cedc5['push'](_0x2cedc5['shift']());}};_0x22032d(++_0x2fabcd);}(_0x693f,0x9d));var _0xf693=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x693f[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xf693('0x0'));var util=require(_0xf693('0x1'));var moment=require(_0xf693('0x2'));var BPromise=require(_0xf693('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf693('0x4'));var db=require(_0xf693('0x5'))['db'];var utils=require(_0xf693('0x6'));var logger=require(_0xf693('0x7'))(_0xf693('0x8'));var config=require(_0xf693('0x9'));var jayson=require(_0xf693('0xa'));var client=jayson['client'][_0xf693('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33305c,_0x5b91c5,_0x22f362){return new BPromise(function(_0x594505,_0x38e78a){return client['request'](_0x33305c,_0x22f362)[_0xf693('0xc')](function(_0x17075d){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x5b91c5,'request\x20sent');logger[_0xf693('0xd')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x5b91c5,_0xf693('0xe'),JSON[_0xf693('0xf')](_0x17075d));if(_0x17075d[_0xf693('0x10')]){if(_0x17075d[_0xf693('0x10')][_0xf693('0x11')]===0x1f4){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x5b91c5,_0x17075d[_0xf693('0x10')][_0xf693('0x12')]);return _0x38e78a(_0x17075d['error'][_0xf693('0x12')]);}logger[_0xf693('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x5b91c5,_0x17075d['error'][_0xf693('0x12')]);return _0x594505(_0x17075d[_0xf693('0x10')][_0xf693('0x12')]);}else{logger[_0xf693('0x13')](_0xf693('0x14'),_0x5b91c5,'request\x20sent');_0x594505(_0x17075d[_0xf693('0x15')][_0xf693('0x12')]);}})[_0xf693('0x16')](function(_0x2a5e1b){logger[_0xf693('0x10')](_0xf693('0x14'),_0x5b91c5,_0x2a5e1b);_0x38e78a(_0x2a5e1b);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 32d9252..4b09473 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 _0xf3cc=['path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','exports','multer','util'];(function(_0x256d13,_0x412205){var _0x1017b8=function(_0x14a4b6){while(--_0x14a4b6){_0x256d13['push'](_0x256d13['shift']());}};_0x1017b8(++_0x412205);}(_0xf3cc,0x12e));var _0xcf3c=function(_0x3c1304,_0x219ae5){_0x3c1304=_0x3c1304-0x0;var _0x11b071=_0xf3cc[_0x3c1304];return _0x11b071;};'use strict';var multer=require(_0xcf3c('0x0'));var util=require(_0xcf3c('0x1'));var path=require(_0xcf3c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xcf3c('0x3'));var auth=require(_0xcf3c('0x4'));var interaction=require(_0xcf3c('0x5'));var config=require(_0xcf3c('0x6'));var controller=require(_0xcf3c('0x7'));router[_0xcf3c('0x8')]('/',auth['isAuthenticated'](),controller[_0xcf3c('0x9')]);router[_0xcf3c('0x8')](_0xcf3c('0xa'),auth[_0xcf3c('0xb')](),controller[_0xcf3c('0xc')]);router[_0xcf3c('0xd')]('/',auth['isAuthenticated'](),controller[_0xcf3c('0xe')]);router[_0xcf3c('0xf')]('/:id',auth[_0xcf3c('0xb')](),controller[_0xcf3c('0x10')]);router[_0xcf3c('0x11')](_0xcf3c('0xa'),auth[_0xcf3c('0xb')](),controller['destroy']);module[_0xcf3c('0x12')]=router; \ No newline at end of file +var _0x0722=['get','isAuthenticated','index','/:id','show','post','create','destroy','multer','util','path','express','Router','../../components/auth/service','../../config/environment'];(function(_0x34bedc,_0x5639f9){var _0x247dfd=function(_0x5f3696){while(--_0x5f3696){_0x34bedc['push'](_0x34bedc['shift']());}};_0x247dfd(++_0x5639f9);}(_0x0722,0x71));var _0x2072=function(_0x539112,_0x2a502a){_0x539112=_0x539112-0x0;var _0x2a47b9=_0x0722[_0x539112];return _0x2a47b9;};'use strict';var multer=require(_0x2072('0x0'));var util=require(_0x2072('0x1'));var path=require(_0x2072('0x2'));var timeout=require('connect-timeout');var express=require(_0x2072('0x3'));var router=express[_0x2072('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2072('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2072('0x6'));var controller=require('./voiceContext.controller');router[_0x2072('0x7')]('/',auth[_0x2072('0x8')](),controller[_0x2072('0x9')]);router[_0x2072('0x7')](_0x2072('0xa'),auth['isAuthenticated'](),controller[_0x2072('0xb')]);router[_0x2072('0xc')]('/',auth[_0x2072('0x8')](),controller[_0x2072('0xd')]);router['put'](_0x2072('0xa'),auth[_0x2072('0x8')](),controller['update']);router['delete'](_0x2072('0xa'),auth[_0x2072('0x8')](),controller[_0x2072('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 1d6b68c..4fb3954 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 _0xb478=['sequelize','STRING','name','BOOLEAN'];(function(_0x476f98,_0x5d1b4e){var _0xd54987=function(_0x11511b){while(--_0x11511b){_0x476f98['push'](_0x476f98['shift']());}};_0xd54987(++_0x5d1b4e);}(_0xb478,0x140));var _0x8b47=function(_0x1c66f1,_0x53c85c){_0x1c66f1=_0x1c66f1-0x0;var _0x682d89=_0xb478[_0x1c66f1];return _0x682d89;};'use strict';var Sequelize=require(_0x8b47('0x0'));module['exports']={'name':{'type':Sequelize[_0x8b47('0x1')],'unique':_0x8b47('0x2')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x8b47('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc392=['STRING','name','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc392,0xba));var _0x2c39=function(_0x5170b2,_0x132900){_0x5170b2=_0x5170b2-0x0;var _0x35641a=_0xc392[_0x5170b2];return _0x35641a;};'use strict';var Sequelize=require(_0x2c39('0x0'));module[_0x2c39('0x1')]={'name':{'type':Sequelize[_0x2c39('0x2')],'unique':_0x2c39('0x3')},'description':{'type':Sequelize[_0x2c39('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index b5676e6..98783cb 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 _0x0e85=['order','sort','where','filters','filter','merge','includeAll','include','findAll','params','keys','find','create','body','join','root','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','writeFileSync','chan_sip.so','readFileSync','server/files/templates/context.ejs','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','http','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','stack','name','send','map','VoiceContext','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x0e85,0x146));var _0x50e8=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x0e85[_0x1da527];return _0x40fc7c;};'use strict';var emlformat=require(_0x50e8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x50e8('0x1'));var rp=require(_0x50e8('0x2'));var moment=require(_0x50e8('0x3'));var BPromise=require(_0x50e8('0x4'));var Mustache=require(_0x50e8('0x5'));var util=require(_0x50e8('0x6'));var path=require(_0x50e8('0x7'));var sox=require(_0x50e8('0x8'));var csv=require(_0x50e8('0x9'));var ejs=require(_0x50e8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x50e8('0xb'));var squel=require(_0x50e8('0xc'));var crypto=require('crypto');var jsforce=require(_0x50e8('0xd'));var deskjs=require(_0x50e8('0xe'));var toCsv=require(_0x50e8('0x9'));var querystring=require(_0x50e8('0xf'));var Papa=require(_0x50e8('0x10'));var Redis=require(_0x50e8('0x11'));var authService=require(_0x50e8('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x50e8('0x13'));var logger=require(_0x50e8('0x14'))(_0x50e8('0x15'));var utils=require(_0x50e8('0x16'));var config=require(_0x50e8('0x17'));var licenseUtil=require(_0x50e8('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x50e8('0x19'));var client=jayson['client'][_0x50e8('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x339092,_0x5751ab,_0x3bce4a,_0x429c9e){return new BPromise(function(_0x350572,_0x37eb73){var _0x3cbaa3=_0x429c9e||client;return _0x3cbaa3[_0x50e8('0x1b')](_0x339092,_0x3bce4a)[_0x50e8('0x1c')](function(_0x7bad63){logger['info'](_0x50e8('0x1d'),_0x5751ab,'request\x20sent');logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x5751ab,_0x50e8('0x1e'),JSON[_0x50e8('0x1f')](_0x7bad63));if(_0x7bad63[_0x50e8('0x20')]){if(_0x7bad63[_0x50e8('0x20')][_0x50e8('0x21')]===0x1f4){logger[_0x50e8('0x20')](_0x50e8('0x1d'),_0x5751ab,_0x7bad63[_0x50e8('0x20')][_0x50e8('0x22')]);return _0x37eb73(_0x7bad63['error']['message']);}logger['error'](_0x50e8('0x1d'),_0x5751ab,_0x7bad63['error']['message']);return _0x350572(_0x7bad63[_0x50e8('0x20')]['message']);}else{logger[_0x50e8('0x23')](_0x50e8('0x1d'),_0x5751ab,_0x50e8('0x1e'));_0x350572(_0x7bad63[_0x50e8('0x24')]['message']);}})[_0x50e8('0x25')](function(_0x4b36bd){logger[_0x50e8('0x20')](_0x50e8('0x1d'),_0x5751ab,_0x4b36bd);_0x37eb73(_0x4b36bd);});});}function respondWithStatusCode(_0x5a0bd6,_0x25c22a){_0x25c22a=_0x25c22a||0xcc;return function(_0x4f71ab){if(_0x4f71ab){return _0x5a0bd6[_0x50e8('0x26')](_0x25c22a);}return _0x5a0bd6[_0x50e8('0x27')](_0x25c22a)[_0x50e8('0x28')]();};}function respondWithResult(_0x3912c6,_0xd82a64){_0xd82a64=_0xd82a64||0xc8;return function(_0x1491ea){if(_0x1491ea){return _0x3912c6[_0x50e8('0x27')](_0xd82a64)[_0x50e8('0x29')](_0x1491ea);}};}function respondWithFilteredResult(_0x575b2c,_0x16a455){return function(_0x23aecf){if(_0x23aecf){var _0x275723=typeof _0x16a455[_0x50e8('0x2a')]===_0x50e8('0x2b')&&typeof _0x16a455[_0x50e8('0x2c')]===_0x50e8('0x2b');var _0x8214d1=_0x23aecf[_0x50e8('0x2d')];var _0x54a5ce=_0x275723?0x0:_0x16a455[_0x50e8('0x2a')];var _0x4d3d3a=_0x275723?_0x23aecf['count']:_0x16a455[_0x50e8('0x2a')]+_0x16a455['limit'];var _0x5b50ee;if(_0x4d3d3a>=_0x8214d1){_0x4d3d3a=_0x8214d1;_0x5b50ee=0xc8;}else{_0x5b50ee=0xce;}_0x575b2c[_0x50e8('0x27')](_0x5b50ee);return _0x575b2c[_0x50e8('0x2e')](_0x50e8('0x2f'),_0x54a5ce+'-'+_0x4d3d3a+'/'+_0x8214d1)[_0x50e8('0x29')](_0x23aecf);}return null;};}function patchUpdates(_0x3e8b1e){return function(_0x52be94){try{jsonpatch[_0x50e8('0x30')](_0x52be94,_0x3e8b1e,!![]);}catch(_0xece87){return BPromise[_0x50e8('0x31')](_0xece87);}return _0x52be94[_0x50e8('0x32')]();};}function saveUpdates(_0x595e70,_0x594f7a){return function(_0xbbd7fa){if(_0xbbd7fa){return _0xbbd7fa[_0x50e8('0x33')](_0x595e70)['then'](function(_0x40c90c){return _0x40c90c;});}return null;};}function removeEntity(_0x285ee5,_0x2a8929){return function(_0x3b7d7b){if(_0x3b7d7b){return _0x3b7d7b[_0x50e8('0x34')]()[_0x50e8('0x1c')](function(){var _0x5a9c6c=_0x3b7d7b[_0x50e8('0x35')]({'plain':!![]});var _0x558540='Contexts';return db[_0x50e8('0x36')][_0x50e8('0x34')]({'where':{'type':_0x558540,'resourceId':_0x5a9c6c['id']}})[_0x50e8('0x1c')](function(){return _0x3b7d7b;});})[_0x50e8('0x1c')](function(){_0x285ee5[_0x50e8('0x27')](0xcc)[_0x50e8('0x28')]();});}};}function handleEntityNotFound(_0x5e91f0,_0x332577){return function(_0x82cb3d){if(!_0x82cb3d){_0x5e91f0[_0x50e8('0x26')](0x194);}return _0x82cb3d;};}function handleError(_0x25c19d,_0x3f7ecc){_0x3f7ecc=_0x3f7ecc||0x1f4;return function(_0x3878f5){logger[_0x50e8('0x20')](_0x3878f5[_0x50e8('0x37')]);if(_0x3878f5[_0x50e8('0x38')]){delete _0x3878f5[_0x50e8('0x38')];}_0x25c19d[_0x50e8('0x27')](_0x3f7ecc)[_0x50e8('0x39')](_0x3878f5);};}exports['index']=function(_0x1a92d9,_0xd70319){var _0x119c83={},_0x49164f={},_0xeac0a3={'count':0x0,'rows':[]};var _0x355ee0=_[_0x50e8('0x3a')](db[_0x50e8('0x3b')][_0x50e8('0x3c')],function(_0x397b5e){return{'name':_0x397b5e[_0x50e8('0x3d')],'type':_0x397b5e[_0x50e8('0x3e')]['key']};});_0x49164f[_0x50e8('0x3f')]=_['map'](_0x355ee0,_0x50e8('0x38'));_0x49164f[_0x50e8('0x40')]=_['keys'](_0x1a92d9[_0x50e8('0x40')]);_0x49164f['filters']=_[_0x50e8('0x41')](_0x49164f[_0x50e8('0x3f')],_0x49164f[_0x50e8('0x40')]);_0x119c83[_0x50e8('0x42')]=_[_0x50e8('0x41')](_0x49164f[_0x50e8('0x3f')],qs[_0x50e8('0x43')](_0x1a92d9[_0x50e8('0x40')][_0x50e8('0x43')]));_0x119c83[_0x50e8('0x42')]=_0x119c83['attributes'][_0x50e8('0x44')]?_0x119c83[_0x50e8('0x42')]:_0x49164f[_0x50e8('0x3f')];if(!_0x1a92d9['query'][_0x50e8('0x45')]('nolimit')){_0x119c83[_0x50e8('0x2c')]=qs[_0x50e8('0x2c')](_0x1a92d9[_0x50e8('0x40')][_0x50e8('0x2c')]);_0x119c83[_0x50e8('0x2a')]=qs[_0x50e8('0x2a')](_0x1a92d9[_0x50e8('0x40')][_0x50e8('0x2a')]);}_0x119c83[_0x50e8('0x46')]=qs[_0x50e8('0x47')](_0x1a92d9['query'][_0x50e8('0x47')]);_0x119c83[_0x50e8('0x48')]=qs[_0x50e8('0x49')](_['pick'](_0x1a92d9['query'],_0x49164f[_0x50e8('0x49')]),_0x355ee0);if(_0x1a92d9['query'][_0x50e8('0x4a')]){_0x119c83[_0x50e8('0x48')]=_[_0x50e8('0x4b')](_0x119c83[_0x50e8('0x48')],{'$or':_[_0x50e8('0x3a')](_0x355ee0,function(_0x5676c4){if(_0x5676c4[_0x50e8('0x3e')]!=='VIRTUAL'){var _0x1a00b2={};_0x1a00b2[_0x5676c4[_0x50e8('0x38')]]={'$like':'%'+_0x1a92d9[_0x50e8('0x40')][_0x50e8('0x4a')]+'%'};return _0x1a00b2;}})});}_0x119c83=_[_0x50e8('0x4b')]({},_0x119c83,_0x1a92d9['options']);var _0x144fde={'where':_0x119c83['where']};return db['VoiceContext'][_0x50e8('0x2d')](_0x144fde)['then'](function(_0x21bf0c){_0xeac0a3[_0x50e8('0x2d')]=_0x21bf0c;if(_0x1a92d9['query'][_0x50e8('0x4c')]){_0x119c83[_0x50e8('0x4d')]=[{'all':!![]}];}return db['VoiceContext'][_0x50e8('0x4e')](_0x119c83);})[_0x50e8('0x1c')](function(_0x2dc3ae){_0xeac0a3['rows']=_0x2dc3ae;return _0xeac0a3;})[_0x50e8('0x1c')](respondWithFilteredResult(_0xd70319,_0x119c83))[_0x50e8('0x25')](handleError(_0xd70319,null));};exports['show']=function(_0x5ccbeb,_0x1328a2){var _0x1f309c={'raw':![],'where':{'id':_0x5ccbeb[_0x50e8('0x4f')]['id']}},_0x254a21={};_0x254a21['model']=_[_0x50e8('0x50')](db[_0x50e8('0x3b')][_0x50e8('0x3c')]);_0x254a21[_0x50e8('0x40')]=_[_0x50e8('0x50')](_0x5ccbeb[_0x50e8('0x40')]);_0x254a21[_0x50e8('0x49')]=_['intersection'](_0x254a21[_0x50e8('0x3f')],_0x254a21[_0x50e8('0x40')]);_0x1f309c['attributes']=_[_0x50e8('0x41')](_0x254a21['model'],qs[_0x50e8('0x43')](_0x5ccbeb[_0x50e8('0x40')][_0x50e8('0x43')]));_0x1f309c[_0x50e8('0x42')]=_0x1f309c[_0x50e8('0x42')]['length']?_0x1f309c[_0x50e8('0x42')]:_0x254a21['model'];if(_0x5ccbeb['query']['includeAll']){_0x1f309c[_0x50e8('0x4d')]=[{'all':!![]}];}_0x1f309c=_['merge']({},_0x1f309c,_0x5ccbeb['options']);return db['VoiceContext'][_0x50e8('0x51')](_0x1f309c)[_0x50e8('0x1c')](handleEntityNotFound(_0x1328a2,null))[_0x50e8('0x1c')](respondWithResult(_0x1328a2,null))['catch'](handleError(_0x1328a2,null));};exports[_0x50e8('0x52')]=function(_0x4389e7,_0x5d11e8,_0x43621b){var _0xb99890;return db[_0x50e8('0x3b')][_0x50e8('0x52')](_0x4389e7[_0x50e8('0x53')],{'raw':!![]})[_0x50e8('0x1c')](function(_0x46754a){_0xb99890=_0x46754a;return db[_0x50e8('0x3b')][_0x50e8('0x4e')]({'raw':!![]});})['then'](function(_0xa956ec){var _0x2a9636=fs['readFileSync'](path[_0x50e8('0x54')](config[_0x50e8('0x55')],'server/files/templates/context.ejs'),_0x50e8('0x56'));var _0x1d7ef2=ejs[_0x50e8('0x57')](_0x2a9636,{'contexts':_0xa956ec||[]});fs['writeFileSync'](_0x50e8('0x58'),_0x1d7ef2);})[_0x50e8('0x1c')](function(){return respondWithRpcPromise(_0x50e8('0x59'),_0x50e8('0x52'),{'module':'chan_sip.so'});})['then'](function(){var _0x32e43f=_0x4389e7[_0x50e8('0x5a')]['get']({'plain':!![]});if(!_0x32e43f)throw new Error(_0x50e8('0x5b'));if(_0x32e43f['role']===_0x50e8('0x5a')){var _0x588e33=_0xb99890[_0x50e8('0x35')]({'plain':!![]});return db['UserProfileSection'][_0x50e8('0x51')]({'where':{'name':'Contexts','userProfileId':_0x32e43f[_0x50e8('0x5c')]},'raw':!![]})[_0x50e8('0x1c')](function(_0x34c139){if(_0x34c139&&_0x34c139[_0x50e8('0x5d')]===0x0){return db[_0x50e8('0x36')][_0x50e8('0x52')]({'name':_0x588e33['name'],'resourceId':_0x588e33['id'],'type':_0x34c139['name'],'sectionId':_0x34c139['id']},{})[_0x50e8('0x1c')](function(){return _0xb99890;});}else{return _0xb99890;}})[_0x50e8('0x25')](function(_0x4fbcf4){logger['error'](_0x50e8('0x5e'),_0x4fbcf4);throw _0x4fbcf4;});}return _0xb99890;})['then'](respondWithResult(_0x5d11e8,0xc9))[_0x50e8('0x25')](handleError(_0x5d11e8,null));};exports[_0x50e8('0x33')]=function(_0x390056,_0x434f32,_0x167b57){var _0xc7c7df;return db[_0x50e8('0x3b')]['find']({'where':{'id':_0x390056[_0x50e8('0x4f')]['id']}})[_0x50e8('0x1c')](handleEntityNotFound(_0x434f32,null))['then'](saveUpdates(_0x390056[_0x50e8('0x53')],null))[_0x50e8('0x1c')](function(_0x4658c8){if(_0x4658c8){_0xc7c7df=_0x4658c8;return db['VoiceContext'][_0x50e8('0x4e')]({'raw':!![]});}})[_0x50e8('0x1c')](function(_0x39cb5c){var _0x42b7d5=fs['readFileSync'](path[_0x50e8('0x54')](config[_0x50e8('0x55')],'server/files/templates/context.ejs'),_0x50e8('0x56'));var _0x5222d6=ejs[_0x50e8('0x57')](_0x42b7d5,{'contexts':_0x39cb5c||[]});fs[_0x50e8('0x5f')](_0x50e8('0x58'),_0x5222d6);})[_0x50e8('0x1c')](function(){return respondWithRpcPromise(_0x50e8('0x59'),'update',{'module':_0x50e8('0x60')});})[_0x50e8('0x1c')](function(){return _0xc7c7df;})['then'](respondWithResult(_0x434f32,null))[_0x50e8('0x25')](handleError(_0x434f32,null));};exports[_0x50e8('0x34')]=function(_0x180e10,_0xcc821d,_0x18512b){var _0x40e8ea;return db[_0x50e8('0x3b')]['find']({'where':{'id':_0x180e10['params']['id']}})[_0x50e8('0x1c')](handleEntityNotFound(_0xcc821d,null))[_0x50e8('0x1c')](removeEntity(_0xcc821d,null))[_0x50e8('0x1c')](function(){return db[_0x50e8('0x3b')][_0x50e8('0x4e')]({'raw':!![]});})['then'](function(_0x5b1224){var _0x5e1cf0=fs[_0x50e8('0x61')](path[_0x50e8('0x54')](config[_0x50e8('0x55')],_0x50e8('0x62')),_0x50e8('0x56'));var _0x7ddf9b=ejs['render'](_0x5e1cf0,{'contexts':_0x5b1224});fs[_0x50e8('0x5f')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x7ddf9b);return respondWithRpcPromise(_0x50e8('0x59'),'destroy',{'module':_0x50e8('0x60')});})[_0x50e8('0x25')](handleError(_0xcc821d,null));}; \ No newline at end of file +var _0xf193=['attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','rows','params','find','create','findAll','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','readFileSync','chan_sip.so','join','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','json','undefined','limit','offset','apply','save','update','then','destroy','get','Contexts','stack','name','send','index','map','VoiceContext','rawAttributes','type','query','keys','filters','intersection','model'];(function(_0x2a3ce4,_0x974797){var _0x192665=function(_0x1542c3){while(--_0x1542c3){_0x2a3ce4['push'](_0x2a3ce4['shift']());}};_0x192665(++_0x974797);}(_0xf193,0x1c5));var _0x3f19=function(_0x56d599,_0xde964d){_0x56d599=_0x56d599-0x0;var _0x32edd5=_0xf193[_0x56d599];return _0x32edd5;};'use strict';var emlformat=require(_0x3f19('0x0'));var rimraf=require(_0x3f19('0x1'));var zipdir=require(_0x3f19('0x2'));var jsonpatch=require(_0x3f19('0x3'));var rp=require(_0x3f19('0x4'));var moment=require(_0x3f19('0x5'));var BPromise=require(_0x3f19('0x6'));var Mustache=require(_0x3f19('0x7'));var util=require(_0x3f19('0x8'));var path=require('path');var sox=require(_0x3f19('0x9'));var csv=require(_0x3f19('0xa'));var ejs=require(_0x3f19('0xb'));var fs=require('fs');var fs_extra=require(_0x3f19('0xc'));var _=require(_0x3f19('0xd'));var squel=require(_0x3f19('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3f19('0xf'));var toCsv=require(_0x3f19('0xa'));var querystring=require('querystring');var Papa=require(_0x3f19('0x10'));var Redis=require(_0x3f19('0x11'));var authService=require(_0x3f19('0x12'));var qs=require(_0x3f19('0x13'));var as=require(_0x3f19('0x14'));var hardwareService=require(_0x3f19('0x15'));var logger=require(_0x3f19('0x16'))(_0x3f19('0x17'));var utils=require(_0x3f19('0x18'));var config=require(_0x3f19('0x19'));var licenseUtil=require(_0x3f19('0x1a'));var db=require(_0x3f19('0x1b'))['db'];var jayson=require(_0x3f19('0x1c'));var client=jayson[_0x3f19('0x1d')][_0x3f19('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2e3131,_0x20de9f,_0x2a6881,_0x3857a1){return new BPromise(function(_0x398c46,_0x549815){var _0x4deeff=_0x3857a1||client;return _0x4deeff['request'](_0x2e3131,_0x2a6881)['then'](function(_0x422f09){logger['info'](_0x3f19('0x1f'),_0x20de9f,_0x3f19('0x20'));logger['debug'](_0x3f19('0x21'),_0x20de9f,_0x3f19('0x20'),JSON[_0x3f19('0x22')](_0x422f09));if(_0x422f09[_0x3f19('0x23')]){if(_0x422f09[_0x3f19('0x23')][_0x3f19('0x24')]===0x1f4){logger[_0x3f19('0x23')]('VoiceContext,\x20%s,\x20%s',_0x20de9f,_0x422f09[_0x3f19('0x23')][_0x3f19('0x25')]);return _0x549815(_0x422f09[_0x3f19('0x23')]['message']);}logger[_0x3f19('0x23')]('VoiceContext,\x20%s,\x20%s',_0x20de9f,_0x422f09[_0x3f19('0x23')][_0x3f19('0x25')]);return _0x398c46(_0x422f09[_0x3f19('0x23')][_0x3f19('0x25')]);}else{logger[_0x3f19('0x26')](_0x3f19('0x1f'),_0x20de9f,_0x3f19('0x20'));_0x398c46(_0x422f09[_0x3f19('0x27')][_0x3f19('0x25')]);}})[_0x3f19('0x28')](function(_0x124dff){logger[_0x3f19('0x23')](_0x3f19('0x1f'),_0x20de9f,_0x124dff);_0x549815(_0x124dff);});});}function respondWithStatusCode(_0x1dade4,_0x3c75ae){_0x3c75ae=_0x3c75ae||0xcc;return function(_0x40f46b){if(_0x40f46b){return _0x1dade4[_0x3f19('0x29')](_0x3c75ae);}return _0x1dade4[_0x3f19('0x2a')](_0x3c75ae)['end']();};}function respondWithResult(_0x3e7cbc,_0x2ae5da){_0x2ae5da=_0x2ae5da||0xc8;return function(_0x4a2731){if(_0x4a2731){return _0x3e7cbc[_0x3f19('0x2a')](_0x2ae5da)[_0x3f19('0x2b')](_0x4a2731);}};}function respondWithFilteredResult(_0x5ac020,_0x4297e4){return function(_0x2e0c8d){if(_0x2e0c8d){var _0x3a0d77=typeof _0x4297e4['offset']===_0x3f19('0x2c')&&typeof _0x4297e4[_0x3f19('0x2d')]===_0x3f19('0x2c');var _0x19f168=_0x2e0c8d['count'];var _0x195b28=_0x3a0d77?0x0:_0x4297e4[_0x3f19('0x2e')];var _0x2eb533=_0x3a0d77?_0x2e0c8d['count']:_0x4297e4['offset']+_0x4297e4[_0x3f19('0x2d')];var _0x39286b;if(_0x2eb533>=_0x19f168){_0x2eb533=_0x19f168;_0x39286b=0xc8;}else{_0x39286b=0xce;}_0x5ac020['status'](_0x39286b);return _0x5ac020['set']('Content-Range',_0x195b28+'-'+_0x2eb533+'/'+_0x19f168)[_0x3f19('0x2b')](_0x2e0c8d);}return null;};}function patchUpdates(_0xb2129f){return function(_0x114092){try{jsonpatch[_0x3f19('0x2f')](_0x114092,_0xb2129f,!![]);}catch(_0x8032cc){return BPromise['reject'](_0x8032cc);}return _0x114092[_0x3f19('0x30')]();};}function saveUpdates(_0x4d52b6,_0x3f5ad3){return function(_0x4265d4){if(_0x4265d4){return _0x4265d4[_0x3f19('0x31')](_0x4d52b6)[_0x3f19('0x32')](function(_0x263934){return _0x263934;});}return null;};}function removeEntity(_0x3130be,_0x5f4ee5){return function(_0x374b79){if(_0x374b79){return _0x374b79[_0x3f19('0x33')]()[_0x3f19('0x32')](function(){var _0x56404c=_0x374b79[_0x3f19('0x34')]({'plain':!![]});var _0x484394=_0x3f19('0x35');return db['UserProfileResource'][_0x3f19('0x33')]({'where':{'type':_0x484394,'resourceId':_0x56404c['id']}})[_0x3f19('0x32')](function(){return _0x374b79;});})[_0x3f19('0x32')](function(){_0x3130be[_0x3f19('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1648b2,_0x17aee5){return function(_0x2dfd09){if(!_0x2dfd09){_0x1648b2[_0x3f19('0x29')](0x194);}return _0x2dfd09;};}function handleError(_0x4cdad6,_0x22d41a){_0x22d41a=_0x22d41a||0x1f4;return function(_0x4fec5e){logger['error'](_0x4fec5e[_0x3f19('0x36')]);if(_0x4fec5e[_0x3f19('0x37')]){delete _0x4fec5e[_0x3f19('0x37')];}_0x4cdad6[_0x3f19('0x2a')](_0x22d41a)[_0x3f19('0x38')](_0x4fec5e);};}exports[_0x3f19('0x39')]=function(_0x223698,_0x53f1a3){var _0x4ec69a={},_0xd87f9f={},_0x575e60={'count':0x0,'rows':[]};var _0x515297=_[_0x3f19('0x3a')](db[_0x3f19('0x3b')][_0x3f19('0x3c')],function(_0x3d7c5b){return{'name':_0x3d7c5b['fieldName'],'type':_0x3d7c5b[_0x3f19('0x3d')]['key']};});_0xd87f9f['model']=_[_0x3f19('0x3a')](_0x515297,_0x3f19('0x37'));_0xd87f9f[_0x3f19('0x3e')]=_[_0x3f19('0x3f')](_0x223698[_0x3f19('0x3e')]);_0xd87f9f[_0x3f19('0x40')]=_[_0x3f19('0x41')](_0xd87f9f[_0x3f19('0x42')],_0xd87f9f[_0x3f19('0x3e')]);_0x4ec69a[_0x3f19('0x43')]=_[_0x3f19('0x41')](_0xd87f9f[_0x3f19('0x42')],qs[_0x3f19('0x44')](_0x223698['query'][_0x3f19('0x44')]));_0x4ec69a[_0x3f19('0x43')]=_0x4ec69a[_0x3f19('0x43')][_0x3f19('0x45')]?_0x4ec69a[_0x3f19('0x43')]:_0xd87f9f['model'];if(!_0x223698[_0x3f19('0x3e')][_0x3f19('0x46')]('nolimit')){_0x4ec69a['limit']=qs['limit'](_0x223698[_0x3f19('0x3e')]['limit']);_0x4ec69a['offset']=qs[_0x3f19('0x2e')](_0x223698[_0x3f19('0x3e')][_0x3f19('0x2e')]);}_0x4ec69a[_0x3f19('0x47')]=qs[_0x3f19('0x48')](_0x223698[_0x3f19('0x3e')]['sort']);_0x4ec69a[_0x3f19('0x49')]=qs['filters'](_[_0x3f19('0x4a')](_0x223698[_0x3f19('0x3e')],_0xd87f9f[_0x3f19('0x40')]),_0x515297);if(_0x223698['query'][_0x3f19('0x4b')]){_0x4ec69a[_0x3f19('0x49')]=_[_0x3f19('0x4c')](_0x4ec69a[_0x3f19('0x49')],{'$or':_[_0x3f19('0x3a')](_0x515297,function(_0x10bb24){if(_0x10bb24[_0x3f19('0x3d')]!==_0x3f19('0x4d')){var _0x27b8ea={};_0x27b8ea[_0x10bb24[_0x3f19('0x37')]]={'$like':'%'+_0x223698[_0x3f19('0x3e')][_0x3f19('0x4b')]+'%'};return _0x27b8ea;}})});}_0x4ec69a=_[_0x3f19('0x4c')]({},_0x4ec69a,_0x223698['options']);var _0x10fdd3={'where':_0x4ec69a[_0x3f19('0x49')]};return db['VoiceContext'][_0x3f19('0x4e')](_0x10fdd3)[_0x3f19('0x32')](function(_0xe6ee32){_0x575e60[_0x3f19('0x4e')]=_0xe6ee32;if(_0x223698[_0x3f19('0x3e')][_0x3f19('0x4f')]){_0x4ec69a[_0x3f19('0x50')]=[{'all':!![]}];}return db[_0x3f19('0x3b')]['findAll'](_0x4ec69a);})[_0x3f19('0x32')](function(_0x3b9c1a){_0x575e60[_0x3f19('0x51')]=_0x3b9c1a;return _0x575e60;})['then'](respondWithFilteredResult(_0x53f1a3,_0x4ec69a))[_0x3f19('0x28')](handleError(_0x53f1a3,null));};exports['show']=function(_0x3180a9,_0x1eba19){var _0x3fcb09={'raw':![],'where':{'id':_0x3180a9[_0x3f19('0x52')]['id']}},_0x10b129={};_0x10b129[_0x3f19('0x42')]=_[_0x3f19('0x3f')](db[_0x3f19('0x3b')][_0x3f19('0x3c')]);_0x10b129[_0x3f19('0x3e')]=_['keys'](_0x3180a9['query']);_0x10b129['filters']=_['intersection'](_0x10b129[_0x3f19('0x42')],_0x10b129[_0x3f19('0x3e')]);_0x3fcb09[_0x3f19('0x43')]=_[_0x3f19('0x41')](_0x10b129['model'],qs[_0x3f19('0x44')](_0x3180a9[_0x3f19('0x3e')][_0x3f19('0x44')]));_0x3fcb09[_0x3f19('0x43')]=_0x3fcb09['attributes'][_0x3f19('0x45')]?_0x3fcb09[_0x3f19('0x43')]:_0x10b129[_0x3f19('0x42')];if(_0x3180a9['query']['includeAll']){_0x3fcb09[_0x3f19('0x50')]=[{'all':!![]}];}_0x3fcb09=_[_0x3f19('0x4c')]({},_0x3fcb09,_0x3180a9['options']);return db['VoiceContext'][_0x3f19('0x53')](_0x3fcb09)[_0x3f19('0x32')](handleEntityNotFound(_0x1eba19,null))[_0x3f19('0x32')](respondWithResult(_0x1eba19,null))[_0x3f19('0x28')](handleError(_0x1eba19,null));};exports['create']=function(_0x1f698d,_0x524762,_0x4277ac){var _0x4c11a7;return db[_0x3f19('0x3b')][_0x3f19('0x54')](_0x1f698d['body'],{'raw':!![]})[_0x3f19('0x32')](function(_0x3204a7){_0x4c11a7=_0x3204a7;return db[_0x3f19('0x3b')][_0x3f19('0x55')]({'raw':!![]});})['then'](function(_0x5cdabe){var _0x54be61=fs['readFileSync'](path['join'](config[_0x3f19('0x56')],_0x3f19('0x57')),_0x3f19('0x58'));var _0x1f50b3=ejs[_0x3f19('0x59')](_0x54be61,{'contexts':_0x5cdabe||[]});fs[_0x3f19('0x5a')](_0x3f19('0x5b'),_0x1f50b3);})[_0x3f19('0x32')](function(){return respondWithRpcPromise(_0x3f19('0x5c'),_0x3f19('0x54'),{'module':'chan_sip.so'});})[_0x3f19('0x32')](function(){var _0x1eabe3=_0x1f698d[_0x3f19('0x5d')][_0x3f19('0x34')]({'plain':!![]});if(!_0x1eabe3)throw new Error(_0x3f19('0x5e'));if(_0x1eabe3[_0x3f19('0x5f')]===_0x3f19('0x5d')){var _0x259618=_0x4c11a7[_0x3f19('0x34')]({'plain':!![]});return db['UserProfileSection'][_0x3f19('0x53')]({'where':{'name':_0x3f19('0x35'),'userProfileId':_0x1eabe3[_0x3f19('0x60')]},'raw':!![]})['then'](function(_0x1a68ee){if(_0x1a68ee&&_0x1a68ee[_0x3f19('0x61')]===0x0){return db[_0x3f19('0x62')][_0x3f19('0x54')]({'name':_0x259618[_0x3f19('0x37')],'resourceId':_0x259618['id'],'type':_0x1a68ee[_0x3f19('0x37')],'sectionId':_0x1a68ee['id']},{})[_0x3f19('0x32')](function(){return _0x4c11a7;});}else{return _0x4c11a7;}})[_0x3f19('0x28')](function(_0x1f11ad){logger[_0x3f19('0x23')](_0x3f19('0x63'),_0x1f11ad);throw _0x1f11ad;});}return _0x4c11a7;})[_0x3f19('0x32')](respondWithResult(_0x524762,0xc9))[_0x3f19('0x28')](handleError(_0x524762,null));};exports['update']=function(_0x5af114,_0x3baf44,_0x3a53ed){var _0xe86634;return db[_0x3f19('0x3b')][_0x3f19('0x53')]({'where':{'id':_0x5af114[_0x3f19('0x52')]['id']}})[_0x3f19('0x32')](handleEntityNotFound(_0x3baf44,null))[_0x3f19('0x32')](saveUpdates(_0x5af114[_0x3f19('0x64')],null))[_0x3f19('0x32')](function(_0x2d9803){if(_0x2d9803){_0xe86634=_0x2d9803;return db['VoiceContext'][_0x3f19('0x55')]({'raw':!![]});}})[_0x3f19('0x32')](function(_0x12eaa1){var _0x40d86f=fs[_0x3f19('0x65')](path['join'](config[_0x3f19('0x56')],'server/files/templates/context.ejs'),_0x3f19('0x58'));var _0x32ec1e=ejs[_0x3f19('0x59')](_0x40d86f,{'contexts':_0x12eaa1||[]});fs[_0x3f19('0x5a')](_0x3f19('0x5b'),_0x32ec1e);})['then'](function(){return respondWithRpcPromise(_0x3f19('0x5c'),_0x3f19('0x31'),{'module':_0x3f19('0x66')});})['then'](function(){return _0xe86634;})['then'](respondWithResult(_0x3baf44,null))[_0x3f19('0x28')](handleError(_0x3baf44,null));};exports[_0x3f19('0x33')]=function(_0x32dced,_0x3ab292,_0xee459){var _0x271314;return db['VoiceContext'][_0x3f19('0x53')]({'where':{'id':_0x32dced[_0x3f19('0x52')]['id']}})[_0x3f19('0x32')](handleEntityNotFound(_0x3ab292,null))[_0x3f19('0x32')](removeEntity(_0x3ab292,null))[_0x3f19('0x32')](function(){return db['VoiceContext'][_0x3f19('0x55')]({'raw':!![]});})['then'](function(_0x39b4bd){var _0x49cf07=fs['readFileSync'](path[_0x3f19('0x67')](config[_0x3f19('0x56')],_0x3f19('0x57')),_0x3f19('0x58'));var _0x21ac09=ejs[_0x3f19('0x59')](_0x49cf07,{'contexts':_0x39b4bd});fs[_0x3f19('0x5a')](_0x3f19('0x5b'),_0x21ac09);return respondWithRpcPromise(_0x3f19('0x5c'),'destroy',{'module':_0x3f19('0x66')});})[_0x3f19('0x28')](handleError(_0x3ab292,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 47b3875..9b6c3fd 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 _0x0b70=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','define','voice_contexts','lodash'];(function(_0x1f8d29,_0x295837){var _0x5e5adf=function(_0x533cf5){while(--_0x533cf5){_0x1f8d29['push'](_0x1f8d29['shift']());}};_0x5e5adf(++_0x295837);}(_0x0b70,0x192));var _0x00b7=function(_0x3c2ccc,_0x44120d){_0x3c2ccc=_0x3c2ccc-0x0;var _0x306570=_0x0b70[_0x3c2ccc];return _0x306570;};'use strict';var _=require(_0x00b7('0x0'));var util=require(_0x00b7('0x1'));var logger=require(_0x00b7('0x2'))(_0x00b7('0x3'));var moment=require(_0x00b7('0x4'));var BPromise=require('bluebird');var rp=require(_0x00b7('0x5'));var fs=require('fs');var path=require(_0x00b7('0x6'));var rimraf=require(_0x00b7('0x7'));var config=require(_0x00b7('0x8'));var attributes=require(_0x00b7('0x9'));module[_0x00b7('0xa')]=function(_0x345cb4,_0x434115){return _0x345cb4[_0x00b7('0xb')]('VoiceContext',attributes,{'tableName':_0x00b7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ec8=['exports','define','voice_contexts','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2ec8,0xfd));var _0x82ec=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2ec8[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x82ec('0x0'));var util=require('util');var logger=require(_0x82ec('0x1'))(_0x82ec('0x2'));var moment=require(_0x82ec('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x82ec('0x4'));var rimraf=require(_0x82ec('0x5'));var config=require(_0x82ec('0x6'));var attributes=require('./voiceContext.attributes');module[_0x82ec('0x7')]=function(_0x4c820c,_0x3ac4ef){return _0x4c820c[_0x82ec('0x8')]('VoiceContext',attributes,{'tableName':_0x82ec('0x9'),'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 b17ea41..c308a82 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 _0x1564=['debug','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VoiceContext,\x20%s,\x20%s'];(function(_0x2868fb,_0x2165dd){var _0x1f2744=function(_0x580d38){while(--_0x580d38){_0x2868fb['push'](_0x2868fb['shift']());}};_0x1f2744(++_0x2165dd);}(_0x1564,0x125));var _0x4156=function(_0x357b8c,_0x315ad2){_0x357b8c=_0x357b8c-0x0;var _0x148add=_0x1564[_0x357b8c];return _0x148add;};'use strict';var _=require(_0x4156('0x0'));var util=require(_0x4156('0x1'));var moment=require(_0x4156('0x2'));var BPromise=require(_0x4156('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4156('0x4'));var db=require(_0x4156('0x5'))['db'];var utils=require(_0x4156('0x6'));var logger=require(_0x4156('0x7'))(_0x4156('0x8'));var config=require(_0x4156('0x9'));var jayson=require(_0x4156('0xa'));var client=jayson[_0x4156('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a49d1,_0x5d0d0b,_0x2dcaf1){return new BPromise(function(_0x492aec,_0x347f0e){return client[_0x4156('0xc')](_0x5a49d1,_0x2dcaf1)['then'](function(_0x276ad6){logger[_0x4156('0xd')](_0x4156('0xe'),_0x5d0d0b,'request\x20sent');logger[_0x4156('0xf')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x5d0d0b,_0x4156('0x10'),JSON[_0x4156('0x11')](_0x276ad6));if(_0x276ad6['error']){if(_0x276ad6[_0x4156('0x12')][_0x4156('0x13')]===0x1f4){logger[_0x4156('0x12')](_0x4156('0xe'),_0x5d0d0b,_0x276ad6[_0x4156('0x12')][_0x4156('0x14')]);return _0x347f0e(_0x276ad6[_0x4156('0x12')][_0x4156('0x14')]);}logger['error'](_0x4156('0xe'),_0x5d0d0b,_0x276ad6[_0x4156('0x12')][_0x4156('0x14')]);return _0x492aec(_0x276ad6[_0x4156('0x12')][_0x4156('0x14')]);}else{logger['info'](_0x4156('0xe'),_0x5d0d0b,'request\x20sent');_0x492aec(_0x276ad6['result'][_0x4156('0x14')]);}})[_0x4156('0x15')](function(_0x70e570){logger[_0x4156('0x12')](_0x4156('0xe'),_0x5d0d0b,_0x70e570);_0x347f0e(_0x70e570);});});} \ No newline at end of file +var _0x793b=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','lodash','util','moment'];(function(_0x5f25b3,_0x35481a){var _0x4ab9bf=function(_0x49baf7){while(--_0x49baf7){_0x5f25b3['push'](_0x5f25b3['shift']());}};_0x4ab9bf(++_0x35481a);}(_0x793b,0x189));var _0xb793=function(_0x395185,_0x5cefae){_0x395185=_0x395185-0x0;var _0x44b281=_0x793b[_0x395185];return _0x44b281;};'use strict';var _=require(_0xb793('0x0'));var util=require(_0xb793('0x1'));var moment=require(_0xb793('0x2'));var BPromise=require(_0xb793('0x3'));var rs=require(_0xb793('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb793('0x5'))['db'];var utils=require(_0xb793('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xb793('0x7'));var jayson=require(_0xb793('0x8'));var client=jayson[_0xb793('0x9')][_0xb793('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39f110,_0x42d0c7,_0x134ac4){return new BPromise(function(_0x23a718,_0x149720){return client[_0xb793('0xb')](_0x39f110,_0x134ac4)[_0xb793('0xc')](function(_0x22c9ea){logger[_0xb793('0xd')](_0xb793('0xe'),_0x42d0c7,'request\x20sent');logger[_0xb793('0xf')](_0xb793('0x10'),_0x42d0c7,'request\x20sent',JSON['stringify'](_0x22c9ea));if(_0x22c9ea[_0xb793('0x11')]){if(_0x22c9ea[_0xb793('0x11')]['code']===0x1f4){logger[_0xb793('0x11')](_0xb793('0xe'),_0x42d0c7,_0x22c9ea['error'][_0xb793('0x12')]);return _0x149720(_0x22c9ea[_0xb793('0x11')][_0xb793('0x12')]);}logger[_0xb793('0x11')](_0xb793('0xe'),_0x42d0c7,_0x22c9ea[_0xb793('0x11')][_0xb793('0x12')]);return _0x23a718(_0x22c9ea['error'][_0xb793('0x12')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x42d0c7,_0xb793('0x13'));_0x23a718(_0x22c9ea[_0xb793('0x14')][_0xb793('0x12')]);}})[_0xb793('0x15')](function(_0x38d9f2){logger[_0xb793('0x11')](_0xb793('0xe'),_0x42d0c7,_0x38d9f2);_0x149720(_0x38d9f2);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 8d2ebb4..617800d 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 _0x2e35=['post','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','/:id'];(function(_0x1a644d,_0xfeada0){var _0x58be40=function(_0x454483){while(--_0x454483){_0x1a644d['push'](_0x1a644d['shift']());}};_0x58be40(++_0xfeada0);}(_0x2e35,0x1d0));var _0x52e3=function(_0x247db1,_0x23dc20){_0x247db1=_0x247db1-0x0;var _0x221742=_0x2e35[_0x247db1];return _0x221742;};'use strict';var multer=require(_0x52e3('0x0'));var util=require(_0x52e3('0x1'));var path=require(_0x52e3('0x2'));var timeout=require('connect-timeout');var express=require(_0x52e3('0x3'));var router=express[_0x52e3('0x4')]();var fs_extra=require(_0x52e3('0x5'));var auth=require(_0x52e3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x52e3('0x7'));var controller=require(_0x52e3('0x8'));router[_0x52e3('0x9')]('/',auth[_0x52e3('0xa')](),controller['index']);router['get']('/describe',auth[_0x52e3('0xa')](),controller['describe']);router['get'](_0x52e3('0xb'),auth[_0x52e3('0xa')](),controller['show']);router[_0x52e3('0xc')]('/',auth[_0x52e3('0xa')](),controller['create']);router[_0x52e3('0xd')]('/:id',auth[_0x52e3('0xa')](),controller[_0x52e3('0xe')]);router[_0x52e3('0xf')]('/:id',auth[_0x52e3('0xa')](),controller[_0x52e3('0x10')]);module['exports']=router; \ No newline at end of file +var _0x36d6=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','describe','show','post','create','put','delete','/:id','exports','path','connect-timeout'];(function(_0x40b831,_0x4977cf){var _0x1595ee=function(_0x3780d9){while(--_0x3780d9){_0x40b831['push'](_0x40b831['shift']());}};_0x1595ee(++_0x4977cf);}(_0x36d6,0x18d));var _0x636d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36d6[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x636d('0x0'));var timeout=require(_0x636d('0x1'));var express=require(_0x636d('0x2'));var router=express['Router']();var fs_extra=require(_0x636d('0x3'));var auth=require(_0x636d('0x4'));var interaction=require(_0x636d('0x5'));var config=require(_0x636d('0x6'));var controller=require(_0x636d('0x7'));router[_0x636d('0x8')]('/',auth[_0x636d('0x9')](),controller[_0x636d('0xa')]);router['get']('/describe',auth[_0x636d('0x9')](),controller[_0x636d('0xb')]);router[_0x636d('0x8')]('/:id',auth[_0x636d('0x9')](),controller[_0x636d('0xc')]);router[_0x636d('0xd')]('/',auth[_0x636d('0x9')](),controller[_0x636d('0xe')]);router[_0x636d('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x636d('0x10')](_0x636d('0x11'),auth[_0x636d('0x9')](),controller['destroy']);module[_0x636d('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index d497429..298f42f 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 _0x425d=['sequelize','STRING','INTEGER','DATE'];(function(_0x483734,_0x2da8dc){var _0x6686c2=function(_0x46b320){while(--_0x46b320){_0x483734['push'](_0x483734['shift']());}};_0x6686c2(++_0x2da8dc);}(_0x425d,0x1e0));var _0xd425=function(_0x502ea4,_0x56ae9d){_0x502ea4=_0x502ea4-0x0;var _0x159978=_0x425d[_0x502ea4];return _0x159978;};'use strict';var Sequelize=require(_0xd425('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xd425('0x1')]},'channel':{'type':Sequelize[_0xd425('0x1')]},'channelstate':{'type':Sequelize[_0xd425('0x2')]},'channelstatedesc':{'type':Sequelize[_0xd425('0x1')]},'calleridnum':{'type':Sequelize[_0xd425('0x1')]},'calleridname':{'type':Sequelize[_0xd425('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd425('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd425('0x1')]},'accountcode':{'type':Sequelize[_0xd425('0x1')]},'context':{'type':Sequelize[_0xd425('0x1')]},'exten':{'type':Sequelize[_0xd425('0x1')]},'priority':{'type':Sequelize[_0xd425('0x2')]},'uniqueid':{'type':Sequelize[_0xd425('0x1')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xd425('0x1')]},'destchannelstate':{'type':Sequelize[_0xd425('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xd425('0x1')]},'destcalleridnum':{'type':Sequelize[_0xd425('0x1')]},'destcalleridname':{'type':Sequelize[_0xd425('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd425('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd425('0x1')]},'destlanguage':{'type':Sequelize[_0xd425('0x1')]},'destaccountcode':{'type':Sequelize[_0xd425('0x1')]},'destcontext':{'type':Sequelize[_0xd425('0x1')]},'destexten':{'type':Sequelize[_0xd425('0x1')]},'destpriority':{'type':Sequelize[_0xd425('0x2')]},'destuniqueid':{'type':Sequelize[_0xd425('0x1')]},'destlinkedid':{'type':Sequelize[_0xd425('0x1')]},'dialstring':{'type':Sequelize[_0xd425('0x1')]},'dialstatus':{'type':Sequelize[_0xd425('0x1')]},'starttime':{'type':Sequelize[_0xd425('0x3')]},'answertime':{'type':Sequelize[_0xd425('0x3')]},'endtime':{'type':Sequelize[_0xd425('0x3')]},'lastevent':{'type':Sequelize[_0xd425('0x1')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xd425('0x2')]},'duration':{'type':Sequelize[_0xd425('0x2')]},'holdtime':{'type':Sequelize[_0xd425('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xbec5=['called,connect,complete','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x34f697,_0x22471c){var _0x5c6cb9=function(_0x56061d){while(--_0x56061d){_0x34f697['push'](_0x34f697['shift']());}};_0x5c6cb9(++_0x22471c);}(_0xbec5,0xe5));var _0x5bec=function(_0x1f7201,_0x141b79){_0x1f7201=_0x1f7201-0x0;var _0x289fd2=_0xbec5[_0x1f7201];return _0x289fd2;};'use strict';var Sequelize=require(_0x5bec('0x0'));module[_0x5bec('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5bec('0x2')]},'channelstate':{'type':Sequelize[_0x5bec('0x3')]},'channelstatedesc':{'type':Sequelize[_0x5bec('0x2')]},'calleridnum':{'type':Sequelize[_0x5bec('0x2')]},'calleridname':{'type':Sequelize[_0x5bec('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x5bec('0x2')]},'language':{'type':Sequelize[_0x5bec('0x2')]},'accountcode':{'type':Sequelize[_0x5bec('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x5bec('0x2')]},'priority':{'type':Sequelize[_0x5bec('0x3')]},'uniqueid':{'type':Sequelize[_0x5bec('0x2')]},'linkedid':{'type':Sequelize[_0x5bec('0x2')]},'destchannel':{'type':Sequelize[_0x5bec('0x2')]},'destchannelstate':{'type':Sequelize[_0x5bec('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x5bec('0x2')]},'destcalleridnum':{'type':Sequelize[_0x5bec('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x5bec('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x5bec('0x2')]},'destaccountcode':{'type':Sequelize[_0x5bec('0x2')]},'destcontext':{'type':Sequelize[_0x5bec('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x5bec('0x3')]},'destuniqueid':{'type':Sequelize[_0x5bec('0x2')]},'destlinkedid':{'type':Sequelize[_0x5bec('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x5bec('0x2')]},'starttime':{'type':Sequelize[_0x5bec('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x5bec('0x4')]},'lastevent':{'type':Sequelize[_0x5bec('0x2')],'comment':_0x5bec('0x5')},'routeId':{'type':Sequelize[_0x5bec('0x3')]},'duration':{'type':Sequelize[_0x5bec('0x3')]},'holdtime':{'type':Sequelize[_0x5bec('0x3')]},'billableseconds':{'type':Sequelize[_0x5bec('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index ea422e8..def886c 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 _0x34c8=['query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','VoiceDialReport','key','model','keys'];(function(_0x3eb578,_0x59e0af){var _0x7f3c90=function(_0x673688){while(--_0x673688){_0x3eb578['push'](_0x3eb578['shift']());}};_0x7f3c90(++_0x59e0af);}(_0x34c8,0xb2));var _0x834c=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x34c8[_0x2aea9e];return _0x430b92;};'use strict';var emlformat=require(_0x834c('0x0'));var rimraf=require(_0x834c('0x1'));var zipdir=require(_0x834c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x834c('0x3'));var moment=require(_0x834c('0x4'));var BPromise=require(_0x834c('0x5'));var Mustache=require(_0x834c('0x6'));var util=require(_0x834c('0x7'));var path=require('path');var sox=require(_0x834c('0x8'));var csv=require('to-csv');var ejs=require(_0x834c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x834c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x834c('0xb'));var toCsv=require('to-csv');var querystring=require(_0x834c('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x834c('0xd'));var qs=require(_0x834c('0xe'));var as=require(_0x834c('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x834c('0x10'))(_0x834c('0x11'));var utils=require(_0x834c('0x12'));var config=require(_0x834c('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ab64d,_0x504195){_0x504195=_0x504195||0xcc;return function(_0x2bc157){if(_0x2bc157){return _0x5ab64d[_0x834c('0x14')](_0x504195);}return _0x5ab64d[_0x834c('0x15')](_0x504195)[_0x834c('0x16')]();};}function respondWithResult(_0x5973d0,_0x57361d){_0x57361d=_0x57361d||0xc8;return function(_0x5b4c03){if(_0x5b4c03){return _0x5973d0['status'](_0x57361d)[_0x834c('0x17')](_0x5b4c03);}};}function respondWithFilteredResult(_0x1eea5c,_0x4d298e){return function(_0x55c98e){if(_0x55c98e){var _0x4b884e=typeof _0x4d298e[_0x834c('0x18')]===_0x834c('0x19')&&typeof _0x4d298e[_0x834c('0x1a')]==='undefined';var _0x39520c=_0x55c98e['count'];var _0xadbdab=_0x4b884e?0x0:_0x4d298e[_0x834c('0x18')];var _0x3e6322=_0x4b884e?_0x55c98e['count']:_0x4d298e[_0x834c('0x18')]+_0x4d298e[_0x834c('0x1a')];var _0x33e468;if(_0x3e6322>=_0x39520c){_0x3e6322=_0x39520c;_0x33e468=0xc8;}else{_0x33e468=0xce;}_0x1eea5c[_0x834c('0x15')](_0x33e468);return _0x1eea5c[_0x834c('0x1b')](_0x834c('0x1c'),_0xadbdab+'-'+_0x3e6322+'/'+_0x39520c)[_0x834c('0x17')](_0x55c98e);}return null;};}function patchUpdates(_0x896aed){return function(_0x58511e){try{jsonpatch[_0x834c('0x1d')](_0x58511e,_0x896aed,!![]);}catch(_0x30cc97){return BPromise[_0x834c('0x1e')](_0x30cc97);}return _0x58511e['save']();};}function saveUpdates(_0x3a868b,_0x2195d6){return function(_0x477a88){if(_0x477a88){return _0x477a88[_0x834c('0x1f')](_0x3a868b)[_0x834c('0x20')](function(_0xe399c1){return _0xe399c1;});}return null;};}function removeEntity(_0x3f442d,_0x23f65e){return function(_0x57b9a6){if(_0x57b9a6){return _0x57b9a6[_0x834c('0x21')]()[_0x834c('0x20')](function(){_0x3f442d[_0x834c('0x15')](0xcc)[_0x834c('0x16')]();});}};}function handleEntityNotFound(_0x262b01,_0x1f08f4){return function(_0x98db90){if(!_0x98db90){_0x262b01[_0x834c('0x14')](0x194);}return _0x98db90;};}function handleError(_0x9dbd12,_0xc3411){_0xc3411=_0xc3411||0x1f4;return function(_0x5999c6){logger[_0x834c('0x22')](_0x5999c6[_0x834c('0x23')]);if(_0x5999c6['name']){delete _0x5999c6[_0x834c('0x24')];}_0x9dbd12[_0x834c('0x15')](_0xc3411)[_0x834c('0x25')](_0x5999c6);};}exports[_0x834c('0x26')]=function(_0x5dc08c,_0x452a61){var _0x5b67f5={},_0x31e41f={},_0x52ae61={'count':0x0,'rows':[]};var _0x253669=_[_0x834c('0x27')](db[_0x834c('0x28')]['rawAttributes'],function(_0x225d60){return{'name':_0x225d60['fieldName'],'type':_0x225d60['type'][_0x834c('0x29')]};});_0x31e41f[_0x834c('0x2a')]=_[_0x834c('0x27')](_0x253669,_0x834c('0x24'));_0x31e41f['query']=_[_0x834c('0x2b')](_0x5dc08c[_0x834c('0x2c')]);_0x31e41f[_0x834c('0x2d')]=_[_0x834c('0x2e')](_0x31e41f[_0x834c('0x2a')],_0x31e41f[_0x834c('0x2c')]);_0x5b67f5[_0x834c('0x2f')]=_[_0x834c('0x2e')](_0x31e41f[_0x834c('0x2a')],qs[_0x834c('0x30')](_0x5dc08c[_0x834c('0x2c')][_0x834c('0x30')]));_0x5b67f5['attributes']=_0x5b67f5[_0x834c('0x2f')]['length']?_0x5b67f5[_0x834c('0x2f')]:_0x31e41f[_0x834c('0x2a')];if(!_0x5dc08c['query'][_0x834c('0x31')](_0x834c('0x32'))){_0x5b67f5['limit']=qs[_0x834c('0x1a')](_0x5dc08c[_0x834c('0x2c')][_0x834c('0x1a')]);_0x5b67f5['offset']=qs['offset'](_0x5dc08c[_0x834c('0x2c')]['offset']);}_0x5b67f5[_0x834c('0x33')]=qs['sort'](_0x5dc08c[_0x834c('0x2c')][_0x834c('0x34')]);_0x5b67f5[_0x834c('0x35')]=qs[_0x834c('0x2d')](_[_0x834c('0x36')](_0x5dc08c[_0x834c('0x2c')],_0x31e41f['filters']),_0x253669);if(_0x5dc08c[_0x834c('0x2c')][_0x834c('0x37')]){_0x5b67f5[_0x834c('0x35')]=_[_0x834c('0x38')](_0x5b67f5[_0x834c('0x35')],{'$or':_['map'](_0x253669,function(_0x2ec1cb){if(_0x2ec1cb[_0x834c('0x39')]!==_0x834c('0x3a')){var _0x974a0f={};_0x974a0f[_0x2ec1cb[_0x834c('0x24')]]={'$like':'%'+_0x5dc08c['query'][_0x834c('0x37')]+'%'};return _0x974a0f;}})});}_0x5b67f5=_[_0x834c('0x38')]({},_0x5b67f5,_0x5dc08c[_0x834c('0x3b')]);var _0x5cf079={'where':_0x5b67f5[_0x834c('0x35')]};return db[_0x834c('0x28')][_0x834c('0x3c')](_0x5cf079)[_0x834c('0x20')](function(_0x43dc3d){_0x52ae61['count']=_0x43dc3d;if(_0x5dc08c[_0x834c('0x2c')][_0x834c('0x3d')]){_0x5b67f5[_0x834c('0x3e')]=[{'all':!![]}];}return db[_0x834c('0x28')][_0x834c('0x3f')](_0x5b67f5);})[_0x834c('0x20')](function(_0x5c9bda){_0x52ae61[_0x834c('0x40')]=_0x5c9bda;return _0x52ae61;})[_0x834c('0x20')](respondWithFilteredResult(_0x452a61,_0x5b67f5))[_0x834c('0x41')](handleError(_0x452a61,null));};exports[_0x834c('0x42')]=function(_0x118914,_0x47c8fd){var _0x1cf02c={'raw':!![],'where':{'id':_0x118914[_0x834c('0x43')]['id']}},_0x4c93b5={};_0x4c93b5[_0x834c('0x2a')]=_[_0x834c('0x2b')](db[_0x834c('0x28')][_0x834c('0x44')]);_0x4c93b5[_0x834c('0x2c')]=_[_0x834c('0x2b')](_0x118914[_0x834c('0x2c')]);_0x4c93b5[_0x834c('0x2d')]=_[_0x834c('0x2e')](_0x4c93b5['model'],_0x4c93b5[_0x834c('0x2c')]);_0x1cf02c[_0x834c('0x2f')]=_['intersection'](_0x4c93b5[_0x834c('0x2a')],qs[_0x834c('0x30')](_0x118914[_0x834c('0x2c')][_0x834c('0x30')]));_0x1cf02c[_0x834c('0x2f')]=_0x1cf02c[_0x834c('0x2f')][_0x834c('0x45')]?_0x1cf02c['attributes']:_0x4c93b5[_0x834c('0x2a')];if(_0x118914['query'][_0x834c('0x3d')]){_0x1cf02c[_0x834c('0x3e')]=[{'all':!![]}];}_0x1cf02c=_[_0x834c('0x38')]({},_0x1cf02c,_0x118914['options']);return db[_0x834c('0x28')][_0x834c('0x46')](_0x1cf02c)[_0x834c('0x20')](handleEntityNotFound(_0x47c8fd,null))[_0x834c('0x20')](respondWithResult(_0x47c8fd,null))[_0x834c('0x41')](handleError(_0x47c8fd,null));};exports[_0x834c('0x47')]=function(_0x385df6,_0x5e300e){return db[_0x834c('0x28')][_0x834c('0x47')](_0x385df6[_0x834c('0x48')],{})[_0x834c('0x20')](respondWithResult(_0x5e300e,0xc9))[_0x834c('0x41')](handleError(_0x5e300e,null));};exports['update']=function(_0x5dbd02,_0x5af008){if(_0x5dbd02[_0x834c('0x48')]['id']){delete _0x5dbd02['body']['id'];}return db[_0x834c('0x28')]['find']({'where':{'id':_0x5dbd02[_0x834c('0x43')]['id']}})[_0x834c('0x20')](handleEntityNotFound(_0x5af008,null))[_0x834c('0x20')](saveUpdates(_0x5dbd02[_0x834c('0x48')],null))['then'](respondWithResult(_0x5af008,null))[_0x834c('0x41')](handleError(_0x5af008,null));};exports[_0x834c('0x21')]=function(_0x647cbb,_0x279676){return db[_0x834c('0x28')][_0x834c('0x46')]({'where':{'id':_0x647cbb[_0x834c('0x43')]['id']}})[_0x834c('0x20')](handleEntityNotFound(_0x279676,null))[_0x834c('0x20')](removeEntity(_0x279676,null))[_0x834c('0x41')](handleError(_0x279676,null));};exports[_0x834c('0x49')]=function(_0x3e4a51,_0x47b5b2){return db['VoiceDialReport'][_0x834c('0x49')]()[_0x834c('0x20')](respondWithResult(_0x47b5b2,null))[_0x834c('0x41')](handleError(_0x47b5b2,null));}; \ No newline at end of file +var _0x32ca=['fast-json-patch','request-promise','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','sort','filters','filter','where','merge','map','options','includeAll','include','findAll','show','params','length','find','catch','create','body','describe','eml-format','rimraf'];(function(_0x5e15ee,_0x4ed8fb){var _0x107fda=function(_0x906e33){while(--_0x906e33){_0x5e15ee['push'](_0x5e15ee['shift']());}};_0x107fda(++_0x4ed8fb);}(_0x32ca,0x1e8));var _0xa32c=function(_0xf2efae,_0x307737){_0xf2efae=_0xf2efae-0x0;var _0x241311=_0x32ca[_0xf2efae];return _0x241311;};'use strict';var emlformat=require(_0xa32c('0x0'));var rimraf=require(_0xa32c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa32c('0x2'));var rp=require(_0xa32c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa32c('0x4'));var util=require(_0xa32c('0x5'));var path=require(_0xa32c('0x6'));var sox=require(_0xa32c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa32c('0x8'));var _=require(_0xa32c('0x9'));var squel=require(_0xa32c('0xa'));var crypto=require('crypto');var jsforce=require(_0xa32c('0xb'));var deskjs=require(_0xa32c('0xc'));var toCsv=require(_0xa32c('0xd'));var querystring=require('querystring');var Papa=require(_0xa32c('0xe'));var Redis=require('ioredis');var authService=require(_0xa32c('0xf'));var qs=require(_0xa32c('0x10'));var as=require(_0xa32c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa32c('0x12'))(_0xa32c('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa32c('0x14'))['db'];function respondWithStatusCode(_0x5c4e0b,_0x11b27b){_0x11b27b=_0x11b27b||0xcc;return function(_0x5637ea){if(_0x5637ea){return _0x5c4e0b['sendStatus'](_0x11b27b);}return _0x5c4e0b[_0xa32c('0x15')](_0x11b27b)[_0xa32c('0x16')]();};}function respondWithResult(_0x4bfb47,_0x3bdb80){_0x3bdb80=_0x3bdb80||0xc8;return function(_0xe5afdf){if(_0xe5afdf){return _0x4bfb47[_0xa32c('0x15')](_0x3bdb80)['json'](_0xe5afdf);}};}function respondWithFilteredResult(_0x546a15,_0x220375){return function(_0x49dc00){if(_0x49dc00){var _0x1e84e7=typeof _0x220375[_0xa32c('0x17')]===_0xa32c('0x18')&&typeof _0x220375[_0xa32c('0x19')]==='undefined';var _0x44f8b4=_0x49dc00[_0xa32c('0x1a')];var _0x23433a=_0x1e84e7?0x0:_0x220375['offset'];var _0x3f58a7=_0x1e84e7?_0x49dc00[_0xa32c('0x1a')]:_0x220375[_0xa32c('0x17')]+_0x220375['limit'];var _0x2f36f0;if(_0x3f58a7>=_0x44f8b4){_0x3f58a7=_0x44f8b4;_0x2f36f0=0xc8;}else{_0x2f36f0=0xce;}_0x546a15[_0xa32c('0x15')](_0x2f36f0);return _0x546a15[_0xa32c('0x1b')](_0xa32c('0x1c'),_0x23433a+'-'+_0x3f58a7+'/'+_0x44f8b4)[_0xa32c('0x1d')](_0x49dc00);}return null;};}function patchUpdates(_0x47c51a){return function(_0x4f4972){try{jsonpatch[_0xa32c('0x1e')](_0x4f4972,_0x47c51a,!![]);}catch(_0x50f857){return BPromise[_0xa32c('0x1f')](_0x50f857);}return _0x4f4972[_0xa32c('0x20')]();};}function saveUpdates(_0x54a6e0,_0x575dc9){return function(_0x2f0d0b){if(_0x2f0d0b){return _0x2f0d0b[_0xa32c('0x21')](_0x54a6e0)[_0xa32c('0x22')](function(_0x4c5435){return _0x4c5435;});}return null;};}function removeEntity(_0x1a19b1,_0xee660d){return function(_0x2a1e85){if(_0x2a1e85){return _0x2a1e85[_0xa32c('0x23')]()['then'](function(){_0x1a19b1[_0xa32c('0x15')](0xcc)[_0xa32c('0x16')]();});}};}function handleEntityNotFound(_0x3dadac,_0x35afc6){return function(_0x42c25e){if(!_0x42c25e){_0x3dadac['sendStatus'](0x194);}return _0x42c25e;};}function handleError(_0x518b4b,_0x12349c){_0x12349c=_0x12349c||0x1f4;return function(_0x2afae3){logger[_0xa32c('0x24')](_0x2afae3['stack']);if(_0x2afae3[_0xa32c('0x25')]){delete _0x2afae3[_0xa32c('0x25')];}_0x518b4b[_0xa32c('0x15')](_0x12349c)[_0xa32c('0x26')](_0x2afae3);};}exports[_0xa32c('0x27')]=function(_0x4e52b4,_0x31ceaa){var _0x2b8992={},_0x3f8fe8={},_0x5a9c83={'count':0x0,'rows':[]};var _0x114339=_['map'](db[_0xa32c('0x28')][_0xa32c('0x29')],function(_0x2bbe84){return{'name':_0x2bbe84[_0xa32c('0x2a')],'type':_0x2bbe84[_0xa32c('0x2b')][_0xa32c('0x2c')]};});_0x3f8fe8[_0xa32c('0x2d')]=_['map'](_0x114339,'name');_0x3f8fe8[_0xa32c('0x2e')]=_[_0xa32c('0x2f')](_0x4e52b4[_0xa32c('0x2e')]);_0x3f8fe8['filters']=_[_0xa32c('0x30')](_0x3f8fe8[_0xa32c('0x2d')],_0x3f8fe8['query']);_0x2b8992[_0xa32c('0x31')]=_['intersection'](_0x3f8fe8['model'],qs['fields'](_0x4e52b4[_0xa32c('0x2e')][_0xa32c('0x32')]));_0x2b8992[_0xa32c('0x31')]=_0x2b8992[_0xa32c('0x31')]['length']?_0x2b8992[_0xa32c('0x31')]:_0x3f8fe8['model'];if(!_0x4e52b4[_0xa32c('0x2e')][_0xa32c('0x33')]('nolimit')){_0x2b8992[_0xa32c('0x19')]=qs[_0xa32c('0x19')](_0x4e52b4['query']['limit']);_0x2b8992[_0xa32c('0x17')]=qs[_0xa32c('0x17')](_0x4e52b4['query']['offset']);}_0x2b8992['order']=qs[_0xa32c('0x34')](_0x4e52b4[_0xa32c('0x2e')]['sort']);_0x2b8992['where']=qs[_0xa32c('0x35')](_['pick'](_0x4e52b4[_0xa32c('0x2e')],_0x3f8fe8['filters']),_0x114339);if(_0x4e52b4[_0xa32c('0x2e')][_0xa32c('0x36')]){_0x2b8992[_0xa32c('0x37')]=_[_0xa32c('0x38')](_0x2b8992['where'],{'$or':_[_0xa32c('0x39')](_0x114339,function(_0x17ab06){if(_0x17ab06[_0xa32c('0x2b')]!=='VIRTUAL'){var _0x24ec10={};_0x24ec10[_0x17ab06[_0xa32c('0x25')]]={'$like':'%'+_0x4e52b4[_0xa32c('0x2e')]['filter']+'%'};return _0x24ec10;}})});}_0x2b8992=_['merge']({},_0x2b8992,_0x4e52b4[_0xa32c('0x3a')]);var _0x3bb2e8={'where':_0x2b8992[_0xa32c('0x37')]};return db[_0xa32c('0x28')][_0xa32c('0x1a')](_0x3bb2e8)[_0xa32c('0x22')](function(_0x5da1ca){_0x5a9c83[_0xa32c('0x1a')]=_0x5da1ca;if(_0x4e52b4['query'][_0xa32c('0x3b')]){_0x2b8992[_0xa32c('0x3c')]=[{'all':!![]}];}return db[_0xa32c('0x28')][_0xa32c('0x3d')](_0x2b8992);})[_0xa32c('0x22')](function(_0x5050f9){_0x5a9c83['rows']=_0x5050f9;return _0x5a9c83;})['then'](respondWithFilteredResult(_0x31ceaa,_0x2b8992))['catch'](handleError(_0x31ceaa,null));};exports[_0xa32c('0x3e')]=function(_0x55986c,_0x24a515){var _0x972ffc={'raw':!![],'where':{'id':_0x55986c[_0xa32c('0x3f')]['id']}},_0x3b5afd={};_0x3b5afd[_0xa32c('0x2d')]=_[_0xa32c('0x2f')](db[_0xa32c('0x28')]['rawAttributes']);_0x3b5afd[_0xa32c('0x2e')]=_[_0xa32c('0x2f')](_0x55986c[_0xa32c('0x2e')]);_0x3b5afd[_0xa32c('0x35')]=_[_0xa32c('0x30')](_0x3b5afd[_0xa32c('0x2d')],_0x3b5afd[_0xa32c('0x2e')]);_0x972ffc['attributes']=_[_0xa32c('0x30')](_0x3b5afd[_0xa32c('0x2d')],qs[_0xa32c('0x32')](_0x55986c[_0xa32c('0x2e')]['fields']));_0x972ffc['attributes']=_0x972ffc[_0xa32c('0x31')][_0xa32c('0x40')]?_0x972ffc[_0xa32c('0x31')]:_0x3b5afd[_0xa32c('0x2d')];if(_0x55986c[_0xa32c('0x2e')][_0xa32c('0x3b')]){_0x972ffc[_0xa32c('0x3c')]=[{'all':!![]}];}_0x972ffc=_['merge']({},_0x972ffc,_0x55986c['options']);return db['VoiceDialReport'][_0xa32c('0x41')](_0x972ffc)[_0xa32c('0x22')](handleEntityNotFound(_0x24a515,null))[_0xa32c('0x22')](respondWithResult(_0x24a515,null))[_0xa32c('0x42')](handleError(_0x24a515,null));};exports[_0xa32c('0x43')]=function(_0x5b3895,_0x28f147){return db[_0xa32c('0x28')][_0xa32c('0x43')](_0x5b3895[_0xa32c('0x44')],{})['then'](respondWithResult(_0x28f147,0xc9))[_0xa32c('0x42')](handleError(_0x28f147,null));};exports[_0xa32c('0x21')]=function(_0x4f118d,_0x24868e){if(_0x4f118d[_0xa32c('0x44')]['id']){delete _0x4f118d[_0xa32c('0x44')]['id'];}return db[_0xa32c('0x28')][_0xa32c('0x41')]({'where':{'id':_0x4f118d['params']['id']}})[_0xa32c('0x22')](handleEntityNotFound(_0x24868e,null))[_0xa32c('0x22')](saveUpdates(_0x4f118d[_0xa32c('0x44')],null))['then'](respondWithResult(_0x24868e,null))[_0xa32c('0x42')](handleError(_0x24868e,null));};exports[_0xa32c('0x23')]=function(_0x1b988a,_0x30c08f){return db[_0xa32c('0x28')][_0xa32c('0x41')]({'where':{'id':_0x1b988a[_0xa32c('0x3f')]['id']}})[_0xa32c('0x22')](handleEntityNotFound(_0x30c08f,null))[_0xa32c('0x22')](removeEntity(_0x30c08f,null))[_0xa32c('0x42')](handleError(_0x30c08f,null));};exports[_0xa32c('0x45')]=function(_0x5b7998,_0x56f65d){return db[_0xa32c('0x28')]['describe']()[_0xa32c('0x22')](respondWithResult(_0x56f65d,null))[_0xa32c('0x42')](handleError(_0x56f65d,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 30e6807..22a253b 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 _0x98d4=['rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util','api','moment','bluebird','path'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x98d4,0xf6));var _0x498d=function(_0xa3b71c,_0x530eb2){_0xa3b71c=_0xa3b71c-0x0;var _0x545100=_0x98d4[_0xa3b71c];return _0x545100;};'use strict';var _=require(_0x498d('0x0'));var util=require(_0x498d('0x1'));var logger=require('../../config/logger')(_0x498d('0x2'));var moment=require(_0x498d('0x3'));var BPromise=require(_0x498d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x498d('0x5'));var rimraf=require(_0x498d('0x6'));var config=require(_0x498d('0x7'));var attributes=require(_0x498d('0x8'));module[_0x498d('0x9')]=function(_0x16979b,_0x540b60){return _0x16979b[_0x498d('0xa')](_0x498d('0xb'),attributes,{'tableName':_0x498d('0xc'),'paranoid':![],'indexes':[{'fields':[_0x498d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb769=['lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','report_dial'];(function(_0x16984d,_0x40a4d9){var _0x567c12=function(_0x4e959e){while(--_0x4e959e){_0x16984d['push'](_0x16984d['shift']());}};_0x567c12(++_0x40a4d9);}(_0xb769,0x19e));var _0x9b76=function(_0x59e9a9,_0xd4e48e){_0x59e9a9=_0x59e9a9-0x0;var _0x213617=_0xb769[_0x59e9a9];return _0x213617;};'use strict';var _=require(_0x9b76('0x0'));var util=require('util');var logger=require(_0x9b76('0x1'))(_0x9b76('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9b76('0x3'));var fs=require('fs');var path=require(_0x9b76('0x4'));var rimraf=require(_0x9b76('0x5'));var config=require(_0x9b76('0x6'));var attributes=require('./voiceDialReport.attributes');module[_0x9b76('0x7')]=function(_0x18f154,_0x5706b0){return _0x18f154['define']('VoiceDialReport',attributes,{'tableName':_0x9b76('0x8'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 1ec71f1..91cf8bf 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 _0x90d2=['jayson/promise','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceDialReport','create','options','raw','update','body','where','attributes','limit','debug','UpdateVoiceDialReport','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x15023f,_0x342b87){var _0x1d3400=function(_0x4408ac){while(--_0x4408ac){_0x15023f['push'](_0x15023f['shift']());}};_0x1d3400(++_0x342b87);}(_0x90d2,0x1aa));var _0x290d=function(_0x18b73e,_0x39b3f2){_0x18b73e=_0x18b73e-0x0;var _0x25fa91=_0x90d2[_0x18b73e];return _0x25fa91;};'use strict';var _=require('lodash');var util=require(_0x290d('0x0'));var moment=require(_0x290d('0x1'));var BPromise=require(_0x290d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x290d('0x3'));var db=require(_0x290d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x290d('0x5'))(_0x290d('0x6'));var config=require(_0x290d('0x7'));var jayson=require(_0x290d('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2b586c,_0x4f39bb,_0x5b5a11){return new BPromise(function(_0x4619be,_0x38c793){return client['request'](_0x2b586c,_0x5b5a11)[_0x290d('0x9')](function(_0x3efebe){logger[_0x290d('0xa')](_0x290d('0xb'),_0x4f39bb,_0x290d('0xc'));logger['debug'](_0x290d('0xd'),_0x4f39bb,_0x290d('0xc'),JSON[_0x290d('0xe')](_0x3efebe));if(_0x3efebe[_0x290d('0xf')]){if(_0x3efebe[_0x290d('0xf')][_0x290d('0x10')]===0x1f4){logger[_0x290d('0xf')](_0x290d('0xb'),_0x4f39bb,_0x3efebe[_0x290d('0xf')][_0x290d('0x11')]);return _0x38c793(_0x3efebe[_0x290d('0xf')]['message']);}logger[_0x290d('0xf')](_0x290d('0xb'),_0x4f39bb,_0x3efebe[_0x290d('0xf')][_0x290d('0x11')]);return _0x4619be(_0x3efebe[_0x290d('0xf')][_0x290d('0x11')]);}else{logger['info'](_0x290d('0xb'),_0x4f39bb,'request\x20sent');_0x4619be(_0x3efebe[_0x290d('0x12')][_0x290d('0x11')]);}})[_0x290d('0x13')](function(_0x3647fc){logger[_0x290d('0xf')](_0x290d('0xb'),_0x4f39bb,_0x3647fc);_0x38c793(_0x3647fc);});});}exports[_0x290d('0x14')]=function(_0x22644e){var _0x310efb=this;return new Promise(function(_0x9ae7b6,_0x1ab66f){return db['VoiceDialReport'][_0x290d('0x15')](_0x22644e['body'],{'raw':_0x22644e[_0x290d('0x16')]?_0x22644e['options'][_0x290d('0x17')]===undefined?!![]:![]:!![]})[_0x290d('0x9')](function(_0x36c5ee){logger[_0x290d('0xa')](_0x290d('0x14'),_0x22644e);logger['debug']('CreateVoiceDialReport',_0x22644e,JSON['stringify'](_0x36c5ee));_0x9ae7b6(_0x36c5ee);})['catch'](function(_0x1fda33){logger[_0x290d('0xf')](_0x290d('0x14'),_0x1fda33[_0x290d('0x11')],_0x22644e);_0x1ab66f(_0x310efb[_0x290d('0xf')](0x1f4,_0x1fda33['message']));});});};exports['UpdateVoiceDialReport']=function(_0x4dbcdf){var _0xf378f2=this;return new Promise(function(_0x5203b8,_0x1ed444){return db['VoiceDialReport'][_0x290d('0x18')](_0x4dbcdf[_0x290d('0x19')],{'raw':_0x4dbcdf[_0x290d('0x16')]?_0x4dbcdf[_0x290d('0x16')][_0x290d('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4dbcdf[_0x290d('0x16')]?_0x4dbcdf[_0x290d('0x16')][_0x290d('0x1a')]||null:null,'attributes':_0x4dbcdf['options']?_0x4dbcdf[_0x290d('0x16')][_0x290d('0x1b')]||null:null,'limit':_0x4dbcdf[_0x290d('0x16')]?_0x4dbcdf[_0x290d('0x16')][_0x290d('0x1c')]||null:null})[_0x290d('0x9')](function(_0x3cd2b6){logger[_0x290d('0xa')]('UpdateVoiceDialReport',_0x4dbcdf);logger[_0x290d('0x1d')](_0x290d('0x1e'),_0x4dbcdf,JSON['stringify'](_0x3cd2b6));_0x5203b8(_0x3cd2b6);})[_0x290d('0x13')](function(_0x8d2410){logger[_0x290d('0xf')](_0x290d('0x1e'),_0x8d2410['message'],_0x4dbcdf);_0x1ed444(_0xf378f2[_0x290d('0xf')](0x1f4,_0x8d2410[_0x290d('0x11')]));});});}; \ No newline at end of file +var _0x7731=['info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateVoiceDialReport','body','options','raw','UpdateVoiceDialReport','VoiceDialReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x7731,0x17c));var _0x1773=function(_0x349031,_0x3cd2d1){_0x349031=_0x349031-0x0;var _0x33bcba=_0x7731[_0x349031];return _0x33bcba;};'use strict';var _=require(_0x1773('0x0'));var util=require(_0x1773('0x1'));var moment=require(_0x1773('0x2'));var BPromise=require(_0x1773('0x3'));var rs=require(_0x1773('0x4'));var fs=require('fs');var Redis=require(_0x1773('0x5'));var db=require(_0x1773('0x6'))['db'];var utils=require(_0x1773('0x7'));var logger=require(_0x1773('0x8'))(_0x1773('0x9'));var config=require(_0x1773('0xa'));var jayson=require(_0x1773('0xb'));var client=jayson[_0x1773('0xc')][_0x1773('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x53faf9,_0x26c346,_0x5b9be9){return new BPromise(function(_0x43cde6,_0x310c37){return client[_0x1773('0xe')](_0x53faf9,_0x5b9be9)[_0x1773('0xf')](function(_0x168e6b){logger[_0x1773('0x10')](_0x1773('0x11'),_0x26c346,_0x1773('0x12'));logger[_0x1773('0x13')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x26c346,_0x1773('0x12'),JSON[_0x1773('0x14')](_0x168e6b));if(_0x168e6b[_0x1773('0x15')]){if(_0x168e6b['error'][_0x1773('0x16')]===0x1f4){logger[_0x1773('0x15')](_0x1773('0x11'),_0x26c346,_0x168e6b[_0x1773('0x15')]['message']);return _0x310c37(_0x168e6b[_0x1773('0x15')][_0x1773('0x17')]);}logger[_0x1773('0x15')](_0x1773('0x11'),_0x26c346,_0x168e6b[_0x1773('0x15')]['message']);return _0x43cde6(_0x168e6b[_0x1773('0x15')][_0x1773('0x17')]);}else{logger['info'](_0x1773('0x11'),_0x26c346,_0x1773('0x12'));_0x43cde6(_0x168e6b[_0x1773('0x18')][_0x1773('0x17')]);}})[_0x1773('0x19')](function(_0x465e34){logger[_0x1773('0x15')](_0x1773('0x11'),_0x26c346,_0x465e34);_0x310c37(_0x465e34);});});}exports[_0x1773('0x1a')]=function(_0x15f547){var _0x150cbe=this;return new Promise(function(_0x2b54ce,_0x22293b){return db['VoiceDialReport']['create'](_0x15f547[_0x1773('0x1b')],{'raw':_0x15f547[_0x1773('0x1c')]?_0x15f547[_0x1773('0x1c')][_0x1773('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x38c6c5){logger[_0x1773('0x10')](_0x1773('0x1a'),_0x15f547);logger[_0x1773('0x13')]('CreateVoiceDialReport',_0x15f547,JSON[_0x1773('0x14')](_0x38c6c5));_0x2b54ce(_0x38c6c5);})[_0x1773('0x19')](function(_0x3bc227){logger[_0x1773('0x15')](_0x1773('0x1a'),_0x3bc227[_0x1773('0x17')],_0x15f547);_0x22293b(_0x150cbe[_0x1773('0x15')](0x1f4,_0x3bc227['message']));});});};exports[_0x1773('0x1e')]=function(_0x5c89f5){var _0x5b972a=this;return new Promise(function(_0x336730,_0x183429){return db[_0x1773('0x1f')][_0x1773('0x20')](_0x5c89f5['body'],{'raw':_0x5c89f5[_0x1773('0x1c')]?_0x5c89f5['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c89f5['options']?_0x5c89f5[_0x1773('0x1c')][_0x1773('0x21')]||null:null,'attributes':_0x5c89f5[_0x1773('0x1c')]?_0x5c89f5[_0x1773('0x1c')][_0x1773('0x22')]||null:null,'limit':_0x5c89f5['options']?_0x5c89f5[_0x1773('0x1c')][_0x1773('0x23')]||null:null})[_0x1773('0xf')](function(_0x34a539){logger[_0x1773('0x10')](_0x1773('0x1e'),_0x5c89f5);logger[_0x1773('0x13')](_0x1773('0x1e'),_0x5c89f5,JSON['stringify'](_0x34a539));_0x336730(_0x34a539);})[_0x1773('0x19')](function(_0x4f58ab){logger[_0x1773('0x15')](_0x1773('0x1e'),_0x4f58ab['message'],_0x5c89f5);_0x183429(_0x5b972a['error'](0x1f4,_0x4f58ab['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 79c9526..968771e 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 _0xd8f4=['index','isAuthenticated','show','post','create','addApplications','put','/:id','update','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get'];(function(_0x71aa20,_0x1c935b){var _0x5a2cbc=function(_0x440efd){while(--_0x440efd){_0x71aa20['push'](_0x71aa20['shift']());}};_0x5a2cbc(++_0x1c935b);}(_0xd8f4,0xbd));var _0x4d8f=function(_0x3fc8fd,_0x3d1544){_0x3fc8fd=_0x3fc8fd-0x0;var _0x111320=_0xd8f4[_0x3fc8fd];return _0x111320;};'use strict';var multer=require(_0x4d8f('0x0'));var util=require(_0x4d8f('0x1'));var path=require(_0x4d8f('0x2'));var timeout=require(_0x4d8f('0x3'));var express=require(_0x4d8f('0x4'));var router=express['Router']();var fs_extra=require(_0x4d8f('0x5'));var auth=require(_0x4d8f('0x6'));var interaction=require(_0x4d8f('0x7'));var config=require(_0x4d8f('0x8'));var controller=require(_0x4d8f('0x9'));router[_0x4d8f('0xa')]('/',auth['isAuthenticated'](),controller[_0x4d8f('0xb')]);router['get']('/:id',auth[_0x4d8f('0xc')](),controller[_0x4d8f('0xd')]);router[_0x4d8f('0xe')]('/',auth['isAuthenticated'](),controller[_0x4d8f('0xf')]);router['post']('/:id/applications',auth[_0x4d8f('0xc')](),controller[_0x4d8f('0x10')]);router[_0x4d8f('0x11')](_0x4d8f('0x12'),auth['isAuthenticated'](),controller[_0x4d8f('0x13')]);router['delete'](_0x4d8f('0x12'),auth[_0x4d8f('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd0f9=['/:id','post','create','/:id/applications','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index'];(function(_0x12c34e,_0x39287a){var _0x244e88=function(_0x34507b){while(--_0x34507b){_0x12c34e['push'](_0x12c34e['shift']());}};_0x244e88(++_0x39287a);}(_0xd0f9,0x9c));var _0x9d0f=function(_0x9cfe28,_0x1a335c){_0x9cfe28=_0x9cfe28-0x0;var _0x54a1d0=_0xd0f9[_0x9cfe28];return _0x54a1d0;};'use strict';var multer=require(_0x9d0f('0x0'));var util=require(_0x9d0f('0x1'));var path=require('path');var timeout=require(_0x9d0f('0x2'));var express=require(_0x9d0f('0x3'));var router=express[_0x9d0f('0x4')]();var fs_extra=require(_0x9d0f('0x5'));var auth=require(_0x9d0f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9d0f('0x7'));var controller=require(_0x9d0f('0x8'));router[_0x9d0f('0x9')]('/',auth[_0x9d0f('0xa')](),controller[_0x9d0f('0xb')]);router['get'](_0x9d0f('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x9d0f('0xd')]('/',auth['isAuthenticated'](),controller[_0x9d0f('0xe')]);router['post'](_0x9d0f('0xf'),auth[_0x9d0f('0xa')](),controller['addApplications']);router[_0x9d0f('0x10')]('/:id',auth[_0x9d0f('0xa')](),controller[_0x9d0f('0x11')]);router[_0x9d0f('0x12')](_0x9d0f('0xc'),auth[_0x9d0f('0xa')](),controller[_0x9d0f('0x13')]);module[_0x9d0f('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 034cfca..b9c582d 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 _0xfcae=['exten','sequelize','STRING','compositeIndex','NoOp','ENUM','outbound','internal','inbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL'];(function(_0x10cb21,_0xf036f){var _0x94db5d=function(_0x329b2b){while(--_0x329b2b){_0x10cb21['push'](_0x10cb21['shift']());}};_0x94db5d(++_0xf036f);}(_0xfcae,0xb1));var _0xefca=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xfcae[_0x13b8f3];return _0x1a6d06;};'use strict';var Sequelize=require(_0xefca('0x0'));module['exports']={'context':{'type':Sequelize[_0xefca('0x1')],'allowNull':![],'unique':_0xefca('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xefca('0x2')},'priority':{'type':Sequelize[_0xefca('0x1')],'allowNull':![],'defaultValue':'1','unique':_0xefca('0x2')},'tag':{'type':Sequelize[_0xefca('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xefca('0x3')},'appdata':{'type':Sequelize[_0xefca('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xefca('0x4')]('inbound',_0xefca('0x5'),_0xefca('0x6'),_0xefca('0x7'),'outbound-fax',_0xefca('0x8'),_0xefca('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0xefca('0x1')]},'interval':{'type':Sequelize[_0xefca('0x1')],'allowNull':![],'defaultValue':_0xefca('0xa')},'IntervalId':{'type':Sequelize[_0xefca('0xb')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0xefca('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0xefca('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xefca('0xb')]},'recordingFormat':{'type':Sequelize[_0xefca('0x1')],'defaultValue':_0xefca('0xd')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0xefca('0xe')],'get':function(_0x4e40cb){return this['getDataValue'](_0xefca('0xf'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xc000=['BOOLEAN','wav','getDataValue','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER'];(function(_0x35f30d,_0x4ff767){var _0x2dea42=function(_0x4c7734){while(--_0x4c7734){_0x35f30d['push'](_0x35f30d['shift']());}};_0x2dea42(++_0x4ff767);}(_0xc000,0xcf));var _0x0c00=function(_0x43ead6,_0x156392){_0x43ead6=_0x43ead6-0x0;var _0x1419a5=_0xc000[_0x43ead6];return _0x1419a5;};'use strict';var Sequelize=require('sequelize');module[_0x0c00('0x0')]={'context':{'type':Sequelize[_0x0c00('0x1')],'allowNull':![],'unique':_0x0c00('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x0c00('0x1')],'allowNull':![],'unique':_0x0c00('0x2')},'priority':{'type':Sequelize[_0x0c00('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x0c00('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0c00('0x1')],'allowNull':![],'defaultValue':_0x0c00('0x3')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x0c00('0x4')](_0x0c00('0x5'),_0x0c00('0x6'),_0x0c00('0x7'),_0x0c00('0x8'),_0x0c00('0x9'),_0x0c00('0xa'),_0x0c00('0xb')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0c00('0x1')],'allowNull':![],'defaultValue':_0x0c00('0xc')},'IntervalId':{'type':Sequelize[_0x0c00('0xd')]},'isApp':{'type':Sequelize[_0x0c00('0xe')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0c00('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0c00('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x0c00('0xe')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x0c00('0xd')]},'recordingFormat':{'type':Sequelize[_0x0c00('0x1')],'defaultValue':_0x0c00('0xf')},'answer':{'type':Sequelize[_0x0c00('0xe')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2b597f){return this[_0x0c00('0x10')]('exten');}},'alias':{'type':Sequelize[_0x0c00('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index cc0e86d..551ca6d 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 _0x1aee=['concat','role','user','InboundRoutes','internal','find','UserProfileSection','userProfileId','autoAssociation','error','update','context','description','cutdigits','alias','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','findOne','isApp','createRouting','bulkCreate','findAndCountAll','priority','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','destroy','then','get','inbound','OutboundRoutes','outbound','InternalRoutes','filter','ignore','map','value','includes','type','name','UserProfileResource','stack','send','VoiceExtension','rawAttributes','key','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','startsWith','exten'];(function(_0x511324,_0x5b2951){var _0x493eb2=function(_0x545e00){while(--_0x545e00){_0x511324['push'](_0x511324['shift']());}};_0x493eb2(++_0x5b2951);}(_0x1aee,0x7b));var _0xe1ae=function(_0x164af1,_0x3cf772){_0x164af1=_0x164af1-0x0;var _0x5d81a2=_0x1aee[_0x164af1];return _0x5d81a2;};'use strict';var _=require(_0xe1ae('0x0'));var Redis=require(_0xe1ae('0x1'));var qs=require(_0xe1ae('0x2'));var logger=require(_0xe1ae('0x3'))(_0xe1ae('0x4'));var config=require(_0xe1ae('0x5'));var db=require(_0xe1ae('0x6'))['db'];config['redis']=_[_0xe1ae('0x7')](config['redis'],{'host':_0xe1ae('0x8'),'port':0x18eb});var socket=require(_0xe1ae('0x9'))(new Redis(config[_0xe1ae('0xa')]));require(_0xe1ae('0xb'))[_0xe1ae('0xc')](socket);function respondWithStatusCode(_0x11ee77,_0x5958b9){_0x5958b9=_0x5958b9||0xcc;return function(_0x20d780){if(_0x20d780){return _0x11ee77[_0xe1ae('0xd')](_0x5958b9);}return _0x11ee77[_0xe1ae('0xe')](_0x5958b9)[_0xe1ae('0xf')]();};}function respondWithResult(_0x18f203,_0xb03a53){_0xb03a53=_0xb03a53||0xc8;return function(_0x46b9a1){if(_0x46b9a1){return _0x18f203[_0xe1ae('0xe')](_0xb03a53)[_0xe1ae('0x10')](_0x46b9a1);}};}function respondWithFilteredResult(_0x1b6297,_0x343b09){return function(_0x35b1b8){if(_0x35b1b8){var _0x148c07=typeof _0x343b09[_0xe1ae('0x11')]===_0xe1ae('0x12')&&typeof _0x343b09[_0xe1ae('0x13')]==='undefined';var _0x331ab5=_0x35b1b8['count'];var _0x9d3eb3=_0x148c07?0x0:_0x343b09[_0xe1ae('0x11')];var _0x1c5719=_0x148c07?_0x35b1b8[_0xe1ae('0x14')]:_0x343b09[_0xe1ae('0x11')]+_0x343b09[_0xe1ae('0x13')];var _0x77adfe;if(_0x1c5719>=_0x331ab5){_0x1c5719=_0x331ab5;_0x77adfe=0xc8;}else{_0x77adfe=0xce;}_0x1b6297[_0xe1ae('0xe')](_0x77adfe);return _0x1b6297[_0xe1ae('0x15')]('Content-Range',_0x9d3eb3+'-'+_0x1c5719+'/'+_0x331ab5)[_0xe1ae('0x10')](_0x35b1b8);}return null;};}function removeEntity(_0x19d491){return function(_0x501f56){if(_0x501f56){return _0x501f56[_0xe1ae('0x16')]()[_0xe1ae('0x17')](function(){var _0x55ead0=_0x501f56[_0xe1ae('0x18')]({'plain':!![]});var _0x24cc9a=[{'name':'InboundRoutes','value':_0xe1ae('0x19'),'ignore':![]},{'name':_0xe1ae('0x1a'),'value':_0xe1ae('0x1b'),'ignore':![]},{'name':_0xe1ae('0x1c'),'value':'internal','ignore':![]}];var _0x6be98b=_(_0x24cc9a)[_0xe1ae('0x1d')](_0xe1ae('0x1e'))[_0xe1ae('0x1f')](_0xe1ae('0x20'))['value']();if(_[_0xe1ae('0x21')](_0x6be98b,_0x55ead0[_0xe1ae('0x22')])){return;}var _0x2d6c12=_['find'](_0x24cc9a,[_0xe1ae('0x20'),_0x55ead0[_0xe1ae('0x22')]])[_0xe1ae('0x23')];return db[_0xe1ae('0x24')]['destroy']({'where':{'type':_0x2d6c12,'resourceId':_0x55ead0['id']}})[_0xe1ae('0x17')](function(){return _0x501f56;});})[_0xe1ae('0x17')](function(){_0x19d491[_0xe1ae('0xe')](0xcc)[_0xe1ae('0xf')]();});}};}function handleEntityNotFound(_0x1f39cf){return function(_0x5066c0){if(!_0x5066c0){_0x1f39cf['sendStatus'](0x194);}return _0x5066c0;};}function handleError(_0x219af0,_0x45dbf9){_0x45dbf9=_0x45dbf9||0x1f4;return function(_0x5b81a4){logger['error'](_0x5b81a4[_0xe1ae('0x25')]);if(_0x5b81a4['name']){delete _0x5b81a4[_0xe1ae('0x23')];}_0x219af0[_0xe1ae('0xe')](_0x45dbf9)[_0xe1ae('0x26')](_0x5b81a4);};}exports['index']=function(_0x26826f,_0x268cc5){var _0x4d9e03={},_0x567873={},_0x35dc7a={'count':0x0,'rows':[]};var _0x21fd29=_[_0xe1ae('0x1f')](db[_0xe1ae('0x27')][_0xe1ae('0x28')],function(_0xaad2c1){return{'name':_0xaad2c1['fieldName'],'type':_0xaad2c1[_0xe1ae('0x22')][_0xe1ae('0x29')]};});_0x567873[_0xe1ae('0x2a')]=_[_0xe1ae('0x1f')](_0x21fd29,_0xe1ae('0x23'));_0x567873['query']=_[_0xe1ae('0x2b')](_0x26826f[_0xe1ae('0x2c')]);_0x567873['filters']=_[_0xe1ae('0x2d')](_0x567873[_0xe1ae('0x2a')],_0x567873[_0xe1ae('0x2c')]);_0x4d9e03[_0xe1ae('0x2e')]=_[_0xe1ae('0x2d')](_0x567873['model'],qs[_0xe1ae('0x2f')](_0x26826f[_0xe1ae('0x2c')][_0xe1ae('0x2f')]));_0x4d9e03['attributes']=_0x4d9e03[_0xe1ae('0x2e')][_0xe1ae('0x30')]?_0x4d9e03[_0xe1ae('0x2e')]:_0x567873[_0xe1ae('0x2a')];if(!_0x26826f[_0xe1ae('0x2c')]['hasOwnProperty'](_0xe1ae('0x31'))){_0x4d9e03[_0xe1ae('0x13')]=qs[_0xe1ae('0x13')](_0x26826f['query'][_0xe1ae('0x13')]);_0x4d9e03[_0xe1ae('0x11')]=qs['offset'](_0x26826f[_0xe1ae('0x2c')]['offset']);}_0x4d9e03[_0xe1ae('0x32')]=qs[_0xe1ae('0x33')](_0x26826f[_0xe1ae('0x2c')][_0xe1ae('0x33')]);_0x4d9e03[_0xe1ae('0x34')]=qs[_0xe1ae('0x35')](_[_0xe1ae('0x36')](_0x26826f[_0xe1ae('0x2c')],_0x567873[_0xe1ae('0x35')]),_0x21fd29);if(_0x26826f[_0xe1ae('0x2c')]['filter']){_0x4d9e03[_0xe1ae('0x34')]=_['merge'](_0x4d9e03['where'],{'$or':_[_0xe1ae('0x1f')](_0x21fd29,function(_0x111890){if(_0x111890[_0xe1ae('0x22')]!==_0xe1ae('0x37')){var _0x1d7db2={};_0x1d7db2[_0x111890[_0xe1ae('0x23')]]={'$like':'%'+_0x26826f[_0xe1ae('0x2c')]['filter']+'%'};return _0x1d7db2;}})});}_0x4d9e03=_[_0xe1ae('0x38')]({},_0x4d9e03,_0x26826f[_0xe1ae('0x39')]);var _0x7a1bf9={'where':_0x4d9e03['where']};return db['VoiceExtension'][_0xe1ae('0x14')](_0x7a1bf9)[_0xe1ae('0x17')](function(_0x512772){_0x35dc7a['count']=_0x512772;if(_0x26826f['query'][_0xe1ae('0x3a')]){_0x4d9e03[_0xe1ae('0x3b')]=[{'all':!![]}];}return db[_0xe1ae('0x27')][_0xe1ae('0x3c')](_0x4d9e03);})[_0xe1ae('0x17')](function(_0x4dc318){_0x35dc7a[_0xe1ae('0x3d')]=_0x4dc318;return _0x35dc7a;})[_0xe1ae('0x17')](respondWithFilteredResult(_0x268cc5,_0x4d9e03))[_0xe1ae('0x3e')](handleError(_0x268cc5,null));};exports[_0xe1ae('0x3f')]=function(_0x285a74,_0x272722){var _0x5d1dfd={'raw':![],'where':{'id':_0x285a74[_0xe1ae('0x40')]['id']}},_0x23dd45={};_0x23dd45[_0xe1ae('0x2a')]=_[_0xe1ae('0x2b')](db[_0xe1ae('0x27')][_0xe1ae('0x28')]);_0x23dd45['query']=_['keys'](_0x285a74[_0xe1ae('0x2c')]);_0x23dd45[_0xe1ae('0x35')]=_[_0xe1ae('0x2d')](_0x23dd45[_0xe1ae('0x2a')],_0x23dd45['query']);_0x5d1dfd[_0xe1ae('0x2e')]=_['intersection'](_0x23dd45[_0xe1ae('0x2a')],qs['fields'](_0x285a74[_0xe1ae('0x2c')][_0xe1ae('0x2f')]));_0x5d1dfd['attributes']=_0x5d1dfd[_0xe1ae('0x2e')]['length']?_0x5d1dfd['attributes']:_0x23dd45[_0xe1ae('0x2a')];if(_0x285a74[_0xe1ae('0x2c')][_0xe1ae('0x3a')]){_0x5d1dfd[_0xe1ae('0x3b')]=[{'all':!![]}];}_0x5d1dfd=_[_0xe1ae('0x38')]({},_0x5d1dfd,_0x285a74[_0xe1ae('0x39')]);return db['VoiceExtension']['find'](_0x5d1dfd)['then'](handleEntityNotFound(_0x272722,null))[_0xe1ae('0x17')](respondWithResult(_0x272722,null))[_0xe1ae('0x3e')](handleError(_0x272722,null));};exports[_0xe1ae('0x16')]=function(_0x43efcf,_0x2c1421){return db[_0xe1ae('0x27')]['find']({'where':{'id':_0x43efcf[_0xe1ae('0x40')]['id']}})[_0xe1ae('0x17')](handleEntityNotFound(_0x2c1421,null))[_0xe1ae('0x17')](removeEntity(_0x2c1421,null))['catch'](handleError(_0x2c1421,null));};exports[_0xe1ae('0x41')]=function(_0x57199b,_0x5b1b93){if(_0x57199b[_0xe1ae('0x42')][_0xe1ae('0x22')]==='outbound'&&!_[_0xe1ae('0x43')](_0x57199b[_0xe1ae('0x42')][_0xe1ae('0x44')],'_')){_0x57199b[_0xe1ae('0x42')][_0xe1ae('0x44')]='_'[_0xe1ae('0x45')](_0x57199b[_0xe1ae('0x42')][_0xe1ae('0x44')]);}return db[_0xe1ae('0x27')][_0xe1ae('0x41')](_0x57199b['body'],{'raw':![]})['then'](function(_0x2a6919){var _0x205b31=_0x57199b['user'][_0xe1ae('0x18')]({'plain':!![]});if(!_0x205b31)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x205b31[_0xe1ae('0x46')]===_0xe1ae('0x47')){var _0x29acee=_0x2a6919[_0xe1ae('0x18')]({'plain':!![]});var _0xbcebc=[{'name':_0xe1ae('0x48'),'value':_0xe1ae('0x19')},{'name':'OutboundRoutes','value':_0xe1ae('0x1b')},{'name':_0xe1ae('0x1c'),'value':_0xe1ae('0x49')}];var _0x2cb44e=_[_0xe1ae('0x4a')](_0xbcebc,[_0xe1ae('0x20'),_0x29acee['type']])[_0xe1ae('0x23')];return db[_0xe1ae('0x4b')][_0xe1ae('0x4a')]({'where':{'name':_0x2cb44e,'userProfileId':_0x205b31[_0xe1ae('0x4c')]},'raw':!![]})[_0xe1ae('0x17')](function(_0x2e1b9a){if(_0x2e1b9a&&_0x2e1b9a[_0xe1ae('0x4d')]===0x0){return db[_0xe1ae('0x24')][_0xe1ae('0x41')]({'name':_0x29acee[_0xe1ae('0x23')],'resourceId':_0x29acee['id'],'type':_0x2e1b9a[_0xe1ae('0x23')],'sectionId':_0x2e1b9a['id']},{})[_0xe1ae('0x17')](function(){return _0x2a6919;});}else{return _0x2a6919;}})[_0xe1ae('0x3e')](function(_0x22c31f){logger[_0xe1ae('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x22c31f);throw _0x22c31f;});}return _0x2a6919;})[_0xe1ae('0x17')](respondWithResult(_0x5b1b93,0xc9))[_0xe1ae('0x3e')](handleError(_0x5b1b93,null));};exports[_0xe1ae('0x4f')]=function(_0x440750,_0x4d6a05){if(_0x440750[_0xe1ae('0x42')]['id']){delete _0x440750[_0xe1ae('0x42')]['id'];}return db['VoiceExtension'][_0xe1ae('0x4a')]({'where':{'id':_0x440750[_0xe1ae('0x40')]['id']}})[_0xe1ae('0x17')](handleEntityNotFound(_0x4d6a05,null))[_0xe1ae('0x17')](function(_0x332279){if(_0x332279){return db[_0xe1ae('0x27')][_0xe1ae('0x4f')](_['pick'](_0x440750['body'],['exten',_0xe1ae('0x50'),_0xe1ae('0x51'),'recordingFormat',_0xe1ae('0x52'),'mandatoryDisposition',_0xe1ae('0x53')]),{'where':{'context':_0x332279[_0xe1ae('0x50')],'exten':_0x332279[_0xe1ae('0x44')]},'individualHooks':!![]})[_0xe1ae('0x17')](function(_0x2a9240){return _0x2a9240;});}return null;})[_0xe1ae('0x17')](respondWithStatusCode(_0x4d6a05,null))[_0xe1ae('0x3e')](handleError(_0x4d6a05,null));};exports[_0xe1ae('0x54')]=function(_0xdbff88,_0xba1a8){var _0x5b3776=_0xdbff88['params']['id'];var _0xd4f159=_0xdbff88[_0xe1ae('0x42')];var _0x235e6a=0xc8;var _0x462994=null;return db[_0xe1ae('0x55')][_0xe1ae('0x56')]({'isolationLevel':db[_0xe1ae('0x55')][_0xe1ae('0x57')]['ISOLATION_LEVELS'][_0xe1ae('0x58')]},function(_0x4bec16){return db['VoiceExtension'][_0xe1ae('0x59')]({'where':{'id':_0x5b3776},'transaction':_0x4bec16})[_0xe1ae('0x17')](function(_0x35cd1b){if(_0x35cd1b){return db[_0xe1ae('0x27')][_0xe1ae('0x16')]({'where':{'VoiceExtensionId':_0x5b3776},'transaction':_0x4bec16})[_0xe1ae('0x17')](function(){var _0x2ce2e9=_[_0xe1ae('0x1f')](_0xd4f159,function(_0xec39b3){_0xec39b3['VoiceExtensionId']=_0x5b3776;_0xec39b3[_0xe1ae('0x5a')]=!![];return _0xec39b3;});return _0x35cd1b[_0xe1ae('0x5b')](_0x2ce2e9);})[_0xe1ae('0x17')](function(_0x31038f){return db['VoiceExtension'][_0xe1ae('0x5c')](_0x31038f,{'transaction':_0x4bec16});});}else{_0x235e6a=0x194;_0x462994=[];}});})[_0xe1ae('0x17')](function(){if(_0x235e6a!==0x194){return db[_0xe1ae('0x27')][_0xe1ae('0x5d')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5b3776},'order':_0xe1ae('0x5e')})[_0xe1ae('0x17')](function(_0x4f2c49){_0x462994=_0x4f2c49;});}})['catch'](function(_0x48b67d){_0x235e6a=0x1f4;logger['error'](_0x48b67d[_0xe1ae('0x25')]);if(_0x48b67d['name']){delete _0x48b67d[_0xe1ae('0x23')];}_0x462994=_0x48b67d;})[_0xe1ae('0x5f')](function(){if(_0x462994===null){_0xba1a8[_0xe1ae('0xd')](_0x235e6a);}else{if(_0x235e6a===0x1f4){_0xba1a8[_0xe1ae('0xe')](_0x235e6a)[_0xe1ae('0x26')](_0x462994);}else{_0xba1a8[_0xe1ae('0xe')](_0x235e6a)['json'](_0x462994);}}});}; \ No newline at end of file +var _0xddbb=['key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','keys','catch','params','create','body','startsWith','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','cutdigits','mandatoryDisposition','alias','context','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','VoiceExtensionId','createRouting','bulkCreate','findAndCountAll','priority','finally','sendStatus','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','status','end','json','undefined','count','offset','limit','set','Content-Range','then','InboundRoutes','inbound','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','type','find','UserProfileResource','destroy','error','name','send','VoiceExtension','rawAttributes','fieldName'];(function(_0x156ed4,_0x249717){var _0x499d24=function(_0x44ca6){while(--_0x44ca6){_0x156ed4['push'](_0x156ed4['shift']());}};_0x499d24(++_0x249717);}(_0xddbb,0x1bb));var _0xbddb=function(_0x1c5bd0,_0x258f8e){_0x1c5bd0=_0x1c5bd0-0x0;var _0x4ac59d=_0xddbb[_0x1c5bd0];return _0x4ac59d;};'use strict';var _=require(_0xbddb('0x0'));var Redis=require(_0xbddb('0x1'));var qs=require(_0xbddb('0x2'));var logger=require(_0xbddb('0x3'))(_0xbddb('0x4'));var config=require(_0xbddb('0x5'));var db=require('../../mysqldb')['db'];config[_0xbddb('0x6')]=_[_0xbddb('0x7')](config[_0xbddb('0x6')],{'host':_0xbddb('0x8'),'port':0x18eb});var socket=require(_0xbddb('0x9'))(new Redis(config['redis']));require(_0xbddb('0xa'))[_0xbddb('0xb')](socket);function respondWithStatusCode(_0x6e3297,_0x841f2d){_0x841f2d=_0x841f2d||0xcc;return function(_0x38f02c){if(_0x38f02c){return _0x6e3297['sendStatus'](_0x841f2d);}return _0x6e3297[_0xbddb('0xc')](_0x841f2d)[_0xbddb('0xd')]();};}function respondWithResult(_0x3910a1,_0x21c479){_0x21c479=_0x21c479||0xc8;return function(_0x2eb03f){if(_0x2eb03f){return _0x3910a1[_0xbddb('0xc')](_0x21c479)[_0xbddb('0xe')](_0x2eb03f);}};}function respondWithFilteredResult(_0x17b61d,_0x394f96){return function(_0x5c112a){if(_0x5c112a){var _0xda43d5=typeof _0x394f96['offset']===_0xbddb('0xf')&&typeof _0x394f96['limit']==='undefined';var _0xfd7ab1=_0x5c112a[_0xbddb('0x10')];var _0x2d0f7f=_0xda43d5?0x0:_0x394f96[_0xbddb('0x11')];var _0x7c3491=_0xda43d5?_0x5c112a[_0xbddb('0x10')]:_0x394f96['offset']+_0x394f96[_0xbddb('0x12')];var _0x2fc13b;if(_0x7c3491>=_0xfd7ab1){_0x7c3491=_0xfd7ab1;_0x2fc13b=0xc8;}else{_0x2fc13b=0xce;}_0x17b61d[_0xbddb('0xc')](_0x2fc13b);return _0x17b61d[_0xbddb('0x13')](_0xbddb('0x14'),_0x2d0f7f+'-'+_0x7c3491+'/'+_0xfd7ab1)[_0xbddb('0xe')](_0x5c112a);}return null;};}function removeEntity(_0x466dcf){return function(_0x49665d){if(_0x49665d){return _0x49665d['destroy']()[_0xbddb('0x15')](function(){var _0x5d53a6=_0x49665d['get']({'plain':!![]});var _0x55ac0a=[{'name':_0xbddb('0x16'),'value':_0xbddb('0x17'),'ignore':![]},{'name':'OutboundRoutes','value':_0xbddb('0x18'),'ignore':![]},{'name':_0xbddb('0x19'),'value':_0xbddb('0x1a'),'ignore':![]}];var _0x3dd792=_(_0x55ac0a)[_0xbddb('0x1b')](_0xbddb('0x1c'))[_0xbddb('0x1d')](_0xbddb('0x1e'))[_0xbddb('0x1e')]();if(_[_0xbddb('0x1f')](_0x3dd792,_0x5d53a6[_0xbddb('0x20')])){return;}var _0x223597=_[_0xbddb('0x21')](_0x55ac0a,['value',_0x5d53a6[_0xbddb('0x20')]])['name'];return db[_0xbddb('0x22')][_0xbddb('0x23')]({'where':{'type':_0x223597,'resourceId':_0x5d53a6['id']}})[_0xbddb('0x15')](function(){return _0x49665d;});})[_0xbddb('0x15')](function(){_0x466dcf['status'](0xcc)[_0xbddb('0xd')]();});}};}function handleEntityNotFound(_0x52f458){return function(_0x26200a){if(!_0x26200a){_0x52f458['sendStatus'](0x194);}return _0x26200a;};}function handleError(_0x8ce7a5,_0x16972d){_0x16972d=_0x16972d||0x1f4;return function(_0x304d6f){logger[_0xbddb('0x24')](_0x304d6f['stack']);if(_0x304d6f[_0xbddb('0x25')]){delete _0x304d6f['name'];}_0x8ce7a5[_0xbddb('0xc')](_0x16972d)[_0xbddb('0x26')](_0x304d6f);};}exports['index']=function(_0x18bb68,_0x29a80c){var _0x4d2b41={},_0x28b83c={},_0x393899={'count':0x0,'rows':[]};var _0x2ff7be=_[_0xbddb('0x1d')](db[_0xbddb('0x27')][_0xbddb('0x28')],function(_0x45b3b2){return{'name':_0x45b3b2[_0xbddb('0x29')],'type':_0x45b3b2[_0xbddb('0x20')][_0xbddb('0x2a')]};});_0x28b83c[_0xbddb('0x2b')]=_['map'](_0x2ff7be,_0xbddb('0x25'));_0x28b83c['query']=_['keys'](_0x18bb68[_0xbddb('0x2c')]);_0x28b83c[_0xbddb('0x2d')]=_[_0xbddb('0x2e')](_0x28b83c['model'],_0x28b83c[_0xbddb('0x2c')]);_0x4d2b41['attributes']=_['intersection'](_0x28b83c[_0xbddb('0x2b')],qs[_0xbddb('0x2f')](_0x18bb68[_0xbddb('0x2c')][_0xbddb('0x2f')]));_0x4d2b41[_0xbddb('0x30')]=_0x4d2b41['attributes'][_0xbddb('0x31')]?_0x4d2b41['attributes']:_0x28b83c[_0xbddb('0x2b')];if(!_0x18bb68[_0xbddb('0x2c')][_0xbddb('0x32')]('nolimit')){_0x4d2b41[_0xbddb('0x12')]=qs[_0xbddb('0x12')](_0x18bb68['query'][_0xbddb('0x12')]);_0x4d2b41[_0xbddb('0x11')]=qs[_0xbddb('0x11')](_0x18bb68[_0xbddb('0x2c')]['offset']);}_0x4d2b41[_0xbddb('0x33')]=qs[_0xbddb('0x34')](_0x18bb68[_0xbddb('0x2c')][_0xbddb('0x34')]);_0x4d2b41[_0xbddb('0x35')]=qs['filters'](_[_0xbddb('0x36')](_0x18bb68[_0xbddb('0x2c')],_0x28b83c[_0xbddb('0x2d')]),_0x2ff7be);if(_0x18bb68['query'][_0xbddb('0x1b')]){_0x4d2b41['where']=_['merge'](_0x4d2b41[_0xbddb('0x35')],{'$or':_[_0xbddb('0x1d')](_0x2ff7be,function(_0x3f9134){if(_0x3f9134[_0xbddb('0x20')]!==_0xbddb('0x37')){var _0x112697={};_0x112697[_0x3f9134[_0xbddb('0x25')]]={'$like':'%'+_0x18bb68[_0xbddb('0x2c')][_0xbddb('0x1b')]+'%'};return _0x112697;}})});}_0x4d2b41=_[_0xbddb('0x38')]({},_0x4d2b41,_0x18bb68[_0xbddb('0x39')]);var _0x4ab9df={'where':_0x4d2b41[_0xbddb('0x35')]};return db[_0xbddb('0x27')][_0xbddb('0x10')](_0x4ab9df)[_0xbddb('0x15')](function(_0x4103f7){_0x393899[_0xbddb('0x10')]=_0x4103f7;if(_0x18bb68[_0xbddb('0x2c')][_0xbddb('0x3a')]){_0x4d2b41[_0xbddb('0x3b')]=[{'all':!![]}];}return db[_0xbddb('0x27')][_0xbddb('0x3c')](_0x4d2b41);})['then'](function(_0x209358){_0x393899[_0xbddb('0x3d')]=_0x209358;return _0x393899;})[_0xbddb('0x15')](respondWithFilteredResult(_0x29a80c,_0x4d2b41))['catch'](handleError(_0x29a80c,null));};exports['show']=function(_0x3172dc,_0x2d85cb){var _0x46edd2={'raw':![],'where':{'id':_0x3172dc['params']['id']}},_0x4c78e4={};_0x4c78e4['model']=_[_0xbddb('0x3e')](db['VoiceExtension'][_0xbddb('0x28')]);_0x4c78e4[_0xbddb('0x2c')]=_[_0xbddb('0x3e')](_0x3172dc[_0xbddb('0x2c')]);_0x4c78e4[_0xbddb('0x2d')]=_[_0xbddb('0x2e')](_0x4c78e4['model'],_0x4c78e4[_0xbddb('0x2c')]);_0x46edd2[_0xbddb('0x30')]=_[_0xbddb('0x2e')](_0x4c78e4[_0xbddb('0x2b')],qs[_0xbddb('0x2f')](_0x3172dc[_0xbddb('0x2c')][_0xbddb('0x2f')]));_0x46edd2[_0xbddb('0x30')]=_0x46edd2[_0xbddb('0x30')][_0xbddb('0x31')]?_0x46edd2[_0xbddb('0x30')]:_0x4c78e4[_0xbddb('0x2b')];if(_0x3172dc['query'][_0xbddb('0x3a')]){_0x46edd2['include']=[{'all':!![]}];}_0x46edd2=_[_0xbddb('0x38')]({},_0x46edd2,_0x3172dc[_0xbddb('0x39')]);return db[_0xbddb('0x27')][_0xbddb('0x21')](_0x46edd2)[_0xbddb('0x15')](handleEntityNotFound(_0x2d85cb,null))[_0xbddb('0x15')](respondWithResult(_0x2d85cb,null))[_0xbddb('0x3f')](handleError(_0x2d85cb,null));};exports['destroy']=function(_0x2fa2ea,_0x5b7239){return db['VoiceExtension'][_0xbddb('0x21')]({'where':{'id':_0x2fa2ea[_0xbddb('0x40')]['id']}})['then'](handleEntityNotFound(_0x5b7239,null))['then'](removeEntity(_0x5b7239,null))[_0xbddb('0x3f')](handleError(_0x5b7239,null));};exports[_0xbddb('0x41')]=function(_0x36781e,_0x34ea74){if(_0x36781e[_0xbddb('0x42')][_0xbddb('0x20')]===_0xbddb('0x18')&&!_[_0xbddb('0x43')](_0x36781e[_0xbddb('0x42')][_0xbddb('0x44')],'_')){_0x36781e[_0xbddb('0x42')][_0xbddb('0x44')]='_'[_0xbddb('0x45')](_0x36781e['body'][_0xbddb('0x44')]);}return db[_0xbddb('0x27')][_0xbddb('0x41')](_0x36781e[_0xbddb('0x42')],{'raw':![]})[_0xbddb('0x15')](function(_0x579cad){var _0x35cdf6=_0x36781e['user']['get']({'plain':!![]});if(!_0x35cdf6)throw new Error(_0xbddb('0x46'));if(_0x35cdf6[_0xbddb('0x47')]===_0xbddb('0x48')){var _0x1cf7fd=_0x579cad[_0xbddb('0x49')]({'plain':!![]});var _0x54eeb6=[{'name':_0xbddb('0x16'),'value':_0xbddb('0x17')},{'name':'OutboundRoutes','value':_0xbddb('0x18')},{'name':'InternalRoutes','value':'internal'}];var _0x2b4e37=_['find'](_0x54eeb6,[_0xbddb('0x1e'),_0x1cf7fd['type']])[_0xbddb('0x25')];return db[_0xbddb('0x4a')]['find']({'where':{'name':_0x2b4e37,'userProfileId':_0x35cdf6[_0xbddb('0x4b')]},'raw':!![]})[_0xbddb('0x15')](function(_0x8d90b6){if(_0x8d90b6&&_0x8d90b6[_0xbddb('0x4c')]===0x0){return db[_0xbddb('0x22')][_0xbddb('0x41')]({'name':_0x1cf7fd[_0xbddb('0x25')],'resourceId':_0x1cf7fd['id'],'type':_0x8d90b6['name'],'sectionId':_0x8d90b6['id']},{})[_0xbddb('0x15')](function(){return _0x579cad;});}else{return _0x579cad;}})[_0xbddb('0x3f')](function(_0x5bd9cf){logger[_0xbddb('0x24')](_0xbddb('0x4d'),_0x5bd9cf);throw _0x5bd9cf;});}return _0x579cad;})[_0xbddb('0x15')](respondWithResult(_0x34ea74,0xc9))[_0xbddb('0x3f')](handleError(_0x34ea74,null));};exports[_0xbddb('0x4e')]=function(_0x44d06b,_0x8a802f){if(_0x44d06b[_0xbddb('0x42')]['id']){delete _0x44d06b['body']['id'];}return db[_0xbddb('0x27')][_0xbddb('0x21')]({'where':{'id':_0x44d06b[_0xbddb('0x40')]['id']}})['then'](handleEntityNotFound(_0x8a802f,null))[_0xbddb('0x15')](function(_0x4baf4c){if(_0x4baf4c){return db[_0xbddb('0x27')][_0xbddb('0x4e')](_[_0xbddb('0x36')](_0x44d06b[_0xbddb('0x42')],[_0xbddb('0x44'),'context',_0xbddb('0x4f'),_0xbddb('0x50'),_0xbddb('0x51'),_0xbddb('0x52'),_0xbddb('0x53')]),{'where':{'context':_0x4baf4c[_0xbddb('0x54')],'exten':_0x4baf4c[_0xbddb('0x44')]},'individualHooks':!![]})['then'](function(_0x44b069){return _0x44b069;});}return null;})[_0xbddb('0x15')](respondWithStatusCode(_0x8a802f,null))[_0xbddb('0x3f')](handleError(_0x8a802f,null));};exports[_0xbddb('0x55')]=function(_0x2f3303,_0x56698b){var _0xcfd69d=_0x2f3303[_0xbddb('0x40')]['id'];var _0x403cc6=_0x2f3303[_0xbddb('0x42')];var _0x16555c=0xc8;var _0x5bb5a8=null;return db[_0xbddb('0x56')][_0xbddb('0x57')]({'isolationLevel':db[_0xbddb('0x56')][_0xbddb('0x58')][_0xbddb('0x59')]['READ_COMMITTED']},function(_0x3071c0){return db[_0xbddb('0x27')]['findOne']({'where':{'id':_0xcfd69d},'transaction':_0x3071c0})[_0xbddb('0x15')](function(_0x3137bb){if(_0x3137bb){return db['VoiceExtension'][_0xbddb('0x23')]({'where':{'VoiceExtensionId':_0xcfd69d},'transaction':_0x3071c0})[_0xbddb('0x15')](function(){var _0x45fdeb=_[_0xbddb('0x1d')](_0x403cc6,function(_0xbe9241){_0xbe9241[_0xbddb('0x5a')]=_0xcfd69d;_0xbe9241['isApp']=!![];return _0xbe9241;});return _0x3137bb[_0xbddb('0x5b')](_0x45fdeb);})[_0xbddb('0x15')](function(_0x3a7d85){return db[_0xbddb('0x27')][_0xbddb('0x5c')](_0x3a7d85,{'transaction':_0x3071c0});});}else{_0x16555c=0x194;_0x5bb5a8=[];}});})['then'](function(){if(_0x16555c!==0x194){return db['VoiceExtension'][_0xbddb('0x5d')]({'where':{'isApp':!![],'VoiceExtensionId':_0xcfd69d},'order':_0xbddb('0x5e')})['then'](function(_0x10ebcb){_0x5bb5a8=_0x10ebcb;});}})[_0xbddb('0x3f')](function(_0x45f45e){_0x16555c=0x1f4;logger[_0xbddb('0x24')](_0x45f45e['stack']);if(_0x45f45e[_0xbddb('0x25')]){delete _0x45f45e[_0xbddb('0x25')];}_0x5bb5a8=_0x45f45e;})[_0xbddb('0x5f')](function(){if(_0x5bb5a8===null){_0x56698b[_0xbddb('0x60')](_0x16555c);}else{if(_0x16555c===0x1f4){_0x56698b[_0xbddb('0xc')](_0x16555c)[_0xbddb('0x26')](_0x5bb5a8);}else{_0x56698b['status'](_0x16555c)[_0xbddb('0xe')](_0x5bb5a8);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 00ae344..e806837 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 _0x9bf2=['update','remove','emit','hook','exports','events','VoiceExtension','setMaxListeners','save'];(function(_0x45370c,_0x4fa896){var _0x3aa71a=function(_0x40ce53){while(--_0x40ce53){_0x45370c['push'](_0x45370c['shift']());}};_0x3aa71a(++_0x4fa896);}(_0x9bf2,0x137));var _0x29bf=function(_0xdae077,_0x206a0b){_0xdae077=_0xdae077-0x0;var _0x3868e4=_0x9bf2[_0xdae077];return _0x3868e4;};'use strict';var EventEmitter=require(_0x29bf('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x29bf('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x29bf('0x2')](0x0);var events={'afterCreate':_0x29bf('0x3'),'afterUpdate':_0x29bf('0x4'),'afterDestroy':_0x29bf('0x5')};function emitEvent(_0x404555){return function(_0x3ebc43,_0x50e655,_0x42b5ca){VoiceExtensionEvents[_0x29bf('0x6')](_0x404555+':'+_0x3ebc43['id'],_0x3ebc43);VoiceExtensionEvents[_0x29bf('0x6')](_0x404555,_0x3ebc43);_0x42b5ca(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x29bf('0x7')](e,emitEvent(event));}}module[_0x29bf('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0x0005=['exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x12d207,_0x461077){var _0x2adbaa=function(_0x4cc418){while(--_0x4cc418){_0x12d207['push'](_0x12d207['shift']());}};_0x2adbaa(++_0x461077);}(_0x0005,0x10f));var _0x5000=function(_0x357549,_0x3f1df0){_0x357549=_0x357549-0x0;var _0x4eff56=_0x0005[_0x357549];return _0x4eff56;};'use strict';var EventEmitter=require(_0x5000('0x0'));var VoiceExtension=require(_0x5000('0x1'))['db'][_0x5000('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x5000('0x3')](0x0);var events={'afterCreate':_0x5000('0x4'),'afterUpdate':_0x5000('0x5'),'afterDestroy':_0x5000('0x6')};function emitEvent(_0x85a35f){return function(_0x4dbf5d,_0x5360d5,_0x413da1){VoiceExtensionEvents[_0x5000('0x7')](_0x85a35f+':'+_0x4dbf5d['id'],_0x4dbf5d);VoiceExtensionEvents[_0x5000('0x7')](_0x85a35f,_0x4dbf5d);_0x413da1(null);};}for(var e in events){if(events[_0x5000('0x8')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x5000('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 147f10f..e7fc7b7 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 _0x649b=['appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','exports','type','CDR(type)=','context','alias','NoOp','CDR(routeAlias)=','exten','inbound','push','Set','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','No\x20alias\x20set','CDR(destination)=','cutdigits','${EXTEN:','CDR(routeid)=','ExecIf','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','url','length','name','param','split','phone','prefix','SIP','join','options','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','filter','tag','CDR(tag)=','toLowerCase','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','outboundDial'];(function(_0x21a33e,_0x818168){var _0x40b07f=function(_0x282f45){while(--_0x282f45){_0x21a33e['push'](_0x21a33e['shift']());}};_0x40b07f(++_0x818168);}(_0x649b,0x166));var _0xb649=function(_0x149643,_0x9fef37){_0x149643=_0x149643-0x0;var _0x4bda3a=_0x649b[_0x149643];return _0x4bda3a;};'use strict';var _=require('lodash');var attributes=require('./voiceExtension.attributes');module[_0xb649('0x0')]=function(_0x1fd3a2){var _0x4ede93=_0x1fd3a2['models'];function _0xd0360e(_0x54800b){var _0x9422ae=0x2;var _0x20a3fd=[{'type':_0x54800b[_0xb649('0x1')],'app':'Set','appdata':_0xb649('0x2')+_0x54800b[_0xb649('0x1')],'context':_0x54800b[_0xb649('0x3')],'exten':_0x54800b['exten'],'priority':_0x9422ae++,'VoiceExtensionId':_0x54800b['id']},{'type':_0x54800b['type'],'app':_0x54800b[_0xb649('0x4')]?'Set':_0xb649('0x5'),'appdata':_0x54800b[_0xb649('0x4')]?_0xb649('0x6')+_0x54800b[_0xb649('0x4')]:'No\x20alias\x20set','context':_0x54800b[_0xb649('0x3')],'exten':_0x54800b[_0xb649('0x7')],'priority':_0x9422ae++,'VoiceExtensionId':_0x54800b['id']}];if(_0x54800b[_0xb649('0x1')]===_0xb649('0x8')){_0x20a3fd['push']({'type':_0xb649('0x8'),'app':'Set','appdata':'CDR(routeid)='+_0x54800b['id'],'context':_0x54800b['context'],'exten':_0x54800b[_0xb649('0x7')],'priority':_0x9422ae++,'VoiceExtensionId':_0x54800b['id']});}_0x20a3fd[_0xb649('0x9')]({'type':_0x54800b[_0xb649('0x1')],'app':_0xb649('0xa'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x54800b[_0xb649('0x3')],'exten':_0x54800b[_0xb649('0x7')],'priority':_0x9422ae++,'VoiceExtensionId':_0x54800b['id']},{'type':_0x54800b[_0xb649('0x1')],'app':'Set','appdata':_0xb649('0xb'),'context':_0x54800b[_0xb649('0x3')],'exten':_0x54800b[_0xb649('0x7')],'priority':_0x9422ae++,'VoiceExtensionId':_0x54800b['id']},{'type':_0x54800b[_0xb649('0x1')],'app':_0xb649('0xa'),'appdata':'MONITOR_OPTIONS=ab','context':_0x54800b[_0xb649('0x3')],'exten':_0x54800b[_0xb649('0x7')],'priority':_0x9422ae++,'VoiceExtensionId':_0x54800b['id']});return _0x20a3fd;}function _0x11e3c9(_0x5e455a){var _0x36c236=0x2;var _0x1030c6=[{'type':_0xb649('0xc'),'app':_0xb649('0xa'),'appdata':_0xb649('0xd'),'context':_0x5e455a['context'],'exten':_0x5e455a['exten'],'priority':_0x36c236++,'VoiceExtensionId':_0x5e455a['id']},{'type':_0xb649('0xc'),'app':_0x5e455a[_0xb649('0x4')]?_0xb649('0xa'):_0xb649('0x5'),'appdata':_0x5e455a[_0xb649('0x4')]?_0xb649('0x6')+_0x5e455a[_0xb649('0x4')]:_0xb649('0xe'),'context':_0x5e455a[_0xb649('0x3')],'exten':_0x5e455a[_0xb649('0x7')],'priority':_0x36c236++,'VoiceExtensionId':_0x5e455a['id']},{'type':'outbound','app':'Set','appdata':_0xb649('0xf')+(_0x5e455a[_0xb649('0x10')]?_0xb649('0x11')+_0x5e455a[_0xb649('0x10')]+'}':'${EXTEN}'),'context':_0x5e455a[_0xb649('0x3')],'exten':_0x5e455a[_0xb649('0x7')],'priority':_0x36c236++,'VoiceExtensionId':_0x5e455a['id']},{'type':'outbound','app':_0xb649('0xa'),'appdata':_0xb649('0x12')+_0x5e455a['id'],'context':_0x5e455a[_0xb649('0x3')],'exten':_0x5e455a[_0xb649('0x7')],'priority':_0x36c236++,'VoiceExtensionId':_0x5e455a['id']},{'type':'outbound','app':_0xb649('0x13'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x36c236+0x2)+'):Goto('+(_0x36c236+0x1)+')','context':_0x5e455a[_0xb649('0x3')],'exten':_0x5e455a[_0xb649('0x7')],'priority':_0x36c236++,'VoiceExtensionId':_0x5e455a['id']},{'type':_0xb649('0xc'),'app':_0xb649('0xa'),'appdata':_0x5e455a['cutdigits']?_0xb649('0x14')+_0x5e455a[_0xb649('0x10')]+'}':_0xb649('0x15'),'context':_0x5e455a[_0xb649('0x3')],'exten':_0x5e455a[_0xb649('0x7')],'priority':_0x36c236++,'VoiceExtensionId':_0x5e455a['id']},{'type':_0xb649('0xc'),'app':'Set','appdata':_0xb649('0x16'),'context':_0x5e455a[_0xb649('0x3')],'exten':_0x5e455a[_0xb649('0x7')],'priority':_0x36c236++,'VoiceExtensionId':_0x5e455a['id']},{'type':_0xb649('0xc'),'app':'Set','appdata':_0xb649('0xb'),'context':_0x5e455a['context'],'exten':_0x5e455a[_0xb649('0x7')],'priority':_0x36c236++,'VoiceExtensionId':_0x5e455a['id']},{'type':'outbound','app':_0xb649('0xa'),'appdata':_0xb649('0x17'),'context':_0x5e455a[_0xb649('0x3')],'exten':_0x5e455a[_0xb649('0x7')],'priority':_0x36c236++,'VoiceExtensionId':_0x5e455a['id']},{'type':_0xb649('0xc'),'app':_0xb649('0xa'),'appdata':_0xb649('0x18')+_0x5e455a['id'],'context':_0x5e455a[_0xb649('0x3')],'exten':_0x5e455a[_0xb649('0x7')],'priority':_0x36c236++,'VoiceExtensionId':_0x5e455a['id']}];if(_0x5e455a[_0xb649('0x19')](_0xb649('0x1a'))&&_0x5e455a[_0xb649('0x1a')]!==_0xb649('0x1b')){_0x1030c6['push']({'type':_0xb649('0xc'),'app':'Set','appdata':_0xb649('0x1c'),'context':_0x5e455a[_0xb649('0x3')],'exten':_0x5e455a[_0xb649('0x7')],'priority':_0x36c236++,'VoiceExtensionId':_0x5e455a['id']},{'type':'outbound','app':_0xb649('0xa'),'appdata':_0xb649('0x1d')+_0x5e455a['recordingFormat']||_0xb649('0x1e'),'context':_0x5e455a[_0xb649('0x3')],'exten':_0x5e455a[_0xb649('0x7')],'priority':_0x36c236++,'VoiceExtensionId':_0x5e455a['id']});}return _0x1030c6;}function _0x31a574(_0x384520,_0x1356ec){var _0x4c991d=[{'name':_0xb649('0x1f'),'param':0x0},{'name':_0xb649('0x20'),'param':0x1},{'name':'options','param':0x2},{'name':_0xb649('0x21'),'param':0x3}];var _0x35dd88={};var _0x2a3883=_0x1356ec['split'](',');var _0x32bce9=[];for(var _0x127ed3=0x0;_0x127ed3<_0x4c991d[_0xb649('0x22')];_0x127ed3++){switch(_0x4c991d[_0x127ed3][_0xb649('0x23')]){case _0xb649('0x1f'):_0x35dd88[_0xb649('0x1f')]=_0x2a3883[_0x4c991d[_0x127ed3][_0xb649('0x24')]][_0xb649('0x25')]('/')[0x1];_0x35dd88[_0xb649('0x26')]=_0x2a3883[_0x4c991d[_0x127ed3][_0xb649('0x24')]][_0xb649('0x25')]('/')[0x2];_0x35dd88[_0xb649('0x27')]=_0x35dd88[_0xb649('0x26')]?_0x35dd88[_0xb649('0x26')]['split']('$')[0x0]:undefined;_0x35dd88[_0xb649('0x26')]=_0x384520[_0xb649('0x10')]?(_0x35dd88[_0xb649('0x27')]||'')+'${EXTEN:'+_0x384520[_0xb649('0x10')]+'}':(_0x35dd88[_0xb649('0x27')]||'')+'${EXTEN}';_0x32bce9[_0x4c991d[_0x127ed3][_0xb649('0x24')]]=[_0xb649('0x28'),_0x35dd88[_0xb649('0x1f')],_0x35dd88[_0xb649('0x26')]][_0xb649('0x29')]('/');break;case'options':_0x35dd88['options']=_0x2a3883[_0x4c991d[_0x127ed3]['param']];if(_0x384520[_0xb649('0x1a')]!==_0xb649('0x1b')){if(_0x35dd88[_0xb649('0x2a')][_0xb649('0x2b')]('U(xcally-mixmonitor-context)')<0x0){_0x35dd88[_0xb649('0x2a')]+=_0xb649('0x2c');}}else{_0x35dd88['options']=_0x35dd88[_0xb649('0x2a')][_0xb649('0x2d')](_0xb649('0x2c'),'');}_0x32bce9[_0x4c991d[_0x127ed3][_0xb649('0x24')]]=_0x35dd88[_0xb649('0x2a')];break;default:_0x32bce9[_0x4c991d[_0x127ed3][_0xb649('0x24')]]=_0x2a3883[_0x4c991d[_0x127ed3][_0xb649('0x24')]];}}return _0x32bce9[_0xb649('0x29')](',');}function _0x1c75bd(_0x47feb1,_0x112f2f,_0x49e6ea){return new Promise(function(_0x228a60,_0x36eb4d){var _0x5d6b5f=[];if(_[_0xb649('0x2e')](_0x112f2f))return _0x228a60(_0x5d6b5f);_0x4ede93[_0xb649('0x2f')][_0xb649('0x30')]({'attributes':['id',_0xb649('0x31'),_0xb649('0x32')],'raw':!![]})[_0xb649('0x33')](function(_0x305750){for(var _0x48aa9b=0x0,_0x90c06d=0x0;_0x48aa9b<_0x112f2f[_0xb649('0x22')];_0x48aa9b++,_0x90c06d=0x0){var _0x37dbfa=_0x112f2f[_0x48aa9b];var _0x170ce6=[];var _0x3092e2=[];delete _0x37dbfa['id'];if(_0x37dbfa['interval']!==_0xb649('0x34')){_0x37dbfa['intervals']=[_0x37dbfa['interval']];}else{_0x37dbfa[_0xb649('0x35')]=_0x37dbfa[_0xb649('0x32')]?_[_0xb649('0x36')](_[_0xb649('0x37')](_0x305750,{'IntervalId':_0x37dbfa[_0xb649('0x32')]}),'interval'):[];}_0x37dbfa[_0xb649('0x3')]=_0x47feb1[_0xb649('0x3')];_0x37dbfa[_0xb649('0x7')]=_0x47feb1[_0xb649('0x7')];if(_0x37dbfa['type'])_0x37dbfa['type']=_0x37dbfa[_0xb649('0x1')]['toLowerCase']();if(_0x47feb1[_0xb649('0x1')]===_0xb649('0xc')){if(_0x37dbfa[_0xb649('0x19')](_0xb649('0x38'))&&_0x37dbfa['tag']&&_0x37dbfa[_0xb649('0x38')]!=='--'){_0x170ce6['push']({'type':_0x37dbfa['type']['toLowerCase'](),'app':_0xb649('0xa'),'appdata':_0xb649('0x39')+_0x37dbfa[_0xb649('0x38')],'context':_0x47feb1['context'],'exten':_0x47feb1[_0xb649('0x7')],'priority':_0x37dbfa[_0xb649('0x35')][_0xb649('0x22')]+_0x49e6ea+_0x90c06d++,'VoiceExtensionId':_0x47feb1['id']});}_0x170ce6[_0xb649('0x9')]({'type':_0x37dbfa[_0xb649('0x1')][_0xb649('0x3a')](),'app':_0xb649('0x13'),'appdata':_0xb649('0x3b')+(_0x37dbfa[_0xb649('0x3c')]?_0xb649('0x3d')+_0x37dbfa['callerID']+')':_0xb649('0x3e')),'context':_0x47feb1[_0xb649('0x3')],'exten':_0x47feb1[_0xb649('0x7')],'priority':_0x37dbfa[_0xb649('0x35')]['length']+_0x49e6ea+_0x90c06d++,'VoiceExtensionId':_0x47feb1['id']});}else{if(_0x37dbfa['hasOwnProperty'](_0xb649('0x3f'))){if([_0xb649('0x40'),_0xb649('0x41')][_0xb649('0x42')](_0x37dbfa[_0xb649('0x43')][_0xb649('0x3a')]())&&_0x37dbfa[_0xb649('0x44')]!==_0xb649('0x45')){if(_0x37dbfa[_0xb649('0x3f')]){_0x170ce6['push']({'type':_0x37dbfa[_0xb649('0x1')][_0xb649('0x3a')](),'app':_0xb649('0x13'),'appdata':_0xb649('0x46'),'context':_0x47feb1[_0xb649('0x3')],'exten':_0x47feb1['exten'],'priority':_0x37dbfa[_0xb649('0x35')]['length']+_0x49e6ea+_0x90c06d++,'VoiceExtensionId':_0x47feb1['id']});_0x170ce6['push']({'type':_0x37dbfa[_0xb649('0x1')][_0xb649('0x3a')](),'app':'Set','appdata':_0xb649('0x47'),'context':_0x47feb1['context'],'exten':_0x47feb1['exten'],'priority':_0x37dbfa[_0xb649('0x35')][_0xb649('0x22')]+_0x49e6ea+_0x90c06d++,'VoiceExtensionId':_0x47feb1['id']});}else{_0x170ce6['push']({'type':_0x37dbfa[_0xb649('0x1')][_0xb649('0x3a')](),'app':'ExecIf','appdata':_0xb649('0x48'),'context':_0x47feb1[_0xb649('0x3')],'exten':_0x47feb1[_0xb649('0x7')],'priority':_0x37dbfa['intervals'][_0xb649('0x22')]+_0x49e6ea+_0x90c06d++,'VoiceExtensionId':_0x47feb1['id']});_0x170ce6[_0xb649('0x9')]({'type':_0x37dbfa[_0xb649('0x1')][_0xb649('0x3a')](),'app':_0xb649('0xa'),'appdata':_0xb649('0x49'),'context':_0x47feb1[_0xb649('0x3')],'exten':_0x47feb1[_0xb649('0x7')],'priority':_0x37dbfa[_0xb649('0x35')]['length']+_0x49e6ea+_0x90c06d++,'VoiceExtensionId':_0x47feb1['id']});}}}}for(var _0x1cdc67=0x0;_0x1cdc67<_0x37dbfa[_0xb649('0x35')][_0xb649('0x22')];_0x1cdc67++){var _0x39cf25=_0x49e6ea+_0x37dbfa['intervals'][_0xb649('0x22')];var _0x440fbf=_0x1cdc67===_0x37dbfa['intervals'][_0xb649('0x22')]-0x1?_0x49e6ea+_0x170ce6[_0xb649('0x22')]+_0x3092e2[_0xb649('0x22')]+0x2:_0x49e6ea+_0x1cdc67+0x1;_0x170ce6[_0xb649('0x4a')](_0x1cdc67,0x0,{'type':_0x47feb1[_0xb649('0x1')],'app':'GotoIfTime','appdata':_0x37dbfa[_0xb649('0x35')][_0x1cdc67]+'?'+_0x47feb1['context']+_0xb649('0x4b')+_0x39cf25+':'+_0x47feb1['context']+_0xb649('0x4b')+_0x440fbf,'exten':_0x47feb1['exten'],'context':_0x47feb1['context'],'priority':_0x49e6ea+_0x1cdc67,'VoiceExtensionId':_0x47feb1['id']});}if(_0x37dbfa['appType']===_0xb649('0x4c'))_0x37dbfa[_0xb649('0x4d')]=_0x31a574(_0x47feb1,_0x37dbfa['appdata']);_0x37dbfa[_0xb649('0x4e')]=_0x170ce6['length']?_[_0xb649('0x4f')](_0x170ce6)[_0xb649('0x4e')]+0x1:_0x49e6ea;_0x5d6b5f=_[_0xb649('0x50')](_0x5d6b5f,_0x170ce6,[_0x37dbfa],_0x3092e2);_0x49e6ea=_['last'](_0x5d6b5f)[_0xb649('0x4e')]+0x1;}return _0x228a60(_0x5d6b5f);})[_0xb649('0x51')](function(_0x5467fd){_0x36eb4d(_0x5467fd);});});}return _0x1fd3a2[_0xb649('0x52')](_0xb649('0x53'),attributes,{'tableName':_0xb649('0x54'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x166c62){var _0x30461e=this[_0xb649('0x55')]({'plain':!![]});var _0x5bb222=_0x30461e[_0xb649('0x1')]===_0xb649('0xc')?_0x11e3c9(_0x30461e):_0xd0360e(_0x30461e);return _0x1c75bd(_0x30461e,_0x166c62,_[_0xb649('0x4f')](_0x5bb222)[_0xb649('0x4e')]+0x1)[_0xb649('0x33')](function(_0x2fffd3){var _0x468040=_[_0xb649('0x50')](_0x5bb222,_0x2fffd3);_0x468040[_0xb649('0x9')]({'type':_0x30461e[_0xb649('0x1')],'app':_0xb649('0x56'),'exten':_0x30461e[_0xb649('0x7')],'context':_0x30461e['context'],'priority':_[_0xb649('0x4f')](_0x468040)[_0xb649('0x4e')]+0x1,'VoiceExtensionId':_0x30461e['id']});return _0x468040;});}}});}; \ No newline at end of file +var _0xd072=['CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outbound','CDR(routeAlias)=','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','MONITOR_OPTIONS=ab','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','param','prefix','phone','SIP','indexOf','U(xcally-mixmonitor-context)','replace','join','isEmpty','findAll','interval','IntervalId','length','*,*,*,*','intervals','map','tag','toLowerCase','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','playback','app','appType','custom','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appdata','priority','last','concat','catch','define','voice_extensions','get','then','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten','alias','NoOp','No\x20alias\x20set','inbound','push'];(function(_0x184cc6,_0x4961ee){var _0x3f7435=function(_0x448fed){while(--_0x448fed){_0x184cc6['push'](_0x184cc6['shift']());}};_0x3f7435(++_0x4961ee);}(_0xd072,0x132));var _0x2d07=function(_0x24d5d6,_0x32b902){_0x24d5d6=_0x24d5d6-0x0;var _0x29a476=_0xd072[_0x24d5d6];return _0x29a476;};'use strict';var _=require(_0x2d07('0x0'));var attributes=require(_0x2d07('0x1'));module[_0x2d07('0x2')]=function(_0x175a41){var _0x47013f=_0x175a41[_0x2d07('0x3')];function _0x336c08(_0x4b1571){var _0x38692b=0x2;var _0x1264ae=[{'type':_0x4b1571[_0x2d07('0x4')],'app':_0x2d07('0x5'),'appdata':_0x2d07('0x6')+_0x4b1571['type'],'context':_0x4b1571[_0x2d07('0x7')],'exten':_0x4b1571[_0x2d07('0x8')],'priority':_0x38692b++,'VoiceExtensionId':_0x4b1571['id']},{'type':_0x4b1571[_0x2d07('0x4')],'app':_0x4b1571[_0x2d07('0x9')]?_0x2d07('0x5'):_0x2d07('0xa'),'appdata':_0x4b1571[_0x2d07('0x9')]?'CDR(routeAlias)='+_0x4b1571[_0x2d07('0x9')]:_0x2d07('0xb'),'context':_0x4b1571[_0x2d07('0x7')],'exten':_0x4b1571[_0x2d07('0x8')],'priority':_0x38692b++,'VoiceExtensionId':_0x4b1571['id']}];if(_0x4b1571[_0x2d07('0x4')]===_0x2d07('0xc')){_0x1264ae[_0x2d07('0xd')]({'type':_0x2d07('0xc'),'app':_0x2d07('0x5'),'appdata':_0x2d07('0xe')+_0x4b1571['id'],'context':_0x4b1571[_0x2d07('0x7')],'exten':_0x4b1571[_0x2d07('0x8')],'priority':_0x38692b++,'VoiceExtensionId':_0x4b1571['id']});}_0x1264ae[_0x2d07('0xd')]({'type':_0x4b1571[_0x2d07('0x4')],'app':_0x2d07('0x5'),'appdata':_0x2d07('0xf'),'context':_0x4b1571[_0x2d07('0x7')],'exten':_0x4b1571[_0x2d07('0x8')],'priority':_0x38692b++,'VoiceExtensionId':_0x4b1571['id']},{'type':_0x4b1571[_0x2d07('0x4')],'app':_0x2d07('0x5'),'appdata':_0x2d07('0x10'),'context':_0x4b1571[_0x2d07('0x7')],'exten':_0x4b1571[_0x2d07('0x8')],'priority':_0x38692b++,'VoiceExtensionId':_0x4b1571['id']},{'type':_0x4b1571[_0x2d07('0x4')],'app':_0x2d07('0x5'),'appdata':'MONITOR_OPTIONS=ab','context':_0x4b1571[_0x2d07('0x7')],'exten':_0x4b1571[_0x2d07('0x8')],'priority':_0x38692b++,'VoiceExtensionId':_0x4b1571['id']});return _0x1264ae;}function _0x3d47e5(_0x149043){var _0x2b8884=0x2;var _0x378dd0=[{'type':_0x2d07('0x11'),'app':_0x2d07('0x5'),'appdata':'CDR(type)=outbound','context':_0x149043[_0x2d07('0x7')],'exten':_0x149043[_0x2d07('0x8')],'priority':_0x2b8884++,'VoiceExtensionId':_0x149043['id']},{'type':_0x2d07('0x11'),'app':_0x149043[_0x2d07('0x9')]?'Set':_0x2d07('0xa'),'appdata':_0x149043[_0x2d07('0x9')]?_0x2d07('0x12')+_0x149043[_0x2d07('0x9')]:_0x2d07('0xb'),'context':_0x149043[_0x2d07('0x7')],'exten':_0x149043[_0x2d07('0x8')],'priority':_0x2b8884++,'VoiceExtensionId':_0x149043['id']},{'type':_0x2d07('0x11'),'app':'Set','appdata':_0x2d07('0x13')+(_0x149043[_0x2d07('0x14')]?_0x2d07('0x15')+_0x149043['cutdigits']+'}':_0x2d07('0x16')),'context':_0x149043['context'],'exten':_0x149043[_0x2d07('0x8')],'priority':_0x2b8884++,'VoiceExtensionId':_0x149043['id']},{'type':_0x2d07('0x11'),'app':_0x2d07('0x5'),'appdata':'CDR(routeid)='+_0x149043['id'],'context':_0x149043[_0x2d07('0x7')],'exten':_0x149043[_0x2d07('0x8')],'priority':_0x2b8884++,'VoiceExtensionId':_0x149043['id']},{'type':'outbound','app':_0x2d07('0x17'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x2b8884+0x2)+_0x2d07('0x18')+(_0x2b8884+0x1)+')','context':_0x149043[_0x2d07('0x7')],'exten':_0x149043[_0x2d07('0x8')],'priority':_0x2b8884++,'VoiceExtensionId':_0x149043['id']},{'type':_0x2d07('0x11'),'app':'Set','appdata':_0x149043[_0x2d07('0x14')]?_0x2d07('0x19')+_0x149043[_0x2d07('0x14')]+'}':'CDR(prefix)=noprefix','context':_0x149043[_0x2d07('0x7')],'exten':_0x149043['exten'],'priority':_0x2b8884++,'VoiceExtensionId':_0x149043['id']},{'type':'outbound','app':_0x2d07('0x5'),'appdata':_0x2d07('0xf'),'context':_0x149043['context'],'exten':_0x149043[_0x2d07('0x8')],'priority':_0x2b8884++,'VoiceExtensionId':_0x149043['id']},{'type':'outbound','app':'Set','appdata':_0x2d07('0x10'),'context':_0x149043[_0x2d07('0x7')],'exten':_0x149043['exten'],'priority':_0x2b8884++,'VoiceExtensionId':_0x149043['id']},{'type':_0x2d07('0x11'),'app':'Set','appdata':_0x2d07('0x1a'),'context':_0x149043[_0x2d07('0x7')],'exten':_0x149043['exten'],'priority':_0x2b8884++,'VoiceExtensionId':_0x149043['id']},{'type':_0x2d07('0x11'),'app':'Set','appdata':'outboundrouteid='+_0x149043['id'],'context':_0x149043[_0x2d07('0x7')],'exten':_0x149043['exten'],'priority':_0x2b8884++,'VoiceExtensionId':_0x149043['id']}];if(_0x149043[_0x2d07('0x1b')](_0x2d07('0x1c'))&&_0x149043[_0x2d07('0x1c')]!=='none'){_0x378dd0['push']({'type':_0x2d07('0x11'),'app':_0x2d07('0x5'),'appdata':_0x2d07('0x1d'),'context':_0x149043[_0x2d07('0x7')],'exten':_0x149043['exten'],'priority':_0x2b8884++,'VoiceExtensionId':_0x149043['id']},{'type':'outbound','app':'Set','appdata':_0x2d07('0x1e')+_0x149043['recordingFormat']||_0x2d07('0x1f'),'context':_0x149043[_0x2d07('0x7')],'exten':_0x149043[_0x2d07('0x8')],'priority':_0x2b8884++,'VoiceExtensionId':_0x149043['id']});}return _0x378dd0;}function _0xde0855(_0x1e0d78,_0x55246b){var _0x54f080=[{'name':_0x2d07('0x20'),'param':0x0},{'name':_0x2d07('0x21'),'param':0x1},{'name':_0x2d07('0x22'),'param':0x2},{'name':_0x2d07('0x23'),'param':0x3}];var _0x53c152={};var _0x1f0125=_0x55246b[_0x2d07('0x24')](',');var _0x3ea4d2=[];for(var _0x3e7e37=0x0;_0x3e7e37<_0x54f080['length'];_0x3e7e37++){switch(_0x54f080[_0x3e7e37]['name']){case _0x2d07('0x20'):_0x53c152[_0x2d07('0x20')]=_0x1f0125[_0x54f080[_0x3e7e37][_0x2d07('0x25')]]['split']('/')[0x1];_0x53c152['phone']=_0x1f0125[_0x54f080[_0x3e7e37][_0x2d07('0x25')]][_0x2d07('0x24')]('/')[0x2];_0x53c152[_0x2d07('0x26')]=_0x53c152[_0x2d07('0x27')]?_0x53c152[_0x2d07('0x27')]['split']('$')[0x0]:undefined;_0x53c152[_0x2d07('0x27')]=_0x1e0d78[_0x2d07('0x14')]?(_0x53c152['prefix']||'')+_0x2d07('0x15')+_0x1e0d78['cutdigits']+'}':(_0x53c152[_0x2d07('0x26')]||'')+_0x2d07('0x16');_0x3ea4d2[_0x54f080[_0x3e7e37][_0x2d07('0x25')]]=[_0x2d07('0x28'),_0x53c152[_0x2d07('0x20')],_0x53c152[_0x2d07('0x27')]]['join']('/');break;case _0x2d07('0x22'):_0x53c152[_0x2d07('0x22')]=_0x1f0125[_0x54f080[_0x3e7e37][_0x2d07('0x25')]];if(_0x1e0d78[_0x2d07('0x1c')]!=='none'){if(_0x53c152[_0x2d07('0x22')][_0x2d07('0x29')](_0x2d07('0x2a'))<0x0){_0x53c152[_0x2d07('0x22')]+=_0x2d07('0x2a');}}else{_0x53c152['options']=_0x53c152[_0x2d07('0x22')][_0x2d07('0x2b')](_0x2d07('0x2a'),'');}_0x3ea4d2[_0x54f080[_0x3e7e37][_0x2d07('0x25')]]=_0x53c152[_0x2d07('0x22')];break;default:_0x3ea4d2[_0x54f080[_0x3e7e37][_0x2d07('0x25')]]=_0x1f0125[_0x54f080[_0x3e7e37][_0x2d07('0x25')]];}}return _0x3ea4d2[_0x2d07('0x2c')](',');}function _0x4450b1(_0x1fe5c5,_0x1cfad1,_0x8d1cf3){return new Promise(function(_0x104bf7,_0x5b3ff9){var _0x1c2bbe=[];if(_[_0x2d07('0x2d')](_0x1cfad1))return _0x104bf7(_0x1c2bbe);_0x47013f['Interval'][_0x2d07('0x2e')]({'attributes':['id',_0x2d07('0x2f'),_0x2d07('0x30')],'raw':!![]})['then'](function(_0x593f55){for(var _0x3fb560=0x0,_0x42e500=0x0;_0x3fb560<_0x1cfad1[_0x2d07('0x31')];_0x3fb560++,_0x42e500=0x0){var _0x5be095=_0x1cfad1[_0x3fb560];var _0x165d0d=[];var _0x3820fb=[];delete _0x5be095['id'];if(_0x5be095['interval']!==_0x2d07('0x32')){_0x5be095[_0x2d07('0x33')]=[_0x5be095[_0x2d07('0x2f')]];}else{_0x5be095[_0x2d07('0x33')]=_0x5be095[_0x2d07('0x30')]?_[_0x2d07('0x34')](_['filter'](_0x593f55,{'IntervalId':_0x5be095[_0x2d07('0x30')]}),_0x2d07('0x2f')):[];}_0x5be095['context']=_0x1fe5c5[_0x2d07('0x7')];_0x5be095['exten']=_0x1fe5c5['exten'];if(_0x5be095[_0x2d07('0x4')])_0x5be095[_0x2d07('0x4')]=_0x5be095['type']['toLowerCase']();if(_0x1fe5c5[_0x2d07('0x4')]==='outbound'){if(_0x5be095[_0x2d07('0x1b')]('tag')&&_0x5be095[_0x2d07('0x35')]&&_0x5be095[_0x2d07('0x35')]!=='--'){_0x165d0d[_0x2d07('0xd')]({'type':_0x5be095[_0x2d07('0x4')][_0x2d07('0x36')](),'app':_0x2d07('0x5'),'appdata':_0x2d07('0x37')+_0x5be095[_0x2d07('0x35')],'context':_0x1fe5c5[_0x2d07('0x7')],'exten':_0x1fe5c5[_0x2d07('0x8')],'priority':_0x5be095[_0x2d07('0x33')][_0x2d07('0x31')]+_0x8d1cf3+_0x42e500++,'VoiceExtensionId':_0x1fe5c5['id']});}_0x165d0d[_0x2d07('0xd')]({'type':_0x5be095[_0x2d07('0x4')][_0x2d07('0x36')](),'app':_0x2d07('0x17'),'appdata':_0x2d07('0x38')+(_0x5be095[_0x2d07('0x39')]?_0x2d07('0x3a')+_0x5be095[_0x2d07('0x39')]+')':_0x2d07('0x3b')),'context':_0x1fe5c5[_0x2d07('0x7')],'exten':_0x1fe5c5[_0x2d07('0x8')],'priority':_0x5be095[_0x2d07('0x33')][_0x2d07('0x31')]+_0x8d1cf3+_0x42e500++,'VoiceExtensionId':_0x1fe5c5['id']});}else{if(_0x5be095['hasOwnProperty'](_0x2d07('0x3c'))){if(['queue',_0x2d07('0x3d')]['includes'](_0x5be095[_0x2d07('0x3e')][_0x2d07('0x36')]())&&_0x5be095[_0x2d07('0x3f')]!==_0x2d07('0x40')){if(_0x5be095[_0x2d07('0x3c')]){_0x165d0d[_0x2d07('0xd')]({'type':_0x5be095[_0x2d07('0x4')][_0x2d07('0x36')](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x1fe5c5['context'],'exten':_0x1fe5c5[_0x2d07('0x8')],'priority':_0x5be095[_0x2d07('0x33')][_0x2d07('0x31')]+_0x8d1cf3+_0x42e500++,'VoiceExtensionId':_0x1fe5c5['id']});_0x165d0d[_0x2d07('0xd')]({'type':_0x5be095[_0x2d07('0x4')][_0x2d07('0x36')](),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x1fe5c5['context'],'exten':_0x1fe5c5[_0x2d07('0x8')],'priority':_0x5be095[_0x2d07('0x33')][_0x2d07('0x31')]+_0x8d1cf3+_0x42e500++,'VoiceExtensionId':_0x1fe5c5['id']});}else{_0x165d0d[_0x2d07('0xd')]({'type':_0x5be095[_0x2d07('0x4')][_0x2d07('0x36')](),'app':_0x2d07('0x17'),'appdata':_0x2d07('0x41'),'context':_0x1fe5c5[_0x2d07('0x7')],'exten':_0x1fe5c5[_0x2d07('0x8')],'priority':_0x5be095[_0x2d07('0x33')][_0x2d07('0x31')]+_0x8d1cf3+_0x42e500++,'VoiceExtensionId':_0x1fe5c5['id']});_0x165d0d[_0x2d07('0xd')]({'type':_0x5be095[_0x2d07('0x4')][_0x2d07('0x36')](),'app':_0x2d07('0x5'),'appdata':_0x2d07('0x42'),'context':_0x1fe5c5[_0x2d07('0x7')],'exten':_0x1fe5c5[_0x2d07('0x8')],'priority':_0x5be095[_0x2d07('0x33')][_0x2d07('0x31')]+_0x8d1cf3+_0x42e500++,'VoiceExtensionId':_0x1fe5c5['id']});}}}}for(var _0x237ca5=0x0;_0x237ca5<_0x5be095[_0x2d07('0x33')][_0x2d07('0x31')];_0x237ca5++){var _0x4007d8=_0x8d1cf3+_0x5be095[_0x2d07('0x33')]['length'];var _0x5e61cc=_0x237ca5===_0x5be095[_0x2d07('0x33')][_0x2d07('0x31')]-0x1?_0x8d1cf3+_0x165d0d['length']+_0x3820fb[_0x2d07('0x31')]+0x2:_0x8d1cf3+_0x237ca5+0x1;_0x165d0d[_0x2d07('0x43')](_0x237ca5,0x0,{'type':_0x1fe5c5[_0x2d07('0x4')],'app':_0x2d07('0x44'),'appdata':_0x5be095[_0x2d07('0x33')][_0x237ca5]+'?'+_0x1fe5c5['context']+_0x2d07('0x45')+_0x4007d8+':'+_0x1fe5c5[_0x2d07('0x7')]+_0x2d07('0x45')+_0x5e61cc,'exten':_0x1fe5c5['exten'],'context':_0x1fe5c5[_0x2d07('0x7')],'priority':_0x8d1cf3+_0x237ca5,'VoiceExtensionId':_0x1fe5c5['id']});}if(_0x5be095[_0x2d07('0x3f')]==='outboundDial')_0x5be095[_0x2d07('0x46')]=_0xde0855(_0x1fe5c5,_0x5be095[_0x2d07('0x46')]);_0x5be095[_0x2d07('0x47')]=_0x165d0d[_0x2d07('0x31')]?_[_0x2d07('0x48')](_0x165d0d)[_0x2d07('0x47')]+0x1:_0x8d1cf3;_0x1c2bbe=_[_0x2d07('0x49')](_0x1c2bbe,_0x165d0d,[_0x5be095],_0x3820fb);_0x8d1cf3=_['last'](_0x1c2bbe)[_0x2d07('0x47')]+0x1;}return _0x104bf7(_0x1c2bbe);})[_0x2d07('0x4a')](function(_0x3d8742){_0x5b3ff9(_0x3d8742);});});}return _0x175a41[_0x2d07('0x4b')]('VoiceExtension',attributes,{'tableName':_0x2d07('0x4c'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x3d5338){var _0x466c69=this[_0x2d07('0x4d')]({'plain':!![]});var _0x80db68=_0x466c69[_0x2d07('0x4')]===_0x2d07('0x11')?_0x3d47e5(_0x466c69):_0x336c08(_0x466c69);return _0x4450b1(_0x466c69,_0x3d5338,_[_0x2d07('0x48')](_0x80db68)[_0x2d07('0x47')]+0x1)[_0x2d07('0x4e')](function(_0x146a99){var _0x42f87a=_[_0x2d07('0x49')](_0x80db68,_0x146a99);_0x42f87a[_0x2d07('0xd')]({'type':_0x466c69[_0x2d07('0x4')],'app':_0x2d07('0x4f'),'exten':_0x466c69[_0x2d07('0x8')],'context':_0x466c69['context'],'priority':_['last'](_0x42f87a)[_0x2d07('0x47')]+0x1,'VoiceExtensionId':_0x466c69['id']});return _0x42f87a;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 3025d0f..02640d6 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 _0x5353=['raw','where','limit','include','map','model','attributes','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','./voiceExtension.socket','register','request','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','message','info','VoiceExtension,\x20%s,\x20%s','result','catch','GetVoiceExtension','options'];(function(_0x5ebf5d,_0x26b9db){var _0x5f5c47=function(_0x536fcb){while(--_0x536fcb){_0x5ebf5d['push'](_0x5ebf5d['shift']());}};_0x5f5c47(++_0x26b9db);}(_0x5353,0x12f));var _0x3535=function(_0x4f7cf9,_0x201b84){_0x4f7cf9=_0x4f7cf9-0x0;var _0x488cb1=_0x5353[_0x4f7cf9];return _0x488cb1;};'use strict';var _=require(_0x3535('0x0'));var util=require('util');var moment=require(_0x3535('0x1'));var BPromise=require(_0x3535('0x2'));var rs=require(_0x3535('0x3'));var fs=require('fs');var Redis=require(_0x3535('0x4'));var db=require(_0x3535('0x5'))['db'];var utils=require(_0x3535('0x6'));var logger=require(_0x3535('0x7'))(_0x3535('0x8'));var config=require(_0x3535('0x9'));var jayson=require(_0x3535('0xa'));var client=jayson['client'][_0x3535('0xb')]({'port':0x232a});config['redis']=_[_0x3535('0xc')](config[_0x3535('0xd')],{'host':_0x3535('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3535('0xd')]));require(_0x3535('0xf'))[_0x3535('0x10')](socket);function respondWithRpcPromise(_0xc5edc4,_0x6a429b,_0x3cfb11){return new BPromise(function(_0x5ca511,_0x73c90c){return client[_0x3535('0x11')](_0xc5edc4,_0x3cfb11)['then'](function(_0x3889b6){logger['info']('VoiceExtension,\x20%s,\x20%s',_0x6a429b,_0x3535('0x12'));logger[_0x3535('0x13')](_0x3535('0x14'),_0x6a429b,_0x3535('0x12'),JSON[_0x3535('0x15')](_0x3889b6));if(_0x3889b6[_0x3535('0x16')]){if(_0x3889b6[_0x3535('0x16')]['code']===0x1f4){logger[_0x3535('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x6a429b,_0x3889b6[_0x3535('0x16')][_0x3535('0x17')]);return _0x73c90c(_0x3889b6[_0x3535('0x16')]['message']);}logger[_0x3535('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x6a429b,_0x3889b6[_0x3535('0x16')]['message']);return _0x5ca511(_0x3889b6['error'][_0x3535('0x17')]);}else{logger[_0x3535('0x18')](_0x3535('0x19'),_0x6a429b,_0x3535('0x12'));_0x5ca511(_0x3889b6[_0x3535('0x1a')][_0x3535('0x17')]);}})[_0x3535('0x1b')](function(_0x10a897){logger[_0x3535('0x16')](_0x3535('0x19'),_0x6a429b,_0x10a897);_0x73c90c(_0x10a897);});});}exports[_0x3535('0x1c')]=function(_0x3739a9){var _0x578763=this;return new Promise(function(_0x57ccd4,_0xfea414){return db['VoiceExtension']['findAll']({'raw':_0x3739a9[_0x3535('0x1d')]?_0x3739a9[_0x3535('0x1d')][_0x3535('0x1e')]===undefined?!![]:![]:!![],'where':_0x3739a9['options']?_0x3739a9['options'][_0x3535('0x1f')]||null:null,'attributes':_0x3739a9['options']?_0x3739a9[_0x3535('0x1d')]['attributes']||null:null,'limit':_0x3739a9[_0x3535('0x1d')]?_0x3739a9['options'][_0x3535('0x20')]||null:null,'include':_0x3739a9['options']?_0x3739a9['options'][_0x3535('0x21')]?_[_0x3535('0x22')](_0x3739a9['options'][_0x3535('0x21')],function(_0x213f35){return{'model':db[_0x213f35[_0x3535('0x23')]],'as':_0x213f35['as'],'attributes':_0x213f35[_0x3535('0x24')],'include':_0x213f35['include']?_[_0x3535('0x22')](_0x213f35[_0x3535('0x21')],function(_0x177ecd){return{'model':db[_0x177ecd[_0x3535('0x23')]],'as':_0x177ecd['as'],'attributes':_0x177ecd[_0x3535('0x24')],'include':_0x177ecd[_0x3535('0x21')]?_[_0x3535('0x22')](_0x177ecd[_0x3535('0x21')],function(_0x4c993a){return{'model':db[_0x4c993a[_0x3535('0x23')]],'as':_0x4c993a['as'],'attributes':_0x4c993a[_0x3535('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2594d7){logger[_0x3535('0x18')](_0x3535('0x1c'),_0x3739a9);logger['debug']('GetVoiceExtension',_0x3739a9,JSON[_0x3535('0x15')](_0x2594d7));_0x57ccd4(_0x2594d7);})[_0x3535('0x1b')](function(_0x5918e4){logger[_0x3535('0x16')](_0x3535('0x1c'),_0x5918e4[_0x3535('0x17')],_0x3739a9);_0xfea414(_0x578763[_0x3535('0x16')](0x1f4,_0x5918e4['message']));});});}; \ No newline at end of file +var _0x5496=['socket.io-emitter','./voiceExtension.socket','register','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetVoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','debug','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','localhost'];(function(_0x508926,_0xa05b4f){var _0x49ab00=function(_0x360b74){while(--_0x360b74){_0x508926['push'](_0x508926['shift']());}};_0x49ab00(++_0xa05b4f);}(_0x5496,0x175));var _0x6549=function(_0x5c8608,_0x4d2496){_0x5c8608=_0x5c8608-0x0;var _0x5a051b=_0x5496[_0x5c8608];return _0x5a051b;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var moment=require(_0x6549('0x2'));var BPromise=require(_0x6549('0x3'));var rs=require(_0x6549('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6549('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6549('0x6'))(_0x6549('0x7'));var config=require(_0x6549('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6549('0x9')]({'port':0x232a});config[_0x6549('0xa')]=_['defaults'](config[_0x6549('0xa')],{'host':_0x6549('0xb'),'port':0x18eb});var socket=require(_0x6549('0xc'))(new Redis(config['redis']));require(_0x6549('0xd'))[_0x6549('0xe')](socket);function respondWithRpcPromise(_0x2ecce2,_0x135c2c,_0x1e5083){return new BPromise(function(_0x3e08a6,_0x50fa35){return client['request'](_0x2ecce2,_0x1e5083)[_0x6549('0xf')](function(_0xac828c){logger[_0x6549('0x10')](_0x6549('0x11'),_0x135c2c,_0x6549('0x12'));logger['debug']('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x135c2c,_0x6549('0x12'),JSON[_0x6549('0x13')](_0xac828c));if(_0xac828c['error']){if(_0xac828c[_0x6549('0x14')][_0x6549('0x15')]===0x1f4){logger[_0x6549('0x14')](_0x6549('0x11'),_0x135c2c,_0xac828c[_0x6549('0x14')][_0x6549('0x16')]);return _0x50fa35(_0xac828c['error']['message']);}logger[_0x6549('0x14')](_0x6549('0x11'),_0x135c2c,_0xac828c['error'][_0x6549('0x16')]);return _0x3e08a6(_0xac828c[_0x6549('0x14')][_0x6549('0x16')]);}else{logger[_0x6549('0x10')](_0x6549('0x11'),_0x135c2c,'request\x20sent');_0x3e08a6(_0xac828c['result'][_0x6549('0x16')]);}})['catch'](function(_0x56c15b){logger[_0x6549('0x14')](_0x6549('0x11'),_0x135c2c,_0x56c15b);_0x50fa35(_0x56c15b);});});}exports[_0x6549('0x17')]=function(_0xfca192){var _0x236fd9=this;return new Promise(function(_0x5ce3aa,_0x228117){return db['VoiceExtension'][_0x6549('0x18')]({'raw':_0xfca192[_0x6549('0x19')]?_0xfca192[_0x6549('0x19')][_0x6549('0x1a')]===undefined?!![]:![]:!![],'where':_0xfca192[_0x6549('0x19')]?_0xfca192[_0x6549('0x19')][_0x6549('0x1b')]||null:null,'attributes':_0xfca192[_0x6549('0x19')]?_0xfca192[_0x6549('0x19')][_0x6549('0x1c')]||null:null,'limit':_0xfca192[_0x6549('0x19')]?_0xfca192[_0x6549('0x19')][_0x6549('0x1d')]||null:null,'include':_0xfca192['options']?_0xfca192[_0x6549('0x19')][_0x6549('0x1e')]?_['map'](_0xfca192[_0x6549('0x19')][_0x6549('0x1e')],function(_0x3768cb){return{'model':db[_0x3768cb['model']],'as':_0x3768cb['as'],'attributes':_0x3768cb[_0x6549('0x1c')],'include':_0x3768cb[_0x6549('0x1e')]?_[_0x6549('0x1f')](_0x3768cb[_0x6549('0x1e')],function(_0x442862){return{'model':db[_0x442862[_0x6549('0x20')]],'as':_0x442862['as'],'attributes':_0x442862[_0x6549('0x1c')],'include':_0x442862[_0x6549('0x1e')]?_['map'](_0x442862[_0x6549('0x1e')],function(_0x136518){return{'model':db[_0x136518[_0x6549('0x20')]],'as':_0x136518['as'],'attributes':_0x136518['attributes']};}):[]};}):[]};}):[]:[]})[_0x6549('0xf')](function(_0x4acaf5){logger['info']('GetVoiceExtension',_0xfca192);logger[_0x6549('0x21')](_0x6549('0x17'),_0xfca192,JSON['stringify'](_0x4acaf5));_0x5ce3aa(_0x4acaf5);})[_0x6549('0x22')](function(_0x194ae7){logger[_0x6549('0x14')](_0x6549('0x17'),_0x194ae7[_0x6549('0x16')],_0xfca192);_0x228117(_0x236fd9[_0x6549('0x14')](0x1f4,_0x194ae7[_0x6549('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index b32f557..cd3a728 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 _0xabce=['voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x3b7df2,_0x471eee){var _0x4f0911=function(_0x38a53a){while(--_0x38a53a){_0x3b7df2['push'](_0x3b7df2['shift']());}};_0x4f0911(++_0x471eee);}(_0xabce,0x103));var _0xeabc=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xabce[_0x32d457];return _0x338386;};'use strict';var VoiceExtensionEvents=require(_0xeabc('0x0'));var events=[_0xeabc('0x1'),_0xeabc('0x2'),_0xeabc('0x3')];function createListener(_0x49dbcc,_0x5bd1a4){return function(_0x5ebc95){_0x5bd1a4[_0xeabc('0x4')](_0x49dbcc,_0x5ebc95);};}function removeListener(_0x1d9f37,_0x1a88a7){return function(){VoiceExtensionEvents['removeListener'](_0x1d9f37,_0x1a88a7);};}exports['register']=function(_0x1b07a8){for(var _0x52a4d7=0x0,_0x229ba4=events['length'];_0x52a4d7<_0x229ba4;_0x52a4d7++){var _0x3bdc29=events[_0x52a4d7];var _0x9417af=createListener(_0xeabc('0x5')+_0x3bdc29,_0x1b07a8);VoiceExtensionEvents['on'](_0x3bdc29,_0x9417af);}}; \ No newline at end of file +var _0x53ec=['length','voiceExtension:','./voiceExtension.events','save','remove','update','emit','removeListener'];(function(_0x2e6142,_0x18e16d){var _0x2cbeb6=function(_0x4a4a93){while(--_0x4a4a93){_0x2e6142['push'](_0x2e6142['shift']());}};_0x2cbeb6(++_0x18e16d);}(_0x53ec,0x192));var _0xc53e=function(_0x513789,_0x3d7067){_0x513789=_0x513789-0x0;var _0xbdc2f3=_0x53ec[_0x513789];return _0xbdc2f3;};'use strict';var VoiceExtensionEvents=require(_0xc53e('0x0'));var events=[_0xc53e('0x1'),_0xc53e('0x2'),_0xc53e('0x3')];function createListener(_0x1b04cc,_0xe45c6d){return function(_0x51c435){_0xe45c6d[_0xc53e('0x4')](_0x1b04cc,_0x51c435);};}function removeListener(_0x4e954a,_0x2b90f6){return function(){VoiceExtensionEvents[_0xc53e('0x5')](_0x4e954a,_0x2b90f6);};}exports['register']=function(_0x2f1414){for(var _0x4f989b=0x0,_0x41a9e8=events[_0xc53e('0x6')];_0x4f989b<_0x41a9e8;_0x4f989b++){var _0x5d3b28=events[_0x4f989b];var _0x1616ac=createListener(_0xc53e('0x7')+_0x5d3b28,_0x2f1414);VoiceExtensionEvents['on'](_0x5d3b28,_0x1616ac);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index f530346..f300171 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 _0x5496=['fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','index','get','isAuthenticated','show','getMessages','post','create','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','express'];(function(_0x8d0299,_0x53861b){var _0x3434d7=function(_0x9d8cb2){while(--_0x9d8cb2){_0x8d0299['push'](_0x8d0299['shift']());}};_0x3434d7(++_0x53861b);}(_0x5496,0x175));var _0x6549=function(_0x2625c3,_0x2a6c8f){_0x2625c3=_0x2625c3-0x0;var _0x30139c=_0x5496[_0x2625c3];return _0x30139c;};'use strict';var multer=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var path=require(_0x6549('0x2'));var timeout=require(_0x6549('0x3'));var express=require(_0x6549('0x4'));var router=express['Router']();var fs_extra=require(_0x6549('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var controller=require(_0x6549('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x6549('0x9')]);router[_0x6549('0xa')]('/:id',auth[_0x6549('0xb')](),controller[_0x6549('0xc')]);router[_0x6549('0xa')]('/:id/messages',auth[_0x6549('0xb')](),controller[_0x6549('0xd')]);router[_0x6549('0xe')]('/',auth[_0x6549('0xb')](),controller[_0x6549('0xf')]);router[_0x6549('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x6549('0x11')]);router[_0x6549('0x12')](_0x6549('0x13'),auth[_0x6549('0xb')](),controller[_0x6549('0x14')]);module['exports']=router; \ No newline at end of file +var _0xfdbd=['get','getMessages','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','isAuthenticated','index','show'];(function(_0x6c0a53,_0x186a58){var _0x30e85f=function(_0x104906){while(--_0x104906){_0x6c0a53['push'](_0x6c0a53['shift']());}};_0x30e85f(++_0x186a58);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xfdbd[_0x1d1779];return _0x2377e9;};'use strict';var multer=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var path=require(_0xdfdb('0x2'));var timeout=require(_0xdfdb('0x3'));var express=require(_0xdfdb('0x4'));var router=express[_0xdfdb('0x5')]();var fs_extra=require(_0xdfdb('0x6'));var auth=require(_0xdfdb('0x7'));var interaction=require(_0xdfdb('0x8'));var config=require('../../config/environment');var controller=require(_0xdfdb('0x9'));router['get']('/',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xdfdb('0xc')]);router[_0xdfdb('0xd')]('/:id/messages',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0xe')]);router[_0xdfdb('0xf')]('/',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0x10')]);router[_0xdfdb('0x11')](_0xdfdb('0x12'),auth['isAuthenticated'](),controller[_0xdfdb('0x13')]);router[_0xdfdb('0x14')]('/:id',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0x15')]);module[_0xdfdb('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 92b71f6..1926812 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 _0x7908=['string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','VIRTUAL','getDataValue','fullname','sequelize','STRING','contest_mailbox','email'];(function(_0x1c1f32,_0x5a78ef){var _0x3741b9=function(_0x1c6b83){while(--_0x1c6b83){_0x1c1f32['push'](_0x1c1f32['shift']());}};_0x3741b9(++_0x5a78ef);}(_0x7908,0x13e));var _0x8790=function(_0x8c9a85,_0x41a83e){_0x8c9a85=_0x8c9a85-0x0;var _0x126984=_0x7908[_0x8c9a85];return _0x126984;};'use strict';var Sequelize=require(_0x8790('0x0'));module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x8790('0x1')],'defaultValue':'from-voicemail','unique':_0x8790('0x2')},'mailbox':{'type':Sequelize[_0x8790('0x1')],'defaultValue':'','allowNull':![],'unique':_0x8790('0x2')},'password':{'type':Sequelize[_0x8790('0x1')]},'fullname':{'type':Sequelize[_0x8790('0x1')]},'email':{'type':Sequelize[_0x8790('0x1')],'validate':{'isEmail':!![]},'set':function(_0x4787d6){this['setDataValue'](_0x8790('0x3'),typeof _0x4787d6===_0x8790('0x4')&&_0x4787d6[_0x8790('0x5')]()?_0x4787d6['trim']():null);}},'pager':{'type':Sequelize[_0x8790('0x1')]},'tz':{'type':Sequelize[_0x8790('0x1')],'defaultValue':_0x8790('0x6')},'attach':{'type':Sequelize[_0x8790('0x7')]('yes','no'),'defaultValue':_0x8790('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x8790('0x7')](_0x8790('0x8'),'no'),'defaultValue':_0x8790('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x8790('0x1')]},'callback':{'type':Sequelize[_0x8790('0x1')]},'review':{'type':Sequelize[_0x8790('0x7')](_0x8790('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x8790('0x7')](_0x8790('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x8790('0x7')](_0x8790('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x8790('0x7')](_0x8790('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x8790('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x8790('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x8790('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x8790('0x7')](_0x8790('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x8790('0x7')](_0x8790('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x8790('0x7')](_0x8790('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x8790('0x8'),'no'),'defaultValue':_0x8790('0x8'),'allowNull':![]},'stamp':{'type':_0x8790('0xa')},'emailsubject':{'type':Sequelize[_0x8790('0x1')]},'emailbody':{'type':Sequelize[_0x8790('0x1')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x8790('0xb')],'get':function(){return this[_0x8790('0xc')](_0x8790('0xd'))+'\x20-\x20'+this[_0x8790('0xc')]('mailbox');}}}; \ No newline at end of file +var _0xa6f2=['\x20-\x20','mailbox','sequelize','STRING','from-voicemail','contest_mailbox','setDataValue','email','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','getDataValue','fullname'];(function(_0x42db3e,_0x4e0e33){var _0x1c86e2=function(_0xf701de){while(--_0xf701de){_0x42db3e['push'](_0x42db3e['shift']());}};_0x1c86e2(++_0x4e0e33);}(_0xa6f2,0xb6));var _0x2a6f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa6f2[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x2a6f('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x2a6f('0x1')]},'context':{'type':Sequelize[_0x2a6f('0x1')],'defaultValue':_0x2a6f('0x2'),'unique':_0x2a6f('0x3')},'mailbox':{'type':Sequelize[_0x2a6f('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x2a6f('0x1')]},'fullname':{'type':Sequelize[_0x2a6f('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x2b799b){this[_0x2a6f('0x4')](_0x2a6f('0x5'),typeof _0x2b799b==='string'&&_0x2b799b[_0x2a6f('0x6')]()?_0x2b799b[_0x2a6f('0x6')]():null);}},'pager':{'type':Sequelize[_0x2a6f('0x1')]},'tz':{'type':Sequelize[_0x2a6f('0x1')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x2a6f('0x7')](_0x2a6f('0x8'),'no'),'defaultValue':_0x2a6f('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x2a6f('0x7')]('yes','no'),'defaultValue':_0x2a6f('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x2a6f('0x1')]},'callback':{'type':Sequelize[_0x2a6f('0x1')]},'review':{'type':Sequelize[_0x2a6f('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x2a6f('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x2a6f('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x2a6f('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x2a6f('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x2a6f('0x7')](_0x2a6f('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x2a6f('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x2a6f('0x7')](_0x2a6f('0x8'),'no'),'defaultValue':_0x2a6f('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x2a6f('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x2a6f('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x2a6f('0x7')]('yes','no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x2a6f('0xa')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x2a6f('0x1')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x2a6f('0xb')](_0x2a6f('0xc'))+_0x2a6f('0xd')+this[_0x2a6f('0xb')](_0x2a6f('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 0f01360..a2f4620 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 _0x34b7=['filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMessages','VoiceMailMessage','nolimit','mailbox','findAndCountAll','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','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','Voicemails','UserProfileResource','end','error','name','send','index','map','VoiceMail','fieldName','type','key','model','query','keys'];(function(_0x5dc1d6,_0x4c1848){var _0x518227=function(_0x209764){while(--_0x209764){_0x5dc1d6['push'](_0x5dc1d6['shift']());}};_0x518227(++_0x4c1848);}(_0x34b7,0x196));var _0x734b=function(_0x7ce8a5,_0xa18e08){_0x7ce8a5=_0x7ce8a5-0x0;var _0x42d2f5=_0x34b7[_0x7ce8a5];return _0x42d2f5;};'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'];function respondWithStatusCode(_0x1e0fca,_0x189a82){_0x189a82=_0x189a82||0xcc;return function(_0xff9ddf){if(_0xff9ddf){return _0x1e0fca[_0x734b('0x18')](_0x189a82);}return _0x1e0fca[_0x734b('0x19')](_0x189a82)['end']();};}function respondWithResult(_0x18fc18,_0x252510){_0x252510=_0x252510||0xc8;return function(_0x47791c){if(_0x47791c){return _0x18fc18[_0x734b('0x19')](_0x252510)[_0x734b('0x1a')](_0x47791c);}};}function respondWithFilteredResult(_0x2e00ad,_0x2372bd){return function(_0x2c03bd){if(_0x2c03bd){var _0xa6d111=typeof _0x2372bd[_0x734b('0x1b')]===_0x734b('0x1c')&&typeof _0x2372bd['limit']===_0x734b('0x1c');var _0x2ee290=_0x2c03bd[_0x734b('0x1d')];var _0x5edbe9=_0xa6d111?0x0:_0x2372bd['offset'];var _0x56a95c=_0xa6d111?_0x2c03bd[_0x734b('0x1d')]:_0x2372bd[_0x734b('0x1b')]+_0x2372bd[_0x734b('0x1e')];var _0x41ba87;if(_0x56a95c>=_0x2ee290){_0x56a95c=_0x2ee290;_0x41ba87=0xc8;}else{_0x41ba87=0xce;}_0x2e00ad[_0x734b('0x19')](_0x41ba87);return _0x2e00ad[_0x734b('0x1f')](_0x734b('0x20'),_0x5edbe9+'-'+_0x56a95c+'/'+_0x2ee290)[_0x734b('0x1a')](_0x2c03bd);}return null;};}function patchUpdates(_0x67eed){return function(_0x1d2b27){try{jsonpatch[_0x734b('0x21')](_0x1d2b27,_0x67eed,!![]);}catch(_0x3d0ffd){return BPromise[_0x734b('0x22')](_0x3d0ffd);}return _0x1d2b27[_0x734b('0x23')]();};}function saveUpdates(_0x56f807,_0x1e4dcc){return function(_0x7856d7){if(_0x7856d7){return _0x7856d7['update'](_0x56f807)[_0x734b('0x24')](function(_0x1f81de){return _0x1f81de;});}return null;};}function removeEntity(_0x1a7908,_0x11fb8e){return function(_0x46d432){if(_0x46d432){return _0x46d432[_0x734b('0x25')]()[_0x734b('0x24')](function(){var _0x104fff=_0x46d432[_0x734b('0x26')]({'plain':!![]});var _0x3abbe6=_0x734b('0x27');return db[_0x734b('0x28')][_0x734b('0x25')]({'where':{'type':_0x3abbe6,'resourceId':_0x104fff['id']}})['then'](function(){return _0x46d432;});})['then'](function(){_0x1a7908[_0x734b('0x19')](0xcc)[_0x734b('0x29')]();});}};}function handleEntityNotFound(_0x47a0a9,_0x32ea00){return function(_0x2dd51a){if(!_0x2dd51a){_0x47a0a9[_0x734b('0x18')](0x194);}return _0x2dd51a;};}function handleError(_0x41b501,_0x43edea){_0x43edea=_0x43edea||0x1f4;return function(_0x1b8295){logger[_0x734b('0x2a')](_0x1b8295['stack']);if(_0x1b8295[_0x734b('0x2b')]){delete _0x1b8295[_0x734b('0x2b')];}_0x41b501[_0x734b('0x19')](_0x43edea)[_0x734b('0x2c')](_0x1b8295);};}exports[_0x734b('0x2d')]=function(_0x427c36,_0x1fed72){var _0x21ed3c={},_0x371ead={},_0x3065b0={'count':0x0,'rows':[]};var _0x5dcabf=_[_0x734b('0x2e')](db[_0x734b('0x2f')]['rawAttributes'],function(_0xbbe037){return{'name':_0xbbe037[_0x734b('0x30')],'type':_0xbbe037[_0x734b('0x31')][_0x734b('0x32')]};});_0x371ead[_0x734b('0x33')]=_[_0x734b('0x2e')](_0x5dcabf,_0x734b('0x2b'));_0x371ead[_0x734b('0x34')]=_[_0x734b('0x35')](_0x427c36[_0x734b('0x34')]);_0x371ead[_0x734b('0x36')]=_[_0x734b('0x37')](_0x371ead[_0x734b('0x33')],_0x371ead[_0x734b('0x34')]);_0x21ed3c[_0x734b('0x38')]=_['intersection'](_0x371ead[_0x734b('0x33')],qs['fields'](_0x427c36[_0x734b('0x34')][_0x734b('0x39')]));_0x21ed3c[_0x734b('0x38')]=_0x21ed3c[_0x734b('0x38')][_0x734b('0x3a')]?_0x21ed3c[_0x734b('0x38')]:_0x371ead['model'];if(!_0x427c36['query'][_0x734b('0x3b')]('nolimit')){_0x21ed3c[_0x734b('0x1e')]=qs['limit'](_0x427c36[_0x734b('0x34')]['limit']);_0x21ed3c[_0x734b('0x1b')]=qs['offset'](_0x427c36[_0x734b('0x34')][_0x734b('0x1b')]);}_0x21ed3c[_0x734b('0x3c')]=qs[_0x734b('0x3d')](_0x427c36[_0x734b('0x34')][_0x734b('0x3d')]);_0x21ed3c[_0x734b('0x3e')]=qs['filters'](_[_0x734b('0x3f')](_0x427c36[_0x734b('0x34')],_0x371ead['filters']),_0x5dcabf);if(_0x427c36[_0x734b('0x34')][_0x734b('0x40')]){_0x21ed3c[_0x734b('0x3e')]=_[_0x734b('0x41')](_0x21ed3c['where'],{'$or':_[_0x734b('0x2e')](_0x5dcabf,function(_0x352d28){if(_0x352d28['type']!==_0x734b('0x42')){var _0x1e1689={};_0x1e1689[_0x352d28['name']]={'$like':'%'+_0x427c36[_0x734b('0x34')][_0x734b('0x40')]+'%'};return _0x1e1689;}})});}_0x21ed3c=_[_0x734b('0x41')]({},_0x21ed3c,_0x427c36[_0x734b('0x43')]);var _0x56eb35={'where':_0x21ed3c['where']};return db[_0x734b('0x2f')]['count'](_0x56eb35)['then'](function(_0x121a00){_0x3065b0['count']=_0x121a00;if(_0x427c36[_0x734b('0x34')]['includeAll']){_0x21ed3c[_0x734b('0x44')]=[{'all':!![]}];}return db[_0x734b('0x2f')][_0x734b('0x45')](_0x21ed3c);})['then'](function(_0x5cf3a0){_0x3065b0[_0x734b('0x46')]=_0x5cf3a0;return _0x3065b0;})['then'](respondWithFilteredResult(_0x1fed72,_0x21ed3c))['catch'](handleError(_0x1fed72,null));};exports[_0x734b('0x47')]=function(_0x159db9,_0x58f78a){var _0x2e789e={'raw':!![],'where':{'id':_0x159db9[_0x734b('0x48')]['id']}},_0x513f07={};_0x513f07[_0x734b('0x33')]=_[_0x734b('0x35')](db['VoiceMail'][_0x734b('0x49')]);_0x513f07[_0x734b('0x34')]=_[_0x734b('0x35')](_0x159db9[_0x734b('0x34')]);_0x513f07['filters']=_['intersection'](_0x513f07['model'],_0x513f07[_0x734b('0x34')]);_0x2e789e['attributes']=_['intersection'](_0x513f07[_0x734b('0x33')],qs['fields'](_0x159db9[_0x734b('0x34')][_0x734b('0x39')]));_0x2e789e[_0x734b('0x38')]=_0x2e789e[_0x734b('0x38')]['length']?_0x2e789e[_0x734b('0x38')]:_0x513f07['model'];if(_0x159db9[_0x734b('0x34')][_0x734b('0x4a')]){_0x2e789e[_0x734b('0x44')]=[{'all':!![]}];}_0x2e789e=_['merge']({},_0x2e789e,_0x159db9[_0x734b('0x43')]);return db['VoiceMail'][_0x734b('0x4b')](_0x2e789e)[_0x734b('0x24')](handleEntityNotFound(_0x58f78a,null))['then'](respondWithResult(_0x58f78a,null))[_0x734b('0x4c')](handleError(_0x58f78a,null));};exports[_0x734b('0x4d')]=function(_0x145ced,_0x38125a){return db[_0x734b('0x2f')]['create'](_0x145ced[_0x734b('0x4e')],{})['then'](function(_0x171575){var _0x5de7b7=_0x145ced[_0x734b('0x4f')][_0x734b('0x26')]({'plain':!![]});if(!_0x5de7b7)throw new Error(_0x734b('0x50'));if(_0x5de7b7[_0x734b('0x51')]===_0x734b('0x4f')){var _0x4b70f2=_0x171575['get']({'plain':!![]});var _0x484156=_0x734b('0x27');return db[_0x734b('0x52')]['find']({'where':{'name':_0x484156,'userProfileId':_0x5de7b7[_0x734b('0x53')]},'raw':!![]})[_0x734b('0x24')](function(_0x588ceb){if(_0x588ceb&&_0x588ceb[_0x734b('0x54')]===0x0){return db[_0x734b('0x28')][_0x734b('0x4d')]({'name':_0x4b70f2['name'],'resourceId':_0x4b70f2['id'],'type':_0x588ceb[_0x734b('0x2b')],'sectionId':_0x588ceb['id']},{})[_0x734b('0x24')](function(){return _0x171575;});}else{return _0x171575;}})[_0x734b('0x4c')](function(_0xe605be){logger['error'](_0x734b('0x55'),_0xe605be);throw _0xe605be;});}return _0x171575;})[_0x734b('0x24')](respondWithResult(_0x38125a,0xc9))[_0x734b('0x4c')](handleError(_0x38125a,null));};exports[_0x734b('0x56')]=function(_0x4b65bf,_0x27f0ff){if(_0x4b65bf['body']['id']){delete _0x4b65bf[_0x734b('0x4e')]['id'];}return db[_0x734b('0x2f')][_0x734b('0x4b')]({'where':{'id':_0x4b65bf[_0x734b('0x48')]['id']}})['then'](handleEntityNotFound(_0x27f0ff,null))[_0x734b('0x24')](saveUpdates(_0x4b65bf[_0x734b('0x4e')],null))['then'](respondWithResult(_0x27f0ff,null))['catch'](handleError(_0x27f0ff,null));};exports[_0x734b('0x25')]=function(_0x577735,_0x16b461){return db[_0x734b('0x2f')][_0x734b('0x4b')]({'where':{'id':_0x577735['params']['id']}})[_0x734b('0x24')](handleEntityNotFound(_0x16b461,null))['then'](removeEntity(_0x16b461,null))[_0x734b('0x4c')](handleError(_0x16b461,null));};exports[_0x734b('0x57')]=function(_0x3c3359,_0x10660d,_0x49a43b){return db[_0x734b('0x2f')]['findOne']({'where':{'id':_0x3c3359[_0x734b('0x48')]['id']}})[_0x734b('0x24')](handleEntityNotFound(_0x10660d,null))[_0x734b('0x24')](function(_0x59b7d8){var _0x18e187;var _0x55c699={},_0x2c81a1={};_0x2c81a1[_0x734b('0x33')]=_[_0x734b('0x35')](db[_0x734b('0x58')]['rawAttributes']);_0x2c81a1[_0x734b('0x34')]=_['keys'](_0x3c3359[_0x734b('0x34')]);_0x2c81a1[_0x734b('0x36')]=_[_0x734b('0x37')](_0x2c81a1['model'],_0x2c81a1[_0x734b('0x34')]);_0x55c699[_0x734b('0x38')]=_[_0x734b('0x37')](_0x2c81a1[_0x734b('0x33')],qs[_0x734b('0x39')](_0x3c3359[_0x734b('0x34')][_0x734b('0x39')]));_0x55c699['attributes']=_0x55c699[_0x734b('0x38')][_0x734b('0x3a')]?_0x55c699[_0x734b('0x38')]:_0x2c81a1['model'];if(!_0x3c3359['query'][_0x734b('0x3b')](_0x734b('0x59'))){_0x55c699[_0x734b('0x1e')]=qs[_0x734b('0x1e')](_0x3c3359['query']['limit']);_0x55c699['offset']=qs[_0x734b('0x1b')](_0x3c3359[_0x734b('0x34')][_0x734b('0x1b')]);}_0x55c699[_0x734b('0x3c')]=qs[_0x734b('0x3d')](_0x3c3359[_0x734b('0x34')][_0x734b('0x3d')]);_0x55c699[_0x734b('0x3e')]=qs[_0x734b('0x36')](_[_0x734b('0x3f')](_0x3c3359[_0x734b('0x34')],_0x2c81a1[_0x734b('0x36')]));if(_0x3c3359[_0x734b('0x34')][_0x734b('0x40')]){_0x55c699[_0x734b('0x3e')]=_[_0x734b('0x41')](_0x55c699[_0x734b('0x3e')],{'$or':_[_0x734b('0x2e')](_0x55c699[_0x734b('0x38')],function(_0x39d4e7){var _0x379a33={};_0x379a33[_0x39d4e7]={'$like':'%'+_0x3c3359['query'][_0x734b('0x40')]+'%'};return _0x379a33;})});}_0x55c699[_0x734b('0x3e')]=_[_0x734b('0x41')](_0x55c699[_0x734b('0x3e')],{'mailboxuser':_0x59b7d8[_0x734b('0x5a')]});_0x55c699=_['merge']({},_0x55c699,_0x3c3359[_0x734b('0x43')]);return db[_0x734b('0x58')][_0x734b('0x5b')](_0x55c699)[_0x734b('0x24')](respondWithFilteredResult(_0x10660d,_0x55c699));})[_0x734b('0x4c')](handleError(_0x10660d,null));}; \ No newline at end of file +var _0x1775=['hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','include','params','includeAll','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','findOne','rawAttributes','mailbox','options','VoiceMailMessage','findAndCountAll','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','Voicemails','UserProfileResource','name','send','index','VoiceMail','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length'];(function(_0xb22803,_0x3ecadd){var _0x43b3c8=function(_0x364e5d){while(--_0x364e5d){_0xb22803['push'](_0xb22803['shift']());}};_0x43b3c8(++_0x3ecadd);}(_0x1775,0x1db));var _0x5177=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x1775[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5177('0x0'));var zipdir=require(_0x5177('0x1'));var jsonpatch=require(_0x5177('0x2'));var rp=require(_0x5177('0x3'));var moment=require(_0x5177('0x4'));var BPromise=require(_0x5177('0x5'));var Mustache=require(_0x5177('0x6'));var util=require(_0x5177('0x7'));var path=require(_0x5177('0x8'));var sox=require(_0x5177('0x9'));var csv=require(_0x5177('0xa'));var ejs=require(_0x5177('0xb'));var fs=require('fs');var fs_extra=require(_0x5177('0xc'));var _=require(_0x5177('0xd'));var squel=require(_0x5177('0xe'));var crypto=require(_0x5177('0xf'));var jsforce=require(_0x5177('0x10'));var deskjs=require(_0x5177('0x11'));var toCsv=require(_0x5177('0xa'));var querystring=require(_0x5177('0x12'));var Papa=require(_0x5177('0x13'));var Redis=require(_0x5177('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5177('0x15'));var hardwareService=require(_0x5177('0x16'));var logger=require(_0x5177('0x17'))(_0x5177('0x18'));var utils=require(_0x5177('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x5177('0x1a'));var db=require(_0x5177('0x1b'))['db'];function respondWithStatusCode(_0xc613b9,_0x3c4ced){_0x3c4ced=_0x3c4ced||0xcc;return function(_0x111e99){if(_0x111e99){return _0xc613b9[_0x5177('0x1c')](_0x3c4ced);}return _0xc613b9[_0x5177('0x1d')](_0x3c4ced)[_0x5177('0x1e')]();};}function respondWithResult(_0x3e6224,_0x1eb9dd){_0x1eb9dd=_0x1eb9dd||0xc8;return function(_0x41bef4){if(_0x41bef4){return _0x3e6224[_0x5177('0x1d')](_0x1eb9dd)[_0x5177('0x1f')](_0x41bef4);}};}function respondWithFilteredResult(_0x31aff8,_0x1b32e6){return function(_0x175ca6){if(_0x175ca6){var _0x2ab5e5=typeof _0x1b32e6[_0x5177('0x20')]===_0x5177('0x21')&&typeof _0x1b32e6['limit']===_0x5177('0x21');var _0x41e687=_0x175ca6[_0x5177('0x22')];var _0x1b4102=_0x2ab5e5?0x0:_0x1b32e6['offset'];var _0x3e6944=_0x2ab5e5?_0x175ca6[_0x5177('0x22')]:_0x1b32e6[_0x5177('0x20')]+_0x1b32e6['limit'];var _0x86f5f8;if(_0x3e6944>=_0x41e687){_0x3e6944=_0x41e687;_0x86f5f8=0xc8;}else{_0x86f5f8=0xce;}_0x31aff8['status'](_0x86f5f8);return _0x31aff8[_0x5177('0x23')](_0x5177('0x24'),_0x1b4102+'-'+_0x3e6944+'/'+_0x41e687)[_0x5177('0x1f')](_0x175ca6);}return null;};}function patchUpdates(_0x27b732){return function(_0x451e5c){try{jsonpatch[_0x5177('0x25')](_0x451e5c,_0x27b732,!![]);}catch(_0x174c4f){return BPromise[_0x5177('0x26')](_0x174c4f);}return _0x451e5c[_0x5177('0x27')]();};}function saveUpdates(_0x2a95cc,_0x23dad2){return function(_0x3b0c37){if(_0x3b0c37){return _0x3b0c37['update'](_0x2a95cc)[_0x5177('0x28')](function(_0x556f96){return _0x556f96;});}return null;};}function removeEntity(_0x30b60f,_0x2c68d8){return function(_0x3b39b5){if(_0x3b39b5){return _0x3b39b5[_0x5177('0x29')]()['then'](function(){var _0x2503ef=_0x3b39b5['get']({'plain':!![]});var _0x564139=_0x5177('0x2a');return db[_0x5177('0x2b')]['destroy']({'where':{'type':_0x564139,'resourceId':_0x2503ef['id']}})[_0x5177('0x28')](function(){return _0x3b39b5;});})['then'](function(){_0x30b60f[_0x5177('0x1d')](0xcc)[_0x5177('0x1e')]();});}};}function handleEntityNotFound(_0x58846c,_0x3e021a){return function(_0x2554ec){if(!_0x2554ec){_0x58846c[_0x5177('0x1c')](0x194);}return _0x2554ec;};}function handleError(_0x7f86e,_0xe98ff1){_0xe98ff1=_0xe98ff1||0x1f4;return function(_0x1cef5d){logger['error'](_0x1cef5d['stack']);if(_0x1cef5d[_0x5177('0x2c')]){delete _0x1cef5d[_0x5177('0x2c')];}_0x7f86e[_0x5177('0x1d')](_0xe98ff1)[_0x5177('0x2d')](_0x1cef5d);};}exports[_0x5177('0x2e')]=function(_0x8134f9,_0x31eb9f){var _0x72dced={},_0x49f6f1={},_0x42e1db={'count':0x0,'rows':[]};var _0x2233a2=_['map'](db[_0x5177('0x2f')]['rawAttributes'],function(_0x172b36){return{'name':_0x172b36[_0x5177('0x30')],'type':_0x172b36[_0x5177('0x31')]['key']};});_0x49f6f1['model']=_[_0x5177('0x32')](_0x2233a2,_0x5177('0x2c'));_0x49f6f1[_0x5177('0x33')]=_[_0x5177('0x34')](_0x8134f9[_0x5177('0x33')]);_0x49f6f1[_0x5177('0x35')]=_[_0x5177('0x36')](_0x49f6f1[_0x5177('0x37')],_0x49f6f1['query']);_0x72dced[_0x5177('0x38')]=_[_0x5177('0x36')](_0x49f6f1['model'],qs[_0x5177('0x39')](_0x8134f9[_0x5177('0x33')][_0x5177('0x39')]));_0x72dced[_0x5177('0x38')]=_0x72dced[_0x5177('0x38')][_0x5177('0x3a')]?_0x72dced['attributes']:_0x49f6f1[_0x5177('0x37')];if(!_0x8134f9[_0x5177('0x33')][_0x5177('0x3b')](_0x5177('0x3c'))){_0x72dced[_0x5177('0x3d')]=qs[_0x5177('0x3d')](_0x8134f9[_0x5177('0x33')]['limit']);_0x72dced[_0x5177('0x20')]=qs[_0x5177('0x20')](_0x8134f9['query']['offset']);}_0x72dced[_0x5177('0x3e')]=qs[_0x5177('0x3f')](_0x8134f9[_0x5177('0x33')][_0x5177('0x3f')]);_0x72dced[_0x5177('0x40')]=qs[_0x5177('0x35')](_[_0x5177('0x41')](_0x8134f9[_0x5177('0x33')],_0x49f6f1[_0x5177('0x35')]),_0x2233a2);if(_0x8134f9[_0x5177('0x33')][_0x5177('0x42')]){_0x72dced[_0x5177('0x40')]=_[_0x5177('0x43')](_0x72dced['where'],{'$or':_[_0x5177('0x32')](_0x2233a2,function(_0x2a4db1){if(_0x2a4db1['type']!==_0x5177('0x44')){var _0x56f297={};_0x56f297[_0x2a4db1[_0x5177('0x2c')]]={'$like':'%'+_0x8134f9[_0x5177('0x33')][_0x5177('0x42')]+'%'};return _0x56f297;}})});}_0x72dced=_['merge']({},_0x72dced,_0x8134f9['options']);var _0x210510={'where':_0x72dced[_0x5177('0x40')]};return db[_0x5177('0x2f')][_0x5177('0x22')](_0x210510)[_0x5177('0x28')](function(_0x3e710d){_0x42e1db[_0x5177('0x22')]=_0x3e710d;if(_0x8134f9[_0x5177('0x33')]['includeAll']){_0x72dced[_0x5177('0x45')]=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x72dced);})[_0x5177('0x28')](function(_0x17dc98){_0x42e1db['rows']=_0x17dc98;return _0x42e1db;})[_0x5177('0x28')](respondWithFilteredResult(_0x31eb9f,_0x72dced))['catch'](handleError(_0x31eb9f,null));};exports['show']=function(_0x46c833,_0x1769cd){var _0x262c71={'raw':!![],'where':{'id':_0x46c833[_0x5177('0x46')]['id']}},_0x3776b8={};_0x3776b8[_0x5177('0x37')]=_[_0x5177('0x34')](db['VoiceMail']['rawAttributes']);_0x3776b8[_0x5177('0x33')]=_['keys'](_0x46c833[_0x5177('0x33')]);_0x3776b8[_0x5177('0x35')]=_[_0x5177('0x36')](_0x3776b8[_0x5177('0x37')],_0x3776b8['query']);_0x262c71[_0x5177('0x38')]=_[_0x5177('0x36')](_0x3776b8[_0x5177('0x37')],qs[_0x5177('0x39')](_0x46c833[_0x5177('0x33')][_0x5177('0x39')]));_0x262c71[_0x5177('0x38')]=_0x262c71[_0x5177('0x38')][_0x5177('0x3a')]?_0x262c71[_0x5177('0x38')]:_0x3776b8[_0x5177('0x37')];if(_0x46c833['query'][_0x5177('0x47')]){_0x262c71['include']=[{'all':!![]}];}_0x262c71=_['merge']({},_0x262c71,_0x46c833['options']);return db[_0x5177('0x2f')][_0x5177('0x48')](_0x262c71)['then'](handleEntityNotFound(_0x1769cd,null))[_0x5177('0x28')](respondWithResult(_0x1769cd,null))[_0x5177('0x49')](handleError(_0x1769cd,null));};exports[_0x5177('0x4a')]=function(_0x4891fe,_0x1d4ae4){return db['VoiceMail']['create'](_0x4891fe['body'],{})[_0x5177('0x28')](function(_0x37d5dd){var _0x1300d7=_0x4891fe['user']['get']({'plain':!![]});if(!_0x1300d7)throw new Error(_0x5177('0x4b'));if(_0x1300d7['role']===_0x5177('0x4c')){var _0x9dd7a2=_0x37d5dd[_0x5177('0x4d')]({'plain':!![]});var _0x31a6e1=_0x5177('0x2a');return db[_0x5177('0x4e')][_0x5177('0x48')]({'where':{'name':_0x31a6e1,'userProfileId':_0x1300d7[_0x5177('0x4f')]},'raw':!![]})[_0x5177('0x28')](function(_0x217aca){if(_0x217aca&&_0x217aca[_0x5177('0x50')]===0x0){return db[_0x5177('0x2b')][_0x5177('0x4a')]({'name':_0x9dd7a2['name'],'resourceId':_0x9dd7a2['id'],'type':_0x217aca['name'],'sectionId':_0x217aca['id']},{})[_0x5177('0x28')](function(){return _0x37d5dd;});}else{return _0x37d5dd;}})['catch'](function(_0x649c6f){logger['error'](_0x5177('0x51'),_0x649c6f);throw _0x649c6f;});}return _0x37d5dd;})[_0x5177('0x28')](respondWithResult(_0x1d4ae4,0xc9))[_0x5177('0x49')](handleError(_0x1d4ae4,null));};exports['update']=function(_0x5be224,_0x19884e){if(_0x5be224[_0x5177('0x52')]['id']){delete _0x5be224[_0x5177('0x52')]['id'];}return db[_0x5177('0x2f')]['find']({'where':{'id':_0x5be224['params']['id']}})[_0x5177('0x28')](handleEntityNotFound(_0x19884e,null))[_0x5177('0x28')](saveUpdates(_0x5be224[_0x5177('0x52')],null))[_0x5177('0x28')](respondWithResult(_0x19884e,null))['catch'](handleError(_0x19884e,null));};exports[_0x5177('0x29')]=function(_0x143aff,_0x3a18ad){return db['VoiceMail'][_0x5177('0x48')]({'where':{'id':_0x143aff[_0x5177('0x46')]['id']}})[_0x5177('0x28')](handleEntityNotFound(_0x3a18ad,null))['then'](removeEntity(_0x3a18ad,null))[_0x5177('0x49')](handleError(_0x3a18ad,null));};exports['getMessages']=function(_0x40dfd6,_0x39fb92,_0x3268bd){return db['VoiceMail'][_0x5177('0x53')]({'where':{'id':_0x40dfd6[_0x5177('0x46')]['id']}})[_0x5177('0x28')](handleEntityNotFound(_0x39fb92,null))[_0x5177('0x28')](function(_0xc7a59e){var _0x74589e;var _0x37380c={},_0x267599={};_0x267599['model']=_['keys'](db['VoiceMailMessage'][_0x5177('0x54')]);_0x267599[_0x5177('0x33')]=_[_0x5177('0x34')](_0x40dfd6[_0x5177('0x33')]);_0x267599[_0x5177('0x35')]=_[_0x5177('0x36')](_0x267599['model'],_0x267599['query']);_0x37380c[_0x5177('0x38')]=_[_0x5177('0x36')](_0x267599[_0x5177('0x37')],qs[_0x5177('0x39')](_0x40dfd6[_0x5177('0x33')][_0x5177('0x39')]));_0x37380c[_0x5177('0x38')]=_0x37380c[_0x5177('0x38')][_0x5177('0x3a')]?_0x37380c['attributes']:_0x267599[_0x5177('0x37')];if(!_0x40dfd6[_0x5177('0x33')]['hasOwnProperty'](_0x5177('0x3c'))){_0x37380c[_0x5177('0x3d')]=qs['limit'](_0x40dfd6[_0x5177('0x33')][_0x5177('0x3d')]);_0x37380c[_0x5177('0x20')]=qs['offset'](_0x40dfd6[_0x5177('0x33')][_0x5177('0x20')]);}_0x37380c['order']=qs['sort'](_0x40dfd6[_0x5177('0x33')]['sort']);_0x37380c[_0x5177('0x40')]=qs['filters'](_[_0x5177('0x41')](_0x40dfd6[_0x5177('0x33')],_0x267599['filters']));if(_0x40dfd6[_0x5177('0x33')][_0x5177('0x42')]){_0x37380c[_0x5177('0x40')]=_[_0x5177('0x43')](_0x37380c[_0x5177('0x40')],{'$or':_[_0x5177('0x32')](_0x37380c[_0x5177('0x38')],function(_0x58ebdd){var _0x26b733={};_0x26b733[_0x58ebdd]={'$like':'%'+_0x40dfd6['query']['filter']+'%'};return _0x26b733;})});}_0x37380c[_0x5177('0x40')]=_[_0x5177('0x43')](_0x37380c['where'],{'mailboxuser':_0xc7a59e[_0x5177('0x55')]});_0x37380c=_[_0x5177('0x43')]({},_0x37380c,_0x40dfd6[_0x5177('0x56')]);return db[_0x5177('0x57')][_0x5177('0x58')](_0x37380c)[_0x5177('0x28')](respondWithFilteredResult(_0x39fb92,_0x37380c));})[_0x5177('0x49')](handleError(_0x39fb92,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 455da66..409e1a8 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 _0xa979=['exports','define','VoiceMail','mailbox','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0xe43a53,_0x2c1e45){var _0x45687a=function(_0x4d2adc){while(--_0x4d2adc){_0xe43a53['push'](_0xe43a53['shift']());}};_0x45687a(++_0x2c1e45);}(_0xa979,0xac));var _0x9a97=function(_0x1b2781,_0x50b74d){_0x1b2781=_0x1b2781-0x0;var _0x226750=_0xa979[_0x1b2781];return _0x226750;};'use strict';var _=require(_0x9a97('0x0'));var util=require(_0x9a97('0x1'));var logger=require(_0x9a97('0x2'))(_0x9a97('0x3'));var moment=require('moment');var BPromise=require(_0x9a97('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9a97('0x5'));var rimraf=require(_0x9a97('0x6'));var config=require(_0x9a97('0x7'));var attributes=require('./voiceMail.attributes');module[_0x9a97('0x8')]=function(_0x183ea6,_0x3b3806){return _0x183ea6[_0x9a97('0x9')](_0x9a97('0xa'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x9a97('0xb'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5661=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','VoiceMail','voice_voicemail','mailbox','context','util'];(function(_0x888385,_0x9cdc66){var _0x22d5c2=function(_0x3b1599){while(--_0x3b1599){_0x888385['push'](_0x888385['shift']());}};_0x22d5c2(++_0x9cdc66);}(_0x5661,0x197));var _0x1566=function(_0x3dae40,_0x5ac8fb){_0x3dae40=_0x3dae40-0x0;var _0x4a3858=_0x5661[_0x3dae40];return _0x4a3858;};'use strict';var _=require('lodash');var util=require(_0x1566('0x0'));var logger=require(_0x1566('0x1'))(_0x1566('0x2'));var moment=require(_0x1566('0x3'));var BPromise=require('bluebird');var rp=require(_0x1566('0x4'));var fs=require('fs');var path=require(_0x1566('0x5'));var rimraf=require(_0x1566('0x6'));var config=require(_0x1566('0x7'));var attributes=require('./voiceMail.attributes');module['exports']=function(_0x50724a,_0x57154f){return _0x50724a['define'](_0x1566('0x8'),attributes,{'tableName':_0x1566('0x9'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x1566('0xa'),_0x1566('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 0d61751..3150b16 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 _0x75ed=['jayson/promise','client','http','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x75ed,0xad));var _0xd75e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x75ed[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0xd75e('0x0'));var moment=require(_0xd75e('0x1'));var BPromise=require('bluebird');var rs=require(_0xd75e('0x2'));var fs=require('fs');var Redis=require(_0xd75e('0x3'));var db=require(_0xd75e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd75e('0x5'))(_0xd75e('0x6'));var config=require('../../config/environment');var jayson=require(_0xd75e('0x7'));var client=jayson[_0xd75e('0x8')][_0xd75e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x278549,_0x47ef7c,_0x304e21){return new BPromise(function(_0x1d0175,_0x56f9fc){return client['request'](_0x278549,_0x304e21)[_0xd75e('0xa')](function(_0x220ec3){logger[_0xd75e('0xb')](_0xd75e('0xc'),_0x47ef7c,_0xd75e('0xd'));logger[_0xd75e('0xe')](_0xd75e('0xf'),_0x47ef7c,_0xd75e('0xd'),JSON['stringify'](_0x220ec3));if(_0x220ec3[_0xd75e('0x10')]){if(_0x220ec3[_0xd75e('0x10')][_0xd75e('0x11')]===0x1f4){logger[_0xd75e('0x10')]('VoiceMail,\x20%s,\x20%s',_0x47ef7c,_0x220ec3[_0xd75e('0x10')][_0xd75e('0x12')]);return _0x56f9fc(_0x220ec3[_0xd75e('0x10')][_0xd75e('0x12')]);}logger['error'](_0xd75e('0xc'),_0x47ef7c,_0x220ec3[_0xd75e('0x10')][_0xd75e('0x12')]);return _0x1d0175(_0x220ec3[_0xd75e('0x10')][_0xd75e('0x12')]);}else{logger[_0xd75e('0xb')]('VoiceMail,\x20%s,\x20%s',_0x47ef7c,_0xd75e('0xd'));_0x1d0175(_0x220ec3[_0xd75e('0x13')][_0xd75e('0x12')]);}})['catch'](function(_0x2fe35a){logger[_0xd75e('0x10')]('VoiceMail,\x20%s,\x20%s',_0x47ef7c,_0x2fe35a);_0x56f9fc(_0x2fe35a);});});} \ No newline at end of file +var _0xfd11=['info','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xfd11,0x1e5));var _0x1fd1=function(_0x53c256,_0x382a24){_0x53c256=_0x53c256-0x0;var _0x25feb6=_0xfd11[_0x53c256];return _0x25feb6;};'use strict';var _=require('lodash');var util=require(_0x1fd1('0x0'));var moment=require(_0x1fd1('0x1'));var BPromise=require(_0x1fd1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1fd1('0x3'));var db=require(_0x1fd1('0x4'))['db'];var utils=require(_0x1fd1('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x1fd1('0x6'));var jayson=require(_0x1fd1('0x7'));var client=jayson[_0x1fd1('0x8')][_0x1fd1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49c3cb,_0x1eaf1e,_0x8d9ed8){return new BPromise(function(_0xb563e6,_0x5d53d5){return client['request'](_0x49c3cb,_0x8d9ed8)[_0x1fd1('0xa')](function(_0x311a30){logger['info'](_0x1fd1('0xb'),_0x1eaf1e,_0x1fd1('0xc'));logger[_0x1fd1('0xd')](_0x1fd1('0xe'),_0x1eaf1e,_0x1fd1('0xc'),JSON[_0x1fd1('0xf')](_0x311a30));if(_0x311a30[_0x1fd1('0x10')]){if(_0x311a30['error'][_0x1fd1('0x11')]===0x1f4){logger[_0x1fd1('0x10')](_0x1fd1('0xb'),_0x1eaf1e,_0x311a30[_0x1fd1('0x10')][_0x1fd1('0x12')]);return _0x5d53d5(_0x311a30[_0x1fd1('0x10')][_0x1fd1('0x12')]);}logger[_0x1fd1('0x10')](_0x1fd1('0xb'),_0x1eaf1e,_0x311a30[_0x1fd1('0x10')][_0x1fd1('0x12')]);return _0xb563e6(_0x311a30[_0x1fd1('0x10')]['message']);}else{logger[_0x1fd1('0x13')](_0x1fd1('0xb'),_0x1eaf1e,'request\x20sent');_0xb563e6(_0x311a30[_0x1fd1('0x14')][_0x1fd1('0x12')]);}})['catch'](function(_0x297eaf){logger[_0x1fd1('0x10')](_0x1fd1('0xb'),_0x1eaf1e,_0x297eaf);_0x5d53d5(_0x297eaf);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index c032af7..98641b9 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 _0x2226=['isAuthenticated','index','/:id','download','post','create','update','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/interaction/service','get'];(function(_0x467602,_0x4ff9d7){var _0x507133=function(_0x41c544){while(--_0x41c544){_0x467602['push'](_0x467602['shift']());}};_0x507133(++_0x4ff9d7);}(_0x2226,0xda));var _0x6222=function(_0xfa2e1e,_0x4002ed){_0xfa2e1e=_0xfa2e1e-0x0;var _0x2f1d12=_0x2226[_0xfa2e1e];return _0x2f1d12;};'use strict';var multer=require(_0x6222('0x0'));var util=require('util');var path=require(_0x6222('0x1'));var timeout=require(_0x6222('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6222('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x6222('0x4'));var config=require('../../config/environment');var controller=require('./voiceMailMessage.controller');router[_0x6222('0x5')]('/',auth[_0x6222('0x6')](),controller[_0x6222('0x7')]);router['get'](_0x6222('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x6222('0x5')]('/:id/download',auth[_0x6222('0x6')](),controller[_0x6222('0x9')]);router[_0x6222('0xa')]('/',auth[_0x6222('0x6')](),controller[_0x6222('0xb')]);router['put']('/:id',auth[_0x6222('0x6')](),controller[_0x6222('0xc')]);router[_0x6222('0xd')](_0x6222('0x8'),auth['isAuthenticated'](),controller[_0x6222('0xe')]);module[_0x6222('0xf')]=router; \ No newline at end of file +var _0x5cae=['../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','create','/:id','update','delete','destroy','exports','multer','util','path','Router','fs-extra'];(function(_0x44da95,_0x4cc956){var _0x5d1db4=function(_0xe7c3da){while(--_0xe7c3da){_0x44da95['push'](_0x44da95['shift']());}};_0x5d1db4(++_0x4cc956);}(_0x5cae,0x160));var _0xe5ca=function(_0x43e2e4,_0x4ad3b4){_0x43e2e4=_0x43e2e4-0x0;var _0x1b71d0=_0x5cae[_0x43e2e4];return _0x1b71d0;};'use strict';var multer=require(_0xe5ca('0x0'));var util=require(_0xe5ca('0x1'));var path=require(_0xe5ca('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe5ca('0x3')]();var fs_extra=require(_0xe5ca('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe5ca('0x5'));var config=require(_0xe5ca('0x6'));var controller=require(_0xe5ca('0x7'));router[_0xe5ca('0x8')]('/',auth[_0xe5ca('0x9')](),controller[_0xe5ca('0xa')]);router[_0xe5ca('0x8')]('/:id',auth[_0xe5ca('0x9')](),controller['show']);router[_0xe5ca('0x8')]('/:id/download',auth[_0xe5ca('0x9')](),controller['download']);router['post']('/',auth[_0xe5ca('0x9')](),controller[_0xe5ca('0xb')]);router['put'](_0xe5ca('0xc'),auth[_0xe5ca('0x9')](),controller[_0xe5ca('0xd')]);router[_0xe5ca('0xe')](_0xe5ca('0xc'),auth[_0xe5ca('0x9')](),controller[_0xe5ca('0xf')]);module[_0xe5ca('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index f627f2a..5d6e110 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 _0x525e=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long'];(function(_0x43a6d5,_0x2edd68){var _0x28b871=function(_0x4ac546){while(--_0x4ac546){_0x43a6d5['push'](_0x43a6d5['shift']());}};_0x28b871(++_0x2edd68);}(_0x525e,0x8e));var _0xe525=function(_0x3e226a,_0x390a9b){_0x3e226a=_0x3e226a-0x0;var _0x1d826f=_0x525e[_0x3e226a];return _0x1d826f;};'use strict';var Sequelize=require(_0xe525('0x0'));module[_0xe525('0x1')]={'name':{'type':Sequelize[_0xe525('0x2')],'get':function(_0x3f29d9){return this[_0xe525('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xe525('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xe525('0x5')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xe525('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0xe525('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xe525('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xe525('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0xe525('0x6')](_0xe525('0x7')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xe525('0x5')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xe525('0x8')](_0xe525('0x9'))}}; \ No newline at end of file +var _0xe9f9=['sequelize','VIRTUAL','INTEGER','STRING','BLOB','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe9f9,0x1ea));var _0x9e9f=function(_0x68f044,_0x1bb7a8){_0x68f044=_0x68f044-0x0;var _0x5741eb=_0xe9f9[_0x68f044];return _0x5741eb;};'use strict';var Sequelize=require(_0x9e9f('0x0'));module['exports']={'name':{'type':Sequelize[_0x9e9f('0x1')],'get':function(_0x13d5b5){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x9e9f('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x9e9f('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x9e9f('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x9e9f('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x9e9f('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x9e9f('0x4')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x9e9f('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x9e9f('0x3')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0x9e9f('0x5')](_0x9e9f('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 4156fdc..596665d 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 _0x4319=['catch','show','params','includeAll','include','find','create','body','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','squel','desk.js','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','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','VoiceMailMessage','rawAttributes','fieldName','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows'];(function(_0x5f3c0e,_0x5324d9){var _0x581009=function(_0x41d176){while(--_0x41d176){_0x5f3c0e['push'](_0x5f3c0e['shift']());}};_0x581009(++_0x5324d9);}(_0x4319,0x111));var _0x9431=function(_0x2dd22e,_0xec41fe){_0x2dd22e=_0x2dd22e-0x0;var _0x257b01=_0x4319[_0x2dd22e];return _0x257b01;};'use strict';var emlformat=require(_0x9431('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9431('0x1'));var jsonpatch=require(_0x9431('0x2'));var rp=require('request-promise');var moment=require(_0x9431('0x3'));var BPromise=require(_0x9431('0x4'));var Mustache=require(_0x9431('0x5'));var util=require(_0x9431('0x6'));var path=require(_0x9431('0x7'));var sox=require('sox');var csv=require(_0x9431('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9431('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9431('0xa'));var toCsv=require(_0x9431('0x8'));var querystring=require(_0x9431('0xb'));var Papa=require(_0x9431('0xc'));var Redis=require('ioredis');var authService=require(_0x9431('0xd'));var qs=require(_0x9431('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9431('0xf'));var logger=require(_0x9431('0x10'))(_0x9431('0x11'));var utils=require(_0x9431('0x12'));var config=require(_0x9431('0x13'));var licenseUtil=require(_0x9431('0x14'));var db=require(_0x9431('0x15'))['db'];function respondWithStatusCode(_0x325124,_0x46bb3d){_0x46bb3d=_0x46bb3d||0xcc;return function(_0xb857a8){if(_0xb857a8){return _0x325124[_0x9431('0x16')](_0x46bb3d);}return _0x325124[_0x9431('0x17')](_0x46bb3d)[_0x9431('0x18')]();};}function respondWithResult(_0x2aea18,_0x26b944){_0x26b944=_0x26b944||0xc8;return function(_0x2bce2a){if(_0x2bce2a){return _0x2aea18[_0x9431('0x17')](_0x26b944)[_0x9431('0x19')](_0x2bce2a);}};}function respondWithFilteredResult(_0xb0702,_0x23daf2){return function(_0x4a121a){if(_0x4a121a){var _0x59205d=typeof _0x23daf2[_0x9431('0x1a')]===_0x9431('0x1b')&&typeof _0x23daf2['limit']==='undefined';var _0x30b533=_0x4a121a[_0x9431('0x1c')];var _0x21c7e6=_0x59205d?0x0:_0x23daf2[_0x9431('0x1a')];var _0x4decdc=_0x59205d?_0x4a121a['count']:_0x23daf2[_0x9431('0x1a')]+_0x23daf2[_0x9431('0x1d')];var _0x2ea1bc;if(_0x4decdc>=_0x30b533){_0x4decdc=_0x30b533;_0x2ea1bc=0xc8;}else{_0x2ea1bc=0xce;}_0xb0702[_0x9431('0x17')](_0x2ea1bc);return _0xb0702[_0x9431('0x1e')](_0x9431('0x1f'),_0x21c7e6+'-'+_0x4decdc+'/'+_0x30b533)['json'](_0x4a121a);}return null;};}function patchUpdates(_0x26a238){return function(_0xd913ea){try{jsonpatch[_0x9431('0x20')](_0xd913ea,_0x26a238,!![]);}catch(_0x29e342){return BPromise['reject'](_0x29e342);}return _0xd913ea[_0x9431('0x21')]();};}function saveUpdates(_0x1f4b6a,_0x633e60){return function(_0x55ddbd){if(_0x55ddbd){return _0x55ddbd[_0x9431('0x22')](_0x1f4b6a)[_0x9431('0x23')](function(_0x15d9cb){return _0x15d9cb;});}return null;};}function removeEntity(_0x2217b0,_0x54dc71){return function(_0x25ab7b){if(_0x25ab7b){return _0x25ab7b[_0x9431('0x24')]()[_0x9431('0x23')](function(){_0x2217b0[_0x9431('0x17')](0xcc)[_0x9431('0x18')]();});}};}function handleEntityNotFound(_0x365bfd,_0x12a32b){return function(_0x51a5b1){if(!_0x51a5b1){_0x365bfd['sendStatus'](0x194);}return _0x51a5b1;};}function handleError(_0x248154,_0x2bb316){_0x2bb316=_0x2bb316||0x1f4;return function(_0x50768b){logger[_0x9431('0x25')](_0x50768b[_0x9431('0x26')]);if(_0x50768b[_0x9431('0x27')]){delete _0x50768b[_0x9431('0x27')];}_0x248154[_0x9431('0x17')](_0x2bb316)[_0x9431('0x28')](_0x50768b);};}exports['index']=function(_0x40402f,_0x582305){var _0x500105={},_0x2eec6b={},_0x1b7bca={'count':0x0,'rows':[]};var _0x481f19=_[_0x9431('0x29')](db[_0x9431('0x2a')][_0x9431('0x2b')],function(_0x3b883f){return{'name':_0x3b883f[_0x9431('0x2c')],'type':_0x3b883f['type'][_0x9431('0x2d')]};});_0x2eec6b[_0x9431('0x2e')]=_[_0x9431('0x2f')](_[_0x9431('0x29')](_0x481f19,_0x9431('0x27')),[_0x9431('0x27')]);_0x2eec6b[_0x9431('0x30')]=_[_0x9431('0x31')](_0x40402f['query']);_0x2eec6b[_0x9431('0x32')]=_[_0x9431('0x33')](_0x2eec6b[_0x9431('0x2e')],_0x2eec6b[_0x9431('0x30')]);_0x500105[_0x9431('0x34')]=_[_0x9431('0x33')](_0x2eec6b['model'],qs[_0x9431('0x35')](_0x40402f[_0x9431('0x30')][_0x9431('0x35')]));_0x500105[_0x9431('0x34')]=_0x500105['attributes'][_0x9431('0x36')]?_0x500105[_0x9431('0x34')]:_0x2eec6b[_0x9431('0x2e')];if(!_0x40402f[_0x9431('0x30')][_0x9431('0x37')](_0x9431('0x38'))){_0x500105[_0x9431('0x1d')]=qs[_0x9431('0x1d')](_0x40402f[_0x9431('0x30')]['limit']);_0x500105[_0x9431('0x1a')]=qs[_0x9431('0x1a')](_0x40402f['query'][_0x9431('0x1a')]);}_0x500105[_0x9431('0x39')]=qs[_0x9431('0x3a')](_0x40402f['query'][_0x9431('0x3a')]);_0x500105[_0x9431('0x3b')]=qs['filters'](_[_0x9431('0x3c')](_0x40402f[_0x9431('0x30')],_0x2eec6b[_0x9431('0x32')]),_0x481f19);if(_0x40402f[_0x9431('0x30')][_0x9431('0x3d')]){_0x500105[_0x9431('0x3b')]=_[_0x9431('0x3e')](_0x500105[_0x9431('0x3b')],{'$or':_['map'](_0x481f19,function(_0x3e20de){if(_0x3e20de['type']!==_0x9431('0x3f')){var _0x3489fb={};_0x3489fb[_0x3e20de[_0x9431('0x27')]]={'$like':'%'+_0x40402f[_0x9431('0x30')][_0x9431('0x3d')]+'%'};return _0x3489fb;}})});}_0x500105=_[_0x9431('0x3e')]({},_0x500105,_0x40402f[_0x9431('0x40')]);var _0x58e7e8={'where':_0x500105[_0x9431('0x3b')]};return db['VoiceMailMessage'][_0x9431('0x1c')](_0x58e7e8)[_0x9431('0x23')](function(_0x39e87c){_0x1b7bca[_0x9431('0x1c')]=_0x39e87c;if(_0x40402f[_0x9431('0x30')]['includeAll']){_0x500105['include']=[{'all':!![]}];}return db[_0x9431('0x2a')][_0x9431('0x41')](_0x500105);})['then'](function(_0x4f96f5){_0x1b7bca[_0x9431('0x42')]=_0x4f96f5;return _0x1b7bca;})[_0x9431('0x23')](respondWithFilteredResult(_0x582305,_0x500105))[_0x9431('0x43')](handleError(_0x582305,null));};exports[_0x9431('0x44')]=function(_0x2fae12,_0x457e4e){var _0x55b35f={'raw':!![],'where':{'id':_0x2fae12[_0x9431('0x45')]['id']}},_0x1bce70={};_0x1bce70[_0x9431('0x2e')]=_[_0x9431('0x31')](db[_0x9431('0x2a')][_0x9431('0x2b')]);_0x1bce70[_0x9431('0x30')]=_[_0x9431('0x31')](_0x2fae12[_0x9431('0x30')]);_0x1bce70[_0x9431('0x32')]=_[_0x9431('0x33')](_0x1bce70[_0x9431('0x2e')],_0x1bce70[_0x9431('0x30')]);_0x55b35f['attributes']=_['intersection'](_0x1bce70[_0x9431('0x2e')],qs['fields'](_0x2fae12['query']['fields']));_0x55b35f[_0x9431('0x34')]=_0x55b35f[_0x9431('0x34')][_0x9431('0x36')]?_0x55b35f[_0x9431('0x34')]:_0x1bce70['model'];if(_0x2fae12[_0x9431('0x30')][_0x9431('0x46')]){_0x55b35f[_0x9431('0x47')]=[{'all':!![]}];}_0x55b35f=_[_0x9431('0x3e')]({},_0x55b35f,_0x2fae12['options']);return db['VoiceMailMessage'][_0x9431('0x48')](_0x55b35f)[_0x9431('0x23')](handleEntityNotFound(_0x457e4e,null))[_0x9431('0x23')](respondWithResult(_0x457e4e,null))[_0x9431('0x43')](handleError(_0x457e4e,null));};exports[_0x9431('0x49')]=function(_0xe71b6c,_0x5f4c46){return db[_0x9431('0x2a')]['create'](_0xe71b6c[_0x9431('0x4a')],{})[_0x9431('0x23')](respondWithResult(_0x5f4c46,0xc9))['catch'](handleError(_0x5f4c46,null));};exports[_0x9431('0x22')]=function(_0x32aaba,_0x39d534){if(_0x32aaba[_0x9431('0x4a')]['id']){delete _0x32aaba[_0x9431('0x4a')]['id'];}return db[_0x9431('0x2a')]['find']({'where':{'id':_0x32aaba[_0x9431('0x45')]['id']}})[_0x9431('0x23')](handleEntityNotFound(_0x39d534,null))[_0x9431('0x23')](saveUpdates(_0x32aaba[_0x9431('0x4a')],null))[_0x9431('0x23')](respondWithResult(_0x39d534,null))[_0x9431('0x43')](handleError(_0x39d534,null));};exports['destroy']=function(_0xb5462b,_0x80602f){return db['VoiceMailMessage']['find']({'where':{'id':_0xb5462b[_0x9431('0x45')]['id']}})[_0x9431('0x23')](handleEntityNotFound(_0x80602f,null))['then'](removeEntity(_0x80602f,null))[_0x9431('0x43')](handleError(_0x80602f,null));};exports[_0x9431('0x4b')]=function(_0x1e8cf0,_0x41953f,_0x1a1aad){return db[_0x9431('0x2a')][_0x9431('0x48')]({'where':{'id':_0x1e8cf0['params']['id']},'attributes':['id',_0x9431('0x4c'),_0x9431('0x4d')]})[_0x9431('0x23')](handleEntityNotFound(_0x41953f,null))[_0x9431('0x23')](function(_0x238644){if(_0x238644){if(!_0x238644[_0x9431('0x4c')]){throw new db[(_0x9431('0x4e'))][(_0x9431('0x4f'))](_0x9431('0x50'));}var _0x14d96e={'Content-Type':'audio/wav','Content-Disposition':_0x9431('0x51')};if(_0x238644['msg_id']){_0x14d96e[_0x9431('0x52')]=_0x9431('0x53')+_0x238644['msg_id']+_0x9431('0x54');}_0x41953f['set'](_0x14d96e);return _0x41953f['send'](new Buffer(_0x238644[_0x9431('0x4c')]));}})[_0x9431('0x43')](handleError(_0x41953f,null));}; \ No newline at end of file +var _0xa534=['api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','apply','reject','update','then','destroy','error','stack','name','send','index','map','VoiceMailMessage','fieldName','type','key','differenceBy','query','keys','filters','intersection','model','attributes','fields','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x19d24c,_0x62bc50){var _0x2fae8d=function(_0x419856){while(--_0x419856){_0x19d24c['push'](_0x19d24c['shift']());}};_0x2fae8d(++_0x62bc50);}(_0xa534,0x92));var _0x4a53=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xa534[_0x4a747d];return _0x3a5b5c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4a53('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4a53('0x1'));var rp=require(_0x4a53('0x2'));var moment=require(_0x4a53('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4a53('0x4'));var util=require('util');var path=require(_0x4a53('0x5'));var sox=require(_0x4a53('0x6'));var csv=require(_0x4a53('0x7'));var ejs=require(_0x4a53('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4a53('0x9'));var squel=require('squel');var crypto=require(_0x4a53('0xa'));var jsforce=require(_0x4a53('0xb'));var deskjs=require(_0x4a53('0xc'));var toCsv=require(_0x4a53('0x7'));var querystring=require(_0x4a53('0xd'));var Papa=require('papaparse');var Redis=require(_0x4a53('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4a53('0xf'));var as=require(_0x4a53('0x10'));var hardwareService=require(_0x4a53('0x11'));var logger=require('../../config/logger')(_0x4a53('0x12'));var utils=require('../../config/utils');var config=require(_0x4a53('0x13'));var licenseUtil=require(_0x4a53('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x235038,_0x27652b){_0x27652b=_0x27652b||0xcc;return function(_0x3476ad){if(_0x3476ad){return _0x235038[_0x4a53('0x15')](_0x27652b);}return _0x235038[_0x4a53('0x16')](_0x27652b)[_0x4a53('0x17')]();};}function respondWithResult(_0x36e1d9,_0x5a42f3){_0x5a42f3=_0x5a42f3||0xc8;return function(_0x521208){if(_0x521208){return _0x36e1d9['status'](_0x5a42f3)[_0x4a53('0x18')](_0x521208);}};}function respondWithFilteredResult(_0x289911,_0x4b3f5f){return function(_0x199409){if(_0x199409){var _0x29d765=typeof _0x4b3f5f[_0x4a53('0x19')]==='undefined'&&typeof _0x4b3f5f[_0x4a53('0x1a')]===_0x4a53('0x1b');var _0x591353=_0x199409[_0x4a53('0x1c')];var _0x2dddbe=_0x29d765?0x0:_0x4b3f5f['offset'];var _0x3c00be=_0x29d765?_0x199409[_0x4a53('0x1c')]:_0x4b3f5f[_0x4a53('0x19')]+_0x4b3f5f[_0x4a53('0x1a')];var _0x500362;if(_0x3c00be>=_0x591353){_0x3c00be=_0x591353;_0x500362=0xc8;}else{_0x500362=0xce;}_0x289911['status'](_0x500362);return _0x289911['set']('Content-Range',_0x2dddbe+'-'+_0x3c00be+'/'+_0x591353)[_0x4a53('0x18')](_0x199409);}return null;};}function patchUpdates(_0x3cdb77){return function(_0x569bdc){try{jsonpatch[_0x4a53('0x1d')](_0x569bdc,_0x3cdb77,!![]);}catch(_0x2b42ee){return BPromise[_0x4a53('0x1e')](_0x2b42ee);}return _0x569bdc['save']();};}function saveUpdates(_0x1da20d,_0x39cdf8){return function(_0x332fea){if(_0x332fea){return _0x332fea[_0x4a53('0x1f')](_0x1da20d)[_0x4a53('0x20')](function(_0x3fd4ba){return _0x3fd4ba;});}return null;};}function removeEntity(_0x1ad2ae,_0x2c5b5f){return function(_0x2b5c9d){if(_0x2b5c9d){return _0x2b5c9d[_0x4a53('0x21')]()[_0x4a53('0x20')](function(){_0x1ad2ae['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xdb8330,_0x5d599a){return function(_0xa73f67){if(!_0xa73f67){_0xdb8330[_0x4a53('0x15')](0x194);}return _0xa73f67;};}function handleError(_0x15f2cf,_0x1cac2f){_0x1cac2f=_0x1cac2f||0x1f4;return function(_0x2db734){logger[_0x4a53('0x22')](_0x2db734[_0x4a53('0x23')]);if(_0x2db734[_0x4a53('0x24')]){delete _0x2db734[_0x4a53('0x24')];}_0x15f2cf[_0x4a53('0x16')](_0x1cac2f)[_0x4a53('0x25')](_0x2db734);};}exports[_0x4a53('0x26')]=function(_0xaec2c,_0x46790d){var _0x560749={},_0x19a73a={},_0x119ab1={'count':0x0,'rows':[]};var _0x33e9dc=_[_0x4a53('0x27')](db[_0x4a53('0x28')]['rawAttributes'],function(_0x204c45){return{'name':_0x204c45[_0x4a53('0x29')],'type':_0x204c45[_0x4a53('0x2a')][_0x4a53('0x2b')]};});_0x19a73a['model']=_[_0x4a53('0x2c')](_['map'](_0x33e9dc,_0x4a53('0x24')),['name']);_0x19a73a[_0x4a53('0x2d')]=_[_0x4a53('0x2e')](_0xaec2c[_0x4a53('0x2d')]);_0x19a73a[_0x4a53('0x2f')]=_[_0x4a53('0x30')](_0x19a73a[_0x4a53('0x31')],_0x19a73a[_0x4a53('0x2d')]);_0x560749[_0x4a53('0x32')]=_['intersection'](_0x19a73a[_0x4a53('0x31')],qs[_0x4a53('0x33')](_0xaec2c[_0x4a53('0x2d')][_0x4a53('0x33')]));_0x560749[_0x4a53('0x32')]=_0x560749[_0x4a53('0x32')]['length']?_0x560749[_0x4a53('0x32')]:_0x19a73a[_0x4a53('0x31')];if(!_0xaec2c[_0x4a53('0x2d')]['hasOwnProperty'](_0x4a53('0x34'))){_0x560749['limit']=qs[_0x4a53('0x1a')](_0xaec2c[_0x4a53('0x2d')][_0x4a53('0x1a')]);_0x560749['offset']=qs[_0x4a53('0x19')](_0xaec2c[_0x4a53('0x2d')][_0x4a53('0x19')]);}_0x560749['order']=qs[_0x4a53('0x35')](_0xaec2c[_0x4a53('0x2d')][_0x4a53('0x35')]);_0x560749[_0x4a53('0x36')]=qs[_0x4a53('0x2f')](_[_0x4a53('0x37')](_0xaec2c[_0x4a53('0x2d')],_0x19a73a[_0x4a53('0x2f')]),_0x33e9dc);if(_0xaec2c[_0x4a53('0x2d')]['filter']){_0x560749[_0x4a53('0x36')]=_[_0x4a53('0x38')](_0x560749[_0x4a53('0x36')],{'$or':_[_0x4a53('0x27')](_0x33e9dc,function(_0x704b30){if(_0x704b30[_0x4a53('0x2a')]!==_0x4a53('0x39')){var _0x3c75e9={};_0x3c75e9[_0x704b30[_0x4a53('0x24')]]={'$like':'%'+_0xaec2c[_0x4a53('0x2d')][_0x4a53('0x3a')]+'%'};return _0x3c75e9;}})});}_0x560749=_[_0x4a53('0x38')]({},_0x560749,_0xaec2c[_0x4a53('0x3b')]);var _0x290bed={'where':_0x560749[_0x4a53('0x36')]};return db[_0x4a53('0x28')]['count'](_0x290bed)[_0x4a53('0x20')](function(_0x5d628e){_0x119ab1['count']=_0x5d628e;if(_0xaec2c[_0x4a53('0x2d')][_0x4a53('0x3c')]){_0x560749[_0x4a53('0x3d')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x4a53('0x3e')](_0x560749);})[_0x4a53('0x20')](function(_0x4619f0){_0x119ab1[_0x4a53('0x3f')]=_0x4619f0;return _0x119ab1;})['then'](respondWithFilteredResult(_0x46790d,_0x560749))[_0x4a53('0x40')](handleError(_0x46790d,null));};exports[_0x4a53('0x41')]=function(_0x3fa5d8,_0x31e011){var _0x46886f={'raw':!![],'where':{'id':_0x3fa5d8[_0x4a53('0x42')]['id']}},_0x44142d={};_0x44142d[_0x4a53('0x31')]=_[_0x4a53('0x2e')](db[_0x4a53('0x28')][_0x4a53('0x43')]);_0x44142d[_0x4a53('0x2d')]=_['keys'](_0x3fa5d8[_0x4a53('0x2d')]);_0x44142d['filters']=_[_0x4a53('0x30')](_0x44142d[_0x4a53('0x31')],_0x44142d[_0x4a53('0x2d')]);_0x46886f[_0x4a53('0x32')]=_[_0x4a53('0x30')](_0x44142d[_0x4a53('0x31')],qs[_0x4a53('0x33')](_0x3fa5d8[_0x4a53('0x2d')][_0x4a53('0x33')]));_0x46886f[_0x4a53('0x32')]=_0x46886f[_0x4a53('0x32')]['length']?_0x46886f[_0x4a53('0x32')]:_0x44142d[_0x4a53('0x31')];if(_0x3fa5d8[_0x4a53('0x2d')]['includeAll']){_0x46886f[_0x4a53('0x3d')]=[{'all':!![]}];}_0x46886f=_['merge']({},_0x46886f,_0x3fa5d8['options']);return db[_0x4a53('0x28')][_0x4a53('0x44')](_0x46886f)[_0x4a53('0x20')](handleEntityNotFound(_0x31e011,null))[_0x4a53('0x20')](respondWithResult(_0x31e011,null))['catch'](handleError(_0x31e011,null));};exports['create']=function(_0x48a56,_0x1cb5ee){return db[_0x4a53('0x28')][_0x4a53('0x45')](_0x48a56[_0x4a53('0x46')],{})[_0x4a53('0x20')](respondWithResult(_0x1cb5ee,0xc9))[_0x4a53('0x40')](handleError(_0x1cb5ee,null));};exports[_0x4a53('0x1f')]=function(_0xff4522,_0x273161){if(_0xff4522[_0x4a53('0x46')]['id']){delete _0xff4522[_0x4a53('0x46')]['id'];}return db['VoiceMailMessage']['find']({'where':{'id':_0xff4522[_0x4a53('0x42')]['id']}})['then'](handleEntityNotFound(_0x273161,null))[_0x4a53('0x20')](saveUpdates(_0xff4522['body'],null))[_0x4a53('0x20')](respondWithResult(_0x273161,null))[_0x4a53('0x40')](handleError(_0x273161,null));};exports[_0x4a53('0x21')]=function(_0x29bae5,_0x19bb27){return db[_0x4a53('0x28')][_0x4a53('0x44')]({'where':{'id':_0x29bae5['params']['id']}})[_0x4a53('0x20')](handleEntityNotFound(_0x19bb27,null))[_0x4a53('0x20')](removeEntity(_0x19bb27,null))['catch'](handleError(_0x19bb27,null));};exports[_0x4a53('0x47')]=function(_0xfb4945,_0x31ef3b,_0x43b4ea){return db['VoiceMailMessage'][_0x4a53('0x44')]({'where':{'id':_0xfb4945['params']['id']},'attributes':['id',_0x4a53('0x48'),_0x4a53('0x49')]})[_0x4a53('0x20')](handleEntityNotFound(_0x31ef3b,null))[_0x4a53('0x20')](function(_0x55fa32){if(_0x55fa32){if(!_0x55fa32[_0x4a53('0x48')]){throw new db[(_0x4a53('0x4a'))]['ValidationError'](_0x4a53('0x4b'));}var _0x2d98ea={'Content-Type':_0x4a53('0x4c'),'Content-Disposition':_0x4a53('0x4d')};if(_0x55fa32['msg_id']){_0x2d98ea[_0x4a53('0x4e')]=_0x4a53('0x4f')+_0x55fa32[_0x4a53('0x49')]+_0x4a53('0x50');}_0x31ef3b[_0x4a53('0x51')](_0x2d98ea);return _0x31ef3b['send'](new Buffer(_0x55fa32[_0x4a53('0x48')]));}})['catch'](handleError(_0x31ef3b,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index f698a45..5c8adcd 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 _0x2b74=['dir','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./voiceMailMessage.attributes','define','VoiceMailMessage','voice_voicemail_messages'];(function(_0x154cb5,_0x1a8d5a){var _0x3f574f=function(_0x597a52){while(--_0x597a52){_0x154cb5['push'](_0x154cb5['shift']());}};_0x3f574f(++_0x1a8d5a);}(_0x2b74,0x109));var _0x42b7=function(_0x328972,_0x15c834){_0x328972=_0x328972-0x0;var _0x67a1cf=_0x2b74[_0x328972];return _0x67a1cf;};'use strict';var _=require(_0x42b7('0x0'));var util=require(_0x42b7('0x1'));var logger=require(_0x42b7('0x2'))('api');var moment=require(_0x42b7('0x3'));var BPromise=require(_0x42b7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x42b7('0x5'));var rimraf=require(_0x42b7('0x6'));var config=require('../../config/environment');var attributes=require(_0x42b7('0x7'));module['exports']=function(_0x1c0162,_0x1a908a){return _0x1c0162[_0x42b7('0x8')](_0x42b7('0x9'),attributes,{'tableName':_0x42b7('0xa'),'paranoid':![],'indexes':[{'name':_0x42b7('0xb'),'fields':[_0x42b7('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0xc5d6=['dir','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','voice_voicemail_messages'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xc5d6,0x16d));var _0x6c5d=function(_0x5d8030,_0x36ef31){_0x5d8030=_0x5d8030-0x0;var _0x465a41=_0xc5d6[_0x5d8030];return _0x465a41;};'use strict';var _=require(_0x6c5d('0x0'));var util=require(_0x6c5d('0x1'));var logger=require(_0x6c5d('0x2'))('api');var moment=require(_0x6c5d('0x3'));var BPromise=require(_0x6c5d('0x4'));var rp=require(_0x6c5d('0x5'));var fs=require('fs');var path=require(_0x6c5d('0x6'));var rimraf=require(_0x6c5d('0x7'));var config=require(_0x6c5d('0x8'));var attributes=require(_0x6c5d('0x9'));module[_0x6c5d('0xa')]=function(_0x14dcfb,_0x3896fb){return _0x14dcfb['define']('VoiceMailMessage',attributes,{'tableName':_0x6c5d('0xb'),'paranoid':![],'indexes':[{'name':_0x6c5d('0xc'),'fields':[_0x6c5d('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index b0c2324..1d168fa 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 _0x3abf=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring'];(function(_0x3313a3,_0x3dca09){var _0x4fd1f3=function(_0x3309ee){while(--_0x3309ee){_0x3313a3['push'](_0x3313a3['shift']());}};_0x4fd1f3(++_0x3dca09);}(_0x3abf,0x127));var _0xf3ab=function(_0xfe7250,_0x5f43df){_0xfe7250=_0xfe7250-0x0;var _0x4b8ab3=_0x3abf[_0xfe7250];return _0x4b8ab3;};'use strict';var _=require(_0xf3ab('0x0'));var util=require(_0xf3ab('0x1'));var moment=require(_0xf3ab('0x2'));var BPromise=require('bluebird');var rs=require(_0xf3ab('0x3'));var fs=require('fs');var Redis=require(_0xf3ab('0x4'));var db=require(_0xf3ab('0x5'))['db'];var utils=require(_0xf3ab('0x6'));var logger=require(_0xf3ab('0x7'))(_0xf3ab('0x8'));var config=require('../../config/environment');var jayson=require(_0xf3ab('0x9'));var client=jayson['client'][_0xf3ab('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x328746,_0x4e5e50,_0x2c8668){return new BPromise(function(_0xb400c7,_0x401ebb){return client[_0xf3ab('0xb')](_0x328746,_0x2c8668)[_0xf3ab('0xc')](function(_0x260ced){logger[_0xf3ab('0xd')](_0xf3ab('0xe'),_0x4e5e50,_0xf3ab('0xf'));logger['debug'](_0xf3ab('0x10'),_0x4e5e50,_0xf3ab('0xf'),JSON[_0xf3ab('0x11')](_0x260ced));if(_0x260ced[_0xf3ab('0x12')]){if(_0x260ced[_0xf3ab('0x12')][_0xf3ab('0x13')]===0x1f4){logger['error'](_0xf3ab('0xe'),_0x4e5e50,_0x260ced[_0xf3ab('0x12')][_0xf3ab('0x14')]);return _0x401ebb(_0x260ced[_0xf3ab('0x12')]['message']);}logger[_0xf3ab('0x12')](_0xf3ab('0xe'),_0x4e5e50,_0x260ced[_0xf3ab('0x12')][_0xf3ab('0x14')]);return _0xb400c7(_0x260ced[_0xf3ab('0x12')][_0xf3ab('0x14')]);}else{logger['info'](_0xf3ab('0xe'),_0x4e5e50,_0xf3ab('0xf'));_0xb400c7(_0x260ced[_0xf3ab('0x15')][_0xf3ab('0x14')]);}})[_0xf3ab('0x16')](function(_0x6984e9){logger['error'](_0xf3ab('0xe'),_0x4e5e50,_0x6984e9);_0x401ebb(_0x6984e9);});});} \ No newline at end of file +var _0xead6=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug','request\x20sent','error','code','VoiceMailMessage,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xead6,0xdb));var _0x6ead=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xead6[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x6ead('0x0'));var util=require('util');var moment=require(_0x6ead('0x1'));var BPromise=require(_0x6ead('0x2'));var rs=require(_0x6ead('0x3'));var fs=require('fs');var Redis=require(_0x6ead('0x4'));var db=require(_0x6ead('0x5'))['db'];var utils=require(_0x6ead('0x6'));var logger=require('../../config/logger')(_0x6ead('0x7'));var config=require(_0x6ead('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6ead('0x9')][_0x6ead('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xcabd6c,_0x23eba5,_0x499687){return new BPromise(function(_0x4a5ecf,_0x430b3e){return client[_0x6ead('0xb')](_0xcabd6c,_0x499687)[_0x6ead('0xc')](function(_0x7172cb){logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x23eba5,'request\x20sent');logger[_0x6ead('0xd')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x23eba5,_0x6ead('0xe'),JSON['stringify'](_0x7172cb));if(_0x7172cb[_0x6ead('0xf')]){if(_0x7172cb[_0x6ead('0xf')][_0x6ead('0x10')]===0x1f4){logger[_0x6ead('0xf')](_0x6ead('0x11'),_0x23eba5,_0x7172cb[_0x6ead('0xf')][_0x6ead('0x12')]);return _0x430b3e(_0x7172cb[_0x6ead('0xf')][_0x6ead('0x12')]);}logger[_0x6ead('0xf')](_0x6ead('0x11'),_0x23eba5,_0x7172cb['error'][_0x6ead('0x12')]);return _0x4a5ecf(_0x7172cb[_0x6ead('0xf')]['message']);}else{logger[_0x6ead('0x13')](_0x6ead('0x11'),_0x23eba5,_0x6ead('0xe'));_0x4a5ecf(_0x7172cb[_0x6ead('0x14')][_0x6ead('0x12')]);}})[_0x6ead('0x15')](function(_0x18de9d){logger[_0x6ead('0xf')](_0x6ead('0x11'),_0x23eba5,_0x18de9d);_0x430b3e(_0x18de9d);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 6e12014..fbe1d49 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 _0x8bc1=['removeSound','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./voiceMusicOnHold.controller','get','/:id','show','/:id/sounds','post','create','isAuthenticated','addSound','put','update','delete','destroy','/:id/sounds/:id2'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8bc1,0xa3));var _0x18bc=function(_0x18b981,_0x120eb9){_0x18b981=_0x18b981-0x0;var _0x269c38=_0x8bc1[_0x18b981];return _0x269c38;};'use strict';var multer=require(_0x18bc('0x0'));var util=require(_0x18bc('0x1'));var path=require(_0x18bc('0x2'));var timeout=require(_0x18bc('0x3'));var express=require(_0x18bc('0x4'));var router=express[_0x18bc('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x18bc('0x6'));var config=require('../../config/environment');var controller=require(_0x18bc('0x7'));router[_0x18bc('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x18bc('0x8')](_0x18bc('0x9'),auth['isAuthenticated'](),controller[_0x18bc('0xa')]);router[_0x18bc('0x8')](_0x18bc('0xb'),auth['isAuthenticated'](),controller['getSounds']);router[_0x18bc('0xc')]('/',auth['isAuthenticated'](),controller[_0x18bc('0xd')]);router[_0x18bc('0xc')](_0x18bc('0xb'),auth[_0x18bc('0xe')](),controller[_0x18bc('0xf')]);router[_0x18bc('0x10')](_0x18bc('0x9'),auth[_0x18bc('0xe')](),controller[_0x18bc('0x11')]);router[_0x18bc('0x12')](_0x18bc('0x9'),auth[_0x18bc('0xe')](),controller[_0x18bc('0x13')]);router[_0x18bc('0x12')](_0x18bc('0x14'),auth[_0x18bc('0xe')](),controller[_0x18bc('0x15')]);module[_0x18bc('0x16')]=router; \ No newline at end of file +var _0xbed9=['getSounds','post','create','put','/:id','update','delete','/:id/sounds/:id2','removeSound','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','get','show','/:id/sounds'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xbed9,0xc2));var _0x9bed=function(_0x5bed33,_0x254573){_0x5bed33=_0x5bed33-0x0;var _0x48ffa4=_0xbed9[_0x5bed33];return _0x48ffa4;};'use strict';var multer=require(_0x9bed('0x0'));var util=require(_0x9bed('0x1'));var path=require(_0x9bed('0x2'));var timeout=require('connect-timeout');var express=require(_0x9bed('0x3'));var router=express[_0x9bed('0x4')]();var fs_extra=require(_0x9bed('0x5'));var auth=require(_0x9bed('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9bed('0x7'));var controller=require(_0x9bed('0x8'));router['get']('/',auth[_0x9bed('0x9')](),controller['index']);router[_0x9bed('0xa')]('/:id',auth[_0x9bed('0x9')](),controller[_0x9bed('0xb')]);router[_0x9bed('0xa')](_0x9bed('0xc'),auth[_0x9bed('0x9')](),controller[_0x9bed('0xd')]);router[_0x9bed('0xe')]('/',auth['isAuthenticated'](),controller[_0x9bed('0xf')]);router[_0x9bed('0xe')]('/:id/sounds',auth[_0x9bed('0x9')](),controller['addSound']);router[_0x9bed('0x10')](_0x9bed('0x11'),auth[_0x9bed('0x9')](),controller[_0x9bed('0x12')]);router['delete'](_0x9bed('0x11'),auth[_0x9bed('0x9')](),controller['destroy']);router[_0x9bed('0x13')](_0x9bed('0x14'),auth[_0x9bed('0x9')](),controller[_0x9bed('0x15')]);module[_0x9bed('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 33e3e1c..40a647a 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 _0xab85=['exports','STRING','name','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize'];(function(_0x501c00,_0x1dc98b){var _0x5ad836=function(_0x21299f){while(--_0x21299f){_0x501c00['push'](_0x501c00['shift']());}};_0x5ad836(++_0x1dc98b);}(_0xab85,0x1df));var _0x5ab8=function(_0x1a8472,_0x28eb63){_0x1a8472=_0x1a8472-0x0;var _0x2b5240=_0xab85[_0x1a8472];return _0x2b5240;};'use strict';var Sequelize=require(_0x5ab8('0x0'));module[_0x5ab8('0x1')]={'name':{'type':Sequelize[_0x5ab8('0x2')],'allowNull':![],'unique':_0x5ab8('0x3')},'mode':{'type':Sequelize['ENUM']('custom',_0x5ab8('0x4'),_0x5ab8('0x5'),_0x5ab8('0x6'),_0x5ab8('0x7'),_0x5ab8('0x8')),'allowNull':!![],'defaultValue':_0x5ab8('0x4')},'directory':{'type':Sequelize[_0x5ab8('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x5ab8('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x5ab8('0x2')],'allowNull':!![],'defaultValue':_0x5ab8('0x9')},'format':{'type':Sequelize[_0x5ab8('0x2')],'allowNull':!![]},'stamp':{'type':_0x5ab8('0xa')},'defaultEntry':{'type':Sequelize[_0x5ab8('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7310=['STRING','TIMESTAMP','BOOLEAN','sequelize','exports','ENUM','files','quietmp3nb','quietmp3'];(function(_0x25bada,_0xf760bb){var _0x3b2e2a=function(_0x42a9c8){while(--_0x42a9c8){_0x25bada['push'](_0x25bada['shift']());}};_0x3b2e2a(++_0xf760bb);}(_0x7310,0xdb));var _0x0731=function(_0xfeb222,_0x1e8428){_0xfeb222=_0xfeb222-0x0;var _0x2026d3=_0x7310[_0xfeb222];return _0x2026d3;};'use strict';var Sequelize=require(_0x0731('0x0'));module[_0x0731('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x0731('0x2')]('custom',_0x0731('0x3'),'mp3nb',_0x0731('0x4'),_0x0731('0x5'),'mp3'),'allowNull':!![],'defaultValue':_0x0731('0x3')},'directory':{'type':Sequelize[_0x0731('0x6')],'allowNull':!![]},'application':{'type':Sequelize[_0x0731('0x6')],'allowNull':!![]},'digit':{'type':Sequelize[_0x0731('0x6')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x0731('0x6')],'allowNull':!![]},'stamp':{'type':_0x0731('0x7')},'defaultEntry':{'type':Sequelize[_0x0731('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 47441d6..d9dc88c 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 _0x382a=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','set','apply','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','sendStatus','error','stack','name','send','map','VoiceMusicOnHold','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','sequelize','transaction','files','directory','join','root','mode','mkdirSync','0777','user','role','UserProfileSection','userProfileId','autoAssociation','create','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','createdAt','server/files/sounds/converted','format','%s.%s','converted_format','server/files/moh','symlinkSync','removeSound','id2','getSounds','options','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x200276,_0x3a39b5){var _0x496325=function(_0x36551d){while(--_0x36551d){_0x200276['push'](_0x200276['shift']());}};_0x496325(++_0x3a39b5);}(_0x382a,0xd3));var _0xa382=function(_0x2d50be,_0x4e2d7c){_0x2d50be=_0x2d50be-0x0;var _0x2d3545=_0x382a[_0x2d50be];return _0x2d3545;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa382('0x0'));var zipdir=require(_0xa382('0x1'));var jsonpatch=require(_0xa382('0x2'));var rp=require(_0xa382('0x3'));var moment=require(_0xa382('0x4'));var BPromise=require(_0xa382('0x5'));var Mustache=require('mustache');var util=require(_0xa382('0x6'));var path=require(_0xa382('0x7'));var sox=require('sox');var csv=require(_0xa382('0x8'));var ejs=require(_0xa382('0x9'));var fs=require('fs');var fs_extra=require(_0xa382('0xa'));var _=require('lodash');var squel=require(_0xa382('0xb'));var crypto=require(_0xa382('0xc'));var jsforce=require(_0xa382('0xd'));var deskjs=require(_0xa382('0xe'));var toCsv=require(_0xa382('0x8'));var querystring=require(_0xa382('0xf'));var Papa=require('papaparse');var Redis=require(_0xa382('0x10'));var authService=require(_0xa382('0x11'));var qs=require(_0xa382('0x12'));var as=require(_0xa382('0x13'));var hardwareService=require(_0xa382('0x14'));var logger=require(_0xa382('0x15'))(_0xa382('0x16'));var utils=require(_0xa382('0x17'));var config=require(_0xa382('0x18'));var licenseUtil=require(_0xa382('0x19'));var db=require(_0xa382('0x1a'))['db'];function respondWithStatusCode(_0x4bce44,_0x37839e){_0x37839e=_0x37839e||0xcc;return function(_0x29e141){if(_0x29e141){return _0x4bce44['sendStatus'](_0x37839e);}return _0x4bce44[_0xa382('0x1b')](_0x37839e)[_0xa382('0x1c')]();};}function respondWithResult(_0x55617d,_0x3b4187){_0x3b4187=_0x3b4187||0xc8;return function(_0x5eddee){if(_0x5eddee){return _0x55617d[_0xa382('0x1b')](_0x3b4187)[_0xa382('0x1d')](_0x5eddee);}};}function respondWithFilteredResult(_0x2aada2,_0x249cdd){return function(_0x146bcf){if(_0x146bcf){var _0x3a5549=typeof _0x249cdd['offset']===_0xa382('0x1e')&&typeof _0x249cdd[_0xa382('0x1f')]===_0xa382('0x1e');var _0x2acc35=_0x146bcf[_0xa382('0x20')];var _0x3553f9=_0x3a5549?0x0:_0x249cdd['offset'];var _0x473c93=_0x3a5549?_0x146bcf[_0xa382('0x20')]:_0x249cdd['offset']+_0x249cdd['limit'];var _0x2c25f5;if(_0x473c93>=_0x2acc35){_0x473c93=_0x2acc35;_0x2c25f5=0xc8;}else{_0x2c25f5=0xce;}_0x2aada2['status'](_0x2c25f5);return _0x2aada2[_0xa382('0x21')]('Content-Range',_0x3553f9+'-'+_0x473c93+'/'+_0x2acc35)['json'](_0x146bcf);}return null;};}function patchUpdates(_0x5ad13d){return function(_0x54afad){try{jsonpatch[_0xa382('0x22')](_0x54afad,_0x5ad13d,!![]);}catch(_0x4e6cfd){return BPromise['reject'](_0x4e6cfd);}return _0x54afad[_0xa382('0x23')]();};}function saveUpdates(_0x457165,_0xfb2179){return function(_0x45d353){if(_0x45d353){return _0x45d353[_0xa382('0x24')](_0x457165)[_0xa382('0x25')](function(_0x2f340d){return _0x2f340d;});}return null;};}function removeEntity(_0x407421,_0x5569cf){return function(_0x4d6122){if(_0x4d6122){return _0x4d6122[_0xa382('0x26')]()['then'](function(){var _0xfb814d=_0x4d6122[_0xa382('0x27')]({'plain':!![]});var _0x17c53b=_0xa382('0x28');return db[_0xa382('0x29')][_0xa382('0x26')]({'where':{'type':_0x17c53b,'resourceId':_0xfb814d['id']}})[_0xa382('0x25')](function(){return _0x4d6122;});})[_0xa382('0x25')](function(){_0x407421[_0xa382('0x1b')](0xcc)[_0xa382('0x1c')]();});}};}function handleEntityNotFound(_0x13d8d3,_0x286b31){return function(_0x5e2076){if(!_0x5e2076){_0x13d8d3[_0xa382('0x2a')](0x194);}return _0x5e2076;};}function handleError(_0x2ea882,_0x3ba3da){_0x3ba3da=_0x3ba3da||0x1f4;return function(_0x30b3fe){logger[_0xa382('0x2b')](_0x30b3fe[_0xa382('0x2c')]);if(_0x30b3fe[_0xa382('0x2d')]){delete _0x30b3fe[_0xa382('0x2d')];}_0x2ea882[_0xa382('0x1b')](_0x3ba3da)[_0xa382('0x2e')](_0x30b3fe);};}exports['index']=function(_0x6cbaab,_0x55561e){var _0x3c6249={},_0x1d48fa={},_0x49743f={'count':0x0,'rows':[]};var _0x11aef0=_[_0xa382('0x2f')](db[_0xa382('0x30')]['rawAttributes'],function(_0x45f65b){return{'name':_0x45f65b[_0xa382('0x31')],'type':_0x45f65b[_0xa382('0x32')][_0xa382('0x33')]};});_0x1d48fa[_0xa382('0x34')]=_[_0xa382('0x2f')](_0x11aef0,'name');_0x1d48fa['query']=_[_0xa382('0x35')](_0x6cbaab['query']);_0x1d48fa[_0xa382('0x36')]=_[_0xa382('0x37')](_0x1d48fa[_0xa382('0x34')],_0x1d48fa[_0xa382('0x38')]);_0x3c6249['attributes']=_['intersection'](_0x1d48fa[_0xa382('0x34')],qs[_0xa382('0x39')](_0x6cbaab[_0xa382('0x38')]['fields']));_0x3c6249['attributes']=_0x3c6249[_0xa382('0x3a')][_0xa382('0x3b')]?_0x3c6249[_0xa382('0x3a')]:_0x1d48fa[_0xa382('0x34')];if(!_0x6cbaab['query'][_0xa382('0x3c')](_0xa382('0x3d'))){_0x3c6249[_0xa382('0x1f')]=qs[_0xa382('0x1f')](_0x6cbaab[_0xa382('0x38')]['limit']);_0x3c6249['offset']=qs['offset'](_0x6cbaab[_0xa382('0x38')][_0xa382('0x3e')]);}_0x3c6249[_0xa382('0x3f')]=qs[_0xa382('0x40')](_0x6cbaab[_0xa382('0x38')]['sort']);delete _0x6cbaab[_0xa382('0x38')][_0xa382('0x40')];_0x3c6249['where']=qs[_0xa382('0x36')](_[_0xa382('0x41')](_0x6cbaab[_0xa382('0x38')],_0x1d48fa[_0xa382('0x36')]),_0x11aef0);if(_0x6cbaab['query'][_0xa382('0x42')]){_0x3c6249[_0xa382('0x43')]=_[_0xa382('0x44')](_0x3c6249[_0xa382('0x43')],{'$or':_[_0xa382('0x2f')](_0x11aef0,function(_0x2af882){if(_0x2af882[_0xa382('0x32')]!==_0xa382('0x45')){var _0x1750b9={};_0x1750b9[_0x2af882[_0xa382('0x2d')]]={'$like':'%'+_0x6cbaab[_0xa382('0x38')][_0xa382('0x42')]+'%'};return _0x1750b9;}})});}_0x3c6249=_['merge']({},_0x3c6249,_0x6cbaab['options']);var _0x28ef32={'where':_0x3c6249[_0xa382('0x43')]};return db[_0xa382('0x30')][_0xa382('0x20')](_0x28ef32)['then'](function(_0x4e9fe9){_0x49743f[_0xa382('0x20')]=_0x4e9fe9;if(_0x6cbaab[_0xa382('0x38')][_0xa382('0x46')]){_0x3c6249[_0xa382('0x47')]=[{'all':!![]}];}return db[_0xa382('0x30')][_0xa382('0x48')](_0x3c6249);})[_0xa382('0x25')](function(_0x532d91){_0x49743f[_0xa382('0x49')]=_0x532d91;return _0x49743f;})[_0xa382('0x25')](respondWithFilteredResult(_0x55561e,_0x3c6249))[_0xa382('0x4a')](handleError(_0x55561e,null));};exports[_0xa382('0x4b')]=function(_0x14e325,_0x55e74e){var _0x80721c={'raw':![],'where':{'id':_0x14e325[_0xa382('0x4c')]['id']}},_0x3e8771={};_0x3e8771[_0xa382('0x34')]=_[_0xa382('0x35')](db[_0xa382('0x30')][_0xa382('0x4d')]);_0x3e8771[_0xa382('0x38')]=_[_0xa382('0x35')](_0x14e325[_0xa382('0x38')]);_0x3e8771[_0xa382('0x36')]=_[_0xa382('0x37')](_0x3e8771[_0xa382('0x34')],_0x3e8771[_0xa382('0x38')]);_0x80721c[_0xa382('0x3a')]=_['intersection'](_0x3e8771[_0xa382('0x34')],qs[_0xa382('0x39')](_0x14e325[_0xa382('0x38')][_0xa382('0x39')]));_0x80721c[_0xa382('0x3a')]=_0x80721c[_0xa382('0x3a')][_0xa382('0x3b')]?_0x80721c['attributes']:_0x3e8771[_0xa382('0x34')];if(_0x14e325[_0xa382('0x38')][_0xa382('0x46')]){_0x80721c['include']=[{'all':!![]}];}_0x80721c=_[_0xa382('0x44')]({},_0x80721c,_0x14e325['options']);return db[_0xa382('0x30')][_0xa382('0x4e')](_0x80721c)[_0xa382('0x25')](handleEntityNotFound(_0x55e74e,null))[_0xa382('0x25')](respondWithResult(_0x55e74e,null))['catch'](handleError(_0x55e74e,null));};exports[_0xa382('0x24')]=function(_0x1fb84c,_0x8b97d5){if(_0x1fb84c['body']['id']){delete _0x1fb84c[_0xa382('0x4f')]['id'];}return db[_0xa382('0x30')][_0xa382('0x4e')]({'where':{'id':_0x1fb84c[_0xa382('0x4c')]['id']}})['then'](handleEntityNotFound(_0x8b97d5,null))['then'](saveUpdates(_0x1fb84c['body'],null))[_0xa382('0x25')](respondWithResult(_0x8b97d5,null))['catch'](handleError(_0x8b97d5,null));};exports['create']=function(_0x55da4c,_0x20c71b,_0x368ec1){return db[_0xa382('0x50')][_0xa382('0x51')](function(_0x1b82db){if(_0x55da4c[_0xa382('0x4f')]['mode']===_0xa382('0x52')){_0x55da4c[_0xa382('0x4f')][_0xa382('0x53')]=path[_0xa382('0x54')](config[_0xa382('0x55')],'server/files/moh',_0x55da4c[_0xa382('0x4f')]['name']);}return db[_0xa382('0x30')]['create'](_0x55da4c[_0xa382('0x4f')],{'transaction':_0x1b82db})[_0xa382('0x25')](function(_0x1f82d9){if(_0x55da4c[_0xa382('0x4f')][_0xa382('0x56')]===_0xa382('0x52')){fs[_0xa382('0x57')](_0x1f82d9['directory'],parseInt(_0xa382('0x58'),0x8));}var _0x340a8c=_0x55da4c[_0xa382('0x59')]['get']({'plain':!![]});if(!_0x340a8c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x340a8c[_0xa382('0x5a')]===_0xa382('0x59')){var _0x4f9c65=_0x1f82d9[_0xa382('0x27')]({'plain':!![]});return db[_0xa382('0x5b')]['find']({'where':{'name':_0xa382('0x28'),'userProfileId':_0x340a8c[_0xa382('0x5c')]},'raw':!![]})[_0xa382('0x25')](function(_0x20cc00){if(_0x20cc00&&_0x20cc00[_0xa382('0x5d')]===0x0){return db[_0xa382('0x29')][_0xa382('0x5e')]({'name':_0x4f9c65[_0xa382('0x2d')],'resourceId':_0x4f9c65['id'],'type':_0x20cc00[_0xa382('0x2d')],'sectionId':_0x20cc00['id']},{})[_0xa382('0x25')](function(){return _0x1f82d9;});}else{return _0x1f82d9;}})[_0xa382('0x4a')](function(_0x47b452){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x47b452);});}return _0x1f82d9;});})[_0xa382('0x25')](respondWithResult(_0x20c71b,0xc9))[_0xa382('0x4a')](handleError(_0x20c71b,null));};exports[_0xa382('0x26')]=function(_0x587e0b,_0x2c0377,_0x29403c){var _0x449051;return db['VoiceMusicOnHold'][_0xa382('0x4e')]({'where':{'id':_0x587e0b['params']['id']}})[_0xa382('0x25')](function(_0x15ef1d){if(_0x15ef1d){return db['sequelize'][_0xa382('0x51')](function(_0x87f53f){return _0x15ef1d[_0xa382('0x26')]({'transaction':_0x87f53f,'raw':!![]})[_0xa382('0x25')](function(_0xd34763){if(_0xd34763[_0xa382('0x53')]){fs['readdirSync'](_0xd34763[_0xa382('0x53')])['forEach'](function(_0x545b87){fs[_0xa382('0x5f')](path[_0xa382('0x54')](_0xd34763[_0xa382('0x53')],_0x545b87));});fs[_0xa382('0x60')](_0xd34763[_0xa382('0x53')]);}return _0xd34763;});})[_0xa382('0x4a')](function(_0x2071e5){throw new db[(_0xa382('0x61'))][(_0xa382('0x62'))](_0x2071e5[_0xa382('0x63')]);});}})[_0xa382('0x25')](handleEntityNotFound(_0x2c0377,null))['then'](removeEntity(_0x2c0377,null))[_0xa382('0x4a')](handleError(_0x2c0377,null));};exports[_0xa382('0x64')]=function(_0x363639,_0x811018,_0x58283a){return db[_0xa382('0x50')]['transaction'](function(_0x50a75d){var _0x5afeaf;return db[_0xa382('0x30')][_0xa382('0x4e')]({'where':{'id':_0x363639[_0xa382('0x4c')]['id']}})[_0xa382('0x25')](function(_0x5147d1){if(_0x5147d1){_0x5afeaf=_0x5147d1;return _0x5147d1['addSound'](_0x363639['body']['id'],{'transaction':_0x50a75d});}})[_0xa382('0x25')](function(_0x3fe88b){if(_0x3fe88b){return db[_0xa382('0x65')][_0xa382('0x66')]({'where':{'id':_0x363639[_0xa382('0x4f')]['id']},'attributes':['id','name',_0xa382('0x67'),'converted_format',_0xa382('0x68')],'raw':!![]});}})[_0xa382('0x25')](function(_0x1b8590){if(_0x1b8590){var _0x358415=path[_0xa382('0x54')](config[_0xa382('0x55')],_0xa382('0x69'),util[_0xa382('0x6a')](_0xa382('0x6b'),path['basename'](_0x1b8590[_0xa382('0x67')],path['extname'](_0x1b8590[_0xa382('0x67')])),_0x1b8590[_0xa382('0x6c')]));var _0xd34a92=path['join'](config[_0xa382('0x55')],_0xa382('0x6d'),_0x5afeaf[_0xa382('0x2d')],util['format'](_0xa382('0x6b'),_0x1b8590[_0xa382('0x2d')],_0x1b8590[_0xa382('0x6c')]));fs[_0xa382('0x6e')](_0x358415,_0xd34a92);return _0x1b8590;}})[_0xa382('0x4a')](function(_0x110263){throw new db[(_0xa382('0x61'))][(_0xa382('0x62'))](_0x110263[_0xa382('0x63')]);});})[_0xa382('0x25')](handleEntityNotFound(_0x811018,null))[_0xa382('0x25')](respondWithResult(_0x811018,0xc9))[_0xa382('0x4a')](handleError(_0x811018,null));};exports[_0xa382('0x6f')]=function(_0x5e597e,_0xd79282,_0x485769){return db[_0xa382('0x50')]['transaction'](function(_0x12200e){var _0x5ab5f1;return db[_0xa382('0x30')][_0xa382('0x66')]({'where':{'id':_0x5e597e[_0xa382('0x4c')]['id']}})['then'](handleEntityNotFound(_0xd79282,null))['then'](function(_0x3ef18c){if(_0x3ef18c){_0x5ab5f1=_0x3ef18c;return _0x3ef18c['removeSound'](_0x5e597e['params'][_0xa382('0x70')]);}})[_0xa382('0x25')](function(_0x41af14){if(_0x41af14){return db[_0xa382('0x65')][_0xa382('0x66')]({'where':{'id':_0x5e597e[_0xa382('0x4c')][_0xa382('0x70')]},'attributes':['id',_0xa382('0x2d'),_0xa382('0x67'),_0xa382('0x6c'),_0xa382('0x68')],'raw':!![]});}})[_0xa382('0x25')](function(_0x1ccdd5){if(_0x1ccdd5){fs['unlinkSync'](path[_0xa382('0x54')](_0x5ab5f1[_0xa382('0x53')],util[_0xa382('0x6a')](_0xa382('0x6b'),_0x1ccdd5['name'],_0x1ccdd5[_0xa382('0x6c')])));return _0x1ccdd5;}})[_0xa382('0x4a')](function(_0x501bd3){throw new db[(_0xa382('0x61'))][(_0xa382('0x62'))](_0x501bd3[_0xa382('0x63')]);});})[_0xa382('0x25')](handleEntityNotFound(_0xd79282,null))[_0xa382('0x25')](respondWithStatusCode(_0xd79282,0xcc))[_0xa382('0x4a')](handleError(_0xd79282,null));};exports[_0xa382('0x71')]=function(_0x15fd7a,_0x283101,_0xb490d5){var _0x5c76fb={};var _0x154970={};var _0x3a8eb8;var _0x5e875e;return db[_0xa382('0x30')][_0xa382('0x66')]({'where':{'id':_0x15fd7a[_0xa382('0x4c')]['id']}})[_0xa382('0x25')](handleEntityNotFound(_0x283101,null))[_0xa382('0x25')](function(_0x539ffb){if(_0x539ffb){_0x3a8eb8=_0x539ffb;_0x154970['model']=_[_0xa382('0x35')](db[_0xa382('0x65')][_0xa382('0x4d')]);_0x154970[_0xa382('0x38')]=_[_0xa382('0x35')](_0x15fd7a[_0xa382('0x38')]);_0x154970['filters']=_['intersection'](_0x154970[_0xa382('0x34')],_0x154970[_0xa382('0x38')]);_0x5c76fb[_0xa382('0x3a')]=_[_0xa382('0x37')](_0x154970['model'],qs['fields'](_0x15fd7a[_0xa382('0x38')][_0xa382('0x39')]));_0x5c76fb['attributes']=_0x5c76fb[_0xa382('0x3a')][_0xa382('0x3b')]?_0x5c76fb[_0xa382('0x3a')]:_0x154970['model'];_0x5c76fb[_0xa382('0x3f')]=qs[_0xa382('0x40')](_0x15fd7a[_0xa382('0x38')][_0xa382('0x40')]);_0x5c76fb[_0xa382('0x43')]=qs[_0xa382('0x36')](_['pick'](_0x15fd7a[_0xa382('0x38')],_0x154970[_0xa382('0x36')]));if(_0x15fd7a[_0xa382('0x38')][_0xa382('0x42')]){_0x5c76fb['where']=_['merge'](_0x5c76fb[_0xa382('0x43')],{'$or':_[_0xa382('0x2f')](_0x5c76fb[_0xa382('0x3a')],function(_0x21bab4){var _0x1abfc3={};_0x1abfc3[_0x21bab4]={'$like':'%'+_0x15fd7a['query'][_0xa382('0x42')]+'%'};return _0x1abfc3;})});}_0x5c76fb=_['merge']({},_0x5c76fb,_0x15fd7a[_0xa382('0x72')]);return _0x3a8eb8[_0xa382('0x71')](_0x5c76fb);}})[_0xa382('0x25')](function(_0x5217d0){if(_0x5217d0){_0x5e875e=_0x5217d0['length'];if(!_0x15fd7a[_0xa382('0x38')]['hasOwnProperty'](_0xa382('0x3d'))){_0x5c76fb[_0xa382('0x1f')]=qs[_0xa382('0x1f')](_0x15fd7a['query'][_0xa382('0x1f')]);_0x5c76fb[_0xa382('0x3e')]=qs['offset'](_0x15fd7a[_0xa382('0x38')][_0xa382('0x3e')]);}return _0x3a8eb8['getSounds'](_0x5c76fb);}})['then'](function(_0x22b9d0){if(_0x22b9d0){return _0x22b9d0?{'count':_0x5e875e,'rows':_0x22b9d0}:null;}})[_0xa382('0x25')](respondWithResult(_0x283101,null))['catch'](handleError(_0x283101,null));}; \ No newline at end of file +var _0xb286=['addSound','Sound','findOne','save_name','createdAt','server/files/sounds/converted','format','%s.%s','extname','converted_format','symlinkSync','ValidationError','removeSound','id2','getSounds','pick','nolimit','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','get','UserProfileResource','destroy','then','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','key','query','filters','intersection','model','fields','length','attributes','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','body','params','create','sequelize','transaction','files','join','root','server/files/moh','mode','mkdirSync','directory','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MusicOnHolds','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','unlinkSync','rmdirSync','Sequelize','message'];(function(_0x56fbb6,_0x385dbb){var _0x200655=function(_0x4159a9){while(--_0x4159a9){_0x56fbb6['push'](_0x56fbb6['shift']());}};_0x200655(++_0x385dbb);}(_0xb286,0x105));var _0x6b28=function(_0x50973d,_0x3c0764){_0x50973d=_0x50973d-0x0;var _0x328618=_0xb286[_0x50973d];return _0x328618;};'use strict';var emlformat=require(_0x6b28('0x0'));var rimraf=require(_0x6b28('0x1'));var zipdir=require(_0x6b28('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6b28('0x3'));var moment=require(_0x6b28('0x4'));var BPromise=require(_0x6b28('0x5'));var Mustache=require(_0x6b28('0x6'));var util=require(_0x6b28('0x7'));var path=require(_0x6b28('0x8'));var sox=require(_0x6b28('0x9'));var csv=require('to-csv');var ejs=require(_0x6b28('0xa'));var fs=require('fs');var fs_extra=require(_0x6b28('0xb'));var _=require(_0x6b28('0xc'));var squel=require(_0x6b28('0xd'));var crypto=require('crypto');var jsforce=require(_0x6b28('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6b28('0xf'));var querystring=require(_0x6b28('0x10'));var Papa=require(_0x6b28('0x11'));var Redis=require(_0x6b28('0x12'));var authService=require(_0x6b28('0x13'));var qs=require(_0x6b28('0x14'));var as=require(_0x6b28('0x15'));var hardwareService=require(_0x6b28('0x16'));var logger=require(_0x6b28('0x17'))(_0x6b28('0x18'));var utils=require(_0x6b28('0x19'));var config=require(_0x6b28('0x1a'));var licenseUtil=require(_0x6b28('0x1b'));var db=require(_0x6b28('0x1c'))['db'];function respondWithStatusCode(_0x3d892c,_0x3176ce){_0x3176ce=_0x3176ce||0xcc;return function(_0x444ce1){if(_0x444ce1){return _0x3d892c[_0x6b28('0x1d')](_0x3176ce);}return _0x3d892c[_0x6b28('0x1e')](_0x3176ce)[_0x6b28('0x1f')]();};}function respondWithResult(_0x55ed91,_0x88a880){_0x88a880=_0x88a880||0xc8;return function(_0xbea9a7){if(_0xbea9a7){return _0x55ed91[_0x6b28('0x1e')](_0x88a880)[_0x6b28('0x20')](_0xbea9a7);}};}function respondWithFilteredResult(_0x3f7ce2,_0x4fad63){return function(_0x5adbc5){if(_0x5adbc5){var _0x480fa9=typeof _0x4fad63[_0x6b28('0x21')]===_0x6b28('0x22')&&typeof _0x4fad63[_0x6b28('0x23')]===_0x6b28('0x22');var _0x31fb3f=_0x5adbc5[_0x6b28('0x24')];var _0x36a74d=_0x480fa9?0x0:_0x4fad63['offset'];var _0x3aa824=_0x480fa9?_0x5adbc5['count']:_0x4fad63[_0x6b28('0x21')]+_0x4fad63[_0x6b28('0x23')];var _0x329077;if(_0x3aa824>=_0x31fb3f){_0x3aa824=_0x31fb3f;_0x329077=0xc8;}else{_0x329077=0xce;}_0x3f7ce2[_0x6b28('0x1e')](_0x329077);return _0x3f7ce2[_0x6b28('0x25')](_0x6b28('0x26'),_0x36a74d+'-'+_0x3aa824+'/'+_0x31fb3f)[_0x6b28('0x20')](_0x5adbc5);}return null;};}function patchUpdates(_0x36dcf4){return function(_0x21dd4e){try{jsonpatch[_0x6b28('0x27')](_0x21dd4e,_0x36dcf4,!![]);}catch(_0x38174e){return BPromise[_0x6b28('0x28')](_0x38174e);}return _0x21dd4e['save']();};}function saveUpdates(_0x3589fd,_0x527a24){return function(_0x592296){if(_0x592296){return _0x592296[_0x6b28('0x29')](_0x3589fd)['then'](function(_0x7cc32){return _0x7cc32;});}return null;};}function removeEntity(_0x50e1a3,_0x56d38b){return function(_0x1a7a5f){if(_0x1a7a5f){return _0x1a7a5f['destroy']()['then'](function(){var _0x2d2d17=_0x1a7a5f[_0x6b28('0x2a')]({'plain':!![]});var _0x51bc04='MusicOnHolds';return db[_0x6b28('0x2b')][_0x6b28('0x2c')]({'where':{'type':_0x51bc04,'resourceId':_0x2d2d17['id']}})[_0x6b28('0x2d')](function(){return _0x1a7a5f;});})['then'](function(){_0x50e1a3[_0x6b28('0x1e')](0xcc)[_0x6b28('0x1f')]();});}};}function handleEntityNotFound(_0x52c656,_0x34da24){return function(_0x2edfa3){if(!_0x2edfa3){_0x52c656[_0x6b28('0x1d')](0x194);}return _0x2edfa3;};}function handleError(_0x3063bc,_0x28241d){_0x28241d=_0x28241d||0x1f4;return function(_0x43491a){logger[_0x6b28('0x2e')](_0x43491a[_0x6b28('0x2f')]);if(_0x43491a[_0x6b28('0x30')]){delete _0x43491a[_0x6b28('0x30')];}_0x3063bc[_0x6b28('0x1e')](_0x28241d)[_0x6b28('0x31')](_0x43491a);};}exports[_0x6b28('0x32')]=function(_0x29418d,_0x1bfae7){var _0x553b01={},_0x1d01ff={},_0x3e7f5e={'count':0x0,'rows':[]};var _0x4b5dea=_[_0x6b28('0x33')](db[_0x6b28('0x34')][_0x6b28('0x35')],function(_0x36d061){return{'name':_0x36d061[_0x6b28('0x36')],'type':_0x36d061['type'][_0x6b28('0x37')]};});_0x1d01ff['model']=_['map'](_0x4b5dea,_0x6b28('0x30'));_0x1d01ff[_0x6b28('0x38')]=_['keys'](_0x29418d[_0x6b28('0x38')]);_0x1d01ff[_0x6b28('0x39')]=_[_0x6b28('0x3a')](_0x1d01ff['model'],_0x1d01ff[_0x6b28('0x38')]);_0x553b01['attributes']=_[_0x6b28('0x3a')](_0x1d01ff[_0x6b28('0x3b')],qs[_0x6b28('0x3c')](_0x29418d[_0x6b28('0x38')][_0x6b28('0x3c')]));_0x553b01['attributes']=_0x553b01['attributes'][_0x6b28('0x3d')]?_0x553b01[_0x6b28('0x3e')]:_0x1d01ff[_0x6b28('0x3b')];if(!_0x29418d[_0x6b28('0x38')][_0x6b28('0x3f')]('nolimit')){_0x553b01['limit']=qs[_0x6b28('0x23')](_0x29418d['query']['limit']);_0x553b01[_0x6b28('0x21')]=qs[_0x6b28('0x21')](_0x29418d[_0x6b28('0x38')][_0x6b28('0x21')]);}_0x553b01[_0x6b28('0x40')]=qs[_0x6b28('0x41')](_0x29418d[_0x6b28('0x38')][_0x6b28('0x41')]);delete _0x29418d[_0x6b28('0x38')][_0x6b28('0x41')];_0x553b01[_0x6b28('0x42')]=qs[_0x6b28('0x39')](_['pick'](_0x29418d[_0x6b28('0x38')],_0x1d01ff[_0x6b28('0x39')]),_0x4b5dea);if(_0x29418d[_0x6b28('0x38')][_0x6b28('0x43')]){_0x553b01[_0x6b28('0x42')]=_[_0x6b28('0x44')](_0x553b01[_0x6b28('0x42')],{'$or':_[_0x6b28('0x33')](_0x4b5dea,function(_0x343153){if(_0x343153['type']!==_0x6b28('0x45')){var _0x930d61={};_0x930d61[_0x343153[_0x6b28('0x30')]]={'$like':'%'+_0x29418d[_0x6b28('0x38')][_0x6b28('0x43')]+'%'};return _0x930d61;}})});}_0x553b01=_[_0x6b28('0x44')]({},_0x553b01,_0x29418d[_0x6b28('0x46')]);var _0x551a3c={'where':_0x553b01[_0x6b28('0x42')]};return db[_0x6b28('0x34')][_0x6b28('0x24')](_0x551a3c)['then'](function(_0x229c56){_0x3e7f5e[_0x6b28('0x24')]=_0x229c56;if(_0x29418d['query'][_0x6b28('0x47')]){_0x553b01[_0x6b28('0x48')]=[{'all':!![]}];}return db[_0x6b28('0x34')][_0x6b28('0x49')](_0x553b01);})[_0x6b28('0x2d')](function(_0x537360){_0x3e7f5e[_0x6b28('0x4a')]=_0x537360;return _0x3e7f5e;})[_0x6b28('0x2d')](respondWithFilteredResult(_0x1bfae7,_0x553b01))[_0x6b28('0x4b')](handleError(_0x1bfae7,null));};exports[_0x6b28('0x4c')]=function(_0x56cf2f,_0x48cba0){var _0x5ec4b8={'raw':![],'where':{'id':_0x56cf2f['params']['id']}},_0x4d1ac5={};_0x4d1ac5['model']=_[_0x6b28('0x4d')](db['VoiceMusicOnHold'][_0x6b28('0x35')]);_0x4d1ac5[_0x6b28('0x38')]=_[_0x6b28('0x4d')](_0x56cf2f[_0x6b28('0x38')]);_0x4d1ac5['filters']=_[_0x6b28('0x3a')](_0x4d1ac5[_0x6b28('0x3b')],_0x4d1ac5[_0x6b28('0x38')]);_0x5ec4b8[_0x6b28('0x3e')]=_[_0x6b28('0x3a')](_0x4d1ac5[_0x6b28('0x3b')],qs[_0x6b28('0x3c')](_0x56cf2f[_0x6b28('0x38')][_0x6b28('0x3c')]));_0x5ec4b8['attributes']=_0x5ec4b8['attributes'][_0x6b28('0x3d')]?_0x5ec4b8[_0x6b28('0x3e')]:_0x4d1ac5[_0x6b28('0x3b')];if(_0x56cf2f['query'][_0x6b28('0x47')]){_0x5ec4b8[_0x6b28('0x48')]=[{'all':!![]}];}_0x5ec4b8=_['merge']({},_0x5ec4b8,_0x56cf2f[_0x6b28('0x46')]);return db[_0x6b28('0x34')][_0x6b28('0x4e')](_0x5ec4b8)[_0x6b28('0x2d')](handleEntityNotFound(_0x48cba0,null))[_0x6b28('0x2d')](respondWithResult(_0x48cba0,null))[_0x6b28('0x4b')](handleError(_0x48cba0,null));};exports['update']=function(_0x3c4c39,_0x12da35){if(_0x3c4c39['body']['id']){delete _0x3c4c39[_0x6b28('0x4f')]['id'];}return db[_0x6b28('0x34')][_0x6b28('0x4e')]({'where':{'id':_0x3c4c39[_0x6b28('0x50')]['id']}})[_0x6b28('0x2d')](handleEntityNotFound(_0x12da35,null))[_0x6b28('0x2d')](saveUpdates(_0x3c4c39['body'],null))['then'](respondWithResult(_0x12da35,null))['catch'](handleError(_0x12da35,null));};exports[_0x6b28('0x51')]=function(_0x51b239,_0x4b8079,_0x5560aa){return db[_0x6b28('0x52')][_0x6b28('0x53')](function(_0x3ad4a3){if(_0x51b239[_0x6b28('0x4f')]['mode']===_0x6b28('0x54')){_0x51b239['body']['directory']=path[_0x6b28('0x55')](config[_0x6b28('0x56')],_0x6b28('0x57'),_0x51b239['body']['name']);}return db[_0x6b28('0x34')][_0x6b28('0x51')](_0x51b239['body'],{'transaction':_0x3ad4a3})[_0x6b28('0x2d')](function(_0x3c18eb){if(_0x51b239[_0x6b28('0x4f')][_0x6b28('0x58')]===_0x6b28('0x54')){fs[_0x6b28('0x59')](_0x3c18eb[_0x6b28('0x5a')],parseInt(_0x6b28('0x5b'),0x8));}var _0x215ad8=_0x51b239[_0x6b28('0x5c')][_0x6b28('0x2a')]({'plain':!![]});if(!_0x215ad8)throw new Error(_0x6b28('0x5d'));if(_0x215ad8[_0x6b28('0x5e')]===_0x6b28('0x5c')){var _0xc6b56b=_0x3c18eb[_0x6b28('0x2a')]({'plain':!![]});return db[_0x6b28('0x5f')][_0x6b28('0x4e')]({'where':{'name':_0x6b28('0x60'),'userProfileId':_0x215ad8[_0x6b28('0x61')]},'raw':!![]})['then'](function(_0x150299){if(_0x150299&&_0x150299[_0x6b28('0x62')]===0x0){return db['UserProfileResource'][_0x6b28('0x51')]({'name':_0xc6b56b[_0x6b28('0x30')],'resourceId':_0xc6b56b['id'],'type':_0x150299[_0x6b28('0x30')],'sectionId':_0x150299['id']},{})[_0x6b28('0x2d')](function(){return _0x3c18eb;});}else{return _0x3c18eb;}})[_0x6b28('0x4b')](function(_0x4ae533){logger[_0x6b28('0x2e')](_0x6b28('0x63'),_0x4ae533);});}return _0x3c18eb;});})[_0x6b28('0x2d')](respondWithResult(_0x4b8079,0xc9))[_0x6b28('0x4b')](handleError(_0x4b8079,null));};exports[_0x6b28('0x2c')]=function(_0x41afa2,_0x1b8575,_0x5b2e33){var _0x3efa7f;return db[_0x6b28('0x34')]['find']({'where':{'id':_0x41afa2[_0x6b28('0x50')]['id']}})['then'](function(_0x1703d7){if(_0x1703d7){return db['sequelize'][_0x6b28('0x53')](function(_0x3d6ac5){return _0x1703d7[_0x6b28('0x2c')]({'transaction':_0x3d6ac5,'raw':!![]})[_0x6b28('0x2d')](function(_0x537894){if(_0x537894['directory']){fs[_0x6b28('0x64')](_0x537894[_0x6b28('0x5a')])['forEach'](function(_0x4175d3){fs[_0x6b28('0x65')](path[_0x6b28('0x55')](_0x537894[_0x6b28('0x5a')],_0x4175d3));});fs[_0x6b28('0x66')](_0x537894[_0x6b28('0x5a')]);}return _0x537894;});})[_0x6b28('0x4b')](function(_0xac5f16){throw new db[(_0x6b28('0x67'))]['ValidationError'](_0xac5f16[_0x6b28('0x68')]);});}})[_0x6b28('0x2d')](handleEntityNotFound(_0x1b8575,null))[_0x6b28('0x2d')](removeEntity(_0x1b8575,null))[_0x6b28('0x4b')](handleError(_0x1b8575,null));};exports['addSound']=function(_0x29bcbc,_0x817d13,_0x63af87){return db[_0x6b28('0x52')][_0x6b28('0x53')](function(_0x5bf50d){var _0x2fdfbb;return db['VoiceMusicOnHold'][_0x6b28('0x4e')]({'where':{'id':_0x29bcbc[_0x6b28('0x50')]['id']}})[_0x6b28('0x2d')](function(_0x22d9f5){if(_0x22d9f5){_0x2fdfbb=_0x22d9f5;return _0x22d9f5[_0x6b28('0x69')](_0x29bcbc['body']['id'],{'transaction':_0x5bf50d});}})[_0x6b28('0x2d')](function(_0x23b2e0){if(_0x23b2e0){return db[_0x6b28('0x6a')][_0x6b28('0x6b')]({'where':{'id':_0x29bcbc[_0x6b28('0x4f')]['id']},'attributes':['id','name',_0x6b28('0x6c'),'converted_format',_0x6b28('0x6d')],'raw':!![]});}})['then'](function(_0x5eafb3){if(_0x5eafb3){var _0x5f2eb1=path[_0x6b28('0x55')](config[_0x6b28('0x56')],_0x6b28('0x6e'),util[_0x6b28('0x6f')](_0x6b28('0x70'),path['basename'](_0x5eafb3[_0x6b28('0x6c')],path[_0x6b28('0x71')](_0x5eafb3[_0x6b28('0x6c')])),_0x5eafb3[_0x6b28('0x72')]));var _0xad0418=path[_0x6b28('0x55')](config['root'],_0x6b28('0x57'),_0x2fdfbb[_0x6b28('0x30')],util[_0x6b28('0x6f')](_0x6b28('0x70'),_0x5eafb3[_0x6b28('0x30')],_0x5eafb3[_0x6b28('0x72')]));fs[_0x6b28('0x73')](_0x5f2eb1,_0xad0418);return _0x5eafb3;}})[_0x6b28('0x4b')](function(_0x1c09df){throw new db['Sequelize'][(_0x6b28('0x74'))](_0x1c09df[_0x6b28('0x68')]);});})['then'](handleEntityNotFound(_0x817d13,null))[_0x6b28('0x2d')](respondWithResult(_0x817d13,0xc9))[_0x6b28('0x4b')](handleError(_0x817d13,null));};exports['removeSound']=function(_0x36d574,_0xe5e6b6,_0x50d9f4){return db[_0x6b28('0x52')][_0x6b28('0x53')](function(_0x3bcc08){var _0xa6bf5a;return db[_0x6b28('0x34')][_0x6b28('0x6b')]({'where':{'id':_0x36d574[_0x6b28('0x50')]['id']}})[_0x6b28('0x2d')](handleEntityNotFound(_0xe5e6b6,null))[_0x6b28('0x2d')](function(_0x690f77){if(_0x690f77){_0xa6bf5a=_0x690f77;return _0x690f77[_0x6b28('0x75')](_0x36d574[_0x6b28('0x50')]['id2']);}})[_0x6b28('0x2d')](function(_0x2f6f4b){if(_0x2f6f4b){return db[_0x6b28('0x6a')]['findOne']({'where':{'id':_0x36d574[_0x6b28('0x50')][_0x6b28('0x76')]},'attributes':['id',_0x6b28('0x30'),_0x6b28('0x6c'),_0x6b28('0x72'),_0x6b28('0x6d')],'raw':!![]});}})[_0x6b28('0x2d')](function(_0x4abad2){if(_0x4abad2){fs['unlinkSync'](path[_0x6b28('0x55')](_0xa6bf5a['directory'],util[_0x6b28('0x6f')](_0x6b28('0x70'),_0x4abad2['name'],_0x4abad2[_0x6b28('0x72')])));return _0x4abad2;}})[_0x6b28('0x4b')](function(_0x5758f0){throw new db[(_0x6b28('0x67'))]['ValidationError'](_0x5758f0[_0x6b28('0x68')]);});})[_0x6b28('0x2d')](handleEntityNotFound(_0xe5e6b6,null))['then'](respondWithStatusCode(_0xe5e6b6,0xcc))[_0x6b28('0x4b')](handleError(_0xe5e6b6,null));};exports[_0x6b28('0x77')]=function(_0x15d581,_0x48987c,_0x27636c){var _0x5c47e1={};var _0x577b0d={};var _0x1b1231;var _0x57194b;return db[_0x6b28('0x34')][_0x6b28('0x6b')]({'where':{'id':_0x15d581[_0x6b28('0x50')]['id']}})[_0x6b28('0x2d')](handleEntityNotFound(_0x48987c,null))['then'](function(_0x25c51f){if(_0x25c51f){_0x1b1231=_0x25c51f;_0x577b0d['model']=_[_0x6b28('0x4d')](db[_0x6b28('0x6a')][_0x6b28('0x35')]);_0x577b0d[_0x6b28('0x38')]=_[_0x6b28('0x4d')](_0x15d581[_0x6b28('0x38')]);_0x577b0d[_0x6b28('0x39')]=_['intersection'](_0x577b0d[_0x6b28('0x3b')],_0x577b0d[_0x6b28('0x38')]);_0x5c47e1['attributes']=_[_0x6b28('0x3a')](_0x577b0d[_0x6b28('0x3b')],qs['fields'](_0x15d581[_0x6b28('0x38')][_0x6b28('0x3c')]));_0x5c47e1['attributes']=_0x5c47e1[_0x6b28('0x3e')][_0x6b28('0x3d')]?_0x5c47e1['attributes']:_0x577b0d[_0x6b28('0x3b')];_0x5c47e1[_0x6b28('0x40')]=qs[_0x6b28('0x41')](_0x15d581[_0x6b28('0x38')][_0x6b28('0x41')]);_0x5c47e1[_0x6b28('0x42')]=qs[_0x6b28('0x39')](_[_0x6b28('0x78')](_0x15d581['query'],_0x577b0d[_0x6b28('0x39')]));if(_0x15d581['query'][_0x6b28('0x43')]){_0x5c47e1['where']=_[_0x6b28('0x44')](_0x5c47e1['where'],{'$or':_['map'](_0x5c47e1['attributes'],function(_0x491233){var _0x5cc114={};_0x5cc114[_0x491233]={'$like':'%'+_0x15d581[_0x6b28('0x38')][_0x6b28('0x43')]+'%'};return _0x5cc114;})});}_0x5c47e1=_[_0x6b28('0x44')]({},_0x5c47e1,_0x15d581[_0x6b28('0x46')]);return _0x1b1231[_0x6b28('0x77')](_0x5c47e1);}})[_0x6b28('0x2d')](function(_0x6efef4){if(_0x6efef4){_0x57194b=_0x6efef4[_0x6b28('0x3d')];if(!_0x15d581[_0x6b28('0x38')][_0x6b28('0x3f')](_0x6b28('0x79'))){_0x5c47e1[_0x6b28('0x23')]=qs[_0x6b28('0x23')](_0x15d581[_0x6b28('0x38')][_0x6b28('0x23')]);_0x5c47e1['offset']=qs[_0x6b28('0x21')](_0x15d581['query'][_0x6b28('0x21')]);}return _0x1b1231[_0x6b28('0x77')](_0x5c47e1);}})[_0x6b28('0x2d')](function(_0x156c79){if(_0x156c79){return _0x156c79?{'count':_0x57194b,'rows':_0x156c79}:null;}})[_0x6b28('0x2d')](respondWithResult(_0x48987c,null))[_0x6b28('0x4b')](handleError(_0x48987c,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 5f9da70..3b1fc77 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 _0xe26b=['lodash','../../config/logger','api','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold'];(function(_0x406b98,_0x5e21bb){var _0x5c2247=function(_0x3cbcb2){while(--_0x3cbcb2){_0x406b98['push'](_0x406b98['shift']());}};_0x5c2247(++_0x5e21bb);}(_0xe26b,0x197));var _0xbe26=function(_0x55bb77,_0x182e95){_0x55bb77=_0x55bb77-0x0;var _0x1510f8=_0xe26b[_0x55bb77];return _0x1510f8;};'use strict';var _=require(_0xbe26('0x0'));var util=require('util');var logger=require(_0xbe26('0x1'))(_0xbe26('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe26('0x3'));var rimraf=require(_0xbe26('0x4'));var config=require(_0xbe26('0x5'));var attributes=require(_0xbe26('0x6'));module[_0xbe26('0x7')]=function(_0x55c5cb,_0x349ac6){return _0x55c5cb[_0xbe26('0x8')](_0xbe26('0x9'),attributes,{'tableName':_0xbe26('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbfaf=['voice_musiconhold','lodash','moment','request-promise','rimraf','../../config/environment','exports'];(function(_0x2dfabd,_0x1374db){var _0x437cdc=function(_0x2c429e){while(--_0x2c429e){_0x2dfabd['push'](_0x2dfabd['shift']());}};_0x437cdc(++_0x1374db);}(_0xbfaf,0x1d6));var _0xfbfa=function(_0x309d93,_0x157662){_0x309d93=_0x309d93-0x0;var _0x2dd61d=_0xbfaf[_0x309d93];return _0x2dd61d;};'use strict';var _=require(_0xfbfa('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xfbfa('0x1'));var BPromise=require('bluebird');var rp=require(_0xfbfa('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfbfa('0x3'));var config=require(_0xfbfa('0x4'));var attributes=require('./voiceMusicOnHold.attributes');module[_0xfbfa('0x5')]=function(_0x3dedfb,_0x3b8d97){return _0x3dedfb['define']('VoiceMusicOnHold',attributes,{'tableName':_0xfbfa('0x6'),'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 a0ba0c8..7e8b366 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3a6308,_0x259b99){var _0x423c0d=function(_0x5f3d7b){while(--_0x5f3d7b){_0x3a6308['push'](_0x3a6308['shift']());}};_0x423c0d(++_0x259b99);}(_0xe706,0xa3));var _0x6e70=function(_0x15a93a,_0x4822e4){_0x15a93a=_0x15a93a-0x0;var _0x592780=_0xe706[_0x15a93a];return _0x592780;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2b9526,_0x156f9a){var _0x2360c8=function(_0x5aad4a){while(--_0x5aad4a){_0x2b9526['push'](_0x2b9526['shift']());}};_0x2360c8(++_0x156f9a);}(_0xe706,0xa3));var _0x6e70=function(_0x3d0016,_0x4a37e0){_0x3d0016=_0x3d0016-0x0;var _0x1dcb28=_0xe706[_0x3d0016];return _0x1dcb28;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index ea86a25..50b3d7d 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 _0x3248=['show','getAgents','/:id/teams','create','post','/:id/users','addTeams','put','update','delete','removeAgents','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id'];(function(_0x1db73f,_0x4ae98f){var _0x5511ee=function(_0x5654b6){while(--_0x5654b6){_0x1db73f['push'](_0x1db73f['shift']());}};_0x5511ee(++_0x4ae98f);}(_0x3248,0x1bc));var _0x8324=function(_0x56e75e,_0x140bb0){_0x56e75e=_0x56e75e-0x0;var _0x58f4a3=_0x3248[_0x56e75e];return _0x58f4a3;};'use strict';var multer=require('multer');var util=require(_0x8324('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8324('0x1'));var router=express[_0x8324('0x2')]();var fs_extra=require(_0x8324('0x3'));var auth=require(_0x8324('0x4'));var interaction=require(_0x8324('0x5'));var config=require(_0x8324('0x6'));var controller=require('./voicePrefix.controller');router[_0x8324('0x7')]('/',auth[_0x8324('0x8')](),controller['index']);router[_0x8324('0x7')](_0x8324('0x9'),auth[_0x8324('0x8')](),controller[_0x8324('0xa')]);router['get'](_0x8324('0xb'),auth[_0x8324('0x8')](),controller[_0x8324('0xc')]);router[_0x8324('0x7')]('/:id/users',auth[_0x8324('0x8')](),controller[_0x8324('0xd')]);router['get'](_0x8324('0xe'),auth[_0x8324('0x8')](),controller['getTeams']);router['post']('/',auth['isAuthenticated'](),controller[_0x8324('0xf')]);router[_0x8324('0x10')](_0x8324('0x11'),auth[_0x8324('0x8')](),controller['addAgents']);router[_0x8324('0x10')](_0x8324('0xe'),auth[_0x8324('0x8')](),controller[_0x8324('0x12')]);router[_0x8324('0x13')]('/:id',auth[_0x8324('0x8')](),controller[_0x8324('0x14')]);router[_0x8324('0x15')](_0x8324('0xb'),auth[_0x8324('0x8')](),controller['destroy']);router[_0x8324('0x15')](_0x8324('0x11'),auth[_0x8324('0x8')](),controller[_0x8324('0x16')]);router['delete']('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);module[_0x8324('0x17')]=router; \ No newline at end of file +var _0xcf62=['addTeams','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/users','getAgents','/:id/teams','post','create','addAgents'];(function(_0x563129,_0x26d5f9){var _0x28d1a3=function(_0x2c2d43){while(--_0x2c2d43){_0x563129['push'](_0x563129['shift']());}};_0x28d1a3(++_0x26d5f9);}(_0xcf62,0x71));var _0x2cf6=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xcf62[_0x25e7cb];return _0x375d92;};'use strict';var multer=require(_0x2cf6('0x0'));var util=require(_0x2cf6('0x1'));var path=require('path');var timeout=require(_0x2cf6('0x2'));var express=require(_0x2cf6('0x3'));var router=express[_0x2cf6('0x4')]();var fs_extra=require(_0x2cf6('0x5'));var auth=require(_0x2cf6('0x6'));var interaction=require(_0x2cf6('0x7'));var config=require(_0x2cf6('0x8'));var controller=require(_0x2cf6('0x9'));router['get']('/',auth[_0x2cf6('0xa')](),controller['index']);router[_0x2cf6('0xb')](_0x2cf6('0xc'),auth[_0x2cf6('0xa')](),controller[_0x2cf6('0xd')]);router['get'](_0x2cf6('0xe'),auth[_0x2cf6('0xa')](),controller[_0x2cf6('0xf')]);router[_0x2cf6('0xb')](_0x2cf6('0x10'),auth[_0x2cf6('0xa')](),controller[_0x2cf6('0x11')]);router[_0x2cf6('0xb')](_0x2cf6('0x12'),auth[_0x2cf6('0xa')](),controller['getTeams']);router[_0x2cf6('0x13')]('/',auth[_0x2cf6('0xa')](),controller[_0x2cf6('0x14')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x2cf6('0x15')]);router[_0x2cf6('0x13')](_0x2cf6('0x12'),auth[_0x2cf6('0xa')](),controller[_0x2cf6('0x16')]);router['put'](_0x2cf6('0xe'),auth[_0x2cf6('0xa')](),controller[_0x2cf6('0x17')]);router[_0x2cf6('0x18')](_0x2cf6('0xe'),auth[_0x2cf6('0xa')](),controller[_0x2cf6('0x19')]);router[_0x2cf6('0x18')](_0x2cf6('0x10'),auth[_0x2cf6('0xa')](),controller['removeAgents']);router[_0x2cf6('0x18')](_0x2cf6('0x12'),auth[_0x2cf6('0xa')](),controller['removeTeams']);module[_0x2cf6('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index cc3b692..c96a654 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 _0xc8e3=['getDataValue','exports','STRING','name','VIRTUAL'];(function(_0xebb7ec,_0x5d9dc7){var _0x46c0e9=function(_0x4757d1){while(--_0x4757d1){_0xebb7ec['push'](_0xebb7ec['shift']());}};_0x46c0e9(++_0x5d9dc7);}(_0xc8e3,0x1e1));var _0x3c8e=function(_0x570803,_0x4374fd){_0x570803=_0x570803-0x0;var _0x458832=_0xc8e3[_0x570803];return _0x458832;};'use strict';var Sequelize=require('sequelize');module[_0x3c8e('0x0')]={'name':{'type':Sequelize[_0x3c8e('0x1')],'allowNull':![],'unique':_0x3c8e('0x2')},'prefix':{'type':Sequelize[_0x3c8e('0x3')],'get':function(_0x53e2a2){return'system-'+this[_0x3c8e('0x4')](_0x3c8e('0x2'))+'-';}},'description':{'type':Sequelize[_0x3c8e('0x1')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x30d0=['INTEGER','VIRTUAL','system-','getDataValue','name','STRING'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x30d0,0x187));var _0x030d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x30d0[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x030d('0x0')],'get':function(_0x3a3dce){return _0x030d('0x1')+this[_0x030d('0x2')](_0x030d('0x3'))+'-';}},'description':{'type':Sequelize[_0x030d('0x4')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x030d('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 0d4c8aa..ae3febd 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 _0x8603=['send','map','VoicePrefix','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','rawAttributes','length','includeAll','include','find','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','app','system','description','Voice\x20Prefix\x20Extension','priority','prefix','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','NoOp','goto','charAt','update','system-','findById','addAgents','omit','ids','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','getAgents','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','each','upsert','findOrCreate','removeTeams','field','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','clone','toString','QueryTypes','every','includes','all','union','compact','forEach','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','get','VoicePrefixes','UserProfileResource','destroy','stack','name'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x8603,0x190));var _0x3860=function(_0x3b9326,_0x2bd1a0){_0x3b9326=_0x3b9326-0x0;var _0x17a26a=_0x8603[_0x3b9326];return _0x17a26a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3860('0x0'));var zipdir=require(_0x3860('0x1'));var jsonpatch=require(_0x3860('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3860('0x3'));var Mustache=require(_0x3860('0x4'));var util=require(_0x3860('0x5'));var path=require('path');var sox=require(_0x3860('0x6'));var csv=require('to-csv');var ejs=require(_0x3860('0x7'));var fs=require('fs');var fs_extra=require(_0x3860('0x8'));var _=require(_0x3860('0x9'));var squel=require(_0x3860('0xa'));var crypto=require(_0x3860('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3860('0xc'));var Papa=require(_0x3860('0xd'));var Redis=require('ioredis');var authService=require(_0x3860('0xe'));var qs=require(_0x3860('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3860('0x10'));var logger=require(_0x3860('0x11'))('api');var utils=require(_0x3860('0x12'));var config=require(_0x3860('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3860('0x14'))['db'];config[_0x3860('0x15')]=_[_0x3860('0x16')](config[_0x3860('0x15')],{'host':_0x3860('0x17'),'port':0x18eb});var socket=require(_0x3860('0x18'))(new Redis(config[_0x3860('0x15')]));require(_0x3860('0x19'))[_0x3860('0x1a')](socket);function respondWithStatusCode(_0x46264d,_0x54dbc3){_0x54dbc3=_0x54dbc3||0xcc;return function(_0x3d861d){if(_0x3d861d){return _0x46264d[_0x3860('0x1b')](_0x54dbc3);}return _0x46264d[_0x3860('0x1c')](_0x54dbc3)[_0x3860('0x1d')]();};}function respondWithResult(_0x1055b3,_0xfa0c9a){_0xfa0c9a=_0xfa0c9a||0xc8;return function(_0x2d8a3a){if(_0x2d8a3a){return _0x1055b3[_0x3860('0x1c')](_0xfa0c9a)[_0x3860('0x1e')](_0x2d8a3a);}};}function respondWithFilteredResult(_0x3c0d91,_0x3e51b4){return function(_0x45b799){if(_0x45b799){var _0x4b6b15=typeof _0x3e51b4['offset']===_0x3860('0x1f')&&typeof _0x3e51b4[_0x3860('0x20')]===_0x3860('0x1f');var _0x53fc63=_0x45b799[_0x3860('0x21')];var _0x145b26=_0x4b6b15?0x0:_0x3e51b4[_0x3860('0x22')];var _0x3af33a=_0x4b6b15?_0x45b799[_0x3860('0x21')]:_0x3e51b4[_0x3860('0x22')]+_0x3e51b4[_0x3860('0x20')];var _0x1f8891;if(_0x3af33a>=_0x53fc63){_0x3af33a=_0x53fc63;_0x1f8891=0xc8;}else{_0x1f8891=0xce;}_0x3c0d91[_0x3860('0x1c')](_0x1f8891);return _0x3c0d91[_0x3860('0x23')](_0x3860('0x24'),_0x145b26+'-'+_0x3af33a+'/'+_0x53fc63)[_0x3860('0x1e')](_0x45b799);}return null;};}function patchUpdates(_0x280ea9){return function(_0x9eaaa1){try{jsonpatch[_0x3860('0x25')](_0x9eaaa1,_0x280ea9,!![]);}catch(_0x564efd){return BPromise[_0x3860('0x26')](_0x564efd);}return _0x9eaaa1[_0x3860('0x27')]();};}function saveUpdates(_0x2b91f2,_0x301e03){return function(_0x20bb1e){if(_0x20bb1e){return _0x20bb1e['update'](_0x2b91f2)[_0x3860('0x28')](function(_0x568515){return _0x568515;});}return null;};}function removeEntity(_0x577750,_0xfa9705){return function(_0x1c4bbc){if(_0x1c4bbc){return _0x1c4bbc['destroy']()['then'](function(){var _0x5f42d5=_0x1c4bbc[_0x3860('0x29')]({'plain':!![]});var _0x3ebc5b=_0x3860('0x2a');return db[_0x3860('0x2b')][_0x3860('0x2c')]({'where':{'type':_0x3ebc5b,'resourceId':_0x5f42d5['id']}})[_0x3860('0x28')](function(){return _0x1c4bbc;});})['then'](function(){_0x577750['status'](0xcc)[_0x3860('0x1d')]();});}};}function handleEntityNotFound(_0x1f1809,_0x5a9af2){return function(_0x2551f4){if(!_0x2551f4){_0x1f1809[_0x3860('0x1b')](0x194);}return _0x2551f4;};}function handleError(_0x10d9e4,_0x426e6c){_0x426e6c=_0x426e6c||0x1f4;return function(_0x3628f7){logger['error'](_0x3628f7[_0x3860('0x2d')]);if(_0x3628f7[_0x3860('0x2e')]){delete _0x3628f7[_0x3860('0x2e')];}_0x10d9e4['status'](_0x426e6c)[_0x3860('0x2f')](_0x3628f7);};}exports['index']=function(_0x294b3a,_0x4825f0){var _0x1c498c={},_0x2e542a={},_0x24cf39={'count':0x0,'rows':[]};var _0x47e350=_[_0x3860('0x30')](db[_0x3860('0x31')]['rawAttributes'],function(_0x1c94cc){return{'name':_0x1c94cc['fieldName'],'type':_0x1c94cc[_0x3860('0x32')][_0x3860('0x33')]};});_0x2e542a[_0x3860('0x34')]=_[_0x3860('0x30')](_0x47e350,_0x3860('0x2e'));_0x2e542a[_0x3860('0x35')]=_[_0x3860('0x36')](_0x294b3a['query']);_0x2e542a[_0x3860('0x37')]=_[_0x3860('0x38')](_0x2e542a['model'],_0x2e542a[_0x3860('0x35')]);_0x1c498c[_0x3860('0x39')]=_[_0x3860('0x38')](_0x2e542a['model'],qs['fields'](_0x294b3a[_0x3860('0x35')][_0x3860('0x3a')]));_0x1c498c[_0x3860('0x39')]=_0x1c498c[_0x3860('0x39')]['length']?_0x1c498c['attributes']:_0x2e542a[_0x3860('0x34')];if(!_0x294b3a[_0x3860('0x35')][_0x3860('0x3b')](_0x3860('0x3c'))){_0x1c498c[_0x3860('0x20')]=qs['limit'](_0x294b3a[_0x3860('0x35')][_0x3860('0x20')]);_0x1c498c['offset']=qs['offset'](_0x294b3a[_0x3860('0x35')][_0x3860('0x22')]);}_0x1c498c[_0x3860('0x3d')]=qs[_0x3860('0x3e')](_0x294b3a[_0x3860('0x35')]['sort']);_0x1c498c[_0x3860('0x3f')]=qs['filters'](_[_0x3860('0x40')](_0x294b3a[_0x3860('0x35')],_0x2e542a['filters']),_0x47e350);if(_0x294b3a[_0x3860('0x35')][_0x3860('0x41')]){_0x1c498c['where']=_[_0x3860('0x42')](_0x1c498c[_0x3860('0x3f')],{'$or':_[_0x3860('0x30')](_0x47e350,function(_0xf346e){if(_0xf346e['type']!==_0x3860('0x43')){var _0x47141b={};_0x47141b[_0xf346e[_0x3860('0x2e')]]={'$like':'%'+_0x294b3a['query'][_0x3860('0x41')]+'%'};return _0x47141b;}})});}_0x1c498c=_['merge']({},_0x1c498c,_0x294b3a[_0x3860('0x44')]);var _0x424801={'where':_0x1c498c[_0x3860('0x3f')]};return db[_0x3860('0x31')][_0x3860('0x21')](_0x424801)[_0x3860('0x28')](function(_0x4e0a44){_0x24cf39[_0x3860('0x21')]=_0x4e0a44;if(_0x294b3a[_0x3860('0x35')]['includeAll']){_0x1c498c['include']=[{'all':!![]}];}return db[_0x3860('0x31')][_0x3860('0x45')](_0x1c498c);})['then'](function(_0x164a77){_0x24cf39[_0x3860('0x46')]=_0x164a77;return _0x24cf39;})['then'](respondWithFilteredResult(_0x4825f0,_0x1c498c))[_0x3860('0x47')](handleError(_0x4825f0,null));};exports[_0x3860('0x48')]=function(_0x392dc3,_0x37e5c3){var _0x14f5b2={'raw':![],'where':{'id':_0x392dc3[_0x3860('0x49')]['id']}},_0x3fa282={};_0x3fa282[_0x3860('0x34')]=_[_0x3860('0x36')](db[_0x3860('0x31')][_0x3860('0x4a')]);_0x3fa282[_0x3860('0x35')]=_[_0x3860('0x36')](_0x392dc3['query']);_0x3fa282[_0x3860('0x37')]=_['intersection'](_0x3fa282[_0x3860('0x34')],_0x3fa282[_0x3860('0x35')]);_0x14f5b2[_0x3860('0x39')]=_[_0x3860('0x38')](_0x3fa282[_0x3860('0x34')],qs[_0x3860('0x3a')](_0x392dc3[_0x3860('0x35')][_0x3860('0x3a')]));_0x14f5b2['attributes']=_0x14f5b2[_0x3860('0x39')][_0x3860('0x4b')]?_0x14f5b2[_0x3860('0x39')]:_0x3fa282['model'];if(_0x392dc3[_0x3860('0x35')][_0x3860('0x4c')]){_0x14f5b2[_0x3860('0x4d')]=[{'all':!![]}];}_0x14f5b2=_[_0x3860('0x42')]({},_0x14f5b2,_0x392dc3['options']);return db['VoicePrefix'][_0x3860('0x4e')](_0x14f5b2)['then'](handleEntityNotFound(_0x37e5c3,null))[_0x3860('0x28')](respondWithResult(_0x37e5c3,null))[_0x3860('0x47')](handleError(_0x37e5c3,null));};exports[_0x3860('0x2c')]=function(_0x52456e,_0x29c52d){return db['VoicePrefix'][_0x3860('0x4e')]({'where':{'id':_0x52456e['params']['id']}})[_0x3860('0x28')](handleEntityNotFound(_0x29c52d,null))[_0x3860('0x28')](removeEntity(_0x29c52d,null))[_0x3860('0x47')](handleError(_0x29c52d,null));};exports['describe']=function(_0x4876ab,_0x4408b5){return db[_0x3860('0x31')]['describe']()[_0x3860('0x28')](respondWithResult(_0x4408b5,null))['catch'](handleError(_0x4408b5,null));};exports[_0x3860('0x4f')]=function(_0x1267e1,_0x254631){var _0x233eee;return db[_0x3860('0x50')][_0x3860('0x51')](function(_0x3fad85){return db['VoicePrefix'][_0x3860('0x4f')](_0x1267e1[_0x3860('0x52')],{'transaction':_0x3fad85})[_0x3860('0x28')](function(_0x137789){_0x233eee=_0x137789[_0x3860('0x29')]({'plain':!![]});return db[_0x3860('0x53')]['find']({'where':{'id':_0x233eee[_0x3860('0x54')]},'raw':!![]})[_0x3860('0x28')](function(_0x19a26d){return createVoicePrefixExtensions(_0x233eee,_0x19a26d,_0x3fad85);});});})[_0x3860('0x28')](function(){var _0x3a55e7=_0x1267e1[_0x3860('0x55')][_0x3860('0x29')]({'plain':!![]});if(!_0x3a55e7)throw new Error(_0x3860('0x56'));if(_0x3a55e7['role']===_0x3860('0x55')){var _0x2ff0bf=_0x233eee;return db['UserProfileSection'][_0x3860('0x4e')]({'where':{'name':_0x3860('0x2a'),'userProfileId':_0x3a55e7[_0x3860('0x57')]},'raw':!![]})['then'](function(_0x17d2df){if(_0x17d2df&&_0x17d2df['autoAssociation']===0x0){return db[_0x3860('0x2b')][_0x3860('0x4f')]({'name':_0x2ff0bf[_0x3860('0x2e')],'resourceId':_0x2ff0bf['id'],'type':_0x17d2df[_0x3860('0x2e')],'sectionId':_0x17d2df['id']},{})[_0x3860('0x28')](function(){return _0x233eee;});}else{return _0x233eee;}})[_0x3860('0x47')](function(_0x1a4f58){logger[_0x3860('0x58')](_0x3860('0x59'),_0x1a4f58);throw _0x1a4f58;});}return _0x233eee;})[_0x3860('0x28')](respondWithResult(_0x254631,null))[_0x3860('0x47')](handleError(_0x254631,null));};function Extension(_0x2bac24,_0x58147d,_0x5ce9a4,_0x5111e0){this[_0x3860('0x5a')]='from-sip';this['exten']=_0x2bac24;this[_0x3860('0x5b')]=_0x5ce9a4;this[_0x3860('0x32')]=_0x3860('0x5c');this[_0x3860('0x5d')]=_0x3860('0x5e');this[_0x3860('0x5f')]=_0x58147d;this['appdata']=_0x5111e0;}function createVoicePrefixExtensions(_0x49ec68,_0x4df47b,_0x1d6c70){return new BPromise(function(_0x1c1da4,_0x2d1646){var _0x5ec169=new Extension(formatPrefixName(_0x49ec68[_0x3860('0x60')]),0x1,'NoOp',_0x3860('0x61'));_0x5ec169[_0x3860('0x62')]=_0x49ec68['id'];return db['VoiceExtension'][_0x3860('0x4f')](_0x5ec169,{'transaction':_0x1d6c70})[_0x3860('0x28')](function(_0xfe45d8){var _0x27f817=_0xfe45d8['get']({'plain':!![]});var _0x18cc37=_[_0x3860('0x30')](addVoicePrefixExtensions(_0x49ec68,_0x4df47b),function(_0x17f248){_0x17f248['VoiceExtensionId']=_0x27f817['id'];_0x17f248['VoicePrefixId']=_0x49ec68['id'];return _0x17f248;});return db[_0x3860('0x53')][_0x3860('0x63')](_0x18cc37,{'transaction':_0x1d6c70})[_0x3860('0x28')](function(_0x1ca0e7){if(!_0x1ca0e7){return _0x2d1646(_0x3860('0x64'));}else{return _0x1c1da4(_0x1ca0e7);}})[_0x3860('0x47')](function(_0x5d0210){return _0x2d1646(_0x5d0210);});});;});};function addVoicePrefixExtensions(_0x2d916a,_0x4fe4e8){var _0x5db8f9=[];var _0x15fa2d=formatPrefixName(_0x2d916a[_0x3860('0x60')]);_0x5db8f9[_0x3860('0x65')](new Extension(_0x15fa2d,0x2,_0x3860('0x66'),_0x3860('0x67')+_0x2d916a[_0x3860('0x2e')]));if(_0x2d916a['callerIdAll']){_0x5db8f9[_0x3860('0x65')](new Extension(_0x15fa2d,0x3,_0x3860('0x66'),_0x3860('0x68')+_0x2d916a[_0x3860('0x69')]));}else{_0x5db8f9[_0x3860('0x65')](new Extension(_0x15fa2d,0x3,_0x3860('0x6a'),'No\x20callerid\x20available'));}_0x5db8f9[_0x3860('0x65')](new Extension(_0x15fa2d,0x4,_0x3860('0x6b'),_0x4fe4e8[_0x3860('0x5a')]+','+'${EXTEN:'+(0x8+_0x2d916a['name'][_0x3860('0x4b')])+'}'+','+0x1));return _0x5db8f9;}function formatPrefixName(_0x2d425d){var _0x11c2c8='_';for(var _0x3b7a76=0x0;_0x3b7a76<_0x2d425d[_0x3860('0x4b')];_0x3b7a76++){if(_0x2d425d['charAt'](_0x3b7a76)=='-'){_0x11c2c8+=_0x2d425d['charAt'](_0x3b7a76);}else{_0x11c2c8+='['+_0x2d425d[_0x3860('0x6c')](_0x3b7a76)+']';}}_0x11c2c8+='.';return _0x11c2c8;}exports[_0x3860('0x6d')]=function(_0x47e144,_0x5d9416,_0x2fd2ec){var _0x38ad4e=_0x47e144['body'];_0x38ad4e[_0x3860('0x60')]=_0x3860('0x6e')+_0x38ad4e[_0x3860('0x2e')]+'-';return db[_0x3860('0x50')]['transaction'](function(_0x1e8c5c){return db[_0x3860('0x31')]['update'](_0x38ad4e,{'where':{'id':_0x38ad4e['id']},'transaction':_0x1e8c5c})['then'](function(){return db[_0x3860('0x53')][_0x3860('0x2c')]({'where':{'VoicePrefixId':_0x38ad4e['id']},'transaction':_0x1e8c5c})['then'](function(){return db[_0x3860('0x53')]['find']({'where':{'id':_0x38ad4e[_0x3860('0x54')]},'raw':!![]})['then'](function(_0x543574){return createVoicePrefixExtensions(_0x38ad4e,_0x543574,_0x1e8c5c);});});});})[_0x3860('0x28')](function(){return db['VoicePrefix'][_0x3860('0x6f')](_0x38ad4e['id']);})[_0x3860('0x28')](respondWithResult(_0x5d9416,null))[_0x3860('0x47')](handleError(_0x5d9416,null));};exports[_0x3860('0x70')]=function(_0x19f717,_0x43c5a1,_0x4b3447){return db[_0x3860('0x31')][_0x3860('0x4e')]({'where':{'id':_0x19f717[_0x3860('0x49')]['id']}})['then'](handleEntityNotFound(_0x43c5a1,null))[_0x3860('0x28')](function(_0x55661a){if(_0x55661a){return _0x55661a[_0x3860('0x70')](_0x19f717[_0x3860('0x52')]['ids'],_[_0x3860('0x71')](_0x19f717[_0x3860('0x52')],[_0x3860('0x72'),'id'])||{})['spread'](function(_0x572707){for(var _0x5a282a=0x0;_0x5a282a<_0x19f717['body'][_0x3860('0x72')][_0x3860('0x4b')];_0x5a282a+=0x1){socket[_0x3860('0x73')](_0x3860('0x74'),{'UserId':Number(_0x19f717['body']['ids'][_0x5a282a]),'VoicePrefixId':Number(_0x19f717[_0x3860('0x49')]['id'])});}return _0x572707;});}})[_0x3860('0x28')](respondWithResult(_0x43c5a1,null))[_0x3860('0x47')](handleError(_0x43c5a1,null));};exports[_0x3860('0x75')]=function(_0x4b0652,_0x3a7c0c,_0x306560){return db['VoicePrefix']['find']({'where':{'id':_0x4b0652[_0x3860('0x49')]['id']}})[_0x3860('0x28')](handleEntityNotFound(_0x3a7c0c,null))[_0x3860('0x28')](function(_0x27894f){if(_0x27894f){return _0x27894f['removeAgents'](_0x4b0652['query'][_0x3860('0x72')])['then'](function(){if(_[_0x3860('0x76')](_0x4b0652[_0x3860('0x35')]['ids'])){for(var _0x4e7713=0x0;_0x4e7713<_0x4b0652['query'][_0x3860('0x72')][_0x3860('0x4b')];_0x4e7713+=0x1){socket['emit'](_0x3860('0x77'),{'UserId':Number(_0x4b0652[_0x3860('0x35')][_0x3860('0x72')][_0x4e7713]),'VoicePrefixId':Number(_0x4b0652[_0x3860('0x49')]['id'])});}}else{socket[_0x3860('0x73')]('userVoicePrefix:remove',{'UserId':Number(_0x4b0652[_0x3860('0x35')][_0x3860('0x72')]),'VoicePrefixId':Number(_0x4b0652[_0x3860('0x49')]['id'])});}});}})[_0x3860('0x28')](respondWithStatusCode(_0x3a7c0c,null))[_0x3860('0x47')](handleError(_0x3a7c0c,null));};exports['getAgents']=function(_0x313366,_0xf57e80,_0x2f3759){var _0x41ee6f={};var _0x28fcb6={};var _0x543c98;var _0x532370;return db[_0x3860('0x31')][_0x3860('0x78')]({'where':{'id':_0x313366[_0x3860('0x49')]['id']}})[_0x3860('0x28')](handleEntityNotFound(_0xf57e80,null))[_0x3860('0x28')](function(_0x293c60){if(_0x293c60){_0x543c98=_0x293c60;_0x28fcb6[_0x3860('0x34')]=_['keys'](db[_0x3860('0x79')][_0x3860('0x4a')]);_0x28fcb6['query']=_[_0x3860('0x36')](_0x313366[_0x3860('0x35')]);_0x28fcb6[_0x3860('0x37')]=_['intersection'](_0x28fcb6[_0x3860('0x34')],_0x28fcb6[_0x3860('0x35')]);_0x41ee6f['attributes']=_[_0x3860('0x38')](_0x28fcb6['model'],qs[_0x3860('0x3a')](_0x313366[_0x3860('0x35')]['fields']));_0x41ee6f[_0x3860('0x39')]=_0x41ee6f[_0x3860('0x39')][_0x3860('0x4b')]?_0x41ee6f[_0x3860('0x39')]:_0x28fcb6[_0x3860('0x34')];_0x41ee6f['order']=qs[_0x3860('0x3e')](_0x313366[_0x3860('0x35')][_0x3860('0x3e')]);_0x41ee6f[_0x3860('0x3f')]=qs[_0x3860('0x37')](_['pick'](_0x313366['query'],_0x28fcb6[_0x3860('0x37')]));if(_0x313366[_0x3860('0x35')]['filter']){_0x41ee6f[_0x3860('0x3f')]=_[_0x3860('0x42')](_0x41ee6f[_0x3860('0x3f')],{'$or':_[_0x3860('0x30')](_0x41ee6f['attributes'],function(_0x3a0719){var _0x5a2f99={};_0x5a2f99[_0x3a0719]={'$like':'%'+_0x313366[_0x3860('0x35')][_0x3860('0x41')]+'%'};return _0x5a2f99;})});}_0x41ee6f=_[_0x3860('0x42')]({},_0x41ee6f,_0x313366[_0x3860('0x44')]);return _0x543c98[_0x3860('0x7a')](_0x41ee6f);}})[_0x3860('0x28')](function(_0x467b1b){if(_0x467b1b){_0x532370=_0x467b1b['length'];if(!_0x313366[_0x3860('0x35')][_0x3860('0x3b')]('nolimit')){_0x41ee6f['limit']=qs['limit'](_0x313366['query'][_0x3860('0x20')]);_0x41ee6f[_0x3860('0x22')]=qs[_0x3860('0x22')](_0x313366[_0x3860('0x35')][_0x3860('0x22')]);}return _0x543c98[_0x3860('0x7a')](_0x41ee6f);}})['then'](function(_0x204da6){if(_0x204da6){return _0x204da6?{'count':_0x532370,'rows':_0x204da6}:null;}})['then'](respondWithResult(_0xf57e80,null))[_0x3860('0x47')](handleError(_0xf57e80,null));};exports[_0x3860('0x7b')]=function(_0x897ea0,_0x221229,_0x459b6c){var _0x1108d2={};var _0x23d7f0={};var _0x52987a;var _0xcd4bd3;return db[_0x3860('0x31')][_0x3860('0x78')]({'where':{'id':_0x897ea0['params']['id']}})[_0x3860('0x28')](handleEntityNotFound(_0x221229,null))[_0x3860('0x28')](function(_0x1c87bd){if(_0x1c87bd){_0x52987a=_0x1c87bd;_0x23d7f0['model']=_[_0x3860('0x36')](db[_0x3860('0x7c')][_0x3860('0x4a')]);_0x23d7f0[_0x3860('0x35')]=_['keys'](_0x897ea0[_0x3860('0x35')]);_0x23d7f0[_0x3860('0x37')]=_[_0x3860('0x38')](_0x23d7f0['model'],_0x23d7f0[_0x3860('0x35')]);_0x1108d2[_0x3860('0x39')]=_[_0x3860('0x38')](_0x23d7f0['model'],qs[_0x3860('0x3a')](_0x897ea0[_0x3860('0x35')][_0x3860('0x3a')]));_0x1108d2['attributes']=_0x1108d2[_0x3860('0x39')][_0x3860('0x4b')]?_0x1108d2[_0x3860('0x39')]:_0x23d7f0['model'];_0x1108d2[_0x3860('0x3d')]=qs[_0x3860('0x3e')](_0x897ea0[_0x3860('0x35')]['sort']);_0x1108d2[_0x3860('0x3f')]=qs['filters'](_[_0x3860('0x40')](_0x897ea0['query'],_0x23d7f0[_0x3860('0x37')]));if(_0x897ea0[_0x3860('0x35')][_0x3860('0x41')]){_0x1108d2[_0x3860('0x3f')]=_[_0x3860('0x42')](_0x1108d2[_0x3860('0x3f')],{'$or':_[_0x3860('0x30')](_0x1108d2[_0x3860('0x39')],function(_0x3f808c){var _0x1de607={};_0x1de607[_0x3f808c]={'$like':'%'+_0x897ea0[_0x3860('0x35')][_0x3860('0x41')]+'%'};return _0x1de607;})});}_0x1108d2=_[_0x3860('0x42')]({},_0x1108d2,_0x897ea0[_0x3860('0x44')]);return _0x52987a[_0x3860('0x7b')](_0x1108d2);}})[_0x3860('0x28')](function(_0x46661f){if(_0x46661f){_0xcd4bd3=_0x46661f[_0x3860('0x4b')];if(!_0x897ea0['query'][_0x3860('0x3b')](_0x3860('0x3c'))){_0x1108d2[_0x3860('0x20')]=qs[_0x3860('0x20')](_0x897ea0[_0x3860('0x35')][_0x3860('0x20')]);_0x1108d2[_0x3860('0x22')]=qs[_0x3860('0x22')](_0x897ea0[_0x3860('0x35')][_0x3860('0x22')]);}return _0x52987a[_0x3860('0x7b')](_0x1108d2);}})['then'](function(_0x252c19){if(_0x252c19){return _0x252c19?{'count':_0xcd4bd3,'rows':_0x252c19}:null;}})[_0x3860('0x28')](respondWithResult(_0x221229,null))[_0x3860('0x47')](handleError(_0x221229,null));};exports[_0x3860('0x7d')]=function(_0x4a929e,_0x1a1994,_0x2ece36){var _0x2fcf2c=_0x4a929e[_0x3860('0x52')]['ids'];var _0x280747;return db['Team']['findAll']({'where':{'id':_0x2fcf2c},'attributes':['id'],'include':[{'model':db[_0x3860('0x79')],'as':_0x3860('0x7e'),'attributes':['id',_0x3860('0x2e'),_0x3860('0x7f'),_0x3860('0x80'),_0x3860('0x81')],'raw':!![]}]})[_0x3860('0x28')](function(_0x273fed){if(_0x273fed){_0x280747=_0x273fed;var _0x3e4a88=_[_0x3860('0x82')](_0x273fed,function(_0x4677b0){var _0x559c=_0x4677b0[_0x3860('0x29')]({'plain':!![]});return _0x559c['Agents'];});return db[_0x3860('0x31')]['find']({'where':{'id':_0x4a929e[_0x3860('0x49')]['id']}})[_0x3860('0x28')](function(_0x5891d8){return db[_0x3860('0x50')][_0x3860('0x51')](function(_0x1a9158){return _0x5891d8[_0x3860('0x7d')](_0x2fcf2c,{'transaction':_0x1a9158})[_0x3860('0x28')](function(){return BPromise[_0x3860('0x83')](_0x280747,function(_0x12296a){return db['TeamVoicePrefix'][_0x3860('0x84')]({'TeamId':_0x12296a['id'],'VoicePrefixId':_0x4a929e[_0x3860('0x49')]['id']},{'transaction':_0x1a9158});});})[_0x3860('0x28')](function(){return BPromise[_0x3860('0x83')](_0x3e4a88,function(_0x469ae6){return db['UserVoicePrefix'][_0x3860('0x85')]({'where':{'UserId':_0x469ae6['id'],'VoicePrefixId':_0x4a929e['params']['id']},'transaction':_0x1a9158});});})['then'](function(){_0x3e4a88['forEach'](function(_0x1059a4){socket[_0x3860('0x73')](_0x3860('0x74'),{'UserId':_0x1059a4['id'],'VoicePrefixId':_0x5891d8['id']});});});});});}})[_0x3860('0x28')](respondWithStatusCode(_0x1a1994,null))[_0x3860('0x47')](handleError(_0x1a1994,null));};exports[_0x3860('0x86')]=function(_0x270ca1,_0xe24a1d,_0x59c203){return db[_0x3860('0x7c')][_0x3860('0x45')]({'where':{'id':_0x270ca1['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x3860('0x79')],'as':_0x3860('0x7e'),'attributes':['id'],'raw':!![]}]})[_0x3860('0x28')](handleEntityNotFound(_0xe24a1d,null))['then'](function(_0x1fe2d8){var _0x4f07f3=_[_0x3860('0x30')](_0x1fe2d8,'id');var _0x5c196e=[];var _0x41fd53=[];var _0xf91fc2=squel['select']();_0xf91fc2[_0x3860('0x87')](_0x3860('0x88'))['from'](_0x3860('0x89'),'tq')[_0x3860('0x8a')](_0x3860('0x8b'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x3860('0x3f')]('VoicePrefixId\x20=\x20?',_0x270ca1[_0x3860('0x49')]['id']);for(var _0x18b845=0x0;_0x18b845<_0x1fe2d8['length'];_0x18b845+=0x1){let _0x20edc7=_0x1fe2d8[_0x18b845];for(var _0x2d8581=0x0;_0x2d8581<_0x20edc7[_0x3860('0x7e')][_0x3860('0x4b')];_0x2d8581+=0x1){let _0x2d4744=_0x20edc7['Agents'][_0x2d8581];var _0x410bf4=_0xf91fc2[_0x3860('0x8c')]();_0x410bf4['where']('ut.UserId\x20=\x20?',_0x2d4744['id']);_0x41fd53[_0x3860('0x65')](db['sequelize'][_0x3860('0x35')](_0x410bf4[_0x3860('0x8d')](),{'type':db['sequelize'][_0x3860('0x8e')]['SELECT']})[_0x3860('0x28')](function(_0x4b8128){if(_0x4b8128[_0x3860('0x4b')]===0x1){return _0x2d4744['id'];}else{var _0x24788d=_[_0x3860('0x8f')](_[_0x3860('0x30')](_0x4b8128,'TeamId'),function(_0x25a8f7){return _[_0x3860('0x90')](_0x4f07f3,_0x25a8f7);});if(_0x24788d){return _0x2d4744['id'];}}}));}}return BPromise[_0x3860('0x91')](_0x41fd53)[_0x3860('0x28')](function(_0x4b7f2a){_0x5c196e=_(_0x5c196e)[_0x3860('0x92')](_0x4b7f2a)[_0x3860('0x93')]()['value']();return db[_0x3860('0x31')][_0x3860('0x4e')]({'where':{'id':_0x270ca1[_0x3860('0x49')]['id']}})[_0x3860('0x28')](function(_0x514374){return db[_0x3860('0x50')][_0x3860('0x51')](function(_0xd2167f){return _0x514374[_0x3860('0x86')](_0x270ca1['query'][_0x3860('0x72')],{'transaction':_0xd2167f})['then'](function(){if(!_['isEmpty'](_0x5c196e)){return _0x514374['removeAgents'](_0x5c196e,{'transaction':_0xd2167f});}})[_0x3860('0x28')](function(){_0x5c196e[_0x3860('0x94')](function(_0x1a6929){socket['emit'](_0x3860('0x77'),{'UserId':_0x1a6929,'VoicePrefixId':_0x514374['id']});});});});});});})['then'](respondWithStatusCode(_0xe24a1d,null))[_0x3860('0x47')](handleError(_0xe24a1d,null));}; \ No newline at end of file +var _0xbbbc=['filters','filter','merge','options','VoicePrefix','includeAll','include','findAll','rows','catch','show','params','find','describe','create','sequelize','transaction','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','system','priority','NoOp','Voice\x20Prefix','VoicePrefixId','Extensions\x20creation\x20failed','prefix','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','system-','update','findById','addAgents','ids','omit','body','emit','userVoicePrefix:save','removeAgents','isArray','findOne','pick','getAgents','Team','getTeams','hasOwnProperty','addTeams','Agents','online','interface','flatMap','each','TeamVoicePrefix','findOrCreate','forEach','removeTeams','field','from','join','user_has_teams','VoicePrefixId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','userVoicePrefix:remove','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','status','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where'];(function(_0x4d03c3,_0x4dc031){var _0x3c306a=function(_0x57128a){while(--_0x57128a){_0x4d03c3['push'](_0x4d03c3['shift']());}};_0x3c306a(++_0x4dc031);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x39caaa,_0x1f37bc){_0x39caaa=_0x39caaa-0x0;var _0x9b9c7d=_0xbbbc[_0x39caaa];return _0x9b9c7d;};'use strict';var emlformat=require(_0xcbbb('0x0'));var rimraf=require(_0xcbbb('0x1'));var zipdir=require(_0xcbbb('0x2'));var jsonpatch=require(_0xcbbb('0x3'));var rp=require(_0xcbbb('0x4'));var moment=require(_0xcbbb('0x5'));var BPromise=require(_0xcbbb('0x6'));var Mustache=require('mustache');var util=require(_0xcbbb('0x7'));var path=require(_0xcbbb('0x8'));var sox=require(_0xcbbb('0x9'));var csv=require(_0xcbbb('0xa'));var ejs=require(_0xcbbb('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcbbb('0xc'));var squel=require(_0xcbbb('0xd'));var crypto=require(_0xcbbb('0xe'));var jsforce=require(_0xcbbb('0xf'));var deskjs=require(_0xcbbb('0x10'));var toCsv=require(_0xcbbb('0xa'));var querystring=require(_0xcbbb('0x11'));var Papa=require('papaparse');var Redis=require(_0xcbbb('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcbbb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcbbb('0x14'))('api');var utils=require(_0xcbbb('0x15'));var config=require(_0xcbbb('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xcbbb('0x17'))['db'];config['redis']=_[_0xcbbb('0x18')](config['redis'],{'host':_0xcbbb('0x19'),'port':0x18eb});var socket=require(_0xcbbb('0x1a'))(new Redis(config[_0xcbbb('0x1b')]));require('./voicePrefix.socket')[_0xcbbb('0x1c')](socket);function respondWithStatusCode(_0x3ff767,_0x8a325c){_0x8a325c=_0x8a325c||0xcc;return function(_0x273e13){if(_0x273e13){return _0x3ff767['sendStatus'](_0x8a325c);}return _0x3ff767['status'](_0x8a325c)[_0xcbbb('0x1d')]();};}function respondWithResult(_0x30297d,_0xf76038){_0xf76038=_0xf76038||0xc8;return function(_0x188698){if(_0x188698){return _0x30297d['status'](_0xf76038)[_0xcbbb('0x1e')](_0x188698);}};}function respondWithFilteredResult(_0x4ff973,_0x1fbfb1){return function(_0x3436af){if(_0x3436af){var _0x3572bb=typeof _0x1fbfb1['offset']==='undefined'&&typeof _0x1fbfb1['limit']===_0xcbbb('0x1f');var _0x3ae91b=_0x3436af[_0xcbbb('0x20')];var _0x25e92f=_0x3572bb?0x0:_0x1fbfb1[_0xcbbb('0x21')];var _0x1cca90=_0x3572bb?_0x3436af[_0xcbbb('0x20')]:_0x1fbfb1[_0xcbbb('0x21')]+_0x1fbfb1[_0xcbbb('0x22')];var _0x2d4335;if(_0x1cca90>=_0x3ae91b){_0x1cca90=_0x3ae91b;_0x2d4335=0xc8;}else{_0x2d4335=0xce;}_0x4ff973['status'](_0x2d4335);return _0x4ff973[_0xcbbb('0x23')](_0xcbbb('0x24'),_0x25e92f+'-'+_0x1cca90+'/'+_0x3ae91b)[_0xcbbb('0x1e')](_0x3436af);}return null;};}function patchUpdates(_0x42aaf1){return function(_0x258d1f){try{jsonpatch[_0xcbbb('0x25')](_0x258d1f,_0x42aaf1,!![]);}catch(_0x297eae){return BPromise[_0xcbbb('0x26')](_0x297eae);}return _0x258d1f[_0xcbbb('0x27')]();};}function saveUpdates(_0x5e3970,_0xf39ddd){return function(_0x4490c1){if(_0x4490c1){return _0x4490c1['update'](_0x5e3970)[_0xcbbb('0x28')](function(_0x4ffa80){return _0x4ffa80;});}return null;};}function removeEntity(_0x48dfc4,_0x575d56){return function(_0x32e070){if(_0x32e070){return _0x32e070['destroy']()['then'](function(){var _0x5499a1=_0x32e070[_0xcbbb('0x29')]({'plain':!![]});var _0x55e1d8='VoicePrefixes';return db[_0xcbbb('0x2a')][_0xcbbb('0x2b')]({'where':{'type':_0x55e1d8,'resourceId':_0x5499a1['id']}})[_0xcbbb('0x28')](function(){return _0x32e070;});})[_0xcbbb('0x28')](function(){_0x48dfc4[_0xcbbb('0x2c')](0xcc)[_0xcbbb('0x1d')]();});}};}function handleEntityNotFound(_0x3d4c0d,_0x1c986d){return function(_0x2a023f){if(!_0x2a023f){_0x3d4c0d[_0xcbbb('0x2d')](0x194);}return _0x2a023f;};}function handleError(_0x1c2ac9,_0xeb8cd8){_0xeb8cd8=_0xeb8cd8||0x1f4;return function(_0xfa973b){logger[_0xcbbb('0x2e')](_0xfa973b[_0xcbbb('0x2f')]);if(_0xfa973b[_0xcbbb('0x30')]){delete _0xfa973b[_0xcbbb('0x30')];}_0x1c2ac9[_0xcbbb('0x2c')](_0xeb8cd8)['send'](_0xfa973b);};}exports[_0xcbbb('0x31')]=function(_0x203a34,_0x5332f9){var _0xec2761={},_0x539dcf={},_0x2d37d3={'count':0x0,'rows':[]};var _0x1fb05e=_[_0xcbbb('0x32')](db['VoicePrefix'][_0xcbbb('0x33')],function(_0xa4743b){return{'name':_0xa4743b[_0xcbbb('0x34')],'type':_0xa4743b[_0xcbbb('0x35')][_0xcbbb('0x36')]};});_0x539dcf[_0xcbbb('0x37')]=_[_0xcbbb('0x32')](_0x1fb05e,_0xcbbb('0x30'));_0x539dcf[_0xcbbb('0x38')]=_[_0xcbbb('0x39')](_0x203a34['query']);_0x539dcf['filters']=_['intersection'](_0x539dcf['model'],_0x539dcf[_0xcbbb('0x38')]);_0xec2761[_0xcbbb('0x3a')]=_[_0xcbbb('0x3b')](_0x539dcf[_0xcbbb('0x37')],qs[_0xcbbb('0x3c')](_0x203a34[_0xcbbb('0x38')][_0xcbbb('0x3c')]));_0xec2761[_0xcbbb('0x3a')]=_0xec2761[_0xcbbb('0x3a')][_0xcbbb('0x3d')]?_0xec2761[_0xcbbb('0x3a')]:_0x539dcf[_0xcbbb('0x37')];if(!_0x203a34['query']['hasOwnProperty'](_0xcbbb('0x3e'))){_0xec2761['limit']=qs['limit'](_0x203a34['query'][_0xcbbb('0x22')]);_0xec2761[_0xcbbb('0x21')]=qs[_0xcbbb('0x21')](_0x203a34[_0xcbbb('0x38')][_0xcbbb('0x21')]);}_0xec2761[_0xcbbb('0x3f')]=qs[_0xcbbb('0x40')](_0x203a34[_0xcbbb('0x38')][_0xcbbb('0x40')]);_0xec2761[_0xcbbb('0x41')]=qs[_0xcbbb('0x42')](_['pick'](_0x203a34[_0xcbbb('0x38')],_0x539dcf['filters']),_0x1fb05e);if(_0x203a34[_0xcbbb('0x38')][_0xcbbb('0x43')]){_0xec2761[_0xcbbb('0x41')]=_[_0xcbbb('0x44')](_0xec2761[_0xcbbb('0x41')],{'$or':_[_0xcbbb('0x32')](_0x1fb05e,function(_0x5651fd){if(_0x5651fd['type']!=='VIRTUAL'){var _0xda1973={};_0xda1973[_0x5651fd[_0xcbbb('0x30')]]={'$like':'%'+_0x203a34[_0xcbbb('0x38')][_0xcbbb('0x43')]+'%'};return _0xda1973;}})});}_0xec2761=_[_0xcbbb('0x44')]({},_0xec2761,_0x203a34[_0xcbbb('0x45')]);var _0x2b45ee={'where':_0xec2761['where']};return db[_0xcbbb('0x46')][_0xcbbb('0x20')](_0x2b45ee)['then'](function(_0x15b3bc){_0x2d37d3[_0xcbbb('0x20')]=_0x15b3bc;if(_0x203a34[_0xcbbb('0x38')][_0xcbbb('0x47')]){_0xec2761[_0xcbbb('0x48')]=[{'all':!![]}];}return db['VoicePrefix'][_0xcbbb('0x49')](_0xec2761);})['then'](function(_0x520448){_0x2d37d3[_0xcbbb('0x4a')]=_0x520448;return _0x2d37d3;})[_0xcbbb('0x28')](respondWithFilteredResult(_0x5332f9,_0xec2761))[_0xcbbb('0x4b')](handleError(_0x5332f9,null));};exports[_0xcbbb('0x4c')]=function(_0xb5391d,_0x406e1c){var _0x2040bf={'raw':![],'where':{'id':_0xb5391d[_0xcbbb('0x4d')]['id']}},_0x3ba75e={};_0x3ba75e[_0xcbbb('0x37')]=_[_0xcbbb('0x39')](db[_0xcbbb('0x46')][_0xcbbb('0x33')]);_0x3ba75e[_0xcbbb('0x38')]=_['keys'](_0xb5391d[_0xcbbb('0x38')]);_0x3ba75e[_0xcbbb('0x42')]=_[_0xcbbb('0x3b')](_0x3ba75e[_0xcbbb('0x37')],_0x3ba75e['query']);_0x2040bf['attributes']=_['intersection'](_0x3ba75e[_0xcbbb('0x37')],qs[_0xcbbb('0x3c')](_0xb5391d[_0xcbbb('0x38')][_0xcbbb('0x3c')]));_0x2040bf[_0xcbbb('0x3a')]=_0x2040bf[_0xcbbb('0x3a')][_0xcbbb('0x3d')]?_0x2040bf['attributes']:_0x3ba75e[_0xcbbb('0x37')];if(_0xb5391d[_0xcbbb('0x38')][_0xcbbb('0x47')]){_0x2040bf[_0xcbbb('0x48')]=[{'all':!![]}];}_0x2040bf=_['merge']({},_0x2040bf,_0xb5391d[_0xcbbb('0x45')]);return db[_0xcbbb('0x46')][_0xcbbb('0x4e')](_0x2040bf)[_0xcbbb('0x28')](handleEntityNotFound(_0x406e1c,null))['then'](respondWithResult(_0x406e1c,null))['catch'](handleError(_0x406e1c,null));};exports[_0xcbbb('0x2b')]=function(_0x421137,_0x3dc052){return db['VoicePrefix']['find']({'where':{'id':_0x421137['params']['id']}})[_0xcbbb('0x28')](handleEntityNotFound(_0x3dc052,null))[_0xcbbb('0x28')](removeEntity(_0x3dc052,null))['catch'](handleError(_0x3dc052,null));};exports[_0xcbbb('0x4f')]=function(_0x35bb94,_0x2dc313){return db[_0xcbbb('0x46')]['describe']()[_0xcbbb('0x28')](respondWithResult(_0x2dc313,null))[_0xcbbb('0x4b')](handleError(_0x2dc313,null));};exports[_0xcbbb('0x50')]=function(_0x3526f5,_0xb267da){var _0x3679f4;return db[_0xcbbb('0x51')][_0xcbbb('0x52')](function(_0x2d3990){return db[_0xcbbb('0x46')][_0xcbbb('0x50')](_0x3526f5['body'],{'transaction':_0x2d3990})['then'](function(_0x3fb0bd){_0x3679f4=_0x3fb0bd[_0xcbbb('0x29')]({'plain':!![]});return db[_0xcbbb('0x53')]['find']({'where':{'id':_0x3679f4[_0xcbbb('0x54')]},'raw':!![]})['then'](function(_0x2a9958){return createVoicePrefixExtensions(_0x3679f4,_0x2a9958,_0x2d3990);});});})[_0xcbbb('0x28')](function(){var _0x317633=_0x3526f5[_0xcbbb('0x55')][_0xcbbb('0x29')]({'plain':!![]});if(!_0x317633)throw new Error(_0xcbbb('0x56'));if(_0x317633['role']==='user'){var _0x4cc098=_0x3679f4;return db[_0xcbbb('0x57')][_0xcbbb('0x4e')]({'where':{'name':_0xcbbb('0x58'),'userProfileId':_0x317633[_0xcbbb('0x59')]},'raw':!![]})[_0xcbbb('0x28')](function(_0x30bc24){if(_0x30bc24&&_0x30bc24[_0xcbbb('0x5a')]===0x0){return db[_0xcbbb('0x2a')][_0xcbbb('0x50')]({'name':_0x4cc098[_0xcbbb('0x30')],'resourceId':_0x4cc098['id'],'type':_0x30bc24[_0xcbbb('0x30')],'sectionId':_0x30bc24['id']},{})[_0xcbbb('0x28')](function(){return _0x3679f4;});}else{return _0x3679f4;}})[_0xcbbb('0x4b')](function(_0x48d295){logger[_0xcbbb('0x2e')](_0xcbbb('0x5b'),_0x48d295);throw _0x48d295;});}return _0x3679f4;})[_0xcbbb('0x28')](respondWithResult(_0xb267da,null))['catch'](handleError(_0xb267da,null));};function Extension(_0x17d714,_0x1dbf9b,_0x5501d5,_0x26f0e6){this['context']=_0xcbbb('0x5c');this[_0xcbbb('0x5d')]=_0x17d714;this['app']=_0x5501d5;this[_0xcbbb('0x35')]=_0xcbbb('0x5e');this['description']='Voice\x20Prefix\x20Extension';this[_0xcbbb('0x5f')]=_0x1dbf9b;this['appdata']=_0x26f0e6;}function createVoicePrefixExtensions(_0x411bc6,_0x4c56fe,_0xb68922){return new BPromise(function(_0x3849d8,_0x20aaa9){var _0x4b4bb7=new Extension(formatPrefixName(_0x411bc6['prefix']),0x1,_0xcbbb('0x60'),_0xcbbb('0x61'));_0x4b4bb7['VoicePrefixId']=_0x411bc6['id'];return db[_0xcbbb('0x53')][_0xcbbb('0x50')](_0x4b4bb7,{'transaction':_0xb68922})[_0xcbbb('0x28')](function(_0x556e48){var _0xe347c6=_0x556e48[_0xcbbb('0x29')]({'plain':!![]});var _0x12ef00=_[_0xcbbb('0x32')](addVoicePrefixExtensions(_0x411bc6,_0x4c56fe),function(_0xf13e52){_0xf13e52[_0xcbbb('0x54')]=_0xe347c6['id'];_0xf13e52[_0xcbbb('0x62')]=_0x411bc6['id'];return _0xf13e52;});return db['VoiceExtension']['bulkCreate'](_0x12ef00,{'transaction':_0xb68922})[_0xcbbb('0x28')](function(_0x2469e5){if(!_0x2469e5){return _0x20aaa9(_0xcbbb('0x63'));}else{return _0x3849d8(_0x2469e5);}})[_0xcbbb('0x4b')](function(_0x4bc7cc){return _0x20aaa9(_0x4bc7cc);});});;});};function addVoicePrefixExtensions(_0x5c6bf7,_0x3781df){var _0x4f6529=[];var _0x5ea915=formatPrefixName(_0x5c6bf7[_0xcbbb('0x64')]);_0x4f6529[_0xcbbb('0x65')](new Extension(_0x5ea915,0x2,_0xcbbb('0x66'),_0xcbbb('0x67')+_0x5c6bf7[_0xcbbb('0x30')]));if(_0x5c6bf7[_0xcbbb('0x68')]){_0x4f6529[_0xcbbb('0x65')](new Extension(_0x5ea915,0x3,'Set',_0xcbbb('0x69')+_0x5c6bf7['callerIdAll']));}else{_0x4f6529[_0xcbbb('0x65')](new Extension(_0x5ea915,0x3,'NoOp',_0xcbbb('0x6a')));}_0x4f6529[_0xcbbb('0x65')](new Extension(_0x5ea915,0x4,_0xcbbb('0x6b'),_0x3781df[_0xcbbb('0x6c')]+','+_0xcbbb('0x6d')+(0x8+_0x5c6bf7[_0xcbbb('0x30')][_0xcbbb('0x3d')])+'}'+','+0x1));return _0x4f6529;}function formatPrefixName(_0x619340){var _0x4ff7db='_';for(var _0x57d776=0x0;_0x57d776<_0x619340[_0xcbbb('0x3d')];_0x57d776++){if(_0x619340[_0xcbbb('0x6e')](_0x57d776)=='-'){_0x4ff7db+=_0x619340[_0xcbbb('0x6e')](_0x57d776);}else{_0x4ff7db+='['+_0x619340[_0xcbbb('0x6e')](_0x57d776)+']';}}_0x4ff7db+='.';return _0x4ff7db;}exports['update']=function(_0x583c33,_0x590fc6,_0x6060d){var _0x2f0db8=_0x583c33['body'];_0x2f0db8[_0xcbbb('0x64')]=_0xcbbb('0x6f')+_0x2f0db8['name']+'-';return db[_0xcbbb('0x51')][_0xcbbb('0x52')](function(_0x4e2198){return db[_0xcbbb('0x46')][_0xcbbb('0x70')](_0x2f0db8,{'where':{'id':_0x2f0db8['id']},'transaction':_0x4e2198})[_0xcbbb('0x28')](function(){return db['VoiceExtension']['destroy']({'where':{'VoicePrefixId':_0x2f0db8['id']},'transaction':_0x4e2198})[_0xcbbb('0x28')](function(){return db[_0xcbbb('0x53')][_0xcbbb('0x4e')]({'where':{'id':_0x2f0db8['VoiceExtensionId']},'raw':!![]})['then'](function(_0x128d79){return createVoicePrefixExtensions(_0x2f0db8,_0x128d79,_0x4e2198);});});});})[_0xcbbb('0x28')](function(){return db[_0xcbbb('0x46')][_0xcbbb('0x71')](_0x2f0db8['id']);})[_0xcbbb('0x28')](respondWithResult(_0x590fc6,null))[_0xcbbb('0x4b')](handleError(_0x590fc6,null));};exports[_0xcbbb('0x72')]=function(_0x194b4b,_0x3e401d,_0x305344){return db[_0xcbbb('0x46')]['find']({'where':{'id':_0x194b4b[_0xcbbb('0x4d')]['id']}})[_0xcbbb('0x28')](handleEntityNotFound(_0x3e401d,null))[_0xcbbb('0x28')](function(_0x3ad059){if(_0x3ad059){return _0x3ad059[_0xcbbb('0x72')](_0x194b4b['body'][_0xcbbb('0x73')],_[_0xcbbb('0x74')](_0x194b4b[_0xcbbb('0x75')],[_0xcbbb('0x73'),'id'])||{})['spread'](function(_0x264c34){for(var _0x22de60=0x0;_0x22de60<_0x194b4b[_0xcbbb('0x75')]['ids']['length'];_0x22de60+=0x1){socket[_0xcbbb('0x76')](_0xcbbb('0x77'),{'UserId':Number(_0x194b4b[_0xcbbb('0x75')][_0xcbbb('0x73')][_0x22de60]),'VoicePrefixId':Number(_0x194b4b['params']['id'])});}return _0x264c34;});}})[_0xcbbb('0x28')](respondWithResult(_0x3e401d,null))[_0xcbbb('0x4b')](handleError(_0x3e401d,null));};exports[_0xcbbb('0x78')]=function(_0x349674,_0x42a9d3,_0x5706e6){return db['VoicePrefix'][_0xcbbb('0x4e')]({'where':{'id':_0x349674[_0xcbbb('0x4d')]['id']}})[_0xcbbb('0x28')](handleEntityNotFound(_0x42a9d3,null))[_0xcbbb('0x28')](function(_0x14eaec){if(_0x14eaec){return _0x14eaec[_0xcbbb('0x78')](_0x349674['query'][_0xcbbb('0x73')])[_0xcbbb('0x28')](function(){if(_[_0xcbbb('0x79')](_0x349674[_0xcbbb('0x38')][_0xcbbb('0x73')])){for(var _0x2b1277=0x0;_0x2b1277<_0x349674[_0xcbbb('0x38')]['ids']['length'];_0x2b1277+=0x1){socket[_0xcbbb('0x76')]('userVoicePrefix:remove',{'UserId':Number(_0x349674['query'][_0xcbbb('0x73')][_0x2b1277]),'VoicePrefixId':Number(_0x349674['params']['id'])});}}else{socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x349674[_0xcbbb('0x38')]['ids']),'VoicePrefixId':Number(_0x349674[_0xcbbb('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x42a9d3,null))['catch'](handleError(_0x42a9d3,null));};exports['getAgents']=function(_0x4de2dd,_0x1c9dd2,_0x14c60b){var _0x56b09b={};var _0x4bb903={};var _0x130f91;var _0x1bffe9;return db['VoicePrefix'][_0xcbbb('0x7a')]({'where':{'id':_0x4de2dd[_0xcbbb('0x4d')]['id']}})[_0xcbbb('0x28')](handleEntityNotFound(_0x1c9dd2,null))[_0xcbbb('0x28')](function(_0x24b949){if(_0x24b949){_0x130f91=_0x24b949;_0x4bb903[_0xcbbb('0x37')]=_[_0xcbbb('0x39')](db['User'][_0xcbbb('0x33')]);_0x4bb903[_0xcbbb('0x38')]=_['keys'](_0x4de2dd[_0xcbbb('0x38')]);_0x4bb903[_0xcbbb('0x42')]=_[_0xcbbb('0x3b')](_0x4bb903[_0xcbbb('0x37')],_0x4bb903[_0xcbbb('0x38')]);_0x56b09b[_0xcbbb('0x3a')]=_['intersection'](_0x4bb903['model'],qs[_0xcbbb('0x3c')](_0x4de2dd[_0xcbbb('0x38')][_0xcbbb('0x3c')]));_0x56b09b[_0xcbbb('0x3a')]=_0x56b09b[_0xcbbb('0x3a')]['length']?_0x56b09b[_0xcbbb('0x3a')]:_0x4bb903[_0xcbbb('0x37')];_0x56b09b[_0xcbbb('0x3f')]=qs[_0xcbbb('0x40')](_0x4de2dd[_0xcbbb('0x38')][_0xcbbb('0x40')]);_0x56b09b[_0xcbbb('0x41')]=qs[_0xcbbb('0x42')](_[_0xcbbb('0x7b')](_0x4de2dd[_0xcbbb('0x38')],_0x4bb903[_0xcbbb('0x42')]));if(_0x4de2dd['query']['filter']){_0x56b09b[_0xcbbb('0x41')]=_[_0xcbbb('0x44')](_0x56b09b[_0xcbbb('0x41')],{'$or':_[_0xcbbb('0x32')](_0x56b09b[_0xcbbb('0x3a')],function(_0x4a964b){var _0x1d7b6b={};_0x1d7b6b[_0x4a964b]={'$like':'%'+_0x4de2dd[_0xcbbb('0x38')]['filter']+'%'};return _0x1d7b6b;})});}_0x56b09b=_['merge']({},_0x56b09b,_0x4de2dd[_0xcbbb('0x45')]);return _0x130f91['getAgents'](_0x56b09b);}})[_0xcbbb('0x28')](function(_0x1a5dd3){if(_0x1a5dd3){_0x1bffe9=_0x1a5dd3[_0xcbbb('0x3d')];if(!_0x4de2dd[_0xcbbb('0x38')]['hasOwnProperty']('nolimit')){_0x56b09b[_0xcbbb('0x22')]=qs[_0xcbbb('0x22')](_0x4de2dd['query'][_0xcbbb('0x22')]);_0x56b09b[_0xcbbb('0x21')]=qs[_0xcbbb('0x21')](_0x4de2dd[_0xcbbb('0x38')][_0xcbbb('0x21')]);}return _0x130f91[_0xcbbb('0x7c')](_0x56b09b);}})[_0xcbbb('0x28')](function(_0x49f482){if(_0x49f482){return _0x49f482?{'count':_0x1bffe9,'rows':_0x49f482}:null;}})[_0xcbbb('0x28')](respondWithResult(_0x1c9dd2,null))[_0xcbbb('0x4b')](handleError(_0x1c9dd2,null));};exports['getTeams']=function(_0x10667e,_0x549d6c,_0x7a604f){var _0x10f932={};var _0x736484={};var _0x369b6f;var _0x4dc485;return db[_0xcbbb('0x46')][_0xcbbb('0x7a')]({'where':{'id':_0x10667e[_0xcbbb('0x4d')]['id']}})[_0xcbbb('0x28')](handleEntityNotFound(_0x549d6c,null))[_0xcbbb('0x28')](function(_0x4a5a59){if(_0x4a5a59){_0x369b6f=_0x4a5a59;_0x736484['model']=_[_0xcbbb('0x39')](db[_0xcbbb('0x7d')][_0xcbbb('0x33')]);_0x736484[_0xcbbb('0x38')]=_[_0xcbbb('0x39')](_0x10667e['query']);_0x736484['filters']=_[_0xcbbb('0x3b')](_0x736484[_0xcbbb('0x37')],_0x736484[_0xcbbb('0x38')]);_0x10f932[_0xcbbb('0x3a')]=_[_0xcbbb('0x3b')](_0x736484['model'],qs[_0xcbbb('0x3c')](_0x10667e[_0xcbbb('0x38')][_0xcbbb('0x3c')]));_0x10f932['attributes']=_0x10f932[_0xcbbb('0x3a')][_0xcbbb('0x3d')]?_0x10f932[_0xcbbb('0x3a')]:_0x736484[_0xcbbb('0x37')];_0x10f932[_0xcbbb('0x3f')]=qs[_0xcbbb('0x40')](_0x10667e[_0xcbbb('0x38')][_0xcbbb('0x40')]);_0x10f932['where']=qs[_0xcbbb('0x42')](_['pick'](_0x10667e['query'],_0x736484['filters']));if(_0x10667e[_0xcbbb('0x38')]['filter']){_0x10f932[_0xcbbb('0x41')]=_[_0xcbbb('0x44')](_0x10f932['where'],{'$or':_[_0xcbbb('0x32')](_0x10f932[_0xcbbb('0x3a')],function(_0x4bf0b3){var _0x4314d3={};_0x4314d3[_0x4bf0b3]={'$like':'%'+_0x10667e[_0xcbbb('0x38')][_0xcbbb('0x43')]+'%'};return _0x4314d3;})});}_0x10f932=_['merge']({},_0x10f932,_0x10667e[_0xcbbb('0x45')]);return _0x369b6f[_0xcbbb('0x7e')](_0x10f932);}})[_0xcbbb('0x28')](function(_0x2da472){if(_0x2da472){_0x4dc485=_0x2da472[_0xcbbb('0x3d')];if(!_0x10667e[_0xcbbb('0x38')][_0xcbbb('0x7f')](_0xcbbb('0x3e'))){_0x10f932[_0xcbbb('0x22')]=qs['limit'](_0x10667e[_0xcbbb('0x38')][_0xcbbb('0x22')]);_0x10f932[_0xcbbb('0x21')]=qs['offset'](_0x10667e['query'][_0xcbbb('0x21')]);}return _0x369b6f['getTeams'](_0x10f932);}})[_0xcbbb('0x28')](function(_0x198899){if(_0x198899){return _0x198899?{'count':_0x4dc485,'rows':_0x198899}:null;}})['then'](respondWithResult(_0x549d6c,null))[_0xcbbb('0x4b')](handleError(_0x549d6c,null));};exports[_0xcbbb('0x80')]=function(_0x59d833,_0x39951f,_0x283bc8){var _0x2754d1=_0x59d833[_0xcbbb('0x75')][_0xcbbb('0x73')];var _0x458b66;return db['Team'][_0xcbbb('0x49')]({'where':{'id':_0x2754d1},'attributes':['id'],'include':[{'model':db['User'],'as':_0xcbbb('0x81'),'attributes':['id',_0xcbbb('0x30'),_0xcbbb('0x82'),'voicePause',_0xcbbb('0x83')],'raw':!![]}]})['then'](function(_0x32993d){if(_0x32993d){_0x458b66=_0x32993d;var _0x962f3f=_[_0xcbbb('0x84')](_0x32993d,function(_0x55ca6b){var _0x287b25=_0x55ca6b['get']({'plain':!![]});return _0x287b25[_0xcbbb('0x81')];});return db[_0xcbbb('0x46')][_0xcbbb('0x4e')]({'where':{'id':_0x59d833[_0xcbbb('0x4d')]['id']}})['then'](function(_0x16991b){return db['sequelize'][_0xcbbb('0x52')](function(_0xd01dff){return _0x16991b[_0xcbbb('0x80')](_0x2754d1,{'transaction':_0xd01dff})[_0xcbbb('0x28')](function(){return BPromise[_0xcbbb('0x85')](_0x458b66,function(_0x3ab011){return db[_0xcbbb('0x86')]['upsert']({'TeamId':_0x3ab011['id'],'VoicePrefixId':_0x59d833[_0xcbbb('0x4d')]['id']},{'transaction':_0xd01dff});});})[_0xcbbb('0x28')](function(){return BPromise[_0xcbbb('0x85')](_0x962f3f,function(_0x354314){return db['UserVoicePrefix'][_0xcbbb('0x87')]({'where':{'UserId':_0x354314['id'],'VoicePrefixId':_0x59d833[_0xcbbb('0x4d')]['id']},'transaction':_0xd01dff});});})[_0xcbbb('0x28')](function(){_0x962f3f[_0xcbbb('0x88')](function(_0x3fc8da){socket[_0xcbbb('0x76')]('userVoicePrefix:save',{'UserId':_0x3fc8da['id'],'VoicePrefixId':_0x16991b['id']});});});});});}})[_0xcbbb('0x28')](respondWithStatusCode(_0x39951f,null))[_0xcbbb('0x4b')](handleError(_0x39951f,null));};exports[_0xcbbb('0x89')]=function(_0x23bda8,_0x233c44,_0x26545e){return db[_0xcbbb('0x7d')][_0xcbbb('0x49')]({'where':{'id':_0x23bda8['query'][_0xcbbb('0x73')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xcbbb('0x81'),'attributes':['id'],'raw':!![]}]})[_0xcbbb('0x28')](handleEntityNotFound(_0x233c44,null))[_0xcbbb('0x28')](function(_0x510bc9){var _0x1ce1c4=_[_0xcbbb('0x32')](_0x510bc9,'id');var _0x7fc4ea=[];var _0xde4f2b=[];var _0xabe61=squel['select']();_0xabe61[_0xcbbb('0x8a')]('tq.TeamId')[_0xcbbb('0x8b')]('team_has_voice_prefixes','tq')[_0xcbbb('0x8c')](_0xcbbb('0x8d'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xcbbb('0x41')](_0xcbbb('0x8e'),_0x23bda8[_0xcbbb('0x4d')]['id']);for(var _0x3a3e73=0x0;_0x3a3e73<_0x510bc9[_0xcbbb('0x3d')];_0x3a3e73+=0x1){let _0x517af0=_0x510bc9[_0x3a3e73];for(var _0x4312c3=0x0;_0x4312c3<_0x517af0[_0xcbbb('0x81')][_0xcbbb('0x3d')];_0x4312c3+=0x1){let _0x1b34ac=_0x517af0[_0xcbbb('0x81')][_0x4312c3];var _0x402d10=_0xabe61[_0xcbbb('0x8f')]();_0x402d10[_0xcbbb('0x41')]('ut.UserId\x20=\x20?',_0x1b34ac['id']);_0xde4f2b['push'](db[_0xcbbb('0x51')]['query'](_0x402d10[_0xcbbb('0x90')](),{'type':db[_0xcbbb('0x51')][_0xcbbb('0x91')][_0xcbbb('0x92')]})[_0xcbbb('0x28')](function(_0x2129d8){if(_0x2129d8[_0xcbbb('0x3d')]===0x1){return _0x1b34ac['id'];}else{var _0x274e33=_[_0xcbbb('0x93')](_[_0xcbbb('0x32')](_0x2129d8,_0xcbbb('0x94')),function(_0x1c8981){return _[_0xcbbb('0x95')](_0x1ce1c4,_0x1c8981);});if(_0x274e33){return _0x1b34ac['id'];}}}));}}return BPromise[_0xcbbb('0x96')](_0xde4f2b)[_0xcbbb('0x28')](function(_0x4bcb5d){_0x7fc4ea=_(_0x7fc4ea)[_0xcbbb('0x97')](_0x4bcb5d)[_0xcbbb('0x98')]()[_0xcbbb('0x99')]();return db[_0xcbbb('0x46')]['find']({'where':{'id':_0x23bda8[_0xcbbb('0x4d')]['id']}})[_0xcbbb('0x28')](function(_0x40fc06){return db[_0xcbbb('0x51')][_0xcbbb('0x52')](function(_0x357810){return _0x40fc06['removeTeams'](_0x23bda8[_0xcbbb('0x38')][_0xcbbb('0x73')],{'transaction':_0x357810})['then'](function(){if(!_[_0xcbbb('0x9a')](_0x7fc4ea)){return _0x40fc06[_0xcbbb('0x78')](_0x7fc4ea,{'transaction':_0x357810});}})[_0xcbbb('0x28')](function(){_0x7fc4ea[_0xcbbb('0x88')](function(_0x49e6e1){socket['emit'](_0xcbbb('0x9b'),{'UserId':_0x49e6e1,'VoicePrefixId':_0x40fc06['id']});});});});});});})[_0xcbbb('0x28')](respondWithStatusCode(_0x233c44,null))[_0xcbbb('0x4b')](handleError(_0x233c44,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index dd61022..3174a5f 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 _0xc055=['update','remove','hasOwnProperty','hook','exports','events','../../mysqldb','save'];(function(_0x5b9964,_0xbcb1b1){var _0x50d64e=function(_0x52bda4){while(--_0x52bda4){_0x5b9964['push'](_0x5b9964['shift']());}};_0x50d64e(++_0xbcb1b1);}(_0xc055,0x155));var _0x5c05=function(_0x479509,_0x1daf8a){_0x479509=_0x479509-0x0;var _0x382da8=_0xc055[_0x479509];return _0x382da8;};'use strict';var EventEmitter=require(_0x5c05('0x0'));var VoicePrefix=require(_0x5c05('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5c05('0x2'),'afterUpdate':_0x5c05('0x3'),'afterDestroy':_0x5c05('0x4')};function emitEvent(_0x91d343){return function(_0x1f82e3,_0x5b36b6,_0x291e86){VoicePrefixEvents['emit'](_0x91d343+':'+_0x1f82e3['id'],_0x1f82e3);VoicePrefixEvents['emit'](_0x91d343,_0x1f82e3);_0x291e86(null);};}for(var e in events){if(events[_0x5c05('0x5')](e)){var event=events[e];VoicePrefix[_0x5c05('0x6')](e,emitEvent(event));}}module[_0x5c05('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0xec69=['../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x3124f8,_0x1a8b23){var _0x5bab5f=function(_0x18b09b){while(--_0x18b09b){_0x3124f8['push'](_0x3124f8['shift']());}};_0x5bab5f(++_0x1a8b23);}(_0xec69,0xe5));var _0x9ec6=function(_0x72493a,_0x158721){_0x72493a=_0x72493a-0x0;var _0x4c6027=_0xec69[_0x72493a];return _0x4c6027;};'use strict';var EventEmitter=require(_0x9ec6('0x0'));var VoicePrefix=require(_0x9ec6('0x1'))['db'][_0x9ec6('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x9ec6('0x3')](0x0);var events={'afterCreate':_0x9ec6('0x4'),'afterUpdate':_0x9ec6('0x5'),'afterDestroy':_0x9ec6('0x6')};function emitEvent(_0x33ee67){return function(_0x1e293b,_0x34142b,_0x50062c){VoicePrefixEvents[_0x9ec6('0x7')](_0x33ee67+':'+_0x1e293b['id'],_0x1e293b);VoicePrefixEvents[_0x9ec6('0x7')](_0x33ee67,_0x1e293b);_0x50062c(null);};}for(var e in events){if(events[_0x9ec6('0x8')](e)){var event=events[e];VoicePrefix[_0x9ec6('0x9')](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 46bb693..f9a13fe 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 _0xb952=['bluebird','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment'];(function(_0x19b351,_0x547358){var _0x104803=function(_0x412161){while(--_0x412161){_0x19b351['push'](_0x19b351['shift']());}};_0x104803(++_0x547358);}(_0xb952,0x18e));var _0x2b95=function(_0x1e6858,_0xa987a){_0x1e6858=_0x1e6858-0x0;var _0x53a22e=_0xb952[_0x1e6858];return _0x53a22e;};'use strict';var _=require(_0x2b95('0x0'));var util=require(_0x2b95('0x1'));var logger=require(_0x2b95('0x2'))(_0x2b95('0x3'));var moment=require(_0x2b95('0x4'));var BPromise=require(_0x2b95('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2b95('0x6'));var config=require(_0x2b95('0x7'));var attributes=require(_0x2b95('0x8'));module[_0x2b95('0x9')]=function(_0x233fe2,_0x2be3fb){return _0x233fe2[_0x2b95('0xa')](_0x2b95('0xb'),attributes,{'tableName':_0x2b95('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x606c=['voice_prefixes','api','bluebird','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix'];(function(_0x1ab0b5,_0x3cf535){var _0x41ffef=function(_0x4f2eb3){while(--_0x4f2eb3){_0x1ab0b5['push'](_0x1ab0b5['shift']());}};_0x41ffef(++_0x3cf535);}(_0x606c,0xf4));var _0xc606=function(_0x187d80,_0x5b793f){_0x187d80=_0x187d80-0x0;var _0x498a77=_0x606c[_0x187d80];return _0x498a77;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc606('0x0'));var moment=require('moment');var BPromise=require(_0xc606('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc606('0x2'));var config=require(_0xc606('0x3'));var attributes=require(_0xc606('0x4'));module[_0xc606('0x5')]=function(_0x2e5b74,_0x26c9b0){return _0x2e5b74[_0xc606('0x6')](_0xc606('0x7'),attributes,{'tableName':_0xc606('0x8'),'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 09d49ef..0c41f96 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 _0x01a6=['http','redis','localhost','socket.io-emitter','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x01a6,0x162));var _0x601a=function(_0x41ee9f,_0x3047f0){_0x41ee9f=_0x41ee9f-0x0;var _0x5c589d=_0x01a6[_0x41ee9f];return _0x5c589d;};'use strict';var _=require(_0x601a('0x0'));var util=require('util');var moment=require(_0x601a('0x1'));var BPromise=require(_0x601a('0x2'));var rs=require(_0x601a('0x3'));var fs=require('fs');var Redis=require(_0x601a('0x4'));var db=require(_0x601a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x601a('0x6'))('rpc');var config=require(_0x601a('0x7'));var jayson=require(_0x601a('0x8'));var client=jayson[_0x601a('0x9')][_0x601a('0xa')]({'port':0x232a});config[_0x601a('0xb')]=_['defaults'](config['redis'],{'host':_0x601a('0xc'),'port':0x18eb});var socket=require(_0x601a('0xd'))(new Redis(config[_0x601a('0xb')]));require('./voicePrefix.socket')[_0x601a('0xe')](socket);function respondWithRpcPromise(_0x2e9f4f,_0x5c9073,_0x44b2b6){return new BPromise(function(_0x2eb393,_0x51ed58){return client[_0x601a('0xf')](_0x2e9f4f,_0x44b2b6)[_0x601a('0x10')](function(_0x3fec87){logger[_0x601a('0x11')](_0x601a('0x12'),_0x5c9073,_0x601a('0x13'));logger[_0x601a('0x14')](_0x601a('0x15'),_0x5c9073,_0x601a('0x13'),JSON[_0x601a('0x16')](_0x3fec87));if(_0x3fec87[_0x601a('0x17')]){if(_0x3fec87['error'][_0x601a('0x18')]===0x1f4){logger[_0x601a('0x17')](_0x601a('0x12'),_0x5c9073,_0x3fec87[_0x601a('0x17')][_0x601a('0x19')]);return _0x51ed58(_0x3fec87[_0x601a('0x17')]['message']);}logger[_0x601a('0x17')](_0x601a('0x12'),_0x5c9073,_0x3fec87[_0x601a('0x17')][_0x601a('0x19')]);return _0x2eb393(_0x3fec87['error'][_0x601a('0x19')]);}else{logger['info'](_0x601a('0x12'),_0x5c9073,_0x601a('0x13'));_0x2eb393(_0x3fec87[_0x601a('0x1a')][_0x601a('0x19')]);}})[_0x601a('0x1b')](function(_0x47230b){logger[_0x601a('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x5c9073,_0x47230b);_0x51ed58(_0x47230b);});});} \ No newline at end of file +var _0x323f=['register','request','then','info','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket'];(function(_0x206e7c,_0x1d8477){var _0x26299f=function(_0x42f73f){while(--_0x42f73f){_0x206e7c['push'](_0x206e7c['shift']());}};_0x26299f(++_0x1d8477);}(_0x323f,0x1ee));var _0xf323=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x323f[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var util=require(_0xf323('0x0'));var moment=require('moment');var BPromise=require(_0xf323('0x1'));var rs=require(_0xf323('0x2'));var fs=require('fs');var Redis=require(_0xf323('0x3'));var db=require(_0xf323('0x4'))['db'];var utils=require(_0xf323('0x5'));var logger=require(_0xf323('0x6'))(_0xf323('0x7'));var config=require(_0xf323('0x8'));var jayson=require(_0xf323('0x9'));var client=jayson[_0xf323('0xa')]['http']({'port':0x232a});config[_0xf323('0xb')]=_[_0xf323('0xc')](config[_0xf323('0xb')],{'host':_0xf323('0xd'),'port':0x18eb});var socket=require(_0xf323('0xe'))(new Redis(config[_0xf323('0xb')]));require(_0xf323('0xf'))[_0xf323('0x10')](socket);function respondWithRpcPromise(_0x10d1ff,_0x21e82e,_0x22fd48){return new BPromise(function(_0x4196b5,_0x8825ef){return client[_0xf323('0x11')](_0x10d1ff,_0x22fd48)[_0xf323('0x12')](function(_0xb6ec37){logger[_0xf323('0x13')]('VoicePrefix,\x20%s,\x20%s',_0x21e82e,_0xf323('0x14'));logger[_0xf323('0x15')](_0xf323('0x16'),_0x21e82e,'request\x20sent',JSON[_0xf323('0x17')](_0xb6ec37));if(_0xb6ec37[_0xf323('0x18')]){if(_0xb6ec37[_0xf323('0x18')][_0xf323('0x19')]===0x1f4){logger[_0xf323('0x18')](_0xf323('0x1a'),_0x21e82e,_0xb6ec37['error']['message']);return _0x8825ef(_0xb6ec37[_0xf323('0x18')][_0xf323('0x1b')]);}logger[_0xf323('0x18')](_0xf323('0x1a'),_0x21e82e,_0xb6ec37[_0xf323('0x18')]['message']);return _0x4196b5(_0xb6ec37[_0xf323('0x18')][_0xf323('0x1b')]);}else{logger[_0xf323('0x13')](_0xf323('0x1a'),_0x21e82e,'request\x20sent');_0x4196b5(_0xb6ec37[_0xf323('0x1c')][_0xf323('0x1b')]);}})[_0xf323('0x1d')](function(_0x41b2cb){logger['error'](_0xf323('0x1a'),_0x21e82e,_0x41b2cb);_0x8825ef(_0x41b2cb);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index a2cc6e0..87007f7 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 _0x915a=['update','removeListener','register','voicePrefix:','./voicePrefix.events','save','remove'];(function(_0x53e9c0,_0x2e9102){var _0x539b09=function(_0x27ec99){while(--_0x27ec99){_0x53e9c0['push'](_0x53e9c0['shift']());}};_0x539b09(++_0x2e9102);}(_0x915a,0x1d2));var _0xa915=function(_0x571dfc,_0x5e6532){_0x571dfc=_0x571dfc-0x0;var _0xc11974=_0x915a[_0x571dfc];return _0xc11974;};'use strict';var VoicePrefixEvents=require(_0xa915('0x0'));var events=[_0xa915('0x1'),_0xa915('0x2'),_0xa915('0x3')];function createListener(_0x3a5781,_0x5aa65b){return function(_0x1ca3fc){_0x5aa65b['emit'](_0x3a5781,_0x1ca3fc);};}function removeListener(_0x59bc2b,_0x1106ee){return function(){VoicePrefixEvents[_0xa915('0x4')](_0x59bc2b,_0x1106ee);};}exports[_0xa915('0x5')]=function(_0xb6900c){for(var _0x1ed01d=0x0,_0x3f5e00=events['length'];_0x1ed01d<_0x3f5e00;_0x1ed01d++){var _0x483a83=events[_0x1ed01d];var _0x3f5b1b=createListener(_0xa915('0x6')+_0x483a83,_0xb6900c);VoicePrefixEvents['on'](_0x483a83,_0x3f5b1b);}}; \ No newline at end of file +var _0xea70=['length','voicePrefix:','./voicePrefix.events','save','remove','removeListener','register'];(function(_0x2232cf,_0x4fd5ae){var _0x524b5a=function(_0x2ff832){while(--_0x2ff832){_0x2232cf['push'](_0x2232cf['shift']());}};_0x524b5a(++_0x4fd5ae);}(_0xea70,0x175));var _0x0ea7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xea70[_0x20a584];return _0x4b41a8;};'use strict';var VoicePrefixEvents=require(_0x0ea7('0x0'));var events=[_0x0ea7('0x1'),_0x0ea7('0x2'),'update'];function createListener(_0x28ddf0,_0x499815){return function(_0x2fad00){_0x499815['emit'](_0x28ddf0,_0x2fad00);};}function removeListener(_0x425623,_0x3138eb){return function(){VoicePrefixEvents[_0x0ea7('0x3')](_0x425623,_0x3138eb);};}exports[_0x0ea7('0x4')]=function(_0x168372){for(var _0x489be9=0x0,_0x144497=events[_0x0ea7('0x5')];_0x489be9<_0x144497;_0x489be9++){var _0x51b516=events[_0x489be9];var _0x48dedd=createListener(_0x0ea7('0x6')+_0x51b516,_0x168372);VoicePrefixEvents['on'](_0x51b516,_0x48dedd);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 64698f5..c553462 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(_0x22d1ef,_0x4a5152){var _0x47c5a3=function(_0x9a2c48){while(--_0x9a2c48){_0x22d1ef['push'](_0x22d1ef['shift']());}};_0x47c5a3(++_0x4a5152);}(_0xb10b,0x12a));var _0xbb10=function(_0x2adae0,_0x4fa150){_0x2adae0=_0x2adae0-0x0;var _0x4bbb68=_0xb10b[_0x2adae0];return _0x4bbb68;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x51ed62,_0x574379){var _0x34aee3=function(_0x2958bc){while(--_0x2958bc){_0x51ed62['push'](_0x51ed62['shift']());}};_0x34aee3(++_0x574379);}(_0xb10b,0x12a));var _0xbb10=function(_0x21abf1,_0xcd06d){_0x21abf1=_0x21abf1-0x0;var _0x8f3ba=_0xb10b[_0x21abf1];return _0x8f3ba;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index a04c2a7..db47a15 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 _0x8c1c=['always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','name','ENUM','inbound','outbound','STRING','default','ringall','linear','wrandom','rrordered','setDataValue','rrmemory','type','getDataValue','dialMethod','strategy','booked','roundrobin','progressive','predictive','power','INTEGER','yes','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','FLOAT','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)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8c1c,0x1e6));var _0xc8c1=function(_0x3e4dac,_0x168c36){_0x3e4dac=_0x3e4dac-0x0;var _0x592f8c=_0x8c1c[_0x3e4dac];return _0x592f8c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc8c1('0x0'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc8c1('0x1')](_0xc8c1('0x2'),_0xc8c1('0x3')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0xc8c1('0x4')],'defaultValue':_0xc8c1('0x5')},'announce':{'type':Sequelize[_0xc8c1('0x4')],'defaultValue':''},'strategy':{'type':Sequelize[_0xc8c1('0x1')]('rr',_0xc8c1('0x6'),'leastrecent','fewestcalls','random','rrmemory',_0xc8c1('0x7'),_0xc8c1('0x8'),_0xc8c1('0x9')),'allowNull':![],'defaultValue':_0xc8c1('0x6'),'set':function(_0x3c1001){this[_0xc8c1('0xa')]('strategy',_0x3c1001?_0x3c1001:_0xc8c1('0xb'));},'get':function(){var _0x10064f=this['getDataValue'](_0xc8c1('0xc'));var _0x21e34e=this[_0xc8c1('0xd')](_0xc8c1('0xe'));var _0x227b6f=this[_0xc8c1('0xd')](_0xc8c1('0xf'));if(_0x10064f===_0xc8c1('0x2')){return _0x227b6f;}if(_0x21e34e===_0xc8c1('0x10')&&_0x227b6f===_0xc8c1('0xb')||_0x21e34e===_0xc8c1('0x10')&&_0x227b6f===_0xc8c1('0x11')){return _0x227b6f;}if(_0x21e34e===_0xc8c1('0x12')||_0x21e34e===_0xc8c1('0x13')||_0x21e34e===_0xc8c1('0x14')){return _0x227b6f;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xc8c1('0x4')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xc8c1('0x15')](0xb)},'timeout':{'type':Sequelize[_0xc8c1('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xc8c1('0x4')]},'weight':{'type':Sequelize[_0xc8c1('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xc8c1('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0xc8c1('0x16'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0xc8c1('0x1')](_0xc8c1('0x16'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xc8c1('0x15')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0xc8c1('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xc8c1('0x1')](_0xc8c1('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xc8c1('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xc8c1('0x1')](_0xc8c1('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xc8c1('0x1')](_0xc8c1('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xc8c1('0x1')](_0xc8c1('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xc8c1('0x1')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xc8c1('0x4')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xc8c1('0x4')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xc8c1('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xc8c1('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xc8c1('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xc8c1('0x1')](_0xc8c1('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xc8c1('0x1')](_0xc8c1('0x16'),'no'),'defaultValue':_0xc8c1('0x16')},'announce_holdtime':{'type':Sequelize[_0xc8c1('0x1')](_0xc8c1('0x16'),'no',_0xc8c1('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xc8c1('0x4')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xc8c1('0x1')](_0xc8c1('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0xc8c1('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xc8c1('0x1')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xc8c1('0x4')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xc8c1('0x4')]},'queue_youarenext':{'type':Sequelize[_0xc8c1('0x4')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xc8c1('0x4')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xc8c1('0x4')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xc8c1('0x4')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xc8c1('0x4')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xc8c1('0x4')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xc8c1('0x4')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xc8c1('0x4')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0xc8c1('0x4')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0xc8c1('0x4')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0xc8c1('0x18')],'set':function(_0x40d38f){this[_0xc8c1('0xa')](_0xc8c1('0x19'),_0x40d38f?_0x40d38f[_0xc8c1('0x1a')](','):[]);},'get':function(){return this['getDataValue'](_0xc8c1('0x19'))?this[_0xc8c1('0xd')](_0xc8c1('0x19'))[_0xc8c1('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0xc8c1('0x4')],'defaultValue':_0xc8c1('0x16'),'set':function(_0xf3e41c){this[_0xc8c1('0xa')](_0xc8c1('0x1c'),_0xf3e41c?_0xf3e41c['join'](','):undefined);},'get':function(){return this[_0xc8c1('0xd')](_0xc8c1('0x1c'))?this[_0xc8c1('0xd')](_0xc8c1('0x1c'))[_0xc8c1('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xc8c1('0x4')],'defaultValue':'no','set':function(_0x401568){this['setDataValue'](_0xc8c1('0x1d'),_0x401568?_0x401568[_0xc8c1('0x1a')](','):undefined);},'get':function(){return this['getDataValue'](_0xc8c1('0x1d'))?this[_0xc8c1('0xd')](_0xc8c1('0x1d'))[_0xc8c1('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xc8c1('0x1')](_0xc8c1('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xc8c1('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xc8c1('0x1')](_0xc8c1('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xc8c1('0x4')]},'description':{'type':Sequelize[_0xc8c1('0x4')]},'acw':{'type':Sequelize[_0xc8c1('0x1e')],'defaultValue':0x0,'set':function(_0x229b23){this[_0xc8c1('0xa')](_0xc8c1('0x1f'),_0x229b23);if(_0x229b23){if(this[_0xc8c1('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0xc8c1('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xc8c1('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xc8c1('0x1e')],'defaultValue':0x0,'comment':_0xc8c1('0x21')},'dialMethod':{'type':Sequelize[_0xc8c1('0x1')](_0xc8c1('0x22'),_0xc8c1('0x12'),'power',_0xc8c1('0x13'),_0xc8c1('0x10')),'defaultValue':_0xc8c1('0x12'),'comment':_0xc8c1('0x23')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0xc8c1('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xc8c1('0x25')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xc8c1('0x26')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0xc8c1('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xc8c1('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0xc8c1('0x1')](_0xc8c1('0x28'),'dropRate'),'defaultValue':'dropRate','comment':_0xc8c1('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xc8c1('0x2a')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0xc8c1('0x15')](0x3)[_0xc8c1('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xc8c1('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize[_0xc8c1('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xc8c1('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc8c1('0x2c')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0xc8c1('0x2d'),'comment':_0xc8c1('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0xc8c1('0x15')](0x3)[_0xc8c1('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc8c1('0x2f')},'dialQueueProject':{'type':Sequelize[_0xc8c1('0x4')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xc8c1('0x15')](0x3)[_0xc8c1('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc8c1('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc8c1('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc8c1('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0xc8c1('0x15')](0x3)[_0xc8c1('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc8c1('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc8c1('0x24')],'defaultValue':0x3,'comment':_0xc8c1('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc8c1('0x15')](0x5)[_0xc8c1('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xc8c1('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xc8c1('0x34')},'dialTimezone':{'type':Sequelize[_0xc8c1('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xc8c1('0x4')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xc8c1('0x35'),_0xc8c1('0x36'),_0xc8c1('0x37')),'defaultValue':_0xc8c1('0x35')},'dialAMDActive':{'type':Sequelize[_0xc8c1('0x1e')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xc8c1('0x15')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xc8c1('0x38')},'dialAMDGreeting':{'type':Sequelize[_0xc8c1('0x15')](0x9)[_0xc8c1('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc8c1('0x15')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc8c1('0x39')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc8c1('0x15')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xc8c1('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc8c1('0x3a')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc8c1('0x15')](0x9)[_0xc8c1('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc8c1('0x3b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xc8c1('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xc8c1('0x3c')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xc8c1('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xc8c1('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc8c1('0x3d')},'dialRecallMeTimeout':{'type':Sequelize[_0xc8c1('0x15')](0x5)[_0xc8c1('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xc8c1('0x3e')},'dialRecallInQueue':{'type':Sequelize[_0xc8c1('0x1e')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0xc8c1('0x1')](_0xc8c1('0x3f'),_0xc8c1('0x40')),'defaultValue':_0xc8c1('0x3f')},'dialQueueProject2':{'type':Sequelize[_0xc8c1('0x4')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0xc8c1('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xc8c1('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc8c1('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc8c1('0x41')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc8c1('0x42')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc8c1('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc8c1('0x43')},'dialDropMaxRetry':{'type':Sequelize[_0xc8c1('0x15')](0x3)[_0xc8c1('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc8c1('0x44')},'dialDropRetryFrequency':{'type':Sequelize[_0xc8c1('0x15')](0x5)[_0xc8c1('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc8c1('0x15')](0x3)[_0xc8c1('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc8c1('0x45')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc8c1('0x15')](0x5)[_0xc8c1('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc8c1('0x46')},'dialMachineMaxRetry':{'type':Sequelize[_0xc8c1('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xc8c1('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc8c1('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xc8c1('0x15')](0x3)[_0xc8c1('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc8c1('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xc8c1('0x15')](0x5)[_0xc8c1('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc8c1('0x49')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc8c1('0x15')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xc8c1('0x1e')],'defaultValue':![],'comment':_0xc8c1('0x4a'),'set':function(_0x295184){if(!_0x295184)this['setDataValue'](_0xc8c1('0x4b'),null);this[_0xc8c1('0xa')](_0xc8c1('0x4c'),_0x295184);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xc8c1('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xc8c1('0x15')](0x3)[_0xc8c1('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xacb5=['#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','ENUM','inbound','ringall','leastrecent','fewestcalls','random','rrmemory','linear','rrordered','strategy','getDataValue','type','dialMethod','booked','predictive','power','INTEGER','yes','all','once','setDataValue','periodic_announce','joinempty','join','split','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Busy\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xacb5,0xf4));var _0x5acb=function(_0x55c485,_0x3fe77e){_0x55c485=_0x55c485-0x0;var _0x6bb521=_0xacb5[_0x55c485];return _0x6bb521;};'use strict';var Sequelize=require(_0x5acb('0x0'));module['exports']={'name':{'type':Sequelize[_0x5acb('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x5acb('0x2')](_0x5acb('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x5acb('0x3')},'musiconhold':{'type':Sequelize[_0x5acb('0x1')],'defaultValue':'default'},'announce':{'type':Sequelize[_0x5acb('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x5acb('0x2')]('rr',_0x5acb('0x4'),_0x5acb('0x5'),_0x5acb('0x6'),_0x5acb('0x7'),_0x5acb('0x8'),_0x5acb('0x9'),'wrandom',_0x5acb('0xa')),'allowNull':![],'defaultValue':_0x5acb('0x4'),'set':function(_0x65f042){this['setDataValue'](_0x5acb('0xb'),_0x65f042?_0x65f042:_0x5acb('0x8'));},'get':function(){var _0x4c4fa6=this[_0x5acb('0xc')](_0x5acb('0xd'));var _0x46c6eb=this['getDataValue'](_0x5acb('0xe'));var _0x1af0ad=this[_0x5acb('0xc')](_0x5acb('0xb'));if(_0x4c4fa6===_0x5acb('0x3')){return _0x1af0ad;}if(_0x46c6eb===_0x5acb('0xf')&&_0x1af0ad===_0x5acb('0x8')||_0x46c6eb===_0x5acb('0xf')&&_0x1af0ad==='roundrobin'){return _0x1af0ad;}if(_0x46c6eb==='progressive'||_0x46c6eb===_0x5acb('0x10')||_0x46c6eb===_0x5acb('0x11')){return _0x1af0ad;}return null;}},'servicelevel':{'type':Sequelize[_0x5acb('0x12')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x5acb('0x12')](0xb)},'timeout':{'type':Sequelize[_0x5acb('0x12')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x5acb('0x1')]},'weight':{'type':Sequelize[_0x5acb('0x12')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x5acb('0x12')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x5acb('0x2')](_0x5acb('0x13'),'no'),'defaultValue':_0x5acb('0x13')},'autopause':{'type':Sequelize[_0x5acb('0x2')](_0x5acb('0x13'),'no',_0x5acb('0x14')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x5acb('0x2')](_0x5acb('0x13'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x5acb('0x2')](_0x5acb('0x13'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x5acb('0x12')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x5acb('0x2')](_0x5acb('0x13'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x5acb('0x2')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x5acb('0x2')](_0x5acb('0x13'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x5acb('0x2')](_0x5acb('0x13'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x5acb('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x5acb('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x5acb('0x12')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x5acb('0x12')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x5acb('0x2')](_0x5acb('0x13'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x5acb('0x2')](_0x5acb('0x13'),'no'),'defaultValue':_0x5acb('0x13')},'announce_holdtime':{'type':Sequelize[_0x5acb('0x2')](_0x5acb('0x13'),'no',_0x5acb('0x15')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x5acb('0x2')](_0x5acb('0x13'),'no')},'announce_position_limit':{'type':Sequelize[_0x5acb('0x12')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x5acb('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x5acb('0x1')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x5acb('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x5acb('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x5acb('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x5acb('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x5acb('0x1')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x5acb('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0x5acb('0x1')]},'queue_less_than':{'type':Sequelize[_0x5acb('0x1')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x6d3276){this[_0x5acb('0x16')](_0x5acb('0x17'),_0x6d3276?_0x6d3276['join'](','):[]);},'get':function(){return this['getDataValue']('periodic_announce')?this[_0x5acb('0xc')](_0x5acb('0x17'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x5acb('0x1')],'defaultValue':'yes','set':function(_0x17ac01){this[_0x5acb('0x16')](_0x5acb('0x18'),_0x17ac01?_0x17ac01[_0x5acb('0x19')](','):undefined);},'get':function(){return this[_0x5acb('0xc')]('joinempty')?this['getDataValue'](_0x5acb('0x18'))[_0x5acb('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x5acb('0x1')],'defaultValue':'no','set':function(_0x34a334){this[_0x5acb('0x16')](_0x5acb('0x1b'),_0x34a334?_0x34a334[_0x5acb('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x5acb('0x1b'))?this[_0x5acb('0xc')](_0x5acb('0x1b'))[_0x5acb('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x5acb('0x2')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x5acb('0x2')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x5acb('0x13'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x5acb('0x1')]},'description':{'type':Sequelize[_0x5acb('0x1')]},'acw':{'type':Sequelize[_0x5acb('0x1c')],'defaultValue':0x0,'set':function(_0x2a8f3c){this[_0x5acb('0x16')](_0x5acb('0x1d'),_0x2a8f3c);if(_0x2a8f3c){if(this[_0x5acb('0xc')](_0x5acb('0x1e'))<0x2){this[_0x5acb('0x16')](_0x5acb('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x5acb('0x1c')],'defaultValue':0x0,'comment':_0x5acb('0x1f')},'dialMethod':{'type':Sequelize[_0x5acb('0x2')](_0x5acb('0x20'),_0x5acb('0x21'),_0x5acb('0x11'),_0x5acb('0x10'),_0x5acb('0xf')),'defaultValue':'progressive','comment':_0x5acb('0x22')},'dialLimitChannel':{'type':Sequelize[_0x5acb('0x12')](0x4)[_0x5acb('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x5acb('0x12')](0x4)[_0x5acb('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x5acb('0x24')},'dialPowerLevel':{'type':Sequelize[_0x5acb('0x25')](0x2)[_0x5acb('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x5acb('0x26'),_0x5acb('0x27')),'defaultValue':_0x5acb('0x27'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x5acb('0x25')](0x2)[_0x5acb('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x5acb('0x28')},'dialPredictiveInterval':{'type':Sequelize[_0x5acb('0x12')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x5acb('0x29')},'dialOriginateCallerIdName':{'type':Sequelize[_0x5acb('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x5acb('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x5acb('0x12')](0x3)[_0x5acb('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5acb('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x5acb('0x1')],'defaultValue':'tTxX','comment':_0x5acb('0x2b')},'dialQueueTimeout':{'type':Sequelize[_0x5acb('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x5acb('0x1')],'comment':_0x5acb('0x2c')},'dialCongestionMaxRetry':{'type':Sequelize[_0x5acb('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x5acb('0x12')](0x5)[_0x5acb('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x5acb('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5acb('0x2d')},'dialBusyRetryFrequency':{'type':Sequelize[_0x5acb('0x12')](0x5)[_0x5acb('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x5acb('0x12')](0x3)[_0x5acb('0x23')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x5acb('0x12')](0x5)[_0x5acb('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x5acb('0x12')](0x3)[_0x5acb('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x5acb('0x2e')},'dialTimezone':{'type':Sequelize[_0x5acb('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x5acb('0x1')],'defaultValue':_0x5acb('0x2f')},'dialPrefix':{'type':Sequelize[_0x5acb('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x5acb('0x2')](_0x5acb('0x30'),_0x5acb('0x31'),_0x5acb('0x32')),'defaultValue':_0x5acb('0x30')},'dialAMDActive':{'type':Sequelize[_0x5acb('0x1c')],'defaultValue':0x0,'comment':_0x5acb('0x33')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x5acb('0x34')},'dialAMDGreeting':{'type':Sequelize[_0x5acb('0x12')](0x9)[_0x5acb('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x5acb('0x35')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x5acb('0x12')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x5acb('0x36')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x5acb('0x12')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5acb('0x37')},'dialAMDMinWordLength':{'type':Sequelize[_0x5acb('0x12')](0x9)[_0x5acb('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x5acb('0x38')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x5acb('0x12')](0x9)[_0x5acb('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x5acb('0x39')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x5acb('0x12')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x5acb('0x3a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x5acb('0x12')](0x5)[_0x5acb('0x23')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x5acb('0x3b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x5acb('0x12')](0x9)[_0x5acb('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5acb('0x3c')},'dialRecallMeTimeout':{'type':Sequelize[_0x5acb('0x12')](0x5)[_0x5acb('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x5acb('0x3d')},'dialRecallInQueue':{'type':Sequelize[_0x5acb('0x1c')],'defaultValue':0x0,'comment':_0x5acb('0x3e')},'dialOrderByScheduledAt':{'type':Sequelize[_0x5acb('0x2')](_0x5acb('0x3f'),_0x5acb('0x40')),'defaultValue':_0x5acb('0x3f')},'dialQueueProject2':{'type':Sequelize[_0x5acb('0x1')],'comment':_0x5acb('0x2c')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x5acb('0x1c')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x5acb('0x1c')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x5acb('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5acb('0x41')},'dialCutDigit':{'type':Sequelize[_0x5acb('0x12')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x5acb('0x12')](0x3)[_0x5acb('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5acb('0x42')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x5acb('0x12')](0x5)[_0x5acb('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5acb('0x43')},'dialDropMaxRetry':{'type':Sequelize[_0x5acb('0x12')](0x3)[_0x5acb('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x5acb('0x12')](0x5)[_0x5acb('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x5acb('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5acb('0x44')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x5acb('0x12')](0x5)[_0x5acb('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5acb('0x45')},'dialMachineMaxRetry':{'type':Sequelize[_0x5acb('0x12')](0x3)[_0x5acb('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5acb('0x46')},'dialMachineRetryFrequency':{'type':Sequelize[_0x5acb('0x12')](0x5)[_0x5acb('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5acb('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5acb('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5acb('0x48')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5acb('0x12')],'allowNull':!![],'comment':_0x5acb('0x49')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xf152c3){if(!_0xf152c3)this[_0x5acb('0x16')](_0x5acb('0x4a'),null);this['setDataValue'](_0x5acb('0x4b'),_0xf152c3);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x5acb('0x12')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x5acb('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x5acb('0x1c')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 820e7d3..d790040 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 _0xb397=['UserVoiceQueueRt','upsert','isNil','format','SIP/%s','forEach','removeTeams','field','tq.TeamId','from','team_has_voice_queues','VoiceQueueId\x20=\x20?','clone','sequelize','toString','QueryTypes','SELECT','every','includes','all','union','compact','ids','isEmpty','removeAgents','emit','userVoiceQueue:remove','addAgents','spread','userVoiceQueue:save','User','online','push','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','ContactId','ListId','select','phone','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','scheduledAt','removeLists','getBlackLists','addBlackLists','removeBlackLists','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','find','type','name','UserProfileResource','destroy','error','send','index','VoiceQueue','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','params','keys','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rawAttributes','omit','createdAt','updatedAt','getHoppers','findOne','CmHopper','order','VoiceQueueId','getHopperHistories','CmHopperHistory','rows','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','Agents','voicePause','interface','penalty','transaction','each','TeamVoiceQueue','UserVoiceQueue','findOrCreate'];(function(_0xa4928c,_0x16b89c){var _0x27cc29=function(_0x14b819){while(--_0x14b819){_0xa4928c['push'](_0xa4928c['shift']());}};_0x27cc29(++_0x16b89c);}(_0xb397,0x1af));var _0x7b39=function(_0x11c3d1,_0x22a48d){_0x11c3d1=_0x11c3d1-0x0;var _0x4ee373=_0xb397[_0x11c3d1];return _0x4ee373;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7b39('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b39('0x1'));var rp=require(_0x7b39('0x2'));var moment=require(_0x7b39('0x3'));var BPromise=require(_0x7b39('0x4'));var Mustache=require(_0x7b39('0x5'));var util=require(_0x7b39('0x6'));var path=require('path');var sox=require(_0x7b39('0x7'));var csv=require('to-csv');var ejs=require(_0x7b39('0x8'));var fs=require('fs');var fs_extra=require(_0x7b39('0x9'));var _=require(_0x7b39('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7b39('0xb'));var deskjs=require(_0x7b39('0xc'));var toCsv=require(_0x7b39('0xd'));var querystring=require(_0x7b39('0xe'));var Papa=require('papaparse');var Redis=require(_0x7b39('0xf'));var authService=require(_0x7b39('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7b39('0x11'));var hardwareService=require(_0x7b39('0x12'));var logger=require('../../config/logger')(_0x7b39('0x13'));var utils=require(_0x7b39('0x14'));var config=require(_0x7b39('0x15'));var licenseUtil=require(_0x7b39('0x16'));var db=require(_0x7b39('0x17'))['db'];config[_0x7b39('0x18')]=_[_0x7b39('0x19')](config[_0x7b39('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x7b39('0x1a'))(new Redis(config['redis']));require(_0x7b39('0x1b'))[_0x7b39('0x1c')](socket);function respondWithStatusCode(_0x518ec2,_0x124fd3){_0x124fd3=_0x124fd3||0xcc;return function(_0x1d8be5){if(_0x1d8be5){return _0x518ec2[_0x7b39('0x1d')](_0x124fd3);}return _0x518ec2[_0x7b39('0x1e')](_0x124fd3)[_0x7b39('0x1f')]();};}function respondWithResult(_0x377b40,_0x1895d9){_0x1895d9=_0x1895d9||0xc8;return function(_0x46a8f9){if(_0x46a8f9){return _0x377b40['status'](_0x1895d9)[_0x7b39('0x20')](_0x46a8f9);}};}function respondWithFilteredResult(_0x422979,_0x5eb85d){return function(_0x184f4){if(_0x184f4){var _0x3b2dbf=typeof _0x5eb85d['offset']===_0x7b39('0x21')&&typeof _0x5eb85d[_0x7b39('0x22')]==='undefined';var _0x48c352=_0x184f4[_0x7b39('0x23')];var _0xc69113=_0x3b2dbf?0x0:_0x5eb85d[_0x7b39('0x24')];var _0x2a947f=_0x3b2dbf?_0x184f4[_0x7b39('0x23')]:_0x5eb85d[_0x7b39('0x24')]+_0x5eb85d[_0x7b39('0x22')];var _0x2809b7;if(_0x2a947f>=_0x48c352){_0x2a947f=_0x48c352;_0x2809b7=0xc8;}else{_0x2809b7=0xce;}_0x422979[_0x7b39('0x1e')](_0x2809b7);return _0x422979['set']('Content-Range',_0xc69113+'-'+_0x2a947f+'/'+_0x48c352)[_0x7b39('0x20')](_0x184f4);}return null;};}function patchUpdates(_0x11a836){return function(_0x12d4f8){try{jsonpatch[_0x7b39('0x25')](_0x12d4f8,_0x11a836,!![]);}catch(_0x278e4c){return BPromise[_0x7b39('0x26')](_0x278e4c);}return _0x12d4f8[_0x7b39('0x27')]();};}function saveUpdates(_0x1c8a4f,_0x2e55f5){return function(_0x540b90){if(_0x540b90){return _0x540b90[_0x7b39('0x28')](_0x1c8a4f)['then'](function(_0x13ac20){return _0x13ac20;});}return null;};}function removeEntity(_0x2afaa4,_0x5c9898){return function(_0x396977){if(_0x396977){return _0x396977['destroy']()[_0x7b39('0x29')](function(){var _0x549c1d=_0x396977['get']({'plain':!![]});var _0x1313dc=[{'name':_0x7b39('0x2a'),'value':_0x7b39('0x2b'),'ignore':![]},{'name':_0x7b39('0x2c'),'value':_0x7b39('0x2d'),'ignore':![]}];var _0x986aeb=_(_0x1313dc)[_0x7b39('0x2e')](_0x7b39('0x2f'))[_0x7b39('0x30')]('value')[_0x7b39('0x31')]();if(_['includes'](_0x986aeb,_0x549c1d['type'])){return;}var _0x4ab898=_[_0x7b39('0x32')](_0x1313dc,['value',_0x549c1d[_0x7b39('0x33')]])[_0x7b39('0x34')];return db[_0x7b39('0x35')][_0x7b39('0x36')]({'where':{'type':_0x4ab898,'resourceId':_0x549c1d['id']}})['then'](function(){return _0x396977;});})[_0x7b39('0x29')](function(){_0x2afaa4[_0x7b39('0x1e')](0xcc)[_0x7b39('0x1f')]();});}};}function handleEntityNotFound(_0x18deb5,_0x1b5b74){return function(_0x1405b1){if(!_0x1405b1){_0x18deb5[_0x7b39('0x1d')](0x194);}return _0x1405b1;};}function handleError(_0x123eaa,_0xcd8be){_0xcd8be=_0xcd8be||0x1f4;return function(_0x3bf7eb){logger[_0x7b39('0x37')](_0x3bf7eb['stack']);if(_0x3bf7eb[_0x7b39('0x34')]){delete _0x3bf7eb[_0x7b39('0x34')];}_0x123eaa[_0x7b39('0x1e')](_0xcd8be)[_0x7b39('0x38')](_0x3bf7eb);};}exports[_0x7b39('0x39')]=function(_0x299d75,_0x1e620e){var _0x2914d3={},_0x2430b5={},_0x2e21af={'count':0x0,'rows':[]};var _0x33e706=_['map'](db[_0x7b39('0x3a')]['rawAttributes'],function(_0x440fc0){return{'name':_0x440fc0[_0x7b39('0x3b')],'type':_0x440fc0[_0x7b39('0x33')][_0x7b39('0x3c')]};});_0x2430b5[_0x7b39('0x3d')]=_[_0x7b39('0x30')](_0x33e706,_0x7b39('0x34'));_0x2430b5[_0x7b39('0x3e')]=_['keys'](_0x299d75[_0x7b39('0x3e')]);_0x2430b5[_0x7b39('0x3f')]=_[_0x7b39('0x40')](_0x2430b5[_0x7b39('0x3d')],_0x2430b5['query']);_0x2914d3[_0x7b39('0x41')]=_['intersection'](_0x2430b5['model'],qs[_0x7b39('0x42')](_0x299d75[_0x7b39('0x3e')]['fields']));_0x2914d3['attributes']=_0x2914d3[_0x7b39('0x41')][_0x7b39('0x43')]?_0x2914d3[_0x7b39('0x41')]:_0x2430b5[_0x7b39('0x3d')];if(!_0x299d75[_0x7b39('0x3e')][_0x7b39('0x44')](_0x7b39('0x45'))){_0x2914d3[_0x7b39('0x22')]=qs[_0x7b39('0x22')](_0x299d75['query']['limit']);_0x2914d3['offset']=qs[_0x7b39('0x24')](_0x299d75['query'][_0x7b39('0x24')]);}_0x2914d3['order']=qs[_0x7b39('0x46')](_0x299d75['query'][_0x7b39('0x46')]);_0x2914d3[_0x7b39('0x47')]=qs['filters'](_[_0x7b39('0x48')](_0x299d75[_0x7b39('0x3e')],_0x2430b5['filters']),_0x33e706);if(_0x299d75[_0x7b39('0x3e')][_0x7b39('0x2e')]){_0x2914d3[_0x7b39('0x47')]=_[_0x7b39('0x49')](_0x2914d3[_0x7b39('0x47')],{'$or':_[_0x7b39('0x30')](_0x33e706,function(_0xa535a5){if(_0xa535a5['type']!==_0x7b39('0x4a')){var _0x2e335c={};_0x2e335c[_0xa535a5[_0x7b39('0x34')]]={'$like':'%'+_0x299d75[_0x7b39('0x3e')][_0x7b39('0x2e')]+'%'};return _0x2e335c;}})});}_0x2914d3=_[_0x7b39('0x49')]({},_0x2914d3,_0x299d75[_0x7b39('0x4b')]);var _0x313214={'where':_0x2914d3[_0x7b39('0x47')]};return db[_0x7b39('0x3a')]['count'](_0x313214)[_0x7b39('0x29')](function(_0x219c97){_0x2e21af[_0x7b39('0x23')]=_0x219c97;if(_0x299d75['query'][_0x7b39('0x4c')]){_0x2914d3[_0x7b39('0x4d')]=[{'all':!![]}];}return db['VoiceQueue'][_0x7b39('0x4e')](_0x2914d3);})[_0x7b39('0x29')](function(_0x5429f4){_0x2e21af['rows']=_0x5429f4;return _0x2e21af;})[_0x7b39('0x29')](respondWithFilteredResult(_0x1e620e,_0x2914d3))['catch'](handleError(_0x1e620e,null));};exports['show']=function(_0x1bbb60,_0x17221e){var _0x1b43cf={'raw':![],'where':{'id':_0x1bbb60[_0x7b39('0x4f')]['id']}},_0x1611a7={};_0x1611a7[_0x7b39('0x3d')]=_[_0x7b39('0x50')](db['VoiceQueue']['rawAttributes']);_0x1611a7['query']=_[_0x7b39('0x50')](_0x1bbb60[_0x7b39('0x3e')]);_0x1611a7[_0x7b39('0x3f')]=_['intersection'](_0x1611a7['model'],_0x1611a7['query']);_0x1b43cf[_0x7b39('0x41')]=_['intersection'](_0x1611a7['model'],qs[_0x7b39('0x42')](_0x1bbb60[_0x7b39('0x3e')][_0x7b39('0x42')]));_0x1b43cf[_0x7b39('0x41')]=_0x1b43cf['attributes'][_0x7b39('0x43')]?_0x1b43cf['attributes']:_0x1611a7[_0x7b39('0x3d')];if(_0x1bbb60[_0x7b39('0x3e')][_0x7b39('0x4c')]){_0x1b43cf[_0x7b39('0x4d')]=[{'all':!![]}];}_0x1b43cf=_[_0x7b39('0x49')]({},_0x1b43cf,_0x1bbb60['options']);return db[_0x7b39('0x3a')]['find'](_0x1b43cf)[_0x7b39('0x29')](handleEntityNotFound(_0x17221e,null))[_0x7b39('0x29')](respondWithResult(_0x17221e,null))[_0x7b39('0x51')](handleError(_0x17221e,null));};exports[_0x7b39('0x52')]=function(_0x5738f3,_0x5283cc){return db[_0x7b39('0x3a')][_0x7b39('0x52')](_0x5738f3[_0x7b39('0x53')],{})[_0x7b39('0x29')](function(_0x336a02){var _0x15ddf1=_0x5738f3['user'][_0x7b39('0x54')]({'plain':!![]});if(!_0x15ddf1)throw new Error(_0x7b39('0x55'));if(_0x15ddf1[_0x7b39('0x56')]===_0x7b39('0x57')){var _0x30ecb9=_0x336a02[_0x7b39('0x54')]({'plain':!![]});var _0x4118bc=[{'name':_0x7b39('0x2a'),'value':_0x7b39('0x2b')},{'name':'QueueCampaigns','value':_0x7b39('0x2d')}];var _0xe3a139=_['find'](_0x4118bc,[_0x7b39('0x31'),_0x30ecb9['type']])[_0x7b39('0x34')];return db[_0x7b39('0x58')][_0x7b39('0x32')]({'where':{'name':_0xe3a139,'userProfileId':_0x15ddf1[_0x7b39('0x59')]},'raw':!![]})[_0x7b39('0x29')](function(_0x38a1e6){if(_0x38a1e6&&_0x38a1e6[_0x7b39('0x5a')]===0x0){return db[_0x7b39('0x35')][_0x7b39('0x52')]({'name':_0x30ecb9[_0x7b39('0x34')],'resourceId':_0x30ecb9['id'],'type':_0x38a1e6[_0x7b39('0x34')],'sectionId':_0x38a1e6['id']},{})[_0x7b39('0x29')](function(){return _0x336a02;});}else{return _0x336a02;}})[_0x7b39('0x51')](function(_0x3b4238){logger[_0x7b39('0x37')](_0x7b39('0x5b'),_0x3b4238);throw _0x3b4238;});}return _0x336a02;})['then'](respondWithResult(_0x5283cc,0xc9))[_0x7b39('0x51')](handleError(_0x5283cc,null));};exports['clone']=function(_0x405474,_0x3891f5){var _0x12e966={'where':{'id':_0x405474['params']['id']}},_0x3b90d9={};_0x3b90d9[_0x7b39('0x3d')]=_['keys'](db[_0x7b39('0x3a')][_0x7b39('0x5c')]);_0x12e966['attributes']=_['intersection'](_0x3b90d9[_0x7b39('0x3d')],qs[_0x7b39('0x42')](_0x405474['query'][_0x7b39('0x42')]));_0x12e966[_0x7b39('0x41')]=_0x12e966[_0x7b39('0x41')][_0x7b39('0x43')]?_0x12e966[_0x7b39('0x41')]:_0x3b90d9[_0x7b39('0x3d')];if(_0x405474[_0x7b39('0x3e')][_0x7b39('0x4c')]){_0x12e966[_0x7b39('0x4d')]=[{'all':!![]}];}_0x12e966=_[_0x7b39('0x49')]({},_0x12e966,_0x405474[_0x7b39('0x4b')]);return db['VoiceQueue']['find'](_0x12e966)[_0x7b39('0x29')](handleEntityNotFound(_0x3891f5,null))[_0x7b39('0x29')](function(_0x4ee686){if(_0x4ee686){var _0x1cc40f=_0x4ee686[_0x7b39('0x54')]({'plain':!![]});_0x1cc40f=qs[_0x7b39('0x5d')](_0x1cc40f,['id',_0x7b39('0x5e'),_0x7b39('0x5f')]);_0x405474[_0x7b39('0x53')]=_[_0x7b39('0x5d')](_0x405474['body'],['id',_0x7b39('0x5e'),_0x7b39('0x5f')]);return db[_0x7b39('0x3a')][_0x7b39('0x52')](_[_0x7b39('0x49')](_0x1cc40f,_0x405474[_0x7b39('0x53')]),{'include':_0x405474[_0x7b39('0x3e')][_0x7b39('0x4c')]?[{'all':!![]}]:undefined})[_0x7b39('0x29')](function(_0x2097b9){var _0x3fa16a=_0x405474['user'][_0x7b39('0x54')]({'plain':!![]});if(!_0x3fa16a)throw new Error(_0x7b39('0x55'));if(_0x3fa16a[_0x7b39('0x56')]===_0x7b39('0x57')){var _0x44c523=_0x2097b9[_0x7b39('0x54')]({'plain':!![]});var _0x47d180=[{'name':_0x7b39('0x2a'),'value':'inbound'},{'name':_0x7b39('0x2c'),'value':'outbound'}];var _0x2b535a=_['find'](_0x47d180,[_0x7b39('0x31'),_0x44c523[_0x7b39('0x33')]])[_0x7b39('0x34')];return db[_0x7b39('0x58')][_0x7b39('0x32')]({'where':{'name':_0x2b535a,'userProfileId':_0x3fa16a[_0x7b39('0x59')]},'raw':!![]})[_0x7b39('0x29')](function(_0x590a0f){if(_0x590a0f&&_0x590a0f[_0x7b39('0x5a')]===0x0){return db[_0x7b39('0x35')]['create']({'name':_0x44c523['name'],'resourceId':_0x44c523['id'],'type':_0x590a0f['name'],'sectionId':_0x590a0f['id']},{})[_0x7b39('0x29')](function(){return _0x2097b9;});}else{return _0x2097b9;}})[_0x7b39('0x51')](function(_0x419544){logger[_0x7b39('0x37')](_0x7b39('0x5b'),_0x419544);throw _0x419544;});}return _0x2097b9;});}})[_0x7b39('0x29')](respondWithResult(_0x3891f5,0xc9))['catch'](handleError(_0x3891f5,null));};exports[_0x7b39('0x28')]=function(_0x49a242,_0x365887){if(_0x49a242[_0x7b39('0x53')]['id']){delete _0x49a242[_0x7b39('0x53')]['id'];}return db['VoiceQueue'][_0x7b39('0x32')]({'where':{'id':_0x49a242[_0x7b39('0x4f')]['id']}})[_0x7b39('0x29')](handleEntityNotFound(_0x365887,null))[_0x7b39('0x29')](saveUpdates(_0x49a242[_0x7b39('0x53')],null))[_0x7b39('0x29')](respondWithResult(_0x365887,null))['catch'](handleError(_0x365887,null));};exports[_0x7b39('0x36')]=function(_0x3155a1,_0x54616d){return db[_0x7b39('0x3a')]['find']({'where':{'id':_0x3155a1[_0x7b39('0x4f')]['id']}})['then'](handleEntityNotFound(_0x54616d,null))[_0x7b39('0x29')](removeEntity(_0x54616d,null))[_0x7b39('0x51')](handleError(_0x54616d,null));};exports[_0x7b39('0x60')]=function(_0x4d70ca,_0x206616,_0x291c52){var _0x2961d8={'raw':![],'where':{}};var _0x4e5861={};var _0x5d0425={'count':0x0,'rows':[]};return db[_0x7b39('0x3a')][_0x7b39('0x61')]({'where':{'id':_0x4d70ca[_0x7b39('0x4f')]['id']}})['then'](handleEntityNotFound(_0x206616,null))['then'](function(_0x39b841){if(_0x39b841){_0x4e5861[_0x7b39('0x3d')]=_[_0x7b39('0x50')](db[_0x7b39('0x62')][_0x7b39('0x5c')]);_0x4e5861[_0x7b39('0x3e')]=_['keys'](_0x4d70ca[_0x7b39('0x3e')]);_0x4e5861[_0x7b39('0x3f')]=_['intersection'](_0x4e5861[_0x7b39('0x3d')],_0x4e5861[_0x7b39('0x3e')]);_0x2961d8['attributes']=_['intersection'](_0x4e5861[_0x7b39('0x3d')],qs[_0x7b39('0x42')](_0x4d70ca[_0x7b39('0x3e')][_0x7b39('0x42')]));_0x2961d8[_0x7b39('0x41')]=_0x2961d8['attributes']['length']?_0x2961d8[_0x7b39('0x41')]:_0x4e5861[_0x7b39('0x3d')];if(!_0x4d70ca['query'][_0x7b39('0x44')](_0x7b39('0x45'))){_0x2961d8[_0x7b39('0x22')]=qs['limit'](_0x4d70ca[_0x7b39('0x3e')][_0x7b39('0x22')]);_0x2961d8[_0x7b39('0x24')]=qs['offset'](_0x4d70ca[_0x7b39('0x3e')][_0x7b39('0x24')]);}_0x2961d8[_0x7b39('0x63')]=qs[_0x7b39('0x46')](_0x4d70ca[_0x7b39('0x3e')]['sort']);_0x2961d8[_0x7b39('0x47')]=qs['filters'](_[_0x7b39('0x48')](_0x4d70ca[_0x7b39('0x3e')],_0x4e5861[_0x7b39('0x3f')]));_0x2961d8['where'][_0x7b39('0x64')]=_0x39b841['id'];if(_0x4d70ca[_0x7b39('0x3e')]['filter']){_0x2961d8[_0x7b39('0x47')]=_[_0x7b39('0x49')](_0x2961d8[_0x7b39('0x47')],{'$or':_['map'](_0x2961d8['attributes'],function(_0x5995f2){var _0x54ea24={};_0x54ea24[_0x5995f2]={'$like':'%'+_0x4d70ca[_0x7b39('0x3e')][_0x7b39('0x2e')]+'%'};return _0x54ea24;})});}_0x2961d8=_[_0x7b39('0x49')]({},_0x2961d8,_0x4d70ca[_0x7b39('0x4b')]);return db[_0x7b39('0x62')][_0x7b39('0x23')]({'where':_0x2961d8[_0x7b39('0x47')]})[_0x7b39('0x29')](function(_0x3edea2){_0x5d0425['count']=_0x3edea2;if(_0x4d70ca[_0x7b39('0x3e')][_0x7b39('0x4c')]){_0x2961d8[_0x7b39('0x4d')]=[{'all':!![]}];}return db[_0x7b39('0x62')][_0x7b39('0x4e')](_0x2961d8);})[_0x7b39('0x29')](function(_0x17a23f){_0x5d0425['rows']=_0x17a23f;return _0x5d0425;});}})[_0x7b39('0x29')](respondWithFilteredResult(_0x206616,_0x2961d8))[_0x7b39('0x51')](handleError(_0x206616,null));};exports[_0x7b39('0x65')]=function(_0x4a8189,_0x3f157f,_0x1218bf){var _0x2ec298={'raw':!![],'where':{}};var _0x2f2c66={};var _0x162d9e={'count':0x0,'rows':[]};return db[_0x7b39('0x3a')]['findOne']({'where':{'id':_0x4a8189['params']['id']}})[_0x7b39('0x29')](handleEntityNotFound(_0x3f157f,null))['then'](function(_0x4f37df){if(_0x4f37df){_0x2f2c66[_0x7b39('0x3d')]=_[_0x7b39('0x50')](db[_0x7b39('0x66')][_0x7b39('0x5c')]);_0x2f2c66[_0x7b39('0x3e')]=_[_0x7b39('0x50')](_0x4a8189['query']);_0x2f2c66[_0x7b39('0x3f')]=_[_0x7b39('0x40')](_0x2f2c66[_0x7b39('0x3d')],_0x2f2c66['query']);_0x2ec298[_0x7b39('0x41')]=_['intersection'](_0x2f2c66[_0x7b39('0x3d')],qs['fields'](_0x4a8189[_0x7b39('0x3e')]['fields']));_0x2ec298[_0x7b39('0x41')]=_0x2ec298[_0x7b39('0x41')][_0x7b39('0x43')]?_0x2ec298[_0x7b39('0x41')]:_0x2f2c66['model'];if(!_0x4a8189[_0x7b39('0x3e')][_0x7b39('0x44')](_0x7b39('0x45'))){_0x2ec298[_0x7b39('0x22')]=qs[_0x7b39('0x22')](_0x4a8189[_0x7b39('0x3e')][_0x7b39('0x22')]);_0x2ec298[_0x7b39('0x24')]=qs[_0x7b39('0x24')](_0x4a8189[_0x7b39('0x3e')]['offset']);}_0x2ec298[_0x7b39('0x63')]=qs['sort'](_0x4a8189[_0x7b39('0x3e')][_0x7b39('0x46')]);_0x2ec298[_0x7b39('0x47')]=qs['filters'](_[_0x7b39('0x48')](_0x4a8189[_0x7b39('0x3e')],_0x2f2c66['filters']));_0x2ec298[_0x7b39('0x47')]['VoiceQueueId']=_0x4f37df['id'];if(_0x4a8189['query'][_0x7b39('0x2e')]){_0x2ec298[_0x7b39('0x47')]=_[_0x7b39('0x49')](_0x2ec298['where'],{'$or':_[_0x7b39('0x30')](_0x2ec298['attributes'],function(_0x3f4ef9){var _0x49eb21={};_0x49eb21[_0x3f4ef9]={'$like':'%'+_0x4a8189[_0x7b39('0x3e')][_0x7b39('0x2e')]+'%'};return _0x49eb21;})});}_0x2ec298=_[_0x7b39('0x49')]({},_0x2ec298,_0x4a8189[_0x7b39('0x4b')]);return db[_0x7b39('0x66')][_0x7b39('0x23')]({'where':_0x2ec298[_0x7b39('0x47')]})['then'](function(_0x4a9ca9){_0x162d9e[_0x7b39('0x23')]=_0x4a9ca9;if(_0x4a8189[_0x7b39('0x3e')][_0x7b39('0x4c')]){_0x2ec298[_0x7b39('0x4d')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x7b39('0x4e')](_0x2ec298);})[_0x7b39('0x29')](function(_0x41c26d){_0x162d9e[_0x7b39('0x67')]=_0x41c26d;return _0x162d9e;});}})[_0x7b39('0x29')](respondWithFilteredResult(_0x3f157f,_0x2ec298))[_0x7b39('0x51')](handleError(_0x3f157f,null));};exports[_0x7b39('0x68')]=function(_0x5c607c,_0x5ef365,_0x269fe7){var _0x29ce7d={'raw':!![],'where':{}};var _0x332ece={};var _0x31db73={'count':0x0,'rows':[]};return db[_0x7b39('0x3a')]['findOne']({'where':{'id':_0x5c607c[_0x7b39('0x4f')]['id']}})[_0x7b39('0x29')](handleEntityNotFound(_0x5ef365,null))[_0x7b39('0x29')](function(_0x218a9e){if(_0x218a9e){_0x332ece[_0x7b39('0x3d')]=_[_0x7b39('0x50')](db[_0x7b39('0x69')][_0x7b39('0x5c')]);_0x332ece['query']=_['keys'](_0x5c607c[_0x7b39('0x3e')]);_0x332ece[_0x7b39('0x3f')]=_[_0x7b39('0x40')](_0x332ece[_0x7b39('0x3d')],_0x332ece[_0x7b39('0x3e')]);_0x29ce7d[_0x7b39('0x41')]=_['intersection'](_0x332ece[_0x7b39('0x3d')],qs['fields'](_0x5c607c[_0x7b39('0x3e')][_0x7b39('0x42')]));_0x29ce7d['attributes']=_0x29ce7d[_0x7b39('0x41')]['length']?_0x29ce7d['attributes']:_0x332ece[_0x7b39('0x3d')];if(!_0x5c607c['query'][_0x7b39('0x44')](_0x7b39('0x45'))){_0x29ce7d[_0x7b39('0x22')]=qs['limit'](_0x5c607c[_0x7b39('0x3e')]['limit']);_0x29ce7d[_0x7b39('0x24')]=qs[_0x7b39('0x24')](_0x5c607c[_0x7b39('0x3e')][_0x7b39('0x24')]);}_0x29ce7d[_0x7b39('0x63')]=qs['sort'](_0x5c607c[_0x7b39('0x3e')][_0x7b39('0x46')]);_0x29ce7d[_0x7b39('0x47')]=qs[_0x7b39('0x3f')](_[_0x7b39('0x48')](_0x5c607c['query'],_0x332ece[_0x7b39('0x3f')]));_0x29ce7d[_0x7b39('0x47')][_0x7b39('0x64')]=_0x218a9e['id'];if(_0x5c607c[_0x7b39('0x3e')][_0x7b39('0x2e')]){_0x29ce7d[_0x7b39('0x47')]=_[_0x7b39('0x49')](_0x29ce7d['where'],{'$or':_[_0x7b39('0x30')](_0x29ce7d[_0x7b39('0x41')],function(_0xc80964){var _0x396b84={};_0x396b84[_0xc80964]={'$like':'%'+_0x5c607c[_0x7b39('0x3e')][_0x7b39('0x2e')]+'%'};return _0x396b84;})});}_0x29ce7d=_[_0x7b39('0x49')]({},_0x29ce7d,_0x5c607c[_0x7b39('0x4b')]);return db[_0x7b39('0x69')][_0x7b39('0x23')]({'where':_0x29ce7d[_0x7b39('0x47')]})[_0x7b39('0x29')](function(_0x634e60){_0x31db73['count']=_0x634e60;if(_0x5c607c[_0x7b39('0x3e')][_0x7b39('0x4c')]){_0x29ce7d[_0x7b39('0x4d')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x7b39('0x4e')](_0x29ce7d);})[_0x7b39('0x29')](function(_0x34d31b){_0x31db73[_0x7b39('0x67')]=_0x34d31b;return _0x31db73;});}})[_0x7b39('0x29')](respondWithFilteredResult(_0x5ef365,_0x29ce7d))['catch'](handleError(_0x5ef365,null));};exports[_0x7b39('0x6a')]=function(_0x252e32,_0x59310,_0x4efc35){var _0x194265={'raw':!![],'where':{}};var _0x1978d1={};var _0x4202b4={'count':0x0,'rows':[]};return db[_0x7b39('0x3a')][_0x7b39('0x61')]({'where':{'id':_0x252e32[_0x7b39('0x4f')]['id']}})[_0x7b39('0x29')](handleEntityNotFound(_0x59310,null))['then'](function(_0x4158ab){if(_0x4158ab){_0x1978d1['model']=_[_0x7b39('0x50')](db[_0x7b39('0x6b')][_0x7b39('0x5c')]);_0x1978d1[_0x7b39('0x3e')]=_['keys'](_0x252e32[_0x7b39('0x3e')]);_0x1978d1['filters']=_[_0x7b39('0x40')](_0x1978d1['model'],_0x1978d1[_0x7b39('0x3e')]);_0x194265[_0x7b39('0x41')]=_['intersection'](_0x1978d1[_0x7b39('0x3d')],qs['fields'](_0x252e32[_0x7b39('0x3e')]['fields']));_0x194265[_0x7b39('0x41')]=_0x194265[_0x7b39('0x41')][_0x7b39('0x43')]?_0x194265[_0x7b39('0x41')]:_0x1978d1[_0x7b39('0x3d')];if(!_0x252e32[_0x7b39('0x3e')][_0x7b39('0x44')](_0x7b39('0x45'))){_0x194265['limit']=qs[_0x7b39('0x22')](_0x252e32['query'][_0x7b39('0x22')]);_0x194265[_0x7b39('0x24')]=qs[_0x7b39('0x24')](_0x252e32[_0x7b39('0x3e')][_0x7b39('0x24')]);}_0x194265[_0x7b39('0x63')]=qs[_0x7b39('0x46')](_0x252e32[_0x7b39('0x3e')]['sort']);_0x194265[_0x7b39('0x47')]=qs[_0x7b39('0x3f')](_[_0x7b39('0x48')](_0x252e32[_0x7b39('0x3e')],_0x1978d1['filters']));_0x194265[_0x7b39('0x47')][_0x7b39('0x64')]=_0x4158ab['id'];if(_0x252e32[_0x7b39('0x3e')][_0x7b39('0x2e')]){_0x194265[_0x7b39('0x47')]=_[_0x7b39('0x49')](_0x194265['where'],{'$or':_[_0x7b39('0x30')](_0x194265[_0x7b39('0x41')],function(_0x536344){var _0x4b1826={};_0x4b1826[_0x536344]={'$like':'%'+_0x252e32[_0x7b39('0x3e')][_0x7b39('0x2e')]+'%'};return _0x4b1826;})});}_0x194265=_[_0x7b39('0x49')]({},_0x194265,_0x252e32['options']);return db['CmHopperBlack']['count']({'where':_0x194265[_0x7b39('0x47')]})[_0x7b39('0x29')](function(_0x2cb184){_0x4202b4[_0x7b39('0x23')]=_0x2cb184;if(_0x252e32[_0x7b39('0x3e')][_0x7b39('0x4c')]){_0x194265[_0x7b39('0x4d')]=[{'all':!![]}];}return db[_0x7b39('0x6b')]['findAll'](_0x194265);})[_0x7b39('0x29')](function(_0x1075f9){_0x4202b4['rows']=_0x1075f9;return _0x4202b4;});}})[_0x7b39('0x29')](respondWithFilteredResult(_0x59310,_0x194265))['catch'](handleError(_0x59310,null));};exports[_0x7b39('0x6c')]=function(_0x528ab3,_0x538b63,_0x53c3bf){var _0x1dcd1f={};var _0x408d60={};var _0x29b0dd;var _0x320871;return db[_0x7b39('0x3a')][_0x7b39('0x61')]({'where':{'id':_0x528ab3[_0x7b39('0x4f')]['id']}})['then'](handleEntityNotFound(_0x538b63,null))[_0x7b39('0x29')](function(_0x18be5c){if(_0x18be5c){_0x29b0dd=_0x18be5c;_0x408d60['model']=_[_0x7b39('0x50')](db[_0x7b39('0x6d')][_0x7b39('0x5c')]);_0x408d60['query']=_[_0x7b39('0x50')](_0x528ab3['query']);_0x408d60[_0x7b39('0x3f')]=_[_0x7b39('0x40')](_0x408d60['model'],_0x408d60[_0x7b39('0x3e')]);_0x1dcd1f['attributes']=_['intersection'](_0x408d60[_0x7b39('0x3d')],qs[_0x7b39('0x42')](_0x528ab3[_0x7b39('0x3e')]['fields']));_0x1dcd1f[_0x7b39('0x41')]=_0x1dcd1f[_0x7b39('0x41')][_0x7b39('0x43')]?_0x1dcd1f[_0x7b39('0x41')]:_0x408d60['model'];_0x1dcd1f[_0x7b39('0x63')]=qs[_0x7b39('0x46')](_0x528ab3[_0x7b39('0x3e')][_0x7b39('0x46')]);_0x1dcd1f[_0x7b39('0x47')]=qs[_0x7b39('0x3f')](_['pick'](_0x528ab3[_0x7b39('0x3e')],_0x408d60[_0x7b39('0x3f')]));if(_0x528ab3[_0x7b39('0x3e')][_0x7b39('0x2e')]){_0x1dcd1f['where']=_[_0x7b39('0x49')](_0x1dcd1f[_0x7b39('0x47')],{'$or':_[_0x7b39('0x30')](_0x1dcd1f[_0x7b39('0x41')],function(_0x579bbf){var _0x291735={};_0x291735[_0x579bbf]={'$like':'%'+_0x528ab3[_0x7b39('0x3e')][_0x7b39('0x2e')]+'%'};return _0x291735;})});}_0x1dcd1f=_[_0x7b39('0x49')]({},_0x1dcd1f,_0x528ab3[_0x7b39('0x4b')]);return _0x29b0dd[_0x7b39('0x6c')](_0x1dcd1f);}})['then'](function(_0xd93a96){if(_0xd93a96){_0x320871=_0xd93a96[_0x7b39('0x43')];if(!_0x528ab3[_0x7b39('0x3e')]['hasOwnProperty'](_0x7b39('0x45'))){_0x1dcd1f[_0x7b39('0x22')]=qs['limit'](_0x528ab3[_0x7b39('0x3e')][_0x7b39('0x22')]);_0x1dcd1f[_0x7b39('0x24')]=qs[_0x7b39('0x24')](_0x528ab3[_0x7b39('0x3e')]['offset']);}return _0x29b0dd[_0x7b39('0x6c')](_0x1dcd1f);}})[_0x7b39('0x29')](function(_0x16b22f){if(_0x16b22f){return _0x16b22f?{'count':_0x320871,'rows':_0x16b22f}:null;}})[_0x7b39('0x29')](respondWithResult(_0x538b63,null))[_0x7b39('0x51')](handleError(_0x538b63,null));};exports[_0x7b39('0x6e')]=function(_0x34fa91,_0x447349,_0x49a0fa){var _0xcdb529=_0x34fa91['body'][_0x7b39('0x6f')];var _0x5ed0f8=_['map'](_0xcdb529,'id');return db[_0x7b39('0x6d')][_0x7b39('0x4e')]({'where':{'id':_0x5ed0f8},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7b39('0x70'),'attributes':['id',_0x7b39('0x34'),'online',_0x7b39('0x71'),_0x7b39('0x72')],'raw':!![]}]})['then'](function(_0x13ba26){if(_0x13ba26){var _0x4b6071=_['flatMap'](_0x13ba26,function(_0x41bbe0){var _0x4f0f48=_0x41bbe0[_0x7b39('0x54')]({'plain':!![]});_0x4f0f48[_0x7b39('0x70')]['forEach'](function(_0x49e67e){_0x49e67e[_0x7b39('0x73')]=_[_0x7b39('0x32')](_0xcdb529,{'id':_0x4f0f48['id']})['penalty'];});return _0x4f0f48['Agents'];});return db[_0x7b39('0x3a')][_0x7b39('0x32')]({'where':{'id':_0x34fa91[_0x7b39('0x4f')]['id']}})[_0x7b39('0x29')](function(_0x20ae32){return db['sequelize'][_0x7b39('0x74')](function(_0x32b6ff){return _0x20ae32['addTeams'](_0x5ed0f8,{'transaction':_0x32b6ff})[_0x7b39('0x29')](function(){return BPromise[_0x7b39('0x75')](_0xcdb529,function(_0x20ea32){return db[_0x7b39('0x76')]['upsert']({'TeamId':_0x20ea32['id'],'VoiceQueueId':_0x34fa91['params']['id'],'penalty':_0x20ea32[_0x7b39('0x73')]},{'transaction':_0x32b6ff});});})[_0x7b39('0x29')](function(){return BPromise[_0x7b39('0x75')](_0x4b6071,function(_0x165ca9){return db[_0x7b39('0x77')][_0x7b39('0x78')]({'where':{'UserId':_0x165ca9['id'],'VoiceQueueId':_0x34fa91['params']['id']},'defaults':{'penalty':_0x165ca9[_0x7b39('0x73')]},'transaction':_0x32b6ff});});})[_0x7b39('0x29')](function(){return BPromise[_0x7b39('0x75')](_[_0x7b39('0x2e')](_0x4b6071,{'online':!![]}),function(_0x5e16e3){return db[_0x7b39('0x79')][_0x7b39('0x7a')]({'membername':_0x5e16e3['name'],'UserId':_0x5e16e3['id'],'queue_name':_0x20ae32[_0x7b39('0x34')],'VoiceQueueId':_0x20ae32['id'],'interface':_[_0x7b39('0x7b')](_0x5e16e3['interface'])?util[_0x7b39('0x7c')](_0x7b39('0x7d'),_0x5e16e3['name']):_0x5e16e3['interface'],'paused':_0x5e16e3['voicePause']||![],'penalty':_0x5e16e3[_0x7b39('0x73')]},{'transaction':_0x32b6ff});});})[_0x7b39('0x29')](function(){_0x4b6071[_0x7b39('0x7e')](function(_0x3f78c0){socket['emit']('userVoiceQueue:save',{'UserId':_0x3f78c0['id'],'VoiceQueueId':_0x20ae32['id']});});});});});}})[_0x7b39('0x29')](respondWithStatusCode(_0x447349,null))[_0x7b39('0x51')](handleError(_0x447349,null));};exports[_0x7b39('0x7f')]=function(_0x4beaea,_0xdb678c,_0x11e380){return db[_0x7b39('0x6d')]['findAll']({'where':{'id':_0x4beaea[_0x7b39('0x3e')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7b39('0x70'),'attributes':['id'],'raw':!![]}]})[_0x7b39('0x29')](handleEntityNotFound(_0xdb678c,null))[_0x7b39('0x29')](function(_0x19e5f5){var _0x1f62a1=_[_0x7b39('0x30')](_0x19e5f5,'id');var _0x2566f=[];var _0x244faf=[];var _0x2f953d=squel['select']();_0x2f953d[_0x7b39('0x80')](_0x7b39('0x81'))[_0x7b39('0x82')](_0x7b39('0x83'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x7b39('0x47')](_0x7b39('0x84'),_0x4beaea[_0x7b39('0x4f')]['id']);for(var _0x4b866d=0x0;_0x4b866d<_0x19e5f5[_0x7b39('0x43')];_0x4b866d+=0x1){let _0x2fd366=_0x19e5f5[_0x4b866d];for(var _0x8679af=0x0;_0x8679af<_0x2fd366[_0x7b39('0x70')][_0x7b39('0x43')];_0x8679af+=0x1){let _0x578643=_0x2fd366[_0x7b39('0x70')][_0x8679af];var _0x2ec372=_0x2f953d[_0x7b39('0x85')]();_0x2ec372[_0x7b39('0x47')]('ut.UserId\x20=\x20?',_0x578643['id']);_0x244faf['push'](db[_0x7b39('0x86')]['query'](_0x2ec372[_0x7b39('0x87')](),{'type':db[_0x7b39('0x86')][_0x7b39('0x88')][_0x7b39('0x89')]})[_0x7b39('0x29')](function(_0x308da3){if(_0x308da3['length']===0x1){return _0x578643['id'];}else{var _0x5442f6=_[_0x7b39('0x8a')](_[_0x7b39('0x30')](_0x308da3,'TeamId'),function(_0x3635d5){return _[_0x7b39('0x8b')](_0x1f62a1,_0x3635d5);});if(_0x5442f6){return _0x578643['id'];}}}));}}return BPromise[_0x7b39('0x8c')](_0x244faf)[_0x7b39('0x29')](function(_0xded5bb){_0x2566f=_(_0x2566f)[_0x7b39('0x8d')](_0xded5bb)[_0x7b39('0x8e')]()[_0x7b39('0x31')]();return db[_0x7b39('0x3a')][_0x7b39('0x32')]({'where':{'id':_0x4beaea[_0x7b39('0x4f')]['id']}})[_0x7b39('0x29')](function(_0x369177){return db[_0x7b39('0x86')][_0x7b39('0x74')](function(_0xb71a08){return _0x369177[_0x7b39('0x7f')](_0x4beaea[_0x7b39('0x3e')][_0x7b39('0x8f')],{'transaction':_0xb71a08})[_0x7b39('0x29')](function(){if(!_[_0x7b39('0x90')](_0x2566f)){return _0x369177[_0x7b39('0x91')](_0x2566f,{'transaction':_0xb71a08})[_0x7b39('0x29')](function(){return db[_0x7b39('0x79')][_0x7b39('0x36')]({'where':{'VoiceQueueId':_0x4beaea[_0x7b39('0x4f')]['id'],'UserId':_0x2566f},'transaction':_0xb71a08});});}})[_0x7b39('0x29')](function(){_0x2566f['forEach'](function(_0x9de47c){socket[_0x7b39('0x92')](_0x7b39('0x93'),{'UserId':_0x9de47c,'VoiceQueueId':_0x369177['id']});});});});});});})[_0x7b39('0x29')](respondWithStatusCode(_0xdb678c,null))['catch'](handleError(_0xdb678c,null));};exports['addAgents']=function(_0x2e7959,_0x17f2b9,_0x189a47){var _0x2450c6,_0x463c64;return db[_0x7b39('0x3a')][_0x7b39('0x32')]({'where':{'id':_0x2e7959[_0x7b39('0x4f')]['id']}})[_0x7b39('0x29')](handleEntityNotFound(_0x17f2b9,null))['then'](function(_0x33e1f9){if(_0x33e1f9){_0x463c64=_0x33e1f9;return _0x33e1f9[_0x7b39('0x94')](_0x2e7959[_0x7b39('0x53')]['ids'],_['omit'](_0x2e7959[_0x7b39('0x53')],['ids','id'])||{})[_0x7b39('0x95')](function(_0x2e804b){for(var _0x349b41=0x0;_0x349b41<_0x2e7959[_0x7b39('0x53')]['ids']['length'];_0x349b41+=0x1){socket['emit'](_0x7b39('0x96'),{'UserId':Number(_0x2e7959[_0x7b39('0x53')][_0x7b39('0x8f')][_0x349b41]),'VoiceQueueId':Number(_0x2e7959[_0x7b39('0x4f')]['id'])});}return _0x2e804b;});}})[_0x7b39('0x29')](function(_0x3b6ae5){_0x2450c6=_0x3b6ae5||[];if(_0x463c64){return db[_0x7b39('0x97')][_0x7b39('0x4e')]({'where':{'id':_0x2e7959[_0x7b39('0x53')][_0x7b39('0x8f')]},'attributes':['id',_0x7b39('0x34'),_0x7b39('0x98'),'voicePause',_0x7b39('0x72')],'raw':!![]});}})[_0x7b39('0x29')](function(_0x8bafca){if(!_['isEmpty'](_0x8bafca)){var _0x106e11=[];for(var _0x52c6b=0x0;_0x52c6b<_0x8bafca['length'];_0x52c6b++){if(_0x8bafca[_0x52c6b][_0x7b39('0x98')]){_0x106e11[_0x7b39('0x99')](db[_0x7b39('0x79')]['upsert']({'membername':_0x8bafca[_0x52c6b]['name'],'UserId':_0x8bafca[_0x52c6b]['id'],'queue_name':_0x463c64[_0x7b39('0x34')],'VoiceQueueId':_0x463c64['id'],'interface':_[_0x7b39('0x7b')](_0x8bafca[_0x52c6b]['interface'])?util['format'](_0x7b39('0x7d'),_0x8bafca[_0x52c6b]['name']):_0x8bafca[_0x52c6b][_0x7b39('0x72')],'paused':_0x8bafca[_0x52c6b][_0x7b39('0x71')]||![],'penalty':_0x2e7959[_0x7b39('0x53')][_0x7b39('0x73')]||0x0}));}}return BPromise['all'](_0x106e11);}})[_0x7b39('0x29')](function(){return _0x2450c6;})['then'](respondWithResult(_0x17f2b9,null))[_0x7b39('0x51')](handleError(_0x17f2b9,null));};exports['removeAgents']=function(_0x53c15a,_0x3bbd15,_0x61edf4){return db[_0x7b39('0x3a')]['find']({'where':{'id':_0x53c15a[_0x7b39('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3bbd15,null))[_0x7b39('0x29')](function(_0xbf71b0){if(_0xbf71b0){return _0xbf71b0[_0x7b39('0x91')](_0x53c15a[_0x7b39('0x3e')]['ids'])[_0x7b39('0x29')](function(){if(_['isArray'](_0x53c15a[_0x7b39('0x3e')][_0x7b39('0x8f')])){for(var _0x12d278=0x0;_0x12d278<_0x53c15a[_0x7b39('0x3e')][_0x7b39('0x8f')]['length'];_0x12d278+=0x1){socket[_0x7b39('0x92')](_0x7b39('0x93'),{'UserId':Number(_0x53c15a['query'][_0x7b39('0x8f')][_0x12d278]),'VoiceQueueId':Number(_0x53c15a[_0x7b39('0x4f')]['id'])});}}else{socket[_0x7b39('0x92')](_0x7b39('0x93'),{'UserId':Number(_0x53c15a[_0x7b39('0x3e')][_0x7b39('0x8f')]),'VoiceQueueId':Number(_0x53c15a['params']['id'])});}});}})['then'](function(_0x4afe39){return db[_0x7b39('0x79')]['destroy']({'where':{'VoiceQueueId':_0x53c15a[_0x7b39('0x4f')]['id'],'UserId':_0x53c15a[_0x7b39('0x3e')]['ids']}})[_0x7b39('0x29')](function(){return _0x4afe39;});})[_0x7b39('0x29')](respondWithStatusCode(_0x3bbd15,null))[_0x7b39('0x51')](handleError(_0x3bbd15,null));};exports['getAgents']=function(_0xf2f6b3,_0x1c6fd7,_0x1bde77){var _0x5df5a9={};var _0x4e2ae8={};var _0x5283da;var _0x352931;return db[_0x7b39('0x3a')][_0x7b39('0x61')]({'where':{'id':_0xf2f6b3[_0x7b39('0x4f')]['id']}})[_0x7b39('0x29')](handleEntityNotFound(_0x1c6fd7,null))[_0x7b39('0x29')](function(_0x42233e){if(_0x42233e){_0x5283da=_0x42233e;_0x4e2ae8[_0x7b39('0x3d')]=_[_0x7b39('0x50')](db[_0x7b39('0x97')][_0x7b39('0x5c')]);_0x4e2ae8[_0x7b39('0x3e')]=_[_0x7b39('0x50')](_0xf2f6b3['query']);_0x4e2ae8[_0x7b39('0x3f')]=_[_0x7b39('0x40')](_0x4e2ae8[_0x7b39('0x3d')],_0x4e2ae8['query']);_0x5df5a9[_0x7b39('0x41')]=_[_0x7b39('0x40')](_0x4e2ae8['model'],qs[_0x7b39('0x42')](_0xf2f6b3['query'][_0x7b39('0x42')]));_0x5df5a9['attributes']=_0x5df5a9['attributes'][_0x7b39('0x43')]?_0x5df5a9[_0x7b39('0x41')]:_0x4e2ae8[_0x7b39('0x3d')];_0x5df5a9['order']=qs['sort'](_0xf2f6b3[_0x7b39('0x3e')][_0x7b39('0x46')]);_0x5df5a9[_0x7b39('0x47')]=qs[_0x7b39('0x3f')](_[_0x7b39('0x48')](_0xf2f6b3[_0x7b39('0x3e')],_0x4e2ae8['filters']));if(_0xf2f6b3['query'][_0x7b39('0x2e')]){_0x5df5a9[_0x7b39('0x47')]=_[_0x7b39('0x49')](_0x5df5a9['where'],{'$or':_[_0x7b39('0x30')](_0x5df5a9['attributes'],function(_0x16ddae){var _0x4bb620={};_0x4bb620[_0x16ddae]={'$like':'%'+_0xf2f6b3[_0x7b39('0x3e')][_0x7b39('0x2e')]+'%'};return _0x4bb620;})});}_0x5df5a9=_['merge']({},_0x5df5a9,_0xf2f6b3[_0x7b39('0x4b')]);return _0x5283da[_0x7b39('0x9a')](_0x5df5a9);}})['then'](function(_0x22377b){if(_0x22377b){_0x352931=_0x22377b[_0x7b39('0x43')];if(!_0xf2f6b3['query'][_0x7b39('0x44')](_0x7b39('0x45'))){_0x5df5a9['limit']=qs[_0x7b39('0x22')](_0xf2f6b3[_0x7b39('0x3e')][_0x7b39('0x22')]);_0x5df5a9[_0x7b39('0x24')]=qs[_0x7b39('0x24')](_0xf2f6b3['query'][_0x7b39('0x24')]);}return _0x5283da[_0x7b39('0x9a')](_0x5df5a9);}})[_0x7b39('0x29')](function(_0x40efcb){if(_0x40efcb){return _0x40efcb?{'count':_0x352931,'rows':_0x40efcb}:null;}})[_0x7b39('0x29')](respondWithResult(_0x1c6fd7,null))[_0x7b39('0x51')](handleError(_0x1c6fd7,null));};exports[_0x7b39('0x9b')]=function(_0x3fcbd0,_0x3aed8e,_0x37e4cf){var _0x2ebcb7={};var _0x136410={};var _0x412d23;var _0x2066df;return db[_0x7b39('0x3a')][_0x7b39('0x61')]({'where':{'id':_0x3fcbd0[_0x7b39('0x4f')]['id']}})[_0x7b39('0x29')](handleEntityNotFound(_0x3aed8e,null))[_0x7b39('0x29')](function(_0x3098cc){if(_0x3098cc){_0x412d23=_0x3098cc;_0x136410[_0x7b39('0x3d')]=_[_0x7b39('0x50')](db[_0x7b39('0x79')]['rawAttributes']);_0x136410[_0x7b39('0x3e')]=_[_0x7b39('0x50')](_0x3fcbd0[_0x7b39('0x3e')]);_0x136410[_0x7b39('0x3f')]=_[_0x7b39('0x40')](_0x136410[_0x7b39('0x3d')],_0x136410['query']);_0x2ebcb7[_0x7b39('0x41')]=_[_0x7b39('0x40')](_0x136410['model'],qs[_0x7b39('0x42')](_0x3fcbd0[_0x7b39('0x3e')][_0x7b39('0x42')]));_0x2ebcb7[_0x7b39('0x41')]=_0x2ebcb7[_0x7b39('0x41')][_0x7b39('0x43')]?_0x2ebcb7[_0x7b39('0x41')]:_0x136410['model'];_0x2ebcb7['order']=qs[_0x7b39('0x46')](_0x3fcbd0['query'][_0x7b39('0x46')]);_0x2ebcb7[_0x7b39('0x47')]=qs[_0x7b39('0x3f')](_[_0x7b39('0x48')](_0x3fcbd0[_0x7b39('0x3e')],_0x136410['filters']));if(_0x3fcbd0['query'][_0x7b39('0x2e')]){_0x2ebcb7[_0x7b39('0x47')]=_['merge'](_0x2ebcb7[_0x7b39('0x47')],{'$or':_['map'](_0x2ebcb7[_0x7b39('0x41')],function(_0x34e0c4){var _0x5e8ef5={};_0x5e8ef5[_0x34e0c4]={'$like':'%'+_0x3fcbd0[_0x7b39('0x3e')][_0x7b39('0x2e')]+'%'};return _0x5e8ef5;})});}_0x2ebcb7=_[_0x7b39('0x49')]({},_0x2ebcb7,_0x3fcbd0[_0x7b39('0x4b')]);return _0x412d23[_0x7b39('0x9b')](_0x2ebcb7);}})[_0x7b39('0x29')](function(_0x270642){if(_0x270642){_0x2066df=_0x270642[_0x7b39('0x43')];if(!_0x3fcbd0['query'][_0x7b39('0x44')]('nolimit')){_0x2ebcb7[_0x7b39('0x22')]=qs['limit'](_0x3fcbd0['query'][_0x7b39('0x22')]);_0x2ebcb7[_0x7b39('0x24')]=qs[_0x7b39('0x24')](_0x3fcbd0[_0x7b39('0x3e')][_0x7b39('0x24')]);}return _0x412d23[_0x7b39('0x9b')](_0x2ebcb7);}})[_0x7b39('0x29')](function(_0x5617d2){return _0x5617d2?{'count':_0x2066df,'rows':_0x5617d2}:null;})[_0x7b39('0x29')](respondWithResult(_0x3aed8e,null))[_0x7b39('0x51')](handleError(_0x3aed8e,null));};exports[_0x7b39('0x9c')]=function(_0x9affca,_0x494c7f,_0x388e0c){var _0x4083ce={};var _0x29ac31={};var _0x4500;var _0x172030;return db[_0x7b39('0x3a')][_0x7b39('0x61')]({'where':{'id':_0x9affca[_0x7b39('0x4f')]['id']}})[_0x7b39('0x29')](handleEntityNotFound(_0x494c7f,null))[_0x7b39('0x29')](function(_0x1bb6d3){if(_0x1bb6d3){_0x4500=_0x1bb6d3;_0x29ac31[_0x7b39('0x3d')]=_['keys'](db[_0x7b39('0x9d')][_0x7b39('0x5c')]);_0x29ac31[_0x7b39('0x3e')]=_[_0x7b39('0x50')](_0x9affca['query']);_0x29ac31[_0x7b39('0x3f')]=_['intersection'](_0x29ac31['model'],_0x29ac31[_0x7b39('0x3e')]);_0x4083ce[_0x7b39('0x41')]=_[_0x7b39('0x40')](_0x29ac31['model'],qs[_0x7b39('0x42')](_0x9affca[_0x7b39('0x3e')][_0x7b39('0x42')]));_0x4083ce[_0x7b39('0x41')]=_0x4083ce[_0x7b39('0x41')]['length']?_0x4083ce[_0x7b39('0x41')]:_0x29ac31[_0x7b39('0x3d')];_0x4083ce[_0x7b39('0x63')]=qs[_0x7b39('0x46')](_0x9affca['query'][_0x7b39('0x46')]);_0x4083ce['where']=qs[_0x7b39('0x3f')](_['pick'](_0x9affca[_0x7b39('0x3e')],_0x29ac31[_0x7b39('0x3f')]));if(_0x9affca['query'][_0x7b39('0x2e')]){_0x4083ce[_0x7b39('0x47')]=_[_0x7b39('0x49')](_0x4083ce['where'],{'$or':_[_0x7b39('0x30')](_0x4083ce[_0x7b39('0x41')],function(_0x4e984b){var _0x5cd30e={};_0x5cd30e[_0x4e984b]={'$like':'%'+_0x9affca[_0x7b39('0x3e')][_0x7b39('0x2e')]+'%'};return _0x5cd30e;})});}_0x4083ce=_[_0x7b39('0x49')]({},_0x4083ce,_0x9affca[_0x7b39('0x4b')]);return _0x4500[_0x7b39('0x9c')](_0x4083ce);}})[_0x7b39('0x29')](function(_0x5011c8){if(_0x5011c8){_0x172030=_0x5011c8[_0x7b39('0x43')];if(!_0x9affca[_0x7b39('0x3e')][_0x7b39('0x44')](_0x7b39('0x45'))){_0x4083ce[_0x7b39('0x22')]=qs[_0x7b39('0x22')](_0x9affca[_0x7b39('0x3e')][_0x7b39('0x22')]);_0x4083ce[_0x7b39('0x24')]=qs['offset'](_0x9affca[_0x7b39('0x3e')]['offset']);}return _0x4500[_0x7b39('0x9c')](_0x4083ce);}})[_0x7b39('0x29')](function(_0x2ae90d){if(_0x2ae90d){return _0x2ae90d?{'count':_0x172030,'rows':_0x2ae90d}:null;}})[_0x7b39('0x29')](respondWithResult(_0x494c7f,null))[_0x7b39('0x51')](handleError(_0x494c7f,null));};exports[_0x7b39('0x9e')]=function(_0x5d245c,_0x169ade,_0x20f3a5){var _0x4937c1,_0x142552;return db['VoiceQueue']['find']({'where':{'id':_0x5d245c['params']['id']}})[_0x7b39('0x29')](handleEntityNotFound(_0x169ade,null))[_0x7b39('0x29')](function(_0x166bcf){if(_0x166bcf){_0x142552=_0x166bcf;return _0x166bcf[_0x7b39('0x9e')](_0x5d245c[_0x7b39('0x53')]['ids'],_[_0x7b39('0x5d')](_0x5d245c[_0x7b39('0x53')],[_0x7b39('0x8f'),'id'])||{});}return null;})[_0x7b39('0x95')](function(_0x586742){var _0x1bf5c2;_0x4937c1=_0x586742||[];var _0x30d2d4=[];if(_0x586742){for(var _0x4df9e5=0x0;_0x4df9e5<_0x586742[_0x7b39('0x43')];_0x4df9e5+=0x1){var _0x2da029=_0x586742[_0x4df9e5][_0x7b39('0x54')]({'plain':!![]});_0x142552[_0x7b39('0x9f')]=_0x5d245c[_0x7b39('0x53')][_0x7b39('0x9f')]?_0x5d245c['body']['dialCheckDuplicateType']:_0x142552['dialCheckDuplicateType'];switch(_0x142552[_0x7b39('0x9f')]){case _0x7b39('0xa0'):_0x1bf5c2=squel[_0x7b39('0xa1')]()[_0x7b39('0xa2')](_0x7b39('0xa3'))[_0x7b39('0xa4')](['phone','scheduledAt',_0x7b39('0xa5'),_0x7b39('0xa6'),_0x7b39('0x64'),'createdAt',_0x7b39('0x5f')],squel[_0x7b39('0xa7')]()['field']('phone',_0x7b39('0xa8'))[_0x7b39('0x80')](_0x7b39('0xa9'),'scheduledAt')[_0x7b39('0x80')]('id',_0x7b39('0xa5'))[_0x7b39('0x80')](_0x2da029[_0x7b39('0xaa')][_0x7b39('0x87')](),_0x7b39('0xa6'))['field'](_0x5d245c['params']['id'][_0x7b39('0x87')](),'VoiceQueueId')[_0x7b39('0x80')](_0x7b39('0xa9'),'createdAt')['field']('NOW()',_0x7b39('0x5f'))[_0x7b39('0x82')](_0x7b39('0xab'))[_0x7b39('0x47')](_0x7b39('0xac'))[_0x7b39('0x47')](_0x7b39('0xad'),_0x2da029[_0x7b39('0xaa')]['toString']())[_0x7b39('0x47')](_0x7b39('0xae'))['where'](_0x7b39('0xaf'),squel['select']()[_0x7b39('0x80')]('COALESCE(calleridnum,\x27\x27)')[_0x7b39('0x82')](_0x7b39('0xb0'))[_0x7b39('0x47')](_0x7b39('0x84'),_0x5d245c['params']['id']['toString']()))['where'](_0x7b39('0xaf'),squel[_0x7b39('0xa7')]()[_0x7b39('0x80')](_0x7b39('0xb1'))['from'](_0x7b39('0xa3'))[_0x7b39('0x47')](_0x7b39('0x84'),_0x5d245c[_0x7b39('0x4f')]['id'][_0x7b39('0x87')]())))['toString']();break;case _0x7b39('0xb2'):_0x1bf5c2=squel[_0x7b39('0xa1')]()[_0x7b39('0xa2')](_0x7b39('0xa3'))[_0x7b39('0xa4')]([_0x7b39('0xa8'),_0x7b39('0xb3'),'ContactId',_0x7b39('0xa6'),_0x7b39('0x64'),_0x7b39('0x5e'),_0x7b39('0x5f')],squel[_0x7b39('0xa7')]()[_0x7b39('0x80')](_0x7b39('0xa8'),'phone')[_0x7b39('0x80')](_0x7b39('0xa9'),_0x7b39('0xb3'))[_0x7b39('0x80')]('id',_0x7b39('0xa5'))['field'](_0x2da029[_0x7b39('0xaa')][_0x7b39('0x87')](),'ListId')['field'](_0x5d245c[_0x7b39('0x4f')]['id'][_0x7b39('0x87')](),'VoiceQueueId')[_0x7b39('0x80')]('NOW()',_0x7b39('0x5e'))['field'](_0x7b39('0xa9'),_0x7b39('0x5f'))['from'](_0x7b39('0xab'))[_0x7b39('0x47')](_0x7b39('0xac'))['where'](_0x7b39('0xad'),_0x2da029['CmListId']['toString']())[_0x7b39('0x47')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x7b39('0xaf'),squel[_0x7b39('0xa7')]()[_0x7b39('0x80')](_0x7b39('0xb1'))['from'](_0x7b39('0xa3'))['where'](_0x7b39('0x84'),_0x5d245c[_0x7b39('0x4f')]['id'][_0x7b39('0x87')]())))[_0x7b39('0x87')]();break;default:_0x1bf5c2=squel[_0x7b39('0xa1')]()[_0x7b39('0xa2')](_0x7b39('0xa3'))[_0x7b39('0xa4')]([_0x7b39('0xa8'),'scheduledAt',_0x7b39('0xa5'),_0x7b39('0xa6'),_0x7b39('0x64'),_0x7b39('0x5e'),_0x7b39('0x5f')],squel[_0x7b39('0xa7')]()['field'](_0x7b39('0xa8'),_0x7b39('0xa8'))[_0x7b39('0x80')](_0x7b39('0xa9'),_0x7b39('0xb3'))[_0x7b39('0x80')]('id',_0x7b39('0xa5'))[_0x7b39('0x80')](_0x2da029[_0x7b39('0xaa')][_0x7b39('0x87')](),_0x7b39('0xa6'))[_0x7b39('0x80')](_0x5d245c[_0x7b39('0x4f')]['id']['toString'](),_0x7b39('0x64'))[_0x7b39('0x80')]('NOW()',_0x7b39('0x5e'))['field'](_0x7b39('0xa9'),_0x7b39('0x5f'))['from']('cm_contacts')[_0x7b39('0x47')](_0x7b39('0xac'))[_0x7b39('0x47')](_0x7b39('0xad'),_0x2da029[_0x7b39('0xaa')][_0x7b39('0x87')]())[_0x7b39('0x47')](_0x7b39('0xae')))[_0x7b39('0x87')]();}_0x30d2d4[_0x7b39('0x99')](db['sequelize'][_0x7b39('0x3e')](_0x1bf5c2));}return BPromise[_0x7b39('0x8c')](_0x30d2d4);}})[_0x7b39('0x29')](function(){return _0x4937c1;})['then'](respondWithResult(_0x169ade,null))[_0x7b39('0x51')](handleError(_0x169ade,null));};exports[_0x7b39('0xb4')]=function(_0x5123cb,_0x3b1e86,_0x5b3664){return db[_0x7b39('0x3a')]['find']({'where':{'id':_0x5123cb[_0x7b39('0x4f')]['id']}})[_0x7b39('0x29')](handleEntityNotFound(_0x3b1e86,null))[_0x7b39('0x29')](function(_0x4a1968){if(_0x4a1968){return _0x4a1968['removeLists'](_0x5123cb[_0x7b39('0x3e')]['ids']);}})[_0x7b39('0x29')](function(_0x2c9e15){if(_0x2c9e15){return db[_0x7b39('0x62')]['destroy']({'where':{'ListId':_0x5123cb[_0x7b39('0x3e')][_0x7b39('0x8f')],'VoiceQueueId':_0x5123cb[_0x7b39('0x4f')]['id']}})[_0x7b39('0x29')](function(){return _0x2c9e15;});}})['then'](respondWithStatusCode(_0x3b1e86,null))[_0x7b39('0x51')](handleError(_0x3b1e86,null));};exports[_0x7b39('0xb5')]=function(_0x59e101,_0x4e47b0,_0x64b54e){var _0x25606e={};var _0x42b2a0={};var _0x3693ec;var _0x214283;return db[_0x7b39('0x3a')][_0x7b39('0x61')]({'where':{'id':_0x59e101[_0x7b39('0x4f')]['id']}})[_0x7b39('0x29')](handleEntityNotFound(_0x4e47b0,null))[_0x7b39('0x29')](function(_0x2e0146){if(_0x2e0146){_0x3693ec=_0x2e0146;_0x42b2a0[_0x7b39('0x3d')]=_['keys'](db[_0x7b39('0x9d')]['rawAttributes']);_0x42b2a0[_0x7b39('0x3e')]=_[_0x7b39('0x50')](_0x59e101[_0x7b39('0x3e')]);_0x42b2a0[_0x7b39('0x3f')]=_['intersection'](_0x42b2a0[_0x7b39('0x3d')],_0x42b2a0[_0x7b39('0x3e')]);_0x25606e[_0x7b39('0x41')]=_[_0x7b39('0x40')](_0x42b2a0['model'],qs[_0x7b39('0x42')](_0x59e101[_0x7b39('0x3e')][_0x7b39('0x42')]));_0x25606e['attributes']=_0x25606e[_0x7b39('0x41')][_0x7b39('0x43')]?_0x25606e['attributes']:_0x42b2a0[_0x7b39('0x3d')];_0x25606e[_0x7b39('0x63')]=qs['sort'](_0x59e101[_0x7b39('0x3e')][_0x7b39('0x46')]);_0x25606e[_0x7b39('0x47')]=qs[_0x7b39('0x3f')](_[_0x7b39('0x48')](_0x59e101['query'],_0x42b2a0[_0x7b39('0x3f')]));if(_0x59e101['query'][_0x7b39('0x2e')]){_0x25606e[_0x7b39('0x47')]=_[_0x7b39('0x49')](_0x25606e[_0x7b39('0x47')],{'$or':_['map'](_0x25606e[_0x7b39('0x41')],function(_0x37da96){var _0x5e8502={};_0x5e8502[_0x37da96]={'$like':'%'+_0x59e101[_0x7b39('0x3e')]['filter']+'%'};return _0x5e8502;})});}_0x25606e=_[_0x7b39('0x49')]({},_0x25606e,_0x59e101[_0x7b39('0x4b')]);return _0x3693ec[_0x7b39('0xb5')](_0x25606e);}})['then'](function(_0x5d4d0f){if(_0x5d4d0f){_0x214283=_0x5d4d0f['length'];if(!_0x59e101[_0x7b39('0x3e')][_0x7b39('0x44')](_0x7b39('0x45'))){_0x25606e['limit']=qs[_0x7b39('0x22')](_0x59e101[_0x7b39('0x3e')][_0x7b39('0x22')]);_0x25606e[_0x7b39('0x24')]=qs[_0x7b39('0x24')](_0x59e101[_0x7b39('0x3e')][_0x7b39('0x24')]);}return _0x3693ec[_0x7b39('0xb5')](_0x25606e);}})['then'](function(_0x2e1678){if(_0x2e1678){return _0x2e1678?{'count':_0x214283,'rows':_0x2e1678}:null;}})[_0x7b39('0x29')](respondWithResult(_0x4e47b0,null))[_0x7b39('0x51')](handleError(_0x4e47b0,null));};exports[_0x7b39('0xb6')]=function(_0xef80d7,_0x4fa7f8,_0x16c9c9){var _0x5e5835,_0x5026e8;return db[_0x7b39('0x3a')][_0x7b39('0x32')]({'where':{'id':_0xef80d7[_0x7b39('0x4f')]['id']}})[_0x7b39('0x29')](handleEntityNotFound(_0x4fa7f8,null))[_0x7b39('0x29')](function(_0xdd2757){if(_0xdd2757){_0x5026e8=_0xdd2757;return _0xdd2757[_0x7b39('0xb6')](_0xef80d7[_0x7b39('0x53')][_0x7b39('0x8f')],_['omit'](_0xef80d7[_0x7b39('0x53')],[_0x7b39('0x8f'),'id'])||{});}return null;})[_0x7b39('0x95')](function(_0x33675d){var _0x5c5ed9;_0x5e5835=_0x33675d||[];var _0x3b3a53=[];if(_0x33675d){for(var _0x12d541=0x0;_0x12d541<_0x33675d[_0x7b39('0x43')];_0x12d541+=0x1){var _0x210c86=_0x33675d[_0x12d541][_0x7b39('0x54')]({'plain':!![]});_0x5c5ed9=squel['insert']()['into']('cm_hopper_black')[_0x7b39('0xa4')]([_0x7b39('0xa8'),'ContactId',_0x7b39('0xa6'),_0x7b39('0x64'),'createdAt',_0x7b39('0x5f')],squel[_0x7b39('0xa7')]()[_0x7b39('0x80')](_0x7b39('0xa8'),_0x7b39('0xa8'))[_0x7b39('0x80')]('id',_0x7b39('0xa5'))[_0x7b39('0x80')](_0x210c86[_0x7b39('0xaa')][_0x7b39('0x87')](),_0x7b39('0xa6'))['field'](_0xef80d7['params']['id'][_0x7b39('0x87')](),_0x7b39('0x64'))[_0x7b39('0x80')]('NOW()',_0x7b39('0x5e'))[_0x7b39('0x80')](_0x7b39('0xa9'),_0x7b39('0x5f'))[_0x7b39('0x82')](_0x7b39('0xab'))[_0x7b39('0x47')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x210c86[_0x7b39('0xaa')]['toString']())[_0x7b39('0x47')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x3b3a53[_0x7b39('0x99')](db[_0x7b39('0x86')][_0x7b39('0x3e')](_0x5c5ed9));}return BPromise['all'](_0x3b3a53);}})[_0x7b39('0x29')](function(){return _0x5e5835;})[_0x7b39('0x29')](respondWithResult(_0x4fa7f8,null))[_0x7b39('0x51')](handleError(_0x4fa7f8,null));};exports['removeBlackLists']=function(_0x40af56,_0x5776cf,_0x289726){return db[_0x7b39('0x3a')][_0x7b39('0x32')]({'where':{'id':_0x40af56[_0x7b39('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5776cf,null))['then'](function(_0x487a62){if(_0x487a62){return _0x487a62[_0x7b39('0xb7')](_0x40af56[_0x7b39('0x3e')][_0x7b39('0x8f')]);}})[_0x7b39('0x29')](function(_0x36104a){if(_0x36104a){return db[_0x7b39('0x6b')][_0x7b39('0x36')]({'where':{'ListId':_0x40af56['query'][_0x7b39('0x8f')],'VoiceQueueId':_0x40af56[_0x7b39('0x4f')]['id']}})['then'](function(){return _0x36104a;});}})[_0x7b39('0x29')](respondWithStatusCode(_0x5776cf,null))[_0x7b39('0x51')](handleError(_0x5776cf,null));}; \ No newline at end of file +var _0x32cc=['keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','pick','where','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','merge','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','create','clone','omit','updatedAt','createdAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','nolimit','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','teams','User','Agents','online','voicePause','interface','flatMap','penalty','sequelize','addTeams','each','TeamVoiceQueue','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','all','union','compact','transaction','removeAgents','emit','userVoiceQueue:remove','addAgents','isEmpty','isArray','getAgents','getMembers','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','scheduledAt','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','NOW()','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','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/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','count','set','Content-Range','apply','reject','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','value','includes','type','UserProfileResource','destroy','error','stack','name','index','map','VoiceQueue','rawAttributes','fieldName','key','query'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x32cc,0x13d));var _0xc32c=function(_0x148202,_0x132b6a){_0x148202=_0x148202-0x0;var _0x1b15ad=_0x32cc[_0x148202];return _0x1b15ad;};'use strict';var emlformat=require(_0xc32c('0x0'));var rimraf=require(_0xc32c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc32c('0x2'));var rp=require(_0xc32c('0x3'));var moment=require(_0xc32c('0x4'));var BPromise=require(_0xc32c('0x5'));var Mustache=require('mustache');var util=require(_0xc32c('0x6'));var path=require(_0xc32c('0x7'));var sox=require(_0xc32c('0x8'));var csv=require(_0xc32c('0x9'));var ejs=require(_0xc32c('0xa'));var fs=require('fs');var fs_extra=require(_0xc32c('0xb'));var _=require(_0xc32c('0xc'));var squel=require(_0xc32c('0xd'));var crypto=require(_0xc32c('0xe'));var jsforce=require(_0xc32c('0xf'));var deskjs=require(_0xc32c('0x10'));var toCsv=require(_0xc32c('0x9'));var querystring=require(_0xc32c('0x11'));var Papa=require('papaparse');var Redis=require(_0xc32c('0x12'));var authService=require(_0xc32c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc32c('0x14'));var hardwareService=require(_0xc32c('0x15'));var logger=require(_0xc32c('0x16'))(_0xc32c('0x17'));var utils=require(_0xc32c('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xc32c('0x19'));var db=require('../../mysqldb')['db'];config[_0xc32c('0x1a')]=_[_0xc32c('0x1b')](config[_0xc32c('0x1a')],{'host':_0xc32c('0x1c'),'port':0x18eb});var socket=require(_0xc32c('0x1d'))(new Redis(config[_0xc32c('0x1a')]));require('./voiceQueue.socket')['register'](socket);function respondWithStatusCode(_0x9bd6a6,_0x4322d7){_0x4322d7=_0x4322d7||0xcc;return function(_0x121f6e){if(_0x121f6e){return _0x9bd6a6[_0xc32c('0x1e')](_0x4322d7);}return _0x9bd6a6[_0xc32c('0x1f')](_0x4322d7)[_0xc32c('0x20')]();};}function respondWithResult(_0x8b5725,_0x744978){_0x744978=_0x744978||0xc8;return function(_0x44a46e){if(_0x44a46e){return _0x8b5725[_0xc32c('0x1f')](_0x744978)[_0xc32c('0x21')](_0x44a46e);}};}function respondWithFilteredResult(_0x241431,_0x668d6b){return function(_0x3f266e){if(_0x3f266e){var _0x5e0950=typeof _0x668d6b[_0xc32c('0x22')]==='undefined'&&typeof _0x668d6b['limit']==='undefined';var _0xd4b474=_0x3f266e[_0xc32c('0x23')];var _0x485cdd=_0x5e0950?0x0:_0x668d6b[_0xc32c('0x22')];var _0x23c53f=_0x5e0950?_0x3f266e['count']:_0x668d6b[_0xc32c('0x22')]+_0x668d6b['limit'];var _0x3ffe73;if(_0x23c53f>=_0xd4b474){_0x23c53f=_0xd4b474;_0x3ffe73=0xc8;}else{_0x3ffe73=0xce;}_0x241431[_0xc32c('0x1f')](_0x3ffe73);return _0x241431[_0xc32c('0x24')](_0xc32c('0x25'),_0x485cdd+'-'+_0x23c53f+'/'+_0xd4b474)[_0xc32c('0x21')](_0x3f266e);}return null;};}function patchUpdates(_0x48a857){return function(_0x5bdc43){try{jsonpatch[_0xc32c('0x26')](_0x5bdc43,_0x48a857,!![]);}catch(_0x19b354){return BPromise[_0xc32c('0x27')](_0x19b354);}return _0x5bdc43['save']();};}function saveUpdates(_0x3553de,_0x3be9a6){return function(_0xf5ecca){if(_0xf5ecca){return _0xf5ecca[_0xc32c('0x28')](_0x3553de)['then'](function(_0x5f338a){return _0x5f338a;});}return null;};}function removeEntity(_0x39b48e,_0x647708){return function(_0x2e5a25){if(_0x2e5a25){return _0x2e5a25['destroy']()[_0xc32c('0x29')](function(){var _0x1d7cf5=_0x2e5a25[_0xc32c('0x2a')]({'plain':!![]});var _0x2e8881=[{'name':_0xc32c('0x2b'),'value':_0xc32c('0x2c'),'ignore':![]},{'name':_0xc32c('0x2d'),'value':_0xc32c('0x2e'),'ignore':![]}];var _0x56b3a1=_(_0x2e8881)[_0xc32c('0x2f')]('ignore')['map'](_0xc32c('0x30'))[_0xc32c('0x30')]();if(_[_0xc32c('0x31')](_0x56b3a1,_0x1d7cf5[_0xc32c('0x32')])){return;}var _0x5076bf=_['find'](_0x2e8881,[_0xc32c('0x30'),_0x1d7cf5[_0xc32c('0x32')]])['name'];return db[_0xc32c('0x33')][_0xc32c('0x34')]({'where':{'type':_0x5076bf,'resourceId':_0x1d7cf5['id']}})[_0xc32c('0x29')](function(){return _0x2e5a25;});})[_0xc32c('0x29')](function(){_0x39b48e[_0xc32c('0x1f')](0xcc)[_0xc32c('0x20')]();});}};}function handleEntityNotFound(_0x35ff16,_0x25e0aa){return function(_0xb175a9){if(!_0xb175a9){_0x35ff16[_0xc32c('0x1e')](0x194);}return _0xb175a9;};}function handleError(_0x2d6325,_0x3d80d5){_0x3d80d5=_0x3d80d5||0x1f4;return function(_0x11e57e){logger[_0xc32c('0x35')](_0x11e57e[_0xc32c('0x36')]);if(_0x11e57e[_0xc32c('0x37')]){delete _0x11e57e[_0xc32c('0x37')];}_0x2d6325['status'](_0x3d80d5)['send'](_0x11e57e);};}exports[_0xc32c('0x38')]=function(_0x5258b6,_0x4a24d2){var _0x804294={},_0x577706={},_0x283f90={'count':0x0,'rows':[]};var _0x221730=_[_0xc32c('0x39')](db[_0xc32c('0x3a')][_0xc32c('0x3b')],function(_0x405fb9){return{'name':_0x405fb9[_0xc32c('0x3c')],'type':_0x405fb9[_0xc32c('0x32')][_0xc32c('0x3d')]};});_0x577706['model']=_['map'](_0x221730,'name');_0x577706[_0xc32c('0x3e')]=_[_0xc32c('0x3f')](_0x5258b6['query']);_0x577706[_0xc32c('0x40')]=_['intersection'](_0x577706[_0xc32c('0x41')],_0x577706[_0xc32c('0x3e')]);_0x804294[_0xc32c('0x42')]=_[_0xc32c('0x43')](_0x577706['model'],qs['fields'](_0x5258b6[_0xc32c('0x3e')][_0xc32c('0x44')]));_0x804294[_0xc32c('0x42')]=_0x804294['attributes'][_0xc32c('0x45')]?_0x804294['attributes']:_0x577706[_0xc32c('0x41')];if(!_0x5258b6[_0xc32c('0x3e')][_0xc32c('0x46')]('nolimit')){_0x804294[_0xc32c('0x47')]=qs[_0xc32c('0x47')](_0x5258b6[_0xc32c('0x3e')][_0xc32c('0x47')]);_0x804294[_0xc32c('0x22')]=qs[_0xc32c('0x22')](_0x5258b6[_0xc32c('0x3e')][_0xc32c('0x22')]);}_0x804294[_0xc32c('0x48')]=qs[_0xc32c('0x49')](_0x5258b6[_0xc32c('0x3e')]['sort']);_0x804294['where']=qs[_0xc32c('0x40')](_[_0xc32c('0x4a')](_0x5258b6[_0xc32c('0x3e')],_0x577706[_0xc32c('0x40')]),_0x221730);if(_0x5258b6[_0xc32c('0x3e')][_0xc32c('0x2f')]){_0x804294[_0xc32c('0x4b')]=_['merge'](_0x804294['where'],{'$or':_[_0xc32c('0x39')](_0x221730,function(_0x5c31cf){if(_0x5c31cf[_0xc32c('0x32')]!==_0xc32c('0x4c')){var _0x21663c={};_0x21663c[_0x5c31cf['name']]={'$like':'%'+_0x5258b6[_0xc32c('0x3e')][_0xc32c('0x2f')]+'%'};return _0x21663c;}})});}_0x804294=_['merge']({},_0x804294,_0x5258b6[_0xc32c('0x4d')]);var _0x459de2={'where':_0x804294[_0xc32c('0x4b')]};return db['VoiceQueue'][_0xc32c('0x23')](_0x459de2)['then'](function(_0x480d40){_0x283f90[_0xc32c('0x23')]=_0x480d40;if(_0x5258b6[_0xc32c('0x3e')]['includeAll']){_0x804294[_0xc32c('0x4e')]=[{'all':!![]}];}return db[_0xc32c('0x3a')][_0xc32c('0x4f')](_0x804294);})['then'](function(_0x5d64f1){_0x283f90[_0xc32c('0x50')]=_0x5d64f1;return _0x283f90;})[_0xc32c('0x29')](respondWithFilteredResult(_0x4a24d2,_0x804294))[_0xc32c('0x51')](handleError(_0x4a24d2,null));};exports[_0xc32c('0x52')]=function(_0x305d49,_0x1fcfe1){var _0x1eeb9e={'raw':![],'where':{'id':_0x305d49[_0xc32c('0x53')]['id']}},_0x203c80={};_0x203c80[_0xc32c('0x41')]=_['keys'](db['VoiceQueue']['rawAttributes']);_0x203c80[_0xc32c('0x3e')]=_['keys'](_0x305d49[_0xc32c('0x3e')]);_0x203c80[_0xc32c('0x40')]=_[_0xc32c('0x43')](_0x203c80[_0xc32c('0x41')],_0x203c80[_0xc32c('0x3e')]);_0x1eeb9e[_0xc32c('0x42')]=_['intersection'](_0x203c80[_0xc32c('0x41')],qs[_0xc32c('0x44')](_0x305d49[_0xc32c('0x3e')][_0xc32c('0x44')]));_0x1eeb9e['attributes']=_0x1eeb9e[_0xc32c('0x42')][_0xc32c('0x45')]?_0x1eeb9e[_0xc32c('0x42')]:_0x203c80['model'];if(_0x305d49['query'][_0xc32c('0x54')]){_0x1eeb9e['include']=[{'all':!![]}];}_0x1eeb9e=_[_0xc32c('0x55')]({},_0x1eeb9e,_0x305d49[_0xc32c('0x4d')]);return db[_0xc32c('0x3a')][_0xc32c('0x56')](_0x1eeb9e)[_0xc32c('0x29')](handleEntityNotFound(_0x1fcfe1,null))[_0xc32c('0x29')](respondWithResult(_0x1fcfe1,null))[_0xc32c('0x51')](handleError(_0x1fcfe1,null));};exports['create']=function(_0x4610f2,_0x5b3528){return db['VoiceQueue']['create'](_0x4610f2[_0xc32c('0x57')],{})[_0xc32c('0x29')](function(_0x5c8d66){var _0x86e41b=_0x4610f2['user'][_0xc32c('0x2a')]({'plain':!![]});if(!_0x86e41b)throw new Error(_0xc32c('0x58'));if(_0x86e41b[_0xc32c('0x59')]===_0xc32c('0x5a')){var _0x51234d=_0x5c8d66['get']({'plain':!![]});var _0x32074d=[{'name':_0xc32c('0x2b'),'value':_0xc32c('0x2c')},{'name':'QueueCampaigns','value':'outbound'}];var _0x2ef934=_[_0xc32c('0x56')](_0x32074d,[_0xc32c('0x30'),_0x51234d['type']])[_0xc32c('0x37')];return db[_0xc32c('0x5b')]['find']({'where':{'name':_0x2ef934,'userProfileId':_0x86e41b[_0xc32c('0x5c')]},'raw':!![]})[_0xc32c('0x29')](function(_0x5a3455){if(_0x5a3455&&_0x5a3455[_0xc32c('0x5d')]===0x0){return db[_0xc32c('0x33')][_0xc32c('0x5e')]({'name':_0x51234d[_0xc32c('0x37')],'resourceId':_0x51234d['id'],'type':_0x5a3455[_0xc32c('0x37')],'sectionId':_0x5a3455['id']},{})['then'](function(){return _0x5c8d66;});}else{return _0x5c8d66;}})['catch'](function(_0x326a52){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x326a52);throw _0x326a52;});}return _0x5c8d66;})[_0xc32c('0x29')](respondWithResult(_0x5b3528,0xc9))[_0xc32c('0x51')](handleError(_0x5b3528,null));};exports[_0xc32c('0x5f')]=function(_0x492187,_0xd2669b){var _0x1e2b6b={'where':{'id':_0x492187['params']['id']}},_0x13eaf0={};_0x13eaf0[_0xc32c('0x41')]=_[_0xc32c('0x3f')](db[_0xc32c('0x3a')][_0xc32c('0x3b')]);_0x1e2b6b[_0xc32c('0x42')]=_[_0xc32c('0x43')](_0x13eaf0[_0xc32c('0x41')],qs[_0xc32c('0x44')](_0x492187[_0xc32c('0x3e')][_0xc32c('0x44')]));_0x1e2b6b[_0xc32c('0x42')]=_0x1e2b6b[_0xc32c('0x42')]['length']?_0x1e2b6b[_0xc32c('0x42')]:_0x13eaf0[_0xc32c('0x41')];if(_0x492187[_0xc32c('0x3e')][_0xc32c('0x54')]){_0x1e2b6b['include']=[{'all':!![]}];}_0x1e2b6b=_[_0xc32c('0x55')]({},_0x1e2b6b,_0x492187[_0xc32c('0x4d')]);return db[_0xc32c('0x3a')][_0xc32c('0x56')](_0x1e2b6b)['then'](handleEntityNotFound(_0xd2669b,null))['then'](function(_0x39d90d){if(_0x39d90d){var _0xd60a4a=_0x39d90d[_0xc32c('0x2a')]({'plain':!![]});_0xd60a4a=qs[_0xc32c('0x60')](_0xd60a4a,['id','createdAt',_0xc32c('0x61')]);_0x492187[_0xc32c('0x57')]=_[_0xc32c('0x60')](_0x492187[_0xc32c('0x57')],['id',_0xc32c('0x62'),_0xc32c('0x61')]);return db[_0xc32c('0x3a')][_0xc32c('0x5e')](_[_0xc32c('0x55')](_0xd60a4a,_0x492187[_0xc32c('0x57')]),{'include':_0x492187['query'][_0xc32c('0x54')]?[{'all':!![]}]:undefined})[_0xc32c('0x29')](function(_0x227ed4){var _0x4ff400=_0x492187[_0xc32c('0x5a')]['get']({'plain':!![]});if(!_0x4ff400)throw new Error(_0xc32c('0x58'));if(_0x4ff400[_0xc32c('0x59')]===_0xc32c('0x5a')){var _0x105b4c=_0x227ed4[_0xc32c('0x2a')]({'plain':!![]});var _0x1be2ba=[{'name':'VoiceQueues','value':_0xc32c('0x2c')},{'name':_0xc32c('0x2d'),'value':_0xc32c('0x2e')}];var _0xc7279=_['find'](_0x1be2ba,[_0xc32c('0x30'),_0x105b4c['type']])[_0xc32c('0x37')];return db[_0xc32c('0x5b')][_0xc32c('0x56')]({'where':{'name':_0xc7279,'userProfileId':_0x4ff400[_0xc32c('0x5c')]},'raw':!![]})[_0xc32c('0x29')](function(_0x3b8cc1){if(_0x3b8cc1&&_0x3b8cc1[_0xc32c('0x5d')]===0x0){return db[_0xc32c('0x33')][_0xc32c('0x5e')]({'name':_0x105b4c[_0xc32c('0x37')],'resourceId':_0x105b4c['id'],'type':_0x3b8cc1[_0xc32c('0x37')],'sectionId':_0x3b8cc1['id']},{})['then'](function(){return _0x227ed4;});}else{return _0x227ed4;}})[_0xc32c('0x51')](function(_0x48aa2d){logger[_0xc32c('0x35')](_0xc32c('0x63'),_0x48aa2d);throw _0x48aa2d;});}return _0x227ed4;});}})[_0xc32c('0x29')](respondWithResult(_0xd2669b,0xc9))[_0xc32c('0x51')](handleError(_0xd2669b,null));};exports['update']=function(_0x2547a3,_0x3f1890){if(_0x2547a3['body']['id']){delete _0x2547a3['body']['id'];}return db[_0xc32c('0x3a')]['find']({'where':{'id':_0x2547a3[_0xc32c('0x53')]['id']}})[_0xc32c('0x29')](handleEntityNotFound(_0x3f1890,null))[_0xc32c('0x29')](saveUpdates(_0x2547a3['body'],null))[_0xc32c('0x29')](respondWithResult(_0x3f1890,null))['catch'](handleError(_0x3f1890,null));};exports[_0xc32c('0x34')]=function(_0x48dbc4,_0x573b9c){return db['VoiceQueue']['find']({'where':{'id':_0x48dbc4['params']['id']}})['then'](handleEntityNotFound(_0x573b9c,null))[_0xc32c('0x29')](removeEntity(_0x573b9c,null))[_0xc32c('0x51')](handleError(_0x573b9c,null));};exports[_0xc32c('0x64')]=function(_0x495345,_0x14f3cd,_0x31a3d7){var _0x1d5bea={'raw':![],'where':{}};var _0x2ef1ae={};var _0x50e752={'count':0x0,'rows':[]};return db[_0xc32c('0x3a')][_0xc32c('0x65')]({'where':{'id':_0x495345[_0xc32c('0x53')]['id']}})[_0xc32c('0x29')](handleEntityNotFound(_0x14f3cd,null))['then'](function(_0x11a6a2){if(_0x11a6a2){_0x2ef1ae[_0xc32c('0x41')]=_[_0xc32c('0x3f')](db[_0xc32c('0x66')][_0xc32c('0x3b')]);_0x2ef1ae['query']=_[_0xc32c('0x3f')](_0x495345[_0xc32c('0x3e')]);_0x2ef1ae[_0xc32c('0x40')]=_['intersection'](_0x2ef1ae[_0xc32c('0x41')],_0x2ef1ae[_0xc32c('0x3e')]);_0x1d5bea[_0xc32c('0x42')]=_['intersection'](_0x2ef1ae['model'],qs[_0xc32c('0x44')](_0x495345['query'][_0xc32c('0x44')]));_0x1d5bea[_0xc32c('0x42')]=_0x1d5bea[_0xc32c('0x42')]['length']?_0x1d5bea['attributes']:_0x2ef1ae['model'];if(!_0x495345[_0xc32c('0x3e')]['hasOwnProperty'](_0xc32c('0x67'))){_0x1d5bea['limit']=qs[_0xc32c('0x47')](_0x495345[_0xc32c('0x3e')][_0xc32c('0x47')]);_0x1d5bea['offset']=qs[_0xc32c('0x22')](_0x495345['query'][_0xc32c('0x22')]);}_0x1d5bea[_0xc32c('0x48')]=qs['sort'](_0x495345[_0xc32c('0x3e')][_0xc32c('0x49')]);_0x1d5bea[_0xc32c('0x4b')]=qs[_0xc32c('0x40')](_[_0xc32c('0x4a')](_0x495345[_0xc32c('0x3e')],_0x2ef1ae[_0xc32c('0x40')]));_0x1d5bea['where'][_0xc32c('0x68')]=_0x11a6a2['id'];if(_0x495345['query'][_0xc32c('0x2f')]){_0x1d5bea[_0xc32c('0x4b')]=_[_0xc32c('0x55')](_0x1d5bea['where'],{'$or':_[_0xc32c('0x39')](_0x1d5bea[_0xc32c('0x42')],function(_0x3888f0){var _0x1763b7={};_0x1763b7[_0x3888f0]={'$like':'%'+_0x495345['query'][_0xc32c('0x2f')]+'%'};return _0x1763b7;})});}_0x1d5bea=_[_0xc32c('0x55')]({},_0x1d5bea,_0x495345['options']);return db[_0xc32c('0x66')]['count']({'where':_0x1d5bea['where']})[_0xc32c('0x29')](function(_0x5dcacf){_0x50e752[_0xc32c('0x23')]=_0x5dcacf;if(_0x495345[_0xc32c('0x3e')][_0xc32c('0x54')]){_0x1d5bea[_0xc32c('0x4e')]=[{'all':!![]}];}return db[_0xc32c('0x66')][_0xc32c('0x4f')](_0x1d5bea);})[_0xc32c('0x29')](function(_0x136059){_0x50e752[_0xc32c('0x50')]=_0x136059;return _0x50e752;});}})[_0xc32c('0x29')](respondWithFilteredResult(_0x14f3cd,_0x1d5bea))['catch'](handleError(_0x14f3cd,null));};exports[_0xc32c('0x69')]=function(_0xdda9e7,_0x42bc6c,_0x1a4074){var _0x3a7d64={'raw':!![],'where':{}};var _0x4c8ff8={};var _0x58ec08={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xc32c('0x65')]({'where':{'id':_0xdda9e7['params']['id']}})['then'](handleEntityNotFound(_0x42bc6c,null))[_0xc32c('0x29')](function(_0x2fd343){if(_0x2fd343){_0x4c8ff8[_0xc32c('0x41')]=_['keys'](db[_0xc32c('0x6a')][_0xc32c('0x3b')]);_0x4c8ff8[_0xc32c('0x3e')]=_[_0xc32c('0x3f')](_0xdda9e7[_0xc32c('0x3e')]);_0x4c8ff8[_0xc32c('0x40')]=_[_0xc32c('0x43')](_0x4c8ff8[_0xc32c('0x41')],_0x4c8ff8[_0xc32c('0x3e')]);_0x3a7d64['attributes']=_['intersection'](_0x4c8ff8['model'],qs['fields'](_0xdda9e7[_0xc32c('0x3e')]['fields']));_0x3a7d64[_0xc32c('0x42')]=_0x3a7d64['attributes'][_0xc32c('0x45')]?_0x3a7d64[_0xc32c('0x42')]:_0x4c8ff8[_0xc32c('0x41')];if(!_0xdda9e7[_0xc32c('0x3e')][_0xc32c('0x46')](_0xc32c('0x67'))){_0x3a7d64[_0xc32c('0x47')]=qs['limit'](_0xdda9e7[_0xc32c('0x3e')][_0xc32c('0x47')]);_0x3a7d64[_0xc32c('0x22')]=qs[_0xc32c('0x22')](_0xdda9e7[_0xc32c('0x3e')][_0xc32c('0x22')]);}_0x3a7d64['order']=qs[_0xc32c('0x49')](_0xdda9e7['query'][_0xc32c('0x49')]);_0x3a7d64['where']=qs[_0xc32c('0x40')](_[_0xc32c('0x4a')](_0xdda9e7[_0xc32c('0x3e')],_0x4c8ff8['filters']));_0x3a7d64['where']['VoiceQueueId']=_0x2fd343['id'];if(_0xdda9e7[_0xc32c('0x3e')][_0xc32c('0x2f')]){_0x3a7d64[_0xc32c('0x4b')]=_['merge'](_0x3a7d64[_0xc32c('0x4b')],{'$or':_['map'](_0x3a7d64[_0xc32c('0x42')],function(_0x17b466){var _0xd0c340={};_0xd0c340[_0x17b466]={'$like':'%'+_0xdda9e7[_0xc32c('0x3e')]['filter']+'%'};return _0xd0c340;})});}_0x3a7d64=_[_0xc32c('0x55')]({},_0x3a7d64,_0xdda9e7[_0xc32c('0x4d')]);return db[_0xc32c('0x6a')]['count']({'where':_0x3a7d64[_0xc32c('0x4b')]})[_0xc32c('0x29')](function(_0x4ab357){_0x58ec08[_0xc32c('0x23')]=_0x4ab357;if(_0xdda9e7[_0xc32c('0x3e')][_0xc32c('0x54')]){_0x3a7d64[_0xc32c('0x4e')]=[{'all':!![]}];}return db[_0xc32c('0x6a')][_0xc32c('0x4f')](_0x3a7d64);})['then'](function(_0xc2b60e){_0x58ec08[_0xc32c('0x50')]=_0xc2b60e;return _0x58ec08;});}})[_0xc32c('0x29')](respondWithFilteredResult(_0x42bc6c,_0x3a7d64))[_0xc32c('0x51')](handleError(_0x42bc6c,null));};exports[_0xc32c('0x6b')]=function(_0x2abc14,_0x15dd82,_0x226b31){var _0x49f833={'raw':!![],'where':{}};var _0x4f26ec={};var _0x367f1c={'count':0x0,'rows':[]};return db[_0xc32c('0x3a')][_0xc32c('0x65')]({'where':{'id':_0x2abc14['params']['id']}})['then'](handleEntityNotFound(_0x15dd82,null))[_0xc32c('0x29')](function(_0x40c5e2){if(_0x40c5e2){_0x4f26ec[_0xc32c('0x41')]=_['keys'](db[_0xc32c('0x6c')][_0xc32c('0x3b')]);_0x4f26ec[_0xc32c('0x3e')]=_[_0xc32c('0x3f')](_0x2abc14[_0xc32c('0x3e')]);_0x4f26ec[_0xc32c('0x40')]=_[_0xc32c('0x43')](_0x4f26ec['model'],_0x4f26ec[_0xc32c('0x3e')]);_0x49f833[_0xc32c('0x42')]=_[_0xc32c('0x43')](_0x4f26ec['model'],qs[_0xc32c('0x44')](_0x2abc14[_0xc32c('0x3e')][_0xc32c('0x44')]));_0x49f833['attributes']=_0x49f833[_0xc32c('0x42')]['length']?_0x49f833['attributes']:_0x4f26ec[_0xc32c('0x41')];if(!_0x2abc14[_0xc32c('0x3e')][_0xc32c('0x46')]('nolimit')){_0x49f833[_0xc32c('0x47')]=qs[_0xc32c('0x47')](_0x2abc14[_0xc32c('0x3e')]['limit']);_0x49f833[_0xc32c('0x22')]=qs[_0xc32c('0x22')](_0x2abc14['query'][_0xc32c('0x22')]);}_0x49f833['order']=qs[_0xc32c('0x49')](_0x2abc14['query'][_0xc32c('0x49')]);_0x49f833[_0xc32c('0x4b')]=qs[_0xc32c('0x40')](_[_0xc32c('0x4a')](_0x2abc14['query'],_0x4f26ec[_0xc32c('0x40')]));_0x49f833[_0xc32c('0x4b')][_0xc32c('0x68')]=_0x40c5e2['id'];if(_0x2abc14['query']['filter']){_0x49f833[_0xc32c('0x4b')]=_[_0xc32c('0x55')](_0x49f833[_0xc32c('0x4b')],{'$or':_[_0xc32c('0x39')](_0x49f833[_0xc32c('0x42')],function(_0x22d871){var _0x554cb0={};_0x554cb0[_0x22d871]={'$like':'%'+_0x2abc14['query'][_0xc32c('0x2f')]+'%'};return _0x554cb0;})});}_0x49f833=_[_0xc32c('0x55')]({},_0x49f833,_0x2abc14[_0xc32c('0x4d')]);return db[_0xc32c('0x6c')][_0xc32c('0x23')]({'where':_0x49f833[_0xc32c('0x4b')]})[_0xc32c('0x29')](function(_0x752fcf){_0x367f1c['count']=_0x752fcf;if(_0x2abc14[_0xc32c('0x3e')][_0xc32c('0x54')]){_0x49f833['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0xc32c('0x4f')](_0x49f833);})['then'](function(_0x499793){_0x367f1c[_0xc32c('0x50')]=_0x499793;return _0x367f1c;});}})[_0xc32c('0x29')](respondWithFilteredResult(_0x15dd82,_0x49f833))[_0xc32c('0x51')](handleError(_0x15dd82,null));};exports[_0xc32c('0x6d')]=function(_0x2f0145,_0x527298,_0xeee314){var _0x3591f2={'raw':!![],'where':{}};var _0x436ce1={};var _0x493353={'count':0x0,'rows':[]};return db[_0xc32c('0x3a')][_0xc32c('0x65')]({'where':{'id':_0x2f0145['params']['id']}})['then'](handleEntityNotFound(_0x527298,null))['then'](function(_0x34a301){if(_0x34a301){_0x436ce1['model']=_[_0xc32c('0x3f')](db[_0xc32c('0x6e')]['rawAttributes']);_0x436ce1[_0xc32c('0x3e')]=_['keys'](_0x2f0145[_0xc32c('0x3e')]);_0x436ce1[_0xc32c('0x40')]=_['intersection'](_0x436ce1['model'],_0x436ce1['query']);_0x3591f2[_0xc32c('0x42')]=_[_0xc32c('0x43')](_0x436ce1[_0xc32c('0x41')],qs['fields'](_0x2f0145[_0xc32c('0x3e')]['fields']));_0x3591f2[_0xc32c('0x42')]=_0x3591f2['attributes'][_0xc32c('0x45')]?_0x3591f2[_0xc32c('0x42')]:_0x436ce1[_0xc32c('0x41')];if(!_0x2f0145['query'][_0xc32c('0x46')]('nolimit')){_0x3591f2[_0xc32c('0x47')]=qs[_0xc32c('0x47')](_0x2f0145[_0xc32c('0x3e')][_0xc32c('0x47')]);_0x3591f2[_0xc32c('0x22')]=qs['offset'](_0x2f0145[_0xc32c('0x3e')]['offset']);}_0x3591f2['order']=qs[_0xc32c('0x49')](_0x2f0145[_0xc32c('0x3e')]['sort']);_0x3591f2[_0xc32c('0x4b')]=qs[_0xc32c('0x40')](_['pick'](_0x2f0145['query'],_0x436ce1[_0xc32c('0x40')]));_0x3591f2[_0xc32c('0x4b')][_0xc32c('0x68')]=_0x34a301['id'];if(_0x2f0145[_0xc32c('0x3e')][_0xc32c('0x2f')]){_0x3591f2[_0xc32c('0x4b')]=_['merge'](_0x3591f2['where'],{'$or':_[_0xc32c('0x39')](_0x3591f2[_0xc32c('0x42')],function(_0x729a9b){var _0x38934d={};_0x38934d[_0x729a9b]={'$like':'%'+_0x2f0145['query'][_0xc32c('0x2f')]+'%'};return _0x38934d;})});}_0x3591f2=_[_0xc32c('0x55')]({},_0x3591f2,_0x2f0145[_0xc32c('0x4d')]);return db['CmHopperBlack'][_0xc32c('0x23')]({'where':_0x3591f2['where']})[_0xc32c('0x29')](function(_0x37144b){_0x493353[_0xc32c('0x23')]=_0x37144b;if(_0x2f0145['query'][_0xc32c('0x54')]){_0x3591f2[_0xc32c('0x4e')]=[{'all':!![]}];}return db[_0xc32c('0x6e')][_0xc32c('0x4f')](_0x3591f2);})[_0xc32c('0x29')](function(_0x163932){_0x493353[_0xc32c('0x50')]=_0x163932;return _0x493353;});}})['then'](respondWithFilteredResult(_0x527298,_0x3591f2))['catch'](handleError(_0x527298,null));};exports[_0xc32c('0x6f')]=function(_0x3a0add,_0x48dcda,_0x1d49a1){var _0x25d6f9={};var _0x468f11={};var _0x3be1cd;var _0x46bf62;return db[_0xc32c('0x3a')][_0xc32c('0x65')]({'where':{'id':_0x3a0add['params']['id']}})[_0xc32c('0x29')](handleEntityNotFound(_0x48dcda,null))['then'](function(_0x41343c){if(_0x41343c){_0x3be1cd=_0x41343c;_0x468f11['model']=_['keys'](db[_0xc32c('0x70')][_0xc32c('0x3b')]);_0x468f11['query']=_[_0xc32c('0x3f')](_0x3a0add[_0xc32c('0x3e')]);_0x468f11[_0xc32c('0x40')]=_[_0xc32c('0x43')](_0x468f11[_0xc32c('0x41')],_0x468f11[_0xc32c('0x3e')]);_0x25d6f9['attributes']=_[_0xc32c('0x43')](_0x468f11[_0xc32c('0x41')],qs[_0xc32c('0x44')](_0x3a0add[_0xc32c('0x3e')]['fields']));_0x25d6f9[_0xc32c('0x42')]=_0x25d6f9['attributes'][_0xc32c('0x45')]?_0x25d6f9['attributes']:_0x468f11['model'];_0x25d6f9[_0xc32c('0x48')]=qs[_0xc32c('0x49')](_0x3a0add[_0xc32c('0x3e')][_0xc32c('0x49')]);_0x25d6f9[_0xc32c('0x4b')]=qs['filters'](_['pick'](_0x3a0add[_0xc32c('0x3e')],_0x468f11['filters']));if(_0x3a0add[_0xc32c('0x3e')]['filter']){_0x25d6f9[_0xc32c('0x4b')]=_[_0xc32c('0x55')](_0x25d6f9[_0xc32c('0x4b')],{'$or':_[_0xc32c('0x39')](_0x25d6f9[_0xc32c('0x42')],function(_0x130fe9){var _0x418a76={};_0x418a76[_0x130fe9]={'$like':'%'+_0x3a0add[_0xc32c('0x3e')][_0xc32c('0x2f')]+'%'};return _0x418a76;})});}_0x25d6f9=_[_0xc32c('0x55')]({},_0x25d6f9,_0x3a0add[_0xc32c('0x4d')]);return _0x3be1cd[_0xc32c('0x6f')](_0x25d6f9);}})[_0xc32c('0x29')](function(_0x273494){if(_0x273494){_0x46bf62=_0x273494[_0xc32c('0x45')];if(!_0x3a0add[_0xc32c('0x3e')]['hasOwnProperty'](_0xc32c('0x67'))){_0x25d6f9[_0xc32c('0x47')]=qs['limit'](_0x3a0add[_0xc32c('0x3e')]['limit']);_0x25d6f9[_0xc32c('0x22')]=qs[_0xc32c('0x22')](_0x3a0add[_0xc32c('0x3e')][_0xc32c('0x22')]);}return _0x3be1cd['getTeams'](_0x25d6f9);}})[_0xc32c('0x29')](function(_0x430677){if(_0x430677){return _0x430677?{'count':_0x46bf62,'rows':_0x430677}:null;}})[_0xc32c('0x29')](respondWithResult(_0x48dcda,null))['catch'](handleError(_0x48dcda,null));};exports['addTeams']=function(_0x20e7f4,_0x205c3a,_0x4acdf9){var _0x24a8e6=_0x20e7f4['body'][_0xc32c('0x71')];var _0x5a2386=_['map'](_0x24a8e6,'id');return db['Team'][_0xc32c('0x4f')]({'where':{'id':_0x5a2386},'attributes':['id'],'include':[{'model':db[_0xc32c('0x72')],'as':_0xc32c('0x73'),'attributes':['id',_0xc32c('0x37'),_0xc32c('0x74'),_0xc32c('0x75'),_0xc32c('0x76')],'raw':!![]}]})[_0xc32c('0x29')](function(_0x408d67){if(_0x408d67){var _0x1e3f24=_[_0xc32c('0x77')](_0x408d67,function(_0x1b46fc){var _0x31826c=_0x1b46fc[_0xc32c('0x2a')]({'plain':!![]});_0x31826c[_0xc32c('0x73')]['forEach'](function(_0x4637c7){_0x4637c7[_0xc32c('0x78')]=_[_0xc32c('0x56')](_0x24a8e6,{'id':_0x31826c['id']})[_0xc32c('0x78')];});return _0x31826c['Agents'];});return db[_0xc32c('0x3a')][_0xc32c('0x56')]({'where':{'id':_0x20e7f4[_0xc32c('0x53')]['id']}})[_0xc32c('0x29')](function(_0x210dc8){return db[_0xc32c('0x79')]['transaction'](function(_0x58014d){return _0x210dc8[_0xc32c('0x7a')](_0x5a2386,{'transaction':_0x58014d})['then'](function(){return BPromise[_0xc32c('0x7b')](_0x24a8e6,function(_0x376cf4){return db[_0xc32c('0x7c')]['upsert']({'TeamId':_0x376cf4['id'],'VoiceQueueId':_0x20e7f4[_0xc32c('0x53')]['id'],'penalty':_0x376cf4[_0xc32c('0x78')]},{'transaction':_0x58014d});});})['then'](function(){return BPromise[_0xc32c('0x7b')](_0x1e3f24,function(_0x3c442d){return db[_0xc32c('0x7d')][_0xc32c('0x7e')]({'where':{'UserId':_0x3c442d['id'],'VoiceQueueId':_0x20e7f4['params']['id']},'defaults':{'penalty':_0x3c442d[_0xc32c('0x78')]},'transaction':_0x58014d});});})['then'](function(){return BPromise[_0xc32c('0x7b')](_[_0xc32c('0x2f')](_0x1e3f24,{'online':!![]}),function(_0x4aae6b){return db[_0xc32c('0x7f')][_0xc32c('0x80')]({'membername':_0x4aae6b[_0xc32c('0x37')],'UserId':_0x4aae6b['id'],'queue_name':_0x210dc8[_0xc32c('0x37')],'VoiceQueueId':_0x210dc8['id'],'interface':_[_0xc32c('0x81')](_0x4aae6b['interface'])?util[_0xc32c('0x82')](_0xc32c('0x83'),_0x4aae6b[_0xc32c('0x37')]):_0x4aae6b[_0xc32c('0x76')],'paused':_0x4aae6b[_0xc32c('0x75')]||![],'penalty':_0x4aae6b[_0xc32c('0x78')]},{'transaction':_0x58014d});});})['then'](function(){_0x1e3f24['forEach'](function(_0x7f5403){socket['emit'](_0xc32c('0x84'),{'UserId':_0x7f5403['id'],'VoiceQueueId':_0x210dc8['id']});});});});});}})[_0xc32c('0x29')](respondWithStatusCode(_0x205c3a,null))[_0xc32c('0x51')](handleError(_0x205c3a,null));};exports[_0xc32c('0x85')]=function(_0xcf268,_0x29f4f0,_0x2a9223){return db[_0xc32c('0x70')][_0xc32c('0x4f')]({'where':{'id':_0xcf268[_0xc32c('0x3e')][_0xc32c('0x86')]},'attributes':['id'],'include':[{'model':db[_0xc32c('0x72')],'as':_0xc32c('0x73'),'attributes':['id'],'raw':!![]}]})[_0xc32c('0x29')](handleEntityNotFound(_0x29f4f0,null))[_0xc32c('0x29')](function(_0x1d9adc){var _0x5e221e=_['map'](_0x1d9adc,'id');var _0x38d8d0=[];var _0x557abf=[];var _0x2942d4=squel[_0xc32c('0x87')]();_0x2942d4[_0xc32c('0x88')](_0xc32c('0x89'))[_0xc32c('0x8a')](_0xc32c('0x8b'),'tq')['join'](_0xc32c('0x8c'),'ut',_0xc32c('0x8d'))['where']('VoiceQueueId\x20=\x20?',_0xcf268[_0xc32c('0x53')]['id']);for(var _0x477b04=0x0;_0x477b04<_0x1d9adc[_0xc32c('0x45')];_0x477b04+=0x1){let _0x146f5a=_0x1d9adc[_0x477b04];for(var _0x3cb0ae=0x0;_0x3cb0ae<_0x146f5a[_0xc32c('0x73')][_0xc32c('0x45')];_0x3cb0ae+=0x1){let _0x1ed895=_0x146f5a[_0xc32c('0x73')][_0x3cb0ae];var _0x46f09a=_0x2942d4[_0xc32c('0x5f')]();_0x46f09a[_0xc32c('0x4b')](_0xc32c('0x8e'),_0x1ed895['id']);_0x557abf[_0xc32c('0x8f')](db[_0xc32c('0x79')][_0xc32c('0x3e')](_0x46f09a[_0xc32c('0x90')](),{'type':db[_0xc32c('0x79')][_0xc32c('0x91')]['SELECT']})[_0xc32c('0x29')](function(_0x2bbade){if(_0x2bbade['length']===0x1){return _0x1ed895['id'];}else{var _0x3a2dbe=_['every'](_[_0xc32c('0x39')](_0x2bbade,_0xc32c('0x92')),function(_0xa0c011){return _[_0xc32c('0x31')](_0x5e221e,_0xa0c011);});if(_0x3a2dbe){return _0x1ed895['id'];}}}));}}return BPromise[_0xc32c('0x93')](_0x557abf)[_0xc32c('0x29')](function(_0x2258d9){_0x38d8d0=_(_0x38d8d0)[_0xc32c('0x94')](_0x2258d9)[_0xc32c('0x95')]()['value']();return db[_0xc32c('0x3a')]['find']({'where':{'id':_0xcf268['params']['id']}})[_0xc32c('0x29')](function(_0x8bdc96){return db[_0xc32c('0x79')][_0xc32c('0x96')](function(_0x4af328){return _0x8bdc96['removeTeams'](_0xcf268[_0xc32c('0x3e')][_0xc32c('0x86')],{'transaction':_0x4af328})[_0xc32c('0x29')](function(){if(!_['isEmpty'](_0x38d8d0)){return _0x8bdc96[_0xc32c('0x97')](_0x38d8d0,{'transaction':_0x4af328})['then'](function(){return db[_0xc32c('0x7f')][_0xc32c('0x34')]({'where':{'VoiceQueueId':_0xcf268[_0xc32c('0x53')]['id'],'UserId':_0x38d8d0},'transaction':_0x4af328});});}})[_0xc32c('0x29')](function(){_0x38d8d0['forEach'](function(_0x222513){socket[_0xc32c('0x98')](_0xc32c('0x99'),{'UserId':_0x222513,'VoiceQueueId':_0x8bdc96['id']});});});});});});})['then'](respondWithStatusCode(_0x29f4f0,null))[_0xc32c('0x51')](handleError(_0x29f4f0,null));};exports[_0xc32c('0x9a')]=function(_0x167dae,_0x72685a,_0x1d89f8){var _0x4fdb78,_0x4a98bb;return db[_0xc32c('0x3a')][_0xc32c('0x56')]({'where':{'id':_0x167dae['params']['id']}})[_0xc32c('0x29')](handleEntityNotFound(_0x72685a,null))[_0xc32c('0x29')](function(_0x146299){if(_0x146299){_0x4a98bb=_0x146299;return _0x146299[_0xc32c('0x9a')](_0x167dae['body'][_0xc32c('0x86')],_[_0xc32c('0x60')](_0x167dae['body'],[_0xc32c('0x86'),'id'])||{})['spread'](function(_0x313e13){for(var _0x4e35bd=0x0;_0x4e35bd<_0x167dae[_0xc32c('0x57')][_0xc32c('0x86')][_0xc32c('0x45')];_0x4e35bd+=0x1){socket[_0xc32c('0x98')]('userVoiceQueue:save',{'UserId':Number(_0x167dae['body']['ids'][_0x4e35bd]),'VoiceQueueId':Number(_0x167dae[_0xc32c('0x53')]['id'])});}return _0x313e13;});}})[_0xc32c('0x29')](function(_0xbb6697){_0x4fdb78=_0xbb6697||[];if(_0x4a98bb){return db[_0xc32c('0x72')][_0xc32c('0x4f')]({'where':{'id':_0x167dae['body']['ids']},'attributes':['id',_0xc32c('0x37'),_0xc32c('0x74'),_0xc32c('0x75'),_0xc32c('0x76')],'raw':!![]});}})[_0xc32c('0x29')](function(_0x5a42b0){if(!_[_0xc32c('0x9b')](_0x5a42b0)){var _0x1da0b8=[];for(var _0x2a9288=0x0;_0x2a9288<_0x5a42b0['length'];_0x2a9288++){if(_0x5a42b0[_0x2a9288]['online']){_0x1da0b8['push'](db['UserVoiceQueueRt'][_0xc32c('0x80')]({'membername':_0x5a42b0[_0x2a9288][_0xc32c('0x37')],'UserId':_0x5a42b0[_0x2a9288]['id'],'queue_name':_0x4a98bb['name'],'VoiceQueueId':_0x4a98bb['id'],'interface':_[_0xc32c('0x81')](_0x5a42b0[_0x2a9288][_0xc32c('0x76')])?util['format']('SIP/%s',_0x5a42b0[_0x2a9288]['name']):_0x5a42b0[_0x2a9288][_0xc32c('0x76')],'paused':_0x5a42b0[_0x2a9288]['voicePause']||![],'penalty':_0x167dae[_0xc32c('0x57')][_0xc32c('0x78')]||0x0}));}}return BPromise[_0xc32c('0x93')](_0x1da0b8);}})[_0xc32c('0x29')](function(){return _0x4fdb78;})[_0xc32c('0x29')](respondWithResult(_0x72685a,null))['catch'](handleError(_0x72685a,null));};exports['removeAgents']=function(_0x40d3ce,_0x3a920e,_0xcc636c){return db[_0xc32c('0x3a')]['find']({'where':{'id':_0x40d3ce['params']['id']}})[_0xc32c('0x29')](handleEntityNotFound(_0x3a920e,null))['then'](function(_0x55e6d0){if(_0x55e6d0){return _0x55e6d0[_0xc32c('0x97')](_0x40d3ce[_0xc32c('0x3e')][_0xc32c('0x86')])[_0xc32c('0x29')](function(){if(_[_0xc32c('0x9c')](_0x40d3ce['query'][_0xc32c('0x86')])){for(var _0x47c2d1=0x0;_0x47c2d1<_0x40d3ce[_0xc32c('0x3e')][_0xc32c('0x86')][_0xc32c('0x45')];_0x47c2d1+=0x1){socket[_0xc32c('0x98')]('userVoiceQueue:remove',{'UserId':Number(_0x40d3ce['query']['ids'][_0x47c2d1]),'VoiceQueueId':Number(_0x40d3ce[_0xc32c('0x53')]['id'])});}}else{socket[_0xc32c('0x98')](_0xc32c('0x99'),{'UserId':Number(_0x40d3ce[_0xc32c('0x3e')][_0xc32c('0x86')]),'VoiceQueueId':Number(_0x40d3ce[_0xc32c('0x53')]['id'])});}});}})[_0xc32c('0x29')](function(_0x4623c2){return db[_0xc32c('0x7f')][_0xc32c('0x34')]({'where':{'VoiceQueueId':_0x40d3ce[_0xc32c('0x53')]['id'],'UserId':_0x40d3ce[_0xc32c('0x3e')][_0xc32c('0x86')]}})['then'](function(){return _0x4623c2;});})[_0xc32c('0x29')](respondWithStatusCode(_0x3a920e,null))[_0xc32c('0x51')](handleError(_0x3a920e,null));};exports[_0xc32c('0x9d')]=function(_0xcaf12a,_0x274243,_0x5e4994){var _0xd85690={};var _0x54447f={};var _0x91bf46;var _0x1b8e36;return db['VoiceQueue'][_0xc32c('0x65')]({'where':{'id':_0xcaf12a['params']['id']}})['then'](handleEntityNotFound(_0x274243,null))[_0xc32c('0x29')](function(_0x1bbe1c){if(_0x1bbe1c){_0x91bf46=_0x1bbe1c;_0x54447f[_0xc32c('0x41')]=_[_0xc32c('0x3f')](db[_0xc32c('0x72')]['rawAttributes']);_0x54447f['query']=_['keys'](_0xcaf12a[_0xc32c('0x3e')]);_0x54447f[_0xc32c('0x40')]=_[_0xc32c('0x43')](_0x54447f[_0xc32c('0x41')],_0x54447f[_0xc32c('0x3e')]);_0xd85690[_0xc32c('0x42')]=_[_0xc32c('0x43')](_0x54447f[_0xc32c('0x41')],qs['fields'](_0xcaf12a[_0xc32c('0x3e')][_0xc32c('0x44')]));_0xd85690[_0xc32c('0x42')]=_0xd85690[_0xc32c('0x42')]['length']?_0xd85690[_0xc32c('0x42')]:_0x54447f[_0xc32c('0x41')];_0xd85690['order']=qs[_0xc32c('0x49')](_0xcaf12a[_0xc32c('0x3e')]['sort']);_0xd85690['where']=qs[_0xc32c('0x40')](_[_0xc32c('0x4a')](_0xcaf12a[_0xc32c('0x3e')],_0x54447f[_0xc32c('0x40')]));if(_0xcaf12a[_0xc32c('0x3e')][_0xc32c('0x2f')]){_0xd85690[_0xc32c('0x4b')]=_['merge'](_0xd85690[_0xc32c('0x4b')],{'$or':_['map'](_0xd85690[_0xc32c('0x42')],function(_0x563dd7){var _0x54569a={};_0x54569a[_0x563dd7]={'$like':'%'+_0xcaf12a[_0xc32c('0x3e')]['filter']+'%'};return _0x54569a;})});}_0xd85690=_[_0xc32c('0x55')]({},_0xd85690,_0xcaf12a['options']);return _0x91bf46[_0xc32c('0x9d')](_0xd85690);}})[_0xc32c('0x29')](function(_0x2a7765){if(_0x2a7765){_0x1b8e36=_0x2a7765['length'];if(!_0xcaf12a[_0xc32c('0x3e')][_0xc32c('0x46')](_0xc32c('0x67'))){_0xd85690[_0xc32c('0x47')]=qs[_0xc32c('0x47')](_0xcaf12a[_0xc32c('0x3e')][_0xc32c('0x47')]);_0xd85690[_0xc32c('0x22')]=qs[_0xc32c('0x22')](_0xcaf12a[_0xc32c('0x3e')][_0xc32c('0x22')]);}return _0x91bf46[_0xc32c('0x9d')](_0xd85690);}})['then'](function(_0x4b68b8){if(_0x4b68b8){return _0x4b68b8?{'count':_0x1b8e36,'rows':_0x4b68b8}:null;}})[_0xc32c('0x29')](respondWithResult(_0x274243,null))[_0xc32c('0x51')](handleError(_0x274243,null));};exports[_0xc32c('0x9e')]=function(_0x420790,_0x47db50,_0x302d6c){var _0x3dddb9={};var _0x1f666b={};var _0x3cbcc0;var _0x1f5871;return db['VoiceQueue']['findOne']({'where':{'id':_0x420790[_0xc32c('0x53')]['id']}})[_0xc32c('0x29')](handleEntityNotFound(_0x47db50,null))[_0xc32c('0x29')](function(_0x22e095){if(_0x22e095){_0x3cbcc0=_0x22e095;_0x1f666b[_0xc32c('0x41')]=_[_0xc32c('0x3f')](db[_0xc32c('0x7f')][_0xc32c('0x3b')]);_0x1f666b[_0xc32c('0x3e')]=_[_0xc32c('0x3f')](_0x420790[_0xc32c('0x3e')]);_0x1f666b[_0xc32c('0x40')]=_[_0xc32c('0x43')](_0x1f666b[_0xc32c('0x41')],_0x1f666b[_0xc32c('0x3e')]);_0x3dddb9['attributes']=_['intersection'](_0x1f666b[_0xc32c('0x41')],qs['fields'](_0x420790[_0xc32c('0x3e')][_0xc32c('0x44')]));_0x3dddb9[_0xc32c('0x42')]=_0x3dddb9['attributes']['length']?_0x3dddb9[_0xc32c('0x42')]:_0x1f666b[_0xc32c('0x41')];_0x3dddb9[_0xc32c('0x48')]=qs[_0xc32c('0x49')](_0x420790[_0xc32c('0x3e')][_0xc32c('0x49')]);_0x3dddb9['where']=qs[_0xc32c('0x40')](_[_0xc32c('0x4a')](_0x420790['query'],_0x1f666b['filters']));if(_0x420790[_0xc32c('0x3e')][_0xc32c('0x2f')]){_0x3dddb9[_0xc32c('0x4b')]=_[_0xc32c('0x55')](_0x3dddb9[_0xc32c('0x4b')],{'$or':_[_0xc32c('0x39')](_0x3dddb9[_0xc32c('0x42')],function(_0xa76f70){var _0x3ba7ea={};_0x3ba7ea[_0xa76f70]={'$like':'%'+_0x420790['query'][_0xc32c('0x2f')]+'%'};return _0x3ba7ea;})});}_0x3dddb9=_['merge']({},_0x3dddb9,_0x420790[_0xc32c('0x4d')]);return _0x3cbcc0[_0xc32c('0x9e')](_0x3dddb9);}})['then'](function(_0x565dda){if(_0x565dda){_0x1f5871=_0x565dda[_0xc32c('0x45')];if(!_0x420790[_0xc32c('0x3e')][_0xc32c('0x46')]('nolimit')){_0x3dddb9['limit']=qs[_0xc32c('0x47')](_0x420790[_0xc32c('0x3e')][_0xc32c('0x47')]);_0x3dddb9[_0xc32c('0x22')]=qs[_0xc32c('0x22')](_0x420790[_0xc32c('0x3e')]['offset']);}return _0x3cbcc0[_0xc32c('0x9e')](_0x3dddb9);}})[_0xc32c('0x29')](function(_0x5633f2){return _0x5633f2?{'count':_0x1f5871,'rows':_0x5633f2}:null;})[_0xc32c('0x29')](respondWithResult(_0x47db50,null))['catch'](handleError(_0x47db50,null));};exports[_0xc32c('0x9f')]=function(_0x1a0a44,_0x147a32,_0x5d7698){var _0x5ba3a9={};var _0x4bd504={};var _0x201b75;var _0x57feaf;return db['VoiceQueue'][_0xc32c('0x65')]({'where':{'id':_0x1a0a44[_0xc32c('0x53')]['id']}})[_0xc32c('0x29')](handleEntityNotFound(_0x147a32,null))[_0xc32c('0x29')](function(_0xb898c2){if(_0xb898c2){_0x201b75=_0xb898c2;_0x4bd504['model']=_[_0xc32c('0x3f')](db[_0xc32c('0xa0')][_0xc32c('0x3b')]);_0x4bd504[_0xc32c('0x3e')]=_[_0xc32c('0x3f')](_0x1a0a44[_0xc32c('0x3e')]);_0x4bd504[_0xc32c('0x40')]=_[_0xc32c('0x43')](_0x4bd504['model'],_0x4bd504[_0xc32c('0x3e')]);_0x5ba3a9[_0xc32c('0x42')]=_['intersection'](_0x4bd504[_0xc32c('0x41')],qs[_0xc32c('0x44')](_0x1a0a44[_0xc32c('0x3e')][_0xc32c('0x44')]));_0x5ba3a9['attributes']=_0x5ba3a9[_0xc32c('0x42')][_0xc32c('0x45')]?_0x5ba3a9['attributes']:_0x4bd504[_0xc32c('0x41')];_0x5ba3a9[_0xc32c('0x48')]=qs[_0xc32c('0x49')](_0x1a0a44[_0xc32c('0x3e')]['sort']);_0x5ba3a9[_0xc32c('0x4b')]=qs[_0xc32c('0x40')](_[_0xc32c('0x4a')](_0x1a0a44[_0xc32c('0x3e')],_0x4bd504['filters']));if(_0x1a0a44[_0xc32c('0x3e')][_0xc32c('0x2f')]){_0x5ba3a9['where']=_[_0xc32c('0x55')](_0x5ba3a9['where'],{'$or':_[_0xc32c('0x39')](_0x5ba3a9[_0xc32c('0x42')],function(_0xb59ee9){var _0x2ee361={};_0x2ee361[_0xb59ee9]={'$like':'%'+_0x1a0a44['query'][_0xc32c('0x2f')]+'%'};return _0x2ee361;})});}_0x5ba3a9=_['merge']({},_0x5ba3a9,_0x1a0a44[_0xc32c('0x4d')]);return _0x201b75[_0xc32c('0x9f')](_0x5ba3a9);}})[_0xc32c('0x29')](function(_0x20570f){if(_0x20570f){_0x57feaf=_0x20570f[_0xc32c('0x45')];if(!_0x1a0a44['query'][_0xc32c('0x46')](_0xc32c('0x67'))){_0x5ba3a9[_0xc32c('0x47')]=qs[_0xc32c('0x47')](_0x1a0a44[_0xc32c('0x3e')][_0xc32c('0x47')]);_0x5ba3a9[_0xc32c('0x22')]=qs[_0xc32c('0x22')](_0x1a0a44[_0xc32c('0x3e')][_0xc32c('0x22')]);}return _0x201b75[_0xc32c('0x9f')](_0x5ba3a9);}})[_0xc32c('0x29')](function(_0x1f7e75){if(_0x1f7e75){return _0x1f7e75?{'count':_0x57feaf,'rows':_0x1f7e75}:null;}})[_0xc32c('0x29')](respondWithResult(_0x147a32,null))['catch'](handleError(_0x147a32,null));};exports[_0xc32c('0xa1')]=function(_0x2c43b7,_0x520490,_0x3323b0){var _0x616957,_0x587d06;return db[_0xc32c('0x3a')][_0xc32c('0x56')]({'where':{'id':_0x2c43b7['params']['id']}})[_0xc32c('0x29')](handleEntityNotFound(_0x520490,null))[_0xc32c('0x29')](function(_0x41a9d9){if(_0x41a9d9){_0x587d06=_0x41a9d9;return _0x41a9d9[_0xc32c('0xa1')](_0x2c43b7['body'][_0xc32c('0x86')],_[_0xc32c('0x60')](_0x2c43b7[_0xc32c('0x57')],[_0xc32c('0x86'),'id'])||{});}return null;})[_0xc32c('0xa2')](function(_0x4ff5ee){var _0xbdc361;_0x616957=_0x4ff5ee||[];var _0x3f1bee=[];if(_0x4ff5ee){for(var _0x59decb=0x0;_0x59decb<_0x4ff5ee[_0xc32c('0x45')];_0x59decb+=0x1){var _0x56ec5c=_0x4ff5ee[_0x59decb]['get']({'plain':!![]});_0x587d06[_0xc32c('0xa3')]=_0x2c43b7[_0xc32c('0x57')][_0xc32c('0xa3')]?_0x2c43b7['body']['dialCheckDuplicateType']:_0x587d06[_0xc32c('0xa3')];switch(_0x587d06[_0xc32c('0xa3')]){case _0xc32c('0xa4'):_0xbdc361=squel[_0xc32c('0xa5')]()[_0xc32c('0xa6')](_0xc32c('0xa7'))[_0xc32c('0xa8')]([_0xc32c('0xa9'),'scheduledAt',_0xc32c('0xaa'),_0xc32c('0xab'),_0xc32c('0x68'),_0xc32c('0x62'),_0xc32c('0x61')],squel[_0xc32c('0x87')]()['field'](_0xc32c('0xa9'),'phone')['field']('NOW()',_0xc32c('0xac'))[_0xc32c('0x88')]('id',_0xc32c('0xaa'))[_0xc32c('0x88')](_0x56ec5c[_0xc32c('0xad')][_0xc32c('0x90')](),_0xc32c('0xab'))[_0xc32c('0x88')](_0x2c43b7[_0xc32c('0x53')]['id'][_0xc32c('0x90')](),_0xc32c('0x68'))[_0xc32c('0x88')]('NOW()','createdAt')['field']('NOW()',_0xc32c('0x61'))[_0xc32c('0x8a')](_0xc32c('0xae'))[_0xc32c('0x4b')](_0xc32c('0xaf'))[_0xc32c('0x4b')](_0xc32c('0xb0'),_0x56ec5c[_0xc32c('0xad')][_0xc32c('0x90')]())[_0xc32c('0x4b')](_0xc32c('0xb1'))[_0xc32c('0x4b')](_0xc32c('0xb2'),squel[_0xc32c('0x87')]()[_0xc32c('0x88')](_0xc32c('0xb3'))[_0xc32c('0x8a')](_0xc32c('0xb4'))[_0xc32c('0x4b')](_0xc32c('0xb5'),_0x2c43b7[_0xc32c('0x53')]['id'][_0xc32c('0x90')]()))[_0xc32c('0x4b')](_0xc32c('0xb2'),squel[_0xc32c('0x87')]()[_0xc32c('0x88')](_0xc32c('0xb6'))['from'](_0xc32c('0xa7'))[_0xc32c('0x4b')](_0xc32c('0xb5'),_0x2c43b7['params']['id'][_0xc32c('0x90')]())))[_0xc32c('0x90')]();break;case _0xc32c('0xb7'):_0xbdc361=squel[_0xc32c('0xa5')]()[_0xc32c('0xa6')]('cm_hopper')[_0xc32c('0xa8')]([_0xc32c('0xa9'),_0xc32c('0xac'),_0xc32c('0xaa'),'ListId',_0xc32c('0x68'),_0xc32c('0x62'),_0xc32c('0x61')],squel[_0xc32c('0x87')]()[_0xc32c('0x88')](_0xc32c('0xa9'),_0xc32c('0xa9'))[_0xc32c('0x88')](_0xc32c('0xb8'),'scheduledAt')[_0xc32c('0x88')]('id',_0xc32c('0xaa'))[_0xc32c('0x88')](_0x56ec5c['CmListId']['toString'](),_0xc32c('0xab'))[_0xc32c('0x88')](_0x2c43b7[_0xc32c('0x53')]['id']['toString'](),_0xc32c('0x68'))[_0xc32c('0x88')](_0xc32c('0xb8'),'createdAt')[_0xc32c('0x88')]('NOW()',_0xc32c('0x61'))[_0xc32c('0x8a')](_0xc32c('0xae'))[_0xc32c('0x4b')](_0xc32c('0xaf'))['where'](_0xc32c('0xb0'),_0x56ec5c['CmListId']['toString']())[_0xc32c('0x4b')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xc32c('0xb2'),squel['select']()[_0xc32c('0x88')]('COALESCE(phone,\x27\x27)')[_0xc32c('0x8a')](_0xc32c('0xa7'))[_0xc32c('0x4b')](_0xc32c('0xb5'),_0x2c43b7[_0xc32c('0x53')]['id'][_0xc32c('0x90')]())))['toString']();break;default:_0xbdc361=squel[_0xc32c('0xa5')]()[_0xc32c('0xa6')](_0xc32c('0xa7'))[_0xc32c('0xa8')]([_0xc32c('0xa9'),'scheduledAt',_0xc32c('0xaa'),'ListId',_0xc32c('0x68'),'createdAt',_0xc32c('0x61')],squel[_0xc32c('0x87')]()[_0xc32c('0x88')](_0xc32c('0xa9'),'phone')[_0xc32c('0x88')](_0xc32c('0xb8'),_0xc32c('0xac'))[_0xc32c('0x88')]('id',_0xc32c('0xaa'))[_0xc32c('0x88')](_0x56ec5c[_0xc32c('0xad')]['toString'](),'ListId')[_0xc32c('0x88')](_0x2c43b7[_0xc32c('0x53')]['id'][_0xc32c('0x90')](),_0xc32c('0x68'))[_0xc32c('0x88')](_0xc32c('0xb8'),'createdAt')[_0xc32c('0x88')]('NOW()',_0xc32c('0x61'))[_0xc32c('0x8a')](_0xc32c('0xae'))[_0xc32c('0x4b')](_0xc32c('0xaf'))[_0xc32c('0x4b')]('ListId\x20=\x20?',_0x56ec5c[_0xc32c('0xad')]['toString']())['where']('phone\x20IS\x20NOT\x20NULL'))[_0xc32c('0x90')]();}_0x3f1bee['push'](db[_0xc32c('0x79')][_0xc32c('0x3e')](_0xbdc361));}return BPromise[_0xc32c('0x93')](_0x3f1bee);}})[_0xc32c('0x29')](function(){return _0x616957;})[_0xc32c('0x29')](respondWithResult(_0x520490,null))[_0xc32c('0x51')](handleError(_0x520490,null));};exports['removeLists']=function(_0x37fecf,_0x2c956c,_0x120541){return db[_0xc32c('0x3a')][_0xc32c('0x56')]({'where':{'id':_0x37fecf[_0xc32c('0x53')]['id']}})['then'](handleEntityNotFound(_0x2c956c,null))[_0xc32c('0x29')](function(_0x127d7c){if(_0x127d7c){return _0x127d7c[_0xc32c('0xb9')](_0x37fecf['query']['ids']);}})['then'](function(_0x245b29){if(_0x245b29){return db[_0xc32c('0x66')]['destroy']({'where':{'ListId':_0x37fecf['query'][_0xc32c('0x86')],'VoiceQueueId':_0x37fecf[_0xc32c('0x53')]['id']}})[_0xc32c('0x29')](function(){return _0x245b29;});}})['then'](respondWithStatusCode(_0x2c956c,null))[_0xc32c('0x51')](handleError(_0x2c956c,null));};exports[_0xc32c('0xba')]=function(_0x1300c0,_0x16e8a5,_0x594831){var _0x341d1f={};var _0x18f279={};var _0x9fd43e;var _0x42a84b;return db[_0xc32c('0x3a')][_0xc32c('0x65')]({'where':{'id':_0x1300c0[_0xc32c('0x53')]['id']}})['then'](handleEntityNotFound(_0x16e8a5,null))[_0xc32c('0x29')](function(_0xa08e4f){if(_0xa08e4f){_0x9fd43e=_0xa08e4f;_0x18f279[_0xc32c('0x41')]=_['keys'](db[_0xc32c('0xa0')][_0xc32c('0x3b')]);_0x18f279['query']=_[_0xc32c('0x3f')](_0x1300c0[_0xc32c('0x3e')]);_0x18f279[_0xc32c('0x40')]=_['intersection'](_0x18f279[_0xc32c('0x41')],_0x18f279[_0xc32c('0x3e')]);_0x341d1f[_0xc32c('0x42')]=_[_0xc32c('0x43')](_0x18f279[_0xc32c('0x41')],qs[_0xc32c('0x44')](_0x1300c0[_0xc32c('0x3e')][_0xc32c('0x44')]));_0x341d1f['attributes']=_0x341d1f['attributes'][_0xc32c('0x45')]?_0x341d1f[_0xc32c('0x42')]:_0x18f279[_0xc32c('0x41')];_0x341d1f['order']=qs[_0xc32c('0x49')](_0x1300c0[_0xc32c('0x3e')][_0xc32c('0x49')]);_0x341d1f[_0xc32c('0x4b')]=qs[_0xc32c('0x40')](_['pick'](_0x1300c0[_0xc32c('0x3e')],_0x18f279[_0xc32c('0x40')]));if(_0x1300c0[_0xc32c('0x3e')][_0xc32c('0x2f')]){_0x341d1f[_0xc32c('0x4b')]=_[_0xc32c('0x55')](_0x341d1f[_0xc32c('0x4b')],{'$or':_[_0xc32c('0x39')](_0x341d1f[_0xc32c('0x42')],function(_0x38ddd4){var _0x4fc919={};_0x4fc919[_0x38ddd4]={'$like':'%'+_0x1300c0['query'][_0xc32c('0x2f')]+'%'};return _0x4fc919;})});}_0x341d1f=_[_0xc32c('0x55')]({},_0x341d1f,_0x1300c0['options']);return _0x9fd43e['getBlackLists'](_0x341d1f);}})[_0xc32c('0x29')](function(_0x1361d1){if(_0x1361d1){_0x42a84b=_0x1361d1[_0xc32c('0x45')];if(!_0x1300c0['query'][_0xc32c('0x46')](_0xc32c('0x67'))){_0x341d1f[_0xc32c('0x47')]=qs[_0xc32c('0x47')](_0x1300c0[_0xc32c('0x3e')][_0xc32c('0x47')]);_0x341d1f['offset']=qs[_0xc32c('0x22')](_0x1300c0[_0xc32c('0x3e')][_0xc32c('0x22')]);}return _0x9fd43e['getBlackLists'](_0x341d1f);}})[_0xc32c('0x29')](function(_0xc6cf2b){if(_0xc6cf2b){return _0xc6cf2b?{'count':_0x42a84b,'rows':_0xc6cf2b}:null;}})[_0xc32c('0x29')](respondWithResult(_0x16e8a5,null))[_0xc32c('0x51')](handleError(_0x16e8a5,null));};exports[_0xc32c('0xbb')]=function(_0x3bcb11,_0x58ec57,_0x3e9e5d){var _0x486284,_0x1090ea;return db['VoiceQueue'][_0xc32c('0x56')]({'where':{'id':_0x3bcb11[_0xc32c('0x53')]['id']}})['then'](handleEntityNotFound(_0x58ec57,null))[_0xc32c('0x29')](function(_0x538dbf){if(_0x538dbf){_0x1090ea=_0x538dbf;return _0x538dbf[_0xc32c('0xbb')](_0x3bcb11[_0xc32c('0x57')]['ids'],_[_0xc32c('0x60')](_0x3bcb11[_0xc32c('0x57')],[_0xc32c('0x86'),'id'])||{});}return null;})[_0xc32c('0xa2')](function(_0x302220){var _0x10067c;_0x486284=_0x302220||[];var _0x472b2d=[];if(_0x302220){for(var _0x593c67=0x0;_0x593c67<_0x302220[_0xc32c('0x45')];_0x593c67+=0x1){var _0xa928c4=_0x302220[_0x593c67][_0xc32c('0x2a')]({'plain':!![]});_0x10067c=squel[_0xc32c('0xa5')]()['into'](_0xc32c('0xbc'))[_0xc32c('0xa8')](['phone',_0xc32c('0xaa'),'ListId','VoiceQueueId',_0xc32c('0x62'),_0xc32c('0x61')],squel['select']()[_0xc32c('0x88')](_0xc32c('0xa9'),_0xc32c('0xa9'))['field']('id',_0xc32c('0xaa'))[_0xc32c('0x88')](_0xa928c4[_0xc32c('0xad')][_0xc32c('0x90')](),_0xc32c('0xab'))[_0xc32c('0x88')](_0x3bcb11[_0xc32c('0x53')]['id'][_0xc32c('0x90')](),_0xc32c('0x68'))[_0xc32c('0x88')](_0xc32c('0xb8'),'createdAt')['field'](_0xc32c('0xb8'),'updatedAt')['from'](_0xc32c('0xae'))[_0xc32c('0x4b')](_0xc32c('0xaf'))['where']('ListId\x20=\x20?',_0xa928c4[_0xc32c('0xad')][_0xc32c('0x90')]())['where'](_0xc32c('0xb1')))[_0xc32c('0x90')]();_0x472b2d[_0xc32c('0x8f')](db[_0xc32c('0x79')]['query'](_0x10067c));}return BPromise[_0xc32c('0x93')](_0x472b2d);}})[_0xc32c('0x29')](function(){return _0x486284;})['then'](respondWithResult(_0x58ec57,null))[_0xc32c('0x51')](handleError(_0x58ec57,null));};exports[_0xc32c('0xbd')]=function(_0x1a623a,_0xc2bf57,_0x27c11c){return db[_0xc32c('0x3a')][_0xc32c('0x56')]({'where':{'id':_0x1a623a[_0xc32c('0x53')]['id']}})[_0xc32c('0x29')](handleEntityNotFound(_0xc2bf57,null))[_0xc32c('0x29')](function(_0x2ef00b){if(_0x2ef00b){return _0x2ef00b[_0xc32c('0xbd')](_0x1a623a[_0xc32c('0x3e')][_0xc32c('0x86')]);}})[_0xc32c('0x29')](function(_0x52d02f){if(_0x52d02f){return db[_0xc32c('0x6e')][_0xc32c('0x34')]({'where':{'ListId':_0x1a623a[_0xc32c('0x3e')][_0xc32c('0x86')],'VoiceQueueId':_0x1a623a[_0xc32c('0x53')]['id']}})['then'](function(){return _0x52d02f;});}})[_0xc32c('0x29')](respondWithStatusCode(_0xc2bf57,null))[_0xc32c('0x51')](handleError(_0xc2bf57,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 8e7e5d0..efdbfae 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 _0xfa74=['update','emit','hasOwnProperty','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save'];(function(_0x1303c5,_0x38490d){var _0x3c1e22=function(_0x446100){while(--_0x446100){_0x1303c5['push'](_0x1303c5['shift']());}};_0x3c1e22(++_0x38490d);}(_0xfa74,0xaf));var _0x4fa7=function(_0x5de1d2,_0x3ed732){_0x5de1d2=_0x5de1d2-0x0;var _0x327771=_0xfa74[_0x5de1d2];return _0x327771;};'use strict';var EventEmitter=require(_0x4fa7('0x0'));var VoiceQueue=require(_0x4fa7('0x1'))['db'][_0x4fa7('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x4fa7('0x3')](0x0);var events={'afterCreate':_0x4fa7('0x4'),'afterUpdate':_0x4fa7('0x5'),'afterDestroy':'remove'};function emitEvent(_0x50f385){return function(_0x11030d,_0x41153f,_0x448a64){VoiceQueueEvents[_0x4fa7('0x6')](_0x50f385+':'+_0x11030d['id'],_0x11030d);VoiceQueueEvents['emit'](_0x50f385,_0x11030d);_0x448a64(null);};}for(var e in events){if(events[_0x4fa7('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x4fa7('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0x53d4=['../../mysqldb','VoiceQueue','save','update','remove','hasOwnProperty','hook','exports'];(function(_0xb5896a,_0x17b104){var _0x273217=function(_0x19843a){while(--_0x19843a){_0xb5896a['push'](_0xb5896a['shift']());}};_0x273217(++_0x17b104);}(_0x53d4,0xd8));var _0x453d=function(_0x5dfbb,_0x548b87){_0x5dfbb=_0x5dfbb-0x0;var _0xfee3d5=_0x53d4[_0x5dfbb];return _0xfee3d5;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x453d('0x0'))['db'][_0x453d('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x453d('0x2'),'afterUpdate':_0x453d('0x3'),'afterDestroy':_0x453d('0x4')};function emitEvent(_0xbde201){return function(_0x11bd5c,_0x22180e,_0x2e0e3b){VoiceQueueEvents['emit'](_0xbde201+':'+_0x11bd5c['id'],_0x11bd5c);VoiceQueueEvents['emit'](_0xbde201,_0x11bd5c);_0x2e0e3b(null);};}for(var e in events){if(events[_0x453d('0x5')](e)){var event=events[e];VoiceQueue[_0x453d('0x6')](e,emitEvent(event));}}module[_0x453d('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 467578b..50eb95b 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x52a40a,_0x428073){var _0x80bd65=function(_0x20ef33){while(--_0x20ef33){_0x52a40a['push'](_0x52a40a['shift']());}};_0x80bd65(++_0x428073);}(_0xedd9,0xfc));var _0x9edd=function(_0x49a7c2,_0x1c50a0){_0x49a7c2=_0x49a7c2-0x0;var _0x47e727=_0xedd9[_0x49a7c2];return _0x47e727;};'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':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x1329df,_0x1d71e5){var _0x245a6f=function(_0x241a83){while(--_0x241a83){_0x1329df['push'](_0x1329df['shift']());}};_0x245a6f(++_0x1d71e5);}(_0xedd9,0xfc));var _0x9edd=function(_0x5e33db,_0x3b8df8){_0x5e33db=_0x5e33db-0x0;var _0x267bde=_0xedd9[_0x5e33db];return _0x267bde;};'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':'voice_queues','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 420b3a3..61b6ebf 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 _0x7218=['request','then','info','debug','request\x20sent','error','code','VoiceQueue,\x20%s,\x20%s','message','result','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','map','include','model','stringify','catch','ShowVoiceQueue','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./voiceQueue.socket','register'];(function(_0x487de6,_0x2db671){var _0x3dcac9=function(_0x40dbc4){while(--_0x40dbc4){_0x487de6['push'](_0x487de6['shift']());}};_0x3dcac9(++_0x2db671);}(_0x7218,0x176));var _0x8721=function(_0x1175ac,_0x533135){_0x1175ac=_0x1175ac-0x0;var _0xba6299=_0x7218[_0x1175ac];return _0xba6299;};'use strict';var _=require(_0x8721('0x0'));var util=require(_0x8721('0x1'));var moment=require(_0x8721('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8721('0x3'));var db=require(_0x8721('0x4'))['db'];var utils=require(_0x8721('0x5'));var logger=require(_0x8721('0x6'))(_0x8721('0x7'));var config=require(_0x8721('0x8'));var jayson=require(_0x8721('0x9'));var client=jayson['client'][_0x8721('0xa')]({'port':0x232a});config[_0x8721('0xb')]=_['defaults'](config[_0x8721('0xb')],{'host':_0x8721('0xc'),'port':0x18eb});var socket=require(_0x8721('0xd'))(new Redis(config[_0x8721('0xb')]));require(_0x8721('0xe'))[_0x8721('0xf')](socket);function respondWithRpcPromise(_0xcb79b7,_0x18415c,_0x317780){return new BPromise(function(_0x297519,_0x27fad4){return client[_0x8721('0x10')](_0xcb79b7,_0x317780)[_0x8721('0x11')](function(_0x470fe2){logger[_0x8721('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x18415c,'request\x20sent');logger[_0x8721('0x13')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x18415c,_0x8721('0x14'),JSON['stringify'](_0x470fe2));if(_0x470fe2[_0x8721('0x15')]){if(_0x470fe2[_0x8721('0x15')][_0x8721('0x16')]===0x1f4){logger['error'](_0x8721('0x17'),_0x18415c,_0x470fe2[_0x8721('0x15')][_0x8721('0x18')]);return _0x27fad4(_0x470fe2[_0x8721('0x15')][_0x8721('0x18')]);}logger[_0x8721('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x18415c,_0x470fe2[_0x8721('0x15')]['message']);return _0x297519(_0x470fe2[_0x8721('0x15')]['message']);}else{logger[_0x8721('0x12')](_0x8721('0x17'),_0x18415c,'request\x20sent');_0x297519(_0x470fe2[_0x8721('0x19')]['message']);}})['catch'](function(_0xb01117){logger[_0x8721('0x15')](_0x8721('0x17'),_0x18415c,_0xb01117);_0x27fad4(_0xb01117);});});}exports[_0x8721('0x1a')]=function(_0x4cd135){var _0x1f4525=this;return new Promise(function(_0x394a34,_0x21c575){return db[_0x8721('0x1b')][_0x8721('0x1c')]({'raw':_0x4cd135['options']?_0x4cd135[_0x8721('0x1d')][_0x8721('0x1e')]===undefined?!![]:![]:!![],'where':_0x4cd135[_0x8721('0x1d')]?_0x4cd135['options'][_0x8721('0x1f')]||null:null,'attributes':_0x4cd135[_0x8721('0x1d')]?_0x4cd135[_0x8721('0x1d')][_0x8721('0x20')]||null:null,'limit':_0x4cd135[_0x8721('0x1d')]?_0x4cd135[_0x8721('0x1d')]['limit']||null:null,'include':_0x4cd135[_0x8721('0x1d')]?_0x4cd135[_0x8721('0x1d')]['include']?_[_0x8721('0x21')](_0x4cd135[_0x8721('0x1d')][_0x8721('0x22')],function(_0x1f417f){return{'model':db[_0x1f417f[_0x8721('0x23')]],'as':_0x1f417f['as'],'attributes':_0x1f417f[_0x8721('0x20')],'include':_0x1f417f[_0x8721('0x22')]?_[_0x8721('0x21')](_0x1f417f[_0x8721('0x22')],function(_0xf229b4){return{'model':db[_0xf229b4[_0x8721('0x23')]],'as':_0xf229b4['as'],'attributes':_0xf229b4['attributes'],'include':_0xf229b4[_0x8721('0x22')]?_[_0x8721('0x21')](_0xf229b4[_0x8721('0x22')],function(_0x3465b7){return{'model':db[_0x3465b7['model']],'as':_0x3465b7['as'],'attributes':_0x3465b7[_0x8721('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8721('0x11')](function(_0x27d18d){logger[_0x8721('0x12')](_0x8721('0x1a'),_0x4cd135);logger[_0x8721('0x13')]('GetVoiceQueue',_0x4cd135,JSON[_0x8721('0x24')](_0x27d18d));_0x394a34(_0x27d18d);})[_0x8721('0x25')](function(_0xdad525){logger[_0x8721('0x15')](_0x8721('0x1a'),_0xdad525[_0x8721('0x18')],_0x4cd135);_0x21c575(_0x1f4525[_0x8721('0x15')](0x1f4,_0xdad525[_0x8721('0x18')]));});});};exports[_0x8721('0x26')]=function(_0x2fa635){var _0x1612f5=this;return new Promise(function(_0x4e27e4,_0x41b2bd){return db[_0x8721('0x1b')]['find']({'raw':_0x2fa635[_0x8721('0x1d')]?_0x2fa635['options']['raw']===undefined?!![]:![]:!![],'where':_0x2fa635[_0x8721('0x1d')]?_0x2fa635[_0x8721('0x1d')][_0x8721('0x1f')]||null:null,'attributes':_0x2fa635[_0x8721('0x1d')]?_0x2fa635[_0x8721('0x1d')][_0x8721('0x20')]||null:null,'include':_0x2fa635[_0x8721('0x1d')]?_0x2fa635[_0x8721('0x1d')]['include']?_[_0x8721('0x21')](_0x2fa635[_0x8721('0x1d')][_0x8721('0x22')],function(_0x4b0b7b){return{'model':db[_0x4b0b7b[_0x8721('0x23')]],'as':_0x4b0b7b['as'],'attributes':_0x4b0b7b['attributes'],'include':_0x4b0b7b['include']?_[_0x8721('0x21')](_0x4b0b7b[_0x8721('0x22')],function(_0x2c14df){return{'model':db[_0x2c14df[_0x8721('0x23')]],'as':_0x2c14df['as'],'attributes':_0x2c14df['attributes'],'include':_0x2c14df[_0x8721('0x22')]?_[_0x8721('0x21')](_0x2c14df[_0x8721('0x22')],function(_0xbe21b8){return{'model':db[_0xbe21b8[_0x8721('0x23')]],'as':_0xbe21b8['as'],'attributes':_0xbe21b8['attributes']};}):[]};}):[]};}):[]:[]})[_0x8721('0x11')](function(_0x5cbf43){logger[_0x8721('0x12')](_0x8721('0x26'),_0x2fa635);logger[_0x8721('0x13')](_0x8721('0x26'),_0x2fa635,JSON['stringify'](_0x5cbf43));_0x4e27e4(_0x5cbf43);})[_0x8721('0x25')](function(_0x18484f){logger[_0x8721('0x15')](_0x8721('0x26'),_0x18484f['message'],_0x2fa635);_0x41b2bd(_0x1612f5['error'](0x1f4,_0x18484f['message']));});});}; \ No newline at end of file +var _0xb236=['moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','register','request','then','info','VoiceQueue,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','VoiceQueue','findAll','options','raw','attributes','limit','include','map','model','GetVoiceQueue','ShowVoiceQueue','find','where'];(function(_0x16115d,_0x58f185){var _0x10d5da=function(_0x39981a){while(--_0x39981a){_0x16115d['push'](_0x16115d['shift']());}};_0x10d5da(++_0x58f185);}(_0xb236,0x1d4));var _0x6b23=function(_0x1396c8,_0x4b14c8){_0x1396c8=_0x1396c8-0x0;var _0x46451c=_0xb236[_0x1396c8];return _0x46451c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6b23('0x0'));var BPromise=require(_0x6b23('0x1'));var rs=require(_0x6b23('0x2'));var fs=require('fs');var Redis=require(_0x6b23('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6b23('0x4'))('rpc');var config=require(_0x6b23('0x5'));var jayson=require(_0x6b23('0x6'));var client=jayson[_0x6b23('0x7')][_0x6b23('0x8')]({'port':0x232a});config['redis']=_[_0x6b23('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6b23('0xa'))(new Redis(config['redis']));require('./voiceQueue.socket')[_0x6b23('0xb')](socket);function respondWithRpcPromise(_0x364f0d,_0x56c03a,_0x388da9){return new BPromise(function(_0x36f77a,_0x37e98e){return client[_0x6b23('0xc')](_0x364f0d,_0x388da9)[_0x6b23('0xd')](function(_0x60300d){logger[_0x6b23('0xe')](_0x6b23('0xf'),_0x56c03a,'request\x20sent');logger[_0x6b23('0x10')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x56c03a,'request\x20sent',JSON[_0x6b23('0x11')](_0x60300d));if(_0x60300d[_0x6b23('0x12')]){if(_0x60300d['error'][_0x6b23('0x13')]===0x1f4){logger['error'](_0x6b23('0xf'),_0x56c03a,_0x60300d[_0x6b23('0x12')][_0x6b23('0x14')]);return _0x37e98e(_0x60300d['error'][_0x6b23('0x14')]);}logger[_0x6b23('0x12')](_0x6b23('0xf'),_0x56c03a,_0x60300d[_0x6b23('0x12')][_0x6b23('0x14')]);return _0x36f77a(_0x60300d['error']['message']);}else{logger['info'](_0x6b23('0xf'),_0x56c03a,_0x6b23('0x15'));_0x36f77a(_0x60300d[_0x6b23('0x16')][_0x6b23('0x14')]);}})['catch'](function(_0x5dc631){logger[_0x6b23('0x12')](_0x6b23('0xf'),_0x56c03a,_0x5dc631);_0x37e98e(_0x5dc631);});});}exports['GetVoiceQueue']=function(_0x56c667){var _0x1b151b=this;return new Promise(function(_0x34102f,_0x52d740){return db[_0x6b23('0x17')][_0x6b23('0x18')]({'raw':_0x56c667['options']?_0x56c667[_0x6b23('0x19')][_0x6b23('0x1a')]===undefined?!![]:![]:!![],'where':_0x56c667['options']?_0x56c667[_0x6b23('0x19')]['where']||null:null,'attributes':_0x56c667[_0x6b23('0x19')]?_0x56c667[_0x6b23('0x19')][_0x6b23('0x1b')]||null:null,'limit':_0x56c667[_0x6b23('0x19')]?_0x56c667[_0x6b23('0x19')][_0x6b23('0x1c')]||null:null,'include':_0x56c667['options']?_0x56c667[_0x6b23('0x19')][_0x6b23('0x1d')]?_[_0x6b23('0x1e')](_0x56c667[_0x6b23('0x19')][_0x6b23('0x1d')],function(_0x45076b){return{'model':db[_0x45076b[_0x6b23('0x1f')]],'as':_0x45076b['as'],'attributes':_0x45076b['attributes'],'include':_0x45076b[_0x6b23('0x1d')]?_[_0x6b23('0x1e')](_0x45076b['include'],function(_0x526ef4){return{'model':db[_0x526ef4[_0x6b23('0x1f')]],'as':_0x526ef4['as'],'attributes':_0x526ef4[_0x6b23('0x1b')],'include':_0x526ef4['include']?_[_0x6b23('0x1e')](_0x526ef4['include'],function(_0x401685){return{'model':db[_0x401685[_0x6b23('0x1f')]],'as':_0x401685['as'],'attributes':_0x401685['attributes']};}):[]};}):[]};}):[]:[]})[_0x6b23('0xd')](function(_0x4bb282){logger[_0x6b23('0xe')]('GetVoiceQueue',_0x56c667);logger[_0x6b23('0x10')]('GetVoiceQueue',_0x56c667,JSON[_0x6b23('0x11')](_0x4bb282));_0x34102f(_0x4bb282);})['catch'](function(_0x10e8c7){logger[_0x6b23('0x12')](_0x6b23('0x20'),_0x10e8c7[_0x6b23('0x14')],_0x56c667);_0x52d740(_0x1b151b[_0x6b23('0x12')](0x1f4,_0x10e8c7[_0x6b23('0x14')]));});});};exports[_0x6b23('0x21')]=function(_0x36184b){var _0x405c5d=this;return new Promise(function(_0x2b1211,_0x276425){return db[_0x6b23('0x17')][_0x6b23('0x22')]({'raw':_0x36184b['options']?_0x36184b[_0x6b23('0x19')][_0x6b23('0x1a')]===undefined?!![]:![]:!![],'where':_0x36184b['options']?_0x36184b[_0x6b23('0x19')][_0x6b23('0x23')]||null:null,'attributes':_0x36184b[_0x6b23('0x19')]?_0x36184b[_0x6b23('0x19')][_0x6b23('0x1b')]||null:null,'include':_0x36184b[_0x6b23('0x19')]?_0x36184b[_0x6b23('0x19')][_0x6b23('0x1d')]?_[_0x6b23('0x1e')](_0x36184b['options'][_0x6b23('0x1d')],function(_0x5b1f97){return{'model':db[_0x5b1f97[_0x6b23('0x1f')]],'as':_0x5b1f97['as'],'attributes':_0x5b1f97[_0x6b23('0x1b')],'include':_0x5b1f97[_0x6b23('0x1d')]?_['map'](_0x5b1f97[_0x6b23('0x1d')],function(_0x4599c6){return{'model':db[_0x4599c6[_0x6b23('0x1f')]],'as':_0x4599c6['as'],'attributes':_0x4599c6[_0x6b23('0x1b')],'include':_0x4599c6[_0x6b23('0x1d')]?_[_0x6b23('0x1e')](_0x4599c6[_0x6b23('0x1d')],function(_0x4d060d){return{'model':db[_0x4d060d[_0x6b23('0x1f')]],'as':_0x4d060d['as'],'attributes':_0x4d060d[_0x6b23('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6b23('0xd')](function(_0x36aeb6){logger['info'](_0x6b23('0x21'),_0x36184b);logger['debug'](_0x6b23('0x21'),_0x36184b,JSON[_0x6b23('0x11')](_0x36aeb6));_0x2b1211(_0x36aeb6);})['catch'](function(_0x42dceb){logger[_0x6b23('0x12')](_0x6b23('0x21'),_0x42dceb['message'],_0x36184b);_0x276425(_0x405c5d[_0x6b23('0x12')](0x1f4,_0x42dceb['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index df38c62..90d0b94 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 _0x943e=['voiceQueue:','./voiceQueue.events','save','emit','length'];(function(_0x350a01,_0x5ed763){var _0xc17c6b=function(_0x31aaec){while(--_0x31aaec){_0x350a01['push'](_0x350a01['shift']());}};_0xc17c6b(++_0x5ed763);}(_0x943e,0xb5));var _0xe943=function(_0x471452,_0x157074){_0x471452=_0x471452-0x0;var _0x1220ac=_0x943e[_0x471452];return _0x1220ac;};'use strict';var VoiceQueueEvents=require(_0xe943('0x0'));var events=[_0xe943('0x1'),'remove','update'];function createListener(_0x13ddd8,_0x523ccf){return function(_0x4a13b9){_0x523ccf[_0xe943('0x2')](_0x13ddd8,_0x4a13b9);};}function removeListener(_0x5085f2,_0x27febe){return function(){VoiceQueueEvents['removeListener'](_0x5085f2,_0x27febe);};}exports['register']=function(_0x5c1350){for(var _0x39b4d6=0x0,_0x462aaf=events[_0xe943('0x3')];_0x39b4d6<_0x462aaf;_0x39b4d6++){var _0x33974d=events[_0x39b4d6];var _0xf2ced2=createListener(_0xe943('0x4')+_0x33974d,_0x5c1350);VoiceQueueEvents['on'](_0x33974d,_0xf2ced2);}}; \ No newline at end of file +var _0xd9e8=['voiceQueue:','./voiceQueue.events','save','update','emit','removeListener','register'];(function(_0xc465f5,_0xa9c358){var _0x3dd839=function(_0x45aa86){while(--_0x45aa86){_0xc465f5['push'](_0xc465f5['shift']());}};_0x3dd839(++_0xa9c358);}(_0xd9e8,0x19e));var _0x8d9e=function(_0x4ac955,_0x30fd5c){_0x4ac955=_0x4ac955-0x0;var _0x3a907f=_0xd9e8[_0x4ac955];return _0x3a907f;};'use strict';var VoiceQueueEvents=require(_0x8d9e('0x0'));var events=[_0x8d9e('0x1'),'remove',_0x8d9e('0x2')];function createListener(_0xb3a770,_0x418ef0){return function(_0x25229b){_0x418ef0[_0x8d9e('0x3')](_0xb3a770,_0x25229b);};}function removeListener(_0x124e46,_0x38a059){return function(){VoiceQueueEvents[_0x8d9e('0x4')](_0x124e46,_0x38a059);};}exports[_0x8d9e('0x5')]=function(_0x305028){for(var _0x146f5a=0x0,_0x537e3f=events['length'];_0x146f5a<_0x537e3f;_0x146f5a++){var _0x279dc9=events[_0x146f5a];var _0x18acc8=createListener(_0x8d9e('0x6')+_0x279dc9,_0x305028);VoiceQueueEvents['on'](_0x279dc9,_0x18acc8);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 16b26af..ef35600 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 _0xf980=['../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','/describe','describe','/index','getVoiceQueuesReport','/:id','show','put','update','delete','destroy','util','Router','fs-extra'];(function(_0x3dbd97,_0x5a0738){var _0x44f649=function(_0x2e5498){while(--_0x2e5498){_0x3dbd97['push'](_0x3dbd97['shift']());}};_0x44f649(++_0x5a0738);}(_0xf980,0x96));var _0x0f98=function(_0x3babb2,_0x4e832d){_0x3babb2=_0x3babb2-0x0;var _0x43e8fd=_0xf980[_0x3babb2];return _0x43e8fd;};'use strict';var multer=require('multer');var util=require(_0x0f98('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0f98('0x1')]();var fs_extra=require(_0x0f98('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0f98('0x3'));var controller=require(_0x0f98('0x4'));router[_0x0f98('0x5')]('/',auth[_0x0f98('0x6')](),controller['index']);router['get'](_0x0f98('0x7'),auth[_0x0f98('0x6')](),controller[_0x0f98('0x8')]);router[_0x0f98('0x5')](_0x0f98('0x9'),auth[_0x0f98('0x6')](),controller[_0x0f98('0xa')]);router[_0x0f98('0x5')](_0x0f98('0xb'),auth[_0x0f98('0x6')](),controller[_0x0f98('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x0f98('0xd')](_0x0f98('0xb'),auth[_0x0f98('0x6')](),controller[_0x0f98('0xe')]);router[_0x0f98('0xf')](_0x0f98('0xb'),auth['isAuthenticated'](),controller[_0x0f98('0x10')]);module['exports']=router; \ No newline at end of file +var _0x6642=['put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./voiceQueueReport.controller','isAuthenticated','index','get','/index','getVoiceQueuesReport','post','create'];(function(_0xf04c6d,_0xe98786){var _0x4a804e=function(_0x431a0a){while(--_0x431a0a){_0xf04c6d['push'](_0xf04c6d['shift']());}};_0x4a804e(++_0xe98786);}(_0x6642,0xa5));var _0x2664=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6642[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x2664('0x0'));var util=require(_0x2664('0x1'));var path=require(_0x2664('0x2'));var timeout=require(_0x2664('0x3'));var express=require(_0x2664('0x4'));var router=express[_0x2664('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2664('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2664('0x7'));router['get']('/',auth[_0x2664('0x8')](),controller[_0x2664('0x9')]);router[_0x2664('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x2664('0xa')](_0x2664('0xb'),auth[_0x2664('0x8')](),controller[_0x2664('0xc')]);router[_0x2664('0xa')]('/:id',auth[_0x2664('0x8')](),controller['show']);router[_0x2664('0xd')]('/',auth[_0x2664('0x8')](),controller[_0x2664('0xe')]);router[_0x2664('0xf')](_0x2664('0x10'),auth[_0x2664('0x8')](),controller[_0x2664('0x11')]);router[_0x2664('0x12')](_0x2664('0x10'),auth[_0x2664('0x8')](),controller['destroy']);module[_0x2664('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 d0e9216..f9ea350 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 _0xa6c3=['holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt'];(function(_0x2c21fa,_0x5f0a10){var _0x5aafc6=function(_0x1eb171){while(--_0x1eb171){_0x2c21fa['push'](_0x2c21fa['shift']());}};_0x5aafc6(++_0x5f0a10);}(_0xa6c3,0x148));var _0x3a6c=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0xa6c3[_0x2f1762];return _0x8ab21;};'use strict';var Sequelize=require(_0x3a6c('0x0'));var moment=require('moment');module[_0x3a6c('0x1')]={'type':{'type':Sequelize[_0x3a6c('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x3a6c('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x3a6c('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x3a6c('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x3a6c('0x3')],'set':function(_0x274c80){var _0x12111f=moment(_0x274c80);var _0x27ea0f=moment(this[_0x3a6c('0x4')](_0x3a6c('0x5')))[_0x3a6c('0x6')](_0x3a6c('0x7'));var _0xba66b5=_0x12111f[_0x3a6c('0x8')](_0x27ea0f,_0x3a6c('0x9'));this[_0x3a6c('0xa')](_0x3a6c('0xb'),_0x274c80);this[_0x3a6c('0xa')](_0x3a6c('0xc'),_0xba66b5||null);}},'position':{'type':Sequelize[_0x3a6c('0xd')]},'count':{'type':Sequelize[_0x3a6c('0xd')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x3a6c('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x3a6c('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x3a6c('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x3a6c('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x3a6c('0x2')],'comment':_0x3a6c('0xf')},'originalposition':{'type':Sequelize[_0x3a6c('0xd')]},'channel':{'type':Sequelize[_0x3a6c('0x2')]},'connectedlinenum':{'type':Sequelize[_0x3a6c('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x3a6c('0x2')]},'context':{'type':Sequelize[_0x3a6c('0x2')]},'exten':{'type':Sequelize[_0x3a6c('0x2')]},'priority':{'type':Sequelize[_0x3a6c('0x2')]},'holdtime':{'type':Sequelize[_0x3a6c('0xd')]},'mohtime':{'type':Sequelize[_0x3a6c('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x3a6c('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x3a6c('0x2')],'comment':_0x3a6c('0x10')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x3a6c('0x2')]},'secondDisposition':{'type':Sequelize[_0x3a6c('0x2')]},'thirdDisposition':{'type':Sequelize[_0x3a6c('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x3a6c('0xd')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb21a=['format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt'];(function(_0xfb02c9,_0x43c274){var _0x9afb71=function(_0x56dff0){while(--_0x56dff0){_0xfb02c9['push'](_0xfb02c9['shift']());}};_0x9afb71(++_0x43c274);}(_0xb21a,0x1f1));var _0xab21=function(_0x314995,_0x168758){_0x314995=_0x314995-0x0;var _0x347fcf=_0xb21a[_0x314995];return _0x347fcf;};'use strict';var Sequelize=require(_0xab21('0x0'));var moment=require(_0xab21('0x1'));module[_0xab21('0x2')]={'type':{'type':Sequelize[_0xab21('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xab21('0x3')]},'calleridname':{'type':Sequelize[_0xab21('0x3')]},'queue':{'type':Sequelize[_0xab21('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0xab21('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xab21('0x4')],'set':function(_0x4f42e5){var _0x52d100=moment(_0x4f42e5);var _0x3eb760=moment(this[_0xab21('0x5')](_0xab21('0x6')))[_0xab21('0x7')](_0xab21('0x8'));var _0x1cbbe0=_0x52d100[_0xab21('0x9')](_0x3eb760,_0xab21('0xa'));this[_0xab21('0xb')](_0xab21('0xc'),_0x4f42e5);this[_0xab21('0xb')](_0xab21('0xd'),_0x1cbbe0||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xab21('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xab21('0x4')]},'queuecallercomplete':{'type':Sequelize[_0xab21('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xab21('0x4')]},'queuecallerexit':{'type':Sequelize[_0xab21('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xab21('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0xab21('0x3')],'comment':_0xab21('0xf')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xab21('0x3')]},'connectedlinename':{'type':Sequelize[_0xab21('0x3')]},'accountcode':{'type':Sequelize[_0xab21('0x3')]},'context':{'type':Sequelize[_0xab21('0x3')]},'exten':{'type':Sequelize[_0xab21('0x3')]},'priority':{'type':Sequelize[_0xab21('0x3')]},'holdtime':{'type':Sequelize[_0xab21('0x10')]},'mohtime':{'type':Sequelize[_0xab21('0x10')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xab21('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xab21('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xab21('0x11')},'transferexten':{'type':Sequelize[_0xab21('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xab21('0x3')]},'secondDisposition':{'type':Sequelize[_0xab21('0x3')]},'thirdDisposition':{'type':Sequelize[_0xab21('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0xab21('0x10')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index e89285b..af5c547 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 _0x2b65=['rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','end','json','limit','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','VoiceQueueReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','length','catch','create','body','find','getVoiceQueuesReport','findAll','eml-format'];(function(_0x25bba0,_0x4bd142){var _0x3da505=function(_0x395d93){while(--_0x395d93){_0x25bba0['push'](_0x25bba0['shift']());}};_0x3da505(++_0x4bd142);}(_0x2b65,0x153));var _0x52b6=function(_0x12a04a,_0x4e3d1a){_0x12a04a=_0x12a04a-0x0;var _0x6d5409=_0x2b65[_0x12a04a];return _0x6d5409;};'use strict';var emlformat=require(_0x52b6('0x0'));var rimraf=require(_0x52b6('0x1'));var zipdir=require(_0x52b6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x52b6('0x3'));var BPromise=require(_0x52b6('0x4'));var Mustache=require(_0x52b6('0x5'));var util=require(_0x52b6('0x6'));var path=require('path');var sox=require(_0x52b6('0x7'));var csv=require(_0x52b6('0x8'));var ejs=require(_0x52b6('0x9'));var fs=require('fs');var fs_extra=require(_0x52b6('0xa'));var _=require(_0x52b6('0xb'));var squel=require(_0x52b6('0xc'));var crypto=require(_0x52b6('0xd'));var jsforce=require(_0x52b6('0xe'));var deskjs=require(_0x52b6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x52b6('0x10'));var Papa=require(_0x52b6('0x11'));var Redis=require(_0x52b6('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x52b6('0x13'));var as=require(_0x52b6('0x14'));var hardwareService=require(_0x52b6('0x15'));var logger=require(_0x52b6('0x16'))(_0x52b6('0x17'));var utils=require(_0x52b6('0x18'));var config=require(_0x52b6('0x19'));var licenseUtil=require(_0x52b6('0x1a'));var db=require(_0x52b6('0x1b'))['db'];config[_0x52b6('0x1c')]=_[_0x52b6('0x1d')](config[_0x52b6('0x1c')],{'host':_0x52b6('0x1e'),'port':0x18eb});var socket=require(_0x52b6('0x1f'))(new Redis(config[_0x52b6('0x1c')]));require(_0x52b6('0x20'))['register'](socket);function respondWithStatusCode(_0x13dd3e,_0x5eb513){_0x5eb513=_0x5eb513||0xcc;return function(_0x56f186){if(_0x56f186){return _0x13dd3e['sendStatus'](_0x5eb513);}return _0x13dd3e['status'](_0x5eb513)[_0x52b6('0x21')]();};}function respondWithResult(_0x1b439d,_0x1615c7){_0x1615c7=_0x1615c7||0xc8;return function(_0x3fd7e0){if(_0x3fd7e0){return _0x1b439d['status'](_0x1615c7)[_0x52b6('0x22')](_0x3fd7e0);}};}function respondWithFilteredResult(_0x291a60,_0x21c53d){return function(_0xd8298){if(_0xd8298){var _0x5c367d=typeof _0x21c53d['offset']==='undefined'&&typeof _0x21c53d[_0x52b6('0x23')]==='undefined';var _0x56fb0c=_0xd8298[_0x52b6('0x24')];var _0x407508=_0x5c367d?0x0:_0x21c53d[_0x52b6('0x25')];var _0xa4f966=_0x5c367d?_0xd8298['count']:_0x21c53d['offset']+_0x21c53d['limit'];var _0x2775da;if(_0xa4f966>=_0x56fb0c){_0xa4f966=_0x56fb0c;_0x2775da=0xc8;}else{_0x2775da=0xce;}_0x291a60[_0x52b6('0x26')](_0x2775da);return _0x291a60[_0x52b6('0x27')](_0x52b6('0x28'),_0x407508+'-'+_0xa4f966+'/'+_0x56fb0c)['json'](_0xd8298);}return null;};}function patchUpdates(_0x328649){return function(_0x1bea7e){try{jsonpatch[_0x52b6('0x29')](_0x1bea7e,_0x328649,!![]);}catch(_0x31b634){return BPromise[_0x52b6('0x2a')](_0x31b634);}return _0x1bea7e[_0x52b6('0x2b')]();};}function saveUpdates(_0x11a07b,_0x2ed88b){return function(_0x34121c){if(_0x34121c){return _0x34121c[_0x52b6('0x2c')](_0x11a07b)[_0x52b6('0x2d')](function(_0x18409a){return _0x18409a;});}return null;};}function removeEntity(_0x576908,_0x3b754a){return function(_0x15b124){if(_0x15b124){return _0x15b124[_0x52b6('0x2e')]()[_0x52b6('0x2d')](function(){_0x576908[_0x52b6('0x26')](0xcc)[_0x52b6('0x21')]();});}};}function handleEntityNotFound(_0x433a99,_0x5f2630){return function(_0x1b7aa3){if(!_0x1b7aa3){_0x433a99[_0x52b6('0x2f')](0x194);}return _0x1b7aa3;};}function handleError(_0x4bd6c6,_0x440f8b){_0x440f8b=_0x440f8b||0x1f4;return function(_0x41fed3){logger[_0x52b6('0x30')](_0x41fed3['stack']);if(_0x41fed3[_0x52b6('0x31')]){delete _0x41fed3[_0x52b6('0x31')];}_0x4bd6c6[_0x52b6('0x26')](_0x440f8b)[_0x52b6('0x32')](_0x41fed3);};}exports['index']=function(_0x1d654e,_0x28b244){var _0x19e9e6={},_0x50ec98={},_0x2bd5a2={'count':0x0,'rows':[]};var _0x202064=_['map'](db[_0x52b6('0x33')]['rawAttributes'],function(_0x4994d7){return{'name':_0x4994d7[_0x52b6('0x34')],'type':_0x4994d7[_0x52b6('0x35')][_0x52b6('0x36')]};});_0x50ec98[_0x52b6('0x37')]=_['map'](_0x202064,_0x52b6('0x31'));_0x50ec98[_0x52b6('0x38')]=_[_0x52b6('0x39')](_0x1d654e[_0x52b6('0x38')]);_0x50ec98[_0x52b6('0x3a')]=_['intersection'](_0x50ec98[_0x52b6('0x37')],_0x50ec98[_0x52b6('0x38')]);_0x19e9e6[_0x52b6('0x3b')]=_[_0x52b6('0x3c')](_0x50ec98[_0x52b6('0x37')],qs['fields'](_0x1d654e[_0x52b6('0x38')][_0x52b6('0x3d')]));_0x19e9e6[_0x52b6('0x3b')]=_0x19e9e6[_0x52b6('0x3b')]['length']?_0x19e9e6['attributes']:_0x50ec98[_0x52b6('0x37')];if(!_0x1d654e[_0x52b6('0x38')]['hasOwnProperty'](_0x52b6('0x3e'))){_0x19e9e6[_0x52b6('0x23')]=qs[_0x52b6('0x23')](_0x1d654e[_0x52b6('0x38')]['limit']);_0x19e9e6[_0x52b6('0x25')]=qs[_0x52b6('0x25')](_0x1d654e[_0x52b6('0x38')][_0x52b6('0x25')]);}_0x19e9e6[_0x52b6('0x3f')]=qs[_0x52b6('0x40')](_0x1d654e[_0x52b6('0x38')]['sort']);_0x19e9e6[_0x52b6('0x41')]=qs['filters'](_[_0x52b6('0x42')](_0x1d654e[_0x52b6('0x38')],_0x50ec98[_0x52b6('0x3a')]),_0x202064);if(_0x1d654e[_0x52b6('0x38')][_0x52b6('0x43')]){_0x19e9e6['where']=_[_0x52b6('0x44')](_0x19e9e6[_0x52b6('0x41')],{'$or':_[_0x52b6('0x45')](_0x202064,function(_0x32fbee){if(_0x32fbee['type']!==_0x52b6('0x46')){var _0x526820={};_0x526820[_0x32fbee[_0x52b6('0x31')]]={'$like':'%'+_0x1d654e['query'][_0x52b6('0x43')]+'%'};return _0x526820;}})});}_0x19e9e6=_[_0x52b6('0x44')]({},_0x19e9e6,_0x1d654e[_0x52b6('0x47')]);var _0x57de22={'where':_0x19e9e6[_0x52b6('0x41')]};return db['VoiceQueueReport'][_0x52b6('0x24')](_0x57de22)[_0x52b6('0x2d')](function(_0x5a311c){_0x2bd5a2[_0x52b6('0x24')]=_0x5a311c;if(_0x1d654e[_0x52b6('0x38')][_0x52b6('0x48')]){_0x19e9e6[_0x52b6('0x49')]=[{'all':!![]}];}return db[_0x52b6('0x33')]['findAll'](_0x19e9e6);})[_0x52b6('0x2d')](function(_0x254174){_0x2bd5a2[_0x52b6('0x4a')]=_0x254174;return _0x2bd5a2;})[_0x52b6('0x2d')](respondWithFilteredResult(_0x28b244,_0x19e9e6))['catch'](handleError(_0x28b244,null));};exports[_0x52b6('0x4b')]=function(_0x1c23c0,_0x2aa238){var _0x117057={'raw':![],'where':{'id':_0x1c23c0[_0x52b6('0x4c')]['id']}},_0x2e8422={};_0x2e8422['model']=_[_0x52b6('0x39')](db['VoiceQueueReport'][_0x52b6('0x4d')]);_0x2e8422['query']=_[_0x52b6('0x39')](_0x1c23c0[_0x52b6('0x38')]);_0x2e8422[_0x52b6('0x3a')]=_[_0x52b6('0x3c')](_0x2e8422['model'],_0x2e8422[_0x52b6('0x38')]);_0x117057['attributes']=_['intersection'](_0x2e8422[_0x52b6('0x37')],qs['fields'](_0x1c23c0['query'][_0x52b6('0x3d')]));_0x117057['attributes']=_0x117057[_0x52b6('0x3b')][_0x52b6('0x4e')]?_0x117057[_0x52b6('0x3b')]:_0x2e8422[_0x52b6('0x37')];if(_0x1c23c0['query']['includeAll']){_0x117057[_0x52b6('0x49')]=[{'all':!![]}];}_0x117057=_[_0x52b6('0x44')]({},_0x117057,_0x1c23c0[_0x52b6('0x47')]);return db['VoiceQueueReport']['find'](_0x117057)[_0x52b6('0x2d')](handleEntityNotFound(_0x2aa238,null))[_0x52b6('0x2d')](respondWithResult(_0x2aa238,null))[_0x52b6('0x4f')](handleError(_0x2aa238,null));};exports[_0x52b6('0x50')]=function(_0x3669f6,_0x596434){return db['VoiceQueueReport'][_0x52b6('0x50')](_0x3669f6[_0x52b6('0x51')],{})[_0x52b6('0x2d')](respondWithResult(_0x596434,0xc9))[_0x52b6('0x4f')](handleError(_0x596434,null));};exports[_0x52b6('0x2c')]=function(_0x5559cd,_0x37fd5e){if(_0x5559cd['body']['id']){delete _0x5559cd[_0x52b6('0x51')]['id'];}return db[_0x52b6('0x33')][_0x52b6('0x52')]({'where':{'id':_0x5559cd[_0x52b6('0x4c')]['id']}})[_0x52b6('0x2d')](handleEntityNotFound(_0x37fd5e,null))['then'](saveUpdates(_0x5559cd[_0x52b6('0x51')],null))[_0x52b6('0x2d')](respondWithResult(_0x37fd5e,null))[_0x52b6('0x4f')](handleError(_0x37fd5e,null));};exports[_0x52b6('0x2e')]=function(_0x1b7866,_0x19263d){return db[_0x52b6('0x33')]['find']({'where':{'id':_0x1b7866['params']['id']}})[_0x52b6('0x2d')](handleEntityNotFound(_0x19263d,null))[_0x52b6('0x2d')](removeEntity(_0x19263d,null))['catch'](handleError(_0x19263d,null));};exports['describe']=function(_0x4f4453,_0x36bc9e){return db[_0x52b6('0x33')]['describe']()['then'](respondWithResult(_0x36bc9e,null))[_0x52b6('0x4f')](handleError(_0x36bc9e,null));};exports[_0x52b6('0x53')]=function(_0x2d3881,_0x41e85b){var _0x44730e={},_0x4a0822={},_0x1ee64d={'count':0x0,'rows':[]};_0x4a0822[_0x52b6('0x37')]=_[_0x52b6('0x39')](db[_0x52b6('0x33')][_0x52b6('0x4d')]);_0x4a0822[_0x52b6('0x38')]=_[_0x52b6('0x39')](_0x2d3881[_0x52b6('0x38')]);_0x4a0822['filters']=_[_0x52b6('0x3c')](_0x4a0822[_0x52b6('0x37')],_0x4a0822[_0x52b6('0x38')]);_0x44730e['attributes']=_[_0x52b6('0x3c')](_0x4a0822[_0x52b6('0x37')],qs[_0x52b6('0x3d')](_0x2d3881[_0x52b6('0x38')][_0x52b6('0x3d')]));_0x44730e[_0x52b6('0x3b')]=_0x44730e[_0x52b6('0x3b')]['length']?_0x44730e[_0x52b6('0x3b')]:_0x4a0822[_0x52b6('0x37')];if(!_0x2d3881[_0x52b6('0x38')]['hasOwnProperty'](_0x52b6('0x3e'))){_0x44730e[_0x52b6('0x23')]=qs[_0x52b6('0x23')](_0x2d3881[_0x52b6('0x38')][_0x52b6('0x23')]);_0x44730e['offset']=qs[_0x52b6('0x25')](_0x2d3881[_0x52b6('0x38')][_0x52b6('0x25')]);}_0x44730e[_0x52b6('0x3f')]=qs[_0x52b6('0x40')](_0x2d3881[_0x52b6('0x38')]['sort']);_0x44730e[_0x52b6('0x41')]=qs[_0x52b6('0x3a')](_[_0x52b6('0x42')](_0x2d3881[_0x52b6('0x38')],_0x4a0822[_0x52b6('0x3a')]));if(_0x2d3881[_0x52b6('0x38')][_0x52b6('0x43')]){_0x44730e['where']=_['merge'](_0x44730e[_0x52b6('0x41')],{'$or':_[_0x52b6('0x45')](_0x44730e[_0x52b6('0x3b')],function(_0x28d0c2){var _0x51ebe0={};_0x51ebe0[_0x28d0c2]={'$like':'%'+_0x2d3881[_0x52b6('0x38')][_0x52b6('0x43')]+'%'};return _0x51ebe0;})});}_0x44730e=_[_0x52b6('0x44')]({},_0x44730e,_0x2d3881['options']);var _0x472152={'where':_0x44730e[_0x52b6('0x41')]};return db[_0x52b6('0x33')][_0x52b6('0x24')](_0x472152)[_0x52b6('0x2d')](function(_0x263727){_0x1ee64d[_0x52b6('0x24')]=_0x263727;if(_0x2d3881[_0x52b6('0x38')][_0x52b6('0x48')]){_0x44730e[_0x52b6('0x49')]=[{'all':!![]}];}return db[_0x52b6('0x33')][_0x52b6('0x54')](_0x44730e);})[_0x52b6('0x2d')](function(_0x55267a){_0x1ee64d[_0x52b6('0x4a')]=_0x55267a;return _0x1ee64d;})[_0x52b6('0x2d')](respondWithFilteredResult(_0x41e85b,_0x44730e,_0x52b6('0x53')))['catch'](handleError(_0x41e85b,null,_0x52b6('0x53')));}; \ No newline at end of file +var _0xf803=['describe','getVoiceQueuesReport','rows','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','name','send','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','body','params'];(function(_0x1344c6,_0x54914b){var _0x144dfb=function(_0x942296){while(--_0x942296){_0x1344c6['push'](_0x1344c6['shift']());}};_0x144dfb(++_0x54914b);}(_0xf803,0xf9));var _0x3f80=function(_0x50b2f3,_0x7a6e39){_0x50b2f3=_0x50b2f3-0x0;var _0x478ce9=_0xf803[_0x50b2f3];return _0x478ce9;};'use strict';var emlformat=require(_0x3f80('0x0'));var rimraf=require(_0x3f80('0x1'));var zipdir=require(_0x3f80('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3f80('0x3'));var moment=require(_0x3f80('0x4'));var BPromise=require(_0x3f80('0x5'));var Mustache=require(_0x3f80('0x6'));var util=require(_0x3f80('0x7'));var path=require('path');var sox=require(_0x3f80('0x8'));var csv=require('to-csv');var ejs=require(_0x3f80('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3f80('0xa'));var squel=require(_0x3f80('0xb'));var crypto=require(_0x3f80('0xc'));var jsforce=require(_0x3f80('0xd'));var deskjs=require(_0x3f80('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3f80('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3f80('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f80('0x11'));var logger=require('../../config/logger')(_0x3f80('0x12'));var utils=require(_0x3f80('0x13'));var config=require(_0x3f80('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x3f80('0x15'))['db'];config[_0x3f80('0x16')]=_[_0x3f80('0x17')](config['redis'],{'host':_0x3f80('0x18'),'port':0x18eb});var socket=require(_0x3f80('0x19'))(new Redis(config[_0x3f80('0x16')]));require(_0x3f80('0x1a'))[_0x3f80('0x1b')](socket);function respondWithStatusCode(_0x1d9dfc,_0x2a1a0d){_0x2a1a0d=_0x2a1a0d||0xcc;return function(_0x1d2e75){if(_0x1d2e75){return _0x1d9dfc['sendStatus'](_0x2a1a0d);}return _0x1d9dfc['status'](_0x2a1a0d)[_0x3f80('0x1c')]();};}function respondWithResult(_0x19b739,_0x1f618a){_0x1f618a=_0x1f618a||0xc8;return function(_0x3d6c71){if(_0x3d6c71){return _0x19b739[_0x3f80('0x1d')](_0x1f618a)['json'](_0x3d6c71);}};}function respondWithFilteredResult(_0x2f0a39,_0x2ac34b){return function(_0x3ad13d){if(_0x3ad13d){var _0x36015d=typeof _0x2ac34b[_0x3f80('0x1e')]==='undefined'&&typeof _0x2ac34b['limit']===_0x3f80('0x1f');var _0x32ba19=_0x3ad13d['count'];var _0x5b3304=_0x36015d?0x0:_0x2ac34b['offset'];var _0x174bb0=_0x36015d?_0x3ad13d[_0x3f80('0x20')]:_0x2ac34b[_0x3f80('0x1e')]+_0x2ac34b[_0x3f80('0x21')];var _0x573179;if(_0x174bb0>=_0x32ba19){_0x174bb0=_0x32ba19;_0x573179=0xc8;}else{_0x573179=0xce;}_0x2f0a39[_0x3f80('0x1d')](_0x573179);return _0x2f0a39[_0x3f80('0x22')](_0x3f80('0x23'),_0x5b3304+'-'+_0x174bb0+'/'+_0x32ba19)[_0x3f80('0x24')](_0x3ad13d);}return null;};}function patchUpdates(_0xaf2996){return function(_0xe3b84){try{jsonpatch[_0x3f80('0x25')](_0xe3b84,_0xaf2996,!![]);}catch(_0x2c2402){return BPromise[_0x3f80('0x26')](_0x2c2402);}return _0xe3b84[_0x3f80('0x27')]();};}function saveUpdates(_0xe06a3,_0x53d4a0){return function(_0x466d0d){if(_0x466d0d){return _0x466d0d[_0x3f80('0x28')](_0xe06a3)['then'](function(_0x11ad9e){return _0x11ad9e;});}return null;};}function removeEntity(_0x57953a,_0x31cdc0){return function(_0x1ee274){if(_0x1ee274){return _0x1ee274[_0x3f80('0x29')]()[_0x3f80('0x2a')](function(){_0x57953a[_0x3f80('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1de18f,_0x595f27){return function(_0x45781d){if(!_0x45781d){_0x1de18f[_0x3f80('0x2b')](0x194);}return _0x45781d;};}function handleError(_0x2011b7,_0x3632b1){_0x3632b1=_0x3632b1||0x1f4;return function(_0x3df1ac){logger['error'](_0x3df1ac['stack']);if(_0x3df1ac[_0x3f80('0x2c')]){delete _0x3df1ac[_0x3f80('0x2c')];}_0x2011b7['status'](_0x3632b1)[_0x3f80('0x2d')](_0x3df1ac);};}exports['index']=function(_0x5c9dea,_0x4fdf64){var _0x1dfa30={},_0x4667ca={},_0x47adb3={'count':0x0,'rows':[]};var _0x334804=_[_0x3f80('0x2e')](db[_0x3f80('0x2f')][_0x3f80('0x30')],function(_0x131817){return{'name':_0x131817[_0x3f80('0x31')],'type':_0x131817[_0x3f80('0x32')][_0x3f80('0x33')]};});_0x4667ca[_0x3f80('0x34')]=_[_0x3f80('0x2e')](_0x334804,_0x3f80('0x2c'));_0x4667ca[_0x3f80('0x35')]=_[_0x3f80('0x36')](_0x5c9dea[_0x3f80('0x35')]);_0x4667ca[_0x3f80('0x37')]=_[_0x3f80('0x38')](_0x4667ca[_0x3f80('0x34')],_0x4667ca[_0x3f80('0x35')]);_0x1dfa30[_0x3f80('0x39')]=_[_0x3f80('0x38')](_0x4667ca[_0x3f80('0x34')],qs[_0x3f80('0x3a')](_0x5c9dea[_0x3f80('0x35')][_0x3f80('0x3a')]));_0x1dfa30['attributes']=_0x1dfa30['attributes'][_0x3f80('0x3b')]?_0x1dfa30['attributes']:_0x4667ca[_0x3f80('0x34')];if(!_0x5c9dea[_0x3f80('0x35')][_0x3f80('0x3c')](_0x3f80('0x3d'))){_0x1dfa30[_0x3f80('0x21')]=qs[_0x3f80('0x21')](_0x5c9dea['query'][_0x3f80('0x21')]);_0x1dfa30[_0x3f80('0x1e')]=qs['offset'](_0x5c9dea['query']['offset']);}_0x1dfa30[_0x3f80('0x3e')]=qs[_0x3f80('0x3f')](_0x5c9dea['query'][_0x3f80('0x3f')]);_0x1dfa30['where']=qs[_0x3f80('0x37')](_[_0x3f80('0x40')](_0x5c9dea[_0x3f80('0x35')],_0x4667ca[_0x3f80('0x37')]),_0x334804);if(_0x5c9dea[_0x3f80('0x35')][_0x3f80('0x41')]){_0x1dfa30[_0x3f80('0x42')]=_[_0x3f80('0x43')](_0x1dfa30[_0x3f80('0x42')],{'$or':_[_0x3f80('0x2e')](_0x334804,function(_0x3ec10c){if(_0x3ec10c[_0x3f80('0x32')]!==_0x3f80('0x44')){var _0x48c1ea={};_0x48c1ea[_0x3ec10c[_0x3f80('0x2c')]]={'$like':'%'+_0x5c9dea[_0x3f80('0x35')]['filter']+'%'};return _0x48c1ea;}})});}_0x1dfa30=_[_0x3f80('0x43')]({},_0x1dfa30,_0x5c9dea[_0x3f80('0x45')]);var _0x13a234={'where':_0x1dfa30[_0x3f80('0x42')]};return db[_0x3f80('0x2f')][_0x3f80('0x20')](_0x13a234)[_0x3f80('0x2a')](function(_0x5d5691){_0x47adb3['count']=_0x5d5691;if(_0x5c9dea[_0x3f80('0x35')][_0x3f80('0x46')]){_0x1dfa30[_0x3f80('0x47')]=[{'all':!![]}];}return db[_0x3f80('0x2f')][_0x3f80('0x48')](_0x1dfa30);})[_0x3f80('0x2a')](function(_0x1dd7c7){_0x47adb3['rows']=_0x1dd7c7;return _0x47adb3;})[_0x3f80('0x2a')](respondWithFilteredResult(_0x4fdf64,_0x1dfa30))[_0x3f80('0x49')](handleError(_0x4fdf64,null));};exports[_0x3f80('0x4a')]=function(_0xbacba7,_0x10c761){var _0x52b824={'raw':![],'where':{'id':_0xbacba7['params']['id']}},_0xea0517={};_0xea0517[_0x3f80('0x34')]=_[_0x3f80('0x36')](db[_0x3f80('0x2f')][_0x3f80('0x30')]);_0xea0517[_0x3f80('0x35')]=_[_0x3f80('0x36')](_0xbacba7[_0x3f80('0x35')]);_0xea0517[_0x3f80('0x37')]=_[_0x3f80('0x38')](_0xea0517['model'],_0xea0517[_0x3f80('0x35')]);_0x52b824['attributes']=_[_0x3f80('0x38')](_0xea0517['model'],qs[_0x3f80('0x3a')](_0xbacba7['query'][_0x3f80('0x3a')]));_0x52b824[_0x3f80('0x39')]=_0x52b824[_0x3f80('0x39')][_0x3f80('0x3b')]?_0x52b824['attributes']:_0xea0517[_0x3f80('0x34')];if(_0xbacba7[_0x3f80('0x35')][_0x3f80('0x46')]){_0x52b824[_0x3f80('0x47')]=[{'all':!![]}];}_0x52b824=_[_0x3f80('0x43')]({},_0x52b824,_0xbacba7[_0x3f80('0x45')]);return db[_0x3f80('0x2f')][_0x3f80('0x4b')](_0x52b824)[_0x3f80('0x2a')](handleEntityNotFound(_0x10c761,null))[_0x3f80('0x2a')](respondWithResult(_0x10c761,null))[_0x3f80('0x49')](handleError(_0x10c761,null));};exports[_0x3f80('0x4c')]=function(_0x44be7f,_0x58a7ff){return db[_0x3f80('0x2f')][_0x3f80('0x4c')](_0x44be7f[_0x3f80('0x4d')],{})[_0x3f80('0x2a')](respondWithResult(_0x58a7ff,0xc9))['catch'](handleError(_0x58a7ff,null));};exports[_0x3f80('0x28')]=function(_0x924010,_0x1b6912){if(_0x924010[_0x3f80('0x4d')]['id']){delete _0x924010[_0x3f80('0x4d')]['id'];}return db[_0x3f80('0x2f')][_0x3f80('0x4b')]({'where':{'id':_0x924010['params']['id']}})['then'](handleEntityNotFound(_0x1b6912,null))[_0x3f80('0x2a')](saveUpdates(_0x924010[_0x3f80('0x4d')],null))[_0x3f80('0x2a')](respondWithResult(_0x1b6912,null))[_0x3f80('0x49')](handleError(_0x1b6912,null));};exports['destroy']=function(_0x4e8975,_0x5f5d5c){return db['VoiceQueueReport'][_0x3f80('0x4b')]({'where':{'id':_0x4e8975[_0x3f80('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5f5d5c,null))[_0x3f80('0x2a')](removeEntity(_0x5f5d5c,null))[_0x3f80('0x49')](handleError(_0x5f5d5c,null));};exports['describe']=function(_0xf9bff0,_0x4ba716){return db['VoiceQueueReport'][_0x3f80('0x4f')]()['then'](respondWithResult(_0x4ba716,null))[_0x3f80('0x49')](handleError(_0x4ba716,null));};exports[_0x3f80('0x50')]=function(_0x26da0c,_0x42465b){var _0x428b31={},_0x39591e={},_0x5b5e70={'count':0x0,'rows':[]};_0x39591e[_0x3f80('0x34')]=_[_0x3f80('0x36')](db[_0x3f80('0x2f')][_0x3f80('0x30')]);_0x39591e[_0x3f80('0x35')]=_[_0x3f80('0x36')](_0x26da0c[_0x3f80('0x35')]);_0x39591e[_0x3f80('0x37')]=_[_0x3f80('0x38')](_0x39591e['model'],_0x39591e[_0x3f80('0x35')]);_0x428b31[_0x3f80('0x39')]=_[_0x3f80('0x38')](_0x39591e[_0x3f80('0x34')],qs[_0x3f80('0x3a')](_0x26da0c[_0x3f80('0x35')][_0x3f80('0x3a')]));_0x428b31['attributes']=_0x428b31[_0x3f80('0x39')]['length']?_0x428b31[_0x3f80('0x39')]:_0x39591e[_0x3f80('0x34')];if(!_0x26da0c['query'][_0x3f80('0x3c')](_0x3f80('0x3d'))){_0x428b31[_0x3f80('0x21')]=qs[_0x3f80('0x21')](_0x26da0c[_0x3f80('0x35')][_0x3f80('0x21')]);_0x428b31['offset']=qs[_0x3f80('0x1e')](_0x26da0c[_0x3f80('0x35')][_0x3f80('0x1e')]);}_0x428b31[_0x3f80('0x3e')]=qs[_0x3f80('0x3f')](_0x26da0c[_0x3f80('0x35')][_0x3f80('0x3f')]);_0x428b31['where']=qs['filters'](_['pick'](_0x26da0c['query'],_0x39591e[_0x3f80('0x37')]));if(_0x26da0c[_0x3f80('0x35')][_0x3f80('0x41')]){_0x428b31['where']=_[_0x3f80('0x43')](_0x428b31['where'],{'$or':_[_0x3f80('0x2e')](_0x428b31[_0x3f80('0x39')],function(_0x5c6e63){var _0x51298a={};_0x51298a[_0x5c6e63]={'$like':'%'+_0x26da0c[_0x3f80('0x35')][_0x3f80('0x41')]+'%'};return _0x51298a;})});}_0x428b31=_[_0x3f80('0x43')]({},_0x428b31,_0x26da0c['options']);var _0x4864a0={'where':_0x428b31[_0x3f80('0x42')]};return db[_0x3f80('0x2f')][_0x3f80('0x20')](_0x4864a0)[_0x3f80('0x2a')](function(_0x3d9658){_0x5b5e70[_0x3f80('0x20')]=_0x3d9658;if(_0x26da0c[_0x3f80('0x35')]['includeAll']){_0x428b31['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0x3f80('0x48')](_0x428b31);})[_0x3f80('0x2a')](function(_0xe5f9b6){_0x5b5e70[_0x3f80('0x51')]=_0xe5f9b6;return _0x5b5e70;})[_0x3f80('0x2a')](respondWithFilteredResult(_0x42465b,_0x428b31,_0x3f80('0x50')))[_0x3f80('0x49')](handleError(_0x42465b,null,_0x3f80('0x50')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index b62e041..f31a54d 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 _0x3118=['hook','exports','events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x2534cf,_0x545be6){var _0x221461=function(_0x379e83){while(--_0x379e83){_0x2534cf['push'](_0x2534cf['shift']());}};_0x221461(++_0x545be6);}(_0x3118,0x1bb));var _0x8311=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x3118[_0x39096d];return _0x13da4f;};'use strict';var EventEmitter=require(_0x8311('0x0'));var VoiceQueueReport=require(_0x8311('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x8311('0x2')](0x0);var events={'afterCreate':_0x8311('0x3'),'afterUpdate':'update','afterDestroy':_0x8311('0x4')};function emitEvent(_0x170a9c){return function(_0x1c0250,_0x4c3d72,_0x420792){VoiceQueueReportEvents[_0x8311('0x5')](_0x170a9c+':'+_0x1c0250['id'],_0x1c0250);VoiceQueueReportEvents[_0x8311('0x5')](_0x170a9c,_0x1c0250);_0x420792(null);};}for(var e in events){if(events[_0x8311('0x6')](e)){var event=events[e];VoiceQueueReport[_0x8311('0x7')](e,emitEvent(event));}}module[_0x8311('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xfafe=['save','update','emit','hook','exports','events','../../mysqldb','VoiceQueueReport'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xfafe,0x65));var _0xefaf=function(_0x31f8a0,_0x1e3391){_0x31f8a0=_0x31f8a0-0x0;var _0x319328=_0xfafe[_0x31f8a0];return _0x319328;};'use strict';var EventEmitter=require(_0xefaf('0x0'));var VoiceQueueReport=require(_0xefaf('0x1'))['db'][_0xefaf('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xefaf('0x3'),'afterUpdate':_0xefaf('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4a4f86){return function(_0x7d8ce3,_0x248db6,_0x4a568d){VoiceQueueReportEvents[_0xefaf('0x5')](_0x4a4f86+':'+_0x7d8ce3['id'],_0x7d8ce3);VoiceQueueReportEvents[_0xefaf('0x5')](_0x4a4f86,_0x7d8ce3);_0x4a568d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xefaf('0x6')](e,emitEvent(event));}}module[_0xefaf('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 59deb9a..20df09a 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 _0x69cd=['rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x10791d,_0x2562b6){var _0x1b4f9c=function(_0x3b2815){while(--_0x3b2815){_0x10791d['push'](_0x10791d['shift']());}};_0x1b4f9c(++_0x2562b6);}(_0x69cd,0x19d));var _0xd69c=function(_0x5eb22e,_0x27cbac){_0x5eb22e=_0x5eb22e-0x0;var _0x27fed5=_0x69cd[_0x5eb22e];return _0x27fed5;};'use strict';var _=require(_0xd69c('0x0'));var util=require(_0xd69c('0x1'));var logger=require(_0xd69c('0x2'))(_0xd69c('0x3'));var moment=require(_0xd69c('0x4'));var BPromise=require(_0xd69c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd69c('0x6'));var rimraf=require(_0xd69c('0x7'));var config=require(_0xd69c('0x8'));var attributes=require(_0xd69c('0x9'));module[_0xd69c('0xa')]=function(_0xa83168,_0x33db18){return _0xa83168[_0xd69c('0xb')]('VoiceQueueReport',attributes,{'tableName':_0xd69c('0xc'),'paranoid':![],'indexes':[{'fields':[_0xd69c('0xd')]},{'fields':[_0xd69c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7ce6=['../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','uniqueid','calleridnum','util','moment','bluebird','path'];(function(_0x476b00,_0x250877){var _0x44ec8e=function(_0xec6b23){while(--_0xec6b23){_0x476b00['push'](_0x476b00['shift']());}};_0x44ec8e(++_0x250877);}(_0x7ce6,0xe3));var _0x67ce=function(_0x37d7b2,_0x31a1b3){_0x37d7b2=_0x37d7b2-0x0;var _0x279fa7=_0x7ce6[_0x37d7b2];return _0x279fa7;};'use strict';var _=require('lodash');var util=require(_0x67ce('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x67ce('0x1'));var BPromise=require(_0x67ce('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x67ce('0x3'));var rimraf=require('rimraf');var config=require(_0x67ce('0x4'));var attributes=require(_0x67ce('0x5'));module[_0x67ce('0x6')]=function(_0x32c9f3,_0x10453c){return _0x32c9f3[_0x67ce('0x7')](_0x67ce('0x8'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x67ce('0x9')]},{'fields':[_0x67ce('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index d7b995b..47bad6f 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 _0xe259=['limit','include','model','map','then','GetVoiceQueueReport','CreateVoiceQueueReport','VoiceQueueReport','create','body','UpdateVoiceQueueReport','update','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','client','http','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','options','raw','where','attributes'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xe259,0xd9));var _0x9e25=function(_0x5e0f1d,_0x5e7e6a){_0x5e0f1d=_0x5e0f1d-0x0;var _0xb801aa=_0xe259[_0x5e0f1d];return _0xb801aa;};'use strict';var _=require('lodash');var util=require(_0x9e25('0x0'));var moment=require(_0x9e25('0x1'));var BPromise=require(_0x9e25('0x2'));var rs=require(_0x9e25('0x3'));var fs=require('fs');var Redis=require(_0x9e25('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9e25('0x5'));var logger=require(_0x9e25('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9e25('0x7')][_0x9e25('0x8')]({'port':0x232a});config[_0x9e25('0x9')]=_[_0x9e25('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9e25('0xb'))(new Redis(config[_0x9e25('0x9')]));require(_0x9e25('0xc'))[_0x9e25('0xd')](socket);function respondWithRpcPromise(_0x2099f3,_0x3ac266,_0x3c6252){return new BPromise(function(_0xaec723,_0x298acf){return client['request'](_0x2099f3,_0x3c6252)['then'](function(_0x3fe5e3){logger[_0x9e25('0xe')](_0x9e25('0xf'),_0x3ac266,'request\x20sent');logger[_0x9e25('0x10')](_0x9e25('0x11'),_0x3ac266,_0x9e25('0x12'),JSON[_0x9e25('0x13')](_0x3fe5e3));if(_0x3fe5e3[_0x9e25('0x14')]){if(_0x3fe5e3[_0x9e25('0x14')][_0x9e25('0x15')]===0x1f4){logger[_0x9e25('0x14')](_0x9e25('0xf'),_0x3ac266,_0x3fe5e3[_0x9e25('0x14')][_0x9e25('0x16')]);return _0x298acf(_0x3fe5e3[_0x9e25('0x14')][_0x9e25('0x16')]);}logger[_0x9e25('0x14')](_0x9e25('0xf'),_0x3ac266,_0x3fe5e3[_0x9e25('0x14')][_0x9e25('0x16')]);return _0xaec723(_0x3fe5e3[_0x9e25('0x14')][_0x9e25('0x16')]);}else{logger[_0x9e25('0xe')](_0x9e25('0xf'),_0x3ac266,_0x9e25('0x12'));_0xaec723(_0x3fe5e3[_0x9e25('0x17')][_0x9e25('0x16')]);}})[_0x9e25('0x18')](function(_0x3d43f1){logger[_0x9e25('0x14')](_0x9e25('0xf'),_0x3ac266,_0x3d43f1);_0x298acf(_0x3d43f1);});});}exports['GetVoiceQueueReport']=function(_0x1ff797){var _0xa9a94a=this;return new Promise(function(_0x26294a,_0xc6ee2){return db['VoiceQueueReport']['findAll']({'raw':_0x1ff797['options']?_0x1ff797[_0x9e25('0x19')][_0x9e25('0x1a')]===undefined?!![]:![]:!![],'where':_0x1ff797['options']?_0x1ff797['options'][_0x9e25('0x1b')]||null:null,'attributes':_0x1ff797[_0x9e25('0x19')]?_0x1ff797[_0x9e25('0x19')][_0x9e25('0x1c')]||null:null,'limit':_0x1ff797['options']?_0x1ff797[_0x9e25('0x19')][_0x9e25('0x1d')]||null:null,'include':_0x1ff797[_0x9e25('0x19')]?_0x1ff797[_0x9e25('0x19')][_0x9e25('0x1e')]?_['map'](_0x1ff797[_0x9e25('0x19')][_0x9e25('0x1e')],function(_0x1ede28){return{'model':db[_0x1ede28[_0x9e25('0x1f')]],'as':_0x1ede28['as'],'attributes':_0x1ede28['attributes'],'include':_0x1ede28[_0x9e25('0x1e')]?_['map'](_0x1ede28[_0x9e25('0x1e')],function(_0x161120){return{'model':db[_0x161120[_0x9e25('0x1f')]],'as':_0x161120['as'],'attributes':_0x161120[_0x9e25('0x1c')],'include':_0x161120['include']?_[_0x9e25('0x20')](_0x161120[_0x9e25('0x1e')],function(_0x58b1f4){return{'model':db[_0x58b1f4[_0x9e25('0x1f')]],'as':_0x58b1f4['as'],'attributes':_0x58b1f4[_0x9e25('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9e25('0x21')](function(_0xdd8855){logger[_0x9e25('0xe')](_0x9e25('0x22'),_0x1ff797);logger[_0x9e25('0x10')]('GetVoiceQueueReport',_0x1ff797,JSON[_0x9e25('0x13')](_0xdd8855));_0x26294a(_0xdd8855);})[_0x9e25('0x18')](function(_0x537e83){logger['error']('GetVoiceQueueReport',_0x537e83[_0x9e25('0x16')],_0x1ff797);_0xc6ee2(_0xa9a94a['error'](0x1f4,_0x537e83[_0x9e25('0x16')]));});});};exports[_0x9e25('0x23')]=function(_0x4aad3b){var _0x353cb2=this;return new Promise(function(_0x26148b,_0x1345e9){return db[_0x9e25('0x24')][_0x9e25('0x25')](_0x4aad3b[_0x9e25('0x26')],{'raw':_0x4aad3b[_0x9e25('0x19')]?_0x4aad3b['options'][_0x9e25('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x91718e){logger[_0x9e25('0xe')](_0x9e25('0x23'),_0x4aad3b);logger['debug'](_0x9e25('0x23'),_0x4aad3b,JSON['stringify'](_0x91718e));_0x26148b(_0x91718e);})[_0x9e25('0x18')](function(_0x150f8d){logger[_0x9e25('0x14')](_0x9e25('0x23'),_0x150f8d['message'],_0x4aad3b);_0x1345e9(_0x353cb2[_0x9e25('0x14')](0x1f4,_0x150f8d[_0x9e25('0x16')]));});});};exports[_0x9e25('0x27')]=function(_0x21362f){var _0x23f0b7=this;return new Promise(function(_0x3c35fd,_0x1fb7e0){return db[_0x9e25('0x24')][_0x9e25('0x28')](_0x21362f[_0x9e25('0x26')],{'raw':_0x21362f['options']?_0x21362f[_0x9e25('0x19')][_0x9e25('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21362f[_0x9e25('0x19')]?_0x21362f['options'][_0x9e25('0x1b')]||null:null,'attributes':_0x21362f[_0x9e25('0x19')]?_0x21362f['options'][_0x9e25('0x1c')]||null:null,'limit':_0x21362f[_0x9e25('0x19')]?_0x21362f[_0x9e25('0x19')]['limit']||null:null})[_0x9e25('0x21')](function(_0x13c444){logger[_0x9e25('0xe')]('UpdateVoiceQueueReport',_0x21362f);logger['debug'](_0x9e25('0x27'),_0x21362f,JSON[_0x9e25('0x13')](_0x13c444));_0x3c35fd(_0x13c444);})['catch'](function(_0xe52131){logger[_0x9e25('0x14')](_0x9e25('0x27'),_0xe52131[_0x9e25('0x16')],_0x21362f);_0x1fb7e0(_0x23f0b7[_0x9e25('0x14')](0x1f4,_0xe52131[_0x9e25('0x16')]));});});}; \ No newline at end of file +var _0x5ef8=['request\x20sent','debug','error','code','message','info','result','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','map','include','model','then','stringify','CreateVoiceQueueReport','body','catch','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','VoiceQueueReport,\x20%s,\x20%s'];(function(_0x30d749,_0x3f0518){var _0x36b854=function(_0x1aac59){while(--_0x1aac59){_0x30d749['push'](_0x30d749['shift']());}};_0x36b854(++_0x3f0518);}(_0x5ef8,0x9d));var _0x85ef=function(_0x530d94,_0x58dc9f){_0x530d94=_0x530d94-0x0;var _0x56123f=_0x5ef8[_0x530d94];return _0x56123f;};'use strict';var _=require(_0x85ef('0x0'));var util=require(_0x85ef('0x1'));var moment=require(_0x85ef('0x2'));var BPromise=require(_0x85ef('0x3'));var rs=require(_0x85ef('0x4'));var fs=require('fs');var Redis=require(_0x85ef('0x5'));var db=require(_0x85ef('0x6'))['db'];var utils=require(_0x85ef('0x7'));var logger=require(_0x85ef('0x8'))(_0x85ef('0x9'));var config=require(_0x85ef('0xa'));var jayson=require(_0x85ef('0xb'));var client=jayson[_0x85ef('0xc')]['http']({'port':0x232a});config[_0x85ef('0xd')]=_['defaults'](config['redis'],{'host':_0x85ef('0xe'),'port':0x18eb});var socket=require(_0x85ef('0xf'))(new Redis(config[_0x85ef('0xd')]));require(_0x85ef('0x10'))[_0x85ef('0x11')](socket);function respondWithRpcPromise(_0x1035da,_0x2c2e88,_0x3e91b6){return new BPromise(function(_0x33f499,_0x5a60c9){return client['request'](_0x1035da,_0x3e91b6)['then'](function(_0x22cdbc){logger['info'](_0x85ef('0x12'),_0x2c2e88,_0x85ef('0x13'));logger[_0x85ef('0x14')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x2c2e88,'request\x20sent',JSON['stringify'](_0x22cdbc));if(_0x22cdbc[_0x85ef('0x15')]){if(_0x22cdbc[_0x85ef('0x15')][_0x85ef('0x16')]===0x1f4){logger[_0x85ef('0x15')](_0x85ef('0x12'),_0x2c2e88,_0x22cdbc['error'][_0x85ef('0x17')]);return _0x5a60c9(_0x22cdbc[_0x85ef('0x15')]['message']);}logger[_0x85ef('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x2c2e88,_0x22cdbc[_0x85ef('0x15')][_0x85ef('0x17')]);return _0x33f499(_0x22cdbc['error'][_0x85ef('0x17')]);}else{logger[_0x85ef('0x18')](_0x85ef('0x12'),_0x2c2e88,_0x85ef('0x13'));_0x33f499(_0x22cdbc[_0x85ef('0x19')][_0x85ef('0x17')]);}})['catch'](function(_0x5275c0){logger[_0x85ef('0x15')](_0x85ef('0x12'),_0x2c2e88,_0x5275c0);_0x5a60c9(_0x5275c0);});});}exports[_0x85ef('0x1a')]=function(_0x47ef3d){var _0x2149b8=this;return new Promise(function(_0x3abaa4,_0x20955d){return db[_0x85ef('0x1b')][_0x85ef('0x1c')]({'raw':_0x47ef3d[_0x85ef('0x1d')]?_0x47ef3d[_0x85ef('0x1d')][_0x85ef('0x1e')]===undefined?!![]:![]:!![],'where':_0x47ef3d['options']?_0x47ef3d[_0x85ef('0x1d')][_0x85ef('0x1f')]||null:null,'attributes':_0x47ef3d[_0x85ef('0x1d')]?_0x47ef3d[_0x85ef('0x1d')][_0x85ef('0x20')]||null:null,'limit':_0x47ef3d['options']?_0x47ef3d[_0x85ef('0x1d')][_0x85ef('0x21')]||null:null,'include':_0x47ef3d['options']?_0x47ef3d['options']['include']?_[_0x85ef('0x22')](_0x47ef3d[_0x85ef('0x1d')][_0x85ef('0x23')],function(_0x31b1e2){return{'model':db[_0x31b1e2[_0x85ef('0x24')]],'as':_0x31b1e2['as'],'attributes':_0x31b1e2['attributes'],'include':_0x31b1e2['include']?_[_0x85ef('0x22')](_0x31b1e2[_0x85ef('0x23')],function(_0x33af51){return{'model':db[_0x33af51[_0x85ef('0x24')]],'as':_0x33af51['as'],'attributes':_0x33af51[_0x85ef('0x20')],'include':_0x33af51['include']?_['map'](_0x33af51[_0x85ef('0x23')],function(_0x53cc6e){return{'model':db[_0x53cc6e[_0x85ef('0x24')]],'as':_0x53cc6e['as'],'attributes':_0x53cc6e[_0x85ef('0x20')]};}):[]};}):[]};}):[]:[]})[_0x85ef('0x25')](function(_0x4d438e){logger['info'](_0x85ef('0x1a'),_0x47ef3d);logger[_0x85ef('0x14')](_0x85ef('0x1a'),_0x47ef3d,JSON[_0x85ef('0x26')](_0x4d438e));_0x3abaa4(_0x4d438e);})['catch'](function(_0x27bc8c){logger[_0x85ef('0x15')](_0x85ef('0x1a'),_0x27bc8c[_0x85ef('0x17')],_0x47ef3d);_0x20955d(_0x2149b8[_0x85ef('0x15')](0x1f4,_0x27bc8c[_0x85ef('0x17')]));});});};exports[_0x85ef('0x27')]=function(_0x4668ca){var _0x47c719=this;return new Promise(function(_0x61aa2c,_0x284eca){return db[_0x85ef('0x1b')]['create'](_0x4668ca[_0x85ef('0x28')],{'raw':_0x4668ca[_0x85ef('0x1d')]?_0x4668ca[_0x85ef('0x1d')][_0x85ef('0x1e')]===undefined?!![]:![]:!![]})[_0x85ef('0x25')](function(_0x50ba4f){logger[_0x85ef('0x18')](_0x85ef('0x27'),_0x4668ca);logger['debug'](_0x85ef('0x27'),_0x4668ca,JSON[_0x85ef('0x26')](_0x50ba4f));_0x61aa2c(_0x50ba4f);})[_0x85ef('0x29')](function(_0x49d8af){logger[_0x85ef('0x15')]('CreateVoiceQueueReport',_0x49d8af[_0x85ef('0x17')],_0x4668ca);_0x284eca(_0x47c719[_0x85ef('0x15')](0x1f4,_0x49d8af['message']));});});};exports[_0x85ef('0x2a')]=function(_0xdee021){var _0x5d96c9=this;return new Promise(function(_0x19c26b,_0x138226){return db[_0x85ef('0x1b')][_0x85ef('0x2b')](_0xdee021[_0x85ef('0x28')],{'raw':_0xdee021[_0x85ef('0x1d')]?_0xdee021[_0x85ef('0x1d')][_0x85ef('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xdee021[_0x85ef('0x1d')]?_0xdee021[_0x85ef('0x1d')][_0x85ef('0x1f')]||null:null,'attributes':_0xdee021['options']?_0xdee021[_0x85ef('0x1d')][_0x85ef('0x20')]||null:null,'limit':_0xdee021[_0x85ef('0x1d')]?_0xdee021[_0x85ef('0x1d')][_0x85ef('0x21')]||null:null})[_0x85ef('0x25')](function(_0x8d4b11){logger[_0x85ef('0x18')](_0x85ef('0x2a'),_0xdee021);logger[_0x85ef('0x14')](_0x85ef('0x2a'),_0xdee021,JSON['stringify'](_0x8d4b11));_0x19c26b(_0x8d4b11);})[_0x85ef('0x29')](function(_0x534acf){logger[_0x85ef('0x15')](_0x85ef('0x2a'),_0x534acf['message'],_0xdee021);_0x138226(_0x5d96c9[_0x85ef('0x15')](0x1f4,_0x534acf[_0x85ef('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index ec454b4..f0d376f 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 _0x28a0=['./voiceQueueReport.events','remove','update','removeListener','length','voiceQueueReport:'];(function(_0x25b274,_0x578748){var _0x367046=function(_0x160fd6){while(--_0x160fd6){_0x25b274['push'](_0x25b274['shift']());}};_0x367046(++_0x578748);}(_0x28a0,0x8a));var _0x028a=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x28a0[_0x502c7d];return _0x30b7ed;};'use strict';var VoiceQueueReportEvents=require(_0x028a('0x0'));var events=['save',_0x028a('0x1'),_0x028a('0x2')];function createListener(_0x1ad626,_0x5a001b){return function(_0xdd2bf8){_0x5a001b['emit'](_0x1ad626,_0xdd2bf8);};}function removeListener(_0x5ad0b5,_0x499fd4){return function(){VoiceQueueReportEvents[_0x028a('0x3')](_0x5ad0b5,_0x499fd4);};}exports['register']=function(_0x132a95){for(var _0x43e0e5=0x0,_0x16436e=events[_0x028a('0x4')];_0x43e0e5<_0x16436e;_0x43e0e5++){var _0x3aa587=events[_0x43e0e5];var _0x233b9f=createListener(_0x028a('0x5')+_0x3aa587,_0x132a95);VoiceQueueReportEvents['on'](_0x3aa587,_0x233b9f);}}; \ No newline at end of file +var _0x0eab=['save','remove','update','emit','register','length','./voiceQueueReport.events'];(function(_0xb5d5ca,_0x365b89){var _0x524c7d=function(_0x267ed3){while(--_0x267ed3){_0xb5d5ca['push'](_0xb5d5ca['shift']());}};_0x524c7d(++_0x365b89);}(_0x0eab,0x1d4));var _0xb0ea=function(_0x208d59,_0x1ad7a7){_0x208d59=_0x208d59-0x0;var _0x3c3ae0=_0x0eab[_0x208d59];return _0x3c3ae0;};'use strict';var VoiceQueueReportEvents=require(_0xb0ea('0x0'));var events=[_0xb0ea('0x1'),_0xb0ea('0x2'),_0xb0ea('0x3')];function createListener(_0x419942,_0x32fc0f){return function(_0x2b4b1c){_0x32fc0f[_0xb0ea('0x4')](_0x419942,_0x2b4b1c);};}function removeListener(_0x24a827,_0x663143){return function(){VoiceQueueReportEvents['removeListener'](_0x24a827,_0x663143);};}exports[_0xb0ea('0x5')]=function(_0x721c00){for(var _0x251758=0x0,_0x136b87=events[_0xb0ea('0x6')];_0x251758<_0x136b87;_0x251758++){var _0x5d3174=events[_0x251758];var _0x1d045f=createListener('voiceQueueReport:'+_0x5d3174,_0x721c00);VoiceQueueReportEvents['on'](_0x5d3174,_0x1d045f);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 2f26549..015d56b 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 _0x44d4=['exports','multer','express','Router','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x44d4,0x161));var _0x444d=function(_0x2e5a17,_0x558f0e){_0x2e5a17=_0x2e5a17-0x0;var _0x24f53d=_0x44d4[_0x2e5a17];return _0x24f53d;};'use strict';var multer=require(_0x444d('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x444d('0x1'));var router=express[_0x444d('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x444d('0x3'));var controller=require(_0x444d('0x4'));router[_0x444d('0x5')]('/',auth[_0x444d('0x6')](),controller[_0x444d('0x7')]);router[_0x444d('0x5')](_0x444d('0x8'),auth['isAuthenticated'](),controller[_0x444d('0x9')]);router['post']('/',auth[_0x444d('0x6')](),controller[_0x444d('0xa')]);router[_0x444d('0xb')](_0x444d('0x8'),auth[_0x444d('0x6')](),controller[_0x444d('0xc')]);router[_0x444d('0xd')](_0x444d('0x8'),auth[_0x444d('0x6')](),controller[_0x444d('0xe')]);module[_0x444d('0xf')]=router; \ No newline at end of file +var _0xabc7=['isAuthenticated','create','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','post'];(function(_0x520ec5,_0x293c71){var _0x2a383d=function(_0x368984){while(--_0x368984){_0x520ec5['push'](_0x520ec5['shift']());}};_0x2a383d(++_0x293c71);}(_0xabc7,0x77));var _0x7abc=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xabc7[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x7abc('0x0'));var util=require(_0x7abc('0x1'));var path=require(_0x7abc('0x2'));var timeout=require(_0x7abc('0x3'));var express=require(_0x7abc('0x4'));var router=express['Router']();var fs_extra=require(_0x7abc('0x5'));var auth=require(_0x7abc('0x6'));var interaction=require(_0x7abc('0x7'));var config=require(_0x7abc('0x8'));var controller=require('./voiceQueuesLog.controller');router[_0x7abc('0x9')]('/',auth['isAuthenticated'](),controller[_0x7abc('0xa')]);router[_0x7abc('0x9')](_0x7abc('0xb'),auth['isAuthenticated'](),controller[_0x7abc('0xc')]);router[_0x7abc('0xd')]('/',auth[_0x7abc('0xe')](),controller[_0x7abc('0xf')]);router['put'](_0x7abc('0xb'),auth[_0x7abc('0xe')](),controller[_0x7abc('0x10')]);router[_0x7abc('0x11')](_0x7abc('0xb'),auth[_0x7abc('0xe')](),controller['destroy']);module[_0x7abc('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index d6ca155..6c872af 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 _0x6636=['DATE','sequelize','moment','STRING'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x6636,0x119));var _0x6663=function(_0x505edd,_0x21da2d){_0x505edd=_0x505edd-0x0;var _0xd43afd=_0x6636[_0x505edd];return _0xd43afd;};'use strict';var Sequelize=require(_0x6663('0x0'));var moment=require(_0x6663('0x1'));module['exports']={'time':{'type':Sequelize[_0x6663('0x2')]},'callid':{'type':Sequelize[_0x6663('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x6663('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x6663('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x6663('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x6663('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x6663('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x6663('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x6663('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x6663('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x6663('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x6663('0x3')],'allowNull':![],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0x24fe=['YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING','DATE','format'];(function(_0x22a443,_0xc47c8e){var _0x310537=function(_0xcd536d){while(--_0xcd536d){_0x22a443['push'](_0x22a443['shift']());}};_0x310537(++_0xc47c8e);}(_0x24fe,0xef));var _0xe24f=function(_0x402f42,_0x5d3d08){_0x402f42=_0x402f42-0x0;var _0x2d3cf8=_0x24fe[_0x402f42];return _0x2d3cf8;};'use strict';var Sequelize=require(_0xe24f('0x0'));var moment=require(_0xe24f('0x1'));module[_0xe24f('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xe24f('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xe24f('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xe24f('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xe24f('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xe24f('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xe24f('0x4')],'allowNull':![],'defaultValue':moment()[_0xe24f('0x5')](_0xe24f('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index bd4edc5..8b6ac0c 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 _0xa11f=['fields','length','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include','rows','show','params','options','find','create','body','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes'];(function(_0x5f47e0,_0x4d77a2){var _0x203360=function(_0x155fb6){while(--_0x155fb6){_0x5f47e0['push'](_0x5f47e0['shift']());}};_0x203360(++_0x4d77a2);}(_0xa11f,0x134));var _0xfa11=function(_0xaa6a4,_0x64b067){_0xaa6a4=_0xaa6a4-0x0;var _0xdc31a4=_0xa11f[_0xaa6a4];return _0xdc31a4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfa11('0x0'));var zipdir=require(_0xfa11('0x1'));var jsonpatch=require(_0xfa11('0x2'));var rp=require(_0xfa11('0x3'));var moment=require(_0xfa11('0x4'));var BPromise=require(_0xfa11('0x5'));var Mustache=require('mustache');var util=require(_0xfa11('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xfa11('0x7'));var ejs=require(_0xfa11('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfa11('0x9'));var crypto=require(_0xfa11('0xa'));var jsforce=require(_0xfa11('0xb'));var deskjs=require(_0xfa11('0xc'));var toCsv=require(_0xfa11('0x7'));var querystring=require(_0xfa11('0xd'));var Papa=require(_0xfa11('0xe'));var Redis=require('ioredis');var authService=require(_0xfa11('0xf'));var qs=require(_0xfa11('0x10'));var as=require(_0xfa11('0x11'));var hardwareService=require(_0xfa11('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xfa11('0x13'));var config=require(_0xfa11('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1aed3c,_0xfbfbfe){_0xfbfbfe=_0xfbfbfe||0xcc;return function(_0x5cae6c){if(_0x5cae6c){return _0x1aed3c[_0xfa11('0x15')](_0xfbfbfe);}return _0x1aed3c[_0xfa11('0x16')](_0xfbfbfe)[_0xfa11('0x17')]();};}function respondWithResult(_0x2eef13,_0x4fddbb){_0x4fddbb=_0x4fddbb||0xc8;return function(_0x5390d3){if(_0x5390d3){return _0x2eef13[_0xfa11('0x16')](_0x4fddbb)[_0xfa11('0x18')](_0x5390d3);}};}function respondWithFilteredResult(_0x47e55e,_0x5e56c3){return function(_0x3ea782){if(_0x3ea782){var _0x5845bd=typeof _0x5e56c3[_0xfa11('0x19')]===_0xfa11('0x1a')&&typeof _0x5e56c3[_0xfa11('0x1b')]===_0xfa11('0x1a');var _0x18fb1c=_0x3ea782[_0xfa11('0x1c')];var _0x347118=_0x5845bd?0x0:_0x5e56c3[_0xfa11('0x19')];var _0x3c8edc=_0x5845bd?_0x3ea782['count']:_0x5e56c3['offset']+_0x5e56c3[_0xfa11('0x1b')];var _0x3b719a;if(_0x3c8edc>=_0x18fb1c){_0x3c8edc=_0x18fb1c;_0x3b719a=0xc8;}else{_0x3b719a=0xce;}_0x47e55e['status'](_0x3b719a);return _0x47e55e[_0xfa11('0x1d')]('Content-Range',_0x347118+'-'+_0x3c8edc+'/'+_0x18fb1c)[_0xfa11('0x18')](_0x3ea782);}return null;};}function patchUpdates(_0x2b1e1a){return function(_0x1356ca){try{jsonpatch[_0xfa11('0x1e')](_0x1356ca,_0x2b1e1a,!![]);}catch(_0x22cca1){return BPromise[_0xfa11('0x1f')](_0x22cca1);}return _0x1356ca[_0xfa11('0x20')]();};}function saveUpdates(_0x3c7be8,_0x24c3dc){return function(_0x4bcbfc){if(_0x4bcbfc){return _0x4bcbfc[_0xfa11('0x21')](_0x3c7be8)[_0xfa11('0x22')](function(_0x1417bd){return _0x1417bd;});}return null;};}function removeEntity(_0x341647,_0x1f83cd){return function(_0x41d19d){if(_0x41d19d){return _0x41d19d[_0xfa11('0x23')]()[_0xfa11('0x22')](function(){_0x341647['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a016e,_0x2d531a){return function(_0x6c0cc7){if(!_0x6c0cc7){_0x2a016e[_0xfa11('0x15')](0x194);}return _0x6c0cc7;};}function handleError(_0x1991ff,_0x376ec8){_0x376ec8=_0x376ec8||0x1f4;return function(_0x5da13c){logger[_0xfa11('0x24')](_0x5da13c[_0xfa11('0x25')]);if(_0x5da13c[_0xfa11('0x26')]){delete _0x5da13c[_0xfa11('0x26')];}_0x1991ff[_0xfa11('0x16')](_0x376ec8)[_0xfa11('0x27')](_0x5da13c);};}exports[_0xfa11('0x28')]=function(_0x172ff8,_0x52730c){var _0x44a8bb={},_0x4c7b40={},_0x23b98b={'count':0x0,'rows':[]};var _0xa350f0=_[_0xfa11('0x29')](db[_0xfa11('0x2a')][_0xfa11('0x2b')],function(_0x109a52){return{'name':_0x109a52[_0xfa11('0x2c')],'type':_0x109a52['type'][_0xfa11('0x2d')]};});_0x4c7b40[_0xfa11('0x2e')]=_[_0xfa11('0x29')](_0xa350f0,_0xfa11('0x26'));_0x4c7b40['query']=_[_0xfa11('0x2f')](_0x172ff8['query']);_0x4c7b40[_0xfa11('0x30')]=_[_0xfa11('0x31')](_0x4c7b40[_0xfa11('0x2e')],_0x4c7b40[_0xfa11('0x32')]);_0x44a8bb[_0xfa11('0x33')]=_[_0xfa11('0x31')](_0x4c7b40[_0xfa11('0x2e')],qs[_0xfa11('0x34')](_0x172ff8[_0xfa11('0x32')][_0xfa11('0x34')]));_0x44a8bb[_0xfa11('0x33')]=_0x44a8bb[_0xfa11('0x33')][_0xfa11('0x35')]?_0x44a8bb['attributes']:_0x4c7b40[_0xfa11('0x2e')];if(!_0x172ff8[_0xfa11('0x32')]['hasOwnProperty'](_0xfa11('0x36'))){_0x44a8bb[_0xfa11('0x1b')]=qs['limit'](_0x172ff8[_0xfa11('0x32')]['limit']);_0x44a8bb[_0xfa11('0x19')]=qs[_0xfa11('0x19')](_0x172ff8['query'][_0xfa11('0x19')]);}_0x44a8bb['order']=qs[_0xfa11('0x37')](_0x172ff8[_0xfa11('0x32')]['sort']);_0x44a8bb[_0xfa11('0x38')]=qs['filters'](_[_0xfa11('0x39')](_0x172ff8[_0xfa11('0x32')],_0x4c7b40['filters']),_0xa350f0);if(_0x172ff8[_0xfa11('0x32')]['filter']){_0x44a8bb['where']=_[_0xfa11('0x3a')](_0x44a8bb[_0xfa11('0x38')],{'$or':_['map'](_0xa350f0,function(_0x32c9ca){if(_0x32c9ca[_0xfa11('0x3b')]!==_0xfa11('0x3c')){var _0x4a4396={};_0x4a4396[_0x32c9ca['name']]={'$like':'%'+_0x172ff8[_0xfa11('0x32')][_0xfa11('0x3d')]+'%'};return _0x4a4396;}})});}_0x44a8bb=_['merge']({},_0x44a8bb,_0x172ff8['options']);var _0x2be465={'where':_0x44a8bb[_0xfa11('0x38')]};return db[_0xfa11('0x2a')][_0xfa11('0x1c')](_0x2be465)[_0xfa11('0x22')](function(_0x133ce9){_0x23b98b[_0xfa11('0x1c')]=_0x133ce9;if(_0x172ff8[_0xfa11('0x32')][_0xfa11('0x3e')]){_0x44a8bb[_0xfa11('0x3f')]=[{'all':!![]}];}return db[_0xfa11('0x2a')]['findAll'](_0x44a8bb);})['then'](function(_0x3b76cd){_0x23b98b[_0xfa11('0x40')]=_0x3b76cd;return _0x23b98b;})['then'](respondWithFilteredResult(_0x52730c,_0x44a8bb))['catch'](handleError(_0x52730c,null));};exports[_0xfa11('0x41')]=function(_0x268532,_0x429989){var _0x304f63={'raw':!![],'where':{'id':_0x268532[_0xfa11('0x42')]['id']}},_0x51934d={};_0x51934d[_0xfa11('0x2e')]=_['keys'](db['VoiceQueuesLog'][_0xfa11('0x2b')]);_0x51934d[_0xfa11('0x32')]=_[_0xfa11('0x2f')](_0x268532[_0xfa11('0x32')]);_0x51934d[_0xfa11('0x30')]=_[_0xfa11('0x31')](_0x51934d[_0xfa11('0x2e')],_0x51934d['query']);_0x304f63[_0xfa11('0x33')]=_[_0xfa11('0x31')](_0x51934d['model'],qs[_0xfa11('0x34')](_0x268532[_0xfa11('0x32')][_0xfa11('0x34')]));_0x304f63['attributes']=_0x304f63[_0xfa11('0x33')][_0xfa11('0x35')]?_0x304f63[_0xfa11('0x33')]:_0x51934d['model'];if(_0x268532[_0xfa11('0x32')]['includeAll']){_0x304f63[_0xfa11('0x3f')]=[{'all':!![]}];}_0x304f63=_[_0xfa11('0x3a')]({},_0x304f63,_0x268532[_0xfa11('0x43')]);return db[_0xfa11('0x2a')][_0xfa11('0x44')](_0x304f63)['then'](handleEntityNotFound(_0x429989,null))[_0xfa11('0x22')](respondWithResult(_0x429989,null))['catch'](handleError(_0x429989,null));};exports[_0xfa11('0x45')]=function(_0x2269fd,_0x281872){return db[_0xfa11('0x2a')][_0xfa11('0x45')](_0x2269fd[_0xfa11('0x46')],{})[_0xfa11('0x22')](respondWithResult(_0x281872,0xc9))['catch'](handleError(_0x281872,null));};exports[_0xfa11('0x21')]=function(_0x2c07ab,_0x24a144){if(_0x2c07ab[_0xfa11('0x46')]['id']){delete _0x2c07ab[_0xfa11('0x46')]['id'];}return db[_0xfa11('0x2a')][_0xfa11('0x44')]({'where':{'id':_0x2c07ab[_0xfa11('0x42')]['id']}})['then'](handleEntityNotFound(_0x24a144,null))[_0xfa11('0x22')](saveUpdates(_0x2c07ab[_0xfa11('0x46')],null))[_0xfa11('0x22')](respondWithResult(_0x24a144,null))['catch'](handleError(_0x24a144,null));};exports[_0xfa11('0x23')]=function(_0x431c4e,_0x2f2924){return db[_0xfa11('0x2a')][_0xfa11('0x44')]({'where':{'id':_0x431c4e[_0xfa11('0x42')]['id']}})['then'](handleEntityNotFound(_0x2f2924,null))[_0xfa11('0x22')](removeEntity(_0x2f2924,null))[_0xfa11('0x47')](handleError(_0x2f2924,null));}; \ No newline at end of file +var _0x8cf5=['count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','util','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x24bed0,_0x2519fa){var _0x3df76a=function(_0x1c94f8){while(--_0x1c94f8){_0x24bed0['push'](_0x24bed0['shift']());}};_0x3df76a(++_0x2519fa);}(_0x8cf5,0xfc));var _0x58cf=function(_0x1582be,_0x1fa1d5){_0x1582be=_0x1582be-0x0;var _0x246f4d=_0x8cf5[_0x1582be];return _0x246f4d;};'use strict';var emlformat=require(_0x58cf('0x0'));var rimraf=require(_0x58cf('0x1'));var zipdir=require(_0x58cf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x58cf('0x3'));var moment=require(_0x58cf('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x58cf('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x58cf('0x6'));var ejs=require(_0x58cf('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x58cf('0x8'));var crypto=require('crypto');var jsforce=require(_0x58cf('0x9'));var deskjs=require(_0x58cf('0xa'));var toCsv=require('to-csv');var querystring=require(_0x58cf('0xb'));var Papa=require(_0x58cf('0xc'));var Redis=require(_0x58cf('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x58cf('0xe'));var hardwareService=require(_0x58cf('0xf'));var logger=require(_0x58cf('0x10'))(_0x58cf('0x11'));var utils=require('../../config/utils');var config=require(_0x58cf('0x12'));var licenseUtil=require(_0x58cf('0x13'));var db=require(_0x58cf('0x14'))['db'];function respondWithStatusCode(_0x12731b,_0x22e757){_0x22e757=_0x22e757||0xcc;return function(_0x2c20bb){if(_0x2c20bb){return _0x12731b[_0x58cf('0x15')](_0x22e757);}return _0x12731b[_0x58cf('0x16')](_0x22e757)[_0x58cf('0x17')]();};}function respondWithResult(_0x3a1088,_0x1caeb4){_0x1caeb4=_0x1caeb4||0xc8;return function(_0x383a32){if(_0x383a32){return _0x3a1088['status'](_0x1caeb4)[_0x58cf('0x18')](_0x383a32);}};}function respondWithFilteredResult(_0x2b2b69,_0x21a63a){return function(_0x3a55ce){if(_0x3a55ce){var _0x17a489=typeof _0x21a63a[_0x58cf('0x19')]===_0x58cf('0x1a')&&typeof _0x21a63a[_0x58cf('0x1b')]===_0x58cf('0x1a');var _0x361b9b=_0x3a55ce[_0x58cf('0x1c')];var _0x597ba7=_0x17a489?0x0:_0x21a63a[_0x58cf('0x19')];var _0x53da50=_0x17a489?_0x3a55ce[_0x58cf('0x1c')]:_0x21a63a[_0x58cf('0x19')]+_0x21a63a[_0x58cf('0x1b')];var _0x2776ed;if(_0x53da50>=_0x361b9b){_0x53da50=_0x361b9b;_0x2776ed=0xc8;}else{_0x2776ed=0xce;}_0x2b2b69[_0x58cf('0x16')](_0x2776ed);return _0x2b2b69[_0x58cf('0x1d')]('Content-Range',_0x597ba7+'-'+_0x53da50+'/'+_0x361b9b)['json'](_0x3a55ce);}return null;};}function patchUpdates(_0x554378){return function(_0x253a61){try{jsonpatch[_0x58cf('0x1e')](_0x253a61,_0x554378,!![]);}catch(_0x441333){return BPromise[_0x58cf('0x1f')](_0x441333);}return _0x253a61[_0x58cf('0x20')]();};}function saveUpdates(_0x4ad278,_0x1a7e45){return function(_0x3ca4a9){if(_0x3ca4a9){return _0x3ca4a9[_0x58cf('0x21')](_0x4ad278)[_0x58cf('0x22')](function(_0x1e45a4){return _0x1e45a4;});}return null;};}function removeEntity(_0x535f82,_0x238760){return function(_0x5bdc63){if(_0x5bdc63){return _0x5bdc63[_0x58cf('0x23')]()[_0x58cf('0x22')](function(){_0x535f82[_0x58cf('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x336619,_0x82e16f){return function(_0x36f42f){if(!_0x36f42f){_0x336619[_0x58cf('0x15')](0x194);}return _0x36f42f;};}function handleError(_0x384b91,_0x451dc3){_0x451dc3=_0x451dc3||0x1f4;return function(_0x34647e){logger[_0x58cf('0x24')](_0x34647e[_0x58cf('0x25')]);if(_0x34647e[_0x58cf('0x26')]){delete _0x34647e[_0x58cf('0x26')];}_0x384b91['status'](_0x451dc3)[_0x58cf('0x27')](_0x34647e);};}exports[_0x58cf('0x28')]=function(_0x255c58,_0x480457){var _0xab4c1b={},_0x1f3b2e={},_0x145c9c={'count':0x0,'rows':[]};var _0x2f4f62=_[_0x58cf('0x29')](db[_0x58cf('0x2a')][_0x58cf('0x2b')],function(_0x4c5e63){return{'name':_0x4c5e63[_0x58cf('0x2c')],'type':_0x4c5e63[_0x58cf('0x2d')][_0x58cf('0x2e')]};});_0x1f3b2e[_0x58cf('0x2f')]=_[_0x58cf('0x29')](_0x2f4f62,'name');_0x1f3b2e['query']=_[_0x58cf('0x30')](_0x255c58[_0x58cf('0x31')]);_0x1f3b2e[_0x58cf('0x32')]=_[_0x58cf('0x33')](_0x1f3b2e[_0x58cf('0x2f')],_0x1f3b2e[_0x58cf('0x31')]);_0xab4c1b[_0x58cf('0x34')]=_[_0x58cf('0x33')](_0x1f3b2e['model'],qs[_0x58cf('0x35')](_0x255c58[_0x58cf('0x31')][_0x58cf('0x35')]));_0xab4c1b[_0x58cf('0x34')]=_0xab4c1b[_0x58cf('0x34')][_0x58cf('0x36')]?_0xab4c1b['attributes']:_0x1f3b2e[_0x58cf('0x2f')];if(!_0x255c58['query'][_0x58cf('0x37')]('nolimit')){_0xab4c1b[_0x58cf('0x1b')]=qs[_0x58cf('0x1b')](_0x255c58['query']['limit']);_0xab4c1b[_0x58cf('0x19')]=qs[_0x58cf('0x19')](_0x255c58[_0x58cf('0x31')][_0x58cf('0x19')]);}_0xab4c1b['order']=qs['sort'](_0x255c58[_0x58cf('0x31')]['sort']);_0xab4c1b['where']=qs[_0x58cf('0x32')](_[_0x58cf('0x38')](_0x255c58[_0x58cf('0x31')],_0x1f3b2e[_0x58cf('0x32')]),_0x2f4f62);if(_0x255c58[_0x58cf('0x31')][_0x58cf('0x39')]){_0xab4c1b[_0x58cf('0x3a')]=_[_0x58cf('0x3b')](_0xab4c1b['where'],{'$or':_['map'](_0x2f4f62,function(_0x525532){if(_0x525532[_0x58cf('0x2d')]!==_0x58cf('0x3c')){var _0x4cab41={};_0x4cab41[_0x525532['name']]={'$like':'%'+_0x255c58[_0x58cf('0x31')]['filter']+'%'};return _0x4cab41;}})});}_0xab4c1b=_[_0x58cf('0x3b')]({},_0xab4c1b,_0x255c58['options']);var _0x35cc79={'where':_0xab4c1b['where']};return db[_0x58cf('0x2a')]['count'](_0x35cc79)[_0x58cf('0x22')](function(_0x87fa5c){_0x145c9c[_0x58cf('0x1c')]=_0x87fa5c;if(_0x255c58['query'][_0x58cf('0x3d')]){_0xab4c1b[_0x58cf('0x3e')]=[{'all':!![]}];}return db[_0x58cf('0x2a')][_0x58cf('0x3f')](_0xab4c1b);})[_0x58cf('0x22')](function(_0x568992){_0x145c9c[_0x58cf('0x40')]=_0x568992;return _0x145c9c;})['then'](respondWithFilteredResult(_0x480457,_0xab4c1b))[_0x58cf('0x41')](handleError(_0x480457,null));};exports['show']=function(_0x5846be,_0x5c9b03){var _0x59d4e9={'raw':!![],'where':{'id':_0x5846be[_0x58cf('0x42')]['id']}},_0x57cc40={};_0x57cc40[_0x58cf('0x2f')]=_[_0x58cf('0x30')](db[_0x58cf('0x2a')]['rawAttributes']);_0x57cc40[_0x58cf('0x31')]=_['keys'](_0x5846be['query']);_0x57cc40[_0x58cf('0x32')]=_[_0x58cf('0x33')](_0x57cc40[_0x58cf('0x2f')],_0x57cc40[_0x58cf('0x31')]);_0x59d4e9[_0x58cf('0x34')]=_[_0x58cf('0x33')](_0x57cc40[_0x58cf('0x2f')],qs[_0x58cf('0x35')](_0x5846be['query'][_0x58cf('0x35')]));_0x59d4e9[_0x58cf('0x34')]=_0x59d4e9[_0x58cf('0x34')]['length']?_0x59d4e9[_0x58cf('0x34')]:_0x57cc40[_0x58cf('0x2f')];if(_0x5846be[_0x58cf('0x31')][_0x58cf('0x3d')]){_0x59d4e9['include']=[{'all':!![]}];}_0x59d4e9=_[_0x58cf('0x3b')]({},_0x59d4e9,_0x5846be['options']);return db[_0x58cf('0x2a')][_0x58cf('0x43')](_0x59d4e9)['then'](handleEntityNotFound(_0x5c9b03,null))[_0x58cf('0x22')](respondWithResult(_0x5c9b03,null))[_0x58cf('0x41')](handleError(_0x5c9b03,null));};exports[_0x58cf('0x44')]=function(_0x2d61d9,_0x505b41){return db['VoiceQueuesLog'][_0x58cf('0x44')](_0x2d61d9['body'],{})[_0x58cf('0x22')](respondWithResult(_0x505b41,0xc9))[_0x58cf('0x41')](handleError(_0x505b41,null));};exports['update']=function(_0x4ade85,_0x35b8f5){if(_0x4ade85[_0x58cf('0x45')]['id']){delete _0x4ade85[_0x58cf('0x45')]['id'];}return db[_0x58cf('0x2a')][_0x58cf('0x43')]({'where':{'id':_0x4ade85['params']['id']}})['then'](handleEntityNotFound(_0x35b8f5,null))[_0x58cf('0x22')](saveUpdates(_0x4ade85[_0x58cf('0x45')],null))['then'](respondWithResult(_0x35b8f5,null))[_0x58cf('0x41')](handleError(_0x35b8f5,null));};exports[_0x58cf('0x23')]=function(_0x4f66c5,_0x54407d){return db[_0x58cf('0x2a')]['find']({'where':{'id':_0x4f66c5[_0x58cf('0x42')]['id']}})[_0x58cf('0x22')](handleEntityNotFound(_0x54407d,null))[_0x58cf('0x22')](removeEntity(_0x54407d,null))['catch'](handleError(_0x54407d,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 673f588..5e217d0 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 _0x0cd2=['VoiceQueuesLog','voice_queues_log','event','dtm','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x3b3d81,_0x119b4c){var _0x733e1a=function(_0x30a8c5){while(--_0x30a8c5){_0x3b3d81['push'](_0x3b3d81['shift']());}};_0x733e1a(++_0x119b4c);}(_0x0cd2,0x1cb));var _0x20cd=function(_0x3a6abb,_0x4d8e70){_0x3a6abb=_0x3a6abb-0x0;var _0x396555=_0x0cd2[_0x3a6abb];return _0x396555;};'use strict';var _=require(_0x20cd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x20cd('0x1'));var moment=require(_0x20cd('0x2'));var BPromise=require(_0x20cd('0x3'));var rp=require(_0x20cd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x20cd('0x5'));var config=require(_0x20cd('0x6'));var attributes=require('./voiceQueuesLog.attributes');module[_0x20cd('0x7')]=function(_0x2171fb,_0x5af7b0){return _0x2171fb[_0x20cd('0x8')](_0x20cd('0x9'),attributes,{'tableName':_0x20cd('0xa'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x20cd('0xb'),_0x20cd('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x96d5=['../../config/environment','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x382dfd,_0x40c06c){var _0x356b15=function(_0x1a0240){while(--_0x1a0240){_0x382dfd['push'](_0x382dfd['shift']());}};_0x356b15(++_0x40c06c);}(_0x96d5,0x166));var _0x596d=function(_0xbc6566,_0x32d463){_0xbc6566=_0xbc6566-0x0;var _0x4ed128=_0x96d5[_0xbc6566];return _0x4ed128;};'use strict';var _=require(_0x596d('0x0'));var util=require('util');var logger=require(_0x596d('0x1'))(_0x596d('0x2'));var moment=require('moment');var BPromise=require(_0x596d('0x3'));var rp=require(_0x596d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x596d('0x5'));var config=require(_0x596d('0x6'));var attributes=require('./voiceQueuesLog.attributes');module[_0x596d('0x7')]=function(_0x1c8bbd,_0xfc78e8){return _0x1c8bbd[_0x596d('0x8')](_0x596d('0x9'),attributes,{'tableName':_0x596d('0xa'),'paranoid':![],'indexes':[{'name':_0x596d('0xb'),'fields':[_0x596d('0xc'),_0x596d('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index a561fc5..a7990b4 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 _0x9dbe=['rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4bc494,_0x5edcab){var _0x14fa09=function(_0x2ae284){while(--_0x2ae284){_0x4bc494['push'](_0x4bc494['shift']());}};_0x14fa09(++_0x5edcab);}(_0x9dbe,0x1c4));var _0xe9db=function(_0x110660,_0x30405a){_0x110660=_0x110660-0x0;var _0x4be6e1=_0x9dbe[_0x110660];return _0x4be6e1;};'use strict';var _=require(_0xe9db('0x0'));var util=require(_0xe9db('0x1'));var moment=require(_0xe9db('0x2'));var BPromise=require(_0xe9db('0x3'));var rs=require(_0xe9db('0x4'));var fs=require('fs');var Redis=require(_0xe9db('0x5'));var db=require(_0xe9db('0x6'))['db'];var utils=require(_0xe9db('0x7'));var logger=require('../../config/logger')(_0xe9db('0x8'));var config=require(_0xe9db('0x9'));var jayson=require(_0xe9db('0xa'));var client=jayson['client'][_0xe9db('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x121004,_0x5ba220,_0x56ee55){return new BPromise(function(_0x129aca,_0x20f4d4){return client[_0xe9db('0xc')](_0x121004,_0x56ee55)[_0xe9db('0xd')](function(_0x423a27){logger[_0xe9db('0xe')](_0xe9db('0xf'),_0x5ba220,_0xe9db('0x10'));logger['debug'](_0xe9db('0x11'),_0x5ba220,_0xe9db('0x10'),JSON[_0xe9db('0x12')](_0x423a27));if(_0x423a27[_0xe9db('0x13')]){if(_0x423a27[_0xe9db('0x13')][_0xe9db('0x14')]===0x1f4){logger[_0xe9db('0x13')](_0xe9db('0xf'),_0x5ba220,_0x423a27[_0xe9db('0x13')][_0xe9db('0x15')]);return _0x20f4d4(_0x423a27['error'][_0xe9db('0x15')]);}logger['error'](_0xe9db('0xf'),_0x5ba220,_0x423a27['error'][_0xe9db('0x15')]);return _0x129aca(_0x423a27[_0xe9db('0x13')][_0xe9db('0x15')]);}else{logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x5ba220,_0xe9db('0x10'));_0x129aca(_0x423a27['result'][_0xe9db('0x15')]);}})[_0xe9db('0x16')](function(_0x920d9b){logger[_0xe9db('0x13')](_0xe9db('0xf'),_0x5ba220,_0x920d9b);_0x20f4d4(_0x920d9b);});});} \ No newline at end of file +var _0x24cf=['info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x313f90,_0xa58897){var _0x3e0fb6=function(_0x5f0cd2){while(--_0x5f0cd2){_0x313f90['push'](_0x313f90['shift']());}};_0x3e0fb6(++_0xa58897);}(_0x24cf,0x1d5));var _0xf24c=function(_0x29d7ef,_0x251294){_0x29d7ef=_0x29d7ef-0x0;var _0x284f1c=_0x24cf[_0x29d7ef];return _0x284f1c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf24c('0x0'));var BPromise=require(_0xf24c('0x1'));var rs=require(_0xf24c('0x2'));var fs=require('fs');var Redis=require(_0xf24c('0x3'));var db=require(_0xf24c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf24c('0x5'))(_0xf24c('0x6'));var config=require(_0xf24c('0x7'));var jayson=require(_0xf24c('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5104bd,_0x272d25,_0x596e81){return new BPromise(function(_0x3b7cf1,_0x13163e){return client[_0xf24c('0x9')](_0x5104bd,_0x596e81)[_0xf24c('0xa')](function(_0x4b3ea3){logger[_0xf24c('0xb')](_0xf24c('0xc'),_0x272d25,_0xf24c('0xd'));logger[_0xf24c('0xe')](_0xf24c('0xf'),_0x272d25,_0xf24c('0xd'),JSON['stringify'](_0x4b3ea3));if(_0x4b3ea3[_0xf24c('0x10')]){if(_0x4b3ea3[_0xf24c('0x10')][_0xf24c('0x11')]===0x1f4){logger['error'](_0xf24c('0xc'),_0x272d25,_0x4b3ea3[_0xf24c('0x10')]['message']);return _0x13163e(_0x4b3ea3['error'][_0xf24c('0x12')]);}logger['error'](_0xf24c('0xc'),_0x272d25,_0x4b3ea3[_0xf24c('0x10')]['message']);return _0x3b7cf1(_0x4b3ea3[_0xf24c('0x10')][_0xf24c('0x12')]);}else{logger[_0xf24c('0xb')](_0xf24c('0xc'),_0x272d25,_0xf24c('0xd'));_0x3b7cf1(_0x4b3ea3['result']['message']);}})[_0xf24c('0x13')](function(_0x462801){logger['error'](_0xf24c('0xc'),_0x272d25,_0x462801);_0x13163e(_0x462801);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 109c8e7..0d4b6be 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 _0x9c00=['../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x5b9b11,_0x25ea00){var _0x4d8ec4=function(_0x562a7c){while(--_0x562a7c){_0x5b9b11['push'](_0x5b9b11['shift']());}};_0x4d8ec4(++_0x25ea00);}(_0x9c00,0x1a3));var _0x09c0=function(_0x197954,_0x3f61d0){_0x197954=_0x197954-0x0;var _0x231d54=_0x9c00[_0x197954];return _0x231d54;};'use strict';var multer=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var path=require(_0x09c0('0x2'));var timeout=require(_0x09c0('0x3'));var express=require(_0x09c0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x09c0('0x5'));var interaction=require(_0x09c0('0x6'));var config=require(_0x09c0('0x7'));var controller=require(_0x09c0('0x8'));router[_0x09c0('0x9')]('/',auth[_0x09c0('0xa')](),controller[_0x09c0('0xb')]);router[_0x09c0('0x9')]('/describe',auth[_0x09c0('0xa')](),controller[_0x09c0('0xc')]);router['get'](_0x09c0('0xd'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xe')]);router[_0x09c0('0x9')](_0x09c0('0xf'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x10')]);router[_0x09c0('0x9')](_0x09c0('0x11'),controller[_0x09c0('0x12')]);router[_0x09c0('0x9')](_0x09c0('0x13'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x14')]);router[_0x09c0('0x15')]('/',auth[_0x09c0('0xa')](),controller['create']);router[_0x09c0('0x15')](_0x09c0('0x13'),auth['isAuthenticated'](),controller[_0x09c0('0x16')]);router[_0x09c0('0x17')]('/:id',auth[_0x09c0('0xa')](),controller['update']);router['delete']('/:id',auth[_0x09c0('0xa')](),controller['destroy']);module[_0x09c0('0x18')]=router; \ No newline at end of file +var _0x2bdc=['util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','/:id/download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','update','destroy','exports','multer'];(function(_0x2440b9,_0x1732dc){var _0x3b097b=function(_0x39a1e9){while(--_0x39a1e9){_0x2440b9['push'](_0x2440b9['shift']());}};_0x3b097b(++_0x1732dc);}(_0x2bdc,0xb7));var _0xc2bd=function(_0x2e9490,_0x40ff41){_0x2e9490=_0x2e9490-0x0;var _0x400142=_0x2bdc[_0x2e9490];return _0x400142;};'use strict';var multer=require(_0xc2bd('0x0'));var util=require(_0xc2bd('0x1'));var path=require(_0xc2bd('0x2'));var timeout=require(_0xc2bd('0x3'));var express=require('express');var router=express[_0xc2bd('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc2bd('0x5'));var config=require(_0xc2bd('0x6'));var controller=require('./voiceRecording.controller');router['get']('/',auth[_0xc2bd('0x7')](),controller[_0xc2bd('0x8')]);router[_0xc2bd('0x9')]('/describe',auth[_0xc2bd('0x7')](),controller[_0xc2bd('0xa')]);router['get'](_0xc2bd('0xb'),auth[_0xc2bd('0x7')](),controller[_0xc2bd('0xc')]);router[_0xc2bd('0x9')](_0xc2bd('0xd'),auth[_0xc2bd('0x7')](),controller['download']);router[_0xc2bd('0x9')](_0xc2bd('0xe'),controller[_0xc2bd('0xf')]);router[_0xc2bd('0x9')](_0xc2bd('0x10'),auth[_0xc2bd('0x7')](),controller[_0xc2bd('0x11')]);router['post']('/',auth[_0xc2bd('0x7')](),controller['create']);router[_0xc2bd('0x12')](_0xc2bd('0x10'),auth[_0xc2bd('0x7')](),controller[_0xc2bd('0x13')]);router['put'](_0xc2bd('0xb'),auth[_0xc2bd('0x7')](),controller[_0xc2bd('0x14')]);router['delete']('/:id',auth[_0xc2bd('0x7')](),controller[_0xc2bd('0x15')]);module[_0xc2bd('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index c513e79..b1da89e 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(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 139adf9..e3da4b3 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 _0xed4f=['sort','pick','merge','where','type','options','VoiceRecording','includeAll','include','findAll','rows','catch','keys','length','create','body','find','params','describe','../../components/encryptor','uniqueid','value','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','download','message','Not\x20found','sequelize','MD5','col','token','$and','push','Entity\x20not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','Location','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','findOne','transcribe','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','language','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order'];(function(_0x59265a,_0x350f1b){var _0x6dae3d=function(_0x1be06c){while(--_0x1be06c){_0x59265a['push'](_0x59265a['shift']());}};_0x6dae3d(++_0x350f1b);}(_0xed4f,0xf5));var _0xfed4=function(_0x480247,_0x251a7b){_0x480247=_0x480247-0x0;var _0x37cb20=_0xed4f[_0x480247];return _0x37cb20;};'use strict';var emlformat=require(_0xfed4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfed4('0x1'));var jsonpatch=require(_0xfed4('0x2'));var rp=require(_0xfed4('0x3'));var moment=require(_0xfed4('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfed4('0x5'));var path=require(_0xfed4('0x6'));var sox=require(_0xfed4('0x7'));var csv=require(_0xfed4('0x8'));var ejs=require(_0xfed4('0x9'));var fs=require('fs');var fs_extra=require(_0xfed4('0xa'));var _=require('lodash');var squel=require(_0xfed4('0xb'));var crypto=require(_0xfed4('0xc'));var jsforce=require(_0xfed4('0xd'));var deskjs=require(_0xfed4('0xe'));var toCsv=require(_0xfed4('0x8'));var querystring=require(_0xfed4('0xf'));var Papa=require(_0xfed4('0x10'));var AWS=require('aws-sdk');var uuidv4=require(_0xfed4('0x11'));var Redis=require(_0xfed4('0x12'));var authService=require(_0xfed4('0x13'));var qs=require(_0xfed4('0x14'));var as=require(_0xfed4('0x15'));var hardwareService=require(_0xfed4('0x16'));var logger=require('../../config/logger')(_0xfed4('0x17'));var utils=require(_0xfed4('0x18'));var config=require(_0xfed4('0x19'));var licenseUtil=require(_0xfed4('0x1a'));var db=require(_0xfed4('0x1b'))['db'];function respondWithStatusCode(_0x4a4aaa,_0x4a9b64){_0x4a9b64=_0x4a9b64||0xcc;return function(_0x261053){if(_0x261053){return _0x4a4aaa[_0xfed4('0x1c')](_0x4a9b64);}return _0x4a4aaa[_0xfed4('0x1d')](_0x4a9b64)[_0xfed4('0x1e')]();};}function respondWithResult(_0x444a5d,_0x18c371){_0x18c371=_0x18c371||0xc8;return function(_0x5d47a9){if(_0x5d47a9){return _0x444a5d[_0xfed4('0x1d')](_0x18c371)['json'](_0x5d47a9);}};}function respondWithFilteredResult(_0xa52732,_0x1da9a2){return function(_0x4e5a68){if(_0x4e5a68){var _0x1d974f=typeof _0x1da9a2[_0xfed4('0x1f')]===_0xfed4('0x20')&&typeof _0x1da9a2[_0xfed4('0x21')]==='undefined';var _0x511075=_0x4e5a68[_0xfed4('0x22')];var _0x4c9f83=_0x1d974f?0x0:_0x1da9a2[_0xfed4('0x1f')];var _0x474144=_0x1d974f?_0x4e5a68[_0xfed4('0x22')]:_0x1da9a2[_0xfed4('0x1f')]+_0x1da9a2[_0xfed4('0x21')];var _0x289528;if(_0x474144>=_0x511075){_0x474144=_0x511075;_0x289528=0xc8;}else{_0x289528=0xce;}_0xa52732['status'](_0x289528);return _0xa52732[_0xfed4('0x23')](_0xfed4('0x24'),_0x4c9f83+'-'+_0x474144+'/'+_0x511075)[_0xfed4('0x25')](_0x4e5a68);}return null;};}function patchUpdates(_0x1ed26d){return function(_0x209425){try{jsonpatch[_0xfed4('0x26')](_0x209425,_0x1ed26d,!![]);}catch(_0x4c2978){return BPromise[_0xfed4('0x27')](_0x4c2978);}return _0x209425[_0xfed4('0x28')]();};}function saveUpdates(_0x4385e2,_0x1245a9){return function(_0x42c6be){if(_0x42c6be){return _0x42c6be[_0xfed4('0x29')](_0x4385e2)[_0xfed4('0x2a')](function(_0x3f7f1f){return _0x3f7f1f;});}return null;};}function removeEntity(_0x5291d5,_0x46802d){return function(_0x20a0ba){if(_0x20a0ba){return _0x20a0ba[_0xfed4('0x2b')]()[_0xfed4('0x2a')](function(){_0x5291d5[_0xfed4('0x1d')](0xcc)[_0xfed4('0x1e')]();});}};}function handleEntityNotFound(_0x30e485,_0x5780e2){return function(_0x1624ae){if(!_0x1624ae){_0x30e485[_0xfed4('0x1c')](0x194);}return _0x1624ae;};}function handleError(_0x40e4c2,_0x520ac7){_0x520ac7=_0x520ac7||0x1f4;return function(_0x2dc2ee){logger[_0xfed4('0x2c')](_0x2dc2ee[_0xfed4('0x2d')]);if(_0x2dc2ee['name']){delete _0x2dc2ee[_0xfed4('0x2e')];}_0x40e4c2[_0xfed4('0x1d')](_0x520ac7)[_0xfed4('0x2f')](_0x2dc2ee);};}exports['index']=function(_0x5a8452,_0x51be76){var _0x155f58={},_0x108ae8={},_0x5b76fc={'count':0x0,'rows':[]};var _0x50cca1=_[_0xfed4('0x30')](db['VoiceRecording'][_0xfed4('0x31')],function(_0x20f15a){return{'name':_0x20f15a[_0xfed4('0x32')],'type':_0x20f15a['type'][_0xfed4('0x33')]};});_0x108ae8[_0xfed4('0x34')]=_['differenceBy'](_[_0xfed4('0x30')](_0x50cca1,_0xfed4('0x2e')),['format']);_0x108ae8[_0xfed4('0x35')]=_['keys'](_0x5a8452[_0xfed4('0x35')]);_0x108ae8[_0xfed4('0x36')]=_[_0xfed4('0x37')](_0x108ae8[_0xfed4('0x34')],_0x108ae8[_0xfed4('0x35')]);_0x155f58[_0xfed4('0x38')]=_[_0xfed4('0x37')](_0x108ae8[_0xfed4('0x34')],qs[_0xfed4('0x39')](_0x5a8452[_0xfed4('0x35')]['fields']));_0x155f58[_0xfed4('0x38')]=_0x155f58[_0xfed4('0x38')]['length']?_0x155f58[_0xfed4('0x38')]:_0x108ae8[_0xfed4('0x34')];if(!_0x5a8452[_0xfed4('0x35')][_0xfed4('0x3a')](_0xfed4('0x3b'))){_0x155f58[_0xfed4('0x21')]=qs[_0xfed4('0x21')](_0x5a8452['query'][_0xfed4('0x21')]);_0x155f58[_0xfed4('0x1f')]=qs['offset'](_0x5a8452[_0xfed4('0x35')][_0xfed4('0x1f')]);}_0x155f58[_0xfed4('0x3c')]=qs['sort'](_0x5a8452['query'][_0xfed4('0x3d')]);_0x155f58['where']=qs[_0xfed4('0x36')](_[_0xfed4('0x3e')](_0x5a8452[_0xfed4('0x35')],_0x108ae8[_0xfed4('0x36')]),_0x50cca1);if(_0x5a8452[_0xfed4('0x35')]['filter']){_0x155f58['where']=_[_0xfed4('0x3f')](_0x155f58[_0xfed4('0x40')],{'$or':_['map'](_0x50cca1,function(_0x5c05b6){if(_0x5c05b6[_0xfed4('0x41')]!=='VIRTUAL'){var _0x37e5ce={};_0x37e5ce[_0x5c05b6['name']]={'$like':'%'+_0x5a8452['query']['filter']+'%'};return _0x37e5ce;}})});}_0x155f58=_[_0xfed4('0x3f')]({},_0x155f58,_0x5a8452[_0xfed4('0x42')]);var _0x532558={'where':_0x155f58[_0xfed4('0x40')]};return db[_0xfed4('0x43')]['count'](_0x532558)[_0xfed4('0x2a')](function(_0x5770da){_0x5b76fc['count']=_0x5770da;if(_0x5a8452[_0xfed4('0x35')][_0xfed4('0x44')]){_0x155f58[_0xfed4('0x45')]=[{'all':!![]}];}return db[_0xfed4('0x43')][_0xfed4('0x46')](_0x155f58);})[_0xfed4('0x2a')](function(_0x2b1dde){_0x5b76fc[_0xfed4('0x47')]=_0x2b1dde;return _0x5b76fc;})[_0xfed4('0x2a')](respondWithFilteredResult(_0x51be76,_0x155f58))[_0xfed4('0x48')](handleError(_0x51be76,null));};exports['show']=function(_0x353847,_0xd0644c){var _0x55b5a6={'raw':![],'where':{'id':_0x353847['params']['id']}},_0x1b4b3a={};_0x1b4b3a[_0xfed4('0x34')]=_[_0xfed4('0x49')](db[_0xfed4('0x43')][_0xfed4('0x31')]);_0x1b4b3a['query']=_[_0xfed4('0x49')](_0x353847['query']);_0x1b4b3a[_0xfed4('0x36')]=_[_0xfed4('0x37')](_0x1b4b3a[_0xfed4('0x34')],_0x1b4b3a[_0xfed4('0x35')]);_0x55b5a6[_0xfed4('0x38')]=_[_0xfed4('0x37')](_0x1b4b3a[_0xfed4('0x34')],qs[_0xfed4('0x39')](_0x353847[_0xfed4('0x35')][_0xfed4('0x39')]));_0x55b5a6[_0xfed4('0x38')]=_0x55b5a6['attributes'][_0xfed4('0x4a')]?_0x55b5a6[_0xfed4('0x38')]:_0x1b4b3a[_0xfed4('0x34')];if(_0x353847['query'][_0xfed4('0x44')]){_0x55b5a6[_0xfed4('0x45')]=[{'all':!![]}];}_0x55b5a6=_[_0xfed4('0x3f')]({},_0x55b5a6,_0x353847[_0xfed4('0x42')]);return db[_0xfed4('0x43')]['find'](_0x55b5a6)[_0xfed4('0x2a')](handleEntityNotFound(_0xd0644c,null))['then'](respondWithResult(_0xd0644c,null))['catch'](handleError(_0xd0644c,null));};exports[_0xfed4('0x4b')]=function(_0x415813,_0x2a1f16){return db[_0xfed4('0x43')][_0xfed4('0x4b')](_0x415813[_0xfed4('0x4c')],{})[_0xfed4('0x2a')](respondWithResult(_0x2a1f16,0xc9))['catch'](handleError(_0x2a1f16,null));};exports[_0xfed4('0x29')]=function(_0x3697ba,_0x6924ab){if(_0x3697ba[_0xfed4('0x4c')]['id']){delete _0x3697ba[_0xfed4('0x4c')]['id'];}return db[_0xfed4('0x43')][_0xfed4('0x4d')]({'where':{'id':_0x3697ba[_0xfed4('0x4e')]['id']}})[_0xfed4('0x2a')](handleEntityNotFound(_0x6924ab,null))[_0xfed4('0x2a')](saveUpdates(_0x3697ba[_0xfed4('0x4c')],null))[_0xfed4('0x2a')](respondWithResult(_0x6924ab,null))[_0xfed4('0x48')](handleError(_0x6924ab,null));};exports[_0xfed4('0x4f')]=function(_0x411e08,_0x522d4e){return db[_0xfed4('0x43')]['describe']()[_0xfed4('0x2a')](respondWithResult(_0x522d4e,null))['catch'](handleError(_0x522d4e,null));};exports['download']=function(_0x381ed2,_0x80ec46,_0x52ef3f){var _0x24ff6c=require(_0xfed4('0x50'));var _0x424c21=![];var _0x1eafde={};if(_0x381ed2[_0xfed4('0x35')][_0xfed4('0x41')]&&_0x381ed2[_0xfed4('0x35')]['type']==='uniqueid'){_0x1eafde[_0xfed4('0x51')]=_0x381ed2[_0xfed4('0x4e')]['id'];}else{_0x1eafde['id']=_0x381ed2[_0xfed4('0x4e')]['id'];}return db[_0xfed4('0x43')][_0xfed4('0x4d')]({'where':_0x1eafde,'attributes':['id',_0xfed4('0x52')],'raw':!![]})['then'](handleEntityNotFound(_0x80ec46,null))[_0xfed4('0x2a')](function(_0x40f6a0){if(_0x40f6a0){var _0x33fbbc=_0x40f6a0['value'];var _0x3aa3e7=util[_0xfed4('0x53')](_0xfed4('0x54'),_0x33fbbc);if(fs[_0xfed4('0x55')](_0x3aa3e7)){_0x424c21=!![];return _0x24ff6c[_0xfed4('0x56')](_0x3aa3e7,_0x33fbbc,config[_0xfed4('0x57')][_0xfed4('0x58')])[_0xfed4('0x2a')](function(){return _0x40f6a0;});}return _0x40f6a0;}})[_0xfed4('0x2a')](function(_0xf35496){if(_0xf35496){var _0x5f1918=_0xf35496['value'];if(!fs[_0xfed4('0x55')](_0x5f1918)){throw new db[(_0xfed4('0x59'))][(_0xfed4('0x5a'))](_0xfed4('0x5b'));}if(_0xf35496[_0xfed4('0x5c')]){return _0x80ec46['download'](_0x5f1918,_0xf35496[_0xfed4('0x5c')]+path[_0xfed4('0x5d')](_0x5f1918),function(){if(_0x424c21){fs[_0xfed4('0x5e')](_0x5f1918);}});}else{return _0x80ec46[_0xfed4('0x5f')](_0x5f1918,function(_0xa12ce4){if(_0x424c21){fs['unlink'](_0x5f1918);}});}}})[_0xfed4('0x48')](function(_0x4d697d){if(_0x4d697d[_0xfed4('0x60')]===_0xfed4('0x5b')){_0x80ec46[_0xfed4('0x1d')](0x194)['send'](_0xfed4('0x61'));}else{return handleError(_0x80ec46,null);}});};exports['downloads']=function(_0x31c19f,_0x5e0b29,_0x2646b7){var _0x24240a=require(_0xfed4('0x50'));var _0x164962=![];var _0x26894c={'$and':[db[_0xfed4('0x62')][_0xfed4('0x40')](db[_0xfed4('0x62')]['fn'](_0xfed4('0x63'),db['sequelize'][_0xfed4('0x64')]('uniqueid')),_0x31c19f[_0xfed4('0x35')][_0xfed4('0x65')])]};if(_0x31c19f['query'][_0xfed4('0x41')]&&_0x31c19f[_0xfed4('0x35')][_0xfed4('0x41')]==='uniqueid'){_0x26894c[_0xfed4('0x66')]['push']({'uniqueid':_0x31c19f[_0xfed4('0x4e')]['id']});}else{_0x26894c['$and'][_0xfed4('0x67')]({'id':_0x31c19f[_0xfed4('0x4e')]['id']});}return db[_0xfed4('0x43')][_0xfed4('0x4d')]({'where':_0x26894c,'attributes':['id','value'],'raw':!![]})[_0xfed4('0x2a')](handleEntityNotFound(_0x5e0b29,null))[_0xfed4('0x2a')](function(_0x177327){if(_0x177327){var _0x5bc2f5=util[_0xfed4('0x53')](_0xfed4('0x54'),_0x177327[_0xfed4('0x52')]);if(fs[_0xfed4('0x55')](_0x5bc2f5)){_0x164962=!![];return _0x24240a[_0xfed4('0x56')](_0x5bc2f5,_0x177327[_0xfed4('0x52')],config['secrets'][_0xfed4('0x58')])[_0xfed4('0x2a')](function(){return _0x177327;});}return _0x177327;}})['then'](function(_0x229ba1){if(_0x229ba1){if(!fs[_0xfed4('0x55')](_0x229ba1[_0xfed4('0x52')])){throw new db['Sequelize'][(_0xfed4('0x5a'))]('VoiceRecording\x20not\x20found');}if(_0x229ba1[_0xfed4('0x5c')]){return _0x5e0b29['download'](_0x229ba1[_0xfed4('0x52')],_0x229ba1['filename']+path[_0xfed4('0x5d')](_0x229ba1['value']),function(){if(_0x164962){fs['unlink'](_0x229ba1[_0xfed4('0x52')]);}});}else{return _0x5e0b29['download'](_0x229ba1[_0xfed4('0x52')],function(_0x1ada94){if(_0x164962){fs[_0xfed4('0x5e')](_0x229ba1[_0xfed4('0x52')]);}});}}})[_0xfed4('0x48')](handleError(_0x5e0b29,null));};exports[_0xfed4('0x2b')]=function(_0x363b8b,_0x2d5260){return db[_0xfed4('0x43')][_0xfed4('0x4d')]({'where':{'id':_0x363b8b['params']['id']}})[_0xfed4('0x2a')](function(_0x8e8bb9){if(_['isNil'](_0x8e8bb9)){throw new ReferenceError(_0xfed4('0x68'));}return _0x8e8bb9;})[_0xfed4('0x2a')](function(_0x38d3a2){var _0xd7860b=_0x38d3a2[_0xfed4('0x52')];logger[_0xfed4('0x69')]('cancellazione\x20fisica\x20documento\x20%s',_0xd7860b);if(!_[_0xfed4('0x6a')](_0x38d3a2[_0xfed4('0x52')])&&fs[_0xfed4('0x55')](_0xd7860b)){logger[_0xfed4('0x69')](_0xfed4('0x6b')+_0xd7860b+_0xfed4('0x6c'));fs['unlinkSync'](_0xd7860b);}_0xd7860b=_0xd7860b+_0xfed4('0x6d');if(!_['isNil'](_0x38d3a2['value'])&&fs[_0xfed4('0x55')](_0xd7860b)){logger[_0xfed4('0x69')]('File:\x20\x22'+_0xd7860b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xfed4('0x6e')](_0xd7860b);}return _0x38d3a2;})[_0xfed4('0x2a')](function(_0x54f9f6){if(!_0x54f9f6)throw new InternalError();return _0x54f9f6[_0xfed4('0x2b')]();})[_0xfed4('0x2a')](function(){_0x2d5260[_0xfed4('0x1d')](0xcc)[_0xfed4('0x1e')]();})[_0xfed4('0x48')](handleError(_0x2d5260,null));};function getBucketslist(_0x10268e,_0x5f2aed,_0x3922ad){return new Promise(function(_0x59673d,_0x3c6f1a){var _0x3ef087=new AWS['S3']({'accessKeyId':_0x5f2aed,'secretAccessKey':_0x10268e,'region':_0x3922ad});_0x3ef087[_0xfed4('0x6f')]({},function(_0x3ec92b,_0x36d243){if(_0x3ec92b){return _0x3c6f1a(_0x3ec92b);}else{return _0x59673d(_0x36d243);}});});}function createBucket(_0x1cf880,_0x57ed93,_0x4dd87e,_0x15c3e4){return new Promise(function(_0x1ce939,_0x12e378){var _0x2d2031=new AWS['S3']({'accessKeyId':_0x57ed93,'secretAccessKey':_0x1cf880,'region':_0x4dd87e});_0x2d2031[_0xfed4('0x70')]({'Bucket':_0x15c3e4},function(_0x22bdf8,_0x3e94c3){if(_0x22bdf8){return _0x12e378(_0x22bdf8);}else{return _0x1ce939(_0x3e94c3);}});});}function uploadFile(_0xa966e0,_0x140d3c,_0x4b450d,_0x4d2a05,_0x4bbe00,_0x439db0){return new Promise(function(_0x37e541,_0x344261){var _0x346135=new AWS['S3']({'accessKeyId':_0x140d3c,'secretAccessKey':_0xa966e0,'region':_0x4b450d});_0x346135[_0xfed4('0x71')]({'Bucket':_0x4d2a05,'Key':_0x4bbe00,'Body':_0x439db0},function(_0x37b2d9,_0x2f93c1){if(_0x37b2d9){return _0x344261(_0x37b2d9);}else{return _0x37e541(_0x2f93c1);}});});}function startTranscribe(_0x305d54,_0x3ee0cf,_0x120e79,_0x1d075f,_0x2511f0,_0x13d505){return new Promise(function(_0x112ecf,_0x15d8e3){var _0x22076f=new AWS[(_0xfed4('0x72'))]({'accessKeyId':_0x3ee0cf,'secretAccessKey':_0x305d54,'region':_0x120e79});_0x22076f['startTranscriptionJob']({'TranscriptionJobName':_0x1d075f,'LanguageCode':_0x2511f0,'Media':{'MediaFileUri':_0x13d505}},function(_0x4f77f7,_0x116601){if(_0x4f77f7){return _0x15d8e3(_0x4f77f7);}else{return _0x112ecf(_0x116601);}});});}function transcribe(_0x5c89d2,_0x1b4c67,_0x5d39d5,_0x4c8655,_0x3cad1b,_0x10b419,_0x19963d){return new Promise(function(_0x501663,_0x586b88){var _0xef9f13={};logger[_0xfed4('0x69')](util[_0xfed4('0x53')](_0xfed4('0x73'),_0x5c89d2,_0x3cad1b));return uploadFile(_0x1b4c67,_0x5d39d5,_0x4c8655,_0x3cad1b,path['basename'](_0x10b419),fs[_0xfed4('0x74')](_0x10b419))[_0xfed4('0x2a')](function(_0x19e0f6){logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x5c89d2,_0x3cad1b,_0x19e0f6[_0xfed4('0x75')]));_0xef9f13['bucket']=_0x19e0f6[_0xfed4('0x76')];_0xef9f13['location']=_0x19e0f6[_0xfed4('0x75')];logger[_0xfed4('0x69')](util[_0xfed4('0x53')](_0xfed4('0x77'),_0x5c89d2));return startTranscribe(_0x1b4c67,_0x5d39d5,_0x4c8655,uuidv4(),_0x19963d,_0x19e0f6[_0xfed4('0x75')]);})[_0xfed4('0x2a')](function(_0x10e6d4){logger['info'](util[_0xfed4('0x53')](_0xfed4('0x78'),_0x5c89d2,_0x10e6d4[_0xfed4('0x79')]['TranscriptionJobName']));_0xef9f13[_0xfed4('0x7a')]=_0x10e6d4[_0xfed4('0x79')][_0xfed4('0x7b')];_0xef9f13[_0xfed4('0x7c')]=_0x10e6d4[_0xfed4('0x79')]['TranscriptionJobStatus'];return _0x501663(_0xef9f13);})[_0xfed4('0x48')](function(_0x3b2b05){return _0x586b88(_0x3b2b05);});});}exports['runTranscribe']=function(_0x2f8ef5,_0x5f18bc,_0x5a13bb){var _0x2687a4;var _0x44b2f1;var _0x1b0160;var _0x318021=require(_0xfed4('0x50'));return db['VoiceRecording']['findOne']({'where':{'id':_0x2f8ef5[_0xfed4('0x4e')]['id']}})[_0xfed4('0x2a')](function(_0x439fa0){if(_0x439fa0){var _0x335fcc=util[_0xfed4('0x53')](_0xfed4('0x54'),_0x439fa0[_0xfed4('0x52')]);if(fs[_0xfed4('0x55')](_0x335fcc)){cypher=!![];return _0x318021['decryptFile'](_0x335fcc,_0x439fa0[_0xfed4('0x52')],config[_0xfed4('0x57')]['recording'])[_0xfed4('0x2a')](function(){return _0x439fa0;});}return _0x439fa0;}})[_0xfed4('0x2a')](function(_0x2abcb3){if(!_0x2abcb3){throw new db[(_0xfed4('0x59'))]['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x44b2f1=_0x2abcb3;return db['Setting'][_0xfed4('0x7d')]({'where':{'id':0x1}});})[_0xfed4('0x2a')](handleEntityNotFound(_0x5f18bc,null))['then'](function(_0xd7f22c){if(_0xd7f22c){_0x2687a4=_0xd7f22c;if(!_0x2687a4[_0xfed4('0x7e')]||!_0x2687a4[_0xfed4('0x7f')]||!_0x2687a4[_0xfed4('0x80')]||!_0x2687a4['language']||!_0x2687a4['bucket']){throw new db[(_0xfed4('0x59'))][(_0xfed4('0x5a'))](_0xfed4('0x81'));}if(_0x2f8ef5[_0xfed4('0x4c')][_0xfed4('0x82')]&&(!_0x2687a4[_0xfed4('0x83')]||!_0x2687a4[_0xfed4('0x84')]||!_0x2687a4['sentimentRegion']||!_0x2687a4[_0xfed4('0x85')]||!_0x2687a4[_0xfed4('0x86')])){throw new db[(_0xfed4('0x59'))][(_0xfed4('0x5a'))](_0xfed4('0x87'));}return db[_0xfed4('0x88')][_0xfed4('0x7d')]({'where':{'id':_0x2687a4[_0xfed4('0x7f')]}});}})[_0xfed4('0x2a')](function(_0x940f3b){if(!_0x940f3b){throw new db[(_0xfed4('0x59'))][(_0xfed4('0x5a'))](_0xfed4('0x89'));}if(!_0x940f3b[_0xfed4('0x8a')]||!_0x940f3b['data2']){throw new db[(_0xfed4('0x59'))][(_0xfed4('0x5a'))](_0xfed4('0x8b'));}_0x1b0160=_0x940f3b;return getBucketslist(_0x1b0160['data1'],_0x1b0160[_0xfed4('0x8c')],_0x2687a4[_0xfed4('0x80')]);})[_0xfed4('0x2a')](function(_0x3bf509){if(_0x3bf509&&_0x3bf509[_0xfed4('0x8d')]){var _0x3de429=_['find'](_0x3bf509['Buckets'],function(_0x1d5bce){return _0x1d5bce['Name']===_0x2687a4['bucket'];});if(!_0x3de429){logger[_0xfed4('0x69')](util[_0xfed4('0x53')](_0xfed4('0x8e'),_0x2f8ef5[_0xfed4('0x4e')]['id'],_0x2687a4[_0xfed4('0x86')]));return createBucket(_0x1b0160[_0xfed4('0x8a')],_0x1b0160[_0xfed4('0x8c')],_0x2687a4[_0xfed4('0x80')],_0x2687a4['bucket']);}logger[_0xfed4('0x69')](util[_0xfed4('0x53')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x2f8ef5[_0xfed4('0x4e')]['id'],_0x2687a4[_0xfed4('0x86')]));return;}})[_0xfed4('0x2a')](function(_0x230822){if(_0x44b2f1[_0xfed4('0x7c')]==='NEW'){return transcribe(_0x2f8ef5[_0xfed4('0x4e')]['id'],_0x1b0160[_0xfed4('0x8a')],_0x1b0160[_0xfed4('0x8c')],_0x2687a4[_0xfed4('0x80')],_0x2687a4['bucket'],_0x44b2f1[_0xfed4('0x52')],_0x2687a4[_0xfed4('0x85')]);}else{logger[_0xfed4('0x69')](util['format'](_0xfed4('0x8f'),_0x2f8ef5['params']['id']));return{'transcribeStatus':_0xfed4('0x90')};}})['then'](function(_0x6a7a38){if(_0x6a7a38){_0x6a7a38['tempSentiment']=_0x2f8ef5[_0xfed4('0x4c')][_0xfed4('0x82')];return _0x44b2f1[_0xfed4('0x91')](_0x6a7a38);}})['then'](respondWithResult(_0x5f18bc,null))[_0xfed4('0x48')](handleError(_0x5f18bc,null));};function writeFile(_0x18694c,_0x2d989c){return new Promise(function(_0x4b134b,_0x5554cd){fs[_0xfed4('0x92')](_0x2d989c,_0x18694c,function(_0x3ff87c,_0x49ee7a){if(_0x3ff87c){return _0x5554cd(_0x3ff87c);}else{return _0x4b134b(_0x49ee7a);}});});}exports[_0xfed4('0x93')]=function(_0x25b3c0,_0x5a4909,_0x292fe0){return db[_0xfed4('0x43')][_0xfed4('0x7d')]({'where':{'id':_0x25b3c0['params']['id']}})[_0xfed4('0x2a')](handleEntityNotFound(_0x5a4909))[_0xfed4('0x2a')](function(_0x48ceb8){if(_0x48ceb8&&_0x48ceb8[_0xfed4('0x94')]){var _0x7449da=_0x48ceb8[_0xfed4('0x94')];var _0x455a81=config[_0xfed4('0x95')]+_0xfed4('0x96')+_0x48ceb8['id']+_0xfed4('0x97');if(fs['existsSync'](_0x455a81)){return _0x455a81;}return writeFile(_0x7449da,_0x455a81)[_0xfed4('0x2a')](function(){return _0x455a81;});}else{throw new db[(_0xfed4('0x59'))]['ValidationError'](_0xfed4('0x98'));}})[_0xfed4('0x2a')](function(_0x313167){return _0x5a4909[_0xfed4('0x5f')](_0x313167);})[_0xfed4('0x48')](handleError(_0x5a4909));}; \ No newline at end of file +var _0xcad0=['NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','sendStatus','error','name','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','catch','show','params','find','create','body','describe','download','../../components/encryptor','uniqueid','value','existsSync','decryptFile','secrets','recording','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','send','downloads','sequelize','token','$and','push','Sequelize','isNil','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','upload','startTranscriptionJob','format','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','%s.cypher','Voice\x20Recording\x20not\x20found','transcribe','transcribeAccountId','transcribeRegion','language','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available'];(function(_0x36d5d5,_0x1c1590){var _0x4eaa56=function(_0x56fa0e){while(--_0x56fa0e){_0x36d5d5['push'](_0x36d5d5['shift']());}};_0x4eaa56(++_0x1c1590);}(_0xcad0,0x1b6));var _0x0cad=function(_0x423b10,_0x36cad4){_0x423b10=_0x423b10-0x0;var _0x1338d9=_0xcad0[_0x423b10];return _0x1338d9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0cad('0x0'));var jsonpatch=require(_0x0cad('0x1'));var rp=require('request-promise');var moment=require(_0x0cad('0x2'));var BPromise=require(_0x0cad('0x3'));var Mustache=require('mustache');var util=require(_0x0cad('0x4'));var path=require(_0x0cad('0x5'));var sox=require(_0x0cad('0x6'));var csv=require(_0x0cad('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0cad('0x8'));var squel=require(_0x0cad('0x9'));var crypto=require(_0x0cad('0xa'));var jsforce=require(_0x0cad('0xb'));var deskjs=require(_0x0cad('0xc'));var toCsv=require(_0x0cad('0x7'));var querystring=require('querystring');var Papa=require(_0x0cad('0xd'));var AWS=require('aws-sdk');var uuidv4=require(_0x0cad('0xe'));var Redis=require('ioredis');var authService=require(_0x0cad('0xf'));var qs=require(_0x0cad('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0cad('0x11'));var logger=require(_0x0cad('0x12'))('api');var utils=require(_0x0cad('0x13'));var config=require(_0x0cad('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0cad('0x15'))['db'];function respondWithStatusCode(_0x5340bc,_0x3d6dff){_0x3d6dff=_0x3d6dff||0xcc;return function(_0x3e4953){if(_0x3e4953){return _0x5340bc['sendStatus'](_0x3d6dff);}return _0x5340bc['status'](_0x3d6dff)[_0x0cad('0x16')]();};}function respondWithResult(_0x5b39a1,_0xbacfb4){_0xbacfb4=_0xbacfb4||0xc8;return function(_0xfbfd9c){if(_0xfbfd9c){return _0x5b39a1[_0x0cad('0x17')](_0xbacfb4)[_0x0cad('0x18')](_0xfbfd9c);}};}function respondWithFilteredResult(_0x3354c2,_0x37c999){return function(_0x4cccb6){if(_0x4cccb6){var _0x17035b=typeof _0x37c999[_0x0cad('0x19')]===_0x0cad('0x1a')&&typeof _0x37c999[_0x0cad('0x1b')]==='undefined';var _0xe082=_0x4cccb6['count'];var _0x5905b3=_0x17035b?0x0:_0x37c999['offset'];var _0x1a6deb=_0x17035b?_0x4cccb6[_0x0cad('0x1c')]:_0x37c999[_0x0cad('0x19')]+_0x37c999[_0x0cad('0x1b')];var _0x1c934f;if(_0x1a6deb>=_0xe082){_0x1a6deb=_0xe082;_0x1c934f=0xc8;}else{_0x1c934f=0xce;}_0x3354c2[_0x0cad('0x17')](_0x1c934f);return _0x3354c2[_0x0cad('0x1d')](_0x0cad('0x1e'),_0x5905b3+'-'+_0x1a6deb+'/'+_0xe082)[_0x0cad('0x18')](_0x4cccb6);}return null;};}function patchUpdates(_0x2dffbd){return function(_0x4fbd9b){try{jsonpatch['apply'](_0x4fbd9b,_0x2dffbd,!![]);}catch(_0x443bd5){return BPromise[_0x0cad('0x1f')](_0x443bd5);}return _0x4fbd9b['save']();};}function saveUpdates(_0x33c042,_0x39a529){return function(_0x52dd0e){if(_0x52dd0e){return _0x52dd0e[_0x0cad('0x20')](_0x33c042)[_0x0cad('0x21')](function(_0x5d11d9){return _0x5d11d9;});}return null;};}function removeEntity(_0x5a0624,_0x5e23fc){return function(_0x86dd07){if(_0x86dd07){return _0x86dd07[_0x0cad('0x22')]()[_0x0cad('0x21')](function(){_0x5a0624[_0x0cad('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51b992,_0x4f926b){return function(_0x44866b){if(!_0x44866b){_0x51b992[_0x0cad('0x23')](0x194);}return _0x44866b;};}function handleError(_0x47338a,_0x2250c2){_0x2250c2=_0x2250c2||0x1f4;return function(_0xf090b5){logger[_0x0cad('0x24')](_0xf090b5['stack']);if(_0xf090b5[_0x0cad('0x25')]){delete _0xf090b5[_0x0cad('0x25')];}_0x47338a[_0x0cad('0x17')](_0x2250c2)['send'](_0xf090b5);};}exports['index']=function(_0x5eb903,_0x248dec){var _0x48cc7a={},_0x51120c={},_0x1d41fd={'count':0x0,'rows':[]};var _0x5eac21=_[_0x0cad('0x26')](db[_0x0cad('0x27')][_0x0cad('0x28')],function(_0x3a5199){return{'name':_0x3a5199[_0x0cad('0x29')],'type':_0x3a5199[_0x0cad('0x2a')][_0x0cad('0x2b')]};});_0x51120c[_0x0cad('0x2c')]=_[_0x0cad('0x2d')](_[_0x0cad('0x26')](_0x5eac21,_0x0cad('0x25')),['format']);_0x51120c['query']=_[_0x0cad('0x2e')](_0x5eb903[_0x0cad('0x2f')]);_0x51120c[_0x0cad('0x30')]=_[_0x0cad('0x31')](_0x51120c[_0x0cad('0x2c')],_0x51120c[_0x0cad('0x2f')]);_0x48cc7a[_0x0cad('0x32')]=_[_0x0cad('0x31')](_0x51120c[_0x0cad('0x2c')],qs[_0x0cad('0x33')](_0x5eb903['query'][_0x0cad('0x33')]));_0x48cc7a[_0x0cad('0x32')]=_0x48cc7a[_0x0cad('0x32')][_0x0cad('0x34')]?_0x48cc7a[_0x0cad('0x32')]:_0x51120c[_0x0cad('0x2c')];if(!_0x5eb903['query'][_0x0cad('0x35')](_0x0cad('0x36'))){_0x48cc7a[_0x0cad('0x1b')]=qs[_0x0cad('0x1b')](_0x5eb903['query']['limit']);_0x48cc7a[_0x0cad('0x19')]=qs[_0x0cad('0x19')](_0x5eb903[_0x0cad('0x2f')][_0x0cad('0x19')]);}_0x48cc7a[_0x0cad('0x37')]=qs[_0x0cad('0x38')](_0x5eb903[_0x0cad('0x2f')][_0x0cad('0x38')]);_0x48cc7a[_0x0cad('0x39')]=qs[_0x0cad('0x30')](_[_0x0cad('0x3a')](_0x5eb903[_0x0cad('0x2f')],_0x51120c[_0x0cad('0x30')]),_0x5eac21);if(_0x5eb903[_0x0cad('0x2f')]['filter']){_0x48cc7a['where']=_[_0x0cad('0x3b')](_0x48cc7a[_0x0cad('0x39')],{'$or':_[_0x0cad('0x26')](_0x5eac21,function(_0x4f63dc){if(_0x4f63dc[_0x0cad('0x2a')]!=='VIRTUAL'){var _0x5102ca={};_0x5102ca[_0x4f63dc['name']]={'$like':'%'+_0x5eb903[_0x0cad('0x2f')][_0x0cad('0x3c')]+'%'};return _0x5102ca;}})});}_0x48cc7a=_['merge']({},_0x48cc7a,_0x5eb903[_0x0cad('0x3d')]);var _0x39d812={'where':_0x48cc7a[_0x0cad('0x39')]};return db[_0x0cad('0x27')][_0x0cad('0x1c')](_0x39d812)[_0x0cad('0x21')](function(_0x1331d7){_0x1d41fd[_0x0cad('0x1c')]=_0x1331d7;if(_0x5eb903['query'][_0x0cad('0x3e')]){_0x48cc7a[_0x0cad('0x3f')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x48cc7a);})['then'](function(_0x3dde1c){_0x1d41fd['rows']=_0x3dde1c;return _0x1d41fd;})[_0x0cad('0x21')](respondWithFilteredResult(_0x248dec,_0x48cc7a))[_0x0cad('0x40')](handleError(_0x248dec,null));};exports[_0x0cad('0x41')]=function(_0x35933b,_0x3eaf2c){var _0x117d46={'raw':![],'where':{'id':_0x35933b[_0x0cad('0x42')]['id']}},_0x21fca1={};_0x21fca1[_0x0cad('0x2c')]=_[_0x0cad('0x2e')](db[_0x0cad('0x27')][_0x0cad('0x28')]);_0x21fca1['query']=_[_0x0cad('0x2e')](_0x35933b['query']);_0x21fca1['filters']=_[_0x0cad('0x31')](_0x21fca1['model'],_0x21fca1[_0x0cad('0x2f')]);_0x117d46[_0x0cad('0x32')]=_[_0x0cad('0x31')](_0x21fca1[_0x0cad('0x2c')],qs[_0x0cad('0x33')](_0x35933b[_0x0cad('0x2f')]['fields']));_0x117d46[_0x0cad('0x32')]=_0x117d46[_0x0cad('0x32')][_0x0cad('0x34')]?_0x117d46[_0x0cad('0x32')]:_0x21fca1['model'];if(_0x35933b[_0x0cad('0x2f')]['includeAll']){_0x117d46[_0x0cad('0x3f')]=[{'all':!![]}];}_0x117d46=_[_0x0cad('0x3b')]({},_0x117d46,_0x35933b[_0x0cad('0x3d')]);return db[_0x0cad('0x27')][_0x0cad('0x43')](_0x117d46)[_0x0cad('0x21')](handleEntityNotFound(_0x3eaf2c,null))[_0x0cad('0x21')](respondWithResult(_0x3eaf2c,null))[_0x0cad('0x40')](handleError(_0x3eaf2c,null));};exports[_0x0cad('0x44')]=function(_0xb4cab3,_0x571089){return db[_0x0cad('0x27')]['create'](_0xb4cab3[_0x0cad('0x45')],{})['then'](respondWithResult(_0x571089,0xc9))[_0x0cad('0x40')](handleError(_0x571089,null));};exports[_0x0cad('0x20')]=function(_0x7f41a,_0x45c84e){if(_0x7f41a['body']['id']){delete _0x7f41a[_0x0cad('0x45')]['id'];}return db[_0x0cad('0x27')][_0x0cad('0x43')]({'where':{'id':_0x7f41a[_0x0cad('0x42')]['id']}})[_0x0cad('0x21')](handleEntityNotFound(_0x45c84e,null))[_0x0cad('0x21')](saveUpdates(_0x7f41a[_0x0cad('0x45')],null))[_0x0cad('0x21')](respondWithResult(_0x45c84e,null))[_0x0cad('0x40')](handleError(_0x45c84e,null));};exports[_0x0cad('0x46')]=function(_0x197370,_0x169cd8){return db['VoiceRecording'][_0x0cad('0x46')]()['then'](respondWithResult(_0x169cd8,null))[_0x0cad('0x40')](handleError(_0x169cd8,null));};exports[_0x0cad('0x47')]=function(_0x4b1390,_0x32db8b,_0x2df491){var _0x53461b=require(_0x0cad('0x48'));var _0x5d002a=![];var _0x47cb8b={};if(_0x4b1390[_0x0cad('0x2f')][_0x0cad('0x2a')]&&_0x4b1390['query'][_0x0cad('0x2a')]===_0x0cad('0x49')){_0x47cb8b[_0x0cad('0x49')]=_0x4b1390[_0x0cad('0x42')]['id'];}else{_0x47cb8b['id']=_0x4b1390['params']['id'];}return db['VoiceRecording'][_0x0cad('0x43')]({'where':_0x47cb8b,'attributes':['id','value'],'raw':!![]})[_0x0cad('0x21')](handleEntityNotFound(_0x32db8b,null))[_0x0cad('0x21')](function(_0x500252){if(_0x500252){var _0x404276=_0x500252[_0x0cad('0x4a')];var _0x199207=util['format']('%s.cypher',_0x404276);if(fs[_0x0cad('0x4b')](_0x199207)){_0x5d002a=!![];return _0x53461b[_0x0cad('0x4c')](_0x199207,_0x404276,config[_0x0cad('0x4d')][_0x0cad('0x4e')])[_0x0cad('0x21')](function(){return _0x500252;});}return _0x500252;}})[_0x0cad('0x21')](function(_0x7dccca){if(_0x7dccca){var _0x5e4f3f=_0x7dccca[_0x0cad('0x4a')];if(!fs[_0x0cad('0x4b')](_0x5e4f3f)){throw new db['Sequelize'][(_0x0cad('0x4f'))](_0x0cad('0x50'));}if(_0x7dccca['filename']){return _0x32db8b['download'](_0x5e4f3f,_0x7dccca[_0x0cad('0x51')]+path[_0x0cad('0x52')](_0x5e4f3f),function(){if(_0x5d002a){fs[_0x0cad('0x53')](_0x5e4f3f);}});}else{return _0x32db8b[_0x0cad('0x47')](_0x5e4f3f,function(_0x419424){if(_0x5d002a){fs[_0x0cad('0x53')](_0x5e4f3f);}});}}})[_0x0cad('0x40')](function(_0x14fcc7){if(_0x14fcc7[_0x0cad('0x54')]===_0x0cad('0x50')){_0x32db8b[_0x0cad('0x17')](0x194)[_0x0cad('0x55')]('Not\x20found');}else{return handleError(_0x32db8b,null);}});};exports[_0x0cad('0x56')]=function(_0x1b9051,_0x33f55e,_0x4c3997){var _0x58e899=require('../../components/encryptor');var _0x4499c8=![];var _0x269067={'$and':[db[_0x0cad('0x57')][_0x0cad('0x39')](db['sequelize']['fn']('MD5',db[_0x0cad('0x57')]['col']('uniqueid')),_0x1b9051[_0x0cad('0x2f')][_0x0cad('0x58')])]};if(_0x1b9051[_0x0cad('0x2f')][_0x0cad('0x2a')]&&_0x1b9051['query'][_0x0cad('0x2a')]===_0x0cad('0x49')){_0x269067['$and']['push']({'uniqueid':_0x1b9051[_0x0cad('0x42')]['id']});}else{_0x269067[_0x0cad('0x59')][_0x0cad('0x5a')]({'id':_0x1b9051['params']['id']});}return db[_0x0cad('0x27')][_0x0cad('0x43')]({'where':_0x269067,'attributes':['id',_0x0cad('0x4a')],'raw':!![]})['then'](handleEntityNotFound(_0x33f55e,null))['then'](function(_0x98f0c2){if(_0x98f0c2){var _0x1a3980=util['format']('%s.cypher',_0x98f0c2['value']);if(fs['existsSync'](_0x1a3980)){_0x4499c8=!![];return _0x58e899[_0x0cad('0x4c')](_0x1a3980,_0x98f0c2[_0x0cad('0x4a')],config[_0x0cad('0x4d')]['recording'])[_0x0cad('0x21')](function(){return _0x98f0c2;});}return _0x98f0c2;}})[_0x0cad('0x21')](function(_0x5e87a9){if(_0x5e87a9){if(!fs[_0x0cad('0x4b')](_0x5e87a9[_0x0cad('0x4a')])){throw new db[(_0x0cad('0x5b'))][(_0x0cad('0x4f'))]('VoiceRecording\x20not\x20found');}if(_0x5e87a9[_0x0cad('0x51')]){return _0x33f55e[_0x0cad('0x47')](_0x5e87a9[_0x0cad('0x4a')],_0x5e87a9[_0x0cad('0x51')]+path[_0x0cad('0x52')](_0x5e87a9[_0x0cad('0x4a')]),function(){if(_0x4499c8){fs[_0x0cad('0x53')](_0x5e87a9[_0x0cad('0x4a')]);}});}else{return _0x33f55e[_0x0cad('0x47')](_0x5e87a9[_0x0cad('0x4a')],function(_0x3bbc19){if(_0x4499c8){fs[_0x0cad('0x53')](_0x5e87a9[_0x0cad('0x4a')]);}});}}})['catch'](handleError(_0x33f55e,null));};exports[_0x0cad('0x22')]=function(_0x4852a1,_0x4d97fc){return db[_0x0cad('0x27')]['find']({'where':{'id':_0x4852a1[_0x0cad('0x42')]['id']}})[_0x0cad('0x21')](function(_0x8e0ad2){if(_[_0x0cad('0x5c')](_0x8e0ad2)){throw new ReferenceError('Entity\x20not\x20found');}return _0x8e0ad2;})[_0x0cad('0x21')](function(_0x4bedb8){var _0x2837f=_0x4bedb8[_0x0cad('0x4a')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x2837f);if(!_['isNil'](_0x4bedb8[_0x0cad('0x4a')])&&fs['existsSync'](_0x2837f)){logger[_0x0cad('0x5d')](_0x0cad('0x5e')+_0x2837f+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x0cad('0x5f')](_0x2837f);}_0x2837f=_0x2837f+_0x0cad('0x60');if(!_[_0x0cad('0x5c')](_0x4bedb8[_0x0cad('0x4a')])&&fs[_0x0cad('0x4b')](_0x2837f)){logger[_0x0cad('0x5d')](_0x0cad('0x5e')+_0x2837f+_0x0cad('0x61'));fs['unlinkSync'](_0x2837f);}return _0x4bedb8;})[_0x0cad('0x21')](function(_0x1910ff){if(!_0x1910ff)throw new InternalError();return _0x1910ff['destroy']();})[_0x0cad('0x21')](function(){_0x4d97fc[_0x0cad('0x17')](0xcc)[_0x0cad('0x16')]();})['catch'](handleError(_0x4d97fc,null));};function getBucketslist(_0x1f9c50,_0x6141a9,_0x5ac3e1){return new Promise(function(_0x247fcf,_0x16e4f6){var _0x196bdf=new AWS['S3']({'accessKeyId':_0x6141a9,'secretAccessKey':_0x1f9c50,'region':_0x5ac3e1});_0x196bdf['listBuckets']({},function(_0x539561,_0x37b20d){if(_0x539561){return _0x16e4f6(_0x539561);}else{return _0x247fcf(_0x37b20d);}});});}function createBucket(_0x3dafb1,_0x3dcefd,_0xcbebe,_0x3abeac){return new Promise(function(_0x12271e,_0x428da5){var _0x332f8c=new AWS['S3']({'accessKeyId':_0x3dcefd,'secretAccessKey':_0x3dafb1,'region':_0xcbebe});_0x332f8c['createBucket']({'Bucket':_0x3abeac},function(_0x76f53f,_0x18079d){if(_0x76f53f){return _0x428da5(_0x76f53f);}else{return _0x12271e(_0x18079d);}});});}function uploadFile(_0x55b0da,_0x1c9d8c,_0x32ac27,_0x4cac4b,_0x20074a,_0xc91b9e){return new Promise(function(_0x47deac,_0x5c2d97){var _0x4064e5=new AWS['S3']({'accessKeyId':_0x1c9d8c,'secretAccessKey':_0x55b0da,'region':_0x32ac27});_0x4064e5[_0x0cad('0x62')]({'Bucket':_0x4cac4b,'Key':_0x20074a,'Body':_0xc91b9e},function(_0x1b6fda,_0x3aa578){if(_0x1b6fda){return _0x5c2d97(_0x1b6fda);}else{return _0x47deac(_0x3aa578);}});});}function startTranscribe(_0x2bf0e7,_0x219fe3,_0x36bcfe,_0x461f3c,_0x5bf6bb,_0xaa3257){return new Promise(function(_0x250d9b,_0x21ee3e){var _0x3a8eb6=new AWS['TranscribeService']({'accessKeyId':_0x219fe3,'secretAccessKey':_0x2bf0e7,'region':_0x36bcfe});_0x3a8eb6[_0x0cad('0x63')]({'TranscriptionJobName':_0x461f3c,'LanguageCode':_0x5bf6bb,'Media':{'MediaFileUri':_0xaa3257}},function(_0x48aedd,_0x4c1514){if(_0x48aedd){return _0x21ee3e(_0x48aedd);}else{return _0x250d9b(_0x4c1514);}});});}function transcribe(_0x107a67,_0x5074a6,_0x5f01d6,_0x24bd8f,_0x418356,_0x26ee82,_0xf41d64){return new Promise(function(_0x3959d2,_0x56d26d){var _0x277d27={};logger[_0x0cad('0x5d')](util[_0x0cad('0x64')](_0x0cad('0x65'),_0x107a67,_0x418356));return uploadFile(_0x5074a6,_0x5f01d6,_0x24bd8f,_0x418356,path['basename'](_0x26ee82),fs['readFileSync'](_0x26ee82))['then'](function(_0x2d4e76){logger[_0x0cad('0x5d')](util[_0x0cad('0x64')](_0x0cad('0x66'),_0x107a67,_0x418356,_0x2d4e76[_0x0cad('0x67')]));_0x277d27[_0x0cad('0x68')]=_0x2d4e76[_0x0cad('0x69')];_0x277d27[_0x0cad('0x6a')]=_0x2d4e76[_0x0cad('0x67')];logger[_0x0cad('0x5d')](util[_0x0cad('0x64')](_0x0cad('0x6b'),_0x107a67));return startTranscribe(_0x5074a6,_0x5f01d6,_0x24bd8f,uuidv4(),_0xf41d64,_0x2d4e76[_0x0cad('0x67')]);})[_0x0cad('0x21')](function(_0x5b2ccb){logger[_0x0cad('0x5d')](util['format'](_0x0cad('0x6c'),_0x107a67,_0x5b2ccb[_0x0cad('0x6d')][_0x0cad('0x6e')]));_0x277d27[_0x0cad('0x6f')]=_0x5b2ccb[_0x0cad('0x6d')][_0x0cad('0x6e')];_0x277d27[_0x0cad('0x70')]=_0x5b2ccb['TranscriptionJob'][_0x0cad('0x71')];return _0x3959d2(_0x277d27);})[_0x0cad('0x40')](function(_0x5660ec){return _0x56d26d(_0x5660ec);});});}exports[_0x0cad('0x72')]=function(_0x320e48,_0x5a0d94,_0x3274fc){var _0x12db22;var _0x3e3c0f;var _0x2a37d3;var _0x419054=require('../../components/encryptor');return db[_0x0cad('0x27')][_0x0cad('0x73')]({'where':{'id':_0x320e48[_0x0cad('0x42')]['id']}})[_0x0cad('0x21')](function(_0xedb978){if(_0xedb978){var _0x19dfc6=util[_0x0cad('0x64')](_0x0cad('0x74'),_0xedb978[_0x0cad('0x4a')]);if(fs[_0x0cad('0x4b')](_0x19dfc6)){cypher=!![];return _0x419054['decryptFile'](_0x19dfc6,_0xedb978[_0x0cad('0x4a')],config[_0x0cad('0x4d')][_0x0cad('0x4e')])[_0x0cad('0x21')](function(){return _0xedb978;});}return _0xedb978;}})[_0x0cad('0x21')](function(_0x407c82){if(!_0x407c82){throw new db['Sequelize'][(_0x0cad('0x4f'))](_0x0cad('0x75'));}_0x3e3c0f=_0x407c82;return db['Setting'][_0x0cad('0x73')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x5a0d94,null))['then'](function(_0x7a4f54){if(_0x7a4f54){_0x12db22=_0x7a4f54;if(!_0x12db22[_0x0cad('0x76')]||!_0x12db22[_0x0cad('0x77')]||!_0x12db22[_0x0cad('0x78')]||!_0x12db22[_0x0cad('0x79')]||!_0x12db22[_0x0cad('0x68')]){throw new db['Sequelize'][(_0x0cad('0x4f'))]('Transcribe\x20not\x20configured');}if(_0x320e48[_0x0cad('0x45')][_0x0cad('0x7a')]&&(!_0x12db22[_0x0cad('0x7b')]||!_0x12db22[_0x0cad('0x7c')]||!_0x12db22[_0x0cad('0x7d')]||!_0x12db22['language']||!_0x12db22[_0x0cad('0x68')])){throw new db[(_0x0cad('0x5b'))][(_0x0cad('0x4f'))](_0x0cad('0x7e'));}return db[_0x0cad('0x7f')][_0x0cad('0x73')]({'where':{'id':_0x12db22[_0x0cad('0x77')]}});}})[_0x0cad('0x21')](function(_0x3d2da0){if(!_0x3d2da0){throw new db[(_0x0cad('0x5b'))][(_0x0cad('0x4f'))](_0x0cad('0x80'));}if(!_0x3d2da0[_0x0cad('0x81')]||!_0x3d2da0['data2']){throw new db[(_0x0cad('0x5b'))]['ValidationError'](_0x0cad('0x82'));}_0x2a37d3=_0x3d2da0;return getBucketslist(_0x2a37d3['data1'],_0x2a37d3[_0x0cad('0x83')],_0x12db22[_0x0cad('0x78')]);})[_0x0cad('0x21')](function(_0x25744c){if(_0x25744c&&_0x25744c[_0x0cad('0x84')]){var _0x1928c9=_['find'](_0x25744c[_0x0cad('0x84')],function(_0x4c7801){return _0x4c7801['Name']===_0x12db22[_0x0cad('0x68')];});if(!_0x1928c9){logger['info'](util[_0x0cad('0x64')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x320e48['params']['id'],_0x12db22[_0x0cad('0x68')]));return createBucket(_0x2a37d3[_0x0cad('0x81')],_0x2a37d3[_0x0cad('0x83')],_0x12db22[_0x0cad('0x78')],_0x12db22[_0x0cad('0x68')]);}logger[_0x0cad('0x5d')](util['format'](_0x0cad('0x85'),_0x320e48['params']['id'],_0x12db22[_0x0cad('0x68')]));return;}})[_0x0cad('0x21')](function(_0xc8d51){if(_0x3e3c0f['transcribeStatus']===_0x0cad('0x86')){return transcribe(_0x320e48[_0x0cad('0x42')]['id'],_0x2a37d3[_0x0cad('0x81')],_0x2a37d3[_0x0cad('0x83')],_0x12db22[_0x0cad('0x78')],_0x12db22['bucket'],_0x3e3c0f[_0x0cad('0x4a')],_0x12db22[_0x0cad('0x79')]);}else{logger[_0x0cad('0x5d')](util[_0x0cad('0x64')](_0x0cad('0x87'),_0x320e48[_0x0cad('0x42')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x0cad('0x21')](function(_0x5e963e){if(_0x5e963e){_0x5e963e[_0x0cad('0x88')]=_0x320e48[_0x0cad('0x45')]['runSentiment'];return _0x3e3c0f[_0x0cad('0x89')](_0x5e963e);}})[_0x0cad('0x21')](respondWithResult(_0x5a0d94,null))[_0x0cad('0x40')](handleError(_0x5a0d94,null));};function writeFile(_0x3c254c,_0x9ddcbd){return new Promise(function(_0x3e70c0,_0x56ce71){fs['writeFile'](_0x9ddcbd,_0x3c254c,function(_0x19799f,_0x17676b){if(_0x19799f){return _0x56ce71(_0x19799f);}else{return _0x3e70c0(_0x17676b);}});});}exports[_0x0cad('0x8a')]=function(_0x4f14b8,_0x18d1ad,_0x5f234b){return db[_0x0cad('0x27')][_0x0cad('0x73')]({'where':{'id':_0x4f14b8[_0x0cad('0x42')]['id']}})[_0x0cad('0x21')](handleEntityNotFound(_0x18d1ad))[_0x0cad('0x21')](function(_0x4547b9){if(_0x4547b9&&_0x4547b9[_0x0cad('0x8b')]){var _0x4b1538=_0x4547b9[_0x0cad('0x8b')];var _0x173ad1=config[_0x0cad('0x8c')]+_0x0cad('0x8d')+_0x4547b9['id']+'.txt';if(fs[_0x0cad('0x4b')](_0x173ad1)){return _0x173ad1;}return writeFile(_0x4b1538,_0x173ad1)['then'](function(){return _0x173ad1;});}else{throw new db['Sequelize'][(_0x0cad('0x4f'))](_0x0cad('0x8e'));}})[_0x0cad('0x21')](function(_0x543adf){return _0x18d1ad[_0x0cad('0x47')](_0x543adf);})[_0x0cad('0x40')](handleError(_0x18d1ad));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index ce7895f..b599a37 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 _0x87e1=['request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','lodash','util','../../config/logger','api','bluebird'];(function(_0x30efc1,_0xce84de){var _0x46d79e=function(_0x397ace){while(--_0x397ace){_0x30efc1['push'](_0x30efc1['shift']());}};_0x46d79e(++_0xce84de);}(_0x87e1,0xb1));var _0x187e=function(_0x52660e,_0x4bae6b){_0x52660e=_0x52660e-0x0;var _0x2fd1a3=_0x87e1[_0x52660e];return _0x2fd1a3;};'use strict';var _=require(_0x187e('0x0'));var util=require(_0x187e('0x1'));var logger=require(_0x187e('0x2'))(_0x187e('0x3'));var moment=require('moment');var BPromise=require(_0x187e('0x4'));var rp=require(_0x187e('0x5'));var fs=require('fs');var path=require(_0x187e('0x6'));var rimraf=require(_0x187e('0x7'));var config=require(_0x187e('0x8'));var attributes=require(_0x187e('0x9'));module[_0x187e('0xa')]=function(_0x22f398,_0x4e17ad){return _0x22f398[_0x187e('0xb')](_0x187e('0xc'),attributes,{'tableName':_0x187e('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x76d5=['define','VoiceRecording','voice_recordings','uniqueid','lodash','api','moment','path','rimraf','../../config/environment','./voiceRecording.attributes'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0x76d5,0x19b));var _0x576d=function(_0x3bd885,_0x440155){_0x3bd885=_0x3bd885-0x0;var _0x5f5791=_0x76d5[_0x3bd885];return _0x5f5791;};'use strict';var _=require(_0x576d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x576d('0x1'));var moment=require(_0x576d('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x576d('0x3'));var rimraf=require(_0x576d('0x4'));var config=require(_0x576d('0x5'));var attributes=require(_0x576d('0x6'));module['exports']=function(_0x1fec3e,_0x1d7f08){return _0x1fec3e[_0x576d('0x7')](_0x576d('0x8'),attributes,{'tableName':_0x576d('0x9'),'paranoid':![],'indexes':[{'name':_0x576d('0xa'),'fields':[_0x576d('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index ac1e358..4875527 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 _0xfcbb=['VoiceRecording,\x20%s,\x20%s','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','options','attributes','limit','CreateVoiceRecording','Setting','findOne','callRecordingEncryption','create','body','existsSync','value','format','%s.cypher','encryptFile','recording','unlink','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xb9580,_0x441821){var _0x532515=function(_0x32ef38){while(--_0x32ef38){_0xb9580['push'](_0xb9580['shift']());}};_0x532515(++_0x441821);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x450f0b,_0x269b47){_0x450f0b=_0x450f0b-0x0;var _0x4bf3eb=_0xfcbb[_0x450f0b];return _0x4bf3eb;};'use strict';var _=require(_0xbfcb('0x0'));var util=require(_0xbfcb('0x1'));var moment=require(_0xbfcb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfcb('0x3'));var db=require(_0xbfcb('0x4'))['db'];var utils=require(_0xbfcb('0x5'));var logger=require(_0xbfcb('0x6'))(_0xbfcb('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbfcb('0x8')][_0xbfcb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8d4e6a,_0x2df839,_0x288ee5){return new BPromise(function(_0x2f875c,_0x49717b){return client['request'](_0x8d4e6a,_0x288ee5)[_0xbfcb('0xa')](function(_0x331173){logger[_0xbfcb('0xb')]('VoiceRecording,\x20%s,\x20%s',_0x2df839,_0xbfcb('0xc'));logger[_0xbfcb('0xd')](_0xbfcb('0xe'),_0x2df839,_0xbfcb('0xc'),JSON[_0xbfcb('0xf')](_0x331173));if(_0x331173[_0xbfcb('0x10')]){if(_0x331173['error'][_0xbfcb('0x11')]===0x1f4){logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x331173[_0xbfcb('0x10')]['message']);return _0x49717b(_0x331173[_0xbfcb('0x10')]['message']);}logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x331173[_0xbfcb('0x10')][_0xbfcb('0x13')]);return _0x2f875c(_0x331173[_0xbfcb('0x10')][_0xbfcb('0x13')]);}else{logger[_0xbfcb('0xb')](_0xbfcb('0x12'),_0x2df839,_0xbfcb('0xc'));_0x2f875c(_0x331173[_0xbfcb('0x14')][_0xbfcb('0x13')]);}})[_0xbfcb('0x15')](function(_0x26f335){logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x26f335);_0x49717b(_0x26f335);});});}exports[_0xbfcb('0x16')]=function(_0xba1d6){var _0x38689e=this;return new Promise(function(_0x3404aa,_0x46b8d2){return db[_0xbfcb('0x17')][_0xbfcb('0x18')](_0xba1d6['body'],{'raw':_0xba1d6[_0xbfcb('0x19')]?_0xba1d6[_0xbfcb('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xba1d6[_0xbfcb('0x19')]?_0xba1d6[_0xbfcb('0x19')]['where']||null:null,'attributes':_0xba1d6['options']?_0xba1d6[_0xbfcb('0x19')][_0xbfcb('0x1a')]||null:null,'limit':_0xba1d6[_0xbfcb('0x19')]?_0xba1d6[_0xbfcb('0x19')][_0xbfcb('0x1b')]||null:null})['then'](function(_0x365d6c){logger[_0xbfcb('0xb')](_0xbfcb('0x16'),_0xba1d6);logger[_0xbfcb('0xd')](_0xbfcb('0x16'),_0xba1d6,JSON[_0xbfcb('0xf')](_0x365d6c));_0x3404aa(_0x365d6c);})[_0xbfcb('0x15')](function(_0x14e43c){logger[_0xbfcb('0x10')](_0xbfcb('0x16'),_0x14e43c[_0xbfcb('0x13')],_0xba1d6);_0x46b8d2(_0x38689e[_0xbfcb('0x10')](0x1f4,_0x14e43c[_0xbfcb('0x13')]));});});};exports[_0xbfcb('0x1c')]=function(_0x3e954d){var _0x2a1272=this;return new Promise(function(_0x5cd703,_0x3465f5){var _0x2881f8=require('../../components/encryptor');var _0x64a69;return db[_0xbfcb('0x1d')][_0xbfcb('0x1e')]({'attributes':['id',_0xbfcb('0x1f')],'where':{'id':0x1},'raw':!![]})[_0xbfcb('0xa')](function(_0x3542e9){_0x64a69=_0x3542e9;return db[_0xbfcb('0x17')][_0xbfcb('0x20')](_0x3e954d[_0xbfcb('0x21')]);})[_0xbfcb('0xa')](function(_0x59719b){if(_0x64a69[_0xbfcb('0x1f')]&&fs[_0xbfcb('0x22')](_0x59719b[_0xbfcb('0x23')])){var _0x43de3c=util[_0xbfcb('0x24')](_0xbfcb('0x25'),_0x59719b[_0xbfcb('0x23')]);return _0x2881f8[_0xbfcb('0x26')](_0x59719b[_0xbfcb('0x23')],_0x43de3c,config['secrets'][_0xbfcb('0x27')])[_0xbfcb('0xa')](function(){fs[_0xbfcb('0x28')](_0x59719b[_0xbfcb('0x23')]);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0x59719b;});}return _0x59719b;})[_0xbfcb('0xa')](function(_0x35925b){logger[_0xbfcb('0xb')](_0xbfcb('0x1c'),_0x3e954d);logger[_0xbfcb('0xd')](_0xbfcb('0x1c'),_0x3e954d,JSON[_0xbfcb('0xf')](_0x35925b));_0x5cd703(_0x35925b);})['catch'](function(_0x504d81){logger['error'](_0xbfcb('0x1c'),_0x504d81['message'],_0x3e954d);_0x3465f5(_0x2a1272[_0xbfcb('0x10')](0x1f4,_0x504d81[_0xbfcb('0x13')]));});});}; \ No newline at end of file +var _0x2542=['catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','UpdateVoiceRecording','update','body','options','raw','where','limit','../../components/encryptor','Setting','callRecordingEncryption','VoiceRecording','create','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording'];(function(_0x26eecf,_0x360096){var _0x1cf849=function(_0x44f8be){while(--_0x44f8be){_0x26eecf['push'](_0x26eecf['shift']());}};_0x1cf849(++_0x360096);}(_0x2542,0x169));var _0x2254=function(_0x387969,_0x24921c){_0x387969=_0x387969-0x0;var _0x4a77ce=_0x2542[_0x387969];return _0x4a77ce;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});}exports[_0x2254('0x16')]=function(_0x1ae11e){var _0x34f90e=this;return new Promise(function(_0x497724,_0x51b395){return db['VoiceRecording'][_0x2254('0x17')](_0x1ae11e[_0x2254('0x18')],{'raw':_0x1ae11e[_0x2254('0x19')]?_0x1ae11e[_0x2254('0x19')][_0x2254('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ae11e[_0x2254('0x19')]?_0x1ae11e['options'][_0x2254('0x1b')]||null:null,'attributes':_0x1ae11e[_0x2254('0x19')]?_0x1ae11e[_0x2254('0x19')]['attributes']||null:null,'limit':_0x1ae11e['options']?_0x1ae11e['options'][_0x2254('0x1c')]||null:null})[_0x2254('0xc')](function(_0xf88b56){logger['info']('UpdateVoiceRecording',_0x1ae11e);logger['debug']('UpdateVoiceRecording',_0x1ae11e,JSON['stringify'](_0xf88b56));_0x497724(_0xf88b56);})['catch'](function(_0x1aa71f){logger[_0x2254('0x14')](_0x2254('0x16'),_0x1aa71f[_0x2254('0x15')],_0x1ae11e);_0x51b395(_0x34f90e[_0x2254('0x14')](0x1f4,_0x1aa71f[_0x2254('0x15')]));});});};exports['CreateVoiceRecording']=function(_0x4a8274){var _0x1ada42=this;return new Promise(function(_0x4f6877,_0x35608a){var _0x141dc5=require(_0x2254('0x1d'));var _0x3aa0bd;return db[_0x2254('0x1e')]['findOne']({'attributes':['id',_0x2254('0x1f')],'where':{'id':0x1},'raw':!![]})[_0x2254('0xc')](function(_0x21285d){_0x3aa0bd=_0x21285d;return db[_0x2254('0x20')][_0x2254('0x21')](_0x4a8274[_0x2254('0x18')]);})[_0x2254('0xc')](function(_0x22e791){if(_0x3aa0bd[_0x2254('0x1f')]&&fs[_0x2254('0x22')](_0x22e791[_0x2254('0x23')])){var _0xad7774=util[_0x2254('0x24')](_0x2254('0x25'),_0x22e791[_0x2254('0x23')]);return _0x141dc5[_0x2254('0x26')](_0x22e791[_0x2254('0x23')],_0xad7774,config[_0x2254('0x27')][_0x2254('0x28')])['then'](function(){fs[_0x2254('0x29')](_0x22e791[_0x2254('0x23')]);logger[_0x2254('0xd')](_0x2254('0x2a'));return _0x22e791;});}return _0x22e791;})[_0x2254('0xc')](function(_0x1d275b){logger[_0x2254('0xd')](_0x2254('0x2b'),_0x4a8274);logger[_0x2254('0xf')]('CreateVoiceRecording',_0x4a8274,JSON[_0x2254('0x12')](_0x1d275b));_0x4f6877(_0x1d275b);})[_0x2254('0x2c')](function(_0x503540){logger[_0x2254('0x14')](_0x2254('0x2b'),_0x503540[_0x2254('0x15')],_0x4a8274);_0x35608a(_0x1ada42[_0x2254('0x14')](0x1f4,_0x503540['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 9d6a5aa..e507ff1 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 _0x78aa=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','post','create','put','update','delete'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x78aa,0x105));var _0xa78a=function(_0x455e8a,_0x17def6){_0x455e8a=_0x455e8a-0x0;var _0x132409=_0x78aa[_0x455e8a];return _0x132409;};'use strict';var multer=require(_0xa78a('0x0'));var util=require(_0xa78a('0x1'));var path=require(_0xa78a('0x2'));var timeout=require(_0xa78a('0x3'));var express=require(_0xa78a('0x4'));var router=express['Router']();var fs_extra=require(_0xa78a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa78a('0x6'));var config=require(_0xa78a('0x7'));var controller=require('./voiceTransferReport.controller');router['get']('/',auth[_0xa78a('0x8')](),controller[_0xa78a('0x9')]);router[_0xa78a('0xa')](_0xa78a('0xb'),auth[_0xa78a('0x8')](),controller[_0xa78a('0xc')]);router['get'](_0xa78a('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xa78a('0xe')]('/',auth[_0xa78a('0x8')](),controller[_0xa78a('0xf')]);router[_0xa78a('0x10')](_0xa78a('0xd'),auth['isAuthenticated'](),controller[_0xa78a('0x11')]);router[_0xa78a('0x12')](_0xa78a('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xa78a('0x13')]=router; \ No newline at end of file +var _0x3c66=['Router','fs-extra','../../components/auth/service','./voiceTransferReport.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x2d2d37,_0x5778a6){var _0x55bbce=function(_0x319445){while(--_0x319445){_0x2d2d37['push'](_0x2d2d37['shift']());}};_0x55bbce(++_0x5778a6);}(_0x3c66,0x1ef));var _0x63c6=function(_0x26cbce,_0x44addd){_0x26cbce=_0x26cbce-0x0;var _0xf052c3=_0x3c66[_0x26cbce];return _0xf052c3;};'use strict';var multer=require(_0x63c6('0x0'));var util=require(_0x63c6('0x1'));var path=require(_0x63c6('0x2'));var timeout=require(_0x63c6('0x3'));var express=require(_0x63c6('0x4'));var router=express[_0x63c6('0x5')]();var fs_extra=require(_0x63c6('0x6'));var auth=require(_0x63c6('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x63c6('0x8'));router[_0x63c6('0x9')]('/',auth['isAuthenticated'](),controller[_0x63c6('0xa')]);router[_0x63c6('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x63c6('0xb'),auth[_0x63c6('0xc')](),controller[_0x63c6('0xd')]);router[_0x63c6('0xe')]('/',auth[_0x63c6('0xc')](),controller[_0x63c6('0xf')]);router[_0x63c6('0x10')](_0x63c6('0xb'),auth['isAuthenticated'](),controller[_0x63c6('0x11')]);router['delete'](_0x63c6('0xb'),auth[_0x63c6('0xc')](),controller[_0x63c6('0x12')]);module[_0x63c6('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index b7c9d57..d7a04d0 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 _0x703f=['exports','ENUM','blind','attended','STRING','Yes'];(function(_0x2aa5a4,_0x51ed81){var _0x229dab=function(_0x4f62c9){while(--_0x4f62c9){_0x2aa5a4['push'](_0x2aa5a4['shift']());}};_0x229dab(++_0x51ed81);}(_0x703f,0x1b6));var _0xf703=function(_0x547f7e,_0x41c8dd){_0x547f7e=_0x547f7e-0x0;var _0x469b38=_0x703f[_0x547f7e];return _0x469b38;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xf703('0x0')]={'type':{'type':Sequelize[_0xf703('0x1')](_0xf703('0x2'),_0xf703('0x3'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xf703('0x4')]},'transferercalleridnum':{'type':Sequelize[_0xf703('0x4')]},'transferercalleridname':{'type':Sequelize[_0xf703('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0xf703('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0xf703('0x4')]},'transfereraccountcode':{'type':Sequelize[_0xf703('0x4')]},'transferercontext':{'type':Sequelize[_0xf703('0x4')]},'transfererexten':{'type':Sequelize[_0xf703('0x4')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0xf703('0x4')]},'transfereecalleridname':{'type':Sequelize[_0xf703('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xf703('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0xf703('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0xf703('0x4')]},'transfereecontext':{'type':Sequelize[_0xf703('0x4')]},'transfereeexten':{'type':Sequelize[_0xf703('0x4')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0xf703('0x1')](_0xf703('0x5'),'No')},'context':{'type':Sequelize[_0xf703('0x4')]},'extension':{'type':Sequelize[_0xf703('0x4')]}}; \ No newline at end of file +var _0x16fc=['attended','STRING','Yes','sequelize','moment','exports','ENUM','blind'];(function(_0x130dac,_0x4799d4){var _0x4d2555=function(_0x370c2f){while(--_0x370c2f){_0x130dac['push'](_0x130dac['shift']());}};_0x4d2555(++_0x4799d4);}(_0x16fc,0x83));var _0xc16f=function(_0x48b66d,_0x16a9df){_0x48b66d=_0x48b66d-0x0;var _0x4a3d04=_0x16fc[_0x48b66d];return _0x4a3d04;};'use strict';var Sequelize=require(_0xc16f('0x0'));var moment=require(_0xc16f('0x1'));module[_0xc16f('0x2')]={'type':{'type':Sequelize[_0xc16f('0x3')](_0xc16f('0x4'),_0xc16f('0x5'))},'result':{'type':Sequelize[_0xc16f('0x6')]},'transfererchannel':{'type':Sequelize[_0xc16f('0x6')]},'transferercalleridnum':{'type':Sequelize[_0xc16f('0x6')]},'transferercalleridname':{'type':Sequelize[_0xc16f('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0xc16f('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0xc16f('0x6')]},'transfereraccountcode':{'type':Sequelize[_0xc16f('0x6')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xc16f('0x6')]},'transfererlinkedid':{'type':Sequelize[_0xc16f('0x6')]},'transfereechannel':{'type':Sequelize[_0xc16f('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0xc16f('0x6')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xc16f('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0xc16f('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0xc16f('0x6')]},'transfereecontext':{'type':Sequelize[_0xc16f('0x6')]},'transfereeexten':{'type':Sequelize[_0xc16f('0x6')]},'transfereelinkedid':{'type':Sequelize[_0xc16f('0x6')]},'isexternal':{'type':Sequelize[_0xc16f('0x3')](_0xc16f('0x7'),'No')},'context':{'type':Sequelize[_0xc16f('0x6')]},'extension':{'type':Sequelize[_0xc16f('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 8773f8e..f30033d 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 _0x66af=['json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','send','map','VoiceTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','merge','options','includeAll','findAll','catch','show','params','intersection','include','find','create','body','describe','rimraf','zip-dir','fast-json-patch','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x15ecbe,_0x471dbf){var _0x3ff86d=function(_0x579811){while(--_0x579811){_0x15ecbe['push'](_0x15ecbe['shift']());}};_0x3ff86d(++_0x471dbf);}(_0x66af,0xb9));var _0xf66a=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x66af[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf66a('0x0'));var zipdir=require(_0xf66a('0x1'));var jsonpatch=require(_0xf66a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf66a('0x3'));var Mustache=require('mustache');var util=require(_0xf66a('0x4'));var path=require(_0xf66a('0x5'));var sox=require('sox');var csv=require(_0xf66a('0x6'));var ejs=require(_0xf66a('0x7'));var fs=require('fs');var fs_extra=require(_0xf66a('0x8'));var _=require(_0xf66a('0x9'));var squel=require(_0xf66a('0xa'));var crypto=require(_0xf66a('0xb'));var jsforce=require(_0xf66a('0xc'));var deskjs=require(_0xf66a('0xd'));var toCsv=require(_0xf66a('0x6'));var querystring=require(_0xf66a('0xe'));var Papa=require(_0xf66a('0xf'));var Redis=require(_0xf66a('0x10'));var authService=require(_0xf66a('0x11'));var qs=require(_0xf66a('0x12'));var as=require(_0xf66a('0x13'));var hardwareService=require(_0xf66a('0x14'));var logger=require(_0xf66a('0x15'))(_0xf66a('0x16'));var utils=require(_0xf66a('0x17'));var config=require(_0xf66a('0x18'));var licenseUtil=require(_0xf66a('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59f77,_0x13d15c){_0x13d15c=_0x13d15c||0xcc;return function(_0x3b9085){if(_0x3b9085){return _0x59f77[_0xf66a('0x1a')](_0x13d15c);}return _0x59f77['status'](_0x13d15c)['end']();};}function respondWithResult(_0x55b3fd,_0x14ca96){_0x14ca96=_0x14ca96||0xc8;return function(_0x2302f5){if(_0x2302f5){return _0x55b3fd[_0xf66a('0x1b')](_0x14ca96)[_0xf66a('0x1c')](_0x2302f5);}};}function respondWithFilteredResult(_0x3bdf17,_0x432989){return function(_0x1fb907){if(_0x1fb907){var _0x52047b=typeof _0x432989[_0xf66a('0x1d')]===_0xf66a('0x1e')&&typeof _0x432989[_0xf66a('0x1f')]===_0xf66a('0x1e');var _0xf552ce=_0x1fb907[_0xf66a('0x20')];var _0x3453df=_0x52047b?0x0:_0x432989[_0xf66a('0x1d')];var _0x3e777c=_0x52047b?_0x1fb907['count']:_0x432989[_0xf66a('0x1d')]+_0x432989[_0xf66a('0x1f')];var _0x458788;if(_0x3e777c>=_0xf552ce){_0x3e777c=_0xf552ce;_0x458788=0xc8;}else{_0x458788=0xce;}_0x3bdf17[_0xf66a('0x1b')](_0x458788);return _0x3bdf17[_0xf66a('0x21')]('Content-Range',_0x3453df+'-'+_0x3e777c+'/'+_0xf552ce)[_0xf66a('0x1c')](_0x1fb907);}return null;};}function patchUpdates(_0x44b106){return function(_0x40c7ae){try{jsonpatch[_0xf66a('0x22')](_0x40c7ae,_0x44b106,!![]);}catch(_0x392e92){return BPromise['reject'](_0x392e92);}return _0x40c7ae[_0xf66a('0x23')]();};}function saveUpdates(_0x283a1d,_0x143f08){return function(_0x5e9ac0){if(_0x5e9ac0){return _0x5e9ac0[_0xf66a('0x24')](_0x283a1d)[_0xf66a('0x25')](function(_0x4c16f1){return _0x4c16f1;});}return null;};}function removeEntity(_0x4d90b7,_0x5a4422){return function(_0x5098e0){if(_0x5098e0){return _0x5098e0[_0xf66a('0x26')]()[_0xf66a('0x25')](function(){_0x4d90b7[_0xf66a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38b2c4,_0x5c6fa3){return function(_0x2c91c3){if(!_0x2c91c3){_0x38b2c4[_0xf66a('0x1a')](0x194);}return _0x2c91c3;};}function handleError(_0x105567,_0x3cfb20){_0x3cfb20=_0x3cfb20||0x1f4;return function(_0x240891){logger['error'](_0x240891[_0xf66a('0x27')]);if(_0x240891[_0xf66a('0x28')]){delete _0x240891[_0xf66a('0x28')];}_0x105567[_0xf66a('0x1b')](_0x3cfb20)[_0xf66a('0x29')](_0x240891);};}exports['index']=function(_0x1d7db4,_0x5bc653){var _0x57f552={},_0x14388a={},_0x327e44={'count':0x0,'rows':[]};var _0xe04612=_[_0xf66a('0x2a')](db[_0xf66a('0x2b')][_0xf66a('0x2c')],function(_0x538f6f){return{'name':_0x538f6f[_0xf66a('0x2d')],'type':_0x538f6f[_0xf66a('0x2e')]['key']};});_0x14388a[_0xf66a('0x2f')]=_['map'](_0xe04612,'name');_0x14388a[_0xf66a('0x30')]=_[_0xf66a('0x31')](_0x1d7db4[_0xf66a('0x30')]);_0x14388a[_0xf66a('0x32')]=_['intersection'](_0x14388a[_0xf66a('0x2f')],_0x14388a[_0xf66a('0x30')]);_0x57f552[_0xf66a('0x33')]=_['intersection'](_0x14388a[_0xf66a('0x2f')],qs['fields'](_0x1d7db4[_0xf66a('0x30')][_0xf66a('0x34')]));_0x57f552[_0xf66a('0x33')]=_0x57f552['attributes'][_0xf66a('0x35')]?_0x57f552[_0xf66a('0x33')]:_0x14388a[_0xf66a('0x2f')];if(!_0x1d7db4[_0xf66a('0x30')][_0xf66a('0x36')]('nolimit')){_0x57f552[_0xf66a('0x1f')]=qs[_0xf66a('0x1f')](_0x1d7db4[_0xf66a('0x30')][_0xf66a('0x1f')]);_0x57f552[_0xf66a('0x1d')]=qs[_0xf66a('0x1d')](_0x1d7db4['query'][_0xf66a('0x1d')]);}_0x57f552[_0xf66a('0x37')]=qs[_0xf66a('0x38')](_0x1d7db4[_0xf66a('0x30')][_0xf66a('0x38')]);_0x57f552[_0xf66a('0x39')]=qs['filters'](_['pick'](_0x1d7db4[_0xf66a('0x30')],_0x14388a['filters']),_0xe04612);if(_0x1d7db4[_0xf66a('0x30')]['filter']){_0x57f552['where']=_[_0xf66a('0x3a')](_0x57f552[_0xf66a('0x39')],{'$or':_[_0xf66a('0x2a')](_0xe04612,function(_0x4d9b9b){if(_0x4d9b9b[_0xf66a('0x2e')]!=='VIRTUAL'){var _0x4a4c30={};_0x4a4c30[_0x4d9b9b['name']]={'$like':'%'+_0x1d7db4['query']['filter']+'%'};return _0x4a4c30;}})});}_0x57f552=_[_0xf66a('0x3a')]({},_0x57f552,_0x1d7db4[_0xf66a('0x3b')]);var _0x1f30e7={'where':_0x57f552[_0xf66a('0x39')]};return db[_0xf66a('0x2b')][_0xf66a('0x20')](_0x1f30e7)[_0xf66a('0x25')](function(_0x13f53d){_0x327e44[_0xf66a('0x20')]=_0x13f53d;if(_0x1d7db4[_0xf66a('0x30')][_0xf66a('0x3c')]){_0x57f552['include']=[{'all':!![]}];}return db[_0xf66a('0x2b')][_0xf66a('0x3d')](_0x57f552);})['then'](function(_0x126972){_0x327e44['rows']=_0x126972;return _0x327e44;})[_0xf66a('0x25')](respondWithFilteredResult(_0x5bc653,_0x57f552))[_0xf66a('0x3e')](handleError(_0x5bc653,null));};exports[_0xf66a('0x3f')]=function(_0x34fc7a,_0x4da3fc){var _0x160f4f={'raw':!![],'where':{'id':_0x34fc7a[_0xf66a('0x40')]['id']}},_0x328ab8={};_0x328ab8[_0xf66a('0x2f')]=_[_0xf66a('0x31')](db['VoiceTransferReport'][_0xf66a('0x2c')]);_0x328ab8[_0xf66a('0x30')]=_[_0xf66a('0x31')](_0x34fc7a[_0xf66a('0x30')]);_0x328ab8[_0xf66a('0x32')]=_[_0xf66a('0x41')](_0x328ab8[_0xf66a('0x2f')],_0x328ab8[_0xf66a('0x30')]);_0x160f4f[_0xf66a('0x33')]=_[_0xf66a('0x41')](_0x328ab8[_0xf66a('0x2f')],qs[_0xf66a('0x34')](_0x34fc7a[_0xf66a('0x30')]['fields']));_0x160f4f[_0xf66a('0x33')]=_0x160f4f[_0xf66a('0x33')][_0xf66a('0x35')]?_0x160f4f[_0xf66a('0x33')]:_0x328ab8[_0xf66a('0x2f')];if(_0x34fc7a[_0xf66a('0x30')]['includeAll']){_0x160f4f[_0xf66a('0x42')]=[{'all':!![]}];}_0x160f4f=_['merge']({},_0x160f4f,_0x34fc7a['options']);return db[_0xf66a('0x2b')][_0xf66a('0x43')](_0x160f4f)[_0xf66a('0x25')](handleEntityNotFound(_0x4da3fc,null))[_0xf66a('0x25')](respondWithResult(_0x4da3fc,null))['catch'](handleError(_0x4da3fc,null));};exports[_0xf66a('0x44')]=function(_0x446835,_0x44e2b0){return db[_0xf66a('0x2b')][_0xf66a('0x44')](_0x446835[_0xf66a('0x45')],{})[_0xf66a('0x25')](respondWithResult(_0x44e2b0,0xc9))['catch'](handleError(_0x44e2b0,null));};exports[_0xf66a('0x24')]=function(_0x301d78,_0x31c4cf){if(_0x301d78[_0xf66a('0x45')]['id']){delete _0x301d78[_0xf66a('0x45')]['id'];}return db[_0xf66a('0x2b')][_0xf66a('0x43')]({'where':{'id':_0x301d78[_0xf66a('0x40')]['id']}})[_0xf66a('0x25')](handleEntityNotFound(_0x31c4cf,null))[_0xf66a('0x25')](saveUpdates(_0x301d78[_0xf66a('0x45')],null))[_0xf66a('0x25')](respondWithResult(_0x31c4cf,null))[_0xf66a('0x3e')](handleError(_0x31c4cf,null));};exports[_0xf66a('0x26')]=function(_0x46531e,_0x29d672){return db[_0xf66a('0x2b')]['find']({'where':{'id':_0x46531e['params']['id']}})['then'](handleEntityNotFound(_0x29d672,null))['then'](removeEntity(_0x29d672,null))[_0xf66a('0x3e')](handleError(_0x29d672,null));};exports[_0xf66a('0x46')]=function(_0x34fb17,_0x117314){return db[_0xf66a('0x2b')][_0xf66a('0x46')]()[_0xf66a('0x25')](respondWithResult(_0x117314,null))[_0xf66a('0x3e')](handleError(_0x117314,null));}; \ No newline at end of file +var _0x9053=['fast-json-patch','request-promise','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','catch','create','body','find','describe','eml-format','rimraf','zip-dir'];(function(_0x15c618,_0x1cb4c6){var _0x536358=function(_0x45ecdf){while(--_0x45ecdf){_0x15c618['push'](_0x15c618['shift']());}};_0x536358(++_0x1cb4c6);}(_0x9053,0xde));var _0x3905=function(_0x56e4e7,_0x1db098){_0x56e4e7=_0x56e4e7-0x0;var _0x383618=_0x9053[_0x56e4e7];return _0x383618;};'use strict';var emlformat=require(_0x3905('0x0'));var rimraf=require(_0x3905('0x1'));var zipdir=require(_0x3905('0x2'));var jsonpatch=require(_0x3905('0x3'));var rp=require(_0x3905('0x4'));var moment=require(_0x3905('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3905('0x6'));var util=require(_0x3905('0x7'));var path=require(_0x3905('0x8'));var sox=require('sox');var csv=require(_0x3905('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3905('0xa'));var squel=require(_0x3905('0xb'));var crypto=require(_0x3905('0xc'));var jsforce=require(_0x3905('0xd'));var deskjs=require(_0x3905('0xe'));var toCsv=require(_0x3905('0x9'));var querystring=require(_0x3905('0xf'));var Papa=require(_0x3905('0x10'));var Redis=require(_0x3905('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3905('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3905('0x13'));var logger=require(_0x3905('0x14'))(_0x3905('0x15'));var utils=require('../../config/utils');var config=require(_0x3905('0x16'));var licenseUtil=require(_0x3905('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x191655,_0x47a440){_0x47a440=_0x47a440||0xcc;return function(_0x41b647){if(_0x41b647){return _0x191655[_0x3905('0x18')](_0x47a440);}return _0x191655['status'](_0x47a440)[_0x3905('0x19')]();};}function respondWithResult(_0x4100d5,_0x2d8a5e){_0x2d8a5e=_0x2d8a5e||0xc8;return function(_0xc94152){if(_0xc94152){return _0x4100d5[_0x3905('0x1a')](_0x2d8a5e)[_0x3905('0x1b')](_0xc94152);}};}function respondWithFilteredResult(_0x2867d3,_0x13d2c4){return function(_0x3fb7bc){if(_0x3fb7bc){var _0x24c256=typeof _0x13d2c4[_0x3905('0x1c')]===_0x3905('0x1d')&&typeof _0x13d2c4[_0x3905('0x1e')]===_0x3905('0x1d');var _0x360dc7=_0x3fb7bc[_0x3905('0x1f')];var _0x55dfa5=_0x24c256?0x0:_0x13d2c4[_0x3905('0x1c')];var _0x5baf3e=_0x24c256?_0x3fb7bc['count']:_0x13d2c4['offset']+_0x13d2c4[_0x3905('0x1e')];var _0x1059a9;if(_0x5baf3e>=_0x360dc7){_0x5baf3e=_0x360dc7;_0x1059a9=0xc8;}else{_0x1059a9=0xce;}_0x2867d3[_0x3905('0x1a')](_0x1059a9);return _0x2867d3[_0x3905('0x20')]('Content-Range',_0x55dfa5+'-'+_0x5baf3e+'/'+_0x360dc7)[_0x3905('0x1b')](_0x3fb7bc);}return null;};}function patchUpdates(_0x2c86a5){return function(_0x456d65){try{jsonpatch[_0x3905('0x21')](_0x456d65,_0x2c86a5,!![]);}catch(_0x242ad8){return BPromise[_0x3905('0x22')](_0x242ad8);}return _0x456d65[_0x3905('0x23')]();};}function saveUpdates(_0x397343,_0x50a091){return function(_0x49f2eb){if(_0x49f2eb){return _0x49f2eb[_0x3905('0x24')](_0x397343)[_0x3905('0x25')](function(_0x56c52d){return _0x56c52d;});}return null;};}function removeEntity(_0xf20eac,_0x13fa13){return function(_0x2754a3){if(_0x2754a3){return _0x2754a3[_0x3905('0x26')]()['then'](function(){_0xf20eac[_0x3905('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cb816,_0x3b2555){return function(_0x41472e){if(!_0x41472e){_0x2cb816[_0x3905('0x18')](0x194);}return _0x41472e;};}function handleError(_0x4b1649,_0x1d11f3){_0x1d11f3=_0x1d11f3||0x1f4;return function(_0x456569){logger[_0x3905('0x27')](_0x456569[_0x3905('0x28')]);if(_0x456569[_0x3905('0x29')]){delete _0x456569['name'];}_0x4b1649[_0x3905('0x1a')](_0x1d11f3)['send'](_0x456569);};}exports[_0x3905('0x2a')]=function(_0x138ac9,_0x4a98a1){var _0x5224c6={},_0x443902={},_0x1fffff={'count':0x0,'rows':[]};var _0x1a06e4=_[_0x3905('0x2b')](db[_0x3905('0x2c')][_0x3905('0x2d')],function(_0x3e7c69){return{'name':_0x3e7c69[_0x3905('0x2e')],'type':_0x3e7c69[_0x3905('0x2f')][_0x3905('0x30')]};});_0x443902[_0x3905('0x31')]=_[_0x3905('0x2b')](_0x1a06e4,_0x3905('0x29'));_0x443902['query']=_[_0x3905('0x32')](_0x138ac9[_0x3905('0x33')]);_0x443902[_0x3905('0x34')]=_['intersection'](_0x443902[_0x3905('0x31')],_0x443902['query']);_0x5224c6[_0x3905('0x35')]=_[_0x3905('0x36')](_0x443902[_0x3905('0x31')],qs['fields'](_0x138ac9[_0x3905('0x33')][_0x3905('0x37')]));_0x5224c6['attributes']=_0x5224c6[_0x3905('0x35')][_0x3905('0x38')]?_0x5224c6[_0x3905('0x35')]:_0x443902[_0x3905('0x31')];if(!_0x138ac9[_0x3905('0x33')][_0x3905('0x39')]('nolimit')){_0x5224c6[_0x3905('0x1e')]=qs['limit'](_0x138ac9['query'][_0x3905('0x1e')]);_0x5224c6[_0x3905('0x1c')]=qs['offset'](_0x138ac9[_0x3905('0x33')][_0x3905('0x1c')]);}_0x5224c6[_0x3905('0x3a')]=qs[_0x3905('0x3b')](_0x138ac9[_0x3905('0x33')][_0x3905('0x3b')]);_0x5224c6[_0x3905('0x3c')]=qs[_0x3905('0x34')](_[_0x3905('0x3d')](_0x138ac9[_0x3905('0x33')],_0x443902[_0x3905('0x34')]),_0x1a06e4);if(_0x138ac9['query']['filter']){_0x5224c6[_0x3905('0x3c')]=_[_0x3905('0x3e')](_0x5224c6[_0x3905('0x3c')],{'$or':_[_0x3905('0x2b')](_0x1a06e4,function(_0x350593){if(_0x350593[_0x3905('0x2f')]!==_0x3905('0x3f')){var _0x1c59ed={};_0x1c59ed[_0x350593['name']]={'$like':'%'+_0x138ac9['query']['filter']+'%'};return _0x1c59ed;}})});}_0x5224c6=_[_0x3905('0x3e')]({},_0x5224c6,_0x138ac9[_0x3905('0x40')]);var _0xb00d0b={'where':_0x5224c6['where']};return db[_0x3905('0x2c')][_0x3905('0x1f')](_0xb00d0b)[_0x3905('0x25')](function(_0x17d8da){_0x1fffff[_0x3905('0x1f')]=_0x17d8da;if(_0x138ac9[_0x3905('0x33')][_0x3905('0x41')]){_0x5224c6[_0x3905('0x42')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x3905('0x43')](_0x5224c6);})[_0x3905('0x25')](function(_0x1af448){_0x1fffff[_0x3905('0x44')]=_0x1af448;return _0x1fffff;})[_0x3905('0x25')](respondWithFilteredResult(_0x4a98a1,_0x5224c6))['catch'](handleError(_0x4a98a1,null));};exports['show']=function(_0x1d5b2f,_0x3b9f08){var _0x2f617a={'raw':!![],'where':{'id':_0x1d5b2f[_0x3905('0x45')]['id']}},_0x46d938={};_0x46d938[_0x3905('0x31')]=_[_0x3905('0x32')](db['VoiceTransferReport'][_0x3905('0x2d')]);_0x46d938[_0x3905('0x33')]=_['keys'](_0x1d5b2f['query']);_0x46d938[_0x3905('0x34')]=_[_0x3905('0x36')](_0x46d938[_0x3905('0x31')],_0x46d938[_0x3905('0x33')]);_0x2f617a[_0x3905('0x35')]=_[_0x3905('0x36')](_0x46d938[_0x3905('0x31')],qs[_0x3905('0x37')](_0x1d5b2f[_0x3905('0x33')][_0x3905('0x37')]));_0x2f617a[_0x3905('0x35')]=_0x2f617a[_0x3905('0x35')][_0x3905('0x38')]?_0x2f617a[_0x3905('0x35')]:_0x46d938[_0x3905('0x31')];if(_0x1d5b2f['query'][_0x3905('0x41')]){_0x2f617a[_0x3905('0x42')]=[{'all':!![]}];}_0x2f617a=_[_0x3905('0x3e')]({},_0x2f617a,_0x1d5b2f['options']);return db[_0x3905('0x2c')]['find'](_0x2f617a)[_0x3905('0x25')](handleEntityNotFound(_0x3b9f08,null))['then'](respondWithResult(_0x3b9f08,null))[_0x3905('0x46')](handleError(_0x3b9f08,null));};exports[_0x3905('0x47')]=function(_0x3e096a,_0x3c98e0){return db[_0x3905('0x2c')]['create'](_0x3e096a['body'],{})[_0x3905('0x25')](respondWithResult(_0x3c98e0,0xc9))[_0x3905('0x46')](handleError(_0x3c98e0,null));};exports[_0x3905('0x24')]=function(_0x3fe1b6,_0x58a32a){if(_0x3fe1b6[_0x3905('0x48')]['id']){delete _0x3fe1b6['body']['id'];}return db[_0x3905('0x2c')][_0x3905('0x49')]({'where':{'id':_0x3fe1b6[_0x3905('0x45')]['id']}})[_0x3905('0x25')](handleEntityNotFound(_0x58a32a,null))['then'](saveUpdates(_0x3fe1b6[_0x3905('0x48')],null))[_0x3905('0x25')](respondWithResult(_0x58a32a,null))[_0x3905('0x46')](handleError(_0x58a32a,null));};exports[_0x3905('0x26')]=function(_0x2eb7aa,_0x379e0c){return db[_0x3905('0x2c')]['find']({'where':{'id':_0x2eb7aa[_0x3905('0x45')]['id']}})[_0x3905('0x25')](handleEntityNotFound(_0x379e0c,null))[_0x3905('0x25')](removeEntity(_0x379e0c,null))[_0x3905('0x46')](handleError(_0x379e0c,null));};exports[_0x3905('0x4a')]=function(_0x28a18a,_0x3f5b1b){return db['VoiceTransferReport'][_0x3905('0x4a')]()[_0x3905('0x25')](respondWithResult(_0x3f5b1b,null))['catch'](handleError(_0x3f5b1b,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index f022bb8..4feedd9 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 _0x5772=['define','VoiceTransferReport','lodash','../../config/logger','moment','bluebird','path','../../config/environment','exports'];(function(_0x3ddf16,_0x76f985){var _0x353de4=function(_0x49c878){while(--_0x49c878){_0x3ddf16['push'](_0x3ddf16['shift']());}};_0x353de4(++_0x76f985);}(_0x5772,0x107));var _0x2577=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0x5772[_0x3e112d];return _0x531c31;};'use strict';var _=require(_0x2577('0x0'));var util=require('util');var logger=require(_0x2577('0x1'))('api');var moment=require(_0x2577('0x2'));var BPromise=require(_0x2577('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2577('0x4'));var rimraf=require('rimraf');var config=require(_0x2577('0x5'));var attributes=require('./voiceTransferReport.attributes');module[_0x2577('0x6')]=function(_0x53fe7f,_0x102313){return _0x53fe7f[_0x2577('0x7')](_0x2577('0x8'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6889=['util','../../config/logger','bluebird','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash'];(function(_0x1d8c09,_0x28e4c8){var _0x2421c6=function(_0x39a0ef){while(--_0x39a0ef){_0x1d8c09['push'](_0x1d8c09['shift']());}};_0x2421c6(++_0x28e4c8);}(_0x6889,0xef));var _0x9688=function(_0xcf5436,_0x4632c3){_0xcf5436=_0xcf5436-0x0;var _0xc4f5c8=_0x6889[_0xcf5436];return _0xc4f5c8;};'use strict';var _=require(_0x9688('0x0'));var util=require(_0x9688('0x1'));var logger=require(_0x9688('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9688('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9688('0x4'));var rimraf=require(_0x9688('0x5'));var config=require(_0x9688('0x6'));var attributes=require(_0x9688('0x7'));module[_0x9688('0x8')]=function(_0x3b2064,_0x835edb){return _0x3b2064[_0x9688('0x9')](_0x9688('0xa'),attributes,{'tableName':_0x9688('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 6812e5b..a891e8c 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 _0xb9a8=['bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceTransferReport','options','raw','then','util','moment'];(function(_0x2f227c,_0x360c3a){var _0x5032bc=function(_0x824bb){while(--_0x824bb){_0x2f227c['push'](_0x2f227c['shift']());}};_0x5032bc(++_0x360c3a);}(_0xb9a8,0x12a));var _0x8b9a=function(_0x1a856a,_0x48b14e){_0x1a856a=_0x1a856a-0x0;var _0x56edf4=_0xb9a8[_0x1a856a];return _0x56edf4;};'use strict';var _=require('lodash');var util=require(_0x8b9a('0x0'));var moment=require(_0x8b9a('0x1'));var BPromise=require(_0x8b9a('0x2'));var rs=require(_0x8b9a('0x3'));var fs=require('fs');var Redis=require(_0x8b9a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8b9a('0x5'))(_0x8b9a('0x6'));var config=require(_0x8b9a('0x7'));var jayson=require(_0x8b9a('0x8'));var client=jayson[_0x8b9a('0x9')][_0x8b9a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bdd97,_0x2ac442,_0x528c42){return new BPromise(function(_0x30be12,_0xb50292){return client['request'](_0x3bdd97,_0x528c42)['then'](function(_0x5133e3){logger[_0x8b9a('0xb')](_0x8b9a('0xc'),_0x2ac442,_0x8b9a('0xd'));logger[_0x8b9a('0xe')](_0x8b9a('0xf'),_0x2ac442,_0x8b9a('0xd'),JSON[_0x8b9a('0x10')](_0x5133e3));if(_0x5133e3[_0x8b9a('0x11')]){if(_0x5133e3[_0x8b9a('0x11')][_0x8b9a('0x12')]===0x1f4){logger[_0x8b9a('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x2ac442,_0x5133e3[_0x8b9a('0x11')][_0x8b9a('0x13')]);return _0xb50292(_0x5133e3[_0x8b9a('0x11')][_0x8b9a('0x13')]);}logger[_0x8b9a('0x11')](_0x8b9a('0xc'),_0x2ac442,_0x5133e3['error'][_0x8b9a('0x13')]);return _0x30be12(_0x5133e3[_0x8b9a('0x11')][_0x8b9a('0x13')]);}else{logger[_0x8b9a('0xb')](_0x8b9a('0xc'),_0x2ac442,_0x8b9a('0xd'));_0x30be12(_0x5133e3['result'][_0x8b9a('0x13')]);}})[_0x8b9a('0x14')](function(_0x4c124e){logger[_0x8b9a('0x11')](_0x8b9a('0xc'),_0x2ac442,_0x4c124e);_0xb50292(_0x4c124e);});});}exports[_0x8b9a('0x15')]=function(_0x38ac60){var _0x56cb17=this;return new Promise(function(_0x5b94a9,_0x27fefc){return db['VoiceTransferReport']['create'](_0x38ac60['body'],{'raw':_0x38ac60[_0x8b9a('0x16')]?_0x38ac60[_0x8b9a('0x16')][_0x8b9a('0x17')]===undefined?!![]:![]:!![]})[_0x8b9a('0x18')](function(_0x3b4b8b){logger['info'](_0x8b9a('0x15'),_0x38ac60);logger['debug']('CreateVoiceTransferReport',_0x38ac60,JSON['stringify'](_0x3b4b8b));_0x5b94a9(_0x3b4b8b);})[_0x8b9a('0x14')](function(_0x2a5871){logger[_0x8b9a('0x11')]('CreateVoiceTransferReport',_0x2a5871[_0x8b9a('0x13')],_0x38ac60);_0x27fefc(_0x56cb17[_0x8b9a('0x11')](0x1f4,_0x2a5871[_0x8b9a('0x13')]));});});}; \ No newline at end of file +var _0x6463=['request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateVoiceTransferReport','VoiceTransferReport','body','options','raw','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceTransferReport,\x20%s,\x20%s'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x6463,0xe8));var _0x3646=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6463[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x3646('0x0'));var moment=require(_0x3646('0x1'));var BPromise=require(_0x3646('0x2'));var rs=require(_0x3646('0x3'));var fs=require('fs');var Redis=require(_0x3646('0x4'));var db=require(_0x3646('0x5'))['db'];var utils=require(_0x3646('0x6'));var logger=require(_0x3646('0x7'))(_0x3646('0x8'));var config=require(_0x3646('0x9'));var jayson=require(_0x3646('0xa'));var client=jayson[_0x3646('0xb')][_0x3646('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21a549,_0x5b2224,_0xc1a9d4){return new BPromise(function(_0x548dad,_0x4c14f3){return client[_0x3646('0xd')](_0x21a549,_0xc1a9d4)[_0x3646('0xe')](function(_0xda467a){logger['info'](_0x3646('0xf'),_0x5b2224,_0x3646('0x10'));logger[_0x3646('0x11')](_0x3646('0x12'),_0x5b2224,_0x3646('0x10'),JSON[_0x3646('0x13')](_0xda467a));if(_0xda467a[_0x3646('0x14')]){if(_0xda467a[_0x3646('0x14')][_0x3646('0x15')]===0x1f4){logger[_0x3646('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x5b2224,_0xda467a[_0x3646('0x14')][_0x3646('0x16')]);return _0x4c14f3(_0xda467a['error'][_0x3646('0x16')]);}logger['error'](_0x3646('0xf'),_0x5b2224,_0xda467a[_0x3646('0x14')][_0x3646('0x16')]);return _0x548dad(_0xda467a['error']['message']);}else{logger[_0x3646('0x17')](_0x3646('0xf'),_0x5b2224,_0x3646('0x10'));_0x548dad(_0xda467a[_0x3646('0x18')][_0x3646('0x16')]);}})['catch'](function(_0x63aade){logger['error'](_0x3646('0xf'),_0x5b2224,_0x63aade);_0x4c14f3(_0x63aade);});});}exports[_0x3646('0x19')]=function(_0x396221){var _0x3aff47=this;return new Promise(function(_0x5481e2,_0x986c7c){return db[_0x3646('0x1a')]['create'](_0x396221[_0x3646('0x1b')],{'raw':_0x396221['options']?_0x396221[_0x3646('0x1c')][_0x3646('0x1d')]===undefined?!![]:![]:!![]})[_0x3646('0xe')](function(_0x3265f1){logger[_0x3646('0x17')]('CreateVoiceTransferReport',_0x396221);logger[_0x3646('0x11')](_0x3646('0x19'),_0x396221,JSON[_0x3646('0x13')](_0x3265f1));_0x5481e2(_0x3265f1);})[_0x3646('0x1e')](function(_0xeee92){logger[_0x3646('0x14')]('CreateVoiceTransferReport',_0xeee92[_0x3646('0x16')],_0x396221);_0x986c7c(_0x3aff47[_0x3646('0x14')](0x1f4,_0xeee92[_0x3646('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 55ec8ae..909f8fb 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(_0x56844b,_0x4f0a52){var _0x567d29=function(_0x486d7d){while(--_0x486d7d){_0x56844b['push'](_0x56844b['shift']());}};_0x567d29(++_0x4f0a52);}(_0xdace,0xc5));var _0xedac=function(_0x277107,_0x3420dc){_0x277107=_0x277107-0x0;var _0x1da046=_0xdace[_0x277107];return _0x1da046;};'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 _0xb4e6=['unhold','calls','/transfer','exports','express','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','/hold','hold','/unhold'];(function(_0x375bd5,_0x43ff4d){var _0x3ab484=function(_0x14ba99){while(--_0x14ba99){_0x375bd5['push'](_0x375bd5['shift']());}};_0x3ab484(++_0x43ff4d);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x1ab0e6,_0x17ba8d){_0x1ab0e6=_0x1ab0e6-0x0;var _0x248815=_0xb4e6[_0x1ab0e6];return _0x248815;};'use strict';var express=require(_0x6b4e('0x0'));var router=express['Router']();var auth=require(_0x6b4e('0x1'));var controller=require(_0x6b4e('0x2'));router[_0x6b4e('0x3')](_0x6b4e('0x4'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0x7')]);router['post'](_0x6b4e('0x8'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller['hangup']);router[_0x6b4e('0x3')]('/answer',auth['isAuthenticated'](),auth[_0x6b4e('0x6')](),controller['answer']);router['post'](_0x6b4e('0x9'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0xa')]);router[_0x6b4e('0x3')](_0x6b4e('0xb'),auth[_0x6b4e('0x5')](),auth['isWebrtcLicence'](),controller[_0x6b4e('0xc')]);router[_0x6b4e('0x3')]('/calls',auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0xd')]);router[_0x6b4e('0x3')](_0x6b4e('0xe'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller['transfer']);module[_0x6b4e('0xf')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index a7e638a..755ef86 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 _0xa74f=['user:%s','webbar:answer','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold','unhold\x20fired:','calls','calls\x20fired:','VoiceChannels','filter','rows','conference\x20fired:','webbar:conference','transfer','transferNumber','transfer\x20executed!','../../mysqldb','bluebird','jayson/promise','client','http','webbarapi','defaults','redis','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','emit','handleError:','error','stack','name','status','send','message','catch','User','agent','then','all','sessionId','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','length','json','userId','callerId','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','entityFound:','format','webbar:hangup','hangup\x20executed!','answer'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa74f,0x9a));var _0xfa74=function(_0x356e8d,_0x24c719){_0x356e8d=_0x356e8d-0x0;var _0x39e65a=_0xa74f[_0x356e8d];return _0x39e65a;};'use strict';var path=require('path');var fs=require('fs');var _=require('lodash');var db=require(_0xfa74('0x0'))['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0xfa74('0x1'));var jayson=require(_0xfa74('0x2'));var amiClient=jayson[_0xfa74('0x3')][_0xfa74('0x4')]({'port':0x232a});var logger=require('../../config/logger')(_0xfa74('0x5'));var Redis=require('ioredis');config['redis']=_[_0xfa74('0x6')](config[_0xfa74('0x7')],{'host':_0xfa74('0x8'),'port':0x18eb});var io=require(_0xfa74('0x9'))(new Redis(config[_0xfa74('0x7')]));var Schema=require(_0xfa74('0xa'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0xfa74('0xb')]},'callNumber':{'type':_0xfa74('0xc'),'required':[!![],_0xfa74('0xd')]},'callerId':{'type':_0xfa74('0xc')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xfa74('0xe'),'required':[!![],_0xfa74('0xb')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xfa74('0xe'),'required':[!![],_0xfa74('0xb')]},'sessionId':{'type':_0xfa74('0xc'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xfa74('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xfa74('0xc'),'required':[!![],_0xfa74('0xf')]},'transferNumber':{'type':_0xfa74('0xc'),'required':[!![],_0xfa74('0x10')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xfa74('0xb')]},'sessionId':{'type':_0xfa74('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xfa74('0xe'),'required':[!![],_0xfa74('0xb')]},'sessionId':{'type':_0xfa74('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xfa74('0xb')]}});var conferenceValidation=new Schema({'userId':{'type':_0xfa74('0xe'),'required':[!![],_0xfa74('0xb')]}});function emit(_0x1f1de0,_0x3867f8,_0x40af70){logger[_0xfa74('0x11')](_0x1f1de0,_0x3867f8,JSON['stringify'](_0x40af70));io['to'](_0x1f1de0)[_0xfa74('0x12')](_0x3867f8,_0x40af70);}function handleError(_0xe0e33d){return function(_0x51dda1){console['log'](_0xfa74('0x13'),_0x51dda1,_0x51dda1 instanceof RangeError);logger[_0xfa74('0x14')](_0x51dda1[_0xfa74('0x15')]);if(_0x51dda1 instanceof RangeError){if(_0x51dda1['name']){delete _0x51dda1[_0xfa74('0x16')];}_0xe0e33d[_0xfa74('0x17')](0x194)[_0xfa74('0x18')](_0x51dda1);}else{if(_0x51dda1['name']){delete _0x51dda1[_0xfa74('0x16')];}_0xe0e33d[_0xfa74('0x17')](0x1f4)[_0xfa74('0x18')](_0x51dda1);}};}function checkError(){return function(_0x4a5ee4){if(!_0x4a5ee4){throw new RangeError('NotFound');}return _0x4a5ee4;};}function respondWithRpcPromise(_0x100851,_0x2257a0){return new BPromise(function(_0x9932db,_0xeaaa19){var _0x1a453d=amiClient;return _0x1a453d['request'](_0x100851,_0x2257a0)['then'](function(_0x3721bf){if(_0x3721bf['error']){if(_0x3721bf['error']['code']===0x1f4){return _0xeaaa19(_0x3721bf[_0xfa74('0x14')][_0xfa74('0x19')]);}return _0x9932db(_0x3721bf[_0xfa74('0x14')]['message']);}else{_0x9932db(_0x3721bf['result']);}})[_0xfa74('0x1a')](function(_0xeb6c11){_0xeaaa19(_0xeb6c11);});});}function getAgent(_0x5ed1c8){return db[_0xfa74('0x1b')]['findOne']({'where':{'id':_0x5ed1c8,'role':_0xfa74('0x1c')}})[_0xfa74('0x1d')](checkError());}function getAgentCheckSession(_0x55d8e4,_0x298388){return new BPromise(function(_0x1130de,_0x122415){var _0x218c86=respondWithRpcPromise('VoiceChannels');var _0xd9c55d=getAgent(_0x55d8e4);Promise[_0xfa74('0x1e')]([_0x218c86,_0xd9c55d])[_0xfa74('0x1d')](function(_0x57d90e){var _0x4d4bed=_0x57d90e[0x0];var _0x1322a4=_0x57d90e[0x1];var _0x8b706e=_['filter'](_0x4d4bed['rows'],function(_0x343466){return _0x343466['UserId']==_0x1322a4['id']&&_0x343466[_0xfa74('0x1f')]==_0x298388;});if(_0x8b706e['length']==0x1){_0x1130de(_0x1322a4);}else{_0x122415(new RangeError(_0xfa74('0x20')+_0x298388+_0xfa74('0x21')));}});});}exports[_0xfa74('0x22')]=function(_0xdd93e5,_0x4c506f){logger[_0xfa74('0x11')](_0xfa74('0x23'),_0xdd93e5[_0xfa74('0x24')]);var _0x16f9dc=originateValidation[_0xfa74('0xa')](_0xdd93e5[_0xfa74('0x24')]);if(_0x16f9dc[_0xfa74('0x25')]>0x0){return _0x4c506f['status'](0x190)[_0xfa74('0x26')](_0x16f9dc);}var _0x5a9f43=_0xdd93e5[_0xfa74('0x24')][_0xfa74('0x27')];var _0xcc5e32=_0xdd93e5[_0xfa74('0x24')]['callNumber'];var _0x5055d3=_0xdd93e5[_0xfa74('0x24')][_0xfa74('0x28')];var _0x44b725=_0xdd93e5[_0xfa74('0x24')]['callbackUrl'];return getAgent(_0x5a9f43)[_0xfa74('0x1d')](function(_0x231698){logger['info']('entityFound:',_0x231698['name']);emit(util['format']('user:%s',_0x231698[_0xfa74('0x16')]),_0xfa74('0x29'),{'callNumber':_0xcc5e32,'callerId':_0x5055d3,'callbackUrl':_0x44b725});return _0x4c506f[_0xfa74('0x17')](0xc8)[_0xfa74('0x26')]({'error':![],'message':_0xfa74('0x2a')});})[_0xfa74('0x1a')](handleError(_0x4c506f));};exports[_0xfa74('0x2b')]=function(_0x13475a,_0x1a2d52){logger['info'](_0xfa74('0x2c'),_0x13475a[_0xfa74('0x24')]);var _0x430339=hangupValidation[_0xfa74('0xa')](_0x13475a[_0xfa74('0x24')]);if(_0x430339[_0xfa74('0x25')]>0x0){return _0x1a2d52['status'](0x190)[_0xfa74('0x26')](_0x430339);}var _0x1f0806=_0x13475a[_0xfa74('0x24')][_0xfa74('0x27')];var _0x5853d4=_0x13475a[_0xfa74('0x24')][_0xfa74('0x1f')];return getAgent(_0x1f0806)[_0xfa74('0x1d')](function(_0x35f252){logger['info'](_0xfa74('0x2d'),_0x35f252[_0xfa74('0x16')]);emit(util[_0xfa74('0x2e')]('user:%s',_0x35f252['name']),_0xfa74('0x2f'),{'sessionId':_0x5853d4});return _0x1a2d52[_0xfa74('0x17')](0xc8)[_0xfa74('0x26')]({'error':![],'message':_0xfa74('0x30')});})['catch'](handleError(_0x1a2d52));};exports[_0xfa74('0x31')]=function(_0x171923,_0x54e66d){logger['info']('answer\x20fired:',_0x171923['body']);var _0x95c891=answerValidation[_0xfa74('0xa')](_0x171923[_0xfa74('0x24')]);if(_0x95c891[_0xfa74('0x25')]>0x0){return _0x54e66d[_0xfa74('0x17')](0x190)[_0xfa74('0x26')](_0x95c891);}var _0x7735c5=_0x171923['body'][_0xfa74('0x27')];var _0x3938c1=_0x171923[_0xfa74('0x24')][_0xfa74('0x1f')];return getAgent(_0x7735c5)[_0xfa74('0x1d')](function(_0x4af7d4){logger[_0xfa74('0x11')](_0xfa74('0x2d'),_0x4af7d4[_0xfa74('0x16')]);emit(util[_0xfa74('0x2e')](_0xfa74('0x32'),_0x4af7d4[_0xfa74('0x16')]),_0xfa74('0x33'),{'sessionId':_0x3938c1});return _0x54e66d[_0xfa74('0x17')](0xc8)[_0xfa74('0x26')]({'error':![],'message':_0xfa74('0x34')});})['catch'](handleError(_0x54e66d));};exports[_0xfa74('0x35')]=function(_0x4ebb67,_0xb7db3){logger[_0xfa74('0x11')](_0xfa74('0x36'),_0x4ebb67[_0xfa74('0x24')]);var _0x4911a5=holdValidation[_0xfa74('0xa')](_0x4ebb67[_0xfa74('0x24')]);if(_0x4911a5['length']>0x0){return _0xb7db3[_0xfa74('0x17')](0x190)[_0xfa74('0x26')](_0x4911a5);}var _0x5cbb70=_0x4ebb67[_0xfa74('0x24')][_0xfa74('0x27')];var _0x26d239=_0x4ebb67[_0xfa74('0x24')][_0xfa74('0x1f')];return getAgent(_0x5cbb70)['then'](function(_0x54e06c){logger[_0xfa74('0x11')](_0xfa74('0x2d'),_0x54e06c['name']);emit(util[_0xfa74('0x2e')](_0xfa74('0x32'),_0x54e06c[_0xfa74('0x16')]),'webbar:hold',{'sessionId':_0x26d239});return _0xb7db3['status'](0xc8)[_0xfa74('0x26')]({'error':![],'message':_0xfa74('0x37')});})[_0xfa74('0x1a')](handleError(_0xb7db3));};exports[_0xfa74('0x38')]=function(_0x36508a,_0x3cb23d){logger[_0xfa74('0x11')](_0xfa74('0x39'),_0x36508a['body']);var _0x214994=unholdValidation[_0xfa74('0xa')](_0x36508a[_0xfa74('0x24')]);if(_0x214994[_0xfa74('0x25')]>0x0){return _0x3cb23d['status'](0x190)['json'](_0x214994);}var _0x3146de=_0x36508a['body'][_0xfa74('0x27')];var _0x221dc7=_0x36508a[_0xfa74('0x24')][_0xfa74('0x1f')];return getAgent(_0x3146de)[_0xfa74('0x1d')](function(_0x144c80){logger[_0xfa74('0x11')]('entityFound:',_0x144c80[_0xfa74('0x16')]);emit(util['format'](_0xfa74('0x32'),_0x144c80['name']),'webbar:unhold',{'sessionId':_0x221dc7});return _0x3cb23d[_0xfa74('0x17')](0xc8)[_0xfa74('0x26')]({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0x3cb23d));};exports[_0xfa74('0x3a')]=function(_0x1ab715,_0x8afe72){logger[_0xfa74('0x11')](_0xfa74('0x3b'),_0x8afe72[_0xfa74('0x24')]);var _0x1198f3=callsValidation[_0xfa74('0xa')](_0x1ab715[_0xfa74('0x24')]);if(_0x1198f3[_0xfa74('0x25')]>0x0){return _0x8afe72['status'](0x190)[_0xfa74('0x26')](_0x1198f3);}var _0xc89005=_0x1ab715['body']['userId'];var _0x3d88dc=respondWithRpcPromise(_0xfa74('0x3c'));var _0x99f568=getAgent(_0xc89005);return Promise[_0xfa74('0x1e')]([_0x3d88dc,_0x99f568])[_0xfa74('0x1d')](function(_0x5475f1){var _0x36cfc6=_0x5475f1[0x0];var _0x4d6235=_0x5475f1[0x1];var _0x26b398=_[_0xfa74('0x3d')](_0x36cfc6[_0xfa74('0x3e')],function(_0x480295){return _0x480295['UserId']==_0x4d6235['id'];});return _0x8afe72[_0xfa74('0x17')](0xc8)[_0xfa74('0x26')]({'count':_0x26b398[_0xfa74('0x25')],'rows':_0x26b398});})[_0xfa74('0x1a')](handleError(_0x8afe72));};exports['conference']=function(_0xe87727,_0x2f5c31){logger['info'](_0xfa74('0x3f'),_0xe87727[_0xfa74('0x24')]);var _0x1861af=conferenceValidation[_0xfa74('0xa')](_0xe87727['body']);if(_0x1861af[_0xfa74('0x25')]>0x0){return _0x2f5c31['status'](0x190)[_0xfa74('0x26')](_0x1861af);}var _0x3ceb9d=_0xe87727[_0xfa74('0x24')][_0xfa74('0x27')];return getAgent(_0x3ceb9d)[_0xfa74('0x1d')](function(_0x6a3790){logger[_0xfa74('0x11')](_0xfa74('0x2d'),_0x6a3790[_0xfa74('0x16')]);emit(util[_0xfa74('0x2e')](_0xfa74('0x32'),_0x6a3790[_0xfa74('0x16')]),_0xfa74('0x40'));return _0x2f5c31[_0xfa74('0x17')](0xc8)[_0xfa74('0x26')]({'error':![],'message':'conference\x20executed!'});})[_0xfa74('0x1a')](handleError(_0x2f5c31));};exports[_0xfa74('0x41')]=function(_0x5035dd,_0x57a923){logger[_0xfa74('0x11')]('transfer\x20fired:',_0x5035dd[_0xfa74('0x24')]);var _0x2e8174=transferValidation[_0xfa74('0xa')](_0x5035dd['body']);if(_0x2e8174[_0xfa74('0x25')]>0x0){return _0x57a923['status'](0x190)['json'](_0x2e8174);}var _0x1856ea=_0x5035dd[_0xfa74('0x24')][_0xfa74('0x27')];var _0x414e31=_0x5035dd[_0xfa74('0x24')][_0xfa74('0x1f')];var _0x70120d=_0x5035dd[_0xfa74('0x24')][_0xfa74('0x42')];return getAgent(_0x1856ea)[_0xfa74('0x1d')](function(_0x2588bb){logger['info'](_0xfa74('0x2d'),_0x2588bb['name']);emit(util[_0xfa74('0x2e')](_0xfa74('0x32'),_0x2588bb[_0xfa74('0x16')]),'webbar:transfer',{'sessionId':_0x414e31,'transferNumber':_0x70120d});return _0x57a923[_0xfa74('0x17')](0xc8)[_0xfa74('0x26')]({'error':![],'message':_0xfa74('0x43')});})['catch'](handleError(_0x57a923));}; \ No newline at end of file +var _0xc36d=['all','rows','sessionId','length','sessionId\x20','originate','originate\x20fired:','body','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','json','originate\x20executed!','hangup','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','filter','UserId','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','client','http','webbarapi','ioredis','redis','defaults','socket.io-emitter','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','info','stringify','log','handleError:','error','stack','name','status','NotFound','request','then','code','result','catch','User','findOne','agent','VoiceChannels'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc36d,0x7d));var _0xdc36=function(_0x5534fe,_0x43c22e){_0x5534fe=_0x5534fe-0x0;var _0x3d1dc2=_0xc36d[_0x5534fe];return _0x3d1dc2;};'use strict';var path=require(_0xdc36('0x0'));var fs=require('fs');var _=require(_0xdc36('0x1'));var db=require(_0xdc36('0x2'))['db'];var config=require(_0xdc36('0x3'));var util=require(_0xdc36('0x4'));var BPromise=require(_0xdc36('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0xdc36('0x6')][_0xdc36('0x7')]({'port':0x232a});var logger=require('../../config/logger')(_0xdc36('0x8'));var Redis=require(_0xdc36('0x9'));config[_0xdc36('0xa')]=_[_0xdc36('0xb')](config[_0xdc36('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xdc36('0xc'))(new Redis(config[_0xdc36('0xa')]));var Schema=require(_0xdc36('0xd'));var originateValidation=new Schema({'userId':{'type':_0xdc36('0xe'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xdc36('0xf'),'required':[!![],_0xdc36('0x10')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xdc36('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xdc36('0xe'),'required':[!![],_0xdc36('0x11')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xdc36('0xe'),'required':[!![],_0xdc36('0x11')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xdc36('0x11')]},'sessionId':{'type':_0xdc36('0xf'),'required':[!![],_0xdc36('0x12')]},'transferNumber':{'type':_0xdc36('0xf'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xdc36('0xe'),'required':[!![],_0xdc36('0x11')]},'sessionId':{'type':_0xdc36('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xdc36('0xe'),'required':[!![],_0xdc36('0x11')]},'sessionId':{'type':_0xdc36('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xdc36('0xe'),'required':[!![],_0xdc36('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xdc36('0x11')]}});function emit(_0x526ac8,_0x4baf2e,_0x59c88f){logger[_0xdc36('0x13')](_0x526ac8,_0x4baf2e,JSON[_0xdc36('0x14')](_0x59c88f));io['to'](_0x526ac8)['emit'](_0x4baf2e,_0x59c88f);}function handleError(_0xd38826){return function(_0x219a73){console[_0xdc36('0x15')](_0xdc36('0x16'),_0x219a73,_0x219a73 instanceof RangeError);logger[_0xdc36('0x17')](_0x219a73[_0xdc36('0x18')]);if(_0x219a73 instanceof RangeError){if(_0x219a73['name']){delete _0x219a73[_0xdc36('0x19')];}_0xd38826[_0xdc36('0x1a')](0x194)['send'](_0x219a73);}else{if(_0x219a73[_0xdc36('0x19')]){delete _0x219a73[_0xdc36('0x19')];}_0xd38826[_0xdc36('0x1a')](0x1f4)['send'](_0x219a73);}};}function checkError(){return function(_0x10aafb){if(!_0x10aafb){throw new RangeError(_0xdc36('0x1b'));}return _0x10aafb;};}function respondWithRpcPromise(_0x5b9891,_0x388b1a){return new BPromise(function(_0x480277,_0x5a6e35){var _0x12f9d8=amiClient;return _0x12f9d8[_0xdc36('0x1c')](_0x5b9891,_0x388b1a)[_0xdc36('0x1d')](function(_0xda916b){if(_0xda916b[_0xdc36('0x17')]){if(_0xda916b[_0xdc36('0x17')][_0xdc36('0x1e')]===0x1f4){return _0x5a6e35(_0xda916b[_0xdc36('0x17')]['message']);}return _0x480277(_0xda916b[_0xdc36('0x17')]['message']);}else{_0x480277(_0xda916b[_0xdc36('0x1f')]);}})[_0xdc36('0x20')](function(_0x15e686){_0x5a6e35(_0x15e686);});});}function getAgent(_0x5c785b){return db[_0xdc36('0x21')][_0xdc36('0x22')]({'where':{'id':_0x5c785b,'role':_0xdc36('0x23')}})['then'](checkError());}function getAgentCheckSession(_0x28a005,_0x2f3b6a){return new BPromise(function(_0x2a596d,_0x5f3b20){var _0x3c39e3=respondWithRpcPromise(_0xdc36('0x24'));var _0x4b15b4=getAgent(_0x28a005);Promise[_0xdc36('0x25')]([_0x3c39e3,_0x4b15b4])[_0xdc36('0x1d')](function(_0x4ea2ad){var _0x21151b=_0x4ea2ad[0x0];var _0x5bba0b=_0x4ea2ad[0x1];var _0x49bbf2=_['filter'](_0x21151b[_0xdc36('0x26')],function(_0x2f2bb4){return _0x2f2bb4['UserId']==_0x5bba0b['id']&&_0x2f2bb4[_0xdc36('0x27')]==_0x2f3b6a;});if(_0x49bbf2[_0xdc36('0x28')]==0x1){_0x2a596d(_0x5bba0b);}else{_0x5f3b20(new RangeError(_0xdc36('0x29')+_0x2f3b6a+'\x20not\x20found!'));}});});}exports[_0xdc36('0x2a')]=function(_0xcfff77,_0x1d010c){logger[_0xdc36('0x13')](_0xdc36('0x2b'),_0xcfff77[_0xdc36('0x2c')]);var _0x1aa877=originateValidation['validate'](_0xcfff77[_0xdc36('0x2c')]);if(_0x1aa877[_0xdc36('0x28')]>0x0){return _0x1d010c['status'](0x190)['json'](_0x1aa877);}var _0x359e7c=_0xcfff77[_0xdc36('0x2c')][_0xdc36('0x2d')];var _0x58a899=_0xcfff77['body'][_0xdc36('0x2e')];var _0x1a2261=_0xcfff77[_0xdc36('0x2c')][_0xdc36('0x2f')];var _0x302d69=_0xcfff77[_0xdc36('0x2c')][_0xdc36('0x30')];return getAgent(_0x359e7c)[_0xdc36('0x1d')](function(_0x734ad6){logger[_0xdc36('0x13')](_0xdc36('0x31'),_0x734ad6['name']);emit(util[_0xdc36('0x32')](_0xdc36('0x33'),_0x734ad6[_0xdc36('0x19')]),_0xdc36('0x34'),{'callNumber':_0x58a899,'callerId':_0x1a2261,'callbackUrl':_0x302d69});return _0x1d010c['status'](0xc8)[_0xdc36('0x35')]({'error':![],'message':_0xdc36('0x36')});})[_0xdc36('0x20')](handleError(_0x1d010c));};exports[_0xdc36('0x37')]=function(_0x4c4105,_0x3c8bd5){logger['info']('hangup\x20fired:',_0x4c4105[_0xdc36('0x2c')]);var _0x169c1e=hangupValidation[_0xdc36('0xd')](_0x4c4105['body']);if(_0x169c1e[_0xdc36('0x28')]>0x0){return _0x3c8bd5['status'](0x190)[_0xdc36('0x35')](_0x169c1e);}var _0x34f6be=_0x4c4105[_0xdc36('0x2c')]['userId'];var _0x34fe4d=_0x4c4105[_0xdc36('0x2c')][_0xdc36('0x27')];return getAgent(_0x34f6be)[_0xdc36('0x1d')](function(_0x50cf7b){logger[_0xdc36('0x13')](_0xdc36('0x31'),_0x50cf7b[_0xdc36('0x19')]);emit(util['format']('user:%s',_0x50cf7b[_0xdc36('0x19')]),_0xdc36('0x38'),{'sessionId':_0x34fe4d});return _0x3c8bd5['status'](0xc8)['json']({'error':![],'message':_0xdc36('0x39')});})[_0xdc36('0x20')](handleError(_0x3c8bd5));};exports[_0xdc36('0x3a')]=function(_0x1c0a6c,_0x26fb8c){logger[_0xdc36('0x13')](_0xdc36('0x3b'),_0x1c0a6c[_0xdc36('0x2c')]);var _0x2f4c89=answerValidation[_0xdc36('0xd')](_0x1c0a6c[_0xdc36('0x2c')]);if(_0x2f4c89[_0xdc36('0x28')]>0x0){return _0x26fb8c[_0xdc36('0x1a')](0x190)[_0xdc36('0x35')](_0x2f4c89);}var _0x1f2604=_0x1c0a6c[_0xdc36('0x2c')][_0xdc36('0x2d')];var _0x16dcb7=_0x1c0a6c[_0xdc36('0x2c')][_0xdc36('0x27')];return getAgent(_0x1f2604)[_0xdc36('0x1d')](function(_0x608220){logger[_0xdc36('0x13')](_0xdc36('0x31'),_0x608220[_0xdc36('0x19')]);emit(util[_0xdc36('0x32')]('user:%s',_0x608220[_0xdc36('0x19')]),_0xdc36('0x3c'),{'sessionId':_0x16dcb7});return _0x26fb8c['status'](0xc8)['json']({'error':![],'message':_0xdc36('0x3d')});})['catch'](handleError(_0x26fb8c));};exports[_0xdc36('0x3e')]=function(_0x51a276,_0x19c7fe){logger[_0xdc36('0x13')](_0xdc36('0x3f'),_0x51a276[_0xdc36('0x2c')]);var _0x34af88=holdValidation[_0xdc36('0xd')](_0x51a276[_0xdc36('0x2c')]);if(_0x34af88[_0xdc36('0x28')]>0x0){return _0x19c7fe[_0xdc36('0x1a')](0x190)[_0xdc36('0x35')](_0x34af88);}var _0x3c27c7=_0x51a276[_0xdc36('0x2c')][_0xdc36('0x2d')];var _0x10d865=_0x51a276[_0xdc36('0x2c')][_0xdc36('0x27')];return getAgent(_0x3c27c7)[_0xdc36('0x1d')](function(_0x3399cc){logger['info']('entityFound:',_0x3399cc[_0xdc36('0x19')]);emit(util[_0xdc36('0x32')](_0xdc36('0x33'),_0x3399cc[_0xdc36('0x19')]),_0xdc36('0x40'),{'sessionId':_0x10d865});return _0x19c7fe[_0xdc36('0x1a')](0xc8)['json']({'error':![],'message':_0xdc36('0x41')});})[_0xdc36('0x20')](handleError(_0x19c7fe));};exports[_0xdc36('0x42')]=function(_0x49f456,_0x2c6856){logger[_0xdc36('0x13')](_0xdc36('0x43'),_0x49f456[_0xdc36('0x2c')]);var _0x3bfc00=unholdValidation[_0xdc36('0xd')](_0x49f456['body']);if(_0x3bfc00[_0xdc36('0x28')]>0x0){return _0x2c6856[_0xdc36('0x1a')](0x190)[_0xdc36('0x35')](_0x3bfc00);}var _0x18272a=_0x49f456[_0xdc36('0x2c')][_0xdc36('0x2d')];var _0x26775a=_0x49f456[_0xdc36('0x2c')]['sessionId'];return getAgent(_0x18272a)[_0xdc36('0x1d')](function(_0x5bdc6){logger[_0xdc36('0x13')](_0xdc36('0x31'),_0x5bdc6[_0xdc36('0x19')]);emit(util[_0xdc36('0x32')](_0xdc36('0x33'),_0x5bdc6[_0xdc36('0x19')]),'webbar:unhold',{'sessionId':_0x26775a});return _0x2c6856['status'](0xc8)[_0xdc36('0x35')]({'error':![],'message':_0xdc36('0x44')});})['catch'](handleError(_0x2c6856));};exports[_0xdc36('0x45')]=function(_0xd8af57,_0x502033){logger['info'](_0xdc36('0x46'),_0x502033['body']);var _0x4277b4=callsValidation['validate'](_0xd8af57[_0xdc36('0x2c')]);if(_0x4277b4['length']>0x0){return _0x502033['status'](0x190)[_0xdc36('0x35')](_0x4277b4);}var _0x5d139f=_0xd8af57[_0xdc36('0x2c')][_0xdc36('0x2d')];var _0x33b3d2=respondWithRpcPromise(_0xdc36('0x24'));var _0x396a6a=getAgent(_0x5d139f);return Promise['all']([_0x33b3d2,_0x396a6a])[_0xdc36('0x1d')](function(_0x379a72){var _0x42d0a6=_0x379a72[0x0];var _0x4e62c2=_0x379a72[0x1];var _0x4f7bf5=_[_0xdc36('0x47')](_0x42d0a6['rows'],function(_0x3c50ea){return _0x3c50ea[_0xdc36('0x48')]==_0x4e62c2['id'];});return _0x502033[_0xdc36('0x1a')](0xc8)[_0xdc36('0x35')]({'count':_0x4f7bf5['length'],'rows':_0x4f7bf5});})['catch'](handleError(_0x502033));};exports[_0xdc36('0x49')]=function(_0x1d4707,_0x3d8c56){logger[_0xdc36('0x13')](_0xdc36('0x4a'),_0x1d4707[_0xdc36('0x2c')]);var _0x2359bd=conferenceValidation[_0xdc36('0xd')](_0x1d4707[_0xdc36('0x2c')]);if(_0x2359bd[_0xdc36('0x28')]>0x0){return _0x3d8c56['status'](0x190)[_0xdc36('0x35')](_0x2359bd);}var _0x4ea344=_0x1d4707[_0xdc36('0x2c')][_0xdc36('0x2d')];return getAgent(_0x4ea344)[_0xdc36('0x1d')](function(_0x35adec){logger[_0xdc36('0x13')](_0xdc36('0x31'),_0x35adec[_0xdc36('0x19')]);emit(util[_0xdc36('0x32')](_0xdc36('0x33'),_0x35adec[_0xdc36('0x19')]),_0xdc36('0x4b'));return _0x3d8c56[_0xdc36('0x1a')](0xc8)[_0xdc36('0x35')]({'error':![],'message':_0xdc36('0x4c')});})[_0xdc36('0x20')](handleError(_0x3d8c56));};exports[_0xdc36('0x4d')]=function(_0x43e23e,_0x1994c6){logger[_0xdc36('0x13')](_0xdc36('0x4e'),_0x43e23e['body']);var _0x327c04=transferValidation[_0xdc36('0xd')](_0x43e23e[_0xdc36('0x2c')]);if(_0x327c04[_0xdc36('0x28')]>0x0){return _0x1994c6[_0xdc36('0x1a')](0x190)[_0xdc36('0x35')](_0x327c04);}var _0x5ae258=_0x43e23e[_0xdc36('0x2c')][_0xdc36('0x2d')];var _0x52e7f7=_0x43e23e['body'][_0xdc36('0x27')];var _0x271004=_0x43e23e[_0xdc36('0x2c')]['transferNumber'];return getAgent(_0x5ae258)['then'](function(_0x6888a8){logger[_0xdc36('0x13')]('entityFound:',_0x6888a8['name']);emit(util[_0xdc36('0x32')](_0xdc36('0x33'),_0x6888a8[_0xdc36('0x19')]),_0xdc36('0x4f'),{'sessionId':_0x52e7f7,'transferNumber':_0x271004});return _0x1994c6[_0xdc36('0x1a')](0xc8)[_0xdc36('0x35')]({'error':![],'message':_0xdc36('0x50')});})[_0xdc36('0x20')](handleError(_0x1994c6));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 893511b..2f3602b 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 _0xdb28=['removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','getAgents','getApplications','post','create','addDisposition','addAnswer','addAgents','/:id/applications','addApplications','notify','/:id/send','put','update','delete','destroy'];(function(_0x25f051,_0x2fc208){var _0x41f941=function(_0x58cd32){while(--_0x58cd32){_0x25f051['push'](_0x25f051['shift']());}};_0x41f941(++_0x2fc208);}(_0xdb28,0x106));var _0x8db2=function(_0x143df2,_0x38827d){_0x143df2=_0x143df2-0x0;var _0x230770=_0xdb28[_0x143df2];return _0x230770;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./whatsappAccount.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getAnswers']);router[_0x8db2('0x9')](_0x8db2('0x12'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x9')]('/:id/applications',auth['isAuthenticated'](),controller[_0x8db2('0x14')]);router[_0x8db2('0x15')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);router[_0x8db2('0x15')](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x17')]);router[_0x8db2('0x15')](_0x8db2('0x11'),auth['isAuthenticated'](),controller[_0x8db2('0x18')]);router[_0x8db2('0x15')]('/:id/users',auth[_0x8db2('0xa')](),controller[_0x8db2('0x19')]);router[_0x8db2('0x15')](_0x8db2('0x1a'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x1b')]);router['post']('/:id/notify',controller[_0x8db2('0x1c')]);router[_0x8db2('0x15')](_0x8db2('0x1d'),auth[_0x8db2('0xa')](),controller['send']);router[_0x8db2('0x1e')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);router[_0x8db2('0x20')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x21')]);router[_0x8db2('0x20')](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x22')]);router[_0x8db2('0x20')]('/:id/canned_answers',auth[_0x8db2('0xa')](),controller['removeAnswers']);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x8db2('0x23')]);module[_0x8db2('0x24')]=router; \ No newline at end of file +var _0x1a85=['removeAgents','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','create','post','addAnswer','addApplications','/:id/notify','/:id/send','send','put','/:id','update','destroy','delete','removeAnswers'];(function(_0x152453,_0x14efa1){var _0x1ee6cf=function(_0x1c7cba){while(--_0x1c7cba){_0x152453['push'](_0x152453['shift']());}};_0x1ee6cf(++_0x14efa1);}(_0x1a85,0x178));var _0x51a8=function(_0x56fbb6,_0x570f05){_0x56fbb6=_0x56fbb6-0x0;var _0x4e9a77=_0x1a85[_0x56fbb6];return _0x4e9a77;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x51a8('0x0'));var timeout=require(_0x51a8('0x1'));var express=require(_0x51a8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x51a8('0x3'));var interaction=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var controller=require('./whatsappAccount.controller');router[_0x51a8('0x6')]('/',auth['isAuthenticated'](),controller[_0x51a8('0x7')]);router['get'](_0x51a8('0x8'),auth[_0x51a8('0x9')](),controller['describe']);router[_0x51a8('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x51a8('0xa')]);router[_0x51a8('0x6')](_0x51a8('0xb'),auth[_0x51a8('0x9')](),controller[_0x51a8('0xc')]);router[_0x51a8('0x6')](_0x51a8('0xd'),auth[_0x51a8('0x9')](),controller[_0x51a8('0xe')]);router[_0x51a8('0x6')](_0x51a8('0xf'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x10')]);router[_0x51a8('0x6')](_0x51a8('0x11'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x12')]);router['post']('/',auth[_0x51a8('0x9')](),controller[_0x51a8('0x13')]);router[_0x51a8('0x14')]('/:id/dispositions',auth[_0x51a8('0x9')](),controller['addDisposition']);router[_0x51a8('0x14')](_0x51a8('0xd'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x15')]);router[_0x51a8('0x14')](_0x51a8('0xf'),auth[_0x51a8('0x9')](),controller['addAgents']);router[_0x51a8('0x14')](_0x51a8('0x11'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x16')]);router[_0x51a8('0x14')](_0x51a8('0x17'),controller['notify']);router[_0x51a8('0x14')](_0x51a8('0x18'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x19')]);router[_0x51a8('0x1a')](_0x51a8('0x1b'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x1c')]);router['delete'](_0x51a8('0x1b'),auth['isAuthenticated'](),controller[_0x51a8('0x1d')]);router[_0x51a8('0x1e')](_0x51a8('0xb'),auth[_0x51a8('0x9')](),controller['removeDispositions']);router[_0x51a8('0x1e')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x51a8('0x1f')]);router['delete'](_0x51a8('0xf'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x20')]);module[_0x51a8('0x21')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index eb97176..85af1da 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 _0xd276=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','generate','ENUM','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0xf35321,_0x2b8033){var _0x538d16=function(_0x1a66a0){while(--_0x1a66a0){_0xf35321['push'](_0xf35321['shift']());}};_0x538d16(++_0x2b8033);}(_0xd276,0x198));var _0x6d27=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xd276[_0x580576];return _0x3f55a0;};'use strict';var Sequelize=require(_0x6d27('0x0'));var rs=require('randomstring');module[_0x6d27('0x1')]={'name':{'type':Sequelize[_0x6d27('0x2')],'unique':_0x6d27('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x6d27('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x6d27('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x6d27('0x2')],'defaultValue':function(){return rs[_0x6d27('0x4')]();}},'phone':{'type':Sequelize[_0x6d27('0x2')]},'type':{'type':Sequelize[_0x6d27('0x5')]('twilio','sinch')},'accountSid':{'type':Sequelize[_0x6d27('0x2')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x6d27('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x6d27('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6d27('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6d27('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6d27('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6d27('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6d27('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6d27('0x7')],'comment':_0x6d27('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x6d27('0xa'),'set':function(_0x36924c){if(!_0x36924c){this[_0x6d27('0xb')](_0x6d27('0xc'),null);}this[_0x6d27('0xb')](_0x6d27('0xd'),_0x36924c);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x20b5=['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','setDataValue','sequelize','exports','STRING','name','generate'];(function(_0x5b0473,_0x285b48){var _0x56ca94=function(_0x38ed08){while(--_0x38ed08){_0x5b0473['push'](_0x5b0473['shift']());}};_0x56ca94(++_0x285b48);}(_0x20b5,0x67));var _0x520b=function(_0x2684f9,_0x2ae154){_0x2684f9=_0x2684f9-0x0;var _0x4774ef=_0x20b5[_0x2684f9];return _0x4774ef;};'use strict';var Sequelize=require(_0x520b('0x0'));var rs=require('randomstring');module[_0x520b('0x1')]={'name':{'type':Sequelize[_0x520b('0x2')],'unique':_0x520b('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x520b('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x520b('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x520b('0x2')],'defaultValue':function(){return rs[_0x520b('0x4')]();}},'phone':{'type':Sequelize[_0x520b('0x2')]},'type':{'type':Sequelize['ENUM']('twilio',_0x520b('0x5'))},'accountSid':{'type':Sequelize[_0x520b('0x2')]},'baseUrl':{'type':Sequelize[_0x520b('0x2')]},'authToken':{'type':Sequelize[_0x520b('0x2')]},'notificationTemplate':{'type':Sequelize[_0x520b('0x6')],'defaultValue':function(){return _0x520b('0x7');}},'notificationSound':{'type':Sequelize[_0x520b('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x520b('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x520b('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x520b('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x520b('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x520b('0x9')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x520b('0x8')],'defaultValue':![],'comment':_0x520b('0xa'),'set':function(_0x1835d0){if(!_0x1835d0){this[_0x520b('0xb')]('mandatoryDispositionPauseId',null);}this[_0x520b('0xb')]('mandatoryDisposition',_0x1835d0);}},'description':{'type':Sequelize[_0x520b('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 00b9f14..2d9699b 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 _0xf8d6=['mustache','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','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','client','http','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','destroy','get','WhatsappAccounts','UserProfileResource','name','index','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','WhatsappAccount','includeAll','include','rows','show','Pause','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','Disposition','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','WhatsappApplication','findAndCountAll','priority','stack','send','getApplications','notify','whatsapp','account','sinch','statuses','state','WhatsappMessage','timestamp','Applications','asc','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','replace','whatsapp:','Body','messageId','from','notifications','message_id','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','CmContact','contact','interaction','created','autoclose','applications','push','ContactId','UserId','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','\x0a','to\x20is\x20mandatory','List','DESC','WhatsappInteraction','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x52bcc5,_0x114a44){var _0x3e6734=function(_0x3513d8){while(--_0x3513d8){_0x52bcc5['push'](_0x52bcc5['shift']());}};_0x3e6734(++_0x114a44);}(_0xf8d6,0xbc));var _0x6f8d=function(_0xb6e2ea,_0x3b26e9){_0xb6e2ea=_0xb6e2ea-0x0;var _0x2a57bb=_0xf8d6[_0xb6e2ea];return _0x2a57bb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6f8d('0x0'));var zipdir=require(_0x6f8d('0x1'));var jsonpatch=require(_0x6f8d('0x2'));var rp=require(_0x6f8d('0x3'));var moment=require(_0x6f8d('0x4'));var BPromise=require(_0x6f8d('0x5'));var Mustache=require(_0x6f8d('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6f8d('0x7'));var csv=require(_0x6f8d('0x8'));var ejs=require(_0x6f8d('0x9'));var fs=require('fs');var fs_extra=require(_0x6f8d('0xa'));var _=require(_0x6f8d('0xb'));var squel=require(_0x6f8d('0xc'));var crypto=require(_0x6f8d('0xd'));var jsforce=require(_0x6f8d('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6f8d('0xf'));var authService=require(_0x6f8d('0x10'));var qs=require(_0x6f8d('0x11'));var as=require(_0x6f8d('0x12'));var hardwareService=require(_0x6f8d('0x13'));var logger=require(_0x6f8d('0x14'))('api');var utils=require(_0x6f8d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6f8d('0x16'));var db=require(_0x6f8d('0x17'))['db'];config[_0x6f8d('0x18')]=_[_0x6f8d('0x19')](config['redis'],{'host':_0x6f8d('0x1a'),'port':0x18eb});var socket=require(_0x6f8d('0x1b'))(new Redis(config['redis']));require(_0x6f8d('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x6f8d('0x1d')][_0x6f8d('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x2919d2,_0x5cf15b,_0x81d378,_0x168bf7){return new BPromise(function(_0x531dee,_0x1e2fe2){var _0xe8e3b9=_0x168bf7||client;return _0xe8e3b9['request'](_0x2919d2,_0x81d378)[_0x6f8d('0x1f')](function(_0x112744){logger[_0x6f8d('0x20')](_0x6f8d('0x21'),_0x5cf15b,_0x6f8d('0x22'));logger['debug'](_0x6f8d('0x23'),_0x5cf15b,_0x6f8d('0x22'),JSON['stringify'](_0x112744));if(_0x112744[_0x6f8d('0x24')]){if(_0x112744[_0x6f8d('0x24')][_0x6f8d('0x25')]===0x1f4){logger[_0x6f8d('0x24')](_0x6f8d('0x21'),_0x5cf15b,_0x112744[_0x6f8d('0x24')][_0x6f8d('0x26')]);return _0x1e2fe2(_0x112744[_0x6f8d('0x24')]['message']);}logger[_0x6f8d('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0x5cf15b,_0x112744[_0x6f8d('0x24')][_0x6f8d('0x26')]);return _0x531dee(_0x112744[_0x6f8d('0x24')][_0x6f8d('0x26')]);}else{logger[_0x6f8d('0x20')](_0x6f8d('0x21'),_0x5cf15b,'request\x20sent');_0x531dee(_0x112744[_0x6f8d('0x27')][_0x6f8d('0x26')]);}})[_0x6f8d('0x28')](function(_0x7c8ef5){logger['error'](_0x6f8d('0x21'),_0x5cf15b,_0x7c8ef5);_0x1e2fe2(_0x7c8ef5);});});}function respondWithStatusCode(_0x1220ea,_0x3a33a0){_0x3a33a0=_0x3a33a0||0xcc;return function(_0x20b33c){if(_0x20b33c){return _0x1220ea[_0x6f8d('0x29')](_0x3a33a0);}return _0x1220ea['status'](_0x3a33a0)[_0x6f8d('0x2a')]();};}function respondWithResult(_0x27e412,_0x2726df){_0x2726df=_0x2726df||0xc8;return function(_0x58e846){if(_0x58e846){return _0x27e412[_0x6f8d('0x2b')](_0x2726df)[_0x6f8d('0x2c')](_0x58e846);}};}function respondWithFilteredResult(_0x3fa189,_0x5c4a90){return function(_0x3142d6){if(_0x3142d6){var _0x4bd214=typeof _0x5c4a90[_0x6f8d('0x2d')]===_0x6f8d('0x2e')&&typeof _0x5c4a90[_0x6f8d('0x2f')]===_0x6f8d('0x2e');var _0x5a7ed1=_0x3142d6['count'];var _0x44f030=_0x4bd214?0x0:_0x5c4a90[_0x6f8d('0x2d')];var _0x23fad8=_0x4bd214?_0x3142d6[_0x6f8d('0x30')]:_0x5c4a90[_0x6f8d('0x2d')]+_0x5c4a90[_0x6f8d('0x2f')];var _0x311aff;if(_0x23fad8>=_0x5a7ed1){_0x23fad8=_0x5a7ed1;_0x311aff=0xc8;}else{_0x311aff=0xce;}_0x3fa189[_0x6f8d('0x2b')](_0x311aff);return _0x3fa189[_0x6f8d('0x31')]('Content-Range',_0x44f030+'-'+_0x23fad8+'/'+_0x5a7ed1)[_0x6f8d('0x2c')](_0x3142d6);}return null;};}function patchUpdates(_0x5759ac){return function(_0x399161){try{jsonpatch[_0x6f8d('0x32')](_0x399161,_0x5759ac,!![]);}catch(_0x51dcb5){return BPromise['reject'](_0x51dcb5);}return _0x399161['save']();};}function saveUpdates(_0x213a4e,_0x1734dc){return function(_0x40a0e7){if(_0x40a0e7){return _0x40a0e7['update'](_0x213a4e)[_0x6f8d('0x1f')](function(_0x43397d){return _0x43397d;});}return null;};}function removeEntity(_0x38f4e9,_0x2abe44){return function(_0x245304){if(_0x245304){return _0x245304[_0x6f8d('0x33')]()['then'](function(){var _0x426f2f=_0x245304[_0x6f8d('0x34')]({'plain':!![]});var _0xe558f6=_0x6f8d('0x35');return db[_0x6f8d('0x36')][_0x6f8d('0x33')]({'where':{'type':_0xe558f6,'resourceId':_0x426f2f['id']}})['then'](function(){return _0x245304;});})[_0x6f8d('0x1f')](function(){_0x38f4e9[_0x6f8d('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x483c97,_0x3c8b60){return function(_0x258fba){if(!_0x258fba){_0x483c97[_0x6f8d('0x29')](0x194);}return _0x258fba;};}function handleError(_0x58d9cf,_0x461408){_0x461408=_0x461408||0x1f4;return function(_0x4a9364){logger[_0x6f8d('0x24')](_0x4a9364['stack']);if(_0x4a9364[_0x6f8d('0x37')]){delete _0x4a9364[_0x6f8d('0x37')];}_0x58d9cf[_0x6f8d('0x2b')](_0x461408)['send'](_0x4a9364);};}exports[_0x6f8d('0x38')]=function(_0x5710dd,_0x1c66d9){var _0x5928be={'include':[{'model':db['Pause'],'as':_0x6f8d('0x39')}]},_0x58cbe1={},_0x578404={'count':0x0,'rows':[]};var _0x5b96ef=_[_0x6f8d('0x3a')](db['WhatsappAccount'][_0x6f8d('0x3b')],function(_0x37c0bb){return{'name':_0x37c0bb[_0x6f8d('0x3c')],'type':_0x37c0bb[_0x6f8d('0x3d')][_0x6f8d('0x3e')]};});_0x58cbe1[_0x6f8d('0x3f')]=_['map'](_0x5b96ef,_0x6f8d('0x37'));_0x58cbe1[_0x6f8d('0x40')]=_[_0x6f8d('0x41')](_0x5710dd[_0x6f8d('0x40')]);_0x58cbe1['filters']=_[_0x6f8d('0x42')](_0x58cbe1['model'],_0x58cbe1[_0x6f8d('0x40')]);_0x5928be['attributes']=_[_0x6f8d('0x42')](_0x58cbe1['model'],qs[_0x6f8d('0x43')](_0x5710dd['query'][_0x6f8d('0x43')]));_0x5928be['attributes']=_0x5928be[_0x6f8d('0x44')][_0x6f8d('0x45')]?_0x5928be[_0x6f8d('0x44')]:_0x58cbe1['model'];if(!_0x5710dd[_0x6f8d('0x40')][_0x6f8d('0x46')](_0x6f8d('0x47'))){_0x5928be[_0x6f8d('0x2f')]=qs[_0x6f8d('0x2f')](_0x5710dd[_0x6f8d('0x40')][_0x6f8d('0x2f')]);_0x5928be[_0x6f8d('0x2d')]=qs[_0x6f8d('0x2d')](_0x5710dd[_0x6f8d('0x40')][_0x6f8d('0x2d')]);}_0x5928be[_0x6f8d('0x48')]=qs[_0x6f8d('0x49')](_0x5710dd[_0x6f8d('0x40')]['sort']);_0x5928be[_0x6f8d('0x4a')]=qs[_0x6f8d('0x4b')](_[_0x6f8d('0x4c')](_0x5710dd[_0x6f8d('0x40')],_0x58cbe1['filters']),_0x5b96ef);if(_0x5710dd['query']['filter']){_0x5928be[_0x6f8d('0x4a')]=_['merge'](_0x5928be[_0x6f8d('0x4a')],{'$or':_[_0x6f8d('0x3a')](_0x5b96ef,function(_0x4fdf4c){if(_0x4fdf4c[_0x6f8d('0x3d')]!==_0x6f8d('0x4d')){var _0x22f9da={};_0x22f9da[_0x4fdf4c[_0x6f8d('0x37')]]={'$like':'%'+_0x5710dd[_0x6f8d('0x40')][_0x6f8d('0x4e')]+'%'};return _0x22f9da;}})});}_0x5928be=_[_0x6f8d('0x4f')]({},_0x5928be,_0x5710dd[_0x6f8d('0x50')]);var _0x4d8945={'where':_0x5928be[_0x6f8d('0x4a')]};return db[_0x6f8d('0x51')][_0x6f8d('0x30')](_0x4d8945)[_0x6f8d('0x1f')](function(_0x334015){_0x578404[_0x6f8d('0x30')]=_0x334015;if(_0x5710dd[_0x6f8d('0x40')][_0x6f8d('0x52')]){_0x5928be[_0x6f8d('0x53')]=[{'all':!![]}];}return db[_0x6f8d('0x51')]['findAll'](_0x5928be);})['then'](function(_0x86e621){_0x578404[_0x6f8d('0x54')]=_0x86e621;return _0x578404;})[_0x6f8d('0x1f')](respondWithFilteredResult(_0x1c66d9,_0x5928be))['catch'](handleError(_0x1c66d9,null));};exports[_0x6f8d('0x55')]=function(_0x3b8e09,_0x1ef2a7){var _0x5cd0c4={'raw':![],'where':{'id':_0x3b8e09['params']['id']},'include':[{'model':db[_0x6f8d('0x56')],'as':_0x6f8d('0x39')}]},_0x21fe09={};_0x21fe09[_0x6f8d('0x3f')]=_[_0x6f8d('0x41')](db[_0x6f8d('0x51')]['rawAttributes']);_0x21fe09[_0x6f8d('0x40')]=_['keys'](_0x3b8e09['query']);_0x21fe09[_0x6f8d('0x4b')]=_['intersection'](_0x21fe09[_0x6f8d('0x3f')],_0x21fe09['query']);_0x5cd0c4[_0x6f8d('0x44')]=_[_0x6f8d('0x42')](_0x21fe09[_0x6f8d('0x3f')],qs['fields'](_0x3b8e09[_0x6f8d('0x40')]['fields']));_0x5cd0c4[_0x6f8d('0x44')]=_0x5cd0c4[_0x6f8d('0x44')][_0x6f8d('0x45')]?_0x5cd0c4[_0x6f8d('0x44')]:_0x21fe09['model'];if(_0x3b8e09[_0x6f8d('0x40')][_0x6f8d('0x52')]){_0x5cd0c4['include']=[{'all':!![]}];}_0x5cd0c4=_[_0x6f8d('0x4f')]({},_0x5cd0c4,_0x3b8e09[_0x6f8d('0x50')]);return db['WhatsappAccount'][_0x6f8d('0x57')](_0x5cd0c4)[_0x6f8d('0x1f')](handleEntityNotFound(_0x1ef2a7,null))[_0x6f8d('0x1f')](respondWithResult(_0x1ef2a7,null))['catch'](handleError(_0x1ef2a7,null));};exports[_0x6f8d('0x58')]=function(_0x56c7e4,_0x19d21c){return db[_0x6f8d('0x51')][_0x6f8d('0x58')](_0x56c7e4[_0x6f8d('0x59')],{})[_0x6f8d('0x1f')](function(_0xc929df){var _0x14dbcd=_0x56c7e4['user'][_0x6f8d('0x34')]({'plain':!![]});if(!_0x14dbcd)throw new Error(_0x6f8d('0x5a'));if(_0x14dbcd['role']===_0x6f8d('0x5b')){var _0x31c694=_0xc929df['get']({'plain':!![]});var _0x35b3bc='WhatsappAccounts';return db['UserProfileSection']['find']({'where':{'name':_0x35b3bc,'userProfileId':_0x14dbcd[_0x6f8d('0x5c')]},'raw':!![]})[_0x6f8d('0x1f')](function(_0x592c2d){if(_0x592c2d&&_0x592c2d[_0x6f8d('0x5d')]===0x0){return db['UserProfileResource'][_0x6f8d('0x58')]({'name':_0x31c694['name'],'resourceId':_0x31c694['id'],'type':_0x592c2d[_0x6f8d('0x37')],'sectionId':_0x592c2d['id']},{})[_0x6f8d('0x1f')](function(){return _0xc929df;});}else{return _0xc929df;}})[_0x6f8d('0x28')](function(_0x74b877){logger[_0x6f8d('0x24')](_0x6f8d('0x5e'),_0x74b877);throw _0x74b877;});}return _0xc929df;})[_0x6f8d('0x1f')](respondWithResult(_0x19d21c,0xc9))[_0x6f8d('0x28')](handleError(_0x19d21c,null));};exports[_0x6f8d('0x5f')]=function(_0x5c59a5,_0x54ba56){if(_0x5c59a5[_0x6f8d('0x59')]['id']){delete _0x5c59a5[_0x6f8d('0x59')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x5c59a5['params']['id']},'include':[{'model':db[_0x6f8d('0x56')],'as':'mandatoryDispositionPause'}]})[_0x6f8d('0x1f')](handleEntityNotFound(_0x54ba56,null))[_0x6f8d('0x1f')](saveUpdates(_0x5c59a5[_0x6f8d('0x59')],null))[_0x6f8d('0x1f')](respondWithResult(_0x54ba56,null))[_0x6f8d('0x28')](handleError(_0x54ba56,null));};exports[_0x6f8d('0x33')]=function(_0x31df84,_0x455106){return db[_0x6f8d('0x51')][_0x6f8d('0x57')]({'where':{'id':_0x31df84[_0x6f8d('0x60')]['id']}})[_0x6f8d('0x1f')](handleEntityNotFound(_0x455106,null))[_0x6f8d('0x1f')](removeEntity(_0x455106,null))['catch'](handleError(_0x455106,null));};exports[_0x6f8d('0x61')]=function(_0xbcca74,_0xc71b7d){return db[_0x6f8d('0x51')][_0x6f8d('0x61')]()[_0x6f8d('0x1f')](respondWithResult(_0xc71b7d,null))[_0x6f8d('0x28')](handleError(_0xc71b7d,null));};exports[_0x6f8d('0x62')]=function(_0x17b99a,_0x579903,_0xe4d962){if(_0x17b99a[_0x6f8d('0x59')]['id']){delete _0x17b99a[_0x6f8d('0x59')]['id'];}return db['WhatsappAccount'][_0x6f8d('0x57')]({'where':{'id':_0x17b99a['params']['id']}})[_0x6f8d('0x1f')](handleEntityNotFound(_0x579903,null))[_0x6f8d('0x1f')](function(_0x452ce9){if(_0x452ce9){_0x17b99a[_0x6f8d('0x59')][_0x6f8d('0x63')]=_0x452ce9['id'];return db['Disposition'][_0x6f8d('0x58')](_0x17b99a[_0x6f8d('0x59')]);}})[_0x6f8d('0x1f')](respondWithResult(_0x579903,null))[_0x6f8d('0x28')](handleError(_0x579903,null));};exports[_0x6f8d('0x64')]=function(_0x5503d9,_0x4a1dab,_0x2ce54c){var _0x322166={'raw':![],'where':{}};var _0x1a78a3={};var _0x849218={'count':0x0,'rows':[]};return db[_0x6f8d('0x51')][_0x6f8d('0x65')]({'where':{'id':_0x5503d9[_0x6f8d('0x60')]['id']}})[_0x6f8d('0x1f')](handleEntityNotFound(_0x4a1dab,null))[_0x6f8d('0x1f')](function(_0xdc8cac){if(_0xdc8cac){_0x1a78a3[_0x6f8d('0x3f')]=_[_0x6f8d('0x41')](db[_0x6f8d('0x66')]['rawAttributes']);_0x1a78a3[_0x6f8d('0x40')]=_[_0x6f8d('0x41')](_0x5503d9[_0x6f8d('0x40')]);_0x1a78a3[_0x6f8d('0x4b')]=_[_0x6f8d('0x42')](_0x1a78a3['model'],_0x1a78a3[_0x6f8d('0x40')]);_0x322166[_0x6f8d('0x44')]=_[_0x6f8d('0x42')](_0x1a78a3[_0x6f8d('0x3f')],qs[_0x6f8d('0x43')](_0x5503d9[_0x6f8d('0x40')]['fields']));_0x322166[_0x6f8d('0x44')]=_0x322166[_0x6f8d('0x44')][_0x6f8d('0x45')]?_0x322166[_0x6f8d('0x44')]:_0x1a78a3[_0x6f8d('0x3f')];if(!_0x5503d9[_0x6f8d('0x40')]['hasOwnProperty'](_0x6f8d('0x47'))){_0x322166['limit']=qs[_0x6f8d('0x2f')](_0x5503d9[_0x6f8d('0x40')]['limit']);_0x322166[_0x6f8d('0x2d')]=qs['offset'](_0x5503d9[_0x6f8d('0x40')][_0x6f8d('0x2d')]);}_0x322166['order']=qs[_0x6f8d('0x49')](_0x5503d9[_0x6f8d('0x40')][_0x6f8d('0x49')]);_0x322166[_0x6f8d('0x4a')]=qs[_0x6f8d('0x4b')](_[_0x6f8d('0x4c')](_0x5503d9['query'],_0x1a78a3[_0x6f8d('0x4b')]));_0x322166[_0x6f8d('0x4a')][_0x6f8d('0x63')]=_0xdc8cac['id'];if(_0x5503d9[_0x6f8d('0x40')]['filter']){_0x322166[_0x6f8d('0x4a')]=_[_0x6f8d('0x4f')](_0x322166[_0x6f8d('0x4a')],{'$or':_[_0x6f8d('0x3a')](_0x322166[_0x6f8d('0x44')],function(_0x430a46){var _0x3c55b5={};_0x3c55b5[_0x430a46]={'$like':'%'+_0x5503d9[_0x6f8d('0x40')][_0x6f8d('0x4e')]+'%'};return _0x3c55b5;})});}_0x322166=_[_0x6f8d('0x4f')]({},_0x322166,_0x5503d9['options']);return db[_0x6f8d('0x66')]['count']({'where':_0x322166[_0x6f8d('0x4a')]})[_0x6f8d('0x1f')](function(_0x4ea976){_0x849218['count']=_0x4ea976;if(_0x5503d9[_0x6f8d('0x40')][_0x6f8d('0x52')]){_0x322166[_0x6f8d('0x53')]=[{'all':!![]}];}return db[_0x6f8d('0x66')][_0x6f8d('0x67')](_0x322166);})['then'](function(_0x39f3be){_0x849218[_0x6f8d('0x54')]=_0x39f3be;return _0x849218;});}})[_0x6f8d('0x1f')](respondWithFilteredResult(_0x4a1dab,_0x322166))[_0x6f8d('0x28')](handleError(_0x4a1dab,null));};exports[_0x6f8d('0x68')]=function(_0x5c3266,_0xc6ed3b,_0x353b0e){return db['WhatsappAccount'][_0x6f8d('0x57')]({'where':{'id':_0x5c3266[_0x6f8d('0x60')]['id']}})['then'](handleEntityNotFound(_0xc6ed3b,null))['then'](function(_0x55c056){if(_0x55c056){return _0x55c056[_0x6f8d('0x68')](_0x5c3266[_0x6f8d('0x40')][_0x6f8d('0x69')]);}})[_0x6f8d('0x1f')](respondWithStatusCode(_0xc6ed3b,null))[_0x6f8d('0x28')](handleError(_0xc6ed3b,null));};exports[_0x6f8d('0x6a')]=function(_0x577b2f,_0x594768,_0xde0b14){if(_0x577b2f['body']['id']){delete _0x577b2f[_0x6f8d('0x59')]['id'];}return db[_0x6f8d('0x51')][_0x6f8d('0x57')]({'where':{'id':_0x577b2f[_0x6f8d('0x60')]['id']}})['then'](handleEntityNotFound(_0x594768,null))[_0x6f8d('0x1f')](function(_0xf1677a){if(_0xf1677a){_0x577b2f[_0x6f8d('0x59')][_0x6f8d('0x63')]=_0xf1677a['id'];return db[_0x6f8d('0x6b')][_0x6f8d('0x58')](_0x577b2f[_0x6f8d('0x59')]);}})['then'](respondWithResult(_0x594768,null))[_0x6f8d('0x28')](handleError(_0x594768,null));};exports[_0x6f8d('0x6c')]=function(_0x1d45ad,_0x1330a4,_0x342d36){var _0x5f3f3c={'raw':![],'where':{}};var _0x577c2f={};var _0x245d84={'count':0x0,'rows':[]};return db[_0x6f8d('0x51')]['findOne']({'where':{'id':_0x1d45ad[_0x6f8d('0x60')]['id']}})[_0x6f8d('0x1f')](handleEntityNotFound(_0x1330a4,null))['then'](function(_0x442621){if(_0x442621){_0x577c2f[_0x6f8d('0x3f')]=_['keys'](db[_0x6f8d('0x6b')][_0x6f8d('0x3b')]);_0x577c2f[_0x6f8d('0x40')]=_[_0x6f8d('0x41')](_0x1d45ad[_0x6f8d('0x40')]);_0x577c2f['filters']=_['intersection'](_0x577c2f[_0x6f8d('0x3f')],_0x577c2f['query']);_0x5f3f3c[_0x6f8d('0x44')]=_[_0x6f8d('0x42')](_0x577c2f[_0x6f8d('0x3f')],qs[_0x6f8d('0x43')](_0x1d45ad[_0x6f8d('0x40')]['fields']));_0x5f3f3c[_0x6f8d('0x44')]=_0x5f3f3c['attributes'][_0x6f8d('0x45')]?_0x5f3f3c[_0x6f8d('0x44')]:_0x577c2f[_0x6f8d('0x3f')];if(!_0x1d45ad[_0x6f8d('0x40')][_0x6f8d('0x46')](_0x6f8d('0x47'))){_0x5f3f3c[_0x6f8d('0x2f')]=qs['limit'](_0x1d45ad[_0x6f8d('0x40')][_0x6f8d('0x2f')]);_0x5f3f3c[_0x6f8d('0x2d')]=qs[_0x6f8d('0x2d')](_0x1d45ad[_0x6f8d('0x40')][_0x6f8d('0x2d')]);}_0x5f3f3c['order']=qs[_0x6f8d('0x49')](_0x1d45ad[_0x6f8d('0x40')]['sort']);_0x5f3f3c[_0x6f8d('0x4a')]=qs[_0x6f8d('0x4b')](_[_0x6f8d('0x4c')](_0x1d45ad['query'],_0x577c2f[_0x6f8d('0x4b')]));_0x5f3f3c['where'][_0x6f8d('0x63')]=_0x442621['id'];if(_0x1d45ad['query'][_0x6f8d('0x4e')]){_0x5f3f3c[_0x6f8d('0x4a')]=_['merge'](_0x5f3f3c[_0x6f8d('0x4a')],{'$or':_['map'](_0x5f3f3c[_0x6f8d('0x44')],function(_0x31c3a8){var _0x43311d={};_0x43311d[_0x31c3a8]={'$like':'%'+_0x1d45ad[_0x6f8d('0x40')][_0x6f8d('0x4e')]+'%'};return _0x43311d;})});}_0x5f3f3c=_[_0x6f8d('0x4f')]({},_0x5f3f3c,_0x1d45ad[_0x6f8d('0x50')]);return db[_0x6f8d('0x6b')][_0x6f8d('0x30')]({'where':_0x5f3f3c[_0x6f8d('0x4a')]})[_0x6f8d('0x1f')](function(_0xb2790d){_0x245d84[_0x6f8d('0x30')]=_0xb2790d;if(_0x1d45ad[_0x6f8d('0x40')][_0x6f8d('0x52')]){_0x5f3f3c['include']=[{'all':!![]}];}return db[_0x6f8d('0x6b')][_0x6f8d('0x67')](_0x5f3f3c);})[_0x6f8d('0x1f')](function(_0x49cf3a){_0x245d84[_0x6f8d('0x54')]=_0x49cf3a;return _0x245d84;});}})[_0x6f8d('0x1f')](respondWithFilteredResult(_0x1330a4,_0x5f3f3c))[_0x6f8d('0x28')](handleError(_0x1330a4,null));};exports[_0x6f8d('0x6d')]=function(_0x2a8a05,_0x3b82c4,_0x272aa5){return db[_0x6f8d('0x51')]['find']({'where':{'id':_0x2a8a05[_0x6f8d('0x60')]['id']}})[_0x6f8d('0x1f')](handleEntityNotFound(_0x3b82c4,null))[_0x6f8d('0x1f')](function(_0x2985b7){if(_0x2985b7){return _0x2985b7[_0x6f8d('0x6d')](_0x2a8a05[_0x6f8d('0x40')][_0x6f8d('0x69')]);}})['then'](respondWithStatusCode(_0x3b82c4,null))['catch'](handleError(_0x3b82c4,null));};exports[_0x6f8d('0x6e')]=function(_0xb3ad7f,_0x4e404e,_0x537099){return db[_0x6f8d('0x51')][_0x6f8d('0x57')]({'where':{'id':_0xb3ad7f['params']['id']}})[_0x6f8d('0x1f')](handleEntityNotFound(_0x4e404e,null))[_0x6f8d('0x1f')](function(_0x1503bb){if(_0x1503bb){return _0x1503bb[_0x6f8d('0x6e')](_0xb3ad7f[_0x6f8d('0x59')]['ids'],_[_0x6f8d('0x6f')](_0xb3ad7f[_0x6f8d('0x59')],['ids','id'])||{})[_0x6f8d('0x70')](function(_0x3879ae){for(var _0x51739a=0x0;_0x51739a<_0xb3ad7f['body']['ids'][_0x6f8d('0x45')];_0x51739a+=0x1){socket[_0x6f8d('0x71')](_0x6f8d('0x72'),{'UserId':Number(_0xb3ad7f['body']['ids'][_0x51739a]),'WhatsappAccountId':Number(_0xb3ad7f[_0x6f8d('0x60')]['id'])});}return _0x3879ae;});}})[_0x6f8d('0x1f')](respondWithResult(_0x4e404e,null))[_0x6f8d('0x28')](handleError(_0x4e404e,null));};exports[_0x6f8d('0x73')]=function(_0x459681,_0xfc9475,_0x3b1a0d){return db[_0x6f8d('0x51')]['find']({'where':{'id':_0x459681[_0x6f8d('0x60')]['id']}})['then'](handleEntityNotFound(_0xfc9475,null))[_0x6f8d('0x1f')](function(_0x4641c8){if(_0x4641c8){return _0x4641c8['removeAgents'](_0x459681['query'][_0x6f8d('0x69')])['then'](function(){if(_[_0x6f8d('0x74')](_0x459681[_0x6f8d('0x40')][_0x6f8d('0x69')])){for(var _0x2d3365=0x0;_0x2d3365<_0x459681[_0x6f8d('0x40')]['ids'][_0x6f8d('0x45')];_0x2d3365+=0x1){socket['emit'](_0x6f8d('0x75'),{'UserId':Number(_0x459681[_0x6f8d('0x40')]['ids'][_0x2d3365]),'WhatsappAccountId':Number(_0x459681[_0x6f8d('0x60')]['id'])});}}else{socket[_0x6f8d('0x71')](_0x6f8d('0x75'),{'UserId':Number(_0x459681[_0x6f8d('0x40')][_0x6f8d('0x69')]),'WhatsappAccountId':Number(_0x459681['params']['id'])});}});}})[_0x6f8d('0x1f')](respondWithStatusCode(_0xfc9475,null))['catch'](handleError(_0xfc9475,null));};exports[_0x6f8d('0x76')]=function(_0x5e5ce4,_0x1b3896,_0x35eeed){var _0x52c9b1={};var _0x1fb416={};var _0x17b3a4;var _0x1f8da4;return db[_0x6f8d('0x51')]['findOne']({'where':{'id':_0x5e5ce4[_0x6f8d('0x60')]['id']}})[_0x6f8d('0x1f')](handleEntityNotFound(_0x1b3896,null))[_0x6f8d('0x1f')](function(_0xfec292){if(_0xfec292){_0x17b3a4=_0xfec292;_0x1fb416[_0x6f8d('0x3f')]=_[_0x6f8d('0x41')](db[_0x6f8d('0x77')][_0x6f8d('0x3b')]);_0x1fb416[_0x6f8d('0x40')]=_[_0x6f8d('0x41')](_0x5e5ce4[_0x6f8d('0x40')]);_0x1fb416['filters']=_['intersection'](_0x1fb416[_0x6f8d('0x3f')],_0x1fb416[_0x6f8d('0x40')]);_0x52c9b1[_0x6f8d('0x44')]=_[_0x6f8d('0x42')](_0x1fb416['model'],qs[_0x6f8d('0x43')](_0x5e5ce4[_0x6f8d('0x40')][_0x6f8d('0x43')]));_0x52c9b1[_0x6f8d('0x44')]=_0x52c9b1[_0x6f8d('0x44')][_0x6f8d('0x45')]?_0x52c9b1[_0x6f8d('0x44')]:_0x1fb416['model'];_0x52c9b1[_0x6f8d('0x48')]=qs[_0x6f8d('0x49')](_0x5e5ce4['query'][_0x6f8d('0x49')]);_0x52c9b1['where']=qs[_0x6f8d('0x4b')](_[_0x6f8d('0x4c')](_0x5e5ce4[_0x6f8d('0x40')],_0x1fb416[_0x6f8d('0x4b')]));if(_0x5e5ce4[_0x6f8d('0x40')]['filter']){_0x52c9b1[_0x6f8d('0x4a')]=_['merge'](_0x52c9b1[_0x6f8d('0x4a')],{'$or':_[_0x6f8d('0x3a')](_0x52c9b1[_0x6f8d('0x44')],function(_0x67cfed){var _0x3ae945={};_0x3ae945[_0x67cfed]={'$like':'%'+_0x5e5ce4['query'][_0x6f8d('0x4e')]+'%'};return _0x3ae945;})});}_0x52c9b1=_['merge']({},_0x52c9b1,_0x5e5ce4[_0x6f8d('0x50')]);return _0x17b3a4[_0x6f8d('0x76')](_0x52c9b1);}})[_0x6f8d('0x1f')](function(_0x3c08e2){if(_0x3c08e2){_0x1f8da4=_0x3c08e2['length'];if(!_0x5e5ce4[_0x6f8d('0x40')][_0x6f8d('0x46')](_0x6f8d('0x47'))){_0x52c9b1[_0x6f8d('0x2f')]=qs[_0x6f8d('0x2f')](_0x5e5ce4['query'][_0x6f8d('0x2f')]);_0x52c9b1['offset']=qs['offset'](_0x5e5ce4['query'][_0x6f8d('0x2d')]);}return _0x17b3a4[_0x6f8d('0x76')](_0x52c9b1);}})[_0x6f8d('0x1f')](function(_0x3aa7e3){if(_0x3aa7e3){return _0x3aa7e3?{'count':_0x1f8da4,'rows':_0x3aa7e3}:null;}})[_0x6f8d('0x1f')](respondWithResult(_0x1b3896,null))[_0x6f8d('0x28')](handleError(_0x1b3896,null));};exports[_0x6f8d('0x78')]=function(_0x2cd1ef,_0x55f0ca){var _0x3ed2c4=_0x2cd1ef[_0x6f8d('0x60')]['id'];var _0x2086df=_0x2cd1ef['body'];var _0x364e68=0xc8;var _0x1d3601=null;return db['sequelize'][_0x6f8d('0x79')]({'isolationLevel':db[_0x6f8d('0x7a')][_0x6f8d('0x7b')][_0x6f8d('0x7c')]['READ_COMMITTED']},function(_0x28500){return db['WhatsappAccount'][_0x6f8d('0x65')]({'where':{'id':_0x3ed2c4},'transaction':_0x28500})['then'](function(_0x2093b1){if(_0x2093b1){return db[_0x6f8d('0x7d')][_0x6f8d('0x33')]({'where':{'WhatsappAccountId':_0x3ed2c4},'transaction':_0x28500})[_0x6f8d('0x1f')](function(){var _0x2bb3e9=_[_0x6f8d('0x3a')](_0x2086df,function(_0x5dd66c){_0x5dd66c[_0x6f8d('0x63')]=_0x3ed2c4;return _0x5dd66c;});return db['WhatsappApplication']['bulkCreate'](_0x2bb3e9,{'transaction':_0x28500});});}else{_0x364e68=0x194;_0x1d3601=[];}});})[_0x6f8d('0x1f')](function(){if(_0x364e68!==0x194){return db[_0x6f8d('0x7d')][_0x6f8d('0x7e')]({'where':{'WhatsappAccountId':_0x3ed2c4},'order':_0x6f8d('0x7f')})[_0x6f8d('0x1f')](function(_0x3c51b7){_0x1d3601=_0x3c51b7;});}})[_0x6f8d('0x28')](function(_0x15378b){_0x364e68=0x1f4;logger['error'](_0x15378b[_0x6f8d('0x80')]);if(_0x15378b[_0x6f8d('0x37')]){delete _0x15378b[_0x6f8d('0x37')];}_0x1d3601=_0x15378b;})['finally'](function(){if(_0x1d3601===null){_0x55f0ca['sendStatus'](_0x364e68);}else{if(_0x364e68===0x1f4){_0x55f0ca[_0x6f8d('0x2b')](_0x364e68)[_0x6f8d('0x81')](_0x1d3601);}else{_0x55f0ca[_0x6f8d('0x2b')](_0x364e68)[_0x6f8d('0x2c')](_0x1d3601);}}});};exports['getApplications']=function(_0x34c164,_0x455f7c,_0x575e10){var _0x532631={};var _0x428d5f={};var _0x23acb7;var _0x241c51;return db[_0x6f8d('0x51')][_0x6f8d('0x65')]({'where':{'id':_0x34c164[_0x6f8d('0x60')]['id']}})[_0x6f8d('0x1f')](handleEntityNotFound(_0x455f7c,null))[_0x6f8d('0x1f')](function(_0x337325){if(_0x337325){_0x23acb7=_0x337325;_0x428d5f['model']=_[_0x6f8d('0x41')](db['WhatsappApplication'][_0x6f8d('0x3b')]);_0x428d5f['query']=_[_0x6f8d('0x41')](_0x34c164['query']);_0x428d5f[_0x6f8d('0x4b')]=_[_0x6f8d('0x42')](_0x428d5f[_0x6f8d('0x3f')],_0x428d5f[_0x6f8d('0x40')]);_0x532631[_0x6f8d('0x44')]=_[_0x6f8d('0x42')](_0x428d5f[_0x6f8d('0x3f')],qs[_0x6f8d('0x43')](_0x34c164['query'][_0x6f8d('0x43')]));_0x532631[_0x6f8d('0x44')]=_0x532631[_0x6f8d('0x44')][_0x6f8d('0x45')]?_0x532631[_0x6f8d('0x44')]:_0x428d5f[_0x6f8d('0x3f')];_0x532631[_0x6f8d('0x48')]=qs['sort'](_0x34c164[_0x6f8d('0x40')][_0x6f8d('0x49')]);_0x532631['where']=qs[_0x6f8d('0x4b')](_[_0x6f8d('0x4c')](_0x34c164[_0x6f8d('0x40')],_0x428d5f[_0x6f8d('0x4b')]));if(_0x34c164[_0x6f8d('0x40')][_0x6f8d('0x4e')]){_0x532631[_0x6f8d('0x4a')]=_['merge'](_0x532631[_0x6f8d('0x4a')],{'$or':_[_0x6f8d('0x3a')](_0x532631['attributes'],function(_0x5df45b){var _0x3067ef={};_0x3067ef[_0x5df45b]={'$like':'%'+_0x34c164[_0x6f8d('0x40')][_0x6f8d('0x4e')]+'%'};return _0x3067ef;})});}_0x532631=_[_0x6f8d('0x4f')]({},_0x532631,_0x34c164['options']);return _0x23acb7[_0x6f8d('0x82')](_0x532631);}})[_0x6f8d('0x1f')](function(_0x4d32e3){if(_0x4d32e3){_0x241c51=_0x4d32e3[_0x6f8d('0x45')];if(!_0x34c164[_0x6f8d('0x40')][_0x6f8d('0x46')]('nolimit')){_0x532631['limit']=qs['limit'](_0x34c164['query'][_0x6f8d('0x2f')]);_0x532631[_0x6f8d('0x2d')]=qs[_0x6f8d('0x2d')](_0x34c164[_0x6f8d('0x40')][_0x6f8d('0x2d')]);}return _0x23acb7['getApplications'](_0x532631);}})[_0x6f8d('0x1f')](function(_0x249edc){if(_0x249edc){return _0x249edc?{'count':_0x241c51,'rows':_0x249edc}:null;}})[_0x6f8d('0x1f')](respondWithResult(_0x455f7c,null))[_0x6f8d('0x28')](handleError(_0x455f7c,null));};exports[_0x6f8d('0x83')]=function(_0x100a8e,_0x5c67f0,_0x1183ce){var _0x2fe917={'channel':_0x6f8d('0x84')};var _0x143a53=[];var _0xf590c1=[];var _0x242e59={};return db[_0x6f8d('0x51')]['find']({'where':{'id':_0x100a8e[_0x6f8d('0x60')]['id']},'include':[{'model':db[_0x6f8d('0x7d')],'as':'Applications'}]})[_0x6f8d('0x1f')](handleEntityNotFound(_0x5c67f0,null))['then'](function(_0x1b3f3e){_0x2fe917['account']=_0x1b3f3e;if(_0x2fe917[_0x6f8d('0x85')]&&_0x2fe917[_0x6f8d('0x85')][_0x6f8d('0x3d')]===_0x6f8d('0x86')&&_0x100a8e[_0x6f8d('0x59')][_0x6f8d('0x87')]){if(_0x100a8e[_0x6f8d('0x59')][_0x6f8d('0x87')][_0x6f8d('0x45')]===0x0)return;if(_0x100a8e[_0x6f8d('0x59')][_0x6f8d('0x87')][0x0][_0x6f8d('0x88')]!=='read')return;return db[_0x6f8d('0x89')]['update']({'read':!![],'readAt':_0x100a8e[_0x6f8d('0x59')]['statuses'][0x0][_0x6f8d('0x8a')]},{'where':{'messageId':_0x100a8e[_0x6f8d('0x59')][_0x6f8d('0x87')][0x0]['message_id']},'individualHooks':!![]})[_0x6f8d('0x1f')](function(_0x3e1897){return _0x5c67f0[_0x6f8d('0x2b')](0xc8)[_0x6f8d('0x2c')](_0x3e1897);});}_0x2fe917['applications']=_['orderBy'](_0x1b3f3e[_0x6f8d('0x8b')],['priority'],[_0x6f8d('0x8c')]);if(_0x2fe917[_0x6f8d('0x85')][_0x6f8d('0x8b')]){delete _0x2fe917[_0x6f8d('0x85')][_0x6f8d('0x8b')];}return db['CmContact'][_0x6f8d('0x61')]()[_0x6f8d('0x1f')](function(_0x165fb7){if(!_0x165fb7){throw new db[(_0x6f8d('0x8d'))][(_0x6f8d('0x8e'))](_0x6f8d('0x8f'));}_0x143a53=_['difference'](_[_0x6f8d('0x41')](_0x165fb7),[_0x6f8d('0x90'),'updatedAt']);_0xf590c1=_['difference'](_[_0x6f8d('0x41')](_0x165fb7),[_0x6f8d('0x90'),_0x6f8d('0x91'),_0x6f8d('0x92'),_0x6f8d('0x93')]);_0x2fe917[_0x6f8d('0x59')]={'mapKey':_0x6f8d('0x94')};if(_0x2fe917['account']&&_0x2fe917[_0x6f8d('0x85')][_0x6f8d('0x3d')]===_0x6f8d('0x95')){_0x2fe917[_0x6f8d('0x59')]['from']=_0x100a8e[_0x6f8d('0x59')][_0x6f8d('0x96')][_0x6f8d('0x97')](_0x6f8d('0x98'),'');_0x2fe917[_0x6f8d('0x59')][_0x6f8d('0x59')]=_0x100a8e['body'][_0x6f8d('0x99')];_0x2fe917[_0x6f8d('0x59')][_0x6f8d('0x9a')]=_0x100a8e[_0x6f8d('0x59')]['MessageSid'];}if(_0x2fe917[_0x6f8d('0x85')]&&_0x2fe917['account'][_0x6f8d('0x3d')]===_0x6f8d('0x86')){_0x2fe917[_0x6f8d('0x59')][_0x6f8d('0x9b')]=_0x100a8e['body'][_0x6f8d('0x9c')][0x0][_0x6f8d('0x9b')];_0x2fe917['body'][_0x6f8d('0x59')]=_0x100a8e[_0x6f8d('0x59')]['notifications'][0x0][_0x6f8d('0x26')][_0x6f8d('0x59')];_0x2fe917[_0x6f8d('0x59')][_0x6f8d('0x9a')]=_0x100a8e[_0x6f8d('0x59')][_0x6f8d('0x9c')][0x0][_0x6f8d('0x9d')];}if(_0x2fe917[_0x6f8d('0x59')]['id']){delete _0x2fe917[_0x6f8d('0x59')]['id'];}if(_[_0x6f8d('0x9e')](_0x2fe917['body'][_0x6f8d('0x9b')])){throw new db[(_0x6f8d('0x8d'))][(_0x6f8d('0x8e'))](_0x6f8d('0x9f'));}if(_[_0x6f8d('0x9e')](_0x2fe917[_0x6f8d('0x59')][_0x6f8d('0x59')])||_0x2fe917[_0x6f8d('0x59')][_0x6f8d('0x59')]===''){throw new db[(_0x6f8d('0x8d'))]['ValidationError'](_0x6f8d('0xa0'));}if(_[_0x6f8d('0x9e')](_0x2fe917[_0x6f8d('0x59')][_0x6f8d('0xa1')])){throw new db[(_0x6f8d('0x8d'))][(_0x6f8d('0x8e'))](_0x6f8d('0xa2')+_0xf590c1);}if(!_[_0x6f8d('0xa3')](_0xf590c1,_0x2fe917[_0x6f8d('0x59')][_0x6f8d('0xa1')])){throw new db[(_0x6f8d('0x8d'))][(_0x6f8d('0x8e'))](_0x6f8d('0xa4')+_0xf590c1);}_0x242e59[_0x2fe917[_0x6f8d('0x59')]['mapKey']]=_0x2fe917[_0x6f8d('0x59')][_0x6f8d('0x9b')];return db[_0x6f8d('0xa5')][_0x6f8d('0x57')]({'where':{'id':_0x2fe917[_0x6f8d('0x85')][_0x6f8d('0x93')]},'include':[{'model':db['CmContact'],'as':_0x6f8d('0xa6'),'where':_0x242e59,'limit':0x1,'order':[[_0x6f8d('0x91'),'DESC']]}]});})['then'](handleEntityNotFound(_0x5c67f0,null))[_0x6f8d('0x1f')](function(_0x44ae43){if(_0x44ae43){_0x2fe917[_0x6f8d('0xa7')]=_[_0x6f8d('0x6f')](_0x44ae43,[_0x6f8d('0xa6')]);if(_0x44ae43[_0x6f8d('0xa6')][_0x6f8d('0x45')]){return _0x44ae43['Contacts'][0x0];}var _0x69aea3=_[_0x6f8d('0x19')](_0x2fe917['body'],{'firstName':_0x2fe917[_0x6f8d('0x59')][_0x6f8d('0x9b')],'ListId':_0x44ae43['id']});_0x69aea3[_0x2fe917['body']['mapKey']]=_0x2fe917[_0x6f8d('0x59')][_0x6f8d('0x9b')];return db[_0x6f8d('0xa8')][_0x6f8d('0x58')](_0x69aea3,{'fields':_0x143a53,'raw':!![]});}})[_0x6f8d('0x1f')](handleEntityNotFound(_0x5c67f0,null))[_0x6f8d('0x1f')](function(_0x713963){if(_0x713963){_0x2fe917[_0x6f8d('0xa9')]=_0x713963;var _0x1583b7={'ContactId':_0x713963['id'],'phone':_0x2fe917[_0x6f8d('0x59')]['from'],'WhatsappAccountId':_0x100a8e[_0x6f8d('0x60')]['id']};var _0x1d99c2={'ContactId':_0x713963['id'],'WhatsappAccountId':_0x100a8e[_0x6f8d('0x60')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x6f8d('0x57')]({'where':_0x1d99c2})[_0x6f8d('0x1f')](function(_0x21d608){if(_0x21d608){return[_0x21d608,![]];}return db['WhatsappInteraction'][_0x6f8d('0x58')](_0x1583b7)[_0x6f8d('0x1f')](function(_0x2e6e44){return[_0x2e6e44,!![]];});});}})['spread'](function(_0x45f16c,_0x4668ec){_0x2fe917[_0x6f8d('0xaa')]=_0x45f16c[_0x6f8d('0x34')]({'plain':!![]});_0x2fe917['interaction'][_0x6f8d('0xab')]=![];if(_0x4668ec){if(_0x2fe917[_0x6f8d('0x85')][_0x6f8d('0xac')]){_0x2fe917[_0x6f8d('0xad')][_0x6f8d('0xae')]({'id':0x0,'priority':_0x2fe917['applications']['length']+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}_0x2fe917[_0x6f8d('0xaa')][_0x6f8d('0xab')]=!![];}return db[_0x6f8d('0x89')][_0x6f8d('0x58')]({'phone':_0x2fe917[_0x6f8d('0x59')]['from'],'messageId':_0x2fe917['body']['messageId'],'body':_0x2fe917[_0x6f8d('0x59')][_0x6f8d('0x59')],'WhatsappAccountId':_0x100a8e[_0x6f8d('0x60')]['id'],'WhatsappInteractionId':_0x45f16c['id'],'direction':'in','ContactId':_0x45f16c[_0x6f8d('0xaf')],'AttachmentId':_0x2fe917['body']['AttachmentId']});})[_0x6f8d('0x1f')](function(_0x58824a){_0x2fe917[_0x6f8d('0x26')]=_0x58824a;if(_0x2fe917[_0x6f8d('0xaa')]['UserId']){return db['User'][_0x6f8d('0x57')]({'attributes':['id',_0x6f8d('0x37')],'where':{'id':_0x2fe917[_0x6f8d('0xaa')][_0x6f8d('0xb0')]}})[_0x6f8d('0x1f')](function(_0xd8dfef){if(_0xd8dfef){_0x2fe917[_0x6f8d('0xad')][_0x6f8d('0xb1')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xd8dfef[_0x6f8d('0x37')]+','+(_0x2fe917['account'][_0x6f8d('0xb2')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x6f8d('0xb3'),_0x6f8d('0xb4'),_0x2fe917);});}return respondWithRpcPromise('Start',_0x6f8d('0xb4'),_0x2fe917);})[_0x6f8d('0x1f')](function(_0x4dfa7e){if(_0x4dfa7e){var _0x49aee2=0xc8;var _0x1da3ef=_0x6f8d('0xb5');logger['info'](_0x6f8d('0x23'),_0x1da3ef,_0x49aee2,_0x6f8d('0xb6'));logger[_0x6f8d('0xb7')](_0x6f8d('0xb8'),_0x1da3ef,_0x49aee2,_0x6f8d('0xb6'),JSON[_0x6f8d('0xb9')](_0x4dfa7e));if(_0x2fe917[_0x6f8d('0x85')]['type']===_0x6f8d('0x95')){return _0x5c67f0['status'](_0x49aee2)['set'](_0x6f8d('0xba'),'text/xml')[_0x6f8d('0x81')](_0x6f8d('0xbb'));}else{return _0x5c67f0['status'](_0x49aee2)[_0x6f8d('0x2c')](_0x4dfa7e);}}});})[_0x6f8d('0x28')](handleError(_0x5c67f0,null));};exports[_0x6f8d('0x81')]=function(_0x5b210e,_0x253c3c,_0x182ba1){var _0x20e791,_0x229929,_0x17b044;if(_[_0x6f8d('0x9e')](_0x5b210e[_0x6f8d('0x59')][_0x6f8d('0x59')])||_0x5b210e['body'][_0x6f8d('0x59')]===''){throw new db['Sequelize'][(_0x6f8d('0x8e'))](_0x6f8d('0xa0'));}if(_[_0x6f8d('0x9e')](_0x5b210e[_0x6f8d('0x59')]['to'])){throw new db[(_0x6f8d('0x8d'))][(_0x6f8d('0x8e'))](_0x6f8d('0xbc'));}_0x20e791=_0x5b210e[_0x6f8d('0x59')]['to'];return db[_0x6f8d('0x51')][_0x6f8d('0x57')]({'where':{'id':_0x5b210e['params']['id']},'include':[{'model':db[_0x6f8d('0xa5')],'as':_0x6f8d('0xbd'),'include':[{'model':db['CmContact'],'as':_0x6f8d('0xa6'),'where':{'mobile':_0x20e791},'limit':0x1,'order':[['updatedAt',_0x6f8d('0xbe')]]}]}]})[_0x6f8d('0x1f')](handleEntityNotFound(_0x253c3c,null))[_0x6f8d('0x1f')](function(_0x5854ef){if(_0x5854ef&&_0x5854ef[_0x6f8d('0xbd')]){_0x229929=_0x5854ef[_0x6f8d('0x34')]({'plain':!![]});if(_0x229929[_0x6f8d('0xbd')]&&_0x229929[_0x6f8d('0xbd')][_0x6f8d('0xa6')][_0x6f8d('0x45')]){return _0x229929[_0x6f8d('0xbd')][_0x6f8d('0xa6')][0x0];}return db['CmContact'][_0x6f8d('0x58')](_[_0x6f8d('0x19')](_0x5b210e[_0x6f8d('0x59')],{'firstName':_0x20e791,'mobile':_0x20e791,'phone':_0x20e791,'ListId':_0x229929['ListId']}));}})[_0x6f8d('0x1f')](handleEntityNotFound(_0x253c3c,null))[_0x6f8d('0x1f')](function(_0x3b4df9){if(_0x3b4df9){_0x17b044=_0x3b4df9;return db[_0x6f8d('0xbf')][_0x6f8d('0x57')]({'where':{'ContactId':_0x17b044['id'],'closed':![],'WhatsappAccountId':_0x229929['id']}})['then'](function(_0x5112f2){if(_0x5112f2){return[_0x5112f2,![]];}return db['WhatsappInteraction'][_0x6f8d('0x58')]({'UserId':_0x5b210e[_0x6f8d('0x5b')]['id'],'ContactId':_0x17b044['id'],'WhatsappAccountId':_0x229929['id'],'phone':_0x20e791,'firstMsgDirection':'out','Messages':[_[_0x6f8d('0x4f')](_0x5b210e[_0x6f8d('0x59')],{'read':![],'body':_0x5b210e['body']['body'],'phone':_0x20e791,'WhatsappAccountId':_0x229929['id'],'UserId':_0x5b210e['user']['id'],'ContactId':_0x17b044['id']})]},{'include':[{'model':db[_0x6f8d('0x89')],'as':_0x6f8d('0xc0')}]})['then'](function(_0x5797a6){return[_0x5797a6,!![]];});});}})[_0x6f8d('0x70')](function(_0x11a2bd,_0x1ba191){if(_0x1ba191){return _0x11a2bd;}return db['WhatsappMessage'][_0x6f8d('0x58')](_[_0x6f8d('0x4f')](_0x5b210e[_0x6f8d('0x59')],{'read':![],'body':_0x5b210e['body'][_0x6f8d('0x59')],'phone':_0x20e791,'WhatsappAccountId':_0x229929['id'],'WhatsappInteractionId':_0x11a2bd['id'],'UserId':_0x5b210e[_0x6f8d('0x5b')]['id'],'ContactId':_0x17b044['id']}))[_0x6f8d('0x1f')](function(_0x2cc9a0){_0x11a2bd[_0x6f8d('0xc1')][_0x6f8d('0xc0')]=[];_0x11a2bd[_0x6f8d('0xc1')][_0x6f8d('0xc0')][_0x6f8d('0xae')](_0x2cc9a0[_0x6f8d('0xc1')]);return _0x11a2bd;});})[_0x6f8d('0x1f')](respondWithResult(_0x253c3c,null))[_0x6f8d('0x28')](handleError(_0x253c3c,null));}; \ No newline at end of file +var _0xbfed=['omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','asc','CmContact','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','ListId','twilio','from','From','replace','whatsapp:','Body','notifications','messageId','Sequelize','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','CmList','DESC','list','Contacts','contact','WhatsappInteraction','interaction','created','push','close','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','request','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','WhatsappAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','map','WhatsappAccount','rawAttributes','fieldName','key','model','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','type','merge','options','includeAll','include','rows','show','mandatoryDispositionPause','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','order','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addAgents'];(function(_0x41ecb2,_0x306e02){var _0x1137d9=function(_0x4be3ef){while(--_0x4be3ef){_0x41ecb2['push'](_0x41ecb2['shift']());}};_0x1137d9(++_0x306e02);}(_0xbfed,0x114));var _0xdbfe=function(_0x673722,_0x275d7e){_0x673722=_0x673722-0x0;var _0x21249c=_0xbfed[_0x673722];return _0x21249c;};'use strict';var emlformat=require(_0xdbfe('0x0'));var rimraf=require(_0xdbfe('0x1'));var zipdir=require(_0xdbfe('0x2'));var jsonpatch=require(_0xdbfe('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdbfe('0x4'));var Mustache=require(_0xdbfe('0x5'));var util=require('util');var path=require('path');var sox=require(_0xdbfe('0x6'));var csv=require(_0xdbfe('0x7'));var ejs=require(_0xdbfe('0x8'));var fs=require('fs');var fs_extra=require(_0xdbfe('0x9'));var _=require(_0xdbfe('0xa'));var squel=require(_0xdbfe('0xb'));var crypto=require(_0xdbfe('0xc'));var jsforce=require(_0xdbfe('0xd'));var deskjs=require(_0xdbfe('0xe'));var toCsv=require(_0xdbfe('0x7'));var querystring=require(_0xdbfe('0xf'));var Papa=require(_0xdbfe('0x10'));var Redis=require('ioredis');var authService=require(_0xdbfe('0x11'));var qs=require(_0xdbfe('0x12'));var as=require(_0xdbfe('0x13'));var hardwareService=require(_0xdbfe('0x14'));var logger=require(_0xdbfe('0x15'))(_0xdbfe('0x16'));var utils=require(_0xdbfe('0x17'));var config=require(_0xdbfe('0x18'));var licenseUtil=require(_0xdbfe('0x19'));var db=require(_0xdbfe('0x1a'))['db'];config[_0xdbfe('0x1b')]=_[_0xdbfe('0x1c')](config[_0xdbfe('0x1b')],{'host':_0xdbfe('0x1d'),'port':0x18eb});var socket=require(_0xdbfe('0x1e'))(new Redis(config[_0xdbfe('0x1b')]));require(_0xdbfe('0x1f'))[_0xdbfe('0x20')](socket);var jayson=require(_0xdbfe('0x21'));var client=jayson['client'][_0xdbfe('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x439539,_0x5b406d,_0x56ac45,_0x4cba77){return new BPromise(function(_0x37ab3c,_0x7410cd){var _0x58bb60=_0x4cba77||client;return _0x58bb60[_0xdbfe('0x23')](_0x439539,_0x56ac45)['then'](function(_0x664137){logger[_0xdbfe('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0x5b406d,'request\x20sent');logger[_0xdbfe('0x25')](_0xdbfe('0x26'),_0x5b406d,_0xdbfe('0x27'),JSON[_0xdbfe('0x28')](_0x664137));if(_0x664137[_0xdbfe('0x29')]){if(_0x664137[_0xdbfe('0x29')][_0xdbfe('0x2a')]===0x1f4){logger[_0xdbfe('0x29')](_0xdbfe('0x2b'),_0x5b406d,_0x664137['error']['message']);return _0x7410cd(_0x664137[_0xdbfe('0x29')]['message']);}logger[_0xdbfe('0x29')](_0xdbfe('0x2b'),_0x5b406d,_0x664137[_0xdbfe('0x29')]['message']);return _0x37ab3c(_0x664137[_0xdbfe('0x29')][_0xdbfe('0x2c')]);}else{logger[_0xdbfe('0x24')](_0xdbfe('0x2b'),_0x5b406d,_0xdbfe('0x27'));_0x37ab3c(_0x664137[_0xdbfe('0x2d')][_0xdbfe('0x2c')]);}})[_0xdbfe('0x2e')](function(_0x31a7aa){logger[_0xdbfe('0x29')](_0xdbfe('0x2b'),_0x5b406d,_0x31a7aa);_0x7410cd(_0x31a7aa);});});}function respondWithStatusCode(_0x481d7a,_0x4b74bc){_0x4b74bc=_0x4b74bc||0xcc;return function(_0x170a83){if(_0x170a83){return _0x481d7a['sendStatus'](_0x4b74bc);}return _0x481d7a[_0xdbfe('0x2f')](_0x4b74bc)[_0xdbfe('0x30')]();};}function respondWithResult(_0x214f7b,_0x566322){_0x566322=_0x566322||0xc8;return function(_0x157089){if(_0x157089){return _0x214f7b[_0xdbfe('0x2f')](_0x566322)[_0xdbfe('0x31')](_0x157089);}};}function respondWithFilteredResult(_0x4f813c,_0x36ada3){return function(_0x51cd8c){if(_0x51cd8c){var _0x4c083c=typeof _0x36ada3[_0xdbfe('0x32')]===_0xdbfe('0x33')&&typeof _0x36ada3[_0xdbfe('0x34')]===_0xdbfe('0x33');var _0x3769f1=_0x51cd8c[_0xdbfe('0x35')];var _0x367854=_0x4c083c?0x0:_0x36ada3[_0xdbfe('0x32')];var _0x13ad7c=_0x4c083c?_0x51cd8c[_0xdbfe('0x35')]:_0x36ada3['offset']+_0x36ada3[_0xdbfe('0x34')];var _0x578790;if(_0x13ad7c>=_0x3769f1){_0x13ad7c=_0x3769f1;_0x578790=0xc8;}else{_0x578790=0xce;}_0x4f813c['status'](_0x578790);return _0x4f813c[_0xdbfe('0x36')](_0xdbfe('0x37'),_0x367854+'-'+_0x13ad7c+'/'+_0x3769f1)[_0xdbfe('0x31')](_0x51cd8c);}return null;};}function patchUpdates(_0x549211){return function(_0x184e10){try{jsonpatch[_0xdbfe('0x38')](_0x184e10,_0x549211,!![]);}catch(_0x18f4b0){return BPromise['reject'](_0x18f4b0);}return _0x184e10[_0xdbfe('0x39')]();};}function saveUpdates(_0x1532a6,_0x298053){return function(_0x2e6499){if(_0x2e6499){return _0x2e6499[_0xdbfe('0x3a')](_0x1532a6)[_0xdbfe('0x3b')](function(_0x170f28){return _0x170f28;});}return null;};}function removeEntity(_0x1509df,_0x49bcda){return function(_0x18786e){if(_0x18786e){return _0x18786e[_0xdbfe('0x3c')]()[_0xdbfe('0x3b')](function(){var _0x29db53=_0x18786e['get']({'plain':!![]});var _0x5c0380=_0xdbfe('0x3d');return db[_0xdbfe('0x3e')][_0xdbfe('0x3c')]({'where':{'type':_0x5c0380,'resourceId':_0x29db53['id']}})['then'](function(){return _0x18786e;});})[_0xdbfe('0x3b')](function(){_0x1509df['status'](0xcc)[_0xdbfe('0x30')]();});}};}function handleEntityNotFound(_0x464824,_0x539209){return function(_0xe2721d){if(!_0xe2721d){_0x464824[_0xdbfe('0x3f')](0x194);}return _0xe2721d;};}function handleError(_0x3587ef,_0x2f7569){_0x2f7569=_0x2f7569||0x1f4;return function(_0x13644b){logger[_0xdbfe('0x29')](_0x13644b[_0xdbfe('0x40')]);if(_0x13644b[_0xdbfe('0x41')]){delete _0x13644b['name'];}_0x3587ef[_0xdbfe('0x2f')](_0x2f7569)[_0xdbfe('0x42')](_0x13644b);};}exports[_0xdbfe('0x43')]=function(_0x113432,_0x48314d){var _0x56d89a={'include':[{'model':db[_0xdbfe('0x44')],'as':'mandatoryDispositionPause'}]},_0x47f0bb={},_0x1a180c={'count':0x0,'rows':[]};var _0x297d81=_[_0xdbfe('0x45')](db[_0xdbfe('0x46')][_0xdbfe('0x47')],function(_0x2d38ba){return{'name':_0x2d38ba[_0xdbfe('0x48')],'type':_0x2d38ba['type'][_0xdbfe('0x49')]};});_0x47f0bb[_0xdbfe('0x4a')]=_[_0xdbfe('0x45')](_0x297d81,'name');_0x47f0bb['query']=_[_0xdbfe('0x4b')](_0x113432['query']);_0x47f0bb['filters']=_[_0xdbfe('0x4c')](_0x47f0bb[_0xdbfe('0x4a')],_0x47f0bb[_0xdbfe('0x4d')]);_0x56d89a[_0xdbfe('0x4e')]=_[_0xdbfe('0x4c')](_0x47f0bb[_0xdbfe('0x4a')],qs[_0xdbfe('0x4f')](_0x113432[_0xdbfe('0x4d')][_0xdbfe('0x4f')]));_0x56d89a[_0xdbfe('0x4e')]=_0x56d89a['attributes']['length']?_0x56d89a[_0xdbfe('0x4e')]:_0x47f0bb[_0xdbfe('0x4a')];if(!_0x113432['query'][_0xdbfe('0x50')](_0xdbfe('0x51'))){_0x56d89a['limit']=qs['limit'](_0x113432[_0xdbfe('0x4d')]['limit']);_0x56d89a['offset']=qs[_0xdbfe('0x32')](_0x113432[_0xdbfe('0x4d')][_0xdbfe('0x32')]);}_0x56d89a['order']=qs['sort'](_0x113432[_0xdbfe('0x4d')][_0xdbfe('0x52')]);_0x56d89a[_0xdbfe('0x53')]=qs[_0xdbfe('0x54')](_[_0xdbfe('0x55')](_0x113432[_0xdbfe('0x4d')],_0x47f0bb[_0xdbfe('0x54')]),_0x297d81);if(_0x113432['query'][_0xdbfe('0x56')]){_0x56d89a[_0xdbfe('0x53')]=_['merge'](_0x56d89a[_0xdbfe('0x53')],{'$or':_[_0xdbfe('0x45')](_0x297d81,function(_0x523f3e){if(_0x523f3e[_0xdbfe('0x57')]!=='VIRTUAL'){var _0x53505f={};_0x53505f[_0x523f3e[_0xdbfe('0x41')]]={'$like':'%'+_0x113432['query'][_0xdbfe('0x56')]+'%'};return _0x53505f;}})});}_0x56d89a=_[_0xdbfe('0x58')]({},_0x56d89a,_0x113432[_0xdbfe('0x59')]);var _0x34de5c={'where':_0x56d89a['where']};return db['WhatsappAccount'][_0xdbfe('0x35')](_0x34de5c)[_0xdbfe('0x3b')](function(_0x1823c5){_0x1a180c[_0xdbfe('0x35')]=_0x1823c5;if(_0x113432[_0xdbfe('0x4d')][_0xdbfe('0x5a')]){_0x56d89a[_0xdbfe('0x5b')]=[{'all':!![]}];}return db[_0xdbfe('0x46')]['findAll'](_0x56d89a);})[_0xdbfe('0x3b')](function(_0x3c2696){_0x1a180c[_0xdbfe('0x5c')]=_0x3c2696;return _0x1a180c;})[_0xdbfe('0x3b')](respondWithFilteredResult(_0x48314d,_0x56d89a))[_0xdbfe('0x2e')](handleError(_0x48314d,null));};exports[_0xdbfe('0x5d')]=function(_0x9aa111,_0x58ea90){var _0x226f30={'raw':![],'where':{'id':_0x9aa111['params']['id']},'include':[{'model':db[_0xdbfe('0x44')],'as':_0xdbfe('0x5e')}]},_0x4dce53={};_0x4dce53['model']=_[_0xdbfe('0x4b')](db[_0xdbfe('0x46')][_0xdbfe('0x47')]);_0x4dce53[_0xdbfe('0x4d')]=_['keys'](_0x9aa111[_0xdbfe('0x4d')]);_0x4dce53['filters']=_[_0xdbfe('0x4c')](_0x4dce53[_0xdbfe('0x4a')],_0x4dce53['query']);_0x226f30[_0xdbfe('0x4e')]=_[_0xdbfe('0x4c')](_0x4dce53[_0xdbfe('0x4a')],qs[_0xdbfe('0x4f')](_0x9aa111[_0xdbfe('0x4d')]['fields']));_0x226f30[_0xdbfe('0x4e')]=_0x226f30[_0xdbfe('0x4e')][_0xdbfe('0x5f')]?_0x226f30[_0xdbfe('0x4e')]:_0x4dce53['model'];if(_0x9aa111['query'][_0xdbfe('0x5a')]){_0x226f30[_0xdbfe('0x5b')]=[{'all':!![]}];}_0x226f30=_[_0xdbfe('0x58')]({},_0x226f30,_0x9aa111['options']);return db['WhatsappAccount'][_0xdbfe('0x60')](_0x226f30)[_0xdbfe('0x3b')](handleEntityNotFound(_0x58ea90,null))[_0xdbfe('0x3b')](respondWithResult(_0x58ea90,null))['catch'](handleError(_0x58ea90,null));};exports['create']=function(_0x5844ad,_0x150b6c){return db[_0xdbfe('0x46')][_0xdbfe('0x61')](_0x5844ad[_0xdbfe('0x62')],{})['then'](function(_0x55f025){var _0x547266=_0x5844ad[_0xdbfe('0x63')][_0xdbfe('0x64')]({'plain':!![]});if(!_0x547266)throw new Error(_0xdbfe('0x65'));if(_0x547266[_0xdbfe('0x66')]==='user'){var _0x3d9cc2=_0x55f025[_0xdbfe('0x64')]({'plain':!![]});var _0xee3d6=_0xdbfe('0x3d');return db[_0xdbfe('0x67')]['find']({'where':{'name':_0xee3d6,'userProfileId':_0x547266[_0xdbfe('0x68')]},'raw':!![]})[_0xdbfe('0x3b')](function(_0x355f1e){if(_0x355f1e&&_0x355f1e[_0xdbfe('0x69')]===0x0){return db[_0xdbfe('0x3e')][_0xdbfe('0x61')]({'name':_0x3d9cc2[_0xdbfe('0x41')],'resourceId':_0x3d9cc2['id'],'type':_0x355f1e[_0xdbfe('0x41')],'sectionId':_0x355f1e['id']},{})[_0xdbfe('0x3b')](function(){return _0x55f025;});}else{return _0x55f025;}})[_0xdbfe('0x2e')](function(_0x3ae684){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ae684);throw _0x3ae684;});}return _0x55f025;})['then'](respondWithResult(_0x150b6c,0xc9))[_0xdbfe('0x2e')](handleError(_0x150b6c,null));};exports[_0xdbfe('0x3a')]=function(_0x363782,_0x367918){if(_0x363782[_0xdbfe('0x62')]['id']){delete _0x363782[_0xdbfe('0x62')]['id'];}return db[_0xdbfe('0x46')][_0xdbfe('0x60')]({'where':{'id':_0x363782[_0xdbfe('0x6a')]['id']},'include':[{'model':db['Pause'],'as':_0xdbfe('0x5e')}]})[_0xdbfe('0x3b')](handleEntityNotFound(_0x367918,null))[_0xdbfe('0x3b')](saveUpdates(_0x363782['body'],null))[_0xdbfe('0x3b')](respondWithResult(_0x367918,null))[_0xdbfe('0x2e')](handleError(_0x367918,null));};exports[_0xdbfe('0x3c')]=function(_0x2f4491,_0x5dc394){return db[_0xdbfe('0x46')][_0xdbfe('0x60')]({'where':{'id':_0x2f4491[_0xdbfe('0x6a')]['id']}})[_0xdbfe('0x3b')](handleEntityNotFound(_0x5dc394,null))[_0xdbfe('0x3b')](removeEntity(_0x5dc394,null))[_0xdbfe('0x2e')](handleError(_0x5dc394,null));};exports['describe']=function(_0x33b189,_0x2c2500){return db['WhatsappAccount'][_0xdbfe('0x6b')]()['then'](respondWithResult(_0x2c2500,null))[_0xdbfe('0x2e')](handleError(_0x2c2500,null));};exports[_0xdbfe('0x6c')]=function(_0x17cc7c,_0x808c30,_0x3693ae){if(_0x17cc7c[_0xdbfe('0x62')]['id']){delete _0x17cc7c[_0xdbfe('0x62')]['id'];}return db[_0xdbfe('0x46')][_0xdbfe('0x60')]({'where':{'id':_0x17cc7c[_0xdbfe('0x6a')]['id']}})[_0xdbfe('0x3b')](handleEntityNotFound(_0x808c30,null))[_0xdbfe('0x3b')](function(_0x3ee13a){if(_0x3ee13a){_0x17cc7c['body'][_0xdbfe('0x6d')]=_0x3ee13a['id'];return db[_0xdbfe('0x6e')][_0xdbfe('0x61')](_0x17cc7c['body']);}})[_0xdbfe('0x3b')](respondWithResult(_0x808c30,null))[_0xdbfe('0x2e')](handleError(_0x808c30,null));};exports[_0xdbfe('0x6f')]=function(_0x1434f0,_0x3cb523,_0x471478){var _0x389cf3={'raw':![],'where':{}};var _0x4d9fa9={};var _0x2b849f={'count':0x0,'rows':[]};return db[_0xdbfe('0x46')]['findOne']({'where':{'id':_0x1434f0[_0xdbfe('0x6a')]['id']}})[_0xdbfe('0x3b')](handleEntityNotFound(_0x3cb523,null))[_0xdbfe('0x3b')](function(_0x23e21e){if(_0x23e21e){_0x4d9fa9[_0xdbfe('0x4a')]=_[_0xdbfe('0x4b')](db['Disposition'][_0xdbfe('0x47')]);_0x4d9fa9['query']=_[_0xdbfe('0x4b')](_0x1434f0[_0xdbfe('0x4d')]);_0x4d9fa9[_0xdbfe('0x54')]=_[_0xdbfe('0x4c')](_0x4d9fa9['model'],_0x4d9fa9[_0xdbfe('0x4d')]);_0x389cf3['attributes']=_[_0xdbfe('0x4c')](_0x4d9fa9[_0xdbfe('0x4a')],qs[_0xdbfe('0x4f')](_0x1434f0[_0xdbfe('0x4d')][_0xdbfe('0x4f')]));_0x389cf3[_0xdbfe('0x4e')]=_0x389cf3[_0xdbfe('0x4e')][_0xdbfe('0x5f')]?_0x389cf3['attributes']:_0x4d9fa9[_0xdbfe('0x4a')];if(!_0x1434f0[_0xdbfe('0x4d')][_0xdbfe('0x50')](_0xdbfe('0x51'))){_0x389cf3[_0xdbfe('0x34')]=qs[_0xdbfe('0x34')](_0x1434f0['query'][_0xdbfe('0x34')]);_0x389cf3['offset']=qs[_0xdbfe('0x32')](_0x1434f0[_0xdbfe('0x4d')][_0xdbfe('0x32')]);}_0x389cf3[_0xdbfe('0x70')]=qs[_0xdbfe('0x52')](_0x1434f0[_0xdbfe('0x4d')][_0xdbfe('0x52')]);_0x389cf3['where']=qs[_0xdbfe('0x54')](_['pick'](_0x1434f0['query'],_0x4d9fa9[_0xdbfe('0x54')]));_0x389cf3['where']['WhatsappAccountId']=_0x23e21e['id'];if(_0x1434f0['query'][_0xdbfe('0x56')]){_0x389cf3[_0xdbfe('0x53')]=_[_0xdbfe('0x58')](_0x389cf3[_0xdbfe('0x53')],{'$or':_[_0xdbfe('0x45')](_0x389cf3[_0xdbfe('0x4e')],function(_0x7080){var _0x5e57b0={};_0x5e57b0[_0x7080]={'$like':'%'+_0x1434f0[_0xdbfe('0x4d')][_0xdbfe('0x56')]+'%'};return _0x5e57b0;})});}_0x389cf3=_[_0xdbfe('0x58')]({},_0x389cf3,_0x1434f0[_0xdbfe('0x59')]);return db[_0xdbfe('0x6e')][_0xdbfe('0x35')]({'where':_0x389cf3[_0xdbfe('0x53')]})[_0xdbfe('0x3b')](function(_0x1714f8){_0x2b849f[_0xdbfe('0x35')]=_0x1714f8;if(_0x1434f0[_0xdbfe('0x4d')][_0xdbfe('0x5a')]){_0x389cf3[_0xdbfe('0x5b')]=[{'all':!![]}];}return db[_0xdbfe('0x6e')][_0xdbfe('0x71')](_0x389cf3);})[_0xdbfe('0x3b')](function(_0x3d37ea){_0x2b849f[_0xdbfe('0x5c')]=_0x3d37ea;return _0x2b849f;});}})['then'](respondWithFilteredResult(_0x3cb523,_0x389cf3))[_0xdbfe('0x2e')](handleError(_0x3cb523,null));};exports[_0xdbfe('0x72')]=function(_0x516e28,_0x3e3928,_0x346c70){return db[_0xdbfe('0x46')][_0xdbfe('0x60')]({'where':{'id':_0x516e28['params']['id']}})[_0xdbfe('0x3b')](handleEntityNotFound(_0x3e3928,null))[_0xdbfe('0x3b')](function(_0xa76355){if(_0xa76355){return _0xa76355['removeDispositions'](_0x516e28[_0xdbfe('0x4d')][_0xdbfe('0x73')]);}})[_0xdbfe('0x3b')](respondWithStatusCode(_0x3e3928,null))[_0xdbfe('0x2e')](handleError(_0x3e3928,null));};exports[_0xdbfe('0x74')]=function(_0x212bc8,_0x44e280,_0x523b99){if(_0x212bc8[_0xdbfe('0x62')]['id']){delete _0x212bc8['body']['id'];}return db[_0xdbfe('0x46')]['find']({'where':{'id':_0x212bc8['params']['id']}})[_0xdbfe('0x3b')](handleEntityNotFound(_0x44e280,null))[_0xdbfe('0x3b')](function(_0x380232){if(_0x380232){_0x212bc8['body']['WhatsappAccountId']=_0x380232['id'];return db[_0xdbfe('0x75')][_0xdbfe('0x61')](_0x212bc8['body']);}})[_0xdbfe('0x3b')](respondWithResult(_0x44e280,null))['catch'](handleError(_0x44e280,null));};exports[_0xdbfe('0x76')]=function(_0x494386,_0x27f23b,_0x23c62e){var _0x3d3ade={'raw':![],'where':{}};var _0x15fff4={};var _0x4dd673={'count':0x0,'rows':[]};return db[_0xdbfe('0x46')][_0xdbfe('0x77')]({'where':{'id':_0x494386[_0xdbfe('0x6a')]['id']}})[_0xdbfe('0x3b')](handleEntityNotFound(_0x27f23b,null))[_0xdbfe('0x3b')](function(_0x1785fc){if(_0x1785fc){_0x15fff4[_0xdbfe('0x4a')]=_[_0xdbfe('0x4b')](db[_0xdbfe('0x75')][_0xdbfe('0x47')]);_0x15fff4[_0xdbfe('0x4d')]=_[_0xdbfe('0x4b')](_0x494386[_0xdbfe('0x4d')]);_0x15fff4[_0xdbfe('0x54')]=_['intersection'](_0x15fff4['model'],_0x15fff4[_0xdbfe('0x4d')]);_0x3d3ade[_0xdbfe('0x4e')]=_[_0xdbfe('0x4c')](_0x15fff4['model'],qs[_0xdbfe('0x4f')](_0x494386['query'][_0xdbfe('0x4f')]));_0x3d3ade[_0xdbfe('0x4e')]=_0x3d3ade[_0xdbfe('0x4e')][_0xdbfe('0x5f')]?_0x3d3ade[_0xdbfe('0x4e')]:_0x15fff4[_0xdbfe('0x4a')];if(!_0x494386[_0xdbfe('0x4d')][_0xdbfe('0x50')](_0xdbfe('0x51'))){_0x3d3ade[_0xdbfe('0x34')]=qs['limit'](_0x494386[_0xdbfe('0x4d')][_0xdbfe('0x34')]);_0x3d3ade['offset']=qs[_0xdbfe('0x32')](_0x494386['query'][_0xdbfe('0x32')]);}_0x3d3ade['order']=qs[_0xdbfe('0x52')](_0x494386[_0xdbfe('0x4d')]['sort']);_0x3d3ade[_0xdbfe('0x53')]=qs[_0xdbfe('0x54')](_[_0xdbfe('0x55')](_0x494386[_0xdbfe('0x4d')],_0x15fff4[_0xdbfe('0x54')]));_0x3d3ade[_0xdbfe('0x53')][_0xdbfe('0x6d')]=_0x1785fc['id'];if(_0x494386[_0xdbfe('0x4d')][_0xdbfe('0x56')]){_0x3d3ade[_0xdbfe('0x53')]=_[_0xdbfe('0x58')](_0x3d3ade['where'],{'$or':_['map'](_0x3d3ade[_0xdbfe('0x4e')],function(_0x409189){var _0x5808ef={};_0x5808ef[_0x409189]={'$like':'%'+_0x494386[_0xdbfe('0x4d')]['filter']+'%'};return _0x5808ef;})});}_0x3d3ade=_[_0xdbfe('0x58')]({},_0x3d3ade,_0x494386[_0xdbfe('0x59')]);return db[_0xdbfe('0x75')][_0xdbfe('0x35')]({'where':_0x3d3ade[_0xdbfe('0x53')]})[_0xdbfe('0x3b')](function(_0x35ca37){_0x4dd673[_0xdbfe('0x35')]=_0x35ca37;if(_0x494386[_0xdbfe('0x4d')][_0xdbfe('0x5a')]){_0x3d3ade[_0xdbfe('0x5b')]=[{'all':!![]}];}return db[_0xdbfe('0x75')][_0xdbfe('0x71')](_0x3d3ade);})['then'](function(_0x4feb76){_0x4dd673[_0xdbfe('0x5c')]=_0x4feb76;return _0x4dd673;});}})['then'](respondWithFilteredResult(_0x27f23b,_0x3d3ade))[_0xdbfe('0x2e')](handleError(_0x27f23b,null));};exports[_0xdbfe('0x78')]=function(_0x1afb53,_0x1746eb,_0x2125dd){return db[_0xdbfe('0x46')][_0xdbfe('0x60')]({'where':{'id':_0x1afb53[_0xdbfe('0x6a')]['id']}})[_0xdbfe('0x3b')](handleEntityNotFound(_0x1746eb,null))[_0xdbfe('0x3b')](function(_0x3e6bab){if(_0x3e6bab){return _0x3e6bab[_0xdbfe('0x78')](_0x1afb53[_0xdbfe('0x4d')][_0xdbfe('0x73')]);}})['then'](respondWithStatusCode(_0x1746eb,null))[_0xdbfe('0x2e')](handleError(_0x1746eb,null));};exports[_0xdbfe('0x79')]=function(_0x3345b6,_0x5d1b61,_0x4e4fd1){return db[_0xdbfe('0x46')][_0xdbfe('0x60')]({'where':{'id':_0x3345b6[_0xdbfe('0x6a')]['id']}})['then'](handleEntityNotFound(_0x5d1b61,null))[_0xdbfe('0x3b')](function(_0x15e569){if(_0x15e569){return _0x15e569[_0xdbfe('0x79')](_0x3345b6[_0xdbfe('0x62')][_0xdbfe('0x73')],_[_0xdbfe('0x7a')](_0x3345b6['body'],[_0xdbfe('0x73'),'id'])||{})[_0xdbfe('0x7b')](function(_0x44c183){for(var _0x2c535d=0x0;_0x2c535d<_0x3345b6[_0xdbfe('0x62')]['ids'][_0xdbfe('0x5f')];_0x2c535d+=0x1){socket[_0xdbfe('0x7c')]('userWhatsappAccount:save',{'UserId':Number(_0x3345b6[_0xdbfe('0x62')][_0xdbfe('0x73')][_0x2c535d]),'WhatsappAccountId':Number(_0x3345b6[_0xdbfe('0x6a')]['id'])});}return _0x44c183;});}})[_0xdbfe('0x3b')](respondWithResult(_0x5d1b61,null))['catch'](handleError(_0x5d1b61,null));};exports[_0xdbfe('0x7d')]=function(_0x4cfe60,_0x7d6ac7,_0x1568df){return db[_0xdbfe('0x46')][_0xdbfe('0x60')]({'where':{'id':_0x4cfe60[_0xdbfe('0x6a')]['id']}})['then'](handleEntityNotFound(_0x7d6ac7,null))['then'](function(_0x4c8b14){if(_0x4c8b14){return _0x4c8b14['removeAgents'](_0x4cfe60['query'][_0xdbfe('0x73')])[_0xdbfe('0x3b')](function(){if(_[_0xdbfe('0x7e')](_0x4cfe60['query'][_0xdbfe('0x73')])){for(var _0x2b0dbd=0x0;_0x2b0dbd<_0x4cfe60[_0xdbfe('0x4d')][_0xdbfe('0x73')][_0xdbfe('0x5f')];_0x2b0dbd+=0x1){socket['emit'](_0xdbfe('0x7f'),{'UserId':Number(_0x4cfe60['query']['ids'][_0x2b0dbd]),'WhatsappAccountId':Number(_0x4cfe60[_0xdbfe('0x6a')]['id'])});}}else{socket['emit'](_0xdbfe('0x7f'),{'UserId':Number(_0x4cfe60['query'][_0xdbfe('0x73')]),'WhatsappAccountId':Number(_0x4cfe60['params']['id'])});}});}})['then'](respondWithStatusCode(_0x7d6ac7,null))['catch'](handleError(_0x7d6ac7,null));};exports[_0xdbfe('0x80')]=function(_0x45eed9,_0xcb2326,_0x3e6f5e){var _0xadbc5a={};var _0x293b43={};var _0x1696f8;var _0x56a152;return db[_0xdbfe('0x46')][_0xdbfe('0x77')]({'where':{'id':_0x45eed9[_0xdbfe('0x6a')]['id']}})[_0xdbfe('0x3b')](handleEntityNotFound(_0xcb2326,null))[_0xdbfe('0x3b')](function(_0x54c9aa){if(_0x54c9aa){_0x1696f8=_0x54c9aa;_0x293b43['model']=_['keys'](db[_0xdbfe('0x81')][_0xdbfe('0x47')]);_0x293b43['query']=_[_0xdbfe('0x4b')](_0x45eed9['query']);_0x293b43[_0xdbfe('0x54')]=_[_0xdbfe('0x4c')](_0x293b43[_0xdbfe('0x4a')],_0x293b43[_0xdbfe('0x4d')]);_0xadbc5a[_0xdbfe('0x4e')]=_[_0xdbfe('0x4c')](_0x293b43[_0xdbfe('0x4a')],qs['fields'](_0x45eed9[_0xdbfe('0x4d')][_0xdbfe('0x4f')]));_0xadbc5a[_0xdbfe('0x4e')]=_0xadbc5a[_0xdbfe('0x4e')][_0xdbfe('0x5f')]?_0xadbc5a['attributes']:_0x293b43[_0xdbfe('0x4a')];_0xadbc5a[_0xdbfe('0x70')]=qs[_0xdbfe('0x52')](_0x45eed9[_0xdbfe('0x4d')]['sort']);_0xadbc5a[_0xdbfe('0x53')]=qs[_0xdbfe('0x54')](_[_0xdbfe('0x55')](_0x45eed9[_0xdbfe('0x4d')],_0x293b43[_0xdbfe('0x54')]));if(_0x45eed9[_0xdbfe('0x4d')][_0xdbfe('0x56')]){_0xadbc5a['where']=_['merge'](_0xadbc5a[_0xdbfe('0x53')],{'$or':_[_0xdbfe('0x45')](_0xadbc5a['attributes'],function(_0xa8bd4a){var _0x160535={};_0x160535[_0xa8bd4a]={'$like':'%'+_0x45eed9[_0xdbfe('0x4d')][_0xdbfe('0x56')]+'%'};return _0x160535;})});}_0xadbc5a=_[_0xdbfe('0x58')]({},_0xadbc5a,_0x45eed9[_0xdbfe('0x59')]);return _0x1696f8[_0xdbfe('0x80')](_0xadbc5a);}})[_0xdbfe('0x3b')](function(_0x255f08){if(_0x255f08){_0x56a152=_0x255f08[_0xdbfe('0x5f')];if(!_0x45eed9['query']['hasOwnProperty']('nolimit')){_0xadbc5a[_0xdbfe('0x34')]=qs['limit'](_0x45eed9[_0xdbfe('0x4d')][_0xdbfe('0x34')]);_0xadbc5a[_0xdbfe('0x32')]=qs['offset'](_0x45eed9[_0xdbfe('0x4d')][_0xdbfe('0x32')]);}return _0x1696f8[_0xdbfe('0x80')](_0xadbc5a);}})[_0xdbfe('0x3b')](function(_0x3433f0){if(_0x3433f0){return _0x3433f0?{'count':_0x56a152,'rows':_0x3433f0}:null;}})[_0xdbfe('0x3b')](respondWithResult(_0xcb2326,null))[_0xdbfe('0x2e')](handleError(_0xcb2326,null));};exports[_0xdbfe('0x82')]=function(_0xd7d380,_0x179584){var _0x5530ed=_0xd7d380[_0xdbfe('0x6a')]['id'];var _0x1607eb=_0xd7d380['body'];var _0x8b341=0xc8;var _0x2ecdb6=null;return db['sequelize']['transaction']({'isolationLevel':db[_0xdbfe('0x83')]['Transaction'][_0xdbfe('0x84')][_0xdbfe('0x85')]},function(_0x3d6636){return db[_0xdbfe('0x46')][_0xdbfe('0x77')]({'where':{'id':_0x5530ed},'transaction':_0x3d6636})[_0xdbfe('0x3b')](function(_0x514603){if(_0x514603){return db[_0xdbfe('0x86')][_0xdbfe('0x3c')]({'where':{'WhatsappAccountId':_0x5530ed},'transaction':_0x3d6636})['then'](function(){var _0xf0f73e=_[_0xdbfe('0x45')](_0x1607eb,function(_0x29a3df){_0x29a3df[_0xdbfe('0x6d')]=_0x5530ed;return _0x29a3df;});return db[_0xdbfe('0x86')]['bulkCreate'](_0xf0f73e,{'transaction':_0x3d6636});});}else{_0x8b341=0x194;_0x2ecdb6=[];}});})[_0xdbfe('0x3b')](function(){if(_0x8b341!==0x194){return db[_0xdbfe('0x86')][_0xdbfe('0x87')]({'where':{'WhatsappAccountId':_0x5530ed},'order':'priority'})['then'](function(_0xb17809){_0x2ecdb6=_0xb17809;});}})[_0xdbfe('0x2e')](function(_0x3ce68f){_0x8b341=0x1f4;logger['error'](_0x3ce68f[_0xdbfe('0x40')]);if(_0x3ce68f[_0xdbfe('0x41')]){delete _0x3ce68f[_0xdbfe('0x41')];}_0x2ecdb6=_0x3ce68f;})[_0xdbfe('0x88')](function(){if(_0x2ecdb6===null){_0x179584[_0xdbfe('0x3f')](_0x8b341);}else{if(_0x8b341===0x1f4){_0x179584['status'](_0x8b341)['send'](_0x2ecdb6);}else{_0x179584[_0xdbfe('0x2f')](_0x8b341)[_0xdbfe('0x31')](_0x2ecdb6);}}});};exports['getApplications']=function(_0x4a3d0d,_0x1b7a2c,_0x5f41c6){var _0x53f9bc={};var _0x505478={};var _0x18cc8c;var _0x54b28c;return db[_0xdbfe('0x46')]['findOne']({'where':{'id':_0x4a3d0d['params']['id']}})[_0xdbfe('0x3b')](handleEntityNotFound(_0x1b7a2c,null))['then'](function(_0x3a5e7d){if(_0x3a5e7d){_0x18cc8c=_0x3a5e7d;_0x505478[_0xdbfe('0x4a')]=_[_0xdbfe('0x4b')](db[_0xdbfe('0x86')]['rawAttributes']);_0x505478[_0xdbfe('0x4d')]=_[_0xdbfe('0x4b')](_0x4a3d0d['query']);_0x505478['filters']=_[_0xdbfe('0x4c')](_0x505478[_0xdbfe('0x4a')],_0x505478['query']);_0x53f9bc['attributes']=_[_0xdbfe('0x4c')](_0x505478[_0xdbfe('0x4a')],qs['fields'](_0x4a3d0d[_0xdbfe('0x4d')]['fields']));_0x53f9bc[_0xdbfe('0x4e')]=_0x53f9bc[_0xdbfe('0x4e')][_0xdbfe('0x5f')]?_0x53f9bc[_0xdbfe('0x4e')]:_0x505478[_0xdbfe('0x4a')];_0x53f9bc[_0xdbfe('0x70')]=qs['sort'](_0x4a3d0d[_0xdbfe('0x4d')][_0xdbfe('0x52')]);_0x53f9bc[_0xdbfe('0x53')]=qs[_0xdbfe('0x54')](_[_0xdbfe('0x55')](_0x4a3d0d[_0xdbfe('0x4d')],_0x505478[_0xdbfe('0x54')]));if(_0x4a3d0d[_0xdbfe('0x4d')][_0xdbfe('0x56')]){_0x53f9bc[_0xdbfe('0x53')]=_[_0xdbfe('0x58')](_0x53f9bc[_0xdbfe('0x53')],{'$or':_[_0xdbfe('0x45')](_0x53f9bc[_0xdbfe('0x4e')],function(_0x517f26){var _0x10c4e7={};_0x10c4e7[_0x517f26]={'$like':'%'+_0x4a3d0d[_0xdbfe('0x4d')][_0xdbfe('0x56')]+'%'};return _0x10c4e7;})});}_0x53f9bc=_[_0xdbfe('0x58')]({},_0x53f9bc,_0x4a3d0d[_0xdbfe('0x59')]);return _0x18cc8c['getApplications'](_0x53f9bc);}})[_0xdbfe('0x3b')](function(_0x154539){if(_0x154539){_0x54b28c=_0x154539[_0xdbfe('0x5f')];if(!_0x4a3d0d[_0xdbfe('0x4d')][_0xdbfe('0x50')](_0xdbfe('0x51'))){_0x53f9bc[_0xdbfe('0x34')]=qs[_0xdbfe('0x34')](_0x4a3d0d[_0xdbfe('0x4d')][_0xdbfe('0x34')]);_0x53f9bc['offset']=qs[_0xdbfe('0x32')](_0x4a3d0d['query']['offset']);}return _0x18cc8c[_0xdbfe('0x89')](_0x53f9bc);}})[_0xdbfe('0x3b')](function(_0x3d7c89){if(_0x3d7c89){return _0x3d7c89?{'count':_0x54b28c,'rows':_0x3d7c89}:null;}})['then'](respondWithResult(_0x1b7a2c,null))[_0xdbfe('0x2e')](handleError(_0x1b7a2c,null));};exports[_0xdbfe('0x8a')]=function(_0x55017f,_0x56cf8e,_0x5b655f){var _0x49dc5a={'channel':_0xdbfe('0x8b')};var _0x103981=[];var _0xe9b2d0=[];var _0x5b3486={};return db['WhatsappAccount'][_0xdbfe('0x60')]({'where':{'id':_0x55017f[_0xdbfe('0x6a')]['id']},'include':[{'model':db[_0xdbfe('0x86')],'as':_0xdbfe('0x8c')}]})[_0xdbfe('0x3b')](handleEntityNotFound(_0x56cf8e,null))[_0xdbfe('0x3b')](function(_0x7b0b3b){_0x49dc5a[_0xdbfe('0x8d')]=_0x7b0b3b;if(_0x49dc5a[_0xdbfe('0x8d')]&&_0x49dc5a[_0xdbfe('0x8d')]['type']===_0xdbfe('0x8e')&&_0x55017f['body'][_0xdbfe('0x8f')]){if(_0x55017f[_0xdbfe('0x62')][_0xdbfe('0x8f')][_0xdbfe('0x5f')]===0x0)return;if(_0x55017f[_0xdbfe('0x62')][_0xdbfe('0x8f')][0x0][_0xdbfe('0x90')]!==_0xdbfe('0x91'))return;return db[_0xdbfe('0x92')][_0xdbfe('0x3a')]({'read':!![],'readAt':_0x55017f[_0xdbfe('0x62')][_0xdbfe('0x8f')][0x0][_0xdbfe('0x93')]},{'where':{'messageId':_0x55017f[_0xdbfe('0x62')][_0xdbfe('0x8f')][0x0][_0xdbfe('0x94')]},'individualHooks':!![]})[_0xdbfe('0x3b')](function(_0x5b590f){return _0x56cf8e['status'](0xc8)[_0xdbfe('0x31')](_0x5b590f);});}_0x49dc5a[_0xdbfe('0x95')]=_[_0xdbfe('0x96')](_0x7b0b3b[_0xdbfe('0x8c')],['priority'],[_0xdbfe('0x97')]);if(_0x49dc5a[_0xdbfe('0x8d')][_0xdbfe('0x8c')]){delete _0x49dc5a[_0xdbfe('0x8d')][_0xdbfe('0x8c')];}return db[_0xdbfe('0x98')][_0xdbfe('0x6b')]()['then'](function(_0x378196){if(!_0x378196){throw new db['Sequelize'][(_0xdbfe('0x99'))](_0xdbfe('0x9a'));}_0x103981=_['difference'](_['keys'](_0x378196),[_0xdbfe('0x9b'),_0xdbfe('0x9c')]);_0xe9b2d0=_[_0xdbfe('0x9d')](_[_0xdbfe('0x4b')](_0x378196),[_0xdbfe('0x9b'),_0xdbfe('0x9c'),'CompanyId',_0xdbfe('0x9e')]);_0x49dc5a[_0xdbfe('0x62')]={'mapKey':'mobile'};if(_0x49dc5a[_0xdbfe('0x8d')]&&_0x49dc5a[_0xdbfe('0x8d')]['type']===_0xdbfe('0x9f')){_0x49dc5a[_0xdbfe('0x62')][_0xdbfe('0xa0')]=_0x55017f[_0xdbfe('0x62')][_0xdbfe('0xa1')][_0xdbfe('0xa2')](_0xdbfe('0xa3'),'');_0x49dc5a[_0xdbfe('0x62')]['body']=_0x55017f[_0xdbfe('0x62')][_0xdbfe('0xa4')];_0x49dc5a['body']['messageId']=_0x55017f[_0xdbfe('0x62')]['MessageSid'];}if(_0x49dc5a[_0xdbfe('0x8d')]&&_0x49dc5a[_0xdbfe('0x8d')][_0xdbfe('0x57')]===_0xdbfe('0x8e')){_0x49dc5a[_0xdbfe('0x62')][_0xdbfe('0xa0')]=_0x55017f[_0xdbfe('0x62')][_0xdbfe('0xa5')][0x0]['from'];_0x49dc5a[_0xdbfe('0x62')][_0xdbfe('0x62')]=_0x55017f[_0xdbfe('0x62')]['notifications'][0x0][_0xdbfe('0x2c')][_0xdbfe('0x62')];_0x49dc5a[_0xdbfe('0x62')][_0xdbfe('0xa6')]=_0x55017f[_0xdbfe('0x62')][_0xdbfe('0xa5')][0x0]['message_id'];}if(_0x49dc5a[_0xdbfe('0x62')]['id']){delete _0x49dc5a['body']['id'];}if(_['isNil'](_0x49dc5a[_0xdbfe('0x62')][_0xdbfe('0xa0')])){throw new db[(_0xdbfe('0xa7'))][(_0xdbfe('0x99'))](_0xdbfe('0xa8'));}if(_[_0xdbfe('0xa9')](_0x49dc5a[_0xdbfe('0x62')][_0xdbfe('0x62')])||_0x49dc5a[_0xdbfe('0x62')][_0xdbfe('0x62')]===''){throw new db[(_0xdbfe('0xa7'))][(_0xdbfe('0x99'))](_0xdbfe('0xaa'));}if(_[_0xdbfe('0xa9')](_0x49dc5a[_0xdbfe('0x62')][_0xdbfe('0xab')])){throw new db[(_0xdbfe('0xa7'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xe9b2d0);}if(!_[_0xdbfe('0xac')](_0xe9b2d0,_0x49dc5a[_0xdbfe('0x62')][_0xdbfe('0xab')])){throw new db[(_0xdbfe('0xa7'))][(_0xdbfe('0x99'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xe9b2d0);}_0x5b3486[_0x49dc5a['body'][_0xdbfe('0xab')]]=_0x49dc5a[_0xdbfe('0x62')][_0xdbfe('0xa0')];return db[_0xdbfe('0xad')][_0xdbfe('0x60')]({'where':{'id':_0x49dc5a[_0xdbfe('0x8d')][_0xdbfe('0x9e')]},'include':[{'model':db[_0xdbfe('0x98')],'as':'Contacts','where':_0x5b3486,'limit':0x1,'order':[[_0xdbfe('0x9c'),_0xdbfe('0xae')]]}]});})[_0xdbfe('0x3b')](handleEntityNotFound(_0x56cf8e,null))[_0xdbfe('0x3b')](function(_0xc51054){if(_0xc51054){_0x49dc5a[_0xdbfe('0xaf')]=_[_0xdbfe('0x7a')](_0xc51054,[_0xdbfe('0xb0')]);if(_0xc51054[_0xdbfe('0xb0')][_0xdbfe('0x5f')]){return _0xc51054['Contacts'][0x0];}var _0x57301d=_[_0xdbfe('0x1c')](_0x49dc5a[_0xdbfe('0x62')],{'firstName':_0x49dc5a[_0xdbfe('0x62')][_0xdbfe('0xa0')],'ListId':_0xc51054['id']});_0x57301d[_0x49dc5a[_0xdbfe('0x62')][_0xdbfe('0xab')]]=_0x49dc5a[_0xdbfe('0x62')][_0xdbfe('0xa0')];return db[_0xdbfe('0x98')][_0xdbfe('0x61')](_0x57301d,{'fields':_0x103981,'raw':!![]});}})[_0xdbfe('0x3b')](handleEntityNotFound(_0x56cf8e,null))[_0xdbfe('0x3b')](function(_0x5d8fbb){if(_0x5d8fbb){_0x49dc5a[_0xdbfe('0xb1')]=_0x5d8fbb;var _0x5dc00a={'ContactId':_0x5d8fbb['id'],'phone':_0x49dc5a[_0xdbfe('0x62')][_0xdbfe('0xa0')],'WhatsappAccountId':_0x55017f['params']['id']};var _0x2baf50={'ContactId':_0x5d8fbb['id'],'WhatsappAccountId':_0x55017f[_0xdbfe('0x6a')]['id'],'closed':![]};return db[_0xdbfe('0xb2')][_0xdbfe('0x60')]({'where':_0x2baf50})[_0xdbfe('0x3b')](function(_0x348281){if(_0x348281){return[_0x348281,![]];}return db[_0xdbfe('0xb2')]['create'](_0x5dc00a)['then'](function(_0x224d23){return[_0x224d23,!![]];});});}})[_0xdbfe('0x7b')](function(_0x1786e7,_0xc412d7){_0x49dc5a[_0xdbfe('0xb3')]=_0x1786e7[_0xdbfe('0x64')]({'plain':!![]});_0x49dc5a[_0xdbfe('0xb3')][_0xdbfe('0xb4')]=![];if(_0xc412d7){if(_0x49dc5a[_0xdbfe('0x8d')]['autoclose']){_0x49dc5a[_0xdbfe('0x95')][_0xdbfe('0xb5')]({'id':0x0,'priority':_0x49dc5a[_0xdbfe('0x95')][_0xdbfe('0x5f')]+0x1,'app':_0xdbfe('0xb6'),'appdata':'unmanaged','interval':_0xdbfe('0xb7')});}_0x49dc5a[_0xdbfe('0xb3')][_0xdbfe('0xb4')]=!![];}return db['WhatsappMessage'][_0xdbfe('0x61')]({'phone':_0x49dc5a['body'][_0xdbfe('0xa0')],'messageId':_0x49dc5a['body'][_0xdbfe('0xa6')],'body':_0x49dc5a[_0xdbfe('0x62')][_0xdbfe('0x62')],'WhatsappAccountId':_0x55017f[_0xdbfe('0x6a')]['id'],'WhatsappInteractionId':_0x1786e7['id'],'direction':'in','ContactId':_0x1786e7[_0xdbfe('0xb8')],'AttachmentId':_0x49dc5a[_0xdbfe('0x62')][_0xdbfe('0xb9')]});})[_0xdbfe('0x3b')](function(_0x14e7ad){_0x49dc5a['message']=_0x14e7ad;if(_0x49dc5a[_0xdbfe('0xb3')][_0xdbfe('0xba')]){return db[_0xdbfe('0x81')][_0xdbfe('0x60')]({'attributes':['id',_0xdbfe('0x41')],'where':{'id':_0x49dc5a['interaction'][_0xdbfe('0xba')]}})[_0xdbfe('0x3b')](function(_0x5212cb){if(_0x5212cb){_0x49dc5a['applications'][_0xdbfe('0xbb')]({'id':0x0,'priority':0x0,'app':_0xdbfe('0xbc'),'appdata':_0x5212cb[_0xdbfe('0x41')]+','+(_0x49dc5a[_0xdbfe('0x8d')][_0xdbfe('0xbd')]||0xa),'interval':_0xdbfe('0xb7')});}return respondWithRpcPromise(_0xdbfe('0xbe'),_0xdbfe('0xbf'),_0x49dc5a);});}return respondWithRpcPromise('Start','startRouting',_0x49dc5a);})[_0xdbfe('0x3b')](function(_0x4f8abe){if(_0x4f8abe){var _0xdaea74=0xc8;var _0x16e7fe='receiveMessage';logger[_0xdbfe('0x24')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x16e7fe,_0xdaea74,_0xdbfe('0xc0'));logger[_0xdbfe('0x25')](_0xdbfe('0xc1'),_0x16e7fe,_0xdaea74,_0xdbfe('0xc0'),JSON[_0xdbfe('0x28')](_0x4f8abe));if(_0x49dc5a['account'][_0xdbfe('0x57')]==='twilio'){return _0x56cf8e['status'](_0xdaea74)[_0xdbfe('0x36')]('Content-Type','text/xml')['send']('\x0a');}else{return _0x56cf8e[_0xdbfe('0x2f')](_0xdaea74)[_0xdbfe('0x31')](_0x4f8abe);}}});})[_0xdbfe('0x2e')](handleError(_0x56cf8e,null));};exports[_0xdbfe('0x42')]=function(_0x4c3796,_0x10cf1d,_0x297c26){var _0x292ce1,_0x2c7086,_0xe8a0d5;if(_[_0xdbfe('0xa9')](_0x4c3796['body'][_0xdbfe('0x62')])||_0x4c3796[_0xdbfe('0x62')][_0xdbfe('0x62')]===''){throw new db[(_0xdbfe('0xa7'))][(_0xdbfe('0x99'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x4c3796[_0xdbfe('0x62')]['to'])){throw new db[(_0xdbfe('0xa7'))][(_0xdbfe('0x99'))](_0xdbfe('0xc2'));}_0x292ce1=_0x4c3796[_0xdbfe('0x62')]['to'];return db[_0xdbfe('0x46')][_0xdbfe('0x60')]({'where':{'id':_0x4c3796['params']['id']},'include':[{'model':db[_0xdbfe('0xad')],'as':'List','include':[{'model':db[_0xdbfe('0x98')],'as':_0xdbfe('0xb0'),'where':{'mobile':_0x292ce1},'limit':0x1,'order':[['updatedAt',_0xdbfe('0xae')]]}]}]})[_0xdbfe('0x3b')](handleEntityNotFound(_0x10cf1d,null))[_0xdbfe('0x3b')](function(_0x543423){if(_0x543423&&_0x543423[_0xdbfe('0xc3')]){_0x2c7086=_0x543423['get']({'plain':!![]});if(_0x2c7086[_0xdbfe('0xc3')]&&_0x2c7086['List'][_0xdbfe('0xb0')][_0xdbfe('0x5f')]){return _0x2c7086[_0xdbfe('0xc3')][_0xdbfe('0xb0')][0x0];}return db[_0xdbfe('0x98')][_0xdbfe('0x61')](_[_0xdbfe('0x1c')](_0x4c3796[_0xdbfe('0x62')],{'firstName':_0x292ce1,'mobile':_0x292ce1,'phone':_0x292ce1,'ListId':_0x2c7086['ListId']}));}})[_0xdbfe('0x3b')](handleEntityNotFound(_0x10cf1d,null))['then'](function(_0x4716b2){if(_0x4716b2){_0xe8a0d5=_0x4716b2;return db[_0xdbfe('0xb2')][_0xdbfe('0x60')]({'where':{'ContactId':_0xe8a0d5['id'],'closed':![],'WhatsappAccountId':_0x2c7086['id']}})[_0xdbfe('0x3b')](function(_0x279dfe){if(_0x279dfe){return[_0x279dfe,![]];}return db[_0xdbfe('0xb2')][_0xdbfe('0x61')]({'UserId':_0x4c3796[_0xdbfe('0x63')]['id'],'ContactId':_0xe8a0d5['id'],'WhatsappAccountId':_0x2c7086['id'],'phone':_0x292ce1,'firstMsgDirection':_0xdbfe('0xc4'),'Messages':[_['merge'](_0x4c3796[_0xdbfe('0x62')],{'read':![],'body':_0x4c3796[_0xdbfe('0x62')]['body'],'phone':_0x292ce1,'WhatsappAccountId':_0x2c7086['id'],'UserId':_0x4c3796[_0xdbfe('0x63')]['id'],'ContactId':_0xe8a0d5['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0xdbfe('0xc5')}]})['then'](function(_0x300cf6){return[_0x300cf6,!![]];});});}})[_0xdbfe('0x7b')](function(_0x365d3a,_0x54bd55){if(_0x54bd55){return _0x365d3a;}return db['WhatsappMessage']['create'](_['merge'](_0x4c3796[_0xdbfe('0x62')],{'read':![],'body':_0x4c3796[_0xdbfe('0x62')]['body'],'phone':_0x292ce1,'WhatsappAccountId':_0x2c7086['id'],'WhatsappInteractionId':_0x365d3a['id'],'UserId':_0x4c3796[_0xdbfe('0x63')]['id'],'ContactId':_0xe8a0d5['id']}))[_0xdbfe('0x3b')](function(_0x45d11d){_0x365d3a['dataValues'][_0xdbfe('0xc5')]=[];_0x365d3a[_0xdbfe('0xc6')]['Messages'][_0xdbfe('0xb5')](_0x45d11d[_0xdbfe('0xc6')]);return _0x365d3a;});})[_0xdbfe('0x3b')](respondWithResult(_0x10cf1d,null))[_0xdbfe('0x2e')](handleError(_0x10cf1d,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index da88d0c..ab74f66 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 _0x4867=['update','remove','emit','hook','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners'];(function(_0x27c068,_0x342981){var _0xe5a67f=function(_0x20658a){while(--_0x20658a){_0x27c068['push'](_0x27c068['shift']());}};_0xe5a67f(++_0x342981);}(_0x4867,0xc2));var _0x7486=function(_0xa1f3d9,_0x2a0fa4){_0xa1f3d9=_0xa1f3d9-0x0;var _0x5dcb0a=_0x4867[_0xa1f3d9];return _0x5dcb0a;};'use strict';var EventEmitter=require(_0x7486('0x0'));var WhatsappAccount=require(_0x7486('0x1'))['db'][_0x7486('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x7486('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7486('0x4'),'afterDestroy':_0x7486('0x5')};function emitEvent(_0x42afdb){return function(_0x27e22a,_0x57d898,_0x1f036d){WhatsappAccountEvents['emit'](_0x42afdb+':'+_0x27e22a['id'],_0x27e22a);WhatsappAccountEvents[_0x7486('0x6')](_0x42afdb,_0x27e22a);_0x1f036d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x7486('0x7')](e,emitEvent(event));}}module[_0x7486('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0x4c7f=['WhatsappAccount','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x4c7f,0x157));var _0xf4c7=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x4c7f[_0x58e469];return _0x4c01c5;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require('../../mysqldb')['db'][_0xf4c7('0x0')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xf4c7('0x1'),'afterDestroy':_0xf4c7('0x2')};function emitEvent(_0x1d4cdb){return function(_0xcd24d,_0x560d07,_0x4e884f){WhatsappAccountEvents[_0xf4c7('0x3')](_0x1d4cdb+':'+_0xcd24d['id'],_0xcd24d);WhatsappAccountEvents[_0xf4c7('0x3')](_0x1d4cdb,_0xcd24d);_0x4e884f(null);};}for(var e in events){if(events[_0xf4c7('0x4')](e)){var event=events[e];WhatsappAccount[_0xf4c7('0x5')](e,emitEvent(event));}}module[_0xf4c7('0x6')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index a2766b0..e198e56 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 _0x70b8=['./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3498e5,_0x1f78fd){var _0x3fe3fd=function(_0xa338e3){while(--_0xa338e3){_0x3498e5['push'](_0x3498e5['shift']());}};_0x3fe3fd(++_0x1f78fd);}(_0x70b8,0x178));var _0x870b=function(_0x1d7fe4,_0x39c93c){_0x1d7fe4=_0x1d7fe4-0x0;var _0x767e84=_0x70b8[_0x1d7fe4];return _0x767e84;};'use strict';var _=require('lodash');var util=require(_0x870b('0x0'));var logger=require(_0x870b('0x1'))(_0x870b('0x2'));var moment=require(_0x870b('0x3'));var BPromise=require(_0x870b('0x4'));var rp=require(_0x870b('0x5'));var fs=require('fs');var path=require(_0x870b('0x6'));var rimraf=require('rimraf');var config=require(_0x870b('0x7'));var attributes=require(_0x870b('0x8'));module['exports']=function(_0x221059,_0x2ddb55){return _0x221059[_0x870b('0x9')](_0x870b('0xa'),attributes,{'tableName':_0x870b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x47a7=['rimraf','../../config/environment','exports','define','WhatsappAccount','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0xcda325,_0x1859c4){var _0x1f988f=function(_0x3b2d44){while(--_0x3b2d44){_0xcda325['push'](_0xcda325['shift']());}};_0x1f988f(++_0x1859c4);}(_0x47a7,0x1e5));var _0x747a=function(_0x4eb889,_0x13b842){_0x4eb889=_0x4eb889-0x0;var _0x3f2955=_0x47a7[_0x4eb889];return _0x3f2955;};'use strict';var _=require(_0x747a('0x0'));var util=require(_0x747a('0x1'));var logger=require(_0x747a('0x2'))(_0x747a('0x3'));var moment=require(_0x747a('0x4'));var BPromise=require(_0x747a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x747a('0x6'));var rimraf=require(_0x747a('0x7'));var config=require(_0x747a('0x8'));var attributes=require('./whatsappAccount.attributes');module[_0x747a('0x9')]=function(_0x394e46,_0x31d4a7){return _0x394e46[_0x747a('0xa')](_0x747a('0xb'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index d0e7b9b..90b4a2e 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 _0xc830=['info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','WhatsappAccount','find','options','raw','where','attributes','include','map','model','debug','stringify','catch','ShowWhatsappAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','request','then'];(function(_0x52e488,_0x347309){var _0x1a600f=function(_0x3a2e80){while(--_0x3a2e80){_0x52e488['push'](_0x52e488['shift']());}};_0x1a600f(++_0x347309);}(_0xc830,0x14d));var _0x0c83=function(_0x27ccb9,_0x4e0473){_0x27ccb9=_0x27ccb9-0x0;var _0x6253da=_0xc830[_0x27ccb9];return _0x6253da;};'use strict';var _=require(_0x0c83('0x0'));var util=require(_0x0c83('0x1'));var moment=require(_0x0c83('0x2'));var BPromise=require(_0x0c83('0x3'));var rs=require(_0x0c83('0x4'));var fs=require('fs');var Redis=require(_0x0c83('0x5'));var db=require(_0x0c83('0x6'))['db'];var utils=require(_0x0c83('0x7'));var logger=require(_0x0c83('0x8'))(_0x0c83('0x9'));var config=require(_0x0c83('0xa'));var jayson=require(_0x0c83('0xb'));var client=jayson['client'][_0x0c83('0xc')]({'port':0x232a});config[_0x0c83('0xd')]=_['defaults'](config[_0x0c83('0xd')],{'host':_0x0c83('0xe'),'port':0x18eb});var socket=require(_0x0c83('0xf'))(new Redis(config[_0x0c83('0xd')]));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0x522410,_0x566cb7,_0x2487ff){return new BPromise(function(_0x4e2130,_0x4e3b5b){return client[_0x0c83('0x10')](_0x522410,_0x2487ff)[_0x0c83('0x11')](function(_0x449e32){logger[_0x0c83('0x12')](_0x0c83('0x13'),_0x566cb7,_0x0c83('0x14'));logger['debug'](_0x0c83('0x15'),_0x566cb7,_0x0c83('0x14'),JSON['stringify'](_0x449e32));if(_0x449e32[_0x0c83('0x16')]){if(_0x449e32[_0x0c83('0x16')][_0x0c83('0x17')]===0x1f4){logger[_0x0c83('0x16')](_0x0c83('0x13'),_0x566cb7,_0x449e32[_0x0c83('0x16')][_0x0c83('0x18')]);return _0x4e3b5b(_0x449e32[_0x0c83('0x16')][_0x0c83('0x18')]);}logger[_0x0c83('0x16')](_0x0c83('0x13'),_0x566cb7,_0x449e32['error'][_0x0c83('0x18')]);return _0x4e2130(_0x449e32['error'][_0x0c83('0x18')]);}else{logger[_0x0c83('0x12')](_0x0c83('0x13'),_0x566cb7,_0x0c83('0x14'));_0x4e2130(_0x449e32[_0x0c83('0x19')]['message']);}})['catch'](function(_0x3caf57){logger[_0x0c83('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x566cb7,_0x3caf57);_0x4e3b5b(_0x3caf57);});});}exports['ShowWhatsappAccount']=function(_0x28b376){var _0x5f206a=this;return new Promise(function(_0x8f139c,_0x2c25f8){return db[_0x0c83('0x1a')][_0x0c83('0x1b')]({'raw':_0x28b376['options']?_0x28b376[_0x0c83('0x1c')][_0x0c83('0x1d')]===undefined?!![]:![]:!![],'where':_0x28b376[_0x0c83('0x1c')]?_0x28b376[_0x0c83('0x1c')][_0x0c83('0x1e')]||null:null,'attributes':_0x28b376['options']?_0x28b376[_0x0c83('0x1c')][_0x0c83('0x1f')]||null:null,'include':_0x28b376[_0x0c83('0x1c')]?_0x28b376[_0x0c83('0x1c')][_0x0c83('0x20')]?_[_0x0c83('0x21')](_0x28b376[_0x0c83('0x1c')][_0x0c83('0x20')],function(_0x1a0e36){return{'model':db[_0x1a0e36[_0x0c83('0x22')]],'as':_0x1a0e36['as'],'attributes':_0x1a0e36[_0x0c83('0x1f')],'include':_0x1a0e36[_0x0c83('0x20')]?_[_0x0c83('0x21')](_0x1a0e36[_0x0c83('0x20')],function(_0x422e3a){return{'model':db[_0x422e3a[_0x0c83('0x22')]],'as':_0x422e3a['as'],'attributes':_0x422e3a['attributes'],'include':_0x422e3a[_0x0c83('0x20')]?_[_0x0c83('0x21')](_0x422e3a['include'],function(_0x51e994){return{'model':db[_0x51e994['model']],'as':_0x51e994['as'],'attributes':_0x51e994[_0x0c83('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0c83('0x11')](function(_0x5c5fdc){logger[_0x0c83('0x12')]('ShowWhatsappAccount',_0x28b376);logger[_0x0c83('0x23')]('ShowWhatsappAccount',_0x28b376,JSON[_0x0c83('0x24')](_0x5c5fdc));_0x8f139c(_0x5c5fdc);})[_0x0c83('0x25')](function(_0x53974e){logger[_0x0c83('0x16')](_0x0c83('0x26'),_0x53974e['message'],_0x28b376);_0x2c25f8(_0x5f206a[_0x0c83('0x16')](0x1f4,_0x53974e['message']));});});}; \ No newline at end of file +var _0xe08b=['options','raw','where','map','model','attributes','include','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','request\x20sent','debug','error','code','message','WhatsappAccount,\x20%s,\x20%s','result','catch','ShowWhatsappAccount','find'];(function(_0x2cae99,_0x2c4acb){var _0x2748b6=function(_0x277351){while(--_0x277351){_0x2cae99['push'](_0x2cae99['shift']());}};_0x2748b6(++_0x2c4acb);}(_0xe08b,0x184));var _0xbe08=function(_0xfb0281,_0x3ff38b){_0xfb0281=_0xfb0281-0x0;var _0x408dd3=_0xe08b[_0xfb0281];return _0x408dd3;};'use strict';var _=require('lodash');var util=require(_0xbe08('0x0'));var moment=require(_0xbe08('0x1'));var BPromise=require(_0xbe08('0x2'));var rs=require(_0xbe08('0x3'));var fs=require('fs');var Redis=require(_0xbe08('0x4'));var db=require(_0xbe08('0x5'))['db'];var utils=require(_0xbe08('0x6'));var logger=require(_0xbe08('0x7'))('rpc');var config=require(_0xbe08('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbe08('0x9')][_0xbe08('0xa')]({'port':0x232a});config[_0xbe08('0xb')]=_[_0xbe08('0xc')](config[_0xbe08('0xb')],{'host':_0xbe08('0xd'),'port':0x18eb});var socket=require(_0xbe08('0xe'))(new Redis(config[_0xbe08('0xb')]));require(_0xbe08('0xf'))[_0xbe08('0x10')](socket);function respondWithRpcPromise(_0x438ca1,_0x29b3fa,_0x358a34){return new BPromise(function(_0x2bf1db,_0x504852){return client[_0xbe08('0x11')](_0x438ca1,_0x358a34)[_0xbe08('0x12')](function(_0x393650){logger[_0xbe08('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x29b3fa,_0xbe08('0x14'));logger[_0xbe08('0x15')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x29b3fa,_0xbe08('0x14'),JSON['stringify'](_0x393650));if(_0x393650[_0xbe08('0x16')]){if(_0x393650[_0xbe08('0x16')][_0xbe08('0x17')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x29b3fa,_0x393650['error'][_0xbe08('0x18')]);return _0x504852(_0x393650[_0xbe08('0x16')][_0xbe08('0x18')]);}logger['error'](_0xbe08('0x19'),_0x29b3fa,_0x393650[_0xbe08('0x16')][_0xbe08('0x18')]);return _0x2bf1db(_0x393650[_0xbe08('0x16')][_0xbe08('0x18')]);}else{logger[_0xbe08('0x13')](_0xbe08('0x19'),_0x29b3fa,_0xbe08('0x14'));_0x2bf1db(_0x393650[_0xbe08('0x1a')][_0xbe08('0x18')]);}})[_0xbe08('0x1b')](function(_0x5e94bd){logger[_0xbe08('0x16')](_0xbe08('0x19'),_0x29b3fa,_0x5e94bd);_0x504852(_0x5e94bd);});});}exports[_0xbe08('0x1c')]=function(_0x15880a){var _0x3a6e6d=this;return new Promise(function(_0x48d880,_0x334dbc){return db['WhatsappAccount'][_0xbe08('0x1d')]({'raw':_0x15880a['options']?_0x15880a[_0xbe08('0x1e')][_0xbe08('0x1f')]===undefined?!![]:![]:!![],'where':_0x15880a[_0xbe08('0x1e')]?_0x15880a[_0xbe08('0x1e')][_0xbe08('0x20')]||null:null,'attributes':_0x15880a[_0xbe08('0x1e')]?_0x15880a[_0xbe08('0x1e')]['attributes']||null:null,'include':_0x15880a['options']?_0x15880a[_0xbe08('0x1e')]['include']?_[_0xbe08('0x21')](_0x15880a[_0xbe08('0x1e')]['include'],function(_0x22cc18){return{'model':db[_0x22cc18[_0xbe08('0x22')]],'as':_0x22cc18['as'],'attributes':_0x22cc18[_0xbe08('0x23')],'include':_0x22cc18[_0xbe08('0x24')]?_[_0xbe08('0x21')](_0x22cc18['include'],function(_0x3be3ac){return{'model':db[_0x3be3ac[_0xbe08('0x22')]],'as':_0x3be3ac['as'],'attributes':_0x3be3ac['attributes'],'include':_0x3be3ac[_0xbe08('0x24')]?_[_0xbe08('0x21')](_0x3be3ac[_0xbe08('0x24')],function(_0x28f762){return{'model':db[_0x28f762['model']],'as':_0x28f762['as'],'attributes':_0x28f762[_0xbe08('0x23')]};}):[]};}):[]};}):[]:[]})[_0xbe08('0x12')](function(_0x84ba17){logger[_0xbe08('0x13')](_0xbe08('0x1c'),_0x15880a);logger[_0xbe08('0x15')](_0xbe08('0x1c'),_0x15880a,JSON[_0xbe08('0x25')](_0x84ba17));_0x48d880(_0x84ba17);})[_0xbe08('0x1b')](function(_0x390df2){logger[_0xbe08('0x16')]('ShowWhatsappAccount',_0x390df2[_0xbe08('0x18')],_0x15880a);_0x334dbc(_0x3a6e6d[_0xbe08('0x16')](0x1f4,_0x390df2[_0xbe08('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 3b8f312..05329c4 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 _0x3ffa=['update','removeListener','register','length','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3ffa,0x12b));var _0xa3ff=function(_0x632945,_0x55dc2d){_0x632945=_0x632945-0x0;var _0xcbe1c5=_0x3ffa[_0x632945];return _0xcbe1c5;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xa3ff('0x0'),'remove',_0xa3ff('0x1')];function createListener(_0xc62924,_0x2e7f3d){return function(_0x35d48b){_0x2e7f3d['emit'](_0xc62924,_0x35d48b);};}function removeListener(_0x318f90,_0x251d04){return function(){WhatsappAccountEvents[_0xa3ff('0x2')](_0x318f90,_0x251d04);};}exports[_0xa3ff('0x3')]=function(_0x108182){for(var _0x5930ad=0x0,_0x57328c=events[_0xa3ff('0x4')];_0x5930ad<_0x57328c;_0x5930ad++){var _0x42a5f3=events[_0x5930ad];var _0x3d5f20=createListener('whatsappAccount:'+_0x42a5f3,_0x108182);WhatsappAccountEvents['on'](_0x42a5f3,_0x3d5f20);}}; \ No newline at end of file +var _0xdfac=['update','emit','removeListener','register','whatsappAccount:','./whatsappAccount.events','save','remove'];(function(_0x585346,_0x4458c7){var _0x266f8a=function(_0x2891b9){while(--_0x2891b9){_0x585346['push'](_0x585346['shift']());}};_0x266f8a(++_0x4458c7);}(_0xdfac,0x9d));var _0xcdfa=function(_0x3e2435,_0xc531a1){_0x3e2435=_0x3e2435-0x0;var _0x5d49e7=_0xdfac[_0x3e2435];return _0x5d49e7;};'use strict';var WhatsappAccountEvents=require(_0xcdfa('0x0'));var events=[_0xcdfa('0x1'),_0xcdfa('0x2'),_0xcdfa('0x3')];function createListener(_0x1d127f,_0x1d7ddb){return function(_0x4a46db){_0x1d7ddb[_0xcdfa('0x4')](_0x1d127f,_0x4a46db);};}function removeListener(_0x5dd5b3,_0x10e4c7){return function(){WhatsappAccountEvents[_0xcdfa('0x5')](_0x5dd5b3,_0x10e4c7);};}exports[_0xcdfa('0x6')]=function(_0x55c4db){for(var _0x144a86=0x0,_0x7a0514=events['length'];_0x144a86<_0x7a0514;_0x144a86++){var _0x1a2fa9=events[_0x144a86];var _0x1c297d=createListener(_0xcdfa('0x7')+_0x1a2fa9,_0x55c4db);WhatsappAccountEvents['on'](_0x1a2fa9,_0x1c297d);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index e96f179..7fdd7c5 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 _0x3a07=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x3a07,0x73));var _0x73a0=function(_0x583345,_0x36bd3b){_0x583345=_0x583345-0x0;var _0x45778d=_0x3a07[_0x583345];return _0x45778d;};'use strict';var multer=require(_0x73a0('0x0'));var util=require(_0x73a0('0x1'));var path=require(_0x73a0('0x2'));var timeout=require(_0x73a0('0x3'));var express=require(_0x73a0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x73a0('0x5'));var interaction=require(_0x73a0('0x6'));var config=require(_0x73a0('0x7'));var controller=require('./whatsappApplication.controller');router[_0x73a0('0x8')]('/',auth['isAuthenticated'](),controller[_0x73a0('0x9')]);router[_0x73a0('0x8')](_0x73a0('0xa'),auth[_0x73a0('0xb')](),controller[_0x73a0('0xc')]);router[_0x73a0('0xd')]('/',auth[_0x73a0('0xb')](),controller[_0x73a0('0xe')]);router[_0x73a0('0xf')](_0x73a0('0xa'),auth[_0x73a0('0xb')](),controller[_0x73a0('0x10')]);router[_0x73a0('0x11')](_0x73a0('0xa'),auth[_0x73a0('0xb')](),controller[_0x73a0('0x12')]);module[_0x73a0('0x13')]=router; \ No newline at end of file +var _0x560a=['destroy','exports','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','/:id','show','post','isAuthenticated','put','update','delete'];(function(_0x3303b8,_0xe0e43e){var _0x193c57=function(_0x42e064){while(--_0x42e064){_0x3303b8['push'](_0x3303b8['shift']());}};_0x193c57(++_0xe0e43e);}(_0x560a,0x142));var _0xa560=function(_0x2c90c1,_0x446eda){_0x2c90c1=_0x2c90c1-0x0;var _0xcb55d4=_0x560a[_0x2c90c1];return _0xcb55d4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa560('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa560('0x1'));var auth=require(_0xa560('0x2'));var interaction=require(_0xa560('0x3'));var config=require(_0xa560('0x4'));var controller=require(_0xa560('0x5'));router[_0xa560('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa560('0x6')](_0xa560('0x7'),auth['isAuthenticated'](),controller[_0xa560('0x8')]);router[_0xa560('0x9')]('/',auth[_0xa560('0xa')](),controller['create']);router[_0xa560('0xb')](_0xa560('0x7'),auth[_0xa560('0xa')](),controller[_0xa560('0xc')]);router[_0xa560('0xd')](_0xa560('0x7'),auth['isAuthenticated'](),controller[_0xa560('0xe')]);module[_0xa560('0xf')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 675f174..cdac040 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 _0x18e7=['INTEGER','noop','STRING'];(function(_0x1c4394,_0x24b2c5){var _0x3d3eb5=function(_0x57941a){while(--_0x57941a){_0x1c4394['push'](_0x1c4394['shift']());}};_0x3d3eb5(++_0x24b2c5);}(_0x18e7,0x129));var _0x718e=function(_0x2fa3ac,_0x28eeba){_0x2fa3ac=_0x2fa3ac-0x0;var _0x39809e=_0x18e7[_0x2fa3ac];return _0x39809e;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x718e('0x0')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x718e('0x1')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x718e('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x4972=['noop','TEXT','STRING','*,*,*,*','exports','INTEGER'];(function(_0x33cb6d,_0xe5a8e4){var _0x554b8c=function(_0xc64e55){while(--_0xc64e55){_0x33cb6d['push'](_0x33cb6d['shift']());}};_0x554b8c(++_0xe5a8e4);}(_0x4972,0x130));var _0x2497=function(_0x19dc23,_0x4dd8c6){_0x19dc23=_0x19dc23-0x0;var _0x325046=_0x4972[_0x19dc23];return _0x325046;};'use strict';var Sequelize=require('sequelize');module[_0x2497('0x0')]={'priority':{'type':Sequelize[_0x2497('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2497('0x2')},'appdata':{'type':Sequelize[_0x2497('0x3')]()},'description':{'type':Sequelize[_0x2497('0x4')]},'interval':{'type':Sequelize[_0x2497('0x4')],'defaultValue':_0x2497('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 62f616e..a6eee93 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 _0x627e=['status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','error','stack','name','index','WhatsappApplication','fieldName','key','map','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','filter','merge','options','rows','catch','params','fields','length','includeAll','include','find','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x276cce,_0x51d2f6){var _0x2a3894=function(_0x5248a1){while(--_0x5248a1){_0x276cce['push'](_0x276cce['shift']());}};_0x2a3894(++_0x51d2f6);}(_0x627e,0x14a));var _0xe627=function(_0x384de6,_0x3ea2f5){_0x384de6=_0x384de6-0x0;var _0x1b6d98=_0x627e[_0x384de6];return _0x1b6d98;};'use strict';var emlformat=require(_0xe627('0x0'));var rimraf=require(_0xe627('0x1'));var zipdir=require(_0xe627('0x2'));var jsonpatch=require(_0xe627('0x3'));var rp=require(_0xe627('0x4'));var moment=require('moment');var BPromise=require(_0xe627('0x5'));var Mustache=require(_0xe627('0x6'));var util=require(_0xe627('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe627('0x8'));var fs=require('fs');var fs_extra=require(_0xe627('0x9'));var _=require(_0xe627('0xa'));var squel=require(_0xe627('0xb'));var crypto=require(_0xe627('0xc'));var jsforce=require(_0xe627('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe627('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe627('0xf'));var authService=require(_0xe627('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe627('0x11'));var logger=require(_0xe627('0x12'))(_0xe627('0x13'));var utils=require(_0xe627('0x14'));var config=require(_0xe627('0x15'));var licenseUtil=require(_0xe627('0x16'));var db=require(_0xe627('0x17'))['db'];function respondWithStatusCode(_0x3919be,_0x1922f5){_0x1922f5=_0x1922f5||0xcc;return function(_0x582190){if(_0x582190){return _0x3919be[_0xe627('0x18')](_0x1922f5);}return _0x3919be[_0xe627('0x19')](_0x1922f5)[_0xe627('0x1a')]();};}function respondWithResult(_0x4be370,_0x42dd1c){_0x42dd1c=_0x42dd1c||0xc8;return function(_0x1e2e62){if(_0x1e2e62){return _0x4be370[_0xe627('0x19')](_0x42dd1c)[_0xe627('0x1b')](_0x1e2e62);}};}function respondWithFilteredResult(_0x62896f,_0x6a9a15){return function(_0x271325){if(_0x271325){var _0x54720a=typeof _0x6a9a15[_0xe627('0x1c')]===_0xe627('0x1d')&&typeof _0x6a9a15[_0xe627('0x1e')]===_0xe627('0x1d');var _0x403982=_0x271325[_0xe627('0x1f')];var _0x56559b=_0x54720a?0x0:_0x6a9a15[_0xe627('0x1c')];var _0x538b22=_0x54720a?_0x271325[_0xe627('0x1f')]:_0x6a9a15['offset']+_0x6a9a15[_0xe627('0x1e')];var _0x565213;if(_0x538b22>=_0x403982){_0x538b22=_0x403982;_0x565213=0xc8;}else{_0x565213=0xce;}_0x62896f['status'](_0x565213);return _0x62896f[_0xe627('0x20')]('Content-Range',_0x56559b+'-'+_0x538b22+'/'+_0x403982)[_0xe627('0x1b')](_0x271325);}return null;};}function patchUpdates(_0x3391ce){return function(_0x4adde7){try{jsonpatch['apply'](_0x4adde7,_0x3391ce,!![]);}catch(_0x4ecfa6){return BPromise[_0xe627('0x21')](_0x4ecfa6);}return _0x4adde7[_0xe627('0x22')]();};}function saveUpdates(_0x4e3338,_0x708a8a){return function(_0x33cb27){if(_0x33cb27){return _0x33cb27['update'](_0x4e3338)[_0xe627('0x23')](function(_0x29221b){return _0x29221b;});}return null;};}function removeEntity(_0x52d492,_0x42f3d1){return function(_0x19adbc){if(_0x19adbc){return _0x19adbc[_0xe627('0x24')]()['then'](function(){_0x52d492[_0xe627('0x19')](0xcc)[_0xe627('0x1a')]();});}};}function handleEntityNotFound(_0x1a5081,_0x3ddd8d){return function(_0x4b9ff9){if(!_0x4b9ff9){_0x1a5081[_0xe627('0x18')](0x194);}return _0x4b9ff9;};}function handleError(_0x1fe192,_0x1635a0){_0x1635a0=_0x1635a0||0x1f4;return function(_0x29eb8e){logger[_0xe627('0x25')](_0x29eb8e[_0xe627('0x26')]);if(_0x29eb8e[_0xe627('0x27')]){delete _0x29eb8e[_0xe627('0x27')];}_0x1fe192[_0xe627('0x19')](_0x1635a0)['send'](_0x29eb8e);};}exports[_0xe627('0x28')]=function(_0x5aeba1,_0x5cd7c8){var _0x1e0bd7={},_0xdf63c8={},_0x5799a3={'count':0x0,'rows':[]};var _0x39c23f=_['map'](db[_0xe627('0x29')]['rawAttributes'],function(_0x262253){return{'name':_0x262253[_0xe627('0x2a')],'type':_0x262253['type'][_0xe627('0x2b')]};});_0xdf63c8['model']=_[_0xe627('0x2c')](_0x39c23f,_0xe627('0x27'));_0xdf63c8[_0xe627('0x2d')]=_[_0xe627('0x2e')](_0x5aeba1[_0xe627('0x2d')]);_0xdf63c8[_0xe627('0x2f')]=_[_0xe627('0x30')](_0xdf63c8[_0xe627('0x31')],_0xdf63c8[_0xe627('0x2d')]);_0x1e0bd7[_0xe627('0x32')]=_[_0xe627('0x30')](_0xdf63c8['model'],qs['fields'](_0x5aeba1[_0xe627('0x2d')]['fields']));_0x1e0bd7[_0xe627('0x32')]=_0x1e0bd7['attributes']['length']?_0x1e0bd7[_0xe627('0x32')]:_0xdf63c8['model'];if(!_0x5aeba1['query'][_0xe627('0x33')](_0xe627('0x34'))){_0x1e0bd7[_0xe627('0x1e')]=qs['limit'](_0x5aeba1['query']['limit']);_0x1e0bd7[_0xe627('0x1c')]=qs['offset'](_0x5aeba1[_0xe627('0x2d')][_0xe627('0x1c')]);}_0x1e0bd7['order']=qs[_0xe627('0x35')](_0x5aeba1[_0xe627('0x2d')]['sort']);_0x1e0bd7[_0xe627('0x36')]=qs[_0xe627('0x2f')](_[_0xe627('0x37')](_0x5aeba1[_0xe627('0x2d')],_0xdf63c8[_0xe627('0x2f')]),_0x39c23f);if(_0x5aeba1[_0xe627('0x2d')]['filter']){_0x1e0bd7[_0xe627('0x36')]=_['merge'](_0x1e0bd7[_0xe627('0x36')],{'$or':_['map'](_0x39c23f,function(_0xe90eda){if(_0xe90eda[_0xe627('0x38')]!==_0xe627('0x39')){var _0x21a533={};_0x21a533[_0xe90eda[_0xe627('0x27')]]={'$like':'%'+_0x5aeba1[_0xe627('0x2d')][_0xe627('0x3a')]+'%'};return _0x21a533;}})});}_0x1e0bd7=_[_0xe627('0x3b')]({},_0x1e0bd7,_0x5aeba1[_0xe627('0x3c')]);var _0x415a25={'where':_0x1e0bd7[_0xe627('0x36')]};return db[_0xe627('0x29')][_0xe627('0x1f')](_0x415a25)['then'](function(_0x4ddff5){_0x5799a3['count']=_0x4ddff5;if(_0x5aeba1['query']['includeAll']){_0x1e0bd7['include']=[{'all':!![]}];}return db[_0xe627('0x29')]['findAll'](_0x1e0bd7);})[_0xe627('0x23')](function(_0x59cd6a){_0x5799a3[_0xe627('0x3d')]=_0x59cd6a;return _0x5799a3;})[_0xe627('0x23')](respondWithFilteredResult(_0x5cd7c8,_0x1e0bd7))[_0xe627('0x3e')](handleError(_0x5cd7c8,null));};exports['show']=function(_0x58e110,_0x26064c){var _0x5f3374={'raw':!![],'where':{'id':_0x58e110[_0xe627('0x3f')]['id']}},_0x5e352e={};_0x5e352e['model']=_[_0xe627('0x2e')](db['WhatsappApplication']['rawAttributes']);_0x5e352e[_0xe627('0x2d')]=_[_0xe627('0x2e')](_0x58e110[_0xe627('0x2d')]);_0x5e352e['filters']=_['intersection'](_0x5e352e[_0xe627('0x31')],_0x5e352e['query']);_0x5f3374['attributes']=_[_0xe627('0x30')](_0x5e352e[_0xe627('0x31')],qs[_0xe627('0x40')](_0x58e110[_0xe627('0x2d')][_0xe627('0x40')]));_0x5f3374[_0xe627('0x32')]=_0x5f3374['attributes'][_0xe627('0x41')]?_0x5f3374[_0xe627('0x32')]:_0x5e352e['model'];if(_0x58e110['query'][_0xe627('0x42')]){_0x5f3374[_0xe627('0x43')]=[{'all':!![]}];}_0x5f3374=_[_0xe627('0x3b')]({},_0x5f3374,_0x58e110[_0xe627('0x3c')]);return db[_0xe627('0x29')][_0xe627('0x44')](_0x5f3374)[_0xe627('0x23')](handleEntityNotFound(_0x26064c,null))['then'](respondWithResult(_0x26064c,null))[_0xe627('0x3e')](handleError(_0x26064c,null));};exports['create']=function(_0x648456,_0xcd19f5){return db[_0xe627('0x29')]['create'](_0x648456[_0xe627('0x45')],{})['then'](respondWithResult(_0xcd19f5,0xc9))[_0xe627('0x3e')](handleError(_0xcd19f5,null));};exports[_0xe627('0x46')]=function(_0x375e05,_0x30e057){if(_0x375e05[_0xe627('0x45')]['id']){delete _0x375e05['body']['id'];}return db[_0xe627('0x29')][_0xe627('0x44')]({'where':{'id':_0x375e05[_0xe627('0x3f')]['id']}})[_0xe627('0x23')](handleEntityNotFound(_0x30e057,null))[_0xe627('0x23')](saveUpdates(_0x375e05[_0xe627('0x45')],null))[_0xe627('0x23')](respondWithResult(_0x30e057,null))[_0xe627('0x3e')](handleError(_0x30e057,null));};exports[_0xe627('0x24')]=function(_0x3824da,_0x550b74){return db[_0xe627('0x29')][_0xe627('0x44')]({'where':{'id':_0x3824da['params']['id']}})[_0xe627('0x23')](handleEntityNotFound(_0x550b74,null))[_0xe627('0x23')](removeEntity(_0x550b74,null))['catch'](handleError(_0x550b74,null));}; \ No newline at end of file +var _0xbd0a=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','status','error','stack','name','send','index','map','WhatsappApplication','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','find','create','body','eml-format','zip-dir','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/logger','../../config/utils'];(function(_0x2c04a4,_0x4745f1){var _0x5c43de=function(_0x18b5df){while(--_0x18b5df){_0x2c04a4['push'](_0x2c04a4['shift']());}};_0x5c43de(++_0x4745f1);}(_0xbd0a,0x1b9));var _0xabd0=function(_0xe5da06,_0x1a56da){_0xe5da06=_0xe5da06-0x0;var _0x1fee48=_0xbd0a[_0xe5da06];return _0x1fee48;};'use strict';var emlformat=require(_0xabd0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xabd0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xabd0('0x2'));var Mustache=require(_0xabd0('0x3'));var util=require(_0xabd0('0x4'));var path=require(_0xabd0('0x5'));var sox=require(_0xabd0('0x6'));var csv=require(_0xabd0('0x7'));var ejs=require(_0xabd0('0x8'));var fs=require('fs');var fs_extra=require(_0xabd0('0x9'));var _=require(_0xabd0('0xa'));var squel=require('squel');var crypto=require(_0xabd0('0xb'));var jsforce=require(_0xabd0('0xc'));var deskjs=require(_0xabd0('0xd'));var toCsv=require('to-csv');var querystring=require(_0xabd0('0xe'));var Papa=require('papaparse');var Redis=require(_0xabd0('0xf'));var authService=require(_0xabd0('0x10'));var qs=require(_0xabd0('0x11'));var as=require(_0xabd0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xabd0('0x13'))('api');var utils=require(_0xabd0('0x14'));var config=require(_0xabd0('0x15'));var licenseUtil=require(_0xabd0('0x16'));var db=require(_0xabd0('0x17'))['db'];function respondWithStatusCode(_0x3bf33,_0xd66d68){_0xd66d68=_0xd66d68||0xcc;return function(_0x5b0f34){if(_0x5b0f34){return _0x3bf33[_0xabd0('0x18')](_0xd66d68);}return _0x3bf33['status'](_0xd66d68)[_0xabd0('0x19')]();};}function respondWithResult(_0x145f76,_0x5ceb94){_0x5ceb94=_0x5ceb94||0xc8;return function(_0x56ba31){if(_0x56ba31){return _0x145f76['status'](_0x5ceb94)['json'](_0x56ba31);}};}function respondWithFilteredResult(_0x679d0b,_0x26d8fd){return function(_0x97f4ec){if(_0x97f4ec){var _0xdb7a40=typeof _0x26d8fd[_0xabd0('0x1a')]===_0xabd0('0x1b')&&typeof _0x26d8fd[_0xabd0('0x1c')]===_0xabd0('0x1b');var _0x2d17b1=_0x97f4ec['count'];var _0x3a0ace=_0xdb7a40?0x0:_0x26d8fd['offset'];var _0x579dcd=_0xdb7a40?_0x97f4ec[_0xabd0('0x1d')]:_0x26d8fd[_0xabd0('0x1a')]+_0x26d8fd[_0xabd0('0x1c')];var _0x23f955;if(_0x579dcd>=_0x2d17b1){_0x579dcd=_0x2d17b1;_0x23f955=0xc8;}else{_0x23f955=0xce;}_0x679d0b['status'](_0x23f955);return _0x679d0b[_0xabd0('0x1e')](_0xabd0('0x1f'),_0x3a0ace+'-'+_0x579dcd+'/'+_0x2d17b1)['json'](_0x97f4ec);}return null;};}function patchUpdates(_0x56c2f5){return function(_0x1c955e){try{jsonpatch[_0xabd0('0x20')](_0x1c955e,_0x56c2f5,!![]);}catch(_0x4d9416){return BPromise[_0xabd0('0x21')](_0x4d9416);}return _0x1c955e[_0xabd0('0x22')]();};}function saveUpdates(_0xa1ebf,_0x1e077e){return function(_0x4c9f3a){if(_0x4c9f3a){return _0x4c9f3a[_0xabd0('0x23')](_0xa1ebf)[_0xabd0('0x24')](function(_0x3376bc){return _0x3376bc;});}return null;};}function removeEntity(_0x462420,_0x264167){return function(_0xf6dbad){if(_0xf6dbad){return _0xf6dbad[_0xabd0('0x25')]()[_0xabd0('0x24')](function(){_0x462420[_0xabd0('0x26')](0xcc)[_0xabd0('0x19')]();});}};}function handleEntityNotFound(_0x52c8be,_0x369dd0){return function(_0x2699c4){if(!_0x2699c4){_0x52c8be[_0xabd0('0x18')](0x194);}return _0x2699c4;};}function handleError(_0x3e0dd2,_0x31b869){_0x31b869=_0x31b869||0x1f4;return function(_0x399996){logger[_0xabd0('0x27')](_0x399996[_0xabd0('0x28')]);if(_0x399996[_0xabd0('0x29')]){delete _0x399996[_0xabd0('0x29')];}_0x3e0dd2[_0xabd0('0x26')](_0x31b869)[_0xabd0('0x2a')](_0x399996);};}exports[_0xabd0('0x2b')]=function(_0x3246de,_0x1fe955){var _0x15096f={},_0x5427a0={},_0x1c0d90={'count':0x0,'rows':[]};var _0x2d4c55=_[_0xabd0('0x2c')](db[_0xabd0('0x2d')]['rawAttributes'],function(_0x1ef94b){return{'name':_0x1ef94b[_0xabd0('0x2e')],'type':_0x1ef94b[_0xabd0('0x2f')]['key']};});_0x5427a0[_0xabd0('0x30')]=_[_0xabd0('0x2c')](_0x2d4c55,'name');_0x5427a0[_0xabd0('0x31')]=_['keys'](_0x3246de[_0xabd0('0x31')]);_0x5427a0[_0xabd0('0x32')]=_[_0xabd0('0x33')](_0x5427a0[_0xabd0('0x30')],_0x5427a0[_0xabd0('0x31')]);_0x15096f[_0xabd0('0x34')]=_['intersection'](_0x5427a0[_0xabd0('0x30')],qs[_0xabd0('0x35')](_0x3246de[_0xabd0('0x31')][_0xabd0('0x35')]));_0x15096f[_0xabd0('0x34')]=_0x15096f[_0xabd0('0x34')][_0xabd0('0x36')]?_0x15096f[_0xabd0('0x34')]:_0x5427a0[_0xabd0('0x30')];if(!_0x3246de[_0xabd0('0x31')][_0xabd0('0x37')](_0xabd0('0x38'))){_0x15096f[_0xabd0('0x1c')]=qs[_0xabd0('0x1c')](_0x3246de[_0xabd0('0x31')]['limit']);_0x15096f['offset']=qs['offset'](_0x3246de[_0xabd0('0x31')][_0xabd0('0x1a')]);}_0x15096f[_0xabd0('0x39')]=qs[_0xabd0('0x3a')](_0x3246de[_0xabd0('0x31')]['sort']);_0x15096f['where']=qs['filters'](_[_0xabd0('0x3b')](_0x3246de['query'],_0x5427a0[_0xabd0('0x32')]),_0x2d4c55);if(_0x3246de[_0xabd0('0x31')][_0xabd0('0x3c')]){_0x15096f[_0xabd0('0x3d')]=_[_0xabd0('0x3e')](_0x15096f[_0xabd0('0x3d')],{'$or':_[_0xabd0('0x2c')](_0x2d4c55,function(_0x42e86e){if(_0x42e86e['type']!==_0xabd0('0x3f')){var _0x592de0={};_0x592de0[_0x42e86e['name']]={'$like':'%'+_0x3246de[_0xabd0('0x31')][_0xabd0('0x3c')]+'%'};return _0x592de0;}})});}_0x15096f=_[_0xabd0('0x3e')]({},_0x15096f,_0x3246de[_0xabd0('0x40')]);var _0x1b8687={'where':_0x15096f['where']};return db[_0xabd0('0x2d')][_0xabd0('0x1d')](_0x1b8687)[_0xabd0('0x24')](function(_0x2e0bdf){_0x1c0d90['count']=_0x2e0bdf;if(_0x3246de[_0xabd0('0x31')][_0xabd0('0x41')]){_0x15096f[_0xabd0('0x42')]=[{'all':!![]}];}return db[_0xabd0('0x2d')][_0xabd0('0x43')](_0x15096f);})[_0xabd0('0x24')](function(_0x2aa5a9){_0x1c0d90[_0xabd0('0x44')]=_0x2aa5a9;return _0x1c0d90;})[_0xabd0('0x24')](respondWithFilteredResult(_0x1fe955,_0x15096f))[_0xabd0('0x45')](handleError(_0x1fe955,null));};exports[_0xabd0('0x46')]=function(_0x975bbe,_0x237a33){var _0x514ea3={'raw':!![],'where':{'id':_0x975bbe[_0xabd0('0x47')]['id']}},_0x2ba135={};_0x2ba135[_0xabd0('0x30')]=_['keys'](db['WhatsappApplication'][_0xabd0('0x48')]);_0x2ba135[_0xabd0('0x31')]=_[_0xabd0('0x49')](_0x975bbe[_0xabd0('0x31')]);_0x2ba135[_0xabd0('0x32')]=_['intersection'](_0x2ba135['model'],_0x2ba135[_0xabd0('0x31')]);_0x514ea3[_0xabd0('0x34')]=_[_0xabd0('0x33')](_0x2ba135[_0xabd0('0x30')],qs[_0xabd0('0x35')](_0x975bbe['query'][_0xabd0('0x35')]));_0x514ea3[_0xabd0('0x34')]=_0x514ea3[_0xabd0('0x34')]['length']?_0x514ea3[_0xabd0('0x34')]:_0x2ba135[_0xabd0('0x30')];if(_0x975bbe[_0xabd0('0x31')][_0xabd0('0x41')]){_0x514ea3['include']=[{'all':!![]}];}_0x514ea3=_[_0xabd0('0x3e')]({},_0x514ea3,_0x975bbe[_0xabd0('0x40')]);return db[_0xabd0('0x2d')][_0xabd0('0x4a')](_0x514ea3)['then'](handleEntityNotFound(_0x237a33,null))[_0xabd0('0x24')](respondWithResult(_0x237a33,null))[_0xabd0('0x45')](handleError(_0x237a33,null));};exports[_0xabd0('0x4b')]=function(_0xc80459,_0x2a1069){return db[_0xabd0('0x2d')]['create'](_0xc80459['body'],{})[_0xabd0('0x24')](respondWithResult(_0x2a1069,0xc9))['catch'](handleError(_0x2a1069,null));};exports['update']=function(_0x2293bd,_0x1610d9){if(_0x2293bd[_0xabd0('0x4c')]['id']){delete _0x2293bd[_0xabd0('0x4c')]['id'];}return db['WhatsappApplication'][_0xabd0('0x4a')]({'where':{'id':_0x2293bd[_0xabd0('0x47')]['id']}})[_0xabd0('0x24')](handleEntityNotFound(_0x1610d9,null))[_0xabd0('0x24')](saveUpdates(_0x2293bd['body'],null))['then'](respondWithResult(_0x1610d9,null))[_0xabd0('0x45')](handleError(_0x1610d9,null));};exports[_0xabd0('0x25')]=function(_0x16dd64,_0x32a5c9){return db[_0xabd0('0x2d')][_0xabd0('0x4a')]({'where':{'id':_0x16dd64[_0xabd0('0x47')]['id']}})[_0xabd0('0x24')](handleEntityNotFound(_0x32a5c9,null))[_0xabd0('0x24')](removeEntity(_0x32a5c9,null))['catch'](handleError(_0x32a5c9,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index e6be92a..e5d9010 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 _0x689c=['define','WhatsappApplication','whatsapp_applications','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x689c,0x9e));var _0xc689=function(_0x1a6aa9,_0x228c72){_0x1a6aa9=_0x1a6aa9-0x0;var _0x28a465=_0x689c[_0x1a6aa9];return _0x28a465;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc689('0x0'))(_0xc689('0x1'));var moment=require(_0xc689('0x2'));var BPromise=require(_0xc689('0x3'));var rp=require(_0xc689('0x4'));var fs=require('fs');var path=require(_0xc689('0x5'));var rimraf=require('rimraf');var config=require(_0xc689('0x6'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x3a4916,_0x28ce4c){return _0x3a4916[_0xc689('0x7')](_0xc689('0x8'),attributes,{'tableName':_0xc689('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc689('0xa')});}; \ No newline at end of file +var _0xae24=['rimraf','./whatsappApplication.attributes','exports','define','WhatsappApplication','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird'];(function(_0x321c39,_0x323c87){var _0x479de4=function(_0x386b17){while(--_0x386b17){_0x321c39['push'](_0x321c39['shift']());}};_0x479de4(++_0x323c87);}(_0xae24,0x182));var _0x4ae2=function(_0x11205c,_0x30eaf7){_0x11205c=_0x11205c-0x0;var _0x35e776=_0xae24[_0x11205c];return _0x35e776;};'use strict';var _=require(_0x4ae2('0x0'));var util=require('util');var logger=require(_0x4ae2('0x1'))('api');var moment=require(_0x4ae2('0x2'));var BPromise=require(_0x4ae2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ae2('0x4'));var config=require('../../config/environment');var attributes=require(_0x4ae2('0x5'));module[_0x4ae2('0x6')]=function(_0x20c85c,_0x3e6055){return _0x20c85c[_0x4ae2('0x7')](_0x4ae2('0x8'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x4ae2('0x9')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index ee78038..e971050 100644 --- a/server/api/whatsappApplication/whatsappApplication.rpc.js +++ b/server/api/whatsappApplication/whatsappApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac9d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x824143,_0x550e49){var _0x4c4a00=function(_0x4663c4){while(--_0x4663c4){_0x824143['push'](_0x824143['shift']());}};_0x4c4a00(++_0x550e49);}(_0xac9d,0x14d));var _0xdac9=function(_0xaf025d,_0x586d7a){_0xaf025d=_0xaf025d-0x0;var _0x1c77cb=_0xac9d[_0xaf025d];return _0x1c77cb;};'use strict';var _=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var moment=require(_0xdac9('0x2'));var BPromise=require(_0xdac9('0x3'));var rs=require(_0xdac9('0x4'));var fs=require('fs');var Redis=require(_0xdac9('0x5'));var db=require(_0xdac9('0x6'))['db'];var utils=require(_0xdac9('0x7'));var logger=require('../../config/logger')(_0xdac9('0x8'));var config=require('../../config/environment');var jayson=require(_0xdac9('0x9'));var client=jayson[_0xdac9('0xa')][_0xdac9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x776b6c,_0x1c78c5,_0x39f560){return new BPromise(function(_0x5531af,_0x2b1d6f){return client['request'](_0x776b6c,_0x39f560)[_0xdac9('0xc')](function(_0x3a013b){logger[_0xdac9('0xd')](_0xdac9('0xe'),_0x1c78c5,_0xdac9('0xf'));logger[_0xdac9('0x10')](_0xdac9('0x11'),_0x1c78c5,_0xdac9('0xf'),JSON[_0xdac9('0x12')](_0x3a013b));if(_0x3a013b['error']){if(_0x3a013b[_0xdac9('0x13')][_0xdac9('0x14')]===0x1f4){logger['error'](_0xdac9('0xe'),_0x1c78c5,_0x3a013b[_0xdac9('0x13')][_0xdac9('0x15')]);return _0x2b1d6f(_0x3a013b['error'][_0xdac9('0x15')]);}logger[_0xdac9('0x13')](_0xdac9('0xe'),_0x1c78c5,_0x3a013b['error']['message']);return _0x5531af(_0x3a013b[_0xdac9('0x13')][_0xdac9('0x15')]);}else{logger['info'](_0xdac9('0xe'),_0x1c78c5,_0xdac9('0xf'));_0x5531af(_0x3a013b[_0xdac9('0x16')][_0xdac9('0x15')]);}})[_0xdac9('0x17')](function(_0x393acc){logger[_0xdac9('0x13')](_0xdac9('0xe'),_0x1c78c5,_0x393acc);_0x2b1d6f(_0x393acc);});});} \ No newline at end of file +var _0x55ca=['rpc','../../config/environment','jayson/promise','client','http','request','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0x3fa212,_0x3d7bcb){var _0x1b65b1=function(_0x1423f8){while(--_0x1423f8){_0x3fa212['push'](_0x3fa212['shift']());}};_0x1b65b1(++_0x3d7bcb);}(_0x55ca,0x126));var _0xa55c=function(_0x65efc5,_0x5d978c){_0x65efc5=_0x65efc5-0x0;var _0x4c387a=_0x55ca[_0x65efc5];return _0x4c387a;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 4b88727..22c6d84 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 _0x53ec=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/messages','getMessages','create','post','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','removeTags','exports','multer'];(function(_0x3bf5c5,_0x5006d2){var _0x1bd3e0=function(_0x22c2f){while(--_0x22c2f){_0x3bf5c5['push'](_0x3bf5c5['shift']());}};_0x1bd3e0(++_0x5006d2);}(_0x53ec,0x192));var _0xc53e=function(_0x203a81,_0x37aefa){_0x203a81=_0x203a81-0x0;var _0x5b45f8=_0x53ec[_0x203a81];return _0x5b45f8;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xa')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router['get']('/:id/download',auth[_0xc53e('0x9')](),controller['download']);router['post']('/',auth[_0xc53e('0x9')](),controller[_0xc53e('0x11')]);router[_0xc53e('0x12')](_0xc53e('0xf'),auth['isAuthenticated'](),controller['addMessage']);router[_0xc53e('0x12')](_0xc53e('0x13'),auth[_0xc53e('0x9')](),interaction[_0xc53e('0x14')](_0xc53e('0x15'),_0xc53e('0x16')),controller[_0xc53e('0x17')]);router[_0xc53e('0x18')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),interaction['tracked'](_0xc53e('0x15'),_0xc53e('0x19')),controller[_0xc53e('0x1a')]);router[_0xc53e('0x1b')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),interaction[_0xc53e('0x14')](_0xc53e('0x15'),_0xc53e('0x1c')),controller['destroy']);router['delete'](_0xc53e('0x13'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1d')]);module[_0xc53e('0x1e')]=router; \ No newline at end of file +var _0xa23f=['/:id/messages','/:id/tags','tracked','whatsapp','addTags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','getMessages','/:id/download','download','post'];(function(_0x1b14a2,_0x8c4a63){var _0x88d8b8=function(_0xf78866){while(--_0xf78866){_0x1b14a2['push'](_0x1b14a2['shift']());}};_0x88d8b8(++_0x8c4a63);}(_0xa23f,0x7c));var _0xfa23=function(_0x33774e,_0x45b8df){_0x33774e=_0x33774e-0x0;var _0x3f9076=_0xa23f[_0x33774e];return _0x3f9076;};'use strict';var multer=require(_0xfa23('0x0'));var util=require(_0xfa23('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfa23('0x2'));var router=express[_0xfa23('0x3')]();var fs_extra=require(_0xfa23('0x4'));var auth=require(_0xfa23('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfa23('0x6'));var controller=require('./whatsappInteraction.controller');router[_0xfa23('0x7')]('/',auth[_0xfa23('0x8')](),controller[_0xfa23('0x9')]);router[_0xfa23('0x7')]('/describe',auth[_0xfa23('0x8')](),controller['describe']);router[_0xfa23('0x7')](_0xfa23('0xa'),auth[_0xfa23('0x8')](),controller[_0xfa23('0xb')]);router[_0xfa23('0x7')]('/:id/messages',auth['isAuthenticated'](),controller[_0xfa23('0xc')]);router['get'](_0xfa23('0xd'),auth['isAuthenticated'](),controller[_0xfa23('0xe')]);router[_0xfa23('0xf')]('/',auth[_0xfa23('0x8')](),controller['create']);router[_0xfa23('0xf')](_0xfa23('0x10'),auth[_0xfa23('0x8')](),controller['addMessage']);router['post'](_0xfa23('0x11'),auth[_0xfa23('0x8')](),interaction[_0xfa23('0x12')](_0xfa23('0x13'),'whatsappinteraction:addtags'),controller[_0xfa23('0x14')]);router[_0xfa23('0x15')](_0xfa23('0xa'),auth[_0xfa23('0x8')](),interaction['tracked'](_0xfa23('0x13'),_0xfa23('0x16')),controller[_0xfa23('0x17')]);router[_0xfa23('0x18')](_0xfa23('0xa'),auth['isAuthenticated'](),interaction['tracked']('whatsapp',_0xfa23('0x19')),controller[_0xfa23('0x1a')]);router['delete'](_0xfa23('0x11'),auth[_0xfa23('0x8')](),controller[_0xfa23('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 37d9d96..464a410 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 _0x5162=['BOOLEAN','sequelize','STRING','DATE','ENUM','out'];(function(_0x353150,_0x1ab0ef){var _0x3dc923=function(_0xd33b75){while(--_0xd33b75){_0x353150['push'](_0x353150['shift']());}};_0x3dc923(++_0x1ab0ef);}(_0x5162,0x103));var _0x2516=function(_0x49ccaa,_0x5944f2){_0x49ccaa=_0x49ccaa-0x0;var _0x2c1ae1=_0x5162[_0x49ccaa];return _0x2c1ae1;};'use strict';var Sequelize=require(_0x2516('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x2516('0x1')]},'secondDisposition':{'type':Sequelize[_0x2516('0x1')]},'thirdDisposition':{'type':Sequelize[_0x2516('0x1')]},'note':{'type':Sequelize[_0x2516('0x1')]},'phone':{'type':Sequelize[_0x2516('0x1')]},'read1stAt':{'type':Sequelize[_0x2516('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x2516('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x2516('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x2516('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x1354=['STRING','out','sequelize','moment','exports','BOOLEAN','DATE'];(function(_0x18350c,_0x1bc1d7){var _0x32e371=function(_0x76bff5){while(--_0x76bff5){_0x18350c['push'](_0x18350c['shift']());}};_0x32e371(++_0x1bc1d7);}(_0x1354,0x95));var _0x4135=function(_0x543429,_0x140390){_0x543429=_0x543429-0x0;var _0x112a46=_0x1354[_0x543429];return _0x112a46;};'use strict';var Sequelize=require(_0x4135('0x0'));var moment=require(_0x4135('0x1'));module[_0x4135('0x2')]={'closed':{'type':Sequelize[_0x4135('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4135('0x4')]},'disposition':{'type':Sequelize[_0x4135('0x5')]},'secondDisposition':{'type':Sequelize[_0x4135('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x4135('0x5')]},'phone':{'type':Sequelize[_0x4135('0x5')]},'read1stAt':{'type':Sequelize[_0x4135('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x4135('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4135('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x4135('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4135('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index f3ca904..043a8ce 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 _0xf50b=['undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','Users','map','TagIds','Tags','split','forEach','push','index','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','field','color','from','select','u.id','u.id\x20=\x20ui.UserId','whatsapp_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','tools_tags','expr','search','length','conditions','find','unreadMessages','having','`\x20=\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','UserId','text','body','some','compact','isEmpty','WhatsappAccountId','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','WhatsappInteraction','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','c.firstName','Contact.firstName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','params','includeAll','include','options','catch','create','describe','addMessage','ids','omit','findOne','WhatsappMessage','hasOwnProperty','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','emit','whatsappInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','User','fullname','CmContact','firstName','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Account','get','mkdirSync','Whatsapp','Owner','N.A.','closed','basename','existsSync','createReadStream','pipe','out','renderFile','views','downloadInteraction.ejs','.pdf','log','err','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset'];(function(_0x43672a,_0x569b12){var _0x246d47=function(_0x3de4f3){while(--_0x3de4f3){_0x43672a['push'](_0x43672a['shift']());}};_0x246d47(++_0x569b12);}(_0xf50b,0xc8));var _0xbf50=function(_0x518025,_0x3076d9){_0x518025=_0x518025-0x0;var _0x5124a3=_0xf50b[_0x518025];return _0x5124a3;};'use strict';var emlformat=require(_0xbf50('0x0'));var rimraf=require(_0xbf50('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbf50('0x2'));var rp=require(_0xbf50('0x3'));var moment=require(_0xbf50('0x4'));var BPromise=require(_0xbf50('0x5'));var Mustache=require('mustache');var util=require(_0xbf50('0x6'));var path=require('path');var sox=require(_0xbf50('0x7'));var csv=require(_0xbf50('0x8'));var ejs=require(_0xbf50('0x9'));var fs=require('fs');var fs_extra=require(_0xbf50('0xa'));var _=require(_0xbf50('0xb'));var squel=require(_0xbf50('0xc'));var crypto=require(_0xbf50('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbf50('0xe'));var toCsv=require(_0xbf50('0x8'));var querystring=require(_0xbf50('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbf50('0x10'));var qs=require(_0xbf50('0x11'));var as=require(_0xbf50('0x12'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0xbf50('0x13'));var logger=require(_0xbf50('0x14'))(_0xbf50('0x15'));var utils=require(_0xbf50('0x16'));var config=require(_0xbf50('0x17'));var licenseUtil=require(_0xbf50('0x18'));var db=require(_0xbf50('0x19'))['db'];config['redis']=_[_0xbf50('0x1a')](config[_0xbf50('0x1b')],{'host':_0xbf50('0x1c'),'port':0x18eb});var socket=require(_0xbf50('0x1d'))(new Redis(config[_0xbf50('0x1b')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithStatusCode(_0x4b05bb,_0x101e5d){_0x101e5d=_0x101e5d||0xcc;return function(_0x5df099){if(_0x5df099){return _0x4b05bb[_0xbf50('0x1e')](_0x101e5d);}return _0x4b05bb[_0xbf50('0x1f')](_0x101e5d)[_0xbf50('0x20')]();};}function respondWithResult(_0x531729,_0xfa5164){_0xfa5164=_0xfa5164||0xc8;return function(_0x5be8ae){if(_0x5be8ae){return _0x531729[_0xbf50('0x1f')](_0xfa5164)[_0xbf50('0x21')](_0x5be8ae);}};}function respondWithFilteredResult(_0x33495f,_0x596142){return function(_0x17b416){if(_0x17b416){var _0x216254=typeof _0x596142[_0xbf50('0x22')]===_0xbf50('0x23')&&typeof _0x596142[_0xbf50('0x24')]==='undefined';var _0x433484=_0x17b416[_0xbf50('0x25')];var _0x54c011=_0x216254?0x0:_0x596142[_0xbf50('0x22')];var _0x21763f=_0x216254?_0x17b416['count']:_0x596142[_0xbf50('0x22')]+_0x596142[_0xbf50('0x24')];var _0x19cb84;if(_0x21763f>=_0x433484){_0x21763f=_0x433484;_0x19cb84=0xc8;}else{_0x19cb84=0xce;}_0x33495f[_0xbf50('0x1f')](_0x19cb84);return _0x33495f[_0xbf50('0x26')](_0xbf50('0x27'),_0x54c011+'-'+_0x21763f+'/'+_0x433484)[_0xbf50('0x21')](_0x17b416);}return null;};}function patchUpdates(_0x5e0eda){return function(_0x304bd5){try{jsonpatch[_0xbf50('0x28')](_0x304bd5,_0x5e0eda,!![]);}catch(_0x5fb909){return BPromise[_0xbf50('0x29')](_0x5fb909);}return _0x304bd5['save']();};}function saveUpdates(_0x3648bf,_0x219e99){return function(_0x31f9a8){if(_0x31f9a8){return _0x31f9a8[_0xbf50('0x2a')](_0x3648bf)[_0xbf50('0x2b')](function(_0x16e1e3){return _0x16e1e3;});}return null;};}function removeEntity(_0x4ff0be,_0xf970a1){return function(_0x30bfff){if(_0x30bfff){return _0x30bfff[_0xbf50('0x2c')]()['then'](function(){_0x4ff0be['status'](0xcc)[_0xbf50('0x20')]();});}};}function handleEntityNotFound(_0x53be2e,_0x3ca677){return function(_0x53707f){if(!_0x53707f){_0x53be2e[_0xbf50('0x1e')](0x194);}return _0x53707f;};}function handleError(_0x47b714,_0x3e45f9){_0x3e45f9=_0x3e45f9||0x1f4;return function(_0x105c9f){logger[_0xbf50('0x2d')](_0x105c9f[_0xbf50('0x2e')]);if(_0x105c9f[_0xbf50('0x2f')]){delete _0x105c9f[_0xbf50('0x2f')];}_0x47b714['status'](_0x3e45f9)[_0xbf50('0x30')](_0x105c9f);};}function getInteractionUsers(_0x18923b,_0x1bc9bc){return new BPromise(function(_0x173ebe,_0x2e4d55){try{if(_0x1bc9bc[_0x18923b['id']]){_0x18923b[_0xbf50('0x31')]=_[_0xbf50('0x32')](_0x1bc9bc[_0x18923b['id']],function(_0xc7df4c){return{'id':_0xc7df4c['id'],'fullname':_0xc7df4c['fullname']};});}}catch(_0x446f22){_0x2e4d55(_0x446f22);}_0x173ebe(_0x18923b);});}function getInteractionTags(_0x2662e1,_0x18b949){return new BPromise(function(_0x104063,_0x5a99d1){try{if(_0x2662e1[_0xbf50('0x33')]){_0x2662e1[_0xbf50('0x34')]=[];_0x2662e1[_0xbf50('0x33')][_0xbf50('0x35')](',')[_0xbf50('0x36')](function(_0x3c472e){_0x2662e1[_0xbf50('0x34')][_0xbf50('0x37')](_0x18b949[_0x3c472e]);});}delete _0x2662e1[_0xbf50('0x33')];}catch(_0x8f23c5){_0x5a99d1(_0x8f23c5);}_0x104063(_0x2662e1);});}function updateWhatsappInteraction(_0x192706,_0x53134d,_0x8128e0){return new BPromise(function(_0x44fe4a,_0x4b9a51){return getInteractionUsers(_0x192706,_0x8128e0)[_0xbf50('0x2b')](function(_0x2becfc){return getInteractionTags(_0x2becfc,_0x53134d);})[_0xbf50('0x2b')](function(_0x2268c3){_0x44fe4a(_0x2268c3);})['catch'](function(_0x2e7453){_0x4b9a51(_0x2e7453);});});}exports[_0xbf50('0x38')]=function(_0x351490,_0x6ff880){var _0x16ef05={},_0x52e8fa={},_0x44f8b1={'count':0x0,'rows':[]};var _0x410d5f=_['map'](db['WhatsappInteraction'][_0xbf50('0x39')],function(_0x16bde3){return{'name':_0x16bde3[_0xbf50('0x3a')],'type':_0x16bde3[_0xbf50('0x3b')]['key']};});_0x52e8fa[_0xbf50('0x3c')]=_['map'](_0x410d5f,_0xbf50('0x2f'));_0x52e8fa[_0xbf50('0x3d')]=_[_0xbf50('0x3e')](_0x351490[_0xbf50('0x3d')]);_0x52e8fa[_0xbf50('0x3f')]=_[_0xbf50('0x40')](_0x52e8fa[_0xbf50('0x3c')],_0x52e8fa[_0xbf50('0x3d')]);_0x16ef05[_0xbf50('0x41')]=_[_0xbf50('0x40')](_0x52e8fa['model'],qs['fields'](_0x351490['query'][_0xbf50('0x42')]));_0x16ef05['attributes']=_0x16ef05[_0xbf50('0x41')]['length']?_0x16ef05[_0xbf50('0x41')]:_0x52e8fa[_0xbf50('0x3c')];if(!_0x351490[_0xbf50('0x3d')]['hasOwnProperty'](_0xbf50('0x43'))){_0x16ef05[_0xbf50('0x24')]=qs[_0xbf50('0x24')](_0x351490[_0xbf50('0x3d')]['limit']);_0x16ef05[_0xbf50('0x22')]=qs[_0xbf50('0x22')](_0x351490[_0xbf50('0x3d')][_0xbf50('0x22')]);}_0x16ef05[_0xbf50('0x44')]=qs[_0xbf50('0x45')](_0x351490[_0xbf50('0x3d')][_0xbf50('0x45')]);_0x16ef05[_0xbf50('0x46')]=qs[_0xbf50('0x3f')](_[_0xbf50('0x47')](_0x351490[_0xbf50('0x3d')],_0x52e8fa[_0xbf50('0x3f')]),_0x410d5f);var _0x2fd9dc=[];var _0x151d17=squel['select']()[_0xbf50('0x48')]('id')[_0xbf50('0x48')]('name')['field'](_0xbf50('0x49'))[_0xbf50('0x4a')]('tools_tags');var _0x398290=squel[_0xbf50('0x4b')]()[_0xbf50('0x48')](_0xbf50('0x4c'))[_0xbf50('0x48')]('u.fullname')[_0xbf50('0x48')]('ui.WhatsappInteractionId')[_0xbf50('0x4a')]('user_has_whatsapp_interactions','ui')['left_join']('users','u',_0xbf50('0x4d'));var _0x5c38f1=squel[_0xbf50('0x4b')]()['from'](_0xbf50('0x4e'),'i')[_0xbf50('0x4f')](_0xbf50('0x50'),'c',_0xbf50('0x51'))['left_join'](_0xbf50('0x52'),'o',_0xbf50('0x53'))['left_join'](_0xbf50('0x54'),'a',_0xbf50('0x55'))[_0xbf50('0x4f')](_0xbf50('0x56'),'me',_0xbf50('0x57'))[_0xbf50('0x4f')]('whatsapp_interaction_has_tags','it','it.WhatsappInteractionId\x20=\x20i.id')[_0xbf50('0x4f')](_0xbf50('0x58'),'t','t.id\x20=\x20it.TagId');var _0x47aea7=squel['expr']();var _0x4c12b7=[];var _0xb92b08=squel[_0xbf50('0x59')]();var _0x5b77bc;if(_0x351490[_0xbf50('0x3d')]['search']){_0x5b77bc=as['parseSearch'](_0x351490[_0xbf50('0x3d')][_0xbf50('0x5a')]);var _0x2c4db6=_0x5b77bc['sqlOperator'];for(var _0x149015=0x0;_0x149015<_0x5b77bc['conditions'][_0xbf50('0x5b')];_0x149015++){var _0x2b3f89=_0x5b77bc[_0xbf50('0x5c')][_0x149015];var _0xfb3e4b='i';var _0x151208=_[_0xbf50('0x5d')](_0x410d5f,[_0xbf50('0x2f'),_0x2b3f89['field']]);if(!_0x151208){switch(_0x2b3f89[_0xbf50('0x48')]){case _0xbf50('0x5e'):if(_0x2b3f89['value']==0x1){_0x5c38f1[_0xbf50('0x5f')]('`'+_0x2b3f89[_0xbf50('0x48')]+_0xbf50('0x60'));}else{_0x5c38f1[_0xbf50('0x5f')]('`'+_0x2b3f89[_0xbf50('0x48')]+'`\x20>\x200');}break;case _0xbf50('0x61'):if(_0x2b3f89[_0xbf50('0x62')]===_0xbf50('0x63')){if(_0x2b3f89[_0xbf50('0x64')][_0xbf50('0x35')]('\x20')[_0xbf50('0x5b')]>0x1){_0x47aea7[_0x2c4db6](_0xbf50('0x65'),qs[_0xbf50('0x66')](_0x2b3f89['value']),null);}else{var _0x58104c='%'+_0x2b3f89[_0xbf50('0x64')]+'%';_0x47aea7[_0x2c4db6](_0xbf50('0x67'),_0x58104c,_0x58104c,_0x58104c);}}else{_0x151208=_[_0xbf50('0x5d')](_0x410d5f,[_0xbf50('0x2f'),_0xbf50('0x68')]);_0x2b3f89[_0xbf50('0x48')]=_0xbf50('0x68');_0x1c2d43=as[_0xbf50('0x69')](_0xfb3e4b,_0x151208[_0xbf50('0x3b')],_0x2b3f89);_0x47aea7[_0x2c4db6](_0x1c2d43['text'],_0x1c2d43[_0xbf50('0x64')][_0xbf50('0x6a')],_0x1c2d43[_0xbf50('0x64')][_0xbf50('0x20')]);}break;case _0xbf50('0x6b'):var _0x56b14e=_0x2b3f89[_0xbf50('0x64')][_0xbf50('0x35')](',')[_0xbf50('0x32')](function(_0x2643b3){return Number(_0x2643b3);});_0x56b14e[_0xbf50('0x36')](function(_0x113ce6){_0xb92b08['or'](_0xbf50('0x6c'),'%,'+_0x113ce6+',%');});_0x4c12b7=_['union'](_0x4c12b7,_0x56b14e);break;case'User':if(_0x2b3f89[_0xbf50('0x62')]===_0xbf50('0x63')){_0x47aea7[_0x2c4db6]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2b3f89[_0xbf50('0x64')]+'%',null);}else{_0x151208=_['find'](_0x410d5f,['name',_0xbf50('0x6d')]);_0x2b3f89[_0xbf50('0x48')]=_0xbf50('0x6d');_0x1c2d43=as[_0xbf50('0x69')](_0xfb3e4b,_0x151208[_0xbf50('0x3b')],_0x2b3f89);_0x47aea7[_0x2c4db6](_0x1c2d43[_0xbf50('0x6e')],_0x1c2d43[_0xbf50('0x64')]['start'],_0x1c2d43[_0xbf50('0x64')][_0xbf50('0x20')]);}break;case _0xbf50('0x6f'):_0x1c2d43=as[_0xbf50('0x69')]('me',null,_0x2b3f89);_0x47aea7[_0x2c4db6](_0x1c2d43[_0xbf50('0x6e')],_0x1c2d43['value'][_0xbf50('0x6a')],_0x1c2d43[_0xbf50('0x64')][_0xbf50('0x20')]);break;}}else{var _0x1c2d43=as['buildExpression'](_0xfb3e4b,_0x151208[_0xbf50('0x3b')],_0x2b3f89);_0x47aea7[_0x2c4db6](_0x1c2d43[_0xbf50('0x6e')],_0x1c2d43['value'][_0xbf50('0x6a')],_0x1c2d43['value'][_0xbf50('0x20')]);}}}else{var _0x34aa21=_(_0x351490[_0xbf50('0x3d')])[_0xbf50('0x3e')]()[_0xbf50('0x32')](function(_0x576916){return _[_0xbf50('0x70')](_0x410d5f,[_0xbf50('0x2f'),_0x576916])?_0x576916:undefined;})[_0xbf50('0x71')]()[_0xbf50('0x64')]();if(!_[_0xbf50('0x72')](_0x34aa21)){_0x34aa21[_0xbf50('0x36')](function(_0x6adaa3){if(_0x6adaa3===_0xbf50('0x73')){_0x5c38f1[_0xbf50('0x46')]('i.WhatsappAccountId\x20IN\x20?',[][_0xbf50('0x74')](_0x351490['query'][_0x6adaa3]));}else if(_0x6adaa3===_0xbf50('0x75')){var _0x1ddd06=JSON[_0xbf50('0x76')](_0x351490[_0xbf50('0x3d')][_0x6adaa3])['$gte'];var _0xcb4885=JSON['parse'](_0x351490['query'][_0x6adaa3])[_0xbf50('0x77')];_0x5c38f1[_0xbf50('0x46')](_0xbf50('0x78'),_0x1ddd06,_0xcb4885);}else{if(_0x351490['query'][_0x6adaa3]===_0xbf50('0x79')){_0x5c38f1[_0xbf50('0x46')]('i.'+_0x6adaa3+'\x20IS\x20NULL');}else{_0x5c38f1['where']('i.'+_0x6adaa3+_0xbf50('0x7a'),_0x351490[_0xbf50('0x3d')][_0x6adaa3]);}}});}if(_0x351490[_0xbf50('0x3d')][_0xbf50('0x7b')]){if(_0x351490[_0xbf50('0x3d')]['read']==0x1){_0x5c38f1[_0xbf50('0x5f')](_0xbf50('0x7c'));}else{_0x5c38f1['having'](_0xbf50('0x7d'));}}if(_0x351490['query'][_0xbf50('0x7e')]){_0x4c12b7=_[_0xbf50('0x7f')](_0x351490[_0xbf50('0x3d')][_0xbf50('0x7e')])?_0x351490[_0xbf50('0x3d')][_0xbf50('0x7e')]:new Array(_0x351490[_0xbf50('0x3d')][_0xbf50('0x7e')]);_0x4c12b7['forEach'](function(_0x387c33){_0xb92b08['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x387c33+',%');});}if(_0x351490[_0xbf50('0x3d')][_0xbf50('0x80')]){var _0x30606c=_0x351490[_0xbf50('0x3d')][_0xbf50('0x80')][_0xbf50('0x81')]('\x5c','\x5c\x5c')[_0xbf50('0x81')](/'/g,'\x27\x27');if(qs[_0xbf50('0x82')](_0x30606c)){_0x47aea7['or']('i.id\x20LIKE\x20?',_0x30606c+'%')['or'](_0xbf50('0x83'),_0x30606c+'%');}else{_0x47aea7['or'](_0xbf50('0x84'),qs[_0xbf50('0x66')](_0x30606c))['or'](_0xbf50('0x85'),_0x30606c+'%');}}}_0x5c38f1[_0xbf50('0x46')](_0x47aea7);_0x5c38f1[_0xbf50('0x86')](_0xbf50('0x87'));var _0x1506af={'type':db[_0xbf50('0x88')][_0xbf50('0x89')]['SELECT'],'raw':!![]};var _0x564e29=_0x5c38f1[_0xbf50('0x8a')]();_0x564e29[_0xbf50('0x48')](_0xbf50('0x87'));_0x564e29[_0xbf50('0x48')](_0xbf50('0x8b'),'unreadMessages');if(_0x16ef05['order']){_0x16ef05['order'][_0xbf50('0x36')](function(_0xc86bb8){var _0x4befcc=_0xc86bb8[0x0]==='contactName'?_0xc86bb8[0x0]:'i.'+_0xc86bb8[0x0];_0x5c38f1[_0xbf50('0x44')](_0x4befcc,_0xc86bb8[0x1]===_0xbf50('0x8c')?![]:!![]);});}if(!_[_0xbf50('0x72')](_0x4c12b7)){_0x5c38f1[_0xbf50('0x5f')](_0xb92b08);_0x564e29[_0xbf50('0x46')](_0xbf50('0x8d'),_0x4c12b7);}BPromise[_0xbf50('0x8e')]()[_0xbf50('0x2b')](function(){if(!_0x5b77bc){if(_0x351490[_0xbf50('0x3d')][_0xbf50('0x73')])return;_0x564e29[_0xbf50('0x46')](_0xbf50('0x8f'));_0x5c38f1['where'](_0xbf50('0x8f'));return;}if(_0x351490[_0xbf50('0x90')][_0xbf50('0x91')]!==_0xbf50('0x92'))return;return _0x351490['user']['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0xbf50('0x2b')](function(_0x29c673){if(_[_0xbf50('0x72')](_0x29c673)){_0x564e29[_0xbf50('0x46')](_0xbf50('0x93'));_0x5c38f1['where'](_0xbf50('0x93'));}else{_0x564e29['where'](_0xbf50('0x94'),_[_0xbf50('0x32')](_0x29c673,'id'));_0x5c38f1[_0xbf50('0x46')](_0xbf50('0x94'),_[_0xbf50('0x32')](_0x29c673,'id'));}});})[_0xbf50('0x2b')](function(){if(_0x351490[_0xbf50('0x90')][_0xbf50('0x91')]==='agent'&&!_0x5b77bc&&!_0x351490[_0xbf50('0x3d')]['WhatsappAccountId'])return[];return db[_0xbf50('0x95')]['query'](_0x564e29[_0xbf50('0x96')](),_0x1506af);})[_0xbf50('0x2b')](function(_0x34fac7){_0x44f8b1[_0xbf50('0x25')]=_0x34fac7['length'];if(_0x44f8b1[_0xbf50('0x25')]===0x0)return[];return db['sequelize'][_0xbf50('0x3d')](_0x151d17[_0xbf50('0x96')](),_0x1506af)['then'](function(_0x5329c0){_0x2fd9dc=_[_0xbf50('0x97')](_0x5329c0,'id');_0x1506af=_[_0xbf50('0x98')](_0x1506af,{'model':db[_0xbf50('0x99')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x351490[_0xbf50('0x3d')][_0xbf50('0x42')]){_0x16ef05[_0xbf50('0x41')][_0xbf50('0x36')](function(_0x51ab29){_0x5c38f1[_0xbf50('0x48')]('i.'+_0x51ab29);});}else{_0x5c38f1['field'](_0xbf50('0x8b'),_0xbf50('0x5e'));_0x5c38f1[_0xbf50('0x48')]('a.key','Account.key');_0x5c38f1[_0xbf50('0x48')](_0xbf50('0x9a'),_0xbf50('0x9b'));_0x5c38f1[_0xbf50('0x48')](_0xbf50('0x9c'),_0xbf50('0x9d'));_0x5c38f1['field']('i.*');_0x5c38f1['field'](_0xbf50('0x9e'),_0xbf50('0x9f'));_0x5c38f1[_0xbf50('0x48')]('c.lastName','Contact.lastName');_0x5c38f1[_0xbf50('0x48')](_0xbf50('0xa0'),_0xbf50('0xa1'));_0x5c38f1[_0xbf50('0x48')](_0xbf50('0xa2'),_0xbf50('0xa3'));_0x5c38f1[_0xbf50('0x48')](_0xbf50('0xa4'),_0xbf50('0xa5'));_0x5c38f1['field'](_0xbf50('0xa6'),_0xbf50('0xa7'));_0x5c38f1[_0xbf50('0x48')](_0xbf50('0xa8'),'Owner.fullname');_0x5c38f1['field'](_0xbf50('0xa9'),_0xbf50('0xaa'));_0x5c38f1['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xbf50('0x33'));}if(_0x16ef05[_0xbf50('0x24')])_0x5c38f1['limit'](_0x16ef05[_0xbf50('0x24')]);if(_0x16ef05[_0xbf50('0x22')])_0x5c38f1[_0xbf50('0x22')](_0x16ef05[_0xbf50('0x22')]);return db[_0xbf50('0x95')][_0xbf50('0x3d')](_0x5c38f1[_0xbf50('0x96')](),_0x1506af);})[_0xbf50('0x2b')](function(_0x384fcb){if(_0x384fcb[_0xbf50('0x5b')]>0x0)_0x398290[_0xbf50('0x46')](_0xbf50('0xab'),_[_0xbf50('0x32')](_0x384fcb,'id'));return db[_0xbf50('0x95')][_0xbf50('0x3d')](_0x398290['toString'](),_0x1506af)[_0xbf50('0x2b')](function(_0x45de71){var _0x317030=_[_0xbf50('0xac')](_0x45de71,_0xbf50('0xad'));var _0x24c6c7=[];_0x384fcb[_0xbf50('0x36')](function(_0x29fcf8){_0x24c6c7[_0xbf50('0x37')](updateWhatsappInteraction(_0x29fcf8,_0x2fd9dc,_0x317030));});return BPromise[_0xbf50('0xae')](_0x24c6c7);});});})[_0xbf50('0x2b')](function(_0x307cc9){_0x44f8b1[_0xbf50('0xaf')]=_0x307cc9;return _0x44f8b1;})[_0xbf50('0x2b')](respondWithFilteredResult(_0x6ff880,_0x16ef05))['catch'](handleError(_0x6ff880,null));};exports[_0xbf50('0xb0')]=function(_0x2ba42a,_0x3cb330){var _0x4a91f5={'raw':![],'where':{'id':_0x2ba42a[_0xbf50('0xb1')]['id']}},_0xe72018={};_0xe72018[_0xbf50('0x3c')]=_[_0xbf50('0x3e')](db[_0xbf50('0x99')][_0xbf50('0x39')]);_0xe72018[_0xbf50('0x3d')]=_[_0xbf50('0x3e')](_0x2ba42a[_0xbf50('0x3d')]);_0xe72018[_0xbf50('0x3f')]=_['intersection'](_0xe72018[_0xbf50('0x3c')],_0xe72018[_0xbf50('0x3d')]);_0x4a91f5[_0xbf50('0x41')]=_['intersection'](_0xe72018[_0xbf50('0x3c')],qs[_0xbf50('0x42')](_0x2ba42a[_0xbf50('0x3d')]['fields']));_0x4a91f5['attributes']=_0x4a91f5[_0xbf50('0x41')]['length']?_0x4a91f5[_0xbf50('0x41')]:_0xe72018[_0xbf50('0x3c')];if(_0x2ba42a[_0xbf50('0x3d')][_0xbf50('0xb2')]){_0x4a91f5[_0xbf50('0xb3')]=[{'all':!![]}];}_0x4a91f5=_[_0xbf50('0x98')]({},_0x4a91f5,_0x2ba42a[_0xbf50('0xb4')]);return db[_0xbf50('0x99')][_0xbf50('0x5d')](_0x4a91f5)[_0xbf50('0x2b')](handleEntityNotFound(_0x3cb330,null))[_0xbf50('0x2b')](respondWithResult(_0x3cb330,null))[_0xbf50('0xb5')](handleError(_0x3cb330,null));};exports[_0xbf50('0xb6')]=function(_0x4b384b,_0x48cde6){return db[_0xbf50('0x99')][_0xbf50('0xb6')](_0x4b384b[_0xbf50('0x6f')],{})[_0xbf50('0x2b')](respondWithResult(_0x48cde6,0xc9))[_0xbf50('0xb5')](handleError(_0x48cde6,null));};exports[_0xbf50('0x2a')]=function(_0x325c2a,_0xd16523){if(_0x325c2a['body']['id']){delete _0x325c2a[_0xbf50('0x6f')]['id'];}return db[_0xbf50('0x99')]['find']({'where':{'id':_0x325c2a[_0xbf50('0xb1')]['id']}})[_0xbf50('0x2b')](handleEntityNotFound(_0xd16523,null))[_0xbf50('0x2b')](saveUpdates(_0x325c2a['body'],null))[_0xbf50('0x2b')](respondWithResult(_0xd16523,null))[_0xbf50('0xb5')](handleError(_0xd16523,null));};exports[_0xbf50('0x2c')]=function(_0x1fd75e,_0x8503ea){return db[_0xbf50('0x99')][_0xbf50('0x5d')]({'where':{'id':_0x1fd75e[_0xbf50('0xb1')]['id']}})[_0xbf50('0x2b')](handleEntityNotFound(_0x8503ea,null))[_0xbf50('0x2b')](removeEntity(_0x8503ea,null))[_0xbf50('0xb5')](handleError(_0x8503ea,null));};exports[_0xbf50('0xb7')]=function(_0x9f3d2a,_0x621da8){return db[_0xbf50('0x99')][_0xbf50('0xb7')]()[_0xbf50('0x2b')](respondWithResult(_0x621da8,null))['catch'](handleError(_0x621da8,null));};exports[_0xbf50('0xb8')]=function(_0x326bc9,_0x3a64e3,_0x521b44){return db['WhatsappMessage'][_0xbf50('0x5d')]({'where':{'id':_0x326bc9['params']['id']}})[_0xbf50('0x2b')](handleEntityNotFound(_0x3a64e3,null))['then'](function(_0x1e185a){if(_0x1e185a){return _0x1e185a[_0xbf50('0xb8')](_0x326bc9['body'][_0xbf50('0xb9')],_[_0xbf50('0xba')](_0x326bc9['body'],[_0xbf50('0xb9'),'id'])||{});}})[_0xbf50('0x2b')](respondWithResult(_0x3a64e3,null))[_0xbf50('0xb5')](handleError(_0x3a64e3,null));};exports['getMessages']=function(_0x4ddcf2,_0x4d6380,_0x3447c8){var _0x47b969={'raw':![],'where':{}};var _0x332fe3={};var _0x5355f3={'count':0x0,'rows':[]};return db[_0xbf50('0x99')][_0xbf50('0xbb')]({'where':{'id':_0x4ddcf2[_0xbf50('0xb1')]['id']}})['then'](handleEntityNotFound(_0x4d6380,null))[_0xbf50('0x2b')](function(_0xd73dcc){if(_0xd73dcc){_0x332fe3['model']=_[_0xbf50('0x3e')](db[_0xbf50('0xbc')]['rawAttributes']);_0x332fe3[_0xbf50('0x3d')]=_['keys'](_0x4ddcf2[_0xbf50('0x3d')]);_0x332fe3['filters']=_[_0xbf50('0x40')](_0x332fe3[_0xbf50('0x3c')],_0x332fe3[_0xbf50('0x3d')]);_0x47b969[_0xbf50('0x41')]=_[_0xbf50('0x40')](_0x332fe3['model'],qs[_0xbf50('0x42')](_0x4ddcf2[_0xbf50('0x3d')]['fields']));_0x47b969['attributes']=_0x47b969['attributes'][_0xbf50('0x5b')]?_0x47b969[_0xbf50('0x41')]:_0x332fe3['model'];if(!_0x4ddcf2[_0xbf50('0x3d')][_0xbf50('0xbd')](_0xbf50('0x43'))){_0x47b969['limit']=qs[_0xbf50('0x24')](_0x4ddcf2['query'][_0xbf50('0x24')]);_0x47b969[_0xbf50('0x22')]=qs[_0xbf50('0x22')](_0x4ddcf2['query'][_0xbf50('0x22')]);}_0x47b969['order']=qs[_0xbf50('0x45')](_0x4ddcf2[_0xbf50('0x3d')]['sort']);_0x47b969[_0xbf50('0x46')]=qs[_0xbf50('0x3f')](_[_0xbf50('0x47')](_0x4ddcf2[_0xbf50('0x3d')],_0x332fe3[_0xbf50('0x3f')]));_0x47b969['where'][_0xbf50('0xad')]=_0xd73dcc['id'];if(_0x4ddcf2['query'][_0xbf50('0x80')]){_0x47b969[_0xbf50('0x46')]=_[_0xbf50('0x98')](_0x47b969[_0xbf50('0x46')],{'$or':_[_0xbf50('0x32')](_0x47b969[_0xbf50('0x41')],function(_0x2a39ea){var _0x1baacd={};_0x1baacd[_0x2a39ea]={'$like':'%'+_0x4ddcf2[_0xbf50('0x3d')]['filter']+'%'};return _0x1baacd;})});}if(_0x4ddcf2[_0xbf50('0x3d')][_0xbf50('0xbe')]){var _0x2f2bfb=_0x4ddcf2['query'][_0xbf50('0xbe')][_0xbf50('0x35')](',');var _0x39c52f={};_0x39c52f[_0x2f2bfb[0x0]]={'$gte':moment(_0x2f2bfb[0x1])[_0xbf50('0xbf')](_0xbf50('0xc0'))};_0x47b969[_0xbf50('0x46')]=_['merge'](_0x47b969['where'],_0x39c52f);}_0x47b969=_[_0xbf50('0x98')]({},_0x47b969,_0x4ddcf2[_0xbf50('0xb4')]);return db[_0xbf50('0xbc')][_0xbf50('0x25')]({'where':_0x47b969[_0xbf50('0x46')]})[_0xbf50('0x2b')](function(_0x5cf8c3){_0x5355f3[_0xbf50('0x25')]=_0x5cf8c3;if(_0x4ddcf2[_0xbf50('0x3d')][_0xbf50('0xb2')]){_0x47b969[_0xbf50('0xb3')]=[{'all':!![]}];}return db[_0xbf50('0xbc')][_0xbf50('0xc1')](_0x47b969);})[_0xbf50('0x2b')](function(_0xa10acd){_0x5355f3[_0xbf50('0xaf')]=_0xa10acd;return _0x5355f3;});}})[_0xbf50('0x2b')](respondWithFilteredResult(_0x4d6380,_0x47b969))['catch'](handleError(_0x4d6380,null));};exports['addTags']=function(_0x158f2d,_0x361bb2,_0x1b302c){return db['WhatsappInteraction'][_0xbf50('0x5d')]({'where':{'id':_0x158f2d[_0xbf50('0xb1')]['id']}})[_0xbf50('0x2b')](handleEntityNotFound(_0x361bb2,null))['then'](function(_0x4bb6f2){if(_0x4bb6f2){return _0x4bb6f2['setTags'](_0x158f2d['body']['ids'],_[_0xbf50('0xba')](_0x158f2d[_0xbf50('0x6f')],[_0xbf50('0xb9'),'id'])||{})['spread'](function(){return db[_0xbf50('0x6b')][_0xbf50('0xc1')]({'attributes':['id','name',_0xbf50('0x49')],'where':{'id':_0x158f2d['body'][_0xbf50('0xb9')]}});})[_0xbf50('0x2b')](function(_0x2aee50){socket[_0xbf50('0xc2')](_0xbf50('0xc3'),{'id':Number(_0x158f2d['params']['id']),'tags':_0x2aee50||[]});return{'id':Number(_0x158f2d[_0xbf50('0xb1')]['id']),'tags':_0x2aee50||[]};});}})[_0xbf50('0x2b')](respondWithResult(_0x361bb2,null))[_0xbf50('0xb5')](handleError(_0x361bb2,null));};exports[_0xbf50('0xc4')]=function(_0xecabf4,_0x43ea33,_0xe35d5){return db['WhatsappInteraction']['find']({'where':{'id':_0xecabf4[_0xbf50('0xb1')]['id']}})[_0xbf50('0x2b')](handleEntityNotFound(_0x43ea33,null))['then'](function(_0x41620a){if(_0x41620a){return _0x41620a[_0xbf50('0xc4')](_0xecabf4[_0xbf50('0x3d')][_0xbf50('0xb9')]);}})[_0xbf50('0x2b')](respondWithStatusCode(_0x43ea33,null))[_0xbf50('0xb5')](handleError(_0x43ea33,null));};exports[_0xbf50('0xc5')]=function(_0x2171bc,_0x1ad876){var _0xc35d7b=moment()[_0xbf50('0xc6')]()['toString']();var _0x1d93ab=path['join'](config[_0xbf50('0xc7')],_0xbf50('0xc8'),_0xbf50('0xc9'),_0xbf50('0xca'));var _0x3f1686=path[_0xbf50('0xcb')](config[_0xbf50('0xc7')],'server',_0xbf50('0xc9'),_0xbf50('0xcc'));var _0x2b3ee1=path[_0xbf50('0xcb')](_0x1d93ab,_0xc35d7b);var _0x4e7098=util[_0xbf50('0xbf')](_0xbf50('0xcd'),_0x2171bc[_0xbf50('0xb1')]['id'],_0xc35d7b);var _0x29a27d=path[_0xbf50('0xcb')](_0x1d93ab,_0x4e7098);var _0x2122b7=[];_0x2122b7[_0xbf50('0x37')]({'model':db[_0xbf50('0xce')],'as':_0xbf50('0xce'),'attributes':['id',_0xbf50('0xcf')],'raw':!![]});_0x2122b7['push']({'model':db[_0xbf50('0xd0')],'as':'Contact','attributes':['id',_0xbf50('0xd1'),_0xbf50('0xd2')],'raw':!![]});if(_0x2171bc[_0xbf50('0x3d')][_0xbf50('0xcc')]){_0x2122b7['push']({'model':db[_0xbf50('0xd3')],'as':_0xbf50('0xd3'),'raw':!![]});}var _0x5169cc=[{'model':db[_0xbf50('0xbc')],'as':_0xbf50('0xd4'),'attributes':['id',_0xbf50('0x6f'),_0xbf50('0x75'),_0xbf50('0xd5'),_0xbf50('0xd6'),_0xbf50('0x7b')],'include':_0x2122b7}];_0x5169cc[_0xbf50('0x37')]({'model':db[_0xbf50('0xd7')],'as':_0xbf50('0xd8'),'attributes':['id',_0xbf50('0x2f')]});_0x5169cc[_0xbf50('0x37')]({'model':db['User'],'as':'Owner','attributes':['id',_0xbf50('0xcf')]});return db[_0xbf50('0x99')][_0xbf50('0x5d')]({'where':{'id':_0x2171bc[_0xbf50('0xb1')]['id']},'include':_0x5169cc})[_0xbf50('0x2b')](handleEntityNotFound(_0x1ad876,null))['then'](function(_0x175d0d){if(_0x175d0d){var _0x65aa54=_0x175d0d[_0xbf50('0xd9')]({'plain':!![]});fs[_0xbf50('0xda')](_0x2b3ee1);var _0x28fad7={'channel':_0xbf50('0xdb'),'account':_0x65aa54[_0xbf50('0xd8')][_0xbf50('0x2f')],'agent':_0x65aa54[_0xbf50('0xdc')]?_0x65aa54[_0xbf50('0xdc')][_0xbf50('0xcf')]:_0xbf50('0xdd'),'createdAt':moment(_0x65aa54[_0xbf50('0x75')])['format'](_0xbf50('0xc0'))['toString'](),'closedAt':_0x65aa54[_0xbf50('0xde')]?moment(_0x65aa54['closedAt'])[_0xbf50('0xbf')](_0xbf50('0xc0'))[_0xbf50('0x96')]():'','disposition':_0x65aa54['disposition'],'messages':_(_0x65aa54[_0xbf50('0xd4')])[_0xbf50('0x80')]({'secret':![]})['map'](function(_0x1ab97d){if(_0x1ab97d[_0xbf50('0xd3')]){var _0x187223=path[_0xbf50('0xcb')](_0x3f1686,_0x1ab97d[_0xbf50('0xd3')][_0xbf50('0xdf')]);if(fs[_0xbf50('0xe0')](_0x187223)){fs[_0xbf50('0xe1')](_0x187223)[_0xbf50('0xe2')](fs['createWriteStream'](path['join'](_0x2b3ee1,_0x1ab97d[_0xbf50('0xd3')][_0xbf50('0xdf')])));}}return{'date':moment(_0x1ab97d['createdAt'])[_0xbf50('0xbf')](_0xbf50('0xc0'))[_0xbf50('0x96')](),'sender':_0x1ab97d[_0xbf50('0xd5')]===_0xbf50('0xe3')?_0x1ab97d['User']?_0x1ab97d['User']['fullname']:'System':_0x1ab97d['Contact'][_0xbf50('0xd1')]+(_0x1ab97d[_0xbf50('0x61')]['lastName']?'\x20'+_0x1ab97d[_0xbf50('0x61')][_0xbf50('0xd2')]:''),'body':_0x1ab97d[_0xbf50('0xd3')]?_0x1ab97d[_0xbf50('0xd3')][_0xbf50('0xdf')]:_0x1ab97d[_0xbf50('0x6f')],'direction':_0x1ab97d[_0xbf50('0xd5')]===_0xbf50('0xe3')?'A':'C','secret':_0x1ab97d['secret'],'read':_0x1ab97d[_0xbf50('0x7b')],'attachment':_0x1ab97d['Attachment']};})['value']()};return ejs[_0xbf50('0xe4')](path[_0xbf50('0xcb')](config[_0xbf50('0xc7')],_0xbf50('0xc8'),_0xbf50('0xe5'),_0xbf50('0xe6')),{'interaction':_0x28fad7})[_0xbf50('0x2b')](function(_0x49d7ae){var _0x453f77=path['join'](_0x2b3ee1,'transcript-'+_0x65aa54['id']+'-'+_0xc35d7b+_0xbf50('0xe7'));var _0x4ac69b={'path':_0x453f77,'channel':'Whatsapp','interactionId':_0x65aa54['id']};return pdf['createPdfFromHTML'](_0x49d7ae,_0x4ac69b);})[_0xbf50('0x2b')](function(){return new BPromise(function(_0x4a630c,_0x33c9cf){zipdir(_0x2b3ee1,{'saveTo':_0x29a27d},function(_0x3c678b,_0x3e9d7e){if(_0x3c678b)return _0x33c9cf(_0x3c678b);return _0x4a630c(_0x3e9d7e);});})[_0xbf50('0x2b')](function(){return new BPromise(function(_0x412626,_0x417b6d){rimraf(_0x2b3ee1,function(_0x47eb59){if(_0x47eb59)_0x417b6d(_0x47eb59);return _0x412626();});});})[_0xbf50('0x2b')](function(){return _0x1ad876['download'](_0x29a27d,_0x4e7098,function(_0x33e4b3){if(_0x33e4b3){console[_0xbf50('0xe8')](_0xbf50('0xe9'),_0x33e4b3);}else{fs[_0xbf50('0xea')](_0x29a27d);}});});});}else{return _0x1ad876[_0xbf50('0x1e')](0xc8);}})['catch'](handleError(_0x1ad876,null));}; \ No newline at end of file +var _0x95f2=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','error','stack','name','send','map','TagIds','Tags','split','forEach','catch','WhatsappInteraction','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','select','field','tools_tags','u.id','u.fullname','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','from','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','find','unreadMessages','value','`\x20=\x200','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$gte','parse','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','all','show','params','include','options','create','describe','addMessage','ids','omit','getMessages','findOne','WhatsappMessage','intersection','pick','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','rows','color','emit','removeTags','download','unix','join','root','server','files','push','CmContact','lastName','attachments','Attachment','Messages','direction','Account','Owner','fullname','get','mkdirSync','Whatsapp','N.A.','closed','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','Contact','firstName','secret','renderFile','views','transcript-','.pdf','err','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path'];(function(_0x21c11f,_0x439add){var _0x5bccc1=function(_0x490024){while(--_0x490024){_0x21c11f['push'](_0x21c11f['shift']());}};_0x5bccc1(++_0x439add);}(_0x95f2,0xdf));var _0x295f=function(_0x22dac7,_0x45d32a){_0x22dac7=_0x22dac7-0x0;var _0x3e6cfa=_0x95f2[_0x22dac7];return _0x3e6cfa;};'use strict';var emlformat=require(_0x295f('0x0'));var rimraf=require(_0x295f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x295f('0x2'));var rp=require(_0x295f('0x3'));var moment=require(_0x295f('0x4'));var BPromise=require(_0x295f('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x295f('0x6'));var sox=require(_0x295f('0x7'));var csv=require(_0x295f('0x8'));var ejs=require(_0x295f('0x9'));var fs=require('fs');var fs_extra=require(_0x295f('0xa'));var _=require(_0x295f('0xb'));var squel=require(_0x295f('0xc'));var crypto=require(_0x295f('0xd'));var jsforce=require(_0x295f('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x295f('0xf'));var Papa=require('papaparse');var Redis=require(_0x295f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x295f('0x11'));var as=require(_0x295f('0x12'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x295f('0x13'));var logger=require(_0x295f('0x14'))('api');var utils=require(_0x295f('0x15'));var config=require(_0x295f('0x16'));var licenseUtil=require(_0x295f('0x17'));var db=require(_0x295f('0x18'))['db'];config['redis']=_[_0x295f('0x19')](config[_0x295f('0x1a')],{'host':_0x295f('0x1b'),'port':0x18eb});var socket=require(_0x295f('0x1c'))(new Redis(config[_0x295f('0x1a')]));require(_0x295f('0x1d'))['register'](socket);function respondWithStatusCode(_0x455c57,_0x143f9b){_0x143f9b=_0x143f9b||0xcc;return function(_0x369edf){if(_0x369edf){return _0x455c57[_0x295f('0x1e')](_0x143f9b);}return _0x455c57[_0x295f('0x1f')](_0x143f9b)[_0x295f('0x20')]();};}function respondWithResult(_0x26c12d,_0x2e2d17){_0x2e2d17=_0x2e2d17||0xc8;return function(_0x17a04e){if(_0x17a04e){return _0x26c12d[_0x295f('0x1f')](_0x2e2d17)[_0x295f('0x21')](_0x17a04e);}};}function respondWithFilteredResult(_0x1d063b,_0x3072bb){return function(_0x530d03){if(_0x530d03){var _0x5882f3=typeof _0x3072bb[_0x295f('0x22')]===_0x295f('0x23')&&typeof _0x3072bb[_0x295f('0x24')]===_0x295f('0x23');var _0xd37370=_0x530d03[_0x295f('0x25')];var _0x419150=_0x5882f3?0x0:_0x3072bb[_0x295f('0x22')];var _0x3b8d4d=_0x5882f3?_0x530d03[_0x295f('0x25')]:_0x3072bb[_0x295f('0x22')]+_0x3072bb[_0x295f('0x24')];var _0x4c194d;if(_0x3b8d4d>=_0xd37370){_0x3b8d4d=_0xd37370;_0x4c194d=0xc8;}else{_0x4c194d=0xce;}_0x1d063b[_0x295f('0x1f')](_0x4c194d);return _0x1d063b[_0x295f('0x26')]('Content-Range',_0x419150+'-'+_0x3b8d4d+'/'+_0xd37370)[_0x295f('0x21')](_0x530d03);}return null;};}function patchUpdates(_0x4dd3e1){return function(_0x2ad19e){try{jsonpatch['apply'](_0x2ad19e,_0x4dd3e1,!![]);}catch(_0x1df335){return BPromise['reject'](_0x1df335);}return _0x2ad19e['save']();};}function saveUpdates(_0x175371,_0x463dbf){return function(_0x19dfb7){if(_0x19dfb7){return _0x19dfb7[_0x295f('0x27')](_0x175371)['then'](function(_0x136555){return _0x136555;});}return null;};}function removeEntity(_0x88425,_0x3e63f3){return function(_0x3141c1){if(_0x3141c1){return _0x3141c1['destroy']()[_0x295f('0x28')](function(){_0x88425[_0x295f('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c5f51,_0x226991){return function(_0x1b6fbc){if(!_0x1b6fbc){_0x3c5f51[_0x295f('0x1e')](0x194);}return _0x1b6fbc;};}function handleError(_0x5ad232,_0x55a341){_0x55a341=_0x55a341||0x1f4;return function(_0x47a602){logger[_0x295f('0x29')](_0x47a602[_0x295f('0x2a')]);if(_0x47a602['name']){delete _0x47a602[_0x295f('0x2b')];}_0x5ad232[_0x295f('0x1f')](_0x55a341)[_0x295f('0x2c')](_0x47a602);};}function getInteractionUsers(_0x2e9193,_0x33e8f3){return new BPromise(function(_0x3f2ff7,_0x5ef755){try{if(_0x33e8f3[_0x2e9193['id']]){_0x2e9193['Users']=_[_0x295f('0x2d')](_0x33e8f3[_0x2e9193['id']],function(_0x33d4af){return{'id':_0x33d4af['id'],'fullname':_0x33d4af['fullname']};});}}catch(_0x42253d){_0x5ef755(_0x42253d);}_0x3f2ff7(_0x2e9193);});}function getInteractionTags(_0x4bb366,_0xac0f6b){return new BPromise(function(_0xda0df8,_0x323c8c){try{if(_0x4bb366[_0x295f('0x2e')]){_0x4bb366[_0x295f('0x2f')]=[];_0x4bb366['TagIds'][_0x295f('0x30')](',')[_0x295f('0x31')](function(_0x5b66cc){_0x4bb366[_0x295f('0x2f')]['push'](_0xac0f6b[_0x5b66cc]);});}delete _0x4bb366[_0x295f('0x2e')];}catch(_0x9855e6){_0x323c8c(_0x9855e6);}_0xda0df8(_0x4bb366);});}function updateWhatsappInteraction(_0x1002ff,_0x229229,_0x1f3883){return new BPromise(function(_0x30fc33,_0x330d4a){return getInteractionUsers(_0x1002ff,_0x1f3883)['then'](function(_0x4b3afb){return getInteractionTags(_0x4b3afb,_0x229229);})[_0x295f('0x28')](function(_0x28424e){_0x30fc33(_0x28424e);})[_0x295f('0x32')](function(_0x28655b){_0x330d4a(_0x28655b);});});}exports['index']=function(_0x4ff088,_0x4f1db9){var _0x54b809={},_0x33866e={},_0x5c9531={'count':0x0,'rows':[]};var _0x2c42aa=_['map'](db[_0x295f('0x33')]['rawAttributes'],function(_0x3fe765){return{'name':_0x3fe765[_0x295f('0x34')],'type':_0x3fe765[_0x295f('0x35')][_0x295f('0x36')]};});_0x33866e[_0x295f('0x37')]=_[_0x295f('0x2d')](_0x2c42aa,_0x295f('0x2b'));_0x33866e[_0x295f('0x38')]=_[_0x295f('0x39')](_0x4ff088['query']);_0x33866e[_0x295f('0x3a')]=_['intersection'](_0x33866e['model'],_0x33866e[_0x295f('0x38')]);_0x54b809[_0x295f('0x3b')]=_['intersection'](_0x33866e[_0x295f('0x37')],qs[_0x295f('0x3c')](_0x4ff088[_0x295f('0x38')][_0x295f('0x3c')]));_0x54b809[_0x295f('0x3b')]=_0x54b809[_0x295f('0x3b')][_0x295f('0x3d')]?_0x54b809['attributes']:_0x33866e[_0x295f('0x37')];if(!_0x4ff088[_0x295f('0x38')][_0x295f('0x3e')]('nolimit')){_0x54b809[_0x295f('0x24')]=qs['limit'](_0x4ff088[_0x295f('0x38')][_0x295f('0x24')]);_0x54b809[_0x295f('0x22')]=qs['offset'](_0x4ff088['query'][_0x295f('0x22')]);}_0x54b809[_0x295f('0x3f')]=qs[_0x295f('0x40')](_0x4ff088['query']['sort']);_0x54b809[_0x295f('0x41')]=qs[_0x295f('0x3a')](_['pick'](_0x4ff088[_0x295f('0x38')],_0x33866e[_0x295f('0x3a')]),_0x2c42aa);var _0x5ac8ad=[];var _0x350bee=squel[_0x295f('0x42')]()[_0x295f('0x43')]('id')['field'](_0x295f('0x2b'))[_0x295f('0x43')]('color')['from'](_0x295f('0x44'));var _0x4b7e04=squel[_0x295f('0x42')]()['field'](_0x295f('0x45'))[_0x295f('0x43')](_0x295f('0x46'))[_0x295f('0x43')]('ui.WhatsappInteractionId')['from'](_0x295f('0x47'),'ui')[_0x295f('0x48')](_0x295f('0x49'),'u',_0x295f('0x4a'));var _0xdb34e4=squel[_0x295f('0x42')]()[_0x295f('0x4b')](_0x295f('0x4c'),'i')[_0x295f('0x48')](_0x295f('0x4d'),'c',_0x295f('0x4e'))['left_join'](_0x295f('0x49'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x295f('0x4f'),'a',_0x295f('0x50'))[_0x295f('0x48')](_0x295f('0x51'),'me',_0x295f('0x52'))[_0x295f('0x48')](_0x295f('0x53'),'it',_0x295f('0x54'))[_0x295f('0x48')]('tools_tags','t',_0x295f('0x55'));var _0x4854e3=squel[_0x295f('0x56')]();var _0x25246f=[];var _0x2f6276=squel[_0x295f('0x56')]();var _0x8201b0;if(_0x4ff088[_0x295f('0x38')]['search']){_0x8201b0=as[_0x295f('0x57')](_0x4ff088[_0x295f('0x38')][_0x295f('0x58')]);var _0xc2487d=_0x8201b0[_0x295f('0x59')];for(var _0x3e3b9c=0x0;_0x3e3b9c<_0x8201b0['conditions']['length'];_0x3e3b9c++){var _0x55988c=_0x8201b0['conditions'][_0x3e3b9c];var _0x349ee9='i';var _0x5df101=_[_0x295f('0x5a')](_0x2c42aa,[_0x295f('0x2b'),_0x55988c[_0x295f('0x43')]]);if(!_0x5df101){switch(_0x55988c[_0x295f('0x43')]){case _0x295f('0x5b'):if(_0x55988c[_0x295f('0x5c')]==0x1){_0xdb34e4['having']('`'+_0x55988c[_0x295f('0x43')]+_0x295f('0x5d'));}else{_0xdb34e4['having']('`'+_0x55988c[_0x295f('0x43')]+_0x295f('0x5e'));}break;case'Contact':if(_0x55988c[_0x295f('0x5f')]===_0x295f('0x60')){if(_0x55988c[_0x295f('0x5c')][_0x295f('0x30')]('\x20')[_0x295f('0x3d')]>0x1){_0x4854e3[_0xc2487d](_0x295f('0x61'),qs[_0x295f('0x62')](_0x55988c[_0x295f('0x5c')]),null);}else{var _0x60c354='%'+_0x55988c[_0x295f('0x5c')]+'%';_0x4854e3[_0xc2487d](_0x295f('0x63'),_0x60c354,_0x60c354,_0x60c354);}}else{_0x5df101=_[_0x295f('0x5a')](_0x2c42aa,[_0x295f('0x2b'),'ContactId']);_0x55988c['field']='ContactId';_0x50b655=as[_0x295f('0x64')](_0x349ee9,_0x5df101[_0x295f('0x35')],_0x55988c);_0x4854e3[_0xc2487d](_0x50b655[_0x295f('0x65')],_0x50b655[_0x295f('0x5c')][_0x295f('0x66')],_0x50b655['value'][_0x295f('0x20')]);}break;case _0x295f('0x67'):var _0x410348=_0x55988c['value'][_0x295f('0x30')](',')['map'](function(_0x80b23b){return Number(_0x80b23b);});_0x410348[_0x295f('0x31')](function(_0x43e37f){_0x2f6276['or'](_0x295f('0x68'),'%,'+_0x43e37f+',%');});_0x25246f=_[_0x295f('0x69')](_0x25246f,_0x410348);break;case _0x295f('0x6a'):if(_0x55988c[_0x295f('0x5f')]===_0x295f('0x60')){_0x4854e3[_0xc2487d](_0x295f('0x6b'),'%'+_0x55988c[_0x295f('0x5c')]+'%',null);}else{_0x5df101=_[_0x295f('0x5a')](_0x2c42aa,[_0x295f('0x2b'),_0x295f('0x6c')]);_0x55988c['field']=_0x295f('0x6c');_0x50b655=as[_0x295f('0x64')](_0x349ee9,_0x5df101[_0x295f('0x35')],_0x55988c);_0x4854e3[_0xc2487d](_0x50b655['text'],_0x50b655[_0x295f('0x5c')][_0x295f('0x66')],_0x50b655[_0x295f('0x5c')][_0x295f('0x20')]);}break;case _0x295f('0x6d'):_0x50b655=as[_0x295f('0x64')]('me',null,_0x55988c);_0x4854e3[_0xc2487d](_0x50b655['text'],_0x50b655[_0x295f('0x5c')][_0x295f('0x66')],_0x50b655[_0x295f('0x5c')]['end']);break;}}else{var _0x50b655=as['buildExpression'](_0x349ee9,_0x5df101[_0x295f('0x35')],_0x55988c);_0x4854e3[_0xc2487d](_0x50b655['text'],_0x50b655[_0x295f('0x5c')][_0x295f('0x66')],_0x50b655[_0x295f('0x5c')][_0x295f('0x20')]);}}}else{var _0x2549bc=_(_0x4ff088[_0x295f('0x38')])['keys']()[_0x295f('0x2d')](function(_0x3e362d){return _[_0x295f('0x6e')](_0x2c42aa,[_0x295f('0x2b'),_0x3e362d])?_0x3e362d:undefined;})['compact']()[_0x295f('0x5c')]();if(!_[_0x295f('0x6f')](_0x2549bc)){_0x2549bc['forEach'](function(_0x252ab5){if(_0x252ab5===_0x295f('0x70')){_0xdb34e4[_0x295f('0x41')](_0x295f('0x71'),[][_0x295f('0x72')](_0x4ff088[_0x295f('0x38')][_0x252ab5]));}else if(_0x252ab5===_0x295f('0x73')){var _0x12610a=JSON['parse'](_0x4ff088[_0x295f('0x38')][_0x252ab5])[_0x295f('0x74')];var _0x5ae215=JSON[_0x295f('0x75')](_0x4ff088['query'][_0x252ab5])['$lte'];_0xdb34e4[_0x295f('0x41')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x12610a,_0x5ae215);}else{if(_0x4ff088['query'][_0x252ab5]==='null'){_0xdb34e4[_0x295f('0x41')]('i.'+_0x252ab5+_0x295f('0x76'));}else{_0xdb34e4[_0x295f('0x41')]('i.'+_0x252ab5+_0x295f('0x77'),_0x4ff088[_0x295f('0x38')][_0x252ab5]);}}});}if(_0x4ff088[_0x295f('0x38')][_0x295f('0x78')]){if(_0x4ff088['query'][_0x295f('0x78')]==0x1){_0xdb34e4[_0x295f('0x79')](_0x295f('0x7a'));}else{_0xdb34e4[_0x295f('0x79')]('`unreadMessages`\x20>\x200');}}if(_0x4ff088[_0x295f('0x38')][_0x295f('0x7b')]){_0x25246f=_[_0x295f('0x7c')](_0x4ff088['query'][_0x295f('0x7b')])?_0x4ff088[_0x295f('0x38')][_0x295f('0x7b')]:new Array(_0x4ff088['query']['tag']);_0x25246f[_0x295f('0x31')](function(_0x4b85e1){_0x2f6276['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4b85e1+',%');});}if(_0x4ff088[_0x295f('0x38')][_0x295f('0x7d')]){var _0x11ed8a=_0x4ff088[_0x295f('0x38')][_0x295f('0x7d')]['replace']('\x5c','\x5c\x5c')[_0x295f('0x7e')](/'/g,'\x27\x27');if(qs[_0x295f('0x7f')](_0x11ed8a)){_0x4854e3['or'](_0x295f('0x80'),_0x11ed8a+'%')['or'](_0x295f('0x81'),_0x11ed8a+'%');}else{_0x4854e3['or'](_0x295f('0x82'),qs[_0x295f('0x62')](_0x11ed8a))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x11ed8a+'%');}}}_0xdb34e4['where'](_0x4854e3);_0xdb34e4[_0x295f('0x83')]('i.id');var _0x5daca9={'type':db[_0x295f('0x84')][_0x295f('0x85')]['SELECT'],'raw':!![]};var _0x5ebee8=_0xdb34e4[_0x295f('0x86')]();_0x5ebee8[_0x295f('0x43')]('i.id');_0x5ebee8[_0x295f('0x43')](_0x295f('0x87'),_0x295f('0x5b'));if(_0x54b809[_0x295f('0x3f')]){_0x54b809['order'][_0x295f('0x31')](function(_0x47581f){var _0x28b37e=_0x47581f[0x0]===_0x295f('0x88')?_0x47581f[0x0]:'i.'+_0x47581f[0x0];_0xdb34e4[_0x295f('0x3f')](_0x28b37e,_0x47581f[0x1]==='DESC'?![]:!![]);});}if(!_[_0x295f('0x6f')](_0x25246f)){_0xdb34e4['having'](_0x2f6276);_0x5ebee8[_0x295f('0x41')](_0x295f('0x89'),_0x25246f);}BPromise[_0x295f('0x8a')]()[_0x295f('0x28')](function(){if(!_0x8201b0){if(_0x4ff088[_0x295f('0x38')][_0x295f('0x70')])return;_0x5ebee8[_0x295f('0x41')](_0x295f('0x8b'));_0xdb34e4[_0x295f('0x41')](_0x295f('0x8b'));return;}if(_0x4ff088[_0x295f('0x8c')][_0x295f('0x8d')]!==_0x295f('0x8e'))return;return _0x4ff088[_0x295f('0x8c')][_0x295f('0x8f')]({'attributes':['id'],'raw':!![]})['then'](function(_0x13ecc8){if(_['isEmpty'](_0x13ecc8)){_0x5ebee8['where'](_0x295f('0x90'));_0xdb34e4[_0x295f('0x41')](_0x295f('0x90'));}else{_0x5ebee8[_0x295f('0x41')]('i.WhatsappAccountId\x20IN\x20?',_['map'](_0x13ecc8,'id'));_0xdb34e4[_0x295f('0x41')](_0x295f('0x71'),_[_0x295f('0x2d')](_0x13ecc8,'id'));}});})[_0x295f('0x28')](function(){if(_0x4ff088[_0x295f('0x8c')][_0x295f('0x8d')]===_0x295f('0x8e')&&!_0x8201b0&&!_0x4ff088['query'][_0x295f('0x70')])return[];return db['sequelize'][_0x295f('0x38')](_0x5ebee8[_0x295f('0x91')](),_0x5daca9);})[_0x295f('0x28')](function(_0xe699ea){_0x5c9531[_0x295f('0x25')]=_0xe699ea[_0x295f('0x3d')];if(_0x5c9531[_0x295f('0x25')]===0x0)return[];return db[_0x295f('0x92')][_0x295f('0x38')](_0x350bee[_0x295f('0x91')](),_0x5daca9)['then'](function(_0x447261){_0x5ac8ad=_[_0x295f('0x93')](_0x447261,'id');_0x5daca9=_[_0x295f('0x94')](_0x5daca9,{'model':db[_0x295f('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4ff088[_0x295f('0x38')][_0x295f('0x3c')]){_0x54b809[_0x295f('0x3b')][_0x295f('0x31')](function(_0x21c767){_0xdb34e4['field']('i.'+_0x21c767);});}else{_0xdb34e4[_0x295f('0x43')](_0x295f('0x87'),_0x295f('0x5b'));_0xdb34e4[_0x295f('0x43')]('a.key',_0x295f('0x95'));_0xdb34e4[_0x295f('0x43')](_0x295f('0x96'),_0x295f('0x97'));_0xdb34e4[_0x295f('0x43')](_0x295f('0x98'),_0x295f('0x88'));_0xdb34e4[_0x295f('0x43')](_0x295f('0x99'));_0xdb34e4['field'](_0x295f('0x9a'),'Contact.firstName');_0xdb34e4[_0x295f('0x43')](_0x295f('0x9b'),_0x295f('0x9c'));_0xdb34e4[_0x295f('0x43')](_0x295f('0x9d'),_0x295f('0x9e'));_0xdb34e4[_0x295f('0x43')](_0x295f('0x9f'),_0x295f('0xa0'));_0xdb34e4['field']('c.mobile','Contact.mobile');_0xdb34e4['field'](_0x295f('0xa1'),'Contact.fax');_0xdb34e4['field'](_0x295f('0xa2'),_0x295f('0xa3'));_0xdb34e4[_0x295f('0x43')](_0x295f('0xa4'),_0x295f('0xa5'));_0xdb34e4['field'](_0x295f('0xa6'),'TagIds');}if(_0x54b809[_0x295f('0x24')])_0xdb34e4['limit'](_0x54b809['limit']);if(_0x54b809[_0x295f('0x22')])_0xdb34e4[_0x295f('0x22')](_0x54b809[_0x295f('0x22')]);return db[_0x295f('0x92')][_0x295f('0x38')](_0xdb34e4['toString'](),_0x5daca9);})[_0x295f('0x28')](function(_0x399fa3){if(_0x399fa3['length']>0x0)_0x4b7e04['where'](_0x295f('0xa7'),_['map'](_0x399fa3,'id'));return db[_0x295f('0x92')][_0x295f('0x38')](_0x4b7e04[_0x295f('0x91')](),_0x5daca9)[_0x295f('0x28')](function(_0x424dab){var _0xb6c0a0=_[_0x295f('0xa8')](_0x424dab,'WhatsappInteractionId');var _0x23b90e=[];_0x399fa3[_0x295f('0x31')](function(_0x494cee){_0x23b90e['push'](updateWhatsappInteraction(_0x494cee,_0x5ac8ad,_0xb6c0a0));});return BPromise[_0x295f('0xa9')](_0x23b90e);});});})[_0x295f('0x28')](function(_0x54444c){_0x5c9531['rows']=_0x54444c;return _0x5c9531;})[_0x295f('0x28')](respondWithFilteredResult(_0x4f1db9,_0x54b809))[_0x295f('0x32')](handleError(_0x4f1db9,null));};exports[_0x295f('0xaa')]=function(_0x2e00ee,_0x49d63c){var _0xbccf50={'raw':![],'where':{'id':_0x2e00ee[_0x295f('0xab')]['id']}},_0x1dbd09={};_0x1dbd09[_0x295f('0x37')]=_[_0x295f('0x39')](db[_0x295f('0x33')]['rawAttributes']);_0x1dbd09[_0x295f('0x38')]=_['keys'](_0x2e00ee[_0x295f('0x38')]);_0x1dbd09[_0x295f('0x3a')]=_['intersection'](_0x1dbd09[_0x295f('0x37')],_0x1dbd09['query']);_0xbccf50[_0x295f('0x3b')]=_['intersection'](_0x1dbd09[_0x295f('0x37')],qs['fields'](_0x2e00ee[_0x295f('0x38')][_0x295f('0x3c')]));_0xbccf50[_0x295f('0x3b')]=_0xbccf50['attributes'][_0x295f('0x3d')]?_0xbccf50[_0x295f('0x3b')]:_0x1dbd09[_0x295f('0x37')];if(_0x2e00ee[_0x295f('0x38')]['includeAll']){_0xbccf50[_0x295f('0xac')]=[{'all':!![]}];}_0xbccf50=_['merge']({},_0xbccf50,_0x2e00ee[_0x295f('0xad')]);return db[_0x295f('0x33')][_0x295f('0x5a')](_0xbccf50)['then'](handleEntityNotFound(_0x49d63c,null))[_0x295f('0x28')](respondWithResult(_0x49d63c,null))[_0x295f('0x32')](handleError(_0x49d63c,null));};exports['create']=function(_0x2d8b4a,_0x2b2143){return db[_0x295f('0x33')][_0x295f('0xae')](_0x2d8b4a['body'],{})[_0x295f('0x28')](respondWithResult(_0x2b2143,0xc9))['catch'](handleError(_0x2b2143,null));};exports[_0x295f('0x27')]=function(_0x16b972,_0x3fc944){if(_0x16b972[_0x295f('0x6d')]['id']){delete _0x16b972[_0x295f('0x6d')]['id'];}return db['WhatsappInteraction'][_0x295f('0x5a')]({'where':{'id':_0x16b972[_0x295f('0xab')]['id']}})[_0x295f('0x28')](handleEntityNotFound(_0x3fc944,null))['then'](saveUpdates(_0x16b972[_0x295f('0x6d')],null))[_0x295f('0x28')](respondWithResult(_0x3fc944,null))['catch'](handleError(_0x3fc944,null));};exports['destroy']=function(_0x4b48d3,_0x4831c7){return db[_0x295f('0x33')][_0x295f('0x5a')]({'where':{'id':_0x4b48d3[_0x295f('0xab')]['id']}})['then'](handleEntityNotFound(_0x4831c7,null))[_0x295f('0x28')](removeEntity(_0x4831c7,null))[_0x295f('0x32')](handleError(_0x4831c7,null));};exports[_0x295f('0xaf')]=function(_0x2767bf,_0xa1acc4){return db['WhatsappInteraction']['describe']()[_0x295f('0x28')](respondWithResult(_0xa1acc4,null))[_0x295f('0x32')](handleError(_0xa1acc4,null));};exports[_0x295f('0xb0')]=function(_0x1f263a,_0x455d7d,_0x2fed3a){return db['WhatsappMessage']['find']({'where':{'id':_0x1f263a[_0x295f('0xab')]['id']}})[_0x295f('0x28')](handleEntityNotFound(_0x455d7d,null))[_0x295f('0x28')](function(_0xd7e3dd){if(_0xd7e3dd){return _0xd7e3dd['addMessage'](_0x1f263a[_0x295f('0x6d')][_0x295f('0xb1')],_[_0x295f('0xb2')](_0x1f263a['body'],[_0x295f('0xb1'),'id'])||{});}})['then'](respondWithResult(_0x455d7d,null))[_0x295f('0x32')](handleError(_0x455d7d,null));};exports[_0x295f('0xb3')]=function(_0x56e539,_0x1b0101,_0x883b52){var _0x4e24c7={'raw':![],'where':{}};var _0x50c062={};var _0x105e96={'count':0x0,'rows':[]};return db[_0x295f('0x33')][_0x295f('0xb4')]({'where':{'id':_0x56e539[_0x295f('0xab')]['id']}})[_0x295f('0x28')](handleEntityNotFound(_0x1b0101,null))[_0x295f('0x28')](function(_0x3e3c3f){if(_0x3e3c3f){_0x50c062[_0x295f('0x37')]=_[_0x295f('0x39')](db[_0x295f('0xb5')]['rawAttributes']);_0x50c062[_0x295f('0x38')]=_[_0x295f('0x39')](_0x56e539[_0x295f('0x38')]);_0x50c062[_0x295f('0x3a')]=_[_0x295f('0xb6')](_0x50c062[_0x295f('0x37')],_0x50c062[_0x295f('0x38')]);_0x4e24c7[_0x295f('0x3b')]=_[_0x295f('0xb6')](_0x50c062[_0x295f('0x37')],qs[_0x295f('0x3c')](_0x56e539[_0x295f('0x38')][_0x295f('0x3c')]));_0x4e24c7[_0x295f('0x3b')]=_0x4e24c7[_0x295f('0x3b')][_0x295f('0x3d')]?_0x4e24c7[_0x295f('0x3b')]:_0x50c062['model'];if(!_0x56e539[_0x295f('0x38')]['hasOwnProperty']('nolimit')){_0x4e24c7[_0x295f('0x24')]=qs['limit'](_0x56e539['query']['limit']);_0x4e24c7[_0x295f('0x22')]=qs[_0x295f('0x22')](_0x56e539[_0x295f('0x38')]['offset']);}_0x4e24c7[_0x295f('0x3f')]=qs['sort'](_0x56e539[_0x295f('0x38')]['sort']);_0x4e24c7['where']=qs[_0x295f('0x3a')](_[_0x295f('0xb7')](_0x56e539[_0x295f('0x38')],_0x50c062[_0x295f('0x3a')]));_0x4e24c7[_0x295f('0x41')]['WhatsappInteractionId']=_0x3e3c3f['id'];if(_0x56e539['query'][_0x295f('0x7d')]){_0x4e24c7[_0x295f('0x41')]=_[_0x295f('0x94')](_0x4e24c7[_0x295f('0x41')],{'$or':_[_0x295f('0x2d')](_0x4e24c7[_0x295f('0x3b')],function(_0x32bd91){var _0x3d9e57={};_0x3d9e57[_0x32bd91]={'$like':'%'+_0x56e539[_0x295f('0x38')][_0x295f('0x7d')]+'%'};return _0x3d9e57;})});}if(_0x56e539[_0x295f('0x38')][_0x295f('0x74')]){var _0x2ba9c5=_0x56e539[_0x295f('0x38')][_0x295f('0x74')][_0x295f('0x30')](',');var _0x1d000c={};_0x1d000c[_0x2ba9c5[0x0]]={'$gte':moment(_0x2ba9c5[0x1])[_0x295f('0xb8')](_0x295f('0xb9'))};_0x4e24c7[_0x295f('0x41')]=_[_0x295f('0x94')](_0x4e24c7['where'],_0x1d000c);}_0x4e24c7=_[_0x295f('0x94')]({},_0x4e24c7,_0x56e539[_0x295f('0xad')]);return db[_0x295f('0xb5')][_0x295f('0x25')]({'where':_0x4e24c7[_0x295f('0x41')]})['then'](function(_0x578af7){_0x105e96[_0x295f('0x25')]=_0x578af7;if(_0x56e539[_0x295f('0x38')][_0x295f('0xba')]){_0x4e24c7[_0x295f('0xac')]=[{'all':!![]}];}return db[_0x295f('0xb5')][_0x295f('0xbb')](_0x4e24c7);})[_0x295f('0x28')](function(_0x129553){_0x105e96[_0x295f('0xbc')]=_0x129553;return _0x105e96;});}})['then'](respondWithFilteredResult(_0x1b0101,_0x4e24c7))[_0x295f('0x32')](handleError(_0x1b0101,null));};exports['addTags']=function(_0x163f20,_0x2a7a62,_0x21519f){return db[_0x295f('0x33')]['find']({'where':{'id':_0x163f20[_0x295f('0xab')]['id']}})[_0x295f('0x28')](handleEntityNotFound(_0x2a7a62,null))['then'](function(_0x5dedc8){if(_0x5dedc8){return _0x5dedc8['setTags'](_0x163f20[_0x295f('0x6d')]['ids'],_[_0x295f('0xb2')](_0x163f20['body'],['ids','id'])||{})['spread'](function(){return db[_0x295f('0x67')][_0x295f('0xbb')]({'attributes':['id',_0x295f('0x2b'),_0x295f('0xbd')],'where':{'id':_0x163f20[_0x295f('0x6d')]['ids']}});})[_0x295f('0x28')](function(_0x2e89ae){socket[_0x295f('0xbe')]('whatsappInteractionTags:save',{'id':Number(_0x163f20[_0x295f('0xab')]['id']),'tags':_0x2e89ae||[]});return{'id':Number(_0x163f20[_0x295f('0xab')]['id']),'tags':_0x2e89ae||[]};});}})[_0x295f('0x28')](respondWithResult(_0x2a7a62,null))[_0x295f('0x32')](handleError(_0x2a7a62,null));};exports[_0x295f('0xbf')]=function(_0x352265,_0x4666ac,_0x5ece69){return db[_0x295f('0x33')][_0x295f('0x5a')]({'where':{'id':_0x352265['params']['id']}})[_0x295f('0x28')](handleEntityNotFound(_0x4666ac,null))[_0x295f('0x28')](function(_0x32e367){if(_0x32e367){return _0x32e367[_0x295f('0xbf')](_0x352265[_0x295f('0x38')][_0x295f('0xb1')]);}})['then'](respondWithStatusCode(_0x4666ac,null))[_0x295f('0x32')](handleError(_0x4666ac,null));};exports[_0x295f('0xc0')]=function(_0x4cde8c,_0x5b527a){var _0x5c421b=moment()[_0x295f('0xc1')]()[_0x295f('0x91')]();var _0x4293d7=path[_0x295f('0xc2')](config[_0x295f('0xc3')],_0x295f('0xc4'),_0x295f('0xc5'),'tmp');var _0x2c5926=path[_0x295f('0xc2')](config[_0x295f('0xc3')],_0x295f('0xc4'),_0x295f('0xc5'),'attachments');var _0x501000=path[_0x295f('0xc2')](_0x4293d7,_0x5c421b);var _0x370273=util[_0x295f('0xb8')]('transcript-%d-%s.zip',_0x4cde8c['params']['id'],_0x5c421b);var _0x414311=path[_0x295f('0xc2')](_0x4293d7,_0x370273);var _0x1188c6=[];_0x1188c6[_0x295f('0xc6')]({'model':db['User'],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x1188c6[_0x295f('0xc6')]({'model':db[_0x295f('0xc7')],'as':'Contact','attributes':['id','firstName',_0x295f('0xc8')],'raw':!![]});if(_0x4cde8c[_0x295f('0x38')][_0x295f('0xc9')]){_0x1188c6[_0x295f('0xc6')]({'model':db['Attachment'],'as':_0x295f('0xca'),'raw':!![]});}var _0x57a7db=[{'model':db[_0x295f('0xb5')],'as':_0x295f('0xcb'),'attributes':['id',_0x295f('0x6d'),_0x295f('0x73'),_0x295f('0xcc'),'secret','read'],'include':_0x1188c6}];_0x57a7db[_0x295f('0xc6')]({'model':db['WhatsappAccount'],'as':_0x295f('0xcd'),'attributes':['id',_0x295f('0x2b')]});_0x57a7db[_0x295f('0xc6')]({'model':db['User'],'as':_0x295f('0xce'),'attributes':['id',_0x295f('0xcf')]});return db[_0x295f('0x33')][_0x295f('0x5a')]({'where':{'id':_0x4cde8c['params']['id']},'include':_0x57a7db})['then'](handleEntityNotFound(_0x5b527a,null))[_0x295f('0x28')](function(_0x4d4ec6){if(_0x4d4ec6){var _0x5f3576=_0x4d4ec6[_0x295f('0xd0')]({'plain':!![]});fs[_0x295f('0xd1')](_0x501000);var _0xac82c0={'channel':_0x295f('0xd2'),'account':_0x5f3576[_0x295f('0xcd')][_0x295f('0x2b')],'agent':_0x5f3576[_0x295f('0xce')]?_0x5f3576[_0x295f('0xce')][_0x295f('0xcf')]:_0x295f('0xd3'),'createdAt':moment(_0x5f3576['createdAt'])[_0x295f('0xb8')](_0x295f('0xb9'))[_0x295f('0x91')](),'closedAt':_0x5f3576[_0x295f('0xd4')]?moment(_0x5f3576['closedAt'])[_0x295f('0xb8')](_0x295f('0xb9'))['toString']():'','disposition':_0x5f3576[_0x295f('0xd5')],'messages':_(_0x5f3576['Messages'])['filter']({'secret':![]})[_0x295f('0x2d')](function(_0x5e82bd){if(_0x5e82bd[_0x295f('0xca')]){var _0x28e557=path['join'](_0x2c5926,_0x5e82bd[_0x295f('0xca')][_0x295f('0xd6')]);if(fs[_0x295f('0xd7')](_0x28e557)){fs[_0x295f('0xd8')](_0x28e557)[_0x295f('0xd9')](fs[_0x295f('0xda')](path[_0x295f('0xc2')](_0x501000,_0x5e82bd[_0x295f('0xca')][_0x295f('0xd6')])));}}return{'date':moment(_0x5e82bd['createdAt'])['format'](_0x295f('0xb9'))[_0x295f('0x91')](),'sender':_0x5e82bd[_0x295f('0xcc')]===_0x295f('0xdb')?_0x5e82bd['User']?_0x5e82bd[_0x295f('0x6a')]['fullname']:_0x295f('0xdc'):_0x5e82bd[_0x295f('0xdd')][_0x295f('0xde')]+(_0x5e82bd[_0x295f('0xdd')]['lastName']?'\x20'+_0x5e82bd[_0x295f('0xdd')][_0x295f('0xc8')]:''),'body':_0x5e82bd[_0x295f('0xca')]?_0x5e82bd['Attachment']['basename']:_0x5e82bd[_0x295f('0x6d')],'direction':_0x5e82bd[_0x295f('0xcc')]==='out'?'A':'C','secret':_0x5e82bd[_0x295f('0xdf')],'read':_0x5e82bd[_0x295f('0x78')],'attachment':_0x5e82bd[_0x295f('0xca')]};})[_0x295f('0x5c')]()};return ejs[_0x295f('0xe0')](path[_0x295f('0xc2')](config[_0x295f('0xc3')],_0x295f('0xc4'),_0x295f('0xe1'),'downloadInteraction.ejs'),{'interaction':_0xac82c0})[_0x295f('0x28')](function(_0x33bab6){var _0x4f4667=path[_0x295f('0xc2')](_0x501000,_0x295f('0xe2')+_0x5f3576['id']+'-'+_0x5c421b+_0x295f('0xe3'));var _0x36dbe8={'path':_0x4f4667,'channel':_0x295f('0xd2'),'interactionId':_0x5f3576['id']};return pdf['createPdfFromHTML'](_0x33bab6,_0x36dbe8);})[_0x295f('0x28')](function(){return new BPromise(function(_0x28c66c,_0x250a15){zipdir(_0x501000,{'saveTo':_0x414311},function(_0x57babf,_0x2353b4){if(_0x57babf)return _0x250a15(_0x57babf);return _0x28c66c(_0x2353b4);});})[_0x295f('0x28')](function(){return new BPromise(function(_0x503695,_0x279661){rimraf(_0x501000,function(_0x37ba51){if(_0x37ba51)_0x279661(_0x37ba51);return _0x503695();});});})[_0x295f('0x28')](function(){return _0x5b527a[_0x295f('0xc0')](_0x414311,_0x370273,function(_0x2838dc){if(_0x2838dc){console['log'](_0x295f('0xe4'),_0x2838dc);}else{fs[_0x295f('0xe5')](_0x414311);}});});});}else{return _0x5b527a[_0x295f('0x1e')](0xc8);}})[_0x295f('0x32')](handleError(_0x5b527a,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 593c31b..272e526 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 _0x1cc3=['getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x1cc3,0x11b));var _0x31cc=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x1cc3[_0x138adb];return _0x1b27f2;};'use strict';var EventEmitter=require(_0x31cc('0x0'));var WhatsappInteraction=require(_0x31cc('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x31cc('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x31cc('0x2')](0x0);var events={'afterCreate':_0x31cc('0x3'),'afterUpdate':_0x31cc('0x4'),'afterDestroy':'remove'};function emitEvent(_0x103c04){return function(_0xebc7cc,_0x32b9a6,_0x541da0){_0xebc7cc[_0x31cc('0x5')]({'attributes':['id'],'raw':!![]})[_0x31cc('0x6')](function(_0x306896){_0xebc7cc[_0x31cc('0x7')](_0x31cc('0x8'),_0x306896[_0x31cc('0x9')](function(_0x6ac277){return{'id':_0x6ac277['id']};}));return WhatsappMessage[_0x31cc('0xa')]({'where':{'WhatsappInteractionId':_0xebc7cc['id'],'direction':'in','read':![]},'raw':!![]});})[_0x31cc('0x6')](function(_0x5a96bf){_0xebc7cc[_0x31cc('0x7')](_0x31cc('0xb'),_0x5a96bf[_0x31cc('0xc')]);WhatsappInteractionEvents[_0x31cc('0xd')](_0x103c04+':'+_0xebc7cc['id'],_0xebc7cc);WhatsappInteractionEvents[_0x31cc('0xd')](_0x103c04,_0xebc7cc);_0x541da0(null);})[_0x31cc('0xe')](_0x541da0(null));};}for(var e in events){if(events[_0x31cc('0xf')](e)){var event=events[e];WhatsappInteraction[_0x31cc('0x10')](e,emitEvent(event));}}module[_0x31cc('0x11')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xe28e=['length','emit','catch','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','findAll','unreadMessages'];(function(_0x4ee04c,_0x3e0798){var _0x1c9ad1=function(_0x9ae612){while(--_0x9ae612){_0x4ee04c['push'](_0x4ee04c['shift']());}};_0x1c9ad1(++_0x3e0798);}(_0xe28e,0x1ba));var _0xee28=function(_0x5af2b0,_0x2e2a22){_0x5af2b0=_0x5af2b0-0x0;var _0x3c4eef=_0xe28e[_0x5af2b0];return _0x3c4eef;};'use strict';var EventEmitter=require(_0xee28('0x0'));var WhatsappInteraction=require(_0xee28('0x1'))['db'][_0xee28('0x2')];var WhatsappMessage=require(_0xee28('0x1'))['db'][_0xee28('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xee28('0x4')](0x0);var events={'afterCreate':_0xee28('0x5'),'afterUpdate':_0xee28('0x6'),'afterDestroy':_0xee28('0x7')};function emitEvent(_0x40fdf8){return function(_0x1c7cb1,_0x43c350,_0x162d3f){_0x1c7cb1['getUsers']({'attributes':['id'],'raw':!![]})[_0xee28('0x8')](function(_0x30224a){_0x1c7cb1[_0xee28('0x9')](_0xee28('0xa'),_0x30224a[_0xee28('0xb')](function(_0x478b02){return{'id':_0x478b02['id']};}));return WhatsappMessage[_0xee28('0xc')]({'where':{'WhatsappInteractionId':_0x1c7cb1['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5afe44){_0x1c7cb1['setDataValue'](_0xee28('0xd'),_0x5afe44[_0xee28('0xe')]);WhatsappInteractionEvents['emit'](_0x40fdf8+':'+_0x1c7cb1['id'],_0x1c7cb1);WhatsappInteractionEvents[_0xee28('0xf')](_0x40fdf8,_0x1c7cb1);_0x162d3f(null);})[_0xee28('0x10')](_0x162d3f(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0xee28('0x11')](e,emitEvent(event));}}module[_0xee28('0x12')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index a288086..5959833 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 _0xc6a6=['define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports'];(function(_0x1c1bd5,_0x2f079c){var _0x3eb95b=function(_0x3b0ee2){while(--_0x3b0ee2){_0x1c1bd5['push'](_0x1c1bd5['shift']());}};_0x3eb95b(++_0x2f079c);}(_0xc6a6,0x1a6));var _0x6c6a=function(_0x15e2fc,_0x41b843){_0x15e2fc=_0x15e2fc-0x0;var _0x58db64=_0xc6a6[_0x15e2fc];return _0x58db64;};'use strict';var _=require('lodash');var util=require(_0x6c6a('0x0'));var logger=require(_0x6c6a('0x1'))('api');var moment=require(_0x6c6a('0x2'));var BPromise=require(_0x6c6a('0x3'));var rp=require(_0x6c6a('0x4'));var fs=require('fs');var path=require(_0x6c6a('0x5'));var rimraf=require(_0x6c6a('0x6'));var config=require(_0x6c6a('0x7'));var attributes=require(_0x6c6a('0x8'));module[_0x6c6a('0x9')]=function(_0x48d8bf,_0x2452cb){return _0x48d8bf[_0x6c6a('0xa')](_0x6c6a('0xb'),attributes,{'tableName':_0x6c6a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x52eb3c,_0x22671e,_0x22aff2){if(_0x52eb3c[_0x6c6a('0xd')](_0x6c6a('0xe'))){_0x52eb3c[_0x6c6a('0xf')]=moment()[_0x6c6a('0x10')](_0x6c6a('0x11'));}_0x22aff2(null,_0x52eb3c);}}});}; \ No newline at end of file +var _0x221f=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0x221f,0x14e));var _0xf221=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x221f[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0xf221('0x0'));var util=require(_0xf221('0x1'));var logger=require(_0xf221('0x2'))(_0xf221('0x3'));var moment=require(_0xf221('0x4'));var BPromise=require(_0xf221('0x5'));var rp=require(_0xf221('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf221('0x7'));var config=require(_0xf221('0x8'));var attributes=require(_0xf221('0x9'));module[_0xf221('0xa')]=function(_0xf5457,_0xf6a412){return _0xf5457['define'](_0xf221('0xb'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x239d8c,_0xbe80bb,_0x53ed13){if(_0x239d8c[_0xf221('0xc')](_0xf221('0xd'))){_0x239d8c[_0xf221('0xe')]=moment()['format'](_0xf221('0xf'));}_0x53ed13(null,_0x239d8c);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 28609d0..2af231f 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 _0xcdca=['where','attributes','limit','debug','catch','addTags','body','ids','omit','spread','AddTags','util','moment','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw'];(function(_0x4f4fa8,_0x455a27){var _0x563b7a=function(_0x32b71b){while(--_0x32b71b){_0x4f4fa8['push'](_0x4f4fa8['shift']());}};_0x563b7a(++_0x455a27);}(_0xcdca,0xfb));var _0xacdc=function(_0x25a01d,_0x5aabf0){_0x25a01d=_0x25a01d-0x0;var _0x5b2ab4=_0xcdca[_0x25a01d];return _0x5b2ab4;};'use strict';var _=require('lodash');var util=require(_0xacdc('0x0'));var moment=require(_0xacdc('0x1'));var BPromise=require('bluebird');var rs=require(_0xacdc('0x2'));var fs=require('fs');var Redis=require(_0xacdc('0x3'));var db=require(_0xacdc('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xacdc('0x5'));var jayson=require(_0xacdc('0x6'));var client=jayson[_0xacdc('0x7')][_0xacdc('0x8')]({'port':0x232a});config[_0xacdc('0x9')]=_['defaults'](config['redis'],{'host':_0xacdc('0xa'),'port':0x18eb});var socket=require(_0xacdc('0xb'))(new Redis(config['redis']));require(_0xacdc('0xc'))[_0xacdc('0xd')](socket);function respondWithRpcPromise(_0x37f8d6,_0x4157d2,_0x372b7a){return new BPromise(function(_0x37f7b3,_0x5860f2){return client[_0xacdc('0xe')](_0x37f8d6,_0x372b7a)[_0xacdc('0xf')](function(_0x43b9f9){logger[_0xacdc('0x10')](_0xacdc('0x11'),_0x4157d2,'request\x20sent');logger['debug'](_0xacdc('0x12'),_0x4157d2,_0xacdc('0x13'),JSON[_0xacdc('0x14')](_0x43b9f9));if(_0x43b9f9[_0xacdc('0x15')]){if(_0x43b9f9['error'][_0xacdc('0x16')]===0x1f4){logger[_0xacdc('0x15')](_0xacdc('0x11'),_0x4157d2,_0x43b9f9[_0xacdc('0x15')][_0xacdc('0x17')]);return _0x5860f2(_0x43b9f9['error'][_0xacdc('0x17')]);}logger[_0xacdc('0x15')](_0xacdc('0x11'),_0x4157d2,_0x43b9f9[_0xacdc('0x15')]['message']);return _0x37f7b3(_0x43b9f9[_0xacdc('0x15')][_0xacdc('0x17')]);}else{logger[_0xacdc('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x4157d2,'request\x20sent');_0x37f7b3(_0x43b9f9['result'][_0xacdc('0x17')]);}})['catch'](function(_0x361c75){logger[_0xacdc('0x15')](_0xacdc('0x11'),_0x4157d2,_0x361c75);_0x5860f2(_0x361c75);});});}exports[_0xacdc('0x18')]=function(_0x163839){var _0x24c03e=this;return new Promise(function(_0x51c09a,_0x5c3bf7){return db[_0xacdc('0x19')][_0xacdc('0x1a')](_0x163839['body'],{'raw':_0x163839[_0xacdc('0x1b')]?_0x163839['options'][_0xacdc('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x163839[_0xacdc('0x1b')]?_0x163839[_0xacdc('0x1b')][_0xacdc('0x1d')]||null:null,'attributes':_0x163839[_0xacdc('0x1b')]?_0x163839['options'][_0xacdc('0x1e')]||null:null,'limit':_0x163839['options']?_0x163839[_0xacdc('0x1b')][_0xacdc('0x1f')]||null:null})[_0xacdc('0xf')](function(_0x26ad5b){logger[_0xacdc('0x10')]('UpdateWhatsappInteraction',_0x163839);logger[_0xacdc('0x20')]('UpdateWhatsappInteraction',_0x163839,JSON[_0xacdc('0x14')](_0x26ad5b));_0x51c09a(_0x26ad5b);})[_0xacdc('0x21')](function(_0x575866){logger['error']('UpdateWhatsappInteraction',_0x575866[_0xacdc('0x17')],_0x163839);_0x5c3bf7(_0x24c03e[_0xacdc('0x15')](0x1f4,_0x575866[_0xacdc('0x17')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x154314){return new Promise(function(_0x4eecfe,_0x2974d9){return db[_0xacdc('0x19')]['find']({'where':_0x154314[_0xacdc('0x1b')]?_0x154314[_0xacdc('0x1b')]['where']||null:null})[_0xacdc('0xf')](function(_0x1b9e27){if(_0x1b9e27){return _0x1b9e27[_0xacdc('0x22')](_0x154314[_0xacdc('0x23')][_0xacdc('0x24')],_[_0xacdc('0x25')](_0x154314[_0xacdc('0x23')],[_0xacdc('0x24'),'id'])||{});}})[_0xacdc('0x26')](function(_0x4f3a72){logger['info'](_0xacdc('0x27'),_0x154314);logger[_0xacdc('0x20')](_0xacdc('0x27'),_0x154314,JSON[_0xacdc('0x14')](_0x4f3a72));_0x4eecfe(_0x4f3a72);})[_0xacdc('0x21')](function(_0x41031e){logger['error'](_0xacdc('0x27'),_0x41031e[_0xacdc('0x17')],_0x154314);_0x2974d9(_this[_0xacdc('0x15')](0x1f4,_0x41031e[_0xacdc('0x17')]));});});}; \ No newline at end of file +var _0xf62f=['AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','request\x20sent','debug','error','WhatsappInteraction,\x20%s,\x20%s','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','where','attributes','limit','stringify','AddTagsToWhatsappInteraction','find','ids'];(function(_0x48ed8c,_0x298f37){var _0x55bbee=function(_0x607804){while(--_0x607804){_0x48ed8c['push'](_0x48ed8c['shift']());}};_0x55bbee(++_0x298f37);}(_0xf62f,0x173));var _0xff62=function(_0x242b1e,_0x5ccb20){_0x242b1e=_0x242b1e-0x0;var _0xe9e3ac=_0xf62f[_0x242b1e];return _0xe9e3ac;};'use strict';var _=require('lodash');var util=require(_0xff62('0x0'));var moment=require(_0xff62('0x1'));var BPromise=require(_0xff62('0x2'));var rs=require(_0xff62('0x3'));var fs=require('fs');var Redis=require(_0xff62('0x4'));var db=require(_0xff62('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xff62('0x6'))(_0xff62('0x7'));var config=require('../../config/environment');var jayson=require(_0xff62('0x8'));var client=jayson['client'][_0xff62('0x9')]({'port':0x232a});config[_0xff62('0xa')]=_[_0xff62('0xb')](config[_0xff62('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xff62('0xc'))(new Redis(config[_0xff62('0xa')]));require(_0xff62('0xd'))[_0xff62('0xe')](socket);function respondWithRpcPromise(_0x66d4bd,_0x5f5286,_0x38ba94){return new BPromise(function(_0x1c4a52,_0x3568b2){return client[_0xff62('0xf')](_0x66d4bd,_0x38ba94)[_0xff62('0x10')](function(_0x285dea){logger[_0xff62('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x5f5286,_0xff62('0x12'));logger[_0xff62('0x13')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x5f5286,_0xff62('0x12'),JSON['stringify'](_0x285dea));if(_0x285dea[_0xff62('0x14')]){if(_0x285dea['error']['code']===0x1f4){logger[_0xff62('0x14')](_0xff62('0x15'),_0x5f5286,_0x285dea[_0xff62('0x14')]['message']);return _0x3568b2(_0x285dea[_0xff62('0x14')][_0xff62('0x16')]);}logger[_0xff62('0x14')](_0xff62('0x15'),_0x5f5286,_0x285dea['error'][_0xff62('0x16')]);return _0x1c4a52(_0x285dea[_0xff62('0x14')]['message']);}else{logger[_0xff62('0x11')](_0xff62('0x15'),_0x5f5286,_0xff62('0x12'));_0x1c4a52(_0x285dea['result']['message']);}})[_0xff62('0x17')](function(_0x3cd3fd){logger['error'](_0xff62('0x15'),_0x5f5286,_0x3cd3fd);_0x3568b2(_0x3cd3fd);});});}exports[_0xff62('0x18')]=function(_0x1a24b7){var _0x1b34f8=this;return new Promise(function(_0x41b49f,_0x3cccda){return db[_0xff62('0x19')][_0xff62('0x1a')](_0x1a24b7[_0xff62('0x1b')],{'raw':_0x1a24b7[_0xff62('0x1c')]?_0x1a24b7['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a24b7['options']?_0x1a24b7[_0xff62('0x1c')][_0xff62('0x1d')]||null:null,'attributes':_0x1a24b7['options']?_0x1a24b7[_0xff62('0x1c')][_0xff62('0x1e')]||null:null,'limit':_0x1a24b7['options']?_0x1a24b7['options'][_0xff62('0x1f')]||null:null})[_0xff62('0x10')](function(_0x528e06){logger['info'](_0xff62('0x18'),_0x1a24b7);logger[_0xff62('0x13')]('UpdateWhatsappInteraction',_0x1a24b7,JSON[_0xff62('0x20')](_0x528e06));_0x41b49f(_0x528e06);})['catch'](function(_0x4872ba){logger[_0xff62('0x14')](_0xff62('0x18'),_0x4872ba[_0xff62('0x16')],_0x1a24b7);_0x3cccda(_0x1b34f8[_0xff62('0x14')](0x1f4,_0x4872ba['message']));});});};exports[_0xff62('0x21')]=function(_0x3f697e){return new Promise(function(_0x3cb433,_0x2b051f){return db[_0xff62('0x19')][_0xff62('0x22')]({'where':_0x3f697e[_0xff62('0x1c')]?_0x3f697e[_0xff62('0x1c')][_0xff62('0x1d')]||null:null})[_0xff62('0x10')](function(_0x5cb746){if(_0x5cb746){return _0x5cb746['addTags'](_0x3f697e[_0xff62('0x1b')]['ids'],_['omit'](_0x3f697e[_0xff62('0x1b')],[_0xff62('0x23'),'id'])||{});}})['spread'](function(_0xa7718f){logger[_0xff62('0x11')](_0xff62('0x24'),_0x3f697e);logger[_0xff62('0x13')](_0xff62('0x24'),_0x3f697e,JSON[_0xff62('0x20')](_0xa7718f));_0x3cb433(_0xa7718f);})[_0xff62('0x17')](function(_0xb1e115){logger[_0xff62('0x14')](_0xff62('0x24'),_0xb1e115[_0xff62('0x16')],_0x3f697e);_0x2b051f(_this[_0xff62('0x14')](0x1f4,_0xb1e115[_0xff62('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index d9d02b9..468c6b7 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 _0xe8e7=['emit','removeListener','length','whatsappInteraction:','./whatsappInteraction.events','remove','update'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe8e7,0x1cb));var _0x7e8e=function(_0xe5d453,_0x4791ce){_0xe5d453=_0xe5d453-0x0;var _0xce0091=_0xe8e7[_0xe5d453];return _0xce0091;};'use strict';var WhatsappInteractionEvents=require(_0x7e8e('0x0'));var events=['save',_0x7e8e('0x1'),_0x7e8e('0x2')];function createListener(_0x3750e4,_0x32b92b){return function(_0x3b1858){_0x32b92b[_0x7e8e('0x3')](_0x3750e4,_0x3b1858);};}function removeListener(_0xd99084,_0x3b8dc6){return function(){WhatsappInteractionEvents[_0x7e8e('0x4')](_0xd99084,_0x3b8dc6);};}exports['register']=function(_0x49ac85){for(var _0x307978=0x0,_0x38c680=events[_0x7e8e('0x5')];_0x307978<_0x38c680;_0x307978++){var _0x43e110=events[_0x307978];var _0x1dfaeb=createListener(_0x7e8e('0x6')+_0x43e110,_0x49ac85);WhatsappInteractionEvents['on'](_0x43e110,_0x1dfaeb);}}; \ No newline at end of file +var _0x7486=['register','length','whatsappInteraction:','./whatsappInteraction.events','save','remove','update','emit','removeListener'];(function(_0x88bc71,_0x391a44){var _0x48aaa2=function(_0x2522cd){while(--_0x2522cd){_0x88bc71['push'](_0x88bc71['shift']());}};_0x48aaa2(++_0x391a44);}(_0x7486,0x147));var _0x6748=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7486[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappInteractionEvents=require(_0x6748('0x0'));var events=[_0x6748('0x1'),_0x6748('0x2'),_0x6748('0x3')];function createListener(_0x68e33d,_0x3d9892){return function(_0xb7dfbf){_0x3d9892[_0x6748('0x4')](_0x68e33d,_0xb7dfbf);};}function removeListener(_0x2aff36,_0x80d9d1){return function(){WhatsappInteractionEvents[_0x6748('0x5')](_0x2aff36,_0x80d9d1);};}exports[_0x6748('0x6')]=function(_0x267a51){for(var _0x479812=0x0,_0x199e98=events[_0x6748('0x7')];_0x479812<_0x199e98;_0x479812++){var _0x49cc2c=events[_0x479812];var _0x50da52=createListener(_0x6748('0x8')+_0x49cc2c,_0x267a51);WhatsappInteractionEvents['on'](_0x49cc2c,_0x50da52);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index a509a95..0e28e54 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 _0x176b=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','update','/:id/accept','accept','put','destroy','exports','multer','util','path'];(function(_0xf9aa97,_0x4ecbb5){var _0x54e7e3=function(_0x11c265){while(--_0x11c265){_0xf9aa97['push'](_0xf9aa97['shift']());}};_0x54e7e3(++_0x4ecbb5);}(_0x176b,0xc1));var _0xb176=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x176b[_0x186376];return _0x2dbdd9;};'use strict';var multer=require(_0xb176('0x0'));var util=require(_0xb176('0x1'));var path=require(_0xb176('0x2'));var timeout=require(_0xb176('0x3'));var express=require(_0xb176('0x4'));var router=express[_0xb176('0x5')]();var fs_extra=require(_0xb176('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb176('0x7'));var config=require('../../config/environment');var controller=require(_0xb176('0x8'));router[_0xb176('0x9')]('/',auth[_0xb176('0xa')](),controller[_0xb176('0xb')]);router[_0xb176('0x9')](_0xb176('0xc'),auth['isAuthenticated'](),controller[_0xb176('0xd')]);router[_0xb176('0x9')](_0xb176('0xe'),auth['isAuthenticated'](),controller[_0xb176('0xf')]);router[_0xb176('0x10')]('/',auth[_0xb176('0xa')](),interaction[_0xb176('0x11')](_0xb176('0x12'),_0xb176('0x13')),controller[_0xb176('0x14')]);router['post'](_0xb176('0x15'),controller['status']);router['put'](_0xb176('0xe'),auth[_0xb176('0xa')](),controller[_0xb176('0x16')]);router['put'](_0xb176('0x17'),auth[_0xb176('0xa')](),controller[_0xb176('0x18')]);router[_0xb176('0x19')]('/:id/reject',auth[_0xb176('0xa')](),controller['reject']);router['delete'](_0xb176('0xe'),auth[_0xb176('0xa')](),controller[_0xb176('0x1a')]);module[_0xb176('0x1b')]=router; \ No newline at end of file +var _0xa47d=['tracked','whatsapp','whatsappmessage:create','post','/:id/status','status','put','update','reject','delete','multer','util','path','fs-extra','../../components/auth/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','describe','/:id','show'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0xa47d,0x11e));var _0xda47=function(_0x38cfab,_0x3274c2){_0x38cfab=_0x38cfab-0x0;var _0x9ae20e=_0xa47d[_0x38cfab];return _0x9ae20e;};'use strict';var multer=require(_0xda47('0x0'));var util=require(_0xda47('0x1'));var path=require(_0xda47('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xda47('0x3'));var auth=require(_0xda47('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xda47('0x5'));var controller=require(_0xda47('0x6'));router[_0xda47('0x7')]('/',auth[_0xda47('0x8')](),controller[_0xda47('0x9')]);router[_0xda47('0x7')]('/describe',auth[_0xda47('0x8')](),controller[_0xda47('0xa')]);router[_0xda47('0x7')](_0xda47('0xb'),auth[_0xda47('0x8')](),controller[_0xda47('0xc')]);router['post']('/',auth[_0xda47('0x8')](),interaction[_0xda47('0xd')](_0xda47('0xe'),_0xda47('0xf')),controller['create']);router[_0xda47('0x10')](_0xda47('0x11'),controller[_0xda47('0x12')]);router[_0xda47('0x13')]('/:id',auth[_0xda47('0x8')](),controller[_0xda47('0x14')]);router['put']('/:id/accept',auth[_0xda47('0x8')](),controller['accept']);router[_0xda47('0x13')]('/:id/reject',auth[_0xda47('0x8')](),controller[_0xda47('0x15')]);router[_0xda47('0x16')]('/:id',auth[_0xda47('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index c751a4c..bb0ce78 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 _0x7c22=['out','DATE','STRING','sequelize','exports','medium','BOOLEAN'];(function(_0x518839,_0x26dde1){var _0x518e32=function(_0x133215){while(--_0x133215){_0x518839['push'](_0x518839['shift']());}};_0x518e32(++_0x26dde1);}(_0x7c22,0x6c));var _0x27c2=function(_0x4e4ee1,_0x11cd95){_0x4e4ee1=_0x4e4ee1-0x0;var _0x3c3c0e=_0x7c22[_0x4e4ee1];return _0x3c3c0e;};'use strict';var Sequelize=require(_0x27c2('0x0'));module[_0x27c2('0x1')]={'body':{'type':Sequelize['TEXT'](_0x27c2('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x27c2('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x27c2('0x4')),'defaultValue':_0x27c2('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x27c2('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x27c2('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xd55c=['DATE','sequelize','exports','TEXT','medium','BOOLEAN','out'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xd55c,0x14a));var _0xcd55=function(_0x4c2967,_0x4f8873){_0x4c2967=_0x4c2967-0x0;var _0x2c7e2b=_0xd55c[_0x4c2967];return _0x2c7e2b;};'use strict';var Sequelize=require(_0xcd55('0x0'));module[_0xcd55('0x1')]={'body':{'type':Sequelize[_0xcd55('0x2')](_0xcd55('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xcd55('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xcd55('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xcd55('0x6')]},'secret':{'type':Sequelize[_0xcd55('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xcd55('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 24d5476..2f730e4 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 _0xdf70=['get','WhatsappInteraction','WhatsappInteractionId','read1stAt','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','internal','SIP/%s','channel','event','accept','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','interface','motionChannel','rejectmessage','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','sendStatus','stack','name','index','map','WhatsappMessage','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','params','rawAttributes','create','body','find','destroy','describe','../../config/logger','whatsapp-interactions','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent'];(function(_0x18cbec,_0x1f8da8){var _0x5d1909=function(_0x6c2c32){while(--_0x6c2c32){_0x18cbec['push'](_0x18cbec['shift']());}};_0x5d1909(++_0x1f8da8);}(_0xdf70,0x1c2));var _0x0df7=function(_0x31ecbe,_0x5a424f){_0x31ecbe=_0x31ecbe-0x0;var _0x62cb0d=_0xdf70[_0x31ecbe];return _0x62cb0d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0df7('0x0'));var zipdir=require(_0x0df7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0df7('0x2'));var moment=require(_0x0df7('0x3'));var BPromise=require(_0x0df7('0x4'));var Mustache=require(_0x0df7('0x5'));var util=require(_0x0df7('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0df7('0x7'));var ejs=require(_0x0df7('0x8'));var fs=require('fs');var fs_extra=require(_0x0df7('0x9'));var _=require('lodash');var squel=require(_0x0df7('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0df7('0x7'));var querystring=require('querystring');var Papa=require(_0x0df7('0xb'));var Redis=require(_0x0df7('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x0df7('0xd'));var as=require(_0x0df7('0xe'));var hardwareService=require(_0x0df7('0xf'));var logger=require('../../config/logger')(_0x0df7('0x10'));var utils=require(_0x0df7('0x11'));var config=require(_0x0df7('0x12'));var licenseUtil=require(_0x0df7('0x13'));var db=require(_0x0df7('0x14'))['db'];config[_0x0df7('0x15')]=_[_0x0df7('0x16')](config[_0x0df7('0x15')],{'host':_0x0df7('0x17'),'port':0x18eb});var socket=require(_0x0df7('0x18'))(new Redis(config['redis']));require(_0x0df7('0x19'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x0df7('0x1a')][_0x0df7('0x1b')]({'port':0x232c});var client9002=jayson[_0x0df7('0x1a')][_0x0df7('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x48cc2d,_0x5c5382,_0x302cc6,_0x181b8f){return new BPromise(function(_0x3ed7c6,_0x51c779){var _0x565e80=_0x181b8f||client;return _0x565e80[_0x0df7('0x1c')](_0x48cc2d,_0x302cc6)[_0x0df7('0x1d')](function(_0x83adca){logger[_0x0df7('0x1e')](_0x0df7('0x1f'),_0x5c5382,_0x0df7('0x20'));logger[_0x0df7('0x21')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x5c5382,_0x0df7('0x20'),JSON[_0x0df7('0x22')](_0x83adca));if(_0x83adca[_0x0df7('0x23')]){if(_0x83adca[_0x0df7('0x23')][_0x0df7('0x24')]===0x1f4){logger['error'](_0x0df7('0x1f'),_0x5c5382,_0x83adca[_0x0df7('0x23')][_0x0df7('0x25')]);return _0x51c779(_0x83adca[_0x0df7('0x23')][_0x0df7('0x25')]);}logger[_0x0df7('0x23')](_0x0df7('0x1f'),_0x5c5382,_0x83adca[_0x0df7('0x23')]['message']);return _0x3ed7c6(_0x83adca[_0x0df7('0x23')][_0x0df7('0x25')]);}else{logger['info'](_0x0df7('0x1f'),_0x5c5382,_0x0df7('0x20'));_0x3ed7c6(_0x83adca[_0x0df7('0x26')]['message']);}})[_0x0df7('0x27')](function(_0x1f0e35){logger[_0x0df7('0x23')](_0x0df7('0x1f'),_0x5c5382,_0x1f0e35);_0x51c779(_0x1f0e35);});});}function respondWithStatusCode(_0x2de43c,_0x127de0){_0x127de0=_0x127de0||0xcc;return function(_0x1037d7){if(_0x1037d7){return _0x2de43c['sendStatus'](_0x127de0);}return _0x2de43c['status'](_0x127de0)[_0x0df7('0x28')]();};}function respondWithResult(_0x402d62,_0x3bb88a){_0x3bb88a=_0x3bb88a||0xc8;return function(_0x7e3f11){if(_0x7e3f11){return _0x402d62['status'](_0x3bb88a)[_0x0df7('0x29')](_0x7e3f11);}};}function respondWithFilteredResult(_0x2759a1,_0x597982){return function(_0x56c36d){if(_0x56c36d){var _0x175041=typeof _0x597982[_0x0df7('0x2a')]===_0x0df7('0x2b')&&typeof _0x597982[_0x0df7('0x2c')]===_0x0df7('0x2b');var _0x4995a2=_0x56c36d[_0x0df7('0x2d')];var _0x307e74=_0x175041?0x0:_0x597982[_0x0df7('0x2a')];var _0x505138=_0x175041?_0x56c36d[_0x0df7('0x2d')]:_0x597982[_0x0df7('0x2a')]+_0x597982[_0x0df7('0x2c')];var _0x4f7a2a;if(_0x505138>=_0x4995a2){_0x505138=_0x4995a2;_0x4f7a2a=0xc8;}else{_0x4f7a2a=0xce;}_0x2759a1[_0x0df7('0x2e')](_0x4f7a2a);return _0x2759a1[_0x0df7('0x2f')](_0x0df7('0x30'),_0x307e74+'-'+_0x505138+'/'+_0x4995a2)['json'](_0x56c36d);}return null;};}function patchUpdates(_0x2c4a4d){return function(_0x2cca03){try{jsonpatch[_0x0df7('0x31')](_0x2cca03,_0x2c4a4d,!![]);}catch(_0x573474){return BPromise[_0x0df7('0x32')](_0x573474);}return _0x2cca03['save']();};}function saveUpdates(_0x1f57ff,_0x500316){return function(_0x198e05){if(_0x198e05){return _0x198e05[_0x0df7('0x33')](_0x1f57ff)['then'](function(_0x569cdf){return _0x569cdf;});}return null;};}function removeEntity(_0x498107,_0x53c205){return function(_0x47e72e){if(_0x47e72e){return _0x47e72e['destroy']()[_0x0df7('0x1d')](function(){_0x498107[_0x0df7('0x2e')](0xcc)[_0x0df7('0x28')]();});}};}function handleEntityNotFound(_0x14a544,_0x2f72e2){return function(_0x1b0c8c){if(!_0x1b0c8c){_0x14a544[_0x0df7('0x34')](0x194);}return _0x1b0c8c;};}function handleError(_0x1c65b4,_0x3e85d5){_0x3e85d5=_0x3e85d5||0x1f4;return function(_0x35e3d7){logger[_0x0df7('0x23')](_0x35e3d7[_0x0df7('0x35')]);if(_0x35e3d7['name']){delete _0x35e3d7[_0x0df7('0x36')];}_0x1c65b4[_0x0df7('0x2e')](_0x3e85d5)['send'](_0x35e3d7);};}exports[_0x0df7('0x37')]=function(_0x3d7ff4,_0x4d68d1){var _0x333e27={},_0x220963={},_0x4acb44={'count':0x0,'rows':[]};var _0x2a8091=_[_0x0df7('0x38')](db[_0x0df7('0x39')]['rawAttributes'],function(_0x30a630){return{'name':_0x30a630[_0x0df7('0x3a')],'type':_0x30a630['type'][_0x0df7('0x3b')]};});_0x220963[_0x0df7('0x3c')]=_[_0x0df7('0x38')](_0x2a8091,_0x0df7('0x36'));_0x220963[_0x0df7('0x3d')]=_[_0x0df7('0x3e')](_0x3d7ff4[_0x0df7('0x3d')]);_0x220963[_0x0df7('0x3f')]=_[_0x0df7('0x40')](_0x220963[_0x0df7('0x3c')],_0x220963['query']);_0x333e27[_0x0df7('0x41')]=_[_0x0df7('0x40')](_0x220963[_0x0df7('0x3c')],qs['fields'](_0x3d7ff4[_0x0df7('0x3d')][_0x0df7('0x42')]));_0x333e27[_0x0df7('0x41')]=_0x333e27[_0x0df7('0x41')]['length']?_0x333e27[_0x0df7('0x41')]:_0x220963[_0x0df7('0x3c')];if(!_0x3d7ff4['query'][_0x0df7('0x43')](_0x0df7('0x44'))){_0x333e27[_0x0df7('0x2c')]=qs[_0x0df7('0x2c')](_0x3d7ff4[_0x0df7('0x3d')][_0x0df7('0x2c')]);_0x333e27[_0x0df7('0x2a')]=qs['offset'](_0x3d7ff4[_0x0df7('0x3d')][_0x0df7('0x2a')]);}_0x333e27[_0x0df7('0x45')]=qs['sort'](_0x3d7ff4[_0x0df7('0x3d')][_0x0df7('0x46')]);_0x333e27[_0x0df7('0x47')]=qs[_0x0df7('0x3f')](_[_0x0df7('0x48')](_0x3d7ff4[_0x0df7('0x3d')],_0x220963[_0x0df7('0x3f')]),_0x2a8091);if(_0x3d7ff4[_0x0df7('0x3d')][_0x0df7('0x49')]){_0x333e27['where']=_[_0x0df7('0x4a')](_0x333e27[_0x0df7('0x47')],{'$or':_['map'](_0x2a8091,function(_0x26ef1b){if(_0x26ef1b[_0x0df7('0x4b')]!==_0x0df7('0x4c')){var _0x101121={};_0x101121[_0x26ef1b[_0x0df7('0x36')]]={'$like':'%'+_0x3d7ff4[_0x0df7('0x3d')]['filter']+'%'};return _0x101121;}})});}_0x333e27=_['merge']({},_0x333e27,_0x3d7ff4[_0x0df7('0x4d')]);var _0x3b9fda={'where':_0x333e27[_0x0df7('0x47')]};return db[_0x0df7('0x39')][_0x0df7('0x2d')](_0x3b9fda)[_0x0df7('0x1d')](function(_0x5185fe){_0x4acb44[_0x0df7('0x2d')]=_0x5185fe;if(_0x3d7ff4[_0x0df7('0x3d')][_0x0df7('0x4e')]){_0x333e27[_0x0df7('0x4f')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x0df7('0x50')](_0x333e27);})[_0x0df7('0x1d')](function(_0x242eeb){_0x4acb44['rows']=_0x242eeb;return _0x4acb44;})[_0x0df7('0x1d')](respondWithFilteredResult(_0x4d68d1,_0x333e27))['catch'](handleError(_0x4d68d1,null));};exports['show']=function(_0x2000d1,_0xdccd2e){var _0x3130d4={'raw':!![],'where':{'id':_0x2000d1[_0x0df7('0x51')]['id']}},_0x13691a={};_0x13691a['model']=_['keys'](db[_0x0df7('0x39')][_0x0df7('0x52')]);_0x13691a[_0x0df7('0x3d')]=_[_0x0df7('0x3e')](_0x2000d1[_0x0df7('0x3d')]);_0x13691a['filters']=_[_0x0df7('0x40')](_0x13691a[_0x0df7('0x3c')],_0x13691a[_0x0df7('0x3d')]);_0x3130d4[_0x0df7('0x41')]=_[_0x0df7('0x40')](_0x13691a[_0x0df7('0x3c')],qs['fields'](_0x2000d1['query'][_0x0df7('0x42')]));_0x3130d4['attributes']=_0x3130d4[_0x0df7('0x41')]['length']?_0x3130d4[_0x0df7('0x41')]:_0x13691a[_0x0df7('0x3c')];if(_0x2000d1[_0x0df7('0x3d')][_0x0df7('0x4e')]){_0x3130d4[_0x0df7('0x4f')]=[{'all':!![]}];}_0x3130d4=_[_0x0df7('0x4a')]({},_0x3130d4,_0x2000d1[_0x0df7('0x4d')]);return db[_0x0df7('0x39')]['find'](_0x3130d4)['then'](handleEntityNotFound(_0xdccd2e,null))['then'](respondWithResult(_0xdccd2e,null))[_0x0df7('0x27')](handleError(_0xdccd2e,null));};exports[_0x0df7('0x53')]=function(_0x2b9bd7,_0x325fd3){return db[_0x0df7('0x39')][_0x0df7('0x53')](_0x2b9bd7[_0x0df7('0x54')],{})[_0x0df7('0x1d')](respondWithResult(_0x325fd3,0xc9))[_0x0df7('0x27')](handleError(_0x325fd3,null));};exports[_0x0df7('0x33')]=function(_0x2a6b9a,_0x30bbec){if(_0x2a6b9a['body']['id']){delete _0x2a6b9a[_0x0df7('0x54')]['id'];}return db[_0x0df7('0x39')][_0x0df7('0x55')]({'where':{'id':_0x2a6b9a[_0x0df7('0x51')]['id']}})['then'](handleEntityNotFound(_0x30bbec,null))[_0x0df7('0x1d')](saveUpdates(_0x2a6b9a['body'],null))[_0x0df7('0x1d')](respondWithResult(_0x30bbec,null))[_0x0df7('0x27')](handleError(_0x30bbec,null));};exports[_0x0df7('0x56')]=function(_0xcad2f,_0x5d4b09){return db[_0x0df7('0x39')]['find']({'where':{'id':_0xcad2f[_0x0df7('0x51')]['id']}})['then'](handleEntityNotFound(_0x5d4b09,null))[_0x0df7('0x1d')](removeEntity(_0x5d4b09,null))[_0x0df7('0x27')](handleError(_0x5d4b09,null));};exports['describe']=function(_0xe0f42,_0x4d2874){return db[_0x0df7('0x39')][_0x0df7('0x57')]()[_0x0df7('0x1d')](respondWithResult(_0x4d2874,null))[_0x0df7('0x27')](handleError(_0x4d2874,null));};var interaction_log=require(_0x0df7('0x58'))(_0x0df7('0x59'));exports['accept']=function(_0x480d46,_0x5da60e,_0x106a52){var _0x4855d5={'agent':{},'channel':_0x0df7('0x5a')};if(_0x480d46[_0x0df7('0x54')]['id']){delete _0x480d46[_0x0df7('0x54')]['id'];}_0x480d46[_0x0df7('0x54')][_0x0df7('0x5b')]=!![];_0x480d46['body'][_0x0df7('0x5c')]=moment()[_0x0df7('0x5d')](_0x0df7('0x5e'));_0x480d46['body'][_0x0df7('0x5f')]=_0x480d46[_0x0df7('0x54')]['UserId']||_0x480d46[_0x0df7('0x60')]['id'];_0x4855d5[_0x0df7('0x61')]['id']=_0x480d46['body'][_0x0df7('0x5f')];return db[_0x0df7('0x39')][_0x0df7('0x55')]({'where':{'id':_0x480d46[_0x0df7('0x51')]['id'],'UserId':null}})[_0x0df7('0x1d')](handleEntityNotFound(_0x5da60e,null))[_0x0df7('0x1d')](saveUpdates(_0x480d46['body'],null))[_0x0df7('0x1d')](function(_0x167a8e){if(_0x167a8e){_0x4855d5['message']=_0x167a8e[_0x0df7('0x62')]({'plain':!![]});return db[_0x0df7('0x63')][_0x0df7('0x55')]({'where':{'id':_0x167a8e[_0x0df7('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x5da60e,null))[_0x0df7('0x1d')](function(_0x527c8e){if(_0x527c8e){return _0x527c8e[_0x0df7('0x33')]({'UserId':_0x480d46[_0x0df7('0x54')][_0x0df7('0x5f')],'read1stAt':_['isNil'](_0x527c8e[_0x0df7('0x65')])?moment()[_0x0df7('0x5d')](_0x0df7('0x5e')):undefined});}return null;})['then'](function(_0x435194){if(_0x435194){_0x4855d5['interaction']=_0x435194['get']({'plain':!![]});interaction_log[_0x0df7('0x1e')](_0x0df7('0x66'),_0x480d46[_0x0df7('0x60')]['id'],_0x480d46[_0x0df7('0x60')][_0x0df7('0x36')],_0x480d46[_0x0df7('0x60')][_0x0df7('0x67')],_0x4855d5[_0x0df7('0x68')]['id'],_0x480d46['body']?JSON['stringify'](_0x480d46[_0x0df7('0x54')]):_0x0df7('0x69'));return respondWithRpcPromise(_0x0df7('0x6a'),_0x0df7('0x6b'),_0x4855d5);}return null;})[_0x0df7('0x1d')](function(_0xbc6440){var _0x214351='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xbc6440[_0x0df7('0x25')][_0x0df7('0x6c')];return db[_0x0df7('0x6d')][_0x0df7('0x3d')](_0x214351,{'type':db[_0x0df7('0x6e')][_0x0df7('0x6f')][_0x0df7('0x70')],'raw':!![]})[_0x0df7('0x1d')](function(_0x3116b5){return _0x3116b5;});})['then'](function(_0x562835){if(_0x562835){_0x4855d5[_0x0df7('0x25')][_0x0df7('0x71')]=_0x562835[0x0];if(!_0x480d46['body'][_0x0df7('0x5f')])return;return db[_0x0df7('0x72')][_0x0df7('0x55')]({'where':{'id':_0x480d46[_0x0df7('0x54')][_0x0df7('0x5f')],'role':_0x0df7('0x61')},'attributes':['id',_0x0df7('0x36'),'fullname',_0x0df7('0x73'),_0x0df7('0x74')],'raw':!![]});}return null;})[_0x0df7('0x1d')](function(_0x3da5cf){if(!_0x3da5cf)return null;_0x4855d5[_0x0df7('0x25')][_0x0df7('0x61')]=_0x3da5cf;return _0x4855d5;})['then'](function(_0x45eebc){if(_0x45eebc){if(_0x480d46[_0x0df7('0x54')]['manual']){_0x4855d5[_0x0df7('0x25')]['interface']=util[_0x0df7('0x5d')](_0x0df7('0x75'),_0x480d46['user'][_0x0df7('0x36')]);_0x4855d5[_0x0df7('0x25')][_0x0df7('0x76')]=_0x4855d5['channel'];_0x4855d5[_0x0df7('0x25')]['motionChannel']=_0x4855d5[_0x0df7('0x76')];_0x4855d5['message'][_0x0df7('0x77')]=_0x0df7('0x78');return respondWithRpcPromise(_0x0df7('0x79'),_0x0df7('0x79'),{'event':_0x0df7('0x7a'),'message':_0x4855d5['message']},client9002)[_0x0df7('0x1d')](function(){return _0x4855d5;});}return _0x4855d5;}return null;})[_0x0df7('0x1d')](respondWithResult(_0x5da60e,null))[_0x0df7('0x27')](handleError(_0x5da60e,null));};var interaction_log=require(_0x0df7('0x58'))('whatsapp-interactions');exports[_0x0df7('0x32')]=function(_0x495273,_0x402b45,_0x5173f9){var _0x1e80dc={'agent':{},'channel':_0x0df7('0x5a')};if(_0x495273[_0x0df7('0x54')]['id']){delete _0x495273['body']['id'];}_0x495273[_0x0df7('0x54')][_0x0df7('0x5f')]=_0x495273[_0x0df7('0x54')][_0x0df7('0x5f')]||_0x495273['user']['id'];_0x1e80dc[_0x0df7('0x61')]['id']=_0x495273[_0x0df7('0x54')][_0x0df7('0x5f')];return db[_0x0df7('0x39')]['find']({'where':{'id':_0x495273[_0x0df7('0x51')]['id'],'UserId':null}})[_0x0df7('0x1d')](handleEntityNotFound(_0x402b45,null))[_0x0df7('0x1d')](function(_0x2ed2b4){if(_0x2ed2b4){_0x1e80dc[_0x0df7('0x25')]=_0x2ed2b4[_0x0df7('0x62')]({'plain':!![]});return db['WhatsappInteraction'][_0x0df7('0x55')]({'where':{'id':_0x2ed2b4[_0x0df7('0x64')]}});}return null;})[_0x0df7('0x1d')](handleEntityNotFound(_0x402b45,null))[_0x0df7('0x1d')](function(_0x3e4c87){if(_0x3e4c87){_0x1e80dc[_0x0df7('0x68')]=_0x3e4c87['get']({'plain':!![]});interaction_log[_0x0df7('0x1e')](_0x0df7('0x7b'),_0x495273[_0x0df7('0x60')]['id'],_0x495273[_0x0df7('0x60')][_0x0df7('0x36')],_0x495273['user'][_0x0df7('0x67')],_0x1e80dc[_0x0df7('0x68')]['id'],_0x495273['body']?JSON[_0x0df7('0x22')](_0x495273[_0x0df7('0x54')]):_0x0df7('0x69'));return respondWithRpcPromise(_0x0df7('0x7c'),_0x0df7('0x7d'),_0x1e80dc);}return null;})[_0x0df7('0x1d')](function(_0x4f4898){var _0x332f02=_0x0df7('0x7e')+_0x4f4898[_0x0df7('0x25')][_0x0df7('0x6c')];return db[_0x0df7('0x6d')][_0x0df7('0x3d')](_0x332f02,{'type':db[_0x0df7('0x6e')][_0x0df7('0x6f')][_0x0df7('0x70')],'raw':!![]})[_0x0df7('0x1d')](function(_0x19f02a){return _0x19f02a;});})[_0x0df7('0x1d')](function(_0x461ecc){if(_0x461ecc){_0x1e80dc[_0x0df7('0x25')][_0x0df7('0x71')]=_0x461ecc[0x0];if(!_0x495273[_0x0df7('0x54')][_0x0df7('0x5f')])return;return db['User'][_0x0df7('0x55')]({'where':{'id':_0x495273[_0x0df7('0x54')][_0x0df7('0x5f')],'role':_0x0df7('0x61')},'attributes':['id',_0x0df7('0x36'),'fullname',_0x0df7('0x73'),_0x0df7('0x74')],'raw':!![]});}return null;})[_0x0df7('0x1d')](function(_0x467db9){if(!_0x467db9)return null;_0x1e80dc[_0x0df7('0x25')][_0x0df7('0x61')]=_0x467db9;return _0x1e80dc;})['then'](function(_0x260217){if(_0x260217){_0x260217[_0x0df7('0x25')][_0x0df7('0x7f')]=util[_0x0df7('0x5d')](_0x0df7('0x75'),_0x495273['user'][_0x0df7('0x36')]);_0x260217['message']['channel']=_0x1e80dc[_0x0df7('0x76')];_0x260217['message'][_0x0df7('0x80')]=_0x1e80dc['channel'];_0x260217[_0x0df7('0x25')]['event']='reject';respondWithRpcPromise('EventManager',_0x0df7('0x79'),{'event':_0x0df7('0x81'),'message':_0x260217[_0x0df7('0x25')]},client9002);return _0x1e80dc;}return null;})[_0x0df7('0x1d')](respondWithResult(_0x402b45,null))[_0x0df7('0x27')](handleError(_0x402b45,null));};exports[_0x0df7('0x2e')]=function(_0x458374,_0x182638,_0x57a8ac){if(_0x458374[_0x0df7('0x54')]['id']){delete _0x458374['body']['id'];}var _0x47b70c;return db[_0x0df7('0x39')]['find']({'where':{'id':_0x458374[_0x0df7('0x51')]['id']}})[_0x0df7('0x1d')](handleEntityNotFound(_0x182638,null))[_0x0df7('0x1d')](function(_0x12a687){if(_0x12a687){_0x47b70c=_0x12a687;return db['WhatsappAccount'][_0x0df7('0x55')]({'where':{'id':_0x12a687['WhatsappAccountId']}});}})[_0x0df7('0x1d')](handleEntityNotFound(_0x182638,null))[_0x0df7('0x1d')](function(_0x59b802){if(_0x59b802){logger[_0x0df7('0x21')](_0x0df7('0x82'),_0x0df7('0x2e'),_0x0df7('0x83'),_0x59b802[_0x0df7('0x4b')],util['inspect'](_0x458374['body'],{'showHidden':![],'depth':null}));switch(_0x59b802[_0x0df7('0x4b')]){case _0x0df7('0x84'):if(_0x458374[_0x0df7('0x54')]['MessageSid']&&_0x458374[_0x0df7('0x54')][_0x0df7('0x85')]===_0x47b70c['messageId']&&_0x458374['body'][_0x0df7('0x86')]&&_0x458374[_0x0df7('0x54')]['MessageStatus']===_0x0df7('0x5b')){return _0x47b70c[_0x0df7('0x33')]({'read':!![]});}else{logger[_0x0df7('0x23')](_0x0df7('0x87'),_0x0df7('0x2e'),_0x0df7('0x84'),util[_0x0df7('0x88')](_0x458374['body'],{'showHidden':![],'depth':null}));}break;}return _0x47b70c;}})[_0x0df7('0x1d')](respondWithResult(_0x182638,null))[_0x0df7('0x27')](handleError(_0x182638,null));}; \ No newline at end of file +var _0xec14=['eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','./whatsappMessage.socket','register','jayson/promise','client','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappMessage,\x20%s,\x20%s','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','reject','destroy','sendStatus','stack','name','index','map','WhatsappMessage','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','show','params','includeAll','find','create','update','body','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','WhatsappInteractionId','isNil','read1stAt','interaction','user','role','null','AcceptMessage','ContactId','sequelize','QueryTypes','SELECT','contact','fullname','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','User','email','rejectmessage','WhatsappAccount','WhatsappAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect'];(function(_0x285c48,_0x13ac4f){var _0x3b9961=function(_0x501329){while(--_0x501329){_0x285c48['push'](_0x285c48['shift']());}};_0x3b9961(++_0x13ac4f);}(_0xec14,0x85));var _0x4ec1=function(_0x1030ce,_0xbe3f74){_0x1030ce=_0x1030ce-0x0;var _0x3367fd=_0xec14[_0x1030ce];return _0x3367fd;};'use strict';var emlformat=require(_0x4ec1('0x0'));var rimraf=require(_0x4ec1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4ec1('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4ec1('0x3'));var Mustache=require(_0x4ec1('0x4'));var util=require(_0x4ec1('0x5'));var path=require(_0x4ec1('0x6'));var sox=require('sox');var csv=require(_0x4ec1('0x7'));var ejs=require(_0x4ec1('0x8'));var fs=require('fs');var fs_extra=require(_0x4ec1('0x9'));var _=require(_0x4ec1('0xa'));var squel=require('squel');var crypto=require(_0x4ec1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4ec1('0xc'));var toCsv=require(_0x4ec1('0x7'));var querystring=require(_0x4ec1('0xd'));var Papa=require(_0x4ec1('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4ec1('0xf'));var as=require(_0x4ec1('0x10'));var hardwareService=require(_0x4ec1('0x11'));var logger=require('../../config/logger')(_0x4ec1('0x12'));var utils=require(_0x4ec1('0x13'));var config=require(_0x4ec1('0x14'));var licenseUtil=require(_0x4ec1('0x15'));var db=require(_0x4ec1('0x16'))['db'];config[_0x4ec1('0x17')]=_['defaults'](config[_0x4ec1('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4ec1('0x17')]));require(_0x4ec1('0x18'))[_0x4ec1('0x19')](socket);var jayson=require(_0x4ec1('0x1a'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x4ec1('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x539df2,_0x2f4030,_0x1f858c,_0x1fe5c4){return new BPromise(function(_0x204582,_0x50d221){var _0x17e23a=_0x1fe5c4||client;return _0x17e23a[_0x4ec1('0x1c')](_0x539df2,_0x1f858c)[_0x4ec1('0x1d')](function(_0x1668ba){logger[_0x4ec1('0x1e')]('WhatsappMessage,\x20%s,\x20%s',_0x2f4030,_0x4ec1('0x1f'));logger[_0x4ec1('0x20')](_0x4ec1('0x21'),_0x2f4030,_0x4ec1('0x1f'),JSON[_0x4ec1('0x22')](_0x1668ba));if(_0x1668ba[_0x4ec1('0x23')]){if(_0x1668ba[_0x4ec1('0x23')][_0x4ec1('0x24')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x2f4030,_0x1668ba[_0x4ec1('0x23')][_0x4ec1('0x25')]);return _0x50d221(_0x1668ba[_0x4ec1('0x23')]['message']);}logger[_0x4ec1('0x23')](_0x4ec1('0x26'),_0x2f4030,_0x1668ba[_0x4ec1('0x23')]['message']);return _0x204582(_0x1668ba[_0x4ec1('0x23')][_0x4ec1('0x25')]);}else{logger[_0x4ec1('0x1e')](_0x4ec1('0x26'),_0x2f4030,_0x4ec1('0x1f'));_0x204582(_0x1668ba[_0x4ec1('0x27')][_0x4ec1('0x25')]);}})[_0x4ec1('0x28')](function(_0x2fc7c7){logger[_0x4ec1('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x2f4030,_0x2fc7c7);_0x50d221(_0x2fc7c7);});});}function respondWithStatusCode(_0x28b9ac,_0x3d93f6){_0x3d93f6=_0x3d93f6||0xcc;return function(_0x30ab62){if(_0x30ab62){return _0x28b9ac['sendStatus'](_0x3d93f6);}return _0x28b9ac[_0x4ec1('0x29')](_0x3d93f6)['end']();};}function respondWithResult(_0x1b0efe,_0x51296e){_0x51296e=_0x51296e||0xc8;return function(_0x55440e){if(_0x55440e){return _0x1b0efe[_0x4ec1('0x29')](_0x51296e)[_0x4ec1('0x2a')](_0x55440e);}};}function respondWithFilteredResult(_0x175481,_0x3409a2){return function(_0x2cd918){if(_0x2cd918){var _0x1e767a=typeof _0x3409a2[_0x4ec1('0x2b')]===_0x4ec1('0x2c')&&typeof _0x3409a2[_0x4ec1('0x2d')]===_0x4ec1('0x2c');var _0x457d4c=_0x2cd918['count'];var _0x19097f=_0x1e767a?0x0:_0x3409a2[_0x4ec1('0x2b')];var _0x185ead=_0x1e767a?_0x2cd918[_0x4ec1('0x2e')]:_0x3409a2[_0x4ec1('0x2b')]+_0x3409a2['limit'];var _0x3ba8ca;if(_0x185ead>=_0x457d4c){_0x185ead=_0x457d4c;_0x3ba8ca=0xc8;}else{_0x3ba8ca=0xce;}_0x175481[_0x4ec1('0x29')](_0x3ba8ca);return _0x175481[_0x4ec1('0x2f')](_0x4ec1('0x30'),_0x19097f+'-'+_0x185ead+'/'+_0x457d4c)['json'](_0x2cd918);}return null;};}function patchUpdates(_0x326939){return function(_0x2b80f2){try{jsonpatch['apply'](_0x2b80f2,_0x326939,!![]);}catch(_0x27323a){return BPromise[_0x4ec1('0x31')](_0x27323a);}return _0x2b80f2['save']();};}function saveUpdates(_0x1405db,_0x2b7f64){return function(_0x3ba97d){if(_0x3ba97d){return _0x3ba97d['update'](_0x1405db)[_0x4ec1('0x1d')](function(_0x196d0a){return _0x196d0a;});}return null;};}function removeEntity(_0x179c9b,_0x11d3ad){return function(_0x3fe66c){if(_0x3fe66c){return _0x3fe66c[_0x4ec1('0x32')]()[_0x4ec1('0x1d')](function(){_0x179c9b[_0x4ec1('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13e2a2,_0x4fee77){return function(_0x2bb7b6){if(!_0x2bb7b6){_0x13e2a2[_0x4ec1('0x33')](0x194);}return _0x2bb7b6;};}function handleError(_0x45bb9a,_0x25e692){_0x25e692=_0x25e692||0x1f4;return function(_0x296c26){logger['error'](_0x296c26[_0x4ec1('0x34')]);if(_0x296c26[_0x4ec1('0x35')]){delete _0x296c26[_0x4ec1('0x35')];}_0x45bb9a[_0x4ec1('0x29')](_0x25e692)['send'](_0x296c26);};}exports[_0x4ec1('0x36')]=function(_0x40df2a,_0x57c963){var _0x4c5892={},_0x4f172d={},_0x5e9c3a={'count':0x0,'rows':[]};var _0x388069=_[_0x4ec1('0x37')](db[_0x4ec1('0x38')][_0x4ec1('0x39')],function(_0x55855a){return{'name':_0x55855a['fieldName'],'type':_0x55855a[_0x4ec1('0x3a')]['key']};});_0x4f172d['model']=_[_0x4ec1('0x37')](_0x388069,_0x4ec1('0x35'));_0x4f172d[_0x4ec1('0x3b')]=_[_0x4ec1('0x3c')](_0x40df2a['query']);_0x4f172d[_0x4ec1('0x3d')]=_[_0x4ec1('0x3e')](_0x4f172d[_0x4ec1('0x3f')],_0x4f172d['query']);_0x4c5892[_0x4ec1('0x40')]=_['intersection'](_0x4f172d[_0x4ec1('0x3f')],qs[_0x4ec1('0x41')](_0x40df2a[_0x4ec1('0x3b')]['fields']));_0x4c5892[_0x4ec1('0x40')]=_0x4c5892[_0x4ec1('0x40')][_0x4ec1('0x42')]?_0x4c5892[_0x4ec1('0x40')]:_0x4f172d['model'];if(!_0x40df2a[_0x4ec1('0x3b')]['hasOwnProperty'](_0x4ec1('0x43'))){_0x4c5892['limit']=qs[_0x4ec1('0x2d')](_0x40df2a['query'][_0x4ec1('0x2d')]);_0x4c5892[_0x4ec1('0x2b')]=qs['offset'](_0x40df2a['query']['offset']);}_0x4c5892[_0x4ec1('0x44')]=qs[_0x4ec1('0x45')](_0x40df2a[_0x4ec1('0x3b')][_0x4ec1('0x45')]);_0x4c5892[_0x4ec1('0x46')]=qs[_0x4ec1('0x3d')](_[_0x4ec1('0x47')](_0x40df2a[_0x4ec1('0x3b')],_0x4f172d[_0x4ec1('0x3d')]),_0x388069);if(_0x40df2a[_0x4ec1('0x3b')][_0x4ec1('0x48')]){_0x4c5892[_0x4ec1('0x46')]=_[_0x4ec1('0x49')](_0x4c5892['where'],{'$or':_[_0x4ec1('0x37')](_0x388069,function(_0x5da4f1){if(_0x5da4f1['type']!=='VIRTUAL'){var _0x458596={};_0x458596[_0x5da4f1[_0x4ec1('0x35')]]={'$like':'%'+_0x40df2a[_0x4ec1('0x3b')][_0x4ec1('0x48')]+'%'};return _0x458596;}})});}_0x4c5892=_[_0x4ec1('0x49')]({},_0x4c5892,_0x40df2a[_0x4ec1('0x4a')]);var _0x425063={'where':_0x4c5892[_0x4ec1('0x46')]};return db[_0x4ec1('0x38')]['count'](_0x425063)[_0x4ec1('0x1d')](function(_0xf18328){_0x5e9c3a[_0x4ec1('0x2e')]=_0xf18328;if(_0x40df2a[_0x4ec1('0x3b')]['includeAll']){_0x4c5892[_0x4ec1('0x4b')]=[{'all':!![]}];}return db[_0x4ec1('0x38')][_0x4ec1('0x4c')](_0x4c5892);})[_0x4ec1('0x1d')](function(_0xf7ef08){_0x5e9c3a['rows']=_0xf7ef08;return _0x5e9c3a;})[_0x4ec1('0x1d')](respondWithFilteredResult(_0x57c963,_0x4c5892))[_0x4ec1('0x28')](handleError(_0x57c963,null));};exports[_0x4ec1('0x4d')]=function(_0x5523be,_0x1fff58){var _0x4a7f93={'raw':!![],'where':{'id':_0x5523be[_0x4ec1('0x4e')]['id']}},_0x2fdfda={};_0x2fdfda['model']=_[_0x4ec1('0x3c')](db[_0x4ec1('0x38')][_0x4ec1('0x39')]);_0x2fdfda[_0x4ec1('0x3b')]=_[_0x4ec1('0x3c')](_0x5523be['query']);_0x2fdfda[_0x4ec1('0x3d')]=_[_0x4ec1('0x3e')](_0x2fdfda['model'],_0x2fdfda[_0x4ec1('0x3b')]);_0x4a7f93[_0x4ec1('0x40')]=_[_0x4ec1('0x3e')](_0x2fdfda['model'],qs[_0x4ec1('0x41')](_0x5523be[_0x4ec1('0x3b')][_0x4ec1('0x41')]));_0x4a7f93[_0x4ec1('0x40')]=_0x4a7f93[_0x4ec1('0x40')][_0x4ec1('0x42')]?_0x4a7f93[_0x4ec1('0x40')]:_0x2fdfda['model'];if(_0x5523be[_0x4ec1('0x3b')][_0x4ec1('0x4f')]){_0x4a7f93[_0x4ec1('0x4b')]=[{'all':!![]}];}_0x4a7f93=_[_0x4ec1('0x49')]({},_0x4a7f93,_0x5523be[_0x4ec1('0x4a')]);return db['WhatsappMessage'][_0x4ec1('0x50')](_0x4a7f93)[_0x4ec1('0x1d')](handleEntityNotFound(_0x1fff58,null))['then'](respondWithResult(_0x1fff58,null))[_0x4ec1('0x28')](handleError(_0x1fff58,null));};exports[_0x4ec1('0x51')]=function(_0x569b93,_0x3526fd){return db[_0x4ec1('0x38')][_0x4ec1('0x51')](_0x569b93['body'],{})[_0x4ec1('0x1d')](respondWithResult(_0x3526fd,0xc9))['catch'](handleError(_0x3526fd,null));};exports[_0x4ec1('0x52')]=function(_0x5b1f43,_0xc4d65){if(_0x5b1f43[_0x4ec1('0x53')]['id']){delete _0x5b1f43[_0x4ec1('0x53')]['id'];}return db['WhatsappMessage'][_0x4ec1('0x50')]({'where':{'id':_0x5b1f43[_0x4ec1('0x4e')]['id']}})[_0x4ec1('0x1d')](handleEntityNotFound(_0xc4d65,null))[_0x4ec1('0x1d')](saveUpdates(_0x5b1f43[_0x4ec1('0x53')],null))[_0x4ec1('0x1d')](respondWithResult(_0xc4d65,null))[_0x4ec1('0x28')](handleError(_0xc4d65,null));};exports[_0x4ec1('0x32')]=function(_0x9a8ba2,_0x35f39c){return db[_0x4ec1('0x38')][_0x4ec1('0x50')]({'where':{'id':_0x9a8ba2[_0x4ec1('0x4e')]['id']}})['then'](handleEntityNotFound(_0x35f39c,null))[_0x4ec1('0x1d')](removeEntity(_0x35f39c,null))[_0x4ec1('0x28')](handleError(_0x35f39c,null));};exports['describe']=function(_0x583503,_0x1e71a0){return db[_0x4ec1('0x38')][_0x4ec1('0x54')]()[_0x4ec1('0x1d')](respondWithResult(_0x1e71a0,null))[_0x4ec1('0x28')](handleError(_0x1e71a0,null));};var interaction_log=require(_0x4ec1('0x55'))(_0x4ec1('0x56'));exports[_0x4ec1('0x57')]=function(_0x308e3b,_0x276fd1,_0x47f5be){var _0x21c7fb={'agent':{},'channel':_0x4ec1('0x58')};if(_0x308e3b[_0x4ec1('0x53')]['id']){delete _0x308e3b['body']['id'];}_0x308e3b[_0x4ec1('0x53')][_0x4ec1('0x59')]=!![];_0x308e3b[_0x4ec1('0x53')][_0x4ec1('0x5a')]=moment()[_0x4ec1('0x5b')](_0x4ec1('0x5c'));_0x308e3b[_0x4ec1('0x53')]['UserId']=_0x308e3b[_0x4ec1('0x53')][_0x4ec1('0x5d')]||_0x308e3b['user']['id'];_0x21c7fb[_0x4ec1('0x5e')]['id']=_0x308e3b[_0x4ec1('0x53')][_0x4ec1('0x5d')];return db[_0x4ec1('0x38')][_0x4ec1('0x50')]({'where':{'id':_0x308e3b[_0x4ec1('0x4e')]['id'],'UserId':null}})[_0x4ec1('0x1d')](handleEntityNotFound(_0x276fd1,null))[_0x4ec1('0x1d')](saveUpdates(_0x308e3b['body'],null))[_0x4ec1('0x1d')](function(_0x3687b3){if(_0x3687b3){_0x21c7fb[_0x4ec1('0x25')]=_0x3687b3[_0x4ec1('0x5f')]({'plain':!![]});return db['WhatsappInteraction'][_0x4ec1('0x50')]({'where':{'id':_0x3687b3[_0x4ec1('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x276fd1,null))['then'](function(_0x15a9d2){if(_0x15a9d2){return _0x15a9d2[_0x4ec1('0x52')]({'UserId':_0x308e3b[_0x4ec1('0x53')][_0x4ec1('0x5d')],'read1stAt':_[_0x4ec1('0x61')](_0x15a9d2[_0x4ec1('0x62')])?moment()[_0x4ec1('0x5b')](_0x4ec1('0x5c')):undefined});}return null;})[_0x4ec1('0x1d')](function(_0x23ffaf){if(_0x23ffaf){_0x21c7fb[_0x4ec1('0x63')]=_0x23ffaf['get']({'plain':!![]});interaction_log[_0x4ec1('0x1e')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x308e3b[_0x4ec1('0x64')]['id'],_0x308e3b[_0x4ec1('0x64')][_0x4ec1('0x35')],_0x308e3b[_0x4ec1('0x64')][_0x4ec1('0x65')],_0x21c7fb[_0x4ec1('0x63')]['id'],_0x308e3b[_0x4ec1('0x53')]?JSON['stringify'](_0x308e3b[_0x4ec1('0x53')]):_0x4ec1('0x66'));return respondWithRpcPromise(_0x4ec1('0x67'),'acceptMessage',_0x21c7fb);}return null;})[_0x4ec1('0x1d')](function(_0xcdb765){var _0x13202='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xcdb765[_0x4ec1('0x25')][_0x4ec1('0x68')];return db[_0x4ec1('0x69')][_0x4ec1('0x3b')](_0x13202,{'type':db['Sequelize'][_0x4ec1('0x6a')][_0x4ec1('0x6b')],'raw':!![]})[_0x4ec1('0x1d')](function(_0x257f6){return _0x257f6;});})[_0x4ec1('0x1d')](function(_0x1dff3b){if(_0x1dff3b){_0x21c7fb[_0x4ec1('0x25')][_0x4ec1('0x6c')]=_0x1dff3b[0x0];if(!_0x308e3b['body']['UserId'])return;return db['User'][_0x4ec1('0x50')]({'where':{'id':_0x308e3b[_0x4ec1('0x53')][_0x4ec1('0x5d')],'role':_0x4ec1('0x5e')},'attributes':['id',_0x4ec1('0x35'),_0x4ec1('0x6d'),'email',_0x4ec1('0x6e')],'raw':!![]});}return null;})[_0x4ec1('0x1d')](function(_0x597135){if(!_0x597135)return null;_0x21c7fb[_0x4ec1('0x25')][_0x4ec1('0x5e')]=_0x597135;return _0x21c7fb;})['then'](function(_0x4eec77){if(_0x4eec77){if(_0x308e3b[_0x4ec1('0x53')]['manual']){_0x21c7fb[_0x4ec1('0x25')][_0x4ec1('0x6f')]=util[_0x4ec1('0x5b')](_0x4ec1('0x70'),_0x308e3b[_0x4ec1('0x64')][_0x4ec1('0x35')]);_0x21c7fb['message'][_0x4ec1('0x71')]=_0x21c7fb[_0x4ec1('0x71')];_0x21c7fb[_0x4ec1('0x25')][_0x4ec1('0x72')]=_0x21c7fb[_0x4ec1('0x71')];_0x21c7fb[_0x4ec1('0x25')][_0x4ec1('0x73')]='accept';return respondWithRpcPromise(_0x4ec1('0x74'),_0x4ec1('0x74'),{'event':'acceptmessage','message':_0x21c7fb[_0x4ec1('0x25')]},client9002)[_0x4ec1('0x1d')](function(){return _0x21c7fb;});}return _0x21c7fb;}return null;})[_0x4ec1('0x1d')](respondWithResult(_0x276fd1,null))[_0x4ec1('0x28')](handleError(_0x276fd1,null));};var interaction_log=require(_0x4ec1('0x55'))(_0x4ec1('0x56'));exports[_0x4ec1('0x31')]=function(_0x3ad531,_0x37f761,_0x10a762){var _0x1da382={'agent':{},'channel':_0x4ec1('0x58')};if(_0x3ad531['body']['id']){delete _0x3ad531[_0x4ec1('0x53')]['id'];}_0x3ad531[_0x4ec1('0x53')]['UserId']=_0x3ad531[_0x4ec1('0x53')]['UserId']||_0x3ad531['user']['id'];_0x1da382[_0x4ec1('0x5e')]['id']=_0x3ad531[_0x4ec1('0x53')][_0x4ec1('0x5d')];return db[_0x4ec1('0x38')][_0x4ec1('0x50')]({'where':{'id':_0x3ad531[_0x4ec1('0x4e')]['id'],'UserId':null}})[_0x4ec1('0x1d')](handleEntityNotFound(_0x37f761,null))[_0x4ec1('0x1d')](function(_0x30f528){if(_0x30f528){_0x1da382['message']=_0x30f528['get']({'plain':!![]});return db[_0x4ec1('0x75')]['find']({'where':{'id':_0x30f528[_0x4ec1('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x37f761,null))[_0x4ec1('0x1d')](function(_0x375ee9){if(_0x375ee9){_0x1da382[_0x4ec1('0x63')]=_0x375ee9['get']({'plain':!![]});interaction_log[_0x4ec1('0x1e')](_0x4ec1('0x76'),_0x3ad531['user']['id'],_0x3ad531[_0x4ec1('0x64')][_0x4ec1('0x35')],_0x3ad531['user'][_0x4ec1('0x65')],_0x1da382['interaction']['id'],_0x3ad531['body']?JSON[_0x4ec1('0x22')](_0x3ad531['body']):_0x4ec1('0x66'));return respondWithRpcPromise('RejectMessage',_0x4ec1('0x77'),_0x1da382);}return null;})['then'](function(_0x518290){var _0x1a4802=_0x4ec1('0x78')+_0x518290['message'][_0x4ec1('0x68')];return db[_0x4ec1('0x69')][_0x4ec1('0x3b')](_0x1a4802,{'type':db['Sequelize'][_0x4ec1('0x6a')][_0x4ec1('0x6b')],'raw':!![]})['then'](function(_0x301738){return _0x301738;});})[_0x4ec1('0x1d')](function(_0x5e5c23){if(_0x5e5c23){_0x1da382[_0x4ec1('0x25')]['contact']=_0x5e5c23[0x0];if(!_0x3ad531['body']['UserId'])return;return db[_0x4ec1('0x79')]['find']({'where':{'id':_0x3ad531[_0x4ec1('0x53')][_0x4ec1('0x5d')],'role':'agent'},'attributes':['id',_0x4ec1('0x35'),_0x4ec1('0x6d'),_0x4ec1('0x7a'),_0x4ec1('0x6e')],'raw':!![]});}return null;})[_0x4ec1('0x1d')](function(_0xb495f1){if(!_0xb495f1)return null;_0x1da382[_0x4ec1('0x25')][_0x4ec1('0x5e')]=_0xb495f1;return _0x1da382;})[_0x4ec1('0x1d')](function(_0x4b964e){if(_0x4b964e){_0x4b964e[_0x4ec1('0x25')]['interface']=util[_0x4ec1('0x5b')](_0x4ec1('0x70'),_0x3ad531[_0x4ec1('0x64')][_0x4ec1('0x35')]);_0x4b964e['message']['channel']=_0x1da382[_0x4ec1('0x71')];_0x4b964e[_0x4ec1('0x25')][_0x4ec1('0x72')]=_0x1da382[_0x4ec1('0x71')];_0x4b964e[_0x4ec1('0x25')][_0x4ec1('0x73')]='reject';respondWithRpcPromise(_0x4ec1('0x74'),_0x4ec1('0x74'),{'event':_0x4ec1('0x7b'),'message':_0x4b964e[_0x4ec1('0x25')]},client9002);return _0x1da382;}return null;})['then'](respondWithResult(_0x37f761,null))['catch'](handleError(_0x37f761,null));};exports[_0x4ec1('0x29')]=function(_0x4757bb,_0x41909e,_0x3714f1){if(_0x4757bb['body']['id']){delete _0x4757bb['body']['id'];}var _0x15006f;return db[_0x4ec1('0x38')][_0x4ec1('0x50')]({'where':{'id':_0x4757bb[_0x4ec1('0x4e')]['id']}})[_0x4ec1('0x1d')](handleEntityNotFound(_0x41909e,null))[_0x4ec1('0x1d')](function(_0x6fc8ab){if(_0x6fc8ab){_0x15006f=_0x6fc8ab;return db[_0x4ec1('0x7c')][_0x4ec1('0x50')]({'where':{'id':_0x6fc8ab[_0x4ec1('0x7d')]}});}})['then'](handleEntityNotFound(_0x41909e,null))[_0x4ec1('0x1d')](function(_0x5d010b){if(_0x5d010b){logger[_0x4ec1('0x20')]('WhatsppMessage,\x20%s,\x20%s,\x20%s','status',_0x4ec1('0x7e'),_0x5d010b[_0x4ec1('0x3a')],util['inspect'](_0x4757bb[_0x4ec1('0x53')],{'showHidden':![],'depth':null}));switch(_0x5d010b[_0x4ec1('0x3a')]){case _0x4ec1('0x7f'):if(_0x4757bb['body'][_0x4ec1('0x80')]&&_0x4757bb[_0x4ec1('0x53')][_0x4ec1('0x80')]===_0x15006f[_0x4ec1('0x81')]&&_0x4757bb['body'][_0x4ec1('0x82')]&&_0x4757bb[_0x4ec1('0x53')][_0x4ec1('0x82')]===_0x4ec1('0x59')){return _0x15006f[_0x4ec1('0x52')]({'read':!![]});}else{logger['error'](_0x4ec1('0x83'),_0x4ec1('0x29'),_0x4ec1('0x7f'),util[_0x4ec1('0x84')](_0x4757bb['body'],{'showHidden':![],'depth':null}));}break;}return _0x15006f;}})[_0x4ec1('0x1d')](respondWithResult(_0x41909e,null))['catch'](handleError(_0x41909e,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index c7a5154..6d4eba8 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 _0x8580=['../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1e2080,_0x53283b){var _0x260111=function(_0x15da5e){while(--_0x15da5e){_0x1e2080['push'](_0x1e2080['shift']());}};_0x260111(++_0x53283b);}(_0x8580,0x1c7));var _0x0858=function(_0x557e10,_0x4b2740){_0x557e10=_0x557e10-0x0;var _0x57ad32=_0x8580[_0x557e10];return _0x57ad32;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x0858('0x0'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x0858('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0858('0x2')};function emitEvent(_0x22550c){return function(_0x55aab5,_0x6928ba,_0xa857b7){WhatsappMessageEvents['emit'](_0x22550c+':'+_0x55aab5['id'],_0x55aab5);WhatsappMessageEvents[_0x0858('0x3')](_0x22550c,_0x55aab5);_0xa857b7(null);};}for(var e in events){if(events[_0x0858('0x4')](e)){var event=events[e];WhatsappMessage[_0x0858('0x5')](e,emitEvent(event));}}module[_0x0858('0x6')]=WhatsappMessageEvents; \ No newline at end of file +var _0xd64b=['exports','events','WhatsappMessage','save','update','remove','hasOwnProperty','hook'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xd64b,0xc1));var _0xbd64=function(_0x31922d,_0x35f27b){_0x31922d=_0x31922d-0x0;var _0x255700=_0xd64b[_0x31922d];return _0x255700;};'use strict';var EventEmitter=require(_0xbd64('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xbd64('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbd64('0x2'),'afterUpdate':_0xbd64('0x3'),'afterDestroy':_0xbd64('0x4')};function emitEvent(_0x3f1f05){return function(_0x30fe29,_0x5458d8,_0x5446e4){WhatsappMessageEvents['emit'](_0x3f1f05+':'+_0x30fe29['id'],_0x30fe29);WhatsappMessageEvents['emit'](_0x3f1f05,_0x30fe29);_0x5446e4(null);};}for(var e in events){if(events[_0xbd64('0x5')](e)){var event=events[e];WhatsappMessage[_0xbd64('0x6')](e,emitEvent(event));}}module[_0xbd64('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 7f2432b..c57ad43 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 _0xf878=['WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','messages','create','whatsapp:','phone','remote','token','sid','catch','inspect','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','sinch','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','err','utf8mb4','../../config/logger','moment','bluebird','request-promise','node-fetch','path','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','then','update'];(function(_0x4018fd,_0x4c744d){var _0x2bb6c6=function(_0x21389e){while(--_0x21389e){_0x4018fd['push'](_0x4018fd['shift']());}};_0x2bb6c6(++_0x4c744d);}(_0xf878,0x88));var _0x8f87=function(_0x4bf23b,_0x30882f){_0x4bf23b=_0x4bf23b-0x0;var _0x24c961=_0xf878[_0x4bf23b];return _0x24c961;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8f87('0x0'))('api');var moment=require(_0x8f87('0x1'));var BPromise=require(_0x8f87('0x2'));var rp=require(_0x8f87('0x3'));var fetch=require(_0x8f87('0x4'));var fs=require('fs');var path=require(_0x8f87('0x5'));var rimraf=require('rimraf');var config=require(_0x8f87('0x6'));var attributes=require(_0x8f87('0x7'));module[_0x8f87('0x8')]=function(_0x2f4ab5,_0x3fa6a9){return _0x2f4ab5[_0x8f87('0x9')](_0x8f87('0xa'),attributes,{'tableName':_0x8f87('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x8f87('0xc')]},{'name':_0x8f87('0xd'),'fields':[_0x8f87('0xe')],'type':_0x8f87('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1048dd,_0x35f386,_0x2444e6){var _0x65cb21=_0x2f4ab5['models'];var _0x59beac=_0x1048dd[_0x8f87('0x10')]({'plain':!![]});if(_0x59beac[_0x8f87('0x11')]['toLowerCase']()==='in'||_0x59beac['direction'][_0x8f87('0x12')]()===_0x8f87('0x13')&&!_0x59beac[_0x8f87('0x14')]&&!_[_0x8f87('0x15')](_0x59beac[_0x8f87('0x16')])){_0x65cb21[_0x8f87('0x17')]['findOne']({'where':{'id':_0x59beac['WhatsappInteractionId']}})[_0x8f87('0x18')](function(_0x2afa9b){if(_0x2afa9b){_0x2afa9b[_0x8f87('0x19')]({'lastMsgAt':_0x59beac['createdAt'],'lastMsgDirection':_0x59beac['direction'][_0x8f87('0x12')]()});}})['catch'](function(_0x13f9d2){console['error'](_0x13f9d2);});}if(_0x59beac[_0x8f87('0x11')]===_0x8f87('0x13')&&!_0x59beac[_0x8f87('0x14')]){var _0x5da708;_0x65cb21[_0x8f87('0x1a')][_0x8f87('0x1b')]({'where':{'id':_0x59beac[_0x8f87('0x1c')]},'raw':!![]})[_0x8f87('0x18')](function(_0x7e63ac){_0x5da708=_0x7e63ac;if(_0x5da708&&_0x5da708[_0x8f87('0x1d')]){switch(_0x5da708[_0x8f87('0x1d')]){case'twilio':var _0x109e2b=require(_0x8f87('0x1e'));if(_0x5da708[_0x8f87('0x1f')]&&_0x5da708[_0x8f87('0x20')]&&_0x5da708['phone']){var _0x1a8153=new _0x109e2b(_0x5da708['accountSid'],_0x5da708[_0x8f87('0x20')]);_0x1a8153[_0x8f87('0x21')][_0x8f87('0x22')]({'body':_0x59beac[_0x8f87('0xe')],'to':_0x8f87('0x23')+_0x59beac[_0x8f87('0x24')],'from':_0x8f87('0x23')+_0x5da708[_0x8f87('0x24')],'statusCallback':_0x5da708[_0x8f87('0x25')]+'/api/whatsapp/messages/'+_0x59beac['id']+'/status?token='+_0x5da708[_0x8f87('0x26')]})[_0x8f87('0x18')](function(_0x4c7fe9){if(_0x4c7fe9[_0x8f87('0x27')]){return _0x1048dd['update']({'messageId':_0x4c7fe9[_0x8f87('0x27')]});}})[_0x8f87('0x28')](function(_0x25bc47){logger['error']('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x8f87('0x1e'),util[_0x8f87('0x29')](_0x25bc47,{'showHidden':![],'depth':null}));});}else{logger[_0x8f87('0x2a')](_0x8f87('0x2b'),'afterCreate',_0x8f87('0x1e'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x8f87('0x2c'):var _0x1b0f72=_0x5da708[_0x8f87('0x1f')];var _0x5a7705=_0x5da708[_0x8f87('0x20')];var _0x33b112=_0x5da708['baseUrl']+'/whatsapp/v1/'+_0x1b0f72+_0x8f87('0x2d');var _0x546d5f={'to':[_0x59beac[_0x8f87('0x24')]],'message':{'type':_0x8f87('0x2e'),'text':_0x59beac['body']}};var _0x31c9b5={'method':_0x8f87('0x2f'),'uri':_0x33b112,'headers':{'Authorization':_0x8f87('0x30')+_0x5a7705,'Content-Type':_0x8f87('0x31')},'body':_0x546d5f,'json':!![]};rp(_0x31c9b5)[_0x8f87('0x18')](function(_0xb81f17){if(_0xb81f17[_0x8f87('0x32')][0x0][_0x8f87('0x33')]){return _0x1048dd[_0x8f87('0x19')]({'messageId':_0xb81f17[_0x8f87('0x32')][0x0]['message_id']});}})[_0x8f87('0x28')](function(_0x8b55e6){logger[_0x8f87('0x34')]('WhatsappMessage,\x20%s',_0x8b55e6);});break;}}})['finally'](function(){_0x2444e6();});}else{_0x2444e6();}}},'charset':_0x8f87('0x35'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x134d=['token','sid','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','application/json','message_id','statuses','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','WhatsappInteractionId','then','update','catch','error','find','WhatsappAccountId','type','twilio','authToken','phone','accountSid','create','body','/api/whatsapp/messages/','/status?token='];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x134d,0xfc));var _0xd134=function(_0x32d1c1,_0x620f95){_0x32d1c1=_0x32d1c1-0x0;var _0x32ffb9=_0x134d[_0x32d1c1];return _0x32ffb9;};'use strict';var _=require(_0xd134('0x0'));var util=require('util');var logger=require(_0xd134('0x1'))(_0xd134('0x2'));var moment=require(_0xd134('0x3'));var BPromise=require(_0xd134('0x4'));var rp=require(_0xd134('0x5'));var fetch=require(_0xd134('0x6'));var fs=require('fs');var path=require(_0xd134('0x7'));var rimraf=require(_0xd134('0x8'));var config=require(_0xd134('0x9'));var attributes=require(_0xd134('0xa'));module[_0xd134('0xb')]=function(_0x4bf824,_0x5bd6a3){return _0x4bf824['define']('WhatsappMessage',attributes,{'tableName':_0xd134('0xc'),'paranoid':![],'indexes':[{'name':_0xd134('0xd'),'fields':[_0xd134('0xd')]},{'name':_0xd134('0xe'),'fields':['body'],'type':_0xd134('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x482267,_0x458527,_0x3e0e65){var _0x397764=_0x4bf824[_0xd134('0x10')];var _0x351960=_0x482267['get']({'plain':!![]});if(_0x351960[_0xd134('0x11')][_0xd134('0x12')]()==='in'||_0x351960[_0xd134('0x11')][_0xd134('0x12')]()===_0xd134('0x13')&&!_0x351960[_0xd134('0x14')]&&!_['isNil'](_0x351960[_0xd134('0x15')])){_0x397764['WhatsappInteraction']['findOne']({'where':{'id':_0x351960[_0xd134('0x16')]}})[_0xd134('0x17')](function(_0x1163a0){if(_0x1163a0){_0x1163a0[_0xd134('0x18')]({'lastMsgAt':_0x351960['createdAt'],'lastMsgDirection':_0x351960['direction'][_0xd134('0x12')]()});}})[_0xd134('0x19')](function(_0x2e4590){console[_0xd134('0x1a')](_0x2e4590);});}if(_0x351960['direction']===_0xd134('0x13')&&!_0x351960[_0xd134('0x14')]){var _0x495a3e;_0x397764['WhatsappAccount'][_0xd134('0x1b')]({'where':{'id':_0x351960[_0xd134('0x1c')]},'raw':!![]})[_0xd134('0x17')](function(_0x2953cd){_0x495a3e=_0x2953cd;if(_0x495a3e&&_0x495a3e[_0xd134('0x1d')]){switch(_0x495a3e[_0xd134('0x1d')]){case _0xd134('0x1e'):var _0xba8b6d=require(_0xd134('0x1e'));if(_0x495a3e['accountSid']&&_0x495a3e[_0xd134('0x1f')]&&_0x495a3e[_0xd134('0x20')]){var _0x10e2d6=new _0xba8b6d(_0x495a3e[_0xd134('0x21')],_0x495a3e[_0xd134('0x1f')]);_0x10e2d6['messages'][_0xd134('0x22')]({'body':_0x351960[_0xd134('0x23')],'to':'whatsapp:'+_0x351960[_0xd134('0x20')],'from':'whatsapp:'+_0x495a3e[_0xd134('0x20')],'statusCallback':_0x495a3e['remote']+_0xd134('0x24')+_0x351960['id']+_0xd134('0x25')+_0x495a3e[_0xd134('0x26')]})[_0xd134('0x17')](function(_0x28b05c){if(_0x28b05c[_0xd134('0x27')]){return _0x482267[_0xd134('0x18')]({'messageId':_0x28b05c[_0xd134('0x27')]});}})[_0xd134('0x19')](function(_0x3698f9){logger[_0xd134('0x1a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xd134('0x28'),_0xd134('0x1e'),util[_0xd134('0x29')](_0x3698f9,{'showHidden':![],'depth':null}));});}else{logger[_0xd134('0x1a')](_0xd134('0x2a'),_0xd134('0x28'),_0xd134('0x1e'),_0xd134('0x2b'));}break;case _0xd134('0x2c'):var _0x17b4b2=_0x495a3e[_0xd134('0x21')];var _0x21ac16=_0x495a3e['authToken'];var _0x5a7503=_0x495a3e[_0xd134('0x2d')]+_0xd134('0x2e')+_0x17b4b2+_0xd134('0x2f');var _0x5a631a={'to':[_0x351960[_0xd134('0x20')]],'message':{'type':_0xd134('0x30'),'text':_0x351960[_0xd134('0x23')]}};var _0x372a8f={'method':_0xd134('0x31'),'uri':_0x5a7503,'headers':{'Authorization':'Bearer\x20'+_0x21ac16,'Content-Type':_0xd134('0x32')},'body':_0x5a631a,'json':!![]};rp(_0x372a8f)['then'](function(_0x3f7c5a){if(_0x3f7c5a['statuses'][0x0][_0xd134('0x33')]){return _0x482267[_0xd134('0x18')]({'messageId':_0x3f7c5a[_0xd134('0x34')][0x0]['message_id']});}})[_0xd134('0x19')](function(_0x3c1a0d){logger[_0xd134('0x35')](_0xd134('0x36'),_0x3c1a0d);});break;}}})[_0xd134('0x37')](function(){_0x3e0e65();});}else{_0x3e0e65();}}},'charset':_0xd134('0x38'),'collate':_0xd134('0x39')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 35499e5..d104eb6 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 _0x234a=['code','error','message','result','catch','CreateWhatsappMessage','WhatsappMessage','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s'];(function(_0x3d2669,_0x4bc81b){var _0x182f03=function(_0x4de18f){while(--_0x4de18f){_0x3d2669['push'](_0x3d2669['shift']());}};_0x182f03(++_0x4bc81b);}(_0x234a,0x15f));var _0xa234=function(_0x433d65,_0x5d119b){_0x433d65=_0x433d65-0x0;var _0x24799c=_0x234a[_0x433d65];return _0x24799c;};'use strict';var _=require(_0xa234('0x0'));var util=require(_0xa234('0x1'));var moment=require(_0xa234('0x2'));var BPromise=require(_0xa234('0x3'));var rs=require(_0xa234('0x4'));var fs=require('fs');var Redis=require(_0xa234('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa234('0x6'));var logger=require('../../config/logger')(_0xa234('0x7'));var config=require(_0xa234('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa234('0x9')][_0xa234('0xa')]({'port':0x232a});config['redis']=_[_0xa234('0xb')](config[_0xa234('0xc')],{'host':_0xa234('0xd'),'port':0x18eb});var socket=require(_0xa234('0xe'))(new Redis(config['redis']));require('./whatsappMessage.socket')[_0xa234('0xf')](socket);function respondWithRpcPromise(_0x34907b,_0x109af6,_0x1fe0e8){return new BPromise(function(_0x2d77b4,_0x5df477){return client[_0xa234('0x10')](_0x34907b,_0x1fe0e8)[_0xa234('0x11')](function(_0x26311c){logger[_0xa234('0x12')](_0xa234('0x13'),_0x109af6,_0xa234('0x14'));logger[_0xa234('0x15')](_0xa234('0x16'),_0x109af6,'request\x20sent',JSON['stringify'](_0x26311c));if(_0x26311c['error']){if(_0x26311c['error'][_0xa234('0x17')]===0x1f4){logger[_0xa234('0x18')](_0xa234('0x13'),_0x109af6,_0x26311c[_0xa234('0x18')]['message']);return _0x5df477(_0x26311c[_0xa234('0x18')]['message']);}logger['error'](_0xa234('0x13'),_0x109af6,_0x26311c[_0xa234('0x18')][_0xa234('0x19')]);return _0x2d77b4(_0x26311c[_0xa234('0x18')][_0xa234('0x19')]);}else{logger['info'](_0xa234('0x13'),_0x109af6,_0xa234('0x14'));_0x2d77b4(_0x26311c[_0xa234('0x1a')]['message']);}})[_0xa234('0x1b')](function(_0x370226){logger['error'](_0xa234('0x13'),_0x109af6,_0x370226);_0x5df477(_0x370226);});});}exports[_0xa234('0x1c')]=function(_0x196e0b){var _0x4d3c3d=this;return new Promise(function(_0x455f2c,_0x18f6de){return db[_0xa234('0x1d')]['create'](_0x196e0b[_0xa234('0x1e')],{'raw':_0x196e0b[_0xa234('0x1f')]?_0x196e0b[_0xa234('0x1f')][_0xa234('0x20')]===undefined?!![]:![]:!![]})[_0xa234('0x11')](function(_0x5c9bfd){logger[_0xa234('0x12')](_0xa234('0x1c'),_0x196e0b);logger[_0xa234('0x15')]('CreateWhatsappMessage',_0x196e0b,JSON[_0xa234('0x21')](_0x5c9bfd));_0x455f2c(_0x5c9bfd);})[_0xa234('0x1b')](function(_0x2f4ff6){logger[_0xa234('0x18')](_0xa234('0x1c'),_0x2f4ff6[_0xa234('0x19')],_0x196e0b);_0x18f6de(_0x4d3c3d['error'](0x1f4,_0x2f4ff6['message']));});});}; \ No newline at end of file +var _0x5b64=['raw','debug','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','./whatsappMessage.socket','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateWhatsappMessage','create','body','options'];(function(_0x481604,_0x276ff8){var _0x1ca4ed=function(_0x136e9d){while(--_0x136e9d){_0x481604['push'](_0x481604['shift']());}};_0x1ca4ed(++_0x276ff8);}(_0x5b64,0x15e));var _0x45b6=function(_0x10848d,_0x49ab9b){_0x10848d=_0x10848d-0x0;var _0x5d09ec=_0x5b64[_0x10848d];return _0x5d09ec;};'use strict';var _=require('lodash');var util=require(_0x45b6('0x0'));var moment=require(_0x45b6('0x1'));var BPromise=require('bluebird');var rs=require(_0x45b6('0x2'));var fs=require('fs');var Redis=require(_0x45b6('0x3'));var db=require(_0x45b6('0x4'))['db'];var utils=require(_0x45b6('0x5'));var logger=require(_0x45b6('0x6'))('rpc');var config=require(_0x45b6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x45b6('0x8')][_0x45b6('0x9')]({'port':0x232a});config['redis']=_[_0x45b6('0xa')](config[_0x45b6('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x45b6('0xb')]));require(_0x45b6('0xc'))['register'](socket);function respondWithRpcPromise(_0x1b3012,_0x2a8b14,_0x4a5863){return new BPromise(function(_0x3043c9,_0x3ed21c){return client[_0x45b6('0xd')](_0x1b3012,_0x4a5863)['then'](function(_0x55cb46){logger[_0x45b6('0xe')](_0x45b6('0xf'),_0x2a8b14,_0x45b6('0x10'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x2a8b14,_0x45b6('0x10'),JSON[_0x45b6('0x11')](_0x55cb46));if(_0x55cb46[_0x45b6('0x12')]){if(_0x55cb46[_0x45b6('0x12')][_0x45b6('0x13')]===0x1f4){logger[_0x45b6('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x2a8b14,_0x55cb46[_0x45b6('0x12')]['message']);return _0x3ed21c(_0x55cb46['error'][_0x45b6('0x14')]);}logger[_0x45b6('0x12')](_0x45b6('0xf'),_0x2a8b14,_0x55cb46[_0x45b6('0x12')][_0x45b6('0x14')]);return _0x3043c9(_0x55cb46[_0x45b6('0x12')][_0x45b6('0x14')]);}else{logger[_0x45b6('0xe')](_0x45b6('0xf'),_0x2a8b14,_0x45b6('0x10'));_0x3043c9(_0x55cb46[_0x45b6('0x15')][_0x45b6('0x14')]);}})[_0x45b6('0x16')](function(_0x103334){logger[_0x45b6('0x12')](_0x45b6('0xf'),_0x2a8b14,_0x103334);_0x3ed21c(_0x103334);});});}exports[_0x45b6('0x17')]=function(_0x488e07){var _0x192bd2=this;return new Promise(function(_0x45e8c0,_0x5c4a8d){return db['WhatsappMessage'][_0x45b6('0x18')](_0x488e07[_0x45b6('0x19')],{'raw':_0x488e07[_0x45b6('0x1a')]?_0x488e07['options'][_0x45b6('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x44acd0){logger[_0x45b6('0xe')](_0x45b6('0x17'),_0x488e07);logger[_0x45b6('0x1c')](_0x45b6('0x17'),_0x488e07,JSON[_0x45b6('0x11')](_0x44acd0));_0x45e8c0(_0x44acd0);})[_0x45b6('0x16')](function(_0x149b65){logger[_0x45b6('0x12')](_0x45b6('0x17'),_0x149b65[_0x45b6('0x14')],_0x488e07);_0x5c4a8d(_0x192bd2[_0x45b6('0x12')](0x1f4,_0x149b65[_0x45b6('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 47c2cd1..b4812b7 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 _0xbc1d=['register','whatsappMessage:','save','update','removeListener'];(function(_0x50309e,_0x5ab9fb){var _0x4080ae=function(_0x4fa78b){while(--_0x4fa78b){_0x50309e['push'](_0x50309e['shift']());}};_0x4080ae(++_0x5ab9fb);}(_0xbc1d,0x179));var _0xdbc1=function(_0x58fc2f,_0x111399){_0x58fc2f=_0x58fc2f-0x0;var _0x3a1312=_0xbc1d[_0x58fc2f];return _0x3a1312;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xdbc1('0x0'),'remove',_0xdbc1('0x1')];function createListener(_0x5d4c00,_0x5777d2){return function(_0x1edeb3){_0x5777d2['emit'](_0x5d4c00,_0x1edeb3);};}function removeListener(_0x3e9e29,_0x393b39){return function(){WhatsappMessageEvents[_0xdbc1('0x2')](_0x3e9e29,_0x393b39);};}exports[_0xdbc1('0x3')]=function(_0x253911){for(var _0x11a6b0=0x0,_0x5ae437=events['length'];_0x11a6b0<_0x5ae437;_0x11a6b0++){var _0x61079=events[_0x11a6b0];var _0x33a575=createListener(_0xdbc1('0x4')+_0x61079,_0x253911);WhatsappMessageEvents['on'](_0x61079,_0x33a575);}}; \ No newline at end of file +var _0x2164=['length','save','remove','update','emit','removeListener'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x2164,0x187));var _0x4216=function(_0x22c1ea,_0x37210c){_0x22c1ea=_0x22c1ea-0x0;var _0x2a7c46=_0x2164[_0x22c1ea];return _0x2a7c46;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x4216('0x0'),_0x4216('0x1'),_0x4216('0x2')];function createListener(_0xc3988d,_0xa312d7){return function(_0x53dc5d){_0xa312d7[_0x4216('0x3')](_0xc3988d,_0x53dc5d);};}function removeListener(_0x2c015a,_0x1341d8){return function(){WhatsappMessageEvents[_0x4216('0x4')](_0x2c015a,_0x1341d8);};}exports['register']=function(_0x45bcdd){for(var _0x98a04c=0x0,_0x4b5e7a=events[_0x4216('0x5')];_0x98a04c<_0x4b5e7a;_0x98a04c++){var _0x52f08a=events[_0x98a04c];var _0x24531a=createListener('whatsappMessage:'+_0x52f08a,_0x45bcdd);WhatsappMessageEvents['on'](_0x52f08a,_0x24531a);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index aba8dc9..ee1b3af 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 _0xa65b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','/:id/users','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','express','Router'];(function(_0x1398fe,_0x14ad26){var _0x56da90=function(_0x335565){while(--_0x335565){_0x1398fe['push'](_0x1398fe['shift']());}};_0x56da90(++_0x14ad26);}(_0xa65b,0x1e8));var _0xba65=function(_0x1e357e,_0x372e44){_0x1e357e=_0x1e357e-0x0;var _0x2635b9=_0xa65b[_0x1e357e];return _0x2635b9;};'use strict';var multer=require(_0xba65('0x0'));var util=require(_0xba65('0x1'));var path=require(_0xba65('0x2'));var timeout=require('connect-timeout');var express=require(_0xba65('0x3'));var router=express[_0xba65('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xba65('0x5'));var interaction=require(_0xba65('0x6'));var config=require(_0xba65('0x7'));var controller=require(_0xba65('0x8'));router[_0xba65('0x9')]('/',auth[_0xba65('0xa')](),controller[_0xba65('0xb')]);router[_0xba65('0x9')](_0xba65('0xc'),auth[_0xba65('0xa')](),controller['describe']);router[_0xba65('0x9')](_0xba65('0xd'),auth[_0xba65('0xa')](),controller['show']);router[_0xba65('0x9')](_0xba65('0xe'),auth[_0xba65('0xa')](),controller[_0xba65('0xf')]);router[_0xba65('0x9')](_0xba65('0x10'),auth[_0xba65('0xa')](),controller[_0xba65('0x11')]);router[_0xba65('0x9')]('/:id/users',auth[_0xba65('0xa')](),controller[_0xba65('0x12')]);router[_0xba65('0x13')]('/',auth[_0xba65('0xa')](),controller['create']);router[_0xba65('0x13')](_0xba65('0x10'),auth[_0xba65('0xa')](),controller[_0xba65('0x14')]);router[_0xba65('0x13')](_0xba65('0x15'),auth['isAuthenticated'](),controller[_0xba65('0x16')]);router[_0xba65('0x17')](_0xba65('0xd'),auth[_0xba65('0xa')](),controller['update']);router[_0xba65('0x18')](_0xba65('0xd'),auth[_0xba65('0xa')](),controller[_0xba65('0x19')]);router['delete'](_0xba65('0x10'),auth['isAuthenticated'](),controller[_0xba65('0x1a')]);router[_0xba65('0x18')](_0xba65('0x15'),auth[_0xba65('0xa')](),controller[_0xba65('0x1b')]);module[_0xba65('0x1c')]=router; \ No newline at end of file +var _0xa927=['path','express','../../components/auth/service','./whatsappQueue.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/teams','getAgents','post','create','addTeams','/:id/users','delete','removeAgents','exports','multer'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa927,0xc7));var _0x7a92=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa927[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7a92('0x0'));var util=require('util');var path=require(_0x7a92('0x1'));var timeout=require('connect-timeout');var express=require(_0x7a92('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7a92('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7a92('0x4'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x7a92('0x5')](_0x7a92('0x6'),auth[_0x7a92('0x7')](),controller[_0x7a92('0x8')]);router[_0x7a92('0x5')](_0x7a92('0x9'),auth[_0x7a92('0x7')](),controller[_0x7a92('0xa')]);router[_0x7a92('0x5')]('/:id/members',auth[_0x7a92('0x7')](),controller['getMembers']);router[_0x7a92('0x5')](_0x7a92('0xb'),auth['isAuthenticated'](),controller['getTeams']);router[_0x7a92('0x5')]('/:id/users',auth[_0x7a92('0x7')](),controller[_0x7a92('0xc')]);router[_0x7a92('0xd')]('/',auth[_0x7a92('0x7')](),controller[_0x7a92('0xe')]);router[_0x7a92('0xd')]('/:id/teams',auth[_0x7a92('0x7')](),controller[_0x7a92('0xf')]);router[_0x7a92('0xd')](_0x7a92('0x10'),auth[_0x7a92('0x7')](),controller['addAgents']);router['put'](_0x7a92('0x9'),auth[_0x7a92('0x7')](),controller['update']);router[_0x7a92('0x11')](_0x7a92('0x9'),auth[_0x7a92('0x7')](),controller['destroy']);router[_0x7a92('0x11')](_0x7a92('0xb'),auth[_0x7a92('0x7')](),controller['removeTeams']);router['delete'](_0x7a92('0x10'),auth['isAuthenticated'](),controller[_0x7a92('0x12')]);module[_0x7a92('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 055dd80..bbb8432 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 _0xcab6=['rrmemory','beepall','sequelize','STRING','name','INTEGER','ENUM'];(function(_0x336e71,_0x1ea2ed){var _0x3baa56=function(_0x2505df){while(--_0x2505df){_0x336e71['push'](_0x336e71['shift']());}};_0x3baa56(++_0x1ea2ed);}(_0xcab6,0xd4));var _0x6cab=function(_0x4a3423,_0x17a5f9){_0x4a3423=_0x4a3423-0x0;var _0x5870ba=_0xcab6[_0x4a3423];return _0x5870ba;};'use strict';var Sequelize=require(_0x6cab('0x0'));module['exports']={'name':{'type':Sequelize[_0x6cab('0x1')],'unique':_0x6cab('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x6cab('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6cab('0x4')](_0x6cab('0x5'),_0x6cab('0x6'),'roundrobin')},'description':{'type':Sequelize[_0x6cab('0x1')]}}; \ No newline at end of file +var _0xcb91=['name','INTEGER','ENUM','beepall','roundrobin','STRING'];(function(_0x31e982,_0x521c6a){var _0x3efb59=function(_0x9a5416){while(--_0x9a5416){_0x31e982['push'](_0x31e982['shift']());}};_0x3efb59(++_0x521c6a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xcb91[_0xdea41a];return _0x15d0d8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1cb9('0x0')],'unique':_0x1cb9('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x1cb9('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1cb9('0x3')]('rrmemory',_0x1cb9('0x4'),_0x1cb9('0x5'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index bbf46e0..174ba51 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 _0xbbe5=['error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','filter','where','VIRTUAL','merge','options','include','findAll','show','params','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','getMembers','findOne','UserWhatsappQueue','pick','User','findAndCountAll','UserId','agent','updatedAt','rows','format','%s/%s','SIP','whatsappPause','createdAt','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','isArray','userWhatsappQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','register','end','status','json','offset','undefined','count','limit','set','apply','reject','then','get','WhatsappQueues','UserProfileResource','destroy','sendStatus'];(function(_0x4deff,_0x42c328){var _0x440123=function(_0x2d7dde){while(--_0x2d7dde){_0x4deff['push'](_0x4deff['shift']());}};_0x440123(++_0x42c328);}(_0xbbe5,0xf1));var _0x5bbe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbe5[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x5bbe('0x0'));var rimraf=require(_0x5bbe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5bbe('0x2'));var rp=require(_0x5bbe('0x3'));var moment=require(_0x5bbe('0x4'));var BPromise=require(_0x5bbe('0x5'));var Mustache=require(_0x5bbe('0x6'));var util=require('util');var path=require(_0x5bbe('0x7'));var sox=require('sox');var csv=require(_0x5bbe('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5bbe('0x9'));var _=require(_0x5bbe('0xa'));var squel=require('squel');var crypto=require(_0x5bbe('0xb'));var jsforce=require(_0x5bbe('0xc'));var deskjs=require(_0x5bbe('0xd'));var toCsv=require(_0x5bbe('0x8'));var querystring=require('querystring');var Papa=require(_0x5bbe('0xe'));var Redis=require(_0x5bbe('0xf'));var authService=require(_0x5bbe('0x10'));var qs=require(_0x5bbe('0x11'));var as=require(_0x5bbe('0x12'));var hardwareService=require(_0x5bbe('0x13'));var logger=require('../../config/logger')(_0x5bbe('0x14'));var utils=require(_0x5bbe('0x15'));var config=require(_0x5bbe('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5bbe('0x17'))['db'];config['redis']=_[_0x5bbe('0x18')](config[_0x5bbe('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5bbe('0x19')]));require('./whatsappQueue.socket')[_0x5bbe('0x1a')](socket);function respondWithStatusCode(_0x289252,_0x54cb4b){_0x54cb4b=_0x54cb4b||0xcc;return function(_0x3e4eaf){if(_0x3e4eaf){return _0x289252['sendStatus'](_0x54cb4b);}return _0x289252['status'](_0x54cb4b)[_0x5bbe('0x1b')]();};}function respondWithResult(_0x3d47c0,_0x2b8cdc){_0x2b8cdc=_0x2b8cdc||0xc8;return function(_0x1c1e12){if(_0x1c1e12){return _0x3d47c0[_0x5bbe('0x1c')](_0x2b8cdc)[_0x5bbe('0x1d')](_0x1c1e12);}};}function respondWithFilteredResult(_0x26fb51,_0x41cc87){return function(_0x479eb9){if(_0x479eb9){var _0x1c92b1=typeof _0x41cc87[_0x5bbe('0x1e')]==='undefined'&&typeof _0x41cc87['limit']===_0x5bbe('0x1f');var _0x317af7=_0x479eb9[_0x5bbe('0x20')];var _0x1cdc35=_0x1c92b1?0x0:_0x41cc87[_0x5bbe('0x1e')];var _0x1ffce5=_0x1c92b1?_0x479eb9['count']:_0x41cc87[_0x5bbe('0x1e')]+_0x41cc87[_0x5bbe('0x21')];var _0x46cf7d;if(_0x1ffce5>=_0x317af7){_0x1ffce5=_0x317af7;_0x46cf7d=0xc8;}else{_0x46cf7d=0xce;}_0x26fb51['status'](_0x46cf7d);return _0x26fb51[_0x5bbe('0x22')]('Content-Range',_0x1cdc35+'-'+_0x1ffce5+'/'+_0x317af7)['json'](_0x479eb9);}return null;};}function patchUpdates(_0x3d36f2){return function(_0x207b3d){try{jsonpatch[_0x5bbe('0x23')](_0x207b3d,_0x3d36f2,!![]);}catch(_0x2383d9){return BPromise[_0x5bbe('0x24')](_0x2383d9);}return _0x207b3d['save']();};}function saveUpdates(_0x27a340,_0x5b029e){return function(_0x1f7883){if(_0x1f7883){return _0x1f7883['update'](_0x27a340)['then'](function(_0x5e85d5){return _0x5e85d5;});}return null;};}function removeEntity(_0x14fdc8,_0x24e04a){return function(_0x2e54b){if(_0x2e54b){return _0x2e54b['destroy']()[_0x5bbe('0x25')](function(){var _0x497fc3=_0x2e54b[_0x5bbe('0x26')]({'plain':!![]});var _0x5bd2cc=_0x5bbe('0x27');return db[_0x5bbe('0x28')][_0x5bbe('0x29')]({'where':{'type':_0x5bd2cc,'resourceId':_0x497fc3['id']}})[_0x5bbe('0x25')](function(){return _0x2e54b;});})[_0x5bbe('0x25')](function(){_0x14fdc8[_0x5bbe('0x1c')](0xcc)[_0x5bbe('0x1b')]();});}};}function handleEntityNotFound(_0x3647cf,_0x16735c){return function(_0x2b60ea){if(!_0x2b60ea){_0x3647cf[_0x5bbe('0x2a')](0x194);}return _0x2b60ea;};}function handleError(_0x293a03,_0x3eba58){_0x3eba58=_0x3eba58||0x1f4;return function(_0x33b900){logger[_0x5bbe('0x2b')](_0x33b900[_0x5bbe('0x2c')]);if(_0x33b900[_0x5bbe('0x2d')]){delete _0x33b900[_0x5bbe('0x2d')];}_0x293a03[_0x5bbe('0x1c')](_0x3eba58)[_0x5bbe('0x2e')](_0x33b900);};}exports[_0x5bbe('0x2f')]=function(_0x5599b7,_0x4d26ba){var _0x64147b={},_0x5a94dc={},_0x4e3375={'count':0x0,'rows':[]};var _0x1b77d8=_[_0x5bbe('0x30')](db[_0x5bbe('0x31')][_0x5bbe('0x32')],function(_0x372e1a){return{'name':_0x372e1a[_0x5bbe('0x33')],'type':_0x372e1a[_0x5bbe('0x34')][_0x5bbe('0x35')]};});_0x5a94dc[_0x5bbe('0x36')]=_[_0x5bbe('0x30')](_0x1b77d8,_0x5bbe('0x2d'));_0x5a94dc[_0x5bbe('0x37')]=_[_0x5bbe('0x38')](_0x5599b7[_0x5bbe('0x37')]);_0x5a94dc[_0x5bbe('0x39')]=_[_0x5bbe('0x3a')](_0x5a94dc[_0x5bbe('0x36')],_0x5a94dc[_0x5bbe('0x37')]);_0x64147b['attributes']=_['intersection'](_0x5a94dc['model'],qs[_0x5bbe('0x3b')](_0x5599b7[_0x5bbe('0x37')][_0x5bbe('0x3b')]));_0x64147b[_0x5bbe('0x3c')]=_0x64147b[_0x5bbe('0x3c')][_0x5bbe('0x3d')]?_0x64147b[_0x5bbe('0x3c')]:_0x5a94dc[_0x5bbe('0x36')];if(!_0x5599b7[_0x5bbe('0x37')][_0x5bbe('0x3e')]('nolimit')){_0x64147b['limit']=qs[_0x5bbe('0x21')](_0x5599b7['query'][_0x5bbe('0x21')]);_0x64147b[_0x5bbe('0x1e')]=qs[_0x5bbe('0x1e')](_0x5599b7[_0x5bbe('0x37')][_0x5bbe('0x1e')]);}_0x64147b[_0x5bbe('0x3f')]=qs[_0x5bbe('0x40')](_0x5599b7[_0x5bbe('0x37')][_0x5bbe('0x40')]);_0x64147b['where']=qs[_0x5bbe('0x39')](_['pick'](_0x5599b7[_0x5bbe('0x37')],_0x5a94dc['filters']),_0x1b77d8);if(_0x5599b7[_0x5bbe('0x37')][_0x5bbe('0x41')]){_0x64147b[_0x5bbe('0x42')]=_['merge'](_0x64147b[_0x5bbe('0x42')],{'$or':_[_0x5bbe('0x30')](_0x1b77d8,function(_0x3fa6b7){if(_0x3fa6b7['type']!==_0x5bbe('0x43')){var _0x1866ec={};_0x1866ec[_0x3fa6b7[_0x5bbe('0x2d')]]={'$like':'%'+_0x5599b7[_0x5bbe('0x37')][_0x5bbe('0x41')]+'%'};return _0x1866ec;}})});}_0x64147b=_[_0x5bbe('0x44')]({},_0x64147b,_0x5599b7[_0x5bbe('0x45')]);var _0x3b2e5f={'where':_0x64147b[_0x5bbe('0x42')]};return db['WhatsappQueue']['count'](_0x3b2e5f)['then'](function(_0x4e96b7){_0x4e3375['count']=_0x4e96b7;if(_0x5599b7[_0x5bbe('0x37')]['includeAll']){_0x64147b[_0x5bbe('0x46')]=[{'all':!![]}];}return db[_0x5bbe('0x31')][_0x5bbe('0x47')](_0x64147b);})['then'](function(_0x30a287){_0x4e3375['rows']=_0x30a287;return _0x4e3375;})['then'](respondWithFilteredResult(_0x4d26ba,_0x64147b))['catch'](handleError(_0x4d26ba,null));};exports[_0x5bbe('0x48')]=function(_0x535aad,_0x31252b){var _0x2bae04={'raw':!![],'where':{'id':_0x535aad[_0x5bbe('0x49')]['id']}},_0x49e686={};_0x49e686[_0x5bbe('0x36')]=_['keys'](db['WhatsappQueue'][_0x5bbe('0x32')]);_0x49e686['query']=_[_0x5bbe('0x38')](_0x535aad['query']);_0x49e686[_0x5bbe('0x39')]=_['intersection'](_0x49e686[_0x5bbe('0x36')],_0x49e686['query']);_0x2bae04[_0x5bbe('0x3c')]=_['intersection'](_0x49e686[_0x5bbe('0x36')],qs[_0x5bbe('0x3b')](_0x535aad['query'][_0x5bbe('0x3b')]));_0x2bae04['attributes']=_0x2bae04[_0x5bbe('0x3c')][_0x5bbe('0x3d')]?_0x2bae04[_0x5bbe('0x3c')]:_0x49e686['model'];if(_0x535aad['query']['includeAll']){_0x2bae04[_0x5bbe('0x46')]=[{'all':!![]}];}_0x2bae04=_[_0x5bbe('0x44')]({},_0x2bae04,_0x535aad['options']);return db[_0x5bbe('0x31')]['find'](_0x2bae04)[_0x5bbe('0x25')](handleEntityNotFound(_0x31252b,null))[_0x5bbe('0x25')](respondWithResult(_0x31252b,null))[_0x5bbe('0x4a')](handleError(_0x31252b,null));};exports[_0x5bbe('0x4b')]=function(_0x4c1a76,_0x3c7553){return db[_0x5bbe('0x31')][_0x5bbe('0x4b')](_0x4c1a76['body'],{})['then'](function(_0x1e0aa5){var _0x1cfc45=_0x4c1a76[_0x5bbe('0x4c')]['get']({'plain':!![]});if(!_0x1cfc45)throw new Error(_0x5bbe('0x4d'));if(_0x1cfc45[_0x5bbe('0x4e')]===_0x5bbe('0x4c')){var _0x22c904=_0x1e0aa5['get']({'plain':!![]});var _0x4b7dc4=_0x5bbe('0x27');return db[_0x5bbe('0x4f')][_0x5bbe('0x50')]({'where':{'name':_0x4b7dc4,'userProfileId':_0x1cfc45['userProfileId']},'raw':!![]})[_0x5bbe('0x25')](function(_0x513657){if(_0x513657&&_0x513657['autoAssociation']===0x0){return db[_0x5bbe('0x28')]['create']({'name':_0x22c904[_0x5bbe('0x2d')],'resourceId':_0x22c904['id'],'type':_0x513657[_0x5bbe('0x2d')],'sectionId':_0x513657['id']},{})[_0x5bbe('0x25')](function(){return _0x1e0aa5;});}else{return _0x1e0aa5;}})[_0x5bbe('0x4a')](function(_0x6557c1){logger[_0x5bbe('0x2b')](_0x5bbe('0x51'),_0x6557c1);throw _0x6557c1;});}return _0x1e0aa5;})['then'](respondWithResult(_0x3c7553,0xc9))[_0x5bbe('0x4a')](handleError(_0x3c7553,null));};exports[_0x5bbe('0x52')]=function(_0x5926fc,_0x21836e){if(_0x5926fc[_0x5bbe('0x53')]['id']){delete _0x5926fc[_0x5bbe('0x53')]['id'];}return db[_0x5bbe('0x31')][_0x5bbe('0x50')]({'where':{'id':_0x5926fc[_0x5bbe('0x49')]['id']}})[_0x5bbe('0x25')](handleEntityNotFound(_0x21836e,null))[_0x5bbe('0x25')](saveUpdates(_0x5926fc[_0x5bbe('0x53')],null))[_0x5bbe('0x25')](respondWithResult(_0x21836e,null))[_0x5bbe('0x4a')](handleError(_0x21836e,null));};exports['destroy']=function(_0x4229f6,_0xc8ac40){return db['WhatsappQueue'][_0x5bbe('0x50')]({'where':{'id':_0x4229f6[_0x5bbe('0x49')]['id']}})['then'](handleEntityNotFound(_0xc8ac40,null))[_0x5bbe('0x25')](removeEntity(_0xc8ac40,null))['catch'](handleError(_0xc8ac40,null));};exports['describe']=function(_0x37999d,_0x23099a){return db[_0x5bbe('0x31')]['describe']()[_0x5bbe('0x25')](respondWithResult(_0x23099a,null))[_0x5bbe('0x4a')](handleError(_0x23099a,null));};exports[_0x5bbe('0x54')]=function(_0x612647,_0x902911,_0x4e78e0){var _0x2f3f94={'raw':!![],'where':{}},_0x2ae4c9={},_0xfbe2f2;return db[_0x5bbe('0x31')][_0x5bbe('0x55')]({'where':{'id':_0x612647[_0x5bbe('0x49')]['id']}})[_0x5bbe('0x25')](handleEntityNotFound(_0x902911,null))[_0x5bbe('0x25')](function(_0x39e846){if(_0x39e846){_0xfbe2f2=_0x39e846['get']({'plain':!![]});_0x2ae4c9[_0x5bbe('0x36')]=_[_0x5bbe('0x38')](db[_0x5bbe('0x56')]['rawAttributes']);_0x2ae4c9[_0x5bbe('0x37')]=_[_0x5bbe('0x38')](_0x612647[_0x5bbe('0x37')]);_0x2ae4c9['filters']=_['intersection'](_0x2ae4c9[_0x5bbe('0x36')],_0x2ae4c9[_0x5bbe('0x37')]);_0x2f3f94[_0x5bbe('0x3c')]=_[_0x5bbe('0x3a')](_0x2ae4c9[_0x5bbe('0x36')],qs[_0x5bbe('0x3b')](_0x612647[_0x5bbe('0x37')][_0x5bbe('0x3b')]));_0x2f3f94[_0x5bbe('0x3c')]=_0x2f3f94[_0x5bbe('0x3c')][_0x5bbe('0x3d')]?_0x2f3f94[_0x5bbe('0x3c')]:_0x2ae4c9['model'];if(!_0x612647[_0x5bbe('0x37')][_0x5bbe('0x3e')]('nolimit')){_0x2f3f94['limit']=qs['limit'](_0x612647[_0x5bbe('0x37')][_0x5bbe('0x21')]);_0x2f3f94[_0x5bbe('0x1e')]=qs[_0x5bbe('0x1e')](_0x612647[_0x5bbe('0x37')][_0x5bbe('0x1e')]);}_0x2f3f94[_0x5bbe('0x3f')]=qs['sort'](_0x612647['query'][_0x5bbe('0x40')]);_0x2f3f94[_0x5bbe('0x42')]=qs[_0x5bbe('0x39')](_[_0x5bbe('0x57')](_0x612647[_0x5bbe('0x37')],_0x2ae4c9[_0x5bbe('0x39')]));_0x2f3f94[_0x5bbe('0x42')]['WhatsappQueueId']=_0x39e846['id'];if(_0x612647[_0x5bbe('0x37')][_0x5bbe('0x41')]){_0x2f3f94[_0x5bbe('0x42')]=_[_0x5bbe('0x44')](_0x2f3f94[_0x5bbe('0x42')],{'$or':_[_0x5bbe('0x30')](_0x2f3f94[_0x5bbe('0x3c')],function(_0x373b10){var _0x2845a9={};_0x2845a9[_0x373b10]={'$like':'%'+_0x612647['query'][_0x5bbe('0x41')]+'%'};return _0x2845a9;})});}_0x2f3f94=_[_0x5bbe('0x44')]({},_0x2f3f94,_0x612647[_0x5bbe('0x45')]);return db[_0x5bbe('0x56')][_0x5bbe('0x47')](_0x2f3f94);}})[_0x5bbe('0x25')](function(_0x26cd49){if(_0x26cd49){return db[_0x5bbe('0x58')][_0x5bbe('0x59')]({'where':{'id':_[_0x5bbe('0x30')](_0x26cd49,_0x5bbe('0x5a')),'role':_0x5bbe('0x5b')},'attributes':['id','name','whatsappPause',_0x5bbe('0x5c'),'createdAt']});}})[_0x5bbe('0x25')](function(_0x1681f4){if(_0x1681f4){return{'count':_0x1681f4[_0x5bbe('0x20')],'rows':_['map'](_0x1681f4[_0x5bbe('0x5d')],function(_0x425938){return{'membername':_0x425938[_0x5bbe('0x2d')],'UserId':_0x425938['id'],'queue_name':_0xfbe2f2['name'],'WhatsappQueueId':_0xfbe2f2['id'],'interface':util[_0x5bbe('0x5e')](_0x5bbe('0x5f'),_0x5bbe('0x60'),_0x425938[_0x5bbe('0x2d')]),'penalty':0x0,'paused':_0x425938[_0x5bbe('0x61')],'createdAt':_0x425938[_0x5bbe('0x62')],'updatedAt':_0x425938[_0x5bbe('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5bbe('0x25')](respondWithFilteredResult(_0x902911,_0x2f3f94))[_0x5bbe('0x4a')](handleError(_0x902911,null));};exports[_0x5bbe('0x63')]=function(_0x4acca4,_0x5d9a73,_0x8e5e1b){var _0x30ba76={};var _0x5d0f01={};var _0x1744f2;var _0x4a08b6;return db[_0x5bbe('0x31')]['findOne']({'where':{'id':_0x4acca4[_0x5bbe('0x49')]['id']}})['then'](handleEntityNotFound(_0x5d9a73,null))[_0x5bbe('0x25')](function(_0x418e59){if(_0x418e59){_0x1744f2=_0x418e59;_0x5d0f01['model']=_[_0x5bbe('0x38')](db[_0x5bbe('0x64')][_0x5bbe('0x32')]);_0x5d0f01[_0x5bbe('0x37')]=_['keys'](_0x4acca4[_0x5bbe('0x37')]);_0x5d0f01[_0x5bbe('0x39')]=_['intersection'](_0x5d0f01[_0x5bbe('0x36')],_0x5d0f01['query']);_0x30ba76['attributes']=_[_0x5bbe('0x3a')](_0x5d0f01['model'],qs[_0x5bbe('0x3b')](_0x4acca4[_0x5bbe('0x37')][_0x5bbe('0x3b')]));_0x30ba76[_0x5bbe('0x3c')]=_0x30ba76[_0x5bbe('0x3c')][_0x5bbe('0x3d')]?_0x30ba76[_0x5bbe('0x3c')]:_0x5d0f01[_0x5bbe('0x36')];_0x30ba76[_0x5bbe('0x3f')]=qs[_0x5bbe('0x40')](_0x4acca4[_0x5bbe('0x37')]['sort']);_0x30ba76[_0x5bbe('0x42')]=qs[_0x5bbe('0x39')](_[_0x5bbe('0x57')](_0x4acca4[_0x5bbe('0x37')],_0x5d0f01[_0x5bbe('0x39')]));if(_0x4acca4['query'][_0x5bbe('0x41')]){_0x30ba76['where']=_[_0x5bbe('0x44')](_0x30ba76[_0x5bbe('0x42')],{'$or':_[_0x5bbe('0x30')](_0x30ba76['attributes'],function(_0x147ddc){var _0x55f44b={};_0x55f44b[_0x147ddc]={'$like':'%'+_0x4acca4['query']['filter']+'%'};return _0x55f44b;})});}_0x30ba76=_[_0x5bbe('0x44')]({},_0x30ba76,_0x4acca4[_0x5bbe('0x45')]);return _0x1744f2[_0x5bbe('0x63')](_0x30ba76);}})['then'](function(_0x58820f){if(_0x58820f){_0x4a08b6=_0x58820f['length'];if(!_0x4acca4[_0x5bbe('0x37')][_0x5bbe('0x3e')]('nolimit')){_0x30ba76[_0x5bbe('0x21')]=qs['limit'](_0x4acca4[_0x5bbe('0x37')][_0x5bbe('0x21')]);_0x30ba76[_0x5bbe('0x1e')]=qs[_0x5bbe('0x1e')](_0x4acca4[_0x5bbe('0x37')][_0x5bbe('0x1e')]);}return _0x1744f2[_0x5bbe('0x63')](_0x30ba76);}})[_0x5bbe('0x25')](function(_0x264ed1){if(_0x264ed1){return _0x264ed1?{'count':_0x4a08b6,'rows':_0x264ed1}:null;}})['then'](respondWithResult(_0x5d9a73,null))[_0x5bbe('0x4a')](handleError(_0x5d9a73,null));};exports[_0x5bbe('0x65')]=function(_0xb37e19,_0x1b19d7,_0x11bc86){var _0x46b9bf=_0xb37e19[_0x5bbe('0x53')]['ids'];return db[_0x5bbe('0x64')]['findAll']({'where':{'id':_0x46b9bf},'attributes':['id'],'include':[{'model':db[_0x5bbe('0x58')],'as':_0x5bbe('0x66'),'attributes':['id',_0x5bbe('0x2d'),_0x5bbe('0x67'),_0x5bbe('0x68'),_0x5bbe('0x69')],'raw':!![]}]})[_0x5bbe('0x25')](function(_0x4341e6){if(_0x4341e6){var _0x1ec67b=_[_0x5bbe('0x6a')](_0x4341e6,function(_0x689106){var _0x583720=_0x689106[_0x5bbe('0x26')]({'plain':!![]});return _0x583720[_0x5bbe('0x66')];});return db[_0x5bbe('0x31')]['find']({'where':{'id':_0xb37e19['params']['id']}})[_0x5bbe('0x25')](function(_0x5e3a69){return db[_0x5bbe('0x6b')][_0x5bbe('0x6c')](function(_0x34de06){return _0x5e3a69[_0x5bbe('0x65')](_0x46b9bf,{'transaction':_0x34de06})[_0x5bbe('0x25')](function(){return BPromise[_0x5bbe('0x6d')](_0x1ec67b,function(_0x3de8c5){return db[_0x5bbe('0x56')][_0x5bbe('0x6e')]({'where':{'UserId':_0x3de8c5['id'],'WhatsappQueueId':_0xb37e19[_0x5bbe('0x49')]['id']},'transaction':_0x34de06});});})['then'](function(){_0x1ec67b[_0x5bbe('0x6f')](function(_0x504eaa){socket[_0x5bbe('0x70')](_0x5bbe('0x71'),{'UserId':_0x504eaa['id'],'WhatsappQueueId':_0x5e3a69['id']});});});});});}})[_0x5bbe('0x25')](respondWithStatusCode(_0x1b19d7,null))[_0x5bbe('0x4a')](handleError(_0x1b19d7,null));};exports[_0x5bbe('0x72')]=function(_0x4531a7,_0x5e0645,_0x191323){return db[_0x5bbe('0x64')][_0x5bbe('0x47')]({'where':{'id':_0x4531a7[_0x5bbe('0x37')][_0x5bbe('0x73')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5bbe('0x66'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5e0645,null))[_0x5bbe('0x25')](function(_0x26b246){var _0x589313=_[_0x5bbe('0x30')](_0x26b246,'id');var _0x4d653e=[];var _0x327c1d=[];var _0x542e6f=squel[_0x5bbe('0x74')]();_0x542e6f[_0x5bbe('0x75')](_0x5bbe('0x76'))[_0x5bbe('0x77')](_0x5bbe('0x78'),'tq')[_0x5bbe('0x79')]('user_has_teams','ut',_0x5bbe('0x7a'))['where'](_0x5bbe('0x7b'),_0x4531a7[_0x5bbe('0x49')]['id']);for(var _0x4c5fce=0x0;_0x4c5fce<_0x26b246[_0x5bbe('0x3d')];_0x4c5fce+=0x1){let _0x3490dd=_0x26b246[_0x4c5fce];for(var _0x194320=0x0;_0x194320<_0x3490dd[_0x5bbe('0x66')]['length'];_0x194320+=0x1){let _0x4ba924=_0x3490dd[_0x5bbe('0x66')][_0x194320];var _0x5dfa23=_0x542e6f[_0x5bbe('0x7c')]();_0x5dfa23[_0x5bbe('0x42')](_0x5bbe('0x7d'),_0x4ba924['id']);_0x327c1d[_0x5bbe('0x7e')](db['sequelize'][_0x5bbe('0x37')](_0x5dfa23[_0x5bbe('0x7f')](),{'type':db[_0x5bbe('0x6b')][_0x5bbe('0x80')][_0x5bbe('0x81')]})[_0x5bbe('0x25')](function(_0x431486){if(_0x431486[_0x5bbe('0x3d')]===0x1){return _0x4ba924['id'];}else{var _0x558a9d=_[_0x5bbe('0x82')](_[_0x5bbe('0x30')](_0x431486,'TeamId'),function(_0x251129){return _[_0x5bbe('0x83')](_0x589313,_0x251129);});if(_0x558a9d){return _0x4ba924['id'];}}}));}}return BPromise[_0x5bbe('0x84')](_0x327c1d)[_0x5bbe('0x25')](function(_0x40f3d9){_0x4d653e=_(_0x4d653e)[_0x5bbe('0x85')](_0x40f3d9)[_0x5bbe('0x86')]()[_0x5bbe('0x87')]();return db[_0x5bbe('0x31')][_0x5bbe('0x50')]({'where':{'id':_0x4531a7[_0x5bbe('0x49')]['id']}})[_0x5bbe('0x25')](function(_0x377937){return db['sequelize']['transaction'](function(_0x3250bb){return _0x377937['removeTeams'](_0x4531a7[_0x5bbe('0x37')]['ids'],{'transaction':_0x3250bb})[_0x5bbe('0x25')](function(){if(!_[_0x5bbe('0x88')](_0x4d653e)){return _0x377937[_0x5bbe('0x89')](_0x4d653e,{'transaction':_0x3250bb});}})[_0x5bbe('0x25')](function(){_0x4d653e[_0x5bbe('0x6f')](function(_0x2b3089){socket[_0x5bbe('0x70')]('userWhatsappQueue:remove',{'UserId':_0x2b3089,'WhatsappQueueId':_0x377937['id']});});});});});});})[_0x5bbe('0x25')](respondWithStatusCode(_0x5e0645,null))['catch'](handleError(_0x5e0645,null));};exports[_0x5bbe('0x8a')]=function(_0x1592ed,_0x242b5c,_0x2aaa7e){return db['WhatsappQueue'][_0x5bbe('0x50')]({'where':{'id':_0x1592ed[_0x5bbe('0x49')]['id']}})[_0x5bbe('0x25')](handleEntityNotFound(_0x242b5c,null))['then'](function(_0x510fcc){if(_0x510fcc){return _0x510fcc['addAgents'](_0x1592ed[_0x5bbe('0x53')][_0x5bbe('0x73')],_['omit'](_0x1592ed[_0x5bbe('0x53')],[_0x5bbe('0x73'),'id'])||{})['spread'](function(_0x1e79de){for(var _0x5ed3f6=0x0;_0x5ed3f6<_0x1592ed[_0x5bbe('0x53')][_0x5bbe('0x73')]['length'];_0x5ed3f6+=0x1){socket[_0x5bbe('0x70')]('userWhatsappQueue:save',{'UserId':Number(_0x1592ed['body'][_0x5bbe('0x73')][_0x5ed3f6]),'WhatsappQueueId':Number(_0x1592ed[_0x5bbe('0x49')]['id'])});}return _0x1e79de;});}})[_0x5bbe('0x25')](respondWithResult(_0x242b5c,null))[_0x5bbe('0x4a')](handleError(_0x242b5c,null));};exports[_0x5bbe('0x89')]=function(_0x1e2deb,_0x2d0fb0,_0x54cc14){return db[_0x5bbe('0x31')]['find']({'where':{'id':_0x1e2deb[_0x5bbe('0x49')]['id']}})[_0x5bbe('0x25')](handleEntityNotFound(_0x2d0fb0,null))[_0x5bbe('0x25')](function(_0x24b334){if(_0x24b334){return _0x24b334['removeAgents'](_0x1e2deb[_0x5bbe('0x37')]['ids'])['then'](function(){if(_[_0x5bbe('0x8b')](_0x1e2deb[_0x5bbe('0x37')]['ids'])){for(var _0x535f45=0x0;_0x535f45<_0x1e2deb[_0x5bbe('0x37')][_0x5bbe('0x73')][_0x5bbe('0x3d')];_0x535f45+=0x1){socket[_0x5bbe('0x70')](_0x5bbe('0x8c'),{'UserId':Number(_0x1e2deb[_0x5bbe('0x37')][_0x5bbe('0x73')][_0x535f45]),'WhatsappQueueId':Number(_0x1e2deb[_0x5bbe('0x49')]['id'])});}}else{socket[_0x5bbe('0x70')](_0x5bbe('0x8c'),{'UserId':Number(_0x1e2deb['query'][_0x5bbe('0x73')]),'WhatsappQueueId':Number(_0x1e2deb[_0x5bbe('0x49')]['id'])});}});}})[_0x5bbe('0x25')](respondWithStatusCode(_0x2d0fb0,null))[_0x5bbe('0x4a')](handleError(_0x2d0fb0,null));};exports[_0x5bbe('0x8d')]=function(_0x775381,_0xcaa77,_0x45b79c){var _0x4a2ecf={};var _0x2d525e={};var _0x4d0ef0;var _0x3362c6;return db[_0x5bbe('0x31')][_0x5bbe('0x55')]({'where':{'id':_0x775381['params']['id']}})[_0x5bbe('0x25')](handleEntityNotFound(_0xcaa77,null))[_0x5bbe('0x25')](function(_0xca3d78){if(_0xca3d78){_0x4d0ef0=_0xca3d78;_0x2d525e[_0x5bbe('0x36')]=_['keys'](db['User'][_0x5bbe('0x32')]);_0x2d525e['query']=_[_0x5bbe('0x38')](_0x775381[_0x5bbe('0x37')]);_0x2d525e[_0x5bbe('0x39')]=_[_0x5bbe('0x3a')](_0x2d525e[_0x5bbe('0x36')],_0x2d525e[_0x5bbe('0x37')]);_0x4a2ecf[_0x5bbe('0x3c')]=_[_0x5bbe('0x3a')](_0x2d525e[_0x5bbe('0x36')],qs[_0x5bbe('0x3b')](_0x775381[_0x5bbe('0x37')][_0x5bbe('0x3b')]));_0x4a2ecf[_0x5bbe('0x3c')]=_0x4a2ecf[_0x5bbe('0x3c')][_0x5bbe('0x3d')]?_0x4a2ecf[_0x5bbe('0x3c')]:_0x2d525e[_0x5bbe('0x36')];_0x4a2ecf[_0x5bbe('0x3f')]=qs[_0x5bbe('0x40')](_0x775381['query'][_0x5bbe('0x40')]);_0x4a2ecf['where']=qs[_0x5bbe('0x39')](_[_0x5bbe('0x57')](_0x775381[_0x5bbe('0x37')],_0x2d525e['filters']));if(_0x775381[_0x5bbe('0x37')][_0x5bbe('0x41')]){_0x4a2ecf[_0x5bbe('0x42')]=_[_0x5bbe('0x44')](_0x4a2ecf[_0x5bbe('0x42')],{'$or':_['map'](_0x4a2ecf['attributes'],function(_0x3acf13){var _0x4f3dfd={};_0x4f3dfd[_0x3acf13]={'$like':'%'+_0x775381[_0x5bbe('0x37')][_0x5bbe('0x41')]+'%'};return _0x4f3dfd;})});}_0x4a2ecf=_[_0x5bbe('0x44')]({},_0x4a2ecf,_0x775381[_0x5bbe('0x45')]);return _0x4d0ef0[_0x5bbe('0x8d')](_0x4a2ecf);}})[_0x5bbe('0x25')](function(_0x47d1d6){if(_0x47d1d6){_0x3362c6=_0x47d1d6[_0x5bbe('0x3d')];if(!_0x775381['query']['hasOwnProperty']('nolimit')){_0x4a2ecf[_0x5bbe('0x21')]=qs[_0x5bbe('0x21')](_0x775381['query']['limit']);_0x4a2ecf[_0x5bbe('0x1e')]=qs[_0x5bbe('0x1e')](_0x775381[_0x5bbe('0x37')][_0x5bbe('0x1e')]);}return _0x4d0ef0[_0x5bbe('0x8d')](_0x4a2ecf);}})[_0x5bbe('0x25')](function(_0x108cc9){if(_0x108cc9){return _0x108cc9?{'count':_0x3362c6,'rows':_0x108cc9}:null;}})[_0x5bbe('0x25')](respondWithResult(_0xcaa77,null))[_0x5bbe('0x4a')](handleError(_0xcaa77,null));}; \ No newline at end of file +var _0x575a=['fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappQueue.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','WhatsappQueues','error','stack','index','map','WhatsappQueue','fieldName','type','keys','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','user','role','UserProfileSection','userProfileId','UserProfileResource','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserWhatsappQueue','pick','WhatsappQueueId','findAll','User','UserId','agent','updatedAt','createdAt','%s/%s','SIP','whatsappPause','getTeams','findOne','Team','addTeams','Agents','online','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','ids','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','QueryTypes','SELECT','TeamId','includes','all','compact','value','transaction','isEmpty','userWhatsappQueue:remove','addAgents','spread','isArray','getAgents','zip-dir','request-promise','bluebird','mustache','util','path','to-csv'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x575a,0x83));var _0xa575=function(_0x2adfb1,_0x406e6e){_0x2adfb1=_0x2adfb1-0x0;var _0xa52d45=_0x575a[_0x2adfb1];return _0xa52d45;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa575('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa575('0x1'));var moment=require('moment');var BPromise=require(_0xa575('0x2'));var Mustache=require(_0xa575('0x3'));var util=require(_0xa575('0x4'));var path=require(_0xa575('0x5'));var sox=require('sox');var csv=require(_0xa575('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa575('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa575('0x8'));var jsforce=require(_0xa575('0x9'));var deskjs=require(_0xa575('0xa'));var toCsv=require(_0xa575('0x6'));var querystring=require(_0xa575('0xb'));var Papa=require(_0xa575('0xc'));var Redis=require(_0xa575('0xd'));var authService=require(_0xa575('0xe'));var qs=require(_0xa575('0xf'));var as=require(_0xa575('0x10'));var hardwareService=require(_0xa575('0x11'));var logger=require(_0xa575('0x12'))('api');var utils=require(_0xa575('0x13'));var config=require(_0xa575('0x14'));var licenseUtil=require(_0xa575('0x15'));var db=require(_0xa575('0x16'))['db'];config[_0xa575('0x17')]=_[_0xa575('0x18')](config['redis'],{'host':_0xa575('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa575('0x17')]));require(_0xa575('0x1a'))[_0xa575('0x1b')](socket);function respondWithStatusCode(_0x2595a7,_0x145e12){_0x145e12=_0x145e12||0xcc;return function(_0x8b65a8){if(_0x8b65a8){return _0x2595a7[_0xa575('0x1c')](_0x145e12);}return _0x2595a7[_0xa575('0x1d')](_0x145e12)[_0xa575('0x1e')]();};}function respondWithResult(_0x5dc793,_0x5ba525){_0x5ba525=_0x5ba525||0xc8;return function(_0x2afc2e){if(_0x2afc2e){return _0x5dc793['status'](_0x5ba525)['json'](_0x2afc2e);}};}function respondWithFilteredResult(_0x5f0192,_0x1ddaff){return function(_0x2214ac){if(_0x2214ac){var _0x3d5553=typeof _0x1ddaff[_0xa575('0x1f')]==='undefined'&&typeof _0x1ddaff[_0xa575('0x20')]===_0xa575('0x21');var _0x50d2a2=_0x2214ac['count'];var _0xecbabc=_0x3d5553?0x0:_0x1ddaff['offset'];var _0x1d763a=_0x3d5553?_0x2214ac[_0xa575('0x22')]:_0x1ddaff['offset']+_0x1ddaff['limit'];var _0x16db57;if(_0x1d763a>=_0x50d2a2){_0x1d763a=_0x50d2a2;_0x16db57=0xc8;}else{_0x16db57=0xce;}_0x5f0192[_0xa575('0x1d')](_0x16db57);return _0x5f0192[_0xa575('0x23')]('Content-Range',_0xecbabc+'-'+_0x1d763a+'/'+_0x50d2a2)['json'](_0x2214ac);}return null;};}function patchUpdates(_0x17012b){return function(_0x23474f){try{jsonpatch[_0xa575('0x24')](_0x23474f,_0x17012b,!![]);}catch(_0x244914){return BPromise[_0xa575('0x25')](_0x244914);}return _0x23474f[_0xa575('0x26')]();};}function saveUpdates(_0x32a850,_0x70ddf4){return function(_0x4ba0ae){if(_0x4ba0ae){return _0x4ba0ae[_0xa575('0x27')](_0x32a850)[_0xa575('0x28')](function(_0x3999c1){return _0x3999c1;});}return null;};}function removeEntity(_0x10fd49,_0x208bbd){return function(_0x1d8a42){if(_0x1d8a42){return _0x1d8a42[_0xa575('0x29')]()[_0xa575('0x28')](function(){var _0x4767c6=_0x1d8a42[_0xa575('0x2a')]({'plain':!![]});var _0x47156b=_0xa575('0x2b');return db['UserProfileResource'][_0xa575('0x29')]({'where':{'type':_0x47156b,'resourceId':_0x4767c6['id']}})[_0xa575('0x28')](function(){return _0x1d8a42;});})[_0xa575('0x28')](function(){_0x10fd49[_0xa575('0x1d')](0xcc)[_0xa575('0x1e')]();});}};}function handleEntityNotFound(_0x578455,_0x241ef2){return function(_0x351daa){if(!_0x351daa){_0x578455['sendStatus'](0x194);}return _0x351daa;};}function handleError(_0x1a51fe,_0x18ac59){_0x18ac59=_0x18ac59||0x1f4;return function(_0xd86be5){logger[_0xa575('0x2c')](_0xd86be5[_0xa575('0x2d')]);if(_0xd86be5['name']){delete _0xd86be5['name'];}_0x1a51fe[_0xa575('0x1d')](_0x18ac59)['send'](_0xd86be5);};}exports[_0xa575('0x2e')]=function(_0x14c81b,_0x3236e7){var _0x25e672={},_0x48c768={},_0x4db8d4={'count':0x0,'rows':[]};var _0x42fc4a=_[_0xa575('0x2f')](db[_0xa575('0x30')]['rawAttributes'],function(_0x246da8){return{'name':_0x246da8[_0xa575('0x31')],'type':_0x246da8[_0xa575('0x32')]['key']};});_0x48c768['model']=_['map'](_0x42fc4a,'name');_0x48c768['query']=_[_0xa575('0x33')](_0x14c81b[_0xa575('0x34')]);_0x48c768['filters']=_['intersection'](_0x48c768[_0xa575('0x35')],_0x48c768[_0xa575('0x34')]);_0x25e672[_0xa575('0x36')]=_[_0xa575('0x37')](_0x48c768[_0xa575('0x35')],qs['fields'](_0x14c81b[_0xa575('0x34')][_0xa575('0x38')]));_0x25e672[_0xa575('0x36')]=_0x25e672[_0xa575('0x36')][_0xa575('0x39')]?_0x25e672[_0xa575('0x36')]:_0x48c768[_0xa575('0x35')];if(!_0x14c81b['query'][_0xa575('0x3a')](_0xa575('0x3b'))){_0x25e672[_0xa575('0x20')]=qs[_0xa575('0x20')](_0x14c81b[_0xa575('0x34')][_0xa575('0x20')]);_0x25e672[_0xa575('0x1f')]=qs[_0xa575('0x1f')](_0x14c81b['query'][_0xa575('0x1f')]);}_0x25e672[_0xa575('0x3c')]=qs['sort'](_0x14c81b[_0xa575('0x34')][_0xa575('0x3d')]);_0x25e672[_0xa575('0x3e')]=qs['filters'](_['pick'](_0x14c81b['query'],_0x48c768[_0xa575('0x3f')]),_0x42fc4a);if(_0x14c81b[_0xa575('0x34')][_0xa575('0x40')]){_0x25e672['where']=_[_0xa575('0x41')](_0x25e672['where'],{'$or':_[_0xa575('0x2f')](_0x42fc4a,function(_0x27bc1c){if(_0x27bc1c['type']!==_0xa575('0x42')){var _0x2be552={};_0x2be552[_0x27bc1c['name']]={'$like':'%'+_0x14c81b[_0xa575('0x34')]['filter']+'%'};return _0x2be552;}})});}_0x25e672=_['merge']({},_0x25e672,_0x14c81b[_0xa575('0x43')]);var _0x23b4de={'where':_0x25e672[_0xa575('0x3e')]};return db[_0xa575('0x30')][_0xa575('0x22')](_0x23b4de)['then'](function(_0x58a6a7){_0x4db8d4[_0xa575('0x22')]=_0x58a6a7;if(_0x14c81b[_0xa575('0x34')][_0xa575('0x44')]){_0x25e672[_0xa575('0x45')]=[{'all':!![]}];}return db[_0xa575('0x30')]['findAll'](_0x25e672);})['then'](function(_0x494a0b){_0x4db8d4[_0xa575('0x46')]=_0x494a0b;return _0x4db8d4;})['then'](respondWithFilteredResult(_0x3236e7,_0x25e672))[_0xa575('0x47')](handleError(_0x3236e7,null));};exports[_0xa575('0x48')]=function(_0x360db3,_0x3e5461){var _0x4ff4be={'raw':!![],'where':{'id':_0x360db3[_0xa575('0x49')]['id']}},_0x300d62={};_0x300d62[_0xa575('0x35')]=_[_0xa575('0x33')](db['WhatsappQueue'][_0xa575('0x4a')]);_0x300d62[_0xa575('0x34')]=_[_0xa575('0x33')](_0x360db3['query']);_0x300d62['filters']=_[_0xa575('0x37')](_0x300d62['model'],_0x300d62[_0xa575('0x34')]);_0x4ff4be[_0xa575('0x36')]=_[_0xa575('0x37')](_0x300d62[_0xa575('0x35')],qs[_0xa575('0x38')](_0x360db3[_0xa575('0x34')][_0xa575('0x38')]));_0x4ff4be[_0xa575('0x36')]=_0x4ff4be[_0xa575('0x36')][_0xa575('0x39')]?_0x4ff4be[_0xa575('0x36')]:_0x300d62[_0xa575('0x35')];if(_0x360db3[_0xa575('0x34')][_0xa575('0x44')]){_0x4ff4be['include']=[{'all':!![]}];}_0x4ff4be=_[_0xa575('0x41')]({},_0x4ff4be,_0x360db3['options']);return db['WhatsappQueue'][_0xa575('0x4b')](_0x4ff4be)['then'](handleEntityNotFound(_0x3e5461,null))['then'](respondWithResult(_0x3e5461,null))[_0xa575('0x47')](handleError(_0x3e5461,null));};exports['create']=function(_0x3ba2a8,_0x1c2a04){return db[_0xa575('0x30')][_0xa575('0x4c')](_0x3ba2a8[_0xa575('0x4d')],{})[_0xa575('0x28')](function(_0x31d12f){var _0x35b06b=_0x3ba2a8[_0xa575('0x4e')]['get']({'plain':!![]});if(!_0x35b06b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35b06b[_0xa575('0x4f')]==='user'){var _0x4dbd95=_0x31d12f[_0xa575('0x2a')]({'plain':!![]});var _0x33cb33=_0xa575('0x2b');return db[_0xa575('0x50')]['find']({'where':{'name':_0x33cb33,'userProfileId':_0x35b06b[_0xa575('0x51')]},'raw':!![]})['then'](function(_0x17405c){if(_0x17405c&&_0x17405c['autoAssociation']===0x0){return db[_0xa575('0x52')][_0xa575('0x4c')]({'name':_0x4dbd95[_0xa575('0x53')],'resourceId':_0x4dbd95['id'],'type':_0x17405c[_0xa575('0x53')],'sectionId':_0x17405c['id']},{})[_0xa575('0x28')](function(){return _0x31d12f;});}else{return _0x31d12f;}})[_0xa575('0x47')](function(_0x5dd68e){logger[_0xa575('0x2c')](_0xa575('0x54'),_0x5dd68e);throw _0x5dd68e;});}return _0x31d12f;})[_0xa575('0x28')](respondWithResult(_0x1c2a04,0xc9))[_0xa575('0x47')](handleError(_0x1c2a04,null));};exports[_0xa575('0x27')]=function(_0x458c3d,_0x5f238e){if(_0x458c3d['body']['id']){delete _0x458c3d[_0xa575('0x4d')]['id'];}return db['WhatsappQueue'][_0xa575('0x4b')]({'where':{'id':_0x458c3d[_0xa575('0x49')]['id']}})[_0xa575('0x28')](handleEntityNotFound(_0x5f238e,null))[_0xa575('0x28')](saveUpdates(_0x458c3d[_0xa575('0x4d')],null))[_0xa575('0x28')](respondWithResult(_0x5f238e,null))['catch'](handleError(_0x5f238e,null));};exports[_0xa575('0x29')]=function(_0x7e6a71,_0x47f1b5){return db[_0xa575('0x30')][_0xa575('0x4b')]({'where':{'id':_0x7e6a71[_0xa575('0x49')]['id']}})[_0xa575('0x28')](handleEntityNotFound(_0x47f1b5,null))[_0xa575('0x28')](removeEntity(_0x47f1b5,null))[_0xa575('0x47')](handleError(_0x47f1b5,null));};exports['describe']=function(_0x3ee96a,_0x15d23e){return db['WhatsappQueue'][_0xa575('0x55')]()[_0xa575('0x28')](respondWithResult(_0x15d23e,null))[_0xa575('0x47')](handleError(_0x15d23e,null));};exports[_0xa575('0x56')]=function(_0x3786aa,_0x4ccebb,_0x44e4f9){var _0x22e076={'raw':!![],'where':{}},_0x19e10f={},_0x5de858;return db[_0xa575('0x30')]['findOne']({'where':{'id':_0x3786aa[_0xa575('0x49')]['id']}})[_0xa575('0x28')](handleEntityNotFound(_0x4ccebb,null))[_0xa575('0x28')](function(_0x540949){if(_0x540949){_0x5de858=_0x540949['get']({'plain':!![]});_0x19e10f[_0xa575('0x35')]=_[_0xa575('0x33')](db[_0xa575('0x57')][_0xa575('0x4a')]);_0x19e10f[_0xa575('0x34')]=_[_0xa575('0x33')](_0x3786aa[_0xa575('0x34')]);_0x19e10f[_0xa575('0x3f')]=_[_0xa575('0x37')](_0x19e10f[_0xa575('0x35')],_0x19e10f[_0xa575('0x34')]);_0x22e076['attributes']=_[_0xa575('0x37')](_0x19e10f[_0xa575('0x35')],qs[_0xa575('0x38')](_0x3786aa[_0xa575('0x34')][_0xa575('0x38')]));_0x22e076[_0xa575('0x36')]=_0x22e076[_0xa575('0x36')][_0xa575('0x39')]?_0x22e076['attributes']:_0x19e10f[_0xa575('0x35')];if(!_0x3786aa[_0xa575('0x34')][_0xa575('0x3a')]('nolimit')){_0x22e076[_0xa575('0x20')]=qs[_0xa575('0x20')](_0x3786aa[_0xa575('0x34')][_0xa575('0x20')]);_0x22e076[_0xa575('0x1f')]=qs['offset'](_0x3786aa[_0xa575('0x34')][_0xa575('0x1f')]);}_0x22e076[_0xa575('0x3c')]=qs[_0xa575('0x3d')](_0x3786aa[_0xa575('0x34')][_0xa575('0x3d')]);_0x22e076[_0xa575('0x3e')]=qs[_0xa575('0x3f')](_[_0xa575('0x58')](_0x3786aa[_0xa575('0x34')],_0x19e10f['filters']));_0x22e076[_0xa575('0x3e')][_0xa575('0x59')]=_0x540949['id'];if(_0x3786aa['query']['filter']){_0x22e076[_0xa575('0x3e')]=_[_0xa575('0x41')](_0x22e076[_0xa575('0x3e')],{'$or':_[_0xa575('0x2f')](_0x22e076[_0xa575('0x36')],function(_0xdf279a){var _0x462253={};_0x462253[_0xdf279a]={'$like':'%'+_0x3786aa[_0xa575('0x34')][_0xa575('0x40')]+'%'};return _0x462253;})});}_0x22e076=_[_0xa575('0x41')]({},_0x22e076,_0x3786aa[_0xa575('0x43')]);return db[_0xa575('0x57')][_0xa575('0x5a')](_0x22e076);}})[_0xa575('0x28')](function(_0x2ac93b){if(_0x2ac93b){return db[_0xa575('0x5b')]['findAndCountAll']({'where':{'id':_[_0xa575('0x2f')](_0x2ac93b,_0xa575('0x5c')),'role':_0xa575('0x5d')},'attributes':['id',_0xa575('0x53'),'whatsappPause',_0xa575('0x5e'),_0xa575('0x5f')]});}})[_0xa575('0x28')](function(_0x54f337){if(_0x54f337){return{'count':_0x54f337[_0xa575('0x22')],'rows':_[_0xa575('0x2f')](_0x54f337[_0xa575('0x46')],function(_0x58f051){return{'membername':_0x58f051['name'],'UserId':_0x58f051['id'],'queue_name':_0x5de858[_0xa575('0x53')],'WhatsappQueueId':_0x5de858['id'],'interface':util['format'](_0xa575('0x60'),_0xa575('0x61'),_0x58f051['name']),'penalty':0x0,'paused':_0x58f051[_0xa575('0x62')],'createdAt':_0x58f051['createdAt'],'updatedAt':_0x58f051[_0xa575('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa575('0x28')](respondWithFilteredResult(_0x4ccebb,_0x22e076))[_0xa575('0x47')](handleError(_0x4ccebb,null));};exports[_0xa575('0x63')]=function(_0x36b8e0,_0x291091,_0x1b8e0a){var _0x2cdbb5={};var _0x3371b9={};var _0x45b149;var _0x139ff2;return db[_0xa575('0x30')][_0xa575('0x64')]({'where':{'id':_0x36b8e0[_0xa575('0x49')]['id']}})['then'](handleEntityNotFound(_0x291091,null))['then'](function(_0x3c412c){if(_0x3c412c){_0x45b149=_0x3c412c;_0x3371b9[_0xa575('0x35')]=_[_0xa575('0x33')](db[_0xa575('0x65')][_0xa575('0x4a')]);_0x3371b9[_0xa575('0x34')]=_[_0xa575('0x33')](_0x36b8e0[_0xa575('0x34')]);_0x3371b9['filters']=_['intersection'](_0x3371b9[_0xa575('0x35')],_0x3371b9[_0xa575('0x34')]);_0x2cdbb5[_0xa575('0x36')]=_['intersection'](_0x3371b9[_0xa575('0x35')],qs[_0xa575('0x38')](_0x36b8e0[_0xa575('0x34')]['fields']));_0x2cdbb5[_0xa575('0x36')]=_0x2cdbb5[_0xa575('0x36')][_0xa575('0x39')]?_0x2cdbb5['attributes']:_0x3371b9[_0xa575('0x35')];_0x2cdbb5[_0xa575('0x3c')]=qs[_0xa575('0x3d')](_0x36b8e0[_0xa575('0x34')][_0xa575('0x3d')]);_0x2cdbb5[_0xa575('0x3e')]=qs[_0xa575('0x3f')](_[_0xa575('0x58')](_0x36b8e0['query'],_0x3371b9[_0xa575('0x3f')]));if(_0x36b8e0[_0xa575('0x34')][_0xa575('0x40')]){_0x2cdbb5['where']=_['merge'](_0x2cdbb5[_0xa575('0x3e')],{'$or':_[_0xa575('0x2f')](_0x2cdbb5[_0xa575('0x36')],function(_0x242b6f){var _0x4bc5cd={};_0x4bc5cd[_0x242b6f]={'$like':'%'+_0x36b8e0[_0xa575('0x34')]['filter']+'%'};return _0x4bc5cd;})});}_0x2cdbb5=_['merge']({},_0x2cdbb5,_0x36b8e0['options']);return _0x45b149[_0xa575('0x63')](_0x2cdbb5);}})[_0xa575('0x28')](function(_0x4b48a0){if(_0x4b48a0){_0x139ff2=_0x4b48a0['length'];if(!_0x36b8e0[_0xa575('0x34')][_0xa575('0x3a')]('nolimit')){_0x2cdbb5[_0xa575('0x20')]=qs[_0xa575('0x20')](_0x36b8e0['query'][_0xa575('0x20')]);_0x2cdbb5[_0xa575('0x1f')]=qs[_0xa575('0x1f')](_0x36b8e0[_0xa575('0x34')][_0xa575('0x1f')]);}return _0x45b149[_0xa575('0x63')](_0x2cdbb5);}})['then'](function(_0x4df1e3){if(_0x4df1e3){return _0x4df1e3?{'count':_0x139ff2,'rows':_0x4df1e3}:null;}})['then'](respondWithResult(_0x291091,null))[_0xa575('0x47')](handleError(_0x291091,null));};exports[_0xa575('0x66')]=function(_0x5706f9,_0x5d4c84,_0x1f6a02){var _0x3dd723=_0x5706f9['body']['ids'];return db[_0xa575('0x65')][_0xa575('0x5a')]({'where':{'id':_0x3dd723},'attributes':['id'],'include':[{'model':db[_0xa575('0x5b')],'as':_0xa575('0x67'),'attributes':['id',_0xa575('0x53'),_0xa575('0x68'),'voicePause',_0xa575('0x69')],'raw':!![]}]})[_0xa575('0x28')](function(_0x1a8db0){if(_0x1a8db0){var _0x5ab9b2=_[_0xa575('0x6a')](_0x1a8db0,function(_0x390865){var _0x148b0d=_0x390865[_0xa575('0x2a')]({'plain':!![]});return _0x148b0d[_0xa575('0x67')];});return db[_0xa575('0x30')]['find']({'where':{'id':_0x5706f9['params']['id']}})['then'](function(_0x539e30){return db[_0xa575('0x6b')]['transaction'](function(_0x21928e){return _0x539e30['addTeams'](_0x3dd723,{'transaction':_0x21928e})[_0xa575('0x28')](function(){return BPromise[_0xa575('0x6c')](_0x5ab9b2,function(_0x2fcf4c){return db[_0xa575('0x57')][_0xa575('0x6d')]({'where':{'UserId':_0x2fcf4c['id'],'WhatsappQueueId':_0x5706f9[_0xa575('0x49')]['id']},'transaction':_0x21928e});});})[_0xa575('0x28')](function(){_0x5ab9b2[_0xa575('0x6e')](function(_0x181208){socket[_0xa575('0x6f')](_0xa575('0x70'),{'UserId':_0x181208['id'],'WhatsappQueueId':_0x539e30['id']});});});});});}})[_0xa575('0x28')](respondWithStatusCode(_0x5d4c84,null))[_0xa575('0x47')](handleError(_0x5d4c84,null));};exports[_0xa575('0x71')]=function(_0x160330,_0x27cf84,_0x3a1759){return db[_0xa575('0x65')]['findAll']({'where':{'id':_0x160330['query'][_0xa575('0x72')]},'attributes':['id'],'include':[{'model':db[_0xa575('0x5b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xa575('0x28')](handleEntityNotFound(_0x27cf84,null))[_0xa575('0x28')](function(_0x140191){var _0xa4b325=_['map'](_0x140191,'id');var _0x31c7c8=[];var _0x3c0c62=[];var _0x319b5e=squel[_0xa575('0x73')]();_0x319b5e['field'](_0xa575('0x74'))[_0xa575('0x75')]('team_has_whatsapp_queues','tq')[_0xa575('0x76')](_0xa575('0x77'),'ut',_0xa575('0x78'))[_0xa575('0x3e')]('WhatsappQueueId\x20=\x20?',_0x160330[_0xa575('0x49')]['id']);for(var _0x2e6a0e=0x0;_0x2e6a0e<_0x140191['length'];_0x2e6a0e+=0x1){let _0x25e5f2=_0x140191[_0x2e6a0e];for(var _0x33aa45=0x0;_0x33aa45<_0x25e5f2[_0xa575('0x67')]['length'];_0x33aa45+=0x1){let _0xd3eec7=_0x25e5f2['Agents'][_0x33aa45];var _0x313896=_0x319b5e[_0xa575('0x79')]();_0x313896['where']('ut.UserId\x20=\x20?',_0xd3eec7['id']);_0x3c0c62[_0xa575('0x7a')](db[_0xa575('0x6b')]['query'](_0x313896[_0xa575('0x7b')](),{'type':db[_0xa575('0x6b')][_0xa575('0x7c')][_0xa575('0x7d')]})['then'](function(_0x302485){if(_0x302485[_0xa575('0x39')]===0x1){return _0xd3eec7['id'];}else{var _0x59e6b9=_['every'](_[_0xa575('0x2f')](_0x302485,_0xa575('0x7e')),function(_0x2cd425){return _[_0xa575('0x7f')](_0xa4b325,_0x2cd425);});if(_0x59e6b9){return _0xd3eec7['id'];}}}));}}return BPromise[_0xa575('0x80')](_0x3c0c62)[_0xa575('0x28')](function(_0x27f716){_0x31c7c8=_(_0x31c7c8)['union'](_0x27f716)[_0xa575('0x81')]()[_0xa575('0x82')]();return db['WhatsappQueue'][_0xa575('0x4b')]({'where':{'id':_0x160330[_0xa575('0x49')]['id']}})['then'](function(_0x41d8bc){return db[_0xa575('0x6b')][_0xa575('0x83')](function(_0x37c23f){return _0x41d8bc[_0xa575('0x71')](_0x160330['query'][_0xa575('0x72')],{'transaction':_0x37c23f})['then'](function(){if(!_[_0xa575('0x84')](_0x31c7c8)){return _0x41d8bc['removeAgents'](_0x31c7c8,{'transaction':_0x37c23f});}})[_0xa575('0x28')](function(){_0x31c7c8[_0xa575('0x6e')](function(_0x562621){socket[_0xa575('0x6f')](_0xa575('0x85'),{'UserId':_0x562621,'WhatsappQueueId':_0x41d8bc['id']});});});});});});})['then'](respondWithStatusCode(_0x27cf84,null))[_0xa575('0x47')](handleError(_0x27cf84,null));};exports[_0xa575('0x86')]=function(_0x4bf6ed,_0x2b4794,_0x49381b){return db['WhatsappQueue']['find']({'where':{'id':_0x4bf6ed[_0xa575('0x49')]['id']}})[_0xa575('0x28')](handleEntityNotFound(_0x2b4794,null))['then'](function(_0x5338ec){if(_0x5338ec){return _0x5338ec[_0xa575('0x86')](_0x4bf6ed[_0xa575('0x4d')]['ids'],_['omit'](_0x4bf6ed[_0xa575('0x4d')],[_0xa575('0x72'),'id'])||{})[_0xa575('0x87')](function(_0x51721b){for(var _0x422fec=0x0;_0x422fec<_0x4bf6ed[_0xa575('0x4d')][_0xa575('0x72')][_0xa575('0x39')];_0x422fec+=0x1){socket[_0xa575('0x6f')](_0xa575('0x70'),{'UserId':Number(_0x4bf6ed[_0xa575('0x4d')][_0xa575('0x72')][_0x422fec]),'WhatsappQueueId':Number(_0x4bf6ed['params']['id'])});}return _0x51721b;});}})['then'](respondWithResult(_0x2b4794,null))[_0xa575('0x47')](handleError(_0x2b4794,null));};exports['removeAgents']=function(_0x5cf572,_0x4fdfb9,_0x3b085b){return db['WhatsappQueue'][_0xa575('0x4b')]({'where':{'id':_0x5cf572[_0xa575('0x49')]['id']}})['then'](handleEntityNotFound(_0x4fdfb9,null))[_0xa575('0x28')](function(_0xff366f){if(_0xff366f){return _0xff366f['removeAgents'](_0x5cf572['query'][_0xa575('0x72')])[_0xa575('0x28')](function(){if(_[_0xa575('0x88')](_0x5cf572[_0xa575('0x34')][_0xa575('0x72')])){for(var _0x5684e7=0x0;_0x5684e7<_0x5cf572['query'][_0xa575('0x72')][_0xa575('0x39')];_0x5684e7+=0x1){socket[_0xa575('0x6f')](_0xa575('0x85'),{'UserId':Number(_0x5cf572[_0xa575('0x34')][_0xa575('0x72')][_0x5684e7]),'WhatsappQueueId':Number(_0x5cf572[_0xa575('0x49')]['id'])});}}else{socket['emit'](_0xa575('0x85'),{'UserId':Number(_0x5cf572[_0xa575('0x34')][_0xa575('0x72')]),'WhatsappQueueId':Number(_0x5cf572[_0xa575('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x4fdfb9,null))[_0xa575('0x47')](handleError(_0x4fdfb9,null));};exports[_0xa575('0x89')]=function(_0x1dc328,_0x566bc5,_0x5e523e){var _0x5df2ae={};var _0x37c654={};var _0x5874ee;var _0x66ba36;return db[_0xa575('0x30')][_0xa575('0x64')]({'where':{'id':_0x1dc328[_0xa575('0x49')]['id']}})[_0xa575('0x28')](handleEntityNotFound(_0x566bc5,null))[_0xa575('0x28')](function(_0x141517){if(_0x141517){_0x5874ee=_0x141517;_0x37c654[_0xa575('0x35')]=_[_0xa575('0x33')](db['User']['rawAttributes']);_0x37c654[_0xa575('0x34')]=_[_0xa575('0x33')](_0x1dc328[_0xa575('0x34')]);_0x37c654['filters']=_[_0xa575('0x37')](_0x37c654[_0xa575('0x35')],_0x37c654['query']);_0x5df2ae[_0xa575('0x36')]=_[_0xa575('0x37')](_0x37c654[_0xa575('0x35')],qs[_0xa575('0x38')](_0x1dc328[_0xa575('0x34')]['fields']));_0x5df2ae[_0xa575('0x36')]=_0x5df2ae[_0xa575('0x36')][_0xa575('0x39')]?_0x5df2ae['attributes']:_0x37c654[_0xa575('0x35')];_0x5df2ae[_0xa575('0x3c')]=qs[_0xa575('0x3d')](_0x1dc328[_0xa575('0x34')][_0xa575('0x3d')]);_0x5df2ae[_0xa575('0x3e')]=qs[_0xa575('0x3f')](_[_0xa575('0x58')](_0x1dc328[_0xa575('0x34')],_0x37c654[_0xa575('0x3f')]));if(_0x1dc328[_0xa575('0x34')][_0xa575('0x40')]){_0x5df2ae[_0xa575('0x3e')]=_['merge'](_0x5df2ae[_0xa575('0x3e')],{'$or':_[_0xa575('0x2f')](_0x5df2ae[_0xa575('0x36')],function(_0x5e1003){var _0x1aac13={};_0x1aac13[_0x5e1003]={'$like':'%'+_0x1dc328['query'][_0xa575('0x40')]+'%'};return _0x1aac13;})});}_0x5df2ae=_[_0xa575('0x41')]({},_0x5df2ae,_0x1dc328[_0xa575('0x43')]);return _0x5874ee['getAgents'](_0x5df2ae);}})[_0xa575('0x28')](function(_0xc69847){if(_0xc69847){_0x66ba36=_0xc69847['length'];if(!_0x1dc328['query']['hasOwnProperty']('nolimit')){_0x5df2ae[_0xa575('0x20')]=qs[_0xa575('0x20')](_0x1dc328[_0xa575('0x34')][_0xa575('0x20')]);_0x5df2ae['offset']=qs[_0xa575('0x1f')](_0x1dc328[_0xa575('0x34')][_0xa575('0x1f')]);}return _0x5874ee[_0xa575('0x89')](_0x5df2ae);}})['then'](function(_0x37f330){if(_0x37f330){return _0x37f330?{'count':_0x66ba36,'rows':_0x37f330}:null;}})[_0xa575('0x28')](respondWithResult(_0x566bc5,null))['catch'](handleError(_0x566bc5,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 3afe591..6365fbd 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 _0x12fb=['events','../../mysqldb','WhatsappQueue','setMaxListeners','update','emit','hook','exports'];(function(_0x33eb5c,_0x4a7d98){var _0x253328=function(_0x3b23a0){while(--_0x3b23a0){_0x33eb5c['push'](_0x33eb5c['shift']());}};_0x253328(++_0x4a7d98);}(_0x12fb,0x130));var _0xb12f=function(_0x4e7abc,_0x2aeca1){_0x4e7abc=_0x4e7abc-0x0;var _0x428796=_0x12fb[_0x4e7abc];return _0x428796;};'use strict';var EventEmitter=require(_0xb12f('0x0'));var WhatsappQueue=require(_0xb12f('0x1'))['db'][_0xb12f('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xb12f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb12f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x20e43a){return function(_0x52ee4d,_0x184f5c,_0x5a33e6){WhatsappQueueEvents['emit'](_0x20e43a+':'+_0x52ee4d['id'],_0x52ee4d);WhatsappQueueEvents[_0xb12f('0x5')](_0x20e43a,_0x52ee4d);_0x5a33e6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xb12f('0x6')](e,emitEvent(event));}}module[_0xb12f('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0xba68=['WhatsappQueue','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports','events'];(function(_0x285824,_0x3da647){var _0x311d7e=function(_0x2f3de0){while(--_0x2f3de0){_0x285824['push'](_0x285824['shift']());}};_0x311d7e(++_0x3da647);}(_0xba68,0x1b8));var _0x8ba6=function(_0x30fdb7,_0x26483c){_0x30fdb7=_0x30fdb7-0x0;var _0x12668d=_0xba68[_0x30fdb7];return _0x12668d;};'use strict';var EventEmitter=require(_0x8ba6('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x8ba6('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x8ba6('0x2')](0x0);var events={'afterCreate':_0x8ba6('0x3'),'afterUpdate':_0x8ba6('0x4'),'afterDestroy':_0x8ba6('0x5')};function emitEvent(_0xaedb4c){return function(_0x134f9f,_0x3eca49,_0x286c22){WhatsappQueueEvents['emit'](_0xaedb4c+':'+_0x134f9f['id'],_0x134f9f);WhatsappQueueEvents['emit'](_0xaedb4c,_0x134f9f);_0x286c22(null);};}for(var e in events){if(events[_0x8ba6('0x6')](e)){var event=events[e];WhatsappQueue[_0x8ba6('0x7')](e,emitEvent(event));}}module[_0x8ba6('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 3e768ff..2a77efc 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 _0x6984=['request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','moment','bluebird'];(function(_0x2dd473,_0x2fa2ac){var _0x1253a8=function(_0x349d6f){while(--_0x349d6f){_0x2dd473['push'](_0x2dd473['shift']());}};_0x1253a8(++_0x2fa2ac);}(_0x6984,0xa4));var _0x4698=function(_0x252d50,_0xa3406d){_0x252d50=_0x252d50-0x0;var _0x2f49ac=_0x6984[_0x252d50];return _0x2f49ac;};'use strict';var _=require(_0x4698('0x0'));var util=require(_0x4698('0x1'));var logger=require(_0x4698('0x2'))('api');var moment=require(_0x4698('0x3'));var BPromise=require(_0x4698('0x4'));var rp=require(_0x4698('0x5'));var fs=require('fs');var path=require(_0x4698('0x6'));var rimraf=require(_0x4698('0x7'));var config=require(_0x4698('0x8'));var attributes=require(_0x4698('0x9'));module[_0x4698('0xa')]=function(_0x5cd1fe,_0x5eb806){return _0x5cd1fe['define'](_0x4698('0xb'),attributes,{'tableName':_0x4698('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7553=['bluebird','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','moment'];(function(_0x9a6719,_0x191f24){var _0x138184=function(_0x6fbdfd){while(--_0x6fbdfd){_0x9a6719['push'](_0x9a6719['shift']());}};_0x138184(++_0x191f24);}(_0x7553,0xef));var _0x3755=function(_0xfbc3dc,_0x3a7830){_0xfbc3dc=_0xfbc3dc-0x0;var _0x48c818=_0x7553[_0xfbc3dc];return _0x48c818;};'use strict';var _=require(_0x3755('0x0'));var util=require(_0x3755('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3755('0x2'));var BPromise=require(_0x3755('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3755('0x4'));var config=require(_0x3755('0x5'));var attributes=require(_0x3755('0x6'));module[_0x3755('0x7')]=function(_0xeaea29,_0x2c4256){return _0xeaea29[_0x3755('0x8')](_0x3755('0x9'),attributes,{'tableName':_0x3755('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index b171056..1d5db64 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 _0x92ca=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappQueue.socket','register','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','options','raw','where','attributes','limit','include','model','map','then','GetWhatsappQueue','WhatsappQueue','find','ShowWhatsappQueue','lodash','util'];(function(_0x5ce3c8,_0x2503bd){var _0xa76867=function(_0x52815e){while(--_0x52815e){_0x5ce3c8['push'](_0x5ce3c8['shift']());}};_0xa76867(++_0x2503bd);}(_0x92ca,0x1c1));var _0xa92c=function(_0x266945,_0x5c5e8c){_0x266945=_0x266945-0x0;var _0x4477d5=_0x92ca[_0x266945];return _0x4477d5;};'use strict';var _=require(_0xa92c('0x0'));var util=require(_0xa92c('0x1'));var moment=require(_0xa92c('0x2'));var BPromise=require('bluebird');var rs=require(_0xa92c('0x3'));var fs=require('fs');var Redis=require(_0xa92c('0x4'));var db=require(_0xa92c('0x5'))['db'];var utils=require(_0xa92c('0x6'));var logger=require('../../config/logger')(_0xa92c('0x7'));var config=require(_0xa92c('0x8'));var jayson=require(_0xa92c('0x9'));var client=jayson[_0xa92c('0xa')][_0xa92c('0xb')]({'port':0x232a});config[_0xa92c('0xc')]=_[_0xa92c('0xd')](config[_0xa92c('0xc')],{'host':_0xa92c('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa92c('0xf'))[_0xa92c('0x10')](socket);function respondWithRpcPromise(_0x4ff2bd,_0x76a6df,_0x2ff9b8){return new BPromise(function(_0x20c801,_0x1cffff){return client[_0xa92c('0x11')](_0x4ff2bd,_0x2ff9b8)['then'](function(_0x240e5b){logger[_0xa92c('0x12')](_0xa92c('0x13'),_0x76a6df,_0xa92c('0x14'));logger[_0xa92c('0x15')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x76a6df,_0xa92c('0x14'),JSON[_0xa92c('0x16')](_0x240e5b));if(_0x240e5b['error']){if(_0x240e5b[_0xa92c('0x17')][_0xa92c('0x18')]===0x1f4){logger[_0xa92c('0x17')](_0xa92c('0x13'),_0x76a6df,_0x240e5b[_0xa92c('0x17')]['message']);return _0x1cffff(_0x240e5b['error'][_0xa92c('0x19')]);}logger[_0xa92c('0x17')](_0xa92c('0x13'),_0x76a6df,_0x240e5b['error'][_0xa92c('0x19')]);return _0x20c801(_0x240e5b[_0xa92c('0x17')]['message']);}else{logger[_0xa92c('0x12')](_0xa92c('0x13'),_0x76a6df,_0xa92c('0x14'));_0x20c801(_0x240e5b[_0xa92c('0x1a')]['message']);}})[_0xa92c('0x1b')](function(_0x1306c0){logger[_0xa92c('0x17')](_0xa92c('0x13'),_0x76a6df,_0x1306c0);_0x1cffff(_0x1306c0);});});}exports['GetWhatsappQueue']=function(_0x2c4790){var _0x450262=this;return new Promise(function(_0x4f17cd,_0x3af25f){return db['WhatsappQueue']['findAll']({'raw':_0x2c4790[_0xa92c('0x1c')]?_0x2c4790[_0xa92c('0x1c')][_0xa92c('0x1d')]===undefined?!![]:![]:!![],'where':_0x2c4790[_0xa92c('0x1c')]?_0x2c4790['options'][_0xa92c('0x1e')]||null:null,'attributes':_0x2c4790['options']?_0x2c4790['options'][_0xa92c('0x1f')]||null:null,'limit':_0x2c4790['options']?_0x2c4790[_0xa92c('0x1c')][_0xa92c('0x20')]||null:null,'include':_0x2c4790['options']?_0x2c4790[_0xa92c('0x1c')][_0xa92c('0x21')]?_['map'](_0x2c4790['options'][_0xa92c('0x21')],function(_0x352ea3){return{'model':db[_0x352ea3[_0xa92c('0x22')]],'as':_0x352ea3['as'],'attributes':_0x352ea3[_0xa92c('0x1f')],'include':_0x352ea3['include']?_[_0xa92c('0x23')](_0x352ea3[_0xa92c('0x21')],function(_0x459b64){return{'model':db[_0x459b64[_0xa92c('0x22')]],'as':_0x459b64['as'],'attributes':_0x459b64['attributes'],'include':_0x459b64['include']?_[_0xa92c('0x23')](_0x459b64[_0xa92c('0x21')],function(_0x788979){return{'model':db[_0x788979[_0xa92c('0x22')]],'as':_0x788979['as'],'attributes':_0x788979[_0xa92c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa92c('0x24')](function(_0x4266e1){logger[_0xa92c('0x12')](_0xa92c('0x25'),_0x2c4790);logger[_0xa92c('0x15')](_0xa92c('0x25'),_0x2c4790,JSON[_0xa92c('0x16')](_0x4266e1));_0x4f17cd(_0x4266e1);})[_0xa92c('0x1b')](function(_0x317e86){logger[_0xa92c('0x17')](_0xa92c('0x25'),_0x317e86['message'],_0x2c4790);_0x3af25f(_0x450262[_0xa92c('0x17')](0x1f4,_0x317e86[_0xa92c('0x19')]));});});};exports['ShowWhatsappQueue']=function(_0x2f22e4){var _0x2a063c=this;return new Promise(function(_0x4642cb,_0x30f9a9){return db[_0xa92c('0x26')][_0xa92c('0x27')]({'raw':_0x2f22e4['options']?_0x2f22e4[_0xa92c('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x2f22e4[_0xa92c('0x1c')]?_0x2f22e4[_0xa92c('0x1c')][_0xa92c('0x1e')]||null:null,'attributes':_0x2f22e4[_0xa92c('0x1c')]?_0x2f22e4['options'][_0xa92c('0x1f')]||null:null,'include':_0x2f22e4[_0xa92c('0x1c')]?_0x2f22e4[_0xa92c('0x1c')][_0xa92c('0x21')]?_[_0xa92c('0x23')](_0x2f22e4['options'][_0xa92c('0x21')],function(_0x38ffe7){return{'model':db[_0x38ffe7[_0xa92c('0x22')]],'as':_0x38ffe7['as'],'attributes':_0x38ffe7[_0xa92c('0x1f')],'include':_0x38ffe7['include']?_['map'](_0x38ffe7[_0xa92c('0x21')],function(_0x5684e7){return{'model':db[_0x5684e7[_0xa92c('0x22')]],'as':_0x5684e7['as'],'attributes':_0x5684e7[_0xa92c('0x1f')],'include':_0x5684e7[_0xa92c('0x21')]?_[_0xa92c('0x23')](_0x5684e7[_0xa92c('0x21')],function(_0x2a5c9a){return{'model':db[_0x2a5c9a['model']],'as':_0x2a5c9a['as'],'attributes':_0x2a5c9a['attributes']};}):[]};}):[]};}):[]:[]})[_0xa92c('0x24')](function(_0x1ef6f7){logger['info'](_0xa92c('0x28'),_0x2f22e4);logger['debug']('ShowWhatsappQueue',_0x2f22e4,JSON[_0xa92c('0x16')](_0x1ef6f7));_0x4642cb(_0x1ef6f7);})[_0xa92c('0x1b')](function(_0x137a36){logger[_0xa92c('0x17')]('ShowWhatsappQueue',_0x137a36[_0xa92c('0x19')],_0x2f22e4);_0x30f9a9(_0x2a063c[_0xa92c('0x17')](0x1f4,_0x137a36[_0xa92c('0x19')]));});});}; \ No newline at end of file +var _0x4e2f=['message','result','catch','GetWhatsappQueue','WhatsappQueue','options','where','attributes','map','include','model','ShowWhatsappQueue','find','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','localhost','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1ae86b,_0x24699f){var _0x2f11a5=function(_0x1b1177){while(--_0x1b1177){_0x1ae86b['push'](_0x1ae86b['shift']());}};_0x2f11a5(++_0x24699f);}(_0x4e2f,0x148));var _0xf4e2=function(_0x5ef0fe,_0xb5967a){_0x5ef0fe=_0x5ef0fe-0x0;var _0x3a18bb=_0x4e2f[_0x5ef0fe];return _0x3a18bb;};'use strict';var _=require('lodash');var util=require(_0xf4e2('0x0'));var moment=require(_0xf4e2('0x1'));var BPromise=require('bluebird');var rs=require(_0xf4e2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4e2('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf4e2('0x4'));var config=require(_0xf4e2('0x5'));var jayson=require(_0xf4e2('0x6'));var client=jayson[_0xf4e2('0x7')]['http']({'port':0x232a});config[_0xf4e2('0x8')]=_['defaults'](config[_0xf4e2('0x8')],{'host':_0xf4e2('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf4e2('0x8')]));require(_0xf4e2('0xa'))[_0xf4e2('0xb')](socket);function respondWithRpcPromise(_0x55d89b,_0x46d7c7,_0x176321){return new BPromise(function(_0x1ec3c5,_0x443713){return client[_0xf4e2('0xc')](_0x55d89b,_0x176321)[_0xf4e2('0xd')](function(_0x3c86ec){logger[_0xf4e2('0xe')](_0xf4e2('0xf'),_0x46d7c7,_0xf4e2('0x10'));logger[_0xf4e2('0x11')](_0xf4e2('0x12'),_0x46d7c7,'request\x20sent',JSON[_0xf4e2('0x13')](_0x3c86ec));if(_0x3c86ec['error']){if(_0x3c86ec[_0xf4e2('0x14')][_0xf4e2('0x15')]===0x1f4){logger[_0xf4e2('0x14')](_0xf4e2('0xf'),_0x46d7c7,_0x3c86ec[_0xf4e2('0x14')][_0xf4e2('0x16')]);return _0x443713(_0x3c86ec[_0xf4e2('0x14')]['message']);}logger[_0xf4e2('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x46d7c7,_0x3c86ec[_0xf4e2('0x14')][_0xf4e2('0x16')]);return _0x1ec3c5(_0x3c86ec['error']['message']);}else{logger['info'](_0xf4e2('0xf'),_0x46d7c7,_0xf4e2('0x10'));_0x1ec3c5(_0x3c86ec[_0xf4e2('0x17')][_0xf4e2('0x16')]);}})[_0xf4e2('0x18')](function(_0x1650dd){logger[_0xf4e2('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x46d7c7,_0x1650dd);_0x443713(_0x1650dd);});});}exports[_0xf4e2('0x19')]=function(_0x4cb270){var _0x27a654=this;return new Promise(function(_0x351fc1,_0x36df25){return db[_0xf4e2('0x1a')]['findAll']({'raw':_0x4cb270[_0xf4e2('0x1b')]?_0x4cb270[_0xf4e2('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4cb270[_0xf4e2('0x1b')]?_0x4cb270[_0xf4e2('0x1b')][_0xf4e2('0x1c')]||null:null,'attributes':_0x4cb270[_0xf4e2('0x1b')]?_0x4cb270[_0xf4e2('0x1b')][_0xf4e2('0x1d')]||null:null,'limit':_0x4cb270[_0xf4e2('0x1b')]?_0x4cb270[_0xf4e2('0x1b')]['limit']||null:null,'include':_0x4cb270[_0xf4e2('0x1b')]?_0x4cb270[_0xf4e2('0x1b')]['include']?_[_0xf4e2('0x1e')](_0x4cb270['options'][_0xf4e2('0x1f')],function(_0x18db01){return{'model':db[_0x18db01[_0xf4e2('0x20')]],'as':_0x18db01['as'],'attributes':_0x18db01[_0xf4e2('0x1d')],'include':_0x18db01[_0xf4e2('0x1f')]?_['map'](_0x18db01[_0xf4e2('0x1f')],function(_0x27512d){return{'model':db[_0x27512d[_0xf4e2('0x20')]],'as':_0x27512d['as'],'attributes':_0x27512d['attributes'],'include':_0x27512d[_0xf4e2('0x1f')]?_[_0xf4e2('0x1e')](_0x27512d[_0xf4e2('0x1f')],function(_0xdd9cc0){return{'model':db[_0xdd9cc0[_0xf4e2('0x20')]],'as':_0xdd9cc0['as'],'attributes':_0xdd9cc0[_0xf4e2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf4e2('0xd')](function(_0x334fa9){logger[_0xf4e2('0xe')](_0xf4e2('0x19'),_0x4cb270);logger[_0xf4e2('0x11')]('GetWhatsappQueue',_0x4cb270,JSON[_0xf4e2('0x13')](_0x334fa9));_0x351fc1(_0x334fa9);})[_0xf4e2('0x18')](function(_0x56dd38){logger[_0xf4e2('0x14')]('GetWhatsappQueue',_0x56dd38[_0xf4e2('0x16')],_0x4cb270);_0x36df25(_0x27a654[_0xf4e2('0x14')](0x1f4,_0x56dd38[_0xf4e2('0x16')]));});});};exports[_0xf4e2('0x21')]=function(_0x41f0a3){var _0x24c42c=this;return new Promise(function(_0xb9831d,_0x17b6e3){return db[_0xf4e2('0x1a')][_0xf4e2('0x22')]({'raw':_0x41f0a3[_0xf4e2('0x1b')]?_0x41f0a3['options']['raw']===undefined?!![]:![]:!![],'where':_0x41f0a3[_0xf4e2('0x1b')]?_0x41f0a3[_0xf4e2('0x1b')][_0xf4e2('0x1c')]||null:null,'attributes':_0x41f0a3[_0xf4e2('0x1b')]?_0x41f0a3[_0xf4e2('0x1b')][_0xf4e2('0x1d')]||null:null,'include':_0x41f0a3[_0xf4e2('0x1b')]?_0x41f0a3[_0xf4e2('0x1b')][_0xf4e2('0x1f')]?_['map'](_0x41f0a3[_0xf4e2('0x1b')][_0xf4e2('0x1f')],function(_0x22672b){return{'model':db[_0x22672b[_0xf4e2('0x20')]],'as':_0x22672b['as'],'attributes':_0x22672b[_0xf4e2('0x1d')],'include':_0x22672b[_0xf4e2('0x1f')]?_[_0xf4e2('0x1e')](_0x22672b[_0xf4e2('0x1f')],function(_0x4d9a96){return{'model':db[_0x4d9a96[_0xf4e2('0x20')]],'as':_0x4d9a96['as'],'attributes':_0x4d9a96[_0xf4e2('0x1d')],'include':_0x4d9a96[_0xf4e2('0x1f')]?_[_0xf4e2('0x1e')](_0x4d9a96[_0xf4e2('0x1f')],function(_0x2d85a8){return{'model':db[_0x2d85a8[_0xf4e2('0x20')]],'as':_0x2d85a8['as'],'attributes':_0x2d85a8[_0xf4e2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf4e2('0xd')](function(_0x5f0314){logger[_0xf4e2('0xe')](_0xf4e2('0x21'),_0x41f0a3);logger[_0xf4e2('0x11')](_0xf4e2('0x21'),_0x41f0a3,JSON[_0xf4e2('0x13')](_0x5f0314));_0xb9831d(_0x5f0314);})[_0xf4e2('0x18')](function(_0x1dd215){logger['error'](_0xf4e2('0x21'),_0x1dd215[_0xf4e2('0x16')],_0x41f0a3);_0x17b6e3(_0x24c42c[_0xf4e2('0x14')](0x1f4,_0x1dd215[_0xf4e2('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 8f93fb6..d2d54c0 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 _0xe0b4=['length','whatsappQueue:','./whatsappQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x366fbb,_0xef9453){var _0x298c53=function(_0x20d9b6){while(--_0x20d9b6){_0x366fbb['push'](_0x366fbb['shift']());}};_0x298c53(++_0xef9453);}(_0xe0b4,0x12b));var _0x4e0b=function(_0x53d279,_0x324982){_0x53d279=_0x53d279-0x0;var _0x3a1ba4=_0xe0b4[_0x53d279];return _0x3a1ba4;};'use strict';var WhatsappQueueEvents=require(_0x4e0b('0x0'));var events=[_0x4e0b('0x1'),_0x4e0b('0x2'),_0x4e0b('0x3')];function createListener(_0x5d5023,_0x242373){return function(_0x314381){_0x242373[_0x4e0b('0x4')](_0x5d5023,_0x314381);};}function removeListener(_0x1b4f46,_0x4bb757){return function(){WhatsappQueueEvents[_0x4e0b('0x5')](_0x1b4f46,_0x4bb757);};}exports[_0x4e0b('0x6')]=function(_0xd44a37){for(var _0x22e210=0x0,_0x425475=events[_0x4e0b('0x7')];_0x22e210<_0x425475;_0x22e210++){var _0x377080=events[_0x22e210];var _0x5f3ab2=createListener(_0x4e0b('0x8')+_0x377080,_0xd44a37);WhatsappQueueEvents['on'](_0x377080,_0x5f3ab2);}}; \ No newline at end of file +var _0x4b20=['whatsappQueue:','./whatsappQueue.events','remove','emit','register'];(function(_0x45f095,_0x2b24b7){var _0x1f7365=function(_0x1343af){while(--_0x1343af){_0x45f095['push'](_0x45f095['shift']());}};_0x1f7365(++_0x2b24b7);}(_0x4b20,0x1c8));var _0x04b2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4b20[_0x14add3];return _0x4a174f;};'use strict';var WhatsappQueueEvents=require(_0x04b2('0x0'));var events=['save',_0x04b2('0x1'),'update'];function createListener(_0x10ec8e,_0x1317a8){return function(_0xced91c){_0x1317a8[_0x04b2('0x2')](_0x10ec8e,_0xced91c);};}function removeListener(_0x2a9853,_0x1fb5df){return function(){WhatsappQueueEvents['removeListener'](_0x2a9853,_0x1fb5df);};}exports[_0x04b2('0x3')]=function(_0x481c71){for(var _0x5d2caa=0x0,_0x43150e=events['length'];_0x5d2caa<_0x43150e;_0x5d2caa++){var _0x2797bb=events[_0x5d2caa];var _0x12a81e=createListener(_0x04b2('0x4')+_0x2797bb,_0x481c71);WhatsappQueueEvents['on'](_0x2797bb,_0x12a81e);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 6c5ddf4..0e6bea4 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 _0x07fc=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','index','get','/describe','/:id','show','post','create','put','update','exports','multer','util'];(function(_0x5ce3c8,_0x2503bd){var _0xa76867=function(_0x52815e){while(--_0x52815e){_0x5ce3c8['push'](_0x5ce3c8['shift']());}};_0xa76867(++_0x2503bd);}(_0x07fc,0x163));var _0xc07f=function(_0x3cc77d,_0xcdb0c6){_0x3cc77d=_0x3cc77d-0x0;var _0x5c73b1=_0x07fc[_0x3cc77d];return _0x5c73b1;};'use strict';var multer=require(_0xc07f('0x0'));var util=require(_0xc07f('0x1'));var path=require(_0xc07f('0x2'));var timeout=require('connect-timeout');var express=require(_0xc07f('0x3'));var router=express[_0xc07f('0x4')]();var fs_extra=require(_0xc07f('0x5'));var auth=require(_0xc07f('0x6'));var interaction=require(_0xc07f('0x7'));var config=require(_0xc07f('0x8'));var controller=require(_0xc07f('0x9'));router['get']('/',auth[_0xc07f('0xa')](),controller[_0xc07f('0xb')]);router[_0xc07f('0xc')](_0xc07f('0xd'),auth[_0xc07f('0xa')](),controller['describe']);router[_0xc07f('0xc')](_0xc07f('0xe'),auth[_0xc07f('0xa')](),controller[_0xc07f('0xf')]);router[_0xc07f('0x10')]('/',auth[_0xc07f('0xa')](),controller[_0xc07f('0x11')]);router[_0xc07f('0x12')]('/:id',auth[_0xc07f('0xa')](),controller[_0xc07f('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xc07f('0x14')]=router; \ No newline at end of file +var _0x3c51=['./whatsappQueueReport.controller','isAuthenticated','index','get','/:id','post','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1c86c7,_0x508992){var _0x3e1a9a=function(_0xa843cc){while(--_0xa843cc){_0x1c86c7['push'](_0x1c86c7['shift']());}};_0x3e1a9a(++_0x508992);}(_0x3c51,0x109));var _0x13c5=function(_0x27737f,_0x41a746){_0x27737f=_0x27737f-0x0;var _0x36c322=_0x3c51[_0x27737f];return _0x36c322;};'use strict';var multer=require(_0x13c5('0x0'));var util=require(_0x13c5('0x1'));var path=require(_0x13c5('0x2'));var timeout=require('connect-timeout');var express=require(_0x13c5('0x3'));var router=express[_0x13c5('0x4')]();var fs_extra=require(_0x13c5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x13c5('0x6'));var config=require('../../config/environment');var controller=require(_0x13c5('0x7'));router['get']('/',auth[_0x13c5('0x8')](),controller[_0x13c5('0x9')]);router[_0x13c5('0xa')]('/describe',auth[_0x13c5('0x8')](),controller['describe']);router[_0x13c5('0xa')](_0x13c5('0xb'),auth[_0x13c5('0x8')](),controller['show']);router[_0x13c5('0xc')]('/',auth[_0x13c5('0x8')](),controller['create']);router['put'](_0x13c5('0xb'),auth['isAuthenticated'](),controller[_0x13c5('0xd')]);router['delete']('/:id',auth[_0x13c5('0x8')](),controller[_0x13c5('0xe')]);module[_0x13c5('0xf')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 0d7e5df..8cb422b 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x5d8611,_0x3e8fee){var _0x5e116b=function(_0x234121){while(--_0x234121){_0x5d8611['push'](_0x5d8611['shift']());}};_0x5e116b(++_0x3e8fee);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x8f82df,_0x4ad0e9){var _0x19212a=function(_0xa30958){while(--_0xa30958){_0x8f82df['push'](_0x8f82df['shift']());}};_0x19212a(++_0x4ad0e9);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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 d18dd34..428e1d4 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 _0x1339=['../../config/license/util','status','json','undefined','limit','offset','Content-Range','then','destroy','end','sendStatus','error','name','send','index','map','WhatsappQueueReport','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','create','body','update','params','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x8d618c,_0x95c2e){var _0x265013=function(_0x51d693){while(--_0x51d693){_0x8d618c['push'](_0x8d618c['shift']());}};_0x265013(++_0x95c2e);}(_0x1339,0x1ed));var _0x9133=function(_0x2037a7,_0x21857e){_0x2037a7=_0x2037a7-0x0;var _0x2f200=_0x1339[_0x2037a7];return _0x2f200;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9133('0x0'));var jsonpatch=require(_0x9133('0x1'));var rp=require(_0x9133('0x2'));var moment=require(_0x9133('0x3'));var BPromise=require(_0x9133('0x4'));var Mustache=require(_0x9133('0x5'));var util=require(_0x9133('0x6'));var path=require(_0x9133('0x7'));var sox=require('sox');var csv=require(_0x9133('0x8'));var ejs=require(_0x9133('0x9'));var fs=require('fs');var fs_extra=require(_0x9133('0xa'));var _=require('lodash');var squel=require(_0x9133('0xb'));var crypto=require(_0x9133('0xc'));var jsforce=require(_0x9133('0xd'));var deskjs=require(_0x9133('0xe'));var toCsv=require(_0x9133('0x8'));var querystring=require(_0x9133('0xf'));var Papa=require(_0x9133('0x10'));var Redis=require(_0x9133('0x11'));var authService=require(_0x9133('0x12'));var qs=require(_0x9133('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9133('0x14'));var logger=require(_0x9133('0x15'))(_0x9133('0x16'));var utils=require(_0x9133('0x17'));var config=require(_0x9133('0x18'));var licenseUtil=require(_0x9133('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb64550,_0x7cc59e){_0x7cc59e=_0x7cc59e||0xcc;return function(_0x4bbfdc){if(_0x4bbfdc){return _0xb64550['sendStatus'](_0x7cc59e);}return _0xb64550[_0x9133('0x1a')](_0x7cc59e)['end']();};}function respondWithResult(_0x22132a,_0x439e1a){_0x439e1a=_0x439e1a||0xc8;return function(_0x17dfd1){if(_0x17dfd1){return _0x22132a[_0x9133('0x1a')](_0x439e1a)[_0x9133('0x1b')](_0x17dfd1);}};}function respondWithFilteredResult(_0x4327b3,_0x49cc5d){return function(_0x13f8fc){if(_0x13f8fc){var _0x1e23ce=typeof _0x49cc5d['offset']===_0x9133('0x1c')&&typeof _0x49cc5d[_0x9133('0x1d')]===_0x9133('0x1c');var _0x427663=_0x13f8fc['count'];var _0x1f3484=_0x1e23ce?0x0:_0x49cc5d['offset'];var _0x3c48ef=_0x1e23ce?_0x13f8fc['count']:_0x49cc5d[_0x9133('0x1e')]+_0x49cc5d[_0x9133('0x1d')];var _0x5e8620;if(_0x3c48ef>=_0x427663){_0x3c48ef=_0x427663;_0x5e8620=0xc8;}else{_0x5e8620=0xce;}_0x4327b3[_0x9133('0x1a')](_0x5e8620);return _0x4327b3['set'](_0x9133('0x1f'),_0x1f3484+'-'+_0x3c48ef+'/'+_0x427663)['json'](_0x13f8fc);}return null;};}function patchUpdates(_0x5e4f0c){return function(_0x2f7354){try{jsonpatch['apply'](_0x2f7354,_0x5e4f0c,!![]);}catch(_0x12c2d4){return BPromise['reject'](_0x12c2d4);}return _0x2f7354['save']();};}function saveUpdates(_0x4c846e,_0x2e99a1){return function(_0x2dcfb8){if(_0x2dcfb8){return _0x2dcfb8['update'](_0x4c846e)[_0x9133('0x20')](function(_0x3f5d0e){return _0x3f5d0e;});}return null;};}function removeEntity(_0xff08d5,_0x26190c){return function(_0x4f26e8){if(_0x4f26e8){return _0x4f26e8[_0x9133('0x21')]()['then'](function(){_0xff08d5[_0x9133('0x1a')](0xcc)[_0x9133('0x22')]();});}};}function handleEntityNotFound(_0x3f278d,_0x14c1cb){return function(_0x4483ef){if(!_0x4483ef){_0x3f278d[_0x9133('0x23')](0x194);}return _0x4483ef;};}function handleError(_0x294332,_0x313d43){_0x313d43=_0x313d43||0x1f4;return function(_0x1b6b3e){logger[_0x9133('0x24')](_0x1b6b3e['stack']);if(_0x1b6b3e['name']){delete _0x1b6b3e[_0x9133('0x25')];}_0x294332[_0x9133('0x1a')](_0x313d43)[_0x9133('0x26')](_0x1b6b3e);};}exports[_0x9133('0x27')]=function(_0x4de894,_0x4ecd9e){var _0x3e2404={},_0x45966d={},_0x188c49={'count':0x0,'rows':[]};var _0x26d351=_[_0x9133('0x28')](db[_0x9133('0x29')]['rawAttributes'],function(_0x58afe0){return{'name':_0x58afe0['fieldName'],'type':_0x58afe0[_0x9133('0x2a')]['key']};});_0x45966d[_0x9133('0x2b')]=_[_0x9133('0x28')](_0x26d351,'name');_0x45966d[_0x9133('0x2c')]=_['keys'](_0x4de894[_0x9133('0x2c')]);_0x45966d[_0x9133('0x2d')]=_[_0x9133('0x2e')](_0x45966d['model'],_0x45966d[_0x9133('0x2c')]);_0x3e2404[_0x9133('0x2f')]=_[_0x9133('0x2e')](_0x45966d['model'],qs[_0x9133('0x30')](_0x4de894[_0x9133('0x2c')][_0x9133('0x30')]));_0x3e2404['attributes']=_0x3e2404[_0x9133('0x2f')][_0x9133('0x31')]?_0x3e2404[_0x9133('0x2f')]:_0x45966d[_0x9133('0x2b')];if(!_0x4de894['query'][_0x9133('0x32')](_0x9133('0x33'))){_0x3e2404['limit']=qs[_0x9133('0x1d')](_0x4de894[_0x9133('0x2c')][_0x9133('0x1d')]);_0x3e2404[_0x9133('0x1e')]=qs[_0x9133('0x1e')](_0x4de894[_0x9133('0x2c')][_0x9133('0x1e')]);}_0x3e2404[_0x9133('0x34')]=qs[_0x9133('0x35')](_0x4de894[_0x9133('0x2c')][_0x9133('0x35')]);_0x3e2404['where']=qs[_0x9133('0x2d')](_[_0x9133('0x36')](_0x4de894['query'],_0x45966d[_0x9133('0x2d')]),_0x26d351);if(_0x4de894[_0x9133('0x2c')][_0x9133('0x37')]){_0x3e2404[_0x9133('0x38')]=_[_0x9133('0x39')](_0x3e2404[_0x9133('0x38')],{'$or':_['map'](_0x26d351,function(_0x4e16d2){if(_0x4e16d2[_0x9133('0x2a')]!==_0x9133('0x3a')){var _0x156905={};_0x156905[_0x4e16d2[_0x9133('0x25')]]={'$like':'%'+_0x4de894[_0x9133('0x2c')][_0x9133('0x37')]+'%'};return _0x156905;}})});}_0x3e2404=_[_0x9133('0x39')]({},_0x3e2404,_0x4de894[_0x9133('0x3b')]);var _0x720048={'where':_0x3e2404['where']};return db[_0x9133('0x29')][_0x9133('0x3c')](_0x720048)[_0x9133('0x20')](function(_0x199ae9){_0x188c49[_0x9133('0x3c')]=_0x199ae9;if(_0x4de894['query'][_0x9133('0x3d')]){_0x3e2404[_0x9133('0x3e')]=[{'all':!![]}];}return db[_0x9133('0x29')][_0x9133('0x3f')](_0x3e2404);})['then'](function(_0x146734){_0x188c49[_0x9133('0x40')]=_0x146734;return _0x188c49;})[_0x9133('0x20')](respondWithFilteredResult(_0x4ecd9e,_0x3e2404))[_0x9133('0x41')](handleError(_0x4ecd9e,null));};exports[_0x9133('0x42')]=function(_0x338049,_0x3b2287){var _0x4ca1a3={'raw':!![],'where':{'id':_0x338049['params']['id']}},_0x7f6cd9={};_0x7f6cd9['model']=_[_0x9133('0x43')](db[_0x9133('0x29')][_0x9133('0x44')]);_0x7f6cd9[_0x9133('0x2c')]=_[_0x9133('0x43')](_0x338049[_0x9133('0x2c')]);_0x7f6cd9[_0x9133('0x2d')]=_[_0x9133('0x2e')](_0x7f6cd9[_0x9133('0x2b')],_0x7f6cd9['query']);_0x4ca1a3[_0x9133('0x2f')]=_[_0x9133('0x2e')](_0x7f6cd9[_0x9133('0x2b')],qs['fields'](_0x338049['query'][_0x9133('0x30')]));_0x4ca1a3[_0x9133('0x2f')]=_0x4ca1a3['attributes'][_0x9133('0x31')]?_0x4ca1a3[_0x9133('0x2f')]:_0x7f6cd9[_0x9133('0x2b')];if(_0x338049[_0x9133('0x2c')][_0x9133('0x3d')]){_0x4ca1a3['include']=[{'all':!![]}];}_0x4ca1a3=_[_0x9133('0x39')]({},_0x4ca1a3,_0x338049[_0x9133('0x3b')]);return db[_0x9133('0x29')]['find'](_0x4ca1a3)[_0x9133('0x20')](handleEntityNotFound(_0x3b2287,null))[_0x9133('0x20')](respondWithResult(_0x3b2287,null))['catch'](handleError(_0x3b2287,null));};exports['create']=function(_0x42c188,_0x2cd935){return db[_0x9133('0x29')][_0x9133('0x45')](_0x42c188[_0x9133('0x46')],{})[_0x9133('0x20')](respondWithResult(_0x2cd935,0xc9))[_0x9133('0x41')](handleError(_0x2cd935,null));};exports[_0x9133('0x47')]=function(_0x23f134,_0xf07fbb){if(_0x23f134[_0x9133('0x46')]['id']){delete _0x23f134[_0x9133('0x46')]['id'];}return db['WhatsappQueueReport']['find']({'where':{'id':_0x23f134[_0x9133('0x48')]['id']}})['then'](handleEntityNotFound(_0xf07fbb,null))[_0x9133('0x20')](saveUpdates(_0x23f134[_0x9133('0x46')],null))[_0x9133('0x20')](respondWithResult(_0xf07fbb,null))[_0x9133('0x41')](handleError(_0xf07fbb,null));};exports['destroy']=function(_0x2a3848,_0x25750f){return db[_0x9133('0x29')]['find']({'where':{'id':_0x2a3848[_0x9133('0x48')]['id']}})[_0x9133('0x20')](handleEntityNotFound(_0x25750f,null))[_0x9133('0x20')](removeEntity(_0x25750f,null))['catch'](handleError(_0x25750f,null));};exports[_0x9133('0x49')]=function(_0x4f7b1e,_0x2342f4){return db[_0x9133('0x29')][_0x9133('0x49')]()[_0x9133('0x20')](respondWithResult(_0x2342f4,null))['catch'](handleError(_0x2342f4,null));}; \ No newline at end of file +var _0x58a4=['key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','rawAttributes','include','create','body','update','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','sendStatus','error','name','index','map','WhatsappQueueReport','fieldName'];(function(_0x223bdb,_0x5882e6){var _0xef8e68=function(_0x55ab83){while(--_0x55ab83){_0x223bdb['push'](_0x223bdb['shift']());}};_0xef8e68(++_0x5882e6);}(_0x58a4,0xbf));var _0x458a=function(_0x49253a,_0x4883d1){_0x49253a=_0x49253a-0x0;var _0x471008=_0x58a4[_0x49253a];return _0x471008;};'use strict';var emlformat=require(_0x458a('0x0'));var rimraf=require(_0x458a('0x1'));var zipdir=require(_0x458a('0x2'));var jsonpatch=require(_0x458a('0x3'));var rp=require(_0x458a('0x4'));var moment=require(_0x458a('0x5'));var BPromise=require(_0x458a('0x6'));var Mustache=require(_0x458a('0x7'));var util=require(_0x458a('0x8'));var path=require(_0x458a('0x9'));var sox=require(_0x458a('0xa'));var csv=require(_0x458a('0xb'));var ejs=require(_0x458a('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x458a('0xd'));var crypto=require(_0x458a('0xe'));var jsforce=require(_0x458a('0xf'));var deskjs=require(_0x458a('0x10'));var toCsv=require(_0x458a('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x458a('0x11'));var authService=require(_0x458a('0x12'));var qs=require(_0x458a('0x13'));var as=require(_0x458a('0x14'));var hardwareService=require(_0x458a('0x15'));var logger=require('../../config/logger')(_0x458a('0x16'));var utils=require(_0x458a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x458a('0x18'));var db=require(_0x458a('0x19'))['db'];function respondWithStatusCode(_0xee09c6,_0x2a4934){_0x2a4934=_0x2a4934||0xcc;return function(_0x2e788b){if(_0x2e788b){return _0xee09c6['sendStatus'](_0x2a4934);}return _0xee09c6['status'](_0x2a4934)[_0x458a('0x1a')]();};}function respondWithResult(_0x56436f,_0x2c7528){_0x2c7528=_0x2c7528||0xc8;return function(_0x44f683){if(_0x44f683){return _0x56436f[_0x458a('0x1b')](_0x2c7528)[_0x458a('0x1c')](_0x44f683);}};}function respondWithFilteredResult(_0xad80f9,_0x29acee){return function(_0x507b0f){if(_0x507b0f){var _0x4b26be=typeof _0x29acee['offset']===_0x458a('0x1d')&&typeof _0x29acee[_0x458a('0x1e')]===_0x458a('0x1d');var _0x5c5b41=_0x507b0f[_0x458a('0x1f')];var _0x260c87=_0x4b26be?0x0:_0x29acee[_0x458a('0x20')];var _0x392986=_0x4b26be?_0x507b0f[_0x458a('0x1f')]:_0x29acee['offset']+_0x29acee['limit'];var _0x178db9;if(_0x392986>=_0x5c5b41){_0x392986=_0x5c5b41;_0x178db9=0xc8;}else{_0x178db9=0xce;}_0xad80f9['status'](_0x178db9);return _0xad80f9[_0x458a('0x21')](_0x458a('0x22'),_0x260c87+'-'+_0x392986+'/'+_0x5c5b41)['json'](_0x507b0f);}return null;};}function patchUpdates(_0x468416){return function(_0x55a588){try{jsonpatch[_0x458a('0x23')](_0x55a588,_0x468416,!![]);}catch(_0x1c79cb){return BPromise['reject'](_0x1c79cb);}return _0x55a588[_0x458a('0x24')]();};}function saveUpdates(_0xead884,_0x5a2bcb){return function(_0xa6b8ff){if(_0xa6b8ff){return _0xa6b8ff['update'](_0xead884)[_0x458a('0x25')](function(_0x5bca42){return _0x5bca42;});}return null;};}function removeEntity(_0x4080fc,_0x5dfc6c){return function(_0x36b08e){if(_0x36b08e){return _0x36b08e[_0x458a('0x26')]()[_0x458a('0x25')](function(){_0x4080fc[_0x458a('0x1b')](0xcc)[_0x458a('0x1a')]();});}};}function handleEntityNotFound(_0x19bd5,_0x340375){return function(_0x3012c7){if(!_0x3012c7){_0x19bd5[_0x458a('0x27')](0x194);}return _0x3012c7;};}function handleError(_0xfc6b24,_0x52efed){_0x52efed=_0x52efed||0x1f4;return function(_0x327fcb){logger[_0x458a('0x28')](_0x327fcb['stack']);if(_0x327fcb[_0x458a('0x29')]){delete _0x327fcb[_0x458a('0x29')];}_0xfc6b24['status'](_0x52efed)['send'](_0x327fcb);};}exports[_0x458a('0x2a')]=function(_0x596fe2,_0x33c5d8){var _0x29f9b5={},_0x223f73={},_0x4a49e4={'count':0x0,'rows':[]};var _0xa6fdf=_[_0x458a('0x2b')](db[_0x458a('0x2c')]['rawAttributes'],function(_0x47e20d){return{'name':_0x47e20d[_0x458a('0x2d')],'type':_0x47e20d['type'][_0x458a('0x2e')]};});_0x223f73['model']=_[_0x458a('0x2b')](_0xa6fdf,_0x458a('0x29'));_0x223f73['query']=_[_0x458a('0x2f')](_0x596fe2[_0x458a('0x30')]);_0x223f73[_0x458a('0x31')]=_['intersection'](_0x223f73[_0x458a('0x32')],_0x223f73[_0x458a('0x30')]);_0x29f9b5[_0x458a('0x33')]=_[_0x458a('0x34')](_0x223f73[_0x458a('0x32')],qs['fields'](_0x596fe2[_0x458a('0x30')][_0x458a('0x35')]));_0x29f9b5[_0x458a('0x33')]=_0x29f9b5[_0x458a('0x33')][_0x458a('0x36')]?_0x29f9b5[_0x458a('0x33')]:_0x223f73['model'];if(!_0x596fe2[_0x458a('0x30')][_0x458a('0x37')](_0x458a('0x38'))){_0x29f9b5[_0x458a('0x1e')]=qs[_0x458a('0x1e')](_0x596fe2[_0x458a('0x30')][_0x458a('0x1e')]);_0x29f9b5[_0x458a('0x20')]=qs[_0x458a('0x20')](_0x596fe2['query'][_0x458a('0x20')]);}_0x29f9b5[_0x458a('0x39')]=qs[_0x458a('0x3a')](_0x596fe2[_0x458a('0x30')][_0x458a('0x3a')]);_0x29f9b5[_0x458a('0x3b')]=qs[_0x458a('0x31')](_[_0x458a('0x3c')](_0x596fe2[_0x458a('0x30')],_0x223f73[_0x458a('0x31')]),_0xa6fdf);if(_0x596fe2[_0x458a('0x30')][_0x458a('0x3d')]){_0x29f9b5[_0x458a('0x3b')]=_[_0x458a('0x3e')](_0x29f9b5[_0x458a('0x3b')],{'$or':_['map'](_0xa6fdf,function(_0x226cf0){if(_0x226cf0[_0x458a('0x3f')]!==_0x458a('0x40')){var _0x12dad4={};_0x12dad4[_0x226cf0[_0x458a('0x29')]]={'$like':'%'+_0x596fe2[_0x458a('0x30')][_0x458a('0x3d')]+'%'};return _0x12dad4;}})});}_0x29f9b5=_[_0x458a('0x3e')]({},_0x29f9b5,_0x596fe2[_0x458a('0x41')]);var _0x44c5ba={'where':_0x29f9b5[_0x458a('0x3b')]};return db['WhatsappQueueReport'][_0x458a('0x1f')](_0x44c5ba)[_0x458a('0x25')](function(_0x5da57a){_0x4a49e4[_0x458a('0x1f')]=_0x5da57a;if(_0x596fe2[_0x458a('0x30')][_0x458a('0x42')]){_0x29f9b5['include']=[{'all':!![]}];}return db[_0x458a('0x2c')][_0x458a('0x43')](_0x29f9b5);})[_0x458a('0x25')](function(_0x1e51d2){_0x4a49e4[_0x458a('0x44')]=_0x1e51d2;return _0x4a49e4;})[_0x458a('0x25')](respondWithFilteredResult(_0x33c5d8,_0x29f9b5))[_0x458a('0x45')](handleError(_0x33c5d8,null));};exports[_0x458a('0x46')]=function(_0x5883ab,_0x296385){var _0x145e3c={'raw':!![],'where':{'id':_0x5883ab['params']['id']}},_0x2b9030={};_0x2b9030[_0x458a('0x32')]=_[_0x458a('0x2f')](db['WhatsappQueueReport'][_0x458a('0x47')]);_0x2b9030[_0x458a('0x30')]=_[_0x458a('0x2f')](_0x5883ab[_0x458a('0x30')]);_0x2b9030[_0x458a('0x31')]=_['intersection'](_0x2b9030['model'],_0x2b9030[_0x458a('0x30')]);_0x145e3c[_0x458a('0x33')]=_[_0x458a('0x34')](_0x2b9030[_0x458a('0x32')],qs['fields'](_0x5883ab[_0x458a('0x30')][_0x458a('0x35')]));_0x145e3c['attributes']=_0x145e3c[_0x458a('0x33')]['length']?_0x145e3c[_0x458a('0x33')]:_0x2b9030[_0x458a('0x32')];if(_0x5883ab[_0x458a('0x30')]['includeAll']){_0x145e3c[_0x458a('0x48')]=[{'all':!![]}];}_0x145e3c=_[_0x458a('0x3e')]({},_0x145e3c,_0x5883ab[_0x458a('0x41')]);return db['WhatsappQueueReport']['find'](_0x145e3c)[_0x458a('0x25')](handleEntityNotFound(_0x296385,null))[_0x458a('0x25')](respondWithResult(_0x296385,null))[_0x458a('0x45')](handleError(_0x296385,null));};exports['create']=function(_0x5e7a64,_0x3a7005){return db[_0x458a('0x2c')][_0x458a('0x49')](_0x5e7a64[_0x458a('0x4a')],{})[_0x458a('0x25')](respondWithResult(_0x3a7005,0xc9))[_0x458a('0x45')](handleError(_0x3a7005,null));};exports[_0x458a('0x4b')]=function(_0x30cdaf,_0xb22232){if(_0x30cdaf[_0x458a('0x4a')]['id']){delete _0x30cdaf[_0x458a('0x4a')]['id'];}return db[_0x458a('0x2c')][_0x458a('0x4c')]({'where':{'id':_0x30cdaf[_0x458a('0x4d')]['id']}})[_0x458a('0x25')](handleEntityNotFound(_0xb22232,null))[_0x458a('0x25')](saveUpdates(_0x30cdaf['body'],null))[_0x458a('0x25')](respondWithResult(_0xb22232,null))[_0x458a('0x45')](handleError(_0xb22232,null));};exports[_0x458a('0x26')]=function(_0x396bb3,_0x44670a){return db['WhatsappQueueReport']['find']({'where':{'id':_0x396bb3['params']['id']}})[_0x458a('0x25')](handleEntityNotFound(_0x44670a,null))['then'](removeEntity(_0x44670a,null))[_0x458a('0x45')](handleError(_0x44670a,null));};exports[_0x458a('0x4e')]=function(_0x2a35a9,_0x649553){return db[_0x458a('0x2c')]['describe']()['then'](respondWithResult(_0x649553,null))[_0x458a('0x45')](handleError(_0x649553,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 0d90cb9..ed06383 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 _0xfb98=['../../config/logger','api','request-promise','path','rimraf','exports','define','uniqueid','lodash'];(function(_0x3f7101,_0x3af08b){var _0x1a30a0=function(_0x750e5b){while(--_0x750e5b){_0x3f7101['push'](_0x3f7101['shift']());}};_0x1a30a0(++_0x3af08b);}(_0xfb98,0x131));var _0x8fb9=function(_0x4d366e,_0x1d24b1){_0x4d366e=_0x4d366e-0x0;var _0x3a3f6d=_0xfb98[_0x4d366e];return _0x3a3f6d;};'use strict';var _=require(_0x8fb9('0x0'));var util=require('util');var logger=require(_0x8fb9('0x1'))(_0x8fb9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8fb9('0x3'));var fs=require('fs');var path=require(_0x8fb9('0x4'));var rimraf=require(_0x8fb9('0x5'));var config=require('../../config/environment');var attributes=require('./whatsappQueueReport.attributes');module[_0x8fb9('0x6')]=function(_0x3031e6,_0x14472f){return _0x3031e6[_0x8fb9('0x7')]('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x8fb9('0x8'),'fields':[_0x8fb9('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x41a5=['util','../../config/logger','api','moment','bluebird','request-promise','path','./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x41a5,0xe9));var _0x541a=function(_0x400a49,_0x1cf98a){_0x400a49=_0x400a49-0x0;var _0x302ce4=_0x41a5[_0x400a49];return _0x302ce4;};'use strict';var _=require(_0x541a('0x0'));var util=require(_0x541a('0x1'));var logger=require(_0x541a('0x2'))(_0x541a('0x3'));var moment=require(_0x541a('0x4'));var BPromise=require(_0x541a('0x5'));var rp=require(_0x541a('0x6'));var fs=require('fs');var path=require(_0x541a('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x541a('0x8'));module['exports']=function(_0x1a5ba4,_0x578931){return _0x1a5ba4[_0x541a('0x9')](_0x541a('0xa'),attributes,{'tableName':_0x541a('0xb'),'paranoid':![],'indexes':[{'name':_0x541a('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 9c5a50a..738fe06 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 _0xc064=['client','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','WhatsappQueueReport','create','body','options','raw','stringify','CreateWhatsappQueueReport','update','where','attributes','limit','UpdateWhatsappQueueReport','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4b03d6,_0x255bb0){var _0xb8c45c=function(_0x5bafc8){while(--_0x5bafc8){_0x4b03d6['push'](_0x4b03d6['shift']());}};_0xb8c45c(++_0x255bb0);}(_0xc064,0x173));var _0x4c06=function(_0x257437,_0x2f7d20){_0x257437=_0x257437-0x0;var _0xee1edf=_0xc064[_0x257437];return _0xee1edf;};'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('ioredis');var db=require(_0x4c06('0x0'))['db'];var utils=require(_0x4c06('0x1'));var logger=require(_0x4c06('0x2'))(_0x4c06('0x3'));var config=require(_0x4c06('0x4'));var jayson=require(_0x4c06('0x5'));var client=jayson[_0x4c06('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d0d1a,_0x3d36de,_0x4d357c){return new BPromise(function(_0x1fd60f,_0xa49a0e){return client['request'](_0x3d0d1a,_0x4d357c)[_0x4c06('0x7')](function(_0x2abe08){logger[_0x4c06('0x8')](_0x4c06('0x9'),_0x3d36de,_0x4c06('0xa'));logger[_0x4c06('0xb')](_0x4c06('0xc'),_0x3d36de,'request\x20sent',JSON['stringify'](_0x2abe08));if(_0x2abe08[_0x4c06('0xd')]){if(_0x2abe08[_0x4c06('0xd')][_0x4c06('0xe')]===0x1f4){logger[_0x4c06('0xd')](_0x4c06('0x9'),_0x3d36de,_0x2abe08[_0x4c06('0xd')][_0x4c06('0xf')]);return _0xa49a0e(_0x2abe08['error'][_0x4c06('0xf')]);}logger[_0x4c06('0xd')](_0x4c06('0x9'),_0x3d36de,_0x2abe08[_0x4c06('0xd')][_0x4c06('0xf')]);return _0x1fd60f(_0x2abe08[_0x4c06('0xd')][_0x4c06('0xf')]);}else{logger[_0x4c06('0x8')](_0x4c06('0x9'),_0x3d36de,'request\x20sent');_0x1fd60f(_0x2abe08['result']['message']);}})[_0x4c06('0x10')](function(_0x5e01cb){logger[_0x4c06('0xd')](_0x4c06('0x9'),_0x3d36de,_0x5e01cb);_0xa49a0e(_0x5e01cb);});});}exports['CreateWhatsappQueueReport']=function(_0x488922){var _0x546096=this;return new Promise(function(_0x2f95b8,_0x51a3ac){return db[_0x4c06('0x11')][_0x4c06('0x12')](_0x488922[_0x4c06('0x13')],{'raw':_0x488922[_0x4c06('0x14')]?_0x488922[_0x4c06('0x14')][_0x4c06('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x567118){logger[_0x4c06('0x8')]('CreateWhatsappQueueReport',_0x488922);logger[_0x4c06('0xb')]('CreateWhatsappQueueReport',_0x488922,JSON[_0x4c06('0x16')](_0x567118));_0x2f95b8(_0x567118);})[_0x4c06('0x10')](function(_0x42c90d){logger[_0x4c06('0xd')](_0x4c06('0x17'),_0x42c90d[_0x4c06('0xf')],_0x488922);_0x51a3ac(_0x546096[_0x4c06('0xd')](0x1f4,_0x42c90d[_0x4c06('0xf')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x2b651a){var _0x2d4710=this;return new Promise(function(_0x46444c,_0x227f0b){return db[_0x4c06('0x11')][_0x4c06('0x18')](_0x2b651a['body'],{'raw':_0x2b651a['options']?_0x2b651a['options'][_0x4c06('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b651a[_0x4c06('0x14')]?_0x2b651a[_0x4c06('0x14')][_0x4c06('0x19')]||null:null,'attributes':_0x2b651a['options']?_0x2b651a[_0x4c06('0x14')][_0x4c06('0x1a')]||null:null,'limit':_0x2b651a[_0x4c06('0x14')]?_0x2b651a['options'][_0x4c06('0x1b')]||null:null})[_0x4c06('0x7')](function(_0xc1811b){logger[_0x4c06('0x8')]('UpdateWhatsappQueueReport',_0x2b651a);logger['debug'](_0x4c06('0x1c'),_0x2b651a,JSON[_0x4c06('0x16')](_0xc1811b));_0x46444c(_0xc1811b);})[_0x4c06('0x10')](function(_0x2204e6){logger[_0x4c06('0xd')](_0x4c06('0x1c'),_0x2204e6['message'],_0x2b651a);_0x227f0b(_0x2d4710[_0x4c06('0xd')](0x1f4,_0x2204e6[_0x4c06('0xf')]));});});}; \ No newline at end of file +var _0x29e8=['WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','WhatsappQueueReport','create','body','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','options','where','attributes','then','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','info'];(function(_0x1c8b28,_0x18ef15){var _0x5be512=function(_0x20c7cb){while(--_0x20c7cb){_0x1c8b28['push'](_0x1c8b28['shift']());}};_0x5be512(++_0x18ef15);}(_0x29e8,0x15d));var _0x829e=function(_0x20ebe1,_0x46332f){_0x20ebe1=_0x20ebe1-0x0;var _0x28e139=_0x29e8[_0x20ebe1];return _0x28e139;};'use strict';var _=require(_0x829e('0x0'));var util=require('util');var moment=require(_0x829e('0x1'));var BPromise=require(_0x829e('0x2'));var rs=require(_0x829e('0x3'));var fs=require('fs');var Redis=require(_0x829e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x829e('0x5'))(_0x829e('0x6'));var config=require('../../config/environment');var jayson=require(_0x829e('0x7'));var client=jayson[_0x829e('0x8')][_0x829e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e4036,_0x52e6da,_0x4caba4){return new BPromise(function(_0x516db0,_0x427b65){return client['request'](_0x1e4036,_0x4caba4)['then'](function(_0x319b66){logger[_0x829e('0xa')](_0x829e('0xb'),_0x52e6da,_0x829e('0xc'));logger[_0x829e('0xd')](_0x829e('0xe'),_0x52e6da,_0x829e('0xc'),JSON[_0x829e('0xf')](_0x319b66));if(_0x319b66[_0x829e('0x10')]){if(_0x319b66['error'][_0x829e('0x11')]===0x1f4){logger[_0x829e('0x10')](_0x829e('0xb'),_0x52e6da,_0x319b66['error'][_0x829e('0x12')]);return _0x427b65(_0x319b66[_0x829e('0x10')][_0x829e('0x12')]);}logger[_0x829e('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x52e6da,_0x319b66[_0x829e('0x10')][_0x829e('0x12')]);return _0x516db0(_0x319b66[_0x829e('0x10')]['message']);}else{logger['info'](_0x829e('0xb'),_0x52e6da,_0x829e('0xc'));_0x516db0(_0x319b66['result']['message']);}})[_0x829e('0x13')](function(_0x45fa7f){logger[_0x829e('0x10')](_0x829e('0xb'),_0x52e6da,_0x45fa7f);_0x427b65(_0x45fa7f);});});}exports['CreateWhatsappQueueReport']=function(_0xb44374){var _0x423707=this;return new Promise(function(_0x3f2e45,_0x1b8d2d){return db[_0x829e('0x14')][_0x829e('0x15')](_0xb44374[_0x829e('0x16')],{'raw':_0xb44374['options']?_0xb44374['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x554d7e){logger['info']('CreateWhatsappQueueReport',_0xb44374);logger['debug'](_0x829e('0x17'),_0xb44374,JSON['stringify'](_0x554d7e));_0x3f2e45(_0x554d7e);})[_0x829e('0x13')](function(_0x275441){logger[_0x829e('0x10')]('CreateWhatsappQueueReport',_0x275441[_0x829e('0x12')],_0xb44374);_0x1b8d2d(_0x423707[_0x829e('0x10')](0x1f4,_0x275441['message']));});});};exports[_0x829e('0x18')]=function(_0x594f94){var _0x3d1870=this;return new Promise(function(_0x197679,_0x265ce3){return db[_0x829e('0x14')][_0x829e('0x19')](_0x594f94['body'],{'raw':_0x594f94[_0x829e('0x1a')]?_0x594f94['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x594f94[_0x829e('0x1a')]?_0x594f94[_0x829e('0x1a')][_0x829e('0x1b')]||null:null,'attributes':_0x594f94[_0x829e('0x1a')]?_0x594f94[_0x829e('0x1a')][_0x829e('0x1c')]||null:null,'limit':_0x594f94[_0x829e('0x1a')]?_0x594f94[_0x829e('0x1a')]['limit']||null:null})[_0x829e('0x1d')](function(_0x30739c){logger[_0x829e('0xa')](_0x829e('0x18'),_0x594f94);logger[_0x829e('0xd')](_0x829e('0x18'),_0x594f94,JSON['stringify'](_0x30739c));_0x197679(_0x30739c);})[_0x829e('0x13')](function(_0x20fa77){logger[_0x829e('0x10')](_0x829e('0x18'),_0x20fa77[_0x829e('0x12')],_0x594f94);_0x265ce3(_0x3d1870['error'](0x1f4,_0x20fa77['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index a5409d1..3c6d0cf 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 _0xde3c=['update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get','index','isAuthenticated','describe','/:id','post','create'];(function(_0x47df9d,_0x532aed){var _0x16971a=function(_0x1894a4){while(--_0x1894a4){_0x47df9d['push'](_0x47df9d['shift']());}};_0x16971a(++_0x532aed);}(_0xde3c,0xcc));var _0xcde3=function(_0x39e4af,_0x499b6a){_0x39e4af=_0x39e4af-0x0;var _0x5b9c91=_0xde3c[_0x39e4af];return _0x5b9c91;};'use strict';var multer=require(_0xcde3('0x0'));var util=require(_0xcde3('0x1'));var path=require('path');var timeout=require(_0xcde3('0x2'));var express=require(_0xcde3('0x3'));var router=express[_0xcde3('0x4')]();var fs_extra=require(_0xcde3('0x5'));var auth=require(_0xcde3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcde3('0x7'));var controller=require(_0xcde3('0x8'));router[_0xcde3('0x9')]('/',auth['isAuthenticated'](),controller[_0xcde3('0xa')]);router[_0xcde3('0x9')]('/describe',auth[_0xcde3('0xb')](),controller[_0xcde3('0xc')]);router[_0xcde3('0x9')](_0xcde3('0xd'),auth[_0xcde3('0xb')](),controller['show']);router[_0xcde3('0xe')]('/',auth['isAuthenticated'](),controller[_0xcde3('0xf')]);router['put']('/:id',auth[_0xcde3('0xb')](),controller[_0xcde3('0x10')]);router[_0xcde3('0x11')](_0xcde3('0xd'),auth[_0xcde3('0xb')](),controller[_0xcde3('0x12')]);module[_0xcde3('0x13')]=router; \ No newline at end of file +var _0xd44c=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','update','delete'];(function(_0x11192a,_0x478cf4){var _0x4f99a4=function(_0x58dc74){while(--_0x58dc74){_0x11192a['push'](_0x11192a['shift']());}};_0x4f99a4(++_0x478cf4);}(_0xd44c,0x106));var _0xcd44=function(_0x1b1f88,_0x3fe1cb){_0x1b1f88=_0x1b1f88-0x0;var _0x5045b9=_0xd44c[_0x1b1f88];return _0x5045b9;};'use strict';var multer=require(_0xcd44('0x0'));var util=require(_0xcd44('0x1'));var path=require(_0xcd44('0x2'));var timeout=require(_0xcd44('0x3'));var express=require('express');var router=express[_0xcd44('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcd44('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcd44('0x6'));var controller=require(_0xcd44('0x7'));router['get']('/',auth[_0xcd44('0x8')](),controller[_0xcd44('0x9')]);router[_0xcd44('0xa')](_0xcd44('0xb'),auth[_0xcd44('0x8')](),controller[_0xcd44('0xc')]);router[_0xcd44('0xa')](_0xcd44('0xd'),auth[_0xcd44('0x8')](),controller[_0xcd44('0xe')]);router[_0xcd44('0xf')]('/',auth[_0xcd44('0x8')](),controller['create']);router['put'](_0xcd44('0xd'),auth['isAuthenticated'](),controller[_0xcd44('0x10')]);router[_0xcd44('0x11')](_0xcd44('0xd'),auth['isAuthenticated'](),controller[_0xcd44('0x12')]);module[_0xcd44('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 2ac0d70..fa4a8f2 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 _0x7be1=['sequelize','exports','STRING','account','agent','queue','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7be1,0x165));var _0x17be=function(_0x3baaf2,_0x894e3d){_0x3baaf2=_0x3baaf2-0x0;var _0x50e8b0=_0x7be1[_0x3baaf2];return _0x50e8b0;};'use strict';var Sequelize=require(_0x17be('0x0'));module[_0x17be('0x1')]={'uniqueid':{'type':Sequelize[_0x17be('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x17be('0x3'),_0x17be('0x4'),_0x17be('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x17be('0x6')]}}; \ No newline at end of file +var _0xb8a0=['agent','STRING','ENUM'];(function(_0x27be9a,_0x592f94){var _0x563f8a=function(_0x5be946){while(--_0x5be946){_0x27be9a['push'](_0x27be9a['shift']());}};_0x563f8a(++_0x592f94);}(_0xb8a0,0x1d5));var _0x0b8a=function(_0x31cd4c,_0x2eca23){_0x31cd4c=_0x31cd4c-0x0;var _0x434419=_0xb8a0[_0x31cd4c];return _0x434419;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x0b8a('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x0b8a('0x1')]('account',_0x0b8a('0x2'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 392a535..1e8a78f 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 _0xb426=['rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','include','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../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','set','Content-Range','apply','save','update','then','stack','name','send','index','map','WhatsappTransferReport'];(function(_0x2e249d,_0x41b7e7){var _0x1faa37=function(_0x1422b4){while(--_0x1422b4){_0x2e249d['push'](_0x2e249d['shift']());}};_0x1faa37(++_0x41b7e7);}(_0xb426,0xbc));var _0x6b42=function(_0x5161d1,_0x158f11){_0x5161d1=_0x5161d1-0x0;var _0x287fe6=_0xb426[_0x5161d1];return _0x287fe6;};'use strict';var emlformat=require(_0x6b42('0x0'));var rimraf=require(_0x6b42('0x1'));var zipdir=require(_0x6b42('0x2'));var jsonpatch=require(_0x6b42('0x3'));var rp=require(_0x6b42('0x4'));var moment=require(_0x6b42('0x5'));var BPromise=require(_0x6b42('0x6'));var Mustache=require(_0x6b42('0x7'));var util=require('util');var path=require(_0x6b42('0x8'));var sox=require(_0x6b42('0x9'));var csv=require(_0x6b42('0xa'));var ejs=require(_0x6b42('0xb'));var fs=require('fs');var fs_extra=require(_0x6b42('0xc'));var _=require(_0x6b42('0xd'));var squel=require(_0x6b42('0xe'));var crypto=require(_0x6b42('0xf'));var jsforce=require(_0x6b42('0x10'));var deskjs=require(_0x6b42('0x11'));var toCsv=require(_0x6b42('0xa'));var querystring=require(_0x6b42('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6b42('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6b42('0x14'));var hardwareService=require(_0x6b42('0x15'));var logger=require(_0x6b42('0x16'))(_0x6b42('0x17'));var utils=require('../../config/utils');var config=require(_0x6b42('0x18'));var licenseUtil=require(_0x6b42('0x19'));var db=require(_0x6b42('0x1a'))['db'];function respondWithStatusCode(_0x2f3c68,_0x52c944){_0x52c944=_0x52c944||0xcc;return function(_0x3e64c8){if(_0x3e64c8){return _0x2f3c68[_0x6b42('0x1b')](_0x52c944);}return _0x2f3c68[_0x6b42('0x1c')](_0x52c944)[_0x6b42('0x1d')]();};}function respondWithResult(_0x342332,_0x5801f7){_0x5801f7=_0x5801f7||0xc8;return function(_0x43ee76){if(_0x43ee76){return _0x342332[_0x6b42('0x1c')](_0x5801f7)[_0x6b42('0x1e')](_0x43ee76);}};}function respondWithFilteredResult(_0x5eccf7,_0x456d25){return function(_0xfa9b8){if(_0xfa9b8){var _0x42ba33=typeof _0x456d25[_0x6b42('0x1f')]===_0x6b42('0x20')&&typeof _0x456d25[_0x6b42('0x21')]===_0x6b42('0x20');var _0x217067=_0xfa9b8['count'];var _0x3132b4=_0x42ba33?0x0:_0x456d25[_0x6b42('0x1f')];var _0x2abe02=_0x42ba33?_0xfa9b8['count']:_0x456d25[_0x6b42('0x1f')]+_0x456d25['limit'];var _0x2f03e7;if(_0x2abe02>=_0x217067){_0x2abe02=_0x217067;_0x2f03e7=0xc8;}else{_0x2f03e7=0xce;}_0x5eccf7['status'](_0x2f03e7);return _0x5eccf7[_0x6b42('0x22')](_0x6b42('0x23'),_0x3132b4+'-'+_0x2abe02+'/'+_0x217067)[_0x6b42('0x1e')](_0xfa9b8);}return null;};}function patchUpdates(_0x51f246){return function(_0x4ff44e){try{jsonpatch[_0x6b42('0x24')](_0x4ff44e,_0x51f246,!![]);}catch(_0x34bc02){return BPromise['reject'](_0x34bc02);}return _0x4ff44e[_0x6b42('0x25')]();};}function saveUpdates(_0x971cef,_0x2f0298){return function(_0x4b82b4){if(_0x4b82b4){return _0x4b82b4[_0x6b42('0x26')](_0x971cef)[_0x6b42('0x27')](function(_0x2de753){return _0x2de753;});}return null;};}function removeEntity(_0x8c1a1e,_0x30c186){return function(_0x3bf6c1){if(_0x3bf6c1){return _0x3bf6c1['destroy']()[_0x6b42('0x27')](function(){_0x8c1a1e[_0x6b42('0x1c')](0xcc)[_0x6b42('0x1d')]();});}};}function handleEntityNotFound(_0x2acacf,_0x3fbb17){return function(_0x25d285){if(!_0x25d285){_0x2acacf[_0x6b42('0x1b')](0x194);}return _0x25d285;};}function handleError(_0xcca211,_0x3ea83d){_0x3ea83d=_0x3ea83d||0x1f4;return function(_0x463933){logger['error'](_0x463933[_0x6b42('0x28')]);if(_0x463933[_0x6b42('0x29')]){delete _0x463933[_0x6b42('0x29')];}_0xcca211[_0x6b42('0x1c')](_0x3ea83d)[_0x6b42('0x2a')](_0x463933);};}exports[_0x6b42('0x2b')]=function(_0x9b011e,_0x5a5c64){var _0x4f477={},_0x14f286={},_0x536ff7={'count':0x0,'rows':[]};var _0x45f417=_[_0x6b42('0x2c')](db[_0x6b42('0x2d')][_0x6b42('0x2e')],function(_0x143505){return{'name':_0x143505['fieldName'],'type':_0x143505[_0x6b42('0x2f')]['key']};});_0x14f286[_0x6b42('0x30')]=_[_0x6b42('0x2c')](_0x45f417,_0x6b42('0x29'));_0x14f286[_0x6b42('0x31')]=_[_0x6b42('0x32')](_0x9b011e[_0x6b42('0x31')]);_0x14f286[_0x6b42('0x33')]=_[_0x6b42('0x34')](_0x14f286[_0x6b42('0x30')],_0x14f286[_0x6b42('0x31')]);_0x4f477[_0x6b42('0x35')]=_['intersection'](_0x14f286['model'],qs[_0x6b42('0x36')](_0x9b011e['query'][_0x6b42('0x36')]));_0x4f477['attributes']=_0x4f477[_0x6b42('0x35')][_0x6b42('0x37')]?_0x4f477[_0x6b42('0x35')]:_0x14f286[_0x6b42('0x30')];if(!_0x9b011e[_0x6b42('0x31')]['hasOwnProperty'](_0x6b42('0x38'))){_0x4f477['limit']=qs[_0x6b42('0x21')](_0x9b011e[_0x6b42('0x31')]['limit']);_0x4f477[_0x6b42('0x1f')]=qs[_0x6b42('0x1f')](_0x9b011e['query'][_0x6b42('0x1f')]);}_0x4f477[_0x6b42('0x39')]=qs[_0x6b42('0x3a')](_0x9b011e[_0x6b42('0x31')][_0x6b42('0x3a')]);_0x4f477[_0x6b42('0x3b')]=qs[_0x6b42('0x33')](_[_0x6b42('0x3c')](_0x9b011e['query'],_0x14f286[_0x6b42('0x33')]),_0x45f417);if(_0x9b011e['query'][_0x6b42('0x3d')]){_0x4f477[_0x6b42('0x3b')]=_[_0x6b42('0x3e')](_0x4f477[_0x6b42('0x3b')],{'$or':_['map'](_0x45f417,function(_0x2b24c2){if(_0x2b24c2[_0x6b42('0x2f')]!==_0x6b42('0x3f')){var _0x20ea19={};_0x20ea19[_0x2b24c2[_0x6b42('0x29')]]={'$like':'%'+_0x9b011e['query'][_0x6b42('0x3d')]+'%'};return _0x20ea19;}})});}_0x4f477=_[_0x6b42('0x3e')]({},_0x4f477,_0x9b011e[_0x6b42('0x40')]);var _0x5586b5={'where':_0x4f477['where']};return db['WhatsappTransferReport'][_0x6b42('0x41')](_0x5586b5)['then'](function(_0x14e495){_0x536ff7[_0x6b42('0x41')]=_0x14e495;if(_0x9b011e['query'][_0x6b42('0x42')]){_0x4f477['include']=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x6b42('0x43')](_0x4f477);})[_0x6b42('0x27')](function(_0x36ad00){_0x536ff7[_0x6b42('0x44')]=_0x36ad00;return _0x536ff7;})[_0x6b42('0x27')](respondWithFilteredResult(_0x5a5c64,_0x4f477))[_0x6b42('0x45')](handleError(_0x5a5c64,null));};exports[_0x6b42('0x46')]=function(_0x2ac08b,_0x5d6ddc){var _0x29c514={'raw':!![],'where':{'id':_0x2ac08b[_0x6b42('0x47')]['id']}},_0x49ebb1={};_0x49ebb1[_0x6b42('0x30')]=_[_0x6b42('0x32')](db[_0x6b42('0x2d')][_0x6b42('0x2e')]);_0x49ebb1['query']=_['keys'](_0x2ac08b[_0x6b42('0x31')]);_0x49ebb1['filters']=_[_0x6b42('0x34')](_0x49ebb1[_0x6b42('0x30')],_0x49ebb1[_0x6b42('0x31')]);_0x29c514[_0x6b42('0x35')]=_[_0x6b42('0x34')](_0x49ebb1[_0x6b42('0x30')],qs['fields'](_0x2ac08b[_0x6b42('0x31')]['fields']));_0x29c514['attributes']=_0x29c514[_0x6b42('0x35')][_0x6b42('0x37')]?_0x29c514[_0x6b42('0x35')]:_0x49ebb1[_0x6b42('0x30')];if(_0x2ac08b[_0x6b42('0x31')][_0x6b42('0x42')]){_0x29c514[_0x6b42('0x48')]=[{'all':!![]}];}_0x29c514=_['merge']({},_0x29c514,_0x2ac08b['options']);return db[_0x6b42('0x2d')]['find'](_0x29c514)[_0x6b42('0x27')](handleEntityNotFound(_0x5d6ddc,null))[_0x6b42('0x27')](respondWithResult(_0x5d6ddc,null))[_0x6b42('0x45')](handleError(_0x5d6ddc,null));};exports[_0x6b42('0x49')]=function(_0x3b79f3,_0x369d44){return db[_0x6b42('0x2d')][_0x6b42('0x49')](_0x3b79f3['body'],{})['then'](respondWithResult(_0x369d44,0xc9))[_0x6b42('0x45')](handleError(_0x369d44,null));};exports[_0x6b42('0x26')]=function(_0x436cda,_0xba0f20){if(_0x436cda[_0x6b42('0x4a')]['id']){delete _0x436cda[_0x6b42('0x4a')]['id'];}return db[_0x6b42('0x2d')][_0x6b42('0x4b')]({'where':{'id':_0x436cda['params']['id']}})[_0x6b42('0x27')](handleEntityNotFound(_0xba0f20,null))[_0x6b42('0x27')](saveUpdates(_0x436cda[_0x6b42('0x4a')],null))[_0x6b42('0x27')](respondWithResult(_0xba0f20,null))[_0x6b42('0x45')](handleError(_0xba0f20,null));};exports[_0x6b42('0x4c')]=function(_0x443e0e,_0x20061d){return db[_0x6b42('0x2d')][_0x6b42('0x4b')]({'where':{'id':_0x443e0e['params']['id']}})[_0x6b42('0x27')](handleEntityNotFound(_0x20061d,null))['then'](removeEntity(_0x20061d,null))[_0x6b42('0x45')](handleError(_0x20061d,null));};exports['describe']=function(_0x1c7225,_0x1122a7){return db[_0x6b42('0x2d')][_0x6b42('0x4d')]()['then'](respondWithResult(_0x1122a7,null))['catch'](handleError(_0x1122a7,null));}; \ No newline at end of file +var _0x340e=['hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','WhatsappTransferReport','includeAll','findAll','show','params','include','find','catch','create','body','describe','eml-format','zip-dir','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','filters','intersection','query','attributes','model','fields','length'];(function(_0x793c7c,_0x1ae54a){var _0x356037=function(_0x4fcf9f){while(--_0x4fcf9f){_0x793c7c['push'](_0x793c7c['shift']());}};_0x356037(++_0x1ae54a);}(_0x340e,0x1dc));var _0xe340=function(_0x205946,_0x23a131){_0x205946=_0x205946-0x0;var _0x197059=_0x340e[_0x205946];return _0x197059;};'use strict';var emlformat=require(_0xe340('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe340('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe340('0x2'));var BPromise=require(_0xe340('0x3'));var Mustache=require('mustache');var util=require(_0xe340('0x4'));var path=require(_0xe340('0x5'));var sox=require(_0xe340('0x6'));var csv=require('to-csv');var ejs=require(_0xe340('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe340('0x8'));var squel=require(_0xe340('0x9'));var crypto=require(_0xe340('0xa'));var jsforce=require(_0xe340('0xb'));var deskjs=require(_0xe340('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe340('0xd'));var Papa=require(_0xe340('0xe'));var Redis=require(_0xe340('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe340('0x10'));var as=require(_0xe340('0x11'));var hardwareService=require(_0xe340('0x12'));var logger=require(_0xe340('0x13'))('api');var utils=require(_0xe340('0x14'));var config=require(_0xe340('0x15'));var licenseUtil=require(_0xe340('0x16'));var db=require(_0xe340('0x17'))['db'];function respondWithStatusCode(_0x181974,_0x463805){_0x463805=_0x463805||0xcc;return function(_0x326c9b){if(_0x326c9b){return _0x181974['sendStatus'](_0x463805);}return _0x181974[_0xe340('0x18')](_0x463805)[_0xe340('0x19')]();};}function respondWithResult(_0x325018,_0x1e1ad7){_0x1e1ad7=_0x1e1ad7||0xc8;return function(_0x14f0a5){if(_0x14f0a5){return _0x325018['status'](_0x1e1ad7)[_0xe340('0x1a')](_0x14f0a5);}};}function respondWithFilteredResult(_0xd401cd,_0x5f12d0){return function(_0xc2784a){if(_0xc2784a){var _0x335ab9=typeof _0x5f12d0[_0xe340('0x1b')]===_0xe340('0x1c')&&typeof _0x5f12d0[_0xe340('0x1d')]===_0xe340('0x1c');var _0x1d749b=_0xc2784a[_0xe340('0x1e')];var _0x257798=_0x335ab9?0x0:_0x5f12d0[_0xe340('0x1b')];var _0x5f16ce=_0x335ab9?_0xc2784a[_0xe340('0x1e')]:_0x5f12d0[_0xe340('0x1b')]+_0x5f12d0[_0xe340('0x1d')];var _0x1281b2;if(_0x5f16ce>=_0x1d749b){_0x5f16ce=_0x1d749b;_0x1281b2=0xc8;}else{_0x1281b2=0xce;}_0xd401cd[_0xe340('0x18')](_0x1281b2);return _0xd401cd['set'](_0xe340('0x1f'),_0x257798+'-'+_0x5f16ce+'/'+_0x1d749b)[_0xe340('0x1a')](_0xc2784a);}return null;};}function patchUpdates(_0xba68f5){return function(_0x32e4c7){try{jsonpatch[_0xe340('0x20')](_0x32e4c7,_0xba68f5,!![]);}catch(_0x557dcf){return BPromise[_0xe340('0x21')](_0x557dcf);}return _0x32e4c7[_0xe340('0x22')]();};}function saveUpdates(_0x1eb647,_0x2b5e98){return function(_0x39ad71){if(_0x39ad71){return _0x39ad71[_0xe340('0x23')](_0x1eb647)[_0xe340('0x24')](function(_0x506f89){return _0x506f89;});}return null;};}function removeEntity(_0x189c81,_0x41815c){return function(_0x361d96){if(_0x361d96){return _0x361d96[_0xe340('0x25')]()['then'](function(){_0x189c81[_0xe340('0x18')](0xcc)[_0xe340('0x19')]();});}};}function handleEntityNotFound(_0x487b36,_0x1e160f){return function(_0x3fe91e){if(!_0x3fe91e){_0x487b36[_0xe340('0x26')](0x194);}return _0x3fe91e;};}function handleError(_0x332b0e,_0x38c0a8){_0x38c0a8=_0x38c0a8||0x1f4;return function(_0x3792db){logger['error'](_0x3792db[_0xe340('0x27')]);if(_0x3792db['name']){delete _0x3792db[_0xe340('0x28')];}_0x332b0e[_0xe340('0x18')](_0x38c0a8)[_0xe340('0x29')](_0x3792db);};}exports[_0xe340('0x2a')]=function(_0x131584,_0x376446){var _0x4ccbf7={},_0x34342c={},_0x2998c5={'count':0x0,'rows':[]};var _0x1f12cc=_[_0xe340('0x2b')](db['WhatsappTransferReport'][_0xe340('0x2c')],function(_0x64f389){return{'name':_0x64f389[_0xe340('0x2d')],'type':_0x64f389[_0xe340('0x2e')][_0xe340('0x2f')]};});_0x34342c['model']=_[_0xe340('0x2b')](_0x1f12cc,'name');_0x34342c['query']=_[_0xe340('0x30')](_0x131584['query']);_0x34342c[_0xe340('0x31')]=_[_0xe340('0x32')](_0x34342c['model'],_0x34342c[_0xe340('0x33')]);_0x4ccbf7[_0xe340('0x34')]=_[_0xe340('0x32')](_0x34342c[_0xe340('0x35')],qs[_0xe340('0x36')](_0x131584[_0xe340('0x33')]['fields']));_0x4ccbf7[_0xe340('0x34')]=_0x4ccbf7['attributes'][_0xe340('0x37')]?_0x4ccbf7[_0xe340('0x34')]:_0x34342c[_0xe340('0x35')];if(!_0x131584[_0xe340('0x33')][_0xe340('0x38')](_0xe340('0x39'))){_0x4ccbf7[_0xe340('0x1d')]=qs[_0xe340('0x1d')](_0x131584[_0xe340('0x33')][_0xe340('0x1d')]);_0x4ccbf7[_0xe340('0x1b')]=qs[_0xe340('0x1b')](_0x131584[_0xe340('0x33')][_0xe340('0x1b')]);}_0x4ccbf7[_0xe340('0x3a')]=qs[_0xe340('0x3b')](_0x131584[_0xe340('0x33')][_0xe340('0x3b')]);_0x4ccbf7['where']=qs[_0xe340('0x31')](_[_0xe340('0x3c')](_0x131584[_0xe340('0x33')],_0x34342c['filters']),_0x1f12cc);if(_0x131584[_0xe340('0x33')][_0xe340('0x3d')]){_0x4ccbf7[_0xe340('0x3e')]=_[_0xe340('0x3f')](_0x4ccbf7[_0xe340('0x3e')],{'$or':_['map'](_0x1f12cc,function(_0x500672){if(_0x500672[_0xe340('0x2e')]!=='VIRTUAL'){var _0x5dfe7a={};_0x5dfe7a[_0x500672[_0xe340('0x28')]]={'$like':'%'+_0x131584['query'][_0xe340('0x3d')]+'%'};return _0x5dfe7a;}})});}_0x4ccbf7=_[_0xe340('0x3f')]({},_0x4ccbf7,_0x131584[_0xe340('0x40')]);var _0x30a0ec={'where':_0x4ccbf7[_0xe340('0x3e')]};return db[_0xe340('0x41')]['count'](_0x30a0ec)[_0xe340('0x24')](function(_0x51d1c7){_0x2998c5[_0xe340('0x1e')]=_0x51d1c7;if(_0x131584[_0xe340('0x33')][_0xe340('0x42')]){_0x4ccbf7['include']=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xe340('0x43')](_0x4ccbf7);})['then'](function(_0x28aa94){_0x2998c5['rows']=_0x28aa94;return _0x2998c5;})[_0xe340('0x24')](respondWithFilteredResult(_0x376446,_0x4ccbf7))['catch'](handleError(_0x376446,null));};exports[_0xe340('0x44')]=function(_0x26af6c,_0x6a1de){var _0x48b536={'raw':!![],'where':{'id':_0x26af6c[_0xe340('0x45')]['id']}},_0x3866ec={};_0x3866ec[_0xe340('0x35')]=_['keys'](db[_0xe340('0x41')][_0xe340('0x2c')]);_0x3866ec[_0xe340('0x33')]=_['keys'](_0x26af6c['query']);_0x3866ec[_0xe340('0x31')]=_[_0xe340('0x32')](_0x3866ec[_0xe340('0x35')],_0x3866ec['query']);_0x48b536['attributes']=_[_0xe340('0x32')](_0x3866ec[_0xe340('0x35')],qs[_0xe340('0x36')](_0x26af6c[_0xe340('0x33')]['fields']));_0x48b536[_0xe340('0x34')]=_0x48b536[_0xe340('0x34')][_0xe340('0x37')]?_0x48b536[_0xe340('0x34')]:_0x3866ec[_0xe340('0x35')];if(_0x26af6c['query'][_0xe340('0x42')]){_0x48b536[_0xe340('0x46')]=[{'all':!![]}];}_0x48b536=_['merge']({},_0x48b536,_0x26af6c[_0xe340('0x40')]);return db['WhatsappTransferReport'][_0xe340('0x47')](_0x48b536)[_0xe340('0x24')](handleEntityNotFound(_0x6a1de,null))[_0xe340('0x24')](respondWithResult(_0x6a1de,null))[_0xe340('0x48')](handleError(_0x6a1de,null));};exports[_0xe340('0x49')]=function(_0x4c9b44,_0x51c2b3){return db[_0xe340('0x41')]['create'](_0x4c9b44[_0xe340('0x4a')],{})['then'](respondWithResult(_0x51c2b3,0xc9))[_0xe340('0x48')](handleError(_0x51c2b3,null));};exports['update']=function(_0x1b9b92,_0x4426bc){if(_0x1b9b92['body']['id']){delete _0x1b9b92['body']['id'];}return db['WhatsappTransferReport'][_0xe340('0x47')]({'where':{'id':_0x1b9b92[_0xe340('0x45')]['id']}})[_0xe340('0x24')](handleEntityNotFound(_0x4426bc,null))[_0xe340('0x24')](saveUpdates(_0x1b9b92[_0xe340('0x4a')],null))[_0xe340('0x24')](respondWithResult(_0x4426bc,null))['catch'](handleError(_0x4426bc,null));};exports[_0xe340('0x25')]=function(_0x163f96,_0x5cd56d){return db['WhatsappTransferReport']['find']({'where':{'id':_0x163f96['params']['id']}})['then'](handleEntityNotFound(_0x5cd56d,null))[_0xe340('0x24')](removeEntity(_0x5cd56d,null))[_0xe340('0x48')](handleError(_0x5cd56d,null));};exports[_0xe340('0x4b')]=function(_0x41296a,_0x21b9b7){return db[_0xe340('0x41')][_0xe340('0x4b')]()[_0xe340('0x24')](respondWithResult(_0x21b9b7,null))[_0xe340('0x48')](handleError(_0x21b9b7,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 5ed16e5..1d68fc9 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 _0x0879=['rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x4fc776,_0xa46b8a){var _0x33e056=function(_0x1eb549){while(--_0x1eb549){_0x4fc776['push'](_0x4fc776['shift']());}};_0x33e056(++_0xa46b8a);}(_0x0879,0x143));var _0x9087=function(_0xac218e,_0x4a3a42){_0xac218e=_0xac218e-0x0;var _0x513b6d=_0x0879[_0xac218e];return _0x513b6d;};'use strict';var _=require(_0x9087('0x0'));var util=require(_0x9087('0x1'));var logger=require(_0x9087('0x2'))(_0x9087('0x3'));var moment=require(_0x9087('0x4'));var BPromise=require('bluebird');var rp=require(_0x9087('0x5'));var fs=require('fs');var path=require(_0x9087('0x6'));var rimraf=require(_0x9087('0x7'));var config=require(_0x9087('0x8'));var attributes=require(_0x9087('0x9'));module[_0x9087('0xa')]=function(_0x2dd27a,_0x1754ac){return _0x2dd27a[_0x9087('0xb')](_0x9087('0xc'),attributes,{'tableName':_0x9087('0xd'),'paranoid':![],'indexes':[{'name':_0x9087('0xe'),'fields':[_0x9087('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x48ab=['exports','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./whatsappTransferReport.attributes'];(function(_0x535e0e,_0x1b9d34){var _0x2dfaa5=function(_0x594ca0){while(--_0x594ca0){_0x535e0e['push'](_0x535e0e['shift']());}};_0x2dfaa5(++_0x1b9d34);}(_0x48ab,0x1a8));var _0xb48a=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x48ab[_0x1e7b16];return _0x37fadc;};'use strict';var _=require(_0xb48a('0x0'));var util=require('util');var logger=require(_0xb48a('0x1'))(_0xb48a('0x2'));var moment=require('moment');var BPromise=require(_0xb48a('0x3'));var rp=require(_0xb48a('0x4'));var fs=require('fs');var path=require(_0xb48a('0x5'));var rimraf=require('rimraf');var config=require(_0xb48a('0x6'));var attributes=require(_0xb48a('0x7'));module[_0xb48a('0x8')]=function(_0x2de7a5,_0x358901){return _0x2de7a5['define'](_0xb48a('0x9'),attributes,{'tableName':_0xb48a('0xa'),'paranoid':![],'indexes':[{'name':_0xb48a('0xb'),'fields':[_0xb48a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 1c363c7..cc2a14b 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 _0xa25d=['debug','stringify','error','WhatsappTransferReport,\x20%s,\x20%s','message','lodash','util','moment','ioredis','../../mysqldb','../../config/environment','client','then','info','request\x20sent'];(function(_0x226041,_0x31e59f){var _0x326df4=function(_0x1e86b6){while(--_0x1e86b6){_0x226041['push'](_0x226041['shift']());}};_0x326df4(++_0x31e59f);}(_0xa25d,0x1c7));var _0xda25=function(_0x1a0c59,_0x3b4dcc){_0x1a0c59=_0x1a0c59-0x0;var _0xed67c9=_0xa25d[_0x1a0c59];return _0xed67c9;};'use strict';var _=require(_0xda25('0x0'));var util=require(_0xda25('0x1'));var moment=require(_0xda25('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda25('0x3'));var db=require(_0xda25('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xda25('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xda25('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d7997,_0xa8636e,_0x4e73c7){return new BPromise(function(_0x578894,_0x1997c9){return client['request'](_0x1d7997,_0x4e73c7)[_0xda25('0x7')](function(_0x2f096d){logger[_0xda25('0x8')]('WhatsappTransferReport,\x20%s,\x20%s',_0xa8636e,_0xda25('0x9'));logger[_0xda25('0xa')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0xa8636e,'request\x20sent',JSON[_0xda25('0xb')](_0x2f096d));if(_0x2f096d['error']){if(_0x2f096d[_0xda25('0xc')]['code']===0x1f4){logger[_0xda25('0xc')](_0xda25('0xd'),_0xa8636e,_0x2f096d['error'][_0xda25('0xe')]);return _0x1997c9(_0x2f096d[_0xda25('0xc')][_0xda25('0xe')]);}logger[_0xda25('0xc')](_0xda25('0xd'),_0xa8636e,_0x2f096d[_0xda25('0xc')]['message']);return _0x578894(_0x2f096d[_0xda25('0xc')]['message']);}else{logger[_0xda25('0x8')](_0xda25('0xd'),_0xa8636e,_0xda25('0x9'));_0x578894(_0x2f096d['result'][_0xda25('0xe')]);}})['catch'](function(_0x1047f8){logger[_0xda25('0xc')](_0xda25('0xd'),_0xa8636e,_0x1047f8);_0x1997c9(_0x1047f8);});});} \ No newline at end of file +var _0x72ad=['client','http','request','then','info','request\x20sent','debug','stringify','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x4bfade,_0xb26c0e){var _0x272465=function(_0x3b38cb){while(--_0x3b38cb){_0x4bfade['push'](_0x4bfade['shift']());}};_0x272465(++_0xb26c0e);}(_0x72ad,0xff));var _0xd72a=function(_0x56f7e2,_0x145392){_0x56f7e2=_0x56f7e2-0x0;var _0x36240b=_0x72ad[_0x56f7e2];return _0x36240b;};'use strict';var _=require(_0xd72a('0x0'));var util=require('util');var moment=require(_0xd72a('0x1'));var BPromise=require(_0xd72a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd72a('0x3'));var db=require(_0xd72a('0x4'))['db'];var utils=require(_0xd72a('0x5'));var logger=require(_0xd72a('0x6'))('rpc');var config=require(_0xd72a('0x7'));var jayson=require(_0xd72a('0x8'));var client=jayson[_0xd72a('0x9')][_0xd72a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x140b24,_0x35f4a9,_0x52d4df){return new BPromise(function(_0x14d409,_0x4e9a30){return client[_0xd72a('0xb')](_0x140b24,_0x52d4df)[_0xd72a('0xc')](function(_0x3333d3){logger[_0xd72a('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0x35f4a9,_0xd72a('0xe'));logger[_0xd72a('0xf')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x35f4a9,_0xd72a('0xe'),JSON[_0xd72a('0x10')](_0x3333d3));if(_0x3333d3[_0xd72a('0x11')]){if(_0x3333d3[_0xd72a('0x11')][_0xd72a('0x12')]===0x1f4){logger[_0xd72a('0x11')](_0xd72a('0x13'),_0x35f4a9,_0x3333d3['error'][_0xd72a('0x14')]);return _0x4e9a30(_0x3333d3[_0xd72a('0x11')]['message']);}logger[_0xd72a('0x11')](_0xd72a('0x13'),_0x35f4a9,_0x3333d3['error']['message']);return _0x14d409(_0x3333d3['error'][_0xd72a('0x14')]);}else{logger[_0xd72a('0xd')](_0xd72a('0x13'),_0x35f4a9,_0xd72a('0xe'));_0x14d409(_0x3333d3[_0xd72a('0x15')][_0xd72a('0x14')]);}})['catch'](function(_0xd4d739){logger['error'](_0xd72a('0x13'),_0x35f4a9,_0xd4d739);_0x4e9a30(_0xd4d739);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 9891dd1..b1a0c4f 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x211d=['./config/seedDB','./config/license','default','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','./mysqldb','./rpc','./config/environment','./config/logger','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sync','then','listen','start','info','Online\x20apps:','map','join','Offline\x20apps:','filter','status','online','name','None','seedDB'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x211d,0x1e1));var _0xd211=function(_0x187f89,_0x8547b5){_0x187f89=_0x187f89-0x0;var _0x3e6d4c=_0x211d[_0x187f89];return _0x3e6d4c;};'use strict';var _=require('lodash');var mysqldb=require(_0xd211('0x0'));var rpc=require(_0xd211('0x1'));var config=require(_0xd211('0x2'));var logger=require(_0xd211('0x3'))('app');var pm2=require('./config/pm2');var pm2Config=require(_0xd211('0x4'));var schedule=require(_0xd211('0x5'));var chat=require(_0xd211('0x6'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0xd211('0x7'));function main(){return mysqldb['db']['sequelize'][_0xd211('0x8')]()[_0xd211('0x9')](function(){return rpc[_0xd211('0xa')]();})[_0xd211('0x9')](function(_0x5df16e){logger['info'](_0x5df16e);return chat[_0xd211('0xb')]();})[_0xd211('0x9')](function(){return whatsapp[_0xd211('0xb')]();})[_0xd211('0x9')](function(){return schedule[_0xd211('0xb')]();})['then'](function(){return transcribe['start']();})[_0xd211('0x9')](function(_0x143bac){logger['info'](_0x143bac);return pm2[_0xd211('0xb')](pm2Config);})[_0xd211('0x9')](function(_0xda6046){logger[_0xd211('0xc')](_0xd211('0xd'),_[_0xd211('0xe')](_['filter'](_0xda6046,{'status':'online'}),'name')[_0xd211('0xf')]());logger[_0xd211('0xc')](_0xd211('0x10'),_[_0xd211('0xe')](_[_0xd211('0x11')](_0xda6046,function(_0x142dce){return _0x142dce[_0xd211('0x12')]!==_0xd211('0x13');}),_0xd211('0x14'))[_0xd211('0xf')]()||_0xd211('0x15'));config[_0xd211('0x16')]&&require(_0xd211('0x17'))['default']();require(_0xd211('0x18'))[_0xd211('0x19')]();})[_0xd211('0x1a')](function(_0x22a53c){logger['error'](_0xd211('0x1b'),_0x22a53c);process['exit'](0x1);});}main(); \ No newline at end of file +var _0xd068=['./config/schedule/transcribe','sequelize','then','info','start','Online\x20apps:','map','filter','online','name','Offline\x20apps:','status','join','seedDB','./config/seedDB','default','./config/license','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/environment','./config/logger','app','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp'];(function(_0x77c228,_0x222bcb){var _0x28a9f=function(_0x490ad3){while(--_0x490ad3){_0x77c228['push'](_0x77c228['shift']());}};_0x28a9f(++_0x222bcb);}(_0xd068,0x1de));var _0x8d06=function(_0x122d0b,_0x2186fa){_0x122d0b=_0x122d0b-0x0;var _0x3f18fd=_0xd068[_0x122d0b];return _0x3f18fd;};'use strict';var _=require(_0x8d06('0x0'));var mysqldb=require(_0x8d06('0x1'));var rpc=require('./rpc');var config=require(_0x8d06('0x2'));var logger=require(_0x8d06('0x3'))(_0x8d06('0x4'));var pm2=require('./config/pm2');var pm2Config=require('./config/pm2/config');var schedule=require(_0x8d06('0x5'));var chat=require(_0x8d06('0x6'));var whatsapp=require(_0x8d06('0x7'));var transcribe=require(_0x8d06('0x8'));function main(){return mysqldb['db'][_0x8d06('0x9')]['sync']()[_0x8d06('0xa')](function(){return rpc['listen']();})[_0x8d06('0xa')](function(_0x2af713){logger[_0x8d06('0xb')](_0x2af713);return chat[_0x8d06('0xc')]();})[_0x8d06('0xa')](function(){return whatsapp[_0x8d06('0xc')]();})['then'](function(){return schedule[_0x8d06('0xc')]();})[_0x8d06('0xa')](function(){return transcribe[_0x8d06('0xc')]();})['then'](function(_0x390c2e){logger[_0x8d06('0xb')](_0x390c2e);return pm2[_0x8d06('0xc')](pm2Config);})[_0x8d06('0xa')](function(_0x2f5751){logger[_0x8d06('0xb')](_0x8d06('0xd'),_[_0x8d06('0xe')](_[_0x8d06('0xf')](_0x2f5751,{'status':_0x8d06('0x10')}),_0x8d06('0x11'))['join']());logger[_0x8d06('0xb')](_0x8d06('0x12'),_[_0x8d06('0xe')](_[_0x8d06('0xf')](_0x2f5751,function(_0x57f2dc){return _0x57f2dc[_0x8d06('0x13')]!==_0x8d06('0x10');}),'name')[_0x8d06('0x14')]()||'None');config[_0x8d06('0x15')]&&require(_0x8d06('0x16'))[_0x8d06('0x17')]();require(_0x8d06('0x18'))['default']();})['catch'](function(_0x257acf){logger[_0x8d06('0x19')](_0x8d06('0x1a'),_0x257acf);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index ab17422..14b9ca9 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 _0xd931=['basic-auth','bluebird','session','role','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','hotdesk','interface','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','isChatInteractionAuthorized','isAuthenticated','user','findOne','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','Forbidden.','catch','use','headers','authorization','startsWith','Basic','find','authenticate','pass','Wrong\x20credentials.','Bearer','query','getUuid','apikey','User','sub','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','update','isWebrtcLicence','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','split','splice','unshift','encryptString','join','promisify','sign','secret','payload','options','verify','secrets','randomBytes','toString','floor','now','../../mysqldb','../../config/license/util','../encryptor','lodash','jsonwebtoken','composable-middleware'];(function(_0xddfe05,_0x57b987){var _0x42b95e=function(_0x30699b){while(--_0x30699b){_0xddfe05['push'](_0xddfe05['shift']());}};_0x42b95e(++_0x57b987);}(_0xd931,0x7c));var _0x1d93=function(_0x36b037,_0x2b234e){_0x36b037=_0x36b037-0x0;var _0x409194=_0xd931[_0x36b037];return _0x409194;};'use strict';var db=require(_0x1d93('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x1d93('0x1'));var encryptor=require(_0x1d93('0x2'));var _=require(_0x1d93('0x3'));var jwt=require(_0x1d93('0x4'));var expressJwt=require('express-jwt');var compose=require(_0x1d93('0x5'));var basicAuth=require(_0x1d93('0x6'));var crypto=require('crypto');var BPromise=require(_0x1d93('0x7'));var util=require('util');var moment=require('moment');var validateJwt=expressJwt({'secret':config['secrets'][_0x1d93('0x8')]});var userAttributes=['id',_0x1d93('0x9'),'fullname',_0x1d93('0xa'),_0x1d93('0xb'),_0x1d93('0xc'),_0x1d93('0xd'),_0x1d93('0xe'),_0x1d93('0xf'),_0x1d93('0x10'),_0x1d93('0x11'),_0x1d93('0x12'),'faxPause',_0x1d93('0x13'),_0x1d93('0x14'),_0x1d93('0x15'),_0x1d93('0x16'),_0x1d93('0x17'),_0x1d93('0x18'),_0x1d93('0x19'),_0x1d93('0x1a'),_0x1d93('0x1b'),_0x1d93('0x1c'),_0x1d93('0x1d'),_0x1d93('0x1e'),_0x1d93('0x1f'),_0x1d93('0x20'),_0x1d93('0x21'),_0x1d93('0x22'),_0x1d93('0x23'),'phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort',_0x1d93('0x24'),_0x1d93('0x25'),'userProfileId',_0x1d93('0x26'),_0x1d93('0x27'),_0x1d93('0x28'),_0x1d93('0x29'),'downloadOmnichannelInteractions',_0x1d93('0x2a'),'ignorePauseForPreviewCalls','selectRecallMeCampaign'];exports[_0x1d93('0x2b')]=function(){return this[_0x1d93('0x2c')](!![])['use'](function(_0x131137,_0x57141a,_0xa4a892){if(_0x131137[_0x1d93('0x2d')]){_0xa4a892();}else{return db['ChatInteraction'][_0x1d93('0x2e')]({'where':{'id':_0x131137[_0x1d93('0x2f')]['id']},'attributes':['id',_0x1d93('0x30'),_0x1d93('0x31')],'raw':!![]})[_0x1d93('0x32')](function(_0x48d4db){if(_0x48d4db&&_0x48d4db['closed']){return _0x57141a[_0x1d93('0x33')](_0x48d4db[_0x1d93('0x31')]===_0x1d93('0x34')?0x195:0x193)[_0x1d93('0x35')]({'message':_0x48d4db['disposition']===_0x1d93('0x34')?_0x1d93('0x36'):_0x1d93('0x37')});}else{_0xa4a892();}})[_0x1d93('0x38')](function(_0x1ef5b9){_0xa4a892(_0x1ef5b9);});}});};exports[_0x1d93('0x2c')]=function isAuthenticated(_0x4b6d9b){return compose()[_0x1d93('0x39')](function(_0x2d3ab2,_0x12ff2c,_0x348509){var _0x2b9a3c;if(_0x2d3ab2[_0x1d93('0x3a')][_0x1d93('0x3b')]){if(_[_0x1d93('0x3c')](_0x2d3ab2[_0x1d93('0x3a')][_0x1d93('0x3b')],_0x1d93('0x3d'))){var _0x14f344=basicAuth(_0x2d3ab2);db['User'][_0x1d93('0x3e')]({'where':{'name':_0x14f344[_0x1d93('0xa')]}})['then'](function(_0x415194){if(!_0x415194||!_0x415194[_0x1d93('0x3f')](_0x14f344[_0x1d93('0x40')])){return _0x12ff2c[_0x1d93('0x33')](0x191)[_0x1d93('0x35')]({'message':_0x1d93('0x41')});}_0x2d3ab2['user']={'id':_0x415194['id']};_0x348509();})[_0x1d93('0x38')](function(_0x54611d){_0x348509(_0x54611d);});}else if(_[_0x1d93('0x3c')](_0x2d3ab2[_0x1d93('0x3a')][_0x1d93('0x3b')],_0x1d93('0x42'))){validateJwt(_0x2d3ab2,_0x12ff2c,_0x348509);}else{if(_0x4b6d9b){_0x348509();}else{return _0x12ff2c['status'](0x193)[_0x1d93('0x35')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x2d3ab2[_0x1d93('0x43')]['apikey']){try{var _0x2940b7={'audience':hardwareConf[_0x1d93('0x44')](),'issuer':hardwareConf[_0x1d93('0x44')]()};verifyJwt(_0x2d3ab2['query'][_0x1d93('0x45')],_0x2940b7)['then'](function(_0x3f7843){return db[_0x1d93('0x46')]['find']({'where':{'id':_0x3f7843[_0x1d93('0x47')]}})[_0x1d93('0x32')](function(_0x208c79){_0x2b9a3c=_0x208c79;return db['Setting'][_0x1d93('0x2e')]({'where':{'id':0x1},'attributes':[_0x1d93('0x48'),_0x1d93('0x49')],'raw':!![]});})['then'](function(_0x168bbf){if(!_0x2b9a3c||!_['isEqual'](_0x2b9a3c[_0x1d93('0x4a')],_0x3f7843[_0x1d93('0x4b')])){return _0x12ff2c[_0x1d93('0x33')](0x191)[_0x1d93('0x35')]({'message':_0x1d93('0x4c')});}if(_0x2b9a3c[_0x1d93('0x4d')]){return _0x12ff2c[_0x1d93('0x33')](0x191)[_0x1d93('0x35')]({'message':_0x1d93('0x4e')});}if(_0x2b9a3c[_0x1d93('0x4f')]){if(_0x168bbf[_0x1d93('0x49')]>0x0){if(moment(_0x2b9a3c[_0x1d93('0x50')])[_0x1d93('0x51')](_0x168bbf[_0x1d93('0x49')],_0x1d93('0x52'))>moment()){return _0x12ff2c[_0x1d93('0x33')](0x191)[_0x1d93('0x35')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x12ff2c[_0x1d93('0x33')](0x191)[_0x1d93('0x35')]({'message':_0x1d93('0x4e')});}}_0x2d3ab2[_0x1d93('0x2d')]={'id':_0x2b9a3c['id']};_0x348509();});})[_0x1d93('0x38')](function(){return _0x12ff2c[_0x1d93('0x33')](0x191)[_0x1d93('0x35')]({'message':_0x1d93('0x4e')});});}catch(_0x4d905a){_0x348509(_0x4d905a);}}else if(_0x4b6d9b){_0x348509();}else{return _0x12ff2c[_0x1d93('0x33')](0x193)[_0x1d93('0x35')]({'message':_0x1d93('0x53')});}})[_0x1d93('0x39')](function(_0x2f0b3d,_0xf7f1bb,_0x3aa55d){if(_0x2f0b3d[_0x1d93('0x2d')]){db['User'][_0x1d93('0x3e')]({'where':{'id':_0x2f0b3d[_0x1d93('0x2d')]['id']},'attributes':userAttributes})[_0x1d93('0x32')](function(_0x1c065d){if(!_0x1c065d){return _0xf7f1bb['status'](0x194)['json']({'message':_0x1d93('0x54')});}_0x2f0b3d['user']=_0x1c065d;_0x3aa55d();})['catch'](function(_0x19a278){_0x3aa55d(_0x19a278);});}else if(_0x4b6d9b){_0x3aa55d();}else{return _0xf7f1bb[_0x1d93('0x33')](0x194)['json']({'message':_0x1d93('0x55')});}});};exports[_0x1d93('0x56')]=function canUpdate(){return compose()[_0x1d93('0x39')](function(_0x11f6da,_0x5d9edb,_0x3c356c){return licenseUtil['getLicense']()[_0x1d93('0x32')](function(_0x3bdd3c){if(_0x3bdd3c[_0x1d93('0x57')]){_0x3c356c();}else{return _0x5d9edb['status'](0x193)[_0x1d93('0x35')]({'message':'Forbidden'});}})[_0x1d93('0x38')](function(_0x3887a9){_0x3c356c(_0x3887a9);});});};exports[_0x1d93('0x58')]=function isWebrtcLicence(){return compose()[_0x1d93('0x39')](function(_0xe11d8a,_0x390aac,_0x257816){return licenseUtil['getLicense']()[_0x1d93('0x32')](function(_0x5244c0){if(_0x5244c0['webrtc']){_0x257816();}else{return _0x390aac[_0x1d93('0x33')](0x193)['json']({'message':_0x1d93('0x59')});}})['catch'](function(_0x38a75e){_0x257816(_0x38a75e);});});};exports['isMiddleware']=function(_0x399a2f,_0x187d90,_0x599150){_0x399a2f[_0x1d93('0x5a')]=!![];return _0x599150();};exports[_0x1d93('0x5b')]=function signToken(_0x569ebe){return signJwt(_0x569ebe);};exports[_0x1d93('0x5c')]=function(_0x43442e,_0x4944e8){if(!_0x43442e['user']){return _0x4944e8[_0x1d93('0x33')](0x194)[_0x1d93('0x35')]({'message':_0x1d93('0x5d')});}var _0x36ce55={'payload':{'id':_0x43442e[_0x1d93('0x2d')]['id'],'role':_0x43442e[_0x1d93('0x2d')][_0x1d93('0x9')]},'options':{'expiresIn':0x15180}};return signJwt(_0x36ce55)[_0x1d93('0x32')](function(_0x2b75df){_0x4944e8[_0x1d93('0x5e')](_0x1d93('0x5f'),_0x2b75df);_0x4944e8[_0x1d93('0x60')](_0x1d93('0x61'));})[_0x1d93('0x38')](function(_0x1d8ec5){return _0x4944e8['status'](0x1f4)[_0x1d93('0x62')](_0x1d8ec5);});};exports[_0x1d93('0x63')]=function(_0x1c50af){if(_['isNil'](_0x1c50af['apiKeyNonce'])||_[_0x1d93('0x64')](_0x1c50af[_0x1d93('0x65')])){return null;}else{return createJwt(_0x1c50af);}};exports['generateApiKey']=function(_0x246398){_0x246398[_0x1d93('0x4a')]=generateNonce();_0x246398[_0x1d93('0x65')]=generateIssuedAt();return createJwt(_0x246398);};exports['regenerateApiKey']=function(_0x16d17c,_0x23c85c){var _0x16edde=_0x16d17c[_0x1d93('0x43')]['apikey'];if(_0x16edde){var _0x1ed53a={'nonce':_0x23c85c[_0x1d93('0x4a')],'iat':_0x23c85c[_0x1d93('0x65')],'audience':hardwareConf[_0x1d93('0x44')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x16edde,_0x1ed53a)[_0x1d93('0x32')](function(){return generateApiKey(_0x23c85c);});}else{throw{'message':_0x1d93('0x66')};}};exports[_0x1d93('0x67')]=function(_0x4f1fe9){var _0x1d3ef9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x1d3ef9[_0x1d93('0x68')](_0x4f1fe9))throw new db[(_0x1d93('0x69'))][(_0x1d93('0x6a'))](_0x1d93('0x6b'));return;};exports['validatePasswordHistory']=function(_0x5acec0,_0x461b77,_0x1da6c6){var _0x511dfb=encryptor[_0x1d93('0x6c')](_0x461b77)['split'](',');for(var _0x11e2e4=0x0;_0x11e2e4<_0x1da6c6;_0x11e2e4++){if(!_0x511dfb[_0x11e2e4])break;if(_0x5acec0[_0x1d93('0x6d')]()===_0x511dfb[_0x11e2e4][_0x1d93('0x6d')]()){var _0x1f2362=util[_0x1d93('0x6e')](_0x1d93('0x6f'),_0x1da6c6);if(_0x1da6c6===0x1){_0x1f2362=_0x1d93('0x70');}throw new db['Sequelize']['ValidationError'](_0x1f2362);}}return;};exports[_0x1d93('0x71')]=function(_0xb13932,_0x40afc7){var _0x3233e1=_0x40afc7?encryptor[_0x1d93('0x6c')](_0x40afc7)[_0x1d93('0x72')](','):[];if(_0x3233e1['length']===0x5){_0x3233e1[_0x1d93('0x73')](-0x1,0x1);}_0x3233e1[_0x1d93('0x74')](_0xb13932);return encryptor[_0x1d93('0x75')](_0x3233e1[_0x1d93('0x76')](','));};function signJwt(_0x269bab){var _0x1fba08=BPromise[_0x1d93('0x77')](jwt[_0x1d93('0x78')],{'context':jwt});var _0x4d7b0d=_0x269bab[_0x1d93('0x79')]||config['secrets'][_0x1d93('0x8')];return new BPromise(function(_0x2b1ee2,_0x30065f){_0x1fba08(_0x269bab[_0x1d93('0x7a')],_0x4d7b0d,_0x269bab[_0x1d93('0x7b')])[_0x1d93('0x32')](function(_0x312cdd){_0x2b1ee2(_0x312cdd);})[_0x1d93('0x38')](function(_0x7d3713){_0x30065f(_0x7d3713);});});}function verifyJwt(_0x555c5c,_0x480f62,_0x4fcc9e){var _0x1a43e4=BPromise[_0x1d93('0x77')](jwt[_0x1d93('0x7c')],{'context':jwt});var _0x52e0eb=_0x4fcc9e||config[_0x1d93('0x7d')][_0x1d93('0x8')];return new BPromise(function(_0x3541b3,_0x33a3da){_0x1a43e4(_0x555c5c,_0x52e0eb,_0x480f62)[_0x1d93('0x32')](function(_0x351d09){_0x3541b3(_0x351d09);})['catch'](function(_0x458f9d){_0x33a3da(_0x458f9d);});});}function generateNonce(){return crypto[_0x1d93('0x7e')](0x10)[_0x1d93('0x7f')]('hex');}function generateIssuedAt(){return Math[_0x1d93('0x80')](Date[_0x1d93('0x81')]()/0x3e8)['toString']();}function createJwt(_0x31786d){var _0x18a3bb={'payload':{'iat':_0x31786d[_0x1d93('0x65')],'nonce':_0x31786d[_0x1d93('0x4a')]},'options':{'algorithm':'HS512','subject':_0x31786d['id'][_0x1d93('0x7f')](),'issuer':hardwareConf[_0x1d93('0x44')](),'audience':hardwareConf[_0x1d93('0x44')]()}};return signJwt(_0x18a3bb)[_0x1d93('0x32')](function(_0x5cd477){return{'iat':_0x31786d[_0x1d93('0x65')],'nonce':_0x31786d['apiKeyNonce'],'token':_0x5cd477};});} \ No newline at end of file +var _0x44c7=['User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','cookie','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Sequelize','validatePasswordHistory','decryptString','toLowerCase','format','updatePasswordsHistory','split','length','splice','unshift','join','promisify','sign','secret','payload','options','verify','randomBytes','toString','hex','floor','now','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','composable-middleware','basic-auth','bluebird','util','moment','secrets','session','role','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','ignorePauseForPreviewCalls','selectRecallMeCampaign','isChatInteractionAuthorized','isAuthenticated','use','user','findOne','params','closed','disposition','then','status','unmanaged','json','catch','authorization','startsWith','headers','Basic','User','find','authenticate','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','getUuid','query','apikey','Setting','allowedLoginAttempts','blockDuration','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blockedAt','add','minutes','User\x20not\x20found.'];(function(_0x512407,_0x536ec8){var _0x3c7e61=function(_0x4fe690){while(--_0x4fe690){_0x512407['push'](_0x512407['shift']());}};_0x3c7e61(++_0x536ec8);}(_0x44c7,0xa7));var _0x744c=function(_0x2956ed,_0x3e62f0){_0x2956ed=_0x2956ed-0x0;var _0x1deefd=_0x44c7[_0x2956ed];return _0x1deefd;};'use strict';var db=require(_0x744c('0x0'))['db'];var config=require(_0x744c('0x1'));var hardwareConf=require(_0x744c('0x2'));var licenseUtil=require(_0x744c('0x3'));var encryptor=require(_0x744c('0x4'));var _=require(_0x744c('0x5'));var jwt=require(_0x744c('0x6'));var expressJwt=require('express-jwt');var compose=require(_0x744c('0x7'));var basicAuth=require(_0x744c('0x8'));var crypto=require('crypto');var BPromise=require(_0x744c('0x9'));var util=require(_0x744c('0xa'));var moment=require(_0x744c('0xb'));var validateJwt=expressJwt({'secret':config[_0x744c('0xc')][_0x744c('0xd')]});var userAttributes=['id',_0x744c('0xe'),_0x744c('0xf'),_0x744c('0x10'),_0x744c('0x11'),_0x744c('0x12'),_0x744c('0x13'),_0x744c('0x14'),_0x744c('0x15'),_0x744c('0x16'),_0x744c('0x17'),'mailPause',_0x744c('0x18'),_0x744c('0x19'),_0x744c('0x1a'),_0x744c('0x1b'),_0x744c('0x1c'),_0x744c('0x1d'),_0x744c('0x1e'),_0x744c('0x1f'),_0x744c('0x20'),_0x744c('0x21'),_0x744c('0x22'),_0x744c('0x23'),_0x744c('0x24'),_0x744c('0x25'),_0x744c('0x26'),'phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired',_0x744c('0x27'),_0x744c('0x28'),_0x744c('0x29'),'interface','userProfileId',_0x744c('0x2a'),_0x744c('0x2b'),_0x744c('0x2c'),_0x744c('0x2d'),_0x744c('0x2e'),'downloadAttachments',_0x744c('0x2f'),_0x744c('0x30')];exports[_0x744c('0x31')]=function(){return this[_0x744c('0x32')](!![])[_0x744c('0x33')](function(_0x165a61,_0x4d6237,_0x1f6ac9){if(_0x165a61[_0x744c('0x34')]){_0x1f6ac9();}else{return db['ChatInteraction'][_0x744c('0x35')]({'where':{'id':_0x165a61[_0x744c('0x36')]['id']},'attributes':['id',_0x744c('0x37'),_0x744c('0x38')],'raw':!![]})[_0x744c('0x39')](function(_0x5317d4){if(_0x5317d4&&_0x5317d4[_0x744c('0x37')]){return _0x4d6237[_0x744c('0x3a')](_0x5317d4[_0x744c('0x38')]===_0x744c('0x3b')?0x195:0x193)[_0x744c('0x3c')]({'message':_0x5317d4[_0x744c('0x38')]===_0x744c('0x3b')?'Unmanaged.':'Forbidden.'});}else{_0x1f6ac9();}})[_0x744c('0x3d')](function(_0x29fdbc){_0x1f6ac9(_0x29fdbc);});}});};exports[_0x744c('0x32')]=function isAuthenticated(_0x518def){return compose()[_0x744c('0x33')](function(_0x2c608f,_0x3fe6fe,_0x30cae1){var _0xf2de1e;if(_0x2c608f['headers'][_0x744c('0x3e')]){if(_[_0x744c('0x3f')](_0x2c608f[_0x744c('0x40')][_0x744c('0x3e')],_0x744c('0x41'))){var _0x743450=basicAuth(_0x2c608f);db[_0x744c('0x42')][_0x744c('0x43')]({'where':{'name':_0x743450[_0x744c('0x10')]}})[_0x744c('0x39')](function(_0x28bede){if(!_0x28bede||!_0x28bede[_0x744c('0x44')](_0x743450[_0x744c('0x45')])){return _0x3fe6fe['status'](0x191)[_0x744c('0x3c')]({'message':_0x744c('0x46')});}_0x2c608f[_0x744c('0x34')]={'id':_0x28bede['id']};_0x30cae1();})[_0x744c('0x3d')](function(_0x36a37c){_0x30cae1(_0x36a37c);});}else if(_[_0x744c('0x3f')](_0x2c608f['headers'][_0x744c('0x3e')],_0x744c('0x47'))){validateJwt(_0x2c608f,_0x3fe6fe,_0x30cae1);}else{if(_0x518def){_0x30cae1();}else{return _0x3fe6fe[_0x744c('0x3a')](0x193)[_0x744c('0x3c')]({'message':_0x744c('0x48')});}}}else if(_0x2c608f['query']['apikey']){try{var _0x3c2381={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x744c('0x49')]()};verifyJwt(_0x2c608f[_0x744c('0x4a')][_0x744c('0x4b')],_0x3c2381)[_0x744c('0x39')](function(_0x27c4d6){return db['User'][_0x744c('0x43')]({'where':{'id':_0x27c4d6['sub']}})[_0x744c('0x39')](function(_0x1444de){_0xf2de1e=_0x1444de;return db[_0x744c('0x4c')][_0x744c('0x35')]({'where':{'id':0x1},'attributes':[_0x744c('0x4d'),_0x744c('0x4e')],'raw':!![]});})['then'](function(_0x58ae0b){if(!_0xf2de1e||!_['isEqual'](_0xf2de1e[_0x744c('0x4f')],_0x27c4d6['nonce'])){return _0x3fe6fe[_0x744c('0x3a')](0x191)[_0x744c('0x3c')]({'message':_0x744c('0x50')});}if(_0xf2de1e[_0x744c('0x51')]){return _0x3fe6fe[_0x744c('0x3a')](0x191)[_0x744c('0x3c')]({'message':_0x744c('0x52')});}if(_0xf2de1e['blocked']){if(_0x58ae0b['blockDuration']>0x0){if(moment(_0xf2de1e[_0x744c('0x53')])[_0x744c('0x54')](_0x58ae0b[_0x744c('0x4e')],_0x744c('0x55'))>moment()){return _0x3fe6fe[_0x744c('0x3a')](0x191)[_0x744c('0x3c')]({'message':_0x744c('0x52')});}}else{return _0x3fe6fe['status'](0x191)[_0x744c('0x3c')]({'message':_0x744c('0x52')});}}_0x2c608f[_0x744c('0x34')]={'id':_0xf2de1e['id']};_0x30cae1();});})[_0x744c('0x3d')](function(){return _0x3fe6fe['status'](0x191)[_0x744c('0x3c')]({'message':_0x744c('0x52')});});}catch(_0x200ac6){_0x30cae1(_0x200ac6);}}else if(_0x518def){_0x30cae1();}else{return _0x3fe6fe[_0x744c('0x3a')](0x193)[_0x744c('0x3c')]({'message':_0x744c('0x48')});}})[_0x744c('0x33')](function(_0x1b208b,_0x3f6889,_0x1db733){if(_0x1b208b[_0x744c('0x34')]){db['User'][_0x744c('0x43')]({'where':{'id':_0x1b208b['user']['id']},'attributes':userAttributes})[_0x744c('0x39')](function(_0x3fdbd4){if(!_0x3fdbd4){return _0x3f6889[_0x744c('0x3a')](0x194)[_0x744c('0x3c')]({'message':_0x744c('0x56')});}_0x1b208b[_0x744c('0x34')]=_0x3fdbd4;_0x1db733();})[_0x744c('0x3d')](function(_0xa6356a){_0x1db733(_0xa6356a);});}else if(_0x518def){_0x1db733();}else{return _0x3f6889[_0x744c('0x3a')](0x194)[_0x744c('0x3c')]({'message':_0x744c('0x57')});}});};exports[_0x744c('0x58')]=function canUpdate(){return compose()[_0x744c('0x33')](function(_0x36df71,_0x106afb,_0x3e3099){return licenseUtil[_0x744c('0x59')]()[_0x744c('0x39')](function(_0x23eb92){if(_0x23eb92['update']){_0x3e3099();}else{return _0x106afb[_0x744c('0x3a')](0x193)['json']({'message':_0x744c('0x5a')});}})[_0x744c('0x3d')](function(_0xe16746){_0x3e3099(_0xe16746);});});};exports[_0x744c('0x5b')]=function isWebrtcLicence(){return compose()[_0x744c('0x33')](function(_0x331105,_0xa3848b,_0x451c04){return licenseUtil[_0x744c('0x59')]()['then'](function(_0x497655){if(_0x497655[_0x744c('0x5c')]){_0x451c04();}else{return _0xa3848b[_0x744c('0x3a')](0x193)[_0x744c('0x3c')]({'message':_0x744c('0x5a')});}})[_0x744c('0x3d')](function(_0xd8f1ad){_0x451c04(_0xd8f1ad);});});};exports[_0x744c('0x5d')]=function(_0x44f02a,_0x1e050f,_0xa266e){_0x44f02a[_0x744c('0x5d')]=!![];return _0xa266e();};exports[_0x744c('0x5e')]=function signToken(_0x5557b8){return signJwt(_0x5557b8);};exports[_0x744c('0x5f')]=function(_0x42e66e,_0x383f41){if(!_0x42e66e[_0x744c('0x34')]){return _0x383f41[_0x744c('0x3a')](0x194)[_0x744c('0x3c')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x33cfdd={'payload':{'id':_0x42e66e[_0x744c('0x34')]['id'],'role':_0x42e66e['user'][_0x744c('0xe')]},'options':{'expiresIn':0x15180}};return signJwt(_0x33cfdd)['then'](function(_0x2baaa7){_0x383f41[_0x744c('0x60')]('motion.token',_0x2baaa7);_0x383f41[_0x744c('0x61')](_0x744c('0x62'));})['catch'](function(_0x2e0521){return _0x383f41[_0x744c('0x3a')](0x1f4)[_0x744c('0x63')](_0x2e0521);});};exports[_0x744c('0x64')]=function(_0x59df26){if(_[_0x744c('0x65')](_0x59df26[_0x744c('0x4f')])||_[_0x744c('0x65')](_0x59df26[_0x744c('0x66')])){return null;}else{return createJwt(_0x59df26);}};exports[_0x744c('0x67')]=function(_0x2d0a72){_0x2d0a72['apiKeyNonce']=generateNonce();_0x2d0a72[_0x744c('0x66')]=generateIssuedAt();return createJwt(_0x2d0a72);};exports[_0x744c('0x68')]=function(_0x51f3f8,_0x4509c9){var _0x16460a=_0x51f3f8['query'][_0x744c('0x4b')];if(_0x16460a){var _0x8bf0a4={'nonce':_0x4509c9['apiKeyNonce'],'iat':_0x4509c9[_0x744c('0x66')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x744c('0x49')]()};return verifyJwt(_0x16460a,_0x8bf0a4)[_0x744c('0x39')](function(){return generateApiKey(_0x4509c9);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports['validatePasswordPattern']=function(_0x544fc1){var _0x575a15=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x575a15['test'](_0x544fc1))throw new db[(_0x744c('0x69'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x744c('0x6a')]=function(_0xb5115b,_0x39a830,_0x304462){var _0x142b5c=encryptor[_0x744c('0x6b')](_0x39a830)['split'](',');for(var _0x3035d9=0x0;_0x3035d9<_0x304462;_0x3035d9++){if(!_0x142b5c[_0x3035d9])break;if(_0xb5115b['toLowerCase']()===_0x142b5c[_0x3035d9][_0x744c('0x6c')]()){var _0x12decf=util[_0x744c('0x6d')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x304462);if(_0x304462===0x1){_0x12decf='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x744c('0x69'))]['ValidationError'](_0x12decf);}}return;};exports[_0x744c('0x6e')]=function(_0x1578d0,_0xfe3101){var _0x374974=_0xfe3101?encryptor[_0x744c('0x6b')](_0xfe3101)[_0x744c('0x6f')](','):[];if(_0x374974[_0x744c('0x70')]===0x5){_0x374974[_0x744c('0x71')](-0x1,0x1);}_0x374974[_0x744c('0x72')](_0x1578d0);return encryptor['encryptString'](_0x374974[_0x744c('0x73')](','));};function signJwt(_0x25721d){var _0x1e4cf9=BPromise[_0x744c('0x74')](jwt[_0x744c('0x75')],{'context':jwt});var _0x463858=_0x25721d[_0x744c('0x76')]||config['secrets']['session'];return new BPromise(function(_0x1ba5cc,_0x5ea882){_0x1e4cf9(_0x25721d[_0x744c('0x77')],_0x463858,_0x25721d[_0x744c('0x78')])[_0x744c('0x39')](function(_0x19c2e2){_0x1ba5cc(_0x19c2e2);})[_0x744c('0x3d')](function(_0x49eaa4){_0x5ea882(_0x49eaa4);});});}function verifyJwt(_0x14a5a0,_0x5c589b,_0x195e57){var _0x3d4be0=BPromise[_0x744c('0x74')](jwt[_0x744c('0x79')],{'context':jwt});var _0x43c502=_0x195e57||config[_0x744c('0xc')][_0x744c('0xd')];return new BPromise(function(_0x52122c,_0x36a168){_0x3d4be0(_0x14a5a0,_0x43c502,_0x5c589b)[_0x744c('0x39')](function(_0xf69ac7){_0x52122c(_0xf69ac7);})[_0x744c('0x3d')](function(_0x83dd07){_0x36a168(_0x83dd07);});});}function generateNonce(){return crypto[_0x744c('0x7a')](0x10)[_0x744c('0x7b')](_0x744c('0x7c'));}function generateIssuedAt(){return Math[_0x744c('0x7d')](Date[_0x744c('0x7e')]()/0x3e8)[_0x744c('0x7b')]();}function createJwt(_0x31cd2f){var _0x103e36={'payload':{'iat':_0x31cd2f[_0x744c('0x66')],'nonce':_0x31cd2f[_0x744c('0x4f')]},'options':{'algorithm':'HS512','subject':_0x31cd2f['id'][_0x744c('0x7b')](),'issuer':hardwareConf[_0x744c('0x49')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x103e36)['then'](function(_0x3383a2){return{'iat':_0x31cd2f['apiKeyIat'],'nonce':_0x31cd2f['apiKeyNonce'],'token':_0x3383a2};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 3fbee06..08919e8 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 _0xe8df=['write','end','final','binary','close','unlink','decryptFile','data','update','encryptString','secret','utf8','base64','decryptString','createDecipher','bluebird','lodash','../../config/environment','../../config/logger','session','aes-256-ctr','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher'];(function(_0x2a40b3,_0xe1c253){var _0x4ac6cb=function(_0x5083fe){while(--_0x5083fe){_0x2a40b3['push'](_0x2a40b3['shift']());}};_0x4ac6cb(++_0xe1c253);}(_0xe8df,0x141));var _0xfe8d=function(_0x1036bb,_0x3df1ce){_0x1036bb=_0x1036bb-0x0;var _0x5267e1=_0xe8df[_0x1036bb];return _0x5267e1;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0xfe8d('0x0'));var _=require(_0xfe8d('0x1'));var config=require(_0xfe8d('0x2'));var logger=require(_0xfe8d('0x3'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0xfe8d('0x4')],'algorithm':_0xfe8d('0x5')};const fileOptions={'algorithm':'aes192'};if(config[_0xfe8d('0x6')]&&config[_0xfe8d('0x6')][_0xfe8d('0x7')]){var isSupported=isAlgorithmSupported(config[_0xfe8d('0x6')][_0xfe8d('0x7')]);if(isSupported){fileOptions[_0xfe8d('0x7')]=config[_0xfe8d('0x6')][_0xfe8d('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xfe8d('0x8')](',\x20');logger['error'](config[_0xfe8d('0x6')][_0xfe8d('0x7')],_0xfe8d('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0x104819){return AES_SUPPORTED_RX[_0xfe8d('0xa')](_0x104819);}function getSupportedCiphers(){return crypto[_0xfe8d('0xb')]()[_0xfe8d('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x9f4996){return getSupportedCiphers()[_0xfe8d('0xd')](_0x9f4996)>-0x1;}function combineOptions(_0x467a98){var _0x44c4e4={};for(var _0x31fa89 in fileOptions){if(fileOptions[_0xfe8d('0xe')](_0x31fa89)){_0x44c4e4[_0x31fa89]=fileOptions[_0x31fa89];}}if(_0x467a98){for(var _0x1aed31 in _0x467a98){if(_0x467a98[_0xfe8d('0xe')](_0x1aed31)){_0x44c4e4[_0x1aed31]=_0x467a98[_0x1aed31];}}}return _0x44c4e4;}exports[_0xfe8d('0xf')]=function(_0x45a43f,_0x1dd774,_0x17e497,_0xf1ea5c){return new BPromise(function(_0x5b9e79,_0x240c60){_0xf1ea5c=combineOptions(_0xf1ea5c);var _0x2ea6fd=new Buffer(_0x17e497);var _0xbedf5d=fs[_0xfe8d('0x10')](_0x45a43f);var _0x442af9=fs[_0xfe8d('0x11')](_0x1dd774);var _0x334e20=crypto[_0xfe8d('0x12')](_0xf1ea5c[_0xfe8d('0x7')],_0x2ea6fd);_0xbedf5d['on']('data',function(_0x377b42){var _0x4c356d=new Buffer(_0x334e20['update'](_0x377b42),'binary');_0x442af9[_0xfe8d('0x13')](_0x4c356d);});_0xbedf5d['on'](_0xfe8d('0x14'),function(){try{var _0x16bbcf=new Buffer(_0x334e20[_0xfe8d('0x15')]('binary'),_0xfe8d('0x16'));_0x442af9[_0xfe8d('0x13')](_0x16bbcf);_0x442af9[_0xfe8d('0x14')]();_0x442af9['on'](_0xfe8d('0x17'),function(){return _0x5b9e79(_0x1dd774);});}catch(_0x252663){fs[_0xfe8d('0x18')](_0x1dd774);return _0x240c60(_0x252663);}});});};exports[_0xfe8d('0x19')]=function(_0x14ecfc,_0x565e46,_0x24d52f,_0x304b02){return new BPromise(function(_0x3d95c1,_0x5c70e5){_0x304b02=combineOptions(_0x304b02);var _0x3e7ca2=new Buffer(_0x24d52f);var _0x11e473=fs['createReadStream'](_0x14ecfc);var _0x490429=fs['createWriteStream'](_0x565e46);var _0x132465=crypto['createDecipher'](_0x304b02[_0xfe8d('0x7')],_0x3e7ca2);_0x11e473['on'](_0xfe8d('0x1a'),function(_0x5c8398){var _0x1f204f=new Buffer(_0x132465[_0xfe8d('0x1b')](_0x5c8398),_0xfe8d('0x16'));_0x490429['write'](_0x1f204f);});_0x11e473['on']('end',function(){try{var _0x57b306=new Buffer(_0x132465[_0xfe8d('0x15')]('binary'),'binary');_0x490429[_0xfe8d('0x13')](_0x57b306);_0x490429[_0xfe8d('0x14')]();_0x490429['on']('close',function(){return _0x3d95c1(_0x565e46);});}catch(_0x37ee1a){fs[_0xfe8d('0x18')](_0x565e46);return _0x5c70e5(_0x37ee1a);}});});};exports[_0xfe8d('0x1c')]=function(_0x5ebe58,_0x2c7081,_0x5c5239){var _0x35bb0d=_0x5c5239||stringOptions[_0xfe8d('0x7')];var _0x23952d=_0x2c7081||stringOptions[_0xfe8d('0x1d')];var _0x25cc53=crypto[_0xfe8d('0x12')](_0x35bb0d,_0x23952d);var _0x4faefd=_0x25cc53[_0xfe8d('0x1b')](_0x5ebe58,_0xfe8d('0x1e'),'base64');_0x4faefd+=_0x25cc53[_0xfe8d('0x15')](_0xfe8d('0x1f'));return _0x4faefd;};exports[_0xfe8d('0x20')]=function(_0x552585,_0x44d8ae,_0x1dc001){var _0x24d1cb=_0x1dc001||stringOptions[_0xfe8d('0x7')];var _0x4683fd=_0x44d8ae||stringOptions[_0xfe8d('0x1d')];var _0xd34c17=crypto[_0xfe8d('0x21')](_0x24d1cb,_0x4683fd);var _0x3535ca=_0xd34c17[_0xfe8d('0x1b')](_0x552585,_0xfe8d('0x1f'),_0xfe8d('0x1e'));_0x3535ca+=_0xd34c17[_0xfe8d('0x15')](_0xfe8d('0x1e'));return _0x3535ca;}; \ No newline at end of file +var _0x12b5=['createCipher','utf8','base64','secret','lodash','../../config/environment','../../config/logger','secrets','session','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','write','end','final','binary','close','unlink','createDecipher','data','update'];(function(_0x1b76fd,_0x6f361e){var _0x5406c6=function(_0x2ae044){while(--_0x2ae044){_0x1b76fd['push'](_0x1b76fd['shift']());}};_0x5406c6(++_0x6f361e);}(_0x12b5,0x144));var _0x512b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x12b5[_0x14add3];return _0x4a174f;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x512b('0x0'));var config=require(_0x512b('0x1'));var logger=require(_0x512b('0x2'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x512b('0x3')][_0x512b('0x4')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x512b('0x5')};if(config[_0x512b('0x6')]&&config['encrypt']['algorithm']){var isSupported=isAlgorithmSupported(config[_0x512b('0x6')]['algorithm']);if(isSupported){fileOptions[_0x512b('0x7')]=config[_0x512b('0x6')][_0x512b('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x512b('0x8')](',\x20');logger[_0x512b('0x9')](config['encrypt'][_0x512b('0x7')],_0x512b('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x2a5484){return AES_SUPPORTED_RX[_0x512b('0xb')](_0x2a5484);}function getSupportedCiphers(){return crypto[_0x512b('0xc')]()[_0x512b('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x23ea54){return getSupportedCiphers()[_0x512b('0xe')](_0x23ea54)>-0x1;}function combineOptions(_0x4533ea){var _0x219f3b={};for(var _0x3809f6 in fileOptions){if(fileOptions['hasOwnProperty'](_0x3809f6)){_0x219f3b[_0x3809f6]=fileOptions[_0x3809f6];}}if(_0x4533ea){for(var _0x11a837 in _0x4533ea){if(_0x4533ea[_0x512b('0xf')](_0x11a837)){_0x219f3b[_0x11a837]=_0x4533ea[_0x11a837];}}}return _0x219f3b;}exports[_0x512b('0x10')]=function(_0x451f28,_0x565028,_0x35aed2,_0x23e86c){return new BPromise(function(_0x17db5a,_0x5c37a1){_0x23e86c=combineOptions(_0x23e86c);var _0x115e34=new Buffer(_0x35aed2);var _0x5804d8=fs[_0x512b('0x11')](_0x451f28);var _0x4930fa=fs[_0x512b('0x12')](_0x565028);var _0x40fe5c=crypto['createCipher'](_0x23e86c[_0x512b('0x7')],_0x115e34);_0x5804d8['on']('data',function(_0x5e3ee1){var _0x32618a=new Buffer(_0x40fe5c['update'](_0x5e3ee1),'binary');_0x4930fa[_0x512b('0x13')](_0x32618a);});_0x5804d8['on'](_0x512b('0x14'),function(){try{var _0x449d41=new Buffer(_0x40fe5c[_0x512b('0x15')](_0x512b('0x16')),_0x512b('0x16'));_0x4930fa['write'](_0x449d41);_0x4930fa['end']();_0x4930fa['on'](_0x512b('0x17'),function(){return _0x17db5a(_0x565028);});}catch(_0x4c036a){fs[_0x512b('0x18')](_0x565028);return _0x5c37a1(_0x4c036a);}});});};exports['decryptFile']=function(_0x1cd291,_0x14b8c5,_0x41373c,_0x3fd3d1){return new BPromise(function(_0x4bd164,_0x42eee8){_0x3fd3d1=combineOptions(_0x3fd3d1);var _0x503871=new Buffer(_0x41373c);var _0x3face5=fs[_0x512b('0x11')](_0x1cd291);var _0x226f7e=fs[_0x512b('0x12')](_0x14b8c5);var _0x47fcdd=crypto[_0x512b('0x19')](_0x3fd3d1[_0x512b('0x7')],_0x503871);_0x3face5['on'](_0x512b('0x1a'),function(_0x1d2722){var _0x1e2eed=new Buffer(_0x47fcdd[_0x512b('0x1b')](_0x1d2722),_0x512b('0x16'));_0x226f7e[_0x512b('0x13')](_0x1e2eed);});_0x3face5['on'](_0x512b('0x14'),function(){try{var _0x4b6187=new Buffer(_0x47fcdd[_0x512b('0x15')](_0x512b('0x16')),'binary');_0x226f7e[_0x512b('0x13')](_0x4b6187);_0x226f7e[_0x512b('0x14')]();_0x226f7e['on'](_0x512b('0x17'),function(){return _0x4bd164(_0x14b8c5);});}catch(_0x47c590){fs[_0x512b('0x18')](_0x14b8c5);return _0x42eee8(_0x47c590);}});});};exports['encryptString']=function(_0x532bdb,_0x296c3a,_0xcd3a9d){var _0x2d7f91=_0xcd3a9d||stringOptions[_0x512b('0x7')];var _0x57a739=_0x296c3a||stringOptions['secret'];var _0x54c909=crypto[_0x512b('0x1c')](_0x2d7f91,_0x57a739);var _0x38f8d1=_0x54c909[_0x512b('0x1b')](_0x532bdb,_0x512b('0x1d'),'base64');_0x38f8d1+=_0x54c909[_0x512b('0x15')](_0x512b('0x1e'));return _0x38f8d1;};exports['decryptString']=function(_0x33b2bb,_0x27bbe5,_0x186251){var _0x5b692b=_0x186251||stringOptions[_0x512b('0x7')];var _0x30218b=_0x27bbe5||stringOptions[_0x512b('0x1f')];var _0x175935=crypto[_0x512b('0x19')](_0x5b692b,_0x30218b);var _0x4209a5=_0x175935['update'](_0x33b2bb,'base64','utf8');_0x4209a5+=_0x175935[_0x512b('0x15')](_0x512b('0x1d'));return _0x4209a5;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 8578019..5676548 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 _0x67f4=['Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','to-csv','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','argv','savename','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','then','splitSizeCsv','sequelize','query','QueryTypes','SELECT','num','Empty','length','isInteger','push','format','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','%s.%s','csv','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed'];(function(_0x27c42c,_0x2ba003){var _0x1256c=function(_0x2cfeb7){while(--_0x2cfeb7){_0x27c42c['push'](_0x27c42c['shift']());}};_0x1256c(++_0x2ba003);}(_0x67f4,0x9b));var _0x467f=function(_0x441075,_0x1b2e02){_0x441075=_0x441075-0x0;var _0x32e203=_0x67f4[_0x441075];return _0x32e203;};'use strict';var util=require(_0x467f('0x0'));var path=require(_0x467f('0x1'));var _=require(_0x467f('0x2'));var csv=require(_0x467f('0x3'));var fs=require('fs');var BPromise=require(_0x467f('0x4'));var zipdir=require(_0x467f('0x5'));var rimraf=require('rimraf');var db=require(_0x467f('0x6'))['db'];var dbH=require(_0x467f('0x6'))[_0x467f('0x7')];var logger=require(_0x467f('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x467f('0x9')][0x3];var PATH=process[_0x467f('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x256c35,_0x2b1b22){var _0x3a317e={'status':_0x256c35};var _0x2e545a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2b1b22){_0x3a317e[_0x467f('0xa')]=_0x2b1b22;}return db['AnalyticExtractedReport'][_0x467f('0xb')](_0x3a317e,_0x2e545a);}function main(){var _0x3007b5=0x1388;var _0x31c792;logger[_0x467f('0xc')](util['format'](_0x467f('0xd'),EXTRACTED_REPORT_ID,_0x467f('0xe')));return db[_0x467f('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x467f('0x10'),'splitSizeCsv']})[_0x467f('0x11')](function(_0x438ceb){if(_0x438ceb){_0x31c792=_0x438ceb;_0x3007b5=_0x31c792[_0x467f('0x12')]||0x1388;}})[_0x467f('0x11')](function(){return dbH[_0x467f('0x13')][_0x467f('0x14')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x467f('0x13')][_0x467f('0x15')][_0x467f('0x16')]});})['then'](function(_0x396952){if(!_0x396952[0x0][_0x467f('0x17')]){return analyticExtractedReport(_0x467f('0x18'));}var _0x316c36=[];var _0x136b5e=0x0;if(_0x31c792[_0x467f('0x10')]){if(_0x396952&&_0x396952[_0x467f('0x19')]){var _0x173793=_['range'](_0x396952[0x0][_0x467f('0x17')]/_0x3007b5);var _0x1409b5=Number[_0x467f('0x1a')](_0x396952[0x0][_0x467f('0x17')]/_0x3007b5)?_0x396952[0x0][_0x467f('0x17')]%_0x3007b5:0x0;_0x173793['forEach'](function(_0x38321d){if(_0x38321d>0x0){_0x136b5e+=_0x3007b5;}_0x316c36[_0x467f('0x1b')](dbH[_0x467f('0x13')]['query'](util[_0x467f('0x1c')](_0x467f('0x1d'),QUERY,_0x3007b5,_0x136b5e),{'type':dbH[_0x467f('0x13')][_0x467f('0x15')][_0x467f('0x16')]}));});if(_0x1409b5>0x0){_0x136b5e+=_0x3007b5;_0x316c36['push'](dbH[_0x467f('0x13')][_0x467f('0x14')](util[_0x467f('0x1c')](_0x467f('0x1d'),QUERY,_0x1409b5,_0x136b5e),{'type':dbH['sequelize']['QueryTypes'][_0x467f('0x16')]}));}}}else{_0x316c36[_0x467f('0x1b')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x467f('0x13')][_0x467f('0x15')][_0x467f('0x16')]}));}var _0x44e26b=path[_0x467f('0x1e')](PATH);var _0x56b55a=path[_0x467f('0x1f')](PATH,_0x467f('0x20'));var _0x463a2b=_0x31c792[_0x467f('0x10')]&&_0x316c36['length']>0x1;var _0x29ca0e=[];if(!fs[_0x467f('0x21')](path[_0x467f('0x22')](_0x44e26b,_0x56b55a))&&_0x463a2b){fs[_0x467f('0x23')](path['join'](_0x44e26b,_0x56b55a));}return BPromise[_0x467f('0x24')](_0x316c36,function(_0xaf52b1){_0x29ca0e['push'](_0xaf52b1);})[_0x467f('0x11')](function(){for(var _0x5dce8f=0x0;_0x5dce8f<_0x29ca0e[_0x467f('0x19')];_0x5dce8f+=0x1){var _0x580281;var _0x2ee508=_0x29ca0e[_0x5dce8f];if(_0x463a2b){_0x580281=path[_0x467f('0x22')](_0x44e26b,_0x56b55a,util[_0x467f('0x1c')](_0x467f('0x25'),_0x56b55a,_0x5dce8f,'csv'));}else{_0x580281=path['join'](_0x44e26b,util[_0x467f('0x1c')](_0x467f('0x26'),_0x56b55a,_0x467f('0x27')));}fs[_0x467f('0x28')](_0x580281,csv(_0x2ee508));}})['then'](function(){if(_0x463a2b){return new Promise(function(_0x46773f){zipdir(path[_0x467f('0x22')](_0x44e26b,_0x56b55a),{'saveTo':path[_0x467f('0x22')](_0x44e26b,util['format'](_0x467f('0x26'),_0x56b55a,_0x467f('0x29')))},function(_0x471f52,_0x18c27c){rimraf(path['join'](_0x44e26b,_0x56b55a),function(){});_0x46773f(_0x467f('0x2a'));});});}})['then'](function(){logger[_0x467f('0xc')](util['format'](_0x467f('0x2b'),EXTRACTED_REPORT_ID,_0x467f('0xe')));return analyticExtractedReport(_0x467f('0x2c'),_0x463a2b?util[_0x467f('0x1c')](_0x467f('0x26'),_0x56b55a,_0x463a2b?'zip':_0x467f('0x27')):null);});})['catch'](function(_0x1462e5){logger[_0x467f('0xc')](util[_0x467f('0x1c')](_0x467f('0x2d'),EXTRACTED_REPORT_ID,_0x467f('0xe')),util[_0x467f('0x2e')](_0x1462e5,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x467f('0x2f'));})[_0x467f('0x30')](function(){process[_0x467f('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x9f97=['sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','split','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','length','existsSync','join','mkdirSync','%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','finally','exit','util','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','splitSizeCsv','then'];(function(_0x10531e,_0x374772){var _0x23a667=function(_0x18da96){while(--_0x18da96){_0x10531e['push'](_0x10531e['shift']());}};_0x23a667(++_0x374772);}(_0x9f97,0x184));var _0x79f9=function(_0x5976f8,_0x1265b7){_0x5976f8=_0x5976f8-0x0;var _0x179715=_0x9f97[_0x5976f8];return _0x179715;};'use strict';var util=require(_0x79f9('0x0'));var path=require('path');var _=require(_0x79f9('0x1'));var csv=require(_0x79f9('0x2'));var fs=require('fs');var BPromise=require(_0x79f9('0x3'));var zipdir=require(_0x79f9('0x4'));var rimraf=require(_0x79f9('0x5'));var db=require(_0x79f9('0x6'))['db'];var dbH=require(_0x79f9('0x6'))[_0x79f9('0x7')];var logger=require('../../config/logger')(_0x79f9('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x79f9('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x79f9('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4ba07e,_0x4ebff5){var _0x51885c={'status':_0x4ba07e};var _0x4050d8={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4ebff5){_0x51885c[_0x79f9('0xa')]=_0x4ebff5;}return db[_0x79f9('0xb')]['update'](_0x51885c,_0x4050d8);}function main(){var _0x3deab8=0x1388;var _0x21b9f4;logger[_0x79f9('0xc')](util[_0x79f9('0xd')](_0x79f9('0xe'),EXTRACTED_REPORT_ID,_0x79f9('0xf')));return db[_0x79f9('0x10')][_0x79f9('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x79f9('0x12')]})[_0x79f9('0x13')](function(_0x4ac131){if(_0x4ac131){_0x21b9f4=_0x4ac131;_0x3deab8=_0x21b9f4[_0x79f9('0x12')]||0x1388;}})[_0x79f9('0x13')](function(){return dbH[_0x79f9('0x14')][_0x79f9('0x15')](util[_0x79f9('0xd')](_0x79f9('0x16'),QUERY),{'type':dbH[_0x79f9('0x14')][_0x79f9('0x17')][_0x79f9('0x18')]});})['then'](function(_0x5c780e){if(!_0x5c780e[0x0][_0x79f9('0x19')]){return analyticExtractedReport(_0x79f9('0x1a'));}var _0x3d46ae=[];var _0x5e5202=0x0;if(_0x21b9f4[_0x79f9('0x1b')]){if(_0x5c780e&&_0x5c780e['length']){var _0x464942=_['range'](_0x5c780e[0x0]['num']/_0x3deab8);var _0x265663=Number[_0x79f9('0x1c')](_0x5c780e[0x0]['num']/_0x3deab8)?_0x5c780e[0x0][_0x79f9('0x19')]%_0x3deab8:0x0;_0x464942[_0x79f9('0x1d')](function(_0x5d42fa){if(_0x5d42fa>0x0){_0x5e5202+=_0x3deab8;}_0x3d46ae[_0x79f9('0x1e')](dbH[_0x79f9('0x14')][_0x79f9('0x15')](util[_0x79f9('0xd')](_0x79f9('0x1f'),QUERY,_0x3deab8,_0x5e5202),{'type':dbH[_0x79f9('0x14')]['QueryTypes'][_0x79f9('0x18')]}));});if(_0x265663>0x0){_0x5e5202+=_0x3deab8;_0x3d46ae[_0x79f9('0x1e')](dbH[_0x79f9('0x14')][_0x79f9('0x15')](util[_0x79f9('0xd')](_0x79f9('0x1f'),QUERY,_0x265663,_0x5e5202),{'type':dbH['sequelize']['QueryTypes'][_0x79f9('0x18')]}));}}}else{_0x3d46ae[_0x79f9('0x1e')](dbH[_0x79f9('0x14')][_0x79f9('0x15')](QUERY,{'type':dbH[_0x79f9('0x14')]['QueryTypes'][_0x79f9('0x18')]}));}var _0x3a9648=path[_0x79f9('0x20')](PATH);var _0x4753de=path[_0x79f9('0x21')](PATH,_0x79f9('0x22'));var _0x13b433=_0x21b9f4[_0x79f9('0x1b')]&&_0x3d46ae[_0x79f9('0x23')]>0x1;var _0x5bd343=[];if(!fs[_0x79f9('0x24')](path[_0x79f9('0x25')](_0x3a9648,_0x4753de))&&_0x13b433){fs[_0x79f9('0x26')](path[_0x79f9('0x25')](_0x3a9648,_0x4753de));}return BPromise['each'](_0x3d46ae,function(_0x4a0fe6){_0x5bd343[_0x79f9('0x1e')](_0x4a0fe6);})['then'](function(){for(var _0x3e2df1=0x0;_0x3e2df1<_0x5bd343['length'];_0x3e2df1+=0x1){var _0x25d3aa;var _0x516e0a=_0x5bd343[_0x3e2df1];if(_0x13b433){_0x25d3aa=path[_0x79f9('0x25')](_0x3a9648,_0x4753de,util[_0x79f9('0xd')](_0x79f9('0x27'),_0x4753de,_0x3e2df1,_0x79f9('0x28')));}else{_0x25d3aa=path['join'](_0x3a9648,util[_0x79f9('0xd')](_0x79f9('0x29'),_0x4753de,'csv'));}fs[_0x79f9('0x2a')](_0x25d3aa,csv(_0x516e0a));}})['then'](function(){if(_0x13b433){return new Promise(function(_0x135133){zipdir(path[_0x79f9('0x25')](_0x3a9648,_0x4753de),{'saveTo':path[_0x79f9('0x25')](_0x3a9648,util[_0x79f9('0xd')]('%s.%s',_0x4753de,_0x79f9('0x2b')))},function(_0xddec77,_0x29a404){rimraf(path[_0x79f9('0x25')](_0x3a9648,_0x4753de),function(){});_0x135133(_0x79f9('0x2c'));});});}})[_0x79f9('0x13')](function(){logger[_0x79f9('0xc')](util['format'](_0x79f9('0x2d'),EXTRACTED_REPORT_ID,_0x79f9('0xf')));return analyticExtractedReport(_0x79f9('0x2e'),_0x13b433?util[_0x79f9('0xd')](_0x79f9('0x29'),_0x4753de,_0x13b433?_0x79f9('0x2b'):_0x79f9('0x28')):null);});})[_0x79f9('0x2f')](function(_0x40b706){logger['info'](util['format'](_0x79f9('0x30'),EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x40b706,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x79f9('0x31')](function(){process[_0x79f9('0x32')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 972cd3d..cca8c48 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 _0x0b77=['all','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','Arial','center','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','toString','value','fill','length','auto','push','body','chunk','keys','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','format','endDate','header','before','footer','black','right','Empty','Setting','split','then','splitSizePdf','range','num','isInteger','forEach','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','basename','.pdf','existsSync','join','each','createPdfKitDocument','%s%d.%s','%s.%s','pdf'];(function(_0x5ea88c,_0x109810){var _0x247560=function(_0x5f49c6){while(--_0x5f49c6){_0x5ea88c['push'](_0x5ea88c['shift']());}};_0x247560(++_0x109810);}(_0x0b77,0xcd));var _0x70b7=function(_0xf26d40,_0x2f4f46){_0xf26d40=_0xf26d40-0x0;var _0x50b68c=_0x0b77[_0xf26d40];return _0x50b68c;};'use strict';var _=require(_0x70b7('0x0'));var fs=require('fs');var util=require(_0x70b7('0x1'));var path=require(_0x70b7('0x2'));var moment=require(_0x70b7('0x3'));var htmlToPdfmake=require(_0x70b7('0x4'));var PdfPrinter=require(_0x70b7('0x5'));var zipdir=require(_0x70b7('0x6'));var rimraf=require(_0x70b7('0x7'));var JSDOM=require(_0x70b7('0x8'))[_0x70b7('0x9')];var window=new JSDOM('')[_0x70b7('0xa')];var BPromise=require(_0x70b7('0xb'));var db=require('../../mysqldb')['db'];var dbH=require(_0x70b7('0xc'))['dbH'];var logger=require(_0x70b7('0xd'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x70b7('0xe')][0x2]);var QUERY=process[_0x70b7('0xe')][0x3];var PATH=process[_0x70b7('0xe')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x70b7('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x5be269,_0x4e7998){var _0x5b9ecb={'status':_0x5be269};var _0x52d132={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4e7998){_0x5b9ecb[_0x70b7('0x10')]=_0x4e7998;}return db[_0x70b7('0x11')][_0x70b7('0x12')](_0x5b9ecb,_0x52d132);}function getHeaders(_0x53ec19){return _[_0x70b7('0x13')](_0x53ec19,function(_0x449994){return{'text':_0x449994,'style':_0x70b7('0x14')};});}function getRows(_0x3cd13b,_0x2ae10c){return _[_0x70b7('0x13')](_0x2ae10c,function(_0x15dda7){return _(_0x15dda7)['pick'](_0x3cd13b)[_0x70b7('0x13')](function(_0x4ffc7c){return _0x4ffc7c?_[_0x70b7('0x15')](_0x4ffc7c):'';})[_0x70b7('0x16')]();});}function createTable(_0x3df131,_0xe92c76){var _0xd33f2d={'widths':_[_0x70b7('0x17')](Array(_0x3df131[_0x70b7('0x18')]),0x91),'heights':function(_0x31dce1){return _0x31dce1===0x0?_0x70b7('0x19'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x4f94f2=getHeaders(_0x3df131);_0xd33f2d['body'][_0x70b7('0x1a')](_0x4f94f2);var _0x5cdf22=getRows(_0x3df131,_0xe92c76);_0xd33f2d[_0x70b7('0x1b')]=_0xd33f2d[_0x70b7('0x1b')]['concat'](_0x5cdf22);return _0xd33f2d;}function createTables(_0x5ca890){var _0x15427a=[];var _0x10dcee=_[_0x70b7('0x1c')](Object[_0x70b7('0x1d')](_0x5ca890[0x0]),0x5);_0x10dcee['forEach'](function(_0xf3518d){_0x15427a[_0x70b7('0x1a')](createTable(_0xf3518d,_0x5ca890));});return _0x15427a;}function getPDFDocDefinition(_0x1e69f4){var _0x448480=util['format'](_0x70b7('0x1e'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x70b7('0x1f')])[_0x70b7('0x20')](FORMAT),moment(EXTRACTED_REPORT[_0x70b7('0x21')])[_0x70b7('0x20')](FORMAT));var _0x5cd70f=[];for(var _0x3c21b5=0x0;_0x3c21b5<_0x1e69f4[_0x70b7('0x18')];_0x3c21b5++){var _0x207bb2=[];if(_0x3c21b5===0x0){_0x207bb2['push']({'text':_0x448480,'style':_0x70b7('0x22')});}var _0x337e67={'table':_0x1e69f4[_0x3c21b5]};if(_0x3c21b5>0x0){_0x337e67['pageBreak']=_0x70b7('0x23');_0x337e67['margin']=[0x0,0x46,0x0,0x0];}_0x207bb2[_0x70b7('0x1a')](_0x337e67);_0x5cd70f[_0x70b7('0x1a')](_0x207bb2);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x5cd70f,'footer':function(_0x5bcdfd,_0x57fa5b){return{'text':_0x5bcdfd[_0x70b7('0x15')]()+'\x20/\x20'+_0x57fa5b,'style':_0x70b7('0x24')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x70b7('0x25')},'footer':{'alignment':_0x70b7('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x4a7c08){var _0x391784=0x1388;var _0x8af719;if(!_0x4a7c08[0x0]['num']){return analyticExtractedReport(_0x70b7('0x27'));}return db[_0x70b7('0x28')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x70b7('0x29'),'splitSizePdf']})[_0x70b7('0x2a')](function(_0x42f9e0){if(_0x42f9e0){_0x8af719=_0x42f9e0;_0x391784=_0x8af719[_0x70b7('0x2b')]||0x3e8;}})[_0x70b7('0x2a')](function(){var _0x5cd40f=[];var _0xe25e32=0x0;if(_0x8af719['split']){if(_0x4a7c08&&_0x4a7c08['length']){var _0x5f1ddd=_[_0x70b7('0x2c')](_0x4a7c08[0x0][_0x70b7('0x2d')]/_0x391784);var _0x233121=Number[_0x70b7('0x2e')](_0x4a7c08[0x0][_0x70b7('0x2d')]/_0x391784)?_0x4a7c08[0x0][_0x70b7('0x2d')]%_0x391784:0x0;_0x5f1ddd[_0x70b7('0x2f')](function(_0x388898){if(_0x388898>0x0){_0xe25e32+=_0x391784;}_0x5cd40f[_0x70b7('0x1a')](dbH[_0x70b7('0x30')][_0x70b7('0x31')](util[_0x70b7('0x20')](_0x70b7('0x32'),QUERY,_0x391784,_0xe25e32),{'type':dbH['sequelize'][_0x70b7('0x33')]['SELECT']}));});if(_0x233121>0x0){_0xe25e32+=_0x391784;_0x5cd40f['push'](dbH[_0x70b7('0x30')][_0x70b7('0x31')](util[_0x70b7('0x20')](_0x70b7('0x32'),QUERY,_0x233121,_0xe25e32),{'type':dbH[_0x70b7('0x30')][_0x70b7('0x33')][_0x70b7('0x34')]}));}}}else{_0x5cd40f['push'](dbH[_0x70b7('0x30')][_0x70b7('0x31')](QUERY,{'type':dbH[_0x70b7('0x30')][_0x70b7('0x33')]['SELECT']}));}var _0x376419=path['dirname'](PATH);var _0x5958e7=path[_0x70b7('0x35')](PATH,_0x70b7('0x36'));var _0x54a83d=_0x8af719['split']&&_0x5cd40f['length']>0x1;var _0x28c631=[];if(!fs[_0x70b7('0x37')](path[_0x70b7('0x38')](_0x376419,_0x5958e7))&&_0x54a83d){fs['mkdirSync'](path[_0x70b7('0x38')](_0x376419,_0x5958e7));}return BPromise[_0x70b7('0x39')](_0x5cd40f,function(_0x4785e0){_0x28c631[_0x70b7('0x1a')](_0x4785e0);})[_0x70b7('0x2a')](function(){var _0x226520=[];for(var _0x143bd0=0x0;_0x143bd0<_0x28c631[_0x70b7('0x18')];_0x143bd0+=0x1){var _0x29cd74=_0x28c631[_0x143bd0];var _0x2ee43b=createTables(_['flatten'](_0x29cd74));var _0x3a1ef0;var _0x2eb5ae=getPDFDocDefinition(_0x2ee43b);var _0x1cfbf4=getPDFPrinter();var _0x32d1b4=_0x1cfbf4[_0x70b7('0x3a')](_0x2eb5ae);if(_0x54a83d){_0x3a1ef0=path[_0x70b7('0x38')](_0x376419,_0x5958e7,util[_0x70b7('0x20')](_0x70b7('0x3b'),_0x5958e7,_0x143bd0,'pdf'));}else{_0x3a1ef0=path[_0x70b7('0x38')](_0x376419,util[_0x70b7('0x20')](_0x70b7('0x3c'),_0x5958e7,_0x70b7('0x3d')));}_0x226520['push'](writePDFDocument(_0x32d1b4,_0x3a1ef0));}return Promise[_0x70b7('0x3e')](_0x226520);})[_0x70b7('0x2a')](function(){if(_0x54a83d){return new Promise(function(_0x2ea2bd){zipdir(path[_0x70b7('0x38')](_0x376419,_0x5958e7),{'saveTo':path[_0x70b7('0x38')](_0x376419,util['format'](_0x70b7('0x3c'),_0x5958e7,'zip'))},function(){rimraf(path['join'](_0x376419,_0x5958e7),function(){});_0x2ea2bd('zip\x20finished');});});}})[_0x70b7('0x2a')](function(){if(!_0x54a83d)return;rimraf(path[_0x70b7('0x38')](_0x376419,_0x5958e7),function(){});})[_0x70b7('0x2a')](function(){logger[_0x70b7('0x3f')](util[_0x70b7('0x20')](_0x70b7('0x40'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport('Completed',_0x54a83d?util[_0x70b7('0x20')](_0x70b7('0x3c'),_0x5958e7,_0x54a83d?_0x70b7('0x41'):_0x70b7('0x3d')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x70b7('0x20')](_0x70b7('0x42'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x70b7('0x11')][_0x70b7('0x43')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x70b7('0x2a')](function(_0x27fffe){EXTRACTED_REPORT=_0x27fffe;return dbH[_0x70b7('0x30')][_0x70b7('0x31')](util[_0x70b7('0x20')](_0x70b7('0x44'),QUERY),{'type':dbH[_0x70b7('0x30')][_0x70b7('0x33')][_0x70b7('0x34')]});})[_0x70b7('0x2a')](extractReport)[_0x70b7('0x45')](function(_0x94a31f){logger['info'](util[_0x70b7('0x20')](_0x70b7('0x46'),EXTRACTED_REPORT_ID,_0x70b7('0x47')),util['inspect'](_0x94a31f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x70b7('0x48'));})[_0x70b7('0x49')](function(){process[_0x70b7('0x4a')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x7b49b7=new PdfPrinter({'Arial':{'normal':__dirname+_0x70b7('0x4b'),'bold':__dirname+_0x70b7('0x4c'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x70b7('0x4d')}});return _0x7b49b7;}function getPDFDocDefinitionFromHTML(_0x5bae28,_0x118a44){var _0x34b581=util[_0x70b7('0x20')](_0x70b7('0x4e'),_0x118a44[_0x70b7('0x4f')],_0x118a44[_0x70b7('0x50')]);var _0x1a9ce4=moment()['format']('YYYY-MM-DD')[_0x70b7('0x15')]();var _0x20fc8d=htmlToPdfmake(_0x5bae28,{'window':window,'tableAutoSize':!![]});return{'content':[_0x20fc8d],'defaultStyle':{'font':_0x70b7('0x51')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x70b7('0x52'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x70b7('0x52'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x70b7('0x52')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x70b7('0x22')}];},'footer':function(_0x5ba3d8,_0x1a6437){return[{'text':util[_0x70b7('0x20')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x34b581,_0x5ba3d8,_0x1a6437,_0x1a9ce4),'style':_0x70b7('0x24')}];}};}function writePDFDocument(_0x4fac35,_0x37c526){return new Promise(function(_0x28f6df,_0x48747d){var _0xca666a=_0x4fac35[_0x70b7('0x53')](fs[_0x70b7('0x54')](_0x37c526));_0xca666a['on'](_0x70b7('0x55'),function(){_0x28f6df(_0x70b7('0x55'));});_0xca666a['on'](_0x70b7('0x56'),function(_0x538d6b){_0x48747d(_0x538d6b);});_0x4fac35[_0x70b7('0x57')]();});}exports[_0x70b7('0x58')]=function(_0x235754,_0x448cf8){var _0x529645=getPDFPrinter();var _0x16c309=getPDFDocDefinitionFromHTML(_0x235754,_0x448cf8);var _0x540b66=_0x529645[_0x70b7('0x3a')](_0x16c309);return writePDFDocument(_0x540b66,_0x448cf8[_0x70b7('0x2')])[_0x70b7('0x45')](function(_0x3a29be){throw _0x3a29be;});}; \ No newline at end of file +var _0xf5e5=['inspect','Failed','finally','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','YYYY-MM-DD','center','Interaction\x20Transcript','finish','error','end','createPdfFromHTML','catch','util','path','moment','pdfmake/src/printer','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','tableHeader','toString','value','length','auto','body','push','concat','chunk','forEach','format','name','startDate','header','before','margin','\x20/\x20','footer','Arial','black','right','num','Empty','split','splitSizePdf','then','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','basename','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','pdf','%s.%s','all','zip','info','PDF','Completed','AnalyticExtractedReport','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format'];(function(_0x462e58,_0x1389ff){var _0x4eddbb=function(_0x4f5c75){while(--_0x4f5c75){_0x462e58['push'](_0x462e58['shift']());}};_0x4eddbb(++_0x1389ff);}(_0xf5e5,0x1ef));var _0x5f5e=function(_0x4fc5df,_0x3acaab){_0x4fc5df=_0x4fc5df-0x0;var _0x4a18f5=_0xf5e5[_0x4fc5df];return _0x4a18f5;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x5f5e('0x0'));var path=require(_0x5f5e('0x1'));var moment=require(_0x5f5e('0x2'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x5f5e('0x3'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var JSDOM=require('jsdom')[_0x5f5e('0x4')];var window=new JSDOM('')[_0x5f5e('0x5')];var BPromise=require(_0x5f5e('0x6'));var db=require(_0x5f5e('0x7'))['db'];var dbH=require(_0x5f5e('0x7'))[_0x5f5e('0x8')];var logger=require(_0x5f5e('0x9'))(_0x5f5e('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x5f5e('0xb')][0x2]);var QUERY=process[_0x5f5e('0xb')][0x3];var PATH=process[_0x5f5e('0xb')][0x4];var NAME=process[_0x5f5e('0xb')][0x5];var FORMAT=_0x5f5e('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x14b49c,_0x3a13ab){var _0x3dd0b7={'status':_0x14b49c};var _0x2843c3={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3a13ab){_0x3dd0b7[_0x5f5e('0xd')]=_0x3a13ab;}return db['AnalyticExtractedReport'][_0x5f5e('0xe')](_0x3dd0b7,_0x2843c3);}function getHeaders(_0x2db217){return _[_0x5f5e('0xf')](_0x2db217,function(_0x23e3c3){return{'text':_0x23e3c3,'style':_0x5f5e('0x10')};});}function getRows(_0x21e6dc,_0x3e3b84){return _[_0x5f5e('0xf')](_0x3e3b84,function(_0x46ab9c){return _(_0x46ab9c)['pick'](_0x21e6dc)[_0x5f5e('0xf')](function(_0x344546){return _0x344546?_[_0x5f5e('0x11')](_0x344546):'';})[_0x5f5e('0x12')]();});}function createTable(_0x5c4aa9,_0x4d88fe){var _0x2cc85c={'widths':_['fill'](Array(_0x5c4aa9[_0x5f5e('0x13')]),0x91),'heights':function(_0x49354e){return _0x49354e===0x0?_0x5f5e('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x5570ea=getHeaders(_0x5c4aa9);_0x2cc85c[_0x5f5e('0x15')][_0x5f5e('0x16')](_0x5570ea);var _0x3854a3=getRows(_0x5c4aa9,_0x4d88fe);_0x2cc85c[_0x5f5e('0x15')]=_0x2cc85c['body'][_0x5f5e('0x17')](_0x3854a3);return _0x2cc85c;}function createTables(_0x4aa5b9){var _0x17ee24=[];var _0x1fcd1c=_[_0x5f5e('0x18')](Object['keys'](_0x4aa5b9[0x0]),0x5);_0x1fcd1c[_0x5f5e('0x19')](function(_0xb2bbec){_0x17ee24[_0x5f5e('0x16')](createTable(_0xb2bbec,_0x4aa5b9));});return _0x17ee24;}function getPDFDocDefinition(_0xd466b5){var _0x32ac1e=util[_0x5f5e('0x1a')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x5f5e('0x1b')],moment(EXTRACTED_REPORT[_0x5f5e('0x1c')])[_0x5f5e('0x1a')](FORMAT),moment(EXTRACTED_REPORT['endDate'])['format'](FORMAT));var _0x4a0459=[];for(var _0x584643=0x0;_0x584643<_0xd466b5[_0x5f5e('0x13')];_0x584643++){var _0x30357e=[];if(_0x584643===0x0){_0x30357e[_0x5f5e('0x16')]({'text':_0x32ac1e,'style':_0x5f5e('0x1d')});}var _0x50abcd={'table':_0xd466b5[_0x584643]};if(_0x584643>0x0){_0x50abcd['pageBreak']=_0x5f5e('0x1e');_0x50abcd[_0x5f5e('0x1f')]=[0x0,0x46,0x0,0x0];}_0x30357e[_0x5f5e('0x16')](_0x50abcd);_0x4a0459[_0x5f5e('0x16')](_0x30357e);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x4a0459,'footer':function(_0x11fcad,_0x1d3216){return{'text':_0x11fcad['toString']()+_0x5f5e('0x20')+_0x1d3216,'style':_0x5f5e('0x21')};},'defaultStyle':{'font':_0x5f5e('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x5f5e('0x23')},'footer':{'alignment':_0x5f5e('0x24'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x326dd9){var _0x528002=0x1388;var _0x3d9fb7;if(!_0x326dd9[0x0][_0x5f5e('0x25')]){return analyticExtractedReport(_0x5f5e('0x26'));}return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5f5e('0x27'),_0x5f5e('0x28')]})[_0x5f5e('0x29')](function(_0x23c784){if(_0x23c784){_0x3d9fb7=_0x23c784;_0x528002=_0x3d9fb7[_0x5f5e('0x28')]||0x3e8;}})['then'](function(){var _0x406098=[];var _0x436331=0x0;if(_0x3d9fb7[_0x5f5e('0x27')]){if(_0x326dd9&&_0x326dd9[_0x5f5e('0x13')]){var _0x4340bd=_[_0x5f5e('0x2a')](_0x326dd9[0x0][_0x5f5e('0x25')]/_0x528002);var _0x478325=Number[_0x5f5e('0x2b')](_0x326dd9[0x0]['num']/_0x528002)?_0x326dd9[0x0][_0x5f5e('0x25')]%_0x528002:0x0;_0x4340bd['forEach'](function(_0x19cd8b){if(_0x19cd8b>0x0){_0x436331+=_0x528002;}_0x406098[_0x5f5e('0x16')](dbH[_0x5f5e('0x2c')][_0x5f5e('0x2d')](util['format'](_0x5f5e('0x2e'),QUERY,_0x528002,_0x436331),{'type':dbH[_0x5f5e('0x2c')][_0x5f5e('0x2f')]['SELECT']}));});if(_0x478325>0x0){_0x436331+=_0x528002;_0x406098[_0x5f5e('0x16')](dbH[_0x5f5e('0x2c')][_0x5f5e('0x2d')](util[_0x5f5e('0x1a')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x478325,_0x436331),{'type':dbH[_0x5f5e('0x2c')][_0x5f5e('0x2f')][_0x5f5e('0x30')]}));}}}else{_0x406098[_0x5f5e('0x16')](dbH[_0x5f5e('0x2c')][_0x5f5e('0x2d')](QUERY,{'type':dbH[_0x5f5e('0x2c')][_0x5f5e('0x2f')][_0x5f5e('0x30')]}));}var _0x4f1701=path['dirname'](PATH);var _0x5e38e3=path[_0x5f5e('0x31')](PATH,'.pdf');var _0x127a66=_0x3d9fb7[_0x5f5e('0x27')]&&_0x406098['length']>0x1;var _0x526e39=[];if(!fs[_0x5f5e('0x32')](path[_0x5f5e('0x33')](_0x4f1701,_0x5e38e3))&&_0x127a66){fs[_0x5f5e('0x34')](path[_0x5f5e('0x33')](_0x4f1701,_0x5e38e3));}return BPromise[_0x5f5e('0x35')](_0x406098,function(_0x4c94ff){_0x526e39[_0x5f5e('0x16')](_0x4c94ff);})[_0x5f5e('0x29')](function(){var _0x4ab37e=[];for(var _0x16283a=0x0;_0x16283a<_0x526e39[_0x5f5e('0x13')];_0x16283a+=0x1){var _0x16f8c2=_0x526e39[_0x16283a];var _0x5c5e9c=createTables(_[_0x5f5e('0x36')](_0x16f8c2));var _0x220192;var _0x57c958=getPDFDocDefinition(_0x5c5e9c);var _0x2ccefc=getPDFPrinter();var _0x1d6ebd=_0x2ccefc[_0x5f5e('0x37')](_0x57c958);if(_0x127a66){_0x220192=path[_0x5f5e('0x33')](_0x4f1701,_0x5e38e3,util['format']('%s%d.%s',_0x5e38e3,_0x16283a,_0x5f5e('0x38')));}else{_0x220192=path[_0x5f5e('0x33')](_0x4f1701,util['format'](_0x5f5e('0x39'),_0x5e38e3,_0x5f5e('0x38')));}_0x4ab37e['push'](writePDFDocument(_0x1d6ebd,_0x220192));}return Promise[_0x5f5e('0x3a')](_0x4ab37e);})[_0x5f5e('0x29')](function(){if(_0x127a66){return new Promise(function(_0x302d9b){zipdir(path[_0x5f5e('0x33')](_0x4f1701,_0x5e38e3),{'saveTo':path[_0x5f5e('0x33')](_0x4f1701,util[_0x5f5e('0x1a')](_0x5f5e('0x39'),_0x5e38e3,_0x5f5e('0x3b')))},function(){rimraf(path[_0x5f5e('0x33')](_0x4f1701,_0x5e38e3),function(){});_0x302d9b('zip\x20finished');});});}})[_0x5f5e('0x29')](function(){if(!_0x127a66)return;rimraf(path[_0x5f5e('0x33')](_0x4f1701,_0x5e38e3),function(){});})[_0x5f5e('0x29')](function(){logger[_0x5f5e('0x3c')](util[_0x5f5e('0x1a')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x5f5e('0x3d')));return analyticExtractedReport(_0x5f5e('0x3e'),_0x127a66?util[_0x5f5e('0x1a')](_0x5f5e('0x39'),_0x5e38e3,_0x127a66?_0x5f5e('0x3b'):_0x5f5e('0x38')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x5f5e('0x3c')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x5f5e('0x3d')));return db[_0x5f5e('0x3f')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x5f5e('0x29')](function(_0x4ee33b){EXTRACTED_REPORT=_0x4ee33b;return dbH[_0x5f5e('0x2c')][_0x5f5e('0x2d')](util[_0x5f5e('0x1a')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x5f5e('0x2c')][_0x5f5e('0x2f')][_0x5f5e('0x30')]});})['then'](extractReport)['catch'](function(_0x42926c){logger[_0x5f5e('0x3c')](util['format'](_0x5f5e('0x40'),EXTRACTED_REPORT_ID,'PDF'),util[_0x5f5e('0x41')](_0x42926c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x5f5e('0x42'));})[_0x5f5e('0x43')](function(){process[_0x5f5e('0x44')](EXIT_CODE);});}main();function getPDFPrinter(){var _0xb0a487=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x5f5e('0x45'),'italics':__dirname+_0x5f5e('0x46'),'bolditalics':__dirname+_0x5f5e('0x47')}});return _0xb0a487;}function getPDFDocDefinitionFromHTML(_0xfc95be,_0x2fa13a){var _0x35578f=util[_0x5f5e('0x1a')]('%s\x20#%d',_0x2fa13a['channel'],_0x2fa13a['interactionId']);var _0x557447=moment()[_0x5f5e('0x1a')](_0x5f5e('0x48'))['toString']();var _0x521a0a=htmlToPdfmake(_0xfc95be,{'window':window,'tableAutoSize':!![]});return{'content':[_0x521a0a],'defaultStyle':{'font':_0x5f5e('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x5f5e('0x49'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x5f5e('0x49'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x5f5e('0x4a'),'style':'header'}];},'footer':function(_0xb6695b,_0x1bbdb6){return[{'text':util['format']('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x35578f,_0xb6695b,_0x1bbdb6,_0x557447),'style':_0x5f5e('0x21')}];}};}function writePDFDocument(_0x2d300e,_0x506e0e){return new Promise(function(_0x232b18,_0x3d3c75){var _0x302821=_0x2d300e['pipe'](fs['createWriteStream'](_0x506e0e));_0x302821['on']('finish',function(){_0x232b18(_0x5f5e('0x4b'));});_0x302821['on'](_0x5f5e('0x4c'),function(_0x52a77a){_0x3d3c75(_0x52a77a);});_0x2d300e[_0x5f5e('0x4d')]();});}exports[_0x5f5e('0x4e')]=function(_0x23ed6a,_0x18f770){var _0x529d06=getPDFPrinter();var _0x4df0a9=getPDFDocDefinitionFromHTML(_0x23ed6a,_0x18f770);var _0x5f463b=_0x529d06[_0x5f5e('0x37')](_0x4df0a9);return writePDFDocument(_0x5f463b,_0x18f770[_0x5f5e('0x1')])[_0x5f5e('0x4f')](function(_0x3737c9){throw _0x3737c9;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 3c6769c..3e5dac6 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 _0x0df5=['length','isInteger','forEach','push','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.xlsx','join','%s%d.%s','xlsx','%s.%s','writeFileSync','zip\x20finished','Completed','zip','Failed','finally','exit','lodash','json2xls','bluebird','rimraf','../../mysqldb','dbH','argv','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty'];(function(_0xc6c67d,_0x213d39){var _0x361914=function(_0x3f4c3d){while(--_0x3f4c3d){_0xc6c67d['push'](_0xc6c67d['shift']());}};_0x361914(++_0x213d39);}(_0x0df5,0x18f));var _0x50df=function(_0x208a65,_0x129f7f){_0x208a65=_0x208a65-0x0;var _0x384fad=_0x0df5[_0x208a65];return _0x384fad;};'use strict';var util=require('util');var path=require('path');var _=require(_0x50df('0x0'));var fs=require('fs');var json2xls=require(_0x50df('0x1'));var BPromise=require(_0x50df('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0x50df('0x3'));var db=require('../../mysqldb')['db'];var dbH=require(_0x50df('0x4'))[_0x50df('0x5')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x50df('0x6')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x50df('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x14aa90,_0x51a779){var _0x5b24bc={'status':_0x14aa90};var _0x5ab23b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x51a779){_0x5b24bc['savename']=_0x51a779;}return db['AnalyticExtractedReport']['update'](_0x5b24bc,_0x5ab23b);}function main(){var _0x7f69ed=0x1388;var _0x69422d;logger[_0x50df('0x7')](util['format'](_0x50df('0x8'),EXTRACTED_REPORT_ID,_0x50df('0x9')));return db[_0x50df('0xa')][_0x50df('0xb')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x50df('0xc'),_0x50df('0xd')]})['then'](function(_0x10743a){if(_0x10743a){_0x69422d=_0x10743a;_0x7f69ed=_0x69422d['splitSizeXlsx']||0x1388;}})[_0x50df('0xe')](function(){return dbH[_0x50df('0xf')][_0x50df('0x10')](util['format'](_0x50df('0x11'),QUERY),{'type':dbH[_0x50df('0xf')]['QueryTypes'][_0x50df('0x12')]});})[_0x50df('0xe')](function(_0x2b9350){if(!_0x2b9350[0x0][_0x50df('0x13')]){return analyticExtractedReport(_0x50df('0x14'));}var _0xa05b23=[];var _0x1ce8c6=0x0;if(_0x69422d[_0x50df('0xc')]){if(_0x2b9350&&_0x2b9350[_0x50df('0x15')]){var _0x4d058f=_['range'](_0x2b9350[0x0][_0x50df('0x13')]/_0x7f69ed);var _0x109369=Number[_0x50df('0x16')](_0x2b9350[0x0][_0x50df('0x13')]/_0x7f69ed)?_0x2b9350[0x0]['num']%_0x7f69ed:0x0;_0x4d058f[_0x50df('0x17')](function(_0x1ddca0){if(_0x1ddca0>0x0){_0x1ce8c6+=_0x7f69ed;}_0xa05b23[_0x50df('0x18')](dbH['sequelize'][_0x50df('0x10')](util[_0x50df('0x19')](_0x50df('0x1a'),QUERY,_0x7f69ed,_0x1ce8c6),{'type':dbH['sequelize'][_0x50df('0x1b')][_0x50df('0x12')]}));});if(_0x109369>0x0){_0x1ce8c6+=_0x7f69ed;_0xa05b23[_0x50df('0x18')](dbH[_0x50df('0xf')]['query'](util[_0x50df('0x19')](_0x50df('0x1a'),QUERY,_0x109369,_0x1ce8c6),{'type':dbH[_0x50df('0xf')][_0x50df('0x1b')]['SELECT']}));}}}else{_0xa05b23[_0x50df('0x18')](dbH[_0x50df('0xf')][_0x50df('0x10')](QUERY,{'type':dbH[_0x50df('0xf')][_0x50df('0x1b')]['SELECT']}));}var _0x70af68=path[_0x50df('0x1c')](PATH);var _0x323247=path[_0x50df('0x1d')](PATH,_0x50df('0x1e'));var _0x3fee67=_0x69422d[_0x50df('0xc')]&&_0xa05b23[_0x50df('0x15')]>0x1;var _0x4c5e69=[];if(!fs['existsSync'](path['join'](_0x70af68,_0x323247))&&_0x3fee67){fs['mkdirSync'](path[_0x50df('0x1f')](_0x70af68,_0x323247));}return BPromise['each'](_0xa05b23,function(_0x58df37){_0x4c5e69[_0x50df('0x18')](_0x58df37);})['then'](function(){for(var _0x4c6795=0x0;_0x4c6795<_0x4c5e69[_0x50df('0x15')];_0x4c6795+=0x1){var _0x2671ac;var _0x519e4b=_0x4c5e69[_0x4c6795];if(_0x3fee67){_0x2671ac=path[_0x50df('0x1f')](_0x70af68,_0x323247,util['format'](_0x50df('0x20'),_0x323247,_0x4c6795,_0x50df('0x21')));}else{_0x2671ac=path[_0x50df('0x1f')](_0x70af68,util[_0x50df('0x19')](_0x50df('0x22'),_0x323247,_0x50df('0x21')));}fs[_0x50df('0x23')](_0x2671ac,json2xls(_0x519e4b),'binary');}})[_0x50df('0xe')](function(){if(_0x3fee67){return new Promise(function(_0x1092e9){zipdir(path[_0x50df('0x1f')](_0x70af68,_0x323247),{'saveTo':path[_0x50df('0x1f')](_0x70af68,util['format']('%s.%s',_0x323247,'zip'))},function(_0xcff277,_0x334d7a){rimraf(path[_0x50df('0x1f')](_0x70af68,_0x323247),function(){});_0x1092e9(_0x50df('0x24'));});});}})[_0x50df('0xe')](function(){logger['info'](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x50df('0x9')));return analyticExtractedReport(_0x50df('0x25'),_0x3fee67?util[_0x50df('0x19')](_0x50df('0x22'),_0x323247,_0x3fee67?_0x50df('0x26'):_0x50df('0x21')):null);});})['catch'](function(_0x7922b4){logger['info'](util[_0x50df('0x19')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util['inspect'](_0x7922b4,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x50df('0x27'));})[_0x50df('0x28')](function(){process[_0x50df('0x29')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x2779=['.xlsx','existsSync','mkdirSync','join','each','xlsx','writeFileSync','binary','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','%s.%s','zip','inspect','Failed','finally','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename'];(function(_0xce13b1,_0x2b45ff){var _0x2e3ab5=function(_0x50f340){while(--_0x50f340){_0xce13b1['push'](_0xce13b1['shift']());}};_0x2e3ab5(++_0x2b45ff);}(_0x2779,0x143));var _0x9277=function(_0x36131e,_0x1ae548){_0x36131e=_0x36131e-0x0;var _0x22abe1=_0x2779[_0x36131e];return _0x22abe1;};'use strict';var util=require(_0x9277('0x0'));var path=require(_0x9277('0x1'));var _=require(_0x9277('0x2'));var fs=require('fs');var json2xls=require(_0x9277('0x3'));var BPromise=require(_0x9277('0x4'));var zipdir=require(_0x9277('0x5'));var rimraf=require(_0x9277('0x6'));var db=require(_0x9277('0x7'))['db'];var dbH=require(_0x9277('0x7'))['dbH'];var logger=require(_0x9277('0x8'))(_0x9277('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x9277('0xa')][0x2]);var QUERY=process[_0x9277('0xa')][0x3];var PATH=process[_0x9277('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x25a588,_0x1592fd){var _0x326e30={'status':_0x25a588};var _0x4a1004={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1592fd){_0x326e30[_0x9277('0xb')]=_0x1592fd;}return db[_0x9277('0xc')]['update'](_0x326e30,_0x4a1004);}function main(){var _0x88fce1=0x1388;var _0x33b6c2;logger['info'](util['format'](_0x9277('0xd'),EXTRACTED_REPORT_ID,_0x9277('0xe')));return db[_0x9277('0xf')][_0x9277('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9277('0x11'),'splitSizeXlsx']})['then'](function(_0x1d2af1){if(_0x1d2af1){_0x33b6c2=_0x1d2af1;_0x88fce1=_0x33b6c2[_0x9277('0x12')]||0x1388;}})[_0x9277('0x13')](function(){return dbH[_0x9277('0x14')][_0x9277('0x15')](util[_0x9277('0x16')](_0x9277('0x17'),QUERY),{'type':dbH['sequelize'][_0x9277('0x18')][_0x9277('0x19')]});})[_0x9277('0x13')](function(_0x5522ee){if(!_0x5522ee[0x0][_0x9277('0x1a')]){return analyticExtractedReport('Empty');}var _0x289e03=[];var _0x1b27c0=0x0;if(_0x33b6c2['split']){if(_0x5522ee&&_0x5522ee[_0x9277('0x1b')]){var _0x216264=_['range'](_0x5522ee[0x0][_0x9277('0x1a')]/_0x88fce1);var _0x2d90ee=Number[_0x9277('0x1c')](_0x5522ee[0x0]['num']/_0x88fce1)?_0x5522ee[0x0][_0x9277('0x1a')]%_0x88fce1:0x0;_0x216264[_0x9277('0x1d')](function(_0x3bf5b3){if(_0x3bf5b3>0x0){_0x1b27c0+=_0x88fce1;}_0x289e03[_0x9277('0x1e')](dbH[_0x9277('0x14')][_0x9277('0x15')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x88fce1,_0x1b27c0),{'type':dbH[_0x9277('0x14')][_0x9277('0x18')][_0x9277('0x19')]}));});if(_0x2d90ee>0x0){_0x1b27c0+=_0x88fce1;_0x289e03['push'](dbH['sequelize'][_0x9277('0x15')](util['format'](_0x9277('0x1f'),QUERY,_0x2d90ee,_0x1b27c0),{'type':dbH[_0x9277('0x14')][_0x9277('0x18')][_0x9277('0x19')]}));}}}else{_0x289e03[_0x9277('0x1e')](dbH[_0x9277('0x14')][_0x9277('0x15')](QUERY,{'type':dbH[_0x9277('0x14')][_0x9277('0x18')][_0x9277('0x19')]}));}var _0x192237=path[_0x9277('0x20')](PATH);var _0x3b8a70=path[_0x9277('0x21')](PATH,_0x9277('0x22'));var _0x17b5cb=_0x33b6c2[_0x9277('0x11')]&&_0x289e03[_0x9277('0x1b')]>0x1;var _0x523c8d=[];if(!fs[_0x9277('0x23')](path['join'](_0x192237,_0x3b8a70))&&_0x17b5cb){fs[_0x9277('0x24')](path[_0x9277('0x25')](_0x192237,_0x3b8a70));}return BPromise[_0x9277('0x26')](_0x289e03,function(_0xb38e21){_0x523c8d['push'](_0xb38e21);})[_0x9277('0x13')](function(){for(var _0x58bedd=0x0;_0x58bedd<_0x523c8d[_0x9277('0x1b')];_0x58bedd+=0x1){var _0x31cd0e;var _0x1763ab=_0x523c8d[_0x58bedd];if(_0x17b5cb){_0x31cd0e=path[_0x9277('0x25')](_0x192237,_0x3b8a70,util[_0x9277('0x16')]('%s%d.%s',_0x3b8a70,_0x58bedd,_0x9277('0x27')));}else{_0x31cd0e=path[_0x9277('0x25')](_0x192237,util[_0x9277('0x16')]('%s.%s',_0x3b8a70,_0x9277('0x27')));}fs[_0x9277('0x28')](_0x31cd0e,json2xls(_0x1763ab),_0x9277('0x29'));}})[_0x9277('0x13')](function(){if(_0x17b5cb){return new Promise(function(_0x4694a8){zipdir(path[_0x9277('0x25')](_0x192237,_0x3b8a70),{'saveTo':path['join'](_0x192237,util[_0x9277('0x16')]('%s.%s',_0x3b8a70,'zip'))},function(_0x26c7bc,_0x483774){rimraf(path[_0x9277('0x25')](_0x192237,_0x3b8a70),function(){});_0x4694a8(_0x9277('0x2a'));});});}})['then'](function(){logger[_0x9277('0x2b')](util[_0x9277('0x16')](_0x9277('0x2c'),EXTRACTED_REPORT_ID,_0x9277('0xe')));return analyticExtractedReport('Completed',_0x17b5cb?util[_0x9277('0x16')](_0x9277('0x2d'),_0x3b8a70,_0x17b5cb?_0x9277('0x2e'):_0x9277('0x27')):null);});})['catch'](function(_0x45e9d1){logger[_0x9277('0x2b')](util[_0x9277('0x16')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x9277('0xe')),util[_0x9277('0x2f')](_0x45e9d1,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x9277('0x30'));})[_0x9277('0x31')](function(){process[_0x9277('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 7488b06..db7bc82 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 _0x5e60=['context','priority','VoiceExtensionId','inbound','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','*,*,*,*','interval','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','custom','answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','sortBy','catch','error','lodash','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','extensions','extension','find','push','Set','format','CDR(type)=%s','type'];(function(_0x330414,_0x4f3207){var _0x99dbff=function(_0x166f85){while(--_0x166f85){_0x330414['push'](_0x330414['shift']());}};_0x99dbff(++_0x4f3207);}(_0x5e60,0x15e));var _0x05e6=function(_0x305b31,_0x248af7){_0x305b31=_0x305b31-0x0;var _0x328152=_0x5e60[_0x305b31];return _0x328152;};'use strict';var _=require(_0x05e6('0x0'));var util=require('util');function rewrite(_0x24306e,_0x40bca5){var _0x395efd=this;return _0x24306e[_0x05e6('0x1')][_0x05e6('0x2')][_0x05e6('0x3')]({'raw':!![]})[_0x05e6('0x4')](function(_0x121208){_0x395efd[_0x05e6('0x5')]=_0x121208;return _0x24306e[_0x05e6('0x1')][_0x05e6('0x6')][_0x05e6('0x3')]({'where':{'IntervalId':_0x40bca5[_0x05e6('0x7')]},'raw':!![]});})[_0x05e6('0x4')](function(_0x4dc8ee){return _0x24306e[_0x05e6('0x1')][_0x05e6('0x6')][_0x05e6('0x3')]({'where':{'exten':{'$in':_[_0x05e6('0x8')](_[_0x05e6('0x9')](_0x4dc8ee,_0x05e6('0xa')))}},'order':[{'raw':_0x05e6('0xb')}],'raw':!![]});})[_0x05e6('0x4')](function(_0x35dc9d){var _0x5d3ded=_[_0x05e6('0xc')](_0x35dc9d,{'priority':'1'});var _0x15420a=_[_0x05e6('0xc')](_0x35dc9d,{'isApp':0x1});var _0x25bdeb=_[_0x05e6('0xd')](_0x15420a,_0x05e6('0xa'));var _0x2d9c33=[_0x05e6('0xe'),_0x05e6('0xf')];var _0x3c3e82=[];var _0x5880b8=[];for(var _0x50dc64 in _0x25bdeb){if(_0x25bdeb[_0x05e6('0x10')](_0x50dc64)){_0x395efd['priority']=0x2;_0x395efd[_0x05e6('0x11')]=[];_0x395efd[_0x05e6('0x12')]=_[_0x05e6('0x13')](_0x5d3ded,{'exten':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0xa')]});_0x395efd[_0x05e6('0x11')][_0x05e6('0x14')]({'type':_0x25bdeb[_0x50dc64][0x0]['type'],'app':_0x05e6('0x15'),'appdata':util[_0x05e6('0x16')](_0x05e6('0x17'),_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x18')]),'context':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x19')],'exten':_0x25bdeb[_0x50dc64][0x0]['exten'],'priority':_0x395efd[_0x05e6('0x1a')]++,'VoiceExtensionId':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x1b')]});if(_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x18')]===_0x05e6('0x1c')){_0x395efd[_0x05e6('0x11')][_0x05e6('0x14')]({'type':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x18')],'app':_0x05e6('0x15'),'appdata':_0x05e6('0x1d')+_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x1b')],'context':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x19')],'exten':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0xa')],'priority':_0x395efd['priority']++,'VoiceExtensionId':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x1b')]});}else if(_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x18')]===_0x05e6('0x1e')){if(_0x395efd[_0x05e6('0x12')]){_0x395efd[_0x05e6('0x11')]['push']({'type':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x18')],'app':_0x05e6('0x15'),'appdata':_0x05e6('0x1f')+(_0x395efd['extension'][_0x05e6('0x20')]?_0x05e6('0x21')+_0x395efd[_0x05e6('0x12')][_0x05e6('0x20')]+'}':_0x05e6('0x22')),'context':_0x25bdeb[_0x50dc64][0x0]['context'],'exten':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0xa')],'priority':_0x395efd['priority']++,'VoiceExtensionId':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x1b')]});}_0x395efd['extensions'][_0x05e6('0x14')]({'type':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x18')],'app':_0x05e6('0x15'),'appdata':'CDR(routeid)='+_0x25bdeb[_0x50dc64][0x0]['VoiceExtensionId'],'context':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x19')],'exten':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0xa')],'priority':_0x395efd[_0x05e6('0x1a')]++,'VoiceExtensionId':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x1b')]});var _0x377501=_0x395efd[_0x05e6('0x1a')]++;_0x395efd[_0x05e6('0x11')][_0x05e6('0x14')]({'type':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x18')],'app':_0x05e6('0x23'),'appdata':_0x05e6('0x24')+(_0x377501+0x2)+_0x05e6('0x25')+(_0x377501+0x1)+')','context':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x19')],'exten':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0xa')],'priority':_0x377501,'VoiceExtensionId':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x1b')]});if(_0x395efd[_0x05e6('0x12')]){_0x395efd[_0x05e6('0x11')]['push']({'type':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x18')],'app':'Set','appdata':_0x395efd['extension'][_0x05e6('0x20')]?'CDR(prefix)=${EXTEN:0:'+_0x395efd[_0x05e6('0x12')]['cutdigits']+'}':_0x05e6('0x26'),'context':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x19')],'exten':_0x25bdeb[_0x50dc64][0x0]['exten'],'priority':_0x395efd[_0x05e6('0x1a')]++,'VoiceExtensionId':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x1b')]});}_0x395efd[_0x05e6('0x11')][_0x05e6('0x14')]({'type':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x18')],'app':_0x05e6('0x15'),'appdata':_0x05e6('0x27')+_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x1b')],'context':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x19')],'exten':_0x25bdeb[_0x50dc64][0x0]['exten'],'priority':_0x395efd[_0x05e6('0x1a')]++,'VoiceExtensionId':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x1b')]});if(_0x395efd[_0x05e6('0x12')]&&_0x395efd[_0x05e6('0x12')][_0x05e6('0x10')](_0x05e6('0x28'))&&_0x395efd[_0x05e6('0x12')][_0x05e6('0x28')]!==_0x05e6('0x29')){_0x395efd[_0x05e6('0x11')][_0x05e6('0x14')]({'type':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x18')],'app':_0x05e6('0x15'),'appdata':_0x05e6('0x2a'),'context':_0x25bdeb[_0x50dc64][0x0]['context'],'exten':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0xa')],'priority':_0x395efd[_0x05e6('0x1a')]++,'VoiceExtensionId':_0x25bdeb[_0x50dc64][0x0]['VoiceExtensionId']});_0x395efd[_0x05e6('0x11')][_0x05e6('0x14')]({'type':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x18')],'app':_0x05e6('0x15'),'appdata':_0x05e6('0x2b')+_0x395efd[_0x05e6('0x12')]['recordingFormat']||_0x05e6('0x2c'),'context':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x19')],'exten':_0x25bdeb[_0x50dc64][0x0]['exten'],'priority':_0x395efd[_0x05e6('0x1a')]++,'VoiceExtensionId':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x1b')]});}}_0x395efd['extensions']['push']({'type':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x18')],'app':_0x05e6('0x15'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x19')],'exten':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0xa')],'priority':_0x395efd['priority']++,'VoiceExtensionId':_0x25bdeb[_0x50dc64][0x0]['VoiceExtensionId']});_0x395efd['extensions'][_0x05e6('0x14')]({'type':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x18')],'app':'Set','appdata':_0x05e6('0x2d'),'context':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x19')],'exten':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0xa')],'priority':_0x395efd['priority']++,'VoiceExtensionId':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x1b')]});_0x395efd[_0x05e6('0x11')][_0x05e6('0x14')]({'type':_0x25bdeb[_0x50dc64][0x0]['type'],'app':_0x05e6('0x15'),'appdata':_0x05e6('0x2e'),'context':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x19')],'exten':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0xa')],'priority':_0x395efd[_0x05e6('0x1a')]++,'VoiceExtensionId':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x1b')]});for(var _0x269023=0x0,_0xd9d1bf=0x0;_0x269023<_0x25bdeb[_0x50dc64][_0x05e6('0x2f')];_0x269023+=0x1,_0xd9d1bf=0x0){var _0x1eeaa2=_0x25bdeb[_0x50dc64][_0x269023];if(_0x1eeaa2[_0x05e6('0x18')]){_0x1eeaa2[_0x05e6('0x18')]=_0x1eeaa2[_0x05e6('0x18')][_0x05e6('0x30')]();}var _0x20d0e3=[];var _0x352850=[];delete _0x1eeaa2['id'];delete _0x1eeaa2[_0x05e6('0x31')];delete _0x1eeaa2[_0x05e6('0x32')];var _0x30bb2b=_0x1eeaa2['interval']!==_0x05e6('0x33')?[_0x1eeaa2[_0x05e6('0x34')]]:_0x1eeaa2['IntervalId']?_[_0x05e6('0x9')](_[_0x05e6('0xc')](_0x395efd[_0x05e6('0x5')],{'IntervalId':_0x1eeaa2['IntervalId']}),_0x05e6('0x34')):[];if(_0x1eeaa2['hasOwnProperty'](_0x05e6('0x35'))){if(_0x1eeaa2[_0x05e6('0x35')]&&_0x1eeaa2['tag']!=='--'){_0x20d0e3[_0x05e6('0x14')]({'type':_0x1eeaa2[_0x05e6('0x18')],'app':_0x05e6('0x15'),'appdata':_0x05e6('0x36')+_0x1eeaa2[_0x05e6('0x35')],'context':_0x1eeaa2[_0x05e6('0x19')],'exten':_0x1eeaa2[_0x05e6('0xa')],'priority':_0x30bb2b['length']+_0x395efd[_0x05e6('0x1a')]+_0xd9d1bf++,'VoiceExtensionId':_0x1eeaa2[_0x05e6('0x1b')]});}}if(_0x1eeaa2['type']===_0x05e6('0x1e')&&_0x1eeaa2[_0x05e6('0x10')](_0x05e6('0x37'))){if(_0x1eeaa2[_0x05e6('0x37')]){_0x20d0e3['push']({'type':_0x1eeaa2[_0x05e6('0x18')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x1eeaa2[_0x05e6('0x37')]+')','context':_0x1eeaa2[_0x05e6('0x19')],'exten':_0x1eeaa2[_0x05e6('0xa')],'priority':_0x30bb2b[_0x05e6('0x2f')]+_0x395efd[_0x05e6('0x1a')]+_0xd9d1bf++,'VoiceExtensionId':_0x1eeaa2[_0x05e6('0x1b')]});}else{_0x20d0e3[_0x05e6('0x14')]({'type':_0x1eeaa2[_0x05e6('0x18')],'app':_0x05e6('0x23'),'appdata':_0x05e6('0x38'),'context':_0x1eeaa2[_0x05e6('0x19')],'exten':_0x1eeaa2[_0x05e6('0xa')],'priority':_0x30bb2b[_0x05e6('0x2f')]+_0x395efd[_0x05e6('0x1a')]+_0xd9d1bf++,'VoiceExtensionId':_0x1eeaa2[_0x05e6('0x1b')]});}}if(_0x1eeaa2['hasOwnProperty']('answer')){if(_0x2d9c33[_0x05e6('0x39')](_0x1eeaa2[_0x05e6('0x3a')]['toLowerCase']())>=0x0&&_0x1eeaa2['appType']!==_0x05e6('0x3b')){if(_0x1eeaa2[_0x05e6('0x3c')]){_0x20d0e3[_0x05e6('0x14')]({'type':_0x1eeaa2['type'],'app':_0x05e6('0x23'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x1eeaa2[_0x05e6('0x19')],'exten':_0x1eeaa2[_0x05e6('0xa')],'priority':_0x30bb2b[_0x05e6('0x2f')]+_0x395efd[_0x05e6('0x1a')]+_0xd9d1bf++,'VoiceExtensionId':_0x1eeaa2['VoiceExtensionId']});_0x20d0e3['push']({'type':_0x1eeaa2[_0x05e6('0x18')],'app':_0x05e6('0x15'),'appdata':_0x05e6('0x3d'),'context':_0x1eeaa2[_0x05e6('0x19')],'exten':_0x1eeaa2[_0x05e6('0xa')],'priority':_0x30bb2b['length']+_0x395efd['priority']+_0xd9d1bf++,'VoiceExtensionId':_0x1eeaa2[_0x05e6('0x1b')]});}else{_0x20d0e3['push']({'type':_0x1eeaa2['type'],'app':'ExecIf','appdata':_0x05e6('0x3e'),'context':_0x1eeaa2['context'],'exten':_0x1eeaa2['exten'],'priority':_0x30bb2b[_0x05e6('0x2f')]+_0x395efd['priority']+_0xd9d1bf++,'VoiceExtensionId':_0x1eeaa2[_0x05e6('0x1b')]});_0x20d0e3[_0x05e6('0x14')]({'type':_0x1eeaa2[_0x05e6('0x18')],'app':'Set','appdata':_0x05e6('0x3f'),'context':_0x1eeaa2[_0x05e6('0x19')],'exten':_0x1eeaa2[_0x05e6('0xa')],'priority':_0x30bb2b[_0x05e6('0x2f')]+_0x395efd[_0x05e6('0x1a')]+_0xd9d1bf++,'VoiceExtensionId':_0x1eeaa2['VoiceExtensionId']});}}}for(var _0x3b372a=0x0;_0x3b372a<_0x30bb2b[_0x05e6('0x2f')];_0x3b372a+=0x1){var _0x62543a=_0x395efd[_0x05e6('0x1a')]+_0x30bb2b['length'];var _0x44df12=_0x3b372a===_0x30bb2b[_0x05e6('0x2f')]-0x1?_0x395efd[_0x05e6('0x1a')]+_0x20d0e3[_0x05e6('0x2f')]+_0x352850['length']+0x2:_0x395efd[_0x05e6('0x1a')]+_0x3b372a+0x1;_0x20d0e3[_0x05e6('0x40')](_0x3b372a,0x0,{'type':_0x1eeaa2[_0x05e6('0x18')],'app':_0x05e6('0x41'),'appdata':_0x30bb2b[_0x3b372a]+'?'+_0x1eeaa2[_0x05e6('0x19')]+_0x05e6('0x42')+_0x62543a+':'+_0x1eeaa2[_0x05e6('0x19')]+',${EXTEN},'+_0x44df12,'exten':_0x1eeaa2[_0x05e6('0xa')],'context':_0x1eeaa2[_0x05e6('0x19')],'priority':_0x395efd[_0x05e6('0x1a')]+_0x3b372a,'VoiceExtensionId':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x1b')]});}_0x1eeaa2['priority']=_0x20d0e3[_0x05e6('0x2f')]?_[_0x05e6('0x43')](_0x20d0e3)['priority']+0x1:_0x395efd[_0x05e6('0x1a')];_0x395efd[_0x05e6('0x1a')]=(_0x352850[_0x05e6('0x2f')]?_[_0x05e6('0x43')](_0x352850)['priority']:_0x1eeaa2[_0x05e6('0x1a')])+0x1;_0x395efd[_0x05e6('0x11')]=_[_0x05e6('0x44')](_0x395efd[_0x05e6('0x11')],_0x20d0e3,[_0x1eeaa2],_0x352850);}_0x395efd[_0x05e6('0x11')][_0x05e6('0x14')]({'type':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x18')],'app':_0x05e6('0x45'),'exten':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0xa')],'context':_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x19')],'priority':_0x395efd[_0x05e6('0x1a')],'VoiceExtensionId':_0x25bdeb[_0x50dc64][0x0]['VoiceExtensionId']});_0x3c3e82[_0x05e6('0x14')](_0x25bdeb[_0x50dc64][0x0][_0x05e6('0x1b')]);_0x5880b8=_['concat'](_0x5880b8,_0x395efd[_0x05e6('0x11')]);}}return _0x24306e['transaction'](function(_0x4d693a){return _0x24306e['models'][_0x05e6('0x6')][_0x05e6('0x46')]({'where':{'VoiceExtensionId':{'$in':_0x3c3e82}},'transaction':_0x4d693a})[_0x05e6('0x4')](function(_0x581a6a){return _0x24306e[_0x05e6('0x1')][_0x05e6('0x6')][_0x05e6('0x47')](_[_0x05e6('0x48')](_0x5880b8,_0x05e6('0x1a')),{'transaction':_0x4d693a});});});})[_0x05e6('0x49')](function(_0x4e225b){console[_0x05e6('0x4a')](_0x4e225b);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0x9b6a=['appType','custom','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','catch','error','rewrite','lodash','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','extensions','extension','find','push','type','Set','format','CDR(type)=%s','context','priority','VoiceExtensionId','inbound','outbound','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','indexOf','app','toLowerCase'];(function(_0xcb6d2b,_0x1a56ac){var _0x2c3687=function(_0x1b6ed0){while(--_0x1b6ed0){_0xcb6d2b['push'](_0xcb6d2b['shift']());}};_0x2c3687(++_0x1a56ac);}(_0x9b6a,0x99));var _0xa9b6=function(_0x762c59,_0x5e21c9){_0x762c59=_0x762c59-0x0;var _0x27c6f3=_0x9b6a[_0x762c59];return _0x27c6f3;};'use strict';var _=require(_0xa9b6('0x0'));var util=require('util');function rewrite(_0x4b06a1,_0x5ba76a){var _0x388b83=this;return _0x4b06a1[_0xa9b6('0x1')][_0xa9b6('0x2')][_0xa9b6('0x3')]({'raw':!![]})[_0xa9b6('0x4')](function(_0x332abd){_0x388b83[_0xa9b6('0x5')]=_0x332abd;return _0x4b06a1['models'][_0xa9b6('0x6')][_0xa9b6('0x3')]({'where':{'IntervalId':_0x5ba76a[_0xa9b6('0x7')]},'raw':!![]});})[_0xa9b6('0x4')](function(_0x46d0e5){return _0x4b06a1[_0xa9b6('0x1')][_0xa9b6('0x6')]['findAll']({'where':{'exten':{'$in':_[_0xa9b6('0x8')](_[_0xa9b6('0x9')](_0x46d0e5,_0xa9b6('0xa')))}},'order':[{'raw':_0xa9b6('0xb')}],'raw':!![]});})[_0xa9b6('0x4')](function(_0x16cc81){var _0x3e37fd=_[_0xa9b6('0xc')](_0x16cc81,{'priority':'1'});var _0xbbfe5f=_[_0xa9b6('0xc')](_0x16cc81,{'isApp':0x1});var _0x1a4673=_[_0xa9b6('0xd')](_0xbbfe5f,'exten');var _0x4ccee0=[_0xa9b6('0xe'),_0xa9b6('0xf')];var _0x402420=[];var _0x4739cb=[];for(var _0x2e7b40 in _0x1a4673){if(_0x1a4673[_0xa9b6('0x10')](_0x2e7b40)){_0x388b83['priority']=0x2;_0x388b83[_0xa9b6('0x11')]=[];_0x388b83[_0xa9b6('0x12')]=_[_0xa9b6('0x13')](_0x3e37fd,{'exten':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0xa')]});_0x388b83[_0xa9b6('0x11')][_0xa9b6('0x14')]({'type':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0x15')],'app':_0xa9b6('0x16'),'appdata':util[_0xa9b6('0x17')](_0xa9b6('0x18'),_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0x15')]),'context':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0x19')],'exten':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0xa')],'priority':_0x388b83[_0xa9b6('0x1a')]++,'VoiceExtensionId':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0x1b')]});if(_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0x15')]===_0xa9b6('0x1c')){_0x388b83['extensions'][_0xa9b6('0x14')]({'type':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0x15')],'app':'Set','appdata':'CDR(routeid)='+_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0x1b')],'context':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0x19')],'exten':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0xa')],'priority':_0x388b83[_0xa9b6('0x1a')]++,'VoiceExtensionId':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0x1b')]});}else if(_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0x15')]===_0xa9b6('0x1d')){if(_0x388b83[_0xa9b6('0x12')]){_0x388b83[_0xa9b6('0x11')][_0xa9b6('0x14')]({'type':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0x15')],'app':_0xa9b6('0x16'),'appdata':'CDR(destination)='+(_0x388b83['extension'][_0xa9b6('0x1e')]?'${EXTEN:'+_0x388b83[_0xa9b6('0x12')][_0xa9b6('0x1e')]+'}':_0xa9b6('0x1f')),'context':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0x19')],'exten':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0xa')],'priority':_0x388b83['priority']++,'VoiceExtensionId':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0x1b')]});}_0x388b83[_0xa9b6('0x11')][_0xa9b6('0x14')]({'type':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0x15')],'app':'Set','appdata':'CDR(routeid)='+_0x1a4673[_0x2e7b40][0x0]['VoiceExtensionId'],'context':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0x19')],'exten':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0xa')],'priority':_0x388b83['priority']++,'VoiceExtensionId':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0x1b')]});var _0x3af3a6=_0x388b83[_0xa9b6('0x1a')]++;_0x388b83['extensions']['push']({'type':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0x15')],'app':_0xa9b6('0x20'),'appdata':_0xa9b6('0x21')+(_0x3af3a6+0x2)+_0xa9b6('0x22')+(_0x3af3a6+0x1)+')','context':_0x1a4673[_0x2e7b40][0x0]['context'],'exten':_0x1a4673[_0x2e7b40][0x0]['exten'],'priority':_0x3af3a6,'VoiceExtensionId':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0x1b')]});if(_0x388b83[_0xa9b6('0x12')]){_0x388b83['extensions']['push']({'type':_0x1a4673[_0x2e7b40][0x0]['type'],'app':_0xa9b6('0x16'),'appdata':_0x388b83[_0xa9b6('0x12')][_0xa9b6('0x1e')]?'CDR(prefix)=${EXTEN:0:'+_0x388b83[_0xa9b6('0x12')][_0xa9b6('0x1e')]+'}':'CDR(prefix)=noprefix','context':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0x19')],'exten':_0x1a4673[_0x2e7b40][0x0]['exten'],'priority':_0x388b83[_0xa9b6('0x1a')]++,'VoiceExtensionId':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0x1b')]});}_0x388b83[_0xa9b6('0x11')][_0xa9b6('0x14')]({'type':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0x15')],'app':'Set','appdata':_0xa9b6('0x23')+_0x1a4673[_0x2e7b40][0x0]['VoiceExtensionId'],'context':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0x19')],'exten':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0xa')],'priority':_0x388b83[_0xa9b6('0x1a')]++,'VoiceExtensionId':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0x1b')]});if(_0x388b83[_0xa9b6('0x12')]&&_0x388b83[_0xa9b6('0x12')]['hasOwnProperty'](_0xa9b6('0x24'))&&_0x388b83[_0xa9b6('0x12')][_0xa9b6('0x24')]!==_0xa9b6('0x25')){_0x388b83[_0xa9b6('0x11')][_0xa9b6('0x14')]({'type':_0x1a4673[_0x2e7b40][0x0]['type'],'app':_0xa9b6('0x16'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x1a4673[_0x2e7b40][0x0]['context'],'exten':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0xa')],'priority':_0x388b83[_0xa9b6('0x1a')]++,'VoiceExtensionId':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0x1b')]});_0x388b83[_0xa9b6('0x11')][_0xa9b6('0x14')]({'type':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0x15')],'app':_0xa9b6('0x16'),'appdata':_0xa9b6('0x26')+_0x388b83[_0xa9b6('0x12')][_0xa9b6('0x24')]||_0xa9b6('0x27'),'context':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0x19')],'exten':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0xa')],'priority':_0x388b83[_0xa9b6('0x1a')]++,'VoiceExtensionId':_0x1a4673[_0x2e7b40][0x0]['VoiceExtensionId']});}}_0x388b83[_0xa9b6('0x11')][_0xa9b6('0x14')]({'type':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0x15')],'app':_0xa9b6('0x16'),'appdata':_0xa9b6('0x28'),'context':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0x19')],'exten':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0xa')],'priority':_0x388b83[_0xa9b6('0x1a')]++,'VoiceExtensionId':_0x1a4673[_0x2e7b40][0x0]['VoiceExtensionId']});_0x388b83[_0xa9b6('0x11')][_0xa9b6('0x14')]({'type':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0x15')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1a4673[_0x2e7b40][0x0]['context'],'exten':_0x1a4673[_0x2e7b40][0x0]['exten'],'priority':_0x388b83[_0xa9b6('0x1a')]++,'VoiceExtensionId':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0x1b')]});_0x388b83['extensions'][_0xa9b6('0x14')]({'type':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0x15')],'app':_0xa9b6('0x16'),'appdata':_0xa9b6('0x29'),'context':_0x1a4673[_0x2e7b40][0x0]['context'],'exten':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0xa')],'priority':_0x388b83[_0xa9b6('0x1a')]++,'VoiceExtensionId':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0x1b')]});for(var _0x56be06=0x0,_0x2d89ba=0x0;_0x56be06<_0x1a4673[_0x2e7b40]['length'];_0x56be06+=0x1,_0x2d89ba=0x0){var _0x5939e3=_0x1a4673[_0x2e7b40][_0x56be06];if(_0x5939e3[_0xa9b6('0x15')]){_0x5939e3[_0xa9b6('0x15')]=_0x5939e3[_0xa9b6('0x15')]['toLowerCase']();}var _0xf306f3=[];var _0x845ad9=[];delete _0x5939e3['id'];delete _0x5939e3[_0xa9b6('0x2a')];delete _0x5939e3[_0xa9b6('0x2b')];var _0x136714=_0x5939e3[_0xa9b6('0x2c')]!==_0xa9b6('0x2d')?[_0x5939e3[_0xa9b6('0x2c')]]:_0x5939e3[_0xa9b6('0x7')]?_[_0xa9b6('0x9')](_[_0xa9b6('0xc')](_0x388b83['intervals'],{'IntervalId':_0x5939e3[_0xa9b6('0x7')]}),_0xa9b6('0x2c')):[];if(_0x5939e3[_0xa9b6('0x10')](_0xa9b6('0x2e'))){if(_0x5939e3[_0xa9b6('0x2e')]&&_0x5939e3[_0xa9b6('0x2e')]!=='--'){_0xf306f3['push']({'type':_0x5939e3[_0xa9b6('0x15')],'app':_0xa9b6('0x16'),'appdata':_0xa9b6('0x2f')+_0x5939e3[_0xa9b6('0x2e')],'context':_0x5939e3[_0xa9b6('0x19')],'exten':_0x5939e3['exten'],'priority':_0x136714[_0xa9b6('0x30')]+_0x388b83[_0xa9b6('0x1a')]+_0x2d89ba++,'VoiceExtensionId':_0x5939e3['VoiceExtensionId']});}}if(_0x5939e3['type']==='outbound'&&_0x5939e3['hasOwnProperty'](_0xa9b6('0x31'))){if(_0x5939e3['callerID']){_0xf306f3[_0xa9b6('0x14')]({'type':_0x5939e3[_0xa9b6('0x15')],'app':_0xa9b6('0x20'),'appdata':_0xa9b6('0x32')+_0x5939e3['callerID']+')','context':_0x5939e3[_0xa9b6('0x19')],'exten':_0x5939e3[_0xa9b6('0xa')],'priority':_0x136714[_0xa9b6('0x30')]+_0x388b83['priority']+_0x2d89ba++,'VoiceExtensionId':_0x5939e3[_0xa9b6('0x1b')]});}else{_0xf306f3[_0xa9b6('0x14')]({'type':_0x5939e3['type'],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x5939e3['context'],'exten':_0x5939e3[_0xa9b6('0xa')],'priority':_0x136714['length']+_0x388b83[_0xa9b6('0x1a')]+_0x2d89ba++,'VoiceExtensionId':_0x5939e3[_0xa9b6('0x1b')]});}}if(_0x5939e3[_0xa9b6('0x10')]('answer')){if(_0x4ccee0[_0xa9b6('0x33')](_0x5939e3[_0xa9b6('0x34')][_0xa9b6('0x35')]())>=0x0&&_0x5939e3[_0xa9b6('0x36')]!==_0xa9b6('0x37')){if(_0x5939e3['answer']){_0xf306f3['push']({'type':_0x5939e3[_0xa9b6('0x15')],'app':_0xa9b6('0x20'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x5939e3[_0xa9b6('0x19')],'exten':_0x5939e3['exten'],'priority':_0x136714[_0xa9b6('0x30')]+_0x388b83[_0xa9b6('0x1a')]+_0x2d89ba++,'VoiceExtensionId':_0x5939e3[_0xa9b6('0x1b')]});_0xf306f3[_0xa9b6('0x14')]({'type':_0x5939e3[_0xa9b6('0x15')],'app':_0xa9b6('0x16'),'appdata':_0xa9b6('0x38'),'context':_0x5939e3[_0xa9b6('0x19')],'exten':_0x5939e3[_0xa9b6('0xa')],'priority':_0x136714[_0xa9b6('0x30')]+_0x388b83[_0xa9b6('0x1a')]+_0x2d89ba++,'VoiceExtensionId':_0x5939e3[_0xa9b6('0x1b')]});}else{_0xf306f3[_0xa9b6('0x14')]({'type':_0x5939e3[_0xa9b6('0x15')],'app':_0xa9b6('0x20'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x5939e3[_0xa9b6('0x19')],'exten':_0x5939e3[_0xa9b6('0xa')],'priority':_0x136714[_0xa9b6('0x30')]+_0x388b83[_0xa9b6('0x1a')]+_0x2d89ba++,'VoiceExtensionId':_0x5939e3[_0xa9b6('0x1b')]});_0xf306f3[_0xa9b6('0x14')]({'type':_0x5939e3['type'],'app':_0xa9b6('0x16'),'appdata':_0xa9b6('0x39'),'context':_0x5939e3[_0xa9b6('0x19')],'exten':_0x5939e3[_0xa9b6('0xa')],'priority':_0x136714['length']+_0x388b83[_0xa9b6('0x1a')]+_0x2d89ba++,'VoiceExtensionId':_0x5939e3[_0xa9b6('0x1b')]});}}}for(var _0x57b31a=0x0;_0x57b31a<_0x136714[_0xa9b6('0x30')];_0x57b31a+=0x1){var _0x2a0c82=_0x388b83[_0xa9b6('0x1a')]+_0x136714[_0xa9b6('0x30')];var _0xf2b5ac=_0x57b31a===_0x136714['length']-0x1?_0x388b83['priority']+_0xf306f3[_0xa9b6('0x30')]+_0x845ad9[_0xa9b6('0x30')]+0x2:_0x388b83[_0xa9b6('0x1a')]+_0x57b31a+0x1;_0xf306f3['splice'](_0x57b31a,0x0,{'type':_0x5939e3[_0xa9b6('0x15')],'app':_0xa9b6('0x3a'),'appdata':_0x136714[_0x57b31a]+'?'+_0x5939e3['context']+_0xa9b6('0x3b')+_0x2a0c82+':'+_0x5939e3['context']+',${EXTEN},'+_0xf2b5ac,'exten':_0x5939e3[_0xa9b6('0xa')],'context':_0x5939e3[_0xa9b6('0x19')],'priority':_0x388b83[_0xa9b6('0x1a')]+_0x57b31a,'VoiceExtensionId':_0x1a4673[_0x2e7b40][0x0]['VoiceExtensionId']});}_0x5939e3[_0xa9b6('0x1a')]=_0xf306f3[_0xa9b6('0x30')]?_[_0xa9b6('0x3c')](_0xf306f3)['priority']+0x1:_0x388b83['priority'];_0x388b83[_0xa9b6('0x1a')]=(_0x845ad9[_0xa9b6('0x30')]?_[_0xa9b6('0x3c')](_0x845ad9)['priority']:_0x5939e3['priority'])+0x1;_0x388b83[_0xa9b6('0x11')]=_[_0xa9b6('0x3d')](_0x388b83[_0xa9b6('0x11')],_0xf306f3,[_0x5939e3],_0x845ad9);}_0x388b83[_0xa9b6('0x11')][_0xa9b6('0x14')]({'type':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0x15')],'app':_0xa9b6('0x3e'),'exten':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0xa')],'context':_0x1a4673[_0x2e7b40][0x0][_0xa9b6('0x19')],'priority':_0x388b83[_0xa9b6('0x1a')],'VoiceExtensionId':_0x1a4673[_0x2e7b40][0x0]['VoiceExtensionId']});_0x402420[_0xa9b6('0x14')](_0x1a4673[_0x2e7b40][0x0]['VoiceExtensionId']);_0x4739cb=_['concat'](_0x4739cb,_0x388b83['extensions']);}}return _0x4b06a1[_0xa9b6('0x3f')](function(_0x34b480){return _0x4b06a1['models'][_0xa9b6('0x6')][_0xa9b6('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x402420}},'transaction':_0x34b480})[_0xa9b6('0x4')](function(_0x2de07d){return _0x4b06a1['models'][_0xa9b6('0x6')][_0xa9b6('0x41')](_['sortBy'](_0x4739cb,_0xa9b6('0x1a')),{'transaction':_0x34b480});});});})[_0xa9b6('0x42')](function(_0xb4d27f){console[_0xa9b6('0x43')](_0xb4d27f);});}exports[_0xa9b6('0x44')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 67ac588..a1aee50 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 _0x61ad=['stringify','cmContact','checkHopper','insert','into','cm_hopper','fromQuery','scheduledAt','createdAt','updatedAt','select','field','NOW()','ContactId','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ListId\x20=\x20?','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','push','query','VoiceQueueId','then','onlyIfOpen','sequelize','all','get','always','CampaignId','Campaign','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','resolve','exit','info','createReadStream','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','lodash','squel','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','Missing\x20filepath\x20parameter!','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','isNil','errors','length','map','hasOwnProperty','data','firstName','error','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','duplicate','Duplicate\x20Contact','CmContact','create','pick','catch','Error\x20while\x20creating\x20contact:\x20','message'];(function(_0x14f0e1,_0x68d4ff){var _0x1f40c9=function(_0x42d60c){while(--_0x42d60c){_0x14f0e1['push'](_0x14f0e1['shift']());}};_0x1f40c9(++_0x68d4ff);}(_0x61ad,0x1da));var _0xd61a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x61ad[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xd61a('0x0'));var fs=require('fs');var squel=require(_0xd61a('0x1'));var Papa=require('papaparse');var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xd61a('0x2'));config[_0xd61a('0x3')]=_[_0xd61a('0x4')](config['redis'],{'host':_0xd61a('0x5'),'port':0x18eb});var socket=require(_0xd61a('0x6'))(new Redis(config['redis']));require(_0xd61a('0x7'))[_0xd61a('0x8')](socket);try{if(!process[_0xd61a('0x9')][0x2]||process[_0xd61a('0x9')][0x2]==='undefined'||process['argv'][0x2]==='null'){throw new Error(_0xd61a('0xa'));}var FILEPATH=process[_0xd61a('0x9')][0x2];if(!process[_0xd61a('0x9')][0x3]||process[_0xd61a('0x9')][0x3]===_0xd61a('0xb')||process[_0xd61a('0x9')][0x3]===_0xd61a('0xc')||!process['argv'][0x4]||process['argv'][0x4]===_0xd61a('0xb')||process[_0xd61a('0x9')][0x4]===_0xd61a('0xc')){throw new Error(_0xd61a('0xd'));}var FIELDS=_[_0xd61a('0xe')](process['argv'][0x3][_0xd61a('0xf')](','),process[_0xd61a('0x9')][0x4]['split'](','));if(!process[_0xd61a('0x9')][0x5]||process['argv'][0x5]===_0xd61a('0xb')||process[_0xd61a('0x9')][0x5]===_0xd61a('0xc')){throw new Error(_0xd61a('0x10'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0xd61a('0x9')][0x6]&&process['argv'][0x6]!=='undefined'&&process['argv'][0x6]!=='null'?process['argv'][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0xd61a('0x9')][0x7]!==_0xd61a('0xb')&&process[_0xd61a('0x9')][0x7]!==_0xd61a('0xc')?process['argv'][0x7]:null;if(!process['argv'][0x8]||process[_0xd61a('0x9')][0x8]===_0xd61a('0xb')||process[_0xd61a('0x9')][0x8]===_0xd61a('0xc')){throw new Error(_0xd61a('0x11'));}var SOCKET_TIMESTAMP=process[_0xd61a('0x9')][0x8];}catch(_0x4bb9d9){logger['error'](_0x4bb9d9);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(_0x4202ed,_0x28fefa,_0x5e68ad,_0x2a6c26){var _0x1d3c84={'message':_0x28fefa};_0x1d3c84[_0x4202ed]=!![];if(_0x5e68ad){_0x1d3c84[_0xd61a('0x12')]=_0x5e68ad;}if(_0x2a6c26){_0x1d3c84[_0xd61a('0x13')]=_0x2a6c26;}return _0x1d3c84;}function isEmail(_0x180d3b){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'](_0x180d3b);}function checkRow(_0x10c3b7,_0x43340b,_0x3b3ea4){return new BPromise(function(_0x25e6a3,_0x1ffcb4){if(_[_0xd61a('0x14')](_0x10c3b7)){return _0x1ffcb4(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3b3ea4));}if(_0x10c3b7[_0xd61a('0x15')]&&_0x10c3b7['errors'][_0xd61a('0x16')]){var _0x29836e=_[_0xd61a('0x17')](_0x10c3b7[_0xd61a('0x15')],'message')['join'](';');return _0x1ffcb4(handleCheckRowError('error',_0x29836e,null,_0x3b3ea4));}var _0x95f979={};for(var _0x1a3c14 in FIELDS){if(FIELDS[_0xd61a('0x18')](_0x1a3c14)&&FIELDS[_0x1a3c14]){_0x95f979[_0x1a3c14]=_0x10c3b7[_0xd61a('0x19')][0x0][FIELDS[_0x1a3c14]]||_0x10c3b7[_0xd61a('0x19')][0x0]['\ufeff'+FIELDS[_0x1a3c14]];}}if(!_0x95f979[_0xd61a('0x1a')]){return _0x1ffcb4(handleCheckRowError(_0xd61a('0x1b'),_0xd61a('0x1c'),null,_0x3b3ea4));}if(!_0x95f979[_0xd61a('0x1d')]){return _0x1ffcb4(handleCheckRowError('error',_0xd61a('0x1e'),null,_0x3b3ea4));}if(_0x95f979[_0xd61a('0x1f')]){var _0x2e1157=moment(_0x95f979[_0xd61a('0x1f')],_0xd61a('0x20'));if(!_0x2e1157['isValid']()){return _0x1ffcb4(handleCheckRowError('error',_0xd61a('0x21'),null,_0x3b3ea4));}}if(_0x95f979[_0xd61a('0x22')]){if(!isEmail(_0x95f979[_0xd61a('0x22')])){return _0x1ffcb4(handleCheckRowError(_0xd61a('0x1b'),_0xd61a('0x23'),null,_0x3b3ea4));}}_0x95f979[_0xd61a('0x24')]=LISTID;_0x95f979[_0xd61a('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xd61a('0x16')]&&_0x43340b){var _0x50b97c={};for(var _0x4d2ee1=0x0,_0x433e65=DUPLICATES[_0xd61a('0x16')];_0x4d2ee1<_0x433e65;_0x4d2ee1+=0x1){_0x50b97c[DUPLICATES[_0x4d2ee1]]=_0x95f979[DUPLICATES[_0x4d2ee1]];}var _0x5f2516=_['find'](_0x43340b,_0x50b97c);if(_0x5f2516){return _0x1ffcb4(handleCheckRowError(_0xd61a('0x26'),_0xd61a('0x27'),_0x5f2516,_0x3b3ea4));}}return db[_0xd61a('0x28')][_0xd61a('0x29')](_0x95f979,{'raw':!![],'hooks':![],'fields':_['keys'](_0x95f979)})['then'](function(_0x161886){if(DUPLICATES&&DUPLICATES[_0xd61a('0x16')]&&_0x43340b){_0x43340b['push'](_[_0xd61a('0x2a')](_0x95f979,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x161886['id'];return _0x25e6a3();})[_0xd61a('0x2b')](function(_0x239be9){return _0x1ffcb4(handleCheckRowError(_0xd61a('0x1b'),_0xd61a('0x2c')+(_0x239be9[_0xd61a('0x2d')]||JSON[_0xd61a('0x2e')](_0x239be9)),null,_0x3b3ea4));});});}function checkHopper(){function _0x5b4aae(){return function(_0x5d64ae){logger[_0xd61a('0x1b')](_0xd61a('0x2f'),_0xd61a('0x30'),util['inspect'](_0x5d64ae,{'showHidden':![],'depth':null}));};}var _0x1aebe7=function(_0x211f29,_0x3aa1fd){var _0x2d5669=squel[_0xd61a('0x31')]()[_0xd61a('0x32')](_0xd61a('0x33'))[_0xd61a('0x34')]([_0xd61a('0x1d'),_0xd61a('0x35'),'ContactId',_0xd61a('0x24'),_0x3aa1fd,_0xd61a('0x36'),_0xd61a('0x37')],squel[_0xd61a('0x38')]()[_0xd61a('0x39')](_0xd61a('0x1d'),_0xd61a('0x1d'))['field'](_0xd61a('0x3a'),'scheduledAt')['field']('id',_0xd61a('0x3b'))[_0xd61a('0x39')](LISTID[_0xd61a('0x3c')](),_0xd61a('0x24'))[_0xd61a('0x39')](_0x211f29['id'][_0xd61a('0x3c')](),_0x3aa1fd)[_0xd61a('0x39')]('NOW()',_0xd61a('0x36'))[_0xd61a('0x39')](_0xd61a('0x3a'),'updatedAt')[_0xd61a('0x3d')](_0xd61a('0x3e'))[_0xd61a('0x3f')](_0xd61a('0x40'))[_0xd61a('0x3f')]('ListId\x20=\x20?',LISTID[_0xd61a('0x3c')]())[_0xd61a('0x3f')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xd61a('0x41'),squel[_0xd61a('0x38')]()['field'](_0xd61a('0x1d'))[_0xd61a('0x3d')]('cm_hopper')[_0xd61a('0x3f')](_0x3aa1fd+_0xd61a('0x42'),_0x211f29['id'][_0xd61a('0x3c')]())))[_0xd61a('0x3c')]();return _0x2d5669;};var _0x15cfc3=function(_0x54ae32,_0x52a379){var _0x3a6d21=squel['insert']()[_0xd61a('0x32')]('cm_hopper')[_0xd61a('0x34')]([_0xd61a('0x1d'),_0xd61a('0x35'),_0xd61a('0x3b'),_0xd61a('0x24'),_0x52a379,_0xd61a('0x36'),_0xd61a('0x37')],squel[_0xd61a('0x38')]()[_0xd61a('0x39')](_0xd61a('0x1d'),_0xd61a('0x1d'))[_0xd61a('0x39')](_0xd61a('0x3a'),_0xd61a('0x35'))['field']('id','ContactId')[_0xd61a('0x39')](LISTID[_0xd61a('0x3c')](),_0xd61a('0x24'))['field'](_0x54ae32['id'][_0xd61a('0x3c')](),_0x52a379)[_0xd61a('0x39')](_0xd61a('0x3a'),'createdAt')['field']('NOW()',_0xd61a('0x37'))[_0xd61a('0x3d')](_0xd61a('0x3e'))[_0xd61a('0x3f')](_0xd61a('0x40'))['where'](_0xd61a('0x43'),LISTID['toString']())[_0xd61a('0x3f')](_0xd61a('0x44'),squel[_0xd61a('0x45')](hopperContacts))[_0xd61a('0x3f')](_0xd61a('0x46'))[_0xd61a('0x3f')](_0xd61a('0x41'),squel['select']()['field'](_0xd61a('0x47'))[_0xd61a('0x3d')](_0xd61a('0x48'))[_0xd61a('0x3f')](_0x52a379+'\x20=\x20?',_0x54ae32['id'][_0xd61a('0x3c')]()))[_0xd61a('0x3f')](_0xd61a('0x41'),squel['select']()[_0xd61a('0x39')](_0xd61a('0x1d'))[_0xd61a('0x3d')](_0xd61a('0x33'))[_0xd61a('0x3f')](_0x52a379+_0xd61a('0x42'),_0x54ae32['id'][_0xd61a('0x3c')]())))[_0xd61a('0x3c')]();return _0x3a6d21;};function _0x1526b1(_0x222107,_0x4df148){var _0x37a7c2=squel['insert']()[_0xd61a('0x32')](_0xd61a('0x33'))[_0xd61a('0x34')]([_0xd61a('0x1d'),_0xd61a('0x35'),_0xd61a('0x3b'),_0xd61a('0x24'),_0x4df148,_0xd61a('0x36'),'updatedAt'],squel[_0xd61a('0x38')]()[_0xd61a('0x39')]('phone',_0xd61a('0x1d'))[_0xd61a('0x39')](_0xd61a('0x3a'),'scheduledAt')['field']('id',_0xd61a('0x3b'))[_0xd61a('0x39')](LISTID[_0xd61a('0x3c')](),'ListId')['field'](_0x222107['id']['toString'](),_0x4df148)[_0xd61a('0x39')](_0xd61a('0x3a'),_0xd61a('0x36'))[_0xd61a('0x39')](_0xd61a('0x3a'),_0xd61a('0x37'))['from'](_0xd61a('0x3e'))['where'](_0xd61a('0x40'))[_0xd61a('0x3f')](_0xd61a('0x43'),LISTID['toString']())['where'](_0xd61a('0x44'),squel[_0xd61a('0x45')](hopperContacts))[_0xd61a('0x3f')](_0xd61a('0x46')))[_0xd61a('0x3c')]();return _0x37a7c2;}function _0xfcf6e6(_0x3b81a3,_0x3088b5){var _0x3dbcfb=squel[_0xd61a('0x31')]()[_0xd61a('0x32')](_0xd61a('0x49'))[_0xd61a('0x34')]([_0xd61a('0x1d'),_0xd61a('0x3b'),_0xd61a('0x24'),_0x3088b5,'createdAt','updatedAt'],squel[_0xd61a('0x38')]()[_0xd61a('0x39')]('phone',_0xd61a('0x1d'))[_0xd61a('0x39')]('id',_0xd61a('0x3b'))[_0xd61a('0x39')](LISTID[_0xd61a('0x3c')](),_0xd61a('0x24'))[_0xd61a('0x39')](_0x3b81a3['id']['toString'](),_0x3088b5)[_0xd61a('0x39')](_0xd61a('0x3a'),_0xd61a('0x36'))[_0xd61a('0x39')](_0xd61a('0x3a'),_0xd61a('0x37'))['from']('cm_contacts')[_0xd61a('0x3f')](_0xd61a('0x40'))[_0xd61a('0x3f')](_0xd61a('0x43'),LISTID['toString']())[_0xd61a('0x3f')](_0xd61a('0x44'),squel['str'](hopperContacts))[_0xd61a('0x3f')](_0xd61a('0x46')))[_0xd61a('0x3c')]();return _0x3dbcfb;}return db[_0xd61a('0x4a')][_0xd61a('0x4b')]({'where':{'type':_0xd61a('0x4c')},'attributes':['id',_0xd61a('0x4d')],'include':[{'model':db[_0xd61a('0x4e')],'as':_0xd61a('0x4f'),'where':{'id':LISTID}}]})['then'](function(_0x27ff9a){var _0x1b1430=[];if(_0x27ff9a){var _0x44abdf;for(var _0x680f32=0x0,_0x4e5d75;_0x680f32<_0x27ff9a['length'];_0x680f32+=0x1){_0x4e5d75=_0x27ff9a[_0x680f32]['get']({'plain':!![]});switch(_0x4e5d75[_0xd61a('0x4d')]){case'always':_0x1b1430[_0xd61a('0x50')](db['sequelize'][_0xd61a('0x51')](_0x15cfc3(_0x4e5d75,_0xd61a('0x52')))[_0xd61a('0x53')](function(){})[_0xd61a('0x2b')](_0x5b4aae()));break;case _0xd61a('0x54'):_0x1b1430[_0xd61a('0x50')](db[_0xd61a('0x55')]['query'](_0x1aebe7(_0x4e5d75,'VoiceQueueId'))[_0xd61a('0x53')](function(){})[_0xd61a('0x2b')](_0x5b4aae()));break;default:_0x1b1430['push'](db[_0xd61a('0x55')][_0xd61a('0x51')](_0x1526b1(_0x4e5d75,_0xd61a('0x52')))[_0xd61a('0x53')](function(){})[_0xd61a('0x2b')](_0x5b4aae()));}}}return _0x1b1430;})[_0xd61a('0x56')]()['then'](function(){return db[_0xd61a('0x4a')][_0xd61a('0x4b')]({'where':{'type':_0xd61a('0x4c')},'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0xd61a('0x53')](function(_0x1aa295){var _0xa92fa=[];if(_0x1aa295){var _0x1c7f3e;for(var _0x2c1049=0x0,_0x1423b9;_0x2c1049<_0x1aa295[_0xd61a('0x16')];_0x2c1049+=0x1){_0x1423b9=_0x1aa295[_0x2c1049][_0xd61a('0x57')]({'plain':!![]});_0xa92fa[_0xd61a('0x50')](db['sequelize'][_0xd61a('0x51')](_0xfcf6e6(_0x1423b9,'VoiceQueueId'))[_0xd61a('0x53')](function(){})[_0xd61a('0x2b')](_0x5b4aae()));}}return _0xa92fa;})[_0xd61a('0x56')]();})[_0xd61a('0x53')](function(){return db['Campaign'][_0xd61a('0x4b')]({'attributes':['id',_0xd61a('0x4d')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0xd61a('0x53')](function(_0x280c58){var _0x564d01=[];if(_0x280c58){for(var _0x4e0733=0x0,_0x6ab89d;_0x4e0733<_0x280c58[_0xd61a('0x16')];_0x4e0733+=0x1){_0x6ab89d=_0x280c58[_0x4e0733][_0xd61a('0x57')]({'plain':!![]});switch(_0x6ab89d['dialCheckDuplicateType']){case _0xd61a('0x58'):_0x564d01['push'](db[_0xd61a('0x55')]['query'](_0x15cfc3(_0x6ab89d,_0xd61a('0x59')))[_0xd61a('0x53')](function(){})[_0xd61a('0x2b')](_0x5b4aae()));break;case'onlyIfOpen':_0x564d01['push'](db['sequelize'][_0xd61a('0x51')](_0x1aebe7(_0x6ab89d,_0xd61a('0x59')))[_0xd61a('0x53')](function(){})[_0xd61a('0x2b')](_0x5b4aae()));break;default:_0x564d01['push'](db[_0xd61a('0x55')][_0xd61a('0x51')](_0x1526b1(_0x6ab89d,_0xd61a('0x59')))[_0xd61a('0x53')](function(){})[_0xd61a('0x2b')](_0x5b4aae()));}}}return _0x564d01;})[_0xd61a('0x56')]();})[_0xd61a('0x53')](function(){return db[_0xd61a('0x5a')][_0xd61a('0x4b')]({'attributes':['id'],'include':[{'model':db[_0xd61a('0x4e')],'as':_0xd61a('0x5b'),'where':{'id':LISTID}}]})[_0xd61a('0x53')](function(_0x44a87c){var _0x16b220=[];if(_0x44a87c){for(var _0x45aa12=0x0,_0x4d2501;_0x45aa12<_0x44a87c[_0xd61a('0x16')];_0x45aa12+=0x1){_0x4d2501=_0x44a87c[_0x45aa12]['get']({'plain':!![]});_0x16b220[_0xd61a('0x50')](db[_0xd61a('0x55')][_0xd61a('0x51')](_0xfcf6e6(_0x4d2501,_0xd61a('0x59')))[_0xd61a('0x53')](function(){})[_0xd61a('0x2b')](_0x5b4aae()));}}return _0x16b220;})[_0xd61a('0x56')]();})[_0xd61a('0x2b')](function(_0x15c246){logger['error'](_0xd61a('0x5c'),_0xd61a('0x5d'),_0x15c246[_0xd61a('0x2d')]);});}var processPromises=function(_0x22ca61){return BPromise[_0xd61a('0x56')](promises)['then'](function(_0x4fe687){})[_0xd61a('0x2b')](function(_0x364471){logger[_0xd61a('0x1b')](_0xd61a('0x5e'),JSON[_0xd61a('0x2e')](_0x364471));})[_0xd61a('0x5f')](function(){socket['emit'](_0xd61a('0x60')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x22ca61){return _0x22ca61[_0xd61a('0x61')]();}});};var endCsv=function(){return BPromise[_0xd61a('0x62')]()[_0xd61a('0x53')](function(){if(hopperContacts){return checkHopper();}})[_0xd61a('0x53')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x1847e1){logger[_0xd61a('0x1b')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0xd61a('0x2e')](_0x1847e1));}finally{process[_0xd61a('0x63')](0x0);}});};process['on']('SIGINT',function(){logger[_0xd61a('0x64')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0xd61a('0x62')]()[_0xd61a('0x53')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0xd61a('0x28')][_0xd61a('0x4b')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x23b011){var _0x330578=fs[_0xd61a('0x65')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x330578,{'header':!![],'skipEmptyLines':!![],'step':function(_0x44df25,_0x261485){total+=0x1;var _0x35a0d7=total;promises['push'](checkRow(_0x44df25,_0x23b011,_0x35a0d7)['then'](function(){success+=0x1;})['catch'](function(_0x256518){if(_0x256518[_0xd61a('0x1b')]){errors+=0x1;delete _0x256518[_0xd61a('0x1b')];}else if(_0x256518[_0xd61a('0x26')]){duplicates+=0x1;delete _0x256518[_0xd61a('0x26')];}rows[_0xd61a('0x50')](_0x256518);}));if(total%0xc8===0x0){_0x261485['pause']();return processPromises(_0x261485);}},'complete':function(){return processPromises()['then'](function(){logger[_0xd61a('0x64')](_0xd61a('0x66'));endCsv();});},'error':function(_0x233d60,_0x31817a){logger[_0xd61a('0x64')](_0xd61a('0x67'),JSON['stringify'](_0x233d60));endCsv();}});})[_0xd61a('0x2b')](function(_0x4f1182){logger['error']('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0xd61a('0x2e')](_0x4f1182));});}main(); \ No newline at end of file +var _0xa39e=['message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','find','duplicate','Duplicate\x20Contact','create','keys','then','push','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','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','\x20=\x20?','into','str','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','Lists','dialCheckDuplicateType','always','sequelize','query','VoiceQueueId','catch','CmList','BlackLists','get','all','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','resume','resolve','contact:csv_','exit','SIGINT','info','CmContact','parse','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','squel','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','errors','map'];(function(_0xe38764,_0x28ce79){var _0x5979cf=function(_0x1fedef){while(--_0x1fedef){_0xe38764['push'](_0xe38764['shift']());}};_0x5979cf(++_0x28ce79);}(_0xa39e,0x12f));var _0xea39=function(_0x3d78ce,_0x83c8a9){_0x3d78ce=_0x3d78ce-0x0;var _0x150489=_0xa39e[_0x3d78ce];return _0x150489;};'use strict';var BPromise=require(_0xea39('0x0'));var util=require('util');var _=require('lodash');var fs=require('fs');var squel=require(_0xea39('0x1'));var Papa=require('papaparse');var Redis=require('ioredis');var db=require(_0xea39('0x2'))['db'];var config=require(_0xea39('0x3'));var logger=require(_0xea39('0x4'))(_0xea39('0x5'));config[_0xea39('0x6')]=_[_0xea39('0x7')](config[_0xea39('0x6')],{'host':_0xea39('0x8'),'port':0x18eb});var socket=require(_0xea39('0x9'))(new Redis(config[_0xea39('0x6')]));require(_0xea39('0xa'))[_0xea39('0xb')](socket);try{if(!process[_0xea39('0xc')][0x2]||process[_0xea39('0xc')][0x2]===_0xea39('0xd')||process['argv'][0x2]==='null'){throw new Error(_0xea39('0xe'));}var FILEPATH=process[_0xea39('0xc')][0x2];if(!process[_0xea39('0xc')][0x3]||process[_0xea39('0xc')][0x3]==='undefined'||process[_0xea39('0xc')][0x3]==='null'||!process[_0xea39('0xc')][0x4]||process[_0xea39('0xc')][0x4]===_0xea39('0xd')||process[_0xea39('0xc')][0x4]===_0xea39('0xf')){throw new Error(_0xea39('0x10'));}var FIELDS=_['zipObject'](process[_0xea39('0xc')][0x3]['split'](','),process['argv'][0x4][_0xea39('0x11')](','));if(!process[_0xea39('0xc')][0x5]||process['argv'][0x5]===_0xea39('0xd')||process['argv'][0x5]===_0xea39('0xf')){throw new Error(_0xea39('0x12'));}var LISTID=process[_0xea39('0xc')][0x5];var COMPANYID=process[_0xea39('0xc')][0x6]&&process[_0xea39('0xc')][0x6]!==_0xea39('0xd')&&process[_0xea39('0xc')][0x6]!=='null'?process['argv'][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0xea39('0xc')][0x7]!==_0xea39('0xd')&&process[_0xea39('0xc')][0x7]!==_0xea39('0xf')?process[_0xea39('0xc')][0x7]:null;if(!process[_0xea39('0xc')][0x8]||process[_0xea39('0xc')][0x8]===_0xea39('0xd')||process['argv'][0x8]===_0xea39('0xf')){throw new Error(_0xea39('0x13'));}var SOCKET_TIMESTAMP=process[_0xea39('0xc')][0x8];}catch(_0x21fc4a){logger[_0xea39('0x14')](_0x21fc4a);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(_0x5a21dd,_0x5596f5,_0x326938,_0x4bd603){var _0x4d9711={'message':_0x5596f5};_0x4d9711[_0x5a21dd]=!![];if(_0x326938){_0x4d9711[_0xea39('0x15')]=_0x326938;}if(_0x4bd603){_0x4d9711[_0xea39('0x16')]=_0x4bd603;}return _0x4d9711;}function isEmail(_0x317acf){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))*$/[_0xea39('0x17')](_0x317acf);}function checkRow(_0x3dd410,_0x54952b,_0x205aec){return new BPromise(function(_0xb15da4,_0x3f335e){if(_[_0xea39('0x18')](_0x3dd410)){return _0x3f335e(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x205aec));}if(_0x3dd410[_0xea39('0x19')]&&_0x3dd410['errors']['length']){var _0x345f55=_[_0xea39('0x1a')](_0x3dd410[_0xea39('0x19')],_0xea39('0x1b'))['join'](';');return _0x3f335e(handleCheckRowError(_0xea39('0x14'),_0x345f55,null,_0x205aec));}var _0x1be9be={};for(var _0x231e43 in FIELDS){if(FIELDS[_0xea39('0x1c')](_0x231e43)&&FIELDS[_0x231e43]){_0x1be9be[_0x231e43]=_0x3dd410[_0xea39('0x1d')][0x0][FIELDS[_0x231e43]]||_0x3dd410['data'][0x0]['\ufeff'+FIELDS[_0x231e43]];}}if(!_0x1be9be[_0xea39('0x1e')]){return _0x3f335e(handleCheckRowError(_0xea39('0x14'),_0xea39('0x1f'),null,_0x205aec));}if(!_0x1be9be[_0xea39('0x20')]){return _0x3f335e(handleCheckRowError(_0xea39('0x14'),'phone\x20not\x20specified!',null,_0x205aec));}if(_0x1be9be[_0xea39('0x21')]){var _0x58cf05=moment(_0x1be9be[_0xea39('0x21')],_0xea39('0x22'));if(!_0x58cf05[_0xea39('0x23')]()){return _0x3f335e(handleCheckRowError(_0xea39('0x14'),_0xea39('0x24'),null,_0x205aec));}}if(_0x1be9be[_0xea39('0x25')]){if(!isEmail(_0x1be9be[_0xea39('0x25')])){return _0x3f335e(handleCheckRowError(_0xea39('0x14'),_0xea39('0x26'),null,_0x205aec));}}_0x1be9be[_0xea39('0x27')]=LISTID;_0x1be9be[_0xea39('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xea39('0x29')]&&_0x54952b){var _0xc90c8a={};for(var _0x2acaaf=0x0,_0x418beb=DUPLICATES[_0xea39('0x29')];_0x2acaaf<_0x418beb;_0x2acaaf+=0x1){_0xc90c8a[DUPLICATES[_0x2acaaf]]=_0x1be9be[DUPLICATES[_0x2acaaf]];}var _0x698b83=_[_0xea39('0x2a')](_0x54952b,_0xc90c8a);if(_0x698b83){return _0x3f335e(handleCheckRowError(_0xea39('0x2b'),_0xea39('0x2c'),_0x698b83,_0x205aec));}}return db['CmContact'][_0xea39('0x2d')](_0x1be9be,{'raw':!![],'hooks':![],'fields':_[_0xea39('0x2e')](_0x1be9be)})[_0xea39('0x2f')](function(_0x351597){if(DUPLICATES&&DUPLICATES[_0xea39('0x29')]&&_0x54952b){_0x54952b[_0xea39('0x30')](_['pick'](_0x1be9be,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x351597['id'];return _0xb15da4();})['catch'](function(_0x442e8a){return _0x3f335e(handleCheckRowError(_0xea39('0x14'),_0xea39('0x31')+(_0x442e8a[_0xea39('0x1b')]||JSON[_0xea39('0x32')](_0x442e8a)),null,_0x205aec));});});}function checkHopper(){function _0x840e52(){return function(_0xfb4ba7){logger[_0xea39('0x14')]('cmContact',_0xea39('0x33'),util[_0xea39('0x34')](_0xfb4ba7,{'showHidden':![],'depth':null}));};}var _0x52c7ef=function(_0x1f73d7,_0x20877e){var _0x192f90=squel[_0xea39('0x35')]()['into'](_0xea39('0x36'))[_0xea39('0x37')](['phone',_0xea39('0x38'),_0xea39('0x39'),_0xea39('0x27'),_0x20877e,_0xea39('0x3a'),_0xea39('0x3b')],squel[_0xea39('0x3c')]()[_0xea39('0x3d')](_0xea39('0x20'),_0xea39('0x20'))['field'](_0xea39('0x3e'),_0xea39('0x38'))[_0xea39('0x3d')]('id',_0xea39('0x39'))[_0xea39('0x3d')](LISTID[_0xea39('0x3f')](),_0xea39('0x27'))[_0xea39('0x3d')](_0x1f73d7['id']['toString'](),_0x20877e)[_0xea39('0x3d')](_0xea39('0x3e'),_0xea39('0x3a'))['field'](_0xea39('0x3e'),_0xea39('0x3b'))[_0xea39('0x40')](_0xea39('0x41'))[_0xea39('0x42')](_0xea39('0x43'))[_0xea39('0x42')](_0xea39('0x44'),LISTID[_0xea39('0x3f')]())[_0xea39('0x42')](_0xea39('0x45'))[_0xea39('0x42')]('phone\x20NOT\x20IN\x20(?)',squel[_0xea39('0x3c')]()[_0xea39('0x3d')]('phone')[_0xea39('0x40')](_0xea39('0x36'))['where'](_0x20877e+_0xea39('0x46'),_0x1f73d7['id'][_0xea39('0x3f')]())))[_0xea39('0x3f')]();return _0x192f90;};var _0x2b7c7e=function(_0x4845f9,_0x1a75a8){var _0x10b70e=squel[_0xea39('0x35')]()[_0xea39('0x47')](_0xea39('0x36'))[_0xea39('0x37')]([_0xea39('0x20'),_0xea39('0x38'),_0xea39('0x39'),_0xea39('0x27'),_0x1a75a8,_0xea39('0x3a'),_0xea39('0x3b')],squel[_0xea39('0x3c')]()[_0xea39('0x3d')]('phone',_0xea39('0x20'))[_0xea39('0x3d')](_0xea39('0x3e'),_0xea39('0x38'))[_0xea39('0x3d')]('id',_0xea39('0x39'))[_0xea39('0x3d')](LISTID['toString'](),'ListId')['field'](_0x4845f9['id'][_0xea39('0x3f')](),_0x1a75a8)[_0xea39('0x3d')]('NOW()','createdAt')['field'](_0xea39('0x3e'),_0xea39('0x3b'))['from'](_0xea39('0x41'))[_0xea39('0x42')](_0xea39('0x43'))[_0xea39('0x42')](_0xea39('0x44'),LISTID[_0xea39('0x3f')]())[_0xea39('0x42')]('id\x20IN\x20?',squel[_0xea39('0x48')](hopperContacts))[_0xea39('0x42')](_0xea39('0x45'))[_0xea39('0x42')](_0xea39('0x49'),squel[_0xea39('0x3c')]()[_0xea39('0x3d')](_0xea39('0x4a'))[_0xea39('0x40')](_0xea39('0x4b'))[_0xea39('0x42')](_0x1a75a8+_0xea39('0x46'),_0x4845f9['id'][_0xea39('0x3f')]()))[_0xea39('0x42')](_0xea39('0x49'),squel[_0xea39('0x3c')]()[_0xea39('0x3d')](_0xea39('0x20'))[_0xea39('0x40')](_0xea39('0x36'))[_0xea39('0x42')](_0x1a75a8+_0xea39('0x46'),_0x4845f9['id'][_0xea39('0x3f')]())))[_0xea39('0x3f')]();return _0x10b70e;};function _0x4c63dc(_0x742e12,_0x25f10f){var _0x183415=squel['insert']()[_0xea39('0x47')](_0xea39('0x36'))[_0xea39('0x37')]([_0xea39('0x20'),'scheduledAt',_0xea39('0x39'),'ListId',_0x25f10f,_0xea39('0x3a'),_0xea39('0x3b')],squel[_0xea39('0x3c')]()['field'](_0xea39('0x20'),'phone')[_0xea39('0x3d')]('NOW()',_0xea39('0x38'))[_0xea39('0x3d')]('id',_0xea39('0x39'))['field'](LISTID[_0xea39('0x3f')](),_0xea39('0x27'))[_0xea39('0x3d')](_0x742e12['id'][_0xea39('0x3f')](),_0x25f10f)[_0xea39('0x3d')](_0xea39('0x3e'),_0xea39('0x3a'))[_0xea39('0x3d')]('NOW()',_0xea39('0x3b'))['from'](_0xea39('0x41'))[_0xea39('0x42')]('deletedAt\x20IS\x20NULL')[_0xea39('0x42')](_0xea39('0x44'),LISTID[_0xea39('0x3f')]())[_0xea39('0x42')](_0xea39('0x4c'),squel[_0xea39('0x48')](hopperContacts))[_0xea39('0x42')](_0xea39('0x45')))[_0xea39('0x3f')]();return _0x183415;}function _0xf2f060(_0x4e0e2a,_0x34f00a){var _0x449649=squel[_0xea39('0x35')]()['into'](_0xea39('0x4d'))[_0xea39('0x37')]([_0xea39('0x20'),_0xea39('0x39'),_0xea39('0x27'),_0x34f00a,'createdAt',_0xea39('0x3b')],squel[_0xea39('0x3c')]()[_0xea39('0x3d')](_0xea39('0x20'),_0xea39('0x20'))['field']('id',_0xea39('0x39'))[_0xea39('0x3d')](LISTID[_0xea39('0x3f')](),_0xea39('0x27'))[_0xea39('0x3d')](_0x4e0e2a['id'][_0xea39('0x3f')](),_0x34f00a)['field'](_0xea39('0x3e'),_0xea39('0x3a'))[_0xea39('0x3d')](_0xea39('0x3e'),_0xea39('0x3b'))[_0xea39('0x40')](_0xea39('0x41'))[_0xea39('0x42')](_0xea39('0x43'))[_0xea39('0x42')](_0xea39('0x44'),LISTID[_0xea39('0x3f')]())[_0xea39('0x42')](_0xea39('0x4c'),squel[_0xea39('0x48')](hopperContacts))[_0xea39('0x42')](_0xea39('0x45')))[_0xea39('0x3f')]();return _0x449649;}return db[_0xea39('0x4e')][_0xea39('0x4f')]({'where':{'type':_0xea39('0x50')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0xea39('0x51'),'where':{'id':LISTID}}]})[_0xea39('0x2f')](function(_0x20c3ef){var _0xb1dd9d=[];if(_0x20c3ef){var _0x1b8d6c;for(var _0x2b1140=0x0,_0x482d57;_0x2b1140<_0x20c3ef[_0xea39('0x29')];_0x2b1140+=0x1){_0x482d57=_0x20c3ef[_0x2b1140]['get']({'plain':!![]});switch(_0x482d57[_0xea39('0x52')]){case _0xea39('0x53'):_0xb1dd9d[_0xea39('0x30')](db[_0xea39('0x54')][_0xea39('0x55')](_0x2b7c7e(_0x482d57,_0xea39('0x56')))['then'](function(){})['catch'](_0x840e52()));break;case'onlyIfOpen':_0xb1dd9d[_0xea39('0x30')](db['sequelize'][_0xea39('0x55')](_0x52c7ef(_0x482d57,_0xea39('0x56')))[_0xea39('0x2f')](function(){})[_0xea39('0x57')](_0x840e52()));break;default:_0xb1dd9d['push'](db[_0xea39('0x54')][_0xea39('0x55')](_0x4c63dc(_0x482d57,'VoiceQueueId'))[_0xea39('0x2f')](function(){})[_0xea39('0x57')](_0x840e52()));}}}return _0xb1dd9d;})['all']()[_0xea39('0x2f')](function(){return db[_0xea39('0x4e')][_0xea39('0x4f')]({'where':{'type':_0xea39('0x50')},'attributes':['id'],'include':[{'model':db[_0xea39('0x58')],'as':_0xea39('0x59'),'where':{'id':LISTID}}]})[_0xea39('0x2f')](function(_0x5d7fa4){var _0x22915a=[];if(_0x5d7fa4){var _0x55d290;for(var _0x3db0fe=0x0,_0x19b30e;_0x3db0fe<_0x5d7fa4['length'];_0x3db0fe+=0x1){_0x19b30e=_0x5d7fa4[_0x3db0fe][_0xea39('0x5a')]({'plain':!![]});_0x22915a[_0xea39('0x30')](db[_0xea39('0x54')]['query'](_0xf2f060(_0x19b30e,_0xea39('0x56')))[_0xea39('0x2f')](function(){})['catch'](_0x840e52()));}}return _0x22915a;})[_0xea39('0x5b')]();})[_0xea39('0x2f')](function(){return db[_0xea39('0x5c')][_0xea39('0x4f')]({'attributes':['id',_0xea39('0x52')],'include':[{'model':db[_0xea39('0x58')],'as':_0xea39('0x51'),'where':{'id':LISTID}}]})['then'](function(_0x2492f0){var _0x3bc3ce=[];if(_0x2492f0){for(var _0x3a600f=0x0,_0x435013;_0x3a600f<_0x2492f0[_0xea39('0x29')];_0x3a600f+=0x1){_0x435013=_0x2492f0[_0x3a600f]['get']({'plain':!![]});switch(_0x435013[_0xea39('0x52')]){case _0xea39('0x53'):_0x3bc3ce[_0xea39('0x30')](db['sequelize']['query'](_0x2b7c7e(_0x435013,_0xea39('0x5d')))['then'](function(){})[_0xea39('0x57')](_0x840e52()));break;case'onlyIfOpen':_0x3bc3ce[_0xea39('0x30')](db[_0xea39('0x54')]['query'](_0x52c7ef(_0x435013,'CampaignId'))[_0xea39('0x2f')](function(){})[_0xea39('0x57')](_0x840e52()));break;default:_0x3bc3ce[_0xea39('0x30')](db[_0xea39('0x54')][_0xea39('0x55')](_0x4c63dc(_0x435013,_0xea39('0x5d')))['then'](function(){})[_0xea39('0x57')](_0x840e52()));}}}return _0x3bc3ce;})['all']();})['then'](function(){return db[_0xea39('0x5c')][_0xea39('0x4f')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0xea39('0x2f')](function(_0x3ddddd){var _0x1498b7=[];if(_0x3ddddd){for(var _0x5b47d4=0x0,_0x2b8874;_0x5b47d4<_0x3ddddd['length'];_0x5b47d4+=0x1){_0x2b8874=_0x3ddddd[_0x5b47d4][_0xea39('0x5a')]({'plain':!![]});_0x1498b7[_0xea39('0x30')](db['sequelize'][_0xea39('0x55')](_0xf2f060(_0x2b8874,_0xea39('0x5d')))[_0xea39('0x2f')](function(){})['catch'](_0x840e52()));}}return _0x1498b7;})[_0xea39('0x5b')]();})[_0xea39('0x57')](function(_0x12d164){logger[_0xea39('0x14')](_0xea39('0x5e'),_0xea39('0x5f'),_0x12d164['message']);});}var processPromises=function(_0x1aafa7){return BPromise[_0xea39('0x5b')](promises)[_0xea39('0x2f')](function(_0xd86e85){})[_0xea39('0x57')](function(_0x13f8d4){logger[_0xea39('0x14')](_0xea39('0x60'),JSON['stringify'](_0x13f8d4));})[_0xea39('0x61')](function(){socket[_0xea39('0x62')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1aafa7){return _0x1aafa7[_0xea39('0x63')]();}});};var endCsv=function(){return BPromise[_0xea39('0x64')]()[_0xea39('0x2f')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0xea39('0x62')](_0xea39('0x65')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0xe17549){logger[_0xea39('0x14')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0xea39('0x32')](_0xe17549));}finally{process[_0xea39('0x66')](0x0);}});};process['on'](_0xea39('0x67'),function(){logger[_0xea39('0x68')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0xea39('0x64')]()[_0xea39('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xea39('0x11')](',');return db[_0xea39('0x69')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xea39('0x2f')](function(_0x59b818){var _0x3e5f34=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xea39('0x6a')](_0x3e5f34,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5763cd,_0x43c49b){total+=0x1;var _0x107682=total;promises[_0xea39('0x30')](checkRow(_0x5763cd,_0x59b818,_0x107682)[_0xea39('0x2f')](function(){success+=0x1;})['catch'](function(_0xe01953){if(_0xe01953[_0xea39('0x14')]){errors+=0x1;delete _0xe01953['error'];}else if(_0xe01953[_0xea39('0x2b')]){duplicates+=0x1;delete _0xe01953[_0xea39('0x2b')];}rows[_0xea39('0x30')](_0xe01953);}));if(total%0xc8===0x0){_0x43c49b[_0xea39('0x6b')]();return processPromises(_0x43c49b);}},'complete':function(){return processPromises()[_0xea39('0x2f')](function(){logger[_0xea39('0x68')](_0xea39('0x6c'));endCsv();});},'error':function(_0x88d7b6,_0x77a6a7){logger[_0xea39('0x68')]('CSV\x20parse\x20error',JSON[_0xea39('0x32')](_0x88d7b6));endCsv();}});})[_0xea39('0x57')](function(_0x1fe749){logger['error'](_0xea39('0x6d'),JSON[_0xea39('0x32')](_0x1fe749));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 3272d0a..24c8920 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 _0x5085=['unlink','complete','argv','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','parse','No\x20agent\x20available','SIGINT','uncaughtException','path','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','import','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','scheduledat','ContactId','ListId','updatedAt','priority','recallme','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','toString','cm_contacts.createdAt','cm_hopper_black','createdAt','fields','ListId\x20=\x20?','\x20=\x20?','keys','CompanyId','cm_contacts',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','sequelize','query','spread','push','catch','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','header','writeFileSync','createReadStream','rows','data','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','UserId','isNumber','includes','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','length','SystemRow','appendFileSync','contact:import:','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','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','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','campaigns','each','then','finish','affectedRows','emit'];(function(_0x3d95e6,_0x24d50e){var _0x1dac59=function(_0x46a2f0){while(--_0x46a2f0){_0x3d95e6['push'](_0x3d95e6['shift']());}};_0x1dac59(++_0x24d50e);}(_0x5085,0x11d));var _0x5508=function(_0x149ad0,_0x5ea550){_0x149ad0=_0x149ad0-0x0;var _0x212a10=_0x5085[_0x149ad0];return _0x212a10;};'use strict';var fs=require('fs');var path=require(_0x5508('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require(_0x5508('0x1'));var BPromise=require(_0x5508('0x2'));var moment=require(_0x5508('0x3'));var squel=require(_0x5508('0x4'));var Redis=require(_0x5508('0x5'));var db=require(_0x5508('0x6'))['db'];var config=require(_0x5508('0x7'));var logger=require('../../../config/logger')(_0x5508('0x8'));config['redis']=_[_0x5508('0x9')](config[_0x5508('0xa')],{'host':_0x5508('0xb'),'port':0x18eb});var socket=require(_0x5508('0xc'))(new Redis(config[_0x5508('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x5508('0xd')](_0x5508('0xe'));function isEmail(_0x44c6c6){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'](_0x44c6c6);}function selectNotIn(_0x36284f,_0x49ad7e,_0x280d2e,_0x48e93c,_0x483fe4){return squel[_0x5508('0xf')]()[_0x5508('0x10')](_0x5508('0x11'))[_0x5508('0x12')](_0x48e93c)['join'](_0x49ad7e,null,_0x49ad7e+_0x5508('0x13')+_0x48e93c+'.'+_0x280d2e)[_0x5508('0x14')](_0x48e93c+'.'+_0x280d2e+_0x5508('0x15')+_0x36284f+'.'+_0x280d2e)[_0x5508('0x14')](_0x49ad7e+_0x5508('0x16')+_0x483fe4[_0x5508('0x17')]()+')');}function insertCmHopper(_0x820220,_0xb4707,_0x363258,_0x4f8874,_0x112cea){var _0x4093bc=[_0x5508('0x18'),'cm_contacts.scheduledat',_0x5508('0x19'),_0x5508('0x1a'),_0xb4707+'.'+_0x4f8874,'cm_contacts.createdAt',_0x5508('0x1b'),_0x5508('0x1c'),_0x5508('0x1d'),'\x22'+_0x112cea+'\x22'];return squel[_0x5508('0x1e')]()[_0x5508('0x1f')]('cm_hopper')[_0x5508('0x20')]([_0x5508('0x11'),_0x5508('0x21'),_0x5508('0x22'),_0x5508('0x23'),_0x4f8874,'createdAt',_0x5508('0x24'),_0x5508('0x25'),'UserId',_0x5508('0x26')],squel[_0x5508('0xf')]()['fields'](_0x4093bc)[_0x5508('0x12')](_0xb4707)[_0x5508('0x17')]('cm_contacts',null,_0x5508('0x27')+_0xb4707+_0x5508('0x28'))['join'](_0x363258,null,_0x363258+_0x5508('0x13')+_0xb4707+'.'+_0x4f8874)['where'](_0xb4707+_0x5508('0x29'),_0x820220)[_0x5508('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x5508('0x14')](_0x5508('0x2a'),selectNotIn(_0xb4707,_0x363258,_0x4f8874,_0x5508('0x2b'),[_0x5508('0x2c'),'\x22onlyIfOpen\x22']))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xb4707,_0x363258,_0x4f8874,_0x5508('0x2b'),[_0x5508('0x2c')])))[_0x5508('0x2d')]();}function insertCmHopperBlack(_0x347164,_0xf09bcf,_0x2c657b,_0x458669){var _0x38eb6c=['cm_contacts.phone',_0x5508('0x19'),_0x5508('0x1a'),_0xf09bcf+'.'+_0x458669,_0x5508('0x2e'),_0x5508('0x1b')];return squel[_0x5508('0x1e')]()[_0x5508('0x1f')](_0x5508('0x2f'))[_0x5508('0x20')]([_0x5508('0x11'),'ContactId',_0x5508('0x23'),_0x458669,_0x5508('0x30'),_0x5508('0x24')],squel['select']()[_0x5508('0x31')](_0x38eb6c)[_0x5508('0x12')](_0xf09bcf)[_0x5508('0x17')]('cm_contacts',null,_0x5508('0x27')+_0xf09bcf+_0x5508('0x28'))[_0x5508('0x17')](_0x2c657b,null,_0x2c657b+'.id\x20=\x20'+_0xf09bcf+'.'+_0x458669)[_0x5508('0x14')](_0xf09bcf+_0x5508('0x29'),_0x347164)[_0x5508('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x5508('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x5508('0xf')]()[_0x5508('0x10')]('phone')[_0x5508('0x12')](_0x5508('0x2f'))[_0x5508('0x14')](_0x5508('0x32'),_0x347164)[_0x5508('0x14')](_0x458669+_0x5508('0x33'),_0xf09bcf+'.'+_0x458669)))[_0x5508('0x2d')]();}function insertCmContact(_0x5e6a01,_0x10bbb1,_0x4268f5,_0x33a7e5){var _0x54c840=_['concat'](_[_0x5508('0x34')](_0x33a7e5),[_0x5508('0x23'),_0x5508('0x35'),'createdAt',_0x5508('0x24')]);return squel[_0x5508('0x1e')]()[_0x5508('0x1f')](_0x5508('0x36'))['fromQuery'](_0x54c840,squel[_0x5508('0xf')]()[_0x5508('0x31')](_0x54c840)[_0x5508('0x12')](_0x10bbb1)[_0x5508('0x14')]('('+_0x4268f5['join'](',')+_0x5508('0x37'),squel['select']()[_0x5508('0x31')](_0x4268f5)[_0x5508('0x12')](_0x5508('0x36'))[_0x5508('0x14')](_0x5508('0x32'),_0x5e6a01)[_0x5508('0x14')](_0x5508('0x38')))[_0x5508('0x14')](_0x5508('0x39'),squel[_0x5508('0xf')]()[_0x5508('0x10')](_0x5508('0x3a'),_0x5508('0x3b'))[_0x5508('0x12')](_0x10bbb1)[_0x5508('0x3c')](_0x4268f5[_0x5508('0x17')](','))))[_0x5508('0x2d')]();}function handleStop(){logger[_0x5508('0x3d')](_0x5508('0x3e'));stopped=!![];}function handleUncaughtException(_0x4b9fc1){logger[_0x5508('0x3f')](_0x4b9fc1[_0x5508('0x40')]);process[_0x5508('0x41')](0x1);}function handleError(_0xe1b98c,_0xdabd0b){stats[_0x5508('0x42')]['push']({'name':_0xdabd0b['code'],'message':_0xdabd0b[_0x5508('0x40')],'row':_0xe1b98c});}function handleQuery(_0x500218){logger['info'](_0x500218);return db[_0x5508('0x43')][_0x5508('0x44')](_0x500218)[_0x5508('0x45')](function(_0x4835f2){results[_0x5508('0x46')](_0x4835f2);})[_0x5508('0x47')](function(_0x4a9dbb){logger[_0x5508('0x3f')](_0x4a9dbb[_0x5508('0x40')]);});}function main(_0xd8fdeb,_0x868260,_0x4293f1,_0x3d9606){logger[_0x5508('0x3d')](_0x5508('0x48'),_0xd8fdeb,JSON[_0x5508('0x49')](_0x868260));process[_0x5508('0x4a')](_0x5508('0x4b'));var _0x470590=_0x868260[_0x5508('0x4c')];var _0x14ec60=_0x868260[_0x5508('0x4d')];var _0x2377dc=path['join'](config[_0x5508('0x4e')],_0x5508('0x4f'),_0x14ec60+_0x5508('0x50'));var _0x2f4099=_[_0x5508('0x34')](_0x470590)[_0x5508('0x17')]();logger[_0x5508('0x3d')](_0x5508('0x51'),_0x2f4099);fs[_0x5508('0x52')](_0x2377dc,_0x2f4099+'\x0a');Papa['parse'](fs[_0x5508('0x53')](_0xd8fdeb),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4d110d,_0x476891){try{for(var _0x1dd139=0x0,_0x2a46b9=[];_0x1dd139<_0x4d110d['data']['length'];_0x1dd139++){stats[_0x5508('0x54')]+=0x1;if(_0x4d110d[_0x5508('0x42')][_0x1dd139]){handleError(_0x4d110d[_0x5508('0x55')][_0x1dd139],_0x4d110d[_0x5508('0x42')][_0x1dd139]);}else{var _0x523be8=[];for(var _0x225046 in _0x470590){if(_0x470590['hasOwnProperty'](_0x225046)){if(_0x4d110d[_0x5508('0x55')][_0x1dd139][_0x470590[_0x225046]]){var _0x455548=_[_0x5508('0x56')](_0x4d110d['data'][_0x1dd139][_0x470590[_0x225046]][_0x5508('0x57')](/"/g,'\x27'));switch(_0x225046){case _0x5508('0x21'):var _0x2a60ee=moment(_0x455548,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x2a60ee[_0x5508('0x58')]()){_0x2a46b9[_0x5508('0x46')]('\x22'+_0x455548+'\x22');}else{_0x523be8['push'](_0x5508('0x59'));}break;case _0x5508('0x25'):var _0xdc61b6=parseInt(_0x455548);_0x455548=_['isNaN'](_0xdc61b6)||_0xdc61b6<0x0||_0xdc61b6>0x4?_0x3d9606?0x3:0x2:_0xdc61b6;_0x2a46b9[_0x5508('0x46')]('\x22'+_0x455548+'\x22');break;case _0x5508('0x5a'):var _0x25573b=parseInt(_0x455548);if(_[_0x5508('0x5b')](_0x25573b)&&_[_0x5508('0x5c')](_0x4293f1,_0x25573b)){_0x2a46b9[_0x5508('0x46')]('\x22'+_0x25573b+'\x22');}else{_0x523be8[_0x5508('0x46')](_0x5508('0x5d'));}break;case _0x5508('0x5e'):if(isEmail(_0x455548)){_0x2a46b9[_0x5508('0x46')]('\x22'+_0x455548+'\x22');}else{_0x523be8[_0x5508('0x46')]('email\x20wrong\x20format');}break;case _0x5508('0x5f'):var _0x292e3a=moment(_0x455548,_0x5508('0x60'),!![]);if(_0x292e3a['isValid']()){_0x2a46b9[_0x5508('0x46')]('\x22'+_0x455548+'\x22');}else{_0x523be8[_0x5508('0x46')](_0x5508('0x61'));}break;default:_0x2a46b9['push']('\x22'+_0x455548+'\x22');}}else{switch(_0x225046){case _0x5508('0x62'):case _0x5508('0x11'):_0x523be8['push'](_0x225046+'\x20not\x20specified');break;default:_0x2a46b9[_0x5508('0x46')]('\x22\x22');}}}}if(_0x523be8[_0x5508('0x63')]){handleError(_0x4d110d[_0x5508('0x55')][_0x1dd139],{'code':_0x5508('0x64'),'message':_0x523be8[_0x5508('0x17')]()});}else{fs[_0x5508('0x65')](_0x2377dc,_0x2a46b9[_0x5508('0x17')]()+'\x0a');}_0x2a46b9=[];}if(!(stats[_0x5508('0x54')]%0xc8)){socket['emit'](_0x5508('0x66')+_0x14ec60,stats);stats[_0x5508('0x42')]=[];}}if(stopped){logger[_0x5508('0x3d')]('Abort\x20parser');_0x476891['abort']();}}catch(_0x88e8fa){handleError(_0x4d110d[_0x5508('0x55')][_0x1dd139],{'code':'SystemError','message':_0x88e8fa['message']});logger[_0x5508('0x3f')]('step',_0x88e8fa[_0x5508('0x40')]);}},'complete':function(){try{var _0x522e55=[];var _0x124443=_0x5508('0x36');if(_0x868260[_0x5508('0x67')]&&_0x868260[_0x5508('0x67')]['length']){_0x124443='cm_contacts_'+_0x14ec60;_0x522e55['push'](_0x5508('0x68')+_0x124443+_0x5508('0x69'));}var _0x3986d6=util[_0x5508('0xd')](_0x5508('0x6a'),_0x2377dc,_0x124443,_0x2f4099,_0x868260['ListId'],_0x868260[_0x5508('0x35')]||null,NOW,NOW);if(_[_0x5508('0x6b')](_0x470590[_0x5508('0x21')])){_0x3986d6+=_0x5508('0x6c');}_0x522e55['push'](_0x3986d6);if(_0x868260[_0x5508('0x67')]&&_0x868260[_0x5508('0x67')]['length']){_0x522e55['push'](insertCmContact(_0x868260[_0x5508('0x23')],_0x124443,_0x868260['duplicates'],_0x470590));_0x522e55['push'](_0x5508('0x6d')+_0x124443+';');}_0x522e55[_0x5508('0x46')](insertCmHopper(_0x868260[_0x5508('0x23')],_0x5508('0x6e'),_0x5508('0x6f'),_0x5508('0x70'),_0x3d9606));_0x522e55[_0x5508('0x46')](insertCmHopperBlack(_0x868260['ListId'],_0x5508('0x71'),'voice_queues',_0x5508('0x70')));_0x522e55[_0x5508('0x46')](insertCmHopper(_0x868260[_0x5508('0x23')],_0x5508('0x72'),'campaigns',_0x5508('0x73'),_0x3d9606));_0x522e55[_0x5508('0x46')](insertCmHopperBlack(_0x868260[_0x5508('0x23')],_0x5508('0x74'),_0x5508('0x75'),_0x5508('0x73')));BPromise[_0x5508('0x76')](_0x522e55,handleQuery)[_0x5508('0x77')](function(_0x1f55bd){stats[_0x5508('0x78')]=!![];stats[_0x5508('0x79')]=_0x868260[_0x5508('0x67')]&&_0x868260[_0x5508('0x67')]['length']?results[0x2][_0x5508('0x79')]:results[0x0][_0x5508('0x79')];socket[_0x5508('0x7a')](_0x5508('0x66')+_0x14ec60,stats);fs[_0x5508('0x7b')](_0xd8fdeb);fs[_0x5508('0x7b')](_0x2377dc);process[_0x5508('0x41')](0x0);})['catch'](function(_0x5e07a3){logger[_0x5508('0x3f')](_0x5e07a3[_0x5508('0x40')]);process[_0x5508('0x41')](0x1);});}catch(_0x1cb503){logger[_0x5508('0x3f')](_0x5508('0x7c'),_0x1cb503[_0x5508('0x40')]);process[_0x5508('0x41')](0x1);}},'error':function(_0x4a8cd6,_0x4d78b6,_0x4517e9,_0x628f31){throw new Error(_0x628f31);}});}function validate(){if(process[_0x5508('0x7d')]&&process[_0x5508('0x7d')][_0x5508('0x63')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x34c70c=path['join'](config[_0x5508('0x4e')],_0x5508('0x4f'),process['argv'][0x2]);if(!fs[_0x5508('0x7e')](_0x34c70c)){throw new Error(_0x5508('0x7f'));}var _0x27b414={};try{_0x27b414=JSON['parse'](process[_0x5508('0x7d')][0x3]);if(!_0x27b414[_0x5508('0x4c')]){throw new Error(_0x5508('0x80'));}if(!_0x27b414['binding']['phone']){throw new Error(_0x5508('0x81'));}if(!_0x27b414['binding']['firstName']){throw new Error(_0x5508('0x82'));}var _0x508b9b=0x0;if(_0x27b414[_0x5508('0x4c')]['UserId']){_0x508b9b=0x1;}if(!_0x27b414[_0x5508('0x23')]){throw new Error(_0x5508('0x83'));}}catch(_0x55e823){throw new Error('body\x20id\x20mandatory');}var _0x304bc3=[];try{_0x304bc3=_['map'](JSON[_0x5508('0x84')](process[_0x5508('0x7d')][0x4]),'id');}catch(_0x18fde5){logger['info'](_0x5508('0x85'));}main(_0x34c70c,_0x27b414,_0x304bc3,_0x508b9b);}validate();process['on'](_0x5508('0x86'),handleStop);process['on'](_0x5508('0x87'),handleUncaughtException); \ No newline at end of file +var _0x12b5=['argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','join','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','into','cm_hopper','fromQuery','createdAt','updatedAt','priority','UserId','recallme','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','insert','ListId','ListId\x20=\x20?','\x20=\x20?','concat','CompanyId','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','Received\x20SIGINT','error','message','exit','errors','push','code','info','query','spread','catch','main','send','start','root','server/files/tmp','.csv','header','writeFileSync','parse','createReadStream','data','length','rows','trim','replace','scheduledat','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','firstName','SystemRow','emit','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','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','isNil','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','finish','affectedRows','contact:import:','unlink','complete'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x12b5,0x117));var _0x512b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x12b5[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require(_0x512b('0x0'));var _=require(_0x512b('0x1'));var Papa=require(_0x512b('0x2'));var util=require(_0x512b('0x3'));var BPromise=require(_0x512b('0x4'));var moment=require('moment');var squel=require(_0x512b('0x5'));var Redis=require(_0x512b('0x6'));var db=require(_0x512b('0x7'))['db'];var config=require(_0x512b('0x8'));var logger=require(_0x512b('0x9'))(_0x512b('0xa'));config[_0x512b('0xb')]=_[_0x512b('0xc')](config[_0x512b('0xb')],{'host':_0x512b('0xd'),'port':0x18eb});var socket=require(_0x512b('0xe'))(new Redis(config[_0x512b('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x512b('0xf')](_0x512b('0x10'));function isEmail(_0x46fcc2){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'](_0x46fcc2);}function selectNotIn(_0x44f3dd,_0x3b3c23,_0x5452b8,_0x440be3,_0x16c05f){return squel[_0x512b('0x11')]()[_0x512b('0x12')](_0x512b('0x13'))['from'](_0x440be3)['join'](_0x3b3c23,null,_0x3b3c23+_0x512b('0x14')+_0x440be3+'.'+_0x5452b8)[_0x512b('0x15')](_0x440be3+'.'+_0x5452b8+'\x20=\x20'+_0x44f3dd+'.'+_0x5452b8)[_0x512b('0x15')](_0x3b3c23+_0x512b('0x16')+_0x16c05f[_0x512b('0x17')]()+')');}function insertCmHopper(_0x2f1923,_0x322154,_0x1de48e,_0x627add,_0x22521d){var _0x3825c4=['cm_contacts.phone','cm_contacts.scheduledat',_0x512b('0x18'),_0x512b('0x19'),_0x322154+'.'+_0x627add,_0x512b('0x1a'),'cm_contacts.updatedAt',_0x512b('0x1b'),'cm_contacts.UserId','\x22'+_0x22521d+'\x22'];return squel['insert']()[_0x512b('0x1c')](_0x512b('0x1d'))[_0x512b('0x1e')]([_0x512b('0x13'),'scheduledat','ContactId','ListId',_0x627add,_0x512b('0x1f'),_0x512b('0x20'),_0x512b('0x21'),_0x512b('0x22'),_0x512b('0x23')],squel[_0x512b('0x11')]()[_0x512b('0x24')](_0x3825c4)[_0x512b('0x25')](_0x322154)[_0x512b('0x17')](_0x512b('0x26'),null,_0x512b('0x27')+_0x322154+_0x512b('0x28'))[_0x512b('0x17')](_0x1de48e,null,_0x1de48e+_0x512b('0x14')+_0x322154+'.'+_0x627add)[_0x512b('0x15')](_0x322154+_0x512b('0x29'),_0x2f1923)[_0x512b('0x15')](_0x512b('0x2a'),NOW)[_0x512b('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x322154,_0x1de48e,_0x627add,'cm_hopper',[_0x512b('0x2b'),_0x512b('0x2c')]))['where'](_0x512b('0x2d'),selectNotIn(_0x322154,_0x1de48e,_0x627add,_0x512b('0x1d'),[_0x512b('0x2b')])))[_0x512b('0x2e')]();}function insertCmHopperBlack(_0x3eb5e2,_0x47aeb6,_0x3f2f3c,_0x392a8c){var _0xbfd4fd=['cm_contacts.phone',_0x512b('0x18'),'cm_contacts.ListId',_0x47aeb6+'.'+_0x392a8c,_0x512b('0x1a'),'cm_contacts.updatedAt'];return squel[_0x512b('0x2f')]()[_0x512b('0x1c')]('cm_hopper_black')[_0x512b('0x1e')](['phone','ContactId',_0x512b('0x30'),_0x392a8c,'createdAt',_0x512b('0x20')],squel[_0x512b('0x11')]()['fields'](_0xbfd4fd)[_0x512b('0x25')](_0x47aeb6)[_0x512b('0x17')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x47aeb6+_0x512b('0x28'))[_0x512b('0x17')](_0x3f2f3c,null,_0x3f2f3c+_0x512b('0x14')+_0x47aeb6+'.'+_0x392a8c)[_0x512b('0x15')](_0x47aeb6+'.CmListId\x20=\x20?',_0x3eb5e2)[_0x512b('0x15')](_0x512b('0x2a'),NOW)['where'](_0x512b('0x2d'),squel[_0x512b('0x11')]()[_0x512b('0x12')](_0x512b('0x13'))[_0x512b('0x25')]('cm_hopper_black')[_0x512b('0x15')](_0x512b('0x31'),_0x3eb5e2)[_0x512b('0x15')](_0x392a8c+_0x512b('0x32'),_0x47aeb6+'.'+_0x392a8c)))[_0x512b('0x2e')]();}function insertCmContact(_0x4b5959,_0x5464aa,_0x3efe62,_0x46663d){var _0xcf0b15=_[_0x512b('0x33')](_['keys'](_0x46663d),['ListId',_0x512b('0x34'),'createdAt',_0x512b('0x20')]);return squel[_0x512b('0x2f')]()['into'](_0x512b('0x26'))[_0x512b('0x1e')](_0xcf0b15,squel[_0x512b('0x11')]()[_0x512b('0x24')](_0xcf0b15)[_0x512b('0x25')](_0x5464aa)[_0x512b('0x15')]('('+_0x3efe62['join'](',')+')\x20NOT\x20IN\x20?',squel[_0x512b('0x11')]()[_0x512b('0x24')](_0x3efe62)[_0x512b('0x25')](_0x512b('0x26'))[_0x512b('0x15')](_0x512b('0x31'),_0x4b5959)[_0x512b('0x15')](_0x512b('0x35')))['where'](_0x512b('0x36'),squel[_0x512b('0x11')]()[_0x512b('0x12')](_0x512b('0x37'),_0x512b('0x38'))[_0x512b('0x25')](_0x5464aa)[_0x512b('0x39')](_0x3efe62['join'](','))))[_0x512b('0x2e')]();}function handleStop(){logger['info'](_0x512b('0x3a'));stopped=!![];}function handleUncaughtException(_0x3a760a){logger[_0x512b('0x3b')](_0x3a760a[_0x512b('0x3c')]);process[_0x512b('0x3d')](0x1);}function handleError(_0x2b4dcc,_0x8408e3){stats[_0x512b('0x3e')][_0x512b('0x3f')]({'name':_0x8408e3[_0x512b('0x40')],'message':_0x8408e3[_0x512b('0x3c')],'row':_0x2b4dcc});}function handleQuery(_0x5ada10){logger[_0x512b('0x41')](_0x5ada10);return db['sequelize'][_0x512b('0x42')](_0x5ada10)[_0x512b('0x43')](function(_0x35b227){results[_0x512b('0x3f')](_0x35b227);})[_0x512b('0x44')](function(_0xef5d82){logger[_0x512b('0x3b')](_0xef5d82['message']);});}function main(_0x5b2442,_0x3d2ba3,_0x47ff01,_0x58477f){logger[_0x512b('0x41')](_0x512b('0x45'),_0x5b2442,JSON['stringify'](_0x3d2ba3));process[_0x512b('0x46')](_0x512b('0x47'));var _0x430687=_0x3d2ba3['binding'];var _0x253f7a=_0x3d2ba3['socket_timestamp'];var _0x5c1c66=path[_0x512b('0x17')](config[_0x512b('0x48')],_0x512b('0x49'),_0x253f7a+_0x512b('0x4a'));var _0x5be2c4=_['keys'](_0x430687)[_0x512b('0x17')]();logger[_0x512b('0x41')](_0x512b('0x4b'),_0x5be2c4);fs[_0x512b('0x4c')](_0x5c1c66,_0x5be2c4+'\x0a');Papa[_0x512b('0x4d')](fs[_0x512b('0x4e')](_0x5b2442),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3abc7c,_0x3f934e){try{for(var _0x99fa3e=0x0,_0x46f753=[];_0x99fa3e<_0x3abc7c[_0x512b('0x4f')][_0x512b('0x50')];_0x99fa3e++){stats[_0x512b('0x51')]+=0x1;if(_0x3abc7c[_0x512b('0x3e')][_0x99fa3e]){handleError(_0x3abc7c[_0x512b('0x4f')][_0x99fa3e],_0x3abc7c[_0x512b('0x3e')][_0x99fa3e]);}else{var _0x4fdf32=[];for(var _0x41b31f in _0x430687){if(_0x430687['hasOwnProperty'](_0x41b31f)){if(_0x3abc7c[_0x512b('0x4f')][_0x99fa3e][_0x430687[_0x41b31f]]){var _0x2fb5fa=_[_0x512b('0x52')](_0x3abc7c['data'][_0x99fa3e][_0x430687[_0x41b31f]][_0x512b('0x53')](/"/g,'\x27'));switch(_0x41b31f){case _0x512b('0x54'):var _0x246680=moment(_0x2fb5fa,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x246680[_0x512b('0x55')]()){_0x46f753[_0x512b('0x3f')]('\x22'+_0x2fb5fa+'\x22');}else{_0x4fdf32[_0x512b('0x3f')](_0x512b('0x56'));}break;case _0x512b('0x21'):var _0x4273a9=parseInt(_0x2fb5fa);_0x2fb5fa=_[_0x512b('0x57')](_0x4273a9)||_0x4273a9<0x0||_0x4273a9>0x4?_0x58477f?0x3:0x2:_0x4273a9;_0x46f753['push']('\x22'+_0x2fb5fa+'\x22');break;case'UserId':var _0x5f0b49=parseInt(_0x2fb5fa);if(_[_0x512b('0x58')](_0x5f0b49)&&_[_0x512b('0x59')](_0x47ff01,_0x5f0b49)){_0x46f753[_0x512b('0x3f')]('\x22'+_0x5f0b49+'\x22');}else{_0x4fdf32[_0x512b('0x3f')](_0x512b('0x5a'));}break;case _0x512b('0x5b'):if(isEmail(_0x2fb5fa)){_0x46f753[_0x512b('0x3f')]('\x22'+_0x2fb5fa+'\x22');}else{_0x4fdf32[_0x512b('0x3f')]('email\x20wrong\x20format');}break;case _0x512b('0x5c'):var _0x5c8c62=moment(_0x2fb5fa,_0x512b('0x5d'),!![]);if(_0x5c8c62[_0x512b('0x55')]()){_0x46f753[_0x512b('0x3f')]('\x22'+_0x2fb5fa+'\x22');}else{_0x4fdf32[_0x512b('0x3f')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x46f753[_0x512b('0x3f')]('\x22'+_0x2fb5fa+'\x22');}}else{switch(_0x41b31f){case _0x512b('0x5e'):case _0x512b('0x13'):_0x4fdf32[_0x512b('0x3f')](_0x41b31f+'\x20not\x20specified');break;default:_0x46f753['push']('\x22\x22');}}}}if(_0x4fdf32['length']){handleError(_0x3abc7c[_0x512b('0x4f')][_0x99fa3e],{'code':_0x512b('0x5f'),'message':_0x4fdf32['join']()});}else{fs['appendFileSync'](_0x5c1c66,_0x46f753[_0x512b('0x17')]()+'\x0a');}_0x46f753=[];}if(!(stats[_0x512b('0x51')]%0xc8)){socket[_0x512b('0x60')]('contact:import:'+_0x253f7a,stats);stats[_0x512b('0x3e')]=[];}}if(stopped){logger['info']('Abort\x20parser');_0x3f934e['abort']();}}catch(_0x29faf3){handleError(_0x3abc7c[_0x512b('0x4f')][_0x99fa3e],{'code':_0x512b('0x61'),'message':_0x29faf3[_0x512b('0x3c')]});logger[_0x512b('0x3b')](_0x512b('0x62'),_0x29faf3[_0x512b('0x3c')]);}},'complete':function(){try{var _0x323b8f=[];var _0x19b245=_0x512b('0x26');if(_0x3d2ba3[_0x512b('0x63')]&&_0x3d2ba3[_0x512b('0x63')][_0x512b('0x50')]){_0x19b245=_0x512b('0x64')+_0x253f7a;_0x323b8f[_0x512b('0x3f')](_0x512b('0x65')+_0x19b245+_0x512b('0x66'));}var _0x1e0354=util[_0x512b('0xf')](_0x512b('0x67'),_0x5c1c66,_0x19b245,_0x5be2c4,_0x3d2ba3['ListId'],_0x3d2ba3['CompanyId']||null,NOW,NOW);if(_[_0x512b('0x68')](_0x430687[_0x512b('0x54')])){_0x1e0354+=',\x20scheduledAt\x20=\x20NOW()';}_0x323b8f[_0x512b('0x3f')](_0x1e0354);if(_0x3d2ba3['duplicates']&&_0x3d2ba3[_0x512b('0x63')][_0x512b('0x50')]){_0x323b8f[_0x512b('0x3f')](insertCmContact(_0x3d2ba3[_0x512b('0x30')],_0x19b245,_0x3d2ba3[_0x512b('0x63')],_0x430687));_0x323b8f[_0x512b('0x3f')](_0x512b('0x69')+_0x19b245+';');}_0x323b8f[_0x512b('0x3f')](insertCmHopper(_0x3d2ba3['ListId'],_0x512b('0x6a'),_0x512b('0x6b'),_0x512b('0x6c'),_0x58477f));_0x323b8f['push'](insertCmHopperBlack(_0x3d2ba3[_0x512b('0x30')],'voice_queues_has_cm_blacklists',_0x512b('0x6b'),_0x512b('0x6c')));_0x323b8f[_0x512b('0x3f')](insertCmHopper(_0x3d2ba3[_0x512b('0x30')],_0x512b('0x6d'),_0x512b('0x6e'),_0x512b('0x6f'),_0x58477f));_0x323b8f['push'](insertCmHopperBlack(_0x3d2ba3[_0x512b('0x30')],_0x512b('0x70'),_0x512b('0x6e'),'CampaignId'));BPromise[_0x512b('0x71')](_0x323b8f,handleQuery)[_0x512b('0x72')](function(_0x1bc773){stats[_0x512b('0x73')]=!![];stats[_0x512b('0x74')]=_0x3d2ba3['duplicates']&&_0x3d2ba3[_0x512b('0x63')][_0x512b('0x50')]?results[0x2][_0x512b('0x74')]:results[0x0][_0x512b('0x74')];socket[_0x512b('0x60')](_0x512b('0x75')+_0x253f7a,stats);fs['unlink'](_0x5b2442);fs[_0x512b('0x76')](_0x5c1c66);process[_0x512b('0x3d')](0x0);})['catch'](function(_0x500b8c){logger[_0x512b('0x3b')](_0x500b8c[_0x512b('0x3c')]);process[_0x512b('0x3d')](0x1);});}catch(_0x1d8c1a){logger[_0x512b('0x3b')](_0x512b('0x77'),_0x1d8c1a[_0x512b('0x3c')]);process[_0x512b('0x3d')](0x1);}},'error':function(_0x551be5,_0x38460a,_0x514706,_0x21337d){throw new Error(_0x21337d);}});}function validate(){if(process[_0x512b('0x78')]&&process['argv']['length']<0x4){throw new Error(_0x512b('0x79'));}var _0x4fa6c9=path['join'](config[_0x512b('0x48')],_0x512b('0x49'),process[_0x512b('0x78')][0x2]);if(!fs[_0x512b('0x7a')](_0x4fa6c9)){throw new Error(_0x512b('0x7b'));}var _0x51b6f5={};try{_0x51b6f5=JSON[_0x512b('0x4d')](process[_0x512b('0x78')][0x3]);if(!_0x51b6f5[_0x512b('0x7c')]){throw new Error(_0x512b('0x7d'));}if(!_0x51b6f5[_0x512b('0x7c')][_0x512b('0x13')]){throw new Error(_0x512b('0x7e'));}if(!_0x51b6f5[_0x512b('0x7c')][_0x512b('0x5e')]){throw new Error(_0x512b('0x7f'));}var _0x307795=0x0;if(_0x51b6f5[_0x512b('0x7c')][_0x512b('0x22')]){_0x307795=0x1;}if(!_0x51b6f5[_0x512b('0x30')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x4e5021){throw new Error(_0x512b('0x80'));}var _0x47caf5=[];try{_0x47caf5=_[_0x512b('0x81')](JSON[_0x512b('0x4d')](process[_0x512b('0x78')][0x4]),'id');}catch(_0x34480d){logger[_0x512b('0x41')](_0x512b('0x82'));}main(_0x4fa6c9,_0x51b6f5,_0x47caf5,_0x307795);}validate();process['on'](_0x512b('0x83'),handleStop);process['on'](_0x512b('0x84'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 1af2ecd..075fbe0 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x43cb=['toLowerCase','inbound','push','variable','calleridnum','outbound','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','Agent\x20Number','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','membername','starttime','Answer\x20Time','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','voice'];(function(_0x40d708,_0x5f12ed){var _0x12dc20=function(_0x5ece08){while(--_0x5ece08){_0x40d708['push'](_0x40d708['shift']());}};_0x12dc20(++_0x5f12ed);}(_0x43cb,0x87));var _0xb43c=function(_0x495b11,_0x513156){_0x495b11=_0x495b11-0x0;var _0x59f4ec=_0x43cb[_0x495b11];return _0x59f4ec;};'use strict';exports[_0xb43c('0x0')]=function(_0x1bcf88,_0x3f0d2f){var _0x3c841f=[{'type':_0xb43c('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x1bcf88['toLowerCase']()){case _0xb43c('0x2'):switch(_0x3f0d2f[_0xb43c('0x3')]()){case _0xb43c('0x4'):_0x3c841f[_0xb43c('0x5')]({'type':'variable','content':'','variableName':'queue'});_0x3c841f[_0xb43c('0x5')]({'type':_0xb43c('0x6'),'content':'','variableName':_0xb43c('0x7')});break;case _0xb43c('0x8'):_0x3c841f[_0xb43c('0x5')]({'type':_0xb43c('0x1'),'content':'Outbound\x20Call','variableName':null});_0x3c841f[_0xb43c('0x5')]({'type':_0xb43c('0x6'),'content':'','variableName':_0xb43c('0x9')});break;}}return _0x3c841f;};exports[_0xb43c('0xa')]=function(_0x3bae16,_0x33bae9){var _0x4221f5=[];switch(_0x3bae16[_0xb43c('0x3')]()){case _0xb43c('0x2'):switch(_0x33bae9[_0xb43c('0x3')]()){case _0xb43c('0x4'):_0x4221f5=[{'type':_0xb43c('0x1'),'content':_0xb43c('0xb'),'key':null,'keyType':null,'variableName':null},{'type':_0xb43c('0xc'),'content':'','key':_0xb43c('0xd'),'keyType':_0xb43c('0x6'),'variableName':_0xb43c('0x7')},{'type':_0xb43c('0xc'),'content':'','key':_0xb43c('0xe'),'keyType':_0xb43c('0x6'),'variableName':_0xb43c('0xf')},{'type':'keyValue','content':'','key':_0xb43c('0x10'),'keyType':_0xb43c('0x6'),'variableName':_0xb43c('0x11')},{'type':'keyValue','content':'','key':_0xb43c('0x12'),'keyType':'variable','variableName':_0xb43c('0x13')},{'type':_0xb43c('0xc'),'content':'','key':_0xb43c('0x14'),'keyType':_0xb43c('0x6'),'variableName':_0xb43c('0x15')},{'type':_0xb43c('0xc'),'content':'','key':_0xb43c('0x16'),'keyType':_0xb43c('0x6'),'variableName':_0xb43c('0x17')},{'type':_0xb43c('0x1'),'content':_0xb43c('0x18'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xb43c('0x19'),'keyType':_0xb43c('0x6'),'variableName':'destcalleridname'},{'type':'keyValue','content':'','key':_0xb43c('0x1a'),'keyType':_0xb43c('0x6'),'variableName':_0xb43c('0x9')},{'type':_0xb43c('0x1'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xb43c('0xc'),'content':'','key':_0xb43c('0x1b'),'keyType':_0xb43c('0x6'),'variableName':_0xb43c('0x17')},{'type':_0xb43c('0xc'),'content':'','key':_0xb43c('0x1c'),'keyType':'variable','variableName':_0xb43c('0x1d')},{'type':_0xb43c('0xc'),'content':'','key':_0xb43c('0x1e'),'keyType':'variable','variableName':'agentcompleteAt'},{'type':_0xb43c('0xc'),'content':'','key':_0xb43c('0x1f'),'keyType':_0xb43c('0x6'),'variableName':_0xb43c('0x20')},{'type':'keyValue','content':'','key':_0xb43c('0x21'),'keyType':_0xb43c('0x6'),'variableName':_0xb43c('0x22')}];break;case _0xb43c('0x8'):_0x4221f5=[{'type':_0xb43c('0x1'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0xb43c('0xc'),'content':'','key':_0xb43c('0x23'),'keyType':'variable','keyContent':'','variableName':_0xb43c('0x9')},{'type':'keyValue','content':'','key':_0xb43c('0x24'),'keyType':'variable','keyContent':'','variableName':_0xb43c('0x25')},{'type':'keyValue','content':'','key':'UniqueId','keyType':'variable','keyContent':'','variableName':_0xb43c('0x15')},{'type':_0xb43c('0xc'),'content':'','key':_0xb43c('0x16'),'keyType':_0xb43c('0x6'),'keyContent':'','variableName':_0xb43c('0x26')},{'type':_0xb43c('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':_0xb43c('0xc'),'content':'','key':_0xb43c('0x27'),'keyType':_0xb43c('0x6'),'keyContent':'','variableName':'answertime'},{'type':_0xb43c('0xc'),'content':'','key':_0xb43c('0x28'),'keyType':_0xb43c('0x6'),'keyContent':'','variableName':_0xb43c('0x29')},{'type':_0xb43c('0xc'),'content':'','key':_0xb43c('0x2a'),'keyType':'variable','keyContent':'','variableName':_0xb43c('0x2b')},{'type':'keyValue','content':'','key':_0xb43c('0x2c'),'keyType':_0xb43c('0x6'),'keyContent':'','variableName':_0xb43c('0x2d')}];break;}}return _0x4221f5;}; \ No newline at end of file +var _0x14f7=['keyValue','Caller\x20Number','calleridnum','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','uniqueid','Date','agentcalledAt','destcalleridname','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','membername','UniqueId','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','voice','toLowerCase','push','variable','queue','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','inbound','***\x20Call\x20Info\x20***'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0x14f7,0x17a));var _0x714f=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x14f7[_0xaa0309];return _0x5de7ce;};'use strict';exports[_0x714f('0x0')]=function(_0xe2f552,_0x660f67){var _0x111670=[{'type':_0x714f('0x1'),'content':_0x714f('0x2'),'variableName':null}];switch(_0xe2f552['toLowerCase']()){case _0x714f('0x3'):switch(_0x660f67[_0x714f('0x4')]()){case'inbound':_0x111670[_0x714f('0x5')]({'type':_0x714f('0x6'),'content':'','variableName':_0x714f('0x7')});_0x111670[_0x714f('0x5')]({'type':_0x714f('0x6'),'content':'','variableName':'calleridnum'});break;case _0x714f('0x8'):_0x111670[_0x714f('0x5')]({'type':_0x714f('0x1'),'content':_0x714f('0x9'),'variableName':null});_0x111670[_0x714f('0x5')]({'type':_0x714f('0x6'),'content':'','variableName':_0x714f('0xa')});break;}}return _0x111670;};exports[_0x714f('0xb')]=function(_0x8a399e,_0x23bd28){var _0x26d4b7=[];switch(_0x8a399e[_0x714f('0x4')]()){case'voice':switch(_0x23bd28[_0x714f('0x4')]()){case _0x714f('0xc'):_0x26d4b7=[{'type':_0x714f('0x1'),'content':_0x714f('0xd'),'key':null,'keyType':null,'variableName':null},{'type':_0x714f('0xe'),'content':'','key':_0x714f('0xf'),'keyType':_0x714f('0x6'),'variableName':_0x714f('0x10')},{'type':'keyValue','content':'','key':_0x714f('0x11'),'keyType':_0x714f('0x6'),'variableName':_0x714f('0x12')},{'type':_0x714f('0xe'),'content':'','key':_0x714f('0x13'),'keyType':_0x714f('0x6'),'variableName':_0x714f('0x14')},{'type':'keyValue','content':'','key':_0x714f('0x15'),'keyType':'variable','variableName':_0x714f('0x7')},{'type':'keyValue','content':'','key':'UniqueId','keyType':'variable','variableName':_0x714f('0x16')},{'type':_0x714f('0xe'),'content':'','key':_0x714f('0x17'),'keyType':_0x714f('0x6'),'variableName':_0x714f('0x18')},{'type':'string','content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x714f('0xe'),'content':'','key':'Agent\x20Name','keyType':_0x714f('0x6'),'variableName':_0x714f('0x19')},{'type':_0x714f('0xe'),'content':'','key':'Agent\x20Number','keyType':_0x714f('0x6'),'variableName':'destcalleridnum'},{'type':_0x714f('0x1'),'content':_0x714f('0x1a'),'key':null,'keyType':null,'variableName':null},{'type':_0x714f('0xe'),'content':'','key':_0x714f('0x1b'),'keyType':_0x714f('0x6'),'variableName':'agentcalledAt'},{'type':_0x714f('0xe'),'content':'','key':_0x714f('0x1c'),'keyType':_0x714f('0x6'),'variableName':_0x714f('0x1d')},{'type':_0x714f('0xe'),'content':'','key':_0x714f('0x1e'),'keyType':'variable','variableName':_0x714f('0x1f')},{'type':_0x714f('0xe'),'content':'','key':_0x714f('0x20'),'keyType':_0x714f('0x6'),'variableName':_0x714f('0x21')},{'type':_0x714f('0xe'),'content':'','key':_0x714f('0x22'),'keyType':'variable','variableName':_0x714f('0x23')}];break;case _0x714f('0x8'):_0x26d4b7=[{'type':_0x714f('0x1'),'content':_0x714f('0xd'),'variableName':null},{'type':_0x714f('0xe'),'content':'','key':_0x714f('0x24'),'keyType':'variable','keyContent':'','variableName':_0x714f('0xa')},{'type':_0x714f('0xe'),'content':'','key':_0x714f('0x25'),'keyType':'variable','keyContent':'','variableName':_0x714f('0x26')},{'type':'keyValue','content':'','key':_0x714f('0x27'),'keyType':_0x714f('0x6'),'keyContent':'','variableName':_0x714f('0x16')},{'type':_0x714f('0xe'),'content':'','key':_0x714f('0x17'),'keyType':_0x714f('0x6'),'keyContent':'','variableName':_0x714f('0x28')},{'type':_0x714f('0x1'),'content':_0x714f('0x1a')},{'type':_0x714f('0xe'),'content':'','key':_0x714f('0x29'),'keyType':_0x714f('0x6'),'keyContent':'','variableName':_0x714f('0x2a')},{'type':'keyValue','content':'','key':_0x714f('0x2b'),'keyType':_0x714f('0x6'),'keyContent':'','variableName':_0x714f('0x2c')},{'type':_0x714f('0xe'),'content':'','key':_0x714f('0x2d'),'keyType':'variable','keyContent':'','variableName':_0x714f('0x2e')},{'type':_0x714f('0xe'),'content':'','key':_0x714f('0x2f'),'keyType':_0x714f('0x6'),'keyContent':'','variableName':_0x714f('0x30')}];break;}}return _0x26d4b7;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 074b411..c4359d4 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb1c4=['omit','html','phone','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','whatsapp-interactions','upperFirst','unknown','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','then','update','info','error','user','query','clone','body'];(function(_0x4506ec,_0x44543d){var _0x5edc22=function(_0x25d762){while(--_0x25d762){_0x4506ec['push'](_0x4506ec['shift']());}};_0x5edc22(++_0x44543d);}(_0xb1c4,0xf4));var _0x4b1c=function(_0x24b80d,_0x4e1204){_0x24b80d=_0x24b80d-0x0;var _0x33958d=_0xb1c4[_0x24b80d];return _0x33958d;};'use strict';var _=require(_0x4b1c('0x0'));var db=require(_0x4b1c('0x1'))['db'];var loggers={'openchannel':require(_0x4b1c('0x2'))(_0x4b1c('0x3')),'mail':require(_0x4b1c('0x2'))(_0x4b1c('0x4')),'fax':require('../../config/logger')(_0x4b1c('0x5')),'sms':require(_0x4b1c('0x2'))(_0x4b1c('0x6')),'chat':require(_0x4b1c('0x2'))('chat-interactions'),'whatsapp':require(_0x4b1c('0x2'))(_0x4b1c('0x7'))};function getInteractionId(_0x9d51d5,_0x1b21fc,_0x6992ec){if(_0x9d51d5&&_0x9d51d5[_[_0x4b1c('0x8')](_0x6992ec)+'InteractionId']){return _0x9d51d5[_[_0x4b1c('0x8')](_0x6992ec)+'InteractionId'];}else if(_0x9d51d5&&_0x9d51d5['id']){return _0x9d51d5['id'];}else if(_0x1b21fc&&_0x1b21fc['id']){return _0x1b21fc['id'];}else{return _0x4b1c('0x9');}}function log(_0x25eff7,_0xe47525,_0x46c0f9,_0x5a65a2,_0x3d5aaa,_0x413864){loggers[_0x3d5aaa['toLowerCase']()][_0x25eff7](_0x4b1c('0xa'),_0x413864[_0x4b1c('0xb')](),_0xe47525?_0xe47525['id']:null,_0xe47525?_0xe47525[_0x4b1c('0xc')]:null,_0xe47525?_0xe47525[_0x4b1c('0xd')]:null,getInteractionId(_0x46c0f9,_0x5a65a2,_0x3d5aaa),_0x46c0f9?JSON[_0x4b1c('0xe')](_0x46c0f9):_0x4b1c('0xf'));}function updateUser(_0x3d2bba,_0x4fe1d9,_0x42e92a,_0x5995ea,_0x59c008){db[_[_0x4b1c('0x8')](_0x5995ea)+_0x4b1c('0x10')][_0x4b1c('0x11')]({'where':{'id':getInteractionId(_0x4fe1d9,_0x42e92a,_0x5995ea)}})[_0x4b1c('0x12')](function(_0x5e4e0c){if(_0x5e4e0c){return _0x5e4e0c[_0x4b1c('0x13')]({'UserId':_0x3d2bba?_0x3d2bba['id']:null});}})[_0x4b1c('0x12')](function(_0xca8d47){if(_0xca8d47){log(_0x4b1c('0x14'),_0x3d2bba,_0x4fe1d9,_0x42e92a,_0x5995ea,_0x59c008);}})['catch'](function(){log(_0x4b1c('0x15'),_0x3d2bba,_0x4fe1d9,_0x42e92a,_0x5995ea,_0x59c008);});}exports['tracked']=function(_0x56e405,_0x49a532){return function(_0x4d43d6,_0x91807e,_0x29d89d){var _0x55e0aa=_0x4d43d6[_0x4b1c('0x16')];var _0x1ea2c8={};var _0x5a51aa=_0x4d43d6[_0x4b1c('0x17')];if(_0x1ea2c8){_0x1ea2c8=_[_0x4b1c('0x18')](_0x4d43d6[_0x4b1c('0x19')]);_0x1ea2c8=_[_0x4b1c('0x1a')](_0x1ea2c8,[_0x4b1c('0x19'),_0x4b1c('0x1b'),_0x4b1c('0x1c'),'fax',_0x4b1c('0x1d')]);}updateUser(_0x55e0aa,_0x1ea2c8,_0x5a51aa,_0x56e405,_0x49a532);_0x29d89d(null);};}; \ No newline at end of file +var _0xe397=['then','update','info','catch','error','tracked','user','query','body','phone','fax','mobile','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','InteractionId','upperFirst','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','stringify','null','Interaction','findOne'];(function(_0x6baf10,_0xc346be){var _0x1846df=function(_0x193129){while(--_0x193129){_0x6baf10['push'](_0x6baf10['shift']());}};_0x1846df(++_0xc346be);}(_0xe397,0x174));var _0x7e39=function(_0x3af1ee,_0x2c54b1){_0x3af1ee=_0x3af1ee-0x0;var _0x49cbcf=_0xe397[_0x3af1ee];return _0x49cbcf;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x7e39('0x0'))(_0x7e39('0x1')),'mail':require('../../config/logger')(_0x7e39('0x2')),'fax':require(_0x7e39('0x0'))(_0x7e39('0x3')),'sms':require(_0x7e39('0x0'))(_0x7e39('0x4')),'chat':require(_0x7e39('0x0'))(_0x7e39('0x5')),'whatsapp':require(_0x7e39('0x0'))(_0x7e39('0x6'))};function getInteractionId(_0x4fb152,_0x100bdd,_0x21f8e3){if(_0x4fb152&&_0x4fb152[_['upperFirst'](_0x21f8e3)+_0x7e39('0x7')]){return _0x4fb152[_[_0x7e39('0x8')](_0x21f8e3)+'InteractionId'];}else if(_0x4fb152&&_0x4fb152['id']){return _0x4fb152['id'];}else if(_0x100bdd&&_0x100bdd['id']){return _0x100bdd['id'];}else{return _0x7e39('0x9');}}function log(_0x32c1ae,_0x51f36e,_0x27d006,_0x20b732,_0xc0870,_0x1a599e){loggers[_0xc0870[_0x7e39('0xa')]()][_0x32c1ae](_0x7e39('0xb'),_0x1a599e['toUpperCase'](),_0x51f36e?_0x51f36e['id']:null,_0x51f36e?_0x51f36e[_0x7e39('0xc')]:null,_0x51f36e?_0x51f36e[_0x7e39('0xd')]:null,getInteractionId(_0x27d006,_0x20b732,_0xc0870),_0x27d006?JSON[_0x7e39('0xe')](_0x27d006):_0x7e39('0xf'));}function updateUser(_0x516c89,_0x5aae63,_0x52dded,_0x27d953,_0x188d8a){db[_[_0x7e39('0x8')](_0x27d953)+_0x7e39('0x10')][_0x7e39('0x11')]({'where':{'id':getInteractionId(_0x5aae63,_0x52dded,_0x27d953)}})[_0x7e39('0x12')](function(_0xf5f09a){if(_0xf5f09a){return _0xf5f09a[_0x7e39('0x13')]({'UserId':_0x516c89?_0x516c89['id']:null});}})[_0x7e39('0x12')](function(_0x18c371){if(_0x18c371){log(_0x7e39('0x14'),_0x516c89,_0x5aae63,_0x52dded,_0x27d953,_0x188d8a);}})[_0x7e39('0x15')](function(){log(_0x7e39('0x16'),_0x516c89,_0x5aae63,_0x52dded,_0x27d953,_0x188d8a);});}exports[_0x7e39('0x17')]=function(_0x35fc46,_0x317dd0){return function(_0x91dbec,_0x5e4f55,_0x30f93e){var _0x5d121a=_0x91dbec[_0x7e39('0x18')];var _0x141290={};var _0x474968=_0x91dbec[_0x7e39('0x19')];if(_0x141290){_0x141290=_['clone'](_0x91dbec[_0x7e39('0x1a')]);_0x141290=_['omit'](_0x141290,[_0x7e39('0x1a'),'html',_0x7e39('0x1b'),_0x7e39('0x1c'),_0x7e39('0x1d')]);}updateUser(_0x5d121a,_0x141290,_0x474968,_0x35fc46,_0x317dd0);_0x30f93e(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index b7fd2cc..dc4b29e 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 _0x7939=['../../mysqldb','../../config/environment','license','data1','split','createDecipher','aes-256-ctr','%s:%s:%s','update','base64','final','utf8','parse','hasOwnProperty','use','License','findOne','then','count','status','format','catch','users','user','util','composable-middleware'];(function(_0x5b20e9,_0x277807){var _0x6c4aac=function(_0xc39e42){while(--_0xc39e42){_0x5b20e9['push'](_0x5b20e9['shift']());}};_0x6c4aac(++_0x277807);}(_0x7939,0x11c));var _0x9793=function(_0x6b5a51,_0x1eb40f){_0x6b5a51=_0x6b5a51-0x0;var _0x1b607f=_0x7939[_0x6b5a51];return _0x1b607f;};'use strict';var crypto=require('crypto');var util=require(_0x9793('0x0'));var compose=require(_0x9793('0x1'));var db=require(_0x9793('0x2'))['db'];var config=require(_0x9793('0x3'));function getValueFromLicense(_0x54ad3e,_0x4eb7cf){if(_0x54ad3e&&_0x4eb7cf){if(_0x4eb7cf['data1']&&_0x4eb7cf[_0x9793('0x4')]){var _0xb32c16=_0x4eb7cf[_0x9793('0x5')];var _0x1205a2=_0x4eb7cf[_0x9793('0x4')];var _0x16d3fe=_0xb32c16[_0x9793('0x6')]('-')[0x4];var _0x508f94=_0xb32c16[_0x9793('0x6')]('-')[0x0];var _0x8ab0eb=crypto[_0x9793('0x7')](_0x9793('0x8'),util['format'](_0x9793('0x9'),_0x16d3fe,_0xb32c16,_0x508f94));var _0x59f48e=_0x8ab0eb[_0x9793('0xa')](_0x1205a2,_0x9793('0xb'),'utf8');_0x59f48e+=_0x8ab0eb[_0x9793('0xc')](_0x9793('0xd'));var _0xd68eae=JSON[_0x9793('0xe')](_0x59f48e);return _0xd68eae[_0x9793('0xf')](_0x54ad3e)?_0xd68eae[_0x54ad3e]:null;}}return null;}function isLimit(_0x53a690,_0x4d491d,_0x30ca14,_0x358345){var _0x11589f=_0x4d491d;return compose()[_0x9793('0x10')](function(_0xd31d06,_0x19694f,_0x1b7b8a){return db[_0x9793('0x11')][_0x9793('0x12')]({'where':{'id':0x1},'raw':!![]})[_0x9793('0x13')](function(_0x2467ae){var _0x265da2=getValueFromLicense(_0x53a690,_0x2467ae);return _0x265da2?_0x265da2:_0x11589f;})['then'](function(_0x277e9b){_0x11589f=_0x277e9b;return _0x30ca14[_0x9793('0x14')](_0x358345);})['then'](function(_0x5cf237){if(_0x5cf237>=_0x11589f){return _0x19694f[_0x9793('0x15')](0x193)['json']({'message':util[_0x9793('0x16')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x53a690)});}_0x1b7b8a();})[_0x9793('0x17')](function(_0x41617c){_0x1b7b8a(_0x41617c);});});}function isUserLimit(){return isLimit(_0x9793('0x18'),0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':_0x9793('0x19')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0xae6c=['json','format','catch','users','User','admin','user','crypto','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','aes-256-ctr','base64','utf8','parse','hasOwnProperty','findOne','then','count','status'];(function(_0x422b01,_0x7184ed){var _0xfd907=function(_0x2eb052){while(--_0x2eb052){_0x422b01['push'](_0x422b01['shift']());}};_0xfd907(++_0x7184ed);}(_0xae6c,0x7a));var _0xcae6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xae6c[_0x321bb2];return _0x9c12ed;};'use strict';var crypto=require(_0xcae6('0x0'));var util=require('util');var compose=require(_0xcae6('0x1'));var db=require(_0xcae6('0x2'))['db'];var config=require(_0xcae6('0x3'));function getValueFromLicense(_0xf044c8,_0x58877c){if(_0xf044c8&&_0x58877c){if(_0x58877c[_0xcae6('0x4')]&&_0x58877c['license']){var _0xad4bf9=_0x58877c['data1'];var _0x4f7123=_0x58877c[_0xcae6('0x5')];var _0x54ec58=_0xad4bf9[_0xcae6('0x6')]('-')[0x4];var _0x380302=_0xad4bf9[_0xcae6('0x6')]('-')[0x0];var _0x4fb836=crypto['createDecipher'](_0xcae6('0x7'),util['format']('%s:%s:%s',_0x54ec58,_0xad4bf9,_0x380302));var _0xa28145=_0x4fb836['update'](_0x4f7123,_0xcae6('0x8'),_0xcae6('0x9'));_0xa28145+=_0x4fb836['final'](_0xcae6('0x9'));var _0x3b4b4a=JSON[_0xcae6('0xa')](_0xa28145);return _0x3b4b4a[_0xcae6('0xb')](_0xf044c8)?_0x3b4b4a[_0xf044c8]:null;}}return null;}function isLimit(_0x382596,_0x2eecf8,_0x9509f4,_0x495f11){var _0x1d10ce=_0x2eecf8;return compose()['use'](function(_0x43dbe0,_0x17b670,_0x6df3e4){return db['License'][_0xcae6('0xc')]({'where':{'id':0x1},'raw':!![]})[_0xcae6('0xd')](function(_0x510bf8){var _0x53efd9=getValueFromLicense(_0x382596,_0x510bf8);return _0x53efd9?_0x53efd9:_0x1d10ce;})[_0xcae6('0xd')](function(_0x29cc43){_0x1d10ce=_0x29cc43;return _0x9509f4[_0xcae6('0xe')](_0x495f11);})[_0xcae6('0xd')](function(_0x1afd02){if(_0x1afd02>=_0x1d10ce){return _0x17b670[_0xcae6('0xf')](0x193)[_0xcae6('0x10')]({'message':util[_0xcae6('0x11')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x382596)});}_0x6df3e4();})[_0xcae6('0x12')](function(_0x49f328){_0x6df3e4(_0x49f328);});});}function isUserLimit(){return isLimit(_0xcae6('0x13'),0x1,db[_0xcae6('0x14')],{'where':{'$or':[{'role':_0xcae6('0x15')},{'role':_0xcae6('0x16')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index d653f8a..22fc5f1 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 _0xe7d7=['buildExpression','DATE','$between','value','$gt','operator','add','days','format','YYYY-MM-DD','castTo','CAST(','field','$ne','$notIn','text','$in','IN\x20?','NOT\x20IN\x20?','$eq','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','shift','pop','utcOffset','hours','minutes','seconds','lodash','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','length','slice','split','match','forEach','filter','indexOf','map','conditions','push'];(function(_0x534f31,_0x37a4ff){var _0x972a94=function(_0x234c5b){while(--_0x234c5b){_0x534f31['push'](_0x534f31['shift']());}};_0x972a94(++_0x37a4ff);}(_0xe7d7,0x99));var _0x7e7d=function(_0xfd4f7e,_0x15d90a){_0xfd4f7e=_0xfd4f7e-0x0;var _0x171d9c=_0xe7d7[_0xfd4f7e];return _0x171d9c;};'use strict';var _=require(_0x7e7d('0x0'));var moment=require('moment');exports[_0x7e7d('0x1')]=function(_0x1134df){var _0x19957a={'conditions':[]};_0x19957a[_0x7e7d('0x2')]=_[_0x7e7d('0x3')](_0x1134df,_0x7e7d('0x4'))?'or':_0x7e7d('0x5');var _0x4c3474=_0x1134df[_0x7e7d('0x6')](_0x7e7d('0x7'),'')[_0x7e7d('0x6')](_0x7e7d('0x4'),'')['split']('||');for(var _0x49ed7f=0x0;_0x49ed7f<_0x4c3474[_0x7e7d('0x8')];_0x49ed7f++){var _0x5a2acd=_0x4c3474[_0x49ed7f]['split'](':=');var _0xcfd285=_0x5a2acd[0x0];var _0x319308=_0x5a2acd[_0x7e7d('0x9')](0x1);_0x319308['forEach'](function(_0x28bec2){var _0x6b358b=_0x28bec2[_0x7e7d('0xa')]('[')['shift']();var _0x10d6c5=_0x28bec2[_0x7e7d('0xb')](/\[(.*?)\]/g);_0x10d6c5[_0x7e7d('0xc')](function(_0x323217){var _0x3b8205=_0x323217[_0x7e7d('0xa')]('[')[_0x7e7d('0xd')](function(_0x367b45){return _0x367b45[_0x7e7d('0xe')](']')>-0x1;})[_0x7e7d('0xf')](function(_0x431112){return _0x431112[_0x7e7d('0xa')](']')[0x0];})[0x0];_0x19957a[_0x7e7d('0x10')][_0x7e7d('0x11')]({'field':_0xcfd285,'operator':_0x6b358b,'value':_0x3b8205});});});}return _0x19957a;};exports[_0x7e7d('0x12')]=function(_0x224c95,_0x48c2bd,_0x47d222){var _0x1dfd9c={};if(_0x48c2bd===_0x7e7d('0x13')){if(_0x47d222['operator']==='$eq'){_0x47d222['operator']=_0x7e7d('0x14');_0x47d222[_0x7e7d('0x15')]+=','+_0x47d222[_0x7e7d('0x15')];}else if(_['includes']([_0x7e7d('0x16'),'$lte'],_0x47d222[_0x7e7d('0x17')])){_0x47d222['value']=moment(_0x47d222[_0x7e7d('0x15')])[_0x7e7d('0x18')](0x1,_0x7e7d('0x19'))[_0x7e7d('0x1a')](_0x7e7d('0x1b'));}}if(_0x47d222[_0x7e7d('0x1c')]){_0x48c2bd=_0x47d222[_0x7e7d('0x1c')];_0x1dfd9c['text']=_0x7e7d('0x1d')+_0x224c95+'.'+_0x47d222[_0x7e7d('0x1e')]+'\x20AS\x20'+_0x47d222[_0x7e7d('0x1c')]+')\x20'+parseOperator(_0x47d222['operator']);}else{_0x1dfd9c['text']=_0x224c95+'.'+_0x47d222['field']+'\x20'+parseOperator(_0x47d222[_0x7e7d('0x17')]);}if(_['includes']([_0x7e7d('0x1f'),_0x7e7d('0x20')],_0x47d222[_0x7e7d('0x17')]))_0x1dfd9c[_0x7e7d('0x21')]='('+_0x1dfd9c[_0x7e7d('0x21')]+'\x20OR\x20'+_0x224c95+'.'+_0x47d222[_0x7e7d('0x1e')]+'\x20IS\x20NULL)';_0x1dfd9c['value']=parseValue(_0x48c2bd,_0x47d222[_0x7e7d('0x17')],_0x47d222['value']);return _0x1dfd9c;};function parseOperator(_0x2b9bdb){var _0x4dec4f;switch(_0x2b9bdb){case _0x7e7d('0x22'):_0x4dec4f=_0x7e7d('0x23');break;case'$notIn':_0x4dec4f=_0x7e7d('0x24');break;case _0x7e7d('0x25'):_0x4dec4f='=\x20?';break;case _0x7e7d('0x1f'):_0x4dec4f=_0x7e7d('0x26');break;case _0x7e7d('0x27'):case _0x7e7d('0x28'):case _0x7e7d('0x29'):_0x4dec4f=_0x7e7d('0x2a');break;case _0x7e7d('0x2b'):_0x4dec4f=_0x7e7d('0x2c');break;case _0x7e7d('0x16'):_0x4dec4f=_0x7e7d('0x2d');break;case'$lte':_0x4dec4f=_0x7e7d('0x2e');break;case _0x7e7d('0x2f'):_0x4dec4f=_0x7e7d('0x30');break;case _0x7e7d('0x14'):_0x4dec4f=_0x7e7d('0x31');break;}return _0x4dec4f;}function parseValue(_0x13d077,_0x18230c,_0x35ea96){var _0x27d062={'start':undefined,'end':undefined};switch(_0x18230c){case'$in':case _0x7e7d('0x20'):_0x27d062[_0x7e7d('0x32')]=_0x35ea96[_0x7e7d('0xa')](',');break;case _0x7e7d('0x27'):_0x27d062[_0x7e7d('0x32')]='%'+_0x35ea96+'%';break;case _0x7e7d('0x28'):_0x27d062[_0x7e7d('0x32')]=_0x35ea96+'%';break;case _0x7e7d('0x29'):_0x27d062[_0x7e7d('0x32')]='%'+_0x35ea96;break;case _0x7e7d('0x14'):var _0x224b5e=_0x35ea96[_0x7e7d('0xa')](',');var _0x35ea96=_0x224b5e[_0x7e7d('0x33')]();var _0x1ecdd5=_0x224b5e[_0x7e7d('0x34')]();if(_0x13d077===_0x7e7d('0x13')){_0x35ea96=moment(_0x35ea96)[_0x7e7d('0x35')](0x0,!![])['format']();_0x1ecdd5=moment(_0x1ecdd5)[_0x7e7d('0x35')](0x0,!![])[_0x7e7d('0x18')](0x17,_0x7e7d('0x36'))['add'](0x3b,_0x7e7d('0x37'))[_0x7e7d('0x18')](0x3b,_0x7e7d('0x38'))[_0x7e7d('0x1a')]();}_0x27d062={'start':_0x35ea96,'end':_0x1ecdd5};break;default:_0x27d062[_0x7e7d('0x32')]=_0x35ea96;break;}return _0x27d062;} \ No newline at end of file +var _0x1b8e=['hours','minutes','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','slice','forEach','shift','filter','indexOf','map','conditions','push','DATE','operator','$eq','$between','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','\x20OR\x20','\x20IS\x20NULL)','$notIn','NOT\x20IN\x20?','=\x20?','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','<=\x20?','BETWEEN\x20?\x20AND\x20?','$in','$substring','start','pop','utcOffset'];(function(_0x40800b,_0x575a41){var _0x4587ae=function(_0x578486){while(--_0x578486){_0x40800b['push'](_0x40800b['shift']());}};_0x4587ae(++_0x575a41);}(_0x1b8e,0xd6));var _0xe1b8=function(_0x445847,_0x56a926){_0x445847=_0x445847-0x0;var _0x707a85=_0x1b8e[_0x445847];return _0x707a85;};'use strict';var _=require('lodash');var moment=require('moment');exports[_0xe1b8('0x0')]=function(_0x149daf){var _0x2acbbe={'conditions':[]};_0x2acbbe[_0xe1b8('0x1')]=_[_0xe1b8('0x2')](_0x149daf,_0xe1b8('0x3'))?'or':_0xe1b8('0x4');var _0x30039b=_0x149daf[_0xe1b8('0x5')](_0xe1b8('0x6'),'')['replace'](_0xe1b8('0x3'),'')[_0xe1b8('0x7')]('||');for(var _0x3eb0cf=0x0;_0x3eb0cf<_0x30039b['length'];_0x3eb0cf++){var _0x185208=_0x30039b[_0x3eb0cf][_0xe1b8('0x7')](':=');var _0x5ef108=_0x185208[0x0];var _0x96c876=_0x185208[_0xe1b8('0x8')](0x1);_0x96c876[_0xe1b8('0x9')](function(_0x2d7925){var _0x53bd2c=_0x2d7925[_0xe1b8('0x7')]('[')[_0xe1b8('0xa')]();var _0x1ed9d5=_0x2d7925['match'](/\[(.*?)\]/g);_0x1ed9d5['forEach'](function(_0x765fae){var _0x37f7d6=_0x765fae['split']('[')[_0xe1b8('0xb')](function(_0x14652d){return _0x14652d[_0xe1b8('0xc')](']')>-0x1;})[_0xe1b8('0xd')](function(_0x4dc1d8){return _0x4dc1d8[_0xe1b8('0x7')](']')[0x0];})[0x0];_0x2acbbe[_0xe1b8('0xe')][_0xe1b8('0xf')]({'field':_0x5ef108,'operator':_0x53bd2c,'value':_0x37f7d6});});});}return _0x2acbbe;};exports['buildExpression']=function(_0x42baa6,_0xf0a42a,_0x2a7d00){var _0x4a4f35={};if(_0xf0a42a===_0xe1b8('0x10')){if(_0x2a7d00[_0xe1b8('0x11')]===_0xe1b8('0x12')){_0x2a7d00['operator']=_0xe1b8('0x13');_0x2a7d00[_0xe1b8('0x14')]+=','+_0x2a7d00[_0xe1b8('0x14')];}else if(_[_0xe1b8('0x15')]([_0xe1b8('0x16'),_0xe1b8('0x17')],_0x2a7d00[_0xe1b8('0x11')])){_0x2a7d00[_0xe1b8('0x14')]=moment(_0x2a7d00[_0xe1b8('0x14')])[_0xe1b8('0x18')](0x1,_0xe1b8('0x19'))[_0xe1b8('0x1a')](_0xe1b8('0x1b'));}}if(_0x2a7d00['castTo']){_0xf0a42a=_0x2a7d00[_0xe1b8('0x1c')];_0x4a4f35[_0xe1b8('0x1d')]=_0xe1b8('0x1e')+_0x42baa6+'.'+_0x2a7d00[_0xe1b8('0x1f')]+_0xe1b8('0x20')+_0x2a7d00['castTo']+')\x20'+parseOperator(_0x2a7d00['operator']);}else{_0x4a4f35[_0xe1b8('0x1d')]=_0x42baa6+'.'+_0x2a7d00[_0xe1b8('0x1f')]+'\x20'+parseOperator(_0x2a7d00[_0xe1b8('0x11')]);}if(_[_0xe1b8('0x15')]([_0xe1b8('0x21'),'$notIn'],_0x2a7d00[_0xe1b8('0x11')]))_0x4a4f35[_0xe1b8('0x1d')]='('+_0x4a4f35['text']+_0xe1b8('0x22')+_0x42baa6+'.'+_0x2a7d00['field']+_0xe1b8('0x23');_0x4a4f35[_0xe1b8('0x14')]=parseValue(_0xf0a42a,_0x2a7d00['operator'],_0x2a7d00['value']);return _0x4a4f35;};function parseOperator(_0x5297bc){var _0x552d6a;switch(_0x5297bc){case'$in':_0x552d6a='IN\x20?';break;case _0xe1b8('0x24'):_0x552d6a=_0xe1b8('0x25');break;case _0xe1b8('0x12'):_0x552d6a=_0xe1b8('0x26');break;case _0xe1b8('0x21'):_0x552d6a='<>\x20?';break;case'$substring':case _0xe1b8('0x27'):case _0xe1b8('0x28'):_0x552d6a=_0xe1b8('0x29');break;case _0xe1b8('0x2a'):_0x552d6a=_0xe1b8('0x2b');break;case _0xe1b8('0x16'):_0x552d6a='>\x20?';break;case _0xe1b8('0x17'):_0x552d6a=_0xe1b8('0x2c');break;case'$gte':_0x552d6a='>=\x20?';break;case _0xe1b8('0x13'):_0x552d6a=_0xe1b8('0x2d');break;}return _0x552d6a;}function parseValue(_0x1c5238,_0xdd39bf,_0x23d3c5){var _0xc5469e={'start':undefined,'end':undefined};switch(_0xdd39bf){case _0xe1b8('0x2e'):case'$notIn':_0xc5469e['start']=_0x23d3c5[_0xe1b8('0x7')](',');break;case _0xe1b8('0x2f'):_0xc5469e['start']='%'+_0x23d3c5+'%';break;case'$startsWith':_0xc5469e['start']=_0x23d3c5+'%';break;case _0xe1b8('0x28'):_0xc5469e[_0xe1b8('0x30')]='%'+_0x23d3c5;break;case _0xe1b8('0x13'):var _0x3e12ed=_0x23d3c5[_0xe1b8('0x7')](',');var _0x23d3c5=_0x3e12ed[_0xe1b8('0xa')]();var _0x365a09=_0x3e12ed[_0xe1b8('0x31')]();if(_0x1c5238===_0xe1b8('0x10')){_0x23d3c5=moment(_0x23d3c5)[_0xe1b8('0x32')](0x0,!![])[_0xe1b8('0x1a')]();_0x365a09=moment(_0x365a09)[_0xe1b8('0x32')](0x0,!![])['add'](0x17,_0xe1b8('0x33'))[_0xe1b8('0x18')](0x3b,_0xe1b8('0x34'))[_0xe1b8('0x18')](0x3b,'seconds')[_0xe1b8('0x1a')]();}_0xc5469e={'start':_0x23d3c5,'end':_0x365a09};break;default:_0xc5469e[_0xe1b8('0x30')]=_0x23d3c5;break;}return _0xc5469e;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 93186bb..b9b4f82 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 _0xe6ae=['parse','keys','fields','filters','isEmpty','find','type','DATE','utc','$lte','format','YYYY-MM-DD','name','uniqueid','isArray','split','limit','offset','sort','map','indexOf','priority','col','substr','unsigned','ASC','omit','length','unset','hasOwnProperty','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','includes','push','join','query','$id','model','intersection','attributes','where','filter','columns','value','merge','VIRTUAL','lower','options','lodash','sequelize','moment'];(function(_0x2e0443,_0x7e5974){var _0x52d450=function(_0x3a9985){while(--_0x3a9985){_0x2e0443['push'](_0x2e0443['shift']());}};_0x52d450(++_0x7e5974);}(_0xe6ae,0x1e3));var _0xee6a=function(_0x5ec8ef,_0x390c91){_0x5ec8ef=_0x5ec8ef-0x0;var _0x25898a=_0xe6ae[_0x5ec8ef];return _0x25898a;};'use strict';var _=require(_0xee6a('0x0'));var sequelize=require(_0xee6a('0x1'));var moment=require(_0xee6a('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0xbf9e06){var _0x313531=['ne'];try{var _0x3553f3=JSON[_0xee6a('0x3')](_0xbf9e06);var _0x3a4534=Object[_0xee6a('0x4')](_0x3553f3)[0x0];return _0x313531['includes'](_0x3a4534);}catch(_0x4c07ca){return![];}}function getOperatorValue(_0x8133b2){var _0x4ddcc0=JSON[_0xee6a('0x3')](_0x8133b2);var _0x3def71=Object['keys'](_0x4ddcc0)[0x0];var _0x3d2709=_0x4ddcc0[_0x3def71];return{['$'+_0x3def71]:_0x3d2709};}exports[_0xee6a('0x5')]=function(_0x36f4f5){var _0x5f1016=null;if(_0x36f4f5){_0x5f1016=_0x36f4f5['split'](',');}return _0x5f1016;};exports[_0xee6a('0x6')]=function(_0x3740b8,_0x23946b){var _0x4ac38a={};if(!_[_0xee6a('0x7')](_0x3740b8)){_['forOwn'](_0x3740b8,function(_0x4bdab2,_0x5e5fc6){try{if(_0x23946b){var _0x1c6dcd=_[_0xee6a('0x8')](_0x23946b,{'name':_0x5e5fc6})||{};if(hasSequelizeOperator(_0x4bdab2)){_0x4ac38a[_0x5e5fc6]=getOperatorValue(_0x4bdab2);}else if(_0x1c6dcd[_0xee6a('0x9')]===_0xee6a('0xa')&&_['isPlainObject'](_0x4bdab2)){var _0x8379a=JSON[_0xee6a('0x3')](_0x4bdab2);var _0x575296={'$gte':moment(moment(_0x8379a['$gte'])['format']('YYYY-MM-DD'))[_0xee6a('0xb')]()['format'](),'$lte':moment(moment(_0x8379a[_0xee6a('0xc')])[_0xee6a('0xd')](_0xee6a('0xe')))['utc']()['subtract'](0x1,'s')['format']()};_0x4ac38a[_0x5e5fc6]=_0x575296;}else if(_0x1c6dcd[_0xee6a('0xf')]===_0xee6a('0x10')){_0x4ac38a[_0x5e5fc6]=_0x4bdab2;}else{_0x4ac38a[_0x5e5fc6]=_[_0xee6a('0x11')](_0x4bdab2)?_0x4bdab2:JSON[_0xee6a('0x3')](_0x4bdab2);}}else{_0x4ac38a[_0x5e5fc6]=_[_0xee6a('0x11')](_0x4bdab2)?_0x4bdab2:JSON[_0xee6a('0x3')](_0x4bdab2);}}catch(_0xb3089){_0x4ac38a[_0x5e5fc6]=_0x4bdab2[_0xee6a('0x12')](',');}});}return _0x4ac38a;};exports[_0xee6a('0x13')]=function(_0x30dce2){_0x30dce2=parseInt(_0x30dce2,0xa);if(!_0x30dce2||_0x30dce2<0x0){_0x30dce2=LIMIT_VALUE;}return _0x30dce2;};exports[_0xee6a('0x14')]=function(_0x27a17e){_0x27a17e=parseInt(_0x27a17e,0xa);if(!_0x27a17e||_0x27a17e<0x0){_0x27a17e=0x0;}return _0x27a17e;};exports[_0xee6a('0x15')]=function(_0x5910e8){var _0x9e6f5,_0x41194f=null;if(_0x5910e8){_0x9e6f5=_0x5910e8[_0xee6a('0x12')](',');_0x41194f=_[_0xee6a('0x16')](_0x9e6f5,function(_0x1b7f78){if(_0x1b7f78[_0xee6a('0x17')]('-')===0x0){return[_0x1b7f78===_0xee6a('0x18')?sequelize['cast'](sequelize[_0xee6a('0x19')](_0xee6a('0x18')),'unsigned'):_0x1b7f78[_0xee6a('0x1a')](0x1),'DESC'];}else{return[_0x1b7f78===_0xee6a('0x18')?sequelize['cast'](sequelize[_0xee6a('0x19')]('priority'),_0xee6a('0x1b')):_0x1b7f78,_0xee6a('0x1c')];}});}return _0x41194f;};exports[_0xee6a('0x1d')]=function(_0x132d38,_0x3a7a79){if(_['isEmpty'](_0x132d38)){return _0x132d38;}if(_[_0xee6a('0x11')](_0x132d38)){for(var _0x2ac8c7=0x0;_0x2ac8c7<_0x132d38[_0xee6a('0x1e')];_0x2ac8c7+=0x1){_0x132d38[_0x2ac8c7]=this[_0xee6a('0x1d')](_0x132d38[_0x2ac8c7],_0x3a7a79);}return _0x132d38;}if(!_['isObject'](_0x132d38)){return _0x132d38;}if(_['isString'](_0x3a7a79)){_0x3a7a79=[_0x3a7a79];}if(!_[_0xee6a('0x11')](_0x3a7a79)){return _0x132d38;}for(var _0x225a79=0x0;_0x225a79<_0x3a7a79[_0xee6a('0x1e')];_0x225a79+=0x1){_[_0xee6a('0x1f')](_0x132d38,_0x3a7a79[_0x225a79]);}for(var _0x432b7e in _0x132d38){if(_0x132d38[_0xee6a('0x20')](_0x432b7e)){_0x132d38[_0x432b7e]=this[_0xee6a('0x1d')](_0x132d38[_0x432b7e],_0x3a7a79);}}return _0x132d38;};exports['isNumeric']=function(_0x2f0e0f){return _0x2f0e0f[_0xee6a('0x21')](RegExp(_0xee6a('0x22')))?!![]:![];};exports[_0xee6a('0x23')]=function(_0x4b4057){return _0x4b4057['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xee6a('0x24')]=function(_0xef6d5b){var _0xa411ff=[];_0xef6d5b['split'](/[ ,]+/)[_0xee6a('0x25')](function(_0xac9d74){_0xac9d74=_0xac9d74['replace'](/([^:]")"+/g,'$1');_0xac9d74='+'+_0xac9d74+'*';if(_0xac9d74[_0xee6a('0x26')]('@'))_0xac9d74='\x22'+_0xac9d74+'\x22';_0xa411ff[_0xee6a('0x27')](_0xac9d74);});return _0xa411ff[_0xee6a('0x28')]('\x20');};exports['getOptions']=function(_0x5a00c2,_0x197f2f,_0x32669e){var _0x479e23={},_0x34195a={};if(_0x197f2f[_0xee6a('0x29')][_0xee6a('0x2a')]){_0x197f2f[_0xee6a('0x29')]['id']=_0x197f2f[_0xee6a('0x29')][_0xee6a('0x2a')];delete _0x197f2f['query'][_0xee6a('0x2a')];}_0x479e23[_0xee6a('0x2b')]=_[_0xee6a('0x16')](_0x5a00c2,_0xee6a('0xf'));_0x479e23[_0xee6a('0x29')]=_[_0xee6a('0x4')](_0x197f2f[_0xee6a('0x29')]);_0x479e23['filters']=_['intersection'](_0x479e23['model'],_0x479e23['query']);_0x34195a['attributes']=_[_0xee6a('0x2c')](_0x479e23[_0xee6a('0x2b')],this[_0xee6a('0x5')](_0x197f2f[_0xee6a('0x29')]['fields']));_0x34195a[_0xee6a('0x2d')]=_0x34195a[_0xee6a('0x2d')][_0xee6a('0x1e')]?_0x34195a[_0xee6a('0x2d')]:_0x479e23[_0xee6a('0x2b')];if(!_0x197f2f[_0xee6a('0x29')][_0xee6a('0x20')]('nolimit')){_0x34195a[_0xee6a('0x13')]=this[_0xee6a('0x13')](_0x197f2f['query'][_0xee6a('0x13')]);_0x34195a[_0xee6a('0x14')]=this[_0xee6a('0x14')](_0x197f2f[_0xee6a('0x29')][_0xee6a('0x14')]);}_0x34195a['order']=this[_0xee6a('0x15')](_0x197f2f[_0xee6a('0x29')][_0xee6a('0x15')]);_0x34195a[_0xee6a('0x2e')]=this['filters'](_['pick'](_0x197f2f[_0xee6a('0x29')],_0x479e23['filters']),_0x5a00c2);if(_0x197f2f[_0xee6a('0x29')][_0xee6a('0x2f')]){var _0x44245f=_0x5a00c2;var _0x4e3ab5=_0x197f2f['query'][_0xee6a('0x2f')];if(typeof _0x4e3ab5==='object'){_0x44245f=_[_0xee6a('0x2f')](_0x5a00c2,function(_0xd2af16){return _[_0xee6a('0x26')](_0x4e3ab5[_0xee6a('0x30')],_0xd2af16['name']);});_0x4e3ab5=_0x4e3ab5[_0xee6a('0x31')];}_0x34195a[_0xee6a('0x2e')]=_[_0xee6a('0x32')](_0x34195a[_0xee6a('0x2e')],{'$or':_[_0xee6a('0x16')](_0x44245f,function(_0x494228){if(_0x494228[_0xee6a('0x9')]!==_0xee6a('0x33')){if(_0x32669e){return sequelize[_0xee6a('0x2e')](sequelize['fn'](_0xee6a('0x34'),sequelize['col'](_0x494228[_0xee6a('0xf')])),{'$like':sequelize['fn'](_0xee6a('0x34'),'%'+_0x197f2f[_0xee6a('0x29')][_0xee6a('0x2f')]+'%')});}else{var _0x4f6793={};_0x4f6793[_0x494228[_0xee6a('0xf')]]={'$like':'%'+_0x197f2f[_0xee6a('0x29')]['filter']+'%'};return _0x4f6793;}}})});}_0x34195a=_['merge']({},_0x34195a,_0x197f2f[_0xee6a('0x35')]);return _0x34195a;}; \ No newline at end of file +var _0xc95f=['name','uniqueid','isArray','split','limit','offset','map','indexOf','cast','priority','unsigned','substr','DESC','ASC','omit','length','isObject','isString','unset','hasOwnProperty','^[+]?[0-9]*$','isEmail','match','getFullTextValue','push','join','getOptions','query','$id','model','intersection','attributes','nolimit','order','sort','where','filter','object','includes','merge','lower','col','options','lodash','sequelize','moment','parse','keys','fields','filters','isEmpty','forOwn','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract'];(function(_0x37a416,_0x14ee6a){var _0x47959e=function(_0x57aa93){while(--_0x57aa93){_0x37a416['push'](_0x37a416['shift']());}};_0x47959e(++_0x14ee6a);}(_0xc95f,0xe2));var _0xfc95=function(_0x20a6bd,_0xaeb074){_0x20a6bd=_0x20a6bd-0x0;var _0x318a91=_0xc95f[_0x20a6bd];return _0x318a91;};'use strict';var _=require(_0xfc95('0x0'));var sequelize=require(_0xfc95('0x1'));var moment=require(_0xfc95('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x2c0a03){var _0x1e4820=['ne'];try{var _0x169b37=JSON[_0xfc95('0x3')](_0x2c0a03);var _0x5a4e15=Object[_0xfc95('0x4')](_0x169b37)[0x0];return _0x1e4820['includes'](_0x5a4e15);}catch(_0x4df20f){return![];}}function getOperatorValue(_0x97e2d8){var _0x4923f7=JSON['parse'](_0x97e2d8);var _0x5eeb24=Object[_0xfc95('0x4')](_0x4923f7)[0x0];var _0xa83aa1=_0x4923f7[_0x5eeb24];return{['$'+_0x5eeb24]:_0xa83aa1};}exports[_0xfc95('0x5')]=function(_0x87e6f0){var _0x2eaae0=null;if(_0x87e6f0){_0x2eaae0=_0x87e6f0['split'](',');}return _0x2eaae0;};exports[_0xfc95('0x6')]=function(_0x34d4c6,_0x33b8e2){var _0x39bed6={};if(!_[_0xfc95('0x7')](_0x34d4c6)){_[_0xfc95('0x8')](_0x34d4c6,function(_0x1b0979,_0x5b4a15){try{if(_0x33b8e2){var _0x4612c7=_['find'](_0x33b8e2,{'name':_0x5b4a15})||{};if(hasSequelizeOperator(_0x1b0979)){_0x39bed6[_0x5b4a15]=getOperatorValue(_0x1b0979);}else if(_0x4612c7[_0xfc95('0x9')]===_0xfc95('0xa')&&_[_0xfc95('0xb')](_0x1b0979)){var _0x36ba7c=JSON[_0xfc95('0x3')](_0x1b0979);var _0x6e6bcd={'$gte':moment(moment(_0x36ba7c[_0xfc95('0xc')])[_0xfc95('0xd')](_0xfc95('0xe')))[_0xfc95('0xf')]()[_0xfc95('0xd')](),'$lte':moment(moment(_0x36ba7c[_0xfc95('0x10')])['format'](_0xfc95('0xe')))[_0xfc95('0xf')]()[_0xfc95('0x11')](0x1,'s')[_0xfc95('0xd')]()};_0x39bed6[_0x5b4a15]=_0x6e6bcd;}else if(_0x4612c7[_0xfc95('0x12')]===_0xfc95('0x13')){_0x39bed6[_0x5b4a15]=_0x1b0979;}else{_0x39bed6[_0x5b4a15]=_[_0xfc95('0x14')](_0x1b0979)?_0x1b0979:JSON['parse'](_0x1b0979);}}else{_0x39bed6[_0x5b4a15]=_['isArray'](_0x1b0979)?_0x1b0979:JSON['parse'](_0x1b0979);}}catch(_0x3fe4e4){_0x39bed6[_0x5b4a15]=_0x1b0979[_0xfc95('0x15')](',');}});}return _0x39bed6;};exports[_0xfc95('0x16')]=function(_0x423198){_0x423198=parseInt(_0x423198,0xa);if(!_0x423198||_0x423198<0x0){_0x423198=LIMIT_VALUE;}return _0x423198;};exports[_0xfc95('0x17')]=function(_0x59466a){_0x59466a=parseInt(_0x59466a,0xa);if(!_0x59466a||_0x59466a<0x0){_0x59466a=0x0;}return _0x59466a;};exports['sort']=function(_0x4ce6ee){var _0x42711f,_0x3abf7b=null;if(_0x4ce6ee){_0x42711f=_0x4ce6ee[_0xfc95('0x15')](',');_0x3abf7b=_[_0xfc95('0x18')](_0x42711f,function(_0x1d8e83){if(_0x1d8e83[_0xfc95('0x19')]('-')===0x0){return[_0x1d8e83==='priority'?sequelize[_0xfc95('0x1a')](sequelize['col'](_0xfc95('0x1b')),_0xfc95('0x1c')):_0x1d8e83[_0xfc95('0x1d')](0x1),_0xfc95('0x1e')];}else{return[_0x1d8e83==='priority'?sequelize[_0xfc95('0x1a')](sequelize['col'](_0xfc95('0x1b')),_0xfc95('0x1c')):_0x1d8e83,_0xfc95('0x1f')];}});}return _0x3abf7b;};exports[_0xfc95('0x20')]=function(_0x1e5397,_0x3a3d02){if(_[_0xfc95('0x7')](_0x1e5397)){return _0x1e5397;}if(_[_0xfc95('0x14')](_0x1e5397)){for(var _0x53840d=0x0;_0x53840d<_0x1e5397[_0xfc95('0x21')];_0x53840d+=0x1){_0x1e5397[_0x53840d]=this[_0xfc95('0x20')](_0x1e5397[_0x53840d],_0x3a3d02);}return _0x1e5397;}if(!_[_0xfc95('0x22')](_0x1e5397)){return _0x1e5397;}if(_[_0xfc95('0x23')](_0x3a3d02)){_0x3a3d02=[_0x3a3d02];}if(!_[_0xfc95('0x14')](_0x3a3d02)){return _0x1e5397;}for(var _0x213abe=0x0;_0x213abe<_0x3a3d02['length'];_0x213abe+=0x1){_[_0xfc95('0x24')](_0x1e5397,_0x3a3d02[_0x213abe]);}for(var _0x3bd86f in _0x1e5397){if(_0x1e5397[_0xfc95('0x25')](_0x3bd86f)){_0x1e5397[_0x3bd86f]=this['omit'](_0x1e5397[_0x3bd86f],_0x3a3d02);}}return _0x1e5397;};exports['isNumeric']=function(_0x51a509){return _0x51a509['match'](RegExp(_0xfc95('0x26')))?!![]:![];};exports[_0xfc95('0x27')]=function(_0x296cb0){return _0x296cb0[_0xfc95('0x28')](/^\S+@\S+$/)?!![]:![];};exports[_0xfc95('0x29')]=function(_0x4d5db3){var _0x44e2f8=[];_0x4d5db3[_0xfc95('0x15')](/[ ,]+/)['forEach'](function(_0x1675a7){_0x1675a7=_0x1675a7['replace'](/([^:]")"+/g,'$1');_0x1675a7='+'+_0x1675a7+'*';if(_0x1675a7['includes']('@'))_0x1675a7='\x22'+_0x1675a7+'\x22';_0x44e2f8[_0xfc95('0x2a')](_0x1675a7);});return _0x44e2f8[_0xfc95('0x2b')]('\x20');};exports[_0xfc95('0x2c')]=function(_0x5acade,_0x5f10c3,_0x2f370b){var _0x333a09={},_0x446583={};if(_0x5f10c3[_0xfc95('0x2d')][_0xfc95('0x2e')]){_0x5f10c3[_0xfc95('0x2d')]['id']=_0x5f10c3['query'][_0xfc95('0x2e')];delete _0x5f10c3[_0xfc95('0x2d')][_0xfc95('0x2e')];}_0x333a09[_0xfc95('0x2f')]=_[_0xfc95('0x18')](_0x5acade,_0xfc95('0x12'));_0x333a09['query']=_[_0xfc95('0x4')](_0x5f10c3['query']);_0x333a09[_0xfc95('0x6')]=_[_0xfc95('0x30')](_0x333a09[_0xfc95('0x2f')],_0x333a09[_0xfc95('0x2d')]);_0x446583[_0xfc95('0x31')]=_[_0xfc95('0x30')](_0x333a09[_0xfc95('0x2f')],this[_0xfc95('0x5')](_0x5f10c3[_0xfc95('0x2d')][_0xfc95('0x5')]));_0x446583[_0xfc95('0x31')]=_0x446583[_0xfc95('0x31')][_0xfc95('0x21')]?_0x446583[_0xfc95('0x31')]:_0x333a09['model'];if(!_0x5f10c3[_0xfc95('0x2d')]['hasOwnProperty'](_0xfc95('0x32'))){_0x446583[_0xfc95('0x16')]=this[_0xfc95('0x16')](_0x5f10c3[_0xfc95('0x2d')][_0xfc95('0x16')]);_0x446583['offset']=this[_0xfc95('0x17')](_0x5f10c3['query'][_0xfc95('0x17')]);}_0x446583[_0xfc95('0x33')]=this[_0xfc95('0x34')](_0x5f10c3['query'][_0xfc95('0x34')]);_0x446583[_0xfc95('0x35')]=this[_0xfc95('0x6')](_['pick'](_0x5f10c3['query'],_0x333a09[_0xfc95('0x6')]),_0x5acade);if(_0x5f10c3[_0xfc95('0x2d')][_0xfc95('0x36')]){var _0x50fcff=_0x5acade;var _0x30ccfd=_0x5f10c3[_0xfc95('0x2d')][_0xfc95('0x36')];if(typeof _0x30ccfd===_0xfc95('0x37')){_0x50fcff=_[_0xfc95('0x36')](_0x5acade,function(_0x16f4c8){return _[_0xfc95('0x38')](_0x30ccfd['columns'],_0x16f4c8[_0xfc95('0x12')]);});_0x30ccfd=_0x30ccfd['value'];}_0x446583[_0xfc95('0x35')]=_[_0xfc95('0x39')](_0x446583['where'],{'$or':_[_0xfc95('0x18')](_0x50fcff,function(_0x3fe225){if(_0x3fe225['type']!=='VIRTUAL'){if(_0x2f370b){return sequelize[_0xfc95('0x35')](sequelize['fn'](_0xfc95('0x3a'),sequelize[_0xfc95('0x3b')](_0x3fe225[_0xfc95('0x12')])),{'$like':sequelize['fn'](_0xfc95('0x3a'),'%'+_0x5f10c3[_0xfc95('0x2d')][_0xfc95('0x36')]+'%')});}else{var _0x501dbf={};_0x501dbf[_0x3fe225[_0xfc95('0x12')]]={'$like':'%'+_0x5f10c3[_0xfc95('0x2d')]['filter']+'%'};return _0x501dbf;}}})});}_0x446583=_[_0xfc95('0x39')]({},_0x446583,_0x5f10c3[_0xfc95('0x3c')]);return _0x446583;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 934c420..e7cbfaa 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xafbf=['set','appPath','join','root','public','development','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','50mb','json','initialize','express','serve-favicon','body-parser','method-override','cookie-parser','errorhandler','path','cors','moment','./environment','default','get','env'];(function(_0x23745a,_0x4180d9){var _0x5f2f2b=function(_0x25b326){while(--_0x25b326){_0x23745a['push'](_0x23745a['shift']());}};_0x5f2f2b(++_0x4180d9);}(_0xafbf,0x151));var _0xfafb=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xafbf[_0x19e35c];return _0x3e1fe8;};'use strict';var express=require(_0xfafb('0x0'));var favicon=require(_0xfafb('0x1'));var bodyParser=require(_0xfafb('0x2'));var methodOverride=require(_0xfafb('0x3'));var cookieParser=require(_0xfafb('0x4'));var errorHandler=require(_0xfafb('0x5'));var path=require(_0xfafb('0x6'));var passport=require('passport');var cors=require(_0xfafb('0x7'));var moment=require(_0xfafb('0x8'));var config=require(_0xfafb('0x9'));var db=require('../mysqldb')['db'];exports[_0xfafb('0xa')]=function(_0x1e2d33){var _0x2963e9=_0x1e2d33[_0xfafb('0xb')](_0xfafb('0xc'));if(_0x2963e9==='production'){_0x1e2d33[_0xfafb('0xd')](_0xfafb('0xe'),path[_0xfafb('0xf')](config[_0xfafb('0x10')],_0xfafb('0x11')));}if(_0x2963e9===_0xfafb('0x12')||_0x2963e9==='test'){_0x1e2d33[_0xfafb('0xd')](_0xfafb('0xe'),path[_0xfafb('0xf')](config[_0xfafb('0x10')],_0xfafb('0x13')));_0x1e2d33[_0xfafb('0x14')](errorHandler());}_0x1e2d33[_0xfafb('0xd')](_0xfafb('0x15'),function(_0x29e819,_0x667051){if(this[_0x29e819]instanceof Date){_0x667051=this[_0x29e819][_0xfafb('0x16')]()[_0xfafb('0x17')]('.')[0x0]+'Z';}return _0x667051;});_0x1e2d33[_0xfafb('0x14')](express[_0xfafb('0x18')](_0x1e2d33['get']('appPath')));_0x1e2d33[_0xfafb('0xd')]('views',config[_0xfafb('0x10')]+_0xfafb('0x19'));_0x1e2d33[_0xfafb('0x1a')](_0xfafb('0x1b'),require(_0xfafb('0x1c'))[_0xfafb('0x1d')]);_0x1e2d33[_0xfafb('0xd')](_0xfafb('0x1e'),'html');_0x1e2d33[_0xfafb('0x14')](bodyParser[_0xfafb('0x1f')]({'limit':_0xfafb('0x20'),'extended':!![]}));_0x1e2d33[_0xfafb('0x14')](bodyParser[_0xfafb('0x21')]({'limit':_0xfafb('0x20')}));_0x1e2d33[_0xfafb('0x14')](cors());_0x1e2d33[_0xfafb('0x14')](methodOverride());_0x1e2d33[_0xfafb('0x14')](cookieParser());_0x1e2d33[_0xfafb('0x14')](passport[_0xfafb('0x22')]());}; \ No newline at end of file +var _0x935f=['json','initialize','express','serve-favicon','body-parser','method-override','cookie-parser','errorhandler','moment','./environment','../mysqldb','default','get','env','production','set','appPath','join','root','development','test','client','use','json\x20replacer','toISOString','split','static','views','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','50mb'];(function(_0x135424,_0xe21fa7){var _0x28618e=function(_0x103926){while(--_0x103926){_0x135424['push'](_0x135424['shift']());}};_0x28618e(++_0xe21fa7);}(_0x935f,0xda));var _0xf935=function(_0x3052bb,_0x3f9aac){_0x3052bb=_0x3052bb-0x0;var _0x1a1865=_0x935f[_0x3052bb];return _0x1a1865;};'use strict';var express=require(_0xf935('0x0'));var favicon=require(_0xf935('0x1'));var bodyParser=require(_0xf935('0x2'));var methodOverride=require(_0xf935('0x3'));var cookieParser=require(_0xf935('0x4'));var errorHandler=require(_0xf935('0x5'));var path=require('path');var passport=require('passport');var cors=require('cors');var moment=require(_0xf935('0x6'));var config=require(_0xf935('0x7'));var db=require(_0xf935('0x8'))['db'];exports[_0xf935('0x9')]=function(_0x21f750){var _0x5f3457=_0x21f750[_0xf935('0xa')](_0xf935('0xb'));if(_0x5f3457===_0xf935('0xc')){_0x21f750[_0xf935('0xd')](_0xf935('0xe'),path[_0xf935('0xf')](config[_0xf935('0x10')],'public'));}if(_0x5f3457===_0xf935('0x11')||_0x5f3457===_0xf935('0x12')){_0x21f750['set'](_0xf935('0xe'),path[_0xf935('0xf')](config[_0xf935('0x10')],_0xf935('0x13')));_0x21f750[_0xf935('0x14')](errorHandler());}_0x21f750[_0xf935('0xd')](_0xf935('0x15'),function(_0x331ae9,_0x577fd0){if(this[_0x331ae9]instanceof Date){_0x577fd0=this[_0x331ae9][_0xf935('0x16')]()[_0xf935('0x17')]('.')[0x0]+'Z';}return _0x577fd0;});_0x21f750[_0xf935('0x14')](express[_0xf935('0x18')](_0x21f750[_0xf935('0xa')](_0xf935('0xe'))));_0x21f750[_0xf935('0xd')](_0xf935('0x19'),config[_0xf935('0x10')]+_0xf935('0x1a'));_0x21f750[_0xf935('0x1b')](_0xf935('0x1c'),require(_0xf935('0x1d'))[_0xf935('0x1e')]);_0x21f750[_0xf935('0xd')](_0xf935('0x1f'),_0xf935('0x1c'));_0x21f750[_0xf935('0x14')](bodyParser[_0xf935('0x20')]({'limit':_0xf935('0x21'),'extended':!![]}));_0x21f750[_0xf935('0x14')](bodyParser[_0xf935('0x22')]({'limit':_0xf935('0x21')}));_0x21f750['use'](cors());_0x21f750[_0xf935('0x14')](methodOverride());_0x21f750['use'](cookieParser());_0x21f750[_0xf935('0x14')](passport[_0xf935('0x23')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 2379768..2a6ae24 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 _0x7ddb=['hex','substring','lodash','crypto','bimedia-machine-uuid','../environment','keys','filter','family','concat','head','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','cpus','map','model','join','createHash','update','digest','getUuid','platform','licenseToken','test','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','md5'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7ddb,0x68));var _0xb7dd=function(_0xdae136,_0x256a9e){_0xdae136=_0xdae136-0x0;var _0x432764=_0x7ddb[_0xdae136];return _0x432764;};'use strict';var _=require(_0xb7dd('0x0'));var os=require('os');var crypto=require(_0xb7dd('0x1'));var machine=require(_0xb7dd('0x2'));var exec=require('child_process')['execSync'];var config=require(_0xb7dd('0x3'));function getInterfaces(){var _0xc532c2=[];var _0x10a1b7=os['networkInterfaces']();var _0x16b2a4=_['orderBy'](_[_0xb7dd('0x4')](_0x10a1b7));for(var _0x1ac8c7=0x0;_0x1ac8c7<_0x16b2a4['length'];_0x1ac8c7++){var _0x576f56=_0x10a1b7[_0x16b2a4[_0x1ac8c7]][_0xb7dd('0x5')](function(_0x103c33){return _0x103c33[_0xb7dd('0x6')]==='IPv4'&&_0x103c33['internal']===![];});_0xc532c2=_0xc532c2[_0xb7dd('0x7')](_0x576f56);}return _0xc532c2;}function getFirstInterface(){var _0x53d17a=_[_0xb7dd('0x8')](getInterfaces());return{'macAddress':_0x53d17a&&_0x53d17a['mac']?_0x53d17a['mac']:_0xb7dd('0x9'),'ipAddress':_0x53d17a&&_0x53d17a[_0xb7dd('0xa')]?_0x53d17a[_0xb7dd('0xa')]:_0xb7dd('0xb')};}exports[_0xb7dd('0xc')]=getFirstInterface;function getCPUhash(){var _0x4db127=_[_0xb7dd('0xd')](os[_0xb7dd('0xe')]()[_0xb7dd('0xf')](function(_0xdaeade){return _0xdaeade[_0xb7dd('0x10')];}))[_0xb7dd('0x11')](':');return crypto[_0xb7dd('0x12')]('md5')[_0xb7dd('0x13')](_0x4db127)[_0xb7dd('0x14')]('hex');}exports[_0xb7dd('0x15')]=function(){var _0x1aa112=os[_0xb7dd('0x16')]();var _0xedeb17=/[0-9a-f-]{36}/;if(config[_0xb7dd('0x17')]&&_0xedeb17[_0xb7dd('0x18')](config['licenseToken'])){return config[_0xb7dd('0x17')];}else if(_0x1aa112==='win32'){return exec(_0xb7dd('0x19'),{'encoding':_0xb7dd('0x1a')})[_0xb7dd('0x1b')]('\x0d\x0a','');}else{var _0x178f50=getFirstInterface();var _0x56b136=getCPUhash();var _0x5fcb0f=_0x56b136+'|'+os[_0xb7dd('0x1c')]()+'|'+_0x178f50[_0xb7dd('0x1d')]+'|'+_0x178f50[_0xb7dd('0x1e')];var _0x178ec8=crypto[_0xb7dd('0x12')](_0xb7dd('0x1f'))[_0xb7dd('0x13')](_0x5fcb0f)[_0xb7dd('0x14')](_0xb7dd('0x20'));return _0x178ec8[_0xb7dd('0x21')](0x0,0x8)+'-'+_0x178ec8[_0xb7dd('0x21')](0x8,0xc)+'-'+_0x178ec8['substring'](0xc,0x10)+'-'+_0x178ec8['substring'](0x10,0x14)+'-'+_0x178ec8[_0xb7dd('0x21')](0x14);}}; \ No newline at end of file +var _0xc893=['length','filter','head','mac','address','getFirstInterface','cpus','map','model','join','createHash','md5','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','update','substring','lodash','crypto','bimedia-machine-uuid','execSync','../environment','orderBy','keys'];(function(_0x44ed50,_0x4b4a68){var _0x34930c=function(_0x59bf4d){while(--_0x59bf4d){_0x44ed50['push'](_0x44ed50['shift']());}};_0x34930c(++_0x4b4a68);}(_0xc893,0x101));var _0x3c89=function(_0x2f66cb,_0x59a2ce){_0x2f66cb=_0x2f66cb-0x0;var _0x431bdc=_0xc893[_0x2f66cb];return _0x431bdc;};'use strict';var _=require(_0x3c89('0x0'));var os=require('os');var crypto=require(_0x3c89('0x1'));var machine=require(_0x3c89('0x2'));var exec=require('child_process')[_0x3c89('0x3')];var config=require(_0x3c89('0x4'));function getInterfaces(){var _0x2b2fa8=[];var _0x47865e=os['networkInterfaces']();var _0x1c5e85=_[_0x3c89('0x5')](_[_0x3c89('0x6')](_0x47865e));for(var _0x141c03=0x0;_0x141c03<_0x1c5e85[_0x3c89('0x7')];_0x141c03++){var _0xea032d=_0x47865e[_0x1c5e85[_0x141c03]][_0x3c89('0x8')](function(_0x4851a6){return _0x4851a6['family']==='IPv4'&&_0x4851a6['internal']===![];});_0x2b2fa8=_0x2b2fa8['concat'](_0xea032d);}return _0x2b2fa8;}function getFirstInterface(){var _0x44c217=_[_0x3c89('0x9')](getInterfaces());return{'macAddress':_0x44c217&&_0x44c217[_0x3c89('0xa')]?_0x44c217[_0x3c89('0xa')]:'00:00:00:00:00:00','ipAddress':_0x44c217&&_0x44c217[_0x3c89('0xb')]?_0x44c217[_0x3c89('0xb')]:'127.0.0.1'};}exports[_0x3c89('0xc')]=getFirstInterface;function getCPUhash(){var _0x724db3=_[_0x3c89('0x5')](os[_0x3c89('0xd')]()[_0x3c89('0xe')](function(_0x562427){return _0x562427[_0x3c89('0xf')];}))[_0x3c89('0x10')](':');return crypto[_0x3c89('0x11')](_0x3c89('0x12'))['update'](_0x724db3)['digest'](_0x3c89('0x13'));}exports[_0x3c89('0x14')]=function(){var _0x3311a4=os[_0x3c89('0x15')]();var _0x29f86d=/[0-9a-f-]{36}/;if(config[_0x3c89('0x16')]&&_0x29f86d[_0x3c89('0x17')](config[_0x3c89('0x16')])){return config['licenseToken'];}else if(_0x3311a4===_0x3c89('0x18')){return exec(_0x3c89('0x19'),{'encoding':_0x3c89('0x1a')})[_0x3c89('0x1b')]('\x0d\x0a','');}else{var _0x1fe5e2=getFirstInterface();var _0x250221=getCPUhash();var _0x4a7776=_0x250221+'|'+os[_0x3c89('0x1c')]()+'|'+_0x1fe5e2[_0x3c89('0x1d')]+'|'+_0x1fe5e2[_0x3c89('0x1e')];var _0xae9df5=crypto['createHash'](_0x3c89('0x12'))[_0x3c89('0x1f')](_0x4a7776)['digest'](_0x3c89('0x13'));return _0xae9df5[_0x3c89('0x20')](0x0,0x8)+'-'+_0xae9df5['substring'](0x8,0xc)+'-'+_0xae9df5[_0x3c89('0x20')](0xc,0x10)+'-'+_0xae9df5[_0x3c89('0x20')](0x10,0x14)+'-'+_0xae9df5[_0x3c89('0x20')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 1ad67ef..595bd71 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 _0xd507=['%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','active','data2','info','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','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','version','license','format','%s/api/servers/%s/check?version=%s','exports'];(function(_0xb8f65,_0x5b3d4f){var _0x537221=function(_0x157d70){while(--_0x157d70){_0xb8f65['push'](_0xb8f65['shift']());}};_0x537221(++_0x5b3d4f);}(_0xd507,0xa9));var _0x7d50=function(_0xcc104e,_0x3f8d50){_0xcc104e=_0xcc104e-0x0;var _0x39978e=_0xd507[_0xcc104e];return _0x39978e;};'use strict';var util=require(_0x7d50('0x0'));var moment=require('moment');var rp=require('request-promise');var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,_0x7d50('0x1'));var db=require('../../mysqldb')['db'];var encryptor=require('../../components/encryptor');var hardware=require('./hardware');var logger=require('../logger')(_0x7d50('0x2'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x4fe915){return new BPromise(function(_0x3f6d97,_0x10f320){var _0x2e4c20=util[_0x7d50('0x3')](_0x7d50('0x4'),HOST,_0x4fe915,module[_0x7d50('0x5')]['version']);if(oldToken){_0x2e4c20=util[_0x7d50('0x3')](_0x7d50('0x6'),HOST,_0x4fe915,module[_0x7d50('0x5')][_0x7d50('0x1')],oldToken);}var _0x2e4748={'uri':_0x2e4c20,'method':_0x7d50('0x7'),'timeout':0xea60,'json':!![]};return rp(_0x2e4748)[_0x7d50('0x8')](function(_0x31f706){_0x3f6d97(_0x31f706);})[_0x7d50('0x9')](function(_0x62257){_0x10f320(_0x62257);});});}function manageLicense(_0x4be1ad,_0x56f46e){var _0x3a058f=_0x56f46e[_0x7d50('0xa')]({'plain':!![]});if(!isOldTokenSent&&_0x3a058f[_0x7d50('0xb')]!==_0x4be1ad&&!_0x3a058f['data2']){oldToken=_0x3a058f[_0x7d50('0xb')];}httpRequest(_0x4be1ad)[_0x7d50('0x8')](function(_0x13c31e){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x13c31e[_0x7d50('0xc')]){isOldTokenSent=![];if(!_0x3a058f[_0x7d50('0x2')]&&_0x3a058f[_0x7d50('0x2')]!=_0x13c31e[_0x7d50('0x2')]||_0x3a058f[_0x7d50('0x2')]&&_0x3a058f[_0x7d50('0xd')]){logger[_0x7d50('0xe')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x3a058f[_0x7d50('0x2')]&&!_0x3a058f[_0x7d50('0xd')]&&_0x3a058f[_0x7d50('0x2')]!=_0x13c31e[_0x7d50('0x2')]){logger[_0x7d50('0xe')](_0x7d50('0xf'));}if(_0x3a058f[_0x7d50('0x2')]&&!_0x3a058f[_0x7d50('0xd')]&&_0x3a058f[_0x7d50('0x2')]==_0x13c31e[_0x7d50('0x2')]){return _0x56f46e;}return _0x56f46e[_0x7d50('0x10')]({'data1':_0x4be1ad,'data2':null,'license':_0x13c31e['license']});}else{if(_0x13c31e[_0x7d50('0x2')]||_0x3a058f[_0x7d50('0x2')]){if(!_0x3a058f[_0x7d50('0xd')]){if(_0x3a058f['data1']==_0x4be1ad){GRAY_PERIOD_REASON=_0x7d50('0x11');logger[_0x7d50('0xe')](_0x7d50('0x12'));}else{GRAY_PERIOD_REASON='Changed';logger['info'](_0x7d50('0x13'),_0x3a058f[_0x7d50('0xb')],_0x4be1ad);}logger[_0x7d50('0xe')](_0x7d50('0x14'),GRAY_PERIOD_REASON[_0x7d50('0x15')](),moment()[_0x7d50('0x3')](_0x7d50('0x16')));return _0x56f46e['update']({'data2':encryptor['encryptString'](moment()[_0x7d50('0x3')](_0x7d50('0x16')))});}else{if(moment()[_0x7d50('0x17')](encryptor[_0x7d50('0x18')](_0x3a058f[_0x7d50('0xd')]),_0x7d50('0x19'))>DAYS){logger[_0x7d50('0xe')](_0x7d50('0x1a'),moment()['format'](_0x7d50('0x16')));isOldTokenSent=![];return _0x56f46e[_0x7d50('0x10')]({'data1':_0x4be1ad,'data2':null,'license':null});}}}else{if(_0x3a058f[_0x7d50('0xb')]!=_0x4be1ad){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x3a058f[_0x7d50('0xb')],_0x4be1ad);return _0x56f46e[_0x7d50('0x10')]({'data1':_0x4be1ad,'data2':null,'license':null});}}}return _0x56f46e;})[_0x7d50('0x8')](function(_0x3dd189){_0x56f46e=_0x3dd189;})['catch'](function(_0x17642e){logger[_0x7d50('0x1b')](_0x17642e[_0x7d50('0x1c')]);})[_0x7d50('0x1d')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x56f46e);},TIME);});}function defaultLicense(){var _0x30ee14=hardware['getUuid']();if(_0x30ee14){return db[_0x7d50('0x1e')][_0x7d50('0x1f')]({'where':{'id':0x1},'defaults':{'data1':_0x30ee14}})[_0x7d50('0x20')](function(_0x510aa8,_0xb26b72){logger[_0x7d50('0xe')](_0x7d50('0x21'),_0x30ee14);manageLicense(_0x30ee14,_0x510aa8);})[_0x7d50('0x9')](function(_0x397441){logger[_0x7d50('0x1b')](_0x397441[_0x7d50('0x1c')]);});}}exports[_0x7d50('0x22')]=defaultLicense; \ No newline at end of file +var _0x0737=['data1','data2','active','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','format','YYYY-MM-DD\x20HH:mm','update','encryptString','diff','decryptString','days','error','message','finally','getUuid','License','findOrCreate','spread','default','util','request-promise','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','license','https://www.xcallymotion.com','exports','GET','then','catch','get'];(function(_0x2f2352,_0x28419f){var _0x4c4139=function(_0x27c9c9){while(--_0x27c9c9){_0x2f2352['push'](_0x2f2352['shift']());}};_0x4c4139(++_0x28419f);}(_0x0737,0x111));var _0x7073=function(_0x595993,_0x547a3c){_0x595993=_0x595993-0x0;var _0x196614=_0x0737[_0x595993];return _0x196614;};'use strict';var util=require(_0x7073('0x0'));var moment=require('moment');var rp=require(_0x7073('0x1'));var BPromise=require('bluebird');var pkginfo=require(_0x7073('0x2'))(module,_0x7073('0x3'));var db=require(_0x7073('0x4'))['db'];var encryptor=require(_0x7073('0x5'));var hardware=require(_0x7073('0x6'));var logger=require('../logger')(_0x7073('0x7'));var HOST=_0x7073('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x4335cd){return new BPromise(function(_0x393bc9,_0x2333fc){var _0x45e947=util['format']('%s/api/servers/%s/check?version=%s',HOST,_0x4335cd,module[_0x7073('0x9')][_0x7073('0x3')]);if(oldToken){_0x45e947=util['format']('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x4335cd,module[_0x7073('0x9')]['version'],oldToken);}var _0xad182={'uri':_0x45e947,'method':_0x7073('0xa'),'timeout':0xea60,'json':!![]};return rp(_0xad182)[_0x7073('0xb')](function(_0x219dbc){_0x393bc9(_0x219dbc);})[_0x7073('0xc')](function(_0x157725){_0x2333fc(_0x157725);});});}function manageLicense(_0x5d2e21,_0x1fd706){var _0x566feb=_0x1fd706[_0x7073('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0x566feb[_0x7073('0xe')]!==_0x5d2e21&&!_0x566feb[_0x7073('0xf')]){oldToken=_0x566feb[_0x7073('0xe')];}httpRequest(_0x5d2e21)[_0x7073('0xb')](function(_0x37a8e7){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x37a8e7[_0x7073('0x10')]){isOldTokenSent=![];if(!_0x566feb[_0x7073('0x7')]&&_0x566feb[_0x7073('0x7')]!=_0x37a8e7[_0x7073('0x7')]||_0x566feb[_0x7073('0x7')]&&_0x566feb[_0x7073('0xf')]){logger['info'](_0x7073('0x11'));}if(_0x566feb[_0x7073('0x7')]&&!_0x566feb[_0x7073('0xf')]&&_0x566feb[_0x7073('0x7')]!=_0x37a8e7[_0x7073('0x7')]){logger[_0x7073('0x12')](_0x7073('0x13'));}if(_0x566feb[_0x7073('0x7')]&&!_0x566feb[_0x7073('0xf')]&&_0x566feb[_0x7073('0x7')]==_0x37a8e7[_0x7073('0x7')]){return _0x1fd706;}return _0x1fd706['update']({'data1':_0x5d2e21,'data2':null,'license':_0x37a8e7[_0x7073('0x7')]});}else{if(_0x37a8e7[_0x7073('0x7')]||_0x566feb[_0x7073('0x7')]){if(!_0x566feb[_0x7073('0xf')]){if(_0x566feb[_0x7073('0xe')]==_0x5d2e21){GRAY_PERIOD_REASON=_0x7073('0x14');logger[_0x7073('0x12')](_0x7073('0x15'));}else{GRAY_PERIOD_REASON=_0x7073('0x16');logger['info'](_0x7073('0x17'),_0x566feb['data1'],_0x5d2e21);}logger['info'](_0x7073('0x18'),GRAY_PERIOD_REASON[_0x7073('0x19')](),moment()[_0x7073('0x1a')](_0x7073('0x1b')));return _0x1fd706[_0x7073('0x1c')]({'data2':encryptor[_0x7073('0x1d')](moment()[_0x7073('0x1a')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x7073('0x1e')](encryptor[_0x7073('0x1f')](_0x566feb['data2']),_0x7073('0x20'))>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()[_0x7073('0x1a')](_0x7073('0x1b')));isOldTokenSent=![];return _0x1fd706[_0x7073('0x1c')]({'data1':_0x5d2e21,'data2':null,'license':null});}}}else{if(_0x566feb[_0x7073('0xe')]!=_0x5d2e21){logger[_0x7073('0x12')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x566feb[_0x7073('0xe')],_0x5d2e21);return _0x1fd706[_0x7073('0x1c')]({'data1':_0x5d2e21,'data2':null,'license':null});}}}return _0x1fd706;})[_0x7073('0xb')](function(_0x3869be){_0x1fd706=_0x3869be;})[_0x7073('0xc')](function(_0x160dc1){logger[_0x7073('0x21')](_0x160dc1[_0x7073('0x22')]);})[_0x7073('0x23')](function(){setTimeout(function(){manageLicense(hardware[_0x7073('0x24')](),_0x1fd706);},TIME);});}function defaultLicense(){var _0x30a9ee=hardware[_0x7073('0x24')]();if(_0x30a9ee){return db[_0x7073('0x25')][_0x7073('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0x30a9ee}})[_0x7073('0x27')](function(_0x345f21,_0x5367d0){logger['info']('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x30a9ee);manageLicense(_0x30a9ee,_0x345f21);})[_0x7073('0xc')](function(_0x11957f){logger[_0x7073('0x21')](_0x11957f[_0x7073('0x22')]);});}}exports[_0x7073('0x28')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index bd7394b..4199dd2 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 _0xef92=['format','demo','uuid','machineUuid','gray','deadline','add','days','grayReason','changed','message','findAll','role','sequelize','col','count','admin','telephone','telephones','forEach','user','pick','countBy','License\x20limit\x20reached\x20for\x20users','util','lodash','moment','bluebird','./hardware','../../mysqldb','Breaking\x20license','getUuid','defaults','then','catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString'];(function(_0x36438f,_0x45a095){var _0x592832=function(_0x49bed0){while(--_0x49bed0){_0x36438f['push'](_0x36438f['shift']());}};_0x592832(++_0x45a095);}(_0xef92,0x168));var _0x2ef9=function(_0x4de956,_0x4d0251){_0x4de956=_0x4de956-0x0;var _0x78856a=_0xef92[_0x4de956];return _0x78856a;};'use strict';var util=require(_0x2ef9('0x0'));var _=require(_0x2ef9('0x1'));var moment=require(_0x2ef9('0x2'));var BPromise=require(_0x2ef9('0x3'));var hardware=require(_0x2ef9('0x4'));var encryptor=require('../../components/encryptor');var db=require(_0x2ef9('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware['getUuid'](),'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':_0x2ef9('0x6'),'machineUuid':hardware[_0x2ef9('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x454afc){return new BPromise(function(_0x3f464d,_0x39cd89){return db['License']['find'](_[_0x2ef9('0x8')](_0x454afc,{'raw':!![],'where':{'id':0x1}}))[_0x2ef9('0x9')](function(_0x50fdda){return checkLicense(_0x50fdda,null);})[_0x2ef9('0x9')](function(_0x44950c){_0x3f464d(_0x44950c);return;})[_0x2ef9('0xa')](function(_0x3e1a9a){_0x39cd89(_0x3e1a9a);});});}function checkLicense(_0x26f772,_0x2994b0){if(!_0x26f772){demoLicense['uuid']=_0x26f772[_0x2ef9('0xb')];return demoLicense;}try{var _0x483bbb=_0x2994b0||_0x26f772[_0x2ef9('0xc')];if(_[_0x2ef9('0xd')](_0x483bbb)){throw new Error(_0x2ef9('0xe'));}var _0x128113=_0x26f772[_0x2ef9('0xb')];var _0x419742=_0x26f772[_0x2ef9('0xf')];var _0x511898=_0x128113[_0x2ef9('0x10')]('-')[0x4];var _0x1bd02e=_0x128113[_0x2ef9('0x10')]('-')[0x0];var _0x56679f=encryptor[_0x2ef9('0x11')](_0x483bbb,util[_0x2ef9('0x12')]('%s:%s:%s',_0x511898,_0x128113,_0x1bd02e));var _0xe7f3c7=JSON['parse'](_0x56679f);_0xe7f3c7[_0x2ef9('0x13')]=![];_0xe7f3c7[_0x2ef9('0x14')]=_0x128113;_0xe7f3c7[_0x2ef9('0x15')]=hardware[_0x2ef9('0x7')]();if(_0x419742){var _0x40563f=encryptor[_0x2ef9('0x11')](_0x419742);_0xe7f3c7[_0x2ef9('0x16')]=_0x40563f;_0xe7f3c7[_0x2ef9('0x17')]=moment(_0x40563f)[_0x2ef9('0x18')](0x7,_0x2ef9('0x19'))[_0x2ef9('0x12')]();_0xe7f3c7[_0x2ef9('0x1a')]=_0xe7f3c7[_0x2ef9('0x14')]!=_0xe7f3c7[_0x2ef9('0x15')]?_0x2ef9('0x1b'):'disabled';}return _0xe7f3c7;}catch(_0x4eaa58){breakingLicense[_0x2ef9('0x14')]=_0x26f772['data1'];breakingLicense['message']=_0x4eaa58[_0x2ef9('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x47985e,_0x5ca725){getLicense()[_0x2ef9('0x9')](function(_0x40604d){return db['User'][_0x2ef9('0x1d')]({'attributes':[_0x2ef9('0x1e'),[db['sequelize']['fn']('COUNT',db[_0x2ef9('0x1f')][_0x2ef9('0x20')]('role')),_0x2ef9('0x21')]],'group':'role','where':{'role':{'$or':[_0x2ef9('0x22'),'user',_0x2ef9('0x23')]}},'raw':!![]})[_0x2ef9('0x9')](function(_0x4c48bf){var _0x30ef40={'user':_0x40604d['users']||0x0,'telephone':_0x40604d[_0x2ef9('0x24')]||0x0};_0x4c48bf[_0x2ef9('0x25')](function(_0x44f398){var _0x2ec50b=_0x44f398['role']===_0x2ef9('0x22')?_0x2ef9('0x26'):_0x44f398[_0x2ef9('0x1e')];_0x30ef40[_0x2ec50b]-=_0x44f398[_0x2ef9('0x21')];if(_0x30ef40[_0x2ec50b]<0x0)_0x30ef40[_0x2ec50b]=0x0;});_0x47985e(_0x30ef40);return;});})[_0x2ef9('0xa')](function(_0xf35b8e){_0x5ca725(_0xf35b8e);});});}function checkUserLimits(_0x4984d3){return new BPromise(function(_0x3c9bea,_0x5ef601){getLimits()[_0x2ef9('0x9')](function(_0x15b2b2){var _0x442de3=_[_0x2ef9('0x27')](_[_0x2ef9('0x28')](_0x4984d3,_0x2ef9('0x1e')),['admin',_0x2ef9('0x26'),_0x2ef9('0x23')]);var _0x35ec47=(_0x442de3[_0x2ef9('0x22')]||0x0)+(_0x442de3[_0x2ef9('0x26')]||0x0);var _0x1a8f9e=_0x442de3[_0x2ef9('0x23')]||0x0;if(_0x35ec47>_0x15b2b2['user'])return _0x5ef601(_0x2ef9('0x29'));if(_0x1a8f9e>_0x15b2b2[_0x2ef9('0x23')])return _0x5ef601('License\x20limit\x20reached\x20for\x20telephones');return _0x3c9bea();})[_0x2ef9('0xa')](function(_0x27903e){_0x5ef601(_0x27903e);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xdc35=['getUuid','License','find','then','catch','uuid','data1','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','deadline','add','days','grayReason','changed','message','findAll','COUNT','sequelize','count','role','admin','user','telephone','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license'];(function(_0xcd938c,_0x522d9c){var _0x1c7a0c=function(_0x8e7fac){while(--_0x8e7fac){_0xcd938c['push'](_0xcd938c['shift']());}};_0x1c7a0c(++_0x522d9c);}(_0xdc35,0x117));var _0x5dc3=function(_0x461251,_0x4b5f46){_0x461251=_0x461251-0x0;var _0x35a479=_0xdc35[_0x461251];return _0x35a479;};'use strict';var util=require(_0x5dc3('0x0'));var _=require(_0x5dc3('0x1'));var moment=require(_0x5dc3('0x2'));var BPromise=require(_0x5dc3('0x3'));var hardware=require(_0x5dc3('0x4'));var encryptor=require(_0x5dc3('0x5'));var db=require(_0x5dc3('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x5dc3('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x5dc3('0x8'),'machineUuid':hardware[_0x5dc3('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x5dc3('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x5dc3('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4db803){return new BPromise(function(_0x47c5c3,_0xadc457){return db[_0x5dc3('0xa')][_0x5dc3('0xb')](_['defaults'](_0x4db803,{'raw':!![],'where':{'id':0x1}}))[_0x5dc3('0xc')](function(_0x22075e){return checkLicense(_0x22075e,null);})[_0x5dc3('0xc')](function(_0x6e00b7){_0x47c5c3(_0x6e00b7);return;})[_0x5dc3('0xd')](function(_0x43b090){_0xadc457(_0x43b090);});});}function checkLicense(_0x2a694b,_0x4167a3){if(!_0x2a694b){demoLicense[_0x5dc3('0xe')]=_0x2a694b[_0x5dc3('0xf')];return demoLicense;}try{var _0x40bd50=_0x4167a3||_0x2a694b['license'];if(_[_0x5dc3('0x10')](_0x40bd50)){throw new Error(_0x5dc3('0x11'));}var _0x2e20c1=_0x2a694b[_0x5dc3('0xf')];var _0x21341b=_0x2a694b[_0x5dc3('0x12')];var _0xe9aed=_0x2e20c1[_0x5dc3('0x13')]('-')[0x4];var _0x122cbf=_0x2e20c1['split']('-')[0x0];var _0x4875d5=encryptor[_0x5dc3('0x14')](_0x40bd50,util[_0x5dc3('0x15')](_0x5dc3('0x16'),_0xe9aed,_0x2e20c1,_0x122cbf));var _0x2cbff4=JSON[_0x5dc3('0x17')](_0x4875d5);_0x2cbff4[_0x5dc3('0x18')]=![];_0x2cbff4[_0x5dc3('0xe')]=_0x2e20c1;_0x2cbff4[_0x5dc3('0x19')]=hardware[_0x5dc3('0x9')]();if(_0x21341b){var _0x439fb6=encryptor[_0x5dc3('0x14')](_0x21341b);_0x2cbff4[_0x5dc3('0x1a')]=_0x439fb6;_0x2cbff4[_0x5dc3('0x1b')]=moment(_0x439fb6)[_0x5dc3('0x1c')](0x7,_0x5dc3('0x1d'))[_0x5dc3('0x15')]();_0x2cbff4[_0x5dc3('0x1e')]=_0x2cbff4[_0x5dc3('0xe')]!=_0x2cbff4[_0x5dc3('0x19')]?_0x5dc3('0x1f'):'disabled';}return _0x2cbff4;}catch(_0x25a7d2){breakingLicense[_0x5dc3('0xe')]=_0x2a694b[_0x5dc3('0xf')];breakingLicense[_0x5dc3('0x20')]=_0x25a7d2[_0x5dc3('0x20')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3f3c9a,_0x1f73a3){getLicense()['then'](function(_0x12b452){return db['User'][_0x5dc3('0x21')]({'attributes':['role',[db['sequelize']['fn'](_0x5dc3('0x22'),db[_0x5dc3('0x23')]['col']('role')),_0x5dc3('0x24')]],'group':_0x5dc3('0x25'),'where':{'role':{'$or':[_0x5dc3('0x26'),_0x5dc3('0x27'),_0x5dc3('0x28')]}},'raw':!![]})[_0x5dc3('0xc')](function(_0x35a2ad){var _0x53a3ed={'user':_0x12b452['users']||0x0,'telephone':_0x12b452[_0x5dc3('0x29')]||0x0};_0x35a2ad[_0x5dc3('0x2a')](function(_0x2cbf3a){var _0x238851=_0x2cbf3a['role']===_0x5dc3('0x26')?'user':_0x2cbf3a['role'];_0x53a3ed[_0x238851]-=_0x2cbf3a[_0x5dc3('0x24')];if(_0x53a3ed[_0x238851]<0x0)_0x53a3ed[_0x238851]=0x0;});_0x3f3c9a(_0x53a3ed);return;});})[_0x5dc3('0xd')](function(_0x7347aa){_0x1f73a3(_0x7347aa);});});}function checkUserLimits(_0x55ceda){return new BPromise(function(_0x42d9c9,_0x54a20d){getLimits()[_0x5dc3('0xc')](function(_0x510050){var _0x5c778a=_[_0x5dc3('0x2b')](_[_0x5dc3('0x2c')](_0x55ceda,_0x5dc3('0x25')),[_0x5dc3('0x26'),_0x5dc3('0x27'),_0x5dc3('0x28')]);var _0x2897c2=(_0x5c778a[_0x5dc3('0x26')]||0x0)+(_0x5c778a[_0x5dc3('0x27')]||0x0);var _0x1e86da=_0x5c778a[_0x5dc3('0x28')]||0x0;if(_0x2897c2>_0x510050[_0x5dc3('0x27')])return _0x54a20d(_0x5dc3('0x2d'));if(_0x1e86da>_0x510050[_0x5dc3('0x28')])return _0x54a20d(_0x5dc3('0x2e'));return _0x42d9c9();})[_0x5dc3('0xd')](function(_0x1ac610){_0x54a20d(_0x1ac610);});});}module[_0x5dc3('0x2f')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 89f8dac..d1eab2f 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 _0x5c3c=['myappanuglar-secret','app-id','exports','http://localhost:9000'];(function(_0x1faaa1,_0x1568dd){var _0x994ec=function(_0x298ef4){while(--_0x298ef4){_0x1faaa1['push'](_0x1faaa1['shift']());}};_0x994ec(++_0x1568dd);}(_0x5c3c,0x132));var _0xc5c3=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5c3c[_0x4243a3];return _0x1b2a33;};'use strict';module[_0xc5c3('0x0')]={'DOMAIN':_0xc5c3('0x1'),'SESSION_SECRET':_0xc5c3('0x2'),'GOOGLE_ID':_0xc5c3('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x0972=['http://localhost:9000','app-id'];(function(_0x2a54fc,_0x3754c8){var _0x19d8b4=function(_0xce7d3e){while(--_0xce7d3e){_0x2a54fc['push'](_0x2a54fc['shift']());}};_0x19d8b4(++_0x3754c8);}(_0x0972,0x64));var _0x2097=function(_0x82f9de,_0x30a62e){_0x82f9de=_0x82f9de-0x0;var _0x4892d3=_0x0972[_0x82f9de];return _0x4892d3;};'use strict';module['exports']={'DOMAIN':_0x2097('0x0'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x2097('0x1'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 82a8b60..be8fe0a 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbb1a=['%s-%s','error','info','Console','env','debugLevel','moment','winston','util','path','INFO','join','log','xcally','format','%s-%s.log','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','Logger','transports','File'];(function(_0x2ec2bf,_0x64e983){var _0x2c279c=function(_0x41fe42){while(--_0x41fe42){_0x2ec2bf['push'](_0x2ec2bf['shift']());}};_0x2c279c(++_0x64e983);}(_0xbb1a,0x18c));var _0xabb1=function(_0x441a42,_0x1f5385){_0x441a42=_0x441a42-0x0;var _0x5d9d93=_0xbb1a[_0x441a42];return _0x5d9d93;};'use strict';var moment=require(_0xabb1('0x0'));var winston=require(_0xabb1('0x1'));var util=require(_0xabb1('0x2'));var path=require(_0xabb1('0x3'));var debugLevel=_0xabb1('0x4');function filename(_0x5c678d,_0x30572e){return path[_0xabb1('0x5')]('/var',_0xabb1('0x6'),_0xabb1('0x7'),util[_0xabb1('0x8')](_0xabb1('0x9'),_0x5c678d,_0x30572e));}function formatter(_0x5222b7,_0x1b2c0e){_0x1b2c0e['message']=_0x1b2c0e[_0xabb1('0xa')][_0xabb1('0xb')](/@@{/g,'{{{')[_0xabb1('0xb')](/}@@/g,_0xabb1('0xc'))[_0xabb1('0xb')](/@{/g,'{{')[_0xabb1('0xb')](/}@/g,'}}');return util[_0xabb1('0x8')](_0xabb1('0xd'),moment()[_0xabb1('0x8')](_0xabb1('0xe')),_0x1b2c0e[_0xabb1('0xf')][_0xabb1('0x10')](),_0x5222b7,_0x1b2c0e['message']);}module['exports']=function(_0xc1141a){return new winston[(_0xabb1('0x11'))]({'transports':[new winston[(_0xabb1('0x12'))][(_0xabb1('0x13'))]({'name':util[_0xabb1('0x8')](_0xabb1('0x14'),_0xc1141a,_0xabb1('0x15')),'filename':filename(_0xc1141a,'error'),'level':_0xabb1('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x579e52){return formatter(_0xc1141a,_0x579e52);}}),new winston[(_0xabb1('0x12'))][(_0xabb1('0x13'))]({'name':util[_0xabb1('0x8')](_0xabb1('0x14'),_0xc1141a,_0xabb1('0x16')),'filename':filename(_0xc1141a,_0xabb1('0x16')),'level':_0xabb1('0x16'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x19b4c1){return formatter(_0xc1141a,_0x19b4c1);}}),new winston[(_0xabb1('0x12'))][(_0xabb1('0x17'))]({'level':process[_0xabb1('0x18')][_0xabb1('0x19')]||debugLevel,'json':![],'formatter':function(_0xaad090){return formatter(_0xc1141a,_0xaad090);}})]});}; \ No newline at end of file +var _0xa461=['}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','Logger','File','error','transports','%s-%s','info','moment','winston','path','INFO','join','/var','log','xcally','format','message','{{{','replace'];(function(_0x67f95e,_0x3ca797){var _0x538f5a=function(_0xc919e9){while(--_0xc919e9){_0x67f95e['push'](_0x67f95e['shift']());}};_0x538f5a(++_0x3ca797);}(_0xa461,0x1ee));var _0x1a46=function(_0x280cec,_0x435549){_0x280cec=_0x280cec-0x0;var _0x5927d3=_0xa461[_0x280cec];return _0x5927d3;};'use strict';var moment=require(_0x1a46('0x0'));var winston=require(_0x1a46('0x1'));var util=require('util');var path=require(_0x1a46('0x2'));var debugLevel=_0x1a46('0x3');function filename(_0x22b918,_0x10d893){return path[_0x1a46('0x4')](_0x1a46('0x5'),_0x1a46('0x6'),_0x1a46('0x7'),util[_0x1a46('0x8')]('%s-%s.log',_0x22b918,_0x10d893));}function formatter(_0x58437e,_0x339a87){_0x339a87[_0x1a46('0x9')]=_0x339a87[_0x1a46('0x9')]['replace'](/@@{/g,_0x1a46('0xa'))[_0x1a46('0xb')](/}@@/g,_0x1a46('0xc'))['replace'](/@{/g,'{{')[_0x1a46('0xb')](/}@/g,'}}');return util[_0x1a46('0x8')](_0x1a46('0xd'),moment()[_0x1a46('0x8')](_0x1a46('0xe')),_0x339a87[_0x1a46('0xf')]['toUpperCase'](),_0x58437e,_0x339a87[_0x1a46('0x9')]);}module['exports']=function(_0x502512){return new winston[(_0x1a46('0x10'))]({'transports':[new winston['transports'][(_0x1a46('0x11'))]({'name':util['format']('%s-%s',_0x502512,_0x1a46('0x12')),'filename':filename(_0x502512,'error'),'level':_0x1a46('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2d9181){return formatter(_0x502512,_0x2d9181);}}),new winston[(_0x1a46('0x13'))]['File']({'name':util[_0x1a46('0x8')](_0x1a46('0x14'),_0x502512,_0x1a46('0x15')),'filename':filename(_0x502512,_0x1a46('0x15')),'level':_0x1a46('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4aff35){return formatter(_0x502512,_0x4aff35);}}),new winston['transports']['Console']({'level':process['env']['debugLevel']||debugLevel,'json':![],'formatter':function(_0x2adc6b){return formatter(_0x502512,_0x2adc6b);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index dc0be2e..6df311e 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 _0xa38d=['../../services/express/index.js','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','join'];(function(_0x3b4f49,_0x507f85){var _0x48d549=function(_0x46322b){while(--_0x46322b){_0x3b4f49['push'](_0x3b4f49['shift']());}};_0x48d549(++_0x507f85);}(_0xa38d,0x8c));var _0xda38=function(_0x2e7cf1,_0x28db0c){_0x2e7cf1=_0x2e7cf1-0x0;var _0x553752=_0xa38d[_0x2e7cf1];return _0x553752;};'use strict';var path=require(_0xda38('0x0'));var os=require('os');var config={'apps':[{'name':_0xda38('0x1'),'script':path[_0xda38('0x2')](__dirname,_0xda38('0x3'))},{'name':'ami','script':path[_0xda38('0x2')](__dirname,_0xda38('0x4'))},{'name':_0xda38('0x5'),'script':path[_0xda38('0x2')](__dirname,_0xda38('0x6'))},{'name':_0xda38('0x7'),'script':path['join'](__dirname,_0xda38('0x8'))},{'name':'routing','script':path[_0xda38('0x2')](__dirname,_0xda38('0x9'))},{'name':_0xda38('0xa'),'script':path['join'](__dirname,_0xda38('0xb'))}]};module[_0xda38('0xc')]=config; \ No newline at end of file +var _0x33b6=['../../services/express/index.js','ami','join','../../services/ami/index.js','../../services/agi/index.js','../../services/email/index.js','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express'];(function(_0x54d710,_0x17b8ba){var _0x3e7ade=function(_0x46aac3){while(--_0x46aac3){_0x54d710['push'](_0x54d710['shift']());}};_0x3e7ade(++_0x17b8ba);}(_0x33b6,0xee));var _0x633b=function(_0x2503aa,_0x4ea0db){_0x2503aa=_0x2503aa-0x0;var _0x44f5e2=_0x33b6[_0x2503aa];return _0x44f5e2;};'use strict';var path=require(_0x633b('0x0'));var os=require('os');var config={'apps':[{'name':_0x633b('0x1'),'script':path['join'](__dirname,_0x633b('0x2'))},{'name':_0x633b('0x3'),'script':path[_0x633b('0x4')](__dirname,_0x633b('0x5'))},{'name':'agi','script':path[_0x633b('0x4')](__dirname,_0x633b('0x6'))},{'name':'email','script':path[_0x633b('0x4')](__dirname,_0x633b('0x7'))},{'name':'routing','script':path[_0x633b('0x4')](__dirname,_0x633b('0x8'))},{'name':_0x633b('0x9'),'script':path[_0x633b('0x4')](__dirname,_0x633b('0xa'))}]};module[_0x633b('0xb')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index b1eab13..cc2bd42 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 _0xea18=['./config','connect','connected','start','then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2'];(function(_0x46943c,_0x578ca7){var _0xd038fa=function(_0x5193c3){while(--_0x5193c3){_0x46943c['push'](_0x46943c['shift']());}};_0xd038fa(++_0x578ca7);}(_0xea18,0x179));var _0x8ea1=function(_0x1ffd37,_0x5d125b){_0x1ffd37=_0x1ffd37-0x0;var _0x5d0d76=_0xea18[_0x1ffd37];return _0x5d0d76;};'use strict';var pm2=require(_0x8ea1('0x0'));var BPromise=require('bluebird');var config=require(_0x8ea1('0x1'));function connect(){return new BPromise(function(_0xf90c7f,_0x53caf0){return pm2[_0x8ea1('0x2')](function(_0x46e7c7){if(_0x46e7c7){return _0x53caf0(_0x46e7c7);}return _0xf90c7f(_0x8ea1('0x3'));});});};exports[_0x8ea1('0x4')]=function(_0x26f41d){return connect()[_0x8ea1('0x5')](function(){return new BPromise(function(_0x155333,_0x3757d7){return pm2[_0x8ea1('0x4')](_0x26f41d,function(_0x44f198,_0x30bdfa){if(_0x44f198){return _0x3757d7(_0x44f198);}pm2[_0x8ea1('0x6')]();return _0x155333(_0x30bdfa);});});});};exports['stop']=function(_0x272ad2){return connect()[_0x8ea1('0x5')](function(){return new BPromise(function(_0x429dc7,_0xaf115e){return pm2[_0x8ea1('0x7')](_0x272ad2,function(_0x1c14d5,_0x5e7bde){if(_0x1c14d5){return _0xaf115e(_0x1c14d5);}pm2[_0x8ea1('0x6')]();return _0x429dc7(_0x5e7bde);});});});};exports[_0x8ea1('0x8')]=function(_0x595c05){return connect()[_0x8ea1('0x5')](function(){return new BPromise(function(_0x493498,_0x42c34c){return pm2[_0x8ea1('0x8')](_0x595c05,function(_0x2c7d2d,_0x3ee2a5){if(_0x2c7d2d){return _0x42c34c(_0x2c7d2d);}pm2[_0x8ea1('0x6')]();return _0x493498(_0x3ee2a5);});});});};exports['list']=function(){return connect()[_0x8ea1('0x5')](function(){return new BPromise(function(_0x319b32,_0x5686ac){return pm2[_0x8ea1('0x9')](function(_0x1d36c9,_0x1a150a){if(_0x1d36c9){return _0x5686ac(_0x1d36c9);}pm2[_0x8ea1('0x6')]();return _0x319b32(_0x1a150a);});});});};exports['describe']=function(_0x2478e0){return connect()[_0x8ea1('0x5')](function(){return new BPromise(function(_0x23826b,_0x10cc07){return pm2[_0x8ea1('0xa')](_0x2478e0,function(_0x2a9818,_0x35d5c1){if(_0x2a9818){return _0x10cc07(_0x2a9818);}pm2['disconnect']();return _0x23826b(_0x35d5c1);});});});};exports[_0x8ea1('0xb')]=function(_0x1158e9){return connect()[_0x8ea1('0x5')](function(){return new BPromise(function(_0x472c28,_0x4626f1){return pm2[_0x8ea1('0xb')](_0x1158e9,function(_0x103e11,_0x48981d){if(_0x103e11){return _0x4626f1(_0x103e11);}pm2[_0x8ea1('0x6')]();return _0x472c28(_0x48981d);});});});};exports[_0x8ea1('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x36d16c,_0x58daa6){return pm2['dump'](function(_0x4457be){if(_0x4457be){return _0x58daa6(_0x4457be);}return _0x36d16c(_0x8ea1('0xd'));});});});}; \ No newline at end of file +var _0x1b45=['pm2','bluebird','./config','connect','connected','start','disconnect','stop','restart','then','list','describe','delete','dump'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x1b45,0xb6));var _0x51b4=function(_0x166f3c,_0x5770af){_0x166f3c=_0x166f3c-0x0;var _0x58e68b=_0x1b45[_0x166f3c];return _0x58e68b;};'use strict';var pm2=require(_0x51b4('0x0'));var BPromise=require(_0x51b4('0x1'));var config=require(_0x51b4('0x2'));function connect(){return new BPromise(function(_0xa7f626,_0x2cb14b){return pm2[_0x51b4('0x3')](function(_0x597c93){if(_0x597c93){return _0x2cb14b(_0x597c93);}return _0xa7f626(_0x51b4('0x4'));});});};exports[_0x51b4('0x5')]=function(_0x4e4e6d){return connect()['then'](function(){return new BPromise(function(_0x5a2b20,_0x1891cc){return pm2['start'](_0x4e4e6d,function(_0x4eefc8,_0x1d85fd){if(_0x4eefc8){return _0x1891cc(_0x4eefc8);}pm2[_0x51b4('0x6')]();return _0x5a2b20(_0x1d85fd);});});});};exports[_0x51b4('0x7')]=function(_0x20fc40){return connect()['then'](function(){return new BPromise(function(_0x31559b,_0x2f8196){return pm2[_0x51b4('0x7')](_0x20fc40,function(_0x363daa,_0x32f32b){if(_0x363daa){return _0x2f8196(_0x363daa);}pm2['disconnect']();return _0x31559b(_0x32f32b);});});});};exports[_0x51b4('0x8')]=function(_0x3327e6){return connect()[_0x51b4('0x9')](function(){return new BPromise(function(_0x5223f6,_0x3823bf){return pm2[_0x51b4('0x8')](_0x3327e6,function(_0x46de63,_0x297444){if(_0x46de63){return _0x3823bf(_0x46de63);}pm2['disconnect']();return _0x5223f6(_0x297444);});});});};exports[_0x51b4('0xa')]=function(){return connect()[_0x51b4('0x9')](function(){return new BPromise(function(_0x3bf17d,_0x44092b){return pm2[_0x51b4('0xa')](function(_0x722207,_0x1bf280){if(_0x722207){return _0x44092b(_0x722207);}pm2[_0x51b4('0x6')]();return _0x3bf17d(_0x1bf280);});});});};exports['describe']=function(_0x2342c9){return connect()[_0x51b4('0x9')](function(){return new BPromise(function(_0x5e2aa3,_0x5e1f69){return pm2[_0x51b4('0xb')](_0x2342c9,function(_0x6c205b,_0x23e97a){if(_0x6c205b){return _0x5e1f69(_0x6c205b);}pm2[_0x51b4('0x6')]();return _0x5e2aa3(_0x23e97a);});});});};exports[_0x51b4('0xc')]=function(_0x3b0fb3){return connect()[_0x51b4('0x9')](function(){return new BPromise(function(_0x55e203,_0x3735c8){return pm2[_0x51b4('0xc')](_0x3b0fb3,function(_0x16f3c2,_0x3410e2){if(_0x16f3c2){return _0x3735c8(_0x16f3c2);}pm2[_0x51b4('0x6')]();return _0x55e203(_0x3410e2);});});});};exports[_0x51b4('0xd')]=function(){return connect()[_0x51b4('0x9')](function(){return new BPromise(function(_0x58a4b3,_0x2d3d5e){return pm2[_0x51b4('0xd')](function(_0x906000){if(_0x906000){return _0x2d3d5e(_0x906000);}return _0x58a4b3('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 858f464..e3f4714 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 _0xdb0b=['YYYY-MM-DD\x20HH:mm:ss','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','findAll','lastMsgAt','subtract','minutes','length','map','info','join','ChatInteraction','update','system','timeout','format'];(function(_0xe33068,_0x27d876){var _0x593a19=function(_0x3bf812){while(--_0x3bf812){_0xe33068['push'](_0xe33068['shift']());}};_0x593a19(++_0x27d876);}(_0xdb0b,0x170));var _0xbdb0=function(_0x2c693f,_0x3e073c){_0x2c693f=_0x2c693f-0x0;var _0x1f9bc9=_0xdb0b[_0x2c693f];return _0x1f9bc9;};'use strict';var _=require(_0xbdb0('0x0'));var moment=require(_0xbdb0('0x1'));var Redis=require(_0xbdb0('0x2'));var util=require(_0xbdb0('0x3'));var config=require(_0xbdb0('0x4'));var db=require(_0xbdb0('0x5'))['db'];var logger=require(_0xbdb0('0x6'))('schedule');config[_0xbdb0('0x7')]=_[_0xbdb0('0x8')](config[_0xbdb0('0x7')],{'host':_0xbdb0('0x9'),'port':0x18eb});var io=require(_0xbdb0('0xa'))(new Redis(config['redis']));function closeInteractions(){var _0x11ead8=0x0;var _0x25770a=[];return db[_0xbdb0('0xb')][_0xbdb0('0xc')]({'raw':!![],'attributes':['id',_0xbdb0('0xd')],'where':{'id':0x1}})[_0xbdb0('0xe')](function(_0x92b14a){_0x11ead8=_0x92b14a['chatTimeout'];if(_0x11ead8){return db['ChatInteraction'][_0xbdb0('0xf')]({'raw':!![],'attributes':['id',_0xbdb0('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xbdb0('0x11')](_0x92b14a[_0xbdb0('0xd')],_0xbdb0('0x12'))}}});}else{return[];}})['then'](function(_0x217833){if(_0x217833&&_0x217833[_0xbdb0('0x13')]){_0x25770a=_[_0xbdb0('0x14')](_0x217833||[],'id');logger[_0xbdb0('0x15')]('[CHAT]\x20Interactions\x20to\x20close:',_0x25770a[_0xbdb0('0x16')]());return db[_0xbdb0('0x17')][_0xbdb0('0x18')]({'closeReason':_0xbdb0('0x19'),'disposition':_0xbdb0('0x1a'),'closed':!![],'closedAt':moment()[_0xbdb0('0x1b')](_0xbdb0('0x1c'))},{'where':{'id':_0x25770a}});}})['then'](function(){if(_0x25770a&&_0x25770a['length']){logger[_0xbdb0('0x15')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x25770a[_0xbdb0('0x16')]());for(var _0x370f08=0x0;_0x370f08<_0x25770a[_0xbdb0('0x13')];_0x370f08++){io[_0xbdb0('0x1d')](_0xbdb0('0x1e'),{'id':_0x25770a[_0x370f08],'closed':!![]});}}})[_0xbdb0('0x1f')](function(_0x1dd376){logger[_0xbdb0('0x20')](_0xbdb0('0x21'),_0x1dd376?util[_0xbdb0('0x22')](_0x1dd376,{'showHidden':![],'depth':null}):'');});}exports[_0xbdb0('0x23')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x5c7d=['then','map','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../../config/environment','schedule','defaults','redis','localhost','Setting','find','ChatInteraction','findAll','lastMsgAt','chatTimeout','minutes'];(function(_0xb065e3,_0x2d01cf){var _0x1db262=function(_0x7cc0ad){while(--_0x7cc0ad){_0xb065e3['push'](_0xb065e3['shift']());}};_0x1db262(++_0x2d01cf);}(_0x5c7d,0x91));var _0xd5c7=function(_0x5a324f,_0x2de44c){_0x5a324f=_0x5a324f-0x0;var _0x29f2de=_0x5c7d[_0x5a324f];return _0x29f2de;};'use strict';var _=require('lodash');var moment=require(_0xd5c7('0x0'));var Redis=require(_0xd5c7('0x1'));var util=require(_0xd5c7('0x2'));var config=require(_0xd5c7('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0xd5c7('0x4'));config['redis']=_[_0xd5c7('0x5')](config[_0xd5c7('0x6')],{'host':_0xd5c7('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd5c7('0x6')]));function closeInteractions(){var _0x31ac3f=0x0;var _0x1da6e1=[];return db[_0xd5c7('0x8')][_0xd5c7('0x9')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x3dcd51){_0x31ac3f=_0x3dcd51['chatTimeout'];if(_0x31ac3f){return db[_0xd5c7('0xa')][_0xd5c7('0xb')]({'raw':!![],'attributes':['id',_0xd5c7('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x3dcd51[_0xd5c7('0xd')],_0xd5c7('0xe'))}}});}else{return[];}})[_0xd5c7('0xf')](function(_0x27b731){if(_0x27b731&&_0x27b731['length']){_0x1da6e1=_[_0xd5c7('0x10')](_0x27b731||[],'id');logger['info'](_0xd5c7('0x11'),_0x1da6e1[_0xd5c7('0x12')]());return db[_0xd5c7('0xa')][_0xd5c7('0x13')]({'closeReason':_0xd5c7('0x14'),'disposition':_0xd5c7('0x15'),'closed':!![],'closedAt':moment()[_0xd5c7('0x16')](_0xd5c7('0x17'))},{'where':{'id':_0x1da6e1}});}})[_0xd5c7('0xf')](function(){if(_0x1da6e1&&_0x1da6e1['length']){logger[_0xd5c7('0x18')](_0xd5c7('0x19'),_0x1da6e1[_0xd5c7('0x12')]());for(var _0x577578=0x0;_0x577578<_0x1da6e1['length'];_0x577578++){io[_0xd5c7('0x1a')](_0xd5c7('0x1b'),{'id':_0x1da6e1[_0x577578],'closed':!![]});}}})['catch'](function(_0x25ab19){logger[_0xd5c7('0x1c')](_0xd5c7('0x1d'),_0x25ab19?util[_0xd5c7('0x1e')](_0x25ab19,{'showHidden':![],'depth':null}):'');});}exports[_0xd5c7('0x1f')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 32dd325..069c7f7 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 _0x0816=['../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','info','Try\x20to\x20send\x20a\x20mail\x20to','email','Smtp','service','host','port','secure','MailAccount','auth','user','pass','format','\x22%s\x22\x20<%s>','bcc','name','subtractUnit','join','../../files/reports','savename','%s.%s','basename','zip','status','Sent','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','runReport','then','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','MailServerOut','keys','jobs','map','toString','keyBy','difference','intersection','length','stop','delete\x20cron','toRun','index','my\x20id','run\x20job','cron','startAt','add','start','exists','deleteJob','stop\x20cron','active','isBetween','endAt','update','update\x20cron','run','util','path','lodash','moment','cron-job-manager','bluebird'];(function(_0x51680c,_0xf70653){var _0x32bdda=function(_0x153ab2){while(--_0x153ab2){_0x51680c['push'](_0x51680c['shift']());}};_0x32bdda(++_0xf70653);}(_0x0816,0x1bc));var _0x6081=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x0816[_0x4e7d25];return _0x526fe6;};'use strict';var fs=require('fs');var util=require(_0x6081('0x0'));var path=require(_0x6081('0x1'));var _=require(_0x6081('0x2'));var moment=require(_0x6081('0x3'));var CronJobManager=require(_0x6081('0x4'));var jayson=require('jayson/promise');var BPromise=require(_0x6081('0x5'));var logger=require(_0x6081('0x6'))(_0x6081('0x7'));var db=require(_0x6081('0x8'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x6081('0x9'));var client=jayson['client']['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5036c1,_0x5cd291){return function(){logger[_0x6081('0xa')](_0x6081('0xb'),_0x5036c1[_0x6081('0xc')]);var _0x2c2f86=!![];var _0x4179c3={'tls':{'rejectUnauthorized':![]}};if(_0x5036c1['MailAccount'][_0x6081('0xd')]['service']){_0x4179c3[_0x6081('0xe')]=_0x5036c1['MailAccount'][_0x6081('0xd')][_0x6081('0xe')];}else{_0x4179c3[_0x6081('0xf')]=_0x5036c1['MailAccount'][_0x6081('0xd')][_0x6081('0xf')];_0x4179c3[_0x6081('0x10')]=_0x5036c1['MailAccount']['Smtp'][_0x6081('0x10')];_0x4179c3[_0x6081('0x11')]=_0x5036c1[_0x6081('0x12')]['Smtp'][_0x6081('0x11')];}if(_0x5036c1[_0x6081('0x12')][_0x6081('0xd')]['authentication']){_0x4179c3[_0x6081('0x13')]={'user':_0x5036c1[_0x6081('0x12')][_0x6081('0xd')][_0x6081('0x14')],'pass':_0x5036c1['MailAccount'][_0x6081('0xd')][_0x6081('0x15')]};}var _0x511cf4={'account':_0x4179c3,'message':{'from':util[_0x6081('0x16')](_0x6081('0x17'),_0x5036c1[_0x6081('0x12')]['name'],_0x5036c1[_0x6081('0x12')][_0x6081('0xc')]||_0x5036c1[_0x6081('0x12')][_0x6081('0xd')][_0x6081('0x14')]),'to':_0x5036c1[_0x6081('0xc')],'cc':_0x5036c1['cc'],'bcc':_0x5036c1[_0x6081('0x18')],'subject':util[_0x6081('0x16')]('Report\x20%s\x20last\x20%s\x20%s',_0x5cd291[_0x6081('0x19')],_0x5036c1['subtractNumber'],_0x5036c1[_0x6081('0x1a')])}};var _0x187a4a=path[_0x6081('0x1b')](__dirname,_0x6081('0x1c'));var _0x563176=_0x5cd291[_0x6081('0x1d')];var _0x5b79bf=util[_0x6081('0x16')](_0x6081('0x1e'),path[_0x6081('0x1f')](_0x5cd291[_0x6081('0x1d')],path['extname'](_0x5cd291[_0x6081('0x1d')])),_0x6081('0x20'));var _0x56fbe1=path[_0x6081('0x1b')](_0x187a4a,_0x563176);var _0x38f7c3=path['join'](_0x187a4a,_0x5b79bf);if(fs['existsSync'](_0x56fbe1)){_0x5cd291[_0x6081('0x21')]=_0x6081('0x22');_0x511cf4[_0x6081('0x23')][_0x6081('0x24')]=[{'filename':_0x563176,'path':_0x56fbe1}];_0x511cf4[_0x6081('0x23')]['text']=util[_0x6081('0x16')](_0x6081('0x25'),JSON[_0x6081('0x26')](_0x5cd291,null,0x2));}else if(fs[_0x6081('0x27')](_0x38f7c3)){_0x5cd291['status']=_0x6081('0x22');_0x511cf4[_0x6081('0x23')][_0x6081('0x24')]=[{'filename':_0x5b79bf,'path':_0x38f7c3}];}else{_0x511cf4[_0x6081('0x23')][_0x6081('0x28')]=_0x6081('0x29');if(!_0x5036c1['sendIfEmpty']){_0x2c2f86=![];logger[_0x6081('0xa')](_0x6081('0x2a'));}}if(_0x2c2f86){return client[_0x6081('0x2b')]('SendMail',_0x511cf4)['then'](function(_0x39ef23){if(_0x39ef23[_0x6081('0x2c')]){return logger[_0x6081('0x2c')](_0x6081('0x2d'),JSON[_0x6081('0x26')](_0x39ef23));}return logger[_0x6081('0xa')](_0x6081('0x2e'));})[_0x6081('0x2f')](function(_0x45189e){return logger[_0x6081('0x2c')](_0x6081('0x2d'),JSON[_0x6081('0x26')](_0x45189e));});}};}function handleError(){return function(_0x1422cc){return logger[_0x6081('0x2c')](JSON[_0x6081('0x26')](_0x1422cc));};}function handleResult(_0x2c71da){return function(_0x365a6d){logger[_0x6081('0xa')](_0x6081('0x30'),JSON[_0x6081('0x26')](_0x365a6d));if(_0x2c71da[_0x6081('0x12')]&&_0x2c71da['MailAccount'][_0x6081('0xd')]&&!_[_0x6081('0x31')](_0x2c71da['email'])){setTimeout(handleSendEmail(_0x2c71da,_0x365a6d),0x3c*0x3e8);}};}function handleJob(_0x546e18){return function(){try{if(_[_0x6081('0x31')](_0x546e18[_0x6081('0x32')])){return logger[_0x6081('0xa')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x6081('0x31')](_0x546e18['subtractUnit'])){return logger[_0x6081('0xa')](_0x6081('0x33'));}var _0x32e5c0={'startDate':moment()[_0x6081('0x34')](_0x546e18[_0x6081('0x32')],_0x546e18[_0x6081('0x1a')])[_0x6081('0x16')](_0x6081('0x35')),'endDate':moment()[_0x6081('0x16')](_0x6081('0x35')),'type':'scheduled','output':_0x546e18[_0x6081('0x36')],'name':_0x546e18[_0x6081('0x19')]};if(!_[_0x6081('0x31')](_0x546e18[_0x6081('0x37')])){logger[_0x6081('0xa')]('exec\x20defaul\x20report\x20id:%s',_0x546e18['DefaultReportId']);return analyticDefaultReportController[_0x6081('0x38')]({'id':_0x546e18[_0x6081('0x37')]},_0x32e5c0)[_0x6081('0x39')](handleResult(_0x546e18))[_0x6081('0x2f')](handleError());}if(!_['isNil'](_0x546e18['CustomReportId'])){logger['info'](_0x6081('0x3a'),_0x546e18['CustomReportId']);return analyticCustomReportController[_0x6081('0x38')]({'id':_0x546e18[_0x6081('0x3b')]},_0x32e5c0)[_0x6081('0x39')](handleResult(_0x546e18))['catch'](handleError());}}catch(_0xd0028){logger[_0x6081('0x2c')](JSON[_0x6081('0x26')](_0xd0028));}return logger[_0x6081('0xa')](_0x6081('0x3c'));};}function getJobs(_0x4ff0fe){var _0x3768ae={};if(_0x4ff0fe){_0x3768ae['id']=_0x4ff0fe;}return db[_0x6081('0x3d')]['findAll']({'where':_0x3768ae,'include':[{'model':db[_0x6081('0x12')],'attributes':['id','name',_0x6081('0xc')],'include':[{'model':db[_0x6081('0x3e')],'as':_0x6081('0xd')}]}]})[_0x6081('0x39')](function(_0x5413cb){var _0x5049c1=_[_0x6081('0x3f')](manager[_0x6081('0x40')]);var _0x11952c=_[_0x6081('0x41')](_0x5413cb,function(_0x46451c){return _0x46451c['id'][_0x6081('0x42')]();});var _0x1c38cb=_[_0x6081('0x43')](_0x5413cb,function(_0x571a08){return _0x571a08['id'][_0x6081('0x42')]();});var _0x21f8c3=_0x4ff0fe?_0x11952c:_[_0x6081('0x44')](_0x11952c,_0x5049c1);var _0xc765ca=_[_0x6081('0x45')](_0x11952c,_0x5049c1);var _0x5eb450=_[_0x6081('0x44')](_0x5049c1,_0x11952c);var _0x118905;var _0x2b9abe;for(_0x118905=0x0;_0x118905<_0x5eb450[_0x6081('0x46')]&&!_0x4ff0fe;_0x118905+=0x1){_0x2b9abe=_0x5eb450[_0x118905]['toString']();if(manager['exists'](_0x2b9abe)){manager[_0x6081('0x47')](_0x2b9abe);manager['deleteJob'](_0x2b9abe);logger[_0x6081('0xa')](_0x6081('0x48'),_0x2b9abe);}}logger[_0x6081('0xa')](_0x6081('0x49'),JSON[_0x6081('0x26')](_0x21f8c3));for(_0x118905=0x0;_0x118905<_0x21f8c3[_0x6081('0x46')];_0x118905+=0x1){_0x2b9abe=_0x21f8c3[_0x118905][_0x6081('0x42')]();logger[_0x6081('0xa')](_0x6081('0x4a'),_0x2b9abe);if(_0x4ff0fe){logger['info'](_0x6081('0x4b'),_0x4ff0fe);logger['info'](JSON[_0x6081('0x26')](_0x1c38cb[_0x2b9abe]));BPromise['resolve']()[_0x6081('0x39')](handleJob(_0x1c38cb[_0x2b9abe]));logger['info'](_0x6081('0x4c'),_0x1c38cb[_0x2b9abe][_0x6081('0x19')],_0x1c38cb[_0x2b9abe][_0x6081('0x4d')]);}else if(_0x1c38cb[_0x2b9abe][_0x6081('0x4d')]&&_0x1c38cb[_0x2b9abe]['active']&&moment()['isBetween'](_0x1c38cb[_0x2b9abe][_0x6081('0x4e')],_0x1c38cb[_0x2b9abe]['endAt'])){manager[_0x6081('0x4f')](_0x2b9abe,_0x1c38cb[_0x2b9abe]['cron'],handleJob(_0x1c38cb[_0x2b9abe]));manager[_0x6081('0x50')](_0x2b9abe);logger[_0x6081('0xa')]('add\x20cron',_0x1c38cb[_0x2b9abe][_0x6081('0x19')],_0x1c38cb[_0x2b9abe][_0x6081('0x4d')]);}else if(manager[_0x6081('0x51')](_0x2b9abe)){manager['stop'](_0x2b9abe);manager[_0x6081('0x52')](_0x2b9abe);logger[_0x6081('0xa')](_0x6081('0x53'),_0x1c38cb[_0x2b9abe][_0x6081('0x19')],_0x1c38cb[_0x2b9abe][_0x6081('0x4d')]);}}for(_0x118905=0x0,_0x2b9abe;_0x118905<_0xc765ca[_0x6081('0x46')]&&!_0x4ff0fe;_0x118905+=0x1){_0x2b9abe=_0xc765ca[_0x118905][_0x6081('0x42')]();if(manager[_0x6081('0x51')](_0x2b9abe)){if(_0x1c38cb[_0x2b9abe]['cron']&&_0x1c38cb[_0x2b9abe][_0x6081('0x54')]&&moment()[_0x6081('0x55')](_0x1c38cb[_0x2b9abe][_0x6081('0x4e')],_0x1c38cb[_0x2b9abe][_0x6081('0x56')])){manager[_0x6081('0x57')](_0x2b9abe,_0x1c38cb[_0x2b9abe][_0x6081('0x4d')],handleJob(_0x1c38cb[_0x2b9abe]));logger['info'](_0x6081('0x58'),_0x1c38cb[_0x2b9abe][_0x6081('0x19')],_0x1c38cb[_0x2b9abe][_0x6081('0x4d')]);}else{manager[_0x6081('0x47')](_0x2b9abe);manager[_0x6081('0x52')](_0x2b9abe);logger[_0x6081('0xa')](_0x6081('0x53'),_0x1c38cb[_0x2b9abe][_0x6081('0x19')],_0x1c38cb[_0x2b9abe]['cron']);}}}})[_0x6081('0x2f')](function(_0x599497){logger[_0x6081('0x2c')](JSON[_0x6081('0x26')](_0x599497));});}exports[_0x6081('0x59')]=function(_0x382840){return getJobs(_0x382840);};exports[_0x6081('0x50')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xae29=['bcc','format','Report\x20%s\x20last\x20%s\x20%s','join','../../files/reports','savename','%s.%s','basename','extname','zip','status','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','sendIfEmpty','request','SendMail','then','error','error\x20mail','email\x20sent','data','isNil','subtractNumber','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','catch','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','map','keyBy','toString','difference','intersection','length','exists','toRun','index','my\x20id','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','stop','deleteJob','stop\x20cron','update','update\x20cron','run','util','path','lodash','moment','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','user','name'];(function(_0x15af84,_0x7a5b4d){var _0x5ac0a4=function(_0x97cb67){while(--_0x97cb67){_0x15af84['push'](_0x15af84['shift']());}};_0x5ac0a4(++_0x7a5b4d);}(_0xae29,0xa3));var _0x9ae2=function(_0x5de064,_0x2dbae2){_0x5de064=_0x5de064-0x0;var _0x56cdf8=_0xae29[_0x5de064];return _0x56cdf8;};'use strict';var fs=require('fs');var util=require(_0x9ae2('0x0'));var path=require(_0x9ae2('0x1'));var _=require(_0x9ae2('0x2'));var moment=require(_0x9ae2('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x9ae2('0x4'));var BPromise=require(_0x9ae2('0x5'));var logger=require(_0x9ae2('0x6'))(_0x9ae2('0x7'));var db=require(_0x9ae2('0x8'))['db'];var analyticCustomReportController=require(_0x9ae2('0x9'));var analyticDefaultReportController=require(_0x9ae2('0xa'));var client=jayson[_0x9ae2('0xb')][_0x9ae2('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x44b930,_0xf5e235){return function(){logger[_0x9ae2('0xd')](_0x9ae2('0xe'),_0x44b930[_0x9ae2('0xf')]);var _0x1fc1b8=!![];var _0x2cdb82={'tls':{'rejectUnauthorized':![]}};if(_0x44b930[_0x9ae2('0x10')][_0x9ae2('0x11')]['service']){_0x2cdb82[_0x9ae2('0x12')]=_0x44b930[_0x9ae2('0x10')][_0x9ae2('0x11')][_0x9ae2('0x12')];}else{_0x2cdb82[_0x9ae2('0x13')]=_0x44b930['MailAccount'][_0x9ae2('0x11')][_0x9ae2('0x13')];_0x2cdb82[_0x9ae2('0x14')]=_0x44b930[_0x9ae2('0x10')][_0x9ae2('0x11')]['port'];_0x2cdb82[_0x9ae2('0x15')]=_0x44b930[_0x9ae2('0x10')][_0x9ae2('0x11')]['secure'];}if(_0x44b930[_0x9ae2('0x10')][_0x9ae2('0x11')][_0x9ae2('0x16')]){_0x2cdb82['auth']={'user':_0x44b930['MailAccount']['Smtp'][_0x9ae2('0x17')],'pass':_0x44b930['MailAccount']['Smtp']['pass']};}var _0xbad806={'account':_0x2cdb82,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x44b930[_0x9ae2('0x10')][_0x9ae2('0x18')],_0x44b930['MailAccount'][_0x9ae2('0xf')]||_0x44b930[_0x9ae2('0x10')][_0x9ae2('0x11')]['user']),'to':_0x44b930[_0x9ae2('0xf')],'cc':_0x44b930['cc'],'bcc':_0x44b930[_0x9ae2('0x19')],'subject':util[_0x9ae2('0x1a')](_0x9ae2('0x1b'),_0xf5e235['name'],_0x44b930['subtractNumber'],_0x44b930['subtractUnit'])}};var _0x2c81f6=path[_0x9ae2('0x1c')](__dirname,_0x9ae2('0x1d'));var _0x5cb885=_0xf5e235[_0x9ae2('0x1e')];var _0x231e42=util[_0x9ae2('0x1a')](_0x9ae2('0x1f'),path[_0x9ae2('0x20')](_0xf5e235[_0x9ae2('0x1e')],path[_0x9ae2('0x21')](_0xf5e235[_0x9ae2('0x1e')])),_0x9ae2('0x22'));var _0x39223e=path['join'](_0x2c81f6,_0x5cb885);var _0x112618=path['join'](_0x2c81f6,_0x231e42);if(fs['existsSync'](_0x39223e)){_0xf5e235[_0x9ae2('0x23')]='Sent';_0xbad806[_0x9ae2('0x24')][_0x9ae2('0x25')]=[{'filename':_0x5cb885,'path':_0x39223e}];_0xbad806['message'][_0x9ae2('0x26')]=util[_0x9ae2('0x1a')](_0x9ae2('0x27'),JSON[_0x9ae2('0x28')](_0xf5e235,null,0x2));}else if(fs[_0x9ae2('0x29')](_0x112618)){_0xf5e235[_0x9ae2('0x23')]='Sent';_0xbad806[_0x9ae2('0x24')][_0x9ae2('0x25')]=[{'filename':_0x231e42,'path':_0x112618}];}else{_0xbad806[_0x9ae2('0x24')]['text']='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x44b930[_0x9ae2('0x2a')]){_0x1fc1b8=![];logger[_0x9ae2('0xd')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x1fc1b8){return client[_0x9ae2('0x2b')](_0x9ae2('0x2c'),_0xbad806)[_0x9ae2('0x2d')](function(_0x5a2209){if(_0x5a2209[_0x9ae2('0x2e')]){return logger[_0x9ae2('0x2e')](_0x9ae2('0x2f'),JSON[_0x9ae2('0x28')](_0x5a2209));}return logger[_0x9ae2('0xd')](_0x9ae2('0x30'));})['catch'](function(_0xe51874){return logger[_0x9ae2('0x2e')](_0x9ae2('0x2f'),JSON[_0x9ae2('0x28')](_0xe51874));});}};}function handleError(){return function(_0x27e71a){return logger[_0x9ae2('0x2e')](JSON[_0x9ae2('0x28')](_0x27e71a));};}function handleResult(_0x1ea449){return function(_0xc9f6e2){logger[_0x9ae2('0xd')](_0x9ae2('0x31'),JSON['stringify'](_0xc9f6e2));if(_0x1ea449[_0x9ae2('0x10')]&&_0x1ea449[_0x9ae2('0x10')][_0x9ae2('0x11')]&&!_[_0x9ae2('0x32')](_0x1ea449['email'])){setTimeout(handleSendEmail(_0x1ea449,_0xc9f6e2),0x3c*0x3e8);}};}function handleJob(_0x3dffb9){return function(){try{if(_[_0x9ae2('0x32')](_0x3dffb9[_0x9ae2('0x33')])){return logger[_0x9ae2('0xd')]('subtractNumber\x20null\x20or\x20undefined');}if(_['isNil'](_0x3dffb9[_0x9ae2('0x34')])){return logger[_0x9ae2('0xd')](_0x9ae2('0x35'));}var _0xa4c6e8={'startDate':moment()[_0x9ae2('0x36')](_0x3dffb9[_0x9ae2('0x33')],_0x3dffb9[_0x9ae2('0x34')])[_0x9ae2('0x1a')](_0x9ae2('0x37')),'endDate':moment()['format'](_0x9ae2('0x37')),'type':_0x9ae2('0x38'),'output':_0x3dffb9[_0x9ae2('0x39')],'name':_0x3dffb9[_0x9ae2('0x18')]};if(!_['isNil'](_0x3dffb9[_0x9ae2('0x3a')])){logger[_0x9ae2('0xd')](_0x9ae2('0x3b'),_0x3dffb9['DefaultReportId']);return analyticDefaultReportController[_0x9ae2('0x3c')]({'id':_0x3dffb9['DefaultReportId']},_0xa4c6e8)[_0x9ae2('0x2d')](handleResult(_0x3dffb9))['catch'](handleError());}if(!_[_0x9ae2('0x32')](_0x3dffb9[_0x9ae2('0x3d')])){logger[_0x9ae2('0xd')](_0x9ae2('0x3e'),_0x3dffb9[_0x9ae2('0x3d')]);return analyticCustomReportController[_0x9ae2('0x3c')]({'id':_0x3dffb9[_0x9ae2('0x3d')]},_0xa4c6e8)[_0x9ae2('0x2d')](handleResult(_0x3dffb9))[_0x9ae2('0x3f')](handleError());}}catch(_0x5d444b){logger['error'](JSON[_0x9ae2('0x28')](_0x5d444b));}return logger[_0x9ae2('0xd')](_0x9ae2('0x40'));};}function getJobs(_0x4c2d90){var _0x1e6d02={};if(_0x4c2d90){_0x1e6d02['id']=_0x4c2d90;}return db[_0x9ae2('0x41')][_0x9ae2('0x42')]({'where':_0x1e6d02,'include':[{'model':db[_0x9ae2('0x10')],'attributes':['id',_0x9ae2('0x18'),_0x9ae2('0xf')],'include':[{'model':db[_0x9ae2('0x43')],'as':_0x9ae2('0x11')}]}]})[_0x9ae2('0x2d')](function(_0x14029e){var _0x40d004=_[_0x9ae2('0x44')](manager[_0x9ae2('0x45')]);var _0x210657=_[_0x9ae2('0x46')](_0x14029e,function(_0x14ce94){return _0x14ce94['id']['toString']();});var _0x37ef7b=_[_0x9ae2('0x47')](_0x14029e,function(_0x59ea7c){return _0x59ea7c['id'][_0x9ae2('0x48')]();});var _0x194c96=_0x4c2d90?_0x210657:_[_0x9ae2('0x49')](_0x210657,_0x40d004);var _0x36e23c=_[_0x9ae2('0x4a')](_0x210657,_0x40d004);var _0xefa339=_[_0x9ae2('0x49')](_0x40d004,_0x210657);var _0x179ca7;var _0x5bc334;for(_0x179ca7=0x0;_0x179ca7<_0xefa339[_0x9ae2('0x4b')]&&!_0x4c2d90;_0x179ca7+=0x1){_0x5bc334=_0xefa339[_0x179ca7][_0x9ae2('0x48')]();if(manager[_0x9ae2('0x4c')](_0x5bc334)){manager['stop'](_0x5bc334);manager['deleteJob'](_0x5bc334);logger[_0x9ae2('0xd')]('delete\x20cron',_0x5bc334);}}logger[_0x9ae2('0xd')](_0x9ae2('0x4d'),JSON[_0x9ae2('0x28')](_0x194c96));for(_0x179ca7=0x0;_0x179ca7<_0x194c96[_0x9ae2('0x4b')];_0x179ca7+=0x1){_0x5bc334=_0x194c96[_0x179ca7]['toString']();logger[_0x9ae2('0xd')](_0x9ae2('0x4e'),_0x5bc334);if(_0x4c2d90){logger[_0x9ae2('0xd')](_0x9ae2('0x4f'),_0x4c2d90);logger[_0x9ae2('0xd')](JSON['stringify'](_0x37ef7b[_0x5bc334]));BPromise['resolve']()[_0x9ae2('0x2d')](handleJob(_0x37ef7b[_0x5bc334]));logger[_0x9ae2('0xd')]('run\x20job',_0x37ef7b[_0x5bc334][_0x9ae2('0x18')],_0x37ef7b[_0x5bc334][_0x9ae2('0x50')]);}else if(_0x37ef7b[_0x5bc334][_0x9ae2('0x50')]&&_0x37ef7b[_0x5bc334][_0x9ae2('0x51')]&&moment()[_0x9ae2('0x52')](_0x37ef7b[_0x5bc334][_0x9ae2('0x53')],_0x37ef7b[_0x5bc334][_0x9ae2('0x54')])){manager[_0x9ae2('0x55')](_0x5bc334,_0x37ef7b[_0x5bc334]['cron'],handleJob(_0x37ef7b[_0x5bc334]));manager[_0x9ae2('0x56')](_0x5bc334);logger[_0x9ae2('0xd')](_0x9ae2('0x57'),_0x37ef7b[_0x5bc334][_0x9ae2('0x18')],_0x37ef7b[_0x5bc334]['cron']);}else if(manager['exists'](_0x5bc334)){manager[_0x9ae2('0x58')](_0x5bc334);manager[_0x9ae2('0x59')](_0x5bc334);logger[_0x9ae2('0xd')](_0x9ae2('0x5a'),_0x37ef7b[_0x5bc334][_0x9ae2('0x18')],_0x37ef7b[_0x5bc334]['cron']);}}for(_0x179ca7=0x0,_0x5bc334;_0x179ca7<_0x36e23c[_0x9ae2('0x4b')]&&!_0x4c2d90;_0x179ca7+=0x1){_0x5bc334=_0x36e23c[_0x179ca7][_0x9ae2('0x48')]();if(manager[_0x9ae2('0x4c')](_0x5bc334)){if(_0x37ef7b[_0x5bc334][_0x9ae2('0x50')]&&_0x37ef7b[_0x5bc334][_0x9ae2('0x51')]&&moment()[_0x9ae2('0x52')](_0x37ef7b[_0x5bc334][_0x9ae2('0x53')],_0x37ef7b[_0x5bc334][_0x9ae2('0x54')])){manager[_0x9ae2('0x5b')](_0x5bc334,_0x37ef7b[_0x5bc334][_0x9ae2('0x50')],handleJob(_0x37ef7b[_0x5bc334]));logger[_0x9ae2('0xd')](_0x9ae2('0x5c'),_0x37ef7b[_0x5bc334][_0x9ae2('0x18')],_0x37ef7b[_0x5bc334][_0x9ae2('0x50')]);}else{manager['stop'](_0x5bc334);manager['deleteJob'](_0x5bc334);logger[_0x9ae2('0xd')]('stop\x20cron',_0x37ef7b[_0x5bc334][_0x9ae2('0x18')],_0x37ef7b[_0x5bc334][_0x9ae2('0x50')]);}}}})['catch'](function(_0x869f70){logger[_0x9ae2('0x2e')](JSON[_0x9ae2('0x28')](_0x869f70));});}exports[_0x9ae2('0x5d')]=function(_0x512afb){return getJobs(_0x512afb);};exports['start']=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 4ef09e0..9f99f49 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 _0x0664=['transcribeRegion','forEach','all','error','start','aws-sdk','util','bluebird','../../config/logger','transcribe','TranscribeService','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','then','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','bucket','findOne','Cloud\x20Provider\x20not\x20available','Positive','Neutral','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId'];(function(_0x496e6b,_0x21f95a){var _0x3f40fc=function(_0x2bb05c){while(--_0x2bb05c){_0x496e6b['push'](_0x496e6b['shift']());}};_0x3f40fc(++_0x21f95a);}(_0x0664,0x93));var _0x4066=function(_0x5de574,_0x222336){_0x5de574=_0x5de574-0x0;var _0x50415d=_0x0664[_0x5de574];return _0x50415d;};var _=require('lodash');var AWS=require(_0x4066('0x0'));var rp=require('request-promise');var util=require(_0x4066('0x1'));var BPromise=require(_0x4066('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x4066('0x3'))(_0x4066('0x4'));function getTranscriptionJob(_0x1479a6,_0x43d301,_0x362a79,_0x325e0e){return new Promise(function(_0x2febd3,_0x1e2bf0){var _0x143de5=new AWS[(_0x4066('0x5'))]({'accessKeyId':_0x43d301,'secretAccessKey':_0x1479a6,'region':_0x362a79});_0x143de5['getTranscriptionJob']({'TranscriptionJobName':_0x325e0e},function(_0x383df4,_0x5d360d){if(_0x383df4){return _0x1e2bf0(_0x383df4);}else{return _0x2febd3(_0x5d360d);}});});}function sentiment(_0x29a147,_0x2db4e6,_0x48333f,_0x5f3d44,_0x1da4d8){return new Promise(function(_0x3ea971,_0x16a1f7){var _0x41ad8b=new AWS['Comprehend']({'accessKeyId':_0x2db4e6,'secretAccessKey':_0x29a147,'region':_0x48333f});_0x41ad8b['detectSentiment']({'Text':_0x5f3d44,'LanguageCode':_0x1da4d8['substring'](0x0,0x2)},function(_0x4cbeb6,_0x2bac58){if(_0x4cbeb6){return _0x16a1f7(_0x4cbeb6);}else{return _0x3ea971(_0x2bac58);}});});}function checkTranscribeJob(_0x1b1712,_0x10c353,_0x12d36c){var _0x425456;return new BPromise(function(_0x3a0cf2,_0x38c65d){logger[_0x4066('0x6')](util['format'](_0x4066('0x7'),_0x1b1712['id'],_0x1b1712[_0x4066('0x8')]));return getTranscriptionJob(_0x12d36c['data1'],_0x12d36c[_0x4066('0x9')],_0x10c353['transcribeRegion'],_0x1b1712[_0x4066('0x8')])['then'](function(_0x50f71d){logger[_0x4066('0x6')](util[_0x4066('0xa')](_0x4066('0xb'),_0x1b1712['id'],_0x1b1712[_0x4066('0x8')],_0x50f71d[_0x4066('0xc')][_0x4066('0xd')]));if(!_0x1b1712[_0x4066('0xe')]){switch(_0x50f71d[_0x4066('0xc')][_0x4066('0xd')]){case _0x4066('0xf'):var _0x511cfa={'transcribeStatus':_0x50f71d['TranscriptionJob'][_0x4066('0xd')],'fileUri':_0x50f71d[_0x4066('0xc')]['Transcript'][_0x4066('0x10')]};logger[_0x4066('0x6')](util[_0x4066('0xa')](_0x4066('0x11'),_0x1b1712['id']));return rp({'uri':_0x50f71d[_0x4066('0xc')][_0x4066('0x12')]['TranscriptFileUri'],'json':!![]})['then'](function(_0x541306){logger['info'](util[_0x4066('0xa')](_0x4066('0x13'),_0x1b1712['id']));if(_0x541306&&_0x541306[_0x4066('0x14')]&&_0x541306[_0x4066('0x14')][_0x4066('0x15')]&&_0x541306['results'][_0x4066('0x15')][_0x4066('0x16')]){_0x511cfa[_0x4066('0xe')]='';for(var _0x2598c6=0x0;_0x2598c6<_0x541306[_0x4066('0x14')]['transcripts']['length'];_0x2598c6++){_0x511cfa[_0x4066('0xe')]+=_0x541306[_0x4066('0x14')][_0x4066('0x15')][_0x2598c6][_0x4066('0x17')]+'';}}return _0x1b1712[_0x4066('0x18')](_0x511cfa);})[_0x4066('0x19')](function(){logger[_0x4066('0x6')](util[_0x4066('0xa')](_0x4066('0x1a'),_0x1b1712['id']));if(!_0x1b1712[_0x4066('0x1b')]){throw new db[(_0x4066('0x1c'))][(_0x4066('0x1d'))](_0x4066('0x1e'));}if(!_0x10c353[_0x4066('0x1f')]||!_0x10c353[_0x4066('0x20')]||!_0x10c353['sentimentRegion']||!_0x10c353[_0x4066('0x21')]||!_0x10c353['bucket']){throw new db['Sequelize']['ValidationError'](_0x4066('0x22'));}if(!_0x511cfa['fileText']){throw new Error(_0x4066('0x23'));}if(_0x10c353[_0x4066('0x20')]===_0x12d36c['id']){return _0x12d36c;}else{return db[_0x4066('0x24')]['findOne']({'where':{'id':_settings[_0x4066('0x20')]}});}})['then'](function(_0x2468f0){if(!_0x2468f0){throw new db[(_0x4066('0x1c'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x2468f0[_0x4066('0x25')]||!_0x2468f0[_0x4066('0x9')]){throw new db['Sequelize'][(_0x4066('0x1d'))](_0x4066('0x26'));}_0x425456=_0x2468f0;logger[_0x4066('0x6')](util['format'](_0x4066('0x27'),_0x1b1712['id']));return sentiment(_0x425456['data1'],_0x425456[_0x4066('0x9')],_0x10c353[_0x4066('0x28')],_0x511cfa[_0x4066('0xe')],_0x10c353[_0x4066('0x21')]);})[_0x4066('0x19')](function(_0x255fd0){logger[_0x4066('0x6')](util[_0x4066('0xa')](_0x4066('0x29'),_0x1b1712['id']));return _0x1b1712[_0x4066('0x18')]({'sentiment':_0x255fd0[_0x4066('0x2a')],'sPositive':_0x255fd0[_0x4066('0x2b')]['Positive'],'sNegative':_0x255fd0[_0x4066('0x2b')][_0x4066('0x2c')],'sMixed':_0x255fd0['SentimentScore'][_0x4066('0x2d')],'sNeutral':_0x255fd0[_0x4066('0x2b')]['Neutral']});})[_0x4066('0x19')](function(){logger[_0x4066('0x6')](util[_0x4066('0xa')](_0x4066('0x1a'),_0x1b1712['id']));_0x3a0cf2();});case _0x4066('0x2e'):return _0x1b1712[_0x4066('0x18')]({'transcribeStatus':_0x4066('0x2e'),'failureReason':_0x50f71d[_0x4066('0xc')][_0x4066('0x2f')]})['then'](function(){logger[_0x4066('0x6')](util[_0x4066('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x1b1712['id']));_0x3a0cf2();});default:logger[_0x4066('0x6')](util[_0x4066('0xa')](_0x4066('0x30'),_0x1b1712['id']));break;}}else{return BPromise['resolve']()[_0x4066('0x19')](function(){if(!_0x1b1712[_0x4066('0x1b')]){throw new db[(_0x4066('0x1c'))][(_0x4066('0x1d'))](_0x4066('0x1e'));}if(!_0x10c353[_0x4066('0x1f')]||!_0x10c353[_0x4066('0x20')]||!_0x10c353['sentimentRegion']||!_0x10c353[_0x4066('0x21')]||!_0x10c353[_0x4066('0x31')]){throw new db[(_0x4066('0x1c'))][(_0x4066('0x1d'))](_0x4066('0x22'));}if(!_0x1b1712['fileText']){throw new Error(_0x4066('0x23'));}if(_0x10c353[_0x4066('0x20')]===_0x12d36c['id']){return _0x12d36c;}else{return db['CloudProvider'][_0x4066('0x32')]({'where':{'id':_settings[_0x4066('0x20')]}});}})[_0x4066('0x19')](function(_0x1c3abb){if(!_0x1c3abb){throw new db[(_0x4066('0x1c'))]['ValidationError'](_0x4066('0x33'));}if(!_0x1c3abb[_0x4066('0x25')]||!_0x1c3abb['data2']){throw new db[(_0x4066('0x1c'))][(_0x4066('0x1d'))](_0x4066('0x26'));}_0x425456=_0x1c3abb;logger[_0x4066('0x6')](util[_0x4066('0xa')](_0x4066('0x27'),_0x1b1712['id']));return sentiment(_0x425456[_0x4066('0x25')],_0x425456['data2'],_0x10c353[_0x4066('0x28')],_0x1b1712[_0x4066('0xe')],_0x10c353[_0x4066('0x21')]);})[_0x4066('0x19')](function(_0x1c99a8){logger[_0x4066('0x6')](util['format'](_0x4066('0x29'),_0x1b1712['id']));return _0x1b1712['update']({'sentiment':_0x1c99a8[_0x4066('0x2a')],'sPositive':_0x1c99a8['SentimentScore'][_0x4066('0x34')],'sNegative':_0x1c99a8[_0x4066('0x2b')][_0x4066('0x2c')],'sMixed':_0x1c99a8[_0x4066('0x2b')]['Mixed'],'sNeutral':_0x1c99a8[_0x4066('0x2b')][_0x4066('0x35')],'transcribeStatus':'COMPLETED'});})[_0x4066('0x19')](function(){logger['info'](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x1b1712['id']));_0x3a0cf2();});}})[_0x4066('0x36')](function(_0x3e7c11){if(_0x3e7c11){if(!_0x3e7c11[_0x4066('0x37')]||_0x3e7c11[_0x4066('0x37')]!==_0x4066('0x38')){logger['error'](util[_0x4066('0xa')](_0x4066('0x39'),_0x1b1712['id']),util[_0x4066('0x3a')](_0x3e7c11,{'showHidden':![],'depth':null}));}}_0x3a0cf2();});});}function checkTranscribe(){var _0x2dcad0;var _0x218d51;var _0x523396;return db[_0x4066('0x3b')][_0x4066('0x3c')]({'where':{'transcribeStatus':_0x4066('0x3d')}})[_0x4066('0x19')](function(_0x269ff0){if(!_0x269ff0||!_0x269ff0[_0x4066('0x16')]){throw new db[(_0x4066('0x1c'))]['ValidationError'](_0x4066('0x3e'));}_0x2dcad0=_0x269ff0;return db[_0x4066('0x3f')][_0x4066('0x32')]({'where':{'id':0x1}});})[_0x4066('0x19')](function(_0x3bfea2){if(!_0x3bfea2){throw new db['Sequelize'][(_0x4066('0x1d'))](_0x4066('0x40'));}_0x218d51=_0x3bfea2;if(!_0x218d51['transcribe']||!_0x218d51[_0x4066('0x41')]||!_0x218d51[_0x4066('0x42')]||!_0x218d51[_0x4066('0x21')]||!_0x218d51[_0x4066('0x31')]){throw new db[(_0x4066('0x1c'))][(_0x4066('0x1d'))]('Transcribe\x20not\x20configured');}return db[_0x4066('0x24')][_0x4066('0x32')]({'where':{'id':_0x218d51[_0x4066('0x41')]}});})['then'](function(_0xe0f43c){if(!_0xe0f43c){throw new db['Sequelize'][(_0x4066('0x1d'))](_0x4066('0x33'));}if(!_0xe0f43c['data1']||!_0xe0f43c['data2']){throw new db['Sequelize'][(_0x4066('0x1d'))](_0x4066('0x26'));}_0x523396=_0xe0f43c;var _0x1db0be=[];_0x2dcad0[_0x4066('0x43')](function(_0x4e677c){_0x1db0be['push'](checkTranscribeJob(_0x4e677c,_0x218d51,_0x523396));});return BPromise[_0x4066('0x44')](_0x1db0be);})[_0x4066('0x36')](function(_0x5886a1){if(_0x5886a1){if(!_0x5886a1['name']||_0x5886a1[_0x4066('0x37')]!=='SequelizeValidationError'){logger[_0x4066('0x45')](util['inspect'](_0x5886a1,{'showHidden':![],'depth':null}));}}});}exports[_0x4066('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xe3db=['[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','ValidationError','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Transcript\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','catch','name','SequelizeValidationError','error','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','start','lodash','aws-sdk','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','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','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript'];(function(_0x380a3f,_0x202483){var _0x2b4eca=function(_0x1e99b2){while(--_0x1e99b2){_0x380a3f['push'](_0x380a3f['shift']());}};_0x2b4eca(++_0x202483);}(_0xe3db,0xc8));var _0xbe3d=function(_0x12b4b5,_0x29b12a){_0x12b4b5=_0x12b4b5-0x0;var _0x9870c4=_0xe3db[_0x12b4b5];return _0x9870c4;};var _=require(_0xbe3d('0x0'));var AWS=require(_0xbe3d('0x1'));var rp=require('request-promise');var util=require(_0xbe3d('0x2'));var BPromise=require(_0xbe3d('0x3'));var db=require(_0xbe3d('0x4'))['db'];var logger=require(_0xbe3d('0x5'))(_0xbe3d('0x6'));function getTranscriptionJob(_0x192368,_0x30163d,_0x472825,_0x22d579){return new Promise(function(_0xd5a81,_0x2b4c19){var _0x4c255b=new AWS[(_0xbe3d('0x7'))]({'accessKeyId':_0x30163d,'secretAccessKey':_0x192368,'region':_0x472825});_0x4c255b[_0xbe3d('0x8')]({'TranscriptionJobName':_0x22d579},function(_0x24136a,_0x37e7c0){if(_0x24136a){return _0x2b4c19(_0x24136a);}else{return _0xd5a81(_0x37e7c0);}});});}function sentiment(_0x55df34,_0x105b9e,_0x2aa8ff,_0x514464,_0x5eddd8){return new Promise(function(_0x3b313c,_0x29d4d6){var _0x1d9d6b=new AWS[(_0xbe3d('0x9'))]({'accessKeyId':_0x105b9e,'secretAccessKey':_0x55df34,'region':_0x2aa8ff});_0x1d9d6b[_0xbe3d('0xa')]({'Text':_0x514464,'LanguageCode':_0x5eddd8[_0xbe3d('0xb')](0x0,0x2)},function(_0xfb42af,_0x2a772f){if(_0xfb42af){return _0x29d4d6(_0xfb42af);}else{return _0x3b313c(_0x2a772f);}});});}function checkTranscribeJob(_0x1ff83c,_0x276e4c,_0x4d25e7){var _0x2fad2d;return new BPromise(function(_0x48318a,_0xf2e2e6){logger[_0xbe3d('0xc')](util[_0xbe3d('0xd')](_0xbe3d('0xe'),_0x1ff83c['id'],_0x1ff83c[_0xbe3d('0xf')]));return getTranscriptionJob(_0x4d25e7[_0xbe3d('0x10')],_0x4d25e7[_0xbe3d('0x11')],_0x276e4c[_0xbe3d('0x12')],_0x1ff83c[_0xbe3d('0xf')])[_0xbe3d('0x13')](function(_0x2a45ef){logger[_0xbe3d('0xc')](util[_0xbe3d('0xd')](_0xbe3d('0x14'),_0x1ff83c['id'],_0x1ff83c['transcribeName'],_0x2a45ef[_0xbe3d('0x15')][_0xbe3d('0x16')]));if(!_0x1ff83c[_0xbe3d('0x17')]){switch(_0x2a45ef[_0xbe3d('0x15')][_0xbe3d('0x16')]){case _0xbe3d('0x18'):var _0x1d2ccc={'transcribeStatus':_0x2a45ef[_0xbe3d('0x15')][_0xbe3d('0x16')],'fileUri':_0x2a45ef['TranscriptionJob'][_0xbe3d('0x19')][_0xbe3d('0x1a')]};logger[_0xbe3d('0xc')](util[_0xbe3d('0xd')](_0xbe3d('0x1b'),_0x1ff83c['id']));return rp({'uri':_0x2a45ef[_0xbe3d('0x15')][_0xbe3d('0x19')][_0xbe3d('0x1a')],'json':!![]})[_0xbe3d('0x13')](function(_0x37b211){logger[_0xbe3d('0xc')](util['format'](_0xbe3d('0x1c'),_0x1ff83c['id']));if(_0x37b211&&_0x37b211[_0xbe3d('0x1d')]&&_0x37b211['results'][_0xbe3d('0x1e')]&&_0x37b211['results'][_0xbe3d('0x1e')][_0xbe3d('0x1f')]){_0x1d2ccc['fileText']='';for(var _0x1f2cd0=0x0;_0x1f2cd0<_0x37b211[_0xbe3d('0x1d')][_0xbe3d('0x1e')][_0xbe3d('0x1f')];_0x1f2cd0++){_0x1d2ccc[_0xbe3d('0x17')]+=_0x37b211[_0xbe3d('0x1d')][_0xbe3d('0x1e')][_0x1f2cd0][_0xbe3d('0x20')]+'';}}return _0x1ff83c[_0xbe3d('0x21')](_0x1d2ccc);})['then'](function(){logger[_0xbe3d('0xc')](util['format'](_0xbe3d('0x22'),_0x1ff83c['id']));if(!_0x1ff83c['tempSentiment']){throw new db[(_0xbe3d('0x23'))]['ValidationError'](_0xbe3d('0x24'));}if(!_0x276e4c[_0xbe3d('0x25')]||!_0x276e4c[_0xbe3d('0x26')]||!_0x276e4c[_0xbe3d('0x27')]||!_0x276e4c[_0xbe3d('0x28')]||!_0x276e4c[_0xbe3d('0x29')]){throw new db[(_0xbe3d('0x23'))]['ValidationError'](_0xbe3d('0x2a'));}if(!_0x1d2ccc[_0xbe3d('0x17')]){throw new Error('Transcript\x20not\x20available');}if(_0x276e4c['sentimentAccountId']===_0x4d25e7['id']){return _0x4d25e7;}else{return db[_0xbe3d('0x2b')][_0xbe3d('0x2c')]({'where':{'id':_settings[_0xbe3d('0x26')]}});}})[_0xbe3d('0x13')](function(_0x2e8e2e){if(!_0x2e8e2e){throw new db[(_0xbe3d('0x23'))][(_0xbe3d('0x2d'))](_0xbe3d('0x2e'));}if(!_0x2e8e2e['data1']||!_0x2e8e2e[_0xbe3d('0x11')]){throw new db[(_0xbe3d('0x23'))][(_0xbe3d('0x2d'))](_0xbe3d('0x2f'));}_0x2fad2d=_0x2e8e2e;logger[_0xbe3d('0xc')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x1ff83c['id']));return sentiment(_0x2fad2d[_0xbe3d('0x10')],_0x2fad2d['data2'],_0x276e4c['sentimentRegion'],_0x1d2ccc['fileText'],_0x276e4c[_0xbe3d('0x28')]);})[_0xbe3d('0x13')](function(_0x29d222){logger['info'](util[_0xbe3d('0xd')](_0xbe3d('0x30'),_0x1ff83c['id']));return _0x1ff83c[_0xbe3d('0x21')]({'sentiment':_0x29d222['Sentiment'],'sPositive':_0x29d222[_0xbe3d('0x31')][_0xbe3d('0x32')],'sNegative':_0x29d222[_0xbe3d('0x31')][_0xbe3d('0x33')],'sMixed':_0x29d222[_0xbe3d('0x31')][_0xbe3d('0x34')],'sNeutral':_0x29d222[_0xbe3d('0x31')][_0xbe3d('0x35')]});})[_0xbe3d('0x13')](function(){logger[_0xbe3d('0xc')](util[_0xbe3d('0xd')](_0xbe3d('0x22'),_0x1ff83c['id']));_0x48318a();});case'FAILED':return _0x1ff83c[_0xbe3d('0x21')]({'transcribeStatus':_0xbe3d('0x36'),'failureReason':_0x2a45ef[_0xbe3d('0x15')][_0xbe3d('0x37')]})[_0xbe3d('0x13')](function(){logger[_0xbe3d('0xc')](util[_0xbe3d('0xd')](_0xbe3d('0x22'),_0x1ff83c['id']));_0x48318a();});default:logger[_0xbe3d('0xc')](util[_0xbe3d('0xd')](_0xbe3d('0x38'),_0x1ff83c['id']));break;}}else{return BPromise[_0xbe3d('0x39')]()[_0xbe3d('0x13')](function(){if(!_0x1ff83c['tempSentiment']){throw new db[(_0xbe3d('0x23'))][(_0xbe3d('0x2d'))](_0xbe3d('0x24'));}if(!_0x276e4c['sentiment']||!_0x276e4c[_0xbe3d('0x26')]||!_0x276e4c[_0xbe3d('0x27')]||!_0x276e4c[_0xbe3d('0x28')]||!_0x276e4c[_0xbe3d('0x29')]){throw new db[(_0xbe3d('0x23'))][(_0xbe3d('0x2d'))](_0xbe3d('0x2a'));}if(!_0x1ff83c[_0xbe3d('0x17')]){throw new Error(_0xbe3d('0x3a'));}if(_0x276e4c['sentimentAccountId']===_0x4d25e7['id']){return _0x4d25e7;}else{return db[_0xbe3d('0x2b')][_0xbe3d('0x2c')]({'where':{'id':_settings[_0xbe3d('0x26')]}});}})[_0xbe3d('0x13')](function(_0x1e313e){if(!_0x1e313e){throw new db['Sequelize'][(_0xbe3d('0x2d'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x1e313e[_0xbe3d('0x10')]||!_0x1e313e['data2']){throw new db['Sequelize'][(_0xbe3d('0x2d'))](_0xbe3d('0x2f'));}_0x2fad2d=_0x1e313e;logger[_0xbe3d('0xc')](util[_0xbe3d('0xd')](_0xbe3d('0x3b'),_0x1ff83c['id']));return sentiment(_0x2fad2d[_0xbe3d('0x10')],_0x2fad2d[_0xbe3d('0x11')],_0x276e4c['sentimentRegion'],_0x1ff83c[_0xbe3d('0x17')],_0x276e4c[_0xbe3d('0x28')]);})[_0xbe3d('0x13')](function(_0xad5c96){logger['info'](util[_0xbe3d('0xd')](_0xbe3d('0x30'),_0x1ff83c['id']));return _0x1ff83c[_0xbe3d('0x21')]({'sentiment':_0xad5c96[_0xbe3d('0x3c')],'sPositive':_0xad5c96[_0xbe3d('0x31')][_0xbe3d('0x32')],'sNegative':_0xad5c96[_0xbe3d('0x31')][_0xbe3d('0x33')],'sMixed':_0xad5c96[_0xbe3d('0x31')][_0xbe3d('0x34')],'sNeutral':_0xad5c96[_0xbe3d('0x31')][_0xbe3d('0x35')],'transcribeStatus':'COMPLETED'});})[_0xbe3d('0x13')](function(){logger[_0xbe3d('0xc')](util[_0xbe3d('0xd')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x1ff83c['id']));_0x48318a();});}})[_0xbe3d('0x3d')](function(_0x21a424){if(_0x21a424){if(!_0x21a424[_0xbe3d('0x3e')]||_0x21a424['name']!==_0xbe3d('0x3f')){logger[_0xbe3d('0x40')](util[_0xbe3d('0xd')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x1ff83c['id']),util[_0xbe3d('0x41')](_0x21a424,{'showHidden':![],'depth':null}));}}_0x48318a();});});}function checkTranscribe(){var _0x59c888;var _0x4c2584;var _0x47476a;return db[_0xbe3d('0x42')][_0xbe3d('0x43')]({'where':{'transcribeStatus':_0xbe3d('0x44')}})[_0xbe3d('0x13')](function(_0x5e727e){if(!_0x5e727e||!_0x5e727e[_0xbe3d('0x1f')]){throw new db[(_0xbe3d('0x23'))]['ValidationError'](_0xbe3d('0x45'));}_0x59c888=_0x5e727e;return db['Setting'][_0xbe3d('0x2c')]({'where':{'id':0x1}});})[_0xbe3d('0x13')](function(_0x4a28e7){if(!_0x4a28e7){throw new db[(_0xbe3d('0x23'))][(_0xbe3d('0x2d'))](_0xbe3d('0x46'));}_0x4c2584=_0x4a28e7;if(!_0x4c2584[_0xbe3d('0x6')]||!_0x4c2584[_0xbe3d('0x47')]||!_0x4c2584[_0xbe3d('0x12')]||!_0x4c2584[_0xbe3d('0x28')]||!_0x4c2584['bucket']){throw new db[(_0xbe3d('0x23'))][(_0xbe3d('0x2d'))](_0xbe3d('0x48'));}return db[_0xbe3d('0x2b')]['findOne']({'where':{'id':_0x4c2584[_0xbe3d('0x47')]}});})[_0xbe3d('0x13')](function(_0x32ac09){if(!_0x32ac09){throw new db[(_0xbe3d('0x23'))]['ValidationError'](_0xbe3d('0x2e'));}if(!_0x32ac09[_0xbe3d('0x10')]||!_0x32ac09['data2']){throw new db[(_0xbe3d('0x23'))][(_0xbe3d('0x2d'))](_0xbe3d('0x2f'));}_0x47476a=_0x32ac09;var _0x279d2c=[];_0x59c888[_0xbe3d('0x49')](function(_0x5e72ee){_0x279d2c[_0xbe3d('0x4a')](checkTranscribeJob(_0x5e72ee,_0x4c2584,_0x47476a));});return BPromise['all'](_0x279d2c);})['catch'](function(_0x326ea9){if(_0x326ea9){if(!_0x326ea9[_0xbe3d('0x3e')]||_0x326ea9[_0xbe3d('0x3e')]!==_0xbe3d('0x3f')){logger[_0xbe3d('0x40')](util['inspect'](_0x326ea9,{'showHidden':![],'depth':null}));}}});}exports[_0xbe3d('0x4b')]=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 dcd1913..ed9e027 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 _0xa036=['YYYY-MM-DD\x20HH:mm:ss','info','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','../logger','schedule','redis','localhost','WhatsappInteraction','lastMsgAt','subtract','hours','then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','system','timeout','format'];(function(_0x1878a1,_0x19389b){var _0x5a3e20=function(_0x32e48d){while(--_0x32e48d){_0x1878a1['push'](_0x1878a1['shift']());}};_0x5a3e20(++_0x19389b);}(_0xa036,0x101));var _0x6a03=function(_0xc645c9,_0x5c5585){_0xc645c9=_0xc645c9-0x0;var _0x20ab28=_0xa036[_0xc645c9];return _0x20ab28;};'use strict';var _=require('lodash');var moment=require(_0x6a03('0x0'));var Redis=require(_0x6a03('0x1'));var util=require('util');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0x6a03('0x2'))(_0x6a03('0x3'));config[_0x6a03('0x4')]=_['defaults'](config['redis'],{'host':_0x6a03('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6a03('0x4')]));function closeInteractions(){var _0x4a11bd=[];return db[_0x6a03('0x6')]['findAll']({'raw':!![],'attributes':['id',_0x6a03('0x7')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x6a03('0x8')](0x18,_0x6a03('0x9'))}}})[_0x6a03('0xa')](function(_0x304fbc){if(_0x304fbc&&_0x304fbc[_0x6a03('0xb')]){_0x4a11bd=_[_0x6a03('0xc')](_0x304fbc||[],'id');logger['info'](_0x6a03('0xd'),_0x4a11bd[_0x6a03('0xe')]());return db['WhatsappInteraction']['update']({'closeReason':_0x6a03('0xf'),'disposition':_0x6a03('0x10'),'closed':!![],'closedAt':moment()[_0x6a03('0x11')](_0x6a03('0x12'))},{'where':{'id':_0x4a11bd}});}})[_0x6a03('0xa')](function(){if(_0x4a11bd&&_0x4a11bd[_0x6a03('0xb')]){logger[_0x6a03('0x13')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x4a11bd['join']());for(var _0xe53a59=0x0;_0xe53a59<_0x4a11bd[_0x6a03('0xb')];_0xe53a59++){io['emit']('whatsappInteraction:update',{'id':_0x4a11bd[_0xe53a59],'closed':!![]});}}})[_0x6a03('0x14')](function(_0x32c4f0){logger[_0x6a03('0x15')](_0x6a03('0x16'),_0x32c4f0?util[_0x6a03('0x17')](_0x32c4f0,{'showHidden':![],'depth':null}):'');});}exports[_0x6a03('0x18')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xe237=['emit','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','../../config/environment','../../mysqldb','../logger','schedule','redis','WhatsappInteraction','findAll','hours','then','map','[WHATSAPP]\x20Interactions\x20to\x20close:','update','timeout','format','length','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join'];(function(_0x56e3a8,_0x38f770){var _0x321e49=function(_0x22572f){while(--_0x22572f){_0x56e3a8['push'](_0x56e3a8['shift']());}};_0x321e49(++_0x38f770);}(_0xe237,0xdc));var _0x7e23=function(_0x53b938,_0x1ef2f1){_0x53b938=_0x53b938-0x0;var _0xf029bd=_0xe237[_0x53b938];return _0xf029bd;};'use strict';var _=require(_0x7e23('0x0'));var moment=require(_0x7e23('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0x7e23('0x2'));var db=require(_0x7e23('0x3'))['db'];var logger=require(_0x7e23('0x4'))(_0x7e23('0x5'));config['redis']=_['defaults'](config[_0x7e23('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7e23('0x6')]));function closeInteractions(){var _0x1b8093=[];return db[_0x7e23('0x7')][_0x7e23('0x8')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x7e23('0x9'))}}})[_0x7e23('0xa')](function(_0xc5aaae){if(_0xc5aaae&&_0xc5aaae['length']){_0x1b8093=_[_0x7e23('0xb')](_0xc5aaae||[],'id');logger['info'](_0x7e23('0xc'),_0x1b8093['join']());return db[_0x7e23('0x7')][_0x7e23('0xd')]({'closeReason':'system','disposition':_0x7e23('0xe'),'closed':!![],'closedAt':moment()[_0x7e23('0xf')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x1b8093}});}})[_0x7e23('0xa')](function(){if(_0x1b8093&&_0x1b8093[_0x7e23('0x10')]){logger[_0x7e23('0x11')](_0x7e23('0x12'),_0x1b8093[_0x7e23('0x13')]());for(var _0x2d3c0b=0x0;_0x2d3c0b<_0x1b8093[_0x7e23('0x10')];_0x2d3c0b++){io[_0x7e23('0x14')]('whatsappInteraction:update',{'id':_0x1b8093[_0x2d3c0b],'closed':!![]});}}})['catch'](function(_0x5ebb86){logger['error'](_0x7e23('0x15'),_0x5ebb86?util[_0x7e23('0x16')](_0x5ebb86,{'showHidden':![],'depth':null}):'');});}exports[_0x7e23('0x17')]=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 c572610..e660774 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d7d=['catch','../mysqldb','push','Biondo','@xcally.com','now','Innocenzo','innocenzo.biondo','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2'];(function(_0x165194,_0x31a93e){var _0x2975f0=function(_0x49ae22){while(--_0x49ae22){_0x165194['push'](_0x165194['shift']());}};_0x2975f0(++_0x31a93e);}(_0x0d7d,0xe5));var _0xd0d7=function(_0x421263,_0x18187d){_0x421263=_0x421263-0x0;var _0x34e4b5=_0x0d7d[_0x421263];return _0x34e4b5;};'use strict';var util=require('util');var db=require(_0xd0d7('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xd0d7('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xd0d7('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xd0d7('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xd0d7('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xd0d7('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xd0d7('0x4')](),'updatedAt':Date[_0xd0d7('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xd0d7('0x1')]({'id':i,'firstName':_0xd0d7('0x5')+i,'lastName':_0xd0d7('0x2')+i,'phone':0xf879fb460+i,'email':_0xd0d7('0x6')+i+_0xd0d7('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xd0d7('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xd0d7('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}db[_0xd0d7('0x7')][_0xd0d7('0x8')]({'where':{}})[_0xd0d7('0x9')](function(){return db[_0xd0d7('0x7')][_0xd0d7('0xa')](contacts);})[_0xd0d7('0x9')](function(){console[_0xd0d7('0xb')](_0xd0d7('0xc'),_0xd0d7('0xd'));return db[_0xd0d7('0xe')][_0xd0d7('0x8')]({'where':{}});})[_0xd0d7('0x9')](function(){return db[_0xd0d7('0xe')][_0xd0d7('0xa')](hopper);})['then'](function(){console[_0xd0d7('0xb')]('finished\x20populating',_0xd0d7('0xf'));return db[_0xd0d7('0x7')]['bulkCreate'](contacts2);})[_0xd0d7('0x9')](function(){console[_0xd0d7('0xb')](_0xd0d7('0xc'),_0xd0d7('0x10'));return db[_0xd0d7('0xe')][_0xd0d7('0xa')](hopper2);})[_0xd0d7('0x9')](function(){console[_0xd0d7('0xb')](_0xd0d7('0xc'),_0xd0d7('0x11'));})[_0xd0d7('0x12')](function(_0x97f8b6){console[_0xd0d7('0xb')](_0x97f8b6);}); \ No newline at end of file +var _0x664c=['CmHopper','hopper2','catch','util','../mysqldb','push','Biondo','innocenzo.biondo','@xcally.com','now','Innocenzo','destroy','then','CmContact','bulkCreate','log','finished\x20populating'];(function(_0x2c00af,_0x5d5c83){var _0x592a13=function(_0x580dea){while(--_0x580dea){_0x2c00af['push'](_0x2c00af['shift']());}};_0x592a13(++_0x5d5c83);}(_0x664c,0x124));var _0xc664=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x664c[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xc664('0x0'));var db=require(_0xc664('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xc664('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xc664('0x3')+i,'phone':0xf879fb460+i,'email':_0xc664('0x4')+i+_0xc664('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xc664('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xc664('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc664('0x6')](),'updatedAt':Date[_0xc664('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xc664('0x2')]({'id':i,'firstName':_0xc664('0x7')+i,'lastName':_0xc664('0x3')+i,'phone':0xf879fb460+i,'email':_0xc664('0x4')+i+_0xc664('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xc664('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc664('0x6')](),'updatedAt':Date[_0xc664('0x6')]()});}db['CmContact'][_0xc664('0x8')]({'where':{}})[_0xc664('0x9')](function(){return db[_0xc664('0xa')][_0xc664('0xb')](contacts);})[_0xc664('0x9')](function(){console[_0xc664('0xc')](_0xc664('0xd'),'contacts1');return db['CmHopper']['destroy']({'where':{}});})[_0xc664('0x9')](function(){return db['CmHopper'][_0xc664('0xb')](hopper);})[_0xc664('0x9')](function(){console['log']('finished\x20populating','hopper1');return db['CmContact'][_0xc664('0xb')](contacts2);})['then'](function(){console[_0xc664('0xc')](_0xc664('0xd'),'contacts2');return db[_0xc664('0xe')][_0xc664('0xb')](hopper2);})[_0xc664('0x9')](function(){console[_0xc664('0xc')]('finished\x20populating',_0xc664('0xf'));})[_0xc664('0x10')](function(_0x4fa4ce){console[_0xc664('0xc')](_0x4fa4ce);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index dba2cdf..770b999 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e34=['\x22%s\x22\x20<%s>','then','log','add\x20user','catch','util','push','format','%s%s','agent','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x3e34,0x16d));var _0x43e3=function(_0x1ef527,_0x39eb07){_0x1ef527=_0x1ef527-0x0;var _0x72665e=_0x3e34[_0x1ef527];return _0x72665e;};'use strict';var util=require(_0x43e3('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x43e3('0x1')]({'name':util[_0x43e3('0x2')](_0x43e3('0x3'),_0x43e3('0x4'),i),'fullname':util[_0x43e3('0x2')](_0x43e3('0x3'),_0x43e3('0x4'),i),'email':util[_0x43e3('0x2')]('%s%s@xcally.com','agent',i),'role':_0x43e3('0x4'),'password':_0x43e3('0x5'),'internal':0xfa0+i,'type':_0x43e3('0x6'),'transport':[_0x43e3('0x7'),'ws',_0x43e3('0x8')],'disallow':[_0x43e3('0x9')],'allow':[_0x43e3('0xa')],'defaultuser':util[_0x43e3('0x2')](_0x43e3('0x3'),'agent',i),'encryption':_0x43e3('0xb'),'avpf':'yes','force_avp':_0x43e3('0xb'),'icesupport':_0x43e3('0xb'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x43e3('0xc'),'dtlsprivatekey':_0x43e3('0xd'),'dtlssetup':_0x43e3('0xe'),'callerid':util[_0x43e3('0x2')](_0x43e3('0xf'),util[_0x43e3('0x2')]('%s%s',_0x43e3('0x4'),i),0xfa0+i)});}db['User']['bulkCreate'](users)[_0x43e3('0x10')](function(){console[_0x43e3('0x11')](_0x43e3('0x12'));})[_0x43e3('0x13')](function(_0x347053){console['log'](_0x347053);}); \ No newline at end of file +var _0xe7e3=['%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/private/motion.key','User','bulkCreate','then','log','catch','util','../mysqldb','push','format','%s%s','agent'];(function(_0x2c27ed,_0x5c50f0){var _0x597bd1=function(_0xd6db18){while(--_0xd6db18){_0x2c27ed['push'](_0x2c27ed['shift']());}};_0x597bd1(++_0x5c50f0);}(_0xe7e3,0x14e));var _0x3e7e=function(_0x31eb67,_0x9bc8c0){_0x31eb67=_0x31eb67-0x0;var _0x2a8cb8=_0xe7e3[_0x31eb67];return _0x2a8cb8;};'use strict';var util=require(_0x3e7e('0x0'));var db=require(_0x3e7e('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x3e7e('0x2')]({'name':util[_0x3e7e('0x3')](_0x3e7e('0x4'),_0x3e7e('0x5'),i),'fullname':util['format']('%s%s','agent',i),'email':util[_0x3e7e('0x3')](_0x3e7e('0x6'),_0x3e7e('0x5'),i),'role':_0x3e7e('0x5'),'password':_0x3e7e('0x7'),'internal':0xfa0+i,'type':_0x3e7e('0x8'),'transport':[_0x3e7e('0x9'),'ws',_0x3e7e('0xa')],'disallow':[_0x3e7e('0xb')],'allow':[_0x3e7e('0xc')],'defaultuser':util[_0x3e7e('0x3')](_0x3e7e('0x4'),_0x3e7e('0x5'),i),'encryption':_0x3e7e('0xd'),'avpf':_0x3e7e('0xd'),'force_avp':_0x3e7e('0xd'),'icesupport':'yes','dtlsenable':_0x3e7e('0xd'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x3e7e('0xe'),'dtlssetup':'actpass','callerid':util[_0x3e7e('0x3')]('\x22%s\x22\x20<%s>',util[_0x3e7e('0x3')](_0x3e7e('0x4'),_0x3e7e('0x5'),i),0xfa0+i)});}db[_0x3e7e('0xf')][_0x3e7e('0x10')](users)[_0x3e7e('0x11')](function(){console[_0x3e7e('0x12')]('add\x20user');})[_0x3e7e('0x13')](function(_0x1b2077){console[_0x3e7e('0x12')](_0x1b2077);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 3114c57..84dd2ad 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9300=['removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','connection','setMaxListeners','address','request','remoteAddress','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','../mysqldb','./environment','name','Agents','User','role','agent','telephone','type','UserProfileSection','findOne','ChatQueues','FaxQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','UserProfileResource','resourceId','then','map','where','ivr','format','%s:queue:%s','handshake','query','userProfileId','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','admin','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','user','voice:inbound','voice:outbound','SmsQueues','MailQueues','IvrCampaigns','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','leave'];(function(_0x27a3cc,_0x31e238){var _0x1df5bc=function(_0x2de180){while(--_0x2de180){_0x27a3cc['push'](_0x27a3cc['shift']());}};_0x1df5bc(++_0x31e238);}(_0x9300,0x153));var _0x0930=function(_0x2b5ee5,_0x3741bf){_0x2b5ee5=_0x2b5ee5-0x0;var _0x1c480b=_0x9300[_0x2b5ee5];return _0x1c480b;};'use strict';var _=require(_0x0930('0x0'));var util=require('util');var BPromise=require('bluebird');var db=require(_0x0930('0x1'))['db'];var config=require(_0x0930('0x2'));var queryQueues={'attributes':['id',_0x0930('0x3')],'include':[{'as':_0x0930('0x4'),'model':db[_0x0930('0x5')],'attributes':['id','name',_0x0930('0x6')],'raw':!![],'where':{'role':_0x0930('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x0930('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x0930('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x0930('0x3')],'where':{'role':_0x0930('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x0930('0x3'),_0x0930('0x9')],'where':{'type':'ivr'}};function getAssociatedResources(_0x4a7705,_0x31aaa2,_0x4b1994){return db[_0x0930('0xa')][_0x0930('0xb')]({'where':{'name':_0x4a7705,'userProfileId':_0x31aaa2},'raw':!![]})['then'](function(_0x6db8ef){if(_0x6db8ef){if(_0x6db8ef['autoAssociation']){switch(_0x4a7705){case'VoiceQueues':case _0x0930('0xc'):case _0x0930('0xd'):case'SmsQueues':case'MailQueues':case _0x0930('0xe'):case _0x0930('0xf'):return db[_0x4b1994][_0x0930('0x10')](queryQueues);case _0x0930('0x11'):return db[_0x4b1994][_0x0930('0x10')](queryTelephones);case _0x0930('0x12'):return db[_0x4b1994]['findAll'](queryTrunks);case'IvrCampaigns':return db[_0x4b1994]['findAll'](queryCampaigns);}}else{return db[_0x0930('0x13')]['findAll']({'attributes':[_0x0930('0x14')],'where':{'sectionId':_0x6db8ef['id']},'raw':!![]})[_0x0930('0x15')](function(_0x255988){if(_0x255988){var _0x3af83f={'where':{'id':_[_0x0930('0x16')](_0x255988,_0x0930('0x14'))},'raw':!![]};switch(_0x4b1994){case'User':_0x3af83f[_0x0930('0x17')][_0x0930('0x6')]='telephone';break;case'Campaign':_0x3af83f[_0x0930('0x17')][_0x0930('0x9')]=_0x0930('0x18');break;}return db[_0x4b1994][_0x0930('0x10')](_0x3af83f);}else{return[];}});}}else{return[];}})[_0x0930('0x15')](function(_0x4b1eb0){return _0x4b1eb0;});}function joinOrLeaveQueues(_0x19b4e4,_0x16c5fb,_0x4cf8ad,_0x1aa8bb){_0x19b4e4[_0x16c5fb](util[_0x0930('0x19')](_0x0930('0x1a'),_0x4cf8ad,_0x1aa8bb[_0x0930('0x3')]));if(_0x1aa8bb[_0x0930('0x4')]){for(var _0xea7c6c=0x0;_0xea7c6c<_0x1aa8bb['Agents']['length'];_0xea7c6c+=0x1){_0x19b4e4[_0x16c5fb](util[_0x0930('0x19')]('user:%s',_0x1aa8bb[_0x0930('0x4')][_0xea7c6c][_0x0930('0x3')]));}}}function joinOrLeave(_0x361264,_0x4aac18,_0x37e243){var _0x48bdf5;if(_0x361264[_0x0930('0x1b')][_0x0930('0x1c')]['id']){db['User']['find']({'attributes':['id',_0x0930('0x3'),_0x0930('0x6'),_0x0930('0x1d')],'where':{'id':_0x361264[_0x0930('0x1b')][_0x0930('0x1c')]['id']},'include':[{'model':db[_0x0930('0x1e')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x0930('0x1f')],'as':_0x0930('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0x0930('0x21')],'as':_0x0930('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x0930('0x23')],'as':_0x0930('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x0930('0x25')],'as':_0x0930('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x0930('0x27')],'as':_0x0930('0x28'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x2a47f2){if(_0x2a47f2){_0x48bdf5=_0x2a47f2;_0x361264[_0x4aac18](util['format'](_0x0930('0x29'),_0x2a47f2[_0x0930('0x3')]));var _0x2e21c7=[];switch(_0x2a47f2['role']){case _0x0930('0x2a'):_0x361264[_0x4aac18]('voice:inbound');_0x361264[_0x4aac18]('voice:outbound');if(queryQueues[_0x0930('0x2b')]('include')){delete queryQueues[_0x0930('0x2c')];}_0x2e21c7[_0x0930('0x2d')](db[_0x0930('0x2e')][_0x0930('0x10')](queryQueues));_0x2e21c7[_0x0930('0x2d')](db[_0x0930('0x2f')]['findAll'](queryQueues));_0x2e21c7['push'](db[_0x0930('0x30')][_0x0930('0x10')](queryQueues));_0x2e21c7[_0x0930('0x2d')](db[_0x0930('0x31')][_0x0930('0x10')](queryQueues));_0x2e21c7[_0x0930('0x2d')](db[_0x0930('0x32')][_0x0930('0x10')](queryQueues));_0x2e21c7['push'](db[_0x0930('0x33')][_0x0930('0x10')](queryQueues));_0x2e21c7[_0x0930('0x2d')](db[_0x0930('0x34')]['findAll'](queryQueues));_0x2e21c7[_0x0930('0x2d')](db[_0x0930('0x5')][_0x0930('0x10')](queryTelephones));_0x2e21c7[_0x0930('0x2d')](db[_0x0930('0x35')]['findAll'](queryTrunks));_0x2e21c7['push'](db[_0x0930('0x36')][_0x0930('0x10')](queryCampaigns));_0x2e21c7[_0x0930('0x2d')](db[_0x0930('0x5')][_0x0930('0x10')](queryAgents));break;case _0x0930('0x37'):_0x361264[_0x4aac18](_0x0930('0x38'));_0x361264[_0x4aac18](_0x0930('0x39'));_0x2e21c7[_0x0930('0x2d')](getAssociatedResources('VoiceQueues',_0x2a47f2[_0x0930('0x1d')],_0x0930('0x2e')));_0x2e21c7[_0x0930('0x2d')](getAssociatedResources(_0x0930('0xc'),_0x2a47f2[_0x0930('0x1d')],_0x0930('0x2f')));_0x2e21c7[_0x0930('0x2d')](getAssociatedResources(_0x0930('0xd'),_0x2a47f2[_0x0930('0x1d')],_0x0930('0x30')));_0x2e21c7[_0x0930('0x2d')](getAssociatedResources(_0x0930('0x3a'),_0x2a47f2[_0x0930('0x1d')],_0x0930('0x31')));_0x2e21c7[_0x0930('0x2d')](getAssociatedResources(_0x0930('0x3b'),_0x2a47f2['userProfileId'],'MailQueue'));_0x2e21c7['push'](getAssociatedResources(_0x0930('0xe'),_0x2a47f2[_0x0930('0x1d')],_0x0930('0x33')));_0x2e21c7[_0x0930('0x2d')](getAssociatedResources(_0x0930('0xf'),_0x2a47f2[_0x0930('0x1d')],_0x0930('0x34')));_0x2e21c7['push'](getAssociatedResources(_0x0930('0x11'),_0x2a47f2[_0x0930('0x1d')],_0x0930('0x5')));_0x2e21c7[_0x0930('0x2d')](getAssociatedResources(_0x0930('0x12'),_0x2a47f2['userProfileId'],_0x0930('0x35')));_0x2e21c7['push'](getAssociatedResources(_0x0930('0x3c'),_0x2a47f2[_0x0930('0x1d')],'Campaign'));_0x2e21c7[_0x0930('0x2d')](db[_0x0930('0x5')][_0x0930('0x10')](queryAgents));break;case _0x0930('0x7'):_0x361264[_0x4aac18]('voice:inbound');_0x361264[_0x4aac18](_0x0930('0x39'));_0x2e21c7[_0x0930('0x2d')](_0x2a47f2['getVoiceQueues']({'attributes':['id',_0x0930('0x3')]}));_0x2e21c7[_0x0930('0x2d')](_0x2a47f2[_0x0930('0x3d')]({'attributes':['id','name']}));_0x2e21c7[_0x0930('0x2d')](_0x2a47f2[_0x0930('0x3e')]({'attributes':['id',_0x0930('0x3')]}));_0x2e21c7[_0x0930('0x2d')](_0x2a47f2[_0x0930('0x3f')]({'attributes':['id',_0x0930('0x3')]}));_0x2e21c7[_0x0930('0x2d')](_0x2a47f2['getMailQueues']({'attributes':['id','name']}));_0x2e21c7[_0x0930('0x2d')](_0x2a47f2[_0x0930('0x40')]({'attributes':['id','name']}));_0x2e21c7[_0x0930('0x2d')](_0x2a47f2[_0x0930('0x41')]({'attributes':['id',_0x0930('0x3')]}));break;}return BPromise[_0x0930('0x42')](_0x2e21c7);}})['then'](function(_0x1b9af2){if(_0x1b9af2&&_0x1b9af2['length']){for(var _0x294e15=0x0;_0x294e15<_0x1b9af2[_0x0930('0x43')];_0x294e15+=0x1){for(var _0x2d6d40=0x0;_0x2d6d40<_0x1b9af2[_0x294e15][_0x0930('0x43')];_0x2d6d40+=0x1){switch(_0x294e15){case 0x0:joinOrLeaveQueues(_0x361264,_0x4aac18,_0x0930('0x44'),_0x1b9af2[_0x294e15][_0x2d6d40]);break;case 0x1:joinOrLeaveQueues(_0x361264,_0x4aac18,_0x0930('0x45'),_0x1b9af2[_0x294e15][_0x2d6d40]);break;case 0x2:joinOrLeaveQueues(_0x361264,_0x4aac18,_0x0930('0x46'),_0x1b9af2[_0x294e15][_0x2d6d40]);break;case 0x3:joinOrLeaveQueues(_0x361264,_0x4aac18,_0x0930('0x47'),_0x1b9af2[_0x294e15][_0x2d6d40]);break;case 0x4:joinOrLeaveQueues(_0x361264,_0x4aac18,_0x0930('0x48'),_0x1b9af2[_0x294e15][_0x2d6d40]);break;case 0x5:joinOrLeaveQueues(_0x361264,_0x4aac18,_0x0930('0x49'),_0x1b9af2[_0x294e15][_0x2d6d40]);break;case 0x6:joinOrLeaveQueues(_0x361264,_0x4aac18,_0x0930('0x4a'),_0x1b9af2[_0x294e15][_0x2d6d40]);break;case 0x7:if(_0x48bdf5[_0x0930('0x6')]!==_0x0930('0x7'))_0x361264[_0x4aac18](util[_0x0930('0x19')](_0x0930('0x4b'),_0x1b9af2[_0x294e15][_0x2d6d40][_0x0930('0x3')]));break;case 0x8:if(_0x48bdf5[_0x0930('0x6')]!=='agent')_0x361264[_0x4aac18](util[_0x0930('0x19')]('trunk:%s',_0x1b9af2[_0x294e15][_0x2d6d40][_0x0930('0x3')]));break;case 0x9:if(_0x48bdf5['role']!==_0x0930('0x7'))_0x361264[_0x4aac18](util[_0x0930('0x19')]('campaign:%s:%s',_0x1b9af2[_0x294e15][_0x2d6d40][_0x0930('0x9')],_0x1b9af2[_0x294e15][_0x2d6d40][_0x0930('0x3')]));break;case 0xa:_0x361264[_0x4aac18](util[_0x0930('0x19')](_0x0930('0x29'),_0x1b9af2[_0x294e15][_0x2d6d40][_0x0930('0x3')]));break;}}}}})['then'](function(){if(_0x4aac18==='leave'){var _0x50b47d=_[_0x0930('0x16')](_0x48bdf5[_0x0930('0x4c')],'id');return _0x48bdf5[_0x0930('0x4d')](_0x50b47d)[_0x0930('0x15')](function(){for(var _0x2ceb03=0x0;_0x2ceb03<_0x50b47d[_0x0930('0x43')];_0x2ceb03+=0x1){_0x37e243[_0x0930('0x4e')](_0x0930('0x4f'),{'ChatInteractionId':Number(_0x50b47d[_0x2ceb03]),'UserId':Number(_0x48bdf5['id'])});}});}})[_0x0930('0x15')](function(){if(_0x4aac18===_0x0930('0x50')){var _0x1d8124=_[_0x0930('0x16')](_0x48bdf5[_0x0930('0x20')],'id');return _0x48bdf5[_0x0930('0x51')](_0x1d8124)[_0x0930('0x15')](function(){for(var _0x58e812=0x0;_0x58e812<_0x1d8124['length'];_0x58e812+=0x1){_0x37e243['emit'](_0x0930('0x52'),{'MailInteractionId':Number(_0x1d8124[_0x58e812]),'UserId':Number(_0x48bdf5['id'])});}});}})[_0x0930('0x15')](function(){if(_0x4aac18===_0x0930('0x50')){var _0x38da03=_['map'](_0x48bdf5['FaxInteractions'],'id');return _0x48bdf5[_0x0930('0x53')](_0x38da03)[_0x0930('0x15')](function(){for(var _0x2d7ef2=0x0;_0x2d7ef2<_0x38da03[_0x0930('0x43')];_0x2d7ef2+=0x1){_0x37e243['emit'](_0x0930('0x54'),{'FaxInteractionId':Number(_0x38da03[_0x2d7ef2]),'UserId':Number(_0x48bdf5['id'])});}});}})[_0x0930('0x15')](function(){if(_0x4aac18===_0x0930('0x50')){var _0x3f47f2=_[_0x0930('0x16')](_0x48bdf5[_0x0930('0x24')],'id');return _0x48bdf5[_0x0930('0x55')](_0x3f47f2)[_0x0930('0x15')](function(){for(var _0x310199=0x0;_0x310199<_0x3f47f2[_0x0930('0x43')];_0x310199+=0x1){_0x37e243[_0x0930('0x4e')](_0x0930('0x56'),{'SmsInteractionId':Number(_0x3f47f2[_0x310199]),'UserId':Number(_0x48bdf5['id'])});}});}})[_0x0930('0x15')](function(){if(_0x4aac18===_0x0930('0x50')){var _0xda8945=_[_0x0930('0x16')](_0x48bdf5[_0x0930('0x26')],'id');return _0x48bdf5[_0x0930('0x57')](_0xda8945)[_0x0930('0x15')](function(){for(var _0x1297ab=0x0;_0x1297ab<_0xda8945[_0x0930('0x43')];_0x1297ab+=0x1){_0x37e243[_0x0930('0x4e')](_0x0930('0x58'),{'OpenchannelInteractionId':Number(_0xda8945[_0x1297ab]),'UserId':Number(_0x48bdf5['id'])});}});}})[_0x0930('0x15')](function(){if(_0x4aac18===_0x0930('0x50')){var _0x5aa376=_[_0x0930('0x16')](_0x48bdf5[_0x0930('0x28')],'id');return _0x48bdf5[_0x0930('0x59')](_0x5aa376)[_0x0930('0x15')](function(){for(var _0x3a96c0=0x0;_0x3a96c0<_0x5aa376[_0x0930('0x43')];_0x3a96c0+=0x1){_0x37e243[_0x0930('0x4e')](_0x0930('0x5a'),{'WhatsappInteractionId':Number(_0x5aa376[_0x3a96c0]),'UserId':Number(_0x48bdf5['id'])});}});}})[_0x0930('0x5b')](function(_0x41e35b){_0x361264[_0x0930('0x5c')](_0x41e35b);});}}function onDisconnect(_0x30ad0b,_0x2fd05d){joinOrLeave(_0x30ad0b,_0x0930('0x50'),_0x2fd05d);}function onConnect(_0x7bd12d){joinOrLeave(_0x7bd12d,_0x0930('0x5d'));}exports['default']=function(_0x37b3b2){_0x37b3b2['on'](_0x0930('0x5e'),function(_0x564008){_0x564008[_0x0930('0x5f')](0x0);_0x564008[_0x0930('0x60')]=_0x564008[_0x0930('0x61')][_0x0930('0x5e')][_0x0930('0x62')]+':'+_0x564008['request'][_0x0930('0x5e')]['remotePort'];_0x564008[_0x0930('0x63')]=new Date();_0x564008[_0x0930('0x5c')]=function(_0x35b867){console['log'](_0x0930('0x64')+_0x564008[_0x0930('0x65')][_0x0930('0x3')]+'['+_0x564008['address']+']',_0x35b867);};_0x564008['on'](_0x0930('0x66'),function(){onDisconnect(_0x564008,_0x37b3b2);_0x564008[_0x0930('0x5c')](_0x0930('0x67'));});onConnect(_0x564008);_0x564008[_0x0930('0x5c')](_0x0930('0x68'));});}; \ No newline at end of file +var _0x3746=['handshake','query','find','userProfileId','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','admin','push','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','user','voice:inbound','voice:outbound','VoiceQueue','FaxQueues','FaxQueue','OpenchannelQueues','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','connection','address','request','remoteAddress','remotePort','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','../mysqldb','name','Agents','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','map','resourceId','User','where','Campaign','format','%s:queue:%s','length','user:%s'];(function(_0x8f7aff,_0x523fbf){var _0x4742f8=function(_0xc6214c){while(--_0xc6214c){_0x8f7aff['push'](_0x8f7aff['shift']());}};_0x4742f8(++_0x523fbf);}(_0x3746,0xa9));var _0x6374=function(_0x541598,_0x1a5c0f){_0x541598=_0x541598-0x0;var _0x4312d7=_0x3746[_0x541598];return _0x4312d7;};'use strict';var _=require(_0x6374('0x0'));var util=require(_0x6374('0x1'));var BPromise=require('bluebird');var db=require(_0x6374('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x6374('0x3')],'include':[{'as':_0x6374('0x4'),'model':db['User'],'attributes':['id','name',_0x6374('0x5')],'raw':!![],'where':{'role':_0x6374('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x6374('0x3')],'where':{'role':_0x6374('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x6374('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x6374('0x3')],'where':{'role':_0x6374('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x6374('0x3'),_0x6374('0x8')],'where':{'type':_0x6374('0x9')}};function getAssociatedResources(_0x59de90,_0x18e4ef,_0x5bd695){return db[_0x6374('0xa')][_0x6374('0xb')]({'where':{'name':_0x59de90,'userProfileId':_0x18e4ef},'raw':!![]})[_0x6374('0xc')](function(_0x585eed){if(_0x585eed){if(_0x585eed[_0x6374('0xd')]){switch(_0x59de90){case _0x6374('0xe'):case _0x6374('0xf'):case'FaxQueues':case _0x6374('0x10'):case _0x6374('0x11'):case'OpenchannelQueues':case _0x6374('0x12'):return db[_0x5bd695][_0x6374('0x13')](queryQueues);case _0x6374('0x14'):return db[_0x5bd695]['findAll'](queryTelephones);case _0x6374('0x15'):return db[_0x5bd695][_0x6374('0x13')](queryTrunks);case _0x6374('0x16'):return db[_0x5bd695]['findAll'](queryCampaigns);}}else{return db[_0x6374('0x17')]['findAll']({'attributes':['resourceId'],'where':{'sectionId':_0x585eed['id']},'raw':!![]})[_0x6374('0xc')](function(_0x4ffe00){if(_0x4ffe00){var _0x17d71b={'where':{'id':_[_0x6374('0x18')](_0x4ffe00,_0x6374('0x19'))},'raw':!![]};switch(_0x5bd695){case _0x6374('0x1a'):_0x17d71b[_0x6374('0x1b')][_0x6374('0x5')]=_0x6374('0x7');break;case _0x6374('0x1c'):_0x17d71b[_0x6374('0x1b')][_0x6374('0x8')]=_0x6374('0x9');break;}return db[_0x5bd695][_0x6374('0x13')](_0x17d71b);}else{return[];}});}}else{return[];}})[_0x6374('0xc')](function(_0x7f4ea3){return _0x7f4ea3;});}function joinOrLeaveQueues(_0x435ab6,_0x11beab,_0x46fdc2,_0x3b8ed2){_0x435ab6[_0x11beab](util[_0x6374('0x1d')](_0x6374('0x1e'),_0x46fdc2,_0x3b8ed2['name']));if(_0x3b8ed2['Agents']){for(var _0x2c29ae=0x0;_0x2c29ae<_0x3b8ed2['Agents'][_0x6374('0x1f')];_0x2c29ae+=0x1){_0x435ab6[_0x11beab](util[_0x6374('0x1d')](_0x6374('0x20'),_0x3b8ed2[_0x6374('0x4')][_0x2c29ae]['name']));}}}function joinOrLeave(_0x110353,_0x2227c9,_0x190870){var _0x1148e5;if(_0x110353[_0x6374('0x21')][_0x6374('0x22')]['id']){db[_0x6374('0x1a')][_0x6374('0x23')]({'attributes':['id','name',_0x6374('0x5'),_0x6374('0x24')],'where':{'id':_0x110353[_0x6374('0x21')]['query']['id']},'include':[{'model':db[_0x6374('0x25')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x6374('0x26')],'as':_0x6374('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x6374('0x28')],'as':_0x6374('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x6374('0x2a')],'as':_0x6374('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x6374('0x2c')],'as':_0x6374('0x2d'),'attributes':['id'],'raw':!![]},{'model':db[_0x6374('0x2e')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x6374('0xc')](function(_0x37b74a){if(_0x37b74a){_0x1148e5=_0x37b74a;_0x110353[_0x2227c9](util[_0x6374('0x1d')]('user:%s',_0x37b74a[_0x6374('0x3')]));var _0x27f7cf=[];switch(_0x37b74a['role']){case _0x6374('0x2f'):_0x110353[_0x2227c9]('voice:inbound');_0x110353[_0x2227c9]('voice:outbound');if(queryQueues['hasOwnProperty']('include')){delete queryQueues['include'];}_0x27f7cf[_0x6374('0x30')](db['VoiceQueue']['findAll'](queryQueues));_0x27f7cf[_0x6374('0x30')](db[_0x6374('0x31')][_0x6374('0x13')](queryQueues));_0x27f7cf[_0x6374('0x30')](db['FaxQueue'][_0x6374('0x13')](queryQueues));_0x27f7cf['push'](db[_0x6374('0x32')][_0x6374('0x13')](queryQueues));_0x27f7cf[_0x6374('0x30')](db[_0x6374('0x33')][_0x6374('0x13')](queryQueues));_0x27f7cf[_0x6374('0x30')](db[_0x6374('0x34')][_0x6374('0x13')](queryQueues));_0x27f7cf[_0x6374('0x30')](db['WhatsappQueue'][_0x6374('0x13')](queryQueues));_0x27f7cf[_0x6374('0x30')](db['User'][_0x6374('0x13')](queryTelephones));_0x27f7cf[_0x6374('0x30')](db[_0x6374('0x35')][_0x6374('0x13')](queryTrunks));_0x27f7cf[_0x6374('0x30')](db[_0x6374('0x1c')]['findAll'](queryCampaigns));_0x27f7cf[_0x6374('0x30')](db[_0x6374('0x1a')][_0x6374('0x13')](queryAgents));break;case _0x6374('0x36'):_0x110353[_0x2227c9](_0x6374('0x37'));_0x110353[_0x2227c9](_0x6374('0x38'));_0x27f7cf[_0x6374('0x30')](getAssociatedResources('VoiceQueues',_0x37b74a[_0x6374('0x24')],_0x6374('0x39')));_0x27f7cf[_0x6374('0x30')](getAssociatedResources('ChatQueues',_0x37b74a[_0x6374('0x24')],_0x6374('0x31')));_0x27f7cf['push'](getAssociatedResources(_0x6374('0x3a'),_0x37b74a[_0x6374('0x24')],_0x6374('0x3b')));_0x27f7cf[_0x6374('0x30')](getAssociatedResources(_0x6374('0x10'),_0x37b74a['userProfileId'],_0x6374('0x32')));_0x27f7cf[_0x6374('0x30')](getAssociatedResources(_0x6374('0x11'),_0x37b74a['userProfileId'],_0x6374('0x33')));_0x27f7cf[_0x6374('0x30')](getAssociatedResources(_0x6374('0x3c'),_0x37b74a['userProfileId'],_0x6374('0x34')));_0x27f7cf['push'](getAssociatedResources(_0x6374('0x12'),_0x37b74a['userProfileId'],'WhatsappQueue'));_0x27f7cf[_0x6374('0x30')](getAssociatedResources(_0x6374('0x14'),_0x37b74a['userProfileId'],_0x6374('0x1a')));_0x27f7cf[_0x6374('0x30')](getAssociatedResources('Trunks',_0x37b74a[_0x6374('0x24')],_0x6374('0x35')));_0x27f7cf[_0x6374('0x30')](getAssociatedResources(_0x6374('0x16'),_0x37b74a[_0x6374('0x24')],_0x6374('0x1c')));_0x27f7cf[_0x6374('0x30')](db['User']['findAll'](queryAgents));break;case'agent':_0x110353[_0x2227c9]('voice:inbound');_0x110353[_0x2227c9]('voice:outbound');_0x27f7cf['push'](_0x37b74a[_0x6374('0x3d')]({'attributes':['id','name']}));_0x27f7cf[_0x6374('0x30')](_0x37b74a[_0x6374('0x3e')]({'attributes':['id','name']}));_0x27f7cf[_0x6374('0x30')](_0x37b74a[_0x6374('0x3f')]({'attributes':['id',_0x6374('0x3')]}));_0x27f7cf[_0x6374('0x30')](_0x37b74a[_0x6374('0x40')]({'attributes':['id',_0x6374('0x3')]}));_0x27f7cf['push'](_0x37b74a[_0x6374('0x41')]({'attributes':['id',_0x6374('0x3')]}));_0x27f7cf[_0x6374('0x30')](_0x37b74a[_0x6374('0x42')]({'attributes':['id','name']}));_0x27f7cf[_0x6374('0x30')](_0x37b74a['getWhatsappQueues']({'attributes':['id',_0x6374('0x3')]}));break;}return BPromise['all'](_0x27f7cf);}})[_0x6374('0xc')](function(_0x5cdb59){if(_0x5cdb59&&_0x5cdb59[_0x6374('0x1f')]){for(var _0x3d17c3=0x0;_0x3d17c3<_0x5cdb59['length'];_0x3d17c3+=0x1){for(var _0x39dc6c=0x0;_0x39dc6c<_0x5cdb59[_0x3d17c3][_0x6374('0x1f')];_0x39dc6c+=0x1){switch(_0x3d17c3){case 0x0:joinOrLeaveQueues(_0x110353,_0x2227c9,_0x6374('0x43'),_0x5cdb59[_0x3d17c3][_0x39dc6c]);break;case 0x1:joinOrLeaveQueues(_0x110353,_0x2227c9,_0x6374('0x44'),_0x5cdb59[_0x3d17c3][_0x39dc6c]);break;case 0x2:joinOrLeaveQueues(_0x110353,_0x2227c9,_0x6374('0x45'),_0x5cdb59[_0x3d17c3][_0x39dc6c]);break;case 0x3:joinOrLeaveQueues(_0x110353,_0x2227c9,_0x6374('0x46'),_0x5cdb59[_0x3d17c3][_0x39dc6c]);break;case 0x4:joinOrLeaveQueues(_0x110353,_0x2227c9,_0x6374('0x47'),_0x5cdb59[_0x3d17c3][_0x39dc6c]);break;case 0x5:joinOrLeaveQueues(_0x110353,_0x2227c9,_0x6374('0x48'),_0x5cdb59[_0x3d17c3][_0x39dc6c]);break;case 0x6:joinOrLeaveQueues(_0x110353,_0x2227c9,_0x6374('0x49'),_0x5cdb59[_0x3d17c3][_0x39dc6c]);break;case 0x7:if(_0x1148e5[_0x6374('0x5')]!==_0x6374('0x6'))_0x110353[_0x2227c9](util[_0x6374('0x1d')](_0x6374('0x4a'),_0x5cdb59[_0x3d17c3][_0x39dc6c][_0x6374('0x3')]));break;case 0x8:if(_0x1148e5['role']!=='agent')_0x110353[_0x2227c9](util['format'](_0x6374('0x4b'),_0x5cdb59[_0x3d17c3][_0x39dc6c][_0x6374('0x3')]));break;case 0x9:if(_0x1148e5[_0x6374('0x5')]!==_0x6374('0x6'))_0x110353[_0x2227c9](util[_0x6374('0x1d')](_0x6374('0x4c'),_0x5cdb59[_0x3d17c3][_0x39dc6c]['type'],_0x5cdb59[_0x3d17c3][_0x39dc6c][_0x6374('0x3')]));break;case 0xa:_0x110353[_0x2227c9](util[_0x6374('0x1d')](_0x6374('0x20'),_0x5cdb59[_0x3d17c3][_0x39dc6c][_0x6374('0x3')]));break;}}}}})[_0x6374('0xc')](function(){if(_0x2227c9===_0x6374('0x4d')){var _0x15ec01=_[_0x6374('0x18')](_0x1148e5['ChatInteractions'],'id');return _0x1148e5[_0x6374('0x4e')](_0x15ec01)[_0x6374('0xc')](function(){for(var _0x4efc8a=0x0;_0x4efc8a<_0x15ec01[_0x6374('0x1f')];_0x4efc8a+=0x1){_0x190870[_0x6374('0x4f')](_0x6374('0x50'),{'ChatInteractionId':Number(_0x15ec01[_0x4efc8a]),'UserId':Number(_0x1148e5['id'])});}});}})[_0x6374('0xc')](function(){if(_0x2227c9===_0x6374('0x4d')){var _0x3fe6f3=_[_0x6374('0x18')](_0x1148e5['MailInteractions'],'id');return _0x1148e5[_0x6374('0x51')](_0x3fe6f3)['then'](function(){for(var _0x390fe6=0x0;_0x390fe6<_0x3fe6f3['length'];_0x390fe6+=0x1){_0x190870[_0x6374('0x4f')](_0x6374('0x52'),{'MailInteractionId':Number(_0x3fe6f3[_0x390fe6]),'UserId':Number(_0x1148e5['id'])});}});}})['then'](function(){if(_0x2227c9==='leave'){var _0x9d6dcc=_[_0x6374('0x18')](_0x1148e5[_0x6374('0x29')],'id');return _0x1148e5['removeFaxInteractions'](_0x9d6dcc)['then'](function(){for(var _0x4712d6=0x0;_0x4712d6<_0x9d6dcc['length'];_0x4712d6+=0x1){_0x190870[_0x6374('0x4f')](_0x6374('0x53'),{'FaxInteractionId':Number(_0x9d6dcc[_0x4712d6]),'UserId':Number(_0x1148e5['id'])});}});}})['then'](function(){if(_0x2227c9==='leave'){var _0x12801d=_[_0x6374('0x18')](_0x1148e5[_0x6374('0x2b')],'id');return _0x1148e5['removeSmsInteractions'](_0x12801d)[_0x6374('0xc')](function(){for(var _0x30c131=0x0;_0x30c131<_0x12801d['length'];_0x30c131+=0x1){_0x190870[_0x6374('0x4f')](_0x6374('0x54'),{'SmsInteractionId':Number(_0x12801d[_0x30c131]),'UserId':Number(_0x1148e5['id'])});}});}})[_0x6374('0xc')](function(){if(_0x2227c9==='leave'){var _0x170400=_[_0x6374('0x18')](_0x1148e5[_0x6374('0x2d')],'id');return _0x1148e5[_0x6374('0x55')](_0x170400)['then'](function(){for(var _0x508f55=0x0;_0x508f55<_0x170400['length'];_0x508f55+=0x1){_0x190870[_0x6374('0x4f')](_0x6374('0x56'),{'OpenchannelInteractionId':Number(_0x170400[_0x508f55]),'UserId':Number(_0x1148e5['id'])});}});}})[_0x6374('0xc')](function(){if(_0x2227c9===_0x6374('0x4d')){var _0x3a383e=_[_0x6374('0x18')](_0x1148e5['WhatsappInteractions'],'id');return _0x1148e5[_0x6374('0x57')](_0x3a383e)[_0x6374('0xc')](function(){for(var _0x4da92f=0x0;_0x4da92f<_0x3a383e['length'];_0x4da92f+=0x1){_0x190870[_0x6374('0x4f')](_0x6374('0x58'),{'WhatsappInteractionId':Number(_0x3a383e[_0x4da92f]),'UserId':Number(_0x1148e5['id'])});}});}})[_0x6374('0x59')](function(_0x1886ba){_0x110353[_0x6374('0x5a')](_0x1886ba);});}}function onDisconnect(_0x513181,_0x26f601){joinOrLeave(_0x513181,_0x6374('0x4d'),_0x26f601);}function onConnect(_0x48669b){joinOrLeave(_0x48669b,_0x6374('0x5b'));}exports['default']=function(_0x3cd1db){_0x3cd1db['on'](_0x6374('0x5c'),function(_0x5a7efd){_0x5a7efd['setMaxListeners'](0x0);_0x5a7efd[_0x6374('0x5d')]=_0x5a7efd[_0x6374('0x5e')]['connection'][_0x6374('0x5f')]+':'+_0x5a7efd[_0x6374('0x5e')]['connection'][_0x6374('0x60')];_0x5a7efd['connectedAt']=new Date();_0x5a7efd['log']=function(_0x47ed85){console[_0x6374('0x5a')]('SocketIO\x20'+_0x5a7efd[_0x6374('0x61')][_0x6374('0x3')]+'['+_0x5a7efd['address']+']',_0x47ed85);};_0x5a7efd['on'](_0x6374('0x62'),function(){onDisconnect(_0x5a7efd,_0x3cd1db);_0x5a7efd['log'](_0x6374('0x63'));});onConnect(_0x5a7efd);_0x5a7efd[_0x6374('0x5a')](_0x6374('0x64'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 7b42467..b311ed1 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 _0x6e0c=['undefined','Sequelize','QueryTypes','SELECT','contact','UserId','format','SIP/%s','name','channel','incomingmessage','outgoingmessage','AfterCreateMessage','motionChannel','opened','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','agent','AfterCreate','changed','closed','substatus','interface','AfterUpdate','User','find','fullname','email','internal','length','hasOwnProperty','hook','callback','toLowerCase','util','client','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','then','info','Trigger,\x20%s','EventManager','error','code','catch','get','event','direction','resolve','ContactId'];(function(_0x470212,_0x1387de){var _0x5083cb=function(_0x3bec27){while(--_0x3bec27){_0x470212['push'](_0x470212['shift']());}};_0x5083cb(++_0x1387de);}(_0x6e0c,0x190));var _0xc6e0=function(_0x159c2f,_0xd39d20){_0x159c2f=_0x159c2f-0x0;var _0x591f68=_0x6e0c[_0x159c2f];return _0x591f68;};'use strict';var util=require(_0xc6e0('0x0'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var logger=require('../logger')('triggers');var client=jayson[_0xc6e0('0x1')][_0xc6e0('0x2')]({'port':0x232a});var triggers=[{'channel':_0xc6e0('0x3'),'model':_0xc6e0('0x4'),'event':_0xc6e0('0x5'),'condition':_0xc6e0('0x6'),'callback':afterCreate},{'channel':_0xc6e0('0x3'),'model':'ChatInteraction','event':_0xc6e0('0x7'),'condition':_0xc6e0('0x8'),'callback':afterUpdate},{'channel':_0xc6e0('0x3'),'model':_0xc6e0('0x9'),'event':_0xc6e0('0x5'),'condition':_0xc6e0('0xa'),'callback':afterCreateMessage},{'channel':'Sms','model':_0xc6e0('0xb'),'event':_0xc6e0('0x5'),'condition':'newinteraction','callback':afterCreate},{'channel':'Sms','model':_0xc6e0('0xb'),'event':_0xc6e0('0x7'),'condition':_0xc6e0('0x8'),'callback':afterUpdate},{'channel':'Sms','model':_0xc6e0('0xc'),'event':_0xc6e0('0x5'),'condition':_0xc6e0('0xa'),'callback':afterCreateMessage},{'channel':_0xc6e0('0xd'),'model':_0xc6e0('0xe'),'event':_0xc6e0('0x5'),'condition':_0xc6e0('0x6'),'callback':afterCreate},{'channel':_0xc6e0('0xd'),'model':_0xc6e0('0xe'),'event':_0xc6e0('0x7'),'condition':_0xc6e0('0x8'),'callback':afterUpdate},{'channel':_0xc6e0('0xd'),'model':_0xc6e0('0xf'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0xc6e0('0x10'),'model':_0xc6e0('0x11'),'event':_0xc6e0('0x5'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xc6e0('0x10'),'model':'FaxInteraction','event':_0xc6e0('0x7'),'condition':_0xc6e0('0x8'),'callback':afterUpdate},{'channel':_0xc6e0('0x10'),'model':_0xc6e0('0x12'),'event':_0xc6e0('0x5'),'condition':_0xc6e0('0xa'),'callback':afterCreateMessage},{'channel':_0xc6e0('0x13'),'model':_0xc6e0('0x14'),'event':_0xc6e0('0x5'),'condition':_0xc6e0('0x6'),'callback':afterCreate},{'channel':_0xc6e0('0x13'),'model':_0xc6e0('0x14'),'event':_0xc6e0('0x7'),'condition':_0xc6e0('0x8'),'callback':afterUpdate},{'channel':_0xc6e0('0x13'),'model':_0xc6e0('0x15'),'event':_0xc6e0('0x5'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xc6e0('0x16'),'model':_0xc6e0('0x17'),'event':'afterCreate','condition':_0xc6e0('0x6'),'callback':afterCreate},{'channel':_0xc6e0('0x16'),'model':'OpenchannelInteraction','event':_0xc6e0('0x7'),'condition':_0xc6e0('0x8'),'callback':afterUpdate},{'channel':_0xc6e0('0x16'),'model':_0xc6e0('0x18'),'event':_0xc6e0('0x5'),'condition':_0xc6e0('0xa'),'callback':afterCreateMessage}];function request(_0x5867f2){return client[_0xc6e0('0x19')]('EventManager',_0x5867f2)[_0xc6e0('0x1a')](function(_0x247d81){logger[_0xc6e0('0x1b')](_0xc6e0('0x1c'),_0xc6e0('0x1d'),_0x247d81);if(_0x247d81[_0xc6e0('0x1e')]){if(_0x247d81[_0xc6e0('0x1e')][_0xc6e0('0x1f')]===0x1f4){logger[_0xc6e0('0x1e')](_0xc6e0('0x1c'),'EventManager',_0x247d81['error']);}}})[_0xc6e0('0x20')](function(_0x3b03ce){logger['error'](_0xc6e0('0x1c'),'EventManager',_0x3b03ce);});}function afterCreateMessage(_0x1800a8){return function(_0x4172cc){_0x4172cc=_0x4172cc[_0xc6e0('0x21')]({'plain':!![]});_0x4172cc['channel']=_0x1800a8;_0x4172cc['motionChannel']=_0x1800a8;_0x4172cc[_0xc6e0('0x22')]=_0x4172cc[_0xc6e0('0x23')];Promise[_0xc6e0('0x24')]()[_0xc6e0('0x1a')](function(){if(typeof _0x4172cc[_0xc6e0('0x25')]===_0xc6e0('0x26'))return null;var _0x458299='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4172cc[_0xc6e0('0x25')];return db['sequelize']['query'](_0x458299,{'type':db[_0xc6e0('0x27')][_0xc6e0('0x28')][_0xc6e0('0x29')],'raw':!![]});})[_0xc6e0('0x1a')](function(_0x3adc2e){if(_0x3adc2e){_0x4172cc[_0xc6e0('0x2a')]=_0x3adc2e[0x0];}if(typeof _0x4172cc[_0xc6e0('0x2b')]===_0xc6e0('0x26'))return;return getAgent(_0x4172cc['UserId']);})[_0xc6e0('0x1a')](function(_0x3d2a09){if(_0x3d2a09){_0x4172cc['interface']=util[_0xc6e0('0x2c')](_0xc6e0('0x2d'),_0x3d2a09[_0xc6e0('0x2e')]);_0x4172cc['agent']=_0x3d2a09;_0x4172cc[_0xc6e0('0x2f')]=_0x1800a8;return request({'event':_0xc6e0('0x30'),'message':_0x4172cc});}else{return request({'event':_0xc6e0('0x31'),'message':_0x4172cc});}})[_0xc6e0('0x20')](function(_0x19a6ba){logger[_0xc6e0('0x1e')]('Trigger,\x20%s',_0xc6e0('0x32'),_0x19a6ba);});};}function afterCreate(_0x3c5210,_0x3daedb){return function(_0x390af6){_0x390af6=_0x390af6['get']({'plain':!![]});_0x390af6[_0xc6e0('0x2f')]=_0x3c5210;_0x390af6[_0xc6e0('0x33')]=_0x3c5210;_0x390af6[_0xc6e0('0x22')]=_0xc6e0('0x34');Promise[_0xc6e0('0x24')]()[_0xc6e0('0x1a')](function(){var _0x475c75=_0xc6e0('0x35')+_0x390af6[_0xc6e0('0x25')];return db[_0xc6e0('0x36')][_0xc6e0('0x37')](_0x475c75,{'type':db[_0xc6e0('0x27')][_0xc6e0('0x28')][_0xc6e0('0x29')],'raw':!![]});})['then'](function(_0x44a498){if(_0x44a498){_0x390af6[_0xc6e0('0x2a')]=_0x44a498[0x0];}if(typeof _0x390af6[_0xc6e0('0x2b')]===_0xc6e0('0x26'))return;return getAgent(_0x390af6[_0xc6e0('0x2b')]);})[_0xc6e0('0x1a')](function(_0x4b9d34){if(_0x4b9d34){_0x390af6['interface']=util[_0xc6e0('0x2c')](_0xc6e0('0x2d'),_0x4b9d34[_0xc6e0('0x2e')]);_0x390af6[_0xc6e0('0x38')]=_0x4b9d34;}return request({'event':_0x3daedb,'message':_0x390af6});})[_0xc6e0('0x20')](function(_0x3bbcc0){logger['error'](_0xc6e0('0x1c'),_0xc6e0('0x39'),_0x3bbcc0);});};}function afterUpdate(_0x2521e2){return function(_0x13a2de){var _0x5eafc7=_0x13a2de[_0xc6e0('0x3a')](_0xc6e0('0x3b'))&&_0x13a2de['closed'];var _0x2c47e7=_0x13a2de[_0xc6e0('0x3a')](_0xc6e0('0x3c'));if(_0x5eafc7||_0x2c47e7){var _0x32a260=_0x5eafc7?'closedinteraction':'substatus';var _0x559ec6=_0x13a2de[_0xc6e0('0x21')]({'plain':!![]});_0x559ec6[_0xc6e0('0x2f')]=_0x2521e2;_0x559ec6[_0xc6e0('0x33')]=_0x2521e2;_0x559ec6[_0xc6e0('0x22')]=_0x5eafc7?'closed':'substatus';var _0x23d28e=_0xc6e0('0x35')+_0x559ec6[_0xc6e0('0x25')];return db[_0xc6e0('0x36')][_0xc6e0('0x37')](_0x23d28e,{'type':db['Sequelize'][_0xc6e0('0x28')][_0xc6e0('0x29')],'raw':!![]})[_0xc6e0('0x1a')](function(_0x161c5c){if(_0x161c5c){_0x559ec6[_0xc6e0('0x2a')]=_0x161c5c[0x0];}if(typeof _0x559ec6[_0xc6e0('0x2b')]===_0xc6e0('0x26'))return;return getAgent(_0x559ec6[_0xc6e0('0x2b')]);})[_0xc6e0('0x1a')](function(_0x5f0580){if(_0x5f0580){_0x559ec6[_0xc6e0('0x3d')]=util[_0xc6e0('0x2c')](_0xc6e0('0x2d'),_0x5f0580[_0xc6e0('0x2e')]);_0x559ec6[_0xc6e0('0x38')]=_0x5f0580;}return request({'event':_0x32a260,'message':_0x559ec6});})[_0xc6e0('0x20')](function(_0x4df0a3){logger[_0xc6e0('0x1e')](_0xc6e0('0x1c'),_0xc6e0('0x3e'),_0x4df0a3);});}};}function getAgent(_0x5d43ab){return db[_0xc6e0('0x3f')][_0xc6e0('0x40')]({'where':{'id':_0x5d43ab},'attributes':['id',_0xc6e0('0x2e'),_0xc6e0('0x41'),_0xc6e0('0x42'),_0xc6e0('0x43')],'raw':!![]})['then'](function(_0x460348){return _0x460348;});}exports['default']=function(){for(var _0x55c12d=0x0;_0x55c12d=_0x3a4b41[_0xeaf4('0x12')]){throw Error(_0xeaf4('0x13'));}_0x299828(_0x1e0f4d);})[_0xeaf4('0x14')](function(_0x53f727){_0x5e54c9(_0x53f727);});});}; \ No newline at end of file +var _0xdaab=['blockedAt','updateAttributes','getLicense','agent','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util','voice','mail','chat','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser'];(function(_0x345a54,_0x42e24e){var _0x267370=function(_0x28c7ab){while(--_0x28c7ab){_0x345a54['push'](_0x345a54['shift']());}};_0x267370(++_0x42e24e);}(_0xdaab,0x1d7));var _0xbdaa=function(_0x1b1aee,_0x57c8ed){_0x1b1aee=_0x1b1aee-0x0;var _0x276aa2=_0xdaab[_0x1b1aee];return _0x276aa2;};'use strict';var _=require(_0xbdaa('0x0'));var BPromise=require(_0xbdaa('0x1'));var db=require(_0xbdaa('0x2'))['db'];var util=require(_0xbdaa('0x3'));var channels=[_0xbdaa('0x4'),_0xbdaa('0x5'),_0xbdaa('0x6'),'fax','sms','whatsapp',_0xbdaa('0x7')];exports[_0xbdaa('0x8')]=function(){return channels;};exports[_0xbdaa('0x9')]=function(_0x4e2313){_0x4e2313=_0x4e2313[_0xbdaa('0xa')]();return _[_0xbdaa('0xb')](channels,_0x4e2313);};exports[_0xbdaa('0xc')]=function(_0x752dbc,_0x1aef1e,_0x2c4858,_0x1d35f8){var _0x277b8b={'loginAttempts':_0x1aef1e,'blocked':_0x2c4858};if(!_['isUndefined'](_0x1d35f8)){_0x277b8b[_0xbdaa('0xd')]=_0x1d35f8;}return _0x752dbc[_0xbdaa('0xe')](_0x277b8b);};exports[_0xbdaa('0xf')]=function(_0x40e3c7){return new BPromise(function(_0x30d82c,_0x2bdabb){var _0x127fe0=0x0;if(_0x40e3c7['role']!==_0xbdaa('0x10')){_0x30d82c(_0x40e3c7);}db['User'][_0xbdaa('0x11')]({'where':{'role':_0xbdaa('0x10'),'online':!![],'id':{'$ne':_0x40e3c7['id']}}})[_0xbdaa('0x12')](function(_0x14fa50){_0x127fe0=_0x14fa50;return util['getLicense']();})[_0xbdaa('0x12')](function(_0x31c436){if(_0x31c436&&_0x31c436[_0xbdaa('0x13')]&&_0x127fe0>=_0x31c436[_0xbdaa('0x13')]){throw Error(_0xbdaa('0x14'));}_0x30d82c(_0x40e3c7);})[_0xbdaa('0x15')](function(_0x4c0902){_0x2bdabb(_0x4c0902);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index dc14c80..b9b337d 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbc23=['send','exports','404','status'];(function(_0x54bb22,_0x5e210e){var _0x233652=function(_0x10e916){while(--_0x10e916){_0x54bb22['push'](_0x54bb22['shift']());}};_0x233652(++_0x5e210e);}(_0xbc23,0x1bd));var _0x3bc2=function(_0x95086b,_0x1d1dba){_0x95086b=_0x95086b-0x0;var _0x1d672b=_0xbc23[_0x95086b];return _0x1d672b;};'use strict';module[_0x3bc2('0x0')][0x194]=function pageNotFound(_0x49a2ee,_0x52abda){var _0x44ecb0=_0x3bc2('0x1');var _0x473517=0x194;var _0x44738e={'status':_0x473517};_0x52abda[_0x3bc2('0x2')](_0x44738e[_0x3bc2('0x2')]);_0x52abda['render'](_0x44ecb0,{},function(_0x4b0f26,_0x1e9c2b){if(_0x4b0f26){return _0x52abda['status'](_0x44738e['status'])['json'](_0x44738e);}_0x52abda[_0x3bc2('0x3')](_0x1e9c2b);});}; \ No newline at end of file +var _0x5080=['404','status','json','send','exports'];(function(_0x375a22,_0x4c065d){var _0x573d9f=function(_0x3de1ac){while(--_0x3de1ac){_0x375a22['push'](_0x375a22['shift']());}};_0x573d9f(++_0x4c065d);}(_0x5080,0x158));var _0x0508=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x5080[_0x3bf83f];return _0x22c4a9;};'use strict';module[_0x0508('0x0')][0x194]=function pageNotFound(_0x30e691,_0x2cae60){var _0x573935=_0x0508('0x1');var _0x59d20d=0x194;var _0x4baaa9={'status':_0x59d20d};_0x2cae60['status'](_0x4baaa9[_0x0508('0x2')]);_0x2cae60['render'](_0x573935,{},function(_0x205dec,_0x381125){if(_0x205dec){return _0x2cae60[_0x0508('0x2')](_0x4baaa9[_0x0508('0x2')])[_0x0508('0x3')](_0x4baaa9);}_0x2cae60[_0x0508('0x4')](_0x381125);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index ec28f64..8df56bd 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c81=['MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappQueue/whatsappQueue.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','cascade','UserId','hasMany','UserVoiceQueueRt','VoiceQueuesRt','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteraction','SmsInteractions','MailInteractions','belongsTo','userProfileId','Groups','chat_group_has_users','belongsToMany','Contacts','cm_user_has_contacts','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteraction','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefix','MailQueues','UserMailQueue','ChatQueues','FaxQueue','FaxQueues','UserFaxQueue','SmsQueues','UserSmsQueue','OpenchannelQueues','WhatsappQueue','UserWhatsappQueue','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','user_has_openchannel_accounts','user_has_sms_accounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','VoiceChanSpy','SpiedAgents','ChanSpyId','Applications','VoiceMusicOnHold','Sounds','VoiceQueueId','Hoppers','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','Agents','voice_queues_has_cm_blacklists','ScreenRecording','VoiceMailMessage','mailboxuser','mailbox','VoiceCallReport','VoiceQueueReport','QueueCalls','uniqueid','AgentReports','ContactId','MailAccountId','MailServerOut','hasOne','Smtp','Dispositions','Messages','List','ListId','mandatoryDispositionPauseId','Teams','MailInteractionId','Contact','Owner','mail_interaction_has_tags','Tags','ThroughTags','Interaction','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','FaxAccountId','CannedAnswer','Answers','Interactions','FaxMessage','FaxInteractionId','Account','Users','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccount','OpenchannelAccountId','OpenchannelMessage','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','ChatMessage','OpenchannelQueueReport','Queue','ChatQueueId','chat_interaction_has_tags','ChatInteractionId','Attachments','team_has_chat_queues','ChatGroupId','Website','CompanyId','HopperHistories','FaxInteractions','Company','cm_contact_has_tags','CampaignId','OwnerId','All','AutomationAllId','Actions','AutomationId','Intervals','Extensions','MailApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','DefaultReportId','Mohs','fax_interaction_has_tags','whatsapp_interaction_has_tags','AllConditions','TriggerAllId','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','AccountId','Subjects','SubjectId','DescriptionId','FieldId','Subject','Description','Field','VariableId','Descriptions','DeskConfiguration','Configurations','int_desk_configuration_has_tags','ZohoField','ZohoAccount','ZendeskField','int_freshdesk_configuration_has_tags','FreshsalesConfiguration','ToId','SessionId','SmsQueueReport','JscriptyProject','ProjectId','team_has_mail_queues','WhatsappQueues','HopperBlacks','Lists','BlackLists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','FaxTransferReport','ToFaxQueueId','ToFaxAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','voice_queues_has_cm_lists','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappMessage','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','exports','../config/environment','sequelize','jstz','determine','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','sequelizeHistory','motion2','utf8_general_ci','database','username','password','options','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','Automation','../api/automation/automation.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model'];(function(_0x30df25,_0x125de3){var _0x4b1f18=function(_0x4a0582){while(--_0x4a0582){_0x30df25['push'](_0x30df25['shift']());}};_0x4b1f18(++_0x125de3);}(_0x3c81,0x102));var _0x13c8=function(_0x538caf,_0x8b0aee){_0x538caf=_0x538caf-0x0;var _0x33badb=_0x3c81[_0x538caf];return _0x33badb;};'use strict';var config=require(_0x13c8('0x0'));var Sequelize=require(_0x13c8('0x1'));var _=require('lodash');var jstz=require(_0x13c8('0x2'));var timezone=jstz[_0x13c8('0x3')]();config['sequelize']=_['defaultsDeep'](config['sequelize'],{'database':'motion2','username':_0x13c8('0x4'),'password':_0x13c8('0x5'),'options':{'host':_0x13c8('0x6'),'port':0xcea,'dialect':_0x13c8('0x7'),'dialectOptions':{'charset':_0x13c8('0x8')},'logging':![],'timezone':timezone[_0x13c8('0x9')](),'define':{'charset':_0x13c8('0xa'),'collate':'utf8_general_ci'}}});config[_0x13c8('0xb')]=_['defaultsDeep'](config[_0x13c8('0xb')],{'database':_0x13c8('0xc'),'username':_0x13c8('0x4'),'password':_0x13c8('0x5'),'options':{'host':_0x13c8('0x6'),'port':0xcea,'dialect':_0x13c8('0x7'),'dialectOptions':{'charset':_0x13c8('0x8')},'logging':![],'timezone':timezone[_0x13c8('0x9')](),'define':{'charset':_0x13c8('0xa'),'collate':_0x13c8('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x13c8('0x1')][_0x13c8('0xe')],config[_0x13c8('0x1')][_0x13c8('0xf')],config['sequelize'][_0x13c8('0x10')],config[_0x13c8('0x1')][_0x13c8('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x13c8('0xb')]['database'],config[_0x13c8('0xb')]['username'],config['sequelizeHistory']['password'],config[_0x13c8('0xb')]['options'])};db[_0x13c8('0x12')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x14'));db['VoiceChanSpy']=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x15'));db[_0x13c8('0x16')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x17'));db[_0x13c8('0x18')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x19'));db['VoiceMusicOnHold']=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x1a'));db[_0x13c8('0x1b')]=db['sequelize'][_0x13c8('0x13')](_0x13c8('0x1c'));db[_0x13c8('0x1d')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x1e'));db['ScreenRecording']=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x1f'));db[_0x13c8('0x20')]=db['sequelize'][_0x13c8('0x13')](_0x13c8('0x21'));db['VoiceMailMessage']=db['sequelize'][_0x13c8('0x13')](_0x13c8('0x22'));db['VoiceCallReport']=db['sequelize'][_0x13c8('0x13')](_0x13c8('0x23'));db['VoiceDialReport']=db['sequelize'][_0x13c8('0x13')]('../api/voiceDialReport/voiceDialReport.model');db['VoiceAgentReport']=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x24'));db['VoiceQueueReport']=db['sequelize'][_0x13c8('0x13')](_0x13c8('0x25'));db[_0x13c8('0x26')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x27'));db[_0x13c8('0x28')]=db['sequelize'][_0x13c8('0x13')](_0x13c8('0x29'));db['VoiceTransferReport']=db['sequelize'][_0x13c8('0x13')](_0x13c8('0x2a'));db['UserVoiceQueueRt']=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x13c8('0x2b')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x2c'));db[_0x13c8('0x2d')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x2e'));db['UserMailQueue']=db['sequelize'][_0x13c8('0x13')](_0x13c8('0x2f'));db['UserFaxQueue']=db[_0x13c8('0x1')]['import'](_0x13c8('0x30'));db['UserSmsQueue']=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x31'));db[_0x13c8('0x32')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x33'));db['UserWhatsappQueue']=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x13c8('0x34')]=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db['sequelize'][_0x13c8('0x13')](_0x13c8('0x35'));db[_0x13c8('0x36')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x37'));db[_0x13c8('0x38')]=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/mailQueue/mailQueue.model');db['MailSubstatus']=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x39'));db[_0x13c8('0x3a')]=db['sequelize'][_0x13c8('0x13')]('../api/mailInteraction/mailInteraction.model');db[_0x13c8('0x3b')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x3c'));db[_0x13c8('0x3d')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x3e'));db[_0x13c8('0x3f')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x40'));db[_0x13c8('0x41')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x42'));db[_0x13c8('0x43')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x44'));db[_0x13c8('0x45')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x46'));db[_0x13c8('0x47')]=db['sequelize'][_0x13c8('0x13')](_0x13c8('0x48'));db[_0x13c8('0x49')]=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/faxInteraction/faxInteraction.model');db['FaxMessage']=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x4a'));db['FaxQueue']=db['sequelize']['import'](_0x13c8('0x4b'));db['FaxQueueReport']=db[_0x13c8('0x1')]['import'](_0x13c8('0x4c'));db[_0x13c8('0x4d')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x4e'));db[_0x13c8('0x4f')]=db['sequelize'][_0x13c8('0x13')](_0x13c8('0x50'));db['SmsInteraction']=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x51'));db[_0x13c8('0x52')]=db[_0x13c8('0x1')]['import'](_0x13c8('0x53'));db[_0x13c8('0x54')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x55'));db['OpenchannelAccount']=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x56'));db[_0x13c8('0x57')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x58'));db[_0x13c8('0x59')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x5a'));db['OpenchannelMessage']=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x5b'));db[_0x13c8('0x5c')]=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/openchannelQueue/openchannelQueue.model');db[_0x13c8('0x5d')]=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/chatWebsite/chatWebsite.model');db['OpenchannelQueueReport']=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x13c8('0x5e')]=db[_0x13c8('0x1')]['import'](_0x13c8('0x5f'));db['ChatInteraction']=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x60'));db['ChatMessage']=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/chatMessage/chatMessage.model');db[_0x13c8('0x61')]=db['sequelize'][_0x13c8('0x13')](_0x13c8('0x62'));db[_0x13c8('0x63')]=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/chatQueue/chatQueue.model');db[_0x13c8('0x64')]=db['sequelize']['import']('../api/chatGroup/chatGroup.model');db['ChatProactiveAction']=db['sequelize'][_0x13c8('0x13')](_0x13c8('0x65'));db[_0x13c8('0x66')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x67'));db[_0x13c8('0x68')]=db['sequelize']['import'](_0x13c8('0x69'));db[_0x13c8('0x6a')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x6b'));db[_0x13c8('0x6c')]=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x13c8('0x6d')]=db[_0x13c8('0x1')]['import'](_0x13c8('0x6e'));db[_0x13c8('0x6f')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x70'));db[_0x13c8('0x71')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x72'));db[_0x13c8('0x73')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x74'));db[_0x13c8('0x75')]=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/action/action.model');db[_0x13c8('0x76')]=db['sequelize'][_0x13c8('0x13')](_0x13c8('0x77'));db['CannedAnswer']=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/cannedAnswer/cannedAnswer.model');db[_0x13c8('0x78')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x79'));db[_0x13c8('0x7a')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x7b'));db[_0x13c8('0x7c')]=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/interval/interval.model');db[_0x13c8('0x7d')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x7e'));db[_0x13c8('0x7f')]=db[_0x13c8('0x1')]['import'](_0x13c8('0x80'));db[_0x13c8('0x81')]=db[_0x13c8('0x1')]['import'](_0x13c8('0x82'));db[_0x13c8('0x83')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x84'));db[_0x13c8('0x85')]=db['sequelize'][_0x13c8('0x13')](_0x13c8('0x86'));db[_0x13c8('0x87')]=db[_0x13c8('0x1')]['import'](_0x13c8('0x88'));db[_0x13c8('0x89')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x8a'));db[_0x13c8('0x8b')]=db[_0x13c8('0x1')]['import'](_0x13c8('0x8c'));db[_0x13c8('0x8d')]=db[_0x13c8('0x1')]['import'](_0x13c8('0x8e'));db[_0x13c8('0x8f')]=db['sequelize']['import'](_0x13c8('0x90'));db['IntegrationReport']=db[_0x13c8('0x1')]['import'](_0x13c8('0x91'));db[_0x13c8('0x92')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x93'));db['AnalyticDefaultReport']=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x13c8('0x94')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x95'));db[_0x13c8('0x96')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x97'));db[_0x13c8('0x98')]=db[_0x13c8('0x1')]['import'](_0x13c8('0x99'));db[_0x13c8('0x9a')]=db['sequelize']['import'](_0x13c8('0x9b'));db[_0x13c8('0x9c')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x9d'));db[_0x13c8('0x9e')]=db['sequelize'][_0x13c8('0x13')](_0x13c8('0x9f'));db[_0x13c8('0xa0')]=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/intSalesforceField/intSalesforceField.model');db[_0x13c8('0xa1')]=db[_0x13c8('0x1')]['import'](_0x13c8('0xa2'));db[_0x13c8('0xa3')]=db['sequelize'][_0x13c8('0x13')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x13c8('0xa4')]=db['sequelize'][_0x13c8('0x13')](_0x13c8('0xa5'));db[_0x13c8('0xa6')]=db['sequelize'][_0x13c8('0x13')]('../api/intDeskAccount/intDeskAccount.model');db['DeskConfiguration']=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0xa7'));db[_0x13c8('0xa8')]=db['sequelize']['import'](_0x13c8('0xa9'));db['ZohoAccount']=db['sequelize'][_0x13c8('0x13')](_0x13c8('0xaa'));db[_0x13c8('0xab')]=db[_0x13c8('0x1')]['import'](_0x13c8('0xac'));db['ZohoField']=db['sequelize'][_0x13c8('0x13')](_0x13c8('0xad'));db[_0x13c8('0xae')]=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0x13c8('0xaf')]=db['sequelize'][_0x13c8('0x13')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db['ZendeskField']=db[_0x13c8('0x1')]['import'](_0x13c8('0xb0'));db[_0x13c8('0xb1')]=db['sequelize'][_0x13c8('0x13')](_0x13c8('0xb2'));db[_0x13c8('0xb3')]=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x13c8('0xb4')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0xb5'));db[_0x13c8('0xb6')]=db['sequelize']['import'](_0x13c8('0xb7'));db[_0x13c8('0xb8')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0xb9'));db[_0x13c8('0xba')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0xbb'));db[_0x13c8('0xbc')]=db['sequelize']['import'](_0x13c8('0xbd'));db[_0x13c8('0xbe')]=db['sequelize'][_0x13c8('0x13')](_0x13c8('0xbf'));db[_0x13c8('0xc0')]=db[_0x13c8('0x1')]['import'](_0x13c8('0xc1'));db[_0x13c8('0xc2')]=db[_0x13c8('0x1')]['import'](_0x13c8('0xc3'));db[_0x13c8('0xc4')]=db[_0x13c8('0x1')]['import'](_0x13c8('0xc5'));db[_0x13c8('0xc6')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0xc7'));db[_0x13c8('0xc8')]=db['sequelize']['import']('../api/intFreshsalesAccount/intFreshsalesAccount.model');db['FreshsalesConfiguration']=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0xc9'));db[_0x13c8('0xca')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0xcb'));db[_0x13c8('0x8f')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x90'));db['Network']=db['sequelize'][_0x13c8('0x13')](_0x13c8('0xcc'));db[_0x13c8('0xcd')]=db[_0x13c8('0x1')]['import'](_0x13c8('0xce'));db[_0x13c8('0xcf')]=db[_0x13c8('0x1')]['import']('../api/chatInternalMessage/chatInternalMessage.model');db['JscriptyAnswerReport']=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0xd0'));db[_0x13c8('0xd1')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0xd2'));db[_0x13c8('0xd3')]=db['sequelize'][_0x13c8('0x13')]('../api/jscriptySessionReport/jscriptySessionReport.model');db['SmsQueueReport']=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0xd4'));db[_0x13c8('0xd5')]=db['sequelize'][_0x13c8('0x13')]('../api/squareReport/squareReport.model');db[_0x13c8('0xd6')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0xd7'));db['JscriptyProject']=db[_0x13c8('0x1')]['import'](_0x13c8('0xd8'));db[_0x13c8('0xd9')]=db['sequelize']['import']('../api/setting/setting.model');db[_0x13c8('0xda')]=db[_0x13c8('0x1')]['import'](_0x13c8('0xdb'));db[_0x13c8('0xdc')]=db[_0x13c8('0x1')]['import'](_0x13c8('0xdd'));db['SquareRecording']=db['sequelize']['import'](_0x13c8('0xde'));db[_0x13c8('0xdf')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0xe0'));db[_0x13c8('0xe1')]=db['sequelize'][_0x13c8('0x13')]('../api/team/team.model');db['License']=db[_0x13c8('0x1')]['import'](_0x13c8('0xe2'));db[_0x13c8('0xe3')]=db['sequelize'][_0x13c8('0x13')](_0x13c8('0xe4'));db[_0x13c8('0xe5')]=db['sequelize'][_0x13c8('0x13')]('../api/migration/migration.model');db[_0x13c8('0xe6')]=db[_0x13c8('0x1')]['import'](_0x13c8('0xe7'));db['Plugin']=db['sequelize'][_0x13c8('0x13')](_0x13c8('0xe8'));db[_0x13c8('0xe9')]=db['sequelize'][_0x13c8('0x13')](_0x13c8('0xea'));db[_0x13c8('0xeb')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0xec'));db['FaxTransferReport']=db[_0x13c8('0x1')]['import'](_0x13c8('0xed'));db[_0x13c8('0xee')]=db['sequelize'][_0x13c8('0x13')](_0x13c8('0xef'));db['SmsTransferReport']=db['sequelize'][_0x13c8('0x13')](_0x13c8('0xf0'));db[_0x13c8('0xf1')]=db['sequelize']['import'](_0x13c8('0xf2'));db['VoicePrefix']=db['sequelize']['import'](_0x13c8('0xf3'));db[_0x13c8('0xf4')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0xf5'));db[_0x13c8('0xf6')]=db[_0x13c8('0x1')]['import']('../api/userProfileSection/userProfileSection.model');db[_0x13c8('0xf7')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0xf8'));db[_0x13c8('0xf9')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0xfa'));db[_0x13c8('0xfb')]=db['sequelize'][_0x13c8('0x13')](_0x13c8('0xfc'));db[_0x13c8('0xfd')]=db['sequelize'][_0x13c8('0x13')](_0x13c8('0xfe'));db['WhatsappInteraction']=db[_0x13c8('0x1')]['import']('../api/whatsappInteraction/whatsappInteraction.model');db['WhatsappMessage']=db['sequelize'][_0x13c8('0x13')]('../api/whatsappMessage/whatsappMessage.model');db[_0x13c8('0xff')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x100'));db['WhatsappTransferReport']=db[_0x13c8('0x1')]['import']('../api/whatsappTransferReport/whatsappTransferReport.model');db['WhatsappQueue']=db[_0x13c8('0x1')]['import'](_0x13c8('0x101'));db['CloudProvider']=db[_0x13c8('0x1')][_0x13c8('0x13')]('../api/cloudProvider/cloudProvider.model');db[_0x13c8('0x102')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x103'));db[_0x13c8('0x104')]=db[_0x13c8('0x1')][_0x13c8('0x13')](_0x13c8('0x105'));db[_0x13c8('0x106')]=db['sequelize'][_0x13c8('0x13')]('../api/userVoicePrefix/userVoicePrefix.model');db['User']['hasOne'](db[_0x13c8('0x20')],{'as':'VoiceMail','onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x108')});db['User'][_0x13c8('0x109')](db[_0x13c8('0x1d')],{'as':'Recordings','foreignKey':_0x13c8('0x108')});db[_0x13c8('0x12')]['hasMany'](db[_0x13c8('0x10a')],{'as':_0x13c8('0x10b'),'foreignKey':'UserId'});db[_0x13c8('0x12')][_0x13c8('0x109')](db[_0x13c8('0x18')],{'as':'Extensions','onDelete':'cascade','hooks':!![]});db['User'][_0x13c8('0x109')](db[_0x13c8('0x6d')],{'as':_0x13c8('0x10c'),'foreignKey':_0x13c8('0x108')});db[_0x13c8('0x12')][_0x13c8('0x109')](db[_0x13c8('0x6f')],{'as':_0x13c8('0x10d'),'foreignKey':_0x13c8('0x108')});db[_0x13c8('0x12')][_0x13c8('0x109')](db[_0x13c8('0x71')],{'as':_0x13c8('0x71'),'foreignKey':_0x13c8('0x108')});db['User']['hasMany'](db[_0x13c8('0x59')],{'as':_0x13c8('0x10e'),'foreignKey':_0x13c8('0x108')});db[_0x13c8('0x12')][_0x13c8('0x109')](db[_0x13c8('0x10f')],{'as':_0x13c8('0x110'),'foreignKey':'UserId'});db[_0x13c8('0x12')][_0x13c8('0x109')](db[_0x13c8('0x111')],{'as':_0x13c8('0x112'),'foreignKey':_0x13c8('0x108')});db[_0x13c8('0x12')][_0x13c8('0x109')](db[_0x13c8('0x49')],{'as':'FaxInteractions','foreignKey':_0x13c8('0x108')});db[_0x13c8('0x12')][_0x13c8('0x109')](db[_0x13c8('0x3a')],{'as':_0x13c8('0x113'),'foreignKey':_0x13c8('0x108')});db[_0x13c8('0x12')]['hasMany'](db['WhatsappInteraction'],{'as':'WhatsappInteractions','foreignKey':'UserId'});db[_0x13c8('0x12')][_0x13c8('0x109')](db[_0x13c8('0xf9')],{'as':'UserNotifications','foreignKey':'SenderId'});db['User'][_0x13c8('0x114')](db['UserProfile'],{'as':'UserProfile','foreignKey':_0x13c8('0x115')});db['User']['belongsToMany'](db['ChatGroup'],{'as':_0x13c8('0x116'),'through':_0x13c8('0x117')});db['User'][_0x13c8('0x118')](db[_0x13c8('0x68')],{'as':_0x13c8('0x119'),'through':_0x13c8('0x11a')});db[_0x13c8('0x12')][_0x13c8('0x118')](db[_0x13c8('0xf1')],{'as':'Lists','through':_0x13c8('0x11b')});db[_0x13c8('0x12')][_0x13c8('0x118')](db[_0x13c8('0xe1')],{'through':_0x13c8('0x11c')});db[_0x13c8('0x12')][_0x13c8('0x118')](db[_0x13c8('0x3a')],{'as':_0x13c8('0x113'),'through':_0x13c8('0x11d')});db[_0x13c8('0x12')][_0x13c8('0x118')](db[_0x13c8('0x10f')],{'as':'ChatInteractions','through':_0x13c8('0x11e')});db[_0x13c8('0x12')][_0x13c8('0x118')](db['FaxInteraction'],{'as':'FaxInteractions','through':_0x13c8('0x11f')});db['User'][_0x13c8('0x118')](db[_0x13c8('0x111')],{'as':_0x13c8('0x112'),'through':_0x13c8('0x120')});db['User'][_0x13c8('0x118')](db[_0x13c8('0x59')],{'as':_0x13c8('0x10e'),'through':_0x13c8('0x121')});db['User'][_0x13c8('0x118')](db[_0x13c8('0x122')],{'as':_0x13c8('0x123'),'through':_0x13c8('0x124')});db[_0x13c8('0x12')][_0x13c8('0x118')](db['VoiceQueue'],{'as':_0x13c8('0x125'),'through':'UserVoiceQueue','required':![]});db[_0x13c8('0x12')]['belongsToMany'](db[_0x13c8('0x126')],{'as':'VoicePrefixes','through':_0x13c8('0x106'),'required':![]});db[_0x13c8('0x12')][_0x13c8('0x118')](db['MailQueue'],{'as':_0x13c8('0x127'),'through':_0x13c8('0x128'),'required':![]});db[_0x13c8('0x12')]['belongsToMany'](db[_0x13c8('0x63')],{'as':_0x13c8('0x129'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0x13c8('0x12')][_0x13c8('0x118')](db[_0x13c8('0x12a')],{'as':_0x13c8('0x12b'),'through':_0x13c8('0x12c'),'required':![]});db[_0x13c8('0x12')][_0x13c8('0x118')](db[_0x13c8('0x54')],{'as':_0x13c8('0x12d'),'through':_0x13c8('0x12e'),'required':![]});db[_0x13c8('0x12')][_0x13c8('0x118')](db[_0x13c8('0x5c')],{'as':_0x13c8('0x12f'),'through':'UserOpenchannelQueue','required':![]});db[_0x13c8('0x12')][_0x13c8('0x118')](db[_0x13c8('0x130')],{'as':'WhatsappQueues','through':_0x13c8('0x131'),'required':![]});db[_0x13c8('0x12')]['belongsToMany'](db[_0x13c8('0xf1')],{'through':_0x13c8('0x11b')});db[_0x13c8('0x12')]['belongsToMany'](db[_0x13c8('0x5d')],{'as':'ChatWebsites','through':_0x13c8('0x132')});db[_0x13c8('0x12')]['belongsToMany'](db[_0x13c8('0x45')],{'as':_0x13c8('0x133'),'through':_0x13c8('0x134')});db['User'][_0x13c8('0x118')](db[_0x13c8('0x36')],{'as':'MailAccounts','through':'user_has_mail_accounts'});db[_0x13c8('0x12')][_0x13c8('0x118')](db['OpenchannelAccount'],{'as':'OpenchannelAccounts','through':_0x13c8('0x135')});db[_0x13c8('0x12')][_0x13c8('0x118')](db[_0x13c8('0x4d')],{'as':'SmsAccounts','through':_0x13c8('0x136')});db[_0x13c8('0x12')][_0x13c8('0x118')](db[_0x13c8('0xfb')],{'as':'WhatsappAccounts','through':_0x13c8('0x137')});db[_0x13c8('0x12')][_0x13c8('0x118')](db[_0x13c8('0xdc')],{'as':_0x13c8('0x138'),'through':_0x13c8('0x139')});db[_0x13c8('0x13a')][_0x13c8('0x109')](db[_0x13c8('0x18')],{'as':_0x13c8('0x13b'),'onDelete':'cascade','foreignKey':_0x13c8('0x13c')});db['VoiceContext'][_0x13c8('0x109')](db[_0x13c8('0x18')],{'onDelete':_0x13c8('0x107')});db[_0x13c8('0x18')][_0x13c8('0x109')](db['VoiceExtension'],{'as':_0x13c8('0x13d'),'onDelete':_0x13c8('0x107')});db[_0x13c8('0x13e')]['belongsToMany'](db[_0x13c8('0x85')],{'as':_0x13c8('0x13f'),'through':'moh_has_sounds'});db[_0x13c8('0x1b')]['hasMany'](db['UserVoiceQueueRt'],{'as':'Members','foreignKey':_0x13c8('0x140')});db[_0x13c8('0x1b')]['hasMany'](db[_0x13c8('0x6a')],{'as':_0x13c8('0x141'),'foreignKey':_0x13c8('0x140')});db[_0x13c8('0x1b')][_0x13c8('0x109')](db['CmHopperFinal'],{'as':_0x13c8('0x10c'),'foreignKey':_0x13c8('0x140')});db['VoiceQueue']['hasMany'](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0x13c8('0x140')});db[_0x13c8('0x1b')][_0x13c8('0x109')](db['ReportAgentPreview'],{'as':_0x13c8('0x71'),'foreignKey':'VoiceQueueId'});db[_0x13c8('0x1b')][_0x13c8('0x109')](db[_0x13c8('0x6c')],{'as':'HopperBlacks','foreignKey':_0x13c8('0x140')});db['VoiceQueue'][_0x13c8('0x109')](db['JscriptySessionReport'],{'as':_0x13c8('0x142'),'foreignKey':_0x13c8('0x140')});db['VoiceQueue'][_0x13c8('0x114')](db['Trunk'],{'as':_0x13c8('0x28'),'foreignKey':_0x13c8('0x143')});db[_0x13c8('0x1b')][_0x13c8('0x114')](db[_0x13c8('0x28')],{'as':_0x13c8('0x144'),'foreignKey':_0x13c8('0x145')});db[_0x13c8('0x1b')][_0x13c8('0x114')](db['Interval'],{'as':_0x13c8('0x7c'),'foreignKey':_0x13c8('0x146')});db[_0x13c8('0x1b')][_0x13c8('0x114')](db[_0x13c8('0x7d')],{'as':_0x13c8('0x147'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x13c8('0x1b')]['belongsToMany'](db['CmList'],{'as':'Lists','through':'voice_queues_has_cm_lists'});db[_0x13c8('0x1b')][_0x13c8('0x118')](db[_0x13c8('0x12')],{'as':_0x13c8('0x148'),'through':_0x13c8('0x2b')});db[_0x13c8('0x1b')]['belongsToMany'](db[_0x13c8('0xe1')],{'as':'Teams','through':'TeamVoiceQueue'});db[_0x13c8('0x1b')][_0x13c8('0x118')](db[_0x13c8('0xf1')],{'as':'BlackLists','through':_0x13c8('0x149')});db[_0x13c8('0x1d')]['belongsTo'](db[_0x13c8('0x12')],{'as':_0x13c8('0x12'),'foreignKey':_0x13c8('0x108')});db[_0x13c8('0x14a')][_0x13c8('0x114')](db[_0x13c8('0x12')],{'as':_0x13c8('0x12'),'foreignKey':_0x13c8('0x108')});db['VoiceMail'][_0x13c8('0x109')](db[_0x13c8('0x14b')],{'as':'Messages','onDelete':_0x13c8('0x107'),'foreignKey':'mailboxuser','sourceKey':'mailbox'});db[_0x13c8('0x14b')][_0x13c8('0x114')](db[_0x13c8('0x20')],{'foreignKey':_0x13c8('0x14c'),'targetKey':_0x13c8('0x14d')});db[_0x13c8('0x14e')][_0x13c8('0x109')](db[_0x13c8('0x14f')],{'as':_0x13c8('0x150'),'foreignKey':_0x13c8('0x151'),'constraints':![]});db[_0x13c8('0x14e')][_0x13c8('0x109')](db['VoiceAgentReport'],{'as':_0x13c8('0x152'),'foreignKey':'uniqueid','constraints':![]});db[_0x13c8('0x14e')][_0x13c8('0x114')](db[_0x13c8('0x12')],{'as':'User','foreignKey':_0x13c8('0x108')});db[_0x13c8('0x14e')]['belongsTo'](db[_0x13c8('0x68')],{'as':'Contact','foreignKey':_0x13c8('0x153')});db[_0x13c8('0x34')][_0x13c8('0x114')](db[_0x13c8('0x36')],{'as':_0x13c8('0x36'),'foreignKey':_0x13c8('0x154')});db[_0x13c8('0x155')][_0x13c8('0x114')](db[_0x13c8('0x36')],{'as':_0x13c8('0x36'),'foreignKey':_0x13c8('0x154')});db[_0x13c8('0x36')][_0x13c8('0x156')](db[_0x13c8('0x34')],{'as':'Imap','onDelete':_0x13c8('0x107')});db[_0x13c8('0x36')][_0x13c8('0x156')](db[_0x13c8('0x155')],{'as':_0x13c8('0x157'),'onDelete':'cascade'});db['MailAccount']['hasMany'](db[_0x13c8('0x78')],{'as':_0x13c8('0x158'),'foreignKey':_0x13c8('0x154'),'onDelete':_0x13c8('0x107')});db[_0x13c8('0x36')]['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x13c8('0x154')});db['MailAccount'][_0x13c8('0x109')](db['MailMessage'],{'as':_0x13c8('0x159'),'foreignKey':'MailAccountId'});db['MailAccount'][_0x13c8('0x109')](db[_0x13c8('0x3a')],{'as':'Interactions'});db[_0x13c8('0x36')][_0x13c8('0x109')](db[_0x13c8('0x3d')],{'as':_0x13c8('0x13d')});db[_0x13c8('0x36')]['belongsTo'](db[_0x13c8('0xf1')],{'as':_0x13c8('0x15a'),'foreignKey':_0x13c8('0x15b')});db[_0x13c8('0x36')][_0x13c8('0x114')](db['Template'],{'as':_0x13c8('0x89'),'foreignKey':'TemplateId'});db[_0x13c8('0x36')][_0x13c8('0x114')](db[_0x13c8('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x13c8('0x15c')});db[_0x13c8('0x36')][_0x13c8('0x118')](db['User'],{'as':'Agents','through':'user_has_mail_accounts'});db[_0x13c8('0x38')]['belongsToMany'](db[_0x13c8('0x12')],{'as':_0x13c8('0x148'),'through':_0x13c8('0x128')});db[_0x13c8('0x38')][_0x13c8('0x118')](db[_0x13c8('0xe1')],{'through':'team_has_mail_queues','as':_0x13c8('0x15d')});db[_0x13c8('0x3a')][_0x13c8('0x109')](db[_0x13c8('0x3b')],{'as':_0x13c8('0x159'),'onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x15e')});db[_0x13c8('0x3a')][_0x13c8('0x114')](db[_0x13c8('0x36')],{'as':'Account','foreignKey':'MailAccountId'});db['MailInteraction']['belongsTo'](db['CmContact'],{'as':_0x13c8('0x15f'),'foreignKey':_0x13c8('0x153')});db[_0x13c8('0x3a')][_0x13c8('0x114')](db[_0x13c8('0x12')],{'as':_0x13c8('0x160'),'foreignKey':_0x13c8('0x108')});db[_0x13c8('0x3a')]['belongsToMany'](db[_0x13c8('0x87')],{'through':_0x13c8('0x161'),'as':_0x13c8('0x162')});db['MailInteraction']['belongsToMany'](db[_0x13c8('0x87')],{'through':_0x13c8('0x161'),'as':_0x13c8('0x163')});db[_0x13c8('0x3a')][_0x13c8('0x118')](db[_0x13c8('0x12')],{'as':'Users','through':_0x13c8('0x11d'),'foreignKey':'MailInteractionId'});db[_0x13c8('0x3b')][_0x13c8('0x109')](db[_0x13c8('0xe6')],{'as':'Attachments','onDelete':_0x13c8('0x107')});db['MailMessage']['belongsTo'](db[_0x13c8('0x12')],{'as':_0x13c8('0x12')});db[_0x13c8('0x3b')][_0x13c8('0x114')](db[_0x13c8('0x68')],{'onDelete':_0x13c8('0x107'),'as':_0x13c8('0x15f')});db['MailMessage'][_0x13c8('0x114')](db[_0x13c8('0x3a')],{'as':_0x13c8('0x164'),'foreignKey':_0x13c8('0x15e')});db[_0x13c8('0x3b')][_0x13c8('0x114')](db[_0x13c8('0x36')],{'as':'Account','foreignKey':_0x13c8('0x154')});db[_0x13c8('0x3b')]['belongsTo'](db['ChatWebsite'],{'as':_0x13c8('0x5d'),'foreignKey':_0x13c8('0x165')});db[_0x13c8('0x3b')][_0x13c8('0x114')](db[_0x13c8('0x61')],{'as':_0x13c8('0x61'),'foreignKey':_0x13c8('0x166')});db[_0x13c8('0x3d')][_0x13c8('0x114')](db[_0x13c8('0x12')],{'onDelete':_0x13c8('0x167')});db[_0x13c8('0x3d')][_0x13c8('0x114')](db[_0x13c8('0x38')],{'onDelete':_0x13c8('0x167')});db[_0x13c8('0x3d')][_0x13c8('0x114')](db[_0x13c8('0x36')],{'onDelete':_0x13c8('0x167')});db[_0x13c8('0x3d')]['belongsTo'](db[_0x13c8('0x7c')],{'onDelete':_0x13c8('0x167'),'foreignKey':_0x13c8('0x146')});db[_0x13c8('0x3d')]['belongsTo'](db[_0x13c8('0x87')],{'onDelete':'restrict','foreignKey':_0x13c8('0x168')});db[_0x13c8('0x3f')][_0x13c8('0x114')](db[_0x13c8('0x36')],{});db['MailQueueReport'][_0x13c8('0x114')](db[_0x13c8('0xf1')],{'as':'List','foreignKey':_0x13c8('0x15b')});db[_0x13c8('0x3f')][_0x13c8('0x114')](db[_0x13c8('0x68')],{'as':'Contact','foreignKey':_0x13c8('0x153')});db[_0x13c8('0x3f')][_0x13c8('0x114')](db[_0x13c8('0x3a')],{});db[_0x13c8('0x3f')][_0x13c8('0x114')](db['MailMessage'],{});db[_0x13c8('0x3f')]['belongsTo'](db[_0x13c8('0x12')],{});db['MailQueueReport'][_0x13c8('0x114')](db[_0x13c8('0x38')],{});db['Dashboard'][_0x13c8('0x109')](db[_0x13c8('0x43')],{'as':'Items','onDelete':_0x13c8('0x107')});db[_0x13c8('0x45')][_0x13c8('0x109')](db['Disposition'],{'as':_0x13c8('0x158'),'foreignKey':_0x13c8('0x169'),'onDelete':_0x13c8('0x107')});db[_0x13c8('0x45')]['hasMany'](db[_0x13c8('0x16a')],{'as':_0x13c8('0x16b'),'foreignKey':_0x13c8('0x169')});db['FaxAccount'][_0x13c8('0x109')](db[_0x13c8('0x49')],{'as':_0x13c8('0x16c')});db['FaxAccount'][_0x13c8('0x109')](db[_0x13c8('0x47')],{'as':'Applications'});db['FaxAccount']['hasMany'](db[_0x13c8('0x18')],{'as':'Exntensions','onDelete':'cascade'});db[_0x13c8('0x45')][_0x13c8('0x109')](db['FaxMessage'],{'as':_0x13c8('0x159')});db[_0x13c8('0x45')]['belongsTo'](db[_0x13c8('0x28')],{'as':_0x13c8('0x28')});db[_0x13c8('0x45')][_0x13c8('0x114')](db[_0x13c8('0xf1')],{'as':_0x13c8('0x15a'),'foreignKey':_0x13c8('0x15b')});db['FaxAccount'][_0x13c8('0x114')](db[_0x13c8('0x7d')],{'as':_0x13c8('0x147'),'foreignKey':'mandatoryDispositionPauseId'});db['FaxAccount'][_0x13c8('0x118')](db[_0x13c8('0x12')],{'as':_0x13c8('0x148'),'through':_0x13c8('0x134')});db[_0x13c8('0x47')][_0x13c8('0x114')](db[_0x13c8('0x12')],{'onDelete':_0x13c8('0x167')});db[_0x13c8('0x47')][_0x13c8('0x114')](db[_0x13c8('0x12a')],{'onDelete':_0x13c8('0x167')});db[_0x13c8('0x47')][_0x13c8('0x114')](db[_0x13c8('0x45')],{'onDelete':_0x13c8('0x167')});db[_0x13c8('0x47')][_0x13c8('0x114')](db[_0x13c8('0x87')],{'onDelete':_0x13c8('0x167'),'foreignKey':_0x13c8('0x168')});db[_0x13c8('0x49')]['hasMany'](db[_0x13c8('0x16d')],{'as':_0x13c8('0x159'),'onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x16e')});db[_0x13c8('0x49')][_0x13c8('0x114')](db['FaxAccount'],{'as':_0x13c8('0x16f'),'foreignKey':_0x13c8('0x169')});db[_0x13c8('0x49')]['belongsTo'](db[_0x13c8('0x68')],{'as':_0x13c8('0x15f'),'foreignKey':_0x13c8('0x153')});db[_0x13c8('0x49')][_0x13c8('0x114')](db['User'],{'as':_0x13c8('0x160'),'foreignKey':_0x13c8('0x108')});db[_0x13c8('0x49')][_0x13c8('0x118')](db[_0x13c8('0x87')],{'through':'fax_interaction_has_tags','as':_0x13c8('0x162')});db[_0x13c8('0x49')][_0x13c8('0x118')](db[_0x13c8('0x87')],{'through':'fax_interaction_has_tags','as':_0x13c8('0x163')});db[_0x13c8('0x49')]['belongsToMany'](db['User'],{'as':_0x13c8('0x170'),'through':'user_has_fax_interactions','foreignKey':_0x13c8('0x16e')});db[_0x13c8('0x16d')][_0x13c8('0x114')](db[_0x13c8('0x12')],{'onDelete':_0x13c8('0x107'),'as':_0x13c8('0x12')});db[_0x13c8('0x16d')][_0x13c8('0x114')](db[_0x13c8('0x49')],{'as':_0x13c8('0x164'),'foreignKey':_0x13c8('0x16e')});db[_0x13c8('0x16d')][_0x13c8('0x114')](db[_0x13c8('0x68')],{'onDelete':'cascade','as':_0x13c8('0x15f')});db[_0x13c8('0x16d')][_0x13c8('0x114')](db[_0x13c8('0xe6')],{'as':_0x13c8('0xe6'),'foreignKey':_0x13c8('0x171')});db[_0x13c8('0x16d')][_0x13c8('0x114')](db[_0x13c8('0x45')],{'as':_0x13c8('0x16f'),'foreignKey':_0x13c8('0x169')});db[_0x13c8('0x12a')]['belongsToMany'](db[_0x13c8('0x12')],{'as':_0x13c8('0x148'),'through':_0x13c8('0x12c')});db[_0x13c8('0x12a')][_0x13c8('0x118')](db['Team'],{'through':_0x13c8('0x172'),'as':'Teams'});db['FaxQueueReport'][_0x13c8('0x114')](db[_0x13c8('0x45')],{});db[_0x13c8('0x173')][_0x13c8('0x114')](db[_0x13c8('0xf1')],{'as':_0x13c8('0x15a'),'foreignKey':_0x13c8('0x15b')});db[_0x13c8('0x173')][_0x13c8('0x114')](db[_0x13c8('0x68')],{'as':_0x13c8('0x15f'),'foreignKey':'ContactId'});db[_0x13c8('0x173')][_0x13c8('0x114')](db[_0x13c8('0x49')],{});db[_0x13c8('0x173')]['belongsTo'](db[_0x13c8('0x16d')],{});db[_0x13c8('0x173')][_0x13c8('0x114')](db[_0x13c8('0x12')],{});db['FaxQueueReport']['belongsTo'](db[_0x13c8('0x12a')],{});db[_0x13c8('0x4d')]['hasMany'](db[_0x13c8('0x78')],{'as':'Dispositions','foreignKey':'SmsAccountId','onDelete':'cascade'});db[_0x13c8('0x4d')]['hasMany'](db[_0x13c8('0x16a')],{'as':_0x13c8('0x16b'),'foreignKey':_0x13c8('0x174')});db['SmsAccount'][_0x13c8('0x109')](db[_0x13c8('0x52')],{'as':_0x13c8('0x159'),'foreignKey':'SmsAccountId'});db[_0x13c8('0x4d')][_0x13c8('0x109')](db[_0x13c8('0x111')],{'as':_0x13c8('0x16c')});db['SmsAccount']['hasMany'](db['SmsApplication'],{'as':'Applications'});db[_0x13c8('0x4d')][_0x13c8('0x114')](db[_0x13c8('0xf1')],{'as':'List','foreignKey':_0x13c8('0x15b')});db[_0x13c8('0x4d')]['belongsTo'](db[_0x13c8('0x7d')],{'as':_0x13c8('0x147'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x13c8('0x4d')][_0x13c8('0x118')](db[_0x13c8('0x12')],{'as':_0x13c8('0x148'),'through':_0x13c8('0x136')});db[_0x13c8('0x4f')][_0x13c8('0x114')](db['User'],{'onDelete':_0x13c8('0x167')});db[_0x13c8('0x4f')][_0x13c8('0x114')](db['SmsQueue'],{'onDelete':'restrict'});db['SmsApplication']['belongsTo'](db['SmsAccount'],{'onDelete':_0x13c8('0x167')});db[_0x13c8('0x4f')][_0x13c8('0x114')](db[_0x13c8('0x7c')],{'onDelete':_0x13c8('0x167'),'foreignKey':_0x13c8('0x146')});db['SmsApplication'][_0x13c8('0x114')](db['Tag'],{'onDelete':_0x13c8('0x167'),'foreignKey':_0x13c8('0x168')});db[_0x13c8('0x111')][_0x13c8('0x109')](db['SmsMessage'],{'as':_0x13c8('0x159'),'onDelete':'cascade','foreignKey':_0x13c8('0x175')});db[_0x13c8('0x111')]['belongsTo'](db[_0x13c8('0x4d')],{'as':_0x13c8('0x16f'),'foreignKey':'SmsAccountId'});db[_0x13c8('0x111')][_0x13c8('0x114')](db[_0x13c8('0x68')],{'as':_0x13c8('0x15f'),'foreignKey':'ContactId'});db[_0x13c8('0x111')][_0x13c8('0x114')](db[_0x13c8('0x12')],{'as':'Owner','foreignKey':_0x13c8('0x108')});db[_0x13c8('0x111')][_0x13c8('0x118')](db[_0x13c8('0x87')],{'through':_0x13c8('0x176'),'as':_0x13c8('0x162')});db['SmsInteraction'][_0x13c8('0x118')](db[_0x13c8('0x87')],{'through':_0x13c8('0x176'),'as':_0x13c8('0x163')});db['SmsInteraction']['belongsToMany'](db[_0x13c8('0x12')],{'as':'Users','through':_0x13c8('0x120'),'foreignKey':_0x13c8('0x175')});db['SmsMessage']['belongsTo'](db['User'],{'as':_0x13c8('0x12')});db['SmsMessage'][_0x13c8('0x114')](db[_0x13c8('0x68')],{'onDelete':_0x13c8('0x107'),'as':_0x13c8('0x15f')});db[_0x13c8('0x52')][_0x13c8('0x114')](db[_0x13c8('0x111')],{'onDelete':_0x13c8('0x107'),'as':_0x13c8('0x164'),'foreignKey':'SmsInteractionId'});db['SmsMessage'][_0x13c8('0x114')](db[_0x13c8('0x4d')],{'as':'Account','foreignKey':_0x13c8('0x174')});db[_0x13c8('0x54')][_0x13c8('0x118')](db[_0x13c8('0x12')],{'as':_0x13c8('0x148'),'through':_0x13c8('0x12e'),'foreignKey':_0x13c8('0x177')});db[_0x13c8('0x54')][_0x13c8('0x118')](db['Team'],{'through':_0x13c8('0x178'),'as':_0x13c8('0x15d')});db[_0x13c8('0x179')][_0x13c8('0x109')](db['Disposition'],{'as':_0x13c8('0x158'),'foreignKey':'OpenchannelAccountId','onDelete':_0x13c8('0x107')});db[_0x13c8('0x179')][_0x13c8('0x109')](db[_0x13c8('0x16a')],{'as':_0x13c8('0x16b'),'foreignKey':_0x13c8('0x17a')});db[_0x13c8('0x179')][_0x13c8('0x109')](db[_0x13c8('0x59')],{'as':_0x13c8('0x16c'),'foreignKey':_0x13c8('0x17a')});db[_0x13c8('0x179')]['hasMany'](db[_0x13c8('0x17b')],{'as':_0x13c8('0x159'),'foreignKey':_0x13c8('0x17a')});db['OpenchannelAccount'][_0x13c8('0x109')](db[_0x13c8('0x57')],{'as':'Applications','foreignKey':_0x13c8('0x17a')});db[_0x13c8('0x179')]['belongsTo'](db[_0x13c8('0xf1')],{'as':_0x13c8('0x15a'),'foreignKey':_0x13c8('0x15b')});db[_0x13c8('0x179')][_0x13c8('0x114')](db[_0x13c8('0x7d')],{'as':_0x13c8('0x147'),'foreignKey':_0x13c8('0x15c')});db[_0x13c8('0x179')][_0x13c8('0x118')](db['User'],{'as':_0x13c8('0x148'),'through':_0x13c8('0x135')});db[_0x13c8('0x57')]['belongsTo'](db[_0x13c8('0x12')],{'onDelete':_0x13c8('0x167')});db[_0x13c8('0x57')][_0x13c8('0x114')](db[_0x13c8('0x5c')],{'onDelete':_0x13c8('0x167'),'foreignKey':_0x13c8('0x17c')});db['OpenchannelApplication']['belongsTo'](db['OpenchannelAccount'],{'onDelete':_0x13c8('0x167'),'foreignKey':_0x13c8('0x17a')});db['OpenchannelApplication'][_0x13c8('0x114')](db[_0x13c8('0x7c')],{'onDelete':_0x13c8('0x167'),'foreignKey':_0x13c8('0x146')});db['OpenchannelApplication'][_0x13c8('0x114')](db[_0x13c8('0x87')],{'onDelete':_0x13c8('0x167'),'foreignKey':'TagId'});db[_0x13c8('0x59')]['hasMany'](db[_0x13c8('0x17b')],{'as':'Messages','onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x17d')});db[_0x13c8('0x59')][_0x13c8('0x114')](db[_0x13c8('0x179')],{'as':'Account','foreignKey':_0x13c8('0x17a')});db['OpenchannelInteraction'][_0x13c8('0x114')](db[_0x13c8('0x68')],{'as':'Contact','foreignKey':'ContactId'});db[_0x13c8('0x59')]['belongsTo'](db[_0x13c8('0x12')],{'as':_0x13c8('0x160'),'foreignKey':_0x13c8('0x108')});db['OpenchannelInteraction'][_0x13c8('0x118')](db[_0x13c8('0x87')],{'through':_0x13c8('0x17e'),'as':'Tags'});db[_0x13c8('0x59')][_0x13c8('0x118')](db[_0x13c8('0x87')],{'through':_0x13c8('0x17e'),'as':'ThroughTags'});db[_0x13c8('0x59')]['belongsToMany'](db[_0x13c8('0x12')],{'as':_0x13c8('0x170'),'through':'user_has_openchannel_interactions','foreignKey':'OpenchannelInteractionId'});db[_0x13c8('0x17b')][_0x13c8('0x114')](db[_0x13c8('0x12')],{'onDelete':'cascade','as':'User'});db['OpenchannelMessage'][_0x13c8('0x114')](db[_0x13c8('0x68')],{'onDelete':_0x13c8('0x107'),'as':_0x13c8('0x15f')});db[_0x13c8('0x17b')][_0x13c8('0x114')](db[_0x13c8('0x59')],{'onDelete':_0x13c8('0x107'),'as':'Interaction','foreignKey':_0x13c8('0x17d')});db[_0x13c8('0x17b')][_0x13c8('0x114')](db['Attachment'],{'as':_0x13c8('0xe6'),'foreignKey':'AttachmentId'});db[_0x13c8('0x17b')]['belongsTo'](db[_0x13c8('0x179')],{'as':'Account','foreignKey':_0x13c8('0x17a')});db[_0x13c8('0x5c')][_0x13c8('0x118')](db[_0x13c8('0x12')],{'as':_0x13c8('0x148'),'through':_0x13c8('0x32'),'foreignKey':_0x13c8('0x17c')});db['OpenchannelQueue'][_0x13c8('0x118')](db[_0x13c8('0xe1')],{'through':_0x13c8('0x17f'),'as':_0x13c8('0x15d')});db[_0x13c8('0x5d')][_0x13c8('0x109')](db[_0x13c8('0x78')],{'as':_0x13c8('0x158'),'foreignKey':_0x13c8('0x165'),'onDelete':'cascade'});db[_0x13c8('0x5d')]['hasMany'](db[_0x13c8('0x16a')],{'as':_0x13c8('0x16b'),'foreignKey':_0x13c8('0x165')});db['ChatWebsite'][_0x13c8('0x109')](db[_0x13c8('0x180')],{'as':_0x13c8('0x181')});db[_0x13c8('0x5d')]['hasMany'](db['ChatInteraction'],{'as':_0x13c8('0x16c')});db['ChatWebsite'][_0x13c8('0x109')](db[_0x13c8('0x5e')],{'as':'Applications'});db['ChatWebsite']['hasMany'](db[_0x13c8('0x182')],{'as':_0x13c8('0x159')});db[_0x13c8('0x5d')]['belongsTo'](db['CmList'],{'as':_0x13c8('0x15a'),'foreignKey':_0x13c8('0x15b')});db[_0x13c8('0x5d')][_0x13c8('0x114')](db[_0x13c8('0x7c')],{'as':'Interval','foreignKey':_0x13c8('0x146')});db[_0x13c8('0x5d')][_0x13c8('0x114')](db[_0x13c8('0x36')],{'as':_0x13c8('0x36'),'foreignKey':_0x13c8('0x154')});db['ChatWebsite'][_0x13c8('0x114')](db['Pause'],{'as':_0x13c8('0x147'),'foreignKey':'mandatoryDispositionPauseId'});db['ChatWebsite'][_0x13c8('0x118')](db[_0x13c8('0x12')],{'as':'Agents','through':'user_has_chat_websites'});db[_0x13c8('0x183')][_0x13c8('0x114')](db['OpenchannelAccount'],{});db[_0x13c8('0x183')][_0x13c8('0x114')](db[_0x13c8('0xf1')],{'as':_0x13c8('0x15a'),'foreignKey':'ListId'});db[_0x13c8('0x183')][_0x13c8('0x114')](db['CmContact'],{'as':_0x13c8('0x15f'),'foreignKey':_0x13c8('0x153')});db['OpenchannelQueueReport'][_0x13c8('0x114')](db[_0x13c8('0x59')],{});db[_0x13c8('0x183')][_0x13c8('0x114')](db['OpenchannelMessage'],{});db[_0x13c8('0x183')]['belongsTo'](db[_0x13c8('0x12')],{});db[_0x13c8('0x183')][_0x13c8('0x114')](db[_0x13c8('0x5c')],{});db['ChatApplication'][_0x13c8('0x114')](db[_0x13c8('0x12')],{'as':'Agent','foreignKey':'UserId','onDelete':'restrict'});db[_0x13c8('0x5e')][_0x13c8('0x114')](db[_0x13c8('0x63')],{'as':_0x13c8('0x184'),'foreignKey':_0x13c8('0x185'),'onDelete':_0x13c8('0x167')});db[_0x13c8('0x5e')][_0x13c8('0x114')](db[_0x13c8('0x5d')],{'as':'Website','foreignKey':'ChatWebsiteId','onDelete':_0x13c8('0x167')});db[_0x13c8('0x5e')][_0x13c8('0x114')](db[_0x13c8('0x87')],{'onDelete':_0x13c8('0x167'),'foreignKey':_0x13c8('0x168')});db['ChatInteraction'][_0x13c8('0x109')](db['ChatMessage'],{'as':_0x13c8('0x159'),'onDelete':_0x13c8('0x107'),'foreignKey':'ChatInteractionId'});db['ChatInteraction'][_0x13c8('0x114')](db[_0x13c8('0x5d')],{'as':_0x13c8('0x16f'),'foreignKey':_0x13c8('0x165')});db[_0x13c8('0x10f')][_0x13c8('0x114')](db[_0x13c8('0x68')],{'as':'Contact','foreignKey':_0x13c8('0x153')});db[_0x13c8('0x10f')]['belongsTo'](db['User'],{'as':_0x13c8('0x160'),'foreignKey':'UserId'});db['ChatInteraction'][_0x13c8('0x118')](db[_0x13c8('0x87')],{'through':'chat_interaction_has_tags','as':_0x13c8('0x162')});db[_0x13c8('0x10f')]['belongsToMany'](db[_0x13c8('0x87')],{'through':_0x13c8('0x186'),'as':'ThroughTags'});db['ChatInteraction'][_0x13c8('0x118')](db[_0x13c8('0x12')],{'as':'Users','through':_0x13c8('0x11e'),'foreignKey':_0x13c8('0x187')});db[_0x13c8('0x182')]['belongsTo'](db[_0x13c8('0x12')],{'onDelete':_0x13c8('0x107'),'as':_0x13c8('0x12')});db['ChatMessage'][_0x13c8('0x114')](db[_0x13c8('0x68')],{'onDelete':_0x13c8('0x107'),'as':'Contact','foreignKey':_0x13c8('0x153')});db[_0x13c8('0x182')][_0x13c8('0x114')](db['ChatInteraction'],{'onDelete':_0x13c8('0x107'),'as':_0x13c8('0x164'),'foreignKey':_0x13c8('0x187')});db[_0x13c8('0x182')][_0x13c8('0x114')](db[_0x13c8('0xe6')],{'as':'Attachment','foreignKey':_0x13c8('0x171')});db[_0x13c8('0x182')][_0x13c8('0x114')](db['ChatWebsite'],{'as':_0x13c8('0x16f'),'foreignKey':'ChatWebsiteId'});db[_0x13c8('0x61')][_0x13c8('0x109')](db['Attachment'],{'as':_0x13c8('0x188'),'foreignKey':_0x13c8('0x166'),'onDelete':_0x13c8('0x107'),'hooks':!![]});db[_0x13c8('0x61')][_0x13c8('0x114')](db['CmContact'],{'onDelete':'cascade','as':_0x13c8('0x15f'),'foreignKey':_0x13c8('0x153')});db[_0x13c8('0x61')][_0x13c8('0x114')](db['ChatWebsite'],{'as':_0x13c8('0x16f'),'foreignKey':_0x13c8('0x165')});db[_0x13c8('0x63')][_0x13c8('0x118')](db['User'],{'as':_0x13c8('0x148'),'through':_0x13c8('0x2d'),'hooks':!![]});db[_0x13c8('0x63')][_0x13c8('0x118')](db[_0x13c8('0xe1')],{'through':_0x13c8('0x189'),'as':_0x13c8('0x15d')});db[_0x13c8('0x64')]['hasMany'](db[_0x13c8('0xcf')],{'as':'Messages','foreignKey':_0x13c8('0x18a'),'onDelete':_0x13c8('0x107')});db[_0x13c8('0x64')][_0x13c8('0x118')](db[_0x13c8('0x12')],{'as':'Members','through':'chat_group_has_users'});db[_0x13c8('0x180')]['belongsTo'](db[_0x13c8('0x5d')],{'as':_0x13c8('0x18b'),'foreignKey':'ChatWebsiteId'});db[_0x13c8('0x66')]['hasMany'](db[_0x13c8('0x68')],{'as':'Contacts','foreignKey':_0x13c8('0x18c')});db['CmContact']['hasMany'](db[_0x13c8('0x6a')],{'as':_0x13c8('0x141'),'foreignKey':_0x13c8('0x153')});db[_0x13c8('0x68')][_0x13c8('0x109')](db[_0x13c8('0x6d')],{'as':'HopperFinals','foreignKey':_0x13c8('0x153')});db['CmContact'][_0x13c8('0x109')](db[_0x13c8('0x6f')],{'as':_0x13c8('0x18d'),'foreignKey':_0x13c8('0x153')});db['CmContact'][_0x13c8('0x109')](db[_0x13c8('0x71')],{'as':'ReportAgentPreview','foreignKey':_0x13c8('0x153')});db[_0x13c8('0x68')]['hasMany'](db['JscriptySessionReport'],{'as':_0x13c8('0x142'),'foreignKey':_0x13c8('0x153')});db[_0x13c8('0x68')][_0x13c8('0x109')](db[_0x13c8('0x59')],{'as':_0x13c8('0x10e'),'foreignKey':_0x13c8('0x153'),'onDelete':'restrict'});db[_0x13c8('0x68')][_0x13c8('0x109')](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':'ContactId','onDelete':_0x13c8('0x167')});db['CmContact'][_0x13c8('0x109')](db[_0x13c8('0x111')],{'as':_0x13c8('0x112'),'foreignKey':_0x13c8('0x153'),'onDelete':_0x13c8('0x167')});db[_0x13c8('0x68')][_0x13c8('0x109')](db[_0x13c8('0x49')],{'as':_0x13c8('0x18e'),'foreignKey':_0x13c8('0x153'),'onDelete':'restrict'});db[_0x13c8('0x68')][_0x13c8('0x109')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0x13c8('0x153'),'onDelete':_0x13c8('0x167')});db['CmContact'][_0x13c8('0x114')](db['CmCompany'],{'as':_0x13c8('0x18f'),'foreignKey':_0x13c8('0x18c')});db['CmContact']['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x13c8('0x15b'),'onDelete':'cascade'});db[_0x13c8('0x68')][_0x13c8('0x118')](db[_0x13c8('0x12')],{'as':'Users','through':_0x13c8('0x11a')});db[_0x13c8('0x68')][_0x13c8('0x118')](db[_0x13c8('0x87')],{'as':_0x13c8('0x162'),'through':_0x13c8('0x190')});db['CmContact'][_0x13c8('0x118')](db[_0x13c8('0x87')],{'through':_0x13c8('0x190'),'as':_0x13c8('0x163')});db[_0x13c8('0x6a')]['belongsTo'](db[_0x13c8('0x68')],{'as':_0x13c8('0x15f'),'foreignKey':'ContactId','onDelete':'cascade'});db['CmHopper'][_0x13c8('0x114')](db[_0x13c8('0xf1')],{'as':_0x13c8('0x15a'),'foreignKey':_0x13c8('0x15b'),'onDelete':_0x13c8('0x107')});db[_0x13c8('0x6a')]['belongsTo'](db[_0x13c8('0x12')],{'as':'Agent','foreignKey':_0x13c8('0x108')});db[_0x13c8('0x6a')][_0x13c8('0x114')](db[_0x13c8('0x1b')],{'as':_0x13c8('0x184'),'foreignKey':_0x13c8('0x140'),'onDelete':_0x13c8('0x107')});db[_0x13c8('0x6a')][_0x13c8('0x114')](db['Campaign'],{'as':_0x13c8('0xe3'),'foreignKey':_0x13c8('0x191'),'onDelete':'cascade'});db[_0x13c8('0x6a')][_0x13c8('0x114')](db['User'],{'as':_0x13c8('0x160'),'foreignKey':_0x13c8('0x192')});db['CmHopperBlack'][_0x13c8('0x114')](db[_0x13c8('0x68')],{'as':'Contact','foreignKey':'ContactId','onDelete':_0x13c8('0x107')});db[_0x13c8('0x6c')][_0x13c8('0x114')](db[_0x13c8('0xf1')],{'as':_0x13c8('0x15a'),'foreignKey':_0x13c8('0x15b'),'onDelete':_0x13c8('0x107')});db['CmHopperBlack'][_0x13c8('0x114')](db[_0x13c8('0x1b')],{'as':_0x13c8('0x184'),'foreignKey':_0x13c8('0x140'),'onDelete':'cascade'});db['CmHopperBlack'][_0x13c8('0x114')](db[_0x13c8('0xe3')],{'as':_0x13c8('0xe3'),'foreignKey':_0x13c8('0x191'),'onDelete':'cascade'});db[_0x13c8('0x76')][_0x13c8('0x109')](db[_0x13c8('0x7a')],{'as':{'plural':_0x13c8('0x193'),'singular':'OneAll'},'foreignKey':_0x13c8('0x194'),'onDelete':_0x13c8('0x107'),'hooks':!![]});db[_0x13c8('0x76')][_0x13c8('0x109')](db['Condition'],{'as':{'plural':'Any','singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':_0x13c8('0x107'),'hooks':!![]});db[_0x13c8('0x76')][_0x13c8('0x109')](db['Action'],{'as':_0x13c8('0x195'),'foreignKey':_0x13c8('0x196'),'onDelete':_0x13c8('0x107'),'hooks':!![]});db[_0x13c8('0x78')]['hasMany'](db[_0x13c8('0x78')],{'as':_0x13c8('0x158'),'foreignKey':'ParentId','onDelete':_0x13c8('0x107')});db[_0x13c8('0x7c')][_0x13c8('0x109')](db[_0x13c8('0x7c')],{'as':_0x13c8('0x197'),'foreignKey':_0x13c8('0x146'),'onDelete':_0x13c8('0x107'),'hooks':!![],'required':![]});db[_0x13c8('0x7c')][_0x13c8('0x109')](db[_0x13c8('0x18')],{'as':_0x13c8('0x198'),'foreignKey':_0x13c8('0x146'),'onDelete':_0x13c8('0x167')});db['Interval'][_0x13c8('0x109')](db[_0x13c8('0x3d')],{'as':_0x13c8('0x199'),'foreignKey':_0x13c8('0x146')});db[_0x13c8('0x7c')][_0x13c8('0x109')](db[_0x13c8('0x5e')],{'as':'ChatApplications','foreignKey':_0x13c8('0x146')});db[_0x13c8('0x7c')][_0x13c8('0x109')](db[_0x13c8('0x47')],{'as':_0x13c8('0x19a'),'foreignKey':'IntervalId'});db[_0x13c8('0x7c')]['hasMany'](db[_0x13c8('0x4f')],{'as':_0x13c8('0x19b'),'foreignKey':'IntervalId'});db[_0x13c8('0x83')][_0x13c8('0x114')](db[_0x13c8('0x36')],{});db[_0x13c8('0x83')][_0x13c8('0x114')](db[_0x13c8('0x19c')],{'foreignKey':_0x13c8('0x19d')});db[_0x13c8('0x83')]['belongsTo'](db[_0x13c8('0x92')],{'foreignKey':'CustomReportId'});db[_0x13c8('0x85')]['belongsToMany'](db['VoiceMusicOnHold'],{'as':_0x13c8('0x19e'),'through':'moh_has_sounds','onDelete':'restrict'});db[_0x13c8('0x87')][_0x13c8('0x118')](db[_0x13c8('0x68')],{'through':_0x13c8('0x190')});db[_0x13c8('0x87')]['belongsToMany'](db[_0x13c8('0x10f')],{'through':_0x13c8('0x186')});db[_0x13c8('0x87')]['belongsToMany'](db['MailInteraction'],{'through':_0x13c8('0x161')});db[_0x13c8('0x87')]['belongsToMany'](db[_0x13c8('0x111')],{'through':'sms_interaction_has_tags'});db[_0x13c8('0x87')][_0x13c8('0x118')](db[_0x13c8('0x49')],{'through':_0x13c8('0x19f')});db[_0x13c8('0x87')][_0x13c8('0x118')](db[_0x13c8('0x59')],{'through':_0x13c8('0x17e')});db[_0x13c8('0x87')][_0x13c8('0x118')](db['WhatsappInteraction'],{'through':_0x13c8('0x1a0')});db['Trigger'][_0x13c8('0x109')](db[_0x13c8('0x7a')],{'as':{'plural':_0x13c8('0x1a1'),'singular':'AllCondition'},'foreignKey':_0x13c8('0x1a2'),'onDelete':_0x13c8('0x107'),'hooks':!![]});db['Trigger'][_0x13c8('0x109')](db[_0x13c8('0x7a')],{'as':{'plural':'AnyConditions','singular':_0x13c8('0x1a3')},'foreignKey':_0x13c8('0x1a4'),'onDelete':_0x13c8('0x107'),'hooks':!![]});db[_0x13c8('0x8b')][_0x13c8('0x109')](db[_0x13c8('0x75')],{'as':_0x13c8('0x195'),'foreignKey':_0x13c8('0x1a5'),'onDelete':'cascade','hooks':!![]});db[_0x13c8('0x92')]['hasMany'](db[_0x13c8('0x98')],{'as':_0x13c8('0x1a6'),'onDelete':_0x13c8('0x107'),'foreignKey':'CustomReportId','hooks':!![]});db[_0x13c8('0x19c')][_0x13c8('0x109')](db[_0x13c8('0x98')],{'as':_0x13c8('0x1a6'),'onDelete':_0x13c8('0x107'),'foreignKey':'DefaultReportId'});db[_0x13c8('0x96')][_0x13c8('0x109')](db[_0x13c8('0x98')],{'as':_0x13c8('0x1a6'),'onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x1a7')});db[_0x13c8('0x98')]['belongsTo'](db['AnalyticMetric'],{'foreignKey':'MetricId'});db[_0x13c8('0x9c')][_0x13c8('0x109')](db['SalesforceConfiguration'],{'as':'Configurations','onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x1a8')});db[_0x13c8('0x9e')][_0x13c8('0x109')](db[_0x13c8('0xa0')],{'as':_0x13c8('0x1a9'),'onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x1aa')});db[_0x13c8('0x9e')][_0x13c8('0x109')](db[_0x13c8('0xa0')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x13c8('0x1ab')});db[_0x13c8('0x9e')]['hasMany'](db['SalesforceField'],{'as':_0x13c8('0x1a6'),'onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x1ac')});db['SalesforceConfiguration'][_0x13c8('0x114')](db[_0x13c8('0x9c')],{'as':_0x13c8('0x16f'),'foreignKey':_0x13c8('0x1a8')});db[_0x13c8('0xa0')][_0x13c8('0x109')](db[_0x13c8('0xa0')],{'as':_0x13c8('0x1ad'),'foreignKey':_0x13c8('0x1aa')});db[_0x13c8('0xa0')][_0x13c8('0x109')](db['SalesforceField'],{'as':_0x13c8('0x1ae'),'foreignKey':_0x13c8('0x1ab')});db[_0x13c8('0xa0')]['hasMany'](db['SalesforceField'],{'as':_0x13c8('0x1af'),'foreignKey':_0x13c8('0x1ac')});db['SalesforceField']['belongsTo'](db[_0x13c8('0x8d')],{'as':_0x13c8('0x8d'),'foreignKey':_0x13c8('0x1b0')});db[_0x13c8('0xa1')][_0x13c8('0x109')](db[_0x13c8('0xa3')],{'as':'Configurations','onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x1a8')});db[_0x13c8('0xa3')][_0x13c8('0x109')](db[_0x13c8('0xa4')],{'as':_0x13c8('0x1a9'),'onDelete':'cascade','foreignKey':_0x13c8('0x1aa')});db[_0x13c8('0xa3')][_0x13c8('0x109')](db[_0x13c8('0xa4')],{'as':_0x13c8('0x1b1'),'onDelete':_0x13c8('0x107'),'foreignKey':'DescriptionId'});db[_0x13c8('0xa3')][_0x13c8('0x109')](db['SugarcrmField'],{'as':_0x13c8('0x1a6'),'onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x1ac')});db[_0x13c8('0xa3')][_0x13c8('0x114')](db[_0x13c8('0xa1')],{'as':_0x13c8('0x16f'),'foreignKey':'AccountId'});db[_0x13c8('0xa4')][_0x13c8('0x109')](db[_0x13c8('0xa4')],{'as':_0x13c8('0x1ad'),'foreignKey':_0x13c8('0x1aa')});db['SugarcrmField'][_0x13c8('0x109')](db[_0x13c8('0xa4')],{'as':'Description','foreignKey':'DescriptionId'});db['SugarcrmField']['hasMany'](db[_0x13c8('0xa4')],{'as':_0x13c8('0x1af'),'foreignKey':_0x13c8('0x1ac')});db['SugarcrmField'][_0x13c8('0x114')](db[_0x13c8('0x8d')],{'as':_0x13c8('0x8d'),'foreignKey':_0x13c8('0x1b0')});db[_0x13c8('0xa6')]['hasMany'](db[_0x13c8('0x1b2')],{'as':_0x13c8('0x1b3'),'onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x1a8')});db[_0x13c8('0x1b2')]['hasMany'](db[_0x13c8('0xa8')],{'as':_0x13c8('0x1a9'),'onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x1aa')});db[_0x13c8('0x1b2')][_0x13c8('0x109')](db[_0x13c8('0xa8')],{'as':'Descriptions','onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x1ab')});db[_0x13c8('0x1b2')][_0x13c8('0x109')](db[_0x13c8('0xa8')],{'as':_0x13c8('0x1a6'),'onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x1ac')});db[_0x13c8('0x1b2')]['belongsTo'](db[_0x13c8('0xa6')],{'as':_0x13c8('0x16f'),'foreignKey':'AccountId'});db[_0x13c8('0x1b2')][_0x13c8('0x118')](db['Tag'],{'through':_0x13c8('0x1b4')});db[_0x13c8('0xa8')][_0x13c8('0x109')](db[_0x13c8('0xa8')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x13c8('0xa8')][_0x13c8('0x109')](db['DeskField'],{'as':'Description','foreignKey':_0x13c8('0x1ab')});db[_0x13c8('0xa8')]['hasMany'](db[_0x13c8('0xa8')],{'as':_0x13c8('0x1af'),'foreignKey':_0x13c8('0x1ac')});db[_0x13c8('0xa8')][_0x13c8('0x114')](db['Variable'],{'as':_0x13c8('0x8d'),'foreignKey':_0x13c8('0x1b0')});db['ZohoAccount'][_0x13c8('0x109')](db[_0x13c8('0xab')],{'as':_0x13c8('0x1b3'),'onDelete':_0x13c8('0x107'),'foreignKey':'AccountId'});db[_0x13c8('0xab')][_0x13c8('0x109')](db[_0x13c8('0x1b5')],{'as':_0x13c8('0x1a9'),'onDelete':_0x13c8('0x107'),'foreignKey':'SubjectId'});db['ZohoConfiguration'][_0x13c8('0x109')](db[_0x13c8('0x1b5')],{'as':_0x13c8('0x1b1'),'onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x1ab')});db[_0x13c8('0xab')][_0x13c8('0x109')](db[_0x13c8('0x1b5')],{'as':_0x13c8('0x1a6'),'onDelete':'cascade','foreignKey':_0x13c8('0x1ac')});db[_0x13c8('0xab')][_0x13c8('0x114')](db[_0x13c8('0x1b6')],{'as':'Account','foreignKey':_0x13c8('0x1a8')});db['ZohoField'][_0x13c8('0x109')](db[_0x13c8('0x1b5')],{'as':_0x13c8('0x1ad'),'foreignKey':'SubjectId'});db[_0x13c8('0x1b5')]['hasMany'](db[_0x13c8('0x1b5')],{'as':_0x13c8('0x1ae'),'foreignKey':_0x13c8('0x1ab')});db[_0x13c8('0x1b5')]['hasMany'](db[_0x13c8('0x1b5')],{'as':_0x13c8('0x1af'),'foreignKey':_0x13c8('0x1ac')});db[_0x13c8('0x1b5')][_0x13c8('0x114')](db[_0x13c8('0x8d')],{'as':'Variable','foreignKey':_0x13c8('0x1b0')});db['ZendeskAccount'][_0x13c8('0x109')](db[_0x13c8('0xaf')],{'as':_0x13c8('0x1b3'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x13c8('0xaf')][_0x13c8('0x109')](db[_0x13c8('0x1b7')],{'as':_0x13c8('0x1a9'),'foreignKey':_0x13c8('0x1aa')});db[_0x13c8('0xaf')][_0x13c8('0x109')](db[_0x13c8('0x1b7')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x13c8('0xaf')][_0x13c8('0x109')](db[_0x13c8('0x1b7')],{'as':'Fields','foreignKey':_0x13c8('0x1ac')});db[_0x13c8('0xaf')]['belongsTo'](db['ZendeskAccount'],{'as':_0x13c8('0x16f'),'foreignKey':_0x13c8('0x1a8')});db['ZendeskConfiguration']['belongsToMany'](db['Tag'],{'through':'int_zendesk_configuration_has_tags'});db['ZendeskField'][_0x13c8('0x109')](db['ZendeskField'],{'as':_0x13c8('0x1ad'),'foreignKey':'SubjectId'});db['ZendeskField'][_0x13c8('0x109')](db[_0x13c8('0x1b7')],{'as':_0x13c8('0x1ae'),'foreignKey':_0x13c8('0x1ab')});db[_0x13c8('0x1b7')][_0x13c8('0x109')](db[_0x13c8('0x1b7')],{'as':_0x13c8('0x1af'),'foreignKey':_0x13c8('0x1ac')});db[_0x13c8('0x1b7')][_0x13c8('0x114')](db[_0x13c8('0x8d')],{'as':_0x13c8('0x8d'),'foreignKey':_0x13c8('0x1b0')});db['FreshdeskAccount'][_0x13c8('0x109')](db[_0x13c8('0xb3')],{'as':_0x13c8('0x1b3'),'onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x1a8')});db[_0x13c8('0xb3')][_0x13c8('0x109')](db['FreshdeskField'],{'as':_0x13c8('0x1a9'),'onDelete':'cascade','foreignKey':_0x13c8('0x1aa')});db[_0x13c8('0xb3')]['hasMany'](db['FreshdeskField'],{'as':'Descriptions','onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x1ab')});db[_0x13c8('0xb3')][_0x13c8('0x109')](db[_0x13c8('0xb4')],{'as':_0x13c8('0x1a6'),'onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x1ac')});db['FreshdeskConfiguration'][_0x13c8('0x114')](db[_0x13c8('0xb1')],{'as':_0x13c8('0x16f'),'foreignKey':_0x13c8('0x1a8')});db[_0x13c8('0xb3')][_0x13c8('0x118')](db[_0x13c8('0x87')],{'through':_0x13c8('0x1b8')});db['FreshdeskField'][_0x13c8('0x109')](db[_0x13c8('0xb4')],{'as':_0x13c8('0x1ad'),'foreignKey':_0x13c8('0x1aa')});db['FreshdeskField'][_0x13c8('0x109')](db[_0x13c8('0xb4')],{'as':_0x13c8('0x1ae'),'foreignKey':_0x13c8('0x1ab')});db[_0x13c8('0xb4')][_0x13c8('0x109')](db[_0x13c8('0xb4')],{'as':_0x13c8('0x1af'),'foreignKey':_0x13c8('0x1ac')});db['FreshdeskField']['belongsTo'](db['Variable'],{'as':_0x13c8('0x8d'),'foreignKey':_0x13c8('0x1b0')});db[_0x13c8('0xb6')]['hasMany'](db[_0x13c8('0xb8')],{'as':_0x13c8('0x1b3'),'onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x1a8')});db[_0x13c8('0xb8')]['hasMany'](db['VtigerField'],{'as':_0x13c8('0x1a9'),'foreignKey':_0x13c8('0x1aa')});db[_0x13c8('0xb8')][_0x13c8('0x109')](db[_0x13c8('0xba')],{'as':'Descriptions','foreignKey':_0x13c8('0x1ab')});db[_0x13c8('0xb8')][_0x13c8('0x109')](db[_0x13c8('0xba')],{'as':_0x13c8('0x1a6'),'foreignKey':_0x13c8('0x1ac')});db[_0x13c8('0xb8')][_0x13c8('0x114')](db[_0x13c8('0xb6')],{'as':_0x13c8('0x16f'),'foreignKey':_0x13c8('0x1a8')});db[_0x13c8('0xba')][_0x13c8('0x109')](db[_0x13c8('0xba')],{'as':_0x13c8('0x1ad'),'foreignKey':_0x13c8('0x1aa')});db[_0x13c8('0xba')][_0x13c8('0x109')](db[_0x13c8('0xba')],{'as':_0x13c8('0x1ae'),'foreignKey':_0x13c8('0x1ab')});db[_0x13c8('0xba')]['hasMany'](db['VtigerField'],{'as':_0x13c8('0x1af'),'foreignKey':_0x13c8('0x1ac')});db[_0x13c8('0xba')][_0x13c8('0x114')](db[_0x13c8('0x8d')],{'as':'Variable','foreignKey':_0x13c8('0x1b0')});db['ServicenowAccount'][_0x13c8('0x109')](db[_0x13c8('0xbe')],{'as':_0x13c8('0x1b3'),'onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x1a8')});db[_0x13c8('0xbe')]['hasMany'](db['ServicenowField'],{'as':_0x13c8('0x1a9'),'foreignKey':_0x13c8('0x1aa')});db['ServicenowConfiguration'][_0x13c8('0x109')](db[_0x13c8('0xc0')],{'as':_0x13c8('0x1b1'),'foreignKey':_0x13c8('0x1ab')});db[_0x13c8('0xbe')]['hasMany'](db[_0x13c8('0xc0')],{'as':_0x13c8('0x1a6'),'foreignKey':_0x13c8('0x1ac')});db[_0x13c8('0xbe')][_0x13c8('0x114')](db[_0x13c8('0xbc')],{'as':'Account','foreignKey':_0x13c8('0x1a8')});db['ServicenowField'][_0x13c8('0x109')](db[_0x13c8('0xc0')],{'as':_0x13c8('0x1ad'),'foreignKey':_0x13c8('0x1aa')});db[_0x13c8('0xc0')][_0x13c8('0x109')](db[_0x13c8('0xc0')],{'as':_0x13c8('0x1ae'),'foreignKey':'DescriptionId'});db[_0x13c8('0xc0')][_0x13c8('0x109')](db[_0x13c8('0xc0')],{'as':_0x13c8('0x1af'),'foreignKey':_0x13c8('0x1ac')});db[_0x13c8('0xc0')][_0x13c8('0x114')](db[_0x13c8('0x8d')],{'as':_0x13c8('0x8d'),'foreignKey':_0x13c8('0x1b0')});db[_0x13c8('0xc2')]['hasMany'](db['Dynamics365Configuration'],{'as':_0x13c8('0x1b3'),'onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x1a8')});db[_0x13c8('0xc4')][_0x13c8('0x109')](db['Dynamics365Field'],{'as':_0x13c8('0x1a9'),'onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x1aa')});db[_0x13c8('0xc4')]['hasMany'](db[_0x13c8('0xc6')],{'as':_0x13c8('0x1b1'),'onDelete':'cascade','foreignKey':_0x13c8('0x1ab')});db[_0x13c8('0xc4')][_0x13c8('0x109')](db[_0x13c8('0xc6')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0x13c8('0xc4')]['belongsTo'](db[_0x13c8('0xc2')],{'as':_0x13c8('0x16f'),'foreignKey':_0x13c8('0x1a8')});db[_0x13c8('0xc6')][_0x13c8('0x109')](db['Dynamics365Field'],{'as':_0x13c8('0x1ad'),'foreignKey':_0x13c8('0x1aa')});db['Dynamics365Field'][_0x13c8('0x109')](db[_0x13c8('0xc6')],{'as':_0x13c8('0x1ae'),'foreignKey':_0x13c8('0x1ab')});db[_0x13c8('0xc6')][_0x13c8('0x109')](db[_0x13c8('0xc6')],{'as':_0x13c8('0x1af'),'foreignKey':_0x13c8('0x1ac')});db[_0x13c8('0xc6')][_0x13c8('0x114')](db[_0x13c8('0x8d')],{'as':_0x13c8('0x8d'),'foreignKey':'VariableId'});db[_0x13c8('0xc8')][_0x13c8('0x109')](db[_0x13c8('0x1b9')],{'as':_0x13c8('0x1b3'),'onDelete':'cascade','foreignKey':_0x13c8('0x1a8')});db['FreshsalesConfiguration'][_0x13c8('0x109')](db[_0x13c8('0xca')],{'as':_0x13c8('0x1a9'),'foreignKey':'SubjectId'});db['FreshsalesConfiguration']['hasMany'](db[_0x13c8('0xca')],{'as':_0x13c8('0x1b1'),'foreignKey':_0x13c8('0x1ab')});db[_0x13c8('0x1b9')]['hasMany'](db[_0x13c8('0xca')],{'as':_0x13c8('0x1a6'),'foreignKey':_0x13c8('0x1ac')});db[_0x13c8('0x1b9')][_0x13c8('0x114')](db['FreshsalesAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0x13c8('0xca')][_0x13c8('0x109')](db['FreshsalesField'],{'as':_0x13c8('0x1ad'),'foreignKey':_0x13c8('0x1aa')});db[_0x13c8('0xca')][_0x13c8('0x109')](db['FreshsalesField'],{'as':_0x13c8('0x1ae'),'foreignKey':'DescriptionId'});db[_0x13c8('0xca')][_0x13c8('0x109')](db[_0x13c8('0xca')],{'as':_0x13c8('0x1af'),'foreignKey':_0x13c8('0x1ac')});db[_0x13c8('0xca')]['belongsTo'](db[_0x13c8('0x8d')],{'as':'Variable','foreignKey':_0x13c8('0x1b0')});db['ChatQueueReport']['belongsTo'](db['ChatWebsite'],{});db[_0x13c8('0xcd')][_0x13c8('0x114')](db[_0x13c8('0xf1')],{'as':_0x13c8('0x15a'),'foreignKey':'ListId'});db['ChatQueueReport']['belongsTo'](db[_0x13c8('0x68')],{'as':_0x13c8('0x15f'),'foreignKey':'ContactId'});db[_0x13c8('0xcd')][_0x13c8('0x114')](db['ChatInteraction'],{});db[_0x13c8('0xcd')][_0x13c8('0x114')](db[_0x13c8('0x182')],{});db[_0x13c8('0xcd')]['belongsTo'](db['User'],{});db[_0x13c8('0xcd')]['belongsTo'](db[_0x13c8('0x63')],{});db[_0x13c8('0xcf')]['belongsTo'](db[_0x13c8('0x12')],{'onDelete':_0x13c8('0x107'),'foreignKey':'FromId'});db[_0x13c8('0xcf')][_0x13c8('0x114')](db['User'],{'onDelete':'cascade','foreignKey':_0x13c8('0x1ba')});db['JscriptySessionReport']['hasMany'](db[_0x13c8('0xd1')],{'foreignKey':_0x13c8('0x1bb'),'onDelete':'cascade'});db[_0x13c8('0xd3')][_0x13c8('0x109')](db['JscriptyAnswerReport'],{'foreignKey':_0x13c8('0x1bb'),'onDelete':_0x13c8('0x107')});db[_0x13c8('0x1bc')][_0x13c8('0x114')](db[_0x13c8('0x4d')],{});db[_0x13c8('0x1bc')][_0x13c8('0x114')](db[_0x13c8('0xf1')],{'as':_0x13c8('0x15a'),'foreignKey':'ListId'});db[_0x13c8('0x1bc')][_0x13c8('0x114')](db['CmContact'],{'as':'Contact','foreignKey':_0x13c8('0x153')});db[_0x13c8('0x1bc')][_0x13c8('0x114')](db[_0x13c8('0x111')],{});db['SmsQueueReport']['belongsTo'](db[_0x13c8('0x52')],{});db[_0x13c8('0x1bc')][_0x13c8('0x114')](db[_0x13c8('0x12')],{});db['SmsQueueReport'][_0x13c8('0x114')](db[_0x13c8('0x54')],{});db[_0x13c8('0x1bd')][_0x13c8('0x109')](db[_0x13c8('0xd3')],{'foreignKey':_0x13c8('0x1be')});db[_0x13c8('0x1bd')][_0x13c8('0x109')](db[_0x13c8('0xd1')],{'foreignKey':'ProjectId'});db[_0x13c8('0x1bd')][_0x13c8('0x109')](db['JscriptyAnswerReport'],{'foreignKey':_0x13c8('0x1be')});db[_0x13c8('0xdc')][_0x13c8('0x118')](db[_0x13c8('0x12')],{'as':_0x13c8('0x170'),'through':_0x13c8('0x139')});db['Team'][_0x13c8('0x118')](db[_0x13c8('0x12')],{'as':_0x13c8('0x148'),'through':_0x13c8('0x11c')});db[_0x13c8('0xe1')][_0x13c8('0x118')](db['VoiceQueue'],{'through':'TeamVoiceQueue','as':_0x13c8('0x125')});db[_0x13c8('0xe1')]['belongsToMany'](db['MailQueue'],{'through':_0x13c8('0x1bf'),'as':_0x13c8('0x127')});db[_0x13c8('0xe1')][_0x13c8('0x118')](db[_0x13c8('0x63')],{'through':'team_has_chat_queues','as':'ChatQueues'});db[_0x13c8('0xe1')][_0x13c8('0x118')](db['FaxQueue'],{'through':_0x13c8('0x172'),'as':'FaxQueues'});db['Team'][_0x13c8('0x118')](db[_0x13c8('0x54')],{'through':_0x13c8('0x178'),'as':_0x13c8('0x12d')});db[_0x13c8('0xe1')][_0x13c8('0x118')](db[_0x13c8('0x5c')],{'through':_0x13c8('0x17f'),'as':'OpenchannelQueues'});db[_0x13c8('0xe1')][_0x13c8('0x118')](db['WhatsappQueue'],{'through':'team_has_whatsapp_queues','as':_0x13c8('0x1c0')});db[_0x13c8('0xe1')][_0x13c8('0x118')](db[_0x13c8('0x126')],{'through':_0x13c8('0x104'),'as':'VoicePrefixes'});db[_0x13c8('0xe3')][_0x13c8('0x109')](db[_0x13c8('0x6a')],{'as':_0x13c8('0x141'),'foreignKey':_0x13c8('0x191')});db[_0x13c8('0xe3')]['hasMany'](db[_0x13c8('0x6d')],{'as':'HopperFinals','foreignKey':_0x13c8('0x191')});db[_0x13c8('0xe3')]['hasMany'](db[_0x13c8('0x6f')],{'as':_0x13c8('0x18d'),'foreignKey':'CampaignId'});db[_0x13c8('0xe3')][_0x13c8('0x109')](db[_0x13c8('0x6c')],{'as':_0x13c8('0x1c1'),'foreignKey':_0x13c8('0x191')});db['Campaign'][_0x13c8('0x114')](db['Trunk'],{'as':_0x13c8('0x28'),'foreignKey':'TrunkId'});db[_0x13c8('0xe3')][_0x13c8('0x114')](db[_0x13c8('0x28')],{'as':_0x13c8('0x144'),'foreignKey':_0x13c8('0x145')});db[_0x13c8('0xe3')][_0x13c8('0x114')](db[_0x13c8('0x7c')],{'as':'Interval','foreignKey':'IntervalId'});db['Campaign'][_0x13c8('0x114')](db[_0x13c8('0xdc')],{'as':_0x13c8('0xdc'),'foreignKey':'SquareProjectId'});db[_0x13c8('0xe3')][_0x13c8('0x118')](db[_0x13c8('0xf1')],{'as':_0x13c8('0x1c2'),'through':'campaigns_has_cm_lists'});db[_0x13c8('0xe3')]['belongsToMany'](db[_0x13c8('0xf1')],{'as':_0x13c8('0x1c3'),'through':_0x13c8('0x1c4')});db[_0x13c8('0xe6')][_0x13c8('0x114')](db[_0x13c8('0x61')],{'as':'ChatOfflineMessage','foreignKey':_0x13c8('0x166')});db[_0x13c8('0xe9')][_0x13c8('0x114')](db['MailMessage'],{});db[_0x13c8('0xe9')][_0x13c8('0x114')](db[_0x13c8('0x3a')],{});db['MailTransferReport'][_0x13c8('0x114')](db[_0x13c8('0x36')],{'foreignKey':_0x13c8('0x1c5'),'as':_0x13c8('0x1c6')});db[_0x13c8('0xe9')][_0x13c8('0x114')](db[_0x13c8('0x12')],{'foreignKey':_0x13c8('0x1c7'),'as':_0x13c8('0x1c8')});db[_0x13c8('0xe9')][_0x13c8('0x114')](db[_0x13c8('0x12')],{'foreignKey':_0x13c8('0x1c9'),'as':_0x13c8('0x1ca')});db['MailTransferReport'][_0x13c8('0x114')](db[_0x13c8('0x38')],{'foreignKey':_0x13c8('0x1cb'),'as':_0x13c8('0x1cc')});db['MailTransferReport']['belongsTo'](db[_0x13c8('0x36')],{'foreignKey':_0x13c8('0x1cd'),'as':_0x13c8('0x1ce')});db[_0x13c8('0xeb')][_0x13c8('0x114')](db[_0x13c8('0x182')],{});db[_0x13c8('0xeb')][_0x13c8('0x114')](db[_0x13c8('0x10f')],{});db[_0x13c8('0xeb')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x13c8('0x1cf'),'as':_0x13c8('0x1c6')});db['ChatTransferReport'][_0x13c8('0x114')](db[_0x13c8('0x12')],{'foreignKey':_0x13c8('0x1c7'),'as':_0x13c8('0x1c8')});db[_0x13c8('0xeb')]['belongsTo'](db[_0x13c8('0x12')],{'foreignKey':_0x13c8('0x1c9'),'as':'ToAgent'});db[_0x13c8('0xeb')][_0x13c8('0x114')](db['ChatQueue'],{'foreignKey':_0x13c8('0x1d0'),'as':'ToQueue'});db[_0x13c8('0xeb')][_0x13c8('0x114')](db['ChatWebsite'],{'foreignKey':_0x13c8('0x1d1'),'as':_0x13c8('0x1ce')});db[_0x13c8('0x1d2')][_0x13c8('0x114')](db[_0x13c8('0x16d')],{});db[_0x13c8('0x1d2')][_0x13c8('0x114')](db[_0x13c8('0x49')],{});db[_0x13c8('0x1d2')][_0x13c8('0x114')](db['FaxAccount'],{'foreignKey':'FromFaxAccountId','as':_0x13c8('0x1c6')});db[_0x13c8('0x1d2')][_0x13c8('0x114')](db[_0x13c8('0x12')],{'foreignKey':_0x13c8('0x1c7'),'as':'FromAgent'});db[_0x13c8('0x1d2')][_0x13c8('0x114')](db[_0x13c8('0x12')],{'foreignKey':_0x13c8('0x1c9'),'as':_0x13c8('0x1ca')});db[_0x13c8('0x1d2')][_0x13c8('0x114')](db['FaxQueue'],{'foreignKey':_0x13c8('0x1d3'),'as':_0x13c8('0x1cc')});db[_0x13c8('0x1d2')][_0x13c8('0x114')](db['FaxAccount'],{'foreignKey':_0x13c8('0x1d4'),'as':_0x13c8('0x1ce')});db[_0x13c8('0xee')][_0x13c8('0x114')](db[_0x13c8('0x17b')],{});db[_0x13c8('0xee')][_0x13c8('0x114')](db[_0x13c8('0x59')],{});db[_0x13c8('0xee')][_0x13c8('0x114')](db[_0x13c8('0x179')],{'foreignKey':'FromOpenchannelAccountId','as':_0x13c8('0x1c6')});db[_0x13c8('0xee')][_0x13c8('0x114')](db[_0x13c8('0x12')],{'foreignKey':_0x13c8('0x1c7'),'as':_0x13c8('0x1c8')});db['OpenchannelTransferReport'][_0x13c8('0x114')](db[_0x13c8('0x12')],{'foreignKey':_0x13c8('0x1c9'),'as':'ToAgent'});db[_0x13c8('0xee')][_0x13c8('0x114')](db['OpenchannelQueue'],{'foreignKey':_0x13c8('0x1d5'),'as':_0x13c8('0x1cc')});db[_0x13c8('0xee')][_0x13c8('0x114')](db[_0x13c8('0x179')],{'foreignKey':_0x13c8('0x1d6'),'as':_0x13c8('0x1ce')});db[_0x13c8('0x1d7')]['belongsTo'](db[_0x13c8('0x52')],{});db[_0x13c8('0x1d7')][_0x13c8('0x114')](db['SmsInteraction'],{});db[_0x13c8('0x1d7')][_0x13c8('0x114')](db[_0x13c8('0x4d')],{'foreignKey':_0x13c8('0x1d8'),'as':_0x13c8('0x1c6')});db[_0x13c8('0x1d7')][_0x13c8('0x114')](db[_0x13c8('0x12')],{'foreignKey':_0x13c8('0x1c7'),'as':_0x13c8('0x1c8')});db[_0x13c8('0x1d7')][_0x13c8('0x114')](db[_0x13c8('0x12')],{'foreignKey':'ToUserId','as':_0x13c8('0x1ca')});db['SmsTransferReport']['belongsTo'](db['SmsQueue'],{'foreignKey':_0x13c8('0x1d9'),'as':_0x13c8('0x1cc')});db[_0x13c8('0x1d7')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0x13c8('0x1da'),'as':_0x13c8('0x1ce')});db[_0x13c8('0xf1')]['hasMany'](db[_0x13c8('0x78')],{'as':'Dispositions','foreignKey':_0x13c8('0x15b'),'onDelete':_0x13c8('0x107')});db[_0x13c8('0xf1')][_0x13c8('0x109')](db[_0x13c8('0x73')],{'as':_0x13c8('0x1db'),'foreignKey':_0x13c8('0x15b')});db[_0x13c8('0xf1')][_0x13c8('0x109')](db['CmContact'],{'as':_0x13c8('0x119'),'onDelete':_0x13c8('0x107'),'foreignKey':_0x13c8('0x15b')});db[_0x13c8('0xf1')][_0x13c8('0x109')](db['CmHopperFinal'],{'as':_0x13c8('0x10c'),'foreignKey':_0x13c8('0x15b')});db['CmList']['hasMany'](db['CmHopperHistory'],{'as':_0x13c8('0x10d'),'foreignKey':_0x13c8('0x15b')});db[_0x13c8('0xf1')][_0x13c8('0x109')](db['ReportAgentPreview'],{'as':_0x13c8('0x71'),'foreignKey':'ListId'});db[_0x13c8('0xf1')][_0x13c8('0x118')](db[_0x13c8('0x1b')],{'as':_0x13c8('0x1dc'),'through':_0x13c8('0x1dd')});db[_0x13c8('0xf1')]['belongsToMany'](db[_0x13c8('0x12')],{'as':_0x13c8('0x148'),'through':_0x13c8('0x11b')});db[_0x13c8('0x126')][_0x13c8('0x109')](db[_0x13c8('0x18')],{'as':'Extensions','onDelete':_0x13c8('0x107')});db[_0x13c8('0x126')][_0x13c8('0x118')](db['User'],{'as':_0x13c8('0x148'),'through':'UserVoicePrefix'});db[_0x13c8('0x126')]['belongsToMany'](db[_0x13c8('0xe1')],{'through':_0x13c8('0x104'),'as':_0x13c8('0x15d')});db[_0x13c8('0xf4')][_0x13c8('0x109')](db['User'],{'as':_0x13c8('0x170'),'foreignKey':_0x13c8('0x115')});db['UserProfile'][_0x13c8('0x109')](db['UserProfileSection'],{'as':_0x13c8('0x1de'),'foreignKey':_0x13c8('0x115'),'onDelete':_0x13c8('0x107')});db['UserProfileSection'][_0x13c8('0x109')](db[_0x13c8('0xf7')],{'as':_0x13c8('0x1df'),'foreignKey':_0x13c8('0x1e0'),'onDelete':_0x13c8('0x107')});db[_0x13c8('0xfb')][_0x13c8('0x109')](db[_0x13c8('0x78')],{'as':'Dispositions','foreignKey':_0x13c8('0x1e1'),'onDelete':_0x13c8('0x107')});db[_0x13c8('0xfb')][_0x13c8('0x109')](db[_0x13c8('0x16a')],{'as':'Answers','foreignKey':_0x13c8('0x1e1')});db['WhatsappAccount'][_0x13c8('0x109')](db['WhatsappMessage'],{'as':_0x13c8('0x159'),'foreignKey':_0x13c8('0x1e1')});db[_0x13c8('0xfb')]['hasMany'](db[_0x13c8('0x122')],{'as':_0x13c8('0x16c')});db[_0x13c8('0xfb')][_0x13c8('0x109')](db['WhatsappApplication'],{'as':_0x13c8('0x13d')});db[_0x13c8('0xfb')][_0x13c8('0x114')](db[_0x13c8('0xf1')],{'as':_0x13c8('0x15a'),'foreignKey':_0x13c8('0x15b')});db[_0x13c8('0xfb')][_0x13c8('0x114')](db[_0x13c8('0x7d')],{'as':_0x13c8('0x147'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x13c8('0xfb')][_0x13c8('0x118')](db[_0x13c8('0x12')],{'as':'Agents','through':_0x13c8('0x137')});db['WhatsappApplication']['belongsTo'](db[_0x13c8('0x12')],{'onDelete':_0x13c8('0x167')});db[_0x13c8('0xfd')][_0x13c8('0x114')](db[_0x13c8('0x130')],{'onDelete':'restrict'});db[_0x13c8('0xfd')]['belongsTo'](db[_0x13c8('0xfb')],{'onDelete':_0x13c8('0x167')});db['WhatsappApplication'][_0x13c8('0x114')](db[_0x13c8('0x7c')],{'onDelete':_0x13c8('0x167'),'foreignKey':_0x13c8('0x146')});db[_0x13c8('0xfd')][_0x13c8('0x114')](db[_0x13c8('0x87')],{'onDelete':_0x13c8('0x167'),'foreignKey':'TagId'});db[_0x13c8('0x122')][_0x13c8('0x109')](db['WhatsappMessage'],{'as':_0x13c8('0x159'),'onDelete':'cascade','foreignKey':_0x13c8('0x1e2')});db['WhatsappInteraction']['belongsTo'](db[_0x13c8('0xfb')],{'as':_0x13c8('0x16f'),'foreignKey':'WhatsappAccountId'});db[_0x13c8('0x122')][_0x13c8('0x114')](db[_0x13c8('0x68')],{'as':_0x13c8('0x15f'),'foreignKey':_0x13c8('0x153')});db[_0x13c8('0x122')][_0x13c8('0x114')](db[_0x13c8('0x12')],{'as':_0x13c8('0x160'),'foreignKey':'UserId'});db[_0x13c8('0x122')][_0x13c8('0x118')](db[_0x13c8('0x87')],{'through':_0x13c8('0x1a0'),'as':_0x13c8('0x162')});db['WhatsappInteraction'][_0x13c8('0x118')](db['Tag'],{'through':_0x13c8('0x1a0'),'as':_0x13c8('0x163')});db[_0x13c8('0x122')]['belongsToMany'](db['User'],{'as':_0x13c8('0x170'),'through':_0x13c8('0x124'),'foreignKey':_0x13c8('0x1e2')});db[_0x13c8('0x1e3')][_0x13c8('0x114')](db['User'],{'as':_0x13c8('0x12')});db[_0x13c8('0x1e3')][_0x13c8('0x114')](db[_0x13c8('0x68')],{'onDelete':'cascade','as':'Contact'});db[_0x13c8('0x1e3')][_0x13c8('0x114')](db['WhatsappInteraction'],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x13c8('0x1e2')});db[_0x13c8('0x1e3')][_0x13c8('0x114')](db[_0x13c8('0xfb')],{'as':'Account','foreignKey':_0x13c8('0x1e1')});db[_0x13c8('0xff')][_0x13c8('0x114')](db[_0x13c8('0xfb')],{});db[_0x13c8('0xff')][_0x13c8('0x114')](db[_0x13c8('0xf1')],{'as':'List','foreignKey':_0x13c8('0x15b')});db[_0x13c8('0xff')]['belongsTo'](db[_0x13c8('0x68')],{'as':_0x13c8('0x15f'),'foreignKey':_0x13c8('0x153')});db[_0x13c8('0xff')][_0x13c8('0x114')](db[_0x13c8('0x122')],{});db[_0x13c8('0xff')][_0x13c8('0x114')](db[_0x13c8('0x130')],{});db[_0x13c8('0xff')][_0x13c8('0x114')](db['WhatsappMessage'],{});db[_0x13c8('0xff')][_0x13c8('0x114')](db[_0x13c8('0x12')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x13c8('0x1e3')],{});db[_0x13c8('0x1e4')][_0x13c8('0x114')](db[_0x13c8('0x122')],{});db[_0x13c8('0x1e4')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x13c8('0x1e5'),'as':_0x13c8('0x1c6')});db[_0x13c8('0x1e4')][_0x13c8('0x114')](db['WhatsappAccount'],{'foreignKey':_0x13c8('0x1e6'),'as':'ToAccount'});db[_0x13c8('0x1e4')][_0x13c8('0x114')](db[_0x13c8('0x130')],{'foreignKey':_0x13c8('0x1e7'),'as':'ToQueue'});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x13c8('0x1c7'),'as':'FromAgent'});db[_0x13c8('0x1e4')][_0x13c8('0x114')](db[_0x13c8('0x12')],{'foreignKey':_0x13c8('0x1c9'),'as':'ToAgent'});db[_0x13c8('0x130')][_0x13c8('0x118')](db[_0x13c8('0x12')],{'as':_0x13c8('0x148'),'through':_0x13c8('0x131'),'foreignKey':_0x13c8('0x1e8')});db[_0x13c8('0x130')][_0x13c8('0x118')](db[_0x13c8('0xe1')],{'through':_0x13c8('0x1e9'),'as':'Teams'});module[_0x13c8('0x1ea')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x668b=['ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject','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','Plugin','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','SmsTransferReport','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','CmHopperFinal','HopperFinals','OpenchannelInteractions','ChatInteractions','SmsInteractions','MailInteractions','WhatsappInteractions','SenderId','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','CmList','Lists','cm_user_has_lists','user_has_mail_interactions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','user_has_openchannel_interactions','VoiceQueue','VoiceQueues','VoicePrefixes','MailQueue','MailQueues','ChatQueues','FaxQueues','SmsQueues','ChatWebsite','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','moh_has_sounds','Members','Hoppers','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','BlackLists','voice_queues_has_cm_blacklists','ScreenRecording','Messages','mailboxuser','mailbox','VoiceQueueReport','uniqueid','VoiceAgentReport','AgentReports','Contact','ContactId','MailAccount','MailServerIn','Smtp','Dispositions','MailAccountId','CannedAnswer','Answers','Interactions','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','Teams','MailInteractionId','Owner','mail_interaction_has_tags','Users','Attachment','Attachments','Interaction','Account','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','Dashboard','FaxAccountId','Exntensions','FaxMessage','mandatoryDispositionPauseId','FaxApplication','FaxInteractionId','fax_interaction_has_tags','Tags','ThroughTags','AttachmentId','SmsAccountId','SmsApplication','sms_interaction_has_tags','user_has_sms_interactions','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','IntervalId','OpenchannelInteractionId','openchannel_interaction_has_tags','ProactiveActions','OpenchannelQueueReport','Agent','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','Website','CompanyId','Company','cm_user_has_contacts','cm_contact_has_tags','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Fields','Configurations','AccountId','Subjects','Descriptions','DescriptionId','FieldId','SubjectId','VariableId','Description','Field','int_desk_configuration_has_tags','Subject','int_freshdesk_configuration_has_tags','VtigerConfiguration','Dynamics365Configuration','FromId','ToId','JscriptySessionReport','JscriptyQuestionReport','SessionId','JscriptyProject','ProjectId','team_has_openchannel_queues','OpenchannelQueues','WhatsappQueues','TeamVoicePrefix','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','ToMailQueueId','ToMailAccountId','ToAccount','FromAgent','ToUserId','ToChatQueueId','ToQueue','FaxTransferReport','FromFaxAccountId','ToAgent','ToOpenchannelQueueId','ToOpenchannelAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','HopperHistory','Queues','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappQueueReport','ToWhatsappAccountId','ToQueueId','team_has_whatsapp_queues','../config/environment','sequelize','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','127.0.0.1','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerOut','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','../api/chatWebsite/chatWebsite.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','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','Pause','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','AnalyticDefaultReport','AnalyticExtractedReport','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model'];(function(_0x43ceb7,_0x20ed3c){var _0x4bfee7=function(_0x43f666){while(--_0x43f666){_0x43ceb7['push'](_0x43ceb7['shift']());}};_0x4bfee7(++_0x20ed3c);}(_0x668b,0x140));var _0xb668=function(_0x365be9,_0x3c88b9){_0x365be9=_0x365be9-0x0;var _0x185c12=_0x668b[_0x365be9];return _0x185c12;};'use strict';var config=require(_0xb668('0x0'));var Sequelize=require(_0xb668('0x1'));var _=require('lodash');var jstz=require(_0xb668('0x2'));var timezone=jstz[_0xb668('0x3')]();config['sequelize']=_[_0xb668('0x4')](config['sequelize'],{'database':_0xb668('0x5'),'username':_0xb668('0x6'),'password':_0xb668('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xb668('0x8'),'dialectOptions':{'charset':_0xb668('0x9')},'logging':![],'timezone':timezone[_0xb668('0xa')](),'define':{'charset':_0xb668('0xb'),'collate':_0xb668('0xc')}}});config[_0xb668('0xd')]=_['defaultsDeep'](config[_0xb668('0xd')],{'database':_0xb668('0x5'),'username':_0xb668('0x6'),'password':_0xb668('0x7'),'options':{'host':_0xb668('0xe'),'port':0xcea,'dialect':_0xb668('0x8'),'dialectOptions':{'charset':_0xb668('0x9')},'logging':![],'timezone':timezone[_0xb668('0xa')](),'define':{'charset':'utf8','collate':_0xb668('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xb668('0x1')][_0xb668('0xf')],config[_0xb668('0x1')][_0xb668('0x10')],config[_0xb668('0x1')][_0xb668('0x11')],config[_0xb668('0x1')][_0xb668('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xb668('0xd')][_0xb668('0xf')],config[_0xb668('0xd')][_0xb668('0x10')],config[_0xb668('0xd')][_0xb668('0x11')],config[_0xb668('0xd')][_0xb668('0x12')])};db[_0xb668('0x13')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x15'));db[_0xb668('0x16')]=db['sequelize'][_0xb668('0x14')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0xb668('0x17')]=db[_0xb668('0x1')]['import'](_0xb668('0x18'));db[_0xb668('0x19')]=db['sequelize'][_0xb668('0x14')]('../api/voiceExtension/voiceExtension.model');db[_0xb668('0x1a')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x1b'));db['VoiceQueue']=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x1c'));db['VoiceRecording']=db['sequelize'][_0xb668('0x14')](_0xb668('0x1d'));db['ScreenRecording']=db[_0xb668('0x1')]['import'](_0xb668('0x1e'));db['VoiceMail']=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x1f'));db[_0xb668('0x20')]=db[_0xb668('0x1')][_0xb668('0x14')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0xb668('0x21')]=db[_0xb668('0x1')][_0xb668('0x14')]('../api/voiceCallReport/voiceCallReport.model');db['VoiceDialReport']=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x22'));db['VoiceAgentReport']=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x23'));db['VoiceQueueReport']=db['sequelize'][_0xb668('0x14')](_0xb668('0x24'));db['MemberReport']=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x25'));db[_0xb668('0x26')]=db[_0xb668('0x1')]['import'](_0xb668('0x27'));db[_0xb668('0x28')]=db['sequelize'][_0xb668('0x14')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0xb668('0x29')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x2a'));db[_0xb668('0x2b')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x2c'));db[_0xb668('0x2d')]=db['sequelize'][_0xb668('0x14')](_0xb668('0x2e'));db[_0xb668('0x2f')]=db['sequelize'][_0xb668('0x14')](_0xb668('0x30'));db[_0xb668('0x31')]=db[_0xb668('0x1')]['import'](_0xb668('0x32'));db[_0xb668('0x33')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x34'));db[_0xb668('0x35')]=db[_0xb668('0x1')]['import'](_0xb668('0x36'));db[_0xb668('0x37')]=db['sequelize'][_0xb668('0x14')]('../api/userWhatsappQueue/userWhatsappQueue.model');db['MailServerIn']=db[_0xb668('0x1')][_0xb668('0x14')]('../api/mailServerIn/mailServerIn.model');db[_0xb668('0x38')]=db['sequelize'][_0xb668('0x14')]('../api/mailServerOut/mailServerOut.model');db['MailAccount']=db[_0xb668('0x1')][_0xb668('0x14')]('../api/mailAccount/mailAccount.model');db['MailQueue']=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x39'));db[_0xb668('0x3a')]=db[_0xb668('0x1')]['import']('../api/mailSubstatus/mailSubstatus.model');db[_0xb668('0x3b')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x3c'));db[_0xb668('0x3d')]=db[_0xb668('0x1')]['import']('../api/mailMessage/mailMessage.model');db[_0xb668('0x3e')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x3f'));db[_0xb668('0x40')]=db['sequelize'][_0xb668('0x14')](_0xb668('0x41'));db['Dashboard']=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x42'));db[_0xb668('0x43')]=db['sequelize']['import']('../api/dashboardItem/dashboardItem.model');db[_0xb668('0x44')]=db['sequelize']['import']('../api/faxAccount/faxAccount.model');db['FaxApplication']=db[_0xb668('0x1')]['import'](_0xb668('0x45'));db[_0xb668('0x46')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x47'));db['FaxMessage']=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x48'));db[_0xb668('0x49')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x4a'));db[_0xb668('0x4b')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x4c'));db['SmsAccount']=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x4d'));db['SmsApplication']=db['sequelize'][_0xb668('0x14')]('../api/smsApplication/smsApplication.model');db[_0xb668('0x4e')]=db['sequelize']['import']('../api/smsInteraction/smsInteraction.model');db[_0xb668('0x4f')]=db[_0xb668('0x1')]['import'](_0xb668('0x50'));db[_0xb668('0x51')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x52'));db[_0xb668('0x53')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x54'));db[_0xb668('0x55')]=db['sequelize'][_0xb668('0x14')](_0xb668('0x56'));db[_0xb668('0x57')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x58'));db[_0xb668('0x59')]=db[_0xb668('0x1')][_0xb668('0x14')]('../api/openchannelMessage/openchannelMessage.model');db[_0xb668('0x5a')]=db[_0xb668('0x1')][_0xb668('0x14')]('../api/openchannelQueue/openchannelQueue.model');db['ChatWebsite']=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x5b'));db['OpenchannelQueueReport']=db[_0xb668('0x1')]['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0xb668('0x5c')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x5d'));db[_0xb668('0x5e')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x5f'));db[_0xb668('0x60')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x61'));db[_0xb668('0x62')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x63'));db[_0xb668('0x64')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x65'));db[_0xb668('0x66')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x67'));db[_0xb668('0x68')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x69'));db[_0xb668('0x6a')]=db[_0xb668('0x1')]['import'](_0xb668('0x6b'));db[_0xb668('0x6c')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x6d'));db[_0xb668('0x6e')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x6f'));db[_0xb668('0x70')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x71'));db['CmHopperFinal']=db[_0xb668('0x1')][_0xb668('0x14')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0xb668('0x72')]=db[_0xb668('0x1')]['import'](_0xb668('0x73'));db[_0xb668('0x74')]=db['sequelize'][_0xb668('0x14')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0xb668('0x75')]=db[_0xb668('0x1')]['import'](_0xb668('0x76'));db[_0xb668('0x77')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x78'));db[_0xb668('0x79')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x7a'));db['CannedAnswer']=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x7b'));db[_0xb668('0x7c')]=db[_0xb668('0x1')]['import'](_0xb668('0x7d'));db[_0xb668('0x7e')]=db[_0xb668('0x1')]['import'](_0xb668('0x7f'));db[_0xb668('0x80')]=db[_0xb668('0x1')][_0xb668('0x14')]('../api/interval/interval.model');db[_0xb668('0x81')]=db[_0xb668('0x1')][_0xb668('0x14')]('../api/pause/pause.model');db[_0xb668('0x82')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x83'));db[_0xb668('0x84')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x85'));db[_0xb668('0x86')]=db['sequelize'][_0xb668('0x14')]('../api/schedule/schedule.model');db[_0xb668('0x87')]=db['sequelize'][_0xb668('0x14')](_0xb668('0x88'));db[_0xb668('0x89')]=db['sequelize'][_0xb668('0x14')](_0xb668('0x8a'));db[_0xb668('0x8b')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x8c'));db[_0xb668('0x8d')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x8e'));db[_0xb668('0x8f')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x90'));db[_0xb668('0x91')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x92'));db[_0xb668('0x93')]=db[_0xb668('0x1')]['import'](_0xb668('0x94'));db[_0xb668('0x95')]=db['sequelize'][_0xb668('0x14')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0xb668('0x96')]=db[_0xb668('0x1')]['import']('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0xb668('0x97')]=db[_0xb668('0x1')][_0xb668('0x14')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0xb668('0x98')]=db[_0xb668('0x1')][_0xb668('0x14')]('../api/analyticMetric/analyticMetric.model');db[_0xb668('0x99')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x9a'));db[_0xb668('0x9b')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x9c'));db[_0xb668('0x9d')]=db[_0xb668('0x1')][_0xb668('0x14')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0xb668('0x9e')]=db['sequelize']['import'](_0xb668('0x9f'));db[_0xb668('0xa0')]=db[_0xb668('0x1')][_0xb668('0x14')]('../api/intSalesforceField/intSalesforceField.model');db[_0xb668('0xa1')]=db['sequelize'][_0xb668('0x14')](_0xb668('0xa2'));db[_0xb668('0xa3')]=db['sequelize'][_0xb668('0x14')](_0xb668('0xa4'));db[_0xb668('0xa5')]=db['sequelize'][_0xb668('0x14')](_0xb668('0xa6'));db[_0xb668('0xa7')]=db[_0xb668('0x1')]['import'](_0xb668('0xa8'));db[_0xb668('0xa9')]=db['sequelize'][_0xb668('0x14')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0xb668('0xaa')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0xab'));db[_0xb668('0xac')]=db['sequelize']['import'](_0xb668('0xad'));db[_0xb668('0xae')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0xaf'));db[_0xb668('0xb0')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0xb1'));db[_0xb668('0xb2')]=db[_0xb668('0x1')]['import'](_0xb668('0xb3'));db[_0xb668('0xb4')]=db['sequelize'][_0xb668('0x14')](_0xb668('0xb5'));db[_0xb668('0xb6')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0xb7'));db[_0xb668('0xb8')]=db['sequelize'][_0xb668('0x14')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0xb668('0xb9')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0xba'));db[_0xb668('0xbb')]=db['sequelize'][_0xb668('0x14')](_0xb668('0xbc'));db[_0xb668('0xbd')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0xbe'));db['VtigerConfiguration']=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0xbf'));db[_0xb668('0xc0')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0xc1'));db[_0xb668('0xc2')]=db['sequelize'][_0xb668('0x14')](_0xb668('0xc3'));db[_0xb668('0xc4')]=db['sequelize'][_0xb668('0x14')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0xb668('0xc5')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0xc6'));db[_0xb668('0xc7')]=db[_0xb668('0x1')][_0xb668('0x14')]('../api/intDynamics365Account/intDynamics365Account.model');db['Dynamics365Configuration']=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0xc8'));db[_0xb668('0xc9')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0xca'));db[_0xb668('0xcb')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0xcc'));db[_0xb668('0xcd')]=db[_0xb668('0x1')]['import'](_0xb668('0xce'));db[_0xb668('0xcf')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0xd0'));db[_0xb668('0x91')]=db[_0xb668('0x1')][_0xb668('0x14')]('../api/integration/integration.model');db[_0xb668('0xd1')]=db['sequelize']['import'](_0xb668('0xd2'));db[_0xb668('0xd3')]=db['sequelize'][_0xb668('0x14')]('../api/chatQueueReport/chatQueueReport.model');db[_0xb668('0xd4')]=db[_0xb668('0x1')][_0xb668('0x14')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0xb668('0xd5')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0xd6'));db['JscriptyQuestionReport']=db['sequelize'][_0xb668('0x14')](_0xb668('0xd7'));db['JscriptySessionReport']=db[_0xb668('0x1')]['import'](_0xb668('0xd8'));db[_0xb668('0xd9')]=db[_0xb668('0x1')][_0xb668('0x14')]('../api/smsQueueReport/smsQueueReport.model');db['SquareReport']=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0xda'));db['SquareDetailsReport']=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0xdb'));db['JscriptyProject']=db[_0xb668('0x1')]['import'](_0xb668('0xdc'));db[_0xb668('0xdd')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0xde'));db['SquareOdbc']=db['sequelize'][_0xb668('0x14')](_0xb668('0xdf'));db[_0xb668('0xe0')]=db[_0xb668('0x1')]['import']('../api/squareProject/squareProject.model');db[_0xb668('0xe1')]=db[_0xb668('0x1')]['import'](_0xb668('0xe2'));db[_0xb668('0xe3')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0xe4'));db[_0xb668('0xe5')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0xe6'));db[_0xb668('0xe7')]=db['sequelize'][_0xb668('0x14')](_0xb668('0xe8'));db[_0xb668('0xe9')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0xea'));db[_0xb668('0xeb')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0xec'));db['Attachment']=db[_0xb668('0x1')][_0xb668('0x14')]('../api/attachment/attachment.model');db[_0xb668('0xed')]=db[_0xb668('0x1')][_0xb668('0x14')]('../api/plugin/plugin.model');db[_0xb668('0xee')]=db[_0xb668('0x1')]['import']('../api/mailTransferReport/mailTransferReport.model');db[_0xb668('0xef')]=db[_0xb668('0x1')]['import'](_0xb668('0xf0'));db['FaxTransferReport']=db[_0xb668('0x1')]['import'](_0xb668('0xf1'));db[_0xb668('0xf2')]=db[_0xb668('0x1')][_0xb668('0x14')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0xb668('0xf3')]=db[_0xb668('0x1')][_0xb668('0x14')]('../api/smsTransferReport/smsTransferReport.model');db['CmList']=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0xf4'));db[_0xb668('0xf5')]=db['sequelize'][_0xb668('0x14')](_0xb668('0xf6'));db[_0xb668('0xf7')]=db['sequelize'][_0xb668('0x14')](_0xb668('0xf8'));db[_0xb668('0xf9')]=db['sequelize'][_0xb668('0x14')](_0xb668('0xfa'));db[_0xb668('0xfb')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0xfc'));db[_0xb668('0xfd')]=db[_0xb668('0x1')][_0xb668('0x14')]('../api/userNotification/userNotification.model');db[_0xb668('0xfe')]=db['sequelize'][_0xb668('0x14')]('../api/whatsappAccount/whatsappAccount.model');db[_0xb668('0xff')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x100'));db[_0xb668('0x101')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x102'));db[_0xb668('0x103')]=db['sequelize'][_0xb668('0x14')](_0xb668('0x104'));db['WhatsappQueueReport']=db[_0xb668('0x1')]['import'](_0xb668('0x105'));db[_0xb668('0x106')]=db[_0xb668('0x1')]['import'](_0xb668('0x107'));db[_0xb668('0x108')]=db[_0xb668('0x1')]['import']('../api/whatsappQueue/whatsappQueue.model');db[_0xb668('0x109')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x10a'));db[_0xb668('0x10b')]=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x10c'));db['TeamVoicePrefix']=db[_0xb668('0x1')][_0xb668('0x14')](_0xb668('0x10d'));db[_0xb668('0x10e')]=db['sequelize']['import'](_0xb668('0x10f'));db[_0xb668('0x13')][_0xb668('0x110')](db['VoiceMail'],{'as':_0xb668('0x111'),'onDelete':_0xb668('0x112'),'foreignKey':_0xb668('0x113')});db['User'][_0xb668('0x114')](db[_0xb668('0x115')],{'as':_0xb668('0x116'),'foreignKey':_0xb668('0x113')});db[_0xb668('0x13')][_0xb668('0x114')](db[_0xb668('0x29')],{'as':_0xb668('0x117'),'foreignKey':_0xb668('0x113')});db[_0xb668('0x13')][_0xb668('0x114')](db[_0xb668('0x19')],{'as':_0xb668('0x118'),'onDelete':_0xb668('0x112'),'hooks':!![]});db[_0xb668('0x13')][_0xb668('0x114')](db[_0xb668('0x119')],{'as':_0xb668('0x11a'),'foreignKey':_0xb668('0x113')});db[_0xb668('0x13')][_0xb668('0x114')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':'UserId'});db[_0xb668('0x13')][_0xb668('0x114')](db[_0xb668('0x74')],{'as':_0xb668('0x74'),'foreignKey':_0xb668('0x113')});db['User'][_0xb668('0x114')](db[_0xb668('0x57')],{'as':_0xb668('0x11b'),'foreignKey':_0xb668('0x113')});db[_0xb668('0x13')][_0xb668('0x114')](db[_0xb668('0x5e')],{'as':_0xb668('0x11c'),'foreignKey':_0xb668('0x113')});db[_0xb668('0x13')][_0xb668('0x114')](db[_0xb668('0x4e')],{'as':_0xb668('0x11d'),'foreignKey':_0xb668('0x113')});db['User'][_0xb668('0x114')](db[_0xb668('0x46')],{'as':'FaxInteractions','foreignKey':_0xb668('0x113')});db['User'][_0xb668('0x114')](db['MailInteraction'],{'as':_0xb668('0x11e'),'foreignKey':_0xb668('0x113')});db[_0xb668('0x13')][_0xb668('0x114')](db[_0xb668('0x101')],{'as':_0xb668('0x11f'),'foreignKey':_0xb668('0x113')});db[_0xb668('0x13')]['hasMany'](db[_0xb668('0xfd')],{'as':'UserNotifications','foreignKey':_0xb668('0x120')});db[_0xb668('0x13')][_0xb668('0x121')](db[_0xb668('0xf7')],{'as':_0xb668('0xf7'),'foreignKey':_0xb668('0x122')});db['User'][_0xb668('0x123')](db['ChatGroup'],{'as':_0xb668('0x124'),'through':_0xb668('0x125')});db[_0xb668('0x13')][_0xb668('0x123')](db[_0xb668('0x6c')],{'as':_0xb668('0x126'),'through':'cm_user_has_contacts'});db[_0xb668('0x13')][_0xb668('0x123')](db[_0xb668('0x127')],{'as':_0xb668('0x128'),'through':_0xb668('0x129')});db['User'][_0xb668('0x123')](db[_0xb668('0xe5')],{'through':'user_has_teams'});db[_0xb668('0x13')][_0xb668('0x123')](db[_0xb668('0x3b')],{'as':_0xb668('0x11e'),'through':_0xb668('0x12a')});db[_0xb668('0x13')][_0xb668('0x123')](db[_0xb668('0x5e')],{'as':_0xb668('0x11c'),'through':_0xb668('0x12b')});db[_0xb668('0x13')][_0xb668('0x123')](db[_0xb668('0x46')],{'as':_0xb668('0x12c'),'through':_0xb668('0x12d')});db[_0xb668('0x13')][_0xb668('0x123')](db[_0xb668('0x4e')],{'as':_0xb668('0x11d'),'through':'user_has_sms_interactions'});db[_0xb668('0x13')][_0xb668('0x123')](db[_0xb668('0x57')],{'as':'OpenchannelInteractions','through':_0xb668('0x12e')});db[_0xb668('0x13')]['belongsToMany'](db['WhatsappInteraction'],{'as':_0xb668('0x11f'),'through':'user_has_whatsapp_interactions'});db['User'][_0xb668('0x123')](db[_0xb668('0x12f')],{'as':_0xb668('0x130'),'through':_0xb668('0x2b'),'required':![]});db[_0xb668('0x13')][_0xb668('0x123')](db[_0xb668('0xf5')],{'as':_0xb668('0x131'),'through':_0xb668('0x10e'),'required':![]});db[_0xb668('0x13')][_0xb668('0x123')](db[_0xb668('0x132')],{'as':_0xb668('0x133'),'through':_0xb668('0x2f'),'required':![]});db[_0xb668('0x13')][_0xb668('0x123')](db[_0xb668('0x64')],{'as':_0xb668('0x134'),'through':_0xb668('0x2d'),'required':![],'hooks':!![]});db['User'][_0xb668('0x123')](db['FaxQueue'],{'as':_0xb668('0x135'),'through':_0xb668('0x31'),'required':![]});db[_0xb668('0x13')][_0xb668('0x123')](db[_0xb668('0x51')],{'as':_0xb668('0x136'),'through':_0xb668('0x33'),'required':![]});db['User']['belongsToMany'](db[_0xb668('0x5a')],{'as':'OpenchannelQueues','through':_0xb668('0x35'),'required':![]});db['User'][_0xb668('0x123')](db[_0xb668('0x108')],{'as':'WhatsappQueues','through':_0xb668('0x37'),'required':![]});db[_0xb668('0x13')][_0xb668('0x123')](db[_0xb668('0x127')],{'through':_0xb668('0x129')});db[_0xb668('0x13')][_0xb668('0x123')](db[_0xb668('0x137')],{'as':_0xb668('0x138'),'through':_0xb668('0x139')});db[_0xb668('0x13')][_0xb668('0x123')](db[_0xb668('0x44')],{'as':'FaxAccounts','through':_0xb668('0x13a')});db[_0xb668('0x13')]['belongsToMany'](db['MailAccount'],{'as':_0xb668('0x13b'),'through':_0xb668('0x13c')});db[_0xb668('0x13')][_0xb668('0x123')](db[_0xb668('0x53')],{'as':_0xb668('0x13d'),'through':_0xb668('0x13e')});db['User'][_0xb668('0x123')](db[_0xb668('0x13f')],{'as':_0xb668('0x140'),'through':_0xb668('0x141')});db['User'][_0xb668('0x123')](db[_0xb668('0xfe')],{'as':_0xb668('0x142'),'through':_0xb668('0x143')});db[_0xb668('0x13')][_0xb668('0x123')](db[_0xb668('0xe0')],{'as':'SquareProjects','through':_0xb668('0x144')});db[_0xb668('0x16')][_0xb668('0x114')](db[_0xb668('0x19')],{'as':_0xb668('0x145'),'onDelete':_0xb668('0x112'),'foreignKey':_0xb668('0x146')});db[_0xb668('0x17')][_0xb668('0x114')](db[_0xb668('0x19')],{'onDelete':_0xb668('0x112')});db['VoiceExtension']['hasMany'](db[_0xb668('0x19')],{'as':_0xb668('0x147'),'onDelete':_0xb668('0x112')});db[_0xb668('0x1a')][_0xb668('0x123')](db[_0xb668('0x87')],{'as':'Sounds','through':_0xb668('0x148')});db[_0xb668('0x12f')][_0xb668('0x114')](db[_0xb668('0x29')],{'as':_0xb668('0x149'),'foreignKey':'VoiceQueueId'});db[_0xb668('0x12f')][_0xb668('0x114')](db[_0xb668('0x6e')],{'as':_0xb668('0x14a'),'foreignKey':_0xb668('0x14b')});db[_0xb668('0x12f')][_0xb668('0x114')](db[_0xb668('0x119')],{'as':'HopperFinals','foreignKey':_0xb668('0x14b')});db['VoiceQueue'][_0xb668('0x114')](db[_0xb668('0x72')],{'as':_0xb668('0x14c'),'foreignKey':_0xb668('0x14b')});db[_0xb668('0x12f')][_0xb668('0x114')](db[_0xb668('0x74')],{'as':_0xb668('0x74'),'foreignKey':_0xb668('0x14b')});db['VoiceQueue']['hasMany'](db[_0xb668('0x70')],{'as':_0xb668('0x14d'),'foreignKey':_0xb668('0x14b')});db[_0xb668('0x12f')][_0xb668('0x114')](db['JscriptySessionReport'],{'as':_0xb668('0x14e'),'foreignKey':_0xb668('0x14b')});db[_0xb668('0x12f')][_0xb668('0x121')](db[_0xb668('0x26')],{'as':'Trunk','foreignKey':_0xb668('0x14f')});db['VoiceQueue'][_0xb668('0x121')](db[_0xb668('0x26')],{'as':_0xb668('0x150'),'foreignKey':'TrunkBackupId'});db[_0xb668('0x12f')][_0xb668('0x121')](db[_0xb668('0x80')],{'as':'Interval','foreignKey':'IntervalId'});db[_0xb668('0x12f')][_0xb668('0x121')](db[_0xb668('0x81')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['VoiceQueue'][_0xb668('0x123')](db[_0xb668('0x127')],{'as':'Lists','through':'voice_queues_has_cm_lists'});db[_0xb668('0x12f')]['belongsToMany'](db[_0xb668('0x13')],{'as':'Agents','through':'UserVoiceQueue'});db[_0xb668('0x12f')][_0xb668('0x123')](db[_0xb668('0xe5')],{'as':'Teams','through':_0xb668('0x10b')});db['VoiceQueue']['belongsToMany'](db[_0xb668('0x127')],{'as':_0xb668('0x151'),'through':_0xb668('0x152')});db[_0xb668('0x115')][_0xb668('0x121')](db['User'],{'as':_0xb668('0x13'),'foreignKey':_0xb668('0x113')});db[_0xb668('0x153')][_0xb668('0x121')](db[_0xb668('0x13')],{'as':'User','foreignKey':'UserId'});db['VoiceMail'][_0xb668('0x114')](db['VoiceMailMessage'],{'as':_0xb668('0x154'),'onDelete':_0xb668('0x112'),'foreignKey':_0xb668('0x155'),'sourceKey':'mailbox'});db[_0xb668('0x20')]['belongsTo'](db[_0xb668('0x111')],{'foreignKey':'mailboxuser','targetKey':_0xb668('0x156')});db[_0xb668('0x21')][_0xb668('0x114')](db[_0xb668('0x157')],{'as':'QueueCalls','foreignKey':_0xb668('0x158'),'constraints':![]});db[_0xb668('0x21')]['hasMany'](db[_0xb668('0x159')],{'as':_0xb668('0x15a'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0xb668('0x121')](db[_0xb668('0x13')],{'as':_0xb668('0x13'),'foreignKey':_0xb668('0x113')});db[_0xb668('0x21')]['belongsTo'](db[_0xb668('0x6c')],{'as':_0xb668('0x15b'),'foreignKey':_0xb668('0x15c')});db['MailServerIn'][_0xb668('0x121')](db['MailAccount'],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0xb668('0x38')][_0xb668('0x121')](db[_0xb668('0x15d')],{'as':'MailAccount','foreignKey':'MailAccountId'});db['MailAccount'][_0xb668('0x110')](db[_0xb668('0x15e')],{'as':'Imap','onDelete':_0xb668('0x112')});db[_0xb668('0x15d')]['hasOne'](db[_0xb668('0x38')],{'as':_0xb668('0x15f'),'onDelete':'cascade'});db[_0xb668('0x15d')][_0xb668('0x114')](db[_0xb668('0x7c')],{'as':_0xb668('0x160'),'foreignKey':_0xb668('0x161'),'onDelete':_0xb668('0x112')});db[_0xb668('0x15d')]['hasMany'](db[_0xb668('0x162')],{'as':_0xb668('0x163'),'foreignKey':_0xb668('0x161')});db[_0xb668('0x15d')][_0xb668('0x114')](db[_0xb668('0x3d')],{'as':_0xb668('0x154'),'foreignKey':_0xb668('0x161')});db[_0xb668('0x15d')][_0xb668('0x114')](db['MailInteraction'],{'as':_0xb668('0x164')});db[_0xb668('0x15d')][_0xb668('0x114')](db[_0xb668('0x3e')],{'as':_0xb668('0x147')});db[_0xb668('0x15d')][_0xb668('0x121')](db['CmList'],{'as':_0xb668('0x165'),'foreignKey':_0xb668('0x166')});db[_0xb668('0x15d')][_0xb668('0x121')](db[_0xb668('0x8b')],{'as':_0xb668('0x8b'),'foreignKey':_0xb668('0x167')});db['MailAccount'][_0xb668('0x121')](db[_0xb668('0x81')],{'as':_0xb668('0x168'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xb668('0x15d')][_0xb668('0x123')](db[_0xb668('0x13')],{'as':_0xb668('0x169'),'through':'user_has_mail_accounts'});db[_0xb668('0x132')][_0xb668('0x123')](db[_0xb668('0x13')],{'as':_0xb668('0x169'),'through':'UserMailQueue'});db[_0xb668('0x132')]['belongsToMany'](db[_0xb668('0xe5')],{'through':_0xb668('0x16a'),'as':_0xb668('0x16b')});db['MailInteraction'][_0xb668('0x114')](db['MailMessage'],{'as':_0xb668('0x154'),'onDelete':_0xb668('0x112'),'foreignKey':_0xb668('0x16c')});db['MailInteraction'][_0xb668('0x121')](db[_0xb668('0x15d')],{'as':'Account','foreignKey':_0xb668('0x161')});db['MailInteraction'][_0xb668('0x121')](db[_0xb668('0x6c')],{'as':'Contact','foreignKey':_0xb668('0x15c')});db[_0xb668('0x3b')][_0xb668('0x121')](db[_0xb668('0x13')],{'as':_0xb668('0x16d'),'foreignKey':_0xb668('0x113')});db[_0xb668('0x3b')][_0xb668('0x123')](db['Tag'],{'through':'mail_interaction_has_tags','as':'Tags'});db[_0xb668('0x3b')][_0xb668('0x123')](db[_0xb668('0x89')],{'through':_0xb668('0x16e'),'as':'ThroughTags'});db[_0xb668('0x3b')][_0xb668('0x123')](db[_0xb668('0x13')],{'as':_0xb668('0x16f'),'through':'user_has_mail_interactions','foreignKey':'MailInteractionId'});db[_0xb668('0x3d')][_0xb668('0x114')](db[_0xb668('0x170')],{'as':_0xb668('0x171'),'onDelete':_0xb668('0x112')});db[_0xb668('0x3d')][_0xb668('0x121')](db[_0xb668('0x13')],{'as':'User'});db[_0xb668('0x3d')][_0xb668('0x121')](db['CmContact'],{'onDelete':_0xb668('0x112'),'as':_0xb668('0x15b')});db[_0xb668('0x3d')][_0xb668('0x121')](db[_0xb668('0x3b')],{'as':_0xb668('0x172'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0xb668('0x121')](db[_0xb668('0x15d')],{'as':_0xb668('0x173'),'foreignKey':_0xb668('0x161')});db[_0xb668('0x3d')][_0xb668('0x121')](db[_0xb668('0x137')],{'as':_0xb668('0x137'),'foreignKey':_0xb668('0x174')});db[_0xb668('0x3d')][_0xb668('0x121')](db[_0xb668('0x62')],{'as':_0xb668('0x62'),'foreignKey':_0xb668('0x175')});db[_0xb668('0x3e')][_0xb668('0x121')](db[_0xb668('0x13')],{'onDelete':_0xb668('0x176')});db[_0xb668('0x3e')][_0xb668('0x121')](db['MailQueue'],{'onDelete':_0xb668('0x176')});db[_0xb668('0x3e')][_0xb668('0x121')](db['MailAccount'],{'onDelete':'restrict'});db[_0xb668('0x3e')]['belongsTo'](db['Interval'],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0xb668('0x3e')][_0xb668('0x121')](db[_0xb668('0x89')],{'onDelete':_0xb668('0x176'),'foreignKey':_0xb668('0x177')});db[_0xb668('0x40')]['belongsTo'](db['MailAccount'],{});db[_0xb668('0x40')][_0xb668('0x121')](db['CmList'],{'as':_0xb668('0x165'),'foreignKey':_0xb668('0x166')});db[_0xb668('0x40')][_0xb668('0x121')](db[_0xb668('0x6c')],{'as':_0xb668('0x15b'),'foreignKey':_0xb668('0x15c')});db[_0xb668('0x40')]['belongsTo'](db[_0xb668('0x3b')],{});db[_0xb668('0x40')]['belongsTo'](db[_0xb668('0x3d')],{});db[_0xb668('0x40')][_0xb668('0x121')](db[_0xb668('0x13')],{});db[_0xb668('0x40')][_0xb668('0x121')](db[_0xb668('0x132')],{});db[_0xb668('0x178')][_0xb668('0x114')](db['DashboardItem'],{'as':'Items','onDelete':_0xb668('0x112')});db[_0xb668('0x44')][_0xb668('0x114')](db[_0xb668('0x7c')],{'as':'Dispositions','foreignKey':_0xb668('0x179'),'onDelete':_0xb668('0x112')});db['FaxAccount']['hasMany'](db[_0xb668('0x162')],{'as':'Answers','foreignKey':'FaxAccountId'});db[_0xb668('0x44')]['hasMany'](db[_0xb668('0x46')],{'as':_0xb668('0x164')});db[_0xb668('0x44')][_0xb668('0x114')](db['FaxApplication'],{'as':_0xb668('0x147')});db[_0xb668('0x44')][_0xb668('0x114')](db[_0xb668('0x19')],{'as':_0xb668('0x17a'),'onDelete':_0xb668('0x112')});db['FaxAccount'][_0xb668('0x114')](db[_0xb668('0x17b')],{'as':_0xb668('0x154')});db[_0xb668('0x44')][_0xb668('0x121')](db[_0xb668('0x26')],{'as':_0xb668('0x26')});db[_0xb668('0x44')]['belongsTo'](db[_0xb668('0x127')],{'as':_0xb668('0x165'),'foreignKey':_0xb668('0x166')});db[_0xb668('0x44')][_0xb668('0x121')](db[_0xb668('0x81')],{'as':'mandatoryDispositionPause','foreignKey':_0xb668('0x17c')});db[_0xb668('0x44')][_0xb668('0x123')](db[_0xb668('0x13')],{'as':_0xb668('0x169'),'through':_0xb668('0x13a')});db[_0xb668('0x17d')]['belongsTo'](db['User'],{'onDelete':_0xb668('0x176')});db[_0xb668('0x17d')][_0xb668('0x121')](db[_0xb668('0x49')],{'onDelete':_0xb668('0x176')});db[_0xb668('0x17d')][_0xb668('0x121')](db['FaxAccount'],{'onDelete':_0xb668('0x176')});db[_0xb668('0x17d')][_0xb668('0x121')](db[_0xb668('0x89')],{'onDelete':_0xb668('0x176'),'foreignKey':_0xb668('0x177')});db['FaxInteraction'][_0xb668('0x114')](db[_0xb668('0x17b')],{'as':_0xb668('0x154'),'onDelete':_0xb668('0x112'),'foreignKey':_0xb668('0x17e')});db[_0xb668('0x46')][_0xb668('0x121')](db[_0xb668('0x44')],{'as':_0xb668('0x173'),'foreignKey':_0xb668('0x179')});db[_0xb668('0x46')][_0xb668('0x121')](db['CmContact'],{'as':_0xb668('0x15b'),'foreignKey':_0xb668('0x15c')});db[_0xb668('0x46')][_0xb668('0x121')](db['User'],{'as':'Owner','foreignKey':_0xb668('0x113')});db[_0xb668('0x46')][_0xb668('0x123')](db['Tag'],{'through':_0xb668('0x17f'),'as':_0xb668('0x180')});db[_0xb668('0x46')][_0xb668('0x123')](db[_0xb668('0x89')],{'through':'fax_interaction_has_tags','as':_0xb668('0x181')});db[_0xb668('0x46')][_0xb668('0x123')](db['User'],{'as':_0xb668('0x16f'),'through':_0xb668('0x12d'),'foreignKey':_0xb668('0x17e')});db['FaxMessage'][_0xb668('0x121')](db['User'],{'onDelete':_0xb668('0x112'),'as':_0xb668('0x13')});db[_0xb668('0x17b')][_0xb668('0x121')](db[_0xb668('0x46')],{'as':_0xb668('0x172'),'foreignKey':_0xb668('0x17e')});db[_0xb668('0x17b')][_0xb668('0x121')](db[_0xb668('0x6c')],{'onDelete':_0xb668('0x112'),'as':_0xb668('0x15b')});db[_0xb668('0x17b')][_0xb668('0x121')](db[_0xb668('0x170')],{'as':_0xb668('0x170'),'foreignKey':_0xb668('0x182')});db[_0xb668('0x17b')][_0xb668('0x121')](db[_0xb668('0x44')],{'as':_0xb668('0x173'),'foreignKey':_0xb668('0x179')});db[_0xb668('0x49')][_0xb668('0x123')](db[_0xb668('0x13')],{'as':_0xb668('0x169'),'through':_0xb668('0x31')});db[_0xb668('0x49')][_0xb668('0x123')](db[_0xb668('0xe5')],{'through':'team_has_fax_queues','as':_0xb668('0x16b')});db[_0xb668('0x4b')][_0xb668('0x121')](db[_0xb668('0x44')],{});db['FaxQueueReport'][_0xb668('0x121')](db['CmList'],{'as':_0xb668('0x165'),'foreignKey':_0xb668('0x166')});db[_0xb668('0x4b')][_0xb668('0x121')](db[_0xb668('0x6c')],{'as':_0xb668('0x15b'),'foreignKey':_0xb668('0x15c')});db['FaxQueueReport'][_0xb668('0x121')](db[_0xb668('0x46')],{});db[_0xb668('0x4b')][_0xb668('0x121')](db[_0xb668('0x17b')],{});db['FaxQueueReport'][_0xb668('0x121')](db[_0xb668('0x13')],{});db['FaxQueueReport'][_0xb668('0x121')](db[_0xb668('0x49')],{});db['SmsAccount'][_0xb668('0x114')](db[_0xb668('0x7c')],{'as':_0xb668('0x160'),'foreignKey':_0xb668('0x183'),'onDelete':_0xb668('0x112')});db['SmsAccount']['hasMany'](db[_0xb668('0x162')],{'as':_0xb668('0x163'),'foreignKey':_0xb668('0x183')});db[_0xb668('0x13f')][_0xb668('0x114')](db[_0xb668('0x4f')],{'as':'Messages','foreignKey':'SmsAccountId'});db['SmsAccount'][_0xb668('0x114')](db[_0xb668('0x4e')],{'as':'Interactions'});db[_0xb668('0x13f')]['hasMany'](db['SmsApplication'],{'as':_0xb668('0x147')});db[_0xb668('0x13f')][_0xb668('0x121')](db['CmList'],{'as':_0xb668('0x165'),'foreignKey':'ListId'});db[_0xb668('0x13f')][_0xb668('0x121')](db[_0xb668('0x81')],{'as':_0xb668('0x168'),'foreignKey':_0xb668('0x17c')});db['SmsAccount'][_0xb668('0x123')](db[_0xb668('0x13')],{'as':_0xb668('0x169'),'through':_0xb668('0x141')});db[_0xb668('0x184')][_0xb668('0x121')](db[_0xb668('0x13')],{'onDelete':_0xb668('0x176')});db['SmsApplication']['belongsTo'](db[_0xb668('0x51')],{'onDelete':_0xb668('0x176')});db['SmsApplication'][_0xb668('0x121')](db[_0xb668('0x13f')],{'onDelete':_0xb668('0x176')});db[_0xb668('0x184')][_0xb668('0x121')](db[_0xb668('0x80')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0xb668('0x184')][_0xb668('0x121')](db[_0xb668('0x89')],{'onDelete':_0xb668('0x176'),'foreignKey':_0xb668('0x177')});db['SmsInteraction'][_0xb668('0x114')](db['SmsMessage'],{'as':_0xb668('0x154'),'onDelete':_0xb668('0x112'),'foreignKey':'SmsInteractionId'});db[_0xb668('0x4e')]['belongsTo'](db[_0xb668('0x13f')],{'as':_0xb668('0x173'),'foreignKey':'SmsAccountId'});db['SmsInteraction'][_0xb668('0x121')](db[_0xb668('0x6c')],{'as':_0xb668('0x15b'),'foreignKey':_0xb668('0x15c')});db[_0xb668('0x4e')][_0xb668('0x121')](db[_0xb668('0x13')],{'as':_0xb668('0x16d'),'foreignKey':_0xb668('0x113')});db['SmsInteraction'][_0xb668('0x123')](db[_0xb668('0x89')],{'through':_0xb668('0x185'),'as':'Tags'});db[_0xb668('0x4e')][_0xb668('0x123')](db[_0xb668('0x89')],{'through':'sms_interaction_has_tags','as':_0xb668('0x181')});db[_0xb668('0x4e')][_0xb668('0x123')](db[_0xb668('0x13')],{'as':_0xb668('0x16f'),'through':_0xb668('0x186'),'foreignKey':_0xb668('0x187')});db['SmsMessage']['belongsTo'](db[_0xb668('0x13')],{'as':_0xb668('0x13')});db[_0xb668('0x4f')]['belongsTo'](db['CmContact'],{'onDelete':_0xb668('0x112'),'as':_0xb668('0x15b')});db[_0xb668('0x4f')]['belongsTo'](db[_0xb668('0x4e')],{'onDelete':_0xb668('0x112'),'as':_0xb668('0x172'),'foreignKey':_0xb668('0x187')});db[_0xb668('0x4f')]['belongsTo'](db[_0xb668('0x13f')],{'as':_0xb668('0x173'),'foreignKey':_0xb668('0x183')});db[_0xb668('0x51')][_0xb668('0x123')](db[_0xb668('0x13')],{'as':_0xb668('0x169'),'through':_0xb668('0x33'),'foreignKey':_0xb668('0x188')});db[_0xb668('0x51')][_0xb668('0x123')](db[_0xb668('0xe5')],{'through':_0xb668('0x189'),'as':_0xb668('0x16b')});db[_0xb668('0x53')]['hasMany'](db[_0xb668('0x7c')],{'as':_0xb668('0x160'),'foreignKey':_0xb668('0x18a'),'onDelete':_0xb668('0x112')});db[_0xb668('0x53')][_0xb668('0x114')](db[_0xb668('0x162')],{'as':_0xb668('0x163'),'foreignKey':'OpenchannelAccountId'});db[_0xb668('0x53')][_0xb668('0x114')](db[_0xb668('0x57')],{'as':'Interactions','foreignKey':_0xb668('0x18a')});db[_0xb668('0x53')]['hasMany'](db[_0xb668('0x59')],{'as':_0xb668('0x154'),'foreignKey':_0xb668('0x18a')});db[_0xb668('0x53')]['hasMany'](db[_0xb668('0x55')],{'as':_0xb668('0x147'),'foreignKey':_0xb668('0x18a')});db[_0xb668('0x53')][_0xb668('0x121')](db['CmList'],{'as':_0xb668('0x165'),'foreignKey':_0xb668('0x166')});db[_0xb668('0x53')]['belongsTo'](db[_0xb668('0x81')],{'as':'mandatoryDispositionPause','foreignKey':_0xb668('0x17c')});db[_0xb668('0x53')][_0xb668('0x123')](db[_0xb668('0x13')],{'as':_0xb668('0x169'),'through':_0xb668('0x13e')});db[_0xb668('0x55')][_0xb668('0x121')](db[_0xb668('0x13')],{'onDelete':_0xb668('0x176')});db[_0xb668('0x55')][_0xb668('0x121')](db['OpenchannelQueue'],{'onDelete':_0xb668('0x176'),'foreignKey':_0xb668('0x18b')});db[_0xb668('0x55')][_0xb668('0x121')](db[_0xb668('0x53')],{'onDelete':_0xb668('0x176'),'foreignKey':_0xb668('0x18a')});db[_0xb668('0x55')][_0xb668('0x121')](db[_0xb668('0x80')],{'onDelete':_0xb668('0x176'),'foreignKey':_0xb668('0x18c')});db[_0xb668('0x55')][_0xb668('0x121')](db[_0xb668('0x89')],{'onDelete':_0xb668('0x176'),'foreignKey':_0xb668('0x177')});db[_0xb668('0x57')][_0xb668('0x114')](db[_0xb668('0x59')],{'as':_0xb668('0x154'),'onDelete':'cascade','foreignKey':_0xb668('0x18d')});db[_0xb668('0x57')][_0xb668('0x121')](db[_0xb668('0x53')],{'as':'Account','foreignKey':_0xb668('0x18a')});db['OpenchannelInteraction']['belongsTo'](db[_0xb668('0x6c')],{'as':_0xb668('0x15b'),'foreignKey':_0xb668('0x15c')});db[_0xb668('0x57')][_0xb668('0x121')](db[_0xb668('0x13')],{'as':'Owner','foreignKey':_0xb668('0x113')});db[_0xb668('0x57')][_0xb668('0x123')](db[_0xb668('0x89')],{'through':'openchannel_interaction_has_tags','as':_0xb668('0x180')});db[_0xb668('0x57')][_0xb668('0x123')](db['Tag'],{'through':_0xb668('0x18e'),'as':_0xb668('0x181')});db[_0xb668('0x57')][_0xb668('0x123')](db[_0xb668('0x13')],{'as':_0xb668('0x16f'),'through':_0xb668('0x12e'),'foreignKey':'OpenchannelInteractionId'});db[_0xb668('0x59')][_0xb668('0x121')](db[_0xb668('0x13')],{'onDelete':_0xb668('0x112'),'as':_0xb668('0x13')});db[_0xb668('0x59')][_0xb668('0x121')](db[_0xb668('0x6c')],{'onDelete':_0xb668('0x112'),'as':'Contact'});db[_0xb668('0x59')][_0xb668('0x121')](db['OpenchannelInteraction'],{'onDelete':_0xb668('0x112'),'as':'Interaction','foreignKey':_0xb668('0x18d')});db[_0xb668('0x59')]['belongsTo'](db['Attachment'],{'as':_0xb668('0x170'),'foreignKey':_0xb668('0x182')});db[_0xb668('0x59')][_0xb668('0x121')](db['OpenchannelAccount'],{'as':'Account','foreignKey':_0xb668('0x18a')});db[_0xb668('0x5a')]['belongsToMany'](db[_0xb668('0x13')],{'as':'Agents','through':_0xb668('0x35'),'foreignKey':'OpenchannelQueueId'});db[_0xb668('0x5a')][_0xb668('0x123')](db['Team'],{'through':'team_has_openchannel_queues','as':_0xb668('0x16b')});db['ChatWebsite'][_0xb668('0x114')](db['Disposition'],{'as':_0xb668('0x160'),'foreignKey':_0xb668('0x174'),'onDelete':_0xb668('0x112')});db['ChatWebsite']['hasMany'](db[_0xb668('0x162')],{'as':_0xb668('0x163'),'foreignKey':_0xb668('0x174')});db['ChatWebsite'][_0xb668('0x114')](db[_0xb668('0x68')],{'as':_0xb668('0x18f')});db[_0xb668('0x137')]['hasMany'](db[_0xb668('0x5e')],{'as':'Interactions'});db[_0xb668('0x137')]['hasMany'](db[_0xb668('0x5c')],{'as':_0xb668('0x147')});db[_0xb668('0x137')][_0xb668('0x114')](db[_0xb668('0x60')],{'as':_0xb668('0x154')});db['ChatWebsite'][_0xb668('0x121')](db[_0xb668('0x127')],{'as':'List','foreignKey':'ListId'});db[_0xb668('0x137')]['belongsTo'](db[_0xb668('0x80')],{'as':'Interval','foreignKey':_0xb668('0x18c')});db[_0xb668('0x137')][_0xb668('0x121')](db['MailAccount'],{'as':_0xb668('0x15d'),'foreignKey':'MailAccountId'});db[_0xb668('0x137')][_0xb668('0x121')](db[_0xb668('0x81')],{'as':_0xb668('0x168'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xb668('0x137')][_0xb668('0x123')](db[_0xb668('0x13')],{'as':'Agents','through':_0xb668('0x139')});db[_0xb668('0x190')][_0xb668('0x121')](db['OpenchannelAccount'],{});db[_0xb668('0x190')][_0xb668('0x121')](db['CmList'],{'as':'List','foreignKey':_0xb668('0x166')});db[_0xb668('0x190')]['belongsTo'](db[_0xb668('0x6c')],{'as':_0xb668('0x15b'),'foreignKey':_0xb668('0x15c')});db['OpenchannelQueueReport'][_0xb668('0x121')](db[_0xb668('0x57')],{});db[_0xb668('0x190')][_0xb668('0x121')](db[_0xb668('0x59')],{});db[_0xb668('0x190')][_0xb668('0x121')](db[_0xb668('0x13')],{});db[_0xb668('0x190')][_0xb668('0x121')](db[_0xb668('0x5a')],{});db[_0xb668('0x5c')][_0xb668('0x121')](db[_0xb668('0x13')],{'as':_0xb668('0x191'),'foreignKey':_0xb668('0x113'),'onDelete':_0xb668('0x176')});db[_0xb668('0x5c')][_0xb668('0x121')](db['ChatQueue'],{'as':_0xb668('0x192'),'foreignKey':_0xb668('0x193'),'onDelete':'restrict'});db['ChatApplication'][_0xb668('0x121')](db['ChatWebsite'],{'as':'Website','foreignKey':_0xb668('0x174'),'onDelete':'restrict'});db[_0xb668('0x5c')]['belongsTo'](db[_0xb668('0x89')],{'onDelete':_0xb668('0x176'),'foreignKey':_0xb668('0x177')});db['ChatInteraction'][_0xb668('0x114')](db[_0xb668('0x60')],{'as':'Messages','onDelete':_0xb668('0x112'),'foreignKey':_0xb668('0x194')});db[_0xb668('0x5e')][_0xb668('0x121')](db[_0xb668('0x137')],{'as':_0xb668('0x173'),'foreignKey':'ChatWebsiteId'});db[_0xb668('0x5e')][_0xb668('0x121')](db['CmContact'],{'as':_0xb668('0x15b'),'foreignKey':_0xb668('0x15c')});db[_0xb668('0x5e')]['belongsTo'](db[_0xb668('0x13')],{'as':_0xb668('0x16d'),'foreignKey':_0xb668('0x113')});db[_0xb668('0x5e')]['belongsToMany'](db['Tag'],{'through':_0xb668('0x195'),'as':_0xb668('0x180')});db[_0xb668('0x5e')][_0xb668('0x123')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0xb668('0x181')});db[_0xb668('0x5e')][_0xb668('0x123')](db[_0xb668('0x13')],{'as':_0xb668('0x16f'),'through':_0xb668('0x12b'),'foreignKey':_0xb668('0x194')});db[_0xb668('0x60')]['belongsTo'](db[_0xb668('0x13')],{'onDelete':_0xb668('0x112'),'as':_0xb668('0x13')});db[_0xb668('0x60')][_0xb668('0x121')](db[_0xb668('0x6c')],{'onDelete':_0xb668('0x112'),'as':_0xb668('0x15b'),'foreignKey':_0xb668('0x15c')});db[_0xb668('0x60')][_0xb668('0x121')](db[_0xb668('0x5e')],{'onDelete':_0xb668('0x112'),'as':_0xb668('0x172'),'foreignKey':_0xb668('0x194')});db[_0xb668('0x60')][_0xb668('0x121')](db[_0xb668('0x170')],{'as':_0xb668('0x170'),'foreignKey':_0xb668('0x182')});db[_0xb668('0x60')]['belongsTo'](db[_0xb668('0x137')],{'as':_0xb668('0x173'),'foreignKey':'ChatWebsiteId'});db[_0xb668('0x62')][_0xb668('0x114')](db[_0xb668('0x170')],{'as':_0xb668('0x171'),'foreignKey':_0xb668('0x175'),'onDelete':_0xb668('0x112'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db[_0xb668('0x6c')],{'onDelete':_0xb668('0x112'),'as':_0xb668('0x15b'),'foreignKey':'ContactId'});db[_0xb668('0x62')]['belongsTo'](db['ChatWebsite'],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0xb668('0x64')][_0xb668('0x123')](db[_0xb668('0x13')],{'as':_0xb668('0x169'),'through':_0xb668('0x2d'),'hooks':!![]});db[_0xb668('0x64')][_0xb668('0x123')](db[_0xb668('0xe5')],{'through':'team_has_chat_queues','as':_0xb668('0x16b')});db[_0xb668('0x66')][_0xb668('0x114')](db[_0xb668('0xd4')],{'as':_0xb668('0x154'),'foreignKey':'ChatGroupId','onDelete':'cascade'});db[_0xb668('0x66')][_0xb668('0x123')](db[_0xb668('0x13')],{'as':'Members','through':_0xb668('0x125')});db['ChatProactiveAction'][_0xb668('0x121')](db[_0xb668('0x137')],{'as':_0xb668('0x196'),'foreignKey':'ChatWebsiteId'});db[_0xb668('0x6a')][_0xb668('0x114')](db[_0xb668('0x6c')],{'as':_0xb668('0x126'),'foreignKey':_0xb668('0x197')});db[_0xb668('0x6c')][_0xb668('0x114')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0xb668('0x15c')});db[_0xb668('0x6c')]['hasMany'](db[_0xb668('0x119')],{'as':_0xb668('0x11a'),'foreignKey':'ContactId'});db[_0xb668('0x6c')][_0xb668('0x114')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0xb668('0x15c')});db[_0xb668('0x6c')]['hasMany'](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0xb668('0x15c')});db[_0xb668('0x6c')]['hasMany'](db['JscriptySessionReport'],{'as':_0xb668('0x14e'),'foreignKey':'ContactId'});db[_0xb668('0x6c')][_0xb668('0x114')](db[_0xb668('0x57')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0xb668('0x176')});db[_0xb668('0x6c')]['hasMany'](db[_0xb668('0x5e')],{'as':_0xb668('0x11c'),'foreignKey':_0xb668('0x15c'),'onDelete':_0xb668('0x176')});db['CmContact'][_0xb668('0x114')](db['SmsInteraction'],{'as':_0xb668('0x11d'),'foreignKey':_0xb668('0x15c'),'onDelete':_0xb668('0x176')});db[_0xb668('0x6c')][_0xb668('0x114')](db[_0xb668('0x46')],{'as':'FaxInteractions','foreignKey':_0xb668('0x15c'),'onDelete':_0xb668('0x176')});db['CmContact'][_0xb668('0x114')](db['MailInteraction'],{'as':_0xb668('0x11e'),'foreignKey':_0xb668('0x15c'),'onDelete':_0xb668('0x176')});db[_0xb668('0x6c')][_0xb668('0x121')](db[_0xb668('0x6a')],{'as':_0xb668('0x198'),'foreignKey':_0xb668('0x197')});db[_0xb668('0x6c')][_0xb668('0x121')](db[_0xb668('0x127')],{'as':_0xb668('0x165'),'foreignKey':_0xb668('0x166'),'onDelete':_0xb668('0x112')});db[_0xb668('0x6c')][_0xb668('0x123')](db[_0xb668('0x13')],{'as':_0xb668('0x16f'),'through':_0xb668('0x199')});db[_0xb668('0x6c')][_0xb668('0x123')](db[_0xb668('0x89')],{'as':'Tags','through':'cm_contact_has_tags'});db['CmContact'][_0xb668('0x123')](db['Tag'],{'through':_0xb668('0x19a'),'as':_0xb668('0x181')});db[_0xb668('0x6e')][_0xb668('0x121')](db[_0xb668('0x6c')],{'as':_0xb668('0x15b'),'foreignKey':_0xb668('0x15c'),'onDelete':_0xb668('0x112')});db[_0xb668('0x6e')][_0xb668('0x121')](db[_0xb668('0x127')],{'as':_0xb668('0x165'),'foreignKey':_0xb668('0x166'),'onDelete':_0xb668('0x112')});db[_0xb668('0x6e')]['belongsTo'](db[_0xb668('0x13')],{'as':'Agent','foreignKey':_0xb668('0x113')});db['CmHopper']['belongsTo'](db[_0xb668('0x12f')],{'as':'Queue','foreignKey':_0xb668('0x14b'),'onDelete':_0xb668('0x112')});db[_0xb668('0x6e')]['belongsTo'](db[_0xb668('0xe9')],{'as':_0xb668('0xe9'),'foreignKey':_0xb668('0x19b'),'onDelete':_0xb668('0x112')});db['CmHopper'][_0xb668('0x121')](db[_0xb668('0x13')],{'as':_0xb668('0x16d'),'foreignKey':_0xb668('0x19c')});db[_0xb668('0x70')][_0xb668('0x121')](db[_0xb668('0x6c')],{'as':_0xb668('0x15b'),'foreignKey':_0xb668('0x15c'),'onDelete':_0xb668('0x112')});db[_0xb668('0x70')]['belongsTo'](db[_0xb668('0x127')],{'as':_0xb668('0x165'),'foreignKey':'ListId','onDelete':'cascade'});db[_0xb668('0x70')][_0xb668('0x121')](db[_0xb668('0x12f')],{'as':_0xb668('0x192'),'foreignKey':_0xb668('0x14b'),'onDelete':_0xb668('0x112')});db[_0xb668('0x70')]['belongsTo'](db[_0xb668('0xe9')],{'as':_0xb668('0xe9'),'foreignKey':_0xb668('0x19b'),'onDelete':_0xb668('0x112')});db['Automation'][_0xb668('0x114')](db[_0xb668('0x7e')],{'as':{'plural':_0xb668('0x19d'),'singular':_0xb668('0x19e')},'foreignKey':_0xb668('0x19f'),'onDelete':'cascade','hooks':!![]});db[_0xb668('0x79')][_0xb668('0x114')](db[_0xb668('0x7e')],{'as':{'plural':_0xb668('0x1a0'),'singular':_0xb668('0x1a1')},'foreignKey':_0xb668('0x1a2'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0xb668('0x114')](db[_0xb668('0x77')],{'as':_0xb668('0x1a3'),'foreignKey':_0xb668('0x1a4'),'onDelete':_0xb668('0x112'),'hooks':!![]});db[_0xb668('0x7c')][_0xb668('0x114')](db[_0xb668('0x7c')],{'as':_0xb668('0x160'),'foreignKey':_0xb668('0x1a5'),'onDelete':'cascade'});db[_0xb668('0x80')]['hasMany'](db[_0xb668('0x80')],{'as':_0xb668('0x1a6'),'foreignKey':_0xb668('0x18c'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0xb668('0x80')][_0xb668('0x114')](db[_0xb668('0x19')],{'as':_0xb668('0x118'),'foreignKey':_0xb668('0x18c'),'onDelete':_0xb668('0x176')});db[_0xb668('0x80')]['hasMany'](db['MailApplication'],{'as':_0xb668('0x1a7'),'foreignKey':_0xb668('0x18c')});db['Interval'][_0xb668('0x114')](db[_0xb668('0x5c')],{'as':_0xb668('0x1a8'),'foreignKey':_0xb668('0x18c')});db[_0xb668('0x80')][_0xb668('0x114')](db[_0xb668('0x17d')],{'as':'FaxApplications','foreignKey':_0xb668('0x18c')});db[_0xb668('0x80')][_0xb668('0x114')](db[_0xb668('0x184')],{'as':_0xb668('0x1a9'),'foreignKey':_0xb668('0x18c')});db['Schedule'][_0xb668('0x121')](db['MailAccount'],{});db[_0xb668('0x86')][_0xb668('0x121')](db[_0xb668('0x96')],{'foreignKey':_0xb668('0x1aa')});db[_0xb668('0x86')][_0xb668('0x121')](db[_0xb668('0x95')],{'foreignKey':_0xb668('0x1ab')});db[_0xb668('0x87')][_0xb668('0x123')](db[_0xb668('0x1a')],{'as':_0xb668('0x1ac'),'through':_0xb668('0x148'),'onDelete':'restrict'});db['Tag']['belongsToMany'](db[_0xb668('0x6c')],{'through':_0xb668('0x19a')});db['Tag'][_0xb668('0x123')](db[_0xb668('0x5e')],{'through':_0xb668('0x195')});db[_0xb668('0x89')][_0xb668('0x123')](db[_0xb668('0x3b')],{'through':_0xb668('0x16e')});db[_0xb668('0x89')][_0xb668('0x123')](db[_0xb668('0x4e')],{'through':'sms_interaction_has_tags'});db[_0xb668('0x89')][_0xb668('0x123')](db['FaxInteraction'],{'through':_0xb668('0x17f')});db[_0xb668('0x89')]['belongsToMany'](db[_0xb668('0x57')],{'through':'openchannel_interaction_has_tags'});db[_0xb668('0x89')][_0xb668('0x123')](db[_0xb668('0x101')],{'through':_0xb668('0x1ad')});db[_0xb668('0x8d')][_0xb668('0x114')](db['Condition'],{'as':{'plural':_0xb668('0x1ae'),'singular':_0xb668('0x1af')},'foreignKey':_0xb668('0x1b0'),'onDelete':_0xb668('0x112'),'hooks':!![]});db[_0xb668('0x8d')][_0xb668('0x114')](db[_0xb668('0x7e')],{'as':{'plural':_0xb668('0x1b1'),'singular':_0xb668('0x1b2')},'foreignKey':_0xb668('0x1b3'),'onDelete':'cascade','hooks':!![]});db['Trigger']['hasMany'](db[_0xb668('0x77')],{'as':_0xb668('0x1a3'),'foreignKey':'TriggerId','onDelete':_0xb668('0x112'),'hooks':!![]});db[_0xb668('0x95')]['hasMany'](db[_0xb668('0x99')],{'as':'Fields','onDelete':_0xb668('0x112'),'foreignKey':_0xb668('0x1ab'),'hooks':!![]});db[_0xb668('0x96')][_0xb668('0x114')](db[_0xb668('0x99')],{'as':_0xb668('0x1b4'),'onDelete':_0xb668('0x112'),'foreignKey':_0xb668('0x1aa')});db['AnalyticMetric']['hasMany'](db[_0xb668('0x99')],{'as':_0xb668('0x1b4'),'onDelete':_0xb668('0x112'),'foreignKey':'MetricId'});db[_0xb668('0x99')][_0xb668('0x121')](db[_0xb668('0x98')],{'foreignKey':'MetricId'});db[_0xb668('0x9d')][_0xb668('0x114')](db[_0xb668('0x9e')],{'as':_0xb668('0x1b5'),'onDelete':_0xb668('0x112'),'foreignKey':_0xb668('0x1b6')});db['SalesforceConfiguration']['hasMany'](db[_0xb668('0xa0')],{'as':_0xb668('0x1b7'),'onDelete':_0xb668('0x112'),'foreignKey':'SubjectId'});db['SalesforceConfiguration']['hasMany'](db[_0xb668('0xa0')],{'as':_0xb668('0x1b8'),'onDelete':'cascade','foreignKey':_0xb668('0x1b9')});db[_0xb668('0x9e')][_0xb668('0x114')](db['SalesforceField'],{'as':_0xb668('0x1b4'),'onDelete':_0xb668('0x112'),'foreignKey':_0xb668('0x1ba')});db[_0xb668('0x9e')]['belongsTo'](db[_0xb668('0x9d')],{'as':_0xb668('0x173'),'foreignKey':_0xb668('0x1b6')});db[_0xb668('0xa0')][_0xb668('0x114')](db[_0xb668('0xa0')],{'as':'Subject','foreignKey':_0xb668('0x1bb')});db[_0xb668('0xa0')][_0xb668('0x114')](db[_0xb668('0xa0')],{'as':'Description','foreignKey':_0xb668('0x1b9')});db['SalesforceField'][_0xb668('0x114')](db[_0xb668('0xa0')],{'as':'Field','foreignKey':_0xb668('0x1ba')});db[_0xb668('0xa0')][_0xb668('0x121')](db[_0xb668('0x8f')],{'as':_0xb668('0x8f'),'foreignKey':_0xb668('0x1bc')});db[_0xb668('0xa1')][_0xb668('0x114')](db['SugarcrmConfiguration'],{'as':_0xb668('0x1b5'),'onDelete':'cascade','foreignKey':_0xb668('0x1b6')});db[_0xb668('0xa3')]['hasMany'](db[_0xb668('0xa5')],{'as':'Subjects','onDelete':_0xb668('0x112'),'foreignKey':_0xb668('0x1bb')});db[_0xb668('0xa3')]['hasMany'](db['SugarcrmField'],{'as':_0xb668('0x1b8'),'onDelete':'cascade','foreignKey':_0xb668('0x1b9')});db[_0xb668('0xa3')]['hasMany'](db['SugarcrmField'],{'as':_0xb668('0x1b4'),'onDelete':_0xb668('0x112'),'foreignKey':'FieldId'});db[_0xb668('0xa3')][_0xb668('0x121')](db['SugarcrmAccount'],{'as':_0xb668('0x173'),'foreignKey':'AccountId'});db[_0xb668('0xa5')][_0xb668('0x114')](db['SugarcrmField'],{'as':'Subject','foreignKey':_0xb668('0x1bb')});db[_0xb668('0xa5')]['hasMany'](db['SugarcrmField'],{'as':_0xb668('0x1bd'),'foreignKey':_0xb668('0x1b9')});db['SugarcrmField'][_0xb668('0x114')](db['SugarcrmField'],{'as':_0xb668('0x1be'),'foreignKey':_0xb668('0x1ba')});db[_0xb668('0xa5')][_0xb668('0x121')](db['Variable'],{'as':_0xb668('0x8f'),'foreignKey':'VariableId'});db[_0xb668('0xa7')][_0xb668('0x114')](db['DeskConfiguration'],{'as':_0xb668('0x1b5'),'onDelete':_0xb668('0x112'),'foreignKey':_0xb668('0x1b6')});db[_0xb668('0xa9')][_0xb668('0x114')](db['DeskField'],{'as':'Subjects','onDelete':_0xb668('0x112'),'foreignKey':_0xb668('0x1bb')});db[_0xb668('0xa9')][_0xb668('0x114')](db[_0xb668('0xaa')],{'as':_0xb668('0x1b8'),'onDelete':_0xb668('0x112'),'foreignKey':_0xb668('0x1b9')});db[_0xb668('0xa9')][_0xb668('0x114')](db['DeskField'],{'as':_0xb668('0x1b4'),'onDelete':'cascade','foreignKey':'FieldId'});db['DeskConfiguration'][_0xb668('0x121')](db[_0xb668('0xa7')],{'as':_0xb668('0x173'),'foreignKey':_0xb668('0x1b6')});db[_0xb668('0xa9')]['belongsToMany'](db[_0xb668('0x89')],{'through':_0xb668('0x1bf')});db[_0xb668('0xaa')][_0xb668('0x114')](db[_0xb668('0xaa')],{'as':_0xb668('0x1c0'),'foreignKey':'SubjectId'});db[_0xb668('0xaa')][_0xb668('0x114')](db[_0xb668('0xaa')],{'as':'Description','foreignKey':_0xb668('0x1b9')});db[_0xb668('0xaa')][_0xb668('0x114')](db[_0xb668('0xaa')],{'as':_0xb668('0x1be'),'foreignKey':_0xb668('0x1ba')});db['DeskField'][_0xb668('0x121')](db[_0xb668('0x8f')],{'as':_0xb668('0x8f'),'foreignKey':_0xb668('0x1bc')});db[_0xb668('0xac')]['hasMany'](db[_0xb668('0xae')],{'as':_0xb668('0x1b5'),'onDelete':_0xb668('0x112'),'foreignKey':_0xb668('0x1b6')});db[_0xb668('0xae')][_0xb668('0x114')](db[_0xb668('0xb0')],{'as':_0xb668('0x1b7'),'onDelete':_0xb668('0x112'),'foreignKey':_0xb668('0x1bb')});db[_0xb668('0xae')][_0xb668('0x114')](db['ZohoField'],{'as':_0xb668('0x1b8'),'onDelete':_0xb668('0x112'),'foreignKey':_0xb668('0x1b9')});db['ZohoConfiguration']['hasMany'](db[_0xb668('0xb0')],{'as':_0xb668('0x1b4'),'onDelete':_0xb668('0x112'),'foreignKey':'FieldId'});db['ZohoConfiguration'][_0xb668('0x121')](db['ZohoAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0xb668('0xb0')][_0xb668('0x114')](db['ZohoField'],{'as':_0xb668('0x1c0'),'foreignKey':_0xb668('0x1bb')});db[_0xb668('0xb0')][_0xb668('0x114')](db[_0xb668('0xb0')],{'as':_0xb668('0x1bd'),'foreignKey':_0xb668('0x1b9')});db[_0xb668('0xb0')][_0xb668('0x114')](db[_0xb668('0xb0')],{'as':'Field','foreignKey':_0xb668('0x1ba')});db[_0xb668('0xb0')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0xb668('0x1bc')});db[_0xb668('0xb2')][_0xb668('0x114')](db[_0xb668('0xb4')],{'as':_0xb668('0x1b5'),'onDelete':_0xb668('0x112'),'foreignKey':_0xb668('0x1b6')});db[_0xb668('0xb4')]['hasMany'](db[_0xb668('0xb6')],{'as':_0xb668('0x1b7'),'foreignKey':_0xb668('0x1bb')});db[_0xb668('0xb4')]['hasMany'](db['ZendeskField'],{'as':_0xb668('0x1b8'),'foreignKey':'DescriptionId'});db[_0xb668('0xb4')][_0xb668('0x114')](db[_0xb668('0xb6')],{'as':_0xb668('0x1b4'),'foreignKey':'FieldId'});db[_0xb668('0xb4')][_0xb668('0x121')](db[_0xb668('0xb2')],{'as':_0xb668('0x173'),'foreignKey':_0xb668('0x1b6')});db[_0xb668('0xb4')][_0xb668('0x123')](db[_0xb668('0x89')],{'through':'int_zendesk_configuration_has_tags'});db[_0xb668('0xb6')][_0xb668('0x114')](db[_0xb668('0xb6')],{'as':_0xb668('0x1c0'),'foreignKey':'SubjectId'});db[_0xb668('0xb6')][_0xb668('0x114')](db['ZendeskField'],{'as':_0xb668('0x1bd'),'foreignKey':_0xb668('0x1b9')});db['ZendeskField'][_0xb668('0x114')](db[_0xb668('0xb6')],{'as':_0xb668('0x1be'),'foreignKey':_0xb668('0x1ba')});db[_0xb668('0xb6')]['belongsTo'](db[_0xb668('0x8f')],{'as':_0xb668('0x8f'),'foreignKey':_0xb668('0x1bc')});db[_0xb668('0xb8')][_0xb668('0x114')](db['FreshdeskConfiguration'],{'as':_0xb668('0x1b5'),'onDelete':_0xb668('0x112'),'foreignKey':_0xb668('0x1b6')});db['FreshdeskConfiguration'][_0xb668('0x114')](db['FreshdeskField'],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xb668('0x1bb')});db[_0xb668('0xb9')][_0xb668('0x114')](db[_0xb668('0xbb')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xb668('0x1b9')});db[_0xb668('0xb9')][_0xb668('0x114')](db['FreshdeskField'],{'as':_0xb668('0x1b4'),'onDelete':_0xb668('0x112'),'foreignKey':_0xb668('0x1ba')});db['FreshdeskConfiguration'][_0xb668('0x121')](db[_0xb668('0xb8')],{'as':'Account','foreignKey':'AccountId'});db[_0xb668('0xb9')][_0xb668('0x123')](db[_0xb668('0x89')],{'through':_0xb668('0x1c1')});db[_0xb668('0xbb')]['hasMany'](db['FreshdeskField'],{'as':_0xb668('0x1c0'),'foreignKey':'SubjectId'});db[_0xb668('0xbb')][_0xb668('0x114')](db['FreshdeskField'],{'as':_0xb668('0x1bd'),'foreignKey':_0xb668('0x1b9')});db[_0xb668('0xbb')][_0xb668('0x114')](db[_0xb668('0xbb')],{'as':_0xb668('0x1be'),'foreignKey':_0xb668('0x1ba')});db[_0xb668('0xbb')]['belongsTo'](db[_0xb668('0x8f')],{'as':_0xb668('0x8f'),'foreignKey':_0xb668('0x1bc')});db['VtigerAccount'][_0xb668('0x114')](db[_0xb668('0x1c2')],{'as':_0xb668('0x1b5'),'onDelete':_0xb668('0x112'),'foreignKey':'AccountId'});db[_0xb668('0x1c2')]['hasMany'](db[_0xb668('0xc0')],{'as':'Subjects','foreignKey':_0xb668('0x1bb')});db[_0xb668('0x1c2')][_0xb668('0x114')](db['VtigerField'],{'as':_0xb668('0x1b8'),'foreignKey':_0xb668('0x1b9')});db[_0xb668('0x1c2')][_0xb668('0x114')](db[_0xb668('0xc0')],{'as':_0xb668('0x1b4'),'foreignKey':_0xb668('0x1ba')});db[_0xb668('0x1c2')][_0xb668('0x121')](db[_0xb668('0xbd')],{'as':_0xb668('0x173'),'foreignKey':_0xb668('0x1b6')});db['VtigerField'][_0xb668('0x114')](db['VtigerField'],{'as':_0xb668('0x1c0'),'foreignKey':_0xb668('0x1bb')});db['VtigerField'][_0xb668('0x114')](db[_0xb668('0xc0')],{'as':'Description','foreignKey':_0xb668('0x1b9')});db[_0xb668('0xc0')][_0xb668('0x114')](db[_0xb668('0xc0')],{'as':'Field','foreignKey':_0xb668('0x1ba')});db[_0xb668('0xc0')][_0xb668('0x121')](db[_0xb668('0x8f')],{'as':_0xb668('0x8f'),'foreignKey':'VariableId'});db[_0xb668('0xc2')]['hasMany'](db['ServicenowConfiguration'],{'as':_0xb668('0x1b5'),'onDelete':'cascade','foreignKey':_0xb668('0x1b6')});db['ServicenowConfiguration'][_0xb668('0x114')](db['ServicenowField'],{'as':_0xb668('0x1b7'),'foreignKey':_0xb668('0x1bb')});db['ServicenowConfiguration'][_0xb668('0x114')](db[_0xb668('0xc5')],{'as':_0xb668('0x1b8'),'foreignKey':'DescriptionId'});db[_0xb668('0xc4')][_0xb668('0x114')](db[_0xb668('0xc5')],{'as':_0xb668('0x1b4'),'foreignKey':_0xb668('0x1ba')});db[_0xb668('0xc4')][_0xb668('0x121')](db[_0xb668('0xc2')],{'as':_0xb668('0x173'),'foreignKey':_0xb668('0x1b6')});db[_0xb668('0xc5')][_0xb668('0x114')](db['ServicenowField'],{'as':_0xb668('0x1c0'),'foreignKey':_0xb668('0x1bb')});db[_0xb668('0xc5')][_0xb668('0x114')](db[_0xb668('0xc5')],{'as':'Description','foreignKey':_0xb668('0x1b9')});db[_0xb668('0xc5')]['hasMany'](db[_0xb668('0xc5')],{'as':_0xb668('0x1be'),'foreignKey':_0xb668('0x1ba')});db[_0xb668('0xc5')]['belongsTo'](db[_0xb668('0x8f')],{'as':_0xb668('0x8f'),'foreignKey':'VariableId'});db[_0xb668('0xc7')]['hasMany'](db[_0xb668('0x1c3')],{'as':_0xb668('0x1b5'),'onDelete':_0xb668('0x112'),'foreignKey':_0xb668('0x1b6')});db[_0xb668('0x1c3')]['hasMany'](db[_0xb668('0xc9')],{'as':_0xb668('0x1b7'),'onDelete':_0xb668('0x112'),'foreignKey':'SubjectId'});db[_0xb668('0x1c3')][_0xb668('0x114')](db[_0xb668('0xc9')],{'as':_0xb668('0x1b8'),'onDelete':_0xb668('0x112'),'foreignKey':_0xb668('0x1b9')});db[_0xb668('0x1c3')][_0xb668('0x114')](db['Dynamics365Field'],{'as':_0xb668('0x1b4'),'onDelete':_0xb668('0x112'),'foreignKey':_0xb668('0x1ba')});db[_0xb668('0x1c3')]['belongsTo'](db['Dynamics365Account'],{'as':_0xb668('0x173'),'foreignKey':_0xb668('0x1b6')});db[_0xb668('0xc9')][_0xb668('0x114')](db[_0xb668('0xc9')],{'as':_0xb668('0x1c0'),'foreignKey':_0xb668('0x1bb')});db[_0xb668('0xc9')][_0xb668('0x114')](db[_0xb668('0xc9')],{'as':_0xb668('0x1bd'),'foreignKey':'DescriptionId'});db[_0xb668('0xc9')][_0xb668('0x114')](db[_0xb668('0xc9')],{'as':_0xb668('0x1be'),'foreignKey':_0xb668('0x1ba')});db['Dynamics365Field']['belongsTo'](db['Variable'],{'as':_0xb668('0x8f'),'foreignKey':'VariableId'});db['FreshsalesAccount']['hasMany'](db['FreshsalesConfiguration'],{'as':'Configurations','onDelete':_0xb668('0x112'),'foreignKey':_0xb668('0x1b6')});db[_0xb668('0xcd')][_0xb668('0x114')](db[_0xb668('0xcf')],{'as':_0xb668('0x1b7'),'foreignKey':'SubjectId'});db[_0xb668('0xcd')]['hasMany'](db[_0xb668('0xcf')],{'as':'Descriptions','foreignKey':_0xb668('0x1b9')});db[_0xb668('0xcd')][_0xb668('0x114')](db['FreshsalesField'],{'as':_0xb668('0x1b4'),'foreignKey':_0xb668('0x1ba')});db['FreshsalesConfiguration'][_0xb668('0x121')](db[_0xb668('0xcb')],{'as':_0xb668('0x173'),'foreignKey':_0xb668('0x1b6')});db['FreshsalesField']['hasMany'](db[_0xb668('0xcf')],{'as':_0xb668('0x1c0'),'foreignKey':'SubjectId'});db[_0xb668('0xcf')][_0xb668('0x114')](db[_0xb668('0xcf')],{'as':_0xb668('0x1bd'),'foreignKey':_0xb668('0x1b9')});db[_0xb668('0xcf')]['hasMany'](db[_0xb668('0xcf')],{'as':_0xb668('0x1be'),'foreignKey':_0xb668('0x1ba')});db[_0xb668('0xcf')]['belongsTo'](db[_0xb668('0x8f')],{'as':_0xb668('0x8f'),'foreignKey':_0xb668('0x1bc')});db[_0xb668('0xd3')][_0xb668('0x121')](db['ChatWebsite'],{});db['ChatQueueReport'][_0xb668('0x121')](db['CmList'],{'as':_0xb668('0x165'),'foreignKey':_0xb668('0x166')});db['ChatQueueReport'][_0xb668('0x121')](db['CmContact'],{'as':'Contact','foreignKey':_0xb668('0x15c')});db[_0xb668('0xd3')][_0xb668('0x121')](db['ChatInteraction'],{});db[_0xb668('0xd3')][_0xb668('0x121')](db['ChatMessage'],{});db['ChatQueueReport'][_0xb668('0x121')](db[_0xb668('0x13')],{});db['ChatQueueReport'][_0xb668('0x121')](db[_0xb668('0x64')],{});db[_0xb668('0xd4')]['belongsTo'](db[_0xb668('0x13')],{'onDelete':'cascade','foreignKey':_0xb668('0x1c4')});db[_0xb668('0xd4')][_0xb668('0x121')](db['User'],{'onDelete':_0xb668('0x112'),'foreignKey':_0xb668('0x1c5')});db[_0xb668('0x1c6')][_0xb668('0x114')](db[_0xb668('0x1c7')],{'foreignKey':_0xb668('0x1c8'),'onDelete':_0xb668('0x112')});db[_0xb668('0x1c6')][_0xb668('0x114')](db[_0xb668('0xd5')],{'foreignKey':_0xb668('0x1c8'),'onDelete':_0xb668('0x112')});db[_0xb668('0xd9')][_0xb668('0x121')](db['SmsAccount'],{});db[_0xb668('0xd9')][_0xb668('0x121')](db[_0xb668('0x127')],{'as':_0xb668('0x165'),'foreignKey':_0xb668('0x166')});db[_0xb668('0xd9')]['belongsTo'](db[_0xb668('0x6c')],{'as':'Contact','foreignKey':_0xb668('0x15c')});db[_0xb668('0xd9')][_0xb668('0x121')](db[_0xb668('0x4e')],{});db[_0xb668('0xd9')]['belongsTo'](db[_0xb668('0x4f')],{});db[_0xb668('0xd9')][_0xb668('0x121')](db[_0xb668('0x13')],{});db[_0xb668('0xd9')][_0xb668('0x121')](db[_0xb668('0x51')],{});db['JscriptyProject']['hasMany'](db['JscriptySessionReport'],{'foreignKey':'ProjectId'});db[_0xb668('0x1c9')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':_0xb668('0x1ca')});db['JscriptyProject'][_0xb668('0x114')](db[_0xb668('0xd5')],{'foreignKey':_0xb668('0x1ca')});db[_0xb668('0xe0')]['belongsToMany'](db['User'],{'as':_0xb668('0x16f'),'through':_0xb668('0x144')});db[_0xb668('0xe5')]['belongsToMany'](db[_0xb668('0x13')],{'as':_0xb668('0x169'),'through':'user_has_teams'});db['Team'][_0xb668('0x123')](db['VoiceQueue'],{'through':'TeamVoiceQueue','as':_0xb668('0x130')});db[_0xb668('0xe5')][_0xb668('0x123')](db['MailQueue'],{'through':_0xb668('0x16a'),'as':_0xb668('0x133')});db[_0xb668('0xe5')][_0xb668('0x123')](db['ChatQueue'],{'through':'team_has_chat_queues','as':'ChatQueues'});db[_0xb668('0xe5')]['belongsToMany'](db[_0xb668('0x49')],{'through':'team_has_fax_queues','as':_0xb668('0x135')});db[_0xb668('0xe5')][_0xb668('0x123')](db[_0xb668('0x51')],{'through':_0xb668('0x189'),'as':_0xb668('0x136')});db[_0xb668('0xe5')][_0xb668('0x123')](db[_0xb668('0x5a')],{'through':_0xb668('0x1cb'),'as':_0xb668('0x1cc')});db[_0xb668('0xe5')][_0xb668('0x123')](db[_0xb668('0x108')],{'through':'team_has_whatsapp_queues','as':_0xb668('0x1cd')});db[_0xb668('0xe5')][_0xb668('0x123')](db['VoicePrefix'],{'through':_0xb668('0x1ce'),'as':_0xb668('0x131')});db['Campaign'][_0xb668('0x114')](db[_0xb668('0x6e')],{'as':_0xb668('0x14a'),'foreignKey':_0xb668('0x19b')});db[_0xb668('0xe9')][_0xb668('0x114')](db[_0xb668('0x119')],{'as':_0xb668('0x11a'),'foreignKey':_0xb668('0x19b')});db[_0xb668('0xe9')][_0xb668('0x114')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0xb668('0x19b')});db[_0xb668('0xe9')][_0xb668('0x114')](db[_0xb668('0x70')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db['Campaign'][_0xb668('0x121')](db[_0xb668('0x26')],{'as':_0xb668('0x26'),'foreignKey':_0xb668('0x14f')});db['Campaign'][_0xb668('0x121')](db[_0xb668('0x26')],{'as':'TrunkBackup','foreignKey':_0xb668('0x1cf')});db[_0xb668('0xe9')]['belongsTo'](db[_0xb668('0x80')],{'as':_0xb668('0x80'),'foreignKey':_0xb668('0x18c')});db[_0xb668('0xe9')][_0xb668('0x121')](db[_0xb668('0xe0')],{'as':_0xb668('0xe0'),'foreignKey':_0xb668('0x1d0')});db[_0xb668('0xe9')][_0xb668('0x123')](db[_0xb668('0x127')],{'as':'Lists','through':_0xb668('0x1d1')});db['Campaign'][_0xb668('0x123')](db[_0xb668('0x127')],{'as':_0xb668('0x151'),'through':_0xb668('0x1d2')});db[_0xb668('0x170')][_0xb668('0x121')](db[_0xb668('0x62')],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db[_0xb668('0xee')][_0xb668('0x121')](db[_0xb668('0x3d')],{});db[_0xb668('0xee')][_0xb668('0x121')](db[_0xb668('0x3b')],{});db[_0xb668('0xee')][_0xb668('0x121')](db['MailAccount'],{'foreignKey':_0xb668('0x1d3'),'as':_0xb668('0x1d4')});db[_0xb668('0xee')]['belongsTo'](db['User'],{'foreignKey':_0xb668('0x1d5'),'as':'FromAgent'});db[_0xb668('0xee')][_0xb668('0x121')](db[_0xb668('0x13')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xb668('0xee')][_0xb668('0x121')](db[_0xb668('0x132')],{'foreignKey':_0xb668('0x1d6'),'as':'ToQueue'});db[_0xb668('0xee')][_0xb668('0x121')](db[_0xb668('0x15d')],{'foreignKey':_0xb668('0x1d7'),'as':_0xb668('0x1d8')});db[_0xb668('0xef')][_0xb668('0x121')](db[_0xb668('0x60')],{});db[_0xb668('0xef')][_0xb668('0x121')](db[_0xb668('0x5e')],{});db[_0xb668('0xef')][_0xb668('0x121')](db['ChatWebsite'],{'foreignKey':'FromChatWebsiteId','as':_0xb668('0x1d4')});db[_0xb668('0xef')][_0xb668('0x121')](db[_0xb668('0x13')],{'foreignKey':_0xb668('0x1d5'),'as':_0xb668('0x1d9')});db[_0xb668('0xef')][_0xb668('0x121')](db[_0xb668('0x13')],{'foreignKey':_0xb668('0x1da'),'as':'ToAgent'});db['ChatTransferReport'][_0xb668('0x121')](db[_0xb668('0x64')],{'foreignKey':_0xb668('0x1db'),'as':_0xb668('0x1dc')});db[_0xb668('0xef')]['belongsTo'](db['ChatWebsite'],{'foreignKey':'ToChatWebsiteId','as':'ToAccount'});db[_0xb668('0x1dd')]['belongsTo'](db[_0xb668('0x17b')],{});db['FaxTransferReport']['belongsTo'](db[_0xb668('0x46')],{});db['FaxTransferReport'][_0xb668('0x121')](db['FaxAccount'],{'foreignKey':_0xb668('0x1de'),'as':'FromAccount'});db[_0xb668('0x1dd')][_0xb668('0x121')](db[_0xb668('0x13')],{'foreignKey':_0xb668('0x1d5'),'as':_0xb668('0x1d9')});db['FaxTransferReport'][_0xb668('0x121')](db['User'],{'foreignKey':_0xb668('0x1da'),'as':_0xb668('0x1df')});db[_0xb668('0x1dd')][_0xb668('0x121')](db[_0xb668('0x49')],{'foreignKey':'ToFaxQueueId','as':_0xb668('0x1dc')});db[_0xb668('0x1dd')][_0xb668('0x121')](db[_0xb668('0x44')],{'foreignKey':'ToFaxAccountId','as':_0xb668('0x1d8')});db[_0xb668('0xf2')]['belongsTo'](db[_0xb668('0x59')],{});db[_0xb668('0xf2')][_0xb668('0x121')](db[_0xb668('0x57')],{});db[_0xb668('0xf2')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0xb668('0x1d4')});db[_0xb668('0xf2')][_0xb668('0x121')](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xb668('0xf2')][_0xb668('0x121')](db[_0xb668('0x13')],{'foreignKey':_0xb668('0x1da'),'as':'ToAgent'});db[_0xb668('0xf2')][_0xb668('0x121')](db['OpenchannelQueue'],{'foreignKey':_0xb668('0x1e0'),'as':'ToQueue'});db[_0xb668('0xf2')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0xb668('0x1e1'),'as':_0xb668('0x1d8')});db[_0xb668('0xf3')][_0xb668('0x121')](db[_0xb668('0x4f')],{});db[_0xb668('0xf3')]['belongsTo'](db[_0xb668('0x4e')],{});db[_0xb668('0xf3')][_0xb668('0x121')](db[_0xb668('0x13f')],{'foreignKey':'FromSmsAccountId','as':_0xb668('0x1d4')});db[_0xb668('0xf3')][_0xb668('0x121')](db[_0xb668('0x13')],{'foreignKey':_0xb668('0x1d5'),'as':_0xb668('0x1d9')});db[_0xb668('0xf3')]['belongsTo'](db['User'],{'foreignKey':_0xb668('0x1da'),'as':_0xb668('0x1df')});db[_0xb668('0xf3')][_0xb668('0x121')](db['SmsQueue'],{'foreignKey':_0xb668('0x1e2'),'as':'ToQueue'});db[_0xb668('0xf3')][_0xb668('0x121')](db[_0xb668('0x13f')],{'foreignKey':_0xb668('0x1e3'),'as':'ToAccount'});db['CmList'][_0xb668('0x114')](db[_0xb668('0x7c')],{'as':_0xb668('0x160'),'foreignKey':_0xb668('0x166'),'onDelete':_0xb668('0x112')});db['CmList'][_0xb668('0x114')](db['CmCustomField'],{'as':_0xb668('0x1e4'),'foreignKey':_0xb668('0x166')});db[_0xb668('0x127')][_0xb668('0x114')](db[_0xb668('0x6c')],{'as':_0xb668('0x126'),'onDelete':'cascade','foreignKey':'ListId'});db[_0xb668('0x127')]['hasMany'](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':'ListId'});db[_0xb668('0x127')][_0xb668('0x114')](db[_0xb668('0x72')],{'as':_0xb668('0x1e5'),'foreignKey':_0xb668('0x166')});db[_0xb668('0x127')]['hasMany'](db[_0xb668('0x74')],{'as':_0xb668('0x74'),'foreignKey':_0xb668('0x166')});db[_0xb668('0x127')]['belongsToMany'](db[_0xb668('0x12f')],{'as':_0xb668('0x1e6'),'through':'voice_queues_has_cm_lists'});db[_0xb668('0x127')]['belongsToMany'](db['User'],{'as':_0xb668('0x169'),'through':_0xb668('0x129')});db['VoicePrefix']['hasMany'](db[_0xb668('0x19')],{'as':_0xb668('0x118'),'onDelete':'cascade'});db[_0xb668('0xf5')][_0xb668('0x123')](db[_0xb668('0x13')],{'as':_0xb668('0x169'),'through':_0xb668('0x10e')});db[_0xb668('0xf5')][_0xb668('0x123')](db['Team'],{'through':'TeamVoicePrefix','as':_0xb668('0x16b')});db['UserProfile']['hasMany'](db[_0xb668('0x13')],{'as':_0xb668('0x16f'),'foreignKey':_0xb668('0x122')});db[_0xb668('0xf7')][_0xb668('0x114')](db[_0xb668('0xf9')],{'as':_0xb668('0x1e7'),'foreignKey':_0xb668('0x122'),'onDelete':_0xb668('0x112')});db[_0xb668('0xf9')][_0xb668('0x114')](db[_0xb668('0xfb')],{'as':_0xb668('0x1e8'),'foreignKey':_0xb668('0x1e9'),'onDelete':_0xb668('0x112')});db[_0xb668('0xfe')]['hasMany'](db['Disposition'],{'as':_0xb668('0x160'),'foreignKey':_0xb668('0x1ea'),'onDelete':'cascade'});db[_0xb668('0xfe')][_0xb668('0x114')](db[_0xb668('0x162')],{'as':_0xb668('0x163'),'foreignKey':_0xb668('0x1ea')});db[_0xb668('0xfe')][_0xb668('0x114')](db[_0xb668('0x103')],{'as':_0xb668('0x154'),'foreignKey':'WhatsappAccountId'});db[_0xb668('0xfe')]['hasMany'](db[_0xb668('0x101')],{'as':_0xb668('0x164')});db[_0xb668('0xfe')][_0xb668('0x114')](db[_0xb668('0xff')],{'as':_0xb668('0x147')});db['WhatsappAccount'][_0xb668('0x121')](db[_0xb668('0x127')],{'as':_0xb668('0x165'),'foreignKey':_0xb668('0x166')});db['WhatsappAccount'][_0xb668('0x121')](db[_0xb668('0x81')],{'as':_0xb668('0x168'),'foreignKey':_0xb668('0x17c')});db[_0xb668('0xfe')]['belongsToMany'](db[_0xb668('0x13')],{'as':'Agents','through':_0xb668('0x143')});db['WhatsappApplication'][_0xb668('0x121')](db[_0xb668('0x13')],{'onDelete':_0xb668('0x176')});db[_0xb668('0xff')][_0xb668('0x121')](db[_0xb668('0x108')],{'onDelete':_0xb668('0x176')});db[_0xb668('0xff')][_0xb668('0x121')](db[_0xb668('0xfe')],{'onDelete':_0xb668('0x176')});db[_0xb668('0xff')]['belongsTo'](db[_0xb668('0x80')],{'onDelete':_0xb668('0x176'),'foreignKey':_0xb668('0x18c')});db['WhatsappApplication'][_0xb668('0x121')](db[_0xb668('0x89')],{'onDelete':'restrict','foreignKey':_0xb668('0x177')});db[_0xb668('0x101')]['hasMany'](db[_0xb668('0x103')],{'as':_0xb668('0x154'),'onDelete':_0xb668('0x112'),'foreignKey':_0xb668('0x1eb')});db[_0xb668('0x101')][_0xb668('0x121')](db[_0xb668('0xfe')],{'as':_0xb668('0x173'),'foreignKey':_0xb668('0x1ea')});db['WhatsappInteraction'][_0xb668('0x121')](db[_0xb668('0x6c')],{'as':_0xb668('0x15b'),'foreignKey':_0xb668('0x15c')});db[_0xb668('0x101')][_0xb668('0x121')](db['User'],{'as':_0xb668('0x16d'),'foreignKey':'UserId'});db[_0xb668('0x101')][_0xb668('0x123')](db[_0xb668('0x89')],{'through':'whatsapp_interaction_has_tags','as':_0xb668('0x180')});db[_0xb668('0x101')][_0xb668('0x123')](db[_0xb668('0x89')],{'through':_0xb668('0x1ad'),'as':'ThroughTags'});db[_0xb668('0x101')][_0xb668('0x123')](db[_0xb668('0x13')],{'as':_0xb668('0x16f'),'through':'user_has_whatsapp_interactions','foreignKey':_0xb668('0x1eb')});db[_0xb668('0x103')][_0xb668('0x121')](db[_0xb668('0x13')],{'as':_0xb668('0x13')});db['WhatsappMessage'][_0xb668('0x121')](db[_0xb668('0x6c')],{'onDelete':_0xb668('0x112'),'as':_0xb668('0x15b')});db['WhatsappMessage'][_0xb668('0x121')](db[_0xb668('0x101')],{'onDelete':_0xb668('0x112'),'as':'Interaction','foreignKey':_0xb668('0x1eb')});db[_0xb668('0x103')]['belongsTo'](db['WhatsappAccount'],{'as':_0xb668('0x173'),'foreignKey':'WhatsappAccountId'});db[_0xb668('0x1ec')][_0xb668('0x121')](db[_0xb668('0xfe')],{});db['WhatsappQueueReport'][_0xb668('0x121')](db[_0xb668('0x127')],{'as':_0xb668('0x165'),'foreignKey':_0xb668('0x166')});db[_0xb668('0x1ec')][_0xb668('0x121')](db[_0xb668('0x6c')],{'as':_0xb668('0x15b'),'foreignKey':_0xb668('0x15c')});db[_0xb668('0x1ec')][_0xb668('0x121')](db[_0xb668('0x101')],{});db[_0xb668('0x1ec')][_0xb668('0x121')](db['WhatsappQueue'],{});db[_0xb668('0x1ec')][_0xb668('0x121')](db[_0xb668('0x103')],{});db[_0xb668('0x1ec')][_0xb668('0x121')](db['User'],{});db[_0xb668('0x106')][_0xb668('0x121')](db[_0xb668('0x103')],{});db[_0xb668('0x106')]['belongsTo'](db['WhatsappInteraction'],{});db['WhatsappTransferReport'][_0xb668('0x121')](db[_0xb668('0xfe')],{'foreignKey':'FromWhatsappAccountId','as':_0xb668('0x1d4')});db['WhatsappTransferReport']['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0xb668('0x1ed'),'as':_0xb668('0x1d8')});db['WhatsappTransferReport'][_0xb668('0x121')](db[_0xb668('0x108')],{'foreignKey':_0xb668('0x1ee'),'as':'ToQueue'});db['WhatsappTransferReport'][_0xb668('0x121')](db[_0xb668('0x13')],{'foreignKey':_0xb668('0x1d5'),'as':_0xb668('0x1d9')});db['WhatsappTransferReport'][_0xb668('0x121')](db['User'],{'foreignKey':_0xb668('0x1da'),'as':_0xb668('0x1df')});db[_0xb668('0x108')][_0xb668('0x123')](db[_0xb668('0x13')],{'as':_0xb668('0x169'),'through':_0xb668('0x37'),'foreignKey':'WhatsappQueueId'});db['WhatsappQueue']['belongsToMany'](db[_0xb668('0xe5')],{'through':_0xb668('0x1ef'),'as':_0xb668('0x16b')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index f028def..979fb1b 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6e5b=['./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','./api/team','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/realtime','/api/auth/local','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','/apidoc','root','/www','static','join','/demo','snippet','3.0.0','/:url(api|auth|components|app|bower_components|assets)/*','get','/index.html','username','newPassword','apiKey','firstName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','code','accessKey','token','channelSecret','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','key','accountSid','localstationid','secret','oldPassword','isPlainObject','isArray','length','replace','@@{','includes','lodash','express','util','./config/environment','./config/logger','auth','./safe-template','safeTemplate','default','use','logger','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','url','statusCode','responseTime','user','name','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','remoteAddress','role','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/applications','./api/faxApplication','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','/api/chat/applications','/api/chat/interactions','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/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/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/configurations','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc'];(function(_0x36b400,_0x277ec5){var _0x4d47bf=function(_0x55372b){while(--_0x55372b){_0x36b400['push'](_0x36b400['shift']());}};_0x4d47bf(++_0x277ec5);}(_0x6e5b,0x1ae));var _0xb6e5=function(_0x3d48cb,_0x1fbe1f){_0x3d48cb=_0x3d48cb-0x0;var _0x170a55=_0x6e5b[_0x3d48cb];return _0x170a55;};'use strict';var _=require(_0xb6e5('0x0'));var path=require('path');var express=require(_0xb6e5('0x1'));var ewinston=require('express-winston');var util=require(_0xb6e5('0x2'));var errors=require('./errors');var config=require(_0xb6e5('0x3'));var logger=require(_0xb6e5('0x4'))('api');var authLogger=require(_0xb6e5('0x4'))(_0xb6e5('0x5'));var safeTemplate=require(_0xb6e5('0x6'))[_0xb6e5('0x7')];exports[_0xb6e5('0x8')]=function(_0x3aea3b){_0x3aea3b[_0xb6e5('0x9')](ewinston[_0xb6e5('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x38c9b7,_0x5a05b0){var _0x6be65c='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_['isEmpty'](_0x38c9b7[_0xb6e5('0xb')])){_0x6be65c+=_0xb6e5('0xc');var _0x28b5eb=_0x38c9b7[_0xb6e5('0xb')];maskSensitiveData(_0x28b5eb);}return safeTemplate(util[_0xb6e5('0xd')](_0x6be65c,_0x38c9b7[_0xb6e5('0xe')],_0x38c9b7[_0xb6e5('0xf')][_0xb6e5('0x10')]?_0x38c9b7[_0xb6e5('0xf')][_0xb6e5('0x10')]:_0x38c9b7[_0xb6e5('0x11')]['remoteAddress']||_0x38c9b7['ip'],_0x38c9b7[_0xb6e5('0x12')],_0x5a05b0[_0xb6e5('0x13')],_0x5a05b0[_0xb6e5('0x14')],_0x38c9b7[_0xb6e5('0x15')]?_0x38c9b7['user']['id']:null,_0x38c9b7[_0xb6e5('0x15')]?_0x38c9b7[_0xb6e5('0x15')][_0xb6e5('0x16')]:null,_0x38c9b7[_0xb6e5('0x15')]?_0x38c9b7[_0xb6e5('0x15')]['role']:null,_0x28b5eb?util[_0xb6e5('0x17')](_0x28b5eb,![],null):''));}}));_0x3aea3b[_0xb6e5('0x9')](ewinston[_0xb6e5('0xa')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x283853,_0x241906){var _0x543467=_0xb6e5('0x18');if(_0x283853[_0xb6e5('0xb')]&&_0x283853['body'][_0xb6e5('0x19')]&&_0x283853['body'][_0xb6e5('0x1a')]){_0x543467='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xb6e5('0xd')](_0x543467,_0x283853[_0xb6e5('0xe')],_0x283853[_0xb6e5('0xf')][_0xb6e5('0x10')]?_0x283853[_0xb6e5('0xf')][_0xb6e5('0x10')]:_0x283853['connection'][_0xb6e5('0x1b')]||_0x283853['ip'],_0x283853['url'],_0x241906[_0xb6e5('0x13')],_0x241906[_0xb6e5('0x14')],_0x283853[_0xb6e5('0x15')]?_0x283853[_0xb6e5('0x15')]['id']:null,_0x283853['user']?_0x283853[_0xb6e5('0x15')][_0xb6e5('0x16')]:null,_0x283853['user']?_0x283853[_0xb6e5('0x15')][_0xb6e5('0x1c')]:null,_0x283853[_0xb6e5('0xb')]&&_0x283853['body'][_0xb6e5('0x19')]?_0x283853[_0xb6e5('0xb')][_0xb6e5('0x19')]:_0xb6e5('0x1d'),_0x283853[_0xb6e5('0xb')]&&_0x283853[_0xb6e5('0xb')][_0xb6e5('0x1a')]?_0x283853[_0xb6e5('0xb')][_0xb6e5('0x1a')]:'',_0x283853['body']&&_0x283853['body']['agent_name']?_0x283853[_0xb6e5('0xb')][_0xb6e5('0x1e')]:'');},'ignoreRoute':function(_0x48cdbc){var _0x3dd14c=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3dd14c[_0xb6e5('0x1f')](_0x48cdbc[_0xb6e5('0x12')]);}}));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x20'),require(_0xb6e5('0x21')));_0x3aea3b['use'](_0xb6e5('0x22'),require('./api/voiceChanSpy'));_0x3aea3b['use'](_0xb6e5('0x23'),require(_0xb6e5('0x24')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x25'),require(_0xb6e5('0x26')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x27'),require(_0xb6e5('0x28')));_0x3aea3b['use'](_0xb6e5('0x29'),require('./api/voiceQueue'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x2a'),require(_0xb6e5('0x2b')));_0x3aea3b[_0xb6e5('0x9')]('/api/screen/recordings',require(_0xb6e5('0x2c')));_0x3aea3b[_0xb6e5('0x9')]('/api/voice/mails',require(_0xb6e5('0x2d')));_0x3aea3b['use'](_0xb6e5('0x2e'),require(_0xb6e5('0x2f')));_0x3aea3b[_0xb6e5('0x9')]('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x3aea3b['use'](_0xb6e5('0x30'),require(_0xb6e5('0x31')));_0x3aea3b[_0xb6e5('0x9')]('/api/voice/agents/reports',require(_0xb6e5('0x32')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x33'),require(_0xb6e5('0x34')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x35'),require(_0xb6e5('0x36')));_0x3aea3b[_0xb6e5('0x9')]('/api/trunks',require(_0xb6e5('0x37')));_0x3aea3b[_0xb6e5('0x9')]('/api/voice/transfers/reports',require('./api/voiceTransferReport'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x38'),require(_0xb6e5('0x39')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x3a'),require('./api/mailAccount'));_0x3aea3b['use']('/api/mail/queues',require(_0xb6e5('0x3b')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x3c'),require(_0xb6e5('0x3d')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x3e'),require(_0xb6e5('0x3f')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x40'),require(_0xb6e5('0x41')));_0x3aea3b[_0xb6e5('0x9')]('/api/mail/applications',require(_0xb6e5('0x42')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x43'),require(_0xb6e5('0x44')));_0x3aea3b['use'](_0xb6e5('0x45'),require('./api/dashboard'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x46'),require(_0xb6e5('0x47')));_0x3aea3b['use']('/api/fax/accounts',require('./api/faxAccount'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x48'),require(_0xb6e5('0x49')));_0x3aea3b[_0xb6e5('0x9')]('/api/fax/interactions',require(_0xb6e5('0x4a')));_0x3aea3b[_0xb6e5('0x9')]('/api/fax/messages',require(_0xb6e5('0x4b')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x4c'),require(_0xb6e5('0x4d')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x4e'),require(_0xb6e5('0x4f')));_0x3aea3b[_0xb6e5('0x9')]('/api/sms/accounts',require(_0xb6e5('0x50')));_0x3aea3b[_0xb6e5('0x9')]('/api/sms/applications',require(_0xb6e5('0x51')));_0x3aea3b[_0xb6e5('0x9')]('/api/sms/interactions',require(_0xb6e5('0x52')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x53'),require(_0xb6e5('0x54')));_0x3aea3b['use'](_0xb6e5('0x55'),require(_0xb6e5('0x56')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x57'),require('./api/openchannelAccount'));_0x3aea3b['use'](_0xb6e5('0x58'),require(_0xb6e5('0x59')));_0x3aea3b['use'](_0xb6e5('0x5a'),require(_0xb6e5('0x5b')));_0x3aea3b['use']('/api/openchannel/messages',require('./api/openchannelMessage'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x5c'),require(_0xb6e5('0x5d')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x5e'),require('./api/chatWebsite'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x5f'),require('./api/openchannelQueueReport'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x60'),require('./api/chatApplication'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x61'),require('./api/chatInteraction'));_0x3aea3b[_0xb6e5('0x9')]('/api/chat/messages',require('./api/chatMessage'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x62'),require('./api/chatOfflineMessage'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x63'),require(_0xb6e5('0x64')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x65'),require('./api/chatGroup'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x66'),require(_0xb6e5('0x67')));_0x3aea3b[_0xb6e5('0x9')]('/api/cm/companies',require(_0xb6e5('0x68')));_0x3aea3b['use'](_0xb6e5('0x69'),require(_0xb6e5('0x6a')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x6b'),require('./api/cmHopper'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x6c'),require(_0xb6e5('0x6d')));_0x3aea3b[_0xb6e5('0x9')]('/api/cm/hopper_final',require(_0xb6e5('0x6e')));_0x3aea3b['use'](_0xb6e5('0x6f'),require('./api/cmHopperHistory'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x70'),require(_0xb6e5('0x71')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x72'),require(_0xb6e5('0x73')));_0x3aea3b['use']('/api/automations',require(_0xb6e5('0x74')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x75'),require(_0xb6e5('0x76')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x77'),require('./api/disposition'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x78'),require(_0xb6e5('0x79')));_0x3aea3b[_0xb6e5('0x9')]('/api/intervals',require(_0xb6e5('0x7a')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x7b'),require(_0xb6e5('0x7c')));_0x3aea3b['use']('/api/cdr',require(_0xb6e5('0x7d')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x7e'),require(_0xb6e5('0x7f')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x80'),require(_0xb6e5('0x81')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x82'),require(_0xb6e5('0x83')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x84'),require(_0xb6e5('0x85')));_0x3aea3b[_0xb6e5('0x9')]('/api/templates',require('./api/template'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x86'),require(_0xb6e5('0x87')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x88'),require(_0xb6e5('0x89')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x8a'),require('./api/integration'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x8b'),require('./api/integrationReport'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x8c'),require(_0xb6e5('0x8d')));_0x3aea3b['use'](_0xb6e5('0x8e'),require(_0xb6e5('0x8f')));_0x3aea3b[_0xb6e5('0x9')]('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x90'),require(_0xb6e5('0x91')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x92'),require('./api/analyticFieldReport'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x93'),require(_0xb6e5('0x94')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x95'),require(_0xb6e5('0x96')));_0x3aea3b['use'](_0xb6e5('0x97'),require(_0xb6e5('0x98')));_0x3aea3b['use'](_0xb6e5('0x99'),require('./api/intSalesforceField'));_0x3aea3b['use'](_0xb6e5('0x9a'),require(_0xb6e5('0x9b')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x9c'),require(_0xb6e5('0x9d')));_0x3aea3b[_0xb6e5('0x9')]('/api/integrations/sugarcrm/fields',require('./api/intSugarcrmField'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x9e'),require(_0xb6e5('0x9f')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xa0'),require(_0xb6e5('0xa1')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xa2'),require(_0xb6e5('0xa3')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xa4'),require('./api/intZohoAccount'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xa5'),require(_0xb6e5('0xa6')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xa7'),require(_0xb6e5('0xa8')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xa9'),require(_0xb6e5('0xaa')));_0x3aea3b[_0xb6e5('0x9')]('/api/integrations/zendesk/configurations',require(_0xb6e5('0xab')));_0x3aea3b[_0xb6e5('0x9')]('/api/integrations/zendesk/fields',require(_0xb6e5('0xac')));_0x3aea3b['use'](_0xb6e5('0xad'),require('./api/intFreshdeskAccount'));_0x3aea3b[_0xb6e5('0x9')]('/api/integrations/freshdesk/configurations',require('./api/intFreshdeskConfiguration'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xae'),require(_0xb6e5('0xaf')));_0x3aea3b['use']('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xb0'),require('./api/intVtigerConfiguration'));_0x3aea3b[_0xb6e5('0x9')]('/api/integrations/vtiger/fields',require('./api/intVtigerField'));_0x3aea3b['use'](_0xb6e5('0xb1'),require(_0xb6e5('0xb2')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xb3'),require(_0xb6e5('0xb4')));_0x3aea3b['use'](_0xb6e5('0xb5'),require(_0xb6e5('0xb6')));_0x3aea3b['use'](_0xb6e5('0xb7'),require(_0xb6e5('0xb8')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xb9'),require('./api/intDynamics365Configuration'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xba'),require(_0xb6e5('0xbb')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xbc'),require('./api/intFreshsalesAccount'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xbd'),require(_0xb6e5('0xbe')));_0x3aea3b['use'](_0xb6e5('0xbf'),require(_0xb6e5('0xc0')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xc1'),require(_0xb6e5('0xc2')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xc3'),require(_0xb6e5('0xc4')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xc5'),require(_0xb6e5('0xc6')));_0x3aea3b[_0xb6e5('0x9')]('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xc7'),require('./api/jscriptyQuestionReport'));_0x3aea3b['use'](_0xb6e5('0xc8'),require('./api/jscriptySessionReport'));_0x3aea3b[_0xb6e5('0x9')]('/api/sms/reports/queue',require(_0xb6e5('0xc9')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xca'),require(_0xb6e5('0xcb')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xcc'),require(_0xb6e5('0xcd')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xce'),require(_0xb6e5('0xcf')));_0x3aea3b['use'](_0xb6e5('0xd0'),require('./api/setting'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xd1'),require(_0xb6e5('0xd2')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xd3'),require(_0xb6e5('0xd4')));_0x3aea3b['use'](_0xb6e5('0xd5'),require(_0xb6e5('0xd6')));_0x3aea3b[_0xb6e5('0x9')]('/api/square/messages',require(_0xb6e5('0xd7')));_0x3aea3b['use'](_0xb6e5('0xd8'),require(_0xb6e5('0xd9')));_0x3aea3b[_0xb6e5('0x9')]('/api/license',require(_0xb6e5('0xda')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xdb'),require(_0xb6e5('0xdc')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xdd'),require(_0xb6e5('0xde')));_0x3aea3b['use'](_0xb6e5('0xdf'),require(_0xb6e5('0xe0')));_0x3aea3b[_0xb6e5('0x9')]('/api/plugins',require(_0xb6e5('0xe1')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xe2'),require(_0xb6e5('0xe3')));_0x3aea3b['use'](_0xb6e5('0xe4'),require('./api/chatTransferReport'));_0x3aea3b['use'](_0xb6e5('0xe5'),require(_0xb6e5('0xe6')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xe7'),require(_0xb6e5('0xe8')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xe9'),require(_0xb6e5('0xea')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xeb'),require(_0xb6e5('0xec')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xed'),require('./api/voicePrefix'));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xee'),require(_0xb6e5('0xef')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xf0'),require(_0xb6e5('0xf1')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xf2'),require('./api/userProfileResource'));_0x3aea3b['use']('/api/userNotifications',require(_0xb6e5('0xf3')));_0x3aea3b[_0xb6e5('0x9')]('/api/whatsapp/accounts',require(_0xb6e5('0xf4')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xf5'),require(_0xb6e5('0xf6')));_0x3aea3b['use']('/api/whatsapp/interactions',require(_0xb6e5('0xf7')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xf8'),require(_0xb6e5('0xf9')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xfa'),require(_0xb6e5('0xfb')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xfc'),require(_0xb6e5('0xfd')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0xfe'),require(_0xb6e5('0xff')));_0x3aea3b['use'](_0xb6e5('0x100'),require('./api/cloudProvider'));_0x3aea3b[_0xb6e5('0x9')]('/api/realtime',require(_0xb6e5('0x101')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x102'),require('./api/authLocal'));_0x3aea3b['use']('/api/auth/google',require(_0xb6e5('0x103')));_0x3aea3b[_0xb6e5('0x9')]('/api/auth/activedirectory',require('./api/authActiveDirectory'));_0x3aea3b['use'](_0xb6e5('0x104'),require(_0xb6e5('0x105')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x106'),require(_0xb6e5('0x107')));_0x3aea3b[_0xb6e5('0x9')]('/api/version',require(_0xb6e5('0x108')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x109'),require(_0xb6e5('0x10a')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x10b'),require(_0xb6e5('0x10c')));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x10d'),require('./api/webbar'));_0x3aea3b['use'](_0xb6e5('0x10e'),express['static'](path['join'](config[_0xb6e5('0x10f')],_0xb6e5('0x10e'))));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x110'),express[_0xb6e5('0x111')](path[_0xb6e5('0x112')](config[_0xb6e5('0x10f')],_0xb6e5('0x110'))));_0x3aea3b[_0xb6e5('0x9')](_0xb6e5('0x113'),express['static'](path[_0xb6e5('0x112')](config[_0xb6e5('0x10f')],_0xb6e5('0x113'))));_0x3aea3b[_0xb6e5('0x9')]('/snippet',express[_0xb6e5('0x111')](path[_0xb6e5('0x112')](config['root'],_0xb6e5('0x114'),_0xb6e5('0x115'))));_0x3aea3b[_0xb6e5('0x9')]('/plugins',express['static'](path['join'](config[_0xb6e5('0x10f')],'/server/files/plugins')));_0x3aea3b['route'](_0xb6e5('0x116'))[_0xb6e5('0x117')](errors[0x194]);_0x3aea3b['route']('/*')[_0xb6e5('0x117')](function(_0x3c25f5,_0xacf7b2){_0xacf7b2['sendFile'](path['resolve'](_0x3aea3b[_0xb6e5('0x117')]('appPath')+_0xb6e5('0x118')));});};var sensitiveFields=[_0xb6e5('0x119'),'password',_0xb6e5('0x11a'),_0xb6e5('0x11b'),_0xb6e5('0x11c'),'lastName',_0xb6e5('0x11d'),_0xb6e5('0x11e'),_0xb6e5('0x11f'),_0xb6e5('0x120'),_0xb6e5('0x121'),_0xb6e5('0x122'),_0xb6e5('0x123'),_0xb6e5('0x124'),_0xb6e5('0x125'),_0xb6e5('0x126'),'tenantId',_0xb6e5('0x127'),_0xb6e5('0x128'),_0xb6e5('0x129'),_0xb6e5('0x12a'),'authToken',_0xb6e5('0x12b'),_0xb6e5('0x12c'),_0xb6e5('0x12d'),_0xb6e5('0x12e'),_0xb6e5('0x12f'),_0xb6e5('0x130'),_0xb6e5('0x131'),_0xb6e5('0x132'),'privateKey',_0xb6e5('0x133'),_0xb6e5('0x134'),_0xb6e5('0x135'),'user','pass',_0xb6e5('0x136'),_0xb6e5('0x137'),'dsn',_0xb6e5('0x138'),'registry',_0xb6e5('0x139')];function maskSensitiveData(_0x28491b){var _0x52ecb7=/(?!^)[\s\S](?!$)/g;if(!_[_0xb6e5('0x13a')](_0x28491b))return;for(var _0x400538 in _0x28491b){if(_[_0xb6e5('0x13b')](_0x28491b[_0x400538])){for(var _0xfc9399=0x0;_0xfc9399<_0x28491b[_0x400538][_0xb6e5('0x13c')];_0xfc9399++){maskSensitiveData(_0x28491b[_0x400538][_0xfc9399]);}}else if(_[_0xb6e5('0x13a')](_0x28491b[_0x400538])){maskSensitiveData(_0x28491b[_0x400538]);}else if(_['isString'](_0x28491b[_0x400538])){_0x28491b[_0x400538]=_0x28491b[_0x400538][_0xb6e5('0x13d')](/{{{/g,_0xb6e5('0x13e'))[_0xb6e5('0x13d')](/}}}/g,'}@@')[_0xb6e5('0x13d')](/{{/g,'@{')[_0xb6e5('0x13d')](/}}/g,'}@');if(_[_0xb6e5('0x13f')](sensitiveFields,_0x400538)){_0x28491b[_0x400538]=_0x28491b[_0x400538][_0xb6e5('0x13d')](_0x52ecb7,'*');}}}} \ No newline at end of file +var _0xafec=['clientEmail','privateKey','key','pass','localstationid','dsn','secret','oldPassword','isPlainObject','isArray','length','isString','@@{','replace','}@@','includes','path','express','express-winston','util','./config/environment','api','./config/logger','./safe-template','safeTemplate','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','x-forwarded-for','headers','remoteAddress','url','statusCode','responseTime','user','name','role','inspect','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','connection','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','/api/chat/proactive_actions','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','/api/dispositions','/api/conditions','./api/condition','/api/intervals','./api/interval','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','/api/integrations','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','./api/license','/api/migrations','./api/migration','/api/attachments','/api/plugins','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','./api/realtime','/api/auth/local','./api/authLocal','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','join','root','/apidoc','/www','static','/demo','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','username','newPassword','apiKey','street','fax','email','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xafec,0x161));var _0xcafe=function(_0x287ca1,_0x9e0fba){_0x287ca1=_0x287ca1-0x0;var _0x88ce7e=_0xafec[_0x287ca1];return _0x88ce7e;};'use strict';var _=require('lodash');var path=require(_0xcafe('0x0'));var express=require(_0xcafe('0x1'));var ewinston=require(_0xcafe('0x2'));var util=require(_0xcafe('0x3'));var errors=require('./errors');var config=require(_0xcafe('0x4'));var logger=require('./config/logger')(_0xcafe('0x5'));var authLogger=require(_0xcafe('0x6'))('auth');var safeTemplate=require(_0xcafe('0x7'))[_0xcafe('0x8')];exports[_0xcafe('0x9')]=function(_0x27062a){_0x27062a[_0xcafe('0xa')](ewinston[_0xcafe('0xb')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0xed4ea1,_0x35762a){var _0x21bef8=_0xcafe('0xc');if(!_[_0xcafe('0xd')](_0xed4ea1[_0xcafe('0xe')])){_0x21bef8+='\x20body=%s';var _0x433b66=_0xed4ea1['body'];maskSensitiveData(_0x433b66);}return safeTemplate(util[_0xcafe('0xf')](_0x21bef8,_0xed4ea1['method'],_0xed4ea1['headers'][_0xcafe('0x10')]?_0xed4ea1[_0xcafe('0x11')][_0xcafe('0x10')]:_0xed4ea1['connection'][_0xcafe('0x12')]||_0xed4ea1['ip'],_0xed4ea1[_0xcafe('0x13')],_0x35762a[_0xcafe('0x14')],_0x35762a[_0xcafe('0x15')],_0xed4ea1['user']?_0xed4ea1[_0xcafe('0x16')]['id']:null,_0xed4ea1[_0xcafe('0x16')]?_0xed4ea1['user'][_0xcafe('0x17')]:null,_0xed4ea1[_0xcafe('0x16')]?_0xed4ea1['user'][_0xcafe('0x18')]:null,_0x433b66?util[_0xcafe('0x19')](_0x433b66,![],null):''));}}));_0x27062a[_0xcafe('0xa')](ewinston[_0xcafe('0xb')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x2e26ef,_0x1a4a47){var _0x45dc6d='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x2e26ef[_0xcafe('0xe')]&&_0x2e26ef[_0xcafe('0xe')][_0xcafe('0x1a')]&&_0x2e26ef[_0xcafe('0xe')][_0xcafe('0x1b')]){_0x45dc6d=_0xcafe('0x1c');}return util['format'](_0x45dc6d,_0x2e26ef[_0xcafe('0x1d')],_0x2e26ef[_0xcafe('0x11')][_0xcafe('0x10')]?_0x2e26ef[_0xcafe('0x11')][_0xcafe('0x10')]:_0x2e26ef[_0xcafe('0x1e')][_0xcafe('0x12')]||_0x2e26ef['ip'],_0x2e26ef[_0xcafe('0x13')],_0x1a4a47['statusCode'],_0x1a4a47[_0xcafe('0x15')],_0x2e26ef[_0xcafe('0x16')]?_0x2e26ef['user']['id']:null,_0x2e26ef[_0xcafe('0x16')]?_0x2e26ef[_0xcafe('0x16')][_0xcafe('0x17')]:null,_0x2e26ef[_0xcafe('0x16')]?_0x2e26ef[_0xcafe('0x16')][_0xcafe('0x18')]:null,_0x2e26ef['body']&&_0x2e26ef[_0xcafe('0xe')][_0xcafe('0x1a')]?_0x2e26ef[_0xcafe('0xe')][_0xcafe('0x1a')]:'other',_0x2e26ef[_0xcafe('0xe')]&&_0x2e26ef[_0xcafe('0xe')]['agent_id']?_0x2e26ef[_0xcafe('0xe')][_0xcafe('0x1b')]:'',_0x2e26ef['body']&&_0x2e26ef[_0xcafe('0xe')]['agent_name']?_0x2e26ef[_0xcafe('0xe')][_0xcafe('0x1f')]:'');},'ignoreRoute':function(_0x33b77d){var _0x4ef74f=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4ef74f[_0xcafe('0x20')](_0x33b77d[_0xcafe('0x13')]);}}));_0x27062a[_0xcafe('0xa')](_0xcafe('0x21'),require(_0xcafe('0x22')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x23'),require(_0xcafe('0x24')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x25'),require(_0xcafe('0x26')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x27'),require('./api/voiceExtension'));_0x27062a[_0xcafe('0xa')](_0xcafe('0x28'),require(_0xcafe('0x29')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x2a'),require(_0xcafe('0x2b')));_0x27062a['use']('/api/voice/recordings',require(_0xcafe('0x2c')));_0x27062a['use'](_0xcafe('0x2d'),require(_0xcafe('0x2e')));_0x27062a['use'](_0xcafe('0x2f'),require('./api/voiceMail'));_0x27062a[_0xcafe('0xa')](_0xcafe('0x30'),require(_0xcafe('0x31')));_0x27062a[_0xcafe('0xa')]('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x27062a['use'](_0xcafe('0x32'),require(_0xcafe('0x33')));_0x27062a['use'](_0xcafe('0x34'),require(_0xcafe('0x35')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x36'),require(_0xcafe('0x37')));_0x27062a['use'](_0xcafe('0x38'),require('./api/memberReport'));_0x27062a[_0xcafe('0xa')](_0xcafe('0x39'),require(_0xcafe('0x3a')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x3b'),require(_0xcafe('0x3c')));_0x27062a[_0xcafe('0xa')]('/api/mail/out_servers',require(_0xcafe('0x3d')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x3e'),require(_0xcafe('0x3f')));_0x27062a[_0xcafe('0xa')]('/api/mail/queues',require(_0xcafe('0x40')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x41'),require('./api/mailSubstatus'));_0x27062a['use'](_0xcafe('0x42'),require(_0xcafe('0x43')));_0x27062a['use'](_0xcafe('0x44'),require(_0xcafe('0x45')));_0x27062a[_0xcafe('0xa')]('/api/mail/applications',require(_0xcafe('0x46')));_0x27062a[_0xcafe('0xa')]('/api/mail/reports/queue',require(_0xcafe('0x47')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x48'),require('./api/dashboard'));_0x27062a[_0xcafe('0xa')](_0xcafe('0x49'),require(_0xcafe('0x4a')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x4b'),require(_0xcafe('0x4c')));_0x27062a['use'](_0xcafe('0x4d'),require(_0xcafe('0x4e')));_0x27062a['use'](_0xcafe('0x4f'),require(_0xcafe('0x50')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x51'),require(_0xcafe('0x52')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x53'),require(_0xcafe('0x54')));_0x27062a['use']('/api/fax/reports/queue',require(_0xcafe('0x55')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x56'),require(_0xcafe('0x57')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x58'),require('./api/smsApplication'));_0x27062a['use'](_0xcafe('0x59'),require(_0xcafe('0x5a')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x5b'),require(_0xcafe('0x5c')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x5d'),require(_0xcafe('0x5e')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x5f'),require('./api/openchannelAccount'));_0x27062a[_0xcafe('0xa')]('/api/openchannel/applications',require(_0xcafe('0x60')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x61'),require(_0xcafe('0x62')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x63'),require(_0xcafe('0x64')));_0x27062a[_0xcafe('0xa')]('/api/openchannel/queues',require(_0xcafe('0x65')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x66'),require(_0xcafe('0x67')));_0x27062a[_0xcafe('0xa')]('/api/openchannel/reports/queue',require(_0xcafe('0x68')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x69'),require(_0xcafe('0x6a')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x6b'),require(_0xcafe('0x6c')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x6d'),require(_0xcafe('0x6e')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x6f'),require(_0xcafe('0x70')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x71'),require('./api/chatQueue'));_0x27062a[_0xcafe('0xa')](_0xcafe('0x72'),require('./api/chatGroup'));_0x27062a['use'](_0xcafe('0x73'),require('./api/chatProactiveAction'));_0x27062a[_0xcafe('0xa')]('/api/cm/companies',require(_0xcafe('0x74')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x75'),require(_0xcafe('0x76')));_0x27062a['use'](_0xcafe('0x77'),require(_0xcafe('0x78')));_0x27062a['use'](_0xcafe('0x79'),require(_0xcafe('0x7a')));_0x27062a['use'](_0xcafe('0x7b'),require(_0xcafe('0x7c')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x7d'),require(_0xcafe('0x7e')));_0x27062a[_0xcafe('0xa')]('/api/cm/custom_fields',require(_0xcafe('0x7f')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x80'),require(_0xcafe('0x81')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x82'),require('./api/automation'));_0x27062a[_0xcafe('0xa')](_0xcafe('0x83'),require('./api/cannedAnswer'));_0x27062a[_0xcafe('0xa')](_0xcafe('0x84'),require('./api/disposition'));_0x27062a[_0xcafe('0xa')](_0xcafe('0x85'),require(_0xcafe('0x86')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x87'),require(_0xcafe('0x88')));_0x27062a[_0xcafe('0xa')]('/api/pauses',require(_0xcafe('0x89')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x8a'),require(_0xcafe('0x8b')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x8c'),require(_0xcafe('0x8d')));_0x27062a['use'](_0xcafe('0x8e'),require(_0xcafe('0x8f')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x90'),require(_0xcafe('0x91')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x92'),require(_0xcafe('0x93')));_0x27062a['use'](_0xcafe('0x94'),require(_0xcafe('0x95')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x96'),require(_0xcafe('0x97')));_0x27062a['use'](_0xcafe('0x98'),require('./api/variable'));_0x27062a[_0xcafe('0xa')](_0xcafe('0x99'),require('./api/integration'));_0x27062a[_0xcafe('0xa')](_0xcafe('0x9a'),require('./api/integrationReport'));_0x27062a['use'](_0xcafe('0x9b'),require(_0xcafe('0x9c')));_0x27062a['use'](_0xcafe('0x9d'),require(_0xcafe('0x9e')));_0x27062a[_0xcafe('0xa')]('/api/analytics/extracted_reports',require(_0xcafe('0x9f')));_0x27062a[_0xcafe('0xa')](_0xcafe('0xa0'),require(_0xcafe('0xa1')));_0x27062a[_0xcafe('0xa')](_0xcafe('0xa2'),require(_0xcafe('0xa3')));_0x27062a['use'](_0xcafe('0xa4'),require(_0xcafe('0xa5')));_0x27062a[_0xcafe('0xa')]('/api/integrations/salesforce/accounts',require(_0xcafe('0xa6')));_0x27062a[_0xcafe('0xa')]('/api/integrations/salesforce/configurations',require(_0xcafe('0xa7')));_0x27062a[_0xcafe('0xa')](_0xcafe('0xa8'),require(_0xcafe('0xa9')));_0x27062a[_0xcafe('0xa')](_0xcafe('0xaa'),require('./api/intSugarcrmAccount'));_0x27062a['use'](_0xcafe('0xab'),require(_0xcafe('0xac')));_0x27062a['use'](_0xcafe('0xad'),require('./api/intSugarcrmField'));_0x27062a[_0xcafe('0xa')]('/api/integrations/desk/accounts',require(_0xcafe('0xae')));_0x27062a['use'](_0xcafe('0xaf'),require('./api/intDeskConfiguration'));_0x27062a[_0xcafe('0xa')](_0xcafe('0xb0'),require(_0xcafe('0xb1')));_0x27062a[_0xcafe('0xa')](_0xcafe('0xb2'),require(_0xcafe('0xb3')));_0x27062a[_0xcafe('0xa')]('/api/integrations/zoho/configurations',require(_0xcafe('0xb4')));_0x27062a[_0xcafe('0xa')]('/api/integrations/zoho/fields',require(_0xcafe('0xb5')));_0x27062a[_0xcafe('0xa')](_0xcafe('0xb6'),require('./api/intZendeskAccount'));_0x27062a[_0xcafe('0xa')]('/api/integrations/zendesk/configurations',require(_0xcafe('0xb7')));_0x27062a['use'](_0xcafe('0xb8'),require(_0xcafe('0xb9')));_0x27062a[_0xcafe('0xa')]('/api/integrations/freshdesk/accounts',require('./api/intFreshdeskAccount'));_0x27062a[_0xcafe('0xa')](_0xcafe('0xba'),require('./api/intFreshdeskConfiguration'));_0x27062a[_0xcafe('0xa')](_0xcafe('0xbb'),require(_0xcafe('0xbc')));_0x27062a[_0xcafe('0xa')]('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x27062a['use'](_0xcafe('0xbd'),require('./api/intVtigerConfiguration'));_0x27062a[_0xcafe('0xa')](_0xcafe('0xbe'),require(_0xcafe('0xbf')));_0x27062a[_0xcafe('0xa')](_0xcafe('0xc0'),require(_0xcafe('0xc1')));_0x27062a['use'](_0xcafe('0xc2'),require(_0xcafe('0xc3')));_0x27062a['use'](_0xcafe('0xc4'),require('./api/intServicenowField'));_0x27062a[_0xcafe('0xa')](_0xcafe('0xc5'),require(_0xcafe('0xc6')));_0x27062a[_0xcafe('0xa')]('/api/integrations/dynamics365/configurations',require(_0xcafe('0xc7')));_0x27062a[_0xcafe('0xa')](_0xcafe('0xc8'),require(_0xcafe('0xc9')));_0x27062a[_0xcafe('0xa')](_0xcafe('0xca'),require(_0xcafe('0xcb')));_0x27062a['use']('/api/integrations/freshsales/configurations',require(_0xcafe('0xcc')));_0x27062a[_0xcafe('0xa')](_0xcafe('0xcd'),require(_0xcafe('0xce')));_0x27062a['use'](_0xcafe('0xcf'),require(_0xcafe('0xd0')));_0x27062a[_0xcafe('0xa')](_0xcafe('0xd1'),require('./api/chatQueueReport'));_0x27062a['use'](_0xcafe('0xd2'),require('./api/chatInternalMessage'));_0x27062a[_0xcafe('0xa')](_0xcafe('0xd3'),require('./api/jscriptyAnswerReport'));_0x27062a[_0xcafe('0xa')]('/api/jscripty/questions/reports',require(_0xcafe('0xd4')));_0x27062a[_0xcafe('0xa')](_0xcafe('0xd5'),require('./api/jscriptySessionReport'));_0x27062a[_0xcafe('0xa')]('/api/sms/reports/queue',require(_0xcafe('0xd6')));_0x27062a[_0xcafe('0xa')]('/api/square/reports',require(_0xcafe('0xd7')));_0x27062a[_0xcafe('0xa')](_0xcafe('0xd8'),require('./api/squareReportDetail'));_0x27062a[_0xcafe('0xa')](_0xcafe('0xd9'),require(_0xcafe('0xda')));_0x27062a['use'](_0xcafe('0xdb'),require(_0xcafe('0xdc')));_0x27062a[_0xcafe('0xa')](_0xcafe('0xdd'),require(_0xcafe('0xde')));_0x27062a[_0xcafe('0xa')](_0xcafe('0xdf'),require('./api/squareProject'));_0x27062a[_0xcafe('0xa')](_0xcafe('0xe0'),require(_0xcafe('0xe1')));_0x27062a[_0xcafe('0xa')](_0xcafe('0xe2'),require(_0xcafe('0xe3')));_0x27062a[_0xcafe('0xa')]('/api/teams',require(_0xcafe('0xe4')));_0x27062a['use']('/api/license',require(_0xcafe('0xe5')));_0x27062a[_0xcafe('0xa')]('/api/campaigns',require('./api/campaign'));_0x27062a['use'](_0xcafe('0xe6'),require(_0xcafe('0xe7')));_0x27062a[_0xcafe('0xa')](_0xcafe('0xe8'),require('./api/attachment'));_0x27062a['use'](_0xcafe('0xe9'),require('./api/plugin'));_0x27062a[_0xcafe('0xa')]('/api/mail/reports/transfer',require(_0xcafe('0xea')));_0x27062a['use'](_0xcafe('0xeb'),require(_0xcafe('0xec')));_0x27062a[_0xcafe('0xa')](_0xcafe('0xed'),require(_0xcafe('0xee')));_0x27062a[_0xcafe('0xa')](_0xcafe('0xef'),require(_0xcafe('0xf0')));_0x27062a[_0xcafe('0xa')](_0xcafe('0xf1'),require(_0xcafe('0xf2')));_0x27062a[_0xcafe('0xa')](_0xcafe('0xf3'),require(_0xcafe('0xf4')));_0x27062a[_0xcafe('0xa')](_0xcafe('0xf5'),require(_0xcafe('0xf6')));_0x27062a[_0xcafe('0xa')](_0xcafe('0xf7'),require(_0xcafe('0xf8')));_0x27062a['use'](_0xcafe('0xf9'),require(_0xcafe('0xfa')));_0x27062a[_0xcafe('0xa')](_0xcafe('0xfb'),require(_0xcafe('0xfc')));_0x27062a['use'](_0xcafe('0xfd'),require(_0xcafe('0xfe')));_0x27062a[_0xcafe('0xa')]('/api/whatsapp/accounts',require(_0xcafe('0xff')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x100'),require(_0xcafe('0x101')));_0x27062a['use']('/api/whatsapp/interactions',require(_0xcafe('0x102')));_0x27062a[_0xcafe('0xa')]('/api/whatsapp/messages',require('./api/whatsappMessage'));_0x27062a[_0xcafe('0xa')](_0xcafe('0x103'),require(_0xcafe('0x104')));_0x27062a[_0xcafe('0xa')]('/api/whatsapp/reports/transfer',require(_0xcafe('0x105')));_0x27062a['use'](_0xcafe('0x106'),require(_0xcafe('0x107')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x108'),require(_0xcafe('0x109')));_0x27062a[_0xcafe('0xa')]('/api/realtime',require(_0xcafe('0x10a')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x10b'),require(_0xcafe('0x10c')));_0x27062a[_0xcafe('0xa')]('/api/auth/google',require(_0xcafe('0x10d')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x10e'),require(_0xcafe('0x10f')));_0x27062a['use'](_0xcafe('0x110'),require('./api/jira'));_0x27062a[_0xcafe('0xa')](_0xcafe('0x111'),require(_0xcafe('0x112')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x113'),require(_0xcafe('0x114')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x115'),require(_0xcafe('0x116')));_0x27062a[_0xcafe('0xa')](_0xcafe('0x117'),require(_0xcafe('0x118')));_0x27062a[_0xcafe('0xa')]('/api/webbar',require('./api/webbar'));_0x27062a[_0xcafe('0xa')]('/apidoc',express['static'](path[_0xcafe('0x119')](config[_0xcafe('0x11a')],_0xcafe('0x11b'))));_0x27062a[_0xcafe('0xa')](_0xcafe('0x11c'),express[_0xcafe('0x11d')](path['join'](config[_0xcafe('0x11a')],_0xcafe('0x11c'))));_0x27062a['use'](_0xcafe('0x11e'),express[_0xcafe('0x11d')](path[_0xcafe('0x119')](config[_0xcafe('0x11a')],_0xcafe('0x11e'))));_0x27062a[_0xcafe('0xa')](_0xcafe('0x11f'),express[_0xcafe('0x11d')](path[_0xcafe('0x119')](config[_0xcafe('0x11a')],_0xcafe('0x120'),_0xcafe('0x121'))));_0x27062a[_0xcafe('0xa')](_0xcafe('0x122'),express[_0xcafe('0x11d')](path['join'](config['root'],_0xcafe('0x123'))));_0x27062a[_0xcafe('0x124')](_0xcafe('0x125'))[_0xcafe('0x126')](errors[0x194]);_0x27062a[_0xcafe('0x124')]('/*')['get'](function(_0x42220a,_0x236c73){_0x236c73[_0xcafe('0x127')](path[_0xcafe('0x128')](_0x27062a[_0xcafe('0x126')](_0xcafe('0x129'))+'/index.html'));});};var sensitiveFields=[_0xcafe('0x12a'),'password',_0xcafe('0x12b'),_0xcafe('0x12c'),'firstName','lastName',_0xcafe('0x12d'),'phone','mobile',_0xcafe('0x12e'),_0xcafe('0x12f'),'clientId',_0xcafe('0x130'),_0xcafe('0x131'),_0xcafe('0x132'),_0xcafe('0x133'),_0xcafe('0x134'),_0xcafe('0x135'),_0xcafe('0x136'),_0xcafe('0x137'),_0xcafe('0x138'),_0xcafe('0x139'),_0xcafe('0x13a'),_0xcafe('0x13b'),_0xcafe('0x13c'),_0xcafe('0x13d'),_0xcafe('0x13e'),_0xcafe('0x13f'),_0xcafe('0x140'),_0xcafe('0x141'),_0xcafe('0x142'),'accesskeyid','secretaccesskey',_0xcafe('0x143'),_0xcafe('0x16'),_0xcafe('0x144'),'accountSid',_0xcafe('0x145'),_0xcafe('0x146'),_0xcafe('0x147'),'registry',_0xcafe('0x148')];function maskSensitiveData(_0x1bedf6){var _0x349e42=/(?!^)[\s\S](?!$)/g;if(!_[_0xcafe('0x149')](_0x1bedf6))return;for(var _0x3cfa15 in _0x1bedf6){if(_[_0xcafe('0x14a')](_0x1bedf6[_0x3cfa15])){for(var _0x2af257=0x0;_0x2af257<_0x1bedf6[_0x3cfa15][_0xcafe('0x14b')];_0x2af257++){maskSensitiveData(_0x1bedf6[_0x3cfa15][_0x2af257]);}}else if(_['isPlainObject'](_0x1bedf6[_0x3cfa15])){maskSensitiveData(_0x1bedf6[_0x3cfa15]);}else if(_[_0xcafe('0x14c')](_0x1bedf6[_0x3cfa15])){_0x1bedf6[_0x3cfa15]=_0x1bedf6[_0x3cfa15]['replace'](/{{{/g,_0xcafe('0x14d'))[_0xcafe('0x14e')](/}}}/g,_0xcafe('0x14f'))[_0xcafe('0x14e')](/{{/g,'@{')[_0xcafe('0x14e')](/}}/g,'}@');if(_[_0xcafe('0x150')](sensitiveFields,_0x3cfa15)){_0x1bedf6[_0x3cfa15]=_0x1bedf6[_0x3cfa15][_0xcafe('0x14e')](_0x349e42,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 3773ab3..ee8fb60 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc009=['../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.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/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc'];(function(_0x1ece13,_0x37fafe){var _0x318167=function(_0x260802){while(--_0x260802){_0x1ece13['push'](_0x1ece13['shift']());}};_0x318167(++_0x37fafe);}(_0xc009,0x1de));var _0x9c00=function(_0x5f3d2d,_0x1e8662){_0x5f3d2d=_0x5f3d2d-0x0;var _0x2b9ef1=_0xc009[_0x5f3d2d];return _0x2b9ef1;};'use strict';var jayson=require(_0x9c00('0x0'));var BPromise=require(_0x9c00('0x1'));var _=require(_0x9c00('0x2'));var config=require('../config/environment');exports[_0x9c00('0x3')]=function(){return new BPromise(function(_0xec990e,_0x338d13){var _0x47d0cf={};_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x5')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x6')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x7')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require('../api/voiceRecording/voiceRecording.rpc'));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x8')));_0x47d0cf=_['merge'](_0x47d0cf,require(_0x9c00('0x9')));_0x47d0cf=_['merge'](_0x47d0cf,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0xa')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0xb')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0xc')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0xd')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0xe')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0xf')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require('../api/mailAccount/mailAccount.rpc'));_0x47d0cf=_['merge'](_0x47d0cf,require('../api/mailQueue/mailQueue.rpc'));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x10')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x11')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x12')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x13')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x14')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x15')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x16')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x17')));_0x47d0cf=_['merge'](_0x47d0cf,require(_0x9c00('0x18')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x19')));_0x47d0cf=_['merge'](_0x47d0cf,require(_0x9c00('0x1a')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x1b')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x1c')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x1d')));_0x47d0cf=_['merge'](_0x47d0cf,require(_0x9c00('0x1e')));_0x47d0cf=_['merge'](_0x47d0cf,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x1f')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x20')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x21')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x22')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x23')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x24')));_0x47d0cf=_['merge'](_0x47d0cf,require(_0x9c00('0x25')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x26')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x47d0cf=_['merge'](_0x47d0cf,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x47d0cf=_['merge'](_0x47d0cf,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x27')));_0x47d0cf=_['merge'](_0x47d0cf,require(_0x9c00('0x28')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x29')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x2a')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x2b')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require('../api/variable/variable.rpc'));_0x47d0cf=_['merge'](_0x47d0cf,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x2c')));_0x47d0cf=_['merge'](_0x47d0cf,require(_0x9c00('0x2d')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x2e')));_0x47d0cf=_['merge'](_0x47d0cf,require(_0x9c00('0x2f')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x30')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x31')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x32')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x33')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x34')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x35')));_0x47d0cf=_['merge'](_0x47d0cf,require(_0x9c00('0x36')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x37')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x38')));_0x47d0cf=_['merge'](_0x47d0cf,require(_0x9c00('0x39')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x3a')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x3b')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require('../api/squareMessage/squareMessage.rpc'));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x3c')));_0x47d0cf=_['merge'](_0x47d0cf,require(_0x9c00('0x3d')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require('../api/plugin/plugin.rpc'));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require(_0x9c00('0x3e')));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x47d0cf=_['merge'](_0x47d0cf,require(_0x9c00('0x3f')));_0x47d0cf=_['merge'](_0x47d0cf,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x47d0cf=_[_0x9c00('0x4')](_0x47d0cf,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x3f5ba9=jayson[_0x9c00('0x40')](_0x47d0cf)[_0x9c00('0x41')]();var _0x2341f1=config[_0x9c00('0x42')][_0x9c00('0x43')]||config[_0x9c00('0x43')]+0x1;var _0x13234f=config[_0x9c00('0x42')]['ip']||_0x9c00('0x44');_0x3f5ba9['on'](_0x9c00('0x45'),function(_0x3737bf){return _0x338d13(_0x3737bf);});_0x3f5ba9[_0x9c00('0x3')](_0x2341f1,_0x13234f,function(){console[_0x9c00('0x46')](_0x9c00('0x47'),_0x13234f,_0x2341f1);require(_0x9c00('0x48'))[_0x9c00('0x49')]();return _0xec990e(_0x9c00('0x4a')+_0x13234f+':'+_0x2341f1);});});}; \ No newline at end of file +var _0x9b0b=['../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','listen','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','bluebird','lodash','../config/environment','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.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/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.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/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.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'];(function(_0x2053ea,_0x1ab2d4){var _0x2232c4=function(_0x4230df){while(--_0x4230df){_0x2053ea['push'](_0x2053ea['shift']());}};_0x2232c4(++_0x1ab2d4);}(_0x9b0b,0xff));var _0xb9b0=function(_0x256e32,_0x4013bc){_0x256e32=_0x256e32-0x0;var _0x464070=_0x9b0b[_0x256e32];return _0x464070;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xb9b0('0x0'));var _=require(_0xb9b0('0x1'));var config=require(_0xb9b0('0x2'));exports['listen']=function(){return new BPromise(function(_0xbd49f8,_0x59b838){var _0x319c00={};_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x4')));_0x319c00=_['merge'](_0x319c00,require(_0xb9b0('0x5')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x6')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x7')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x8')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x9')));_0x319c00=_['merge'](_0x319c00,require(_0xb9b0('0xa')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require('../api/memberReport/memberReport.rpc'));_0x319c00=_['merge'](_0x319c00,require('../api/trunk/trunk.rpc'));_0x319c00=_['merge'](_0x319c00,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0xb')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require('../api/mailServerIn/mailServerIn.rpc'));_0x319c00=_['merge'](_0x319c00,require(_0xb9b0('0xc')));_0x319c00=_['merge'](_0x319c00,require(_0xb9b0('0xd')));_0x319c00=_['merge'](_0x319c00,require(_0xb9b0('0xe')));_0x319c00=_['merge'](_0x319c00,require('../api/mailMessage/mailMessage.rpc'));_0x319c00=_['merge'](_0x319c00,require(_0xb9b0('0xf')));_0x319c00=_['merge'](_0x319c00,require(_0xb9b0('0x10')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x11')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x12')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x13')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x14')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x15')));_0x319c00=_['merge'](_0x319c00,require(_0xb9b0('0x16')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require('../api/smsAccount/smsAccount.rpc'));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x17')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x18')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x19')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x1a')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x1b')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x1c')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x1d')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require('../api/chatInteraction/chatInteraction.rpc'));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x1e')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require('../api/chatQueue/chatQueue.rpc'));_0x319c00=_['merge'](_0x319c00,require('../api/cmContact/cmContact.rpc'));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x1f')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x20')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x21')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x22')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x23')));_0x319c00=_['merge'](_0x319c00,require(_0xb9b0('0x24')));_0x319c00=_['merge'](_0x319c00,require(_0xb9b0('0x25')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require('../api/sound/sound.rpc'));_0x319c00=_['merge'](_0x319c00,require(_0xb9b0('0x26')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x27')));_0x319c00=_['merge'](_0x319c00,require(_0xb9b0('0x28')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x29')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x2a')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x2b')));_0x319c00=_['merge'](_0x319c00,require(_0xb9b0('0x2c')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x2d')));_0x319c00=_['merge'](_0x319c00,require(_0xb9b0('0x2e')));_0x319c00=_['merge'](_0x319c00,require(_0xb9b0('0x2f')));_0x319c00=_['merge'](_0x319c00,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x319c00=_['merge'](_0x319c00,require(_0xb9b0('0x30')));_0x319c00=_['merge'](_0x319c00,require(_0xb9b0('0x31')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x32')));_0x319c00=_['merge'](_0x319c00,require(_0xb9b0('0x33')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x34')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x35')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x36')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x37')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x38')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x39')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x3a')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x3b')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x3c')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x3d')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x3e')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x3f')));_0x319c00=_['merge'](_0x319c00,require(_0xb9b0('0x40')));_0x319c00=_[_0xb9b0('0x3')](_0x319c00,require(_0xb9b0('0x41')));var _0x1a70bb=jayson[_0xb9b0('0x42')](_0x319c00)[_0xb9b0('0x43')]();var _0x14506b=config[_0xb9b0('0x44')][_0xb9b0('0x45')]||config['port']+0x1;var _0x4acef8=config[_0xb9b0('0x44')]['ip']||_0xb9b0('0x46');_0x1a70bb['on']('error',function(_0x45a985){return _0x59b838(_0x45a985);});_0x1a70bb[_0xb9b0('0x47')](_0x14506b,_0x4acef8,function(){console['log'](_0xb9b0('0x48'),_0x4acef8,_0x14506b);require(_0xb9b0('0x49'))[_0xb9b0('0x4a')]();return _0xbd49f8(_0xb9b0('0x4b')+_0x4acef8+':'+_0x14506b);});});}; \ No newline at end of file diff --git a/server/safe-template.js b/server/safe-template.js index 451caaa..f9f0680 100644 --- a/server/safe-template.js +++ b/server/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5eb8=['{\x20{\x20','\x20}\x20}','string','replace','isArray','map','isPlainObject','keys','reduce','exports','safeTemplate'];(function(_0x236f19,_0x11dea9){var _0x3c5ea3=function(_0x2a47ad){while(--_0x2a47ad){_0x236f19['push'](_0x236f19['shift']());}};_0x3c5ea3(++_0x11dea9);}(_0x5eb8,0xb0));var _0x85eb=function(_0x3653c7,_0xadb356){_0x3653c7=_0x3653c7-0x0;var _0x58a021=_0x5eb8[_0x3653c7];return _0x58a021;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x57e9bc){return _0x57e9bc==='{{'?_0x85eb('0x0'):_0x85eb('0x1');}function safeTemplate(_0x393a8a){var _0xd2f5dc=_0x393a8a;if(typeof _0x393a8a===_0x85eb('0x2')){_0xd2f5dc=_0x393a8a[_0x85eb('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x85eb('0x4')](_0x393a8a)){_0xd2f5dc=_0x393a8a[_0x85eb('0x5')](function(_0x3c5798){return safeTemplate(_0x3c5798);});}else if(_[_0x85eb('0x6')](_0x393a8a)){_0xd2f5dc=Object[_0x85eb('0x7')](_0x393a8a)[_0x85eb('0x8')](function(_0x4a8814,_0x16d7b9){_0x4a8814[_0x16d7b9]=safeTemplate(_0x393a8a[_0x16d7b9]);return _0x4a8814;},{});}return _0xd2f5dc;}module[_0x85eb('0x9')][_0x85eb('0xa')]=safeTemplate; \ No newline at end of file +var _0x1a85=['{\x20{\x20','\x20}\x20}','replace','isArray','map','isPlainObject','reduce','exports'];(function(_0x8cd7,_0x2cf434){var _0x262c9f=function(_0x14c21d){while(--_0x14c21d){_0x8cd7['push'](_0x8cd7['shift']());}};_0x262c9f(++_0x2cf434);}(_0x1a85,0x178));var _0x51a8=function(_0x4e1211,_0x1c0e26){_0x4e1211=_0x4e1211-0x0;var _0x4ae887=_0x1a85[_0x4e1211];return _0x4ae887;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x54a0db){return _0x54a0db==='{{'?_0x51a8('0x0'):_0x51a8('0x1');}function safeTemplate(_0x43e22a){var _0x498466=_0x43e22a;if(typeof _0x43e22a==='string'){_0x498466=_0x43e22a[_0x51a8('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x51a8('0x3')](_0x43e22a)){_0x498466=_0x43e22a[_0x51a8('0x4')](function(_0x48a21b){return safeTemplate(_0x48a21b);});}else if(_[_0x51a8('0x5')](_0x43e22a)){_0x498466=Object['keys'](_0x43e22a)[_0x51a8('0x6')](function(_0x5cf430,_0x331117){_0x5cf430[_0x331117]=safeTemplate(_0x43e22a[_0x331117]);return _0x5cf430;},{});}return _0x498466;}module[_0x51a8('0x7')]['safeTemplate']=safeTemplate; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 2feeff7..191c39d 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 _0x4bd3=['length','match','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','destroy','prototype','sendRequest','sync','answer','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','exec','isArray','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','setVariable','isBoolean','isNumber','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','getVariable','GET\x20VARIABLE\x20\x22%s\x22','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','agi','AGI','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','events','EventEmitter','call','setEncoding','setTimeout','headers','emit','ready','line','toLowerCase','hangup','search','substring','no\x20code','replace','result=','indexOf'];(function(_0x32d83e,_0x4c9155){var _0xdc5d9=function(_0x1e0f1a){while(--_0x1e0f1a){_0x32d83e['push'](_0x32d83e['shift']());}};_0xdc5d9(++_0x4c9155);}(_0x4bd3,0x174));var _0x34bd=function(_0x22b637,_0x1b6a95){_0x22b637=_0x22b637-0x0;var _0x2b9450=_0x4bd3[_0x22b637];return _0x2b9450;};'use strict';var util=require(_0x34bd('0x0'));var _=require('lodash');var EventEmitter=require(_0x34bd('0x1'))[_0x34bd('0x2')];var AGIReply=require('./reply');var AGIError=require('./error');function AGIChannel(_0x4cad21){var _0x22b921=this,_0x44854a=new AGIReply(),_0x1fc8eb=![],_0x5846f3={};EventEmitter[_0x34bd('0x3')](_0x22b921);_0x4cad21[_0x34bd('0x4')]('utf8');_0x4cad21[_0x34bd('0x5')](0x8*0x3c*0x3c*0x3e8);_0x44854a[_0x34bd('0x4')]('utf8');_0x44854a['on'](_0x34bd('0x6'),function(_0x76de8d){for(var _0x3260ff in _0x76de8d){_0x22b921[_0x3260ff]=_0x76de8d[_0x3260ff];}_0x22b921[_0x34bd('0x7')](_0x34bd('0x8'));});_0x44854a['on'](_0x34bd('0x9'),function(_0x4db0ba){if(_0x4db0ba[_0x34bd('0xa')]()==_0x34bd('0xb')){_0x22b921[_0x34bd('0x7')](_0x34bd('0xb'));return;}if(_0x4db0ba['substring'](0x0,0xb)=='520-Invalid'){_0x1fc8eb=!![];}if(_0x1fc8eb){_0x5846f3['rx']+=_0x4db0ba+'\x0a';if(_0x4db0ba[_0x34bd('0xc')]('520\x20End\x20of\x20proper')!=-0x1){_0x1fc8eb=![];}}else{_0x5846f3['rx']=_0x4db0ba;}if(_0x1fc8eb){return;}if(typeof _0x5846f3['cb']=='function'){var _0x275d80=_0x5846f3['rx'][_0x34bd('0xd')](0x0,0x3),_0x1f19b9=null,_0x282af4=null;_0x275d80=parseInt(_0x275d80);if(isNaN(_0x275d80)){_0x5846f3['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x34bd('0xe')});return;}if(_0x275d80!=0xc8){_0x5846f3['cb'](null,{'code':_0x275d80,'result':-0x1,'extra':'KO'});return;}_0x1f19b9=_0x5846f3['rx'][_0x34bd('0xd')](0x4)[_0x34bd('0xf')](_0x34bd('0x10'),'');if(_0x1f19b9[_0x34bd('0x11')]('\x20')!=-0x1){_0x1f19b9=_0x1f19b9['substr'](0x0,_0x1f19b9[_0x34bd('0x11')]('\x20'));}if(_['startsWith'](_0x1f19b9,'-1')){_0x1f19b9=parseInt(_0x1f19b9);}_0x282af4=_0x5846f3['rx']['split']('\x20');if(_0x282af4[_0x34bd('0x12')]==0x3){_0x282af4=_0x282af4[0x2][_0x34bd('0xd')](0x1,_0x282af4[0x2][_0x34bd('0x12')]-0x1);}else if(_0x282af4[_0x34bd('0x12')]>0x3){var _0x34b91b=/\((.+)\)/;var _0x1643af=_0x5846f3['rx'][_0x34bd('0x13')](_0x34b91b);if(_0x1643af){_0x282af4=_0x1643af[0x1];}else{_0x282af4=null;}}else{_0x282af4=null;}_0x5846f3['cb'](null,{'code':_0x275d80,'result':_0x1f19b9,'extra':_0x282af4});}});_0x4cad21['on'](_0x34bd('0x14'),function(_0x3b4bf8){_0x22b921[_0x34bd('0x7')](_0x34bd('0x14'),new AGIError('E_AGI_SOCKET_ERROR',_0x3b4bf8[_0x34bd('0x15')]));});_0x4cad21['on'](_0x34bd('0x16'),function(){_0x22b921[_0x34bd('0x7')](_0x34bd('0x16'),new AGIError(_0x34bd('0x17')));});_0x4cad21['on'](_0x34bd('0x18'),function(){_0x22b921[_0x34bd('0x7')](_0x34bd('0x18'),new AGIError(_0x34bd('0x19')));_0x4cad21['destroy']();});_0x4cad21[_0x34bd('0x1a')](_0x44854a);this[_0x34bd('0x1b')]=function(_0x49f625,_0x14254b){var _0x49f625=_0x49f625||'',_0x14254b=typeof _0x14254b=='function'?_0x14254b:new Function();_0x5846f3={'tx':_0x49f625,'rx':'','cb':_0x14254b};_0x4cad21['write'](_0x49f625+'\x0a');},this['close']=function(){_0x4cad21[_0x34bd('0x1c')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x34bd('0x1d')][_0x34bd('0x1e')]=function(_0x428140){return this['command'][_0x34bd('0x1f')](this,_0x428140);};AGIChannel[_0x34bd('0x1d')][_0x34bd('0x20')]=function(){return this[_0x34bd('0x1e')]('ANSWER');};AGIChannel[_0x34bd('0x1d')][_0x34bd('0x21')]=function(_0x264c94,_0x3e4dc3,_0x56baf7){_0x264c94=_0x264c94===undefined?_0x34bd('0x22'):_0x264c94;_0x3e4dc3=_0x3e4dc3===undefined?'5':_0x3e4dc3;_0x56baf7=_0x56baf7===undefined?'1':_0x56baf7;return this[_0x34bd('0x1e')](util['format'](_0x34bd('0x23'),_0x264c94,_0x3e4dc3*0x3e8,_0x56baf7));};AGIChannel[_0x34bd('0x1d')][_0x34bd('0x24')]=function(_0x3f675c){_0x3f675c=_0x3f675c||_0x34bd('0x25');return this[_0x34bd('0x1e')](util[_0x34bd('0x26')]('VERBOSE\x20\x22%s\x22',_0x3f675c));};AGIChannel[_0x34bd('0x1d')][_0x34bd('0x27')]=function(_0x56d3b9,_0x5d1662){if(_[_0x34bd('0x28')](_0x5d1662)){return this[_0x34bd('0x1e')](util[_0x34bd('0x26')]('EXEC\x20%s\x20%s',_0x56d3b9,_0x5d1662['join'](',')));}return this[_0x34bd('0x1e')](util[_0x34bd('0x26')](_0x34bd('0x29'),_0x56d3b9,_0x5d1662));};AGIChannel[_0x34bd('0x1d')]['setContext']=function(_0x3a6fb2){return this[_0x34bd('0x1e')](util[_0x34bd('0x26')](_0x34bd('0x2a'),_0x3a6fb2));};AGIChannel[_0x34bd('0x1d')][_0x34bd('0x2b')]=function(_0x4ae886){return this[_0x34bd('0x1e')](util['format'](_0x34bd('0x2c'),_0x4ae886));};AGIChannel[_0x34bd('0x1d')][_0x34bd('0x2d')]=function(_0x4e9e70){return this[_0x34bd('0x1e')](util[_0x34bd('0x26')]('SET\x20PRIORITY\x20%s',_0x4e9e70));};AGIChannel[_0x34bd('0x1d')][_0x34bd('0xb')]=function(){return this[_0x34bd('0x1e')]('HANGUP');};AGIChannel[_0x34bd('0x1d')][_0x34bd('0x2e')]=function(_0x4bfb6c,_0x117188){var _0x41c377=_[_0x34bd('0x2f')](_0x117188)||_[_0x34bd('0x30')](_0x117188)?_0x117188[_0x34bd('0x31')]():_0x117188;return this[_0x34bd('0x1e')](util['format']('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x4bfb6c,_0x41c377?_0x41c377['toString']()[_0x34bd('0xf')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x34bd('0x1d')]['sayNumber']=function(_0x5b5f86,_0x13d2f0){return this['sendRequest'](util['format'](_0x34bd('0x32'),_0x5b5f86,_0x13d2f0));};AGIChannel[_0x34bd('0x1d')][_0x34bd('0x33')]=function(_0xdc3496,_0x2af1af){return this['sendRequest'](util['format'](_0x34bd('0x34'),_0xdc3496,_0x2af1af));};AGIChannel['prototype'][_0x34bd('0x35')]=function(_0x2c9b7a,_0x3fc418){return this[_0x34bd('0x1e')](util[_0x34bd('0x26')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x2c9b7a,_0x3fc418));};AGIChannel[_0x34bd('0x1d')][_0x34bd('0x36')]=function(_0x16858c,_0x1b86e1,_0x551c87){_0x1b86e1=_0x1b86e1||this[_0x34bd('0x37')];_0x551c87=_0x551c87||0x1;this['setContext'](_0x16858c);this[_0x34bd('0x2b')](_0x1b86e1);this[_0x34bd('0x2d')](_0x551c87);return this['noop'](util[_0x34bd('0x26')]('GOTO\x20%s\x20%s\x20%s',_0x16858c,_0x1b86e1,_0x551c87));};AGIChannel[_0x34bd('0x1d')][_0x34bd('0x38')]=function(_0x18e9f6){return this[_0x34bd('0x1e')](util[_0x34bd('0x26')](_0x34bd('0x39'),_0x18e9f6));};AGIChannel[_0x34bd('0x1d')]['recordFile']=function(_0x4986bb,_0x547f97,_0xede936,_0x3e4d4d,_0x22ebf4,_0x787f74){_0x547f97=_0x547f97||'wav';_0xede936=_0xede936||'';_0x3e4d4d=_0x3e4d4d===undefined?-0x1:_0x3e4d4d==='-1'?-0x1:_0x3e4d4d*0x3e8;_0x22ebf4=_0x22ebf4===undefined?'':'s='+_0x22ebf4;_0x787f74=_0x787f74?_0x34bd('0x3a'):'';return this[_0x34bd('0x1e')](util[_0x34bd('0x26')](_0x34bd('0x3b'),_0x4986bb,_0x547f97,_0xede936,_0x3e4d4d,_0x787f74,_0x22ebf4));};AGIChannel[_0x34bd('0x1d')]['streamFile']=function(_0x3687b9,_0x557094){_0x557094=_0x557094||'';return this['sendRequest'](util[_0x34bd('0x26')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x3687b9,_0x557094));};AGIChannel[_0x34bd('0x1d')][_0x34bd('0x3c')]=function(_0x18d71e){return this[_0x34bd('0x27')](_0x34bd('0x3d'),_0x18d71e);};AGIChannel['prototype']['wait']=function(_0x33e8e8){return this['exec'](_0x34bd('0x3e'),_0x33e8e8);};AGIChannel[_0x34bd('0x1d')][_0x34bd('0x14')]=function(_0x540b04,_0x4ad00c){this['noop'](util['format'](_0x34bd('0x3f'),_0x540b04['id'],_0x540b04['label'],_0x4ad00c));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x34bd('0x40')]=AGIChannel; \ No newline at end of file +var _0x778c=['prototype','answer','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','sayDigits','sayPhonetic','extension','setExtension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','error','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','events','EventEmitter','./reply','./error','setEncoding','utf8','headers','line','toLowerCase','hangup','emit','substring','520-Invalid','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','startsWith','length','match','E_AGI_SOCKET_ERROR','code','close','timeout','pipe','command','write','destroy','inherits','sendRequest','sync'];(function(_0x186c5c,_0x166826){var _0x824c59=function(_0x29eeea){while(--_0x29eeea){_0x186c5c['push'](_0x186c5c['shift']());}};_0x824c59(++_0x166826);}(_0x778c,0x1e4));var _0xc778=function(_0x4b980d,_0x32fc6a){_0x4b980d=_0x4b980d-0x0;var _0x5c7974=_0x778c[_0x4b980d];return _0x5c7974;};'use strict';var util=require(_0xc778('0x0'));var _=require('lodash');var EventEmitter=require(_0xc778('0x1'))[_0xc778('0x2')];var AGIReply=require(_0xc778('0x3'));var AGIError=require(_0xc778('0x4'));function AGIChannel(_0x32350d){var _0x405cda=this,_0x5be380=new AGIReply(),_0x2b759f=![],_0x552344={};EventEmitter['call'](_0x405cda);_0x32350d[_0xc778('0x5')](_0xc778('0x6'));_0x32350d['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x5be380[_0xc778('0x5')]('utf8');_0x5be380['on'](_0xc778('0x7'),function(_0xbf56a9){for(var _0x17ec39 in _0xbf56a9){_0x405cda[_0x17ec39]=_0xbf56a9[_0x17ec39];}_0x405cda['emit']('ready');});_0x5be380['on'](_0xc778('0x8'),function(_0x748f1a){if(_0x748f1a[_0xc778('0x9')]()==_0xc778('0xa')){_0x405cda[_0xc778('0xb')](_0xc778('0xa'));return;}if(_0x748f1a[_0xc778('0xc')](0x0,0xb)==_0xc778('0xd')){_0x2b759f=!![];}if(_0x2b759f){_0x552344['rx']+=_0x748f1a+'\x0a';if(_0x748f1a['search'](_0xc778('0xe'))!=-0x1){_0x2b759f=![];}}else{_0x552344['rx']=_0x748f1a;}if(_0x2b759f){return;}if(typeof _0x552344['cb']==_0xc778('0xf')){var _0x8bd093=_0x552344['rx'][_0xc778('0xc')](0x0,0x3),_0x2b2ba4=null,_0x106f44=null;_0x8bd093=parseInt(_0x8bd093);if(isNaN(_0x8bd093)){_0x552344['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xc778('0x10')});return;}if(_0x8bd093!=0xc8){_0x552344['cb'](null,{'code':_0x8bd093,'result':-0x1,'extra':'KO'});return;}_0x2b2ba4=_0x552344['rx'][_0xc778('0xc')](0x4)[_0xc778('0x11')](_0xc778('0x12'),'');if(_0x2b2ba4[_0xc778('0x13')]('\x20')!=-0x1){_0x2b2ba4=_0x2b2ba4['substr'](0x0,_0x2b2ba4[_0xc778('0x13')]('\x20'));}if(_[_0xc778('0x14')](_0x2b2ba4,'-1')){_0x2b2ba4=parseInt(_0x2b2ba4);}_0x106f44=_0x552344['rx']['split']('\x20');if(_0x106f44[_0xc778('0x15')]==0x3){_0x106f44=_0x106f44[0x2][_0xc778('0xc')](0x1,_0x106f44[0x2][_0xc778('0x15')]-0x1);}else if(_0x106f44[_0xc778('0x15')]>0x3){var _0x2726fc=/\((.+)\)/;var _0x557e48=_0x552344['rx'][_0xc778('0x16')](_0x2726fc);if(_0x557e48){_0x106f44=_0x557e48[0x1];}else{_0x106f44=null;}}else{_0x106f44=null;}_0x552344['cb'](null,{'code':_0x8bd093,'result':_0x2b2ba4,'extra':_0x106f44});}});_0x32350d['on']('error',function(_0x49a567){_0x405cda['emit']('error',new AGIError(_0xc778('0x17'),_0x49a567[_0xc778('0x18')]));});_0x32350d['on'](_0xc778('0x19'),function(){_0x405cda[_0xc778('0xb')](_0xc778('0x19'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x32350d['on'](_0xc778('0x1a'),function(){_0x405cda[_0xc778('0xb')](_0xc778('0x1a'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x32350d['destroy']();});_0x32350d[_0xc778('0x1b')](_0x5be380);this[_0xc778('0x1c')]=function(_0x3c2ca6,_0x27c08d){var _0x3c2ca6=_0x3c2ca6||'',_0x27c08d=typeof _0x27c08d==_0xc778('0xf')?_0x27c08d:new Function();_0x552344={'tx':_0x3c2ca6,'rx':'','cb':_0x27c08d};_0x32350d[_0xc778('0x1d')](_0x3c2ca6+'\x0a');},this[_0xc778('0x19')]=function(){_0x32350d[_0xc778('0x1e')]();};}util[_0xc778('0x1f')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0xc778('0x20')]=function(_0x472b30){return this[_0xc778('0x1c')][_0xc778('0x21')](this,_0x472b30);};AGIChannel[_0xc778('0x22')][_0xc778('0x23')]=function(){return this[_0xc778('0x20')](_0xc778('0x24'));};AGIChannel['prototype'][_0xc778('0x25')]=function(_0x4f4e25,_0x43cb3e,_0x487070){_0x4f4e25=_0x4f4e25===undefined?'beep':_0x4f4e25;_0x43cb3e=_0x43cb3e===undefined?'5':_0x43cb3e;_0x487070=_0x487070===undefined?'1':_0x487070;return this['sendRequest'](util[_0xc778('0x26')](_0xc778('0x27'),_0x4f4e25,_0x43cb3e*0x3e8,_0x487070));};AGIChannel[_0xc778('0x22')][_0xc778('0x28')]=function(_0x358dd7){_0x358dd7=_0x358dd7||_0xc778('0x29');return this[_0xc778('0x20')](util['format'](_0xc778('0x2a'),_0x358dd7));};AGIChannel['prototype'][_0xc778('0x2b')]=function(_0x290424,_0x1b69d2){if(_[_0xc778('0x2c')](_0x1b69d2)){return this[_0xc778('0x20')](util[_0xc778('0x26')](_0xc778('0x2d'),_0x290424,_0x1b69d2[_0xc778('0x2e')](',')));}return this['sendRequest'](util['format'](_0xc778('0x2d'),_0x290424,_0x1b69d2));};AGIChannel[_0xc778('0x22')][_0xc778('0x2f')]=function(_0x556403){return this['sendRequest'](util[_0xc778('0x26')](_0xc778('0x30'),_0x556403));};AGIChannel['prototype']['setExtension']=function(_0x3f0f38){return this[_0xc778('0x20')](util[_0xc778('0x26')]('SET\x20EXTENSION\x20%s',_0x3f0f38));};AGIChannel['prototype'][_0xc778('0x31')]=function(_0x3c04c2){return this['sendRequest'](util['format'](_0xc778('0x32'),_0x3c04c2));};AGIChannel['prototype']['hangup']=function(){return this[_0xc778('0x20')](_0xc778('0x33'));};AGIChannel[_0xc778('0x22')][_0xc778('0x34')]=function(_0x54b646,_0x3b4aa5){var _0x4770f2=_['isBoolean'](_0x3b4aa5)||_['isNumber'](_0x3b4aa5)?_0x3b4aa5['toString']():_0x3b4aa5;return this[_0xc778('0x20')](util[_0xc778('0x26')](_0xc778('0x35'),_0x54b646,_0x4770f2?_0x4770f2[_0xc778('0x36')]()[_0xc778('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0xc778('0x37')]=function(_0x58336d,_0x4cb2e){return this[_0xc778('0x20')](util[_0xc778('0x26')]('SAY\x20NUMBER\x20%s\x20%s',_0x58336d,_0x4cb2e));};AGIChannel[_0xc778('0x22')][_0xc778('0x38')]=function(_0x17e25d,_0x2500eb){return this[_0xc778('0x20')](util[_0xc778('0x26')]('SAY\x20DIGITS\x20%s\x20%s',_0x17e25d,_0x2500eb));};AGIChannel[_0xc778('0x22')][_0xc778('0x39')]=function(_0x458087,_0x28a602){return this[_0xc778('0x20')](util[_0xc778('0x26')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x458087,_0x28a602));};AGIChannel[_0xc778('0x22')]['continueAt']=function(_0xe6cbc3,_0x544ae0,_0x37d37f){_0x544ae0=_0x544ae0||this[_0xc778('0x3a')];_0x37d37f=_0x37d37f||0x1;this['setContext'](_0xe6cbc3);this[_0xc778('0x3b')](_0x544ae0);this['setPriority'](_0x37d37f);return this[_0xc778('0x28')](util['format'](_0xc778('0x3c'),_0xe6cbc3,_0x544ae0,_0x37d37f));};AGIChannel[_0xc778('0x22')][_0xc778('0x3d')]=function(_0x3c8027){return this[_0xc778('0x20')](util[_0xc778('0x26')](_0xc778('0x3e'),_0x3c8027));};AGIChannel[_0xc778('0x22')]['recordFile']=function(_0x728cc5,_0x4d72b8,_0x475aa3,_0x241561,_0x370a3c,_0x23b476){_0x4d72b8=_0x4d72b8||_0xc778('0x3f');_0x475aa3=_0x475aa3||'';_0x241561=_0x241561===undefined?-0x1:_0x241561==='-1'?-0x1:_0x241561*0x3e8;_0x370a3c=_0x370a3c===undefined?'':'s='+_0x370a3c;_0x23b476=_0x23b476?_0xc778('0x40'):'';return this['sendRequest'](util[_0xc778('0x26')](_0xc778('0x41'),_0x728cc5,_0x4d72b8,_0x475aa3,_0x241561,_0x23b476,_0x370a3c));};AGIChannel[_0xc778('0x22')][_0xc778('0x42')]=function(_0x564bfb,_0x17561e){_0x17561e=_0x17561e||'';return this[_0xc778('0x20')](util['format'](_0xc778('0x43'),_0x564bfb,_0x17561e));};AGIChannel[_0xc778('0x22')][_0xc778('0x44')]=function(_0x4f6454){return this[_0xc778('0x2b')](_0xc778('0x45'),_0x4f6454);};AGIChannel[_0xc778('0x22')][_0xc778('0x46')]=function(_0x2d4a6a){return this['exec']('WAIT',_0x2d4a6a);};AGIChannel['prototype'][_0xc778('0x47')]=function(_0x54b6f2,_0x618368){this[_0xc778('0x28')](util[_0xc778('0x26')](_0xc778('0x48'),_0x54b6f2['id'],_0x54b6f2[_0xc778('0x49')],_0x618368));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index d5cb498..536aa22 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 _0x0137=['Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','message','name','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.'];(function(_0x8c3feb,_0x289f9c){var _0x142488=function(_0x235983){while(--_0x235983){_0x8c3feb['push'](_0x8c3feb['shift']());}};_0x142488(++_0x289f9c);}(_0x0137,0x157));var _0x7013=function(_0x53a167,_0x4bf6c7){_0x53a167=_0x53a167-0x0;var _0x150263=_0x0137[_0x53a167];return _0x150263;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x7013('0x0'),'E_AGI_ARGUMENT_PORT':_0x7013('0x1'),'E_AGI_SERVER_ERROR':_0x7013('0x2'),'E_AGI_SERVER_CLOSE':_0x7013('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x7013('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x7013('0x5'),'E_AGI_SOCKET_CLOSE':_0x7013('0x6'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x7013('0x7'),'E_AGI_IVR_ENTRY':_0x7013('0x8')};function AGIError(_0x4c80aa){var _0x4c80aa=_0x4c80aa||null,_0x2bf1f4=_0x2bf1f4||[],_0x22e717=0x1,_0x2cd4af='';if(!error[_0x4c80aa]){_0x4c80aa=_0x7013('0x9');}_0x2bf1f4[_0x7013('0xa')](error[_0x4c80aa]);while(arguments[_0x22e717]){_0x2bf1f4[_0x7013('0xa')](arguments[_0x22e717]);_0x22e717++;}_0x2cd4af=util['format'][_0x7013('0xb')](util,_0x2bf1f4);this[_0x7013('0xc')]=_0x2cd4af;this[_0x7013('0xd')]=_0x4c80aa;}module['exports']=AGIError; \ No newline at end of file +var _0x6508=['push','format','message','exports','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED'];(function(_0x154fc2,_0xdafb2d){var _0x27e717=function(_0x7ba0f){while(--_0x7ba0f){_0x154fc2['push'](_0x154fc2['shift']());}};_0x27e717(++_0xdafb2d);}(_0x6508,0xe8));var _0x8650=function(_0x254081,_0x20731a){_0x254081=_0x254081-0x0;var _0x5d1e2a=_0x6508[_0x254081];return _0x5d1e2a;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x8650('0x0'),'E_AGI_SERVER_VOICE_DISABLED':_0x8650('0x1'),'E_AGI_SOCKET_ERROR':_0x8650('0x2'),'E_AGI_SOCKET_CLOSE':_0x8650('0x3'),'E_AGI_SOCKET_TIMEOUT':_0x8650('0x4'),'E_AGI_COMMAND_EMPTY':_0x8650('0x5'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x8650('0x6')};function AGIError(_0x1ec479){var _0x1ec479=_0x1ec479||null,_0x295c3e=_0x295c3e||[],_0x2b888c=0x1,_0xd5a67d='';if(!error[_0x1ec479]){_0x1ec479=_0x8650('0x7');}_0x295c3e[_0x8650('0x8')](error[_0x1ec479]);while(arguments[_0x2b888c]){_0x295c3e[_0x8650('0x8')](arguments[_0x2b888c]);_0x2b888c++;}_0xd5a67d=util[_0x8650('0x9')]['apply'](util,_0x295c3e);this[_0x8650('0xa')]=_0xd5a67d;this['name']=_0x1ec479;}module[_0x8650('0xb')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 2794093..0b9953b 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 _0x5b00=['lodash','../../../config/logger','getsecretdigits','vertices','edges','prototype','addEdge','numberOfEdges','getVertex','traverseBFS','info','no\x20vertex\x20found','length','vswitch','target','agicommand','menu','invalid','default\x20on\x20switch\x20not\x20found','includes','condition\x20not\x20found'];(function(_0x34d769,_0x33f39f){var _0x11316b=function(_0x811251){while(--_0x811251){_0x34d769['push'](_0x34d769['shift']());}};_0x11316b(++_0x33f39f);}(_0x5b00,0x1e3));var _0x05b0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5b00[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x05b0('0x0'));var logger=require(_0x05b0('0x1'))('agi');var verticesWithRetry=['menu','getdigits',_0x05b0('0x2')];var Graph=function(){this[_0x05b0('0x3')]={};this[_0x05b0('0x4')]={};this['numberOfEdges']=0x0;};Graph[_0x05b0('0x5')]['addVertex']=function(_0x6cd34b){this[_0x05b0('0x3')][_0x6cd34b['id']]=_0x6cd34b;this[_0x05b0('0x4')][_0x6cd34b['id']]=[];};Graph['prototype'][_0x05b0('0x6')]=function(_0x16ac1b,_0x12cc7a,_0x3340b9){this[_0x05b0('0x4')][_0x16ac1b]['push']({'target':_0x12cc7a,'condition':_0x3340b9});this[_0x05b0('0x7')]+=0x1;};Graph[_0x05b0('0x5')]['size']=function(){return _['size'](this['vertices']);};Graph['prototype']['relations']=function(){return this[_0x05b0('0x7')];};Graph[_0x05b0('0x5')][_0x05b0('0x8')]=function(_0x14d007){return this[_0x05b0('0x3')][_0x14d007];};Graph['prototype'][_0x05b0('0x9')]=function(_0x47d75d,_0x353d48){if(!this[_0x05b0('0x3')][_0x47d75d]){return logger[_0x05b0('0xa')](_0x05b0('0xb'));}var _0x2e5ff2=_0x353d48(this[_0x05b0('0x3')][_0x47d75d]);if(!_0x2e5ff2){return logger[_0x05b0('0xa')]('stop\x20traverse');}if(this[_0x05b0('0x4')][_0x47d75d][_0x05b0('0xc')]===0x0){return logger[_0x05b0('0xa')]('no\x20edge/s\x20available');}for(var _0x4ad2c2=0x0,_0xb58350=[],_0x49a5b0=![];_0x4ad2c2\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','mxGraphModel','root','agicommand','maxRetry','addVertex','mxCell','hasOwnProperty','isArray','length','source','target','addEdge','value','getSquareProject','catch','createSquareReport','then','indexOf','agi_','substring','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','start','YYYY-MM-DD\x20HH:mm:ss','omit','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','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','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','Project\x20%s\x20not\x20published','continueAt','Project\x20%s\x20not\x20found','getLicense','callysquare'];(function(_0x34ae9e,_0x2e0550){var _0x2df069=function(_0xcaa67d){while(--_0xcaa67d){_0x34ae9e['push'](_0x34ae9e['shift']());}};_0x2df069(++_0x2e0550);}(_0x5777,0xbf));var _0x7577=function(_0x5b004f,_0xd4d052){_0x5b004f=_0x5b004f-0x0;var _0x3b42b3=_0x5777[_0x5b004f];return _0x3b42b3;};'use strict';var parser=require(_0x7577('0x0'));var _=require(_0x7577('0x1'));var syncho=require(_0x7577('0x2'));var util=require(_0x7577('0x3'));var moment=require(_0x7577('0x4'));var config=require(_0x7577('0x5'));var logger=require('../../config/logger')('agi');var utilLicense=require(_0x7577('0x6'));var rpc=require('./rpc');var mailRpc=require('./mailRpc');var Graph=require(_0x7577('0x7'));var Vertices=require(_0x7577('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x7577('0x9')]=_[_0x7577('0xa')](config[_0x7577('0x9')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x48dc51){process[_0x7577('0xb')](function(){syncho(function(){try{setChannelVariables(_0x48dc51);agiHandler(_0x48dc51);}catch(_0x12f7b8){logger[_0x7577('0xc')](_0x12f7b8[_0x7577('0xd')]);}});});}function listeningHandler(){console[_0x7577('0xe')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x7577('0x9')]['port']);logger[_0x7577('0xf')](util[_0x7577('0x10')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x7577('0x9')]['ip'],config['agi'][_0x7577('0x11')]));}function errorHandler(_0x4cfd72){if(_0x4cfd72&&_0x4cfd72[_0x7577('0x12')]&&_0x4cfd72[_0x7577('0x13')]){logger[_0x7577('0xc')](util[_0x7577('0x10')]('[%s]\x20%s',_0x4cfd72[_0x7577('0x12')],_0x4cfd72[_0x7577('0x13')]));}else{logger[_0x7577('0xc')](util[_0x7577('0x10')](_0x7577('0x14'),_0x4cfd72['stack']));}}function closeHandler(){logger[_0x7577('0xf')](util[_0x7577('0x10')](_0x7577('0x15'),this[_0x7577('0x16')],this['calleridname'],this[_0x7577('0x17')],this[_0x7577('0x18')],this['uniqueid']));try{createSquareReport(this);}catch(_0x441e7b){logger['error'](_0x441e7b[_0x7577('0xd')]);}}function timeoutHandler(){logger[_0x7577('0xf')](util[_0x7577('0x10')](_0x7577('0x19'),this[_0x7577('0x16')],this[_0x7577('0x1a')],this[_0x7577('0x17')],this[_0x7577('0x18')],this[_0x7577('0x1b')]));}function hangupHandler(){logger[_0x7577('0xf')](util[_0x7577('0x10')](_0x7577('0x1c'),this['arg_1'],this['calleridname'],this[_0x7577('0x17')],this[_0x7577('0x18')],this['uniqueid']));this[_0x7577('0x1d')]=!![];}function getRoot(_0x3319c2){return parser['toJson'](_0x3319c2,{'object':!![]})[_0x7577('0x1e')][_0x7577('0x1f')];}function addVertex(_0x2a7092,_0x291114,_0x382f90){_0x291114[_0x7577('0x20')]=_0x382f90;if(_0x291114['hasOwnProperty']('retry')){_0x291114[_0x7577('0x21')]=parseInt(_0x291114['retry'],0xa);}_0x2a7092[_0x7577('0x22')](_['omit'](_0x291114,_0x7577('0x23')));}function initGraph(_0x1cb550,_0xa42229){var _0x1e0104=new Graph();for(var _0x4f97b3 in _0x1cb550){if(_0x1cb550[_0x7577('0x24')](_0x4f97b3)){if(_[_0x7577('0x25')](_0x1cb550[_0x4f97b3])){for(var _0x158bba=0x0;_0x158bba<_0x1cb550[_0x4f97b3][_0x7577('0x26')];_0x158bba+=0x1){addVertex(_0x1e0104,_0x1cb550[_0x4f97b3][_0x158bba],_0x4f97b3);}}else{addVertex(_0x1e0104,_0x1cb550[_0x4f97b3],_0x4f97b3);}}}for(var _0x4b6dbc=0x0;_0x4b6dbc<_0xa42229[_0x7577('0x26')];_0x4b6dbc+=0x1){if(_0xa42229[_0x4b6dbc][_0x7577('0x27')]&&_0xa42229[_0x4b6dbc][_0x7577('0x28')]){_0x1e0104[_0x7577('0x29')](_0xa42229[_0x4b6dbc][_0x7577('0x27')],_0xa42229[_0x4b6dbc][_0x7577('0x28')],_0xa42229[_0x4b6dbc][_0x7577('0x2a')]);}}return _0x1e0104;}function getSquareProject(_0xaa58fb,_0x24f4d2){rpc[_0x7577('0x2b')](_0xaa58fb)['then'](function(_0x6dc86a){_0x24f4d2(null,_0x6dc86a);})[_0x7577('0x2c')](function(_0x171ed3){_0x24f4d2(null,_0x171ed3);});}function createSquareReport(_0x225083,_0x430ef2){rpc[_0x7577('0x2d')](_0x225083)[_0x7577('0x2e')](function(_0x4459b3){if(_0x430ef2){_0x430ef2(null,_0x4459b3);}})[_0x7577('0x2c')](function(_0x216011){if(_0x430ef2){_0x430ef2(null,_0x216011);}});}function setChannelVariables(_0x2920db){for(var _0x51e4cf in _0x2920db){if(_0x2920db[_0x7577('0x24')](_0x51e4cf)){if(_0x51e4cf[_0x7577('0x2f')](_0x7577('0x30'))===0x0){_0x2920db[_0x51e4cf[_0x7577('0x31')](0x4)]=_0x2920db[_0x51e4cf];delete _0x2920db[_0x51e4cf];}}}}function getLogFromObject(_0xb9c2a3){return util[_0x7577('0x32')](_0xb9c2a3,{'showHidden':![],'depth':null});}function agiHandler(_0xed28d9){var _0x2d71f4,_0x51c03c,_0x1b0238,_0x9e2895,_0xdf4dcd;logger[_0x7577('0x33')](_0x7577('0x34'),JSON[_0x7577('0x35')](_0xed28d9,null,0x2));logger['info'](util[_0x7577('0x10')](_0x7577('0x36'),_0xed28d9[_0x7577('0x16')],_0xed28d9['calleridname'],_0xed28d9[_0x7577('0x17')],_0xed28d9[_0x7577('0x18')],_0xed28d9['uniqueid']));_0xed28d9['on'](_0x7577('0xc'),errorHandler);_0xed28d9['on'](_0x7577('0x37'),closeHandler);_0xed28d9['on'](_0x7577('0x38'),timeoutHandler);_0xed28d9['evtHangup']=![];_0xed28d9['on'](_0x7577('0x39'),hangupHandler);var _0x38f34d=getSquareProject[_0x7577('0x3a')](null,_0xed28d9['arg_1']);if(_0x38f34d){if(_0x38f34d[_0x7577('0x3b')]){_0x2d71f4=getRoot(_0x38f34d[_0x7577('0x3b')]);if(_0x2d71f4&&_0x2d71f4[_0x7577('0x3c')]){logger[_0x7577('0x33')](_0x7577('0x1f'),JSON[_0x7577('0x35')](_0x2d71f4,null,0x2));_0xed28d9['joinAt']=moment()[_0x7577('0x10')](_0x7577('0x3d'));_0x51c03c=initGraph(_[_0x7577('0x3e')](_0x2d71f4,'mxCell'),_0x2d71f4[_0x7577('0x23')]);_0x1b0238=new Vertices(_0xed28d9,rpc,mailRpc);logger['info'](util[_0x7577('0x10')](_0x7577('0x3f'),_0xed28d9[_0x7577('0x16')],_0xed28d9['calleridname'],_0xed28d9[_0x7577('0x17')],_0xed28d9['dnid'],_0xed28d9['uniqueid']));_0x51c03c[_0x7577('0x40')](_0x2d71f4['start']['id'],function(_0xa36a62){try{_0xa36a62=_0x1b0238[_0x7577('0x41')](_0xa36a62);logger[_0x7577('0x33')]('vertex',JSON[_0x7577('0x35')](_0xa36a62,null,0x2));if(_0xa36a62[_0x7577('0x20')]==='gotoc'){logger['info'](_0x7577('0x42'));_0xed28d9[_0x7577('0x43')]=_0xa36a62['context']||_0xed28d9[_0x7577('0x43')];_0xed28d9[_0x7577('0x44')]=_0xa36a62['extension'];_0xed28d9[_0x7577('0x45')]=_0xa36a62[_0x7577('0x45')]?_0xa36a62[_0x7577('0x45')]-0x1:0x1;return null;}else if(_0xa36a62&&_0x1b0238[_0xa36a62[_0x7577('0x20')]]){_0xdf4dcd=_0x1b0238[_0xa36a62[_0x7577('0x20')]](_0xa36a62);logger[_0x7577('0xf')](_0x7577('0x46'),JSON['stringify'](_0xdf4dcd,null,0x2));if(_0xdf4dcd&&_0xdf4dcd[_0x7577('0x47')]===AGI_CODE_SUCCESS&&_0xdf4dcd[_0x7577('0x48')]!==AGI_RESULT_ERROR&&!_0xed28d9[_0x7577('0x1d')]){logger[_0x7577('0x33')](_0x7577('0x46'),getLogFromObject(_0xdf4dcd));return _[_0x7577('0x49')](_0xdf4dcd[_0x7577('0x48')])?null:_0xdf4dcd[_0x7577('0x48')][_0x7577('0x4a')]();}else{logger[_0x7577('0xc')]('response',getLogFromObject(_0xdf4dcd));return null;}}else{logger['error'](_0x7577('0x4b'));return null;}}catch(_0x34c038){logger[_0x7577('0xc')](_0x34c038[_0x7577('0xd')]);return null;}});if(_0x2d71f4[_0x7577('0x4c')]){logger['info'](util[_0x7577('0x10')](_0x7577('0x4d'),_0xed28d9['arg_1'],_0xed28d9[_0x7577('0x1a')],_0xed28d9[_0x7577('0x17')],_0xed28d9[_0x7577('0x18')],_0xed28d9[_0x7577('0x1b')]));_0x51c03c[_0x7577('0x40')](_0x2d71f4[_0x7577('0x4c')]['id'],function(_0x1e243b){try{_0x1e243b=_0x1b0238[_0x7577('0x41')](_0x1e243b);logger[_0x7577('0x33')](_0x7577('0x4e'),JSON[_0x7577('0x35')](_0x1e243b,null,0x2));if(_0x1e243b&&_0x1b0238[_0x1e243b[_0x7577('0x20')]]){_0xdf4dcd=_0x1b0238[_0x1e243b[_0x7577('0x20')]](_0x1e243b);if(_0xdf4dcd){logger[_0x7577('0x33')](_0x7577('0x46'),getLogFromObject(_0xdf4dcd));return _['isUndefined'](_0xdf4dcd[_0x7577('0x48')])?null:_0xdf4dcd['result']['toString']();}else{logger['error'](_0x7577('0x46'),getLogFromObject(_0xdf4dcd));return null;}}else{logger['error'](_0x7577('0x4b'));return null;}}catch(_0x487e02){logger['error'](_0x487e02[_0x7577('0xd')]);return null;}});}logger[_0x7577('0xf')](util[_0x7577('0x10')](_0x7577('0x4f'),_0xed28d9['arg_1'],_0xed28d9[_0x7577('0x1a')],_0xed28d9[_0x7577('0x17')],_0xed28d9[_0x7577('0x18')],_0xed28d9['uniqueid']));logger[_0x7577('0xf')](util['format']('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0xed28d9[_0x7577('0x43')],_0xed28d9['extension'],parseInt(_0xed28d9['priority'],0xa)+0x1));_0xed28d9['continueAt'](_0xed28d9[_0x7577('0x43')],_0xed28d9[_0x7577('0x44')],parseInt(_0xed28d9[_0x7577('0x45')],0xa)+0x1);_0xed28d9['close']();}}else{logger[_0x7577('0xc')](util[_0x7577('0x10')](_0x7577('0x50'),_0xed28d9[_0x7577('0x16')]));_0xed28d9[_0x7577('0x51')](_0xed28d9[_0x7577('0x43')],_0xed28d9[_0x7577('0x44')],parseInt(_0xed28d9[_0x7577('0x45')],0xa)+0x1);_0xed28d9['close']();}}else{logger[_0x7577('0xc')](util[_0x7577('0x10')](_0x7577('0x52'),_0xed28d9[_0x7577('0x16')]));_0xed28d9[_0x7577('0x51')](_0xed28d9[_0x7577('0x43')],_0xed28d9[_0x7577('0x44')],parseInt(_0xed28d9[_0x7577('0x45')],0xa)+0x1);_0xed28d9['close']();}}function main(){var _0x27a414;return utilLicense[_0x7577('0x53')]()[_0x7577('0x2e')](function(_0x397023){if(_0x397023){if(_0x397023['voice']){if(_0x397023[_0x7577('0x54')]&&_0x397023['callysquare']>0x0){logger['info'](util[_0x7577('0x10')](_0x7577('0x55'),_0x397023[_0x7577('0x54')]));_0x27a414=_0x397023['callysquare'];}else{logger[_0x7577('0xf')](_0x7577('0x56'));}}else{logger['info'](_0x7577('0x57'));_0x27a414=-0x1;}}})['catch'](function(_0x5a4493){logger[_0x7577('0xc')](_0x7577('0x58'),_0x5a4493[_0x7577('0xd')]);})[_0x7577('0x4c')](function(){var _0x56de54=require(_0x7577('0x59'))(config['agi'][_0x7577('0x11')],config[_0x7577('0x9')]['ip'],_0x27a414);_0x56de54['on'](_0x7577('0xc'),errorHandler);_0x56de54['on'](_0x7577('0x5a'),listeningHandler);_0x56de54['on'](_0x7577('0x5b'),connectionHandler);_0x56de54['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x964d=['traverseBFS','clear','gotoc','context','extension','priority','code','isUndefined','result','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','finally','vertex','response','[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','Project\x20%s\x20not\x20found','continueAt','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','lodash','syncho','../../config/environment','../../config/logger','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','agi','defaults','127.0.0.1','nextTick','error','stack','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','[%s]\x20%s','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','root','agicommand','hasOwnProperty','retry','maxRetry','omit','isArray','length','target','addEdge','source','value','getSquareProject','then','catch','createSquareReport','agi_','substring','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','production','joinAt','YYYY-MM-DD\x20HH:mm:ss','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s'];(function(_0x200765,_0x5aaf6c){var _0x307858=function(_0x28cc3f){while(--_0x28cc3f){_0x200765['push'](_0x200765['shift']());}};_0x307858(++_0x5aaf6c);}(_0x964d,0x191));var _0xd964=function(_0x3ac786,_0x38fde4){_0x3ac786=_0x3ac786-0x0;var _0x377991=_0x964d[_0x3ac786];return _0x377991;};'use strict';var parser=require(_0xd964('0x0'));var _=require(_0xd964('0x1'));var syncho=require(_0xd964('0x2'));var util=require('util');var moment=require('moment');var config=require(_0xd964('0x3'));var logger=require(_0xd964('0x4'))('agi');var utilLicense=require(_0xd964('0x5'));var rpc=require(_0xd964('0x6'));var mailRpc=require(_0xd964('0x7'));var Graph=require(_0xd964('0x8'));var Vertices=require(_0xd964('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xd964('0xa')]=_[_0xd964('0xb')](config[_0xd964('0xa')],{'ip':_0xd964('0xc'),'port':0x11dd});function connectionHandler(_0x1db978){process[_0xd964('0xd')](function(){syncho(function(){try{setChannelVariables(_0x1db978);agiHandler(_0x1db978);}catch(_0x275bb){logger[_0xd964('0xe')](_0x275bb[_0xd964('0xf')]);}});});}function listeningHandler(){console['log'](_0xd964('0x10'),config[_0xd964('0xa')][_0xd964('0x11')]);logger[_0xd964('0x12')](util[_0xd964('0x13')](_0xd964('0x14'),config['agi']['ip'],config[_0xd964('0xa')][_0xd964('0x11')]));}function errorHandler(_0x44959e){if(_0x44959e&&_0x44959e[_0xd964('0x15')]&&_0x44959e['message']){logger['error'](util[_0xd964('0x13')](_0xd964('0x16'),_0x44959e['name'],_0x44959e[_0xd964('0x17')]));}else{logger[_0xd964('0xe')](util[_0xd964('0x13')](_0xd964('0x18'),_0x44959e[_0xd964('0xf')]));}}function closeHandler(){logger[_0xd964('0x12')](util[_0xd964('0x13')](_0xd964('0x19'),this['arg_1'],this['calleridname'],this[_0xd964('0x1a')],this[_0xd964('0x1b')],this[_0xd964('0x1c')]));try{createSquareReport(this);}catch(_0x209867){logger[_0xd964('0xe')](_0x209867[_0xd964('0xf')]);}}function timeoutHandler(){logger[_0xd964('0x12')](util[_0xd964('0x13')](_0xd964('0x1d'),this[_0xd964('0x1e')],this['calleridname'],this[_0xd964('0x1a')],this[_0xd964('0x1b')],this[_0xd964('0x1c')]));}function hangupHandler(){logger[_0xd964('0x12')](util['format'](_0xd964('0x1f'),this[_0xd964('0x1e')],this['calleridname'],this[_0xd964('0x1a')],this[_0xd964('0x1b')],this['uniqueid']));this[_0xd964('0x20')]=!![];}function getRoot(_0x4287b7){return parser[_0xd964('0x21')](_0x4287b7,{'object':!![]})['mxGraphModel'][_0xd964('0x22')];}function addVertex(_0x4af4c9,_0x37f5ee,_0x16be6a){_0x37f5ee[_0xd964('0x23')]=_0x16be6a;if(_0x37f5ee[_0xd964('0x24')](_0xd964('0x25'))){_0x37f5ee[_0xd964('0x26')]=parseInt(_0x37f5ee[_0xd964('0x25')],0xa);}_0x4af4c9['addVertex'](_[_0xd964('0x27')](_0x37f5ee,'mxCell'));}function initGraph(_0x4ef99c,_0x5e5d94){var _0x3e11e1=new Graph();for(var _0x239bc8 in _0x4ef99c){if(_0x4ef99c[_0xd964('0x24')](_0x239bc8)){if(_[_0xd964('0x28')](_0x4ef99c[_0x239bc8])){for(var _0x41df40=0x0;_0x41df40<_0x4ef99c[_0x239bc8][_0xd964('0x29')];_0x41df40+=0x1){addVertex(_0x3e11e1,_0x4ef99c[_0x239bc8][_0x41df40],_0x239bc8);}}else{addVertex(_0x3e11e1,_0x4ef99c[_0x239bc8],_0x239bc8);}}}for(var _0x637ea8=0x0;_0x637ea8<_0x5e5d94[_0xd964('0x29')];_0x637ea8+=0x1){if(_0x5e5d94[_0x637ea8]['source']&&_0x5e5d94[_0x637ea8][_0xd964('0x2a')]){_0x3e11e1[_0xd964('0x2b')](_0x5e5d94[_0x637ea8][_0xd964('0x2c')],_0x5e5d94[_0x637ea8][_0xd964('0x2a')],_0x5e5d94[_0x637ea8][_0xd964('0x2d')]);}}return _0x3e11e1;}function getSquareProject(_0xdd4657,_0x269d88){rpc[_0xd964('0x2e')](_0xdd4657)[_0xd964('0x2f')](function(_0x14bae5){_0x269d88(null,_0x14bae5);})[_0xd964('0x30')](function(_0x5796eb){_0x269d88(null,_0x5796eb);});}function createSquareReport(_0x28d773,_0x20ed2b){rpc[_0xd964('0x31')](_0x28d773)[_0xd964('0x2f')](function(_0x2b8be7){if(_0x20ed2b){_0x20ed2b(null,_0x2b8be7);}})['catch'](function(_0x1997ce){if(_0x20ed2b){_0x20ed2b(null,_0x1997ce);}});}function setChannelVariables(_0x1d88c3){for(var _0x58e04e in _0x1d88c3){if(_0x1d88c3['hasOwnProperty'](_0x58e04e)){if(_0x58e04e['indexOf'](_0xd964('0x32'))===0x0){_0x1d88c3[_0x58e04e[_0xd964('0x33')](0x4)]=_0x1d88c3[_0x58e04e];delete _0x1d88c3[_0x58e04e];}}}}function getLogFromObject(_0x262a82){return util[_0xd964('0x34')](_0x262a82,{'showHidden':![],'depth':null});}function agiHandler(_0x1ff038){var _0x5b0ae4,_0x2d0ed4,_0x16bb08,_0x3516f6,_0x32e68e;logger[_0xd964('0x35')](_0xd964('0x36'),JSON[_0xd964('0x37')](_0x1ff038,null,0x2));logger['info'](util[_0xd964('0x13')](_0xd964('0x38'),_0x1ff038[_0xd964('0x1e')],_0x1ff038['calleridname'],_0x1ff038[_0xd964('0x1a')],_0x1ff038['dnid'],_0x1ff038[_0xd964('0x1c')]));_0x1ff038['on'](_0xd964('0xe'),errorHandler);_0x1ff038['on'](_0xd964('0x39'),closeHandler);_0x1ff038['on'](_0xd964('0x3a'),timeoutHandler);_0x1ff038[_0xd964('0x20')]=![];_0x1ff038['on']('hangup',hangupHandler);var _0x352265=getSquareProject['sync'](null,_0x1ff038[_0xd964('0x1e')]);if(_0x352265){if(_0x352265['production']){_0x5b0ae4=getRoot(_0x352265[_0xd964('0x3b')]);if(_0x5b0ae4&&_0x5b0ae4['start']){logger[_0xd964('0x35')]('root',JSON[_0xd964('0x37')](_0x5b0ae4,null,0x2));_0x1ff038[_0xd964('0x3c')]=moment()[_0xd964('0x13')](_0xd964('0x3d'));_0x2d0ed4=initGraph(_['omit'](_0x5b0ae4,_0xd964('0x3e')),_0x5b0ae4[_0xd964('0x3e')]);_0x16bb08=new Vertices(_0x1ff038,rpc,mailRpc);logger[_0xd964('0x12')](util[_0xd964('0x13')](_0xd964('0x3f'),_0x1ff038[_0xd964('0x1e')],_0x1ff038['calleridname'],_0x1ff038['callerid'],_0x1ff038[_0xd964('0x1b')],_0x1ff038[_0xd964('0x1c')]));_0x2d0ed4[_0xd964('0x40')](_0x5b0ae4['start']['id'],function(_0xfcb6){try{_0xfcb6=_0x16bb08[_0xd964('0x41')](_0xfcb6);logger[_0xd964('0x35')]('vertex',JSON['stringify'](_0xfcb6,null,0x2));if(_0xfcb6[_0xd964('0x23')]===_0xd964('0x42')){logger[_0xd964('0x12')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x1ff038[_0xd964('0x43')]=_0xfcb6['context']||_0x1ff038['context'];_0x1ff038[_0xd964('0x44')]=_0xfcb6[_0xd964('0x44')];_0x1ff038[_0xd964('0x45')]=_0xfcb6[_0xd964('0x45')]?_0xfcb6[_0xd964('0x45')]-0x1:0x1;return null;}else if(_0xfcb6&&_0x16bb08[_0xfcb6[_0xd964('0x23')]]){_0x32e68e=_0x16bb08[_0xfcb6[_0xd964('0x23')]](_0xfcb6);logger[_0xd964('0x12')]('response',JSON[_0xd964('0x37')](_0x32e68e,null,0x2));if(_0x32e68e&&_0x32e68e[_0xd964('0x46')]===AGI_CODE_SUCCESS&&_0x32e68e['result']!==AGI_RESULT_ERROR&&!_0x1ff038[_0xd964('0x20')]){logger[_0xd964('0x35')]('response',getLogFromObject(_0x32e68e));return _[_0xd964('0x47')](_0x32e68e[_0xd964('0x48')])?null:_0x32e68e[_0xd964('0x48')][_0xd964('0x49')]();}else{logger['error']('response',getLogFromObject(_0x32e68e));return null;}}else{logger[_0xd964('0xe')](_0xd964('0x4a'));return null;}}catch(_0x4ef48c){logger[_0xd964('0xe')](_0x4ef48c[_0xd964('0xf')]);return null;}});if(_0x5b0ae4['finally']){logger[_0xd964('0x12')](util[_0xd964('0x13')](_0xd964('0x4b'),_0x1ff038[_0xd964('0x1e')],_0x1ff038[_0xd964('0x4c')],_0x1ff038[_0xd964('0x1a')],_0x1ff038['dnid'],_0x1ff038['uniqueid']));_0x2d0ed4[_0xd964('0x40')](_0x5b0ae4[_0xd964('0x4d')]['id'],function(_0x3cd1e2){try{_0x3cd1e2=_0x16bb08['clear'](_0x3cd1e2);logger[_0xd964('0x35')](_0xd964('0x4e'),JSON[_0xd964('0x37')](_0x3cd1e2,null,0x2));if(_0x3cd1e2&&_0x16bb08[_0x3cd1e2[_0xd964('0x23')]]){_0x32e68e=_0x16bb08[_0x3cd1e2['agicommand']](_0x3cd1e2);if(_0x32e68e){logger[_0xd964('0x35')](_0xd964('0x4f'),getLogFromObject(_0x32e68e));return _['isUndefined'](_0x32e68e[_0xd964('0x48')])?null:_0x32e68e[_0xd964('0x48')][_0xd964('0x49')]();}else{logger[_0xd964('0xe')](_0xd964('0x4f'),getLogFromObject(_0x32e68e));return null;}}else{logger[_0xd964('0xe')](_0xd964('0x4a'));return null;}}catch(_0x5822cf){logger[_0xd964('0xe')](_0x5822cf[_0xd964('0xf')]);return null;}});}logger['info'](util[_0xd964('0x13')](_0xd964('0x50'),_0x1ff038[_0xd964('0x1e')],_0x1ff038[_0xd964('0x4c')],_0x1ff038[_0xd964('0x1a')],_0x1ff038[_0xd964('0x1b')],_0x1ff038[_0xd964('0x1c')]));logger[_0xd964('0x12')](util[_0xd964('0x13')](_0xd964('0x51'),_0x1ff038[_0xd964('0x43')],_0x1ff038[_0xd964('0x44')],parseInt(_0x1ff038[_0xd964('0x45')],0xa)+0x1));_0x1ff038['continueAt'](_0x1ff038[_0xd964('0x43')],_0x1ff038[_0xd964('0x44')],parseInt(_0x1ff038[_0xd964('0x45')],0xa)+0x1);_0x1ff038[_0xd964('0x39')]();}}else{logger[_0xd964('0xe')](util[_0xd964('0x13')]('Project\x20%s\x20not\x20published',_0x1ff038[_0xd964('0x1e')]));_0x1ff038['continueAt'](_0x1ff038['context'],_0x1ff038[_0xd964('0x44')],parseInt(_0x1ff038['priority'],0xa)+0x1);_0x1ff038[_0xd964('0x39')]();}}else{logger[_0xd964('0xe')](util[_0xd964('0x13')](_0xd964('0x52'),_0x1ff038['arg_1']));_0x1ff038[_0xd964('0x53')](_0x1ff038[_0xd964('0x43')],_0x1ff038[_0xd964('0x44')],parseInt(_0x1ff038['priority'],0xa)+0x1);_0x1ff038[_0xd964('0x39')]();}}function main(){var _0xc6da88;return utilLicense['getLicense']()[_0xd964('0x2f')](function(_0x218883){if(_0x218883){if(_0x218883[_0xd964('0x54')]){if(_0x218883[_0xd964('0x55')]&&_0x218883[_0xd964('0x55')]>0x0){logger[_0xd964('0x12')](util[_0xd964('0x13')](_0xd964('0x56'),_0x218883['callysquare']));_0xc6da88=_0x218883[_0xd964('0x55')];}else{logger[_0xd964('0x12')](_0xd964('0x57'));}}else{logger['info'](_0xd964('0x58'));_0xc6da88=-0x1;}}})['catch'](function(_0x56ffa6){logger[_0xd964('0xe')](_0xd964('0x59'),_0x56ffa6[_0xd964('0xf')]);})[_0xd964('0x4d')](function(){var _0x198878=require(_0xd964('0x5a'))(config['agi']['port'],config['agi']['ip'],_0xc6da88);_0x198878['on'](_0xd964('0xe'),errorHandler);_0x198878['on'](_0xd964('0x5b'),listeningHandler);_0x198878['on'](_0xd964('0x5c'),connectionHandler);_0x198878['on']('close',closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index d876130..3f1480b 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 _0x429a=['bluebird','jayson/promise','http','request','error','message','result','sendMailMessage','SendMail'];(function(_0x185127,_0x55eef7){var _0xf0fbff=function(_0x55c01a){while(--_0x55c01a){_0x185127['push'](_0x185127['shift']());}};_0xf0fbff(++_0x55eef7);}(_0x429a,0xd8));var _0xa429=function(_0x349a9e,_0x473cb8){_0x349a9e=_0x349a9e-0x0;var _0x24c207=_0x429a[_0x349a9e];return _0x24c207;};'use strict';var BPromise=require(_0xa429('0x0'));var jayson=require(_0xa429('0x1'));var client=jayson['client'][_0xa429('0x2')]({'port':0x232b});function request(_0x22ffbe,_0x43f0c0){return new BPromise(function(_0x4290c8,_0x16f142){return client[_0xa429('0x3')](_0x22ffbe,_0x43f0c0)['then'](function(_0x2d4d42){if(_0x2d4d42['error']){return _0x16f142(_0x2d4d42[_0xa429('0x4')][_0xa429('0x5')]);}else{return _0x4290c8(_0x2d4d42[_0xa429('0x6')]);}})['catch'](function(_0x75566d){return _0x16f142(_0x75566d);});});}exports[_0xa429('0x7')]=function(_0x40f61,_0x3a5701){return request(_0xa429('0x8'),{'account':_0x40f61,'message':_0x3a5701});}; \ No newline at end of file +var _0xbcd9=['request','then','error','result','sendMailMessage','client','http'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xbcd9,0x147));var _0x9bcd=function(_0x8030cb,_0xb58484){_0x8030cb=_0x8030cb-0x0;var _0x3d5afc=_0xbcd9[_0x8030cb];return _0x3d5afc;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson[_0x9bcd('0x0')][_0x9bcd('0x1')]({'port':0x232b});function request(_0x2b0cd5,_0x1b58e3){return new BPromise(function(_0x3eaab7,_0x33b5e9){return client[_0x9bcd('0x2')](_0x2b0cd5,_0x1b58e3)[_0x9bcd('0x3')](function(_0x323dfa){if(_0x323dfa[_0x9bcd('0x4')]){return _0x33b5e9(_0x323dfa['error']['message']);}else{return _0x3eaab7(_0x323dfa[_0x9bcd('0x5')]);}})['catch'](function(_0x2d5e7b){return _0x33b5e9(_0x2d5e7b);});});}exports[_0x9bcd('0x6')]=function(_0xba77b6,_0x301d09){return request('SendMail',{'account':_0xba77b6,'message':_0x301d09});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index b0d3da5..f0abe2f 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 _0x1ca7=['emit','headers','line','util','stream','_localBuffer','_inBody','inherits','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','slice','trim'];(function(_0x503511,_0x454c89){var _0x490877=function(_0x146974){while(--_0x146974){_0x503511['push'](_0x503511['shift']());}};_0x490877(++_0x454c89);}(_0x1ca7,0x157));var _0x71ca=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x1ca7[_0xb0f7c3];return _0x28ea68;};'use strict';var util=require(_0x71ca('0x0'));var Transform=require(_0x71ca('0x1'))['Transform'];function AGIReply(_0x53ce28){Transform['call'](this,_0x53ce28);this[_0x71ca('0x2')]='';this[_0x71ca('0x3')]=![];}util[_0x71ca('0x4')](AGIReply,Transform);AGIReply['prototype'][_0x71ca('0x5')]=function(_0x3b6cbf,_0x58f288,_0x58c4a5){var _0x3ebc2f='\x0a',_0x2d5d49=['\x0a\x0a',_0x71ca('0x6')],_0x31444d=-0x1,_0xa06a89=-0x1,_0x4f25f6='',_0x378012=0x0,_0x41ca0a='',_0x59f41c='';this[_0x71ca('0x2')]+=_0x3b6cbf[_0x71ca('0x7')]();_0x41ca0a=this['_localBuffer'];if(!this[_0x71ca('0x3')]){_0x378012=0x0;while(_0x2d5d49[_0x378012]){while((_0xa06a89=_0x41ca0a[_0x71ca('0x8')](_0x2d5d49[_0x378012]))!=-0x1){_0x4f25f6=_0x2d5d49[_0x378012];_0x59f41c=_0x41ca0a[_0x71ca('0x9')](0x0,_0xa06a89);_0x41ca0a=_0x41ca0a[_0x71ca('0x9')](_0xa06a89+_0x4f25f6[_0x71ca('0xa')]);var _0x3d5a28=_0x59f41c[_0x71ca('0xb')](_0x3ebc2f),_0x5df2cd=0x0,_0x1d92d6={},_0x1654d3='',_0x4da234='',_0x230345=-0x1;while(_0x3d5a28[_0x5df2cd]){_0x230345=_0x3d5a28[_0x5df2cd][_0x71ca('0x8')](':');if(_0x230345!=-0x1){_0x1654d3=_0x3d5a28[_0x5df2cd][_0x71ca('0xc')](0x0,_0x230345)[_0x71ca('0xd')]();_0x4da234=_0x3d5a28[_0x5df2cd][_0x71ca('0xc')](_0x230345+0x1)[_0x71ca('0xd')]();if(_0x1654d3[_0x71ca('0xa')]>0x0){_0x1d92d6[_0x1654d3]=_0x4da234;}}else{}_0x5df2cd++;}this[_0x71ca('0xe')](_0x71ca('0xf'),_0x1d92d6);this['_inBody']=!![];}_0x378012++;}this['_localBuffer']=_0x41ca0a;}else{while((_0x31444d=_0x41ca0a[_0x71ca('0x8')](_0x3ebc2f))!=-0x1){_0x59f41c=_0x41ca0a['substring'](0x0,_0x31444d);this[_0x71ca('0xe')](_0x71ca('0x10'),_0x59f41c);_0x41ca0a=_0x41ca0a['substring'](_0x31444d+_0x3ebc2f['length']);}this[_0x71ca('0x2')]=_0x41ca0a;}_0x58c4a5();};module['exports']=AGIReply; \ No newline at end of file +var _0xaf1d=['_localBuffer','_inBody','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','slice','trim','emit','line','exports','util','stream','Transform'];(function(_0x50f392,_0x1d8441){var _0x5926f2=function(_0x17df32){while(--_0x17df32){_0x50f392['push'](_0x50f392['shift']());}};_0x5926f2(++_0x1d8441);}(_0xaf1d,0x9f));var _0xdaf1=function(_0x3cd878,_0x13ae44){_0x3cd878=_0x3cd878-0x0;var _0x4e8c2e=_0xaf1d[_0x3cd878];return _0x4e8c2e;};'use strict';var util=require(_0xdaf1('0x0'));var Transform=require(_0xdaf1('0x1'))[_0xdaf1('0x2')];function AGIReply(_0x12480d){Transform['call'](this,_0x12480d);this[_0xdaf1('0x3')]='';this[_0xdaf1('0x4')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0xdaf1('0x5')][_0xdaf1('0x6')]=function(_0x1e5a38,_0x51cdb6,_0x1f6731){var _0x46f030='\x0a',_0x4d6c50=['\x0a\x0a',_0xdaf1('0x7')],_0x54dc7a=-0x1,_0x5ed9cd=-0x1,_0xfb18fc='',_0x51a7e9=0x0,_0x4fd84c='',_0x23076c='';this[_0xdaf1('0x3')]+=_0x1e5a38[_0xdaf1('0x8')]();_0x4fd84c=this['_localBuffer'];if(!this[_0xdaf1('0x4')]){_0x51a7e9=0x0;while(_0x4d6c50[_0x51a7e9]){while((_0x5ed9cd=_0x4fd84c[_0xdaf1('0x9')](_0x4d6c50[_0x51a7e9]))!=-0x1){_0xfb18fc=_0x4d6c50[_0x51a7e9];_0x23076c=_0x4fd84c[_0xdaf1('0xa')](0x0,_0x5ed9cd);_0x4fd84c=_0x4fd84c[_0xdaf1('0xa')](_0x5ed9cd+_0xfb18fc[_0xdaf1('0xb')]);var _0x4868eb=_0x23076c[_0xdaf1('0xc')](_0x46f030),_0x35ee0d=0x0,_0x7d7480={},_0x260c4b='',_0x112c60='',_0x3543e1=-0x1;while(_0x4868eb[_0x35ee0d]){_0x3543e1=_0x4868eb[_0x35ee0d][_0xdaf1('0x9')](':');if(_0x3543e1!=-0x1){_0x260c4b=_0x4868eb[_0x35ee0d][_0xdaf1('0xd')](0x0,_0x3543e1)[_0xdaf1('0xe')]();_0x112c60=_0x4868eb[_0x35ee0d][_0xdaf1('0xd')](_0x3543e1+0x1)[_0xdaf1('0xe')]();if(_0x260c4b[_0xdaf1('0xb')]>0x0){_0x7d7480[_0x260c4b]=_0x112c60;}}else{}_0x35ee0d++;}this[_0xdaf1('0xf')]('headers',_0x7d7480);this[_0xdaf1('0x4')]=!![];}_0x51a7e9++;}this[_0xdaf1('0x3')]=_0x4fd84c;}else{while((_0x54dc7a=_0x4fd84c['indexOf'](_0x46f030))!=-0x1){_0x23076c=_0x4fd84c[_0xdaf1('0xa')](0x0,_0x54dc7a);this['emit'](_0xdaf1('0x10'),_0x23076c);_0x4fd84c=_0x4fd84c[_0xdaf1('0xa')](_0x54dc7a+_0x46f030[_0xdaf1('0xb')]);}this['_localBuffer']=_0x4fd84c;}_0x1f6731();};module[_0xdaf1('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 c45fd32..52714bb 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 _0x2c8e=['getTrunkById','ShowTrunk','ShowSound','Intervals','ShowSmsAccount','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','createSquareMessage','CreateSquareMessage','createCmContact','phone','ListId','getPauseById','ShowPause','agentLogin','agentPause','PauseUser','agentUnpause','LogoutUser','bluebird','lodash','util','jayson/promise','client','http','then','error','message','result','production','getMailAccountById','ShowMailAccount','Smtp','name','email','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','ShowSquareOdbc','ShowUser'];(function(_0x54fbff,_0x53470e){var _0x5cf619=function(_0x28765b){while(--_0x28765b){_0x54fbff['push'](_0x54fbff['shift']());}};_0x5cf619(++_0x53470e);}(_0x2c8e,0x97));var _0xe2c8=function(_0xf94684,_0x1411a1){_0xf94684=_0xf94684-0x0;var _0x58f7ef=_0x2c8e[_0xf94684];return _0x58f7ef;};'use strict';var BPromise=require(_0xe2c8('0x0'));var moment=require('moment');var _=require(_0xe2c8('0x1'));var util=require(_0xe2c8('0x2'));var jayson=require(_0xe2c8('0x3'));var client=jayson[_0xe2c8('0x4')][_0xe2c8('0x5')]({'port':0x2329});function request(_0x377c1d,_0x56b308){return new BPromise(function(_0x246ea3,_0x20c91b){return client['request'](_0x377c1d,_0x56b308)[_0xe2c8('0x6')](function(_0x471698){if(_0x471698[_0xe2c8('0x7')]){return _0x20c91b(_0x471698['error'][_0xe2c8('0x8')]);}else{return _0x246ea3(_0x471698[_0xe2c8('0x9')]);}})['catch'](function(_0x33af1f){return _0x20c91b(_0x33af1f);});});}exports['getSquareProject']=function(_0x312cc0){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x312cc0},'attributes':[_0xe2c8('0xa')]}});};exports[_0xe2c8('0xb')]=function(_0x111e78){return request(_0xe2c8('0xc'),{'options':{'raw':![],'where':{'id':_0x111e78},'include':[{'model':'MailServerOut','as':_0xe2c8('0xd')}],'attributes':['id',_0xe2c8('0xe'),_0xe2c8('0xf')]}});};exports['getSquareProjectById']=function(_0x137579){return request(_0xe2c8('0x10'),{'options':{'where':{'id':_0x137579},'attributes':[_0xe2c8('0xe')]}});};exports[_0xe2c8('0x11')]=function(_0x40836d){return request(_0xe2c8('0x12'),{'options':{'where':{'id':_0x40836d},'attributes':['name']}});};exports['getVariableById']=function(_0x46cb3f){return request('ShowVariable',{'options':{'where':{'id':_0x46cb3f},'attributes':[_0xe2c8('0xe')]}});};exports['getSquareOdbcById']=function(_0x4602f1){return request(_0xe2c8('0x13'),{'options':{'where':{'id':_0x4602f1},'attributes':['dsn']}});};exports['getUserById']=function(_0x1dc14e){return request(_0xe2c8('0x14'),{'options':{'where':{'id':_0x1dc14e},'attributes':['name']}});};exports[_0xe2c8('0x15')]=function(_0x20b1b7){return request(_0xe2c8('0x16'),{'options':{'where':{'id':_0x20b1b7},'attributes':[_0xe2c8('0xe')]}});};exports['getSoundById']=function(_0x195259){return request(_0xe2c8('0x17'),{'options':{'where':{'id':_0x195259},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x50422e){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x50422e},'include':[{'model':'Interval','as':_0xe2c8('0x18')}]}});};exports['getSmsAccountById']=function(_0x1e2ffe){return request(_0xe2c8('0x19'),{'options':{'where':{'id':_0x1e2ffe},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x442fd2){return request('CreateSmsMessage',{'body':_0x442fd2});};exports[_0xe2c8('0x1a')]=function(_0x4f0770){return request(_0xe2c8('0x1b'),{'body':_0x4f0770});};exports[_0xe2c8('0x1c')]=function(_0x2c399a){return request(_0xe2c8('0x1d'),{'body':_[_0xe2c8('0x1e')](_0x2c399a,{'project_name':_0x2c399a['arg_1'],'prev_project_name':_0x2c399a['arg_2']||'','is_subproject':_0x2c399a['arg_2']?!![]:![],'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')})});};exports['createSquareRecording']=function(_0x59ec32){return request('CreateSquareRecording',{'body':_0x59ec32});};exports[_0xe2c8('0x1f')]=function(_0x5a32ab){return request(_0xe2c8('0x20'),{'body':_0x5a32ab});};exports[_0xe2c8('0x21')]=function(_0x5bfe35){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x5bfe35[_0xe2c8('0x22')],'ListId':_0x5bfe35[_0xe2c8('0x23')]}}})[_0xe2c8('0x6')](function(_0x2855d4){if(_0x2855d4){return _0x2855d4;}return request('CreateCmContact',{'body':_0x5bfe35});});};exports[_0xe2c8('0x24')]=function(_0x28707f){return request(_0xe2c8('0x25'),{'options':{'where':{'id':_0x28707f},'attributes':[_0xe2c8('0xe')]}});};exports[_0xe2c8('0x26')]=function(_0x18d5a6,_0x37b1f0){return request('LoginUser',{'body':{'interface':_0x37b1f0},'options':{'where':_0x18d5a6}});};exports[_0xe2c8('0x27')]=function(_0x7787f,_0x2c310c,_0x9d0fa6){return request(_0xe2c8('0x28'),{'body':{'type':_0x2c310c,'uniqueid':_0x9d0fa6},'options':{'where':_0x7787f}});};exports[_0xe2c8('0x29')]=function(_0x19edd2){return request('UnpauseUser',{'body':{},'options':{'where':_0x19edd2}});};exports['agentLogout']=function(_0x45af5a){return request(_0xe2c8('0x2a'),{'body':{},'options':{'where':_0x45af5a}});}; \ No newline at end of file +var _0x0da8=['ShowPause','LoginUser','agentPause','PauseUser','agentLogout','bluebird','moment','lodash','jayson/promise','http','then','error','message','result','ShowSquareProject','production','ShowMailAccount','MailServerOut','Smtp','email','name','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x0da8,0x1f4));var _0x80da=function(_0xf8ebe,_0x4a8cba){_0xf8ebe=_0xf8ebe-0x0;var _0x11131f=_0x0da8[_0xf8ebe];return _0x11131f;};'use strict';var BPromise=require(_0x80da('0x0'));var moment=require(_0x80da('0x1'));var _=require(_0x80da('0x2'));var util=require('util');var jayson=require(_0x80da('0x3'));var client=jayson['client'][_0x80da('0x4')]({'port':0x2329});function request(_0x5e9030,_0x59fc88){return new BPromise(function(_0x385210,_0x596d39){return client['request'](_0x5e9030,_0x59fc88)[_0x80da('0x5')](function(_0x10d5bd){if(_0x10d5bd['error']){return _0x596d39(_0x10d5bd[_0x80da('0x6')][_0x80da('0x7')]);}else{return _0x385210(_0x10d5bd[_0x80da('0x8')]);}})['catch'](function(_0x510318){return _0x596d39(_0x510318);});});}exports['getSquareProject']=function(_0x38a349){return request(_0x80da('0x9'),{'options':{'raw':![],'where':{'name':_0x38a349},'attributes':[_0x80da('0xa')]}});};exports['getMailAccountById']=function(_0x279dc1){return request(_0x80da('0xb'),{'options':{'raw':![],'where':{'id':_0x279dc1},'include':[{'model':_0x80da('0xc'),'as':_0x80da('0xd')}],'attributes':['id','name',_0x80da('0xe')]}});};exports['getSquareProjectById']=function(_0x3326b7){return request('ShowSquareProject',{'options':{'where':{'id':_0x3326b7},'attributes':[_0x80da('0xf')]}});};exports[_0x80da('0x10')]=function(_0x1eb4dc){return request(_0x80da('0x11'),{'options':{'where':{'id':_0x1eb4dc},'attributes':[_0x80da('0xf')]}});};exports[_0x80da('0x12')]=function(_0x171f78){return request('ShowVariable',{'options':{'where':{'id':_0x171f78},'attributes':[_0x80da('0xf')]}});};exports[_0x80da('0x13')]=function(_0x5315f3){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x5315f3},'attributes':['dsn']}});};exports['getUserById']=function(_0x4500ee){return request(_0x80da('0x14'),{'options':{'where':{'id':_0x4500ee},'attributes':[_0x80da('0xf')]}});};exports[_0x80da('0x15')]=function(_0x56cb7e){return request(_0x80da('0x16'),{'options':{'where':{'id':_0x56cb7e},'attributes':[_0x80da('0xf')]}});};exports[_0x80da('0x17')]=function(_0x31c89c){return request(_0x80da('0x18'),{'options':{'where':{'id':_0x31c89c},'attributes':[_0x80da('0x19')]}});};exports[_0x80da('0x1a')]=function(_0x1b4b99){return request(_0x80da('0x1b'),{'options':{'raw':![],'where':{'id':_0x1b4b99},'include':[{'model':_0x80da('0x1c'),'as':_0x80da('0x1d')}]}});};exports['getSmsAccountById']=function(_0x119742){return request(_0x80da('0x1e'),{'options':{'where':{'id':_0x119742},'attributes':['id',_0x80da('0xf')]}});};exports[_0x80da('0x1f')]=function(_0x58e3ac){return request(_0x80da('0x20'),{'body':_0x58e3ac});};exports[_0x80da('0x21')]=function(_0x24f189){return request(_0x80da('0x22'),{'body':_0x24f189});};exports['createSquareReport']=function(_0x2229ac){return request(_0x80da('0x23'),{'body':_['merge'](_0x2229ac,{'project_name':_0x2229ac[_0x80da('0x24')],'prev_project_name':_0x2229ac[_0x80da('0x25')]||'','is_subproject':_0x2229ac['arg_2']?!![]:![],'leaveAt':moment()[_0x80da('0x26')](_0x80da('0x27'))})});};exports[_0x80da('0x28')]=function(_0x47c87e){return request(_0x80da('0x29'),{'body':_0x47c87e});};exports[_0x80da('0x2a')]=function(_0x49ed07){return request(_0x80da('0x2b'),{'body':_0x49ed07});};exports[_0x80da('0x2c')]=function(_0x3e07c9){return request(_0x80da('0x2d'),{'options':{'raw':![],'where':{'phone':_0x3e07c9[_0x80da('0x2e')],'ListId':_0x3e07c9[_0x80da('0x2f')]}}})[_0x80da('0x5')](function(_0x52cadb){if(_0x52cadb){return _0x52cadb;}return request(_0x80da('0x30'),{'body':_0x3e07c9});});};exports[_0x80da('0x31')]=function(_0x3559fd){return request(_0x80da('0x32'),{'options':{'where':{'id':_0x3559fd},'attributes':[_0x80da('0xf')]}});};exports['agentLogin']=function(_0xb6f1f4,_0x519418){return request(_0x80da('0x33'),{'body':{'interface':_0x519418},'options':{'where':_0xb6f1f4}});};exports[_0x80da('0x34')]=function(_0x201b69,_0x3121d1,_0x1d1fb9){return request(_0x80da('0x35'),{'body':{'type':_0x3121d1,'uniqueid':_0x1d1fb9},'options':{'where':_0x201b69}});};exports['agentUnpause']=function(_0x1ba593){return request('UnpauseUser',{'body':{},'options':{'where':_0x1ba593}});};exports[_0x80da('0x36')]=function(_0x85b27b){return request('LogoutUser',{'body':{},'options':{'where':_0x85b27b}});}; \ 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 8347fc4..c729fc9 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 _0xe2fe=['./polly'];(function(_0x1f6b14,_0x57183d){var _0x31aca3=function(_0x45566c){while(--_0x45566c){_0x1f6b14['push'](_0x1f6b14['shift']());}};_0x31aca3(++_0x57183d);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};var polly=require(_0xee2f('0x0'));var lex=require('./lex');module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x297f=['./polly','./lex'];(function(_0x164cb4,_0x1d217f){var _0x5e50f8=function(_0x3164cc){while(--_0x3164cc){_0x164cb4['push'](_0x164cb4['shift']());}};_0x5e50f8(++_0x1d217f);}(_0x297f,0x1f0));var _0xf297=function(_0x449668,_0x5bc459){_0x449668=_0x449668-0x0;var _0x394e6f=_0x297f[_0x449668];return _0x394e6f;};var polly=require(_0xf297('0x0'));var lex=require(_0xf297('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 1273693..9b46f14 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var lex=require('./lib/api');module['exports']=function(_0x3d5d4e,_0x33a55d,_0x5527b3,_0x175deb,_0xd002ca,_0x200b2a){return lex(_0x3d5d4e,_0x33a55d,_0x5527b3,_0x175deb,_0xd002ca,_0x200b2a);}; \ No newline at end of file +var _0x668b=['./lib/api','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x668b,0x140));var _0xb668=function(_0x36fbef,_0x4ffc84){_0x36fbef=_0x36fbef-0x0;var _0x45e270=_0x668b[_0x36fbef];return _0x45e270;};'use strict';var lex=require(_0xb668('0x0'));module[_0xb668('0x1')]=function(_0x51555f,_0x15fbea,_0x2c30c1,_0x49a53b,_0x336ba4,_0x5e2e83){return lex(_0x51555f,_0x15fbea,_0x2c30c1,_0x49a53b,_0x336ba4,_0x5e2e83);}; \ 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 2d66689..f444f60 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(_0xe878a9,_0x4a2563){var _0x3bff68=function(_0x1068ba){while(--_0x1068ba){_0xe878a9['push'](_0xe878a9['shift']());}};_0x3bff68(++_0x4a2563);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file +var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x51eace,_0x5788f1){var _0x441082=function(_0x3356bd){while(--_0x3356bd){_0x51eace['push'](_0x51eace['shift']());}};_0x441082(++_0x5788f1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/index.js b/server/services/agi/scripts/aws/polly/index.js index 5a46811..0d8adff 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 _0x1a63=['./lib/api','exports'];(function(_0x3b812b,_0xfae437){var _0x45993d=function(_0x257a2d){while(--_0x257a2d){_0x3b812b['push'](_0x3b812b['shift']());}};_0x45993d(++_0xfae437);}(_0x1a63,0x1a2));var _0x31a6=function(_0x2a8c5c,_0x570e0b){_0x2a8c5c=_0x2a8c5c-0x0;var _0x333591=_0x1a63[_0x2a8c5c];return _0x333591;};'use strict';var polly=require(_0x31a6('0x0'));module[_0x31a6('0x1')]=function(_0x26a12c,_0x182585,_0xf8fc9e,_0x3ef5ec,_0x2326ae,_0x34beba,_0x1049de){return polly(_0x26a12c,_0x182585,_0xf8fc9e,_0x3ef5ec,_0x2326ae,_0x34beba,_0x1049de);}; \ No newline at end of file +var _0xd6a3=['./lib/api','exports'];(function(_0x270940,_0x3bb39f){var _0x3fd506=function(_0x20f203){while(--_0x20f203){_0x270940['push'](_0x270940['shift']());}};_0x3fd506(++_0x3bb39f);}(_0xd6a3,0x106));var _0x3d6a=function(_0x3629fb,_0x4f0632){_0x3629fb=_0x3629fb-0x0;var _0x5c4ee5=_0xd6a3[_0x3629fb];return _0x5c4ee5;};'use strict';var polly=require(_0x3d6a('0x0'));module[_0x3d6a('0x1')]=function(_0xc802ce,_0xa0b77,_0x4b17b9,_0x2b17eb,_0x335efd,_0x845dba,_0x225e8a){return polly(_0xc802ce,_0xa0b77,_0x4b17b9,_0x2b17eb,_0x335efd,_0x845dba,_0x225e8a);}; \ 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 93cabc6..3415285 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 _0x76df=['exports','text','mp3','bluebird','randomstring','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x519376,_0x5f538b){var _0xd413e=function(_0x392331){while(--_0x392331){_0x519376['push'](_0x519376['shift']());}};_0xd413e(++_0x5f538b);}(_0x76df,0x11b));var _0xf76d=function(_0x45385c,_0x840419){_0x45385c=_0x45385c-0x0;var _0x523eb1=_0x76df[_0x45385c];return _0x523eb1;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xf76d('0x0'));var rs=require(_0xf76d('0x1'));var AWS=require('aws-sdk');function pollyResult(_0x398ff5,_0xa65d08,_0x322df8){return new BPromise(function(_0xd53114,_0x7c79ff){_0x398ff5['synthesizeSpeech'](_0xa65d08,function(_0x5e3076,_0x283bcc){if(_0x5e3076){_0x7c79ff(_0x5e3076);}else if(_0x283bcc){if(_0x283bcc['AudioStream']instanceof Buffer){fs[_0xf76d('0x2')](_0x322df8,_0x283bcc[_0xf76d('0x3')],function(_0x23bd40){if(_0x23bd40){_0x7c79ff(_0x23bd40);}else{_0xd53114();}});}else{_0x7c79ff(new Error(_0xf76d('0x4')));}}else{_0x7c79ff(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0xf76d('0x5')]=function(_0x32a3dd,_0x4506eb,_0x3dd2e0,_0x2b1f54,_0x31aae2,_0x40f0d6,_0xf1f95b){var _0x295e4d=new AWS['Polly']({'accessKeyId':_0x32a3dd,'secretAccessKey':_0x4506eb,'region':_0x3dd2e0});var _0x15b8d2={'Text':_0x31aae2,'TextType':_0x40f0d6||_0xf76d('0x6'),'OutputFormat':_0xf76d('0x7'),'VoiceId':_0x2b1f54};return pollyResult(_0x295e4d,_0x15b8d2,_0xf1f95b);}; \ No newline at end of file +var _0x3e9c=['text','mp3','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly'];(function(_0x4a0e68,_0x45c08c){var _0x4fb274=function(_0x5f36b1){while(--_0x5f36b1){_0x4a0e68['push'](_0x4a0e68['shift']());}};_0x4fb274(++_0x45c08c);}(_0x3e9c,0x1a4));var _0xc3e9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3e9c[_0x20a584];return _0x4b41a8;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xc3e9('0x0'));var rs=require(_0xc3e9('0x1'));var AWS=require(_0xc3e9('0x2'));function pollyResult(_0x5f2c1e,_0x2cde08,_0x2c8144){return new BPromise(function(_0xd72263,_0xc94a4a){_0x5f2c1e[_0xc3e9('0x3')](_0x2cde08,function(_0x2f165d,_0x35c38a){if(_0x2f165d){_0xc94a4a(_0x2f165d);}else if(_0x35c38a){if(_0x35c38a[_0xc3e9('0x4')]instanceof Buffer){fs[_0xc3e9('0x5')](_0x2c8144,_0x35c38a['AudioStream'],function(_0x290606){if(_0x290606){_0xc94a4a(_0x290606);}else{_0xd72263();}});}else{_0xc94a4a(new Error(_0xc3e9('0x6')));}}else{_0xc94a4a(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0xc3e9('0x7')]=function(_0x315fac,_0x5dc5ab,_0x462a3a,_0x3efcd9,_0x36dd42,_0x1378cb,_0x243b29){var _0x2aa455=new AWS[(_0xc3e9('0x8'))]({'accessKeyId':_0x315fac,'secretAccessKey':_0x5dc5ab,'region':_0x462a3a});var _0x31a9b2={'Text':_0x36dd42,'TextType':_0x1378cb||_0xc3e9('0x9'),'OutputFormat':_0xc3e9('0xa'),'VoiceId':_0x3efcd9};return pollyResult(_0x2aa455,_0x31a9b2,_0x243b29);}; \ 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 798e6a4..30ee638 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 _0x3dc1=['./lib/api'];(function(_0x4a8e2e,_0x2dab17){var _0x419372=function(_0x1bba3f){while(--_0x1bba3f){_0x4a8e2e['push'](_0x4a8e2e['shift']());}};_0x419372(++_0x2dab17);}(_0x3dc1,0x1d5));var _0x13dc=function(_0x2ee869,_0x1817bf){_0x2ee869=_0x2ee869-0x0;var _0x3c76c2=_0x3dc1[_0x2ee869];return _0x3c76c2;};'use strict';var asr=require(_0x13dc('0x0'));module['exports']=function(_0x478c80,_0x4480d4,_0x2384bc,_0x1b8f07){return asr(_0x478c80,_0x4480d4,_0x2384bc);}; \ No newline at end of file +var _0xdd8a=['./lib/api','exports'];(function(_0x227b67,_0x5c4075){var _0x16f616=function(_0x46e857){while(--_0x46e857){_0x227b67['push'](_0x227b67['shift']());}};_0x16f616(++_0x5c4075);}(_0xdd8a,0x148));var _0xadd8=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0xdd8a[_0x424a9a];return _0xa7831c;};'use strict';var asr=require(_0xadd8('0x0'));module[_0xadd8('0x1')]=function(_0x166f5a,_0xeb004f,_0x3b4823,_0x42caa6){return asr(_0x166f5a,_0xeb004f,_0x3b4823);}; \ 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 2645b5c..587bac7 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 _0x16d2=['lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','LINEAR16','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined'];(function(_0x375a25,_0x21acb3){var _0x426e40=function(_0x2c50f4){while(--_0x2c50f4){_0x375a25['push'](_0x375a25['shift']());}};_0x426e40(++_0x21acb3);}(_0x16d2,0x123));var _0x216d=function(_0x486eff,_0x5cb3b0){_0x486eff=_0x486eff-0x0;var _0x95293b=_0x16d2[_0x486eff];return _0x95293b;};'use strict';var url=require(_0x216d('0x0'));var BPromise=require(_0x216d('0x1'));var fs=require('fs');var host=_0x216d('0x2');module[_0x216d('0x3')]=function(_0x1688cc,_0x3a2589,_0x34cf5b){return new BPromise(function(_0x239b49,_0xfd7306){var _0x593bb0;if(typeof _0x1688cc!==_0x216d('0x4')||_0x1688cc[_0x216d('0x5')]===0x0){return _0xfd7306(_0x216d('0x6'));}if(typeof _0x3a2589!==_0x216d('0x4')||_0x3a2589[_0x216d('0x5')]===0x0){return _0xfd7306(_0x216d('0x7'));}if(typeof _0x34cf5b!==_0x216d('0x8')&&(typeof _0x34cf5b!==_0x216d('0x4')||_0x34cf5b['length']===0x0)){return _0xfd7306(_0x216d('0x9'));}try{_0x593bb0=fs[_0x216d('0xa')](_0x1688cc)[_0x216d('0xb')](_0x216d('0xc'));}catch(_0x301058){return _0xfd7306(_0x301058);}return _0x239b49({'method':_0x216d('0xd'),'uri':host+'/v1/speech:recognize?key='+_0x3a2589,'body':{'config':{'encoding':_0x216d('0xe'),'sampleRateHertz':'8000','languageCode':_0x34cf5b},'audio':{'content':_0x593bb0}},'json':!![]});});}; \ No newline at end of file +var _0x630e=['LINEAR16','8000','url','https://speech.googleapis.com','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','readFileSync','toString','base64','/v1/speech:recognize?key='];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x630e,0x1af));var _0xe630=function(_0x251b26,_0x1fb546){_0x251b26=_0x251b26-0x0;var _0xc9f6f6=_0x630e[_0x251b26];return _0xc9f6f6;};'use strict';var url=require(_0xe630('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0xe630('0x1');module['exports']=function(_0x559334,_0x36902e,_0x143cb6){return new BPromise(function(_0x12449c,_0x5c5606){var _0x2f3a0f;if(typeof _0x559334!==_0xe630('0x2')||_0x559334[_0xe630('0x3')]===0x0){return _0x5c5606(_0xe630('0x4'));}if(typeof _0x36902e!==_0xe630('0x2')||_0x36902e['length']===0x0){return _0x5c5606(_0xe630('0x5'));}if(typeof _0x143cb6!==_0xe630('0x6')&&(typeof _0x143cb6!=='string'||_0x143cb6[_0xe630('0x3')]===0x0)){return _0x5c5606('lang\x20should\x20be\x20a\x20string');}try{_0x2f3a0f=fs[_0xe630('0x7')](_0x559334)[_0xe630('0x8')](_0xe630('0x9'));}catch(_0x5a3a70){return _0x5c5606(_0x5a3a70);}return _0x12449c({'method':'POST','uri':host+_0xe630('0xa')+_0x36902e,'body':{'config':{'encoding':_0xe630('0xb'),'sampleRateHertz':_0xe630('0xc'),'languageCode':_0x143cb6},'audio':{'content':_0x2f3a0f}},'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 60c1ebb..20faf13 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 _0xbb7a=['exports'];(function(_0xb6a0a9,_0x5c50e4){var _0x3ade14=function(_0x45b3b9){while(--_0x45b3b9){_0xb6a0a9['push'](_0xb6a0a9['shift']());}};_0x3ade14(++_0x5c50e4);}(_0xbb7a,0x1d8));var _0xabb7=function(_0x16e242,_0x458eb0){_0x16e242=_0x16e242-0x0;var _0x4fc8b1=_0xbb7a[_0x16e242];return _0x4fc8b1;};var asr=require('./asr');module[_0xabb7('0x0')]={'asr':asr}; \ No newline at end of file +var _0x59b5=['./asr'];(function(_0x55a8f4,_0xcd4a90){var _0x355404=function(_0x63be10){while(--_0x63be10){_0x55a8f4['push'](_0x55a8f4['shift']());}};_0x355404(++_0xcd4a90);}(_0x59b5,0xbb));var _0x559b=function(_0x4b57f5,_0x37a1cf){_0x4b57f5=_0x4b57f5-0x0;var _0x2aeb88=_0x59b5[_0x4b57f5];return _0x2aeb88;};var asr=require(_0x559b('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 522f6c3..396eb5f 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 _0x7770=['dialogflow','http','https','md5','path','querystring','sox','google-tts-api','parse','./aws','./google','./sestek','./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','info','finish\x20download\x20file','close','unlink','download\x20error','end','data','transcode','wav','start','resolve','tmp','generate','.wav','writeFileSync','then','chmodSync','777','split','readFileSync','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','from','audioContent','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','jQ1olc','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','name','message','googleDialogflow','textRequest','source','result','resolvedQuery','action','fulfillment','speech','score','status','code','metadata','endConversation','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','tildeASR','asr','Tilde\x20ASR\x20confidence','awsPolly','polly','lex','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','format','model=%s','freeform=3','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird'];(function(_0x32a8b8,_0x2e2a58){var _0x38d0c4=function(_0xad321d){while(--_0xad321d){_0x32a8b8['push'](_0x32a8b8['shift']());}};_0x38d0c4(++_0x2e2a58);}(_0x7770,0x10c));var _0x0777=function(_0x56326f,_0x10a9e0){_0x56326f=_0x56326f-0x0;var _0x4edad8=_0x7770[_0x56326f];return _0x4edad8;};'use strict';var apiai=require(_0x0777('0x0'));var BPromise=require(_0x0777('0x1'));var dialogflow=require(_0x0777('0x2'));var fs=require('fs');var http=require(_0x0777('0x3'));var https=require(_0x0777('0x4'));var md5=require(_0x0777('0x5'));var path=require(_0x0777('0x6'));var querystring=require(_0x0777('0x7'));var rp=require('request-promise');var rs=require('randomstring');var sox=require(_0x0777('0x8'));var tts=require(_0x0777('0x9'));var urlParse=require('url')[_0x0777('0xa')];var util=require('util');var aws=require(_0x0777('0xb'));var google=require(_0x0777('0xc'));var sestek=require(_0x0777('0xd'));var tilde=require(_0x0777('0xe'));var logger=require(_0x0777('0xf'))(_0x0777('0x10'));var ISPEECH_API=_0x0777('0x11');function downloadFile(_0x38672d,_0x5eebe6){return new BPromise(function(_0x5e4f49,_0x4a36d1){var _0xb9ff25=urlParse(_0x38672d);var _0x58afe0=_0xb9ff25[_0x0777('0x12')]===_0x0777('0x13')?https:http;var _0x43a602={'host':_0xb9ff25[_0x0777('0x14')],'path':_0xb9ff25[_0x0777('0x6')],'headers':{'user-agent':_0x0777('0x15')}};_0x58afe0[_0x0777('0x16')](_0x43a602,function(_0x34b56a){if(_0x34b56a[_0x0777('0x17')]!==0xc8){logger[_0x0777('0x18')](_0x0777('0x19')+_0x38672d+_0x0777('0x1a')+_0x34b56a[_0x0777('0x17')]+'\x20('+_0x34b56a['statusMessage']+')');_0x4a36d1(new Error(_0x0777('0x19')+_0x38672d+_0x0777('0x1a')+_0x34b56a['statusCode']+'\x20('+_0x34b56a[_0x0777('0x1b')]+')'));return;}var _0x6e8d54=fs[_0x0777('0x1c')](_0x5eebe6);_0x6e8d54['on'](_0x0777('0x1d'),function(){logger[_0x0777('0x1e')](_0x0777('0x1f'));_0x6e8d54[_0x0777('0x20')](_0x5e4f49);});_0x6e8d54['on'](_0x0777('0x18'),function(_0x55ab00){fs[_0x0777('0x21')](_0x5eebe6);logger[_0x0777('0x18')](_0x0777('0x22'),_0x55ab00);_0x4a36d1(_0x55ab00);});_0x34b56a['pipe'](_0x6e8d54);})['on'](_0x0777('0x18'),function(_0x35db95){logger[_0x0777('0x18')](_0x35db95);_0x4a36d1(_0x35db95);})[_0x0777('0x23')]();});}function uploadFile(_0x54c9ac){return new BPromise(function(_0x2edcf8,_0x51d333){var _0x33a3fc=urlParse(_0x54c9ac);var _0x419bce=_0x33a3fc[_0x0777('0x12')]===_0x0777('0x13')?https:http;var _0x24ee18={'host':_0x33a3fc[_0x0777('0x14')],'path':_0x33a3fc['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x419bce[_0x0777('0x16')](_0x24ee18,function(_0x142096){if(_0x142096[_0x0777('0x17')]!==0xc8){_0x51d333(new Error(_0x0777('0x19')+_0x54c9ac+'\x20failed,\x20status\x20code\x20=\x20'+_0x142096[_0x0777('0x17')]+'\x20('+_0x142096['statusMessage']+')'));return;}var _0x2ed1dc='';_0x142096['on'](_0x0777('0x24'),function(_0x9a8fa4){_0x2ed1dc+=_0x9a8fa4;});_0x142096['on']('end',function(){_0x2edcf8(_0x2ed1dc);});})['on']('error',function(_0x3393c0){_0x51d333(_0x3393c0);})['end']();});}function convertFile(_0x1d8ea1,_0x22c117){return new BPromise(function(_0x197a43,_0x30d40b){var _0x36813e=sox[_0x0777('0x25')](_0x1d8ea1,_0x22c117,{'sampleRate':0x1f40,'format':_0x0777('0x26'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x36813e['on']('error',function(_0x21ba25){logger[_0x0777('0x18')]('error\x20convert',_0x21ba25);_0x30d40b(_0x21ba25);});_0x36813e['on']('end',function(){logger[_0x0777('0x1e')]('finish\x20to\x20convert');_0x197a43();});_0x36813e[_0x0777('0x27')]();});}function base64Decode(_0x4930cb,_0x12309a){var _0x302191=path[_0x0777('0x28')](__dirname,_0x0777('0x29'),rs[_0x0777('0x2a')](0x4)+_0x0777('0x2b'));fs[_0x0777('0x2c')](_0x302191,_0x4930cb,'base64');return convertFile(_0x302191,_0x12309a)[_0x0777('0x2d')](function(){try{fs[_0x0777('0x21')](_0x302191);fs[_0x0777('0x2e')](_0x12309a,_0x0777('0x2f'));}catch(_0x194306){logger[_0x0777('0x18')](_0x194306);}return _0x12309a[_0x0777('0x30')]('.')[0x0];});}function base64Encode(_0x3c93c8){var _0x393600=fs[_0x0777('0x31')](_0x3c93c8);return new Buffer(_0x393600)['toString'](_0x0777('0x32'));}exports[_0x0777('0x33')]=function(_0x335c71,_0x130cf0,_0x488a3b,_0x3d09b3,_0x63078f,_0xbade92){var _0xabed5a,_0x2dcf7a;var _0xfff037=_0x0777('0x34');var _0x14a8ec=_0x0777('0x35')+_0x335c71;var _0x4a8c0c={};if(_0x130cf0===_0x0777('0x36')){_0x4a8c0c['input']={'ssml':_0x488a3b};}else{_0x4a8c0c[_0x0777('0x37')]={'text':_0x488a3b};};_0x4a8c0c[_0x0777('0x38')]={'languageCode':_0x3d09b3,'ssmlGender':_0x63078f};_0x4a8c0c[_0x0777('0x39')]={'audioEncoding':_0x0777('0x3a'),'sampleRateHertz':0x1f40};var _0x469063={'url':_0xfff037+_0x0777('0x3b')+_0x14a8ec,'method':_0x0777('0x3c'),'json':!![],'body':_0x4a8c0c};return rp(_0x469063)['then'](function(_0x13c462){return new BPromise(function(_0x26f8aa,_0x593995){_0xabed5a=path[_0x0777('0x28')](__dirname,_0x0777('0x29'),rs[_0x0777('0x2a')](0x4)+_0x0777('0x3d'));var _0x23f517=Buffer[_0x0777('0x3e')](_0x13c462[_0x0777('0x3f')],_0x0777('0x32'));return fs['writeFile'](_0xabed5a,_0x23f517,function(_0x2fae25){_0x593995(_0x2fae25);},function(_0x2cdc21){fs[_0x0777('0x2e')](_0xabed5a,'777');_0x26f8aa(_0x2cdc21);});});})[_0x0777('0x2d')](function(_0x9484c4){_0x2dcf7a=path[_0x0777('0x28')](__dirname,_0x0777('0x29'),rs[_0x0777('0x2a')](0x4)+'.wav');return convertFile(_0xabed5a,_0x2dcf7a);})[_0x0777('0x2d')](function(){try{fs[_0x0777('0x21')](_0xabed5a);fs[_0x0777('0x2e')](_0x2dcf7a,_0x0777('0x2f'));}catch(_0x461b7a){logger[_0x0777('0x18')](_0x461b7a);}logger[_0x0777('0x1e')](_0x0777('0x40'),_0x2dcf7a[_0x0777('0x30')]('.')[0x0]);return _0x2dcf7a[_0x0777('0x30')]('.')[0x0];});};exports['googleTTS']=function(_0x1dfced,_0x34aca8){var _0x53b00a=_0x0777('0x41');var _0x4ad0bf,_0x1ea08d;var _0x5f17d4;var _0x922503={'encoding':_0x0777('0x42'),'method':'POST','timeout':0x2710,'url':_0x53b00a,'headers':{'Content-Type':_0x0777('0x43')},'body':_0x0777('0x44')+encodeURIComponent(JSON['stringify']([[[_0x0777('0x45'),JSON[_0x0777('0x46')]([_0x1dfced,_0x34aca8||'en',![],_0x0777('0x47')]),null,_0x0777('0x48')]]]))};return rp(_0x922503)[_0x0777('0x2d')](function(_0x38fc67){try{_0x5f17d4=eval(_0x38fc67[_0x0777('0x49')](0x5))[0x0][0x2];}catch(_0x187219){throw new Error(_0x0777('0x4a')+_0x38fc67['data']);}if(!_0x5f17d4){if(_0x1dfced[_0x0777('0x4b')]>0xc8){throw new Error(_0x0777('0x4c'));}else{throw new Error(_0x0777('0x4d')+_0x34aca8+_0x0777('0x4e'));}}try{_0x5f17d4=eval(_0x5f17d4)[0x0];}catch(_0x3725cb){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x0777('0x24')]);}const _0x856e03=_0x5f17d4;_0x4ad0bf=path['resolve'](__dirname,_0x0777('0x29'),rs[_0x0777('0x2a')](0x4)+_0x0777('0x3d'));fs[_0x0777('0x2c')](_0x4ad0bf,_0x5f17d4,{'encoding':_0x0777('0x32')});_0x1ea08d=path[_0x0777('0x28')](__dirname,_0x0777('0x29'),rs[_0x0777('0x2a')](0x4)+_0x0777('0x2b'));return convertFile(_0x4ad0bf,_0x1ea08d);})[_0x0777('0x2d')](function(){try{fs['unlink'](_0x4ad0bf);fs[_0x0777('0x2e')](_0x1ea08d,_0x0777('0x2f'));}catch(_0x30da8f){logger['error'](_0x30da8f);}logger['info'](_0x0777('0x4f'),_0x1ea08d[_0x0777('0x30')]('.')[0x0]);return _0x1ea08d['split']('.')[0x0];});};exports['googleASR']=function(_0x385687,_0x4d2262,_0x99c2e0){return google['asr'](_0x385687,_0x4d2262,_0x99c2e0)[_0x0777('0x2d')](function(_0x51e310){logger[_0x0777('0x1e')](_0x51e310[_0x0777('0x50')]);return rp(_0x51e310);})[_0x0777('0x2d')](function(_0x105876){var _0x59bb2c='';var _0x1deb2c=0x0;try{fs[_0x0777('0x21')](_0x385687);}catch(_0x18a9c6){logger['error'](_0x18a9c6);}if(_0x105876&&_0x105876['results']){_0x59bb2c=_0x105876[_0x0777('0x51')][_0x0777('0x52')](function(_0x32c0a8){return _0x32c0a8&&_0x32c0a8['alternatives'][0x0]&&_0x32c0a8[_0x0777('0x53')][0x0]['transcript']?_0x32c0a8[_0x0777('0x53')][0x0][_0x0777('0x54')]:'';})[_0x0777('0x55')]('\x0a');_0x1deb2c=_0x105876[_0x0777('0x51')][_0x0777('0x52')](function(_0x98b235){return _0x98b235&&_0x98b235['alternatives'][0x0]&&_0x98b235[_0x0777('0x53')][0x0][_0x0777('0x56')]?_0x98b235[_0x0777('0x53')][0x0][_0x0777('0x56')]:0x0;})[_0x0777('0x55')]('\x0a');}logger[_0x0777('0x1e')]('googleASR\x20transcription',_0x59bb2c);logger[_0x0777('0x1e')](_0x0777('0x57'),_0x1deb2c);return{'transcript':_0x59bb2c,'confidence':_0x1deb2c};})[_0x0777('0x58')](function(_0x10b68c){logger[_0x0777('0x18')]('[%s]\x20%s:%s',_0x10b68c[_0x0777('0x17')],_0x10b68c[_0x0777('0x59')],_0x10b68c[_0x0777('0x5a')]);});};exports[_0x0777('0x5b')]=function(_0x478c36,_0x8e0b22,_0x20a408,_0x271c1b){var _0x93e0ae=apiai(_0x8e0b22,{'language':_0x271c1b||'en'});return _0x93e0ae[_0x0777('0x5c')](_0x20a408,{'sessionId':md5(_0x478c36)})[_0x0777('0x2d')](function(_0x2ace9f){logger[_0x0777('0x1e')](JSON[_0x0777('0x46')](_0x2ace9f));return{'source':_0x2ace9f['result'][_0x0777('0x5d')],'resolvedQuery':_0x2ace9f[_0x0777('0x5e')][_0x0777('0x5f')],'action':_0x2ace9f[_0x0777('0x5e')][_0x0777('0x60')],'actionIncomplete':_0x2ace9f[_0x0777('0x5e')]['actionIncomplete'],'speech':_0x2ace9f[_0x0777('0x5e')][_0x0777('0x61')][_0x0777('0x62')],'score':_0x2ace9f[_0x0777('0x5e')][_0x0777('0x63')],'statusCode':_0x2ace9f[_0x0777('0x64')][_0x0777('0x65')],'endConversation':_0x2ace9f[_0x0777('0x5e')][_0x0777('0x66')][_0x0777('0x67')]||![],'isFallbackIntent':_0x2ace9f[_0x0777('0x5e')][_0x0777('0x66')]['isFallbackIntent']};});};exports['googleDialogflowV2']=function(_0x1827f4,_0x1ceb2d,_0x11af41,_0x150196,_0x5bdb2a,_0x56f8da){var _0x5b2c92=_0x150196['replace'](/\\n/g,'\x0a');var _0x259968={'credentials':{'private_key':_0x5b2c92,'client_email':_0x11af41}};var _0x292018=new dialogflow[(_0x0777('0x68'))](_0x259968);var _0x3dc5cd=_0x292018[_0x0777('0x69')](_0x1ceb2d,md5(_0x1827f4));var _0x1672bb={'session':_0x3dc5cd,'queryInput':{'text':{'text':_0x5bdb2a,'languageCode':_0x56f8da}}};return _0x292018['detectIntent'](_0x1672bb)['then'](function(_0x428aad){if(_0x428aad&&_0x428aad['length']){logger[_0x0777('0x1e')](_0x0777('0x6a'),JSON[_0x0777('0x46')](_0x428aad));var _0x26a76b=_0x428aad[0x0];if(_0x26a76b){var _0x16eed0={'action':_0x26a76b[_0x0777('0x6b')][_0x0777('0x60')],'allRequiredParamsPresent':_0x26a76b[_0x0777('0x6b')]['allRequiredParamsPresent'],'endConversation':_0x26a76b[_0x0777('0x6b')][_0x0777('0x6c')]&&_0x26a76b[_0x0777('0x6b')][_0x0777('0x6c')][_0x0777('0x6d')]?_0x26a76b['queryResult'][_0x0777('0x6c')][_0x0777('0x6d')]['end_conversation'][_0x0777('0x6e')]:![],'fulfillmentText':_0x26a76b['queryResult'][_0x0777('0x6f')],'intentName':_0x26a76b[_0x0777('0x6b')][_0x0777('0x70')][_0x0777('0x59')],'intentDisplayName':_0x26a76b[_0x0777('0x6b')]['intent'][_0x0777('0x71')],'isFallbackIntent':_0x26a76b[_0x0777('0x6b')][_0x0777('0x70')][_0x0777('0x72')],'languageCode':_0x26a76b['queryResult'][_0x0777('0x73')],'queryText':_0x26a76b['queryResult'][_0x0777('0x74')],'responseId':_0x26a76b['responseId'],'score':_0x26a76b[_0x0777('0x6b')]['intentDetectionConfidence'],'speech':_0x26a76b[_0x0777('0x6b')][_0x0777('0x6f')],'providerResponse':JSON[_0x0777('0x46')](_0x428aad)};return _0x16eed0;}}});};exports[_0x0777('0x75')]=function(_0x224cbc,_0x599b0f,_0x48ede7,_0x5212fa){return tilde[_0x0777('0x76')](_0x224cbc,_0x599b0f,_0x48ede7,_0x5212fa)[_0x0777('0x2d')](function(_0x5ed4ad){try{fs[_0x0777('0x21')](_0x224cbc);}catch(_0x271815){logger[_0x0777('0x18')](_0x271815);}logger[_0x0777('0x1e')]('Tilde\x20ASR\x20transcription',_0x5ed4ad[_0x0777('0x54')]);logger['info'](_0x0777('0x77'),_0x5ed4ad[_0x0777('0x56')]);return _0x5ed4ad;});};exports[_0x0777('0x78')]=function(_0x3f9631,_0x22c54b,_0x1b7344,_0x2b7d1a,_0x2f5f45,_0x446b86){var _0x5d822e=path[_0x0777('0x28')](__dirname,'tmp',rs[_0x0777('0x2a')](0x4)+_0x0777('0x3d'));var _0x15d640;return aws[_0x0777('0x79')](_0x3f9631,_0x22c54b,_0x1b7344,_0x2b7d1a,_0x2f5f45,_0x446b86,_0x5d822e)['then'](function(){_0x15d640=path[_0x0777('0x28')](__dirname,'tmp',rs[_0x0777('0x2a')](0x4)+_0x0777('0x2b'));return convertFile(_0x5d822e,_0x15d640);})[_0x0777('0x2d')](function(){try{fs['unlink'](_0x5d822e);fs[_0x0777('0x2e')](_0x15d640,_0x0777('0x2f'));}catch(_0x11116d){logger[_0x0777('0x18')](_0x11116d);}return _0x15d640[_0x0777('0x30')]('.')[0x0];});};exports['awsLex']=function(_0x4b7dc3,_0x223368,_0x72cb3a,_0x3cd646,_0x4bb934,_0x5f4ba1){return aws[_0x0777('0x7a')](_0x4b7dc3,_0x223368,_0x72cb3a,_0x3cd646,_0x4bb934,_0x5f4ba1)['then'](function(_0x519c21){logger[_0x0777('0x1e')](JSON['stringify'](_0x519c21));return _0x519c21;});};exports['ispeechTTS']=function(_0x2f5f2f,_0x3e9d8b,_0x193164,_0x38b879){var _0x43805e=util['format'](_0x0777('0x7b'),ISPEECH_API,_0x2f5f2f,encodeURIComponent(_0x3e9d8b),_0x193164,_0x38b879);var _0x1c25dc=path['resolve'](__dirname,'tmp',rs[_0x0777('0x2a')](0x4)+_0x0777('0x3d'));var _0x7f1bb0;return downloadFile(_0x43805e,_0x1c25dc)['then'](function(){_0x7f1bb0=path[_0x0777('0x28')](__dirname,_0x0777('0x29'),rs[_0x0777('0x2a')](0x4)+_0x0777('0x2b'));return convertFile(_0x1c25dc,_0x7f1bb0);})['then'](function(){try{fs[_0x0777('0x21')](_0x1c25dc);fs[_0x0777('0x2e')](_0x7f1bb0,_0x0777('0x2f'));}catch(_0xd8d41c){logger['error'](_0xd8d41c);}return _0x7f1bb0[_0x0777('0x30')]('.')[0x0];});};exports['ispeechASR']=function(_0x28ff6,_0x4a5827,_0x3ad317,_0x1d34fd){var _0x5372fa=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x4a5827,_0x3ad317,base64Encode(_0x28ff6),_0x1d34fd?util[_0x0777('0x7c')](_0x0777('0x7d'),encodeURIComponent(_0x1d34fd)):_0x0777('0x7e'));return uploadFile(_0x5372fa)[_0x0777('0x2d')](function(_0x6491a5){return querystring['parse'](_0x6491a5);});};exports['sestekNDA']=function(_0x286e76,_0x4c2fdc){return sestek[_0x0777('0x7f')](_0x286e76,_0x4c2fdc)[_0x0777('0x2d')](function(_0x30c0c2){logger['info'](JSON[_0x0777('0x46')](_0x30c0c2));var _0x2e63e4={'speech':_0x30c0c2['text'],'action':_0x30c0c2['channelData']?_0x30c0c2[_0x0777('0x80')][_0x0777('0x81')]:undefined,'actiondata':_0x30c0c2['channelData']?_0x30c0c2[_0x0777('0x80')][_0x0777('0x82')]:undefined};if(_0x30c0c2[_0x0777('0x80')]&&_0x30c0c2[_0x0777('0x80')][_0x0777('0x83')]){return base64Decode(_0x30c0c2[_0x0777('0x80')][_0x0777('0x83')][_0x0777('0x84')],path[_0x0777('0x28')](__dirname,_0x0777('0x29'),rs[_0x0777('0x2a')](0x4)+_0x0777('0x2b')))[_0x0777('0x2d')](function(_0x479c6d){_0x2e63e4[_0x0777('0x85')]=_0x479c6d;return _0x2e63e4;});}return _0x2e63e4;});};exports[_0x0777('0x86')]=function(){return __dirname;}; \ No newline at end of file +var _0x452c=['https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','jQ1olc','stringify','null','generic','then','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','actionIncomplete','fulfillment','speech','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','sessionPath','Dialogflow\x20V2\x20response:','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','languageCode','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','model=%s','freeform=3','parse','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','apiai-promise','bluebird','dialogflow','http','md5','path','request-promise','randomstring','google-tts-api','url','util','./aws','./google','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','unlink','download\x20error','pipe','end','data','error\x20convert','finish\x20to\x20convert','start','resolve','generate','.wav','writeFileSync','base64','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','POST','tmp','.mp3','audioContent','writeFile','googleCloudTTS\x20path','googleTTS'];(function(_0x26a74d,_0x37ecfc){var _0xcbb1a3=function(_0x24b978){while(--_0x24b978){_0x26a74d['push'](_0x26a74d['shift']());}};_0xcbb1a3(++_0x37ecfc);}(_0x452c,0xd9));var _0xc452=function(_0x43b5f9,_0x1ef336){_0x43b5f9=_0x43b5f9-0x0;var _0x547fca=_0x452c[_0x43b5f9];return _0x547fca;};'use strict';var apiai=require(_0xc452('0x0'));var BPromise=require(_0xc452('0x1'));var dialogflow=require(_0xc452('0x2'));var fs=require('fs');var http=require(_0xc452('0x3'));var https=require('https');var md5=require(_0xc452('0x4'));var path=require(_0xc452('0x5'));var querystring=require('querystring');var rp=require(_0xc452('0x6'));var rs=require(_0xc452('0x7'));var sox=require('sox');var tts=require(_0xc452('0x8'));var urlParse=require(_0xc452('0x9'))['parse'];var util=require(_0xc452('0xa'));var aws=require(_0xc452('0xb'));var google=require(_0xc452('0xc'));var sestek=require('./sestek');var tilde=require('./tilde');var logger=require(_0xc452('0xd'))(_0xc452('0xe'));var ISPEECH_API=_0xc452('0xf');function downloadFile(_0x4be7b7,_0x98de12){return new BPromise(function(_0x1aaeaa,_0x35a17f){var _0xe91c98=urlParse(_0x4be7b7);var _0x1c3082=_0xe91c98[_0xc452('0x10')]===_0xc452('0x11')?https:http;var _0x20a1dd={'host':_0xe91c98[_0xc452('0x12')],'path':_0xe91c98[_0xc452('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0x1c3082[_0xc452('0x13')](_0x20a1dd,function(_0x34b0a9){if(_0x34b0a9[_0xc452('0x14')]!==0xc8){logger[_0xc452('0x15')](_0xc452('0x16')+_0x4be7b7+'\x20failed,\x20status\x20code\x20=\x20'+_0x34b0a9['statusCode']+'\x20('+_0x34b0a9['statusMessage']+')');_0x35a17f(new Error(_0xc452('0x16')+_0x4be7b7+_0xc452('0x17')+_0x34b0a9[_0xc452('0x14')]+'\x20('+_0x34b0a9[_0xc452('0x18')]+')'));return;}var _0x47ac82=fs['createWriteStream'](_0x98de12);_0x47ac82['on'](_0xc452('0x19'),function(){logger[_0xc452('0x1a')]('finish\x20download\x20file');_0x47ac82['close'](_0x1aaeaa);});_0x47ac82['on'](_0xc452('0x15'),function(_0x2080ee){fs[_0xc452('0x1b')](_0x98de12);logger[_0xc452('0x15')](_0xc452('0x1c'),_0x2080ee);_0x35a17f(_0x2080ee);});_0x34b0a9[_0xc452('0x1d')](_0x47ac82);})['on']('error',function(_0x325b6d){logger[_0xc452('0x15')](_0x325b6d);_0x35a17f(_0x325b6d);})[_0xc452('0x1e')]();});}function uploadFile(_0x3ecb88){return new BPromise(function(_0x3777c7,_0x3d9c5c){var _0x29de9f=urlParse(_0x3ecb88);var _0x47dd9e=_0x29de9f[_0xc452('0x10')]==='https:'?https:http;var _0xcc9b7b={'host':_0x29de9f['host'],'path':_0x29de9f['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x47dd9e[_0xc452('0x13')](_0xcc9b7b,function(_0x57eb60){if(_0x57eb60[_0xc452('0x14')]!==0xc8){_0x3d9c5c(new Error(_0xc452('0x16')+_0x3ecb88+_0xc452('0x17')+_0x57eb60[_0xc452('0x14')]+'\x20('+_0x57eb60[_0xc452('0x18')]+')'));return;}var _0x51d00d='';_0x57eb60['on'](_0xc452('0x1f'),function(_0x1258f4){_0x51d00d+=_0x1258f4;});_0x57eb60['on'](_0xc452('0x1e'),function(){_0x3777c7(_0x51d00d);});})['on'](_0xc452('0x15'),function(_0x7079a2){_0x3d9c5c(_0x7079a2);})[_0xc452('0x1e')]();});}function convertFile(_0x4f5b8e,_0x4f6beb){return new BPromise(function(_0x3dfb0b,_0x369d7d){var _0x5121fc=sox['transcode'](_0x4f5b8e,_0x4f6beb,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5121fc['on'](_0xc452('0x15'),function(_0x275ed7){logger[_0xc452('0x15')](_0xc452('0x20'),_0x275ed7);_0x369d7d(_0x275ed7);});_0x5121fc['on'](_0xc452('0x1e'),function(){logger['info'](_0xc452('0x21'));_0x3dfb0b();});_0x5121fc[_0xc452('0x22')]();});}function base64Decode(_0x9ebea8,_0x546851){var _0x5d0ede=path[_0xc452('0x23')](__dirname,'tmp',rs[_0xc452('0x24')](0x4)+_0xc452('0x25'));fs[_0xc452('0x26')](_0x5d0ede,_0x9ebea8,_0xc452('0x27'));return convertFile(_0x5d0ede,_0x546851)['then'](function(){try{fs[_0xc452('0x1b')](_0x5d0ede);fs[_0xc452('0x28')](_0x546851,_0xc452('0x29'));}catch(_0x5f38bb){logger[_0xc452('0x15')](_0x5f38bb);}return _0x546851[_0xc452('0x2a')]('.')[0x0];});}function base64Encode(_0x32bd9a){var _0x2628d2=fs[_0xc452('0x2b')](_0x32bd9a);return new Buffer(_0x2628d2)[_0xc452('0x2c')](_0xc452('0x27'));}exports[_0xc452('0x2d')]=function(_0x26e180,_0x5b8008,_0x5f6ce3,_0x2e23fc,_0x788b9d,_0x3c029e){var _0x2da5a2,_0x2963f5;var _0x27930e=_0xc452('0x2e');var _0x4aad6a=_0xc452('0x2f')+_0x26e180;var _0xfde09f={};if(_0x5b8008===_0xc452('0x30')){_0xfde09f['input']={'ssml':_0x5f6ce3};}else{_0xfde09f[_0xc452('0x31')]={'text':_0x5f6ce3};};_0xfde09f[_0xc452('0x32')]={'languageCode':_0x2e23fc,'ssmlGender':_0x788b9d};_0xfde09f[_0xc452('0x33')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x1d5860={'url':_0x27930e+'text:synthesize'+_0x4aad6a,'method':_0xc452('0x34'),'json':!![],'body':_0xfde09f};return rp(_0x1d5860)['then'](function(_0x342684){return new BPromise(function(_0x335ca7,_0x2350eb){_0x2da5a2=path[_0xc452('0x23')](__dirname,_0xc452('0x35'),rs[_0xc452('0x24')](0x4)+_0xc452('0x36'));var _0x51a627=Buffer['from'](_0x342684[_0xc452('0x37')],_0xc452('0x27'));return fs[_0xc452('0x38')](_0x2da5a2,_0x51a627,function(_0x1fb8e5){_0x2350eb(_0x1fb8e5);},function(_0xde0d62){fs[_0xc452('0x28')](_0x2da5a2,_0xc452('0x29'));_0x335ca7(_0xde0d62);});});})['then'](function(_0x331a36){_0x2963f5=path[_0xc452('0x23')](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x2da5a2,_0x2963f5);})['then'](function(){try{fs[_0xc452('0x1b')](_0x2da5a2);fs[_0xc452('0x28')](_0x2963f5,'777');}catch(_0x373498){logger['error'](_0x373498);}logger[_0xc452('0x1a')](_0xc452('0x39'),_0x2963f5[_0xc452('0x2a')]('.')[0x0]);return _0x2963f5[_0xc452('0x2a')]('.')[0x0];});};exports[_0xc452('0x3a')]=function(_0x1ef420,_0x4496bd){var _0x4d8f6a=_0xc452('0x3b');var _0x44a639,_0x104ef1;var _0x4041a8;var _0x43d6ac={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x4d8f6a,'headers':{'Content-Type':_0xc452('0x3c')},'body':_0xc452('0x3d')+encodeURIComponent(JSON['stringify']([[[_0xc452('0x3e'),JSON[_0xc452('0x3f')]([_0x1ef420,_0x4496bd||'en',![],_0xc452('0x40')]),null,_0xc452('0x41')]]]))};return rp(_0x43d6ac)[_0xc452('0x42')](function(_0x5f4529){try{_0x4041a8=eval(_0x5f4529[_0xc452('0x43')](0x5))[0x0][0x2];}catch(_0x31ebbd){throw new Error(_0xc452('0x44')+_0x5f4529[_0xc452('0x1f')]);}if(!_0x4041a8){if(_0x1ef420[_0xc452('0x45')]>0xc8){throw new Error(_0xc452('0x46'));}else{throw new Error(_0xc452('0x47')+_0x4496bd+_0xc452('0x48'));}}try{_0x4041a8=eval(_0x4041a8)[0x0];}catch(_0x44c225){throw new Error(_0xc452('0x44')+res['data']);}const _0x3f6329=_0x4041a8;_0x44a639=path[_0xc452('0x23')](__dirname,_0xc452('0x35'),rs[_0xc452('0x24')](0x4)+_0xc452('0x36'));fs[_0xc452('0x26')](_0x44a639,_0x4041a8,{'encoding':'base64'});_0x104ef1=path['resolve'](__dirname,'tmp',rs[_0xc452('0x24')](0x4)+_0xc452('0x25'));return convertFile(_0x44a639,_0x104ef1);})[_0xc452('0x42')](function(){try{fs['unlink'](_0x44a639);fs[_0xc452('0x28')](_0x104ef1,'777');}catch(_0x201c40){logger[_0xc452('0x15')](_0x201c40);}logger[_0xc452('0x1a')](_0xc452('0x49'),_0x104ef1[_0xc452('0x2a')]('.')[0x0]);return _0x104ef1[_0xc452('0x2a')]('.')[0x0];});};exports[_0xc452('0x4a')]=function(_0x5e97aa,_0x46f1bc,_0x22da91){return google[_0xc452('0x4b')](_0x5e97aa,_0x46f1bc,_0x22da91)[_0xc452('0x42')](function(_0x37a3a2){logger[_0xc452('0x1a')](_0x37a3a2['uri']);return rp(_0x37a3a2);})['then'](function(_0x42f668){var _0x1f6526='';var _0x23c2b5=0x0;try{fs['unlink'](_0x5e97aa);}catch(_0x57050d){logger[_0xc452('0x15')](_0x57050d);}if(_0x42f668&&_0x42f668[_0xc452('0x4c')]){_0x1f6526=_0x42f668[_0xc452('0x4c')][_0xc452('0x4d')](function(_0x1712b3){return _0x1712b3&&_0x1712b3['alternatives'][0x0]&&_0x1712b3[_0xc452('0x4e')][0x0][_0xc452('0x4f')]?_0x1712b3['alternatives'][0x0][_0xc452('0x4f')]:'';})[_0xc452('0x50')]('\x0a');_0x23c2b5=_0x42f668[_0xc452('0x4c')][_0xc452('0x4d')](function(_0x3edc54){return _0x3edc54&&_0x3edc54[_0xc452('0x4e')][0x0]&&_0x3edc54['alternatives'][0x0]['confidence']?_0x3edc54['alternatives'][0x0][_0xc452('0x51')]:0x0;})[_0xc452('0x50')]('\x0a');}logger[_0xc452('0x1a')](_0xc452('0x52'),_0x1f6526);logger[_0xc452('0x1a')]('googleASR\x20confidence',_0x23c2b5);return{'transcript':_0x1f6526,'confidence':_0x23c2b5};})[_0xc452('0x53')](function(_0x2aeda3){logger[_0xc452('0x15')](_0xc452('0x54'),_0x2aeda3[_0xc452('0x14')],_0x2aeda3[_0xc452('0x55')],_0x2aeda3[_0xc452('0x56')]);});};exports[_0xc452('0x57')]=function(_0x51eec8,_0x113792,_0x1253bf,_0x196898){var _0x3d6400=apiai(_0x113792,{'language':_0x196898||'en'});return _0x3d6400[_0xc452('0x58')](_0x1253bf,{'sessionId':md5(_0x51eec8)})['then'](function(_0x1ab97a){logger[_0xc452('0x1a')](JSON[_0xc452('0x3f')](_0x1ab97a));return{'source':_0x1ab97a[_0xc452('0x59')][_0xc452('0x5a')],'resolvedQuery':_0x1ab97a['result'][_0xc452('0x5b')],'action':_0x1ab97a[_0xc452('0x59')]['action'],'actionIncomplete':_0x1ab97a[_0xc452('0x59')][_0xc452('0x5c')],'speech':_0x1ab97a[_0xc452('0x59')][_0xc452('0x5d')][_0xc452('0x5e')],'score':_0x1ab97a[_0xc452('0x59')]['score'],'statusCode':_0x1ab97a[_0xc452('0x5f')][_0xc452('0x60')],'endConversation':_0x1ab97a['result'][_0xc452('0x61')][_0xc452('0x62')]||![],'isFallbackIntent':_0x1ab97a[_0xc452('0x59')][_0xc452('0x61')][_0xc452('0x63')]};});};exports[_0xc452('0x64')]=function(_0x42e4f7,_0x54b06c,_0x23bb43,_0x5d5656,_0x560388,_0x160489){var _0x4da2a3=_0x5d5656[_0xc452('0x65')](/\\n/g,'\x0a');var _0x5d03b0={'credentials':{'private_key':_0x4da2a3,'client_email':_0x23bb43}};var _0x2e90a8=new dialogflow['SessionsClient'](_0x5d03b0);var _0x4dbe85=_0x2e90a8[_0xc452('0x66')](_0x54b06c,md5(_0x42e4f7));var _0x28b824={'session':_0x4dbe85,'queryInput':{'text':{'text':_0x560388,'languageCode':_0x160489}}};return _0x2e90a8['detectIntent'](_0x28b824)[_0xc452('0x42')](function(_0x3725d8){if(_0x3725d8&&_0x3725d8['length']){logger[_0xc452('0x1a')](_0xc452('0x67'),JSON['stringify'](_0x3725d8));var _0x260cc4=_0x3725d8[0x0];if(_0x260cc4){var _0x5039d9={'action':_0x260cc4[_0xc452('0x68')][_0xc452('0x69')],'allRequiredParamsPresent':_0x260cc4[_0xc452('0x68')][_0xc452('0x6a')],'endConversation':_0x260cc4['queryResult'][_0xc452('0x6b')]&&_0x260cc4[_0xc452('0x68')][_0xc452('0x6b')][_0xc452('0x6c')]?_0x260cc4[_0xc452('0x68')][_0xc452('0x6b')][_0xc452('0x6c')][_0xc452('0x6d')][_0xc452('0x6e')]:![],'fulfillmentText':_0x260cc4[_0xc452('0x68')][_0xc452('0x6f')],'intentName':_0x260cc4[_0xc452('0x68')][_0xc452('0x70')][_0xc452('0x55')],'intentDisplayName':_0x260cc4[_0xc452('0x68')][_0xc452('0x70')][_0xc452('0x71')],'isFallbackIntent':_0x260cc4[_0xc452('0x68')][_0xc452('0x70')]['isFallback'],'languageCode':_0x260cc4['queryResult'][_0xc452('0x72')],'queryText':_0x260cc4[_0xc452('0x68')]['queryText'],'responseId':_0x260cc4['responseId'],'score':_0x260cc4[_0xc452('0x68')][_0xc452('0x73')],'speech':_0x260cc4['queryResult'][_0xc452('0x6f')],'providerResponse':JSON['stringify'](_0x3725d8)};return _0x5039d9;}}});};exports[_0xc452('0x74')]=function(_0x29c96b,_0x3576bd,_0x5e4971,_0x29d51a){return tilde[_0xc452('0x4b')](_0x29c96b,_0x3576bd,_0x5e4971,_0x29d51a)['then'](function(_0x41d482){try{fs[_0xc452('0x1b')](_0x29c96b);}catch(_0x824dea){logger[_0xc452('0x15')](_0x824dea);}logger[_0xc452('0x1a')](_0xc452('0x75'),_0x41d482['transcript']);logger[_0xc452('0x1a')](_0xc452('0x76'),_0x41d482[_0xc452('0x51')]);return _0x41d482;});};exports[_0xc452('0x77')]=function(_0x18cf2f,_0x20e37e,_0x36b426,_0x4e3fd0,_0x4195c4,_0x5eb2bc){var _0x5e0907=path['resolve'](__dirname,_0xc452('0x35'),rs[_0xc452('0x24')](0x4)+_0xc452('0x36'));var _0x24d8c6;return aws[_0xc452('0x78')](_0x18cf2f,_0x20e37e,_0x36b426,_0x4e3fd0,_0x4195c4,_0x5eb2bc,_0x5e0907)['then'](function(){_0x24d8c6=path[_0xc452('0x23')](__dirname,_0xc452('0x35'),rs[_0xc452('0x24')](0x4)+_0xc452('0x25'));return convertFile(_0x5e0907,_0x24d8c6);})[_0xc452('0x42')](function(){try{fs[_0xc452('0x1b')](_0x5e0907);fs[_0xc452('0x28')](_0x24d8c6,_0xc452('0x29'));}catch(_0x19f619){logger[_0xc452('0x15')](_0x19f619);}return _0x24d8c6['split']('.')[0x0];});};exports[_0xc452('0x79')]=function(_0x52916a,_0x2eec69,_0x68711d,_0x449683,_0x3cbfc9,_0x11380d){return aws[_0xc452('0x7a')](_0x52916a,_0x2eec69,_0x68711d,_0x449683,_0x3cbfc9,_0x11380d)[_0xc452('0x42')](function(_0x4ee814){logger[_0xc452('0x1a')](JSON['stringify'](_0x4ee814));return _0x4ee814;});};exports[_0xc452('0x7b')]=function(_0x1ad888,_0x3c9c05,_0x43f023,_0x2645d0){var _0x4cf514=util['format'](_0xc452('0x7c'),ISPEECH_API,_0x1ad888,encodeURIComponent(_0x3c9c05),_0x43f023,_0x2645d0);var _0x2a5319=path[_0xc452('0x23')](__dirname,_0xc452('0x35'),rs['generate'](0x4)+_0xc452('0x36'));var _0x17b688;return downloadFile(_0x4cf514,_0x2a5319)[_0xc452('0x42')](function(){_0x17b688=path['resolve'](__dirname,_0xc452('0x35'),rs['generate'](0x4)+'.wav');return convertFile(_0x2a5319,_0x17b688);})[_0xc452('0x42')](function(){try{fs[_0xc452('0x1b')](_0x2a5319);fs[_0xc452('0x28')](_0x17b688,'777');}catch(_0x1c7603){logger[_0xc452('0x15')](_0x1c7603);}return _0x17b688[_0xc452('0x2a')]('.')[0x0];});};exports[_0xc452('0x7d')]=function(_0x3eff5e,_0x1febdf,_0x137a65,_0x5984b3){var _0x4f88f4=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x1febdf,_0x137a65,base64Encode(_0x3eff5e),_0x5984b3?util[_0xc452('0x7e')](_0xc452('0x7f'),encodeURIComponent(_0x5984b3)):_0xc452('0x80'));return uploadFile(_0x4f88f4)[_0xc452('0x42')](function(_0x4f016f){return querystring[_0xc452('0x81')](_0x4f016f);});};exports[_0xc452('0x82')]=function(_0x3720ef,_0x1d7801){return sestek[_0xc452('0x83')](_0x3720ef,_0x1d7801)[_0xc452('0x42')](function(_0x126197){logger[_0xc452('0x1a')](JSON[_0xc452('0x3f')](_0x126197));var _0x2a8bf6={'speech':_0x126197[_0xc452('0x84')],'action':_0x126197[_0xc452('0x85')]?_0x126197[_0xc452('0x85')][_0xc452('0x86')]:undefined,'actiondata':_0x126197[_0xc452('0x85')]?_0x126197[_0xc452('0x85')][_0xc452('0x87')]:undefined};if(_0x126197[_0xc452('0x85')]&&_0x126197[_0xc452('0x85')]['AudioFromTts']){return base64Decode(_0x126197['channelData'][_0xc452('0x88')][_0xc452('0x89')],path[_0xc452('0x23')](__dirname,_0xc452('0x35'),rs[_0xc452('0x24')](0x4)+_0xc452('0x25')))['then'](function(_0x680c94){_0x2a8bf6['audiofile']=_0x680c94;return _0x2a8bf6;});}return _0x2a8bf6;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 15b0505..681712f 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 _0x9a66=['exports','./nda'];(function(_0x389788,_0x3d305a){var _0x4357d1=function(_0x53c393){while(--_0x53c393){_0x389788['push'](_0x389788['shift']());}};_0x4357d1(++_0x3d305a);}(_0x9a66,0x117));var _0x69a6=function(_0xebaafc,_0x186ef8){_0xebaafc=_0xebaafc-0x0;var _0x2690ee=_0x9a66[_0xebaafc];return _0x2690ee;};var nda=require(_0x69a6('0x0'));module[_0x69a6('0x1')]={'nda':nda}; \ No newline at end of file +var _0xb43a=['./nda','exports'];(function(_0x20918c,_0x37a788){var _0x31257d=function(_0x547d3c){while(--_0x547d3c){_0x20918c['push'](_0x20918c['shift']());}};_0x31257d(++_0x37a788);}(_0xb43a,0x1a8));var _0xab43=function(_0x31c19c,_0xbe4b70){_0x31c19c=_0x31c19c-0x0;var _0x1a87f7=_0xb43a[_0x31c19c];return _0x1a87f7;};var nda=require(_0xab43('0x0'));module[_0xab43('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 8c7e1d7..2b6755b 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 _0xeebe=['../../../../../config/logger','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','Nda','uniqueid','callerid','dnid','extension','text','access_token','channelData','ProjectName','project','ndagenerate_audio','body','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise'];(function(_0x5775c4,_0x11631c){var _0xa2e3a1=function(_0x3c9a67){while(--_0x3c9a67){_0x5775c4['push'](_0x5775c4['shift']());}};_0xa2e3a1(++_0x11631c);}(_0xeebe,0xff));var _0xeeeb=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xeebe[_0x49ca18];return _0x145d54;};'use strict';var rp=require(_0xeeeb('0x0'));var url=require('url');var logger=require(_0xeeeb('0x1'))('agi');module[_0xeeeb('0x2')]=function(_0x1a1a35,_0xb434b3){var _0x427b94={'method':_0xeeeb('0x3'),'uri':url[_0xeeeb('0x4')](_0xb434b3[_0xeeeb('0x5')],_0xeeeb('0x6')),'form':{'grant_type':_0xeeeb('0x7'),'username':_0xb434b3[_0xeeeb('0x8')],'password':_0xb434b3[_0xeeeb('0x7')]},'json':!![]};return rp(_0x427b94)[_0xeeeb('0x9')](function(_0x41847e){var _0x1f88ea={'method':_0xeeeb('0x3'),'uri':url[_0xeeeb('0x4')](_0xb434b3[_0xeeeb('0xa')],_0xeeeb('0xb')),'body':{'type':_0xb434b3['ndaactivity_type']||'message','channelId':_0xeeeb('0xc'),'conversation':{'id':_0x1a1a35[_0xeeeb('0xd')]},'from':{'id':_0x1a1a35[_0xeeeb('0xe')],'name':_0x1a1a35['calleridname']},'recipient':{'id':_0x1a1a35[_0xeeeb('0xf')],'name':_0x1a1a35[_0xeeeb('0x10')]},'text':_0xb434b3[_0xeeeb('0x11')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x41847e[_0xeeeb('0x12')]},'json':!![]};if(_0xb434b3['project']){_0x1f88ea['body'][_0xeeeb('0x13')][_0xeeeb('0x14')]=_0xb434b3[_0xeeeb('0x15')];}if(_0xb434b3[_0xeeeb('0x16')]=='1'){_0x1f88ea[_0xeeeb('0x17')][_0xeeeb('0x13')][_0xeeeb('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xeeeb('0x19')};}if(_0xb434b3[_0xeeeb('0x1a')]){_0x1f88ea[_0xeeeb('0x17')][_0xeeeb('0x13')][_0xeeeb('0x1b')]=_0xb434b3[_0xeeeb('0x1a')];if(_0xb434b3[_0xeeeb('0x1c')]){_0x1f88ea[_0xeeeb('0x17')][_0xeeeb('0x13')][_0xeeeb('0x1d')]=_0xb434b3[_0xeeeb('0x1c')];}}logger[_0xeeeb('0x1e')](JSON[_0xeeeb('0x1f')](_0x1f88ea));return rp(_0x1f88ea);});}; \ No newline at end of file +var _0x76dc=['calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','agi','POST','/token','password','username','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','callerid'];(function(_0x331e91,_0x1cc7e3){var _0x2c73f5=function(_0x4797a1){while(--_0x4797a1){_0x331e91['push'](_0x331e91['shift']());}};_0x2c73f5(++_0x1cc7e3);}(_0x76dc,0x1f2));var _0xc76d=function(_0x314460,_0x356cb6){_0x314460=_0x314460-0x0;var _0x1b2c7b=_0x76dc[_0x314460];return _0x1b2c7b;};'use strict';var rp=require(_0xc76d('0x0'));var url=require(_0xc76d('0x1'));var logger=require(_0xc76d('0x2'))(_0xc76d('0x3'));module['exports']=function(_0x2a8b7d,_0x1ba6a1){var _0x5cff74={'method':_0xc76d('0x4'),'uri':url['resolve'](_0x1ba6a1['ndauth_url'],_0xc76d('0x5')),'form':{'grant_type':_0xc76d('0x6'),'username':_0x1ba6a1[_0xc76d('0x7')],'password':_0x1ba6a1['password']},'json':!![]};return rp(_0x5cff74)['then'](function(_0x119f38){var _0x114572={'method':_0xc76d('0x4'),'uri':url['resolve'](_0x1ba6a1['ndassistant_url'],_0xc76d('0x8')),'body':{'type':_0x1ba6a1[_0xc76d('0x9')]||'message','channelId':_0xc76d('0xa'),'conversation':{'id':_0x2a8b7d['uniqueid']},'from':{'id':_0x2a8b7d[_0xc76d('0xb')],'name':_0x2a8b7d[_0xc76d('0xc')]},'recipient':{'id':_0x2a8b7d[_0xc76d('0xd')],'name':_0x2a8b7d[_0xc76d('0xe')]},'text':_0x1ba6a1[_0xc76d('0xf')],'channelData':{}},'headers':{'Authorization':_0xc76d('0x10')+_0x119f38[_0xc76d('0x11')]},'json':!![]};if(_0x1ba6a1[_0xc76d('0x12')]){_0x114572[_0xc76d('0x13')][_0xc76d('0x14')][_0xc76d('0x15')]=_0x1ba6a1[_0xc76d('0x12')];}if(_0x1ba6a1[_0xc76d('0x16')]=='1'){_0x114572[_0xc76d('0x13')]['channelData'][_0xc76d('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xc76d('0x18')};}if(_0x1ba6a1['custom_action']){_0x114572[_0xc76d('0x13')][_0xc76d('0x14')][_0xc76d('0x19')]=_0x1ba6a1[_0xc76d('0x1a')];if(_0x1ba6a1['custom_action_data']){_0x114572[_0xc76d('0x13')]['channelData']['CustomActionData']=_0x1ba6a1[_0xc76d('0x1b')];}}logger[_0xc76d('0x1c')](JSON[_0xc76d('0x1d')](_0x114572));return rp(_0x114572);});}; \ 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 4a0a705..9d5b855 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 _0x6bc4=['./lib/api','exports'];(function(_0x5329c4,_0x2c5ea2){var _0x4c4d5a=function(_0x5d6dbf){while(--_0x5d6dbf){_0x5329c4['push'](_0x5329c4['shift']());}};_0x4c4d5a(++_0x2c5ea2);}(_0x6bc4,0x134));var _0x46bc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6bc4[_0x14add3];return _0x4a174f;};'use strict';var asr=require(_0x46bc('0x0'));module[_0x46bc('0x1')]=function(_0x563f66,_0x377fce,_0x27b510,_0x20d3c0){return asr(_0x563f66,_0x377fce,_0x27b510,_0x20d3c0);}; \ No newline at end of file +var _0x8868=['./lib/api'];(function(_0x4ab080,_0x2de364){var _0x53c5f3=function(_0x40bb04){while(--_0x40bb04){_0x4ab080['push'](_0x4ab080['shift']());}};_0x53c5f3(++_0x2de364);}(_0x8868,0x1ed));var _0x8886=function(_0xd52ead,_0xc316cc){_0xd52ead=_0xd52ead-0x0;var _0x868f2d=_0x8868[_0xd52ead];return _0x868f2d;};'use strict';var asr=require(_0x8886('0x0'));module['exports']=function(_0x498615,_0xe1c26e,_0x848726,_0x5aba82){return asr(_0x498615,_0xe1c26e,_0x848726,_0x5aba82);}; \ 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 fecb1ab..c9a2c26 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 _0x0c09=['Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','parse','status','result','final','info','Tilde\x20ASR\x20hypoteses','hypotheses','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','terminate','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','bluebird','lodash','crypto','../../../../../../config/logger','agi','exports','Tilde\x20URI','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','digest','hex'];(function(_0x648163,_0x241576){var _0x199d4d=function(_0x23055d){while(--_0x23055d){_0x648163['push'](_0x648163['shift']());}};_0x199d4d(++_0x241576);}(_0x0c09,0xbd));var _0x90c0=function(_0x5f207c,_0x3325f4){_0x5f207c=_0x5f207c-0x0;var _0x4a8a9c=_0x0c09[_0x5f207c];return _0x4a8a9c;};'use strict';var BPromise=require(_0x90c0('0x0'));var _=require(_0x90c0('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x90c0('0x2'));var logger=require(_0x90c0('0x3'))(_0x90c0('0x4'));module[_0x90c0('0x5')]=function(_0x374f93,_0x31fc02,_0x1b2753,_0x3bf4a4){return new BPromise(function(_0x2a1d5f,_0x49c704){logger['info'](_0x90c0('0x6'),_0x3bf4a4||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x1fdb9a=new WebSocket(_0x3bf4a4||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x50a004='';var _0x48f759='0';var _0x42f0bd='1';var _0x2fe724=_0x90c0('0x7');function _0x441150(_0x555b4f){var _0xa21190=crypto[_0x90c0('0x8')]('sha1');_0xa21190['update'](_0x555b4f);return _0xa21190[_0x90c0('0x9')](_0x90c0('0xa'));}function _0x28e6d9(){try{logger['info'](_0x90c0('0xb'));var _0x2312d5=moment()[_0x90c0('0xc')]();var _0x2a893c=_0x441150(_0x2312d5+_0x31fc02+_0x1b2753);_0x1fdb9a[_0x90c0('0xd')](JSON[_0x90c0('0xe')]({'appID':_0x31fc02,'timestamp':_0x2312d5,'appKey':_0x2a893c}));var _0x448510=fs['createReadStream'](_0x374f93);_0x448510['on'](_0x90c0('0xf'),function(_0x1c3d69){_0x1fdb9a[_0x90c0('0xd')](_0x1c3d69);});_0x448510['on'](_0x90c0('0x10'),function(){_0x1fdb9a[_0x90c0('0xd')](_0x90c0('0x11'));});}catch(_0x1f35a9){logger[_0x90c0('0x12')](_0x90c0('0x13'),JSON['stringify'](_0x1f35a9));_0x1fdb9a['terminate']();}}function _0x10d091(_0x2aaa29){try{if(_0x2aaa29){var _0x313e34=JSON[_0x90c0('0x14')](_0x2aaa29);switch(_0x313e34[_0x90c0('0x15')]){case 0x0:if(_0x313e34[_0x90c0('0x16')]){if(_0x313e34[_0x90c0('0x16')][_0x90c0('0x17')]){logger[_0x90c0('0x18')](_0x90c0('0x19'),JSON['stringify'](_0x313e34[_0x90c0('0x16')][_0x90c0('0x1a')]));_0x50a004=_0x313e34['result']['hypotheses'][0x0]['transcript'];_0x48f759=_0x313e34['result'][_0x90c0('0x1a')][0x0][_0x90c0('0x1b')];_0x42f0bd='0';_0x2fe724=_0x90c0('0x1c');_0x1fdb9a['terminate']();}}break;case 0x1:logger[_0x90c0('0x18')](_0x90c0('0x7'));_0x42f0bd='1';_0x2fe724='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x90c0('0x18')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x42f0bd='2';_0x2fe724=_0x90c0('0x1d');break;case 0x9:logger[_0x90c0('0x18')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x42f0bd='9';_0x2fe724=_0x90c0('0x1e');break;case 0xa:logger[_0x90c0('0x18')](_0x90c0('0x1f'));_0x42f0bd='10';_0x2fe724=_0x90c0('0x1f');break;case 0xb:logger[_0x90c0('0x18')](_0x90c0('0x20'));_0x42f0bd='11';_0x2fe724=_0x90c0('0x20');}}}catch(_0x41912f){logger['error'](_0x90c0('0x21'),JSON[_0x90c0('0xe')](_0x41912f));_0x1fdb9a[_0x90c0('0x22')]();}}function _0x49a085(){logger[_0x90c0('0x18')](_0x90c0('0x23'));_0x2a1d5f({'transcript':_0x50a004,'confidence':_0x48f759,'status':_0x42f0bd,'status_message':_0x2fe724});}function _0x27264f(_0x505054){logger[_0x90c0('0x12')](_0x90c0('0x24'));if(!_[_0x90c0('0x25')](_0x505054)){logger[_0x90c0('0x12')](_[_0x90c0('0x26')](_0x505054)?JSON['stringify'](_0x505054):_0x505054);}}_0x1fdb9a['on'](_0x90c0('0x27'),_0x28e6d9);_0x1fdb9a['on']('message',_0x10d091);_0x1fdb9a['on']('close',_0x49a085);_0x1fdb9a['on'](_0x90c0('0x12'),_0x27264f);});}; \ No newline at end of file +var _0xec64=['final','Tilde\x20ASR\x20hypoteses','stringify','hypotheses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result'];(function(_0x579879,_0x16d3e1){var _0x33baa0=function(_0x1b1098){while(--_0x1b1098){_0x579879['push'](_0x579879['shift']());}};_0x33baa0(++_0x16d3e1);}(_0xec64,0x147));var _0x4ec6=function(_0x272638,_0x42b993){_0x272638=_0x272638-0x0;var _0x19d027=_0xec64[_0x272638];return _0x19d027;};'use strict';var BPromise=require(_0x4ec6('0x0'));var _=require(_0x4ec6('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x4ec6('0x2'));var crypto=require(_0x4ec6('0x3'));var logger=require(_0x4ec6('0x4'))(_0x4ec6('0x5'));module['exports']=function(_0xbb5b7f,_0x195abe,_0x31c987,_0x407d39){return new BPromise(function(_0x1c9426,_0x20fcab){logger[_0x4ec6('0x6')](_0x4ec6('0x7'),_0x407d39||_0x4ec6('0x8'));var _0x4760bc=new WebSocket(_0x407d39||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x2b7b75='';var _0x4bf562='0';var _0x50cb14='1';var _0x21399a=_0x4ec6('0x9');function _0x22a99a(_0x597342){var _0x2e910a=crypto['createHash'](_0x4ec6('0xa'));_0x2e910a[_0x4ec6('0xb')](_0x597342);return _0x2e910a[_0x4ec6('0xc')](_0x4ec6('0xd'));}function _0x14a901(){try{logger[_0x4ec6('0x6')](_0x4ec6('0xe'));var _0x1651d3=moment()['unix']();var _0x2ae892=_0x22a99a(_0x1651d3+_0x195abe+_0x31c987);_0x4760bc['send'](JSON['stringify']({'appID':_0x195abe,'timestamp':_0x1651d3,'appKey':_0x2ae892}));var _0x8729bd=fs['createReadStream'](_0xbb5b7f);_0x8729bd['on'](_0x4ec6('0xf'),function(_0x262ba9){_0x4760bc['send'](_0x262ba9);});_0x8729bd['on'](_0x4ec6('0x10'),function(){_0x4760bc['send'](_0x4ec6('0x11'));});}catch(_0x54490b){logger[_0x4ec6('0x12')](_0x4ec6('0x13'),JSON['stringify'](_0x54490b));_0x4760bc[_0x4ec6('0x14')]();}}function _0x1a716c(_0x3226a7){try{if(_0x3226a7){var _0x3be129=JSON[_0x4ec6('0x15')](_0x3226a7);switch(_0x3be129[_0x4ec6('0x16')]){case 0x0:if(_0x3be129[_0x4ec6('0x17')]){if(_0x3be129[_0x4ec6('0x17')][_0x4ec6('0x18')]){logger[_0x4ec6('0x6')](_0x4ec6('0x19'),JSON[_0x4ec6('0x1a')](_0x3be129[_0x4ec6('0x17')][_0x4ec6('0x1b')]));_0x2b7b75=_0x3be129[_0x4ec6('0x17')]['hypotheses'][0x0][_0x4ec6('0x1c')];_0x4bf562=_0x3be129['result']['hypotheses'][0x0][_0x4ec6('0x1d')];_0x50cb14='0';_0x21399a='Success.';_0x4760bc[_0x4ec6('0x14')]();}}break;case 0x1:logger['info'](_0x4ec6('0x9'));_0x50cb14='1';_0x21399a=_0x4ec6('0x9');break;case 0x2:logger['info'](_0x4ec6('0x1e'));_0x50cb14='2';_0x21399a='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info'](_0x4ec6('0x1f'));_0x50cb14='9';_0x21399a='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x4ec6('0x6')]('Authentication\x20failed.');_0x50cb14='10';_0x21399a='Authentication\x20failed.';break;case 0xb:logger['info'](_0x4ec6('0x20'));_0x50cb14='11';_0x21399a=_0x4ec6('0x20');}}}catch(_0x2e3fb0){logger[_0x4ec6('0x12')](_0x4ec6('0x21'),JSON[_0x4ec6('0x1a')](_0x2e3fb0));_0x4760bc[_0x4ec6('0x14')]();}}function _0x1ffc65(){logger[_0x4ec6('0x6')](_0x4ec6('0x22'));_0x1c9426({'transcript':_0x2b7b75,'confidence':_0x4bf562,'status':_0x50cb14,'status_message':_0x21399a});}function _0x2ba5a4(_0x2452a2){logger[_0x4ec6('0x12')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x4ec6('0x23')](_0x2452a2)){logger[_0x4ec6('0x12')](_[_0x4ec6('0x24')](_0x2452a2)?JSON['stringify'](_0x2452a2):_0x2452a2);}}_0x4760bc['on'](_0x4ec6('0x25'),_0x14a901);_0x4760bc['on'](_0x4ec6('0x26'),_0x1a716c);_0x4760bc['on'](_0x4ec6('0x10'),_0x1ffc65);_0x4760bc['on'](_0x4ec6('0x12'),_0x2ba5a4);});}; \ 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 e40c52d..27f8b5d 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 _0x47cd=['./asr','exports'];(function(_0x56c93c,_0x3cfe76){var _0x2796e7=function(_0x1d3c3a){while(--_0x1d3c3a){_0x56c93c['push'](_0x56c93c['shift']());}};_0x2796e7(++_0x3cfe76);}(_0x47cd,0x11e));var _0xd47c=function(_0xa0469e,_0x316873){_0xa0469e=_0xa0469e-0x0;var _0x1093c1=_0x47cd[_0xa0469e];return _0x1093c1;};var asr=require(_0xd47c('0x0'));module[_0xd47c('0x1')]={'asr':asr}; \ No newline at end of file +var _0x8eb9=['./asr','exports'];(function(_0x1f692e,_0x1d0805){var _0x586dc7=function(_0x2eeed1){while(--_0x2eeed1){_0x1f692e['push'](_0x1f692e['shift']());}};_0x586dc7(++_0x1d0805);}(_0x8eb9,0x14c));var _0x98eb=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x8eb9[_0x19e35c];return _0x3e1fe8;};var asr=require(_0x98eb('0x0'));module[_0x98eb('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index e4346c2..58d77c8 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 _0x3050=['close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','events','EventEmitter','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','E_AGI_SERVER_MAXCONNECTION','ready','code'];(function(_0x56236c,_0x57cce8){var _0x140a7=function(_0x2dc810){while(--_0x2dc810){_0x56236c['push'](_0x56236c['shift']());}};_0x140a7(++_0x57cce8);}(_0x3050,0x1ae));var _0x0305=function(_0x1dc3b2,_0x2b2a3b){_0x1dc3b2=_0x1dc3b2-0x0;var _0x298d84=_0x3050[_0x1dc3b2];return _0x298d84;};'use strict';var util=require(_0x0305('0x0'));var net=require('net');var EventEmitter=require(_0x0305('0x1'))[_0x0305('0x2')];var AGIError=require(_0x0305('0x3'));var AGIChannel=require(_0x0305('0x4'));var AGIServer=function(_0x4aa790,_0x2ce843,_0x196e1f){var _0x41e2a4=this,_0x4aa790=_0x4aa790||0x11dd,_0x2ce843=_0x2ce843||_0x0305('0x5'),_0x489a2e=null,_0x362618=0x0;EventEmitter[_0x0305('0x6')](_0x41e2a4);function _0xc2cf42(){if(!_0x4aa790){_0x41e2a4[_0x0305('0x7')](_0x0305('0x8'),new AGIError(_0x0305('0x9')));return![];}_0x489a2e=net[_0x0305('0xa')]();_0x489a2e[_0x0305('0xb')](_0x4aa790,_0x2ce843);_0x489a2e['on'](_0x0305('0xc'),function(){_0x41e2a4[_0x0305('0x7')](_0x0305('0xc'));});_0x489a2e['on'](_0x0305('0xd'),function(_0x3c0ec5){_0x489a2e[_0x0305('0xe')](function(_0x144e39,_0x338502){if(_0x144e39){_0x41e2a4[_0x0305('0x7')](_0x0305('0x8'),new AGIError(_0x0305('0xf'),_0x144e39));}else if(_0x196e1f&&_0x196e1f<0x0){_0x41e2a4[_0x0305('0x7')](_0x0305('0x8'),new AGIError(_0x0305('0x10')));_0x3c0ec5['destroy']();}else if(_0x196e1f&&_0x196e1f>0x0&&_0x196e1f<_0x338502){_0x362618+=0x1;_0x41e2a4[_0x0305('0x7')]('error',new AGIError(_0x0305('0x11'),_0x362618));_0x3c0ec5['destroy']();}else{var _0x5b9c49=new AGIChannel(_0x3c0ec5);_0x5b9c49['on'](_0x0305('0x12'),function(){_0x41e2a4[_0x0305('0x7')](_0x0305('0xd'),_0x5b9c49);});}});});_0x489a2e['on'](_0x0305('0x8'),function(_0x19af9a){_0x41e2a4[_0x0305('0x7')](_0x0305('0x8'),new AGIError(_0x0305('0xf'),_0x19af9a[_0x0305('0x13')]));});_0x489a2e['on'](_0x0305('0x14'),function(){_0x41e2a4[_0x0305('0x7')](_0x0305('0x14'),new AGIError(_0x0305('0x15')));});}process[_0x0305('0x16')](function(){_0xc2cf42();});};util[_0x0305('0x17')](AGIServer,EventEmitter);module[_0x0305('0x18')]=function(_0x4b1e06,_0x17ab29,_0x144aa0){return new AGIServer(_0x4b1e06,_0x17ab29,_0x144aa0);}; \ No newline at end of file +var _0x6867=['nextTick','inherits','exports','net','events','EventEmitter','./error','./channel','error','E_AGI_ARGUMENT_PORT','createServer','listening','getConnections','E_AGI_SERVER_ERROR','emit','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','code','close','E_AGI_SERVER_CLOSE'];(function(_0x365c07,_0x3ef179){var _0x348481=function(_0x2323ec){while(--_0x2323ec){_0x365c07['push'](_0x365c07['shift']());}};_0x348481(++_0x3ef179);}(_0x6867,0xd2));var _0x7686=function(_0x42b216,_0x3a3d48){_0x42b216=_0x42b216-0x0;var _0x4cf366=_0x6867[_0x42b216];return _0x4cf366;};'use strict';var util=require('util');var net=require(_0x7686('0x0'));var EventEmitter=require(_0x7686('0x1'))[_0x7686('0x2')];var AGIError=require(_0x7686('0x3'));var AGIChannel=require(_0x7686('0x4'));var AGIServer=function(_0x288990,_0x1d2626,_0x5d9a66){var _0x217091=this,_0x288990=_0x288990||0x11dd,_0x1d2626=_0x1d2626||'127.0.0.1',_0x2673cd=null,_0xbe4a43=0x0;EventEmitter['call'](_0x217091);function _0x124a87(){if(!_0x288990){_0x217091['emit'](_0x7686('0x5'),new AGIError(_0x7686('0x6')));return![];}_0x2673cd=net[_0x7686('0x7')]();_0x2673cd['listen'](_0x288990,_0x1d2626);_0x2673cd['on'](_0x7686('0x8'),function(){_0x217091['emit']('listening');});_0x2673cd['on']('connection',function(_0x456b85){_0x2673cd[_0x7686('0x9')](function(_0x1a8b54,_0x1b6c6b){if(_0x1a8b54){_0x217091['emit'](_0x7686('0x5'),new AGIError(_0x7686('0xa'),_0x1a8b54));}else if(_0x5d9a66&&_0x5d9a66<0x0){_0x217091[_0x7686('0xb')](_0x7686('0x5'),new AGIError(_0x7686('0xc')));_0x456b85[_0x7686('0xd')]();}else if(_0x5d9a66&&_0x5d9a66>0x0&&_0x5d9a66<_0x1b6c6b){_0xbe4a43+=0x1;_0x217091['emit'](_0x7686('0x5'),new AGIError(_0x7686('0xe'),_0xbe4a43));_0x456b85[_0x7686('0xd')]();}else{var _0x2aae7a=new AGIChannel(_0x456b85);_0x2aae7a['on'](_0x7686('0xf'),function(){_0x217091[_0x7686('0xb')](_0x7686('0x10'),_0x2aae7a);});}});});_0x2673cd['on'](_0x7686('0x5'),function(_0x233e34){_0x217091[_0x7686('0xb')](_0x7686('0x5'),new AGIError(_0x7686('0xa'),_0x233e34[_0x7686('0x11')]));});_0x2673cd['on'](_0x7686('0x12'),function(){_0x217091[_0x7686('0xb')](_0x7686('0x12'),new AGIError(_0x7686('0x13')));});}process[_0x7686('0x14')](function(){_0x124a87();});};util[_0x7686('0x15')](AGIServer,EventEmitter);module[_0x7686('0x16')]=function(_0x4f0462,_0x23ac9e,_0x384e52){return new AGIServer(_0x4f0462,_0x23ac9e,_0x384e52);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 899631b..d9f8e4d 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 _0xb3f9=['result','noop','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Wait\x20%s\x20seconds\x20before\x20answer','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20database\x20selected','getSquareOdbc','replace','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20found','SIP/%s','opts','url','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20project_id\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20variable\x20selected\x20for\x20the\x20result','response','maxdigit','test','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','no\x20valid\x20credentials\x20configured','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','generate','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','context','extension','gotoif','no\x20condition\x20configured','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','math','Enter\x20in\x20MATH\x20(%s)\x20block','math\x20%s','operation','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','no\x20file\x20audio\x20found','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','position','Executed\x20command\x20%s\x20%s','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','service','host','port','auth','pass','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','.wav','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','agentUnpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','split','join','exports','path','util','lodash','shelljs','odbc','moment','mustache','request-promise','../../config/logger','../../config/environment','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbcById','dsn','getUserById','getTrunk','getSound','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervals','IntervalId','map','Intervals','interval','format','%s/sounds/converted/%s','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','priority','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback_priority','getPause','getPauseById','agentPause','agent','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','method','timeout','number','POST','PUT','toUpperCase','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','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','uri','clear','agicommand','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','replaceAll','extra','toString','isConfigured','maxRetry','retry','mrcpsynth','MRCPSynth'];(function(_0x1d5352,_0x4f7974){var _0x3395c2=function(_0x1f062a){while(--_0x1f062a){_0x1d5352['push'](_0x1d5352['shift']());}};_0x3395c2(++_0x4f7974);}(_0xb3f9,0x122));var _0x9b3f=function(_0x23dc4b,_0x232451){_0x23dc4b=_0x23dc4b-0x0;var _0x5ee516=_0xb3f9[_0x23dc4b];return _0x5ee516;};'use strict';var fs=require('fs');var path=require(_0x9b3f('0x0'));var util=require(_0x9b3f('0x1'));var _=require(_0x9b3f('0x2'));var sh=require(_0x9b3f('0x3'));var odbc=require(_0x9b3f('0x4'))();var rs=require('randomstring');var moment=require(_0x9b3f('0x5'));var Mustache=require(_0x9b3f('0x6'));var rp=require(_0x9b3f('0x7'));var logger=require(_0x9b3f('0x8'))('agi');var config=require(_0x9b3f('0x9'));var scripts=require('./scripts');var FILES_PATH=_0x9b3f('0xa');var recursiveMapAttributes=[_0x9b3f('0xb'),_0x9b3f('0xc')];var verticesWithRetry=[_0x9b3f('0xd'),'getdigits','getsecretdigits'];var AGIVertices=function(_0x251a6e,_0x2ff7cf,_0x41a78c){this[_0x9b3f('0xe')]=_0x251a6e;this[_0x9b3f('0xf')]=_0x2ff7cf;this[_0x9b3f('0x10')]=_0x41a78c;};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x12')]=function(_0x4779db,_0x9e421e){this[_0x9b3f('0xf')][_0x9b3f('0x13')](_0x4779db)[_0x9b3f('0x14')](function(_0x56a7b2){_0x9e421e(null,_0x56a7b2?_0x56a7b2[_0x9b3f('0x15')]:![]);})[_0x9b3f('0x16')](function(_0x39931d){_0x9e421e(_0x39931d);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x17')]=function(_0x1fec63,_0x6b1d57){this[_0x9b3f('0xf')][_0x9b3f('0x18')](_0x1fec63)[_0x9b3f('0x14')](function(_0x21fef5){_0x6b1d57(null,_0x21fef5?_0x21fef5[_0x9b3f('0x15')]:![]);})[_0x9b3f('0x16')](function(_0x495554){_0x6b1d57(_0x495554);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x19')]=function(_0x1a4567,_0x23c726){this['rpc'][_0x9b3f('0x1a')](_0x1a4567)[_0x9b3f('0x14')](function(_0x295eed){_0x23c726(null,_0x295eed?_0x295eed[_0x9b3f('0x15')]:![]);})[_0x9b3f('0x16')](function(_0x4e159c){_0x23c726(_0x4e159c);});};AGIVertices[_0x9b3f('0x11')]['getSquareOdbc']=function(_0x3addd7,_0x406631){this[_0x9b3f('0xf')][_0x9b3f('0x1b')](_0x3addd7)[_0x9b3f('0x14')](function(_0x4b1ce2){_0x406631(null,_0x4b1ce2?_0x4b1ce2[_0x9b3f('0x1c')]:![]);})[_0x9b3f('0x16')](function(_0x4f0e55){_0x406631(_0x4f0e55);});};AGIVertices[_0x9b3f('0x11')]['getUser']=function(_0x599b4a,_0x18a8ce){this['rpc'][_0x9b3f('0x1d')](_0x599b4a)[_0x9b3f('0x14')](function(_0x409840){_0x18a8ce(null,_0x409840?_0x409840['name']:![]);})['catch'](function(_0x486349){_0x18a8ce(_0x486349);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x1e')]=function(_0x58b464,_0x5644e4){this[_0x9b3f('0xf')]['getTrunkById'](_0x58b464)[_0x9b3f('0x14')](function(_0x401eef){_0x5644e4(null,_0x401eef?_0x401eef[_0x9b3f('0x15')]:![]);})[_0x9b3f('0x16')](function(_0x40e84b){_0x5644e4(_0x40e84b);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x1f')]=function(_0x2b64eb,_0x108ec8){var _0x295013=this;this[_0x9b3f('0xf')]['getSoundById'](_0x2b64eb)['then'](function(_0x54ed85){_0x108ec8(null,_0x54ed85?_0x295013[_0x9b3f('0x20')](_0x54ed85[_0x9b3f('0x21')]):![]);})[_0x9b3f('0x16')](function(_0x4ccdd9){_0x108ec8(_0x4ccdd9);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x22')]=function(_0x30855f,_0x5ea8d1){this['rpc']['getMailAccountById'](_0x30855f)[_0x9b3f('0x14')](function(_0x87dcdb){_0x5ea8d1(null,_0x87dcdb?_0x87dcdb:![]);})['catch'](function(_0x588d4b){_0x5ea8d1(_0x588d4b);});};AGIVertices['prototype'][_0x9b3f('0x23')]=function(_0x432532,_0x5617d9,_0x1d9faa){this[_0x9b3f('0x10')]['sendMailMessage'](_0x432532,_0x5617d9)[_0x9b3f('0x14')](function(){_0x1d9faa(null);})[_0x9b3f('0x16')](function(_0x175554){_0x1d9faa(_0x175554);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x24')]=function(_0x1414a1,_0x23680c){this[_0x9b3f('0xf')]['getIntervalById'](_0x1414a1)[_0x9b3f('0x14')](function(_0x17e41c){if(_0x17e41c){if(_0x17e41c[_0x9b3f('0x25')]){_0x23680c(null,[_0x17e41c['interval']]);}else{_0x23680c(null,_[_0x9b3f('0x26')](_0x17e41c[_0x9b3f('0x27')],_0x9b3f('0x28')));}}else{_0x23680c(null,![]);}})[_0x9b3f('0x16')](function(_0x8c8a34){_0x23680c(_0x8c8a34);});};AGIVertices[_0x9b3f('0x11')]['getSoundPath']=function(_0x590553){return util[_0x9b3f('0x29')](_0x9b3f('0x2a'),FILES_PATH,_0x590553);};AGIVertices['prototype']['getQueryOdbc']=function(_0x44bea4,_0x37962a,_0x13949b){odbc[_0x9b3f('0x2b')](_0x44bea4,function(_0x181707){if(_0x181707){logger['error'](_0x9b3f('0x2c'),_0x181707);_0x13949b(_0x181707);}else{logger[_0x9b3f('0x2d')](_0x9b3f('0x2e'));odbc[_0x9b3f('0x2f')](_0x37962a,function(_0x16ecdf,_0xfe29c8){if(_0x16ecdf){logger['info']('Error\x20executing\x20query\x20%s',_0x37962a);_0x13949b(_0x16ecdf);}else{logger['info'](_0x9b3f('0x30'),_0x37962a);odbc[_0x9b3f('0x31')](function(_0x52d696){if(_0x52d696){logger[_0x9b3f('0x32')](_0x9b3f('0x33'),_0x52d696);}_0x13949b(null,_0xfe29c8);});}});}});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x34')]=function(_0x5be3fd,_0x3c336e){this[_0x9b3f('0xf')][_0x9b3f('0x35')](_0x5be3fd)[_0x9b3f('0x14')](function(_0x4c9508){_0x3c336e(null,_0x4c9508?_0x4c9508:![]);})[_0x9b3f('0x16')](function(_0x4c7cb9){_0x3c336e(_0x4c7cb9);});};AGIVertices['prototype']['createSmsMessage']=function(_0x1b5735,_0x49305c){this['rpc'][_0x9b3f('0x36')](_0x1b5735)['then'](function(_0x410ae2){_0x49305c(null,_0x410ae2);})[_0x9b3f('0x16')](function(_0x4e101d){_0x49305c(_0x4e101d);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x37')]=function(_0x2b71f6,_0x2d6197,_0x398fda){this[_0x9b3f('0xf')][_0x9b3f('0x37')]({'uniqueid':this['channel'][_0x9b3f('0x38')],'node':_0x2b71f6[_0x9b3f('0x39')],'application':_0x2b71f6['agicommand'],'data':_0x2d6197||null,'project_name':this['channel'][_0x9b3f('0x3a')],'callerid':this[_0x9b3f('0xe')][_0x9b3f('0x3b')]})[_0x9b3f('0x14')](function(_0x1a7b0f){if(_0x398fda){_0x398fda(null,_0x1a7b0f);}})[_0x9b3f('0x16')](function(_0x8ff5f0){if(_0x398fda){_0x398fda(_0x8ff5f0);}});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x3c')]=function(_0x56953d,_0x46d286,_0x288ff8,_0x3c574d){this[_0x9b3f('0xf')][_0x9b3f('0x3c')]({'uniqueid':this[_0x9b3f('0xe')][_0x9b3f('0x38')],'callerid':this[_0x9b3f('0xe')][_0x9b3f('0x3b')],'calleridname':this[_0x9b3f('0xe')][_0x9b3f('0x3d')],'context':this['channel']['context'],'extension':this['channel']['extension'],'priority':this[_0x9b3f('0xe')][_0x9b3f('0x3e')],'accountcode':this['channel']['accountcode'],'dnid':this[_0x9b3f('0xe')][_0x9b3f('0x3f')],'projectName':this['channel']['arg_1'],'saveName':_0x46d286,'filename':_0x56953d[_0x9b3f('0x40')]||_0x46d286,'savePath':_0x288ff8})['then'](function(_0x562577){_0x3c574d(null,_0x562577);})['catch'](function(_0x212f3c){_0x3c574d(_0x212f3c);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x41')]=function(_0x3b5131,_0x290253,_0x103ae2,_0x2dd478,_0x3f100f){this[_0x9b3f('0xf')]['createSquareMessage']({'uniqueid':this[_0x9b3f('0xe')][_0x9b3f('0x38')],'body':_0x3b5131,'direction':_0x290253,'providerName':_0x103ae2,'providerResponse':_0x2dd478})['then'](function(_0x584b5f){if(_0x3f100f){_0x3f100f(null,_0x584b5f);}})[_0x9b3f('0x16')](function(_0x253f2d){if(_0x3f100f){_0x3f100f(_0x253f2d);}});};AGIVertices[_0x9b3f('0x11')]['createCmContact']=function(_0x2742e7,_0x491eae){this['rpc'][_0x9b3f('0x42')]({'firstName':_[_0x9b3f('0x43')](_0x2742e7['name'])||_[_0x9b3f('0x44')](_0x2742e7['name'])?_0x9b3f('0x45')+Math[_0x9b3f('0x46')]():_0x2742e7['name'],'lastName':_[_0x9b3f('0x43')](_0x2742e7[_0x9b3f('0x47')])||_['isNil'](_0x2742e7['lastName'])?null:_0x2742e7['lastName'],'phone':_0x2742e7[_0x9b3f('0x48')],'ListId':_0x2742e7[_0x9b3f('0x49')],'scheduledat':_0x2742e7[_0x9b3f('0x4a')],'callbackUniqueid':this[_0x9b3f('0xe')][_0x9b3f('0x38')],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0x2742e7['scheduledAt']['toString'](),'priority':_0x2742e7[_0x9b3f('0x4b')]})['then'](function(_0x35cd0d){_0x491eae(null,_0x35cd0d);})[_0x9b3f('0x16')](function(_0x47c96b){_0x491eae(_0x47c96b);});};AGIVertices['prototype'][_0x9b3f('0x4c')]=function(_0x2c0f0c,_0x215c3d){this[_0x9b3f('0xf')][_0x9b3f('0x4d')](_0x2c0f0c)[_0x9b3f('0x14')](function(_0x1d2376){_0x215c3d(null,_0x1d2376?_0x1d2376[_0x9b3f('0x15')]:![]);})[_0x9b3f('0x16')](function(_0x39c04a){_0x215c3d(_0x39c04a);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x4e')]=function(_0x2ee2c7,_0x1f7489,_0x15075f){var _0x289bc2={'role':_0x9b3f('0x4f')};_0x289bc2[_0x2ee2c7]=this[_0x9b3f('0xe')]['callerid'];this[_0x9b3f('0xf')]['agentPause'](_0x289bc2,_0x1f7489,this[_0x9b3f('0xe')][_0x9b3f('0x38')])['then'](function(_0xb7249b){_0x15075f(null,_[_0x9b3f('0x44')](_0xb7249b)?![]:!![]);})['catch'](function(_0x5ec7dc){logger[_0x9b3f('0x32')](_0x5ec7dc);_0x15075f(null,![]);});};AGIVertices[_0x9b3f('0x11')]['agentUnpause']=function(_0x4ef0a4,_0xe8108b){var _0x44368c={'role':_0x9b3f('0x4f')};_0x44368c[_0x4ef0a4]=this[_0x9b3f('0xe')][_0x9b3f('0x3b')];this[_0x9b3f('0xf')]['agentUnpause'](_0x44368c)[_0x9b3f('0x14')](function(_0x240287){_0xe8108b(null,_['isNil'](_0x240287)?![]:!![]);})[_0x9b3f('0x16')](function(_0x43c97b){logger[_0x9b3f('0x32')](_0x43c97b);_0xe8108b(null,![]);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x50')]=function(_0x5a83df,_0x6d506d){var _0x428e85={'role':_0x9b3f('0x4f')};_0x428e85[_0x5a83df]=this['channel'][_0x9b3f('0x3b')];this[_0x9b3f('0xf')][_0x9b3f('0x50')](_0x428e85)[_0x9b3f('0x14')](function(_0x1a26cd){_0x6d506d(null,_[_0x9b3f('0x44')](_0x1a26cd)?![]:!![]);})[_0x9b3f('0x16')](function(_0x30bfb7){logger['error'](_0x30bfb7);_0x6d506d(null,![]);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x51')]=function(_0x232f1a,_0x1e252c){var _0x32b703={'role':_0x9b3f('0x4f')};_0x32b703[_0x232f1a]=this['channel']['callerid'];var _0x4a3a59=_0x232f1a!=_0x9b3f('0x52')?util[_0x9b3f('0x29')](_0x9b3f('0x53'),_0x9b3f('0x54'),this['channel']['callerid']):undefined;this[_0x9b3f('0xf')]['agentLogin'](_0x32b703,_0x4a3a59)['then'](function(_0x28dbbc){_0x1e252c(null,_['isNil'](_0x28dbbc)?![]:!![]);})[_0x9b3f('0x16')](function(_0x56aa84){logger[_0x9b3f('0x32')](_0x56aa84);_0x1e252c(null,![]);});};AGIVertices['prototype'][_0x9b3f('0x55')]=function(_0x4d7b58,_0x394239){sh[_0x9b3f('0x56')](_[_0x9b3f('0x57')](_0x4d7b58),function(_0x3f146d,_0x29fa0c){var _0x3815e0=_0x29fa0c['replace'](/(\r\n|\n|\r)/gm,'');_0x394239(null,_0x3815e0);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x58')]=function(_0x4e4559,_0x220f7c){scripts[_0x9b3f('0x58')](_0x4e4559[_0x9b3f('0x59')],_0x4e4559[_0x9b3f('0x5a')]||_0x9b3f('0x5b'),_0x4e4559[_0x9b3f('0x5b')],_0x4e4559[_0x9b3f('0x5c')]||_0x9b3f('0x5d'),_0x4e4559['ssmlGender']||'MALE',_0x4e4559[_0x9b3f('0x5e')]||_0x9b3f('0x5f'))[_0x9b3f('0x14')](function(_0x2dbc3a){_0x220f7c(null,_0x2dbc3a);})[_0x9b3f('0x16')](function(_0xfe23a5){_0x220f7c(_0xfe23a5);});};AGIVertices['prototype'][_0x9b3f('0x60')]=function(_0x551a01,_0x205225){scripts['googleTTS'](_0x551a01[_0x9b3f('0x5b')],_0x551a01[_0x9b3f('0x61')]||'en',0x1)[_0x9b3f('0x14')](function(_0x19f514){_0x205225(null,_0x19f514);})[_0x9b3f('0x16')](function(_0x5d712e){_0x205225(_0x5d712e);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x62')]=function(_0x439733,_0x2688b9){var _0x130616={'uri':_0x439733['url'],'method':_0x439733[_0x9b3f('0x63')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x439733[_0x9b3f('0x64')])===_0x9b3f('0x65')&&parseInt(_0x439733[_0x9b3f('0x64')])>=0x1?parseInt(_0x439733[_0x9b3f('0x64')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x9b3f('0x66'),_0x9b3f('0x67')],_0x130616['method'][_0x9b3f('0x68')]())){try{_0x130616['body']=_0x439733[_0x9b3f('0xc')]?JSON[_0x9b3f('0x69')](_0x439733[_0x9b3f('0xc')]):{};}catch(_0x233ae0){logger[_0x9b3f('0x32')](_0x9b3f('0x6a'),_0x233ae0);}}try{_0x130616[_0x9b3f('0x6b')]=_0x439733[_0x9b3f('0xb')]?JSON[_0x9b3f('0x69')](_0x439733[_0x9b3f('0xb')]):{};}catch(_0x6823a3){logger['error'](_0x9b3f('0x6c'),_0x6823a3);}if(_0x439733['computedVariables']){try{var _0x3dd3a5=require(_0x439733[_0x9b3f('0x6d')])[_0x9b3f('0x6e')](this,_0x130616);_0x130616['uri']=Mustache[_0x9b3f('0x6f')](_0x439733['url'],_0x3dd3a5,{},['$$','$$']);if(_0x130616['headers']){_0x130616[_0x9b3f('0x6b')]=JSON[_0x9b3f('0x69')](Mustache[_0x9b3f('0x6f')](JSON[_0x9b3f('0x70')](_0x130616[_0x9b3f('0x6b')]),_0x3dd3a5,{},['$$','$$']));}if(_0x130616[_0x9b3f('0x71')]){_0x130616['body']=JSON['parse'](Mustache[_0x9b3f('0x6f')](JSON['stringify'](_0x130616[_0x9b3f('0x71')]),_0x3dd3a5,{},['$$','$$']));}}catch(_0x5e1c48){logger[_0x9b3f('0x32')](_0x9b3f('0x72'),_0x5e1c48);}}rp(_0x130616)[_0x9b3f('0x14')](function(_0x525a85){var _0x14894e={'statusCode':_0x525a85[_0x9b3f('0x73')]||0xc8,'statusMessage':_0x525a85[_0x9b3f('0x74')]||'OK','headers':_0x525a85[_0x9b3f('0x6b')]||{},'body':_0x525a85['body']||{}};_0x2688b9(null,_0x14894e);})[_0x9b3f('0x16')](function(_0x254094){var _0xef6d9b={'statusCode':_0x254094['statusCode']||0x1f4,'statusMessage':_0x254094['message']||_0x9b3f('0x75'),'headers':_0x254094[_0x9b3f('0x76')]['headers']||{},'body':_0x254094['options'][_0x9b3f('0x71')]||{}};_0x2688b9(null,_0xef6d9b);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x77')]=function(_0x52083b,_0x17d462){scripts['googleDialogflow'](this[_0x9b3f('0xe')][_0x9b3f('0x38')],_0x52083b[_0x9b3f('0x78')],_0x52083b[_0x9b3f('0x5b')],_0x52083b[_0x9b3f('0x79')]||'en')[_0x9b3f('0x14')](function(_0x39fae2){_0x17d462(null,_0x39fae2);})[_0x9b3f('0x16')](function(_0x5c27e8){_0x17d462(_0x5c27e8);});};AGIVertices[_0x9b3f('0x11')]['googleDialogflowV2']=function(_0x2063ac,_0x282ef6){scripts[_0x9b3f('0x7a')](this[_0x9b3f('0xe')][_0x9b3f('0x38')],_0x2063ac['dialogflowV2_project_id'],_0x2063ac[_0x9b3f('0x7b')],_0x2063ac[_0x9b3f('0x7c')],_0x2063ac[_0x9b3f('0x5b')],_0x2063ac[_0x9b3f('0x7d')]||'en')[_0x9b3f('0x14')](function(_0x54612d){_0x282ef6(null,_0x54612d);})['catch'](function(_0x2dce43){_0x282ef6(_0x2dce43);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x7e')]=function(_0x29a949,_0x305579){scripts[_0x9b3f('0x7e')](this[_0x9b3f('0xe')],_0x29a949)[_0x9b3f('0x14')](function(_0x175caf){_0x305579(null,_0x175caf);})['catch'](function(_0x4aba4b){_0x305579(_0x4aba4b);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x7f')]=function(_0x62ccc,_0x54c39b){scripts['ispeechTTS'](_0x62ccc[_0x9b3f('0x78')],_0x62ccc[_0x9b3f('0x5b')],_0x62ccc[_0x9b3f('0x80')]||_0x9b3f('0x5d'),_0x62ccc[_0x9b3f('0x81')])['then'](function(_0x51cc0b){_0x54c39b(null,_0x51cc0b);})[_0x9b3f('0x16')](function(_0x4d906a){_0x54c39b(_0x4d906a);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x82')]=function(_0x1a7d1b,_0x4e828a,_0x33a436){scripts[_0x9b3f('0x82')](_0x4e828a,_0x1a7d1b[_0x9b3f('0x78')],_0x1a7d1b[_0x9b3f('0x83')]||_0x9b3f('0x5d'),this['isConfigured'](_0x1a7d1b[_0x9b3f('0x84')])?_0x1a7d1b['model']:undefined)[_0x9b3f('0x14')](function(_0x1b7fc0){_0x33a436(null,_0x1b7fc0);})['catch'](function(_0x32399e){_0x33a436(_0x32399e);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x85')]=function(_0x554c26,_0x1afb99){scripts[_0x9b3f('0x85')](_0x554c26[_0x9b3f('0x86')],_0x554c26[_0x9b3f('0x87')],_0x554c26['aws_polly_region'],_0x554c26[_0x9b3f('0x88')]||_0x9b3f('0x89'),_0x554c26['text'],_0x554c26[_0x9b3f('0x8a')]||'text')[_0x9b3f('0x14')](function(_0x1f135e){_0x1afb99(null,_0x1f135e);})['catch'](function(_0x345dc3){_0x1afb99(_0x345dc3);});};AGIVertices[_0x9b3f('0x11')]['awsLex']=function(_0x514d9d,_0x599f0e){scripts[_0x9b3f('0x8b')](this[_0x9b3f('0xe')][_0x9b3f('0x38')],_0x514d9d[_0x9b3f('0x86')],_0x514d9d['aws_secret_access_key'],_0x514d9d[_0x9b3f('0x8c')],_0x514d9d[_0x9b3f('0x5b')],_0x514d9d[_0x9b3f('0x8d')])[_0x9b3f('0x14')](function(_0x1a733a){_0x599f0e(null,_0x1a733a);})[_0x9b3f('0x16')](function(_0x5afec4){_0x599f0e(_0x5afec4);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x8e')]=function(_0x637c86,_0x147712,_0x23670c){scripts[_0x9b3f('0x8e')](_0x147712,_0x637c86[_0x9b3f('0x78')],_0x637c86[_0x9b3f('0x8f')]||_0x9b3f('0x5d'))[_0x9b3f('0x14')](function(_0x4ecb56){_0x23670c(null,_0x4ecb56);})[_0x9b3f('0x16')](function(_0x124e68){_0x23670c(_0x124e68);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x90')]=function(_0xd0a2ce,_0xcec828,_0x249323){scripts[_0x9b3f('0x90')](_0xcec828,_0xd0a2ce[_0x9b3f('0x91')],_0xd0a2ce[_0x9b3f('0x92')],_0xd0a2ce[_0x9b3f('0x93')])[_0x9b3f('0x14')](function(_0xe188ab){_0x249323(null,_0xe188ab);})[_0x9b3f('0x16')](function(_0xc41741){_0x249323(_0xc41741);});};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x94')]=function(_0x5d5ef4){var _0x5737d9=_['includes'](verticesWithRetry,_0x5d5ef4[_0x9b3f('0x95')])?_0x5d5ef4:_[_0x9b3f('0x96')](_0x5d5ef4);for(var _0xc2cfa9 in _0x5737d9){if(_0x5737d9[_0x9b3f('0x97')](_0xc2cfa9)){if(_0x5737d9[_0xc2cfa9]&&_[_0x9b3f('0x98')](_0x5737d9[_0xc2cfa9])){if(_['includes'](recursiveMapAttributes,_0xc2cfa9)){_0x5737d9[_0xc2cfa9]=this[_0x9b3f('0x99')](_0x5737d9[_0xc2cfa9]);}else{_0x5737d9[_0xc2cfa9]=this[_0x9b3f('0x9a')](_0x5737d9[_0xc2cfa9]);}}}}return _0x5737d9;};AGIVertices['prototype'][_0x9b3f('0x9b')]=function(_0x4ca8f6){for(var _0x1c3c53 in _0x4ca8f6){if(_0x4ca8f6[_0x9b3f('0x97')](_0x1c3c53)){if(_[_0x9b3f('0x9c')](_0x4ca8f6[_0x1c3c53])){this[_0x9b3f('0x9b')](_0x4ca8f6[_0x1c3c53]);}else if(_[_0x9b3f('0x9d')](_0x4ca8f6[_0x1c3c53])){for(var _0x50e3f3=0x0;_0x50e3f3<_0x4ca8f6[_0x1c3c53][_0x9b3f('0x9e')];_0x50e3f3++){this[_0x9b3f('0x9b')](_0x4ca8f6[_0x1c3c53][_0x50e3f3]);}}else if(_[_0x9b3f('0x98')](_0x4ca8f6[_0x1c3c53])){_0x4ca8f6[_0x1c3c53]=this[_0x9b3f('0x9a')](_0x4ca8f6[_0x1c3c53]);}}}};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x9f')]=function(_0x194055,_0x77d7f8){for(var _0x23c665 in _0x194055){if(_0x194055[_0x9b3f('0x97')](_0x23c665)){if(_[_0x9b3f('0x9c')](_0x194055[_0x23c665])){if(!_[_0x9b3f('0x43')](_0x194055[_0x23c665])){this[_0x9b3f('0x9f')](_0x194055[_0x23c665],util[_0x9b3f('0x29')](_0x9b3f('0xa0'),_0x77d7f8,_0x23c665));}}else if(_[_0x9b3f('0x9d')](_0x194055[_0x23c665])){for(var _0x3cd602=0x0;_0x3cd602<_0x194055[_0x23c665][_0x9b3f('0x9e')];_0x3cd602++){this[_0x9b3f('0x9f')](_0x194055[_0x23c665][_0x3cd602],util['format'](_0x9b3f('0xa0'),_0x77d7f8,_0x23c665+'['+_0x3cd602+']'));}}else{if(!_[_0x9b3f('0x44')](_0x194055[_0x23c665])){this[_0x9b3f('0xe')][_0x9b3f('0xa1')](util['format'](_0x9b3f('0xa0'),_0x77d7f8,_0x23c665),_0x194055[_0x23c665]);}}}}};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x99')]=function(_0x2c9c07){try{var _0x35c67f=JSON[_0x9b3f('0x69')](_0x2c9c07);this[_0x9b3f('0x9b')](_0x35c67f);return JSON[_0x9b3f('0x70')](_0x35c67f);}catch(_0x4ed679){return this[_0x9b3f('0x9a')](_0x2c9c07);}};AGIVertices[_0x9b3f('0x11')]['replaceAllVariables']=function(_0x2bb67b){var _0x27d8b5=_0x2bb67b['split']('{');for(var _0xc375b8=0x1;_0xc375b8<_0x27d8b5[_0x9b3f('0x9e')];_0xc375b8+=0x1){var _0x358291=_0x27d8b5[_0xc375b8]['split']('}');if(_0x358291[_0x9b3f('0x9e')]>0x1){_0x2bb67b=_0x2bb67b[_0x9b3f('0xa2')]('{'+_0x358291[0x0]+'}',this['channel'][_0x9b3f('0x12')](_0x358291[0x0])[_0x9b3f('0xa3')]||_0x358291[0x0]);}}if(_0x27d8b5['length']===0x1){return _0x2bb67b[_0x9b3f('0xa4')]();}return this[_0x9b3f('0x9a')](_0x2bb67b);};AGIVertices[_0x9b3f('0x11')]['getAndSetVariable']=function(_0x5c9aa2,_0x281e10){var _0x1ba562=this[_0x9b3f('0xe')][_0x9b3f('0x12')](_0x5c9aa2);if(_0x1ba562['result']===-0x1){return _0x1ba562;}logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x281e10,_0x1ba562[_0x9b3f('0xa3')]));return this[_0x9b3f('0xe')][_0x9b3f('0xa1')](_0x281e10,_0x1ba562[_0x9b3f('0xa3')]);};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0xa5')]=function(_0x40b876){return _0x40b876&&_0x40b876!=='0'&&_0x40b876!=='-1'&&_0x40b876!=='';};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0xa6')]=function(_0x452f4c){this[_0x9b3f('0x37')][_0x9b3f('0x6e')](this,_0x452f4c,'-');_0x452f4c[_0x9b3f('0xa7')]=_0x452f4c[_0x9b3f('0xa6')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0xa8')]=function(_0x23358e){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x23358e[_0x9b3f('0x39')]));if(!this[_0x9b3f('0xa5')](_0x23358e['text'])){return this[_0x9b3f('0xe')]['noop']('no\x20text\x20configured');}var _0x38a7de='\x22'+_0x23358e[_0x9b3f('0x5b')]+'\x22';if(this[_0x9b3f('0xa5')](_0x23358e['options'])){_0x38a7de+=','+_0x23358e[_0x9b3f('0x76')];}var _0xb2aefa=this[_0x9b3f('0xe')][_0x9b3f('0x56')](_0x9b3f('0xa9'),_0x38a7de);if(_0xb2aefa[_0x9b3f('0xaa')]===-0x1){return _0xb2aefa;}return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')]('Executed\x20command\x20MRCPSynth\x20%s',_0x38a7de));};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0xac')]=function(_0x463be4){logger['info'](util[_0x9b3f('0x29')](_0x9b3f('0xad'),_0x463be4[_0x9b3f('0x39')]));if(!this[_0x9b3f('0xa5')](_0x463be4[_0x9b3f('0xae')])){return this[_0x9b3f('0xe')]['noop'](_0x9b3f('0xaf'));}var _0x37fa14=_0x463be4[_0x9b3f('0xae')];if(this[_0x9b3f('0xa5')](_0x463be4[_0x9b3f('0x76')])){_0x37fa14+=','+_0x463be4[_0x9b3f('0x76')];}var _0x5a90f9=this[_0x9b3f('0xe')][_0x9b3f('0x56')](_0x9b3f('0xb0'),_0x37fa14);if(_0x5a90f9[_0x9b3f('0xaa')]===-0x1){return _0x5a90f9;}var _0x213564=this[_0x9b3f('0xb1')](_0x9b3f('0xb2'),_0x9b3f('0xb3'));if(_0x213564[_0x9b3f('0xaa')]===-0x1){return _0x213564;}var _0x393a92=this[_0x9b3f('0xb1')](_0x9b3f('0xb4'),_0x9b3f('0xb5'));if(_0x393a92[_0x9b3f('0xaa')]===-0x1){return _0x393a92;}var _0x3ccf99=this[_0x9b3f('0xb1')](_0x9b3f('0xb6'),_0x9b3f('0xb7'));if(_0x3ccf99[_0x9b3f('0xaa')]===-0x1){return _0x3ccf99;}return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x37fa14));};AGIVertices['prototype'][_0x9b3f('0xb8')]=function(_0x2d82f5){logger[_0x9b3f('0x2d')](util['format'](_0x9b3f('0xb9'),_0x2d82f5[_0x9b3f('0x39')]));return this[_0x9b3f('0xe')]['agi']([_0x2d82f5[_0x9b3f('0xba')],_0x2d82f5['args']]);};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0xbb')]=function(_0x417011){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x417011['label']));if(this[_0x9b3f('0xa5')](_0x417011[_0x9b3f('0x64')])){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0xbc'),_0x417011['timeout']));var _0x17f751=this['channel']['wait'](_0x417011['timeout']);if(_0x17f751[_0x9b3f('0xaa')]===-0x1){return _0x17f751;}}return this[_0x9b3f('0xe')][_0x9b3f('0xbb')]();};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0xbd')]=function(_0x5122d5){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0xbe'),_0x5122d5['label']));if(!this[_0x9b3f('0xa5')](_0x5122d5[_0x9b3f('0x49')])){return this[_0x9b3f('0xe')]['error'](_0x5122d5,'no\x20list\x20selected');}_0x5122d5['scheduledAt']=moment();if(this[_0x9b3f('0xa5')](_0x5122d5[_0x9b3f('0xbf')])){_0x5122d5['scheduledAt']=moment()[_0x9b3f('0xc0')](_0x5122d5[_0x9b3f('0xbf')],_0x9b3f('0xc1'));}if(!this['isConfigured'](_0x5122d5[_0x9b3f('0x4b')])){_0x5122d5[_0x9b3f('0x4b')]=0x2;}this[_0x9b3f('0x42')][_0x9b3f('0x6e')](this,_0x5122d5);return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0xc2'),_0x5122d5[_0x9b3f('0x48')],_0x5122d5[_0x9b3f('0x49')],_0x5122d5[_0x9b3f('0x4a')]));};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0xc3')]=function(_0x208fc8){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0xc4'),_0x208fc8['label']));var _0x53a8c5=this[_0x9b3f('0xe')][_0x9b3f('0x56')](_0x208fc8['application'],_0x208fc8[_0x9b3f('0x76')]);if(_0x53a8c5[_0x9b3f('0xaa')]===-0x1){return _0x53a8c5;}return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')]('Executed\x20command\x20%s\x20%s',_0x208fc8[_0x9b3f('0xc5')],_0x208fc8['options']));};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0xc6')]=function(_0x1198cf){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x1198cf[_0x9b3f('0x39')]));if(!this[_0x9b3f('0xa5')](_0x1198cf[_0x9b3f('0x5b')])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x9b3f('0xc7'));}var _0x4eb412='\x22'+_0x1198cf[_0x9b3f('0x5b')]+'\x22';if(this[_0x9b3f('0xa5')](_0x1198cf[_0x9b3f('0x76')])){_0x4eb412+=','+_0x1198cf[_0x9b3f('0x76')];}var _0x2cf612=this[_0x9b3f('0xe')][_0x9b3f('0x56')]('MRCPSynth',_0x4eb412);if(_0x2cf612[_0x9b3f('0xaa')]===-0x1){return _0x2cf612;}return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0xc8'),_0x4eb412));};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0xc9')]=function(_0x4c2e46){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0xca'),_0x4c2e46[_0x9b3f('0x39')]));if(!this['isConfigured'](_0x4c2e46['text'])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x9b3f('0xc7'));}var _0x318347='\x22'+_0x4c2e46[_0x9b3f('0x5b')]+'\x22';if(this[_0x9b3f('0xa5')](_0x4c2e46[_0x9b3f('0x76')])){_0x318347+=','+_0x4c2e46[_0x9b3f('0x76')];}var _0x53aaf8=this[_0x9b3f('0xe')][_0x9b3f('0x56')](_0x9b3f('0xa9'),_0x318347);if(_0x53aaf8[_0x9b3f('0xaa')]===-0x1){return _0x53aaf8;}return this[_0x9b3f('0xe')]['noop'](util[_0x9b3f('0x29')](_0x9b3f('0xc8'),_0x318347));};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0xcb')]=function(_0x57948c){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0xcc'),_0x57948c[_0x9b3f('0x39')]));if(!this[_0x9b3f('0xa5')](_0x57948c['grammar'])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x9b3f('0xaf'));}var _0x3a2a81=_0x57948c['grammar'];if(this[_0x9b3f('0xa5')](_0x57948c[_0x9b3f('0x76')])){_0x3a2a81+=','+_0x57948c[_0x9b3f('0x76')];}var _0x347cd1=this['channel'][_0x9b3f('0x56')](_0x9b3f('0xb0'),_0x3a2a81);if(_0x347cd1[_0x9b3f('0xaa')]===-0x1){return _0x347cd1;}var _0x462b7b=this['getAndSetVariable'](_0x9b3f('0xb2'),_0x9b3f('0xcd'));if(_0x462b7b[_0x9b3f('0xaa')]===-0x1){return _0x462b7b;}var _0x23b58d=this[_0x9b3f('0xb1')]('RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT');if(_0x23b58d['result']===-0x1){return _0x23b58d;}var _0x1ef881=this[_0x9b3f('0xb1')](_0x9b3f('0xb6'),'LUMENVOX_ASR_INSTANCE');if(_0x1ef881[_0x9b3f('0xaa')]===-0x1){return _0x1ef881;}return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')]('Executed\x20command\x20MRCPRecog\x20%s',_0x3a2a81));};AGIVertices['prototype'][_0x9b3f('0xce')]=function(_0x3cee1d){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0xcf'),_0x3cee1d[_0x9b3f('0x39')]));if(!this[_0x9b3f('0xa5')](_0x3cee1d['grammar'])){return this[_0x9b3f('0xe')]['noop'](_0x9b3f('0xaf'));}var _0x205f9b=_0x3cee1d[_0x9b3f('0xae')];if(this['isConfigured'](_0x3cee1d[_0x9b3f('0x76')])){_0x205f9b+=','+_0x3cee1d[_0x9b3f('0x76')];}var _0xc4ee11=this[_0x9b3f('0xe')][_0x9b3f('0x56')](_0x9b3f('0xb0'),_0x205f9b);if(_0xc4ee11[_0x9b3f('0xaa')]===-0x1){return _0xc4ee11;}var _0x36bac2=this['getAndSetVariable'](_0x9b3f('0xb2'),'SESTEK_ASR_CONFIDENCE');if(_0x36bac2['result']===-0x1){return _0x36bac2;}var _0x473ab8=this[_0x9b3f('0xb1')](_0x9b3f('0xb4'),'SESTEK_ASR_TRANSCRIPT');if(_0x473ab8['result']===-0x1){return _0x473ab8;}var _0x16ec87=this[_0x9b3f('0xb1')](_0x9b3f('0xb6'),_0x9b3f('0xd0'));if(_0x16ec87[_0x9b3f('0xaa')]===-0x1){return _0x16ec87;}return this['channel'][_0x9b3f('0xab')](util[_0x9b3f('0x29')]('Executed\x20command\x20MRCPRecog\x20%s',_0x205f9b));};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0xd1')]=function(_0x2f1ca){logger[_0x9b3f('0x2d')](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x2f1ca[_0x9b3f('0x39')]));if(!this[_0x9b3f('0xa5')](_0x2f1ca[_0x9b3f('0xd2')])){return this[_0x9b3f('0xe')]['error'](_0x2f1ca,_0x9b3f('0xd3'));}var _0x45fbae=this[_0x9b3f('0xd4')][_0x9b3f('0x6e')](this,_0x2f1ca[_0x9b3f('0xd2')]);if(!_0x45fbae){return this[_0x9b3f('0xe')]['error'](_0x2f1ca,'no\x20odbc\x20database\x20found');}if(!this[_0x9b3f('0xa5')](_0x2f1ca['query'])){return this[_0x9b3f('0xe')][_0x9b3f('0x32')](_0x2f1ca,'no\x20query\x20configured');}var _0x2d6210=_0x2f1ca[_0x9b3f('0x2f')][_0x9b3f('0xd5')](/(\r\n|\n|\r)/gm,'\x20');this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0xd6'),_0x2d6210));var _0xd0a0a0=this[_0x9b3f('0xd7')][_0x9b3f('0x6e')](this,_0x45fbae,_0x2d6210);this[_0x9b3f('0x37')][_0x9b3f('0x6e')](this,_0x2f1ca,_0x2d6210);if(!this['isConfigured'](_0x2f1ca[_0x9b3f('0xd8')])){return this[_0x9b3f('0xe')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x5b8dcf=this[_0x9b3f('0x12')][_0x9b3f('0x6e')](this,_0x2f1ca['variable_id']);if(!_0x5b8dcf){return this['channel'][_0x9b3f('0x32')](_0x2f1ca,_0x9b3f('0xd9'));}var _0x1b0681=this;_0xd0a0a0[_0x9b3f('0xda')](function(_0x39b943,_0x340b33){Object[_0x9b3f('0xdb')](_0x39b943)[_0x9b3f('0xda')](function(_0x3c3a55){_0x1b0681[_0x9b3f('0xe')]['setVariable'](util['format']('%s[%s][%s]',_0x5b8dcf,_0x340b33,_0x3c3a55),_0x39b943[_0x3c3a55]);});});this[_0x9b3f('0xe')][_0x9b3f('0xa1')](util[_0x9b3f('0x29')](_0x9b3f('0xdc'),_0x5b8dcf),_0xd0a0a0[_0x9b3f('0x9e')]);return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util['format'](_0x9b3f('0xdd'),_0x5b8dcf));};AGIVertices['prototype'][_0x9b3f('0xde')]=function(_0x2bc6ac){logger[_0x9b3f('0xdf')](util[_0x9b3f('0x29')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x2bc6ac[_0x9b3f('0x39')]));if(!this[_0x9b3f('0xa5')](_0x2bc6ac[_0x9b3f('0xe0')])){return this[_0x9b3f('0xe')]['error'](_0x2bc6ac,'no\x20user\x20selected');}var _0x1e11be=this['getUser'][_0x9b3f('0x6e')](this,_0x2bc6ac['sip_id']);if(!_0x1e11be){return this[_0x9b3f('0xe')][_0x9b3f('0x32')](_0x2bc6ac,_0x9b3f('0xe1'));}var _0x1577e7=this[_0x9b3f('0xe')]['exec']('DIAL',[util['format'](_0x9b3f('0xe2'),_0x1e11be),_0x2bc6ac[_0x9b3f('0x64')],_0x2bc6ac[_0x9b3f('0xe3')],_0x2bc6ac[_0x9b3f('0xe4')]]);if(_0x1577e7[_0x9b3f('0xaa')]===-0x1){return _0x1577e7;}return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0xe5'),_0x9b3f('0xe6')));};AGIVertices['prototype'][_0x9b3f('0xe7')]=function(_0x4940aa){logger['info'](util['format'](_0x9b3f('0xe8'),_0x4940aa[_0x9b3f('0x39')]));if(!this[_0x9b3f('0xa5')](_0x4940aa[_0x9b3f('0x78')])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x9b3f('0xe9'));}if(!this[_0x9b3f('0xa5')](_0x4940aa['text'])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x9b3f('0xc7'));}this[_0x9b3f('0xe')][_0x9b3f('0xea')]=!![];this[_0x9b3f('0x37')](_0x4940aa);this[_0x9b3f('0x41')](_0x4940aa['text'],'in','','');this['channel'][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0xeb'),_0x4940aa[_0x9b3f('0x5b')]));var _0x116955=this[_0x9b3f('0x77')][_0x9b3f('0x6e')](this,_0x4940aa);if(_0x116955){for(var _0x39dfaf in _0x116955){if(_0x116955[_0x9b3f('0x97')](_0x39dfaf)){this[_0x9b3f('0xe')][_0x9b3f('0xa1')](util[_0x9b3f('0x29')](_0x9b3f('0xec'),_0x39dfaf['toUpperCase']()),_0x116955[_0x39dfaf]);}}this[_0x9b3f('0x41')](_0x116955[_0x9b3f('0xed')],_0x9b3f('0xee'),_0x9b3f('0xe7'),'');return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0xef'),_0x116955[_0x9b3f('0xed')]));}return this['channel'][_0x9b3f('0x32')](_0x4940aa,_0x9b3f('0xf0'));};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0xf1')]=function(_0x24aebf){logger['info'](util[_0x9b3f('0x29')](_0x9b3f('0xf2'),_0x24aebf[_0x9b3f('0x39')]));if(!this[_0x9b3f('0xa5')](_0x24aebf[_0x9b3f('0xf3')])){return this['channel'][_0x9b3f('0xab')](_0x9b3f('0xf4'));}if(!this[_0x9b3f('0xa5')](_0x24aebf[_0x9b3f('0x7b')])){return this['channel']['noop']('no\x20client_email\x20configured');}if(!this[_0x9b3f('0xa5')](_0x24aebf[_0x9b3f('0x7c')])){return this['channel'][_0x9b3f('0xab')]('no\x20private_key\x20configured');}if(!this[_0x9b3f('0xa5')](_0x24aebf[_0x9b3f('0x7d')])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')]('no\x20anguage\x20configured');}if(!this[_0x9b3f('0xa5')](_0x24aebf[_0x9b3f('0x5b')])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')]('no\x20text\x20configured');}this['channel']['bot']=!![];this[_0x9b3f('0x37')](_0x24aebf);this['createSquareMessage'](_0x24aebf[_0x9b3f('0x5b')],'in','','');this['channel'][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0xf5'),_0x24aebf[_0x9b3f('0x5b')]));var _0x556851=this[_0x9b3f('0x7a')]['sync'](this,_0x24aebf);if(_0x556851){for(var _0x26fb1c in _0x556851){if(_0x556851[_0x9b3f('0x97')](_0x26fb1c)){if(_0x26fb1c!==_0x9b3f('0xf6')){this['channel'][_0x9b3f('0xa1')](util[_0x9b3f('0x29')](_0x9b3f('0xec'),_0x26fb1c[_0x9b3f('0x68')]()),_0x556851[_0x26fb1c]);}}}this[_0x9b3f('0x41')](_0x556851[_0x9b3f('0xed')],_0x9b3f('0xee'),_0x9b3f('0xf1'),_0x556851[_0x9b3f('0xf6')]);return this['channel']['noop'](util[_0x9b3f('0x29')](_0x9b3f('0xf7'),_0x556851['speech']));}return this[_0x9b3f('0xe')][_0x9b3f('0x32')](_0x24aebf,_0x9b3f('0xf8'));};AGIVertices[_0x9b3f('0x11')]['sesteknda']=function(_0x547a4d){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0xf9'),_0x547a4d['label']));if(!this[_0x9b3f('0xa5')](_0x547a4d['ndauth_url'])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')]('no\x20ndauth\x20url\x20configured');}if(!this['isConfigured'](_0x547a4d[_0x9b3f('0xfa')])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x9b3f('0xfb'));}if(!this[_0x9b3f('0xa5')](_0x547a4d[_0x9b3f('0xfc')])){return this['channel'][_0x9b3f('0xab')](_0x9b3f('0xfd'));}if(!this[_0x9b3f('0xa5')](_0x547a4d[_0x9b3f('0xfe')])){return this['channel'][_0x9b3f('0xab')](_0x9b3f('0xc7'));}this[_0x9b3f('0xe')]['bot']=!![];this[_0x9b3f('0x37')](_0x547a4d);this[_0x9b3f('0x41')](_0x547a4d['text'],'in','','');this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')]('Trying\x20SestekNDA:\x20%s',_0x547a4d['text']));var _0x9fc04e=this['sestekNDA'][_0x9b3f('0x6e')](this,_0x547a4d);if(_0x9fc04e){for(var _0x2f6a98 in _0x9fc04e){if(_0x9fc04e['hasOwnProperty'](_0x2f6a98)){this[_0x9b3f('0xe')]['setVariable'](util[_0x9b3f('0x29')](_0x9b3f('0xff'),_0x2f6a98[_0x9b3f('0x68')]()),_0x9fc04e[_0x2f6a98]);}}this[_0x9b3f('0x41')](_0x9fc04e[_0x9b3f('0xed')],_0x9b3f('0xee'),'sesteknda','');if(_0x9fc04e[_0x9b3f('0x100')]){this[_0x9b3f('0xe')]['noop'](util[_0x9b3f('0x29')](_0x9b3f('0x101'),_0x9fc04e[_0x9b3f('0x100')]));var _0x109e1b=this[_0x9b3f('0xe')][_0x9b3f('0x102')](_0x9fc04e[_0x9b3f('0x100')]);try{fs[_0x9b3f('0x103')](_0x9fc04e['audiofile']+'.wav');}catch(_0x381c96){logger['error'](_0x381c96);}return _0x109e1b;}else{return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0x104'),_0x9fc04e['speech']));}}return this[_0x9b3f('0xe')][_0x9b3f('0x32')](_0x547a4d,_0x9b3f('0x105'));};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x106')]=function(_0x52fdd6){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x107'),_0x52fdd6[_0x9b3f('0x39')]));return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x9b3f('0x106'));};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x108')]=function(_0x32cdc0){logger['info'](util[_0x9b3f('0x29')](_0x9b3f('0x109'),_0x32cdc0[_0x9b3f('0x39')]));var _0x3ed5e5='';if(_0x32cdc0[_0x9b3f('0x10a')]){if(!this[_0x9b3f('0xa5')](_0x32cdc0[_0x9b3f('0x10a')])){return this['channel'][_0x9b3f('0x32')](_0x32cdc0,_0x9b3f('0x10b'));}else{var _0x33af50=parseInt(_0x32cdc0[_0x9b3f('0x10a')],0xa);if(isNaN(_0x33af50)){_0x3ed5e5=_0x32cdc0['trunk_id'];}else{_0x3ed5e5=this[_0x9b3f('0x1e')][_0x9b3f('0x6e')](this,_0x32cdc0[_0x9b3f('0x10a')]);if(!_0x3ed5e5){return this[_0x9b3f('0xe')][_0x9b3f('0x32')](_0x32cdc0,_0x9b3f('0x10c'));}}}}else if(_0x32cdc0[_0x9b3f('0x10d')]){_0x3ed5e5=_0x32cdc0[_0x9b3f('0x10d')];}else{return this[_0x9b3f('0xe')][_0x9b3f('0x32')](_0x32cdc0,_0x9b3f('0x10b'));}var _0x424080=this['channel'][_0x9b3f('0x56')](_0x9b3f('0xe6'),[util[_0x9b3f('0x29')](_0x9b3f('0x10e'),_0x3ed5e5,_0x32cdc0[_0x9b3f('0x48')]),_0x32cdc0[_0x9b3f('0x64')],_0x32cdc0[_0x9b3f('0xe3')],_0x32cdc0['url']]);if(_0x424080[_0x9b3f('0xaa')]===-0x1){return _0x424080;}return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')]('Executed\x20command\x20%s','DIAL'));};AGIVertices['prototype'][_0x9b3f('0x10f')]=function(_0x15537e){logger['info'](util[_0x9b3f('0x29')](_0x9b3f('0x110'),_0x15537e[_0x9b3f('0x39')]));return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x9b3f('0x10f'));};AGIVertices['prototype']['getdigits']=function(_0x311627){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x111'),_0x311627['label']));if(_0x311627[_0x9b3f('0xa7')]===0x0){return this[_0x9b3f('0xa6')](_0x311627);}_0x311627[_0x9b3f('0xa7')]-=0x1;if(!this['isConfigured'](_0x311627[_0x9b3f('0x112')])){return this['channel']['error'](_0x311627,_0x9b3f('0x113'));}var _0x1ee772=this[_0x9b3f('0x1f')][_0x9b3f('0x6e')](this,_0x311627[_0x9b3f('0x112')]);if(!_0x1ee772){return this['channel']['error'](_0x311627,'no\x20file\x20audio\x20found');}if(!this[_0x9b3f('0xa5')](_0x311627['variable_id'])){return this[_0x9b3f('0xe')]['error'](_0x9b3f('0x114'));}var _0x32b727=this[_0x9b3f('0xe')]['getData'](_0x1ee772,_0x311627[_0x9b3f('0x115')],_0x311627[_0x9b3f('0x116')]);var _0x18772b=_0x32b727['result']?_0x32b727[_0x9b3f('0xaa')][_0x9b3f('0xa4')]():'';logger['info'](_0x9b3f('0x117'),JSON[_0x9b3f('0x70')](_0x32b727));if(_0x32b727[_0x9b3f('0xaa')]===-0x1){this[_0x9b3f('0x37')]['sync'](this,_0x311627,_0x18772b);return _0x32b727;}else if(_0x32b727[_0x9b3f('0xa3')]===_0x9b3f('0x64')){_0x32b727[_0x9b3f('0xaa')]=_0x18772b[_0x9b3f('0x9e')]>=parseInt(_0x311627['mindigit'])?'x':'i';}else{_0x32b727['result']=_0x18772b[_0x9b3f('0x9e')]>=parseInt(_0x311627[_0x9b3f('0x118')])&&_0x18772b[_0x9b3f('0x9e')]<=parseInt(_0x311627[_0x9b3f('0x116')])?'x':'i';}var _0x458194=this['getVariable'][_0x9b3f('0x6e')](this,_0x311627[_0x9b3f('0xd8')]);if(!_0x458194){return this['channel'][_0x9b3f('0x32')](_0x311627,_0x9b3f('0xd9'));}this[_0x9b3f('0xe')][_0x9b3f('0xa1')](_0x458194,_0x18772b);if(this[_0x9b3f('0xa5')](_0x311627['hiddendigitsnum'])){var _0x5c4dc6=parseInt(_0x311627[_0x9b3f('0x119')],0xa);var _0x31a33c=rs['generate']({'charset':'*','length':_0x5c4dc6});var _0x3afabc=_0x18772b[_0x9b3f('0x9e')];if(_0x3afabc>0x0){if(_0x3afabc>_0x5c4dc6){this[_0x9b3f('0x37')][_0x9b3f('0x6e')](this,_0x311627,_0x311627[_0x9b3f('0x11a')]===_0x9b3f('0x11b')?_0x31a33c+_0x18772b['substr'](_0x5c4dc6):_0x18772b[_0x9b3f('0x11c')](0x0,_0x3afabc-_0x5c4dc6)+_0x31a33c);}else{this['createSquareDetailsReport']['sync'](this,_0x311627,rs['generate']({'charset':'*','length':_0x3afabc}));}}else{this[_0x9b3f('0x37')][_0x9b3f('0x6e')](this,_0x311627,'');}}else{this[_0x9b3f('0x37')]['sync'](this,_0x311627,_0x18772b);}return _0x32b727;};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x11d')]=function(_0x4dd2dc){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x11e'),_0x4dd2dc[_0x9b3f('0x39')]));return this['getdigits'](_0x4dd2dc);};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x11f')]=function(_0x1a8076){logger['info'](util['format'](_0x9b3f('0x120'),_0x1a8076['label']));this[_0x9b3f('0x37')][_0x9b3f('0x6e')](this,_0x1a8076,_0x1a8076[_0x9b3f('0x121')]);return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')]('GOAL\x20%s',_0x1a8076[_0x9b3f('0x121')]));};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x122')]=function(_0x3a1fd1){logger['info'](util[_0x9b3f('0x29')](_0x9b3f('0x123'),_0x3a1fd1['label']));if(!this['isConfigured'](_0x3a1fd1[_0x9b3f('0x86')])||!this['isConfigured'](_0x3a1fd1['aws_secret_access_key'])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x3a1fd1['text'])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x9b3f('0xc7'));}this[_0x9b3f('0xe')][_0x9b3f('0xab')](util['format'](_0x9b3f('0x124'),_0x3a1fd1[_0x9b3f('0x5b')]));var _0x130fca=this[_0x9b3f('0x85')][_0x9b3f('0x6e')](this,_0x3a1fd1);if(_0x130fca){this[_0x9b3f('0xe')]['noop'](util[_0x9b3f('0x29')](_0x9b3f('0x125'),_0x130fca));var _0x4d20cb=this[_0x9b3f('0xe')]['streamFile'](_0x130fca);try{fs[_0x9b3f('0x103')](_0x130fca+'.wav');}catch(_0x7bb515){logger[_0x9b3f('0x32')](_0x7bb515);}return _0x4d20cb;}return this['channel'][_0x9b3f('0x32')](_0x3a1fd1,_0x9b3f('0x126'));};AGIVertices['prototype']['awslex']=function(_0x10daa1){logger['info'](util[_0x9b3f('0x29')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x10daa1['label']));if(!this[_0x9b3f('0xa5')](_0x10daa1[_0x9b3f('0x86')])||!this[_0x9b3f('0xa5')](_0x10daa1[_0x9b3f('0x87')])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x9b3f('0x127'));}if(!this[_0x9b3f('0xa5')](_0x10daa1['aws_bot_name'])){return this[_0x9b3f('0xe')]['noop']('no\x20bot\x20name\x20configured');}if(!this[_0x9b3f('0xa5')](_0x10daa1[_0x9b3f('0x5b')])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x9b3f('0xc7'));}this['channel'][_0x9b3f('0xea')]=!![];this[_0x9b3f('0x37')](_0x10daa1);this['createSquareMessage'](_0x10daa1[_0x9b3f('0x5b')],'in','','');this[_0x9b3f('0xe')]['noop'](util['format']('Trying\x20Amazon\x20Lex:\x20%s',_0x10daa1[_0x9b3f('0x5b')]));var _0x1ec1a3=this[_0x9b3f('0x8b')][_0x9b3f('0x6e')](this,_0x10daa1);if(_0x1ec1a3){for(var _0xbd270e in _0x1ec1a3){if(_0x1ec1a3[_0x9b3f('0x97')](_0xbd270e)&&_[_0x9b3f('0x98')](_0x1ec1a3[_0xbd270e])){this[_0x9b3f('0xe')][_0x9b3f('0xa1')](util[_0x9b3f('0x29')](_0x9b3f('0x128'),_0xbd270e['toUpperCase']()),_0x1ec1a3[_0xbd270e]);}}if(_['isNil'](_0x1ec1a3[_0x9b3f('0x129')])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x9b3f('0x12a'));}else{this[_0x9b3f('0x41')](_0x1ec1a3[_0x9b3f('0x129')],'out',_0x9b3f('0x12b'),'');return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')]('Amazon\x20Lex\x20Result\x20%s',_0x1ec1a3[_0x9b3f('0x129')]));}}return this[_0x9b3f('0xe')]['error'](_0x10daa1,_0x9b3f('0x12c'));};AGIVertices[_0x9b3f('0x11')]['googleasr']=function(_0x2abb80){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x12d'),_0x2abb80[_0x9b3f('0x39')],_0x2abb80[_0x9b3f('0x64')]));if(!this[_0x9b3f('0xa5')](_0x2abb80[_0x9b3f('0x78')])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')]('no\x20key\x20configured');}var _0x453bd7=_0x9b3f('0x12e');var _0x565042=util[_0x9b3f('0x29')](_0x9b3f('0x12f'),FILES_PATH,rs['generate'](0x4));var _0x1b236e=util['format'](_0x9b3f('0xa0'),_0x565042,_0x453bd7);var _0x135f62=!![];if(_0x2abb80[_0x9b3f('0x130')]===_0x9b3f('0x131')){_0x135f62=![];}var _0x37563d=this['channel'][_0x9b3f('0x132')](_0x565042,_0x453bd7,_0x2abb80['intKey'],_0x2abb80['timeout'],undefined,_0x135f62);if(_0x37563d[_0x9b3f('0xaa')]!==-0x1){this['channel'][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0x133'),_0x1b236e));var _0x1d7806=this[_0x9b3f('0x8e')][_0x9b3f('0x6e')](this,_0x2abb80,_0x1b236e);if(_0x1d7806){for(var _0xb02244 in _0x1d7806){if(_0x1d7806[_0x9b3f('0x97')](_0xb02244)){this['channel'][_0x9b3f('0xa1')](util['format'](_0x9b3f('0x134'),_0xb02244[_0x9b3f('0x68')]()),_0x1d7806[_0xb02244]);}}return this['channel'][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0x135'),JSON['stringify'](_0x1d7806)));}}return _0x37563d;};AGIVertices[_0x9b3f('0x11')]['tildeasr']=function(_0x3f1b6b){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x136'),_0x3f1b6b['label']));if(!this[_0x9b3f('0xa5')](_0x3f1b6b[_0x9b3f('0x91')])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')]('no\x20appid\x20configured');}if(!this['isConfigured'](_0x3f1b6b['appsecret'])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')]('no\x20appsecret\x20configured');}var _0x4a7450='wav';var _0x47ad5f=util[_0x9b3f('0x29')](_0x9b3f('0x12f'),FILES_PATH,rs[_0x9b3f('0x137')](0x4));var _0x3df2be=util['format'](_0x9b3f('0xa0'),_0x47ad5f,_0x4a7450);var _0x271ad8=!![];if(_0x3f1b6b[_0x9b3f('0x130')]===_0x9b3f('0x131')){_0x271ad8=![];}var _0x19bfc9=this[_0x9b3f('0xe')][_0x9b3f('0x132')](_0x47ad5f,_0x4a7450,_0x3f1b6b[_0x9b3f('0x138')],_0x3f1b6b[_0x9b3f('0x64')],undefined,_0x271ad8);if(_0x19bfc9[_0x9b3f('0xaa')]!==-0x1){this[_0x9b3f('0xe')][_0x9b3f('0xab')](util['format'](_0x9b3f('0x139'),_0x3df2be));var _0x1948cb=this[_0x9b3f('0x90')]['sync'](this,_0x3f1b6b,_0x3df2be);if(_0x1948cb){for(var _0x46e872 in _0x1948cb){if(_0x1948cb[_0x9b3f('0x97')](_0x46e872)){this[_0x9b3f('0xe')][_0x9b3f('0xa1')](util[_0x9b3f('0x29')](_0x9b3f('0x13a'),_0x46e872['toUpperCase']()),_0x1948cb[_0x46e872]);}}return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util['format'](_0x9b3f('0x13b'),JSON[_0x9b3f('0x70')](_0x1948cb)));}}return _0x19bfc9;};AGIVertices[_0x9b3f('0x11')]['gotoc']=function(_0x3ffe9e){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x3ffe9e[_0x9b3f('0x39')]));return this[_0x9b3f('0xe')]['continueAt'](_0x3ffe9e[_0x9b3f('0x13c')],_0x3ffe9e[_0x9b3f('0x13d')],_0x3ffe9e['priority']);};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x13e')]=function(_0x86726b){logger[_0x9b3f('0x2d')](util['format']('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x86726b['label']));if(!this['isConfigured'](_0x86726b['condition'])){return this[_0x9b3f('0xe')][_0x9b3f('0x32')](_0x86726b,_0x9b3f('0x13f'));}try{var _0x436de0=eval(_0x86726b[_0x9b3f('0x140')])?_0x9b3f('0x141'):_0x9b3f('0x142');this[_0x9b3f('0xe')][_0x9b3f('0xab')](util['format'](_0x9b3f('0x143'),_0x86726b['condition'],_0x436de0));return{'code':0xc8,'result':_0x436de0};}catch(_0x4233ca){return{'code':0xc8,'result':_0x9b3f('0x142')};}};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x144')]=function(_0x276f5d){logger['info'](util[_0x9b3f('0x29')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x276f5d['label']));if(!this[_0x9b3f('0xa5')](_0x276f5d[_0x9b3f('0x145')])){return this[_0x9b3f('0xe')][_0x9b3f('0x32')](_0x276f5d,'no\x20interval\x20configured');}var _0x53616a=this['getIntervals'][_0x9b3f('0x6e')](this,_0x276f5d[_0x9b3f('0x145')]);if(!_0x53616a){return this['channel'][_0x9b3f('0x32')](_0x276f5d,'no\x20intervals\x20found');}for(var _0x2415ae=0x0;_0x2415ae<_0x53616a[_0x9b3f('0x9e')];_0x2415ae+=0x1){var _0x72407c=this[_0x9b3f('0xe')][_0x9b3f('0x12')](util[_0x9b3f('0x29')](_0x9b3f('0x146'),_0x53616a[_0x2415ae]));if(_0x72407c[_0x9b3f('0xaa')]===-0x1){return _0x72407c;}logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x147'),_0x53616a[_0x2415ae],_0x72407c['extra']));if(_0x72407c[_0x9b3f('0xa3')]===_0x9b3f('0x141')){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')]('IFTIME\x20%s\x20%s',_0x53616a[_0x2415ae],'true'));this[_0x9b3f('0xe')][_0x9b3f('0xab')](util['format'](_0x9b3f('0x147'),_0x53616a[_0x2415ae],_0x9b3f('0x141')));return{'code':0xc8,'result':_0x9b3f('0x141')};}else{logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')]('IFTIME\x20%s\x20%s',_0x53616a[_0x2415ae],_0x9b3f('0x142')));this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0x147'),_0x53616a[_0x2415ae],_0x9b3f('0x142')));}}return{'code':0xc8,'result':_0x9b3f('0x142')};};AGIVertices['prototype'][_0x9b3f('0x148')]=function(_0x36d767){logger['info'](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x36d767[_0x9b3f('0x39')]));return this['channel'][_0x9b3f('0x148')]();};AGIVertices['prototype'][_0x9b3f('0x149')]=function(_0x39151a){logger['info'](util[_0x9b3f('0x29')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x39151a[_0x9b3f('0x39')]));if(!this[_0x9b3f('0xa5')](_0x39151a[_0x9b3f('0x78')])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x9b3f('0xe9'));}var _0x29cae0=_0x9b3f('0x12e');var _0x10bce2=util[_0x9b3f('0x29')](_0x9b3f('0x12f'),FILES_PATH,rs[_0x9b3f('0x137')](0x4));var _0x51f475=util['format'](_0x9b3f('0xa0'),_0x10bce2,_0x29cae0);var _0x2b455f=!![];if(_0x39151a['beep']==='NOBEEP'){_0x2b455f=![];}var _0x4a97fb=this[_0x9b3f('0xe')][_0x9b3f('0x132')](_0x10bce2,_0x29cae0,_0x39151a[_0x9b3f('0x138')],_0x39151a[_0x9b3f('0x64')],undefined,_0x2b455f);if(_0x4a97fb['result']!==-0x1){this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')]('ispeech\x20%s\x20file\x20created',_0x51f475));var _0x4d0fae=this[_0x9b3f('0x82')]['sync'](this,_0x39151a,_0x51f475);if(_0x4d0fae){for(var _0x14716b in _0x4d0fae){if(_0x4d0fae[_0x9b3f('0x97')](_0x14716b)){this[_0x9b3f('0xe')][_0x9b3f('0xa1')](util[_0x9b3f('0x29')](_0x9b3f('0x14a'),_0x14716b[_0x9b3f('0x68')]()),_0x4d0fae[_0x14716b]);}}return this[_0x9b3f('0xe')]['noop'](util[_0x9b3f('0x29')](_0x9b3f('0x14b'),JSON[_0x9b3f('0x70')](_0x4d0fae)));}}return _0x4a97fb;};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x14c')]=function(_0x23f80f){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x14d'),_0x23f80f[_0x9b3f('0x39')]));if(!this[_0x9b3f('0xa5')](_0x23f80f[_0x9b3f('0x78')])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')]('no\x20key\x20configured');}if(!this[_0x9b3f('0xa5')](_0x23f80f[_0x9b3f('0x5b')])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x9b3f('0xc7'));}this[_0x9b3f('0xe')][_0x9b3f('0xab')](util['format'](_0x9b3f('0x14e'),_0x23f80f['text']));var _0x12eda7=this[_0x9b3f('0x7f')][_0x9b3f('0x6e')](this,_0x23f80f);if(_0x12eda7){this[_0x9b3f('0xe')]['noop'](util['format'](_0x9b3f('0x14f'),_0x12eda7));var _0x4d9f59=this[_0x9b3f('0xe')][_0x9b3f('0x102')](_0x12eda7,_0x23f80f['intKey']);try{fs[_0x9b3f('0x103')](_0x12eda7+'.wav');}catch(_0x1f26a6){logger[_0x9b3f('0x32')](_0x1f26a6);}return _0x4d9f59;}return this['channel'][_0x9b3f('0x32')](_0x23f80f,_0x9b3f('0x150'));};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x151')]=function(_0x10b547){logger['info'](util['format'](_0x9b3f('0x152'),_0x10b547[_0x9b3f('0x39')]));if(!this['isConfigured'](_0x10b547[_0x9b3f('0x153')])){return this[_0x9b3f('0xe')][_0x9b3f('0x32')](_0x10b547,_0x9b3f('0x154'));}logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x9b3f('0xe')][_0x9b3f('0x3b')],_0x10b547['findBy']));var _0x5bde7b=this['agentLogin'][_0x9b3f('0x6e')](this,_0x10b547[_0x9b3f('0x153')]);if(_0x5bde7b){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x155'),this[_0x9b3f('0xe')][_0x9b3f('0x3b')],_0x10b547[_0x9b3f('0x153')]));this['channel']['noop'](util[_0x9b3f('0x29')](_0x9b3f('0x155'),this[_0x9b3f('0xe')][_0x9b3f('0x3b')],_0x10b547[_0x9b3f('0x153')]));return{'code':0xc8,'result':_0x9b3f('0x156')};}else{logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x157'),this['channel'][_0x9b3f('0x3b')],_0x10b547[_0x9b3f('0x153')]));this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x9b3f('0xe')][_0x9b3f('0x3b')],_0x10b547['findBy']));return{'code':0xc8,'result':_0x9b3f('0x158')};}};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x159')]=function(_0x1ec9f1){logger['info'](util['format'](_0x9b3f('0x15a'),_0x1ec9f1['label']));if(!this[_0x9b3f('0xa5')](_0x1ec9f1[_0x9b3f('0x153')])){return this[_0x9b3f('0xe')]['error'](_0x1ec9f1,_0x9b3f('0x154'));}logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x15b'),this[_0x9b3f('0xe')][_0x9b3f('0x3b')],_0x1ec9f1[_0x9b3f('0x153')]));var _0x40d048=this['agentLogout']['sync'](this,_0x1ec9f1[_0x9b3f('0x153')]);if(_0x40d048){logger['info'](util[_0x9b3f('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x1ec9f1[_0x9b3f('0x153')]));this['channel'][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0x155'),this['channel'][_0x9b3f('0x3b')],_0x1ec9f1[_0x9b3f('0x153')]));return{'code':0xc8,'result':_0x9b3f('0x156')};}else{logger['info'](util['format'](_0x9b3f('0x157'),this[_0x9b3f('0xe')]['callerid'],_0x1ec9f1[_0x9b3f('0x153')]));this[_0x9b3f('0xe')][_0x9b3f('0xab')](util['format'](_0x9b3f('0x157'),this[_0x9b3f('0xe')][_0x9b3f('0x3b')],_0x1ec9f1[_0x9b3f('0x153')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x15c')]=function(_0x479faf){logger['info'](util['format'](_0x9b3f('0x15d'),_0x479faf[_0x9b3f('0x39')]));if(!this[_0x9b3f('0xa5')](_0x479faf['operation'])){return this[_0x9b3f('0xe')][_0x9b3f('0x32')](_0x479faf,'no\x20operation\x20configured');}this['channel'][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0x15e'),_0x479faf[_0x9b3f('0x15f')]));var _0x31f4b7=eval(_0x479faf[_0x9b3f('0x15f')]);if(!this[_0x9b3f('0xa5')](_0x479faf[_0x9b3f('0xd8')])){return this['channel'][_0x9b3f('0xab')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x58be43=this[_0x9b3f('0x12')][_0x9b3f('0x6e')](this,_0x479faf[_0x9b3f('0xd8')]);if(!_0x58be43){return this[_0x9b3f('0xe')][_0x9b3f('0x32')](_0x479faf,_0x9b3f('0xd9'));}if(_[_0x9b3f('0x9d')](_0x31f4b7)){var _0x255043=this;_0x31f4b7[_0x9b3f('0xda')](function(_0x144eff,_0x50a5d1){_0x255043[_0x9b3f('0xe')]['setVariable'](util[_0x9b3f('0x29')](_0x9b3f('0x160'),_0x58be43,_0x50a5d1),_0x144eff);});return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')]('variable\x20%s[key]\x20set',_0x58be43));}else{return this[_0x9b3f('0xe')][_0x9b3f('0xa1')](_0x58be43,_0x31f4b7);}};AGIVertices[_0x9b3f('0x11')]['menu']=function(_0x252adb){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x161'),_0x252adb[_0x9b3f('0x39')]));if(_0x252adb[_0x9b3f('0xa7')]===0x0){return this['maxRetry'](_0x252adb);}_0x252adb[_0x9b3f('0xa7')]-=0x1;if(!this['isConfigured'](_0x252adb[_0x9b3f('0x112')])){return this['channel']['error'](_0x252adb,_0x9b3f('0x113'));}var _0x249527=this[_0x9b3f('0x1f')][_0x9b3f('0x6e')](this,_0x252adb[_0x9b3f('0x112')]);if(!_0x249527){return this[_0x9b3f('0xe')]['error'](_0x252adb,'no\x20file\x20audio\x20found');}var _0x296393=this[_0x9b3f('0xe')][_0x9b3f('0x162')](_0x249527,_0x252adb['response'],_0x252adb[_0x9b3f('0x163')]);var _0x4980cb=_0x296393[_0x9b3f('0xaa')];if(_0x296393[_0x9b3f('0xaa')]===-0x1){this[_0x9b3f('0x37')][_0x9b3f('0x6e')](this,_0x252adb,'-1');return _0x296393;}else if(_0x296393[_0x9b3f('0xa3')]==='timeout'){_0x296393['result']=_0x296393[_0x9b3f('0xaa')]['length']>0x0?_0x296393['result']:'t';}else if(_[_0x9b3f('0x43')](_0x296393[_0x9b3f('0xaa')])){_0x296393[_0x9b3f('0xaa')]='#';_0x4980cb='#';}if(!this[_0x9b3f('0xa5')](_0x252adb[_0x9b3f('0xd8')])){this[_0x9b3f('0xe')][_0x9b3f('0xab')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x272033=this[_0x9b3f('0x12')]['sync'](this,_0x252adb['variable_id']);if(!_0x272033){return this['channel']['error'](_0x252adb,'no\x20variable\x20found');}this['channel'][_0x9b3f('0xa1')](_0x272033,_0x4980cb);}this['createSquareDetailsReport'][_0x9b3f('0x6e')](this,_0x252adb,_0x4980cb);return _0x296393;};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0xab')]=function(_0x36601b){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x164'),_0x36601b[_0x9b3f('0x39')]));return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x36601b[_0x9b3f('0x165')]||_0x36601b['label']);};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x166')]=function(_0x594cce){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x167'),_0x594cce[_0x9b3f('0x39')]));if(!this['isConfigured'](_0x594cce[_0x9b3f('0x153')])){return this[_0x9b3f('0xe')][_0x9b3f('0x32')](_0x594cce,_0x9b3f('0x154'));}logger['info'](util[_0x9b3f('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x9b3f('0x3b')],_0x594cce[_0x9b3f('0x153')]));var _0x306d64=this[_0x9b3f('0x4c')][_0x9b3f('0x6e')](this,_0x594cce[_0x9b3f('0x168')]);var _0x186721=this[_0x9b3f('0x4e')][_0x9b3f('0x6e')](this,_0x594cce[_0x9b3f('0x153')],_0x306d64);if(_0x186721){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x155'),this[_0x9b3f('0xe')][_0x9b3f('0x3b')],_0x594cce['findBy']));this[_0x9b3f('0xe')]['noop'](util[_0x9b3f('0x29')](_0x9b3f('0x155'),this[_0x9b3f('0xe')][_0x9b3f('0x3b')],_0x594cce[_0x9b3f('0x153')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format'](_0x9b3f('0x157'),this['channel']['callerid'],_0x594cce['findBy']));this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0x155'),this[_0x9b3f('0xe')][_0x9b3f('0x3b')],_0x594cce['findBy']));return{'code':0xc8,'result':_0x9b3f('0x158')};}};AGIVertices['prototype'][_0x9b3f('0x169')]=function(_0x40fe9f){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x40fe9f[_0x9b3f('0x39')]));if(!this[_0x9b3f('0xa5')](_0x40fe9f[_0x9b3f('0x112')])){return this[_0x9b3f('0xe')]['error'](_0x40fe9f,_0x9b3f('0x113'));}var _0x33dfc9=this[_0x9b3f('0x1f')]['sync'](this,_0x40fe9f[_0x9b3f('0x112')]);if(!_0x33dfc9){return this[_0x9b3f('0xe')]['error'](_0x40fe9f,_0x9b3f('0x16a'));}var _0x5677b0=this[_0x9b3f('0xe')][_0x9b3f('0x56')](_0x9b3f('0x16b'),[_0x33dfc9,_0x40fe9f[_0x9b3f('0xe3')]]);if(_0x5677b0['result']===-0x1){return _0x5677b0;}return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util['format']('Executed\x20command\x20%s\x20%s',_0x9b3f('0x16b'),_0x33dfc9));};AGIVertices['prototype']['queue']=function(_0x4c1857){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x16c'),_0x4c1857[_0x9b3f('0x39')]));if(!this[_0x9b3f('0xa5')](_0x4c1857[_0x9b3f('0x16d')])){return this[_0x9b3f('0xe')]['error'](_0x4c1857,_0x9b3f('0x16e'));}var _0x1dd2c9='';var _0x57d72e=parseInt(_0x4c1857['queue_id'],0xa);if(isNaN(_0x57d72e)){_0x1dd2c9=_0x4c1857['queue_id'];}else{_0x1dd2c9=this[_0x9b3f('0x17')][_0x9b3f('0x6e')](this,_0x4c1857[_0x9b3f('0x16d')]);if(!_0x1dd2c9){return this[_0x9b3f('0xe')]['error'](_0x4c1857,_0x9b3f('0x16f'));}}var _0x476152='';if(this[_0x9b3f('0xa5')](_0x4c1857['file_id'])){var _0x1138b3=this[_0x9b3f('0x1f')][_0x9b3f('0x6e')](this,_0x4c1857['file_id']);if(_0x1138b3){_0x476152=_0x1138b3;}}this[_0x9b3f('0x37')]['sync'](this,_0x4c1857,_0x1dd2c9);if(_0x4c1857['opts'][_0x9b3f('0x170')]('x')<0x0){_0x4c1857[_0x9b3f('0xe3')]+='x';}if(_0x4c1857[_0x9b3f('0xe3')]['indexOf']('X')<0x0){_0x4c1857[_0x9b3f('0xe3')]+='X';}this[_0x9b3f('0xe')][_0x9b3f('0xa1')](_0x9b3f('0x171'),_0x1dd2c9?_0x1dd2c9[_0x9b3f('0x172')]():'');var _0x1dce13=this[_0x9b3f('0xe')][_0x9b3f('0x56')](_0x9b3f('0x173'),[_0x1dd2c9,_0x4c1857[_0x9b3f('0xe3')],_0x4c1857[_0x9b3f('0xe4')],_0x476152,_0x4c1857[_0x9b3f('0x64')],_0x4c1857[_0x9b3f('0xb8')],_0x4c1857[_0x9b3f('0x174')],_0x4c1857['gosub'],'',_0x4c1857[_0x9b3f('0x175')]]);if(_0x1dce13[_0x9b3f('0xaa')]===-0x1){return _0x1dce13;}return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0x176'),'QUEUE',_0x1dd2c9));};AGIVertices['prototype'][_0x9b3f('0x177')]=function(_0x39bbdf){logger['info'](util['format'](_0x9b3f('0x178'),_0x39bbdf[_0x9b3f('0x39')]));var _0x38b5cc=_0x39bbdf['recordingFormat']||_0x9b3f('0x12e');var _0x275e4d=util[_0x9b3f('0x29')](_0x9b3f('0x179'),this['channel'][_0x9b3f('0x38')],rs[_0x9b3f('0x137')](0x5));var _0x39b7f0=util[_0x9b3f('0x29')]('%s/recordings/%s.%s',FILES_PATH,_0x275e4d,_0x38b5cc);var _0x43a3c0=util[_0x9b3f('0x29')](_0x9b3f('0x12f'),FILES_PATH,_0x275e4d);this[_0x9b3f('0x3c')]['sync'](this,_0x39bbdf,_0x275e4d,_0x39b7f0);this[_0x9b3f('0xe')][_0x9b3f('0xa1')]('RECORDING_SAVENAME',_0x275e4d);logger[_0x9b3f('0x2d')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x43a3c0,_0x38b5cc,_0x39bbdf[_0x9b3f('0x17a')],_0x39bbdf[_0x9b3f('0x64')]);return this[_0x9b3f('0xe')][_0x9b3f('0x132')](_0x43a3c0,_0x38b5cc,_0x39bbdf[_0x9b3f('0x17a')],_0x39bbdf[_0x9b3f('0x64')],undefined,!![]);};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x17b')]=function(_0x220b19){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x17c'),_0x220b19['label']));if(!this[_0x9b3f('0xa5')](_0x220b19[_0x9b3f('0xe4')])){return this[_0x9b3f('0xe')]['noop'](_0x9b3f('0x17d'));}var _0xce9a63=this['restAPI'][_0x9b3f('0x6e')](this,_0x220b19);logger['info'](util[_0x9b3f('0x29')](_0x9b3f('0x17e'),util[_0x9b3f('0x17f')](_0xce9a63,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x220b19['variable_id'])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x9b3f('0x180'));}var _0x3b8db5=this[_0x9b3f('0x12')][_0x9b3f('0x6e')](this,_0x220b19[_0x9b3f('0xd8')]);if(!_0x3b8db5){return this[_0x9b3f('0xe')]['error'](_0x220b19,_0x9b3f('0xd9'));}this[_0x9b3f('0xe')][_0x9b3f('0xa1')](util['format']('%s_STATUS_CODE',_0x3b8db5),_0xce9a63[_0x9b3f('0x73')]?_0xce9a63[_0x9b3f('0x73')]:_0x9b3f('0x181'));this[_0x9b3f('0xe')]['setVariable'](util[_0x9b3f('0x29')](_0x9b3f('0x182'),_0x3b8db5),_0xce9a63[_0x9b3f('0x74')]?_0xce9a63['statusMessage']:'OK');if(_0xce9a63[_0x9b3f('0x71')]){try{this[_0x9b3f('0x9f')](_0xce9a63[_0x9b3f('0x71')],_0x3b8db5);}catch(_0x165298){logger[_0x9b3f('0x32')](util[_0x9b3f('0x29')](_0x9b3f('0x183'),_0x3b8db5));}}return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')]('variable\x20%s\x20set',_0x3b8db5));};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x184')]=function(_0xa51bea){logger['info'](util[_0x9b3f('0x29')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0xa51bea[_0x9b3f('0x39')]));return this[_0x9b3f('0xe')][_0x9b3f('0x185')](_0xa51bea[_0x9b3f('0x186')][_0x9b3f('0xd5')](/\s+/g,''),_0xa51bea[_0x9b3f('0x17a')]);};AGIVertices['prototype'][_0x9b3f('0x187')]=function(_0x5875c7){logger['info'](util['format'](_0x9b3f('0x188'),_0x5875c7[_0x9b3f('0x39')]));return this[_0x9b3f('0xe')][_0x9b3f('0x189')](_0x5875c7[_0x9b3f('0x65')]['replace'](/\s+/g,''),_0x5875c7['escape_digits']);};AGIVertices['prototype'][_0x9b3f('0x18a')]=function(_0x57363a){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x18b'),_0x57363a['label']));return this['channel'][_0x9b3f('0x18c')](_0x57363a[_0x9b3f('0x5b')],_0x57363a[_0x9b3f('0x17a')]);};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x18d')]=function(_0x56f581){logger[_0x9b3f('0x2d')](util['format']('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x56f581[_0x9b3f('0x39')]));if(!this[_0x9b3f('0xa5')](_0x56f581[_0x9b3f('0x18e')])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x9b3f('0x18f'));}var _0x26474c=this['getMailAccount'][_0x9b3f('0x6e')](this,_0x56f581['account_id']);if(!_0x26474c||!_0x26474c[_0x9b3f('0x190')]){return this['channel'][_0x9b3f('0x32')](_0x56f581,_0x9b3f('0x191'));}var _0x4e83e8={'from':util[_0x9b3f('0x29')](_0x9b3f('0x192'),_0x26474c[_0x9b3f('0x15')],_0x26474c[_0x9b3f('0x193')]||_0x26474c[_0x9b3f('0x190')][_0x9b3f('0x194')]),'to':_0x56f581['to']||'','cc':_0x56f581['cc']||'','bcc':_0x56f581[_0x9b3f('0x195')]||'','subject':_0x56f581['subject'],'html':_0x56f581[_0x9b3f('0x5b')],'text':_0x56f581[_0x9b3f('0x5b')]};var _0x7942a2={'tls':{'rejectUnauthorized':![]}};if(_0x26474c[_0x9b3f('0x190')][_0x9b3f('0x196')]){_0x7942a2[_0x9b3f('0x196')]=_0x26474c[_0x9b3f('0x190')]['service'];}else{_0x7942a2[_0x9b3f('0x197')]=_0x26474c[_0x9b3f('0x190')][_0x9b3f('0x197')];_0x7942a2[_0x9b3f('0x198')]=_0x26474c[_0x9b3f('0x190')][_0x9b3f('0x198')];_0x7942a2['secure']=_0x26474c[_0x9b3f('0x190')]['secure'];}if(_0x26474c[_0x9b3f('0x190')]['authentication']){_0x7942a2[_0x9b3f('0x199')]={'user':_0x26474c[_0x9b3f('0x190')][_0x9b3f('0x194')],'pass':_0x26474c['Smtp'][_0x9b3f('0x19a')]};}if(this['isConfigured'](_0x56f581['template_id'])){}logger[_0x9b3f('0xdf')](_0x9b3f('0x19b'),JSON[_0x9b3f('0x70')](_0x4e83e8));this[_0x9b3f('0x37')][_0x9b3f('0x6e')](this,_0x56f581,_0x56f581['account_id']);this[_0x9b3f('0xe')]['noop'](util['format'](_0x9b3f('0x19c'),_0x26474c[_0x9b3f('0x15')]));this['sendMailMessage'][_0x9b3f('0x6e')](this,_0x7942a2,_0x4e83e8);return this[_0x9b3f('0xe')][_0x9b3f('0xab')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0x9b3f('0x19d')]=function(_0x552689){logger['info'](util[_0x9b3f('0x29')](_0x9b3f('0x19e'),_0x552689[_0x9b3f('0x39')]));return this['channel'][_0x9b3f('0xab')](_0x9b3f('0x19f'));};AGIVertices['prototype'][_0x9b3f('0x1a0')]=function(_0x941be1){logger[_0x9b3f('0x2d')](util['format'](_0x9b3f('0x1a1'),_0x941be1[_0x9b3f('0x39')]));if(!this[_0x9b3f('0xa5')](_0x941be1[_0x9b3f('0x1a2')])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')]('no\x20sms\x20account\x20configured');}var _0x4c0d56=this['getSmsAccount'][_0x9b3f('0x6e')](this,_0x941be1[_0x9b3f('0x1a2')]);if(!_0x4c0d56){return this[_0x9b3f('0xe')][_0x9b3f('0x32')](_0x941be1,_0x9b3f('0x1a3'));}var _0x3057d6={'body':_0x941be1['sms_text'],'phone':_0x941be1['to']||'','SmsAccountId':_0x4c0d56['id']};logger[_0x9b3f('0xdf')](_0x9b3f('0x1a4'),JSON['stringify'](_0x3057d6));this[_0x9b3f('0x37')][_0x9b3f('0x6e')](this,_0x941be1,_0x941be1['sms_account_id']);this[_0x9b3f('0xe')][_0x9b3f('0xab')](util['format'](_0x9b3f('0x1a5'),_0x4c0d56['name']));this[_0x9b3f('0x36')][_0x9b3f('0x6e')](this,_0x3057d6);return this[_0x9b3f('0xe')]['noop'](_0x9b3f('0x1a6'));};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x1a7')]=function(_0x5507dc){logger[_0x9b3f('0x2d')](util['format'](_0x9b3f('0x1a8'),_0x5507dc[_0x9b3f('0x39')]));if(!this['isConfigured'](_0x5507dc[_0x9b3f('0xd8')])){return this['channel'][_0x9b3f('0x32')](_0x5507dc,_0x9b3f('0x1a9'));}var _0x55bf2d=this[_0x9b3f('0x12')][_0x9b3f('0x6e')](this,_0x5507dc[_0x9b3f('0xd8')]);if(!_0x55bf2d){return this[_0x9b3f('0xe')]['error'](_0x5507dc,_0x9b3f('0xd9'));}return this[_0x9b3f('0xe')][_0x9b3f('0xa1')](_0x55bf2d,_0x5507dc['variable_value']);};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x1aa')]=function(_0x2f9945){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x1ab'),_0x2f9945[_0x9b3f('0x39')]));this['channel'][_0x9b3f('0xab')](_0x9b3f('0x1ac'));if(_0x2f9945[_0x9b3f('0xbb')]===_0x9b3f('0x1ad')){this[_0x9b3f('0xe')][_0x9b3f('0xab')]('Answer');return this[_0x9b3f('0xe')][_0x9b3f('0xbb')]();}return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x9b3f('0x1ae'));};AGIVertices[_0x9b3f('0x11')]['subproject']=function(_0x54853e){logger['info'](util[_0x9b3f('0x29')](_0x9b3f('0x1af'),_0x54853e[_0x9b3f('0x39')]));if(!this[_0x9b3f('0xa5')](_0x54853e[_0x9b3f('0x1b0')])){return this[_0x9b3f('0xe')]['error'](_0x54853e,_0x9b3f('0x1b1'));}var _0xa297ca=this[_0x9b3f('0x19')][_0x9b3f('0x6e')](this,_0x54853e[_0x9b3f('0x1b0')]);if(!this[_0x9b3f('0xa5')](_0xa297ca)){return this[_0x9b3f('0xe')][_0x9b3f('0x32')](_0x54853e,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0x54853e['project_id']));}if(_0xa297ca===this[_0x9b3f('0xe')][_0x9b3f('0x3a')]){return this['channel'][_0x9b3f('0x32')](_0x54853e,_0x9b3f('0x1b2'));}this[_0x9b3f('0x37')]['sync'](this,_0x54853e,_0xa297ca);var _0xc9bd51=this[_0x9b3f('0xe')]['exec'](_0x9b3f('0x1b3'),util[_0x9b3f('0x29')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x9b3f('0xb8')][_0x9b3f('0x197')]||_0x9b3f('0x1b4'),_0xa297ca,this['channel'][_0x9b3f('0x3a')]));if(_0xc9bd51[_0x9b3f('0xaa')]===-0x1){return _0xc9bd51;}return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0x176'),'AGI',_0xa297ca));};AGIVertices['prototype'][_0x9b3f('0x1b5')]=function(_0x4f71d5){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x1b6'),_0x4f71d5[_0x9b3f('0x39')]));var _0x5ce609=this[_0x9b3f('0x55')][_0x9b3f('0x6e')](this,_0x4f71d5['command']);this[_0x9b3f('0x37')][_0x9b3f('0x6e')](this,_0x4f71d5,_0x4f71d5['command']);if(this['isConfigured'](_0x4f71d5[_0x9b3f('0xd8')])){var _0x57d237=this[_0x9b3f('0x12')]['sync'](this,_0x4f71d5[_0x9b3f('0xd8')]);if(_0x57d237){this['channel'][_0x9b3f('0xa1')](_0x57d237,_0x5ce609);return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x4f71d5['command'],_0x57d237));}}return this[_0x9b3f('0xe')]['noop'](util[_0x9b3f('0x29')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x4f71d5[_0x9b3f('0xba')]));};AGIVertices['prototype'][_0x9b3f('0x1b7')]=function(_0x13ac86){logger[_0x9b3f('0x2d')](util['format'](_0x9b3f('0x1b8'),_0x13ac86['label']));_0x13ac86['text']=_0x13ac86[_0x9b3f('0x5b')][_0x9b3f('0xd5')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9b3f('0xa5')](_0x13ac86[_0x9b3f('0x59')])){return this['channel'][_0x9b3f('0xab')](_0x9b3f('0x1b9'));}if(!this[_0x9b3f('0xa5')](_0x13ac86['text'])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')](_0x9b3f('0xc7'));}this[_0x9b3f('0xe')]['noop'](util['format']('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x13ac86[_0x9b3f('0x5b')]));var _0x14209e=this['googleCloudTTS']['sync'](this,_0x13ac86);if(_0x14209e){this[_0x9b3f('0xe')][_0x9b3f('0xab')](util['format']('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x14209e));var _0x4879e7=this[_0x9b3f('0xe')][_0x9b3f('0x102')](_0x14209e);try{fs[_0x9b3f('0x103')](_0x14209e+_0x9b3f('0x1ba'));}catch(_0x3b43eb){logger['error'](_0x3b43eb);}return _0x4879e7;}return this['channel'][_0x9b3f('0x32')](_0x13ac86,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x1bb')]=function(_0x59af1f){logger[_0x9b3f('0x2d')](util['format'](_0x9b3f('0x1bc'),_0x59af1f[_0x9b3f('0x39')]));_0x59af1f[_0x9b3f('0x5b')]=_0x59af1f['text'][_0x9b3f('0xd5')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9b3f('0xa5')](_0x59af1f['text'])){return this[_0x9b3f('0xe')][_0x9b3f('0xab')]('no\x20text\x20configured');}this[_0x9b3f('0xe')][_0x9b3f('0xab')](util['format'](_0x9b3f('0x1bd'),_0x59af1f[_0x9b3f('0x5b')]));var _0x771b1b=this[_0x9b3f('0x60')][_0x9b3f('0x6e')](this,_0x59af1f);if(_0x771b1b){this['channel'][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0x1be'),_0x771b1b));var _0x18907a=this[_0x9b3f('0xe')][_0x9b3f('0x102')](_0x771b1b);try{fs[_0x9b3f('0x103')](_0x771b1b+'.wav');}catch(_0x53e65d){logger[_0x9b3f('0x32')](_0x53e65d);}return _0x18907a;}return this[_0x9b3f('0xe')]['error'](_0x59af1f,_0x9b3f('0x1bf'));};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x1c0')]=function(_0x1fb147){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x1c1'),_0x1fb147['label']));if(!this[_0x9b3f('0xa5')](_0x1fb147[_0x9b3f('0x153')])){return this[_0x9b3f('0xe')][_0x9b3f('0x32')](_0x1fb147,_0x9b3f('0x154'));}logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x15b'),this[_0x9b3f('0xe')]['callerid'],_0x1fb147[_0x9b3f('0x153')]));var _0x50a5d5=this[_0x9b3f('0x1c2')][_0x9b3f('0x6e')](this,_0x1fb147[_0x9b3f('0x153')]);if(_0x50a5d5){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x155'),this[_0x9b3f('0xe')][_0x9b3f('0x3b')],_0x1fb147[_0x9b3f('0x153')]));this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0x155'),this[_0x9b3f('0xe')]['callerid'],_0x1fb147[_0x9b3f('0x153')]));return{'code':0xc8,'result':_0x9b3f('0x156')};}else{logger['info'](util[_0x9b3f('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x9b3f('0xe')]['callerid'],_0x1fb147[_0x9b3f('0x153')]));this['channel'][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0x157'),this[_0x9b3f('0xe')][_0x9b3f('0x3b')],_0x1fb147['findBy']));return{'code':0xc8,'result':_0x9b3f('0x158')};}};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x1c3')]=function(_0x2e4db9){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x1c4'),_0x2e4db9['label']));var _0x1703d8=this[_0x9b3f('0xe')][_0x9b3f('0x56')](_0x9b3f('0x1c5'),[_0x2e4db9['mailbox'],_0x2e4db9['options']]);if(_0x1703d8[_0x9b3f('0xaa')]===-0x1){return _0x1703d8;}return this[_0x9b3f('0xe')][_0x9b3f('0xab')](util[_0x9b3f('0x29')](_0x9b3f('0x176'),_0x9b3f('0x1c5'),_0x2e4db9[_0x9b3f('0x1c6')]));};AGIVertices[_0x9b3f('0x11')][_0x9b3f('0x1c7')]=function(_0x4bd714){logger[_0x9b3f('0x2d')](util[_0x9b3f('0x29')](_0x9b3f('0x1c8'),_0x4bd714[_0x9b3f('0x39')]));if(!this[_0x9b3f('0xa5')](_0x4bd714[_0x9b3f('0xd8')])){return this['channel'][_0x9b3f('0x32')](_0x4bd714,_0x9b3f('0x1a9'));}var _0x29c087=this[_0x9b3f('0x12')][_0x9b3f('0x6e')](this,_0x4bd714['variable_id']);if(!_0x29c087){return this[_0x9b3f('0xe')][_0x9b3f('0x32')](_0x4bd714,_0x9b3f('0xd9'));}var _0x49c3a7=this[_0x9b3f('0xe')]['getVariable'](_0x29c087);return{'code':0xc8,'result':_0x49c3a7[_0x9b3f('0xa3')]?_0x49c3a7['extra']:'-'};};String[_0x9b3f('0x11')][_0x9b3f('0xa2')]=function(_0x31c8ca,_0x47851a){return this[_0x9b3f('0x1c9')](_0x31c8ca)[_0x9b3f('0x1ca')](_0x47851a);};module[_0x9b3f('0x1cb')]=AGIVertices; \ No newline at end of file +var _0x8322=['file','createSquareMessage','uniqueid','createCmContact','isEmpty','isNil','callback_','lastName','phone','scheduledAt','Callback\x20scheduled\x20at\x20','toString','getPause','agentPause','agent','agentUnpause','agentLogin','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','MALE','audioEncoding','MP3','googleTTS','method','timeout','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','render','url','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','private_key','ispeechTTS','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_polly_region','Amy','aws_text_type','awsLex','aws_access_key_id','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','uri','clear','agicommand','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','isPlainObject','isArray','length','recursiveNodeIndex','%s.%s','split','replaceAll','getVariable','extra','result','setVariable','maxRetry','mrcpsynth','noop','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','args','answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','delay','add','callback_priority','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','no\x20text\x20configured','sestektts','lumenvoxasr','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20query\x20configured','replace','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','dialogflowV2_language','no\x20anguage\x20configured','bot','Trying\x20DialogflowV2:\x20%s','DIALOGFLOW_%s','out','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','password','no\x20password\x20configured','ndassistant_url','sestekNDA','SESTEK_NDA_%s','sesteknda','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','trunk_name','SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','isString','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','recordFile','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appsecret\x20configured','beep','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','condition','no\x20condition\x20configured','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','no\x20interval\x20configured','interval_id','IFTIME(%s?true:false)','true','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','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','no\x20variable\x20found','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','getVoiceQueue','no\x20queue\x20found','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','saveRestApiResult','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','escape_digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','number','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','email','user','bcc','subject','service','host','port','secure','auth','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','vswitch','join','exports','path','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getsecretdigits','rpc','mailRpc','getVariableById','then','name','prototype','getVoiceQueueById','catch','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getSound','getSoundById','save_name','getMailAccount','getMailAccountById','getIntervals','IntervalId','map','Intervals','interval','format','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSquareDetailsReport','channel','label','arg_1','callerid','createSquareRecording','calleridname','context','extension','dnid'];(function(_0x3936c4,_0x59b4bb){var _0x5c2e58=function(_0x35cd52){while(--_0x35cd52){_0x3936c4['push'](_0x3936c4['shift']());}};_0x5c2e58(++_0x59b4bb);}(_0x8322,0x186));var _0x2832=function(_0x6d6a66,_0x2924af){_0x6d6a66=_0x6d6a66-0x0;var _0x11eb6e=_0x8322[_0x6d6a66];return _0x11eb6e;};'use strict';var fs=require('fs');var path=require(_0x2832('0x0'));var util=require(_0x2832('0x1'));var _=require(_0x2832('0x2'));var sh=require(_0x2832('0x3'));var odbc=require(_0x2832('0x4'))();var rs=require(_0x2832('0x5'));var moment=require(_0x2832('0x6'));var Mustache=require(_0x2832('0x7'));var rp=require(_0x2832('0x8'));var logger=require(_0x2832('0x9'))('agi');var config=require('../../config/environment');var scripts=require(_0x2832('0xa'));var FILES_PATH=_0x2832('0xb');var recursiveMapAttributes=[_0x2832('0xc'),_0x2832('0xd')];var verticesWithRetry=[_0x2832('0xe'),'getdigits',_0x2832('0xf')];var AGIVertices=function(_0x6e6b65,_0x303743,_0xb1f005){this['channel']=_0x6e6b65;this[_0x2832('0x10')]=_0x303743;this[_0x2832('0x11')]=_0xb1f005;};AGIVertices['prototype']['getVariable']=function(_0x4366bf,_0x4a3bbc){this['rpc'][_0x2832('0x12')](_0x4366bf)[_0x2832('0x13')](function(_0x3efaf2){_0x4a3bbc(null,_0x3efaf2?_0x3efaf2[_0x2832('0x14')]:![]);})['catch'](function(_0x2fc06a){_0x4a3bbc(_0x2fc06a);});};AGIVertices[_0x2832('0x15')]['getVoiceQueue']=function(_0x27cf0c,_0x4629fd){this[_0x2832('0x10')][_0x2832('0x16')](_0x27cf0c)[_0x2832('0x13')](function(_0x342922){_0x4629fd(null,_0x342922?_0x342922[_0x2832('0x14')]:![]);})['catch'](function(_0x1805db){_0x4629fd(_0x1805db);});};AGIVertices[_0x2832('0x15')]['getSquareProject']=function(_0x3362ef,_0x56d1e6){this[_0x2832('0x10')]['getSquareProjectById'](_0x3362ef)['then'](function(_0x1bb3f0){_0x56d1e6(null,_0x1bb3f0?_0x1bb3f0[_0x2832('0x14')]:![]);})[_0x2832('0x17')](function(_0x47b804){_0x56d1e6(_0x47b804);});};AGIVertices[_0x2832('0x15')][_0x2832('0x18')]=function(_0x52f067,_0xd33f46){this[_0x2832('0x10')][_0x2832('0x19')](_0x52f067)[_0x2832('0x13')](function(_0x561169){_0xd33f46(null,_0x561169?_0x561169[_0x2832('0x1a')]:![]);})[_0x2832('0x17')](function(_0x3d57f9){_0xd33f46(_0x3d57f9);});};AGIVertices[_0x2832('0x15')][_0x2832('0x1b')]=function(_0x2df647,_0x3f8f4a){this[_0x2832('0x10')][_0x2832('0x1c')](_0x2df647)[_0x2832('0x13')](function(_0x1ccbd8){_0x3f8f4a(null,_0x1ccbd8?_0x1ccbd8['name']:![]);})[_0x2832('0x17')](function(_0x216357){_0x3f8f4a(_0x216357);});};AGIVertices[_0x2832('0x15')][_0x2832('0x1d')]=function(_0x24621a,_0x83416e){this[_0x2832('0x10')]['getTrunkById'](_0x24621a)['then'](function(_0x5bfd7a){_0x83416e(null,_0x5bfd7a?_0x5bfd7a[_0x2832('0x14')]:![]);})[_0x2832('0x17')](function(_0x4ab2ac){_0x83416e(_0x4ab2ac);});};AGIVertices[_0x2832('0x15')][_0x2832('0x1e')]=function(_0x4694ac,_0x3703b1){var _0x178173=this;this[_0x2832('0x10')][_0x2832('0x1f')](_0x4694ac)[_0x2832('0x13')](function(_0x11aa49){_0x3703b1(null,_0x11aa49?_0x178173['getSoundPath'](_0x11aa49[_0x2832('0x20')]):![]);})['catch'](function(_0x120965){_0x3703b1(_0x120965);});};AGIVertices[_0x2832('0x15')][_0x2832('0x21')]=function(_0x2cbd15,_0x23c709){this[_0x2832('0x10')][_0x2832('0x22')](_0x2cbd15)['then'](function(_0x438735){_0x23c709(null,_0x438735?_0x438735:![]);})[_0x2832('0x17')](function(_0x321c03){_0x23c709(_0x321c03);});};AGIVertices[_0x2832('0x15')]['sendMailMessage']=function(_0x11ef70,_0x4fd4db,_0x3623ee){this['mailRpc']['sendMailMessage'](_0x11ef70,_0x4fd4db)[_0x2832('0x13')](function(){_0x3623ee(null);})[_0x2832('0x17')](function(_0x34f55d){_0x3623ee(_0x34f55d);});};AGIVertices[_0x2832('0x15')][_0x2832('0x23')]=function(_0x3382e9,_0x50d5d9){this[_0x2832('0x10')]['getIntervalById'](_0x3382e9)[_0x2832('0x13')](function(_0x2744ff){if(_0x2744ff){if(_0x2744ff[_0x2832('0x24')]){_0x50d5d9(null,[_0x2744ff['interval']]);}else{_0x50d5d9(null,_[_0x2832('0x25')](_0x2744ff[_0x2832('0x26')],_0x2832('0x27')));}}else{_0x50d5d9(null,![]);}})[_0x2832('0x17')](function(_0x2a74cf){_0x50d5d9(_0x2a74cf);});};AGIVertices['prototype']['getSoundPath']=function(_0x1cfcf2){return util[_0x2832('0x28')](_0x2832('0x29'),FILES_PATH,_0x1cfcf2);};AGIVertices['prototype'][_0x2832('0x2a')]=function(_0x47533e,_0x38c908,_0x482744){odbc['open'](_0x47533e,function(_0x1028a2){if(_0x1028a2){logger[_0x2832('0x2b')](_0x2832('0x2c'),_0x1028a2);_0x482744(_0x1028a2);}else{logger[_0x2832('0x2d')](_0x2832('0x2e'));odbc[_0x2832('0x2f')](_0x38c908,function(_0x57ff4d,_0x26a1c5){if(_0x57ff4d){logger[_0x2832('0x2d')](_0x2832('0x30'),_0x38c908);_0x482744(_0x57ff4d);}else{logger[_0x2832('0x2d')](_0x2832('0x31'),_0x38c908);odbc['close'](function(_0x3cd4e5){if(_0x3cd4e5){logger[_0x2832('0x2b')](_0x2832('0x32'),_0x3cd4e5);}_0x482744(null,_0x26a1c5);});}});}});};AGIVertices[_0x2832('0x15')][_0x2832('0x33')]=function(_0x4fec18,_0x31b5b1){this['rpc'][_0x2832('0x34')](_0x4fec18)[_0x2832('0x13')](function(_0x7f2ee){_0x31b5b1(null,_0x7f2ee?_0x7f2ee:![]);})['catch'](function(_0x1300d3){_0x31b5b1(_0x1300d3);});};AGIVertices[_0x2832('0x15')]['createSmsMessage']=function(_0x50812d,_0x716f66){this[_0x2832('0x10')]['createSmsMessage'](_0x50812d)[_0x2832('0x13')](function(_0x30def3){_0x716f66(null,_0x30def3);})[_0x2832('0x17')](function(_0x3a869c){_0x716f66(_0x3a869c);});};AGIVertices[_0x2832('0x15')][_0x2832('0x35')]=function(_0x18713b,_0x3eb880,_0x1ebe44){this[_0x2832('0x10')]['createSquareDetailsReport']({'uniqueid':this[_0x2832('0x36')]['uniqueid'],'node':_0x18713b[_0x2832('0x37')],'application':_0x18713b['agicommand'],'data':_0x3eb880||null,'project_name':this[_0x2832('0x36')][_0x2832('0x38')],'callerid':this['channel'][_0x2832('0x39')]})[_0x2832('0x13')](function(_0x54ac1e){if(_0x1ebe44){_0x1ebe44(null,_0x54ac1e);}})[_0x2832('0x17')](function(_0x4932e7){if(_0x1ebe44){_0x1ebe44(_0x4932e7);}});};AGIVertices[_0x2832('0x15')][_0x2832('0x3a')]=function(_0x189881,_0x104873,_0xf7e048,_0x27f24d){this[_0x2832('0x10')][_0x2832('0x3a')]({'uniqueid':this['channel']['uniqueid'],'callerid':this[_0x2832('0x36')][_0x2832('0x39')],'calleridname':this[_0x2832('0x36')][_0x2832('0x3b')],'context':this[_0x2832('0x36')][_0x2832('0x3c')],'extension':this[_0x2832('0x36')][_0x2832('0x3d')],'priority':this[_0x2832('0x36')]['priority'],'accountcode':this[_0x2832('0x36')]['accountcode'],'dnid':this['channel'][_0x2832('0x3e')],'projectName':this[_0x2832('0x36')][_0x2832('0x38')],'saveName':_0x104873,'filename':_0x189881[_0x2832('0x3f')]||_0x104873,'savePath':_0xf7e048})['then'](function(_0x39e0a2){_0x27f24d(null,_0x39e0a2);})[_0x2832('0x17')](function(_0x1188f9){_0x27f24d(_0x1188f9);});};AGIVertices[_0x2832('0x15')][_0x2832('0x40')]=function(_0x43fa8a,_0x1c53c2,_0x4c4022,_0x48da55,_0x5ee856){this['rpc']['createSquareMessage']({'uniqueid':this['channel'][_0x2832('0x41')],'body':_0x43fa8a,'direction':_0x1c53c2,'providerName':_0x4c4022,'providerResponse':_0x48da55})[_0x2832('0x13')](function(_0x4785f9){if(_0x5ee856){_0x5ee856(null,_0x4785f9);}})[_0x2832('0x17')](function(_0x2a997a){if(_0x5ee856){_0x5ee856(_0x2a997a);}});};AGIVertices[_0x2832('0x15')][_0x2832('0x42')]=function(_0x4024eb,_0x538923){this[_0x2832('0x10')][_0x2832('0x42')]({'firstName':_[_0x2832('0x43')](_0x4024eb[_0x2832('0x14')])||_[_0x2832('0x44')](_0x4024eb[_0x2832('0x14')])?_0x2832('0x45')+Math['random']():_0x4024eb['name'],'lastName':_[_0x2832('0x43')](_0x4024eb[_0x2832('0x46')])||_[_0x2832('0x44')](_0x4024eb[_0x2832('0x46')])?null:_0x4024eb[_0x2832('0x46')],'phone':_0x4024eb[_0x2832('0x47')],'ListId':_0x4024eb['list_id'],'scheduledat':_0x4024eb[_0x2832('0x48')],'callbackUniqueid':this[_0x2832('0x36')][_0x2832('0x41')],'tags':'callback','description':_0x2832('0x49')+_0x4024eb['scheduledAt'][_0x2832('0x4a')](),'priority':_0x4024eb['callback_priority']})[_0x2832('0x13')](function(_0x2476a4){_0x538923(null,_0x2476a4);})['catch'](function(_0x23997d){_0x538923(_0x23997d);});};AGIVertices['prototype'][_0x2832('0x4b')]=function(_0x556448,_0x3258ca){this['rpc']['getPauseById'](_0x556448)[_0x2832('0x13')](function(_0x4fceb2){_0x3258ca(null,_0x4fceb2?_0x4fceb2[_0x2832('0x14')]:![]);})['catch'](function(_0x14a60a){_0x3258ca(_0x14a60a);});};AGIVertices[_0x2832('0x15')][_0x2832('0x4c')]=function(_0x26484e,_0x32fdaa,_0x459a92){var _0x27b84e={'role':_0x2832('0x4d')};_0x27b84e[_0x26484e]=this[_0x2832('0x36')][_0x2832('0x39')];this['rpc'][_0x2832('0x4c')](_0x27b84e,_0x32fdaa,this[_0x2832('0x36')][_0x2832('0x41')])[_0x2832('0x13')](function(_0x4f692){_0x459a92(null,_[_0x2832('0x44')](_0x4f692)?![]:!![]);})[_0x2832('0x17')](function(_0x3e9ed2){logger[_0x2832('0x2b')](_0x3e9ed2);_0x459a92(null,![]);});};AGIVertices[_0x2832('0x15')][_0x2832('0x4e')]=function(_0x39b757,_0x4c4a5e){var _0x3dfcb4={'role':_0x2832('0x4d')};_0x3dfcb4[_0x39b757]=this['channel'][_0x2832('0x39')];this['rpc'][_0x2832('0x4e')](_0x3dfcb4)[_0x2832('0x13')](function(_0x15f2d8){_0x4c4a5e(null,_[_0x2832('0x44')](_0x15f2d8)?![]:!![]);})[_0x2832('0x17')](function(_0x6959c7){logger[_0x2832('0x2b')](_0x6959c7);_0x4c4a5e(null,![]);});};AGIVertices['prototype']['agentLogout']=function(_0x3f9dff,_0x5b2b80){var _0x27014b={'role':_0x2832('0x4d')};_0x27014b[_0x3f9dff]=this[_0x2832('0x36')][_0x2832('0x39')];this[_0x2832('0x10')]['agentLogout'](_0x27014b)['then'](function(_0x5522aa){_0x5b2b80(null,_[_0x2832('0x44')](_0x5522aa)?![]:!![]);})[_0x2832('0x17')](function(_0x1addfa){logger['error'](_0x1addfa);_0x5b2b80(null,![]);});};AGIVertices[_0x2832('0x15')][_0x2832('0x4f')]=function(_0x22e134,_0x2b54dd){var _0x299000={'role':'agent'};_0x299000[_0x22e134]=this['channel'][_0x2832('0x39')];var _0x3cb032=_0x22e134!='internal'?util[_0x2832('0x28')](_0x2832('0x50'),_0x2832('0x51'),this[_0x2832('0x36')][_0x2832('0x39')]):undefined;this['rpc'][_0x2832('0x4f')](_0x299000,_0x3cb032)['then'](function(_0x57bbc1){_0x2b54dd(null,_[_0x2832('0x44')](_0x57bbc1)?![]:!![]);})[_0x2832('0x17')](function(_0x1b852a){logger[_0x2832('0x2b')](_0x1b852a);_0x2b54dd(null,![]);});};AGIVertices[_0x2832('0x15')][_0x2832('0x52')]=function(_0x10f648,_0x11087b){sh[_0x2832('0x53')](_[_0x2832('0x54')](_0x10f648),function(_0x4e2884,_0x312afb){var _0x2e1688=_0x312afb['replace'](/(\r\n|\n|\r)/gm,'');_0x11087b(null,_0x2e1688);});};AGIVertices[_0x2832('0x15')][_0x2832('0x55')]=function(_0x61883c,_0xac73d6){scripts[_0x2832('0x55')](_0x61883c[_0x2832('0x56')],_0x61883c[_0x2832('0x57')]||_0x2832('0x58'),_0x61883c[_0x2832('0x58')],_0x61883c[_0x2832('0x59')]||_0x2832('0x5a'),_0x61883c['ssmlGender']||_0x2832('0x5b'),_0x61883c[_0x2832('0x5c')]||_0x2832('0x5d'))[_0x2832('0x13')](function(_0x11c840){_0xac73d6(null,_0x11c840);})[_0x2832('0x17')](function(_0x1929ab){_0xac73d6(_0x1929ab);});};AGIVertices[_0x2832('0x15')]['googleTTS']=function(_0x77c1f7,_0x17f5ae){scripts[_0x2832('0x5e')](_0x77c1f7[_0x2832('0x58')],_0x77c1f7['google_tts_language']||'en',0x1)[_0x2832('0x13')](function(_0x3ac570){_0x17f5ae(null,_0x3ac570);})[_0x2832('0x17')](function(_0x1c6a7b){_0x17f5ae(_0x1c6a7b);});};AGIVertices[_0x2832('0x15')]['restAPI']=function(_0x4cc4c4,_0x2f6164){var _0x5af47c={'uri':_0x4cc4c4['url'],'method':_0x4cc4c4[_0x2832('0x5f')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4cc4c4[_0x2832('0x60')])==='number'&&parseInt(_0x4cc4c4[_0x2832('0x60')])>=0x1?parseInt(_0x4cc4c4[_0x2832('0x60')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x2832('0x61'),_0x2832('0x62')],_0x5af47c[_0x2832('0x5f')][_0x2832('0x63')]())){try{_0x5af47c[_0x2832('0x64')]=_0x4cc4c4[_0x2832('0xd')]?JSON[_0x2832('0x65')](_0x4cc4c4[_0x2832('0xd')]):{};}catch(_0x150b2e){logger[_0x2832('0x2b')](_0x2832('0x66'),_0x150b2e);}}try{_0x5af47c[_0x2832('0x67')]=_0x4cc4c4[_0x2832('0xc')]?JSON[_0x2832('0x65')](_0x4cc4c4[_0x2832('0xc')]):{};}catch(_0x87ad43){logger[_0x2832('0x2b')](_0x2832('0x68'),_0x87ad43);}if(_0x4cc4c4[_0x2832('0x69')]){try{var _0x1d9f98=require(_0x4cc4c4[_0x2832('0x69')])[_0x2832('0x6a')](this,_0x5af47c);_0x5af47c['uri']=Mustache[_0x2832('0x6b')](_0x4cc4c4[_0x2832('0x6c')],_0x1d9f98,{},['$$','$$']);if(_0x5af47c[_0x2832('0x67')]){_0x5af47c['headers']=JSON[_0x2832('0x65')](Mustache[_0x2832('0x6b')](JSON[_0x2832('0x6d')](_0x5af47c['headers']),_0x1d9f98,{},['$$','$$']));}if(_0x5af47c[_0x2832('0x64')]){_0x5af47c[_0x2832('0x64')]=JSON[_0x2832('0x65')](Mustache[_0x2832('0x6b')](JSON[_0x2832('0x6d')](_0x5af47c['body']),_0x1d9f98,{},['$$','$$']));}}catch(_0x58b4df){logger[_0x2832('0x2b')](_0x2832('0x6e'),_0x58b4df);}}rp(_0x5af47c)[_0x2832('0x13')](function(_0x673521){var _0x417972={'statusCode':_0x673521[_0x2832('0x6f')]||0xc8,'statusMessage':_0x673521['statusMessage']||'OK','headers':_0x673521[_0x2832('0x67')]||{},'body':_0x673521[_0x2832('0x64')]||{}};_0x2f6164(null,_0x417972);})[_0x2832('0x17')](function(_0x508b2b){var _0x4fe393={'statusCode':_0x508b2b[_0x2832('0x6f')]||0x1f4,'statusMessage':_0x508b2b[_0x2832('0x70')]||_0x2832('0x71'),'headers':_0x508b2b[_0x2832('0x72')][_0x2832('0x67')]||{},'body':_0x508b2b['options']['body']||{}};_0x2f6164(null,_0x4fe393);});};AGIVertices[_0x2832('0x15')][_0x2832('0x73')]=function(_0x3bd84e,_0x2aaf94){scripts[_0x2832('0x73')](this[_0x2832('0x36')][_0x2832('0x41')],_0x3bd84e[_0x2832('0x74')],_0x3bd84e['text'],_0x3bd84e[_0x2832('0x75')]||'en')[_0x2832('0x13')](function(_0xd21303){_0x2aaf94(null,_0xd21303);})[_0x2832('0x17')](function(_0x145907){_0x2aaf94(_0x145907);});};AGIVertices['prototype'][_0x2832('0x76')]=function(_0x388531,_0x47909d){scripts['googleDialogflowV2'](this[_0x2832('0x36')][_0x2832('0x41')],_0x388531['dialogflowV2_project_id'],_0x388531[_0x2832('0x77')],_0x388531[_0x2832('0x78')],_0x388531[_0x2832('0x58')],_0x388531['dialogflowV2_language']||'en')['then'](function(_0x3a6669){_0x47909d(null,_0x3a6669);})[_0x2832('0x17')](function(_0x3af4cf){_0x47909d(_0x3af4cf);});};AGIVertices[_0x2832('0x15')]['sestekNDA']=function(_0x6015fb,_0x5d9111){scripts['sestekNDA'](this[_0x2832('0x36')],_0x6015fb)[_0x2832('0x13')](function(_0xfa577b){_0x5d9111(null,_0xfa577b);})[_0x2832('0x17')](function(_0x19f7a){_0x5d9111(_0x19f7a);});};AGIVertices['prototype']['ispeechTTS']=function(_0x280445,_0x55a04c){scripts[_0x2832('0x79')](_0x280445[_0x2832('0x74')],_0x280445[_0x2832('0x58')],_0x280445['ispeech_tts_language']||_0x2832('0x5a'),_0x280445['speed'])[_0x2832('0x13')](function(_0xcd2726){_0x55a04c(null,_0xcd2726);})[_0x2832('0x17')](function(_0x7ea93d){_0x55a04c(_0x7ea93d);});};AGIVertices[_0x2832('0x15')][_0x2832('0x7a')]=function(_0x3334b8,_0x44da4d,_0x3c85ea){scripts[_0x2832('0x7a')](_0x44da4d,_0x3334b8[_0x2832('0x74')],_0x3334b8[_0x2832('0x7b')]||_0x2832('0x5a'),this[_0x2832('0x7c')](_0x3334b8[_0x2832('0x7d')])?_0x3334b8[_0x2832('0x7d')]:undefined)[_0x2832('0x13')](function(_0x40d448){_0x3c85ea(null,_0x40d448);})[_0x2832('0x17')](function(_0x635968){_0x3c85ea(_0x635968);});};AGIVertices['prototype'][_0x2832('0x7e')]=function(_0x25fa88,_0x117488){scripts[_0x2832('0x7e')](_0x25fa88['aws_access_key_id'],_0x25fa88['aws_secret_access_key'],_0x25fa88[_0x2832('0x7f')],_0x25fa88['aws_polly_voice']||_0x2832('0x80'),_0x25fa88[_0x2832('0x58')],_0x25fa88[_0x2832('0x81')]||_0x2832('0x58'))['then'](function(_0x15952d){_0x117488(null,_0x15952d);})[_0x2832('0x17')](function(_0x6c27f){_0x117488(_0x6c27f);});};AGIVertices[_0x2832('0x15')][_0x2832('0x82')]=function(_0x30560f,_0x5bf4ca){scripts[_0x2832('0x82')](this['channel'][_0x2832('0x41')],_0x30560f[_0x2832('0x83')],_0x30560f[_0x2832('0x84')],_0x30560f[_0x2832('0x85')],_0x30560f['text'],_0x30560f[_0x2832('0x86')])['then'](function(_0x50ba07){_0x5bf4ca(null,_0x50ba07);})[_0x2832('0x17')](function(_0x26fdc8){_0x5bf4ca(_0x26fdc8);});};AGIVertices['prototype']['googleASR']=function(_0x308d5d,_0x26ab07,_0x2ea7b4){scripts[_0x2832('0x87')](_0x26ab07,_0x308d5d[_0x2832('0x74')],_0x308d5d[_0x2832('0x88')]||_0x2832('0x5a'))[_0x2832('0x13')](function(_0x1cbbaa){_0x2ea7b4(null,_0x1cbbaa);})[_0x2832('0x17')](function(_0x4e60bc){_0x2ea7b4(_0x4e60bc);});};AGIVertices['prototype'][_0x2832('0x89')]=function(_0x23798a,_0x404635,_0x60cb12){scripts['tildeASR'](_0x404635,_0x23798a['appid'],_0x23798a[_0x2832('0x8a')],_0x23798a[_0x2832('0x8b')])[_0x2832('0x13')](function(_0x26edfd){_0x60cb12(null,_0x26edfd);})[_0x2832('0x17')](function(_0xbd05af){_0x60cb12(_0xbd05af);});};AGIVertices[_0x2832('0x15')][_0x2832('0x8c')]=function(_0x435ce5){var _0x316c10=_['includes'](verticesWithRetry,_0x435ce5[_0x2832('0x8d')])?_0x435ce5:_[_0x2832('0x8e')](_0x435ce5);for(var _0x592ee9 in _0x316c10){if(_0x316c10[_0x2832('0x8f')](_0x592ee9)){if(_0x316c10[_0x592ee9]&&_['isString'](_0x316c10[_0x592ee9])){if(_['includes'](recursiveMapAttributes,_0x592ee9)){_0x316c10[_0x592ee9]=this[_0x2832('0x90')](_0x316c10[_0x592ee9]);}else{_0x316c10[_0x592ee9]=this[_0x2832('0x91')](_0x316c10[_0x592ee9]);}}}}return _0x316c10;};AGIVertices[_0x2832('0x15')]['recursiveNodeIndex']=function(_0x5a1e11){for(var _0x4c6561 in _0x5a1e11){if(_0x5a1e11[_0x2832('0x8f')](_0x4c6561)){if(_[_0x2832('0x92')](_0x5a1e11[_0x4c6561])){this['recursiveNodeIndex'](_0x5a1e11[_0x4c6561]);}else if(_[_0x2832('0x93')](_0x5a1e11[_0x4c6561])){for(var _0x511545=0x0;_0x511545<_0x5a1e11[_0x4c6561][_0x2832('0x94')];_0x511545++){this[_0x2832('0x95')](_0x5a1e11[_0x4c6561][_0x511545]);}}else if(_['isString'](_0x5a1e11[_0x4c6561])){_0x5a1e11[_0x4c6561]=this['replaceAllVariables'](_0x5a1e11[_0x4c6561]);}}}};AGIVertices[_0x2832('0x15')]['saveRestApiResult']=function(_0x58bf63,_0x333673){for(var _0x4ff7d4 in _0x58bf63){if(_0x58bf63[_0x2832('0x8f')](_0x4ff7d4)){if(_[_0x2832('0x92')](_0x58bf63[_0x4ff7d4])){if(!_['isEmpty'](_0x58bf63[_0x4ff7d4])){this['saveRestApiResult'](_0x58bf63[_0x4ff7d4],util[_0x2832('0x28')](_0x2832('0x96'),_0x333673,_0x4ff7d4));}}else if(_['isArray'](_0x58bf63[_0x4ff7d4])){for(var _0x52c017=0x0;_0x52c017<_0x58bf63[_0x4ff7d4]['length'];_0x52c017++){this['saveRestApiResult'](_0x58bf63[_0x4ff7d4][_0x52c017],util['format'](_0x2832('0x96'),_0x333673,_0x4ff7d4+'['+_0x52c017+']'));}}else{if(!_[_0x2832('0x44')](_0x58bf63[_0x4ff7d4])){this['channel']['setVariable'](util[_0x2832('0x28')](_0x2832('0x96'),_0x333673,_0x4ff7d4),_0x58bf63[_0x4ff7d4]);}}}}};AGIVertices[_0x2832('0x15')][_0x2832('0x90')]=function(_0x168900){try{var _0x4593e6=JSON[_0x2832('0x65')](_0x168900);this[_0x2832('0x95')](_0x4593e6);return JSON['stringify'](_0x4593e6);}catch(_0x2cee4d){return this[_0x2832('0x91')](_0x168900);}};AGIVertices[_0x2832('0x15')]['replaceAllVariables']=function(_0x32243e){var _0xfb9347=_0x32243e[_0x2832('0x97')]('{');for(var _0x37ee29=0x1;_0x37ee29<_0xfb9347[_0x2832('0x94')];_0x37ee29+=0x1){var _0x4c695e=_0xfb9347[_0x37ee29][_0x2832('0x97')]('}');if(_0x4c695e['length']>0x1){_0x32243e=_0x32243e[_0x2832('0x98')]('{'+_0x4c695e[0x0]+'}',this[_0x2832('0x36')][_0x2832('0x99')](_0x4c695e[0x0])[_0x2832('0x9a')]||_0x4c695e[0x0]);}}if(_0xfb9347[_0x2832('0x94')]===0x1){return _0x32243e[_0x2832('0x4a')]();}return this[_0x2832('0x91')](_0x32243e);};AGIVertices[_0x2832('0x15')]['getAndSetVariable']=function(_0x548267,_0x4bb2f4){var _0x7e667b=this[_0x2832('0x36')]['getVariable'](_0x548267);if(_0x7e667b[_0x2832('0x9b')]===-0x1){return _0x7e667b;}logger[_0x2832('0x2d')](util[_0x2832('0x28')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x4bb2f4,_0x7e667b[_0x2832('0x9a')]));return this[_0x2832('0x36')][_0x2832('0x9c')](_0x4bb2f4,_0x7e667b[_0x2832('0x9a')]);};AGIVertices[_0x2832('0x15')]['isConfigured']=function(_0x3151a9){return _0x3151a9&&_0x3151a9!=='0'&&_0x3151a9!=='-1'&&_0x3151a9!=='';};AGIVertices[_0x2832('0x15')][_0x2832('0x9d')]=function(_0x9cb12b){this[_0x2832('0x35')][_0x2832('0x6a')](this,_0x9cb12b,'-');_0x9cb12b['retry']=_0x9cb12b[_0x2832('0x9d')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x2832('0x9e')]=function(_0x33c5fb){logger[_0x2832('0x2d')](util[_0x2832('0x28')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x33c5fb[_0x2832('0x37')]));if(!this[_0x2832('0x7c')](_0x33c5fb[_0x2832('0x58')])){return this[_0x2832('0x36')][_0x2832('0x9f')]('no\x20text\x20configured');}var _0x584be7='\x22'+_0x33c5fb[_0x2832('0x58')]+'\x22';if(this[_0x2832('0x7c')](_0x33c5fb['options'])){_0x584be7+=','+_0x33c5fb[_0x2832('0x72')];}var _0x4c0651=this['channel']['exec'](_0x2832('0xa0'),_0x584be7);if(_0x4c0651['result']===-0x1){return _0x4c0651;}return this[_0x2832('0x36')][_0x2832('0x9f')](util[_0x2832('0x28')](_0x2832('0xa1'),_0x584be7));};AGIVertices[_0x2832('0x15')][_0x2832('0xa2')]=function(_0x109759){logger['info'](util['format'](_0x2832('0xa3'),_0x109759[_0x2832('0x37')]));if(!this[_0x2832('0x7c')](_0x109759[_0x2832('0xa4')])){return this[_0x2832('0x36')][_0x2832('0x9f')](_0x2832('0xa5'));}var _0x243297=_0x109759[_0x2832('0xa4')];if(this['isConfigured'](_0x109759['options'])){_0x243297+=','+_0x109759[_0x2832('0x72')];}var _0x25dbd0=this[_0x2832('0x36')][_0x2832('0x53')](_0x2832('0xa6'),_0x243297);if(_0x25dbd0['result']===-0x1){return _0x25dbd0;}var _0x16784c=this[_0x2832('0xa7')](_0x2832('0xa8'),_0x2832('0xa9'));if(_0x16784c['result']===-0x1){return _0x16784c;}var _0x2f558d=this[_0x2832('0xa7')](_0x2832('0xaa'),'MRCP_RECOG_TRANSCRIPT');if(_0x2f558d['result']===-0x1){return _0x2f558d;}var _0x2ad135=this[_0x2832('0xa7')](_0x2832('0xab'),_0x2832('0xac'));if(_0x2ad135['result']===-0x1){return _0x2ad135;}return this[_0x2832('0x36')][_0x2832('0x9f')](util[_0x2832('0x28')](_0x2832('0xad'),_0x243297));};AGIVertices['prototype'][_0x2832('0xae')]=function(_0x85972d){logger[_0x2832('0x2d')](util['format']('Enter\x20in\x20AGI\x20(%s)\x20block',_0x85972d[_0x2832('0x37')]));return this[_0x2832('0x36')][_0x2832('0xae')]([_0x85972d['command'],_0x85972d[_0x2832('0xaf')]]);};AGIVertices['prototype'][_0x2832('0xb0')]=function(_0x47eb67){logger[_0x2832('0x2d')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x47eb67[_0x2832('0x37')]));if(this[_0x2832('0x7c')](_0x47eb67[_0x2832('0x60')])){logger[_0x2832('0x2d')](util[_0x2832('0x28')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x47eb67[_0x2832('0x60')]));var _0x5af823=this[_0x2832('0x36')][_0x2832('0xb1')](_0x47eb67['timeout']);if(_0x5af823[_0x2832('0x9b')]===-0x1){return _0x5af823;}}return this[_0x2832('0x36')][_0x2832('0xb0')]();};AGIVertices[_0x2832('0x15')]['callback']=function(_0xfa3111){logger[_0x2832('0x2d')](util[_0x2832('0x28')](_0x2832('0xb2'),_0xfa3111[_0x2832('0x37')]));if(!this[_0x2832('0x7c')](_0xfa3111[_0x2832('0xb3')])){return this[_0x2832('0x36')][_0x2832('0x2b')](_0xfa3111,_0x2832('0xb4'));}_0xfa3111['scheduledAt']=moment();if(this[_0x2832('0x7c')](_0xfa3111[_0x2832('0xb5')])){_0xfa3111[_0x2832('0x48')]=moment()[_0x2832('0xb6')](_0xfa3111[_0x2832('0xb5')],'minutes');}if(!this[_0x2832('0x7c')](_0xfa3111[_0x2832('0xb7')])){_0xfa3111['callback_priority']=0x2;}this[_0x2832('0x42')][_0x2832('0x6a')](this,_0xfa3111);return this['channel'][_0x2832('0x9f')](util[_0x2832('0x28')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0xfa3111[_0x2832('0x47')],_0xfa3111[_0x2832('0xb3')],_0xfa3111[_0x2832('0x48')]));};AGIVertices['prototype'][_0x2832('0xb8')]=function(_0x515cad){logger[_0x2832('0x2d')](util[_0x2832('0x28')](_0x2832('0xb9'),_0x515cad[_0x2832('0x37')]));var _0x4aa045=this['channel']['exec'](_0x515cad[_0x2832('0xba')],_0x515cad[_0x2832('0x72')]);if(_0x4aa045[_0x2832('0x9b')]===-0x1){return _0x4aa045;}return this['channel']['noop'](util[_0x2832('0x28')](_0x2832('0xbb'),_0x515cad[_0x2832('0xba')],_0x515cad['options']));};AGIVertices[_0x2832('0x15')]['lumenvoxtts']=function(_0x1d6cd1){logger['info'](util[_0x2832('0x28')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x1d6cd1[_0x2832('0x37')]));if(!this['isConfigured'](_0x1d6cd1[_0x2832('0x58')])){return this[_0x2832('0x36')][_0x2832('0x9f')](_0x2832('0xbc'));}var _0x522e85='\x22'+_0x1d6cd1['text']+'\x22';if(this['isConfigured'](_0x1d6cd1[_0x2832('0x72')])){_0x522e85+=','+_0x1d6cd1[_0x2832('0x72')];}var _0x2ba1f6=this['channel']['exec']('MRCPSynth',_0x522e85);if(_0x2ba1f6[_0x2832('0x9b')]===-0x1){return _0x2ba1f6;}return this[_0x2832('0x36')][_0x2832('0x9f')](util[_0x2832('0x28')](_0x2832('0xa1'),_0x522e85));};AGIVertices[_0x2832('0x15')][_0x2832('0xbd')]=function(_0x2b5b6e){logger[_0x2832('0x2d')](util[_0x2832('0x28')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x2b5b6e[_0x2832('0x37')]));if(!this[_0x2832('0x7c')](_0x2b5b6e[_0x2832('0x58')])){return this[_0x2832('0x36')][_0x2832('0x9f')]('no\x20text\x20configured');}var _0x308241='\x22'+_0x2b5b6e[_0x2832('0x58')]+'\x22';if(this['isConfigured'](_0x2b5b6e[_0x2832('0x72')])){_0x308241+=','+_0x2b5b6e[_0x2832('0x72')];}var _0x586dae=this[_0x2832('0x36')][_0x2832('0x53')](_0x2832('0xa0'),_0x308241);if(_0x586dae[_0x2832('0x9b')]===-0x1){return _0x586dae;}return this['channel'][_0x2832('0x9f')](util[_0x2832('0x28')]('Executed\x20command\x20MRCPSynth\x20%s',_0x308241));};AGIVertices[_0x2832('0x15')][_0x2832('0xbe')]=function(_0x31a694){logger[_0x2832('0x2d')](util['format']('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x31a694['label']));if(!this[_0x2832('0x7c')](_0x31a694['grammar'])){return this[_0x2832('0x36')][_0x2832('0x9f')](_0x2832('0xa5'));}var _0x16d760=_0x31a694[_0x2832('0xa4')];if(this[_0x2832('0x7c')](_0x31a694['options'])){_0x16d760+=','+_0x31a694['options'];}var _0x2f1916=this[_0x2832('0x36')][_0x2832('0x53')]('MRCPRecog',_0x16d760);if(_0x2f1916[_0x2832('0x9b')]===-0x1){return _0x2f1916;}var _0x41e8f1=this['getAndSetVariable'](_0x2832('0xa8'),_0x2832('0xbf'));if(_0x41e8f1[_0x2832('0x9b')]===-0x1){return _0x41e8f1;}var _0x76def2=this[_0x2832('0xa7')](_0x2832('0xaa'),_0x2832('0xc0'));if(_0x76def2['result']===-0x1){return _0x76def2;}var _0x268762=this[_0x2832('0xa7')](_0x2832('0xab'),_0x2832('0xc1'));if(_0x268762[_0x2832('0x9b')]===-0x1){return _0x268762;}return this[_0x2832('0x36')][_0x2832('0x9f')](util[_0x2832('0x28')](_0x2832('0xad'),_0x16d760));};AGIVertices[_0x2832('0x15')]['sestekasr']=function(_0x5de4fa){logger['info'](util[_0x2832('0x28')](_0x2832('0xc2'),_0x5de4fa['label']));if(!this[_0x2832('0x7c')](_0x5de4fa[_0x2832('0xa4')])){return this[_0x2832('0x36')]['noop'](_0x2832('0xa5'));}var _0x555645=_0x5de4fa[_0x2832('0xa4')];if(this[_0x2832('0x7c')](_0x5de4fa[_0x2832('0x72')])){_0x555645+=','+_0x5de4fa[_0x2832('0x72')];}var _0x199ab9=this['channel'][_0x2832('0x53')](_0x2832('0xa6'),_0x555645);if(_0x199ab9['result']===-0x1){return _0x199ab9;}var _0x5e09a1=this[_0x2832('0xa7')](_0x2832('0xa8'),_0x2832('0xc3'));if(_0x5e09a1[_0x2832('0x9b')]===-0x1){return _0x5e09a1;}var _0x591e14=this[_0x2832('0xa7')](_0x2832('0xaa'),_0x2832('0xc4'));if(_0x591e14[_0x2832('0x9b')]===-0x1){return _0x591e14;}var _0x40b62f=this[_0x2832('0xa7')](_0x2832('0xab'),_0x2832('0xc5'));if(_0x40b62f[_0x2832('0x9b')]===-0x1){return _0x40b62f;}return this[_0x2832('0x36')][_0x2832('0x9f')](util[_0x2832('0x28')](_0x2832('0xad'),_0x555645));};AGIVertices[_0x2832('0x15')]['database']=function(_0x226f49){logger[_0x2832('0x2d')](util[_0x2832('0x28')](_0x2832('0xc6'),_0x226f49['label']));if(!this[_0x2832('0x7c')](_0x226f49[_0x2832('0xc7')])){return this['channel'][_0x2832('0x2b')](_0x226f49,_0x2832('0xc8'));}var _0x5a1d32=this[_0x2832('0x18')]['sync'](this,_0x226f49[_0x2832('0xc7')]);if(!_0x5a1d32){return this[_0x2832('0x36')][_0x2832('0x2b')](_0x226f49,'no\x20odbc\x20database\x20found');}if(!this[_0x2832('0x7c')](_0x226f49[_0x2832('0x2f')])){return this[_0x2832('0x36')][_0x2832('0x2b')](_0x226f49,_0x2832('0xc9'));}var _0x237b6a=_0x226f49[_0x2832('0x2f')][_0x2832('0xca')](/(\r\n|\n|\r)/gm,'\x20');this[_0x2832('0x36')][_0x2832('0x9f')](util[_0x2832('0x28')](_0x2832('0xcb'),_0x237b6a));var _0x59e2da=this['getQueryOdbc'][_0x2832('0x6a')](this,_0x5a1d32,_0x237b6a);this['createSquareDetailsReport'][_0x2832('0x6a')](this,_0x226f49,_0x237b6a);if(!this[_0x2832('0x7c')](_0x226f49[_0x2832('0xcc')])){return this[_0x2832('0x36')][_0x2832('0x9f')](_0x2832('0xcd'));}var _0x3aaa08=this[_0x2832('0x99')][_0x2832('0x6a')](this,_0x226f49['variable_id']);if(!_0x3aaa08){return this[_0x2832('0x36')][_0x2832('0x2b')](_0x226f49,'no\x20variable\x20found');}var _0x218f5d=this;_0x59e2da['forEach'](function(_0x57b96d,_0x4ab6b9){Object[_0x2832('0xce')](_0x57b96d)[_0x2832('0xcf')](function(_0x5a178a){_0x218f5d['channel'][_0x2832('0x9c')](util[_0x2832('0x28')](_0x2832('0xd0'),_0x3aaa08,_0x4ab6b9,_0x5a178a),_0x57b96d[_0x5a178a]);});});this[_0x2832('0x36')]['setVariable'](util[_0x2832('0x28')](_0x2832('0xd1'),_0x3aaa08),_0x59e2da['length']);return this['channel'][_0x2832('0x9f')](util['format'](_0x2832('0xd2'),_0x3aaa08));};AGIVertices[_0x2832('0x15')][_0x2832('0xd3')]=function(_0x261c68){logger[_0x2832('0xd4')](util[_0x2832('0x28')](_0x2832('0xd5'),_0x261c68[_0x2832('0x37')]));if(!this[_0x2832('0x7c')](_0x261c68[_0x2832('0xd6')])){return this[_0x2832('0x36')][_0x2832('0x2b')](_0x261c68,_0x2832('0xd7'));}var _0x3f89e4=this[_0x2832('0x1b')][_0x2832('0x6a')](this,_0x261c68[_0x2832('0xd6')]);if(!_0x3f89e4){return this[_0x2832('0x36')][_0x2832('0x2b')](_0x261c68,_0x2832('0xd8'));}var _0x153543=this[_0x2832('0x36')]['exec'](_0x2832('0xd9'),[util[_0x2832('0x28')](_0x2832('0xda'),_0x3f89e4),_0x261c68['timeout'],_0x261c68[_0x2832('0xdb')],_0x261c68[_0x2832('0x6c')]]);if(_0x153543['result']===-0x1){return _0x153543;}return this[_0x2832('0x36')][_0x2832('0x9f')](util['format']('Executed\x20command\x20%s','DIAL'));};AGIVertices['prototype'][_0x2832('0xdc')]=function(_0x8563f9){logger[_0x2832('0x2d')](util['format'](_0x2832('0xdd'),_0x8563f9[_0x2832('0x37')]));if(!this[_0x2832('0x7c')](_0x8563f9[_0x2832('0x74')])){return this['channel'][_0x2832('0x9f')](_0x2832('0xde'));}if(!this[_0x2832('0x7c')](_0x8563f9[_0x2832('0x58')])){return this['channel'][_0x2832('0x9f')](_0x2832('0xbc'));}this[_0x2832('0x36')]['bot']=!![];this[_0x2832('0x35')](_0x8563f9);this[_0x2832('0x40')](_0x8563f9[_0x2832('0x58')],'in','','');this[_0x2832('0x36')]['noop'](util[_0x2832('0x28')](_0x2832('0xdf'),_0x8563f9[_0x2832('0x58')]));var _0x5348de=this[_0x2832('0x73')]['sync'](this,_0x8563f9);if(_0x5348de){for(var _0xbb00d6 in _0x5348de){if(_0x5348de[_0x2832('0x8f')](_0xbb00d6)){this[_0x2832('0x36')]['setVariable'](util[_0x2832('0x28')]('DIALOGFLOW_%s',_0xbb00d6[_0x2832('0x63')]()),_0x5348de[_0xbb00d6]);}}this[_0x2832('0x40')](_0x5348de['speech'],'out',_0x2832('0xdc'),'');return this['channel']['noop'](util[_0x2832('0x28')]('Dialogflow\x20Result\x20%s',_0x5348de[_0x2832('0xe0')]));}return this[_0x2832('0x36')]['error'](_0x8563f9,_0x2832('0xe1'));};AGIVertices['prototype'][_0x2832('0xe2')]=function(_0x58c69f){logger['info'](util[_0x2832('0x28')](_0x2832('0xe3'),_0x58c69f[_0x2832('0x37')]));if(!this[_0x2832('0x7c')](_0x58c69f[_0x2832('0xe4')])){return this[_0x2832('0x36')]['noop'](_0x2832('0xe5'));}if(!this['isConfigured'](_0x58c69f[_0x2832('0x77')])){return this[_0x2832('0x36')][_0x2832('0x9f')](_0x2832('0xe6'));}if(!this['isConfigured'](_0x58c69f[_0x2832('0x78')])){return this[_0x2832('0x36')]['noop'](_0x2832('0xe7'));}if(!this[_0x2832('0x7c')](_0x58c69f[_0x2832('0xe8')])){return this[_0x2832('0x36')]['noop'](_0x2832('0xe9'));}if(!this['isConfigured'](_0x58c69f[_0x2832('0x58')])){return this[_0x2832('0x36')]['noop'](_0x2832('0xbc'));}this[_0x2832('0x36')][_0x2832('0xea')]=!![];this['createSquareDetailsReport'](_0x58c69f);this[_0x2832('0x40')](_0x58c69f[_0x2832('0x58')],'in','','');this[_0x2832('0x36')]['noop'](util[_0x2832('0x28')](_0x2832('0xeb'),_0x58c69f['text']));var _0x5a5d95=this[_0x2832('0x76')][_0x2832('0x6a')](this,_0x58c69f);if(_0x5a5d95){for(var _0x3c0d6b in _0x5a5d95){if(_0x5a5d95[_0x2832('0x8f')](_0x3c0d6b)){if(_0x3c0d6b!=='providerResponse'){this[_0x2832('0x36')]['setVariable'](util[_0x2832('0x28')](_0x2832('0xec'),_0x3c0d6b['toUpperCase']()),_0x5a5d95[_0x3c0d6b]);}}}this[_0x2832('0x40')](_0x5a5d95[_0x2832('0xe0')],_0x2832('0xed'),_0x2832('0xe2'),_0x5a5d95[_0x2832('0xee')]);return this[_0x2832('0x36')]['noop'](util['format'](_0x2832('0xef'),_0x5a5d95[_0x2832('0xe0')]));}return this[_0x2832('0x36')]['error'](_0x58c69f,_0x2832('0xf0'));};AGIVertices[_0x2832('0x15')]['sesteknda']=function(_0x2e5627){logger[_0x2832('0x2d')](util['format'](_0x2832('0xf1'),_0x2e5627['label']));if(!this[_0x2832('0x7c')](_0x2e5627[_0x2832('0xf2')])){return this['channel'][_0x2832('0x9f')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x2832('0x7c')](_0x2e5627[_0x2832('0xf3')])){return this['channel'][_0x2832('0x9f')]('no\x20username\x20configured');}if(!this['isConfigured'](_0x2e5627[_0x2832('0xf4')])){return this[_0x2832('0x36')][_0x2832('0x9f')](_0x2832('0xf5'));}if(!this[_0x2832('0x7c')](_0x2e5627[_0x2832('0xf6')])){return this[_0x2832('0x36')]['noop']('no\x20text\x20configured');}this[_0x2832('0x36')][_0x2832('0xea')]=!![];this[_0x2832('0x35')](_0x2e5627);this['createSquareMessage'](_0x2e5627['text'],'in','','');this[_0x2832('0x36')][_0x2832('0x9f')](util[_0x2832('0x28')]('Trying\x20SestekNDA:\x20%s',_0x2e5627[_0x2832('0x58')]));var _0xc63e19=this[_0x2832('0xf7')][_0x2832('0x6a')](this,_0x2e5627);if(_0xc63e19){for(var _0x3d5d5d in _0xc63e19){if(_0xc63e19[_0x2832('0x8f')](_0x3d5d5d)){this[_0x2832('0x36')][_0x2832('0x9c')](util[_0x2832('0x28')](_0x2832('0xf8'),_0x3d5d5d['toUpperCase']()),_0xc63e19[_0x3d5d5d]);}}this['createSquareMessage'](_0xc63e19[_0x2832('0xe0')],_0x2832('0xed'),_0x2832('0xf9'),'');if(_0xc63e19[_0x2832('0xfa')]){this[_0x2832('0x36')]['noop'](util[_0x2832('0x28')](_0x2832('0xfb'),_0xc63e19[_0x2832('0xfa')]));var _0x86d605=this[_0x2832('0x36')]['streamFile'](_0xc63e19['audiofile']);try{fs[_0x2832('0xfc')](_0xc63e19[_0x2832('0xfa')]+_0x2832('0xfd'));}catch(_0x5653f7){logger['error'](_0x5653f7);}return _0x86d605;}else{return this['channel'][_0x2832('0x9f')](util[_0x2832('0x28')]('SestekNDA\x20Result\x20%s',_0xc63e19['speech']));}}return this[_0x2832('0x36')][_0x2832('0x2b')](_0x2e5627,_0x2832('0xfe'));};AGIVertices['prototype']['end']=function(_0x6ef790){logger[_0x2832('0x2d')](util[_0x2832('0x28')](_0x2832('0xff'),_0x6ef790['label']));return this[_0x2832('0x36')]['noop'](_0x2832('0x100'));};AGIVertices[_0x2832('0x15')][_0x2832('0x101')]=function(_0x5d0736){logger[_0x2832('0x2d')](util[_0x2832('0x28')](_0x2832('0x102'),_0x5d0736[_0x2832('0x37')]));var _0x1667ac='';if(_0x5d0736[_0x2832('0x103')]){if(!this[_0x2832('0x7c')](_0x5d0736[_0x2832('0x103')])){return this[_0x2832('0x36')]['error'](_0x5d0736,'no\x20trunk\x20selected');}else{var _0x5067d9=parseInt(_0x5d0736[_0x2832('0x103')],0xa);if(isNaN(_0x5067d9)){_0x1667ac=_0x5d0736[_0x2832('0x103')];}else{_0x1667ac=this['getTrunk'][_0x2832('0x6a')](this,_0x5d0736[_0x2832('0x103')]);if(!_0x1667ac){return this[_0x2832('0x36')][_0x2832('0x2b')](_0x5d0736,'no\x20trunk\x20found');}}}}else if(_0x5d0736[_0x2832('0x104')]){_0x1667ac=_0x5d0736[_0x2832('0x104')];}else{return this[_0x2832('0x36')]['error'](_0x5d0736,'no\x20trunk\x20selected');}var _0x1917c2=this[_0x2832('0x36')][_0x2832('0x53')](_0x2832('0xd9'),[util[_0x2832('0x28')](_0x2832('0x105'),_0x1667ac,_0x5d0736['phone']),_0x5d0736[_0x2832('0x60')],_0x5d0736[_0x2832('0xdb')],_0x5d0736[_0x2832('0x6c')]]);if(_0x1917c2[_0x2832('0x9b')]===-0x1){return _0x1917c2;}return this['channel'][_0x2832('0x9f')](util[_0x2832('0x28')](_0x2832('0x106'),_0x2832('0xd9')));};AGIVertices[_0x2832('0x15')][_0x2832('0x107')]=function(_0x25746a){logger['info'](util[_0x2832('0x28')](_0x2832('0x108'),_0x25746a[_0x2832('0x37')]));return this[_0x2832('0x36')][_0x2832('0x9f')](_0x2832('0x107'));};AGIVertices['prototype'][_0x2832('0x109')]=function(_0x3c00e8){logger[_0x2832('0x2d')](util['format'](_0x2832('0x10a'),_0x3c00e8[_0x2832('0x37')]));if(_0x3c00e8[_0x2832('0x10b')]===0x0){return this[_0x2832('0x9d')](_0x3c00e8);}_0x3c00e8[_0x2832('0x10b')]-=0x1;if(!this[_0x2832('0x7c')](_0x3c00e8[_0x2832('0x10c')])){return this['channel'][_0x2832('0x2b')](_0x3c00e8,_0x2832('0x10d'));}var _0x56dea3=this[_0x2832('0x1e')][_0x2832('0x6a')](this,_0x3c00e8[_0x2832('0x10c')]);if(!_0x56dea3){return this['channel'][_0x2832('0x2b')](_0x3c00e8,_0x2832('0x10e'));}if(!this[_0x2832('0x7c')](_0x3c00e8[_0x2832('0xcc')])){return this['channel'][_0x2832('0x2b')](_0x2832('0xcd'));}var _0x524d92=this[_0x2832('0x36')][_0x2832('0x10f')](_0x56dea3,_0x3c00e8[_0x2832('0x110')],_0x3c00e8[_0x2832('0x111')]);var _0x5cc745=_0x524d92[_0x2832('0x9b')]?_0x524d92[_0x2832('0x9b')][_0x2832('0x4a')]():'';logger[_0x2832('0x2d')](_0x2832('0x112'),JSON[_0x2832('0x6d')](_0x524d92));if(_0x524d92['result']===-0x1){this[_0x2832('0x35')][_0x2832('0x6a')](this,_0x3c00e8,_0x5cc745);return _0x524d92;}else if(_0x524d92[_0x2832('0x9a')]===_0x2832('0x60')){_0x524d92[_0x2832('0x9b')]=_0x5cc745['length']>=parseInt(_0x3c00e8[_0x2832('0x113')])?'x':'i';}else{_0x524d92['result']=_0x5cc745['length']>=parseInt(_0x3c00e8[_0x2832('0x113')])&&_0x5cc745[_0x2832('0x94')]<=parseInt(_0x3c00e8['maxdigit'])?'x':'i';}var _0x5de7bf=this[_0x2832('0x99')][_0x2832('0x6a')](this,_0x3c00e8[_0x2832('0xcc')]);if(!_0x5de7bf){return this[_0x2832('0x36')]['error'](_0x3c00e8,'no\x20variable\x20found');}this[_0x2832('0x36')][_0x2832('0x9c')](_0x5de7bf,_0x5cc745);if(this['isConfigured'](_0x3c00e8['hiddendigitsnum'])){var _0x3d02c7=parseInt(_0x3c00e8[_0x2832('0x114')],0xa);var _0x1c8f1c=rs[_0x2832('0x115')]({'charset':'*','length':_0x3d02c7});var _0x29cc5c=_0x5cc745['length'];if(_0x29cc5c>0x0){if(_0x29cc5c>_0x3d02c7){this[_0x2832('0x35')][_0x2832('0x6a')](this,_0x3c00e8,_0x3c00e8[_0x2832('0x116')]===_0x2832('0x117')?_0x1c8f1c+_0x5cc745[_0x2832('0x118')](_0x3d02c7):_0x5cc745[_0x2832('0x118')](0x0,_0x29cc5c-_0x3d02c7)+_0x1c8f1c);}else{this[_0x2832('0x35')][_0x2832('0x6a')](this,_0x3c00e8,rs[_0x2832('0x115')]({'charset':'*','length':_0x29cc5c}));}}else{this[_0x2832('0x35')]['sync'](this,_0x3c00e8,'');}}else{this['createSquareDetailsReport'][_0x2832('0x6a')](this,_0x3c00e8,_0x5cc745);}return _0x524d92;};AGIVertices['prototype']['getsecretdigits']=function(_0xb39309){logger['info'](util[_0x2832('0x28')](_0x2832('0x119'),_0xb39309['label']));return this[_0x2832('0x109')](_0xb39309);};AGIVertices[_0x2832('0x15')][_0x2832('0x11a')]=function(_0x5141d5){logger[_0x2832('0x2d')](util[_0x2832('0x28')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x5141d5[_0x2832('0x37')]));this[_0x2832('0x35')][_0x2832('0x6a')](this,_0x5141d5,_0x5141d5[_0x2832('0x11b')]);return this['channel'][_0x2832('0x9f')](util[_0x2832('0x28')]('GOAL\x20%s',_0x5141d5['goalname']));};AGIVertices[_0x2832('0x15')][_0x2832('0x11c')]=function(_0x57a291){logger['info'](util['format'](_0x2832('0x11d'),_0x57a291[_0x2832('0x37')]));if(!this[_0x2832('0x7c')](_0x57a291[_0x2832('0x83')])||!this[_0x2832('0x7c')](_0x57a291['aws_secret_access_key'])){return this[_0x2832('0x36')][_0x2832('0x9f')](_0x2832('0x11e'));}if(!this[_0x2832('0x7c')](_0x57a291[_0x2832('0x58')])){return this[_0x2832('0x36')]['noop'](_0x2832('0xbc'));}this[_0x2832('0x36')][_0x2832('0x9f')](util[_0x2832('0x28')](_0x2832('0x11f'),_0x57a291['text']));var _0x52708a=this['awsPolly']['sync'](this,_0x57a291);if(_0x52708a){this[_0x2832('0x36')][_0x2832('0x9f')](util[_0x2832('0x28')](_0x2832('0x120'),_0x52708a));var _0xdf1825=this[_0x2832('0x36')][_0x2832('0x121')](_0x52708a);try{fs[_0x2832('0xfc')](_0x52708a+_0x2832('0xfd'));}catch(_0x2cab47){logger[_0x2832('0x2b')](_0x2cab47);}return _0xdf1825;}return this[_0x2832('0x36')][_0x2832('0x2b')](_0x57a291,_0x2832('0x122'));};AGIVertices['prototype']['awslex']=function(_0x15a075){logger['info'](util[_0x2832('0x28')](_0x2832('0x123'),_0x15a075[_0x2832('0x37')]));if(!this['isConfigured'](_0x15a075[_0x2832('0x83')])||!this['isConfigured'](_0x15a075[_0x2832('0x84')])){return this['channel']['noop'](_0x2832('0x11e'));}if(!this[_0x2832('0x7c')](_0x15a075[_0x2832('0x86')])){return this[_0x2832('0x36')]['noop'](_0x2832('0x124'));}if(!this['isConfigured'](_0x15a075['text'])){return this[_0x2832('0x36')][_0x2832('0x9f')](_0x2832('0xbc'));}this[_0x2832('0x36')][_0x2832('0xea')]=!![];this[_0x2832('0x35')](_0x15a075);this[_0x2832('0x40')](_0x15a075[_0x2832('0x58')],'in','','');this['channel'][_0x2832('0x9f')](util[_0x2832('0x28')]('Trying\x20Amazon\x20Lex:\x20%s',_0x15a075[_0x2832('0x58')]));var _0x5922c9=this[_0x2832('0x82')]['sync'](this,_0x15a075);if(_0x5922c9){for(var _0xcac0b3 in _0x5922c9){if(_0x5922c9[_0x2832('0x8f')](_0xcac0b3)&&_[_0x2832('0x125')](_0x5922c9[_0xcac0b3])){this['channel'][_0x2832('0x9c')](util[_0x2832('0x28')](_0x2832('0x126'),_0xcac0b3['toUpperCase']()),_0x5922c9[_0xcac0b3]);}}if(_['isNil'](_0x5922c9[_0x2832('0x70')])){return this['channel']['noop'](_0x2832('0x127'));}else{this[_0x2832('0x40')](_0x5922c9[_0x2832('0x70')],'out',_0x2832('0x128'),'');return this[_0x2832('0x36')][_0x2832('0x9f')](util[_0x2832('0x28')]('Amazon\x20Lex\x20Result\x20%s',_0x5922c9[_0x2832('0x70')]));}}return this['channel']['error'](_0x15a075,_0x2832('0x129'));};AGIVertices[_0x2832('0x15')][_0x2832('0x12a')]=function(_0x59f24e){logger[_0x2832('0x2d')](util[_0x2832('0x28')](_0x2832('0x12b'),_0x59f24e[_0x2832('0x37')],_0x59f24e[_0x2832('0x60')]));if(!this[_0x2832('0x7c')](_0x59f24e['key'])){return this[_0x2832('0x36')]['noop']('no\x20key\x20configured');}var _0x3c668b=_0x2832('0x12c');var _0x2278bf=util[_0x2832('0x28')](_0x2832('0x12d'),FILES_PATH,rs[_0x2832('0x115')](0x4));var _0x17b252=util[_0x2832('0x28')](_0x2832('0x96'),_0x2278bf,_0x3c668b);var _0x3c649b=!![];if(_0x59f24e['beep']===_0x2832('0x12e')){_0x3c649b=![];}var _0x1d1c70=this[_0x2832('0x36')][_0x2832('0x12f')](_0x2278bf,_0x3c668b,_0x59f24e['intKey'],_0x59f24e['timeout'],undefined,_0x3c649b);if(_0x1d1c70[_0x2832('0x9b')]!==-0x1){this['channel']['noop'](util[_0x2832('0x28')]('google\x20%s\x20file\x20created',_0x17b252));var _0x642d08=this[_0x2832('0x87')][_0x2832('0x6a')](this,_0x59f24e,_0x17b252);if(_0x642d08){for(var _0x59afb3 in _0x642d08){if(_0x642d08[_0x2832('0x8f')](_0x59afb3)){this['channel'][_0x2832('0x9c')](util[_0x2832('0x28')]('GOOGLE_ASR_%s',_0x59afb3['toUpperCase']()),_0x642d08[_0x59afb3]);}}return this[_0x2832('0x36')][_0x2832('0x9f')](util[_0x2832('0x28')](_0x2832('0x130'),JSON[_0x2832('0x6d')](_0x642d08)));}}return _0x1d1c70;};AGIVertices['prototype']['tildeasr']=function(_0x4ccf26){logger[_0x2832('0x2d')](util['format'](_0x2832('0x131'),_0x4ccf26['label']));if(!this[_0x2832('0x7c')](_0x4ccf26[_0x2832('0x132')])){return this[_0x2832('0x36')][_0x2832('0x9f')]('no\x20appid\x20configured');}if(!this[_0x2832('0x7c')](_0x4ccf26[_0x2832('0x8a')])){return this['channel'][_0x2832('0x9f')](_0x2832('0x133'));}var _0xce8db='wav';var _0x3a554a=util['format'](_0x2832('0x12d'),FILES_PATH,rs[_0x2832('0x115')](0x4));var _0x5e18ab=util[_0x2832('0x28')](_0x2832('0x96'),_0x3a554a,_0xce8db);var _0x3c0e66=!![];if(_0x4ccf26[_0x2832('0x134')]==='NOBEEP'){_0x3c0e66=![];}var _0x1e31f5=this['channel'][_0x2832('0x12f')](_0x3a554a,_0xce8db,_0x4ccf26[_0x2832('0x135')],_0x4ccf26[_0x2832('0x60')],undefined,_0x3c0e66);if(_0x1e31f5[_0x2832('0x9b')]!==-0x1){this[_0x2832('0x36')][_0x2832('0x9f')](util[_0x2832('0x28')](_0x2832('0x136'),_0x5e18ab));var _0x20b2c6=this[_0x2832('0x89')]['sync'](this,_0x4ccf26,_0x5e18ab);if(_0x20b2c6){for(var _0x30ac55 in _0x20b2c6){if(_0x20b2c6[_0x2832('0x8f')](_0x30ac55)){this['channel'][_0x2832('0x9c')](util[_0x2832('0x28')](_0x2832('0x137'),_0x30ac55[_0x2832('0x63')]()),_0x20b2c6[_0x30ac55]);}}return this[_0x2832('0x36')][_0x2832('0x9f')](util[_0x2832('0x28')](_0x2832('0x138'),JSON[_0x2832('0x6d')](_0x20b2c6)));}}return _0x1e31f5;};AGIVertices[_0x2832('0x15')]['gotoc']=function(_0x104a66){logger['info'](util[_0x2832('0x28')](_0x2832('0x139'),_0x104a66[_0x2832('0x37')]));return this[_0x2832('0x36')][_0x2832('0x13a')](_0x104a66['context'],_0x104a66[_0x2832('0x3d')],_0x104a66[_0x2832('0x13b')]);};AGIVertices[_0x2832('0x15')]['gotoif']=function(_0x378d34){logger[_0x2832('0x2d')](util[_0x2832('0x28')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x378d34['label']));if(!this[_0x2832('0x7c')](_0x378d34[_0x2832('0x13c')])){return this[_0x2832('0x36')][_0x2832('0x2b')](_0x378d34,_0x2832('0x13d'));}try{var _0x2c4318=eval(_0x378d34['condition'])?'true':'false';this[_0x2832('0x36')][_0x2832('0x9f')](util[_0x2832('0x28')](_0x2832('0x13e'),_0x378d34[_0x2832('0x13c')],_0x2c4318));return{'code':0xc8,'result':_0x2c4318};}catch(_0x25718d){return{'code':0xc8,'result':_0x2832('0x13f')};}};AGIVertices[_0x2832('0x15')][_0x2832('0x140')]=function(_0x5bd190){logger[_0x2832('0x2d')](util[_0x2832('0x28')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x5bd190['label']));if(!this[_0x2832('0x7c')](_0x5bd190['interval_id'])){return this[_0x2832('0x36')][_0x2832('0x2b')](_0x5bd190,_0x2832('0x141'));}var _0x34ff11=this['getIntervals'][_0x2832('0x6a')](this,_0x5bd190[_0x2832('0x142')]);if(!_0x34ff11){return this[_0x2832('0x36')]['error'](_0x5bd190,'no\x20intervals\x20found');}for(var _0x490bf8=0x0;_0x490bf8<_0x34ff11[_0x2832('0x94')];_0x490bf8+=0x1){var _0xc843ee=this['channel'][_0x2832('0x99')](util[_0x2832('0x28')](_0x2832('0x143'),_0x34ff11[_0x490bf8]));if(_0xc843ee[_0x2832('0x9b')]===-0x1){return _0xc843ee;}logger[_0x2832('0x2d')](util[_0x2832('0x28')]('IFTIME\x20%s\x20%s',_0x34ff11[_0x490bf8],_0xc843ee[_0x2832('0x9a')]));if(_0xc843ee[_0x2832('0x9a')]===_0x2832('0x144')){logger['info'](util[_0x2832('0x28')](_0x2832('0x145'),_0x34ff11[_0x490bf8],_0x2832('0x144')));this[_0x2832('0x36')][_0x2832('0x9f')](util[_0x2832('0x28')](_0x2832('0x145'),_0x34ff11[_0x490bf8],_0x2832('0x144')));return{'code':0xc8,'result':'true'};}else{logger[_0x2832('0x2d')](util[_0x2832('0x28')](_0x2832('0x145'),_0x34ff11[_0x490bf8],'false'));this[_0x2832('0x36')][_0x2832('0x9f')](util[_0x2832('0x28')]('IFTIME\x20%s\x20%s',_0x34ff11[_0x490bf8],_0x2832('0x13f')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x2832('0x15')][_0x2832('0x146')]=function(_0x57997d){logger[_0x2832('0x2d')](util[_0x2832('0x28')](_0x2832('0x147'),_0x57997d[_0x2832('0x37')]));return this[_0x2832('0x36')][_0x2832('0x146')]();};AGIVertices['prototype'][_0x2832('0x148')]=function(_0x515aa7){logger[_0x2832('0x2d')](util[_0x2832('0x28')](_0x2832('0x149'),_0x515aa7[_0x2832('0x37')]));if(!this['isConfigured'](_0x515aa7['key'])){return this[_0x2832('0x36')][_0x2832('0x9f')](_0x2832('0xde'));}var _0x46d3e3=_0x2832('0x12c');var _0x24ea77=util['format']('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x2cc4ae=util[_0x2832('0x28')](_0x2832('0x96'),_0x24ea77,_0x46d3e3);var _0x4ea0e4=!![];if(_0x515aa7[_0x2832('0x134')]==='NOBEEP'){_0x4ea0e4=![];}var _0xe1ccf5=this['channel']['recordFile'](_0x24ea77,_0x46d3e3,_0x515aa7[_0x2832('0x135')],_0x515aa7[_0x2832('0x60')],undefined,_0x4ea0e4);if(_0xe1ccf5[_0x2832('0x9b')]!==-0x1){this[_0x2832('0x36')][_0x2832('0x9f')](util['format'](_0x2832('0x14a'),_0x2cc4ae));var _0x244035=this[_0x2832('0x7a')]['sync'](this,_0x515aa7,_0x2cc4ae);if(_0x244035){for(var _0x5ec949 in _0x244035){if(_0x244035['hasOwnProperty'](_0x5ec949)){this[_0x2832('0x36')]['setVariable'](util['format'](_0x2832('0x14b'),_0x5ec949['toUpperCase']()),_0x244035[_0x5ec949]);}}return this['channel'][_0x2832('0x9f')](util[_0x2832('0x28')](_0x2832('0x14c'),JSON['stringify'](_0x244035)));}}return _0xe1ccf5;};AGIVertices[_0x2832('0x15')][_0x2832('0x14d')]=function(_0x7f9a08){logger[_0x2832('0x2d')](util[_0x2832('0x28')](_0x2832('0x14e'),_0x7f9a08['label']));if(!this['isConfigured'](_0x7f9a08['key'])){return this[_0x2832('0x36')]['noop'](_0x2832('0xde'));}if(!this[_0x2832('0x7c')](_0x7f9a08['text'])){return this[_0x2832('0x36')]['noop'](_0x2832('0xbc'));}this[_0x2832('0x36')]['noop'](util[_0x2832('0x28')](_0x2832('0x14f'),_0x7f9a08[_0x2832('0x58')]));var _0x446c75=this['ispeechTTS'][_0x2832('0x6a')](this,_0x7f9a08);if(_0x446c75){this[_0x2832('0x36')][_0x2832('0x9f')](util[_0x2832('0x28')](_0x2832('0x14a'),_0x446c75));var _0x36663b=this[_0x2832('0x36')][_0x2832('0x121')](_0x446c75,_0x7f9a08[_0x2832('0x135')]);try{fs[_0x2832('0xfc')](_0x446c75+'.wav');}catch(_0x5d65ff){logger['error'](_0x5d65ff);}return _0x36663b;}return this[_0x2832('0x36')][_0x2832('0x2b')](_0x7f9a08,_0x2832('0x150'));};AGIVertices['prototype']['login']=function(_0x31d0fb){logger[_0x2832('0x2d')](util[_0x2832('0x28')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x31d0fb['label']));if(!this[_0x2832('0x7c')](_0x31d0fb['findBy'])){return this[_0x2832('0x36')]['error'](_0x31d0fb,_0x2832('0x151'));}logger[_0x2832('0x2d')](util[_0x2832('0x28')](_0x2832('0x152'),this[_0x2832('0x36')][_0x2832('0x39')],_0x31d0fb['findBy']));var _0x545d37=this[_0x2832('0x4f')][_0x2832('0x6a')](this,_0x31d0fb['findBy']);if(_0x545d37){logger[_0x2832('0x2d')](util[_0x2832('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x2832('0x36')][_0x2832('0x39')],_0x31d0fb[_0x2832('0x153')]));this[_0x2832('0x36')][_0x2832('0x9f')](util[_0x2832('0x28')](_0x2832('0x154'),this[_0x2832('0x36')][_0x2832('0x39')],_0x31d0fb[_0x2832('0x153')]));return{'code':0xc8,'result':'success'};}else{logger[_0x2832('0x2d')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x2832('0x36')][_0x2832('0x39')],_0x31d0fb[_0x2832('0x153')]));this['channel'][_0x2832('0x9f')](util[_0x2832('0x28')](_0x2832('0x155'),this[_0x2832('0x36')][_0x2832('0x39')],_0x31d0fb[_0x2832('0x153')]));return{'code':0xc8,'result':_0x2832('0x156')};}};AGIVertices[_0x2832('0x15')]['logout']=function(_0x2c499f){logger[_0x2832('0x2d')](util[_0x2832('0x28')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x2c499f['label']));if(!this[_0x2832('0x7c')](_0x2c499f[_0x2832('0x153')])){return this[_0x2832('0x36')][_0x2832('0x2b')](_0x2c499f,_0x2832('0x151'));}logger[_0x2832('0x2d')](util[_0x2832('0x28')](_0x2832('0x152'),this[_0x2832('0x36')]['callerid'],_0x2c499f[_0x2832('0x153')]));var _0x23ede6=this['agentLogout']['sync'](this,_0x2c499f['findBy']);if(_0x23ede6){logger[_0x2832('0x2d')](util[_0x2832('0x28')](_0x2832('0x154'),this[_0x2832('0x36')][_0x2832('0x39')],_0x2c499f[_0x2832('0x153')]));this['channel'][_0x2832('0x9f')](util['format'](_0x2832('0x154'),this[_0x2832('0x36')][_0x2832('0x39')],_0x2c499f[_0x2832('0x153')]));return{'code':0xc8,'result':_0x2832('0x157')};}else{logger[_0x2832('0x2d')](util[_0x2832('0x28')](_0x2832('0x155'),this[_0x2832('0x36')][_0x2832('0x39')],_0x2c499f[_0x2832('0x153')]));this['channel'][_0x2832('0x9f')](util[_0x2832('0x28')](_0x2832('0x155'),this[_0x2832('0x36')][_0x2832('0x39')],_0x2c499f['findBy']));return{'code':0xc8,'result':_0x2832('0x156')};}};AGIVertices[_0x2832('0x15')][_0x2832('0x158')]=function(_0x4b8f71){logger[_0x2832('0x2d')](util[_0x2832('0x28')](_0x2832('0x159'),_0x4b8f71['label']));if(!this[_0x2832('0x7c')](_0x4b8f71[_0x2832('0x15a')])){return this['channel'][_0x2832('0x2b')](_0x4b8f71,_0x2832('0x15b'));}this[_0x2832('0x36')]['noop'](util[_0x2832('0x28')](_0x2832('0x15c'),_0x4b8f71[_0x2832('0x15a')]));var _0x35851b=eval(_0x4b8f71[_0x2832('0x15a')]);if(!this['isConfigured'](_0x4b8f71['variable_id'])){return this[_0x2832('0x36')][_0x2832('0x9f')](_0x2832('0xcd'));}var _0x136b54=this[_0x2832('0x99')][_0x2832('0x6a')](this,_0x4b8f71[_0x2832('0xcc')]);if(!_0x136b54){return this[_0x2832('0x36')][_0x2832('0x2b')](_0x4b8f71,'no\x20variable\x20found');}if(_[_0x2832('0x93')](_0x35851b)){var _0x579ae5=this;_0x35851b[_0x2832('0xcf')](function(_0x3fcf3c,_0x505015){_0x579ae5[_0x2832('0x36')][_0x2832('0x9c')](util[_0x2832('0x28')](_0x2832('0x15d'),_0x136b54,_0x505015),_0x3fcf3c);});return this[_0x2832('0x36')][_0x2832('0x9f')](util[_0x2832('0x28')](_0x2832('0x15e'),_0x136b54));}else{return this[_0x2832('0x36')]['setVariable'](_0x136b54,_0x35851b);}};AGIVertices[_0x2832('0x15')][_0x2832('0xe')]=function(_0x7dc3b6){logger[_0x2832('0x2d')](util['format'](_0x2832('0x15f'),_0x7dc3b6[_0x2832('0x37')]));if(_0x7dc3b6[_0x2832('0x10b')]===0x0){return this[_0x2832('0x9d')](_0x7dc3b6);}_0x7dc3b6[_0x2832('0x10b')]-=0x1;if(!this[_0x2832('0x7c')](_0x7dc3b6[_0x2832('0x10c')])){return this[_0x2832('0x36')][_0x2832('0x2b')](_0x7dc3b6,'no\x20file\x20audio\x20selected');}var _0x3d2af6=this['getSound'][_0x2832('0x6a')](this,_0x7dc3b6[_0x2832('0x10c')]);if(!_0x3d2af6){return this[_0x2832('0x36')][_0x2832('0x2b')](_0x7dc3b6,_0x2832('0x10e'));}var _0x13088f=this[_0x2832('0x36')][_0x2832('0x10f')](_0x3d2af6,_0x7dc3b6['response'],_0x7dc3b6[_0x2832('0x160')]);var _0x1b1218=_0x13088f['result'];if(_0x13088f[_0x2832('0x9b')]===-0x1){this[_0x2832('0x35')]['sync'](this,_0x7dc3b6,'-1');return _0x13088f;}else if(_0x13088f[_0x2832('0x9a')]==='timeout'){_0x13088f['result']=_0x13088f[_0x2832('0x9b')][_0x2832('0x94')]>0x0?_0x13088f['result']:'t';}else if(_[_0x2832('0x43')](_0x13088f[_0x2832('0x9b')])){_0x13088f['result']='#';_0x1b1218='#';}if(!this[_0x2832('0x7c')](_0x7dc3b6[_0x2832('0xcc')])){this[_0x2832('0x36')]['noop'](_0x2832('0xcd'));}else{var _0xf60a3f=this['getVariable'][_0x2832('0x6a')](this,_0x7dc3b6[_0x2832('0xcc')]);if(!_0xf60a3f){return this['channel'][_0x2832('0x2b')](_0x7dc3b6,_0x2832('0x161'));}this[_0x2832('0x36')][_0x2832('0x9c')](_0xf60a3f,_0x1b1218);}this[_0x2832('0x35')]['sync'](this,_0x7dc3b6,_0x1b1218);return _0x13088f;};AGIVertices[_0x2832('0x15')][_0x2832('0x9f')]=function(_0x3f75a6){logger[_0x2832('0x2d')](util[_0x2832('0x28')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x3f75a6['label']));return this[_0x2832('0x36')][_0x2832('0x9f')](_0x3f75a6[_0x2832('0x162')]||_0x3f75a6[_0x2832('0x37')]);};AGIVertices[_0x2832('0x15')][_0x2832('0x163')]=function(_0x5ccf69){logger['info'](util[_0x2832('0x28')](_0x2832('0x164'),_0x5ccf69[_0x2832('0x37')]));if(!this[_0x2832('0x7c')](_0x5ccf69[_0x2832('0x153')])){return this[_0x2832('0x36')][_0x2832('0x2b')](_0x5ccf69,_0x2832('0x151'));}logger[_0x2832('0x2d')](util['format'](_0x2832('0x152'),this[_0x2832('0x36')][_0x2832('0x39')],_0x5ccf69['findBy']));var _0x2ff536=this[_0x2832('0x4b')][_0x2832('0x6a')](this,_0x5ccf69[_0x2832('0x165')]);var _0x506fce=this['agentPause']['sync'](this,_0x5ccf69[_0x2832('0x153')],_0x2ff536);if(_0x506fce){logger[_0x2832('0x2d')](util[_0x2832('0x28')](_0x2832('0x154'),this[_0x2832('0x36')]['callerid'],_0x5ccf69[_0x2832('0x153')]));this['channel'][_0x2832('0x9f')](util[_0x2832('0x28')](_0x2832('0x154'),this[_0x2832('0x36')][_0x2832('0x39')],_0x5ccf69['findBy']));return{'code':0xc8,'result':_0x2832('0x157')};}else{logger[_0x2832('0x2d')](util[_0x2832('0x28')](_0x2832('0x155'),this['channel'][_0x2832('0x39')],_0x5ccf69['findBy']));this['channel'][_0x2832('0x9f')](util[_0x2832('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x2832('0x36')][_0x2832('0x39')],_0x5ccf69[_0x2832('0x153')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x2832('0x15')]['playback']=function(_0x490b7a){logger[_0x2832('0x2d')](util[_0x2832('0x28')](_0x2832('0x166'),_0x490b7a['label']));if(!this[_0x2832('0x7c')](_0x490b7a['file_id'])){return this[_0x2832('0x36')][_0x2832('0x2b')](_0x490b7a,_0x2832('0x10d'));}var _0x4618e0=this[_0x2832('0x1e')][_0x2832('0x6a')](this,_0x490b7a['file_id']);if(!_0x4618e0){return this[_0x2832('0x36')]['error'](_0x490b7a,_0x2832('0x10e'));}var _0x5b4629=this[_0x2832('0x36')][_0x2832('0x53')](_0x2832('0x167'),[_0x4618e0,_0x490b7a['opts']]);if(_0x5b4629[_0x2832('0x9b')]===-0x1){return _0x5b4629;}return this['channel']['noop'](util[_0x2832('0x28')](_0x2832('0xbb'),_0x2832('0x167'),_0x4618e0));};AGIVertices[_0x2832('0x15')]['queue']=function(_0x466be6){logger[_0x2832('0x2d')](util[_0x2832('0x28')](_0x2832('0x168'),_0x466be6[_0x2832('0x37')]));if(!this[_0x2832('0x7c')](_0x466be6[_0x2832('0x169')])){return this[_0x2832('0x36')][_0x2832('0x2b')](_0x466be6,'no\x20queue\x20selected');}var _0x1f5b93='';var _0x51201e=parseInt(_0x466be6[_0x2832('0x169')],0xa);if(isNaN(_0x51201e)){_0x1f5b93=_0x466be6[_0x2832('0x169')];}else{_0x1f5b93=this[_0x2832('0x16a')]['sync'](this,_0x466be6[_0x2832('0x169')]);if(!_0x1f5b93){return this[_0x2832('0x36')][_0x2832('0x2b')](_0x466be6,_0x2832('0x16b'));}}var _0x1ee8ad='';if(this[_0x2832('0x7c')](_0x466be6['file_id'])){var _0x7c03b6=this[_0x2832('0x1e')][_0x2832('0x6a')](this,_0x466be6[_0x2832('0x10c')]);if(_0x7c03b6){_0x1ee8ad=_0x7c03b6;}}this['createSquareDetailsReport'][_0x2832('0x6a')](this,_0x466be6,_0x1f5b93);if(_0x466be6[_0x2832('0xdb')]['indexOf']('x')<0x0){_0x466be6['opts']+='x';}if(_0x466be6[_0x2832('0xdb')]['indexOf']('X')<0x0){_0x466be6[_0x2832('0xdb')]+='X';}this[_0x2832('0x36')][_0x2832('0x9c')](_0x2832('0x16c'),_0x1f5b93?_0x1f5b93[_0x2832('0x16d')]():'');var _0x17cd4f=this[_0x2832('0x36')][_0x2832('0x53')](_0x2832('0x16e'),[_0x1f5b93,_0x466be6[_0x2832('0xdb')],_0x466be6['url'],_0x1ee8ad,_0x466be6[_0x2832('0x60')],_0x466be6['agi'],_0x466be6[_0x2832('0x16f')],_0x466be6[_0x2832('0x170')],'',_0x466be6[_0x2832('0x171')]]);if(_0x17cd4f[_0x2832('0x9b')]===-0x1){return _0x17cd4f;}return this[_0x2832('0x36')][_0x2832('0x9f')](util[_0x2832('0x28')](_0x2832('0xbb'),_0x2832('0x16e'),_0x1f5b93));};AGIVertices[_0x2832('0x15')][_0x2832('0x172')]=function(_0x1ae16e){logger[_0x2832('0x2d')](util[_0x2832('0x28')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x1ae16e['label']));var _0x5f2860=_0x1ae16e[_0x2832('0x173')]||'wav';var _0x135a86=util[_0x2832('0x28')]('%s_%s',this[_0x2832('0x36')][_0x2832('0x41')],rs[_0x2832('0x115')](0x5));var _0x2243a2=util[_0x2832('0x28')](_0x2832('0x174'),FILES_PATH,_0x135a86,_0x5f2860);var _0x2193a4=util[_0x2832('0x28')](_0x2832('0x12d'),FILES_PATH,_0x135a86);this[_0x2832('0x3a')][_0x2832('0x6a')](this,_0x1ae16e,_0x135a86,_0x2243a2);this[_0x2832('0x36')][_0x2832('0x9c')](_0x2832('0x175'),_0x135a86);logger[_0x2832('0x2d')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x2193a4,_0x5f2860,_0x1ae16e['escape_digits'],_0x1ae16e[_0x2832('0x60')]);return this[_0x2832('0x36')][_0x2832('0x12f')](_0x2193a4,_0x5f2860,_0x1ae16e['escape_digits'],_0x1ae16e[_0x2832('0x60')],undefined,!![]);};AGIVertices['prototype'][_0x2832('0x176')]=function(_0x464b5e){logger[_0x2832('0x2d')](util[_0x2832('0x28')](_0x2832('0x177'),_0x464b5e[_0x2832('0x37')]));if(!this[_0x2832('0x7c')](_0x464b5e[_0x2832('0x6c')])){return this['channel']['noop'](_0x2832('0x178'));}var _0x548773=this['restAPI'][_0x2832('0x6a')](this,_0x464b5e);logger[_0x2832('0x2d')](util['format'](_0x2832('0x179'),util[_0x2832('0x17a')](_0x548773,{'showHidden':![],'depth':null})));if(!this[_0x2832('0x7c')](_0x464b5e[_0x2832('0xcc')])){return this[_0x2832('0x36')]['noop'](_0x2832('0x17b'));}var _0x4b04be=this['getVariable']['sync'](this,_0x464b5e[_0x2832('0xcc')]);if(!_0x4b04be){return this[_0x2832('0x36')][_0x2832('0x2b')](_0x464b5e,_0x2832('0x161'));}this[_0x2832('0x36')]['setVariable'](util['format'](_0x2832('0x17c'),_0x4b04be),_0x548773[_0x2832('0x6f')]?_0x548773[_0x2832('0x6f')]:_0x2832('0x17d'));this[_0x2832('0x36')][_0x2832('0x9c')](util[_0x2832('0x28')](_0x2832('0x17e'),_0x4b04be),_0x548773[_0x2832('0x17f')]?_0x548773['statusMessage']:'OK');if(_0x548773['body']){try{this[_0x2832('0x180')](_0x548773[_0x2832('0x64')],_0x4b04be);}catch(_0x548b8e){logger[_0x2832('0x2b')](util[_0x2832('0x28')](_0x2832('0x181'),_0x4b04be));}}return this[_0x2832('0x36')][_0x2832('0x9f')](util['format']('variable\x20%s\x20set',_0x4b04be));};AGIVertices[_0x2832('0x15')][_0x2832('0x182')]=function(_0xe4b855){logger[_0x2832('0x2d')](util[_0x2832('0x28')](_0x2832('0x183'),_0xe4b855[_0x2832('0x37')]));return this['channel'][_0x2832('0x184')](_0xe4b855['digits'][_0x2832('0xca')](/\s+/g,''),_0xe4b855[_0x2832('0x185')]);};AGIVertices[_0x2832('0x15')]['saynumber']=function(_0xd6035a){logger['info'](util['format'](_0x2832('0x186'),_0xd6035a[_0x2832('0x37')]));return this[_0x2832('0x36')]['sayNumber'](_0xd6035a[_0x2832('0x187')][_0x2832('0xca')](/\s+/g,''),_0xd6035a[_0x2832('0x185')]);};AGIVertices[_0x2832('0x15')][_0x2832('0x188')]=function(_0x1fef71){logger[_0x2832('0x2d')](util['format']('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x1fef71[_0x2832('0x37')]));return this[_0x2832('0x36')][_0x2832('0x189')](_0x1fef71[_0x2832('0x58')],_0x1fef71[_0x2832('0x185')]);};AGIVertices['prototype'][_0x2832('0x18a')]=function(_0x3e6d87){logger[_0x2832('0x2d')](util['format'](_0x2832('0x18b'),_0x3e6d87[_0x2832('0x37')]));if(!this[_0x2832('0x7c')](_0x3e6d87[_0x2832('0x18c')])){return this['channel'][_0x2832('0x9f')](_0x2832('0x18d'));}var _0x51d6ce=this[_0x2832('0x21')][_0x2832('0x6a')](this,_0x3e6d87[_0x2832('0x18c')]);if(!_0x51d6ce||!_0x51d6ce[_0x2832('0x18e')]){return this[_0x2832('0x36')][_0x2832('0x2b')](_0x3e6d87,'no\x20mail\x20account\x20found');}var _0x47039e={'from':util[_0x2832('0x28')]('\x22%s\x22\x20<%s>',_0x51d6ce[_0x2832('0x14')],_0x51d6ce[_0x2832('0x18f')]||_0x51d6ce[_0x2832('0x18e')][_0x2832('0x190')]),'to':_0x3e6d87['to']||'','cc':_0x3e6d87['cc']||'','bcc':_0x3e6d87[_0x2832('0x191')]||'','subject':_0x3e6d87[_0x2832('0x192')],'html':_0x3e6d87['text'],'text':_0x3e6d87[_0x2832('0x58')]};var _0x5cd6f1={'tls':{'rejectUnauthorized':![]}};if(_0x51d6ce['Smtp']['service']){_0x5cd6f1['service']=_0x51d6ce[_0x2832('0x18e')][_0x2832('0x193')];}else{_0x5cd6f1[_0x2832('0x194')]=_0x51d6ce[_0x2832('0x18e')][_0x2832('0x194')];_0x5cd6f1['port']=_0x51d6ce[_0x2832('0x18e')][_0x2832('0x195')];_0x5cd6f1['secure']=_0x51d6ce[_0x2832('0x18e')][_0x2832('0x196')];}if(_0x51d6ce['Smtp']['authentication']){_0x5cd6f1[_0x2832('0x197')]={'user':_0x51d6ce[_0x2832('0x18e')][_0x2832('0x190')],'pass':_0x51d6ce[_0x2832('0x18e')]['pass']};}if(this[_0x2832('0x7c')](_0x3e6d87['template_id'])){}logger[_0x2832('0xd4')](_0x2832('0x198'),JSON['stringify'](_0x47039e));this[_0x2832('0x35')][_0x2832('0x6a')](this,_0x3e6d87,_0x3e6d87[_0x2832('0x18c')]);this[_0x2832('0x36')][_0x2832('0x9f')](util[_0x2832('0x28')](_0x2832('0x199'),_0x51d6ce[_0x2832('0x14')]));this['sendMailMessage'][_0x2832('0x6a')](this,_0x5cd6f1,_0x47039e);return this[_0x2832('0x36')][_0x2832('0x9f')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x2832('0x15')][_0x2832('0x19a')]=function(_0x481710){logger[_0x2832('0x2d')](util[_0x2832('0x28')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x481710[_0x2832('0x37')]));return this[_0x2832('0x36')][_0x2832('0x9f')](_0x2832('0x19b'));};AGIVertices[_0x2832('0x15')][_0x2832('0x19c')]=function(_0x2fbfa1){logger['info'](util[_0x2832('0x28')](_0x2832('0x19d'),_0x2fbfa1[_0x2832('0x37')]));if(!this[_0x2832('0x7c')](_0x2fbfa1[_0x2832('0x19e')])){return this[_0x2832('0x36')][_0x2832('0x9f')]('no\x20sms\x20account\x20configured');}var _0x4908d1=this[_0x2832('0x33')]['sync'](this,_0x2fbfa1[_0x2832('0x19e')]);if(!_0x4908d1){return this['channel']['error'](_0x2fbfa1,'no\x20sms\x20account\x20found');}var _0x154086={'body':_0x2fbfa1[_0x2832('0x19f')],'phone':_0x2fbfa1['to']||'','SmsAccountId':_0x4908d1['id']};logger[_0x2832('0xd4')](_0x2832('0x1a0'),JSON['stringify'](_0x154086));this[_0x2832('0x35')][_0x2832('0x6a')](this,_0x2fbfa1,_0x2fbfa1[_0x2832('0x19e')]);this[_0x2832('0x36')][_0x2832('0x9f')](util['format']('Trying\x20SendSMS\x20with\x20account\x20%s',_0x4908d1[_0x2832('0x14')]));this['createSmsMessage'][_0x2832('0x6a')](this,_0x154086);return this[_0x2832('0x36')][_0x2832('0x9f')](_0x2832('0x1a1'));};AGIVertices[_0x2832('0x15')][_0x2832('0x1a2')]=function(_0x493789){logger[_0x2832('0x2d')](util[_0x2832('0x28')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x493789[_0x2832('0x37')]));if(!this['isConfigured'](_0x493789['variable_id'])){return this[_0x2832('0x36')][_0x2832('0x2b')](_0x493789,_0x2832('0x1a3'));}var _0x2307fe=this['getVariable'][_0x2832('0x6a')](this,_0x493789['variable_id']);if(!_0x2307fe){return this['channel'][_0x2832('0x2b')](_0x493789,'no\x20variable\x20found');}return this['channel'][_0x2832('0x9c')](_0x2307fe,_0x493789[_0x2832('0x1a4')]);};AGIVertices[_0x2832('0x15')][_0x2832('0x1a5')]=function(_0x28d8fb){logger[_0x2832('0x2d')](util[_0x2832('0x28')](_0x2832('0x1a6'),_0x28d8fb[_0x2832('0x37')]));this[_0x2832('0x36')][_0x2832('0x9f')](_0x2832('0x1a7'));if(_0x28d8fb[_0x2832('0xb0')]===_0x2832('0x1a8')){this[_0x2832('0x36')][_0x2832('0x9f')]('Answer');return this[_0x2832('0x36')]['answer']();}return this['channel'][_0x2832('0x9f')]('Skipped\x20Answer');};AGIVertices[_0x2832('0x15')]['subproject']=function(_0x4360ad){logger[_0x2832('0x2d')](util[_0x2832('0x28')](_0x2832('0x1a9'),_0x4360ad[_0x2832('0x37')]));if(!this[_0x2832('0x7c')](_0x4360ad[_0x2832('0x1aa')])){return this[_0x2832('0x36')][_0x2832('0x2b')](_0x4360ad,_0x2832('0x1ab'));}var _0x51af30=this[_0x2832('0x1ac')][_0x2832('0x6a')](this,_0x4360ad[_0x2832('0x1aa')]);if(!this[_0x2832('0x7c')](_0x51af30)){return this[_0x2832('0x36')][_0x2832('0x2b')](_0x4360ad,util['format'](_0x2832('0x1ad'),_0x4360ad[_0x2832('0x1aa')]));}if(_0x51af30===this[_0x2832('0x36')]['arg_1']){return this[_0x2832('0x36')][_0x2832('0x2b')](_0x4360ad,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x2832('0x35')][_0x2832('0x6a')](this,_0x4360ad,_0x51af30);var _0x2afe31=this[_0x2832('0x36')][_0x2832('0x53')](_0x2832('0x1ae'),util['format']('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x2832('0xae')][_0x2832('0x194')]||_0x2832('0x1af'),_0x51af30,this['channel']['arg_1']));if(_0x2afe31[_0x2832('0x9b')]===-0x1){return _0x2afe31;}return this[_0x2832('0x36')][_0x2832('0x9f')](util[_0x2832('0x28')](_0x2832('0xbb'),_0x2832('0x1ae'),_0x51af30));};AGIVertices[_0x2832('0x15')]['system']=function(_0xb68077){logger[_0x2832('0x2d')](util[_0x2832('0x28')](_0x2832('0x1b0'),_0xb68077['label']));var _0x58ef5b=this[_0x2832('0x52')][_0x2832('0x6a')](this,_0xb68077[_0x2832('0x1b1')]);this[_0x2832('0x35')]['sync'](this,_0xb68077,_0xb68077['command']);if(this[_0x2832('0x7c')](_0xb68077[_0x2832('0xcc')])){var _0x311ad3=this[_0x2832('0x99')][_0x2832('0x6a')](this,_0xb68077['variable_id']);if(_0x311ad3){this[_0x2832('0x36')][_0x2832('0x9c')](_0x311ad3,_0x58ef5b);return this[_0x2832('0x36')]['noop'](util[_0x2832('0x28')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0xb68077['command'],_0x311ad3));}}return this[_0x2832('0x36')][_0x2832('0x9f')](util[_0x2832('0x28')](_0x2832('0x1b2'),_0xb68077['command']));};AGIVertices[_0x2832('0x15')][_0x2832('0x1b3')]=function(_0x27369f){logger[_0x2832('0x2d')](util[_0x2832('0x28')](_0x2832('0x1b4'),_0x27369f[_0x2832('0x37')]));_0x27369f['text']=_0x27369f[_0x2832('0x58')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x27369f['apiKey'])){return this[_0x2832('0x36')][_0x2832('0x9f')](_0x2832('0x1b5'));}if(!this['isConfigured'](_0x27369f['text'])){return this['channel'][_0x2832('0x9f')](_0x2832('0xbc'));}this[_0x2832('0x36')][_0x2832('0x9f')](util[_0x2832('0x28')](_0x2832('0x1b6'),_0x27369f[_0x2832('0x58')]));var _0x5e7c80=this[_0x2832('0x55')][_0x2832('0x6a')](this,_0x27369f);if(_0x5e7c80){this[_0x2832('0x36')][_0x2832('0x9f')](util[_0x2832('0x28')](_0x2832('0x1b7'),_0x5e7c80));var _0x4d76c2=this[_0x2832('0x36')][_0x2832('0x121')](_0x5e7c80);try{fs['unlink'](_0x5e7c80+_0x2832('0xfd'));}catch(_0x170245){logger['error'](_0x170245);}return _0x4d76c2;}return this[_0x2832('0x36')]['error'](_0x27369f,_0x2832('0x1b8'));};AGIVertices[_0x2832('0x15')][_0x2832('0x1b9')]=function(_0x2d0ab5){logger[_0x2832('0x2d')](util['format']('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x2d0ab5['label']));_0x2d0ab5[_0x2832('0x58')]=_0x2d0ab5['text'][_0x2832('0xca')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x2d0ab5[_0x2832('0x58')])){return this[_0x2832('0x36')][_0x2832('0x9f')](_0x2832('0xbc'));}this[_0x2832('0x36')][_0x2832('0x9f')](util[_0x2832('0x28')](_0x2832('0x1ba'),_0x2d0ab5['text']));var _0xbd6fd4=this[_0x2832('0x5e')][_0x2832('0x6a')](this,_0x2d0ab5);if(_0xbd6fd4){this[_0x2832('0x36')]['noop'](util[_0x2832('0x28')](_0x2832('0x1bb'),_0xbd6fd4));var _0x1a9124=this[_0x2832('0x36')]['streamFile'](_0xbd6fd4);try{fs[_0x2832('0xfc')](_0xbd6fd4+_0x2832('0xfd'));}catch(_0x528dc6){logger[_0x2832('0x2b')](_0x528dc6);}return _0x1a9124;}return this[_0x2832('0x36')][_0x2832('0x2b')](_0x2d0ab5,_0x2832('0x1bc'));};AGIVertices['prototype'][_0x2832('0x1bd')]=function(_0x5e33d4){logger[_0x2832('0x2d')](util[_0x2832('0x28')](_0x2832('0x1be'),_0x5e33d4[_0x2832('0x37')]));if(!this['isConfigured'](_0x5e33d4[_0x2832('0x153')])){return this['channel'][_0x2832('0x2b')](_0x5e33d4,'no\x20find\x20by\x20configured');}logger[_0x2832('0x2d')](util['format'](_0x2832('0x152'),this[_0x2832('0x36')][_0x2832('0x39')],_0x5e33d4['findBy']));var _0x3047c4=this[_0x2832('0x4e')]['sync'](this,_0x5e33d4[_0x2832('0x153')]);if(_0x3047c4){logger['info'](util[_0x2832('0x28')](_0x2832('0x154'),this['channel'][_0x2832('0x39')],_0x5e33d4[_0x2832('0x153')]));this[_0x2832('0x36')]['noop'](util[_0x2832('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x2832('0x36')][_0x2832('0x39')],_0x5e33d4[_0x2832('0x153')]));return{'code':0xc8,'result':_0x2832('0x157')};}else{logger[_0x2832('0x2d')](util[_0x2832('0x28')](_0x2832('0x155'),this['channel']['callerid'],_0x5e33d4[_0x2832('0x153')]));this[_0x2832('0x36')][_0x2832('0x9f')](util[_0x2832('0x28')](_0x2832('0x155'),this[_0x2832('0x36')][_0x2832('0x39')],_0x5e33d4[_0x2832('0x153')]));return{'code':0xc8,'result':_0x2832('0x156')};}};AGIVertices[_0x2832('0x15')][_0x2832('0x1bf')]=function(_0x193776){logger[_0x2832('0x2d')](util[_0x2832('0x28')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x193776[_0x2832('0x37')]));var _0x4e0446=this['channel']['exec'](_0x2832('0x1c0'),[_0x193776[_0x2832('0x1c1')],_0x193776[_0x2832('0x72')]]);if(_0x4e0446['result']===-0x1){return _0x4e0446;}return this['channel'][_0x2832('0x9f')](util['format'](_0x2832('0xbb'),'VOICEMAIL',_0x193776[_0x2832('0x1c1')]));};AGIVertices['prototype'][_0x2832('0x1c2')]=function(_0x88616c){logger['info'](util['format']('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x88616c[_0x2832('0x37')]));if(!this['isConfigured'](_0x88616c[_0x2832('0xcc')])){return this[_0x2832('0x36')][_0x2832('0x2b')](_0x88616c,'no\x20variable\x20selected');}var _0x5876b6=this[_0x2832('0x99')][_0x2832('0x6a')](this,_0x88616c['variable_id']);if(!_0x5876b6){return this['channel'][_0x2832('0x2b')](_0x88616c,_0x2832('0x161'));}var _0x5145a5=this['channel']['getVariable'](_0x5876b6);return{'code':0xc8,'result':_0x5145a5['extra']?_0x5145a5['extra']:'-'};};String[_0x2832('0x15')][_0x2832('0x98')]=function(_0x430115,_0x25c130){return this[_0x2832('0x97')](_0x430115)[_0x2832('0x1c3')](_0x25c130);};module[_0x2832('0x1c4')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 96a3be5..750e4de 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 _0xc07c=['transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','catch','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','message','acw','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','[%s][HANGUP:UNIQUEID]','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid'];(function(_0x3f0b15,_0xb88473){var _0x38f95f=function(_0x3ee319){while(--_0x3ee319){_0x3f0b15['push'](_0x3f0b15['shift']());}};_0x38f95f(++_0xb88473);}(_0xc07c,0x1ca));var _0xcc07=function(_0x30a133,_0x567187){_0x30a133=_0x30a133-0x0;var _0x2b3d79=_0xc07c[_0x30a133];return _0x2b3d79;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xcc07('0x0'));var ami=require(_0xcc07('0x1'));var logger=require(_0xcc07('0x2'))('acw');var RpcUser=require(_0xcc07('0x3'));var RpcVoiceAgentReport=require(_0xcc07('0x4'));function Acw(_0x45eb9d){this[_0xcc07('0x5')]=_0x45eb9d[_0xcc07('0x5')];this[_0xcc07('0x6')]=_0x45eb9d[_0xcc07('0x6')];this[_0xcc07('0x7')]=_0x45eb9d[_0xcc07('0x7')];this[_0xcc07('0x8')]={};ami['on']('agentconnect',this['syncAgentConnect'][_0xcc07('0x9')](this));ami['on'](_0xcc07('0xa'),this[_0xcc07('0xb')]['bind'](this));ami['on'](_0xcc07('0xc'),this[_0xcc07('0xd')]['bind'](this));ami['on'](_0xcc07('0xe'),this[_0xcc07('0xf')][_0xcc07('0x9')](this));ami['on']('attendedtransfer',this[_0xcc07('0x10')]['bind'](this));ami['on'](_0xcc07('0x11'),this['syncBlindTransfer'][_0xcc07('0x9')](this));ami['on'](_0xcc07('0x12'),this[_0xcc07('0x13')]['bind'](this));}function getDiff(_0x5d92ff){var _0xb1e66d=moment()[_0xcc07('0x14')](0x0);var _0x7d6bb2=moment(_0x5d92ff)['milliseconds'](0x0);return _0xb1e66d[_0xcc07('0x15')](_0x7d6bb2,_0xcc07('0x16'));}Acw[_0xcc07('0x17')][_0xcc07('0x18')]=function(_0x195055){try{var _0x2b8034=this;var _0x2f215f=this['channels'][_0x195055]['interface'];var _0x29254c=this['channels'][_0x195055][_0xcc07('0x19')];var _0x3dc621=this[_0xcc07('0x5')][_0x29254c];var _0x23e529=![];var _0x34cba1=_0xcc07('0x1a');if(_0x3dc621[_0xcc07('0x1b')]){if(_0x3dc621[_0xcc07('0x1c')]['name']){_0x23e529=!![];_0x34cba1=_0x3dc621[_0xcc07('0x1c')][_0xcc07('0x1d')];}}ami[_0xcc07('0x1e')]({'action':_0xcc07('0x1f'),'interface':_0x2f215f,'paused':!![],'reason':_0x34cba1})[_0xcc07('0x20')](function(_0xe6ef33){if(_0x2b8034['agents'][_0x2f215f]){return RpcUser[_0xcc07('0x21')](_0x2b8034[_0xcc07('0x6')][_0x2f215f]['id'])[_0xcc07('0x20')](function(_0x2d2e3c){if(_0x2d2e3c&&!_0x2d2e3c[_0xcc07('0x22')]){logger['info'](_0xcc07('0x23'),_0x195055,_0x2f215f,_0x29254c);var _0x2291ad=_0x2b8034[_0xcc07('0x8')][_0x195055][_0xcc07('0x24')]&&_0x2b8034[_0xcc07('0x8')][_0x195055][_0xcc07('0x25')]?_0x2b8034[_0xcc07('0x8')][_0x195055][_0xcc07('0x25')]:_0x195055;return RpcUser[_0xcc07('0x26')](_0x2b8034[_0xcc07('0x6')][_0x2f215f],_0x34cba1,_0x2291ad)[_0xcc07('0x20')](function(_0x2b5dff){if(!_0x23e529){_0x2b8034['timers'][_0x2f215f]={};logger[_0xcc07('0x27')](_0xcc07('0x28'),_0x195055,_0x2b8034[_0xcc07('0x5')][_0x29254c][_0xcc07('0x29')],_0x2f215f,_0x29254c);_0x2b8034['timers'][_0x2f215f][_0xcc07('0x2a')]=setTimeout(_0x2b8034[_0xcc07('0x2b')][_0xcc07('0x9')](_0x2b8034,_0x2f215f),_0x2b8034[_0xcc07('0x5')][_0x29254c][_0xcc07('0x29')]*0x3e8);_0x2b8034[_0xcc07('0x7')][_0x2f215f][_0xcc07('0x2c')]=moment()[_0xcc07('0x2d')](_0xcc07('0x2e'));_0x2b8034[_0xcc07('0x7')][_0x2f215f]['uniqueid']=_0x195055;_0x2b8034[_0xcc07('0x7')][_0x2f215f][_0xcc07('0x19')]=_0x29254c;_0x2b8034['timers'][_0x2f215f][_0xcc07('0x2f')]=function(){var _0x2e63ea=getDiff(_0x2b8034['timers'][_0x2f215f][_0xcc07('0x2c')]);clearTimeout(_0x2b8034[_0xcc07('0x7')][_0x2f215f][_0xcc07('0x2a')]);_0x2b8034[_0xcc07('0x7')][_0x2f215f][_0xcc07('0x2a')]=![];RpcVoiceAgentReport[_0xcc07('0x30')]({'acwtime':_0x2e63ea},_0x2b8034[_0xcc07('0x7')][_0x2f215f][_0xcc07('0x31')],_0x2f215f)[_0xcc07('0x20')](function(_0x516959){logger[_0xcc07('0x27')](_0xcc07('0x32'),_0x195055,_0x2e63ea,_0x516959);})['catch'](function(_0x4092a0){logger[_0xcc07('0x33')]('[%s][UPDATE][ERRORS:%s]',_0x195055,_0x4092a0);});delete _0x2b8034[_0xcc07('0x7')][_0x2f215f];};}});}else{logger[_0xcc07('0x27')](_0xcc07('0x34'),_0x195055,_0x2f215f,_0x29254c);}});}})['catch'](function(_0x535167){logger[_0xcc07('0x33')](_0xcc07('0x28'),_0x195055,_0x2b8034[_0xcc07('0x5')][_0x29254c][_0xcc07('0x29')],_0x2f215f,_0x29254c);})[_0xcc07('0x35')](function(){delete _0x2b8034[_0xcc07('0x8')][_0x195055];});}catch(_0x3be37a){logger[_0xcc07('0x33')](_0xcc07('0x36'),_0x3be37a['message']);}};Acw[_0xcc07('0x17')][_0xcc07('0x2b')]=function(_0x1c7e9c){try{var _0x39e22f=this;if(_0x39e22f[_0xcc07('0x7')][_0x1c7e9c]){_0x39e22f[_0xcc07('0x7')][_0x1c7e9c][_0xcc07('0x2a')]=![];var _0x2f681d=_0x39e22f[_0xcc07('0x7')][_0x1c7e9c]['uniqueid'];var _0x51e8ad=_0x39e22f[_0xcc07('0x7')][_0x1c7e9c][_0xcc07('0x19')];var _0x1bdd70=_0x39e22f[_0xcc07('0x5')][_0x51e8ad]['acwTimeout'];logger['info'](_0xcc07('0x37'),_0x2f681d,_0x1c7e9c);RpcUser[_0xcc07('0x38')](this[_0xcc07('0x6')][_0x1c7e9c]);RpcVoiceAgentReport[_0xcc07('0x30')]({'acwtime':_0x1bdd70,'agentacw':!![]},_0x2f681d,_0x1c7e9c)[_0xcc07('0x20')](function(_0x54b2a4){logger[_0xcc07('0x27')](_0xcc07('0x32'),_0x2f681d,_0x1bdd70,_0x54b2a4);})[_0xcc07('0x39')](function(_0x2a94ba){logger[_0xcc07('0x33')](_0xcc07('0x3a'),_0x2f681d,_0x2a94ba);});}else{logger[_0xcc07('0x33')](_0xcc07('0x3b'),_0x1c7e9c);if(_0x39e22f[_0xcc07('0x7')]){logger[_0xcc07('0x27')](_0xcc07('0x3c'),JSON[_0xcc07('0x3d')](_0x39e22f['timers']));}}}catch(_0x5b28b9){logger[_0xcc07('0x33')]('[ACW][STOP]\x20%s',_0x5b28b9[_0xcc07('0x3e')]);}};Acw[_0xcc07('0x17')]['syncAgentConnect']=function(_0x3d2dbb){try{if(this[_0xcc07('0x5')][_0x3d2dbb['queue']]&&(this['voiceQueues'][_0x3d2dbb[_0xcc07('0x19')]][_0xcc07('0x3f')]||this[_0xcc07('0x5')][_0x3d2dbb[_0xcc07('0x19')]][_0xcc07('0x1b')])){if(this['agents'][_0x3d2dbb[_0xcc07('0x40')]]){this[_0xcc07('0x8')][_0x3d2dbb[_0xcc07('0x31')]]={'queue':_0x3d2dbb[_0xcc07('0x19')],'interface':_0x3d2dbb[_0xcc07('0x40')],'destlinkedid':_0x3d2dbb[_0xcc07('0x25')]};}}}catch(_0x32e73){logger[_0xcc07('0x33')](_0xcc07('0x41'),_0x32e73[_0xcc07('0x3e')]);}};Acw[_0xcc07('0x17')]['syncAgentConnectPreview']=function(_0x398faf){try{if(this[_0xcc07('0x5')][_0x398faf['queue']]&&(this[_0xcc07('0x5')][_0x398faf[_0xcc07('0x19')]][_0xcc07('0x3f')]||this[_0xcc07('0x5')][_0x398faf[_0xcc07('0x19')]]['mandatoryDisposition'])){if(this[_0xcc07('0x6')][_0x398faf[_0xcc07('0x40')]]){this['channels'][_0x398faf['uniqueid']]={'queue':_0x398faf[_0xcc07('0x19')],'interface':_0x398faf[_0xcc07('0x40')]};}}}catch(_0x52851e){logger[_0xcc07('0x33')](_0xcc07('0x42'),_0x52851e[_0xcc07('0x3e')]);}};Acw['prototype'][_0xcc07('0xb')]=function(_0x30ae07){try{if(this[_0xcc07('0x8')][_0x30ae07['uniqueid']]&&_['isUndefined'](this[_0xcc07('0x8')][_0x30ae07[_0xcc07('0x31')]][_0xcc07('0x24')])){logger[_0xcc07('0x27')](_0xcc07('0x43'),_0x30ae07[_0xcc07('0x31')]);this['startAcw'](_0x30ae07[_0xcc07('0x31')]);}else if(this[_0xcc07('0x8')][_0x30ae07['linkedid']]&&_[_0xcc07('0x44')](this[_0xcc07('0x8')][_0x30ae07[_0xcc07('0x45')]][_0xcc07('0x24')])){logger[_0xcc07('0x27')](_0xcc07('0x46'),_0x30ae07[_0xcc07('0x45')]);this['startAcw'](_0x30ae07[_0xcc07('0x45')]);}}catch(_0x53dbff){logger[_0xcc07('0x33')](_0xcc07('0x47'),_0x53dbff[_0xcc07('0x3e')]);}};Acw[_0xcc07('0x17')][_0xcc07('0xd')]=function(_0x13ffa6){try{if(this[_0xcc07('0x8')][_0x13ffa6[_0xcc07('0x31')]]&&this['channels'][_0x13ffa6[_0xcc07('0x31')]][_0xcc07('0x24')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x13ffa6['uniqueid']);this[_0xcc07('0x18')](_0x13ffa6[_0xcc07('0x31')]);}else if(this[_0xcc07('0x8')][_0x13ffa6[_0xcc07('0x45')]]&&this[_0xcc07('0x8')][_0x13ffa6[_0xcc07('0x45')]][_0xcc07('0x24')]){logger[_0xcc07('0x27')](_0xcc07('0x48'),_0x13ffa6[_0xcc07('0x45')]);this[_0xcc07('0x18')](_0x13ffa6[_0xcc07('0x45')]);}}catch(_0x5736db){logger[_0xcc07('0x33')](_0xcc07('0x49'),_0x5736db[_0xcc07('0x3e')]);}};Acw[_0xcc07('0x17')][_0xcc07('0x10')]=function(_0xd6e80e){try{if(!_['isNil'](this[_0xcc07('0x8')][_0xd6e80e[_0xcc07('0x4a')]])){this[_0xcc07('0x18')](_0xd6e80e['transfereeuniqueid']);if(this['channels'][_0xd6e80e[_0xcc07('0x4b')]]){this[_0xcc07('0x8')][_0xd6e80e[_0xcc07('0x4b')]][_0xcc07('0x24')]=!![];this[_0xcc07('0x8')][_0xd6e80e[_0xcc07('0x4c')]]=this[_0xcc07('0x8')][_0xd6e80e[_0xcc07('0x4b')]];delete this[_0xcc07('0x8')][_0xd6e80e['secondtransfereruniqueid']];}}else if(!_['isNil'](this[_0xcc07('0x8')][_0xd6e80e[_0xcc07('0x4c')]])){this[_0xcc07('0x18')](_0xd6e80e['transfertargetuniqueid']);if(this['channels'][_0xd6e80e[_0xcc07('0x4d')]]){this[_0xcc07('0x8')][_0xd6e80e[_0xcc07('0x4d')]][_0xcc07('0x24')]=!![];this[_0xcc07('0x8')][_0xd6e80e[_0xcc07('0x4a')]]=this[_0xcc07('0x8')][_0xd6e80e[_0xcc07('0x4d')]];delete this[_0xcc07('0x8')][_0xd6e80e[_0xcc07('0x4d')]];}}}catch(_0x2c6abb){logger[_0xcc07('0x33')](_0xcc07('0x4e'),_0x2c6abb[_0xcc07('0x3e')]);}};Acw['prototype'][_0xcc07('0x4f')]=function(_0x5cf9e7){try{if(this[_0xcc07('0x8')][_0x5cf9e7[_0xcc07('0x50')]]){logger[_0xcc07('0x27')](_0xcc07('0x51'),JSON[_0xcc07('0x3d')](_0x5cf9e7[_0xcc07('0x50')]));this[_0xcc07('0x18')](_0x5cf9e7[_0xcc07('0x50')]);}else if(this['channels'][_0x5cf9e7[_0xcc07('0x52')]]){logger[_0xcc07('0x27')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xcc07('0x3d')](_0x5cf9e7[_0xcc07('0x52')]));this['startAcw'](_0x5cf9e7[_0xcc07('0x52')]);}}catch(_0x1f64f1){logger[_0xcc07('0x33')]('[ACW][syncBlindTransfer]\x20%s',_0x1f64f1[_0xcc07('0x3e')]);}};Acw['prototype'][_0xcc07('0xf')]=function(_0x2fee14){try{if(this[_0xcc07('0x5')][_0x2fee14['queue']]&&this[_0xcc07('0x5')][_0x2fee14[_0xcc07('0x19')]][_0xcc07('0x53')]===_0xcc07('0x54')){if(this['agents'][_0x2fee14[_0xcc07('0x40')]]){logger[_0xcc07('0x27')](_0xcc07('0x55'),_0x2fee14[_0xcc07('0x31')],_0x2fee14[_0xcc07('0x40')],_0x2fee14[_0xcc07('0x19')]);return RpcUser[_0xcc07('0x26')](this[_0xcc07('0x6')][_0x2fee14['interface']],_0xcc07('0x56'),_0x2fee14[_0xcc07('0x31')]);}}}catch(_0x3f2c69){logger[_0xcc07('0x33')](_0xcc07('0x57'),_0x3f2c69[_0xcc07('0x3e')]);}};module[_0xcc07('0x58')]=Acw; \ No newline at end of file +var _0xb91b=['syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncAgentConnectPreview','milliseconds','diff','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer','stopAcw','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','message','prototype','saveUnpause','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][syncAgentConnect]\x20%s','syncHangupRequest','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','syncBlindTransfer','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','hangup'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb91b,0x92));var _0xbb91=function(_0x5d66fc,_0x4da5af){_0x5d66fc=_0x5d66fc-0x0;var _0x4a4748=_0xb91b[_0x5d66fc];return _0x4a4748;};'use strict';var util=require(_0xbb91('0x0'));var _=require(_0xbb91('0x1'));var moment=require(_0xbb91('0x2'));var ami=require('../ami');var logger=require(_0xbb91('0x3'))(_0xbb91('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xbb91('0x5'));function Acw(_0x5567c8){this[_0xbb91('0x6')]=_0x5567c8[_0xbb91('0x6')];this['agents']=_0x5567c8[_0xbb91('0x7')];this['timers']=_0x5567c8[_0xbb91('0x8')];this[_0xbb91('0x9')]={};ami['on']('agentconnect',this[_0xbb91('0xa')][_0xbb91('0xb')](this));ami['on'](_0xbb91('0xc'),this['syncHangupRequest'][_0xbb91('0xb')](this));ami['on'](_0xbb91('0xd'),this[_0xbb91('0xe')][_0xbb91('0xb')](this));ami['on'](_0xbb91('0xf'),this[_0xbb91('0x10')]['bind'](this));ami['on']('attendedtransfer',this[_0xbb91('0x11')][_0xbb91('0xb')](this));ami['on'](_0xbb91('0x12'),this['syncBlindTransfer'][_0xbb91('0xb')](this));ami['on']('custom:agentConnectPreview',this[_0xbb91('0x13')]['bind'](this));}function getDiff(_0x38c775){var _0x47bd60=moment()[_0xbb91('0x14')](0x0);var _0x5b5575=moment(_0x38c775)[_0xbb91('0x14')](0x0);return _0x47bd60[_0xbb91('0x15')](_0x5b5575,'seconds');}Acw['prototype'][_0xbb91('0x16')]=function(_0x3c5620){try{var _0x23b8cc=this;var _0x41f7f6=this[_0xbb91('0x9')][_0x3c5620][_0xbb91('0x17')];var _0x5cc556=this[_0xbb91('0x9')][_0x3c5620][_0xbb91('0x18')];var _0x2d4b4a=this[_0xbb91('0x6')][_0x5cc556];var _0x220a54=![];var _0x530a1d=_0xbb91('0x19');if(_0x2d4b4a[_0xbb91('0x1a')]){if(_0x2d4b4a['mandatoryDispositionPause']['name']){_0x220a54=!![];_0x530a1d=_0x2d4b4a[_0xbb91('0x1b')][_0xbb91('0x1c')];}}ami[_0xbb91('0x1d')]({'action':_0xbb91('0x1e'),'interface':_0x41f7f6,'paused':!![],'reason':_0x530a1d})[_0xbb91('0x1f')](function(_0xf152f1){if(_0x23b8cc[_0xbb91('0x7')][_0x41f7f6]){return RpcUser[_0xbb91('0x20')](_0x23b8cc[_0xbb91('0x7')][_0x41f7f6]['id'])[_0xbb91('0x1f')](function(_0x53a1e2){if(_0x53a1e2&&!_0x53a1e2[_0xbb91('0x21')]){logger[_0xbb91('0x22')](_0xbb91('0x23'),_0x3c5620,_0x41f7f6,_0x5cc556);var _0x40c10f=_0x23b8cc[_0xbb91('0x9')][_0x3c5620][_0xbb91('0x24')]&&_0x23b8cc['channels'][_0x3c5620][_0xbb91('0x25')]?_0x23b8cc['channels'][_0x3c5620][_0xbb91('0x25')]:_0x3c5620;return RpcUser[_0xbb91('0x26')](_0x23b8cc[_0xbb91('0x7')][_0x41f7f6],_0x530a1d,_0x40c10f)[_0xbb91('0x1f')](function(_0x366f8f){if(!_0x220a54){_0x23b8cc[_0xbb91('0x8')][_0x41f7f6]={};logger[_0xbb91('0x22')](_0xbb91('0x27'),_0x3c5620,_0x23b8cc['voiceQueues'][_0x5cc556]['acwTimeout'],_0x41f7f6,_0x5cc556);_0x23b8cc[_0xbb91('0x8')][_0x41f7f6][_0xbb91('0x28')]=setTimeout(_0x23b8cc[_0xbb91('0x29')][_0xbb91('0xb')](_0x23b8cc,_0x41f7f6),_0x23b8cc['voiceQueues'][_0x5cc556][_0xbb91('0x2a')]*0x3e8);_0x23b8cc[_0xbb91('0x8')][_0x41f7f6][_0xbb91('0x2b')]=moment()[_0xbb91('0x2c')](_0xbb91('0x2d'));_0x23b8cc[_0xbb91('0x8')][_0x41f7f6][_0xbb91('0x2e')]=_0x3c5620;_0x23b8cc[_0xbb91('0x8')][_0x41f7f6][_0xbb91('0x18')]=_0x5cc556;_0x23b8cc['timers'][_0x41f7f6][_0xbb91('0x2f')]=function(){var _0x87c94e=getDiff(_0x23b8cc[_0xbb91('0x8')][_0x41f7f6]['lastPauseAt']);clearTimeout(_0x23b8cc[_0xbb91('0x8')][_0x41f7f6][_0xbb91('0x28')]);_0x23b8cc[_0xbb91('0x8')][_0x41f7f6][_0xbb91('0x28')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x87c94e},_0x23b8cc[_0xbb91('0x8')][_0x41f7f6][_0xbb91('0x2e')],_0x41f7f6)[_0xbb91('0x1f')](function(_0x2d14e7){logger[_0xbb91('0x22')](_0xbb91('0x30'),_0x3c5620,_0x87c94e,_0x2d14e7);})[_0xbb91('0x31')](function(_0x17e246){logger[_0xbb91('0x32')](_0xbb91('0x33'),_0x3c5620,_0x17e246);});delete _0x23b8cc['timers'][_0x41f7f6];};}});}else{logger[_0xbb91('0x22')](_0xbb91('0x34'),_0x3c5620,_0x41f7f6,_0x5cc556);}});}})[_0xbb91('0x31')](function(_0x847b4a){logger[_0xbb91('0x32')](_0xbb91('0x27'),_0x3c5620,_0x23b8cc['voiceQueues'][_0x5cc556][_0xbb91('0x2a')],_0x41f7f6,_0x5cc556);})[_0xbb91('0x35')](function(){delete _0x23b8cc[_0xbb91('0x9')][_0x3c5620];});}catch(_0x80f25b){logger[_0xbb91('0x32')]('[ACW][START]\x20%s',_0x80f25b[_0xbb91('0x36')]);}};Acw[_0xbb91('0x37')][_0xbb91('0x29')]=function(_0x436f97){try{var _0x3a837e=this;if(_0x3a837e[_0xbb91('0x8')][_0x436f97]){_0x3a837e['timers'][_0x436f97][_0xbb91('0x28')]=![];var _0x21094b=_0x3a837e['timers'][_0x436f97][_0xbb91('0x2e')];var _0x25734e=_0x3a837e[_0xbb91('0x8')][_0x436f97][_0xbb91('0x18')];var _0x4d3761=_0x3a837e['voiceQueues'][_0x25734e]['acwTimeout'];logger[_0xbb91('0x22')]('[%s][TIMER][STOP][AGENT:%s]',_0x21094b,_0x436f97);RpcUser[_0xbb91('0x38')](this[_0xbb91('0x7')][_0x436f97]);RpcVoiceAgentReport[_0xbb91('0x39')]({'acwtime':_0x4d3761,'agentacw':!![]},_0x21094b,_0x436f97)[_0xbb91('0x1f')](function(_0x562173){logger[_0xbb91('0x22')](_0xbb91('0x30'),_0x21094b,_0x4d3761,_0x562173);})['catch'](function(_0x1481ca){logger['error'](_0xbb91('0x33'),_0x21094b,_0x1481ca);});}else{logger[_0xbb91('0x32')](_0xbb91('0x3a'),_0x436f97);if(_0x3a837e['timers']){logger[_0xbb91('0x22')]('[ACW][TIMERS]',JSON[_0xbb91('0x3b')](_0x3a837e[_0xbb91('0x8')]));}}}catch(_0x2bc6f9){logger['error']('[ACW][STOP]\x20%s',_0x2bc6f9[_0xbb91('0x36')]);}};Acw[_0xbb91('0x37')]['syncAgentConnect']=function(_0x1349bd){try{if(this['voiceQueues'][_0x1349bd['queue']]&&(this[_0xbb91('0x6')][_0x1349bd[_0xbb91('0x18')]]['acw']||this[_0xbb91('0x6')][_0x1349bd[_0xbb91('0x18')]]['mandatoryDisposition'])){if(this[_0xbb91('0x7')][_0x1349bd[_0xbb91('0x17')]]){this[_0xbb91('0x9')][_0x1349bd[_0xbb91('0x2e')]]={'queue':_0x1349bd['queue'],'interface':_0x1349bd[_0xbb91('0x17')],'destlinkedid':_0x1349bd[_0xbb91('0x25')]};}}}catch(_0x2d2b0b){logger['error'](_0xbb91('0x3c'),_0x2d2b0b[_0xbb91('0x36')]);}};Acw[_0xbb91('0x37')][_0xbb91('0x13')]=function(_0x5dfdea){try{if(this['voiceQueues'][_0x5dfdea['queue']]&&(this['voiceQueues'][_0x5dfdea['queue']]['acw']||this[_0xbb91('0x6')][_0x5dfdea[_0xbb91('0x18')]][_0xbb91('0x1a')])){if(this[_0xbb91('0x7')][_0x5dfdea['interface']]){this[_0xbb91('0x9')][_0x5dfdea[_0xbb91('0x2e')]]={'queue':_0x5dfdea[_0xbb91('0x18')],'interface':_0x5dfdea['interface']};}}}catch(_0x19ddc4){logger[_0xbb91('0x32')]('[ACW][syncAgentConnectPreview]\x20%s',_0x19ddc4[_0xbb91('0x36')]);}};Acw[_0xbb91('0x37')][_0xbb91('0x3d')]=function(_0x594897){try{if(this['channels'][_0x594897[_0xbb91('0x2e')]]&&_['isUndefined'](this[_0xbb91('0x9')][_0x594897[_0xbb91('0x2e')]][_0xbb91('0x24')])){logger[_0xbb91('0x22')](_0xbb91('0x3e'),_0x594897[_0xbb91('0x2e')]);this[_0xbb91('0x16')](_0x594897[_0xbb91('0x2e')]);}else if(this[_0xbb91('0x9')][_0x594897[_0xbb91('0x3f')]]&&_['isUndefined'](this[_0xbb91('0x9')][_0x594897[_0xbb91('0x3f')]][_0xbb91('0x24')])){logger[_0xbb91('0x22')](_0xbb91('0x40'),_0x594897[_0xbb91('0x3f')]);this[_0xbb91('0x16')](_0x594897[_0xbb91('0x3f')]);}}catch(_0x34ce93){logger[_0xbb91('0x32')]('[ACW][syncHangupRequest]\x20%s',_0x34ce93[_0xbb91('0x36')]);}};Acw[_0xbb91('0x37')][_0xbb91('0xe')]=function(_0x415911){try{if(this[_0xbb91('0x9')][_0x415911[_0xbb91('0x2e')]]&&this[_0xbb91('0x9')][_0x415911[_0xbb91('0x2e')]][_0xbb91('0x24')]){logger[_0xbb91('0x22')](_0xbb91('0x41'),_0x415911['uniqueid']);this[_0xbb91('0x16')](_0x415911['uniqueid']);}else if(this[_0xbb91('0x9')][_0x415911[_0xbb91('0x3f')]]&&this['channels'][_0x415911[_0xbb91('0x3f')]][_0xbb91('0x24')]){logger[_0xbb91('0x22')](_0xbb91('0x42'),_0x415911[_0xbb91('0x3f')]);this['startAcw'](_0x415911['linkedid']);}}catch(_0x1d949c){logger[_0xbb91('0x32')](_0xbb91('0x43'),_0x1d949c[_0xbb91('0x36')]);}};Acw[_0xbb91('0x37')]['syncAttendedTransfer']=function(_0x21651f){try{if(!_[_0xbb91('0x44')](this[_0xbb91('0x9')][_0x21651f[_0xbb91('0x45')]])){this[_0xbb91('0x16')](_0x21651f[_0xbb91('0x45')]);if(this[_0xbb91('0x9')][_0x21651f[_0xbb91('0x46')]]){this[_0xbb91('0x9')][_0x21651f[_0xbb91('0x46')]][_0xbb91('0x24')]=!![];this['channels'][_0x21651f[_0xbb91('0x47')]]=this[_0xbb91('0x9')][_0x21651f[_0xbb91('0x46')]];delete this['channels'][_0x21651f[_0xbb91('0x46')]];}}else if(!_[_0xbb91('0x44')](this[_0xbb91('0x9')][_0x21651f[_0xbb91('0x47')]])){this[_0xbb91('0x16')](_0x21651f['transfertargetuniqueid']);if(this['channels'][_0x21651f['origtransfereruniqueid']]){this[_0xbb91('0x9')][_0x21651f['origtransfereruniqueid']][_0xbb91('0x24')]=!![];this['channels'][_0x21651f[_0xbb91('0x45')]]=this[_0xbb91('0x9')][_0x21651f[_0xbb91('0x48')]];delete this[_0xbb91('0x9')][_0x21651f[_0xbb91('0x48')]];}}}catch(_0x197340){logger[_0xbb91('0x32')]('[ACW][syncAttendedTransfer]\x20%s',_0x197340[_0xbb91('0x36')]);}};Acw[_0xbb91('0x37')][_0xbb91('0x49')]=function(_0x25e242){try{if(this[_0xbb91('0x9')][_0x25e242[_0xbb91('0x4a')]]){logger[_0xbb91('0x22')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xbb91('0x3b')](_0x25e242['transfereruniqueid']));this[_0xbb91('0x16')](_0x25e242[_0xbb91('0x4a')]);}else if(this[_0xbb91('0x9')][_0x25e242[_0xbb91('0x4b')]]){logger['info'](_0xbb91('0x4c'),JSON[_0xbb91('0x3b')](_0x25e242[_0xbb91('0x4b')]));this[_0xbb91('0x16')](_0x25e242[_0xbb91('0x4b')]);}}catch(_0x4b63b9){logger['error']('[ACW][syncBlindTransfer]\x20%s',_0x4b63b9[_0xbb91('0x36')]);}};Acw['prototype'][_0xbb91('0x10')]=function(_0x3ef1b2){try{if(this['voiceQueues'][_0x3ef1b2[_0xbb91('0x18')]]&&this['voiceQueues'][_0x3ef1b2[_0xbb91('0x18')]]['autopause']==='all'){if(this[_0xbb91('0x7')][_0x3ef1b2[_0xbb91('0x17')]]){logger[_0xbb91('0x22')](_0xbb91('0x4d'),_0x3ef1b2[_0xbb91('0x2e')],_0x3ef1b2[_0xbb91('0x17')],_0x3ef1b2[_0xbb91('0x18')]);return RpcUser[_0xbb91('0x26')](this['agents'][_0x3ef1b2[_0xbb91('0x17')]],'Auto-Pause',_0x3ef1b2[_0xbb91('0x2e')]);}}}catch(_0x20364f){logger[_0xbb91('0x32')](_0xbb91('0x4e'),_0x20364f[_0xbb91('0x36')]);}};module[_0xbb91('0x4f')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 51defeb..a427c97 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 _0xb10b=['asterisk','port','password','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','username','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionCoreShowChannels','[ami.js][fullybooted]','asterisk-manager','moment','util','lodash','ami','../../config/environment'];(function(_0x3b4411,_0x5b1b3f){var _0x271e00=function(_0x3c0ee5){while(--_0x3c0ee5){_0x3b4411['push'](_0x3b4411['shift']());}};_0x271e00(++_0x5b1b3f);}(_0xb10b,0x12a));var _0xbb10=function(_0x3585fb,_0x5df075){_0x3585fb=_0x3585fb-0x0;var _0x48fb79=_0xb10b[_0x3585fb];return _0x48fb79;};'use strict';var Manager=require(_0xbb10('0x0'));var BPromise=require('bluebird');var moment=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var _=require(_0xbb10('0x3'));var logger=require('../../config/logger')(_0xbb10('0x4'));var config=require(_0xbb10('0x5'));var ami=new Manager(config[_0xbb10('0x6')][_0xbb10('0x7')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')]['username'],config[_0xbb10('0x6')][_0xbb10('0x8')],!![]);ami['keepConnected']();ami[_0xbb10('0x9')]=BPromise[_0xbb10('0xa')](ami[_0xbb10('0xb')]);function error(_0x1c3ee5){logger[_0xbb10('0xc')](util[_0xbb10('0xd')](_0xbb10('0xe'),config[_0xbb10('0x6')]['username'],config['asterisk']['ip'],config[_0xbb10('0x6')][_0xbb10('0x7')],util[_0xbb10('0xf')](_0x1c3ee5,![],null)));}function close(){logger['error'](util[_0xbb10('0xd')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xbb10('0x6')][_0xbb10('0x10')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')][_0xbb10('0x7')]));}ami[_0xbb10('0x11')]=function(){return function(){return ami['Action']({'action':_0xbb10('0x12')});};};ami[_0xbb10('0x13')]=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x14')});};};ami[_0xbb10('0x15')]=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x16')});};};ami[_0xbb10('0x17')]=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x18')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x19')});};};function connect(_0x133ac2){logger[_0xbb10('0x1a')](util[_0xbb10('0xd')](_0xbb10('0x1b'),config[_0xbb10('0x6')][_0xbb10('0x10')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')]['port']));ami[_0xbb10('0x1c')](_0xbb10('0xc'),error);ami[_0xbb10('0x1c')](_0xbb10('0x1d'),close);}ami['on'](_0xbb10('0x1e'),connect);ami['on'](_0xbb10('0x1f'),function(_0x4deb49){logger[_0xbb10('0x1a')](util[_0xbb10('0xd')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0xbb10('0x10')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')][_0xbb10('0x7')],util[_0xbb10('0xf')](_0x4deb49,![],null)));});ami['on'](_0xbb10('0x20'),function(_0x407cb4){logger[_0xbb10('0x1a')](util[_0xbb10('0xd')](_0xbb10('0x21'),config[_0xbb10('0x6')][_0xbb10('0x10')],config['asterisk']['ip'],config['asterisk']['port']));return BPromise[_0xbb10('0x22')]()[_0xbb10('0x23')](ami[_0xbb10('0x11')]())['then'](ami[_0xbb10('0x13')]())[_0xbb10('0x23')](ami[_0xbb10('0x15')]())[_0xbb10('0x23')](ami[_0xbb10('0x17')]())[_0xbb10('0x23')](ami[_0xbb10('0x24')]())['catch'](function(_0x3796c7){logger[_0xbb10('0xc')](_0xbb10('0x25'),util[_0xbb10('0xf')](_0x3796c7,{'showHidden':![],'depth':null}));});});ami[_0xbb10('0x1c')](_0xbb10('0xc'),error);ami['once'](_0xbb10('0x1d'),close);module['exports']=ami; \ No newline at end of file +var _0xb7e7=['username','Action','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','[ami.js][fullybooted]','exports','asterisk-manager','moment','lodash','ami','asterisk','port','password','keepConnected','promisify','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'];(function(_0x46199b,_0x1158b8){var _0x14ce2a=function(_0x4a5571){while(--_0x4a5571){_0x46199b['push'](_0x46199b['shift']());}};_0x14ce2a(++_0x1158b8);}(_0xb7e7,0x121));var _0x7b7e=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0xb7e7[_0x424a9a];return _0xa7831c;};'use strict';var Manager=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var moment=require(_0x7b7e('0x1'));var util=require('util');var _=require(_0x7b7e('0x2'));var logger=require('../../config/logger')(_0x7b7e('0x3'));var config=require('../../config/environment');var ami=new Manager(config[_0x7b7e('0x4')][_0x7b7e('0x5')],config[_0x7b7e('0x4')]['ip'],config['asterisk']['username'],config[_0x7b7e('0x4')][_0x7b7e('0x6')],!![]);ami[_0x7b7e('0x7')]();ami['Action']=BPromise[_0x7b7e('0x8')](ami[_0x7b7e('0x9')]);function error(_0x2917f9){logger[_0x7b7e('0xa')](util[_0x7b7e('0xb')](_0x7b7e('0xc'),config[_0x7b7e('0x4')]['username'],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')],util[_0x7b7e('0xd')](_0x2917f9,![],null)));}function close(){logger[_0x7b7e('0xa')](util[_0x7b7e('0xb')](_0x7b7e('0xe'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config['asterisk']['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x7b7e('0x10')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x11')});};};ami[_0x7b7e('0x12')]=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x13')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x7b7e('0x14')});};};ami[_0x7b7e('0x15')]=function(){return function(){return ami[_0x7b7e('0x10')]({'action':_0x7b7e('0x16')});};};function connect(_0x2cc400){logger[_0x7b7e('0x17')](util[_0x7b7e('0xb')](_0x7b7e('0x18'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')]));ami[_0x7b7e('0x19')](_0x7b7e('0xa'),error);ami[_0x7b7e('0x19')](_0x7b7e('0x1a'),close);}ami['on']('connect',connect);ami['on'](_0x7b7e('0x1b'),function(_0x43db4f){logger[_0x7b7e('0x17')](util['format'](_0x7b7e('0x1c'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config[_0x7b7e('0x4')]['ip'],config[_0x7b7e('0x4')][_0x7b7e('0x5')],util[_0x7b7e('0xd')](_0x43db4f,![],null)));});ami['on'](_0x7b7e('0x1d'),function(_0x53bbb3){logger['info'](util['format'](_0x7b7e('0x1e'),config[_0x7b7e('0x4')][_0x7b7e('0xf')],config['asterisk']['ip'],config['asterisk']['port']));return BPromise[_0x7b7e('0x1f')]()[_0x7b7e('0x20')](ami[_0x7b7e('0x21')]())[_0x7b7e('0x20')](ami[_0x7b7e('0x22')]())['then'](ami[_0x7b7e('0x12')]())[_0x7b7e('0x20')](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())[_0x7b7e('0x23')](function(_0x423832){logger['error'](_0x7b7e('0x24'),util['inspect'](_0x423832,{'showHidden':![],'depth':null}));});});ami[_0x7b7e('0x19')](_0x7b7e('0xa'),error);ami[_0x7b7e('0x19')]('close',close);module[_0x7b7e('0x25')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 7e3e060..cd8048f 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 _0x9bde=['message','result','catch','exports','bluebird','ami','http','Request','request','debug','rpc','memberReport','error'];(function(_0x5948dd,_0x1f6ac8){var _0xb1f8be=function(_0x31a8d2){while(--_0x31a8d2){_0x5948dd['push'](_0x5948dd['shift']());}};_0xb1f8be(++_0x1f6ac8);}(_0x9bde,0xe1));var _0xe9bd=function(_0x263df5,_0x3d8533){_0x263df5=_0x263df5-0x0;var _0xd6fae9=_0x9bde[_0x263df5];return _0xd6fae9;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var client=jayson['client'][_0xe9bd('0x2')]({'port':0x2329});client[_0xe9bd('0x3')]=function(_0x131f6a,_0x1c1b34){return new BPromise(function(_0x10822d,_0x1a4d14){return client[_0xe9bd('0x4')](_0x131f6a,_0x1c1b34)['then'](function(_0x4763e9){logger[_0xe9bd('0x5')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x1c1b34,_0x4763e9);if(_0x4763e9[_0xe9bd('0x8')]){logger[_0xe9bd('0x8')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x4763e9[_0xe9bd('0x8')][_0xe9bd('0x9')],_0x1c1b34);return _0x1a4d14(_0x4763e9['error']['message']);}else{return _0x10822d(_0x4763e9[_0xe9bd('0xa')]);}})[_0xe9bd('0xb')](function(_0x2601ac){logger['error'](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x2601ac,_0x1c1b34);return _0x1a4d14(_0x2601ac);});});};module[_0xe9bd('0xc')]=client; \ No newline at end of file +var _0xac4a=['ami','client','http','then','debug','memberReport','error','message','result','catch','rpc','jayson/promise','bluebird','../../config/logger'];(function(_0x22f9c0,_0x35410c){var _0x1883fe=function(_0x5a5601){while(--_0x5a5601){_0x22f9c0['push'](_0x22f9c0['shift']());}};_0x1883fe(++_0x35410c);}(_0xac4a,0x13f));var _0xaac4=function(_0x573c1c,_0x2f2a15){_0x573c1c=_0x573c1c-0x0;var _0x53a471=_0xac4a[_0x573c1c];return _0x53a471;};'use strict';var jayson=require(_0xaac4('0x0'));var BPromise=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var client=jayson[_0xaac4('0x4')][_0xaac4('0x5')]({'port':0x2329});client['Request']=function(_0x58626e,_0x2af0f6){return new BPromise(function(_0x2a5762,_0x32d34c){return client['request'](_0x58626e,_0x2af0f6)[_0xaac4('0x6')](function(_0x53d03a){logger[_0xaac4('0x7')]('rpc',_0xaac4('0x8'),_0x58626e,_0x2af0f6,_0x53d03a);if(_0x53d03a[_0xaac4('0x9')]){logger['error']('rpc',_0xaac4('0x8'),_0x58626e,_0x53d03a['error'][_0xaac4('0xa')],_0x2af0f6);return _0x32d34c(_0x53d03a['error']['message']);}else{return _0x2a5762(_0x53d03a[_0xaac4('0xb')]);}})[_0xaac4('0xc')](function(_0x38d1d0){logger[_0xaac4('0x9')](_0xaac4('0xd'),'memberReport',_0x58626e,_0x38d1d0,_0x2af0f6);return _0x32d34c(_0x38d1d0);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 228e9dc..0bf9548 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ca3=['ContactFirstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','dialCutDigit','substring','getQueue','exports','lodash','moment','string','isNil','voiceQueue','name','Contact','phone','firstName','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper'];(function(_0x4b0167,_0x154254){var _0x635b82=function(_0x3ecb62){while(--_0x3ecb62){_0x4b0167['push'](_0x4b0167['shift']());}};_0x635b82(++_0x154254);}(_0x1ca3,0x117));var _0x31ca=function(_0x270988,_0x4f80f0){_0x270988=_0x270988-0x0;var _0xa9f73=_0x1ca3[_0x270988];return _0xa9f73;};'use strict';var util=require('util');var _=require(_0x31ca('0x0'));var moment=require(_0x31ca('0x1'));function checkNameSurname(_0x3815c7,_0x4140ee,_0x20bd8b){var _0x258634='';if(!_['isNil'](_0x4140ee)&&_0x31ca('0x2')===typeof _0x4140ee){_0x258634+=_0x4140ee;}if(!_[_0x31ca('0x3')](_0x20bd8b)&&'string'===typeof _0x20bd8b){_0x258634+='\x20'+_0x20bd8b;}if(_0x258634!==''){return _0x258634;}return _0x3815c7;}function Action(_0x736f9c,_0x5e2d71,_0x420470){this[_0x31ca('0x4')]=_0x736f9c;this['uniqueid']=_0x420470||undefined;this[_0x31ca('0x5')]=checkNameSurname(_0x5e2d71[_0x31ca('0x6')][_0x31ca('0x7')],_0x5e2d71['Contact'][_0x31ca('0x8')],_0x5e2d71[_0x31ca('0x6')][_0x31ca('0x9')]);this[_0x31ca('0xa')]=_0x5e2d71[_0x31ca('0x6')]['phone'];this['queue']=_0x736f9c[_0x31ca('0x5')];this[_0x31ca('0xb')]=_0x5e2d71[_0x31ca('0xb')]||![];this[_0x31ca('0xc')]=_0x736f9c[_0x31ca('0xc')];this['dialQueueTimeout']=_0x736f9c[_0x31ca('0xd')]||0x3;this['scheduledat']=_0x5e2d71[_0x31ca('0xe')];this[_0x31ca('0xf')]=_0x5e2d71[_0x31ca('0xf')];this[_0x31ca('0x10')]=_0x5e2d71[_0x31ca('0x10')];this[_0x31ca('0x11')]=_0x5e2d71[_0x31ca('0x11')];this['countnosuchnumberretry']=_0x5e2d71[_0x31ca('0x12')];this[_0x31ca('0x13')]=_0x5e2d71[_0x31ca('0x13')];this[_0x31ca('0x14')]=_0x5e2d71[_0x31ca('0x14')];this[_0x31ca('0x15')]=_0x5e2d71['countmachineretry'];this[_0x31ca('0x16')]=_0x5e2d71['countagentrejectretry'];this[_0x31ca('0x17')]=_0x5e2d71[_0x31ca('0x17')];this[_0x31ca('0x18')]=_0x5e2d71[_0x31ca('0x18')];this[_0x31ca('0x19')]=_0x5e2d71[_0x31ca('0x19')];this[_0x31ca('0x1a')]=_0x5e2d71['VoiceQueueId'];this[_0x31ca('0x1b')]=_0x5e2d71[_0x31ca('0x1b')];this[_0x31ca('0x1c')]=_0x5e2d71['id'];this[_0x31ca('0x1d')]=_0x5e2d71[_0x31ca('0x6')]['firstName']||'';this[_0x31ca('0x1e')]=moment()[_0x31ca('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x31ca('0x20')]=_0x5e2d71[_0x31ca('0x20')];this[_0x31ca('0x21')]=_0x5e2d71[_0x31ca('0x21')];this[_0x31ca('0x22')]=_0x5e2d71['callbackat'];this[_0x31ca('0x23')]=_0x5e2d71['recallme'];this[_0x31ca('0x24')]='';this[_0x31ca('0x25')]='';}Action[_0x31ca('0x26')][_0x31ca('0x27')]=function(){return util[_0x31ca('0x1f')]('\x22%s\x22\x20<%s>',this[_0x31ca('0x5')],this['voiceQueue'][_0x31ca('0x28')]>0x0?this[_0x31ca('0xa')][_0x31ca('0x29')](this[_0x31ca('0x4')][_0x31ca('0x28')]):this['number']);};Action['prototype'][_0x31ca('0x2a')]=function(){return this['queue'];};module[_0x31ca('0x2b')]=Action; \ No newline at end of file +var _0xb657=['countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','substring','getQueue','exports','util','isNil','string','uniqueid','name','Contact','phone','firstName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xb657,0x9e));var _0x7b65=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0xb657[_0xc8a931];return _0x28bd27;};'use strict';var util=require(_0x7b65('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x176676,_0x456f2a,_0xfb940a){var _0x4bd6ce='';if(!_[_0x7b65('0x1')](_0x456f2a)&&_0x7b65('0x2')===typeof _0x456f2a){_0x4bd6ce+=_0x456f2a;}if(!_['isNil'](_0xfb940a)&&_0x7b65('0x2')===typeof _0xfb940a){_0x4bd6ce+='\x20'+_0xfb940a;}if(_0x4bd6ce!==''){return _0x4bd6ce;}return _0x176676;}function Action(_0x76ab6a,_0x242083,_0xc425af){this['voiceQueue']=_0x76ab6a;this[_0x7b65('0x3')]=_0xc425af||undefined;this[_0x7b65('0x4')]=checkNameSurname(_0x242083[_0x7b65('0x5')][_0x7b65('0x6')],_0x242083['Contact'][_0x7b65('0x7')],_0x242083['Contact']['lastName']);this[_0x7b65('0x8')]=_0x242083[_0x7b65('0x5')][_0x7b65('0x6')];this['queue']=_0x76ab6a[_0x7b65('0x4')];this[_0x7b65('0x9')]=_0x242083[_0x7b65('0x9')]||![];this[_0x7b65('0xa')]=_0x76ab6a['type'];this[_0x7b65('0xb')]=_0x76ab6a[_0x7b65('0xb')]||0x3;this[_0x7b65('0xc')]=_0x242083[_0x7b65('0xc')];this['countbusyretry']=_0x242083[_0x7b65('0xd')];this[_0x7b65('0xe')]=_0x242083[_0x7b65('0xe')];this[_0x7b65('0xf')]=_0x242083['countnoanswerretry'];this[_0x7b65('0x10')]=_0x242083[_0x7b65('0x10')];this[_0x7b65('0x11')]=_0x242083[_0x7b65('0x11')];this[_0x7b65('0x12')]=_0x242083[_0x7b65('0x12')];this[_0x7b65('0x13')]=_0x242083[_0x7b65('0x13')];this[_0x7b65('0x14')]=_0x242083['countagentrejectretry'];this[_0x7b65('0x15')]=_0x242083[_0x7b65('0x15')];this['ListId']=_0x242083[_0x7b65('0x16')];this[_0x7b65('0x17')]=_0x242083[_0x7b65('0x17')];this[_0x7b65('0x18')]=_0x242083[_0x7b65('0x18')];this[_0x7b65('0x19')]=_0x242083[_0x7b65('0x19')];this[_0x7b65('0x1a')]=_0x242083['id'];this[_0x7b65('0x1b')]=_0x242083[_0x7b65('0x5')]['firstName']||'';this[_0x7b65('0x1c')]=moment()[_0x7b65('0x1d')](_0x7b65('0x1e'));this[_0x7b65('0x1f')]=_0x242083[_0x7b65('0x1f')];this[_0x7b65('0x20')]=_0x242083[_0x7b65('0x20')];this[_0x7b65('0x21')]=_0x242083[_0x7b65('0x21')];this[_0x7b65('0x22')]=_0x242083['recallme'];this['originatecalleridnum']='';this[_0x7b65('0x23')]='';}Action[_0x7b65('0x24')][_0x7b65('0x25')]=function(){return util[_0x7b65('0x1d')](_0x7b65('0x26'),this['name'],this[_0x7b65('0x27')][_0x7b65('0x28')]>0x0?this[_0x7b65('0x8')][_0x7b65('0x29')](this[_0x7b65('0x27')][_0x7b65('0x28')]):this[_0x7b65('0x8')]);};Action[_0x7b65('0x24')][_0x7b65('0x2a')]=function(){return this['queue'];};module[_0x7b65('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 2c1d702..06f9eaf 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb455=['holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','state','Answer','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','ringtime'];(function(_0x23a62f,_0x1166df){var _0x35a97a=function(_0x5ea529){while(--_0x5ea529){_0x23a62f['push'](_0x23a62f['shift']());}};_0x35a97a(++_0x1166df);}(_0xb455,0x142));var _0x5b45=function(_0xba908c,_0xe7a057){_0xba908c=_0xba908c-0x0;var _0x3627c8=_0xb455[_0xba908c];return _0x3627c8;};'use strict';var util=require(_0x5b45('0x0'));var _=require(_0x5b45('0x1'));var moment=require(_0x5b45('0x2'));function getSeconds(_0x3cb29e,_0x5de933){var _0x4aaabf=moment(_0x3cb29e)[_0x5b45('0x3')](0x0);var _0x5d6627=moment(_0x5de933)[_0x5b45('0x3')](0x0);return _0x4aaabf[_0x5b45('0x4')](_0x5d6627,'seconds');}function AgentComplete(_0x347632,_0x1042e6){this[_0x5b45('0x5')]=0x4;this['statedesc']=_0x5b45('0x6');this['scheduledat']=_0x347632['scheduledat'];this[_0x5b45('0x7')]=_0x347632[_0x5b45('0x7')];this['campaigntype']=_0x347632[_0x5b45('0x7')]===_0x5b45('0x8')?_0x5b45('0x9'):_0x347632[_0x5b45('0x7')];this[_0x5b45('0xa')]=_0x347632[_0x5b45('0xa')];this[_0x5b45('0xb')]=_0x347632['countcongestionretry'];this[_0x5b45('0xc')]=_0x347632[_0x5b45('0xc')];this[_0x5b45('0xd')]=_0x347632[_0x5b45('0xa')]+_0x347632['countcongestionretry']+_0x347632[_0x5b45('0xc')]+_0x347632[_0x5b45('0xe')]+_0x347632[_0x5b45('0xf')]+_0x347632[_0x5b45('0x10')]+_0x347632[_0x5b45('0x11')]+_0x347632[_0x5b45('0x12')];this[_0x5b45('0xe')]=_0x347632[_0x5b45('0xe')];this['countdropretry']=_0x347632[_0x5b45('0xf')];this[_0x5b45('0x10')]=_0x347632[_0x5b45('0x10')];this['countmachineretry']=_0x347632[_0x5b45('0x11')];this[_0x5b45('0x12')]=_0x347632['countagentrejectretry'];this[_0x5b45('0x13')]=_0x1042e6[_0x5b45('0x13')];this[_0x5b45('0x14')]=_0x347632[_0x5b45('0x15')];this[_0x5b45('0x16')]=_0x347632[_0x5b45('0x17')];this[_0x5b45('0x18')]=_0x347632['starttime'];this[_0x5b45('0x19')]=_0x347632[_0x5b45('0x19')];this['answertime']=_0x347632[_0x5b45('0x1a')];this[_0x5b45('0x1b')]=moment()[_0x5b45('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x5b45('0x1d')]=getSeconds(_0x347632[_0x5b45('0x19')],_0x347632[_0x5b45('0x18')]);this[_0x5b45('0x1e')]=getSeconds(_0x347632['answertime'],_0x347632['responsetime']);this['talktime']=getSeconds(this[_0x5b45('0x1b')],_0x347632['answertime']);this[_0x5b45('0x9')]=_0x1042e6[_0x5b45('0x9')];this[_0x5b45('0x1f')]=_0x1042e6['membername'];this[_0x5b45('0x20')]=_0x1042e6[_0x5b45('0x20')];this[_0x5b45('0x21')]=_0x347632[_0x5b45('0x21')];this[_0x5b45('0x22')]=_0x347632['callbackuniqueid'];this[_0x5b45('0x23')]=_0x347632['callbackat'];this[_0x5b45('0x24')]=_0x347632[_0x5b45('0x24')];this[_0x5b45('0x25')]=_0x347632[_0x5b45('0x25')];this[_0x5b45('0x26')]=_0x347632[_0x5b45('0x26')];this['UserId']=_0x347632['UserId'];this['VoiceQueueId']=_0x347632[_0x5b45('0x27')];this[_0x5b45('0x28')]=_0x347632[_0x5b45('0x28')];this[_0x5b45('0x29')]=_0x347632[_0x5b45('0x29')]||'';this[_0x5b45('0x2a')]=_0x347632[_0x5b45('0x2a')]||'';}module[_0x5b45('0x2b')]=AgentComplete; \ No newline at end of file +var _0xbcc9=['number','starttime','answertime','endtime','format','ringtime','holdtime','responsetime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','uniqueid','name','calleridnum'];(function(_0x36856f,_0x98b59e){var _0x43ac52=function(_0x36bc47){while(--_0x36bc47){_0x36856f['push'](_0x36856f['shift']());}};_0x43ac52(++_0x98b59e);}(_0xbcc9,0x149));var _0x9bcc=function(_0x3c026d,_0x281623){_0x3c026d=_0x3c026d-0x0;var _0x30cbde=_0xbcc9[_0x3c026d];return _0x30cbde;};'use strict';var util=require(_0x9bcc('0x0'));var _=require(_0x9bcc('0x1'));var moment=require(_0x9bcc('0x2'));function getSeconds(_0x3c1d6c,_0x559299){var _0xfb5aa6=moment(_0x3c1d6c)['milliseconds'](0x0);var _0x480400=moment(_0x559299)[_0x9bcc('0x3')](0x0);return _0xfb5aa6[_0x9bcc('0x4')](_0x480400,'seconds');}function AgentComplete(_0x198420,_0x144710){this['state']=0x4;this[_0x9bcc('0x5')]=_0x9bcc('0x6');this[_0x9bcc('0x7')]=_0x198420[_0x9bcc('0x7')];this[_0x9bcc('0x8')]=_0x198420['type'];this[_0x9bcc('0x9')]=_0x198420[_0x9bcc('0x8')]===_0x9bcc('0xa')?_0x9bcc('0xb'):_0x198420[_0x9bcc('0x8')];this[_0x9bcc('0xc')]=_0x198420[_0x9bcc('0xc')];this[_0x9bcc('0xd')]=_0x198420[_0x9bcc('0xd')];this['countnoanswerretry']=_0x198420[_0x9bcc('0xe')];this[_0x9bcc('0xf')]=_0x198420[_0x9bcc('0xc')]+_0x198420[_0x9bcc('0xd')]+_0x198420[_0x9bcc('0xe')]+_0x198420['countnosuchnumberretry']+_0x198420[_0x9bcc('0x10')]+_0x198420[_0x9bcc('0x11')]+_0x198420['countmachineretry']+_0x198420[_0x9bcc('0x12')];this['countnosuchnumberretry']=_0x198420[_0x9bcc('0x13')];this[_0x9bcc('0x10')]=_0x198420[_0x9bcc('0x10')];this['countabandonedretry']=_0x198420['countabandonedretry'];this['countmachineretry']=_0x198420['countmachineretry'];this[_0x9bcc('0x12')]=_0x198420[_0x9bcc('0x12')];this[_0x9bcc('0x14')]=_0x144710['uniqueid'];this['calleridname']=_0x198420[_0x9bcc('0x15')];this[_0x9bcc('0x16')]=_0x198420[_0x9bcc('0x17')];this[_0x9bcc('0x18')]=_0x198420[_0x9bcc('0x18')];this['responsetime']=_0x198420['responsetime'];this[_0x9bcc('0x19')]=_0x198420['answertime'];this[_0x9bcc('0x1a')]=moment()[_0x9bcc('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x9bcc('0x1c')]=getSeconds(_0x198420['responsetime'],_0x198420['starttime']);this[_0x9bcc('0x1d')]=getSeconds(_0x198420[_0x9bcc('0x19')],_0x198420[_0x9bcc('0x1e')]);this['talktime']=getSeconds(this[_0x9bcc('0x1a')],_0x198420['answertime']);this[_0x9bcc('0xb')]=_0x144710['queue'];this[_0x9bcc('0x1f')]=_0x144710[_0x9bcc('0x1f')];this[_0x9bcc('0x20')]=_0x144710[_0x9bcc('0x20')];this['callback']=_0x198420[_0x9bcc('0x21')];this[_0x9bcc('0x22')]=_0x198420[_0x9bcc('0x22')];this[_0x9bcc('0x23')]=_0x198420['callbackat'];this[_0x9bcc('0x24')]=_0x198420['recallme'];this['ContactId']=_0x198420[_0x9bcc('0x25')];this[_0x9bcc('0x26')]=_0x198420[_0x9bcc('0x26')];this[_0x9bcc('0x27')]=_0x198420[_0x9bcc('0x27')];this[_0x9bcc('0x28')]=_0x198420[_0x9bcc('0x28')];this['CampaignId']=_0x198420['CampaignId'];this[_0x9bcc('0x29')]=_0x198420[_0x9bcc('0x29')]||'';this[_0x9bcc('0x2a')]=_0x198420[_0x9bcc('0x2a')]||'';}module[_0x9bcc('0x2b')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 63e05d7..fd2d75a 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb66=['scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime','holdtime','talktime','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds'];(function(_0x28c3ea,_0x517740){var _0x1bea20=function(_0x39e90e){while(--_0x39e90e){_0x28c3ea['push'](_0x28c3ea['shift']());}};_0x1bea20(++_0x517740);}(_0xcb66,0x19f));var _0x6cb6=function(_0x2bbc07,_0x1e2168){_0x2bbc07=_0x2bbc07-0x0;var _0x6879e4=_0xcb66[_0x2bbc07];return _0x6879e4;};'use strict';var util=require('util');var _=require(_0x6cb6('0x0'));var moment=require(_0x6cb6('0x1'));function getSeconds(_0x1066ea,_0x3f607b){var _0x205243=moment(_0x1066ea)['milliseconds'](0x0);var _0xe996ed=moment(_0x3f607b)[_0x6cb6('0x2')](0x0);return _0x205243[_0x6cb6('0x3')](_0xe996ed,_0x6cb6('0x4'));}function Final(_0x16bb9d){this['uniqueid']=_0x16bb9d['uniqueid'];this[_0x6cb6('0x5')]=_0x16bb9d[_0x6cb6('0x5')];this[_0x6cb6('0x6')]=_0x16bb9d[_0x6cb6('0x6')];this[_0x6cb6('0x7')]=_0x16bb9d[_0x6cb6('0x6')]===_0x6cb6('0x8')?_0x6cb6('0x9'):_0x16bb9d[_0x6cb6('0x6')];this[_0x6cb6('0xa')]=_0x16bb9d[_0x6cb6('0xa')];this[_0x6cb6('0xb')]=_0x16bb9d[_0x6cb6('0xb')];this['countnoanswerretry']=_0x16bb9d['countnoanswerretry'];this['countglobal']=_0x16bb9d['countbusyretry']+_0x16bb9d[_0x6cb6('0xb')]+_0x16bb9d[_0x6cb6('0xc')]+_0x16bb9d[_0x6cb6('0xd')]+_0x16bb9d[_0x6cb6('0xe')]+_0x16bb9d['countabandonedretry']+_0x16bb9d[_0x6cb6('0xf')]+_0x16bb9d[_0x6cb6('0x10')];this['countnosuchnumberretry']=_0x16bb9d[_0x6cb6('0xd')];this[_0x6cb6('0xe')]=_0x16bb9d['countdropretry'];this[_0x6cb6('0x11')]=_0x16bb9d[_0x6cb6('0x11')];this['countmachineretry']=_0x16bb9d['countmachineretry'];this['countagentrejectretry']=_0x16bb9d['countagentrejectretry'];this[_0x6cb6('0x9')]=_0x16bb9d[_0x6cb6('0x9')];this[_0x6cb6('0x12')]=_0x16bb9d[_0x6cb6('0x12')];this[_0x6cb6('0x13')]=_0x16bb9d[_0x6cb6('0x13')];this['starttime']=_0x16bb9d[_0x6cb6('0x14')];this[_0x6cb6('0x15')]=_0x16bb9d['responsetime'];this['endtime']=_0x16bb9d['responsetime'];this['ringtime']=_0x16bb9d['ringtime']||0x0;this['holdtime']=_0x16bb9d[_0x6cb6('0x16')]||0x0;this[_0x6cb6('0x17')]=_0x16bb9d[_0x6cb6('0x17')]||0x0;this[_0x6cb6('0x18')]=_0x16bb9d[_0x6cb6('0x18')];this['callbackuniqueid']=_0x16bb9d['callbackuniqueid'];this[_0x6cb6('0x19')]=_0x16bb9d[_0x6cb6('0x19')];this[_0x6cb6('0x1a')]=_0x16bb9d[_0x6cb6('0x1a')];this['ContactId']=_0x16bb9d[_0x6cb6('0x1b')];this[_0x6cb6('0x1c')]=_0x16bb9d['ListId'];this['UserId']=_0x16bb9d[_0x6cb6('0x1d')];this['VoiceQueueId']=_0x16bb9d[_0x6cb6('0x1e')];this[_0x6cb6('0x1f')]=_0x16bb9d[_0x6cb6('0x1f')];this[_0x6cb6('0x20')]=_0x16bb9d[_0x6cb6('0x20')]||'';this[_0x6cb6('0x21')]=_0x16bb9d[_0x6cb6('0x21')]||'';}module[_0x6cb6('0x22')]=Final; \ No newline at end of file +var _0x0b78=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue'];(function(_0x18fad4,_0xd83752){var _0xd84fb0=function(_0x36e0fe){while(--_0x36e0fe){_0x18fad4['push'](_0x18fad4['shift']());}};_0xd84fb0(++_0xd83752);}(_0x0b78,0x1ad));var _0x80b7=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x0b78[_0xfae23b];return _0x200640;};'use strict';var util=require(_0x80b7('0x0'));var _=require(_0x80b7('0x1'));var moment=require('moment');function getSeconds(_0x10e644,_0x4f55ab){var _0x4bffac=moment(_0x10e644)[_0x80b7('0x2')](0x0);var _0x4ee9b4=moment(_0x4f55ab)[_0x80b7('0x2')](0x0);return _0x4bffac[_0x80b7('0x3')](_0x4ee9b4,_0x80b7('0x4'));}function Final(_0x5d4a96){this['uniqueid']=_0x5d4a96[_0x80b7('0x5')];this['scheduledat']=_0x5d4a96[_0x80b7('0x6')];this[_0x80b7('0x7')]=_0x5d4a96[_0x80b7('0x7')];this[_0x80b7('0x8')]=_0x5d4a96['type']===_0x80b7('0x9')?_0x80b7('0xa'):_0x5d4a96[_0x80b7('0x7')];this['countbusyretry']=_0x5d4a96[_0x80b7('0xb')];this['countcongestionretry']=_0x5d4a96[_0x80b7('0xc')];this[_0x80b7('0xd')]=_0x5d4a96[_0x80b7('0xd')];this[_0x80b7('0xe')]=_0x5d4a96[_0x80b7('0xb')]+_0x5d4a96[_0x80b7('0xc')]+_0x5d4a96[_0x80b7('0xd')]+_0x5d4a96[_0x80b7('0xf')]+_0x5d4a96[_0x80b7('0x10')]+_0x5d4a96[_0x80b7('0x11')]+_0x5d4a96[_0x80b7('0x12')]+_0x5d4a96['countagentrejectretry'];this[_0x80b7('0xf')]=_0x5d4a96[_0x80b7('0xf')];this['countdropretry']=_0x5d4a96[_0x80b7('0x10')];this[_0x80b7('0x11')]=_0x5d4a96['countabandonedretry'];this[_0x80b7('0x12')]=_0x5d4a96[_0x80b7('0x12')];this[_0x80b7('0x13')]=_0x5d4a96[_0x80b7('0x13')];this[_0x80b7('0xa')]=_0x5d4a96[_0x80b7('0xa')];this[_0x80b7('0x14')]=_0x5d4a96[_0x80b7('0x14')];this[_0x80b7('0x15')]=_0x5d4a96[_0x80b7('0x15')];this['starttime']=_0x5d4a96[_0x80b7('0x16')];this[_0x80b7('0x17')]=_0x5d4a96[_0x80b7('0x17')];this[_0x80b7('0x18')]=_0x5d4a96['responsetime'];this['ringtime']=_0x5d4a96[_0x80b7('0x19')]||0x0;this[_0x80b7('0x1a')]=_0x5d4a96[_0x80b7('0x1a')]||0x0;this[_0x80b7('0x1b')]=_0x5d4a96['talktime']||0x0;this['callback']=_0x5d4a96[_0x80b7('0x1c')];this[_0x80b7('0x1d')]=_0x5d4a96[_0x80b7('0x1d')];this[_0x80b7('0x1e')]=_0x5d4a96['callbackat'];this[_0x80b7('0x1f')]=_0x5d4a96['recallme'];this['ContactId']=_0x5d4a96[_0x80b7('0x20')];this[_0x80b7('0x21')]=_0x5d4a96[_0x80b7('0x21')];this[_0x80b7('0x22')]=_0x5d4a96[_0x80b7('0x22')];this[_0x80b7('0x23')]=_0x5d4a96[_0x80b7('0x23')];this[_0x80b7('0x24')]=_0x5d4a96[_0x80b7('0x24')];this[_0x80b7('0x25')]=_0x5d4a96[_0x80b7('0x25')]||'';this[_0x80b7('0x26')]=_0x5d4a96[_0x80b7('0x26')]||'';}module[_0x80b7('0x27')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index a7af842..430b12b 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a8f=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','number','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','starttime','talktime','IVR','reason','cause-txt','callback'];(function(_0x250da5,_0x4f7286){var _0x26d80a=function(_0x137534){while(--_0x137534){_0x250da5['push'](_0x250da5['shift']());}};_0x26d80a(++_0x4f7286);}(_0x9a8f,0xb9));var _0xf9a8=function(_0x2d5771,_0x298eb0){_0x2d5771=_0x2d5771-0x0;var _0x4e7fff=_0x9a8f[_0x2d5771];return _0x4e7fff;};'use strict';var util=require(_0xf9a8('0x0'));var _=require(_0xf9a8('0x1'));var moment=require(_0xf9a8('0x2'));function getSeconds(_0x58a04d,_0x518b22){var _0x40b2bf=moment(_0x58a04d)[_0xf9a8('0x3')](0x0);var _0x193c89=moment(_0x518b22)['milliseconds'](0x0);return _0x40b2bf[_0xf9a8('0x4')](_0x193c89,_0xf9a8('0x5'));}function Hangup(_0x408a37,_0x32c822){this['state']=0x4;this[_0xf9a8('0x6')]=_0xf9a8('0x7');this[_0xf9a8('0x8')]=_0x408a37['scheduledat'];this[_0xf9a8('0x9')]=_0x408a37['type'];this[_0xf9a8('0xa')]=_0x408a37['type']===_0xf9a8('0xb')?_0xf9a8('0xc'):_0x408a37[_0xf9a8('0x9')];this[_0xf9a8('0xd')]=_0x408a37['countbusyretry'];this['countcongestionretry']=_0x408a37[_0xf9a8('0xe')];this[_0xf9a8('0xf')]=_0x408a37[_0xf9a8('0xf')];this[_0xf9a8('0x10')]=_0x408a37[_0xf9a8('0xd')]+_0x408a37[_0xf9a8('0xe')]+_0x408a37[_0xf9a8('0xf')]+_0x408a37[_0xf9a8('0x11')]+_0x408a37[_0xf9a8('0x12')]+_0x408a37[_0xf9a8('0x13')]+_0x408a37['countmachineretry']+_0x408a37[_0xf9a8('0x14')];this[_0xf9a8('0x11')]=_0x408a37['countnosuchnumberretry'];this[_0xf9a8('0x12')]=_0x408a37['countdropretry'];this['countabandonedretry']=_0x408a37['countabandonedretry'];this[_0xf9a8('0x15')]=_0x408a37[_0xf9a8('0x15')];this[_0xf9a8('0x14')]=_0x408a37[_0xf9a8('0x14')];this[_0xf9a8('0x16')]=_0x32c822[_0xf9a8('0x16')];this[_0xf9a8('0x17')]=_0x408a37[_0xf9a8('0x18')];this['calleridnum']=_0x408a37[_0xf9a8('0x19')];this['starttime']=_0x408a37['starttime'];this[_0xf9a8('0x1a')]=_0x408a37['responsetime'];this[_0xf9a8('0x1b')]=moment()['format'](_0xf9a8('0x1c'));this['ringtime']=getSeconds(_0x408a37['responsetime'],_0x408a37[_0xf9a8('0x1d')]);this['holdtime']=0x0;this[_0xf9a8('0x1e')]=getSeconds(this[_0xf9a8('0x1b')],_0x408a37[_0xf9a8('0x1a')]);this[_0xf9a8('0xc')]=_0x408a37[_0xf9a8('0xc')];this['membername']=_0xf9a8('0x1f');this[_0xf9a8('0x20')]=_0x32c822[_0xf9a8('0x21')];this[_0xf9a8('0x22')]=_0x408a37[_0xf9a8('0x22')];this[_0xf9a8('0x23')]=_0x408a37[_0xf9a8('0x23')];this[_0xf9a8('0x24')]=_0x408a37['callbackat'];this[_0xf9a8('0x25')]=_0x408a37[_0xf9a8('0x25')];this[_0xf9a8('0x26')]=_0x408a37[_0xf9a8('0x26')];this[_0xf9a8('0x27')]=_0x408a37['ListId'];this[_0xf9a8('0x28')]=_0x408a37[_0xf9a8('0x28')];this['VoiceQueueId']=_0x408a37[_0xf9a8('0x29')];this[_0xf9a8('0x2a')]=_0x408a37['CampaignId'];}module[_0xf9a8('0x2b')]=Hangup; \ No newline at end of file +var _0x290c=['util','lodash','moment','milliseconds','seconds','state','statedesc','Answer','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','queue','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId'];(function(_0x3c159d,_0x5220f0){var _0x119498=function(_0x1d383f){while(--_0x1d383f){_0x3c159d['push'](_0x3c159d['shift']());}};_0x119498(++_0x5220f0);}(_0x290c,0x140));var _0xc290=function(_0x17b7c7,_0x21a43d){_0x17b7c7=_0x17b7c7-0x0;var _0x13b567=_0x290c[_0x17b7c7];return _0x13b567;};'use strict';var util=require(_0xc290('0x0'));var _=require(_0xc290('0x1'));var moment=require(_0xc290('0x2'));function getSeconds(_0x568809,_0x56ff6c){var _0x1e4b29=moment(_0x568809)[_0xc290('0x3')](0x0);var _0x3369ad=moment(_0x56ff6c)[_0xc290('0x3')](0x0);return _0x1e4b29['diff'](_0x3369ad,_0xc290('0x4'));}function Hangup(_0x1e35c1,_0x4c14eb){this[_0xc290('0x5')]=0x4;this[_0xc290('0x6')]=_0xc290('0x7');this[_0xc290('0x8')]=_0x1e35c1[_0xc290('0x8')];this[_0xc290('0x9')]=_0x1e35c1['type'];this['campaigntype']=_0x1e35c1[_0xc290('0x9')]==='outbound'?'queue':_0x1e35c1[_0xc290('0x9')];this[_0xc290('0xa')]=_0x1e35c1[_0xc290('0xa')];this[_0xc290('0xb')]=_0x1e35c1['countcongestionretry'];this[_0xc290('0xc')]=_0x1e35c1['countnoanswerretry'];this[_0xc290('0xd')]=_0x1e35c1[_0xc290('0xa')]+_0x1e35c1[_0xc290('0xb')]+_0x1e35c1[_0xc290('0xc')]+_0x1e35c1[_0xc290('0xe')]+_0x1e35c1[_0xc290('0xf')]+_0x1e35c1[_0xc290('0x10')]+_0x1e35c1[_0xc290('0x11')]+_0x1e35c1['countagentrejectretry'];this[_0xc290('0xe')]=_0x1e35c1['countnosuchnumberretry'];this[_0xc290('0xf')]=_0x1e35c1[_0xc290('0xf')];this[_0xc290('0x10')]=_0x1e35c1[_0xc290('0x10')];this[_0xc290('0x11')]=_0x1e35c1[_0xc290('0x11')];this[_0xc290('0x12')]=_0x1e35c1[_0xc290('0x12')];this[_0xc290('0x13')]=_0x4c14eb[_0xc290('0x13')];this['calleridname']=_0x1e35c1[_0xc290('0x14')];this['calleridnum']=_0x1e35c1['number'];this[_0xc290('0x15')]=_0x1e35c1[_0xc290('0x15')];this[_0xc290('0x16')]=_0x1e35c1[_0xc290('0x16')];this[_0xc290('0x17')]=moment()[_0xc290('0x18')](_0xc290('0x19'));this[_0xc290('0x1a')]=getSeconds(_0x1e35c1[_0xc290('0x16')],_0x1e35c1[_0xc290('0x15')]);this['holdtime']=0x0;this[_0xc290('0x1b')]=getSeconds(this['endtime'],_0x1e35c1[_0xc290('0x16')]);this['queue']=_0x1e35c1[_0xc290('0x1c')];this['membername']=_0xc290('0x1d');this[_0xc290('0x1e')]=_0x4c14eb[_0xc290('0x1f')];this['callback']=_0x1e35c1[_0xc290('0x20')];this[_0xc290('0x21')]=_0x1e35c1['callbackuniqueid'];this[_0xc290('0x22')]=_0x1e35c1[_0xc290('0x22')];this[_0xc290('0x23')]=_0x1e35c1[_0xc290('0x23')];this[_0xc290('0x24')]=_0x1e35c1[_0xc290('0x24')];this[_0xc290('0x25')]=_0x1e35c1['ListId'];this[_0xc290('0x26')]=_0x1e35c1[_0xc290('0x26')];this['VoiceQueueId']=_0x1e35c1['VoiceQueueId'];this[_0xc290('0x27')]=_0x1e35c1['CampaignId'];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index b2ecbb3..afdf70b 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ac8=['milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','name','number','starttime','responsetime','endtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment'];(function(_0x1e5044,_0x6e8c05){var _0x44181e=function(_0x4bb976){while(--_0x4bb976){_0x1e5044['push'](_0x1e5044['shift']());}};_0x44181e(++_0x6e8c05);}(_0x4ac8,0x108));var _0x84ac=function(_0x2b7ce8,_0x392eb0){_0x2b7ce8=_0x2b7ce8-0x0;var _0xea0dad=_0x4ac8[_0x2b7ce8];return _0xea0dad;};'use strict';var util=require(_0x84ac('0x0'));var _=require('lodash');var moment=require(_0x84ac('0x1'));function getSeconds(_0x261586,_0x1659a7){var _0x2bcf0f=moment(_0x261586)[_0x84ac('0x2')](0x0);var _0x7e5d14=moment(_0x1659a7)['milliseconds'](0x0);return _0x2bcf0f[_0x84ac('0x3')](_0x7e5d14,_0x84ac('0x4'));}function History(_0x501e88){this[_0x84ac('0x5')]=_0x501e88[_0x84ac('0x5')];this[_0x84ac('0x6')]=_0x501e88[_0x84ac('0x6')]||undefined;this[_0x84ac('0x7')]=_0x501e88['type'];this[_0x84ac('0x8')]=_0x501e88[_0x84ac('0x7')]===_0x84ac('0x9')?_0x84ac('0xa'):_0x501e88[_0x84ac('0x7')];this[_0x84ac('0xb')]=_0x501e88[_0x84ac('0xb')];this['countcongestionretry']=_0x501e88[_0x84ac('0xc')];this[_0x84ac('0xd')]=_0x501e88[_0x84ac('0xd')];this[_0x84ac('0xe')]=_0x501e88[_0x84ac('0xb')]+_0x501e88[_0x84ac('0xc')]+_0x501e88[_0x84ac('0xd')]+_0x501e88[_0x84ac('0xf')]+_0x501e88[_0x84ac('0x10')]+_0x501e88[_0x84ac('0x11')]+_0x501e88[_0x84ac('0x12')]+_0x501e88[_0x84ac('0x13')];this[_0x84ac('0xf')]=_0x501e88['countnosuchnumberretry'];this['countdropretry']=_0x501e88[_0x84ac('0x10')];this['countabandonedretry']=_0x501e88[_0x84ac('0x11')];this['countmachineretry']=_0x501e88['countmachineretry'];this[_0x84ac('0x13')]=_0x501e88[_0x84ac('0x13')];this[_0x84ac('0xa')]=_0x501e88['queue'];this['calleridname']=_0x501e88[_0x84ac('0x14')];this['calleridnum']=_0x501e88[_0x84ac('0x15')];this[_0x84ac('0x16')]=_0x501e88[_0x84ac('0x16')];this[_0x84ac('0x17')]=_0x501e88['responsetime'];this[_0x84ac('0x18')]=_0x501e88[_0x84ac('0x17')];this['ringtime']=getSeconds(_0x501e88[_0x84ac('0x17')],_0x501e88[_0x84ac('0x16')]);this['holdtime']=0x0;this[_0x84ac('0x19')]=0x0;this[_0x84ac('0x1a')]=_0x501e88[_0x84ac('0x1a')];this[_0x84ac('0x1b')]=_0x501e88[_0x84ac('0x1b')];this[_0x84ac('0x1c')]=_0x501e88[_0x84ac('0x1c')];this['recallme']=_0x501e88[_0x84ac('0x1d')];this[_0x84ac('0x1e')]=_0x501e88[_0x84ac('0x1e')];this['ListId']=_0x501e88[_0x84ac('0x1f')];this[_0x84ac('0x20')]=_0x501e88[_0x84ac('0x20')];this[_0x84ac('0x21')]=_0x501e88['VoiceQueueId'];this[_0x84ac('0x22')]=_0x501e88[_0x84ac('0x22')];this[_0x84ac('0x23')]=_0x501e88[_0x84ac('0x23')]||'';this[_0x84ac('0x24')]=_0x501e88[_0x84ac('0x24')]||'';}module[_0x84ac('0x25')]=History; \ No newline at end of file +var _0x7d69=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countagentrejectretry','countnosuchnumberretry','countdropretry','countabandonedretry','name','number','starttime','responsetime','endtime','holdtime','callback','callbackuniqueid'];(function(_0x256837,_0x17dec7){var _0x156a52=function(_0x36cc3e){while(--_0x36cc3e){_0x256837['push'](_0x256837['shift']());}};_0x156a52(++_0x17dec7);}(_0x7d69,0x157));var _0x97d6=function(_0x2ef49b,_0x9661a7){_0x2ef49b=_0x2ef49b-0x0;var _0x663f4b=_0x7d69[_0x2ef49b];return _0x663f4b;};'use strict';var util=require(_0x97d6('0x0'));var _=require(_0x97d6('0x1'));var moment=require(_0x97d6('0x2'));function getSeconds(_0x53fdfa,_0x4c3f11){var _0x15b53b=moment(_0x53fdfa)['milliseconds'](0x0);var _0x4ace60=moment(_0x4c3f11)[_0x97d6('0x3')](0x0);return _0x15b53b[_0x97d6('0x4')](_0x4ace60,_0x97d6('0x5'));}function History(_0x25017f){this[_0x97d6('0x6')]=_0x25017f[_0x97d6('0x6')];this[_0x97d6('0x7')]=_0x25017f[_0x97d6('0x7')]||undefined;this[_0x97d6('0x8')]=_0x25017f[_0x97d6('0x8')];this[_0x97d6('0x9')]=_0x25017f[_0x97d6('0x8')]==='outbound'?_0x97d6('0xa'):_0x25017f[_0x97d6('0x8')];this[_0x97d6('0xb')]=_0x25017f['countbusyretry'];this[_0x97d6('0xc')]=_0x25017f['countcongestionretry'];this['countnoanswerretry']=_0x25017f[_0x97d6('0xd')];this[_0x97d6('0xe')]=_0x25017f['countbusyretry']+_0x25017f[_0x97d6('0xc')]+_0x25017f[_0x97d6('0xd')]+_0x25017f['countnosuchnumberretry']+_0x25017f['countdropretry']+_0x25017f['countabandonedretry']+_0x25017f['countmachineretry']+_0x25017f[_0x97d6('0xf')];this[_0x97d6('0x10')]=_0x25017f[_0x97d6('0x10')];this[_0x97d6('0x11')]=_0x25017f[_0x97d6('0x11')];this[_0x97d6('0x12')]=_0x25017f[_0x97d6('0x12')];this['countmachineretry']=_0x25017f['countmachineretry'];this[_0x97d6('0xf')]=_0x25017f[_0x97d6('0xf')];this['queue']=_0x25017f[_0x97d6('0xa')];this['calleridname']=_0x25017f[_0x97d6('0x13')];this['calleridnum']=_0x25017f[_0x97d6('0x14')];this[_0x97d6('0x15')]=_0x25017f['starttime'];this['responsetime']=_0x25017f[_0x97d6('0x16')];this[_0x97d6('0x17')]=_0x25017f['responsetime'];this['ringtime']=getSeconds(_0x25017f[_0x97d6('0x16')],_0x25017f[_0x97d6('0x15')]);this[_0x97d6('0x18')]=0x0;this['talktime']=0x0;this[_0x97d6('0x19')]=_0x25017f[_0x97d6('0x19')];this['callbackuniqueid']=_0x25017f[_0x97d6('0x1a')];this[_0x97d6('0x1b')]=_0x25017f[_0x97d6('0x1b')];this[_0x97d6('0x1c')]=_0x25017f[_0x97d6('0x1c')];this[_0x97d6('0x1d')]=_0x25017f[_0x97d6('0x1d')];this[_0x97d6('0x1e')]=_0x25017f[_0x97d6('0x1e')];this['UserId']=_0x25017f[_0x97d6('0x1f')];this[_0x97d6('0x20')]=_0x25017f[_0x97d6('0x20')];this['CampaignId']=_0x25017f[_0x97d6('0x21')];this['originatecalleridnum']=_0x25017f[_0x97d6('0x22')]||'';this[_0x97d6('0x23')]=_0x25017f[_0x97d6('0x23')]||'';}module[_0x97d6('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 7b07e08..ec62dea 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 _0x3c40=['voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','dialer','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','[rescheduleContact][Machine]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callProgressDetecting','object','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','createStateFinal','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','busy','[syncAgentComplete][createHistory][5]','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','Success','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','getVoiceQueueRtPauses','outboundQueuePauses','[CatchErlangB]','agentBusyFactor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','queueStatusComplete:\x20','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','dialLimitQueue','[countReScheduled]\x20','checkIsBlackList','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','[actionOriginate]\x20','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictive','predictiveCalls','redis','defaults','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','env','XCALLY_IP_AGI','rrmemory','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','isUndefined','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','isEmpty','Intervals','[ifTime][Action]','Error','milliseconds','diff','emit','type','outbound','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','waiting','loggedInDb','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','callerid','stringify','md5','format','voice:queue:%s','voice_queue:save','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','startPredictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','ivr','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','is\x20disactive','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','isNil','Action','status','channel','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','then','catch','resolve','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact]','isSuccess','isTrunkReachable','active','reachable','SIP/%s','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','HangupInAMD','membername','custom:amd','buildObj','amd','[syncHangupInAMD]','MACHINE','Machine','AMD','countmachineretry','countglobal','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','countbusyretry','dialGlobalMaxRetry','stateGlobal','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','Unknow','syncAgentComplete','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','Drop','dropreason','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','calleridname','calleridnum','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','[syncAgentComplete][createHistory][11]','syncQueueMember','actionid','strategy','roundrobin','locked','agents','stateinterface','idHopper','paused','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','length','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','loopCampaigns','resetActiveCalls','syncCampaigns','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','TIMEZONE_UNKNOW','isArray','iftime\x20%s,%s','interval','timezones','indexOf','true','push','command','content','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','power','dialPowerLevel','handlePower','Queue','method\x20not\x20recognized','handleIvr','syncQueueSummary','dialActive','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','checkDialMethod','[syncQueueSummary]','launchHandleIvr','\x5cw{0,','pow','replace','random','match','actionOriginate','originate'];(function(_0x418d65,_0x69d05c){var _0x3bb5e4=function(_0x43b92b){while(--_0x43b92b){_0x418d65['push'](_0x418d65['shift']());}};_0x3bb5e4(++_0x69d05c);}(_0x3c40,0xbc));var _0x03c4=function(_0x338338,_0x782573){_0x338338=_0x338338-0x0;var _0x3cf852=_0x3c40[_0x338338];return _0x3cf852;};'use strict';var util=require(_0x03c4('0x0'));var _=require(_0x03c4('0x1'));var BPromise=require(_0x03c4('0x2'));var uuid=require(_0x03c4('0x3'));var moment=require(_0x03c4('0x4'));var rr=require('rr');var md5=require('md5');var Redis=require(_0x03c4('0x5'));var ut=require(_0x03c4('0x6'));var config=require(_0x03c4('0x7'));var logger=require(_0x03c4('0x8'))('dialer');var loggerBooked=require(_0x03c4('0x8'))(_0x03c4('0x9'));var loggerPredictive=require(_0x03c4('0x8'))(_0x03c4('0xa'));var loggerPredictiveCalls=require(_0x03c4('0x8'))(_0x03c4('0xb'));var loggerSyncQueueSummary=require('../../../config/logger')('syncQueueSummary');var ami=require('../ami');config[_0x03c4('0xc')]=_[_0x03c4('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x03c4('0xc')]));var cmHopper=require(_0x03c4('0xe'));var cmHopperHistory=require(_0x03c4('0xf'));var cmHopperBlack=require(_0x03c4('0x10'));var voiceQueueRt=require(_0x03c4('0x11'));var Action=require(_0x03c4('0x12'));var History=require(_0x03c4('0x13'));var Final=require(_0x03c4('0x14'));var AgentComplete=require(_0x03c4('0x15'));var QueueCallerAbandon=require(_0x03c4('0x16'));var Hangup=require('./hangup');var ipAgi=process[_0x03c4('0x17')][_0x03c4('0x18')]||'127.0.0.1';var strategy={'rrmemory':_0x03c4('0x19'),'roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0x03c4('0x1a')][_0x03c4('0x1b')]=function(_0x10288c){this[_0x03c4('0x1c')]=this[_0x03c4('0x1c')]?this['tail'][_0x03c4('0x1d')](_0x10288c):_0x10288c();};function Dialer(_0x36e3de,_0x2173fa){this[_0x03c4('0x1e')]=new Sequence();this[_0x03c4('0x1f')]=_0x2173fa;this[_0x03c4('0x20')]=_0x36e3de['voiceQueues'];this[_0x03c4('0x21')]=_0x36e3de[_0x03c4('0x21')];this['agents']=_0x36e3de['agents'];this[_0x03c4('0x22')]=_0x36e3de[_0x03c4('0x22')];this[_0x03c4('0x23')]=config['maxNumberOriginate']||0x2;this[_0x03c4('0x24')]={};this[_0x03c4('0x25')]={};this[_0x03c4('0x26')]={};this[_0x03c4('0x27')]={};this[_0x03c4('0x28')]={};this['startPredictive']={};this['startProgressive']={};this[_0x03c4('0x29')]={};this[_0x03c4('0x2a')]={};this['queueBookedRR']={};ami['on'](_0x03c4('0x2b'),this[_0x03c4('0x2c')][_0x03c4('0x2d')](this));ami['on'](_0x03c4('0x2e'),this[_0x03c4('0x2f')]['bind'](this));ami['on'](_0x03c4('0x30'),this[_0x03c4('0x31')]['bind'](this));ami['on'](_0x03c4('0x32'),this['syncAgentComplete']['bind'](this));ami['on'](_0x03c4('0x33'),this['syncQueueSummary'][_0x03c4('0x2d')](this));ami['on'](_0x03c4('0x34'),this[_0x03c4('0x35')][_0x03c4('0x2d')](this));ami['on'](_0x03c4('0x36'),this[_0x03c4('0x37')][_0x03c4('0x2d')](this));ami['on']('varset',this[_0x03c4('0x38')]['bind'](this));ami['on'](_0x03c4('0x39'),this['syncQueueMember'][_0x03c4('0x2d')](this));ami['on'](_0x03c4('0x3a'),this[_0x03c4('0x3b')][_0x03c4('0x2d')](this));this['loopCampaigns']();this[_0x03c4('0x3c')]();}function isNotNull(_0x2279a5){return _0x2279a5!==null&&!_[_0x03c4('0x3d')](_0x2279a5);}function checkIsLoggedIn(_0xc96891,_0x4f2a99){return function(){if(_0x4f2a99<=0x0){_0xc96891[_0x03c4('0x3e')]='AGENTS_NOT_LOGGED';throw _0xc96891[_0x03c4('0x3f')]+_0x03c4('0x40');}};}function isActive(_0x519243){return _0x519243;}function checkIsActive(_0x5dbaff,_0x57c581){return function(){if(!isActive(_0x57c581)){_0x5dbaff[_0x03c4('0x3e')]=_0x03c4('0x41');throw _0x5dbaff[_0x03c4('0x3f')]+'\x20NOT\x20Active';}};}function checkInterval(_0x1a7b6f){return function(){if(!isNotNull(_0x1a7b6f[_0x03c4('0x42')])){_0x1a7b6f[_0x03c4('0x3e')]=_0x03c4('0x43');throw _0x1a7b6f['name']+_0x03c4('0x44');}if(!isNotNull(_0x1a7b6f[_0x03c4('0x42')]['Intervals'])){_0x1a7b6f[_0x03c4('0x3e')]='INTERVAL_IS_NULL';throw _0x1a7b6f[_0x03c4('0x3f')]+_0x03c4('0x44');}if(!isNotNull(_[_0x03c4('0x45')](_0x1a7b6f[_0x03c4('0x42')][_0x03c4('0x46')]))){_0x1a7b6f[_0x03c4('0x3e')]=_0x03c4('0x43');throw _0x1a7b6f[_0x03c4('0x3f')]+_0x03c4('0x44');}};}function msgResponse(_0x33a5a5,_0x1f8b02,_0x198602){return{'action':_0x33a5a5,'response':_0x1f8b02,'message':_0x198602,'stack':_0x198602};}function myreject(_0x1929b9){return function(_0x56f68b){return _0x1929b9(msgResponse(_0x03c4('0x47'),_0x03c4('0x48'),JSON['stringify'](_0x56f68b)));};}function getSeconds(_0x63e28f,_0x6fdcc6){var _0x1341e7=moment(_0x63e28f)[_0x03c4('0x49')](0x0);var _0x1e8b0f=moment(_0x6fdcc6)[_0x03c4('0x49')](0x0);return _0x1341e7[_0x03c4('0x4a')](_0x1e8b0f,'seconds');}function emit(_0x2d26b3,_0x32de1e,_0x1d11b1){io['to'](_0x2d26b3)[_0x03c4('0x4b')](_0x32de1e,_0x1d11b1);}function emitVoiceQueueSummary(_0x42c772){if(_0x42c772[_0x03c4('0x4c')]===_0x03c4('0x4d')){var _0x251ac1={'id':_0x42c772['id'],'name':_0x42c772[_0x03c4('0x3f')],'strategy':_0x42c772['strategy'],'answered':_0x42c772[_0x03c4('0x4e')],'available':_0x42c772[_0x03c4('0x4f')],'loggedIn':_0x42c772[_0x03c4('0x50')],'pTalking':_0x42c772[_0x03c4('0x51')],'sumBillable':_0x42c772[_0x03c4('0x52')],'sumDuration':_0x42c772[_0x03c4('0x53')],'sumHoldTime':_0x42c772[_0x03c4('0x54')]||0x0,'talking':_0x42c772[_0x03c4('0x55')],'total':_0x42c772[_0x03c4('0x56')],'type':_0x42c772[_0x03c4('0x4c')],'unmanaged':_0x42c772[_0x03c4('0x57')],'abandoned':_0x42c772['abandoned'],'waiting':_0x42c772[_0x03c4('0x58')],'loggedInDb':_0x42c772[_0x03c4('0x59')],'dialActive':_0x42c772['dialActive'],'dialMethod':_0x42c772[_0x03c4('0x5a')],'dialOriginateCallerIdName':_0x42c772['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x42c772[_0x03c4('0x5b')],'dialOriginateTimeout':_0x42c772[_0x03c4('0x5c')],'dialPrefix':_0x42c772[_0x03c4('0x5d')],'outboundAnswerAgiCallsDay':_0x42c772[_0x03c4('0x5e')],'outboundAnswerCallsDay':_0x42c772[_0x03c4('0x5f')],'outboundBlacklistCallsDay':_0x42c772['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x42c772[_0x03c4('0x60')],'outboundCongestionCallsDay':_0x42c772[_0x03c4('0x61')],'outboundDropCallsDayACS':_0x42c772['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x42c772[_0x03c4('0x62')],'outboundDropCallsDayTimeout':_0x42c772[_0x03c4('0x63')],'outboundNoAnswerCallsDay':_0x42c772[_0x03c4('0x64')],'outboundNoSuchCallsDay':_0x42c772[_0x03c4('0x65')],'outboundOriginateFailureCallsDay':_0x42c772['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x42c772[_0x03c4('0x66')],'outboundRejectCallsDay':_0x42c772[_0x03c4('0x67')],'outboundUnknownCallsDay':_0x42c772[_0x03c4('0x68')],'predictiveIntervalAnsweredCalls':_0x42c772[_0x03c4('0x69')],'predictiveIntervalAvgHoldtime':_0x42c772[_0x03c4('0x6a')],'predictiveIntervalAvgTalktime':_0x42c772[_0x03c4('0x6b')],'predictiveIntervalDroppedCallsCallersExit':_0x42c772[_0x03c4('0x6c')],'predictiveIntervalDroppedCallsTimeout':_0x42c772[_0x03c4('0x6d')],'predictiveIntervalErlangCalls':_0x42c772[_0x03c4('0x6e')],'predictiveIntervalErlangCallsDroppedCalls':_0x42c772[_0x03c4('0x6f')],'predictiveIntervalHitRate':_0x42c772[_0x03c4('0x70')],'predictiveIntervalMultiplicativeFactor':_0x42c772[_0x03c4('0x71')],'predictiveIntervalPauses':_0x42c772[_0x03c4('0x72')],'predictiveIntervalAvailable':_0x42c772['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x42c772[_0x03c4('0x73')],'message':_0x42c772[_0x03c4('0x3e')],'originated':_0x42c772[_0x03c4('0x74')],'erlangCalls':_0x42c772[_0x03c4('0x75')],'erlangCallToSecond':_0x42c772['erlangCallToSecond'],'erlangAbandonmentRate':_0x42c772[_0x03c4('0x76')],'erlangBusyFactor':_0x42c772[_0x03c4('0x77')],'startPredictive':_0x42c772['startPredictive'],'startProgressive':_0x42c772[_0x03c4('0x78')]};if(_0x42c772['Trunk']){_0x251ac1[_0x03c4('0x79')]={'id':_0x42c772[_0x03c4('0x79')]['id'],'name':_0x42c772['Trunk']['name'],'active':_0x42c772[_0x03c4('0x79')]['active'],'callerid':_0x42c772[_0x03c4('0x79')][_0x03c4('0x7a')]};}if(_0x42c772[_0x03c4('0x42')]){_0x251ac1[_0x03c4('0x42')]={'id':_0x42c772['Interval']['id'],'name':_0x42c772[_0x03c4('0x42')]['name']};}var _0x13300b=md5(JSON[_0x03c4('0x7b')](_0x251ac1));if(_0x42c772['md5']!==_0x13300b){_0x42c772[_0x03c4('0x7c')]=_0x13300b;emit(util[_0x03c4('0x7d')](_0x03c4('0x7e'),_0x251ac1['name']),_0x03c4('0x7f'),_0x251ac1);}}}function emitCampaignSummary(_0xc19adf){if(_0xc19adf[_0x03c4('0x4c')]==='ivr'){emit(util[_0x03c4('0x7d')](_0x03c4('0x80'),_0xc19adf['name']),_0x03c4('0x81'),_0xc19adf);}}function checkGetDataPredictive(_0x14f257){if(isNotNull(_0x14f257)&&!_['isEmpty'](_0x14f257)){loggerPredictive[_0x03c4('0x82')](_0x03c4('0x83'));loggerPredictive[_0x03c4('0x82')](_0x03c4('0x84'),_0x14f257[_0x03c4('0x73')]);loggerPredictive[_0x03c4('0x82')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x14f257[_0x03c4('0x69')]);loggerPredictive[_0x03c4('0x82')](_0x03c4('0x85'),_0x14f257[_0x03c4('0x6d')]);loggerPredictive[_0x03c4('0x82')](_0x03c4('0x86'),_0x14f257[_0x03c4('0x6c')]);loggerPredictive[_0x03c4('0x82')](_0x03c4('0x87'),_0x14f257[_0x03c4('0x6a')]);loggerPredictive[_0x03c4('0x82')](_0x03c4('0x88'),_0x14f257[_0x03c4('0x6b')]);loggerPredictive[_0x03c4('0x82')](_0x03c4('0x89'));if(_0x14f257[_0x03c4('0x73')]>0x0){if(!_[_0x03c4('0x3d')](_0x14f257[_0x03c4('0x6b')])&&_0x14f257[_0x03c4('0x6b')]>0x0){return!![];}loggerPredictive[_0x03c4('0x82')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_['isUndefined'](_0x14f257[_0x03c4('0x6a')])&&_0x14f257['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x03c4('0x82')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x03c4('0x82')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x03c4('0x82')](_0x03c4('0x8a'));}return![];}function mergeDataErlangB(_0x772371){return function(_0x149ba7){loggerPredictive[_0x03c4('0x82')](_0x03c4('0x8b'));loggerPredictive[_0x03c4('0x82')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x149ba7[_0x03c4('0x75')]);loggerPredictive['info'](_0x03c4('0x8c'),_0x149ba7[_0x03c4('0x8d')]);loggerPredictive[_0x03c4('0x82')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x149ba7['erlangAbandonmentRate']);loggerPredictive[_0x03c4('0x82')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x149ba7['erlangBusyFactor']);loggerPredictive[_0x03c4('0x82')](_0x03c4('0x8e'),_0x149ba7['erlangAbandonmentRate']);loggerPredictive[_0x03c4('0x82')](_0x03c4('0x89'));_[_0x03c4('0x8f')](_0x772371,_0x149ba7);};}function getDiff(_0x4335f7){var _0x18326f=moment()[_0x03c4('0x49')](0x0);var _0x42767a=moment(_0x4335f7)[_0x03c4('0x49')](0x0);return _0x18326f['diff'](_0x42767a,'seconds');}function ifInterval(_0x180736,_0x228c5b){if(_[_0x03c4('0x3d')](_0x228c5b)){return![];}return getDiff(_0x228c5b)<_0x180736*0x3c;}function freeVariablesPredictive(_0x5811f5){if(isNotNull(_0x5811f5)){if(!_[_0x03c4('0x3d')](_0x5811f5['startProgressive'])){_0x5811f5[_0x03c4('0x78')]=undefined;loggerPredictive[_0x03c4('0x82')](_0x5811f5[_0x03c4('0x3f')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0x03c4('0x3d')](_0x5811f5[_0x03c4('0x90')])){_0x5811f5[_0x03c4('0x90')]=undefined;loggerPredictive[_0x03c4('0x82')](_0x5811f5[_0x03c4('0x3f')],'clearing\x20variable\x20start\x20predictive');}if(!_['isUndefined'](_0x5811f5[_0x03c4('0x91')])){clearInterval(_0x5811f5[_0x03c4('0x91')]);_0x5811f5[_0x03c4('0x91')]=undefined;loggerPredictive[_0x03c4('0x82')](_0x5811f5['name'],_0x03c4('0x92'));}}}function erlangb(_0x535987,_0x7b3a84){if(_0x7b3a84===0x0){return 0x0;}var _0x19a97d=0x1;for(var _0x10a86c=0x1;_0x10a86c<=_0x7b3a84;_0x10a86c+=0x1){_0x19a97d=0x1+_0x19a97d*_0x10a86c/_0x535987;}return 0x1/_0x19a97d;}function isVoiceQueueOutbound(_0x5c98e2){return _0x5c98e2==='outbound';}function isNotPreview(_0x57220f){return _0x57220f!==_0x03c4('0x1f');}function isCampaignIvr(_0x563ee4){return _0x563ee4===_0x03c4('0x93');}function getCallerId(_0x44fad6,_0x2d5640,_0x5bc243){if(!_[_0x03c4('0x3d')](_0x5bc243)&&typeof _0x5bc243===_0x03c4('0x94')&&!_[_0x03c4('0x45')](_0x5bc243)){if(!_['isUndefined'](_0x2d5640)&&typeof _0x2d5640===_0x03c4('0x94')&&!_[_0x03c4('0x45')](_0x2d5640)){return util[_0x03c4('0x7d')](_0x03c4('0x95'),_0x2d5640,_0x5bc243);}return util[_0x03c4('0x7d')](_0x03c4('0x95'),_0x5bc243,_0x5bc243);}if(!_[_0x03c4('0x3d')](_0x44fad6)&&typeof _0x44fad6===_0x03c4('0x94')&&!_['isEmpty'](_0x44fad6)){return _0x44fad6;}return _0x03c4('0x96');}function loggerCatchQueueSummary(_0x4bf561,_0x2d0dee){return function(_0x3580e4){freeVariablesPredictive(_0x2d0dee);emitVoiceQueueSummary(_0x2d0dee);emitCampaignSummary(_0x2d0dee);loggerSyncQueueSummary[_0x03c4('0x97')](_0x4bf561,util[_0x03c4('0x98')](_0x3580e4,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x10e7f2,_0x4e7796){return function(_0x295ec2){loggerPredictive['error'](_0x4e7796[_0x03c4('0x3f')],_0x10e7f2);loggerPredictive[_0x03c4('0x97')](_0x295ec2[_0x03c4('0x99')]);freeVariablesPredictive(_0x4e7796);};}function loggerCatch(_0x5b3675){return function(_0x456eb9){logger[_0x03c4('0x97')](_0x5b3675,util[_0x03c4('0x98')](_0x456eb9,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x2cf849){return _0x2cf849&&!_[_0x03c4('0x3d')](_0x2cf849)&&_0x2cf849['length']>0x0;}function decremetOriginate(_0x2bc56f){if(!_['isUndefined'](_0x2bc56f)&&_0x2bc56f!==null){if(typeof _0x2bc56f[_0x03c4('0x74')]!==_0x03c4('0x9a')){if(_0x2bc56f[_0x03c4('0x74')]>0x0){_0x2bc56f['originated']-=0x1;}else{logger[_0x03c4('0x97')](_0x03c4('0x9b'));}}}else{logger[_0x03c4('0x97')](_0x03c4('0x9c'));}}function checkContactLowerLimitOriginate(_0x74782e,_0x31b3fc,_0x53def7){if(_0x31b3fc>_0x53def7){for(var _0x41f86d=0x0;_0x41f86d<_0x31b3fc-_0x53def7;_0x41f86d+=0x1){decremetOriginate(_0x74782e);}}}function loggerGetContactDialer(_0x1ad3ae,_0x11a3ac,_0x1b05be){return function(_0x27e2ac){checkContactLowerLimitOriginate(_0x11a3ac,_0x1b05be,0x0);logger['error'](_0x1ad3ae,util[_0x03c4('0x98')](_0x27e2ac,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x568785){return function(_0x4db8f5){if(isNotNull(_0x4db8f5)&&isNotNull(_0x4db8f5[0x0])){if(_0x4db8f5[0x0]['contactsRescheduled']>0x0){_0x568785[_0x03c4('0x3e')]='RESCHEDULED_CONTACTS';logger[_0x03c4('0x82')](_0x03c4('0x9d')+_0x568785[_0x03c4('0x3f')],_0x4db8f5[0x0][_0x03c4('0x9e')],_0x03c4('0x9f'));}else{_0x568785[_0x03c4('0x3e')]=_0x03c4('0xa0');logger['info']('[getContactDialer2][Empty]'+_0x568785['name']);}}};}function notSendMessagesQueue(_0x189154){if(_0x189154['sendMessageOneNotActive']){freeVariablesPredictive(_0x189154);if(_0x189154[_0x03c4('0x74')]===0x0&&_0x189154['talking']===0x0&&_0x189154[_0x03c4('0x58')]===0x0&&(_0x189154[_0x03c4('0x51')]||0x0)===0x0){_0x189154[_0x03c4('0xa1')]=![];_0x189154[_0x03c4('0x4f')]=0x0;_0x189154[_0x03c4('0x3e')]=_0x03c4('0x41');loggerSyncQueueSummary[_0x03c4('0x97')](_0x03c4('0xa2'),_0x189154[_0x03c4('0x3f')],_0x03c4('0xa3'));}else{_0x189154[_0x03c4('0x3e')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x03c4('0x97')](_0x03c4('0xa2'),_0x189154[_0x03c4('0x3f')],_0x03c4('0xa4'));}emitVoiceQueueSummary(_0x189154);}}function notSendMessagesCampaign(_0x3c38ca){if(_0x3c38ca['sendMessageOneNotActive']){if(_0x3c38ca[_0x03c4('0x74')]===0x0){_0x3c38ca[_0x03c4('0xa1')]=![];_0x3c38ca[_0x03c4('0x3e')]=_0x03c4('0x41');loggerSyncQueueSummary[_0x03c4('0x97')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x3c38ca[_0x03c4('0x3f')],_0x03c4('0xa3'));}else{_0x3c38ca[_0x03c4('0x3e')]=_0x03c4('0xa5');loggerSyncQueueSummary[_0x03c4('0x97')](_0x03c4('0xa6'),_0x3c38ca[_0x03c4('0x3f')],'is\x20disactive');}emitCampaignSummary(_0x3c38ca);}}function createObjHistory(_0x109bb8,_0x384438,_0x1b1fae,_0x41ccf0,_0x42a890){_0x109bb8[_0x03c4('0x3e')]=_0x1b1fae;var _0x5e083a=new Action(_0x109bb8,_0x384438);var _0x5c254c=new History(_0x5e083a);_0x5c254c[_0x03c4('0xa7')]=_0x41ccf0;_0x5c254c[_0x03c4('0xa8')]=_0x42a890;_0x5c254c[_0x03c4('0xa9')]=_0x5e083a[_0x03c4('0xaa')];return _0x5c254c;}Dialer[_0x03c4('0x1a')][_0x03c4('0x3c')]=function(){var _0x5efbed=this;setInterval(function(){_0x5efbed[_0x03c4('0xab')](_0x5efbed[_0x03c4('0x27')],_0x03c4('0xac'));_0x5efbed['clearZombieChannels'](_0x5efbed[_0x03c4('0x25')],'[actions]');},0x32c8);};Dialer[_0x03c4('0x1a')][_0x03c4('0xab')]=function(_0x27dc73,_0x3e36a0){var _0x179aad=this;for(var _0xb4f821 in _0x27dc73){if(typeof _0x27dc73[_0xb4f821]!==_0x03c4('0x9a')){this[_0x03c4('0x1e')][_0x03c4('0x1b')](function(){if(!_[_0x03c4('0xad')](_0x27dc73[_0xb4f821])){return ami[_0x03c4('0xae')]({'action':_0x03c4('0xaf'),'channel':_0x27dc73[_0xb4f821][_0x03c4('0xb0')]})['catch'](function(_0x3c161c){if(_0x3c161c[_0x03c4('0x3e')]===_0x03c4('0xb1')){setTimeout(function(){if(_0x27dc73[_0xb4f821]&&_0x27dc73[_0xb4f821][_0x03c4('0x4c')]!==_0x03c4('0x93')){_0x179aad[_0x03c4('0xb2')](_0x179aad[_0x03c4('0x20')][_0x27dc73[_0xb4f821][_0x03c4('0xb3')]]);logger[_0x03c4('0x97')](_0x03c4('0xb4'),_0x3e36a0,_0xb4f821,_0x27dc73[_0xb4f821][_0x03c4('0xb3')]);delete _0x27dc73[_0xb4f821];}if(_0x27dc73[_0xb4f821]&&_0x27dc73[_0xb4f821][_0x03c4('0x4c')]===_0x03c4('0x93')){_0x179aad[_0x03c4('0xb2')](_0x179aad[_0x03c4('0x21')][_0x27dc73[_0xb4f821][_0x03c4('0xb3')]]);logger[_0x03c4('0x97')](_0x03c4('0xb5'),_0x3e36a0,_0xb4f821,_0x27dc73[_0xb4f821][_0x03c4('0xb3')]);delete _0x27dc73[_0xb4f821];}},0x2328);}});}});}}};Dialer[_0x03c4('0x1a')][_0x03c4('0xb6')]=function(_0x3d09f1){return BPromise['resolve']()[_0x03c4('0xb7')](cmHopper[_0x03c4('0xb6')](_0x3d09f1))[_0x03c4('0xb8')](loggerCatch('[countReScheduled]\x20'));};Dialer['prototype']['checkIsBlackList']=function(_0x59e14a){return BPromise[_0x03c4('0xb9')]()[_0x03c4('0xb7')](cmHopperBlack['checkIsBlackList'](_0x59e14a))['catch'](loggerCatch(_0x03c4('0xba')));};Dialer['prototype'][_0x03c4('0xbb')]=function(_0x5b7cbe){return BPromise[_0x03c4('0xb9')]()['then'](cmHopperBlack[_0x03c4('0xbb')](_0x5b7cbe))[_0x03c4('0xb8')](loggerCatch(_0x03c4('0xbc')));};Dialer[_0x03c4('0x1a')][_0x03c4('0xbd')]=function(_0x33f1b9){return BPromise[_0x03c4('0xb9')]()[_0x03c4('0xb7')](cmHopperHistory[_0x03c4('0xbe')](_0x33f1b9))[_0x03c4('0xb8')](loggerCatch(_0x03c4('0xbf')));};Dialer[_0x03c4('0x1a')][_0x03c4('0xc0')]=function(_0x4e94fc){return BPromise[_0x03c4('0xb9')]()[_0x03c4('0xb7')](cmHopper[_0x03c4('0xc0')](_0x4e94fc))[_0x03c4('0xb8')](loggerCatch(_0x03c4('0xc1')));};Dialer[_0x03c4('0x1a')][_0x03c4('0xc2')]=function(_0x321baa,_0x114a7b,_0x512167){return BPromise[_0x03c4('0xb9')]()[_0x03c4('0xb7')](cmHopper[_0x03c4('0xc2')](_0x321baa,_0x114a7b,_0x512167))[_0x03c4('0xb8')](loggerCatch('[unlockContact]\x20'));};Dialer['prototype']['getContactDialer']=function(_0x190810,_0x5ca885,_0x305f93,_0x36d9f2,_0xe7c713){return BPromise[_0x03c4('0xb9')]()[_0x03c4('0xb7')](cmHopper[_0x03c4('0xc3')](_0x190810,_0x5ca885,_0x305f93,_0x36d9f2))[_0x03c4('0xb8')](function(_0x44703e){_0xe7c713[_0x03c4('0xc4')]-=_0x305f93;_0xe7c713[_0x03c4('0xc4')]=_0xe7c713['temp']>0x0?_0xe7c713[_0x03c4('0xc4')]:0x0;loggerCatch(_0x03c4('0xc5'))(_0x44703e);});};Dialer[_0x03c4('0x1a')][_0x03c4('0xc6')]=function(_0x5b2b86,_0x55c9b8,_0x3c7abc,_0x285e3c){return BPromise[_0x03c4('0xb9')]()[_0x03c4('0xb7')](cmHopper[_0x03c4('0xc6')](_0x5b2b86,_0x55c9b8,_0x3c7abc))[_0x03c4('0xb8')](function(_0x184cc9){_0x285e3c[_0x03c4('0xc4')]-=_0x55c9b8;_0x285e3c[_0x03c4('0xc4')]=_0x285e3c['temp']>0x0?_0x285e3c[_0x03c4('0xc4')]:0x0;loggerCatch(_0x03c4('0xc7'))(_0x184cc9);});};Dialer[_0x03c4('0x1a')]['getVoiceQueueRtPauses']=function(_0x6597cd){return BPromise[_0x03c4('0xb9')]()['then'](voiceQueueRt['getVoiceQueueRtPauses'](_0x6597cd))[_0x03c4('0xb8')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x03c4('0x1a')][_0x03c4('0xc8')]=function(_0x11b854){return BPromise[_0x03c4('0xb9')]()[_0x03c4('0xb7')](cmHopper[_0x03c4('0xc8')](_0x11b854))[_0x03c4('0xb8')](loggerCatch(_0x03c4('0xc9')));};Dialer[_0x03c4('0x1a')][_0x03c4('0xca')]=function(_0x37368f){return BPromise[_0x03c4('0xb9')]()[_0x03c4('0xb7')](cmHopperHistory[_0x03c4('0xca')](_0x37368f))['catch'](loggerCatch('[createHistory]\x20'));};Dialer['prototype'][_0x03c4('0xb2')]=function(_0x57ce23){if(!_[_0x03c4('0x3d')](_0x57ce23)&&_0x57ce23!==null){if(typeof _0x57ce23[_0x03c4('0x74')]!=='undefined'){if(_0x57ce23[_0x03c4('0x74')]>0x0){_0x57ce23[_0x03c4('0x74')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x03c4('0x97')](_0x03c4('0xcb'));}};Dialer[_0x03c4('0x1a')][_0x03c4('0xcc')]=function(_0x4308ec,_0x42cb24){var _0x494a53=this;return function(_0x44f2de){_0x494a53[_0x03c4('0xb2')](_0x42cb24);logger[_0x03c4('0x97')](_0x4308ec,util[_0x03c4('0x98')](_0x44f2de,{'showHidden':![],'depth':null}));};};Dialer[_0x03c4('0x1a')][_0x03c4('0xcd')]=function(_0x37e0cc,_0x3b7784,_0x4a3c1c){var _0x539c3f={'state':0x19,'statedesc':_0x03c4('0xce')};this[_0x03c4('0xb2')](_0x3b7784);this[_0x03c4('0xcf')](_[_0x03c4('0x8f')](_0x539c3f,_[_0x03c4('0xd0')](_0x4a3c1c,[_0x03c4('0xd1'),_0x03c4('0xd2'),_0x03c4('0xd3'),_0x03c4('0xd4'),_0x03c4('0xd5')])),'[emptyContact][createHistory]',_0x03c4('0xd6'));logger['error'](_0x37e0cc);};Dialer[_0x03c4('0x1a')][_0x03c4('0xd7')]=function(_0x2daddd){return _0x2daddd==='Success';};Dialer['prototype'][_0x03c4('0xd8')]=function(_0x60ba23){return!_[_0x03c4('0x3d')](_0x60ba23)&&_0x60ba23&&!_['isUndefined'](_0x60ba23['name'])&&!_[_0x03c4('0x3d')](_0x60ba23['active'])&&_0x60ba23[_0x03c4('0xd9')]&&(this[_0x03c4('0x22')][util[_0x03c4('0x7d')]('SIP/%s',_0x60ba23[_0x03c4('0x3f')])][_0x03c4('0xaf')]===_0x03c4('0xda')||this[_0x03c4('0x22')][util[_0x03c4('0x7d')](_0x03c4('0xdb'),_0x60ba23[_0x03c4('0x3f')])][_0x03c4('0xaf')]===_0x03c4('0xdc'));};Dialer[_0x03c4('0x1a')][_0x03c4('0xcf')]=function(_0x4cb5c0,_0x195624,_0x2808fb){this[_0x03c4('0xca')](_0x4cb5c0)[_0x03c4('0xb8')](loggerCatch(_0x195624));this[_0x03c4('0xc8')](_0x4cb5c0)[_0x03c4('0xb8')](loggerCatch(_0x2808fb));};Dialer[_0x03c4('0x1a')][_0x03c4('0x38')]=function(_0x3ac7d0){var _0x48a074=this[_0x03c4('0x27')][_0x3ac7d0[_0x03c4('0xdd')]];var _0x232385;if(!_[_0x03c4('0xad')](_0x3ac7d0)&&!_[_0x03c4('0xad')](_0x3ac7d0['variable'])&&!_[_0x03c4('0xad')](_0x3ac7d0[_0x03c4('0xde')][_0x03c4('0xdf')])&&_0x3ac7d0[_0x03c4('0xe0')]===_0x03c4('0xe1')&&_0x48a074){if(_0x48a074[_0x03c4('0x4c')]!==_0x03c4('0x93')&&this[_0x03c4('0x20')][_0x48a074['queue']][_0x03c4('0xe2')]&&_0x3ac7d0[_0x03c4('0xe3')]===_0x03c4('0xe4')){delete this[_0x03c4('0x27')][_0x3ac7d0['uniqueid']];this['updateOriginated'](this[_0x03c4('0x20')][_0x48a074[_0x03c4('0xb3')]]);this[_0x03c4('0x20')][_0x48a074[_0x03c4('0xb3')]][_0x03c4('0x5f')]+=0x1;this[_0x03c4('0x20')][_0x48a074[_0x03c4('0xb3')]][_0x03c4('0x5e')]+=0x1;_0x232385=new Hangup(_0x48a074,_0x3ac7d0);_0x232385[_0x03c4('0xa7')]=0x12;_0x232385[_0x03c4('0xa8')]=_0x03c4('0xe5');_0x232385[_0x03c4('0xe6')]='AMD';ami['emit'](_0x03c4('0xe7'),ut[_0x03c4('0xe8')](_0x232385,_0x03c4('0xe9')));this[_0x03c4('0xcf')](_0x232385,'[syncHangupInAMD][createHistory]',_0x03c4('0xea'));}if(_0x48a074['type']!==_0x03c4('0x93')&&this[_0x03c4('0x20')][_0x48a074[_0x03c4('0xb3')]][_0x03c4('0xe2')]&&_0x3ac7d0['value']===_0x03c4('0xeb')){var _0x1df846=this;return new BPromise(function(_0x93d75f,_0x53b9b6){delete _0x1df846['uniqueId'][_0x3ac7d0['uniqueid']];_0x1df846[_0x03c4('0xb2')](_0x1df846[_0x03c4('0x20')][_0x48a074['queue']]);_0x1df846['voiceQueues'][_0x48a074[_0x03c4('0xb3')]][_0x03c4('0x5f')]+=0x1;_0x1df846[_0x03c4('0x20')][_0x48a074['queue']][_0x03c4('0x5e')]+=0x1;var _0x184fff=_0x1df846[_0x03c4('0x20')][_0x48a074['queue']];var _0x2cc71f=new Hangup(_0x48a074,_0x3ac7d0);_0x2cc71f[_0x03c4('0xa7')]=0x13;_0x2cc71f[_0x03c4('0xa8')]=_0x03c4('0xec');_0x2cc71f['membername']=_0x03c4('0xed');_0x2cc71f[_0x03c4('0xee')]+=0x1;_0x2cc71f[_0x03c4('0xef')]+=0x1;_0x2cc71f[_0x03c4('0xe9')]=!![];ami['emit'](_0x03c4('0xe7'),ut[_0x03c4('0xe8')](_0x2cc71f,_0x03c4('0xe9')));_0x1df846[_0x03c4('0xca')](_0x2cc71f)[_0x03c4('0xb8')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x2cc71f['countbusyretry']+_0x2cc71f[_0x03c4('0xf0')]+_0x2cc71f[_0x03c4('0xf1')]+_0x2cc71f[_0x03c4('0xf2')]+_0x2cc71f[_0x03c4('0xf3')]+_0x2cc71f[_0x03c4('0xf4')]+_0x2cc71f[_0x03c4('0xee')]+_0x2cc71f[_0x03c4('0xf5')]>=_0x184fff['dialGlobalMaxRetry']){_0x1df846['stateGlobal'](_0x2cc71f,_0x93d75f,_0x53b9b6,_0x03c4('0xf6'));}else{if(_0x2cc71f['countmachineretry']>=_0x184fff[_0x03c4('0xf7')]){_0x1df846['createStateFinal'](_0x2cc71f,_0x93d75f,_0x53b9b6,_0x03c4('0xf8'));}else{_0x1df846[_0x03c4('0xc0')]({'active':![],'countmachineretry':_0x2cc71f[_0x03c4('0xee')],'scheduledat':moment()[_0x03c4('0xf9')](_0x184fff[_0x03c4('0xfa')],_0x03c4('0xfb'))[_0x03c4('0x7d')](_0x03c4('0xfc')),'ContactId':_0x2cc71f[_0x03c4('0xd1')],'ListId':_0x2cc71f['ListId'],'VoiceQueueId':_0x2cc71f['VoiceQueueId']||undefined,'CampaignId':_0x2cc71f[_0x03c4('0xd5')]||undefined})[_0x03c4('0xb8')](loggerCatch('[rescheduleContact][Machine]'));_0x93d75f({'reschedule':0x1});}}});}if(_0x48a074['type']===_0x03c4('0x93')&&this['campaigns'][_0x48a074[_0x03c4('0xb3')]][_0x03c4('0xe2')]&&_0x3ac7d0[_0x03c4('0xe3')]===_0x03c4('0xe4')){delete this[_0x03c4('0x27')][_0x3ac7d0['uniqueid']];this[_0x03c4('0xb2')](this[_0x03c4('0x21')][_0x48a074['queue']]);_0x232385=new Hangup(_0x48a074,_0x3ac7d0);_0x232385[_0x03c4('0xa7')]=0x12;_0x232385[_0x03c4('0xa8')]=_0x03c4('0xe5');_0x232385[_0x03c4('0xe6')]=_0x03c4('0xed');ami[_0x03c4('0x4b')]('custom:amd',ut[_0x03c4('0xe8')](_0x232385,'amd'));this['saveInDb'](_0x232385,_0x03c4('0xfd'),_0x03c4('0xfe'));}if(_0x48a074[_0x03c4('0x4c')]===_0x03c4('0x93')&&this['campaigns'][_0x48a074[_0x03c4('0xb3')]][_0x03c4('0xe2')]&&_0x3ac7d0[_0x03c4('0xe3')]===_0x03c4('0xeb')){var _0x1df846=this;return new BPromise(function(_0x1ba59a,_0xa38014){delete _0x1df846[_0x03c4('0x27')][_0x3ac7d0[_0x03c4('0xdd')]];_0x1df846[_0x03c4('0xb2')](_0x1df846[_0x03c4('0x21')][_0x48a074[_0x03c4('0xb3')]]);_0x1df846['campaigns'][_0x48a074[_0x03c4('0xb3')]][_0x03c4('0x5f')]+=0x1;_0x1df846[_0x03c4('0x21')][_0x48a074[_0x03c4('0xb3')]][_0x03c4('0x5e')]+=0x1;var _0x1a8658=_0x1df846[_0x03c4('0x21')][_0x48a074[_0x03c4('0xb3')]];var _0x36c694=new Hangup(_0x48a074,_0x3ac7d0);_0x36c694['state']=0x13;_0x36c694[_0x03c4('0xa8')]='Machine';_0x36c694[_0x03c4('0xe6')]='AMD';_0x36c694[_0x03c4('0xee')]+=0x1;_0x36c694['countglobal']+=0x1;_0x36c694['amd']=!![];ami[_0x03c4('0x4b')](_0x03c4('0xe7'),ut['buildObj'](_0x36c694,'amd'));_0x1df846[_0x03c4('0xca')](_0x36c694)['catch'](loggerCatch(_0x03c4('0xff')));if(_0x36c694[_0x03c4('0x100')]+_0x36c694[_0x03c4('0xf0')]+_0x36c694['countnoanswerretry']+_0x36c694[_0x03c4('0xf2')]+_0x36c694['countdropretry']+_0x36c694['countabandonedretry']+_0x36c694[_0x03c4('0xee')]+_0x36c694[_0x03c4('0xf5')]>=_0x1a8658[_0x03c4('0x101')]){_0x1df846[_0x03c4('0x102')](_0x36c694,_0x1ba59a,_0xa38014,_0x03c4('0xf6'));}else{if(_0x36c694[_0x03c4('0xee')]>=_0x1a8658[_0x03c4('0xf7')]){_0x1df846['createStateFinal'](_0x36c694,_0x1ba59a,_0xa38014,'reason\x2019\x20machine....');}else{_0x1df846[_0x03c4('0xc0')]({'active':![],'countmachineretry':_0x36c694[_0x03c4('0xee')],'scheduledat':moment()[_0x03c4('0xf9')](_0x1a8658[_0x03c4('0xfa')],_0x03c4('0xfb'))[_0x03c4('0x7d')](_0x03c4('0xfc')),'ContactId':_0x36c694['ContactId'],'ListId':_0x36c694[_0x03c4('0xd2')],'VoiceQueueId':_0x36c694[_0x03c4('0xd4')]||undefined,'CampaignId':_0x36c694[_0x03c4('0xd5')]||undefined})[_0x03c4('0xb8')](loggerCatch('[rescheduleContact][Machine]'));_0x1ba59a({'reschedule':0x1});}}});}}};Dialer[_0x03c4('0x1a')][_0x03c4('0x35')]=function(_0x36d913){var _0x545a99=this[_0x03c4('0x27')][_0x36d913[_0x03c4('0xdd')]];var _0x38d8dd=this;var _0x1cf890;if(_0x545a99&&_0x545a99[_0x03c4('0x4c')]===_0x03c4('0x93')){delete this[_0x03c4('0x27')][_0x36d913[_0x03c4('0xdd')]];this[_0x03c4('0xb2')](this['campaigns'][_0x545a99['queue']]);this[_0x03c4('0x21')][_0x545a99[_0x03c4('0xb3')]][_0x03c4('0x103')]+=0x1;_0x1cf890=new Hangup(_0x545a99,_0x36d913);this[_0x03c4('0xca')](_0x1cf890)[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x104')));this[_0x03c4('0xc8')](_0x1cf890)['catch'](loggerCatch(_0x03c4('0x105')));}if(_0x545a99&&_0x545a99[_0x03c4('0x4c')]!==_0x03c4('0x93')&&isNotNull(this['voiceQueues'][_0x545a99[_0x03c4('0xb3')]][_0x03c4('0x106')])){delete this[_0x03c4('0x27')][_0x36d913['uniqueid']];this['updateOriginated'](this['voiceQueues'][_0x545a99[_0x03c4('0xb3')]]);this[_0x03c4('0x20')][_0x545a99[_0x03c4('0xb3')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x545a99['queue']][_0x03c4('0x5e')]+=0x1;_0x1cf890=new Hangup(_0x545a99,_0x36d913);_0x1cf890[_0x03c4('0xa7')]=0x10;_0x1cf890[_0x03c4('0xa8')]=_0x03c4('0x107');_0x1cf890[_0x03c4('0xe6')]=_0x03c4('0x108');this['createHistory'](_0x1cf890)['catch'](loggerCatch(_0x03c4('0x104')));this['moveContactManagedDialer'](_0x1cf890)['catch'](loggerCatch(_0x03c4('0x105')));}if(_0x545a99&&_0x545a99[_0x03c4('0x4c')]!==_0x03c4('0x93')&&!isNotNull(this[_0x03c4('0x20')][_0x545a99['queue']][_0x03c4('0x106')])){delete this['uniqueId'][_0x36d913['uniqueid']];this[_0x03c4('0xb2')](this['voiceQueues'][_0x545a99[_0x03c4('0xb3')]]);this[_0x03c4('0x20')][_0x545a99[_0x03c4('0xb3')]][_0x03c4('0x68')]+=0x1;_0x1cf890=new Hangup(_0x545a99,_0x36d913);_0x1cf890[_0x03c4('0xa7')]=0xc;_0x1cf890[_0x03c4('0xa8')]=_0x36d913['cause-txt'];_0x1cf890[_0x03c4('0xe6')]=_0x03c4('0x109');this[_0x03c4('0xca')](_0x1cf890)[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x104')));this['moveContactManagedDialer'](_0x1cf890)[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x105')));}};Dialer[_0x03c4('0x1a')][_0x03c4('0x10a')]=function(_0xa9b15b){var _0x4f9c1e=this[_0x03c4('0x27')][_0xa9b15b[_0x03c4('0xdd')]];var _0x7b92a4=this;if(this['voiceQueues'][_0xa9b15b[_0x03c4('0xb3')]]){if(_0x4f9c1e&&_0x4f9c1e[_0x03c4('0x4c')]!==_0x03c4('0x93')){delete this[_0x03c4('0x27')][_0xa9b15b[_0x03c4('0xdd')]];this[_0x03c4('0x20')][_0xa9b15b[_0x03c4('0xb3')]][_0x03c4('0x5f')]+=0x1;var _0x104db7=new AgentComplete(_0x4f9c1e,_0xa9b15b);if(_0xa9b15b[_0x03c4('0x10b')]===_0x03c4('0x10c')){_0x104db7[_0x03c4('0x10d')]=this[_0x03c4('0x20')][_0xa9b15b['queue']][_0x03c4('0x10e')]&&this['voiceQueues'][_0xa9b15b[_0x03c4('0xb3')]][_0x03c4('0x10f')]?moment()[_0x03c4('0x7d')](_0x03c4('0xfc')):undefined;}this[_0x03c4('0xca')](_0x104db7)[_0x03c4('0xb8')](loggerCatch('[syncAgentComplete][createHistory]'));this['moveContactManagedDialer'](_0x104db7)[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x110')));}}};Dialer[_0x03c4('0x1a')][_0x03c4('0x2c')]=function(_0x4d206e){if(this[_0x03c4('0x20')][_0x4d206e[_0x03c4('0xb3')]]){if(this[_0x03c4('0x27')][_0x4d206e[_0x03c4('0xdd')]]&&this[_0x03c4('0x27')][_0x4d206e[_0x03c4('0xdd')]]['type']!==_0x03c4('0x93')){this[_0x03c4('0xb2')](this[_0x03c4('0x20')][_0x4d206e[_0x03c4('0xb3')]]);this[_0x03c4('0x27')][_0x4d206e[_0x03c4('0xdd')]][_0x03c4('0x111')]=moment()['format'](_0x03c4('0xfc'));}}};Dialer[_0x03c4('0x1a')][_0x03c4('0x112')]=function(_0x2f6de8){this[_0x03c4('0xca')](_0x2f6de8)['catch'](loggerCatch(_0x03c4('0x113')));this['moveContactManagedDialer'](_0x2f6de8)[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x114')));};Dialer['prototype'][_0x03c4('0x2f')]=function(_0xd7374){var _0x21f507=this[_0x03c4('0x27')][_0xd7374[_0x03c4('0xdd')]];var _0x3541a1=this;if(this[_0x03c4('0x20')][_0xd7374['queue']]){if(_0x21f507&&_0x21f507[_0x03c4('0x4c')]!==_0x03c4('0x93')){delete this[_0x03c4('0x27')][_0xd7374[_0x03c4('0xdd')]];this[_0x03c4('0xb2')](this['voiceQueues'][_0xd7374['queue']]);_0x21f507[_0x03c4('0x115')]=moment()['format'](_0x03c4('0xfc'));var _0x1ab8f4=new QueueCallerAbandon(_0x21f507,_0xd7374);if(getSeconds(_0x21f507[_0x03c4('0x115')],_0x21f507[_0x03c4('0x116')])>=_0x21f507['dialQueueTimeout']){this['voiceQueues'][_0xd7374[_0x03c4('0xb3')]][_0x03c4('0x6d')]+=0x1;this['voiceQueues'][_0xd7374[_0x03c4('0xb3')]][_0x03c4('0x63')]+=0x1;this[_0x03c4('0x20')][_0xd7374[_0x03c4('0xb3')]][_0x03c4('0x6f')]+=0x1;_0x1ab8f4[_0x03c4('0xa7')]=0xa;_0x1ab8f4[_0x03c4('0xa8')]=_0x03c4('0x117');_0x1ab8f4[_0x03c4('0x118')]=_0x03c4('0x119');_0x1ab8f4[_0x03c4('0x10d')]=this[_0x03c4('0x20')][_0xd7374[_0x03c4('0xb3')]][_0x03c4('0x10e')]?moment()[_0x03c4('0x7d')](_0x03c4('0xfc')):undefined;_0x1ab8f4['countdropretry']+=0x1;_0x1ab8f4['countglobal']+=0x1;if(_0x1ab8f4['countdropretry']>=this[_0x03c4('0x20')][_0xd7374[_0x03c4('0xb3')]][_0x03c4('0x11a')]){this[_0x03c4('0x112')](_0x1ab8f4);}else{this[_0x03c4('0xc0')]({'active':![],'countdropretry':_0x1ab8f4[_0x03c4('0xf3')],'scheduledat':moment()[_0x03c4('0xf9')](this[_0x03c4('0x20')][_0xd7374[_0x03c4('0xb3')]][_0x03c4('0x11b')],_0x03c4('0xfb'))[_0x03c4('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x21f507['ContactId'],'ListId':_0x21f507[_0x03c4('0xd2')],'VoiceQueueId':_0x21f507[_0x03c4('0xd4')]||undefined,'CampaignId':_0x21f507['CampaignId']||undefined})[_0x03c4('0xb8')](loggerCatch('[rescheduleContact][Drop]'));var _0xde4d51=new History(_0x1ab8f4);_0xde4d51[_0x03c4('0xa7')]=0xa;_0xde4d51[_0x03c4('0xa8')]=_0x03c4('0x117');_0xde4d51[_0x03c4('0xaa')]=moment()[_0x03c4('0x7d')](_0x03c4('0xfc'));_0xde4d51[_0x03c4('0xa9')]=_0xde4d51[_0x03c4('0xaa')];_0xde4d51[_0x03c4('0x11c')]=_0x1ab8f4[_0x03c4('0x11c')];_0xde4d51[_0x03c4('0x11d')]=_0x1ab8f4[_0x03c4('0x11d')];this[_0x03c4('0xca')](_0xde4d51)[_0x03c4('0xb8')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0x03c4('0x20')][_0xd7374[_0x03c4('0xb3')]][_0x03c4('0x6c')]+=0x1;this[_0x03c4('0x20')][_0xd7374[_0x03c4('0xb3')]][_0x03c4('0x62')]+=0x1;_0x1ab8f4['state']=0xb;_0x1ab8f4[_0x03c4('0xa8')]=_0x03c4('0x11e');_0x1ab8f4[_0x03c4('0x118')]=_0x03c4('0x11f');_0x1ab8f4[_0x03c4('0xf4')]+=0x1;_0x1ab8f4[_0x03c4('0xef')]+=0x1;if(_0x1ab8f4['countabandonedretry']>=this['voiceQueues'][_0xd7374[_0x03c4('0xb3')]][_0x03c4('0x120')]){this[_0x03c4('0x112')](_0x1ab8f4);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x1ab8f4[_0x03c4('0xf4')],'scheduledat':moment()[_0x03c4('0xf9')](this[_0x03c4('0x20')][_0xd7374['queue']]['dialAbandonedRetryFrequency'],_0x03c4('0xfb'))['format'](_0x03c4('0xfc')),'ContactId':_0x21f507[_0x03c4('0xd1')],'ListId':_0x21f507[_0x03c4('0xd2')],'VoiceQueueId':_0x21f507[_0x03c4('0xd4')]||undefined,'CampaignId':_0x21f507[_0x03c4('0xd5')]||undefined})[_0x03c4('0xb8')](loggerCatch('[rescheduleContact][Abandoned]'));var _0xde4d51=new History(_0x1ab8f4);_0xde4d51['state']=0xb;_0xde4d51['statedesc']=_0x03c4('0x11e');_0xde4d51[_0x03c4('0xaa')]=moment()[_0x03c4('0x7d')](_0x03c4('0xfc'));_0xde4d51[_0x03c4('0xa9')]=_0xde4d51['starttime'];_0xde4d51[_0x03c4('0x11c')]=_0x1ab8f4['calleridname'];_0xde4d51['calleridnum']=_0x1ab8f4[_0x03c4('0x11d')];this['createHistory'](_0xde4d51)['catch'](loggerCatch(_0x03c4('0x121')));}}}}};Dialer[_0x03c4('0x1a')][_0x03c4('0x37')]=function(_0x2e98f4){if(this[_0x03c4('0x25')][_0x2e98f4['uniqueid']]){this[_0x03c4('0x25')][_0x2e98f4[_0x03c4('0xdd')]]['channel']=_0x2e98f4[_0x03c4('0xb0')];}if(this[_0x03c4('0x27')][_0x2e98f4[_0x03c4('0xdd')]]){this[_0x03c4('0x27')][_0x2e98f4[_0x03c4('0xdd')]][_0x03c4('0xb0')]=_0x2e98f4['channel'];}};Dialer[_0x03c4('0x1a')][_0x03c4('0x122')]=function(_0x2edebd){if(strategy[this[_0x03c4('0x20')][this[_0x03c4('0x25')][_0x2edebd[_0x03c4('0x123')]][_0x03c4('0xb3')]][_0x03c4('0x124')]]===_0x03c4('0x125')){if(this['actions'][_0x2edebd[_0x03c4('0x123')]]&&_[_0x03c4('0xad')](this['actions'][_0x2edebd[_0x03c4('0x123')]][_0x03c4('0x126')])&&_0x2edebd['status']==='1'&&_0x2edebd['paused']==='0'){if(this[_0x03c4('0x127')][_0x2edebd[_0x03c4('0x128')]]){if(!this[_0x03c4('0x127')][_0x2edebd[_0x03c4('0x128')]][_0x03c4('0x126')]){this['agents'][_0x2edebd['stateinterface']][_0x03c4('0x126')]=!![];this['actions'][_0x2edebd['actionid']]['locked']=!![];this['actions'][_0x2edebd[_0x03c4('0x123')]][_0x03c4('0x128')]=_0x2edebd[_0x03c4('0x128')];}}}}else if((strategy[this['voiceQueues'][this[_0x03c4('0x25')][_0x2edebd['actionid']]['queue']][_0x03c4('0x124')]]||_0x03c4('0x19'))===_0x03c4('0x19')){if(this['actions'][_0x2edebd[_0x03c4('0x123')]]){if(this[_0x03c4('0x127')][_0x2edebd[_0x03c4('0x128')]]){this['actions'][_0x2edebd[_0x03c4('0x123')]]['stateinterface']=_0x2edebd[_0x03c4('0x128')];if(_[_0x03c4('0xad')](this['queueBooked'][this[_0x03c4('0x25')][_0x2edebd[_0x03c4('0x123')]][_0x03c4('0xb3')]])){this[_0x03c4('0x2a')][this[_0x03c4('0x25')][_0x2edebd['actionid']][_0x03c4('0xb3')]]=[];}this[_0x03c4('0x2a')][this[_0x03c4('0x25')][_0x2edebd[_0x03c4('0x123')]]['queue']]['push'](_[_0x03c4('0x8f')](_['pick'](this['actions'][_0x2edebd[_0x03c4('0x123')]],[_0x03c4('0x129'),'stateinterface']),{'status':_0x2edebd[_0x03c4('0xaf')],'paused':_0x2edebd[_0x03c4('0x12a')]}));}}}};function unlockQueueStatus(_0x366c0b,_0xa3ca79){setTimeout(function(){if(_['isUndefined'](_0x366c0b['queueStatusComplete'])){loggerBooked['error'](_0x03c4('0x12b'),_0xa3ca79);}_0x366c0b[_0x03c4('0x12c')]=!![];loggerBooked['info'](_0x03c4('0x12d'),_0xa3ca79,JSON[_0x03c4('0x7b')](_[_0x03c4('0xd0')](_0x366c0b,[_0x03c4('0x3f'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x03c4('0x1a')][_0x03c4('0x3b')]=function(_0x517fb5){var _0x47c894=this;var _0x3eba91=_0x47c894[_0x03c4('0x20')][_0x47c894[_0x03c4('0x25')][_0x517fb5[_0x03c4('0x123')]][_0x03c4('0xb3')]];if(strategy[this[_0x03c4('0x20')][this[_0x03c4('0x25')][_0x517fb5[_0x03c4('0x123')]][_0x03c4('0xb3')]][_0x03c4('0x124')]]===_0x03c4('0x125')){if(this[_0x03c4('0x25')][_0x517fb5['actionid']]&&this[_0x03c4('0x25')][_0x517fb5[_0x03c4('0x123')]]['stateinterface']){this[_0x03c4('0x1f')][_0x03c4('0x12e')](this[_0x03c4('0x25')][_0x517fb5['actionid']][_0x03c4('0x129')],this[_0x03c4('0x25')][_0x517fb5[_0x03c4('0x123')]][_0x03c4('0x128')])[_0x03c4('0xb8')](function(_0x4f0d83){logger[_0x03c4('0x97')](_0x03c4('0x12f'),util[_0x03c4('0x98')](_0x4f0d83,{'showHidden':![],'depth':null}));})[_0x03c4('0x1d')](function(){_0x47c894[_0x03c4('0xb2')](_0x47c894[_0x03c4('0x20')][_0x47c894['actions'][_0x517fb5[_0x03c4('0x123')]][_0x03c4('0xb3')]]);_0x47c894[_0x03c4('0x127')][_0x47c894[_0x03c4('0x25')][_0x517fb5[_0x03c4('0x123')]][_0x03c4('0x128')]][_0x03c4('0x126')]=![];delete _0x47c894[_0x03c4('0x25')][_0x517fb5[_0x03c4('0x123')]];unlockQueueStatus(_0x3eba91);});}else{this[_0x03c4('0xb2')](this['voiceQueues'][this[_0x03c4('0x25')][_0x517fb5[_0x03c4('0x123')]][_0x03c4('0xb3')]]);this[_0x03c4('0xc0')]({'active':![],'ContactId':this['actions'][_0x517fb5[_0x03c4('0x123')]][_0x03c4('0xd1')],'ListId':this[_0x03c4('0x25')][_0x517fb5[_0x03c4('0x123')]][_0x03c4('0xd2')],'VoiceQueueId':this[_0x03c4('0x25')][_0x517fb5[_0x03c4('0x123')]][_0x03c4('0xd4')]||undefined,'CampaignId':this[_0x03c4('0x25')][_0x517fb5[_0x03c4('0x123')]][_0x03c4('0xd5')]||undefined})[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x130')));delete this['actions'][_0x517fb5[_0x03c4('0x123')]];unlockQueueStatus(_0x3eba91);}}else if((strategy[this[_0x03c4('0x20')][this[_0x03c4('0x25')][_0x517fb5['actionid']]['queue']][_0x03c4('0x124')]]||_0x03c4('0x19'))===_0x03c4('0x19')){var _0x26af2a;if(this[_0x03c4('0x25')][_0x517fb5[_0x03c4('0x123')]]&&!_[_0x03c4('0x45')](this[_0x03c4('0x2a')][this[_0x03c4('0x25')][_0x517fb5[_0x03c4('0x123')]][_0x03c4('0xb3')]])){if(this[_0x03c4('0x131')][_0x47c894[_0x03c4('0x25')][_0x517fb5['actionid']][_0x03c4('0xb3')]]){this['queueBookedRR'][_0x47c894[_0x03c4('0x25')][_0x517fb5[_0x03c4('0x123')]][_0x03c4('0xb3')]]=this[_0x03c4('0x131')][this[_0x03c4('0x25')][_0x517fb5[_0x03c4('0x123')]][_0x03c4('0xb3')]]?this[_0x03c4('0x131')][this[_0x03c4('0x25')][_0x517fb5[_0x03c4('0x123')]]['queue']]:this[_0x03c4('0x2a')][this[_0x03c4('0x25')][_0x517fb5[_0x03c4('0x123')]][_0x03c4('0xb3')]]?this[_0x03c4('0x2a')][this[_0x03c4('0x25')][_0x517fb5[_0x03c4('0x123')]][_0x03c4('0xb3')]][_0x03c4('0x132')]||0x0:0x0;}this[_0x03c4('0x2a')][this[_0x03c4('0x25')][_0x517fb5['actionid']][_0x03c4('0xb3')]][_0x03c4('0x132')]=this[_0x03c4('0x131')][this[_0x03c4('0x25')][_0x517fb5[_0x03c4('0x123')]][_0x03c4('0xb3')]];for(var _0xdca335=0x0;_0xdca335=0x0;})['catch'](myreject(_0x17c87e)));}}else{_0x4e3869[_0x03c4('0x150')](ami[_0x03c4('0xae')]({'action':_0x03c4('0x151'),'command':util['format'](_0x03c4('0x14b'),_0xbfc9c0,!_['isUndefined'](config[_0x03c4('0x14d')][_0x558f54])?_0x558f54:'')})['then'](function(_0x2d1df6){return _0x2d1df6[_0x03c4('0x152')]['indexOf']('true')>=0x0;})[_0x03c4('0xb8')](myreject(_0x17c87e)));}BPromise['all'](_0x4e3869)[_0x03c4('0xb7')](function(_0x1c306e){var _0x2081e3=_[_0x03c4('0x153')](_0x1c306e);if(_0x2081e3){return _0x585ae9(_0x2081e3);}else{_0x5dae3d[_0x03c4('0x3e')]=_0x32b7a5?_0x03c4('0x154'):'INTERVAL_IS_OVERTIME';return _0x17c87e(msgResponse(_0x03c4('0x155'),'Failure',_0x03c4('0x156')+_0x32b7a5+'\x20'+_0x5488e9+_0x03c4('0x157')+util[_0x03c4('0x98')](_0xbfc9c0,{'showHidden':![],'depth':null})+_0x03c4('0x158')+_0x558f54));}})[_0x03c4('0xb8')](function(_0x202575){return _0x17c87e(msgResponse(_0x03c4('0x145'),_0x03c4('0x146'),JSON['stringify'](_0x202575)));});});};Dialer['prototype']['checkDialMethod']=function(_0x38e0eb){var _0x440882=this;return function(){switch(_0x38e0eb['dialMethod']){case'progressive':freeVariablesPredictive(_0x38e0eb);_0x440882['handlePower'](_0x38e0eb,0x1);break;case _0x03c4('0x159'):freeVariablesPredictive(_0x38e0eb);_0x440882['handlePower'](_0x38e0eb,_0x38e0eb[_0x03c4('0x15a')]);break;case _0x03c4('0xa'):_0x440882['predictive'](_0x38e0eb);break;case _0x03c4('0x9'):freeVariablesPredictive(_0x38e0eb);_0x440882[_0x03c4('0x15b')](_0x38e0eb,0x1);break;default:freeVariablesPredictive(_0x38e0eb);logger['error'](_0x03c4('0x15c'),_0x38e0eb['name'],_0x03c4('0x15d'));}};};Dialer[_0x03c4('0x1a')]['launchHandleIvr']=function(_0x2de6f1){var _0x22c634=this;return function(){_0x22c634[_0x03c4('0x15e')](_0x2de6f1);};};Dialer[_0x03c4('0x1a')][_0x03c4('0x15f')]=function(_0x1f70a8){var _0x5a1175=this;if(isNotPreview(_0x1f70a8[_0x03c4('0x5a')])){if(isVoiceQueueOutbound(_0x1f70a8[_0x03c4('0x4c')])&&isActive(_0x1f70a8[_0x03c4('0x160')])){_0x1f70a8[_0x03c4('0xa1')]=!![];BPromise[_0x03c4('0xb9')]()['then'](checkIsLoggedIn(_0x1f70a8,_0x1f70a8[_0x03c4('0x50')]))[_0x03c4('0xb7')](checkIsActive(_0x1f70a8,_0x1f70a8['dialActive']))[_0x03c4('0xb7')](checkInterval(_0x1f70a8))[_0x03c4('0xb7')](_0x5a1175[_0x03c4('0x161')](_0x1f70a8))['then'](_0x5a1175['checkIfTime'](_0x1f70a8[_0x03c4('0x162')],_0x1f70a8[_0x03c4('0x163')],_0x1f70a8[_0x03c4('0x3f')],_0x1f70a8))[_0x03c4('0xb7')](_0x5a1175[_0x03c4('0x144')](_0x1f70a8[_0x03c4('0x42')],_0x1f70a8[_0x03c4('0x163')],_0x1f70a8['name'],_0x1f70a8))[_0x03c4('0xb7')](_0x5a1175[_0x03c4('0x164')](_0x1f70a8))[_0x03c4('0xb8')](loggerCatchQueueSummary(_0x03c4('0x165'),_0x1f70a8));}else{notSendMessagesQueue(_0x1f70a8);}}else{freeVariablesPredictive(_0x1f70a8);}};Dialer['prototype'][_0x03c4('0x13f')]=function(){var _0x1e7c11=this;var _0x1abf70;for(var _0x1b2c00 in this[_0x03c4('0x21')]){if(typeof this['campaigns'][_0x1b2c00]!=='undefined'){_0x1abf70=this[_0x03c4('0x21')][_0x1b2c00];if(isCampaignIvr(_0x1abf70[_0x03c4('0x4c')])&&isActive(_0x1abf70[_0x03c4('0xd9')])){_0x1abf70[_0x03c4('0xa1')]=!![];BPromise['resolve']()[_0x03c4('0xb7')](checkIsActive(_0x1abf70,_0x1abf70[_0x03c4('0xd9')]))[_0x03c4('0xb7')](checkInterval(_0x1abf70))[_0x03c4('0xb7')](_0x1e7c11[_0x03c4('0x161')](_0x1abf70))[_0x03c4('0xb7')](_0x1e7c11[_0x03c4('0x143')](_0x1abf70[_0x03c4('0x162')],_0x1abf70[_0x03c4('0x163')],_0x1abf70['name'],_0x1abf70))[_0x03c4('0xb7')](_0x1e7c11[_0x03c4('0x144')](_0x1abf70[_0x03c4('0x42')],_0x1abf70[_0x03c4('0x163')],_0x1abf70['name'],_0x1abf70))['then'](_0x1e7c11[_0x03c4('0x166')](_0x1abf70))['catch'](loggerCatchQueueSummary('[syncCampaigns]',_0x1abf70));}else{notSendMessagesCampaign(_0x1abf70);}}}};function getCallerIdRandom(_0x1cf91d,_0x5cb56e){var _0x1c5037;var _0x5db48d;var _0x2a4c38;if(_0x5cb56e<=0x0){_0x5cb56e=0x1;}_0x1c5037=new RegExp(_0x03c4('0x167')+_0x5cb56e+'}$');_0x5db48d=Math[_0x03c4('0x168')](0xa,_0x5cb56e-0x1);_0x2a4c38=Math['pow'](0xa,_0x5cb56e)-0x1;return util['format']('%s',_[_0x03c4('0x169')](_0x1cf91d,_0x1c5037,_[_0x03c4('0x16a')](_0x5db48d,_0x2a4c38)));}function extractCalleridName(_0x2fe859){var _0x1c1258=_0x2fe859[_0x03c4('0x16b')](/"(.*?)"/);return _0x1c1258?_0x1c1258[0x1]:_0x2fe859;}function extractCalleridNumber(_0x7804c){var _0x29bfdc=_0x7804c[_0x03c4('0x16b')](/<(.*?)>/);return _0x29bfdc?_0x29bfdc[0x1]:_0x7804c;}Dialer['prototype'][_0x03c4('0x16c')]=function(_0xc23a4e,_0x5748c7){var _0x329d3c=this;var _0x214e9e=uuid['v4']();this[_0x03c4('0x25')][_0x214e9e]=new Action(_0xc23a4e,_0x5748c7,_0x214e9e);return new BPromise(function(_0x12ebbf,_0x650b46){if(_[_0x03c4('0x3d')](_0xc23a4e)&&typeof _0xc23a4e!=='object'){return _0x650b46(msgResponse(_0x03c4('0x16d'),'Failure',_0x03c4('0x16e')));}if(_[_0x03c4('0x3d')](_0x5748c7[_0x03c4('0x16f')][_0x03c4('0x170')])||_0x5748c7[_0x03c4('0x16f')][_0x03c4('0x170')]===null){return _0x650b46(msgResponse(_0x03c4('0x16d'),_0x03c4('0x146'),_0x03c4('0x171')));}var _0x32db58={'XMD-CALLERID':_0x329d3c[_0x03c4('0x25')][_0x214e9e][_0x03c4('0x172')](),'XMD-AGI':_0xc23a4e[_0x03c4('0x106')]?util['format'](_0x03c4('0x173'),ipAgi,_0xc23a4e[_0x03c4('0x106')]):'NONE','XMD-AGIAFTER':_0xc23a4e[_0x03c4('0x10e')]?util[_0x03c4('0x7d')](_0x03c4('0x173'),ipAgi,_0xc23a4e[_0x03c4('0x10e')]):_0x03c4('0x174'),'XMD-QUEUE':_0xc23a4e[_0x03c4('0x4c')]===_0x03c4('0x4d')?util[_0x03c4('0x7d')](_0x03c4('0x175'),_0xc23a4e['name'],_0xc23a4e[_0x03c4('0x176')]||'',_0xc23a4e['dialAgiAfterHangupAgent']?'c':'',_0xc23a4e[_0x03c4('0x177')]||0x3):_0x03c4('0x174'),'XMD-CONTACTID':_0x5748c7[_0x03c4('0xd1')],'XMD-CDRTYPE':_0x03c4('0x178'),'CALLERID(all)':_0x329d3c[_0x03c4('0x25')][_0x214e9e]['getCaller'](),'XMD-AMD':_0xc23a4e[_0x03c4('0xe2')]?_0x03c4('0x179'):_0x03c4('0x174'),'XMD-DESTINATION':_0x03c4('0xe1')};if(_0xc23a4e[_0x03c4('0xe2')]){_0x32db58[_0x03c4('0x17a')]=_0xc23a4e[_0x03c4('0x17b')]||0x9c4;_0x32db58['XMD-AMDGREETING']=_0xc23a4e[_0x03c4('0x17c')]||0x5dc;_0x32db58[_0x03c4('0x17d')]=_0xc23a4e[_0x03c4('0x17e')]||0x320;_0x32db58[_0x03c4('0x17f')]=_0xc23a4e['dialAMDTotalAnalysisTime']||0x1388;_0x32db58[_0x03c4('0x180')]=_0xc23a4e[_0x03c4('0x181')]||0x64;_0x32db58[_0x03c4('0x182')]=_0xc23a4e[_0x03c4('0x183')]||0x32;_0x32db58[_0x03c4('0x184')]=_0xc23a4e[_0x03c4('0x185')]||0x3;_0x32db58[_0x03c4('0x186')]=_0xc23a4e['dialAMDSilenceThreshold']||0x100;_0x32db58[_0x03c4('0x187')]=_0xc23a4e[_0x03c4('0x188')]||0x1388;}if(_0xc23a4e[_0x03c4('0x4c')]===_0x03c4('0x4d')){_0x32db58[_0x03c4('0x189')]=_0x5748c7[_0x03c4('0xd4')];}else{_0x32db58['XMD-CAMPAIGNID']=_0x5748c7[_0x03c4('0xd5')];}for(var _0x4e5324 in _0x5748c7[_0x03c4('0x16f')]){if(typeof _0x5748c7['Contact'][_0x4e5324]!=='undefined'){if(isNotNull(_0x5748c7[_0x03c4('0x16f')][_0x4e5324])&&_0x4e5324!=='id'&&_0x4e5324!==_0x03c4('0x18a')&&_0x4e5324!==_0x03c4('0x18b')&&_0x4e5324!==_0x03c4('0x18c')){_0x32db58[util[_0x03c4('0x7d')](_0x03c4('0x18d'),_0x03c4('0x18e'),_[_0x03c4('0x18f')](_0x4e5324))]=_0x5748c7['Contact'][_0x4e5324];}}}var _0x251ac4=_0x329d3c[_0x03c4('0xd8')](_0xc23a4e['Trunk'])?getCallerId(_0xc23a4e['Trunk'][_0x03c4('0x7a')],_0xc23a4e['dialOriginateCallerIdName'],_0xc23a4e[_0x03c4('0x190')]>0x0?getCallerIdRandom(_0xc23a4e['dialOriginateCallerIdNumber'],_0xc23a4e[_0x03c4('0x190')]):_0xc23a4e['dialOriginateCallerIdNumber']):getCallerId(_[_0x03c4('0xad')](_0xc23a4e['TrunkBackup'])?_0xc23a4e[_0x03c4('0x79')][_0x03c4('0x7a')]:_0xc23a4e['TrunkBackup']['callerid'],_0xc23a4e['dialOriginateCallerIdName'],_0xc23a4e[_0x03c4('0x190')]>0x0?getCallerIdRandom(_0xc23a4e[_0x03c4('0x5b')],_0xc23a4e['dialRandomLastDigitCallerIdNumber']):_0xc23a4e[_0x03c4('0x5b')]);if(_0x251ac4){_0x32db58[_0x03c4('0x191')]=_0x329d3c['actions'][_0x214e9e][_0x03c4('0x192')]=extractCalleridName(_0x251ac4);_0x32db58[_0x03c4('0x193')]=_0x329d3c['actions'][_0x214e9e]['originatecalleridnum']=extractCalleridNumber(_0x251ac4);}return ami[_0x03c4('0xae')]({'actionid':_0x214e9e,'action':_0x03c4('0x16d'),'channel':_0x329d3c[_0x03c4('0xd8')](_0xc23a4e[_0x03c4('0x79')])?util[_0x03c4('0x7d')](_0x03c4('0x194'),_0xc23a4e[_0x03c4('0x79')][_0x03c4('0x3f')],isNotNull(_0xc23a4e[_0x03c4('0x5d')])?_0xc23a4e['dialPrefix'][_0x03c4('0x195')]()||'':'',_0xc23a4e[_0x03c4('0x196')]>0x0?_0x5748c7[_0x03c4('0x16f')][_0x03c4('0x170')][_0x03c4('0x197')](_0xc23a4e[_0x03c4('0x196')]):_0x5748c7['Contact']['phone']):util[_0x03c4('0x7d')](_0x03c4('0x194'),_[_0x03c4('0xad')](_0xc23a4e[_0x03c4('0x140')])?_0xc23a4e['Trunk'][_0x03c4('0x3f')]:_0xc23a4e[_0x03c4('0x140')][_0x03c4('0x3f')],isNotNull(_0xc23a4e[_0x03c4('0x5d')])?_0xc23a4e[_0x03c4('0x5d')][_0x03c4('0x195')]()||'':'',_0xc23a4e['dialCutDigit']>0x0?_0x5748c7[_0x03c4('0x16f')][_0x03c4('0x170')][_0x03c4('0x197')](_0xc23a4e[_0x03c4('0x196')]):_0x5748c7[_0x03c4('0x16f')]['phone']),'callerid':_0x251ac4,'Exten':'xcally-motion-dialer','Context':_0x03c4('0x198'),'Priority':'1','variable':_0x32db58,'timeout':(_0xc23a4e[_0x03c4('0x5c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x214e9e})[_0x03c4('0xb7')](function(_0x2c4da9){return _0x12ebbf(_0x2c4da9);})[_0x03c4('0xb8')](function(_0x344b76){_0xc23a4e[_0x03c4('0x199')]+=0x1;var _0x5c526e=new History(_0x329d3c[_0x03c4('0x25')][_0x214e9e]);logger['error'](util[_0x03c4('0x7d')](_0x03c4('0x19a'),JSON[_0x03c4('0x7b')](_0x344b76)));_0x5c526e[_0x03c4('0xa7')]=0xe;_0x5c526e[_0x03c4('0xa8')]=_0x03c4('0x19b');_0x5c526e['starttime']=moment()[_0x03c4('0x7d')](_0x03c4('0xfc'));_0x5c526e[_0x03c4('0xa9')]=_0x5c526e[_0x03c4('0xaa')];_0x329d3c[_0x03c4('0xca')](_0x5c526e)['catch'](loggerCatch(_0x03c4('0x19c')));_0x329d3c[_0x03c4('0xc8')](_0x5c526e)[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x19c')))[_0x03c4('0x1d')](function(){delete _0x329d3c[_0x03c4('0x25')][_0x214e9e];return _0x650b46(msgResponse(_0x03c4('0x16d'),_0x03c4('0x48'),_0x03c4('0x19d')));});});});};Dialer['prototype'][_0x03c4('0x31')]=function(_0x3728cb){var _0x1cf0d7=this['actions'][_0x3728cb[_0x03c4('0x123')]];if(_0x1cf0d7){delete this[_0x03c4('0x25')][_0x3728cb[_0x03c4('0x123')]];_0x1cf0d7[_0x03c4('0x116')]=moment()[_0x03c4('0x7d')](_0x03c4('0xfc'));var _0xdaa1d7=_0x1cf0d7['type']===_0x03c4('0x93')?this[_0x03c4('0x21')][_0x1cf0d7[_0x03c4('0xb3')]]:this[_0x03c4('0x20')][_0x1cf0d7[_0x03c4('0x19e')]()];if(!this[_0x03c4('0xd7')](_0x3728cb['response'])){this['updateOriginated'](_0xdaa1d7);return this['callProgressDetecting'](_0x1cf0d7,_0xdaa1d7,_0x3728cb)['catch'](loggerCatch(_0x03c4('0x19f')));}this[_0x03c4('0x27')][_0x3728cb[_0x03c4('0xdd')]]=_0x1cf0d7;}};Dialer[_0x03c4('0x1a')][_0x03c4('0x1a0')]=function(_0x5a5248,_0x3a5584,_0x249b23){var _0x36cf4a=new History(_0x3a5584);if(_0x36cf4a[_0x03c4('0x100')]+_0x36cf4a[_0x03c4('0xf0')]+_0x36cf4a['countnoanswerretry']+_0x36cf4a[_0x03c4('0xf2')]+_0x36cf4a[_0x03c4('0xf3')]+_0x36cf4a['countabandonedretry']+_0x36cf4a['countmachineretry']+_0x36cf4a[_0x03c4('0xf5')]>=_0x249b23['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x5a5248){case 0x3:if(_0x36cf4a['countnoanswerretry']>=_0x249b23['dialNoAnswerMaxRetry']-0x1){return!![];}this[_0x03c4('0xc0')]({'active':![],'countnoanswerretry':_0x36cf4a[_0x03c4('0xf1')]+=0x1,'scheduledat':moment()[_0x03c4('0xf9')](_0x249b23[_0x03c4('0x1a1')],_0x03c4('0xfb'))['format'](_0x03c4('0xfc')),'ContactId':_0x36cf4a[_0x03c4('0xd1')],'ListId':_0x36cf4a[_0x03c4('0xd2')],'VoiceQueueId':_0x36cf4a[_0x03c4('0xd4')]||undefined,'CampaignId':_0x36cf4a[_0x03c4('0xd5')]||undefined})['catch'](loggerCatch(_0x03c4('0x1a2')));break;case 0x5:if(_0x36cf4a[_0x03c4('0x100')]>=_0x249b23[_0x03c4('0x1a3')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x36cf4a['countbusyretry']+=0x1,'scheduledat':moment()[_0x03c4('0xf9')](_0x249b23['dialBusyRetryFrequency'],_0x03c4('0xfb'))[_0x03c4('0x7d')](_0x03c4('0xfc')),'ContactId':_0x36cf4a['ContactId'],'ListId':_0x36cf4a[_0x03c4('0xd2')],'VoiceQueueId':_0x36cf4a['VoiceQueueId']||undefined,'CampaignId':_0x36cf4a[_0x03c4('0xd5')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x36cf4a[_0x03c4('0xf0')]>=_0x249b23['dialCongestionMaxRetry']-0x1){return!![];}this[_0x03c4('0xc0')]({'active':![],'countcongestionretry':_0x36cf4a[_0x03c4('0xf0')]+=0x1,'scheduledat':moment()[_0x03c4('0xf9')](_0x249b23[_0x03c4('0x1a4')],_0x03c4('0xfb'))['format'](_0x03c4('0xfc')),'ContactId':_0x36cf4a[_0x03c4('0xd1')],'ListId':_0x36cf4a[_0x03c4('0xd2')],'VoiceQueueId':_0x36cf4a[_0x03c4('0xd4')]||undefined,'CampaignId':_0x36cf4a[_0x03c4('0xd5')]||undefined})[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x1a5')));break;case 0x0:if(_0x36cf4a[_0x03c4('0xf2')]>=_0x249b23[_0x03c4('0x1a6')]-0x1){return!![];}else{this[_0x03c4('0xc0')]({'active':![],'countnosuchnumberretry':_0x36cf4a[_0x03c4('0xf2')]+=0x1,'scheduledat':moment()[_0x03c4('0xf9')](_0x249b23[_0x03c4('0x1a7')],_0x03c4('0xfb'))[_0x03c4('0x7d')](_0x03c4('0xfc')),'ContactId':_0x36cf4a[_0x03c4('0xd1')],'ListId':_0x36cf4a[_0x03c4('0xd2')],'VoiceQueueId':_0x36cf4a[_0x03c4('0xd4')]||undefined,'CampaignId':_0x36cf4a[_0x03c4('0xd5')]||undefined})[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x1a8')));}break;case 0xa:if(_0x36cf4a[_0x03c4('0xf3')]>=_0x249b23[_0x03c4('0x11a')]-0x1){return!![];}this[_0x03c4('0xc0')]({'active':![],'countdropretry':_0x36cf4a[_0x03c4('0xf3')]+=0x1,'scheduledat':moment()[_0x03c4('0xf9')](_0x249b23[_0x03c4('0x11b')],_0x03c4('0xfb'))[_0x03c4('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x36cf4a[_0x03c4('0xd1')],'ListId':_0x36cf4a[_0x03c4('0xd2')],'VoiceQueueId':_0x36cf4a[_0x03c4('0xd4')]||undefined,'CampaignId':_0x36cf4a['CampaignId']||undefined})[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x1a9')));break;case 0xb:if(_0x36cf4a[_0x03c4('0xf4')]>=_0x249b23[_0x03c4('0x120')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x36cf4a[_0x03c4('0xf4')]+=0x1,'scheduledat':moment()[_0x03c4('0xf9')](_0x249b23['dialAbandonedRetryFrequency'],'minutes')[_0x03c4('0x7d')](_0x03c4('0xfc')),'ContactId':_0x36cf4a[_0x03c4('0xd1')],'ListId':_0x36cf4a[_0x03c4('0xd2')],'VoiceQueueId':_0x36cf4a[_0x03c4('0xd4')]||undefined,'CampaignId':_0x36cf4a[_0x03c4('0xd5')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x36cf4a[_0x03c4('0xee')]>=_0x249b23[_0x03c4('0xf7')]-0x1){return!![];}this[_0x03c4('0xc0')]({'active':![],'countmachineretry':_0x36cf4a['countmachineretry']+=0x1,'scheduledat':moment()[_0x03c4('0xf9')](_0x249b23[_0x03c4('0xfa')],'minutes')[_0x03c4('0x7d')](_0x03c4('0xfc')),'ContactId':_0x36cf4a[_0x03c4('0xd1')],'ListId':_0x36cf4a['ListId'],'VoiceQueueId':_0x36cf4a[_0x03c4('0xd4')]||undefined,'CampaignId':_0x36cf4a[_0x03c4('0xd5')]||undefined})[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x1aa')));break;case 0x14:if(_0x36cf4a[_0x03c4('0xf5')]>=_0x249b23[_0x03c4('0x1ab')]-0x1){return!![];}this[_0x03c4('0xc0')]({'active':![],'countagentrejectretry':_0x36cf4a[_0x03c4('0xf5')]+=0x1,'scheduledat':moment()[_0x03c4('0xf9')](_0x249b23[_0x03c4('0x1ac')],_0x03c4('0xfb'))[_0x03c4('0x7d')](_0x03c4('0xfc')),'ContactId':_0x36cf4a['ContactId'],'ListId':_0x36cf4a[_0x03c4('0xd2')],'VoiceQueueId':_0x36cf4a[_0x03c4('0xd4')]||undefined,'CampaignId':_0x36cf4a['CampaignId']||undefined})[_0x03c4('0xb8')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer['prototype'][_0x03c4('0x1ad')]=function(_0x351502,_0xf3f7e6,_0x49bf7a){var _0x405b6a=this;var _0x554492=new History(_0x351502);return new BPromise(function(_0x8124c2,_0xa81d82){if(_[_0x03c4('0x3d')](_0xf3f7e6)&&typeof _0xf3f7e6!==_0x03c4('0x1ae')){return _0xa81d82(msgResponse(_0x03c4('0x1af'),_0x03c4('0x146'),_0x03c4('0x1b0')));}if(_[_0x03c4('0x3d')](_0x49bf7a)&&typeof _0x49bf7a!==_0x03c4('0x1ae')){return _0xa81d82(msgResponse('[callProgressDetecting]',_0x03c4('0x146'),_0x03c4('0x1b1')));}switch(_0x49bf7a[_0x03c4('0x10b')]){case'0':_0xf3f7e6['outboundNoSuchCallsDay']+=0x1;_0x554492[_0x03c4('0xa7')]=0x0;_0x554492[_0x03c4('0xa8')]=_0x03c4('0x1b2');_0x554492[_0x03c4('0xf2')]+=0x1;_0x554492['countglobal']+=0x1;ami[_0x03c4('0x4b')](_0x03c4('0x1b3'),ut[_0x03c4('0xe8')](_0x351502,_0x03c4('0x1b4')));_0x405b6a[_0x03c4('0xca')](_0x554492)[_0x03c4('0xb8')](loggerCatch(_0x03c4('0xff')));if(_0x405b6a[_0x03c4('0x1a0')](0x0,_0x351502,_0xf3f7e6)){if(_0x554492[_0x03c4('0xf2')]>=_0xf3f7e6[_0x03c4('0x1a6')]){_0x405b6a[_0x03c4('0x1b5')](_0x554492,_0x8124c2,_0xa81d82,_0x03c4('0x1b6'));}else{_0x405b6a[_0x03c4('0x102')](_0x554492,_0x8124c2,_0xa81d82,_0x03c4('0x1b6'));}}break;case'3':_0xf3f7e6[_0x03c4('0x64')]+=0x1;_0x554492[_0x03c4('0xa7')]=0x3;_0x554492[_0x03c4('0xa8')]=_0x03c4('0x1b7');_0x554492[_0x03c4('0xf1')]+=0x1;_0x554492[_0x03c4('0xef')]+=0x1;ami[_0x03c4('0x4b')](_0x03c4('0x1b8'),ut['buildObj'](_0x351502,'noanswer'));_0x405b6a['createHistory'](_0x554492)[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x1b9')));if(_0x405b6a[_0x03c4('0x1a0')](0x3,_0x351502,_0xf3f7e6)){if(_0x554492[_0x03c4('0xf1')]>=_0xf3f7e6[_0x03c4('0x1ba')]){_0x405b6a[_0x03c4('0x1b5')](_0x554492,_0x8124c2,_0xa81d82,_0x03c4('0x1bb'));}else{_0x405b6a[_0x03c4('0x102')](_0x554492,_0x8124c2,_0xa81d82,_0x03c4('0x1bb'));}}break;case'5':_0xf3f7e6['outboundBusyCallsDay']+=0x1;_0x554492[_0x03c4('0xa7')]=0x5;_0x554492[_0x03c4('0xa8')]='Busy';_0x554492['countbusyretry']+=0x1;_0x554492[_0x03c4('0xef')]+=0x1;ami[_0x03c4('0x4b')]('custom:agentbusy',ut[_0x03c4('0xe8')](_0x351502,_0x03c4('0x1bc')));_0x405b6a[_0x03c4('0xca')](_0x554492)[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x1bd')));if(_0x405b6a[_0x03c4('0x1a0')](0x5,_0x351502,_0xf3f7e6)){if(_0x554492[_0x03c4('0x100')]>=_0xf3f7e6['dialBusyMaxRetry']){_0x405b6a['createStateFinal'](_0x554492,_0x8124c2,_0xa81d82,'reason\x205\x20busy');}else{_0x405b6a[_0x03c4('0x102')](_0x554492,_0x8124c2,_0xa81d82,'reason\x205\x20busy');}}break;case'8':_0xf3f7e6[_0x03c4('0x61')]+=0x1;_0x554492[_0x03c4('0xa7')]=0x8;_0x554492[_0x03c4('0xa8')]=_0x03c4('0x1be');_0x554492[_0x03c4('0xf0')]+=0x1;_0x554492[_0x03c4('0xef')]+=0x1;ami[_0x03c4('0x4b')](_0x03c4('0x1bf'),ut[_0x03c4('0xe8')](_0x351502,_0x03c4('0x1c0')));_0x405b6a['createHistory'](_0x554492)[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x1c1')));if(_0x405b6a[_0x03c4('0x1a0')](0x8,_0x351502,_0xf3f7e6)){if(_0x554492['countcongestionretry']>=_0xf3f7e6[_0x03c4('0x1c2')]){_0x405b6a['createStateFinal'](_0x554492,_0x8124c2,_0xa81d82,'reason\x208\x20congestion');}else{_0x405b6a[_0x03c4('0x102')](_0x554492,_0x8124c2,_0xa81d82,_0x03c4('0x1c3'));}}break;case'11':_0xf3f7e6[_0x03c4('0x1c4')]+=0x1;_0x554492[_0x03c4('0xa7')]=0xb;_0x554492['statedesc']='Abandoned';_0x554492[_0x03c4('0xf4')]+=0x1;_0x554492['countglobal']+=0x1;_0x405b6a['createHistory'](_0x554492)[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x121')));if(_0x405b6a[_0x03c4('0x1a0')](0xb,_0x351502,_0xf3f7e6)){if(_0x554492[_0x03c4('0xf4')]>=_0xf3f7e6[_0x03c4('0x120')]){_0x405b6a[_0x03c4('0x1b5')](_0x554492,_0x8124c2,_0xa81d82,_0x03c4('0x1c5'));}else{_0x405b6a['stateGlobal'](_0x554492,_0x8124c2,_0xa81d82,_0x03c4('0x1c5'));}}break;case'20':_0xf3f7e6['outboundRejectCallsDay']+=0x1;_0x554492[_0x03c4('0xa7')]=0x14;_0x554492[_0x03c4('0xa8')]='AgentReject';_0x554492[_0x03c4('0xf5')]+=0x1;_0x554492[_0x03c4('0xef')]+=0x1;ami[_0x03c4('0x4b')](_0x03c4('0x1c6'),ut[_0x03c4('0xe8')](_0x351502,'agentreject'));_0x405b6a[_0x03c4('0xca')](_0x554492)['catch'](loggerCatch(_0x03c4('0x1c7')));if(_0x405b6a[_0x03c4('0x1a0')](0x14,_0x351502,_0xf3f7e6)){if(_0x554492[_0x03c4('0xf5')]>=_0xf3f7e6[_0x03c4('0x1ab')]){_0x405b6a[_0x03c4('0x1b5')](_0x554492,_0x8124c2,_0xa81d82,_0x03c4('0x1c8'));}else{_0x405b6a[_0x03c4('0x102')](_0x554492,_0x8124c2,_0xa81d82,_0x03c4('0x1c8'));}}break;default:_0xf3f7e6['outboundUnknownCallsDay']+=0x1;_0x554492[_0x03c4('0xa7')]=0xc;_0x554492[_0x03c4('0xa8')]=_0x49bf7a[_0x03c4('0x10b')];_0x405b6a['createHistory'](_0x554492)[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x1c9')));if(_0x405b6a[_0x03c4('0x1a0')](_0x49bf7a[_0x03c4('0x10b')],_0x351502,_0xf3f7e6)){if(_0x554492[_0x03c4('0x100')]+_0x554492[_0x03c4('0xf0')]+_0x554492[_0x03c4('0xf1')]+_0x554492['countnosuchnumberretry']+_0x554492[_0x03c4('0xf3')]+_0x554492['countabandonedretry']+_0x554492[_0x03c4('0xee')]+_0x554492['countagentrejectretry']>=_0xf3f7e6['dialGlobalMaxRetry']){_0x405b6a[_0x03c4('0x102')](_0x554492,_0x8124c2,_0xa81d82,_0x49bf7a[_0x03c4('0x10b')]);}else{_0x405b6a[_0x03c4('0x1b5')](_0x554492,_0x8124c2,_0xa81d82,_0x49bf7a[_0x03c4('0x10b')]);}}}});};Dialer[_0x03c4('0x1a')][_0x03c4('0x102')]=function(_0x485ed9,_0x521d20,_0x364582,_0xa6f84c){var _0x23822c=new Final(_0x485ed9);_0x23822c[_0x03c4('0xa7')]=0xf;_0x23822c[_0x03c4('0xa8')]=_0x03c4('0x1ca');this[_0x03c4('0x1b5')](_0x23822c,_0x521d20,_0x364582,_0xa6f84c);};Dialer[_0x03c4('0x1a')][_0x03c4('0x1b5')]=function(_0x4eb2bf,_0x2519c4,_0x362b04,_0x49066c){this['moveContactManagedDialer'](_0x4eb2bf)[_0x03c4('0xb7')](function(){return _0x2519c4(msgResponse('[callProgressDetecting]',_0x03c4('0x1cb'),_0x49066c));})['catch'](function(){return _0x362b04(msgResponse('[moveContactManagedDialer][0]',_0x03c4('0x146'),_0x03c4('0x1cc')));});};Dialer[_0x03c4('0x1a')][_0x03c4('0xa')]=function(_0xdafedc){var _0x867995=_0xdafedc[_0x03c4('0x1cd')]/0x64;var _0x5428b4=_0xdafedc['outboundDropCallsDayTimeout']/(_0xdafedc[_0x03c4('0x63')]+_0xdafedc[_0x03c4('0x5f')]);var _0x119614=Math[_0x03c4('0x1ce')](_0xdafedc[_0x03c4('0x1cf')]*(_0xdafedc[_0x03c4('0x1d0')]/0x64));var _0x4fe918=Math['round'](_0xdafedc[_0x03c4('0x1cf')]*(_0xdafedc[_0x03c4('0x1d1')]/0x64));var _0x53421c=_0xdafedc['available']+_0xdafedc[_0x03c4('0x55')];var _0x509a46=Math[_0x03c4('0x1d2')](_0xdafedc['erlangCalls']*_0xdafedc[_0x03c4('0x76')]*_0xdafedc[_0x03c4('0x70')]*_0xdafedc[_0x03c4('0x71')]);if(_[_0x03c4('0x3d')](_0xdafedc['startProgressive'])){if(!_[_0x03c4('0x3d')](_0xdafedc[_0x03c4('0x90')])){_0xdafedc['startPredictive']=undefined;loggerPredictive[_0x03c4('0x97')](_0x03c4('0x1d3'),_0x03c4('0x1d4'));}if(!_['isUndefined'](_0xdafedc[_0x03c4('0x91')])){loggerPredictive[_0x03c4('0x97')](_0x03c4('0x1d3'),_0x03c4('0x1d5'));clearInterval(_0xdafedc['handlePredictive']);_0xdafedc['handlePredictive']=undefined;}_0xdafedc['startProgressive']=moment()[_0x03c4('0x7d')](_0x03c4('0xfc'));loggerPredictive[_0x03c4('0x82')](_0xdafedc['name'],'collection\x20data\x20in\x20progressive\x20at',_0xdafedc[_0x03c4('0x78')]);this['handlePower'](_0xdafedc,0x1);}else if(ifInterval(_0xdafedc[_0x03c4('0x1d6')],_0xdafedc[_0x03c4('0x78')])){this[_0x03c4('0x15b')](_0xdafedc,0x1);loggerPredictiveCalls['info'](_0x03c4('0x1d7'),_0xdafedc[_0x03c4('0x78')],_0xdafedc[_0x03c4('0x3f')]);_0xdafedc[_0x03c4('0x75')]=0x0;_0xdafedc[_0x03c4('0x6f')]=0x0;}else if(_0x867995<_0x5428b4&&_0xdafedc[_0x03c4('0x1d8')]===_0x03c4('0x1d9')){freeVariablesPredictive(_0xdafedc);loggerPredictive[_0x03c4('0x82')](_0x03c4('0x1da'),_0x03c4('0x1db'),_0x5428b4,'startProgressive',_0xdafedc['name']);}else if(_0x509a46<_0xdafedc[_0x03c4('0x6f')]&&_0xdafedc[_0x03c4('0x1d8')]===_0x03c4('0x1d9')){freeVariablesPredictive(_0xdafedc);loggerPredictive[_0x03c4('0x82')](_0x03c4('0x1dc'),_0x03c4('0x1dd'),_0x509a46,'Drop\x20in\x20this\x20interval',_0xdafedc[_0x03c4('0x6f')],_0x03c4('0x78'),_0xdafedc[_0x03c4('0x3f')]);}else if(!ifInterval(_0xdafedc[_0x03c4('0x1d6')],_0xdafedc[_0x03c4('0x78')])&&_['isUndefined'](_0xdafedc[_0x03c4('0x90')])&&!_[_0x03c4('0x3d')](_0xdafedc[_0x03c4('0x78')])){_0xdafedc[_0x03c4('0x90')]=moment()['format'](_0x03c4('0xfc'));loggerPredictive[_0x03c4('0x82')](_0xdafedc['name'],_0x03c4('0x1de'),_0xdafedc['startPredictive']);this[_0x03c4('0xbd')](_0xdafedc['dialPredictiveInterval'])[_0x03c4('0xb7')](this[_0x03c4('0x1df')](_0xdafedc))[_0x03c4('0xb7')](mergeDataErlangB(_0xdafedc))[_0x03c4('0xb7')](this[_0x03c4('0x1e0')](_0xdafedc))[_0x03c4('0xb8')](loggerCatchPredictive(_0x03c4('0x1e1'),_0xdafedc));}else if(!ifInterval(_0xdafedc[_0x03c4('0x1d6')],_0xdafedc[_0x03c4('0x90')])){_0xdafedc[_0x03c4('0x6f')]=0x0;_0xdafedc['startPredictive']=moment()['format'](_0x03c4('0xfc'));loggerPredictive[_0x03c4('0x82')](_0xdafedc[_0x03c4('0x3f')],'recalculate\x20predictive\x20at',_0xdafedc[_0x03c4('0x90')]);clearInterval(_0xdafedc[_0x03c4('0x91')]);_0xdafedc[_0x03c4('0x91')]=undefined;this[_0x03c4('0xbd')](_0xdafedc[_0x03c4('0x1d6')])['then'](this[_0x03c4('0x1df')](_0xdafedc))['then'](mergeDataErlangB(_0xdafedc))[_0x03c4('0xb7')](this[_0x03c4('0x1e0')](_0xdafedc))[_0x03c4('0xb8')](loggerCatchPredictive(_0x03c4('0x1e2'),_0xdafedc));}else if(_0xdafedc['predictiveIntervalAvailable']&&_0x53421c<_0xdafedc[_0x03c4('0x1cf')]-_0x4fe918){freeVariablesPredictive(_0xdafedc);loggerPredictive['info'](_0xdafedc[_0x03c4('0x3f')],_0x03c4('0x1e3'),_0x53421c,')\x20are\x20less\x20than\x20threshold\x20(',_0xdafedc[_0x03c4('0x1cf')],'-',_0x4fe918,'=',_0xdafedc['predictiveIntervalAvailable']-_0x4fe918,')');}else if(_0xdafedc[_0x03c4('0x1cf')]&&_0x53421c>_0xdafedc[_0x03c4('0x1cf')]+_0x119614){freeVariablesPredictive(_0xdafedc);loggerPredictive[_0x03c4('0x82')](_0xdafedc['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x53421c,_0x03c4('0x1e4'),_0xdafedc[_0x03c4('0x1cf')],'+',_0x119614,'=',_0xdafedc[_0x03c4('0x1cf')]+_0x119614,')');}};Dialer['prototype'][_0x03c4('0x1df')]=function(_0xe50e21){var _0x235fab=this;return function(_0x2c0439){return new BPromise(function(_0x29c5ad,_0x102fef){_[_0x03c4('0x8f')](_0xe50e21,_0x2c0439[0x0]);if(checkGetDataPredictive(_0x2c0439[0x0])){var _0x5d55b3=_0xe50e21['predictiveIntervalAvailable']=_0xe50e21['talking']+_0xe50e21[_0x03c4('0x4f')];var _0x500549=_0xe50e21[_0x03c4('0x1d6')]*0x3c;var _0x18a1ec=_0x2c0439[0x0][_0x03c4('0x6b')]+_0x2c0439[0x0]['predictiveIntervalAvgHoldtime'];var _0x477ebf=(_0x2c0439[0x0]['predictiveIntervalAnsweredCalls']+_0x2c0439[0x0][_0x03c4('0x6d')]+_0x2c0439[0x0][_0x03c4('0x6c')])/_0x2c0439[0x0][_0x03c4('0x73')];_0xe50e21['predictiveIntervalHitRate']=_0x477ebf>0x0?_0x477ebf:0x1;switch(_0xe50e21['dialPredictiveOptimization']){case'dropRate':var _0x2531e0=_0xe50e21[_0x03c4('0x1cd')]/0x64;return _0x235fab[_0x03c4('0x1e5')](_0x5d55b3,_0x500549,_0x18a1ec,_0x477ebf,_0x2531e0)[_0x03c4('0xb7')](function(_0x471b88){return _0x29c5ad(_0x471b88);});case'agentBusyFactor':var _0x3d645d=_0xe50e21[_0x03c4('0x1cd')]/0x64;return _0x235fab[_0x03c4('0x1e6')](_0x5d55b3,_0x500549,_0x18a1ec,_0x477ebf,_0x3d645d)[_0x03c4('0xb7')](function(_0x6869d8){return _0x29c5ad(_0x6869d8);});default:return _0x102fef(msgResponse(_0x03c4('0x1e7'),'Failure',_0x03c4('0x1e8')));}}else{return _0x102fef(msgResponse(_0x03c4('0x1e7'),'Failure',_0x03c4('0x1e9')));}});};};Dialer[_0x03c4('0x1a')][_0x03c4('0x1ea')]=function(_0x1661e5){var _0x3c7a6d=this;return function(_0x5ac5ea){return new BPromise(function(_0x4c7220,_0x3a2759){_[_0x03c4('0x8f')](_0x1661e5,_0x5ac5ea[0x0]);if(checkGetDataPredictive(_0x5ac5ea[0x0])){loggerPredictive[_0x03c4('0x82')](JSON[_0x03c4('0x7b')](_0x5ac5ea[0x0]));if(_0x1661e5[_0x03c4('0x1d8')]===_0x03c4('0x1d9')){return _0x3c7a6d[_0x03c4('0x1eb')](_0x1661e5['id'])[_0x03c4('0xb7')](function(_0x3b9482){var _0x273e49=_0x1661e5[_0x03c4('0x50')]-_0x3b9482[0x0]['outboundQueuePauses'];var _0x301604=_0x1661e5['dialPredictiveInterval']*0x3c;var _0x24fc65=_0x5ac5ea[0x0][_0x03c4('0x6b')]+_0x5ac5ea[0x0]['predictiveIntervalAvgHoldtime'];var _0x33a490=(_0x5ac5ea[0x0]['predictiveIntervalAnsweredCalls']+_0x5ac5ea[0x0][_0x03c4('0x6d')]+_0x5ac5ea[0x0][_0x03c4('0x6c')])/_0x5ac5ea[0x0][_0x03c4('0x73')];var _0x11d18d=_0x1661e5[_0x03c4('0x1cd')]/0x64;_0x1661e5[_0x03c4('0x72')]=_0x3b9482[0x0][_0x03c4('0x1ec')]||0x0;_0x1661e5['predictiveIntervalHitRate']=_0x33a490>0x0?_0x33a490:0x1;return _0x3c7a6d[_0x03c4('0x1e5')](_0x273e49,_0x301604,_0x24fc65,_0x33a490,_0x11d18d);})['then'](function(_0x4ad81a){return _0x4c7220(_0x4ad81a);})[_0x03c4('0xb8')](function(_0x5f1f90){return _0x3a2759(msgResponse(_0x03c4('0x1ed'),'Failure',JSON[_0x03c4('0x7b')](_0x5f1f90)));});}if(_0x1661e5[_0x03c4('0x1d8')]===_0x03c4('0x1ee')){return _0x3c7a6d['getVoiceQueueRtPauses'](_0x1661e5['id'])[_0x03c4('0xb7')](function(_0xa934b9){var _0x441f24=_0x1661e5[_0x03c4('0x50')]-_0xa934b9[0x0][_0x03c4('0x1ec')];var _0x694377=_0x1661e5[_0x03c4('0x1d6')]*0x3c;var _0x5380d9=_0x5ac5ea[0x0][_0x03c4('0x6b')]+_0x5ac5ea[0x0]['predictiveIntervalAvgHoldtime'];var _0x3e4676=(_0x5ac5ea[0x0][_0x03c4('0x69')]+_0x5ac5ea[0x0][_0x03c4('0x6d')]+_0x5ac5ea[0x0][_0x03c4('0x6c')])/_0x5ac5ea[0x0]['predictiveIntervalTotalCalls'];var _0x5ae7d8=_0x1661e5[_0x03c4('0x1cd')]/0x64;_0x1661e5[_0x03c4('0x72')]=_0xa934b9[0x0][_0x03c4('0x1ec')]||0x0;_0x1661e5[_0x03c4('0x70')]=_0x3e4676>0x0?_0x3e4676:0x1;return _0x3c7a6d[_0x03c4('0x1e6')](_0x441f24,_0x694377,_0x5380d9,_0x3e4676,_0x5ae7d8);})[_0x03c4('0xb7')](function(_0x5e86c0){return _0x4c7220(_0x5e86c0);})[_0x03c4('0xb8')](function(_0x4d6c27){return _0x3a2759(msgResponse(_0x03c4('0x1ed'),_0x03c4('0x146'),JSON[_0x03c4('0x7b')](_0x4d6c27)));});}}else{return _0x3a2759(msgResponse(_0x03c4('0x1e7'),_0x03c4('0x146'),_0x03c4('0x1e9')));}});};};Dialer['prototype'][_0x03c4('0x1e0')]=function(_0x1040f5){var _0x3d85b0=this;return function(){var _0x5a14a6=0x0;var _0x9a6c45=Math[_0x03c4('0x1d2')](_0x1040f5[_0x03c4('0x8d')]*0x3e8);if(_0x9a6c45>0x0){_0x9a6c45=_0x9a6c45<0x64?0x64:_0x9a6c45;loggerPredictive['info'](_0x1040f5[_0x03c4('0x3f')],_0x03c4('0x1ef'),_0x9a6c45,_0x03c4('0x49'));_0x1040f5['handlePredictive']=setInterval(function(){_0x3d85b0[_0x03c4('0x91')](_0x1040f5);loggerPredictiveCalls[_0x03c4('0x82')](_0x03c4('0x1f0'),_0x5a14a6+=0x1);},_0x9a6c45);}else{loggerPredictive['info'](_0x1040f5['name'],_0x03c4('0x1f1'));}};};Dialer[_0x03c4('0x1a')][_0x03c4('0x1f2')]=function(_0xa2901b,_0x41bf3e){var _0x17dcc8=this;return function(_0x34e2d6){if(_[_0x03c4('0x45')](_0x34e2d6)){if(_[_0x03c4('0xad')](_0x41bf3e[_0x03c4('0xd3')])||!_0x41bf3e['recallme']){if(_0xa2901b['dialMethod']===_0x03c4('0x9')){_0xa2901b['queueStatusComplete']=_['isUndefined'](_0xa2901b[_0x03c4('0x12c')])?!![]:_0xa2901b[_0x03c4('0x12c')];var _0x3924fd=uuid['v4']();_0x17dcc8[_0x03c4('0x25')][_0x3924fd]=new Action(_0xa2901b,_0x41bf3e,_0x3924fd);loggerBooked[_0x03c4('0x82')]('[booked][checkContactBlack]',_0x3924fd,_0x03c4('0x1f3'),JSON[_0x03c4('0x7b')](_0xa2901b[_0x03c4('0x12c')]),_0x03c4('0x1f4'),_0xa2901b[_0x03c4('0x3f')]);if(_0xa2901b[_0x03c4('0x12c')]){_0xa2901b[_0x03c4('0x12c')]=![];_0x17dcc8[_0x03c4('0x2a')][_0x17dcc8[_0x03c4('0x25')][_0x3924fd]['queue']]=[];ami[_0x03c4('0xae')]({'actionid':_0x3924fd,'action':_0x03c4('0x1f5'),'queue':_0xa2901b[_0x03c4('0x3f')]})[_0x03c4('0xb8')](function(){_0x17dcc8[_0x03c4('0xb2')](_0xa2901b);_0x17dcc8[_0x03c4('0xc0')]({'active':![],'ContactId':_0x17dcc8[_0x03c4('0x25')][_0x3924fd][_0x03c4('0xd1')],'ListId':_0x17dcc8[_0x03c4('0x25')][_0x3924fd][_0x03c4('0xd2')],'VoiceQueueId':_0x17dcc8[_0x03c4('0x25')][_0x3924fd][_0x03c4('0xd4')]||undefined,'CampaignId':_0x17dcc8['actions'][_0x3924fd]['CampaignId']||undefined})[_0x03c4('0xb8')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x17dcc8['actions'][_0x3924fd];});}else{loggerBooked[_0x03c4('0x82')](_0x03c4('0x1f6'),JSON[_0x03c4('0x7b')](_0xa2901b['queueStatusComplete']),'Queue:\x20',_0xa2901b['name']);_0x17dcc8['updateOriginated'](_0xa2901b);_0x17dcc8[_0x03c4('0xc0')]({'active':![],'ContactId':_0x17dcc8[_0x03c4('0x25')][_0x3924fd][_0x03c4('0xd1')],'ListId':_0x17dcc8[_0x03c4('0x25')][_0x3924fd]['ListId'],'VoiceQueueId':_0x17dcc8['actions'][_0x3924fd][_0x03c4('0xd4')]||undefined,'CampaignId':_0x17dcc8[_0x03c4('0x25')][_0x3924fd][_0x03c4('0xd5')]||undefined})[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x1f7')));delete _0x17dcc8[_0x03c4('0x25')][_0x3924fd];}}else{return _0x17dcc8[_0x03c4('0x16c')](_0xa2901b,_0x41bf3e);}}else{if(getDiff(_0x41bf3e[_0x03c4('0x1f8')])<_0xa2901b[_0x03c4('0x1f9')]*0x3c){if(_0x41bf3e[_0x03c4('0x1fa')]&&!_0x41bf3e[_0x03c4('0x1fa')][_0x03c4('0x1fb')]){_0x17dcc8[_0x03c4('0x1f')]['run'](_0x41bf3e['id'])[_0x03c4('0x1d')](function(){_0x17dcc8[_0x03c4('0xb2')](_0xa2901b);});}else{_0x17dcc8[_0x03c4('0xc2')]({'active':![]},_0x41bf3e['id'],0x1)[_0x03c4('0x1d')](function(){_0x17dcc8['updateOriginated'](_0xa2901b);});}}else{_0xa2901b['outboundReCallsDay']+=0x1;_0x17dcc8[_0x03c4('0xb2')](_0xa2901b);if(_0xa2901b[_0x03c4('0x1fc')]){_0x17dcc8[_0x03c4('0xc0')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x41bf3e[_0x03c4('0xd1')],'ListId':_0x41bf3e[_0x03c4('0xd2')],'VoiceQueueId':_0x41bf3e['VoiceQueueId']||undefined,'CampaignId':_0x41bf3e['CampaignId']||undefined})['catch'](loggerCatch(_0x03c4('0x1fd')));_0x17dcc8[_0x03c4('0xca')](createObjHistory(_0xa2901b,_0x41bf3e,_0x03c4('0x1fe'),0x17,_0x03c4('0x1ff')))[_0x03c4('0xb8')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x17dcc8[_0x03c4('0xcf')](createObjHistory(_0xa2901b,_0x41bf3e,_0x03c4('0x200'),0x16,_0x03c4('0x201')),_0x03c4('0x202'),_0x03c4('0x203'));}}}}else{_0xa2901b[_0x03c4('0x204')]+=0x1;_0x17dcc8[_0x03c4('0xcf')](createObjHistory(_0xa2901b,_0x41bf3e,_0x03c4('0x205'),0xd,_0x03c4('0x206')),_0x03c4('0x207'),_0x03c4('0x208'));throw _0x03c4('0x209');}};};Dialer[_0x03c4('0x1a')][_0x03c4('0x15e')]=function(_0x505cb0){var _0xb502bf=this;var _0x4cb1fb=_0x505cb0[_0x03c4('0x20a')]-_0x505cb0[_0x03c4('0x74')]-_0x505cb0[_0x03c4('0xc4')];emitCampaignSummary(_0x505cb0);if(_0x4cb1fb>0x0){if(_0x4cb1fb>this[_0x03c4('0x23')]){_0x4cb1fb=this['maxNumberOriginate'];}_0x505cb0[_0x03c4('0xc4')]+=_0x4cb1fb;this[_0x03c4('0xc6')](_0x505cb0['id'],_0x4cb1fb,_0x505cb0[_0x03c4('0x20b')],_0x505cb0)[_0x03c4('0xb7')](function(_0x58e26b){_0x505cb0[_0x03c4('0xc4')]-=_0x4cb1fb;_0x505cb0[_0x03c4('0xc4')]=_0x505cb0[_0x03c4('0xc4')]>0x0?_0x505cb0[_0x03c4('0xc4')]:0x0;if(!checkContactEmpty(_0x58e26b)){_0x505cb0[_0x03c4('0x3e')]=_0x03c4('0xa0');logger[_0x03c4('0x82')](_0x03c4('0x20c')+_0x505cb0['name']);}else{_0x505cb0['originated']+=_0x58e26b[_0x03c4('0x133')];_0x505cb0[_0x03c4('0x3e')]=_0x03c4('0x20d');for(var _0x397fe5=0x0;_0x397fe5<_0x58e26b[_0x03c4('0x133')];_0x397fe5+=0x1){_0x505cb0[_0x03c4('0x20e')]+=0x1;if(_[_0x03c4('0xad')](_0x58e26b[_0x397fe5])||_[_0x03c4('0xad')](_0x58e26b[_0x397fe5][_0x03c4('0x16f')])||_['isNil'](_0x58e26b[_0x397fe5]['Contact']['phone'])){_0xb502bf[_0x03c4('0xcd')]('[actionOriginate]\x20',_0x505cb0,_0x58e26b[_0x397fe5]);}else{_0xb502bf['checkIsBlackListIvr'](_['pick'](_0x58e26b[_0x397fe5],['CampaignId','Contact.phone']))[_0x03c4('0xb7')](_0xb502bf[_0x03c4('0x1f2')](_0x505cb0,_0x58e26b[_0x397fe5]))['catch'](_0xb502bf['loggerHandler']('[actionOriginateIvr]\x20',_0x505cb0));}}}})[_0x03c4('0xb8')](loggerGetContactDialer('[getContactCampaign2]',_0x505cb0,_0x4cb1fb));}};Dialer[_0x03c4('0x1a')][_0x03c4('0x15b')]=function(_0x2ed4a8,_0x1aa817){var _0x3d1019=this;var _0x4d0273=[];var _0x14c0fd=_0x1aa817>=0x1?_0x1aa817:0x1;if(_0x2ed4a8[_0x03c4('0x5a')]===_0x03c4('0x9')){_0x14c0fd=0x1;}var _0x307420=Math[_0x03c4('0x1d2')](_0x2ed4a8[_0x03c4('0x4f')]*_0x14c0fd)-_0x2ed4a8[_0x03c4('0x74')]-_0x2ed4a8[_0x03c4('0xc4')];emitVoiceQueueSummary(_0x2ed4a8);if(_0x2ed4a8[_0x03c4('0x20f')]>0x0){var _0x13f8da=_0x2ed4a8[_0x03c4('0x20f')]-_0x2ed4a8[_0x03c4('0x74')]-_0x2ed4a8['talking']-_0x2ed4a8[_0x03c4('0xc4')]-_0x2ed4a8[_0x03c4('0x51')];if(_0x307420>_0x13f8da){_0x307420=_0x13f8da;}}if(_0x307420>0x0){if(_0x2ed4a8[_0x03c4('0x5a')]===_0x03c4('0x9')){_0x307420=0x1;}if(_0x307420>this[_0x03c4('0x23')]){_0x307420=this[_0x03c4('0x23')];}_0x2ed4a8[_0x03c4('0xc4')]+=_0x307420;for(var _0x4f0ec1 in this[_0x03c4('0x127')]){if(typeof this[_0x03c4('0x127')][_0x4f0ec1]!=='undefined'){if(this['agents'][_0x4f0ec1][_0x03c4('0xa7')]==='not_inuse'&&this[_0x03c4('0x127')][_0x4f0ec1]['status']===_0x03c4('0xda')){_0x4d0273[_0x03c4('0x150')](this[_0x03c4('0x127')][_0x4f0ec1]['id']);}}}this[_0x03c4('0xc3')](_0x2ed4a8['id'],_0x4d0273,_0x307420,_0x2ed4a8['dialOrderByScheduledAt'],_0x2ed4a8)[_0x03c4('0xb7')](function(_0x275ef5){_0x2ed4a8[_0x03c4('0xc4')]-=_0x307420;_0x2ed4a8[_0x03c4('0xc4')]=_0x2ed4a8[_0x03c4('0xc4')]>0x0?_0x2ed4a8['temp']:0x0;if(!checkContactEmpty(_0x275ef5)){_0x3d1019[_0x03c4('0xb6')](_0x2ed4a8)[_0x03c4('0xb7')](sendMessageReschedule(_0x2ed4a8))[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x210')));}else{_0x2ed4a8[_0x03c4('0x74')]+=_0x275ef5[_0x03c4('0x133')];_0x2ed4a8[_0x03c4('0x3e')]=_0x2ed4a8[_0x03c4('0x5a')]==='booked'?_0x03c4('0x179'):_0x03c4('0x20d');for(var _0x322c23=0x0;_0x322c23<_0x275ef5['length'];_0x322c23+=0x1){if(_[_0x03c4('0xad')](_0x275ef5[_0x322c23])||_[_0x03c4('0xad')](_0x275ef5[_0x322c23][_0x03c4('0x16f')])||_[_0x03c4('0xad')](_0x275ef5[_0x322c23][_0x03c4('0x16f')][_0x03c4('0x170')])){_0x3d1019['emptyContact']('[actionOriginate]\x20',_0x2ed4a8,_0x275ef5[_0x322c23]);}else{_0x3d1019[_0x03c4('0x211')](_[_0x03c4('0xd0')](_0x275ef5[_0x322c23],[_0x03c4('0xd4'),_0x03c4('0x212')]))[_0x03c4('0xb7')](_0x3d1019[_0x03c4('0x1f2')](_0x2ed4a8,_0x275ef5[_0x322c23]))[_0x03c4('0xb8')](_0x3d1019[_0x03c4('0xcc')]('[actionOriginate]\x20',_0x2ed4a8));}}}})['catch'](loggerGetContactDialer(_0x03c4('0x213'),_0x2ed4a8,_0x307420));}};Dialer[_0x03c4('0x1a')][_0x03c4('0x91')]=function(_0x552107){if(_0x552107['dialLimitQueue']>0x0){var _0x29cec9=_0x552107['dialLimitQueue']-_0x552107[_0x03c4('0x74')]-_0x552107[_0x03c4('0x55')];if(_0x29cec9>0x0){this[_0x03c4('0x214')](_0x552107);}else{loggerPredictiveCalls['info'](_0x03c4('0x215'));}}else{this['tryOriginatePredictive'](_0x552107);}};Dialer[_0x03c4('0x1a')][_0x03c4('0x214')]=function(_0x102f47){var _0xa21afc=this;var _0x2ec903=[];_0x102f47[_0x03c4('0x74')]+=0x1;for(var _0x56cbbb in this[_0x03c4('0x127')]){if(typeof this[_0x03c4('0x127')][_0x56cbbb]!==_0x03c4('0x9a')){if(this[_0x03c4('0x127')][_0x56cbbb][_0x03c4('0xa7')]===_0x03c4('0x216')&&this[_0x03c4('0x127')][_0x56cbbb][_0x03c4('0xaf')]===_0x03c4('0xda')){_0x2ec903[_0x03c4('0x150')](this[_0x03c4('0x127')][_0x56cbbb]['id']);}}}this['getContactDialer'](_0x102f47['id'],_0x2ec903,0x1,_0x102f47['dialOrderByScheduledAt'],_0x102f47)[_0x03c4('0xb7')](function(_0x5e7a94){if(!checkContactEmpty(_0x5e7a94)){checkContactLowerLimitOriginate(_0x102f47,0x1,0x0);_0xa21afc[_0x03c4('0xb6')](_0x102f47)[_0x03c4('0xb7')](sendMessageReschedule(_0x102f47))[_0x03c4('0xb8')](loggerCatch(_0x03c4('0x210')));}else{_0x102f47[_0x03c4('0x3e')]='RUNNING';if(_[_0x03c4('0xad')](_0x5e7a94[0x0])||_[_0x03c4('0xad')](_0x5e7a94[0x0][_0x03c4('0x16f')])||_[_0x03c4('0xad')](_0x5e7a94[0x0][_0x03c4('0x16f')][_0x03c4('0x170')])){_0xa21afc[_0x03c4('0xcd')](_0x03c4('0x217'),_0x102f47,_0x5e7a94[0x0]);}else{_0xa21afc[_0x03c4('0x211')](_[_0x03c4('0xd0')](_0x5e7a94[0x0],['VoiceQueueId',_0x03c4('0x212')]))[_0x03c4('0xb7')](_0xa21afc['checkContactBlack'](_0x102f47,_0x5e7a94[0x0]))[_0x03c4('0xb8')](_0xa21afc[_0x03c4('0xcc')](_0x03c4('0x218'),_0x102f47));}}})[_0x03c4('0xb8')](loggerGetContactDialer(_0x03c4('0x219'),_0x102f47,0x1));emitVoiceQueueSummary(_0x102f47);};Dialer[_0x03c4('0x1a')][_0x03c4('0x1e5')]=function(_0x12f1d3,_0x45c6ee,_0x14a4bb,_0x827bf,_0x337a57,_0x1fb91f){loggerPredictive[_0x03c4('0x82')](_0x03c4('0x21a'));loggerPredictive[_0x03c4('0x82')](_0x03c4('0x21b'),_0x12f1d3);loggerPredictive[_0x03c4('0x82')](_0x03c4('0x21c'),_0x45c6ee);loggerPredictive[_0x03c4('0x82')](_0x03c4('0x21d'),_0x14a4bb);loggerPredictive['info'](_0x03c4('0x21e'),_0x827bf);loggerPredictive[_0x03c4('0x82')](_0x03c4('0x21f'),_0x337a57);loggerPredictive['info'](_0x03c4('0x89'));return new BPromise(function(_0x524774,_0x323fe4){if(_0x12f1d3<=0x0||isNaN(_0x12f1d3)){return _0x323fe4(msgResponse(_0x03c4('0x220'),_0x03c4('0x48'),'m\x20=\x20'+_0x12f1d3));}if(_0x14a4bb<=0x0||isNaN(_0x14a4bb)){return _0x323fe4(msgResponse(_0x03c4('0x220'),_0x03c4('0x48'),_0x03c4('0x221')+_0x14a4bb));}if(_0x827bf<=0x0||isNaN(_0x827bf)){return _0x323fe4(msgResponse('[abandonmentRate]',_0x03c4('0x48'),_0x03c4('0x222')+_0x827bf));}if(_0x45c6ee<=0x0||isNaN(_0x45c6ee)){return _0x323fe4(msgResponse(_0x03c4('0x220'),_0x03c4('0x48'),_0x03c4('0x223')+_0x45c6ee));}if(_0x337a57<=0x0||isNaN(_0x337a57)){return _0x323fe4(msgResponse(_0x03c4('0x220'),_0x03c4('0x48'),_0x03c4('0x224')+_0x337a57));}_0x1fb91f=_0x1fb91f||0x0;var _0x100cfd=0x1/_0x14a4bb;var _0x11b441=0x0;var _0x4f5232=0x0;var _0x3ec8c9=0x0;var _0x5e4237=0x0;for(var _0x59161f=0x0;_0x3ec8c9<_0x337a57;_0x59161f+=0x1){_0x4f5232=_0x59161f/_0x45c6ee;_0x11b441=(_0x827bf*_0x4f5232+_0x1fb91f)/_0x100cfd;_0x3ec8c9=erlangb(_0x11b441,_0x12f1d3);_0x5e4237=_0x11b441/_0x12f1d3*(0x1-erlangb(_0x11b441,_0x12f1d3));}return _0x524774({'erlangCalls':_0x59161f,'erlangCallToSecond':_0x45c6ee/_0x59161f,'erlangAbandonmentRate':_0x3ec8c9,'erlangBusyFactor':_0x5e4237});});};Dialer['prototype'][_0x03c4('0x1e6')]=function(_0x36fda7,_0x8135b,_0x3f787e,_0x143271,_0x4a2a0f,_0x592e9c){loggerPredictive['info'](_0x03c4('0x225'));loggerPredictive[_0x03c4('0x82')](_0x03c4('0x21b'),_0x36fda7);loggerPredictive[_0x03c4('0x82')](_0x03c4('0x21c'),_0x8135b);loggerPredictive['info'](_0x03c4('0x21d'),_0x3f787e);loggerPredictive[_0x03c4('0x82')](_0x03c4('0x21e'),_0x143271);loggerPredictive[_0x03c4('0x82')](_0x03c4('0x226'),_0x4a2a0f);loggerPredictive[_0x03c4('0x82')](_0x03c4('0x89'));return new BPromise(function(_0x14f4c8,_0x169ed6){if(_0x36fda7<=0x0||isNaN(_0x36fda7)){return _0x169ed6(msgResponse(_0x03c4('0x227'),'Error','m\x20=\x20'+_0x36fda7));}if(_0x3f787e<=0x0||isNaN(_0x3f787e)){return _0x169ed6(msgResponse(_0x03c4('0x227'),_0x03c4('0x48'),_0x03c4('0x221')+_0x3f787e));}if(_0x143271<=0x0||isNaN(_0x143271)){return _0x169ed6(msgResponse('[busyFactor]',_0x03c4('0x48'),_0x03c4('0x222')+_0x143271));}if(_0x8135b<=0x0||isNaN(_0x8135b)){return _0x169ed6(msgResponse('[busyFactor]',_0x03c4('0x48'),_0x03c4('0x223')+_0x8135b));}if(_0x4a2a0f<=0x0||isNaN(_0x4a2a0f)){return _0x169ed6(msgResponse(_0x03c4('0x227'),_0x03c4('0x48'),_0x03c4('0x228')+_0x4a2a0f));}_0x592e9c=_0x592e9c||0x0;var _0x12c9eb=0x1/_0x3f787e;var _0x4c0972=0x0;var _0x504bb9=0x0;var _0x186667=0x0;var _0x1d2b40=0x0;for(var _0x537b37=0x0;_0x1d2b40<_0x4a2a0f;_0x537b37+=0x1){_0x504bb9=_0x537b37/_0x8135b;_0x4c0972=(_0x143271*_0x504bb9+_0x592e9c)/_0x12c9eb;_0x186667=erlangb(_0x4c0972,_0x36fda7);_0x1d2b40=_0x4c0972/_0x36fda7*(0x1-erlangb(_0x4c0972,_0x36fda7));}return _0x14f4c8({'erlangCalls':_0x537b37,'erlangCallToSecond':_0x8135b/_0x537b37,'erlangAbandonmentRate':_0x186667,'erlangBusyFactor':_0x1d2b40});});};module[_0x03c4('0x229')]=Dialer; \ No newline at end of file +var _0xa979=['isEmpty','Intervals','Error','stringify','milliseconds','diff','emit','type','outbound','strategy','answered','available','pTalking','sumBillable','sumHoldTime','talking','total','unmanaged','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','campaign:save','-----\x20Stats\x20Predictive\x20---','info','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','---------------------------','isUndefined','Avg\x20Talk\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','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','seconds','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','originated','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','contacts','[getContactDialer2][Empty]','waiting','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','endtime','prototype','clearZombieChannels','uniqueId','[uniqueid]','isNil','status','catch','No\x20such\x20channel','queue','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','then','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','moveContactManagedDialer','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','updateOriginated','notFound','merge','ContactId','ListId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','isTrunkReachable','reachable','SIP/%s','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','HANGUP','state','statedesc','HangupInAMD','membername','AMD','custom:amd','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','Machine','countmachineretry','countglobal','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','value','[syncHangupInAMDIvr]','MACHINE','countnoanswerretry','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AGI','Unknow','reason','agiafterat','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','dialQueueProject2','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','starttime','channel','syncQueueMember','actionid','locked','paused','stateinterface','push','idHopper','queueStatusComplete','pick','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','timezones','\x20Timezone\x20unknow\x20','isArray','Action','command','iftime\x20%s,%s','interval','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','power','handlePower','dialPowerLevel','booked','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','loggedIn','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','[syncQueueSummary]','[syncCampaigns]','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialer','ACTIVE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','createdAt','updatedAt','%s%s','toUpper','dialRandomLastDigitCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','entity\x20is\x20undefine','[callProgressDetecting]','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','custom:agentcongestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','Success','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','outboundQueuePauses','busyFactor','[CatchErlangB]','check\x20failure','floor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','scheduledat','dialRecallMeTimeout','Agent','run','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','[actionOriginate]\x20','Contact.phone','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','abandonmentRate','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','lodash','bluebird','uuid','moment','md5','../preview/util/util','../../../config/environment/','../../../config/logger','predictive','predictiveCalls','../ami','redis','defaults','localhost','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./agentComplete','./queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','syncAgentComplete','custom:queuesummary','syncQueueSummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','message','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','name','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL','INTERVAL_IS_NULL'];(function(_0x1824c9,_0x475d83){var _0x3ad7e9=function(_0x346a23){while(--_0x346a23){_0x1824c9['push'](_0x1824c9['shift']());}};_0x3ad7e9(++_0x475d83);}(_0xa979,0x1d9));var _0x9a97=function(_0x42ac4d,_0x387c90){_0x42ac4d=_0x42ac4d-0x0;var _0x4a6e46=_0xa979[_0x42ac4d];return _0x4a6e46;};'use strict';var util=require('util');var _=require(_0x9a97('0x0'));var BPromise=require(_0x9a97('0x1'));var uuid=require(_0x9a97('0x2'));var moment=require(_0x9a97('0x3'));var rr=require('rr');var md5=require(_0x9a97('0x4'));var Redis=require('ioredis');var ut=require(_0x9a97('0x5'));var config=require(_0x9a97('0x6'));var logger=require('../../../config/logger')('dialer');var loggerBooked=require(_0x9a97('0x7'))('booked');var loggerPredictive=require(_0x9a97('0x7'))(_0x9a97('0x8'));var loggerPredictiveCalls=require(_0x9a97('0x7'))(_0x9a97('0x9'));var loggerSyncQueueSummary=require('../../../config/logger')('syncQueueSummary');var ami=require(_0x9a97('0xa'));config[_0x9a97('0xb')]=_[_0x9a97('0xc')](config[_0x9a97('0xb')],{'host':_0x9a97('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9a97('0xb')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x9a97('0xe'));var cmHopperBlack=require(_0x9a97('0xf'));var voiceQueueRt=require(_0x9a97('0x10'));var Action=require(_0x9a97('0x11'));var History=require(_0x9a97('0x12'));var Final=require('./final');var AgentComplete=require(_0x9a97('0x13'));var QueueCallerAbandon=require(_0x9a97('0x14'));var Hangup=require('./hangup');var ipAgi=process[_0x9a97('0x15')][_0x9a97('0x16')]||_0x9a97('0x17');var strategy={'rrmemory':_0x9a97('0x18'),'roundrobin':_0x9a97('0x19')};var Sequence=function(){};Sequence['prototype'][_0x9a97('0x1a')]=function(_0x5b58b5){this[_0x9a97('0x1b')]=this['tail']?this[_0x9a97('0x1b')][_0x9a97('0x1c')](_0x5b58b5):_0x5b58b5();};function Dialer(_0x34dfff,_0x38e018){this['sequence']=new Sequence();this[_0x9a97('0x1d')]=_0x38e018;this[_0x9a97('0x1e')]=_0x34dfff['voiceQueues'];this[_0x9a97('0x1f')]=_0x34dfff['campaigns'];this[_0x9a97('0x20')]=_0x34dfff[_0x9a97('0x20')];this[_0x9a97('0x21')]=_0x34dfff[_0x9a97('0x21')];this[_0x9a97('0x22')]=config[_0x9a97('0x22')]||0x2;this[_0x9a97('0x23')]={};this[_0x9a97('0x24')]={};this['contactsId']={};this['uniqueId']={};this['optionPredictive']={};this[_0x9a97('0x25')]={};this[_0x9a97('0x26')]={};this[_0x9a97('0x27')]={};this[_0x9a97('0x28')]={};this[_0x9a97('0x29')]={};ami['on'](_0x9a97('0x2a'),this[_0x9a97('0x2b')][_0x9a97('0x2c')](this));ami['on'](_0x9a97('0x2d'),this[_0x9a97('0x2e')][_0x9a97('0x2c')](this));ami['on']('originateresponse',this[_0x9a97('0x2f')][_0x9a97('0x2c')](this));ami['on']('agentcomplete',this[_0x9a97('0x30')]['bind'](this));ami['on'](_0x9a97('0x31'),this[_0x9a97('0x32')][_0x9a97('0x2c')](this));ami['on'](_0x9a97('0x33'),this[_0x9a97('0x34')][_0x9a97('0x2c')](this));ami['on'](_0x9a97('0x35'),this[_0x9a97('0x36')]['bind'](this));ami['on'](_0x9a97('0x37'),this[_0x9a97('0x38')]['bind'](this));ami['on'](_0x9a97('0x39'),this['syncQueueMember'][_0x9a97('0x2c')](this));ami['on'](_0x9a97('0x3a'),this[_0x9a97('0x3b')][_0x9a97('0x2c')](this));this[_0x9a97('0x3c')]();this[_0x9a97('0x3d')]();}function isNotNull(_0x50e246){return _0x50e246!==null&&!_['isUndefined'](_0x50e246);}function checkIsLoggedIn(_0x4125eb,_0x7878fd){return function(){if(_0x7878fd<=0x0){_0x4125eb[_0x9a97('0x3e')]=_0x9a97('0x3f');throw _0x4125eb['name']+_0x9a97('0x40');}};}function isActive(_0x185ee6){return _0x185ee6;}function checkIsActive(_0x469475,_0x162bff){return function(){if(!isActive(_0x162bff)){_0x469475[_0x9a97('0x3e')]=_0x9a97('0x41');throw _0x469475[_0x9a97('0x42')]+_0x9a97('0x43');}};}function checkInterval(_0x23d986){return function(){if(!isNotNull(_0x23d986[_0x9a97('0x44')])){_0x23d986['message']='INTERVAL_IS_NULL';throw _0x23d986['name']+_0x9a97('0x45');}if(!isNotNull(_0x23d986[_0x9a97('0x44')]['Intervals'])){_0x23d986[_0x9a97('0x3e')]=_0x9a97('0x46');throw _0x23d986[_0x9a97('0x42')]+_0x9a97('0x45');}if(!isNotNull(_[_0x9a97('0x47')](_0x23d986[_0x9a97('0x44')][_0x9a97('0x48')]))){_0x23d986[_0x9a97('0x3e')]='INTERVAL_IS_NULL';throw _0x23d986[_0x9a97('0x42')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x26e202,_0x2a2332,_0xdb8744){return{'action':_0x26e202,'response':_0x2a2332,'message':_0xdb8744,'stack':_0xdb8744};}function myreject(_0x5b3a64){return function(_0x3ff035){return _0x5b3a64(msgResponse('[ifTime][Action]',_0x9a97('0x49'),JSON[_0x9a97('0x4a')](_0x3ff035)));};}function getSeconds(_0x2ffe4c,_0x314f6d){var _0x4422c4=moment(_0x2ffe4c)[_0x9a97('0x4b')](0x0);var _0x216118=moment(_0x314f6d)[_0x9a97('0x4b')](0x0);return _0x4422c4[_0x9a97('0x4c')](_0x216118,'seconds');}function emit(_0x55c05d,_0x4365f3,_0x4c3873){io['to'](_0x55c05d)[_0x9a97('0x4d')](_0x4365f3,_0x4c3873);}function emitVoiceQueueSummary(_0x17d559){if(_0x17d559[_0x9a97('0x4e')]===_0x9a97('0x4f')){var _0x287463={'id':_0x17d559['id'],'name':_0x17d559[_0x9a97('0x42')],'strategy':_0x17d559[_0x9a97('0x50')],'answered':_0x17d559[_0x9a97('0x51')],'available':_0x17d559[_0x9a97('0x52')],'loggedIn':_0x17d559['loggedIn'],'pTalking':_0x17d559[_0x9a97('0x53')],'sumBillable':_0x17d559[_0x9a97('0x54')],'sumDuration':_0x17d559['sumDuration'],'sumHoldTime':_0x17d559[_0x9a97('0x55')]||0x0,'talking':_0x17d559[_0x9a97('0x56')],'total':_0x17d559[_0x9a97('0x57')],'type':_0x17d559[_0x9a97('0x4e')],'unmanaged':_0x17d559[_0x9a97('0x58')],'abandoned':_0x17d559['abandoned'],'waiting':_0x17d559['waiting'],'loggedInDb':_0x17d559[_0x9a97('0x59')],'dialActive':_0x17d559[_0x9a97('0x5a')],'dialMethod':_0x17d559[_0x9a97('0x5b')],'dialOriginateCallerIdName':_0x17d559[_0x9a97('0x5c')],'dialOriginateCallerIdNumber':_0x17d559[_0x9a97('0x5d')],'dialOriginateTimeout':_0x17d559[_0x9a97('0x5e')],'dialPrefix':_0x17d559['dialPrefix'],'outboundAnswerAgiCallsDay':_0x17d559[_0x9a97('0x5f')],'outboundAnswerCallsDay':_0x17d559[_0x9a97('0x60')],'outboundBlacklistCallsDay':_0x17d559['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x17d559[_0x9a97('0x61')],'outboundCongestionCallsDay':_0x17d559[_0x9a97('0x62')],'outboundDropCallsDayACS':_0x17d559[_0x9a97('0x63')],'outboundDropCallsDayCallersExit':_0x17d559[_0x9a97('0x64')],'outboundDropCallsDayTimeout':_0x17d559['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x17d559[_0x9a97('0x65')],'outboundNoSuchCallsDay':_0x17d559[_0x9a97('0x66')],'outboundOriginateFailureCallsDay':_0x17d559[_0x9a97('0x67')],'outboundReCallsDay':_0x17d559[_0x9a97('0x68')],'outboundRejectCallsDay':_0x17d559['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x17d559[_0x9a97('0x69')],'predictiveIntervalAnsweredCalls':_0x17d559['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x17d559['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x17d559[_0x9a97('0x6a')],'predictiveIntervalDroppedCallsCallersExit':_0x17d559['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x17d559[_0x9a97('0x6b')],'predictiveIntervalErlangCalls':_0x17d559[_0x9a97('0x6c')],'predictiveIntervalErlangCallsDroppedCalls':_0x17d559[_0x9a97('0x6d')],'predictiveIntervalHitRate':_0x17d559[_0x9a97('0x6e')],'predictiveIntervalMultiplicativeFactor':_0x17d559['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x17d559[_0x9a97('0x6f')],'predictiveIntervalAvailable':_0x17d559[_0x9a97('0x70')],'predictiveIntervalTotalCalls':_0x17d559[_0x9a97('0x71')],'message':_0x17d559[_0x9a97('0x3e')],'originated':_0x17d559['originated'],'erlangCalls':_0x17d559[_0x9a97('0x72')],'erlangCallToSecond':_0x17d559[_0x9a97('0x73')],'erlangAbandonmentRate':_0x17d559[_0x9a97('0x74')],'erlangBusyFactor':_0x17d559['erlangBusyFactor'],'startPredictive':_0x17d559[_0x9a97('0x25')],'startProgressive':_0x17d559[_0x9a97('0x26')]};if(_0x17d559['Trunk']){_0x287463['Trunk']={'id':_0x17d559[_0x9a97('0x75')]['id'],'name':_0x17d559[_0x9a97('0x75')][_0x9a97('0x42')],'active':_0x17d559[_0x9a97('0x75')][_0x9a97('0x76')],'callerid':_0x17d559[_0x9a97('0x75')][_0x9a97('0x77')]};}if(_0x17d559['Interval']){_0x287463[_0x9a97('0x44')]={'id':_0x17d559[_0x9a97('0x44')]['id'],'name':_0x17d559[_0x9a97('0x44')][_0x9a97('0x42')]};}var _0x111fe=md5(JSON[_0x9a97('0x4a')](_0x287463));if(_0x17d559['md5']!==_0x111fe){_0x17d559[_0x9a97('0x4')]=_0x111fe;emit(util[_0x9a97('0x78')](_0x9a97('0x79'),_0x287463['name']),_0x9a97('0x7a'),_0x287463);}}}function emitCampaignSummary(_0x5d7c64){if(_0x5d7c64[_0x9a97('0x4e')]===_0x9a97('0x7b')){emit(util[_0x9a97('0x78')]('campaign:ivr:%s',_0x5d7c64[_0x9a97('0x42')]),_0x9a97('0x7c'),_0x5d7c64);}}function checkGetDataPredictive(_0x232dd2){if(isNotNull(_0x232dd2)&&!_[_0x9a97('0x47')](_0x232dd2)){loggerPredictive['info'](_0x9a97('0x7d'));loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x232dd2[_0x9a97('0x71')]);loggerPredictive[_0x9a97('0x7e')](_0x9a97('0x7f'),_0x232dd2['predictiveIntervalAnsweredCalls']);loggerPredictive['info'](_0x9a97('0x80'),_0x232dd2[_0x9a97('0x6b')]);loggerPredictive[_0x9a97('0x7e')](_0x9a97('0x81'),_0x232dd2[_0x9a97('0x82')]);loggerPredictive[_0x9a97('0x7e')](_0x9a97('0x83'),_0x232dd2[_0x9a97('0x84')]);loggerPredictive[_0x9a97('0x7e')](_0x9a97('0x85'),_0x232dd2[_0x9a97('0x6a')]);loggerPredictive[_0x9a97('0x7e')](_0x9a97('0x86'));if(_0x232dd2[_0x9a97('0x71')]>0x0){if(!_[_0x9a97('0x87')](_0x232dd2[_0x9a97('0x6a')])&&_0x232dd2['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x9a97('0x7e')](_0x9a97('0x88'));if(!_[_0x9a97('0x87')](_0x232dd2['predictiveIntervalAvgHoldtime'])&&_0x232dd2[_0x9a97('0x84')]>0x0){return!![];}loggerPredictive[_0x9a97('0x7e')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x9a97('0x7e')](_0x9a97('0x89'));}}else{loggerPredictive[_0x9a97('0x7e')](_0x9a97('0x8a'));}return![];}function mergeDataErlangB(_0x3896a1){return function(_0x3ec709){loggerPredictive[_0x9a97('0x7e')](_0x9a97('0x8b'));loggerPredictive[_0x9a97('0x7e')](_0x9a97('0x8c'),_0x3ec709['erlangCalls']);loggerPredictive[_0x9a97('0x7e')](_0x9a97('0x8d'),_0x3ec709['erlangCallToSecond']);loggerPredictive['info'](_0x9a97('0x8e'),_0x3ec709[_0x9a97('0x74')]);loggerPredictive[_0x9a97('0x7e')](_0x9a97('0x8f'),_0x3ec709[_0x9a97('0x90')]);loggerPredictive[_0x9a97('0x7e')](_0x9a97('0x8e'),_0x3ec709[_0x9a97('0x74')]);loggerPredictive[_0x9a97('0x7e')](_0x9a97('0x86'));_['merge'](_0x3896a1,_0x3ec709);};}function getDiff(_0x20461a){var _0x195dae=moment()[_0x9a97('0x4b')](0x0);var _0x17e09d=moment(_0x20461a)[_0x9a97('0x4b')](0x0);return _0x195dae[_0x9a97('0x4c')](_0x17e09d,_0x9a97('0x91'));}function ifInterval(_0x58f3b8,_0x2f16df){if(_[_0x9a97('0x87')](_0x2f16df)){return![];}return getDiff(_0x2f16df)<_0x58f3b8*0x3c;}function freeVariablesPredictive(_0x111196){if(isNotNull(_0x111196)){if(!_[_0x9a97('0x87')](_0x111196[_0x9a97('0x26')])){_0x111196[_0x9a97('0x26')]=undefined;loggerPredictive['info'](_0x111196[_0x9a97('0x42')],_0x9a97('0x92'));}if(!_[_0x9a97('0x87')](_0x111196['startPredictive'])){_0x111196[_0x9a97('0x25')]=undefined;loggerPredictive[_0x9a97('0x7e')](_0x111196['name'],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x9a97('0x87')](_0x111196[_0x9a97('0x93')])){clearInterval(_0x111196[_0x9a97('0x93')]);_0x111196[_0x9a97('0x93')]=undefined;loggerPredictive[_0x9a97('0x7e')](_0x111196[_0x9a97('0x42')],_0x9a97('0x94'));}}}function erlangb(_0x4fc562,_0xd836a8){if(_0xd836a8===0x0){return 0x0;}var _0x395ff3=0x1;for(var _0x5aa966=0x1;_0x5aa966<=_0xd836a8;_0x5aa966+=0x1){_0x395ff3=0x1+_0x395ff3*_0x5aa966/_0x4fc562;}return 0x1/_0x395ff3;}function isVoiceQueueOutbound(_0x5c87b0){return _0x5c87b0===_0x9a97('0x4f');}function isNotPreview(_0x109ea0){return _0x109ea0!=='preview';}function isCampaignIvr(_0x156c19){return _0x156c19==='ivr';}function getCallerId(_0x25a8ce,_0x53c148,_0x5a4d22){if(!_[_0x9a97('0x87')](_0x5a4d22)&&typeof _0x5a4d22===_0x9a97('0x95')&&!_['isEmpty'](_0x5a4d22)){if(!_['isUndefined'](_0x53c148)&&typeof _0x53c148==='string'&&!_[_0x9a97('0x47')](_0x53c148)){return util[_0x9a97('0x78')](_0x9a97('0x96'),_0x53c148,_0x5a4d22);}return util[_0x9a97('0x78')](_0x9a97('0x96'),_0x5a4d22,_0x5a4d22);}if(!_[_0x9a97('0x87')](_0x25a8ce)&&typeof _0x25a8ce===_0x9a97('0x95')&&!_[_0x9a97('0x47')](_0x25a8ce)){return _0x25a8ce;}return _0x9a97('0x97');}function loggerCatchQueueSummary(_0x1120b8,_0x56ae22){return function(_0x24f80b){freeVariablesPredictive(_0x56ae22);emitVoiceQueueSummary(_0x56ae22);emitCampaignSummary(_0x56ae22);loggerSyncQueueSummary[_0x9a97('0x98')](_0x1120b8,util[_0x9a97('0x99')](_0x24f80b,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x342d85,_0x22d0bc){return function(_0x4b26d5){loggerPredictive['error'](_0x22d0bc['name'],_0x342d85);loggerPredictive[_0x9a97('0x98')](_0x4b26d5[_0x9a97('0x9a')]);freeVariablesPredictive(_0x22d0bc);};}function loggerCatch(_0x2d4b76){return function(_0x2cb5cf){logger[_0x9a97('0x98')](_0x2d4b76,util[_0x9a97('0x99')](_0x2cb5cf,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x501e0f){return _0x501e0f&&!_[_0x9a97('0x87')](_0x501e0f)&&_0x501e0f[_0x9a97('0x9b')]>0x0;}function decremetOriginate(_0xe8e5d6){if(!_[_0x9a97('0x87')](_0xe8e5d6)&&_0xe8e5d6!==null){if(typeof _0xe8e5d6[_0x9a97('0x9c')]!==_0x9a97('0x9d')){if(_0xe8e5d6[_0x9a97('0x9c')]>0x0){_0xe8e5d6['originated']-=0x1;}else{logger['error'](_0x9a97('0x9e'));}}}else{logger[_0x9a97('0x98')](_0x9a97('0x9f'));}}function checkContactLowerLimitOriginate(_0x31988c,_0x3c2606,_0x3040f7){if(_0x3c2606>_0x3040f7){for(var _0x258786=0x0;_0x258786<_0x3c2606-_0x3040f7;_0x258786+=0x1){decremetOriginate(_0x31988c);}}}function loggerGetContactDialer(_0x41b2fb,_0x3a0d79,_0x530d18){return function(_0x42b3cb){checkContactLowerLimitOriginate(_0x3a0d79,_0x530d18,0x0);logger['error'](_0x41b2fb,util[_0x9a97('0x99')](_0x42b3cb,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3f1a49){return function(_0x38c4ae){if(isNotNull(_0x38c4ae)&&isNotNull(_0x38c4ae[0x0])){if(_0x38c4ae[0x0]['contactsRescheduled']>0x0){_0x3f1a49[_0x9a97('0x3e')]='RESCHEDULED_CONTACTS';logger['info']('[getContactDialer2][ReScheduled]'+_0x3f1a49['name'],_0x38c4ae[0x0][_0x9a97('0xa0')],_0x9a97('0xa1'));}else{_0x3f1a49[_0x9a97('0x3e')]='AVAILABLE_CONTACTS_FINISHED';logger['info'](_0x9a97('0xa2')+_0x3f1a49[_0x9a97('0x42')]);}}};}function notSendMessagesQueue(_0x194376){if(_0x194376['sendMessageOneNotActive']){freeVariablesPredictive(_0x194376);if(_0x194376['originated']===0x0&&_0x194376[_0x9a97('0x56')]===0x0&&_0x194376[_0x9a97('0xa3')]===0x0&&(_0x194376['pTalking']||0x0)===0x0){_0x194376['sendMessageOneNotActive']=![];_0x194376['available']=0x0;_0x194376[_0x9a97('0x3e')]=_0x9a97('0x41');loggerSyncQueueSummary[_0x9a97('0x98')](_0x9a97('0xa4'),_0x194376[_0x9a97('0x42')],_0x9a97('0xa5'));}else{_0x194376[_0x9a97('0x3e')]=_0x9a97('0xa6');loggerSyncQueueSummary[_0x9a97('0x98')](_0x9a97('0xa4'),_0x194376[_0x9a97('0x42')],_0x9a97('0xa7'));}emitVoiceQueueSummary(_0x194376);}}function notSendMessagesCampaign(_0x3d383b){if(_0x3d383b[_0x9a97('0xa8')]){if(_0x3d383b[_0x9a97('0x9c')]===0x0){_0x3d383b['sendMessageOneNotActive']=![];_0x3d383b[_0x9a97('0x3e')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x9a97('0x98')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x3d383b[_0x9a97('0x42')],_0x9a97('0xa5'));}else{_0x3d383b[_0x9a97('0x3e')]=_0x9a97('0xa6');loggerSyncQueueSummary[_0x9a97('0x98')](_0x9a97('0xa9'),_0x3d383b[_0x9a97('0x42')],_0x9a97('0xa7'));}emitCampaignSummary(_0x3d383b);}}function createObjHistory(_0x56d172,_0x14a5f9,_0x1ae85d,_0x1ef0a1,_0x1aff14){_0x56d172[_0x9a97('0x3e')]=_0x1ae85d;var _0x4e501b=new Action(_0x56d172,_0x14a5f9);var _0x23c10c=new History(_0x4e501b);_0x23c10c['state']=_0x1ef0a1;_0x23c10c['statedesc']=_0x1aff14;_0x23c10c[_0x9a97('0xaa')]=_0x4e501b['starttime'];return _0x23c10c;}Dialer[_0x9a97('0xab')][_0x9a97('0x3d')]=function(){var _0x17b24f=this;setInterval(function(){_0x17b24f[_0x9a97('0xac')](_0x17b24f[_0x9a97('0xad')],_0x9a97('0xae'));_0x17b24f[_0x9a97('0xac')](_0x17b24f[_0x9a97('0x24')],'[actions]');},0x32c8);};Dialer[_0x9a97('0xab')][_0x9a97('0xac')]=function(_0x2047ff,_0x2f08fd){var _0x3e4442=this;for(var _0x12e466 in _0x2047ff){if(typeof _0x2047ff[_0x12e466]!==_0x9a97('0x9d')){this['sequence'][_0x9a97('0x1a')](function(){if(!_[_0x9a97('0xaf')](_0x2047ff[_0x12e466])){return ami['Action']({'action':_0x9a97('0xb0'),'channel':_0x2047ff[_0x12e466]['channel']})[_0x9a97('0xb1')](function(_0x58a608){if(_0x58a608['message']===_0x9a97('0xb2')){setTimeout(function(){if(_0x2047ff[_0x12e466]&&_0x2047ff[_0x12e466]['type']!=='ivr'){_0x3e4442['updateOriginated'](_0x3e4442[_0x9a97('0x1e')][_0x2047ff[_0x12e466]['queue']]);logger[_0x9a97('0x98')]('[Dialer][checkChannel]',_0x2f08fd,_0x12e466,_0x2047ff[_0x12e466][_0x9a97('0xb3')]);delete _0x2047ff[_0x12e466];}if(_0x2047ff[_0x12e466]&&_0x2047ff[_0x12e466][_0x9a97('0x4e')]===_0x9a97('0x7b')){_0x3e4442['updateOriginated'](_0x3e4442['campaigns'][_0x2047ff[_0x12e466][_0x9a97('0xb3')]]);logger[_0x9a97('0x98')]('[Dialer][checkChannel][ivr]',_0x2f08fd,_0x12e466,_0x2047ff[_0x12e466][_0x9a97('0xb3')]);delete _0x2047ff[_0x12e466];}},0x2328);}});}});}}};Dialer['prototype'][_0x9a97('0xb4')]=function(_0x44a84e){return BPromise[_0x9a97('0xb5')]()['then'](cmHopper[_0x9a97('0xb4')](_0x44a84e))['catch'](loggerCatch(_0x9a97('0xb6')));};Dialer['prototype'][_0x9a97('0xb7')]=function(_0x416f02){return BPromise[_0x9a97('0xb5')]()[_0x9a97('0xb8')](cmHopperBlack[_0x9a97('0xb7')](_0x416f02))[_0x9a97('0xb1')](loggerCatch(_0x9a97('0xb9')));};Dialer[_0x9a97('0xab')][_0x9a97('0xba')]=function(_0x507341){return BPromise[_0x9a97('0xb5')]()[_0x9a97('0xb8')](cmHopperBlack[_0x9a97('0xba')](_0x507341))['catch'](loggerCatch(_0x9a97('0xbb')));};Dialer[_0x9a97('0xab')][_0x9a97('0xbc')]=function(_0x206d18){return BPromise['resolve']()[_0x9a97('0xb8')](cmHopperHistory[_0x9a97('0xbd')](_0x206d18))[_0x9a97('0xb1')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0x9a97('0xab')]['rescheduleContact']=function(_0x4f7403){return BPromise[_0x9a97('0xb5')]()['then'](cmHopper[_0x9a97('0xbe')](_0x4f7403))[_0x9a97('0xb1')](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x9a97('0xab')][_0x9a97('0xbf')]=function(_0x19c1dd,_0x25535f,_0x17d3f7){return BPromise[_0x9a97('0xb5')]()[_0x9a97('0xb8')](cmHopper[_0x9a97('0xbf')](_0x19c1dd,_0x25535f,_0x17d3f7))[_0x9a97('0xb1')](loggerCatch(_0x9a97('0xc0')));};Dialer[_0x9a97('0xab')][_0x9a97('0xc1')]=function(_0x358fb7,_0x2396d5,_0x38ced1,_0x16c228,_0x2da46e){return BPromise[_0x9a97('0xb5')]()[_0x9a97('0xb8')](cmHopper[_0x9a97('0xc1')](_0x358fb7,_0x2396d5,_0x38ced1,_0x16c228))[_0x9a97('0xb1')](function(_0x205f13){_0x2da46e[_0x9a97('0xc2')]-=_0x38ced1;_0x2da46e[_0x9a97('0xc2')]=_0x2da46e[_0x9a97('0xc2')]>0x0?_0x2da46e[_0x9a97('0xc2')]:0x0;loggerCatch(_0x9a97('0xc3'))(_0x205f13);});};Dialer['prototype'][_0x9a97('0xc4')]=function(_0x44c005,_0x2508d3,_0x491642,_0x462e3d){return BPromise[_0x9a97('0xb5')]()['then'](cmHopper[_0x9a97('0xc4')](_0x44c005,_0x2508d3,_0x491642))['catch'](function(_0x2012da){_0x462e3d[_0x9a97('0xc2')]-=_0x2508d3;_0x462e3d[_0x9a97('0xc2')]=_0x462e3d[_0x9a97('0xc2')]>0x0?_0x462e3d[_0x9a97('0xc2')]:0x0;loggerCatch(_0x9a97('0xc5'))(_0x2012da);});};Dialer['prototype'][_0x9a97('0xc6')]=function(_0xa72f22){return BPromise[_0x9a97('0xb5')]()[_0x9a97('0xb8')](voiceQueueRt[_0x9a97('0xc6')](_0xa72f22))[_0x9a97('0xb1')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x9a97('0xab')][_0x9a97('0xc7')]=function(_0x28b9a7){return BPromise['resolve']()['then'](cmHopper[_0x9a97('0xc7')](_0x28b9a7))[_0x9a97('0xb1')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0x9a97('0xab')][_0x9a97('0xc8')]=function(_0x160322){return BPromise[_0x9a97('0xb5')]()['then'](cmHopperHistory[_0x9a97('0xc8')](_0x160322))[_0x9a97('0xb1')](loggerCatch('[createHistory]\x20'));};Dialer[_0x9a97('0xab')]['updateOriginated']=function(_0x44e9cd){if(!_[_0x9a97('0x87')](_0x44e9cd)&&_0x44e9cd!==null){if(typeof _0x44e9cd[_0x9a97('0x9c')]!==_0x9a97('0x9d')){if(_0x44e9cd[_0x9a97('0x9c')]>0x0){_0x44e9cd[_0x9a97('0x9c')]-=0x1;}else{logger['error'](_0x9a97('0xc9'));}}}else{logger[_0x9a97('0x98')](_0x9a97('0xca'));}};Dialer[_0x9a97('0xab')][_0x9a97('0xcb')]=function(_0x262dac,_0x496757){var _0x16e989=this;return function(_0x156cdf){_0x16e989[_0x9a97('0xcc')](_0x496757);logger[_0x9a97('0x98')](_0x262dac,util['inspect'](_0x156cdf,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0x14ec48,_0x349e31,_0xf75483){var _0x259fb6={'state':0x19,'statedesc':_0x9a97('0xcd')};this['updateOriginated'](_0x349e31);this['saveInDb'](_[_0x9a97('0xce')](_0x259fb6,_['pick'](_0xf75483,[_0x9a97('0xcf'),_0x9a97('0xd0'),'UserId',_0x9a97('0xd1'),_0x9a97('0xd2')])),_0x9a97('0xd3'),_0x9a97('0xd4'));logger[_0x9a97('0x98')](_0x14ec48);};Dialer[_0x9a97('0xab')][_0x9a97('0xd5')]=function(_0x4840fd){return _0x4840fd==='Success';};Dialer['prototype'][_0x9a97('0xd6')]=function(_0x205194){return!_[_0x9a97('0x87')](_0x205194)&&_0x205194&&!_[_0x9a97('0x87')](_0x205194['name'])&&!_[_0x9a97('0x87')](_0x205194[_0x9a97('0x76')])&&_0x205194[_0x9a97('0x76')]&&(this[_0x9a97('0x21')][util['format']('SIP/%s',_0x205194[_0x9a97('0x42')])]['status']===_0x9a97('0xd7')||this[_0x9a97('0x21')][util['format'](_0x9a97('0xd8'),_0x205194[_0x9a97('0x42')])][_0x9a97('0xb0')]==='unmonitored');};Dialer[_0x9a97('0xab')]['saveInDb']=function(_0x12b98b,_0x4a5f3d,_0x2fcb92){this[_0x9a97('0xc8')](_0x12b98b)[_0x9a97('0xb1')](loggerCatch(_0x4a5f3d));this[_0x9a97('0xc7')](_0x12b98b)[_0x9a97('0xb1')](loggerCatch(_0x2fcb92));};Dialer[_0x9a97('0xab')][_0x9a97('0x38')]=function(_0x4a2e4e){var _0x15d11c=this['uniqueId'][_0x4a2e4e[_0x9a97('0xd9')]];var _0x1d8b4a;if(!_['isNil'](_0x4a2e4e)&&!_[_0x9a97('0xaf')](_0x4a2e4e[_0x9a97('0xda')])&&!_[_0x9a97('0xaf')](_0x4a2e4e[_0x9a97('0xda')][_0x9a97('0xdb')])&&_0x4a2e4e[_0x9a97('0xdc')]===_0x9a97('0xdd')&&_0x15d11c){if(_0x15d11c[_0x9a97('0x4e')]!==_0x9a97('0x7b')&&this[_0x9a97('0x1e')][_0x15d11c[_0x9a97('0xb3')]][_0x9a97('0xde')]&&_0x4a2e4e['value']===_0x9a97('0xdf')){delete this[_0x9a97('0xad')][_0x4a2e4e[_0x9a97('0xd9')]];this[_0x9a97('0xcc')](this[_0x9a97('0x1e')][_0x15d11c[_0x9a97('0xb3')]]);this['voiceQueues'][_0x15d11c['queue']]['outboundAnswerCallsDay']+=0x1;this[_0x9a97('0x1e')][_0x15d11c[_0x9a97('0xb3')]][_0x9a97('0x5f')]+=0x1;_0x1d8b4a=new Hangup(_0x15d11c,_0x4a2e4e);_0x1d8b4a[_0x9a97('0xe0')]=0x12;_0x1d8b4a[_0x9a97('0xe1')]=_0x9a97('0xe2');_0x1d8b4a[_0x9a97('0xe3')]=_0x9a97('0xe4');ami[_0x9a97('0x4d')](_0x9a97('0xe5'),ut['buildObj'](_0x1d8b4a,_0x9a97('0xe6')));this[_0x9a97('0xe7')](_0x1d8b4a,_0x9a97('0xe8'),_0x9a97('0xe9'));}if(_0x15d11c[_0x9a97('0x4e')]!=='ivr'&&this[_0x9a97('0x1e')][_0x15d11c['queue']][_0x9a97('0xde')]&&_0x4a2e4e['value']==='MACHINE'){var _0x3d9354=this;return new BPromise(function(_0x295f1c,_0x27424a){delete _0x3d9354['uniqueId'][_0x4a2e4e[_0x9a97('0xd9')]];_0x3d9354['updateOriginated'](_0x3d9354[_0x9a97('0x1e')][_0x15d11c['queue']]);_0x3d9354[_0x9a97('0x1e')][_0x15d11c[_0x9a97('0xb3')]][_0x9a97('0x60')]+=0x1;_0x3d9354[_0x9a97('0x1e')][_0x15d11c['queue']][_0x9a97('0x5f')]+=0x1;var _0x1faac0=_0x3d9354[_0x9a97('0x1e')][_0x15d11c[_0x9a97('0xb3')]];var _0x487295=new Hangup(_0x15d11c,_0x4a2e4e);_0x487295[_0x9a97('0xe0')]=0x13;_0x487295[_0x9a97('0xe1')]=_0x9a97('0xea');_0x487295[_0x9a97('0xe3')]=_0x9a97('0xe4');_0x487295[_0x9a97('0xeb')]+=0x1;_0x487295[_0x9a97('0xec')]+=0x1;_0x487295['amd']=!![];ami[_0x9a97('0x4d')](_0x9a97('0xe5'),ut[_0x9a97('0xed')](_0x487295,'amd'));_0x3d9354['createHistory'](_0x487295)[_0x9a97('0xb1')](loggerCatch(_0x9a97('0xee')));if(_0x487295[_0x9a97('0xef')]+_0x487295[_0x9a97('0xf0')]+_0x487295['countnoanswerretry']+_0x487295[_0x9a97('0xf1')]+_0x487295[_0x9a97('0xf2')]+_0x487295[_0x9a97('0xf3')]+_0x487295[_0x9a97('0xeb')]+_0x487295[_0x9a97('0xf4')]>=_0x1faac0[_0x9a97('0xf5')]){_0x3d9354[_0x9a97('0xf6')](_0x487295,_0x295f1c,_0x27424a,_0x9a97('0xf7'));}else{if(_0x487295[_0x9a97('0xeb')]>=_0x1faac0[_0x9a97('0xf8')]){_0x3d9354[_0x9a97('0xf9')](_0x487295,_0x295f1c,_0x27424a,_0x9a97('0xfa'));}else{_0x3d9354['rescheduleContact']({'active':![],'countmachineretry':_0x487295[_0x9a97('0xeb')],'scheduledat':moment()[_0x9a97('0xfb')](_0x1faac0[_0x9a97('0xfc')],_0x9a97('0xfd'))['format'](_0x9a97('0xfe')),'ContactId':_0x487295[_0x9a97('0xcf')],'ListId':_0x487295['ListId'],'VoiceQueueId':_0x487295[_0x9a97('0xd1')]||undefined,'CampaignId':_0x487295[_0x9a97('0xd2')]||undefined})[_0x9a97('0xb1')](loggerCatch(_0x9a97('0xff')));_0x295f1c({'reschedule':0x1});}}});}if(_0x15d11c['type']==='ivr'&&this[_0x9a97('0x1f')][_0x15d11c[_0x9a97('0xb3')]][_0x9a97('0xde')]&&_0x4a2e4e[_0x9a97('0x100')]==='HANGUP'){delete this[_0x9a97('0xad')][_0x4a2e4e[_0x9a97('0xd9')]];this[_0x9a97('0xcc')](this[_0x9a97('0x1f')][_0x15d11c[_0x9a97('0xb3')]]);_0x1d8b4a=new Hangup(_0x15d11c,_0x4a2e4e);_0x1d8b4a[_0x9a97('0xe0')]=0x12;_0x1d8b4a[_0x9a97('0xe1')]=_0x9a97('0xe2');_0x1d8b4a[_0x9a97('0xe3')]='AMD';ami[_0x9a97('0x4d')](_0x9a97('0xe5'),ut[_0x9a97('0xed')](_0x1d8b4a,'amd'));this[_0x9a97('0xe7')](_0x1d8b4a,'[syncHangupInAMDIvr][createHistory]',_0x9a97('0x101'));}if(_0x15d11c['type']==='ivr'&&this['campaigns'][_0x15d11c[_0x9a97('0xb3')]][_0x9a97('0xde')]&&_0x4a2e4e[_0x9a97('0x100')]===_0x9a97('0x102')){var _0x3d9354=this;return new BPromise(function(_0x425719,_0x3c291d){delete _0x3d9354[_0x9a97('0xad')][_0x4a2e4e[_0x9a97('0xd9')]];_0x3d9354[_0x9a97('0xcc')](_0x3d9354['campaigns'][_0x15d11c[_0x9a97('0xb3')]]);_0x3d9354[_0x9a97('0x1f')][_0x15d11c[_0x9a97('0xb3')]][_0x9a97('0x60')]+=0x1;_0x3d9354[_0x9a97('0x1f')][_0x15d11c[_0x9a97('0xb3')]][_0x9a97('0x5f')]+=0x1;var _0x6a7ee=_0x3d9354[_0x9a97('0x1f')][_0x15d11c[_0x9a97('0xb3')]];var _0x4995c1=new Hangup(_0x15d11c,_0x4a2e4e);_0x4995c1['state']=0x13;_0x4995c1[_0x9a97('0xe1')]=_0x9a97('0xea');_0x4995c1[_0x9a97('0xe3')]=_0x9a97('0xe4');_0x4995c1[_0x9a97('0xeb')]+=0x1;_0x4995c1[_0x9a97('0xec')]+=0x1;_0x4995c1['amd']=!![];ami[_0x9a97('0x4d')]('custom:amd',ut[_0x9a97('0xed')](_0x4995c1,_0x9a97('0xe6')));_0x3d9354[_0x9a97('0xc8')](_0x4995c1)[_0x9a97('0xb1')](loggerCatch(_0x9a97('0xee')));if(_0x4995c1[_0x9a97('0xef')]+_0x4995c1[_0x9a97('0xf0')]+_0x4995c1[_0x9a97('0x103')]+_0x4995c1[_0x9a97('0xf1')]+_0x4995c1['countdropretry']+_0x4995c1[_0x9a97('0xf3')]+_0x4995c1['countmachineretry']+_0x4995c1[_0x9a97('0xf4')]>=_0x6a7ee[_0x9a97('0xf5')]){_0x3d9354['stateGlobal'](_0x4995c1,_0x425719,_0x3c291d,_0x9a97('0xf7'));}else{if(_0x4995c1[_0x9a97('0xeb')]>=_0x6a7ee[_0x9a97('0xf8')]){_0x3d9354[_0x9a97('0xf9')](_0x4995c1,_0x425719,_0x3c291d,'reason\x2019\x20machine....');}else{_0x3d9354[_0x9a97('0xbe')]({'active':![],'countmachineretry':_0x4995c1[_0x9a97('0xeb')],'scheduledat':moment()['add'](_0x6a7ee[_0x9a97('0xfc')],_0x9a97('0xfd'))[_0x9a97('0x78')](_0x9a97('0xfe')),'ContactId':_0x4995c1[_0x9a97('0xcf')],'ListId':_0x4995c1[_0x9a97('0xd0')],'VoiceQueueId':_0x4995c1[_0x9a97('0xd1')]||undefined,'CampaignId':_0x4995c1[_0x9a97('0xd2')]||undefined})['catch'](loggerCatch(_0x9a97('0xff')));_0x425719({'reschedule':0x1});}}});}}};Dialer[_0x9a97('0xab')]['syncHangup']=function(_0x2abdf9){var _0x23696f=this['uniqueId'][_0x2abdf9['uniqueid']];var _0x2e172d=this;var _0x508ff8;if(_0x23696f&&_0x23696f[_0x9a97('0x4e')]===_0x9a97('0x7b')){delete this[_0x9a97('0xad')][_0x2abdf9[_0x9a97('0xd9')]];this['updateOriginated'](this[_0x9a97('0x1f')][_0x23696f[_0x9a97('0xb3')]]);this[_0x9a97('0x1f')][_0x23696f['queue']][_0x9a97('0x104')]+=0x1;_0x508ff8=new Hangup(_0x23696f,_0x2abdf9);this['createHistory'](_0x508ff8)[_0x9a97('0xb1')](loggerCatch(_0x9a97('0x105')));this[_0x9a97('0xc7')](_0x508ff8)[_0x9a97('0xb1')](loggerCatch(_0x9a97('0x106')));}if(_0x23696f&&_0x23696f[_0x9a97('0x4e')]!==_0x9a97('0x7b')&&isNotNull(this['voiceQueues'][_0x23696f[_0x9a97('0xb3')]][_0x9a97('0x107')])){delete this[_0x9a97('0xad')][_0x2abdf9['uniqueid']];this[_0x9a97('0xcc')](this['voiceQueues'][_0x23696f[_0x9a97('0xb3')]]);this['voiceQueues'][_0x23696f[_0x9a97('0xb3')]]['outboundAnswerCallsDay']+=0x1;this[_0x9a97('0x1e')][_0x23696f[_0x9a97('0xb3')]][_0x9a97('0x5f')]+=0x1;_0x508ff8=new Hangup(_0x23696f,_0x2abdf9);_0x508ff8[_0x9a97('0xe0')]=0x10;_0x508ff8[_0x9a97('0xe1')]='AnswerAGI';_0x508ff8[_0x9a97('0xe3')]=_0x9a97('0x108');this[_0x9a97('0xc8')](_0x508ff8)[_0x9a97('0xb1')](loggerCatch(_0x9a97('0x105')));this[_0x9a97('0xc7')](_0x508ff8)[_0x9a97('0xb1')](loggerCatch(_0x9a97('0x106')));}if(_0x23696f&&_0x23696f[_0x9a97('0x4e')]!=='ivr'&&!isNotNull(this[_0x9a97('0x1e')][_0x23696f['queue']]['dialQueueProject'])){delete this[_0x9a97('0xad')][_0x2abdf9[_0x9a97('0xd9')]];this[_0x9a97('0xcc')](this[_0x9a97('0x1e')][_0x23696f[_0x9a97('0xb3')]]);this[_0x9a97('0x1e')][_0x23696f[_0x9a97('0xb3')]][_0x9a97('0x69')]+=0x1;_0x508ff8=new Hangup(_0x23696f,_0x2abdf9);_0x508ff8['state']=0xc;_0x508ff8[_0x9a97('0xe1')]=_0x2abdf9['cause-txt'];_0x508ff8['membername']=_0x9a97('0x109');this['createHistory'](_0x508ff8)[_0x9a97('0xb1')](loggerCatch(_0x9a97('0x105')));this['moveContactManagedDialer'](_0x508ff8)[_0x9a97('0xb1')](loggerCatch(_0x9a97('0x106')));}};Dialer[_0x9a97('0xab')][_0x9a97('0x30')]=function(_0x15f7a8){var _0x14360c=this['uniqueId'][_0x15f7a8[_0x9a97('0xd9')]];var _0x50d226=this;if(this[_0x9a97('0x1e')][_0x15f7a8[_0x9a97('0xb3')]]){if(_0x14360c&&_0x14360c[_0x9a97('0x4e')]!==_0x9a97('0x7b')){delete this[_0x9a97('0xad')][_0x15f7a8[_0x9a97('0xd9')]];this['voiceQueues'][_0x15f7a8['queue']][_0x9a97('0x60')]+=0x1;var _0x5e8262=new AgentComplete(_0x14360c,_0x15f7a8);if(_0x15f7a8[_0x9a97('0x10a')]==='agent'){_0x5e8262[_0x9a97('0x10b')]=this[_0x9a97('0x1e')][_0x15f7a8['queue']]['dialQueueProject2']&&this[_0x9a97('0x1e')][_0x15f7a8[_0x9a97('0xb3')]][_0x9a97('0x10c')]?moment()[_0x9a97('0x78')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x9a97('0xc8')](_0x5e8262)[_0x9a97('0xb1')](loggerCatch(_0x9a97('0x10d')));this[_0x9a97('0xc7')](_0x5e8262)['catch'](loggerCatch(_0x9a97('0x10e')));}}};Dialer['prototype'][_0x9a97('0x2b')]=function(_0x4a9002){if(this['voiceQueues'][_0x4a9002[_0x9a97('0xb3')]]){if(this[_0x9a97('0xad')][_0x4a9002[_0x9a97('0xd9')]]&&this[_0x9a97('0xad')][_0x4a9002[_0x9a97('0xd9')]][_0x9a97('0x4e')]!==_0x9a97('0x7b')){this['updateOriginated'](this[_0x9a97('0x1e')][_0x4a9002[_0x9a97('0xb3')]]);this['uniqueId'][_0x4a9002[_0x9a97('0xd9')]][_0x9a97('0x10f')]=moment()[_0x9a97('0x78')](_0x9a97('0xfe'));}}};Dialer[_0x9a97('0xab')][_0x9a97('0x110')]=function(_0x5f31ef){this[_0x9a97('0xc8')](_0x5f31ef)[_0x9a97('0xb1')](loggerCatch(_0x9a97('0x10d')));this[_0x9a97('0xc7')](_0x5f31ef)[_0x9a97('0xb1')](loggerCatch(_0x9a97('0x111')));};Dialer[_0x9a97('0xab')][_0x9a97('0x2e')]=function(_0x516fb1){var _0x5adb28=this[_0x9a97('0xad')][_0x516fb1[_0x9a97('0xd9')]];var _0xed477b=this;if(this[_0x9a97('0x1e')][_0x516fb1['queue']]){if(_0x5adb28&&_0x5adb28[_0x9a97('0x4e')]!==_0x9a97('0x7b')){delete this[_0x9a97('0xad')][_0x516fb1[_0x9a97('0xd9')]];this['updateOriginated'](this['voiceQueues'][_0x516fb1[_0x9a97('0xb3')]]);_0x5adb28[_0x9a97('0x112')]=moment()[_0x9a97('0x78')](_0x9a97('0xfe'));var _0x2b8b65=new QueueCallerAbandon(_0x5adb28,_0x516fb1);if(getSeconds(_0x5adb28['droptime'],_0x5adb28[_0x9a97('0x113')])>=_0x5adb28[_0x9a97('0x114')]){this[_0x9a97('0x1e')][_0x516fb1[_0x9a97('0xb3')]][_0x9a97('0x6b')]+=0x1;this['voiceQueues'][_0x516fb1['queue']]['outboundDropCallsDayTimeout']+=0x1;this[_0x9a97('0x1e')][_0x516fb1[_0x9a97('0xb3')]][_0x9a97('0x6d')]+=0x1;_0x2b8b65[_0x9a97('0xe0')]=0xa;_0x2b8b65[_0x9a97('0xe1')]=_0x9a97('0x115');_0x2b8b65[_0x9a97('0x116')]='TIMEOUT';_0x2b8b65[_0x9a97('0x10b')]=this[_0x9a97('0x1e')][_0x516fb1[_0x9a97('0xb3')]][_0x9a97('0x117')]?moment()[_0x9a97('0x78')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x2b8b65['countdropretry']+=0x1;_0x2b8b65[_0x9a97('0xec')]+=0x1;if(_0x2b8b65[_0x9a97('0xf2')]>=this[_0x9a97('0x1e')][_0x516fb1[_0x9a97('0xb3')]][_0x9a97('0x118')]){this[_0x9a97('0x110')](_0x2b8b65);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x2b8b65[_0x9a97('0xf2')],'scheduledat':moment()['add'](this[_0x9a97('0x1e')][_0x516fb1[_0x9a97('0xb3')]][_0x9a97('0x119')],_0x9a97('0xfd'))[_0x9a97('0x78')](_0x9a97('0xfe')),'ContactId':_0x5adb28[_0x9a97('0xcf')],'ListId':_0x5adb28[_0x9a97('0xd0')],'VoiceQueueId':_0x5adb28[_0x9a97('0xd1')]||undefined,'CampaignId':_0x5adb28[_0x9a97('0xd2')]||undefined})[_0x9a97('0xb1')](loggerCatch(_0x9a97('0x11a')));var _0xa699b4=new History(_0x2b8b65);_0xa699b4[_0x9a97('0xe0')]=0xa;_0xa699b4[_0x9a97('0xe1')]=_0x9a97('0x115');_0xa699b4['starttime']=moment()[_0x9a97('0x78')](_0x9a97('0xfe'));_0xa699b4[_0x9a97('0xaa')]=_0xa699b4['starttime'];_0xa699b4['calleridname']=_0x2b8b65[_0x9a97('0x11b')];_0xa699b4[_0x9a97('0x11c')]=_0x2b8b65[_0x9a97('0x11c')];this[_0x9a97('0xc8')](_0xa699b4)[_0x9a97('0xb1')](loggerCatch(_0x9a97('0x11d')));}}else{this[_0x9a97('0x1e')][_0x516fb1[_0x9a97('0xb3')]][_0x9a97('0x82')]+=0x1;this[_0x9a97('0x1e')][_0x516fb1[_0x9a97('0xb3')]][_0x9a97('0x64')]+=0x1;_0x2b8b65[_0x9a97('0xe0')]=0xb;_0x2b8b65[_0x9a97('0xe1')]=_0x9a97('0x11e');_0x2b8b65[_0x9a97('0x116')]=_0x9a97('0x11f');_0x2b8b65[_0x9a97('0xf3')]+=0x1;_0x2b8b65['countglobal']+=0x1;if(_0x2b8b65[_0x9a97('0xf3')]>=this[_0x9a97('0x1e')][_0x516fb1[_0x9a97('0xb3')]]['dialAbandonedMaxRetry']){this[_0x9a97('0x110')](_0x2b8b65);}else{this[_0x9a97('0xbe')]({'active':![],'countabandonedretry':_0x2b8b65['countabandonedretry'],'scheduledat':moment()[_0x9a97('0xfb')](this[_0x9a97('0x1e')][_0x516fb1[_0x9a97('0xb3')]]['dialAbandonedRetryFrequency'],_0x9a97('0xfd'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5adb28[_0x9a97('0xcf')],'ListId':_0x5adb28[_0x9a97('0xd0')],'VoiceQueueId':_0x5adb28[_0x9a97('0xd1')]||undefined,'CampaignId':_0x5adb28['CampaignId']||undefined})[_0x9a97('0xb1')](loggerCatch('[rescheduleContact][Abandoned]'));var _0xa699b4=new History(_0x2b8b65);_0xa699b4[_0x9a97('0xe0')]=0xb;_0xa699b4[_0x9a97('0xe1')]=_0x9a97('0x11e');_0xa699b4[_0x9a97('0x120')]=moment()[_0x9a97('0x78')]('YYYY-MM-DD\x20HH:mm:ss');_0xa699b4[_0x9a97('0xaa')]=_0xa699b4['starttime'];_0xa699b4[_0x9a97('0x11b')]=_0x2b8b65[_0x9a97('0x11b')];_0xa699b4[_0x9a97('0x11c')]=_0x2b8b65[_0x9a97('0x11c')];this['createHistory'](_0xa699b4)[_0x9a97('0xb1')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0x9a97('0xab')][_0x9a97('0x36')]=function(_0x5ac3d0){if(this['actions'][_0x5ac3d0[_0x9a97('0xd9')]]){this[_0x9a97('0x24')][_0x5ac3d0[_0x9a97('0xd9')]]['channel']=_0x5ac3d0['channel'];}if(this['uniqueId'][_0x5ac3d0[_0x9a97('0xd9')]]){this[_0x9a97('0xad')][_0x5ac3d0[_0x9a97('0xd9')]][_0x9a97('0x121')]=_0x5ac3d0[_0x9a97('0x121')];}};Dialer['prototype'][_0x9a97('0x122')]=function(_0x3385dd){if(strategy[this[_0x9a97('0x1e')][this['actions'][_0x3385dd[_0x9a97('0x123')]][_0x9a97('0xb3')]][_0x9a97('0x50')]]===_0x9a97('0x19')){if(this[_0x9a97('0x24')][_0x3385dd[_0x9a97('0x123')]]&&_[_0x9a97('0xaf')](this[_0x9a97('0x24')][_0x3385dd[_0x9a97('0x123')]][_0x9a97('0x124')])&&_0x3385dd[_0x9a97('0xb0')]==='1'&&_0x3385dd[_0x9a97('0x125')]==='0'){if(this[_0x9a97('0x20')][_0x3385dd['stateinterface']]){if(!this[_0x9a97('0x20')][_0x3385dd[_0x9a97('0x126')]][_0x9a97('0x124')]){this[_0x9a97('0x20')][_0x3385dd[_0x9a97('0x126')]][_0x9a97('0x124')]=!![];this[_0x9a97('0x24')][_0x3385dd[_0x9a97('0x123')]][_0x9a97('0x124')]=!![];this[_0x9a97('0x24')][_0x3385dd[_0x9a97('0x123')]][_0x9a97('0x126')]=_0x3385dd[_0x9a97('0x126')];}}}}else if((strategy[this[_0x9a97('0x1e')][this[_0x9a97('0x24')][_0x3385dd[_0x9a97('0x123')]][_0x9a97('0xb3')]][_0x9a97('0x50')]]||_0x9a97('0x18'))===_0x9a97('0x18')){if(this[_0x9a97('0x24')][_0x3385dd[_0x9a97('0x123')]]){if(this[_0x9a97('0x20')][_0x3385dd[_0x9a97('0x126')]]){this[_0x9a97('0x24')][_0x3385dd[_0x9a97('0x123')]][_0x9a97('0x126')]=_0x3385dd[_0x9a97('0x126')];if(_['isNil'](this['queueBooked'][this['actions'][_0x3385dd['actionid']]['queue']])){this['queueBooked'][this[_0x9a97('0x24')][_0x3385dd[_0x9a97('0x123')]][_0x9a97('0xb3')]]=[];}this[_0x9a97('0x28')][this[_0x9a97('0x24')][_0x3385dd[_0x9a97('0x123')]][_0x9a97('0xb3')]][_0x9a97('0x127')](_[_0x9a97('0xce')](_['pick'](this[_0x9a97('0x24')][_0x3385dd[_0x9a97('0x123')]],[_0x9a97('0x128'),'stateinterface']),{'status':_0x3385dd['status'],'paused':_0x3385dd[_0x9a97('0x125')]}));}}}};function unlockQueueStatus(_0x4d4ef5,_0x279323){setTimeout(function(){if(_[_0x9a97('0x87')](_0x4d4ef5[_0x9a97('0x129')])){loggerBooked[_0x9a97('0x98')]('[unlockQueueStatus][undefined]',_0x279323);}_0x4d4ef5[_0x9a97('0x129')]=!![];loggerBooked[_0x9a97('0x7e')]('[booked][unlockQueueStatus]',_0x279323,JSON[_0x9a97('0x4a')](_[_0x9a97('0x12a')](_0x4d4ef5,[_0x9a97('0x42'),_0x9a97('0x129')])));},0x1f3);}Dialer['prototype'][_0x9a97('0x3b')]=function(_0x444c2d){var _0x307aaa=this;var _0x195378=_0x307aaa[_0x9a97('0x1e')][_0x307aaa[_0x9a97('0x24')][_0x444c2d['actionid']][_0x9a97('0xb3')]];if(strategy[this[_0x9a97('0x1e')][this[_0x9a97('0x24')][_0x444c2d[_0x9a97('0x123')]]['queue']][_0x9a97('0x50')]]===_0x9a97('0x19')){if(this[_0x9a97('0x24')][_0x444c2d[_0x9a97('0x123')]]&&this[_0x9a97('0x24')][_0x444c2d[_0x9a97('0x123')]]['stateinterface']){this[_0x9a97('0x1d')]['run'](this[_0x9a97('0x24')][_0x444c2d[_0x9a97('0x123')]]['idHopper'],this[_0x9a97('0x24')][_0x444c2d['actionid']][_0x9a97('0x126')])[_0x9a97('0xb1')](function(_0x11d96e){logger[_0x9a97('0x98')](_0x9a97('0x12b'),util[_0x9a97('0x99')](_0x11d96e,{'showHidden':![],'depth':null}));})['finally'](function(){_0x307aaa[_0x9a97('0xcc')](_0x307aaa['voiceQueues'][_0x307aaa[_0x9a97('0x24')][_0x444c2d[_0x9a97('0x123')]][_0x9a97('0xb3')]]);_0x307aaa[_0x9a97('0x20')][_0x307aaa[_0x9a97('0x24')][_0x444c2d['actionid']][_0x9a97('0x126')]][_0x9a97('0x124')]=![];delete _0x307aaa[_0x9a97('0x24')][_0x444c2d[_0x9a97('0x123')]];unlockQueueStatus(_0x195378);});}else{this[_0x9a97('0xcc')](this[_0x9a97('0x1e')][this[_0x9a97('0x24')][_0x444c2d[_0x9a97('0x123')]][_0x9a97('0xb3')]]);this[_0x9a97('0xbe')]({'active':![],'ContactId':this[_0x9a97('0x24')][_0x444c2d[_0x9a97('0x123')]][_0x9a97('0xcf')],'ListId':this[_0x9a97('0x24')][_0x444c2d[_0x9a97('0x123')]][_0x9a97('0xd0')],'VoiceQueueId':this[_0x9a97('0x24')][_0x444c2d[_0x9a97('0x123')]][_0x9a97('0xd1')]||undefined,'CampaignId':this[_0x9a97('0x24')][_0x444c2d['actionid']][_0x9a97('0xd2')]||undefined})[_0x9a97('0xb1')](loggerCatch(_0x9a97('0x12c')));delete this[_0x9a97('0x24')][_0x444c2d[_0x9a97('0x123')]];unlockQueueStatus(_0x195378);}}else if((strategy[this[_0x9a97('0x1e')][this[_0x9a97('0x24')][_0x444c2d[_0x9a97('0x123')]][_0x9a97('0xb3')]]['strategy']]||'rrmemory')===_0x9a97('0x18')){var _0x4597b9;if(this['actions'][_0x444c2d[_0x9a97('0x123')]]&&!_[_0x9a97('0x47')](this[_0x9a97('0x28')][this[_0x9a97('0x24')][_0x444c2d[_0x9a97('0x123')]][_0x9a97('0xb3')]])){if(this[_0x9a97('0x29')][_0x307aaa[_0x9a97('0x24')][_0x444c2d['actionid']][_0x9a97('0xb3')]]){this['queueBookedRR'][_0x307aaa[_0x9a97('0x24')][_0x444c2d[_0x9a97('0x123')]][_0x9a97('0xb3')]]=this[_0x9a97('0x29')][this[_0x9a97('0x24')][_0x444c2d['actionid']][_0x9a97('0xb3')]]?this['queueBookedRR'][this['actions'][_0x444c2d[_0x9a97('0x123')]][_0x9a97('0xb3')]]:this[_0x9a97('0x28')][this['actions'][_0x444c2d['actionid']][_0x9a97('0xb3')]]?this['queueBooked'][this[_0x9a97('0x24')][_0x444c2d[_0x9a97('0x123')]]['queue']][_0x9a97('0x12d')]||0x0:0x0;}this[_0x9a97('0x28')][this[_0x9a97('0x24')][_0x444c2d[_0x9a97('0x123')]][_0x9a97('0xb3')]][_0x9a97('0x12d')]=this[_0x9a97('0x29')][this[_0x9a97('0x24')][_0x444c2d['actionid']]['queue']];for(var _0x4ecc1e=0x0;_0x4ecc1e=0x0;})[_0x9a97('0xb1')](myreject(_0x1ef1d7)));}}else{_0x9454ab[_0x9a97('0x127')](ami[_0x9a97('0x143')]({'action':'command','command':util[_0x9a97('0x78')]('iftime\x20%s,%s',_0x1f5e44,!_[_0x9a97('0x87')](config[_0x9a97('0x140')][_0x1c2a77])?_0x1c2a77:'')})[_0x9a97('0xb8')](function(_0x33fe4d){return _0x33fe4d['content'][_0x9a97('0x148')](_0x9a97('0x149'))>=0x0;})[_0x9a97('0xb1')](myreject(_0x1ef1d7)));}BPromise[_0x9a97('0x14a')](_0x9454ab)[_0x9a97('0xb8')](function(_0x106aef){var _0x3799dd=_[_0x9a97('0x14b')](_0x106aef);if(_0x3799dd){return _0x2a7dab(_0x3799dd);}else{_0x33c999[_0x9a97('0x3e')]=_0x5b6192?_0x9a97('0x14c'):'INTERVAL_IS_OVERTIME';return _0x1ef1d7(msgResponse(_0x9a97('0x14d'),'Failure','Global:\x20'+_0x5b6192+'\x20'+_0x4a45e1+_0x9a97('0x14e')+util[_0x9a97('0x99')](_0x1f5e44,{'showHidden':![],'depth':null})+_0x9a97('0x14f')+_0x1c2a77));}})['catch'](function(_0x1b0d0d){return _0x1ef1d7(msgResponse('ifTime','Failure',JSON[_0x9a97('0x4a')](_0x1b0d0d)));});});};Dialer[_0x9a97('0xab')][_0x9a97('0x150')]=function(_0x5e73eb){var _0x1dc34a=this;return function(){switch(_0x5e73eb[_0x9a97('0x5b')]){case _0x9a97('0x151'):freeVariablesPredictive(_0x5e73eb);_0x1dc34a['handlePower'](_0x5e73eb,0x1);break;case _0x9a97('0x152'):freeVariablesPredictive(_0x5e73eb);_0x1dc34a[_0x9a97('0x153')](_0x5e73eb,_0x5e73eb[_0x9a97('0x154')]);break;case _0x9a97('0x8'):_0x1dc34a['predictive'](_0x5e73eb);break;case _0x9a97('0x155'):freeVariablesPredictive(_0x5e73eb);_0x1dc34a['handlePower'](_0x5e73eb,0x1);break;default:freeVariablesPredictive(_0x5e73eb);logger['error'](_0x9a97('0x156'),_0x5e73eb[_0x9a97('0x42')],_0x9a97('0x157'));}};};Dialer[_0x9a97('0xab')][_0x9a97('0x158')]=function(_0x4d6246){var _0xf2ce3f=this;return function(){_0xf2ce3f[_0x9a97('0x159')](_0x4d6246);};};Dialer[_0x9a97('0xab')]['syncQueueSummary']=function(_0x29b89d){var _0x49121e=this;if(isNotPreview(_0x29b89d[_0x9a97('0x5b')])){if(isVoiceQueueOutbound(_0x29b89d[_0x9a97('0x4e')])&&isActive(_0x29b89d[_0x9a97('0x5a')])){_0x29b89d[_0x9a97('0xa8')]=!![];BPromise['resolve']()['then'](checkIsLoggedIn(_0x29b89d,_0x29b89d[_0x9a97('0x15a')]))[_0x9a97('0xb8')](checkIsActive(_0x29b89d,_0x29b89d[_0x9a97('0x5a')]))[_0x9a97('0xb8')](checkInterval(_0x29b89d))[_0x9a97('0xb8')](_0x49121e[_0x9a97('0x15b')](_0x29b89d))[_0x9a97('0xb8')](_0x49121e[_0x9a97('0x13a')](_0x29b89d[_0x9a97('0x15c')],_0x29b89d[_0x9a97('0x15d')],_0x29b89d[_0x9a97('0x42')],_0x29b89d))[_0x9a97('0xb8')](_0x49121e[_0x9a97('0x13c')](_0x29b89d[_0x9a97('0x44')],_0x29b89d['dialTimezone'],_0x29b89d['name'],_0x29b89d))[_0x9a97('0xb8')](_0x49121e[_0x9a97('0x150')](_0x29b89d))[_0x9a97('0xb1')](loggerCatchQueueSummary(_0x9a97('0x15e'),_0x29b89d));}else{notSendMessagesQueue(_0x29b89d);}}else{freeVariablesPredictive(_0x29b89d);}};Dialer[_0x9a97('0xab')]['syncCampaigns']=function(){var _0x4e92eb=this;var _0x3b55c4;for(var _0x32d9a9 in this[_0x9a97('0x1f')]){if(typeof this[_0x9a97('0x1f')][_0x32d9a9]!==_0x9a97('0x9d')){_0x3b55c4=this['campaigns'][_0x32d9a9];if(isCampaignIvr(_0x3b55c4[_0x9a97('0x4e')])&&isActive(_0x3b55c4[_0x9a97('0x76')])){_0x3b55c4['sendMessageOneNotActive']=!![];BPromise['resolve']()[_0x9a97('0xb8')](checkIsActive(_0x3b55c4,_0x3b55c4[_0x9a97('0x76')]))[_0x9a97('0xb8')](checkInterval(_0x3b55c4))[_0x9a97('0xb8')](_0x4e92eb[_0x9a97('0x15b')](_0x3b55c4))[_0x9a97('0xb8')](_0x4e92eb[_0x9a97('0x13a')](_0x3b55c4[_0x9a97('0x15c')],_0x3b55c4[_0x9a97('0x15d')],_0x3b55c4[_0x9a97('0x42')],_0x3b55c4))[_0x9a97('0xb8')](_0x4e92eb[_0x9a97('0x13c')](_0x3b55c4[_0x9a97('0x44')],_0x3b55c4[_0x9a97('0x15d')],_0x3b55c4['name'],_0x3b55c4))[_0x9a97('0xb8')](_0x4e92eb[_0x9a97('0x158')](_0x3b55c4))[_0x9a97('0xb1')](loggerCatchQueueSummary(_0x9a97('0x15f'),_0x3b55c4));}else{notSendMessagesCampaign(_0x3b55c4);}}}};function getCallerIdRandom(_0x4000a1,_0x4eb6c2){var _0x3c8b4c;var _0x3c6bfe;var _0x236d19;if(_0x4eb6c2<=0x0){_0x4eb6c2=0x1;}_0x3c8b4c=new RegExp('\x5cw{0,'+_0x4eb6c2+'}$');_0x3c6bfe=Math[_0x9a97('0x160')](0xa,_0x4eb6c2-0x1);_0x236d19=Math[_0x9a97('0x160')](0xa,_0x4eb6c2)-0x1;return util[_0x9a97('0x78')]('%s',_[_0x9a97('0x161')](_0x4000a1,_0x3c8b4c,_[_0x9a97('0x162')](_0x3c6bfe,_0x236d19)));}function extractCalleridName(_0x20cb2b){var _0x250f70=_0x20cb2b[_0x9a97('0x163')](/"(.*?)"/);return _0x250f70?_0x250f70[0x1]:_0x20cb2b;}function extractCalleridNumber(_0x1b2725){var _0x3121c1=_0x1b2725[_0x9a97('0x163')](/<(.*?)>/);return _0x3121c1?_0x3121c1[0x1]:_0x1b2725;}Dialer[_0x9a97('0xab')][_0x9a97('0x164')]=function(_0x5f0f36,_0x4f41f6){var _0x415ea3=this;var _0x9ed251=uuid['v4']();this[_0x9a97('0x24')][_0x9ed251]=new Action(_0x5f0f36,_0x4f41f6,_0x9ed251);return new BPromise(function(_0x5cb5f2,_0x3adbc8){if(_[_0x9a97('0x87')](_0x5f0f36)&&typeof _0x5f0f36!==_0x9a97('0x165')){return _0x3adbc8(msgResponse(_0x9a97('0x166'),_0x9a97('0x13d'),_0x9a97('0x167')));}if(_['isUndefined'](_0x4f41f6[_0x9a97('0x168')]['phone'])||_0x4f41f6[_0x9a97('0x168')][_0x9a97('0x169')]===null){return _0x3adbc8(msgResponse(_0x9a97('0x166'),_0x9a97('0x13d'),'contact\x20is\x20undefine'));}var _0x2c70d2={'XMD-CALLERID':_0x415ea3[_0x9a97('0x24')][_0x9ed251][_0x9a97('0x16a')](),'XMD-AGI':_0x5f0f36['dialQueueProject']?util[_0x9a97('0x78')](_0x9a97('0x16b'),ipAgi,_0x5f0f36[_0x9a97('0x107')]):_0x9a97('0x16c'),'XMD-AGIAFTER':_0x5f0f36[_0x9a97('0x117')]?util[_0x9a97('0x78')](_0x9a97('0x16b'),ipAgi,_0x5f0f36['dialQueueProject2']):_0x9a97('0x16c'),'XMD-QUEUE':_0x5f0f36['type']===_0x9a97('0x4f')?util[_0x9a97('0x78')](_0x9a97('0x16d'),_0x5f0f36[_0x9a97('0x42')],_0x5f0f36['dialQueueOptions']||'',_0x5f0f36[_0x9a97('0x10c')]?'c':'',_0x5f0f36[_0x9a97('0x114')]||0x3):_0x9a97('0x16c'),'XMD-CONTACTID':_0x4f41f6['ContactId'],'XMD-CDRTYPE':_0x9a97('0x16e'),'CALLERID(all)':_0x415ea3[_0x9a97('0x24')][_0x9ed251][_0x9a97('0x16a')](),'XMD-AMD':_0x5f0f36[_0x9a97('0xde')]?_0x9a97('0x16f'):_0x9a97('0x16c'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x5f0f36[_0x9a97('0xde')]){_0x2c70d2['XMD-AMDINITIALSILENCE']=_0x5f0f36[_0x9a97('0x170')]||0x9c4;_0x2c70d2[_0x9a97('0x171')]=_0x5f0f36[_0x9a97('0x172')]||0x5dc;_0x2c70d2[_0x9a97('0x173')]=_0x5f0f36['dialAMDAfterGreetingSilence']||0x320;_0x2c70d2['XMD-AMDTOTALANALYSISTIME']=_0x5f0f36[_0x9a97('0x174')]||0x1388;_0x2c70d2[_0x9a97('0x175')]=_0x5f0f36[_0x9a97('0x176')]||0x64;_0x2c70d2[_0x9a97('0x177')]=_0x5f0f36['dialAMDBetweenWordsSilence']||0x32;_0x2c70d2['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x5f0f36[_0x9a97('0x178')]||0x3;_0x2c70d2[_0x9a97('0x179')]=_0x5f0f36[_0x9a97('0x17a')]||0x100;_0x2c70d2[_0x9a97('0x17b')]=_0x5f0f36[_0x9a97('0x17c')]||0x1388;}if(_0x5f0f36['type']===_0x9a97('0x4f')){_0x2c70d2[_0x9a97('0x17d')]=_0x4f41f6[_0x9a97('0xd1')];}else{_0x2c70d2[_0x9a97('0x17e')]=_0x4f41f6['CampaignId'];}for(var _0xfa0c94 in _0x4f41f6['Contact']){if(typeof _0x4f41f6[_0x9a97('0x168')][_0xfa0c94]!=='undefined'){if(isNotNull(_0x4f41f6[_0x9a97('0x168')][_0xfa0c94])&&_0xfa0c94!=='id'&&_0xfa0c94!=='tags'&&_0xfa0c94!==_0x9a97('0x17f')&&_0xfa0c94!==_0x9a97('0x180')){_0x2c70d2[util[_0x9a97('0x78')](_0x9a97('0x181'),'XMD-',_[_0x9a97('0x182')](_0xfa0c94))]=_0x4f41f6['Contact'][_0xfa0c94];}}}var _0x3eb31f=_0x415ea3[_0x9a97('0xd6')](_0x5f0f36[_0x9a97('0x75')])?getCallerId(_0x5f0f36[_0x9a97('0x75')][_0x9a97('0x77')],_0x5f0f36['dialOriginateCallerIdName'],_0x5f0f36[_0x9a97('0x183')]>0x0?getCallerIdRandom(_0x5f0f36[_0x9a97('0x5d')],_0x5f0f36[_0x9a97('0x183')]):_0x5f0f36[_0x9a97('0x5d')]):getCallerId(_[_0x9a97('0xaf')](_0x5f0f36['TrunkBackup'])?_0x5f0f36[_0x9a97('0x75')][_0x9a97('0x77')]:_0x5f0f36['TrunkBackup']['callerid'],_0x5f0f36[_0x9a97('0x5c')],_0x5f0f36['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x5f0f36[_0x9a97('0x5d')],_0x5f0f36['dialRandomLastDigitCallerIdNumber']):_0x5f0f36['dialOriginateCallerIdNumber']);if(_0x3eb31f){_0x2c70d2['XMD-ORIGINATECALLERIDNAME']=_0x415ea3[_0x9a97('0x24')][_0x9ed251][_0x9a97('0x184')]=extractCalleridName(_0x3eb31f);_0x2c70d2[_0x9a97('0x185')]=_0x415ea3[_0x9a97('0x24')][_0x9ed251][_0x9a97('0x186')]=extractCalleridNumber(_0x3eb31f);}return ami['Action']({'actionid':_0x9ed251,'action':_0x9a97('0x166'),'channel':_0x415ea3[_0x9a97('0xd6')](_0x5f0f36[_0x9a97('0x75')])?util['format'](_0x9a97('0x187'),_0x5f0f36[_0x9a97('0x75')][_0x9a97('0x42')],isNotNull(_0x5f0f36[_0x9a97('0x188')])?_0x5f0f36[_0x9a97('0x188')][_0x9a97('0x189')]()||'':'',_0x5f0f36[_0x9a97('0x18a')]>0x0?_0x4f41f6[_0x9a97('0x168')][_0x9a97('0x169')][_0x9a97('0x18b')](_0x5f0f36['dialCutDigit']):_0x4f41f6['Contact']['phone']):util['format']('SIP/%s/%s%s',_['isNil'](_0x5f0f36[_0x9a97('0x137')])?_0x5f0f36[_0x9a97('0x75')][_0x9a97('0x42')]:_0x5f0f36[_0x9a97('0x137')][_0x9a97('0x42')],isNotNull(_0x5f0f36['dialPrefix'])?_0x5f0f36[_0x9a97('0x188')][_0x9a97('0x189')]()||'':'',_0x5f0f36[_0x9a97('0x18a')]>0x0?_0x4f41f6[_0x9a97('0x168')][_0x9a97('0x169')][_0x9a97('0x18b')](_0x5f0f36[_0x9a97('0x18a')]):_0x4f41f6['Contact'][_0x9a97('0x169')]),'callerid':_0x3eb31f,'Exten':_0x9a97('0xdd'),'Context':_0x9a97('0x18c'),'Priority':'1','variable':_0x2c70d2,'timeout':(_0x5f0f36[_0x9a97('0x5e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x9ed251})[_0x9a97('0xb8')](function(_0x2b97e2){return _0x5cb5f2(_0x2b97e2);})[_0x9a97('0xb1')](function(_0x5305d8){_0x5f0f36[_0x9a97('0x67')]+=0x1;var _0x44e301=new History(_0x415ea3[_0x9a97('0x24')][_0x9ed251]);logger[_0x9a97('0x98')](util[_0x9a97('0x78')](_0x9a97('0x18d'),JSON[_0x9a97('0x4a')](_0x5305d8)));_0x44e301['state']=0xe;_0x44e301[_0x9a97('0xe1')]=_0x9a97('0x18e');_0x44e301[_0x9a97('0x120')]=moment()[_0x9a97('0x78')](_0x9a97('0xfe'));_0x44e301[_0x9a97('0xaa')]=_0x44e301[_0x9a97('0x120')];_0x415ea3[_0x9a97('0xc8')](_0x44e301)[_0x9a97('0xb1')](loggerCatch(_0x9a97('0x18f')));_0x415ea3[_0x9a97('0xc7')](_0x44e301)['catch'](loggerCatch(_0x9a97('0x18f')))[_0x9a97('0x1c')](function(){delete _0x415ea3[_0x9a97('0x24')][_0x9ed251];return _0x3adbc8(msgResponse(_0x9a97('0x166'),'Error',_0x9a97('0x190')));});});});};Dialer[_0x9a97('0xab')]['syncOriginateResponse']=function(_0x53744f){var _0x175100=this[_0x9a97('0x24')][_0x53744f[_0x9a97('0x123')]];if(_0x175100){delete this[_0x9a97('0x24')][_0x53744f['actionid']];_0x175100[_0x9a97('0x113')]=moment()[_0x9a97('0x78')]('YYYY-MM-DD\x20HH:mm:ss');var _0x502d69=_0x175100[_0x9a97('0x4e')]===_0x9a97('0x7b')?this[_0x9a97('0x1f')][_0x175100[_0x9a97('0xb3')]]:this[_0x9a97('0x1e')][_0x175100['getQueue']()];if(!this[_0x9a97('0xd5')](_0x53744f[_0x9a97('0x191')])){this[_0x9a97('0xcc')](_0x502d69);return this[_0x9a97('0x192')](_0x175100,_0x502d69,_0x53744f)[_0x9a97('0xb1')](loggerCatch(_0x9a97('0x193')));}this[_0x9a97('0xad')][_0x53744f['uniqueid']]=_0x175100;}};Dialer[_0x9a97('0xab')][_0x9a97('0x194')]=function(_0x63b3fe,_0x39b6d1,_0x2ef562){var _0x5141b0=new History(_0x39b6d1);if(_0x5141b0[_0x9a97('0xef')]+_0x5141b0[_0x9a97('0xf0')]+_0x5141b0['countnoanswerretry']+_0x5141b0[_0x9a97('0xf1')]+_0x5141b0[_0x9a97('0xf2')]+_0x5141b0[_0x9a97('0xf3')]+_0x5141b0[_0x9a97('0xeb')]+_0x5141b0['countagentrejectretry']>=_0x2ef562[_0x9a97('0xf5')]-0x1){return!![];}switch(_0x63b3fe){case 0x3:if(_0x5141b0[_0x9a97('0x103')]>=_0x2ef562[_0x9a97('0x195')]-0x1){return!![];}this[_0x9a97('0xbe')]({'active':![],'countnoanswerretry':_0x5141b0['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x9a97('0xfb')](_0x2ef562['dialNoAnswerRetryFrequency'],'minutes')[_0x9a97('0x78')](_0x9a97('0xfe')),'ContactId':_0x5141b0[_0x9a97('0xcf')],'ListId':_0x5141b0[_0x9a97('0xd0')],'VoiceQueueId':_0x5141b0[_0x9a97('0xd1')]||undefined,'CampaignId':_0x5141b0['CampaignId']||undefined})[_0x9a97('0xb1')](loggerCatch(_0x9a97('0x196')));break;case 0x5:if(_0x5141b0[_0x9a97('0xef')]>=_0x2ef562[_0x9a97('0x197')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x5141b0[_0x9a97('0xef')]+=0x1,'scheduledat':moment()[_0x9a97('0xfb')](_0x2ef562[_0x9a97('0x198')],_0x9a97('0xfd'))[_0x9a97('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5141b0[_0x9a97('0xcf')],'ListId':_0x5141b0['ListId'],'VoiceQueueId':_0x5141b0[_0x9a97('0xd1')]||undefined,'CampaignId':_0x5141b0[_0x9a97('0xd2')]||undefined})[_0x9a97('0xb1')](loggerCatch(_0x9a97('0x199')));break;case 0x8:if(_0x5141b0[_0x9a97('0xf0')]>=_0x2ef562[_0x9a97('0x19a')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x5141b0[_0x9a97('0xf0')]+=0x1,'scheduledat':moment()[_0x9a97('0xfb')](_0x2ef562['dialCongestionRetryFrequency'],'minutes')[_0x9a97('0x78')](_0x9a97('0xfe')),'ContactId':_0x5141b0['ContactId'],'ListId':_0x5141b0[_0x9a97('0xd0')],'VoiceQueueId':_0x5141b0[_0x9a97('0xd1')]||undefined,'CampaignId':_0x5141b0['CampaignId']||undefined})[_0x9a97('0xb1')](loggerCatch(_0x9a97('0x19b')));break;case 0x0:if(_0x5141b0[_0x9a97('0xf1')]>=_0x2ef562[_0x9a97('0x19c')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x5141b0[_0x9a97('0xf1')]+=0x1,'scheduledat':moment()['add'](_0x2ef562[_0x9a97('0x19d')],'minutes')[_0x9a97('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5141b0[_0x9a97('0xcf')],'ListId':_0x5141b0[_0x9a97('0xd0')],'VoiceQueueId':_0x5141b0['VoiceQueueId']||undefined,'CampaignId':_0x5141b0['CampaignId']||undefined})[_0x9a97('0xb1')](loggerCatch(_0x9a97('0x19e')));}break;case 0xa:if(_0x5141b0[_0x9a97('0xf2')]>=_0x2ef562['dialDropMaxRetry']-0x1){return!![];}this[_0x9a97('0xbe')]({'active':![],'countdropretry':_0x5141b0[_0x9a97('0xf2')]+=0x1,'scheduledat':moment()[_0x9a97('0xfb')](_0x2ef562[_0x9a97('0x119')],_0x9a97('0xfd'))[_0x9a97('0x78')](_0x9a97('0xfe')),'ContactId':_0x5141b0[_0x9a97('0xcf')],'ListId':_0x5141b0[_0x9a97('0xd0')],'VoiceQueueId':_0x5141b0[_0x9a97('0xd1')]||undefined,'CampaignId':_0x5141b0[_0x9a97('0xd2')]||undefined})[_0x9a97('0xb1')](loggerCatch(_0x9a97('0x11a')));break;case 0xb:if(_0x5141b0[_0x9a97('0xf3')]>=_0x2ef562[_0x9a97('0x19f')]-0x1){return!![];}this[_0x9a97('0xbe')]({'active':![],'countabandonedretry':_0x5141b0[_0x9a97('0xf3')]+=0x1,'scheduledat':moment()['add'](_0x2ef562[_0x9a97('0x1a0')],'minutes')['format'](_0x9a97('0xfe')),'ContactId':_0x5141b0[_0x9a97('0xcf')],'ListId':_0x5141b0[_0x9a97('0xd0')],'VoiceQueueId':_0x5141b0[_0x9a97('0xd1')]||undefined,'CampaignId':_0x5141b0['CampaignId']||undefined})[_0x9a97('0xb1')](loggerCatch(_0x9a97('0x1a1')));break;case 0x13:if(_0x5141b0[_0x9a97('0xeb')]>=_0x2ef562[_0x9a97('0xf8')]-0x1){return!![];}this[_0x9a97('0xbe')]({'active':![],'countmachineretry':_0x5141b0[_0x9a97('0xeb')]+=0x1,'scheduledat':moment()[_0x9a97('0xfb')](_0x2ef562['dialMachineRetryFrequency'],_0x9a97('0xfd'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5141b0[_0x9a97('0xcf')],'ListId':_0x5141b0['ListId'],'VoiceQueueId':_0x5141b0[_0x9a97('0xd1')]||undefined,'CampaignId':_0x5141b0[_0x9a97('0xd2')]||undefined})[_0x9a97('0xb1')](loggerCatch(_0x9a97('0xff')));break;case 0x14:if(_0x5141b0[_0x9a97('0xf4')]>=_0x2ef562[_0x9a97('0x1a2')]-0x1){return!![];}this[_0x9a97('0xbe')]({'active':![],'countagentrejectretry':_0x5141b0[_0x9a97('0xf4')]+=0x1,'scheduledat':moment()[_0x9a97('0xfb')](_0x2ef562['dialAgentRejectRetryFrequency'],_0x9a97('0xfd'))[_0x9a97('0x78')](_0x9a97('0xfe')),'ContactId':_0x5141b0[_0x9a97('0xcf')],'ListId':_0x5141b0[_0x9a97('0xd0')],'VoiceQueueId':_0x5141b0[_0x9a97('0xd1')]||undefined,'CampaignId':_0x5141b0[_0x9a97('0xd2')]||undefined})[_0x9a97('0xb1')](loggerCatch(_0x9a97('0x1a3')));break;default:return!![];}};Dialer[_0x9a97('0xab')][_0x9a97('0x192')]=function(_0x225354,_0x300411,_0x2eeb81){var _0x529f51=this;var _0x5cda76=new History(_0x225354);return new BPromise(function(_0x1e89d5,_0x297f6e){if(_[_0x9a97('0x87')](_0x300411)&&typeof _0x300411!==_0x9a97('0x165')){return _0x297f6e(msgResponse('[callProgressDetecting]',_0x9a97('0x13d'),_0x9a97('0x1a4')));}if(_[_0x9a97('0x87')](_0x2eeb81)&&typeof _0x2eeb81!==_0x9a97('0x165')){return _0x297f6e(msgResponse(_0x9a97('0x1a5'),_0x9a97('0x13d'),'evt\x20is\x20undefine'));}switch(_0x2eeb81[_0x9a97('0x10a')]){case'0':_0x300411['outboundNoSuchCallsDay']+=0x1;_0x5cda76[_0x9a97('0xe0')]=0x0;_0x5cda76['statedesc']=_0x9a97('0x1a6');_0x5cda76[_0x9a97('0xf1')]+=0x1;_0x5cda76[_0x9a97('0xec')]+=0x1;ami['emit'](_0x9a97('0x1a7'),ut[_0x9a97('0xed')](_0x225354,_0x9a97('0x1a8')));_0x529f51[_0x9a97('0xc8')](_0x5cda76)['catch'](loggerCatch(_0x9a97('0xee')));if(_0x529f51[_0x9a97('0x194')](0x0,_0x225354,_0x300411)){if(_0x5cda76[_0x9a97('0xf1')]>=_0x300411['dialNoSuchNumberMaxRetry']){_0x529f51[_0x9a97('0xf9')](_0x5cda76,_0x1e89d5,_0x297f6e,_0x9a97('0x1a9'));}else{_0x529f51['stateGlobal'](_0x5cda76,_0x1e89d5,_0x297f6e,_0x9a97('0x1a9'));}}break;case'3':_0x300411['outboundNoAnswerCallsDay']+=0x1;_0x5cda76[_0x9a97('0xe0')]=0x3;_0x5cda76[_0x9a97('0xe1')]=_0x9a97('0x1aa');_0x5cda76['countnoanswerretry']+=0x1;_0x5cda76['countglobal']+=0x1;ami[_0x9a97('0x4d')]('custom:agentnoanswer',ut[_0x9a97('0xed')](_0x225354,_0x9a97('0x1ab')));_0x529f51['createHistory'](_0x5cda76)[_0x9a97('0xb1')](loggerCatch(_0x9a97('0x1ac')));if(_0x529f51[_0x9a97('0x194')](0x3,_0x225354,_0x300411)){if(_0x5cda76[_0x9a97('0x103')]>=_0x300411[_0x9a97('0x195')]){_0x529f51[_0x9a97('0xf9')](_0x5cda76,_0x1e89d5,_0x297f6e,_0x9a97('0x1ad'));}else{_0x529f51[_0x9a97('0xf6')](_0x5cda76,_0x1e89d5,_0x297f6e,_0x9a97('0x1ad'));}}break;case'5':_0x300411[_0x9a97('0x61')]+=0x1;_0x5cda76[_0x9a97('0xe0')]=0x5;_0x5cda76[_0x9a97('0xe1')]=_0x9a97('0x1ae');_0x5cda76[_0x9a97('0xef')]+=0x1;_0x5cda76[_0x9a97('0xec')]+=0x1;ami[_0x9a97('0x4d')](_0x9a97('0x1af'),ut[_0x9a97('0xed')](_0x225354,'busy'));_0x529f51[_0x9a97('0xc8')](_0x5cda76)[_0x9a97('0xb1')](loggerCatch(_0x9a97('0x1b0')));if(_0x529f51['checkRetriveMax'](0x5,_0x225354,_0x300411)){if(_0x5cda76['countbusyretry']>=_0x300411[_0x9a97('0x197')]){_0x529f51[_0x9a97('0xf9')](_0x5cda76,_0x1e89d5,_0x297f6e,_0x9a97('0x1b1'));}else{_0x529f51[_0x9a97('0xf6')](_0x5cda76,_0x1e89d5,_0x297f6e,'reason\x205\x20busy');}}break;case'8':_0x300411['outboundCongestionCallsDay']+=0x1;_0x5cda76[_0x9a97('0xe0')]=0x8;_0x5cda76[_0x9a97('0xe1')]='Congestion';_0x5cda76[_0x9a97('0xf0')]+=0x1;_0x5cda76['countglobal']+=0x1;ami[_0x9a97('0x4d')](_0x9a97('0x1b2'),ut[_0x9a97('0xed')](_0x225354,_0x9a97('0x1b3')));_0x529f51['createHistory'](_0x5cda76)[_0x9a97('0xb1')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x529f51[_0x9a97('0x194')](0x8,_0x225354,_0x300411)){if(_0x5cda76[_0x9a97('0xf0')]>=_0x300411[_0x9a97('0x19a')]){_0x529f51['createStateFinal'](_0x5cda76,_0x1e89d5,_0x297f6e,_0x9a97('0x1b4'));}else{_0x529f51[_0x9a97('0xf6')](_0x5cda76,_0x1e89d5,_0x297f6e,'reason\x208\x20congestion');}}break;case'11':_0x300411[_0x9a97('0x1b5')]+=0x1;_0x5cda76['state']=0xb;_0x5cda76['statedesc']=_0x9a97('0x11e');_0x5cda76[_0x9a97('0xf3')]+=0x1;_0x5cda76[_0x9a97('0xec')]+=0x1;_0x529f51[_0x9a97('0xc8')](_0x5cda76)[_0x9a97('0xb1')](loggerCatch(_0x9a97('0x1b6')));if(_0x529f51[_0x9a97('0x194')](0xb,_0x225354,_0x300411)){if(_0x5cda76[_0x9a97('0xf3')]>=_0x300411['dialAbandonedMaxRetry']){_0x529f51['createStateFinal'](_0x5cda76,_0x1e89d5,_0x297f6e,_0x9a97('0x1b7'));}else{_0x529f51[_0x9a97('0xf6')](_0x5cda76,_0x1e89d5,_0x297f6e,_0x9a97('0x1b7'));}}break;case'20':_0x300411['outboundRejectCallsDay']+=0x1;_0x5cda76[_0x9a97('0xe0')]=0x14;_0x5cda76[_0x9a97('0xe1')]=_0x9a97('0x1b8');_0x5cda76[_0x9a97('0xf4')]+=0x1;_0x5cda76['countglobal']+=0x1;ami[_0x9a97('0x4d')](_0x9a97('0x1b9'),ut[_0x9a97('0xed')](_0x225354,_0x9a97('0x1ba')));_0x529f51[_0x9a97('0xc8')](_0x5cda76)['catch'](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x529f51['checkRetriveMax'](0x14,_0x225354,_0x300411)){if(_0x5cda76[_0x9a97('0xf4')]>=_0x300411[_0x9a97('0x1a2')]){_0x529f51[_0x9a97('0xf9')](_0x5cda76,_0x1e89d5,_0x297f6e,_0x9a97('0x1bb'));}else{_0x529f51['stateGlobal'](_0x5cda76,_0x1e89d5,_0x297f6e,_0x9a97('0x1bb'));}}break;default:_0x300411[_0x9a97('0x69')]+=0x1;_0x5cda76['state']=0xc;_0x5cda76[_0x9a97('0xe1')]=_0x2eeb81['reason'];_0x529f51[_0x9a97('0xc8')](_0x5cda76)[_0x9a97('0xb1')](loggerCatch(_0x9a97('0x1bc')));if(_0x529f51[_0x9a97('0x194')](_0x2eeb81[_0x9a97('0x10a')],_0x225354,_0x300411)){if(_0x5cda76[_0x9a97('0xef')]+_0x5cda76[_0x9a97('0xf0')]+_0x5cda76[_0x9a97('0x103')]+_0x5cda76[_0x9a97('0xf1')]+_0x5cda76[_0x9a97('0xf2')]+_0x5cda76['countabandonedretry']+_0x5cda76[_0x9a97('0xeb')]+_0x5cda76['countagentrejectretry']>=_0x300411[_0x9a97('0xf5')]){_0x529f51[_0x9a97('0xf6')](_0x5cda76,_0x1e89d5,_0x297f6e,_0x2eeb81[_0x9a97('0x10a')]);}else{_0x529f51[_0x9a97('0xf9')](_0x5cda76,_0x1e89d5,_0x297f6e,_0x2eeb81[_0x9a97('0x10a')]);}}}});};Dialer[_0x9a97('0xab')][_0x9a97('0xf6')]=function(_0x43d0df,_0x11a23f,_0xca0992,_0x4adfc0){var _0x2a8176=new Final(_0x43d0df);_0x2a8176['state']=0xf;_0x2a8176['statedesc']=_0x9a97('0x1bd');this['createStateFinal'](_0x2a8176,_0x11a23f,_0xca0992,_0x4adfc0);};Dialer[_0x9a97('0xab')][_0x9a97('0xf9')]=function(_0xda84b,_0x1b49fd,_0x28b66c,_0xb92c57){this['moveContactManagedDialer'](_0xda84b)[_0x9a97('0xb8')](function(){return _0x1b49fd(msgResponse(_0x9a97('0x1a5'),_0x9a97('0x1be'),_0xb92c57));})[_0x9a97('0xb1')](function(){return _0x28b66c(msgResponse('[moveContactManagedDialer][0]',_0x9a97('0x13d'),_0x9a97('0x1bf')));});};Dialer[_0x9a97('0xab')]['predictive']=function(_0x263100){var _0x280f7f=_0x263100[_0x9a97('0x1c0')]/0x64;var _0x1a2ccd=_0x263100[_0x9a97('0x1c1')]/(_0x263100[_0x9a97('0x1c1')]+_0x263100[_0x9a97('0x60')]);var _0x1b9b2e=Math[_0x9a97('0x1c2')](_0x263100[_0x9a97('0x70')]*(_0x263100[_0x9a97('0x1c3')]/0x64));var _0x25c80d=Math['round'](_0x263100['predictiveIntervalAvailable']*(_0x263100[_0x9a97('0x1c4')]/0x64));var _0x15808f=_0x263100['available']+_0x263100[_0x9a97('0x56')];var _0x4a5e9e=Math['floor'](_0x263100[_0x9a97('0x72')]*_0x263100[_0x9a97('0x74')]*_0x263100[_0x9a97('0x6e')]*_0x263100[_0x9a97('0x1c5')]);if(_[_0x9a97('0x87')](_0x263100[_0x9a97('0x26')])){if(!_['isUndefined'](_0x263100[_0x9a97('0x25')])){_0x263100[_0x9a97('0x25')]=undefined;loggerPredictive['error'](_0x9a97('0x1c6'),_0x9a97('0x1c7'));}if(!_[_0x9a97('0x87')](_0x263100[_0x9a97('0x93')])){loggerPredictive[_0x9a97('0x98')](_0x9a97('0x1c6'),_0x9a97('0x1c8'));clearInterval(_0x263100[_0x9a97('0x93')]);_0x263100[_0x9a97('0x93')]=undefined;}_0x263100[_0x9a97('0x26')]=moment()[_0x9a97('0x78')](_0x9a97('0xfe'));loggerPredictive[_0x9a97('0x7e')](_0x263100[_0x9a97('0x42')],_0x9a97('0x1c9'),_0x263100['startProgressive']);this[_0x9a97('0x153')](_0x263100,0x1);}else if(ifInterval(_0x263100[_0x9a97('0x1ca')],_0x263100[_0x9a97('0x26')])){this[_0x9a97('0x153')](_0x263100,0x1);loggerPredictiveCalls[_0x9a97('0x7e')](_0x9a97('0x1cb'),_0x263100[_0x9a97('0x26')],_0x263100[_0x9a97('0x42')]);_0x263100['erlangCalls']=0x0;_0x263100[_0x9a97('0x6d')]=0x0;}else if(_0x280f7f<_0x1a2ccd&&_0x263100[_0x9a97('0x1cc')]===_0x9a97('0x1cd')){freeVariablesPredictive(_0x263100);loggerPredictive[_0x9a97('0x7e')](_0x9a97('0x1ce'),_0x9a97('0x1cf'),_0x1a2ccd,'startProgressive',_0x263100['name']);}else if(_0x4a5e9e<_0x263100['predictiveIntervalErlangCallsDroppedCalls']&&_0x263100[_0x9a97('0x1cc')]===_0x9a97('0x1cd')){freeVariablesPredictive(_0x263100);loggerPredictive[_0x9a97('0x7e')](_0x9a97('0x1d0'),'Max\x20Drop\x20',_0x4a5e9e,_0x9a97('0x1d1'),_0x263100[_0x9a97('0x6d')],_0x9a97('0x26'),_0x263100[_0x9a97('0x42')]);}else if(!ifInterval(_0x263100['dialPredictiveInterval'],_0x263100[_0x9a97('0x26')])&&_[_0x9a97('0x87')](_0x263100[_0x9a97('0x25')])&&!_[_0x9a97('0x87')](_0x263100[_0x9a97('0x26')])){_0x263100[_0x9a97('0x25')]=moment()[_0x9a97('0x78')](_0x9a97('0xfe'));loggerPredictive[_0x9a97('0x7e')](_0x263100[_0x9a97('0x42')],_0x9a97('0x1d2'),_0x263100['startPredictive']);this[_0x9a97('0xbc')](_0x263100[_0x9a97('0x1ca')])[_0x9a97('0xb8')](this['getDataPredictive'](_0x263100))[_0x9a97('0xb8')](mergeDataErlangB(_0x263100))[_0x9a97('0xb8')](this[_0x9a97('0x1d3')](_0x263100))[_0x9a97('0xb1')](loggerCatchPredictive(_0x9a97('0x1d4'),_0x263100));}else if(!ifInterval(_0x263100[_0x9a97('0x1ca')],_0x263100[_0x9a97('0x25')])){_0x263100[_0x9a97('0x6d')]=0x0;_0x263100[_0x9a97('0x25')]=moment()[_0x9a97('0x78')](_0x9a97('0xfe'));loggerPredictive[_0x9a97('0x7e')](_0x263100[_0x9a97('0x42')],_0x9a97('0x1d5'),_0x263100['startPredictive']);clearInterval(_0x263100[_0x9a97('0x93')]);_0x263100[_0x9a97('0x93')]=undefined;this[_0x9a97('0xbc')](_0x263100[_0x9a97('0x1ca')])[_0x9a97('0xb8')](this[_0x9a97('0x1d6')](_0x263100))[_0x9a97('0xb8')](mergeDataErlangB(_0x263100))[_0x9a97('0xb8')](this[_0x9a97('0x1d3')](_0x263100))[_0x9a97('0xb1')](loggerCatchPredictive(_0x9a97('0x1d7'),_0x263100));}else if(_0x263100[_0x9a97('0x70')]&&_0x15808f<_0x263100[_0x9a97('0x70')]-_0x25c80d){freeVariablesPredictive(_0x263100);loggerPredictive[_0x9a97('0x7e')](_0x263100['name'],_0x9a97('0x1d8'),_0x15808f,')\x20are\x20less\x20than\x20threshold\x20(',_0x263100[_0x9a97('0x70')],'-',_0x25c80d,'=',_0x263100[_0x9a97('0x70')]-_0x25c80d,')');}else if(_0x263100[_0x9a97('0x70')]&&_0x15808f>_0x263100[_0x9a97('0x70')]+_0x1b9b2e){freeVariablesPredictive(_0x263100);loggerPredictive[_0x9a97('0x7e')](_0x263100[_0x9a97('0x42')],_0x9a97('0x1d8'),_0x15808f,_0x9a97('0x1d9'),_0x263100['predictiveIntervalAvailable'],'+',_0x1b9b2e,'=',_0x263100[_0x9a97('0x70')]+_0x1b9b2e,')');}};Dialer[_0x9a97('0xab')][_0x9a97('0x1d6')]=function(_0x371e0a){var _0x2cd3a2=this;return function(_0x57267b){return new BPromise(function(_0x1b6065,_0x29c55c){_[_0x9a97('0xce')](_0x371e0a,_0x57267b[0x0]);if(checkGetDataPredictive(_0x57267b[0x0])){var _0x22d6ce=_0x371e0a[_0x9a97('0x70')]=_0x371e0a[_0x9a97('0x56')]+_0x371e0a[_0x9a97('0x52')];var _0xb93ac4=_0x371e0a['dialPredictiveInterval']*0x3c;var _0x25e293=_0x57267b[0x0][_0x9a97('0x6a')]+_0x57267b[0x0][_0x9a97('0x84')];var _0x457858=(_0x57267b[0x0][_0x9a97('0x1da')]+_0x57267b[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x57267b[0x0][_0x9a97('0x82')])/_0x57267b[0x0][_0x9a97('0x71')];_0x371e0a[_0x9a97('0x6e')]=_0x457858>0x0?_0x457858:0x1;switch(_0x371e0a[_0x9a97('0x1cc')]){case _0x9a97('0x1cd'):var _0x29410d=_0x371e0a[_0x9a97('0x1c0')]/0x64;return _0x2cd3a2['abandonmentRate'](_0x22d6ce,_0xb93ac4,_0x25e293,_0x457858,_0x29410d)[_0x9a97('0xb8')](function(_0x51f49e){return _0x1b6065(_0x51f49e);});case _0x9a97('0x1db'):var _0x3fd10f=_0x371e0a['dialPredictiveOptimizationPercentage']/0x64;return _0x2cd3a2['busyFactor'](_0x22d6ce,_0xb93ac4,_0x25e293,_0x457858,_0x3fd10f)['then'](function(_0x4b0351){return _0x1b6065(_0x4b0351);});default:return _0x29c55c(msgResponse(_0x9a97('0x1dc'),'Failure',_0x9a97('0x1dd')));}}else{return _0x29c55c(msgResponse(_0x9a97('0x1dc'),'Failure','check\x20failure'));}});};};Dialer[_0x9a97('0xab')][_0x9a97('0x1de')]=function(_0x4e5e88){var _0xcaf2bc=this;return function(_0x416106){return new BPromise(function(_0x59ae4e,_0x967798){_[_0x9a97('0xce')](_0x4e5e88,_0x416106[0x0]);if(checkGetDataPredictive(_0x416106[0x0])){loggerPredictive[_0x9a97('0x7e')](JSON[_0x9a97('0x4a')](_0x416106[0x0]));if(_0x4e5e88['dialPredictiveOptimization']===_0x9a97('0x1cd')){return _0xcaf2bc[_0x9a97('0xc6')](_0x4e5e88['id'])['then'](function(_0x2d22af){var _0x56f17c=_0x4e5e88[_0x9a97('0x15a')]-_0x2d22af[0x0]['outboundQueuePauses'];var _0x40652d=_0x4e5e88[_0x9a97('0x1ca')]*0x3c;var _0x2508a0=_0x416106[0x0][_0x9a97('0x6a')]+_0x416106[0x0][_0x9a97('0x84')];var _0x3917aa=(_0x416106[0x0][_0x9a97('0x1da')]+_0x416106[0x0][_0x9a97('0x6b')]+_0x416106[0x0][_0x9a97('0x82')])/_0x416106[0x0][_0x9a97('0x71')];var _0x5dc384=_0x4e5e88[_0x9a97('0x1c0')]/0x64;_0x4e5e88[_0x9a97('0x6f')]=_0x2d22af[0x0][_0x9a97('0x1df')]||0x0;_0x4e5e88['predictiveIntervalHitRate']=_0x3917aa>0x0?_0x3917aa:0x1;return _0xcaf2bc['abandonmentRate'](_0x56f17c,_0x40652d,_0x2508a0,_0x3917aa,_0x5dc384);})[_0x9a97('0xb8')](function(_0x552713){return _0x59ae4e(_0x552713);})['catch'](function(_0x5d13d4){return _0x967798(msgResponse('[CatchErlangB]',_0x9a97('0x13d'),JSON[_0x9a97('0x4a')](_0x5d13d4)));});}if(_0x4e5e88[_0x9a97('0x1cc')]===_0x9a97('0x1db')){return _0xcaf2bc[_0x9a97('0xc6')](_0x4e5e88['id'])[_0x9a97('0xb8')](function(_0x4f6ceb){var _0x2a16f2=_0x4e5e88['loggedIn']-_0x4f6ceb[0x0][_0x9a97('0x1df')];var _0x2bce48=_0x4e5e88[_0x9a97('0x1ca')]*0x3c;var _0x1bbee6=_0x416106[0x0]['predictiveIntervalAvgTalktime']+_0x416106[0x0][_0x9a97('0x84')];var _0x3035a4=(_0x416106[0x0][_0x9a97('0x1da')]+_0x416106[0x0][_0x9a97('0x6b')]+_0x416106[0x0][_0x9a97('0x82')])/_0x416106[0x0]['predictiveIntervalTotalCalls'];var _0x1c043b=_0x4e5e88[_0x9a97('0x1c0')]/0x64;_0x4e5e88[_0x9a97('0x6f')]=_0x4f6ceb[0x0][_0x9a97('0x1df')]||0x0;_0x4e5e88[_0x9a97('0x6e')]=_0x3035a4>0x0?_0x3035a4:0x1;return _0xcaf2bc[_0x9a97('0x1e0')](_0x2a16f2,_0x2bce48,_0x1bbee6,_0x3035a4,_0x1c043b);})[_0x9a97('0xb8')](function(_0x45cf72){return _0x59ae4e(_0x45cf72);})[_0x9a97('0xb1')](function(_0xebf3){return _0x967798(msgResponse(_0x9a97('0x1e1'),'Failure',JSON['stringify'](_0xebf3)));});}}else{return _0x967798(msgResponse(_0x9a97('0x1dc'),'Failure',_0x9a97('0x1e2')));}});};};Dialer[_0x9a97('0xab')][_0x9a97('0x1d3')]=function(_0x1b6381){var _0x32db93=this;return function(){var _0x1b845f=0x0;var _0xf2e0f=Math[_0x9a97('0x1e3')](_0x1b6381['erlangCallToSecond']*0x3e8);if(_0xf2e0f>0x0){_0xf2e0f=_0xf2e0f<0x64?0x64:_0xf2e0f;loggerPredictive[_0x9a97('0x7e')](_0x1b6381[_0x9a97('0x42')],_0x9a97('0x1e4'),_0xf2e0f,'milliseconds');_0x1b6381['handlePredictive']=setInterval(function(){_0x32db93[_0x9a97('0x93')](_0x1b6381);loggerPredictiveCalls[_0x9a97('0x7e')](_0x9a97('0x1e5'),_0x1b845f+=0x1);},_0xf2e0f);}else{loggerPredictive[_0x9a97('0x7e')](_0x1b6381[_0x9a97('0x42')],_0x9a97('0x1e6'));}};};Dialer['prototype'][_0x9a97('0x1e7')]=function(_0x5c79cc,_0x472e2d){var _0x49490b=this;return function(_0x5552b7){if(_[_0x9a97('0x47')](_0x5552b7)){if(_[_0x9a97('0xaf')](_0x472e2d['UserId'])||!_0x472e2d[_0x9a97('0x1e8')]){if(_0x5c79cc[_0x9a97('0x5b')]===_0x9a97('0x155')){_0x5c79cc[_0x9a97('0x129')]=_[_0x9a97('0x87')](_0x5c79cc[_0x9a97('0x129')])?!![]:_0x5c79cc['queueStatusComplete'];var _0x257b98=uuid['v4']();_0x49490b[_0x9a97('0x24')][_0x257b98]=new Action(_0x5c79cc,_0x472e2d,_0x257b98);loggerBooked[_0x9a97('0x7e')](_0x9a97('0x1e9'),_0x257b98,_0x9a97('0x1ea'),JSON[_0x9a97('0x4a')](_0x5c79cc[_0x9a97('0x129')]),'Queue:\x20',_0x5c79cc['name']);if(_0x5c79cc['queueStatusComplete']){_0x5c79cc[_0x9a97('0x129')]=![];_0x49490b[_0x9a97('0x28')][_0x49490b[_0x9a97('0x24')][_0x257b98][_0x9a97('0xb3')]]=[];ami[_0x9a97('0x143')]({'actionid':_0x257b98,'action':'queuestatus','queue':_0x5c79cc['name']})[_0x9a97('0xb1')](function(){_0x49490b[_0x9a97('0xcc')](_0x5c79cc);_0x49490b[_0x9a97('0xbe')]({'active':![],'ContactId':_0x49490b[_0x9a97('0x24')][_0x257b98]['ContactId'],'ListId':_0x49490b['actions'][_0x257b98][_0x9a97('0xd0')],'VoiceQueueId':_0x49490b[_0x9a97('0x24')][_0x257b98][_0x9a97('0xd1')]||undefined,'CampaignId':_0x49490b[_0x9a97('0x24')][_0x257b98][_0x9a97('0xd2')]||undefined})['catch'](loggerCatch(_0x9a97('0x1eb')));delete _0x49490b[_0x9a97('0x24')][_0x257b98];});}else{loggerBooked[_0x9a97('0x7e')](_0x9a97('0x1ec'),JSON[_0x9a97('0x4a')](_0x5c79cc[_0x9a97('0x129')]),_0x9a97('0x1ed'),_0x5c79cc['name']);_0x49490b[_0x9a97('0xcc')](_0x5c79cc);_0x49490b[_0x9a97('0xbe')]({'active':![],'ContactId':_0x49490b['actions'][_0x257b98][_0x9a97('0xcf')],'ListId':_0x49490b[_0x9a97('0x24')][_0x257b98]['ListId'],'VoiceQueueId':_0x49490b[_0x9a97('0x24')][_0x257b98][_0x9a97('0xd1')]||undefined,'CampaignId':_0x49490b[_0x9a97('0x24')][_0x257b98][_0x9a97('0xd2')]||undefined})[_0x9a97('0xb1')](loggerCatch(_0x9a97('0x1eb')));delete _0x49490b['actions'][_0x257b98];}}else{return _0x49490b[_0x9a97('0x164')](_0x5c79cc,_0x472e2d);}}else{if(getDiff(_0x472e2d[_0x9a97('0x1ee')])<_0x5c79cc[_0x9a97('0x1ef')]*0x3c){if(_0x472e2d['Agent']&&!_0x472e2d[_0x9a97('0x1f0')]['voicePause']){_0x49490b[_0x9a97('0x1d')][_0x9a97('0x1f1')](_0x472e2d['id'])[_0x9a97('0x1c')](function(){_0x49490b[_0x9a97('0xcc')](_0x5c79cc);});}else{_0x49490b[_0x9a97('0xbf')]({'active':![]},_0x472e2d['id'],0x1)[_0x9a97('0x1c')](function(){_0x49490b[_0x9a97('0xcc')](_0x5c79cc);});}}else{_0x5c79cc[_0x9a97('0x68')]+=0x1;_0x49490b[_0x9a97('0xcc')](_0x5c79cc);if(_0x5c79cc[_0x9a97('0x1f2')]){_0x49490b['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x472e2d['ContactId'],'ListId':_0x472e2d[_0x9a97('0xd0')],'VoiceQueueId':_0x472e2d[_0x9a97('0xd1')]||undefined,'CampaignId':_0x472e2d[_0x9a97('0xd2')]||undefined})[_0x9a97('0xb1')](loggerCatch(_0x9a97('0x1f3')));_0x49490b[_0x9a97('0xc8')](createObjHistory(_0x5c79cc,_0x472e2d,_0x9a97('0x1f4'),0x17,'RecallInQueue'))['catch'](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x49490b['saveInDb'](createObjHistory(_0x5c79cc,_0x472e2d,_0x9a97('0x1f5'),0x16,_0x9a97('0x1f6')),'[Originate][HistoryRecallClose][historyCatch]',_0x9a97('0x1f7'));}}}}else{_0x5c79cc[_0x9a97('0x1f8')]+=0x1;_0x49490b[_0x9a97('0xe7')](createObjHistory(_0x5c79cc,_0x472e2d,_0x9a97('0x1f9'),0xd,_0x9a97('0x1fa')),_0x9a97('0x1fb'),_0x9a97('0x1fc'));throw _0x9a97('0x1fd');}};};Dialer['prototype'][_0x9a97('0x159')]=function(_0x4b6832){var _0x3e8df8=this;var _0x1af97d=_0x4b6832[_0x9a97('0x1fe')]-_0x4b6832['originated']-_0x4b6832[_0x9a97('0xc2')];emitCampaignSummary(_0x4b6832);if(_0x1af97d>0x0){if(_0x1af97d>this[_0x9a97('0x22')]){_0x1af97d=this[_0x9a97('0x22')];}_0x4b6832['temp']+=_0x1af97d;this[_0x9a97('0xc4')](_0x4b6832['id'],_0x1af97d,_0x4b6832[_0x9a97('0x1ff')],_0x4b6832)['then'](function(_0x114d98){_0x4b6832['temp']-=_0x1af97d;_0x4b6832[_0x9a97('0xc2')]=_0x4b6832[_0x9a97('0xc2')]>0x0?_0x4b6832[_0x9a97('0xc2')]:0x0;if(!checkContactEmpty(_0x114d98)){_0x4b6832[_0x9a97('0x3e')]=_0x9a97('0x200');logger[_0x9a97('0x7e')](_0x9a97('0x201')+_0x4b6832[_0x9a97('0x42')]);}else{_0x4b6832[_0x9a97('0x9c')]+=_0x114d98[_0x9a97('0x9b')];_0x4b6832[_0x9a97('0x3e')]=_0x9a97('0x202');for(var _0x474d80=0x0;_0x474d80<_0x114d98[_0x9a97('0x9b')];_0x474d80+=0x1){_0x4b6832[_0x9a97('0x203')]+=0x1;if(_[_0x9a97('0xaf')](_0x114d98[_0x474d80])||_['isNil'](_0x114d98[_0x474d80][_0x9a97('0x168')])||_[_0x9a97('0xaf')](_0x114d98[_0x474d80][_0x9a97('0x168')][_0x9a97('0x169')])){_0x3e8df8[_0x9a97('0x204')]('[actionOriginate]\x20',_0x4b6832,_0x114d98[_0x474d80]);}else{_0x3e8df8[_0x9a97('0xba')](_[_0x9a97('0x12a')](_0x114d98[_0x474d80],[_0x9a97('0xd2'),'Contact.phone']))[_0x9a97('0xb8')](_0x3e8df8[_0x9a97('0x1e7')](_0x4b6832,_0x114d98[_0x474d80]))[_0x9a97('0xb1')](_0x3e8df8[_0x9a97('0xcb')](_0x9a97('0x205'),_0x4b6832));}}}})[_0x9a97('0xb1')](loggerGetContactDialer(_0x9a97('0x206'),_0x4b6832,_0x1af97d));}};Dialer[_0x9a97('0xab')][_0x9a97('0x153')]=function(_0x234fc1,_0x532079){var _0x29a1fa=this;var _0x42d066=[];var _0x278daa=_0x532079>=0x1?_0x532079:0x1;if(_0x234fc1[_0x9a97('0x5b')]===_0x9a97('0x155')){_0x278daa=0x1;}var _0x4148c6=Math['floor'](_0x234fc1[_0x9a97('0x52')]*_0x278daa)-_0x234fc1[_0x9a97('0x9c')]-_0x234fc1['temp'];emitVoiceQueueSummary(_0x234fc1);if(_0x234fc1[_0x9a97('0x207')]>0x0){var _0x7ab2ef=_0x234fc1['dialLimitQueue']-_0x234fc1[_0x9a97('0x9c')]-_0x234fc1['talking']-_0x234fc1[_0x9a97('0xc2')]-_0x234fc1['pTalking'];if(_0x4148c6>_0x7ab2ef){_0x4148c6=_0x7ab2ef;}}if(_0x4148c6>0x0){if(_0x234fc1[_0x9a97('0x5b')]===_0x9a97('0x155')){_0x4148c6=0x1;}if(_0x4148c6>this[_0x9a97('0x22')]){_0x4148c6=this['maxNumberOriginate'];}_0x234fc1[_0x9a97('0xc2')]+=_0x4148c6;for(var _0x1688f2 in this['agents']){if(typeof this[_0x9a97('0x20')][_0x1688f2]!=='undefined'){if(this[_0x9a97('0x20')][_0x1688f2][_0x9a97('0xe0')]===_0x9a97('0x208')&&this[_0x9a97('0x20')][_0x1688f2][_0x9a97('0xb0')]==='reachable'){_0x42d066[_0x9a97('0x127')](this[_0x9a97('0x20')][_0x1688f2]['id']);}}}this[_0x9a97('0xc1')](_0x234fc1['id'],_0x42d066,_0x4148c6,_0x234fc1['dialOrderByScheduledAt'],_0x234fc1)[_0x9a97('0xb8')](function(_0x536443){_0x234fc1[_0x9a97('0xc2')]-=_0x4148c6;_0x234fc1[_0x9a97('0xc2')]=_0x234fc1[_0x9a97('0xc2')]>0x0?_0x234fc1[_0x9a97('0xc2')]:0x0;if(!checkContactEmpty(_0x536443)){_0x29a1fa[_0x9a97('0xb4')](_0x234fc1)[_0x9a97('0xb8')](sendMessageReschedule(_0x234fc1))[_0x9a97('0xb1')](loggerCatch(_0x9a97('0xb6')));}else{_0x234fc1[_0x9a97('0x9c')]+=_0x536443['length'];_0x234fc1[_0x9a97('0x3e')]=_0x234fc1[_0x9a97('0x5b')]===_0x9a97('0x155')?_0x9a97('0x16f'):'RUNNING';for(var _0x1f3b8f=0x0;_0x1f3b8f<_0x536443['length'];_0x1f3b8f+=0x1){if(_[_0x9a97('0xaf')](_0x536443[_0x1f3b8f])||_[_0x9a97('0xaf')](_0x536443[_0x1f3b8f][_0x9a97('0x168')])||_['isNil'](_0x536443[_0x1f3b8f][_0x9a97('0x168')][_0x9a97('0x169')])){_0x29a1fa[_0x9a97('0x204')](_0x9a97('0x209'),_0x234fc1,_0x536443[_0x1f3b8f]);}else{_0x29a1fa[_0x9a97('0xb7')](_[_0x9a97('0x12a')](_0x536443[_0x1f3b8f],[_0x9a97('0xd1'),_0x9a97('0x20a')]))['then'](_0x29a1fa[_0x9a97('0x1e7')](_0x234fc1,_0x536443[_0x1f3b8f]))[_0x9a97('0xb1')](_0x29a1fa[_0x9a97('0xcb')]('[actionOriginate]\x20',_0x234fc1));}}}})[_0x9a97('0xb1')](loggerGetContactDialer('[getContactDialer2]',_0x234fc1,_0x4148c6));}};Dialer[_0x9a97('0xab')][_0x9a97('0x93')]=function(_0x3184a2){if(_0x3184a2[_0x9a97('0x207')]>0x0){var _0x3d21f0=_0x3184a2[_0x9a97('0x207')]-_0x3184a2['originated']-_0x3184a2[_0x9a97('0x56')];if(_0x3d21f0>0x0){this[_0x9a97('0x20b')](_0x3184a2);}else{loggerPredictiveCalls[_0x9a97('0x7e')](_0x9a97('0x20c'));}}else{this[_0x9a97('0x20b')](_0x3184a2);}};Dialer[_0x9a97('0xab')]['tryOriginatePredictive']=function(_0x2a7900){var _0x56ba67=this;var _0x504891=[];_0x2a7900[_0x9a97('0x9c')]+=0x1;for(var _0x6b8c11 in this[_0x9a97('0x20')]){if(typeof this[_0x9a97('0x20')][_0x6b8c11]!=='undefined'){if(this[_0x9a97('0x20')][_0x6b8c11][_0x9a97('0xe0')]===_0x9a97('0x208')&&this[_0x9a97('0x20')][_0x6b8c11][_0x9a97('0xb0')]===_0x9a97('0xd7')){_0x504891[_0x9a97('0x127')](this[_0x9a97('0x20')][_0x6b8c11]['id']);}}}this[_0x9a97('0xc1')](_0x2a7900['id'],_0x504891,0x1,_0x2a7900[_0x9a97('0x1ff')],_0x2a7900)[_0x9a97('0xb8')](function(_0x93bc44){if(!checkContactEmpty(_0x93bc44)){checkContactLowerLimitOriginate(_0x2a7900,0x1,0x0);_0x56ba67[_0x9a97('0xb4')](_0x2a7900)['then'](sendMessageReschedule(_0x2a7900))[_0x9a97('0xb1')](loggerCatch('[countReScheduled]\x20'));}else{_0x2a7900[_0x9a97('0x3e')]=_0x9a97('0x202');if(_['isNil'](_0x93bc44[0x0])||_[_0x9a97('0xaf')](_0x93bc44[0x0]['Contact'])||_['isNil'](_0x93bc44[0x0]['Contact'][_0x9a97('0x169')])){_0x56ba67[_0x9a97('0x204')]('[actionOriginate]\x20',_0x2a7900,_0x93bc44[0x0]);}else{_0x56ba67[_0x9a97('0xb7')](_['pick'](_0x93bc44[0x0],[_0x9a97('0xd1'),'Contact.phone']))['then'](_0x56ba67['checkContactBlack'](_0x2a7900,_0x93bc44[0x0]))[_0x9a97('0xb1')](_0x56ba67[_0x9a97('0xcb')](_0x9a97('0x20d'),_0x2a7900));}}})['catch'](loggerGetContactDialer(_0x9a97('0x20e'),_0x2a7900,0x1));emitVoiceQueueSummary(_0x2a7900);};Dialer[_0x9a97('0xab')][_0x9a97('0x20f')]=function(_0x16639f,_0xde1e0,_0x413947,_0x3d3502,_0x402d26,_0x75f830){loggerPredictive[_0x9a97('0x7e')](_0x9a97('0x210'));loggerPredictive[_0x9a97('0x7e')]('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x16639f);loggerPredictive[_0x9a97('0x7e')](_0x9a97('0x211'),_0xde1e0);loggerPredictive[_0x9a97('0x7e')](_0x9a97('0x212'),_0x413947);loggerPredictive['info'](_0x9a97('0x213'),_0x3d3502);loggerPredictive[_0x9a97('0x7e')](_0x9a97('0x214'),_0x402d26);loggerPredictive[_0x9a97('0x7e')](_0x9a97('0x86'));return new BPromise(function(_0x416a7e,_0x4db386){if(_0x16639f<=0x0||isNaN(_0x16639f)){return _0x4db386(msgResponse(_0x9a97('0x215'),_0x9a97('0x49'),_0x9a97('0x216')+_0x16639f));}if(_0x413947<=0x0||isNaN(_0x413947)){return _0x4db386(msgResponse('[abandonmentRate]',_0x9a97('0x49'),_0x9a97('0x217')+_0x413947));}if(_0x3d3502<=0x0||isNaN(_0x3d3502)){return _0x4db386(msgResponse(_0x9a97('0x215'),_0x9a97('0x49'),_0x9a97('0x218')+_0x3d3502));}if(_0xde1e0<=0x0||isNaN(_0xde1e0)){return _0x4db386(msgResponse(_0x9a97('0x215'),_0x9a97('0x49'),_0x9a97('0x219')+_0xde1e0));}if(_0x402d26<=0x0||isNaN(_0x402d26)){return _0x4db386(msgResponse(_0x9a97('0x215'),_0x9a97('0x49'),_0x9a97('0x21a')+_0x402d26));}_0x75f830=_0x75f830||0x0;var _0x5ed159=0x1/_0x413947;var _0x432836=0x0;var _0x32dcfe=0x0;var _0x1ca484=0x0;var _0x48554a=0x0;for(var _0x27f531=0x0;_0x1ca484<_0x402d26;_0x27f531+=0x1){_0x32dcfe=_0x27f531/_0xde1e0;_0x432836=(_0x3d3502*_0x32dcfe+_0x75f830)/_0x5ed159;_0x1ca484=erlangb(_0x432836,_0x16639f);_0x48554a=_0x432836/_0x16639f*(0x1-erlangb(_0x432836,_0x16639f));}return _0x416a7e({'erlangCalls':_0x27f531,'erlangCallToSecond':_0xde1e0/_0x27f531,'erlangAbandonmentRate':_0x1ca484,'erlangBusyFactor':_0x48554a});});};Dialer[_0x9a97('0xab')][_0x9a97('0x1e0')]=function(_0x1383ee,_0x15205f,_0x46d8ab,_0x34f4a6,_0x364f0a,_0x2bfaa3){loggerPredictive['info'](_0x9a97('0x21b'));loggerPredictive[_0x9a97('0x7e')](_0x9a97('0x21c'),_0x1383ee);loggerPredictive[_0x9a97('0x7e')](_0x9a97('0x211'),_0x15205f);loggerPredictive['info']('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',_0x46d8ab);loggerPredictive[_0x9a97('0x7e')]('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',_0x34f4a6);loggerPredictive[_0x9a97('0x7e')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x364f0a);loggerPredictive['info'](_0x9a97('0x86'));return new BPromise(function(_0x2b569b,_0x230596){if(_0x1383ee<=0x0||isNaN(_0x1383ee)){return _0x230596(msgResponse(_0x9a97('0x21d'),_0x9a97('0x49'),_0x9a97('0x216')+_0x1383ee));}if(_0x46d8ab<=0x0||isNaN(_0x46d8ab)){return _0x230596(msgResponse('[busyFactor]',_0x9a97('0x49'),_0x9a97('0x217')+_0x46d8ab));}if(_0x34f4a6<=0x0||isNaN(_0x34f4a6)){return _0x230596(msgResponse(_0x9a97('0x21d'),_0x9a97('0x49'),'p\x20=\x20'+_0x34f4a6));}if(_0x15205f<=0x0||isNaN(_0x15205f)){return _0x230596(msgResponse('[busyFactor]',_0x9a97('0x49'),'interval\x20=\x20'+_0x15205f));}if(_0x364f0a<=0x0||isNaN(_0x364f0a)){return _0x230596(msgResponse(_0x9a97('0x21d'),'Error',_0x9a97('0x21e')+_0x364f0a));}_0x2bfaa3=_0x2bfaa3||0x0;var _0x31be7e=0x1/_0x46d8ab;var _0x444e88=0x0;var _0x162340=0x0;var _0x37cc52=0x0;var _0x2e34ee=0x0;for(var _0x84fc0d=0x0;_0x2e34ee<_0x364f0a;_0x84fc0d+=0x1){_0x162340=_0x84fc0d/_0x15205f;_0x444e88=(_0x34f4a6*_0x162340+_0x2bfaa3)/_0x31be7e;_0x37cc52=erlangb(_0x444e88,_0x1383ee);_0x2e34ee=_0x444e88/_0x1383ee*(0x1-erlangb(_0x444e88,_0x1383ee));}return _0x2b569b({'erlangCalls':_0x84fc0d,'erlangCallToSecond':_0x15205f/_0x84fc0d,'erlangAbandonmentRate':_0x37cc52,'erlangBusyFactor':_0x2e34ee});});};module[_0x9a97('0x21f')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 465e750..f6a6537 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbb19=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','milliseconds','seconds','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countagentrejectretry','countdropretry','countabandonedretry','countmachineretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime','endtime','holdtime','talktime','queue','membername','connectedlinename','reason'];(function(_0x344ef9,_0x38f8a3){var _0xa088ce=function(_0x884e2b){while(--_0x884e2b){_0x344ef9['push'](_0x344ef9['shift']());}};_0xa088ce(++_0x38f8a3);}(_0xbb19,0xf4));var _0x9bb1=function(_0x390d38,_0x54d08f){_0x390d38=_0x390d38-0x0;var _0x414bee=_0xbb19[_0x390d38];return _0x414bee;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function getSeconds(_0x382405,_0x54757d){var _0x2dac13=moment(_0x382405)['milliseconds'](0x0);var _0x195cd4=moment(_0x54757d)[_0x9bb1('0x0')](0x0);return _0x2dac13['diff'](_0x195cd4,_0x9bb1('0x1'));}function QueueCallerAbandon(_0x2f5e80,_0x70af17){this[_0x9bb1('0x2')]=_0x2f5e80['scheduledat'];this[_0x9bb1('0x3')]=_0x2f5e80['type'];this[_0x9bb1('0x4')]=_0x2f5e80[_0x9bb1('0x3')]===_0x9bb1('0x5')?'queue':_0x2f5e80['type'];this[_0x9bb1('0x6')]=_0x2f5e80[_0x9bb1('0x6')];this[_0x9bb1('0x7')]=_0x2f5e80[_0x9bb1('0x7')];this[_0x9bb1('0x8')]=_0x2f5e80[_0x9bb1('0x8')];this[_0x9bb1('0x9')]=_0x2f5e80[_0x9bb1('0x6')]+_0x2f5e80[_0x9bb1('0x7')]+_0x2f5e80[_0x9bb1('0x8')]+_0x2f5e80[_0x9bb1('0xa')]+_0x2f5e80['countdropretry']+_0x2f5e80['countabandonedretry']+_0x2f5e80['countmachineretry']+_0x2f5e80[_0x9bb1('0xb')];this['countnosuchnumberretry']=_0x2f5e80[_0x9bb1('0xa')];this[_0x9bb1('0xc')]=_0x2f5e80[_0x9bb1('0xc')];this[_0x9bb1('0xd')]=_0x2f5e80[_0x9bb1('0xd')];this['countmachineretry']=_0x2f5e80[_0x9bb1('0xe')];this[_0x9bb1('0xb')]=_0x2f5e80[_0x9bb1('0xb')];this[_0x9bb1('0xf')]=_0x70af17[_0x9bb1('0xf')];this['calleridname']=_0x2f5e80[_0x9bb1('0x10')];this[_0x9bb1('0x11')]=_0x2f5e80[_0x9bb1('0x12')];this[_0x9bb1('0x13')]=_0x2f5e80[_0x9bb1('0x13')];this[_0x9bb1('0x14')]=_0x2f5e80[_0x9bb1('0x14')];this[_0x9bb1('0x15')]=_0x2f5e80[_0x9bb1('0x15')];this[_0x9bb1('0x16')]=this[_0x9bb1('0x15')];this['ringtime']=getSeconds(_0x2f5e80[_0x9bb1('0x14')],_0x2f5e80['starttime']);this[_0x9bb1('0x17')]=getSeconds(this[_0x9bb1('0x15')],_0x2f5e80[_0x9bb1('0x14')]);this[_0x9bb1('0x18')]=0x0;this[_0x9bb1('0x19')]=_0x70af17[_0x9bb1('0x19')];this[_0x9bb1('0x1a')]=_0x70af17[_0x9bb1('0x1b')];this['reason']=_0x70af17[_0x9bb1('0x1c')];this['callback']=_0x2f5e80['callback'];this[_0x9bb1('0x1d')]=_0x2f5e80[_0x9bb1('0x1d')];this['callbackat']=_0x2f5e80[_0x9bb1('0x1e')];this[_0x9bb1('0x1f')]=_0x2f5e80[_0x9bb1('0x1f')];this[_0x9bb1('0x20')]=_0x2f5e80[_0x9bb1('0x20')];this['ListId']=_0x2f5e80[_0x9bb1('0x21')];this[_0x9bb1('0x22')]=_0x2f5e80[_0x9bb1('0x22')];this['VoiceQueueId']=_0x2f5e80[_0x9bb1('0x23')];this[_0x9bb1('0x24')]=_0x2f5e80['CampaignId'];this[_0x9bb1('0x25')]=_0x2f5e80[_0x9bb1('0x25')]||'';this[_0x9bb1('0x26')]=_0x2f5e80[_0x9bb1('0x26')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x7cfe=['type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countagentrejectretry','countdropretry','countabandonedretry','uniqueid','calleridname','calleridnum','number','starttime','droptime','ringtime','holdtime','talktime','membername','connectedlinename','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','milliseconds','diff','scheduledat'];(function(_0x5131ea,_0x10a0a1){var _0x1928f2=function(_0x322109){while(--_0x322109){_0x5131ea['push'](_0x5131ea['shift']());}};_0x1928f2(++_0x10a0a1);}(_0x7cfe,0x94));var _0xe7cf=function(_0x147223,_0x4294ce){_0x147223=_0x147223-0x0;var _0x2adb2c=_0x7cfe[_0x147223];return _0x2adb2c;};'use strict';var util=require(_0xe7cf('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x3be13f,_0x188335){var _0x593f98=moment(_0x3be13f)[_0xe7cf('0x1')](0x0);var _0x18f5cf=moment(_0x188335)[_0xe7cf('0x1')](0x0);return _0x593f98[_0xe7cf('0x2')](_0x18f5cf,'seconds');}function QueueCallerAbandon(_0x6549be,_0x430d41){this[_0xe7cf('0x3')]=_0x6549be[_0xe7cf('0x3')];this['type']=_0x6549be[_0xe7cf('0x4')];this[_0xe7cf('0x5')]=_0x6549be[_0xe7cf('0x4')]==='outbound'?_0xe7cf('0x6'):_0x6549be[_0xe7cf('0x4')];this[_0xe7cf('0x7')]=_0x6549be[_0xe7cf('0x7')];this[_0xe7cf('0x8')]=_0x6549be[_0xe7cf('0x8')];this['countnoanswerretry']=_0x6549be[_0xe7cf('0x9')];this[_0xe7cf('0xa')]=_0x6549be[_0xe7cf('0x7')]+_0x6549be['countcongestionretry']+_0x6549be[_0xe7cf('0x9')]+_0x6549be[_0xe7cf('0xb')]+_0x6549be['countdropretry']+_0x6549be['countabandonedretry']+_0x6549be['countmachineretry']+_0x6549be[_0xe7cf('0xc')];this['countnosuchnumberretry']=_0x6549be[_0xe7cf('0xb')];this[_0xe7cf('0xd')]=_0x6549be[_0xe7cf('0xd')];this['countabandonedretry']=_0x6549be[_0xe7cf('0xe')];this['countmachineretry']=_0x6549be['countmachineretry'];this[_0xe7cf('0xc')]=_0x6549be[_0xe7cf('0xc')];this['uniqueid']=_0x430d41[_0xe7cf('0xf')];this[_0xe7cf('0x10')]=_0x6549be['name'];this[_0xe7cf('0x11')]=_0x6549be[_0xe7cf('0x12')];this[_0xe7cf('0x13')]=_0x6549be['starttime'];this['responsetime']=_0x6549be['responsetime'];this['droptime']=_0x6549be[_0xe7cf('0x14')];this['endtime']=this[_0xe7cf('0x14')];this[_0xe7cf('0x15')]=getSeconds(_0x6549be['responsetime'],_0x6549be[_0xe7cf('0x13')]);this[_0xe7cf('0x16')]=getSeconds(this[_0xe7cf('0x14')],_0x6549be['responsetime']);this[_0xe7cf('0x17')]=0x0;this[_0xe7cf('0x6')]=_0x430d41[_0xe7cf('0x6')];this[_0xe7cf('0x18')]=_0x430d41[_0xe7cf('0x19')];this['reason']=_0x430d41['reason'];this[_0xe7cf('0x1a')]=_0x6549be['callback'];this[_0xe7cf('0x1b')]=_0x6549be[_0xe7cf('0x1b')];this['callbackat']=_0x6549be[_0xe7cf('0x1c')];this[_0xe7cf('0x1d')]=_0x6549be[_0xe7cf('0x1d')];this[_0xe7cf('0x1e')]=_0x6549be[_0xe7cf('0x1e')];this[_0xe7cf('0x1f')]=_0x6549be[_0xe7cf('0x1f')];this[_0xe7cf('0x20')]=_0x6549be['UserId'];this[_0xe7cf('0x21')]=_0x6549be[_0xe7cf('0x21')];this[_0xe7cf('0x22')]=_0x6549be['CampaignId'];this[_0xe7cf('0x23')]=_0x6549be[_0xe7cf('0x23')]||'';this[_0xe7cf('0x24')]=_0x6549be[_0xe7cf('0x24')]||'';}module[_0xe7cf('0x25')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 1f2f531..0eb9f6b 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(_0x4a71dc,_0x3ba07c){var _0x5b3317=function(_0x27c3bc){while(--_0x27c3bc){_0x4a71dc['push'](_0x4a71dc['shift']());}};_0x5b3317(++_0x3ba07c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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(_0x1a084b,_0x1e51dd){var _0x34af00=function(_0x1eda25){while(--_0x1eda25){_0x1a084b['push'](_0x1a084b['shift']());}};_0x34af00(++_0x1e51dd);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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 8e7939d..48d66ba 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 _0xe605=['XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','format','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/attachment','faxAccounts','trunks','actions','newchannel','bind','syncVarSet','newstate','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncOriginateResponse','syncNewchannel','context','from-voip-provider','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','variable','hasOwnProperty','syncNewState','channelstate','value','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','update','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','AttachmentId','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','execute','%s/%s.tif'];(function(_0x40a67a,_0x5c100e){var _0xb0dc9a=function(_0x13d9a7){while(--_0x13d9a7){_0x40a67a['push'](_0x40a67a['shift']());}};_0xb0dc9a(++_0x5c100e);}(_0xe605,0x92));var _0x5e60=function(_0x32a8fd,_0x517a62){_0x32a8fd=_0x32a8fd-0x0;var _0x55df00=_0xe605[_0x32a8fd];return _0x55df00;};'use strict';var util=require(_0x5e60('0x0'));var _=require(_0x5e60('0x1'));var BPromise=require('bluebird');var uuid=require(_0x5e60('0x2'));var moment=require(_0x5e60('0x3'));var path=require(_0x5e60('0x4'));var tiff2pdf=require(_0x5e60('0x5'));var gs=require(_0x5e60('0x6'));var logger=require(_0x5e60('0x7'))(_0x5e60('0x8'));var ami=require(_0x5e60('0x9'));var rpcDb=require(_0x5e60('0xa'));var Channel=require(_0x5e60('0xb'));var ut=require(_0x5e60('0xc'));var Action=require(_0x5e60('0xd'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x5e60('0xe'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x593118){this['channels']={};this[_0x5e60('0xf')]=_0x593118[_0x5e60('0xf')];this[_0x5e60('0x10')]=_0x593118[_0x5e60('0x10')];this[_0x5e60('0x11')]={};ami['on'](_0x5e60('0x12'),this['syncNewchannel'][_0x5e60('0x13')](this));ami['on']('varset',this[_0x5e60('0x14')][_0x5e60('0x13')](this));ami['on'](_0x5e60('0x15'),this['syncNewState'][_0x5e60('0x13')](this));ami['on'](_0x5e60('0x16'),this[_0x5e60('0x17')][_0x5e60('0x13')](this));ami['on'](_0x5e60('0x18'),this[_0x5e60('0x19')]['bind'](this));ami['on'](_0x5e60('0x1a'),this[_0x5e60('0x1b')][_0x5e60('0x13')](this));ami['on'](_0x5e60('0x1c'),this['syncHangup'][_0x5e60('0x13')](this));ami['on']('originateresponse',this[_0x5e60('0x1d')][_0x5e60('0x13')](this));}Fax['prototype'][_0x5e60('0x1e')]=function(_0x3e1a44){if(_0x3e1a44[_0x5e60('0x1f')]===_0x5e60('0x20')){for(var _0x5c485d in this[_0x5e60('0xf')]){if(this[_0x5e60('0xf')]['hasOwnProperty'](_0x5c485d)){if(_0x3e1a44[_0x5e60('0x21')]===this[_0x5e60('0xf')][_0x5c485d][_0x5e60('0x22')]){this[_0x5e60('0x23')][_0x3e1a44[_0x5e60('0x24')]]={};this[_0x5e60('0x23')][_0x3e1a44[_0x5e60('0x24')]][_0x5e60('0x25')]=_0x3e1a44[_0x5e60('0x25')];this[_0x5e60('0x23')][_0x3e1a44[_0x5e60('0x24')]]['id']=this['faxAccounts'][_0x5c485d]['id'];this[_0x5e60('0x23')][_0x3e1a44['uniqueid']][_0x5e60('0x26')]=this[_0x5e60('0xf')][_0x5c485d][_0x5e60('0x26')];logger[_0x5e60('0x27')](_0x3e1a44[_0x5e60('0x24')],_0x5e60('0x28'));}}}}if(this[_0x5e60('0x11')][_0x3e1a44['uniqueid']]){this[_0x5e60('0x23')][_0x3e1a44[_0x5e60('0x24')]]={};this[_0x5e60('0x23')][_0x3e1a44['uniqueid']][_0x5e60('0x25')]=_0x3e1a44[_0x5e60('0x25')];logger[_0x5e60('0x27')](_0x3e1a44[_0x5e60('0x24')],'\x20syncNewchannel\x20');}};Fax[_0x5e60('0x29')]['syncVarSet']=function(_0x23d187){if(this[_0x5e60('0x23')][_0x23d187['uniqueid']]){for(var _0x46691f in _0x23d187[_0x5e60('0x2a')]){if(_0x23d187['variable'][_0x5e60('0x2b')](_0x46691f)){this[_0x5e60('0x23')][_0x23d187['uniqueid']][_0x46691f]=_0x23d187['value'];}}}};Fax['prototype'][_0x5e60('0x2c')]=function(_0x235cc7){if(this[_0x5e60('0x23')][_0x235cc7[_0x5e60('0x24')]]){this[_0x5e60('0x23')][_0x235cc7['uniqueid']][_0x5e60('0x2d')]=_0x235cc7[_0x5e60('0x2d')];this['channels'][_0x235cc7[_0x5e60('0x24')]]['channelstatedesc']=_0x235cc7['channelstatedesc'];}};Fax[_0x5e60('0x29')][_0x5e60('0x17')]=function(_0x1f474b){if(this[_0x5e60('0x23')][_0x1f474b[_0x5e60('0x24')]]){for(var _0xbf5b7a in _0x1f474b[_0x5e60('0x2a')]){if(_0x1f474b[_0x5e60('0x2a')][_0x5e60('0x2b')](_0xbf5b7a)){this[_0x5e60('0x23')][_0x1f474b['uniqueid']][_0xbf5b7a]=_0x1f474b[_0x5e60('0x2e')];}}}};Fax['prototype']['syncFaxStatus']=function(_0x478415){if(this[_0x5e60('0x23')][_0x478415['uniqueid']]){this[_0x5e60('0x23')][_0x478415['uniqueid']][_0x5e60('0x2f')]=_0x478415[_0x5e60('0x2f')];this[_0x5e60('0x23')][_0x478415[_0x5e60('0x24')]][_0x5e60('0x30')]=_0x478415[_0x5e60('0x30')];this[_0x5e60('0x23')][_0x478415[_0x5e60('0x24')]]['localstationid']=_0x478415[_0x5e60('0x22')];this[_0x5e60('0x23')][_0x478415[_0x5e60('0x24')]][_0x5e60('0x31')]=_0x478415[_0x5e60('0x31')];logger[_0x5e60('0x27')](_0x478415[_0x5e60('0x24')],'\x20syncFaxStatus\x20');}};Fax[_0x5e60('0x29')][_0x5e60('0x1b')]=function(_0x4cba18){var _0x532ab2=this;if(this[_0x5e60('0x23')][_0x4cba18[_0x5e60('0x24')]]){var _0x1ae294=this[_0x5e60('0x23')][_0x4cba18[_0x5e60('0x24')]]['id'];this['channels'][_0x4cba18[_0x5e60('0x24')]][_0x5e60('0x32')]=_0x4cba18[_0x5e60('0x32')];this[_0x5e60('0x23')][_0x4cba18[_0x5e60('0x24')]][_0x5e60('0x33')]=_0x4cba18[_0x5e60('0x33')];this['channels'][_0x4cba18[_0x5e60('0x24')]][_0x5e60('0x22')]=_0x4cba18['localstationid'];this['channels'][_0x4cba18['uniqueid']][_0x5e60('0x34')]=_0x4cba18[_0x5e60('0x34')];this[_0x5e60('0x23')][_0x4cba18[_0x5e60('0x24')]]['transferrate']=_0x4cba18[_0x5e60('0x35')];this[_0x5e60('0x23')][_0x4cba18['uniqueid']]['filename']=_0x4cba18[_0x5e60('0x31')];this[_0x5e60('0x23')][_0x4cba18[_0x5e60('0x24')]][_0x5e60('0x36')]=_0x4cba18[_0x5e60('0x36')];if(this[_0x5e60('0x23')][_0x4cba18[_0x5e60('0x24')]][_0x5e60('0x33')]>0x0){tiff2pdf(_0x4cba18[_0x5e60('0x31')],'/var/opt/motion2/server/files/attachments/',function(_0x284e66){logger[_0x5e60('0x27')](_0x4cba18['uniqueid'],_0x5e60('0x37'),_0x284e66[_0x5e60('0x38')]);attachment[_0x5e60('0x39')]({'name':path[_0x5e60('0x3a')](_0x4cba18[_0x5e60('0x31')])['name'],'basename':path[_0x5e60('0x3a')](_0x4cba18[_0x5e60('0x31')])[_0x5e60('0x26')]+_0x5e60('0x3b'),'type':'application/pdf'})['then'](function(_0x5b9f5a){faxAccount[_0x5e60('0x3c')](_0x1ae294,{'from':_0x4cba18[_0x5e60('0x36')],'mapKey':_0x5e60('0x8'),'body':path[_0x5e60('0x3a')](_0x4cba18[_0x5e60('0x31')])[_0x5e60('0x26')]+'.pdf','AttachmentId':_0x5b9f5a['id']})[_0x5e60('0x3d')](function(_0x1c48d0){logger[_0x5e60('0x3e')](_0x4cba18[_0x5e60('0x24')],_0x5e60('0x3f'),JSON[_0x5e60('0x40')](_0x1c48d0));});})[_0x5e60('0x3d')](function(_0x4acd96){logger[_0x5e60('0x3e')](_0x4cba18[_0x5e60('0x24')],_0x5e60('0x41'),JSON[_0x5e60('0x40')](_0x4acd96));});});}logger[_0x5e60('0x27')](_0x4cba18[_0x5e60('0x24')],_0x5e60('0x41'));}};Fax[_0x5e60('0x29')][_0x5e60('0x1d')]=function(_0x350d6d){if(this[_0x5e60('0x11')][_0x350d6d[_0x5e60('0x24')]]){_[_0x5e60('0x42')](this[_0x5e60('0x23')][_0x350d6d[_0x5e60('0x24')]],_[_0x5e60('0x43')](_0x350d6d,[_0x5e60('0x44'),_0x5e60('0x45')]));}};function updateStatus(_0x54479d){if(_0x54479d['AttachmentId']){faxMessage[_0x5e60('0x46')](_0x54479d['AttachmentId'],{'failMessage':_0x5e60('0x47')})[_0x5e60('0x48')](function(_0x20d6e6){ut[_0x5e60('0x49')](_0x5e60('0x4a'),_0x20d6e6);})[_0x5e60('0x3d')](function(_0x4b72a4){ut['logger'](_0x5e60('0x4b'),_0x4b72a4);});}else{ut[_0x5e60('0x49')](_0x5e60('0x4c'));}}Fax['prototype']['updateStatus']=function(_0x31ced8,_0x46f3ba,_0x179cc6){var _0x501b87=this;var _0x1a3ed9={};if(_0x46f3ba){_0x1a3ed9={'read':_0x46f3ba};}else{_0x1a3ed9={'failMessage':_0x179cc6};}if(this[_0x5e60('0x11')][_0x31ced8][_0x5e60('0x4d')]){faxMessage[_0x5e60('0x46')](this[_0x5e60('0x11')][_0x31ced8][_0x5e60('0x4d')],_0x1a3ed9)['then'](function(_0x412be1){ut[_0x5e60('0x49')]('[Fax][Message][Updated]',_0x412be1);})[_0x5e60('0x3d')](function(_0x3f6a1e){ut[_0x5e60('0x49')]('[Fax][Message][NoUpdate1]',_0x3f6a1e);})[_0x5e60('0x4e')](function(){delete _0x501b87[_0x5e60('0x23')][_0x31ced8];delete _0x501b87['actions'][_0x31ced8];});}else{ut[_0x5e60('0x49')](_0x5e60('0x4f'));delete this[_0x5e60('0x23')][_0x31ced8];delete this[_0x5e60('0x11')][_0x31ced8];}};Fax['prototype'][_0x5e60('0x50')]=function(_0x1abc43){var _0x4ded96=this;if(this[_0x5e60('0x23')][_0x1abc43['uniqueid']]){if(this[_0x5e60('0x11')][_0x1abc43['uniqueid']]){this[_0x5e60('0x23')][_0x1abc43[_0x5e60('0x24')]]['id']=this['actions'][_0x1abc43[_0x5e60('0x24')]]['id'];this['channels'][_0x1abc43[_0x5e60('0x24')]]['name']=this[_0x5e60('0x11')][_0x1abc43['uniqueid']][_0x5e60('0x26')];}logger[_0x5e60('0x27')](_0x1abc43[_0x5e60('0x24')],this[_0x5e60('0x11')][_0x1abc43[_0x5e60('0x24')]]?_0x5e60('0x51'):_0x5e60('0x52'),JSON['stringify'](this[_0x5e60('0x23')][_0x1abc43[_0x5e60('0x24')]]));if(this[_0x5e60('0x11')][_0x1abc43[_0x5e60('0x24')]]){if(this[_0x5e60('0x23')][_0x1abc43[_0x5e60('0x24')]]['faxpages']>0x0&&this['channels'][_0x1abc43['uniqueid']][_0x5e60('0x18')]===_0x5e60('0x53')){this['updateStatus'](_0x1abc43[_0x5e60('0x24')],!![]);}else{this[_0x5e60('0x54')](_0x1abc43['uniqueid'],![],this[_0x5e60('0x23')][_0x1abc43[_0x5e60('0x24')]][_0x5e60('0x55')]?_0x5e60('0x56')+this[_0x5e60('0x23')][_0x1abc43[_0x5e60('0x24')]][_0x5e60('0x55')]:_0x5e60('0x57'));}}}};Fax[_0x5e60('0x29')][_0x5e60('0x58')]=function(_0x157aad){var _0x15921d=this;return new BPromise(function(_0xc5f45,_0x2826f7){_0x15921d[_0x5e60('0x59')](_0x157aad,_0x15921d[_0x5e60('0xf')][_0x157aad[_0x5e60('0x5a')]])['then'](function(_0x922817){ut[_0x5e60('0x49')](_0x5e60('0x5b'),_0x922817);_0xc5f45(ut['message'](_0x5e60('0x5c')));})[_0x5e60('0x3d')](function(_0x58376d){ut[_0x5e60('0x49')](_0x5e60('0x5d'),_0x58376d);updateStatus(_0x157aad);_0x2826f7(ut['message'](_0x5e60('0x5e')));});});};Fax[_0x5e60('0x29')][_0x5e60('0x5f')]=function(_0xd9a0db){var _0x1db659=this;return new BPromise(function(_0x711888,_0x221f35){var _0x3b5493=_0x1db659[_0x5e60('0x60')](_0x1db659['faxAccounts'][_0xd9a0db[_0x5e60('0x5a')]][_0x5e60('0x61')],_0xd9a0db);if(_0x3b5493[_0x5e60('0x62')]){_0x711888(ut['message'](_0x5e60('0x63')));}else{_0x221f35(ut[_0x5e60('0x38')](_0x3b5493[_0x5e60('0x38')]));}});};function originate(_0x15d975,_0x3e85fe,_0x559f8c){return new BPromise(function(_0x4560e1,_0x213c7e){if(_0x559f8c){var _0x3463a7=util['format']('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0x5e60('0x3a')](_0x15d975[_0x5e60('0x4')])[_0x5e60('0x26')],_0x15d975[_0x5e60('0x4')]);gs[_0x5e60('0x64')](_0x3463a7)[_0x5e60('0x48')](function(){_0x15d975[_0x5e60('0x4')]=util['format'](_0x5e60('0x65'),path[_0x5e60('0x3a')](_0x15d975[_0x5e60('0x4')])['dir'],path['parse'](_0x15d975[_0x5e60('0x4')])[_0x5e60('0x26')]);_0x3e85fe[_0x5e60('0x66')]=_0x15d975['path'];ut['logger'](_0x5e60('0x67'),'');ami[_0x5e60('0x68')](ut[_0x5e60('0x69')](_0x15d975,_0x3e85fe))[_0x5e60('0x48')](function(_0x42c62d){_0x4560e1(_0x42c62d);})[_0x5e60('0x3d')](function(_0x4a1e15){_0x213c7e(_0x4a1e15);});})[_0x5e60('0x3d')](function(_0x406a74){_0x213c7e(_0x406a74);});}else{ami[_0x5e60('0x68')](ut[_0x5e60('0x69')](_0x15d975,_0x3e85fe))[_0x5e60('0x48')](function(_0x1750b5){_0x4560e1(_0x1750b5);})[_0x5e60('0x3d')](function(_0x92d9c5){_0x213c7e(_0x92d9c5);});}});}Fax[_0x5e60('0x29')]['execOriginate']=function(_0x34cfa7,_0x136464){var _0x48570a=this;return new BPromise(function(_0x306e7c,_0x26508b){var _0x530a21=uuid['v4']();var _0x312ae3=ut[_0x5e60('0x6a')](_0x34cfa7,_0x136464);_0x48570a[_0x5e60('0x11')][_0x530a21]=new Action(_0x530a21,_0x136464,_0x34cfa7);var _0x1b4aee=_0x48570a[_0x5e60('0x11')][_0x530a21];if(path[_0x5e60('0x3a')](_0x34cfa7['path'])[_0x5e60('0x6b')]===_0x5e60('0x3b')){originate(_0x1b4aee,_0x312ae3,!![])[_0x5e60('0x48')](function(_0x222d94){_0x306e7c(_0x222d94);})[_0x5e60('0x3d')](function(_0xd70e8f){_0x26508b(_0xd70e8f);});}else{originate(_0x1b4aee,_0x312ae3,![])[_0x5e60('0x48')](function(_0x3f6bb2){_0x306e7c(_0x3f6bb2);})[_0x5e60('0x3d')](function(_0x58e900){_0x26508b(_0x58e900);});}});};Fax[_0x5e60('0x29')][_0x5e60('0x6c')]=function(_0x71d909){return!_[_0x5e60('0x6d')](_0x71d909)&&!_[_0x5e60('0x6d')](_0x71d909[_0x5e60('0x26')])&&!_[_0x5e60('0x6d')](_0x71d909[_0x5e60('0x6e')])&&_0x71d909[_0x5e60('0x6e')]&&!_[_0x5e60('0x6d')](this['trunks'][util['format']('SIP/%s',_0x71d909[_0x5e60('0x26')])])&&!_[_0x5e60('0x6d')](this[_0x5e60('0x10')][util[_0x5e60('0x6f')](_0x5e60('0x70'),_0x71d909[_0x5e60('0x26')])][_0x5e60('0x30')])&&(this[_0x5e60('0x10')][util[_0x5e60('0x6f')]('SIP/%s',_0x71d909[_0x5e60('0x26')])][_0x5e60('0x30')]===_0x5e60('0x71')||this['trunks'][util[_0x5e60('0x6f')]('SIP/%s',_0x71d909['name'])]['status']===_0x5e60('0x72'));};Fax[_0x5e60('0x29')][_0x5e60('0x60')]=function(_0x148c53,_0x445e6a){if(!this[_0x5e60('0x6c')](_0x148c53)){ut[_0x5e60('0x49')](_0x5e60('0x73'),_[_0x5e60('0x6d')](_0x148c53)?'':_0x148c53['name']+_0x5e60('0x74'));return{'isValid':![],'message':_0x5e60('0x75')};}if(_[_0x5e60('0x6d')](_0x445e6a[_0x5e60('0x8')])){ut[_0x5e60('0x49')](_0x5e60('0x76'),JSON[_0x5e60('0x40')](_0x445e6a));return{'isValid':![],'message':_0x5e60('0x77')};}if(_[_0x5e60('0x6d')](_0x445e6a[_0x5e60('0x4')])){ut[_0x5e60('0x49')](_0x5e60('0x78'),JSON['stringify'](_0x445e6a));return{'isValid':![],'message':_0x5e60('0x79')};}return{'isValid':!![],'message':_0x5e60('0x7a')};};module[_0x5e60('0x7b')]=Fax; \ No newline at end of file +var _0xf45e=['checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','bluebird','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','syncFaxStatus','receivefax','syncReceiveFax','syncOriginateResponse','prototype','from-voip-provider','localstationid','uniqueid','channel','\x20syncNewchannel\x20','info','hasOwnProperty','value','channelstate','channelstatedesc','variable','operation','status','\x20syncFaxStatus\x20','remotestationid','resolution','transferrate','filename','calleridnum','pagestransferred','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','name','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','\x20receiveFax\x20','stringify','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xf45e,0x115));var _0xef45=function(_0x4b7421,_0x478907){_0x4b7421=_0x4b7421-0x0;var _0x58cd23=_0xf45e[_0x4b7421];return _0x58cd23;};'use strict';var util=require(_0xef45('0x0'));var _=require('lodash');var BPromise=require(_0xef45('0x1'));var uuid=require('uuid');var moment=require(_0xef45('0x2'));var path=require(_0xef45('0x3'));var tiff2pdf=require(_0xef45('0x4'));var gs=require(_0xef45('0x5'));var logger=require(_0xef45('0x6'))(_0xef45('0x7'));var ami=require(_0xef45('0x8'));var rpcDb=require(_0xef45('0x9'));var Channel=require(_0xef45('0xa'));var ut=require(_0xef45('0xb'));var Action=require(_0xef45('0xc'));var faxAccount=require(_0xef45('0xd'));var attachment=require(_0xef45('0xe'));var faxMessage=require(_0xef45('0xf'));function Fax(_0x268ef6){this[_0xef45('0x10')]={};this[_0xef45('0x11')]=_0x268ef6[_0xef45('0x11')];this[_0xef45('0x12')]=_0x268ef6['trunks'];this[_0xef45('0x13')]={};ami['on'](_0xef45('0x14'),this[_0xef45('0x15')][_0xef45('0x16')](this));ami['on'](_0xef45('0x17'),this[_0xef45('0x18')]['bind'](this));ami['on'](_0xef45('0x19'),this[_0xef45('0x1a')][_0xef45('0x16')](this));ami['on'](_0xef45('0x1b'),this[_0xef45('0x1c')]['bind'](this));ami['on']('faxstatus',this[_0xef45('0x1d')]['bind'](this));ami['on'](_0xef45('0x1e'),this[_0xef45('0x1f')][_0xef45('0x16')](this));ami['on']('hangup',this['syncHangup'][_0xef45('0x16')](this));ami['on']('originateresponse',this[_0xef45('0x20')][_0xef45('0x16')](this));}Fax[_0xef45('0x21')][_0xef45('0x15')]=function(_0x4bec7d){if(_0x4bec7d['context']===_0xef45('0x22')){for(var _0x219778 in this[_0xef45('0x11')]){if(this[_0xef45('0x11')]['hasOwnProperty'](_0x219778)){if(_0x4bec7d['exten']===this[_0xef45('0x11')][_0x219778][_0xef45('0x23')]){this[_0xef45('0x10')][_0x4bec7d[_0xef45('0x24')]]={};this[_0xef45('0x10')][_0x4bec7d[_0xef45('0x24')]][_0xef45('0x25')]=_0x4bec7d['channel'];this[_0xef45('0x10')][_0x4bec7d[_0xef45('0x24')]]['id']=this[_0xef45('0x11')][_0x219778]['id'];this[_0xef45('0x10')][_0x4bec7d[_0xef45('0x24')]]['name']=this[_0xef45('0x11')][_0x219778]['name'];logger['info'](_0x4bec7d[_0xef45('0x24')],_0xef45('0x26'));}}}}if(this[_0xef45('0x13')][_0x4bec7d[_0xef45('0x24')]]){this[_0xef45('0x10')][_0x4bec7d[_0xef45('0x24')]]={};this[_0xef45('0x10')][_0x4bec7d['uniqueid']][_0xef45('0x25')]=_0x4bec7d['channel'];logger[_0xef45('0x27')](_0x4bec7d[_0xef45('0x24')],'\x20syncNewchannel\x20');}};Fax[_0xef45('0x21')][_0xef45('0x18')]=function(_0x479e3c){if(this[_0xef45('0x10')][_0x479e3c['uniqueid']]){for(var _0x550e18 in _0x479e3c['variable']){if(_0x479e3c['variable'][_0xef45('0x28')](_0x550e18)){this[_0xef45('0x10')][_0x479e3c[_0xef45('0x24')]][_0x550e18]=_0x479e3c[_0xef45('0x29')];}}}};Fax['prototype'][_0xef45('0x1a')]=function(_0x4f028c){if(this[_0xef45('0x10')][_0x4f028c['uniqueid']]){this[_0xef45('0x10')][_0x4f028c['uniqueid']]['channelstate']=_0x4f028c[_0xef45('0x2a')];this[_0xef45('0x10')][_0x4f028c[_0xef45('0x24')]][_0xef45('0x2b')]=_0x4f028c[_0xef45('0x2b')];}};Fax['prototype']['syncNewExten']=function(_0x59030b){if(this[_0xef45('0x10')][_0x59030b[_0xef45('0x24')]]){for(var _0x32f3a9 in _0x59030b[_0xef45('0x2c')]){if(_0x59030b[_0xef45('0x2c')][_0xef45('0x28')](_0x32f3a9)){this[_0xef45('0x10')][_0x59030b['uniqueid']][_0x32f3a9]=_0x59030b['value'];}}}};Fax[_0xef45('0x21')]['syncFaxStatus']=function(_0x2aa6bb){if(this['channels'][_0x2aa6bb[_0xef45('0x24')]]){this[_0xef45('0x10')][_0x2aa6bb[_0xef45('0x24')]][_0xef45('0x2d')]=_0x2aa6bb[_0xef45('0x2d')];this['channels'][_0x2aa6bb[_0xef45('0x24')]][_0xef45('0x2e')]=_0x2aa6bb[_0xef45('0x2e')];this['channels'][_0x2aa6bb['uniqueid']][_0xef45('0x23')]=_0x2aa6bb[_0xef45('0x23')];this['channels'][_0x2aa6bb[_0xef45('0x24')]]['filename']=_0x2aa6bb['filename'];logger[_0xef45('0x27')](_0x2aa6bb[_0xef45('0x24')],_0xef45('0x2f'));}};Fax['prototype'][_0xef45('0x1f')]=function(_0x3a1bcc){var _0x2f5a82=this;if(this[_0xef45('0x10')][_0x3a1bcc['uniqueid']]){var _0x5bc364=this[_0xef45('0x10')][_0x3a1bcc[_0xef45('0x24')]]['id'];this[_0xef45('0x10')][_0x3a1bcc[_0xef45('0x24')]][_0xef45('0x30')]=_0x3a1bcc[_0xef45('0x30')];this[_0xef45('0x10')][_0x3a1bcc[_0xef45('0x24')]]['pagestransferred']=_0x3a1bcc['pagestransferred'];this[_0xef45('0x10')][_0x3a1bcc[_0xef45('0x24')]][_0xef45('0x23')]=_0x3a1bcc[_0xef45('0x23')];this[_0xef45('0x10')][_0x3a1bcc[_0xef45('0x24')]][_0xef45('0x31')]=_0x3a1bcc[_0xef45('0x31')];this[_0xef45('0x10')][_0x3a1bcc[_0xef45('0x24')]][_0xef45('0x32')]=_0x3a1bcc[_0xef45('0x32')];this[_0xef45('0x10')][_0x3a1bcc[_0xef45('0x24')]][_0xef45('0x33')]=_0x3a1bcc[_0xef45('0x33')];this['channels'][_0x3a1bcc[_0xef45('0x24')]][_0xef45('0x34')]=_0x3a1bcc[_0xef45('0x34')];if(this[_0xef45('0x10')][_0x3a1bcc['uniqueid']][_0xef45('0x35')]>0x0){tiff2pdf(_0x3a1bcc['filename'],_0xef45('0x36'),function(_0x48833c){logger[_0xef45('0x27')](_0x3a1bcc[_0xef45('0x24')],_0xef45('0x37'),_0x48833c[_0xef45('0x38')]);attachment[_0xef45('0x39')]({'name':path[_0xef45('0x3a')](_0x3a1bcc[_0xef45('0x33')])['name'],'basename':path[_0xef45('0x3a')](_0x3a1bcc[_0xef45('0x33')])[_0xef45('0x3b')]+_0xef45('0x3c'),'type':_0xef45('0x3d')})[_0xef45('0x3e')](function(_0xc692c0){faxAccount[_0xef45('0x3f')](_0x5bc364,{'from':_0x3a1bcc[_0xef45('0x34')],'mapKey':_0xef45('0x7'),'body':path[_0xef45('0x3a')](_0x3a1bcc[_0xef45('0x33')])[_0xef45('0x3b')]+_0xef45('0x3c'),'AttachmentId':_0xc692c0['id']})[_0xef45('0x40')](function(_0x4a2793){logger[_0xef45('0x41')](_0x3a1bcc[_0xef45('0x24')],_0xef45('0x42'),JSON['stringify'](_0x4a2793));});})['catch'](function(_0x4ae55f){logger[_0xef45('0x41')](_0x3a1bcc[_0xef45('0x24')],_0xef45('0x43'),JSON[_0xef45('0x44')](_0x4ae55f));});});}logger[_0xef45('0x27')](_0x3a1bcc[_0xef45('0x24')],'\x20receiveFax\x20');}};Fax[_0xef45('0x21')][_0xef45('0x20')]=function(_0x2b2419){if(this['actions'][_0x2b2419['uniqueid']]){_[_0xef45('0x45')](this[_0xef45('0x10')][_0x2b2419['uniqueid']],_[_0xef45('0x46')](_0x2b2419,[_0xef45('0x47'),_0xef45('0x48')]));}};function updateStatus(_0x39e9f8){if(_0x39e9f8[_0xef45('0x49')]){faxMessage[_0xef45('0x4a')](_0x39e9f8[_0xef45('0x49')],{'failMessage':_0xef45('0x4b')})[_0xef45('0x3e')](function(_0x1f3a10){ut[_0xef45('0x4c')](_0xef45('0x4d'),_0x1f3a10);})[_0xef45('0x40')](function(_0x1c1be2){ut['logger'](_0xef45('0x4e'),_0x1c1be2);});}else{ut[_0xef45('0x4c')](_0xef45('0x4f'));}}Fax['prototype'][_0xef45('0x50')]=function(_0x3f9b9a,_0x464bda,_0x1531ea){var _0x5a6a68=this;var _0x14bf49={};if(_0x464bda){_0x14bf49={'read':_0x464bda};}else{_0x14bf49={'failMessage':_0x1531ea};}if(this[_0xef45('0x13')][_0x3f9b9a][_0xef45('0x49')]){faxMessage[_0xef45('0x4a')](this[_0xef45('0x13')][_0x3f9b9a][_0xef45('0x49')],_0x14bf49)[_0xef45('0x3e')](function(_0x1a1ce5){ut[_0xef45('0x4c')](_0xef45('0x51'),_0x1a1ce5);})[_0xef45('0x40')](function(_0x24d158){ut['logger'](_0xef45('0x52'),_0x24d158);})[_0xef45('0x53')](function(){delete _0x5a6a68[_0xef45('0x10')][_0x3f9b9a];delete _0x5a6a68[_0xef45('0x13')][_0x3f9b9a];});}else{ut[_0xef45('0x4c')](_0xef45('0x54'));delete this['channels'][_0x3f9b9a];delete this['actions'][_0x3f9b9a];}};Fax[_0xef45('0x21')]['syncHangup']=function(_0x180574){var _0x2841df=this;if(this[_0xef45('0x10')][_0x180574['uniqueid']]){if(this[_0xef45('0x13')][_0x180574[_0xef45('0x24')]]){this['channels'][_0x180574[_0xef45('0x24')]]['id']=this['actions'][_0x180574['uniqueid']]['id'];this[_0xef45('0x10')][_0x180574[_0xef45('0x24')]][_0xef45('0x3b')]=this[_0xef45('0x13')][_0x180574[_0xef45('0x24')]]['name'];}logger[_0xef45('0x27')](_0x180574[_0xef45('0x24')],this['actions'][_0x180574[_0xef45('0x24')]]?_0xef45('0x55'):_0xef45('0x56'),JSON[_0xef45('0x44')](this[_0xef45('0x10')][_0x180574[_0xef45('0x24')]]));if(this[_0xef45('0x13')][_0x180574[_0xef45('0x24')]]){if(this['channels'][_0x180574[_0xef45('0x24')]]['faxpages']>0x0&&this['channels'][_0x180574[_0xef45('0x24')]]['faxstatus']===_0xef45('0x57')){this[_0xef45('0x50')](_0x180574['uniqueid'],!![]);}else{this[_0xef45('0x50')](_0x180574[_0xef45('0x24')],![],this[_0xef45('0x10')][_0x180574[_0xef45('0x24')]][_0xef45('0x58')]?_0xef45('0x59')+this['channels'][_0x180574[_0xef45('0x24')]][_0xef45('0x58')]:_0xef45('0x5a'));}}}};Fax[_0xef45('0x21')][_0xef45('0x5b')]=function(_0x51f841){var _0x2a7857=this;return new BPromise(function(_0x5e485d,_0x10723e){_0x2a7857[_0xef45('0x5c')](_0x51f841,_0x2a7857['faxAccounts'][_0x51f841[_0xef45('0x5d')]])[_0xef45('0x3e')](function(_0x2ec530){ut['logger']('[Fax][execOriginate][success]',_0x2ec530);_0x5e485d(ut[_0xef45('0x38')](_0xef45('0x5e')));})[_0xef45('0x40')](function(_0x55fcf3){ut[_0xef45('0x4c')](_0xef45('0x5f'),_0x55fcf3);updateStatus(_0x51f841);_0x10723e(ut['message'](_0xef45('0x60')));});});};Fax['prototype'][_0xef45('0x61')]=function(_0x6d0e51){var _0x17c2f2=this;return new BPromise(function(_0x26c230,_0x69bad2){var _0xfa4b8a=_0x17c2f2[_0xef45('0x62')](_0x17c2f2[_0xef45('0x11')][_0x6d0e51['FaxAccountId']][_0xef45('0x63')],_0x6d0e51);if(_0xfa4b8a[_0xef45('0x64')]){_0x26c230(ut[_0xef45('0x38')](_0xef45('0x65')));}else{_0x69bad2(ut[_0xef45('0x38')](_0xfa4b8a[_0xef45('0x38')]));}});};function originate(_0xef7b79,_0x14ae27,_0x444d39){return new BPromise(function(_0x41952f,_0xbf9898){if(_0x444d39){var _0x4f9517=util[_0xef45('0x66')](_0xef45('0x67'),path[_0xef45('0x3a')](_0xef7b79[_0xef45('0x3')])[_0xef45('0x3b')],_0xef7b79['path']);gs[_0xef45('0x68')](_0x4f9517)[_0xef45('0x3e')](function(){_0xef7b79['path']=util['format'](_0xef45('0x69'),path[_0xef45('0x3a')](_0xef7b79['path'])['dir'],path['parse'](_0xef7b79[_0xef45('0x3')])[_0xef45('0x3b')]);_0x14ae27['XMF-PATH']=_0xef7b79['path'];ut[_0xef45('0x4c')]('Convert\x20pdf\x20to\x20tif','');ami[_0xef45('0x6a')](ut[_0xef45('0x6b')](_0xef7b79,_0x14ae27))[_0xef45('0x3e')](function(_0x48e5e8){_0x41952f(_0x48e5e8);})[_0xef45('0x40')](function(_0x3ce74b){_0xbf9898(_0x3ce74b);});})[_0xef45('0x40')](function(_0x4ffc0f){_0xbf9898(_0x4ffc0f);});}else{ami[_0xef45('0x6a')](ut[_0xef45('0x6b')](_0xef7b79,_0x14ae27))[_0xef45('0x3e')](function(_0x26d598){_0x41952f(_0x26d598);})[_0xef45('0x40')](function(_0x3c7a0f){_0xbf9898(_0x3c7a0f);});}});}Fax['prototype']['execOriginate']=function(_0x18e5b9,_0x13f5b6){var _0x2989aa=this;return new BPromise(function(_0x34874e,_0x2a2bb6){var _0xc98761=uuid['v4']();var _0x2e8a76=ut[_0xef45('0x6c')](_0x18e5b9,_0x13f5b6);_0x2989aa['actions'][_0xc98761]=new Action(_0xc98761,_0x13f5b6,_0x18e5b9);var _0x31b0a3=_0x2989aa[_0xef45('0x13')][_0xc98761];if(path[_0xef45('0x3a')](_0x18e5b9[_0xef45('0x3')])[_0xef45('0x6d')]===_0xef45('0x3c')){originate(_0x31b0a3,_0x2e8a76,!![])[_0xef45('0x3e')](function(_0x5ece80){_0x34874e(_0x5ece80);})[_0xef45('0x40')](function(_0x4b5bba){_0x2a2bb6(_0x4b5bba);});}else{originate(_0x31b0a3,_0x2e8a76,![])[_0xef45('0x3e')](function(_0x2a8ad9){_0x34874e(_0x2a8ad9);})['catch'](function(_0x341f0e){_0x2a2bb6(_0x341f0e);});}});};Fax[_0xef45('0x21')][_0xef45('0x6e')]=function(_0x4d2c50){return!_[_0xef45('0x6f')](_0x4d2c50)&&!_['isNil'](_0x4d2c50[_0xef45('0x3b')])&&!_[_0xef45('0x6f')](_0x4d2c50[_0xef45('0x70')])&&_0x4d2c50[_0xef45('0x70')]&&!_['isNil'](this[_0xef45('0x12')][util[_0xef45('0x66')](_0xef45('0x71'),_0x4d2c50['name'])])&&!_[_0xef45('0x6f')](this[_0xef45('0x12')][util[_0xef45('0x66')](_0xef45('0x71'),_0x4d2c50[_0xef45('0x3b')])]['status'])&&(this[_0xef45('0x12')][util[_0xef45('0x66')](_0xef45('0x71'),_0x4d2c50[_0xef45('0x3b')])][_0xef45('0x2e')]===_0xef45('0x72')||this[_0xef45('0x12')][util[_0xef45('0x66')](_0xef45('0x71'),_0x4d2c50['name'])][_0xef45('0x2e')]===_0xef45('0x73'));};Fax[_0xef45('0x21')]['checkTrunk']=function(_0xcd8038,_0x4fbf84){if(!this[_0xef45('0x6e')](_0xcd8038)){ut[_0xef45('0x4c')](_0xef45('0x74'),_[_0xef45('0x6f')](_0xcd8038)?'':_0xcd8038[_0xef45('0x3b')]+_0xef45('0x75'));return{'isValid':![],'message':_0xef45('0x76')};}if(_[_0xef45('0x6f')](_0x4fbf84[_0xef45('0x7')])){ut[_0xef45('0x4c')](_0xef45('0x77'),JSON[_0xef45('0x44')](_0x4fbf84));return{'isValid':![],'message':_0xef45('0x78')};}if(_[_0xef45('0x6f')](_0x4fbf84[_0xef45('0x3')])){ut[_0xef45('0x4c')](_0xef45('0x79'),JSON[_0xef45('0x44')](_0x4fbf84));return{'isValid':![],'message':_0xef45('0x7a')};}return{'isValid':!![],'message':_0xef45('0x7b')};};module[_0xef45('0x7c')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 795d24f..bf745ea 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 _0x7017=['lodash','../rpc/faxAccount','error','inspect','notify','resolve','then','[Notify]\x20','util','bluebird','../../../config/logger','preview'];(function(_0x56e541,_0x390e40){var _0x459cff=function(_0x1b0700){while(--_0x1b0700){_0x56e541['push'](_0x56e541['shift']());}};_0x459cff(++_0x390e40);}(_0x7017,0x128));var _0x7701=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x7017[_0x59ee6f];return _0x4c0979;};'use strict';var util=require(_0x7701('0x0'));var BPromise=require(_0x7701('0x1'));var logger=require(_0x7701('0x2'))(_0x7701('0x3'));var _=require(_0x7701('0x4'));var faxAccount=require(_0x7701('0x5'));function loggerCatch(_0x432d0d){return function(_0x2b9875){logger[_0x7701('0x6')](_0x432d0d,util[_0x7701('0x7')](_0x2b9875,{'showHidden':![],'depth':null}));};}exports[_0x7701('0x8')]=function(_0x58f9d7,_0x3bd967){return BPromise[_0x7701('0x9')]()[_0x7701('0xa')](faxAccount[_0x7701('0x8')](_0x58f9d7,_0x3bd967))['catch'](loggerCatch(_0x7701('0xb')));}; \ No newline at end of file +var _0xb493=['then','[Notify]\x20','bluebird','../../../config/logger','lodash','error','inspect','notify','resolve'];(function(_0x273f92,_0x5e6ea2){var _0x38b53c=function(_0x494d4e){while(--_0x494d4e){_0x273f92['push'](_0x273f92['shift']());}};_0x38b53c(++_0x5e6ea2);}(_0xb493,0xbf));var _0x3b49=function(_0x5ca9b4,_0x2bfd14){_0x5ca9b4=_0x5ca9b4-0x0;var _0x42731a=_0xb493[_0x5ca9b4];return _0x42731a;};'use strict';var util=require('util');var BPromise=require(_0x3b49('0x0'));var logger=require(_0x3b49('0x1'))('preview');var _=require(_0x3b49('0x2'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x2ef26b){return function(_0x50f3d4){logger[_0x3b49('0x3')](_0x2ef26b,util[_0x3b49('0x4')](_0x50f3d4,{'showHidden':![],'depth':null}));};}exports[_0x3b49('0x5')]=function(_0x5cde62,_0x1722dc){return BPromise[_0x3b49('0x6')]()[_0x3b49('0x7')](faxAccount['notify'](_0x5cde62,_0x1722dc))['catch'](loggerCatch(_0x3b49('0x8')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 7096a73..a009808 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 _0x918d=['child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','util','../../../../config/logger','fax','bluebird'];(function(_0x5427c6,_0x1240a1){var _0x5144ff=function(_0x426797){while(--_0x426797){_0x5427c6['push'](_0x5427c6['shift']());}};_0x5144ff(++_0x1240a1);}(_0x918d,0x6a));var _0xd918=function(_0x4b76d1,_0x46aa8f){_0x4b76d1=_0x4b76d1-0x0;var _0xa09f73=_0x918d[_0x4b76d1];return _0xa09f73;};'use strict';var util=require(_0xd918('0x0'));var logger=require(_0xd918('0x1'))(_0xd918('0x2'));var BPromise=require(_0xd918('0x3'));var exec=require(_0xd918('0x4'))[_0xd918('0x5')];exports[_0xd918('0x6')]=function(_0x22a95e){return new BPromise(function(_0x2f0fc0,_0x1a9900){exec(_0x22a95e,function(_0x3bfef3,_0x52ff33,_0x159a91){logger[_0xd918('0x7')](_0xd918('0x8'),_0x52ff33);if(_0x3bfef3){logger[_0xd918('0x7')](_0xd918('0x8'),_0xd918('0x9'),util['inspect'](_0x3bfef3,{'showHidden':![],'depth':null}),_0x52ff33,_0x159a91);_0x1a9900(_0x3bfef3);}_0x2f0fc0(_0x52ff33);});});}; \ No newline at end of file +var _0xba92=['util','../../../../config/logger','fax','bluebird','child_process','exec','execute','info','Exec\x20gs','inspect'];(function(_0x58e1f2,_0x462a76){var _0x226926=function(_0x2c12d4){while(--_0x2c12d4){_0x58e1f2['push'](_0x58e1f2['shift']());}};_0x226926(++_0x462a76);}(_0xba92,0x96));var _0x2ba9=function(_0x2b62b4,_0x2edc08){_0x2b62b4=_0x2b62b4-0x0;var _0x59a70a=_0xba92[_0x2b62b4];return _0x59a70a;};'use strict';var util=require(_0x2ba9('0x0'));var logger=require(_0x2ba9('0x1'))(_0x2ba9('0x2'));var BPromise=require(_0x2ba9('0x3'));var exec=require(_0x2ba9('0x4'))[_0x2ba9('0x5')];exports[_0x2ba9('0x6')]=function(_0x2943d4){return new BPromise(function(_0x5b39dd,_0x4c2c68){exec(_0x2943d4,function(_0x708266,_0x28b933,_0x1893d3){logger[_0x2ba9('0x7')](_0x2ba9('0x8'),_0x28b933);if(_0x708266){logger[_0x2ba9('0x7')]('Exec\x20gs','\x20Error\x20:',util[_0x2ba9('0x9')](_0x708266,{'showHidden':![],'depth':null}),_0x28b933,_0x1893d3);_0x4c2c68(_0x708266);}_0x5b39dd(_0x28b933);});});}; \ 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 1dfc0e0..39a6c30 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 _0xa5a1=['modem','gateway','faxdetect','t38timeout','localstationid','path','uniqueid','channel','xcally-motion-fax','from-sip','lodash','fax','message','logger','info','inspect','addVariables','headerinfo','minrate','maxrate','format','\x22%s\x22'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa5a1,0x196));var _0x1a5a=function(_0x340fdf,_0x48ad2b){_0x340fdf=_0x340fdf-0x0;var _0x1a04c2=_0xa5a1[_0x340fdf];return _0x1a04c2;};'use strict';var util=require('util');var _=require(_0x1a5a('0x0'));var moment=require('moment');var logger=require('../../../../config/logger')(_0x1a5a('0x1'));exports[_0x1a5a('0x2')]=function(_0x48edd2){return{'message':_0x48edd2};};exports[_0x1a5a('0x3')]=function(_0x1b64b1,_0x29a3b6){logger[_0x1a5a('0x4')](_0x1b64b1,util[_0x1a5a('0x5')](_0x29a3b6,{'showHidden':![],'depth':null}));};exports[_0x1a5a('0x6')]=function(_0x63d57e,_0x2f1bbd){var _0x4350f1={'XMF-ECM':_0x2f1bbd['ecm'],'XMF-HEADERINFO':_0x2f1bbd[_0x1a5a('0x7')],'XMF-MINRATE':_0x2f1bbd[_0x1a5a('0x8')],'XMF-MAXRATE':_0x2f1bbd[_0x1a5a('0x9')],'XMF-MODEM':util[_0x1a5a('0xa')](_0x1a5a('0xb'),_0x2f1bbd[_0x1a5a('0xc')]),'XMF-GATEWAY':_0x2f1bbd[_0x1a5a('0xd')],'XMF-FAXDETECT':_0x2f1bbd[_0x1a5a('0xe')],'XMF-T38TIMEOUT':_0x2f1bbd[_0x1a5a('0xf')],'XMF-LOCALSTATIONID':_0x2f1bbd[_0x1a5a('0x10')],'XMF-PATH':_0x63d57e[_0x1a5a('0x11')]};return _0x4350f1;};exports['variablesAction']=function(_0x5fe707,_0x1c8f2c){return{'actionid':_0x5fe707[_0x1a5a('0x12')],'action':'originate','channel':_0x5fe707[_0x1a5a('0x13')],'Exten':_0x1a5a('0x14'),'Context':_0x1a5a('0x15'),'Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x5fe707[_0x1a5a('0x7')]?_0x5fe707[_0x1a5a('0x7')]:'',_0x5fe707[_0x1a5a('0x10')]),'variable':_0x1c8f2c,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5fe707[_0x1a5a('0x12')]};}; \ No newline at end of file +var _0x837d=['lodash','moment','fax','message','logger','info','inspect','addVariables','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','channel','from-sip'];(function(_0x4d120d,_0x55a2c9){var _0x12b156=function(_0x3b0aae){while(--_0x3b0aae){_0x4d120d['push'](_0x4d120d['shift']());}};_0x12b156(++_0x55a2c9);}(_0x837d,0x1e3));var _0xd837=function(_0x2bc851,_0x3b0a69){_0x2bc851=_0x2bc851-0x0;var _0x33df0f=_0x837d[_0x2bc851];return _0x33df0f;};'use strict';var util=require('util');var _=require(_0xd837('0x0'));var moment=require(_0xd837('0x1'));var logger=require('../../../../config/logger')(_0xd837('0x2'));exports[_0xd837('0x3')]=function(_0x57c35f){return{'message':_0x57c35f};};exports[_0xd837('0x4')]=function(_0x2130a0,_0x2f69b8){logger[_0xd837('0x5')](_0x2130a0,util[_0xd837('0x6')](_0x2f69b8,{'showHidden':![],'depth':null}));};exports[_0xd837('0x7')]=function(_0x3bd6f6,_0x1aaf3f){var _0x3b4043={'XMF-ECM':_0x1aaf3f['ecm'],'XMF-HEADERINFO':_0x1aaf3f[_0xd837('0x8')],'XMF-MINRATE':_0x1aaf3f[_0xd837('0x9')],'XMF-MAXRATE':_0x1aaf3f[_0xd837('0xa')],'XMF-MODEM':util[_0xd837('0xb')](_0xd837('0xc'),_0x1aaf3f[_0xd837('0xd')]),'XMF-GATEWAY':_0x1aaf3f[_0xd837('0xe')],'XMF-FAXDETECT':_0x1aaf3f[_0xd837('0xf')],'XMF-T38TIMEOUT':_0x1aaf3f[_0xd837('0x10')],'XMF-LOCALSTATIONID':_0x1aaf3f[_0xd837('0x11')],'XMF-PATH':_0x3bd6f6[_0xd837('0x12')]};return _0x3b4043;};exports[_0xd837('0x13')]=function(_0x4b314b,_0x5ef2fe){return{'actionid':_0x4b314b[_0xd837('0x14')],'action':'originate','channel':_0x4b314b[_0xd837('0x15')],'Exten':'xcally-motion-fax','Context':_0xd837('0x16'),'Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x4b314b[_0xd837('0x8')]?_0x4b314b['headerinfo']:'',_0x4b314b['localstationid']),'variable':_0x5ef2fe,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4b314b[_0xd837('0x14')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 9f9f3b2..1423a23 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 _0xcc49=['./realtime','./report','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','ami','get','hour','resolve','then','getAgents','initAgents','initTelephones','getTrunks','initTrunks','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','inspect','listen','sync','bluebird','util','moment','./server'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xcc49,0x155));var _0x9cc4=function(_0xb18b17,_0x121eb1){_0xb18b17=_0xb18b17-0x0;var _0xd1ff7c=_0xcc49[_0xb18b17];return _0xd1ff7c;};'use strict';var BPromise=require(_0x9cc4('0x0'));var util=require(_0x9cc4('0x1'));var moment=require(_0x9cc4('0x2'));var server=require(_0x9cc4('0x3'));var Realtime=require(_0x9cc4('0x4'));var Report=require(_0x9cc4('0x5'));var Acw=require('./acw');var Trigger=require(_0x9cc4('0x6'));var Dialer=require(_0x9cc4('0x7'));var Preview=require(_0x9cc4('0x8'));var Fax=require('./fax');var user=require(_0x9cc4('0x9'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x9cc4('0xa'));var voiceCallReport=require(_0x9cc4('0xb'));var trunk=require('./rpc/trunk');var trigger=require('./rpc/trigger');var template=require(_0x9cc4('0xc'));var cmHopperHistory=require(_0x9cc4('0xd'));var campaign=require(_0x9cc4('0xe'));var voiceExtension=require(_0x9cc4('0xf'));var faxAccount=require(_0x9cc4('0x10'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x9cc4('0x11'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x9cc4('0x12'));var desk=require(_0x9cc4('0x13'));var zoho=require(_0x9cc4('0x14'));var vtiger=require(_0x9cc4('0x15'));var freshsales=require(_0x9cc4('0x16'));var servicenow=require(_0x9cc4('0x17'));var dynamics365=require(_0x9cc4('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0x9cc4('0x19'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x9cc4('0x1a')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x9cc4('0x1a')](_0x9cc4('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x9cc4('0x1c')]()[_0x9cc4('0x1d')](user[_0x9cc4('0x1e')]())[_0x9cc4('0x1d')](realtime[_0x9cc4('0x1f')]())[_0x9cc4('0x1d')](user['getTelephones']())[_0x9cc4('0x1d')](realtime[_0x9cc4('0x20')]())[_0x9cc4('0x1d')](trunk[_0x9cc4('0x21')]())[_0x9cc4('0x1d')](realtime[_0x9cc4('0x22')]())[_0x9cc4('0x1d')](voiceQueue['getVoiceQueues']())[_0x9cc4('0x1d')](realtime['initVoiceQueues']())[_0x9cc4('0x1d')](trigger[_0x9cc4('0x23')]())['then'](realtime[_0x9cc4('0x24')]())['then'](template[_0x9cc4('0x25')]())[_0x9cc4('0x1d')](realtime[_0x9cc4('0x26')]())[_0x9cc4('0x1d')](zendesk[_0x9cc4('0x27')]())[_0x9cc4('0x1d')](realtime[_0x9cc4('0x28')]())[_0x9cc4('0x1d')](salesforce[_0x9cc4('0x29')]())[_0x9cc4('0x1d')](realtime[_0x9cc4('0x2a')]())[_0x9cc4('0x1d')](sugarcrm[_0x9cc4('0x2b')]())[_0x9cc4('0x1d')](realtime[_0x9cc4('0x2c')]())[_0x9cc4('0x1d')](freshdesk[_0x9cc4('0x2d')]())[_0x9cc4('0x1d')](realtime[_0x9cc4('0x2e')]())[_0x9cc4('0x1d')](desk[_0x9cc4('0x2f')]())['then'](realtime[_0x9cc4('0x30')]())[_0x9cc4('0x1d')](zoho['getZohoAccounts']())[_0x9cc4('0x1d')](realtime[_0x9cc4('0x31')]())['then'](vtiger['getVtigerAccounts']())[_0x9cc4('0x1d')](realtime[_0x9cc4('0x32')]())[_0x9cc4('0x1d')](freshsales['getFreshsalesAccounts']())[_0x9cc4('0x1d')](realtime[_0x9cc4('0x33')]())[_0x9cc4('0x1d')](servicenow[_0x9cc4('0x34')]())['then'](realtime[_0x9cc4('0x35')]())[_0x9cc4('0x1d')](dynamics365['getDynamics365Accounts']())['then'](realtime[_0x9cc4('0x36')]())[_0x9cc4('0x1d')](campaign['getCampaigns']())[_0x9cc4('0x1d')](realtime['initCampaigns']())['then'](voiceExtension[_0x9cc4('0x37')]())[_0x9cc4('0x1d')](realtime[_0x9cc4('0x38')]())[_0x9cc4('0x1d')](faxAccount['getFaxAccounts']())[_0x9cc4('0x1d')](realtime[_0x9cc4('0x39')]())[_0x9cc4('0x1d')](function(){return realtime;});}function initParams(){return BPromise[_0x9cc4('0x1c')]()[_0x9cc4('0x1d')](voiceQueueReport[_0x9cc4('0x3a')]())[_0x9cc4('0x1d')](realtime[_0x9cc4('0x3b')]())[_0x9cc4('0x1d')](cmHopperHistory[_0x9cc4('0x3c')]())[_0x9cc4('0x1d')](realtime[_0x9cc4('0x3d')]())['then'](cmHopperHistory[_0x9cc4('0x3e')]())[_0x9cc4('0x1d')](realtime['initCampaignHopperHistory']())[_0x9cc4('0x1d')](voiceCallReport[_0x9cc4('0x3f')]())[_0x9cc4('0x1d')](realtime[_0x9cc4('0x40')]())[_0x9cc4('0x41')](function(_0x1bb76a){logger['error']('[index.js][initParams]',util[_0x9cc4('0x42')](_0x1bb76a,{'showHidden':![],'depth':null}));});}function main(){return server[_0x9cc4('0x43')](realtime,preview,fax)[_0x9cc4('0x1d')](function(_0x25bf80){return initRealtime();})[_0x9cc4('0x1d')](function(){return initParams();})[_0x9cc4('0x1d')](function(){report[_0x9cc4('0x44')]();setInterval(initRealtime,0x1388);})[_0x9cc4('0x41')](function(_0xfbe0ab){logger['error']('[index.js][main]',util[_0x9cc4('0x42')](_0xfbe0ab,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x0968=['catch','error','[index.js][initParams]','inspect','listen','sync','bluebird','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./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/zoho','./rpc/integrations/freshsales','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getFaxAccounts','initFaxAccounts','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports'];(function(_0x42bfef,_0x371020){var _0x350d9c=function(_0x45e1f8){while(--_0x45e1f8){_0x42bfef['push'](_0x42bfef['shift']());}};_0x350d9c(++_0x371020);}(_0x0968,0x1aa));var _0x8096=function(_0x32e933,_0x4e9662){_0x32e933=_0x32e933-0x0;var _0x2e0f95=_0x0968[_0x32e933];return _0x2e0f95;};'use strict';var BPromise=require(_0x8096('0x0'));var util=require('util');var moment=require(_0x8096('0x1'));var server=require(_0x8096('0x2'));var Realtime=require(_0x8096('0x3'));var Report=require(_0x8096('0x4'));var Acw=require(_0x8096('0x5'));var Trigger=require(_0x8096('0x6'));var Dialer=require(_0x8096('0x7'));var Preview=require(_0x8096('0x8'));var Fax=require(_0x8096('0x9'));var user=require('./rpc/user');var voiceQueue=require(_0x8096('0xa'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x8096('0xb'));var trunk=require('./rpc/trunk');var trigger=require(_0x8096('0xc'));var template=require(_0x8096('0xd'));var cmHopperHistory=require(_0x8096('0xe'));var campaign=require(_0x8096('0xf'));var voiceExtension=require(_0x8096('0x10'));var faxAccount=require(_0x8096('0x11'));var zendesk=require(_0x8096('0x12'));var salesforce=require(_0x8096('0x13'));var sugarcrm=require(_0x8096('0x14'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require('./rpc/integrations/desk');var zoho=require(_0x8096('0x15'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x8096('0x16'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x8096('0x17'))(_0x8096('0x18'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x8096('0x19')](_0x8096('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x8096('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x8096('0x1b')]()[_0x8096('0x1c')](user[_0x8096('0x1d')]())[_0x8096('0x1c')](realtime[_0x8096('0x1e')]())['then'](user[_0x8096('0x1f')]())[_0x8096('0x1c')](realtime[_0x8096('0x20')]())[_0x8096('0x1c')](trunk[_0x8096('0x21')]())[_0x8096('0x1c')](realtime[_0x8096('0x22')]())[_0x8096('0x1c')](voiceQueue[_0x8096('0x23')]())[_0x8096('0x1c')](realtime['initVoiceQueues']())[_0x8096('0x1c')](trigger[_0x8096('0x24')]())[_0x8096('0x1c')](realtime[_0x8096('0x25')]())[_0x8096('0x1c')](template[_0x8096('0x26')]())[_0x8096('0x1c')](realtime[_0x8096('0x27')]())[_0x8096('0x1c')](zendesk['getZendeskAccounts']())[_0x8096('0x1c')](realtime[_0x8096('0x28')]())[_0x8096('0x1c')](salesforce['getSalesforceAccounts']())[_0x8096('0x1c')](realtime['initSalesforceAccounts']())[_0x8096('0x1c')](sugarcrm[_0x8096('0x29')]())[_0x8096('0x1c')](realtime[_0x8096('0x2a')]())['then'](freshdesk[_0x8096('0x2b')]())[_0x8096('0x1c')](realtime[_0x8096('0x2c')]())[_0x8096('0x1c')](desk[_0x8096('0x2d')]())[_0x8096('0x1c')](realtime[_0x8096('0x2e')]())[_0x8096('0x1c')](zoho[_0x8096('0x2f')]())[_0x8096('0x1c')](realtime[_0x8096('0x30')]())[_0x8096('0x1c')](vtiger['getVtigerAccounts']())[_0x8096('0x1c')](realtime[_0x8096('0x31')]())[_0x8096('0x1c')](freshsales[_0x8096('0x32')]())[_0x8096('0x1c')](realtime['initFreshsalesAccounts']())[_0x8096('0x1c')](servicenow[_0x8096('0x33')]())[_0x8096('0x1c')](realtime[_0x8096('0x34')]())['then'](dynamics365[_0x8096('0x35')]())[_0x8096('0x1c')](realtime[_0x8096('0x36')]())[_0x8096('0x1c')](campaign[_0x8096('0x37')]())[_0x8096('0x1c')](realtime[_0x8096('0x38')]())[_0x8096('0x1c')](voiceExtension['getVoiceExtensions']())[_0x8096('0x1c')](realtime['initVoiceExtensions']())[_0x8096('0x1c')](faxAccount[_0x8096('0x39')]())[_0x8096('0x1c')](realtime[_0x8096('0x3a')]())[_0x8096('0x1c')](function(){return realtime;});}function initParams(){return BPromise[_0x8096('0x1b')]()[_0x8096('0x1c')](voiceQueueReport['getVoiceQueueReports']())[_0x8096('0x1c')](realtime['initVoiceQueueReports']())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x8096('0x1c')](realtime[_0x8096('0x3b')]())[_0x8096('0x1c')](cmHopperHistory[_0x8096('0x3c')]())[_0x8096('0x1c')](realtime[_0x8096('0x3d')]())[_0x8096('0x1c')](voiceCallReport[_0x8096('0x3e')]())[_0x8096('0x1c')](realtime[_0x8096('0x3f')]())[_0x8096('0x40')](function(_0x220a05){logger[_0x8096('0x41')](_0x8096('0x42'),util[_0x8096('0x43')](_0x220a05,{'showHidden':![],'depth':null}));});}function main(){return server[_0x8096('0x44')](realtime,preview,fax)['then'](function(_0x28e6d2){return initRealtime();})[_0x8096('0x1c')](function(){return initParams();})['then'](function(){report[_0x8096('0x45')]();setInterval(initRealtime,0x1388);})[_0x8096('0x40')](function(_0x44d370){logger[_0x8096('0x41')]('[index.js][main]',util[_0x8096('0x43')](_0x44d370,{'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 dcbff52..937d5c3 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 _0xa9e0=['stateTime','status','address','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','md5','prototype','updateStatusRealtime','not_inuse','inuse','talking','statePause','toNumber','format','fullname','stringify','user:%s','emit','user:save','user:presence','exports','lodash','util','moment','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','email','accountcode','state','unknown'];(function(_0x4819e1,_0x44d88e){var _0xca4f58=function(_0x494088){while(--_0x494088){_0x4819e1['push'](_0x4819e1['shift']());}};_0xca4f58(++_0x44d88e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));config['redis']=_[_0x0a9e('0x4')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x6'),'port':0x18eb});var io=require(_0x0a9e('0x7'))(new Redis(config[_0x0a9e('0x5')]));function Agent(_0x57b080){this['id']=_0x57b080['id']||0x0;this[_0x0a9e('0x8')]=_0x57b080[_0x0a9e('0x8')]||'';this[_0x0a9e('0x9')]=_0x57b080['email']||'';this['accountcode']=_0x57b080[_0x0a9e('0xa')]||'';this['fullname']=_0x57b080['fullname']||'';this[_0x0a9e('0xb')]=_0x0a9e('0xc');this[_0x0a9e('0xd')]=0x0;this[_0x0a9e('0xe')]=_0x0a9e('0xc');this[_0x0a9e('0xf')]='';this['phone']='';this['mobile']='';this['interface']='';this['online']=_0x57b080[_0x0a9e('0x10')]||![];this[_0x0a9e('0x11')]=_0x0a9e('0xc');this[_0x0a9e('0x12')]=0x0;this[_0x0a9e('0x13')]='';this[_0x0a9e('0x14')]='';this['onhold']=![];this[_0x0a9e('0x15')]=![];this[_0x0a9e('0x16')]='';}Agent[_0x0a9e('0x17')][_0x0a9e('0x18')]=function(_0x44dcfd){var _0x4d5611;if(_0x44dcfd&&_0x44dcfd['state']){_0x4d5611=_0x44dcfd[_0x0a9e('0xb')]['toLowerCase']();switch(_0x4d5611){case _0x0a9e('0x19'):_0x4d5611='idle';break;case _0x0a9e('0x1a'):_0x4d5611=_0x0a9e('0x1b');break;}}if(_0x4d5611&&this['voiceStatus']!==_0x4d5611||_0x44dcfd[_0x0a9e('0x1c')]){this['voiceStatusTime']=_[_0x0a9e('0x1d')](moment()[_0x0a9e('0x1e')]('x'));}if(_0x4d5611){this[_0x0a9e('0x11')]=_0x4d5611;}var _0x205fd6={'id':this['id'],'name':this[_0x0a9e('0x8')],'email':this[_0x0a9e('0x9')],'accountcode':this[_0x0a9e('0xa')],'fullname':this[_0x0a9e('0x1f')],'state':this[_0x0a9e('0xb')],'stateTime':this[_0x0a9e('0xd')],'status':this[_0x0a9e('0xe')],'address':this[_0x0a9e('0xf')],'online':this['online'],'voiceStatus':this[_0x0a9e('0x11')],'voiceStatusTime':this[_0x0a9e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x0a9e('0x14')],'interface':this['interface'],'onhold':this['onhold']};var _0x3a02e1=md5(JSON[_0x0a9e('0x20')](_0x205fd6));if(this[_0x0a9e('0x16')]!==_0x3a02e1){this[_0x0a9e('0x16')]=_0x3a02e1;io['to'](util['format'](_0x0a9e('0x21'),_0x205fd6[_0x0a9e('0x8')]))[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x205fd6);io[_0x0a9e('0x22')](_0x0a9e('0x24'),_0x205fd6);}};module[_0x0a9e('0x25')]=Agent; \ No newline at end of file +var _0x0713=['idle','inuse','talking','voiceStatusTime','toNumber','format','voiceStatusQueue','stringify','user:%s','emit','user:save','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','onhold','local','prototype','state','toLowerCase','not_inuse'];(function(_0x2e43b1,_0x386b2e){var _0x5c3971=function(_0x304fd0){while(--_0x304fd0){_0x2e43b1['push'](_0x2e43b1['shift']());}};_0x5c3971(++_0x386b2e);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var md5=require(_0x3071('0x1'));var Redis=require(_0x3071('0x2'));var config=require(_0x3071('0x3'));config[_0x3071('0x4')]=_['defaults'](config[_0x3071('0x4')],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x4')]));function Agent(_0xabd7b6){this['id']=_0xabd7b6['id']||0x0;this[_0x3071('0x7')]=_0xabd7b6[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0xabd7b6[_0x3071('0x8')]||'';this[_0x3071('0x9')]=_0xabd7b6[_0x3071('0x9')]||'';this[_0x3071('0xa')]=_0xabd7b6[_0x3071('0xa')]||'';this['state']=_0x3071('0xb');this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]=_0x3071('0xb');this[_0x3071('0xe')]='';this['phone']='';this[_0x3071('0xf')]='';this[_0x3071('0x10')]='';this[_0x3071('0x11')]=_0xabd7b6[_0x3071('0x11')]||![];this[_0x3071('0x12')]='unknown';this['voiceStatusTime']=0x0;this[_0x3071('0x13')]='';this['voiceStatusQueue']='';this[_0x3071('0x14')]=![];this[_0x3071('0x15')]=![];this['md5']='';}Agent[_0x3071('0x16')]['updateStatusRealtime']=function(_0x2fc15d){var _0x45c93b;if(_0x2fc15d&&_0x2fc15d[_0x3071('0x17')]){_0x45c93b=_0x2fc15d[_0x3071('0x17')][_0x3071('0x18')]();switch(_0x45c93b){case _0x3071('0x19'):_0x45c93b=_0x3071('0x1a');break;case _0x3071('0x1b'):_0x45c93b=_0x3071('0x1c');break;}}if(_0x45c93b&&this[_0x3071('0x12')]!==_0x45c93b||_0x2fc15d['statePause']){this[_0x3071('0x1d')]=_[_0x3071('0x1e')](moment()[_0x3071('0x1f')]('x'));}if(_0x45c93b){this[_0x3071('0x12')]=_0x45c93b;}var _0x3acf0e={'id':this['id'],'name':this[_0x3071('0x7')],'email':this[_0x3071('0x8')],'accountcode':this[_0x3071('0x9')],'fullname':this['fullname'],'state':this[_0x3071('0x17')],'stateTime':this[_0x3071('0xc')],'status':this[_0x3071('0xd')],'address':this['address'],'online':this[_0x3071('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x3071('0x1d')],'voiceStatusCallerIdNumber':this[_0x3071('0x13')],'voiceStatusQueue':this[_0x3071('0x20')],'interface':this[_0x3071('0x10')],'onhold':this[_0x3071('0x14')]};var _0x34c50e=md5(JSON[_0x3071('0x21')](_0x3acf0e));if(this[_0x3071('0x1')]!==_0x34c50e){this['md5']=_0x34c50e;io['to'](util['format'](_0x3071('0x22'),_0x3acf0e[_0x3071('0x7')]))[_0x3071('0x23')](_0x3071('0x24'),_0x3acf0e);io[_0x3071('0x23')](_0x3071('0x25'),_0x3acf0e);}};module[_0x3071('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index f56a800..b307ff8 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 _0x542d=['dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry'];(function(_0x261158,_0x2665a2){var _0x469dfa=function(_0x4262fe){while(--_0x4262fe){_0x261158['push'](_0x261158['shift']());}};_0x469dfa(++_0x2665a2);}(_0x542d,0x1ad));var _0xd542=function(_0x58567a,_0x126680){_0x58567a=_0x58567a-0x0;var _0x559791=_0x542d[_0x58567a];return _0x559791;};'use strict';function Campaign(_0x566e73){this['id']=_0x566e73['id']||0x0;this[_0xd542('0x0')]=_0x566e73[_0xd542('0x0')]||'';this[_0xd542('0x1')]=_0x566e73[_0xd542('0x1')]||_0xd542('0x2');this[_0xd542('0x3')]=0x0;this[_0xd542('0x4')]=0x0;this[_0xd542('0x5')]=0x0;this[_0xd542('0x6')]=0x0;this[_0xd542('0x7')]='';this[_0xd542('0x8')]=!![];this[_0xd542('0x9')]=_0x566e73[_0xd542('0x9')];this[_0xd542('0xa')]=_0x566e73[_0xd542('0xa')];this['dialTimezone']=_0x566e73[_0xd542('0xb')]||null;this['dialGlobalInterval']=_0x566e73['dialGlobalInterval']?_0x566e73[_0xd542('0xc')]:null;this[_0xd542('0xd')]=_0x566e73['dialOriginateCallerIdName'];this[_0xd542('0xe')]=_0x566e73[_0xd542('0xe')];this[_0xd542('0xf')]=_0x566e73[_0xd542('0xf')]||0x1e;this[_0xd542('0x10')]=_0x566e73[_0xd542('0x10')];this['dialCongestionRetryFrequency']=_0x566e73[_0xd542('0x11')];this['dialBusyMaxRetry']=_0x566e73[_0xd542('0x12')];this['dialBusyRetryFrequency']=_0x566e73[_0xd542('0x13')];this['dialNoAnswerMaxRetry']=_0x566e73[_0xd542('0x14')];this['dialNoAnswerRetryFrequency']=_0x566e73[_0xd542('0x15')];this['dialGlobalMaxRetry']=_0x566e73[_0xd542('0x16')];this[_0xd542('0x17')]=_0x566e73[_0xd542('0x17')]||0x3;this[_0xd542('0x18')]=_0x566e73[_0xd542('0x18')]||0x96;this['dialDropMaxRetry']=_0x566e73[_0xd542('0x19')]||0x3;this[_0xd542('0x1a')]=_0x566e73['dialDropRetryFrequency']||0x96;this[_0xd542('0x1b')]=_0x566e73[_0xd542('0x1b')]||0x3;this[_0xd542('0x1c')]=_0x566e73[_0xd542('0x1c')]||0x96;this[_0xd542('0x1d')]=_0x566e73[_0xd542('0x1d')]||0x3;this[_0xd542('0x1e')]=_0x566e73['dialMachineRetryFrequency']||0x96;this[_0xd542('0x1f')]=_0x566e73[_0xd542('0x1f')]||0x3;this['dialAgentRejectRetryFrequency']=_0x566e73['dialAgentRejectRetryFrequency']||0x96;this['dialOrderByScheduledAt']=_0x566e73[_0xd542('0x20')]||_0xd542('0x21');this['dialPrefix']=_0x566e73['dialPrefix']||undefined;this[_0xd542('0x22')]=_0x566e73['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xd542('0x23')]=_0x566e73['dialCutDigit']||undefined;this[_0xd542('0x24')]=_0x566e73[_0xd542('0x24')]?_0x566e73['TrunkBackup']:undefined;this[_0xd542('0x25')]=_0x566e73[_0xd542('0x25')]?_0x566e73[_0xd542('0x25')]:undefined;this[_0xd542('0x26')]=_0x566e73[_0xd542('0x26')]?_0x566e73['Interval']:undefined;this[_0xd542('0x27')]=_0x566e73[_0xd542('0x27')]?_0x566e73[_0xd542('0x27')]:undefined;this['dialQueueProject']=_0x566e73[_0xd542('0x27')]?_0x566e73[_0xd542('0x27')]['name']:undefined;this['dialAMDActive']=_0x566e73[_0xd542('0x28')]||![];this[_0xd542('0x29')]=_0x566e73[_0xd542('0x29')];this['dialAMDGreeting']=_0x566e73[_0xd542('0x2a')];this['dialAMDAfterGreetingSilence']=_0x566e73[_0xd542('0x2b')];this['dialAMDTotalAnalysisTime']=_0x566e73[_0xd542('0x2c')];this[_0xd542('0x2d')]=_0x566e73[_0xd542('0x2d')];this[_0xd542('0x2e')]=_0x566e73['dialAMDBetweenWordsSilence'];this[_0xd542('0x2f')]=_0x566e73[_0xd542('0x2f')];this[_0xd542('0x30')]=_0x566e73[_0xd542('0x30')];this[_0xd542('0x31')]=_0x566e73['dialAMDMaximumWordLength'];}module['exports']=Campaign; \ No newline at end of file +var _0x5282=['dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','temp','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency'];(function(_0x8c675c,_0x3f0aee){var _0x8a2ead=function(_0x5bb11a){while(--_0x5bb11a){_0x8c675c['push'](_0x8c675c['shift']());}};_0x8a2ead(++_0x3f0aee);}(_0x5282,0x1bd));var _0x2528=function(_0x594e11,_0x28f652){_0x594e11=_0x594e11-0x0;var _0x5418ad=_0x5282[_0x594e11];return _0x5418ad;};'use strict';function Campaign(_0x5c116d){this['id']=_0x5c116d['id']||0x0;this[_0x2528('0x0')]=_0x5c116d[_0x2528('0x0')]||'';this[_0x2528('0x1')]=_0x5c116d[_0x2528('0x1')]||_0x2528('0x2');this[_0x2528('0x3')]=0x0;this[_0x2528('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x2528('0x5')]=0x0;this[_0x2528('0x6')]='';this['sendMessageOneNotActive']=!![];this['active']=_0x5c116d[_0x2528('0x7')];this[_0x2528('0x8')]=_0x5c116d['limitCalls'];this[_0x2528('0x9')]=_0x5c116d[_0x2528('0x9')]||null;this[_0x2528('0xa')]=_0x5c116d[_0x2528('0xa')]?_0x5c116d[_0x2528('0xa')]:null;this[_0x2528('0xb')]=_0x5c116d[_0x2528('0xb')];this['dialOriginateCallerIdNumber']=_0x5c116d['dialOriginateCallerIdNumber'];this[_0x2528('0xc')]=_0x5c116d[_0x2528('0xc')]||0x1e;this[_0x2528('0xd')]=_0x5c116d[_0x2528('0xd')];this[_0x2528('0xe')]=_0x5c116d[_0x2528('0xe')];this[_0x2528('0xf')]=_0x5c116d['dialBusyMaxRetry'];this['dialBusyRetryFrequency']=_0x5c116d[_0x2528('0x10')];this[_0x2528('0x11')]=_0x5c116d[_0x2528('0x11')];this[_0x2528('0x12')]=_0x5c116d['dialNoAnswerRetryFrequency'];this[_0x2528('0x13')]=_0x5c116d['dialGlobalMaxRetry'];this[_0x2528('0x14')]=_0x5c116d['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x5c116d[_0x2528('0x15')]||0x96;this[_0x2528('0x16')]=_0x5c116d[_0x2528('0x16')]||0x3;this['dialDropRetryFrequency']=_0x5c116d['dialDropRetryFrequency']||0x96;this[_0x2528('0x17')]=_0x5c116d[_0x2528('0x17')]||0x3;this[_0x2528('0x18')]=_0x5c116d['dialAbandonedRetryFrequency']||0x96;this[_0x2528('0x19')]=_0x5c116d[_0x2528('0x19')]||0x3;this[_0x2528('0x1a')]=_0x5c116d[_0x2528('0x1a')]||0x96;this['dialAgentRejectMaxRetry']=_0x5c116d[_0x2528('0x1b')]||0x3;this[_0x2528('0x1c')]=_0x5c116d[_0x2528('0x1c')]||0x96;this[_0x2528('0x1d')]=_0x5c116d[_0x2528('0x1d')]||'DESC';this[_0x2528('0x1e')]=_0x5c116d[_0x2528('0x1e')]||undefined;this[_0x2528('0x1f')]=_0x5c116d['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x2528('0x20')]=_0x5c116d['dialCutDigit']||undefined;this[_0x2528('0x21')]=_0x5c116d[_0x2528('0x21')]?_0x5c116d[_0x2528('0x21')]:undefined;this['Trunk']=_0x5c116d[_0x2528('0x22')]?_0x5c116d[_0x2528('0x22')]:undefined;this['Interval']=_0x5c116d['Interval']?_0x5c116d[_0x2528('0x23')]:undefined;this[_0x2528('0x24')]=_0x5c116d[_0x2528('0x24')]?_0x5c116d[_0x2528('0x24')]:undefined;this['dialQueueProject']=_0x5c116d[_0x2528('0x24')]?_0x5c116d[_0x2528('0x24')][_0x2528('0x0')]:undefined;this[_0x2528('0x25')]=_0x5c116d[_0x2528('0x25')]||![];this[_0x2528('0x26')]=_0x5c116d[_0x2528('0x26')];this[_0x2528('0x27')]=_0x5c116d['dialAMDGreeting'];this[_0x2528('0x28')]=_0x5c116d[_0x2528('0x28')];this['dialAMDTotalAnalysisTime']=_0x5c116d[_0x2528('0x29')];this[_0x2528('0x2a')]=_0x5c116d[_0x2528('0x2a')];this[_0x2528('0x2b')]=_0x5c116d[_0x2528('0x2b')];this[_0x2528('0x2c')]=_0x5c116d[_0x2528('0x2c')];this[_0x2528('0x2d')]=_0x5c116d['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x5c116d[_0x2528('0x2e')];}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 d8045eb..12fb914 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 _0xcabe=['exports','starttime','destinationchannel','calleridnum','connectedlinenum','connectedlinename','context','uniqueid','linkedid','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','tag','disposition','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType'];(function(_0x47ecba,_0x1732f4){var _0x53b516=function(_0x5301d6){while(--_0x5301d6){_0x47ecba['push'](_0x47ecba['shift']());}};_0x53b516(++_0x1732f4);}(_0xcabe,0x1ef));var _0xecab=function(_0xda7a5a,_0x42981b){_0xda7a5a=_0xda7a5a-0x0;var _0x478daa=_0xcabe[_0xda7a5a];return _0x478daa;};'use strict';function Channel(){this[_0xecab('0x0')]=null;this['channel']='';this[_0xecab('0x1')]='';this[_0xecab('0x2')]=0x0;this['calleridname']='';this[_0xecab('0x3')]=undefined;this[_0xecab('0x4')]=undefined;this['accountcode']=0x0;this[_0xecab('0x5')]='';this[_0xecab('0x6')]=0x0;this[_0xecab('0x7')]=0x0;this['exten']=0x0;this[_0xecab('0x8')]=![];this[_0xecab('0x9')]=null;this[_0xecab('0xa')]=null;this[_0xecab('0xb')]=![];this[_0xecab('0xc')]=![];this[_0xecab('0xd')]='';this[_0xecab('0xe')]='';this[_0xecab('0xf')]=0x0;this[_0xecab('0x10')]=0x0;this['holdtime']=0x0;this['type']=null;this[_0xecab('0x11')]=null;this[_0xecab('0x12')]=null;this['monitor']=![];this[_0xecab('0x13')]=null;this[_0xecab('0x14')]=null;this[_0xecab('0x15')]=[];this[_0xecab('0x16')]=undefined;this[_0xecab('0x17')]=undefined;this[_0xecab('0x18')]=undefined;this['mohtime']=0x0;}module[_0xecab('0x19')]=Channel; \ No newline at end of file +var _0x7896=['destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answertime','endtime','unmanaged','lastapplication','duration','billableseconds','type','disposition','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel'];(function(_0x46f9a4,_0x43ee3c){var _0x8ebc46=function(_0x11707d){while(--_0x11707d){_0x46f9a4['push'](_0x46f9a4['shift']());}};_0x8ebc46(++_0x43ee3c);}(_0x7896,0x127));var _0x6789=function(_0x35cc24,_0x299db6){_0x35cc24=_0x35cc24-0x0;var _0x137359=_0x7896[_0x35cc24];return _0x137359;};'use strict';function Channel(){this[_0x6789('0x0')]=null;this[_0x6789('0x1')]='';this[_0x6789('0x2')]='';this[_0x6789('0x3')]=0x0;this[_0x6789('0x4')]='';this[_0x6789('0x5')]=undefined;this[_0x6789('0x6')]=undefined;this[_0x6789('0x7')]=0x0;this[_0x6789('0x8')]='';this[_0x6789('0x9')]=0x0;this[_0x6789('0xa')]=0x0;this[_0x6789('0xb')]=0x0;this['answered']=![];this[_0x6789('0xc')]=null;this[_0x6789('0xd')]=null;this[_0x6789('0xe')]=![];this['abandoned']=![];this[_0x6789('0xf')]='';this['lastdata']='';this[_0x6789('0x10')]=0x0;this[_0x6789('0x11')]=0x0;this['holdtime']=0x0;this[_0x6789('0x12')]=null;this['tag']=null;this[_0x6789('0x13')]=null;this['monitor']=![];this[_0x6789('0x14')]=null;this['queue']=null;this[_0x6789('0x15')]=[];this[_0x6789('0x16')]=undefined;this[_0x6789('0x17')]=undefined;this[_0x6789('0x18')]=undefined;this[_0x6789('0x19')]=0x0;}module[_0x6789('0x1a')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 0706639..ec0fd09 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 _0xc517=['exports','name','username','remoteUri','authType','password','consumerKey','token','tokenSecret','type','serverUrl','Configurations'];(function(_0x2429be,_0x3bce78){var _0x19e346=function(_0x21693e){while(--_0x21693e){_0x2429be['push'](_0x2429be['shift']());}};_0x19e346(++_0x3bce78);}(_0xc517,0x85));var _0x7c51=function(_0x52116b,_0x535e60){_0x52116b=_0x52116b-0x0;var _0x32e732=_0xc517[_0x52116b];return _0x32e732;};'use strict';function DeskAccount(_0x4a6861){this['id']=_0x4a6861['id']||0x0;this[_0x7c51('0x0')]=_0x4a6861['name']||'';this[_0x7c51('0x1')]=_0x4a6861['username']||'';this['remoteUri']=_0x4a6861[_0x7c51('0x2')]||'';this[_0x7c51('0x3')]=_0x4a6861[_0x7c51('0x3')]||'';this[_0x7c51('0x4')]=_0x4a6861[_0x7c51('0x4')]||'';this['consumerKey']=_0x4a6861[_0x7c51('0x5')]||'';this['consumerSecret']=_0x4a6861['consumerSecret']||'';this[_0x7c51('0x6')]=_0x4a6861['token']||'';this[_0x7c51('0x7')]=_0x4a6861[_0x7c51('0x7')]||'';this[_0x7c51('0x8')]=_0x4a6861[_0x7c51('0x8')]||'';this['serverUrl']=_0x4a6861[_0x7c51('0x9')]||'';this[_0x7c51('0xa')]=_0x4a6861[_0x7c51('0xa')]||{};}module[_0x7c51('0xb')]=DeskAccount; \ No newline at end of file +var _0x9608=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name','username'];(function(_0x1e2321,_0x3ae1c5){var _0x1d346d=function(_0x24f171){while(--_0x24f171){_0x1e2321['push'](_0x1e2321['shift']());}};_0x1d346d(++_0x3ae1c5);}(_0x9608,0x12a));var _0x8960=function(_0x3708dc,_0x2115cd){_0x3708dc=_0x3708dc-0x0;var _0x52c4c7=_0x9608[_0x3708dc];return _0x52c4c7;};'use strict';function DeskAccount(_0x3102fa){this['id']=_0x3102fa['id']||0x0;this[_0x8960('0x0')]=_0x3102fa[_0x8960('0x0')]||'';this[_0x8960('0x1')]=_0x3102fa[_0x8960('0x1')]||'';this[_0x8960('0x2')]=_0x3102fa[_0x8960('0x2')]||'';this[_0x8960('0x3')]=_0x3102fa['authType']||'';this['password']=_0x3102fa[_0x8960('0x4')]||'';this[_0x8960('0x5')]=_0x3102fa['consumerKey']||'';this[_0x8960('0x6')]=_0x3102fa[_0x8960('0x6')]||'';this[_0x8960('0x7')]=_0x3102fa[_0x8960('0x7')]||'';this[_0x8960('0x8')]=_0x3102fa[_0x8960('0x8')]||'';this['type']=_0x3102fa[_0x8960('0x9')]||'';this[_0x8960('0xa')]=_0x3102fa['serverUrl']||'';this[_0x8960('0xb')]=_0x3102fa['Configurations']||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index a0449e7..ae67607 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 _0x80ed=['clientSecret','serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId','clientId'];(function(_0xd9ac06,_0x5c76a8){var _0x1c57b7=function(_0x32143c){while(--_0x32143c){_0xd9ac06['push'](_0xd9ac06['shift']());}};_0x1c57b7(++_0x5c76a8);}(_0x80ed,0x11c));var _0xd80e=function(_0x2aee57,_0x502082){_0x2aee57=_0x2aee57-0x0;var _0x8ca238=_0x80ed[_0x2aee57];return _0x8ca238;};'use strict';function Dynamics365Account(_0x4a9e0a){this['id']=_0x4a9e0a['id']||0x0;this['name']=_0x4a9e0a[_0xd80e('0x0')]||'';this[_0xd80e('0x1')]=_0x4a9e0a[_0xd80e('0x1')]||'';this['password']=_0x4a9e0a[_0xd80e('0x2')]||'';this[_0xd80e('0x3')]=_0x4a9e0a[_0xd80e('0x3')]||'';this[_0xd80e('0x4')]=_0x4a9e0a['tenantId']||'';this[_0xd80e('0x5')]=_0x4a9e0a[_0xd80e('0x5')]||'';this[_0xd80e('0x6')]=_0x4a9e0a['clientSecret']||{};this[_0xd80e('0x7')]=_0x4a9e0a[_0xd80e('0x7')]||'';this[_0xd80e('0x8')]=_0x4a9e0a[_0xd80e('0x8')]||{};}module[_0xd80e('0x9')]=Dynamics365Account; \ No newline at end of file +var _0x34b7=['Configurations','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x34b7,0x196));var _0x734b=function(_0x22a518,_0x4dd9a6){_0x22a518=_0x22a518-0x0;var _0x5395a9=_0x34b7[_0x22a518];return _0x5395a9;};'use strict';function Dynamics365Account(_0x3573c4){this['id']=_0x3573c4['id']||0x0;this['name']=_0x3573c4[_0x734b('0x0')]||'';this[_0x734b('0x1')]=_0x3573c4[_0x734b('0x1')]||'';this[_0x734b('0x2')]=_0x3573c4[_0x734b('0x2')]||'';this[_0x734b('0x3')]=_0x3573c4['remoteUri']||'';this['tenantId']=_0x3573c4[_0x734b('0x4')]||'';this[_0x734b('0x5')]=_0x3573c4[_0x734b('0x5')]||'';this[_0x734b('0x6')]=_0x3573c4[_0x734b('0x6')]||{};this[_0x734b('0x7')]=_0x3573c4['serverUrl']||'';this[_0x734b('0x8')]=_0x3573c4[_0x734b('0x8')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index f952b70..29ccfac 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 _0xf9ca=['name','description','ecm','localstationid','minrate','maxrate','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports'];(function(_0x470e67,_0x4a596d){var _0x28bbde=function(_0x1bbf56){while(--_0x1bbf56){_0x470e67['push'](_0x470e67['shift']());}};_0x28bbde(++_0x4a596d);}(_0xf9ca,0xff));var _0xaf9c=function(_0x4dff66,_0x5ccef9){_0x4dff66=_0x4dff66-0x0;var _0xd686f4=_0xf9ca[_0x4dff66];return _0xd686f4;};'use strict';function FaxAccount(_0x43d935){this['id']=_0x43d935['id']||0x0;this[_0xaf9c('0x0')]=_0x43d935[_0xaf9c('0x0')]||'';this[_0xaf9c('0x1')]=_0x43d935['description'];this['ecm']=_0x43d935[_0xaf9c('0x2')];this['headerinfo']=_0x43d935['headerinfo'];this[_0xaf9c('0x3')]=_0x43d935['localstationid'];this[_0xaf9c('0x4')]=_0x43d935[_0xaf9c('0x4')]||0x960;this[_0xaf9c('0x5')]=_0x43d935[_0xaf9c('0x5')]||0x3840;this['modem']=_0x43d935['modem']||_0xaf9c('0x6');this[_0xaf9c('0x7')]=_0x43d935['gateway']||'no';this[_0xaf9c('0x8')]=_0x43d935[_0xaf9c('0x8')]||'no';this[_0xaf9c('0x9')]=_0x43d935['t38timeout']||0x1388;this[_0xaf9c('0xa')]=_0x43d935[_0xaf9c('0xa')]||'SIP';this[_0xaf9c('0xb')]=_0x43d935[_0xaf9c('0xb')]?_0x43d935[_0xaf9c('0xb')]:undefined;this[_0xaf9c('0xc')]=_0x43d935['ListId'];this['key']=_0x43d935[_0xaf9c('0xd')];}module[_0xaf9c('0xe')]=FaxAccount; \ No newline at end of file +var _0x037d=['minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','headerinfo','localstationid'];(function(_0x498a8b,_0x513c58){var _0x2fbc06=function(_0x3ab7d3){while(--_0x3ab7d3){_0x498a8b['push'](_0x498a8b['shift']());}};_0x2fbc06(++_0x513c58);}(_0x037d,0x1d8));var _0xd037=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x037d[_0x5d6456];return _0x4d66c1;};'use strict';function FaxAccount(_0x502089){this['id']=_0x502089['id']||0x0;this['name']=_0x502089[_0xd037('0x0')]||'';this['description']=_0x502089[_0xd037('0x1')];this['ecm']=_0x502089['ecm'];this[_0xd037('0x2')]=_0x502089['headerinfo'];this['localstationid']=_0x502089[_0xd037('0x3')];this[_0xd037('0x4')]=_0x502089[_0xd037('0x4')]||0x960;this['maxrate']=_0x502089[_0xd037('0x5')]||0x3840;this[_0xd037('0x6')]=_0x502089['modem']||_0xd037('0x7');this[_0xd037('0x8')]=_0x502089['gateway']||'no';this[_0xd037('0x9')]=_0x502089[_0xd037('0x9')]||'no';this['t38timeout']=_0x502089[_0xd037('0xa')]||0x1388;this[_0xd037('0xb')]=_0x502089[_0xd037('0xb')]||_0xd037('0xc');this[_0xd037('0xd')]=_0x502089['Trunk']?_0x502089[_0xd037('0xd')]:undefined;this[_0xd037('0xe')]=_0x502089[_0xd037('0xe')];this[_0xd037('0xf')]=_0x502089[_0xd037('0xf')];}module[_0xd037('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 105d51d..87d6d4d 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 _0xede7=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0xf1226a,_0x29a250){var _0x1b8fe7=function(_0x7178a5){while(--_0x7178a5){_0xf1226a['push'](_0xf1226a['shift']());}};_0x1b8fe7(++_0x29a250);}(_0xede7,0x154));var _0x7ede=function(_0x563c56,_0x5226fe){_0x563c56=_0x563c56-0x0;var _0xd18f4=_0xede7[_0x563c56];return _0xd18f4;};'use strict';function FreshdeskAccount(_0x523b5c){this['id']=_0x523b5c['id']||0x0;this[_0x7ede('0x0')]=_0x523b5c['name']||'';this[_0x7ede('0x1')]=_0x523b5c[_0x7ede('0x1')]||'';this[_0x7ede('0x2')]=_0x523b5c['token']||'';this[_0x7ede('0x3')]=_0x523b5c[_0x7ede('0x3')]||'';this[_0x7ede('0x4')]=_0x523b5c['serverUrl']||'';this[_0x7ede('0x5')]=_0x523b5c[_0x7ede('0x5')]||{};}module[_0x7ede('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x0de2=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0de2,0x18c));var _0x20de=function(_0x9ff51,_0x4c951f){_0x9ff51=_0x9ff51-0x0;var _0x31959b=_0x0de2[_0x9ff51];return _0x31959b;};'use strict';function FreshdeskAccount(_0x1ba12a){this['id']=_0x1ba12a['id']||0x0;this['name']=_0x1ba12a[_0x20de('0x0')]||'';this[_0x20de('0x1')]=_0x1ba12a['username']||'';this[_0x20de('0x2')]=_0x1ba12a[_0x20de('0x3')]||'';this[_0x20de('0x4')]=_0x1ba12a[_0x20de('0x4')]||'';this[_0x20de('0x5')]=_0x1ba12a[_0x20de('0x5')]||'';this['Configurations']=_0x1ba12a[_0x20de('0x6')]||{};}module[_0x20de('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 6880978..1f3bcf4 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 _0x4279=['Configurations','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x2967ae,_0x4b5f1a){var _0x43e251=function(_0x5966e6){while(--_0x5966e6){_0x2967ae['push'](_0x2967ae['shift']());}};_0x43e251(++_0x4b5f1a);}(_0x4279,0x8d));var _0x9427=function(_0x24cb0d,_0x55c4f8){_0x24cb0d=_0x24cb0d-0x0;var _0xda4e66=_0x4279[_0x24cb0d];return _0xda4e66;};'use strict';function FreshsalesAccount(_0x1a6a23){this['id']=_0x1a6a23['id']||0x0;this[_0x9427('0x0')]=_0x1a6a23[_0x9427('0x0')]||'';this['username']=_0x1a6a23[_0x9427('0x1')]||'';this[_0x9427('0x2')]=_0x1a6a23[_0x9427('0x3')]||'';this[_0x9427('0x4')]=_0x1a6a23['remoteUri']||'';this[_0x9427('0x5')]=_0x1a6a23['serverUrl']||'';this[_0x9427('0x6')]=_0x1a6a23[_0x9427('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0xadf0=['serverUrl','name','username','apiKey','token','remoteUri'];(function(_0x3c824f,_0x3fb9a5){var _0x46c994=function(_0x5cc1e2){while(--_0x5cc1e2){_0x3c824f['push'](_0x3c824f['shift']());}};_0x46c994(++_0x3fb9a5);}(_0xadf0,0x12d));var _0x0adf=function(_0x33a5dc,_0x1af353){_0x33a5dc=_0x33a5dc-0x0;var _0x2066bc=_0xadf0[_0x33a5dc];return _0x2066bc;};'use strict';function FreshsalesAccount(_0x35481a){this['id']=_0x35481a['id']||0x0;this[_0x0adf('0x0')]=_0x35481a[_0x0adf('0x0')]||'';this[_0x0adf('0x1')]=_0x35481a[_0x0adf('0x1')]||'';this[_0x0adf('0x2')]=_0x35481a[_0x0adf('0x3')]||'';this[_0x0adf('0x4')]=_0x35481a['remoteUri']||'';this[_0x0adf('0x5')]=_0x35481a['serverUrl']||'';this['Configurations']=_0x35481a['Configurations']||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index fefa1a4..c4cff83 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 _0xefb3=['exten','priority','holdtime','assigned','lastAssignedTo','voice','mohtime','exports','type','inbound','calleridnum','calleridname','queue','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','connectedlinenum','connectedlinename','accountcode','context'];(function(_0x402718,_0x22529c){var _0x3e6afb=function(_0x456b60){while(--_0x456b60){_0x402718['push'](_0x402718['shift']());}};_0x3e6afb(++_0x22529c);}(_0xefb3,0xa9));var _0x3efb=function(_0x13a50f,_0x420ef7){_0x13a50f=_0x13a50f-0x0;var _0x2d17f0=_0xefb3[_0x13a50f];return _0x2d17f0;};'use strict';function QueueReport(){this[_0x3efb('0x0')]=_0x3efb('0x1');this['uniqueid']='';this[_0x3efb('0x2')]='';this[_0x3efb('0x3')]='';this[_0x3efb('0x4')]='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this['position']=0x1;this[_0x3efb('0x5')]=0x1;this[_0x3efb('0x6')]=![];this[_0x3efb('0x7')]=null;this[_0x3efb('0x8')]=![];this[_0x3efb('0x9')]=null;this[_0x3efb('0xa')]=![];this['queuecallerexitAt']=null;this['originalposition']=0x1;this['channel']='';this[_0x3efb('0xb')]='';this[_0x3efb('0xc')]='';this[_0x3efb('0xd')]='';this[_0x3efb('0xe')]='';this[_0x3efb('0xf')]='';this[_0x3efb('0x10')]='';this[_0x3efb('0x11')]=0x0;this[_0x3efb('0x12')]=![];this[_0x3efb('0x13')]='';this['motionChannel']=_0x3efb('0x14');this[_0x3efb('0x15')]=0x0;this['variables']={};}module[_0x3efb('0x16')]=QueueReport; \ No newline at end of file +var _0xb66a=['variables','exports','type','uniqueid','calleridnum','calleridname','queue','position','count','queuecallerabandonAt','queuecallercomplete','queuecallerexit','originalposition','channel','connectedlinenum','accountcode','context','exten','priority','holdtime','lastAssignedTo','motionChannel','mohtime'];(function(_0x1f239e,_0x367b43){var _0x826971=function(_0x2c5777){while(--_0x2c5777){_0x1f239e['push'](_0x1f239e['shift']());}};_0x826971(++_0x367b43);}(_0xb66a,0x1a0));var _0xab66=function(_0x245c04,_0x11ba2b){_0x245c04=_0x245c04-0x0;var _0x8ae3b5=_0xb66a[_0x245c04];return _0x8ae3b5;};'use strict';function QueueReport(){this[_0xab66('0x0')]='inbound';this[_0xab66('0x1')]='';this[_0xab66('0x2')]='';this[_0xab66('0x3')]='';this[_0xab66('0x4')]='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this[_0xab66('0x5')]=0x1;this[_0xab66('0x6')]=0x1;this['queuecallerabandon']=![];this[_0xab66('0x7')]=null;this[_0xab66('0x8')]=![];this['queuecallercompleteAt']=null;this[_0xab66('0x9')]=![];this['queuecallerexitAt']=null;this[_0xab66('0xa')]=0x1;this[_0xab66('0xb')]='';this[_0xab66('0xc')]='';this['connectedlinename']='';this[_0xab66('0xd')]='';this[_0xab66('0xe')]='';this[_0xab66('0xf')]='';this[_0xab66('0x10')]='';this[_0xab66('0x11')]=0x0;this['assigned']=![];this[_0xab66('0x12')]='';this[_0xab66('0x13')]='voice';this[_0xab66('0x14')]=0x0;this[_0xab66('0x15')]={};}module[_0xab66('0x16')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 166ba43..784c860 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 _0x3a26=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports'];(function(_0x543708,_0x517aec){var _0x348543=function(_0x50b805){while(--_0x50b805){_0x543708['push'](_0x543708['shift']());}};_0x348543(++_0x517aec);}(_0x3a26,0x129));var _0x63a2=function(_0x2e368c,_0x232676){_0x2e368c=_0x2e368c-0x0;var _0x23562c=_0x3a26[_0x2e368c];return _0x23562c;};'use strict';function SalesforceAccount(_0x17a510){this['id']=_0x17a510['id']||0x0;this['name']=_0x17a510['name']||'';this[_0x63a2('0x0')]=_0x17a510[_0x63a2('0x0')]||'';this[_0x63a2('0x1')]=_0x17a510[_0x63a2('0x1')]||'';this[_0x63a2('0x2')]=_0x17a510['password']||'';this[_0x63a2('0x3')]=_0x17a510[_0x63a2('0x3')]||'';this[_0x63a2('0x4')]=_0x17a510['clientSecret']||'';this[_0x63a2('0x5')]=_0x17a510[_0x63a2('0x5')]||'';this[_0x63a2('0x6')]=_0x17a510['type']||_0x63a2('0x7');this[_0x63a2('0x8')]=_0x17a510[_0x63a2('0x8')]||'';this[_0x63a2('0x9')]=_0x17a510[_0x63a2('0x9')]||{};}module[_0x63a2('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x24fe=['securityToken','type','serverUrl','Configurations','exports','name','remoteUri','password','clientId'];(function(_0x126e6c,_0xb93513){var _0x4acef4=function(_0x1b6a1d){while(--_0x1b6a1d){_0x126e6c['push'](_0x126e6c['shift']());}};_0x4acef4(++_0xb93513);}(_0x24fe,0xef));var _0xe24f=function(_0xe55314,_0x2fcb48){_0xe55314=_0xe55314-0x0;var _0xa5eb80=_0x24fe[_0xe55314];return _0xa5eb80;};'use strict';function SalesforceAccount(_0x12f2ce){this['id']=_0x12f2ce['id']||0x0;this[_0xe24f('0x0')]=_0x12f2ce[_0xe24f('0x0')]||'';this['username']=_0x12f2ce['username']||'';this[_0xe24f('0x1')]=_0x12f2ce['remoteUri']||'';this[_0xe24f('0x2')]=_0x12f2ce[_0xe24f('0x2')]||'';this[_0xe24f('0x3')]=_0x12f2ce[_0xe24f('0x3')]||'';this['clientSecret']=_0x12f2ce['clientSecret']||'';this['securityToken']=_0x12f2ce[_0xe24f('0x4')]||'';this[_0xe24f('0x5')]=_0x12f2ce[_0xe24f('0x5')]||'integrationTab';this[_0xe24f('0x6')]=_0x12f2ce['serverUrl']||'';this[_0xe24f('0x7')]=_0x12f2ce['Configurations']||{};}module[_0xe24f('0x8')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 341a740..260cd83 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 _0x8ea4=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x36301f,_0x37a90d){var _0x10da6d=function(_0x9cbce1){while(--_0x9cbce1){_0x36301f['push'](_0x36301f['shift']());}};_0x10da6d(++_0x37a90d);}(_0x8ea4,0x190));var _0x48ea=function(_0x3dd991,_0x4bef12){_0x3dd991=_0x3dd991-0x0;var _0x251609=_0x8ea4[_0x3dd991];return _0x251609;};'use strict';function ServicenowAccount(_0x45b439){this['id']=_0x45b439['id']||0x0;this[_0x48ea('0x0')]=_0x45b439[_0x48ea('0x0')]||'';this[_0x48ea('0x1')]=_0x45b439[_0x48ea('0x1')]||'';this['password']=_0x45b439[_0x48ea('0x2')]||'';this[_0x48ea('0x3')]=_0x45b439[_0x48ea('0x3')]||'';this['serverUrl']=_0x45b439[_0x48ea('0x4')]||'';this[_0x48ea('0x5')]=_0x45b439[_0x48ea('0x5')]||{};}module[_0x48ea('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x4617=['Configurations','name','username','password','remoteUri','serverUrl'];(function(_0x1ad8a2,_0x2c16c5){var _0xcf2c0e=function(_0x18163b){while(--_0x18163b){_0x1ad8a2['push'](_0x1ad8a2['shift']());}};_0xcf2c0e(++_0x2c16c5);}(_0x4617,0xaf));var _0x7461=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x4617[_0x4e7d25];return _0x526fe6;};'use strict';function ServicenowAccount(_0x2ad205){this['id']=_0x2ad205['id']||0x0;this[_0x7461('0x0')]=_0x2ad205[_0x7461('0x0')]||'';this['username']=_0x2ad205[_0x7461('0x1')]||'';this[_0x7461('0x2')]=_0x2ad205[_0x7461('0x2')]||'';this[_0x7461('0x3')]=_0x2ad205[_0x7461('0x3')]||'';this[_0x7461('0x4')]=_0x2ad205[_0x7461('0x4')]||'';this[_0x7461('0x5')]=_0x2ad205[_0x7461('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 1b41ff9..568165c 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 _0xef40=['exports','username','password','remoteUri','serverUrl','Configurations'];(function(_0x476c7,_0x298ee0){var _0x47ae56=function(_0x4acf5a){while(--_0x4acf5a){_0x476c7['push'](_0x476c7['shift']());}};_0x47ae56(++_0x298ee0);}(_0xef40,0x8b));var _0x0ef4=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xef40[_0x1facfa];return _0x9ec701;};'use strict';function SugarcrmAccount(_0x12e78a){this['id']=_0x12e78a['id']||0x0;this['name']=_0x12e78a['name']||'';this[_0x0ef4('0x0')]=_0x12e78a[_0x0ef4('0x0')]||'';this['password']=_0x12e78a[_0x0ef4('0x1')]||'';this['remoteUri']=_0x12e78a[_0x0ef4('0x2')]||'';this['serverUrl']=_0x12e78a[_0x0ef4('0x3')]||'';this[_0x0ef4('0x4')]=_0x12e78a[_0x0ef4('0x4')]||{};}module[_0x0ef4('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0x8b8f=['password','remoteUri','serverUrl','Configurations','name','username'];(function(_0x393db8,_0x3e1157){var _0x4295cc=function(_0x59aaf2){while(--_0x59aaf2){_0x393db8['push'](_0x393db8['shift']());}};_0x4295cc(++_0x3e1157);}(_0x8b8f,0x1a8));var _0xf8b8=function(_0x1b1edf,_0x363d35){_0x1b1edf=_0x1b1edf-0x0;var _0x2033a0=_0x8b8f[_0x1b1edf];return _0x2033a0;};'use strict';function SugarcrmAccount(_0x36d5d2){this['id']=_0x36d5d2['id']||0x0;this[_0xf8b8('0x0')]=_0x36d5d2[_0xf8b8('0x0')]||'';this[_0xf8b8('0x1')]=_0x36d5d2['username']||'';this[_0xf8b8('0x2')]=_0x36d5d2['password']||'';this[_0xf8b8('0x3')]=_0x36d5d2[_0xf8b8('0x3')]||'';this[_0xf8b8('0x4')]=_0x36d5d2[_0xf8b8('0x4')]||'';this[_0xf8b8('0x5')]=_0x36d5d2[_0xf8b8('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 6215692..42ffbdd 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 _0x9d62=['address','name','accountcode','unknown','stateTime','status'];(function(_0x29466e,_0x48f04a){var _0x348d5a=function(_0x26105b){while(--_0x26105b){_0x29466e['push'](_0x29466e['shift']());}};_0x348d5a(++_0x48f04a);}(_0x9d62,0xaf));var _0x29d6=function(_0x19e52c,_0x55db35){_0x19e52c=_0x19e52c-0x0;var _0x1e4a2c=_0x9d62[_0x19e52c];return _0x1e4a2c;};'use strict';function Telephone(_0x5bd4a){this['id']=_0x5bd4a['id']||0x0;this[_0x29d6('0x0')]=_0x5bd4a[_0x29d6('0x0')]||'';this[_0x29d6('0x1')]=_0x5bd4a[_0x29d6('0x1')]||'';this['state']=_0x29d6('0x2');this[_0x29d6('0x3')]=0x0;this[_0x29d6('0x4')]=_0x29d6('0x2');this[_0x29d6('0x5')]='';}module['exports']=Telephone; \ No newline at end of file +var _0x29c1=['address','exports','name','accountcode','state','unknown','stateTime','status'];(function(_0x28407a,_0x2a7269){var _0x8bd6ef=function(_0x3c886f){while(--_0x3c886f){_0x28407a['push'](_0x28407a['shift']());}};_0x8bd6ef(++_0x2a7269);}(_0x29c1,0x72));var _0x129c=function(_0x5f0571,_0x5c04a0){_0x5f0571=_0x5f0571-0x0;var _0x2872b7=_0x29c1[_0x5f0571];return _0x2872b7;};'use strict';function Telephone(_0x21ff12){this['id']=_0x21ff12['id']||0x0;this[_0x129c('0x0')]=_0x21ff12[_0x129c('0x0')]||'';this[_0x129c('0x1')]=_0x21ff12['accountcode']||'';this[_0x129c('0x2')]=_0x129c('0x3');this[_0x129c('0x4')]=0x0;this[_0x129c('0x5')]=_0x129c('0x3');this[_0x129c('0x6')]='';}module[_0x129c('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index a100bcb..bc163fd 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(_0x28c495,_0x47136a){var _0x58596d=function(_0x1e88f7){while(--_0x1e88f7){_0x28c495['push'](_0x28c495['shift']());}};_0x58596d(++_0x47136a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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(_0x10aa26,_0x3d0485){var _0x2059d5=function(_0x3fd4f9){while(--_0x3fd4f9){_0x10aa26['push'](_0x10aa26['shift']());}};_0x2059d5(++_0x3d0485);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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 d7968a7..9ce01ea 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 _0xbaf0=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';function Trigger(_0x61caa9){this['id']=_0x61caa9['id']||0x0;this[_0x0baf('0x0')]=_0x61caa9[_0x0baf('0x0')]||'';this[_0x0baf('0x1')]=_0x61caa9[_0x0baf('0x1')]||_0x0baf('0x2');this[_0x0baf('0x3')]=_0x61caa9['status']||![];this[_0x0baf('0x4')]=_0x61caa9[_0x0baf('0x4')]||[];this[_0x0baf('0x5')]=_0x61caa9[_0x0baf('0x5')]||[];this[_0x0baf('0x6')]=_0x61caa9[_0x0baf('0x6')]||[];}module[_0x0baf('0x7')]=Trigger; \ No newline at end of file +var _0x2032=['exports','name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x15fb8f,_0x6858e9){var _0x290eb2=function(_0x3c13d6){while(--_0x3c13d6){_0x15fb8f['push'](_0x15fb8f['shift']());}};_0x290eb2(++_0x6858e9);}(_0x2032,0xd9));var _0x2203=function(_0x7570b8,_0x570d9e){_0x7570b8=_0x7570b8-0x0;var _0x2e75da=_0x2032[_0x7570b8];return _0x2e75da;};'use strict';function Trigger(_0x4d6c97){this['id']=_0x4d6c97['id']||0x0;this[_0x2203('0x0')]=_0x4d6c97[_0x2203('0x0')]||'';this[_0x2203('0x1')]=_0x4d6c97['channel']||_0x2203('0x2');this[_0x2203('0x3')]=_0x4d6c97['status']||![];this[_0x2203('0x4')]=_0x4d6c97[_0x2203('0x4')]||[];this[_0x2203('0x5')]=_0x4d6c97[_0x2203('0x5')]||[];this[_0x2203('0x6')]=_0x4d6c97[_0x2203('0x6')]||[];}module[_0x2203('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 525345d..2eb8d47 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 _0xe7e7=['domain','domainport','refresh','stateRegistry','defaultuser','exports','active','name','state','unknown','stateTime','status','registry','host','port'];(function(_0x3c76fc,_0x39e116){var _0x4755f5=function(_0x493e01){while(--_0x493e01){_0x3c76fc['push'](_0x3c76fc['shift']());}};_0x4755f5(++_0x39e116);}(_0xe7e7,0x1d7));var _0x7e7e=function(_0x8bc61a,_0x431b12){_0x8bc61a=_0x8bc61a-0x0;var _0x564f59=_0xe7e7[_0x8bc61a];return _0x564f59;};'use strict';function Trunk(_0x45d6af){this['id']=_0x45d6af['id']||0x0;this[_0x7e7e('0x0')]=_0x45d6af['active']||![];this[_0x7e7e('0x1')]=_0x45d6af[_0x7e7e('0x1')]||'';this[_0x7e7e('0x2')]=_0x7e7e('0x3');this[_0x7e7e('0x4')]=0x0;this[_0x7e7e('0x5')]=_0x7e7e('0x3');this[_0x7e7e('0x6')]=_0x45d6af[_0x7e7e('0x6')]&&_0x45d6af['registry']['indexOf'](':')?_0x45d6af[_0x7e7e('0x6')]['split'](':')[0x0]:'';this[_0x7e7e('0x7')]='';this[_0x7e7e('0x8')]='';this[_0x7e7e('0x9')]='';this[_0x7e7e('0xa')]='';this[_0x7e7e('0xb')]='';this[_0x7e7e('0xc')]=_0x7e7e('0x3');this['registrationtime']='';this['address']='';this[_0x7e7e('0xd')]=_0x45d6af[_0x7e7e('0xd')]||'';}module[_0x7e7e('0xe')]=Trunk; \ No newline at end of file +var _0xba89=['exports','name','state','stateTime','status','unknown','registry','indexOf','split','host','port','domain','refresh','address','defaultuser'];(function(_0x4572b8,_0x2becd5){var _0x34848e=function(_0x5a3a58){while(--_0x5a3a58){_0x4572b8['push'](_0x4572b8['shift']());}};_0x34848e(++_0x2becd5);}(_0xba89,0x10f));var _0x9ba8=function(_0x2a4bba,_0x1194ce){_0x2a4bba=_0x2a4bba-0x0;var _0x40e9c4=_0xba89[_0x2a4bba];return _0x40e9c4;};'use strict';function Trunk(_0x533d2c){this['id']=_0x533d2c['id']||0x0;this['active']=_0x533d2c['active']||![];this['name']=_0x533d2c[_0x9ba8('0x0')]||'';this[_0x9ba8('0x1')]='unknown';this[_0x9ba8('0x2')]=0x0;this[_0x9ba8('0x3')]=_0x9ba8('0x4');this[_0x9ba8('0x5')]=_0x533d2c[_0x9ba8('0x5')]&&_0x533d2c[_0x9ba8('0x5')][_0x9ba8('0x6')](':')?_0x533d2c[_0x9ba8('0x5')][_0x9ba8('0x7')](':')[0x0]:'';this[_0x9ba8('0x8')]='';this[_0x9ba8('0x9')]='';this[_0x9ba8('0xa')]='';this['domainport']='';this[_0x9ba8('0xb')]='';this['stateRegistry']=_0x9ba8('0x4');this['registrationtime']='';this[_0x9ba8('0xc')]='';this[_0x9ba8('0xd')]=_0x533d2c[_0x9ba8('0xd')]||'';}module[_0x9ba8('0xe')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 308b061..6fb1c53 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 _0x428e=['recordingFormat','none','mandatoryDisposition','exten'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x428e,0x13f));var _0xe428=function(_0x540133,_0x41783f){_0x540133=_0x540133-0x0;var _0x26b6e9=_0x428e[_0x540133];return _0x26b6e9;};'use strict';function voiceExtension(_0x582f0e){this['id']=_0x582f0e['id']||0x0;this[_0xe428('0x0')]=_0x582f0e[_0xe428('0x0')]||'';this[_0xe428('0x1')]=_0x582f0e[_0xe428('0x1')]||_0xe428('0x2');this['mandatoryDisposition']=_0x582f0e[_0xe428('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x022d=['mandatoryDisposition','exten','recordingFormat'];(function(_0x3474ae,_0x231e5b){var _0x28e04e=function(_0x4def0e){while(--_0x4def0e){_0x3474ae['push'](_0x3474ae['shift']());}};_0x28e04e(++_0x231e5b);}(_0x022d,0x130));var _0xd022=function(_0xc8503a,_0xf4ee29){_0xc8503a=_0xc8503a-0x0;var _0x512270=_0x022d[_0xc8503a];return _0x512270;};'use strict';function voiceExtension(_0x50c316){this['id']=_0x50c316['id']||0x0;this[_0xd022('0x0')]=_0x50c316[_0xd022('0x0')]||'';this['recordingFormat']=_0x50c316[_0xd022('0x1')]||'none';this[_0xd022('0x2')]=_0x50c316[_0xd022('0x2')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 6e00842..09a9178 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 _0x82c3=['tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm','roundrobin','name','monitor_format','inbound','waiting','talking','total','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions'];(function(_0x4d7c80,_0x483ef5){var _0x37912b=function(_0x1fa623){while(--_0x1fa623){_0x4d7c80['push'](_0x4d7c80['shift']());}};_0x37912b(++_0x483ef5);}(_0x82c3,0xcb));var _0x382c=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x82c3[_0x491a7f];return _0x3d8f44;};'use strict';var statusDesc=[_0x382c('0x0'),_0x382c('0x1'),_0x382c('0x2'),_0x382c('0x3'),_0x382c('0x4'),_0x382c('0x5'),_0x382c('0x6'),_0x382c('0x7'),_0x382c('0x8')];var monitorFormat={'wav':_0x382c('0x9'),'wav49':_0x382c('0xa'),'gsm':_0x382c('0xb')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x382c('0xc')};function VoiceQueue(_0x13fa11){this['id']=_0x13fa11['id']||0x0;this[_0x382c('0xd')]=_0x13fa11['name']||'';this['monitor_format']=_0x13fa11[_0x382c('0xe')]||'';this['type']=_0x13fa11['type']||_0x382c('0xf');this[_0x382c('0x10')]=0x0;this[_0x382c('0x11')]=0x0;this[_0x382c('0x12')]=0x0;this['answered']=0x0;this[_0x382c('0x13')]=0x0;this[_0x382c('0x14')]=0x0;this[_0x382c('0x15')]=0x0;this[_0x382c('0x16')]=0x0;this[_0x382c('0x17')]=0x0;this['loggedIn']=0x0;this[_0x382c('0x18')]=0x0;this[_0x382c('0x19')]=_0x13fa11[_0x382c('0x19')]||![];this[_0x382c('0x1a')]=_0x13fa11[_0x382c('0x1a')]||0xa;this[_0x382c('0x1b')]=_0x13fa11['autopause']||'no';this[_0x382c('0x1c')]=!![];this[_0x382c('0x1d')]='';this[_0x382c('0x1e')]=0x0;this[_0x382c('0x1f')]=0x0;this['dialTimezone']=_0x13fa11['dialTimezone']||null;this[_0x382c('0x20')]=_0x13fa11[_0x382c('0x20')]?_0x13fa11['dialGlobalInterval']:null;this[_0x382c('0x21')]=_0x13fa11[_0x382c('0x21')];this[_0x382c('0x22')]=_0x13fa11[_0x382c('0x22')]||'progressive';this[_0x382c('0x23')]=_0x13fa11[_0x382c('0x23')]||0x0;this[_0x382c('0x24')]=_0x13fa11['dialLimitQueue']||0x0;this['dialPowerLevel']=_0x13fa11[_0x382c('0x25')]||0x1;this[_0x382c('0x26')]=_0x13fa11[_0x382c('0x26')]||_0x382c('0x27');this['dialPredictiveOptimizationPercentage']=_0x13fa11[_0x382c('0x28')]||0.03;this[_0x382c('0x29')]=_0x13fa11[_0x382c('0x29')]||0x258;this[_0x382c('0x2a')]=_0x13fa11[_0x382c('0x2a')]||_0x382c('0x2b');this[_0x382c('0x2c')]=_0x13fa11[_0x382c('0x2c')]||_0x382c('0x2b');this[_0x382c('0x2d')]=_0x13fa11[_0x382c('0x2d')]||0x1e;this[_0x382c('0x2e')]=_0x13fa11[_0x382c('0x2e')]||_0x382c('0x2f');this[_0x382c('0x30')]=_0x13fa11['dialQueueTimeout']||0x3;this[_0x382c('0x31')]=_0x13fa11[_0x382c('0x31')]||undefined;this[_0x382c('0x32')]=_0x13fa11[_0x382c('0x32')]||0x3;this[_0x382c('0x33')]=_0x13fa11['dialCongestionRetryFrequency']||0x96;this[_0x382c('0x34')]=_0x13fa11['dialBusyMaxRetry']||0x3;this[_0x382c('0x35')]=_0x13fa11[_0x382c('0x35')]||0x96;this[_0x382c('0x36')]=_0x13fa11[_0x382c('0x36')]||0x3;this[_0x382c('0x37')]=_0x13fa11['dialNoAnswerRetryFrequency']||0x96;this[_0x382c('0x38')]=_0x13fa11['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x13fa11['dialNoSuchNumberRetryFrequency']||0x96;this[_0x382c('0x39')]=_0x13fa11[_0x382c('0x39')]||0x3;this[_0x382c('0x3a')]=_0x13fa11[_0x382c('0x3a')]||0x96;this[_0x382c('0x3b')]=_0x13fa11[_0x382c('0x3b')]||0x3;this[_0x382c('0x3c')]=_0x13fa11['dialAbandonedRetryFrequency']||0x96;this[_0x382c('0x3d')]=_0x13fa11[_0x382c('0x3d')]||0x3;this['dialMachineRetryFrequency']=_0x13fa11[_0x382c('0x3e')]||0x96;this[_0x382c('0x3f')]=_0x13fa11[_0x382c('0x3f')]||0x3;this[_0x382c('0x40')]=_0x13fa11[_0x382c('0x40')]||0x96;this['dialGlobalMaxRetry']=_0x13fa11[_0x382c('0x41')]||0x4;this['Trunk']=_0x13fa11[_0x382c('0x42')]?_0x13fa11[_0x382c('0x42')]:undefined;this[_0x382c('0x43')]=_0x13fa11[_0x382c('0x43')]?_0x13fa11['TrunkBackup']:undefined;this[_0x382c('0x44')]=_0x13fa11[_0x382c('0x44')]||undefined;this[_0x382c('0x45')]=_0x13fa11[_0x382c('0x45')]?_0x13fa11[_0x382c('0x45')]:undefined;this[_0x382c('0x46')]=_0x13fa11[_0x382c('0x46')]||_0x382c('0x47');this[_0x382c('0x48')]=_0x13fa11[_0x382c('0x48')]||undefined;this[_0x382c('0x49')]=_0x13fa11['dialCutDigit']||undefined;this[_0x382c('0x4a')]=strategy[_0x13fa11['strategy']]||_0x382c('0x4b');this[_0x382c('0x4c')]=!![];this[_0x382c('0x4d')]=_0x13fa11[_0x382c('0x4d')]||![];this[_0x382c('0x4e')]=_0x13fa11['dialAMDInitialSilence'];this[_0x382c('0x4f')]=_0x13fa11[_0x382c('0x4f')];this[_0x382c('0x50')]=_0x13fa11[_0x382c('0x50')];this['dialAMDTotalAnalysisTime']=_0x13fa11[_0x382c('0x51')];this[_0x382c('0x52')]=_0x13fa11[_0x382c('0x52')];this[_0x382c('0x53')]=_0x13fa11[_0x382c('0x53')];this[_0x382c('0x54')]=_0x13fa11['dialAMDMaximumNumberOfWords'];this[_0x382c('0x55')]=_0x13fa11[_0x382c('0x55')];this[_0x382c('0x56')]=_0x13fa11['dialAMDMaximumWordLength'];this[_0x382c('0x57')]=0x0;this['pTalking']=0x0;this[_0x382c('0x58')]=_0x13fa11[_0x382c('0x58')];this['outboundAnswerCallsDay']=0x0;this[_0x382c('0x59')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x382c('0x5a')]=0x0;this[_0x382c('0x5b')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x382c('0x5c')]=0x0;this[_0x382c('0x5d')]=0x0;this[_0x382c('0x5e')]=0x0;this[_0x382c('0x5f')]=0x0;this[_0x382c('0x60')]=0x0;this[_0x382c('0x61')]=0x0;this[_0x382c('0x62')]=0x0;this[_0x382c('0x63')]=0x0;this[_0x382c('0x64')]=undefined;this[_0x382c('0x65')]=undefined;this['handlePredictive']=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x382c('0x66')]=0x0;this[_0x382c('0x67')]=0x0;this[_0x382c('0x68')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x382c('0x69')]=0x0;this[_0x382c('0x6a')]=0x0;this[_0x382c('0x6b')]=0x0;this[_0x382c('0x6c')]=0x0;this[_0x382c('0x6d')]=_0x13fa11[_0x382c('0x6e')]||0x14;this['predictiveIntervalMinThreshold']=_0x13fa11[_0x382c('0x6e')]||0xa;this[_0x382c('0x6f')]=0x0;this[_0x382c('0x70')]=0x0;this[_0x382c('0x71')]=0x1;this[_0x382c('0x72')]=0x0;this[_0x382c('0x73')]=0x0;this[_0x382c('0x74')]=0x0;this[_0x382c('0x75')]=0x0;this[_0x382c('0x76')]=_0x13fa11[_0x382c('0x76')]||0x1e;this['dialRecallInQueue']=_0x13fa11[_0x382c('0x77')]||![];this[_0x382c('0x78')]=!!_0x13fa11[_0x382c('0x78')]||![];this['dialQueueProject2']=_0x13fa11['dialQueueProject2']||undefined;this[_0x382c('0x79')]=_0x13fa11[_0x382c('0x79')]||![];this[_0x382c('0x7a')]=_0x13fa11[_0x382c('0x7a')]||![];this[_0x382c('0xe')]=monitorFormat[_0x13fa11[_0x382c('0xe')]]?monitorFormat[_0x13fa11['monitor_format']]:undefined;this[_0x382c('0x7b')]=_0x13fa11[_0x382c('0x7b')]||![];this[_0x382c('0x7c')]=_0x13fa11['mandatoryDispositionPause']?_0x13fa11['mandatoryDispositionPause']:undefined;}module['exports']=VoiceQueue; \ No newline at end of file +var _0xd953=['predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','not_inuse','busy','unavailable','ringing','ringinuse','wav49','name','monitor_format','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold'];(function(_0x5cb76f,_0x3f0295){var _0x4b5fbf=function(_0x88628b){while(--_0x88628b){_0x5cb76f['push'](_0x5cb76f['shift']());}};_0x4b5fbf(++_0x3f0295);}(_0xd953,0x105));var _0x3d95=function(_0x3d58ea,_0x67dc79){_0x3d58ea=_0x3d58ea-0x0;var _0x3a7747=_0xd953[_0x3d58ea];return _0x3a7747;};'use strict';var statusDesc=[_0x3d95('0x0'),_0x3d95('0x1'),'inuse',_0x3d95('0x2'),'invalid',_0x3d95('0x3'),_0x3d95('0x4'),_0x3d95('0x5'),'onhold'];var monitorFormat={'wav':'wav','wav49':_0x3d95('0x6'),'gsm':'gsm'};var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};function VoiceQueue(_0x1e96f2){this['id']=_0x1e96f2['id']||0x0;this[_0x3d95('0x7')]=_0x1e96f2[_0x3d95('0x7')]||'';this[_0x3d95('0x8')]=_0x1e96f2[_0x3d95('0x8')]||'';this['type']=_0x1e96f2['type']||_0x3d95('0x9');this[_0x3d95('0xa')]=0x0;this[_0x3d95('0xb')]=0x0;this[_0x3d95('0xc')]=0x0;this[_0x3d95('0xd')]=0x0;this[_0x3d95('0xe')]=0x0;this[_0x3d95('0xf')]=0x0;this[_0x3d95('0x10')]=0x0;this[_0x3d95('0x11')]=0x0;this[_0x3d95('0x12')]=0x0;this[_0x3d95('0x13')]=0x0;this['available']=0x0;this[_0x3d95('0x14')]=_0x1e96f2[_0x3d95('0x14')]||![];this[_0x3d95('0x15')]=_0x1e96f2[_0x3d95('0x15')]||0xa;this[_0x3d95('0x16')]=_0x1e96f2[_0x3d95('0x16')]||'no';this[_0x3d95('0x17')]=!![];this[_0x3d95('0x18')]='';this[_0x3d95('0x19')]=0x0;this['temp']=0x0;this[_0x3d95('0x1a')]=_0x1e96f2['dialTimezone']||null;this['dialGlobalInterval']=_0x1e96f2[_0x3d95('0x1b')]?_0x1e96f2[_0x3d95('0x1b')]:null;this[_0x3d95('0x1c')]=_0x1e96f2['dialActive'];this[_0x3d95('0x1d')]=_0x1e96f2[_0x3d95('0x1d')]||_0x3d95('0x1e');this['dialLimitChannel']=_0x1e96f2[_0x3d95('0x1f')]||0x0;this['dialLimitQueue']=_0x1e96f2[_0x3d95('0x20')]||0x0;this[_0x3d95('0x21')]=_0x1e96f2[_0x3d95('0x21')]||0x1;this[_0x3d95('0x22')]=_0x1e96f2[_0x3d95('0x22')]||_0x3d95('0x23');this[_0x3d95('0x24')]=_0x1e96f2[_0x3d95('0x24')]||0.03;this[_0x3d95('0x25')]=_0x1e96f2[_0x3d95('0x25')]||0x258;this[_0x3d95('0x26')]=_0x1e96f2[_0x3d95('0x26')]||'anonymous';this['dialOriginateCallerIdNumber']=_0x1e96f2[_0x3d95('0x27')]||_0x3d95('0x28');this[_0x3d95('0x29')]=_0x1e96f2[_0x3d95('0x29')]||0x1e;this[_0x3d95('0x2a')]=_0x1e96f2[_0x3d95('0x2a')]||'tTxX';this[_0x3d95('0x2b')]=_0x1e96f2[_0x3d95('0x2b')]||0x3;this[_0x3d95('0x2c')]=_0x1e96f2[_0x3d95('0x2c')]||undefined;this[_0x3d95('0x2d')]=_0x1e96f2['dialCongestionMaxRetry']||0x3;this[_0x3d95('0x2e')]=_0x1e96f2[_0x3d95('0x2e')]||0x96;this[_0x3d95('0x2f')]=_0x1e96f2['dialBusyMaxRetry']||0x3;this['dialBusyRetryFrequency']=_0x1e96f2[_0x3d95('0x30')]||0x96;this[_0x3d95('0x31')]=_0x1e96f2[_0x3d95('0x31')]||0x3;this[_0x3d95('0x32')]=_0x1e96f2[_0x3d95('0x32')]||0x96;this[_0x3d95('0x33')]=_0x1e96f2[_0x3d95('0x33')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x1e96f2[_0x3d95('0x34')]||0x96;this[_0x3d95('0x35')]=_0x1e96f2[_0x3d95('0x35')]||0x3;this[_0x3d95('0x36')]=_0x1e96f2['dialDropRetryFrequency']||0x96;this[_0x3d95('0x37')]=_0x1e96f2[_0x3d95('0x37')]||0x3;this[_0x3d95('0x38')]=_0x1e96f2['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x1e96f2['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x1e96f2[_0x3d95('0x39')]||0x96;this['dialAgentRejectMaxRetry']=_0x1e96f2[_0x3d95('0x3a')]||0x3;this[_0x3d95('0x3b')]=_0x1e96f2[_0x3d95('0x3b')]||0x96;this[_0x3d95('0x3c')]=_0x1e96f2[_0x3d95('0x3c')]||0x4;this[_0x3d95('0x3d')]=_0x1e96f2[_0x3d95('0x3d')]?_0x1e96f2[_0x3d95('0x3d')]:undefined;this[_0x3d95('0x3e')]=_0x1e96f2[_0x3d95('0x3e')]?_0x1e96f2[_0x3d95('0x3e')]:undefined;this[_0x3d95('0x3f')]=_0x1e96f2[_0x3d95('0x3f')]||undefined;this[_0x3d95('0x40')]=_0x1e96f2[_0x3d95('0x40')]?_0x1e96f2[_0x3d95('0x40')]:undefined;this[_0x3d95('0x41')]=_0x1e96f2['dialOrderByScheduledAt']||_0x3d95('0x42');this[_0x3d95('0x43')]=_0x1e96f2[_0x3d95('0x43')]||undefined;this[_0x3d95('0x44')]=_0x1e96f2[_0x3d95('0x44')]||undefined;this['strategy']=strategy[_0x1e96f2[_0x3d95('0x45')]]||_0x3d95('0x46');this['queueStatusComplete']=!![];this[_0x3d95('0x47')]=_0x1e96f2['dialAMDActive']||![];this[_0x3d95('0x48')]=_0x1e96f2['dialAMDInitialSilence'];this[_0x3d95('0x49')]=_0x1e96f2['dialAMDGreeting'];this[_0x3d95('0x4a')]=_0x1e96f2[_0x3d95('0x4a')];this[_0x3d95('0x4b')]=_0x1e96f2['dialAMDTotalAnalysisTime'];this[_0x3d95('0x4c')]=_0x1e96f2['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x1e96f2[_0x3d95('0x4d')];this[_0x3d95('0x4e')]=_0x1e96f2[_0x3d95('0x4e')];this[_0x3d95('0x4f')]=_0x1e96f2[_0x3d95('0x4f')];this[_0x3d95('0x50')]=_0x1e96f2[_0x3d95('0x50')];this[_0x3d95('0x51')]=0x0;this[_0x3d95('0x52')]=0x0;this['timeout']=_0x1e96f2[_0x3d95('0x53')];this[_0x3d95('0x54')]=0x0;this[_0x3d95('0x55')]=0x0;this[_0x3d95('0x56')]=0x0;this[_0x3d95('0x57')]=0x0;this[_0x3d95('0x58')]=0x0;this[_0x3d95('0x59')]=0x0;this[_0x3d95('0x5a')]=0x0;this[_0x3d95('0x5b')]=0x0;this[_0x3d95('0x5c')]=0x0;this[_0x3d95('0x5d')]=0x0;this[_0x3d95('0x5e')]=0x0;this[_0x3d95('0x5f')]=0x0;this['outboundReCallsDay']=0x0;this[_0x3d95('0x60')]=0x0;this['startProgressive']=undefined;this['startPredictive']=undefined;this['handlePredictive']=undefined;this[_0x3d95('0x61')]=1.05;this[_0x3d95('0x62')]=0x0;this[_0x3d95('0x63')]=0x0;this[_0x3d95('0x64')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x3d95('0x65')]=0x0;this[_0x3d95('0x66')]=0x0;this[_0x3d95('0x67')]=0x0;this[_0x3d95('0x68')]=0x0;this[_0x3d95('0x69')]=_0x1e96f2[_0x3d95('0x6a')]||0x14;this[_0x3d95('0x6b')]=_0x1e96f2['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x3d95('0x6c')]=0x0;this[_0x3d95('0x6d')]=0x0;this[_0x3d95('0x6e')]=0x1;this[_0x3d95('0x6f')]=0x0;this[_0x3d95('0x70')]=0x0;this[_0x3d95('0x71')]=0x0;this[_0x3d95('0x72')]=0x0;this[_0x3d95('0x73')]=_0x1e96f2[_0x3d95('0x73')]||0x1e;this[_0x3d95('0x74')]=_0x1e96f2['dialRecallInQueue']||![];this[_0x3d95('0x75')]=!!_0x1e96f2[_0x3d95('0x75')]||![];this[_0x3d95('0x76')]=_0x1e96f2[_0x3d95('0x76')]||undefined;this[_0x3d95('0x77')]=_0x1e96f2[_0x3d95('0x77')]||![];this[_0x3d95('0x78')]=_0x1e96f2[_0x3d95('0x78')]||![];this['monitor_format']=monitorFormat[_0x1e96f2[_0x3d95('0x8')]]?monitorFormat[_0x1e96f2['monitor_format']]:undefined;this[_0x3d95('0x79')]=_0x1e96f2['mandatoryDisposition']||![];this[_0x3d95('0x7a')]=_0x1e96f2[_0x3d95('0x7a')]?_0x1e96f2[_0x3d95('0x7a')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 10018f1..e3dbf05 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 _0x4a9a=['remoteUri','Configurations','exports','name','username','accessKey'];(function(_0x45d1fd,_0x463212){var _0xd0e542=function(_0x23ebc9){while(--_0x23ebc9){_0x45d1fd['push'](_0x45d1fd['shift']());}};_0xd0e542(++_0x463212);}(_0x4a9a,0x123));var _0xa4a9=function(_0x1049a5,_0x15a34b){_0x1049a5=_0x1049a5-0x0;var _0x5c048f=_0x4a9a[_0x1049a5];return _0x5c048f;};'use strict';function VtigerAccount(_0x4dab9a){this['id']=_0x4dab9a['id']||0x0;this[_0xa4a9('0x0')]=_0x4dab9a[_0xa4a9('0x0')]||'';this['username']=_0x4dab9a[_0xa4a9('0x1')]||'';this[_0xa4a9('0x2')]=_0x4dab9a['accessKey']||'';this[_0xa4a9('0x3')]=_0x4dab9a[_0xa4a9('0x3')]||'';this['serverUrl']=_0x4dab9a['serverUrl']||'';this[_0xa4a9('0x4')]=_0x4dab9a[_0xa4a9('0x4')]||{};}module[_0xa4a9('0x5')]=VtigerAccount; \ No newline at end of file +var _0x9ca1=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x31c733,_0x174e9f){var _0x369a7a=function(_0x409188){while(--_0x409188){_0x31c733['push'](_0x31c733['shift']());}};_0x369a7a(++_0x174e9f);}(_0x9ca1,0x1cc));var _0x19ca=function(_0x5aeaff,_0x4ddffd){_0x5aeaff=_0x5aeaff-0x0;var _0x1878b3=_0x9ca1[_0x5aeaff];return _0x1878b3;};'use strict';function VtigerAccount(_0xd0f2eb){this['id']=_0xd0f2eb['id']||0x0;this[_0x19ca('0x0')]=_0xd0f2eb[_0x19ca('0x0')]||'';this[_0x19ca('0x1')]=_0xd0f2eb[_0x19ca('0x1')]||'';this[_0x19ca('0x2')]=_0xd0f2eb[_0x19ca('0x2')]||'';this[_0x19ca('0x3')]=_0xd0f2eb[_0x19ca('0x3')]||'';this[_0x19ca('0x4')]=_0xd0f2eb[_0x19ca('0x4')]||'';this['Configurations']=_0xd0f2eb[_0x19ca('0x5')]||{};}module[_0x19ca('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 72f03cc..7753563 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 _0x7686=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','username','password'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x7686,0xf8));var _0x6768=function(_0x242950,_0x4124d4){_0x242950=_0x242950-0x0;var _0xcd6f5f=_0x7686[_0x242950];return _0xcd6f5f;};'use strict';function ZendeskAccount(_0x14be26){this['id']=_0x14be26['id']||0x0;this['name']=_0x14be26['name']||'';this[_0x6768('0x0')]=_0x14be26['username']||'';this[_0x6768('0x1')]=_0x14be26[_0x6768('0x1')]||'';this[_0x6768('0x2')]=_0x14be26[_0x6768('0x2')]||'';this['remoteUri']=_0x14be26[_0x6768('0x3')]||'';this[_0x6768('0x4')]=_0x14be26[_0x6768('0x4')]||'';this[_0x6768('0x5')]=_0x14be26[_0x6768('0x5')]||_0x6768('0x6');this[_0x6768('0x7')]=_0x14be26[_0x6768('0x7')]||'';this[_0x6768('0x8')]=_0x14be26[_0x6768('0x8')]||{};}module[_0x6768('0x9')]=ZendeskAccount; \ No newline at end of file +var _0xf9db=['remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x2bfd4f,_0x1bbf2c){var _0x341849=function(_0x4c246e){while(--_0x4c246e){_0x2bfd4f['push'](_0x2bfd4f['shift']());}};_0x341849(++_0x1bbf2c);}(_0xf9db,0x1e0));var _0xbf9d=function(_0x54c497,_0x1fee40){_0x54c497=_0x54c497-0x0;var _0x577ab0=_0xf9db[_0x54c497];return _0x577ab0;};'use strict';function ZendeskAccount(_0x2f7ce2){this['id']=_0x2f7ce2['id']||0x0;this['name']=_0x2f7ce2[_0xbf9d('0x0')]||'';this[_0xbf9d('0x1')]=_0x2f7ce2['username']||'';this[_0xbf9d('0x2')]=_0x2f7ce2['password']||'';this[_0xbf9d('0x3')]=_0x2f7ce2['token']||'';this[_0xbf9d('0x4')]=_0x2f7ce2['remoteUri']||'';this[_0xbf9d('0x5')]=_0x2f7ce2[_0xbf9d('0x5')]||'';this[_0xbf9d('0x6')]=_0x2f7ce2['type']||_0xbf9d('0x7');this['serverUrl']=_0x2f7ce2[_0xbf9d('0x8')]||'';this[_0xbf9d('0x9')]=_0x2f7ce2[_0xbf9d('0x9')]||{};}module[_0xbf9d('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 2860502..17c711f 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 _0x2c49=['serverUrl','code','Configurations','name','description','host','zone','clientId','clientSecret'];(function(_0x12dd11,_0x52b882){var _0x3a502b=function(_0x1a660d){while(--_0x1a660d){_0x12dd11['push'](_0x12dd11['shift']());}};_0x3a502b(++_0x52b882);}(_0x2c49,0x12c));var _0x92c4=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x2c49[_0x2112d4];return _0x434972;};'use strict';function ZohoAccount(_0x3c9042){this['id']=_0x3c9042['id']||0x0;this[_0x92c4('0x0')]=_0x3c9042[_0x92c4('0x0')]||'';this[_0x92c4('0x1')]=_0x3c9042[_0x92c4('0x1')]||'';this[_0x92c4('0x2')]=_0x3c9042['host']||'';this[_0x92c4('0x3')]=_0x3c9042[_0x92c4('0x3')]||'';this[_0x92c4('0x4')]=_0x3c9042[_0x92c4('0x4')]||'';this[_0x92c4('0x5')]=_0x3c9042['clientSecret']||'';this[_0x92c4('0x6')]=_0x3c9042[_0x92c4('0x6')]||'';this[_0x92c4('0x7')]=_0x3c9042[_0x92c4('0x7')]||'';this['refreshToken']=_0x3c9042['refreshToken']||'';this['Configurations']=_0x3c9042[_0x92c4('0x8')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x39bc=['code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x39bc,0x1e8));var _0xc39b=function(_0x391b74,_0x4317e2){_0x391b74=_0x391b74-0x0;var _0x3308e6=_0x39bc[_0x391b74];return _0x3308e6;};'use strict';function ZohoAccount(_0x27055f){this['id']=_0x27055f['id']||0x0;this[_0xc39b('0x0')]=_0x27055f[_0xc39b('0x0')]||'';this[_0xc39b('0x1')]=_0x27055f[_0xc39b('0x1')]||'';this[_0xc39b('0x2')]=_0x27055f[_0xc39b('0x2')]||'';this[_0xc39b('0x3')]=_0x27055f[_0xc39b('0x3')]||'';this[_0xc39b('0x4')]=_0x27055f[_0xc39b('0x4')]||'';this[_0xc39b('0x5')]=_0x27055f[_0xc39b('0x5')]||'';this[_0xc39b('0x6')]=_0x27055f[_0xc39b('0x6')]||'';this[_0xc39b('0x7')]=_0x27055f[_0xc39b('0x7')]||'';this[_0xc39b('0x8')]=_0x27055f[_0xc39b('0x8')]||'';this[_0xc39b('0x9')]=_0x27055f['Configurations']||{};}module[_0xc39b('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 7b3619b..01d7e32 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 _0x85e8=['queue','name','type','dialAnswer','Agent','channelAgent','format','SIP/%s','calleridname','Contact','firstName','lastName','active','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','number','exports','util','moment','isNil','string','uniqueid','idContact'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x85e8,0xd6));var _0x885e=function(_0x472b43,_0x542745){_0x472b43=_0x472b43-0x0;var _0x483774=_0x85e8[_0x472b43];return _0x483774;};'use strict';var util=require(_0x885e('0x0'));var _=require('lodash');var moment=require(_0x885e('0x1'));function checkNameSurname(_0x19d308,_0x476a19,_0x3e3636){var _0x36ef1a='';if(!_[_0x885e('0x2')](_0x476a19)&&_0x885e('0x3')===typeof _0x476a19){_0x36ef1a+=_0x476a19;}if(!_[_0x885e('0x2')](_0x3e3636)&&_0x885e('0x3')===typeof _0x3e3636){_0x36ef1a+='\x20'+_0x3e3636;}if(_0x36ef1a!==''){return _0x36ef1a;}return _0x19d308;}function Action(_0xdbb06f,_0x2b5b94,_0x5994fc,_0x18cfc2,_0x166b45){this[_0x885e('0x4')]=_0x5994fc||undefined;this[_0x885e('0x5')]=_0xdbb06f['id'];this[_0x885e('0x6')]=_0x2b5b94[_0x885e('0x7')];this[_0x885e('0x8')]=_0x2b5b94[_0x885e('0x8')];this['campaigntype']=_0x885e('0x6');this[_0x885e('0x9')]=![];this['membername']=_[_0x885e('0x2')](_0xdbb06f[_0x885e('0xa')])?undefined:_0xdbb06f[_0x885e('0xa')][_0x885e('0x7')];this[_0x885e('0xb')]=this['membername']?util[_0x885e('0xc')](_0x885e('0xd'),this['membername']):_0x18cfc2||undefined;this[_0x885e('0xe')]=checkNameSurname(_0xdbb06f[_0x885e('0xf')]['phone'],_0xdbb06f['Contact'][_0x885e('0x10')],_0xdbb06f['Contact'][_0x885e('0x11')]);this[_0x885e('0x12')]=_0xdbb06f['active']||![];this['calleridnum']=_0xdbb06f[_0x885e('0xf')][_0x885e('0x13')];this[_0x885e('0x14')]=_0xdbb06f['scheduledat'];this[_0x885e('0x15')]=_0xdbb06f[_0x885e('0x15')]||0x0;this[_0x885e('0x16')]=_0xdbb06f['countcongestionretry']||0x0;this[_0x885e('0x17')]=_0xdbb06f[_0x885e('0x17')]||0x0;this[_0x885e('0x18')]=(_0xdbb06f[_0x885e('0x15')]||0x0)+(_0xdbb06f[_0x885e('0x16')]||0x0)+(_0xdbb06f[_0x885e('0x17')]||0x0)+(_0xdbb06f[_0x885e('0x19')]||0x0)+(_0xdbb06f[_0x885e('0x1a')]||0x0)+(_0xdbb06f['countabandonedretry']||0x0)+(_0xdbb06f['countmachineretry']||0x0)+(_0xdbb06f[_0x885e('0x1b')]||0x0);this[_0x885e('0x19')]=_0xdbb06f[_0x885e('0x19')]||0x0;this[_0x885e('0x1a')]=_0xdbb06f[_0x885e('0x1a')]||0x0;this['countabandonedretry']=_0xdbb06f[_0x885e('0x1c')]||0x0;this[_0x885e('0x1d')]=_0xdbb06f[_0x885e('0x1d')]||0x0;this[_0x885e('0x1b')]=_0xdbb06f['countagentrejectretry']||0x0;this[_0x885e('0x1e')]=_0xdbb06f['callback'];this[_0x885e('0x1f')]=_0xdbb06f[_0x885e('0x1f')];this[_0x885e('0x20')]=_0xdbb06f[_0x885e('0x20')];this[_0x885e('0x21')]=_0xdbb06f[_0x885e('0x21')];this[_0x885e('0x22')]=_0xdbb06f[_0x885e('0x22')];this[_0x885e('0x23')]=_0xdbb06f[_0x885e('0x23')];this['UserId']=_['isNil'](_0xdbb06f[_0x885e('0xa')])?_0xdbb06f[_0x885e('0x24')]:_0xdbb06f['Agent']['id'];this[_0x885e('0x25')]=_0xdbb06f[_0x885e('0x25')];this[_0x885e('0x26')]='';this[_0x885e('0x27')]='';}Action['prototype'][_0x885e('0x28')]=function(){return util['format'](_0x885e('0x29'),this[_0x885e('0xe')],this[_0x885e('0x2a')]);};module[_0x885e('0x2b')]=Action; \ No newline at end of file +var _0x608b=['exports','util','lodash','moment','string','isNil','uniqueid','idContact','queue','name','type','campaigntype','membername','Agent','format','calleridname','phone','firstName','Contact','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','originatecalleridname','\x22%s\x22\x20<%s>','number'];(function(_0x3e2489,_0x41d9dd){var _0x2254ce=function(_0x227e46){while(--_0x227e46){_0x3e2489['push'](_0x3e2489['shift']());}};_0x2254ce(++_0x41d9dd);}(_0x608b,0x1a5));var _0xb608=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x608b[_0x27af45];return _0x18df21;};'use strict';var util=require(_0xb608('0x0'));var _=require(_0xb608('0x1'));var moment=require(_0xb608('0x2'));function checkNameSurname(_0x247f9e,_0x336343,_0x13a642){var _0x3aaf70='';if(!_['isNil'](_0x336343)&&_0xb608('0x3')===typeof _0x336343){_0x3aaf70+=_0x336343;}if(!_[_0xb608('0x4')](_0x13a642)&&'string'===typeof _0x13a642){_0x3aaf70+='\x20'+_0x13a642;}if(_0x3aaf70!==''){return _0x3aaf70;}return _0x247f9e;}function Action(_0x539de8,_0x139e00,_0xe48aea,_0x5a2eca,_0x5c8a48){this[_0xb608('0x5')]=_0xe48aea||undefined;this[_0xb608('0x6')]=_0x539de8['id'];this[_0xb608('0x7')]=_0x139e00[_0xb608('0x8')];this[_0xb608('0x9')]=_0x139e00['type'];this[_0xb608('0xa')]=_0xb608('0x7');this['dialAnswer']=![];this[_0xb608('0xb')]=_[_0xb608('0x4')](_0x539de8[_0xb608('0xc')])?undefined:_0x539de8[_0xb608('0xc')][_0xb608('0x8')];this['channelAgent']=this[_0xb608('0xb')]?util[_0xb608('0xd')]('SIP/%s',this[_0xb608('0xb')]):_0x5a2eca||undefined;this[_0xb608('0xe')]=checkNameSurname(_0x539de8['Contact'][_0xb608('0xf')],_0x539de8['Contact'][_0xb608('0x10')],_0x539de8[_0xb608('0x11')][_0xb608('0x12')]);this[_0xb608('0x13')]=_0x539de8[_0xb608('0x13')]||![];this[_0xb608('0x14')]=_0x539de8['Contact'][_0xb608('0xf')];this[_0xb608('0x15')]=_0x539de8[_0xb608('0x15')];this[_0xb608('0x16')]=_0x539de8[_0xb608('0x16')]||0x0;this[_0xb608('0x17')]=_0x539de8['countcongestionretry']||0x0;this[_0xb608('0x18')]=_0x539de8[_0xb608('0x18')]||0x0;this[_0xb608('0x19')]=(_0x539de8[_0xb608('0x16')]||0x0)+(_0x539de8[_0xb608('0x17')]||0x0)+(_0x539de8[_0xb608('0x18')]||0x0)+(_0x539de8[_0xb608('0x1a')]||0x0)+(_0x539de8[_0xb608('0x1b')]||0x0)+(_0x539de8['countabandonedretry']||0x0)+(_0x539de8[_0xb608('0x1c')]||0x0)+(_0x539de8[_0xb608('0x1d')]||0x0);this[_0xb608('0x1a')]=_0x539de8['countnosuchnumberretry']||0x0;this[_0xb608('0x1b')]=_0x539de8[_0xb608('0x1b')]||0x0;this[_0xb608('0x1e')]=_0x539de8['countabandonedretry']||0x0;this[_0xb608('0x1c')]=_0x539de8['countmachineretry']||0x0;this[_0xb608('0x1d')]=_0x539de8[_0xb608('0x1d')]||0x0;this[_0xb608('0x1f')]=_0x539de8[_0xb608('0x1f')];this[_0xb608('0x20')]=_0x539de8['callbackuniqueid'];this[_0xb608('0x21')]=_0x539de8[_0xb608('0x21')];this[_0xb608('0x22')]=_0x539de8[_0xb608('0x22')];this['ContactId']=_0x539de8['ContactId'];this[_0xb608('0x23')]=_0x539de8[_0xb608('0x23')];this[_0xb608('0x24')]=_[_0xb608('0x4')](_0x539de8[_0xb608('0xc')])?_0x539de8['UserId']:_0x539de8[_0xb608('0xc')]['id'];this[_0xb608('0x25')]=_0x539de8['VoiceQueueId'];this['originatecalleridnum']='';this[_0xb608('0x26')]='';}Action['prototype']['getCaller']=function(){return util[_0xb608('0xd')](_0xb608('0x27'),this[_0xb608('0xe')],this[_0xb608('0x28')]);};module[_0xb608('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index ec8689b..a357b24 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 _0xd13e=['SIP/%s','unmonitored','execRun','unlock','unlockContact','disableContact','getContactPreview','recallme','validateContact','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','Trunk\x20not\x20work','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialCutDigit','phone','substring','trim','getCallerId','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','logLookAgent','clone','response','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','isUndefined','transfer','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','md5','../../../config/environment','preview','../../../config/logger','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','originateresponse','bind','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','type','outbound','name','strategy','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','message','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','callerid','Interval','stringify','voice_queue:save','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice:queue:%s','voice_queue_presence:remove','sendMessageOneNotActive','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','syncCampaigns','clockClearZombieChannels','hasOwnProperty','booked','clearZombieChannels','setMessage','dialPreviewAutoRecallMe','clearZombieChannel','enqueue','isNil','info','[clearZombieChannels][talking]','Queue','originated:\x20','queue','dialAnswer','pick','contactId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','[action]','size','recallMe','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','rescheduleContactInQueue','createBody','createCustomerHistory','logCustomer','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','totalGlobal','NoSuchNumber','emit','custom:agentnosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','responsetime','[syncHangup][talking][increment]','uniqueid','pTalking:\x20','custom:agentconnect','buildObj','acw','custom:agentConnectPreview','custom:agentcomplete','complete','answered','decrementTalkink','countglobal','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','\x20Queue','BUSY','countbusyretry','Busy','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','dialBusyMaxRetry','dialBusyRetryFrequency','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','noanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','Congestion','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','CANCEL','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','Abandoned','countabandonedetry','dialAbandonedMaxRety','[callProgressDetectingCustomer][logAbandoned]','cause-txt','amd','[callProgressDetectingCustomer][hangupInAMD]','Global','dialstatus','custom:amd','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List'];(function(_0x356cf9,_0x22e533){var _0x58ba1d=function(_0x4793fd){while(--_0x4793fd){_0x356cf9['push'](_0x356cf9['shift']());}};_0x58ba1d(++_0x22e533);}(_0xd13e,0x193));var _0xed13=function(_0xf8d461,_0xa0eb1e){_0xf8d461=_0xf8d461-0x0;var _0x1253cc=_0xd13e[_0xf8d461];return _0x1253cc;};'use strict';var util=require(_0xed13('0x0'));var _=require(_0xed13('0x1'));var BPromise=require(_0xed13('0x2'));var uuid=require(_0xed13('0x3'));var moment=require('moment');var md5=require(_0xed13('0x4'));var Redis=require('ioredis');var config=require(_0xed13('0x5'));var logger=require('../../../config/logger')(_0xed13('0x6'));var loggerAction=require(_0xed13('0x7'))('actionPreview');var ami=require('../ami');var rpcDb=require('./rpcDb');var Action=require(_0xed13('0x8'));var ut=require(_0xed13('0x9'));config[_0xed13('0xa')]=_[_0xed13('0xb')](config[_0xed13('0xa')],{'host':_0xed13('0xc'),'port':0x18eb});var io=require(_0xed13('0xd'))(new Redis(config[_0xed13('0xa')]));var Sequence=function(){};Sequence[_0xed13('0xe')]['enqueue']=function(_0x26442d){this[_0xed13('0xf')]=this[_0xed13('0xf')]?this[_0xed13('0xf')][_0xed13('0x10')](_0x26442d):_0x26442d();};function Preview(_0x57f4d4){this[_0xed13('0x11')]=new Sequence();this[_0xed13('0x12')]=_0x57f4d4[_0xed13('0x13')];this[_0xed13('0x14')]=_0x57f4d4[_0xed13('0x14')];this[_0xed13('0x15')]={};this['agents']=_0x57f4d4[_0xed13('0x16')];this['clockClearZombieChannels']=0x0;ami['on'](_0xed13('0x17'),this['syncOriginateResponse'][_0xed13('0x18')](this));ami['on']('hangup',this[_0xed13('0x19')]['bind'](this));ami['on'](_0xed13('0x1a'),this[_0xed13('0x1b')][_0xed13('0x18')](this));ami['on'](_0xed13('0x1c'),this[_0xed13('0x1d')][_0xed13('0x18')](this));ami['on'](_0xed13('0x1e'),this[_0xed13('0x1f')][_0xed13('0x18')](this));ami['on'](_0xed13('0x20'),this[_0xed13('0x21')][_0xed13('0x18')](this));ami['on'](_0xed13('0x22'),this[_0xed13('0x23')][_0xed13('0x18')](this));ami['on'](_0xed13('0x24'),this['syncBlindTransfer']['bind'](this));this[_0xed13('0x25')](this[_0xed13('0x12')]);}function emit(_0x4f455b,_0x40dd86,_0x4a85a3){io['to'](_0x4f455b)['emit'](_0x40dd86,_0x4a85a3);}function emitCampaignPreview(_0x3b5b1e){if(_0x3b5b1e[_0xed13('0x26')]===_0xed13('0x27')){var _0x192d12={'id':_0x3b5b1e['id'],'name':_0x3b5b1e[_0xed13('0x28')],'strategy':_0x3b5b1e[_0xed13('0x29')],'answered':_0x3b5b1e['answered'],'available':_0x3b5b1e['available'],'loggedIn':_0x3b5b1e['loggedIn'],'pTalking':_0x3b5b1e[_0xed13('0x2a')],'sumBillable':_0x3b5b1e[_0xed13('0x2b')],'sumDuration':_0x3b5b1e[_0xed13('0x2c')],'sumHoldTime':_0x3b5b1e[_0xed13('0x2d')]||0x0,'talking':_0x3b5b1e[_0xed13('0x2e')],'total':_0x3b5b1e[_0xed13('0x2f')],'type':_0x3b5b1e[_0xed13('0x26')],'unmanaged':_0x3b5b1e[_0xed13('0x30')],'abandoned':_0x3b5b1e[_0xed13('0x31')],'waiting':_0x3b5b1e[_0xed13('0x32')],'loggedInDb':_0x3b5b1e[_0xed13('0x33')],'dialActive':_0x3b5b1e[_0xed13('0x34')],'dialMethod':_0x3b5b1e[_0xed13('0x35')],'dialOriginateCallerIdName':_0x3b5b1e[_0xed13('0x36')],'dialOriginateCallerIdNumber':_0x3b5b1e['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x3b5b1e['dialOriginateTimeout'],'dialPrefix':_0x3b5b1e[_0xed13('0x37')],'outboundAnswerAgiCallsDay':_0x3b5b1e[_0xed13('0x38')],'outboundAnswerCallsDay':_0x3b5b1e['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x3b5b1e[_0xed13('0x39')],'outboundBusyCallsDay':_0x3b5b1e[_0xed13('0x3a')],'outboundCongestionCallsDay':_0x3b5b1e['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x3b5b1e[_0xed13('0x3b')],'outboundDropCallsDayCallersExit':_0x3b5b1e[_0xed13('0x3c')],'outboundDropCallsDayTimeout':_0x3b5b1e[_0xed13('0x3d')],'outboundNoAnswerCallsDay':_0x3b5b1e['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x3b5b1e[_0xed13('0x3e')],'outboundOriginateFailureCallsDay':_0x3b5b1e[_0xed13('0x3f')],'outboundReCallsDay':_0x3b5b1e['outboundReCallsDay'],'outboundRejectCallsDay':_0x3b5b1e[_0xed13('0x40')],'outboundUnknownCallsDay':_0x3b5b1e[_0xed13('0x41')],'outboundAbandonedCallsDay':_0x3b5b1e['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x3b5b1e[_0xed13('0x42')],'predictiveIntervalAvgHoldtime':_0x3b5b1e[_0xed13('0x43')],'predictiveIntervalAvgTalktime':_0x3b5b1e[_0xed13('0x44')],'predictiveIntervalDroppedCallsCallersExit':_0x3b5b1e[_0xed13('0x45')],'predictiveIntervalDroppedCallsTimeout':_0x3b5b1e[_0xed13('0x46')],'predictiveIntervalErlangCalls':_0x3b5b1e[_0xed13('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x3b5b1e[_0xed13('0x48')],'predictiveIntervalHitRate':_0x3b5b1e['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x3b5b1e[_0xed13('0x49')],'predictiveIntervalPauses':_0x3b5b1e['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x3b5b1e['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x3b5b1e[_0xed13('0x4a')],'message':_0x3b5b1e[_0xed13('0x4b')],'originated':_0x3b5b1e[_0xed13('0x4c')],'erlangCalls':_0x3b5b1e['erlangCalls'],'erlangCallToSecond':_0x3b5b1e[_0xed13('0x4d')],'erlangAbandonmentRate':_0x3b5b1e[_0xed13('0x4e')],'erlangBusyFactor':_0x3b5b1e[_0xed13('0x4f')],'startPredictive':_0x3b5b1e['startPredictive'],'startProgressive':_0x3b5b1e[_0xed13('0x50')]};if(_0x3b5b1e[_0xed13('0x51')]){_0x192d12[_0xed13('0x51')]={'id':_0x3b5b1e[_0xed13('0x51')]['id'],'name':_0x3b5b1e['Trunk'][_0xed13('0x28')],'active':_0x3b5b1e[_0xed13('0x51')][_0xed13('0x52')],'callerid':_0x3b5b1e[_0xed13('0x51')][_0xed13('0x53')]};}if(_0x3b5b1e[_0xed13('0x54')]){_0x192d12[_0xed13('0x54')]={'id':_0x3b5b1e[_0xed13('0x54')]['id'],'name':_0x3b5b1e[_0xed13('0x54')][_0xed13('0x28')]};}var _0x5a09e4=md5(JSON[_0xed13('0x55')](_0x192d12));if(_0x3b5b1e[_0xed13('0x4')]!==_0x5a09e4){_0x3b5b1e['md5']=_0x5a09e4;emit(util['format']('voice:queue:%s',_0x192d12[_0xed13('0x28')]),_0xed13('0x56'),_0x192d12);}}}function emitVoiceQueueChannelRemove(_0x53df17){logger['info'](_0xed13('0x57'),JSON[_0xed13('0x55')](_0x53df17));emit(util[_0xed13('0x58')](_0xed13('0x59'),_0x53df17[_0xed13('0x28')]),'voice_queue_channel:remove',_0x53df17);io['emit'](_0xed13('0x5a'),_0x53df17);}function notSendMessagesQueue(_0x487cd0){if(_0x487cd0[_0xed13('0x5b')]){if(_0x487cd0['originated']===0x0&&_0x487cd0[_0xed13('0x2a')]===0x0){_0x487cd0['sendMessageOneNotActive']=![];_0x487cd0['available']=0x0;_0x487cd0['paused']=0x0;_0x487cd0[_0xed13('0x4b')]=_0xed13('0x5c');ut[_0xed13('0x5d')](_0xed13('0x5e'),_0x487cd0[_0xed13('0x28')]+'\x20is\x20not\x20active');}else{_0x487cd0[_0xed13('0x4b')]=_0xed13('0x5f');ut[_0xed13('0x5d')](_0xed13('0x5e'),_0x487cd0[_0xed13('0x28')]+'\x20is\x20disactive');}emitCampaignPreview(_0x487cd0);}}Preview[_0xed13('0xe')][_0xed13('0x25')]=function(){var _0x24f4ba=this;setInterval(function(){_0x24f4ba[_0xed13('0x60')]();},0x7cf);};Preview[_0xed13('0xe')][_0xed13('0x60')]=function(){var _0x535de7=this[_0xed13('0x12')];this[_0xed13('0x61')]+=0x1;for(var _0x4686f1 in _0x535de7){if(_0x535de7[_0xed13('0x62')](_0x4686f1)&&(_0x535de7[_0x4686f1][_0xed13('0x35')]===_0xed13('0x6')||_0x535de7[_0x4686f1][_0xed13('0x35')]===_0xed13('0x63'))&&_0x535de7[_0x4686f1][_0xed13('0x26')]===_0xed13('0x27')){if(this[_0xed13('0x61')]>0x7){this[_0xed13('0x61')]=0x0;this[_0xed13('0x64')]();}}if(_0x535de7[_0xed13('0x62')](_0x4686f1)&&_0x535de7[_0x4686f1]['dialMethod']===_0xed13('0x6')&&_0x535de7[_0x4686f1][_0xed13('0x26')]==='outbound'){if(_0x535de7[_0x4686f1][_0xed13('0x34')]){this[_0xed13('0x65')](_0x535de7[_0x4686f1]);if(_0x535de7[_0x4686f1][_0xed13('0x66')])this['recallMe'](_0x535de7[_0x4686f1]);}else{notSendMessagesQueue(_0x535de7[_0x4686f1]);}}}};Preview[_0xed13('0xe')][_0xed13('0x67')]=function(_0x3ba48c){var _0x5c8c1a=this;this['sequence'][_0xed13('0x68')](function(){if(!_[_0xed13('0x69')](_0x5c8c1a['actions'][_0x3ba48c])){loggerAction[_0xed13('0x6a')](_0xed13('0x6b'),_0x3ba48c,_0xed13('0x6c'),_0x5c8c1a[_0xed13('0x15')][_0x3ba48c]['queue'],_0xed13('0x6d'),JSON[_0xed13('0x55')](_0x5c8c1a[_0xed13('0x12')][_0x5c8c1a[_0xed13('0x15')][_0x3ba48c]['queue']][_0xed13('0x4c')]),'pTalking:\x20',JSON[_0xed13('0x55')](_0x5c8c1a['campaignsPreview'][_0x5c8c1a['actions'][_0x3ba48c][_0xed13('0x6e')]][_0xed13('0x2a')]),JSON['stringify'](_0x5c8c1a[_0xed13('0x15')][_0x3ba48c][_0xed13('0x6f')]),JSON[_0xed13('0x55')](_[_0xed13('0x70')](_0x5c8c1a['actions'][_0x3ba48c],[_0xed13('0x71'),'UserId',_0xed13('0x72'),_0xed13('0x73')])));return ami[_0xed13('0x74')]({'action':_0xed13('0x75'),'channel':_0x5c8c1a[_0xed13('0x15')][_0x3ba48c][_0xed13('0x76')]})[_0xed13('0x77')](function(_0x35c934){if(_0x35c934['message']===_0xed13('0x78')){setTimeout(function(){if(_0x5c8c1a[_0xed13('0x15')][_0x3ba48c]){ut[_0xed13('0x79')](_0x5c8c1a[_0xed13('0x12')][_0x5c8c1a['actions'][_0x3ba48c][_0xed13('0x6e')]],'[clearZombieChannel]');if(_0x5c8c1a[_0xed13('0x15')][_0x3ba48c]['dialAnswer']===!![]){ut['decrementTalkink'](_0x5c8c1a['campaignsPreview'][_0x5c8c1a[_0xed13('0x15')][_0x3ba48c][_0xed13('0x6e')]],_0xed13('0x7a'));ut['loggerError'](_0xed13('0x7b')+_0x3ba48c,_0x5c8c1a[_0xed13('0x15')][_0x3ba48c][_0xed13('0x6e')]);}ut[_0xed13('0x7c')](_0xed13('0x7d')+_0x3ba48c,_0x5c8c1a['actions'][_0x3ba48c][_0xed13('0x6e')]);delete _0x5c8c1a[_0xed13('0x15')][_0x3ba48c];}},0x2328);}});}});};Preview[_0xed13('0xe')][_0xed13('0x64')]=function(){var _0x5eff1b=this;loggerAction[_0xed13('0x6a')](_0xed13('0x7e'),_[_0xed13('0x7f')](this[_0xed13('0x15')]));for(var _0x170752 in this[_0xed13('0x15')]){if(_0x5eff1b[_0xed13('0x15')]['hasOwnProperty'](_0x170752)){_0x5eff1b[_0xed13('0x67')](_0x170752);}}};Preview['prototype'][_0xed13('0x80')]=function(_0x5c83f3){var _0x1b736f=this;rpcDb[_0xed13('0x81')](_0x5c83f3['id'],ut[_0xed13('0x82')](this[_0xed13('0x16')]))[_0xed13('0x83')](function(_0x50d211){if(!_['isNil'](_0x50d211)){for(var _0x31907c=0x0;_0x31907c<_0x50d211[_0xed13('0x84')];_0x31907c+=0x1){if(ut[_0xed13('0x85')](_0x50d211[_0x31907c][_0xed13('0x86')])<_0x5c83f3[_0xed13('0x87')]*0x3c){if(_0x50d211[_0x31907c][_0xed13('0x88')]&&!_0x50d211[_0x31907c][_0xed13('0x88')][_0xed13('0x89')]){_0x1b736f[_0xed13('0x8a')](_0x50d211[_0x31907c]['id'])['then'](ut['logger2']('[RecallMe]'))[_0xed13('0x77')](ut[_0xed13('0x8b')](_0xed13('0x8c')));}else{rpcDb['disableContact'](_0x50d211[_0x31907c]['id']);}}else{var _0x4ac5d4=new Action(_0x50d211[_0x31907c],_0x5c83f3);_0x4ac5d4[_0xed13('0x8d')]=moment()[_0xed13('0x58')](_0xed13('0x8e'));_0x5c83f3['outboundReCallsDay']+=0x1;ut['logCustomer'](_0x4ac5d4,0x17,'RecallInQueue');if(_0x5c83f3['dialRecallInQueue']){rpcDb[_0xed13('0x8f')](ut[_0xed13('0x90')](_0x50d211[_0x31907c]));rpcDb[_0xed13('0x91')](_0x4ac5d4,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0xed13('0x92')](_0x4ac5d4,0x16,_0xed13('0x93'));rpcDb['createCustomerHistory'](_0x4ac5d4,_0xed13('0x94'));rpcDb[_0xed13('0x95')](_0x4ac5d4,_0xed13('0x94'));}}}}})[_0xed13('0x77')](ut[_0xed13('0x8b')](_0xed13('0x96')));};Preview[_0xed13('0xe')][_0xed13('0x65')]=function(_0x418419){_0x418419['sendMessageOneNotActive']=!![];if(ut[_0xed13('0x97')](_0x418419[_0xed13('0x98')])){_0x418419[_0xed13('0x4b')]=_0xed13('0x99');}else if(!ut['isActive'](_0x418419['dialActive'])){_0x418419['message']=_0xed13('0x5c');}else if(!this[_0xed13('0x9a')](_0x418419[_0xed13('0x51')])){if(!this[_0xed13('0x9a')](_0x418419[_0xed13('0x9b')])){_0x418419[_0xed13('0x4b')]=_0xed13('0x9c');}else{_0x418419[_0xed13('0x4b')]=_0xed13('0x9d');}}else{_0x418419[_0xed13('0x4b')]=_0xed13('0x9d');}emitCampaignPreview(_0x418419);};Preview[_0xed13('0xe')][_0xed13('0x9e')]=function(_0x2e3307,_0x451995,_0x2aac1c){var _0x520c94=this;var _0x90b96c=this[_0xed13('0x15')][_0x451995];var _0x46b854=this[_0xed13('0x12')][_0x90b96c[_0xed13('0x6e')]];var _0x1fb178;if(_0x46b854){switch(_0x2aac1c){case'1':_0x46b854[_0xed13('0x3e')]+=0x1;_0x90b96c['countnosuchnumberretry']+=0x1;_0x90b96c['countglobal']=ut[_0xed13('0x9f')](_0x90b96c);ut[_0xed13('0x92')](_0x90b96c,0x0,_0xed13('0xa0'));ami[_0xed13('0xa1')](_0xed13('0xa2'),ut['buildObj'](_0x90b96c,'nosuchnumber'));rpcDb[_0xed13('0x91')](_0x90b96c,_0xed13('0xa3'));if(ut[_0xed13('0x9f')](_0x90b96c)>=_0x46b854[_0xed13('0xa4')]){_0x1fb178=ut[_0xed13('0xa5')](_0x90b96c,0xf,'Global');rpcDb[_0xed13('0x95')](_0x1fb178,_0xed13('0xa6'));}else{if(_0x90b96c[_0xed13('0xa7')]>=_0x46b854[_0xed13('0xa8')]){rpcDb[_0xed13('0x95')](_0x90b96c,_0xed13('0xa6'));}else{rpcDb[_0xed13('0xa9')](ut[_0xed13('0xaa')](_0x90b96c,_0xed13('0xa7'),_0x46b854[_0xed13('0xab')]),_0x90b96c[_0xed13('0xac')],_0x90b96c[_0xed13('0xad')]);}}delete this[_0xed13('0x15')][_0x2e3307[_0xed13('0xae')]];break;case'ANSWER':var _0x134463=moment()[_0xed13('0x58')](_0xed13('0x8e'));_0x90b96c[_0xed13('0xaf')]=_0x134463;_0x90b96c['answertime']=_0x134463;_0x90b96c['dialAnswer']=!![];_0x46b854[_0xed13('0x2a')]+=0x1;logger['info'](_0xed13('0xb0'),_0x90b96c[_0xed13('0xb1')],'\x20Queue',_0x46b854['name'],_0xed13('0xb2'),_0x46b854[_0xed13('0x2a')]);ami[_0xed13('0xa1')](_0xed13('0xb3'),ut[_0xed13('0xb4')](_0x90b96c,'connect',this[_0xed13('0x12')][_0x90b96c[_0xed13('0x6e')]]));if(_0x46b854[_0xed13('0xb5')]){ami[_0xed13('0xa1')](_0xed13('0xb6'),ut['buildAcw'](_0x90b96c));}break;case'16':ami[_0xed13('0xa1')](_0xed13('0xb7'),ut[_0xed13('0xb4')](_0x90b96c,'complete',this[_0xed13('0x12')][_0x90b96c[_0xed13('0x6e')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x90b96c,_0xed13('0xb8')));_0x46b854['outboundAnswerCallsDay']+=0x1;_0x46b854['total']+=0x1;_0x46b854[_0xed13('0xb9')]+=0x1;ut[_0xed13('0xba')](_0x46b854,'[16]');_0x90b96c[_0xed13('0xbb')]=ut[_0xed13('0x9f')](_0x90b96c);ut[_0xed13('0x92')](_0x90b96c,0x4,_0xed13('0xbc'));rpcDb[_0xed13('0x91')](_0x90b96c,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xed13('0x95')](_0x90b96c,_0xed13('0xbd'));rpcDb[_0xed13('0xbe')](_0x90b96c);_0x46b854[_0xed13('0x2c')]+=_0x90b96c['talktime'];_0x46b854[_0xed13('0x2b')]+=_0x90b96c[_0xed13('0xbf')];logger[_0xed13('0x6a')](_0xed13('0xc0'),_0x90b96c[_0xed13('0xb1')],_0xed13('0xc1'),_0x46b854['name'],_0xed13('0xb2'),_0x46b854[_0xed13('0x2a')]);delete this['actions'][_0x2e3307['linkedid']];break;case _0xed13('0xc2'):_0x46b854[_0xed13('0x3a')]+=0x1;_0x90b96c[_0xed13('0xc3')]+=0x1;_0x90b96c[_0xed13('0xbb')]=ut[_0xed13('0x9f')](_0x90b96c);ut[_0xed13('0x92')](_0x90b96c,0x5,_0xed13('0xc4'));ami['emit'](_0xed13('0xc5'),ut['buildObj'](_0x90b96c,'busy'));rpcDb[_0xed13('0x91')](_0x90b96c,_0xed13('0xc6'));if(ut[_0xed13('0x9f')](_0x90b96c)>=_0x46b854[_0xed13('0xa4')]){_0x1fb178=ut[_0xed13('0xa5')](_0x90b96c,0xf,'Global');rpcDb[_0xed13('0x95')](_0x1fb178,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x90b96c['countbusyretry']>=_0x46b854[_0xed13('0xc7')]){rpcDb['createCustomerFinal'](_0x90b96c,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xed13('0xa9')](ut[_0xed13('0xaa')](_0x90b96c,_0xed13('0xc3'),_0x46b854[_0xed13('0xc8')]),_0x90b96c[_0xed13('0xac')],_0x90b96c[_0xed13('0xad')]);}}break;case _0xed13('0xc9'):_0x46b854[_0xed13('0xca')]+=0x1;_0x90b96c[_0xed13('0xcb')]+=0x1;_0x90b96c[_0xed13('0xbb')]=ut['totalGlobal'](_0x90b96c);ut['logCustomer'](_0x90b96c,0x3,'NoAnswer');ami[_0xed13('0xa1')]('custom:agentnoanswer',ut['buildObj'](_0x90b96c,_0xed13('0xcc')));rpcDb[_0xed13('0x91')](_0x90b96c,_0xed13('0xcd'));if(ut[_0xed13('0x9f')](_0x90b96c)>=_0x46b854['dialGlobalMaxRetry']){_0x1fb178=ut[_0xed13('0xa5')](_0x90b96c,0xf,'Global');rpcDb[_0xed13('0x95')](_0x1fb178,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x90b96c[_0xed13('0xcb')]>=_0x46b854[_0xed13('0xce')]){rpcDb['createCustomerFinal'](_0x90b96c,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb['rescheduleContact'](ut[_0xed13('0xaa')](_0x90b96c,_0xed13('0xcb'),_0x46b854[_0xed13('0xcf')]),_0x90b96c[_0xed13('0xac')],_0x90b96c['activeContact']);}}break;case'CONGESTION':_0x46b854['outboundCongestionCallsDay']+=0x1;_0x90b96c['countcongestionretry']+=0x1;_0x90b96c[_0xed13('0xbb')]=ut[_0xed13('0x9f')](_0x90b96c);ut['logCustomer'](_0x90b96c,0x8,_0xed13('0xd0'));ami[_0xed13('0xa1')](_0xed13('0xd1'),ut['buildObj'](_0x90b96c,'congestion'));rpcDb[_0xed13('0x91')](_0x90b96c,_0xed13('0xd2'));if(ut[_0xed13('0x9f')](_0x90b96c)>=_0x46b854[_0xed13('0xa4')]){_0x1fb178=ut['cloneAction'](_0x90b96c,0xf,'Global');rpcDb['createCustomerFinal'](_0x1fb178,_0xed13('0xd3'));}else{if(_0x90b96c[_0xed13('0xd4')]>=_0x46b854[_0xed13('0xd5')]){rpcDb[_0xed13('0x95')](_0x90b96c,_0xed13('0xd2'));}else{rpcDb[_0xed13('0xa9')](ut[_0xed13('0xaa')](_0x90b96c,_0xed13('0xd4'),_0x46b854['dialBusyRetryFrequency']),_0x90b96c[_0xed13('0xac')],_0x90b96c[_0xed13('0xad')]);}}break;case _0xed13('0xd6'):_0x46b854[_0xed13('0x40')]+=0x1;_0x90b96c['countagentrejectretry']+=0x1;_0x90b96c[_0xed13('0xbb')]=ut[_0xed13('0x9f')](_0x90b96c);ut['logCustomer'](_0x90b96c,0x14,_0xed13('0xd7'));ami[_0xed13('0xa1')](_0xed13('0xd8'),ut[_0xed13('0xb4')](_0x90b96c,_0xed13('0xd9')));rpcDb[_0xed13('0x91')](_0x90b96c,_0xed13('0xda'));if(ut[_0xed13('0x9f')](_0x90b96c)>=_0x46b854[_0xed13('0xa4')]){_0x1fb178=ut[_0xed13('0xa5')](_0x90b96c,0x14,_0xed13('0xd7'));rpcDb['createCustomerFinal'](_0x1fb178,_0xed13('0xdb'));}else{if(_0x90b96c['countagentrejectretry']>=_0x46b854[_0xed13('0xdc')]){rpcDb[_0xed13('0x95')](_0x90b96c,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0xed13('0xa9')](ut[_0xed13('0xaa')](_0x90b96c,'countagentrejectretry',_0x46b854[_0xed13('0xdd')]),_0x90b96c[_0xed13('0xac')],_0x90b96c[_0xed13('0xad')]);}}break;case _0xed13('0xde'):_0x46b854[_0xed13('0xdf')]+=0x1;_0x90b96c['countabandonedretry']+=0x1;_0x90b96c[_0xed13('0xbb')]=ut[_0xed13('0x9f')](_0x90b96c);ut['logCustomer'](_0x90b96c,0xb,_0xed13('0xe0'));rpcDb[_0xed13('0x91')](_0x90b96c,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0xed13('0x9f')](_0x90b96c)>=_0x46b854['dialGlobalMaxRetry']){_0x1fb178=ut[_0xed13('0xa5')](_0x90b96c,0xf,'Global');rpcDb['createCustomerFinal'](_0x1fb178,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x90b96c[_0xed13('0xe1')]>=_0x46b854[_0xed13('0xe2')]){rpcDb['createCustomerFinal'](_0x90b96c,_0xed13('0xe3'));}else{rpcDb[_0xed13('0xa9')](ut['scheduledAt'](_0x90b96c,'countabandonedretry',_0x46b854['dialAbandonedRetryFrequency']),_0x90b96c['unlockAgent'],_0x90b96c[_0xed13('0xad')]);}}break;case'18':_0x46b854[_0xed13('0x41')]+=0x1;_0x90b96c['countmachineretry']+=0x1;_0x90b96c['countglobal']=ut['totalGlobal'](_0x90b96c);ut[_0xed13('0x92')](_0x90b96c,0x12,_0x2e3307[_0xed13('0xe4')]||_0x2e3307['dialstatus']);ami['emit']('custom:amd',ut[_0xed13('0xb4')](_0x90b96c,_0xed13('0xe5')));rpcDb['createCustomerHistory'](_0x90b96c,_0xed13('0xe6'));if(ut[_0xed13('0x9f')](_0x90b96c)>=_0x46b854[_0xed13('0xa4')]){_0x1fb178=ut[_0xed13('0xa5')](_0x90b96c,0xf,_0xed13('0xe7'));rpcDb[_0xed13('0x95')](_0x1fb178,_0xed13('0xe6'));}else{rpcDb[_0xed13('0x95')](_0x90b96c,_0xed13('0xe6'));}delete this[_0xed13('0x15')][_0x2e3307[_0xed13('0xae')]];break;case'19':_0x46b854[_0xed13('0x41')]+=0x1;_0x90b96c[_0xed13('0xbb')]=ut[_0xed13('0x9f')](_0x90b96c);ut['logCustomer'](_0x90b96c,0x13,_0x2e3307[_0xed13('0xe4')]||_0x2e3307[_0xed13('0xe8')]);ami[_0xed13('0xa1')](_0xed13('0xe9'),ut[_0xed13('0xb4')](_0x90b96c,_0xed13('0xe5')));rpcDb[_0xed13('0x91')](_0x90b96c,_0xed13('0xea'));if(ut[_0xed13('0x9f')](_0x90b96c)>=_0x46b854[_0xed13('0xa4')]){_0x1fb178=ut[_0xed13('0xa5')](_0x90b96c,0xf,_0xed13('0xe7'));rpcDb[_0xed13('0x95')](_0x1fb178,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0xed13('0x95')](_0x90b96c,_0xed13('0xea'));}delete this[_0xed13('0x15')][_0x2e3307['linkedid']];break;default:if(_0x90b96c['dialAnswer']){ut['decrementTalkink'](_0x46b854,'[default]');ut[_0xed13('0x7c')](_0xed13('0xeb')+_0x46b854[_0xed13('0x28')],_0x2e3307);}_0x46b854[_0xed13('0x41')]+=0x1;_0x90b96c[_0xed13('0xbb')]=ut[_0xed13('0x9f')](_0x90b96c);ut[_0xed13('0x92')](_0x90b96c,0xc,_0x2e3307[_0xed13('0xe4')]||_0x2e3307[_0xed13('0xe8')]);rpcDb['createCustomerHistory'](_0x90b96c,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0xed13('0x9f')](_0x90b96c)>=_0x46b854[_0xed13('0xa4')]){_0x1fb178=ut['cloneAction'](_0x90b96c,0xf,_0xed13('0xe7'));rpcDb[_0xed13('0x95')](_0x1fb178,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb['createCustomerFinal'](_0x90b96c,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x2e3307[_0xed13('0xae')]];}if(!(_0x90b96c[_0xed13('0x6f')]&&_0x2aac1c==='16')){ut[_0xed13('0x79')](_0x46b854,_0xed13('0xec'));logger[_0xed13('0x6a')](_0xed13('0xed'),_0x90b96c[_0xed13('0xb1')],_0xed13('0xc1'),_0x46b854[_0xed13('0x28')],_0xed13('0x6d'),_0x46b854[_0xed13('0x4c')]);}if(_0x2aac1c!=='ANSWER'){delete this[_0xed13('0x15')][_0x2e3307[_0xed13('0xae')]];delete this[_0xed13('0x15')][_0x2e3307[_0xed13('0xee')]];}}};Preview[_0xed13('0xe')][_0xed13('0xef')]=function(_0x29e4b7,_0x2bd62a,_0x5ed910){if(_['isUndefined'](_0x2bd62a)&&_0xed13('0xf0')!==typeof _0x2bd62a){return;}if(_['isUndefined'](_0x5ed910)&&_0xed13('0xf0')!==typeof _0x5ed910){return;}switch(_0x5ed910[_0xed13('0xf1')]){case'0':ut['logAgent'](_0x29e4b7,0x0,'NoSuchNumber');rpcDb[_0xed13('0xf2')](_0x29e4b7,_0xed13('0xf3'));break;case'3':ut[_0xed13('0xf4')](_0x29e4b7,0x3,_0xed13('0xf5'));rpcDb[_0xed13('0xf2')](_0x29e4b7,_0xed13('0xf6'));break;case'5':ut[_0xed13('0xf4')](_0x29e4b7,0x5,_0xed13('0xc4'));rpcDb[_0xed13('0xf2')](_0x29e4b7,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x29e4b7,0x8,_0xed13('0xd0'));rpcDb[_0xed13('0xf2')](_0x29e4b7,_0xed13('0xf7'));break;case'22':ut[_0xed13('0xf4')](_0x29e4b7,0x16,_0xed13('0xf8'));rpcDb['createAgentHistory'](_0x29e4b7,_0xed13('0xf9'));break;default:ut['logAgent'](_0x29e4b7,0xc,_0x5ed910[_0xed13('0xf1')]);rpcDb[_0xed13('0xf2')](_0x29e4b7,'[callProgressDetectingAgent][logCongestion]');}ut['updateOriginated'](_0x2bd62a,_0xed13('0xfa'));logger[_0xed13('0x6a')](_0xed13('0xfb'),_0x29e4b7[_0xed13('0xb1')],_0xed13('0xc1'),_0x2bd62a[_0xed13('0x28')],'originated:\x20',_0x2bd62a[_0xed13('0x4c')]);delete this[_0xed13('0x15')][_0x29e4b7[_0xed13('0xb1')]];};Preview[_0xed13('0xe')][_0xed13('0xfc')]=function(_0xf587df,_0xc51ccb,_0x4bcc5f,_0x3723fa,_0x255a46){var _0x307e9b=this;return new BPromise(function(_0x3e117e,_0x2642de){if(_[_0xed13('0x69')](_0xc51ccb)||_[_0xed13('0x69')](_0xc51ccb['Contact'])||_['isNil'](_0xc51ccb[_0xed13('0xfd')]['phone'])||_[_0xed13('0x69')](_0xc51ccb['VoiceQueueId'])){_0x2642de(ut['message'](_0xed13('0xfe'),_0x3723fa,_0x255a46));return;}var _0x328f93=uuid['v4']();var _0x14b95d=_0x307e9b[_0xed13('0x12')][_0xc51ccb[_0xed13('0x6c')][_0xed13('0x28')]];var _0x3c3046=_0x4bcc5f?_0x307e9b[_0xed13('0x16')][_0x4bcc5f]['id']:undefined;_0x307e9b['actions'][_0x328f93]=new Action(_0xc51ccb,_0x14b95d,_0x328f93,_0x4bcc5f,_0x3c3046);var _0x29ab59=_0x307e9b[_0xed13('0x15')][_0x328f93];_0x29ab59['unlockAgent']=_0x3723fa;_0x29ab59[_0xed13('0xad')]=_0x255a46;_0x29ab59[_0xed13('0xff')]=_0x4bcc5f;if(_[_0xed13('0x100')](_0xf587df)){_0x307e9b['execCall'](_0x29ab59,_0x14b95d,_0xc51ccb,_0x4bcc5f)[_0xed13('0x83')](function(_0x4a44cb){logger[_0xed13('0x6a')](_0xed13('0x101'),_0xed13('0x102')+_0x29ab59[_0xed13('0x6e')]+_0xed13('0x103')+_0x29ab59[_0xed13('0x104')],JSON[_0xed13('0x55')](_0x4a44cb));ami['emit']('custom:agentcalled',ut[_0xed13('0xb4')](_0x29ab59,_0xed13('0x105'),_0x307e9b[_0xed13('0x12')][_0x29ab59[_0xed13('0x6e')]]));_0x3e117e(ut['message'](_0xed13('0x106')));})[_0xed13('0x77')](function(_0x59c9d5){ut[_0xed13('0x5d')](_0xed13('0x107'),_0x59c9d5);_0x2642de(ut[_0xed13('0x4b')](_0xed13('0x108'),_0x3723fa,_0x255a46));});}else{_0x14b95d[_0xed13('0x39')]+=0x1;ut[_0xed13('0x109')](_0x29ab59);rpcDb[_0xed13('0x10a')](_0x29ab59,_0xed13('0x10b'));delete _0x307e9b[_0xed13('0x15')][_0x328f93];_0x2642de(ut[_0xed13('0x4b')](_0xed13('0x10c'),_0x3723fa,_0x255a46));}});};Preview['prototype'][_0xed13('0x9a')]=function(_0x5981e5){return!_[_0xed13('0x69')](_0x5981e5)&&!_['isNil'](_0x5981e5[_0xed13('0x28')])&&!_['isNil'](_0x5981e5[_0xed13('0x52')])&&_0x5981e5[_0xed13('0x52')]&&!_['isNil'](this['trunks'][util[_0xed13('0x58')](_0xed13('0x10d'),_0x5981e5[_0xed13('0x28')])])&&!_['isNil'](this[_0xed13('0x14')][util[_0xed13('0x58')](_0xed13('0x10d'),_0x5981e5[_0xed13('0x28')])][_0xed13('0x75')])&&(this[_0xed13('0x14')][util[_0xed13('0x58')](_0xed13('0x10d'),_0x5981e5[_0xed13('0x28')])][_0xed13('0x75')]==='reachable'||this[_0xed13('0x14')][util[_0xed13('0x58')]('SIP/%s',_0x5981e5[_0xed13('0x28')])][_0xed13('0x75')]===_0xed13('0x10e'));};Preview[_0xed13('0xe')][_0xed13('0x8a')]=function(_0x401bba,_0x35c903){var _0xc32f66=this;return new BPromise(function(_0x517382,_0x1a3ef3){_0xc32f66[_0xed13('0x10f')](_0x401bba,_0x35c903)[_0xed13('0x83')](function(_0x2a6b68){_0x517382(_[_0xed13('0x70')](_0x2a6b68,['message']));})[_0xed13('0x77')](function(_0x3384fe){if(_0x3384fe[_0xed13('0x110')]){rpcDb[_0xed13('0x111')](_0x401bba);}if(_0x3384fe[_0xed13('0x52')]){rpcDb[_0xed13('0x112')](_0x401bba);}_0x1a3ef3(_[_0xed13('0x70')](_0x3384fe,['message']));});});};Preview[_0xed13('0xe')]['execRun']=function(_0x2b7085,_0x19d704){var _0x4d0a00=this;return new BPromise(function(_0x2917ec,_0x44321d){var _0x483b4e,_0x1c41e2;rpcDb[_0xed13('0x113')](_0x2b7085)[_0xed13('0x83')](function(_0x3785d1){if(!_[_0xed13('0x69')](_0x3785d1[0x0])){_0x1c41e2=_0x3785d1[0x0][_0xed13('0x114')]?![]:!![];_0x483b4e=_0x3785d1[0x0][_0xed13('0x114')]?!![]:![];_0x483b4e=_0x19d704?!![]:_0x483b4e;}var _0x185dab=_0x4d0a00[_0xed13('0x115')](_0x3785d1);if(_0x185dab['isValid']){rpcDb[_0xed13('0x116')](_[_0xed13('0x70')](_0x3785d1[0x0],[_0xed13('0x72'),_0xed13('0x117')]))['then'](function(_0x2d0f4d){_0x4d0a00['checkInBlack'](_0x2d0f4d,_0x3785d1[0x0],_0x19d704,_0x1c41e2,_0x483b4e)['then'](function(_0x2a602b){_0x2917ec(_0x2a602b);})[_0xed13('0x77')](function(_0x137ec1){_0x44321d(_0x137ec1);});})['catch'](function(_0x1ccd75){ut[_0xed13('0x5d')](_0xed13('0x118'),_0x1ccd75);_0x44321d(ut[_0xed13('0x4b')](_0xed13('0x119'),_0x1c41e2,_0x483b4e));});}else{_0x44321d(ut[_0xed13('0x4b')](_0x185dab[_0xed13('0x4b')],_0x1c41e2,_0x483b4e));}})[_0xed13('0x77')](function(_0x10fc83){ut[_0xed13('0x5d')](_0xed13('0x11a'),_0x10fc83);_0x44321d(ut[_0xed13('0x4b')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0xed13('0xe')][_0xed13('0x115')]=function(_0x27c055){if(_[_0xed13('0x69')](_0x27c055)||_[_0xed13('0x100')](_0x27c055)||!_[_0xed13('0x69')](_0x27c055[0x0][_0xed13('0x88')])&&_['isNil'](_0x27c055[0x0][_0xed13('0x88')]['name'])){ut['logger'](_0xed13('0x11b'),_0x27c055);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x56a48b=this[_0xed13('0x12')][_0x27c055[0x0][_0xed13('0x6c')][_0xed13('0x28')]];_0x56a48b[_0xed13('0x4b')]=_0xed13('0x9d');if(_[_0xed13('0x69')](_0x56a48b)){ut['logger'](_0xed13('0x11c'),_0x56a48b);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0xed13('0x9a')](_0x56a48b[_0xed13('0x51')])){ut['logger'](_0xed13('0x11d'),_0xed13('0x11e')+_0x56a48b[_0xed13('0x28')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xed13('0x9a')](_0x56a48b[_0xed13('0x9b')])){ut[_0xed13('0x5d')](_0xed13('0x11d'),_0x56a48b['name']+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xed13('0x11f')};}}if(!ut[_0xed13('0x120')](_0x56a48b['dialActive'])){ut['logger'](_0xed13('0x121'),_0x56a48b[_0xed13('0x28')]+_0xed13('0x122'));return{'isValid':![],'message':_0xed13('0x11e')+_0x56a48b[_0xed13('0x28')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0xed13('0x123')};};Preview[_0xed13('0xe')][_0xed13('0x124')]=function(_0x29d30a,_0x424af3,_0x522ffd,_0x21474c){var _0x513b90=this;return new BPromise(function(_0x2266e2,_0x2298d5){var _0x4c36bf=_0x29d30a['uniqueid'];var _0x2dbf39=_0x513b90[_0xed13('0x9a')](_0x424af3[_0xed13('0x51')])?util[_0xed13('0x58')](_0xed13('0x125'),_0x424af3[_0xed13('0x51')][_0xed13('0x28')],_[_0xed13('0x69')](_0x424af3[_0xed13('0x37')])?'':_0x424af3['dialPrefix']['trim']()||'',_0x424af3[_0xed13('0x126')]>0x0?_0x522ffd[_0xed13('0xfd')][_0xed13('0x127')][_0xed13('0x128')](_0x424af3[_0xed13('0x126')]):_0x522ffd['Contact'][_0xed13('0x127')]):util['format'](_0xed13('0x125'),_[_0xed13('0x69')](_0x424af3[_0xed13('0x9b')])?_0x424af3['Trunk'][_0xed13('0x28')]:_0x424af3[_0xed13('0x9b')][_0xed13('0x28')],_[_0xed13('0x69')](_0x424af3[_0xed13('0x37')])?'':_0x424af3[_0xed13('0x37')][_0xed13('0x129')]()||'',_0x424af3[_0xed13('0x126')]>0x0?_0x522ffd[_0xed13('0xfd')]['phone'][_0xed13('0x128')](_0x424af3['dialCutDigit']):_0x522ffd[_0xed13('0xfd')][_0xed13('0x127')]);var _0x43dfc9=_0x513b90[_0xed13('0x9a')](_0x424af3[_0xed13('0x51')])?ut[_0xed13('0x12a')](_0x424af3[_0xed13('0x51')][_0xed13('0x53')],_0x424af3[_0xed13('0x36')],_0x424af3[_0xed13('0x12b')]>0x0?ut['getCallerIdRandom'](_0x424af3[_0xed13('0x12c')],_0x424af3[_0xed13('0x12b')]):_0x424af3[_0xed13('0x12c')]):ut[_0xed13('0x12a')](_[_0xed13('0x69')](_0x424af3['TrunkBackup'])?_0x424af3[_0xed13('0x51')][_0xed13('0x53')]:_0x424af3[_0xed13('0x9b')][_0xed13('0x53')],_0x424af3[_0xed13('0x36')],_0x424af3[_0xed13('0x12b')]>0x0?ut[_0xed13('0x12d')](_0x424af3[_0xed13('0x12c')],_0x424af3[_0xed13('0x12b')]):_0x424af3[_0xed13('0x12c')]);if(_0x43dfc9){_0x29d30a[_0xed13('0x12e')]=ut['extractCalleridName'](_0x43dfc9);_0x29d30a[_0xed13('0x12f')]=ut[_0xed13('0x130')](_0x43dfc9);}var _0x2584fc=ut[_0xed13('0x131')](_0x424af3,_0x522ffd,_0x2dbf39,_0x43dfc9,_0x4c36bf,_0x29d30a);_['merge'](_0x29d30a,ut[_0xed13('0x132')](_0x2584fc));_0x29d30a[_0xed13('0x8d')]=moment()[_0xed13('0x58')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0xed13('0x74')](ut[_0xed13('0x133')](_0x29d30a,_0x424af3,_0x2584fc,_0x29d30a[_0xed13('0xad')],_0x21474c))[_0xed13('0x83')](function(_0x345ffa){_0x424af3[_0xed13('0x4c')]+=0x1;logger[_0xed13('0x6a')]('[originated][increment]',_0x4c36bf,'\x20Queue',_0x424af3[_0xed13('0x28')],_0xed13('0x6d'),_0x424af3[_0xed13('0x4c')]);_0x2266e2(_0x345ffa);})[_0xed13('0x77')](function(_0x1a74ed){ut[_0xed13('0xf4')](_0x29d30a,0xe,_0xed13('0x134'));rpcDb['createAgentHistory'](_0x29d30a,_0xed13('0x135'));_0x2298d5(_0x1a74ed);});});};Preview['prototype']['syncNewExten']=function(_0x1498e5){if(this[_0xed13('0x15')][_0x1498e5[_0xed13('0xae')]]){this[_0xed13('0x15')][_0x1498e5['linkedid']]['channel']=_0x1498e5[_0xed13('0x76')];}};Preview[_0xed13('0xe')][_0xed13('0x136')]=function(_0x327e00){var _0x398347=this;var _0x31ec41=this['actions'][_0x327e00['actionid']];if(_0x31ec41){if(_0x31ec41[_0xed13('0xff')]&&this[_0xed13('0x16')][_0x31ec41[_0xed13('0xff')]]){ut[_0xed13('0x137')](_0x31ec41,this['agents'][_0x31ec41[_0xed13('0xff')]]['name'],this[_0xed13('0x16')][_0x31ec41[_0xed13('0xff')]]['id']);}var _0x5833e1=_[_0xed13('0x138')](_0x31ec41);_0x5833e1[_0xed13('0xaf')]=moment()[_0xed13('0x58')]('YYYY-MM-DD\x20HH:mm:ss');var _0x12deae=_0x398347[_0xed13('0x12')][_0x31ec41[_0xed13('0x6e')]];if(ut['isFailure'](_0x327e00[_0xed13('0x139')])){if(_0x31ec41[_0xed13('0xac')]){rpcDb['unlockContact'](_0x31ec41['idContact']);}if(_0x31ec41[_0xed13('0xad')]){rpcDb['disableContact'](_0x31ec41['idContact']);}ami[_0xed13('0xa1')](_0xed13('0x13a'),ut['buildObj'](_0x31ec41,'rejected',this['campaignsPreview'][_0x31ec41['queue']]));this[_0xed13('0xef')](_0x5833e1,_0x12deae,_0x327e00);}else{_0x31ec41[_0xed13('0x8d')]=moment()['format'](_0xed13('0x8e'));ut[_0xed13('0xf4')](_0x5833e1,0x4,_0xed13('0xbc'));rpcDb[_0xed13('0xf2')](_0x5833e1,_0xed13('0x13b'));}}};Preview[_0xed13('0xe')][_0xed13('0x19')]=function(_0x2a31a2){var _0x54b583=this;var _0x579ad0=this[_0xed13('0x15')][_0x2a31a2[_0xed13('0xae')]];var _0x500c85;if(_0x579ad0){_0x500c85=this[_0xed13('0x12')][_0x579ad0[_0xed13('0x6e')]];logger[_0xed13('0x6a')](_0xed13('0x13c'),_0x2a31a2['linkedid'],_0xed13('0xc1'),_0x500c85[_0xed13('0x28')],_0xed13('0xb2'),_0x500c85[_0xed13('0x2a')]);}if(this[_0xed13('0x15')][_0x2a31a2[_0xed13('0xae')]]&&_0x2a31a2[_0xed13('0xae')]!==_0x2a31a2[_0xed13('0xb1')]){if(_0x2a31a2['cause']==='16'&&this[_0xed13('0x15')][_0x2a31a2['linkedid']]['dialAnswer']){this[_0xed13('0x9e')](_0x2a31a2,_0x2a31a2['linkedid'],_0x2a31a2[_0xed13('0x13d')]);}else if(this[_0xed13('0x15')][_0x2a31a2['linkedid']][_0xed13('0x6f')]){logger[_0xed13('0x6a')](_0xed13('0x13e'),_0x2a31a2[_0xed13('0xae')],_0x2a31a2[_0xed13('0x13d')],_0xed13('0xc1'),_0x500c85[_0xed13('0x28')],_0xed13('0xb2'),_0x500c85[_0xed13('0x2a')]);this[_0xed13('0x9e')](_0x2a31a2,_0x2a31a2[_0xed13('0xae')],_0x2a31a2[_0xed13('0x13d')]);}}else if(_0x579ad0&&_[_0xed13('0x69')](_0x579ad0[_0xed13('0x13f')])&&_0x500c85[_0xed13('0x140')]&&_0x2a31a2[_0xed13('0xae')]===_0x2a31a2[_0xed13('0xb1')]&&_[_0xed13('0x69')](_0x2a31a2[_0xed13('0xf1')])&&_0x2a31a2['cause']==='16'&&_0x2a31a2[_0xed13('0x141')]==='6'&&_[_0xed13('0x142')](_0x579ad0[_0xed13('0x143')])){if(_0x579ad0[_0xed13('0xac')]){rpcDb['unlockContact'](_0x579ad0[_0xed13('0x104')]);}if(_0x579ad0[_0xed13('0xad')]){rpcDb['disableContact'](_0x579ad0[_0xed13('0x104')]);}_0x2a31a2[_0xed13('0xf1')]='22';this[_0xed13('0xef')](_0x579ad0,_0x500c85,_0x2a31a2);}else if(_0x579ad0&&_0x579ad0[_0xed13('0x143')]){if(_0x2a31a2[_0xed13('0x13d')]==='16'&&this[_0xed13('0x15')][_0x2a31a2[_0xed13('0xae')]]['dialAnswer']){logger[_0xed13('0x6a')]('[syncHangup][talking][transfer]',_0x2a31a2['linkedid'],_0x2a31a2[_0xed13('0x13d')],'\x20Queue',_0x500c85[_0xed13('0x28')],_0xed13('0xb2'),_0x500c85[_0xed13('0x2a')]);this[_0xed13('0x9e')](_0x2a31a2,_0x2a31a2['linkedid'],_0x2a31a2[_0xed13('0x13d')]);}else if(this[_0xed13('0x15')][_0x2a31a2[_0xed13('0xae')]][_0xed13('0x6f')]){logger['info'](_0xed13('0x13e'),_0x2a31a2[_0xed13('0xae')],_0x2a31a2[_0xed13('0x13d')],_0xed13('0xc1'),_0x500c85[_0xed13('0x28')],_0xed13('0xb2'),_0x500c85[_0xed13('0x2a')]);this['callProgressDetectingCustomer'](_0x2a31a2,_0x2a31a2[_0xed13('0xae')],_0x2a31a2[_0xed13('0x13d')]);}}};Preview[_0xed13('0xe')][_0xed13('0x1d')]=function(_0x441a2d){if(this[_0xed13('0x15')][_0x441a2d[_0xed13('0xee')]]&&_0x441a2d['destlinkedid']!==_0x441a2d[_0xed13('0x144')]){this[_0xed13('0x9e')](_0x441a2d,_0x441a2d[_0xed13('0xee')],_0x441a2d['dialstatus']);}};Preview['prototype'][_0xed13('0x1b')]=function(_0x145f35){if(this[_0xed13('0x15')][_0x145f35[_0xed13('0xae')]]&&_0x145f35[_0xed13('0xae')]!==_0x145f35['uniqueid']&&!this[_0xed13('0x15')][_0x145f35['linkedid']][_0xed13('0x6f')]){if(_0x145f35['cause']==='1'){this[_0xed13('0x9e')](_0x145f35,_0x145f35[_0xed13('0xae')],_0x145f35[_0xed13('0x13d')]);}}};Preview[_0xed13('0xe')][_0xed13('0x145')]=function(_0x42dd30,_0x171311,_0x5311a5){if(this[_0xed13('0x15')][_0x42dd30]){if(_['isNil'](this[_0xed13('0x15')][_0x42dd30][_0xed13('0x146')])){this[_0xed13('0x15')][_0x42dd30][_0xed13('0x146')]={};}this[_0xed13('0x15')][_0x42dd30][_0xed13('0x146')][_0x171311]=_0x5311a5;}};Preview['prototype']['syncVarSet']=function(_0x4c1105){try{if(!_[_0xed13('0x69')](_0x4c1105)){if(ut[_0xed13('0x147')](_[_0xed13('0x148')](_0x4c1105[_0xed13('0x149')])[0x0])){this['addVariable'](_0x4c1105[_0xed13('0xb1')],_[_0xed13('0x148')](_0x4c1105[_0xed13('0x149')])[0x0],_0x4c1105[_0xed13('0x14a')]);}}}catch(_0x3f7493){logger[_0xed13('0x14b')]('[syncVarSet][Preview]',util[_0xed13('0x14c')](_0x3f7493,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0xed13('0x23')]=function(_0x602446){if(_0x602446){if(this[_0xed13('0x15')][_0x602446['transfertargetlinkedid']]){this[_0xed13('0x15')][_0x602446[_0xed13('0x14d')]][_0xed13('0x143')]=!![];}}};Preview[_0xed13('0xe')]['syncBlindTransfer']=function(_0x1c5250){if(_0x1c5250){if(this['actions'][_0x1c5250[_0xed13('0x14e')]]){this[_0xed13('0x15')][_0x1c5250[_0xed13('0x14e')]][_0xed13('0x143')]=!![];}}};module[_0xed13('0x14f')]=Preview; \ No newline at end of file +var _0x5fd1=['../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','defaults','redis','localhost','enqueue','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','syncNewExten','varset','syncVarSet','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','outbound','name','strategy','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','md5','voice_queue:save','info','format','voice_queue_presence:remove','pTalking','sendMessageOneNotActive','paused','message','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','prototype','syncCampaigns','clockClearZombieChannels','hasOwnProperty','booked','type','clearZombieChannels','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','contactId','UserId','VoiceQueueId','Action','status','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','logger2','catch','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','dialGlobalMaxRetry','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','activeContact','linkedid','responsetime','answertime','uniqueid','\x20Queue','custom:agentconnect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','BUSY','countbusyretry','Busy','custom:agentbusy','busy','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','unlockAgent','NOANSWER','countnoanswerretry','NoAnswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','cause-txt','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','custom:amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','callProgressDetectingAgent','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','Contact','phone','lookAgent','isEmpty','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlock','pick','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','Trunk\x20not\x20work','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','substring','dialCutDigit','trim','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','merge','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','channel','actionid','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','syncDialEnd','destlinkedid','destuniqueid','addVariable','variables','filterKey','keys','variable','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfer','transfererlinkedid','exports','util','bluebird','uuid','moment','../../../config/environment'];(function(_0x5e762b,_0x5b760d){var _0x331c85=function(_0x47f11e){while(--_0x47f11e){_0x5e762b['push'](_0x5e762b['shift']());}};_0x331c85(++_0x5b760d);}(_0x5fd1,0x155));var _0x15fd=function(_0x3c87a4,_0x5a4cca){_0x3c87a4=_0x3c87a4-0x0;var _0x1cadd8=_0x5fd1[_0x3c87a4];return _0x1cadd8;};'use strict';var util=require(_0x15fd('0x0'));var _=require('lodash');var BPromise=require(_0x15fd('0x1'));var uuid=require(_0x15fd('0x2'));var moment=require(_0x15fd('0x3'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x15fd('0x4'));var logger=require(_0x15fd('0x5'))(_0x15fd('0x6'));var loggerAction=require('../../../config/logger')(_0x15fd('0x7'));var ami=require(_0x15fd('0x8'));var rpcDb=require(_0x15fd('0x9'));var Action=require(_0x15fd('0xa'));var ut=require(_0x15fd('0xb'));config['redis']=_[_0x15fd('0xc')](config[_0x15fd('0xd')],{'host':_0x15fd('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x15fd('0xd')]));var Sequence=function(){};Sequence['prototype'][_0x15fd('0xf')]=function(_0x250457){this['tail']=this['tail']?this['tail'][_0x15fd('0x10')](_0x250457):_0x250457();};function Preview(_0x2a4d55){this[_0x15fd('0x11')]=new Sequence();this[_0x15fd('0x12')]=_0x2a4d55[_0x15fd('0x13')];this[_0x15fd('0x14')]=_0x2a4d55[_0x15fd('0x14')];this[_0x15fd('0x15')]={};this[_0x15fd('0x16')]=_0x2a4d55['agents'];this['clockClearZombieChannels']=0x0;ami['on']('originateresponse',this[_0x15fd('0x17')][_0x15fd('0x18')](this));ami['on'](_0x15fd('0x19'),this[_0x15fd('0x1a')][_0x15fd('0x18')](this));ami['on'](_0x15fd('0x1b'),this[_0x15fd('0x1c')][_0x15fd('0x18')](this));ami['on']('dialend',this['syncDialEnd'][_0x15fd('0x18')](this));ami['on']('newexten',this[_0x15fd('0x1d')]['bind'](this));ami['on'](_0x15fd('0x1e'),this[_0x15fd('0x1f')][_0x15fd('0x18')](this));ami['on']('attendedtransfer',this[_0x15fd('0x20')][_0x15fd('0x18')](this));ami['on'](_0x15fd('0x21'),this[_0x15fd('0x22')][_0x15fd('0x18')](this));this[_0x15fd('0x23')](this[_0x15fd('0x12')]);}function emit(_0x2f46f1,_0x1b8b9f,_0x1eab55){io['to'](_0x2f46f1)[_0x15fd('0x24')](_0x1b8b9f,_0x1eab55);}function emitCampaignPreview(_0x484db6){if(_0x484db6['type']===_0x15fd('0x25')){var _0x36b21e={'id':_0x484db6['id'],'name':_0x484db6[_0x15fd('0x26')],'strategy':_0x484db6[_0x15fd('0x27')],'answered':_0x484db6[_0x15fd('0x28')],'available':_0x484db6[_0x15fd('0x29')],'loggedIn':_0x484db6[_0x15fd('0x2a')],'pTalking':_0x484db6['pTalking'],'sumBillable':_0x484db6[_0x15fd('0x2b')],'sumDuration':_0x484db6[_0x15fd('0x2c')],'sumHoldTime':_0x484db6[_0x15fd('0x2d')]||0x0,'talking':_0x484db6['talking'],'total':_0x484db6[_0x15fd('0x2e')],'type':_0x484db6['type'],'unmanaged':_0x484db6[_0x15fd('0x2f')],'abandoned':_0x484db6[_0x15fd('0x30')],'waiting':_0x484db6[_0x15fd('0x31')],'loggedInDb':_0x484db6['loggedInDb'],'dialActive':_0x484db6[_0x15fd('0x32')],'dialMethod':_0x484db6[_0x15fd('0x33')],'dialOriginateCallerIdName':_0x484db6[_0x15fd('0x34')],'dialOriginateCallerIdNumber':_0x484db6['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x484db6[_0x15fd('0x35')],'dialPrefix':_0x484db6['dialPrefix'],'outboundAnswerAgiCallsDay':_0x484db6[_0x15fd('0x36')],'outboundAnswerCallsDay':_0x484db6[_0x15fd('0x37')],'outboundBlacklistCallsDay':_0x484db6[_0x15fd('0x38')],'outboundBusyCallsDay':_0x484db6[_0x15fd('0x39')],'outboundCongestionCallsDay':_0x484db6[_0x15fd('0x3a')],'outboundDropCallsDayACS':_0x484db6[_0x15fd('0x3b')],'outboundDropCallsDayCallersExit':_0x484db6[_0x15fd('0x3c')],'outboundDropCallsDayTimeout':_0x484db6[_0x15fd('0x3d')],'outboundNoAnswerCallsDay':_0x484db6[_0x15fd('0x3e')],'outboundNoSuchCallsDay':_0x484db6[_0x15fd('0x3f')],'outboundOriginateFailureCallsDay':_0x484db6[_0x15fd('0x40')],'outboundReCallsDay':_0x484db6['outboundReCallsDay'],'outboundRejectCallsDay':_0x484db6[_0x15fd('0x41')],'outboundUnknownCallsDay':_0x484db6[_0x15fd('0x42')],'outboundAbandonedCallsDay':_0x484db6['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x484db6[_0x15fd('0x43')],'predictiveIntervalAvgHoldtime':_0x484db6[_0x15fd('0x44')],'predictiveIntervalAvgTalktime':_0x484db6['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x484db6[_0x15fd('0x45')],'predictiveIntervalDroppedCallsTimeout':_0x484db6[_0x15fd('0x46')],'predictiveIntervalErlangCalls':_0x484db6['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x484db6[_0x15fd('0x47')],'predictiveIntervalHitRate':_0x484db6[_0x15fd('0x48')],'predictiveIntervalMultiplicativeFactor':_0x484db6[_0x15fd('0x49')],'predictiveIntervalPauses':_0x484db6[_0x15fd('0x4a')],'predictiveIntervalAvailable':_0x484db6[_0x15fd('0x4b')],'predictiveIntervalTotalCalls':_0x484db6[_0x15fd('0x4c')],'message':_0x484db6['message'],'originated':_0x484db6[_0x15fd('0x4d')],'erlangCalls':_0x484db6[_0x15fd('0x4e')],'erlangCallToSecond':_0x484db6[_0x15fd('0x4f')],'erlangAbandonmentRate':_0x484db6[_0x15fd('0x50')],'erlangBusyFactor':_0x484db6['erlangBusyFactor'],'startPredictive':_0x484db6[_0x15fd('0x51')],'startProgressive':_0x484db6[_0x15fd('0x52')]};if(_0x484db6[_0x15fd('0x53')]){_0x36b21e[_0x15fd('0x53')]={'id':_0x484db6[_0x15fd('0x53')]['id'],'name':_0x484db6[_0x15fd('0x53')]['name'],'active':_0x484db6[_0x15fd('0x53')][_0x15fd('0x54')],'callerid':_0x484db6['Trunk'][_0x15fd('0x55')]};}if(_0x484db6[_0x15fd('0x56')]){_0x36b21e[_0x15fd('0x56')]={'id':_0x484db6['Interval']['id'],'name':_0x484db6[_0x15fd('0x56')][_0x15fd('0x26')]};}var _0x1732bc=md5(JSON[_0x15fd('0x57')](_0x36b21e));if(_0x484db6[_0x15fd('0x58')]!==_0x1732bc){_0x484db6[_0x15fd('0x58')]=_0x1732bc;emit(util['format']('voice:queue:%s',_0x36b21e['name']),_0x15fd('0x59'),_0x36b21e);}}}function emitVoiceQueueChannelRemove(_0x289710){logger[_0x15fd('0x5a')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x289710));emit(util[_0x15fd('0x5b')]('voice:queue:%s',_0x289710['name']),'voice_queue_channel:remove',_0x289710);io[_0x15fd('0x24')](_0x15fd('0x5c'),_0x289710);}function notSendMessagesQueue(_0x217300){if(_0x217300['sendMessageOneNotActive']){if(_0x217300[_0x15fd('0x4d')]===0x0&&_0x217300[_0x15fd('0x5d')]===0x0){_0x217300[_0x15fd('0x5e')]=![];_0x217300['available']=0x0;_0x217300[_0x15fd('0x5f')]=0x0;_0x217300[_0x15fd('0x60')]=_0x15fd('0x61');ut[_0x15fd('0x62')](_0x15fd('0x63'),_0x217300[_0x15fd('0x26')]+_0x15fd('0x64'));}else{_0x217300[_0x15fd('0x60')]=_0x15fd('0x65');ut['logger'](_0x15fd('0x63'),_0x217300[_0x15fd('0x26')]+_0x15fd('0x66'));}emitCampaignPreview(_0x217300);}}Preview[_0x15fd('0x67')][_0x15fd('0x23')]=function(){var _0x5f9429=this;setInterval(function(){_0x5f9429[_0x15fd('0x68')]();},0x7cf);};Preview[_0x15fd('0x67')][_0x15fd('0x68')]=function(){var _0x104eef=this[_0x15fd('0x12')];this[_0x15fd('0x69')]+=0x1;for(var _0x269aae in _0x104eef){if(_0x104eef[_0x15fd('0x6a')](_0x269aae)&&(_0x104eef[_0x269aae][_0x15fd('0x33')]==='preview'||_0x104eef[_0x269aae][_0x15fd('0x33')]===_0x15fd('0x6b'))&&_0x104eef[_0x269aae][_0x15fd('0x6c')]===_0x15fd('0x25')){if(this[_0x15fd('0x69')]>0x7){this[_0x15fd('0x69')]=0x0;this[_0x15fd('0x6d')]();}}if(_0x104eef[_0x15fd('0x6a')](_0x269aae)&&_0x104eef[_0x269aae]['dialMethod']==='preview'&&_0x104eef[_0x269aae][_0x15fd('0x6c')]==='outbound'){if(_0x104eef[_0x269aae][_0x15fd('0x32')]){this[_0x15fd('0x6e')](_0x104eef[_0x269aae]);if(_0x104eef[_0x269aae]['dialPreviewAutoRecallMe'])this[_0x15fd('0x6f')](_0x104eef[_0x269aae]);}else{notSendMessagesQueue(_0x104eef[_0x269aae]);}}}};Preview[_0x15fd('0x67')][_0x15fd('0x70')]=function(_0x2611ba){var _0x3f4ad7=this;this[_0x15fd('0x11')]['enqueue'](function(){if(!_[_0x15fd('0x71')](_0x3f4ad7[_0x15fd('0x15')][_0x2611ba])){loggerAction[_0x15fd('0x5a')](_0x15fd('0x72'),_0x2611ba,_0x15fd('0x73'),_0x3f4ad7[_0x15fd('0x15')][_0x2611ba][_0x15fd('0x74')],_0x15fd('0x75'),JSON[_0x15fd('0x57')](_0x3f4ad7[_0x15fd('0x12')][_0x3f4ad7[_0x15fd('0x15')][_0x2611ba][_0x15fd('0x74')]]['originated']),_0x15fd('0x76'),JSON['stringify'](_0x3f4ad7[_0x15fd('0x12')][_0x3f4ad7[_0x15fd('0x15')][_0x2611ba][_0x15fd('0x74')]]['pTalking']),JSON[_0x15fd('0x57')](_0x3f4ad7[_0x15fd('0x15')][_0x2611ba][_0x15fd('0x77')]),JSON[_0x15fd('0x57')](_['pick'](_0x3f4ad7[_0x15fd('0x15')][_0x2611ba],[_0x15fd('0x78'),_0x15fd('0x79'),_0x15fd('0x7a'),'ListId'])));return ami[_0x15fd('0x7b')]({'action':_0x15fd('0x7c'),'channel':_0x3f4ad7['actions'][_0x2611ba]['channel']})['catch'](function(_0x208bad){if(_0x208bad[_0x15fd('0x60')]===_0x15fd('0x7d')){setTimeout(function(){if(_0x3f4ad7[_0x15fd('0x15')][_0x2611ba]){ut[_0x15fd('0x7e')](_0x3f4ad7[_0x15fd('0x12')][_0x3f4ad7['actions'][_0x2611ba][_0x15fd('0x74')]],_0x15fd('0x7f'));if(_0x3f4ad7[_0x15fd('0x15')][_0x2611ba]['dialAnswer']===!![]){ut[_0x15fd('0x80')](_0x3f4ad7['campaignsPreview'][_0x3f4ad7[_0x15fd('0x15')][_0x2611ba][_0x15fd('0x74')]],_0x15fd('0x7f'));ut[_0x15fd('0x81')](_0x15fd('0x82')+_0x2611ba,_0x3f4ad7[_0x15fd('0x15')][_0x2611ba][_0x15fd('0x74')]);}ut[_0x15fd('0x81')](_0x15fd('0x83')+_0x2611ba,_0x3f4ad7[_0x15fd('0x15')][_0x2611ba][_0x15fd('0x74')]);delete _0x3f4ad7[_0x15fd('0x15')][_0x2611ba];}},0x2328);}});}});};Preview[_0x15fd('0x67')]['clearZombieChannels']=function(){var _0x23d976=this;loggerAction['info'](_0x15fd('0x84'),_['size'](this[_0x15fd('0x15')]));for(var _0x1fac7f in this[_0x15fd('0x15')]){if(_0x23d976['actions']['hasOwnProperty'](_0x1fac7f)){_0x23d976[_0x15fd('0x70')](_0x1fac7f);}}};Preview[_0x15fd('0x67')][_0x15fd('0x6f')]=function(_0x30ab06){var _0x5d94b3=this;rpcDb[_0x15fd('0x85')](_0x30ab06['id'],ut[_0x15fd('0x86')](this[_0x15fd('0x16')]))[_0x15fd('0x87')](function(_0x387e7d){if(!_[_0x15fd('0x71')](_0x387e7d)){for(var _0x59b3b4=0x0;_0x59b3b4<_0x387e7d[_0x15fd('0x88')];_0x59b3b4+=0x1){if(ut[_0x15fd('0x89')](_0x387e7d[_0x59b3b4][_0x15fd('0x8a')])<_0x30ab06[_0x15fd('0x8b')]*0x3c){if(_0x387e7d[_0x59b3b4][_0x15fd('0x8c')]&&!_0x387e7d[_0x59b3b4][_0x15fd('0x8c')]['voicePause']){_0x5d94b3['run'](_0x387e7d[_0x59b3b4]['id'])[_0x15fd('0x87')](ut[_0x15fd('0x8d')]('[RecallMe]'))[_0x15fd('0x8e')](ut[_0x15fd('0x8d')]('[RecallMe]'));}else{rpcDb[_0x15fd('0x8f')](_0x387e7d[_0x59b3b4]['id']);}}else{var _0x4626ac=new Action(_0x387e7d[_0x59b3b4],_0x30ab06);_0x4626ac[_0x15fd('0x90')]=moment()['format'](_0x15fd('0x91'));_0x30ab06[_0x15fd('0x92')]+=0x1;ut[_0x15fd('0x93')](_0x4626ac,0x17,_0x15fd('0x94'));if(_0x30ab06[_0x15fd('0x95')]){rpcDb[_0x15fd('0x96')](ut[_0x15fd('0x97')](_0x387e7d[_0x59b3b4]));rpcDb[_0x15fd('0x98')](_0x4626ac,_0x15fd('0x99'));}else{ut[_0x15fd('0x93')](_0x4626ac,0x16,'RecallFailedTimeout');rpcDb[_0x15fd('0x98')](_0x4626ac,_0x15fd('0x9a'));rpcDb['createCustomerFinal'](_0x4626ac,'[HistoryRecallClose]');}}}}})[_0x15fd('0x8e')](ut[_0x15fd('0x8d')](_0x15fd('0x9b')));};Preview[_0x15fd('0x67')][_0x15fd('0x6e')]=function(_0x1b6f59){_0x1b6f59['sendMessageOneNotActive']=!![];if(ut[_0x15fd('0x9c')](_0x1b6f59[_0x15fd('0x2a')])){_0x1b6f59[_0x15fd('0x60')]=_0x15fd('0x9d');}else if(!ut[_0x15fd('0x9e')](_0x1b6f59[_0x15fd('0x32')])){_0x1b6f59[_0x15fd('0x60')]=_0x15fd('0x61');}else if(!this[_0x15fd('0x9f')](_0x1b6f59[_0x15fd('0x53')])){if(!this[_0x15fd('0x9f')](_0x1b6f59['TrunkBackup'])){_0x1b6f59['message']=_0x15fd('0xa0');}else{_0x1b6f59[_0x15fd('0x60')]=_0x15fd('0xa1');}}else{_0x1b6f59[_0x15fd('0x60')]=_0x15fd('0xa1');}emitCampaignPreview(_0x1b6f59);};Preview[_0x15fd('0x67')][_0x15fd('0xa2')]=function(_0x54bd83,_0x46bb7d,_0x5de222){var _0xc8931e=this;var _0x5abc5c=this[_0x15fd('0x15')][_0x46bb7d];var _0x4ad58e=this[_0x15fd('0x12')][_0x5abc5c[_0x15fd('0x74')]];var _0x4390bc;if(_0x4ad58e){switch(_0x5de222){case'1':_0x4ad58e[_0x15fd('0x3f')]+=0x1;_0x5abc5c[_0x15fd('0xa3')]+=0x1;_0x5abc5c[_0x15fd('0xa4')]=ut[_0x15fd('0xa5')](_0x5abc5c);ut[_0x15fd('0x93')](_0x5abc5c,0x0,_0x15fd('0xa6'));ami['emit']('custom:agentnosuchnumber',ut[_0x15fd('0xa7')](_0x5abc5c,_0x15fd('0xa8')));rpcDb[_0x15fd('0x98')](_0x5abc5c,'[callProgressDetectingCustomer][logNoSuch]');if(ut[_0x15fd('0xa5')](_0x5abc5c)>=_0x4ad58e[_0x15fd('0xa9')]){_0x4390bc=ut[_0x15fd('0xaa')](_0x5abc5c,0xf,'Global');rpcDb[_0x15fd('0xab')](_0x4390bc,_0x15fd('0xac'));}else{if(_0x5abc5c['countnosuchnumberretry']>=_0x4ad58e[_0x15fd('0xad')]){rpcDb['createCustomerFinal'](_0x5abc5c,_0x15fd('0xac'));}else{rpcDb[_0x15fd('0xae')](ut[_0x15fd('0xaf')](_0x5abc5c,_0x15fd('0xa3'),_0x4ad58e[_0x15fd('0xb0')]),_0x5abc5c['unlockAgent'],_0x5abc5c[_0x15fd('0xb1')]);}}delete this['actions'][_0x54bd83[_0x15fd('0xb2')]];break;case'ANSWER':var _0x386c9b=moment()[_0x15fd('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');_0x5abc5c[_0x15fd('0xb3')]=_0x386c9b;_0x5abc5c[_0x15fd('0xb4')]=_0x386c9b;_0x5abc5c['dialAnswer']=!![];_0x4ad58e['pTalking']+=0x1;logger[_0x15fd('0x5a')]('[syncHangup][talking][increment]',_0x5abc5c[_0x15fd('0xb5')],_0x15fd('0xb6'),_0x4ad58e[_0x15fd('0x26')],_0x15fd('0x76'),_0x4ad58e[_0x15fd('0x5d')]);ami['emit'](_0x15fd('0xb7'),ut[_0x15fd('0xa7')](_0x5abc5c,'connect',this[_0x15fd('0x12')][_0x5abc5c[_0x15fd('0x74')]]));if(_0x4ad58e[_0x15fd('0xb8')]){ami[_0x15fd('0x24')](_0x15fd('0xb9'),ut[_0x15fd('0xba')](_0x5abc5c));}break;case'16':ami[_0x15fd('0x24')](_0x15fd('0xbb'),ut[_0x15fd('0xa7')](_0x5abc5c,_0x15fd('0xbc'),this[_0x15fd('0x12')][_0x5abc5c[_0x15fd('0x74')]]));emitVoiceQueueChannelRemove(ut[_0x15fd('0xa7')](_0x5abc5c,_0x15fd('0xbc')));_0x4ad58e['outboundAnswerCallsDay']+=0x1;_0x4ad58e[_0x15fd('0x2e')]+=0x1;_0x4ad58e['answered']+=0x1;ut[_0x15fd('0x80')](_0x4ad58e,_0x15fd('0xbd'));_0x5abc5c[_0x15fd('0xa4')]=ut[_0x15fd('0xa5')](_0x5abc5c);ut['logCustomer'](_0x5abc5c,0x4,_0x15fd('0xbe'));rpcDb[_0x15fd('0x98')](_0x5abc5c,_0x15fd('0xbf'));rpcDb[_0x15fd('0xab')](_0x5abc5c,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x15fd('0xc0')](_0x5abc5c);_0x4ad58e[_0x15fd('0x2c')]+=_0x5abc5c['talktime'];_0x4ad58e[_0x15fd('0x2b')]+=_0x5abc5c[_0x15fd('0xc1')];logger[_0x15fd('0x5a')]('[syncHangup][talking][decrement]',_0x5abc5c[_0x15fd('0xb5')],_0x15fd('0xb6'),_0x4ad58e[_0x15fd('0x26')],_0x15fd('0x76'),_0x4ad58e[_0x15fd('0x5d')]);delete this[_0x15fd('0x15')][_0x54bd83[_0x15fd('0xb2')]];break;case _0x15fd('0xc2'):_0x4ad58e[_0x15fd('0x39')]+=0x1;_0x5abc5c[_0x15fd('0xc3')]+=0x1;_0x5abc5c[_0x15fd('0xa4')]=ut[_0x15fd('0xa5')](_0x5abc5c);ut['logCustomer'](_0x5abc5c,0x5,_0x15fd('0xc4'));ami[_0x15fd('0x24')](_0x15fd('0xc5'),ut[_0x15fd('0xa7')](_0x5abc5c,_0x15fd('0xc6')));rpcDb['createCustomerHistory'](_0x5abc5c,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x15fd('0xa5')](_0x5abc5c)>=_0x4ad58e[_0x15fd('0xa9')]){_0x4390bc=ut[_0x15fd('0xaa')](_0x5abc5c,0xf,_0x15fd('0xc7'));rpcDb[_0x15fd('0xab')](_0x4390bc,_0x15fd('0xc8'));}else{if(_0x5abc5c[_0x15fd('0xc3')]>=_0x4ad58e[_0x15fd('0xc9')]){rpcDb[_0x15fd('0xab')](_0x5abc5c,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x15fd('0xae')](ut[_0x15fd('0xaf')](_0x5abc5c,'countbusyretry',_0x4ad58e[_0x15fd('0xca')]),_0x5abc5c[_0x15fd('0xcb')],_0x5abc5c[_0x15fd('0xb1')]);}}break;case _0x15fd('0xcc'):_0x4ad58e['outboundNoAnswerCallsDay']+=0x1;_0x5abc5c[_0x15fd('0xcd')]+=0x1;_0x5abc5c[_0x15fd('0xa4')]=ut['totalGlobal'](_0x5abc5c);ut[_0x15fd('0x93')](_0x5abc5c,0x3,_0x15fd('0xce'));ami[_0x15fd('0x24')]('custom:agentnoanswer',ut[_0x15fd('0xa7')](_0x5abc5c,_0x15fd('0xcf')));rpcDb[_0x15fd('0x98')](_0x5abc5c,_0x15fd('0xd0'));if(ut[_0x15fd('0xa5')](_0x5abc5c)>=_0x4ad58e[_0x15fd('0xa9')]){_0x4390bc=ut[_0x15fd('0xaa')](_0x5abc5c,0xf,_0x15fd('0xc7'));rpcDb['createCustomerFinal'](_0x4390bc,_0x15fd('0xd1'));}else{if(_0x5abc5c[_0x15fd('0xcd')]>=_0x4ad58e[_0x15fd('0xd2')]){rpcDb[_0x15fd('0xab')](_0x5abc5c,_0x15fd('0xd0'));}else{rpcDb[_0x15fd('0xae')](ut[_0x15fd('0xaf')](_0x5abc5c,_0x15fd('0xcd'),_0x4ad58e[_0x15fd('0xd3')]),_0x5abc5c[_0x15fd('0xcb')],_0x5abc5c[_0x15fd('0xb1')]);}}break;case _0x15fd('0xd4'):_0x4ad58e[_0x15fd('0x3a')]+=0x1;_0x5abc5c[_0x15fd('0xd5')]+=0x1;_0x5abc5c[_0x15fd('0xa4')]=ut[_0x15fd('0xa5')](_0x5abc5c);ut[_0x15fd('0x93')](_0x5abc5c,0x8,_0x15fd('0xd6'));ami[_0x15fd('0x24')](_0x15fd('0xd7'),ut[_0x15fd('0xa7')](_0x5abc5c,_0x15fd('0xd8')));rpcDb[_0x15fd('0x98')](_0x5abc5c,_0x15fd('0xd9'));if(ut[_0x15fd('0xa5')](_0x5abc5c)>=_0x4ad58e[_0x15fd('0xa9')]){_0x4390bc=ut['cloneAction'](_0x5abc5c,0xf,_0x15fd('0xc7'));rpcDb[_0x15fd('0xab')](_0x4390bc,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x5abc5c[_0x15fd('0xd5')]>=_0x4ad58e[_0x15fd('0xda')]){rpcDb[_0x15fd('0xab')](_0x5abc5c,_0x15fd('0xd9'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x5abc5c,_0x15fd('0xd5'),_0x4ad58e['dialBusyRetryFrequency']),_0x5abc5c[_0x15fd('0xcb')],_0x5abc5c[_0x15fd('0xb1')]);}}break;case _0x15fd('0xdb'):_0x4ad58e[_0x15fd('0x41')]+=0x1;_0x5abc5c[_0x15fd('0xdc')]+=0x1;_0x5abc5c[_0x15fd('0xa4')]=ut[_0x15fd('0xa5')](_0x5abc5c);ut['logCustomer'](_0x5abc5c,0x14,'AgentReject');ami[_0x15fd('0x24')](_0x15fd('0xdd'),ut[_0x15fd('0xa7')](_0x5abc5c,_0x15fd('0xde')));rpcDb[_0x15fd('0x98')](_0x5abc5c,_0x15fd('0xdf'));if(ut['totalGlobal'](_0x5abc5c)>=_0x4ad58e['dialGlobalMaxRetry']){_0x4390bc=ut[_0x15fd('0xaa')](_0x5abc5c,0x14,_0x15fd('0xe0'));rpcDb[_0x15fd('0xab')](_0x4390bc,_0x15fd('0xe1'));}else{if(_0x5abc5c[_0x15fd('0xdc')]>=_0x4ad58e[_0x15fd('0xe2')]){rpcDb['createCustomerFinal'](_0x5abc5c,_0x15fd('0xe1'));}else{rpcDb['rescheduleContact'](ut[_0x15fd('0xaf')](_0x5abc5c,_0x15fd('0xdc'),_0x4ad58e[_0x15fd('0xe3')]),_0x5abc5c[_0x15fd('0xcb')],_0x5abc5c['activeContact']);}}break;case _0x15fd('0xe4'):_0x4ad58e['outboundAbandonedCallsDay']+=0x1;_0x5abc5c[_0x15fd('0xe5')]+=0x1;_0x5abc5c['countglobal']=ut['totalGlobal'](_0x5abc5c);ut[_0x15fd('0x93')](_0x5abc5c,0xb,_0x15fd('0xe6'));rpcDb[_0x15fd('0x98')](_0x5abc5c,_0x15fd('0xe7'));if(ut[_0x15fd('0xa5')](_0x5abc5c)>=_0x4ad58e[_0x15fd('0xa9')]){_0x4390bc=ut['cloneAction'](_0x5abc5c,0xf,_0x15fd('0xc7'));rpcDb['createCustomerFinal'](_0x4390bc,_0x15fd('0xe7'));}else{if(_0x5abc5c[_0x15fd('0xe8')]>=_0x4ad58e[_0x15fd('0xe9')]){rpcDb[_0x15fd('0xab')](_0x5abc5c,_0x15fd('0xe7'));}else{rpcDb[_0x15fd('0xae')](ut[_0x15fd('0xaf')](_0x5abc5c,_0x15fd('0xe5'),_0x4ad58e[_0x15fd('0xea')]),_0x5abc5c[_0x15fd('0xcb')],_0x5abc5c[_0x15fd('0xb1')]);}}break;case'18':_0x4ad58e[_0x15fd('0x42')]+=0x1;_0x5abc5c['countmachineretry']+=0x1;_0x5abc5c[_0x15fd('0xa4')]=ut[_0x15fd('0xa5')](_0x5abc5c);ut[_0x15fd('0x93')](_0x5abc5c,0x12,_0x54bd83[_0x15fd('0xeb')]||_0x54bd83[_0x15fd('0xec')]);ami[_0x15fd('0x24')]('custom:amd',ut['buildObj'](_0x5abc5c,_0x15fd('0xed')));rpcDb[_0x15fd('0x98')](_0x5abc5c,_0x15fd('0xee'));if(ut[_0x15fd('0xa5')](_0x5abc5c)>=_0x4ad58e['dialGlobalMaxRetry']){_0x4390bc=ut['cloneAction'](_0x5abc5c,0xf,_0x15fd('0xc7'));rpcDb[_0x15fd('0xab')](_0x4390bc,_0x15fd('0xee'));}else{rpcDb['createCustomerFinal'](_0x5abc5c,'[callProgressDetectingCustomer][hangupInAMD]');}delete this[_0x15fd('0x15')][_0x54bd83[_0x15fd('0xb2')]];break;case'19':_0x4ad58e[_0x15fd('0x42')]+=0x1;_0x5abc5c[_0x15fd('0xa4')]=ut[_0x15fd('0xa5')](_0x5abc5c);ut[_0x15fd('0x93')](_0x5abc5c,0x13,_0x54bd83[_0x15fd('0xeb')]||_0x54bd83[_0x15fd('0xec')]);ami[_0x15fd('0x24')](_0x15fd('0xef'),ut['buildObj'](_0x5abc5c,'amd'));rpcDb[_0x15fd('0x98')](_0x5abc5c,_0x15fd('0xf0'));if(ut[_0x15fd('0xa5')](_0x5abc5c)>=_0x4ad58e[_0x15fd('0xa9')]){_0x4390bc=ut[_0x15fd('0xaa')](_0x5abc5c,0xf,_0x15fd('0xc7'));rpcDb[_0x15fd('0xab')](_0x4390bc,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0x15fd('0xab')](_0x5abc5c,'[callProgressDetectingCustomer][machine]');}delete this['actions'][_0x54bd83[_0x15fd('0xb2')]];break;default:if(_0x5abc5c[_0x15fd('0x77')]){ut['decrementTalkink'](_0x4ad58e,_0x15fd('0xf1'));ut[_0x15fd('0x81')](_0x15fd('0xf2')+_0x4ad58e['name'],_0x54bd83);}_0x4ad58e[_0x15fd('0x42')]+=0x1;_0x5abc5c[_0x15fd('0xa4')]=ut[_0x15fd('0xa5')](_0x5abc5c);ut[_0x15fd('0x93')](_0x5abc5c,0xc,_0x54bd83[_0x15fd('0xeb')]||_0x54bd83[_0x15fd('0xec')]);rpcDb[_0x15fd('0x98')](_0x5abc5c,_0x15fd('0xf3'));if(ut[_0x15fd('0xa5')](_0x5abc5c)>=_0x4ad58e[_0x15fd('0xa9')]){_0x4390bc=ut[_0x15fd('0xaa')](_0x5abc5c,0xf,'Global');rpcDb[_0x15fd('0xab')](_0x4390bc,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x15fd('0xab')](_0x5abc5c,_0x15fd('0xf4'));}delete this[_0x15fd('0x15')][_0x54bd83[_0x15fd('0xb2')]];}if(!(_0x5abc5c[_0x15fd('0x77')]&&_0x5de222==='16')){ut[_0x15fd('0x7e')](_0x4ad58e,_0x15fd('0xf5'));logger[_0x15fd('0x5a')](_0x15fd('0xf6'),_0x5abc5c[_0x15fd('0xb5')],_0x15fd('0xb6'),_0x4ad58e['name'],'originated:\x20',_0x4ad58e[_0x15fd('0x4d')]);}if(_0x5de222!==_0x15fd('0xf7')){delete this[_0x15fd('0x15')][_0x54bd83[_0x15fd('0xb2')]];delete this[_0x15fd('0x15')][_0x54bd83['destlinkedid']];}}};Preview['prototype'][_0x15fd('0xf8')]=function(_0x14d028,_0x32397e,_0x3c06d7){if(_['isUndefined'](_0x32397e)&&_0x15fd('0xf9')!==typeof _0x32397e){return;}if(_['isUndefined'](_0x3c06d7)&&_0x15fd('0xf9')!==typeof _0x3c06d7){return;}switch(_0x3c06d7['reason']){case'0':ut[_0x15fd('0xfa')](_0x14d028,0x0,_0x15fd('0xa6'));rpcDb[_0x15fd('0xfb')](_0x14d028,_0x15fd('0xfc'));break;case'3':ut[_0x15fd('0xfa')](_0x14d028,0x3,_0x15fd('0xce'));rpcDb['createAgentHistory'](_0x14d028,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x15fd('0xfa')](_0x14d028,0x5,_0x15fd('0xc4'));rpcDb[_0x15fd('0xfb')](_0x14d028,_0x15fd('0xfd'));break;case'8':ut[_0x15fd('0xfa')](_0x14d028,0x8,_0x15fd('0xd6'));rpcDb[_0x15fd('0xfb')](_0x14d028,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut['logAgent'](_0x14d028,0x16,_0x15fd('0xfe'));rpcDb['createAgentHistory'](_0x14d028,_0x15fd('0xff'));break;default:ut[_0x15fd('0xfa')](_0x14d028,0xc,_0x3c06d7[_0x15fd('0x100')]);rpcDb[_0x15fd('0xfb')](_0x14d028,_0x15fd('0x101'));}ut[_0x15fd('0x7e')](_0x32397e,_0x15fd('0x102'));logger[_0x15fd('0x5a')](_0x15fd('0x103'),_0x14d028['uniqueid'],_0x15fd('0xb6'),_0x32397e[_0x15fd('0x26')],_0x15fd('0x75'),_0x32397e[_0x15fd('0x4d')]);delete this[_0x15fd('0x15')][_0x14d028['uniqueid']];};Preview[_0x15fd('0x67')]['checkInBlack']=function(_0x1ff525,_0x3180ab,_0x355625,_0x23593a,_0x4a6832){var _0x4960b6=this;return new BPromise(function(_0x35cf46,_0x1c34af){if(_['isNil'](_0x3180ab)||_[_0x15fd('0x71')](_0x3180ab[_0x15fd('0x104')])||_[_0x15fd('0x71')](_0x3180ab[_0x15fd('0x104')][_0x15fd('0x105')])||_[_0x15fd('0x71')](_0x3180ab[_0x15fd('0x7a')])){_0x1c34af(ut[_0x15fd('0x60')]('Contact\x20is\x20undefined',_0x23593a,_0x4a6832));return;}var _0x431392=uuid['v4']();var _0x29a110=_0x4960b6[_0x15fd('0x12')][_0x3180ab[_0x15fd('0x73')][_0x15fd('0x26')]];var _0x8598f2=_0x355625?_0x4960b6[_0x15fd('0x16')][_0x355625]['id']:undefined;_0x4960b6['actions'][_0x431392]=new Action(_0x3180ab,_0x29a110,_0x431392,_0x355625,_0x8598f2);var _0xe52abc=_0x4960b6['actions'][_0x431392];_0xe52abc['unlockAgent']=_0x23593a;_0xe52abc[_0x15fd('0xb1')]=_0x4a6832;_0xe52abc[_0x15fd('0x106')]=_0x355625;if(_[_0x15fd('0x107')](_0x1ff525)){_0x4960b6[_0x15fd('0x108')](_0xe52abc,_0x29a110,_0x3180ab,_0x355625)[_0x15fd('0x87')](function(_0x1d8c42){logger[_0x15fd('0x5a')](_0x15fd('0x109'),'Queue:\x20'+_0xe52abc[_0x15fd('0x74')]+_0x15fd('0x10a')+_0xe52abc[_0x15fd('0x10b')],JSON[_0x15fd('0x57')](_0x1d8c42));ami[_0x15fd('0x24')](_0x15fd('0x10c'),ut[_0x15fd('0xa7')](_0xe52abc,_0x15fd('0x10d'),_0x4960b6['campaignsPreview'][_0xe52abc[_0x15fd('0x74')]]));_0x35cf46(ut[_0x15fd('0x60')](_0x15fd('0x10e')));})[_0x15fd('0x8e')](function(_0xdf6a3f){ut['logger'](_0x15fd('0x10f'),_0xdf6a3f);_0x1c34af(ut[_0x15fd('0x60')]('Call\x20failed',_0x23593a,_0x4a6832));});}else{_0x29a110[_0x15fd('0x38')]+=0x1;ut[_0x15fd('0x110')](_0xe52abc);rpcDb[_0x15fd('0x111')](_0xe52abc,_0x15fd('0x112'));delete _0x4960b6[_0x15fd('0x15')][_0x431392];_0x1c34af(ut[_0x15fd('0x60')](_0x15fd('0x113'),_0x23593a,_0x4a6832));}});};Preview[_0x15fd('0x67')][_0x15fd('0x9f')]=function(_0x982d6d){return!_[_0x15fd('0x71')](_0x982d6d)&&!_[_0x15fd('0x71')](_0x982d6d[_0x15fd('0x26')])&&!_[_0x15fd('0x71')](_0x982d6d[_0x15fd('0x54')])&&_0x982d6d[_0x15fd('0x54')]&&!_[_0x15fd('0x71')](this[_0x15fd('0x14')][util[_0x15fd('0x5b')](_0x15fd('0x114'),_0x982d6d[_0x15fd('0x26')])])&&!_[_0x15fd('0x71')](this[_0x15fd('0x14')][util['format']('SIP/%s',_0x982d6d[_0x15fd('0x26')])][_0x15fd('0x7c')])&&(this[_0x15fd('0x14')][util[_0x15fd('0x5b')]('SIP/%s',_0x982d6d[_0x15fd('0x26')])][_0x15fd('0x7c')]===_0x15fd('0x115')||this['trunks'][util[_0x15fd('0x5b')](_0x15fd('0x114'),_0x982d6d[_0x15fd('0x26')])][_0x15fd('0x7c')]===_0x15fd('0x116'));};Preview['prototype']['run']=function(_0x2ec831,_0xc7da2d){var _0x52bcd2=this;return new BPromise(function(_0x6212cb,_0x34008e){_0x52bcd2[_0x15fd('0x117')](_0x2ec831,_0xc7da2d)[_0x15fd('0x87')](function(_0x35febd){_0x6212cb(_['pick'](_0x35febd,[_0x15fd('0x60')]));})[_0x15fd('0x8e')](function(_0x3b1ca4){if(_0x3b1ca4[_0x15fd('0x118')]){rpcDb['unlockContact'](_0x2ec831);}if(_0x3b1ca4[_0x15fd('0x54')]){rpcDb[_0x15fd('0x8f')](_0x2ec831);}_0x34008e(_[_0x15fd('0x119')](_0x3b1ca4,[_0x15fd('0x60')]));});});};Preview[_0x15fd('0x67')][_0x15fd('0x117')]=function(_0x5efbd8,_0x2bd82a){var _0x88e79a=this;return new BPromise(function(_0x30b58b,_0x31a880){var _0x3a30e7,_0x32f2b3;rpcDb[_0x15fd('0x11a')](_0x5efbd8)['then'](function(_0x56db93){if(!_['isNil'](_0x56db93[0x0])){_0x32f2b3=_0x56db93[0x0][_0x15fd('0x11b')]?![]:!![];_0x3a30e7=_0x56db93[0x0][_0x15fd('0x11b')]?!![]:![];_0x3a30e7=_0x2bd82a?!![]:_0x3a30e7;}var _0x24f8eb=_0x88e79a[_0x15fd('0x11c')](_0x56db93);if(_0x24f8eb[_0x15fd('0x11d')]){rpcDb[_0x15fd('0x11e')](_[_0x15fd('0x119')](_0x56db93[0x0],[_0x15fd('0x7a'),_0x15fd('0x11f')]))[_0x15fd('0x87')](function(_0x34b3b0){_0x88e79a[_0x15fd('0x120')](_0x34b3b0,_0x56db93[0x0],_0x2bd82a,_0x32f2b3,_0x3a30e7)[_0x15fd('0x87')](function(_0x4580bd){_0x30b58b(_0x4580bd);})[_0x15fd('0x8e')](function(_0x174b0d){_0x31a880(_0x174b0d);});})['catch'](function(_0x2460a8){ut[_0x15fd('0x62')](_0x15fd('0x121'),_0x2460a8);_0x31a880(ut[_0x15fd('0x60')]('Call\x20unsuccessful',_0x32f2b3,_0x3a30e7));});}else{_0x31a880(ut[_0x15fd('0x60')](_0x24f8eb[_0x15fd('0x60')],_0x32f2b3,_0x3a30e7));}})[_0x15fd('0x8e')](function(_0x389355){ut[_0x15fd('0x62')]('[Preview][getContactPreview]',_0x389355);_0x31a880(ut[_0x15fd('0x60')](_0x15fd('0x122'),![],!![]));});});};Preview['prototype']['validateContact']=function(_0x10a997){if(_[_0x15fd('0x71')](_0x10a997)||_[_0x15fd('0x107')](_0x10a997)||!_[_0x15fd('0x71')](_0x10a997[0x0][_0x15fd('0x8c')])&&_[_0x15fd('0x71')](_0x10a997[0x0][_0x15fd('0x8c')]['name'])){ut[_0x15fd('0x62')](_0x15fd('0x123'),_0x10a997);return{'isValid':![],'message':_0x15fd('0x124')};}var _0x5e6b7b=this[_0x15fd('0x12')][_0x10a997[0x0][_0x15fd('0x73')]['name']];_0x5e6b7b[_0x15fd('0x60')]='ACTIVE';if(_['isNil'](_0x5e6b7b)){ut['logger'](_0x15fd('0x125'),_0x5e6b7b);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0x15fd('0x9f')](_0x5e6b7b['Trunk'])){ut['logger'](_0x15fd('0x126'),_0x15fd('0x127')+_0x5e6b7b['name']+_0x15fd('0x128'));if(!this[_0x15fd('0x9f')](_0x5e6b7b[_0x15fd('0x129')])){ut['logger'](_0x15fd('0x126'),_0x5e6b7b[_0x15fd('0x26')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x15fd('0x12a')};}}if(!ut[_0x15fd('0x9e')](_0x5e6b7b[_0x15fd('0x32')])){ut[_0x15fd('0x62')]('[Preview][validateContact][Campaign\x20Active]',_0x5e6b7b[_0x15fd('0x26')]+_0x15fd('0x12b'));return{'isValid':![],'message':_0x15fd('0x127')+_0x5e6b7b[_0x15fd('0x26')]+_0x15fd('0x12b')};}return{'isValid':!![],'message':_0x15fd('0x12c')};};Preview[_0x15fd('0x67')]['execCall']=function(_0x2350c1,_0x4f0bfd,_0x321f68,_0x5a5ec5){var _0x28bcdb=this;return new BPromise(function(_0xbdc802,_0xc713d8){var _0x4f1309=_0x2350c1['uniqueid'];var _0x20e8a2=_0x28bcdb['isTrunkReachable'](_0x4f0bfd['Trunk'])?util[_0x15fd('0x5b')](_0x15fd('0x12d'),_0x4f0bfd[_0x15fd('0x53')]['name'],_[_0x15fd('0x71')](_0x4f0bfd[_0x15fd('0x12e')])?'':_0x4f0bfd[_0x15fd('0x12e')]['trim']()||'',_0x4f0bfd['dialCutDigit']>0x0?_0x321f68[_0x15fd('0x104')][_0x15fd('0x105')][_0x15fd('0x12f')](_0x4f0bfd[_0x15fd('0x130')]):_0x321f68[_0x15fd('0x104')][_0x15fd('0x105')]):util[_0x15fd('0x5b')]('SIP/%s/%s%s',_[_0x15fd('0x71')](_0x4f0bfd[_0x15fd('0x129')])?_0x4f0bfd['Trunk'][_0x15fd('0x26')]:_0x4f0bfd[_0x15fd('0x129')][_0x15fd('0x26')],_[_0x15fd('0x71')](_0x4f0bfd[_0x15fd('0x12e')])?'':_0x4f0bfd['dialPrefix'][_0x15fd('0x131')]()||'',_0x4f0bfd['dialCutDigit']>0x0?_0x321f68[_0x15fd('0x104')][_0x15fd('0x105')][_0x15fd('0x12f')](_0x4f0bfd[_0x15fd('0x130')]):_0x321f68[_0x15fd('0x104')][_0x15fd('0x105')]);var _0x1105f8=_0x28bcdb[_0x15fd('0x9f')](_0x4f0bfd['Trunk'])?ut[_0x15fd('0x132')](_0x4f0bfd['Trunk'][_0x15fd('0x55')],_0x4f0bfd[_0x15fd('0x34')],_0x4f0bfd[_0x15fd('0x133')]>0x0?ut[_0x15fd('0x134')](_0x4f0bfd[_0x15fd('0x135')],_0x4f0bfd[_0x15fd('0x133')]):_0x4f0bfd[_0x15fd('0x135')]):ut['getCallerId'](_[_0x15fd('0x71')](_0x4f0bfd[_0x15fd('0x129')])?_0x4f0bfd[_0x15fd('0x53')]['callerid']:_0x4f0bfd['TrunkBackup'][_0x15fd('0x55')],_0x4f0bfd[_0x15fd('0x34')],_0x4f0bfd[_0x15fd('0x133')]>0x0?ut[_0x15fd('0x134')](_0x4f0bfd[_0x15fd('0x135')],_0x4f0bfd[_0x15fd('0x133')]):_0x4f0bfd[_0x15fd('0x135')]);if(_0x1105f8){_0x2350c1[_0x15fd('0x136')]=ut[_0x15fd('0x137')](_0x1105f8);_0x2350c1['originatecalleridnum']=ut[_0x15fd('0x138')](_0x1105f8);}var _0x147ae5=ut[_0x15fd('0x139')](_0x4f0bfd,_0x321f68,_0x20e8a2,_0x1105f8,_0x4f1309,_0x2350c1);_[_0x15fd('0x13a')](_0x2350c1,ut['toLowerVariables'](_0x147ae5));_0x2350c1['starttime']=moment()[_0x15fd('0x5b')](_0x15fd('0x91'));ami[_0x15fd('0x7b')](ut[_0x15fd('0x13b')](_0x2350c1,_0x4f0bfd,_0x147ae5,_0x2350c1[_0x15fd('0xb1')],_0x5a5ec5))['then'](function(_0x571242){_0x4f0bfd['originated']+=0x1;logger[_0x15fd('0x5a')]('[originated][increment]',_0x4f1309,'\x20Queue',_0x4f0bfd[_0x15fd('0x26')],_0x15fd('0x75'),_0x4f0bfd[_0x15fd('0x4d')]);_0xbdc802(_0x571242);})[_0x15fd('0x8e')](function(_0x1c5847){ut['logAgent'](_0x2350c1,0xe,_0x15fd('0x13c'));rpcDb[_0x15fd('0xfb')](_0x2350c1,_0x15fd('0x13d'));_0xc713d8(_0x1c5847);});});};Preview[_0x15fd('0x67')][_0x15fd('0x1d')]=function(_0x4d09dd){if(this[_0x15fd('0x15')][_0x4d09dd[_0x15fd('0xb2')]]){this[_0x15fd('0x15')][_0x4d09dd['linkedid']][_0x15fd('0x13e')]=_0x4d09dd[_0x15fd('0x13e')];}};Preview[_0x15fd('0x67')]['syncOriginateResponse']=function(_0x293839){var _0x2a8069=this;var _0x10e272=this[_0x15fd('0x15')][_0x293839[_0x15fd('0x13f')]];if(_0x10e272){if(_0x10e272[_0x15fd('0x106')]&&this[_0x15fd('0x16')][_0x10e272[_0x15fd('0x106')]]){ut[_0x15fd('0x140')](_0x10e272,this[_0x15fd('0x16')][_0x10e272['lookAgent']][_0x15fd('0x26')],this[_0x15fd('0x16')][_0x10e272[_0x15fd('0x106')]]['id']);}var _0x13068e=_[_0x15fd('0x141')](_0x10e272);_0x13068e[_0x15fd('0xb3')]=moment()[_0x15fd('0x5b')](_0x15fd('0x91'));var _0x55c774=_0x2a8069['campaignsPreview'][_0x10e272['queue']];if(ut[_0x15fd('0x142')](_0x293839[_0x15fd('0x143')])){if(_0x10e272['unlockAgent']){rpcDb['unlockContact'](_0x10e272[_0x15fd('0x10b')]);}if(_0x10e272['activeContact']){rpcDb[_0x15fd('0x8f')](_0x10e272['idContact']);}ami[_0x15fd('0x24')](_0x15fd('0x144'),ut[_0x15fd('0xa7')](_0x10e272,_0x15fd('0x145'),this[_0x15fd('0x12')][_0x10e272['queue']]));this[_0x15fd('0xf8')](_0x13068e,_0x55c774,_0x293839);}else{_0x10e272[_0x15fd('0x90')]=moment()[_0x15fd('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x15fd('0xfa')](_0x13068e,0x4,_0x15fd('0xbe'));rpcDb[_0x15fd('0xfb')](_0x13068e,_0x15fd('0x146'));}}};Preview[_0x15fd('0x67')][_0x15fd('0x1a')]=function(_0x30e164){var _0x52951d=this;var _0x762320=this[_0x15fd('0x15')][_0x30e164[_0x15fd('0xb2')]];var _0x812cfa;if(_0x762320){_0x812cfa=this[_0x15fd('0x12')][_0x762320['queue']];logger['info']('[syncHangup][talking]',_0x30e164['linkedid'],_0x15fd('0xb6'),_0x812cfa[_0x15fd('0x26')],_0x15fd('0x76'),_0x812cfa[_0x15fd('0x5d')]);}if(this['actions'][_0x30e164[_0x15fd('0xb2')]]&&_0x30e164[_0x15fd('0xb2')]!==_0x30e164[_0x15fd('0xb5')]){if(_0x30e164[_0x15fd('0x147')]==='16'&&this[_0x15fd('0x15')][_0x30e164[_0x15fd('0xb2')]][_0x15fd('0x77')]){this[_0x15fd('0xa2')](_0x30e164,_0x30e164[_0x15fd('0xb2')],_0x30e164[_0x15fd('0x147')]);}else if(this['actions'][_0x30e164[_0x15fd('0xb2')]][_0x15fd('0x77')]){logger[_0x15fd('0x5a')](_0x15fd('0x148'),_0x30e164['linkedid'],_0x30e164[_0x15fd('0x147')],_0x15fd('0xb6'),_0x812cfa[_0x15fd('0x26')],_0x15fd('0x76'),_0x812cfa['pTalking']);this['callProgressDetectingCustomer'](_0x30e164,_0x30e164['linkedid'],_0x30e164['cause']);}}else if(_0x762320&&_[_0x15fd('0x71')](_0x762320[_0x15fd('0x149')])&&_0x812cfa[_0x15fd('0x14a')]&&_0x30e164[_0x15fd('0xb2')]===_0x30e164['uniqueid']&&_[_0x15fd('0x71')](_0x30e164[_0x15fd('0x100')])&&_0x30e164[_0x15fd('0x147')]==='16'&&_0x30e164[_0x15fd('0x14b')]==='6'&&_['isUndefined'](_0x762320['transfer'])){if(_0x762320['unlockAgent']){rpcDb['unlockContact'](_0x762320[_0x15fd('0x10b')]);}if(_0x762320[_0x15fd('0xb1')]){rpcDb[_0x15fd('0x8f')](_0x762320['idContact']);}_0x30e164['reason']='22';this[_0x15fd('0xf8')](_0x762320,_0x812cfa,_0x30e164);}else if(_0x762320&&_0x762320['transfer']){if(_0x30e164[_0x15fd('0x147')]==='16'&&this['actions'][_0x30e164[_0x15fd('0xb2')]][_0x15fd('0x77')]){logger[_0x15fd('0x5a')]('[syncHangup][talking][transfer]',_0x30e164[_0x15fd('0xb2')],_0x30e164[_0x15fd('0x147')],_0x15fd('0xb6'),_0x812cfa['name'],'pTalking:\x20',_0x812cfa[_0x15fd('0x5d')]);this[_0x15fd('0xa2')](_0x30e164,_0x30e164['linkedid'],_0x30e164[_0x15fd('0x147')]);}else if(this[_0x15fd('0x15')][_0x30e164[_0x15fd('0xb2')]][_0x15fd('0x77')]){logger['info'](_0x15fd('0x148'),_0x30e164['linkedid'],_0x30e164[_0x15fd('0x147')],_0x15fd('0xb6'),_0x812cfa['name'],_0x15fd('0x76'),_0x812cfa[_0x15fd('0x5d')]);this[_0x15fd('0xa2')](_0x30e164,_0x30e164[_0x15fd('0xb2')],_0x30e164[_0x15fd('0x147')]);}}};Preview[_0x15fd('0x67')][_0x15fd('0x14c')]=function(_0x32cbbb){if(this[_0x15fd('0x15')][_0x32cbbb[_0x15fd('0x14d')]]&&_0x32cbbb[_0x15fd('0x14d')]!==_0x32cbbb[_0x15fd('0x14e')]){this['callProgressDetectingCustomer'](_0x32cbbb,_0x32cbbb['destlinkedid'],_0x32cbbb[_0x15fd('0xec')]);}};Preview['prototype'][_0x15fd('0x1c')]=function(_0x3dbc1b){if(this[_0x15fd('0x15')][_0x3dbc1b[_0x15fd('0xb2')]]&&_0x3dbc1b[_0x15fd('0xb2')]!==_0x3dbc1b[_0x15fd('0xb5')]&&!this['actions'][_0x3dbc1b[_0x15fd('0xb2')]][_0x15fd('0x77')]){if(_0x3dbc1b[_0x15fd('0x147')]==='1'){this['callProgressDetectingCustomer'](_0x3dbc1b,_0x3dbc1b[_0x15fd('0xb2')],_0x3dbc1b[_0x15fd('0x147')]);}}};Preview[_0x15fd('0x67')][_0x15fd('0x14f')]=function(_0x2c8934,_0x6982dd,_0x2b7f9c){if(this['actions'][_0x2c8934]){if(_[_0x15fd('0x71')](this[_0x15fd('0x15')][_0x2c8934]['variables'])){this[_0x15fd('0x15')][_0x2c8934][_0x15fd('0x150')]={};}this['actions'][_0x2c8934]['variables'][_0x6982dd]=_0x2b7f9c;}};Preview[_0x15fd('0x67')][_0x15fd('0x1f')]=function(_0x5ceaaa){try{if(!_[_0x15fd('0x71')](_0x5ceaaa)){if(ut[_0x15fd('0x151')](_['keys'](_0x5ceaaa['variable'])[0x0])){this['addVariable'](_0x5ceaaa['uniqueid'],_[_0x15fd('0x152')](_0x5ceaaa[_0x15fd('0x153')])[0x0],_0x5ceaaa['value']);}}}catch(_0x3e7be2){logger['error'](_0x15fd('0x154'),util[_0x15fd('0x155')](_0x3e7be2,{'showHidden':![],'depth':null}));}};Preview[_0x15fd('0x67')][_0x15fd('0x20')]=function(_0x2dc778){if(_0x2dc778){if(this[_0x15fd('0x15')][_0x2dc778[_0x15fd('0x156')]]){this[_0x15fd('0x15')][_0x2dc778['transfertargetlinkedid']][_0x15fd('0x157')]=!![];}}};Preview[_0x15fd('0x67')][_0x15fd('0x22')]=function(_0x22ad72){if(_0x22ad72){if(this[_0x15fd('0x15')][_0x22ad72['transfererlinkedid']]){this['actions'][_0x22ad72[_0x15fd('0x158')]][_0x15fd('0x157')]=!![];}}};module[_0x15fd('0x159')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index c1be6ba..0a890e7 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 _0x484b=['queuecallerjoinAt','queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','[createHistory]\x20','then','createHistory','moveContactManagedDialer','catch','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue'];(function(_0x442f02,_0x47d845){var _0xab6ef1=function(_0x4cad5c){while(--_0x4cad5c){_0x442f02['push'](_0x442f02['shift']());}};_0xab6ef1(++_0x47d845);}(_0x484b,0x139));var _0xb484=function(_0x30d2ce,_0x199640){_0x30d2ce=_0x30d2ce-0x0;var _0x4820cc=_0x484b[_0x30d2ce];return _0x4820cc;};'use strict';var util=require(_0xb484('0x0'));var BPromise=require(_0xb484('0x1'));var logger=require(_0xb484('0x2'))(_0xb484('0x3'));var _=require(_0xb484('0x4'));var cmHopper=require(_0xb484('0x5'));var cmHopperFinal=require(_0xb484('0x6'));var cmHopperHistory=require(_0xb484('0x7'));var cmHopperBlack=require(_0xb484('0x8'));var voiceQueueRt=require(_0xb484('0x9'));var agentReportPreview=require(_0xb484('0xa'));var voiceQueueReport=require(_0xb484('0xb'));function loggerCatch(_0x26f44b){return function(_0x22b519){logger[_0xb484('0xc')](_0x26f44b,util[_0xb484('0xd')](_0x22b519,{'showHidden':![],'depth':null}));};}function create(_0x57b646){return BPromise[_0xb484('0xe')]()['then'](cmHopperHistory['createHistory'](_0x57b646))['catch'](loggerCatch(_0xb484('0xf')));}function createAgent(_0x305fa0){return BPromise['resolve']()[_0xb484('0x10')](agentReportPreview[_0xb484('0x11')](_0x305fa0))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x48735c){return BPromise[_0xb484('0xe')]()[_0xb484('0x10')](cmHopper[_0xb484('0x12')](_0x48735c,!![]))[_0xb484('0x13')](loggerCatch(_0xb484('0x14')));}exports['checkIsBlackList']=function(_0x7fbc7e){return BPromise[_0xb484('0xe')]()[_0xb484('0x10')](cmHopperBlack[_0xb484('0x15')](_0x7fbc7e))['catch'](loggerCatch(_0xb484('0x16')));};exports['getContactPreview']=function(_0x571ae9){return BPromise[_0xb484('0xe')]()[_0xb484('0x10')](cmHopper[_0xb484('0x17')](_0x571ae9))[_0xb484('0x13')](loggerCatch(_0xb484('0x18')));};exports[_0xb484('0x11')]=function(_0x5edcb8,_0xce9338){create(_0x5edcb8)['catch'](loggerCatch(_0xce9338));moveContact(_0x5edcb8)[_0xb484('0x13')](loggerCatch(_0xce9338));};exports[_0xb484('0x19')]=function(_0x57c854,_0x377c32){createAgent(_0x57c854)[_0xb484('0x13')](loggerCatch(_0x377c32));};exports[_0xb484('0x1a')]=function(_0xc5de1e,_0x4717d5){create(_0xc5de1e)[_0xb484('0x13')](loggerCatch(_0x4717d5));};exports[_0xb484('0x1b')]=function(_0x264dae,_0x4192dc){moveContact(_0x264dae)[_0xb484('0x13')](loggerCatch(_0x4192dc));};exports[_0xb484('0x1c')]=function(_0xff0526,_0x1acb29,_0x2ca10d){if(_0x1acb29){_0xff0526['UserId']=null;}if(_0x2ca10d){_0xff0526[_0xb484('0x1d')]=![];}return BPromise[_0xb484('0xe')]()[_0xb484('0x10')](cmHopper[_0xb484('0x1c')](_0xff0526))[_0xb484('0x13')](loggerCatch(_0xb484('0x1e')));};exports[_0xb484('0x1f')]=function(_0x2bd22e){return BPromise[_0xb484('0xe')]()[_0xb484('0x10')](cmHopper[_0xb484('0x1f')](_0x2bd22e))[_0xb484('0x13')](loggerCatch('[countReScheduled]\x20'));};exports[_0xb484('0x20')]=function(_0x37cab7){return BPromise[_0xb484('0xe')]()['then'](cmHopper[_0xb484('0x20')]({'UserId':null},_0x37cab7,0x1))[_0xb484('0x13')](loggerCatch(_0xb484('0x21')));};exports[_0xb484('0x22')]=function(_0x6ad318){return BPromise['resolve']()[_0xb484('0x10')](cmHopper[_0xb484('0x20')]({'active':![]},_0x6ad318,0x1))['catch'](loggerCatch('[activeContact]\x20'));};exports[_0xb484('0x23')]=function(_0x423d5c){var _0x11ac48={};_0x11ac48[_0xb484('0x24')]=_0x423d5c[_0xb484('0x24')];_0x11ac48[_0xb484('0x25')]=_0x423d5c[_0xb484('0x25')];_0x11ac48[_0xb484('0x26')]=_0x423d5c['calleridnum'];_0x11ac48[_0xb484('0x27')]=_0x423d5c[_0xb484('0x27')];_0x11ac48[_0xb484('0x28')]=_0x423d5c[_0xb484('0x28')];_0x11ac48[_0xb484('0x29')]=_0x423d5c['answertime'];_0x11ac48[_0xb484('0x2a')]=_0x423d5c['answertime'];_0x11ac48['queuecallercomplete']=0x1;_0x11ac48[_0xb484('0x2b')]=_0x423d5c[_0xb484('0x2c')];_0x11ac48[_0xb484('0x2d')]=_0x423d5c[_0xb484('0x2e')];_0x11ac48[_0xb484('0x2f')]=_0xb484('0x30');_0x11ac48[_0xb484('0x31')]=_0xb484('0x32');_0x11ac48[_0xb484('0x33')]=0x0;_0x11ac48[_0xb484('0x34')]=0x1;_0x11ac48[_0xb484('0x35')]=_0x423d5c[_0xb484('0x2e')];_0x11ac48[_0xb484('0x36')]='COMPLETED';return BPromise[_0xb484('0xe')]()[_0xb484('0x10')](voiceQueueReport[_0xb484('0x37')](_0x11ac48))['catch'](loggerCatch(_0xb484('0x38')));};exports[_0xb484('0x39')]=function(_0x478f49,_0x557513){return BPromise[_0xb484('0xe')]()[_0xb484('0x10')](cmHopper[_0xb484('0x39')](_0x478f49,_0x557513))[_0xb484('0x13')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xb484('0x3a')]=function(_0x5444f5){return BPromise[_0xb484('0xe')]()[_0xb484('0x10')](cmHopper['rescheduleContact'](_0x5444f5,!![],!![]))[_0xb484('0x13')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0xd271=['queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','COMPLETED','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','rescheduleContact','[rescheduleContactInQueue]\x20','util','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','resolve','then','createHistory','[createHistory]\x20','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','UserId','countReScheduled','unlockContact','[unlockContact]\x20','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xd271,0x75));var _0x1d27=function(_0x31dd78,_0x88b239){_0x31dd78=_0x31dd78-0x0;var _0x5da910=_0xd271[_0x31dd78];return _0x5da910;};'use strict';var util=require(_0x1d27('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x1d27('0x1'));var _=require(_0x1d27('0x2'));var cmHopper=require(_0x1d27('0x3'));var cmHopperFinal=require(_0x1d27('0x4'));var cmHopperHistory=require(_0x1d27('0x5'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x1d27('0x6'));var agentReportPreview=require(_0x1d27('0x7'));var voiceQueueReport=require(_0x1d27('0x8'));function loggerCatch(_0x50cd79){return function(_0x274afa){logger['error'](_0x50cd79,util['inspect'](_0x274afa,{'showHidden':![],'depth':null}));};}function create(_0x57dd72){return BPromise[_0x1d27('0x9')]()[_0x1d27('0xa')](cmHopperHistory[_0x1d27('0xb')](_0x57dd72))['catch'](loggerCatch(_0x1d27('0xc')));}function createAgent(_0xc8e9ed){return BPromise[_0x1d27('0x9')]()[_0x1d27('0xa')](agentReportPreview[_0x1d27('0xb')](_0xc8e9ed))[_0x1d27('0xd')](loggerCatch(_0x1d27('0xc')));}function moveContact(_0x4e5a99){return BPromise['resolve']()['then'](cmHopper[_0x1d27('0xe')](_0x4e5a99,!![]))[_0x1d27('0xd')](loggerCatch(_0x1d27('0xf')));}exports[_0x1d27('0x10')]=function(_0xe7ad7e){return BPromise['resolve']()[_0x1d27('0xa')](cmHopperBlack[_0x1d27('0x10')](_0xe7ad7e))[_0x1d27('0xd')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x1d27('0x11')]=function(_0x376163){return BPromise[_0x1d27('0x9')]()['then'](cmHopper['getContactPreview'](_0x376163))['catch'](loggerCatch(_0x1d27('0x12')));};exports[_0x1d27('0xb')]=function(_0x22795c,_0x4e0e24){create(_0x22795c)[_0x1d27('0xd')](loggerCatch(_0x4e0e24));moveContact(_0x22795c)[_0x1d27('0xd')](loggerCatch(_0x4e0e24));};exports['createAgentHistory']=function(_0x2b3e6b,_0x525584){createAgent(_0x2b3e6b)[_0x1d27('0xd')](loggerCatch(_0x525584));};exports[_0x1d27('0x13')]=function(_0x4503ef,_0x3ef533){create(_0x4503ef)[_0x1d27('0xd')](loggerCatch(_0x3ef533));};exports[_0x1d27('0x14')]=function(_0x4354ae,_0x21caca){moveContact(_0x4354ae)['catch'](loggerCatch(_0x21caca));};exports['rescheduleContact']=function(_0xae545d,_0x4585de,_0x327496){if(_0x4585de){_0xae545d[_0x1d27('0x15')]=null;}if(_0x327496){_0xae545d['active']=![];}return BPromise[_0x1d27('0x9')]()[_0x1d27('0xa')](cmHopper['rescheduleContact'](_0xae545d))[_0x1d27('0xd')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x1d27('0x16')]=function(_0x3cf92a){return BPromise[_0x1d27('0x9')]()[_0x1d27('0xa')](cmHopper[_0x1d27('0x16')](_0x3cf92a))[_0x1d27('0xd')](loggerCatch('[countReScheduled]\x20'));};exports[_0x1d27('0x17')]=function(_0x53f1e8){return BPromise[_0x1d27('0x9')]()[_0x1d27('0xa')](cmHopper[_0x1d27('0x17')]({'UserId':null},_0x53f1e8,0x1))[_0x1d27('0xd')](loggerCatch(_0x1d27('0x18')));};exports['disableContact']=function(_0x2dcfd5){return BPromise['resolve']()[_0x1d27('0xa')](cmHopper[_0x1d27('0x17')]({'active':![]},_0x2dcfd5,0x1))[_0x1d27('0xd')](loggerCatch(_0x1d27('0x19')));};exports['crateCustomerReportQueue']=function(_0x3c28b3){var _0x3517cc={};_0x3517cc[_0x1d27('0x1a')]=_0x3c28b3[_0x1d27('0x1a')];_0x3517cc[_0x1d27('0x1b')]=_0x3c28b3[_0x1d27('0x1b')];_0x3517cc[_0x1d27('0x1c')]=_0x3c28b3[_0x1d27('0x1c')];_0x3517cc['calleridname']=_0x3c28b3[_0x1d27('0x1d')];_0x3517cc[_0x1d27('0x1e')]=_0x3c28b3[_0x1d27('0x1e')];_0x3517cc[_0x1d27('0x1f')]=_0x3c28b3[_0x1d27('0x20')];_0x3517cc[_0x1d27('0x21')]=_0x3c28b3['answertime'];_0x3517cc[_0x1d27('0x22')]=0x1;_0x3517cc[_0x1d27('0x23')]=_0x3c28b3['endtime'];_0x3517cc[_0x1d27('0x24')]=_0x3c28b3[_0x1d27('0x25')];_0x3517cc['context']=_0x1d27('0x26');_0x3517cc[_0x1d27('0x27')]=_0x1d27('0x28');_0x3517cc[_0x1d27('0x29')]=0x0;_0x3517cc[_0x1d27('0x2a')]=0x1;_0x3517cc[_0x1d27('0x2b')]=_0x3c28b3[_0x1d27('0x25')];_0x3517cc['queuecallerexitreason']=_0x1d27('0x2c');return BPromise[_0x1d27('0x9')]()[_0x1d27('0xa')](voiceQueueReport['create'](_0x3517cc))[_0x1d27('0xd')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x1d27('0x2d')]=function(_0x363b2e,_0xefef63){return BPromise['resolve']()[_0x1d27('0xa')](cmHopper[_0x1d27('0x2d')](_0x363b2e,_0xefef63))[_0x1d27('0xd')](loggerCatch(_0x1d27('0x2e')));};exports[_0x1d27('0x2f')]=function(_0x43dfe8){return BPromise[_0x1d27('0x9')]()[_0x1d27('0xa')](cmHopper[_0x1d27('0x30')](_0x43dfe8,!![],!![]))[_0x1d27('0xd')](loggerCatch(_0x1d27('0x31')));}; \ 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 92b4e47..f7111a4 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 _0x202c=['Failure','variablesAction','calleridname','BOOKED','originate','timeout','uniqueid','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','buildObj','queue','interface','channelAgent','motionChannel','voice','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','reachable','push','getDiff','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','scheduledat','countbusyretry','countcongestionretry','countglobal','callback','callbackat','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','match','util','lodash','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','inspect','error','logger2','info','message','getCallerId','string','isEmpty','\x22%s\x22\x20<%s>','format','isUndefined','\x22\x22\x20<>','isActive','isNil','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','starttime','responsetime','logAgent','state','ringtime','logLookAgent','membername','logCustomer','endtime','talktime','answertime','isFailure'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x202c,0x1ef));var _0xc202=function(_0x1af5a8,_0x1b1723){_0x1af5a8=_0x1af5a8-0x0;var _0xba9f46=_0x202c[_0x1af5a8];return _0xba9f46;};'use strict';var util=require(_0xc202('0x0'));var _=require(_0xc202('0x1'));var moment=require('moment');var logger=require(_0xc202('0x2'))(_0xc202('0x3'));var ipAgi=process[_0xc202('0x4')][_0xc202('0x5')]||_0xc202('0x6');function getSeconds(_0x22aa0b,_0x493029){var _0x398ab0=moment(_0x22aa0b)['milliseconds'](0x0);var _0x3ea23d=moment(_0x493029)[_0xc202('0x7')](0x0);return _0x398ab0[_0xc202('0x8')](_0x3ea23d,_0xc202('0x9'));}exports[_0xc202('0xa')]=function(_0x373532){return function(_0x34ffc6){logger['error'](_0x373532,util[_0xc202('0xb')](_0x34ffc6,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x41990e,_0x51d009){logger['info'](_0x41990e,util['inspect'](_0x51d009,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x446885,_0x34e64c){logger[_0xc202('0xc')](_0x446885,util[_0xc202('0xb')](_0x34e64c,{'showHidden':![],'depth':null}));};exports[_0xc202('0xd')]=function(_0x291437){return function(_0x5056d9){logger[_0xc202('0xe')](_0x291437,util[_0xc202('0xb')](_0x5056d9,{'showHidden':![],'depth':null}));};};exports[_0xc202('0xf')]=function(_0x4e3f32,_0x28a2fd,_0x535ba3){return{'message':_0x4e3f32,'unlock':_0x28a2fd,'active':_0x535ba3};};exports[_0xc202('0x10')]=function(_0x330945,_0x505173,_0x2982c5){if(!_['isUndefined'](_0x2982c5)&&_0xc202('0x11')===typeof _0x2982c5&&!_[_0xc202('0x12')](_0x2982c5)){if(!_['isUndefined'](_0x505173)&&_0xc202('0x11')===typeof _0x505173&&!_[_0xc202('0x12')](_0x505173)){return util['format'](_0xc202('0x13'),_0x505173,_0x2982c5);}return util[_0xc202('0x14')]('\x22%s\x22\x20<%s>',_0x2982c5,_0x2982c5);}if(!_[_0xc202('0x15')](_0x330945)&&_0xc202('0x11')===typeof _0x330945&&!_[_0xc202('0x12')](_0x330945)){return _0x330945;}return _0xc202('0x16');};exports[_0xc202('0x17')]=function(_0x1088ca){if(_[_0xc202('0x18')](_0x1088ca)){return![];}return _0x1088ca;};exports['addVariables']=function(_0x19ad2a,_0xf72cfd,_0x22b62f,_0x2651c2,_0x3696df,_0x52859c){var _0x485ebf={'XMD-QUEUE':_0xf72cfd[_0xc202('0x19')]?_0xf72cfd[_0xc202('0x19')][_0xc202('0x1a')]:'','XMD-CALLERID':_0x2651c2,'XMD-CALLERID-PREVIEW':_0x52859c?util[_0xc202('0x14')](_0xc202('0x13'),_0x52859c['calleridname'],_0x52859c[_0xc202('0x1b')]):_0x2651c2,'XMD-DIALID':_0x3696df,'XMD-CONTACTID':_0xf72cfd[_0xc202('0x1c')],'XMD-CDRTYPE':_0xc202('0x1d'),'CALLERID(all)':_0x2651c2,'XMD-VOICEQUEUEID':_0xf72cfd[_0xc202('0x1e')],'XMD-DIALCHANNEL':_0x22b62f,'XMD-DIALTIMEOUT':_0x19ad2a[_0xc202('0x1f')]||0x1e,'XMD-DIALOPTIONS':util[_0xc202('0x14')]('\x22rtTxX%s%s\x22',_0x19ad2a['dialQueueProject2']?'g':'',_['isEmpty'](_0x19ad2a[_0xc202('0x20')])?'':_0xc202('0x21')),'XMD-DIALURL':_0x19ad2a['dialPreviewUrl']||'','XMD-AGI':_0x19ad2a[_0xc202('0x22')]?util['format'](_0xc202('0x23'),ipAgi,_0x19ad2a[_0xc202('0x22')]):_0xc202('0x24'),'XMD-AGIAFTER':_0x19ad2a[_0xc202('0x25')]?util[_0xc202('0x14')]('\x22agi://%s/square,%s\x22',ipAgi,_0x19ad2a[_0xc202('0x25')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x52859c?_0x52859c['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x52859c?_0x52859c['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0xc202('0x12')](_0x19ad2a[_0xc202('0x20')])){_0x485ebf[util[_0xc202('0x14')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x19ad2a['monitor_format'];_0x485ebf[util[_0xc202('0x14')]('%s',_0xc202('0x26'))]=_0x3696df;}if(_0xf72cfd&&_0xf72cfd['Contact']){for(var _0x5efc67 in _0xf72cfd['Contact']){if(_0xf72cfd[_0xc202('0x27')][_0xc202('0x28')](_0x5efc67)){if(!_[_0xc202('0x18')](_0xf72cfd[_0xc202('0x27')][_0x5efc67])&&_0x5efc67!=='id'&&_0x5efc67!=='tags'&&_0x5efc67!==_0xc202('0x29')&&_0x5efc67!==_0xc202('0x2a')){_0x485ebf[util[_0xc202('0x14')](_0xc202('0x2b'),_0xc202('0x2c'),_[_0xc202('0x2d')](_0x5efc67))]=_0xf72cfd[_0xc202('0x27')][_0x5efc67];}}}}return _0x485ebf;};exports[_0xc202('0x2e')]=function(_0x5c6d9b){var _0x4d6d61={};for(var _0x156b1c in _0x5c6d9b){if(_0x5c6d9b['hasOwnProperty'](_0x156b1c)){_0x4d6d61[util[_0xc202('0x14')]('%s',_['toLower'](_0x156b1c))]=_0x5c6d9b[_0x156b1c];}}return{'variables':_0x4d6d61};};exports['updateOriginated']=function(_0x3690a5,_0x44b05b){if(!_[_0xc202('0x18')](_0x3690a5)){if(_0x3690a5[_0xc202('0x28')](_0xc202('0x2f'))){if(_0x3690a5['originated']>0x0){_0x3690a5[_0xc202('0x2f')]-=0x1;}else{logger[_0xc202('0xc')](_0xc202('0x30'),_0x44b05b);}}}else{logger[_0xc202('0xc')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x44b05b);}};exports[_0xc202('0x31')]=function(_0x467dfc){var _0x4b6337=moment()[_0xc202('0x14')](_0xc202('0x32'));_0x467dfc['state']=0xd;_0x467dfc[_0xc202('0x33')]=_0xc202('0x34');_0x467dfc[_0xc202('0x35')]=_0x4b6337;_0x467dfc[_0xc202('0x36')]=_0x4b6337;_0x467dfc['endtime']=_0x4b6337;};exports[_0xc202('0x37')]=function(_0x5157e6,_0x3fadce,_0x5ba04b){var _0x357baa=moment()[_0xc202('0x14')](_0xc202('0x32'));_0x5157e6[_0xc202('0x38')]=_0x3fadce;_0x5157e6[_0xc202('0x33')]=_0x5ba04b;_0x5157e6[_0xc202('0x36')]=_0x357baa;_0x5157e6[_0xc202('0x39')]=getSeconds(_0x5157e6[_0xc202('0x36')],_0x5157e6['starttime']);};exports[_0xc202('0x3a')]=function(_0x25be89,_0x32c089,_0x4c5d86){_0x25be89[_0xc202('0x3b')]=_0x32c089;_0x25be89['UserId']=_0x4c5d86;};exports[_0xc202('0x3c')]=function(_0x586f7a,_0x2707ec,_0x3e6aea){var _0x4eb635=moment()[_0xc202('0x14')](_0xc202('0x32'));_0x586f7a[_0xc202('0x38')]=_0x2707ec;_0x586f7a[_0xc202('0x33')]=_0x3e6aea;_0x586f7a[_0xc202('0x36')]=_0x586f7a[_0xc202('0x36')]?_0x586f7a['responsetime']:_0x4eb635;_0x586f7a[_0xc202('0x3d')]=_0x586f7a[_0xc202('0x3d')]?_0x586f7a[_0xc202('0x3d')]:_0x4eb635;_0x586f7a['ringtime']=getSeconds(_0x586f7a['responsetime']||0x0,_0x586f7a[_0xc202('0x35')]||0x0);_0x586f7a[_0xc202('0x3e')]=_0x586f7a[_0xc202('0x3f')]?getSeconds(_0x586f7a[_0xc202('0x3d')],_0x586f7a[_0xc202('0x3f')]):0x0;};exports[_0xc202('0x40')]=function(_0x28d71b){return _0x28d71b===_0xc202('0x41');};exports[_0xc202('0x42')]=function(_0x2e6e44,_0x10022b,_0x5a2d48,_0x47c989,_0x20aca9){var _0x373ebd=_0x47c989?'RECALL':_0x2e6e44[_0xc202('0x43')];_0x373ebd=_0x20aca9?_0xc202('0x44'):_0x373ebd;return{'actionid':_0x2e6e44['uniqueid'],'action':_0xc202('0x45'),'channel':_0x2e6e44['channelAgent'],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x373ebd,_0x2e6e44[_0xc202('0x1b')]),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x5a2d48,'timeout':(_0x10022b[_0xc202('0x46')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2e6e44[_0xc202('0x47')]};};exports['totalGlobal']=function(_0x132784){return _0x132784['countbusyretry']+_0x132784['countcongestionretry']+_0x132784[_0xc202('0x48')]+_0x132784['countagentrejectretry']+_0x132784[_0xc202('0x49')];};exports[_0xc202('0x4a')]=function(_0x4d3c3c){var _0x16bfac=_[_0xc202('0x4b')](_0x4d3c3c);_0x16bfac['state']=0xf;_0x16bfac[_0xc202('0x33')]=_0xc202('0x4c');return _0x16bfac;};exports[_0xc202('0x4d')]=function(_0xda612f,_0x57339b,_0x59b7cb){var _0xc4a891={};_0xc4a891[_0x57339b]=_0xda612f[_0x57339b];_0xc4a891[_0xc202('0x4e')]=![];_0xc4a891['scheduledat']=moment()[_0xc202('0x4f')](_0x59b7cb,_0xc202('0x50'))[_0xc202('0x14')](_0xc202('0x32'));_0xc4a891[_0xc202('0x1c')]=_0xda612f[_0xc202('0x1c')];_0xc4a891['ListId']=_0xda612f[_0xc202('0x51')];_0xc4a891[_0xc202('0x1e')]=_0xda612f[_0xc202('0x1e')]||undefined;return _0xc4a891;};exports[_0xc202('0x52')]=function(_0x45558f,_0x3c7d5c){if(!_[_0xc202('0x18')](_0x45558f)){if(_0x45558f[_0xc202('0x53')]>0x0){_0x45558f['pTalking']-=0x1;}else{logger[_0xc202('0xc')](_0x3c7d5c,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xc202('0xc')](_0x3c7d5c,_0xc202('0x54'));}};exports['IsNotLoggedIn']=function(_0x5b0bae){if(_0x5b0bae<=0x0){return!![];}return![];};exports[_0xc202('0x55')]=function(_0x2df054,_0x23a9f5,_0x2bf6a8){_0x2df054['lastevent']=_0x23a9f5;_0x2df054['name']=_0x2df054[_0xc202('0x56')];_0x2df054[_0xc202('0x57')]=_0x2df054[_0xc202('0x58')];_0x2df054[_0xc202('0x59')]=_0xc202('0x5a');if(_0x2bf6a8){_0x2df054[_0xc202('0x5b')]=_0x2bf6a8[_0xc202('0x5b')];}return _0x2df054;};exports[_0xc202('0x5c')]=function(_0x1568cd){var _0x558640={};_0x558640[_0xc202('0x56')]=_0x1568cd['queue'];_0x558640[_0xc202('0x57')]=_0x1568cd['channelAgent'];_0x558640[_0xc202('0x47')]=_0x1568cd[_0xc202('0x47')];return _0x558640;};exports[_0xc202('0x5d')]=function(_0x164e4c){var _0x31cba7=[];for(var _0x5c6ef3 in _0x164e4c){if(_0x164e4c['hasOwnProperty'](_0x5c6ef3)){if(!_[_0xc202('0x18')](_0x164e4c[_0x5c6ef3])&&_0x164e4c[_0x5c6ef3][_0xc202('0x38')]===_0xc202('0x5e')&&_0x164e4c[_0x5c6ef3]['status']===_0xc202('0x5f')){_0x31cba7[_0xc202('0x60')](_0x164e4c[_0x5c6ef3]['id']);}}}return _0x31cba7;};exports[_0xc202('0x61')]=function(_0x5f5020){var _0x382767=moment()[_0xc202('0x7')](0x0);var _0x57289e=moment(_0x5f5020)[_0xc202('0x7')](0x0);return _0x382767[_0xc202('0x8')](_0x57289e,_0xc202('0x9'));};exports[_0xc202('0x62')]=function(_0x58ca8f){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x58ca8f['ContactId'],'ListId':_0x58ca8f[_0xc202('0x51')],'VoiceQueueId':_0x58ca8f[_0xc202('0x1e')]||undefined,'CampaignId':_0x58ca8f[_0xc202('0x63')]||undefined};};exports[_0xc202('0x64')]=function(_0x270e4d){if(_0x270e4d===_0xc202('0x47')||_0x270e4d===_0xc202('0x65')||_0x270e4d===_0xc202('0x56')||_0x270e4d===_0xc202('0x66')||_0x270e4d===_0xc202('0x67')||_0x270e4d===_0xc202('0x68')||_0x270e4d===_0xc202('0x3b')||_0x270e4d==='channelAgent'||_0x270e4d==='calleridname'||_0x270e4d===_0xc202('0x4e')||_0x270e4d===_0xc202('0x1b')||_0x270e4d===_0xc202('0x69')||_0x270e4d===_0xc202('0x6a')||_0x270e4d===_0xc202('0x6b')||_0x270e4d===_0xc202('0x48')||_0x270e4d===_0xc202('0x6c')||_0x270e4d===_0xc202('0x6d')||_0x270e4d==='callbackuniqueid'||_0x270e4d===_0xc202('0x6e')||_0x270e4d===_0xc202('0x6f')||_0x270e4d==='ContactId'||_0x270e4d===_0xc202('0x51')||_0x270e4d===_0xc202('0x70')||_0x270e4d===_0xc202('0x1e')||_0x270e4d===_0xc202('0x71')||_0x270e4d===_0xc202('0x72')||_0x270e4d===_0xc202('0x73')||_0x270e4d===_0xc202('0x74')||_0x270e4d===_0xc202('0x75')||_0x270e4d==='xmd-dialurl'||_0x270e4d==='xmd-dialtimeout'||_0x270e4d===_0xc202('0x76')||_0x270e4d===_0xc202('0x77')||_0x270e4d==='xmd-dialchannel'||_0x270e4d===_0xc202('0x78')||_0x270e4d===_0xc202('0x79')||_0x270e4d===_0xc202('0x7a')||_0x270e4d==='xmd-agiafter'||_0x270e4d===_0xc202('0x7b')||_0x270e4d===_0xc202('0x7c')||_0x270e4d===_0xc202('0x7d')||_0x270e4d===_0xc202('0x7e')||_0x270e4d==='rtpaudioqosjitterbridged'||_0x270e4d==='rtpaudioqosloss'||_0x270e4d===_0xc202('0x7f')||_0x270e4d===_0xc202('0x80')||_0x270e4d===_0xc202('0x81')||_0x270e4d===_0xc202('0x7c')||_0x270e4d===_0xc202('0x7d')||_0x270e4d===_0xc202('0x7e')||_0x270e4d===_0xc202('0x82')||_0x270e4d===_0xc202('0x83')||_0x270e4d===_0xc202('0x7f')||_0x270e4d==='rtpaudioqosrtt'||_0x270e4d==='rtpaudioqosrttbridged'||_0x270e4d===_0xc202('0x84')||_0x270e4d===_0xc202('0x85')||_0x270e4d===_0xc202('0x38')||_0x270e4d===_0xc202('0x33')){return![];}return!![];};exports[_0xc202('0x86')]=function(_0x1b97c1,_0x2b4818){var _0xebf712,_0x2732ef,_0x3962fc;if(_0x2b4818<=0x0){_0x2b4818=0x1;}_0xebf712=new RegExp(_0xc202('0x87')+_0x2b4818+'}$');_0x2732ef=Math[_0xc202('0x88')](0xa,_0x2b4818-0x1);_0x3962fc=Math['pow'](0xa,_0x2b4818)-0x1;return util[_0xc202('0x14')]('%s',_['replace'](_0x1b97c1,_0xebf712,_[_0xc202('0x89')](_0x2732ef,_0x3962fc)));};exports[_0xc202('0x8a')]=function(_0x400788){var _0x406026=_0x400788[_0xc202('0x8b')](/"(.*?)"/);return _0x406026?_0x406026[0x1]:_0x400788;};exports['extractCalleridNumber']=function(_0x3e1280){var _0x1066c3=_0x3e1280[_0xc202('0x8b')](/<(.*?)>/);return _0x1066c3?_0x1066c3[0x1]:_0x3e1280;}; \ No newline at end of file +var _0x5e9e=['lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','reachable','diff','CampaignId','filterKey','type','campaigntype','dialAnswer','callback','callbackuniqueid','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqos','bridgepeer','bridgepvtcallid','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','../../../../config/logger','127.0.0.1','milliseconds','seconds','loggerCatch','error','inspect','logger','info','loggerError','logger2','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','ringtime','logLookAgent','membername','UserId','logCustomer','answertime','isFailure','Failure','variablesAction','BOOKED','originate','channelAgent','from-sip','timeout','uniqueid','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','cloneAction','clone','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj'];(function(_0x24a3c1,_0x49f387){var _0x47e090=function(_0x43202a){while(--_0x43202a){_0x24a3c1['push'](_0x24a3c1['shift']());}};_0x47e090(++_0x49f387);}(_0x5e9e,0x1d9));var _0xe5e9=function(_0x1d6472,_0x55284a){_0x1d6472=_0x1d6472-0x0;var _0x5d4516=_0x5e9e[_0x1d6472];return _0x5d4516;};'use strict';var util=require(_0xe5e9('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0xe5e9('0x1'))('preview');var ipAgi=process['env']['XCALLY_IP_AGI']||_0xe5e9('0x2');function getSeconds(_0x5023a6,_0x365f4b){var _0x4b10e1=moment(_0x5023a6)[_0xe5e9('0x3')](0x0);var _0x44eb8c=moment(_0x365f4b)[_0xe5e9('0x3')](0x0);return _0x4b10e1['diff'](_0x44eb8c,_0xe5e9('0x4'));}exports[_0xe5e9('0x5')]=function(_0x259064){return function(_0x21c6c5){logger[_0xe5e9('0x6')](_0x259064,util[_0xe5e9('0x7')](_0x21c6c5,{'showHidden':![],'depth':null}));};};exports[_0xe5e9('0x8')]=function(_0x20990c,_0x378259){logger[_0xe5e9('0x9')](_0x20990c,util[_0xe5e9('0x7')](_0x378259,{'showHidden':![],'depth':null}));};exports[_0xe5e9('0xa')]=function(_0x5a5dc8,_0x14654d){logger[_0xe5e9('0x6')](_0x5a5dc8,util[_0xe5e9('0x7')](_0x14654d,{'showHidden':![],'depth':null}));};exports[_0xe5e9('0xb')]=function(_0x274e05){return function(_0x1193df){logger[_0xe5e9('0x9')](_0x274e05,util['inspect'](_0x1193df,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x319e9a,_0x410fc2,_0x5c0873){return{'message':_0x319e9a,'unlock':_0x410fc2,'active':_0x5c0873};};exports['getCallerId']=function(_0x120d6b,_0x3b2e64,_0x51ca2e){if(!_[_0xe5e9('0xc')](_0x51ca2e)&&_0xe5e9('0xd')===typeof _0x51ca2e&&!_[_0xe5e9('0xe')](_0x51ca2e)){if(!_['isUndefined'](_0x3b2e64)&&_0xe5e9('0xd')===typeof _0x3b2e64&&!_[_0xe5e9('0xe')](_0x3b2e64)){return util[_0xe5e9('0xf')](_0xe5e9('0x10'),_0x3b2e64,_0x51ca2e);}return util[_0xe5e9('0xf')]('\x22%s\x22\x20<%s>',_0x51ca2e,_0x51ca2e);}if(!_[_0xe5e9('0xc')](_0x120d6b)&&_0xe5e9('0xd')===typeof _0x120d6b&&!_[_0xe5e9('0xe')](_0x120d6b)){return _0x120d6b;}return'\x22\x22\x20<>';};exports[_0xe5e9('0x11')]=function(_0x2d27a6){if(_[_0xe5e9('0x12')](_0x2d27a6)){return![];}return _0x2d27a6;};exports[_0xe5e9('0x13')]=function(_0xe8295e,_0xcf0b76,_0x27a745,_0x4093d3,_0x5c5717,_0xa82da3){var _0x3f2867={'XMD-QUEUE':_0xcf0b76[_0xe5e9('0x14')]?_0xcf0b76[_0xe5e9('0x14')][_0xe5e9('0x15')]:'','XMD-CALLERID':_0x4093d3,'XMD-CALLERID-PREVIEW':_0xa82da3?util['format'](_0xe5e9('0x10'),_0xa82da3[_0xe5e9('0x16')],_0xa82da3[_0xe5e9('0x17')]):_0x4093d3,'XMD-DIALID':_0x5c5717,'XMD-CONTACTID':_0xcf0b76[_0xe5e9('0x18')],'XMD-CDRTYPE':_0xe5e9('0x19'),'CALLERID(all)':_0x4093d3,'XMD-VOICEQUEUEID':_0xcf0b76[_0xe5e9('0x1a')],'XMD-DIALCHANNEL':_0x27a745,'XMD-DIALTIMEOUT':_0xe8295e[_0xe5e9('0x1b')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0xe5e9('0x1c'),_0xe8295e[_0xe5e9('0x1d')]?'g':'',_[_0xe5e9('0xe')](_0xe8295e[_0xe5e9('0x1e')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0xe8295e[_0xe5e9('0x1f')]||'','XMD-AGI':_0xe8295e[_0xe5e9('0x20')]?util['format'](_0xe5e9('0x21'),ipAgi,_0xe8295e[_0xe5e9('0x20')]):_0xe5e9('0x22'),'XMD-AGIAFTER':_0xe8295e[_0xe5e9('0x1d')]?util['format'](_0xe5e9('0x21'),ipAgi,_0xe8295e['dialQueueProject2']):_0xe5e9('0x22'),'XMD-ORIGINATECALLERIDNUM':_0xa82da3?_0xa82da3[_0xe5e9('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0xa82da3?_0xa82da3[_0xe5e9('0x24')]:'','XMD-DESTINATION':_0xe5e9('0x25'),'SIPADDHEADER':_0xe5e9('0x26')};if(!_['isEmpty'](_0xe8295e['monitor_format'])){_0x3f2867[util[_0xe5e9('0xf')]('%s',_0xe5e9('0x27'))]=_0xe8295e[_0xe5e9('0x1e')];_0x3f2867[util[_0xe5e9('0xf')]('%s',_0xe5e9('0x28'))]=_0x5c5717;}if(_0xcf0b76&&_0xcf0b76['Contact']){for(var _0x5d32bb in _0xcf0b76[_0xe5e9('0x29')]){if(_0xcf0b76['Contact'][_0xe5e9('0x2a')](_0x5d32bb)){if(!_[_0xe5e9('0x12')](_0xcf0b76[_0xe5e9('0x29')][_0x5d32bb])&&_0x5d32bb!=='id'&&_0x5d32bb!==_0xe5e9('0x2b')&&_0x5d32bb!==_0xe5e9('0x2c')&&_0x5d32bb!==_0xe5e9('0x2d')){_0x3f2867[util[_0xe5e9('0xf')](_0xe5e9('0x2e'),_0xe5e9('0x2f'),_[_0xe5e9('0x30')](_0x5d32bb))]=_0xcf0b76['Contact'][_0x5d32bb];}}}}return _0x3f2867;};exports['toLowerVariables']=function(_0x48ba02){var _0x59850f={};for(var _0x3b5ef8 in _0x48ba02){if(_0x48ba02[_0xe5e9('0x2a')](_0x3b5ef8)){_0x59850f[util[_0xe5e9('0xf')]('%s',_['toLower'](_0x3b5ef8))]=_0x48ba02[_0x3b5ef8];}}return{'variables':_0x59850f};};exports[_0xe5e9('0x31')]=function(_0x5008d9,_0x553879){if(!_[_0xe5e9('0x12')](_0x5008d9)){if(_0x5008d9[_0xe5e9('0x2a')](_0xe5e9('0x32'))){if(_0x5008d9[_0xe5e9('0x32')]>0x0){_0x5008d9[_0xe5e9('0x32')]-=0x1;}else{logger['error'](_0xe5e9('0x33'),_0x553879);}}}else{logger['error'](_0xe5e9('0x34'),_0x553879);}};exports[_0xe5e9('0x35')]=function(_0xd6cd2){var _0x5d8c31=moment()[_0xe5e9('0xf')]('YYYY-MM-DD\x20HH:mm:ss');_0xd6cd2[_0xe5e9('0x36')]=0xd;_0xd6cd2[_0xe5e9('0x37')]=_0xe5e9('0x38');_0xd6cd2[_0xe5e9('0x39')]=_0x5d8c31;_0xd6cd2[_0xe5e9('0x3a')]=_0x5d8c31;_0xd6cd2[_0xe5e9('0x3b')]=_0x5d8c31;};exports[_0xe5e9('0x3c')]=function(_0x31c3ae,_0x1cb23c,_0x4b4132){var _0x4465a1=moment()[_0xe5e9('0xf')](_0xe5e9('0x3d'));_0x31c3ae['state']=_0x1cb23c;_0x31c3ae[_0xe5e9('0x37')]=_0x4b4132;_0x31c3ae[_0xe5e9('0x3a')]=_0x4465a1;_0x31c3ae[_0xe5e9('0x3e')]=getSeconds(_0x31c3ae['responsetime'],_0x31c3ae[_0xe5e9('0x39')]);};exports[_0xe5e9('0x3f')]=function(_0x436d2d,_0x12a4e5,_0x43c76d){_0x436d2d[_0xe5e9('0x40')]=_0x12a4e5;_0x436d2d[_0xe5e9('0x41')]=_0x43c76d;};exports[_0xe5e9('0x42')]=function(_0x1ee4a3,_0x31e106,_0x38333a){var _0x2f6c0b=moment()[_0xe5e9('0xf')](_0xe5e9('0x3d'));_0x1ee4a3[_0xe5e9('0x36')]=_0x31e106;_0x1ee4a3[_0xe5e9('0x37')]=_0x38333a;_0x1ee4a3[_0xe5e9('0x3a')]=_0x1ee4a3[_0xe5e9('0x3a')]?_0x1ee4a3[_0xe5e9('0x3a')]:_0x2f6c0b;_0x1ee4a3[_0xe5e9('0x3b')]=_0x1ee4a3['endtime']?_0x1ee4a3[_0xe5e9('0x3b')]:_0x2f6c0b;_0x1ee4a3['ringtime']=getSeconds(_0x1ee4a3['responsetime']||0x0,_0x1ee4a3[_0xe5e9('0x39')]||0x0);_0x1ee4a3['talktime']=_0x1ee4a3[_0xe5e9('0x43')]?getSeconds(_0x1ee4a3[_0xe5e9('0x3b')],_0x1ee4a3[_0xe5e9('0x43')]):0x0;};exports[_0xe5e9('0x44')]=function(_0x3b312e){return _0x3b312e===_0xe5e9('0x45');};exports[_0xe5e9('0x46')]=function(_0x180aff,_0xbd9fd,_0x44eb95,_0x178625,_0x40bd13){var _0x5a3ce5=_0x178625?'RECALL':_0x180aff['calleridname'];_0x5a3ce5=_0x40bd13?_0xe5e9('0x47'):_0x5a3ce5;return{'actionid':_0x180aff['uniqueid'],'action':_0xe5e9('0x48'),'channel':_0x180aff[_0xe5e9('0x49')],'callerid':util[_0xe5e9('0xf')](_0xe5e9('0x10'),_0x5a3ce5,_0x180aff[_0xe5e9('0x17')]),'Exten':'xcally-motion-preview','Context':_0xe5e9('0x4a'),'Priority':'1','variable':_0x44eb95,'timeout':(_0xbd9fd[_0xe5e9('0x4b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x180aff[_0xe5e9('0x4c')]};};exports[_0xe5e9('0x4d')]=function(_0x4c4140){return _0x4c4140[_0xe5e9('0x4e')]+_0x4c4140[_0xe5e9('0x4f')]+_0x4c4140[_0xe5e9('0x50')]+_0x4c4140[_0xe5e9('0x51')]+_0x4c4140['countnosuchnumberretry'];};exports[_0xe5e9('0x52')]=function(_0x11bdf4){var _0x5ddf17=_[_0xe5e9('0x53')](_0x11bdf4);_0x5ddf17[_0xe5e9('0x36')]=0xf;_0x5ddf17[_0xe5e9('0x37')]='Global';return _0x5ddf17;};exports['scheduledAt']=function(_0x3c38e2,_0x5ceeae,_0x265e04){var _0x446bde={};_0x446bde[_0x5ceeae]=_0x3c38e2[_0x5ceeae];_0x446bde[_0xe5e9('0x54')]=![];_0x446bde[_0xe5e9('0x55')]=moment()[_0xe5e9('0x56')](_0x265e04,_0xe5e9('0x57'))[_0xe5e9('0xf')](_0xe5e9('0x3d'));_0x446bde[_0xe5e9('0x18')]=_0x3c38e2['ContactId'];_0x446bde['ListId']=_0x3c38e2[_0xe5e9('0x58')];_0x446bde[_0xe5e9('0x1a')]=_0x3c38e2[_0xe5e9('0x1a')]||undefined;return _0x446bde;};exports[_0xe5e9('0x59')]=function(_0xa2b875,_0x31bb8c){if(!_[_0xe5e9('0x12')](_0xa2b875)){if(_0xa2b875[_0xe5e9('0x5a')]>0x0){_0xa2b875['pTalking']-=0x1;}else{logger[_0xe5e9('0x6')](_0x31bb8c,_0xe5e9('0x5b'));}}else{logger[_0xe5e9('0x6')](_0x31bb8c,_0xe5e9('0x5c'));}};exports[_0xe5e9('0x5d')]=function(_0x1c3d40){if(_0x1c3d40<=0x0){return!![];}return![];};exports[_0xe5e9('0x5e')]=function(_0xf92ef4,_0x5f0f18,_0x5c620d){_0xf92ef4[_0xe5e9('0x5f')]=_0x5f0f18;_0xf92ef4[_0xe5e9('0x15')]=_0xf92ef4[_0xe5e9('0x60')];_0xf92ef4[_0xe5e9('0x61')]=_0xf92ef4[_0xe5e9('0x49')];_0xf92ef4[_0xe5e9('0x62')]=_0xe5e9('0x63');if(_0x5c620d){_0xf92ef4[_0xe5e9('0x64')]=_0x5c620d[_0xe5e9('0x64')];}return _0xf92ef4;};exports[_0xe5e9('0x65')]=function(_0x385779){var _0x415580={};_0x415580[_0xe5e9('0x60')]=_0x385779[_0xe5e9('0x60')];_0x415580['interface']=_0x385779[_0xe5e9('0x49')];_0x415580['uniqueid']=_0x385779['uniqueid'];return _0x415580;};exports[_0xe5e9('0x66')]=function(_0x21c3ba){var _0x42e21c=[];for(var _0x273813 in _0x21c3ba){if(_0x21c3ba[_0xe5e9('0x2a')](_0x273813)){if(!_[_0xe5e9('0x12')](_0x21c3ba[_0x273813])&&_0x21c3ba[_0x273813][_0xe5e9('0x36')]===_0xe5e9('0x67')&&_0x21c3ba[_0x273813][_0xe5e9('0x68')]===_0xe5e9('0x69')){_0x42e21c['push'](_0x21c3ba[_0x273813]['id']);}}}return _0x42e21c;};exports['getDiff']=function(_0x2f1a3b){var _0xf87659=moment()[_0xe5e9('0x3')](0x0);var _0x2f6a42=moment(_0x2f1a3b)[_0xe5e9('0x3')](0x0);return _0xf87659[_0xe5e9('0x6a')](_0x2f6a42,'seconds');};exports['createBody']=function(_0x2d799d){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2d799d['ContactId'],'ListId':_0x2d799d[_0xe5e9('0x58')],'VoiceQueueId':_0x2d799d[_0xe5e9('0x1a')]||undefined,'CampaignId':_0x2d799d[_0xe5e9('0x6b')]||undefined};};exports[_0xe5e9('0x6c')]=function(_0x3cc7bb){if(_0x3cc7bb===_0xe5e9('0x4c')||_0x3cc7bb==='idContact'||_0x3cc7bb===_0xe5e9('0x60')||_0x3cc7bb===_0xe5e9('0x6d')||_0x3cc7bb===_0xe5e9('0x6e')||_0x3cc7bb===_0xe5e9('0x6f')||_0x3cc7bb===_0xe5e9('0x40')||_0x3cc7bb==='channelAgent'||_0x3cc7bb===_0xe5e9('0x16')||_0x3cc7bb===_0xe5e9('0x54')||_0x3cc7bb===_0xe5e9('0x17')||_0x3cc7bb==='scheduledat'||_0x3cc7bb==='countbusyretry'||_0x3cc7bb===_0xe5e9('0x4f')||_0x3cc7bb===_0xe5e9('0x50')||_0x3cc7bb==='countglobal'||_0x3cc7bb===_0xe5e9('0x70')||_0x3cc7bb===_0xe5e9('0x71')||_0x3cc7bb==='callbackat'||_0x3cc7bb===_0xe5e9('0x72')||_0x3cc7bb==='ContactId'||_0x3cc7bb===_0xe5e9('0x58')||_0x3cc7bb===_0xe5e9('0x41')||_0x3cc7bb===_0xe5e9('0x1a')||_0x3cc7bb===_0xe5e9('0x73')||_0x3cc7bb===_0xe5e9('0x74')||_0x3cc7bb===_0xe5e9('0x75')||_0x3cc7bb===_0xe5e9('0x76')||_0x3cc7bb===_0xe5e9('0x77')||_0x3cc7bb==='xmd-dialurl'||_0x3cc7bb==='xmd-dialtimeout'||_0x3cc7bb===_0xe5e9('0x78')||_0x3cc7bb===_0xe5e9('0x79')||_0x3cc7bb===_0xe5e9('0x7a')||_0x3cc7bb===_0xe5e9('0x7b')||_0x3cc7bb===_0xe5e9('0x7c')||_0x3cc7bb===_0xe5e9('0x7d')||_0x3cc7bb==='xmd-agiafter'||_0x3cc7bb===_0xe5e9('0x7e')||_0x3cc7bb==='rtpaudioqos'||_0x3cc7bb===_0xe5e9('0x7f')||_0x3cc7bb===_0xe5e9('0x80')||_0x3cc7bb===_0xe5e9('0x81')||_0x3cc7bb===_0xe5e9('0x82')||_0x3cc7bb===_0xe5e9('0x83')||_0x3cc7bb===_0xe5e9('0x84')||_0x3cc7bb==='rtpaudioqosrttbridged'||_0x3cc7bb===_0xe5e9('0x85')||_0x3cc7bb==='rtpaudioqosbridged'||_0x3cc7bb===_0xe5e9('0x80')||_0x3cc7bb===_0xe5e9('0x81')||_0x3cc7bb==='rtpaudioqosloss'||_0x3cc7bb===_0xe5e9('0x83')||_0x3cc7bb===_0xe5e9('0x84')||_0x3cc7bb==='rtpaudioqosrttbridged'||_0x3cc7bb===_0xe5e9('0x86')||_0x3cc7bb===_0xe5e9('0x87')||_0x3cc7bb===_0xe5e9('0x36')||_0x3cc7bb==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x3b8c84,_0x2d4996){var _0x4a2f99,_0x4d827c,_0x40487f;if(_0x2d4996<=0x0){_0x2d4996=0x1;}_0x4a2f99=new RegExp('\x5cw{0,'+_0x2d4996+'}$');_0x4d827c=Math[_0xe5e9('0x88')](0xa,_0x2d4996-0x1);_0x40487f=Math['pow'](0xa,_0x2d4996)-0x1;return util[_0xe5e9('0xf')]('%s',_[_0xe5e9('0x89')](_0x3b8c84,_0x4a2f99,_[_0xe5e9('0x8a')](_0x4d827c,_0x40487f)));};exports[_0xe5e9('0x8b')]=function(_0x4afb5c){var _0x12a345=_0x4afb5c[_0xe5e9('0x8c')](/"(.*?)"/);return _0x12a345?_0x12a345[0x1]:_0x4afb5c;};exports[_0xe5e9('0x8d')]=function(_0x1d6b04){var _0x240603=_0x1d6b04[_0xe5e9('0x8c')](/<(.*?)>/);return _0x240603?_0x240603[0x1]:_0x1d6b04;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 0bcd4ef..eb69ccd 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 _0x3b51=['voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','queueremove','queuepause','voicequeuechannel','voicechannel'];(function(_0x205e5a,_0x5c19fb){var _0x10da58=function(_0x1ba35d){while(--_0x1ba35d){_0x205e5a['push'](_0x205e5a['shift']());}};_0x10da58(++_0x5c19fb);}(_0x3b51,0x192));var _0x13b5=function(_0x57c601,_0x3293a2){_0x57c601=_0x57c601-0x0;var _0x10d301=_0x3b51[_0x57c601];return _0x10d301;};'use strict';exports[_0x13b5('0x0')]={'queue':{'type':_0x13b5('0x1'),'required':!![]},'interface':{'type':_0x13b5('0x1'),'required':!![]},'membername':{'type':_0x13b5('0x1'),'required':!![]},'penalty':{'type':_0x13b5('0x2'),'required':![]},'paused':{'type':_0x13b5('0x3'),'required':![]}};exports[_0x13b5('0x4')]={'queue':{'type':_0x13b5('0x1'),'required':!![]},'interface':{'type':_0x13b5('0x1'),'required':!![]}};exports[_0x13b5('0x5')]={'interface':{'type':'string','required':!![]},'paused':{'type':'boolean'},'reason':{'type':'string','required':![]}};exports['reload']={'module':{'type':_0x13b5('0x1'),'required':![]}};exports[_0x13b5('0x6')]={'uniqueid':{'type':_0x13b5('0x1'),'required':!![]}};exports[_0x13b5('0x7')]={'uniqueid':{'type':_0x13b5('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0x13b5('0x1')},'mixmonitorid':{'type':'string'}};exports[_0x13b5('0x8')]={'uniqueid':{'type':_0x13b5('0x1'),'required':!![]}};exports[_0x13b5('0x9')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x13b5('0x1'),'required':!![]},'context':{'type':_0x13b5('0x1')}}; \ No newline at end of file +var _0x3bee=['voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','reload','voicechannel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3bee,0x72));var _0xe3be=function(_0x215ec3,_0x2d7fd5){_0x215ec3=_0x215ec3-0x0;var _0x1c06a1=_0x3bee[_0x215ec3];return _0x1c06a1;};'use strict';exports[_0xe3be('0x0')]={'queue':{'type':_0xe3be('0x1'),'required':!![]},'interface':{'type':_0xe3be('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0xe3be('0x2'),'required':![]},'paused':{'type':_0xe3be('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0xe3be('0x1'),'required':!![]},'interface':{'type':_0xe3be('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0xe3be('0x1'),'required':!![]},'paused':{'type':_0xe3be('0x3')},'reason':{'type':_0xe3be('0x1'),'required':![]}};exports[_0xe3be('0x4')]={'module':{'type':_0xe3be('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xe3be('0x1'),'required':!![]}};exports[_0xe3be('0x5')]={'uniqueid':{'type':_0xe3be('0x1'),'required':!![]},'filename':{'type':_0xe3be('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xe3be('0x1')}};exports[_0xe3be('0x6')]={'uniqueid':{'type':_0xe3be('0x1'),'required':!![]}};exports[_0xe3be('0x7')]={'uniqueid':{'type':_0xe3be('0x1'),'required':!![]},'exten':{'type':_0xe3be('0x1'),'required':!![]},'context':{'type':_0xe3be('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index c7dc116..5b9ff19 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 _0x2a0d=['deskAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','hasOwnProperty','format','SIP/%s','mapKeys','isNil','interface','name','answered','sumHoldTime','sumDuration','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundAnswerCallsDay','mergeFromDatabase','prototype','initAgents','isUndefined','initTelephones','initTrunks','length','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','merge','initVoiceQueueReports','groupBy','uniqueid','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','total','duration','disposition','ANSWERED','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','exports','bluebird','util','moment','../model/agent','../model/voiceQueue','../model/trigger','../model/template','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts'];(function(_0x1ec181,_0x38eebc){var _0x396655=function(_0x192b19){while(--_0x192b19){_0x1ec181['push'](_0x1ec181['shift']());}};_0x396655(++_0x38eebc);}(_0x2a0d,0x187));var _0xd2a0=function(_0x106e66,_0x2fed6a){_0x106e66=_0x106e66-0x0;var _0x4c98ba=_0x2a0d[_0x106e66];return _0x4c98ba;};'use strict';var BPromise=require(_0xd2a0('0x0'));var util=require(_0xd2a0('0x1'));var _=require('lodash');var moment=require(_0xd2a0('0x2'));var Agent=require(_0xd2a0('0x3'));var Telephone=require('../model/telephone');var Trunk=require('../model/trunk');var VoiceQueue=require(_0xd2a0('0x4'));var Trigger=require(_0xd2a0('0x5'));var Template=require(_0xd2a0('0x6'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0xd2a0('0x7'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xd2a0('0x8'));var FreshdeskAccount=require(_0xd2a0('0x9'));var SugarcrmAccount=require(_0xd2a0('0xa'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xd2a0('0xb'));var VtigerAccount=require(_0xd2a0('0xc'));var ServicenowAccount=require(_0xd2a0('0xd'));var Dynamics365Account=require(_0xd2a0('0xe'));var FreshsalesAccount=require(_0xd2a0('0xf'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0xd2a0('0x10')]={};this[_0xd2a0('0x11')]={};this[_0xd2a0('0x12')]={};this[_0xd2a0('0x13')]={};this[_0xd2a0('0x14')]={};this[_0xd2a0('0x15')]={};this[_0xd2a0('0x16')]={};this[_0xd2a0('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xd2a0('0x18')]={};this[_0xd2a0('0x19')]={};this['queueChannels']={};this[_0xd2a0('0x1a')]={};this['timers']={};this[_0xd2a0('0x1b')]={};this[_0xd2a0('0x1c')]={};this[_0xd2a0('0x1d')]={};this[_0xd2a0('0x1e')]={};this[_0xd2a0('0x1f')]={};this[_0xd2a0('0x20')]={};this[_0xd2a0('0x21')]={};this['vtigerAccounts']={};this[_0xd2a0('0x22')]={};this[_0xd2a0('0x23')]={};this[_0xd2a0('0x24')]={};this[_0xd2a0('0x25')]={};};function freeIsNotKey(_0x513876,_0x43dac2,_0x2e9e12){var _0x513dd5=_['mapKeys'](_0x513876,function(_0x4f5e64,_0x822b3b){return _0x4f5e64[_0x2e9e12];});for(var _0x8e83cc in _0x43dac2){if(_0x43dac2[_0xd2a0('0x26')](_0x8e83cc)){if(!_0x513dd5[_0x8e83cc]){delete _0x43dac2[_0x8e83cc];}}}}function freeIsNotKeySip(_0x565599,_0x4e941f){var _0x52054c=_['mapKeys'](_0x565599,function(_0x4e3f94,_0xba2e1e){return util[_0xd2a0('0x27')](_0xd2a0('0x28'),_0x4e3f94['name']);});for(var _0x54dd25 in _0x4e941f){if(_0x4e941f[_0xd2a0('0x26')](_0x54dd25)){if(!_0x52054c[_0x54dd25]){delete _0x4e941f[_0x54dd25];}}}}function freeIsNotKeyAgent(_0x120007,_0x2f8019){var _0xd1dc41=_[_0xd2a0('0x29')](_0x120007,function(_0x1a6721,_0x4e5775){var _0x2c5020=_[_0xd2a0('0x2a')](_0x1a6721[_0xd2a0('0x2b')])?util['format'](_0xd2a0('0x28'),_0x1a6721[_0xd2a0('0x2c')]):_0x1a6721[_0xd2a0('0x2b')];return _0x2c5020;});for(var _0x5c587d in _0x2f8019){if(_0x2f8019[_0xd2a0('0x26')](_0x5c587d)){if(!_0xd1dc41[_0x5c587d]){delete _0x2f8019[_0x5c587d];}}}}function clearVoiceCallReports(_0x3264f7){_0x3264f7['total']=0x0;_0x3264f7[_0xd2a0('0x2d')]=0x0;_0x3264f7[_0xd2a0('0x2e')]=0x0;_0x3264f7[_0xd2a0('0x2f')]=0x0;_0x3264f7['sumBillable']=0x0;}function clearCampaigns(_0xc9e069){if(!_[_0xd2a0('0x30')](_0xc9e069)){for(var _0x1be2d3 in _0xc9e069){if(_0xc9e069[_0xd2a0('0x26')](_0x1be2d3)){_0xc9e069[_0x1be2d3]['ivrTotalCallsDays']=0x0;_0xc9e069[_0x1be2d3][_0xd2a0('0x31')]=0x0;}}}}function clearVoiceQueues(_0xb30fc9){if(!_[_0xd2a0('0x30')](_0xb30fc9)){for(var _0x51c164 in _0xb30fc9){if(_0xb30fc9[_0xd2a0('0x26')](_0x51c164)){_0xb30fc9[_0x51c164]['total']=0x0;_0xb30fc9[_0x51c164][_0xd2a0('0x2d')]=0x0;_0xb30fc9[_0x51c164][_0xd2a0('0x32')]=0x0;_0xb30fc9[_0x51c164][_0xd2a0('0x33')]=0x0;_0xb30fc9[_0x51c164]['sumHoldTime']=0x0;_0xb30fc9[_0x51c164]['sumDuration']=0x0;_0xb30fc9[_0x51c164][_0xd2a0('0x34')]=0x0;_0xb30fc9[_0x51c164][_0xd2a0('0x35')]=0x0;_0xb30fc9[_0x51c164][_0xd2a0('0x36')]=0x0;_0xb30fc9[_0x51c164][_0xd2a0('0x37')]=0x0;_0xb30fc9[_0x51c164][_0xd2a0('0x38')]=0x0;_0xb30fc9[_0x51c164]['outboundNoSuchCallsDay']=0x0;_0xb30fc9[_0x51c164][_0xd2a0('0x39')]=0x0;_0xb30fc9[_0x51c164][_0xd2a0('0x3a')]=0x0;_0xb30fc9[_0x51c164][_0xd2a0('0x3b')]=0x0;_0xb30fc9[_0x51c164][_0xd2a0('0x3c')]=0x0;_0xb30fc9[_0x51c164][_0xd2a0('0x3d')]=0x0;_0xb30fc9[_0x51c164]['outboundRejectCallsDay']=0x0;_0xb30fc9[_0x51c164]['outboundReCallsDay']=0x0;_0xb30fc9[_0x51c164][_0xd2a0('0x35')]=0x0;_0xb30fc9[_0x51c164][_0xd2a0('0x3e')]=0x0;_0xb30fc9[_0x51c164]['queueStatusComplete']=!![];}}}}Realtime['prototype'][_0xd2a0('0x3f')]=function(_0x3def7f,_0x236063){for(var _0x4c0f6c in _0x236063){if(_0x3def7f[_0xd2a0('0x26')](_0x4c0f6c)){_0x3def7f[_0x4c0f6c]=_0x236063[_0x4c0f6c];}}};Realtime[_0xd2a0('0x40')][_0xd2a0('0x41')]=function(){var _0x867d56=this;return function(_0x1bc44d){if(_0x1bc44d){freeIsNotKeyAgent(_0x1bc44d,_0x867d56[_0xd2a0('0x10')]);for(var _0x3f3d2e=0x0,_0x336426={},_0xfcc324={};_0x3f3d2e<_0x1bc44d['length'];_0x3f3d2e+=0x1){_0x336426=_0x1bc44d[_0x3f3d2e];var _0x24500b=_[_0xd2a0('0x2a')](_0x336426[_0xd2a0('0x2b')])?util[_0xd2a0('0x27')](_0xd2a0('0x28'),_0x336426['name']):_0x336426['interface'];if(_[_0xd2a0('0x42')](_0x867d56[_0xd2a0('0x10')][_0x24500b])){_0x867d56['agents'][_0x24500b]=new Agent(_0x336426);}else{_0x867d56['mergeFromDatabase'](_0x867d56[_0xd2a0('0x10')][_0x24500b],_0x336426);}}}return _0x867d56[_0xd2a0('0x10')];};};Realtime['prototype'][_0xd2a0('0x43')]=function(){var _0x3aa186=this;return function(_0x18a519){if(_0x18a519){freeIsNotKeySip(_0x18a519,_0x3aa186[_0xd2a0('0x11')]);for(var _0x5bda34=0x0,_0x35aa29={},_0x3b3eed={};_0x5bda34<_0x18a519['length'];_0x5bda34+=0x1){_0x35aa29=_0x18a519[_0x5bda34];if(_['isUndefined'](_0x3aa186[_0xd2a0('0x11')][util[_0xd2a0('0x27')]('SIP/%s',_0x35aa29[_0xd2a0('0x2c')])])){_0x3aa186[_0xd2a0('0x11')][util[_0xd2a0('0x27')]('SIP/%s',_0x35aa29[_0xd2a0('0x2c')])]=new Telephone(_0x35aa29);}else{_0x3aa186[_0xd2a0('0x3f')](_0x3aa186[_0xd2a0('0x11')][util[_0xd2a0('0x27')]('SIP/%s',_0x35aa29['name'])],_0x35aa29);}}}return _0x3aa186['telephones'];};};Realtime[_0xd2a0('0x40')][_0xd2a0('0x44')]=function(){var _0x25e0bb=this;return function(_0x19980c){if(_0x19980c){freeIsNotKeySip(_0x19980c,_0x25e0bb[_0xd2a0('0x12')]);for(var _0x19ea03=0x0,_0x4511a1={},_0x430045={};_0x19ea03<_0x19980c[_0xd2a0('0x45')];_0x19ea03+=0x1){_0x4511a1=_0x19980c[_0x19ea03];if(_[_0xd2a0('0x42')](_0x25e0bb['trunks'][util[_0xd2a0('0x27')](_0xd2a0('0x28'),_0x4511a1['name'])])){_0x25e0bb[_0xd2a0('0x12')][util[_0xd2a0('0x27')](_0xd2a0('0x28'),_0x4511a1[_0xd2a0('0x2c')])]=new Trunk(_0x4511a1);}else{_0x25e0bb[_0xd2a0('0x3f')](_0x25e0bb[_0xd2a0('0x12')][util[_0xd2a0('0x27')](_0xd2a0('0x28'),_0x4511a1[_0xd2a0('0x2c')])],_0x4511a1);}}}return _0x25e0bb[_0xd2a0('0x12')];};};Realtime[_0xd2a0('0x40')]['initVoiceQueues']=function(){var _0x4b86c2=this;return function(_0x247ac0){if(_0x247ac0){freeIsNotKey(_0x247ac0,_0x4b86c2[_0xd2a0('0x13')],'name');for(var _0x11b8a9=0x0,_0x74bdaf={},_0x793769={};_0x11b8a9<_0x247ac0[_0xd2a0('0x45')];_0x11b8a9+=0x1){_0x74bdaf=_0x247ac0[_0x11b8a9];if(_[_0xd2a0('0x42')](_0x4b86c2[_0xd2a0('0x13')][_0x74bdaf[_0xd2a0('0x2c')]])){_0x4b86c2[_0xd2a0('0x13')][_0x74bdaf[_0xd2a0('0x2c')]]=new VoiceQueue(_0x74bdaf);}else{_0x4b86c2[_0xd2a0('0x3f')](_0x4b86c2['voiceQueues'][_0x74bdaf['name']],_0x74bdaf);}}}return _0x4b86c2[_0xd2a0('0x13')];};};Realtime['prototype'][_0xd2a0('0x46')]=function(){var _0x31b7f3=this;return function(_0x50f12d){if(_0x50f12d){freeIsNotKey(_0x50f12d,_0x31b7f3['triggers'],'id');for(var _0x270ba6=0x0,_0x21e240={},_0x21c97a={};_0x270ba6<_0x50f12d['length'];_0x270ba6+=0x1){_0x21e240=_0x50f12d[_0x270ba6];if(_[_0xd2a0('0x42')](_0x31b7f3[_0xd2a0('0x14')][_0x21e240['id']])){_0x31b7f3['triggers'][_0x21e240['id']]=new Trigger(_0x21e240);}else{_0x31b7f3[_0xd2a0('0x3f')](_0x31b7f3[_0xd2a0('0x14')][_0x21e240['id']],_0x21e240);}}}return _0x31b7f3['triggers'];};};Realtime['prototype'][_0xd2a0('0x47')]=function(){var _0xda1387=this;return function(_0xdd8358){if(_0xdd8358){freeIsNotKey(_0xdd8358,_0xda1387[_0xd2a0('0x16')],'id');for(var _0x1b9802=0x0,_0x342160={},_0xb1df23={};_0x1b9802<_0xdd8358[_0xd2a0('0x45')];_0x1b9802+=0x1){_0x342160=_0xdd8358[_0x1b9802];if(_[_0xd2a0('0x42')](_0xda1387[_0xd2a0('0x16')][_0x342160['id']])){_0xda1387[_0xd2a0('0x16')][_0x342160['id']]=new Template(_0x342160);}else{_0xda1387[_0xd2a0('0x3f')](_0xda1387['templates'][_0x342160['id']],_0x342160);}}}return _0xda1387[_0xd2a0('0x16')];};};Realtime['prototype'][_0xd2a0('0x48')]=function(){var _0x144de7=this;return function(_0x33b4f7){if(_0x33b4f7){freeIsNotKey(_0x33b4f7,_0x144de7['zendeskAccounts'],'id');for(var _0x5af954=0x0,_0x1c8505={},_0x49fb7a={};_0x5af954<_0x33b4f7[_0xd2a0('0x45')];_0x5af954+=0x1){_0x1c8505=_0x33b4f7[_0x5af954];if(_[_0xd2a0('0x42')](_0x144de7[_0xd2a0('0x1c')][_0x1c8505['id']])){_0x144de7[_0xd2a0('0x1c')][_0x1c8505['id']]=new ZendeskAccount(_0x1c8505);}else{_0x144de7['mergeFromDatabase'](_0x144de7[_0xd2a0('0x1c')][_0x1c8505['id']],_0x1c8505);}}}return _0x144de7[_0xd2a0('0x1c')];};};Realtime[_0xd2a0('0x40')][_0xd2a0('0x49')]=function(){var _0x233f2b=this;return function(_0xbdc281){if(_0xbdc281){freeIsNotKey(_0xbdc281,_0x233f2b[_0xd2a0('0x1d')],'id');for(var _0x1bb8ae=0x0,_0x3fa584={},_0x57f4e3={};_0x1bb8ae<_0xbdc281['length'];_0x1bb8ae+=0x1){_0x3fa584=_0xbdc281[_0x1bb8ae];if(_[_0xd2a0('0x42')](_0x233f2b[_0xd2a0('0x1d')][_0x3fa584['id']])){_0x233f2b[_0xd2a0('0x1d')][_0x3fa584['id']]=new SalesforceAccount(_0x3fa584);}else{_0x233f2b[_0xd2a0('0x3f')](_0x233f2b['salesforceAccounts'][_0x3fa584['id']],_0x3fa584);}}}return _0x233f2b[_0xd2a0('0x1d')];};};Realtime[_0xd2a0('0x40')][_0xd2a0('0x4a')]=function(){var _0x163cd2=this;return function(_0x226336){if(_0x226336){freeIsNotKey(_0x226336,_0x163cd2['freshdeskAccounts'],'id');for(var _0x24da85=0x0,_0x396e4d={},_0x126782={};_0x24da85<_0x226336[_0xd2a0('0x45')];_0x24da85+=0x1){_0x396e4d=_0x226336[_0x24da85];if(_['isUndefined'](_0x163cd2['freshdeskAccounts'][_0x396e4d['id']])){_0x163cd2[_0xd2a0('0x1f')][_0x396e4d['id']]=new FreshdeskAccount(_0x396e4d);}else{_0x163cd2['mergeFromDatabase'](_0x163cd2['freshdeskAccounts'][_0x396e4d['id']],_0x396e4d);}}}return _0x163cd2[_0xd2a0('0x1f')];};};Realtime[_0xd2a0('0x40')][_0xd2a0('0x4b')]=function(){var _0x17de85=this;return function(_0x2afdd4){if(_0x2afdd4){freeIsNotKey(_0x2afdd4,_0x17de85[_0xd2a0('0x20')],'id');for(var _0x362ed0=0x0,_0x34348e={},_0x324412={};_0x362ed0<_0x2afdd4[_0xd2a0('0x45')];_0x362ed0+=0x1){_0x34348e=_0x2afdd4[_0x362ed0];if(_[_0xd2a0('0x42')](_0x17de85[_0xd2a0('0x20')][_0x34348e['id']])){_0x17de85[_0xd2a0('0x20')][_0x34348e['id']]=new ZohoAccount(_0x34348e);}else{_0x17de85[_0xd2a0('0x3f')](_0x17de85[_0xd2a0('0x20')][_0x34348e['id']],_0x34348e);}}}return _0x17de85[_0xd2a0('0x20')];};};Realtime[_0xd2a0('0x40')][_0xd2a0('0x4c')]=function(){var _0x49c7eb=this;return function(_0x4b1421){if(_0x4b1421){freeIsNotKey(_0x4b1421,_0x49c7eb['deskAccounts'],'id');for(var _0x112370=0x0,_0x5eac07={},_0x14f915={};_0x112370<_0x4b1421['length'];_0x112370+=0x1){_0x5eac07=_0x4b1421[_0x112370];if(_[_0xd2a0('0x42')](_0x49c7eb[_0xd2a0('0x21')][_0x5eac07['id']])){_0x49c7eb[_0xd2a0('0x21')][_0x5eac07['id']]=new DeskAccount(_0x5eac07);}else{_0x49c7eb[_0xd2a0('0x3f')](_0x49c7eb['deskAccounts'][_0x5eac07['id']],_0x5eac07);}}}return _0x49c7eb['deskAccounts'];};};Realtime[_0xd2a0('0x40')][_0xd2a0('0x4d')]=function(){var _0x406e36=this;return function(_0x3dc61e){if(_0x3dc61e){freeIsNotKey(_0x3dc61e,_0x406e36['sugarcrmAccounts'],'id');for(var _0x335d1a=0x0,_0x1bb20d={},_0x4c1798={};_0x335d1a<_0x3dc61e[_0xd2a0('0x45')];_0x335d1a+=0x1){_0x1bb20d=_0x3dc61e[_0x335d1a];if(_['isUndefined'](_0x406e36['sugarcrmAccounts'][_0x1bb20d['id']])){_0x406e36['sugarcrmAccounts'][_0x1bb20d['id']]=new SugarcrmAccount(_0x1bb20d);}else{_0x406e36[_0xd2a0('0x3f')](_0x406e36[_0xd2a0('0x1e')][_0x1bb20d['id']],_0x1bb20d);}}}return _0x406e36[_0xd2a0('0x1e')];};};Realtime[_0xd2a0('0x40')][_0xd2a0('0x4e')]=function(){var _0x272384=this;return function(_0x5cad1b){if(_0x5cad1b){freeIsNotKey(_0x5cad1b,_0x272384[_0xd2a0('0x4f')],'id');for(var _0x32ed38=0x0,_0x3862af={},_0x16ad86={};_0x32ed38<_0x5cad1b[_0xd2a0('0x45')];_0x32ed38+=0x1){_0x3862af=_0x5cad1b[_0x32ed38];if(_[_0xd2a0('0x42')](_0x272384['vtigerAccounts'][_0x3862af['id']])){_0x272384[_0xd2a0('0x4f')][_0x3862af['id']]=new VtigerAccount(_0x3862af);}else{_0x272384[_0xd2a0('0x3f')](_0x272384['vtigerAccounts'][_0x3862af['id']],_0x3862af);}}}return _0x272384[_0xd2a0('0x4f')];};};Realtime[_0xd2a0('0x40')][_0xd2a0('0x50')]=function(){var _0x5d4862=this;return function(_0x18f512){if(_0x18f512){freeIsNotKey(_0x18f512,_0x5d4862[_0xd2a0('0x22')],'id');for(var _0x2d0ca6=0x0,_0x179cc5={},_0x6e361f={};_0x2d0ca6<_0x18f512[_0xd2a0('0x45')];_0x2d0ca6+=0x1){_0x179cc5=_0x18f512[_0x2d0ca6];if(_[_0xd2a0('0x42')](_0x5d4862[_0xd2a0('0x22')][_0x179cc5['id']])){_0x5d4862['servicenowAccounts'][_0x179cc5['id']]=new ServicenowAccount(_0x179cc5);}else{_0x5d4862[_0xd2a0('0x3f')](_0x5d4862[_0xd2a0('0x22')][_0x179cc5['id']],_0x179cc5);}}}return _0x5d4862[_0xd2a0('0x22')];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x3dd196=this;return function(_0x33f47b){if(_0x33f47b){freeIsNotKey(_0x33f47b,_0x3dd196[_0xd2a0('0x23')],'id');for(var _0xcb5ddf=0x0,_0x309ad2={},_0x3bfe2c={};_0xcb5ddf<_0x33f47b[_0xd2a0('0x45')];_0xcb5ddf+=0x1){_0x309ad2=_0x33f47b[_0xcb5ddf];if(_[_0xd2a0('0x42')](_0x3dd196['dynamics365Accounts'][_0x309ad2['id']])){_0x3dd196[_0xd2a0('0x23')][_0x309ad2['id']]=new Dynamics365Account(_0x309ad2);}else{_0x3dd196[_0xd2a0('0x3f')](_0x3dd196['dynamics365Accounts'][_0x309ad2['id']],_0x309ad2);}}}return _0x3dd196['dynamics365Accounts'];};};Realtime[_0xd2a0('0x40')][_0xd2a0('0x51')]=function(){var _0xe6966f=this;return function(_0xd8e13b){if(_0xd8e13b){freeIsNotKey(_0xd8e13b,_0xe6966f['freshsalesAccounts'],'id');for(var _0x80cc34=0x0,_0x3d3921={},_0x4704c6={};_0x80cc34<_0xd8e13b[_0xd2a0('0x45')];_0x80cc34+=0x1){_0x3d3921=_0xd8e13b[_0x80cc34];if(_['isUndefined'](_0xe6966f[_0xd2a0('0x24')][_0x3d3921['id']])){_0xe6966f[_0xd2a0('0x24')][_0x3d3921['id']]=new FreshsalesAccount(_0x3d3921);}else{_0xe6966f[_0xd2a0('0x3f')](_0xe6966f['freshsalesAccounts'][_0x3d3921['id']],_0x3d3921);}}}return _0xe6966f[_0xd2a0('0x24')];};};Realtime[_0xd2a0('0x40')]['initVoiceQueueHopperHistory']=function(){var _0x49d3b3=this;return function(_0x2a8f3a){for(var _0x59989c=0x0;_0x59989c<_0x2a8f3a[_0xd2a0('0x45')];_0x59989c+=0x1){_[_0xd2a0('0x52')](_0x49d3b3[_0xd2a0('0x13')][_0x2a8f3a[_0x59989c][_0xd2a0('0x2c')]],_0x2a8f3a[_0x59989c]);}return _0x49d3b3['voiceQueues'];};};Realtime[_0xd2a0('0x40')][_0xd2a0('0x53')]=function(){var _0x4fc7a6=this;return function(_0x11a340){clearVoiceQueues(_0x4fc7a6['voiceQueues']);if(_0x11a340){_0x11a340=_[_0xd2a0('0x54')](_0x11a340,_0xd2a0('0x55'));for(var _0x2a73df in _0x11a340){if(_0x11a340['hasOwnProperty'](_0x2a73df)){var _0x1a8a61={};for(var _0x2cba3a=0x0;_0x2cba3a<_0x11a340[_0x2a73df][_0xd2a0('0x45')];_0x2cba3a+=0x1){var _0x5dbbbc=_0x11a340[_0x2a73df][_0x2cba3a]['queue'];if(_0x4fc7a6[_0xd2a0('0x13')][_0x5dbbbc]){if(_0x11a340[_0x2a73df][_0x2cba3a][_0xd2a0('0x56')]){_0x4fc7a6[_0xd2a0('0x13')][_0x5dbbbc][_0xd2a0('0x32')]+=0x1;}if(_0x11a340[_0x2a73df][_0x2cba3a][_0xd2a0('0x57')]){_0x4fc7a6[_0xd2a0('0x13')][_0x5dbbbc][_0xd2a0('0x33')]+=0x1;}_0x4fc7a6[_0xd2a0('0x13')][_0x5dbbbc]['sumHoldTime']+=moment(_0x11a340[_0x2a73df][_0x2cba3a][_0xd2a0('0x58')])[_0xd2a0('0x59')](moment(_0x11a340[_0x2a73df][_0x2cba3a][_0xd2a0('0x5a')]),_0xd2a0('0x5b'))||0x0;if(_0x2cba3a===_0x11a340[_0x2a73df][_0xd2a0('0x45')]-0x1){_0x4fc7a6[_0xd2a0('0x13')][_0x5dbbbc][_0xd2a0('0x2f')]+=moment(_0x11a340[_0x2a73df][_0x2cba3a][_0xd2a0('0x5c')]||_0x11a340[_0x2a73df][_0x2cba3a][_0xd2a0('0x5d')]||_0x11a340[_0x2a73df][_0x2cba3a][_0xd2a0('0x5e')])['diff'](moment(_0x11a340[_0x2a73df][_0x2cba3a][_0xd2a0('0x5a')]),'seconds')||0x0;_0x4fc7a6[_0xd2a0('0x13')][_0x5dbbbc]['total']+=0x1;if(_0x11a340[_0x2a73df][_0x2cba3a][_0xd2a0('0x5f')]){_0x4fc7a6[_0xd2a0('0x13')][_0x5dbbbc][_0xd2a0('0x2d')]+=0x1;_0x4fc7a6[_0xd2a0('0x13')][_0x5dbbbc][_0xd2a0('0x34')]+=moment(_0x11a340[_0x2a73df][_0x2cba3a][_0xd2a0('0x5c')])[_0xd2a0('0x59')](moment(_0x11a340[_0x2a73df][_0x2cba3a][_0xd2a0('0x58')]),'seconds')||0x0;}}else{_0x4fc7a6[_0xd2a0('0x13')][_0x5dbbbc]['sumDuration']+=_0x4fc7a6[_0xd2a0('0x13')][_0x5dbbbc]['sumHoldTime']||0x0;}}}}}}return _0x4fc7a6[_0xd2a0('0x13')];};};Realtime[_0xd2a0('0x40')][_0xd2a0('0x60')]=function(){var _0x19468e=this;return function(_0x34cbc2){clearVoiceCallReports(_0x19468e[_0xd2a0('0x17')]);if(_0x34cbc2){for(var _0xebec09=0x0;_0xebec09<_0x34cbc2['length'];_0xebec09+=0x1){_0x19468e[_0xd2a0('0x17')][_0xd2a0('0x61')]+=0x1;_0x19468e[_0xd2a0('0x17')][_0xd2a0('0x2f')]+=_0x34cbc2[_0xebec09][_0xd2a0('0x62')];if(_0x34cbc2[_0xebec09][_0xd2a0('0x63')]===_0xd2a0('0x64')){_0x19468e[_0xd2a0('0x17')][_0xd2a0('0x2d')]+=0x1;_0x19468e[_0xd2a0('0x17')][_0xd2a0('0x2e')]+=_0x34cbc2[_0xebec09][_0xd2a0('0x62')]-_0x34cbc2[_0xebec09]['billableseconds']||0x0;_0x19468e[_0xd2a0('0x17')]['sumBillable']+=_0x34cbc2[_0xebec09]['billableseconds'];}}}return _0x19468e[_0xd2a0('0x17')];};};Realtime[_0xd2a0('0x40')][_0xd2a0('0x65')]=function(){var _0x240966=this;return function(_0x1bda9e){if(_0x1bda9e){freeIsNotKey(_0x1bda9e,_0x240966[_0xd2a0('0x15')],_0xd2a0('0x2c'));for(var _0x47ae96=0x0,_0x4ccd9a={};_0x47ae96<_0x1bda9e[_0xd2a0('0x45')];_0x47ae96+=0x1){_0x4ccd9a=_0x1bda9e[_0x47ae96];if(_['isUndefined'](_0x240966[_0xd2a0('0x15')][_0x4ccd9a[_0xd2a0('0x2c')]])){_0x240966[_0xd2a0('0x15')][_0x4ccd9a[_0xd2a0('0x2c')]]=new Campaign(_0x4ccd9a);}else{_0x240966[_0xd2a0('0x3f')](_0x240966[_0xd2a0('0x15')][_0x4ccd9a[_0xd2a0('0x2c')]],_0x4ccd9a);_0x240966[_0xd2a0('0x15')][_0x4ccd9a[_0xd2a0('0x2c')]][_0xd2a0('0x66')]=_0x4ccd9a[_0xd2a0('0x67')]?_0x4ccd9a[_0xd2a0('0x67')][_0xd2a0('0x2c')]:undefined;}}}return _0x240966['campaigns'];};};Realtime[_0xd2a0('0x40')][_0xd2a0('0x68')]=function(){var _0x5c49a9=this;return function(_0x4cd748){if(_0x4cd748){freeIsNotKey(_0x4cd748,_0x5c49a9[_0xd2a0('0x18')],'id');for(var _0x4088f1=0x0,_0x464cc0={};_0x4088f1<_0x4cd748[_0xd2a0('0x45')];_0x4088f1+=0x1){_0x464cc0=_0x4cd748[_0x4088f1];if(_['isUndefined'](_0x5c49a9[_0xd2a0('0x18')][_0x464cc0['id']])){_0x5c49a9[_0xd2a0('0x18')][_0x464cc0['id']]=new VoiceExtension(_0x464cc0);}else{_0x5c49a9['mergeFromDatabase'](_0x5c49a9[_0xd2a0('0x18')][_0x464cc0['id']],_0x464cc0);}}}return _0x5c49a9[_0xd2a0('0x18')];};};Realtime['prototype']['initCampaignHopperHistory']=function(){var _0x325763=this;return function(_0x5daadc){clearCampaigns(_0x325763[_0xd2a0('0x15')]);for(var _0x6e2f2f=0x0;_0x6e2f2f<_0x5daadc[_0xd2a0('0x45')];_0x6e2f2f+=0x1){_[_0xd2a0('0x52')](_0x325763[_0xd2a0('0x15')][_0x5daadc[_0x6e2f2f][_0xd2a0('0x2c')]],_0x5daadc[_0x6e2f2f]);}return _0x325763[_0xd2a0('0x15')];};};Realtime[_0xd2a0('0x40')]['initFaxAccounts']=function(){var _0x3bdd4a=this;return function(_0x13e66b){if(_0x13e66b){freeIsNotKey(_0x13e66b,_0x3bdd4a[_0xd2a0('0x25')],'id');for(var _0x26514f=0x0,_0x528f08={},_0x1578d4={};_0x26514f<_0x13e66b[_0xd2a0('0x45')];_0x26514f+=0x1){_0x528f08=_0x13e66b[_0x26514f];if(_[_0xd2a0('0x42')](_0x3bdd4a['faxAccounts'][_0x528f08['id']])){_0x3bdd4a[_0xd2a0('0x25')][_0x528f08['id']]=new FaxAccount(_0x528f08);}else{_0x3bdd4a[_0xd2a0('0x3f')](_0x3bdd4a['faxAccounts'][_0x528f08['id']],_0x528f08);}}}return _0x3bdd4a[_0xd2a0('0x25')];};};module[_0xd2a0('0x69')]=Realtime; \ No newline at end of file +var _0x5e72=['zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','isNil','name','interface','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','total','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTelephones','SIP/%s','initTrunks','trunks','initVoiceQueues','initTemplates','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','uniqueid','queue','queuecallerexit','queuecallerleaveAt','diff','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','seconds','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','SquareProject','initVoiceExtensions','initCampaignHopperHistory','util','lodash','moment','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','timers'];(function(_0x17b0d4,_0x377add){var _0x2d02c7=function(_0x56e627){while(--_0x56e627){_0x17b0d4['push'](_0x17b0d4['shift']());}};_0x2d02c7(++_0x377add);}(_0x5e72,0x1a2));var _0x25e7=function(_0x39fdda,_0x1994e1){_0x39fdda=_0x39fdda-0x0;var _0x5c9d2f=_0x5e72[_0x39fdda];return _0x5c9d2f;};'use strict';var BPromise=require('bluebird');var util=require(_0x25e7('0x0'));var _=require(_0x25e7('0x1'));var moment=require(_0x25e7('0x2'));var Agent=require('../model/agent');var Telephone=require('../model/telephone');var Trunk=require(_0x25e7('0x3'));var VoiceQueue=require(_0x25e7('0x4'));var Trigger=require(_0x25e7('0x5'));var Template=require(_0x25e7('0x6'));var Campaign=require(_0x25e7('0x7'));var VoiceExtension=require(_0x25e7('0x8'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x25e7('0x9'));var FreshdeskAccount=require(_0x25e7('0xa'));var SugarcrmAccount=require(_0x25e7('0xb'));var ZohoAccount=require(_0x25e7('0xc'));var DeskAccount=require(_0x25e7('0xd'));var VtigerAccount=require(_0x25e7('0xe'));var ServicenowAccount=require(_0x25e7('0xf'));var Dynamics365Account=require(_0x25e7('0x10'));var FreshsalesAccount=require(_0x25e7('0x11'));var FaxAccount=require(_0x25e7('0x12'));var Realtime=function(){this[_0x25e7('0x13')]={};this[_0x25e7('0x14')]={};this['trunks']={};this[_0x25e7('0x15')]={};this[_0x25e7('0x16')]={};this[_0x25e7('0x17')]={};this[_0x25e7('0x18')]={};this[_0x25e7('0x19')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x25e7('0x1a')]={};this[_0x25e7('0x1b')]={};this[_0x25e7('0x1c')]={};this['outboundChannels']={};this[_0x25e7('0x1d')]={};this['settings']={};this[_0x25e7('0x1e')]={};this[_0x25e7('0x1f')]={};this[_0x25e7('0x20')]={};this[_0x25e7('0x21')]={};this['zohoAccounts']={};this[_0x25e7('0x22')]={};this[_0x25e7('0x23')]={};this[_0x25e7('0x24')]={};this[_0x25e7('0x25')]={};this[_0x25e7('0x26')]={};this[_0x25e7('0x27')]={};};function freeIsNotKey(_0x5a56dc,_0x18ecd4,_0x58c585){var _0x3f1e7b=_[_0x25e7('0x28')](_0x5a56dc,function(_0x196088,_0x3f1c21){return _0x196088[_0x58c585];});for(var _0xbbac04 in _0x18ecd4){if(_0x18ecd4[_0x25e7('0x29')](_0xbbac04)){if(!_0x3f1e7b[_0xbbac04]){delete _0x18ecd4[_0xbbac04];}}}}function freeIsNotKeySip(_0x5e6cee,_0x2c571b){var _0x5c4424=_['mapKeys'](_0x5e6cee,function(_0x1cfe5d,_0xea31af){return util[_0x25e7('0x2a')]('SIP/%s',_0x1cfe5d['name']);});for(var _0x64f29e in _0x2c571b){if(_0x2c571b['hasOwnProperty'](_0x64f29e)){if(!_0x5c4424[_0x64f29e]){delete _0x2c571b[_0x64f29e];}}}}function freeIsNotKeyAgent(_0x59d46a,_0xaae1cc){var _0x563d89=_[_0x25e7('0x28')](_0x59d46a,function(_0x148544,_0x519ba7){var _0x4ba5d0=_[_0x25e7('0x2b')](_0x148544['interface'])?util['format']('SIP/%s',_0x148544[_0x25e7('0x2c')]):_0x148544[_0x25e7('0x2d')];return _0x4ba5d0;});for(var _0x1fb424 in _0xaae1cc){if(_0xaae1cc['hasOwnProperty'](_0x1fb424)){if(!_0x563d89[_0x1fb424]){delete _0xaae1cc[_0x1fb424];}}}}function clearVoiceCallReports(_0x4ee0de){_0x4ee0de['total']=0x0;_0x4ee0de[_0x25e7('0x2e')]=0x0;_0x4ee0de[_0x25e7('0x2f')]=0x0;_0x4ee0de[_0x25e7('0x30')]=0x0;_0x4ee0de[_0x25e7('0x31')]=0x0;}function clearCampaigns(_0x25bf8f){if(!_[_0x25e7('0x32')](_0x25bf8f)){for(var _0x3ea6a5 in _0x25bf8f){if(_0x25bf8f[_0x25e7('0x29')](_0x3ea6a5)){_0x25bf8f[_0x3ea6a5]['ivrTotalCallsDays']=0x0;_0x25bf8f[_0x3ea6a5][_0x25e7('0x33')]=0x0;}}}}function clearVoiceQueues(_0x30b200){if(!_[_0x25e7('0x32')](_0x30b200)){for(var _0x264a75 in _0x30b200){if(_0x30b200[_0x25e7('0x29')](_0x264a75)){_0x30b200[_0x264a75][_0x25e7('0x34')]=0x0;_0x30b200[_0x264a75]['answered']=0x0;_0x30b200[_0x264a75][_0x25e7('0x35')]=0x0;_0x30b200[_0x264a75][_0x25e7('0x36')]=0x0;_0x30b200[_0x264a75][_0x25e7('0x2f')]=0x0;_0x30b200[_0x264a75][_0x25e7('0x30')]=0x0;_0x30b200[_0x264a75][_0x25e7('0x31')]=0x0;_0x30b200[_0x264a75][_0x25e7('0x37')]=0x0;_0x30b200[_0x264a75][_0x25e7('0x38')]=0x0;_0x30b200[_0x264a75][_0x25e7('0x39')]=0x0;_0x30b200[_0x264a75][_0x25e7('0x3a')]=0x0;_0x30b200[_0x264a75][_0x25e7('0x3b')]=0x0;_0x30b200[_0x264a75][_0x25e7('0x3c')]=0x0;_0x30b200[_0x264a75]['outboundDropCallsDayTimeout']=0x0;_0x30b200[_0x264a75][_0x25e7('0x3d')]=0x0;_0x30b200[_0x264a75][_0x25e7('0x3e')]=0x0;_0x30b200[_0x264a75][_0x25e7('0x3f')]=0x0;_0x30b200[_0x264a75][_0x25e7('0x40')]=0x0;_0x30b200[_0x264a75][_0x25e7('0x41')]=0x0;_0x30b200[_0x264a75]['outboundAnswerAgiCallsDay']=0x0;_0x30b200[_0x264a75][_0x25e7('0x42')]=0x0;_0x30b200[_0x264a75][_0x25e7('0x43')]=!![];}}}}Realtime[_0x25e7('0x44')][_0x25e7('0x45')]=function(_0x202352,_0x1c710c){for(var _0x2a0a43 in _0x1c710c){if(_0x202352[_0x25e7('0x29')](_0x2a0a43)){_0x202352[_0x2a0a43]=_0x1c710c[_0x2a0a43];}}};Realtime[_0x25e7('0x44')][_0x25e7('0x46')]=function(){var _0xdfea81=this;return function(_0x3e0209){if(_0x3e0209){freeIsNotKeyAgent(_0x3e0209,_0xdfea81[_0x25e7('0x13')]);for(var _0x52eb4e=0x0,_0x1a0c2e={},_0x1ebef6={};_0x52eb4e<_0x3e0209[_0x25e7('0x47')];_0x52eb4e+=0x1){_0x1a0c2e=_0x3e0209[_0x52eb4e];var _0x3f5a16=_[_0x25e7('0x2b')](_0x1a0c2e['interface'])?util[_0x25e7('0x2a')]('SIP/%s',_0x1a0c2e[_0x25e7('0x2c')]):_0x1a0c2e[_0x25e7('0x2d')];if(_[_0x25e7('0x48')](_0xdfea81[_0x25e7('0x13')][_0x3f5a16])){_0xdfea81[_0x25e7('0x13')][_0x3f5a16]=new Agent(_0x1a0c2e);}else{_0xdfea81[_0x25e7('0x45')](_0xdfea81[_0x25e7('0x13')][_0x3f5a16],_0x1a0c2e);}}}return _0xdfea81[_0x25e7('0x13')];};};Realtime[_0x25e7('0x44')][_0x25e7('0x49')]=function(){var _0x21be3d=this;return function(_0x3c1cee){if(_0x3c1cee){freeIsNotKeySip(_0x3c1cee,_0x21be3d[_0x25e7('0x14')]);for(var _0x5cd5d3=0x0,_0x320742={},_0x10641a={};_0x5cd5d3<_0x3c1cee[_0x25e7('0x47')];_0x5cd5d3+=0x1){_0x320742=_0x3c1cee[_0x5cd5d3];if(_[_0x25e7('0x48')](_0x21be3d['telephones'][util['format'](_0x25e7('0x4a'),_0x320742[_0x25e7('0x2c')])])){_0x21be3d[_0x25e7('0x14')][util[_0x25e7('0x2a')](_0x25e7('0x4a'),_0x320742[_0x25e7('0x2c')])]=new Telephone(_0x320742);}else{_0x21be3d[_0x25e7('0x45')](_0x21be3d[_0x25e7('0x14')][util[_0x25e7('0x2a')](_0x25e7('0x4a'),_0x320742[_0x25e7('0x2c')])],_0x320742);}}}return _0x21be3d[_0x25e7('0x14')];};};Realtime['prototype'][_0x25e7('0x4b')]=function(){var _0x1e178f=this;return function(_0x4d90b8){if(_0x4d90b8){freeIsNotKeySip(_0x4d90b8,_0x1e178f[_0x25e7('0x4c')]);for(var _0x2ea9cd=0x0,_0x558817={},_0x53c8e2={};_0x2ea9cd<_0x4d90b8[_0x25e7('0x47')];_0x2ea9cd+=0x1){_0x558817=_0x4d90b8[_0x2ea9cd];if(_[_0x25e7('0x48')](_0x1e178f[_0x25e7('0x4c')][util[_0x25e7('0x2a')](_0x25e7('0x4a'),_0x558817[_0x25e7('0x2c')])])){_0x1e178f[_0x25e7('0x4c')][util[_0x25e7('0x2a')](_0x25e7('0x4a'),_0x558817[_0x25e7('0x2c')])]=new Trunk(_0x558817);}else{_0x1e178f[_0x25e7('0x45')](_0x1e178f[_0x25e7('0x4c')][util['format'](_0x25e7('0x4a'),_0x558817['name'])],_0x558817);}}}return _0x1e178f[_0x25e7('0x4c')];};};Realtime['prototype'][_0x25e7('0x4d')]=function(){var _0x16d50d=this;return function(_0x3adf5a){if(_0x3adf5a){freeIsNotKey(_0x3adf5a,_0x16d50d[_0x25e7('0x15')],_0x25e7('0x2c'));for(var _0x115dde=0x0,_0x1b80a5={},_0x114756={};_0x115dde<_0x3adf5a[_0x25e7('0x47')];_0x115dde+=0x1){_0x1b80a5=_0x3adf5a[_0x115dde];if(_[_0x25e7('0x48')](_0x16d50d['voiceQueues'][_0x1b80a5[_0x25e7('0x2c')]])){_0x16d50d[_0x25e7('0x15')][_0x1b80a5['name']]=new VoiceQueue(_0x1b80a5);}else{_0x16d50d[_0x25e7('0x45')](_0x16d50d[_0x25e7('0x15')][_0x1b80a5[_0x25e7('0x2c')]],_0x1b80a5);}}}return _0x16d50d[_0x25e7('0x15')];};};Realtime['prototype']['initTriggers']=function(){var _0x46eee1=this;return function(_0x11ed81){if(_0x11ed81){freeIsNotKey(_0x11ed81,_0x46eee1['triggers'],'id');for(var _0x1d284f=0x0,_0x50e451={},_0x10b47d={};_0x1d284f<_0x11ed81['length'];_0x1d284f+=0x1){_0x50e451=_0x11ed81[_0x1d284f];if(_[_0x25e7('0x48')](_0x46eee1[_0x25e7('0x16')][_0x50e451['id']])){_0x46eee1[_0x25e7('0x16')][_0x50e451['id']]=new Trigger(_0x50e451);}else{_0x46eee1[_0x25e7('0x45')](_0x46eee1[_0x25e7('0x16')][_0x50e451['id']],_0x50e451);}}}return _0x46eee1[_0x25e7('0x16')];};};Realtime[_0x25e7('0x44')][_0x25e7('0x4e')]=function(){var _0x2ebc21=this;return function(_0x3044b8){if(_0x3044b8){freeIsNotKey(_0x3044b8,_0x2ebc21[_0x25e7('0x18')],'id');for(var _0x28aa57=0x0,_0x3b45e0={},_0x2727a0={};_0x28aa57<_0x3044b8[_0x25e7('0x47')];_0x28aa57+=0x1){_0x3b45e0=_0x3044b8[_0x28aa57];if(_[_0x25e7('0x48')](_0x2ebc21[_0x25e7('0x18')][_0x3b45e0['id']])){_0x2ebc21[_0x25e7('0x18')][_0x3b45e0['id']]=new Template(_0x3b45e0);}else{_0x2ebc21[_0x25e7('0x45')](_0x2ebc21[_0x25e7('0x18')][_0x3b45e0['id']],_0x3b45e0);}}}return _0x2ebc21[_0x25e7('0x18')];};};Realtime[_0x25e7('0x44')]['initZendeskAccounts']=function(){var _0x149aaa=this;return function(_0x409a86){if(_0x409a86){freeIsNotKey(_0x409a86,_0x149aaa[_0x25e7('0x1e')],'id');for(var _0x58d5c8=0x0,_0x5b93b7={},_0x59a709={};_0x58d5c8<_0x409a86[_0x25e7('0x47')];_0x58d5c8+=0x1){_0x5b93b7=_0x409a86[_0x58d5c8];if(_[_0x25e7('0x48')](_0x149aaa[_0x25e7('0x1e')][_0x5b93b7['id']])){_0x149aaa['zendeskAccounts'][_0x5b93b7['id']]=new ZendeskAccount(_0x5b93b7);}else{_0x149aaa[_0x25e7('0x45')](_0x149aaa[_0x25e7('0x1e')][_0x5b93b7['id']],_0x5b93b7);}}}return _0x149aaa[_0x25e7('0x1e')];};};Realtime[_0x25e7('0x44')][_0x25e7('0x4f')]=function(){var _0x37ba63=this;return function(_0x2a0a62){if(_0x2a0a62){freeIsNotKey(_0x2a0a62,_0x37ba63[_0x25e7('0x1f')],'id');for(var _0x137ee8=0x0,_0x3be351={},_0x279b82={};_0x137ee8<_0x2a0a62[_0x25e7('0x47')];_0x137ee8+=0x1){_0x3be351=_0x2a0a62[_0x137ee8];if(_['isUndefined'](_0x37ba63[_0x25e7('0x1f')][_0x3be351['id']])){_0x37ba63['salesforceAccounts'][_0x3be351['id']]=new SalesforceAccount(_0x3be351);}else{_0x37ba63[_0x25e7('0x45')](_0x37ba63[_0x25e7('0x1f')][_0x3be351['id']],_0x3be351);}}}return _0x37ba63['salesforceAccounts'];};};Realtime[_0x25e7('0x44')][_0x25e7('0x50')]=function(){var _0x44200c=this;return function(_0x5859ad){if(_0x5859ad){freeIsNotKey(_0x5859ad,_0x44200c[_0x25e7('0x21')],'id');for(var _0x49b2c6=0x0,_0x47ed32={},_0x5b4b4e={};_0x49b2c6<_0x5859ad[_0x25e7('0x47')];_0x49b2c6+=0x1){_0x47ed32=_0x5859ad[_0x49b2c6];if(_[_0x25e7('0x48')](_0x44200c[_0x25e7('0x21')][_0x47ed32['id']])){_0x44200c[_0x25e7('0x21')][_0x47ed32['id']]=new FreshdeskAccount(_0x47ed32);}else{_0x44200c['mergeFromDatabase'](_0x44200c[_0x25e7('0x21')][_0x47ed32['id']],_0x47ed32);}}}return _0x44200c['freshdeskAccounts'];};};Realtime[_0x25e7('0x44')][_0x25e7('0x51')]=function(){var _0x5cfb15=this;return function(_0x4950e0){if(_0x4950e0){freeIsNotKey(_0x4950e0,_0x5cfb15[_0x25e7('0x52')],'id');for(var _0x498e18=0x0,_0x27daa7={},_0x496133={};_0x498e18<_0x4950e0['length'];_0x498e18+=0x1){_0x27daa7=_0x4950e0[_0x498e18];if(_['isUndefined'](_0x5cfb15[_0x25e7('0x52')][_0x27daa7['id']])){_0x5cfb15[_0x25e7('0x52')][_0x27daa7['id']]=new ZohoAccount(_0x27daa7);}else{_0x5cfb15[_0x25e7('0x45')](_0x5cfb15['zohoAccounts'][_0x27daa7['id']],_0x27daa7);}}}return _0x5cfb15[_0x25e7('0x52')];};};Realtime[_0x25e7('0x44')][_0x25e7('0x53')]=function(){var _0x59da6b=this;return function(_0x1d9fc1){if(_0x1d9fc1){freeIsNotKey(_0x1d9fc1,_0x59da6b[_0x25e7('0x22')],'id');for(var _0xd1b9da=0x0,_0x581606={},_0x2caa4d={};_0xd1b9da<_0x1d9fc1['length'];_0xd1b9da+=0x1){_0x581606=_0x1d9fc1[_0xd1b9da];if(_[_0x25e7('0x48')](_0x59da6b[_0x25e7('0x22')][_0x581606['id']])){_0x59da6b[_0x25e7('0x22')][_0x581606['id']]=new DeskAccount(_0x581606);}else{_0x59da6b[_0x25e7('0x45')](_0x59da6b[_0x25e7('0x22')][_0x581606['id']],_0x581606);}}}return _0x59da6b[_0x25e7('0x22')];};};Realtime[_0x25e7('0x44')][_0x25e7('0x54')]=function(){var _0x2a759f=this;return function(_0x2831be){if(_0x2831be){freeIsNotKey(_0x2831be,_0x2a759f[_0x25e7('0x20')],'id');for(var _0x3cc048=0x0,_0x93cf89={},_0x4fbff3={};_0x3cc048<_0x2831be['length'];_0x3cc048+=0x1){_0x93cf89=_0x2831be[_0x3cc048];if(_[_0x25e7('0x48')](_0x2a759f[_0x25e7('0x20')][_0x93cf89['id']])){_0x2a759f['sugarcrmAccounts'][_0x93cf89['id']]=new SugarcrmAccount(_0x93cf89);}else{_0x2a759f[_0x25e7('0x45')](_0x2a759f['sugarcrmAccounts'][_0x93cf89['id']],_0x93cf89);}}}return _0x2a759f[_0x25e7('0x20')];};};Realtime[_0x25e7('0x44')][_0x25e7('0x55')]=function(){var _0x1d33e3=this;return function(_0x4f4e2b){if(_0x4f4e2b){freeIsNotKey(_0x4f4e2b,_0x1d33e3['vtigerAccounts'],'id');for(var _0xc84b72=0x0,_0x3b995e={},_0x541de7={};_0xc84b72<_0x4f4e2b[_0x25e7('0x47')];_0xc84b72+=0x1){_0x3b995e=_0x4f4e2b[_0xc84b72];if(_[_0x25e7('0x48')](_0x1d33e3['vtigerAccounts'][_0x3b995e['id']])){_0x1d33e3[_0x25e7('0x23')][_0x3b995e['id']]=new VtigerAccount(_0x3b995e);}else{_0x1d33e3['mergeFromDatabase'](_0x1d33e3[_0x25e7('0x23')][_0x3b995e['id']],_0x3b995e);}}}return _0x1d33e3['vtigerAccounts'];};};Realtime[_0x25e7('0x44')][_0x25e7('0x56')]=function(){var _0xd774a1=this;return function(_0x422f6a){if(_0x422f6a){freeIsNotKey(_0x422f6a,_0xd774a1[_0x25e7('0x24')],'id');for(var _0x2b61df=0x0,_0x40ae50={},_0x1cd96e={};_0x2b61df<_0x422f6a[_0x25e7('0x47')];_0x2b61df+=0x1){_0x40ae50=_0x422f6a[_0x2b61df];if(_[_0x25e7('0x48')](_0xd774a1[_0x25e7('0x24')][_0x40ae50['id']])){_0xd774a1[_0x25e7('0x24')][_0x40ae50['id']]=new ServicenowAccount(_0x40ae50);}else{_0xd774a1[_0x25e7('0x45')](_0xd774a1[_0x25e7('0x24')][_0x40ae50['id']],_0x40ae50);}}}return _0xd774a1[_0x25e7('0x24')];};};Realtime['prototype'][_0x25e7('0x57')]=function(){var _0x5ba53f=this;return function(_0x40a8fd){if(_0x40a8fd){freeIsNotKey(_0x40a8fd,_0x5ba53f[_0x25e7('0x25')],'id');for(var _0x2fbfc9=0x0,_0x1de7bb={},_0x10fcba={};_0x2fbfc9<_0x40a8fd[_0x25e7('0x47')];_0x2fbfc9+=0x1){_0x1de7bb=_0x40a8fd[_0x2fbfc9];if(_['isUndefined'](_0x5ba53f[_0x25e7('0x25')][_0x1de7bb['id']])){_0x5ba53f[_0x25e7('0x25')][_0x1de7bb['id']]=new Dynamics365Account(_0x1de7bb);}else{_0x5ba53f['mergeFromDatabase'](_0x5ba53f['dynamics365Accounts'][_0x1de7bb['id']],_0x1de7bb);}}}return _0x5ba53f['dynamics365Accounts'];};};Realtime[_0x25e7('0x44')][_0x25e7('0x58')]=function(){var _0x33c4c8=this;return function(_0x5231de){if(_0x5231de){freeIsNotKey(_0x5231de,_0x33c4c8[_0x25e7('0x26')],'id');for(var _0x2b06be=0x0,_0x289f7a={},_0x17fa1f={};_0x2b06be<_0x5231de[_0x25e7('0x47')];_0x2b06be+=0x1){_0x289f7a=_0x5231de[_0x2b06be];if(_['isUndefined'](_0x33c4c8[_0x25e7('0x26')][_0x289f7a['id']])){_0x33c4c8[_0x25e7('0x26')][_0x289f7a['id']]=new FreshsalesAccount(_0x289f7a);}else{_0x33c4c8[_0x25e7('0x45')](_0x33c4c8[_0x25e7('0x26')][_0x289f7a['id']],_0x289f7a);}}}return _0x33c4c8[_0x25e7('0x26')];};};Realtime[_0x25e7('0x44')][_0x25e7('0x59')]=function(){var _0x42a330=this;return function(_0x1c5af1){for(var _0x4efacc=0x0;_0x4efacc<_0x1c5af1[_0x25e7('0x47')];_0x4efacc+=0x1){_[_0x25e7('0x5a')](_0x42a330[_0x25e7('0x15')][_0x1c5af1[_0x4efacc][_0x25e7('0x2c')]],_0x1c5af1[_0x4efacc]);}return _0x42a330[_0x25e7('0x15')];};};Realtime[_0x25e7('0x44')][_0x25e7('0x5b')]=function(){var _0x2fc13e=this;return function(_0x3a4e5e){clearVoiceQueues(_0x2fc13e[_0x25e7('0x15')]);if(_0x3a4e5e){_0x3a4e5e=_['groupBy'](_0x3a4e5e,_0x25e7('0x5c'));for(var _0x160fd0 in _0x3a4e5e){if(_0x3a4e5e['hasOwnProperty'](_0x160fd0)){var _0x29c85c={};for(var _0x35aac5=0x0;_0x35aac5<_0x3a4e5e[_0x160fd0][_0x25e7('0x47')];_0x35aac5+=0x1){var _0x391040=_0x3a4e5e[_0x160fd0][_0x35aac5][_0x25e7('0x5d')];if(_0x2fc13e[_0x25e7('0x15')][_0x391040]){if(_0x3a4e5e[_0x160fd0][_0x35aac5][_0x25e7('0x5e')]){_0x2fc13e[_0x25e7('0x15')][_0x391040][_0x25e7('0x35')]+=0x1;}if(_0x3a4e5e[_0x160fd0][_0x35aac5]['queuecallerabandon']){_0x2fc13e[_0x25e7('0x15')][_0x391040]['abandoned']+=0x1;}_0x2fc13e[_0x25e7('0x15')][_0x391040][_0x25e7('0x2f')]+=moment(_0x3a4e5e[_0x160fd0][_0x35aac5][_0x25e7('0x5f')])[_0x25e7('0x60')](moment(_0x3a4e5e[_0x160fd0][_0x35aac5][_0x25e7('0x61')]),'seconds')||0x0;if(_0x35aac5===_0x3a4e5e[_0x160fd0]['length']-0x1){_0x2fc13e[_0x25e7('0x15')][_0x391040]['sumDuration']+=moment(_0x3a4e5e[_0x160fd0][_0x35aac5][_0x25e7('0x62')]||_0x3a4e5e[_0x160fd0][_0x35aac5][_0x25e7('0x63')]||_0x3a4e5e[_0x160fd0][_0x35aac5][_0x25e7('0x64')])[_0x25e7('0x60')](moment(_0x3a4e5e[_0x160fd0][_0x35aac5][_0x25e7('0x61')]),_0x25e7('0x65'))||0x0;_0x2fc13e[_0x25e7('0x15')][_0x391040][_0x25e7('0x34')]+=0x1;if(_0x3a4e5e[_0x160fd0][_0x35aac5][_0x25e7('0x66')]){_0x2fc13e[_0x25e7('0x15')][_0x391040][_0x25e7('0x2e')]+=0x1;_0x2fc13e[_0x25e7('0x15')][_0x391040][_0x25e7('0x31')]+=moment(_0x3a4e5e[_0x160fd0][_0x35aac5][_0x25e7('0x62')])[_0x25e7('0x60')](moment(_0x3a4e5e[_0x160fd0][_0x35aac5][_0x25e7('0x5f')]),_0x25e7('0x65'))||0x0;}}else{_0x2fc13e['voiceQueues'][_0x391040][_0x25e7('0x30')]+=_0x2fc13e[_0x25e7('0x15')][_0x391040][_0x25e7('0x2f')]||0x0;}}}}}}return _0x2fc13e[_0x25e7('0x15')];};};Realtime[_0x25e7('0x44')][_0x25e7('0x67')]=function(){var _0x174b50=this;return function(_0x4bb5b9){clearVoiceCallReports(_0x174b50[_0x25e7('0x19')]);if(_0x4bb5b9){for(var _0x542398=0x0;_0x542398<_0x4bb5b9[_0x25e7('0x47')];_0x542398+=0x1){_0x174b50['outbound'][_0x25e7('0x34')]+=0x1;_0x174b50[_0x25e7('0x19')][_0x25e7('0x30')]+=_0x4bb5b9[_0x542398][_0x25e7('0x68')];if(_0x4bb5b9[_0x542398][_0x25e7('0x69')]===_0x25e7('0x6a')){_0x174b50[_0x25e7('0x19')][_0x25e7('0x2e')]+=0x1;_0x174b50[_0x25e7('0x19')][_0x25e7('0x2f')]+=_0x4bb5b9[_0x542398][_0x25e7('0x68')]-_0x4bb5b9[_0x542398][_0x25e7('0x6b')]||0x0;_0x174b50['outbound'][_0x25e7('0x31')]+=_0x4bb5b9[_0x542398][_0x25e7('0x6b')];}}}return _0x174b50[_0x25e7('0x19')];};};Realtime[_0x25e7('0x44')][_0x25e7('0x6c')]=function(){var _0x100814=this;return function(_0x38b8b3){if(_0x38b8b3){freeIsNotKey(_0x38b8b3,_0x100814[_0x25e7('0x17')],'name');for(var _0x15440c=0x0,_0x1f9f2d={};_0x15440c<_0x38b8b3[_0x25e7('0x47')];_0x15440c+=0x1){_0x1f9f2d=_0x38b8b3[_0x15440c];if(_[_0x25e7('0x48')](_0x100814['campaigns'][_0x1f9f2d['name']])){_0x100814['campaigns'][_0x1f9f2d['name']]=new Campaign(_0x1f9f2d);}else{_0x100814[_0x25e7('0x45')](_0x100814['campaigns'][_0x1f9f2d[_0x25e7('0x2c')]],_0x1f9f2d);_0x100814[_0x25e7('0x17')][_0x1f9f2d[_0x25e7('0x2c')]]['dialQueueProject']=_0x1f9f2d[_0x25e7('0x6d')]?_0x1f9f2d[_0x25e7('0x6d')][_0x25e7('0x2c')]:undefined;}}}return _0x100814[_0x25e7('0x17')];};};Realtime[_0x25e7('0x44')][_0x25e7('0x6e')]=function(){var _0x19270a=this;return function(_0x723a21){if(_0x723a21){freeIsNotKey(_0x723a21,_0x19270a['voiceExtensions'],'id');for(var _0x1a0cd8=0x0,_0x1978f6={};_0x1a0cd8<_0x723a21[_0x25e7('0x47')];_0x1a0cd8+=0x1){_0x1978f6=_0x723a21[_0x1a0cd8];if(_[_0x25e7('0x48')](_0x19270a[_0x25e7('0x1a')][_0x1978f6['id']])){_0x19270a[_0x25e7('0x1a')][_0x1978f6['id']]=new VoiceExtension(_0x1978f6);}else{_0x19270a[_0x25e7('0x45')](_0x19270a[_0x25e7('0x1a')][_0x1978f6['id']],_0x1978f6);}}}return _0x19270a[_0x25e7('0x1a')];};};Realtime['prototype'][_0x25e7('0x6f')]=function(){var _0x14219c=this;return function(_0xb5f58f){clearCampaigns(_0x14219c[_0x25e7('0x17')]);for(var _0x4b4ad5=0x0;_0x4b4ad5<_0xb5f58f['length'];_0x4b4ad5+=0x1){_[_0x25e7('0x5a')](_0x14219c[_0x25e7('0x17')][_0xb5f58f[_0x4b4ad5]['name']],_0xb5f58f[_0x4b4ad5]);}return _0x14219c[_0x25e7('0x17')];};};Realtime[_0x25e7('0x44')]['initFaxAccounts']=function(){var _0x5c4a52=this;return function(_0x127767){if(_0x127767){freeIsNotKey(_0x127767,_0x5c4a52[_0x25e7('0x27')],'id');for(var _0x5aa41e=0x0,_0x24c0e6={},_0x5c2cef={};_0x5aa41e<_0x127767['length'];_0x5aa41e+=0x1){_0x24c0e6=_0x127767[_0x5aa41e];if(_[_0x25e7('0x48')](_0x5c4a52['faxAccounts'][_0x24c0e6['id']])){_0x5c4a52[_0x25e7('0x27')][_0x24c0e6['id']]=new FaxAccount(_0x24c0e6);}else{_0x5c4a52[_0x25e7('0x45')](_0x5c4a52[_0x25e7('0x27')][_0x24c0e6['id']],_0x24c0e6);}}}return _0x5c4a52[_0x25e7('0x27')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 1c4cea2..d4eb0a8 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 _0x04c9=['connectedlinenum','assigned','lastAssignedTo','interface','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','getCallType','outbound','internal','voiceCallReport','destination','exten','dialer','lastapplication','queue','lastdata','from-voip-provider','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','ANSWERED','linkedid','transfers','transfereelinkedid','uniqueid','blindTransfer','isNil','type','UserId','split','membername','monitor','monitors','filename','createdAt','calleridname','connectedlinename','isArray','forEach','voiceDialReport','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','moment','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','prototype','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','attendedTransfer','findAgent','accountcode','name','find','format','SIP/%s','length'];(function(_0x4f283c,_0x5db666){var _0xd26777=function(_0x93834b){while(--_0x93834b){_0x4f283c['push'](_0x4f283c['shift']());}};_0xd26777(++_0x5db666);}(_0x04c9,0xf5));var _0x904c=function(_0x57a845,_0x276959){_0x57a845=_0x57a845-0x0;var _0x4432da=_0x04c9[_0x57a845];return _0x4432da;};'use strict';var _=require('lodash');var moment=require(_0x904c('0x0'));var util=require(_0x904c('0x1'));var config=require(_0x904c('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x904c('0x3'));var RpcVoiceCallReport=require(_0x904c('0x4'));var RpcVoiceDialReport=require(_0x904c('0x5'));var RpcMemberReport=require(_0x904c('0x6'));var RpcVoiceQueueReport=require(_0x904c('0x7'));var RpcVoiceRecording=require(_0x904c('0x8'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x904c('0x9'));var VoiceCallReport=require(_0x904c('0xa'));var VoiceAgentReport=require(_0x904c('0xb'));var VoiceDialReport=require(_0x904c('0xc'));var UserReport=require(_0x904c('0xd'));function Report(_0x5516bc){this['realtime']=_0x5516bc;this['agents']=_0x5516bc[_0x904c('0xe')];this[_0x904c('0xf')]=_0x5516bc[_0x904c('0xf')];}Report[_0x904c('0x10')]['sync']=function(_0x3e39f9){var _0x106314=new VoiceQueueReport(this[_0x904c('0x11')]);var _0x53e5bf=new VoiceAgentReport(this['realtime']);var _0x1c9e18=new VoiceDialReport(this[_0x904c('0x11')]);var _0x4c3898=new VoiceCallReport(this[_0x904c('0x11')]);var _0x2c3953=new UserReport(this['realtime']);if(config[_0x904c('0x12')]&&config[_0x904c('0x12')][_0x904c('0x13')]){ami['on'](_0x904c('0x14'),this[_0x904c('0x15')][_0x904c('0x16')](this));ami['on'](_0x904c('0x17'),this['voiceCallReport'][_0x904c('0x16')](this));ami['on'](_0x904c('0x18'),this[_0x904c('0x19')]['bind'](this));ami['on']('custom:voiceDialReport',this['voiceDialReport'][_0x904c('0x16')](this));ami['on']('blindtransfer',this['blindTransfer'][_0x904c('0x16')](this));ami['on']('attendedtransfer',this[_0x904c('0x1a')][_0x904c('0x16')](this));}};Report[_0x904c('0x10')][_0x904c('0x1b')]=function(_0xfed513){var _0x135dd4;_0x135dd4=_['find'](this[_0x904c('0xe')],function(_0x3bff73){return _0x3bff73[_0x904c('0x1c')]==_0xfed513||_0x3bff73[_0x904c('0x1d')]==_0xfed513;});if(_['isNil'](_0x135dd4)){var _0x314725=_[_0x904c('0x1e')](this[_0x904c('0xf')],function(_0x230071){return _0x230071['accountcode']==_0xfed513||_0x230071['name']==_0xfed513;});if(_0x314725){_0x135dd4=_['find'](this[_0x904c('0xe')],function(_0x895c18){return _0x895c18['interface']==util[_0x904c('0x1f')](_0x904c('0x20'),_0x314725[_0x904c('0x1d')]);});}}return _0x135dd4;};Report[_0x904c('0x10')][_0x904c('0x15')]=function(_0xab144a){for(var _0x6b1bf8=0x0;_0x6b1bf8<_0xab144a[_0x904c('0x21')];_0x6b1bf8+=0x1){var _0x572aa0=this[_0x904c('0x1b')](_0xab144a[_0x6b1bf8][_0x904c('0x22')]);if(_0x572aa0){_0xab144a[_0x6b1bf8][_0x904c('0x1c')]=_0x572aa0[_0x904c('0x1c')];_0xab144a[_0x6b1bf8][_0x904c('0x23')]=!![];_0xab144a[_0x6b1bf8][_0x904c('0x24')]=_0x572aa0[_0x904c('0x1d')];_0xab144a[_0x6b1bf8][_0x904c('0x25')]=_['isNil'](_0x572aa0[_0x904c('0x25')])?util['format'](_0x904c('0x20'),_0x572aa0[_0x904c('0x1d')]):_0x572aa0['interface'];if(_0xab144a[_0x6b1bf8][_0x904c('0x26')]){_0xab144a[_0x6b1bf8][_0x904c('0x27')]=moment()[_0x904c('0x1f')](_0x904c('0x28'));}if(_0xab144a[_0x6b1bf8][_0x904c('0x29')]){_0xab144a[_0x6b1bf8][_0x904c('0x2a')]=moment()[_0x904c('0x1f')](_0x904c('0x28'));}RpcMemberReport[_0x904c('0x15')](_0xab144a[_0x6b1bf8]);}RpcVoiceQueueReport[_0x904c('0x2b')](_0xab144a[_0x6b1bf8]);}};function extractCalleridNumber(_0x1264b6){var _0x2a2725=_0x1264b6[_0x904c('0x2c')](/<(.*?)>/);return _0x2a2725?_0x2a2725[0x1]:_0x1264b6;}Report[_0x904c('0x10')][_0x904c('0x2d')]=function(_0x37e99f){for(var _0x1de335=0x0;_0x1de335',_0xf0c0f8['calleridname'],_0xf0c0f8[_0x904c('0x3d')]);}if(RpcVoiceTransferReport['transfers'][_0xf0c0f8[_0x904c('0x42')]]){var _0x3a1824=RpcVoiceTransferReport[_0x904c('0x43')][_0xf0c0f8[_0x904c('0x42')]];_0x3a1824[_0x904c('0x44')]=_0xf0c0f8[_0x904c('0x45')];RpcVoiceTransferReport[_0x904c('0x46')](_0x3a1824);delete RpcVoiceTransferReport['transfers'][_0xf0c0f8[_0x904c('0x42')]];}if(_[_0x904c('0x47')](_0xf0c0f8[_0x904c('0x48')])){_0xf0c0f8[_0x904c('0x48')]=this['getCallType'](_0xf0c0f8);}if(_[_0x904c('0x47')](_0xf0c0f8[_0x904c('0x49')])){var _0x1d763c=_0xf0c0f8[_0x904c('0x40')][_0x904c('0x4a')]('-')[0x0];var _0x1aefca=this[_0x904c('0xe')][_0x1d763c];if(!_0x1aefca)_0x1aefca=this[_0x904c('0x2d')](_0xf0c0f8[_0x904c('0x1c')]);if(_0x1aefca){_0xf0c0f8[_0x904c('0x49')]=_0x1aefca['id'];_0xf0c0f8[_0x904c('0x4b')]=_0x1aefca[_0x904c('0x1d')];}}RpcVoiceCallReport[_0x904c('0x2b')](_0xf0c0f8);if(_0xf0c0f8[_0x904c('0x4c')]){for(var _0xa844e6=0x0;_0xa844e6<_0xf0c0f8[_0x904c('0x4d')][_0x904c('0x21')];_0xa844e6+=0x1){_0xf0c0f8['monitorFilename']=_0xf0c0f8[_0x904c('0x4d')][_0xa844e6][_0x904c('0x4e')];_0xf0c0f8[_0x904c('0x4f')]=_0xf0c0f8['monitors'][_0xa844e6]['createdAt'];if(_0xf0c0f8[_0x904c('0x34')]==_0x904c('0x3b')){_0xf0c0f8[_0x904c('0x3d')]=_0xf0c0f8[_0x904c('0x22')];_0xf0c0f8[_0x904c('0x50')]=_0xf0c0f8[_0x904c('0x51')];_0xf0c0f8['connectedlinenum']=_0xf0c0f8[_0x904c('0x1c')];_0xf0c0f8[_0x904c('0x51')]=_0xf0c0f8[_0x904c('0x4b')];_0xf0c0f8[_0x904c('0x34')]=_0xf0c0f8[_0x904c('0x3e')];}else if(_0xf0c0f8[_0x904c('0x34')]=='xcally-motion-dialer'){_0xf0c0f8[_0x904c('0x3d')]=_0xf0c0f8[_0x904c('0x33')];_0xf0c0f8[_0x904c('0x34')]=_0xf0c0f8[_0x904c('0x3e')];}RpcVoiceRecording[_0x904c('0x2b')](_0xf0c0f8);}}};Report[_0x904c('0x10')]['voiceAgentReport']=function(_0x5bd46c){if(_[_0x904c('0x52')](_0x5bd46c)){_0x5bd46c[_0x904c('0x53')](function(_0x4bbf5d){RpcVoiceAgentReport[_0x904c('0x2b')](_0x4bbf5d);});}else{RpcVoiceAgentReport[_0x904c('0x2b')](_0x5bd46c);}};Report['prototype'][_0x904c('0x54')]=function(_0x193928){RpcVoiceDialReport[_0x904c('0x2b')](_0x193928);var _0x23e7c9;var _0x4f4b8d;var _0x57dda7=_0x193928['channel'];if(_['startsWith'](_0x57dda7,_0x904c('0x55'))){_0x4f4b8d=_0x57dda7[_0x904c('0x56')](_0x57dda7['indexOf']('/')+0x1,_0x57dda7[_0x904c('0x57')]('@'));_0x23e7c9=_[_0x904c('0x1e')](this['agents'],function(_0x56e3af){return _0x56e3af[_0x904c('0x58')]==_0x4f4b8d||_0x56e3af[_0x904c('0x59')]==_0x4f4b8d||_0x56e3af[_0x904c('0x1c')]==_0x4f4b8d;});}else{_0x4f4b8d=_0x57dda7[_0x904c('0x56')](_0x57dda7[_0x904c('0x57')]('/')+0x1,_0x57dda7[_0x904c('0x5a')]('-'));_0x23e7c9=this[_0x904c('0x1b')](_0x4f4b8d);}if(_0x23e7c9){_0x193928[_0x904c('0x25')]=_[_0x904c('0x47')](_0x23e7c9[_0x904c('0x25')])?util[_0x904c('0x1f')](_0x904c('0x20'),_0x23e7c9[_0x904c('0x1d')]):_0x23e7c9['interface'];_0x193928[_0x904c('0x4b')]=_0x23e7c9['name'];_0x193928['accountcode']=_0x23e7c9[_0x904c('0x1c')];RpcMemberReport['voiceDialReport'](_0x193928);}};Report['prototype'][_0x904c('0x46')]=function(_0xd1e320){RpcVoiceTransferReport['transfers'][_0xd1e320[_0x904c('0x5b')]]=_0xd1e320;};Report[_0x904c('0x10')][_0x904c('0x1a')]=function(_0x5c99cf){RpcVoiceTransferReport[_0x904c('0x1a')](_0x5c99cf);};module[_0x904c('0x5c')]=Report; \ No newline at end of file +var _0x243f=['queuecallerexitAt','create','match','getAgentByInternal','length','getCallType','split','calleridnum','outbound','voiceCallReport','destination','exten','lastdata','queue','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','channel','destinationchannel','disposition','ANSWERED','connectedlinenum','calleridname','linkedid','transfers','transfereelinkedid','uniqueid','type','UserId','membername','monitor','monitors','monitorFilename','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','lastIndexOf','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','voiceQueueReport','custom:voiceCallReport','bind','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit'];(function(_0x4d4277,_0x31a258){var _0x61626c=function(_0x40a6aa){while(--_0x40a6aa){_0x4d4277['push'](_0x4d4277['shift']());}};_0x61626c(++_0x31a258);}(_0x243f,0x143));var _0xf243=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x243f[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0xf243('0x0'));var moment=require(_0xf243('0x1'));var util=require(_0xf243('0x2'));var config=require(_0xf243('0x3'));var ami=require(_0xf243('0x4'));var RpcVoiceAgentReport=require(_0xf243('0x5'));var RpcVoiceCallReport=require(_0xf243('0x6'));var RpcVoiceDialReport=require(_0xf243('0x7'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0xf243('0x8'));var RpcVoiceRecording=require(_0xf243('0x9'));var RpcVoiceTransferReport=require(_0xf243('0xa'));var VoiceQueueReport=require(_0xf243('0xb'));var VoiceCallReport=require(_0xf243('0xc'));var VoiceAgentReport=require(_0xf243('0xd'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0xf243('0xe'));function Report(_0x1bb777){this[_0xf243('0xf')]=_0x1bb777;this[_0xf243('0x10')]=_0x1bb777[_0xf243('0x10')];this[_0xf243('0x11')]=_0x1bb777[_0xf243('0x11')];}Report[_0xf243('0x12')][_0xf243('0x13')]=function(_0x3725cd){var _0x59a9e7=new VoiceQueueReport(this[_0xf243('0xf')]);var _0x3912fe=new VoiceAgentReport(this[_0xf243('0xf')]);var _0x5a4f84=new VoiceDialReport(this[_0xf243('0xf')]);var _0x24fb21=new VoiceCallReport(this[_0xf243('0xf')]);var _0x4a5027=new UserReport(this['realtime']);if(config[_0xf243('0x14')]&&config['xdr'][_0xf243('0x15')]){ami['on']('custom:voiceQueueReport',this[_0xf243('0x16')]['bind'](this));ami['on'](_0xf243('0x17'),this['voiceCallReport'][_0xf243('0x18')](this));ami['on']('custom:voiceAgentReport',this[_0xf243('0x19')][_0xf243('0x18')](this));ami['on'](_0xf243('0x1a'),this[_0xf243('0x1b')]['bind'](this));ami['on']('blindtransfer',this[_0xf243('0x1c')][_0xf243('0x18')](this));ami['on'](_0xf243('0x1d'),this[_0xf243('0x1e')][_0xf243('0x18')](this));}};Report['prototype'][_0xf243('0x1f')]=function(_0xff7128){var _0x4af39f;_0x4af39f=_[_0xf243('0x20')](this[_0xf243('0x10')],function(_0x438530){return _0x438530[_0xf243('0x21')]==_0xff7128||_0x438530[_0xf243('0x22')]==_0xff7128;});if(_[_0xf243('0x23')](_0x4af39f)){var _0x3801b6=_[_0xf243('0x20')](this['telephones'],function(_0x3fdff0){return _0x3fdff0['accountcode']==_0xff7128||_0x3fdff0['name']==_0xff7128;});if(_0x3801b6){_0x4af39f=_['find'](this[_0xf243('0x10')],function(_0x36da6c){return _0x36da6c[_0xf243('0x24')]==util[_0xf243('0x25')](_0xf243('0x26'),_0x3801b6[_0xf243('0x22')]);});}}return _0x4af39f;};Report[_0xf243('0x12')]['voiceQueueReport']=function(_0x4474d1){for(var _0x4bd66a=0x0;_0x4bd66a<_0x4474d1['length'];_0x4bd66a+=0x1){var _0x5512e0=this[_0xf243('0x1f')](_0x4474d1[_0x4bd66a]['connectedlinenum']);if(_0x5512e0){_0x4474d1[_0x4bd66a][_0xf243('0x21')]=_0x5512e0[_0xf243('0x21')];_0x4474d1[_0x4bd66a][_0xf243('0x27')]=!![];_0x4474d1[_0x4bd66a][_0xf243('0x28')]=_0x5512e0[_0xf243('0x22')];_0x4474d1[_0x4bd66a][_0xf243('0x24')]=_[_0xf243('0x23')](_0x5512e0[_0xf243('0x24')])?util[_0xf243('0x25')](_0xf243('0x26'),_0x5512e0[_0xf243('0x22')]):_0x5512e0[_0xf243('0x24')];if(_0x4474d1[_0x4bd66a][_0xf243('0x29')]){_0x4474d1[_0x4bd66a][_0xf243('0x2a')]=moment()['format'](_0xf243('0x2b'));}if(_0x4474d1[_0x4bd66a][_0xf243('0x2c')]){_0x4474d1[_0x4bd66a][_0xf243('0x2d')]=moment()[_0xf243('0x25')](_0xf243('0x2b'));}RpcMemberReport['voiceQueueReport'](_0x4474d1[_0x4bd66a]);}RpcVoiceQueueReport[_0xf243('0x2e')](_0x4474d1[_0x4bd66a]);}};function extractCalleridNumber(_0x501a7f){var _0x104c75=_0x501a7f[_0xf243('0x2f')](/<(.*?)>/);return _0x104c75?_0x104c75[0x1]:_0x501a7f;}Report[_0xf243('0x12')][_0xf243('0x30')]=function(_0x7e786){for(var _0x3bf86b=0x0;_0x3bf86b',_0x25773a[_0xf243('0x47')],_0x25773a[_0xf243('0x34')]);}if(RpcVoiceTransferReport['transfers'][_0x25773a[_0xf243('0x48')]]){var _0x24a3ba=RpcVoiceTransferReport[_0xf243('0x49')][_0x25773a['linkedid']];_0x24a3ba[_0xf243('0x4a')]=_0x25773a[_0xf243('0x4b')];RpcVoiceTransferReport[_0xf243('0x1c')](_0x24a3ba);delete RpcVoiceTransferReport[_0xf243('0x49')][_0x25773a[_0xf243('0x48')]];}if(_[_0xf243('0x23')](_0x25773a[_0xf243('0x4c')])){_0x25773a[_0xf243('0x4c')]=this[_0xf243('0x32')](_0x25773a);}if(_['isNil'](_0x25773a[_0xf243('0x4d')])){var _0xa8b860=_0x25773a[_0xf243('0x42')]['split']('-')[0x0];var _0x56287e=this[_0xf243('0x10')][_0xa8b860];if(!_0x56287e)_0x56287e=this[_0xf243('0x30')](_0x25773a[_0xf243('0x21')]);if(_0x56287e){_0x25773a[_0xf243('0x4d')]=_0x56287e['id'];_0x25773a[_0xf243('0x4e')]=_0x56287e[_0xf243('0x22')];}}RpcVoiceCallReport[_0xf243('0x2e')](_0x25773a);if(_0x25773a[_0xf243('0x4f')]){for(var _0x41ebee=0x0;_0x41ebee<_0x25773a[_0xf243('0x50')][_0xf243('0x31')];_0x41ebee+=0x1){_0x25773a[_0xf243('0x51')]=_0x25773a[_0xf243('0x50')][_0x41ebee]['filename'];_0x25773a[_0xf243('0x52')]=_0x25773a[_0xf243('0x50')][_0x41ebee][_0xf243('0x52')];if(_0x25773a[_0xf243('0x38')]==_0xf243('0x3f')){_0x25773a['calleridnum']=_0x25773a[_0xf243('0x46')];_0x25773a['calleridname']=_0x25773a[_0xf243('0x53')];_0x25773a[_0xf243('0x46')]=_0x25773a[_0xf243('0x21')];_0x25773a[_0xf243('0x53')]=_0x25773a[_0xf243('0x4e')];_0x25773a[_0xf243('0x38')]=_0x25773a['originatecalleridnum'];}else if(_0x25773a[_0xf243('0x38')]==_0xf243('0x54')){_0x25773a['calleridnum']=_0x25773a[_0xf243('0x37')];_0x25773a['exten']=_0x25773a[_0xf243('0x41')];}RpcVoiceRecording[_0xf243('0x2e')](_0x25773a);}}};Report[_0xf243('0x12')][_0xf243('0x19')]=function(_0x2f32e2){if(_[_0xf243('0x55')](_0x2f32e2)){_0x2f32e2[_0xf243('0x56')](function(_0x176ab5){RpcVoiceAgentReport[_0xf243('0x2e')](_0x176ab5);});}else{RpcVoiceAgentReport['create'](_0x2f32e2);}};Report['prototype'][_0xf243('0x1b')]=function(_0x75f0ec){RpcVoiceDialReport[_0xf243('0x2e')](_0x75f0ec);var _0x2daeb0;var _0xbffbd2;var _0x36c394=_0x75f0ec[_0xf243('0x42')];if(_[_0xf243('0x57')](_0x36c394,_0xf243('0x58'))){_0xbffbd2=_0x36c394[_0xf243('0x59')](_0x36c394[_0xf243('0x5a')]('/')+0x1,_0x36c394['indexOf']('@'));_0x2daeb0=_[_0xf243('0x20')](this[_0xf243('0x10')],function(_0x1726c0){return _0x1726c0['mobile']==_0xbffbd2||_0x1726c0['phone']==_0xbffbd2||_0x1726c0['accountcode']==_0xbffbd2;});}else{_0xbffbd2=_0x36c394[_0xf243('0x59')](_0x36c394[_0xf243('0x5a')]('/')+0x1,_0x36c394[_0xf243('0x5b')]('-'));_0x2daeb0=this[_0xf243('0x1f')](_0xbffbd2);}if(_0x2daeb0){_0x75f0ec[_0xf243('0x24')]=_[_0xf243('0x23')](_0x2daeb0[_0xf243('0x24')])?util[_0xf243('0x25')](_0xf243('0x26'),_0x2daeb0[_0xf243('0x22')]):_0x2daeb0[_0xf243('0x24')];_0x75f0ec[_0xf243('0x4e')]=_0x2daeb0['name'];_0x75f0ec['accountcode']=_0x2daeb0['accountcode'];RpcMemberReport['voiceDialReport'](_0x75f0ec);}};Report[_0xf243('0x12')][_0xf243('0x1c')]=function(_0x3bec2b){RpcVoiceTransferReport['transfers'][_0x3bec2b['transfererlinkedid']]=_0x3bec2b;};Report['prototype']['attendedTransfer']=function(_0x5acee4){RpcVoiceTransferReport['attendedTransfer'](_0x5acee4);};module['exports']=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 1322e96..38b97b7 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x153b=['[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:%s','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','ioredis','bluebird','../../../config/environment','ami','../ami','redis','localhost','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncRealtimeShow','resolve','then','[userReport][sipshowregistry]','inspect','actionDeviceStateList','error','[userReport][devicestatelist]','actionSipPeerStatus','catch','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','debug','username','state','event','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','[userReport][registry]','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','toLowerCase','inuse','local','stateTime','updateStatusRealtime','toNumber','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','indexOf','find','mobile','accountcode','syncPeerStatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status'];(function(_0x53abe5,_0x33a9e5){var _0xc1c37e=function(_0xd53c6e){while(--_0xd53c6e){_0x53abe5['push'](_0x53abe5['shift']());}};_0xc1c37e(++_0x33a9e5);}(_0x153b,0x9a));var _0xb153=function(_0x344397,_0x362498){_0x344397=_0x344397-0x0;var _0x3f7ee8=_0x153b[_0x344397];return _0x3f7ee8;};'use strict';var _=require(_0xb153('0x0'));var moment=require(_0xb153('0x1'));var util=require(_0xb153('0x2'));var Redis=require(_0xb153('0x3'));var BPromise=require(_0xb153('0x4'));var config=require(_0xb153('0x5'));var logger=require('../../../config/logger')(_0xb153('0x6'));var ami=require(_0xb153('0x7'));config[_0xb153('0x8')]=_['defaults'](config[_0xb153('0x8')],{'host':_0xb153('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb153('0x8')]));function UserReport(_0x2db896){this[_0xb153('0xa')]=_0x2db896[_0xb153('0xa')];this['agents']=_0x2db896[_0xb153('0xb')];this[_0xb153('0xc')]=_0x2db896[_0xb153('0xc')];ami['on'](_0xb153('0xd'),this[_0xb153('0xe')][_0xb153('0xf')](this));ami['on'](_0xb153('0x10'),this[_0xb153('0xe')][_0xb153('0xf')](this));ami['on'](_0xb153('0x11'),this[_0xb153('0x12')][_0xb153('0xf')](this));ami['on'](_0xb153('0x13'),this['syncPeerStatus'][_0xb153('0xf')](this));return this[_0xb153('0x14')]();}function showSipRegistrations(){Promise[_0xb153('0x15')]()[_0xb153('0x16')](ami['actionSipShowRegistry']())['catch'](function(_0x157162){logger['error'](_0xb153('0x17'),util[_0xb153('0x18')](_0x157162,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0xb153('0x16')](ami[_0xb153('0x19')]())['catch'](function(_0x3db7b6){logger[_0xb153('0x1a')](_0xb153('0x1b'),util[_0xb153('0x18')](_0x3db7b6,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xb153('0x15')]()['then'](ami[_0xb153('0x1c')]())[_0xb153('0x1d')](function(_0x5a9d2b){logger[_0xb153('0x1a')](_0xb153('0x1e'),util[_0xb153('0x18')](_0x5a9d2b,{'showHidden':![],'depth':null}));});}UserReport['prototype']['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0xb153('0x15')]()['then'](showSipRegistrations())[_0xb153('0x16')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0xb153('0x1f')][_0xb153('0x20')]=function(_0x5128e1){return _0x5128e1!==null&&!_[_0xb153('0x21')](_0x5128e1);};UserReport[_0xb153('0x1f')]['emit']=function(_0x50bc98,_0xbc574e,_0x3f88c1){io['to'](_0x50bc98)[_0xb153('0x22')](_0xbc574e,_0x3f88c1);};UserReport[_0xb153('0x1f')][_0xb153('0xe')]=function(_0x14d5a4){try{if(this['isNotNull'](_0x14d5a4)){logger[_0xb153('0x23')](_0xb153('0x24'),_0x14d5a4['username'],_0x14d5a4['state']);logger[_0xb153('0x25')]('[userReport][registry]',util[_0xb153('0x18')](_0x14d5a4,{'showHidden':![],'depth':null}));var _0x2beea3=_['find'](this[_0xb153('0xa')],{'defaultuser':_0x14d5a4[_0xb153('0x26')]});if(_0x2beea3){_0x14d5a4['stateRegistry']=_0x14d5a4[_0xb153('0x27')];_['merge'](_0x2beea3,_['omit'](_0x14d5a4,[_0xb153('0x28'),'actionid',_0xb153('0x26'),_0xb153('0x27')]));logger[_0xb153('0x25')](_0xb153('0x29'),util[_0xb153('0x18')](_0x2beea3,{'showHidden':![],'depth':null}));this[_0xb153('0x22')](util[_0xb153('0x2a')](_0xb153('0x2b'),_0x2beea3[_0xb153('0x2c')]),_0xb153('0x2d'),_0x2beea3);}}}catch(_0x4d79d0){logger[_0xb153('0x1a')](_0xb153('0x2e'),util[_0xb153('0x18')](_0x4d79d0,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xb153('0x12')]=function(_0x558d00){try{if(this['isNotNull'](_0x558d00)){logger['info'](_0xb153('0x2f'),_0x558d00[_0xb153('0x30')],_0x558d00['state']);logger[_0xb153('0x25')](_0xb153('0x31'),util['inspect'](_0x558d00,{'showHidden':![],'depth':null}));if(this['agents'][_0x558d00[_0xb153('0x30')]]){if(!this[_0xb153('0xb')][_0x558d00[_0xb153('0x30')]]['local']||_0x558d00[_0xb153('0x27')][_0xb153('0x32')]()==_0xb153('0x33')){this[_0xb153('0xb')][_0x558d00[_0xb153('0x30')]][_0xb153('0x34')]=![];if(this[_0xb153('0xb')][_0x558d00[_0xb153('0x30')]][_0xb153('0x27')]!==_0x558d00['state'][_0xb153('0x32')]()){this[_0xb153('0xb')][_0x558d00[_0xb153('0x30')]][_0xb153('0x35')]=_['toNumber'](moment()[_0xb153('0x2a')]('x'));}this['agents'][_0x558d00[_0xb153('0x30')]]['state']=_0x558d00[_0xb153('0x27')][_0xb153('0x32')]();this[_0xb153('0xb')][_0x558d00[_0xb153('0x30')]][_0xb153('0x36')](_0x558d00);}}else if(this[_0xb153('0xc')][_0x558d00[_0xb153('0x30')]]){if(this[_0xb153('0xc')][_0x558d00[_0xb153('0x30')]][_0xb153('0x27')]!==_0x558d00['state'][_0xb153('0x32')]()){this[_0xb153('0xc')][_0x558d00[_0xb153('0x30')]]['stateTime']=_[_0xb153('0x37')](moment()[_0xb153('0x2a')]('x'));}this['telephones'][_0x558d00[_0xb153('0x30')]][_0xb153('0x27')]=_0x558d00[_0xb153('0x27')][_0xb153('0x32')]();logger[_0xb153('0x25')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util['inspect'](this[_0xb153('0xc')][_0x558d00[_0xb153('0x30')]],{'showHidden':![],'depth':null}));this[_0xb153('0x22')](util[_0xb153('0x2a')]('telephone:%s',this['telephones'][_0x558d00[_0xb153('0x30')]][_0xb153('0x2c')]),_0xb153('0x38'),this[_0xb153('0xc')][_0x558d00['device']]);}else if(this[_0xb153('0xa')][_0x558d00[_0xb153('0x30')]]){if(this[_0xb153('0xa')][_0x558d00[_0xb153('0x30')]]['state']!==_0x558d00[_0xb153('0x27')]['toLowerCase']()){this[_0xb153('0xa')][_0x558d00['device']]['stateTime']=_[_0xb153('0x37')](moment()[_0xb153('0x2a')]('x'));}this[_0xb153('0xa')][_0x558d00[_0xb153('0x30')]][_0xb153('0x27')]=_0x558d00[_0xb153('0x27')][_0xb153('0x32')]();logger[_0xb153('0x25')](_0xb153('0x39'),util['inspect'](this[_0xb153('0xa')][_0x558d00[_0xb153('0x30')]],{'showHidden':![],'depth':null}));this[_0xb153('0x22')](util[_0xb153('0x2a')](_0xb153('0x2b'),this[_0xb153('0xa')][_0x558d00[_0xb153('0x30')]][_0xb153('0x2c')]),_0xb153('0x2d'),this[_0xb153('0xa')][_0x558d00[_0xb153('0x30')]]);}else if(_[_0xb153('0x3a')](_0x558d00[_0xb153('0x30')],_0xb153('0x3b'))){var _0x173e24=_0x558d00[_0xb153('0x30')];var _0x12658e=_0x173e24['substring'](_0x173e24[_0xb153('0x3c')]('/')+0x1,_0x173e24[_0xb153('0x3c')]('@'));var _0x30193f=_[_0xb153('0x3d')](this[_0xb153('0xb')],function(_0x45caa9){return _0x45caa9[_0xb153('0x3e')]==_0x12658e||_0x45caa9['phone']==_0x12658e||_0x45caa9[_0xb153('0x3f')]==_0x12658e;});if(_0x30193f){if(_0x30193f[_0xb153('0x27')]!==_0x558d00['state'][_0xb153('0x32')]()){_0x30193f[_0xb153('0x35')]=_[_0xb153('0x37')](moment()[_0xb153('0x2a')]('x'));}_0x30193f[_0xb153('0x27')]=_0x558d00[_0xb153('0x27')][_0xb153('0x32')]();_0x30193f[_0xb153('0x34')]=!![];_0x30193f[_0xb153('0x36')](_0x558d00);}}}}catch(_0x30472e){logger[_0xb153('0x1a')](_0xb153('0x31'),util[_0xb153('0x18')](_0x30472e,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xb153('0x40')]=function(_0x4b3f4f){try{if(this[_0xb153('0x20')](_0x4b3f4f)&&this[_0xb153('0x20')](_0x4b3f4f['peerstatus'])){logger[_0xb153('0x23')](_0xb153('0x41'),_0x4b3f4f[_0xb153('0x42')],_0x4b3f4f[_0xb153('0x43')],_0x4b3f4f[_0xb153('0x13')]);logger[_0xb153('0x25')](_0xb153('0x44'),util['inspect'](_0x4b3f4f,{'showHidden':![],'depth':null}));if(this[_0xb153('0xb')][_0x4b3f4f[_0xb153('0x42')]]){if(!this[_0xb153('0xb')][_0x4b3f4f['peer']][_0xb153('0x34')]||_0x4b3f4f[_0xb153('0x13')][_0xb153('0x32')]()==_0xb153('0x45')){this[_0xb153('0xb')][_0x4b3f4f[_0xb153('0x42')]][_0xb153('0x34')]=![];this[_0xb153('0xb')][_0x4b3f4f[_0xb153('0x42')]][_0xb153('0x46')]=_0x4b3f4f[_0xb153('0x13')][_0xb153('0x32')]();this[_0xb153('0xb')][_0x4b3f4f[_0xb153('0x42')]][_0xb153('0x43')]=_0x4b3f4f[_0xb153('0x43')];this[_0xb153('0xb')][_0x4b3f4f['peer']][_0xb153('0x36')](_0x4b3f4f);}}else if(this[_0xb153('0xc')][_0x4b3f4f[_0xb153('0x42')]]){this[_0xb153('0xc')][_0x4b3f4f['peer']]['status']=_0x4b3f4f[_0xb153('0x13')][_0xb153('0x32')]();this[_0xb153('0xc')][_0x4b3f4f[_0xb153('0x42')]][_0xb153('0x43')]=_0x4b3f4f[_0xb153('0x43')];logger['debug'](_0xb153('0x47'),util[_0xb153('0x18')](this[_0xb153('0xc')][_0x4b3f4f[_0xb153('0x42')]],{'showHidden':![],'depth':null}));this[_0xb153('0x22')](util['format'](_0xb153('0x48'),this[_0xb153('0xc')][_0x4b3f4f[_0xb153('0x42')]]['name']),_0xb153('0x38'),this[_0xb153('0xc')][_0x4b3f4f[_0xb153('0x42')]]);}else if(this[_0xb153('0xa')][_0x4b3f4f[_0xb153('0x42')]]){this['trunks'][_0x4b3f4f[_0xb153('0x42')]][_0xb153('0x46')]=_0x4b3f4f['peerstatus'][_0xb153('0x32')]();this['trunks'][_0x4b3f4f['peer']]['address']=_0x4b3f4f[_0xb153('0x43')];logger[_0xb153('0x25')](_0xb153('0x49'),util[_0xb153('0x18')](this['trunks'][_0x4b3f4f[_0xb153('0x42')]],{'showHidden':![],'depth':null}));this[_0xb153('0x22')](util[_0xb153('0x2a')](_0xb153('0x2b'),this[_0xb153('0xa')][_0x4b3f4f[_0xb153('0x42')]][_0xb153('0x2c')]),_0xb153('0x2d'),this[_0xb153('0xa')][_0x4b3f4f[_0xb153('0x42')]]);}}}catch(_0x382245){logger['error'](_0xb153('0x44'),util[_0xb153('0x18')](_0x382245,{'showHidden':![],'depth':null}));}};module[_0xb153('0x4a')]=UserReport; \ No newline at end of file +var _0x95c7=['state','merge','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','isNotNull','info','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','local','toLowerCase','stateTime','updateStatusRealtime','toNumber','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:save','startsWith','substring','indexOf','mobile','phone','accountcode','[userReport][devicestatechange]','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:%s','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','name','exports','lodash','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','redis','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','[userReport][devicestatelist]','actionSipPeerStatus','prototype','isUndefined','emit','[userReport][registry]\x20registry:%s\x20state:%s','username','debug','[userReport][registry]','find','stateRegistry'];(function(_0x2bf900,_0xc9b9b0){var _0x32e61b=function(_0x4652c1){while(--_0x4652c1){_0x2bf900['push'](_0x2bf900['shift']());}};_0x32e61b(++_0xc9b9b0);}(_0x95c7,0x1a7));var _0x795c=function(_0x17548e,_0x2c3dc8){_0x17548e=_0x17548e-0x0;var _0x2820d1=_0x95c7[_0x17548e];return _0x2820d1;};'use strict';var _=require(_0x795c('0x0'));var moment=require(_0x795c('0x1'));var util=require(_0x795c('0x2'));var Redis=require(_0x795c('0x3'));var BPromise=require(_0x795c('0x4'));var config=require(_0x795c('0x5'));var logger=require(_0x795c('0x6'))(_0x795c('0x7'));var ami=require('../ami');config['redis']=_['defaults'](config[_0x795c('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x795c('0x9'))(new Redis(config[_0x795c('0x8')]));function UserReport(_0x57d8bc){this[_0x795c('0xa')]=_0x57d8bc[_0x795c('0xa')];this[_0x795c('0xb')]=_0x57d8bc[_0x795c('0xb')];this[_0x795c('0xc')]=_0x57d8bc[_0x795c('0xc')];ami['on'](_0x795c('0xd'),this[_0x795c('0xe')][_0x795c('0xf')](this));ami['on'](_0x795c('0x10'),this[_0x795c('0xe')][_0x795c('0xf')](this));ami['on']('devicestatechange',this[_0x795c('0x11')]['bind'](this));ami['on'](_0x795c('0x12'),this[_0x795c('0x13')][_0x795c('0xf')](this));return this[_0x795c('0x14')]();}function showSipRegistrations(){Promise[_0x795c('0x15')]()[_0x795c('0x16')](ami[_0x795c('0x17')]())[_0x795c('0x18')](function(_0x59a582){logger[_0x795c('0x19')](_0x795c('0x1a'),util[_0x795c('0x1b')](_0x59a582,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x795c('0x15')]()[_0x795c('0x16')](ami['actionDeviceStateList']())['catch'](function(_0x48ce09){logger[_0x795c('0x19')](_0x795c('0x1c'),util[_0x795c('0x1b')](_0x48ce09,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x795c('0x15')]()[_0x795c('0x16')](ami[_0x795c('0x1d')]())['catch'](function(_0x4743c0){logger['error']('[userReport][sippeerstatus]',util[_0x795c('0x1b')](_0x4743c0,{'showHidden':![],'depth':null}));});}UserReport[_0x795c('0x1e')]['syncRealtimeShow']=function(){setInterval(function(){BPromise['resolve']()[_0x795c('0x16')](showSipRegistrations())[_0x795c('0x16')](listDeviceStates())[_0x795c('0x16')](showPeersStatus());},0x32c8);};UserReport['prototype']['isNotNull']=function(_0x496340){return _0x496340!==null&&!_[_0x795c('0x1f')](_0x496340);};UserReport[_0x795c('0x1e')][_0x795c('0x20')]=function(_0x345b47,_0x40cbd1,_0x33a167){io['to'](_0x345b47)[_0x795c('0x20')](_0x40cbd1,_0x33a167);};UserReport[_0x795c('0x1e')][_0x795c('0xe')]=function(_0x1bef6f){try{if(this['isNotNull'](_0x1bef6f)){logger['info'](_0x795c('0x21'),_0x1bef6f[_0x795c('0x22')],_0x1bef6f['state']);logger[_0x795c('0x23')](_0x795c('0x24'),util[_0x795c('0x1b')](_0x1bef6f,{'showHidden':![],'depth':null}));var _0x366bcd=_[_0x795c('0x25')](this[_0x795c('0xa')],{'defaultuser':_0x1bef6f[_0x795c('0x22')]});if(_0x366bcd){_0x1bef6f[_0x795c('0x26')]=_0x1bef6f[_0x795c('0x27')];_[_0x795c('0x28')](_0x366bcd,_[_0x795c('0x29')](_0x1bef6f,[_0x795c('0x2a'),_0x795c('0x2b'),'username',_0x795c('0x27')]));logger[_0x795c('0x23')](_0x795c('0x2c'),util[_0x795c('0x1b')](_0x366bcd,{'showHidden':![],'depth':null}));this[_0x795c('0x20')](util[_0x795c('0x2d')](_0x795c('0x2e'),_0x366bcd['name']),'trunk:save',_0x366bcd);}}}catch(_0x18db16){logger['error'](_0x795c('0x24'),util[_0x795c('0x1b')](_0x18db16,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x795c('0x11')]=function(_0x49ea65){try{if(this[_0x795c('0x2f')](_0x49ea65)){logger[_0x795c('0x30')](_0x795c('0x31'),_0x49ea65[_0x795c('0x32')],_0x49ea65[_0x795c('0x27')]);logger[_0x795c('0x23')]('[userReport][devicestatechange]',util[_0x795c('0x1b')](_0x49ea65,{'showHidden':![],'depth':null}));if(this[_0x795c('0xb')][_0x49ea65[_0x795c('0x32')]]){if(!this[_0x795c('0xb')][_0x49ea65['device']][_0x795c('0x33')]||_0x49ea65[_0x795c('0x27')]['toLowerCase']()=='inuse'){this['agents'][_0x49ea65['device']]['local']=![];if(this[_0x795c('0xb')][_0x49ea65[_0x795c('0x32')]][_0x795c('0x27')]!==_0x49ea65[_0x795c('0x27')][_0x795c('0x34')]()){this[_0x795c('0xb')][_0x49ea65[_0x795c('0x32')]][_0x795c('0x35')]=_['toNumber'](moment()['format']('x'));}this[_0x795c('0xb')][_0x49ea65['device']][_0x795c('0x27')]=_0x49ea65['state'][_0x795c('0x34')]();this[_0x795c('0xb')][_0x49ea65[_0x795c('0x32')]][_0x795c('0x36')](_0x49ea65);}}else if(this[_0x795c('0xc')][_0x49ea65['device']]){if(this[_0x795c('0xc')][_0x49ea65[_0x795c('0x32')]][_0x795c('0x27')]!==_0x49ea65['state']['toLowerCase']()){this['telephones'][_0x49ea65[_0x795c('0x32')]]['stateTime']=_[_0x795c('0x37')](moment()[_0x795c('0x2d')]('x'));}this[_0x795c('0xc')][_0x49ea65[_0x795c('0x32')]][_0x795c('0x27')]=_0x49ea65['state']['toLowerCase']();logger['debug']('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0x795c('0x1b')](this[_0x795c('0xc')][_0x49ea65[_0x795c('0x32')]],{'showHidden':![],'depth':null}));this[_0x795c('0x20')](util[_0x795c('0x2d')]('telephone:%s',this[_0x795c('0xc')][_0x49ea65[_0x795c('0x32')]]['name']),_0x795c('0x38'),this['telephones'][_0x49ea65[_0x795c('0x32')]]);}else if(this[_0x795c('0xa')][_0x49ea65[_0x795c('0x32')]]){if(this[_0x795c('0xa')][_0x49ea65[_0x795c('0x32')]][_0x795c('0x27')]!==_0x49ea65['state']['toLowerCase']()){this[_0x795c('0xa')][_0x49ea65[_0x795c('0x32')]][_0x795c('0x35')]=_[_0x795c('0x37')](moment()[_0x795c('0x2d')]('x'));}this[_0x795c('0xa')][_0x49ea65['device']]['state']=_0x49ea65[_0x795c('0x27')]['toLowerCase']();logger[_0x795c('0x23')](_0x795c('0x39'),util['inspect'](this[_0x795c('0xa')][_0x49ea65[_0x795c('0x32')]],{'showHidden':![],'depth':null}));this[_0x795c('0x20')](util[_0x795c('0x2d')](_0x795c('0x2e'),this[_0x795c('0xa')][_0x49ea65[_0x795c('0x32')]]['name']),_0x795c('0x3a'),this[_0x795c('0xa')][_0x49ea65[_0x795c('0x32')]]);}else if(_[_0x795c('0x3b')](_0x49ea65[_0x795c('0x32')],'Local')){var _0xbcf720=_0x49ea65[_0x795c('0x32')];var _0xa8b28b=_0xbcf720[_0x795c('0x3c')](_0xbcf720['indexOf']('/')+0x1,_0xbcf720[_0x795c('0x3d')]('@'));var _0x42b5b7=_[_0x795c('0x25')](this[_0x795c('0xb')],function(_0x418960){return _0x418960[_0x795c('0x3e')]==_0xa8b28b||_0x418960[_0x795c('0x3f')]==_0xa8b28b||_0x418960[_0x795c('0x40')]==_0xa8b28b;});if(_0x42b5b7){if(_0x42b5b7[_0x795c('0x27')]!==_0x49ea65[_0x795c('0x27')][_0x795c('0x34')]()){_0x42b5b7['stateTime']=_[_0x795c('0x37')](moment()[_0x795c('0x2d')]('x'));}_0x42b5b7['state']=_0x49ea65['state'][_0x795c('0x34')]();_0x42b5b7[_0x795c('0x33')]=!![];_0x42b5b7[_0x795c('0x36')](_0x49ea65);}}}}catch(_0x38fd3f){logger[_0x795c('0x19')](_0x795c('0x41'),util['inspect'](_0x38fd3f,{'showHidden':![],'depth':null}));}};UserReport[_0x795c('0x1e')][_0x795c('0x13')]=function(_0x49772e){try{if(this[_0x795c('0x2f')](_0x49772e)&&this[_0x795c('0x2f')](_0x49772e[_0x795c('0x12')])){logger[_0x795c('0x30')](_0x795c('0x42'),_0x49772e[_0x795c('0x43')],_0x49772e[_0x795c('0x44')],_0x49772e[_0x795c('0x12')]);logger[_0x795c('0x23')](_0x795c('0x45'),util[_0x795c('0x1b')](_0x49772e,{'showHidden':![],'depth':null}));if(this['agents'][_0x49772e[_0x795c('0x43')]]){if(!this[_0x795c('0xb')][_0x49772e['peer']][_0x795c('0x33')]||_0x49772e[_0x795c('0x12')][_0x795c('0x34')]()==_0x795c('0x46')){this[_0x795c('0xb')][_0x49772e[_0x795c('0x43')]][_0x795c('0x33')]=![];this[_0x795c('0xb')][_0x49772e[_0x795c('0x43')]][_0x795c('0x47')]=_0x49772e[_0x795c('0x12')][_0x795c('0x34')]();this['agents'][_0x49772e['peer']][_0x795c('0x44')]=_0x49772e[_0x795c('0x44')];this[_0x795c('0xb')][_0x49772e[_0x795c('0x43')]]['updateStatusRealtime'](_0x49772e);}}else if(this[_0x795c('0xc')][_0x49772e[_0x795c('0x43')]]){this[_0x795c('0xc')][_0x49772e[_0x795c('0x43')]][_0x795c('0x47')]=_0x49772e[_0x795c('0x12')][_0x795c('0x34')]();this['telephones'][_0x49772e[_0x795c('0x43')]]['address']=_0x49772e[_0x795c('0x44')];logger[_0x795c('0x23')](_0x795c('0x48'),util[_0x795c('0x1b')](this[_0x795c('0xc')][_0x49772e[_0x795c('0x43')]],{'showHidden':![],'depth':null}));this[_0x795c('0x20')](util[_0x795c('0x2d')](_0x795c('0x49'),this[_0x795c('0xc')][_0x49772e[_0x795c('0x43')]]['name']),_0x795c('0x38'),this[_0x795c('0xc')][_0x49772e[_0x795c('0x43')]]);}else if(this[_0x795c('0xa')][_0x49772e[_0x795c('0x43')]]){this[_0x795c('0xa')][_0x49772e['peer']][_0x795c('0x47')]=_0x49772e['peerstatus']['toLowerCase']();this[_0x795c('0xa')][_0x49772e[_0x795c('0x43')]][_0x795c('0x44')]=_0x49772e[_0x795c('0x44')];logger[_0x795c('0x23')](_0x795c('0x4a'),util[_0x795c('0x1b')](this[_0x795c('0xa')][_0x49772e['peer']],{'showHidden':![],'depth':null}));this[_0x795c('0x20')](util[_0x795c('0x2d')]('trunk:%s',this[_0x795c('0xa')][_0x49772e[_0x795c('0x43')]][_0x795c('0x4b')]),_0x795c('0x3a'),this[_0x795c('0xa')][_0x49772e['peer']]);}}}catch(_0x1dcd33){logger[_0x795c('0x19')](_0x795c('0x45'),util['inspect'](_0x1dcd33,{'showHidden':![],'depth':null}));}};module[_0x795c('0x4c')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index ed6a4f0..2658bbf 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','voice','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','interface','calleridnum','extravar','format','user:%s','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','voiceChannels','routealias','merge','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:agentconnect','agentringnoanswer','agentringnoanswerAt','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','lastevent','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','agent','talktime','acw','acwtime','acwTimeout','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','lodash','moment','util','../../../config/logger','../ami','redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart'];(function(_0x1fa3a0,_0x59907e){var _0x58e941=function(_0x3655dc){while(--_0x3655dc){_0x1fa3a0['push'](_0x1fa3a0['shift']());}};_0x58e941(++_0x59907e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}if(_[_0x0a9e('0x1f')](this['channels'][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]={'agentcalledAt':moment()['format'](_0x0a9e('0x27')),'lastevent':'called','mandatoryDisposition':this[_0x0a9e('0x9')][_0x155cce['queue']]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x29')]||![]:![],'type':this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x2a')]||'inbound':_0x0a9e('0x2b'),'variables':this[_0x0a9e('0xb')][_0x155cce[_0x0a9e('0x26')]],'motionChannel':_0x0a9e('0x2c')};}_['merge'](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']]);var _0x66c1d2={'id':this[_0x0a9e('0xa')][_0x155cce[_0x0a9e('0x32')]]['id'],'calleridnum':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0x33')],'queue':this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]]['queue'],'extravar':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')]?this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')][_0x0a9e('0x34')]:undefined};logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x155cce[_0x0a9e('0x26')],util['inspect'](_0x66c1d2,{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x155cce[_0x0a9e('0x21')]),'user:called',_0x66c1d2);}}catch(_0x31916f){logger[_0x0a9e('0x37')](_0x0a9e('0x38'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x31916f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x39')]=function(_0x4c1c0e){try{if(this['isNotNull'](_0x4c1c0e)){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]){logger['debug'](_0x0a9e('0x3a'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c1c0e,{'showHidden':![],'depth':null}));for(var _0x148f55 in this['channels'][_0x4c1c0e['uniqueid']]){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]['hasOwnProperty'](_0x148f55)){if(_0x4c1c0e[_0x0a9e('0x22')]===_0x148f55){logger[_0x0a9e('0x20')](_0x0a9e('0x3b'),_0x4c1c0e['uniqueid'],_0x4c1c0e[_0x0a9e('0x21')],_0x4c1c0e[_0x0a9e('0x22')]);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3c')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3d')]=_0x4c1c0e[_0x0a9e('0x3d')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3e')]=_0x4c1c0e[_0x0a9e('0x3e')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x3f')]=_0x4c1c0e[_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x40')]=_0x4c1c0e[_0x0a9e('0x40')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x41')]=_0x4c1c0e[_0x0a9e('0x41')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['lastevent']=_0x0a9e('0x42');if(this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x26')]]){var _0xbe9d19=this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x26')]]['routealias'];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x44')]=_0xbe9d19;_0x4c1c0e['routealias']=_0xbe9d19;}_[_0x0a9e('0x45')](this[_0x0a9e('0xa')][_0x4c1c0e[_0x0a9e('0x32')]],_[_0x0a9e('0x46')](_0x4c1c0e,[_0x0a9e('0x28'),_0x0a9e('0x47'),_0x0a9e('0x44')]));logger['debug'](_0x0a9e('0x48'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x49'),this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x4c1c0e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x4c1c0e['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x4c1c0e[_0x0a9e('0x21')]),_0x0a9e('0x4a'),this['channels'][_0x4c1c0e['uniqueid']][_0x4c1c0e['destuniqueid']]);}else if(!this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]&&!this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x4c1c0e[_0x0a9e('0x26')],this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['membername'],_0x148f55);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]=!![];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheredestinationuniqueid']=_0x4c1c0e[_0x0a9e('0x22')];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheremembername']=_0x4c1c0e[_0x0a9e('0x21')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55]['lastevent']=_0x0a9e('0x4d');this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4e')]=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4f'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x50'),this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]);}}}}}}catch(_0xb83dfd){logger[_0x0a9e('0x37')]('[%s][voiceAgentReport][agentconnect]',_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xb83dfd,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x51')]=function(_0x5cc8fb){try{if(this[_0x0a9e('0x1e')](_0x5cc8fb)){logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x5cc8fb['uniqueid'],util[_0x0a9e('0x25')](_0x5cc8fb,{'showHidden':![],'depth':null}));if(this['channels'][_0x5cc8fb[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]){logger[_0x0a9e('0x20')](_0x0a9e('0x52'),_0x5cc8fb['uniqueid'],_0x5cc8fb[_0x0a9e('0x21')],_0x5cc8fb['destuniqueid']);this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x5cc8fb['uniqueid']][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x53')]=_0x0a9e('0x54');this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb['destuniqueid']][_0x0a9e('0x4e')]=_0x0a9e('0x54');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x5cc8fb[_0x0a9e('0x26')],util['inspect'](this['channels'][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x55'),this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]);}}}catch(_0x54a37d){logger[_0x0a9e('0x37')](_0x0a9e('0x56'),_0x5cc8fb[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x54a37d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x11')]=function(_0x320898){try{if(this[_0x0a9e('0x1e')](_0x320898)){logger[_0x0a9e('0x23')](_0x0a9e('0x57'),_0x320898['uniqueid'],util[_0x0a9e('0x25')](_0x320898,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){for(var _0x4edbb0 in this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){if(this['channels'][_0x320898[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x4edbb0)&&!this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4b')]&&!this['channels'][_0x320898['uniqueid']][_0x4edbb0]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x59'),_0x320898[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x21')],_0x4edbb0);this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this['channels'][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x53')]='abandoned';this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4e')]=_0x0a9e('0x5a');logger['debug'](_0x0a9e('0x5b'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x320898['uniqueid']][_0x4edbb0],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x5c'),this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]);}}}}}catch(_0x4abc8f){logger[_0x0a9e('0x37')](_0x0a9e('0x5d'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4abc8f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x13')]=function(_0x40fc56){try{if(this[_0x0a9e('0x1e')](_0x40fc56)){logger[_0x0a9e('0x23')](_0x0a9e('0x5e'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x40fc56,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){for(var _0x5b35db in this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x0a9e('0x58')](_0x5b35db)){if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x3c')]&&!this['channels'][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x40fc56[_0x0a9e('0x26')],this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x21')],_0x5b35db);this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x4e')]=_0x40fc56[_0x0a9e('0x4e')]=='transfer'?_0x0a9e('0x61'):_0x40fc56['reason'];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x62')]=_0x40fc56[_0x0a9e('0x62')];if(this['voiceQueues'][_0x40fc56['queue']]&&this[_0x0a9e('0x9')][_0x40fc56[_0x0a9e('0x28')]][_0x0a9e('0x63')]){this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x64')]=this['voiceQueues'][_0x40fc56['queue']][_0x0a9e('0x65')];this['channels'][_0x40fc56['uniqueid']][_0x5b35db]['agentacw']=!![];}this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]=_[_0x0a9e('0x2d')](this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x66'),this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db]);logger['debug'](_0x0a9e('0x67'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')]({'id':this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]},{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')]('user:%s',_0x40fc56[_0x0a9e('0x21')]),_0x0a9e('0x69'),{'id':this['agents'][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]});}}}}}}catch(_0x3a1974){logger['error'](_0x0a9e('0x6a'),_0x40fc56['uniqueid'],util[_0x0a9e('0x25')](_0x3a1974,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x1f29bd){try{if(this[_0x0a9e('0x1e')](_0x1f29bd)){logger[_0x0a9e('0x23')](_0x0a9e('0x6b'),_0x1f29bd[_0x0a9e('0x26')],util['inspect'](_0x1f29bd,{'showHidden':![],'depth':null}));this[_0x0a9e('0x6c')](_0x1f29bd[_0x0a9e('0x26')],_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){for(var _0x33f0c9 in this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x33f0c9)){logger['info'](_0x0a9e('0x70'),_0x1f29bd[_0x0a9e('0x26')],_0x33f0c9,_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(_['isUndefined'](this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9]['variables'])){this[_0x0a9e('0x8')][_0x1f29bd['uniqueid']][_0x33f0c9][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9][_0x0a9e('0xb')]=this['variables'][_0x1f29bd[_0x0a9e('0x26')]];}}}}}catch(_0x4cf72d){logger[_0x0a9e('0x37')](_0x0a9e('0x71'),_0x1f29bd['uniqueid'],util[_0x0a9e('0x25')](_0x4cf72d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x6c')]=function(_0x4ab276,_0x4c788f,_0x1b82b7){var _0x6ba2be=[_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),_0x0a9e('0x75'),_0x0a9e('0x76'),_0x0a9e('0x77'),_0x0a9e('0x78'),'rtpaudioqosrttbridged',_0x0a9e('0x79'),'sipuri',_0x0a9e('0x7a'),_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x0a9e('0x7d'),_0x0a9e('0x7e'),'memberlastcall',_0x0a9e('0x21'),_0x0a9e('0x7f'),_0x0a9e('0x80')];if(!_[_0x0a9e('0x81')](_0x4c788f)&&!_[_0x0a9e('0x82')](_0x6ba2be,_0x4c788f)){if(_['isUndefined'](this['variables'][_0x4ab276])){this[_0x0a9e('0xb')][_0x4ab276]={};}this['variables'][_0x4ab276][_0x4c788f]=_0x1b82b7;}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x17')]=function(_0x4672e1){try{if(this[_0x0a9e('0x1e')](_0x4672e1)){logger[_0x0a9e('0x23')](_0x0a9e('0x83'),_0x4672e1['uniqueid'],util['inspect'](_0x4672e1,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']]){for(var _0x2469d1 in this['channels'][_0x4672e1[_0x0a9e('0x26')]]){if(this['channels'][_0x4672e1['uniqueid']][_0x0a9e('0x58')](_0x2469d1)){if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']][_0x2469d1][_0x0a9e('0x4e')]==_0x0a9e('0x84')&&this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x4672e1[_0x0a9e('0x26')],_0x2469d1);this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x0a9e('0x23')](_0x0a9e('0x85'),_0x4672e1['uniqueid'],util[_0x0a9e('0x25')](_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x87'),_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x4672e1['uniqueid']];}if(this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]]){delete this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]];}}}catch(_0x1d0b02){logger['error']('[%s][voiceAgentReport][hangup]',_0x4672e1[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1d0b02,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x88')]=function(_0x34f7b5){try{if(this['isNotNull'](_0x34f7b5)){logger[_0x0a9e('0x23')](_0x0a9e('0x89'),_0x34f7b5[_0x0a9e('0x26')],util['inspect'](_0x34f7b5,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]){for(var _0x2144ca in this['channels'][_0x34f7b5[_0x0a9e('0x8a')]]){if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]]['hasOwnProperty'](_0x2144ca)){if(_0x34f7b5[_0x0a9e('0x8b')]===_0x2144ca){logger['info'](_0x0a9e('0x8c'),_0x34f7b5[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x21')],_0x2144ca);var _0x1bee04=moment();this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca]['lastevent']='complete';this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x4e')]=_0x0a9e('0x84');this['channels'][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x62')]=_0x1bee04[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]]){var _0x5d0e1f=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]];this[_0x0a9e('0x8')][_0x34f7b5['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]];this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]=_0x5d0e1f;}}}catch(_0x303f75){logger[_0x0a9e('0x37')](_0x0a9e('0x90'),_0x34f7b5[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x303f75,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x1b')]=function(_0x289e65){try{if(this['isNotNull'](_0x289e65)){logger[_0x0a9e('0x23')](_0x0a9e('0x91'),_0x289e65[_0x0a9e('0x26')],util['inspect'](_0x289e65,{'showHidden':![],'depth':null}));if(this['channels'][_0x289e65['transfereeuniqueid']]){for(var _0x1015aa in this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']]){if(this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x0a9e('0x58')](_0x1015aa)){if(_0x289e65['transfereruniqueid']===_0x1015aa){logger[_0x0a9e('0x20')](_0x0a9e('0x92'),_0x289e65[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x21')],_0x1015aa);var _0x40e6e7=moment();this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x5f')]=_0x40e6e7;this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x4e')]=_0x0a9e('0x84');this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['talktime']=_0x40e6e7[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}}}catch(_0x2be526){logger[_0x0a9e('0x37')](_0x0a9e('0x93'),_0x289e65[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2be526,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x18')]=function(_0x88b25f){var _0x2ff265='';try{if(this[_0x0a9e('0x1e')](_0x88b25f)){logger[_0x0a9e('0x23')](_0x0a9e('0x94'),_0x88b25f[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x88b25f,{'showHidden':![],'depth':null}));if(_0x88b25f['channel']){_0x2ff265=_0x88b25f[_0x0a9e('0x95')][_0x0a9e('0x96')](0x0,_0x88b25f[_0x0a9e('0x95')]['lastIndexOf']('-'));if(this[_0x0a9e('0xa')][_0x2ff265]){logger[_0x0a9e('0x20')](_0x0a9e('0x97'),_0x88b25f[_0x0a9e('0x26')],_0x2ff265);this[_0x0a9e('0xa')][_0x2ff265][_0x0a9e('0x98')]=!![];}}}}catch(_0x424f1b){logger[_0x0a9e('0x37')](_0x0a9e('0x99'),_0x88b25f[_0x0a9e('0x26')],util['inspect'](_0x424f1b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x9a')]=function(_0x15a9ed){var _0x3db98f='';try{if(this[_0x0a9e('0x1e')](_0x15a9ed)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x15a9ed[_0x0a9e('0x26')],util['inspect'](_0x15a9ed,{'showHidden':![],'depth':null}));if(_0x15a9ed['channel']){_0x3db98f=_0x15a9ed['channel'][_0x0a9e('0x96')](0x0,_0x15a9ed[_0x0a9e('0x95')][_0x0a9e('0x9b')]('-'));if(this[_0x0a9e('0xa')][_0x3db98f]){logger['info'](_0x0a9e('0x9c'),_0x15a9ed[_0x0a9e('0x26')],_0x3db98f);this[_0x0a9e('0xa')][_0x3db98f][_0x0a9e('0x98')]=![];}}}}catch(_0x2c8d1d){logger['error']('[%s][voiceAgentReport][musiconholdstop]',_0x15a9ed[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2c8d1d,{'showHidden':![],'depth':null}));}};module[_0x0a9e('0x9d')]=VoiceAgentReport; \ No newline at end of file +var _0xa9e0=['musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','voice','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','interface','calleridnum','extravar','format','user:%s','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','voiceChannels','routealias','merge','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:agentconnect','agentringnoanswer','agentringnoanswerAt','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','lastevent','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','agent','talktime','acw','acwtime','acwTimeout','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','lodash','moment','util','../../../config/logger','../ami','redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart'];(function(_0x4037bf,_0x2b556e){var _0x290dcc=function(_0x888c2d){while(--_0x888c2d){_0x4037bf['push'](_0x4037bf['shift']());}};_0x290dcc(++_0x2b556e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}if(_[_0x0a9e('0x1f')](this['channels'][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]={'agentcalledAt':moment()['format'](_0x0a9e('0x27')),'lastevent':'called','mandatoryDisposition':this[_0x0a9e('0x9')][_0x155cce['queue']]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x29')]||![]:![],'type':this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x2a')]||'inbound':_0x0a9e('0x2b'),'variables':this[_0x0a9e('0xb')][_0x155cce[_0x0a9e('0x26')]],'motionChannel':_0x0a9e('0x2c')};}_['merge'](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']]);var _0x66c1d2={'id':this[_0x0a9e('0xa')][_0x155cce[_0x0a9e('0x32')]]['id'],'calleridnum':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0x33')],'queue':this[_0x0a9e('0x8')][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]]['queue'],'extravar':this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')]?this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]][_0x0a9e('0xb')][_0x0a9e('0x34')]:undefined};logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x155cce[_0x0a9e('0x26')],util['inspect'](_0x66c1d2,{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x155cce[_0x0a9e('0x21')]),'user:called',_0x66c1d2);}}catch(_0x31916f){logger[_0x0a9e('0x37')](_0x0a9e('0x38'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x31916f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x39')]=function(_0x4c1c0e){try{if(this['isNotNull'](_0x4c1c0e)){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]){logger['debug'](_0x0a9e('0x3a'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c1c0e,{'showHidden':![],'depth':null}));for(var _0x148f55 in this['channels'][_0x4c1c0e['uniqueid']]){if(this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]]['hasOwnProperty'](_0x148f55)){if(_0x4c1c0e[_0x0a9e('0x22')]===_0x148f55){logger[_0x0a9e('0x20')](_0x0a9e('0x3b'),_0x4c1c0e['uniqueid'],_0x4c1c0e[_0x0a9e('0x21')],_0x4c1c0e[_0x0a9e('0x22')]);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3c')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3d')]=_0x4c1c0e[_0x0a9e('0x3d')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x3e')]=_0x4c1c0e[_0x0a9e('0x3e')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x3f')]=_0x4c1c0e[_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x40')]=_0x4c1c0e[_0x0a9e('0x40')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x41')]=_0x4c1c0e[_0x0a9e('0x41')];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['lastevent']=_0x0a9e('0x42');if(this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x26')]]){var _0xbe9d19=this[_0x0a9e('0x43')][this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55][_0x0a9e('0x26')]]['routealias'];this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x44')]=_0xbe9d19;_0x4c1c0e['routealias']=_0xbe9d19;}_[_0x0a9e('0x45')](this[_0x0a9e('0xa')][_0x4c1c0e[_0x0a9e('0x32')]],_[_0x0a9e('0x46')](_0x4c1c0e,[_0x0a9e('0x28'),_0x0a9e('0x47'),_0x0a9e('0x44')]));logger['debug'](_0x0a9e('0x48'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x49'),this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x4c1c0e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x4c1c0e['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x4c1c0e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')](_0x0a9e('0x36'),_0x4c1c0e[_0x0a9e('0x21')]),_0x0a9e('0x4a'),this['channels'][_0x4c1c0e['uniqueid']][_0x4c1c0e['destuniqueid']]);}else if(!this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]&&!this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x4c1c0e[_0x0a9e('0x26')],this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['membername'],_0x148f55);this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4b')]=!![];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheredestinationuniqueid']=_0x4c1c0e[_0x0a9e('0x22')];this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]['answeredelsewheremembername']=_0x4c1c0e[_0x0a9e('0x21')];this['channels'][_0x4c1c0e['uniqueid']][_0x148f55]['lastevent']=_0x0a9e('0x4d');this['channels'][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55][_0x0a9e('0x4e')]=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4f'),_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x4c1c0e['uniqueid']][_0x148f55],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x50'),this[_0x0a9e('0x8')][_0x4c1c0e[_0x0a9e('0x26')]][_0x148f55]);}}}}}}catch(_0xb83dfd){logger[_0x0a9e('0x37')]('[%s][voiceAgentReport][agentconnect]',_0x4c1c0e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xb83dfd,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x51')]=function(_0x5cc8fb){try{if(this[_0x0a9e('0x1e')](_0x5cc8fb)){logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x5cc8fb['uniqueid'],util[_0x0a9e('0x25')](_0x5cc8fb,{'showHidden':![],'depth':null}));if(this['channels'][_0x5cc8fb[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]){logger[_0x0a9e('0x20')](_0x0a9e('0x52'),_0x5cc8fb['uniqueid'],_0x5cc8fb[_0x0a9e('0x21')],_0x5cc8fb['destuniqueid']);this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x5cc8fb['uniqueid']][_0x5cc8fb[_0x0a9e('0x22')]][_0x0a9e('0x53')]=_0x0a9e('0x54');this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb['destuniqueid']][_0x0a9e('0x4e')]=_0x0a9e('0x54');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x5cc8fb[_0x0a9e('0x26')],util['inspect'](this['channels'][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x55'),this[_0x0a9e('0x8')][_0x5cc8fb[_0x0a9e('0x26')]][_0x5cc8fb[_0x0a9e('0x22')]]);}}}catch(_0x54a37d){logger[_0x0a9e('0x37')](_0x0a9e('0x56'),_0x5cc8fb[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x54a37d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x11')]=function(_0x320898){try{if(this[_0x0a9e('0x1e')](_0x320898)){logger[_0x0a9e('0x23')](_0x0a9e('0x57'),_0x320898['uniqueid'],util[_0x0a9e('0x25')](_0x320898,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){for(var _0x4edbb0 in this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]]){if(this['channels'][_0x320898[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x4edbb0)&&!this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4b')]&&!this['channels'][_0x320898['uniqueid']][_0x4edbb0]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x59'),_0x320898[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x21')],_0x4edbb0);this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4c')]=moment()['format'](_0x0a9e('0x27'));this['channels'][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x53')]='abandoned';this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0][_0x0a9e('0x4e')]=_0x0a9e('0x5a');logger['debug'](_0x0a9e('0x5b'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x320898['uniqueid']][_0x4edbb0],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x5c'),this[_0x0a9e('0x8')][_0x320898[_0x0a9e('0x26')]][_0x4edbb0]);}}}}}catch(_0x4abc8f){logger[_0x0a9e('0x37')](_0x0a9e('0x5d'),_0x320898[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4abc8f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x13')]=function(_0x40fc56){try{if(this[_0x0a9e('0x1e')](_0x40fc56)){logger[_0x0a9e('0x23')](_0x0a9e('0x5e'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x40fc56,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){for(var _0x5b35db in this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x0a9e('0x58')](_0x5b35db)){if(this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x3c')]&&!this['channels'][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x40fc56[_0x0a9e('0x26')],this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x21')],_0x5b35db);this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x40fc56['uniqueid']][_0x5b35db][_0x0a9e('0x4e')]=_0x40fc56[_0x0a9e('0x4e')]=='transfer'?_0x0a9e('0x61'):_0x40fc56['reason'];this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x62')]=_0x40fc56[_0x0a9e('0x62')];if(this['voiceQueues'][_0x40fc56['queue']]&&this[_0x0a9e('0x9')][_0x40fc56[_0x0a9e('0x28')]][_0x0a9e('0x63')]){this['channels'][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db][_0x0a9e('0x64')]=this['voiceQueues'][_0x40fc56['queue']][_0x0a9e('0x65')];this['channels'][_0x40fc56['uniqueid']][_0x5b35db]['agentacw']=!![];}this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]=_[_0x0a9e('0x2d')](this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x66'),this[_0x0a9e('0x8')][_0x40fc56[_0x0a9e('0x26')]][_0x5b35db]);logger['debug'](_0x0a9e('0x67'),_0x40fc56[_0x0a9e('0x26')],util[_0x0a9e('0x25')]({'id':this[_0x0a9e('0xa')][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]},{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x35')]('user:%s',_0x40fc56[_0x0a9e('0x21')]),_0x0a9e('0x69'),{'id':this['agents'][_0x40fc56[_0x0a9e('0x32')]]['id'],'destaccountcode':_0x40fc56[_0x0a9e('0x68')]});}}}}}}catch(_0x3a1974){logger['error'](_0x0a9e('0x6a'),_0x40fc56['uniqueid'],util[_0x0a9e('0x25')](_0x3a1974,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x1f29bd){try{if(this[_0x0a9e('0x1e')](_0x1f29bd)){logger[_0x0a9e('0x23')](_0x0a9e('0x6b'),_0x1f29bd[_0x0a9e('0x26')],util['inspect'](_0x1f29bd,{'showHidden':![],'depth':null}));this[_0x0a9e('0x6c')](_0x1f29bd[_0x0a9e('0x26')],_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){for(var _0x33f0c9 in this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x0a9e('0x58')](_0x33f0c9)){logger['info'](_0x0a9e('0x70'),_0x1f29bd[_0x0a9e('0x26')],_0x33f0c9,_[_0x0a9e('0x6d')](_0x1f29bd[_0x0a9e('0x6e')])[0x0],_0x1f29bd[_0x0a9e('0x6f')]);if(_['isUndefined'](this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9]['variables'])){this[_0x0a9e('0x8')][_0x1f29bd['uniqueid']][_0x33f0c9][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x1f29bd[_0x0a9e('0x26')]][_0x33f0c9][_0x0a9e('0xb')]=this['variables'][_0x1f29bd[_0x0a9e('0x26')]];}}}}}catch(_0x4cf72d){logger[_0x0a9e('0x37')](_0x0a9e('0x71'),_0x1f29bd['uniqueid'],util[_0x0a9e('0x25')](_0x4cf72d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x6c')]=function(_0x4ab276,_0x4c788f,_0x1b82b7){var _0x6ba2be=[_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),_0x0a9e('0x75'),_0x0a9e('0x76'),_0x0a9e('0x77'),_0x0a9e('0x78'),'rtpaudioqosrttbridged',_0x0a9e('0x79'),'sipuri',_0x0a9e('0x7a'),_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x0a9e('0x7d'),_0x0a9e('0x7e'),'memberlastcall',_0x0a9e('0x21'),_0x0a9e('0x7f'),_0x0a9e('0x80')];if(!_[_0x0a9e('0x81')](_0x4c788f)&&!_[_0x0a9e('0x82')](_0x6ba2be,_0x4c788f)){if(_['isUndefined'](this['variables'][_0x4ab276])){this[_0x0a9e('0xb')][_0x4ab276]={};}this['variables'][_0x4ab276][_0x4c788f]=_0x1b82b7;}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x17')]=function(_0x4672e1){try{if(this[_0x0a9e('0x1e')](_0x4672e1)){logger[_0x0a9e('0x23')](_0x0a9e('0x83'),_0x4672e1['uniqueid'],util['inspect'](_0x4672e1,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']]){for(var _0x2469d1 in this['channels'][_0x4672e1[_0x0a9e('0x26')]]){if(this['channels'][_0x4672e1['uniqueid']][_0x0a9e('0x58')](_0x2469d1)){if(this[_0x0a9e('0x8')][_0x4672e1['uniqueid']][_0x2469d1][_0x0a9e('0x4e')]==_0x0a9e('0x84')&&this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x4672e1[_0x0a9e('0x26')],_0x2469d1);this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]][_0x2469d1][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x0a9e('0x23')](_0x0a9e('0x85'),_0x4672e1['uniqueid'],util[_0x0a9e('0x25')](_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x87'),_[_0x0a9e('0x86')](this[_0x0a9e('0x8')][_0x4672e1[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x4672e1['uniqueid']];}if(this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]]){delete this[_0x0a9e('0xb')][_0x4672e1[_0x0a9e('0x26')]];}}}catch(_0x1d0b02){logger['error']('[%s][voiceAgentReport][hangup]',_0x4672e1[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1d0b02,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x88')]=function(_0x34f7b5){try{if(this['isNotNull'](_0x34f7b5)){logger[_0x0a9e('0x23')](_0x0a9e('0x89'),_0x34f7b5[_0x0a9e('0x26')],util['inspect'](_0x34f7b5,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]){for(var _0x2144ca in this['channels'][_0x34f7b5[_0x0a9e('0x8a')]]){if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]]['hasOwnProperty'](_0x2144ca)){if(_0x34f7b5[_0x0a9e('0x8b')]===_0x2144ca){logger['info'](_0x0a9e('0x8c'),_0x34f7b5[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x21')],_0x2144ca);var _0x1bee04=moment();this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x5f')]=moment()[_0x0a9e('0x35')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca]['lastevent']='complete';this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x4e')]=_0x0a9e('0x84');this['channels'][_0x34f7b5[_0x0a9e('0x8a')]][_0x2144ca][_0x0a9e('0x62')]=_0x1bee04[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']][_0x2144ca][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}if(this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]]){var _0x5d0e1f=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8f')]];this[_0x0a9e('0x8')][_0x34f7b5['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x34f7b5[_0x0a9e('0x8a')]];this[_0x0a9e('0x8')][_0x34f7b5['transfereeuniqueid']]=_0x5d0e1f;}}}catch(_0x303f75){logger[_0x0a9e('0x37')](_0x0a9e('0x90'),_0x34f7b5[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x303f75,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x1b')]=function(_0x289e65){try{if(this['isNotNull'](_0x289e65)){logger[_0x0a9e('0x23')](_0x0a9e('0x91'),_0x289e65[_0x0a9e('0x26')],util['inspect'](_0x289e65,{'showHidden':![],'depth':null}));if(this['channels'][_0x289e65['transfereeuniqueid']]){for(var _0x1015aa in this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']]){if(this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x0a9e('0x58')](_0x1015aa)){if(_0x289e65['transfereruniqueid']===_0x1015aa){logger[_0x0a9e('0x20')](_0x0a9e('0x92'),_0x289e65[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x21')],_0x1015aa);var _0x40e6e7=moment();this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x5f')]=_0x40e6e7;this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x53')]=_0x0a9e('0x60');this[_0x0a9e('0x8')][_0x289e65['transfereeuniqueid']][_0x1015aa][_0x0a9e('0x4e')]=_0x0a9e('0x84');this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa]['talktime']=_0x40e6e7[_0x0a9e('0x8d')](this[_0x0a9e('0x8')][_0x289e65[_0x0a9e('0x8a')]][_0x1015aa][_0x0a9e('0x3c')],_0x0a9e('0x8e'));}}}}}}catch(_0x2be526){logger[_0x0a9e('0x37')](_0x0a9e('0x93'),_0x289e65[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2be526,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x18')]=function(_0x88b25f){var _0x2ff265='';try{if(this[_0x0a9e('0x1e')](_0x88b25f)){logger[_0x0a9e('0x23')](_0x0a9e('0x94'),_0x88b25f[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x88b25f,{'showHidden':![],'depth':null}));if(_0x88b25f['channel']){_0x2ff265=_0x88b25f[_0x0a9e('0x95')][_0x0a9e('0x96')](0x0,_0x88b25f[_0x0a9e('0x95')]['lastIndexOf']('-'));if(this[_0x0a9e('0xa')][_0x2ff265]){logger[_0x0a9e('0x20')](_0x0a9e('0x97'),_0x88b25f[_0x0a9e('0x26')],_0x2ff265);this[_0x0a9e('0xa')][_0x2ff265][_0x0a9e('0x98')]=!![];}}}}catch(_0x424f1b){logger[_0x0a9e('0x37')](_0x0a9e('0x99'),_0x88b25f[_0x0a9e('0x26')],util['inspect'](_0x424f1b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x9a')]=function(_0x15a9ed){var _0x3db98f='';try{if(this[_0x0a9e('0x1e')](_0x15a9ed)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x15a9ed[_0x0a9e('0x26')],util['inspect'](_0x15a9ed,{'showHidden':![],'depth':null}));if(_0x15a9ed['channel']){_0x3db98f=_0x15a9ed['channel'][_0x0a9e('0x96')](0x0,_0x15a9ed[_0x0a9e('0x95')][_0x0a9e('0x9b')]('-'));if(this[_0x0a9e('0xa')][_0x3db98f]){logger['info'](_0x0a9e('0x9c'),_0x15a9ed[_0x0a9e('0x26')],_0x3db98f);this[_0x0a9e('0xa')][_0x3db98f][_0x0a9e('0x98')]=![];}}}}catch(_0x2c8d1d){logger['error']('[%s][voiceAgentReport][musiconholdstop]',_0x15a9ed[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2c8d1d,{'showHidden':![],'depth':null}));}};module[_0x0a9e('0x9d')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 7c39490..1c9abca 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 _0xe94a=['transferType','resolve','then','undefined','isEmpty','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','BlindTransfer','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','transfercalleridnum','origtransfereruniqueid','origtransfererlinkedid','outbound','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','[%s][voiceCallReport][blindtransfer]\x20event:','transfereecalleridnum','extension','BLIND','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../rpc/setting','set','queue','voicemail','NO\x20ANSWER','ANSWERED','BUSY','FAILED','redis','defaults','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','bind','newchannel','syncNewChannel','syncNewState','varset','syncHangup','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','prototype','isNotNull','isUndefined','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridnum','uniqueid','inspect','linkedid','merge','pick','keys','from-sip','channel','xcally-motion-preview','split','emit','format','user:%s','name','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','starttime','disposition','toNumber','channelstate','destconnectedlinenum','exten','debug','user:agentconnect','[%s][voiceCallReport][newchannel]','syncNewExten','application','toLowerCase','applicationdata','appdata','startsWith','CDR(routeAlias)','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','includes','lastapplication','lastdata','cdr(','type','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridname','answered','answertime','diff','connectedlinenum','connectedlinename','destinationchannel','membername','holdtime','UserId','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','.wav49','find','monitors','isNil','push','rec','[%s][voiceCallReport][mixMonitorFilename]','syncVarSet','[%s][voiceCallReport][varset]\x20event:','OutgoingSpoolFailed','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','syncMixMonitorFilename','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','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','parse','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xe94a,0x1b7));var _0xae94=function(_0x53afa6,_0x59e786){_0x53afa6=_0x53afa6-0x0;var _0x51f86a=_0xe94a[_0x53afa6];return _0x51f86a;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0xae94('0x0'));var path=require(_0xae94('0x1'));var Redis=require(_0xae94('0x2'));var config=require(_0xae94('0x3'));var logger=require(_0xae94('0x4'))(_0xae94('0x5'));var ami=require(_0xae94('0x6'));var Channel=require('../model/channel');var RpcSetting=require(_0xae94('0x7'));var applications=[_0xae94('0x8'),_0xae94('0x9'),'agi','dial','playback',_0xae94('0xa')];var dispositions=[_0xae94('0xb'),'FAILED','FAILED',_0xae94('0xb'),_0xae94('0xb'),'NO\x20ANSWER',_0xae94('0xc'),_0xae94('0xd'),_0xae94('0xe'),'FAILED',_0xae94('0xe')];config[_0xae94('0xf')]=_[_0xae94('0x10')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xae94('0x11'))(new Redis(config[_0xae94('0xf')]));function VoiceCallReport(_0x4e1b2b){this['channels']=_0x4e1b2b[_0xae94('0x12')];this['agents']=_0x4e1b2b[_0xae94('0x13')];this[_0xae94('0x14')]={};ami['on'](_0xae94('0x15'),this['syncNewExten']['bind'](this));ami['on']('newexten',this['syncNewExten'][_0xae94('0x16')](this));ami['on'](_0xae94('0x17'),this[_0xae94('0x18')][_0xae94('0x16')](this));ami['on']('newstate',this[_0xae94('0x19')]['bind'](this));ami['on'](_0xae94('0x1a'),this['syncVarSet'][_0xae94('0x16')](this));ami['on']('hangup',this[_0xae94('0x1b')][_0xae94('0x16')](this));ami['on']('newcallerid',this[_0xae94('0x1c')][_0xae94('0x16')](this));ami['on'](_0xae94('0x1d'),this[_0xae94('0x1e')]['bind'](this));ami['on'](_0xae94('0x1f'),this[_0xae94('0x20')][_0xae94('0x16')](this));ami['on'](_0xae94('0x21'),this[_0xae94('0x22')]['bind'](this));ami['on']('musiconholdstop',this[_0xae94('0x23')][_0xae94('0x16')](this));try{logger[_0xae94('0x24')](_0xae94('0x25'));ami[_0xae94('0x26')]();}catch(_0x45e8ce){logger[_0xae94('0x27')]('[voiceCallReport][coreshowchannels]',util['inspect'](_0x45e8ce,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xae94('0x28')][_0xae94('0x29')]=function(_0x491b44){return _0x491b44!==null&&!_[_0xae94('0x2a')](_0x491b44);};VoiceCallReport[_0xae94('0x28')]['emit']=function(_0x4d1a73,_0x3eaded,_0x23cc56){io['to'](_0x4d1a73)['emit'](_0x3eaded,_0x23cc56);};VoiceCallReport['prototype'][_0xae94('0x1c')]=function(_0x59ffff){try{if(this[_0xae94('0x29')](_0x59ffff)){logger[_0xae94('0x24')](_0xae94('0x2b'),_0x59ffff['uniqueid'],_0x59ffff['calleridname'],_0x59ffff[_0xae94('0x2c')]);logger['debug']('[%s][voiceCallReport][newcallerid]\x20event:',_0x59ffff[_0xae94('0x2d')],util[_0xae94('0x2e')](_0x59ffff,{'showHidden':![],'depth':null}));if(_0x59ffff[_0xae94('0x2d')]===_0x59ffff[_0xae94('0x2f')]){if(!_[_0xae94('0x2a')](this[_0xae94('0x12')][_0x59ffff[_0xae94('0x2d')]])){_[_0xae94('0x30')](this['channels'][_0x59ffff['uniqueid']],_[_0xae94('0x31')](_0x59ffff,_[_0xae94('0x32')](this[_0xae94('0x12')][_0x59ffff[_0xae94('0x2d')]])));}}if(_0x59ffff['context']===_0xae94('0x33')){if(this[_0xae94('0x13')][_0x59ffff[_0xae94('0x34')]['split']('-')[0x0]]){if(_0x59ffff['exten']==_0xae94('0x35')){this[_0xae94('0x13')][_0x59ffff['channel'][_0xae94('0x36')]('-')[0x0]]['destconnectedlinenum']=_0x59ffff['connectedlinenum'];this[_0xae94('0x37')](util[_0xae94('0x38')](_0xae94('0x39'),this[_0xae94('0x13')][_0x59ffff[_0xae94('0x34')]['split']('-')[0x0]][_0xae94('0x3a')]),'user:agentconnect',{'destaccountcode':this[_0xae94('0x13')][_0x59ffff[_0xae94('0x34')][_0xae94('0x36')]('-')[0x0]][_0xae94('0x3b')],'destconnectedlinenum':_0x59ffff['connectedlinenum']});}}}}}catch(_0x20780f){logger[_0xae94('0x27')](_0xae94('0x3c'),_0x59ffff[_0xae94('0x2d')],util['inspect'](_0x20780f,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xae94('0x18')]=function(_0x254546){try{if(this[_0xae94('0x29')](_0x254546)){logger['debug'](_0xae94('0x3d'),_0x254546[_0xae94('0x2d')],util[_0xae94('0x2e')](_0x254546,{'showHidden':![],'depth':null}));if(this[_0xae94('0x12')][_0x254546[_0xae94('0x2d')]])return;if(_0x254546[_0xae94('0x34')]==='OutgoingSpoolFailed')return;if(_0x254546[_0xae94('0x2d')]!==_0x254546[_0xae94('0x2f')]&&!this[_0xae94('0x14')][_0x254546[_0xae94('0x2f')]])return;logger[_0xae94('0x24')](_0xae94('0x3e'),_0x254546['uniqueid'],_0x254546[_0xae94('0x3f')],_0x254546['exten']);this[_0xae94('0x12')][_0x254546[_0xae94('0x2d')]]=new Channel();this[_0xae94('0x12')][_0x254546['uniqueid']][_0xae94('0x40')]=moment()[_0xae94('0x38')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xae94('0x12')][_0x254546[_0xae94('0x2d')]][_0xae94('0x41')]=dispositions[_[_0xae94('0x42')](_0x254546[_0xae94('0x43')])];_[_0xae94('0x30')](this[_0xae94('0x12')][_0x254546[_0xae94('0x2d')]],_[_0xae94('0x31')](_0x254546,_[_0xae94('0x32')](this[_0xae94('0x12')][_0x254546['uniqueid']])));if(_0x254546[_0xae94('0x3f')]===_0xae94('0x33')){if(this['agents'][_0x254546[_0xae94('0x34')][_0xae94('0x36')]('-')[0x0]]){if(_['isUndefined'](this[_0xae94('0x13')][_0x254546[_0xae94('0x34')][_0xae94('0x36')]('-')[0x0]][_0xae94('0x44')])){this[_0xae94('0x13')][_0x254546['channel'][_0xae94('0x36')]('-')[0x0]]['destconnectedlinenum']=_0x254546[_0xae94('0x45')];logger[_0xae94('0x46')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x254546[_0xae94('0x2d')],util[_0xae94('0x2e')]({'id':this[_0xae94('0x13')][_0x254546[_0xae94('0x34')][_0xae94('0x36')]('-')[0x0]]['id'],'destaccountcode':this[_0xae94('0x13')][_0x254546[_0xae94('0x34')][_0xae94('0x36')]('-')[0x0]][_0xae94('0x3b')],'destconnectedlinenum':_0x254546[_0xae94('0x45')]},{'showHidden':![],'depth':null}));this[_0xae94('0x37')](util[_0xae94('0x38')](_0xae94('0x39'),this[_0xae94('0x13')][_0x254546[_0xae94('0x34')][_0xae94('0x36')]('-')[0x0]][_0xae94('0x3a')]),_0xae94('0x47'),{'id':this[_0xae94('0x13')][_0x254546[_0xae94('0x34')][_0xae94('0x36')]('-')[0x0]]['id'],'destaccountcode':this[_0xae94('0x13')][_0x254546['channel'][_0xae94('0x36')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x254546[_0xae94('0x45')]});}}}}}catch(_0x46d8fb){logger[_0xae94('0x27')](_0xae94('0x48'),_0x254546[_0xae94('0x2d')],util['inspect'](_0x46d8fb,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xae94('0x49')]=function(_0x2df810){try{if(this['isNotNull'](_0x2df810)){logger[_0xae94('0x46')]('[%s][voiceCallReport][newexten]\x20event:',_0x2df810['uniqueid'],util[_0xae94('0x2e')](_0x2df810,{'showHidden':![],'depth':null}));if(_0x2df810[_0xae94('0x34')]==='OutgoingSpoolFailed'||_0x2df810[_0xae94('0x45')]==='h')return;if(_0x2df810['uniqueid']===_0x2df810[_0xae94('0x2f')]||this[_0xae94('0x14')][_0x2df810[_0xae94('0x2f')]]){_0x2df810[_0xae94('0x4a')]=_0x2df810[_0xae94('0x4a')][_0xae94('0x4b')]();_0x2df810[_0xae94('0x4c')]=_0x2df810[_0xae94('0x4d')]&&_0x2df810['appdata'][_0xae94('0x4e')](_0xae94('0x4f'))?_0x2df810[_0xae94('0x4d')]:(_0x2df810[_0xae94('0x4d')]||_0x2df810['applicationdata'])['toLowerCase']();logger[_0xae94('0x24')](_0xae94('0x50'),_0x2df810['uniqueid'],_0x2df810[_0xae94('0x4a')],_0x2df810[_0xae94('0x4c')]);if(_['isUndefined'](this[_0xae94('0x12')][_0x2df810[_0xae94('0x2d')]])){this['channels'][_0x2df810[_0xae94('0x2d')]]=new Channel();this[_0xae94('0x12')][_0x2df810['uniqueid']][_0xae94('0x40')]=_0x2df810[_0xae94('0x51')]?moment()[_0xae94('0x52')](moment['duration'](_0x2df810['duration'])[_0xae94('0x53')](),_0xae94('0x53'))[_0xae94('0x38')]('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0xae94('0x38')](_0xae94('0x54'));this[_0xae94('0x12')][_0x2df810[_0xae94('0x2d')]]['disposition']=_0xae94('0xb');}_['merge'](this[_0xae94('0x12')][_0x2df810[_0xae94('0x2d')]],_['pick'](_0x2df810,_['keys'](this[_0xae94('0x12')][_0x2df810[_0xae94('0x2d')]])));if(_[_0xae94('0x55')](applications,_0x2df810[_0xae94('0x4a')])){this['channels'][_0x2df810['uniqueid']][_0xae94('0x56')]=_0x2df810[_0xae94('0x4a')];this['channels'][_0x2df810['uniqueid']][_0xae94('0x57')]=_0x2df810[_0xae94('0x4c')];if(_0x2df810[_0xae94('0x4a')]===_0xae94('0x8')&&_[_0xae94('0x4e')](_0x2df810[_0xae94('0x4c')]['toLowerCase'](),_0xae94('0x58'))){var _0x5206e0=_0x2df810[_0xae94('0x4c')][_0xae94('0x36')]('=');var _0x2f3151=_0x5206e0[0x0][_0xae94('0x4b')]()['match'](/cdr\((.*)\)/);if(_0x2f3151){if(_0x2f3151[0x1]===_0xae94('0x59')&&!_['isNil'](this[_0xae94('0x12')][_0x2df810['uniqueid']][_0x2f3151[0x1]]))return;this[_0xae94('0x12')][_0x2df810[_0xae94('0x2d')]][_0x2f3151[0x1]]=_0x5206e0[0x1];}}else if(_0x2df810[_0xae94('0x4a')]==='queue'){this[_0xae94('0x12')][_0x2df810[_0xae94('0x2d')]][_0xae94('0x9')]=_0x2df810['applicationdata'][_0xae94('0x36')](',')[0x0];}}}}}catch(_0x3cf4c7){logger[_0xae94('0x27')](_0xae94('0x5a'),_0x2df810['uniqueid'],util[_0xae94('0x2e')](_0x3cf4c7,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xae94('0x19')]=function(_0x1214ce){try{if(this['isNotNull'](_0x1214ce)){logger[_0xae94('0x24')](_0xae94('0x5b'),_0x1214ce[_0xae94('0x2d')],_0x1214ce[_0xae94('0x2f')],_0x1214ce[_0xae94('0x5c')],_0x1214ce[_0xae94('0x2c')]);logger[_0xae94('0x46')]('[%s][voiceCallReport][newstate]\x20event:',_0x1214ce[_0xae94('0x2d')],util[_0xae94('0x2e')](_0x1214ce,{'showHidden':![],'depth':null}));if(_0x1214ce[_0xae94('0x43')]!=='6')return;if(_0x1214ce[_0xae94('0x2d')]!==_0x1214ce[_0xae94('0x2f')]){var _0x27a466=moment();if(this['channels'][_0x1214ce[_0xae94('0x2f')]]){if(!this[_0xae94('0x12')][_0x1214ce[_0xae94('0x2f')]][_0xae94('0x5d')]){this[_0xae94('0x12')][_0x1214ce[_0xae94('0x2f')]]['answered']=!![];this[_0xae94('0x12')][_0x1214ce[_0xae94('0x2f')]][_0xae94('0x5e')]=_0x27a466[_0xae94('0x38')]('YYYY-MM-DD\x20HH:mm:ss');if(this['channels'][_0x1214ce['linkedid']][_0xae94('0x40')]){this[_0xae94('0x12')][_0x1214ce[_0xae94('0x2f')]]['holdtime']=_0x27a466[_0xae94('0x5f')](this['channels'][_0x1214ce['linkedid']][_0xae94('0x40')],_0xae94('0x53'));}}this[_0xae94('0x12')][_0x1214ce['linkedid']][_0xae94('0x2f')]=_0x1214ce['uniqueid'];if(_0x1214ce['calleridnum']!==_0xae94('0x35')){this['channels'][_0x1214ce[_0xae94('0x2f')]][_0xae94('0x60')]=_0x1214ce[_0xae94('0x2c')];}this[_0xae94('0x12')][_0x1214ce[_0xae94('0x2f')]][_0xae94('0x61')]=_0x1214ce[_0xae94('0x5c')];this[_0xae94('0x12')][_0x1214ce[_0xae94('0x2f')]][_0xae94('0x62')]=_0x1214ce[_0xae94('0x34')];this[_0xae94('0x12')][_0x1214ce[_0xae94('0x2f')]][_0xae94('0x41')]=dispositions[_[_0xae94('0x42')](_0x1214ce[_0xae94('0x43')])];if(this[_0xae94('0x13')][_0x1214ce['channel'][_0xae94('0x36')]('-')[0x0]]){this[_0xae94('0x12')][_0x1214ce['linkedid']]['UserId']=this['agents'][_0x1214ce[_0xae94('0x34')][_0xae94('0x36')]('-')[0x0]]['id'];this['channels'][_0x1214ce[_0xae94('0x2f')]][_0xae94('0x63')]=this['agents'][_0x1214ce[_0xae94('0x34')][_0xae94('0x36')]('-')[0x0]]['name'];}}if(this[_0xae94('0x12')][_0x1214ce[_0xae94('0x2d')]]){if(!this[_0xae94('0x12')][_0x1214ce['uniqueid']][_0xae94('0x5d')]){this[_0xae94('0x12')][_0x1214ce[_0xae94('0x2d')]]['answered']=!![];this[_0xae94('0x12')][_0x1214ce[_0xae94('0x2d')]][_0xae94('0x5e')]=_0x27a466[_0xae94('0x38')](_0xae94('0x54'));if(this[_0xae94('0x12')][_0x1214ce['uniqueid']][_0xae94('0x40')]){this[_0xae94('0x12')][_0x1214ce[_0xae94('0x2d')]][_0xae94('0x64')]=_0x27a466[_0xae94('0x5f')](this[_0xae94('0x12')][_0x1214ce[_0xae94('0x2d')]][_0xae94('0x40')],_0xae94('0x53'));}}if(_0x1214ce[_0xae94('0x2c')]!==_0xae94('0x35')){this[_0xae94('0x12')][_0x1214ce[_0xae94('0x2d')]]['connectedlinenum']=_0x1214ce[_0xae94('0x2c')];}this[_0xae94('0x12')][_0x1214ce['uniqueid']][_0xae94('0x61')]=_0x1214ce[_0xae94('0x5c')];this[_0xae94('0x12')][_0x1214ce[_0xae94('0x2d')]][_0xae94('0x62')]=_0x1214ce[_0xae94('0x34')];this['channels'][_0x1214ce['uniqueid']]['disposition']=dispositions[_['toNumber'](_0x1214ce['channelstate'])];}}else{if(this[_0xae94('0x12')][_0x1214ce[_0xae94('0x2d')]]){if(this[_0xae94('0x13')][_0x1214ce[_0xae94('0x34')][_0xae94('0x36')]('-')[0x0]]){this[_0xae94('0x12')][_0x1214ce[_0xae94('0x2d')]][_0xae94('0x65')]=this[_0xae94('0x13')][_0x1214ce['channel'][_0xae94('0x36')]('-')[0x0]]['id'];this[_0xae94('0x12')][_0x1214ce[_0xae94('0x2d')]][_0xae94('0x63')]=this['agents'][_0x1214ce[_0xae94('0x34')][_0xae94('0x36')]('-')[0x0]][_0xae94('0x3a')];}}}if(_0x1214ce[_0xae94('0x3f')]===_0xae94('0x33')){if(this[_0xae94('0x13')][_0x1214ce[_0xae94('0x34')][_0xae94('0x36')]('-')[0x0]]){this['agents'][_0x1214ce['channel'][_0xae94('0x36')]('-')[0x0]][_0xae94('0x44')]=_0x1214ce[_0xae94('0x45')];var _0x2e281e,_0x2bd960;if(this[_0xae94('0x12')][_0x1214ce['uniqueid']]){_0x2e281e=this[_0xae94('0x12')][_0x1214ce['uniqueid']]['routealias'];_0x2bd960=this[_0xae94('0x12')][_0x1214ce[_0xae94('0x2d')]][_0xae94('0x9')];}else if(this[_0xae94('0x12')][_0x1214ce[_0xae94('0x2f')]]){_0x2e281e=this['channels'][_0x1214ce[_0xae94('0x2f')]][_0xae94('0x66')];_0x2bd960=this[_0xae94('0x12')][_0x1214ce[_0xae94('0x2f')]]['queue'];}logger[_0xae94('0x46')](_0xae94('0x67'),_0x1214ce['uniqueid'],util['inspect']({'id':this[_0xae94('0x13')][_0x1214ce[_0xae94('0x34')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0xae94('0x13')][_0x1214ce[_0xae94('0x34')]['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x1214ce[_0xae94('0x45')],'routealias':_0x2e281e,'queue':_0x2bd960||undefined},{'showHidden':![],'depth':null}));this[_0xae94('0x37')](util[_0xae94('0x38')](_0xae94('0x39'),this[_0xae94('0x13')][_0x1214ce['channel'][_0xae94('0x36')]('-')[0x0]][_0xae94('0x3a')]),_0xae94('0x47'),{'id':this[_0xae94('0x13')][_0x1214ce[_0xae94('0x34')][_0xae94('0x36')]('-')[0x0]]['id'],'agentconnected':!![],'destaccountcode':this[_0xae94('0x13')][_0x1214ce[_0xae94('0x34')][_0xae94('0x36')]('-')[0x0]][_0xae94('0x3b')],'destconnectedlinenum':_0x1214ce[_0xae94('0x45')],'routealias':_0x2e281e,'queue':_0x2bd960||undefined});}}}}catch(_0x433194){logger[_0xae94('0x27')](_0xae94('0x68'),_0x1214ce['uniqueid'],util[_0xae94('0x2e')](_0x433194,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xae94('0x28')]['syncMixMonitorFilename']=function(_0x82b4ac,_0x4050f2){try{if(this[_0xae94('0x12')][_0x82b4ac]){logger[_0xae94('0x24')](_0xae94('0x69'),_0x82b4ac,_0x4050f2);this[_0xae94('0x12')][_0x82b4ac][_0xae94('0x6a')]=!![];if(_['endsWith'](_0x4050f2,_0xae94('0x6b'))){_0x4050f2=_0x4050f2['replace'](_0xae94('0x6b'),'.WAV');}this['channels'][_0x82b4ac]['monitorFilename']=_0x4050f2;var _0x5f1a72=_[_0xae94('0x6c')](this[_0xae94('0x12')][_0x82b4ac][_0xae94('0x6d')],{'filename':_0x4050f2});if(_[_0xae94('0x6e')](_0x5f1a72)){this['channels'][_0x82b4ac][_0xae94('0x6d')][_0xae94('0x6f')]({'filename':_0x4050f2,'createdAt':moment()[_0xae94('0x38')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0xae94('0x70')});}}}catch(_0xe07dab){logger['error'](_0xae94('0x71'),_0x82b4ac,util[_0xae94('0x2e')](_0xe07dab,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xae94('0x28')][_0xae94('0x72')]=function(_0x21d3d9){try{if(this[_0xae94('0x29')](_0x21d3d9)){logger[_0xae94('0x46')](_0xae94('0x73'),_0x21d3d9[_0xae94('0x2d')],util['inspect'](_0x21d3d9,{'showHidden':![],'depth':null}));if(this[_0xae94('0x12')][_0x21d3d9[_0xae94('0x2d')]]&&_0x21d3d9['channel']!=_0xae94('0x74')){if(this[_0xae94('0x29')](_0x21d3d9[_0xae94('0x75')])){if(this[_0xae94('0x29')](_0x21d3d9[_0xae94('0x75')][_0xae94('0x76')])){logger['info'](_0xae94('0x77'),_0x21d3d9[_0xae94('0x2d')],_0x21d3d9['value']);this[_0xae94('0x78')](_0x21d3d9[_0xae94('0x2d')],_0x21d3d9[_0xae94('0x79')]);}else if(this[_0xae94('0x29')](_0x21d3d9[_0xae94('0x75')][_0xae94('0x7a')])){logger[_0xae94('0x24')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x21d3d9[_0xae94('0x2d')],_0x21d3d9['value']);this['channels'][_0x21d3d9['uniqueid']]['calleridnum']=_0x21d3d9['value'];}else if(this[_0xae94('0x29')](_0x21d3d9[_0xae94('0x75')][_0xae94('0x7b')])){logger[_0xae94('0x24')](_0xae94('0x7c'),_0x21d3d9[_0xae94('0x2d')],_0x21d3d9[_0xae94('0x79')]);this[_0xae94('0x12')][_0x21d3d9[_0xae94('0x2d')]][_0xae94('0x7d')]=_0x21d3d9[_0xae94('0x79')];}else if(this['isNotNull'](_0x21d3d9['variable'][_0xae94('0x7e')])){logger[_0xae94('0x24')](_0xae94('0x7f'),_0x21d3d9[_0xae94('0x2d')],_0x21d3d9[_0xae94('0x79')]);this[_0xae94('0x12')][_0x21d3d9[_0xae94('0x2d')]][_0xae94('0x59')]=_0x21d3d9['value'];}else if(this['isNotNull'](_0x21d3d9['variable']['xmd-queue'])){logger[_0xae94('0x24')](_0xae94('0x80'),_0x21d3d9[_0xae94('0x2d')],_0x21d3d9['value'][_0xae94('0x36')](',')[0x0]);this[_0xae94('0x12')][_0x21d3d9[_0xae94('0x2d')]]['queue']=_0x21d3d9[_0xae94('0x79')][_0xae94('0x36')](',')[0x0];}else if(this[_0xae94('0x29')](_0x21d3d9[_0xae94('0x75')][_0xae94('0x81')])){logger[_0xae94('0x24')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x21d3d9[_0xae94('0x2d')],_0x21d3d9[_0xae94('0x79')]);this[_0xae94('0x12')][_0x21d3d9[_0xae94('0x2d')]][_0xae94('0x82')]=_0x21d3d9['value'];}else if(this[_0xae94('0x29')](_0x21d3d9['variable'][_0xae94('0x83')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x21d3d9[_0xae94('0x2d')],_0x21d3d9['value']);this['channels'][_0x21d3d9[_0xae94('0x2d')]][_0xae94('0x84')]=_0x21d3d9[_0xae94('0x79')];}else if(this['isNotNull'](_0x21d3d9[_0xae94('0x75')][_0xae94('0x85')])){logger['info'](_0xae94('0x86'),_0x21d3d9[_0xae94('0x2d')],_0x21d3d9[_0xae94('0x79')]);this[_0xae94('0x12')][_0x21d3d9[_0xae94('0x2d')]][_0xae94('0x87')]=_0x21d3d9[_0xae94('0x79')];}else if(this[_0xae94('0x29')](_0x21d3d9[_0xae94('0x75')][_0xae94('0x88')])){logger[_0xae94('0x24')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x21d3d9[_0xae94('0x2d')],_0x21d3d9['value']);this[_0xae94('0x12')][_0x21d3d9[_0xae94('0x2d')]][_0xae94('0x9')]=_0x21d3d9[_0xae94('0x79')];}else if(this[_0xae94('0x29')](_0x21d3d9[_0xae94('0x75')][_0xae94('0x89')])){logger[_0xae94('0x24')](_0xae94('0x8a'),_0x21d3d9[_0xae94('0x2d')],_0x21d3d9[_0xae94('0x79')]);this[_0xae94('0x12')][_0x21d3d9[_0xae94('0x2d')]]['sipcalluniqueid']=_0x21d3d9['value'];}}}else if(this[_0xae94('0x29')](_0x21d3d9[_0xae94('0x75')][_0xae94('0x76')])){if(_0x21d3d9['value']){var _0x367cda=path[_0xae94('0x8b')](_0x21d3d9[_0xae94('0x79')])[_0xae94('0x3a')];logger['info'](_0xae94('0x77'),_0x367cda,_0x21d3d9[_0xae94('0x79')]);this[_0xae94('0x78')](_0x367cda,_0x21d3d9['value']);}}else if(this['channels'][_0x21d3d9[_0xae94('0x2f')]]){if(this[_0xae94('0x29')](_0x21d3d9['variable'])){if(this[_0xae94('0x29')](_0x21d3d9[_0xae94('0x75')][_0xae94('0x89')])){logger['info'](_0xae94('0x8a'),_0x21d3d9[_0xae94('0x2f')],_0x21d3d9[_0xae94('0x79')]);this[_0xae94('0x12')][_0x21d3d9['linkedid']]['sipcalllinkedid']=_0x21d3d9[_0xae94('0x79')];}}}}}catch(_0x41b80d){logger[_0xae94('0x27')](_0xae94('0x8c'),_0x21d3d9[_0xae94('0x2d')],util[_0xae94('0x2e')](_0x41b80d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xae94('0x28')][_0xae94('0x1b')]=function(_0x43164c){try{if(this[_0xae94('0x29')](_0x43164c)){logger[_0xae94('0x46')](_0xae94('0x8d'),_0x43164c['uniqueid'],util[_0xae94('0x2e')](_0x43164c,{'showHidden':![],'depth':null}));if(this[_0xae94('0x14')][_0x43164c[_0xae94('0x2f')]]){if(this[_0xae94('0x12')][this[_0xae94('0x14')][_0x43164c[_0xae94('0x2f')]]['linkedid']]){this[_0xae94('0x12')][this['blindTransfers'][_0x43164c[_0xae94('0x2f')]][_0xae94('0x2f')]][_0xae94('0x2d')]=_0x43164c[_0xae94('0x2d')];this['channels'][this['blindTransfers'][_0x43164c['linkedid']][_0xae94('0x2f')]]['answered']=this[_0xae94('0x12')][_0x43164c[_0xae94('0x2d')]]['answered'];this[_0xae94('0x12')][this[_0xae94('0x14')][_0x43164c['linkedid']][_0xae94('0x2f')]][_0xae94('0x5e')]=this[_0xae94('0x12')][_0x43164c[_0xae94('0x2d')]][_0xae94('0x5e')];this[_0xae94('0x12')][this[_0xae94('0x14')][_0x43164c['linkedid']][_0xae94('0x2f')]][_0xae94('0x62')]=this[_0xae94('0x12')][this[_0xae94('0x14')][_0x43164c[_0xae94('0x2f')]][_0xae94('0x2f')]][_0xae94('0x34')];this[_0xae94('0x12')][this[_0xae94('0x14')][_0x43164c[_0xae94('0x2f')]][_0xae94('0x2f')]]['disposition']=this[_0xae94('0x12')][_0x43164c[_0xae94('0x2d')]][_0xae94('0x41')];this[_0xae94('0x12')][_0x43164c[_0xae94('0x2d')]]=this[_0xae94('0x12')][this[_0xae94('0x14')][_0x43164c['linkedid']][_0xae94('0x2f')]];delete this[_0xae94('0x12')][this['blindTransfers'][_0x43164c[_0xae94('0x2f')]][_0xae94('0x2f')]];}else if(this[_0xae94('0x12')][this[_0xae94('0x14')][_0x43164c[_0xae94('0x2f')]][_0xae94('0x2d')]]){this[_0xae94('0x12')][this[_0xae94('0x14')][_0x43164c[_0xae94('0x2f')]][_0xae94('0x2d')]]['uniqueid']=[this[_0xae94('0x12')][this['blindTransfers'][_0x43164c[_0xae94('0x2f')]][_0xae94('0x2d')]][_0xae94('0x2f')],this['channels'][this[_0xae94('0x14')][_0x43164c[_0xae94('0x2f')]][_0xae94('0x2d')]][_0xae94('0x2f')]=this[_0xae94('0x12')][this[_0xae94('0x14')][_0x43164c[_0xae94('0x2f')]][_0xae94('0x2d')]]['uniqueid']][0x0];this[_0xae94('0x12')][this['blindTransfers'][_0x43164c[_0xae94('0x2f')]]['uniqueid']][_0xae94('0x5d')]=this['channels'][_0x43164c[_0xae94('0x2d')]][_0xae94('0x5d')];this['channels'][this[_0xae94('0x14')][_0x43164c[_0xae94('0x2f')]][_0xae94('0x2d')]]['answertime']=this[_0xae94('0x12')][_0x43164c[_0xae94('0x2d')]][_0xae94('0x5e')];this[_0xae94('0x12')][this[_0xae94('0x14')][_0x43164c[_0xae94('0x2f')]][_0xae94('0x2d')]]['destinationchannel']=this[_0xae94('0x12')][this['blindTransfers'][_0x43164c[_0xae94('0x2f')]]['uniqueid']][_0xae94('0x34')];this[_0xae94('0x12')][this[_0xae94('0x14')][_0x43164c[_0xae94('0x2f')]][_0xae94('0x2d')]][_0xae94('0x41')]=this['channels'][_0x43164c[_0xae94('0x2d')]][_0xae94('0x41')];this[_0xae94('0x12')][_0x43164c[_0xae94('0x2d')]]=this[_0xae94('0x12')][this[_0xae94('0x14')][_0x43164c[_0xae94('0x2f')]]['uniqueid']];delete this[_0xae94('0x12')][this[_0xae94('0x14')][_0x43164c[_0xae94('0x2f')]]['uniqueid']];}}if(this[_0xae94('0x12')][_0x43164c[_0xae94('0x2d')]]){logger['info'](_0xae94('0x8e'),_0x43164c[_0xae94('0x2d')],_0x43164c['cause-txt']);var _0x44dd16=moment();this[_0xae94('0x12')][_0x43164c[_0xae94('0x2d')]][_0xae94('0x8f')]=_0x44dd16['format'](_0xae94('0x54'));this['channels'][_0x43164c['uniqueid']][_0xae94('0x51')]=_0x44dd16[_0xae94('0x5f')](this[_0xae94('0x12')][_0x43164c[_0xae94('0x2d')]][_0xae94('0x40')],'seconds');if(this[_0xae94('0x12')][_0x43164c[_0xae94('0x2d')]][_0xae94('0x5d')]){this[_0xae94('0x12')][_0x43164c[_0xae94('0x2d')]][_0xae94('0x90')]=_0x44dd16[_0xae94('0x5f')](this[_0xae94('0x12')][_0x43164c['uniqueid']][_0xae94('0x5e')],_0xae94('0x53'));this[_0xae94('0x12')][_0x43164c[_0xae94('0x2d')]][_0xae94('0x64')]=this[_0xae94('0x12')][_0x43164c['uniqueid']]['duration']-this[_0xae94('0x12')][_0x43164c[_0xae94('0x2d')]]['billableseconds'];}if(_0x43164c['context']==='from-sip'){if(this[_0xae94('0x13')][_0x43164c['channel'][_0xae94('0x36')]('-')[0x0]]){this[_0xae94('0x13')][_0x43164c[_0xae94('0x34')][_0xae94('0x36')]('-')[0x0]]=_[_0xae94('0x91')](this[_0xae94('0x13')][_0x43164c['channel'][_0xae94('0x36')]('-')[0x0]],[_0xae94('0x44')]);logger['debug'](_0xae94('0x92'),_0x43164c['uniqueid'],util['inspect']({'id':this[_0xae94('0x13')][_0x43164c[_0xae94('0x34')][_0xae94('0x36')]('-')[0x0]]['id'],'destaccountcode':this[_0xae94('0x13')][_0x43164c[_0xae94('0x34')][_0xae94('0x36')]('-')[0x0]][_0xae94('0x3b')]},{'showHidden':![],'depth':null}));this[_0xae94('0x37')](util['format'](_0xae94('0x39'),this[_0xae94('0x13')][_0x43164c['channel']['split']('-')[0x0]][_0xae94('0x3a')]),_0xae94('0x93'),{'id':this['agents'][_0x43164c[_0xae94('0x34')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0xae94('0x13')][_0x43164c[_0xae94('0x34')][_0xae94('0x36')]('-')[0x0]][_0xae94('0x3b')]});for(var _0x1caa6b=0x0;_0x1caa6b0x0?_0x2283c3:0x0;this[_0x3f92('0x15')][_0x43950c[_0x3f92('0x66')]][_0x3f92('0x34')]=this[_0x3f92('0x15')][_0x43950c['queue']][_0x3f92('0x34')]>_[_0x3f92('0x6a')](_0x43950c[_0x3f92('0x6d')])?_[_0x3f92('0x6a')](_0x43950c[_0x3f92('0x6d')]):this[_0x3f92('0x15')][_0x43950c[_0x3f92('0x66')]][_0x3f92('0x34')];this[_0x3f92('0x6f')](this[_0x3f92('0x15')][_0x43950c[_0x3f92('0x66')]],_0x3f92('0x19'));}logger[_0x3f92('0x51')](_0x3f92('0x70'),util[_0x3f92('0x43')](this[_0x3f92('0x15')][_0x43950c[_0x3f92('0x66')]],{'showHidden':![],'depth':null}));ami[_0x3f92('0x48')](_0x3f92('0x71'),this[_0x3f92('0x15')][_0x43950c[_0x3f92('0x66')]]);}}}catch(_0x5748ab){logger[_0x3f92('0x40')](_0x3f92('0x65'),util['inspect'](_0x5748ab,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3f92('0xd')][_0x3f92('0x72')]=function(_0x5f28c0){logger[_0x3f92('0x51')](_0x3f92('0x73'),util['inspect'](_0x5f28c0,{'showHidden':![],'depth':null}));this[_0x3f92('0x16')]=!![];};VoiceQueueReport['prototype']['syncQueueCallerJoin']=function(_0x51311a){try{if(this['isNotNull'](_0x51311a)){logger[_0x3f92('0x51')](_0x3f92('0x74'),_0x51311a[_0x3f92('0x4b')],util[_0x3f92('0x43')](_0x51311a,{'showHidden':![],'depth':null}));if(_[_0x3f92('0x63')](this[_0x3f92('0x12')][_0x51311a[_0x3f92('0x4b')]]))this[_0x3f92('0x12')][_0x51311a['uniqueid']]=[];if(_[_0x3f92('0x63')](this[_0x3f92('0x38')][_0x51311a[_0x3f92('0x4b')]]))this[_0x3f92('0x38')][_0x51311a['uniqueid']]={};var _0x8c5c56=new QueueReport();_0x8c5c56['name']=_0x51311a[_0x3f92('0x66')];_0x8c5c56[_0x3f92('0x55')]=this['voiceQueues'][_0x8c5c56[_0x3f92('0x4d')]]&&this[_0x3f92('0x15')][_0x8c5c56['name']]['type']?this[_0x3f92('0x15')][_0x8c5c56[_0x3f92('0x4d')]][_0x3f92('0x55')]||'inbound':'inbound';_0x8c5c56['queue']=_0x51311a[_0x3f92('0x66')];_0x8c5c56[_0x3f92('0x75')]=moment()[_0x3f92('0x4c')](_0x3f92('0x76'));_0x8c5c56[_0x3f92('0x77')]=_0x51311a['position'];_0x8c5c56[_0x3f92('0x78')]=_0x51311a[_0x3f92('0x78')];_0x8c5c56[_0x3f92('0x4b')]=_0x51311a[_0x3f92('0x4b')];_0x8c5c56[_0x3f92('0x79')]=this['channels'][_0x51311a[_0x3f92('0x4b')]][_0x3f92('0x79')];logger[_0x3f92('0x67')](_0x3f92('0x7a'),_0x8c5c56[_0x3f92('0x4d')],_0x8c5c56[_0x3f92('0x55')]);_[_0x3f92('0x7b')](_0x8c5c56,_[_0x3f92('0x7c')](_0x51311a,_[_0x3f92('0x7d')](_0x8c5c56)));this[_0x3f92('0x12')][_0x51311a[_0x3f92('0x4b')]]['push'](_0x8c5c56);this[_0x3f92('0x38')][_0x51311a[_0x3f92('0x4b')]]=_0x8c5c56;this[_0x3f92('0x49')](_0x8c5c56,_0x3f92('0x1c'));}}catch(_0xf3c886){logger[_0x3f92('0x40')](_0x3f92('0x74'),_0x51311a[_0x3f92('0x4b')],util[_0x3f92('0x43')](_0xf3c886,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3f92('0x20')]=function(_0x11c483){try{if(this[_0x3f92('0x62')](_0x11c483)){logger[_0x3f92('0x51')](_0x3f92('0x7e'),_0x11c483[_0x3f92('0x4b')],util[_0x3f92('0x43')](_0x11c483,{'showHidden':![],'depth':null}));if(this[_0x3f92('0x12')][_0x11c483['uniqueid']]){var _0x21dfae=_[_0x3f92('0x7f')](this['queueReports'][_0x11c483[_0x3f92('0x4b')]]);_0x21dfae[_0x3f92('0x80')]=![];_0x21dfae[_0x3f92('0x81')]=null;_0x21dfae[_0x3f92('0x82')]=_0x11c483['holdtime'];_0x21dfae[_0x3f92('0x83')]=_0x11c483['originalposition'];_0x21dfae[_0x3f92('0x1f')]=!![];_0x21dfae[_0x3f92('0x84')]=moment()[_0x3f92('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x21dfae['queuecallerexitreason']=_0x3f92('0x85');_0x21dfae[_0x3f92('0x86')]=null;logger[_0x3f92('0x67')](_0x3f92('0x87'),_0x21dfae[_0x3f92('0x4d')],_0x21dfae[_0x3f92('0x55')]);this[_0x3f92('0x38')][_0x11c483[_0x3f92('0x4b')]]=_0x21dfae;this[_0x3f92('0x50')](_0x21dfae,_0x3f92('0x1f'));}}}catch(_0xd07df0){logger[_0x3f92('0x40')](_0x3f92('0x7e'),_0x11c483[_0x3f92('0x4b')],util[_0x3f92('0x43')](_0xd07df0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3f92('0xd')]['syncQueueCallerLeave']=function(_0x171e5f){try{if(this[_0x3f92('0x62')](_0x171e5f)){logger[_0x3f92('0x51')]('[%s][voiceQueueReport][queuecallerleave]',_0x171e5f[_0x3f92('0x4b')],util[_0x3f92('0x43')](_0x171e5f,{'showHidden':![],'depth':null}));if(this[_0x3f92('0x12')][_0x171e5f[_0x3f92('0x4b')]]){var _0x525886=_[_0x3f92('0x7f')](this['queueReports'][_0x171e5f['uniqueid']]);_0x525886[_0x3f92('0x88')]=moment()[_0x3f92('0x4c')](_0x3f92('0x76'));_0x525886[_0x3f92('0x89')]=_0x171e5f[_0x3f92('0x89')];_0x525886['connectedlinename']=_0x171e5f['connectedlinename'];logger[_0x3f92('0x67')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x525886[_0x3f92('0x4d')],_0x525886[_0x3f92('0x55')],_0x171e5f[_0x3f92('0x89')],_0x171e5f[_0x3f92('0x8a')]);this[_0x3f92('0x38')][_0x171e5f[_0x3f92('0x4b')]]=_0x525886;this[_0x3f92('0x49')](_0x525886,'queuecallerleave');}}}catch(_0x5df6d9){logger['error'](_0x3f92('0x8b'),_0x171e5f[_0x3f92('0x4b')],util[_0x3f92('0x43')](_0x5df6d9,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x3f92('0x24')]=function(_0x139d7d){try{if(this[_0x3f92('0x62')](_0x139d7d)){logger[_0x3f92('0x51')](_0x3f92('0x8c'),_0x139d7d[_0x3f92('0x4b')],util['inspect'](_0x139d7d,{'showHidden':![],'depth':null}));if(this[_0x3f92('0x12')][_0x139d7d[_0x3f92('0x4b')]]){var _0x8a15d7=_[_0x3f92('0x7f')](this[_0x3f92('0x12')][_0x139d7d['uniqueid']]);_0x8a15d7[_0x3f92('0x80')]=!![];_0x8a15d7[_0x3f92('0x8d')]=_0x3f92('0x8e');logger[_0x3f92('0x67')](_0x3f92('0x8f'),_0x8a15d7['name'],_0x8a15d7[_0x3f92('0x55')]);}}}catch(_0x33c476){logger['error'](_0x3f92('0x8c'),_0x139d7d[_0x3f92('0x4b')],util[_0x3f92('0x43')](_0x33c476,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3f92('0xd')][_0x3f92('0x22')]=function(_0x51c401){try{if(this[_0x3f92('0x62')](_0x51c401)){logger[_0x3f92('0x51')]('[%s][voiceQueueReport][agentcomplete]',_0x51c401[_0x3f92('0x4b')],util['inspect'](_0x51c401,{'showHidden':![],'depth':null}));if(this[_0x3f92('0x12')][_0x51c401[_0x3f92('0x4b')]]){var _0x1e1e5a=_[_0x3f92('0x7f')](this[_0x3f92('0x12')][_0x51c401[_0x3f92('0x4b')]]);_0x1e1e5a[_0x3f92('0x1f')]=![];_0x1e1e5a[_0x3f92('0x84')]=null;_0x1e1e5a[_0x3f92('0x90')]=!![];_0x1e1e5a[_0x3f92('0x86')]=_0x51c401[_0x3f92('0x91')];_0x1e1e5a[_0x3f92('0x82')]=_0x51c401['holdtime'];_0x1e1e5a[_0x3f92('0x80')]=!![];_0x1e1e5a[_0x3f92('0x92')]=![];_0x1e1e5a[_0x3f92('0x93')]=null;if(!_0x1e1e5a[_0x3f92('0x94')]){if(_0x51c401['reason']==_0x3f92('0x94')){_0x1e1e5a[_0x3f92('0x8d')]=_0x3f92('0x95');logger[_0x3f92('0x67')](_0x3f92('0x96'),_0x1e1e5a[_0x3f92('0x4d')],_0x1e1e5a[_0x3f92('0x55')]);}else{if(_[_0x3f92('0x97')](_0x51c401['channel'][_0x3f92('0x98')](),'local/')){if(this[_0x3f92('0x12')][_0x51c401['linkedid']]){var _0x5baa1a=_[_0x3f92('0x7f')](this[_0x3f92('0x12')][_0x51c401[_0x3f92('0x99')]]);_0x5baa1a[_0x3f92('0x80')]=![];_0x5baa1a[_0x3f92('0x92')]=!![];_0x5baa1a[_0x3f92('0x93')]=moment(_0x1e1e5a['queuecallerjoinAt'])[_0x3f92('0x9a')](_0x51c401['holdtime'],_0x3f92('0x9b'))['format'](_0x3f92('0x76'));_0x5baa1a[_0x3f92('0x8d')]=_0x3f92('0x9c');_0x5baa1a[_0x3f92('0x94')]=!![];_0x5baa1a[_0x3f92('0x9d')]=_0x3f92('0x9e');_0x5baa1a[_0x3f92('0x9f')]=_0x51c401['destexten'];_0x5baa1a[_0x3f92('0xa0')]=_0x51c401['uniqueid'];logger[_0x3f92('0x67')](_0x3f92('0xa1'),_0x5baa1a[_0x3f92('0x4d')],_0x5baa1a[_0x3f92('0x55')]);var _0x56ae73=this['queueReports'][_0x51c401['linkedid']];this['queueReports'][_0x51c401[_0x3f92('0x99')]]=this[_0x3f92('0x12')][_0x51c401['uniqueid']];this[_0x3f92('0x12')][_0x51c401['uniqueid']]=_0x56ae73;}}else{_0x1e1e5a[_0x3f92('0x8d')]=_0x3f92('0xa2')+_0x51c401[_0x3f92('0xa3')][_0x3f92('0xa4')]();logger[_0x3f92('0x67')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x1e1e5a[_0x3f92('0x4d')],_0x1e1e5a['type'],_0x1e1e5a[_0x3f92('0x8d')]);}}}this[_0x3f92('0x38')][_0x51c401[_0x3f92('0x4b')]]=_0x1e1e5a;this[_0x3f92('0x50')](_0x1e1e5a,_0x3f92('0xa5'));}}}catch(_0x2ad40a){logger[_0x3f92('0x40')](_0x3f92('0xa6'),_0x51c401[_0x3f92('0x4b')],util[_0x3f92('0x43')](_0x2ad40a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncVarSet']=function(_0x5d3399){try{if(this[_0x3f92('0x62')](_0x5d3399)){logger[_0x3f92('0x51')](_0x3f92('0xa7'),_0x5d3399['uniqueid'],util[_0x3f92('0x43')](_0x5d3399,{'showHidden':![],'depth':null}));this[_0x3f92('0xa8')](_0x5d3399['uniqueid'],_[_0x3f92('0x7d')](_0x5d3399[_0x3f92('0xa9')])[0x0],_0x5d3399[_0x3f92('0xaa')]);if(this[_0x3f92('0x12')][_0x5d3399['uniqueid']]){var _0xe99b1e=_[_0x3f92('0x7f')](this[_0x3f92('0x12')][_0x5d3399['uniqueid']]);if(_0xe99b1e){if(this['isNotNull'](_0x5d3399[_0x3f92('0xa9')])&&this[_0x3f92('0x62')](_0x5d3399[_0x3f92('0xa9')][_0x3f92('0xab')])){switch(_0x5d3399['value']){case _0x3f92('0xac'):_0xe99b1e[_0x3f92('0x92')]=![];_0xe99b1e[_0x3f92('0x93')]=null;break;case _0x3f92('0xad'):_0xe99b1e[_0x3f92('0xae')]=_0x3f92('0xaf');_0xe99b1e[_0x3f92('0x92')]=!![];_0xe99b1e['queuecallerexitAt']=moment()[_0x3f92('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0xe99b1e[_0x3f92('0x88')]=moment()[_0x3f92('0x4c')](_0x3f92('0x76'));logger[_0x3f92('0x51')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x5d3399['uniqueid'],util['inspect'](_0xe99b1e,{'showHidden':![],'depth':null}));ami[_0x3f92('0x48')](_0x3f92('0xb0'),_0xe99b1e);break;default:_0xe99b1e[_0x3f92('0x92')]=!![];_0xe99b1e[_0x3f92('0x93')]=moment()[_0x3f92('0x4c')](_0x3f92('0x76'));_0xe99b1e[_0x3f92('0x88')]=moment()[_0x3f92('0x4c')](_0x3f92('0x76'));}_0xe99b1e[_0x3f92('0x1f')]=![];_0xe99b1e['queuecallerabandonAt']=null;_0xe99b1e[_0x3f92('0x8d')]=_0x5d3399['value'];this['channels'][_0x5d3399['uniqueid']]=_0xe99b1e;this[_0x3f92('0x50')](_0xe99b1e,_0x3f92('0x25'));}else if(this[_0x3f92('0x62')](_0x5d3399[_0x3f92('0xa9')])&&this[_0x3f92('0x62')](_0x5d3399[_0x3f92('0xa9')]['queueposition'])){if(!_0xe99b1e[_0x3f92('0x1f')]){_0xe99b1e['queuecallerexit']=!![];_0xe99b1e[_0x3f92('0x93')]=moment()[_0x3f92('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0xe99b1e[_0x3f92('0x8d')]=_0x3f92('0xb1');_0xe99b1e[_0x3f92('0x88')]=moment()['format'](_0x3f92('0x76'));this[_0x3f92('0x38')][_0x5d3399[_0x3f92('0x4b')]]=_0xe99b1e;}}logger['info']('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x5d3399[_0x3f92('0x4b')],_0xe99b1e[_0x3f92('0x4d')],_0xe99b1e[_0x3f92('0x55')],_[_0x3f92('0x7d')](_0x5d3399[_0x3f92('0xa9')])[0x0],_0x5d3399['value']);_0xe99b1e[_0x3f92('0x18')]=this['variables'][_0x5d3399[_0x3f92('0x4b')]];}}}}catch(_0x4cee91){logger['error'](_0x3f92('0xa7'),_0x5d3399[_0x3f92('0x4b')],util[_0x3f92('0x43')](_0x4cee91,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3f92('0xd')][_0x3f92('0xa8')]=function(_0x2d508c,_0x531cab,_0x1d879a){var _0x447180=[_0x3f92('0xb2'),'rtpaudioqosbridged',_0x3f92('0xb3'),_0x3f92('0xb4'),'rtpaudioqosloss',_0x3f92('0xb5'),_0x3f92('0xb6'),_0x3f92('0xb7'),'sipcallid',_0x3f92('0xb8'),_0x3f92('0xb9'),'bridgepvtcallid',_0x3f92('0xba'),'memberdynamic',_0x3f92('0xbb'),_0x3f92('0xbc'),_0x3f92('0x91'),_0x3f92('0xbd'),'memberrealtime'];if(!_[_0x3f92('0x3a')](_0x531cab)&&!_['includes'](_0x447180,_0x531cab)){if(_[_0x3f92('0x63')](this['variables'][_0x2d508c])){this['variables'][_0x2d508c]={};}this['variables'][_0x2d508c][_0x531cab]=_0x1d879a;}};VoiceQueueReport['prototype'][_0x3f92('0xbe')]=function(_0x3d3d10){try{if(this[_0x3f92('0x62')](_0x3d3d10)){logger[_0x3f92('0x51')](_0x3f92('0xbf'),_0x3d3d10[_0x3f92('0x4b')],util['inspect'](_0x3d3d10,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3d3d10[_0x3f92('0x4b')]]){for(var _0x30642e=0x0,_0x1bcfe4={};_0x30642e0x0?_0x4592e3:0x0;this[_0x5333('0x13')][_0xf761ac['queue']][_0x5333('0x34')]=this['voiceQueues'][_0xf761ac[_0x5333('0x68')]][_0x5333('0x34')]>_[_0x5333('0x6e')](_0xf761ac[_0x5333('0x6f')])?_[_0x5333('0x6e')](_0xf761ac['loggedin']):this[_0x5333('0x13')][_0xf761ac[_0x5333('0x68')]][_0x5333('0x34')];this[_0x5333('0x70')](this[_0x5333('0x13')][_0xf761ac[_0x5333('0x68')]],_0x5333('0x71'));}logger[_0x5333('0x51')](_0x5333('0x72'),util[_0x5333('0x43')](this[_0x5333('0x13')][_0xf761ac[_0x5333('0x68')]],{'showHidden':![],'depth':null}));ami[_0x5333('0x4d')](_0x5333('0x73'),this['voiceQueues'][_0xf761ac[_0x5333('0x68')]]);}}}catch(_0x4ee97a){logger['error']('[voiceQueueReport][queuesummary]',util[_0x5333('0x43')](_0x4ee97a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5333('0xd')]['syncQueueSummaryComplete']=function(_0x4711e1){logger['debug'](_0x5333('0x74'),util[_0x5333('0x43')](_0x4711e1,{'showHidden':![],'depth':null}));this[_0x5333('0x14')]=!![];};VoiceQueueReport['prototype'][_0x5333('0x75')]=function(_0xb073a6){try{if(this[_0x5333('0x67')](_0xb073a6)){logger['debug'](_0x5333('0x76'),_0xb073a6[_0x5333('0x4c')],util[_0x5333('0x43')](_0xb073a6,{'showHidden':![],'depth':null}));if(_[_0x5333('0x64')](this[_0x5333('0x11')][_0xb073a6['uniqueid']]))this[_0x5333('0x11')][_0xb073a6['uniqueid']]=[];if(_[_0x5333('0x64')](this[_0x5333('0x3a')][_0xb073a6['uniqueid']]))this[_0x5333('0x3a')][_0xb073a6[_0x5333('0x4c')]]={};var _0x638df3=new QueueReport();_0x638df3[_0x5333('0x54')]=_0xb073a6[_0x5333('0x68')];_0x638df3[_0x5333('0x57')]=this[_0x5333('0x13')][_0x638df3[_0x5333('0x54')]]&&this[_0x5333('0x13')][_0x638df3['name']][_0x5333('0x57')]?this[_0x5333('0x13')][_0x638df3[_0x5333('0x54')]][_0x5333('0x57')]||_0x5333('0x58'):_0x5333('0x58');_0x638df3[_0x5333('0x68')]=_0xb073a6[_0x5333('0x68')];_0x638df3[_0x5333('0x77')]=moment()['format'](_0x5333('0x78'));_0x638df3[_0x5333('0x79')]=_0xb073a6[_0x5333('0x79')];_0x638df3['count']=_0xb073a6[_0x5333('0x7a')];_0x638df3['uniqueid']=_0xb073a6[_0x5333('0x4c')];_0x638df3[_0x5333('0x7b')]=this[_0x5333('0x3a')][_0xb073a6[_0x5333('0x4c')]]['routealias'];logger[_0x5333('0x6a')](_0x5333('0x7c'),_0x638df3[_0x5333('0x54')],_0x638df3[_0x5333('0x57')]);_['merge'](_0x638df3,_[_0x5333('0x7d')](_0xb073a6,_[_0x5333('0x7e')](_0x638df3)));this[_0x5333('0x11')][_0xb073a6[_0x5333('0x4c')]][_0x5333('0x7f')](_0x638df3);this[_0x5333('0x3a')][_0xb073a6['uniqueid']]=_0x638df3;this[_0x5333('0x49')](_0x638df3,_0x5333('0x1a'));}}catch(_0x327e05){logger[_0x5333('0x41')](_0x5333('0x76'),_0xb073a6['uniqueid'],util['inspect'](_0x327e05,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5333('0xd')][_0x5333('0x1c')]=function(_0x1b0b9c){try{if(this[_0x5333('0x67')](_0x1b0b9c)){logger[_0x5333('0x51')](_0x5333('0x80'),_0x1b0b9c['uniqueid'],util['inspect'](_0x1b0b9c,{'showHidden':![],'depth':null}));if(this[_0x5333('0x11')][_0x1b0b9c['uniqueid']]){var _0x3f67f6=_[_0x5333('0x81')](this[_0x5333('0x11')][_0x1b0b9c[_0x5333('0x4c')]]);_0x3f67f6[_0x5333('0x82')]=![];_0x3f67f6['queuecallercompleteAt']=null;_0x3f67f6[_0x5333('0x83')]=_0x1b0b9c[_0x5333('0x83')];_0x3f67f6[_0x5333('0x84')]=_0x1b0b9c[_0x5333('0x84')];_0x3f67f6[_0x5333('0x1b')]=!![];_0x3f67f6[_0x5333('0x85')]=moment()['format'](_0x5333('0x78'));_0x3f67f6[_0x5333('0x86')]=_0x5333('0x87');_0x3f67f6[_0x5333('0x88')]=null;logger[_0x5333('0x6a')](_0x5333('0x89'),_0x3f67f6[_0x5333('0x54')],_0x3f67f6['type']);this[_0x5333('0x3a')][_0x1b0b9c[_0x5333('0x4c')]]=_0x3f67f6;this[_0x5333('0x47')](_0x3f67f6,_0x5333('0x1b'));}}}catch(_0x93eed2){logger[_0x5333('0x41')](_0x5333('0x80'),_0x1b0b9c['uniqueid'],util[_0x5333('0x43')](_0x93eed2,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x5333('0x1d')]=function(_0x229911){try{if(this[_0x5333('0x67')](_0x229911)){logger['debug']('[%s][voiceQueueReport][queuecallerleave]',_0x229911[_0x5333('0x4c')],util[_0x5333('0x43')](_0x229911,{'showHidden':![],'depth':null}));if(this[_0x5333('0x11')][_0x229911[_0x5333('0x4c')]]){var _0x1d29d0=_[_0x5333('0x81')](this[_0x5333('0x11')][_0x229911[_0x5333('0x4c')]]);_0x1d29d0[_0x5333('0x8a')]=moment()[_0x5333('0x53')](_0x5333('0x78'));_0x1d29d0[_0x5333('0x8b')]=_0x229911[_0x5333('0x8b')];_0x1d29d0[_0x5333('0x8c')]=_0x229911[_0x5333('0x8c')];logger[_0x5333('0x6a')](_0x5333('0x8d'),_0x1d29d0[_0x5333('0x54')],_0x1d29d0[_0x5333('0x57')],_0x229911[_0x5333('0x8b')],_0x229911[_0x5333('0x8c')]);this['channels'][_0x229911[_0x5333('0x4c')]]=_0x1d29d0;this[_0x5333('0x49')](_0x1d29d0,_0x5333('0x8e'));}}}catch(_0x309948){logger['error'](_0x5333('0x8f'),_0x229911[_0x5333('0x4c')],util['inspect'](_0x309948,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5333('0xd')][_0x5333('0x20')]=function(_0x429688){try{if(this[_0x5333('0x67')](_0x429688)){logger[_0x5333('0x51')](_0x5333('0x90'),_0x429688[_0x5333('0x4c')],util[_0x5333('0x43')](_0x429688,{'showHidden':![],'depth':null}));if(this[_0x5333('0x11')][_0x429688[_0x5333('0x4c')]]){var _0x288b36=_[_0x5333('0x81')](this[_0x5333('0x11')][_0x429688['uniqueid']]);_0x288b36['queuecallercomplete']=!![];_0x288b36['queuecallerexitreason']='COMPLETEDBYAGENT';logger[_0x5333('0x6a')](_0x5333('0x91'),_0x288b36[_0x5333('0x54')],_0x288b36[_0x5333('0x57')]);}}}catch(_0x36f2e5){logger['error'](_0x5333('0x90'),_0x429688[_0x5333('0x4c')],util[_0x5333('0x43')](_0x36f2e5,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x5333('0x1e')]=function(_0x57bd8d){try{if(this['isNotNull'](_0x57bd8d)){logger['debug']('[%s][voiceQueueReport][agentcomplete]',_0x57bd8d[_0x5333('0x4c')],util[_0x5333('0x43')](_0x57bd8d,{'showHidden':![],'depth':null}));if(this[_0x5333('0x11')][_0x57bd8d[_0x5333('0x4c')]]){var _0x1e4223=_[_0x5333('0x81')](this[_0x5333('0x11')][_0x57bd8d[_0x5333('0x4c')]]);_0x1e4223[_0x5333('0x1b')]=![];_0x1e4223[_0x5333('0x85')]=null;_0x1e4223[_0x5333('0x92')]=!![];_0x1e4223[_0x5333('0x88')]=_0x57bd8d['membername'];_0x1e4223[_0x5333('0x83')]=_0x57bd8d['holdtime'];_0x1e4223[_0x5333('0x82')]=!![];_0x1e4223[_0x5333('0x93')]=![];_0x1e4223[_0x5333('0x94')]=null;if(!_0x1e4223[_0x5333('0x95')]){if(_0x57bd8d[_0x5333('0x96')]==_0x5333('0x95')){_0x1e4223[_0x5333('0x86')]='COMPLETED';logger[_0x5333('0x6a')](_0x5333('0x97'),_0x1e4223['name'],_0x1e4223[_0x5333('0x57')]);}else{if(_[_0x5333('0x98')](_0x57bd8d[_0x5333('0x99')][_0x5333('0x9a')](),_0x5333('0x9b'))){if(this[_0x5333('0x11')][_0x57bd8d['linkedid']]){var _0xef82a5=_[_0x5333('0x81')](this[_0x5333('0x11')][_0x57bd8d[_0x5333('0x9c')]]);_0xef82a5[_0x5333('0x82')]=![];_0xef82a5['queuecallerexit']=!![];_0xef82a5[_0x5333('0x94')]=moment(_0x1e4223[_0x5333('0x77')])['add'](_0x57bd8d[_0x5333('0x83')],'seconds')[_0x5333('0x53')](_0x5333('0x78'));_0xef82a5['queuecallerexitreason']=_0x5333('0x9d');_0xef82a5[_0x5333('0x95')]=!![];_0xef82a5[_0x5333('0x9e')]=_0x5333('0x9f');_0xef82a5[_0x5333('0xa0')]=_0x57bd8d[_0x5333('0xa1')];_0xef82a5[_0x5333('0xa2')]=_0x57bd8d[_0x5333('0x4c')];logger['info'](_0x5333('0xa3'),_0xef82a5[_0x5333('0x54')],_0xef82a5[_0x5333('0x57')]);var _0x28dea3=this[_0x5333('0x11')][_0x57bd8d[_0x5333('0x9c')]];this[_0x5333('0x11')][_0x57bd8d[_0x5333('0x9c')]]=this[_0x5333('0x11')][_0x57bd8d[_0x5333('0x4c')]];this['queueReports'][_0x57bd8d[_0x5333('0x4c')]]=_0x28dea3;}}else{_0x1e4223[_0x5333('0x86')]=_0x5333('0xa4')+_0x57bd8d[_0x5333('0x96')][_0x5333('0xa5')]();logger[_0x5333('0x6a')](_0x5333('0xa6'),_0x1e4223[_0x5333('0x54')],_0x1e4223[_0x5333('0x57')],_0x1e4223[_0x5333('0x86')]);}}}this[_0x5333('0x3a')][_0x57bd8d[_0x5333('0x4c')]]=_0x1e4223;this['emitVoiceQueueChannelRemove'](_0x1e4223,_0x5333('0xa7'));}}}catch(_0x443b16){logger[_0x5333('0x41')](_0x5333('0xa8'),_0x57bd8d[_0x5333('0x4c')],util['inspect'](_0x443b16,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x5333('0x22')]=function(_0x1ac300){try{if(this[_0x5333('0x67')](_0x1ac300)){logger[_0x5333('0x51')](_0x5333('0xa9'),_0x1ac300[_0x5333('0x4c')],util[_0x5333('0x43')](_0x1ac300,{'showHidden':![],'depth':null}));this[_0x5333('0xaa')](_0x1ac300[_0x5333('0x4c')],_[_0x5333('0x7e')](_0x1ac300[_0x5333('0xab')])[0x0],_0x1ac300[_0x5333('0xac')]);if(this[_0x5333('0x11')][_0x1ac300[_0x5333('0x4c')]]){var _0xe6ccd4=_[_0x5333('0x81')](this[_0x5333('0x11')][_0x1ac300['uniqueid']]);if(_0xe6ccd4){if(this['isNotNull'](_0x1ac300[_0x5333('0xab')])&&this[_0x5333('0x67')](_0x1ac300[_0x5333('0xab')][_0x5333('0xad')])){switch(_0x1ac300['value']){case _0x5333('0xae'):_0xe6ccd4['queuecallerexit']=![];_0xe6ccd4['queuecallerexitAt']=null;break;case'TIMEOUT':_0xe6ccd4[_0x5333('0xaf')]='timeout';_0xe6ccd4[_0x5333('0x93')]=!![];_0xe6ccd4['queuecallerexitAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xe6ccd4[_0x5333('0x8a')]=moment()[_0x5333('0x53')](_0x5333('0x78'));logger['debug']('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x1ac300[_0x5333('0x4c')],util[_0x5333('0x43')](_0xe6ccd4,{'showHidden':![],'depth':null}));ami[_0x5333('0x4d')]('custom:timeout',_0xe6ccd4);break;default:_0xe6ccd4[_0x5333('0x93')]=!![];_0xe6ccd4[_0x5333('0x94')]=moment()[_0x5333('0x53')](_0x5333('0x78'));_0xe6ccd4[_0x5333('0x8a')]=moment()[_0x5333('0x53')](_0x5333('0x78'));}_0xe6ccd4[_0x5333('0x1b')]=![];_0xe6ccd4[_0x5333('0x85')]=null;_0xe6ccd4[_0x5333('0x86')]=_0x1ac300[_0x5333('0xac')];this['channels'][_0x1ac300[_0x5333('0x4c')]]=_0xe6ccd4;this['emitVoiceQueueChannelRemove'](_0xe6ccd4,_0x5333('0x21'));}else if(this[_0x5333('0x67')](_0x1ac300[_0x5333('0xab')])&&this[_0x5333('0x67')](_0x1ac300[_0x5333('0xab')][_0x5333('0xb0')])){if(!_0xe6ccd4[_0x5333('0x1b')]){_0xe6ccd4[_0x5333('0x93')]=!![];_0xe6ccd4[_0x5333('0x94')]=moment()[_0x5333('0x53')](_0x5333('0x78'));_0xe6ccd4[_0x5333('0x86')]=_0x5333('0xb1');_0xe6ccd4[_0x5333('0x8a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x5333('0x3a')][_0x1ac300['uniqueid']]=_0xe6ccd4;}}logger[_0x5333('0x6a')](_0x5333('0xb2'),_0x1ac300[_0x5333('0x4c')],_0xe6ccd4[_0x5333('0x54')],_0xe6ccd4['type'],_[_0x5333('0x7e')](_0x1ac300[_0x5333('0xab')])[0x0],_0x1ac300['value']);_0xe6ccd4[_0x5333('0x16')]=this[_0x5333('0x16')][_0x1ac300[_0x5333('0x4c')]];}}}}catch(_0x4ebda8){logger[_0x5333('0x41')]('[%s][voiceQueueReport][varset]',_0x1ac300[_0x5333('0x4c')],util[_0x5333('0x43')](_0x4ebda8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5333('0xd')][_0x5333('0xaa')]=function(_0x45def6,_0x5907b9,_0x2cb62d){var _0x3b0761=[_0x5333('0xb3'),'rtpaudioqosbridged',_0x5333('0xb4'),_0x5333('0xb5'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0x5333('0xb6'),_0x5333('0xb7'),_0x5333('0xb8'),'sipuri','bridgepeer',_0x5333('0xb9'),_0x5333('0xba'),_0x5333('0xbb'),_0x5333('0xbc'),_0x5333('0xbd'),_0x5333('0xbe'),'memberpenalty','memberrealtime'];if(!_[_0x5333('0x3c')](_0x5907b9)&&!_['includes'](_0x3b0761,_0x5907b9)){if(_[_0x5333('0x64')](this[_0x5333('0x16')][_0x45def6])){this['variables'][_0x45def6]={};}this[_0x5333('0x16')][_0x45def6][_0x5907b9]=_0x2cb62d;}};VoiceQueueReport[_0x5333('0xd')]['syncHangup']=function(_0x523513){try{if(this['isNotNull'](_0x523513)){logger[_0x5333('0x51')](_0x5333('0xbf'),_0x523513[_0x5333('0x4c')],util['inspect'](_0x523513,{'showHidden':![],'depth':null}));if(this[_0x5333('0x11')][_0x523513[_0x5333('0x4c')]]){for(var _0x46be17=0x0,_0x1f5ce8={};_0x46be17=0x0?moment(_0x2ee916[_0x950a('0x1d')])[_0x950a('0xf')](_0x2ee916['starttime'],_0x950a('0x10')):null,'data1':_0x950a('0x1e'),'data2':_0x2ee916[_0x950a('0x16')],'data3':_0x2ee916[_0x950a('0x13')],'data4':_0x2ee916[_0x950a('0x1f')]||null,'role':_0x950a('0x15'),'internal':_0x2ee916['accountcode']?_['toNumber'](_0x2ee916[_0x950a('0x16')]):undefined,'uniqueid':_0x2ee916[_0x950a('0x18')]},'log':_0x950a('0x19')});}; \ No newline at end of file +var _0xd7f3=['lastAssignedTo','interface','TALKING','queuecallerleaveAt','seconds','inbound','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','voiceDialReport','CreateMemberReport','membername','diff','starttime','endtime','outbound','dialstring','moment','util','voiceQueueReport','queuecallerexitAt','Request','voice','isNil','format'];(function(_0x25b5c1,_0x15f706){var _0x15cb0d=function(_0x269d4e){while(--_0x269d4e){_0x25b5c1['push'](_0x25b5c1['shift']());}};_0x15cb0d(++_0x15f706);}(_0xd7f3,0x1c8));var _0x3d7f=function(_0x333767,_0x3e6f9c){_0x333767=_0x333767-0x0;var _0x51661b=_0xd7f3[_0x333767];return _0x51661b;};'use strict';var moment=require(_0x3d7f('0x0'));var _=require('lodash');var util=require(_0x3d7f('0x1'));var client=require('../client');exports[_0x3d7f('0x2')]=function(_0x1f4b09){var _0x5aaf9b=_0x1f4b09['queuecallercompleteAt']||_0x1f4b09[_0x3d7f('0x3')];return client[_0x3d7f('0x4')]('CreateMemberReport',{'body':{'channel':_0x3d7f('0x5'),'membername':_0x1f4b09['lastAssignedTo'],'interface':_[_0x3d7f('0x6')](_0x1f4b09['interface'])?util[_0x3d7f('0x7')]('SIP/%s',_0x1f4b09[_0x3d7f('0x8')]):_0x1f4b09[_0x3d7f('0x9')],'type':_0x3d7f('0xa'),'enterAt':_0x1f4b09[_0x3d7f('0xb')],'exitAt':_0x5aaf9b,'duration':moment(_0x5aaf9b)['diff'](_0x1f4b09[_0x3d7f('0xb')],_0x3d7f('0xc')),'data1':_0x3d7f('0xd'),'data2':_0x1f4b09[_0x3d7f('0xe')],'data3':_0x1f4b09[_0x3d7f('0xf')],'data4':null,'data5':_0x1f4b09[_0x3d7f('0x10')],'role':_0x3d7f('0x11'),'internal':_0x1f4b09[_0x3d7f('0x12')]?_[_0x3d7f('0x13')](_0x1f4b09[_0x3d7f('0x12')]):undefined,'uniqueid':_0x1f4b09[_0x3d7f('0x14')]},'log':'CreateMemberReport'});};exports[_0x3d7f('0x15')]=function(_0x177d87){return client['Request'](_0x3d7f('0x16'),{'body':{'channel':'voice','membername':_0x177d87[_0x3d7f('0x17')],'interface':_0x177d87[_0x3d7f('0x9')],'type':_0x3d7f('0xa'),'enterAt':_0x177d87['starttime'],'exitAt':_0x177d87['endtime'],'duration':moment(_0x177d87['endtime'])[_0x3d7f('0x18')](_0x177d87[_0x3d7f('0x19')],_0x3d7f('0xc'))>=0x0?moment(_0x177d87[_0x3d7f('0x1a')])[_0x3d7f('0x18')](_0x177d87['starttime'],_0x3d7f('0xc')):null,'data1':_0x3d7f('0x1b'),'data2':_0x177d87[_0x3d7f('0x12')],'data3':_0x177d87[_0x3d7f('0xf')],'data4':_0x177d87[_0x3d7f('0x1c')]||null,'role':_0x3d7f('0x11'),'internal':_0x177d87[_0x3d7f('0x12')]?_[_0x3d7f('0x13')](_0x177d87[_0x3d7f('0x12')]):undefined,'uniqueid':_0x177d87[_0x3d7f('0x14')]},'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 912bf75..9e3259d 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 _0x3657=['stopRecordingOnTransfer','GetSettings','../client','getSettings','Request'];(function(_0x5678b5,_0x1c4aa8){var _0x4c09a5=function(_0x2aa89a){while(--_0x2aa89a){_0x5678b5['push'](_0x5678b5['shift']());}};_0x4c09a5(++_0x1c4aa8);}(_0x3657,0x183));var _0x7365=function(_0x513047,_0x2199c5){_0x513047=_0x513047-0x0;var _0x15b779=_0x3657[_0x513047];return _0x15b779;};'use strict';var client=require(_0x7365('0x0'));exports[_0x7365('0x1')]=function(){return client[_0x7365('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x7365('0x3')]},'log':_0x7365('0x4')});}; \ No newline at end of file +var _0xedb4=['stopRecordingOnTransfer','GetSettings','getSettings','Request','ShowSetting'];(function(_0x1d5a7a,_0x268def){var _0x3a50b1=function(_0x54c4d2){while(--_0x54c4d2){_0x1d5a7a['push'](_0x1d5a7a['shift']());}};_0x3a50b1(++_0x268def);}(_0xedb4,0x156));var _0x4edb=function(_0x385467,_0x298239){_0x385467=_0x385467-0x0;var _0x5ed67e=_0xedb4[_0x385467];return _0x5ed67e;};'use strict';var client=require('../client');exports[_0x4edb('0x0')]=function(){return client[_0x4edb('0x1')](_0x4edb('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x4edb('0x3')]},'log':_0x4edb('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 6ed6f5a..22bbff2 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 _0xdf7f=['getTemplates','GetTemplate','../client'];(function(_0x47e549,_0x2e53d6){var _0x251374=function(_0x400458){while(--_0x400458){_0x47e549['push'](_0x47e549['shift']());}};_0x251374(++_0x2e53d6);}(_0xdf7f,0xe3));var _0xfdf7=function(_0x38fefe,_0x1236e3){_0x38fefe=_0x38fefe-0x0;var _0x1601d0=_0xdf7f[_0x38fefe];return _0x1601d0;};'use strict';var client=require(_0xfdf7('0x0'));exports[_0xfdf7('0x1')]=function(_0x3cf267){return function(_0x354a02){return client['Request'](_0xfdf7('0x2'),{'options':{'raw':!![],'attributes':['id','name','html']},'log':_0xfdf7('0x2')});};}; \ No newline at end of file +var _0xfa91=['GetTemplate','name','html','getTemplates'];(function(_0x526d14,_0x2f348d){var _0x46b222=function(_0x4fce0a){while(--_0x4fce0a){_0x526d14['push'](_0x526d14['shift']());}};_0x46b222(++_0x2f348d);}(_0xfa91,0x11b));var _0x1fa9=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xfa91[_0x167cc1];return _0x10bc4b;};'use strict';var client=require('../client');exports[_0x1fa9('0x0')]=function(_0x486091){return function(_0x271597){return client['Request'](_0x1fa9('0x1'),{'options':{'raw':!![],'attributes':['id',_0x1fa9('0x2'),_0x1fa9('0x3')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index d65f301..4366f73 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 _0x57c2=['name','channel','status','AllConditions','field','operator','value','Condition','AnyConditions','Actions','action','data2','data3','data5','data6','data7','../client','getTriggers','Request','GetTrigger'];(function(_0x962de1,_0x361057){var _0x14085a=function(_0x220dae){while(--_0x220dae){_0x962de1['push'](_0x962de1['shift']());}};_0x14085a(++_0x361057);}(_0x57c2,0x100));var _0x257c=function(_0x5018bb,_0x2abfa3){_0x5018bb=_0x5018bb-0x0;var _0xea2f50=_0x57c2[_0x5018bb];return _0xea2f50;};'use strict';var client=require(_0x257c('0x0'));exports[_0x257c('0x1')]=function(_0x1b57cc){return function(_0x2ccd30){return client[_0x257c('0x2')](_0x257c('0x3'),{'options':{'raw':![],'attributes':['id',_0x257c('0x4'),_0x257c('0x5'),_0x257c('0x6')],'include':[{'model':'Condition','as':_0x257c('0x7'),'attributes':['id',_0x257c('0x8'),_0x257c('0x9'),_0x257c('0xa')]},{'model':_0x257c('0xb'),'as':_0x257c('0xc'),'attributes':['id',_0x257c('0x8'),_0x257c('0x9'),'value']},{'model':'Action','as':_0x257c('0xd'),'attributes':['id',_0x257c('0xe'),'data1',_0x257c('0xf'),_0x257c('0x10'),'data4',_0x257c('0x11'),_0x257c('0x12'),_0x257c('0x13')]}]},'log':_0x257c('0x3')});};}; \ No newline at end of file +var _0x172f=['action','data2','data3','data4','data5','data7','../client','getTriggers','Request','GetTrigger','channel','status','Condition','AllConditions','field','operator','value','Action','Actions'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x172f,0xd7));var _0xf172=function(_0x4a46ad,_0x5d0428){_0x4a46ad=_0x4a46ad-0x0;var _0x29ab8e=_0x172f[_0x4a46ad];return _0x29ab8e;};'use strict';var client=require(_0xf172('0x0'));exports[_0xf172('0x1')]=function(_0x2381e8){return function(_0x3a5cad){return client[_0xf172('0x2')](_0xf172('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xf172('0x4'),_0xf172('0x5')],'include':[{'model':_0xf172('0x6'),'as':_0xf172('0x7'),'attributes':['id',_0xf172('0x8'),_0xf172('0x9'),_0xf172('0xa')]},{'model':_0xf172('0x6'),'as':'AnyConditions','attributes':['id',_0xf172('0x8'),_0xf172('0x9'),'value']},{'model':_0xf172('0xb'),'as':_0xf172('0xc'),'attributes':['id',_0xf172('0xd'),'data1',_0xf172('0xe'),_0xf172('0xf'),_0xf172('0x10'),_0xf172('0x11'),'data6',_0xf172('0x12')]}]},'log':_0xf172('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 8e18be2..8f43214 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 _0x7c5d=['defaultuser','../client','GetTrunk','name','registry'];(function(_0x1a9b87,_0x4b9987){var _0x3e5a50=function(_0x488ffa){while(--_0x488ffa){_0x1a9b87['push'](_0x1a9b87['shift']());}};_0x3e5a50(++_0x4b9987);}(_0x7c5d,0x1aa));var _0xd7c5=function(_0x57c603,_0x1fd777){_0x57c603=_0x57c603-0x0;var _0x307094=_0x7c5d[_0x57c603];return _0x307094;};'use strict';var client=require(_0xd7c5('0x0'));exports['getTrunks']=function(_0x12c820){return function(_0x554051){return client['Request'](_0xd7c5('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xd7c5('0x2'),_0xd7c5('0x3'),_0xd7c5('0x4')]},'log':_0xd7c5('0x1')});};}; \ No newline at end of file +var _0x1e19=['GetTrunk','../client','getTrunks','Request'];(function(_0x576ca4,_0x1e1550){var _0x3a4556=function(_0x407eea){while(--_0x407eea){_0x576ca4['push'](_0x576ca4['shift']());}};_0x3a4556(++_0x1e1550);}(_0x1e19,0x1c9));var _0x91e1=function(_0x1f8dc0,_0x3d20c7){_0x1f8dc0=_0x1f8dc0-0x0;var _0x53b469=_0x1e19[_0x1f8dc0];return _0x53b469;};'use strict';var client=require(_0x91e1('0x0'));exports[_0x91e1('0x1')]=function(_0x45fd92){return function(_0x44c681){return client[_0x91e1('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name','registry','defaultuser']},'log':_0x91e1('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 1b6b7cf..f6b8e97 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['getAgent','Request','GetUser','agent','name','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','accountcode','internal','savePause','PauseUser'];(function(_0x3d65aa,_0x1bd0a5){var _0x4ed3a5=function(_0x254c08){while(--_0x254c08){_0x3d65aa['push'](_0x3d65aa['shift']());}};_0x4ed3a5(++_0x1bd0a5);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'where':{'role':_0x3071('0x2')},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),'accountcode',_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),_0x3071('0xb'),_0x3071('0xc'),_0x3071('0xd')]},'log':_0x3071('0xe')});};};exports[_0x3071('0xf')]=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x3071('0x3'),_0x3071('0x10'),_0x3071('0x11')]},'log':_0x3071('0xf')});};};exports[_0x3071('0x12')]=function(_0x4a470a,_0x2ace21,_0x11a7ee){return client[_0x3071('0x0')](_0x3071('0x13'),{'body':{'type':_0x2ace21,'uniqueid':_0x11a7ee},'options':{'where':{'id':_0x4a470a['id']}},'log':_0x3071('0x12')});};exports['saveUnpause']=function(_0x5330a8){return client[_0x3071('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5330a8['id']}},'log':_0x3071('0x12')});};exports[_0x3071('0x14')]=function(_0x5d4883){return client[_0x3071('0x0')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x3071('0x2'),'id':_0x5d4883},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),_0x3071('0x10'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),'interface']},'log':_0x3071('0x14')});}; \ No newline at end of file +var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x146c7f,_0x29ac20){var _0x5d578a=function(_0x517200){while(--_0x517200){_0x146c7f['push'](_0x146c7f['shift']());}};_0x5d578a(++_0x29ac20);}(_0x9c44,0x178));var _0x49c4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9c44[_0xfae23b];return _0x200640;};'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 be44985..3df8e34 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 _0x11bd=['../client','create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x11bd,0xea));var _0xd11b=function(_0x529f95,_0x47b583){_0x529f95=_0x529f95-0x0;var _0x59f48d=_0x11bd[_0x529f95];return _0x59f48d;};'use strict';var client=require(_0xd11b('0x0'));exports[_0xd11b('0x1')]=function(_0x27e71c){return client[_0xd11b('0x2')]('CreateVoiceAgentReport',{'body':_0x27e71c,'log':_0xd11b('0x3')});};exports[_0xd11b('0x4')]=function(_0x1f15ba,_0x1c6c42,_0x8e7def){return client[_0xd11b('0x2')](_0xd11b('0x5'),{'body':_0x1f15ba,'options':{'where':{'uniqueid':_0x1c6c42,'interface':_0x8e7def,'agentcomplete':!![]}},'log':_0xd11b('0x5')});}; \ No newline at end of file +var _0x6789=['../client','CreateVoiceAgentReport','update','Request','UpdateVoiceAgentReport'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x6789,0x1d6));var _0x9678=function(_0x279d78,_0x11513e){_0x279d78=_0x279d78-0x0;var _0x5233b8=_0x6789[_0x279d78];return _0x5233b8;};'use strict';var client=require(_0x9678('0x0'));exports['create']=function(_0x2e1977){return client['Request'](_0x9678('0x1'),{'body':_0x2e1977,'log':'CreateVoiceAgentReport'});};exports[_0x9678('0x2')]=function(_0x284d27,_0x95f6a7,_0x50ffa9){return client[_0x9678('0x3')](_0x9678('0x4'),{'body':_0x284d27,'options':{'where':{'uniqueid':_0x95f6a7,'interface':_0x50ffa9,'agentcomplete':!![]}},'log':_0x9678('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index d779fd6..2868993 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 _0xb01f=['calleridnum','context','callerid','DOCUMENTATION','GetVoiceCallReport','outbound','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','duration','billableseconds','GetVoiceCallReports','util','lodash','../client','create','CreateVoiceCallReport','merge'];(function(_0x209566,_0x305cf9){var _0x393c0a=function(_0x5b0447){while(--_0x5b0447){_0x209566['push'](_0x209566['shift']());}};_0x393c0a(++_0x305cf9);}(_0xb01f,0x1c6));var _0xfb01=function(_0x35fa92,_0x3cf8c6){_0x35fa92=_0x35fa92-0x0;var _0x4150cf=_0xb01f[_0x35fa92];return _0x4150cf;};'use strict';var moment=require('moment');var util=require(_0xfb01('0x0'));var _=require(_0xfb01('0x1'));var client=require(_0xfb01('0x2'));exports[_0xfb01('0x3')]=function(_0x162beb){return client['Request'](_0xfb01('0x4'),{'body':_[_0xfb01('0x5')](_0x162beb,{'source':_0x162beb[_0xfb01('0x6')],'destinationcontext':_0x162beb[_0xfb01('0x7')],'callerid':_0x162beb[_0xfb01('0x8')],'amaflags':_0xfb01('0x9')}),'log':_0xfb01('0x4')});};exports['getVoiceCallReports']=function(){return function(){return client['Request'](_0xfb01('0xa'),{'options':{'where':{'type':[_0xfb01('0xb')],'createdAt':{'$between':[moment()[_0xfb01('0xc')]('day')[_0xfb01('0xd')](_0xfb01('0xe')),moment()[_0xfb01('0xf')]('day')[_0xfb01('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xfb01('0x10'),'disposition',_0xfb01('0x11'),_0xfb01('0x12')]},'log':_0xfb01('0x13')});};}; \ No newline at end of file +var _0xf71e=['getVoiceCallReports','GetVoiceCallReport','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','lodash','../client','create','Request','CreateVoiceCallReport','merge','context','callerid','DOCUMENTATION'];(function(_0x5a8aa5,_0x257a29){var _0x4fb2cd=function(_0x8f34b6){while(--_0x8f34b6){_0x5a8aa5['push'](_0x5a8aa5['shift']());}};_0x4fb2cd(++_0x257a29);}(_0xf71e,0x89));var _0xef71=function(_0xdd827a,_0x482ad2){_0xdd827a=_0xdd827a-0x0;var _0x2f46f1=_0xf71e[_0xdd827a];return _0x2f46f1;};'use strict';var moment=require(_0xef71('0x0'));var util=require('util');var _=require(_0xef71('0x1'));var client=require(_0xef71('0x2'));exports[_0xef71('0x3')]=function(_0x4ee52f){return client[_0xef71('0x4')](_0xef71('0x5'),{'body':_[_0xef71('0x6')](_0x4ee52f,{'source':_0x4ee52f['calleridnum'],'destinationcontext':_0x4ee52f[_0xef71('0x7')],'callerid':_0x4ee52f[_0xef71('0x8')],'amaflags':_0xef71('0x9')}),'log':_0xef71('0x5')});};exports[_0xef71('0xa')]=function(){return function(){return client[_0xef71('0x4')](_0xef71('0xb'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()['startOf'](_0xef71('0xc'))[_0xef71('0xd')](_0xef71('0xe')),moment()[_0xef71('0xf')](_0xef71('0xc'))[_0xef71('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xef71('0x10'),_0xef71('0x11'),_0xef71('0x12'),_0xef71('0x13')]},'log':_0xef71('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 43300d6..c41642d 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 _0xfa35=['../client','create','Request','CreateVoiceDialReport'];(function(_0x947a45,_0x4de4f1){var _0x225866=function(_0x3b401c){while(--_0x3b401c){_0x947a45['push'](_0x947a45['shift']());}};_0x225866(++_0x4de4f1);}(_0xfa35,0x10c));var _0x5fa3=function(_0x1ce3fa,_0x2a15c2){_0x1ce3fa=_0x1ce3fa-0x0;var _0x27a3b5=_0xfa35[_0x1ce3fa];return _0x27a3b5;};'use strict';var client=require(_0x5fa3('0x0'));exports[_0x5fa3('0x1')]=function(_0x55f453){return client[_0x5fa3('0x2')](_0x5fa3('0x3'),{'body':_0x55f453,'log':_0x5fa3('0x3')});}; \ No newline at end of file +var _0x708d=['Request','CreateVoiceDialReport','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x708d,0x143));var _0xd708=function(_0x1f5236,_0xea7afc){_0x1f5236=_0x1f5236-0x0;var _0x2efe18=_0x708d[_0x1f5236];return _0x2efe18;};'use strict';var client=require(_0xd708('0x0'));exports['create']=function(_0x44ad5b){return client[_0xd708('0x1')]('CreateVoiceDialReport',{'body':_0x44ad5b,'log':_0xd708('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 8fa645c..14f2324 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 _0xa45c=['exten','../client','getVoiceExtensions'];(function(_0x1cf8d1,_0xe6cd99){var _0x227863=function(_0x2236fc){while(--_0x2236fc){_0x1cf8d1['push'](_0x1cf8d1['shift']());}};_0x227863(++_0xe6cd99);}(_0xa45c,0x6d));var _0xca45=function(_0x33a072,_0x36e177){_0x33a072=_0x33a072-0x0;var _0x14fda9=_0xa45c[_0x33a072];return _0x14fda9;};'use strict';var client=require(_0xca45('0x0'));exports[_0xca45('0x1')]=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xca45('0x2'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xca45('0x1')});};}; \ No newline at end of file +var _0xaf1d=['getVoiceExtensions','Request','GetVoiceExtension','recordingFormat','../client'];(function(_0x5e7ce2,_0x2e5851){var _0x1f096b=function(_0x52153c){while(--_0x52153c){_0x5e7ce2['push'](_0x5e7ce2['shift']());}};_0x1f096b(++_0x2e5851);}(_0xaf1d,0x9f));var _0xdaf1=function(_0x312e64,_0x41ba1c){_0x312e64=_0x312e64-0x0;var _0x45872e=_0xaf1d[_0x312e64];return _0x45872e;};'use strict';var client=require(_0xdaf1('0x0'));exports[_0xdaf1('0x1')]=function(){return function(){return client[_0xdaf1('0x2')](_0xdaf1('0x3'),{'options':{'raw':!![],'attributes':['id','exten',_0xdaf1('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xdaf1('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index f188b78..d22accd 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 _0x5785=['dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','active','mandatoryDispositionPause','TrunkBackup','callerid','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout'];(function(_0x31f5b4,_0x31a5ec){var _0x509f55=function(_0x71f66c){while(--_0x71f66c){_0x31f5b4['push'](_0x31f5b4['shift']());}};_0x509f55(++_0x31a5ec);}(_0x5785,0x119));var _0x5578=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x5785[_0x27af45];return _0x18df21;};'use strict';var client=require(_0x5578('0x0'));exports[_0x5578('0x1')]=function(){return function(){return client[_0x5578('0x2')](_0x5578('0x3'),{'options':{'raw':![],'attributes':['id',_0x5578('0x4'),'acw',_0x5578('0x5'),_0x5578('0x6'),_0x5578('0x7'),_0x5578('0x8'),_0x5578('0x9'),_0x5578('0xa'),_0x5578('0xb'),_0x5578('0xc'),_0x5578('0xd'),_0x5578('0xe'),'dialPredictiveOptimizationPercentage',_0x5578('0xf'),_0x5578('0x10'),_0x5578('0x11'),'dialOriginateTimeout',_0x5578('0x12'),'dialQueueTimeout',_0x5578('0x13'),'dialCongestionMaxRetry',_0x5578('0x14'),_0x5578('0x15'),_0x5578('0x16'),'dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency',_0x5578('0x17'),_0x5578('0x18'),_0x5578('0x19'),_0x5578('0x1a'),_0x5578('0x1b'),_0x5578('0x1c'),_0x5578('0x1d'),_0x5578('0x1e'),_0x5578('0x1f'),_0x5578('0x20'),'dialAMDMinWordLength',_0x5578('0x21'),_0x5578('0x22'),_0x5578('0x23'),_0x5578('0x24'),_0x5578('0x25'),_0x5578('0x26'),_0x5578('0x27'),_0x5578('0x28'),_0x5578('0x29'),_0x5578('0x2a'),'dialQueueProject2',_0x5578('0x7'),_0x5578('0x2b'),'dialRandomLastDigitCallerIdNumber','dialCutDigit',_0x5578('0x2c'),_0x5578('0x2d'),'dialDropMaxRetry',_0x5578('0x2e'),_0x5578('0x2f'),_0x5578('0x30'),_0x5578('0x31'),_0x5578('0x32'),_0x5578('0x33'),_0x5578('0x34'),_0x5578('0x35'),_0x5578('0x36'),_0x5578('0x37'),_0x5578('0x38')],'include':[{'model':_0x5578('0x39'),'as':_0x5578('0x39'),'attributes':['id',_0x5578('0x4'),'callerid',_0x5578('0x3a')]},{'model':'Pause','as':_0x5578('0x3b'),'attributes':['id',_0x5578('0x4')]},{'model':_0x5578('0x39'),'as':_0x5578('0x3c'),'attributes':['id',_0x5578('0x4'),_0x5578('0x3d'),'active']},{'model':_0x5578('0x3e'),'as':'Interval','attributes':['id','name'],'include':[{'model':_0x5578('0x3e'),'as':'Intervals','attributes':['id',_0x5578('0x4'),_0x5578('0x3f')]}]}]},'log':_0x5578('0x1')});};}; \ No newline at end of file +var _0x29b1=['timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','active','mandatoryDispositionPause','callerid','Interval','interval','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x29b1,0x13b));var _0x129b=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x29b1[_0x173441];return _0x2423a8;};'use strict';var client=require('../client');exports['getVoiceQueues']=function(){return function(){return client[_0x129b('0x0')](_0x129b('0x1'),{'options':{'raw':![],'attributes':['id',_0x129b('0x2'),_0x129b('0x3'),_0x129b('0x4'),_0x129b('0x5'),_0x129b('0x6'),_0x129b('0x7'),_0x129b('0x8'),_0x129b('0x9'),_0x129b('0xa'),'dialLimitQueue',_0x129b('0xb'),'dialPredictiveOptimization',_0x129b('0xc'),_0x129b('0xd'),'dialOriginateCallerIdName','dialOriginateCallerIdNumber',_0x129b('0xe'),'dialQueueOptions',_0x129b('0xf'),_0x129b('0x10'),_0x129b('0x11'),_0x129b('0x12'),_0x129b('0x13'),_0x129b('0x14'),'dialNoAnswerMaxRetry',_0x129b('0x15'),_0x129b('0x16'),'dialTimezone',_0x129b('0x17'),_0x129b('0x18'),'dialCheckDuplicateType',_0x129b('0x19'),_0x129b('0x1a'),_0x129b('0x1b'),_0x129b('0x1c'),_0x129b('0x1d'),'dialAMDMinWordLength',_0x129b('0x1e'),_0x129b('0x1f'),_0x129b('0x20'),'dialAMDMaximumWordLength',_0x129b('0x21'),_0x129b('0x22'),'dialRecallInQueue',_0x129b('0x23'),'dialAgiAfterHangupAgent',_0x129b('0x24'),_0x129b('0x25'),_0x129b('0x6'),_0x129b('0x26'),_0x129b('0x27'),_0x129b('0x28'),'dialNoSuchNumberMaxRetry',_0x129b('0x29'),_0x129b('0x2a'),'dialDropRetryFrequency',_0x129b('0x2b'),_0x129b('0x2c'),_0x129b('0x2d'),_0x129b('0x2e'),_0x129b('0x2f'),_0x129b('0x30'),'mandatoryDisposition',_0x129b('0x31'),_0x129b('0x32'),'dialPreviewAutoRecallMe'],'include':[{'model':_0x129b('0x33'),'as':'Trunk','attributes':['id',_0x129b('0x2'),'callerid',_0x129b('0x34')]},{'model':'Pause','as':_0x129b('0x35'),'attributes':['id',_0x129b('0x2')]},{'model':_0x129b('0x33'),'as':'TrunkBackup','attributes':['id',_0x129b('0x2'),_0x129b('0x36'),_0x129b('0x34')]},{'model':'Interval','as':'Interval','attributes':['id',_0x129b('0x2')],'include':[{'model':_0x129b('0x37'),'as':'Intervals','attributes':['id',_0x129b('0x2'),_0x129b('0x38')]}]}]},'log':_0x129b('0x39')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 8021f5e..2851760 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(_0x3e54d3,_0xa1c603){var _0x57c0ef=function(_0xef6a02){while(--_0xef6a02){_0x3e54d3['push'](_0x3e54d3['shift']());}};_0x57c0ef(++_0xa1c603);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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(_0x2d1ab0,_0xa2dcf4){var _0xb15680=function(_0x37bb2e){while(--_0x37bb2e){_0x2d1ab0['push'](_0x2d1ab0['shift']());}};_0xb15680(++_0xa2dcf4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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 b18716e..0ef2bca 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 _0x9976=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x52d05e,_0x340f51){var _0x3db1a2=function(_0x59802c){while(--_0x59802c){_0x52d05e['push'](_0x52d05e['shift']());}};_0x3db1a2(++_0x340f51);}(_0x9976,0xf1));var _0x6997=function(_0x22a9dd,_0x496dde){_0x22a9dd=_0x22a9dd-0x0;var _0xa13677=_0x9976[_0x22a9dd];return _0xa13677;};'use strict';var client=require(_0x6997('0x0'));exports[_0x6997('0x1')]=function(_0xe55e55){return function(){return client['Request'](_0x6997('0x2'),{'options':{'where':{'VoiceQueueId':_0xe55e55,'paused':!![]},'raw':!![]},'log':_0x6997('0x1')});};}; \ No newline at end of file +var _0x35bf=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x3517f1,_0x25cd0c){var _0xa091bd=function(_0x2a4218){while(--_0x2a4218){_0x3517f1['push'](_0x3517f1['shift']());}};_0xa091bd(++_0x25cd0c);}(_0x35bf,0xac));var _0xf35b=function(_0x4939da,_0x56d6c9){_0x4939da=_0x4939da-0x0;var _0x2a4e57=_0x35bf[_0x4939da];return _0x2a4e57;};'use strict';var client=require(_0xf35b('0x0'));exports[_0xf35b('0x1')]=function(_0x3007bc){return function(){return client[_0xf35b('0x2')](_0xf35b('0x3'),{'options':{'where':{'VoiceQueueId':_0x3007bc,'paused':!![]},'raw':!![]},'log':_0xf35b('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 810c073..c1be30b 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(_0x3f8ac9,_0x67d34f){var _0x1285f4=function(_0x3cbc1a){while(--_0x3cbc1a){_0x3f8ac9['push'](_0x3f8ac9['shift']());}};_0x1285f4(++_0x67d34f);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x16bf4d,_0x4cf786){var _0xf916ad=function(_0x542101){while(--_0x542101){_0x16bf4d['push'](_0x16bf4d['shift']());}};_0xf916ad(++_0x4cf786);}(_0x7a54,0x106));var _0x47a5=function(_0x468e32,_0x51c766){_0x468e32=_0x468e32-0x0;var _0x29f0a4=_0x7a54[_0x468e32];return _0x29f0a4;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index f201ff7..78c0554 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 _0xf76a=['transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereecontext','transfereeexten','transfereelinkedid','isexternal','extension','blind','attendedTransfer','Request','result','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetlinkedid','origtransferercontext','../client','transfers','blindTransfer','CreateVoiceTransferReport'];(function(_0x528373,_0x4595d3){var _0x3bac7c=function(_0x4c08da){while(--_0x4c08da){_0x528373['push'](_0x528373['shift']());}};_0x3bac7c(++_0x4595d3);}(_0xf76a,0xe6));var _0xaf76=function(_0x221936,_0x48fd5b){_0x221936=_0x221936-0x0;var _0x447c26=_0xf76a[_0x221936];return _0x447c26;};'use strict';var client=require(_0xaf76('0x0'));exports[_0xaf76('0x1')]={};exports[_0xaf76('0x2')]=function(_0x574051){return client['Request'](_0xaf76('0x3'),{'body':{'result':_0x574051['result'],'transfererchannel':_0x574051['transfererchannel'],'transferercalleridnum':_0x574051[_0xaf76('0x4')],'transferercalleridname':_0x574051[_0xaf76('0x5')],'transfererconnectedlinenum':_0x574051[_0xaf76('0x6')],'transfererconnectedlinename':_0x574051[_0xaf76('0x7')],'transfereraccountcode':_0x574051['transfereraccountcode'],'transferercontext':_0x574051[_0xaf76('0x8')],'transfererexten':_0x574051[_0xaf76('0x9')],'transfererlinkedid':_0x574051[_0xaf76('0xa')],'transfereechannel':_0x574051[_0xaf76('0xb')],'transfereecalleridnum':_0x574051[_0xaf76('0xc')],'transfereecalleridname':_0x574051[_0xaf76('0xd')],'transfereeconnectedlinenum':_0x574051['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x574051[_0xaf76('0xe')],'transfereeaccountcode':_0x574051['transfereeaccountcode'],'transfereecontext':_0x574051[_0xaf76('0xf')],'transfereeexten':_0x574051[_0xaf76('0x10')],'transfereelinkedid':_0x574051[_0xaf76('0x11')],'isexternal':_0x574051[_0xaf76('0x12')],'context':_0x574051['context'],'extension':_0x574051[_0xaf76('0x13')],'type':_0xaf76('0x14')},'log':_0xaf76('0x3')});};exports[_0xaf76('0x15')]=function(_0x529637){return client[_0xaf76('0x16')]('CreateVoiceTransferReport',{'body':{'result':_0x529637[_0xaf76('0x17')],'transfererchannel':_0x529637[_0xaf76('0x18')],'transferercalleridnum':_0x529637[_0xaf76('0x19')],'transferercalleridname':_0x529637[_0xaf76('0x1a')],'transfererconnectedlinenum':_0x529637[_0xaf76('0x1b')],'transfererconnectedlinename':_0x529637[_0xaf76('0x1c')],'transfereraccountcode':_0x529637[_0xaf76('0x1d')],'transferercontext':_0x529637['secondtransferercontext'],'transfererexten':_0x529637[_0xaf76('0x1e')],'transfererlinkedid':_0x529637['origtransfererlinkedid'],'transfereechannel':_0x529637[_0xaf76('0x1f')],'transfereecalleridnum':_0x529637[_0xaf76('0x20')],'transfereecalleridname':_0x529637[_0xaf76('0x21')],'transfereeconnectedlinenum':_0x529637[_0xaf76('0x22')],'transfereeconnectedlinename':_0x529637[_0xaf76('0x23')],'transfereeaccountcode':_0x529637[_0xaf76('0x24')],'transfereecontext':_0x529637['transfertargetcontext'],'transfereeexten':_0x529637['transfertargetexten'],'transfereelinkedid':_0x529637[_0xaf76('0x25')],'isexternal':_0x529637[_0xaf76('0x12')],'context':_0x529637[_0xaf76('0x26')],'extension':_0x529637['origtransfererexten'],'type':'attended'},'log':_0xaf76('0x3')});}; \ No newline at end of file +var _0x2d77=['transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','context','blind','result','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','../client','blindTransfer','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfereechannel','transfereecalleridname'];(function(_0x251e8c,_0x277c33){var _0x1e0c1d=function(_0x20b89c){while(--_0x20b89c){_0x251e8c['push'](_0x251e8c['shift']());}};_0x1e0c1d(++_0x277c33);}(_0x2d77,0x83));var _0x72d7=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x2d77[_0x6c993a];return _0x27f547;};'use strict';var client=require(_0x72d7('0x0'));exports['transfers']={};exports[_0x72d7('0x1')]=function(_0x5ebb8b){return client[_0x72d7('0x2')](_0x72d7('0x3'),{'body':{'result':_0x5ebb8b['result'],'transfererchannel':_0x5ebb8b[_0x72d7('0x4')],'transferercalleridnum':_0x5ebb8b[_0x72d7('0x5')],'transferercalleridname':_0x5ebb8b[_0x72d7('0x6')],'transfererconnectedlinenum':_0x5ebb8b[_0x72d7('0x7')],'transfererconnectedlinename':_0x5ebb8b[_0x72d7('0x8')],'transfereraccountcode':_0x5ebb8b['transfereraccountcode'],'transferercontext':_0x5ebb8b[_0x72d7('0x9')],'transfererexten':_0x5ebb8b[_0x72d7('0xa')],'transfererlinkedid':_0x5ebb8b['transfererlinkedid'],'transfereechannel':_0x5ebb8b[_0x72d7('0xb')],'transfereecalleridnum':_0x5ebb8b['transfereecalleridnum'],'transfereecalleridname':_0x5ebb8b[_0x72d7('0xc')],'transfereeconnectedlinenum':_0x5ebb8b[_0x72d7('0xd')],'transfereeconnectedlinename':_0x5ebb8b[_0x72d7('0xe')],'transfereeaccountcode':_0x5ebb8b[_0x72d7('0xf')],'transfereecontext':_0x5ebb8b[_0x72d7('0x10')],'transfereeexten':_0x5ebb8b['transfereeexten'],'transfereelinkedid':_0x5ebb8b[_0x72d7('0x11')],'isexternal':_0x5ebb8b['isexternal'],'context':_0x5ebb8b[_0x72d7('0x12')],'extension':_0x5ebb8b['extension'],'type':_0x72d7('0x13')},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0x11e850){return client[_0x72d7('0x2')](_0x72d7('0x3'),{'body':{'result':_0x11e850[_0x72d7('0x14')],'transfererchannel':_0x11e850['origtransfererchannel'],'transferercalleridnum':_0x11e850['origtransferercalleridnum'],'transferercalleridname':_0x11e850['origtransferercalleridname'],'transfererconnectedlinenum':_0x11e850[_0x72d7('0x15')],'transfererconnectedlinename':_0x11e850[_0x72d7('0x16')],'transfereraccountcode':_0x11e850['origtransfereraccountcode'],'transferercontext':_0x11e850[_0x72d7('0x17')],'transfererexten':_0x11e850[_0x72d7('0x18')],'transfererlinkedid':_0x11e850[_0x72d7('0x19')],'transfereechannel':_0x11e850[_0x72d7('0x1a')],'transfereecalleridnum':_0x11e850[_0x72d7('0x1b')],'transfereecalleridname':_0x11e850[_0x72d7('0x1c')],'transfereeconnectedlinenum':_0x11e850[_0x72d7('0x1d')],'transfereeconnectedlinename':_0x11e850[_0x72d7('0x1e')],'transfereeaccountcode':_0x11e850[_0x72d7('0x1f')],'transfereecontext':_0x11e850[_0x72d7('0x20')],'transfereeexten':_0x11e850[_0x72d7('0x21')],'transfereelinkedid':_0x11e850[_0x72d7('0x22')],'isexternal':_0x11e850['isexternal'],'context':_0x11e850[_0x72d7('0x23')],'extension':_0x11e850['origtransfererexten'],'type':'attended'},'log':_0x72d7('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 11a5316..5269600 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 _0xfdbd=['sumHoldTime','talking','total','type','unmanaged','abandoned','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','find','omit','undefined','values','isConnected','voicechannel','length','map','uniqueid','%s.%s','filename','wav','MixMonitor','channel','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','faxAccounts','checkAfterSend','listen','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','../ami','format','%s/%s','SIP','name','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','asterisk','username','ami\x20disconnected','join','pick','keys','module','Action','then','catch','error','message','action','Command','voiceQueues','strategy','available','loggedIn','pTalking'];(function(_0x347412,_0x56166b){var _0x4995b5=function(_0x4480d2){while(--_0x4480d2){_0x347412['push'](_0x347412['shift']());}};_0x4995b5(++_0x56166b);}(_0xfdbd,0xf0));var _0xdfdb=function(_0xdc66e7,_0x13a216){_0xdc66e7=_0xdc66e7-0x0;var _0x1a46af=_0xfdbd[_0xdc66e7];return _0x1a46af;};'use strict';var _=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var jayson=require(_0xdfdb('0x2'));var schema=require(_0xdfdb('0x3'));var BPromise=require(_0xdfdb('0x4'));var moment=require(_0xdfdb('0x5'));var config=require(_0xdfdb('0x6'));var properties=require(_0xdfdb('0x7'));var ami=require(_0xdfdb('0x8'));exports['listen']=function(_0x3f5b2d,_0x4a4a3f,_0x453ef6){return new BPromise(function(_0x41bd5e,_0x489f19){var _0x556dc0={'QueuePause':function(_0x590b5d){return new Promise(function(_0x188508,_0xf72a24){var _0x47c629=util[_0xdfdb('0x9')](_0xdfdb('0xa'),_0xdfdb('0xb'),_0x590b5d[_0xdfdb('0xc')]);if(_0x3f5b2d[_0xdfdb('0xd')]&&_0x3f5b2d[_0xdfdb('0xd')][_0x47c629]&&_0x3f5b2d[_0xdfdb('0xd')][_0x47c629]['timer']){_0x3f5b2d[_0xdfdb('0xd')][_0x47c629][_0xdfdb('0xe')]();}if(_0x3f5b2d['agents'][_0x47c629]){_0x3f5b2d[_0xdfdb('0xf')][_0x47c629][_0xdfdb('0x10')]({'statePause':_0x590b5d[_0xdfdb('0x11')]?!![]:![]});}_0x188508({'code':0xc8,'message':_0xdfdb('0x12')});});},'Reload':function(_0x2a95f1){var _0x13ada2=this;return new Promise(function(_0xf5d903,_0x16017d){if(ami['isConnected']()==![]){return _0x16017d(_0x13ada2['error'](0x1f4,[config[_0xdfdb('0x13')]['ip'],config['asterisk'][_0xdfdb('0x14')],_0xdfdb('0x15')][_0xdfdb('0x16')]('\x20')));}_0x2a95f1=_[_0xdfdb('0x17')](_0x2a95f1,_[_0xdfdb('0x18')](properties[_0xdfdb('0x19')]));_0x2a95f1['action']='Reload';return ami[_0xdfdb('0x1a')](_0x2a95f1)[_0xdfdb('0x1b')](function(_0x2c1070){_0xf5d903({'code':0xc8,'message':_0x2c1070['message']});})[_0xdfdb('0x1c')](function(_0xb677b1){_0x16017d(_0x13ada2[_0xdfdb('0x1d')](0x1f5,_0xb677b1[_0xdfdb('0x1e')]));});});},'Command':function(_0x306a33){var _0x2294de=this;return new Promise(function(_0x693a2c,_0x29a639){if(ami['isConnected']()==![]){return _0x29a639(_0x2294de[_0xdfdb('0x1d')](0x1f4,[config[_0xdfdb('0x13')]['ip'],config[_0xdfdb('0x13')]['username'],_0xdfdb('0x15')][_0xdfdb('0x16')]('\x20')));}_0x306a33=_[_0xdfdb('0x17')](_0x306a33,'command');_0x306a33[_0xdfdb('0x1f')]=_0xdfdb('0x20');return ami[_0xdfdb('0x1a')](_0x306a33)['then'](function(_0x2a80c1){_0x693a2c({'code':0xc8,'message':_0x2a80c1['content']});})[_0xdfdb('0x1c')](function(_0x145350){_0x29a639(_0x2294de[_0xdfdb('0x1d')](0x1f5,_0x145350[_0xdfdb('0x1e')]));});});},'VoiceQueues':function(_0x4f69cf){return new Promise(function(_0x4c253e,_0x4363d8){var _0x956843=[];for(var _0x400663 in _0x3f5b2d[_0xdfdb('0x21')]){if(_0x3f5b2d[_0xdfdb('0x21')]['hasOwnProperty'](_0x400663)){var _0xec4d22=_0x3f5b2d[_0xdfdb('0x21')][_0x400663];var _0xdf3a5c={'id':_0xec4d22['id'],'name':_0xec4d22['name'],'strategy':_0xec4d22[_0xdfdb('0x22')],'answered':_0xec4d22['answered'],'available':_0xec4d22[_0xdfdb('0x23')],'loggedIn':_0xec4d22[_0xdfdb('0x24')],'pTalking':_0xec4d22[_0xdfdb('0x25')],'sumBillable':_0xec4d22['sumBillable'],'sumDuration':_0xec4d22['sumDuration'],'sumHoldTime':_0xec4d22[_0xdfdb('0x26')]||0x0,'talking':_0xec4d22[_0xdfdb('0x27')],'total':_0xec4d22[_0xdfdb('0x28')],'type':_0xec4d22[_0xdfdb('0x29')],'unmanaged':_0xec4d22[_0xdfdb('0x2a')],'abandoned':_0xec4d22[_0xdfdb('0x2b')],'waiting':_0xec4d22['waiting'],'loggedInDb':_0xec4d22[_0xdfdb('0x2c')]};if(_0xec4d22[_0xdfdb('0x29')]===_0xdfdb('0x2d')){_0xdf3a5c[_0xdfdb('0x2e')]=_0xec4d22[_0xdfdb('0x2e')];_0xdf3a5c[_0xdfdb('0x2f')]=_0xec4d22[_0xdfdb('0x2f')];_0xdf3a5c[_0xdfdb('0x30')]=_0xec4d22[_0xdfdb('0x30')];_0xdf3a5c[_0xdfdb('0x31')]=_0xec4d22[_0xdfdb('0x31')];_0xdf3a5c['dialOriginateTimeout']=_0xec4d22['dialOriginateTimeout'];_0xdf3a5c[_0xdfdb('0x32')]=_0xec4d22['dialPrefix'];_0xdf3a5c[_0xdfdb('0x33')]=_0xec4d22[_0xdfdb('0x33')];_0xdf3a5c[_0xdfdb('0x34')]=_0xec4d22[_0xdfdb('0x34')];_0xdf3a5c['outboundAnswerCallsDay']=_0xec4d22[_0xdfdb('0x35')];_0xdf3a5c['outboundBlacklistCallsDay']=_0xec4d22[_0xdfdb('0x36')];_0xdf3a5c[_0xdfdb('0x37')]=_0xec4d22[_0xdfdb('0x37')];_0xdf3a5c[_0xdfdb('0x38')]=_0xec4d22[_0xdfdb('0x38')];_0xdf3a5c[_0xdfdb('0x39')]=_0xec4d22['outboundDropCallsDayACS'];_0xdf3a5c[_0xdfdb('0x3a')]=_0xec4d22[_0xdfdb('0x3a')];_0xdf3a5c['outboundDropCallsDayTimeout']=_0xec4d22[_0xdfdb('0x3b')];_0xdf3a5c[_0xdfdb('0x3c')]=_0xec4d22[_0xdfdb('0x3c')];_0xdf3a5c[_0xdfdb('0x3d')]=_0xec4d22[_0xdfdb('0x3d')];_0xdf3a5c[_0xdfdb('0x3e')]=_0xec4d22[_0xdfdb('0x3e')];_0xdf3a5c[_0xdfdb('0x3f')]=_0xec4d22[_0xdfdb('0x3f')];_0xdf3a5c[_0xdfdb('0x40')]=_0xec4d22[_0xdfdb('0x40')];_0xdf3a5c['outboundUnknownCallsDay']=_0xec4d22[_0xdfdb('0x41')];_0xdf3a5c[_0xdfdb('0x42')]=_0xec4d22[_0xdfdb('0x42')];_0xdf3a5c[_0xdfdb('0x43')]=_0xec4d22[_0xdfdb('0x43')];_0xdf3a5c[_0xdfdb('0x44')]=_0xec4d22[_0xdfdb('0x44')];_0xdf3a5c[_0xdfdb('0x45')]=_0xec4d22['predictiveIntervalDroppedCallsCallersExit'];_0xdf3a5c['predictiveIntervalDroppedCallsTimeout']=_0xec4d22[_0xdfdb('0x46')];_0xdf3a5c[_0xdfdb('0x47')]=_0xec4d22[_0xdfdb('0x47')];_0xdf3a5c[_0xdfdb('0x48')]=_0xec4d22[_0xdfdb('0x48')];_0xdf3a5c[_0xdfdb('0x49')]=_0xec4d22[_0xdfdb('0x49')];_0xdf3a5c[_0xdfdb('0x4a')]=_0xec4d22[_0xdfdb('0x4a')];_0xdf3a5c['predictiveIntervalPauses']=_0xec4d22[_0xdfdb('0x4b')];_0xdf3a5c[_0xdfdb('0x4c')]=_0xec4d22[_0xdfdb('0x4c')];_0xdf3a5c[_0xdfdb('0x4d')]=_0xec4d22[_0xdfdb('0x4d')];_0xdf3a5c['message']=_0xec4d22[_0xdfdb('0x1e')];_0xdf3a5c[_0xdfdb('0x4e')]=_0xec4d22[_0xdfdb('0x4e')];_0xdf3a5c[_0xdfdb('0x4f')]=_0xec4d22[_0xdfdb('0x4f')];_0xdf3a5c['erlangCallToSecond']=_0xec4d22[_0xdfdb('0x50')];_0xdf3a5c[_0xdfdb('0x51')]=_0xec4d22[_0xdfdb('0x51')];_0xdf3a5c['erlangBusyFactor']=_0xec4d22[_0xdfdb('0x52')];_0xdf3a5c['startPredictive']=_0xec4d22[_0xdfdb('0x53')];_0xdf3a5c['startProgressive']=_0xec4d22[_0xdfdb('0x54')];}if(_0xec4d22[_0xdfdb('0x55')]){_0xdf3a5c['Trunk']={'id':_0xec4d22[_0xdfdb('0x55')]['id'],'name':_0xec4d22['Trunk'][_0xdfdb('0xc')],'active':_0xec4d22[_0xdfdb('0x55')][_0xdfdb('0x56')],'callerid':_0xec4d22[_0xdfdb('0x55')][_0xdfdb('0x57')]};}if(_0xec4d22['Interval']){_0xdf3a5c['Interval']={'id':_0xec4d22[_0xdfdb('0x58')]['id'],'name':_0xec4d22[_0xdfdb('0x58')]['name']};}_0x956843[_0xdfdb('0x59')](_0xdf3a5c);}}_0x4c253e({'count':_0x956843['length'],'rows':_0x956843});});},'UpdateVoiceQueue':function(_0xa7be4b){return new Promise(function(_0x158407,_0x8b1db1){var _0x103166=_[_0xdfdb('0x5a')](_0x3f5b2d[_0xdfdb('0x21')],{'id':parseInt(_0xa7be4b['id'])});var _0x41701c=_[_0xdfdb('0x5b')](_0xa7be4b,['id']);if(_0x103166){for(var _0x2ac36e in _0x41701c){if(typeof _0x41701c[_0x2ac36e]!==_0xdfdb('0x5c')&&typeof _0x103166[_0x2ac36e]!==_0xdfdb('0x5c')){_0x103166[_0x2ac36e]=_0x41701c[_0x2ac36e];}}_0x158407(_0x103166);}else{_0x8b1db1();}});},'VoiceChannels':function(_0x3c8460){return new Promise(function(_0x2d58f4,_0x202c25){var _0x1c08fb=_[_0xdfdb('0x5d')](_0x3f5b2d['channels']);_0x2d58f4({'count':_0x1c08fb['length'],'rows':_0x1c08fb});});},'VoiceChannelMixMonitor':function(_0x6b03a3){var _0x1aff71=this;return new Promise(function(_0x2f1d06,_0x4bbb88){if(ami[_0xdfdb('0x5e')]()==![]){return _0x4bbb88(_0x1aff71[_0xdfdb('0x1d')](0x1f4,[config[_0xdfdb('0x13')]['ip'],config[_0xdfdb('0x13')]['username'],_0xdfdb('0x15')][_0xdfdb('0x16')]('\x20')));}var _0x5446f6=schema(properties[_0xdfdb('0x5f')])[_0xdfdb('0x3')](_0x6b03a3);if(_0x5446f6[_0xdfdb('0x60')]>0x0){return _0x4bbb88(_0x1aff71[_0xdfdb('0x1d')](0x1f4,_[_0xdfdb('0x61')](_0x5446f6,_0xdfdb('0x1e'))[_0xdfdb('0x16')](',\x20')));}var _0x1f5b88=_[_0xdfdb('0x5a')](_0x3f5b2d['channels'],{'uniqueid':_0x6b03a3[_0xdfdb('0x62')]});if(_0x1f5b88&&_0x1f5b88['channel']){var _0x15185c=util[_0xdfdb('0x9')](_0xdfdb('0x63'),_0x6b03a3[_0xdfdb('0x64')]||_0x6b03a3[_0xdfdb('0x62')],_0x6b03a3[_0xdfdb('0x9')]||_0xdfdb('0x65'));return ami['Action']({'action':_0xdfdb('0x66'),'channel':_0x1f5b88[_0xdfdb('0x67')],'file':_0x15185c,'options':_0xdfdb('0x68')})[_0xdfdb('0x1b')](function(_0xd2b334){var _0x5018a0=_[_0xdfdb('0x5a')](_0x1f5b88['monitors'],{'filename':_0xdfdb('0x69')+_0x15185c[_0xdfdb('0x6a')]()});if(_[_0xdfdb('0x6b')](_0x5018a0)){_0x1f5b88[_0xdfdb('0x6c')][_0xdfdb('0x59')]({'filename':'/var/spool/asterisk/monitor/'+_0x15185c[_0xdfdb('0x6a')](),'createdAt':moment()[_0xdfdb('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0xd2b334[_0xdfdb('0x6d')],'status':_0xdfdb('0x6e')});}else{_0x5018a0[_0xdfdb('0x6d')]=_0xd2b334['mixmonitorid'];_0x5018a0[_0xdfdb('0x6f')]=_0xdfdb('0x6e');}_0x2f1d06({'code':0xc8,'message':[_0x6b03a3[_0xdfdb('0x62')],_0xdfdb('0x70'),_0xd2b334[_0xdfdb('0x6d')]][_0xdfdb('0x16')]('\x20'),'mixmonitorid':_0xd2b334['mixmonitorid']});})['catch'](function(_0x21b486){_0x4bbb88(_0x1aff71['error'](0x1f5,[_0x6b03a3['uniqueid'],_0x21b486['message'][_0xdfdb('0x6a')]()][_0xdfdb('0x16')]('\x20')));});}else{return _0x4bbb88(_0x1aff71[_0xdfdb('0x1d')](0x1f5,_0xdfdb('0x71')));}});},'VoiceChannelStopMixMonitor':function(_0x8bd5c0){var _0x17834e=this;return new Promise(function(_0xa1d520,_0x1132ca){if(ami[_0xdfdb('0x5e')]()==![]){return _0x1132ca(_0x17834e['error'](0x1f4,[config['asterisk']['ip'],config[_0xdfdb('0x13')]['username'],_0xdfdb('0x15')][_0xdfdb('0x16')]('\x20')));}var _0x3ec0c6=schema(properties['voicechannel'])[_0xdfdb('0x3')](_0x8bd5c0);if(_0x3ec0c6[_0xdfdb('0x60')]>0x0){return _0x1132ca(_0x17834e[_0xdfdb('0x1d')](0x1f4,_[_0xdfdb('0x61')](_0x3ec0c6,_0xdfdb('0x1e'))[_0xdfdb('0x16')](',\x20')));}var _0x7e6cd1=_[_0xdfdb('0x5a')](_0x3f5b2d['channels'],{'uniqueid':_0x8bd5c0[_0xdfdb('0x62')]});if(_0x7e6cd1){return BPromise[_0xdfdb('0x72')]()['then'](function(){if(_0x7e6cd1[_0xdfdb('0x67')]){return ami[_0xdfdb('0x1a')]({'action':_0xdfdb('0x73'),'channel':_0x7e6cd1[_0xdfdb('0x67')],'mixmonitorid':_0x8bd5c0['mixmonitorid']})['catch'](function(_0x140467){});}})[_0xdfdb('0x1b')](function(){if(_0x7e6cd1['destinationchannel']){return ami[_0xdfdb('0x1a')]({'action':_0xdfdb('0x73'),'channel':_0x7e6cd1[_0xdfdb('0x74')],'mixmonitorid':_0x8bd5c0['mixmonitorid']})['catch'](function(_0x42ad97){});}})[_0xdfdb('0x1b')](function(_0x5cfade){var _0x57ac74=_[_0xdfdb('0x5a')](_0x7e6cd1['monitors'],{'mixmonitorid':_0x8bd5c0['mixmonitorid']});if(_0x57ac74){_0x57ac74[_0xdfdb('0x6f')]='stop';}})[_0xdfdb('0x1b')](function(){var _0x1f0727=util['format']('%s.%s',_0x8bd5c0[_0xdfdb('0x64')]||_0x8bd5c0[_0xdfdb('0x62')],_0x8bd5c0['format']||_0xdfdb('0x65'));var _0xe7a000=_[_0xdfdb('0x5a')](_0x7e6cd1[_0xdfdb('0x6c')],{'filename':_0xdfdb('0x69')+_0x1f0727['toLowerCase']()});if(_0xe7a000){_0xe7a000['status']=_0xdfdb('0x75');}})[_0xdfdb('0x1b')](function(){_0xa1d520({'code':0xc8,'message':[_0x8bd5c0[_0xdfdb('0x62')],_0xdfdb('0x76')][_0xdfdb('0x16')]('\x20')});})[_0xdfdb('0x1c')](function(_0x505073){_0x1132ca(_0x17834e[_0xdfdb('0x1d')](0x1f5,[_0x8bd5c0[_0xdfdb('0x62')],_0x505073[_0xdfdb('0x1e')][_0xdfdb('0x6a')]()][_0xdfdb('0x16')]('\x20')));});}else{return _0x1132ca(_0x17834e[_0xdfdb('0x1d')](0x1f5,_0xdfdb('0x71')));}});},'VoiceQueuesChannels':function(_0x4cdcdc){return new Promise(function(_0x38fa9c,_0x3eca7f){var _0x5ae367=_[_0xdfdb('0x5d')](_0x3f5b2d[_0xdfdb('0x77')]);_0x38fa9c({'count':_0x5ae367[_0xdfdb('0x60')],'rows':_0x5ae367});});},'VoiceQueuesChannel':function(_0x45bfc0){var _0x2c9405=this;return new Promise(function(_0x590a16,_0x2df838){var _0x2b9971=schema(properties[_0xdfdb('0x78')])[_0xdfdb('0x3')](_0x45bfc0);if(_0x2b9971['length']>0x0){return _0x2df838(_0x2c9405[_0xdfdb('0x1d')](0x1f4,_[_0xdfdb('0x61')](_0x2b9971,_0xdfdb('0x1e'))[_0xdfdb('0x16')](',\x20')));}var _0x2edd45=_[_0xdfdb('0x5a')](_0x3f5b2d[_0xdfdb('0x77')],{'uniqueid':_0x45bfc0[_0xdfdb('0x62')]});if(_0x2edd45){_0x590a16(_0x2edd45);}else{return _0x2df838(_0x2c9405[_0xdfdb('0x1d')](0x1f5,_0xdfdb('0x71')));}});},'VoiceQueuesChannelHangup':function(_0x4eacf){var _0x5ea604=this;return new Promise(function(_0x1bf0d2,_0x616d29){if(ami['isConnected']()==![]){return _0x616d29(_0x5ea604[_0xdfdb('0x1d')](0x1f4,[config[_0xdfdb('0x13')]['ip'],config[_0xdfdb('0x13')]['username'],'ami\x20disconnected']['join']('\x20')));}var _0x9f2170=schema(properties[_0xdfdb('0x79')])[_0xdfdb('0x3')](_0x4eacf);if(_0x9f2170[_0xdfdb('0x60')]>0x0){return _0x616d29(_0x5ea604[_0xdfdb('0x1d')](0x1f4,_[_0xdfdb('0x61')](_0x9f2170,_0xdfdb('0x1e'))['join'](',\x20')));}var _0x7f85ce=_[_0xdfdb('0x5a')](_0x3f5b2d[_0xdfdb('0x77')],{'uniqueid':_0x4eacf[_0xdfdb('0x62')]});if(_0x7f85ce&&_0x7f85ce[_0xdfdb('0x67')]){return ami[_0xdfdb('0x1a')]({'action':_0xdfdb('0x7a'),'channel':_0x7f85ce['channel']})[_0xdfdb('0x1b')](function(_0x117cd7){_0x1bf0d2({'code':0xc8,'message':[_0x4eacf[_0xdfdb('0x62')],_0x117cd7[_0xdfdb('0x1e')][_0xdfdb('0x6a')]()]['join']('\x20')});})[_0xdfdb('0x1c')](function(_0x56a633){_0x616d29(_0x5ea604[_0xdfdb('0x1d')](0x1f5,[_0x4eacf[_0xdfdb('0x62')],_0x56a633[_0xdfdb('0x1e')][_0xdfdb('0x6a')]()][_0xdfdb('0x16')]('\x20')));});}else{return _0x616d29(_0x5ea604['error'](0x1f5,_0xdfdb('0x71')));}});},'VoiceQueuesChannelRedirect':function(_0x1f8e13){var _0x55cf4d=this;return new Promise(function(_0x5f32f7,_0x284439){if(ami['isConnected']()==![]){return _0x284439(_0x55cf4d['error'](0x1f4,[config[_0xdfdb('0x13')]['ip'],config[_0xdfdb('0x13')][_0xdfdb('0x14')],_0xdfdb('0x15')][_0xdfdb('0x16')]('\x20')));}var _0x4669c2=schema(properties[_0xdfdb('0x7b')])[_0xdfdb('0x3')](_0x1f8e13);if(_0x4669c2['length']>0x0){return _0x284439(_0x55cf4d[_0xdfdb('0x1d')](0x1f4,_['map'](_0x4669c2,_0xdfdb('0x1e'))[_0xdfdb('0x16')](',\x20')));}var _0xffc426=_[_0xdfdb('0x5a')](_0x3f5b2d[_0xdfdb('0x77')],{'uniqueid':_0x1f8e13['uniqueid']});if(_0xffc426&&_0xffc426[_0xdfdb('0x67')]){return ami[_0xdfdb('0x1a')]({'action':_0xdfdb('0x7c'),'channel':_0xffc426[_0xdfdb('0x67')],'exten':_0x1f8e13[_0xdfdb('0x7d')],'context':_0x1f8e13['context']||_0xffc426['context'],'priority':0x1})[_0xdfdb('0x1b')](function(_0x68fad5){_0x5f32f7({'code':0xc8,'message':[_0x1f8e13['uniqueid'],_0x68fad5[_0xdfdb('0x1e')]['toLowerCase']()][_0xdfdb('0x16')]('\x20')});})[_0xdfdb('0x1c')](function(_0xeadf25){_0x284439(_0x55cf4d['error'](0x1f5,[_0x1f8e13[_0xdfdb('0x62')],_0xeadf25['message']['toLowerCase']()][_0xdfdb('0x16')]('\x20')));});}else{return _0x284439(_0x55cf4d['error'](0x1f5,_0xdfdb('0x71')));}});},'Agents':function(_0x3a16e2){return new Promise(function(_0x162eeb,_0x24bd3c){var _0x191d45=_[_0xdfdb('0x5d')](_0x3f5b2d[_0xdfdb('0xf')]);_0x162eeb({'count':_0x191d45[_0xdfdb('0x60')],'rows':_0x191d45});});},'Telephones':function(_0x1fb331){return new Promise(function(_0x40cfba,_0x5ed460){var _0x5d2dc1=_[_0xdfdb('0x5d')](_0x3f5b2d['telephones']);_0x40cfba({'count':_0x5d2dc1['length'],'rows':_0x5d2dc1});});},'Trunks':function(_0x5542da){return new Promise(function(_0x4dcfbd,_0x197f51){var _0x2caabb=_[_0xdfdb('0x5d')](_0x3f5b2d[_0xdfdb('0x7e')]);_0x4dcfbd({'count':_0x2caabb[_0xdfdb('0x60')],'rows':_0x2caabb});});},'OutboundChannels':function(_0x12f4f7){return new Promise(function(_0x479488,_0x114373){var _0x258738=_[_0xdfdb('0x5d')](_0x3f5b2d[_0xdfdb('0x7f')]);_0x479488({'count':_0x258738[_0xdfdb('0x60')],'rows':_0x258738});});},'Outbound':function(_0x309be3){return new Promise(function(_0x561ced,_0x5979fa){_0x561ced(_0x3f5b2d[_0xdfdb('0x2d')]);});},'Campaigns':function(_0x45fcae){return new Promise(function(_0x5837da,_0x82e712){var _0x44d944=_[_0xdfdb('0x5d')](_0x3f5b2d[_0xdfdb('0x80')]);_0x5837da({'count':_0x44d944[_0xdfdb('0x60')],'rows':_0x44d944});});},'VoiceQueuesPreview':function(_0xd72296){var _0x5bc5a9=this;return new Promise(function(_0x306e18,_0x3a2d02){_0x4a4a3f[_0xdfdb('0x81')](_0xd72296['id'])[_0xdfdb('0x1b')](function(_0x23cbd0){_0x306e18({'code':0xc8,'message':_0x23cbd0[_0xdfdb('0x1e')]});})['catch'](function(_0x156da8){_0x3a2d02(_0x5bc5a9[_0xdfdb('0x1d')](0x1f4,_0x156da8[_0xdfdb('0x1e')]));});});},'EventManager':function(_0x3c09ec){var _0x370c7b=this;return new Promise(function(_0x2bd06f,_0x5e67bd){if(!_0x3c09ec[_0xdfdb('0x82')]){return _0x5e67bd(_0x370c7b[_0xdfdb('0x1d')](0x1f4,_0xdfdb('0x83')));}ami['emit']('custom:'+_0x3c09ec[_0xdfdb('0x82')],_0x3c09ec['message']);_0x2bd06f({'code':0xc8,'message':_0x3c09ec});});},'FaxAccounts':function(_0x5c7601){return new Promise(function(_0x276efc,_0x27c72c){var _0x57d5e3=_['values'](_0x3f5b2d[_0xdfdb('0x84')]);_0x276efc({'count':_0x57d5e3[_0xdfdb('0x60')],'rows':_0x57d5e3});});},'SendFax':function(_0x1f87d3){var _0x1bc293=this;return new Promise(function(_0x36b01e,_0x5b883b){_0x453ef6['send'](_0x1f87d3)[_0xdfdb('0x1b')](function(_0x576570){_0x36b01e({'code':0xc8,'message':_0x576570[_0xdfdb('0x1e')]});})[_0xdfdb('0x1c')](function(_0x3c9465){_0x5b883b(_0x1bc293['error'](0x1f4,_0x3c9465[_0xdfdb('0x1e')]));});});},'CheckAfterSend':function(_0x38a439){var _0x3e0208=this;return new Promise(function(_0x14293d,_0x4c08d0){_0x453ef6[_0xdfdb('0x85')](_0x38a439)[_0xdfdb('0x1b')](function(_0x3fe95d){_0x14293d({'code':0xc8,'message':_0x3fe95d[_0xdfdb('0x1e')]});})['catch'](function(_0xa31219){_0x4c08d0(_0x3e0208['error'](0x1f4,_0xa31219['message']));});});}};var _0x55a7d2=jayson['server'](_0x556dc0)['http']();_0x55a7d2['on'](_0xdfdb('0x1d'),function(_0xe8ac6c){return _0x489f19(_0xe8ac6c);});_0x55a7d2[_0xdfdb('0x86')](0x232a,_0xdfdb('0x87'),function(){console[_0xdfdb('0x88')](_0xdfdb('0x89'),0x232a);return _0x41bd5e(_0xdfdb('0x8a')+0x232a);});});}; \ No newline at end of file +var _0xf69c=['predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','Interval','length','omit','undefined','voicechannel','map','find','channels','uniqueid','%s.%s','filename','wav','MixMonitor','channel','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','rec','status','MixMonitor\x20Success','mixmonitorid','resolve','StopMixMonitor','destinationchannel','stop','monitors','StopMixMonitor\x20Success','values','queueChannels','Channel\x20doesn\x27t\x20exist','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','trunks','outboundChannels','event','emit','custom:','faxAccounts','send','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','listen','format','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','username','join','pick','keys','module','Reload','Action','message','catch','error','isConnected','asterisk','ami\x20disconnected','command','action','Command','then','content','hasOwnProperty','voiceQueues','strategy','answered','available','loggedIn','pTalking','sumHoldTime','talking','total','type','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable'];(function(_0x1b12f5,_0x30a625){var _0x3bcd61=function(_0xbe981a){while(--_0xbe981a){_0x1b12f5['push'](_0x1b12f5['shift']());}};_0x3bcd61(++_0x30a625);}(_0xf69c,0x151));var _0xcf69=function(_0x3e57ef,_0x388fab){_0x3e57ef=_0x3e57ef-0x0;var _0x5ade66=_0xf69c[_0x3e57ef];return _0x5ade66;};'use strict';var _=require(_0xcf69('0x0'));var util=require('util');var jayson=require(_0xcf69('0x1'));var schema=require(_0xcf69('0x2'));var BPromise=require('bluebird');var moment=require(_0xcf69('0x3'));var config=require('../../../config/environment');var properties=require(_0xcf69('0x4'));var ami=require('../ami');exports[_0xcf69('0x5')]=function(_0x4d8180,_0x1c813d,_0x168197){return new BPromise(function(_0x225c65,_0x35aa67){var _0x3b7608={'QueuePause':function(_0x5f1e98){return new Promise(function(_0x38478c,_0xbeb916){var _0x46b433=util[_0xcf69('0x6')]('%s/%s',_0xcf69('0x7'),_0x5f1e98[_0xcf69('0x8')]);if(_0x4d8180[_0xcf69('0x9')]&&_0x4d8180[_0xcf69('0x9')][_0x46b433]&&_0x4d8180[_0xcf69('0x9')][_0x46b433][_0xcf69('0xa')]){_0x4d8180['timers'][_0x46b433][_0xcf69('0xb')]();}if(_0x4d8180['agents'][_0x46b433]){_0x4d8180[_0xcf69('0xc')][_0x46b433][_0xcf69('0xd')]({'statePause':_0x5f1e98[_0xcf69('0xe')]?!![]:![]});}_0x38478c({'code':0xc8,'message':_0xcf69('0xf')});});},'Reload':function(_0x329250){var _0x2981ab=this;return new Promise(function(_0x182dde,_0x34e299){if(ami['isConnected']()==![]){return _0x34e299(_0x2981ab['error'](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xcf69('0x10')],'ami\x20disconnected'][_0xcf69('0x11')]('\x20')));}_0x329250=_[_0xcf69('0x12')](_0x329250,_[_0xcf69('0x13')](properties[_0xcf69('0x14')]));_0x329250['action']=_0xcf69('0x15');return ami[_0xcf69('0x16')](_0x329250)['then'](function(_0x486e06){_0x182dde({'code':0xc8,'message':_0x486e06[_0xcf69('0x17')]});})[_0xcf69('0x18')](function(_0x39306a){_0x34e299(_0x2981ab[_0xcf69('0x19')](0x1f5,_0x39306a[_0xcf69('0x17')]));});});},'Command':function(_0xfd30d2){var _0x120980=this;return new Promise(function(_0x210630,_0x53666e){if(ami[_0xcf69('0x1a')]()==![]){return _0x53666e(_0x120980['error'](0x1f4,[config[_0xcf69('0x1b')]['ip'],config[_0xcf69('0x1b')][_0xcf69('0x10')],_0xcf69('0x1c')][_0xcf69('0x11')]('\x20')));}_0xfd30d2=_[_0xcf69('0x12')](_0xfd30d2,_0xcf69('0x1d'));_0xfd30d2[_0xcf69('0x1e')]=_0xcf69('0x1f');return ami[_0xcf69('0x16')](_0xfd30d2)[_0xcf69('0x20')](function(_0x7d86bc){_0x210630({'code':0xc8,'message':_0x7d86bc[_0xcf69('0x21')]});})[_0xcf69('0x18')](function(_0x3ec2fb){_0x53666e(_0x120980['error'](0x1f5,_0x3ec2fb[_0xcf69('0x17')]));});});},'VoiceQueues':function(_0x1abce9){return new Promise(function(_0x183067,_0x278ce3){var _0x9a006b=[];for(var _0x1a0b33 in _0x4d8180['voiceQueues']){if(_0x4d8180['voiceQueues'][_0xcf69('0x22')](_0x1a0b33)){var _0x59de98=_0x4d8180[_0xcf69('0x23')][_0x1a0b33];var _0x81a49f={'id':_0x59de98['id'],'name':_0x59de98[_0xcf69('0x8')],'strategy':_0x59de98[_0xcf69('0x24')],'answered':_0x59de98[_0xcf69('0x25')],'available':_0x59de98[_0xcf69('0x26')],'loggedIn':_0x59de98[_0xcf69('0x27')],'pTalking':_0x59de98[_0xcf69('0x28')],'sumBillable':_0x59de98['sumBillable'],'sumDuration':_0x59de98['sumDuration'],'sumHoldTime':_0x59de98[_0xcf69('0x29')]||0x0,'talking':_0x59de98[_0xcf69('0x2a')],'total':_0x59de98[_0xcf69('0x2b')],'type':_0x59de98[_0xcf69('0x2c')],'unmanaged':_0x59de98['unmanaged'],'abandoned':_0x59de98[_0xcf69('0x2d')],'waiting':_0x59de98[_0xcf69('0x2e')],'loggedInDb':_0x59de98[_0xcf69('0x2f')]};if(_0x59de98[_0xcf69('0x2c')]===_0xcf69('0x30')){_0x81a49f[_0xcf69('0x31')]=_0x59de98[_0xcf69('0x31')];_0x81a49f[_0xcf69('0x32')]=_0x59de98[_0xcf69('0x32')];_0x81a49f[_0xcf69('0x33')]=_0x59de98['dialOriginateCallerIdName'];_0x81a49f[_0xcf69('0x34')]=_0x59de98['dialOriginateCallerIdNumber'];_0x81a49f[_0xcf69('0x35')]=_0x59de98[_0xcf69('0x35')];_0x81a49f[_0xcf69('0x36')]=_0x59de98[_0xcf69('0x36')];_0x81a49f[_0xcf69('0x37')]=_0x59de98[_0xcf69('0x37')];_0x81a49f[_0xcf69('0x38')]=_0x59de98[_0xcf69('0x38')];_0x81a49f[_0xcf69('0x39')]=_0x59de98[_0xcf69('0x39')];_0x81a49f['outboundBlacklistCallsDay']=_0x59de98[_0xcf69('0x3a')];_0x81a49f[_0xcf69('0x3b')]=_0x59de98['outboundBusyCallsDay'];_0x81a49f[_0xcf69('0x3c')]=_0x59de98['outboundCongestionCallsDay'];_0x81a49f[_0xcf69('0x3d')]=_0x59de98['outboundDropCallsDayACS'];_0x81a49f['outboundDropCallsDayCallersExit']=_0x59de98[_0xcf69('0x3e')];_0x81a49f[_0xcf69('0x3f')]=_0x59de98[_0xcf69('0x3f')];_0x81a49f[_0xcf69('0x40')]=_0x59de98[_0xcf69('0x40')];_0x81a49f[_0xcf69('0x41')]=_0x59de98['outboundNoSuchCallsDay'];_0x81a49f['outboundOriginateFailureCallsDay']=_0x59de98[_0xcf69('0x42')];_0x81a49f[_0xcf69('0x43')]=_0x59de98[_0xcf69('0x43')];_0x81a49f[_0xcf69('0x44')]=_0x59de98[_0xcf69('0x44')];_0x81a49f[_0xcf69('0x45')]=_0x59de98[_0xcf69('0x45')];_0x81a49f[_0xcf69('0x46')]=_0x59de98[_0xcf69('0x46')];_0x81a49f[_0xcf69('0x47')]=_0x59de98[_0xcf69('0x47')];_0x81a49f[_0xcf69('0x48')]=_0x59de98[_0xcf69('0x48')];_0x81a49f[_0xcf69('0x49')]=_0x59de98[_0xcf69('0x49')];_0x81a49f[_0xcf69('0x4a')]=_0x59de98[_0xcf69('0x4a')];_0x81a49f[_0xcf69('0x4b')]=_0x59de98[_0xcf69('0x4b')];_0x81a49f[_0xcf69('0x4c')]=_0x59de98[_0xcf69('0x4c')];_0x81a49f['predictiveIntervalHitRate']=_0x59de98['predictiveIntervalHitRate'];_0x81a49f[_0xcf69('0x4d')]=_0x59de98[_0xcf69('0x4d')];_0x81a49f[_0xcf69('0x4e')]=_0x59de98[_0xcf69('0x4e')];_0x81a49f['predictiveIntervalAvailable']=_0x59de98[_0xcf69('0x4f')];_0x81a49f[_0xcf69('0x50')]=_0x59de98[_0xcf69('0x50')];_0x81a49f[_0xcf69('0x17')]=_0x59de98[_0xcf69('0x17')];_0x81a49f['originated']=_0x59de98[_0xcf69('0x51')];_0x81a49f[_0xcf69('0x52')]=_0x59de98['erlangCalls'];_0x81a49f[_0xcf69('0x53')]=_0x59de98[_0xcf69('0x53')];_0x81a49f[_0xcf69('0x54')]=_0x59de98['erlangAbandonmentRate'];_0x81a49f[_0xcf69('0x55')]=_0x59de98['erlangBusyFactor'];_0x81a49f[_0xcf69('0x56')]=_0x59de98[_0xcf69('0x56')];_0x81a49f['startProgressive']=_0x59de98['startProgressive'];}if(_0x59de98[_0xcf69('0x57')]){_0x81a49f[_0xcf69('0x57')]={'id':_0x59de98[_0xcf69('0x57')]['id'],'name':_0x59de98['Trunk']['name'],'active':_0x59de98[_0xcf69('0x57')][_0xcf69('0x58')],'callerid':_0x59de98['Trunk'][_0xcf69('0x59')]};}if(_0x59de98[_0xcf69('0x5a')]){_0x81a49f[_0xcf69('0x5a')]={'id':_0x59de98[_0xcf69('0x5a')]['id'],'name':_0x59de98[_0xcf69('0x5a')][_0xcf69('0x8')]};}_0x9a006b['push'](_0x81a49f);}}_0x183067({'count':_0x9a006b[_0xcf69('0x5b')],'rows':_0x9a006b});});},'UpdateVoiceQueue':function(_0x39522d){return new Promise(function(_0x3e33e6,_0x58e261){var _0x1a1270=_['find'](_0x4d8180[_0xcf69('0x23')],{'id':parseInt(_0x39522d['id'])});var _0x81d8a7=_[_0xcf69('0x5c')](_0x39522d,['id']);if(_0x1a1270){for(var _0x45c458 in _0x81d8a7){if(typeof _0x81d8a7[_0x45c458]!==_0xcf69('0x5d')&&typeof _0x1a1270[_0x45c458]!=='undefined'){_0x1a1270[_0x45c458]=_0x81d8a7[_0x45c458];}}_0x3e33e6(_0x1a1270);}else{_0x58e261();}});},'VoiceChannels':function(_0x57748d){return new Promise(function(_0xca4bc0,_0x29dfbf){var _0x43ded1=_['values'](_0x4d8180['channels']);_0xca4bc0({'count':_0x43ded1['length'],'rows':_0x43ded1});});},'VoiceChannelMixMonitor':function(_0x2f2b20){var _0x814320=this;return new Promise(function(_0x91069e,_0x4c55e4){if(ami[_0xcf69('0x1a')]()==![]){return _0x4c55e4(_0x814320['error'](0x1f4,[config[_0xcf69('0x1b')]['ip'],config['asterisk'][_0xcf69('0x10')],_0xcf69('0x1c')][_0xcf69('0x11')]('\x20')));}var _0x2f8346=schema(properties[_0xcf69('0x5e')])[_0xcf69('0x2')](_0x2f2b20);if(_0x2f8346[_0xcf69('0x5b')]>0x0){return _0x4c55e4(_0x814320[_0xcf69('0x19')](0x1f4,_[_0xcf69('0x5f')](_0x2f8346,_0xcf69('0x17'))[_0xcf69('0x11')](',\x20')));}var _0x52473a=_[_0xcf69('0x60')](_0x4d8180[_0xcf69('0x61')],{'uniqueid':_0x2f2b20[_0xcf69('0x62')]});if(_0x52473a&&_0x52473a['channel']){var _0x294e08=util['format'](_0xcf69('0x63'),_0x2f2b20[_0xcf69('0x64')]||_0x2f2b20[_0xcf69('0x62')],_0x2f2b20[_0xcf69('0x6')]||_0xcf69('0x65'));return ami[_0xcf69('0x16')]({'action':_0xcf69('0x66'),'channel':_0x52473a[_0xcf69('0x67')],'file':_0x294e08,'options':_0xcf69('0x68')})[_0xcf69('0x20')](function(_0x2f83f6){var _0x2be62c=_[_0xcf69('0x60')](_0x52473a['monitors'],{'filename':_0xcf69('0x69')+_0x294e08[_0xcf69('0x6a')]()});if(_[_0xcf69('0x6b')](_0x2be62c)){_0x52473a['monitors']['push']({'filename':_0xcf69('0x69')+_0x294e08['toLowerCase'](),'createdAt':moment()[_0xcf69('0x6')](_0xcf69('0x6c')),'mixmonitorid':_0x2f83f6['mixmonitorid'],'status':_0xcf69('0x6d')});}else{_0x2be62c['mixmonitorid']=_0x2f83f6['mixmonitorid'];_0x2be62c[_0xcf69('0x6e')]=_0xcf69('0x6d');}_0x91069e({'code':0xc8,'message':[_0x2f2b20[_0xcf69('0x62')],_0xcf69('0x6f'),_0x2f83f6['mixmonitorid']][_0xcf69('0x11')]('\x20'),'mixmonitorid':_0x2f83f6[_0xcf69('0x70')]});})[_0xcf69('0x18')](function(_0x5996eb){_0x4c55e4(_0x814320['error'](0x1f5,[_0x2f2b20[_0xcf69('0x62')],_0x5996eb[_0xcf69('0x17')][_0xcf69('0x6a')]()]['join']('\x20')));});}else{return _0x4c55e4(_0x814320['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x4ab987){var _0x5d036b=this;return new Promise(function(_0x4bfd20,_0x1ace3c){if(ami[_0xcf69('0x1a')]()==![]){return _0x1ace3c(_0x5d036b['error'](0x1f4,[config[_0xcf69('0x1b')]['ip'],config[_0xcf69('0x1b')][_0xcf69('0x10')],_0xcf69('0x1c')][_0xcf69('0x11')]('\x20')));}var _0x19310e=schema(properties['voicechannel'])['validate'](_0x4ab987);if(_0x19310e[_0xcf69('0x5b')]>0x0){return _0x1ace3c(_0x5d036b[_0xcf69('0x19')](0x1f4,_[_0xcf69('0x5f')](_0x19310e,_0xcf69('0x17'))['join'](',\x20')));}var _0x593502=_['find'](_0x4d8180['channels'],{'uniqueid':_0x4ab987[_0xcf69('0x62')]});if(_0x593502){return BPromise[_0xcf69('0x71')]()[_0xcf69('0x20')](function(){if(_0x593502[_0xcf69('0x67')]){return ami[_0xcf69('0x16')]({'action':_0xcf69('0x72'),'channel':_0x593502['channel'],'mixmonitorid':_0x4ab987[_0xcf69('0x70')]})[_0xcf69('0x18')](function(_0x111089){});}})[_0xcf69('0x20')](function(){if(_0x593502[_0xcf69('0x73')]){return ami[_0xcf69('0x16')]({'action':_0xcf69('0x72'),'channel':_0x593502[_0xcf69('0x73')],'mixmonitorid':_0x4ab987[_0xcf69('0x70')]})[_0xcf69('0x18')](function(_0x16d25d){});}})['then'](function(_0x1d5dc1){var _0x3e5450=_[_0xcf69('0x60')](_0x593502['monitors'],{'mixmonitorid':_0x4ab987[_0xcf69('0x70')]});if(_0x3e5450){_0x3e5450['status']=_0xcf69('0x74');}})['then'](function(){var _0x4b3250=util[_0xcf69('0x6')](_0xcf69('0x63'),_0x4ab987[_0xcf69('0x64')]||_0x4ab987[_0xcf69('0x62')],_0x4ab987[_0xcf69('0x6')]||'wav');var _0x5d098a=_[_0xcf69('0x60')](_0x593502[_0xcf69('0x75')],{'filename':'/var/spool/asterisk/monitor/'+_0x4b3250['toLowerCase']()});if(_0x5d098a){_0x5d098a['status']=_0xcf69('0x74');}})[_0xcf69('0x20')](function(){_0x4bfd20({'code':0xc8,'message':[_0x4ab987['uniqueid'],_0xcf69('0x76')]['join']('\x20')});})[_0xcf69('0x18')](function(_0x3b76ce){_0x1ace3c(_0x5d036b[_0xcf69('0x19')](0x1f5,[_0x4ab987[_0xcf69('0x62')],_0x3b76ce[_0xcf69('0x17')]['toLowerCase']()]['join']('\x20')));});}else{return _0x1ace3c(_0x5d036b[_0xcf69('0x19')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x188d15){return new Promise(function(_0x54cf09,_0x53ee6c){var _0x5a183e=_[_0xcf69('0x77')](_0x4d8180[_0xcf69('0x78')]);_0x54cf09({'count':_0x5a183e[_0xcf69('0x5b')],'rows':_0x5a183e});});},'VoiceQueuesChannel':function(_0xbb5438){var _0x566520=this;return new Promise(function(_0x287912,_0x5658f4){var _0x243fda=schema(properties['voicequeuechannel'])[_0xcf69('0x2')](_0xbb5438);if(_0x243fda[_0xcf69('0x5b')]>0x0){return _0x5658f4(_0x566520['error'](0x1f4,_[_0xcf69('0x5f')](_0x243fda,_0xcf69('0x17'))[_0xcf69('0x11')](',\x20')));}var _0x490cce=_['find'](_0x4d8180[_0xcf69('0x78')],{'uniqueid':_0xbb5438[_0xcf69('0x62')]});if(_0x490cce){_0x287912(_0x490cce);}else{return _0x5658f4(_0x566520['error'](0x1f5,_0xcf69('0x79')));}});},'VoiceQueuesChannelHangup':function(_0x38e0b2){var _0x746a64=this;return new Promise(function(_0x4bc426,_0x48774f){if(ami[_0xcf69('0x1a')]()==![]){return _0x48774f(_0x746a64['error'](0x1f4,[config[_0xcf69('0x1b')]['ip'],config[_0xcf69('0x1b')]['username'],_0xcf69('0x1c')][_0xcf69('0x11')]('\x20')));}var _0x5b68b8=schema(properties[_0xcf69('0x7a')])['validate'](_0x38e0b2);if(_0x5b68b8[_0xcf69('0x5b')]>0x0){return _0x48774f(_0x746a64[_0xcf69('0x19')](0x1f4,_[_0xcf69('0x5f')](_0x5b68b8,_0xcf69('0x17'))[_0xcf69('0x11')](',\x20')));}var _0x52eae3=_[_0xcf69('0x60')](_0x4d8180['queueChannels'],{'uniqueid':_0x38e0b2[_0xcf69('0x62')]});if(_0x52eae3&&_0x52eae3[_0xcf69('0x67')]){return ami[_0xcf69('0x16')]({'action':_0xcf69('0x7b'),'channel':_0x52eae3['channel']})['then'](function(_0x2f97f5){_0x4bc426({'code':0xc8,'message':[_0x38e0b2[_0xcf69('0x62')],_0x2f97f5[_0xcf69('0x17')][_0xcf69('0x6a')]()][_0xcf69('0x11')]('\x20')});})[_0xcf69('0x18')](function(_0x5d5dfe){_0x48774f(_0x746a64[_0xcf69('0x19')](0x1f5,[_0x38e0b2[_0xcf69('0x62')],_0x5d5dfe[_0xcf69('0x17')][_0xcf69('0x6a')]()][_0xcf69('0x11')]('\x20')));});}else{return _0x48774f(_0x746a64['error'](0x1f5,_0xcf69('0x79')));}});},'VoiceQueuesChannelRedirect':function(_0x595e2f){var _0x4dbf4e=this;return new Promise(function(_0x96cf1d,_0x270e79){if(ami['isConnected']()==![]){return _0x270e79(_0x4dbf4e['error'](0x1f4,[config['asterisk']['ip'],config[_0xcf69('0x1b')][_0xcf69('0x10')],_0xcf69('0x1c')][_0xcf69('0x11')]('\x20')));}var _0x3d1055=schema(properties[_0xcf69('0x7c')])['validate'](_0x595e2f);if(_0x3d1055[_0xcf69('0x5b')]>0x0){return _0x270e79(_0x4dbf4e[_0xcf69('0x19')](0x1f4,_['map'](_0x3d1055,_0xcf69('0x17'))[_0xcf69('0x11')](',\x20')));}var _0x3cfb21=_[_0xcf69('0x60')](_0x4d8180[_0xcf69('0x78')],{'uniqueid':_0x595e2f[_0xcf69('0x62')]});if(_0x3cfb21&&_0x3cfb21['channel']){return ami[_0xcf69('0x16')]({'action':_0xcf69('0x7d'),'channel':_0x3cfb21[_0xcf69('0x67')],'exten':_0x595e2f[_0xcf69('0x7e')],'context':_0x595e2f['context']||_0x3cfb21[_0xcf69('0x7f')],'priority':0x1})[_0xcf69('0x20')](function(_0x2cdcc3){_0x96cf1d({'code':0xc8,'message':[_0x595e2f[_0xcf69('0x62')],_0x2cdcc3['message'][_0xcf69('0x6a')]()]['join']('\x20')});})[_0xcf69('0x18')](function(_0x1af8a0){_0x270e79(_0x4dbf4e['error'](0x1f5,[_0x595e2f['uniqueid'],_0x1af8a0['message'][_0xcf69('0x6a')]()][_0xcf69('0x11')]('\x20')));});}else{return _0x270e79(_0x4dbf4e['error'](0x1f5,_0xcf69('0x79')));}});},'Agents':function(_0x2002e1){return new Promise(function(_0x145bde,_0x2cd107){var _0x1cb7fd=_[_0xcf69('0x77')](_0x4d8180[_0xcf69('0xc')]);_0x145bde({'count':_0x1cb7fd[_0xcf69('0x5b')],'rows':_0x1cb7fd});});},'Telephones':function(_0x3f67d7){return new Promise(function(_0x4a7f65,_0x455dd0){var _0x2ca0d3=_[_0xcf69('0x77')](_0x4d8180['telephones']);_0x4a7f65({'count':_0x2ca0d3['length'],'rows':_0x2ca0d3});});},'Trunks':function(_0x57f3cb){return new Promise(function(_0x24194c,_0x587c1b){var _0x5eabdb=_[_0xcf69('0x77')](_0x4d8180[_0xcf69('0x80')]);_0x24194c({'count':_0x5eabdb[_0xcf69('0x5b')],'rows':_0x5eabdb});});},'OutboundChannels':function(_0x352d40){return new Promise(function(_0x2b79f0,_0x1fc8db){var _0xeb1b54=_['values'](_0x4d8180[_0xcf69('0x81')]);_0x2b79f0({'count':_0xeb1b54[_0xcf69('0x5b')],'rows':_0xeb1b54});});},'Outbound':function(_0x29e5fc){return new Promise(function(_0x2fbec3,_0x53438c){_0x2fbec3(_0x4d8180[_0xcf69('0x30')]);});},'Campaigns':function(_0xf339fa){return new Promise(function(_0x29d887,_0x3c7db3){var _0xac1fa9=_['values'](_0x4d8180['campaigns']);_0x29d887({'count':_0xac1fa9[_0xcf69('0x5b')],'rows':_0xac1fa9});});},'VoiceQueuesPreview':function(_0x165f37){var _0x4ece02=this;return new Promise(function(_0x14e9d6,_0x45a3a7){_0x1c813d['run'](_0x165f37['id'])[_0xcf69('0x20')](function(_0x548195){_0x14e9d6({'code':0xc8,'message':_0x548195[_0xcf69('0x17')]});})[_0xcf69('0x18')](function(_0x3d1fb0){_0x45a3a7(_0x4ece02[_0xcf69('0x19')](0x1f4,_0x3d1fb0[_0xcf69('0x17')]));});});},'EventManager':function(_0x1fe4a9){var _0x29574f=this;return new Promise(function(_0x478426,_0x3748b5){if(!_0x1fe4a9[_0xcf69('0x82')]){return _0x3748b5(_0x29574f[_0xcf69('0x19')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0xcf69('0x83')](_0xcf69('0x84')+_0x1fe4a9['event'],_0x1fe4a9['message']);_0x478426({'code':0xc8,'message':_0x1fe4a9});});},'FaxAccounts':function(_0x11cdad){return new Promise(function(_0x437d15,_0x3f7b13){var _0x4c8346=_['values'](_0x4d8180[_0xcf69('0x85')]);_0x437d15({'count':_0x4c8346[_0xcf69('0x5b')],'rows':_0x4c8346});});},'SendFax':function(_0x8a4d91){var _0x47d3cb=this;return new Promise(function(_0x172362,_0x2f2ca0){_0x168197[_0xcf69('0x86')](_0x8a4d91)['then'](function(_0x363533){_0x172362({'code':0xc8,'message':_0x363533[_0xcf69('0x17')]});})[_0xcf69('0x18')](function(_0x3e73b9){_0x2f2ca0(_0x47d3cb[_0xcf69('0x19')](0x1f4,_0x3e73b9[_0xcf69('0x17')]));});});},'CheckAfterSend':function(_0x2d1bbf){var _0x4bca3d=this;return new Promise(function(_0x3e29d3,_0x1279fc){_0x168197['checkAfterSend'](_0x2d1bbf)[_0xcf69('0x20')](function(_0x17ef57){_0x3e29d3({'code':0xc8,'message':_0x17ef57[_0xcf69('0x17')]});})[_0xcf69('0x18')](function(_0x18db19){_0x1279fc(_0x4bca3d[_0xcf69('0x19')](0x1f4,_0x18db19['message']));});});}};var _0x1d7528=jayson[_0xcf69('0x87')](_0x3b7608)[_0xcf69('0x88')]();_0x1d7528['on'](_0xcf69('0x19'),function(_0x220220){return _0x35aa67(_0x220220);});_0x1d7528['listen'](0x232a,_0xcf69('0x89'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x225c65(_0xcf69('0x8a')+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 d47483a..1275646 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 _0x207c=['defaults','redis','info','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','format','name','action','merge','length','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact'];(function(_0x5c9f92,_0x43117d){var _0x27ee28=function(_0x4ae8f8){while(--_0x4ae8f8){_0x5c9f92['push'](_0x5c9f92['shift']());}};_0x27ee28(++_0x43117d);}(_0x207c,0x1e8));var _0xc207=function(_0x29fc2c,_0x4ff86a){_0x29fc2c=_0x29fc2c-0x0;var _0x1adbc8=_0x207c[_0x29fc2c];return _0x1adbc8;};'use strict';var _=require('lodash');var BPromise=require(_0xc207('0x0'));var Redis=require(_0xc207('0x1'));var util=require(_0xc207('0x2'));var config=require(_0xc207('0x3'));var logger=require(_0xc207('0x4'))(_0xc207('0x5'));var cmContactRpc=require(_0xc207('0x6'));config['redis']=_[_0xc207('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc207('0x8')]));function emit(_0x314561,_0x3395e4,_0x59ff6f,_0x25cb97,_0xad159b){logger[_0xc207('0x9')]('[CM][%s][%s]',_0x314561,_0x3395e4['id'],_0x59ff6f,_0x25cb97,JSON[_0xc207('0xa')](_0xad159b));io['to'](_0x59ff6f)[_0xc207('0xb')](_0x25cb97,_0xad159b);}exports[_0xc207('0xc')]=function(_0x13ec41,_0x201162,_0x347549,_0x487d95){var _0x574425,_0x5b556f;var _0x19b297={};var _0x491062=Number(_0x347549[_0xc207('0xd')]);var _0x2782ce=_0x347549['data2']?Boolean(Number(_0x347549[_0xc207('0xe')])):![];var _0xb86b06;var _0x3062f5=![];if(!_[_0xc207('0xf')](_0x347549[_0xc207('0x10')])){if(_0x347549['data5']=='1')_0x3062f5=!![];}if(!_0x3062f5){if(_0x487d95[_0xc207('0x11')]){_0x19b297['id']=_0x487d95[_0xc207('0x11')];}}if(!_0x19b297['id']){_0x19b297[_0xc207('0x12')]=_0x491062;_0xb86b06=_0x347549[_0xc207('0x13')]&&_0x347549['data3']!=='0'?_0x347549['data3']['split'](','):[_0xc207('0x14')];_0x19b297[_0xc207('0x15')]=_[_0xc207('0x16')](_0xb86b06,function(_0x65f539){var _0x4b8f44={};_0x4b8f44[_0x65f539]=_0x487d95[_0xc207('0x17')]?_0x487d95[_0xc207('0x18')]:_0x487d95[_0xc207('0x19')];return _0x4b8f44;});}var _0x5f288e=['id',_0xc207('0x1a'),'lastName',_0xc207('0x14'),_0xc207('0x1b'),_0xc207('0x1c'),_0xc207('0x12'),_0xc207('0x1d'),_0xc207('0x1e'),_0xc207('0x1f')];var _0x464dea=_[_0xc207('0x20')](_0x5f288e,_0xb86b06);BPromise[_0xc207('0x21')]()[_0xc207('0x22')](cmContactRpc[_0xc207('0x23')]({'attributes':_0x464dea,'where':_0x19b297}))[_0xc207('0x22')](function(_0x4b52a7){_0x5b556f=_0x4b52a7;if(!_[_0xc207('0x24')](_0x5b556f)){if(_0x5b556f['length']===0x1){_0x574425=_0x5b556f[0x0];logger[_0xc207('0x9')](_0xc207('0x25'),_0x487d95[_0xc207('0x26')],_0x201162['id'],_0x574425['id']);}else{logger[_0xc207('0x9')](_0xc207('0x27'),_0x487d95[_0xc207('0x26')],_0x201162['id'],_[_0xc207('0x16')](_0x5b556f,'id')[_0xc207('0x28')](','));}return;}else{logger[_0xc207('0x9')](_0xc207('0x29'),_0x487d95[_0xc207('0x26')],_0x201162['id']);var _0x27df03={'ListId':_0x491062};var _0x3f738e=_0x347549[_0xc207('0x2a')]&&_0x347549[_0xc207('0x2a')]!=='0'?_0x347549['data4']:_0xc207('0x14');if(_0x2782ce){logger['info']('[CM][%s][%s]\x20Autocreate\x20enabled',_0x487d95[_0xc207('0x26')],_0x201162['id']);_0x27df03[_0x3f738e]=_[_0xc207('0xf')](_0x487d95[_0xc207('0x17')])?_0x487d95[_0xc207('0x19')]:_0x487d95[_0xc207('0x18')];if(_['isNil'](_0x487d95[_0xc207('0x17')])){_0x27df03[_0xc207('0x1a')]=_0x487d95[_0xc207('0x2b')]&&_0x487d95[_0xc207('0x2b')]!==_0xc207('0x2c')?_0x487d95[_0xc207('0x2b')]:_0xc207('0x2d');}else{_0x27df03[_0xc207('0x1a')]=_0x487d95[_0xc207('0x2e')]&&_0x487d95[_0xc207('0x2e')]!==_0xc207('0x2c')?_0x487d95[_0xc207('0x2e')]:_0xc207('0x2d');}return BPromise['resolve']()[_0xc207('0x22')](cmContactRpc[_0xc207('0x2f')](_0x27df03))[_0xc207('0x22')](function(_0x448df1){_0x574425=_0x448df1;_0x5b556f[_0xc207('0x30')](_0x448df1);if(_0x574425){logger[_0xc207('0x9')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x487d95[_0xc207('0x26')],_0x201162['id'],_0x574425['id']);}return;});}else{logger[_0xc207('0x9')](_0xc207('0x31'),_0x487d95[_0xc207('0x26')],_0x201162['id']);_0x27df03[_0x3f738e]=_['isNil'](_0x487d95[_0xc207('0x17')])?_0x487d95[_0xc207('0x19')]:_0x487d95[_0xc207('0x18')];if(_[_0xc207('0xf')](_0x487d95[_0xc207('0x17')])){_0x27df03[_0xc207('0x1a')]=_0x487d95[_0xc207('0x2b')]&&_0x487d95[_0xc207('0x2b')]!==_0xc207('0x2c')?_0x487d95['calleridname']:'Unknown';}else{_0x27df03[_0xc207('0x1a')]=_0x487d95[_0xc207('0x2e')]&&_0x487d95[_0xc207('0x2e')]!==_0xc207('0x2c')?_0x487d95['destcalleridname']:_0xc207('0x2d');}_0x574425=_0x27df03;_0x5b556f[_0xc207('0x30')](_0x27df03);return;}}})[_0xc207('0x22')](function(){if(_0x13ec41){emit(_0x487d95[_0xc207('0x26')],_0x201162,util[_0xc207('0x32')]('user:%s',_0x13ec41[_0xc207('0x33')]),util[_0xc207('0x32')]('trigger:%s',_0x347549[_0xc207('0x34')]['toLowerCase']()),{'evt':_[_0xc207('0x35')](_0x487d95,{'autoCreate':_0x2782ce}),'contact':_0x574425===undefined?{}:_0x574425,'contacts':_0x5b556f[_0xc207('0x36')]===0x0?undefined:_0x5b556f});}});}; \ No newline at end of file +var _0xd6d6=['isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','phone','[CM][%s][%s]\x20Autocreate\x20enabled','routeId','calleridname','','Unknown','destcalleridname','push','[CM][%s][%s]\x20Autocreate\x20disabled','user:%s','name','format','action','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','info','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','$or','map','destcalleridnum','calleridnum','firstName','mobile','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x352db0,_0x2d2422){_0x352db0=_0x352db0-0x0;var _0xfc6d4a=_0xd6d6[_0x352db0];return _0xfc6d4a;};'use strict';var _=require(_0x6d6d('0x0'));var BPromise=require(_0x6d6d('0x1'));var Redis=require(_0x6d6d('0x2'));var util=require(_0x6d6d('0x3'));var config=require('../../../../config/environment');var logger=require(_0x6d6d('0x4'))(_0x6d6d('0x5'));var cmContactRpc=require(_0x6d6d('0x6'));config[_0x6d6d('0x7')]=_[_0x6d6d('0x8')](config[_0x6d6d('0x7')],{'host':_0x6d6d('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6d6d('0x7')]));function emit(_0x1bf731,_0x44f83d,_0x18f824,_0xd49f57,_0x408f88){logger[_0x6d6d('0xa')]('[CM][%s][%s]',_0x1bf731,_0x44f83d['id'],_0x18f824,_0xd49f57,JSON['stringify'](_0x408f88));io['to'](_0x18f824)[_0x6d6d('0xb')](_0xd49f57,_0x408f88);}exports[_0x6d6d('0xc')]=function(_0x23b18a,_0x290dfb,_0xf84314,_0x576c88){var _0x1f2b86,_0x158f82;var _0x49b59c={};var _0x4fbe9c=Number(_0xf84314[_0x6d6d('0xd')]);var _0x32146d=_0xf84314[_0x6d6d('0xe')]?Boolean(Number(_0xf84314[_0x6d6d('0xe')])):![];var _0x2b74ed;var _0x41fbdf=![];if(!_[_0x6d6d('0xf')](_0xf84314[_0x6d6d('0x10')])){if(_0xf84314['data5']=='1')_0x41fbdf=!![];}if(!_0x41fbdf){if(_0x576c88[_0x6d6d('0x11')]){_0x49b59c['id']=_0x576c88[_0x6d6d('0x11')];}}if(!_0x49b59c['id']){_0x49b59c[_0x6d6d('0x12')]=_0x4fbe9c;_0x2b74ed=_0xf84314[_0x6d6d('0x13')]&&_0xf84314[_0x6d6d('0x13')]!=='0'?_0xf84314['data3'][_0x6d6d('0x14')](','):['phone'];_0x49b59c[_0x6d6d('0x15')]=_[_0x6d6d('0x16')](_0x2b74ed,function(_0x1cc02b){var _0x4bb3d1={};_0x4bb3d1[_0x1cc02b]=_0x576c88['routeId']?_0x576c88[_0x6d6d('0x17')]:_0x576c88[_0x6d6d('0x18')];return _0x4bb3d1;});}var _0x2b59d4=['id',_0x6d6d('0x19'),'lastName','phone',_0x6d6d('0x1a'),'fax',_0x6d6d('0x12'),_0x6d6d('0x1b'),_0x6d6d('0x1c'),_0x6d6d('0x1d')];var _0x40d35b=_[_0x6d6d('0x1e')](_0x2b59d4,_0x2b74ed);BPromise[_0x6d6d('0x1f')]()[_0x6d6d('0x20')](cmContactRpc[_0x6d6d('0x21')]({'attributes':_0x40d35b,'where':_0x49b59c}))[_0x6d6d('0x20')](function(_0x24b10d){_0x158f82=_0x24b10d;if(!_[_0x6d6d('0x22')](_0x158f82)){if(_0x158f82[_0x6d6d('0x23')]===0x1){_0x1f2b86=_0x158f82[0x0];logger[_0x6d6d('0xa')](_0x6d6d('0x24'),_0x576c88[_0x6d6d('0x25')],_0x290dfb['id'],_0x1f2b86['id']);}else{logger[_0x6d6d('0xa')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x576c88[_0x6d6d('0x25')],_0x290dfb['id'],_[_0x6d6d('0x16')](_0x158f82,'id')[_0x6d6d('0x26')](','));}return;}else{logger[_0x6d6d('0xa')](_0x6d6d('0x27'),_0x576c88[_0x6d6d('0x25')],_0x290dfb['id']);var _0x554f8e={'ListId':_0x4fbe9c};var _0x2851dd=_0xf84314[_0x6d6d('0x28')]&&_0xf84314[_0x6d6d('0x28')]!=='0'?_0xf84314[_0x6d6d('0x28')]:_0x6d6d('0x29');if(_0x32146d){logger[_0x6d6d('0xa')](_0x6d6d('0x2a'),_0x576c88['uniqueid'],_0x290dfb['id']);_0x554f8e[_0x2851dd]=_[_0x6d6d('0xf')](_0x576c88[_0x6d6d('0x2b')])?_0x576c88['calleridnum']:_0x576c88['destcalleridnum'];if(_[_0x6d6d('0xf')](_0x576c88[_0x6d6d('0x2b')])){_0x554f8e[_0x6d6d('0x19')]=_0x576c88['calleridname']&&_0x576c88[_0x6d6d('0x2c')]!==_0x6d6d('0x2d')?_0x576c88[_0x6d6d('0x2c')]:_0x6d6d('0x2e');}else{_0x554f8e[_0x6d6d('0x19')]=_0x576c88[_0x6d6d('0x2f')]&&_0x576c88[_0x6d6d('0x2f')]!==_0x6d6d('0x2d')?_0x576c88[_0x6d6d('0x2f')]:_0x6d6d('0x2e');}return BPromise['resolve']()[_0x6d6d('0x20')](cmContactRpc['createContact'](_0x554f8e))[_0x6d6d('0x20')](function(_0x1ea9b2){_0x1f2b86=_0x1ea9b2;_0x158f82[_0x6d6d('0x30')](_0x1ea9b2);if(_0x1f2b86){logger[_0x6d6d('0xa')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x576c88[_0x6d6d('0x25')],_0x290dfb['id'],_0x1f2b86['id']);}return;});}else{logger['info'](_0x6d6d('0x31'),_0x576c88[_0x6d6d('0x25')],_0x290dfb['id']);_0x554f8e[_0x2851dd]=_['isNil'](_0x576c88[_0x6d6d('0x2b')])?_0x576c88[_0x6d6d('0x18')]:_0x576c88[_0x6d6d('0x17')];if(_[_0x6d6d('0xf')](_0x576c88[_0x6d6d('0x2b')])){_0x554f8e[_0x6d6d('0x19')]=_0x576c88[_0x6d6d('0x2c')]&&_0x576c88[_0x6d6d('0x2c')]!==_0x6d6d('0x2d')?_0x576c88[_0x6d6d('0x2c')]:_0x6d6d('0x2e');}else{_0x554f8e[_0x6d6d('0x19')]=_0x576c88[_0x6d6d('0x2f')]&&_0x576c88[_0x6d6d('0x2f')]!==''?_0x576c88[_0x6d6d('0x2f')]:_0x6d6d('0x2e');}_0x1f2b86=_0x554f8e;_0x158f82[_0x6d6d('0x30')](_0x554f8e);return;}}})[_0x6d6d('0x20')](function(){if(_0x23b18a){emit(_0x576c88['uniqueid'],_0x290dfb,util['format'](_0x6d6d('0x32'),_0x23b18a[_0x6d6d('0x33')]),util[_0x6d6d('0x34')]('trigger:%s',_0xf84314[_0x6d6d('0x35')][_0x6d6d('0x36')]()),{'evt':_[_0x6d6d('0x37')](_0x576c88,{'autoCreate':_0x32146d}),'contact':_0x1f2b86===undefined?{}:_0x1f2b86,'contacts':_0x158f82[_0x6d6d('0x23')]===0x0?undefined:_0x158f82});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 79b94b3..82ec505 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 _0x9b66=['custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','motionChannel','undefined','interface','checkTriggers','hasOwnProperty','status','checkTrigger','merge','variables','Actions','action','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data3','location','uriLocation','data4','windowWidth','data5','800','windowHeight','data6','600','winApplication','winArguments','format','name','trigger:%s:%s','jscripty','user:%s','trigger:%s','exec','integration','queue','routeId','urlforward','script','query','replace','channel','AllConditions','length','every','checkConditions','AnyConditions','field','account','chat','ChatWebsiteId','upperFirst','AccountId','operator','value','interaction','message','event','agent','membername','lastevent','mailSubstatus','null','substatus','util','lodash','url','mustache','ioredis','./urlforward','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','custom:agentcalled','bind','custom:agentconnect','syncCustomEvent','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x9b66,0xd7));var _0x69b6=function(_0xb62229,_0x386f62){_0xb62229=_0xb62229-0x0;var _0xdfcc4f=_0x9b66[_0xb62229];return _0xdfcc4f;};'use strict';var util=require(_0x69b6('0x0'));var _=require(_0x69b6('0x1'));var url=require(_0x69b6('0x2'));var Mustache=require(_0x69b6('0x3'));var Redis=require(_0x69b6('0x4'));var urlforward=require(_0x69b6('0x5'));var integration=require('./integration');var cmContact=require(_0x69b6('0x6'));var script=require(_0x69b6('0x7'));var config=require(_0x69b6('0x8'));var logger=require(_0x69b6('0x9'))(_0x69b6('0xa'));var ami=require(_0x69b6('0xb'));config[_0x69b6('0xc')]=_[_0x69b6('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x69b6('0xc')]));var operators={'equals':function(_0x271f1e,_0xe64ec0){return _0x271f1e==_0xe64ec0;},'not_equals':function(_0xd92705,_0x4bd4a4){return _0xd92705!=_0x4bd4a4;}};var barAndWebActions=[_0x69b6('0xe'),'url',_0x69b6('0xf')];function Trigger(_0x2ae865){this[_0x69b6('0x10')]=_0x2ae865[_0x69b6('0x10')];this['agents']=_0x2ae865[_0x69b6('0x11')];this[_0x69b6('0x12')]=_0x2ae865[_0x69b6('0x12')];this[_0x69b6('0x13')]=_0x2ae865[_0x69b6('0x13')];this[_0x69b6('0x14')]=_0x2ae865[_0x69b6('0x14')];this['zendeskAccounts']=_0x2ae865[_0x69b6('0x15')];this['freshdeskAccounts']=_0x2ae865[_0x69b6('0x16')];this[_0x69b6('0x17')]=_0x2ae865[_0x69b6('0x17')];this[_0x69b6('0x18')]=_0x2ae865[_0x69b6('0x18')];this['zohoAccounts']=_0x2ae865[_0x69b6('0x19')];this[_0x69b6('0x1a')]=_0x2ae865[_0x69b6('0x1a')];this[_0x69b6('0x1b')]=_0x2ae865[_0x69b6('0x1b')];this[_0x69b6('0x1c')]=_0x2ae865[_0x69b6('0x1c')];this[_0x69b6('0x1d')]=_0x2ae865[_0x69b6('0x1d')];this[_0x69b6('0x1e')]=_0x2ae865[_0x69b6('0x1e')];this['accounts']={'zendesk':this['zendeskAccounts'],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0x69b6('0x16')],'sugarcrm':this[_0x69b6('0x18')],'zoho':this[_0x69b6('0x19')],'desk':this[_0x69b6('0x1a')],'vtiger':this[_0x69b6('0x1b')],'dynamics365':this[_0x69b6('0x1d')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0x69b6('0x1c')]};ami['on'](_0x69b6('0x1f'),this['syncCustomEvent'][_0x69b6('0x20')](this));ami['on'](_0x69b6('0x21'),this[_0x69b6('0x22')][_0x69b6('0x20')](this));ami['on'](_0x69b6('0x23'),this[_0x69b6('0x22')][_0x69b6('0x20')](this));ami['on'](_0x69b6('0x24'),this['syncCustomEvent']['bind'](this));ami['on'](_0x69b6('0x25'),this['syncCustomEvent'][_0x69b6('0x20')](this));ami['on']('custom:agentnoanswer',this['syncCustomEvent'][_0x69b6('0x20')](this));ami['on']('custom:agentbusy',this[_0x69b6('0x22')][_0x69b6('0x20')](this));ami['on'](_0x69b6('0x26'),this[_0x69b6('0x22')]['bind'](this));ami['on'](_0x69b6('0x27'),this[_0x69b6('0x22')][_0x69b6('0x20')](this));ami['on'](_0x69b6('0x28'),this[_0x69b6('0x22')][_0x69b6('0x20')](this));ami['on'](_0x69b6('0x29'),this[_0x69b6('0x22')][_0x69b6('0x20')](this));ami['on'](_0x69b6('0x2a'),this[_0x69b6('0x22')]['bind'](this));ami['on'](_0x69b6('0x2b'),this[_0x69b6('0x2c')][_0x69b6('0x20')](this));ami['on'](_0x69b6('0x2d'),this[_0x69b6('0x2c')][_0x69b6('0x20')](this));ami['on'](_0x69b6('0x2e'),this[_0x69b6('0x2c')]['bind'](this));ami['on'](_0x69b6('0x2f'),this[_0x69b6('0x22')][_0x69b6('0x20')](this));ami['on'](_0x69b6('0x30'),this[_0x69b6('0x22')][_0x69b6('0x20')](this));ami['on']('custom:substatus',this[_0x69b6('0x22')][_0x69b6('0x20')](this));ami['on'](_0x69b6('0x31'),this[_0x69b6('0x22')][_0x69b6('0x20')](this));ami['on'](_0x69b6('0x32'),this[_0x69b6('0x22')][_0x69b6('0x20')](this));ami['on'](_0x69b6('0x33'),this[_0x69b6('0x22')][_0x69b6('0x20')](this));ami['on'](_0x69b6('0x34'),this[_0x69b6('0x22')][_0x69b6('0x20')](this));}Trigger[_0x69b6('0x35')][_0x69b6('0x36')]=function(_0x38a48d,_0x2fdf49,_0x5a0c8e){logger[_0x69b6('0x37')](_0x38a48d,_0x2fdf49,JSON['stringify'](_0x5a0c8e));io['to'](_0x38a48d)[_0x69b6('0x36')](_0x2fdf49,_0x5a0c8e);};Trigger[_0x69b6('0x35')][_0x69b6('0x22')]=function(_0x4b48eb){var _0x5e5f33=_['clone'](_0x4b48eb);if(typeof _0x5e5f33[_0x69b6('0x38')]===_0x69b6('0x39')){_0x5e5f33['motionChannel']='voice';}this['checkTriggers'](_0x5e5f33);};Trigger[_0x69b6('0x35')][_0x69b6('0x2c')]=function(_0x17f9d7){if(this[_0x69b6('0x11')][_0x17f9d7[_0x69b6('0x3a')]]){this['syncCustomEvent'](_0x17f9d7);}};Trigger[_0x69b6('0x35')][_0x69b6('0x3b')]=function(_0x443e8f){var _0xf129d8;for(var _0x20c9f5 in this[_0x69b6('0x10')]){if(this[_0x69b6('0x10')][_0x69b6('0x3c')](_0x20c9f5)){if(this['triggers'][_0x20c9f5][_0x69b6('0x3d')]){_0xf129d8=this[_0x69b6('0x3e')](this[_0x69b6('0x10')][_0x20c9f5],_0x443e8f);if(_0xf129d8){_[_0x69b6('0x3f')](_0x443e8f,_0x443e8f[_0x69b6('0x40')]);for(var _0x20108c=0x0,_0xd410b7,_0x491f19,_0xb62ed9;_0x20108c0x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ No newline at end of file +var _0x326f=['catch','stringify','unmanaged','lastevent','toUpperCase','lodash','util','ioredis','./util','../../../../config/environment','../../../../config/logger','desk','redis','defaults','localhost','validateEmail','info','Getting\x20agent\x20with\x20email','%s/users','then','total_entries','_embedded','entries','Agent\x20found!','format','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','debug','[HTTP]','GET','authType','basic','password','%s/token:%s','Basic\x20%s','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','work','map','length','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','custom_fields','toString','variable','variableName','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','getString','Subjects','xCALLY','concat','Descriptions','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','integrationTab','%s/agent/tickets/%s'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x326f,0xd1));var _0xf326=function(_0x1fc310,_0x53b7c9){_0x1fc310=_0x1fc310-0x0;var _0xfb8695=_0x326f[_0x1fc310];return _0xfb8695;};'use strict';var _=require(_0xf326('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xf326('0x1'));var Redis=require(_0xf326('0x2'));var intUtil=require(_0xf326('0x3'));var config=require(_0xf326('0x4'));var logger=require(_0xf326('0x5'))(_0xf326('0x6'));config[_0xf326('0x7')]=_[_0xf326('0x8')](config[_0xf326('0x7')],{'host':_0xf326('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf326('0x7')]));function emit(_0x3851eb,_0x165f95,_0x1e7b8a){io['to'](_0x3851eb)['emit'](_0x165f95,_0x1e7b8a);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getUser(_0x3bacf2,_0x1fc80e){if(intUtil[_0xf326('0xa')](_0x1fc80e)===!![]){logger[_0xf326('0xb')](_0xf326('0xc'),_0x1fc80e);return request({'uri':util['format'](_0xf326('0xd'),_0x3bacf2['remoteUri'])})[_0xf326('0xe')](function(_0x4aaf3a){if(_0x4aaf3a[_0xf326('0xf')]){return _['find'](_0x4aaf3a[_0xf326('0x10')][_0xf326('0x11')],{'email':_0x1fc80e});}})['then'](function(_0x342fe5){if(_0x342fe5){logger[_0xf326('0xb')](_0xf326('0x12'));return _0x342fe5;}else{logger[_0xf326('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf326('0x13')]('%s/users/me',_0x3bacf2['remoteUri'])});}});}else{logger[_0xf326('0xb')](_0xf326('0x14'));return request({'uri':util[_0xf326('0x13')](_0xf326('0x15'),_0x3bacf2[_0xf326('0x16')])});}}function request(_0x287a2a){logger[_0xf326('0x17')](_0xf326('0x18'),JSON['stringify'](_0x287a2a));return rp(_[_0xf326('0x8')](_0x287a2a,{'method':_0xf326('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x18bee3){var _0x31ffb9;if(_0x18bee3[_0xf326('0x1a')]===_0xf326('0x1b')){_0x31ffb9=util['format']('%s:%s',_0x18bee3['username'],_0x18bee3[_0xf326('0x1c')]);}else if(_0x18bee3[_0xf326('0x1a')]==='token'){_0x31ffb9=util['format'](_0xf326('0x1d'),_0x18bee3['username'],_0x18bee3['token']);}return util[_0xf326('0x13')](_0xf326('0x1e'),new Buffer(_0x31ffb9)['toString']('base64'));}function getEndUser(_0x19b8ba,_0xb1efcf,_0x5f21a2){logger[_0xf326('0xb')](_0xf326('0x1f'),_0x5f21a2);return request({'uri':util[_0xf326('0x13')](_0xf326('0x20'),_0x19b8ba[_0xf326('0x16')]),'qs':{'phone':_0x5f21a2}})[_0xf326('0xe')](function(_0x5ce532){if(_0x5ce532['total_entries']){logger['info'](_0xf326('0x21'));return _0x5ce532[_0xf326('0x10')][_0xf326('0x11')][0x0];}else{logger[_0xf326('0xb')](_0xf326('0x22'));return request({'uri':util[_0xf326('0x13')]('%s/customers',_0x19b8ba[_0xf326('0x16')]),'method':_0xf326('0x23'),'body':{'first_name':_0xb1efcf,'title':_0xb1efcf,'phone_numbers':[{'type':_0xf326('0x24'),'value':_0x5f21a2}]}});}});}function getTags(_0x581531,_0x1617d2){var _0x55ad0f=[];if(_0x581531&&_0x581531['length']>0x0){_0x55ad0f=_[_0xf326('0x25')](_0x581531,_0x1617d2);}return _0x55ad0f;}function getCustomFields(_0x1ae23a,_0x2fa28e){var _0x5dbe63=[];var _0xc115d9={'custom_fields':{}};if(_0x1ae23a[_0xf326('0x26')]>0x0){_['forEach'](_0x1ae23a,function(_0x225776){if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776[_0xf326('0x2a')])&&_0x225776[_0xf326('0x2b')]&&!_0x225776[_0xf326('0x2c')]){_0xc115d9[_0x225776[_0xf326('0x2b')][_0xf326('0x2d')]()]=_0x225776[_0xf326('0x2e')]['toString']();}else if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776['type'])&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x225776['content'][_0xf326('0x31')]();}else if(_0x225776[_0xf326('0x2a')]===_0xf326('0x32')&&_0x225776[_0xf326('0x33')]&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776[_0xf326('0x33')]]&&(_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x2fa28e[_0x225776[_0xf326('0x33')]][_0xf326('0x31')]());}else if(_0x225776['type']===_0xf326('0x34')&&_0x225776['Variable']&&_0x225776[_0xf326('0x35')]['name']&&_0x225776['idField']&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776['Variable'][_0xf326('0x36')]['toLowerCase']()]&&(_0xc115d9[_0xf326('0x30')][_0x225776[_0xf326('0x2f')]]=_0x2fa28e[_0x225776[_0xf326('0x35')]['name'][_0xf326('0x2d')]()][_0xf326('0x31')]());}});}if(_0xc115d9['priority']){_0xc115d9[_0xf326('0x37')]=Number(_0xc115d9[_0xf326('0x37')]);}return _0xc115d9;}function getTicket(_0x40fa7a,_0xaf65e0,_0x51076c,_0x2c4416,_0xb1ef35){logger[_0xf326('0xb')](_0xf326('0x38'));var _0x1d88ed=_['merge']({'subject':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3a')],_0xb1ef35,'\x20'),'type':'phone','status':'new','labels':[_0xf326('0x3b'),'Motion','CTI'][_0xf326('0x3c')](getTags(_0x2c4416['Tags'],_0xf326('0x36'))),'description':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a'),'_links':{'assigned_user':{'href':util[_0xf326('0x13')]('/api/v2/users/%d',_0xaf65e0['id']),'class':_0xf326('0x3e')}},'message':{'direction':'in','body':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a')}},getCustomFields(_0x2c4416[_0xf326('0x3f')],_0xb1ef35));return request({'uri':util[_0xf326('0x13')](_0xf326('0x40'),_0x40fa7a[_0xf326('0x16')],_0x51076c['id']),'method':_0xf326('0x23'),'body':_0x1d88ed});}exports[_0xf326('0x41')]=function(_0x1227d3,_0x361776,_0x2bab13,_0x50d63f,_0x1b6126,_0x1637dc){var _0x2ed1a7,_0x270288;_0x1637dc[_0xf326('0x16')]=intUtil[_0xf326('0x42')](_0x1637dc['remoteUri']);_0x1637dc[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x1637dc['serverUrl']);if(_0x1b6126&&_0x1b6126[_0xf326('0x44')]){logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x46'));_0x361776[_0xf326('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1637dc[_0xf326('0x43')],_0x361776[_0xf326('0x48')],md5(_0x361776['uniqueid']));}else{_0x361776['recordingURL']='';}headers[_0xf326('0x49')]=getAuth(_0x1637dc);return getUser(_0x1637dc,_0x50d63f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x5b3705){_0x2ed1a7=_0x5b3705;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2ed1a7['id']);return getEndUser(_0x1637dc,_0x361776[_0xf326('0x4c')],_0x361776[_0xf326('0x4d')]);})[_0xf326('0xe')](function(_0x2d9bba){_0x270288=_0x2d9bba;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x270288['id']);return getTicket(_0x1637dc,_0x2ed1a7,_0x270288,_0x2bab13,_0x361776);})[_0xf326('0xe')](function(_0x27ced1){if(_0x27ced1){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x27ced1['id']);switch(_0x1637dc[_0xf326('0x2a')]){case'integrationTab':logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x51'));emit(util[_0xf326('0x13')]('user:%s',_0x50d63f[_0xf326('0x36')]),_0xf326('0x52'),{'recordId':_0x27ced1['id']});break;case _0xf326('0x53'):logger[_0xf326('0xb')]('[QUEUE]',_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x50d63f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x27ced1['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x45'),_0xf326('0x58'));}}})['catch'](function(_0x102fba){console[_0xf326('0x57')](_0x102fba);logger[_0xf326('0x57')]('[QUEUE]',JSON['stringify'](_0x102fba));});};exports[_0xf326('0x59')]=function(_0x5b4832,_0x1cf58f,_0x554277,_0x458e5f,_0x7ee57,_0x28c959,_0x25e091){var _0x212594,_0x35d3c8;_0x28c959[_0xf326('0x16')]=intUtil['stripTrailingSlash'](_0x28c959[_0xf326('0x16')]);_0x28c959[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28c959['serverUrl']);if(_0x25e091&&_0x25e091[_0xf326('0x5a')]&&_0x25e091[_0xf326('0x5a')]!==_0xf326('0x5b')){logger[_0xf326('0xb')](_0xf326('0x5c'),'Recording\x20is\x20enabled!');_0x1cf58f[_0xf326('0x47')]=util[_0xf326('0x13')](_0xf326('0x5d'),_0x28c959[_0xf326('0x43')],_0x1cf58f['uniqueid'],md5(_0x1cf58f[_0xf326('0x48')]));}headers[_0xf326('0x49')]=getAuth(_0x28c959);return getUser(_0x28c959,_0x458e5f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x4d3b9e){_0x212594=_0x4d3b9e;logger['info'](_0xf326('0x4b'),_0x212594['id']);return getEndUser(_0x28c959,_0x1cf58f[_0xf326('0x5e')],_0x1cf58f['destcalleridnum']);})[_0xf326('0xe')](function(_0x29de71){_0x35d3c8=_0x29de71;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x35d3c8['id']);return getTicket(_0x28c959,_0x212594,_0x35d3c8,_0x554277,_0x1cf58f);})['then'](function(_0xb1c18c){if(_0xb1c18c){logger['info']('Ticket\x20created!');logger[_0xf326('0xb')]('The\x20Ticket\x20ID\x20is:',_0xb1c18c['id']);switch(_0x28c959[_0xf326('0x2a')]){case _0xf326('0x5f'):logger[_0xf326('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),'trigger:desk:display',{'recordId':_0xb1c18c['id']});break;case _0xf326('0x53'):logger['info'](_0xf326('0x45'),_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util[_0xf326('0x13')](_0xf326('0x60'),_0x28c959[_0xf326('0x16')],_0xb1c18c['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x5c'),_0xf326('0x58'));}}})[_0xf326('0x61')](function(_0x4ca1b8){logger[_0xf326('0x57')]('[OUTBOUND]',JSON[_0xf326('0x62')](_0x4ca1b8));});};exports[_0xf326('0x63')]=function(_0x5e858d,_0x2b770c,_0x5283da,_0x3255b2,_0xd55246,_0x28f3cb){var _0x2d45c9,_0x31b6dd;_0x28f3cb['remoteUri']=intUtil['stripTrailingSlash'](_0x28f3cb[_0xf326('0x16')]);_0x28f3cb[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28f3cb[_0xf326('0x43')]);if(_0xd55246&&_0xd55246[_0xf326('0x44')]){logger['info']('['+_0x2b770c[_0xf326('0x64')][_0xf326('0x65')]()+']','Recording\x20is\x20enabled!');_0x2b770c['recordingURL']=util['format'](_0xf326('0x5d'),_0x28f3cb[_0xf326('0x43')],_0x2b770c[_0xf326('0x48')],md5(_0x2b770c[_0xf326('0x48')]));}else{_0x2b770c[_0xf326('0x47')]='';}headers[_0xf326('0x49')]=getAuth(_0x28f3cb);return getUser(_0x28f3cb)[_0xf326('0xe')](function(_0x4b9013){_0x2d45c9=_0x4b9013;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2d45c9['id']);return getEndUser(_0x28f3cb,_0x2b770c[_0xf326('0x4c')],_0x2b770c[_0xf326('0x4d')]);})['then'](function(_0x3717fe){_0x31b6dd=_0x3717fe;logger['info']('The\x20Enduser\x20ID\x20is:',_0x31b6dd['id']);return getTicket(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x5283da,_0x2b770c);})[_0xf326('0xe')](function(_0x540fa0){if(_0x540fa0){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x540fa0['id']);}})[_0xf326('0x61')](function(_0x541491){logger['error']('['+_0x2b770c['lastevent'][_0xf326('0x65')]()+']',JSON[_0xf326('0x62')](_0x541491));});}; \ 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 30bc739..770e71a 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 _0x2ce0=['toUpperCase',']\x20Wrong\x20credentials!','message','GET','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','destcalleridnum','calleridnum','/systemusers(','Bearer\x20','headers','substring','lastIndexOf','enduserId','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','telephone1','contactid',']\x20Enduser\x20created!','forEach','includes','string','picklist','nameField','customField','indexOf','content','incidents','assign','getString','Subjects','Descriptions','userId','Fields','ticketType','phonecall','/contacts(','callDirection','queue','odata-entityid','format','user:%s','emit','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','POST','remoteUri','username','password','then','access_token','catch','error'];(function(_0x5cc8b9,_0x20e3c3){var _0x58892e=function(_0x87457a){while(--_0x87457a){_0x5cc8b9['push'](_0x5cc8b9['shift']());}};_0x58892e(++_0x20e3c3);}(_0x2ce0,0x10d));var _0x02ce=function(_0x25bfe2,_0xe73273){_0x25bfe2=_0x25bfe2-0x0;var _0x45ef49=_0x2ce0[_0x25bfe2];return _0x45ef49;};'use strict';var _=require(_0x02ce('0x0'));var BPromise=require(_0x02ce('0x1'));var rp=require(_0x02ce('0x2'));var util=require(_0x02ce('0x3'));var intUtil=require('./util');var md5=require(_0x02ce('0x4'));var Redis=require(_0x02ce('0x5'));var logger=require(_0x02ce('0x6'))('dynamics365');var config=require('../../../../config/environment');config['redis']=_[_0x02ce('0x7')](config[_0x02ce('0x8')],{'host':_0x02ce('0x9'),'port':0x18eb});var io=require(_0x02ce('0xa'))(new Redis(config[_0x02ce('0x8')]));function getAuthToken(_0x3e7f76,_0x28944e,_0x3f0b86){var _0x2e6e35={'method':_0x02ce('0xb'),'uri':_0x28944e,'form':{'client_id':_0x3e7f76['clientId'],'resource':_0x3e7f76[_0x02ce('0xc')],'username':_0x3e7f76[_0x02ce('0xd')],'password':_0x3e7f76['password'],'grant_type':_0x02ce('0xe'),'client_secret':_0x3e7f76['clientSecret']},'json':!![]};return rp(_0x2e6e35)[_0x02ce('0xf')](function(_0x393652){return _0x393652[_0x02ce('0x10')];})[_0x02ce('0x11')](function(_0x585ae1){logger[_0x02ce('0x12')]('['+[_0x3f0b86[_0x02ce('0x13')]()]+_0x02ce('0x14'));return _0x585ae1[_0x02ce('0x15')];});}function getUser(_0x217f60,_0x1e10d7,_0x45c018,_0x362b1c,_0x11edb4,_0x26d083){return new BPromise(function(_0x2a4307,_0x1d4662){return getAuthToken(_0x1e10d7,_0x362b1c,_0x26d083)['then'](function(_0x5e6518){var _0xa12fe1={'method':_0x02ce('0x16'),'uri':_0x11edb4+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0x5e6518,'OData-Version':_0x02ce('0x17')},'json':!![]};return rp(_0xa12fe1);})[_0x02ce('0xf')](function(_0x450e6f){var _0x4b6dfd=_0x450e6f[_0x02ce('0x18')];var _0x46e95f=![];var _0x23c776=null;if(!_[_0x02ce('0x19')](_0x45c018)){if(intUtil[_0x02ce('0x1a')](_0x45c018[_0x02ce('0x1b')])){_0x217f60[_0x02ce('0x1c')]=_0x45c018['email'];for(_0x23c776=0x0;_0x23c776<_0x4b6dfd[_0x02ce('0x1d')];_0x23c776++){if(_0x4b6dfd[_0x23c776][_0x02ce('0x1e')]===_0x45c018[_0x02ce('0x1b')]&&!_0x4b6dfd[_0x23c776][_0x02ce('0x1f')]){_0x46e95f=!![];logger[_0x02ce('0x20')]('['+[_0x26d083['toUpperCase']()]+']\x20Agent\x20found\x20'+_0x4b6dfd[_0x23c776][_0x02ce('0x21')]+'!');_0x217f60['userId']=_0x4b6dfd[_0x23c776][_0x02ce('0x21')];}}}}if(!_0x46e95f){logger[_0x02ce('0x20')]('['+[_0x26d083[_0x02ce('0x13')]()]+_0x02ce('0x22'));_0x217f60[_0x02ce('0x1c')]=_0x1e10d7['username'];for(_0x23c776=0x0;_0x23c776<_0x4b6dfd[_0x02ce('0x1d')];_0x23c776++){if(_0x4b6dfd[_0x23c776]['internalemailaddress']===_0x1e10d7['username']){_0x217f60['userId']=_0x4b6dfd[_0x23c776][_0x02ce('0x21')];}}}_0x2a4307(_0x217f60);})[_0x02ce('0x11')](function(_0x1e7e90){_0x1d4662(_0x1e7e90[_0x02ce('0x15')]);});});}function createEndUser(_0x441a83,_0x297f0a,_0x390a6b,_0x22a6f4,_0x286546,_0x4c04e0){return new BPromise(function(_0x43c59a,_0x216905){return getAuthToken(_0x297f0a,_0x390a6b,_0x4c04e0)[_0x02ce('0xf')](function(_0x39a3a4){var _0x588702=_0x4c04e0[_0x02ce('0x23')]()===_0x02ce('0x24')?_0x286546[_0x02ce('0x25')]:_0x286546[_0x02ce('0x26')];var _0x5cbd2c={'method':_0x02ce('0xb'),'uri':_0x22a6f4+'contacts','body':{'telephone1':_0x588702,'fullname':_0x588702,'firstname':_0x588702,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x02ce('0x27')+_0x441a83['userId']+')'},'headers':{'Authorization':_0x02ce('0x28')+_0x39a3a4,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x5cbd2c);})['then'](function(_0x4a674f){var _0x5f5a91=_0x4a674f[_0x02ce('0x29')]['odata-entityid'];var _0x584966=_0x5f5a91[_0x02ce('0x2a')](_0x5f5a91[_0x02ce('0x2b')]('(')+0x1,_0x5f5a91[_0x02ce('0x2b')](')'));_0x441a83[_0x02ce('0x2c')]=_0x584966;_0x43c59a(_0x441a83);})[_0x02ce('0x11')](function(_0x368368){_0x216905(_0x368368[_0x02ce('0x15')]);});});}function getEndUser(_0x5f0192,_0x161e0c,_0x391673,_0x495893,_0x3721b5,_0x59146f){return new BPromise(function(_0x5a8a60,_0x1a8fb1){var _0x2acb99=_0x59146f['toLowerCase']()==='outbound'?_0x3721b5[_0x02ce('0x25')]:_0x3721b5['calleridnum'];return getAuthToken(_0x161e0c,_0x391673,_0x59146f)['then'](function(_0x1fc04f){var _0x1cb44f={'method':_0x02ce('0x16'),'uri':_0x495893+_0x02ce('0x2d')+_0x2acb99['replace']('+','%2b')+'\x27','headers':{'Authorization':_0x02ce('0x28')+_0x1fc04f,'If-None-Match':null,'OData-Version':_0x02ce('0x17')},'json':!![]};return rp(_0x1cb44f);})[_0x02ce('0xf')](function(_0x3d002f){var _0x4d2d9c=null;if(_0x3d002f){var _0x4b43c3=_0x3d002f['value'];var _0x31e74d=![];for(_0x4d2d9c=0x0;_0x4d2d9c<_0x4b43c3['length'];_0x4d2d9c++){if(_0x4b43c3[_0x4d2d9c][_0x02ce('0x2e')]===_0x2acb99){_0x31e74d=!![];_0x5f0192[_0x02ce('0x2c')]=_0x4b43c3[_0x4d2d9c][_0x02ce('0x2f')];}}if(_0x31e74d){_0x5a8a60(_0x5f0192);}else{return createEndUser(_0x5f0192,_0x161e0c,_0x391673,_0x495893,_0x3721b5,_0x59146f)['then'](function(_0x51a663){logger['info']('['+[_0x59146f[_0x02ce('0x13')]()]+_0x02ce('0x30'),_0x51a663[_0x02ce('0x2c')]);_0x5a8a60(_0x51a663);});}}else{return createEndUser(_0x5f0192,_0x161e0c,_0x391673,_0x495893,_0x3721b5,_0x59146f)['then'](function(_0x1ee83f){logger[_0x02ce('0x20')]('['+[_0x59146f[_0x02ce('0x13')]()]+']\x20Enduser\x20Created!',_0x1ee83f[_0x02ce('0x2c')]);_0x5a8a60(_0x1ee83f);});}});});}function getCustomFields(_0xbf8ce7,_0x364341,_0x2cedb6){var _0x95dd0e={};if(_0xbf8ce7[_0x02ce('0x1d')]>0x0){_[_0x02ce('0x31')](_0xbf8ce7,function(_0x3a2678){if(_[_0x02ce('0x32')]([_0x02ce('0x33'),_0x02ce('0x34')],_0x3a2678['type'])&&_0x3a2678[_0x02ce('0x35')]&&!_0x3a2678[_0x02ce('0x36')]){var _0x322491=_0x3a2678['idField'][_0x02ce('0x23')]();var _0x3b83a8=_0x322491[_0x02ce('0x2a')](0x0,_0x322491[_0x02ce('0x37')]('_'));var _0x227152=_0x322491[_0x02ce('0x2a')](_0x322491['indexOf']('_')+0x1);if(_0x3b83a8===_0x2cedb6){_0x95dd0e[_0x227152]=_0x3a2678[_0x02ce('0x38')];}}});}return _0x95dd0e;}function getTicket(_0x338594,_0x5dec41,_0x16376e,_0x299351,_0x56f9d3,_0xe19b9b,_0x132f93){return new BPromise(function(_0x26e3c2,_0x43ab00){var _0x5d7372;return getAuthToken(_0x5dec41,_0x16376e,_0x132f93)[_0x02ce('0xf')](function(_0x119551){if(_0xe19b9b['ticketType']==='incident'){_0x5d7372={'method':_0x02ce('0xb'),'uri':_0x299351+_0x02ce('0x39'),'body':Object[_0x02ce('0x3a')]({},{'title':intUtil[_0x02ce('0x3b')](_0xe19b9b[_0x02ce('0x3c')],_0x56f9d3,'\x20'),'description':intUtil[_0x02ce('0x3b')](_0xe19b9b[_0x02ce('0x3d')],_0x56f9d3,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x338594[_0x02ce('0x2c')]+')','ownerid@odata.bind':_0x02ce('0x27')+_0x338594[_0x02ce('0x3e')]+')','caseorigincode':'1'},getCustomFields(_0xe19b9b[_0x02ce('0x3f')],_0x56f9d3,_0xe19b9b[_0x02ce('0x40')])),'headers':{'Authorization':'Bearer\x20'+_0x119551,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0xe19b9b[_0x02ce('0x40')]===_0x02ce('0x41')){_0x5d7372={'method':_0x02ce('0xb'),'uri':_0x299351+'phonecalls','body':Object['assign']({},{'subject':intUtil[_0x02ce('0x3b')](_0xe19b9b[_0x02ce('0x3c')],_0x56f9d3,'\x20'),'phonenumber':String(_0x56f9d3[_0x02ce('0x26')]),'description':intUtil[_0x02ce('0x3b')](_0xe19b9b[_0x02ce('0x3d')],_0x56f9d3,'\x0a'),'regardingobjectid_contact@odata.bind':_0x02ce('0x42')+_0x338594['enduserId']+')','ownerid@odata.bind':_0x02ce('0x27')+_0x338594[_0x02ce('0x3e')]+')','directioncode':_0x338594[_0x02ce('0x43')]===_0x02ce('0x44')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x02ce('0x27')+_0x338594[_0x02ce('0x3e')]+')','participationtypemask':_0x338594[_0x02ce('0x43')]===_0x02ce('0x44')?0x2:0x1},{'partyid_contact@odata.bind':_0x02ce('0x42')+_0x338594[_0x02ce('0x2c')]+')','participationtypemask':_0x338594[_0x02ce('0x43')]===_0x02ce('0x44')?0x1:0x2}]},getCustomFields(_0xe19b9b['Fields'],_0x56f9d3,_0xe19b9b[_0x02ce('0x40')])),'headers':{'Authorization':'Bearer\x20'+_0x119551,'OData-Version':_0x02ce('0x17')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5d7372);})[_0x02ce('0xf')](function(_0x1ce85d){var _0x39670f=_0x1ce85d['headers'][_0x02ce('0x45')];var _0x337e68=_0x39670f[_0x02ce('0x2a')](_0x39670f[_0x02ce('0x2b')]('(')+0x1,_0x39670f[_0x02ce('0x2b')](')'));_0x338594['ticketId']=_0x337e68;_0x26e3c2(_0x338594);})[_0x02ce('0x11')](function(_0x53a34a){_0x43ab00(_0x53a34a[_0x02ce('0x15')]);});});}function emit(_0x3f7efb,_0x4c1d71,_0x12fd85,_0x19487d){var _0xd6433e={'uri':util[_0x02ce('0x46')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x3f7efb,_0x12fd85,_0x19487d)};io['to'](util[_0x02ce('0x46')](_0x02ce('0x47'),_0x4c1d71))[_0x02ce('0x48')]('trigger:browser:url',_0xd6433e);}exports['cs']=function(_0x3d2af4,_0x196c05,_0xaa85df,_0xc7cfeb,_0x3da8dd,_0xbdca4f,_0x1f0424,_0x25725e){var _0x3fa44b={};_0xbdca4f[_0x02ce('0xc')]=intUtil[_0x02ce('0x49')](_0xbdca4f['remoteUri']);_0xbdca4f[_0x02ce('0x4a')]=intUtil[_0x02ce('0x49')](_0xbdca4f[_0x02ce('0x4a')]);_0x3fa44b[_0x02ce('0x43')]=_0x25725e===_0x02ce('0x44')||_0x25725e===_0x02ce('0x4b')?_0x02ce('0x44'):_0x02ce('0x24');var _0x72db85=util[_0x02ce('0x46')](_0x02ce('0x4c'),_0xbdca4f[_0x02ce('0xc')]);var _0x1ff3ae=util[_0x02ce('0x46')](_0x02ce('0x4d'),_0xbdca4f[_0x02ce('0x4e')]);var _0x35426a=util[_0x02ce('0x46')](_0x02ce('0x4f'),_0xbdca4f[_0x02ce('0x4a')],_0x196c05[_0x02ce('0x50')],md5(_0x196c05[_0x02ce('0x50')]));if(_0x3da8dd&&_0x3da8dd[_0x02ce('0x51')]){logger[_0x02ce('0x20')](_0x02ce('0x52'),'Recording\x20is\x20enabled!');_0x196c05[_0x02ce('0x53')]=_0x35426a;}else if(_0x1f0424&&_0x1f0424[_0x02ce('0x54')]&&_0x1f0424['recordingFormat']!==_0x02ce('0x55')){logger[_0x02ce('0x20')](_0x02ce('0x56'),_0x02ce('0x57'));_0x196c05[_0x02ce('0x53')]=_0x35426a;}else{_0x196c05['recordingURL']='';}return getUser(_0x3fa44b,_0xbdca4f,_0xc7cfeb,_0x1ff3ae,_0x72db85,_0x25725e)[_0x02ce('0xf')](function(_0x4ba825){logger['info']('['+_0x25725e[_0x02ce('0x13')]()+']\x20The\x20User\x20ID\x20is:',_0x4ba825[_0x02ce('0x3e')]);logger['info']('['+_0x25725e[_0x02ce('0x13')]()+_0x02ce('0x58'),_0x4ba825['userEmail']);return getEndUser(_0x4ba825,_0xbdca4f,_0x1ff3ae,_0x72db85,_0x196c05,_0x25725e);})[_0x02ce('0xf')](function(_0x246437){logger[_0x02ce('0x20')]('['+_0x25725e[_0x02ce('0x13')]()+_0x02ce('0x59'),_0x246437[_0x02ce('0x2c')]);logger[_0x02ce('0x20')]('['+_0x25725e[_0x02ce('0x13')]()+_0x02ce('0x5a'),_0x196c05['calleridnum']);return getTicket(_0x246437,_0xbdca4f,_0x1ff3ae,_0x72db85,_0x196c05,_0xaa85df,_0x25725e);})[_0x02ce('0xf')](function(_0x565b1f){logger[_0x02ce('0x20')](util['format']('['+_0x25725e['toUpperCase']()+_0x02ce('0x5b'),_0xaa85df['ticketType'],_0x565b1f[_0x02ce('0x5c')]));logger['info'](util[_0x02ce('0x46')]('['+_0x25725e[_0x02ce('0x13')]()+_0x02ce('0x5d'),_0x25725e));if(_0x25725e!=='unmanaged'){logger[_0x02ce('0x20')]('['+_0x25725e[_0x02ce('0x13')]()+']',_0x02ce('0x5e'));emit(_0xbdca4f['remoteUri'],_0xc7cfeb['name'],_0xaa85df['ticketType'],_0x565b1f[_0x02ce('0x5c')]);}})['catch'](function(_0x428547){logger['error']('['+_0x25725e[_0x02ce('0x13')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0x02ce('0x5f')](_0x428547,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xe5f5=['defaults','socket.io-emitter','POST','remoteUri','username','password','clientSecret','then','access_token','catch','error','toUpperCase','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','toLowerCase','calleridnum','contacts','/systemusers(','substring','lastIndexOf','destcalleridnum','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','string','picklist','type','nameField','customField','idField','content','ticketType','incidents','assign','Subjects','getString','Descriptions','/contacts(','enduserId','Fields','phonecall','callDirection','queue','headers','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','serverUrl','stripTrailingSlash','unmanaged','outbound','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/logger','dynamics365','redis'];(function(_0x2c4c51,_0x16213a){var _0x1f950d=function(_0xa44936){while(--_0xa44936){_0x2c4c51['push'](_0x2c4c51['shift']());}};_0x1f950d(++_0x16213a);}(_0xe5f5,0x1e6));var _0x5e5f=function(_0x5b1d7e,_0x3c930b){_0x5b1d7e=_0x5b1d7e-0x0;var _0x3b8d44=_0xe5f5[_0x5b1d7e];return _0x3b8d44;};'use strict';var _=require(_0x5e5f('0x0'));var BPromise=require(_0x5e5f('0x1'));var rp=require(_0x5e5f('0x2'));var util=require(_0x5e5f('0x3'));var intUtil=require('./util');var md5=require(_0x5e5f('0x4'));var Redis=require(_0x5e5f('0x5'));var logger=require(_0x5e5f('0x6'))(_0x5e5f('0x7'));var config=require('../../../../config/environment');config[_0x5e5f('0x8')]=_[_0x5e5f('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x5e5f('0xa'))(new Redis(config[_0x5e5f('0x8')]));function getAuthToken(_0x181fca,_0x13d28a,_0x2b1d74){var _0x116133={'method':_0x5e5f('0xb'),'uri':_0x13d28a,'form':{'client_id':_0x181fca['clientId'],'resource':_0x181fca[_0x5e5f('0xc')],'username':_0x181fca[_0x5e5f('0xd')],'password':_0x181fca['password'],'grant_type':_0x5e5f('0xe'),'client_secret':_0x181fca[_0x5e5f('0xf')]},'json':!![]};return rp(_0x116133)[_0x5e5f('0x10')](function(_0x4a9a88){return _0x4a9a88[_0x5e5f('0x11')];})[_0x5e5f('0x12')](function(_0x1ca523){logger[_0x5e5f('0x13')]('['+[_0x2b1d74[_0x5e5f('0x14')]()]+']\x20Wrong\x20credentials!');return _0x1ca523[_0x5e5f('0x15')];});}function getUser(_0x88250f,_0x16df6e,_0xe7a74f,_0x240f4a,_0xa68a3a,_0x437a7e){return new BPromise(function(_0x5d180c,_0x15586f){return getAuthToken(_0x16df6e,_0x240f4a,_0x437a7e)[_0x5e5f('0x10')](function(_0x12638d){var _0x5eef05={'method':_0x5e5f('0x16'),'uri':_0xa68a3a+_0x5e5f('0x17'),'headers':{'Authorization':_0x5e5f('0x18')+_0x12638d,'OData-Version':_0x5e5f('0x19')},'json':!![]};return rp(_0x5eef05);})['then'](function(_0xe8f669){var _0x21f43f=_0xe8f669[_0x5e5f('0x1a')];var _0x4f9d3a=![];var _0x556cb7=null;if(!_[_0x5e5f('0x1b')](_0xe7a74f)){if(intUtil[_0x5e5f('0x1c')](_0xe7a74f[_0x5e5f('0x1d')])){_0x88250f[_0x5e5f('0x1e')]=_0xe7a74f[_0x5e5f('0x1d')];for(_0x556cb7=0x0;_0x556cb7<_0x21f43f['length'];_0x556cb7++){if(_0x21f43f[_0x556cb7][_0x5e5f('0x1f')]===_0xe7a74f[_0x5e5f('0x1d')]&&!_0x21f43f[_0x556cb7][_0x5e5f('0x20')]){_0x4f9d3a=!![];logger[_0x5e5f('0x21')]('['+[_0x437a7e[_0x5e5f('0x14')]()]+_0x5e5f('0x22')+_0x21f43f[_0x556cb7][_0x5e5f('0x23')]+'!');_0x88250f[_0x5e5f('0x24')]=_0x21f43f[_0x556cb7][_0x5e5f('0x23')];}}}}if(!_0x4f9d3a){logger[_0x5e5f('0x21')]('['+[_0x437a7e[_0x5e5f('0x14')]()]+_0x5e5f('0x25'));_0x88250f[_0x5e5f('0x1e')]=_0x16df6e[_0x5e5f('0xd')];for(_0x556cb7=0x0;_0x556cb7<_0x21f43f[_0x5e5f('0x26')];_0x556cb7++){if(_0x21f43f[_0x556cb7][_0x5e5f('0x1f')]===_0x16df6e[_0x5e5f('0xd')]){_0x88250f[_0x5e5f('0x24')]=_0x21f43f[_0x556cb7][_0x5e5f('0x23')];}}}_0x5d180c(_0x88250f);})[_0x5e5f('0x12')](function(_0x42362a){_0x15586f(_0x42362a[_0x5e5f('0x15')]);});});}function createEndUser(_0x14a8bd,_0x3bb39d,_0x4e0cb1,_0x20d07a,_0x2320e4,_0x122210){return new BPromise(function(_0x1a6cf5,_0x168748){return getAuthToken(_0x3bb39d,_0x4e0cb1,_0x122210)[_0x5e5f('0x10')](function(_0x748a3d){var _0x44dc86=_0x122210[_0x5e5f('0x27')]()==='outbound'?_0x2320e4['destcalleridnum']:_0x2320e4[_0x5e5f('0x28')];var _0x8f71f6={'method':_0x5e5f('0xb'),'uri':_0x20d07a+_0x5e5f('0x29'),'body':{'telephone1':_0x44dc86,'fullname':_0x44dc86,'firstname':_0x44dc86,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x5e5f('0x2a')+_0x14a8bd[_0x5e5f('0x24')]+')'},'headers':{'Authorization':_0x5e5f('0x18')+_0x748a3d,'OData-Version':_0x5e5f('0x19')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x8f71f6);})[_0x5e5f('0x10')](function(_0x15cab7){var _0x4b7517=_0x15cab7['headers']['odata-entityid'];var _0x58f0d4=_0x4b7517[_0x5e5f('0x2b')](_0x4b7517[_0x5e5f('0x2c')]('(')+0x1,_0x4b7517[_0x5e5f('0x2c')](')'));_0x14a8bd['enduserId']=_0x58f0d4;_0x1a6cf5(_0x14a8bd);})['catch'](function(_0x4687e4){_0x168748(_0x4687e4['message']);});});}function getEndUser(_0x28bba4,_0x16741f,_0x310468,_0x2795bf,_0xcfdf57,_0x31647f){return new BPromise(function(_0x3b8f3e,_0x506302){var _0x10112d=_0x31647f[_0x5e5f('0x27')]()==='outbound'?_0xcfdf57[_0x5e5f('0x2d')]:_0xcfdf57[_0x5e5f('0x28')];return getAuthToken(_0x16741f,_0x310468,_0x31647f)['then'](function(_0x75803e){var _0x238551={'method':_0x5e5f('0x16'),'uri':_0x2795bf+_0x5e5f('0x2e')+_0x10112d[_0x5e5f('0x2f')]('+','%2b')+'\x27','headers':{'Authorization':_0x5e5f('0x18')+_0x75803e,'If-None-Match':null,'OData-Version':_0x5e5f('0x19')},'json':!![]};return rp(_0x238551);})[_0x5e5f('0x10')](function(_0x199e1d){var _0x1516b2=null;if(_0x199e1d){var _0x14cc6c=_0x199e1d[_0x5e5f('0x1a')];var _0x22a9a1=![];for(_0x1516b2=0x0;_0x1516b2<_0x14cc6c['length'];_0x1516b2++){if(_0x14cc6c[_0x1516b2]['telephone1']===_0x10112d){_0x22a9a1=!![];_0x28bba4['enduserId']=_0x14cc6c[_0x1516b2][_0x5e5f('0x30')];}}if(_0x22a9a1){_0x3b8f3e(_0x28bba4);}else{return createEndUser(_0x28bba4,_0x16741f,_0x310468,_0x2795bf,_0xcfdf57,_0x31647f)['then'](function(_0x5dcabc){logger[_0x5e5f('0x21')]('['+[_0x31647f[_0x5e5f('0x14')]()]+_0x5e5f('0x31'),_0x5dcabc['enduserId']);_0x3b8f3e(_0x5dcabc);});}}else{return createEndUser(_0x28bba4,_0x16741f,_0x310468,_0x2795bf,_0xcfdf57,_0x31647f)[_0x5e5f('0x10')](function(_0x2a5fe6){logger[_0x5e5f('0x21')]('['+[_0x31647f[_0x5e5f('0x14')]()]+_0x5e5f('0x32'),_0x2a5fe6['enduserId']);_0x3b8f3e(_0x2a5fe6);});}});});}function getCustomFields(_0x3fb86f,_0x467136,_0x25bd42){var _0x46dc0a={};if(_0x3fb86f[_0x5e5f('0x26')]>0x0){_[_0x5e5f('0x33')](_0x3fb86f,function(_0x4c4c0f){if(_[_0x5e5f('0x34')]([_0x5e5f('0x35'),_0x5e5f('0x36')],_0x4c4c0f[_0x5e5f('0x37')])&&_0x4c4c0f[_0x5e5f('0x38')]&&!_0x4c4c0f[_0x5e5f('0x39')]){var _0x3c4e78=_0x4c4c0f[_0x5e5f('0x3a')][_0x5e5f('0x27')]();var _0x5bbdab=_0x3c4e78[_0x5e5f('0x2b')](0x0,_0x3c4e78['indexOf']('_'));var _0x18705a=_0x3c4e78['substring'](_0x3c4e78['indexOf']('_')+0x1);if(_0x5bbdab===_0x25bd42){_0x46dc0a[_0x18705a]=_0x4c4c0f[_0x5e5f('0x3b')];}}});}return _0x46dc0a;}function getTicket(_0x3c0795,_0x489cd3,_0x52e6c3,_0x2f315b,_0x319096,_0x1db2d4,_0x5500c2){return new BPromise(function(_0x57b56c,_0x213a57){var _0x2af4d0;return getAuthToken(_0x489cd3,_0x52e6c3,_0x5500c2)[_0x5e5f('0x10')](function(_0x2ba534){if(_0x1db2d4[_0x5e5f('0x3c')]==='incident'){_0x2af4d0={'method':'POST','uri':_0x2f315b+_0x5e5f('0x3d'),'body':Object[_0x5e5f('0x3e')]({},{'title':intUtil['getString'](_0x1db2d4[_0x5e5f('0x3f')],_0x319096,'\x20'),'description':intUtil[_0x5e5f('0x40')](_0x1db2d4[_0x5e5f('0x41')],_0x319096,'\x0a'),'customerid_contact@odata.bind':_0x5e5f('0x42')+_0x3c0795[_0x5e5f('0x43')]+')','ownerid@odata.bind':_0x5e5f('0x2a')+_0x3c0795['userId']+')','caseorigincode':'1'},getCustomFields(_0x1db2d4[_0x5e5f('0x44')],_0x319096,_0x1db2d4[_0x5e5f('0x3c')])),'headers':{'Authorization':_0x5e5f('0x18')+_0x2ba534,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1db2d4[_0x5e5f('0x3c')]===_0x5e5f('0x45')){_0x2af4d0={'method':'POST','uri':_0x2f315b+'phonecalls','body':Object[_0x5e5f('0x3e')]({},{'subject':intUtil[_0x5e5f('0x40')](_0x1db2d4['Subjects'],_0x319096,'\x20'),'phonenumber':String(_0x319096[_0x5e5f('0x28')]),'description':intUtil[_0x5e5f('0x40')](_0x1db2d4['Descriptions'],_0x319096,'\x0a'),'regardingobjectid_contact@odata.bind':_0x5e5f('0x42')+_0x3c0795[_0x5e5f('0x43')]+')','ownerid@odata.bind':_0x5e5f('0x2a')+_0x3c0795[_0x5e5f('0x24')]+')','directioncode':_0x3c0795[_0x5e5f('0x46')]===_0x5e5f('0x47')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x3c0795[_0x5e5f('0x24')]+')','participationtypemask':_0x3c0795['callDirection']===_0x5e5f('0x47')?0x2:0x1},{'partyid_contact@odata.bind':_0x5e5f('0x42')+_0x3c0795['enduserId']+')','participationtypemask':_0x3c0795[_0x5e5f('0x46')]===_0x5e5f('0x47')?0x1:0x2}]},getCustomFields(_0x1db2d4[_0x5e5f('0x44')],_0x319096,_0x1db2d4[_0x5e5f('0x3c')])),'headers':{'Authorization':_0x5e5f('0x18')+_0x2ba534,'OData-Version':_0x5e5f('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x2af4d0);})[_0x5e5f('0x10')](function(_0x2dc929){var _0x2bffeb=_0x2dc929[_0x5e5f('0x48')]['odata-entityid'];var _0x150e68=_0x2bffeb[_0x5e5f('0x2b')](_0x2bffeb[_0x5e5f('0x2c')]('(')+0x1,_0x2bffeb[_0x5e5f('0x2c')](')'));_0x3c0795[_0x5e5f('0x49')]=_0x150e68;_0x57b56c(_0x3c0795);})[_0x5e5f('0x12')](function(_0x500a7a){_0x213a57(_0x500a7a['message']);});});}function emit(_0x17261f,_0x66d955,_0x5e0922,_0x1e7b64){var _0x3c5f7c={'uri':util['format'](_0x5e5f('0x4a'),_0x17261f,_0x5e0922,_0x1e7b64)};io['to'](util[_0x5e5f('0x4b')](_0x5e5f('0x4c'),_0x66d955))[_0x5e5f('0x4d')]('trigger:browser:url',_0x3c5f7c);}exports['cs']=function(_0x4fbf80,_0x361d06,_0x3aacf6,_0x2d51bc,_0x24d945,_0x48ed2c,_0x14c8cd,_0x24fe7a){var _0xe70731={};_0x48ed2c[_0x5e5f('0xc')]=intUtil['stripTrailingSlash'](_0x48ed2c['remoteUri']);_0x48ed2c[_0x5e5f('0x4e')]=intUtil[_0x5e5f('0x4f')](_0x48ed2c[_0x5e5f('0x4e')]);_0xe70731['callDirection']=_0x24fe7a===_0x5e5f('0x47')||_0x24fe7a===_0x5e5f('0x50')?_0x5e5f('0x47'):_0x5e5f('0x51');var _0x5b1a7d=util[_0x5e5f('0x4b')]('%s/api/data/v9.0/',_0x48ed2c[_0x5e5f('0xc')]);var _0x58f4ec=util[_0x5e5f('0x4b')](_0x5e5f('0x52'),_0x48ed2c[_0x5e5f('0x53')]);var _0x3d01a0=util[_0x5e5f('0x4b')](_0x5e5f('0x54'),_0x48ed2c[_0x5e5f('0x4e')],_0x361d06[_0x5e5f('0x55')],md5(_0x361d06[_0x5e5f('0x55')]));if(_0x24d945&&_0x24d945[_0x5e5f('0x56')]){logger[_0x5e5f('0x21')](_0x5e5f('0x57'),_0x5e5f('0x58'));_0x361d06[_0x5e5f('0x59')]=_0x3d01a0;}else if(_0x14c8cd&&_0x14c8cd[_0x5e5f('0x5a')]&&_0x14c8cd[_0x5e5f('0x5a')]!=='none'){logger['info'](_0x5e5f('0x5b'),_0x5e5f('0x58'));_0x361d06[_0x5e5f('0x59')]=_0x3d01a0;}else{_0x361d06[_0x5e5f('0x59')]='';}return getUser(_0xe70731,_0x48ed2c,_0x2d51bc,_0x58f4ec,_0x5b1a7d,_0x24fe7a)[_0x5e5f('0x10')](function(_0x8d20cc){logger['info']('['+_0x24fe7a['toUpperCase']()+_0x5e5f('0x5c'),_0x8d20cc[_0x5e5f('0x24')]);logger[_0x5e5f('0x21')]('['+_0x24fe7a[_0x5e5f('0x14')]()+_0x5e5f('0x5d'),_0x8d20cc['userEmail']);return getEndUser(_0x8d20cc,_0x48ed2c,_0x58f4ec,_0x5b1a7d,_0x361d06,_0x24fe7a);})[_0x5e5f('0x10')](function(_0x59b51){logger['info']('['+_0x24fe7a[_0x5e5f('0x14')]()+_0x5e5f('0x5e'),_0x59b51[_0x5e5f('0x43')]);logger['info']('['+_0x24fe7a['toUpperCase']()+']\x20The\x20Enduser\x20phone\x20is:',_0x361d06['calleridnum']);return getTicket(_0x59b51,_0x48ed2c,_0x58f4ec,_0x5b1a7d,_0x361d06,_0x3aacf6,_0x24fe7a);})['then'](function(_0x2dcb8c){logger[_0x5e5f('0x21')](util[_0x5e5f('0x4b')]('['+_0x24fe7a[_0x5e5f('0x14')]()+_0x5e5f('0x5f'),_0x3aacf6['ticketType'],_0x2dcb8c[_0x5e5f('0x49')]));logger[_0x5e5f('0x21')](util[_0x5e5f('0x4b')]('['+_0x24fe7a[_0x5e5f('0x14')]()+_0x5e5f('0x60'),_0x24fe7a));if(_0x24fe7a!==_0x5e5f('0x50')){logger['info']('['+_0x24fe7a[_0x5e5f('0x14')]()+']',_0x5e5f('0x61'));emit(_0x48ed2c[_0x5e5f('0xc')],_0x2d51bc['name'],_0x3aacf6[_0x5e5f('0x3c')],_0x2dcb8c[_0x5e5f('0x49')]);}})[_0x5e5f('0x12')](function(_0x3b6243){logger[_0x5e5f('0x13')]('['+_0x24fe7a[_0x5e5f('0x14')]()+_0x5e5f('0x62'),util['inspect'](_0x3b6243,{'showHidden':!![],'depth':null}));});}; \ 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 900dfc6..902245f 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 _0x99d6=['name','Fields','mapValues','keyBy','custom_fields','value','%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','validateEmail','format','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','[HTTP]','stringify','map','forEach','string','picklist','type','nameField','customField','includes','push','idField','content','variable','variableName','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','outbound','recordingFormat','none','Authorization','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','error','[OUTBOUND]','lastevent','toUpperCase','request-promise','md5','util','ioredis','./util','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridnum','getString','Subjects','Descriptions','
','Tags'];(function(_0x54d52,_0x2473ba){var _0x968345=function(_0x3fcd06){while(--_0x3fcd06){_0x54d52['push'](_0x54d52['shift']());}};_0x968345(++_0x2473ba);}(_0x99d6,0x105));var _0x699d=function(_0x149ca0,_0x2ac7f5){_0x149ca0=_0x149ca0-0x0;var _0x56b6b9=_0x99d6[_0x149ca0];return _0x56b6b9;};'use strict';var _=require('lodash');var rp=require(_0x699d('0x0'));var md5=require(_0x699d('0x1'));var util=require(_0x699d('0x2'));var Redis=require(_0x699d('0x3'));var intUtil=require(_0x699d('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x699d('0x5'));config[_0x699d('0x6')]=_[_0x699d('0x7')](config['redis'],{'host':_0x699d('0x8'),'port':0x18eb});var io=require(_0x699d('0x9'))(new Redis(config[_0x699d('0x6')]));var headers={'Content-Type':_0x699d('0xa'),'Accept':'application/json'};function emit(_0x2bbb92,_0x394901,_0x13e3f4){io['to'](_0x2bbb92)['emit'](_0x394901,_0x13e3f4);}function getTicket(_0x4a02de,_0x51b4c7,_0x5531c7,_0x4d8f5b,_0x2a5f10){logger[_0x699d('0xb')](_0x699d('0xc'));var _0x481dcc=_[_0x699d('0xd')]({'responder_id':_0x51b4c7['id'],'requester_id':_0x5531c7['id'],'name':util['format'](_0x699d('0xe'),_0x2a5f10['calleridname']),'phone':_0x2a5f10[_0x699d('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x699d('0x10')](_0x4d8f5b[_0x699d('0x11')],_0x2a5f10,'\x20'),'description':intUtil[_0x699d('0x10')](_0x4d8f5b[_0x699d('0x12')],_0x2a5f10,_0x699d('0x13')),'tags':getTags(_0x4d8f5b[_0x699d('0x14')],_0x699d('0x15'))},getCustomFields(_0x4d8f5b[_0x699d('0x16')],_0x2a5f10));_0x481dcc['custom_fields']=_[_0x699d('0x17')](_[_0x699d('0x18')](_0x481dcc[_0x699d('0x19')],'id'),_0x699d('0x1a'));return request({'uri':util['format'](_0x699d('0x1b'),_0x4a02de[_0x699d('0x1c')]),'method':'POST','body':_0x481dcc})[_0x699d('0x1d')](function(_0x3682bd){logger['info'](_0x699d('0x1e'));return _0x3682bd;});}function getUser(_0x35e469,_0x3f72cd){if(intUtil[_0x699d('0x1f')](_0x3f72cd)){return request({'uri':util[_0x699d('0x20')]('%s/api/v2/agents',_0x35e469[_0x699d('0x1c')]),'qs':{'email':_0x3f72cd}})['then'](function(_0x3f83dc){if(_0x3f83dc[_0x699d('0x21')]){logger[_0x699d('0xb')](_0x699d('0x22'));return _[_0x699d('0x23')](_0x3f83dc,function(_0x34b083){return _0x34b083[_0x699d('0x24')][_0x699d('0x25')]===_0x3f72cd;});}else{logger[_0x699d('0xb')](_0x699d('0x26'));return request({'uri':util[_0x699d('0x20')](_0x699d('0x27'),_0x35e469['remoteUri'])})[_0x699d('0x1d')](function(_0x52e7b2){logger[_0x699d('0xb')](_0x699d('0x28'));return _0x52e7b2;});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x699d('0x20')]('%s/api/v2/agents/me',_0x35e469[_0x699d('0x1c')])})['then'](function(_0x1bb0f5){logger[_0x699d('0xb')](_0x699d('0x28'));return _0x1bb0f5;});}}function getEndUser(_0x5aeee3,_0x52d285,_0xda0018){logger[_0x699d('0xb')](_0x699d('0x29'),_0xda0018);return request({'uri':util[_0x699d('0x20')](_0x699d('0x2a'),_0x5aeee3['remoteUri']),'qs':{'phone':_0xda0018}})[_0x699d('0x1d')](function(_0x1736c6){if(_0x1736c6[_0x699d('0x21')]){logger[_0x699d('0xb')](_0x699d('0x2b'));return _[_0x699d('0x23')](_0x1736c6,{'phone':_0xda0018});}else{logger[_0x699d('0xb')](_0x699d('0x2c'));return request({'uri':util[_0x699d('0x20')](_0x699d('0x2a'),_0x5aeee3['remoteUri']),'method':'POST','body':{'name':_0x52d285,'phone':_0xda0018}})['then'](function(_0x1b3a86){logger[_0x699d('0xb')](_0x699d('0x2d'));return _0x1b3a86;});}});}function getAuth(_0x595c7a){return util[_0x699d('0x20')](_0x699d('0x2e'),new Buffer(_0x595c7a[_0x699d('0x2f')]+':X')[_0x699d('0x30')](_0x699d('0x31')));}function request(_0x1db660){logger['debug'](_0x699d('0x32'),JSON[_0x699d('0x33')](_0x1db660));return rp(_['defaults'](_0x1db660,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x2abf48,_0x18566a){var _0x3b724f=[];if(_0x2abf48&&_0x2abf48['length']>0x0){_0x3b724f=_[_0x699d('0x34')](_0x2abf48,_0x18566a);}return _0x3b724f;}function getCustomFields(_0x54435c,_0x234fcc){var _0x1b9f0a=[];var _0x357508={'custom_fields':[]};if(_0x54435c[_0x699d('0x21')]>0x0){_[_0x699d('0x35')](_0x54435c,function(_0x946f69){if(_['includes']([_0x699d('0x36'),_0x699d('0x37')],_0x946f69[_0x699d('0x38')])&&_0x946f69[_0x699d('0x39')]&&!_0x946f69[_0x699d('0x3a')]){_0x357508[_0x946f69[_0x699d('0x39')]['toLowerCase']()]=_0x946f69['content'][_0x699d('0x30')]();}else if(_[_0x699d('0x3b')]([_0x699d('0x36'),'picklist'],_0x946f69[_0x699d('0x38')])&&_0x946f69['idField']&&_0x946f69[_0x699d('0x3a')]){_0x357508['custom_fields'][_0x699d('0x3c')]({'id':_0x946f69[_0x699d('0x3d')],'value':_0x946f69[_0x699d('0x3e')]['toString']()});}else if(_0x946f69[_0x699d('0x38')]===_0x699d('0x3f')&&_0x946f69['variableName']&&_0x946f69[_0x699d('0x3d')]&&_0x946f69[_0x699d('0x3a')]){_0x234fcc[_0x946f69[_0x699d('0x40')]]&&_0x357508[_0x699d('0x19')][_0x699d('0x3c')]({'id':_0x946f69[_0x699d('0x3d')],'value':_0x234fcc[_0x946f69[_0x699d('0x40')]][_0x699d('0x30')]()});}else if(_0x946f69[_0x699d('0x38')]==='customVariable'&&_0x946f69['Variable']&&_0x946f69[_0x699d('0x41')][_0x699d('0x15')]&&_0x946f69[_0x699d('0x3d')]&&_0x946f69[_0x699d('0x3a')]){_0x234fcc[_0x946f69['Variable'][_0x699d('0x15')]['toLowerCase']()]&&_0x357508[_0x699d('0x19')][_0x699d('0x3c')]({'id':_0x946f69[_0x699d('0x3d')],'value':_0x234fcc[_0x946f69[_0x699d('0x41')][_0x699d('0x15')][_0x699d('0x42')]()][_0x699d('0x30')]()});}});}return _0x357508;}exports[_0x699d('0x43')]=function(_0x5ea49c,_0x5ae18a,_0x2e7f47,_0x55aa18,_0x4a695b,_0xd255c3){var _0x4b2180,_0x2b14de;_0xd255c3[_0x699d('0x1c')]=intUtil[_0x699d('0x44')](_0xd255c3[_0x699d('0x1c')]);_0xd255c3[_0x699d('0x45')]=intUtil['stripTrailingSlash'](_0xd255c3[_0x699d('0x45')]);if(_0x4a695b&&_0x4a695b[_0x699d('0x46')]){logger['info']('[QUEUE]',_0x699d('0x47'));_0x5ae18a[_0x699d('0x48')]=util[_0x699d('0x20')](_0x699d('0x49'),_0xd255c3[_0x699d('0x45')],_0x5ae18a[_0x699d('0x4a')],md5(_0x5ae18a['uniqueid']));}else{_0x5ae18a[_0x699d('0x48')]='';}headers['Authorization']=getAuth(_0xd255c3);return getUser(_0xd255c3,_0x55aa18[_0x699d('0x25')])[_0x699d('0x1d')](function(_0x4ba427){_0x4b2180=_0x4ba427;logger['info'](_0x699d('0x4b'),_0x4b2180['id']);return getEndUser(_0xd255c3,_0x5ae18a['calleridname'],_0x5ae18a[_0x699d('0xf')]);})[_0x699d('0x1d')](function(_0x157d43){_0x2b14de=_0x157d43;logger[_0x699d('0xb')]('The\x20Enduser\x20ID\x20is:',_0x2b14de['id']);return getTicket(_0xd255c3,_0x4b2180,_0x2b14de,_0x2e7f47,_0x5ae18a);})[_0x699d('0x1d')](function(_0x319e99){if(_0x319e99&&_0x319e99['id']){logger['info'](_0x699d('0x1e'));logger[_0x699d('0xb')](_0x699d('0x4c'),_0x319e99['id']);logger['info'](_0x699d('0x4d'),_0x699d('0x4e'));emit(util[_0x699d('0x20')](_0x699d('0x4f'),_0x55aa18['name']),_0x699d('0x50'),{'uri':util[_0x699d('0x20')](_0x699d('0x51'),_0xd255c3[_0x699d('0x1c')],_0x319e99['id'])});}})[_0x699d('0x52')](function(_0x18930b){logger['error']('[QUEUE]',JSON[_0x699d('0x33')](_0x18930b));});};exports[_0x699d('0x53')]=function(_0x4b4926,_0x410afc,_0x309949,_0x37bdb0,_0x3faf89,_0x2877ce,_0xeb8a97){var _0x51f7d5,_0x3a8733;_0x2877ce[_0x699d('0x1c')]=intUtil['stripTrailingSlash'](_0x2877ce[_0x699d('0x1c')]);_0x2877ce[_0x699d('0x45')]=intUtil[_0x699d('0x44')](_0x2877ce[_0x699d('0x45')]);if(_0xeb8a97&&_0xeb8a97[_0x699d('0x54')]&&_0xeb8a97[_0x699d('0x54')]!==_0x699d('0x55')){logger['info']('[OUTBOUND]',_0x699d('0x47'));_0x410afc['recordingURL']=util[_0x699d('0x20')](_0x699d('0x49'),_0x2877ce[_0x699d('0x45')],_0x410afc[_0x699d('0x4a')],md5(_0x410afc['uniqueid']));}headers[_0x699d('0x56')]=getAuth(_0x2877ce);return getUser(_0x2877ce,_0x37bdb0[_0x699d('0x25')])[_0x699d('0x1d')](function(_0x424b2d){_0x51f7d5=_0x424b2d;logger[_0x699d('0xb')]('The\x20User\x20ID\x20is:',_0x51f7d5['id']);return getEndUser(_0x2877ce,_0x410afc[_0x699d('0x57')],_0x410afc[_0x699d('0x58')]);})[_0x699d('0x1d')](function(_0x2747f6){_0x3a8733=_0x2747f6;logger[_0x699d('0xb')](_0x699d('0x59'),_0x3a8733['id']);return getTicket(_0x2877ce,_0x51f7d5,_0x3a8733,_0x309949,_0x410afc);})[_0x699d('0x1d')](function(_0x3d8d11){if(_0x3d8d11&&_0x3d8d11['id']){logger['info'](_0x699d('0x1e'));logger[_0x699d('0xb')](_0x699d('0x4c'),_0x3d8d11['id']);logger[_0x699d('0xb')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x699d('0x20')](_0x699d('0x4f'),_0x37bdb0[_0x699d('0x15')]),_0x699d('0x50'),{'uri':util[_0x699d('0x20')](_0x699d('0x51'),_0x2877ce[_0x699d('0x1c')],_0x3d8d11['id'])});}})['catch'](function(_0x54f4c2){logger[_0x699d('0x5a')](_0x699d('0x5b'),JSON['stringify'](_0x54f4c2));});};exports['unmanaged']=function(_0x3f3afc,_0x31bd10,_0x1c3d56,_0x590d0f,_0x424fbc,_0x583013){var _0x50924b,_0x35917c;_0x583013[_0x699d('0x1c')]=intUtil[_0x699d('0x44')](_0x583013[_0x699d('0x1c')]);_0x583013[_0x699d('0x45')]=intUtil[_0x699d('0x44')](_0x583013[_0x699d('0x45')]);if(_0x424fbc&&_0x424fbc[_0x699d('0x46')]){logger[_0x699d('0xb')]('['+_0x31bd10[_0x699d('0x5c')][_0x699d('0x5d')]()+']',_0x699d('0x47'));_0x31bd10[_0x699d('0x48')]=util[_0x699d('0x20')](_0x699d('0x49'),_0x583013['serverUrl'],_0x31bd10[_0x699d('0x4a')],md5(_0x31bd10['uniqueid']));}else{_0x31bd10['recordingURL']='';}headers[_0x699d('0x56')]=getAuth(_0x583013);return getUser(_0x583013,'')[_0x699d('0x1d')](function(_0x12bd9b){_0x50924b=_0x12bd9b;logger[_0x699d('0xb')](_0x699d('0x4b'),_0x50924b['id']);return getEndUser(_0x583013,_0x31bd10['calleridname'],_0x31bd10[_0x699d('0xf')]);})[_0x699d('0x1d')](function(_0x2a7ea2){_0x35917c=_0x2a7ea2;logger[_0x699d('0xb')](_0x699d('0x59'),_0x35917c['id']);return getTicket(_0x583013,_0x50924b,_0x35917c,_0x1c3d56,_0x31bd10);})['then'](function(_0x5dd162){if(_0x5dd162){logger[_0x699d('0xb')]('Ticket\x20created!');logger['info'](_0x699d('0x4c'),_0x5dd162['id']);}})[_0x699d('0x52')](function(_0x35be29){logger['error']('['+_0x31bd10[_0x699d('0x5c')]['toUpperCase']()+']',JSON[_0x699d('0x33')](_0x35be29));});}; \ No newline at end of file +var _0xab64=['trigger:browser:url','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','toUpperCase','catch','lastevent','lodash','request-promise','md5','ioredis','./util','../../../../config/logger','localhost','socket.io-emitter','redis','application/json','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Descriptions','
','Tags','name','Fields','mapValues','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','stringify','defaults','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','push','variableName','customVariable','Variable','custom_fields','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0xab64,0xc8));var _0x4ab6=function(_0x574e0b,_0x5ea428){_0x574e0b=_0x574e0b-0x0;var _0x51df06=_0xab64[_0x574e0b];return _0x51df06;};'use strict';var _=require(_0x4ab6('0x0'));var rp=require(_0x4ab6('0x1'));var md5=require(_0x4ab6('0x2'));var util=require('util');var Redis=require(_0x4ab6('0x3'));var intUtil=require(_0x4ab6('0x4'));var config=require('../../../../config/environment');var logger=require(_0x4ab6('0x5'))('freshdesk');config['redis']=_['defaults'](config['redis'],{'host':_0x4ab6('0x6'),'port':0x18eb});var io=require(_0x4ab6('0x7'))(new Redis(config[_0x4ab6('0x8')]));var headers={'Content-Type':_0x4ab6('0x9'),'Accept':_0x4ab6('0x9')};function emit(_0x285c54,_0x4a89ae,_0x21177b){io['to'](_0x285c54)[_0x4ab6('0xa')](_0x4a89ae,_0x21177b);}function getTicket(_0x58242e,_0xf8c338,_0x427f60,_0x59462a,_0x266254){logger[_0x4ab6('0xb')](_0x4ab6('0xc'));var _0x47a2ef=_['merge']({'responder_id':_0xf8c338['id'],'requester_id':_0x427f60['id'],'name':util[_0x4ab6('0xd')](_0x4ab6('0xe'),_0x266254[_0x4ab6('0xf')]),'phone':_0x266254[_0x4ab6('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x4ab6('0x11')](_0x59462a['Subjects'],_0x266254,'\x20'),'description':intUtil['getString'](_0x59462a[_0x4ab6('0x12')],_0x266254,_0x4ab6('0x13')),'tags':getTags(_0x59462a[_0x4ab6('0x14')],_0x4ab6('0x15'))},getCustomFields(_0x59462a[_0x4ab6('0x16')],_0x266254));_0x47a2ef['custom_fields']=_[_0x4ab6('0x17')](_['keyBy'](_0x47a2ef['custom_fields'],'id'),'value');return request({'uri':util[_0x4ab6('0xd')](_0x4ab6('0x18'),_0x58242e[_0x4ab6('0x19')]),'method':_0x4ab6('0x1a'),'body':_0x47a2ef})[_0x4ab6('0x1b')](function(_0x2a8459){logger['info'](_0x4ab6('0x1c'));return _0x2a8459;});}function getUser(_0x175552,_0x53c822){if(intUtil[_0x4ab6('0x1d')](_0x53c822)){return request({'uri':util['format'](_0x4ab6('0x1e'),_0x175552[_0x4ab6('0x19')]),'qs':{'email':_0x53c822}})[_0x4ab6('0x1b')](function(_0xf8e353){if(_0xf8e353['length']){logger[_0x4ab6('0xb')](_0x4ab6('0x1f'));return _[_0x4ab6('0x20')](_0xf8e353,function(_0x15b998){return _0x15b998[_0x4ab6('0x21')][_0x4ab6('0x22')]===_0x53c822;});}else{logger['info'](_0x4ab6('0x23'));return request({'uri':util[_0x4ab6('0xd')](_0x4ab6('0x24'),_0x175552[_0x4ab6('0x19')])})[_0x4ab6('0x1b')](function(_0x38b12c){logger[_0x4ab6('0xb')]('Admin\x20account\x20selected.');return _0x38b12c;});}});}else{logger[_0x4ab6('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x4ab6('0xd')](_0x4ab6('0x24'),_0x175552[_0x4ab6('0x19')])})['then'](function(_0x25a00f){logger['info']('Admin\x20account\x20selected.');return _0x25a00f;});}}function getEndUser(_0x3c80d0,_0x448a8a,_0x2b0f5d){logger[_0x4ab6('0xb')](_0x4ab6('0x25'),_0x2b0f5d);return request({'uri':util[_0x4ab6('0xd')](_0x4ab6('0x26'),_0x3c80d0[_0x4ab6('0x19')]),'qs':{'phone':_0x2b0f5d}})[_0x4ab6('0x1b')](function(_0x2c5a12){if(_0x2c5a12[_0x4ab6('0x27')]){logger[_0x4ab6('0xb')](_0x4ab6('0x28'));return _[_0x4ab6('0x20')](_0x2c5a12,{'phone':_0x2b0f5d});}else{logger[_0x4ab6('0xb')](_0x4ab6('0x29'));return request({'uri':util[_0x4ab6('0xd')]('%s/api/v2/contacts',_0x3c80d0[_0x4ab6('0x19')]),'method':_0x4ab6('0x1a'),'body':{'name':_0x448a8a,'phone':_0x2b0f5d}})['then'](function(_0x29f5d4){logger[_0x4ab6('0xb')](_0x4ab6('0x2a'));return _0x29f5d4;});}});}function getAuth(_0x29288e){return util[_0x4ab6('0xd')](_0x4ab6('0x2b'),new Buffer(_0x29288e[_0x4ab6('0x2c')]+':X')[_0x4ab6('0x2d')](_0x4ab6('0x2e')));}function request(_0xe6a27){logger[_0x4ab6('0x2f')]('[HTTP]',JSON[_0x4ab6('0x30')](_0xe6a27));return rp(_[_0x4ab6('0x31')](_0xe6a27,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x4d2e83,_0x4a76a7){var _0x5516fc=[];if(_0x4d2e83&&_0x4d2e83['length']>0x0){_0x5516fc=_[_0x4ab6('0x32')](_0x4d2e83,_0x4a76a7);}return _0x5516fc;}function getCustomFields(_0x318293,_0x50db46){var _0x3d03a7=[];var _0x587581={'custom_fields':[]};if(_0x318293['length']>0x0){_[_0x4ab6('0x33')](_0x318293,function(_0x16f4b7){if(_[_0x4ab6('0x34')]([_0x4ab6('0x35'),_0x4ab6('0x36')],_0x16f4b7[_0x4ab6('0x37')])&&_0x16f4b7[_0x4ab6('0x38')]&&!_0x16f4b7[_0x4ab6('0x39')]){_0x587581[_0x16f4b7[_0x4ab6('0x38')][_0x4ab6('0x3a')]()]=_0x16f4b7[_0x4ab6('0x3b')][_0x4ab6('0x2d')]();}else if(_['includes'](['string',_0x4ab6('0x36')],_0x16f4b7[_0x4ab6('0x37')])&&_0x16f4b7[_0x4ab6('0x3c')]&&_0x16f4b7[_0x4ab6('0x39')]){_0x587581['custom_fields'][_0x4ab6('0x3d')]({'id':_0x16f4b7[_0x4ab6('0x3c')],'value':_0x16f4b7[_0x4ab6('0x3b')][_0x4ab6('0x2d')]()});}else if(_0x16f4b7['type']==='variable'&&_0x16f4b7[_0x4ab6('0x3e')]&&_0x16f4b7['idField']&&_0x16f4b7[_0x4ab6('0x39')]){_0x50db46[_0x16f4b7[_0x4ab6('0x3e')]]&&_0x587581['custom_fields'][_0x4ab6('0x3d')]({'id':_0x16f4b7['idField'],'value':_0x50db46[_0x16f4b7[_0x4ab6('0x3e')]][_0x4ab6('0x2d')]()});}else if(_0x16f4b7[_0x4ab6('0x37')]===_0x4ab6('0x3f')&&_0x16f4b7[_0x4ab6('0x40')]&&_0x16f4b7[_0x4ab6('0x40')][_0x4ab6('0x15')]&&_0x16f4b7['idField']&&_0x16f4b7[_0x4ab6('0x39')]){_0x50db46[_0x16f4b7[_0x4ab6('0x40')]['name'][_0x4ab6('0x3a')]()]&&_0x587581[_0x4ab6('0x41')]['push']({'id':_0x16f4b7['idField'],'value':_0x50db46[_0x16f4b7[_0x4ab6('0x40')][_0x4ab6('0x15')][_0x4ab6('0x3a')]()]['toString']()});}});}return _0x587581;}exports[_0x4ab6('0x42')]=function(_0x1496ea,_0x2b6821,_0x128578,_0x5692ea,_0x4c7983,_0x350f24){var _0x416196,_0x54e80e;_0x350f24['remoteUri']=intUtil[_0x4ab6('0x43')](_0x350f24[_0x4ab6('0x19')]);_0x350f24['serverUrl']=intUtil[_0x4ab6('0x43')](_0x350f24[_0x4ab6('0x44')]);if(_0x4c7983&&_0x4c7983[_0x4ab6('0x45')]){logger[_0x4ab6('0xb')](_0x4ab6('0x46'),_0x4ab6('0x47'));_0x2b6821[_0x4ab6('0x48')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x350f24[_0x4ab6('0x44')],_0x2b6821[_0x4ab6('0x49')],md5(_0x2b6821[_0x4ab6('0x49')]));}else{_0x2b6821[_0x4ab6('0x48')]='';}headers[_0x4ab6('0x4a')]=getAuth(_0x350f24);return getUser(_0x350f24,_0x5692ea[_0x4ab6('0x22')])[_0x4ab6('0x1b')](function(_0x5b541d){_0x416196=_0x5b541d;logger['info'](_0x4ab6('0x4b'),_0x416196['id']);return getEndUser(_0x350f24,_0x2b6821[_0x4ab6('0xf')],_0x2b6821[_0x4ab6('0x10')]);})['then'](function(_0x5c5aea){_0x54e80e=_0x5c5aea;logger[_0x4ab6('0xb')](_0x4ab6('0x4c'),_0x54e80e['id']);return getTicket(_0x350f24,_0x416196,_0x54e80e,_0x128578,_0x2b6821);})[_0x4ab6('0x1b')](function(_0x3bfff7){if(_0x3bfff7&&_0x3bfff7['id']){logger[_0x4ab6('0xb')](_0x4ab6('0x1c'));logger['info'](_0x4ab6('0x4d'),_0x3bfff7['id']);logger['info'](_0x4ab6('0x46'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x4ab6('0xd')](_0x4ab6('0x4e'),_0x5692ea[_0x4ab6('0x15')]),_0x4ab6('0x4f'),{'uri':util['format'](_0x4ab6('0x50'),_0x350f24['remoteUri'],_0x3bfff7['id'])});}})['catch'](function(_0x47a829){logger[_0x4ab6('0x51')]('[QUEUE]',JSON['stringify'](_0x47a829));});};exports[_0x4ab6('0x52')]=function(_0x49b8b3,_0x590cdb,_0x3e8b55,_0x198763,_0x4b3df5,_0x11832b,_0x521feb){var _0x14db63,_0x5e0dec;_0x11832b[_0x4ab6('0x19')]=intUtil[_0x4ab6('0x43')](_0x11832b[_0x4ab6('0x19')]);_0x11832b['serverUrl']=intUtil[_0x4ab6('0x43')](_0x11832b['serverUrl']);if(_0x521feb&&_0x521feb[_0x4ab6('0x53')]&&_0x521feb[_0x4ab6('0x53')]!==_0x4ab6('0x54')){logger[_0x4ab6('0xb')](_0x4ab6('0x55'),'Recording\x20is\x20enabled!');_0x590cdb[_0x4ab6('0x48')]=util[_0x4ab6('0xd')](_0x4ab6('0x56'),_0x11832b[_0x4ab6('0x44')],_0x590cdb[_0x4ab6('0x49')],md5(_0x590cdb[_0x4ab6('0x49')]));}headers[_0x4ab6('0x4a')]=getAuth(_0x11832b);return getUser(_0x11832b,_0x198763[_0x4ab6('0x22')])[_0x4ab6('0x1b')](function(_0x5a1d6c){_0x14db63=_0x5a1d6c;logger[_0x4ab6('0xb')](_0x4ab6('0x4b'),_0x14db63['id']);return getEndUser(_0x11832b,_0x590cdb[_0x4ab6('0x57')],_0x590cdb[_0x4ab6('0x58')]);})['then'](function(_0x58bbcf){_0x5e0dec=_0x58bbcf;logger['info'](_0x4ab6('0x4c'),_0x5e0dec['id']);return getTicket(_0x11832b,_0x14db63,_0x5e0dec,_0x3e8b55,_0x590cdb);})[_0x4ab6('0x1b')](function(_0x31a822){if(_0x31a822&&_0x31a822['id']){logger['info'](_0x4ab6('0x1c'));logger[_0x4ab6('0xb')]('The\x20Ticket\x20ID\x20is:',_0x31a822['id']);logger[_0x4ab6('0xb')]('[OUTBOUND]',_0x4ab6('0x59'));emit(util[_0x4ab6('0xd')](_0x4ab6('0x4e'),_0x198763[_0x4ab6('0x15')]),_0x4ab6('0x4f'),{'uri':util[_0x4ab6('0xd')](_0x4ab6('0x50'),_0x11832b[_0x4ab6('0x19')],_0x31a822['id'])});}})['catch'](function(_0x4c92c0){logger['error'](_0x4ab6('0x55'),JSON['stringify'](_0x4c92c0));});};exports['unmanaged']=function(_0x110f26,_0x46c36a,_0x5c05b1,_0x3ab169,_0x27852c,_0x49d4b8){var _0x2b8b85,_0x16f6f4;_0x49d4b8['remoteUri']=intUtil['stripTrailingSlash'](_0x49d4b8[_0x4ab6('0x19')]);_0x49d4b8['serverUrl']=intUtil[_0x4ab6('0x43')](_0x49d4b8[_0x4ab6('0x44')]);if(_0x27852c&&_0x27852c[_0x4ab6('0x45')]){logger[_0x4ab6('0xb')]('['+_0x46c36a['lastevent'][_0x4ab6('0x5a')]()+']',_0x4ab6('0x47'));_0x46c36a[_0x4ab6('0x48')]=util[_0x4ab6('0xd')](_0x4ab6('0x56'),_0x49d4b8[_0x4ab6('0x44')],_0x46c36a[_0x4ab6('0x49')],md5(_0x46c36a[_0x4ab6('0x49')]));}else{_0x46c36a['recordingURL']='';}headers[_0x4ab6('0x4a')]=getAuth(_0x49d4b8);return getUser(_0x49d4b8,'')[_0x4ab6('0x1b')](function(_0x314c39){_0x2b8b85=_0x314c39;logger['info'](_0x4ab6('0x4b'),_0x2b8b85['id']);return getEndUser(_0x49d4b8,_0x46c36a[_0x4ab6('0xf')],_0x46c36a['calleridnum']);})[_0x4ab6('0x1b')](function(_0x40f16c){_0x16f6f4=_0x40f16c;logger[_0x4ab6('0xb')](_0x4ab6('0x4c'),_0x16f6f4['id']);return getTicket(_0x49d4b8,_0x2b8b85,_0x16f6f4,_0x5c05b1,_0x46c36a);})[_0x4ab6('0x1b')](function(_0x260be0){if(_0x260be0){logger['info']('Ticket\x20created!');logger[_0x4ab6('0xb')]('The\x20Ticket\x20ID\x20is:',_0x260be0['id']);}})[_0x4ab6('0x5b')](function(_0x68ac3b){logger[_0x4ab6('0x51')]('['+_0x46c36a[_0x4ab6('0x5c')]['toUpperCase']()+']',JSON[_0x4ab6('0x30')](_0x68ac3b));});}; \ 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 55c7be7..33bb14c 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 _0x5c1f=['redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','info','Getting\x20admin\x20information','length','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','Getting\x20user\x20list','then','users','agentEmail','userEmail','userId','error','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','POST','YYYY-MM-DDTHH:mm:ss','headers','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','user:%s','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','outbound','destcalleridnum','queue','unmanaged','email','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','moment','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales'];(function(_0xcdba38,_0xcdd9b1){var _0x47c6bd=function(_0x566a86){while(--_0x566a86){_0xcdba38['push'](_0xcdba38['shift']());}};_0x47c6bd(++_0xcdd9b1);}(_0x5c1f,0x1d7));var _0xf5c1=function(_0x58a4fe,_0x11d439){_0x58a4fe=_0x58a4fe-0x0;var _0x697de2=_0x5c1f[_0x58a4fe];return _0x697de2;};'use strict';var _=require(_0xf5c1('0x0'));var rp=require(_0xf5c1('0x1'));var md5=require(_0xf5c1('0x2'));var util=require('util');var moment=require(_0xf5c1('0x3'));var Promise=require('bluebird');var Redis=require(_0xf5c1('0x4'));var intUtil=require(_0xf5c1('0x5'));var config=require(_0xf5c1('0x6'));var logger=require(_0xf5c1('0x7'))(_0xf5c1('0x8'));config[_0xf5c1('0x9')]=_[_0xf5c1('0xa')](config['redis'],{'host':_0xf5c1('0xb'),'port':0x18eb});var io=require(_0xf5c1('0xc'))(new Redis(config['redis']));function getAdminId(_0x1ab62a,_0x234796,_0x131514,_0x4c4fc0){return new Promise(function(_0x5d48b1,_0x370b27){var _0x476a74=![];var _0x3ff42a={'method':_0xf5c1('0xd'),'uri':_0x4c4fc0+_0xf5c1('0xe'),'json':!![]};_0x3ff42a['headers']=_0x131514;logger[_0xf5c1('0xf')](_0xf5c1('0x10'));return rp(_0x3ff42a)['then'](function(_0x34cccc){if(_0x34cccc){var _0x465e49=_0x34cccc['users'];var _0x2c96d5=null;for(_0x2c96d5=0x0;_0x2c96d5<_0x465e49[_0xf5c1('0x11')];_0x2c96d5++){if(_0x465e49[_0x2c96d5]['email']===_0x1ab62a[_0xf5c1('0x12')]){_0x1ab62a[_0xf5c1('0x13')]=_0x465e49[_0x2c96d5]['id'];_0x476a74=!![];}}if(_0x476a74){logger[_0xf5c1('0xf')]('Admin\x20found:',_0x1ab62a[_0xf5c1('0x13')]);_0x5d48b1(_0x1ab62a);}else{_0x370b27({'statusCode':0x194,'message':_0xf5c1('0x14')});}}else{_0x370b27({'statusCode':0x194,'message':_0xf5c1('0x14')});}})[_0xf5c1('0x15')](function(_0x12e4a2){logger['error']('['+[_0x234796[_0xf5c1('0x16')]()]+']',_0x12e4a2[_0xf5c1('0x17')]);_0x370b27(_0x12e4a2);});});}function getUser(_0x4c263b,_0x3f6b81,_0x29f18a){return function(_0x27f6b5){return new Promise(function(_0xecaa1b,_0x599690){var _0x58b17f={'method':'GET','uri':_0x29f18a+_0xf5c1('0xe'),'json':!![]};_0x58b17f['headers']=_0x3f6b81;logger[_0xf5c1('0xf')](_0xf5c1('0x18'));return rp(_0x58b17f)[_0xf5c1('0x19')](function(_0x32d3f6){if(_0x32d3f6){var _0x2266d0=_0x32d3f6[_0xf5c1('0x1a')];var _0x5e36fa=![];var _0x593c7a=null;if(_0x27f6b5[_0xf5c1('0x1b')]!==null){logger[_0xf5c1('0xf')]('Getting\x20user\x20with\x20email',_0x27f6b5[_0xf5c1('0x1b')]);_0x27f6b5[_0xf5c1('0x1c')]=_0x27f6b5[_0xf5c1('0x1b')];for(_0x593c7a=0x0;_0x593c7a<_0x2266d0[_0xf5c1('0x11')];_0x593c7a++){if(_0x2266d0[_0x593c7a]['email']===_0x27f6b5['agentEmail']){_0x5e36fa=!![];_0x27f6b5[_0xf5c1('0x1d')]=_0x2266d0[_0x593c7a]['id'];logger[_0xf5c1('0xf')]('User\x20found:',_0x27f6b5[_0xf5c1('0x1d')]);}}}if(!_0x5e36fa){logger['info']('Admin\x20selected');_0x27f6b5[_0xf5c1('0x1c')]=_0x27f6b5['adminEmail'];_0x27f6b5['userId']=_0x27f6b5[_0xf5c1('0x13')];_0x5e36fa=!![];}if(_0x5e36fa){_0xecaa1b(_0x27f6b5);}else{_0x599690({'statusCode':0x194,'message':_0xf5c1('0x14')});}}else{_0x599690({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xf5c1('0x15')](function(_0x58b678){logger[_0xf5c1('0x1e')]('['+[_0x4c263b[_0xf5c1('0x16')]()]+']',_0x58b678[_0xf5c1('0x17')]);_0x599690(_0x58b678);});});};}function searchContact(_0x1d79f0,_0x5b0cad,_0x547401,_0x23783a){return new Promise(function(_0x3604b3,_0x1cc68d){var _0x13df7e={'method':_0xf5c1('0xd'),'headers':_0x5b0cad,'uri':_0x1d79f0+_0xf5c1('0x1f')+_0x23783a+_0xf5c1('0x20')+_0x547401+_0xf5c1('0x21'),'json':!![]};rp(_0x13df7e)[_0xf5c1('0x19')](function(_0x3d0067){var _0x1a3cf1=_[_0xf5c1('0x22')](_0x3d0067[_0xf5c1('0x23')][_0xf5c1('0x23')],[_0x547401,_0x23783a]);_0x3604b3(_0x1a3cf1);})[_0xf5c1('0x15')](function(_0x4a28fe){_0x1cc68d(_0x4a28fe);});});}function getEndUser(_0x5e7312,_0x51ebe5,_0x4a096e){return function(_0x912f07){return new Promise(function(_0x3d128d,_0x1a0a65){logger[_0xf5c1('0xf')](util[_0xf5c1('0x24')]('Searching\x20contact\x20with\x20phone\x20%s',_0x912f07[_0xf5c1('0x25')]));searchContact(_0x4a096e,_0x51ebe5,_0xf5c1('0x26'),_0x912f07[_0xf5c1('0x25')])['then'](function(_0x40eae0){if(_0x40eae0){_0x912f07[_0xf5c1('0x27')]=_0x40eae0['id'];logger[_0xf5c1('0xf')](_0xf5c1('0x28'),_0x912f07['endUserId']);return _0x3d128d(_0x912f07);}searchContact(_0x4a096e,_0x51ebe5,_0xf5c1('0x29'),_0x912f07['contactNumber'])[_0xf5c1('0x19')](function(_0x59b898){if(_0x59b898){_0x912f07[_0xf5c1('0x27')]=_0x59b898['id'];logger[_0xf5c1('0xf')](_0xf5c1('0x2a'),_0x912f07['endUserId']);return _0x3d128d(_0x912f07);}createEndUser(_0x912f07,_0x5e7312,_0x51ebe5,_0x4a096e)[_0xf5c1('0x19')](function(_0x56ac94){logger[_0xf5c1('0xf')]('Contact\x20created:',_0x56ac94[_0xf5c1('0x27')]);return _0x3d128d(_0x56ac94);});});})[_0xf5c1('0x15')](function(_0x362638){_0x1a0a65(_0x362638);});});};}function createEndUser(_0x2861ac,_0x90d3ab,_0x214da9,_0x42e834){return new Promise(function(_0x2d3a2a,_0x2b3f0c){var _0x43eb49=moment();var _0x119fb7={'method':_0xf5c1('0x2b'),'uri':_0x42e834+'/api/contacts','body':{'contact':{'last_name':_0x2861ac[_0xf5c1('0x25')],'work_number':_0x2861ac[_0xf5c1('0x25')],'mobile_number':_0x2861ac[_0xf5c1('0x25')],'owner_id':_0x2861ac['userId'],'created_at':_0x43eb49[_0xf5c1('0x24')](_0xf5c1('0x2c'))}},'json':!![]};_0x119fb7[_0xf5c1('0x2d')]=_0x214da9;logger[_0xf5c1('0xf')](_0xf5c1('0x2e'));return rp(_0x119fb7)[_0xf5c1('0x19')](function(_0x4980e3){_0x2861ac[_0xf5c1('0x27')]=_0x4980e3[_0xf5c1('0x2f')]['id'];_0x2d3a2a(_0x2861ac);})['catch'](function(_0x984dc8){logger[_0xf5c1('0x1e')]('['+[_0x90d3ab['toUpperCase']()]+']',_0x984dc8[_0xf5c1('0x17')]);_0x2b3f0c(_0x984dc8[_0xf5c1('0x17')]);});});}function getTicket(_0x7a38e6,_0x97f3de,_0x3549a1,_0x39047c,_0x4bd9df){return function(_0x4d46cb){logger[_0xf5c1('0xf')](_0xf5c1('0x30'));return new Promise(function(_0x26f3de,_0x1c0df5){var _0x13282e=moment();var _0x21a78c={'method':'POST','uri':_0x3549a1+_0xf5c1('0x31'),'body':{'title':intUtil[_0xf5c1('0x32')](_0x39047c[_0xf5c1('0x33')],_0x4bd9df,'\x20'),'description':intUtil[_0xf5c1('0x32')](_0x39047c[_0xf5c1('0x34')],_0x4bd9df,'\x0a'),'owner_id':_0x4d46cb[_0xf5c1('0x1d')],'creater_id':_0x4d46cb[_0xf5c1('0x13')],'targetable_id':_0x4d46cb[_0xf5c1('0x27')],'targetable_type':_0xf5c1('0x35'),'created_at':_0x13282e[_0xf5c1('0x24')](_0xf5c1('0x2c')),'due_date':_0x13282e[_0xf5c1('0x36')](0x1e,'m')[_0xf5c1('0x24')](_0xf5c1('0x2c'))},'json':!![]};_0x21a78c[_0xf5c1('0x2d')]=_0x97f3de;return rp(_0x21a78c)[_0xf5c1('0x19')](function(_0x3575d8){_0x4d46cb['ticketId']=_0x3575d8['task']['id'];logger[_0xf5c1('0xf')]('Task\x20created:',_0x4d46cb[_0xf5c1('0x37')]);_0x26f3de(_0x4d46cb);})[_0xf5c1('0x15')](function(_0x5eba2e){logger[_0xf5c1('0x1e')]('['+[_0x7a38e6[_0xf5c1('0x16')]()]+']',_0x5eba2e[_0xf5c1('0x17')]);_0x1c0df5(_0x5eba2e[_0xf5c1('0x17')]);});});};}function emit(_0xf19726,_0x330deb,_0x2cd1b8){var _0x16964={'uri':_0xf19726+'/contacts/'+_0x2cd1b8};io['to'](util[_0xf5c1('0x24')](_0xf5c1('0x38'),_0x330deb))['emit']('trigger:browser:url',_0x16964);}exports['cs']=function(_0x9d7615,_0x1bac63,_0x2eae50,_0x24d12d,_0x1934ff,_0x2c739c,_0x20256b,_0x2e882e){var _0x4619e7={};var _0xb457e1={'Authorization':_0xf5c1('0x39')+_0x2c739c[_0xf5c1('0x3a')]};_0x2c739c[_0xf5c1('0x3b')]=intUtil[_0xf5c1('0x3c')](_0x2c739c[_0xf5c1('0x3b')]);_0x2c739c[_0xf5c1('0x3d')]=intUtil['stripTrailingSlash'](_0x2c739c['serverUrl']);var _0x527c12=_0x2c739c[_0xf5c1('0x3b')];_0x4619e7['adminEmail']=_0x2c739c[_0xf5c1('0x3e')];_0x4619e7['contactNumber']=_0x2e882e['toLowerCase']()===_0xf5c1('0x3f')?_0x1bac63[_0xf5c1('0x40')]:_0x1bac63['calleridnum'];_0x4619e7['callDirection']=_0x2e882e===_0xf5c1('0x41')||_0x2e882e===_0xf5c1('0x42')?_0xf5c1('0x41'):'outbound';if(_0x24d12d){_0x4619e7[_0xf5c1('0x1b')]=_0x24d12d[_0xf5c1('0x43')];}var _0xe75abc=util[_0xf5c1('0x24')](_0xf5c1('0x44'),_0x2c739c['serverUrl'],_0x1bac63['uniqueid'],md5(_0x1bac63[_0xf5c1('0x45')]));if(_0x1934ff&&_0x1934ff['monitor_format']){logger['info'](_0xf5c1('0x46'),_0xf5c1('0x47'));_0x1bac63[_0xf5c1('0x48')]=_0xe75abc;}else if(_0x20256b&&_0x20256b[_0xf5c1('0x49')]&&_0x20256b[_0xf5c1('0x49')]!=='none'){logger[_0xf5c1('0xf')](_0xf5c1('0x4a'),_0xf5c1('0x47'));_0x1bac63['recordingURL']=_0xe75abc;}else{_0x1bac63['recordingURL']='';}return getAdminId(_0x4619e7,_0x2e882e,_0xb457e1,_0x527c12)[_0xf5c1('0x19')](getUser(_0x2e882e,_0xb457e1,_0x527c12))['then'](getEndUser(_0x2e882e,_0xb457e1,_0x527c12))[_0xf5c1('0x19')](getTicket(_0x2e882e,_0xb457e1,_0x527c12,_0x2eae50,_0x1bac63))[_0xf5c1('0x19')](function(_0x5b9128){logger[_0xf5c1('0xf')](util[_0xf5c1('0x24')](_0xf5c1('0x4b'),_0x5b9128[_0xf5c1('0x37')]));if(_0x2e882e!==_0xf5c1('0x42')){logger[_0xf5c1('0xf')]('['+[_0x2e882e[_0xf5c1('0x16')]()]+']',_0xf5c1('0x4c'));emit(_0x527c12,_0x24d12d[_0xf5c1('0x4d')],_0x5b9128[_0xf5c1('0x27')]);}})[_0xf5c1('0x15')](function(_0x1c20f6){logger[_0xf5c1('0x1e')]('['+[_0x2e882e[_0xf5c1('0x16')]()]+_0xf5c1('0x4e'),util[_0xf5c1('0x4f')](_0x1c20f6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xf5c6=['remoteUri','serverUrl','stripTrailingSlash','username','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','inspect','lodash','request-promise','md5','util','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','socket.io-emitter','GET','/api/selector/owners','info','Getting\x20admin\x20information','users','length','email','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','headers','agentEmail','userEmail','User\x20found:','userId','Admin\x20selected','adminEmail','/api/lookup?q=','&entities=contact','find','contacts','format','contactNumber','then','endUserId','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','POST','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey'];(function(_0x236bf2,_0x58373e){var _0x429196=function(_0x58790c){while(--_0x58790c){_0x236bf2['push'](_0x236bf2['shift']());}};_0x429196(++_0x58373e);}(_0xf5c6,0x161));var _0x6f5c=function(_0x5c0382,_0x15c211){_0x5c0382=_0x5c0382-0x0;var _0x485374=_0xf5c6[_0x5c0382];return _0x485374;};'use strict';var _=require(_0x6f5c('0x0'));var rp=require(_0x6f5c('0x1'));var md5=require(_0x6f5c('0x2'));var util=require(_0x6f5c('0x3'));var moment=require('moment');var Promise=require(_0x6f5c('0x4'));var Redis=require(_0x6f5c('0x5'));var intUtil=require(_0x6f5c('0x6'));var config=require(_0x6f5c('0x7'));var logger=require(_0x6f5c('0x8'))('freshsales');config[_0x6f5c('0x9')]=_['defaults'](config[_0x6f5c('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x6f5c('0xa'))(new Redis(config[_0x6f5c('0x9')]));function getAdminId(_0x63f422,_0x2307ba,_0x1dc4f7,_0x5884e1){return new Promise(function(_0x3ced6a,_0x3b45d6){var _0xf6b51d=![];var _0x163fc2={'method':_0x6f5c('0xb'),'uri':_0x5884e1+_0x6f5c('0xc'),'json':!![]};_0x163fc2['headers']=_0x1dc4f7;logger[_0x6f5c('0xd')](_0x6f5c('0xe'));return rp(_0x163fc2)['then'](function(_0x16b1ad){if(_0x16b1ad){var _0x394ff7=_0x16b1ad[_0x6f5c('0xf')];var _0x386622=null;for(_0x386622=0x0;_0x386622<_0x394ff7[_0x6f5c('0x10')];_0x386622++){if(_0x394ff7[_0x386622][_0x6f5c('0x11')]===_0x63f422['adminEmail']){_0x63f422['adminId']=_0x394ff7[_0x386622]['id'];_0xf6b51d=!![];}}if(_0xf6b51d){logger[_0x6f5c('0xd')](_0x6f5c('0x12'),_0x63f422[_0x6f5c('0x13')]);_0x3ced6a(_0x63f422);}else{_0x3b45d6({'statusCode':0x194,'message':_0x6f5c('0x14')});}}else{_0x3b45d6({'statusCode':0x194,'message':_0x6f5c('0x14')});}})[_0x6f5c('0x15')](function(_0x185753){logger[_0x6f5c('0x16')]('['+[_0x2307ba[_0x6f5c('0x17')]()]+']',_0x185753[_0x6f5c('0x18')]);_0x3b45d6(_0x185753);});});}function getUser(_0x167fa0,_0x19e25f,_0x52ebb6){return function(_0x754af0){return new Promise(function(_0xc1f398,_0x532a41){var _0x4986e3={'method':_0x6f5c('0xb'),'uri':_0x52ebb6+_0x6f5c('0xc'),'json':!![]};_0x4986e3[_0x6f5c('0x19')]=_0x19e25f;logger[_0x6f5c('0xd')]('Getting\x20user\x20list');return rp(_0x4986e3)['then'](function(_0x730191){if(_0x730191){var _0x1c220b=_0x730191['users'];var _0xe605cc=![];var _0x2e126c=null;if(_0x754af0['agentEmail']!==null){logger[_0x6f5c('0xd')]('Getting\x20user\x20with\x20email',_0x754af0[_0x6f5c('0x1a')]);_0x754af0[_0x6f5c('0x1b')]=_0x754af0['agentEmail'];for(_0x2e126c=0x0;_0x2e126c<_0x1c220b[_0x6f5c('0x10')];_0x2e126c++){if(_0x1c220b[_0x2e126c][_0x6f5c('0x11')]===_0x754af0[_0x6f5c('0x1a')]){_0xe605cc=!![];_0x754af0['userId']=_0x1c220b[_0x2e126c]['id'];logger[_0x6f5c('0xd')](_0x6f5c('0x1c'),_0x754af0[_0x6f5c('0x1d')]);}}}if(!_0xe605cc){logger['info'](_0x6f5c('0x1e'));_0x754af0['userEmail']=_0x754af0[_0x6f5c('0x1f')];_0x754af0[_0x6f5c('0x1d')]=_0x754af0[_0x6f5c('0x13')];_0xe605cc=!![];}if(_0xe605cc){_0xc1f398(_0x754af0);}else{_0x532a41({'statusCode':0x194,'message':_0x6f5c('0x14')});}}else{_0x532a41({'statusCode':0x194,'message':_0x6f5c('0x14')});}})[_0x6f5c('0x15')](function(_0x4eb86f){logger[_0x6f5c('0x16')]('['+[_0x167fa0[_0x6f5c('0x17')]()]+']',_0x4eb86f['message']);_0x532a41(_0x4eb86f);});});};}function searchContact(_0x33bc74,_0x123b0d,_0x1193b8,_0xbba89d){return new Promise(function(_0x2220bb,_0x300c17){var _0x2ea666={'method':_0x6f5c('0xb'),'headers':_0x123b0d,'uri':_0x33bc74+_0x6f5c('0x20')+_0xbba89d+'&f='+_0x1193b8+_0x6f5c('0x21'),'json':!![]};rp(_0x2ea666)['then'](function(_0x986deb){var _0x4aa7c3=_[_0x6f5c('0x22')](_0x986deb[_0x6f5c('0x23')][_0x6f5c('0x23')],[_0x1193b8,_0xbba89d]);_0x2220bb(_0x4aa7c3);})[_0x6f5c('0x15')](function(_0x3b296a){_0x300c17(_0x3b296a);});});}function getEndUser(_0x540784,_0x2b8b51,_0x24f876){return function(_0x5cfe7f){return new Promise(function(_0x5aad71,_0x25b599){logger['info'](util[_0x6f5c('0x24')]('Searching\x20contact\x20with\x20phone\x20%s',_0x5cfe7f[_0x6f5c('0x25')]));searchContact(_0x24f876,_0x2b8b51,'mobile_number',_0x5cfe7f[_0x6f5c('0x25')])[_0x6f5c('0x26')](function(_0x1d565f){if(_0x1d565f){_0x5cfe7f['endUserId']=_0x1d565f['id'];logger[_0x6f5c('0xd')]('Contact\x20found\x20mobile_number:',_0x5cfe7f[_0x6f5c('0x27')]);return _0x5aad71(_0x5cfe7f);}searchContact(_0x24f876,_0x2b8b51,'work_number',_0x5cfe7f[_0x6f5c('0x25')])['then'](function(_0x2d71f6){if(_0x2d71f6){_0x5cfe7f[_0x6f5c('0x27')]=_0x2d71f6['id'];logger['info'](_0x6f5c('0x28'),_0x5cfe7f[_0x6f5c('0x27')]);return _0x5aad71(_0x5cfe7f);}createEndUser(_0x5cfe7f,_0x540784,_0x2b8b51,_0x24f876)[_0x6f5c('0x26')](function(_0x453808){logger[_0x6f5c('0xd')](_0x6f5c('0x29'),_0x453808[_0x6f5c('0x27')]);return _0x5aad71(_0x453808);});});})['catch'](function(_0x5e778b){_0x25b599(_0x5e778b);});});};}function createEndUser(_0x440514,_0x42d641,_0xb6a99c,_0x389ea1){return new Promise(function(_0x18e1e6,_0x3bb39d){var _0x1d8c6d=moment();var _0x463f2c={'method':'POST','uri':_0x389ea1+_0x6f5c('0x2a'),'body':{'contact':{'last_name':_0x440514[_0x6f5c('0x25')],'work_number':_0x440514[_0x6f5c('0x25')],'mobile_number':_0x440514[_0x6f5c('0x25')],'owner_id':_0x440514[_0x6f5c('0x1d')],'created_at':_0x1d8c6d[_0x6f5c('0x24')](_0x6f5c('0x2b'))}},'json':!![]};_0x463f2c['headers']=_0xb6a99c;logger[_0x6f5c('0xd')](_0x6f5c('0x2c'));return rp(_0x463f2c)[_0x6f5c('0x26')](function(_0x45ddea){_0x440514[_0x6f5c('0x27')]=_0x45ddea[_0x6f5c('0x2d')]['id'];_0x18e1e6(_0x440514);})[_0x6f5c('0x15')](function(_0x245b7f){logger['error']('['+[_0x42d641[_0x6f5c('0x17')]()]+']',_0x245b7f[_0x6f5c('0x18')]);_0x3bb39d(_0x245b7f['message']);});});}function getTicket(_0x3898be,_0xcd9e62,_0xd7e025,_0xe2201d,_0x5bad57){return function(_0x309314){logger[_0x6f5c('0xd')]('Creating\x20new\x20task');return new Promise(function(_0x4dfb3c,_0x566b8a){var _0x367eb2=moment();var _0x13b0d8={'method':_0x6f5c('0x2e'),'uri':_0xd7e025+_0x6f5c('0x2f'),'body':{'title':intUtil[_0x6f5c('0x30')](_0xe2201d[_0x6f5c('0x31')],_0x5bad57,'\x20'),'description':intUtil[_0x6f5c('0x30')](_0xe2201d[_0x6f5c('0x32')],_0x5bad57,'\x0a'),'owner_id':_0x309314[_0x6f5c('0x1d')],'creater_id':_0x309314[_0x6f5c('0x13')],'targetable_id':_0x309314[_0x6f5c('0x27')],'targetable_type':_0x6f5c('0x33'),'created_at':_0x367eb2[_0x6f5c('0x24')](_0x6f5c('0x2b')),'due_date':_0x367eb2[_0x6f5c('0x34')](0x1e,'m')[_0x6f5c('0x24')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x13b0d8[_0x6f5c('0x19')]=_0xcd9e62;return rp(_0x13b0d8)[_0x6f5c('0x26')](function(_0x5a01cf){_0x309314[_0x6f5c('0x35')]=_0x5a01cf[_0x6f5c('0x36')]['id'];logger['info'](_0x6f5c('0x37'),_0x309314[_0x6f5c('0x35')]);_0x4dfb3c(_0x309314);})[_0x6f5c('0x15')](function(_0x4ddded){logger[_0x6f5c('0x16')]('['+[_0x3898be['toUpperCase']()]+']',_0x4ddded[_0x6f5c('0x18')]);_0x566b8a(_0x4ddded[_0x6f5c('0x18')]);});});};}function emit(_0x2f1d69,_0x591f89,_0xdf30bc){var _0x475375={'uri':_0x2f1d69+_0x6f5c('0x38')+_0xdf30bc};io['to'](util[_0x6f5c('0x24')](_0x6f5c('0x39'),_0x591f89))[_0x6f5c('0x3a')](_0x6f5c('0x3b'),_0x475375);}exports['cs']=function(_0x44b495,_0x43c7fe,_0x39006c,_0x2369cc,_0x43c6aa,_0x5b633c,_0x735cc0,_0x3a0483){var _0xcab4bc={};var _0x1c28ed={'Authorization':_0x6f5c('0x3c')+_0x5b633c[_0x6f5c('0x3d')]};_0x5b633c[_0x6f5c('0x3e')]=intUtil['stripTrailingSlash'](_0x5b633c[_0x6f5c('0x3e')]);_0x5b633c[_0x6f5c('0x3f')]=intUtil[_0x6f5c('0x40')](_0x5b633c[_0x6f5c('0x3f')]);var _0x662f35=_0x5b633c[_0x6f5c('0x3e')];_0xcab4bc[_0x6f5c('0x1f')]=_0x5b633c[_0x6f5c('0x41')];_0xcab4bc[_0x6f5c('0x25')]=_0x3a0483['toLowerCase']()===_0x6f5c('0x42')?_0x43c7fe[_0x6f5c('0x43')]:_0x43c7fe[_0x6f5c('0x44')];_0xcab4bc[_0x6f5c('0x45')]=_0x3a0483===_0x6f5c('0x46')||_0x3a0483===_0x6f5c('0x47')?'queue':'outbound';if(_0x2369cc){_0xcab4bc[_0x6f5c('0x1a')]=_0x2369cc[_0x6f5c('0x11')];}var _0x2573ea=util[_0x6f5c('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5b633c[_0x6f5c('0x3f')],_0x43c7fe[_0x6f5c('0x48')],md5(_0x43c7fe[_0x6f5c('0x48')]));if(_0x43c6aa&&_0x43c6aa[_0x6f5c('0x49')]){logger['info'](_0x6f5c('0x4a'),'Recording\x20is\x20enabled!');_0x43c7fe[_0x6f5c('0x4b')]=_0x2573ea;}else if(_0x735cc0&&_0x735cc0['recordingFormat']&&_0x735cc0[_0x6f5c('0x4c')]!==_0x6f5c('0x4d')){logger[_0x6f5c('0xd')](_0x6f5c('0x4e'),_0x6f5c('0x4f'));_0x43c7fe[_0x6f5c('0x4b')]=_0x2573ea;}else{_0x43c7fe['recordingURL']='';}return getAdminId(_0xcab4bc,_0x3a0483,_0x1c28ed,_0x662f35)[_0x6f5c('0x26')](getUser(_0x3a0483,_0x1c28ed,_0x662f35))['then'](getEndUser(_0x3a0483,_0x1c28ed,_0x662f35))[_0x6f5c('0x26')](getTicket(_0x3a0483,_0x1c28ed,_0x662f35,_0x39006c,_0x43c7fe))['then'](function(_0x4fa0f2){logger[_0x6f5c('0xd')](util[_0x6f5c('0x24')](_0x6f5c('0x50'),_0x4fa0f2[_0x6f5c('0x35')]));if(_0x3a0483!==_0x6f5c('0x47')){logger['info']('['+[_0x3a0483[_0x6f5c('0x17')]()]+']',_0x6f5c('0x51'));emit(_0x662f35,_0x2369cc['name'],_0x4fa0f2[_0x6f5c('0x27')]);}})[_0x6f5c('0x15')](function(_0x49a264){logger['error']('['+[_0x3a0483[_0x6f5c('0x17')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x6f5c('0x52')](_0x49a264,{'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 5ffa776..c54f5ba 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 _0x9c05=['./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','toLowerCase','data1','data2','find','Configurations','data3','queue','routeId','EVENT\x20UNKNOWN','unmanaged','log','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./freshdesk','./zoho','./desk','./servicenow'];(function(_0x3fcc4f,_0xa384ce){var _0x2f4b7c=function(_0x2bbf5f){while(--_0x2bbf5f){_0x3fcc4f['push'](_0x3fcc4f['shift']());}};_0x2f4b7c(++_0xa384ce);}(_0x9c05,0xdc));var _0x59c0=function(_0x51ff0f,_0x2da3d5){_0x51ff0f=_0x51ff0f-0x0;var _0x56aeb1=_0x9c05[_0x51ff0f];return _0x56aeb1;};'use strict';var _=require(_0x59c0('0x0'));var util=require(_0x59c0('0x1'));var zendesk=require(_0x59c0('0x2'));var salesforce=require(_0x59c0('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x59c0('0x4'));var zoho=require(_0x59c0('0x5'));var desk=require(_0x59c0('0x6'));var vtiger=require('./vtiger');var servicenow=require(_0x59c0('0x7'));var dynamics365=require(_0x59c0('0x8'));var freshsales=require(_0x59c0('0x9'));var integrations=[_0x59c0('0xa'),_0x59c0('0xb'),_0x59c0('0xc'),_0x59c0('0xd'),_0x59c0('0xe'),_0x59c0('0xf'),_0x59c0('0x10'),_0x59c0('0x11'),_0x59c0('0x12'),_0x59c0('0x13')];exports[_0x59c0('0x14')]=function(_0x12c56a,_0x2439d7,_0x4fdb4a,_0x29e925,_0x11319e,_0x5a5700){if(_0x4fdb4a){if(_['includes'](integrations,_0x12c56a['data1'][_0x59c0('0x15')]())){try{var _0x3c7b95=null;var _0x5564c7='';var _0x4504f9=_0x4fdb4a[_0x12c56a[_0x59c0('0x16')][_0x59c0('0x15')]()];if(_0x4504f9){var _0x5dc903=_0x4504f9[_0x12c56a[_0x59c0('0x17')]];if(_0x5dc903){var _0x846396=_[_0x59c0('0x18')](_0x5dc903[_0x59c0('0x19')],{'id':parseInt(_0x12c56a[_0x59c0('0x1a')],0xa)});if(_0x846396){if(_0x29e925){if(_0x11319e&&_0x2439d7[_0x59c0('0x1b')]){_0x5564c7='queue';}else if(_0x2439d7[_0x59c0('0x1c')]){_0x5564c7='outbound';}else{console['log'](_0x59c0('0x1d'),_0x2439d7);}}else{_0x5564c7=_0x59c0('0x1e');}switch(_0x12c56a[_0x59c0('0x16')]['toLowerCase']()){case _0x59c0('0xa'):zendesk[_0x5564c7](_0x12c56a,_0x2439d7,_0x846396,_0x29e925,_0x11319e,_0x5dc903,_0x5a5700);break;case _0x59c0('0xb'):salesforce[_0x5564c7](_0x12c56a,_0x2439d7,_0x846396,_0x29e925,_0x11319e,_0x5dc903,_0x5a5700);break;case'sugarcrm':sugarcrm[_0x5564c7](_0x12c56a,_0x2439d7,_0x846396,_0x29e925,_0x11319e,_0x5dc903,_0x5a5700);break;case _0x59c0('0xd'):freshdesk[_0x5564c7](_0x12c56a,_0x2439d7,_0x846396,_0x29e925,_0x11319e,_0x5dc903,_0x5a5700);break;case _0x59c0('0xe'):zoho[_0x5564c7](_0x12c56a,_0x2439d7,_0x846396,_0x29e925,_0x11319e,_0x5dc903,_0x5a5700);break;case _0x59c0('0xf'):desk[_0x5564c7](_0x12c56a,_0x2439d7,_0x846396,_0x29e925,_0x11319e,_0x5dc903,_0x5a5700);break;case _0x59c0('0x10'):vtiger[_0x5564c7](_0x12c56a,_0x2439d7,_0x846396,_0x29e925,_0x11319e,_0x5dc903,_0x5a5700);break;case'freshsales':freshsales['cs'](_0x12c56a,_0x2439d7,_0x846396,_0x29e925,_0x11319e,_0x5dc903,_0x5a5700,_0x5564c7);break;case _0x59c0('0x13'):servicenow['cs'](_0x12c56a,_0x2439d7,_0x846396,_0x29e925,_0x11319e,_0x5dc903,_0x5a5700,_0x5564c7);break;case _0x59c0('0x11'):dynamics365['cs'](_0x12c56a,_0x2439d7,_0x846396,_0x29e925,_0x11319e,_0x5dc903,_0x5a5700,_0x5564c7);break;default:console[_0x59c0('0x1f')]('unknown\x20integration');}}else{_0x3c7b95=require('../../../../config/logger')(_0x12c56a['data1']['toLowerCase']());_0x3c7b95[_0x59c0('0x20')](_0x59c0('0x21'),util[_0x59c0('0x22')](_0x59c0('0x23'),_0x12c56a[_0x59c0('0x16')]['toLowerCase'](),_0x12c56a[_0x59c0('0x1a')]));}}else{_0x3c7b95=require(_0x59c0('0x24'))(_0x12c56a['data1'][_0x59c0('0x15')]());_0x3c7b95[_0x59c0('0x20')](_0x59c0('0x21'),util['format'](_0x59c0('0x25'),_0x12c56a['data1']['toLowerCase'](),_0x12c56a[_0x59c0('0x17')]));}}else{}}catch(_0x510cdb){console[_0x59c0('0x20')](_0x510cdb);}}}}; \ No newline at end of file +var _0x8a62=['./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','zoho','desk','vtiger','freshsales','exec','data1','toLowerCase','data2','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','freshdesk','servicenow','log','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','./zendesk','./salesforce','./sugarcrm','./freshdesk','./desk','./vtiger','./servicenow'];(function(_0x33696f,_0x174357){var _0x3497d3=function(_0xd8914d){while(--_0xd8914d){_0x33696f['push'](_0x33696f['shift']());}};_0x3497d3(++_0x174357);}(_0x8a62,0x18f));var _0x28a6=function(_0xbcd041,_0x2e8922){_0xbcd041=_0xbcd041-0x0;var _0x2ad66a=_0x8a62[_0xbcd041];return _0x2ad66a;};'use strict';var _=require(_0x28a6('0x0'));var util=require('util');var zendesk=require(_0x28a6('0x1'));var salesforce=require(_0x28a6('0x2'));var sugarcrm=require(_0x28a6('0x3'));var freshdesk=require(_0x28a6('0x4'));var zoho=require('./zoho');var desk=require(_0x28a6('0x5'));var vtiger=require(_0x28a6('0x6'));var servicenow=require(_0x28a6('0x7'));var dynamics365=require(_0x28a6('0x8'));var freshsales=require(_0x28a6('0x9'));var integrations=[_0x28a6('0xa'),_0x28a6('0xb'),_0x28a6('0xc'),'freshdesk',_0x28a6('0xd'),_0x28a6('0xe'),_0x28a6('0xf'),'dynamics365',_0x28a6('0x10'),'servicenow'];exports[_0x28a6('0x11')]=function(_0x3a61c4,_0x5bacae,_0x47fc1f,_0x273ebe,_0x514282,_0x265f7b){if(_0x47fc1f){if(_['includes'](integrations,_0x3a61c4[_0x28a6('0x12')][_0x28a6('0x13')]())){try{var _0x526ece=null;var _0xc6e917='';var _0x37a50a=_0x47fc1f[_0x3a61c4[_0x28a6('0x12')][_0x28a6('0x13')]()];if(_0x37a50a){var _0x5a63c7=_0x37a50a[_0x3a61c4[_0x28a6('0x14')]];if(_0x5a63c7){var _0x2d40fe=_['find'](_0x5a63c7['Configurations'],{'id':parseInt(_0x3a61c4[_0x28a6('0x15')],0xa)});if(_0x2d40fe){if(_0x273ebe){if(_0x514282&&_0x5bacae[_0x28a6('0x16')]){_0xc6e917=_0x28a6('0x16');}else if(_0x5bacae[_0x28a6('0x17')]){_0xc6e917=_0x28a6('0x18');}else{console['log'](_0x28a6('0x19'),_0x5bacae);}}else{_0xc6e917=_0x28a6('0x1a');}switch(_0x3a61c4[_0x28a6('0x12')][_0x28a6('0x13')]()){case'zendesk':zendesk[_0xc6e917](_0x3a61c4,_0x5bacae,_0x2d40fe,_0x273ebe,_0x514282,_0x5a63c7,_0x265f7b);break;case'salesforce':salesforce[_0xc6e917](_0x3a61c4,_0x5bacae,_0x2d40fe,_0x273ebe,_0x514282,_0x5a63c7,_0x265f7b);break;case'sugarcrm':sugarcrm[_0xc6e917](_0x3a61c4,_0x5bacae,_0x2d40fe,_0x273ebe,_0x514282,_0x5a63c7,_0x265f7b);break;case _0x28a6('0x1b'):freshdesk[_0xc6e917](_0x3a61c4,_0x5bacae,_0x2d40fe,_0x273ebe,_0x514282,_0x5a63c7,_0x265f7b);break;case _0x28a6('0xd'):zoho[_0xc6e917](_0x3a61c4,_0x5bacae,_0x2d40fe,_0x273ebe,_0x514282,_0x5a63c7,_0x265f7b);break;case'desk':desk[_0xc6e917](_0x3a61c4,_0x5bacae,_0x2d40fe,_0x273ebe,_0x514282,_0x5a63c7,_0x265f7b);break;case _0x28a6('0xf'):vtiger[_0xc6e917](_0x3a61c4,_0x5bacae,_0x2d40fe,_0x273ebe,_0x514282,_0x5a63c7,_0x265f7b);break;case _0x28a6('0x10'):freshsales['cs'](_0x3a61c4,_0x5bacae,_0x2d40fe,_0x273ebe,_0x514282,_0x5a63c7,_0x265f7b,_0xc6e917);break;case _0x28a6('0x1c'):servicenow['cs'](_0x3a61c4,_0x5bacae,_0x2d40fe,_0x273ebe,_0x514282,_0x5a63c7,_0x265f7b,_0xc6e917);break;case'dynamics365':dynamics365['cs'](_0x3a61c4,_0x5bacae,_0x2d40fe,_0x273ebe,_0x514282,_0x5a63c7,_0x265f7b,_0xc6e917);break;default:console[_0x28a6('0x1d')](_0x28a6('0x1e'));}}else{_0x526ece=require(_0x28a6('0x1f'))(_0x3a61c4['data1'][_0x28a6('0x13')]());_0x526ece[_0x28a6('0x20')](_0x28a6('0x21'),util[_0x28a6('0x22')](_0x28a6('0x23'),_0x3a61c4['data1']['toLowerCase'](),_0x3a61c4[_0x28a6('0x15')]));}}else{_0x526ece=require(_0x28a6('0x1f'))(_0x3a61c4[_0x28a6('0x12')]['toLowerCase']());_0x526ece[_0x28a6('0x20')]('[EXEC]',util[_0x28a6('0x22')](_0x28a6('0x24'),_0x3a61c4['data1'][_0x28a6('0x13')](),_0x3a61c4[_0x28a6('0x14')]));}}else{}}catch(_0x48f976){console[_0x28a6('0x20')](_0x48f976);}}}}; \ 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 1d0bd6e..9041bcf 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 _0xb0fb=['attributes','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','contact','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','Caller\x20-\x20%s','LastName','format','Company','No\x20Company','forEach','includes','string','type','idField','content','toString','variable','variableName','customVariable','name','Variable','password','securityToken','remoteUri','https://login.salesforce.com','clientId','login','Connection\x20established.','queue','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','destcalleridname','outbound','integrationTab','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','md5','../../../../config/logger','redis','defaults','socket.io-emitter','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsRecurrence','lead','WhoId','endUserType','WhatId','Case','account','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','execute','find','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','length','additionalSearchLead','account_contact_lead','additionalSearchAccount','Account','Lead','Contact','first','Phone'];(function(_0x1a376e,_0x284e92){var _0x479f58=function(_0x47707d){while(--_0x47707d){_0x1a376e['push'](_0x1a376e['shift']());}};_0x479f58(++_0x284e92);}(_0xb0fb,0xb8));var _0xbb0f=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0xb0fb[_0x485b5a];return _0xd2b34d;};'use strict';var _=require(_0xbb0f('0x0'));var rp=require(_0xbb0f('0x1'));var moment=require('moment');var BPromise=require(_0xbb0f('0x2'));var md5=require(_0xbb0f('0x3'));var jsforce=require('jsforce');var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xbb0f('0x4'))('salesforce');config[_0xbb0f('0x5')]=_[_0xbb0f('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xbb0f('0x7'))(new Redis(config[_0xbb0f('0x5')]));function emit(_0x591e1f,_0x4beafd,_0x1698f1){io['to'](_0x591e1f)['emit'](_0x4beafd,_0x1698f1);}function getTicket(_0x575b6f,_0x39ba35,_0x4cc55f,_0x38c567,_0x227e64,_0x21c4dc,_0x365a38,_0x5c58f1){var _0x11dfda=Object[_0xbb0f('0x8')]({},{'OwnerId':_0x39ba35['id'],'Subject':intUtil[_0xbb0f('0x9')](_0x38c567[_0xbb0f('0xa')],_0x227e64,'\x20'),'Description':intUtil[_0xbb0f('0x9')](_0x38c567[_0xbb0f('0xb')],_0x227e64,'\x0a')},getCustomFields(_0x21c4dc,_0x227e64));if(_0x4cc55f){if(_0x38c567[_0xbb0f('0xc')]===_0xbb0f('0xd')){_0x11dfda[_0xbb0f('0xe')]=moment[_0xbb0f('0xf')]();_0x11dfda['IsReminderSet']=![];_0x11dfda[_0xbb0f('0x10')]=![];if(_0x4cc55f['endUserType']==='contact'||_0x4cc55f['endUserType']===_0xbb0f('0x11')){_0x11dfda[_0xbb0f('0x12')]=_0x4cc55f['id'];}else if(_0x4cc55f[_0xbb0f('0x13')]==='account'){_0x11dfda[_0xbb0f('0x14')]=_0x4cc55f['id'];}}else if(_0x38c567[_0xbb0f('0xc')]===_0xbb0f('0x15')){if(_0x4cc55f[_0xbb0f('0x13')]==='contact'){_0x11dfda['ContactId']=_0x4cc55f['id'];}else if(_0x4cc55f[_0xbb0f('0x13')]===_0xbb0f('0x16')){_0x11dfda[_0xbb0f('0x17')]=_0x4cc55f['id'];}else if(_0x4cc55f[_0xbb0f('0x13')]==='lead'&&_0x38c567['leadId']){_0x11dfda[_0x38c567[_0xbb0f('0x18')]]=_0x4cc55f['id'];}else{logger[_0xbb0f('0x19')](_0xbb0f('0x1a'));}}}return _0x365a38[_0xbb0f('0x1b')](_0x38c567[_0xbb0f('0xc')])['create'](_0x11dfda);}function getUser(_0x30fbcd,_0x3bbae9,_0x156c4a){if(!_[_0xbb0f('0x1c')](_0x3bbae9)&&intUtil[_0xbb0f('0x1d')](_0x3bbae9)){var _0x16e260={'Email':_0x3bbae9};var _0x361dbb={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x156c4a['sobject']('User')['find'](_0x16e260,_0x361dbb)[_0xbb0f('0x1e')]()['then'](function(_0x5b47c5){if(_0x5b47c5['length']){var _0x3431b5=_[_0xbb0f('0x1f')](_0x5b47c5,function(_0x5b1764){return _0x5b1764['Email']===_0x3bbae9;});if(_0x3431b5){logger['info'](_0xbb0f('0x20'),_0x3bbae9);return BPromise[_0xbb0f('0x21')]({'id':_0x3431b5['Id'],'name':_0x3431b5[_0xbb0f('0x22')]});}}else{logger[_0xbb0f('0x19')](_0xbb0f('0x23'),_0x3bbae9);return _0x156c4a[_0xbb0f('0x24')]()[_0xbb0f('0x25')](function(_0x4634f3){return BPromise[_0xbb0f('0x21')]({'id':_0x4634f3[_0xbb0f('0x26')],'name':_0x4634f3[_0xbb0f('0x27')]});});}});}else{logger['info'](_0xbb0f('0x23'),_0x3bbae9);return _0x156c4a[_0xbb0f('0x24')]()[_0xbb0f('0x25')](function(_0x287de5){return BPromise['resolve']({'id':_0x287de5['user_id'],'name':_0x287de5[_0xbb0f('0x27')]});});}}function getEndUser(_0x26f6b7,_0x350a4d,_0x1b9f3e,_0x3cad20,_0x2aed6e){var _0x401bb5={'$or':{'Phone':_0x3cad20}};var _0x186910={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xbb0f('0x21')]()[_0xbb0f('0x25')](function(){logger['info'](_0xbb0f('0x28'),_0x3cad20,_0x350a4d[_0xbb0f('0x29')]);switch(_0x350a4d[_0xbb0f('0x29')]){case _0xbb0f('0x2a'):var _0x260002=_[_0xbb0f('0x2b')](_0x401bb5);if(_0x350a4d[_0xbb0f('0x2c')]){var _0x2f79f1={};_0x2f79f1[_0x350a4d[_0xbb0f('0x2c')]]=_0x3cad20;_[_0xbb0f('0x2d')](_0x260002[_0xbb0f('0x2e')],_0x2f79f1);}return _0x2aed6e['sobject']('Contact')[_0xbb0f('0x1f')](_0x260002,_0x186910)[_0xbb0f('0x1e')]()[_0xbb0f('0x25')](function(_0x583761){if(_0x583761&&_0x583761[_0xbb0f('0x2f')]){return _0x583761;}else{var _0x1c48e7=_['cloneDeep'](_0x401bb5);if(_0x350a4d[_0xbb0f('0x30')]){var _0x570f6d={};_0x570f6d[_0x350a4d['additionalSearchLead']]=_0x3cad20;_[_0xbb0f('0x2d')](_0x1c48e7['$or'],_0x570f6d);}return _0x2aed6e[_0xbb0f('0x1b')]('Lead')[_0xbb0f('0x1f')](_0x1c48e7,_0x186910);}});case _0xbb0f('0x31'):var _0x45257f=_['cloneDeep'](_0x401bb5);if(_0x350a4d[_0xbb0f('0x32')]){var _0x2f79f1={};_0x2f79f1[_0x350a4d['additionalSearchAccount']]=_0x3cad20;_[_0xbb0f('0x2d')](_0x45257f['$or'],_0x2f79f1);}return _0x2aed6e[_0xbb0f('0x1b')](_0xbb0f('0x33'))['find'](_0x45257f,_0x186910)[_0xbb0f('0x1e')]()['then'](function(_0x270dac){if(_0x270dac&&_0x270dac['length']){return _0x270dac;}else{var _0x4052bf=_[_0xbb0f('0x2b')](_0x401bb5);if(_0x350a4d[_0xbb0f('0x2c')]){var _0x4aafa2={};_0x4aafa2[_0x350a4d[_0xbb0f('0x2c')]]=_0x3cad20;_[_0xbb0f('0x2d')](_0x4052bf[_0xbb0f('0x2e')],_0x4aafa2);}return _0x2aed6e[_0xbb0f('0x1b')]('Contact')[_0xbb0f('0x1f')](_0x4052bf,_0x186910)[_0xbb0f('0x25')](function(_0x6825d2){if(_0x6825d2&&_0x6825d2[_0xbb0f('0x2f')]){return _0x6825d2;}else{var _0x399c85=_['cloneDeep'](_0x401bb5);if(_0x350a4d[_0xbb0f('0x30')]){var _0x363204={};_0x363204[_0x350a4d[_0xbb0f('0x30')]]=_0x3cad20;_[_0xbb0f('0x2d')](_0x399c85[_0xbb0f('0x2e')],_0x363204);}return _0x2aed6e[_0xbb0f('0x1b')](_0xbb0f('0x34'))[_0xbb0f('0x1f')](_0x399c85,_0x186910);}});}});case'contact':var _0x260002=_['cloneDeep'](_0x401bb5);if(_0x350a4d[_0xbb0f('0x2c')]){var _0x2f79f1={};_0x2f79f1[_0x350a4d[_0xbb0f('0x2c')]]=_0x3cad20;_[_0xbb0f('0x2d')](_0x260002[_0xbb0f('0x2e')],_0x2f79f1);}return _0x2aed6e[_0xbb0f('0x1b')](_0xbb0f('0x35'))[_0xbb0f('0x1f')](_0x260002,_0x186910)[_0xbb0f('0x1e')]();case _0xbb0f('0x11'):var _0x5cddb5=_['cloneDeep'](_0x401bb5);if(_0x350a4d[_0xbb0f('0x30')]){var _0x2f79f1={};_0x2f79f1[_0x350a4d[_0xbb0f('0x30')]]=_0x3cad20;_[_0xbb0f('0x2d')](_0x5cddb5['$or'],_0x2f79f1);}return _0x2aed6e[_0xbb0f('0x1b')](_0xbb0f('0x34'))[_0xbb0f('0x1f')](_0x5cddb5,_0x186910);case _0xbb0f('0x16'):var _0x45257f=_[_0xbb0f('0x2b')](_0x401bb5);if(_0x350a4d[_0xbb0f('0x32')]){var _0x2f79f1={};_0x2f79f1[_0x350a4d[_0xbb0f('0x32')]]=_0x3cad20;_[_0xbb0f('0x2d')](_0x45257f[_0xbb0f('0x2e')],_0x2f79f1);}return _0x2aed6e[_0xbb0f('0x1b')](_0xbb0f('0x33'))[_0xbb0f('0x1f')](_0x45257f,_0x186910);default:return null;}})[_0xbb0f('0x25')](function(_0xb9d44b){if(_0xb9d44b&&_0xb9d44b[_0xbb0f('0x2f')]){var _0x14a8dd=_[_0xbb0f('0x36')](_0xb9d44b);if(_0x14a8dd){return BPromise[_0xbb0f('0x21')]({'id':_0x14a8dd['Id'],'name':_0x14a8dd[_0xbb0f('0x22')],'phone':_0x14a8dd[_0xbb0f('0x37')],'endUserType':_0x14a8dd[_0xbb0f('0x38')]['type'][_0xbb0f('0x39')]()});}}})[_0xbb0f('0x25')](function(_0x351698){if(_0x351698){logger[_0xbb0f('0x19')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x351698[_0xbb0f('0x13')],_0x3cad20);return BPromise['resolve'](_0x351698);}else{logger[_0xbb0f('0x19')](_0xbb0f('0x3a'),_0x3cad20);var _0x167e6f={'Phone':_0x3cad20};if(_0x350a4d[_0xbb0f('0x3b')]){if(_0x350a4d['moduleCreate']===_0xbb0f('0x3c')){logger['info'](_0xbb0f('0x3d'),_0x3cad20,_0x350a4d['moduleCreate']);_0x167e6f['LastName']=_0x1b9f3e!==_0xbb0f('0x3e')?_0x1b9f3e:util['format'](_0xbb0f('0x3f'),_0x3cad20);}else if(_0x350a4d[_0xbb0f('0x3b')]===_0xbb0f('0x11')){logger[_0xbb0f('0x19')](_0xbb0f('0x3d'),_0x3cad20,_0x350a4d[_0xbb0f('0x3b')]);_0x167e6f[_0xbb0f('0x40')]=_0x1b9f3e!==_0xbb0f('0x3e')?_0x1b9f3e:util[_0xbb0f('0x41')](_0xbb0f('0x3f'),_0x3cad20);_0x167e6f[_0xbb0f('0x42')]=_0xbb0f('0x43');}else if(_0x350a4d['moduleCreate']==='account'){logger[_0xbb0f('0x19')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x3cad20,_0x350a4d['moduleCreate']);_0x167e6f[_0xbb0f('0x22')]=_0x1b9f3e!==_0xbb0f('0x3e')?_0x1b9f3e:util[_0xbb0f('0x41')](_0xbb0f('0x3f'),_0x3cad20);}else{return null;}}return _0x2aed6e[_0xbb0f('0x1b')](_['upperFirst'](_0x350a4d[_0xbb0f('0x3b')]))['create'](_0x167e6f)['then'](function(_0x54b5e9){return BPromise['resolve']({'id':_0x54b5e9['id'],'endUserType':_0x350a4d[_0xbb0f('0x3b')]});});}});}function getCustomFields(_0xe3fd7f,_0x406e39){var _0x1fa10c={};if(_0xe3fd7f[_0xbb0f('0x2f')]>0x0){_[_0xbb0f('0x44')](_0xe3fd7f,function(_0x4194f8){if(_[_0xbb0f('0x45')]([_0xbb0f('0x46'),'picklist'],_0x4194f8[_0xbb0f('0x47')])&&_0x4194f8[_0xbb0f('0x48')]){_0x1fa10c[_0x4194f8[_0xbb0f('0x48')]]=_0x4194f8[_0xbb0f('0x49')][_0xbb0f('0x4a')]();}else if(_0x4194f8[_0xbb0f('0x47')]===_0xbb0f('0x4b')&&_0x4194f8[_0xbb0f('0x4c')]&&_0x4194f8['idField']){_0x406e39[_0x4194f8[_0xbb0f('0x4c')]]&&(_0x1fa10c[_0x4194f8[_0xbb0f('0x48')]]=_0x406e39[_0x4194f8[_0xbb0f('0x4c')]][_0xbb0f('0x4a')]());}else if(_0x4194f8[_0xbb0f('0x47')]===_0xbb0f('0x4d')&&_0x4194f8['Variable']&&_0x4194f8['Variable']['name']&&_0x4194f8[_0xbb0f('0x48')]){_0x406e39[_0x4194f8['Variable'][_0xbb0f('0x4e')][_0xbb0f('0x39')]()]&&(_0x1fa10c[_0x4194f8[_0xbb0f('0x48')]]=_0x406e39[_0x4194f8[_0xbb0f('0x4f')]['name'][_0xbb0f('0x39')]()]['toString']());}});}return _0x1fa10c;}function getConnection(_0x1fb321){var _0x38699e=_0x1fb321[_0xbb0f('0x50')]['concat'](_0x1fb321[_0xbb0f('0x51')]);var _0x384494=new jsforce['Connection']({'oauth2':{'loginUrl':_0x1fb321[_0xbb0f('0x52')]||_0xbb0f('0x53'),'clientId':_0x1fb321[_0xbb0f('0x54')],'clientSecret':_0x1fb321['clientSecret']}});return _0x384494[_0xbb0f('0x55')](_0x1fb321['username'],_0x38699e)[_0xbb0f('0x25')](function(){logger['info'](_0xbb0f('0x56'));return _0x384494;});}exports[_0xbb0f('0x57')]=function(_0x40537c,_0x44c9e3,_0x4f074c,_0x2c94d5,_0x1296bc,_0x2697fd){var _0x3a670e,_0x50c9f6,_0x55bb09,_0x10cbea;_0x2697fd[_0xbb0f('0x58')]=intUtil['stripTrailingSlash'](_0x2697fd['serverUrl']);_0x2697fd[_0xbb0f('0x52')]=intUtil['stripTrailingSlash'](_0x2697fd[_0xbb0f('0x52')]);if(_0x1296bc&&_0x1296bc[_0xbb0f('0x59')]){logger[_0xbb0f('0x19')](_0xbb0f('0x5a'),_0xbb0f('0x5b'));_0x44c9e3[_0xbb0f('0x5c')]=util['format'](_0xbb0f('0x5d'),_0x2697fd[_0xbb0f('0x58')],_0x44c9e3[_0xbb0f('0x5e')],md5(_0x44c9e3[_0xbb0f('0x5e')]));}else{_0x44c9e3[_0xbb0f('0x5c')]='';}return getConnection(_0x2697fd)[_0xbb0f('0x25')](function(_0x5def8f){_0x10cbea=_0x5def8f;return getUser(_0x2697fd,_0x2c94d5[_0xbb0f('0x5f')],_0x10cbea);})[_0xbb0f('0x25')](function(_0x1bdd55){_0x3a670e=_0x1bdd55;return getEndUser(_0x2697fd,_0x4f074c,_0x44c9e3[_0xbb0f('0x60')],_0x44c9e3[_0xbb0f('0x61')],_0x10cbea);})[_0xbb0f('0x25')](function(_0x89dc35){_0x50c9f6=_0x89dc35;return getTicket(_0x2697fd,_0x3a670e,_0x50c9f6,_0x4f074c,_0x44c9e3,_0x4f074c[_0xbb0f('0x62')],_0x10cbea,_0xbb0f('0x57'));})[_0xbb0f('0x25')](function(_0x2d0a49){_0x55bb09=_0x2d0a49;logger[_0xbb0f('0x19')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x55bb09['id']);logger[_0xbb0f('0x19')](_0xbb0f('0x63'),_0x55bb09['id'],_0x2c94d5[_0xbb0f('0x4e')],_0x2697fd['type']);switch(_0x2697fd['type']){case'integrationTab':emit(util[_0xbb0f('0x41')](_0xbb0f('0x64'),_0x2c94d5['name']),_0xbb0f('0x65'),{'recordId':_0x55bb09['id']});break;case _0xbb0f('0x66'):emit(util[_0xbb0f('0x41')](_0xbb0f('0x64'),_0x2c94d5[_0xbb0f('0x4e')]),_0xbb0f('0x67'),{'uri':util['format'](_0xbb0f('0x68'),_0x10cbea[_0xbb0f('0x69')],_0x55bb09['id'])});break;default:logger[_0xbb0f('0x6a')](_0xbb0f('0x6b'));}})[_0xbb0f('0x6c')](function(_0x2d9a4c){logger[_0xbb0f('0x6a')](_0xbb0f('0x5a'),_0x2d9a4c);});};exports['outbound']=function(_0x5c6901,_0x5d3ecd,_0x1ee51b,_0x186565,_0x17e8b6,_0x270c9e,_0x18c368){var _0x1ca2bd,_0x57e749,_0x2ae072,_0x372ff1;_0x270c9e[_0xbb0f('0x58')]=intUtil[_0xbb0f('0x6d')](_0x270c9e[_0xbb0f('0x58')]);_0x270c9e[_0xbb0f('0x52')]=intUtil[_0xbb0f('0x6d')](_0x270c9e['remoteUri']);if(_0x18c368&&_0x18c368[_0xbb0f('0x6e')]&&_0x18c368[_0xbb0f('0x6e')]!==_0xbb0f('0x6f')){logger['info'](_0xbb0f('0x70'),_0xbb0f('0x5b'));_0x5d3ecd[_0xbb0f('0x5c')]=util[_0xbb0f('0x41')](_0xbb0f('0x5d'),_0x270c9e['serverUrl'],_0x5d3ecd[_0xbb0f('0x5e')],md5(_0x5d3ecd[_0xbb0f('0x5e')]));}return getConnection(_0x270c9e)['then'](function(_0x38b473){_0x372ff1=_0x38b473;return getUser(_0x270c9e,_0x186565['email'],_0x372ff1);})[_0xbb0f('0x25')](function(_0x403ed8){_0x1ca2bd=_0x403ed8;return getEndUser(_0x270c9e,_0x1ee51b,_0x5d3ecd[_0xbb0f('0x71')],_0x5d3ecd['destcalleridnum'],_0x372ff1);})[_0xbb0f('0x25')](function(_0x1ce5da){_0x57e749=_0x1ce5da;return getTicket(_0x270c9e,_0x1ca2bd,_0x57e749,_0x1ee51b,_0x5d3ecd,_0x1ee51b[_0xbb0f('0x62')],_0x372ff1,_0xbb0f('0x72'));})[_0xbb0f('0x25')](function(_0x55bec0){_0x2ae072=_0x55bec0;logger['info']('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x2ae072['id']);logger['info']('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x2ae072['id'],_0x186565[_0xbb0f('0x4e')],_0x270c9e['type']);switch(_0x270c9e[_0xbb0f('0x47')]){case _0xbb0f('0x73'):emit(util[_0xbb0f('0x41')](_0xbb0f('0x64'),_0x186565[_0xbb0f('0x4e')]),_0xbb0f('0x65'),{'recordId':_0x2ae072['id']});break;case _0xbb0f('0x66'):emit(util[_0xbb0f('0x41')](_0xbb0f('0x64'),_0x186565[_0xbb0f('0x4e')]),_0xbb0f('0x67'),{'uri':util[_0xbb0f('0x41')]('%s/%s/e',_0x372ff1[_0xbb0f('0x69')],_0x2ae072['id'])});break;default:logger[_0xbb0f('0x6a')](_0xbb0f('0x70'),_0xbb0f('0x74'));}})['catch'](function(_0x431a50){logger[_0xbb0f('0x6a')](_0xbb0f('0x70'),_0x431a50);});};exports['unmanaged']=function(_0x1008a8,_0x2f77fc,_0x5e7eb8,_0x2afd45,_0x1a9bad,_0x19db11){var _0xffd0ab,_0x39d0d5,_0x1f7769,_0xdd3ed1;_0x19db11[_0xbb0f('0x58')]=intUtil[_0xbb0f('0x6d')](_0x19db11[_0xbb0f('0x58')]);_0x19db11[_0xbb0f('0x52')]=intUtil[_0xbb0f('0x6d')](_0x19db11['remoteUri']);if(_0x1a9bad&&_0x1a9bad[_0xbb0f('0x59')]){logger[_0xbb0f('0x19')]('['+_0x2f77fc['lastevent']['toUpperCase']()+']',_0xbb0f('0x5b'));_0x2f77fc['recordingURL']=util['format'](_0xbb0f('0x5d'),_0x19db11[_0xbb0f('0x58')],_0x2f77fc[_0xbb0f('0x5e')],md5(_0x2f77fc[_0xbb0f('0x5e')]));}else{_0x2f77fc[_0xbb0f('0x5c')]='';}return getConnection(_0x19db11)[_0xbb0f('0x25')](function(_0x8b3d43){_0xdd3ed1=_0x8b3d43;if(!_[_0xbb0f('0x1c')](_0x2afd45)){return getUser(_0x19db11,_0x2afd45[_0xbb0f('0x4e')],_0xdd3ed1);}else{return getUser(_0x19db11,null,_0xdd3ed1);}})[_0xbb0f('0x25')](function(_0x8860fd){_0xffd0ab=_0x8860fd;return getEndUser(_0x19db11,_0x5e7eb8,_0x2f77fc[_0xbb0f('0x60')],_0x2f77fc[_0xbb0f('0x61')],_0xdd3ed1);})[_0xbb0f('0x25')](function(_0x2f7e5d){_0x39d0d5=_0x2f7e5d;return getTicket(_0x19db11,_0xffd0ab,_0x39d0d5,_0x5e7eb8,_0x2f77fc,_0x5e7eb8[_0xbb0f('0x62')],_0xdd3ed1);})['then'](function(_0x47cd98){_0x1f7769=_0x47cd98;logger[_0xbb0f('0x19')]('['+_0x2f77fc[_0xbb0f('0x75')][_0xbb0f('0x76')]()+']\x20Ticket\x20%s\x20created.',_0x1f7769['id']);logger[_0xbb0f('0x19')]('['+_0x2f77fc[_0xbb0f('0x75')]['toUpperCase']()+_0xbb0f('0x77'),_0x19db11[_0xbb0f('0x47')]);})[_0xbb0f('0x6c')](function(_0x1360d5){logger[_0xbb0f('0x6a')]('['+_0x2f77fc[_0xbb0f('0x75')][_0xbb0f('0x76')]()+']',_0x1360d5);});}; \ No newline at end of file +var _0x0286=['additionalSearchLead','$or','additionalSearchAccount','Account','Lead','first','Phone','attributes','type','toLowerCase','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','forEach','includes','picklist','idField','content','variable','variableName','toString','customVariable','Variable','name','concat','securityToken','Connection','https://login.salesforce.com','clientId','clientSecret','login','username','queue','stripTrailingSlash','serverUrl','remoteUri','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.','lodash','request-promise','moment','bluebird','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','getString','Subjects','Descriptions','Task','ActivityDate','IsRecurrence','contact','WhoId','endUserType','account','WhatId','ticketType','Case','ContactId','AccountId','lead','leadId','sobject','create','isNil','validateEmail','find','execute','then','Email','info','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','additionalSearchContact','merge','Contact','length','cloneDeep'];(function(_0xcf61c2,_0x3fdde6){var _0x4e236f=function(_0x574801){while(--_0x574801){_0xcf61c2['push'](_0xcf61c2['shift']());}};_0x4e236f(++_0x3fdde6);}(_0x0286,0xcb));var _0x6028=function(_0x58bebd,_0x3b8a61){_0x58bebd=_0x58bebd-0x0;var _0xae4fc0=_0x0286[_0x58bebd];return _0xae4fc0;};'use strict';var _=require(_0x6028('0x0'));var rp=require(_0x6028('0x1'));var moment=require(_0x6028('0x2'));var BPromise=require(_0x6028('0x3'));var md5=require('md5');var jsforce=require(_0x6028('0x4'));var util=require(_0x6028('0x5'));var Redis=require(_0x6028('0x6'));var intUtil=require(_0x6028('0x7'));var config=require(_0x6028('0x8'));var logger=require(_0x6028('0x9'))('salesforce');config[_0x6028('0xa')]=_[_0x6028('0xb')](config[_0x6028('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6028('0xa')]));function emit(_0x10bcfc,_0x4fced3,_0xbed64e){io['to'](_0x10bcfc)['emit'](_0x4fced3,_0xbed64e);}function getTicket(_0x2386cd,_0x1a2057,_0x2f09a7,_0x56dc1b,_0x5db965,_0xc09c21,_0x4b864a,_0x245a24){var _0x405506=Object['assign']({},{'OwnerId':_0x1a2057['id'],'Subject':intUtil[_0x6028('0xc')](_0x56dc1b[_0x6028('0xd')],_0x5db965,'\x20'),'Description':intUtil[_0x6028('0xc')](_0x56dc1b[_0x6028('0xe')],_0x5db965,'\x0a')},getCustomFields(_0xc09c21,_0x5db965));if(_0x2f09a7){if(_0x56dc1b['ticketType']===_0x6028('0xf')){_0x405506[_0x6028('0x10')]=moment['utc']();_0x405506['IsReminderSet']=![];_0x405506[_0x6028('0x11')]=![];if(_0x2f09a7['endUserType']===_0x6028('0x12')||_0x2f09a7['endUserType']==='lead'){_0x405506[_0x6028('0x13')]=_0x2f09a7['id'];}else if(_0x2f09a7[_0x6028('0x14')]===_0x6028('0x15')){_0x405506[_0x6028('0x16')]=_0x2f09a7['id'];}}else if(_0x56dc1b[_0x6028('0x17')]===_0x6028('0x18')){if(_0x2f09a7[_0x6028('0x14')]===_0x6028('0x12')){_0x405506[_0x6028('0x19')]=_0x2f09a7['id'];}else if(_0x2f09a7[_0x6028('0x14')]===_0x6028('0x15')){_0x405506[_0x6028('0x1a')]=_0x2f09a7['id'];}else if(_0x2f09a7[_0x6028('0x14')]===_0x6028('0x1b')&&_0x56dc1b[_0x6028('0x1c')]){_0x405506[_0x56dc1b[_0x6028('0x1c')]]=_0x2f09a7['id'];}else{logger['info']('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x4b864a[_0x6028('0x1d')](_0x56dc1b[_0x6028('0x17')])[_0x6028('0x1e')](_0x405506);}function getUser(_0x56fc16,_0x51f240,_0x1d0014){if(!_[_0x6028('0x1f')](_0x51f240)&&intUtil[_0x6028('0x20')](_0x51f240)){var _0x5b45f4={'Email':_0x51f240};var _0x5edade={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1d0014[_0x6028('0x1d')]('User')[_0x6028('0x21')](_0x5b45f4,_0x5edade)[_0x6028('0x22')]()[_0x6028('0x23')](function(_0xcd4385){if(_0xcd4385['length']){var _0x7855e4=_[_0x6028('0x21')](_0xcd4385,function(_0x1f1387){return _0x1f1387[_0x6028('0x24')]===_0x51f240;});if(_0x7855e4){logger[_0x6028('0x25')](_0x6028('0x26'),_0x51f240);return BPromise[_0x6028('0x27')]({'id':_0x7855e4['Id'],'name':_0x7855e4[_0x6028('0x28')]});}}else{logger[_0x6028('0x25')](_0x6028('0x29'),_0x51f240);return _0x1d0014[_0x6028('0x2a')]()['then'](function(_0x12d1f1){return BPromise[_0x6028('0x27')]({'id':_0x12d1f1[_0x6028('0x2b')],'name':_0x12d1f1[_0x6028('0x2c')]});});}});}else{logger[_0x6028('0x25')](_0x6028('0x29'),_0x51f240);return _0x1d0014['identity']()[_0x6028('0x23')](function(_0x176308){return BPromise[_0x6028('0x27')]({'id':_0x176308[_0x6028('0x2b')],'name':_0x176308[_0x6028('0x2c')]});});}}function getEndUser(_0x21903c,_0xcd08c9,_0x4bb356,_0x4b07b5,_0x3e6028){var _0x48abc2={'$or':{'Phone':_0x4b07b5}};var _0x350ca5={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x6028('0x27')]()[_0x6028('0x23')](function(){logger[_0x6028('0x25')](_0x6028('0x2d'),_0x4b07b5,_0xcd08c9[_0x6028('0x2e')]);switch(_0xcd08c9[_0x6028('0x2e')]){case _0x6028('0x2f'):var _0xb60819=_['cloneDeep'](_0x48abc2);if(_0xcd08c9[_0x6028('0x30')]){var _0x1c0aa8={};_0x1c0aa8[_0xcd08c9['additionalSearchContact']]=_0x4b07b5;_[_0x6028('0x31')](_0xb60819['$or'],_0x1c0aa8);}return _0x3e6028[_0x6028('0x1d')](_0x6028('0x32'))[_0x6028('0x21')](_0xb60819,_0x350ca5)['execute']()[_0x6028('0x23')](function(_0x3cf846){if(_0x3cf846&&_0x3cf846[_0x6028('0x33')]){return _0x3cf846;}else{var _0x374340=_[_0x6028('0x34')](_0x48abc2);if(_0xcd08c9[_0x6028('0x35')]){var _0x2c387f={};_0x2c387f[_0xcd08c9['additionalSearchLead']]=_0x4b07b5;_[_0x6028('0x31')](_0x374340[_0x6028('0x36')],_0x2c387f);}return _0x3e6028[_0x6028('0x1d')]('Lead')['find'](_0x374340,_0x350ca5);}});case'account_contact_lead':var _0x28a980=_[_0x6028('0x34')](_0x48abc2);if(_0xcd08c9[_0x6028('0x37')]){var _0x1c0aa8={};_0x1c0aa8[_0xcd08c9['additionalSearchAccount']]=_0x4b07b5;_[_0x6028('0x31')](_0x28a980[_0x6028('0x36')],_0x1c0aa8);}return _0x3e6028[_0x6028('0x1d')](_0x6028('0x38'))[_0x6028('0x21')](_0x28a980,_0x350ca5)[_0x6028('0x22')]()[_0x6028('0x23')](function(_0x4138e7){if(_0x4138e7&&_0x4138e7[_0x6028('0x33')]){return _0x4138e7;}else{var _0x3bfdd6=_[_0x6028('0x34')](_0x48abc2);if(_0xcd08c9[_0x6028('0x30')]){var _0x25f16a={};_0x25f16a[_0xcd08c9[_0x6028('0x30')]]=_0x4b07b5;_['merge'](_0x3bfdd6[_0x6028('0x36')],_0x25f16a);}return _0x3e6028['sobject'](_0x6028('0x32'))[_0x6028('0x21')](_0x3bfdd6,_0x350ca5)['then'](function(_0x14f058){if(_0x14f058&&_0x14f058[_0x6028('0x33')]){return _0x14f058;}else{var _0x46f7fd=_['cloneDeep'](_0x48abc2);if(_0xcd08c9['additionalSearchLead']){var _0x461093={};_0x461093[_0xcd08c9[_0x6028('0x35')]]=_0x4b07b5;_[_0x6028('0x31')](_0x46f7fd[_0x6028('0x36')],_0x461093);}return _0x3e6028[_0x6028('0x1d')](_0x6028('0x39'))[_0x6028('0x21')](_0x46f7fd,_0x350ca5);}});}});case _0x6028('0x12'):var _0xb60819=_[_0x6028('0x34')](_0x48abc2);if(_0xcd08c9[_0x6028('0x30')]){var _0x1c0aa8={};_0x1c0aa8[_0xcd08c9['additionalSearchContact']]=_0x4b07b5;_[_0x6028('0x31')](_0xb60819[_0x6028('0x36')],_0x1c0aa8);}return _0x3e6028[_0x6028('0x1d')](_0x6028('0x32'))[_0x6028('0x21')](_0xb60819,_0x350ca5)[_0x6028('0x22')]();case _0x6028('0x1b'):var _0x1d7426=_[_0x6028('0x34')](_0x48abc2);if(_0xcd08c9['additionalSearchLead']){var _0x1c0aa8={};_0x1c0aa8[_0xcd08c9[_0x6028('0x35')]]=_0x4b07b5;_[_0x6028('0x31')](_0x1d7426[_0x6028('0x36')],_0x1c0aa8);}return _0x3e6028['sobject'](_0x6028('0x39'))[_0x6028('0x21')](_0x1d7426,_0x350ca5);case _0x6028('0x15'):var _0x28a980=_[_0x6028('0x34')](_0x48abc2);if(_0xcd08c9[_0x6028('0x37')]){var _0x1c0aa8={};_0x1c0aa8[_0xcd08c9[_0x6028('0x37')]]=_0x4b07b5;_[_0x6028('0x31')](_0x28a980[_0x6028('0x36')],_0x1c0aa8);}return _0x3e6028[_0x6028('0x1d')](_0x6028('0x38'))['find'](_0x28a980,_0x350ca5);default:return null;}})[_0x6028('0x23')](function(_0x34b630){if(_0x34b630&&_0x34b630['length']){var _0x31bb17=_[_0x6028('0x3a')](_0x34b630);if(_0x31bb17){return BPromise[_0x6028('0x27')]({'id':_0x31bb17['Id'],'name':_0x31bb17[_0x6028('0x28')],'phone':_0x31bb17[_0x6028('0x3b')],'endUserType':_0x31bb17[_0x6028('0x3c')][_0x6028('0x3d')][_0x6028('0x3e')]()});}}})[_0x6028('0x23')](function(_0x2d27cb){if(_0x2d27cb){logger[_0x6028('0x25')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x2d27cb[_0x6028('0x14')],_0x4b07b5);return BPromise['resolve'](_0x2d27cb);}else{logger[_0x6028('0x25')](_0x6028('0x3f'),_0x4b07b5);var _0x112fd6={'Phone':_0x4b07b5};if(_0xcd08c9[_0x6028('0x40')]){if(_0xcd08c9[_0x6028('0x40')]===_0x6028('0x12')){logger[_0x6028('0x25')](_0x6028('0x41'),_0x4b07b5,_0xcd08c9[_0x6028('0x40')]);_0x112fd6[_0x6028('0x42')]=_0x4bb356!==_0x6028('0x43')?_0x4bb356:util[_0x6028('0x44')](_0x6028('0x45'),_0x4b07b5);}else if(_0xcd08c9[_0x6028('0x40')]===_0x6028('0x1b')){logger[_0x6028('0x25')](_0x6028('0x41'),_0x4b07b5,_0xcd08c9[_0x6028('0x40')]);_0x112fd6[_0x6028('0x42')]=_0x4bb356!==_0x6028('0x43')?_0x4bb356:util[_0x6028('0x44')](_0x6028('0x45'),_0x4b07b5);_0x112fd6[_0x6028('0x46')]=_0x6028('0x47');}else if(_0xcd08c9['moduleCreate']===_0x6028('0x15')){logger['info'](_0x6028('0x41'),_0x4b07b5,_0xcd08c9[_0x6028('0x40')]);_0x112fd6[_0x6028('0x28')]=_0x4bb356!==_0x6028('0x43')?_0x4bb356:util[_0x6028('0x44')]('Caller\x20-\x20%s',_0x4b07b5);}else{return null;}}return _0x3e6028['sobject'](_[_0x6028('0x48')](_0xcd08c9[_0x6028('0x40')]))['create'](_0x112fd6)['then'](function(_0x14f8fa){return BPromise['resolve']({'id':_0x14f8fa['id'],'endUserType':_0xcd08c9[_0x6028('0x40')]});});}});}function getCustomFields(_0x58e19c,_0x505434){var _0x28bf36={};if(_0x58e19c[_0x6028('0x33')]>0x0){_[_0x6028('0x49')](_0x58e19c,function(_0x5b23d1){if(_[_0x6028('0x4a')](['string',_0x6028('0x4b')],_0x5b23d1['type'])&&_0x5b23d1[_0x6028('0x4c')]){_0x28bf36[_0x5b23d1['idField']]=_0x5b23d1[_0x6028('0x4d')]['toString']();}else if(_0x5b23d1['type']===_0x6028('0x4e')&&_0x5b23d1[_0x6028('0x4f')]&&_0x5b23d1[_0x6028('0x4c')]){_0x505434[_0x5b23d1[_0x6028('0x4f')]]&&(_0x28bf36[_0x5b23d1[_0x6028('0x4c')]]=_0x505434[_0x5b23d1['variableName']][_0x6028('0x50')]());}else if(_0x5b23d1[_0x6028('0x3d')]===_0x6028('0x51')&&_0x5b23d1[_0x6028('0x52')]&&_0x5b23d1[_0x6028('0x52')][_0x6028('0x53')]&&_0x5b23d1[_0x6028('0x4c')]){_0x505434[_0x5b23d1[_0x6028('0x52')]['name'][_0x6028('0x3e')]()]&&(_0x28bf36[_0x5b23d1['idField']]=_0x505434[_0x5b23d1['Variable'][_0x6028('0x53')]['toLowerCase']()]['toString']());}});}return _0x28bf36;}function getConnection(_0x407aa4){var _0x40ae58=_0x407aa4['password'][_0x6028('0x54')](_0x407aa4[_0x6028('0x55')]);var _0x5da032=new jsforce[(_0x6028('0x56'))]({'oauth2':{'loginUrl':_0x407aa4['remoteUri']||_0x6028('0x57'),'clientId':_0x407aa4[_0x6028('0x58')],'clientSecret':_0x407aa4[_0x6028('0x59')]}});return _0x5da032[_0x6028('0x5a')](_0x407aa4[_0x6028('0x5b')],_0x40ae58)['then'](function(){logger[_0x6028('0x25')]('Connection\x20established.');return _0x5da032;});}exports[_0x6028('0x5c')]=function(_0x36fa6b,_0x469473,_0x18b859,_0x16b34d,_0xa65a25,_0x13c8b9){var _0x28427b,_0x597c4d,_0x4a4a12,_0x404738;_0x13c8b9['serverUrl']=intUtil[_0x6028('0x5d')](_0x13c8b9[_0x6028('0x5e')]);_0x13c8b9[_0x6028('0x5f')]=intUtil[_0x6028('0x5d')](_0x13c8b9[_0x6028('0x5f')]);if(_0xa65a25&&_0xa65a25['monitor_format']){logger['info'](_0x6028('0x60'),_0x6028('0x61'));_0x469473[_0x6028('0x62')]=util[_0x6028('0x44')](_0x6028('0x63'),_0x13c8b9[_0x6028('0x5e')],_0x469473[_0x6028('0x64')],md5(_0x469473[_0x6028('0x64')]));}else{_0x469473['recordingURL']='';}return getConnection(_0x13c8b9)['then'](function(_0x407c82){_0x404738=_0x407c82;return getUser(_0x13c8b9,_0x16b34d[_0x6028('0x65')],_0x404738);})[_0x6028('0x23')](function(_0x463b62){_0x28427b=_0x463b62;return getEndUser(_0x13c8b9,_0x18b859,_0x469473[_0x6028('0x66')],_0x469473[_0x6028('0x67')],_0x404738);})[_0x6028('0x23')](function(_0x5a51ed){_0x597c4d=_0x5a51ed;return getTicket(_0x13c8b9,_0x28427b,_0x597c4d,_0x18b859,_0x469473,_0x18b859[_0x6028('0x68')],_0x404738,_0x6028('0x5c'));})[_0x6028('0x23')](function(_0x3d5ec7){_0x4a4a12=_0x3d5ec7;logger['info'](_0x6028('0x69'),_0x4a4a12['id']);logger[_0x6028('0x25')](_0x6028('0x6a'),_0x4a4a12['id'],_0x16b34d[_0x6028('0x53')],_0x13c8b9['type']);switch(_0x13c8b9['type']){case _0x6028('0x6b'):emit(util[_0x6028('0x44')](_0x6028('0x6c'),_0x16b34d['name']),_0x6028('0x6d'),{'recordId':_0x4a4a12['id']});break;case _0x6028('0x6e'):emit(util['format'](_0x6028('0x6c'),_0x16b34d['name']),_0x6028('0x6f'),{'uri':util[_0x6028('0x44')](_0x6028('0x70'),_0x404738[_0x6028('0x71')],_0x4a4a12['id'])});break;default:logger[_0x6028('0x72')](_0x6028('0x73'));}})[_0x6028('0x74')](function(_0x358851){logger[_0x6028('0x72')]('[QUEUE]',_0x358851);});};exports[_0x6028('0x75')]=function(_0x4ad769,_0x390a0f,_0x57edd9,_0x37665c,_0x41ab6a,_0x54ad4f,_0x19aa5b){var _0xae67c4,_0x2390c9,_0xcdb7c6,_0xcd1b7f;_0x54ad4f['serverUrl']=intUtil[_0x6028('0x5d')](_0x54ad4f[_0x6028('0x5e')]);_0x54ad4f[_0x6028('0x5f')]=intUtil[_0x6028('0x5d')](_0x54ad4f[_0x6028('0x5f')]);if(_0x19aa5b&&_0x19aa5b[_0x6028('0x76')]&&_0x19aa5b[_0x6028('0x76')]!==_0x6028('0x77')){logger[_0x6028('0x25')](_0x6028('0x78'),_0x6028('0x61'));_0x390a0f['recordingURL']=util[_0x6028('0x44')](_0x6028('0x63'),_0x54ad4f[_0x6028('0x5e')],_0x390a0f[_0x6028('0x64')],md5(_0x390a0f['uniqueid']));}return getConnection(_0x54ad4f)[_0x6028('0x23')](function(_0x7cdd30){_0xcd1b7f=_0x7cdd30;return getUser(_0x54ad4f,_0x37665c['email'],_0xcd1b7f);})[_0x6028('0x23')](function(_0x24390a){_0xae67c4=_0x24390a;return getEndUser(_0x54ad4f,_0x57edd9,_0x390a0f['destcalleridname'],_0x390a0f[_0x6028('0x79')],_0xcd1b7f);})[_0x6028('0x23')](function(_0xe8f998){_0x2390c9=_0xe8f998;return getTicket(_0x54ad4f,_0xae67c4,_0x2390c9,_0x57edd9,_0x390a0f,_0x57edd9[_0x6028('0x68')],_0xcd1b7f,'outbound');})[_0x6028('0x23')](function(_0x514ed3){_0xcdb7c6=_0x514ed3;logger[_0x6028('0x25')](_0x6028('0x7a'),_0xcdb7c6['id']);logger[_0x6028('0x25')](_0x6028('0x7b'),_0xcdb7c6['id'],_0x37665c['name'],_0x54ad4f['type']);switch(_0x54ad4f[_0x6028('0x3d')]){case _0x6028('0x6b'):emit(util['format'](_0x6028('0x6c'),_0x37665c['name']),'trigger:salesforce:display',{'recordId':_0xcdb7c6['id']});break;case _0x6028('0x6e'):emit(util[_0x6028('0x44')]('user:%s',_0x37665c[_0x6028('0x53')]),'trigger:browser:url',{'uri':util['format']('%s/%s/e',_0xcd1b7f['instanceUrl'],_0xcdb7c6['id'])});break;default:logger[_0x6028('0x72')](_0x6028('0x78'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x6028('0x74')](function(_0x479a29){logger[_0x6028('0x72')](_0x6028('0x78'),_0x479a29);});};exports[_0x6028('0x7c')]=function(_0x580791,_0x297f9e,_0x545c74,_0x532ce9,_0x4a6b37,_0x545fdb){var _0x50bee4,_0xc5615b,_0x53a16e,_0x327df3;_0x545fdb['serverUrl']=intUtil[_0x6028('0x5d')](_0x545fdb[_0x6028('0x5e')]);_0x545fdb[_0x6028('0x5f')]=intUtil[_0x6028('0x5d')](_0x545fdb[_0x6028('0x5f')]);if(_0x4a6b37&&_0x4a6b37['monitor_format']){logger[_0x6028('0x25')]('['+_0x297f9e[_0x6028('0x7d')][_0x6028('0x7e')]()+']','Recording\x20is\x20enabled!');_0x297f9e['recordingURL']=util[_0x6028('0x44')](_0x6028('0x63'),_0x545fdb[_0x6028('0x5e')],_0x297f9e[_0x6028('0x64')],md5(_0x297f9e['uniqueid']));}else{_0x297f9e[_0x6028('0x62')]='';}return getConnection(_0x545fdb)[_0x6028('0x23')](function(_0x55b98f){_0x327df3=_0x55b98f;if(!_[_0x6028('0x1f')](_0x532ce9)){return getUser(_0x545fdb,_0x532ce9['name'],_0x327df3);}else{return getUser(_0x545fdb,null,_0x327df3);}})[_0x6028('0x23')](function(_0x2e4932){_0x50bee4=_0x2e4932;return getEndUser(_0x545fdb,_0x545c74,_0x297f9e[_0x6028('0x66')],_0x297f9e[_0x6028('0x67')],_0x327df3);})[_0x6028('0x23')](function(_0x40e205){_0xc5615b=_0x40e205;return getTicket(_0x545fdb,_0x50bee4,_0xc5615b,_0x545c74,_0x297f9e,_0x545c74[_0x6028('0x68')],_0x327df3);})[_0x6028('0x23')](function(_0x3ba9c1){_0x53a16e=_0x3ba9c1;logger[_0x6028('0x25')]('['+_0x297f9e[_0x6028('0x7d')][_0x6028('0x7e')]()+_0x6028('0x7f'),_0x53a16e['id']);logger['info']('['+_0x297f9e[_0x6028('0x7d')]['toUpperCase']()+']\x20Integration\x20account\x20type\x20%s.',_0x545fdb[_0x6028('0x3d')]);})[_0x6028('0x74')](function(_0x55e608){logger[_0x6028('0x72')]('['+_0x297f9e[_0x6028('0x7d')]['toUpperCase']()+']',_0x55e608);});}; \ 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 9f2e072..33ccf15 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 _0x0f90=['label','?sysparm_query=name%3D','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','email','outbound','calleridnum','queue','unmanaged','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','ioredis','./util','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','result','length','adminId','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','],\x20getUser\x20input\x20crm','validateEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','true','userId','adminEmail',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','System','sys_id','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','idField','content','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','endUserId','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x0f90,0xfc));var _0x00f9=function(_0x7966b2,_0xc46ea3){_0x7966b2=_0x7966b2-0x0;var _0x24bec4=_0x0f90[_0x7966b2];return _0x24bec4;};'use strict';var _=require(_0x00f9('0x0'));var Promise=require(_0x00f9('0x1'));var rp=require(_0x00f9('0x2'));var util=require(_0x00f9('0x3'));var md5=require('md5');var Redis=require(_0x00f9('0x4'));var intUtil=require(_0x00f9('0x5'));var config=require('../../../../config/environment');var logger=require(_0x00f9('0x6'))(_0x00f9('0x7'));config[_0x00f9('0x8')]=_[_0x00f9('0x9')](config[_0x00f9('0x8')],{'host':_0x00f9('0xa'),'port':0x18eb});var io=require(_0x00f9('0xb'))(new Redis(config[_0x00f9('0x8')]));function getAdminUser(_0x18b611,_0x469d3d,_0x2d7876,_0x2a10aa,_0x8ab806,_0x505ef0){return new Promise(function(_0x2445f5,_0x2332c5){var _0x364bfd={'method':_0x00f9('0xc'),'uri':_0x2a10aa+_0x00f9('0xd')+'&'+_0x8ab806+'&'+_0x505ef0,'auth':_0x469d3d,'json':!![]};return rp(_0x364bfd)['then'](function(_0x5f1df7){if(_0x5f1df7[_0x00f9('0xe')][_0x00f9('0xf')]>0x0){_0x2d7876[_0x00f9('0x10')]=_0x5f1df7[_0x00f9('0xe')][0x0]['sys_id'];}logger['info']('['+[_0x18b611[_0x00f9('0x11')]()]+_0x00f9('0x12'),_0x2d7876);_0x2445f5(_0x2d7876);})[_0x00f9('0x13')](function(_0xe0c1bd){logger[_0x00f9('0x14')]('['+[_0x18b611[_0x00f9('0x11')]()]+']',_0xe0c1bd[_0x00f9('0x15')]);_0x2332c5(_0xe0c1bd['message']);});});}function getUser(_0x438596,_0x2a7fad,_0x13dd49,_0x6fc85f,_0xdc9aee){return function(_0xc61349){logger[_0x00f9('0x16')]('['+[_0x438596[_0x00f9('0x11')]()]+_0x00f9('0x17'),_0xc61349);return new Promise(function(_0x5b19cb,_0xb5b53){if(intUtil[_0x00f9('0x18')](_0xc61349['userEmail'])){var _0x24e8ce={'method':_0x00f9('0xc'),'uri':_0x13dd49+_0x00f9('0x19')+_0xc61349['userEmail']+'&'+_0x6fc85f+'&'+_0xdc9aee,'auth':_0x2a7fad,'json':!![]};logger[_0x00f9('0x16')]('['+[_0x438596[_0x00f9('0x11')]()]+_0x00f9('0x1a'),_0x24e8ce);return rp(_0x24e8ce)[_0x00f9('0x1b')](function(_0x5c8290){logger['info']('['+[_0x438596['toUpperCase']()]+'],\x20getUser\x20entity',_0x5c8290);if(_0x5c8290[_0x00f9('0xe')]['length']>0x0&&String(_0x5c8290[_0x00f9('0xe')][0x0]['active'])===_0x00f9('0x1c')){_0xc61349[_0x00f9('0x1d')]=_0x5c8290[_0x00f9('0xe')][0x0]['sys_id'];}else{_0xc61349[_0x00f9('0x1d')]=_0xc61349[_0x00f9('0x10')];_0xc61349['userEmail']=_0xc61349[_0x00f9('0x1e')];}logger[_0x00f9('0x16')]('['+[_0x438596[_0x00f9('0x11')]()]+'],\x20getUser\x20crm',_0xc61349);_0x5b19cb(_0xc61349);})[_0x00f9('0x13')](function(_0x3dfe3b){logger[_0x00f9('0x14')]('['+[_0x438596['toUpperCase']()]+']',_0x3dfe3b['message']);_0xb5b53(_0x3dfe3b[_0x00f9('0x15')]);});}else{logger['info']('['+[_0x438596[_0x00f9('0x11')]()]+_0x00f9('0x1f'));_0xc61349[_0x00f9('0x1d')]=_0xc61349[_0x00f9('0x10')];_0xc61349['userEmail']=_0xc61349[_0x00f9('0x1e')];_0x5b19cb(_0xc61349);}});};}function createEndUser(_0x3fa6c8,_0x565700,_0x49cd4f,_0x3178fd,_0xc2bba5){logger[_0x00f9('0x16')]('['+[_0x3fa6c8[_0x00f9('0x11')]()]+_0x00f9('0x20'),_0x49cd4f);return new Promise(function(_0x27c79f,_0x52a7a4){var _0x2eb2be={'method':_0x00f9('0x21'),'uri':_0x3178fd+'sys_user?'+_0xc2bba5,'body':{'user_name':_0x49cd4f[_0x00f9('0x22')],'roles':'user','first_name':_0x49cd4f['endUserNumber'],'active':_0x00f9('0x1c'),'date_format':_0x00f9('0x23'),'phone':_0x49cd4f[_0x00f9('0x22')]},'auth':_0x565700,'json':!![]};return rp(_0x2eb2be)['then'](function(_0x21c0bb){logger[_0x00f9('0x16')]('['+[_0x3fa6c8['toUpperCase']()]+'],\x20EndUser\x20schema',_0x21c0bb[_0x00f9('0xe')]);_0x49cd4f['endUserId']=_0x21c0bb[_0x00f9('0xe')][_0x00f9('0x24')];_0x27c79f(_0x49cd4f);})[_0x00f9('0x13')](function(_0x36af1f){logger[_0x00f9('0x14')]('['+[_0x3fa6c8['toUpperCase']()]+']',_0x36af1f[_0x00f9('0x15')]);_0x52a7a4(_0x36af1f['message']);});});}function getEndUser(_0x34f02e,_0x33321b,_0x2df396,_0x3cf9d4,_0x164a01){return function(_0x3b54ad){logger[_0x00f9('0x16')]('['+[_0x34f02e[_0x00f9('0x11')]()]+'],\x20getEndUser\x20input\x20crm',_0x3b54ad);return new Promise(function(_0x58d78a,_0x5da3f5){var _0x5bac59={'method':'GET','uri':_0x2df396+_0x00f9('0x25')+_0x3b54ad['endUserNumber']+'&'+_0x3cf9d4+'&'+_0x164a01,'auth':_0x33321b,'json':!![]};return rp(_0x5bac59)[_0x00f9('0x1b')](function(_0x50319f){if(_0x50319f['result']['length']>0x0){_0x3b54ad['endUserId']=_0x50319f[_0x00f9('0xe')][0x0][_0x00f9('0x24')];logger[_0x00f9('0x16')]('['+[_0x34f02e[_0x00f9('0x11')]()]+_0x00f9('0x26'),_0x3b54ad);_0x58d78a(_0x3b54ad);}else{return createEndUser(_0x34f02e,_0x33321b,_0x3b54ad,_0x2df396,_0x3cf9d4)[_0x00f9('0x1b')](function(_0x1ea901){logger[_0x00f9('0x16')]('['+[_0x34f02e[_0x00f9('0x11')]()]+_0x00f9('0x27'),_0x1ea901);_0x58d78a(_0x1ea901);});}})[_0x00f9('0x13')](function(_0x49d583){logger['error']('['+[_0x34f02e[_0x00f9('0x11')]()]+']',_0x49d583[_0x00f9('0x15')]);_0x5da3f5(_0x49d583[_0x00f9('0x15')]);});});};}function getCustomFields(_0x1c946d,_0x3e0516){var _0x2e7231={};if(_0x1c946d[_0x00f9('0xf')]>0x0){_[_0x00f9('0x28')](_0x1c946d,function(_0x532995){if(_[_0x00f9('0x29')]([_0x00f9('0x2a'),_0x00f9('0x2b')],_0x532995[_0x00f9('0x2c')])&&_0x532995[_0x00f9('0x2d')]&&!_0x532995[_0x00f9('0x2e')]){_0x2e7231[_0x532995[_0x00f9('0x2d')][_0x00f9('0x2f')]()]=_0x532995['content']['toString']();}else if(_[_0x00f9('0x29')]([_0x00f9('0x2a'),_0x00f9('0x2b')],_0x532995[_0x00f9('0x2c')])&&_0x532995[_0x00f9('0x30')]&&_0x532995[_0x00f9('0x2e')]){_0x2e7231[_0x532995[_0x00f9('0x30')]['toLowerCase']()]=_0x532995[_0x00f9('0x31')][_0x00f9('0x32')]();}else if(_0x532995['type']===_0x00f9('0x33')&&_0x532995[_0x00f9('0x34')]&&_0x532995['idField']&&_0x532995[_0x00f9('0x2e')]){_0x2e7231[_0x532995[_0x00f9('0x30')]['toLowerCase']()]=_0x3e0516[_0x532995[_0x00f9('0x34')]][_0x00f9('0x32')]();}else if(_0x532995['type']===_0x00f9('0x35')&&_0x532995[_0x00f9('0x36')]&&_0x532995[_0x00f9('0x36')][_0x00f9('0x37')]&&_0x532995[_0x00f9('0x30')]&&_0x532995['customField']){_0x2e7231[_0x532995[_0x00f9('0x30')][_0x00f9('0x2f')]()]=_0x3e0516[_0x532995['Variable'][_0x00f9('0x37')][_0x00f9('0x2f')]()][_0x00f9('0x32')]();}});}return _0x2e7231;}function getTicket(_0x3dc1e5,_0x119bf4,_0x397f02,_0x18026e,_0x51f6bd,_0x611467){return function(_0x558017){logger['info']('['+[_0x3dc1e5[_0x00f9('0x11')]()]+_0x00f9('0x38'),_0x558017);return new Promise(function(_0x4a0e33,_0x24a972){var _0x16ac72=_0x3dc1e5[_0x00f9('0x2f')]()==='outbound'?_0x558017[_0x00f9('0x1d')]:_0x558017[_0x00f9('0x39')];var _0x21501d={'method':_0x00f9('0x21'),'uri':_0x397f02+_0x00f9('0x3a')+'?'+_0x611467,'body':Object[_0x00f9('0x3b')]({},{'active':_0x00f9('0x1c'),'caller_id':_0x16ac72,'assigned_to':_0x558017['userId'],'short_description':intUtil[_0x00f9('0x3c')](_0x18026e[_0x00f9('0x3d')],_0x51f6bd,'\x20'),'description':intUtil[_0x00f9('0x3c')](_0x18026e[_0x00f9('0x3e')],_0x51f6bd,'\x0a')},getCustomFields(_0x18026e[_0x00f9('0x3f')],_0x51f6bd)),'auth':_0x119bf4,'json':!![]};return rp(_0x21501d)[_0x00f9('0x1b')](function(_0x5ecb5f){logger[_0x00f9('0x16')]('['+[_0x3dc1e5[_0x00f9('0x11')]()]+_0x00f9('0x40'),_0x5ecb5f[_0x00f9('0xe')]);_0x558017[_0x00f9('0x41')]=_0x5ecb5f[_0x00f9('0xe')][_0x00f9('0x24')];_0x558017[_0x00f9('0x42')]=_0x5ecb5f[_0x00f9('0xe')][_0x00f9('0x43')];logger[_0x00f9('0x16')]('['+[_0x3dc1e5[_0x00f9('0x11')]()]+_0x00f9('0x44'),_0x558017);_0x4a0e33(_0x558017);})[_0x00f9('0x13')](function(_0x3ef6d9){logger['error']('['+[_0x3dc1e5[_0x00f9('0x11')]()]+']',_0x3ef6d9[_0x00f9('0x15')]);_0x24a972(_0x3ef6d9[_0x00f9('0x15')]);});});};}function createRemoteTag(_0x55d37a,_0x9fde72,_0x1ddfd8,_0x56894b){return new Promise(function(_0x2d1699,_0x25e949){var _0x424425={'method':_0x00f9('0x21'),'uri':_0x1ddfd8+_0x00f9('0x45')+'?'+_0x56894b,'body':{'short_description':_0x55d37a,'global':!![],'active':!![],'name':_0x55d37a},'auth':_0x9fde72,'json':!![]};return rp(_0x424425)[_0x00f9('0x1b')](function(_0x5b8f59){var _0x1dbbdc=_0x5b8f59[_0x00f9('0xe')][_0x00f9('0x24')];_0x2d1699(_0x1dbbdc);});});}function getRemoteTag(_0x1a1285,_0x89097f,_0xf08763,_0x1832f3,_0x34159a){return new Promise(function(_0x3893c2,_0x1b0f4c){var _0x2adc0d={'method':_0x00f9('0xc'),'uri':_0xf08763+_0x00f9('0x45')+_0x00f9('0x46')+_0x1a1285+'&'+_0x1832f3,'auth':_0x89097f,'json':!![]};return rp(_0x2adc0d)[_0x00f9('0x1b')](function(_0x2c0d3f){if(_0x2c0d3f[_0x00f9('0xe')][_0x00f9('0xf')]>0x0){var _0x46061b=_0x2c0d3f[_0x00f9('0xe')][0x0][_0x00f9('0x24')];_0x3893c2(_0x46061b);}else{return createRemoteTag(_0x1a1285,_0x89097f,_0xf08763,_0x1832f3)['then'](function(_0x2e48b6){_0x3893c2(_0x2e48b6);});}});});}function assignTagToIncident(_0x32b521,_0x5ef064,_0x75ccfe,_0x46110c,_0x4d4154){return new Promise(function(_0x57a2e9,_0x312345){var _0x11b687={'method':_0x00f9('0x21'),'uri':_0x75ccfe+'label_entry'+'?'+_0x4d4154,'body':{'label':_0x32b521,'table':'incident','id_type':_0x00f9('0x47'),'table_key':_0x46110c[_0x00f9('0x41')],'title':_0x00f9('0x48')+_0x46110c[_0x00f9('0x42')],'id_display':_0x46110c[_0x00f9('0x42')]},'auth':_0x5ef064,'json':!![]};return rp(_0x11b687)[_0x00f9('0x1b')](function(_0x19f1f5){_0x57a2e9();})[_0x00f9('0x13')](function(){_0x57a2e9();});});}function manageTags(_0x3a4d93,_0x3a6544,_0x70969f,_0x5da783,_0x384d52,_0xb0ed26,_0x25035b){return new Promise(function(_0x2ee84c,_0x450670){var _0x23ff37=[];_0x3a6544[_0x00f9('0x28')](function(_0x531230){_0x23ff37[_0x00f9('0x49')](getRemoteTag(_0x531230,_0x70969f,_0x5da783,_0xb0ed26,_0x25035b));});return Promise[_0x00f9('0x4a')](_0x23ff37)['then'](function(_0x2725dd){if(_0x2725dd[_0x00f9('0xf')]){logger[_0x00f9('0x16')]('['+[_0x3a4d93[_0x00f9('0x11')]()]+_0x00f9('0x4b'),_0x2725dd);var _0x2c5e32=[];_0x2725dd[_0x00f9('0x28')](function(_0x536c9c){_0x2c5e32[_0x00f9('0x49')](assignTagToIncident(_0x536c9c,_0x70969f,_0x5da783,_0x384d52,_0xb0ed26));});return Promise[_0x00f9('0x4a')](_0x2c5e32)[_0x00f9('0x1b')](function(){_0x2ee84c();})[_0x00f9('0x13')](function(){_0x2ee84c();});}else{_0x2ee84c();}});});}function getTags(_0x4c435d,_0x200d80,_0x509c85,_0x9b2094,_0x52a5ed,_0x45d139){return function(_0x611b06){return new Promise(function(_0x1dc42e,_0x58a639){var _0x15cd61=[];var _0x2467c9=_0x9b2094[_0x00f9('0x4c')];if(_0x2467c9&&_0x2467c9[_0x00f9('0xf')]>0x0){_0x15cd61=_[_0x00f9('0x4d')](_0x2467c9,'name');}if(_0x15cd61[_0x00f9('0xf')]>0x0){return manageTags(_0x4c435d,_0x15cd61,_0x200d80,_0x509c85,_0x611b06,_0x52a5ed,_0x45d139)[_0x00f9('0x1b')](function(){_0x1dc42e(_0x611b06);});}else{_0x1dc42e(_0x611b06);}});};}function emit(_0x13c241,_0x135a26,_0x3d11e3){var _0x371b2b=_0x00f9('0x4e')+_0x00f9('0x4f')+_0x00f9('0x50')+'%255EORDERBYDESCnumber';var _0xc21dd6={'uri':_0x13c241+_0x00f9('0x51')+_0x3d11e3+_0x371b2b};io['to'](util[_0x00f9('0x52')](_0x00f9('0x53'),_0x135a26))[_0x00f9('0x54')]('trigger:browser:url',_0xc21dd6);}exports['cs']=function(_0x4dba37,_0x3c31c3,_0x390270,_0x5c1761,_0x365f79,_0x3253bf,_0x17bc31,_0x255350){var _0x2c997f={};var _0x54430f={'user':_0x3253bf['username'],'pass':_0x3253bf[_0x00f9('0x55')]};var _0x6dfa41=_0x00f9('0x56');var _0x14ccc6=_0x00f9('0x57');_0x3253bf[_0x00f9('0x58')]=intUtil[_0x00f9('0x59')](_0x3253bf[_0x00f9('0x58')]);_0x3253bf['serverUrl']=intUtil[_0x00f9('0x59')](_0x3253bf[_0x00f9('0x5a')]);var _0x5ec7bd=util['format'](_0x00f9('0x5b'),_0x3253bf[_0x00f9('0x58')]);_0x2c997f['userEmail']=!_['isNil'](_0x5c1761)?_0x5c1761[_0x00f9('0x5c')]:null;_0x2c997f[_0x00f9('0x1e')]=_0x3253bf[_0x00f9('0x5c')];_0x2c997f[_0x00f9('0x22')]=_0x255350[_0x00f9('0x2f')]()===_0x00f9('0x5d')?_0x3c31c3['destcalleridnum']:_0x3c31c3[_0x00f9('0x5e')];_0x2c997f['callDirection']=_0x255350===_0x00f9('0x5f')||_0x255350===_0x00f9('0x60')?_0x00f9('0x5f'):_0x00f9('0x5d');var _0x18a9f7=util[_0x00f9('0x52')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3253bf[_0x00f9('0x5a')],_0x3c31c3[_0x00f9('0x61')],md5(_0x3c31c3[_0x00f9('0x61')]));if(_0x365f79&&_0x365f79[_0x00f9('0x62')]){logger[_0x00f9('0x16')]('[QUEUE]',_0x00f9('0x63'));_0x3c31c3[_0x00f9('0x64')]=_0x18a9f7;}else if(_0x17bc31&&_0x17bc31[_0x00f9('0x65')]&&_0x17bc31[_0x00f9('0x65')]!==_0x00f9('0x66')){logger[_0x00f9('0x16')]('[OUTBOUND]',_0x00f9('0x63'));_0x3c31c3['recordingURL']=_0x18a9f7;}else{_0x3c31c3['recordingURL']='';}return getAdminUser(_0x255350,_0x54430f,_0x2c997f,_0x5ec7bd,_0x14ccc6,_0x6dfa41)['then'](getUser(_0x255350,_0x54430f,_0x5ec7bd,_0x14ccc6,_0x6dfa41))[_0x00f9('0x1b')](getEndUser(_0x255350,_0x54430f,_0x5ec7bd,_0x14ccc6,_0x6dfa41))[_0x00f9('0x1b')](getTicket(_0x255350,_0x54430f,_0x5ec7bd,_0x390270,_0x3c31c3,_0x14ccc6))[_0x00f9('0x1b')](function(_0x42524e){logger[_0x00f9('0x16')](util[_0x00f9('0x52')]('The\x20ticket\x20ID\x20is:\x20%s',_0x42524e[_0x00f9('0x41')]));logger['info'](util['format'](_0x00f9('0x67'),_0x255350));if(_0x255350!=='unmanaged'){logger[_0x00f9('0x16')]('['+[_0x255350[_0x00f9('0x11')]()]+']',_0x00f9('0x68'));emit(_0x3253bf[_0x00f9('0x58')],_0x5c1761[_0x00f9('0x37')],_0x42524e[_0x00f9('0x41')]);}})['catch'](function(_0x3dea47){logger[_0x00f9('0x14')]('['+[_0x255350['toUpperCase']()]+_0x00f9('0x69'),util[_0x00f9('0x6a')](_0x3dea47,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1d26=['sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20entity','active','userId','sys_id','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','adminId','],\x20createEndUser\x20input\x20crm','endUserNumber','user','true','System','then','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','forEach','string','type','customField','nameField','toLowerCase','toString','picklist','idField','content','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','POST','incident','assign','Subjects','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','adminEmail','email','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','util','ioredis','./util','servicenow','redis','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','length','result','info','toUpperCase','catch','error','message','validateEmail'];(function(_0x324e86,_0x81b1cb){var _0x592846=function(_0x33439c){while(--_0x33439c){_0x324e86['push'](_0x324e86['shift']());}};_0x592846(++_0x81b1cb);}(_0x1d26,0x130));var _0x61d2=function(_0x555569,_0x15669b){_0x555569=_0x555569-0x0;var _0x2541ff=_0x1d26[_0x555569];return _0x2541ff;};'use strict';var _=require(_0x61d2('0x0'));var Promise=require('bluebird');var rp=require('request-promise');var util=require(_0x61d2('0x1'));var md5=require('md5');var Redis=require(_0x61d2('0x2'));var intUtil=require(_0x61d2('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x61d2('0x4'));config[_0x61d2('0x5')]=_['defaults'](config[_0x61d2('0x5')],{'host':_0x61d2('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x61d2('0x5')]));function getAdminUser(_0xc41490,_0x431403,_0x2803c0,_0x20ab7a,_0x25c89a,_0xd87885){return new Promise(function(_0x19f788,_0x1f833d){var _0x38eff2={'method':_0x61d2('0x7'),'uri':_0x20ab7a+_0x61d2('0x8')+'&'+_0x25c89a+'&'+_0xd87885,'auth':_0x431403,'json':!![]};return rp(_0x38eff2)['then'](function(_0x30b645){if(_0x30b645['result'][_0x61d2('0x9')]>0x0){_0x2803c0['adminId']=_0x30b645[_0x61d2('0xa')][0x0]['sys_id'];}logger[_0x61d2('0xb')]('['+[_0xc41490[_0x61d2('0xc')]()]+'],\x20getAdminUser\x20crm',_0x2803c0);_0x19f788(_0x2803c0);})[_0x61d2('0xd')](function(_0x1eb197){logger[_0x61d2('0xe')]('['+[_0xc41490[_0x61d2('0xc')]()]+']',_0x1eb197['message']);_0x1f833d(_0x1eb197[_0x61d2('0xf')]);});});}function getUser(_0x551b1c,_0x45bcb5,_0x301a2f,_0x545e9b,_0x20a388){return function(_0x5c64a1){logger[_0x61d2('0xb')]('['+[_0x551b1c[_0x61d2('0xc')]()]+'],\x20getUser\x20input\x20crm',_0x5c64a1);return new Promise(function(_0x55f6f9,_0x1916af){if(intUtil[_0x61d2('0x10')](_0x5c64a1['userEmail'])){var _0x7c8997={'method':_0x61d2('0x7'),'uri':_0x301a2f+_0x61d2('0x11')+_0x5c64a1[_0x61d2('0x12')]+'&'+_0x545e9b+'&'+_0x20a388,'auth':_0x45bcb5,'json':!![]};logger[_0x61d2('0xb')]('['+[_0x551b1c[_0x61d2('0xc')]()]+'],\x20getUser\x20rp\x20obj',_0x7c8997);return rp(_0x7c8997)['then'](function(_0x35eb04){logger['info']('['+[_0x551b1c[_0x61d2('0xc')]()]+_0x61d2('0x13'),_0x35eb04);if(_0x35eb04[_0x61d2('0xa')][_0x61d2('0x9')]>0x0&&String(_0x35eb04[_0x61d2('0xa')][0x0][_0x61d2('0x14')])==='true'){_0x5c64a1[_0x61d2('0x15')]=_0x35eb04[_0x61d2('0xa')][0x0][_0x61d2('0x16')];}else{_0x5c64a1[_0x61d2('0x15')]=_0x5c64a1['adminId'];_0x5c64a1[_0x61d2('0x12')]=_0x5c64a1['adminEmail'];}logger[_0x61d2('0xb')]('['+[_0x551b1c[_0x61d2('0xc')]()]+_0x61d2('0x17'),_0x5c64a1);_0x55f6f9(_0x5c64a1);})[_0x61d2('0xd')](function(_0x1c5f5d){logger[_0x61d2('0xe')]('['+[_0x551b1c[_0x61d2('0xc')]()]+']',_0x1c5f5d[_0x61d2('0xf')]);_0x1916af(_0x1c5f5d['message']);});}else{logger[_0x61d2('0xb')]('['+[_0x551b1c[_0x61d2('0xc')]()]+_0x61d2('0x18'));_0x5c64a1[_0x61d2('0x15')]=_0x5c64a1[_0x61d2('0x19')];_0x5c64a1[_0x61d2('0x12')]=_0x5c64a1['adminEmail'];_0x55f6f9(_0x5c64a1);}});};}function createEndUser(_0x5a4e4d,_0x5a8f1e,_0x2b2b7f,_0x50e6ba,_0x5c0176){logger['info']('['+[_0x5a4e4d[_0x61d2('0xc')]()]+_0x61d2('0x1a'),_0x2b2b7f);return new Promise(function(_0x4a4b4d,_0x1dd85b){var _0x4819d2={'method':'POST','uri':_0x50e6ba+'sys_user?'+_0x5c0176,'body':{'user_name':_0x2b2b7f[_0x61d2('0x1b')],'roles':_0x61d2('0x1c'),'first_name':_0x2b2b7f[_0x61d2('0x1b')],'active':_0x61d2('0x1d'),'date_format':_0x61d2('0x1e'),'phone':_0x2b2b7f[_0x61d2('0x1b')]},'auth':_0x5a8f1e,'json':!![]};return rp(_0x4819d2)[_0x61d2('0x1f')](function(_0x88283){logger[_0x61d2('0xb')]('['+[_0x5a4e4d['toUpperCase']()]+'],\x20EndUser\x20schema',_0x88283[_0x61d2('0xa')]);_0x2b2b7f[_0x61d2('0x20')]=_0x88283[_0x61d2('0xa')]['sys_id'];_0x4a4b4d(_0x2b2b7f);})[_0x61d2('0xd')](function(_0x5d9f12){logger['error']('['+[_0x5a4e4d[_0x61d2('0xc')]()]+']',_0x5d9f12[_0x61d2('0xf')]);_0x1dd85b(_0x5d9f12[_0x61d2('0xf')]);});});}function getEndUser(_0x4af340,_0x4228ea,_0x3fa5b1,_0x25c632,_0x402f71){return function(_0x323d84){logger[_0x61d2('0xb')]('['+[_0x4af340[_0x61d2('0xc')]()]+_0x61d2('0x21'),_0x323d84);return new Promise(function(_0x30f322,_0x11be1e){var _0x3addbc={'method':'GET','uri':_0x3fa5b1+'sys_user?sysparm_query=phone%3D'+_0x323d84[_0x61d2('0x1b')]+'&'+_0x25c632+'&'+_0x402f71,'auth':_0x4228ea,'json':!![]};return rp(_0x3addbc)[_0x61d2('0x1f')](function(_0x3d8f8f){if(_0x3d8f8f[_0x61d2('0xa')]['length']>0x0){_0x323d84[_0x61d2('0x20')]=_0x3d8f8f[_0x61d2('0xa')][0x0]['sys_id'];logger[_0x61d2('0xb')]('['+[_0x4af340[_0x61d2('0xc')]()]+_0x61d2('0x22'),_0x323d84);_0x30f322(_0x323d84);}else{return createEndUser(_0x4af340,_0x4228ea,_0x323d84,_0x3fa5b1,_0x25c632)[_0x61d2('0x1f')](function(_0x3d7ab0){logger['info']('['+[_0x4af340[_0x61d2('0xc')]()]+'],\x20createEndUser\x20crm',_0x3d7ab0);_0x30f322(_0x3d7ab0);});}})[_0x61d2('0xd')](function(_0x2d7a74){logger[_0x61d2('0xe')]('['+[_0x4af340[_0x61d2('0xc')]()]+']',_0x2d7a74[_0x61d2('0xf')]);_0x11be1e(_0x2d7a74['message']);});});};}function getCustomFields(_0x152137,_0xc6e491){var _0x13c444={};if(_0x152137[_0x61d2('0x9')]>0x0){_[_0x61d2('0x23')](_0x152137,function(_0x1de46d){if(_['includes']([_0x61d2('0x24'),'picklist'],_0x1de46d[_0x61d2('0x25')])&&_0x1de46d['nameField']&&!_0x1de46d[_0x61d2('0x26')]){_0x13c444[_0x1de46d[_0x61d2('0x27')][_0x61d2('0x28')]()]=_0x1de46d['content'][_0x61d2('0x29')]();}else if(_['includes']([_0x61d2('0x24'),_0x61d2('0x2a')],_0x1de46d[_0x61d2('0x25')])&&_0x1de46d[_0x61d2('0x2b')]&&_0x1de46d[_0x61d2('0x26')]){_0x13c444[_0x1de46d[_0x61d2('0x2b')][_0x61d2('0x28')]()]=_0x1de46d[_0x61d2('0x2c')][_0x61d2('0x29')]();}else if(_0x1de46d[_0x61d2('0x25')]===_0x61d2('0x2d')&&_0x1de46d[_0x61d2('0x2e')]&&_0x1de46d['idField']&&_0x1de46d[_0x61d2('0x26')]){_0x13c444[_0x1de46d['idField'][_0x61d2('0x28')]()]=_0xc6e491[_0x1de46d[_0x61d2('0x2e')]]['toString']();}else if(_0x1de46d[_0x61d2('0x25')]===_0x61d2('0x2f')&&_0x1de46d[_0x61d2('0x30')]&&_0x1de46d[_0x61d2('0x30')][_0x61d2('0x31')]&&_0x1de46d[_0x61d2('0x2b')]&&_0x1de46d['customField']){_0x13c444[_0x1de46d[_0x61d2('0x2b')][_0x61d2('0x28')]()]=_0xc6e491[_0x1de46d['Variable'][_0x61d2('0x31')][_0x61d2('0x28')]()][_0x61d2('0x29')]();}});}return _0x13c444;}function getTicket(_0xeb7c7d,_0x499ca0,_0x209330,_0x5d8a70,_0x3cf1d5,_0x4fc6b5){return function(_0x479197){logger[_0x61d2('0xb')]('['+[_0xeb7c7d[_0x61d2('0xc')]()]+_0x61d2('0x32'),_0x479197);return new Promise(function(_0x595cca,_0xc60c8f){var _0x192493=_0xeb7c7d[_0x61d2('0x28')]()===_0x61d2('0x33')?_0x479197['userId']:_0x479197[_0x61d2('0x20')];var _0x508381={'method':_0x61d2('0x34'),'uri':_0x209330+_0x61d2('0x35')+'?'+_0x4fc6b5,'body':Object[_0x61d2('0x36')]({},{'active':'true','caller_id':_0x192493,'assigned_to':_0x479197[_0x61d2('0x15')],'short_description':intUtil['getString'](_0x5d8a70[_0x61d2('0x37')],_0x3cf1d5,'\x20'),'description':intUtil[_0x61d2('0x38')](_0x5d8a70[_0x61d2('0x39')],_0x3cf1d5,'\x0a')},getCustomFields(_0x5d8a70[_0x61d2('0x3a')],_0x3cf1d5)),'auth':_0x499ca0,'json':!![]};return rp(_0x508381)[_0x61d2('0x1f')](function(_0x496466){logger[_0x61d2('0xb')]('['+[_0xeb7c7d[_0x61d2('0xc')]()]+_0x61d2('0x3b'),_0x496466[_0x61d2('0xa')]);_0x479197[_0x61d2('0x3c')]=_0x496466[_0x61d2('0xa')][_0x61d2('0x16')];_0x479197[_0x61d2('0x3d')]=_0x496466['result'][_0x61d2('0x3e')];logger['info']('['+[_0xeb7c7d[_0x61d2('0xc')]()]+_0x61d2('0x3f'),_0x479197);_0x595cca(_0x479197);})['catch'](function(_0x34908b){logger[_0x61d2('0xe')]('['+[_0xeb7c7d[_0x61d2('0xc')]()]+']',_0x34908b[_0x61d2('0xf')]);_0xc60c8f(_0x34908b[_0x61d2('0xf')]);});});};}function createRemoteTag(_0x36069f,_0x30b5ba,_0x39de78,_0x4a55c8){return new Promise(function(_0x2f239a,_0x3792da){var _0x257834={'method':_0x61d2('0x34'),'uri':_0x39de78+_0x61d2('0x40')+'?'+_0x4a55c8,'body':{'short_description':_0x36069f,'global':!![],'active':!![],'name':_0x36069f},'auth':_0x30b5ba,'json':!![]};return rp(_0x257834)['then'](function(_0x5a8719){var _0x359a6e=_0x5a8719[_0x61d2('0xa')][_0x61d2('0x16')];_0x2f239a(_0x359a6e);});});}function getRemoteTag(_0x3429d8,_0x55ab18,_0x36c6c2,_0x579294,_0x5af54e){return new Promise(function(_0x13a5c7,_0x519e87){var _0x813541={'method':_0x61d2('0x7'),'uri':_0x36c6c2+_0x61d2('0x40')+_0x61d2('0x41')+_0x3429d8+'&'+_0x579294,'auth':_0x55ab18,'json':!![]};return rp(_0x813541)['then'](function(_0x5ec950){if(_0x5ec950[_0x61d2('0xa')][_0x61d2('0x9')]>0x0){var _0xfb5a0b=_0x5ec950[_0x61d2('0xa')][0x0]['sys_id'];_0x13a5c7(_0xfb5a0b);}else{return createRemoteTag(_0x3429d8,_0x55ab18,_0x36c6c2,_0x579294)[_0x61d2('0x1f')](function(_0x25b6d2){_0x13a5c7(_0x25b6d2);});}});});}function assignTagToIncident(_0xde85f3,_0x166fa0,_0x52be35,_0x3085eb,_0x45bea4){return new Promise(function(_0x468705,_0x2dcbaa){var _0x476f90={'method':_0x61d2('0x34'),'uri':_0x52be35+_0x61d2('0x42')+'?'+_0x45bea4,'body':{'label':_0xde85f3,'table':'incident','id_type':_0x61d2('0x43'),'table_key':_0x3085eb['ticketId'],'title':'Incident\x20-\x20'+_0x3085eb[_0x61d2('0x3d')],'id_display':_0x3085eb[_0x61d2('0x3d')]},'auth':_0x166fa0,'json':!![]};return rp(_0x476f90)[_0x61d2('0x1f')](function(_0x448f19){_0x468705();})[_0x61d2('0xd')](function(){_0x468705();});});}function manageTags(_0x48b278,_0xe9bda6,_0xbe6ee5,_0x4bf5ce,_0x507235,_0x37a2f6,_0x1c689b){return new Promise(function(_0x520a82,_0x1763fe){var _0x27cbf3=[];_0xe9bda6[_0x61d2('0x23')](function(_0x1f5dff){_0x27cbf3[_0x61d2('0x44')](getRemoteTag(_0x1f5dff,_0xbe6ee5,_0x4bf5ce,_0x37a2f6,_0x1c689b));});return Promise[_0x61d2('0x45')](_0x27cbf3)['then'](function(_0x5d3d0a){if(_0x5d3d0a[_0x61d2('0x9')]){logger['info']('['+[_0x48b278[_0x61d2('0xc')]()]+_0x61d2('0x46'),_0x5d3d0a);var _0x367a58=[];_0x5d3d0a[_0x61d2('0x23')](function(_0x4798dc){_0x367a58['push'](assignTagToIncident(_0x4798dc,_0xbe6ee5,_0x4bf5ce,_0x507235,_0x37a2f6));});return Promise[_0x61d2('0x45')](_0x367a58)[_0x61d2('0x1f')](function(){_0x520a82();})[_0x61d2('0xd')](function(){_0x520a82();});}else{_0x520a82();}});});}function getTags(_0x21b9da,_0x538e55,_0x39cb0b,_0x515078,_0x3ec70c,_0x570431){return function(_0x16a05d){return new Promise(function(_0x5d658f,_0x407c76){var _0x5d5d68=[];var _0x14a91a=_0x515078[_0x61d2('0x47')];if(_0x14a91a&&_0x14a91a[_0x61d2('0x9')]>0x0){_0x5d5d68=_['map'](_0x14a91a,_0x61d2('0x31'));}if(_0x5d5d68[_0x61d2('0x9')]>0x0){return manageTags(_0x21b9da,_0x5d5d68,_0x538e55,_0x39cb0b,_0x16a05d,_0x3ec70c,_0x570431)['then'](function(){_0x5d658f(_0x16a05d);});}else{_0x5d658f(_0x16a05d);}});};}function emit(_0x137795,_0x1e2d38,_0x4165fb){var _0x35400d='%26sysparm_record_target%3Dincident'+_0x61d2('0x48')+_0x61d2('0x49')+_0x61d2('0x4a');var _0x2c04a5={'uri':_0x137795+_0x61d2('0x4b')+_0x4165fb+_0x35400d};io['to'](util[_0x61d2('0x4c')](_0x61d2('0x4d'),_0x1e2d38))[_0x61d2('0x4e')](_0x61d2('0x4f'),_0x2c04a5);}exports['cs']=function(_0x3188bd,_0x32909e,_0x33f428,_0x48f6dd,_0x4cb904,_0x392f15,_0x9148c7,_0x8d6575){var _0x140e68={};var _0x55e968={'user':_0x392f15[_0x61d2('0x50')],'pass':_0x392f15[_0x61d2('0x51')]};var _0x3756b3='sysparm_limit=1';var _0x583fa8=_0x61d2('0x52');_0x392f15[_0x61d2('0x53')]=intUtil[_0x61d2('0x54')](_0x392f15[_0x61d2('0x53')]);_0x392f15[_0x61d2('0x55')]=intUtil[_0x61d2('0x54')](_0x392f15['serverUrl']);var _0x24715a=util['format'](_0x61d2('0x56'),_0x392f15[_0x61d2('0x53')]);_0x140e68[_0x61d2('0x12')]=!_[_0x61d2('0x57')](_0x48f6dd)?_0x48f6dd['email']:null;_0x140e68[_0x61d2('0x58')]=_0x392f15[_0x61d2('0x59')];_0x140e68['endUserNumber']=_0x8d6575['toLowerCase']()===_0x61d2('0x33')?_0x32909e['destcalleridnum']:_0x32909e[_0x61d2('0x5a')];_0x140e68[_0x61d2('0x5b')]=_0x8d6575===_0x61d2('0x5c')||_0x8d6575===_0x61d2('0x5d')?_0x61d2('0x5c'):_0x61d2('0x33');var _0x45d2f5=util[_0x61d2('0x4c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x392f15['serverUrl'],_0x32909e['uniqueid'],md5(_0x32909e[_0x61d2('0x5e')]));if(_0x4cb904&&_0x4cb904[_0x61d2('0x5f')]){logger[_0x61d2('0xb')](_0x61d2('0x60'),_0x61d2('0x61'));_0x32909e[_0x61d2('0x62')]=_0x45d2f5;}else if(_0x9148c7&&_0x9148c7[_0x61d2('0x63')]&&_0x9148c7['recordingFormat']!==_0x61d2('0x64')){logger['info'](_0x61d2('0x65'),_0x61d2('0x61'));_0x32909e[_0x61d2('0x62')]=_0x45d2f5;}else{_0x32909e[_0x61d2('0x62')]='';}return getAdminUser(_0x8d6575,_0x55e968,_0x140e68,_0x24715a,_0x583fa8,_0x3756b3)[_0x61d2('0x1f')](getUser(_0x8d6575,_0x55e968,_0x24715a,_0x583fa8,_0x3756b3))[_0x61d2('0x1f')](getEndUser(_0x8d6575,_0x55e968,_0x24715a,_0x583fa8,_0x3756b3))[_0x61d2('0x1f')](getTicket(_0x8d6575,_0x55e968,_0x24715a,_0x33f428,_0x32909e,_0x583fa8))[_0x61d2('0x1f')](function(_0x213c9d){logger[_0x61d2('0xb')](util['format'](_0x61d2('0x66'),_0x213c9d[_0x61d2('0x3c')]));logger['info'](util['format'](_0x61d2('0x67'),_0x8d6575));if(_0x8d6575!==_0x61d2('0x5d')){logger[_0x61d2('0xb')]('['+[_0x8d6575[_0x61d2('0xc')]()]+']',_0x61d2('0x68'));emit(_0x392f15[_0x61d2('0x53')],_0x48f6dd[_0x61d2('0x31')],_0x213c9d[_0x61d2('0x3c')]);}})['catch'](function(_0x3fcc39){logger['error']('['+[_0x8d6575['toUpperCase']()]+_0x61d2('0x69'),util[_0x61d2('0x6a')](_0x3fcc39,{'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 ee2523c..d0e3144 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 _0xd8d9=['created_by','description','date_start','toISOString','duration_hours','duration_minutes','parent_id','Contacts','parent_name','name','direction','forEach','variableName','push','idField','JSON','stringify','format','Basic\x20%s','apiKey','toString','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','user_name','then','entry_list','length','resolve','name_value_list','user_id','value','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','','Enduser\x20created.','first_name','[HTTP]','merge','map','type','string','nameField','customField','custom_fields','content','variable','customVariable','Variable','toLowerCase','login','username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','Calls','queue','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','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','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','error','outbound','recordingFormat','none','[OUTBOUND]','recordingURL','destcalleridname','destcalleridnum','Outbound','users','catch','unmanaged','lastevent','lodash','request-promise','md5','util','ioredis','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','info','getString','Subjects'];(function(_0x4099ee,_0x38495a){var _0x1b7bfc=function(_0x5f5388){while(--_0x5f5388){_0x4099ee['push'](_0x4099ee['shift']());}};_0x1b7bfc(++_0x38495a);}(_0xd8d9,0xda));var _0x9d8d=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xd8d9[_0x3ce3c];return _0x55a2c9;};'use strict';var _=require(_0x9d8d('0x0'));var rp=require(_0x9d8d('0x1'));var BPromise=require('bluebird');var md5=require(_0x9d8d('0x2'));var util=require(_0x9d8d('0x3'));var Redis=require(_0x9d8d('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x9d8d('0x5'));config[_0x9d8d('0x6')]=_[_0x9d8d('0x7')](config['redis'],{'host':_0x9d8d('0x8'),'port':0x18eb});var io=require(_0x9d8d('0x9'))(new Redis(config['redis']));var def={'method':_0x9d8d('0xa'),'json':!![]};function emit(_0x53c732,_0x216bcb,_0x559bfe){io['to'](_0x53c732)['emit'](_0x216bcb,_0x559bfe);}function getTicket(_0x31e032,_0x4d6b05,_0x13b3c3,_0x3a93f7,_0x2752a6,_0xdc55be,_0x4567e3,_0x31a520){logger[_0x9d8d('0xb')]('Creating\x20new\x20ticket...');var _0xe9e6d8=new Date();var _0xf82446=[{'name':'name','value':intUtil[_0x9d8d('0xc')](_0x3a93f7[_0x9d8d('0xd')],_0x2752a6,'\x20')},{'name':'assigned_user_id','value':_0x4d6b05['id']},{'name':_0x9d8d('0xe'),'value':_0x4d6b05['id']},{'name':_0x9d8d('0xf'),'value':intUtil[_0x9d8d('0xc')](_0x3a93f7['Descriptions'],_0x2752a6,'\x0a')},{'name':_0x9d8d('0x10'),'value':_0xe9e6d8[_0x9d8d('0x11')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0x9d8d('0x12'),'value':'0'},{'name':_0x9d8d('0x13'),'value':'15'},{'name':_0x9d8d('0x14'),'value':_0x13b3c3['id']},{'name':'parent_type','value':_0x9d8d('0x15')},{'name':_0x9d8d('0x16'),'value':_0x13b3c3[_0x9d8d('0x17')]},{'name':_0x9d8d('0x18'),'value':_0x31a520}];if(_0xdc55be['length']){_[_0x9d8d('0x19')](_0xdc55be,function(_0x1d2def){if(_0x2752a6[_0x1d2def[_0x9d8d('0x1a')]]){_0xf82446[_0x9d8d('0x1b')]({'name':_0x1d2def[_0x9d8d('0x1c')],'value':_0x2752a6[_0x1d2def[_0x9d8d('0x1a')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x9d8d('0x1d'),'response_type':_0x9d8d('0x1d'),'rest_data':JSON[_0x9d8d('0x1e')]({'session':_0x4567e3['id'],'module_name':'Calls','name_value_list':_0xf82446})}});}function getAuth(_0x2cba30){return util[_0x9d8d('0x1f')](_0x9d8d('0x20'),new Buffer(_0x2cba30[_0x9d8d('0x21')]+':X')[_0x9d8d('0x22')]('base64'));}function getServerInfo(_0x4af2d9){return request({'form':{'method':_0x9d8d('0x23'),'input_type':_0x9d8d('0x1d'),'response_type':'JSON','rest_data':JSON[_0x9d8d('0x1e')]({'session':_0x4af2d9['id']})}});}function getUser(_0xe0ec87,_0x257873,_0xf2865e){if(!_[_0x9d8d('0x24')](_0x257873)){logger[_0x9d8d('0xb')](_0x9d8d('0x25'),_0x257873);return request({'form':{'method':_0x9d8d('0x26'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x9d8d('0x1e')]({'session':_0xf2865e['id'],'module_name':'Employees','query':util[_0x9d8d('0x1f')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x257873),'order_by':'','offset':'0','select_fields':['id',_0x9d8d('0x17'),_0x9d8d('0x27')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9d8d('0x28')](function(_0x3cc118){if(_0x3cc118[_0x9d8d('0x29')][_0x9d8d('0x2a')]){var _0x12d255=_['find'](_0x3cc118['entry_list'],function(_0x48f378){return _0x48f378['name_value_list'][_0x9d8d('0x27')]['value']===_0x257873;});if(_0x12d255){logger[_0x9d8d('0xb')]('Agent\x20found!');return BPromise[_0x9d8d('0x2b')]({'id':_0x12d255[_0x9d8d('0x2c')]['id']['value'],'name':_0x12d255[_0x9d8d('0x2c')][_0x9d8d('0x17')]['value']});}}logger[_0x9d8d('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x9d8d('0x2b')]({'id':_0xf2865e[_0x9d8d('0x2c')][_0x9d8d('0x2d')][_0x9d8d('0x2e')],'name':_0xf2865e[_0x9d8d('0x2c')][_0x9d8d('0x27')][_0x9d8d('0x2e')]});});}else{logger[_0x9d8d('0xb')](_0x9d8d('0x2f'));return BPromise[_0x9d8d('0x2b')]({'id':_0xf2865e[_0x9d8d('0x2c')]['user_id'][_0x9d8d('0x2e')],'name':_0xf2865e[_0x9d8d('0x2c')][_0x9d8d('0x27')][_0x9d8d('0x2e')]});}}function getEndUser(_0x50332a,_0x2b298e,_0x476588,_0x4ba6de){logger['info']('Searching\x20enduser\x20with\x20phone',_0x476588);return request({'form':{'method':_0x9d8d('0x26'),'input_type':_0x9d8d('0x1d'),'response_type':_0x9d8d('0x1d'),'rest_data':JSON[_0x9d8d('0x1e')]({'session':_0x4ba6de['id'],'module_name':_0x9d8d('0x15'),'query':util['format'](_0x9d8d('0x30'),_0x476588),'order_by':'','offset':'0','select_fields':['id','name',_0x9d8d('0x31')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9d8d('0x28')](function(_0xfd919d){if(_0xfd919d['entry_list'][_0x9d8d('0x2a')]){var _0x40edea=_[_0x9d8d('0x32')](_0xfd919d[_0x9d8d('0x29')],function(_0x2c6eb2){return _0x2c6eb2[_0x9d8d('0x2c')]['phone_home'][_0x9d8d('0x2e')]===_0x476588;});if(_0x40edea){logger[_0x9d8d('0xb')](_0x9d8d('0x33'));return BPromise[_0x9d8d('0x2b')]({'id':_0x40edea[_0x9d8d('0x2c')]['id'][_0x9d8d('0x2e')],'name':_0x40edea[_0x9d8d('0x2c')]['name'][_0x9d8d('0x2e')],'phone':_0x40edea[_0x9d8d('0x2c')][_0x9d8d('0x31')]['value']});}}else{logger[_0x9d8d('0xb')](_0x9d8d('0x34'));return request({'form':{'method':_0x9d8d('0x35'),'input_type':_0x9d8d('0x1d'),'response_type':_0x9d8d('0x1d'),'rest_data':JSON[_0x9d8d('0x1e')]({'session':_0x4ba6de['id'],'module_name':_0x9d8d('0x15'),'name_value_list':[{'name':'first_name','value':_0x2b298e!==_0x9d8d('0x36')?_0x2b298e:util[_0x9d8d('0x1f')]('Caller\x20-\x20%s',_0x476588)},{'name':'phone_home','value':_0x476588}]})}})[_0x9d8d('0x28')](function(_0x12c729){logger['info'](_0x9d8d('0x37'));return BPromise[_0x9d8d('0x2b')]({'id':_0x12c729['id'],'name':_0x12c729[_0x9d8d('0x29')][_0x9d8d('0x38')][_0x9d8d('0x2e')],'phone':_0x12c729[_0x9d8d('0x29')]['phone_home'][_0x9d8d('0x2e')]});});}});}function request(_0x4c362e){logger['debug'](_0x9d8d('0x39'),JSON['stringify'](_0x4c362e));return rp(_[_0x9d8d('0x3a')](def,_0x4c362e));}function getTags(_0x34e52a,_0x595cbb){var _0x5d15a3=[];if(_0x34e52a&&_0x34e52a[_0x9d8d('0x2a')]>0x0){_0x5d15a3=_[_0x9d8d('0x3b')](_0x34e52a,_0x595cbb);}return _0x5d15a3;}function getCustomFields(_0x32dc1e,_0x571cd1){var _0x3be2bc=[];var _0x1d0bf3={'custom_fields':[]};if(_0x32dc1e[_0x9d8d('0x2a')]>0x0){_['forEach'](_0x32dc1e,function(_0x46740a){if(_0x46740a[_0x9d8d('0x3c')]===_0x9d8d('0x3d')&&_0x46740a[_0x9d8d('0x3e')]&&!_0x46740a['customField']){_0x1d0bf3[_0x46740a[_0x9d8d('0x3e')]['toLowerCase']()]=_0x46740a['content'][_0x9d8d('0x22')]();}else if(_0x46740a['type']===_0x9d8d('0x3d')&&_0x46740a[_0x9d8d('0x1c')]&&_0x46740a[_0x9d8d('0x3f')]){_0x1d0bf3[_0x9d8d('0x40')][_0x9d8d('0x1b')]({'id':_0x46740a['idField'],'value':_0x46740a[_0x9d8d('0x41')][_0x9d8d('0x22')]()});}else if(_0x46740a['type']===_0x9d8d('0x42')&&_0x46740a[_0x9d8d('0x1a')]&&_0x46740a['idField']&&_0x46740a[_0x9d8d('0x3f')]){_0x571cd1[_0x46740a[_0x9d8d('0x1a')]]&&_0x1d0bf3[_0x9d8d('0x40')][_0x9d8d('0x1b')]({'id':_0x46740a[_0x9d8d('0x1c')],'value':_0x571cd1[_0x46740a[_0x9d8d('0x1a')]][_0x9d8d('0x22')]()});}else if(_0x46740a[_0x9d8d('0x3c')]===_0x9d8d('0x43')&&_0x46740a[_0x9d8d('0x44')]&&_0x46740a[_0x9d8d('0x44')][_0x9d8d('0x17')]&&_0x46740a[_0x9d8d('0x1c')]&&_0x46740a[_0x9d8d('0x3f')]){_0x571cd1[_0x46740a[_0x9d8d('0x44')]['name'][_0x9d8d('0x45')]()]&&_0x1d0bf3['custom_fields']['push']({'id':_0x46740a['idField'],'value':_0x571cd1[_0x46740a[_0x9d8d('0x44')][_0x9d8d('0x17')][_0x9d8d('0x45')]()][_0x9d8d('0x22')]()});}});}return _0x1d0bf3;}function getConnection(_0x317a09){return request({'method':_0x9d8d('0xa'),'form':{'method':_0x9d8d('0x46'),'input_type':_0x9d8d('0x1d'),'response_type':_0x9d8d('0x1d'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x317a09[_0x9d8d('0x47')],'password':_0x317a09['password'],'encryption':_0x9d8d('0x48')},'application':_0x9d8d('0x49')})}})[_0x9d8d('0x28')](function(_0x2b9a33){var _0x11de26=_0x2b9a33;if(_0x11de26['id']){def[_0x9d8d('0x4a')]=_0x11de26['id'];return BPromise[_0x9d8d('0x2b')](_0x11de26);}else{throw new Error(util[_0x9d8d('0x1f')](_0x9d8d('0x4b'),_0x317a09['id']));}});}function setRelationship(_0x102bb9,_0x2b67dd,_0x28d0d2,_0x203aef){return request({'form':{'method':'set_relationship','input_type':_0x9d8d('0x1d'),'response_type':_0x9d8d('0x1d'),'rest_data':JSON[_0x9d8d('0x1e')]({'session':_0x102bb9['id'],'module_name':_0x9d8d('0x4c'),'module_id':_0x28d0d2['id'],'link_field_name':_0x203aef,'related_ids':[_0x2b67dd['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x9d8d('0x4d')]=function(_0x1c84df,_0x428b3a,_0x142a37,_0x3c51f6,_0x43d166,_0x24979c){var _0x44e349,_0x26c56d,_0x27d89f,_0x456294;_0x24979c['remoteUri']=intUtil[_0x9d8d('0x4e')](_0x24979c[_0x9d8d('0x4f')]);_0x24979c[_0x9d8d('0x50')]=intUtil[_0x9d8d('0x4e')](_0x24979c['serverUrl']);def[_0x9d8d('0x51')]=util['format'](_0x9d8d('0x52'),_0x24979c[_0x9d8d('0x4f')]);if(_0x43d166&&_0x43d166[_0x9d8d('0x53')]){logger[_0x9d8d('0xb')](_0x9d8d('0x54'),_0x9d8d('0x55'));_0x428b3a['recordingURL']=util['format'](_0x9d8d('0x56'),_0x24979c[_0x9d8d('0x50')],_0x428b3a[_0x9d8d('0x57')],md5(_0x428b3a[_0x9d8d('0x57')]));}else{_0x428b3a['recordingURL']='';}return getConnection(_0x24979c)[_0x9d8d('0x28')](function(_0x50a3fc){_0x456294=_0x50a3fc;return getUser(_0x24979c,_0x3c51f6[_0x9d8d('0x17')],_0x456294);})['then'](function(_0x52dcfd){_0x44e349=_0x52dcfd;logger[_0x9d8d('0xb')](_0x9d8d('0x58'),_0x44e349['id']);return getEndUser(_0x24979c,_0x428b3a[_0x9d8d('0x59')],_0x428b3a[_0x9d8d('0x5a')],_0x456294);})[_0x9d8d('0x28')](function(_0x3a86e8){_0x26c56d=_0x3a86e8;logger[_0x9d8d('0xb')](_0x9d8d('0x5b'),_0x26c56d['id']);return getTicket(_0x24979c,_0x44e349,_0x26c56d,_0x142a37,_0x428b3a,_0x142a37[_0x9d8d('0x5c')],_0x456294,_0x9d8d('0x5d'));})['then'](function(_0x5719c6){_0x27d89f=_0x5719c6;logger[_0x9d8d('0xb')](_0x9d8d('0x5e'));logger['info'](_0x9d8d('0x5f'),_0x27d89f['id']);return setRelationship(_0x456294,_0x44e349,_0x27d89f,'users');})[_0x9d8d('0x28')](function(){return setRelationship(_0x456294,_0x26c56d,_0x27d89f,_0x9d8d('0x60'));})[_0x9d8d('0x28')](function(){return getServerInfo(_0x456294);})[_0x9d8d('0x28')](function(_0x212374){var _0x4aba4b=parseInt(_0x212374[_0x9d8d('0x61')][_0x9d8d('0x62')](0x0));var _0x508fa0=util[_0x9d8d('0x1f')](_0x9d8d('0x63'),_0x24979c[_0x9d8d('0x4f')],_0x27d89f['id']);if(_0x4aba4b>0x6){_0x508fa0=util[_0x9d8d('0x1f')](_0x9d8d('0x64'),_0x24979c[_0x9d8d('0x4f')],_0x27d89f['id']);}logger['info'](_0x9d8d('0x54'),_0x9d8d('0x65'));emit(util['format'](_0x9d8d('0x66'),_0x3c51f6['name']),'trigger:browser:url',{'uri':_0x508fa0});})['catch'](function(_0x37cf51){logger[_0x9d8d('0x67')](_0x9d8d('0x54'),JSON[_0x9d8d('0x1e')](_0x37cf51));});};exports[_0x9d8d('0x68')]=function(_0x2200c7,_0x371cc4,_0x56764c,_0x4e135b,_0x416432,_0x3f629a,_0x26481c){var _0x3b9989,_0x5a4d06,_0xc6e44f,_0x5f771b;_0x3f629a[_0x9d8d('0x4f')]=intUtil[_0x9d8d('0x4e')](_0x3f629a[_0x9d8d('0x4f')]);_0x3f629a[_0x9d8d('0x50')]=intUtil[_0x9d8d('0x4e')](_0x3f629a[_0x9d8d('0x50')]);def[_0x9d8d('0x51')]=util[_0x9d8d('0x1f')](_0x9d8d('0x52'),_0x3f629a[_0x9d8d('0x4f')]);if(_0x26481c&&_0x26481c[_0x9d8d('0x69')]&&_0x26481c['recordingFormat']!==_0x9d8d('0x6a')){logger[_0x9d8d('0xb')](_0x9d8d('0x6b'),'Recording\x20is\x20enabled!');_0x371cc4[_0x9d8d('0x6c')]=util[_0x9d8d('0x1f')](_0x9d8d('0x56'),_0x3f629a[_0x9d8d('0x50')],_0x371cc4[_0x9d8d('0x57')],md5(_0x371cc4['uniqueid']));}return getConnection(_0x3f629a)[_0x9d8d('0x28')](function(_0x14b563){_0x5f771b=_0x14b563;return getUser(_0x3f629a,_0x4e135b[_0x9d8d('0x17')],_0x5f771b);})['then'](function(_0xacc53a){_0x3b9989=_0xacc53a;logger[_0x9d8d('0xb')]('The\x20User\x20ID\x20is:',_0x3b9989['id']);return getEndUser(_0x3f629a,_0x371cc4[_0x9d8d('0x6d')],_0x371cc4[_0x9d8d('0x6e')],_0x5f771b);})[_0x9d8d('0x28')](function(_0x263514){_0x5a4d06=_0x263514;logger[_0x9d8d('0xb')](_0x9d8d('0x5b'),_0x5a4d06['id']);return getTicket(_0x3f629a,_0x3b9989,_0x5a4d06,_0x56764c,_0x371cc4,_0x56764c['Fields'],_0x5f771b,_0x9d8d('0x6f'));})['then'](function(_0x39e43c){_0xc6e44f=_0x39e43c;logger[_0x9d8d('0xb')](_0x9d8d('0x5e'));logger['info'](_0x9d8d('0x5f'),_0xc6e44f['id']);return setRelationship(_0x5f771b,_0x3b9989,_0xc6e44f,_0x9d8d('0x70'));})[_0x9d8d('0x28')](function(){return setRelationship(_0x5f771b,_0x5a4d06,_0xc6e44f,'contacts');})[_0x9d8d('0x28')](function(){return getServerInfo(_0x5f771b);})[_0x9d8d('0x28')](function(_0x1cedb9){var _0x9ebaef=parseInt(_0x1cedb9[_0x9d8d('0x61')][_0x9d8d('0x62')](0x0));var _0x19b5c7=util[_0x9d8d('0x1f')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x3f629a['remoteUri'],_0xc6e44f['id']);if(_0x9ebaef>0x6){_0x19b5c7=util['format'](_0x9d8d('0x64'),_0x3f629a[_0x9d8d('0x4f')],_0xc6e44f['id']);}logger[_0x9d8d('0xb')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9d8d('0x1f')](_0x9d8d('0x66'),_0x4e135b[_0x9d8d('0x17')]),'trigger:browser:url',{'uri':_0x19b5c7});})[_0x9d8d('0x71')](function(_0x26ad5c){logger[_0x9d8d('0x67')](_0x9d8d('0x6b'),JSON[_0x9d8d('0x1e')](_0x26ad5c));});};exports[_0x9d8d('0x72')]=function(_0x5a3157,_0x48c789,_0x76e4b,_0x3a0cb7,_0x58fb14,_0x575183){var _0xeffea1,_0x1a0e64,_0x5bbdf2,_0x281c00;_0x575183['remoteUri']=intUtil[_0x9d8d('0x4e')](_0x575183[_0x9d8d('0x4f')]);_0x575183[_0x9d8d('0x50')]=intUtil['stripTrailingSlash'](_0x575183['serverUrl']);def[_0x9d8d('0x51')]=util[_0x9d8d('0x1f')]('%s/service/v4_1/rest.php',_0x575183[_0x9d8d('0x4f')]);if(_0x58fb14&&_0x58fb14[_0x9d8d('0x53')]){logger[_0x9d8d('0xb')]('['+_0x48c789[_0x9d8d('0x73')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x48c789[_0x9d8d('0x6c')]=util['format'](_0x9d8d('0x56'),_0x575183[_0x9d8d('0x50')],_0x48c789[_0x9d8d('0x57')],md5(_0x48c789[_0x9d8d('0x57')]));}else{_0x48c789['recordingURL']='';}return getConnection(_0x575183)[_0x9d8d('0x28')](function(_0x4456cc){_0x281c00=_0x4456cc;if(!_[_0x9d8d('0x24')](_0x3a0cb7)){return getUser(_0x575183,_0x3a0cb7[_0x9d8d('0x17')],_0x281c00);}else{return getUser(_0x575183,null,_0x281c00);}})[_0x9d8d('0x28')](function(_0xcc3e55){_0xeffea1=_0xcc3e55;logger[_0x9d8d('0xb')](_0x9d8d('0x58'),_0xeffea1['id']);return getEndUser(_0x575183,_0x48c789['calleridname'],_0x48c789[_0x9d8d('0x5a')],_0x281c00);})[_0x9d8d('0x28')](function(_0x5c33cf){_0x1a0e64=_0x5c33cf;logger['info'](_0x9d8d('0x5b'),_0x1a0e64['id']);return getTicket(_0x575183,_0xeffea1,_0x1a0e64,_0x76e4b,_0x48c789,_0x76e4b[_0x9d8d('0x5c')],_0x281c00,_0x9d8d('0x5d'));})['then'](function(_0x1bd6f8){_0x5bbdf2=_0x1bd6f8;logger[_0x9d8d('0xb')](_0x9d8d('0x5e'));logger[_0x9d8d('0xb')](_0x9d8d('0x5f'),_0x5bbdf2['id']);return setRelationship(_0x281c00,_0xeffea1,_0x5bbdf2,_0x9d8d('0x70'));})[_0x9d8d('0x28')](function(){return setRelationship(_0x281c00,_0x1a0e64,_0x5bbdf2,_0x9d8d('0x60'));})['then'](function(){return getServerInfo(_0x281c00);})[_0x9d8d('0x71')](function(_0x32c5d8){logger[_0x9d8d('0x67')]('['+_0x48c789[_0x9d8d('0x73')]['toUpperCase']()+']',JSON[_0x9d8d('0x1e')](_0x32c5d8));});}; \ No newline at end of file +var _0xa392=['content','variable','customVariable','Variable','POST','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','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','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','Fields','Outbound','The\x20Ticket\x20ID\x20is:','version','user:%s','catch','error','unmanaged','lastevent','toUpperCase','lodash','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','emit','Creating\x20new\x20ticket...','name','Subjects','description','slice','replace','parent_type','Contacts','parent_name','direction','length','forEach','variableName','idField','set_entry','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','JSON','stringify','isNil','info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','name_value_list','user_name','Agent\x20found!','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','resolve','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','[HTTP]','merge','map','type','string','nameField','customField','toLowerCase','custom_fields','push'];(function(_0x34980c,_0x9b03e3){var _0x20826b=function(_0x3268b0){while(--_0x3268b0){_0x34980c['push'](_0x34980c['shift']());}};_0x20826b(++_0x9b03e3);}(_0xa392,0x1a8));var _0x2a39=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa392[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x2a39('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var md5=require('md5');var util=require(_0x2a39('0x1'));var Redis=require(_0x2a39('0x2'));var intUtil=require(_0x2a39('0x3'));var config=require(_0x2a39('0x4'));var logger=require(_0x2a39('0x5'))(_0x2a39('0x6'));config[_0x2a39('0x7')]=_[_0x2a39('0x8')](config[_0x2a39('0x7')],{'host':_0x2a39('0x9'),'port':0x18eb});var io=require(_0x2a39('0xa'))(new Redis(config['redis']));var def={'method':'POST','json':!![]};function emit(_0x113621,_0xbf61e0,_0x4db994){io['to'](_0x113621)[_0x2a39('0xb')](_0xbf61e0,_0x4db994);}function getTicket(_0x2fc9e6,_0x2ed902,_0x1968af,_0x5020ae,_0x4c2d5f,_0x2dc099,_0xffafe7,_0x5cdf84){logger['info'](_0x2a39('0xc'));var _0x20a680=new Date();var _0x18c54c=[{'name':_0x2a39('0xd'),'value':intUtil['getString'](_0x5020ae[_0x2a39('0xe')],_0x4c2d5f,'\x20')},{'name':'assigned_user_id','value':_0x2ed902['id']},{'name':'created_by','value':_0x2ed902['id']},{'name':_0x2a39('0xf'),'value':intUtil['getString'](_0x5020ae['Descriptions'],_0x4c2d5f,'\x0a')},{'name':'date_start','value':_0x20a680['toISOString']()[_0x2a39('0x10')](0x0,0x13)[_0x2a39('0x11')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':'duration_minutes','value':'15'},{'name':'parent_id','value':_0x1968af['id']},{'name':_0x2a39('0x12'),'value':_0x2a39('0x13')},{'name':_0x2a39('0x14'),'value':_0x1968af[_0x2a39('0xd')]},{'name':_0x2a39('0x15'),'value':_0x5cdf84}];if(_0x2dc099[_0x2a39('0x16')]){_[_0x2a39('0x17')](_0x2dc099,function(_0xd908c8){if(_0x4c2d5f[_0xd908c8[_0x2a39('0x18')]]){_0x18c54c['push']({'name':_0xd908c8[_0x2a39('0x19')],'value':_0x4c2d5f[_0xd908c8[_0x2a39('0x18')]]});}});}return request({'form':{'method':_0x2a39('0x1a'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0xffafe7['id'],'module_name':_0x2a39('0x1b'),'name_value_list':_0x18c54c})}});}function getAuth(_0xedbac0){return util[_0x2a39('0x1c')](_0x2a39('0x1d'),new Buffer(_0xedbac0[_0x2a39('0x1e')]+':X')[_0x2a39('0x1f')](_0x2a39('0x20')));}function getServerInfo(_0x3e94b5){return request({'form':{'method':_0x2a39('0x21'),'input_type':_0x2a39('0x22'),'response_type':_0x2a39('0x22'),'rest_data':JSON[_0x2a39('0x23')]({'session':_0x3e94b5['id']})}});}function getUser(_0x5ccd5d,_0x4644d3,_0x23eee9){if(!_[_0x2a39('0x24')](_0x4644d3)){logger[_0x2a39('0x25')](_0x2a39('0x26'),_0x4644d3);return request({'form':{'method':_0x2a39('0x27'),'input_type':'JSON','response_type':_0x2a39('0x22'),'rest_data':JSON[_0x2a39('0x23')]({'session':_0x23eee9['id'],'module_name':_0x2a39('0x28'),'query':util[_0x2a39('0x1c')](_0x2a39('0x29'),_0x4644d3),'order_by':'','offset':'0','select_fields':['id',_0x2a39('0xd'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x2a39('0x2a')](function(_0x5e89d9){if(_0x5e89d9[_0x2a39('0x2b')][_0x2a39('0x16')]){var _0x47a7d5=_['find'](_0x5e89d9[_0x2a39('0x2b')],function(_0xdbfa97){return _0xdbfa97[_0x2a39('0x2c')][_0x2a39('0x2d')]['value']===_0x4644d3;});if(_0x47a7d5){logger[_0x2a39('0x25')](_0x2a39('0x2e'));return BPromise['resolve']({'id':_0x47a7d5[_0x2a39('0x2c')]['id'][_0x2a39('0x2f')],'name':_0x47a7d5[_0x2a39('0x2c')][_0x2a39('0xd')]['value']});}}logger[_0x2a39('0x25')](_0x2a39('0x30'));return BPromise['resolve']({'id':_0x23eee9[_0x2a39('0x2c')][_0x2a39('0x31')][_0x2a39('0x2f')],'name':_0x23eee9[_0x2a39('0x2c')][_0x2a39('0x2d')][_0x2a39('0x2f')]});});}else{logger[_0x2a39('0x25')](_0x2a39('0x32'));return BPromise[_0x2a39('0x33')]({'id':_0x23eee9['name_value_list'][_0x2a39('0x31')]['value'],'name':_0x23eee9[_0x2a39('0x2c')][_0x2a39('0x2d')][_0x2a39('0x2f')]});}}function getEndUser(_0x1447fd,_0x417d8e,_0x351e01,_0x55e10e){logger[_0x2a39('0x25')]('Searching\x20enduser\x20with\x20phone',_0x351e01);return request({'form':{'method':_0x2a39('0x27'),'input_type':_0x2a39('0x22'),'response_type':_0x2a39('0x22'),'rest_data':JSON[_0x2a39('0x23')]({'session':_0x55e10e['id'],'module_name':_0x2a39('0x13'),'query':util['format'](_0x2a39('0x34'),_0x351e01),'order_by':'','offset':'0','select_fields':['id','name',_0x2a39('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x24d14d){if(_0x24d14d['entry_list'][_0x2a39('0x16')]){var _0x2723a3=_[_0x2a39('0x36')](_0x24d14d[_0x2a39('0x2b')],function(_0x5cc762){return _0x5cc762[_0x2a39('0x2c')][_0x2a39('0x35')][_0x2a39('0x2f')]===_0x351e01;});if(_0x2723a3){logger[_0x2a39('0x25')](_0x2a39('0x37'));return BPromise[_0x2a39('0x33')]({'id':_0x2723a3['name_value_list']['id'][_0x2a39('0x2f')],'name':_0x2723a3['name_value_list'][_0x2a39('0xd')][_0x2a39('0x2f')],'phone':_0x2723a3[_0x2a39('0x2c')]['phone_home'][_0x2a39('0x2f')]});}}else{logger[_0x2a39('0x25')](_0x2a39('0x38'));return request({'form':{'method':'set_entry','input_type':_0x2a39('0x22'),'response_type':_0x2a39('0x22'),'rest_data':JSON['stringify']({'session':_0x55e10e['id'],'module_name':_0x2a39('0x13'),'name_value_list':[{'name':'first_name','value':_0x417d8e!==_0x2a39('0x39')?_0x417d8e:util['format'](_0x2a39('0x3a'),_0x351e01)},{'name':_0x2a39('0x35'),'value':_0x351e01}]})}})[_0x2a39('0x2a')](function(_0x41f499){logger[_0x2a39('0x25')](_0x2a39('0x3b'));return BPromise['resolve']({'id':_0x41f499['id'],'name':_0x41f499['entry_list'][_0x2a39('0x3c')][_0x2a39('0x2f')],'phone':_0x41f499[_0x2a39('0x2b')]['phone_home'][_0x2a39('0x2f')]});});}});}function request(_0x545cf9){logger[_0x2a39('0x3d')](_0x2a39('0x3e'),JSON[_0x2a39('0x23')](_0x545cf9));return rp(_[_0x2a39('0x3f')](def,_0x545cf9));}function getTags(_0x2630d6,_0x40b74d){var _0x1e0aeb=[];if(_0x2630d6&&_0x2630d6[_0x2a39('0x16')]>0x0){_0x1e0aeb=_[_0x2a39('0x40')](_0x2630d6,_0x40b74d);}return _0x1e0aeb;}function getCustomFields(_0x3b9c15,_0x1db828){var _0x4c549e=[];var _0x32b27a={'custom_fields':[]};if(_0x3b9c15[_0x2a39('0x16')]>0x0){_['forEach'](_0x3b9c15,function(_0x59e3ab){if(_0x59e3ab[_0x2a39('0x41')]===_0x2a39('0x42')&&_0x59e3ab[_0x2a39('0x43')]&&!_0x59e3ab[_0x2a39('0x44')]){_0x32b27a[_0x59e3ab[_0x2a39('0x43')][_0x2a39('0x45')]()]=_0x59e3ab['content'][_0x2a39('0x1f')]();}else if(_0x59e3ab[_0x2a39('0x41')]==='string'&&_0x59e3ab[_0x2a39('0x19')]&&_0x59e3ab[_0x2a39('0x44')]){_0x32b27a[_0x2a39('0x46')][_0x2a39('0x47')]({'id':_0x59e3ab[_0x2a39('0x19')],'value':_0x59e3ab[_0x2a39('0x48')][_0x2a39('0x1f')]()});}else if(_0x59e3ab[_0x2a39('0x41')]===_0x2a39('0x49')&&_0x59e3ab[_0x2a39('0x18')]&&_0x59e3ab[_0x2a39('0x19')]&&_0x59e3ab['customField']){_0x1db828[_0x59e3ab[_0x2a39('0x18')]]&&_0x32b27a['custom_fields'][_0x2a39('0x47')]({'id':_0x59e3ab[_0x2a39('0x19')],'value':_0x1db828[_0x59e3ab[_0x2a39('0x18')]][_0x2a39('0x1f')]()});}else if(_0x59e3ab[_0x2a39('0x41')]===_0x2a39('0x4a')&&_0x59e3ab[_0x2a39('0x4b')]&&_0x59e3ab['Variable'][_0x2a39('0xd')]&&_0x59e3ab[_0x2a39('0x19')]&&_0x59e3ab[_0x2a39('0x44')]){_0x1db828[_0x59e3ab[_0x2a39('0x4b')][_0x2a39('0xd')]['toLowerCase']()]&&_0x32b27a[_0x2a39('0x46')][_0x2a39('0x47')]({'id':_0x59e3ab[_0x2a39('0x19')],'value':_0x1db828[_0x59e3ab[_0x2a39('0x4b')][_0x2a39('0xd')][_0x2a39('0x45')]()][_0x2a39('0x1f')]()});}});}return _0x32b27a;}function getConnection(_0x3a2383){return request({'method':_0x2a39('0x4c'),'form':{'method':_0x2a39('0x4d'),'input_type':_0x2a39('0x22'),'response_type':_0x2a39('0x22'),'rest_data':JSON[_0x2a39('0x23')]({'user_auth':{'user_name':_0x3a2383[_0x2a39('0x4e')],'password':_0x3a2383[_0x2a39('0x4f')],'encryption':_0x2a39('0x50')},'application':_0x2a39('0x51')})}})[_0x2a39('0x2a')](function(_0x2f8832){var _0x41ea33=_0x2f8832;if(_0x41ea33['id']){def[_0x2a39('0x52')]=_0x41ea33['id'];return BPromise[_0x2a39('0x33')](_0x41ea33);}else{throw new Error(util[_0x2a39('0x1c')](_0x2a39('0x53'),_0x3a2383['id']));}});}function setRelationship(_0x12ad45,_0x2bec51,_0x123b00,_0x34d4de){return request({'form':{'method':_0x2a39('0x54'),'input_type':_0x2a39('0x22'),'response_type':_0x2a39('0x22'),'rest_data':JSON[_0x2a39('0x23')]({'session':_0x12ad45['id'],'module_name':'Calls','module_id':_0x123b00['id'],'link_field_name':_0x34d4de,'related_ids':[_0x2bec51['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x2a39('0x55')]=function(_0x48066f,_0x514fc6,_0x25974d,_0x3e43d1,_0x492fc3,_0x2c4554){var _0x53ffe5,_0x53b7ea,_0x12b61f,_0x1221d2;_0x2c4554['remoteUri']=intUtil[_0x2a39('0x56')](_0x2c4554[_0x2a39('0x57')]);_0x2c4554[_0x2a39('0x58')]=intUtil[_0x2a39('0x56')](_0x2c4554[_0x2a39('0x58')]);def[_0x2a39('0x59')]=util['format'](_0x2a39('0x5a'),_0x2c4554['remoteUri']);if(_0x492fc3&&_0x492fc3[_0x2a39('0x5b')]){logger[_0x2a39('0x25')]('[QUEUE]',_0x2a39('0x5c'));_0x514fc6[_0x2a39('0x5d')]=util[_0x2a39('0x1c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2c4554[_0x2a39('0x58')],_0x514fc6[_0x2a39('0x5e')],md5(_0x514fc6[_0x2a39('0x5e')]));}else{_0x514fc6[_0x2a39('0x5d')]='';}return getConnection(_0x2c4554)[_0x2a39('0x2a')](function(_0x245830){_0x1221d2=_0x245830;return getUser(_0x2c4554,_0x3e43d1[_0x2a39('0xd')],_0x1221d2);})[_0x2a39('0x2a')](function(_0x3083b){_0x53ffe5=_0x3083b;logger[_0x2a39('0x25')](_0x2a39('0x5f'),_0x53ffe5['id']);return getEndUser(_0x2c4554,_0x514fc6[_0x2a39('0x60')],_0x514fc6[_0x2a39('0x61')],_0x1221d2);})['then'](function(_0x4b4272){_0x53b7ea=_0x4b4272;logger[_0x2a39('0x25')](_0x2a39('0x62'),_0x53b7ea['id']);return getTicket(_0x2c4554,_0x53ffe5,_0x53b7ea,_0x25974d,_0x514fc6,_0x25974d['Fields'],_0x1221d2,_0x2a39('0x63'));})[_0x2a39('0x2a')](function(_0x4b388c){_0x12b61f=_0x4b388c;logger[_0x2a39('0x25')](_0x2a39('0x64'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x12b61f['id']);return setRelationship(_0x1221d2,_0x53ffe5,_0x12b61f,_0x2a39('0x65'));})[_0x2a39('0x2a')](function(){return setRelationship(_0x1221d2,_0x53b7ea,_0x12b61f,_0x2a39('0x66'));})['then'](function(){return getServerInfo(_0x1221d2);})['then'](function(_0x4b5ebf){var _0x2790e8=parseInt(_0x4b5ebf['version'][_0x2a39('0x67')](0x0));var _0x4c54b6=util[_0x2a39('0x1c')](_0x2a39('0x68'),_0x2c4554[_0x2a39('0x57')],_0x12b61f['id']);if(_0x2790e8>0x6){_0x4c54b6=util[_0x2a39('0x1c')](_0x2a39('0x69'),_0x2c4554['remoteUri'],_0x12b61f['id']);}logger[_0x2a39('0x25')](_0x2a39('0x6a'),_0x2a39('0x6b'));emit(util[_0x2a39('0x1c')]('user:%s',_0x3e43d1[_0x2a39('0xd')]),_0x2a39('0x6c'),{'uri':_0x4c54b6});})['catch'](function(_0x150058){logger['error'](_0x2a39('0x6a'),JSON['stringify'](_0x150058));});};exports['outbound']=function(_0x2e781e,_0x1863f0,_0x121192,_0x51c05c,_0x157dcd,_0xc57083,_0x4fe038){var _0x5b6ce0,_0x4e8398,_0x3bf7bd,_0x3d7e7f;_0xc57083['remoteUri']=intUtil['stripTrailingSlash'](_0xc57083[_0x2a39('0x57')]);_0xc57083['serverUrl']=intUtil[_0x2a39('0x56')](_0xc57083[_0x2a39('0x58')]);def[_0x2a39('0x59')]=util[_0x2a39('0x1c')](_0x2a39('0x5a'),_0xc57083['remoteUri']);if(_0x4fe038&&_0x4fe038[_0x2a39('0x6d')]&&_0x4fe038[_0x2a39('0x6d')]!==_0x2a39('0x6e')){logger['info'](_0x2a39('0x6f'),_0x2a39('0x5c'));_0x1863f0[_0x2a39('0x5d')]=util[_0x2a39('0x1c')](_0x2a39('0x70'),_0xc57083[_0x2a39('0x58')],_0x1863f0[_0x2a39('0x5e')],md5(_0x1863f0['uniqueid']));}return getConnection(_0xc57083)[_0x2a39('0x2a')](function(_0x324b40){_0x3d7e7f=_0x324b40;return getUser(_0xc57083,_0x51c05c[_0x2a39('0xd')],_0x3d7e7f);})[_0x2a39('0x2a')](function(_0x3b74f3){_0x5b6ce0=_0x3b74f3;logger[_0x2a39('0x25')](_0x2a39('0x5f'),_0x5b6ce0['id']);return getEndUser(_0xc57083,_0x1863f0[_0x2a39('0x71')],_0x1863f0['destcalleridnum'],_0x3d7e7f);})[_0x2a39('0x2a')](function(_0x32a230){_0x4e8398=_0x32a230;logger[_0x2a39('0x25')](_0x2a39('0x62'),_0x4e8398['id']);return getTicket(_0xc57083,_0x5b6ce0,_0x4e8398,_0x121192,_0x1863f0,_0x121192[_0x2a39('0x72')],_0x3d7e7f,_0x2a39('0x73'));})[_0x2a39('0x2a')](function(_0x363597){_0x3bf7bd=_0x363597;logger[_0x2a39('0x25')]('Ticket\x20created!');logger['info'](_0x2a39('0x74'),_0x3bf7bd['id']);return setRelationship(_0x3d7e7f,_0x5b6ce0,_0x3bf7bd,_0x2a39('0x65'));})[_0x2a39('0x2a')](function(){return setRelationship(_0x3d7e7f,_0x4e8398,_0x3bf7bd,_0x2a39('0x66'));})[_0x2a39('0x2a')](function(){return getServerInfo(_0x3d7e7f);})[_0x2a39('0x2a')](function(_0x33c1a2){var _0x4b303d=parseInt(_0x33c1a2[_0x2a39('0x75')][_0x2a39('0x67')](0x0));var _0x569906=util[_0x2a39('0x1c')](_0x2a39('0x68'),_0xc57083[_0x2a39('0x57')],_0x3bf7bd['id']);if(_0x4b303d>0x6){_0x569906=util[_0x2a39('0x1c')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0xc57083[_0x2a39('0x57')],_0x3bf7bd['id']);}logger[_0x2a39('0x25')](_0x2a39('0x6f'),_0x2a39('0x6b'));emit(util[_0x2a39('0x1c')](_0x2a39('0x76'),_0x51c05c[_0x2a39('0xd')]),_0x2a39('0x6c'),{'uri':_0x569906});})[_0x2a39('0x77')](function(_0x13384e){logger[_0x2a39('0x78')]('[OUTBOUND]',JSON[_0x2a39('0x23')](_0x13384e));});};exports[_0x2a39('0x79')]=function(_0x136618,_0x684f23,_0xffb9ed,_0x2ae7fb,_0x3200c8,_0x550ee0){var _0x4a39c9,_0x261279,_0x11e138,_0x229cd4;_0x550ee0[_0x2a39('0x57')]=intUtil[_0x2a39('0x56')](_0x550ee0[_0x2a39('0x57')]);_0x550ee0[_0x2a39('0x58')]=intUtil['stripTrailingSlash'](_0x550ee0['serverUrl']);def['uri']=util[_0x2a39('0x1c')](_0x2a39('0x5a'),_0x550ee0[_0x2a39('0x57')]);if(_0x3200c8&&_0x3200c8[_0x2a39('0x5b')]){logger[_0x2a39('0x25')]('['+_0x684f23[_0x2a39('0x7a')][_0x2a39('0x7b')]()+']','Recording\x20is\x20enabled!');_0x684f23[_0x2a39('0x5d')]=util[_0x2a39('0x1c')](_0x2a39('0x70'),_0x550ee0[_0x2a39('0x58')],_0x684f23[_0x2a39('0x5e')],md5(_0x684f23['uniqueid']));}else{_0x684f23[_0x2a39('0x5d')]='';}return getConnection(_0x550ee0)[_0x2a39('0x2a')](function(_0x3d8332){_0x229cd4=_0x3d8332;if(!_['isNil'](_0x2ae7fb)){return getUser(_0x550ee0,_0x2ae7fb['name'],_0x229cd4);}else{return getUser(_0x550ee0,null,_0x229cd4);}})[_0x2a39('0x2a')](function(_0x57f113){_0x4a39c9=_0x57f113;logger[_0x2a39('0x25')](_0x2a39('0x5f'),_0x4a39c9['id']);return getEndUser(_0x550ee0,_0x684f23[_0x2a39('0x60')],_0x684f23[_0x2a39('0x61')],_0x229cd4);})[_0x2a39('0x2a')](function(_0x59e6b2){_0x261279=_0x59e6b2;logger[_0x2a39('0x25')]('The\x20Enduser\x20ID\x20is:',_0x261279['id']);return getTicket(_0x550ee0,_0x4a39c9,_0x261279,_0xffb9ed,_0x684f23,_0xffb9ed[_0x2a39('0x72')],_0x229cd4,_0x2a39('0x63'));})[_0x2a39('0x2a')](function(_0x3c1a14){_0x11e138=_0x3c1a14;logger[_0x2a39('0x25')]('Ticket\x20created!');logger[_0x2a39('0x25')](_0x2a39('0x74'),_0x11e138['id']);return setRelationship(_0x229cd4,_0x4a39c9,_0x11e138,'users');})[_0x2a39('0x2a')](function(){return setRelationship(_0x229cd4,_0x261279,_0x11e138,_0x2a39('0x66'));})[_0x2a39('0x2a')](function(){return getServerInfo(_0x229cd4);})[_0x2a39('0x77')](function(_0x275528){logger['error']('['+_0x684f23[_0x2a39('0x7a')][_0x2a39('0x7b')]()+']',JSON[_0x2a39('0x23')](_0x275528));});}; \ 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 1ebc708..c3e9023 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 _0x70fe=['lodash','util','getString','length','sortBy','string','push','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','join','substring','lastIndexOf','isNil','test'];(function(_0x110dc0,_0x3a6615){var _0x39aeb1=function(_0x46fa33){while(--_0x46fa33){_0x110dc0['push'](_0x110dc0['shift']());}};_0x39aeb1(++_0x3a6615);}(_0x70fe,0xd0));var _0xe70f=function(_0x39fc77,_0x5d1690){_0x39fc77=_0x39fc77-0x0;var _0x4f7478=_0x70fe[_0x39fc77];return _0x4f7478;};'use strict';var _=require(_0xe70f('0x0'));var util=require(_0xe70f('0x1'));exports[_0xe70f('0x2')]=function(_0x2605ab,_0x32a8d1,_0x2f9375){var _0x4b1214=[];if(_0x2605ab[_0xe70f('0x3')]>0x0){var _0x167629=_[_0xe70f('0x4')](_0x2605ab,['id']);for(var _0xb1c238=0x0;_0xb1c238<_0x167629['length'];_0xb1c238++){var _0x40d26a=_0x167629[_0xb1c238];if(_0x40d26a['type']===_0xe70f('0x5')){_0x4b1214[_0xe70f('0x6')](_0x40d26a[_0xe70f('0x7')]);}else if(_0x40d26a[_0xe70f('0x8')]===_0xe70f('0x9')&&_0x40d26a[_0xe70f('0xa')]){_0x32a8d1[_0x40d26a[_0xe70f('0xa')]]&&_0x4b1214['push'](_0x32a8d1[_0x40d26a['variableName']][_0xe70f('0xb')]());}else if(_0x40d26a['type']===_0xe70f('0xc')&&_0x40d26a[_0xe70f('0xd')]&&_0x40d26a[_0xe70f('0xd')][_0xe70f('0xe')]){_0x32a8d1[_0x40d26a[_0xe70f('0xd')]['name']['toLowerCase']()]&&_0x4b1214[_0xe70f('0x6')](_0x32a8d1[_0x40d26a[_0xe70f('0xd')][_0xe70f('0xe')][_0xe70f('0xf')]()][_0xe70f('0xb')]());}else if(_0x40d26a['type']===_0xe70f('0x10')){if(_0x40d26a[_0xe70f('0x11')]===_0xe70f('0x5')&&_0x40d26a[_0xe70f('0x12')]){_0x4b1214[_0xe70f('0x6')](util[_0xe70f('0x13')](_0xe70f('0x14'),_0x40d26a[_0xe70f('0x12')],_0x40d26a['keyContent']));}else if(_0x40d26a[_0xe70f('0x11')]===_0xe70f('0x9')&&_0x40d26a[_0xe70f('0xa')]&&_0x40d26a[_0xe70f('0x12')]){_0x32a8d1[_0x40d26a['variableName']]&&_0x4b1214[_0xe70f('0x6')](util[_0xe70f('0x13')]('%s:\x20%s',_0x40d26a[_0xe70f('0x12')],_0x32a8d1[_0x40d26a[_0xe70f('0xa')]]));}else if(_0x40d26a[_0xe70f('0x11')]==='customVariable'&&_0x40d26a['Variable']&&_0x40d26a[_0xe70f('0xd')][_0xe70f('0xe')]&&_0x40d26a[_0xe70f('0x12')]){_0x32a8d1[_0x40d26a['Variable'][_0xe70f('0xe')][_0xe70f('0xf')]()]&&_0x4b1214[_0xe70f('0x6')](util[_0xe70f('0x13')](_0xe70f('0x14'),_0x40d26a['key'],_0x32a8d1[_0x40d26a[_0xe70f('0xd')][_0xe70f('0xe')][_0xe70f('0xf')]()]));}}}}return _0x4b1214[_0xe70f('0x15')](_0x2f9375);};exports['stripTrailingSlash']=function(_0x15b6b1){var _0x2683a9=_0x15b6b1['slice'](-0x1);if(_0x2683a9==='/'){_0x15b6b1=_0x15b6b1[_0xe70f('0x16')](0x0,_0x15b6b1[_0xe70f('0x17')](_0x2683a9));}return _0x15b6b1;};exports['validateEmail']=function(_0x44780e){if(!_[_0xe70f('0x18')](_0x44780e)&&_0x44780e!==''){var _0x574db6=/^(([^<>()\[\]\\.,;:\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 _0x574db6[_0xe70f('0x19')](String(_0x44780e)[_0xe70f('0xf')]());}else{return![];}}; \ No newline at end of file +var _0x34d1=['test','lodash','util','getString','length','sortBy','type','string','push','content','variable','variableName','Variable','name','toLowerCase','toString','keyValue','keyType','key','keyContent','format','%s:\x20%s','join','stripTrailingSlash','substring','lastIndexOf','validateEmail','isNil'];(function(_0xf166de,_0x335fa7){var _0x4434f7=function(_0x1c5121){while(--_0x1c5121){_0xf166de['push'](_0xf166de['shift']());}};_0x4434f7(++_0x335fa7);}(_0x34d1,0x135));var _0x134d=function(_0x22cd45,_0x44062f){_0x22cd45=_0x22cd45-0x0;var _0x169481=_0x34d1[_0x22cd45];return _0x169481;};'use strict';var _=require(_0x134d('0x0'));var util=require(_0x134d('0x1'));exports[_0x134d('0x2')]=function(_0x2df0c0,_0x5739f4,_0x38bc6f){var _0x4a0173=[];if(_0x2df0c0[_0x134d('0x3')]>0x0){var _0xec57ac=_[_0x134d('0x4')](_0x2df0c0,['id']);for(var _0x44a950=0x0;_0x44a950<_0xec57ac[_0x134d('0x3')];_0x44a950++){var _0x8fc53b=_0xec57ac[_0x44a950];if(_0x8fc53b[_0x134d('0x5')]===_0x134d('0x6')){_0x4a0173[_0x134d('0x7')](_0x8fc53b[_0x134d('0x8')]);}else if(_0x8fc53b[_0x134d('0x5')]===_0x134d('0x9')&&_0x8fc53b[_0x134d('0xa')]){_0x5739f4[_0x8fc53b[_0x134d('0xa')]]&&_0x4a0173[_0x134d('0x7')](_0x5739f4[_0x8fc53b['variableName']]['toString']());}else if(_0x8fc53b[_0x134d('0x5')]==='customVariable'&&_0x8fc53b[_0x134d('0xb')]&&_0x8fc53b[_0x134d('0xb')][_0x134d('0xc')]){_0x5739f4[_0x8fc53b['Variable'][_0x134d('0xc')][_0x134d('0xd')]()]&&_0x4a0173['push'](_0x5739f4[_0x8fc53b['Variable'][_0x134d('0xc')][_0x134d('0xd')]()][_0x134d('0xe')]());}else if(_0x8fc53b[_0x134d('0x5')]===_0x134d('0xf')){if(_0x8fc53b[_0x134d('0x10')]===_0x134d('0x6')&&_0x8fc53b[_0x134d('0x11')]){_0x4a0173['push'](util['format']('%s:\x20%s',_0x8fc53b['key'],_0x8fc53b[_0x134d('0x12')]));}else if(_0x8fc53b[_0x134d('0x10')]==='variable'&&_0x8fc53b[_0x134d('0xa')]&&_0x8fc53b[_0x134d('0x11')]){_0x5739f4[_0x8fc53b['variableName']]&&_0x4a0173['push'](util[_0x134d('0x13')](_0x134d('0x14'),_0x8fc53b['key'],_0x5739f4[_0x8fc53b[_0x134d('0xa')]]));}else if(_0x8fc53b[_0x134d('0x10')]==='customVariable'&&_0x8fc53b[_0x134d('0xb')]&&_0x8fc53b['Variable'][_0x134d('0xc')]&&_0x8fc53b[_0x134d('0x11')]){_0x5739f4[_0x8fc53b['Variable']['name'][_0x134d('0xd')]()]&&_0x4a0173[_0x134d('0x7')](util['format'](_0x134d('0x14'),_0x8fc53b[_0x134d('0x11')],_0x5739f4[_0x8fc53b[_0x134d('0xb')]['name'][_0x134d('0xd')]()]));}}}}return _0x4a0173[_0x134d('0x15')](_0x38bc6f);};exports[_0x134d('0x16')]=function(_0x2218b1){var _0x87970=_0x2218b1['slice'](-0x1);if(_0x87970==='/'){_0x2218b1=_0x2218b1[_0x134d('0x17')](0x0,_0x2218b1[_0x134d('0x18')](_0x87970));}return _0x2218b1;};exports[_0x134d('0x19')]=function(_0x2f3795){if(!_[_0x134d('0x1a')](_0x2f3795)&&_0x2f3795!==''){var _0x29d93c=/^(([^<>()\[\]\\.,;:\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 _0x29d93c[_0x134d('0x1b')](String(_0x2f3795)[_0x134d('0xd')]());}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 1da7dd8..e027f89 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(_0x5eb095,_0x1e27a8){var _0x198e3c=function(_0x5110ae){while(--_0x5110ae){_0x5eb095['push'](_0x5eb095['shift']());}};_0x198e3c(++_0x1e27a8);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'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(_0x2549c2,_0x115b47){var _0x142c1b=function(_0x4ea3f1){while(--_0x4ea3f1){_0x2549c2['push'](_0x2549c2['shift']());}};_0x142c1b(++_0x115b47);}(_0x34e8,0x12c));var _0x834e=function(_0x3dcae7,_0x1bf2f9){_0x3dcae7=_0x3dcae7-0x0;var _0xedad40=_0x34e8[_0x3dcae7];return _0xedad40;};'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 45b5e2f..0834662 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 _0x389f=['stringify','GET','map','forEach','includes','string','picklist','nameField','content','type','idField','customField','custom_fields','push','variable','variableName','customVariable','Variable','name','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','[OUTBOUND]','Authorization','email','%s/agent/tickets/%s','inspect','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','ioredis','./util','../../../../config/logger','zendesk','defaults','redis','localhost','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','merge','Tags','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','%s/search.json','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Searching\x20enduser\x20with\x20phone','filter','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','end-user','Caller\x20-\x20%s','Enduser\x20created.','password','%s:%s','username','authType','token','%s/token:%s','toString','base64','debug','[HTTP]'];(function(_0x1891c4,_0x190b1f){var _0x1aab80=function(_0x3162a3){while(--_0x3162a3){_0x1891c4['push'](_0x1891c4['shift']());}};_0x1aab80(++_0x190b1f);}(_0x389f,0x118));var _0xf389=function(_0x3c12e0,_0x4d6975){_0x3c12e0=_0x3c12e0-0x0;var _0x558fdd=_0x389f[_0x3c12e0];return _0x558fdd;};'use strict';var _=require(_0xf389('0x0'));var rp=require(_0xf389('0x1'));var md5=require(_0xf389('0x2'));var util=require('util');var Redis=require(_0xf389('0x3'));var intUtil=require(_0xf389('0x4'));var config=require('../../../../config/environment');var logger=require(_0xf389('0x5'))(_0xf389('0x6'));config['redis']=_[_0xf389('0x7')](config[_0xf389('0x8')],{'host':_0xf389('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf389('0x8')]));function emit(_0x328aa9,_0x78ad21,_0x27ec5d){io['to'](_0x328aa9)[_0xf389('0xa')](_0x78ad21,_0x27ec5d);}var headers={'Content-Type':_0xf389('0xb'),'Accept':_0xf389('0xb')};function getTicket(_0x568105,_0x5a62e6,_0x505658,_0x2aea92,_0x84aca2){logger[_0xf389('0xc')](_0xf389('0xd'));return request({'uri':util['format'](_0xf389('0xe'),_0x568105[_0xf389('0xf')]),'method':_0xf389('0x10'),'body':{'ticket':_[_0xf389('0x11')]({'requester_id':_0x505658['id'],'submitter_id':_0x5a62e6?_0x5a62e6['id']:undefined,'assignee_id':_0x5a62e6?_0x5a62e6['id']:undefined,'tags':getTags(_0x2aea92[_0xf389('0x12')],'name'),'subject':intUtil['getString'](_0x2aea92['Subjects'],_0x84aca2,'\x20'),'description':intUtil[_0xf389('0x13')](_0x2aea92[_0xf389('0x14')],_0x84aca2,'\x0a'),'comment':{'public':![],'body':intUtil[_0xf389('0x13')](_0x2aea92[_0xf389('0x14')],_0x84aca2,'\x0a')}},getCustomFields(_0x2aea92[_0xf389('0x15')],_0x84aca2))}})[_0xf389('0x16')](function(_0x436283){logger[_0xf389('0xc')](_0xf389('0x17'));return _0x436283[_0xf389('0x18')];});}function getUser(_0x33f9cc,_0x71ffbb){if(intUtil[_0xf389('0x19')](_0x71ffbb)){logger[_0xf389('0xc')](_0xf389('0x1a'),_0x71ffbb);return request({'uri':util[_0xf389('0x1b')](_0xf389('0x1c'),_0x33f9cc[_0xf389('0xf')]),'qs':{'query':util[_0xf389('0x1b')](_0xf389('0x1d'),_0x71ffbb)}})[_0xf389('0x16')](function(_0xc8e783){if(_0xc8e783['count']){logger[_0xf389('0xc')](_0xf389('0x1e'));return _[_0xf389('0x1f')](_0xc8e783[_0xf389('0x20')],{'email':_0x71ffbb,'role':_0xf389('0x21')});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf389('0x1b')]('%s/users/me.json',_0x33f9cc['remoteUri'])})['then'](function(_0x26ea4f){logger[_0xf389('0xc')]('Admin\x20account\x20selected.');return _0x26ea4f['user'];});}});}else{logger[_0xf389('0xc')](_0xf389('0x22'));return request({'uri':util[_0xf389('0x1b')](_0xf389('0x23'),_0x33f9cc[_0xf389('0xf')])})[_0xf389('0x16')](function(_0x4fe25a){logger[_0xf389('0xc')]('Admin\x20account\x20selected.');return _0x4fe25a[_0xf389('0x24')];});}}function getEndUser(_0x1362a0,_0x16540b,_0x5bc5ae){logger[_0xf389('0xc')](_0xf389('0x25'),_0x5bc5ae);return request({'uri':util[_0xf389('0x1b')](_0xf389('0x1c'),_0x1362a0[_0xf389('0xf')]),'qs':{'query':util[_0xf389('0x1b')]('type:user\x20role:end-user\x20phone:%s',_0x5bc5ae)}})[_0xf389('0x16')](function(_0x27da2b){var _0x1d892c;if(_0x27da2b['results']['length']){_0x27da2b[_0xf389('0x20')]=_[_0xf389('0x26')](_0x27da2b[_0xf389('0x20')],{'suspended':![],'role':'end-user'});if(_0x27da2b[_0xf389('0x20')][_0xf389('0x27')]){_0x1d892c=_[_0xf389('0x28')](_0x27da2b[_0xf389('0x20')]);}}if(_0x1d892c){logger[_0xf389('0xc')](_0xf389('0x29'));return _0x1d892c;}else{logger[_0xf389('0xc')](_0xf389('0x2a'));return request({'uri':util[_0xf389('0x1b')]('%s/users.json',_0x1362a0['remoteUri']),'method':_0xf389('0x10'),'body':{'user':{'role':_0xf389('0x2b'),'name':util[_0xf389('0x1b')](_0xf389('0x2c'),_0x16540b||_0x5bc5ae),'phone':_0x5bc5ae}}})[_0xf389('0x16')](function(_0x30c13e){logger[_0xf389('0xc')](_0xf389('0x2d'));return _0x30c13e[_0xf389('0x24')];});}});}function getAuth(_0x2a76b2){var _0x2d196f;if(_0x2a76b2['authType']===_0xf389('0x2e')){_0x2d196f=util[_0xf389('0x1b')](_0xf389('0x2f'),_0x2a76b2[_0xf389('0x30')],_0x2a76b2[_0xf389('0x2e')]);}else if(_0x2a76b2[_0xf389('0x31')]===_0xf389('0x32')){_0x2d196f=util[_0xf389('0x1b')](_0xf389('0x33'),_0x2a76b2[_0xf389('0x30')],_0x2a76b2[_0xf389('0x32')]);}return util[_0xf389('0x1b')]('Basic\x20%s',new Buffer(_0x2d196f)[_0xf389('0x34')](_0xf389('0x35')));}function request(_0x1bf239){logger[_0xf389('0x36')](_0xf389('0x37'),JSON[_0xf389('0x38')](_0x1bf239));return rp(_[_0xf389('0x7')](_0x1bf239,{'method':_0xf389('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x488763,_0x48c5e4){var _0x26e46e=[];if(_0x488763&&_0x488763[_0xf389('0x27')]>0x0){_0x26e46e=_[_0xf389('0x3a')](_0x488763,_0x48c5e4);}return _0x26e46e;}function getCustomFields(_0x472fea,_0x4501bb){var _0xa20d70=[];var _0x393505={'custom_fields':[]};if(_0x472fea[_0xf389('0x27')]>0x0){_[_0xf389('0x3b')](_0x472fea,function(_0x61cccf){if(_[_0xf389('0x3c')]([_0xf389('0x3d'),_0xf389('0x3e')],_0x61cccf['type'])&&_0x61cccf[_0xf389('0x3f')]&&!_0x61cccf['customField']){_0x393505[_0x61cccf[_0xf389('0x3f')]['toLowerCase']()]=_0x61cccf[_0xf389('0x40')][_0xf389('0x34')]();}else if(_[_0xf389('0x3c')]([_0xf389('0x3d'),_0xf389('0x3e')],_0x61cccf[_0xf389('0x41')])&&_0x61cccf[_0xf389('0x42')]&&_0x61cccf[_0xf389('0x43')]){_0x393505[_0xf389('0x44')][_0xf389('0x45')]({'id':_0x61cccf[_0xf389('0x42')],'value':_0x61cccf[_0xf389('0x40')][_0xf389('0x34')]()});}else if(_0x61cccf[_0xf389('0x41')]===_0xf389('0x46')&&_0x61cccf[_0xf389('0x47')]&&_0x61cccf[_0xf389('0x42')]&&_0x61cccf[_0xf389('0x43')]){_0x4501bb[_0x61cccf[_0xf389('0x47')]]&&_0x393505[_0xf389('0x44')]['push']({'id':_0x61cccf['idField'],'value':_0x4501bb[_0x61cccf[_0xf389('0x47')]][_0xf389('0x34')]()});}else if(_0x61cccf[_0xf389('0x41')]===_0xf389('0x48')&&_0x61cccf[_0xf389('0x49')]&&_0x61cccf['Variable'][_0xf389('0x4a')]&&_0x61cccf[_0xf389('0x42')]&&_0x61cccf[_0xf389('0x43')]){_0x4501bb[_0x61cccf[_0xf389('0x49')][_0xf389('0x4a')][_0xf389('0x4b')]()]&&_0x393505[_0xf389('0x44')]['push']({'id':_0x61cccf[_0xf389('0x42')],'value':_0x4501bb[_0x61cccf[_0xf389('0x49')][_0xf389('0x4a')][_0xf389('0x4b')]()][_0xf389('0x34')]()});}});}return _0x393505;}exports[_0xf389('0x4c')]=function(_0x11161f,_0x4805ed,_0xe430c9,_0x306bb9,_0x98befd,_0x1bb314){var _0xb95264,_0x5c6694;_0x1bb314['remoteUri']=intUtil[_0xf389('0x4d')](_0x1bb314[_0xf389('0xf')]);_0x1bb314[_0xf389('0x4e')]=intUtil[_0xf389('0x4d')](_0x1bb314['serverUrl']);if(_0x98befd&&_0x98befd[_0xf389('0x4f')]){logger[_0xf389('0xc')]('[QUEUE]',_0xf389('0x50'));_0x4805ed[_0xf389('0x51')]=util[_0xf389('0x1b')](_0xf389('0x52'),_0x1bb314[_0xf389('0x4e')],_0x4805ed[_0xf389('0x53')],md5(_0x4805ed[_0xf389('0x53')]));}else{_0x4805ed['recordingURL']='';}headers['Authorization']=getAuth(_0x1bb314);return getUser(_0x1bb314,_0x306bb9['email'])[_0xf389('0x16')](function(_0x5242d3){_0xb95264=_0x5242d3;logger[_0xf389('0xc')](_0xf389('0x54'),_0xb95264['id']);return getEndUser(_0x1bb314,_0x4805ed[_0xf389('0x55')],_0x4805ed[_0xf389('0x56')]);})[_0xf389('0x16')](function(_0x42bb9b){_0x5c6694=_0x42bb9b;logger['info'](_0xf389('0x57'),_0x5c6694['id']);return getTicket(_0x1bb314,_0xb95264,_0x5c6694,_0xe430c9,_0x4805ed);})[_0xf389('0x16')](function(_0x3a5cea){if(_0x3a5cea){logger[_0xf389('0xc')](_0xf389('0x58'),_0x3a5cea['id']);switch(_0x1bb314['type']){case _0xf389('0x59'):logger[_0xf389('0xc')](_0xf389('0x5a'),_0xf389('0x5b'));return request({'uri':util['format'](_0xf389('0x5c'),_0x1bb314['remoteUri'],_0xb95264['id'],_0x3a5cea['id']),'method':_0xf389('0x10')});case _0xf389('0x5d'):logger[_0xf389('0xc')]('[QUEUE]',_0xf389('0x5e'));emit(util['format'](_0xf389('0x5f'),_0x306bb9['name']),'trigger:browser:url',{'uri':util[_0xf389('0x1b')]('%s/agent/tickets/%s',_0x1bb314['remoteUri']['replace'](_0xf389('0x60'),''),_0x3a5cea['id'])});break;default:logger[_0xf389('0x61')](_0xf389('0x5a'),_0xf389('0x62'));}}})[_0xf389('0x63')](function(_0x5b2714){logger[_0xf389('0x61')](_0xf389('0x64'),util['inspect'](_0x5b2714,{'showHidden':!![],'depth':null}));});};exports[_0xf389('0x65')]=function(_0x1ac7bc,_0x414420,_0x354950,_0x47195a,_0x23f93c,_0x13259d,_0x1d9bc8){var _0x5f0f38,_0x5263eb;_0x13259d[_0xf389('0xf')]=intUtil[_0xf389('0x4d')](_0x13259d[_0xf389('0xf')]);_0x13259d[_0xf389('0x4e')]=intUtil[_0xf389('0x4d')](_0x13259d['serverUrl']);if(_0x1d9bc8&&_0x1d9bc8['recordingFormat']&&_0x1d9bc8[_0xf389('0x66')]!==_0xf389('0x67')){logger[_0xf389('0xc')](_0xf389('0x68'),_0xf389('0x50'));_0x414420[_0xf389('0x51')]=util[_0xf389('0x1b')](_0xf389('0x52'),_0x13259d[_0xf389('0x4e')],_0x414420[_0xf389('0x53')],md5(_0x414420[_0xf389('0x53')]));}headers[_0xf389('0x69')]=getAuth(_0x13259d);return getUser(_0x13259d,_0x47195a[_0xf389('0x6a')])[_0xf389('0x16')](function(_0x30b3c3){_0x5f0f38=_0x30b3c3;logger['info'](_0xf389('0x54'),_0x5f0f38['id']);return getEndUser(_0x13259d,_0x414420['destcalleridname'],_0x414420['destcalleridnum']);})[_0xf389('0x16')](function(_0x3f1500){_0x5263eb=_0x3f1500;logger[_0xf389('0xc')](_0xf389('0x57'),_0x5263eb['id']);return getTicket(_0x13259d,_0x5f0f38,_0x5263eb,_0x354950,_0x414420);})[_0xf389('0x16')](function(_0x214014){if(_0x214014){logger['info'](_0xf389('0x58'),_0x214014['id']);switch(_0x13259d[_0xf389('0x41')]){case'integrationTab':logger[_0xf389('0xc')](_0xf389('0x68'),_0xf389('0x5b'));return request({'uri':util[_0xf389('0x1b')](_0xf389('0x5c'),_0x13259d[_0xf389('0xf')],_0x5f0f38['id'],_0x214014['id']),'method':_0xf389('0x10')});case _0xf389('0x5d'):logger[_0xf389('0xc')](_0xf389('0x68'),_0xf389('0x5e'));emit(util['format'](_0xf389('0x5f'),_0x47195a[_0xf389('0x4a')]),'trigger:browser:url',{'uri':util[_0xf389('0x1b')](_0xf389('0x6b'),_0x13259d[_0xf389('0xf')]['replace'](_0xf389('0x60'),''),_0x214014['id'])});break;default:logger[_0xf389('0x61')](_0xf389('0x68'),_0xf389('0x62'));}}})['catch'](function(_0x1459e9){logger[_0xf389('0x61')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0xf389('0x6c')](_0x1459e9,{'showHidden':!![],'depth':null}));});};exports[_0xf389('0x6d')]=function(_0x2341a7,_0x54d629,_0x7b2a8d,_0x471b7b,_0x5384cd,_0x2d4aa7){var _0x3dc5ff,_0x25e62b;_0x2d4aa7[_0xf389('0xf')]=intUtil[_0xf389('0x4d')](_0x2d4aa7['remoteUri']);_0x2d4aa7[_0xf389('0x4e')]=intUtil['stripTrailingSlash'](_0x2d4aa7[_0xf389('0x4e')]);if(_0x5384cd&&_0x5384cd[_0xf389('0x4f')]){logger[_0xf389('0xc')]('['+_0x54d629[_0xf389('0x6e')][_0xf389('0x6f')]()+']','Recording\x20is\x20enabled!');_0x54d629[_0xf389('0x51')]=util[_0xf389('0x1b')](_0xf389('0x52'),_0x2d4aa7['serverUrl'],_0x54d629[_0xf389('0x53')],md5(_0x54d629[_0xf389('0x53')]));}else{_0x54d629[_0xf389('0x51')]='';}headers[_0xf389('0x69')]=getAuth(_0x2d4aa7);return getUser(_0x2d4aa7)[_0xf389('0x16')](function(_0x4bde8b){_0x3dc5ff=_0x4bde8b;logger['info'](_0xf389('0x54'),_0x3dc5ff['id']);return getEndUser(_0x2d4aa7,_0x54d629[_0xf389('0x55')],_0x54d629[_0xf389('0x56')]);})[_0xf389('0x16')](function(_0x2e3950){_0x25e62b=_0x2e3950;logger[_0xf389('0xc')](_0xf389('0x57'),_0x25e62b['id']);return getTicket(_0x2d4aa7,_0x3dc5ff,_0x25e62b,_0x7b2a8d,_0x54d629);})['then'](function(_0x4bb935){if(_0x4bb935){logger[_0xf389('0xc')](_0xf389('0x58'),_0x4bb935['id']);}})['catch'](function(_0x470338){logger[_0xf389('0x61')]('['+_0x54d629[_0xf389('0x6e')]['toUpperCase']()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0xf389('0x6c')](_0x470338,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xcc89=['calleridname','calleridnum','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','POST','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','trigger:browser:url','%s/agent/tickets/%s','inspect','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','defaults','localhost','socket.io-emitter','redis','emit','application/json','info','format','%s/tickets.json','remoteUri','Tags','name','getString','Descriptions','then','Getting\x20agent\x20with\x20email','%s/search.json','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','Basic\x20%s','toString','base64','debug','stringify','GET','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','custom_fields','push','idField','variable','variableName','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:'];(function(_0x20c5f6,_0x5ea3e6){var _0x518805=function(_0x2123ad){while(--_0x2123ad){_0x20c5f6['push'](_0x20c5f6['shift']());}};_0x518805(++_0x5ea3e6);}(_0xcc89,0x8c));var _0x9cc8=function(_0x433aab,_0x458b4e){_0x433aab=_0x433aab-0x0;var _0x32fbbf=_0xcc89[_0x433aab];return _0x32fbbf;};'use strict';var _=require(_0x9cc8('0x0'));var rp=require('request-promise');var md5=require(_0x9cc8('0x1'));var util=require(_0x9cc8('0x2'));var Redis=require(_0x9cc8('0x3'));var intUtil=require(_0x9cc8('0x4'));var config=require(_0x9cc8('0x5'));var logger=require(_0x9cc8('0x6'))(_0x9cc8('0x7'));config['redis']=_[_0x9cc8('0x8')](config['redis'],{'host':_0x9cc8('0x9'),'port':0x18eb});var io=require(_0x9cc8('0xa'))(new Redis(config[_0x9cc8('0xb')]));function emit(_0x73001f,_0x3010f3,_0x306659){io['to'](_0x73001f)[_0x9cc8('0xc')](_0x3010f3,_0x306659);}var headers={'Content-Type':_0x9cc8('0xd'),'Accept':_0x9cc8('0xd')};function getTicket(_0x456a7b,_0x853bce,_0x385a6d,_0x2f87a2,_0x2d18da){logger[_0x9cc8('0xe')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x9cc8('0xf')](_0x9cc8('0x10'),_0x456a7b[_0x9cc8('0x11')]),'method':'POST','body':{'ticket':_['merge']({'requester_id':_0x385a6d['id'],'submitter_id':_0x853bce?_0x853bce['id']:undefined,'assignee_id':_0x853bce?_0x853bce['id']:undefined,'tags':getTags(_0x2f87a2[_0x9cc8('0x12')],_0x9cc8('0x13')),'subject':intUtil[_0x9cc8('0x14')](_0x2f87a2['Subjects'],_0x2d18da,'\x20'),'description':intUtil[_0x9cc8('0x14')](_0x2f87a2[_0x9cc8('0x15')],_0x2d18da,'\x0a'),'comment':{'public':![],'body':intUtil[_0x9cc8('0x14')](_0x2f87a2['Descriptions'],_0x2d18da,'\x0a')}},getCustomFields(_0x2f87a2['Fields'],_0x2d18da))}})[_0x9cc8('0x16')](function(_0x21f551){logger['info']('Ticket\x20created!');return _0x21f551['ticket'];});}function getUser(_0x2aa7d6,_0x2b554e){if(intUtil['validateEmail'](_0x2b554e)){logger['info'](_0x9cc8('0x17'),_0x2b554e);return request({'uri':util['format'](_0x9cc8('0x18'),_0x2aa7d6[_0x9cc8('0x11')]),'qs':{'query':util[_0x9cc8('0xf')]('type:user\x20role:agent\x20email:%s',_0x2b554e)}})['then'](function(_0x48b625){if(_0x48b625[_0x9cc8('0x19')]){logger[_0x9cc8('0xe')](_0x9cc8('0x1a'));return _[_0x9cc8('0x1b')](_0x48b625[_0x9cc8('0x1c')],{'email':_0x2b554e,'role':_0x9cc8('0x1d')});}else{logger[_0x9cc8('0xe')](_0x9cc8('0x1e'));return request({'uri':util['format'](_0x9cc8('0x1f'),_0x2aa7d6[_0x9cc8('0x11')])})['then'](function(_0x5896a9){logger[_0x9cc8('0xe')]('Admin\x20account\x20selected.');return _0x5896a9[_0x9cc8('0x20')];});}});}else{logger[_0x9cc8('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x9cc8('0x1f'),_0x2aa7d6[_0x9cc8('0x11')])})[_0x9cc8('0x16')](function(_0x4dc5e3){logger[_0x9cc8('0xe')](_0x9cc8('0x21'));return _0x4dc5e3[_0x9cc8('0x20')];});}}function getEndUser(_0x34814b,_0x413a50,_0x2ae405){logger[_0x9cc8('0xe')](_0x9cc8('0x22'),_0x2ae405);return request({'uri':util[_0x9cc8('0xf')](_0x9cc8('0x18'),_0x34814b[_0x9cc8('0x11')]),'qs':{'query':util[_0x9cc8('0xf')](_0x9cc8('0x23'),_0x2ae405)}})['then'](function(_0xb41a32){var _0x4a8a33;if(_0xb41a32[_0x9cc8('0x1c')][_0x9cc8('0x24')]){_0xb41a32[_0x9cc8('0x1c')]=_[_0x9cc8('0x25')](_0xb41a32['results'],{'suspended':![],'role':_0x9cc8('0x26')});if(_0xb41a32[_0x9cc8('0x1c')][_0x9cc8('0x24')]){_0x4a8a33=_[_0x9cc8('0x27')](_0xb41a32['results']);}}if(_0x4a8a33){logger[_0x9cc8('0xe')](_0x9cc8('0x28'));return _0x4a8a33;}else{logger[_0x9cc8('0xe')](_0x9cc8('0x29'));return request({'uri':util[_0x9cc8('0xf')](_0x9cc8('0x2a'),_0x34814b['remoteUri']),'method':'POST','body':{'user':{'role':_0x9cc8('0x26'),'name':util['format'](_0x9cc8('0x2b'),_0x413a50||_0x2ae405),'phone':_0x2ae405}}})[_0x9cc8('0x16')](function(_0x59266e){logger[_0x9cc8('0xe')](_0x9cc8('0x2c'));return _0x59266e[_0x9cc8('0x20')];});}});}function getAuth(_0x447603){var _0x57176c;if(_0x447603[_0x9cc8('0x2d')]===_0x9cc8('0x2e')){_0x57176c=util[_0x9cc8('0xf')](_0x9cc8('0x2f'),_0x447603[_0x9cc8('0x30')],_0x447603[_0x9cc8('0x2e')]);}else if(_0x447603[_0x9cc8('0x2d')]==='token'){_0x57176c=util['format']('%s/token:%s',_0x447603[_0x9cc8('0x30')],_0x447603[_0x9cc8('0x31')]);}return util[_0x9cc8('0xf')](_0x9cc8('0x32'),new Buffer(_0x57176c)[_0x9cc8('0x33')](_0x9cc8('0x34')));}function request(_0x1b4e4a){logger[_0x9cc8('0x35')]('[HTTP]',JSON[_0x9cc8('0x36')](_0x1b4e4a));return rp(_[_0x9cc8('0x8')](_0x1b4e4a,{'method':_0x9cc8('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x181207,_0x27f8dc){var _0xe3b9c0=[];if(_0x181207&&_0x181207[_0x9cc8('0x24')]>0x0){_0xe3b9c0=_[_0x9cc8('0x38')](_0x181207,_0x27f8dc);}return _0xe3b9c0;}function getCustomFields(_0xa9dee3,_0x4968a4){var _0x4a1510=[];var _0x587183={'custom_fields':[]};if(_0xa9dee3[_0x9cc8('0x24')]>0x0){_[_0x9cc8('0x39')](_0xa9dee3,function(_0x1bc9df){if(_[_0x9cc8('0x3a')]([_0x9cc8('0x3b'),_0x9cc8('0x3c')],_0x1bc9df[_0x9cc8('0x3d')])&&_0x1bc9df[_0x9cc8('0x3e')]&&!_0x1bc9df[_0x9cc8('0x3f')]){_0x587183[_0x1bc9df[_0x9cc8('0x3e')][_0x9cc8('0x40')]()]=_0x1bc9df[_0x9cc8('0x41')]['toString']();}else if(_[_0x9cc8('0x3a')]([_0x9cc8('0x3b'),_0x9cc8('0x3c')],_0x1bc9df['type'])&&_0x1bc9df['idField']&&_0x1bc9df[_0x9cc8('0x3f')]){_0x587183[_0x9cc8('0x42')][_0x9cc8('0x43')]({'id':_0x1bc9df[_0x9cc8('0x44')],'value':_0x1bc9df[_0x9cc8('0x41')][_0x9cc8('0x33')]()});}else if(_0x1bc9df[_0x9cc8('0x3d')]===_0x9cc8('0x45')&&_0x1bc9df[_0x9cc8('0x46')]&&_0x1bc9df['idField']&&_0x1bc9df[_0x9cc8('0x3f')]){_0x4968a4[_0x1bc9df['variableName']]&&_0x587183[_0x9cc8('0x42')][_0x9cc8('0x43')]({'id':_0x1bc9df[_0x9cc8('0x44')],'value':_0x4968a4[_0x1bc9df[_0x9cc8('0x46')]]['toString']()});}else if(_0x1bc9df[_0x9cc8('0x3d')]===_0x9cc8('0x47')&&_0x1bc9df[_0x9cc8('0x48')]&&_0x1bc9df[_0x9cc8('0x48')]['name']&&_0x1bc9df['idField']&&_0x1bc9df['customField']){_0x4968a4[_0x1bc9df[_0x9cc8('0x48')][_0x9cc8('0x13')][_0x9cc8('0x40')]()]&&_0x587183[_0x9cc8('0x42')][_0x9cc8('0x43')]({'id':_0x1bc9df[_0x9cc8('0x44')],'value':_0x4968a4[_0x1bc9df[_0x9cc8('0x48')][_0x9cc8('0x13')][_0x9cc8('0x40')]()][_0x9cc8('0x33')]()});}});}return _0x587183;}exports['queue']=function(_0x579bf8,_0x4218c1,_0x170673,_0x643aa,_0x4ac470,_0x2a518e){var _0x132383,_0x209871;_0x2a518e[_0x9cc8('0x11')]=intUtil[_0x9cc8('0x49')](_0x2a518e[_0x9cc8('0x11')]);_0x2a518e[_0x9cc8('0x4a')]=intUtil[_0x9cc8('0x49')](_0x2a518e[_0x9cc8('0x4a')]);if(_0x4ac470&&_0x4ac470[_0x9cc8('0x4b')]){logger['info'](_0x9cc8('0x4c'),_0x9cc8('0x4d'));_0x4218c1[_0x9cc8('0x4e')]=util[_0x9cc8('0xf')](_0x9cc8('0x4f'),_0x2a518e[_0x9cc8('0x4a')],_0x4218c1['uniqueid'],md5(_0x4218c1[_0x9cc8('0x50')]));}else{_0x4218c1[_0x9cc8('0x4e')]='';}headers[_0x9cc8('0x51')]=getAuth(_0x2a518e);return getUser(_0x2a518e,_0x643aa[_0x9cc8('0x52')])['then'](function(_0x4406e9){_0x132383=_0x4406e9;logger['info'](_0x9cc8('0x53'),_0x132383['id']);return getEndUser(_0x2a518e,_0x4218c1[_0x9cc8('0x54')],_0x4218c1[_0x9cc8('0x55')]);})[_0x9cc8('0x16')](function(_0x4bf2d0){_0x209871=_0x4bf2d0;logger[_0x9cc8('0xe')]('The\x20Enduser\x20ID\x20is:',_0x209871['id']);return getTicket(_0x2a518e,_0x132383,_0x209871,_0x170673,_0x4218c1);})['then'](function(_0x11ce2f){if(_0x11ce2f){logger[_0x9cc8('0xe')]('The\x20Ticket\x20ID\x20is:',_0x11ce2f['id']);switch(_0x2a518e['type']){case _0x9cc8('0x56'):logger[_0x9cc8('0xe')](_0x9cc8('0x4c'),_0x9cc8('0x57'));return request({'uri':util[_0x9cc8('0xf')](_0x9cc8('0x58'),_0x2a518e['remoteUri'],_0x132383['id'],_0x11ce2f['id']),'method':_0x9cc8('0x59')});case _0x9cc8('0x5a'):logger[_0x9cc8('0xe')](_0x9cc8('0x4c'),_0x9cc8('0x5b'));emit(util['format'](_0x9cc8('0x5c'),_0x643aa[_0x9cc8('0x13')]),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x2a518e['remoteUri'][_0x9cc8('0x5d')](_0x9cc8('0x5e'),''),_0x11ce2f['id'])});break;default:logger['error'](_0x9cc8('0x4c'),_0x9cc8('0x5f'));}}})[_0x9cc8('0x60')](function(_0x2c145b){logger[_0x9cc8('0x61')](_0x9cc8('0x62'),util['inspect'](_0x2c145b,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x5204b6,_0x476d3d,_0x45e173,_0x891322,_0x56e537,_0x3ecb42,_0x47a43e){var _0x592073,_0x1bd99d;_0x3ecb42[_0x9cc8('0x11')]=intUtil[_0x9cc8('0x49')](_0x3ecb42[_0x9cc8('0x11')]);_0x3ecb42['serverUrl']=intUtil[_0x9cc8('0x49')](_0x3ecb42[_0x9cc8('0x4a')]);if(_0x47a43e&&_0x47a43e['recordingFormat']&&_0x47a43e[_0x9cc8('0x63')]!==_0x9cc8('0x64')){logger['info'](_0x9cc8('0x65'),_0x9cc8('0x4d'));_0x476d3d['recordingURL']=util[_0x9cc8('0xf')](_0x9cc8('0x4f'),_0x3ecb42[_0x9cc8('0x4a')],_0x476d3d['uniqueid'],md5(_0x476d3d[_0x9cc8('0x50')]));}headers[_0x9cc8('0x51')]=getAuth(_0x3ecb42);return getUser(_0x3ecb42,_0x891322[_0x9cc8('0x52')])['then'](function(_0xce917d){_0x592073=_0xce917d;logger['info']('The\x20User\x20ID\x20is:',_0x592073['id']);return getEndUser(_0x3ecb42,_0x476d3d[_0x9cc8('0x66')],_0x476d3d['destcalleridnum']);})['then'](function(_0x940afc){_0x1bd99d=_0x940afc;logger[_0x9cc8('0xe')](_0x9cc8('0x67'),_0x1bd99d['id']);return getTicket(_0x3ecb42,_0x592073,_0x1bd99d,_0x45e173,_0x476d3d);})['then'](function(_0x90db7d){if(_0x90db7d){logger[_0x9cc8('0xe')](_0x9cc8('0x68'),_0x90db7d['id']);switch(_0x3ecb42[_0x9cc8('0x3d')]){case'integrationTab':logger[_0x9cc8('0xe')](_0x9cc8('0x65'),_0x9cc8('0x57'));return request({'uri':util[_0x9cc8('0xf')](_0x9cc8('0x58'),_0x3ecb42['remoteUri'],_0x592073['id'],_0x90db7d['id']),'method':_0x9cc8('0x59')});case'newTab':logger[_0x9cc8('0xe')](_0x9cc8('0x65'),_0x9cc8('0x5b'));emit(util[_0x9cc8('0xf')]('user:%s',_0x891322['name']),_0x9cc8('0x69'),{'uri':util[_0x9cc8('0xf')](_0x9cc8('0x6a'),_0x3ecb42['remoteUri'][_0x9cc8('0x5d')](_0x9cc8('0x5e'),''),_0x90db7d['id'])});break;default:logger[_0x9cc8('0x61')](_0x9cc8('0x65'),_0x9cc8('0x5f'));}}})[_0x9cc8('0x60')](function(_0xdc2d60){logger[_0x9cc8('0x61')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x9cc8('0x6b')](_0xdc2d60,{'showHidden':!![],'depth':null}));});};exports[_0x9cc8('0x6c')]=function(_0x519932,_0x3425bf,_0x8f9931,_0xe675f7,_0x4f0b25,_0x3c0eb9){var _0x19eb35,_0x2c95f1;_0x3c0eb9[_0x9cc8('0x11')]=intUtil[_0x9cc8('0x49')](_0x3c0eb9['remoteUri']);_0x3c0eb9[_0x9cc8('0x4a')]=intUtil[_0x9cc8('0x49')](_0x3c0eb9[_0x9cc8('0x4a')]);if(_0x4f0b25&&_0x4f0b25[_0x9cc8('0x4b')]){logger[_0x9cc8('0xe')]('['+_0x3425bf[_0x9cc8('0x6d')][_0x9cc8('0x6e')]()+']',_0x9cc8('0x4d'));_0x3425bf['recordingURL']=util['format'](_0x9cc8('0x4f'),_0x3c0eb9[_0x9cc8('0x4a')],_0x3425bf['uniqueid'],md5(_0x3425bf[_0x9cc8('0x50')]));}else{_0x3425bf[_0x9cc8('0x4e')]='';}headers['Authorization']=getAuth(_0x3c0eb9);return getUser(_0x3c0eb9)['then'](function(_0x1df06c){_0x19eb35=_0x1df06c;logger[_0x9cc8('0xe')](_0x9cc8('0x53'),_0x19eb35['id']);return getEndUser(_0x3c0eb9,_0x3425bf[_0x9cc8('0x54')],_0x3425bf['calleridnum']);})[_0x9cc8('0x16')](function(_0x5222b5){_0x2c95f1=_0x5222b5;logger['info'](_0x9cc8('0x67'),_0x2c95f1['id']);return getTicket(_0x3c0eb9,_0x19eb35,_0x2c95f1,_0x8f9931,_0x3425bf);})['then'](function(_0x36064d){if(_0x36064d){logger[_0x9cc8('0xe')]('The\x20Ticket\x20ID\x20is:',_0x36064d['id']);}})['catch'](function(_0x53c08c){logger[_0x9cc8('0x61')]('['+_0x3425bf[_0x9cc8('0x6d')][_0x9cc8('0x6e')]()+']'+_0x9cc8('0x6f'),util['inspect'](_0x53c08c,{'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 93aca74..072a0e7 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 _0x4f9d=['seconds','catch','error','Failing\x20creating\x20the\x20access_token','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','users','isArrayLikeObject','findIndex','email','info','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','code','SUCCESS','details','moduleCreate','Error:\x20','log','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','lead','Leads','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','First_Name','Last_Name','Full_Name','$se_module','talktime','Call_Duration','mm:ss','answertime','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','Called','complete','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','merge','Fields','/crm/v2/Calls','Call\x20created!','err','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','Outbound','unmanaged','toUpperCase','Inbound','lodash','request-promise','md5','./util','moment','ioredis','bluebird','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','debug','stringify','length','forEach','includes','string','type','idField','content','variable','variableName','customVariable','Variable','name','toLowerCase','toString','indexOf','split','isNil','access_token','isBefore','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','add','expires_in'];(function(_0xacce08,_0x52f0f5){var _0x214bfe=function(_0x430b6e){while(--_0x430b6e){_0xacce08['push'](_0xacce08['shift']());}};_0x214bfe(++_0x52f0f5);}(_0x4f9d,0x1b3));var _0xd4f9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4f9d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd4f9('0x0'));var rp=require(_0xd4f9('0x1'));var md5=require(_0xd4f9('0x2'));var util=require('util');var intUtil=require(_0xd4f9('0x3'));var moment=require(_0xd4f9('0x4'));var Redis=require(_0xd4f9('0x5'));var BPromise=require(_0xd4f9('0x6'));var config=require(_0xd4f9('0x7'));var logger=require('../../../../config/logger')('zoho');config[_0xd4f9('0x8')]=_[_0xd4f9('0x9')](config['redis'],{'host':_0xd4f9('0xa'),'port':0x18eb});var io=require(_0xd4f9('0xb'))(new Redis(config[_0xd4f9('0x8')]));function emit(_0x151221,_0x50beca,_0x448522){io['to'](_0x151221)[_0xd4f9('0xc')](_0x50beca,_0x448522);}function request(_0x419183){logger[_0xd4f9('0xd')]('[HTTP]',JSON[_0xd4f9('0xe')](_0x419183));return rp(_0x419183);}function getCustomFields(_0x2f9635,_0x280c18){var _0xe665a2={};if(_0x2f9635[_0xd4f9('0xf')]>0x0){_[_0xd4f9('0x10')](_0x2f9635,function(_0x4fc909){if(_[_0xd4f9('0x11')]([_0xd4f9('0x12'),'picklist'],_0x4fc909[_0xd4f9('0x13')])&&_0x4fc909[_0xd4f9('0x14')]){_0xe665a2[_0x4fc909[_0xd4f9('0x14')]]=_0x4fc909[_0xd4f9('0x15')]['toString']();}else if(_0x4fc909[_0xd4f9('0x13')]===_0xd4f9('0x16')&&_0x4fc909['variableName']&&_0x4fc909['idField']&&_0x280c18[_0x4fc909[_0xd4f9('0x17')]]){_0xe665a2[_0x4fc909[_0xd4f9('0x14')]]=_0x280c18[_0x4fc909[_0xd4f9('0x17')]]['toString']();}else if(_0x4fc909[_0xd4f9('0x13')]===_0xd4f9('0x18')&&_0x4fc909[_0xd4f9('0x19')]&&_0x4fc909[_0xd4f9('0x19')][_0xd4f9('0x1a')]&&_0x4fc909[_0xd4f9('0x14')]&&_0x280c18[_0x4fc909[_0xd4f9('0x19')]['name'][_0xd4f9('0x1b')]()]){_0xe665a2[_0x4fc909[_0xd4f9('0x14')]]=_0x280c18[_0x4fc909[_0xd4f9('0x19')][_0xd4f9('0x1a')][_0xd4f9('0x1b')]()][_0xd4f9('0x1c')]();}});}return _0xe665a2;}function getName(_0x59efe3){if(_0x59efe3[_0xd4f9('0x1d')]('\x20')>0x0){var _0x52cbf5=_0x59efe3[_0xd4f9('0x1e')](/ (.+)/);if(_0x52cbf5[0x1]){return _0x52cbf5;}}return[_0x59efe3,_0x59efe3];}var accountsTokens={};function getAccessToken(_0x3d26e6){return new Promise(function(_0x37ff63,_0x13af7f){if(!_['isNil'](accountsTokens[_0x3d26e6['id']])&&!_[_0xd4f9('0x1f')](accountsTokens[_0x3d26e6['id']][_0xd4f9('0x20')])){if(moment()[_0xd4f9('0x21')](accountsTokens[_0x3d26e6['id']]['expires_in'])){_0x37ff63(accountsTokens[_0x3d26e6['id']][_0xd4f9('0x20')]);}}var _0x295cce;switch(_0x3d26e6['zone']){case'US':_0x295cce=_0xd4f9('0x22');break;case'AU':_0x295cce='https://accounts.zoho.com.au';break;case'EU':_0x295cce=_0xd4f9('0x23');break;case'IN':_0x295cce=_0xd4f9('0x24');break;case'CN':_0x295cce=_0xd4f9('0x25');break;default:_0x295cce=_0xd4f9('0x23');break;}var _0x385aef={'method':_0xd4f9('0x26'),'uri':_0x295cce+_0xd4f9('0x27'),'qs':{'refresh_token':_0x3d26e6[_0xd4f9('0x28')],'client_id':_0x3d26e6[_0xd4f9('0x29')],'client_secret':_0x3d26e6[_0xd4f9('0x2a')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x385aef)['then'](function(_0x43b705){accountsTokens[_0x3d26e6['id']]={'access_token':_0x43b705[_0xd4f9('0x20')],'expires_in':moment()[_0xd4f9('0x2b')](_0x43b705[_0xd4f9('0x2c')],_0xd4f9('0x2d'))};_0x37ff63(_0x43b705[_0xd4f9('0x20')]);})[_0xd4f9('0x2e')](function(_0x42321f){logger[_0xd4f9('0x2f')](_0xd4f9('0x30'),_0x42321f['stack']);_0x13af7f(_0x42321f);});});}function getUser(_0x3b9676,_0x5937b2,_0x13d2c1,_0x350295){logger['info']('Search\x20user');return request({'method':_0xd4f9('0x31'),'uri':util[_0xd4f9('0x32')](_0xd4f9('0x33'),_0x5937b2),'qs':{'type':_0xd4f9('0x34')},'headers':{'Authorization':_0xd4f9('0x35')+_0x3b9676},'json':!![]})[_0xd4f9('0x36')](function(_0x348ee6){if(_0x348ee6[_0xd4f9('0x37')]){var _0x555f6e=-0x1;if(_[_0xd4f9('0x38')](_0x348ee6[_0xd4f9('0x37')])){if(!_[_0xd4f9('0x1f')](_0x350295)){_0x555f6e=_[_0xd4f9('0x39')](_0x348ee6[_0xd4f9('0x37')],function(_0x38f903){return _0x38f903[_0xd4f9('0x3a')]===_0x350295;});}if(_0x555f6e>=0x0){logger[_0xd4f9('0x3b')](_0xd4f9('0x3c'));}else{logger['info'](_0xd4f9('0x3d'));_0x555f6e=_[_0xd4f9('0x39')](_0x348ee6[_0xd4f9('0x37')],function(_0x44e33b){return _0x44e33b[_0xd4f9('0x3e')][_0xd4f9('0x1a')]===_0xd4f9('0x3f');});}return _0x348ee6['users'][_0x555f6e];}else{if(_0x348ee6[_0xd4f9('0x40')][_0xd4f9('0x3e')][_0xd4f9('0x1a')]===_0xd4f9('0x3f')){logger['info']('Using\x20the\x20admin\x20account!');user=_0x348ee6[_0xd4f9('0x40')];return user;}else{logger[_0xd4f9('0x2f')](_0xd4f9('0x41'),JSON[_0xd4f9('0xe')](_0x348ee6));throw new Error(_0xd4f9('0x42')+JSON[_0xd4f9('0xe')](_0x348ee6));}}}else{logger[_0xd4f9('0x2f')](_0xd4f9('0x41'),JSON['stringify'](_0x348ee6));throw new Error(_0xd4f9('0x42')+JSON['stringify'](_0x348ee6));}})[_0xd4f9('0x2e')](function(_0x28f2ee){console[_0xd4f9('0x2f')](_0x28f2ee);});}function getZohoUser(_0x44230c,_0x20648c){return new BPromise(function(_0x1baab4,_0x1429ea){request(_0x44230c)[_0xd4f9('0x36')](function(_0x5cc18d){var _0xaabd8f=null;if(_0x5cc18d){_0xaabd8f=_0x5cc18d[_0xd4f9('0x43')][0x0];_0xaabd8f[_0xd4f9('0x44')]=_0x20648c;}_0x1baab4(_0xaabd8f);})['catch'](function(_0x50761d){_0x1429ea(_0x50761d);});});}function createEndUser(_0x32bd8b,_0x9268a,_0x3eb62f,_0x1d4ff8,_0x3c5499,_0x41ad65){var _0x3eb62f=getName(_0x3eb62f);return request({'method':_0xd4f9('0x26'),'uri':_0xd4f9('0x45')+_0x9268a+_0xd4f9('0x46')+_[_0xd4f9('0x47')](_0x41ad65['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x3eb62f[0x1],'First_Name':_0x3eb62f[0x0],'Phone':_0x1d4ff8,'Owner':{'name':!_[_0xd4f9('0x1f')](_0x3c5499[_0xd4f9('0x48')][_0xd4f9('0x1a')])?_0x3c5499['role']['name']:!_[_0xd4f9('0x1f')](_0x3c5499[_0xd4f9('0x49')])?_0x3c5499[_0xd4f9('0x49')]+'\x20'+_0x3c5499[_0xd4f9('0x4a')]:_0x3c5499[_0xd4f9('0x4a')],'id':_0x3c5499['id']}}]},'headers':{'Authorization':_0xd4f9('0x35')+_0x32bd8b},'json':!![]})[_0xd4f9('0x36')](function(_0x2df27e){if(_0x2df27e&&_0x2df27e[_0xd4f9('0x43')][0x0][_0xd4f9('0x4b')]===_0xd4f9('0x4c')){var _0x3650dc=_0x2df27e[_0xd4f9('0x43')][0x0][_0xd4f9('0x4d')];_0x3650dc[_0xd4f9('0x44')]=_[_0xd4f9('0x47')](_0x41ad65[_0xd4f9('0x4e')])+'s';return _0x3650dc;}logger['error'](_0xd4f9('0x41'),JSON[_0xd4f9('0xe')](data));throw new Error(_0xd4f9('0x4f')+JSON['stringify'](data));})[_0xd4f9('0x2e')](function(_0x2d1243){console[_0xd4f9('0x50')]('CREATE\x20ERROR',_0x2d1243);});}function getEndUser(_0x34ea4e,_0x43574c,_0x380433,_0x224db3,_0x22d941,_0x39ad48,_0x3d6f4d){var _0x182394={'method':_0xd4f9('0x31'),'uri':'','headers':{'Authorization':_0xd4f9('0x35')+_0x34ea4e},'json':!![]};switch(_0x3d6f4d[_0xd4f9('0x51')]){case'contact_lead':_0x182394[_0xd4f9('0x52')]='https://www.zohoapis.'+_0x43574c+_0xd4f9('0x53')+_0x22d941+'))';return getZohoUser(_0x182394,_0xd4f9('0x54'))['then'](function(_0xfe929){if(_0xfe929)return _0xfe929;_0x182394['uri']='https://www.zohoapis.'+_0x43574c+_0xd4f9('0x55')+_0x22d941+'))';return getZohoUser(_0x182394,'Leads')[_0xd4f9('0x36')](function(_0x23034b){if(_0x23034b)return _0x23034b;if(_0x3d6f4d[_0xd4f9('0x4e')]!='nothing'){return createEndUser(_0x34ea4e,_0x43574c,_0x224db3,_0x22d941,_0x39ad48,_0x3d6f4d);}else{return{};}});});break;case'contact':_0x182394['uri']=_0xd4f9('0x45')+_0x43574c+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x22d941+'))';return getZohoUser(_0x182394,'Contacts')[_0xd4f9('0x36')](function(_0x32c89f){if(_0x32c89f)return _0x32c89f;if(_0x3d6f4d['moduleCreate']!=_0xd4f9('0x56')){return createEndUser(_0x34ea4e,_0x43574c,_0x224db3,_0x22d941,_0x39ad48,_0x3d6f4d);}else{return{};}});break;case _0xd4f9('0x57'):_0x182394['uri']=_0xd4f9('0x45')+_0x43574c+_0xd4f9('0x55')+_0x22d941+'))';return getZohoUser(_0x182394,_0xd4f9('0x58'))[_0xd4f9('0x36')](function(_0x4eb65c){if(_0x4eb65c)return _0x4eb65c;if(_0x3d6f4d[_0xd4f9('0x4e')]!=_0xd4f9('0x56')){return createEndUser(_0x34ea4e,_0x43574c,_0x224db3,_0x22d941,_0x39ad48,_0x3d6f4d);}else{return{};}});break;}}function getCall(_0x43ab8c,_0x13e80,_0x24a5da,_0x5eb246,_0x5b5998,_0x9f3ca6,_0x5ba300,_0x388f99){logger[_0xd4f9('0x3b')](_0xd4f9('0x59'));var _0x110ba0={};_0x110ba0[_0xd4f9('0x5a')]={'name':!_[_0xd4f9('0x1f')](_0x5eb246[_0xd4f9('0x48')][_0xd4f9('0x1a')])&&!_['isNil'](_0x5eb246[_0xd4f9('0x3e')][_0xd4f9('0x1a')])&&_0x5eb246[_0xd4f9('0x3e')][_0xd4f9('0x1a')]===_0xd4f9('0x5b')?_0x5eb246[_0xd4f9('0x48')][_0xd4f9('0x1a')]:!_['isNil'](_0x5eb246[_0xd4f9('0x49')])?_0x5eb246['first_name']+'\x20'+_0x5eb246[_0xd4f9('0x4a')]:_0x5eb246['last_name'],'id':_0x5eb246['id']};_0x110ba0[_0xd4f9('0x5c')]=intUtil[_0xd4f9('0x5d')](_0x9f3ca6[_0xd4f9('0x5e')],_0x5ba300,'\x20');_0x110ba0[_0xd4f9('0x5f')]=intUtil[_0xd4f9('0x5d')](_0x9f3ca6[_0xd4f9('0x60')],_0x5ba300,'\x0a');if(_0x5b5998[_0xd4f9('0x44')]===_0xd4f9('0x54')){_0x110ba0[_0xd4f9('0x61')]={'name':!_[_0xd4f9('0x1f')](_0x5b5998['Full_Name'])?_0x5b5998['Full_Name']:!_[_0xd4f9('0x1f')](_0x5b5998[_0xd4f9('0x62')])?_0x5b5998[_0xd4f9('0x62')]+'\x20'+_0x5b5998[_0xd4f9('0x63')]:_0x5b5998[_0xd4f9('0x63')],'id':_0x5b5998['id']};}if(_0x5b5998[_0xd4f9('0x44')]===_0xd4f9('0x58')){_0x110ba0['What_Id']={'name':!_[_0xd4f9('0x1f')](_0x5b5998['Full_Name'])?_0x5b5998[_0xd4f9('0x64')]:!_['isNil'](_0x5b5998['First_Name'])?_0x5b5998[_0xd4f9('0x62')]+'\x20'+_0x5b5998[_0xd4f9('0x63')]:_0x5b5998[_0xd4f9('0x63')],'id':_0x5b5998['id']};_0x110ba0[_0xd4f9('0x65')]=_[_0xd4f9('0x47')](_0x5b5998[_0xd4f9('0x44')]);}if(_0x5ba300[_0xd4f9('0x66')]){_0x110ba0[_0xd4f9('0x67')]=moment['utc'](parseInt(_0x5ba300[_0xd4f9('0x66')])*0x3e8)[_0xd4f9('0x32')](_0xd4f9('0x68'));}else if(_0x5ba300[_0xd4f9('0x69')]&&_0x5ba300[_0xd4f9('0x6a')]){_0x110ba0[_0xd4f9('0x67')]=moment['utc'](moment(_0x5ba300[_0xd4f9('0x6a')],'YYYY-MM-DDTHH:mm:ss')[_0xd4f9('0x6b')](moment(_0x5ba300[_0xd4f9('0x6c')],_0xd4f9('0x6d'))))[_0xd4f9('0x32')](_0xd4f9('0x68'));}switch(_0x5ba300[_0xd4f9('0x6e')]){case _0xd4f9('0x6f'):_0x110ba0[_0xd4f9('0x70')]=_0xd4f9('0x71');break;case _0xd4f9('0x72'):case'connect':_0x110ba0[_0xd4f9('0x70')]=_0xd4f9('0x73');break;case _0xd4f9('0x74'):_0x110ba0[_0xd4f9('0x70')]=_0xd4f9('0x75');break;case _0xd4f9('0x76'):_0x110ba0[_0xd4f9('0x70')]=_0xd4f9('0x77');break;case _0xd4f9('0x78'):_0x110ba0[_0xd4f9('0x70')]=_0xd4f9('0x79');default:}_0x110ba0[_0xd4f9('0x7a')]=(_0x388f99===_0xd4f9('0x7b')?moment(_0x5ba300[_0xd4f9('0x6c')])[_0xd4f9('0x32')](_0xd4f9('0x6d')):moment(_0x5ba300[_0xd4f9('0x7c')])['format'](_0xd4f9('0x6d')))||moment()[_0xd4f9('0x32')](_0xd4f9('0x6d'));_0x110ba0[_0xd4f9('0x7d')]=_0x388f99||'Inbound';_0x110ba0=_[_0xd4f9('0x7e')](_0x110ba0,getCustomFields(_0x9f3ca6[_0xd4f9('0x7f')],_0x5ba300));return request({'method':'POST','uri':_0xd4f9('0x45')+_0x13e80+_0xd4f9('0x80'),'headers':{'Authorization':_0xd4f9('0x35')+_0x43ab8c},'body':{'data':[_0x110ba0]},'json':!![]})[_0xd4f9('0x36')](function(_0x2e388d){if(_0x2e388d&&_0x2e388d[_0xd4f9('0x43')][0x0][_0xd4f9('0x4b')]===_0xd4f9('0x4c')){logger[_0xd4f9('0x3b')](_0xd4f9('0x81'));return{'id':_0x2e388d[_0xd4f9('0x43')][0x0][_0xd4f9('0x4d')]['id']};}})['catch'](function(_0x470ce5){logger['info'](_0xd4f9('0x82'),_0x470ce5['stack']);console['log'](_0xd4f9('0x82'),_0x470ce5);});}exports['queue']=function(_0x2a5974,_0x3b1102,_0x68434,_0x434b79,_0x18f826,_0x432119){var _0x42ad97,_0x30b229,_0x2b9a99;_0x432119[_0xd4f9('0x83')]=intUtil[_0xd4f9('0x84')](_0x432119[_0xd4f9('0x83')]);_0x432119[_0xd4f9('0x85')]=intUtil['stripTrailingSlash'](_0x432119['serverUrl']);if(_0x18f826&&_0x18f826[_0xd4f9('0x86')]){logger[_0xd4f9('0x3b')](_0xd4f9('0x87'),'Recording\x20is\x20enabled!');_0x3b1102[_0xd4f9('0x88')]=_0x432119[_0xd4f9('0x85')]+_0xd4f9('0x89')+_0x3b1102['uniqueid']+_0xd4f9('0x8a')+md5(_0x3b1102[_0xd4f9('0x8b')]);}else{_0x3b1102[_0xd4f9('0x88')]='';}var _0x418ec9=_0x432119['host']===_0xd4f9('0x8c')?'eu':_0xd4f9('0x8d');return getAccessToken(_0x432119)[_0xd4f9('0x36')](function(_0x347a75){_0x2b9a99=_0x347a75;return getUser(_0x2b9a99,_0x418ec9,_0x432119,_0x434b79[_0xd4f9('0x3a')]);})[_0xd4f9('0x36')](function(_0x5e3ea3){_0x42ad97=_0x5e3ea3;logger['info'](_0xd4f9('0x8e'),_0x42ad97['id']);return getEndUser(_0x2b9a99,_0x418ec9,_0x432119,_0x3b1102[_0xd4f9('0x8f')],_0x3b1102[_0xd4f9('0x90')],_0x42ad97,_0x68434);})[_0xd4f9('0x36')](function(_0x1aef96){_0x30b229=_0x1aef96;return getCall(_0x2b9a99,_0x418ec9,_0x432119,_0x42ad97,_0x30b229,_0x68434,_0x3b1102,'Inbound');})[_0xd4f9('0x36')](function(_0xead88a){if(_0xead88a){logger['info'](_0xd4f9('0x91'),_0xead88a['id']);logger['info'](_0xd4f9('0x87'),_0xd4f9('0x92'));emit(util['format'](_0xd4f9('0x93'),_0x434b79[_0xd4f9('0x1a')]),_0xd4f9('0x94'),{'uri':_0xd4f9('0x95')+_0x432119['host']+_0xd4f9('0x96')+_0xead88a['id']});}})[_0xd4f9('0x2e')](function(_0x36165c){logger[_0xd4f9('0x2f')](_0xd4f9('0x87'),JSON[_0xd4f9('0xe')](_0x36165c));});};exports[_0xd4f9('0x7b')]=function(_0x44f8c4,_0x26a158,_0xf46a5b,_0x175c6f,_0x2099dc,_0x392fd2,_0x21c078){var _0x4a704d,_0x424462,_0x27071d;_0x392fd2[_0xd4f9('0x83')]=intUtil[_0xd4f9('0x84')](_0x392fd2['host']);_0x392fd2[_0xd4f9('0x85')]=intUtil[_0xd4f9('0x84')](_0x392fd2[_0xd4f9('0x85')]);if(_0x21c078&&_0x21c078[_0xd4f9('0x97')]&&_0x21c078[_0xd4f9('0x97')]!==_0xd4f9('0x98')){logger[_0xd4f9('0x3b')](_0xd4f9('0x99'),_0xd4f9('0x9a'));_0x26a158[_0xd4f9('0x88')]=_0x392fd2[_0xd4f9('0x85')]+'/api/voice/recordings/'+_0x26a158['uniqueid']+_0xd4f9('0x8a')+md5(_0x26a158[_0xd4f9('0x8b')]);}var _0x5286a0=_0x392fd2[_0xd4f9('0x83')]===_0xd4f9('0x8c')?'eu':'com';return getAccessToken(_0x392fd2)[_0xd4f9('0x36')](function(_0x1d3590){_0x27071d=_0x1d3590;return getUser(_0x27071d,_0x5286a0,_0x392fd2,_0x175c6f[_0xd4f9('0x3a')]);})[_0xd4f9('0x36')](function(_0x18d568){_0x4a704d=_0x18d568;logger[_0xd4f9('0x3b')](_0xd4f9('0x8e'),_0x4a704d['id']);return getEndUser(_0x27071d,_0x5286a0,_0x392fd2,_0x26a158['destcalleridname'],_0x26a158[_0xd4f9('0x9b')],_0x4a704d,_0xf46a5b);})[_0xd4f9('0x36')](function(_0x1fbd1f){_0x424462=_0x1fbd1f;return getCall(_0x27071d,_0x5286a0,_0x392fd2,_0x4a704d,_0x424462,_0xf46a5b,_0x26a158,_0xd4f9('0x9c'));})[_0xd4f9('0x36')](function(_0x142898){if(_0x142898){logger[_0xd4f9('0x3b')](_0xd4f9('0x91'),_0x142898['id']);logger[_0xd4f9('0x3b')]('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd4f9('0x32')](_0xd4f9('0x93'),_0x175c6f[_0xd4f9('0x1a')]),'trigger:browser:url',{'uri':'https://crm.'+_0x392fd2[_0xd4f9('0x83')]+'/crm/EntityInfo.do?module=Calls&id='+_0x142898['id']});}})['catch'](function(_0x215f0b){logger[_0xd4f9('0x2f')](_0xd4f9('0x99'),JSON['stringify'](_0x215f0b));});};exports[_0xd4f9('0x9d')]=function(_0xc115b9,_0x147656,_0x1c1fa5,_0x5a3273,_0x9a01cd,_0x4a099c){var _0x3e53f1,_0x523c87,_0x214a9f;_0x4a099c[_0xd4f9('0x83')]=intUtil[_0xd4f9('0x84')](_0x4a099c[_0xd4f9('0x83')]);_0x4a099c[_0xd4f9('0x85')]=intUtil[_0xd4f9('0x84')](_0x4a099c[_0xd4f9('0x85')]);if(_0x9a01cd&&_0x9a01cd['monitor_format']){logger[_0xd4f9('0x3b')]('['+_0x147656['lastevent'][_0xd4f9('0x9e')]()+']','Recording\x20is\x20enabled!');_0x147656[_0xd4f9('0x88')]=_0x4a099c[_0xd4f9('0x85')]+_0xd4f9('0x89')+_0x147656[_0xd4f9('0x8b')]+_0xd4f9('0x8a')+md5(_0x147656['uniqueid']);}else{_0x147656[_0xd4f9('0x88')]='';}var _0x42b965=_0x4a099c[_0xd4f9('0x83')]===_0xd4f9('0x8c')?'eu':_0xd4f9('0x8d');return getAccessToken(_0x4a099c)[_0xd4f9('0x36')](function(_0xc1b7cb){_0x214a9f=_0xc1b7cb;return getUser(_0x214a9f,_0x42b965,_0x4a099c);})[_0xd4f9('0x36')](function(_0x58c3af){_0x3e53f1=_0x58c3af;logger[_0xd4f9('0x3b')]('The\x20User\x20ID\x20is:',_0x3e53f1['id']);return getEndUser(_0x214a9f,_0x42b965,_0x4a099c,_0x147656['calleridname'],_0x147656[_0xd4f9('0x90')],_0x3e53f1,_0x1c1fa5);})[_0xd4f9('0x36')](function(_0x39e3a3){_0x523c87=_0x39e3a3;return getCall(_0x214a9f,_0x42b965,_0x4a099c,_0x3e53f1,_0x523c87,_0x1c1fa5,_0x147656,_0xd4f9('0x9f'));})[_0xd4f9('0x36')](function(_0x15f70f){if(_0x15f70f){logger[_0xd4f9('0x3b')]('The\x20Call\x20ID\x20is:',_0x15f70f['id']);}})[_0xd4f9('0x2e')](function(_0x38ebd6){logger[_0xd4f9('0x2f')]('['+_0x147656['lastevent']['toUpperCase']()+']',JSON[_0xd4f9('0xe')](_0x38ebd6));});}; \ No newline at end of file +var _0xb0b9=['zoho.eu','com','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','email','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Call\x20ID\x20is:','toUpperCase','calleridname','lodash','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','string','type','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','split','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','refresh_token','seconds','error','Failing\x20creating\x20the\x20access_token','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','users','isArrayLikeObject','findIndex','info','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','last_name','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','lead','Creating\x20new\x20call...','Owner','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','Leads','What_Id','$se_module','Call_Duration','utc','talktime','format','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','Answered','rejected','abandoned','Abandoned','timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','code','Call\x20created!','err','stack','queue','stripTrailingSlash','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token='];(function(_0x23ec06,_0x561142){var _0x2831d4=function(_0x3802bc){while(--_0x3802bc){_0x23ec06['push'](_0x23ec06['shift']());}};_0x2831d4(++_0x561142);}(_0xb0b9,0x1f3));var _0x9b0b=function(_0x55cb41,_0xcfe1a4){_0x55cb41=_0x55cb41-0x0;var _0x3ca743=_0xb0b9[_0x55cb41];return _0x3ca743;};'use strict';var _=require(_0x9b0b('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x9b0b('0x1'));var intUtil=require(_0x9b0b('0x2'));var moment=require(_0x9b0b('0x3'));var Redis=require(_0x9b0b('0x4'));var BPromise=require(_0x9b0b('0x5'));var config=require(_0x9b0b('0x6'));var logger=require(_0x9b0b('0x7'))(_0x9b0b('0x8'));config[_0x9b0b('0x9')]=_[_0x9b0b('0xa')](config[_0x9b0b('0x9')],{'host':_0x9b0b('0xb'),'port':0x18eb});var io=require(_0x9b0b('0xc'))(new Redis(config[_0x9b0b('0x9')]));function emit(_0x4894ae,_0x537d6e,_0xf14325){io['to'](_0x4894ae)[_0x9b0b('0xd')](_0x537d6e,_0xf14325);}function request(_0x22e8bd){logger[_0x9b0b('0xe')](_0x9b0b('0xf'),JSON[_0x9b0b('0x10')](_0x22e8bd));return rp(_0x22e8bd);}function getCustomFields(_0x5713db,_0x426bc4){var _0x44c7e0={};if(_0x5713db[_0x9b0b('0x11')]>0x0){_[_0x9b0b('0x12')](_0x5713db,function(_0x5277fb){if(_['includes']([_0x9b0b('0x13'),'picklist'],_0x5277fb[_0x9b0b('0x14')])&&_0x5277fb['idField']){_0x44c7e0[_0x5277fb[_0x9b0b('0x15')]]=_0x5277fb[_0x9b0b('0x16')]['toString']();}else if(_0x5277fb['type']===_0x9b0b('0x17')&&_0x5277fb[_0x9b0b('0x18')]&&_0x5277fb[_0x9b0b('0x15')]&&_0x426bc4[_0x5277fb['variableName']]){_0x44c7e0[_0x5277fb[_0x9b0b('0x15')]]=_0x426bc4[_0x5277fb[_0x9b0b('0x18')]][_0x9b0b('0x19')]();}else if(_0x5277fb[_0x9b0b('0x14')]===_0x9b0b('0x1a')&&_0x5277fb[_0x9b0b('0x1b')]&&_0x5277fb[_0x9b0b('0x1b')][_0x9b0b('0x1c')]&&_0x5277fb[_0x9b0b('0x15')]&&_0x426bc4[_0x5277fb[_0x9b0b('0x1b')][_0x9b0b('0x1c')][_0x9b0b('0x1d')]()]){_0x44c7e0[_0x5277fb[_0x9b0b('0x15')]]=_0x426bc4[_0x5277fb[_0x9b0b('0x1b')]['name'][_0x9b0b('0x1d')]()][_0x9b0b('0x19')]();}});}return _0x44c7e0;}function getName(_0x7cf37c){if(_0x7cf37c['indexOf']('\x20')>0x0){var _0x363dbc=_0x7cf37c[_0x9b0b('0x1e')](/ (.+)/);if(_0x363dbc[0x1]){return _0x363dbc;}}return[_0x7cf37c,_0x7cf37c];}var accountsTokens={};function getAccessToken(_0x4067d3){return new Promise(function(_0x565d35,_0x3f19ae){if(!_[_0x9b0b('0x1f')](accountsTokens[_0x4067d3['id']])&&!_[_0x9b0b('0x1f')](accountsTokens[_0x4067d3['id']][_0x9b0b('0x20')])){if(moment()['isBefore'](accountsTokens[_0x4067d3['id']][_0x9b0b('0x21')])){_0x565d35(accountsTokens[_0x4067d3['id']][_0x9b0b('0x20')]);}}var _0x499d4e;switch(_0x4067d3[_0x9b0b('0x22')]){case'US':_0x499d4e=_0x9b0b('0x23');break;case'AU':_0x499d4e=_0x9b0b('0x24');break;case'EU':_0x499d4e=_0x9b0b('0x25');break;case'IN':_0x499d4e=_0x9b0b('0x26');break;case'CN':_0x499d4e=_0x9b0b('0x27');break;default:_0x499d4e=_0x9b0b('0x25');break;}var _0x322a0b={'method':_0x9b0b('0x28'),'uri':_0x499d4e+'/oauth/v2/token','qs':{'refresh_token':_0x4067d3[_0x9b0b('0x29')],'client_id':_0x4067d3[_0x9b0b('0x2a')],'client_secret':_0x4067d3[_0x9b0b('0x2b')],'grant_type':_0x9b0b('0x2c')},'json':!![]};return rp(_0x322a0b)['then'](function(_0x217ac4){accountsTokens[_0x4067d3['id']]={'access_token':_0x217ac4[_0x9b0b('0x20')],'expires_in':moment()['add'](_0x217ac4[_0x9b0b('0x21')],_0x9b0b('0x2d'))};_0x565d35(_0x217ac4[_0x9b0b('0x20')]);})['catch'](function(_0x2cfe21){logger[_0x9b0b('0x2e')](_0x9b0b('0x2f'),_0x2cfe21['stack']);_0x3f19ae(_0x2cfe21);});});}function getUser(_0x2575d8,_0x32668d,_0x21b533,_0x22ce12){logger['info'](_0x9b0b('0x30'));return request({'method':_0x9b0b('0x31'),'uri':util['format'](_0x9b0b('0x32'),_0x32668d),'qs':{'type':_0x9b0b('0x33')},'headers':{'Authorization':_0x9b0b('0x34')+_0x2575d8},'json':!![]})[_0x9b0b('0x35')](function(_0x3b0d5c){if(_0x3b0d5c[_0x9b0b('0x36')]){var _0xfd6ce=-0x1;if(_[_0x9b0b('0x37')](_0x3b0d5c['users'])){if(!_['isNil'](_0x22ce12)){_0xfd6ce=_[_0x9b0b('0x38')](_0x3b0d5c['users'],function(_0x2e3e91){return _0x2e3e91['email']===_0x22ce12;});}if(_0xfd6ce>=0x0){logger['info']('Agent\x20found!');}else{logger[_0x9b0b('0x39')](_0x9b0b('0x3a'));_0xfd6ce=_[_0x9b0b('0x38')](_0x3b0d5c[_0x9b0b('0x36')],function(_0x22f666){return _0x22f666[_0x9b0b('0x3b')][_0x9b0b('0x1c')]===_0x9b0b('0x3c');});}return _0x3b0d5c[_0x9b0b('0x36')][_0xfd6ce];}else{if(_0x3b0d5c[_0x9b0b('0x3d')][_0x9b0b('0x3b')][_0x9b0b('0x1c')]===_0x9b0b('0x3c')){logger['info'](_0x9b0b('0x3a'));user=_0x3b0d5c[_0x9b0b('0x3d')];return user;}else{logger[_0x9b0b('0x2e')](_0x9b0b('0x3e'),JSON[_0x9b0b('0x10')](_0x3b0d5c));throw new Error(_0x9b0b('0x3f')+JSON[_0x9b0b('0x10')](_0x3b0d5c));}}}else{logger[_0x9b0b('0x2e')](_0x9b0b('0x3e'),JSON[_0x9b0b('0x10')](_0x3b0d5c));throw new Error(_0x9b0b('0x3f')+JSON[_0x9b0b('0x10')](_0x3b0d5c));}})[_0x9b0b('0x40')](function(_0x561942){console['error'](_0x561942);});}function getZohoUser(_0x12a5c4,_0x8cfe7c){return new BPromise(function(_0xe60dec,_0x141563){request(_0x12a5c4)[_0x9b0b('0x35')](function(_0x509daf){var _0x117f22=null;if(_0x509daf){_0x117f22=_0x509daf[_0x9b0b('0x41')][0x0];_0x117f22[_0x9b0b('0x42')]=_0x8cfe7c;}_0xe60dec(_0x117f22);})[_0x9b0b('0x40')](function(_0x4d32b5){_0x141563(_0x4d32b5);});});}function createEndUser(_0x5ac75f,_0x1fffc4,_0x509632,_0x223dab,_0x316d86,_0x17a764){var _0x509632=getName(_0x509632);return request({'method':_0x9b0b('0x28'),'uri':_0x9b0b('0x43')+_0x1fffc4+_0x9b0b('0x44')+_[_0x9b0b('0x45')](_0x17a764[_0x9b0b('0x46')])+'s','body':{'data':[{'Last_Name':_0x509632[0x1],'First_Name':_0x509632[0x0],'Phone':_0x223dab,'Owner':{'name':!_[_0x9b0b('0x1f')](_0x316d86[_0x9b0b('0x47')][_0x9b0b('0x1c')])?_0x316d86[_0x9b0b('0x47')][_0x9b0b('0x1c')]:!_[_0x9b0b('0x1f')](_0x316d86['first_name'])?_0x316d86['first_name']+'\x20'+_0x316d86['last_name']:_0x316d86[_0x9b0b('0x48')],'id':_0x316d86['id']}}]},'headers':{'Authorization':_0x9b0b('0x34')+_0x5ac75f},'json':!![]})[_0x9b0b('0x35')](function(_0x424d9b){if(_0x424d9b&&_0x424d9b[_0x9b0b('0x41')][0x0]['code']==='SUCCESS'){var _0x20ec55=_0x424d9b[_0x9b0b('0x41')][0x0][_0x9b0b('0x49')];_0x20ec55[_0x9b0b('0x42')]=_['startCase'](_0x17a764[_0x9b0b('0x46')])+'s';return _0x20ec55;}logger[_0x9b0b('0x2e')](_0x9b0b('0x3e'),JSON[_0x9b0b('0x10')](data));throw new Error(_0x9b0b('0x4a')+JSON['stringify'](data));})[_0x9b0b('0x40')](function(_0x1d9b96){console[_0x9b0b('0x4b')](_0x9b0b('0x4c'),_0x1d9b96);});}function getEndUser(_0x14e8a2,_0x1a4dbb,_0x444d95,_0x37a27a,_0x4e5fac,_0x512ecc,_0x5bfa12){var _0x2b7938={'method':_0x9b0b('0x31'),'uri':'','headers':{'Authorization':_0x9b0b('0x34')+_0x14e8a2},'json':!![]};switch(_0x5bfa12[_0x9b0b('0x4d')]){case _0x9b0b('0x4e'):_0x2b7938[_0x9b0b('0x4f')]=_0x9b0b('0x43')+_0x1a4dbb+_0x9b0b('0x50')+_0x4e5fac+'))';return getZohoUser(_0x2b7938,_0x9b0b('0x51'))[_0x9b0b('0x35')](function(_0x1c83e1){if(_0x1c83e1)return _0x1c83e1;_0x2b7938['uri']=_0x9b0b('0x43')+_0x1a4dbb+_0x9b0b('0x52')+_0x4e5fac+'))';return getZohoUser(_0x2b7938,'Leads')['then'](function(_0xd9410f){if(_0xd9410f)return _0xd9410f;if(_0x5bfa12[_0x9b0b('0x46')]!=_0x9b0b('0x53')){return createEndUser(_0x14e8a2,_0x1a4dbb,_0x37a27a,_0x4e5fac,_0x512ecc,_0x5bfa12);}else{return{};}});});break;case _0x9b0b('0x54'):_0x2b7938['uri']=_0x9b0b('0x43')+_0x1a4dbb+_0x9b0b('0x50')+_0x4e5fac+'))';return getZohoUser(_0x2b7938,_0x9b0b('0x51'))[_0x9b0b('0x35')](function(_0x21f4c1){if(_0x21f4c1)return _0x21f4c1;if(_0x5bfa12[_0x9b0b('0x46')]!=_0x9b0b('0x53')){return createEndUser(_0x14e8a2,_0x1a4dbb,_0x37a27a,_0x4e5fac,_0x512ecc,_0x5bfa12);}else{return{};}});break;case _0x9b0b('0x55'):_0x2b7938[_0x9b0b('0x4f')]='https://www.zohoapis.'+_0x1a4dbb+_0x9b0b('0x52')+_0x4e5fac+'))';return getZohoUser(_0x2b7938,'Leads')[_0x9b0b('0x35')](function(_0x5eb636){if(_0x5eb636)return _0x5eb636;if(_0x5bfa12['moduleCreate']!=_0x9b0b('0x53')){return createEndUser(_0x14e8a2,_0x1a4dbb,_0x37a27a,_0x4e5fac,_0x512ecc,_0x5bfa12);}else{return{};}});break;}}function getCall(_0x2238d1,_0x369752,_0x103281,_0x105503,_0x278fb1,_0x43a913,_0x495b3e,_0x559691){logger['info'](_0x9b0b('0x56'));var _0x250b06={};_0x250b06[_0x9b0b('0x57')]={'name':!_[_0x9b0b('0x1f')](_0x105503[_0x9b0b('0x47')][_0x9b0b('0x1c')])&&!_['isNil'](_0x105503[_0x9b0b('0x3b')][_0x9b0b('0x1c')])&&_0x105503['profile']['name']==='administrator'?_0x105503[_0x9b0b('0x47')][_0x9b0b('0x1c')]:!_['isNil'](_0x105503['first_name'])?_0x105503['first_name']+'\x20'+_0x105503[_0x9b0b('0x48')]:_0x105503[_0x9b0b('0x48')],'id':_0x105503['id']};_0x250b06[_0x9b0b('0x58')]=intUtil[_0x9b0b('0x59')](_0x43a913[_0x9b0b('0x5a')],_0x495b3e,'\x20');_0x250b06[_0x9b0b('0x5b')]=intUtil[_0x9b0b('0x59')](_0x43a913[_0x9b0b('0x5c')],_0x495b3e,'\x0a');if(_0x278fb1[_0x9b0b('0x42')]===_0x9b0b('0x51')){_0x250b06[_0x9b0b('0x5d')]={'name':!_['isNil'](_0x278fb1[_0x9b0b('0x5e')])?_0x278fb1[_0x9b0b('0x5e')]:!_['isNil'](_0x278fb1[_0x9b0b('0x5f')])?_0x278fb1[_0x9b0b('0x5f')]+'\x20'+_0x278fb1['Last_Name']:_0x278fb1[_0x9b0b('0x60')],'id':_0x278fb1['id']};}if(_0x278fb1[_0x9b0b('0x42')]===_0x9b0b('0x61')){_0x250b06[_0x9b0b('0x62')]={'name':!_[_0x9b0b('0x1f')](_0x278fb1['Full_Name'])?_0x278fb1[_0x9b0b('0x5e')]:!_[_0x9b0b('0x1f')](_0x278fb1[_0x9b0b('0x5f')])?_0x278fb1[_0x9b0b('0x5f')]+'\x20'+_0x278fb1['Last_Name']:_0x278fb1['Last_Name'],'id':_0x278fb1['id']};_0x250b06[_0x9b0b('0x63')]=_[_0x9b0b('0x45')](_0x278fb1['enduserType']);}if(_0x495b3e['talktime']){_0x250b06[_0x9b0b('0x64')]=moment[_0x9b0b('0x65')](parseInt(_0x495b3e[_0x9b0b('0x66')])*0x3e8)[_0x9b0b('0x67')](_0x9b0b('0x68'));}else if(_0x495b3e[_0x9b0b('0x69')]&&_0x495b3e[_0x9b0b('0x6a')]){_0x250b06[_0x9b0b('0x64')]=moment['utc'](moment(_0x495b3e[_0x9b0b('0x6a')],_0x9b0b('0x6b'))[_0x9b0b('0x6c')](moment(_0x495b3e[_0x9b0b('0x6d')],'YYYY-MM-DDTHH:mm:ss')))[_0x9b0b('0x67')]('mm:ss');}switch(_0x495b3e[_0x9b0b('0x6e')]){case _0x9b0b('0x6f'):_0x250b06[_0x9b0b('0x70')]=_0x9b0b('0x71');break;case _0x9b0b('0x72'):case'connect':_0x250b06[_0x9b0b('0x70')]=_0x9b0b('0x73');break;case _0x9b0b('0x74'):_0x250b06[_0x9b0b('0x70')]='Rejected';break;case _0x9b0b('0x75'):_0x250b06[_0x9b0b('0x70')]=_0x9b0b('0x76');break;case _0x9b0b('0x77'):_0x250b06[_0x9b0b('0x70')]='Timeout';default:}_0x250b06[_0x9b0b('0x78')]=(_0x559691===_0x9b0b('0x79')?moment(_0x495b3e['starttime'])[_0x9b0b('0x67')](_0x9b0b('0x6b')):moment(_0x495b3e[_0x9b0b('0x7a')])[_0x9b0b('0x67')](_0x9b0b('0x6b')))||moment()[_0x9b0b('0x67')](_0x9b0b('0x6b'));_0x250b06[_0x9b0b('0x7b')]=_0x559691||_0x9b0b('0x7c');_0x250b06=_[_0x9b0b('0x7d')](_0x250b06,getCustomFields(_0x43a913[_0x9b0b('0x7e')],_0x495b3e));return request({'method':_0x9b0b('0x28'),'uri':_0x9b0b('0x43')+_0x369752+'/crm/v2/Calls','headers':{'Authorization':_0x9b0b('0x34')+_0x2238d1},'body':{'data':[_0x250b06]},'json':!![]})[_0x9b0b('0x35')](function(_0x5dd73b){if(_0x5dd73b&&_0x5dd73b['data'][0x0][_0x9b0b('0x7f')]==='SUCCESS'){logger[_0x9b0b('0x39')](_0x9b0b('0x80'));return{'id':_0x5dd73b[_0x9b0b('0x41')][0x0][_0x9b0b('0x49')]['id']};}})[_0x9b0b('0x40')](function(_0x404729){logger['info'](_0x9b0b('0x81'),_0x404729[_0x9b0b('0x82')]);console[_0x9b0b('0x4b')](_0x9b0b('0x81'),_0x404729);});}exports[_0x9b0b('0x83')]=function(_0x732298,_0x299764,_0x2341c3,_0x2ef8ad,_0x3022ff,_0x206e35){var _0x4479cf,_0x26f066,_0x5c58a5;_0x206e35['host']=intUtil[_0x9b0b('0x84')](_0x206e35[_0x9b0b('0x85')]);_0x206e35[_0x9b0b('0x86')]=intUtil[_0x9b0b('0x84')](_0x206e35[_0x9b0b('0x86')]);if(_0x3022ff&&_0x3022ff[_0x9b0b('0x87')]){logger[_0x9b0b('0x39')](_0x9b0b('0x88'),_0x9b0b('0x89'));_0x299764[_0x9b0b('0x8a')]=_0x206e35[_0x9b0b('0x86')]+'/api/voice/recordings/'+_0x299764[_0x9b0b('0x8b')]+_0x9b0b('0x8c')+md5(_0x299764['uniqueid']);}else{_0x299764['recordingURL']='';}var _0x34ff91=_0x206e35[_0x9b0b('0x85')]===_0x9b0b('0x8d')?'eu':_0x9b0b('0x8e');return getAccessToken(_0x206e35)[_0x9b0b('0x35')](function(_0x3852ea){_0x5c58a5=_0x3852ea;return getUser(_0x5c58a5,_0x34ff91,_0x206e35,_0x2ef8ad['email']);})[_0x9b0b('0x35')](function(_0xf64360){_0x4479cf=_0xf64360;logger[_0x9b0b('0x39')]('The\x20User\x20ID\x20is:',_0x4479cf['id']);return getEndUser(_0x5c58a5,_0x34ff91,_0x206e35,_0x299764['calleridname'],_0x299764[_0x9b0b('0x8f')],_0x4479cf,_0x2341c3);})[_0x9b0b('0x35')](function(_0x206cb1){_0x26f066=_0x206cb1;return getCall(_0x5c58a5,_0x34ff91,_0x206e35,_0x4479cf,_0x26f066,_0x2341c3,_0x299764,_0x9b0b('0x7c'));})[_0x9b0b('0x35')](function(_0x2db4fc){if(_0x2db4fc){logger['info']('The\x20Call\x20ID\x20is:',_0x2db4fc['id']);logger['info']('[QUEUE]',_0x9b0b('0x90'));emit(util['format'](_0x9b0b('0x91'),_0x2ef8ad[_0x9b0b('0x1c')]),_0x9b0b('0x92'),{'uri':_0x9b0b('0x93')+_0x206e35[_0x9b0b('0x85')]+_0x9b0b('0x94')+_0x2db4fc['id']});}})[_0x9b0b('0x40')](function(_0x30637c){logger['error'](_0x9b0b('0x88'),JSON['stringify'](_0x30637c));});};exports[_0x9b0b('0x79')]=function(_0x20484b,_0xd8cb35,_0x9dcebe,_0x132612,_0x3152e6,_0x7e4a18,_0x32103e){var _0x553b52,_0xf5a3cc,_0xe502b;_0x7e4a18[_0x9b0b('0x85')]=intUtil['stripTrailingSlash'](_0x7e4a18[_0x9b0b('0x85')]);_0x7e4a18[_0x9b0b('0x86')]=intUtil['stripTrailingSlash'](_0x7e4a18['serverUrl']);if(_0x32103e&&_0x32103e[_0x9b0b('0x95')]&&_0x32103e[_0x9b0b('0x95')]!==_0x9b0b('0x96')){logger['info'](_0x9b0b('0x97'),_0x9b0b('0x89'));_0xd8cb35['recordingURL']=_0x7e4a18[_0x9b0b('0x86')]+_0x9b0b('0x98')+_0xd8cb35[_0x9b0b('0x8b')]+'/downloads?type=uniqueid&token='+md5(_0xd8cb35[_0x9b0b('0x8b')]);}var _0x1ddbb3=_0x7e4a18[_0x9b0b('0x85')]==='zoho.eu'?'eu':_0x9b0b('0x8e');return getAccessToken(_0x7e4a18)[_0x9b0b('0x35')](function(_0x563929){_0xe502b=_0x563929;return getUser(_0xe502b,_0x1ddbb3,_0x7e4a18,_0x132612[_0x9b0b('0x99')]);})[_0x9b0b('0x35')](function(_0x221873){_0x553b52=_0x221873;logger[_0x9b0b('0x39')](_0x9b0b('0x9a'),_0x553b52['id']);return getEndUser(_0xe502b,_0x1ddbb3,_0x7e4a18,_0xd8cb35[_0x9b0b('0x9b')],_0xd8cb35[_0x9b0b('0x9c')],_0x553b52,_0x9dcebe);})[_0x9b0b('0x35')](function(_0x40c624){_0xf5a3cc=_0x40c624;return getCall(_0xe502b,_0x1ddbb3,_0x7e4a18,_0x553b52,_0xf5a3cc,_0x9dcebe,_0xd8cb35,'Outbound');})[_0x9b0b('0x35')](function(_0x409ca1){if(_0x409ca1){logger[_0x9b0b('0x39')](_0x9b0b('0x9d'),_0x409ca1['id']);logger[_0x9b0b('0x39')](_0x9b0b('0x97'),_0x9b0b('0x90'));emit(util[_0x9b0b('0x67')](_0x9b0b('0x91'),_0x132612[_0x9b0b('0x1c')]),'trigger:browser:url',{'uri':_0x9b0b('0x93')+_0x7e4a18[_0x9b0b('0x85')]+'/crm/EntityInfo.do?module=Calls&id='+_0x409ca1['id']});}})[_0x9b0b('0x40')](function(_0x1329bc){logger[_0x9b0b('0x2e')]('[OUTBOUND]',JSON['stringify'](_0x1329bc));});};exports['unmanaged']=function(_0x4ee992,_0x3b6ccc,_0x2cbb96,_0x384052,_0x3bece4,_0x1050ec){var _0x537180,_0x153311,_0x194163;_0x1050ec[_0x9b0b('0x85')]=intUtil[_0x9b0b('0x84')](_0x1050ec[_0x9b0b('0x85')]);_0x1050ec['serverUrl']=intUtil['stripTrailingSlash'](_0x1050ec[_0x9b0b('0x86')]);if(_0x3bece4&&_0x3bece4[_0x9b0b('0x87')]){logger[_0x9b0b('0x39')]('['+_0x3b6ccc[_0x9b0b('0x6e')][_0x9b0b('0x9e')]()+']','Recording\x20is\x20enabled!');_0x3b6ccc[_0x9b0b('0x8a')]=_0x1050ec['serverUrl']+_0x9b0b('0x98')+_0x3b6ccc[_0x9b0b('0x8b')]+_0x9b0b('0x8c')+md5(_0x3b6ccc[_0x9b0b('0x8b')]);}else{_0x3b6ccc['recordingURL']='';}var _0x93cf44=_0x1050ec['host']==='zoho.eu'?'eu':_0x9b0b('0x8e');return getAccessToken(_0x1050ec)[_0x9b0b('0x35')](function(_0x177486){_0x194163=_0x177486;return getUser(_0x194163,_0x93cf44,_0x1050ec);})['then'](function(_0x5d4ed2){_0x537180=_0x5d4ed2;logger[_0x9b0b('0x39')](_0x9b0b('0x9a'),_0x537180['id']);return getEndUser(_0x194163,_0x93cf44,_0x1050ec,_0x3b6ccc[_0x9b0b('0x9f')],_0x3b6ccc['calleridnum'],_0x537180,_0x2cbb96);})[_0x9b0b('0x35')](function(_0x1b63a8){_0x153311=_0x1b63a8;return getCall(_0x194163,_0x93cf44,_0x1050ec,_0x537180,_0x153311,_0x2cbb96,_0x3b6ccc,'Inbound');})[_0x9b0b('0x35')](function(_0x263177){if(_0x263177){logger[_0x9b0b('0x39')](_0x9b0b('0x9d'),_0x263177['id']);}})[_0x9b0b('0x40')](function(_0xad8bd0){logger[_0x9b0b('0x2e')]('['+_0x3b6ccc[_0x9b0b('0x6e')][_0x9b0b('0x9e')]()+']',JSON[_0x9b0b('0x10')](_0xad8bd0));});}; \ 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 22f83f9..0ce8cd8 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 _0x3e52=['util','shelljs','mustache','../../../../config/logger','exec','data2','Script','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s'];(function(_0x52fc98,_0x5aac29){var _0x1a70b4=function(_0x3d7578){while(--_0x3d7578){_0x52fc98['push'](_0x52fc98['shift']());}};_0x1a70b4(++_0x5aac29);}(_0x3e52,0x134));var _0x23e5=function(_0x2db845,_0x38d794){_0x2db845=_0x2db845-0x0;var _0x247735=_0x3e52[_0x2db845];return _0x247735;};'use strict';var util=require(_0x23e5('0x0'));var sh=require(_0x23e5('0x1'));var Mustache=require(_0x23e5('0x2'));var logger=require(_0x23e5('0x3'))('trigger');exports[_0x23e5('0x4')]=function(_0x119d49,_0x2e41be){var _0x3e93e2=_0x119d49['data2']?_0x119d49[_0x23e5('0x5')]:_0x23e5('0x6');var _0x2a67e9=_0x119d49[_0x23e5('0x7')]?Mustache[_0x23e5('0x8')](_0x119d49[_0x23e5('0x7')],_0x2e41be):_0x2e41be;sh[_0x23e5('0x4')](_0x2a67e9,function(_0x33fc9e,_0xa0287a,_0x3ca441){if(_0x33fc9e!==0x0){logger[_0x23e5('0x9')](util[_0x23e5('0xa')](_0x23e5('0xb'),_0x3e93e2,_0x2a67e9,_0x33fc9e,_0x3ca441));}else{logger[_0x23e5('0xc')](util[_0x23e5('0xa')](_0x23e5('0xd'),_0x3e93e2,_0x2a67e9,_0xa0287a));}});}; \ No newline at end of file +var _0xc473=['error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger','exec','data2','data3','render'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xc473,0xad));var _0x3c47=function(_0x553263,_0x19ff84){_0x553263=_0x553263-0x0;var _0x5229ae=_0xc473[_0x553263];return _0x5229ae;};'use strict';var util=require(_0x3c47('0x0'));var sh=require(_0x3c47('0x1'));var Mustache=require(_0x3c47('0x2'));var logger=require(_0x3c47('0x3'))(_0x3c47('0x4'));exports[_0x3c47('0x5')]=function(_0x4a39cd,_0x98d184){var _0x352036=_0x4a39cd['data2']?_0x4a39cd[_0x3c47('0x6')]:'Script';var _0x3ecf01=_0x4a39cd[_0x3c47('0x7')]?Mustache[_0x3c47('0x8')](_0x4a39cd[_0x3c47('0x7')],_0x98d184):_0x98d184;sh[_0x3c47('0x5')](_0x3ecf01,function(_0x3680d8,_0x53c433,_0x54a564){if(_0x3680d8!==0x0){logger[_0x3c47('0x9')](util[_0x3c47('0xa')](_0x3c47('0xb'),_0x352036,_0x3ecf01,_0x3680d8,_0x54a564));}else{logger[_0x3c47('0xc')](util['format'](_0x3c47('0xd'),_0x352036,_0x3ecf01,_0x53c433));}});}; \ 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 2ed9dd6..e7b1ee8 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 _0x8f95=['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','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','request-promise','util','lodash','../../../../config/logger','trigger','exec','toUpperCase','render','data2','data5','number','headers','data6','parse','data1','GET','DELETE','POST','PUT','data7','body','error','stack'];(function(_0x5f1cf8,_0x5e0923){var _0x27d0fa=function(_0x3f1171){while(--_0x3f1171){_0x5f1cf8['push'](_0x5f1cf8['shift']());}};_0x27d0fa(++_0x5e0923);}(_0x8f95,0xc1));var _0x58f9=function(_0x10d9a7,_0xfe57bc){_0x10d9a7=_0x10d9a7-0x0;var _0xaca2bd=_0x8f95[_0x10d9a7];return _0xaca2bd;};'use strict';var rp=require(_0x58f9('0x0'));var util=require(_0x58f9('0x1'));var _=require(_0x58f9('0x2'));var Mustache=require('mustache');var logger=require(_0x58f9('0x3'))(_0x58f9('0x4'));exports[_0x58f9('0x5')]=function(_0x121cbd,_0x444afd){var _0x6e1589,_0x5f22da;var _0x51d82b={'method':_0x121cbd['data1'][_0x58f9('0x6')](),'uri':Mustache[_0x58f9('0x7')](_0x121cbd[_0x58f9('0x8')],_0x444afd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x121cbd[_0x58f9('0x9')])===_0x58f9('0xa')&&parseInt(_0x121cbd[_0x58f9('0x9')])>=0x1&&parseInt(_0x121cbd[_0x58f9('0x9')])<=0xa?parseInt(_0x121cbd['data5'])*0x3e8:0x5*0x3e8};try{_0x51d82b[_0x58f9('0xb')]=_0x121cbd[_0x58f9('0xc')]?JSON[_0x58f9('0xd')](Mustache[_0x58f9('0x7')](_0x121cbd[_0x58f9('0xc')],_0x444afd)):{};}catch(_0x125e01){logger['error'](_0x125e01['stack']);}switch(_0x121cbd[_0x58f9('0xe')]['toUpperCase']()){case _0x58f9('0xf'):case _0x58f9('0x10'):_0x6e1589=null;_0x51d82b['qs']=_0x444afd;break;case _0x58f9('0x11'):case _0x58f9('0x12'):if(_0x121cbd[_0x58f9('0x13')]){try{_0x6e1589=JSON[_0x58f9('0xd')](Mustache[_0x58f9('0x7')](_0x121cbd[_0x58f9('0x13')],_0x444afd));_0x51d82b[_0x58f9('0x14')]=_0x6e1589;}catch(_0x5a278a){logger[_0x58f9('0x15')](_0x5a278a[_0x58f9('0x16')]);logger[_0x58f9('0x15')](_0x58f9('0x17'));}}else{_0x6e1589=_0x444afd;_0x51d82b[_0x58f9('0x14')]=_0x6e1589;}break;}logger[_0x58f9('0x18')](util[_0x58f9('0x19')](_0x58f9('0x1a'),_0x121cbd[_0x58f9('0xe')],_0x121cbd[_0x58f9('0x8')],JSON[_0x58f9('0x1b')](_0x51d82b)));rp(_0x51d82b)[_0x58f9('0x1c')](function(_0x4caacb){_0x6e1589=!_['isNil'](_0x6e1589)?_0x58f9('0x1d')+_0x6e1589:'';_0x5f22da=typeof _0x4caacb[_0x58f9('0x14')]===_0x58f9('0x1e')?JSON['stringify'](_0x4caacb[_0x58f9('0x14')]):_0x4caacb['body'];logger[_0x58f9('0x18')](util[_0x58f9('0x19')](_0x58f9('0x1f'),_0x121cbd[_0x58f9('0xe')],_0x121cbd[_0x58f9('0x8')],_0x4caacb[_0x58f9('0x20')],_0x5f22da));})[_0x58f9('0x21')](function(_0x371272){logger['error'](util['format'](_0x58f9('0x22'),_0x121cbd[_0x58f9('0xe')],_0x121cbd['data2'],_0x371272[_0x58f9('0x20')],_0x371272['name'],_0x371272[_0x58f9('0x23')]));});}; \ No newline at end of file +var _0x4d5c=['DELETE','POST','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',',\x20request\x20body:\x20','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','request-promise','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','data5','number','headers','data6','parse','error','stack','GET'];(function(_0x51f4b2,_0x2e0eca){var _0x1d60bb=function(_0x1a0488){while(--_0x1a0488){_0x51f4b2['push'](_0x51f4b2['shift']());}};_0x1d60bb(++_0x2e0eca);}(_0x4d5c,0x181));var _0xc4d5=function(_0x12bcf7,_0xc11103){_0x12bcf7=_0x12bcf7-0x0;var _0x2825a=_0x4d5c[_0x12bcf7];return _0x2825a;};'use strict';var rp=require(_0xc4d5('0x0'));var util=require('util');var _=require(_0xc4d5('0x1'));var Mustache=require(_0xc4d5('0x2'));var logger=require(_0xc4d5('0x3'))(_0xc4d5('0x4'));exports[_0xc4d5('0x5')]=function(_0x41cbaa,_0x888205){var _0x2ba665,_0x428841;var _0x943749={'method':_0x41cbaa[_0xc4d5('0x6')][_0xc4d5('0x7')](),'uri':Mustache[_0xc4d5('0x8')](_0x41cbaa[_0xc4d5('0x9')],_0x888205),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x41cbaa[_0xc4d5('0xa')])===_0xc4d5('0xb')&&parseInt(_0x41cbaa[_0xc4d5('0xa')])>=0x1&&parseInt(_0x41cbaa['data5'])<=0xa?parseInt(_0x41cbaa[_0xc4d5('0xa')])*0x3e8:0x5*0x3e8};try{_0x943749[_0xc4d5('0xc')]=_0x41cbaa[_0xc4d5('0xd')]?JSON[_0xc4d5('0xe')](Mustache['render'](_0x41cbaa[_0xc4d5('0xd')],_0x888205)):{};}catch(_0x41aafe){logger[_0xc4d5('0xf')](_0x41aafe[_0xc4d5('0x10')]);}switch(_0x41cbaa['data1']['toUpperCase']()){case _0xc4d5('0x11'):case _0xc4d5('0x12'):_0x2ba665=null;_0x943749['qs']=_0x888205;break;case _0xc4d5('0x13'):case'PUT':if(_0x41cbaa[_0xc4d5('0x14')]){try{_0x2ba665=JSON['parse'](Mustache['render'](_0x41cbaa[_0xc4d5('0x14')],_0x888205));_0x943749[_0xc4d5('0x15')]=_0x2ba665;}catch(_0x2d7395){logger[_0xc4d5('0xf')](_0x2d7395[_0xc4d5('0x10')]);logger[_0xc4d5('0xf')](_0xc4d5('0x16'));}}else{_0x2ba665=_0x888205;_0x943749['body']=_0x2ba665;}break;}logger[_0xc4d5('0x17')](util[_0xc4d5('0x18')](_0xc4d5('0x19'),_0x41cbaa[_0xc4d5('0x6')],_0x41cbaa['data2'],JSON['stringify'](_0x943749)));rp(_0x943749)['then'](function(_0x29b211){_0x2ba665=!_['isNil'](_0x2ba665)?_0xc4d5('0x1a')+_0x2ba665:'';_0x428841=typeof _0x29b211[_0xc4d5('0x15')]==='object'?JSON[_0xc4d5('0x1b')](_0x29b211[_0xc4d5('0x15')]):_0x29b211[_0xc4d5('0x15')];logger[_0xc4d5('0x17')](util[_0xc4d5('0x18')](_0xc4d5('0x1c'),_0x41cbaa[_0xc4d5('0x6')],_0x41cbaa[_0xc4d5('0x9')],_0x29b211['statusCode'],_0x428841));})['catch'](function(_0x52ee61){logger[_0xc4d5('0xf')](util[_0xc4d5('0x18')](_0xc4d5('0x1d'),_0x41cbaa['data1'],_0x41cbaa['data2'],_0x52ee61['statusCode'],_0x52ee61[_0xc4d5('0x1e')],_0x52ee61['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index bca6560..5ac88ba 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 _0xddf5=['exports','jayson/promise','../../config/logger','routing','client','Request','then','debug','error','message','result','catch','rpc'];(function(_0x4ea224,_0x463318){var _0x4e363e=function(_0x19be03){while(--_0x19be03){_0x4ea224['push'](_0x4ea224['shift']());}};_0x4e363e(++_0x463318);}(_0xddf5,0x146));var _0x5ddf=function(_0x2a2ac6,_0x355926){_0x2a2ac6=_0x2a2ac6-0x0;var _0x3f1cc4=_0xddf5[_0x2a2ac6];return _0x3f1cc4;};'use strict';var jayson=require(_0x5ddf('0x0'));var BPromise=require('bluebird');var logger=require(_0x5ddf('0x1'))(_0x5ddf('0x2'));var client=jayson[_0x5ddf('0x3')]['http']({'port':0x2329});client[_0x5ddf('0x4')]=function(_0x2135a6,_0x1b5b57){return new BPromise(function(_0x2a4224,_0xe3c2d1){return client['request'](_0x2135a6,_0x1b5b57)[_0x5ddf('0x5')](function(_0x36b7e1){logger[_0x5ddf('0x6')]('rpc',_0x5ddf('0x2'),_0x2135a6,_0x1b5b57,_0x36b7e1);if(_0x36b7e1[_0x5ddf('0x7')]){logger['error']('rpc',_0x5ddf('0x2'),_0x2135a6,_0x36b7e1[_0x5ddf('0x7')]['message'],_0x1b5b57);return _0xe3c2d1(_0x36b7e1[_0x5ddf('0x7')][_0x5ddf('0x8')]);}else{return _0x2a4224(_0x36b7e1[_0x5ddf('0x9')]);}})[_0x5ddf('0xa')](function(_0x424614){logger[_0x5ddf('0x7')](_0x5ddf('0xb'),_0x5ddf('0x2'),_0x2135a6,_0x424614,_0x1b5b57);return _0xe3c2d1(_0x424614);});});};module[_0x5ddf('0xc')]=client; \ No newline at end of file +var _0x9ace=['routing','client','request','then','debug','rpc','error','message','result','catch','../../config/logger'];(function(_0x15da95,_0x2a6b25){var _0x5cfdc5=function(_0x3c899e){while(--_0x3c899e){_0x15da95['push'](_0x15da95['shift']());}};_0x5cfdc5(++_0x2a6b25);}(_0x9ace,0x11d));var _0xe9ac=function(_0x52519f,_0x8b7239){_0x52519f=_0x52519f-0x0;var _0x5ad473=_0x9ace[_0x52519f];return _0x5ad473;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0xe9ac('0x0'))(_0xe9ac('0x1'));var client=jayson[_0xe9ac('0x2')]['http']({'port':0x2329});client['Request']=function(_0x3e57c5,_0x204591){return new BPromise(function(_0x520783,_0x3130a3){return client[_0xe9ac('0x3')](_0x3e57c5,_0x204591)[_0xe9ac('0x4')](function(_0x4f4acb){logger[_0xe9ac('0x5')](_0xe9ac('0x6'),_0xe9ac('0x1'),_0x3e57c5,_0x204591,_0x4f4acb);if(_0x4f4acb[_0xe9ac('0x7')]){logger['error'](_0xe9ac('0x6'),_0xe9ac('0x1'),_0x3e57c5,_0x4f4acb[_0xe9ac('0x7')][_0xe9ac('0x8')],_0x204591);return _0x3130a3(_0x4f4acb[_0xe9ac('0x7')]['message']);}else{return _0x520783(_0x4f4acb[_0xe9ac('0x9')]);}})[_0xe9ac('0xa')](function(_0x23f753){logger[_0xe9ac('0x7')](_0xe9ac('0x6'),_0xe9ac('0x1'),_0x3e57c5,_0x23f753,_0x204591);return _0x3130a3(_0x23f753);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 410a6ba..dd6f5bd 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 _0xed48=['listen','getSettings','loginMailFrequency','log','./server','./lib/email','resolve','then','getMailAccounts','initMailAccounts'];(function(_0x4f0e62,_0x28e44f){var _0x117ab8=function(_0x1a74bb){while(--_0x1a74bb){_0x4f0e62['push'](_0x4f0e62['shift']());}};_0x117ab8(++_0x28e44f);}(_0xed48,0x90));var _0x8ed4=function(_0x503cd5,_0x57774a){_0x503cd5=_0x503cd5-0x0;var _0x1fdf1e=_0xed48[_0x503cd5];return _0x1fdf1e;};'use strict';var BPromise=require('bluebird');var server=require(_0x8ed4('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0x8ed4('0x1'));var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x8ed4('0x2')]()[_0x8ed4('0x3')](mailAccount[_0x8ed4('0x4')]())[_0x8ed4('0x3')](realtime[_0x8ed4('0x5')]())['then'](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x8ed4('0x6')](realtime,email)[_0x8ed4('0x3')](function(){return initRealtime();})[_0x8ed4('0x3')](function(){return setting[_0x8ed4('0x7')]();})['then'](function(_0x3ad89e){return setInterval(initRealtime,_0x3ad89e[_0x8ed4('0x8')]*0x3e8);})['catch'](function(_0x27b35f){console[_0x8ed4('0x9')](_0x27b35f);});}main(); \ No newline at end of file +var _0xc664=['getMailAccounts','then','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','log','bluebird','./server','./realtime','./lib/email','./rpc/setting','resolve'];(function(_0x4e7c2,_0x3b3347){var _0x84bb35=function(_0x217b38){while(--_0x217b38){_0x4e7c2['push'](_0x4e7c2['shift']());}};_0x84bb35(++_0x3b3347);}(_0xc664,0x1ad));var _0x4c66=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc664[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x4c66('0x0'));var server=require(_0x4c66('0x1'));var Realtime=require(_0x4c66('0x2'));var EmailChannel=require(_0x4c66('0x3'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0x4c66('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x4c66('0x5')]()['then'](mailAccount[_0x4c66('0x6')]())[_0x4c66('0x7')](realtime['initMailAccounts']())[_0x4c66('0x7')](function(){email[_0x4c66('0x8')](realtime[_0x4c66('0x9')]);return realtime;});}function main(){return server[_0x4c66('0xa')](realtime,email)[_0x4c66('0x7')](function(){return initRealtime();})[_0x4c66('0x7')](function(){return setting[_0x4c66('0xb')]();})[_0x4c66('0x7')](function(_0x267065){return setInterval(initRealtime,_0x267065[_0x4c66('0xc')]*0x3e8);})[_0x4c66('0xd')](function(_0xbb2bf7){console[_0x4c66('0xe')](_0xbb2bf7);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 26119d0..9ee40c0 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 _0x19f2=['Smtp','verify','exports','lodash','moment','bluebird','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','smtp','prototype','emit','Imap','status','messageStatus','total','isNil','stringify','md5','refresh','hasOwnProperty','active','imapAccounts','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','connected','name','messages','firstName','lastName','from','notify','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','verifySmtp'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x19f2,0x176));var _0x219f=function(_0x3f5dca,_0x59472b){_0x3f5dca=_0x3f5dca-0x0;var _0x5b833a=_0x19f2[_0x3f5dca];return _0x5b833a;};'use strict';var _=require(_0x219f('0x0'));var moment=require(_0x219f('0x1'));var BPromise=require(_0x219f('0x2'));var md5=require('md5');var Redis=require(_0x219f('0x3'));var config=require(_0x219f('0x4'));var logger=require(_0x219f('0x5'))(_0x219f('0x6'));config[_0x219f('0x7')]=_[_0x219f('0x8')](config[_0x219f('0x7')],{'host':_0x219f('0x9'),'port':0x18eb});var io=require(_0x219f('0xa'))(new Redis(config['redis']));var EmailImap=require(_0x219f('0xb'));var EmailSmtp=require(_0x219f('0xc'));var mailAccount=require(_0x219f('0xd'));var md5Accounts={};function EmailChannel(_0x1a3271){logger[_0x219f('0xe')]('start\x20email\x20channel');this[_0x219f('0xf')]=_0x1a3271[_0x219f('0xf')];this['imapAccounts']={};this[_0x219f('0x10')]=new EmailSmtp();}EmailChannel[_0x219f('0x11')][_0x219f('0x12')]=function(_0x3b1294){var _0x236d1d=this[_0x219f('0xf')][_0x3b1294];var _0x3b094b={'id':_0x236d1d['id'],'name':_0x236d1d['name'],'key':_0x236d1d['key'],'active':_0x236d1d['active'],'Imap':{'status':_0x236d1d[_0x219f('0x13')][_0x219f('0x14')],'messageStatus':_0x236d1d[_0x219f('0x13')][_0x219f('0x15')],'total':_0x236d1d[_0x219f('0x13')][_0x219f('0x16')]}};if(_[_0x219f('0x17')](md5Accounts[_0x3b1294])){md5Accounts[_0x3b1294]={};}var _0x41f08f=md5(JSON[_0x219f('0x18')](_0x3b094b));if(md5Accounts[_0x3b1294][_0x219f('0x19')]!==_0x41f08f){md5Accounts[_0x3b1294][_0x219f('0x19')]=_0x41f08f;io[_0x219f('0x12')]('mailAccount:update',_0x3b094b);}};EmailChannel[_0x219f('0x11')][_0x219f('0x1a')]=function(_0xfc55aa){for(var _0x4e04f3 in _0xfc55aa){if(_0xfc55aa[_0x219f('0x1b')](_0x4e04f3)){if(_0xfc55aa[_0x4e04f3][_0x219f('0x13')]&&_0xfc55aa[_0x4e04f3][_0x219f('0x1c')]){var _0x2316ad=_0xfc55aa[_0x4e04f3][_0x219f('0x13')];if(!this[_0x219f('0x1d')][_0x219f('0x1b')](_0x2316ad['id'])){this[_0x219f('0x1d')][_0x2316ad['id']]=new EmailImap(_0x2316ad,_0xfc55aa[_0x4e04f3]['email']);this[_0x219f('0x1d')][_0x2316ad['id']]['on'](_0x219f('0x1e'),this[_0x219f('0x1f')][_0x219f('0x20')](this,_0x4e04f3));this[_0x219f('0x1d')][_0x2316ad['id']]['on']('email',this[_0x219f('0x21')]['bind'](this,_0x4e04f3));this[_0x219f('0x1d')][_0x2316ad['id']]['on'](_0x219f('0x22'),this[_0x219f('0x23')][_0x219f('0x20')](this,_0x4e04f3));this['imapAccounts'][_0x2316ad['id']]['on'](_0x219f('0x24'),this[_0x219f('0x25')]['bind'](this,_0x4e04f3));}}else{if(_[_0x219f('0x17')](this['mailAccounts'][_0x4e04f3][_0x219f('0x13')])){this[_0x219f('0xf')][_0x4e04f3][_0x219f('0x13')]={};}this[_0x219f('0xf')][_0x4e04f3][_0x219f('0x13')][_0x219f('0x14')]='disabled';this['mailAccounts'][_0x4e04f3][_0x219f('0x13')][_0x219f('0x15')]='';this[_0x219f('0x12')](_0x4e04f3);}}}};EmailChannel[_0x219f('0x11')][_0x219f('0x1f')]=function(_0x20bf0f,_0x58ca67){if(this[_0x219f('0xf')][_0x20bf0f]){this['mailAccounts'][_0x20bf0f][_0x219f('0x13')]['status']=_0x219f('0x26');this[_0x219f('0xf')][_0x20bf0f][_0x219f('0x13')][_0x219f('0x15')]=_0x58ca67[_0x219f('0x27')];if(_0x58ca67['messages']){this[_0x219f('0xf')][_0x20bf0f][_0x219f('0x13')][_0x219f('0x16')]=_0x58ca67[_0x219f('0x28')][_0x219f('0x16')];}return this[_0x219f('0x12')](_0x20bf0f);}};EmailChannel['prototype'][_0x219f('0x21')]=function(_0x3fe26a,_0x51802e){logger[_0x219f('0xe')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x51802e[_0x219f('0x29')],_0x51802e[_0x219f('0x2a')],_0x51802e[_0x219f('0x2b')],_0x3fe26a);if(this['mailAccounts'][_0x3fe26a]){return mailAccount[_0x219f('0x2c')](_0x3fe26a,_0x51802e)[_0x219f('0x2d')](function(_0x28a84c){if(_0x28a84c){logger[_0x219f('0xe')]('Mail\x20accepted\x20from\x20routing');}})[_0x219f('0x2e')](function(_0x50f2fc){logger[_0x219f('0x24')](_0x219f('0x2f'),JSON[_0x219f('0x18')](_0x50f2fc));});}};EmailChannel[_0x219f('0x11')][_0x219f('0x23')]=function(_0x4de993){if(this[_0x219f('0xf')][_0x4de993]&&this[_0x219f('0xf')][_0x4de993][_0x219f('0x13')]){if(this[_0x219f('0x1d')][this[_0x219f('0xf')][_0x4de993][_0x219f('0x13')]['id']]){delete this[_0x219f('0x1d')][this[_0x219f('0xf')][_0x4de993][_0x219f('0x13')]['id']];}this[_0x219f('0xf')][_0x4de993][_0x219f('0x13')][_0x219f('0x30')]=moment();this[_0x219f('0x12')](_0x4de993);}};EmailChannel['prototype'][_0x219f('0x25')]=function(_0x42ff99,_0x755e05){if(this[_0x219f('0xf')][_0x42ff99]){this[_0x219f('0xf')][_0x42ff99][_0x219f('0x13')][_0x219f('0x14')]=_0x219f('0x24');this[_0x219f('0xf')][_0x42ff99][_0x219f('0x13')][_0x219f('0x15')]=_0x755e05;return this[_0x219f('0x12')](_0x42ff99);}};EmailChannel[_0x219f('0x11')]['sendMail']=function(_0x3d45ec,_0x7c17af){return this[_0x219f('0x10')]['send'](_0x3d45ec,_0x7c17af);};EmailChannel[_0x219f('0x11')][_0x219f('0x31')]=function(_0x48f017){var _0x58e58f=this;if(this[_0x219f('0xf')][_0x48f017['id']]){if(_[_0x219f('0x17')](this[_0x219f('0xf')][_0x48f017['id']]['Smtp'])){this[_0x219f('0xf')][_0x48f017['id']][_0x219f('0x32')]={};}this[_0x219f('0xf')][_0x48f017['id']][_0x219f('0x32')][_0x219f('0x30')]=moment();return new BPromise(function(_0x74c229,_0x124ae1){return _0x58e58f[_0x219f('0x10')][_0x219f('0x33')](_0x48f017)['then'](function(_0x471296){_0x58e58f['mailAccounts'][_0x48f017['id']][_0x219f('0x32')][_0x219f('0x14')]='verified';_0x58e58f[_0x219f('0xf')][_0x48f017['id']][_0x219f('0x32')][_0x219f('0x15')]='';_0x58e58f[_0x219f('0x12')](_0x48f017['id']);_0x74c229(_0x471296);})[_0x219f('0x2e')](function(_0x5bdff0){_0x58e58f[_0x219f('0xf')][_0x48f017['id']][_0x219f('0x32')]['status']=_0x219f('0x24');_0x58e58f[_0x219f('0xf')][_0x48f017['id']][_0x219f('0x32')][_0x219f('0x15')]=_0x5bdff0;_0x58e58f[_0x219f('0x12')](_0x48f017['id']);_0x124ae1(_0x5bdff0);});});}return this[_0x219f('0x10')][_0x219f('0x33')](_0x48f017);};module[_0x219f('0x34')]=EmailChannel; \ No newline at end of file +var _0x0d6a=['defaults','socket.io-emitter','./imap','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','emit','name','key','active','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','prototype','refresh','hasOwnProperty','handleImapBox','bind','handleImapEmail','error','disabled','connected','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','handleImapError','sendMail','send','verifySmtp','Smtp','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis'];(function(_0x5efad0,_0x3978ef){var _0x53e5ea=function(_0x97a6a1){while(--_0x97a6a1){_0x5efad0['push'](_0x5efad0['shift']());}};_0x53e5ea(++_0x3978ef);}(_0x0d6a,0x12f));var _0xa0d6=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x0d6a[_0x468b0f];return _0x3e74d9;};'use strict';var _=require(_0xa0d6('0x0'));var moment=require(_0xa0d6('0x1'));var BPromise=require(_0xa0d6('0x2'));var md5=require(_0xa0d6('0x3'));var Redis=require(_0xa0d6('0x4'));var config=require(_0xa0d6('0x5'));var logger=require(_0xa0d6('0x6'))(_0xa0d6('0x7'));config[_0xa0d6('0x8')]=_[_0xa0d6('0x9')](config[_0xa0d6('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xa0d6('0xa'))(new Redis(config[_0xa0d6('0x8')]));var EmailImap=require(_0xa0d6('0xb'));var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x4676d5){logger[_0xa0d6('0xc')](_0xa0d6('0xd'));this[_0xa0d6('0xe')]=_0x4676d5['mailAccounts'];this[_0xa0d6('0xf')]={};this[_0xa0d6('0x10')]=new EmailSmtp();}EmailChannel['prototype'][_0xa0d6('0x11')]=function(_0x330de5){var _0x33e487=this['mailAccounts'][_0x330de5];var _0x1ce3d0={'id':_0x33e487['id'],'name':_0x33e487[_0xa0d6('0x12')],'key':_0x33e487[_0xa0d6('0x13')],'active':_0x33e487[_0xa0d6('0x14')],'Imap':{'status':_0x33e487[_0xa0d6('0x15')][_0xa0d6('0x16')],'messageStatus':_0x33e487[_0xa0d6('0x15')][_0xa0d6('0x17')],'total':_0x33e487[_0xa0d6('0x15')][_0xa0d6('0x18')]}};if(_[_0xa0d6('0x19')](md5Accounts[_0x330de5])){md5Accounts[_0x330de5]={};}var _0x2fd775=md5(JSON[_0xa0d6('0x1a')](_0x1ce3d0));if(md5Accounts[_0x330de5][_0xa0d6('0x3')]!==_0x2fd775){md5Accounts[_0x330de5][_0xa0d6('0x3')]=_0x2fd775;io[_0xa0d6('0x11')](_0xa0d6('0x1b'),_0x1ce3d0);}};EmailChannel[_0xa0d6('0x1c')][_0xa0d6('0x1d')]=function(_0xc4fc27){for(var _0x2d1247 in _0xc4fc27){if(_0xc4fc27[_0xa0d6('0x1e')](_0x2d1247)){if(_0xc4fc27[_0x2d1247]['Imap']&&_0xc4fc27[_0x2d1247][_0xa0d6('0x14')]){var _0x2d2e49=_0xc4fc27[_0x2d1247][_0xa0d6('0x15')];if(!this[_0xa0d6('0xf')][_0xa0d6('0x1e')](_0x2d2e49['id'])){this[_0xa0d6('0xf')][_0x2d2e49['id']]=new EmailImap(_0x2d2e49,_0xc4fc27[_0x2d1247][_0xa0d6('0x7')]);this[_0xa0d6('0xf')][_0x2d2e49['id']]['on']('box',this[_0xa0d6('0x1f')][_0xa0d6('0x20')](this,_0x2d1247));this[_0xa0d6('0xf')][_0x2d2e49['id']]['on'](_0xa0d6('0x7'),this[_0xa0d6('0x21')][_0xa0d6('0x20')](this,_0x2d1247));this['imapAccounts'][_0x2d2e49['id']]['on']('end',this['handleImapEnd'][_0xa0d6('0x20')](this,_0x2d1247));this[_0xa0d6('0xf')][_0x2d2e49['id']]['on'](_0xa0d6('0x22'),this['handleImapError'][_0xa0d6('0x20')](this,_0x2d1247));}}else{if(_[_0xa0d6('0x19')](this[_0xa0d6('0xe')][_0x2d1247][_0xa0d6('0x15')])){this[_0xa0d6('0xe')][_0x2d1247][_0xa0d6('0x15')]={};}this['mailAccounts'][_0x2d1247][_0xa0d6('0x15')][_0xa0d6('0x16')]=_0xa0d6('0x23');this['mailAccounts'][_0x2d1247][_0xa0d6('0x15')][_0xa0d6('0x17')]='';this[_0xa0d6('0x11')](_0x2d1247);}}}};EmailChannel[_0xa0d6('0x1c')][_0xa0d6('0x1f')]=function(_0xd442ab,_0x5ddaae){if(this[_0xa0d6('0xe')][_0xd442ab]){this[_0xa0d6('0xe')][_0xd442ab]['Imap'][_0xa0d6('0x16')]=_0xa0d6('0x24');this[_0xa0d6('0xe')][_0xd442ab][_0xa0d6('0x15')][_0xa0d6('0x17')]=_0x5ddaae[_0xa0d6('0x12')];if(_0x5ddaae['messages']){this[_0xa0d6('0xe')][_0xd442ab][_0xa0d6('0x15')]['total']=_0x5ddaae['messages'][_0xa0d6('0x18')];}return this['emit'](_0xd442ab);}};EmailChannel['prototype'][_0xa0d6('0x21')]=function(_0x4e1f0c,_0x321186){logger[_0xa0d6('0xc')](_0xa0d6('0x25'),_0x321186[_0xa0d6('0x26')],_0x321186[_0xa0d6('0x27')],_0x321186[_0xa0d6('0x28')],_0x4e1f0c);if(this[_0xa0d6('0xe')][_0x4e1f0c]){return mailAccount['notify'](_0x4e1f0c,_0x321186)['then'](function(_0x3c3751){if(_0x3c3751){logger['info'](_0xa0d6('0x29'));}})[_0xa0d6('0x2a')](function(_0x2cd21b){logger['error'](_0xa0d6('0x2b'),JSON[_0xa0d6('0x1a')](_0x2cd21b));});}};EmailChannel[_0xa0d6('0x1c')]['handleImapEnd']=function(_0x2de596){if(this[_0xa0d6('0xe')][_0x2de596]&&this[_0xa0d6('0xe')][_0x2de596][_0xa0d6('0x15')]){if(this[_0xa0d6('0xf')][this[_0xa0d6('0xe')][_0x2de596]['Imap']['id']]){delete this[_0xa0d6('0xf')][this[_0xa0d6('0xe')][_0x2de596]['Imap']['id']];}this[_0xa0d6('0xe')][_0x2de596][_0xa0d6('0x15')][_0xa0d6('0x2c')]=moment();this[_0xa0d6('0x11')](_0x2de596);}};EmailChannel[_0xa0d6('0x1c')][_0xa0d6('0x2d')]=function(_0x1b3e27,_0x45e413){if(this[_0xa0d6('0xe')][_0x1b3e27]){this['mailAccounts'][_0x1b3e27][_0xa0d6('0x15')][_0xa0d6('0x16')]='error';this['mailAccounts'][_0x1b3e27][_0xa0d6('0x15')][_0xa0d6('0x17')]=_0x45e413;return this['emit'](_0x1b3e27);}};EmailChannel[_0xa0d6('0x1c')][_0xa0d6('0x2e')]=function(_0x3a5595,_0x2d6791){return this[_0xa0d6('0x10')][_0xa0d6('0x2f')](_0x3a5595,_0x2d6791);};EmailChannel[_0xa0d6('0x1c')][_0xa0d6('0x30')]=function(_0x577db6){var _0x467532=this;if(this['mailAccounts'][_0x577db6['id']]){if(_['isNil'](this[_0xa0d6('0xe')][_0x577db6['id']][_0xa0d6('0x31')])){this[_0xa0d6('0xe')][_0x577db6['id']]['Smtp']={};}this[_0xa0d6('0xe')][_0x577db6['id']][_0xa0d6('0x31')][_0xa0d6('0x2c')]=moment();return new BPromise(function(_0xd74161,_0x167ec1){return _0x467532[_0xa0d6('0x10')]['verify'](_0x577db6)['then'](function(_0xdba8e2){_0x467532[_0xa0d6('0xe')][_0x577db6['id']][_0xa0d6('0x31')][_0xa0d6('0x16')]=_0xa0d6('0x32');_0x467532['mailAccounts'][_0x577db6['id']][_0xa0d6('0x31')]['messageStatus']='';_0x467532[_0xa0d6('0x11')](_0x577db6['id']);_0xd74161(_0xdba8e2);})[_0xa0d6('0x2a')](function(_0x41b0de){_0x467532['mailAccounts'][_0x577db6['id']][_0xa0d6('0x31')][_0xa0d6('0x16')]=_0xa0d6('0x22');_0x467532[_0xa0d6('0xe')][_0x577db6['id']][_0xa0d6('0x31')][_0xa0d6('0x17')]=_0x41b0de;_0x467532[_0xa0d6('0x11')](_0x577db6['id']);_0x167ec1(_0x41b0de);});});}return this['smtp']['verify'](_0x577db6);};module[_0xa0d6('0x33')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index afe2659..477fbe0 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 _0x2a1f=['upperFirst','exports','path','imap','randomstring','simpleParser','iconv','Iconv','events','EventEmitter','./utils','email','mailbox','INBOX','account','ready','handleReady','bind','end','handleEnd','error','handleError','connect','inherits','prototype','getAccount','connTimeout','authTimeout','isNil','authentication','user','password','host','port','tls','required','getHost','anonymous@xcally.com','handleOpenBox','emit','box','readUnseen','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchEnd','handleCloseBox','body','handleMessageBody','once','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','closeBox','handleFetchError','stringify','textCode','hasOwnProperty'];(function(_0x474c66,_0xbce925){var _0xcbd9bf=function(_0x44019d){while(--_0x44019d){_0x474c66['push'](_0x474c66['shift']());}};_0xcbd9bf(++_0xbce925);}(_0x2a1f,0x12e));var _0xf2a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2a1f[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require(_0xf2a1('0x0'));var util=require('util');var Imap=require(_0xf2a1('0x1'));var _=require('lodash');var rs=require(_0xf2a1('0x2'));var simpleParser=require('mailparser')[_0xf2a1('0x3')];var Iconv=require(_0xf2a1('0x4'))[_0xf2a1('0x5')];var EventEmitter=require(_0xf2a1('0x6'))[_0xf2a1('0x7')];var utils=require(_0xf2a1('0x8'));var logger=require('../../../config/logger')(_0xf2a1('0x9'));function EmailImap(_0x41b7a0,_0x1d6153){this[_0xf2a1('0xa')]=_0xf2a1('0xb');this[_0xf2a1('0xc')]=this['getAccount'](_0x41b7a0,_0x1d6153);this[_0xf2a1('0x1')]=new Imap(this[_0xf2a1('0xc')]);this[_0xf2a1('0x1')]['once'](_0xf2a1('0xd'),this[_0xf2a1('0xe')][_0xf2a1('0xf')](this));this['imap']['once'](_0xf2a1('0x10'),this[_0xf2a1('0x11')]['bind'](this));this[_0xf2a1('0x1')]['on'](_0xf2a1('0x12'),this[_0xf2a1('0x13')][_0xf2a1('0xf')](this));this['imap'][_0xf2a1('0x14')]();}util[_0xf2a1('0x15')](EmailImap,EventEmitter);EmailImap[_0xf2a1('0x16')][_0xf2a1('0x17')]=function(_0x2fa41c,_0x417254){var _0x63cb51={'connTimeout':_0x2fa41c[_0xf2a1('0x18')]?_0x2fa41c[_0xf2a1('0x18')]*0x3e8:0x2710,'authTimeout':_0x2fa41c[_0xf2a1('0x19')]?_0x2fa41c[_0xf2a1('0x19')]*0x3e8:0x1388};if(_[_0xf2a1('0x1a')](_0x2fa41c['service'])){if(_0x2fa41c[_0xf2a1('0x1b')]){_0x63cb51[_0xf2a1('0x1c')]=_0x2fa41c['user'];_0x63cb51['password']=_0x2fa41c[_0xf2a1('0x1d')];}_0x63cb51[_0xf2a1('0x1e')]=_0x2fa41c['host'];_0x63cb51[_0xf2a1('0x1f')]=_0x2fa41c[_0xf2a1('0x1f')]||0x3e1;if(_0x2fa41c[_0xf2a1('0x20')]){_0x63cb51[_0xf2a1('0x20')]=!![];}else{_0x63cb51[_0xf2a1('0x20')]=![];_0x63cb51['autotls']=_0xf2a1('0x21');}}else{_0x63cb51[_0xf2a1('0x1c')]=_0x2fa41c[_0xf2a1('0x1c')];_0x63cb51[_0xf2a1('0x1d')]=_0x2fa41c[_0xf2a1('0x1d')];_0x63cb51[_0xf2a1('0x1e')]=utils[_0xf2a1('0x22')](_0x2fa41c['service']);_0x63cb51[_0xf2a1('0x1f')]=0x3e1;_0x63cb51[_0xf2a1('0x20')]=!![];}_0x63cb51[_0xf2a1('0x9')]=_0x417254||_0x2fa41c[_0xf2a1('0x1c')]||_0xf2a1('0x23');return _0x63cb51;};EmailImap['prototype'][_0xf2a1('0xe')]=function(){this[_0xf2a1('0x1')]['openBox'](this[_0xf2a1('0xa')],![],this[_0xf2a1('0x24')][_0xf2a1('0xf')](this));};EmailImap[_0xf2a1('0x16')][_0xf2a1('0x24')]=function(_0x1da551,_0x1cb0c7){if(_0x1da551){this['handleError'](_0x1da551,!![]);}else{this[_0xf2a1('0x25')](_0xf2a1('0x26'),_0x1cb0c7);this[_0xf2a1('0x27')]();}};EmailImap[_0xf2a1('0x16')]['handleCloseBox']=function(_0x453e3f){if(_0x453e3f){this[_0xf2a1('0x13')](_0x453e3f,!![]);}else{this[_0xf2a1('0x1')][_0xf2a1('0x10')]();}};EmailImap['prototype']['readUnseen']=function(){this[_0xf2a1('0x1')]['search'](['UNSEEN'],this['handleReadUnseen'][_0xf2a1('0xf')](this));};EmailImap[_0xf2a1('0x16')][_0xf2a1('0x28')]=function(_0x4d9c3b,_0x49d7aa){if(_0x4d9c3b){this['handleError'](_0x4d9c3b,!![]);}else{if(_0x49d7aa[_0xf2a1('0x29')]){try{var _0x181bb8=this['imap'][_0xf2a1('0x2a')](_0x49d7aa,{'bodies':'','markSeen':!![]});_0x181bb8['on']('message',this[_0xf2a1('0x2b')]['bind'](this));_0x181bb8['once'](_0xf2a1('0x12'),this['handleFetchError'][_0xf2a1('0xf')](this));_0x181bb8['once'](_0xf2a1('0x10'),this[_0xf2a1('0x2c')][_0xf2a1('0xf')](this));}catch(_0xba7637){logger[_0xf2a1('0x12')](_0xba7637);}}else{this[_0xf2a1('0x1')]['closeBox'](!![],this[_0xf2a1('0x2d')][_0xf2a1('0xf')](this));}}};EmailImap[_0xf2a1('0x16')][_0xf2a1('0x2b')]=function(_0x1f6d46,_0x5b3b8f){_0x1f6d46['on'](_0xf2a1('0x2e'),this[_0xf2a1('0x2f')][_0xf2a1('0xf')](this));_0x1f6d46[_0xf2a1('0x30')](_0xf2a1('0x31'),this[_0xf2a1('0x32')][_0xf2a1('0xf')](this));_0x1f6d46['once'](_0xf2a1('0x10'),this[_0xf2a1('0x33')][_0xf2a1('0xf')](this));};EmailImap[_0xf2a1('0x16')][_0xf2a1('0x2f')]=function(_0x2375f4,_0x4b15ce){simpleParser(_0x2375f4,{'Iconv':Iconv},this['handleSimpleParser']['bind'](this));};EmailImap['prototype']['handleMessageAttributes']=function(_0x191fa6){};EmailImap[_0xf2a1('0x16')][_0xf2a1('0x33')]=function(){};EmailImap[_0xf2a1('0x16')][_0xf2a1('0x34')]=function(_0x21bec3,_0x3e5357){if(_0x21bec3){logger[_0xf2a1('0x12')](_0x21bec3);}else{var _0x43b419=this;utils['parser'](this[_0xf2a1('0xc')],_0x3e5357,function(_0x4f9552){_0x43b419[_0xf2a1('0x25')](_0xf2a1('0x9'),_0x4f9552);});}};EmailImap[_0xf2a1('0x16')][_0xf2a1('0x2c')]=function(){this['imap'][_0xf2a1('0x35')](!![],this[_0xf2a1('0x2d')][_0xf2a1('0xf')](this));};EmailImap['prototype'][_0xf2a1('0x36')]=function(_0x396695){this[_0xf2a1('0x13')](_0x396695);this[_0xf2a1('0x1')]['closeBox'](!![],this[_0xf2a1('0x2d')]['bind'](this));};EmailImap[_0xf2a1('0x16')]['handleEnd']=function(){this['emit'](_0xf2a1('0x10'));};EmailImap[_0xf2a1('0x16')][_0xf2a1('0x13')]=function(_0x31a181,_0x200adc){logger[_0xf2a1('0x12')](_0xf2a1('0x13'),this[_0xf2a1('0xc')][_0xf2a1('0x9')],JSON[_0xf2a1('0x37')](_0x31a181));var _0x47a3f9='';if(_0x31a181){if(_0x31a181[_0xf2a1('0x38')]){_0x47a3f9=_0x31a181[_0xf2a1('0x38')];}else{for(var _0xf8f13 in _0x31a181){if(_0x31a181[_0xf2a1('0x39')](_0xf8f13)){_0x47a3f9+=_[_0xf2a1('0x3a')](_0xf8f13)+':\x20'+_0x31a181[_0xf8f13]+'\x0a';}}}}if(_0x200adc){this[_0xf2a1('0x1')][_0xf2a1('0x10')]();}else{this[_0xf2a1('0x25')](_0xf2a1('0x12'),_0x47a3f9);this[_0xf2a1('0x25')](_0xf2a1('0x10'));}};module[_0xf2a1('0x3b')]=EmailImap; \ No newline at end of file +var _0xc125=['util','lodash','randomstring','simpleParser','iconv','Iconv','EventEmitter','../../../config/logger','mailbox','account','imap','handleReady','once','end','handleError','bind','connect','prototype','getAccount','connTimeout','authTimeout','service','authentication','user','password','host','port','tls','required','getHost','email','openBox','handleOpenBox','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','fetch','message','error','handleFetchError','handleFetchEnd','closeBox','handleFetchMessage','body','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','emit','handleEnd','stringify','textCode','hasOwnProperty','upperFirst','path'];(function(_0x3d3a59,_0xe0de59){var _0x2423a5=function(_0x154e5e){while(--_0x154e5e){_0x3d3a59['push'](_0x3d3a59['shift']());}};_0x2423a5(++_0xe0de59);}(_0xc125,0x19c));var _0x5c12=function(_0x5d2317,_0x17fe95){_0x5d2317=_0x5d2317-0x0;var _0x347d5c=_0xc125[_0x5d2317];return _0x347d5c;};'use strict';var fs=require('fs');var path=require(_0x5c12('0x0'));var util=require(_0x5c12('0x1'));var Imap=require('imap');var _=require(_0x5c12('0x2'));var rs=require(_0x5c12('0x3'));var simpleParser=require('mailparser')[_0x5c12('0x4')];var Iconv=require(_0x5c12('0x5'))[_0x5c12('0x6')];var EventEmitter=require('events')[_0x5c12('0x7')];var utils=require('./utils');var logger=require(_0x5c12('0x8'))('email');function EmailImap(_0x22bff5,_0x28d444){this[_0x5c12('0x9')]='INBOX';this[_0x5c12('0xa')]=this['getAccount'](_0x22bff5,_0x28d444);this[_0x5c12('0xb')]=new Imap(this[_0x5c12('0xa')]);this['imap']['once']('ready',this[_0x5c12('0xc')]['bind'](this));this[_0x5c12('0xb')][_0x5c12('0xd')](_0x5c12('0xe'),this['handleEnd']['bind'](this));this[_0x5c12('0xb')]['on']('error',this[_0x5c12('0xf')][_0x5c12('0x10')](this));this['imap'][_0x5c12('0x11')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x5c12('0x12')][_0x5c12('0x13')]=function(_0x8b1de1,_0x15c2cf){var _0x171115={'connTimeout':_0x8b1de1[_0x5c12('0x14')]?_0x8b1de1[_0x5c12('0x14')]*0x3e8:0x2710,'authTimeout':_0x8b1de1[_0x5c12('0x15')]?_0x8b1de1[_0x5c12('0x15')]*0x3e8:0x1388};if(_['isNil'](_0x8b1de1[_0x5c12('0x16')])){if(_0x8b1de1[_0x5c12('0x17')]){_0x171115['user']=_0x8b1de1[_0x5c12('0x18')];_0x171115[_0x5c12('0x19')]=_0x8b1de1[_0x5c12('0x19')];}_0x171115[_0x5c12('0x1a')]=_0x8b1de1[_0x5c12('0x1a')];_0x171115[_0x5c12('0x1b')]=_0x8b1de1[_0x5c12('0x1b')]||0x3e1;if(_0x8b1de1[_0x5c12('0x1c')]){_0x171115['tls']=!![];}else{_0x171115[_0x5c12('0x1c')]=![];_0x171115['autotls']=_0x5c12('0x1d');}}else{_0x171115[_0x5c12('0x18')]=_0x8b1de1[_0x5c12('0x18')];_0x171115[_0x5c12('0x19')]=_0x8b1de1['password'];_0x171115['host']=utils[_0x5c12('0x1e')](_0x8b1de1['service']);_0x171115[_0x5c12('0x1b')]=0x3e1;_0x171115[_0x5c12('0x1c')]=!![];}_0x171115[_0x5c12('0x1f')]=_0x15c2cf||_0x8b1de1[_0x5c12('0x18')]||'anonymous@xcally.com';return _0x171115;};EmailImap['prototype'][_0x5c12('0xc')]=function(){this[_0x5c12('0xb')][_0x5c12('0x20')](this[_0x5c12('0x9')],![],this[_0x5c12('0x21')]['bind'](this));};EmailImap[_0x5c12('0x12')][_0x5c12('0x21')]=function(_0xda910a,_0x5d12f7){if(_0xda910a){this[_0x5c12('0xf')](_0xda910a,!![]);}else{this['emit'](_0x5c12('0x22'),_0x5d12f7);this[_0x5c12('0x23')]();}};EmailImap[_0x5c12('0x12')][_0x5c12('0x24')]=function(_0x19e384){if(_0x19e384){this['handleError'](_0x19e384,!![]);}else{this[_0x5c12('0xb')][_0x5c12('0xe')]();}};EmailImap[_0x5c12('0x12')]['readUnseen']=function(){this[_0x5c12('0xb')][_0x5c12('0x25')]([_0x5c12('0x26')],this[_0x5c12('0x27')][_0x5c12('0x10')](this));};EmailImap[_0x5c12('0x12')][_0x5c12('0x27')]=function(_0x4efd93,_0x57981b){if(_0x4efd93){this['handleError'](_0x4efd93,!![]);}else{if(_0x57981b['length']){try{var _0x110dbd=this[_0x5c12('0xb')][_0x5c12('0x28')](_0x57981b,{'bodies':'','markSeen':!![]});_0x110dbd['on'](_0x5c12('0x29'),this['handleFetchMessage']['bind'](this));_0x110dbd['once'](_0x5c12('0x2a'),this[_0x5c12('0x2b')]['bind'](this));_0x110dbd['once'](_0x5c12('0xe'),this[_0x5c12('0x2c')][_0x5c12('0x10')](this));}catch(_0x1d77a3){logger[_0x5c12('0x2a')](_0x1d77a3);}}else{this[_0x5c12('0xb')][_0x5c12('0x2d')](!![],this[_0x5c12('0x24')][_0x5c12('0x10')](this));}}};EmailImap[_0x5c12('0x12')][_0x5c12('0x2e')]=function(_0x43f2af,_0x58f34f){_0x43f2af['on'](_0x5c12('0x2f'),this['handleMessageBody'][_0x5c12('0x10')](this));_0x43f2af[_0x5c12('0xd')](_0x5c12('0x30'),this[_0x5c12('0x31')][_0x5c12('0x10')](this));_0x43f2af[_0x5c12('0xd')](_0x5c12('0xe'),this[_0x5c12('0x32')][_0x5c12('0x10')](this));};EmailImap['prototype'][_0x5c12('0x33')]=function(_0x27836a,_0x60cd73){simpleParser(_0x27836a,{'Iconv':Iconv},this[_0x5c12('0x34')][_0x5c12('0x10')](this));};EmailImap[_0x5c12('0x12')][_0x5c12('0x31')]=function(_0x120ba6){};EmailImap['prototype'][_0x5c12('0x32')]=function(){};EmailImap[_0x5c12('0x12')][_0x5c12('0x34')]=function(_0x173676,_0x229f90){if(_0x173676){logger['error'](_0x173676);}else{var _0x3d6f51=this;utils['parser'](this[_0x5c12('0xa')],_0x229f90,function(_0x526f9a){_0x3d6f51[_0x5c12('0x35')]('email',_0x526f9a);});}};EmailImap[_0x5c12('0x12')][_0x5c12('0x2c')]=function(){this['imap'][_0x5c12('0x2d')](!![],this[_0x5c12('0x24')][_0x5c12('0x10')](this));};EmailImap[_0x5c12('0x12')][_0x5c12('0x2b')]=function(_0x4a0597){this[_0x5c12('0xf')](_0x4a0597);this[_0x5c12('0xb')][_0x5c12('0x2d')](!![],this[_0x5c12('0x24')][_0x5c12('0x10')](this));};EmailImap[_0x5c12('0x12')][_0x5c12('0x36')]=function(){this[_0x5c12('0x35')](_0x5c12('0xe'));};EmailImap['prototype'][_0x5c12('0xf')]=function(_0x4ad76f,_0x295e7c){logger[_0x5c12('0x2a')](_0x5c12('0xf'),this['account'][_0x5c12('0x1f')],JSON[_0x5c12('0x37')](_0x4ad76f));var _0x495abf='';if(_0x4ad76f){if(_0x4ad76f[_0x5c12('0x38')]){_0x495abf=_0x4ad76f['textCode'];}else{for(var _0x4902f5 in _0x4ad76f){if(_0x4ad76f[_0x5c12('0x39')](_0x4902f5)){_0x495abf+=_[_0x5c12('0x3a')](_0x4902f5)+':\x20'+_0x4ad76f[_0x4902f5]+'\x0a';}}}}if(_0x295e7c){this[_0x5c12('0xb')][_0x5c12('0xe')]();}else{this[_0x5c12('0x35')]('error',_0x495abf);this[_0x5c12('0x35')](_0x5c12('0xe'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 9ac1155..1524428 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 _0x709a=['exports','nodemailer','prototype','send','createTransport','use','compile','toString','verify','Not\x20verifired'];(function(_0x1c0f8d,_0x1adacb){var _0x108dd2=function(_0x14964f){while(--_0x14964f){_0x1c0f8d['push'](_0x1c0f8d['shift']());}};_0x108dd2(++_0x1adacb);}(_0x709a,0x83));var _0xa709=function(_0x4eb447,_0x1b67b5){_0x4eb447=_0x4eb447-0x0;var _0x50542e=_0x709a[_0x4eb447];return _0x50542e;};'use strict';var nodemailer=require(_0xa709('0x0'));var BPromise=require('bluebird');var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0xa709('0x1')][_0xa709('0x2')]=function(_0x437fe3,_0x310c50){return new BPromise(function(_0x2cd540,_0x1672f9){var _0xa81917=nodemailer[_0xa709('0x3')](_0x437fe3);_0xa81917[_0xa709('0x4')](_0xa709('0x5'),inlineBase64());_0xa81917['sendMail'](_0x310c50,function(_0x5cd5c9,_0x3f7526){if(_0x5cd5c9){_0x1672f9(_0x5cd5c9[_0xa709('0x6')]());}else{_0x2cd540(_0x3f7526);}});});};EmailSmtp[_0xa709('0x1')][_0xa709('0x7')]=function(_0x612f32){return new BPromise(function(_0x5c595e,_0xce705e){var _0xcdc09f=nodemailer['createTransport'](_0x612f32);_0xcdc09f[_0xa709('0x7')](function(_0x1183bc,_0x133cf1){if(_0x1183bc){_0xce705e(_0x1183bc[_0xa709('0x6')]());}else{if(_0x133cf1){_0x5c595e(_0x133cf1);}else{_0xce705e(_0xa709('0x8'));}}});});};module[_0xa709('0x9')]=EmailSmtp; \ No newline at end of file +var _0x1818=['toString','verify','exports','bluebird','nodemailer-plugin-inline-base64','prototype','createTransport','sendMail'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x1818,0x19b));var _0x8181=function(_0x489b87,_0xd51c93){_0x489b87=_0x489b87-0x0;var _0x1823b6=_0x1818[_0x489b87];return _0x1823b6;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0x8181('0x0'));var inlineBase64=require(_0x8181('0x1'));function EmailSmtp(){}EmailSmtp[_0x8181('0x2')]['send']=function(_0xaefe03,_0x1c6082){return new BPromise(function(_0x1eae74,_0x412651){var _0x436c50=nodemailer[_0x8181('0x3')](_0xaefe03);_0x436c50['use']('compile',inlineBase64());_0x436c50[_0x8181('0x4')](_0x1c6082,function(_0x381fa4,_0x579bd9){if(_0x381fa4){_0x412651(_0x381fa4[_0x8181('0x5')]());}else{_0x1eae74(_0x579bd9);}});});};EmailSmtp['prototype'][_0x8181('0x6')]=function(_0x32c0f6){return new BPromise(function(_0x4659fe,_0x24ae7e){var _0x3dba9d=nodemailer['createTransport'](_0x32c0f6);_0x3dba9d[_0x8181('0x6')](function(_0x2e56d3,_0x476482){if(_0x2e56d3){_0x24ae7e(_0x2e56d3['toString']());}else{if(_0x476482){_0x4659fe(_0x476482);}else{_0x24ae7e('Not\x20verifired');}}});});};module[_0x8181('0x7')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index f3e881d..e9e2e26 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 _0xc029=['hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','slice','join','Anonymous','pop','length','isEmpty','html','replace','includes','\x20[Attachment:\x20','body','textAsHtml','Empty\x20message

','Attachments','Title','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xc029,0x1df));var _0x9c02=function(_0x3d9557,_0x5d09d2){_0x3d9557=_0x3d9557-0x0;var _0x359ff8=_0xc029[_0x3d9557];return _0x359ff8;};'use strict';var _=require(_0x9c02('0x0'));var moment=require(_0x9c02('0x1'));var random=require(_0x9c02('0x2'));var fs=require('fs');var path=require(_0x9c02('0x3'));var util=require(_0x9c02('0x4'));var tnef=require(_0x9c02('0x5'));var logger=require(_0x9c02('0x6'))(_0x9c02('0x7'));var config=require(_0x9c02('0x8'));function getAddress(_0x2a96cd){var _0x283c37=_[_0x9c02('0x9')](_0x2a96cd[_0x9c02('0xa')]);return _0x283c37&&_0x283c37[_0x9c02('0xb')]?_0x283c37[_0x9c02('0xb')]:_0x9c02('0xc')+random[_0x9c02('0xd')](0x6)+_0x9c02('0xe');}function getFirstName(_0x4a8202){var _0x30fc9c=_['head'](_0x4a8202[_0x9c02('0xa')]);if(_0x30fc9c&&_0x30fc9c[_0x9c02('0xf')]){if(_0x30fc9c[_0x9c02('0xf')]==_0x30fc9c[_0x9c02('0xb')]){return _0x30fc9c['name'][_0x9c02('0x10')](0x0,_0x30fc9c['name'][_0x9c02('0x11')]('@'));}var _0x54221d=_0x30fc9c[_0x9c02('0xf')][_0x9c02('0x12')](/\s+/);return _0x54221d['length']>0x1?_0x54221d[_0x9c02('0x13')](0x0,-0x1)[_0x9c02('0x14')]('\x20'):_0x30fc9c['name'];}return _0x9c02('0x15');}function getLastName(_0x2d7d32){var _0x30677e=_['head'](_0x2d7d32['value']);if(_0x30677e&&_0x30677e[_0x9c02('0xf')]){var _0x26735e=_0x30677e[_0x9c02('0xf')][_0x9c02('0x12')](/\s+/);return _0x26735e['length']>0x1?_0x26735e[_0x9c02('0x16')]():'';}return'';}function getMails(_0x38602c,_0xa6f21e){var _0x729f45='';for(var _0x134cab=0x0;_0x134cab<_0xa6f21e['value'][_0x9c02('0x17')];_0x134cab+=0x1){if(_0xa6f21e[_0x9c02('0xa')][_0x134cab][_0x9c02('0xb')]!==_0x38602c){if(!_[_0x9c02('0x18')](_0x729f45)){_0x729f45+=',';}_0x729f45+=_0xa6f21e[_0x9c02('0xa')][_0x134cab][_0x9c02('0xf')]||_0xa6f21e['value'][_0x134cab][_0x9c02('0xb')]||'';_0x729f45+='\x20<';_0x729f45+=_0xa6f21e[_0x9c02('0xa')][_0x134cab][_0x9c02('0xb')]?_0xa6f21e[_0x9c02('0xa')][_0x134cab][_0x9c02('0xb')]:_0x9c02('0xc')+random[_0x9c02('0xd')](0x6)+_0x9c02('0xe');_0x729f45+='>';}}return _0x729f45;}function parseEmail(_0x314275,_0x5a2097,_0x54fdf4){if(_0x5a2097['html']){var _0x2c5a9c=/)<[^<]*)*<\/script>/gi;while(_0x2c5a9c['test'](_0x5a2097[_0x9c02('0x19')])){_0x5a2097[_0x9c02('0x19')]=_0x5a2097[_0x9c02('0x19')][_0x9c02('0x1a')](_0x2c5a9c,'');}if(_0x5a2097[_0x9c02('0x19')][_0x9c02('0x1b')](_0x9c02('0x1c'))){var _0x42f5db=[];_0x5a2097['attachments'][_0x9c02('0x1d')](_0x3e3da7=>{_0x42f5db[_0x9c02('0x1e')](_0x3e3da7['filename']);});var _0x5509a3=/]+>/g;var _0x50938e=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x5a9976=_0x5a2097[_0x9c02('0x19')][_0x9c02('0x1a')](_0x50938e,_0x9c02('0x1f'));var _0x1b6a72=_0x5a9976[_0x9c02('0x1a')](_0x5509a3,_0x9c02('0x20'));for(let _0x169416=0x0;_0x169416<_0x42f5db[_0x9c02('0x17')];_0x169416++){var _0xf549df=_0x1b6a72[_0x9c02('0x1a')]('_IMG',_0x9c02('0x21')+_0x42f5db[_0x169416]+'\x20]');_0x1b6a72=_0xf549df;}_0x5a2097['html']=_0x1b6a72;}_0x54fdf4[_0x9c02('0x22')]=_0x5a2097['html'];}else{_0x54fdf4[_0x9c02('0x22')]=_0x5a2097[_0x9c02('0x23')];}if(_0x54fdf4[_0x9c02('0x22')]){_0x54fdf4[_0x9c02('0x22')]=_0x54fdf4[_0x9c02('0x22')]['replace'](/0x0){var _0x350e81=[_0x9c02('0x36'),_0x9c02('0x37'),_0x9c02('0x38')];for(var _0x24212e=0x0;_0x24212e<_0x5a2097[_0x9c02('0x35')][_0x9c02('0x17')];_0x24212e++){var _0x2bde7d=_[_0x9c02('0x11')](_0x350e81,_0x5a2097[_0x9c02('0x35')][_0x24212e][_0x9c02('0x39')]);if(_0x2bde7d>=0x0){_0x54fdf4[_0x9c02('0x3a')]=!![];}}}return _0x54fdf4;}exports['parser']=function(_0x4f0d85,_0x10356b,_0xf4cb00){var _0x4d48b3={'from':getAddress(_0x10356b['from']),'firstName':getFirstName(_0x10356b[_0x9c02('0x3b')]),'lastName':getLastName(_0x10356b[_0x9c02('0x3b')]),'mapKey':'email','message':{'from':getMails(_0x4f0d85['email'],_0x10356b[_0x9c02('0x3b')]),'to':_0x4f0d85[_0x9c02('0x7')],'cc':'','subject':_0x10356b['subject']||'','messageId':_0x10356b['messageId'],'inReplyTo':_0x10356b['inReplyTo'],'sentAt':moment(_0x10356b[_0x9c02('0x3c')])[_0x9c02('0x2e')](_0x9c02('0x3d')),'attach':![],'attachments':[]}};if(!_0x10356b['html']&&!_0x10356b[_0x9c02('0x23')]){var _0x29485e=_['filter'](_0x10356b[_0x9c02('0x29')],{'contentType':'application/ms-tnef'});if(_0x29485e[_0x9c02('0x17')]){logger[_0x9c02('0x3e')](util[_0x9c02('0x2e')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x10356b[_0x9c02('0x3f')]));tnef['parseBuffer'](_[_0x9c02('0x40')](_0x29485e)['content'],function(_0x520289,_0x47221f){if(_0x47221f){_0x10356b[_0x9c02('0x19')]=_0x47221f[_0x9c02('0x41')]||_0x9c02('0x42');if(_0x47221f[_0x9c02('0x43')]){for(var _0x4185d7=0x0;_0x4185d7<_0x47221f['Attachments']['length'];_0x4185d7++){var _0x1a99f8=_0x47221f[_0x9c02('0x43')][_0x4185d7];_0x4d48b3['message'][_0x9c02('0x29')]['push']({'filename':_0x1a99f8[_0x9c02('0x44')],'content':Buffer[_0x9c02('0x3b')](_0x1a99f8['Data'])});}}}_0xf4cb00(parseEmail(_0x4f0d85,_0x10356b,_0x4d48b3));});}else{_0x10356b[_0x9c02('0x19')]='

Empty\x20message

';_0xf4cb00(parseEmail(_0x4f0d85,_0x10356b,_0x4d48b3));}}else{_0xf4cb00(parseEmail(_0x4f0d85,_0x10356b,_0x4d48b3));}};exports[_0x9c02('0x45')]=function(_0x5cc626){switch(_0x5cc626){case _0x9c02('0x46'):return _0x9c02('0x47');case _0x9c02('0x48'):return _0x9c02('0x49');case _0x9c02('0x4a'):return _0x9c02('0x4b');case _0x9c02('0x4c'):return _0x9c02('0x4d');}return _0x9c02('0x4e');}; \ No newline at end of file +var _0xad40=['imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','node-tnef','../../../config/logger','email','../../../config/environment','head','address','anonymous','generate','@xcally.com','value','name','substring','split','length','slice','join','Anonymous','pop','html','test','replace','includes','','body','Empty\x20message

','Attachments','Title','Data'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xad40,0xfa));var _0x0ad4=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xad40[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x0ad4('0x0'));var moment=require(_0x0ad4('0x1'));var random=require(_0x0ad4('0x2'));var fs=require('fs');var path=require(_0x0ad4('0x3'));var util=require('util');var tnef=require(_0x0ad4('0x4'));var logger=require(_0x0ad4('0x5'))(_0x0ad4('0x6'));var config=require(_0x0ad4('0x7'));function getAddress(_0x85c3b9){var _0x34f7cb=_[_0x0ad4('0x8')](_0x85c3b9['value']);return _0x34f7cb&&_0x34f7cb[_0x0ad4('0x9')]?_0x34f7cb[_0x0ad4('0x9')]:_0x0ad4('0xa')+random[_0x0ad4('0xb')](0x6)+_0x0ad4('0xc');}function getFirstName(_0x29f1ee){var _0x239e92=_['head'](_0x29f1ee[_0x0ad4('0xd')]);if(_0x239e92&&_0x239e92[_0x0ad4('0xe')]){if(_0x239e92[_0x0ad4('0xe')]==_0x239e92[_0x0ad4('0x9')]){return _0x239e92[_0x0ad4('0xe')][_0x0ad4('0xf')](0x0,_0x239e92[_0x0ad4('0xe')]['indexOf']('@'));}var _0x1b9921=_0x239e92[_0x0ad4('0xe')][_0x0ad4('0x10')](/\s+/);return _0x1b9921[_0x0ad4('0x11')]>0x1?_0x1b9921[_0x0ad4('0x12')](0x0,-0x1)[_0x0ad4('0x13')]('\x20'):_0x239e92[_0x0ad4('0xe')];}return _0x0ad4('0x14');}function getLastName(_0xd8cad3){var _0x3808c2=_['head'](_0xd8cad3[_0x0ad4('0xd')]);if(_0x3808c2&&_0x3808c2['name']){var _0x2286e6=_0x3808c2['name'][_0x0ad4('0x10')](/\s+/);return _0x2286e6['length']>0x1?_0x2286e6[_0x0ad4('0x15')]():'';}return'';}function getMails(_0x58397f,_0x26190d){var _0x5a611f='';for(var _0x244474=0x0;_0x244474<_0x26190d[_0x0ad4('0xd')]['length'];_0x244474+=0x1){if(_0x26190d[_0x0ad4('0xd')][_0x244474][_0x0ad4('0x9')]!==_0x58397f){if(!_['isEmpty'](_0x5a611f)){_0x5a611f+=',';}_0x5a611f+=_0x26190d[_0x0ad4('0xd')][_0x244474][_0x0ad4('0xe')]||_0x26190d[_0x0ad4('0xd')][_0x244474][_0x0ad4('0x9')]||'';_0x5a611f+='\x20<';_0x5a611f+=_0x26190d[_0x0ad4('0xd')][_0x244474]['address']?_0x26190d['value'][_0x244474][_0x0ad4('0x9')]:'anonymous'+random['generate'](0x6)+_0x0ad4('0xc');_0x5a611f+='>';}}return _0x5a611f;}function parseEmail(_0x5e3c56,_0x411acc,_0x1bb68b){if(_0x411acc[_0x0ad4('0x16')]){var _0x147361=/)<[^<]*)*<\/script>/gi;while(_0x147361[_0x0ad4('0x17')](_0x411acc[_0x0ad4('0x16')])){_0x411acc[_0x0ad4('0x16')]=_0x411acc[_0x0ad4('0x16')][_0x0ad4('0x18')](_0x147361,'');}if(_0x411acc[_0x0ad4('0x16')][_0x0ad4('0x19')](_0x0ad4('0x1a'))){var _0x428bb9=[];_0x411acc[_0x0ad4('0x1b')]['forEach'](_0x1f7515=>{_0x428bb9['push'](_0x1f7515['filename']);});var _0xa3a218=/]+>/g;var _0x595431=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x567c73=_0x411acc[_0x0ad4('0x16')][_0x0ad4('0x18')](_0x595431,_0x0ad4('0x1c'));var _0x193a8a=_0x567c73['replace'](_0xa3a218,_0x0ad4('0x1d'));for(let _0x34847b=0x0;_0x34847b<_0x428bb9[_0x0ad4('0x11')];_0x34847b++){var _0xcbf86e=_0x193a8a[_0x0ad4('0x18')](_0x0ad4('0x1d'),'\x20[Attachment:\x20'+_0x428bb9[_0x34847b]+_0x0ad4('0x1e'));_0x193a8a=_0xcbf86e;}_0x411acc[_0x0ad4('0x16')]=_0x193a8a;}_0x1bb68b['body']=_0x411acc['html'];}else{_0x1bb68b[_0x0ad4('0x1f')]=_0x411acc['textAsHtml'];}if(_0x1bb68b['body']){_0x1bb68b[_0x0ad4('0x1f')]=_0x1bb68b['body'][_0x0ad4('0x18')](/0x0){var _0x35df9b=[_0x0ad4('0x33'),_0x0ad4('0x34'),_0x0ad4('0x35')];for(var _0x18bf38=0x0;_0x18bf38<_0x411acc[_0x0ad4('0x32')][_0x0ad4('0x11')];_0x18bf38++){var _0x441a7b=_[_0x0ad4('0x36')](_0x35df9b,_0x411acc[_0x0ad4('0x32')][_0x18bf38][_0x0ad4('0x37')]);if(_0x441a7b>=0x0){_0x1bb68b['isAutoreply']=!![];}}}return _0x1bb68b;}exports['parser']=function(_0x3e755f,_0xc69b7f,_0x2224de){var _0x4b8634={'from':getAddress(_0xc69b7f[_0x0ad4('0x38')]),'firstName':getFirstName(_0xc69b7f[_0x0ad4('0x38')]),'lastName':getLastName(_0xc69b7f['from']),'mapKey':_0x0ad4('0x6'),'message':{'from':getMails(_0x3e755f[_0x0ad4('0x6')],_0xc69b7f['from']),'to':_0x3e755f[_0x0ad4('0x6')],'cc':'','subject':_0xc69b7f[_0x0ad4('0x39')]||'','messageId':_0xc69b7f[_0x0ad4('0x3a')],'inReplyTo':_0xc69b7f[_0x0ad4('0x3b')],'sentAt':moment(_0xc69b7f[_0x0ad4('0x3c')])['format'](_0x0ad4('0x3d')),'attach':![],'attachments':[]}};if(!_0xc69b7f[_0x0ad4('0x16')]&&!_0xc69b7f[_0x0ad4('0x3e')]){var _0x1699fb=_[_0x0ad4('0x3f')](_0xc69b7f[_0x0ad4('0x1b')],{'contentType':_0x0ad4('0x40')});if(_0x1699fb[_0x0ad4('0x11')]){logger[_0x0ad4('0x41')](util['format'](_0x0ad4('0x42'),_0xc69b7f[_0x0ad4('0x3a')]));tnef[_0x0ad4('0x43')](_[_0x0ad4('0x44')](_0x1699fb)[_0x0ad4('0x2f')],function(_0x2c0bec,_0x5f1eb9){if(_0x5f1eb9){_0xc69b7f[_0x0ad4('0x16')]=_0x5f1eb9[_0x0ad4('0x45')]||_0x0ad4('0x46');if(_0x5f1eb9[_0x0ad4('0x47')]){for(var _0x2cc8f8=0x0;_0x2cc8f8<_0x5f1eb9[_0x0ad4('0x47')][_0x0ad4('0x11')];_0x2cc8f8++){var _0x1af2d9=_0x5f1eb9[_0x0ad4('0x47')][_0x2cc8f8];_0x4b8634[_0x0ad4('0x21')][_0x0ad4('0x1b')]['push']({'filename':_0x1af2d9[_0x0ad4('0x48')],'content':Buffer[_0x0ad4('0x38')](_0x1af2d9[_0x0ad4('0x49')])});}}}_0x2224de(parseEmail(_0x3e755f,_0xc69b7f,_0x4b8634));});}else{_0xc69b7f[_0x0ad4('0x16')]='

Empty\x20message

';_0x2224de(parseEmail(_0x3e755f,_0xc69b7f,_0x4b8634));}}else{_0x2224de(parseEmail(_0x3e755f,_0xc69b7f,_0x4b8634));}};exports['getHost']=function(_0x245b56){switch(_0x245b56){case'gmail':return _0x0ad4('0x4a');case _0x0ad4('0x4b'):return _0x0ad4('0x4c');case'hotmail':return _0x0ad4('0x4d');case _0x0ad4('0x4e'):return _0x0ad4('0x4f');}return _0x0ad4('0x50');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index d9acb3d..04349c9 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 _0x2629=['Smtp','exports','lodash','Service','key','active','Imap'];(function(_0x366ae5,_0x2aebf3){var _0x546e69=function(_0x407684){while(--_0x407684){_0x366ae5['push'](_0x366ae5['shift']());}};_0x546e69(++_0x2aebf3);}(_0x2629,0xc6));var _0x9262=function(_0x2af47e,_0x1d2a86){_0x2af47e=_0x2af47e-0x0;var _0x5bca26=_0x2629[_0x2af47e];return _0x5bca26;};'use strict';var _=require(_0x9262('0x0'));function MailAccount(_0x2a95f5){this['id']=_0x2a95f5['id']||0x0;this['name']=_0x2a95f5['name']||_0x9262('0x1');this[_0x9262('0x2')]=_0x2a95f5['key']||'SERV';this[_0x9262('0x3')]=_0x2a95f5[_0x9262('0x3')]||![];this['Imap']=_0x2a95f5[_0x9262('0x4')]||[];this[_0x9262('0x5')]=_0x2a95f5[_0x9262('0x5')]||[];}module[_0x9262('0x6')]=MailAccount; \ No newline at end of file +var _0x7c94=['active','Imap','Smtp','exports','lodash','name','key'];(function(_0x6ad480,_0x3452aa){var _0x203b57=function(_0x2ab95d){while(--_0x2ab95d){_0x6ad480['push'](_0x6ad480['shift']());}};_0x203b57(++_0x3452aa);}(_0x7c94,0x18c));var _0x47c9=function(_0x2449ef,_0x3edf6f){_0x2449ef=_0x2449ef-0x0;var _0x135709=_0x7c94[_0x2449ef];return _0x135709;};'use strict';var _=require(_0x47c9('0x0'));function MailAccount(_0x4060f3){this['id']=_0x4060f3['id']||0x0;this[_0x47c9('0x1')]=_0x4060f3[_0x47c9('0x1')]||'Service';this[_0x47c9('0x2')]=_0x4060f3[_0x47c9('0x2')]||'SERV';this[_0x47c9('0x3')]=_0x4060f3[_0x47c9('0x3')]||![];this[_0x47c9('0x4')]=_0x4060f3[_0x47c9('0x4')]||[];this[_0x47c9('0x5')]=_0x4060f3[_0x47c9('0x5')]||[];}module[_0x47c9('0x6')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 3259df5..b5aa784 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 _0x7b36=['exports','lodash','../model/mailAccount','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','mailAccounts','length','isUndefined','merge'];(function(_0x330a51,_0x42c33b){var _0x55aa63=function(_0x5ddc09){while(--_0x5ddc09){_0x330a51['push'](_0x330a51['shift']());}};_0x55aa63(++_0x42c33b);}(_0x7b36,0x161));var _0x67b3=function(_0x415c0e,_0xde4a07){_0x415c0e=_0x415c0e-0x0;var _0x4fa26c=_0x7b36[_0x415c0e];return _0x4fa26c;};'use strict';var _=require(_0x67b3('0x0'));var MailAccount=require(_0x67b3('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x2155b8,_0x5353d3,_0x4b6d5c){var _0x5981b9=_[_0x67b3('0x2')](_0x2155b8,function(_0x55af13,_0x4ffc9f){return _0x55af13[_0x4b6d5c];});for(var _0x467c0b in _0x5353d3){if(_0x5353d3[_0x67b3('0x3')](_0x467c0b)){if(!_0x5981b9[_0x467c0b]){delete _0x5353d3[_0x467c0b];}}}}Realtime[_0x67b3('0x4')][_0x67b3('0x5')]=function(_0x4a2c55,_0x31e2cf){for(var _0x153a1b in _0x31e2cf){if(_0x4a2c55['hasOwnProperty'](_0x153a1b)){_0x4a2c55[_0x153a1b]=_0x31e2cf[_0x153a1b];}}};Realtime[_0x67b3('0x4')]['initMailAccounts']=function(){var _0x4eec0c=this;return function(_0x2e7a99){if(_0x2e7a99){freeIsNotKey(_0x2e7a99,_0x4eec0c[_0x67b3('0x6')],'id');for(var _0xa6d067=0x0,_0x4f6bd6={},_0x5e948c={};_0xa6d067<_0x2e7a99[_0x67b3('0x7')];_0xa6d067+=0x1){_0x4f6bd6=_0x2e7a99[_0xa6d067];if(_[_0x67b3('0x8')](_0x4eec0c[_0x67b3('0x6')][_0x4f6bd6['id']])){_0x4eec0c[_0x67b3('0x6')][_0x4f6bd6['id']]=new MailAccount(_0x4f6bd6);}else{_[_0x67b3('0x9')](_0x4eec0c['mailAccounts'][_0x4f6bd6['id']],_0x4f6bd6);}}}return _0x4eec0c['mailAccounts'];};};module[_0x67b3('0xa')]=Realtime; \ No newline at end of file +var _0x7a47=['mergeFromDatabase','prototype','initMailAccounts','isUndefined','merge','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x7a47,0x1b3));var _0x77a4=function(_0x8e4fbb,_0x5cf71b){_0x8e4fbb=_0x8e4fbb-0x0;var _0x471af3=_0x7a47[_0x8e4fbb];return _0x471af3;};'use strict';var _=require(_0x77a4('0x0'));var MailAccount=require(_0x77a4('0x1'));var Realtime=function(){this[_0x77a4('0x2')]={};};function freeIsNotKey(_0x5c76fc,_0x77a67f,_0x24a710){var _0x38e088=_[_0x77a4('0x3')](_0x5c76fc,function(_0x5b6d8e,_0x1b220f){return _0x5b6d8e[_0x24a710];});for(var _0x288c94 in _0x77a67f){if(_0x77a67f[_0x77a4('0x4')](_0x288c94)){if(!_0x38e088[_0x288c94]){delete _0x77a67f[_0x288c94];}}}}Realtime['prototype'][_0x77a4('0x5')]=function(_0x39db63,_0x4be132){for(var _0x41a786 in _0x4be132){if(_0x39db63[_0x77a4('0x4')](_0x41a786)){_0x39db63[_0x41a786]=_0x4be132[_0x41a786];}}};Realtime[_0x77a4('0x6')][_0x77a4('0x7')]=function(){var _0x36bd53=this;return function(_0x1875d9){if(_0x1875d9){freeIsNotKey(_0x1875d9,_0x36bd53['mailAccounts'],'id');for(var _0x2e6ee7=0x0,_0x12fe30={},_0x40915a={};_0x2e6ee7<_0x1875d9['length'];_0x2e6ee7+=0x1){_0x12fe30=_0x1875d9[_0x2e6ee7];if(_[_0x77a4('0x8')](_0x36bd53['mailAccounts'][_0x12fe30['id']])){_0x36bd53['mailAccounts'][_0x12fe30['id']]=new MailAccount(_0x12fe30);}else{_[_0x77a4('0x9')](_0x36bd53[_0x77a4('0x2')][_0x12fe30['id']],_0x12fe30);}}}return _0x36bd53[_0x77a4('0x2')];};};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 04e1e21..9483da0 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 _0x4351=['service','email','active','key','ListId','TemplateId','MailServerIn','Imap','MailServerOut','Smtp','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x4351,0x1b5));var _0x1435=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x4351[_0x2b5eae];return _0x5f3ac9;};'use strict';var client=require(_0x1435('0x0'));exports[_0x1435('0x1')]=function(){return function(){return client[_0x1435('0x2')](_0x1435('0x3'),{'options':{'attributes':['id',_0x1435('0x4'),_0x1435('0x5'),_0x1435('0x6'),_0x1435('0x7'),_0x1435('0x8'),_0x1435('0x9'),_0x1435('0xa')],'raw':![],'include':[{'model':_0x1435('0xb'),'as':_0x1435('0xc')},{'model':_0x1435('0xd'),'as':_0x1435('0xe')}]},'log':'getMailAccount'});};};exports[_0x1435('0xf')]=function(_0x5de4b0,_0x4d04c7){return client[_0x1435('0x2')](_0x1435('0x10'),{'account':{'id':_0x5de4b0},'body':_0x4d04c7,'log':_0x1435('0x10')});}; \ No newline at end of file +var _0x8814=['service','email','active','key','TemplateId','MailServerIn','Imap','MailServerOut','getMailAccount','Request','NotifyMailAccount','../client','GetMailAccount'];(function(_0xe389f5,_0x479e70){var _0x2e3ed3=function(_0x400953){while(--_0x400953){_0xe389f5['push'](_0xe389f5['shift']());}};_0x2e3ed3(++_0x479e70);}(_0x8814,0x1b8));var _0x4881=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x8814[_0x36884e];return _0x1cc367;};'use strict';var client=require(_0x4881('0x0'));exports['getMailAccounts']=function(){return function(){return client['Request'](_0x4881('0x1'),{'options':{'attributes':['id','name',_0x4881('0x2'),_0x4881('0x3'),_0x4881('0x4'),_0x4881('0x5'),'ListId',_0x4881('0x6')],'raw':![],'include':[{'model':_0x4881('0x7'),'as':_0x4881('0x8')},{'model':_0x4881('0x9'),'as':'Smtp'}]},'log':_0x4881('0xa')});};};exports['notify']=function(_0x23a0d4,_0x471090){return client[_0x4881('0xb')](_0x4881('0xc'),{'account':{'id':_0x23a0d4},'body':_0x471090,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 93ac731..94173f0 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 _0xf66a=['ShowSetting','loginMailFrequency','GetSettings','../client','getSettings'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf66a,0xa8));var _0xaf66=function(_0x95f412,_0x32bac6){_0x95f412=_0x95f412-0x0;var _0x4d1548=_0xf66a[_0x95f412];return _0x4d1548;};'use strict';var client=require(_0xaf66('0x0'));exports[_0xaf66('0x1')]=function(){return client['Request'](_0xaf66('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xaf66('0x3')]},'log':_0xaf66('0x4')});}; \ No newline at end of file +var _0x1c76=['getSettings','Request','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x569aca,_0x4d83cb){var _0x312280=function(_0x40b5c1){while(--_0x40b5c1){_0x569aca['push'](_0x569aca['shift']());}};_0x312280(++_0x4d83cb);}(_0x1c76,0x96));var _0x61c7=function(_0x220576,_0x5b2568){_0x220576=_0x220576-0x0;var _0x492658=_0x1c76[_0x220576];return _0x492658;};'use strict';var client=require('../client');exports[_0x61c7('0x0')]=function(){return client[_0x61c7('0x1')](_0x61c7('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x61c7('0x3')]},'log':_0x61c7('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index a5af290..c58ae4b 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index 4360827..224e81e 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 _0xd98f=['sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','redis','defaults','localhost','adapter','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http'];(function(_0x446af2,_0x428c0f){var _0x3e291a=function(_0x2f1aaa){while(--_0x2f1aaa){_0x446af2['push'](_0x446af2['shift']());}};_0x3e291a(++_0x428c0f);}(_0xd98f,0x15c));var _0xfd98=function(_0x93d013,_0x5df091){_0x93d013=_0x93d013-0x0;var _0x3f5189=_0xd98f[_0x93d013];return _0x3f5189;};'use strict';var _=require(_0xfd98('0x0'));var http=require(_0xfd98('0x1'));var express=require('express');var sticky=require(_0xfd98('0x2'));var Redis=require(_0xfd98('0x3'));var config=require(_0xfd98('0x4'));var app=express();var server=http[_0xfd98('0x5')](app);server[_0xfd98('0x6')]=0xdbba0;if(sticky[_0xfd98('0x7')](server,config[_0xfd98('0x8')])){var socketio=require(_0xfd98('0x9'))(server,{'transports':[_0xfd98('0xa'),'polling']});config[_0xfd98('0xb')]=_[_0xfd98('0xc')](config[_0xfd98('0xb')],{'host':_0xfd98('0xd'),'port':0x18eb});socketio[_0xfd98('0xe')](require('socket.io-redis')({'pubClient':new Redis(config[_0xfd98('0xb')]),'subClient':new Redis(config['redis'])}));require(_0xfd98('0xf'))[_0xfd98('0x10')]();require(_0xfd98('0x11'))['default'](socketio);require(_0xfd98('0x12'))[_0xfd98('0x10')](app);require(_0xfd98('0x13'))[_0xfd98('0x10')](app);}else{server[_0xfd98('0x14')](_0xfd98('0x15'),function(){console[_0xfd98('0x16')](_0xfd98('0x17'),config['port']);});}exports=module[_0xfd98('0x18')]=app; \ No newline at end of file +var _0xc4d7=['port','exports','lodash','http','express','ioredis','createServer','timeout','listen','socket.io','websocket','polling','defaults','adapter','redis','../../config/triggers','../../config/socketio','default','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xc4d7,0x152));var _0x7c4d=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xc4d7[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7c4d('0x0'));var http=require(_0x7c4d('0x1'));var express=require(_0x7c4d('0x2'));var sticky=require('sticky-session');var Redis=require(_0x7c4d('0x3'));var config=require('../../config/environment');var app=express();var server=http[_0x7c4d('0x4')](app);server[_0x7c4d('0x5')]=0xdbba0;if(sticky[_0x7c4d('0x6')](server,config['port'])){var socketio=require(_0x7c4d('0x7'))(server,{'transports':[_0x7c4d('0x8'),_0x7c4d('0x9')]});config['redis']=_[_0x7c4d('0xa')](config['redis'],{'host':'localhost','port':0x18eb});socketio[_0x7c4d('0xb')](require('socket.io-redis')({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x7c4d('0xc')])}));require(_0x7c4d('0xd'))['default']();require(_0x7c4d('0xe'))[_0x7c4d('0xf')](socketio);require(_0x7c4d('0x10'))[_0x7c4d('0xf')](app);require(_0x7c4d('0x11'))[_0x7c4d('0xf')](app);}else{server[_0x7c4d('0x12')](_0x7c4d('0x13'),function(){console[_0x7c4d('0x14')](_0x7c4d('0x15'),config[_0x7c4d('0x16')]);});}exports=module[_0x7c4d('0x17')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 63258c9..5e4e7a7 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 _0x04be=['request','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','http'];(function(_0x5bfea3,_0x4e7db7){var _0x36dc95=function(_0x15bb34){while(--_0x15bb34){_0x5bfea3['push'](_0x5bfea3['shift']());}};_0x36dc95(++_0x4e7db7);}(_0x04be,0x187));var _0xe04b=function(_0x34d54c,_0x455dac){_0x34d54c=_0x34d54c-0x0;var _0xae18da=_0x04be[_0x34d54c];return _0xae18da;};'use strict';var jayson=require(_0xe04b('0x0'));var BPromise=require(_0xe04b('0x1'));var logger=require(_0xe04b('0x2'))(_0xe04b('0x3'));var client=jayson['client'][_0xe04b('0x4')]({'port':0x2329});client['Request']=function(_0x5b694e,_0x166c4a){return new BPromise(function(_0x57d9b5,_0x10499a){return client[_0xe04b('0x5')](_0x5b694e,_0x166c4a)['then'](function(_0x2c08bc){logger['debug'](_0xe04b('0x6'),'routing',_0x5b694e,_0x166c4a,_0x2c08bc);if(_0x2c08bc[_0xe04b('0x7')]){logger[_0xe04b('0x7')]('rpc',_0xe04b('0x3'),_0x5b694e,_0x2c08bc[_0xe04b('0x7')]['message'],_0x166c4a);return _0x10499a(_0x2c08bc['error'][_0xe04b('0x8')]);}else{return _0x57d9b5(_0x2c08bc[_0xe04b('0x9')]);}})[_0xe04b('0xa')](function(_0x41de32){logger[_0xe04b('0x7')](_0xe04b('0x6'),'routing',_0x5b694e,_0x41de32,_0x166c4a);return _0x10499a(_0x41de32);});});};module[_0xe04b('0xb')]=client; \ No newline at end of file +var _0x958a=['Request','request','debug','rpc','routing','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http'];(function(_0x10a5bf,_0x187060){var _0x52f649=function(_0x638bbe){while(--_0x638bbe){_0x10a5bf['push'](_0x10a5bf['shift']());}};_0x52f649(++_0x187060);}(_0x958a,0x64));var _0xa958=function(_0x3c9d6c,_0x23d406){_0x3c9d6c=_0x3c9d6c-0x0;var _0x59be42=_0x958a[_0x3c9d6c];return _0x59be42;};'use strict';var jayson=require(_0xa958('0x0'));var BPromise=require(_0xa958('0x1'));var logger=require(_0xa958('0x2'))('routing');var client=jayson[_0xa958('0x3')][_0xa958('0x4')]({'port':0x2329});client[_0xa958('0x5')]=function(_0x50188c,_0x3c63f7){return new BPromise(function(_0x409428,_0xd901a0){return client[_0xa958('0x6')](_0x50188c,_0x3c63f7)['then'](function(_0xef790f){logger[_0xa958('0x7')](_0xa958('0x8'),_0xa958('0x9'),_0x50188c,_0x3c63f7,_0xef790f);if(_0xef790f[_0xa958('0xa')]){logger[_0xa958('0xa')]('rpc',_0xa958('0x9'),_0x50188c,_0xef790f[_0xa958('0xa')][_0xa958('0xb')],_0x3c63f7);return _0xd901a0(_0xef790f['error'][_0xa958('0xb')]);}else{return _0x409428(_0xef790f[_0xa958('0xc')]);}})[_0xa958('0xd')](function(_0x3abbbd){logger[_0xa958('0xa')](_0xa958('0x8'),_0xa958('0x9'),_0x50188c,_0x3abbbd,_0x3c63f7);return _0xd901a0(_0x3abbbd);});});};module[_0xa958('0xe')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index d2791ab..ed6a827 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 _0x5f08=['./rpc/chatQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getIntervals','initIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue'];(function(_0x4f41c4,_0x30b3bf){var _0x5966d9=function(_0x21c4bc){while(--_0x21c4bc){_0x4f41c4['push'](_0x4f41c4['shift']());}};_0x5966d9(++_0x30b3bf);}(_0x5f08,0x132));var _0x85f0=function(_0x105ffc,_0x4fc8cd){_0x105ffc=_0x105ffc-0x0;var _0xc3905f=_0x5f08[_0x105ffc];return _0xc3905f;};'use strict';var BPromise=require(_0x85f0('0x0'));var server=require(_0x85f0('0x1'));var Realtime=require(_0x85f0('0x2'));var user=require(_0x85f0('0x3'));var interval=require(_0x85f0('0x4'));var openchannelQueue=require(_0x85f0('0x5'));var chatQueue=require(_0x85f0('0x6'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x85f0('0x7'));var whatsappQueue=require(_0x85f0('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x85f0('0x9')]()[_0x85f0('0xa')](user['getAgents']())[_0x85f0('0xa')](realtime['initAgents']())[_0x85f0('0xa')](interval[_0x85f0('0xb')]())[_0x85f0('0xa')](realtime[_0x85f0('0xc')]())[_0x85f0('0xa')](openchannelQueue[_0x85f0('0xd')]())['then'](realtime['initOpenchannelQueues']())[_0x85f0('0xa')](chatQueue[_0x85f0('0xe')]())[_0x85f0('0xa')](realtime[_0x85f0('0xf')]())['then'](smsQueue[_0x85f0('0x10')]())[_0x85f0('0xa')](realtime[_0x85f0('0x11')]())[_0x85f0('0xa')](mailQueue[_0x85f0('0x12')]())['then'](realtime[_0x85f0('0x13')]())['then'](faxQueue[_0x85f0('0x14')]())[_0x85f0('0xa')](realtime[_0x85f0('0x15')]())[_0x85f0('0xa')](whatsappQueue[_0x85f0('0x16')]())[_0x85f0('0xa')](realtime[_0x85f0('0x17')]())['then'](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x85f0('0xa')](function(_0x1cda49){return initRealtime();})[_0x85f0('0xa')](function(_0x4ce208){return setInterval(initRealtime,0x1388);})[_0x85f0('0x18')](function(_0x4c0618){console[_0x85f0('0x19')](_0x4c0618);});}main(); \ No newline at end of file +var _0x8ee4=['initWhatsappQueues','listen','catch','log','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','getAgents','initIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','getWhatsappQueues'];(function(_0x5a27e0,_0x3104e5){var _0x4a2a63=function(_0x2b5a77){while(--_0x2b5a77){_0x5a27e0['push'](_0x5a27e0['shift']());}};_0x4a2a63(++_0x3104e5);}(_0x8ee4,0xee));var _0x48ee=function(_0xf14cfe,_0x5428e6){_0xf14cfe=_0xf14cfe-0x0;var _0x3a9c2a=_0x8ee4[_0xf14cfe];return _0x3a9c2a;};'use strict';var BPromise=require('bluebird');var server=require(_0x48ee('0x0'));var Realtime=require(_0x48ee('0x1'));var user=require(_0x48ee('0x2'));var interval=require(_0x48ee('0x3'));var openchannelQueue=require(_0x48ee('0x4'));var chatQueue=require(_0x48ee('0x5'));var smsQueue=require(_0x48ee('0x6'));var mailQueue=require(_0x48ee('0x7'));var faxQueue=require(_0x48ee('0x8'));var whatsappQueue=require(_0x48ee('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x48ee('0xa')](user[_0x48ee('0xb')]())[_0x48ee('0xa')](realtime['initAgents']())[_0x48ee('0xa')](interval['getIntervals']())[_0x48ee('0xa')](realtime[_0x48ee('0xc')]())[_0x48ee('0xa')](openchannelQueue[_0x48ee('0xd')]())[_0x48ee('0xa')](realtime[_0x48ee('0xe')]())[_0x48ee('0xa')](chatQueue['getChatQueues']())[_0x48ee('0xa')](realtime[_0x48ee('0xf')]())[_0x48ee('0xa')](smsQueue[_0x48ee('0x10')]())[_0x48ee('0xa')](realtime[_0x48ee('0x11')]())['then'](mailQueue[_0x48ee('0x12')]())['then'](realtime[_0x48ee('0x13')]())['then'](faxQueue[_0x48ee('0x14')]())[_0x48ee('0xa')](realtime['initFaxQueues']())[_0x48ee('0xa')](whatsappQueue[_0x48ee('0x15')]())[_0x48ee('0xa')](realtime[_0x48ee('0x16')]())['then'](function(){return realtime;});}function main(){return server[_0x48ee('0x17')](realtime)['then'](function(_0x26150c){return initRealtime();})['then'](function(_0x4eb4b2){return setInterval(initRealtime,0x1388);})[_0x48ee('0x18')](function(_0x1282f2){console[_0x48ee('0x19')](_0x1282f2);});}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 f039274..eb37dae 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','exports','lodash','util','events','isNil','register','ignoreFactChanges','inherits','init','rules','activeRules','concat','prototype','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','push','call','isEqual','restart','length','condition','matchPath','noop','findRules'];(function(_0x30b4e7,_0x648241){var _0xcf90cd=function(_0x3fbca0){while(--_0x3fbca0){_0x30b4e7['push'](_0x30b4e7['shift']());}};_0xcf90cd(++_0x648241);}(_0x7a54,0x106));var _0x47a5=function(_0x593ff1,_0x20c716){_0x593ff1=_0x593ff1-0x0;var _0xf74e0c=_0x7a54[_0x593ff1];return _0xf74e0c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var EventEmitter=require(_0x47a5('0x2'))['EventEmitter'];function RuleEngine(_0x1d33e,_0x4086cd){this['init']();if(!_[_0x47a5('0x3')](_0x1d33e)){this[_0x47a5('0x4')](_0x1d33e);}if(_0x4086cd){this[_0x47a5('0x5')]=_0x4086cd[_0x47a5('0x5')];}return this;}util[_0x47a5('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x47a5('0x7')]=function(_0x59199c){this[_0x47a5('0x8')]=[];this[_0x47a5('0x9')]=[];};RuleEngine['prototype'][_0x47a5('0x4')]=function(_0x5077f3){if(Array['isArray'](_0x5077f3)){this['rules']=this[_0x47a5('0x8')][_0x47a5('0xa')](_0x5077f3);}else if(_0x5077f3!==null&&_['isObject'](_0x5077f3)){this[_0x47a5('0x8')]['push'](_0x5077f3);}this['sync']();};RuleEngine[_0x47a5('0xb')][_0x47a5('0xc')]=function(){this[_0x47a5('0x9')]=this[_0x47a5('0x8')][_0x47a5('0xd')](function(_0xd308b8){if(_[_0x47a5('0x3')](_0xd308b8['on'])){_0xd308b8['on']=!![];}if(_0xd308b8['on']===!![]){return _0xd308b8;}});this['activeRules']=_[_0x47a5('0xe')](this[_0x47a5('0x9')],['p'],[_0x47a5('0xf')]);};RuleEngine[_0x47a5('0xb')][_0x47a5('0x10')]=function(_0x620ee9,_0x3c6c46){var _0x190faa=![];_0x620ee9['result']=!![];var _0x362359=_[_0x47a5('0x11')](_0x620ee9);var _0x3b001e=_[_0x47a5('0x11')](_0x620ee9);var _0x1ef44c=this['activeRules'];var _0x549de3=[];var _0x138bc0=this['ignoreFactChanges'];(function FnRuleLoop(_0x5247fd){var _0x423a81={'rules':function(){return _0x1ef44c;},'rule':function(){return _0x1ef44c[_0x5247fd];},'when':function(_0xaf70a6){if(_0xaf70a6){var _0x2ce454=_0x1ef44c[_0x5247fd][_0x47a5('0x12')];_0x2ce454[_0x47a5('0x13')]=_0x1ef44c[_0x5247fd]['id']||_0x1ef44c[_0x5247fd][_0x47a5('0x14')]||_0x47a5('0x15')+_0x5247fd;process[_0x47a5('0x16')](function(){_0x549de3[_0x47a5('0x17')](_0x2ce454['ruleRef']);_0x2ce454[_0x47a5('0x18')](_0x362359,_0x423a81);});}else{process[_0x47a5('0x16')](function(){_0x423a81['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190faa=!![];return FnRuleLoop(0x0);},'next':function(_0x2b0360){if(!_0x138bc0&&!_[_0x47a5('0x19')](_0x3b001e,_0x362359)){_0x3b001e=_[_0x47a5('0x11')](_0x362359);process['nextTick'](function(){_0x423a81[_0x47a5('0x1a')]();});}else{process[_0x47a5('0x16')](function(){if(_[_0x47a5('0x3')](_0x2b0360)){return FnRuleLoop(_0x5247fd+0x1);}else{return FnRuleLoop(_0x2b0360);}});}}};if(_0x5247fd<_0x1ef44c[_0x47a5('0x1b')]&&_0x190faa===![]){var _0x5ef1b1=_0x1ef44c[_0x5247fd][_0x47a5('0x1c')];_0x5ef1b1[_0x47a5('0x18')](_0x362359,_0x423a81);}else{process['nextTick'](function(){_0x362359[_0x47a5('0x1d')]=_0x549de3;return _0x3c6c46?_0x3c6c46(_0x362359):_[_0x47a5('0x1e')]();});}}(0x0));};RuleEngine[_0x47a5('0xb')][_0x47a5('0x1f')]=function(_0x3abd6a){if(_['isNil'](_0x3abd6a)){return this['rules'];}else{var _0x136745=_['matches'](_0x3abd6a);return _[_0x47a5('0xd')](this['rules'],_0x136745);}};RuleEngine[_0x47a5('0xb')][_0x47a5('0x20')]=function(_0x36ad34,_0x1dac65){var _0x21f296=_0x36ad34==='on'||_0x36ad34==='ON'?!![]:![];var _0x3ba0b7=this[_0x47a5('0x1f')](_0x1dac65);for(var _0x136b14=0x0,_0x16631f=_0x3ba0b7[_0x47a5('0x1b')];_0x136b14<_0x16631f;_0x136b14+=0x1){_0x3ba0b7[_0x136b14]['on']=_0x21f296;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x21')]=function(_0x528582,_0x243210){_0x528582=parseInt(_0x528582,0xa);var _0x51833b=this[_0x47a5('0x1f')](_0x243210);for(var _0x9ac908=0x0,_0x16901f=_0x51833b['length'];_0x9ac908<_0x16901f;_0x9ac908+=0x1){_0x51833b[_0x9ac908][_0x47a5('0x22')]=_0x528582;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x23')]=function(){var _0x51cc81=this['rules'];if(_0x51cc81 instanceof Array){_0x51cc81=_0x51cc81[_0x47a5('0x24')](function(_0xfb5ddb){_0xfb5ddb['condition']=_0xfb5ddb['condition'][_0x47a5('0x25')]();_0xfb5ddb[_0x47a5('0x12')]=_0xfb5ddb['consequence'][_0x47a5('0x25')]();return _0xfb5ddb;});}else if(!_['isNil'](_0x51cc81)){_0x51cc81[_0x47a5('0x1c')]=_0x51cc81[_0x47a5('0x1c')]['toString']();_0x51cc81['consequence']=_0x51cc81[_0x47a5('0x12')]['toString']();}return _0x51cc81;};RuleEngine[_0x47a5('0xb')][_0x47a5('0x26')]=function(_0xf269a8){this['init']();if(_[_0x47a5('0x27')](_0xf269a8)){_0xf269a8=JSON['parse'](_0xf269a8);}if(_0xf269a8 instanceof Array){_0xf269a8=_0xf269a8['map'](function(_0x65542e){_0x65542e['condition']=eval('('+_0x65542e[_0x47a5('0x1c')]+')');_0x65542e['consequence']=eval('('+_0x65542e[_0x47a5('0x12')]+')');return _0x65542e;});}else if(_0xf269a8!==null&&typeof _0xf269a8==_0x47a5('0x28')){_0xf269a8[_0x47a5('0x1c')]=eval('('+_0xf269a8[_0x47a5('0x1c')]+')');_0xf269a8[_0x47a5('0x12')]=eval('('+_0xf269a8[_0x47a5('0x12')]+')');}this[_0x47a5('0x4')](_0xf269a8);};module[_0x47a5('0x29')]=RuleEngine; \ No newline at end of file +var _0x814b=['init','parse','map','object','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','prototype','rules','isArray','concat','isObject','push','sync','filter','activeRules','orderBy','asc','execute','result','clone','name','ruleRef','call','next','isEqual','nextTick','restart','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','consequence','fromJSON'];(function(_0x36afd7,_0x1181dc){var _0x2e0da0=function(_0x2254e1){while(--_0x2254e1){_0x36afd7['push'](_0x36afd7['shift']());}};_0x2e0da0(++_0x1181dc);}(_0x814b,0x1a2));var _0xb814=function(_0x4557dc,_0x3687b2){_0x4557dc=_0x4557dc-0x0;var _0x1377aa=_0x814b[_0x4557dc];return _0x1377aa;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var EventEmitter=require(_0xb814('0x2'))[_0xb814('0x3')];function RuleEngine(_0xfbb64b,_0x477725){this['init']();if(!_[_0xb814('0x4')](_0xfbb64b)){this[_0xb814('0x5')](_0xfbb64b);}if(_0x477725){this[_0xb814('0x6')]=_0x477725[_0xb814('0x6')];}return this;}util[_0xb814('0x7')](RuleEngine,EventEmitter);RuleEngine[_0xb814('0x8')]['init']=function(_0x3b0829){this[_0xb814('0x9')]=[];this['activeRules']=[];};RuleEngine[_0xb814('0x8')][_0xb814('0x5')]=function(_0x186d5a){if(Array[_0xb814('0xa')](_0x186d5a)){this[_0xb814('0x9')]=this[_0xb814('0x9')][_0xb814('0xb')](_0x186d5a);}else if(_0x186d5a!==null&&_[_0xb814('0xc')](_0x186d5a)){this[_0xb814('0x9')][_0xb814('0xd')](_0x186d5a);}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0xe')]=function(){this['activeRules']=this[_0xb814('0x9')][_0xb814('0xf')](function(_0x35b10d){if(_[_0xb814('0x4')](_0x35b10d['on'])){_0x35b10d['on']=!![];}if(_0x35b10d['on']===!![]){return _0x35b10d;}});this[_0xb814('0x10')]=_[_0xb814('0x11')](this[_0xb814('0x10')],['p'],[_0xb814('0x12')]);};RuleEngine[_0xb814('0x8')][_0xb814('0x13')]=function(_0x3f4881,_0x44fb96){var _0x17f5bd=![];_0x3f4881[_0xb814('0x14')]=!![];var _0x303aca=_[_0xb814('0x15')](_0x3f4881);var _0x45e0d0=_[_0xb814('0x15')](_0x3f4881);var _0x125ce2=this[_0xb814('0x10')];var _0x7a21ef=[];var _0x48c9df=this[_0xb814('0x6')];(function FnRuleLoop(_0x55ba16){var _0x270598={'rules':function(){return _0x125ce2;},'rule':function(){return _0x125ce2[_0x55ba16];},'when':function(_0xfac75b){if(_0xfac75b){var _0x4c3007=_0x125ce2[_0x55ba16]['consequence'];_0x4c3007['ruleRef']=_0x125ce2[_0x55ba16]['id']||_0x125ce2[_0x55ba16][_0xb814('0x16')]||'index_'+_0x55ba16;process['nextTick'](function(){_0x7a21ef[_0xb814('0xd')](_0x4c3007[_0xb814('0x17')]);_0x4c3007[_0xb814('0x18')](_0x303aca,_0x270598);});}else{process['nextTick'](function(){_0x270598[_0xb814('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x17f5bd=!![];return FnRuleLoop(0x0);},'next':function(_0x531032){if(!_0x48c9df&&!_[_0xb814('0x1a')](_0x45e0d0,_0x303aca)){_0x45e0d0=_[_0xb814('0x15')](_0x303aca);process[_0xb814('0x1b')](function(){_0x270598[_0xb814('0x1c')]();});}else{process[_0xb814('0x1b')](function(){if(_[_0xb814('0x4')](_0x531032)){return FnRuleLoop(_0x55ba16+0x1);}else{return FnRuleLoop(_0x531032);}});}}};if(_0x55ba16<_0x125ce2[_0xb814('0x1d')]&&_0x17f5bd===![]){var _0x594470=_0x125ce2[_0x55ba16][_0xb814('0x1e')];_0x594470['call'](_0x303aca,_0x270598);}else{process[_0xb814('0x1b')](function(){_0x303aca[_0xb814('0x1f')]=_0x7a21ef;return _0x44fb96?_0x44fb96(_0x303aca):_[_0xb814('0x20')]();});}}(0x0));};RuleEngine[_0xb814('0x8')][_0xb814('0x21')]=function(_0xb9e57d){if(_[_0xb814('0x4')](_0xb9e57d)){return this['rules'];}else{var _0x392222=_[_0xb814('0x22')](_0xb9e57d);return _[_0xb814('0xf')](this[_0xb814('0x9')],_0x392222);}};RuleEngine[_0xb814('0x8')][_0xb814('0x23')]=function(_0x3f0150,_0x1e4e89){var _0x5a6291=_0x3f0150==='on'||_0x3f0150==='ON'?!![]:![];var _0x271aa8=this[_0xb814('0x21')](_0x1e4e89);for(var _0x52ed64=0x0,_0x9008b2=_0x271aa8[_0xb814('0x1d')];_0x52ed64<_0x9008b2;_0x52ed64+=0x1){_0x271aa8[_0x52ed64]['on']=_0x5a6291;}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0x24')]=function(_0x2051d0,_0x58c3ca){_0x2051d0=parseInt(_0x2051d0,0xa);var _0x338a28=this['findRules'](_0x58c3ca);for(var _0x6efe9a=0x0,_0x5f3e9b=_0x338a28['length'];_0x6efe9a<_0x5f3e9b;_0x6efe9a+=0x1){_0x338a28[_0x6efe9a][_0xb814('0x25')]=_0x2051d0;}this['sync']();};RuleEngine[_0xb814('0x8')][_0xb814('0x26')]=function(){var _0x2b91bd=this['rules'];if(_0x2b91bd instanceof Array){_0x2b91bd=_0x2b91bd['map'](function(_0x26d3a9){_0x26d3a9[_0xb814('0x1e')]=_0x26d3a9['condition'][_0xb814('0x27')]();_0x26d3a9[_0xb814('0x28')]=_0x26d3a9[_0xb814('0x28')][_0xb814('0x27')]();return _0x26d3a9;});}else if(!_[_0xb814('0x4')](_0x2b91bd)){_0x2b91bd[_0xb814('0x1e')]=_0x2b91bd[_0xb814('0x1e')]['toString']();_0x2b91bd[_0xb814('0x28')]=_0x2b91bd[_0xb814('0x28')][_0xb814('0x27')]();}return _0x2b91bd;};RuleEngine[_0xb814('0x8')][_0xb814('0x29')]=function(_0x4ff31a){this[_0xb814('0x2a')]();if(_['isString'](_0x4ff31a)){_0x4ff31a=JSON[_0xb814('0x2b')](_0x4ff31a);}if(_0x4ff31a instanceof Array){_0x4ff31a=_0x4ff31a[_0xb814('0x2c')](function(_0xe0f509){_0xe0f509['condition']=eval('('+_0xe0f509[_0xb814('0x1e')]+')');_0xe0f509[_0xb814('0x28')]=eval('('+_0xe0f509['consequence']+')');return _0xe0f509;});}else if(_0x4ff31a!==null&&typeof _0x4ff31a==_0xb814('0x2d')){_0x4ff31a[_0xb814('0x1e')]=eval('('+_0x4ff31a[_0xb814('0x1e')]+')');_0x4ff31a[_0xb814('0x28')]=eval('('+_0x4ff31a[_0xb814('0x28')]+')');}this[_0xb814('0x5')](_0x4ff31a);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index c2892bc..6955824 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 _0x9a22=['sendMailMessage','jayson/promise','client','http','then','error','message','result','catch'];(function(_0x53749d,_0x2feb71){var _0x55819b=function(_0x58fdcb){while(--_0x58fdcb){_0x53749d['push'](_0x53749d['shift']());}};_0x55819b(++_0x2feb71);}(_0x9a22,0x1ba));var _0x29a2=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x9a22[_0x513aa5];return _0x1a1a7c;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x29a2('0x0'));var client=jayson[_0x29a2('0x1')][_0x29a2('0x2')]({'port':0x232b});function request(_0x291274,_0xd413b4){return new BPromise(function(_0x2b408b,_0x45e29b){return client['request'](_0x291274,_0xd413b4)[_0x29a2('0x3')](function(_0xd0e6b0){if(_0xd0e6b0[_0x29a2('0x4')]){return _0x45e29b(_0xd0e6b0[_0x29a2('0x4')][_0x29a2('0x5')]);}else{return _0x2b408b(_0xd0e6b0[_0x29a2('0x6')]);}})[_0x29a2('0x7')](function(_0xc32895){return _0x45e29b(_0xc32895);});});}exports[_0x29a2('0x8')]=function(_0x4b0dfc,_0x355cd1){return request('SendMail',{'account':_0x4b0dfc,'message':_0x355cd1});}; \ No newline at end of file +var _0x4d25=['client','http','request','then','error','message','result','catch','bluebird','jayson/promise'];(function(_0x50e02c,_0x2d91fa){var _0x2e992a=function(_0x44320f){while(--_0x44320f){_0x50e02c['push'](_0x50e02c['shift']());}};_0x2e992a(++_0x2d91fa);}(_0x4d25,0x18e));var _0x54d2=function(_0xc6a6b8,_0x4eb53f){_0xc6a6b8=_0xc6a6b8-0x0;var _0x15def2=_0x4d25[_0xc6a6b8];return _0x15def2;};'use strict';var BPromise=require(_0x54d2('0x0'));var jayson=require(_0x54d2('0x1'));var client=jayson[_0x54d2('0x2')][_0x54d2('0x3')]({'port':0x232b});function request(_0x4e57d2,_0x3ae906){return new BPromise(function(_0x5ed349,_0x26f090){return client[_0x54d2('0x4')](_0x4e57d2,_0x3ae906)[_0x54d2('0x5')](function(_0x353b9e){if(_0x353b9e[_0x54d2('0x6')]){return _0x26f090(_0x353b9e[_0x54d2('0x6')][_0x54d2('0x7')]);}else{return _0x5ed349(_0x353b9e[_0x54d2('0x8')]);}})[_0x54d2('0x9')](function(_0x1d6077){return _0x26f090(_0x1d6077);});});}exports['sendMailMessage']=function(_0x38d181,_0x175d31){return request('SendMail',{'account':_0x38d181,'message':_0x175d31});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 4dbf452..ed078fa 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 _0x996f=['openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','length','Status','toNumber','format','faxStatus','smsCurrentCapacity','busyQueue','emit','user:save','exports','lodash','moment','md5','../../../config/environment','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity'];(function(_0x5b4d32,_0x33f188){var _0x8d3ff5=function(_0x146154){while(--_0x146154){_0x5b4d32['push'](_0x5b4d32['shift']());}};_0x8d3ff5(++_0x33f188);}(_0x996f,0x97));var _0xf996=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x996f[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xf996('0x0'));var moment=require(_0xf996('0x1'));var md5=require(_0xf996('0x2'));var Redis=require('ioredis');var config=require(_0xf996('0x3'));config[_0xf996('0x4')]=_[_0xf996('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xf996('0x6'))(new Redis(config['redis']));function Agent(_0x3f1ab3){this['id']=_0x3f1ab3['id']||0x0;this[_0xf996('0x7')]=_0x3f1ab3[_0xf996('0x7')]||'';this['online']=_0x3f1ab3[_0xf996('0x8')]||!![];this['voicePause']=_0x3f1ab3[_0xf996('0x9')]||![];this[_0xf996('0xa')]=_0x3f1ab3[_0xf996('0xa')]||![];this[_0xf996('0xb')]=_0x3f1ab3[_0xf996('0xb')]||![];this[_0xf996('0xc')]=_0x3f1ab3[_0xf996('0xc')]||![];this[_0xf996('0xd')]=_0x3f1ab3[_0xf996('0xd')]||![];this[_0xf996('0xe')]=_0x3f1ab3[_0xf996('0xe')]||![];this[_0xf996('0xf')]=_0xf996('0x10');this[_0xf996('0x11')]=0x0;this[_0xf996('0x12')]=_0x3f1ab3[_0xf996('0x12')]||0x0;this[_0xf996('0x13')]=0x0;this[_0xf996('0x14')]='unknown';this[_0xf996('0x15')]=0x0;this[_0xf996('0x16')]=_0x3f1ab3[_0xf996('0x16')]||0x0;this[_0xf996('0x17')]=0x0;this['faxStatus']=_0xf996('0x10');this[_0xf996('0x18')]=0x0;this[_0xf996('0x19')]=_0x3f1ab3[_0xf996('0x19')]||0x0;this['faxCurrentCapacity']=0x0;this[_0xf996('0x1a')]=_0xf996('0x10');this[_0xf996('0x1b')]=0x0;this['smsCapacity']=_0x3f1ab3['smsCapacity']||0x0;this['smsCurrentCapacity']=0x0;this[_0xf996('0x1c')]=_0xf996('0x10');this[_0xf996('0x1d')]=0x0;this[_0xf996('0x1e')]=_0x3f1ab3[_0xf996('0x1e')]||0x0;this[_0xf996('0x1f')]=0x0;this[_0xf996('0x20')]=_0xf996('0x10');this[_0xf996('0x21')]=0x0;this[_0xf996('0x22')]=_0x3f1ab3[_0xf996('0x22')]||0x0;this[_0xf996('0x23')]=0x0;this[_0xf996('0x24')]=![];this['busyQueue']=undefined;this[_0xf996('0x2')]='';this[_0xf996('0x25')]();}Agent[_0xf996('0x26')][_0xf996('0x27')]=function(_0x15f05b){if(this[_0x15f05b+_0xf996('0x28')]>0x0){if(this[_0x15f05b+_0xf996('0x29')]>0x0&&this[_0x15f05b+_0xf996('0x28')]>=this[_0x15f05b+_0xf996('0x29')]){return _0xf996('0x2a');}else{return _0xf996('0x2b');}}else{return _0xf996('0x2c');}};Agent[_0xf996('0x26')]['updateRealtime']=function(){var _0x49a763=[_0xf996('0x2d'),_0xf996('0x2e'),_0xf996('0x2f'),_0xf996('0x30'),_0xf996('0x31'),_0xf996('0x32')];for(var _0x18ab1f=0x0;_0x18ab1f<_0x49a763[_0xf996('0x33')];_0x18ab1f+=0x1){var _0x45d5eb=this[_0xf996('0x27')](_0x49a763[_0x18ab1f]);if(this[_0x49a763[_0x18ab1f]+_0xf996('0x34')]!==_0x45d5eb){this[_0x49a763[_0x18ab1f]+'StatusTime']=_[_0xf996('0x35')](moment()[_0xf996('0x36')]('x'));}this[_0x49a763[_0x18ab1f]+_0xf996('0x34')]=_0x45d5eb;}var _0xb3429d={'id':this['id'],'name':this[_0xf996('0x7')],'online':this[_0xf996('0x8')],'voicePause':this['voicePause'],'chatPause':this['chatPause'],'mailPause':this[_0xf996('0xb')],'smsPause':this['smsPause'],'faxPause':this['faxPause'],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0xf996('0xf')],'chatStatusTime':this[_0xf996('0x11')],'chatCapacity':this[_0xf996('0x12')],'chatCurrentCapacity':this[_0xf996('0x13')],'mailStatus':this[_0xf996('0x14')],'mailStatusTime':this[_0xf996('0x15')],'mailCapacity':this[_0xf996('0x16')],'mailCurrentCapacity':this[_0xf996('0x17')],'faxStatus':this[_0xf996('0x37')],'faxStatusTime':this[_0xf996('0x18')],'faxCapacity':this[_0xf996('0x19')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0xf996('0x1a')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xf996('0x38')],'whatsappStatus':this[_0xf996('0x1c')],'whatsappStatusTime':this[_0xf996('0x1d')],'whatsappCapacity':this[_0xf996('0x1e')],'whatsappCurrentCapacity':this[_0xf996('0x1f')],'openchannelStatus':this[_0xf996('0x20')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0xf996('0x22')],'openchannelCurrentCapacity':this[_0xf996('0x23')],'busy':this['busy'],'busyQueue':this[_0xf996('0x39')]};var _0x496dc6=md5(JSON['stringify'](_0xb3429d));if(this['md5']!==_0x496dc6){this['md5']=_0x496dc6;io[_0xf996('0x3a')](_0xf996('0x3b'),_0xb3429d);}};module[_0xf996('0x3c')]=Agent; \ No newline at end of file +var _0xc009=['idle','prototype','mail','chat','openchannel','fax','sms','Status','toNumber','format','chatStatusTime','faxStatus','faxStatusTime','whatsappCurrentCapacity','busy','busyQueue','stringify','md5','emit','user:save','exports','lodash','moment','ioredis','../../../config/environment','redis','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xc009,0xc9));var _0x9c00=function(_0x5c3708,_0x9b8697){_0x5c3708=_0x5c3708-0x0;var _0x1afe33=_0xc009[_0x5c3708];return _0x1afe33;};'use strict';var _=require(_0x9c00('0x0'));var moment=require(_0x9c00('0x1'));var md5=require('md5');var Redis=require(_0x9c00('0x2'));var config=require(_0x9c00('0x3'));config['redis']=_['defaults'](config[_0x9c00('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x9c00('0x5'))(new Redis(config[_0x9c00('0x4')]));function Agent(_0x437fa6){this['id']=_0x437fa6['id']||0x0;this[_0x9c00('0x6')]=_0x437fa6[_0x9c00('0x6')]||'';this['online']=_0x437fa6[_0x9c00('0x7')]||!![];this['voicePause']=_0x437fa6[_0x9c00('0x8')]||![];this['chatPause']=_0x437fa6[_0x9c00('0x9')]||![];this[_0x9c00('0xa')]=_0x437fa6[_0x9c00('0xa')]||![];this[_0x9c00('0xb')]=_0x437fa6[_0x9c00('0xb')]||![];this[_0x9c00('0xc')]=_0x437fa6[_0x9c00('0xc')]||![];this['openchannelPause']=_0x437fa6[_0x9c00('0xd')]||![];this[_0x9c00('0xe')]=_0x9c00('0xf');this['chatStatusTime']=0x0;this[_0x9c00('0x10')]=_0x437fa6[_0x9c00('0x10')]||0x0;this[_0x9c00('0x11')]=0x0;this[_0x9c00('0x12')]='unknown';this[_0x9c00('0x13')]=0x0;this[_0x9c00('0x14')]=_0x437fa6[_0x9c00('0x14')]||0x0;this[_0x9c00('0x15')]=0x0;this['faxStatus']=_0x9c00('0xf');this['faxStatusTime']=0x0;this[_0x9c00('0x16')]=_0x437fa6[_0x9c00('0x16')]||0x0;this[_0x9c00('0x17')]=0x0;this[_0x9c00('0x18')]=_0x9c00('0xf');this[_0x9c00('0x19')]=0x0;this[_0x9c00('0x1a')]=_0x437fa6[_0x9c00('0x1a')]||0x0;this[_0x9c00('0x1b')]=0x0;this[_0x9c00('0x1c')]=_0x9c00('0xf');this[_0x9c00('0x1d')]=0x0;this['whatsappCapacity']=_0x437fa6[_0x9c00('0x1e')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x9c00('0x1f')]='unknown';this[_0x9c00('0x20')]=0x0;this[_0x9c00('0x21')]=_0x437fa6[_0x9c00('0x21')]||0x0;this['openchannelCurrentCapacity']=0x0;this['busy']=![];this['busyQueue']=undefined;this['md5']='';this['updateRealtime']();}Agent['prototype'][_0x9c00('0x22')]=function(_0xdf3756){if(this[_0xdf3756+_0x9c00('0x23')]>0x0){if(this[_0xdf3756+_0x9c00('0x24')]>0x0&&this[_0xdf3756+_0x9c00('0x23')]>=this[_0xdf3756+_0x9c00('0x24')]){return _0x9c00('0x25');}else{return _0x9c00('0x26');}}else{return _0x9c00('0x27');}};Agent[_0x9c00('0x28')]['updateRealtime']=function(){var _0x5f3bf3=[_0x9c00('0x29'),_0x9c00('0x2a'),_0x9c00('0x2b'),_0x9c00('0x2c'),_0x9c00('0x2d'),'whatsapp'];for(var _0x49e336=0x0;_0x49e336<_0x5f3bf3['length'];_0x49e336+=0x1){var _0x27e0ad=this['getChannelStatus'](_0x5f3bf3[_0x49e336]);if(this[_0x5f3bf3[_0x49e336]+_0x9c00('0x2e')]!==_0x27e0ad){this[_0x5f3bf3[_0x49e336]+'StatusTime']=_[_0x9c00('0x2f')](moment()[_0x9c00('0x30')]('x'));}this[_0x5f3bf3[_0x49e336]+_0x9c00('0x2e')]=_0x27e0ad;}var _0x3a87d9={'id':this['id'],'name':this[_0x9c00('0x6')],'online':this[_0x9c00('0x7')],'voicePause':this[_0x9c00('0x8')],'chatPause':this['chatPause'],'mailPause':this[_0x9c00('0xa')],'smsPause':this[_0x9c00('0xc')],'faxPause':this[_0x9c00('0xb')],'openchannelPause':this[_0x9c00('0xd')],'chatStatus':this[_0x9c00('0xe')],'chatStatusTime':this[_0x9c00('0x31')],'chatCapacity':this[_0x9c00('0x10')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x9c00('0x13')],'mailCapacity':this[_0x9c00('0x14')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x9c00('0x32')],'faxStatusTime':this[_0x9c00('0x33')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x9c00('0x17')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x9c00('0x19')],'smsCapacity':this[_0x9c00('0x1a')],'smsCurrentCapacity':this[_0x9c00('0x1b')],'whatsappStatus':this[_0x9c00('0x1c')],'whatsappStatusTime':this[_0x9c00('0x1d')],'whatsappCapacity':this[_0x9c00('0x1e')],'whatsappCurrentCapacity':this[_0x9c00('0x34')],'openchannelStatus':this[_0x9c00('0x1f')],'openchannelStatusTime':this[_0x9c00('0x20')],'openchannelCapacity':this[_0x9c00('0x21')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x9c00('0x35')],'busyQueue':this[_0x9c00('0x36')]};var _0x374806=md5(JSON[_0x9c00('0x37')](_0x3a87d9));if(this[_0x9c00('0x38')]!==_0x374806){this[_0x9c00('0x38')]=_0x374806;io[_0x9c00('0x39')](_0x9c00('0x3a'),_0x3a87d9);}};module[_0x9c00('0x3b')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index fe6afd2..deed2f0 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 _0x7cb9=['available','waiting','stringify','chat:queue:%s','name','emit','exports','lodash','md5','util','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','length','online'];(function(_0x2f3794,_0x3c3bec){var _0x1c9fbe=function(_0x2d2eac){while(--_0x2d2eac){_0x2f3794['push'](_0x2f3794['shift']());}};_0x1c9fbe(++_0x3c3bec);}(_0x7cb9,0x1d2));var _0x97cb=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7cb9[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x97cb('0x0'));var md5=require(_0x97cb('0x1'));var util=require(_0x97cb('0x2'));var Redis=require('ioredis');var config=require(_0x97cb('0x3'));config[_0x97cb('0x4')]=_['defaults'](config[_0x97cb('0x4')],{'host':_0x97cb('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x47018d){this['id']=_0x47018d['id']||0x0;this['name']=_0x47018d['name']||'';this[_0x97cb('0x6')]=_0x47018d[_0x97cb('0x6')]||0xa;this['strategy']=_0x47018d[_0x97cb('0x7')]||_0x97cb('0x8');this[_0x97cb('0x9')]=_0x47018d[_0x97cb('0x9')];this[_0x97cb('0xa')]={};this['waiting']=0x0;this[_0x97cb('0x1')]='';this['updateRouting']();this[_0x97cb('0xb')]();}ChatQueue[_0x97cb('0xc')][_0x97cb('0xd')]=function(){var _0x2d41af=this[_0x97cb('0xa')][_0x97cb('0xe')];this[_0x97cb('0xa')]=_[_0x97cb('0xf')](this[_0x97cb('0x9')],'id');this[_0x97cb('0xa')][_0x97cb('0xe')]=_0x2d41af;};ChatQueue['prototype'][_0x97cb('0xb')]=function(){this[_0x97cb('0x10')]=0x0;this[_0x97cb('0x11')]=0x0;for(var _0x1616e6=0x0;_0x1616e6=0x0?this[_0x97cb('0x14')]:0x0;var _0x2a7a00={'id':this['id'],'available':this[_0x97cb('0x14')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x97cb('0x11')],'waiting':this[_0x97cb('0x15')]};var _0x307272=md5(JSON[_0x97cb('0x16')](_0x2a7a00));if(this['md5']!==_0x307272){this['md5']=_0x307272;io['to'](util['format'](_0x97cb('0x17'),_0x2a7a00[_0x97cb('0x18')]))[_0x97cb('0x19')]('chat_queue:save',_0x2a7a00);}};module[_0x97cb('0x1a')]=ChatQueue; \ No newline at end of file +var _0xe579=['md5','../../../config/environment','localhost','redis','name','timeout','strategy','beepall','Agents','waiting','updateRealtime','prototype','updateRouting','mapAgentsId','_rr','map','loggedIn','paused','length','online','chatPause','available','format','emit','exports','lodash'];(function(_0x1220ce,_0xcefa78){var _0x5638d1=function(_0x3e2143){while(--_0x3e2143){_0x1220ce['push'](_0x1220ce['shift']());}};_0x5638d1(++_0xcefa78);}(_0xe579,0x137));var _0x9e57=function(_0x2c3e24,_0x29a02a){_0x2c3e24=_0x2c3e24-0x0;var _0x2ed65d=_0xe579[_0x2c3e24];return _0x2ed65d;};'use strict';var _=require(_0x9e57('0x0'));var md5=require(_0x9e57('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x9e57('0x2'));config['redis']=_['defaults'](config['redis'],{'host':_0x9e57('0x3'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9e57('0x4')]));function ChatQueue(_0x1e4eb2){this['id']=_0x1e4eb2['id']||0x0;this[_0x9e57('0x5')]=_0x1e4eb2[_0x9e57('0x5')]||'';this[_0x9e57('0x6')]=_0x1e4eb2[_0x9e57('0x6')]||0xa;this[_0x9e57('0x7')]=_0x1e4eb2[_0x9e57('0x7')]||_0x9e57('0x8');this[_0x9e57('0x9')]=_0x1e4eb2[_0x9e57('0x9')];this['mapAgentsId']={};this[_0x9e57('0xa')]=0x0;this[_0x9e57('0x1')]='';this['updateRouting']();this[_0x9e57('0xb')]();}ChatQueue[_0x9e57('0xc')][_0x9e57('0xd')]=function(){var _0x19b74c=this[_0x9e57('0xe')][_0x9e57('0xf')];this['mapAgentsId']=_[_0x9e57('0x10')](this[_0x9e57('0x9')],'id');this[_0x9e57('0xe')][_0x9e57('0xf')]=_0x19b74c;};ChatQueue[_0x9e57('0xc')]['updateRealtime']=function(){this[_0x9e57('0x11')]=0x0;this[_0x9e57('0x12')]=0x0;for(var _0x396b7d=0x0;_0x396b7d=0x0?this[_0x9e57('0x16')]:0x0;var _0x319289={'id':this['id'],'available':this[_0x9e57('0x16')],'loggedIn':this[_0x9e57('0x11')],'name':this[_0x9e57('0x5')],'paused':this[_0x9e57('0x12')],'waiting':this[_0x9e57('0xa')]};var _0x185495=md5(JSON['stringify'](_0x319289));if(this[_0x9e57('0x1')]!==_0x185495){this[_0x9e57('0x1')]=_0x185495;io['to'](util[_0x9e57('0x17')]('chat:queue:%s',_0x319289[_0x9e57('0x5')]))[_0x9e57('0x18')]('chat_queue:save',_0x319289);}};module[_0x9e57('0x19')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index fb062da..2afbe49 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 _0x3bc7=['map','Agents','loggedIn','paused','length','faxPause','available','format','fax:queue:%s','exports','lodash','md5','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId','waiting','updateRouting','prototype','_rr'];(function(_0x393dfd,_0x40dd83){var _0x2cd9c5=function(_0xc5b5b8){while(--_0xc5b5b8){_0x393dfd['push'](_0x393dfd['shift']());}};_0x2cd9c5(++_0x40dd83);}(_0x3bc7,0x1de));var _0x73bc=function(_0x432aef,_0x5a2632){_0x432aef=_0x432aef-0x0;var _0x1f1880=_0x3bc7[_0x432aef];return _0x1f1880;};'use strict';var _=require(_0x73bc('0x0'));var md5=require(_0x73bc('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x73bc('0x2'));config['redis']=_[_0x73bc('0x3')](config[_0x73bc('0x4')],{'host':_0x73bc('0x5'),'port':0x18eb});var io=require(_0x73bc('0x6'))(new Redis(config[_0x73bc('0x4')]));function FaxQueue(_0x3e0dd8){this['id']=_0x3e0dd8['id']||0x0;this[_0x73bc('0x7')]=_0x3e0dd8[_0x73bc('0x7')]||'';this['timeout']=_0x3e0dd8[_0x73bc('0x8')]||0xa;this[_0x73bc('0x9')]=_0x3e0dd8['strategy']||_0x73bc('0xa');this['Agents']=_0x3e0dd8['Agents'];this[_0x73bc('0xb')]={};this[_0x73bc('0xc')]=0x0;this[_0x73bc('0x1')]='';this[_0x73bc('0xd')]();this['updateRealtime']();}FaxQueue[_0x73bc('0xe')]['updateRouting']=function(){var _0x179524=this['mapAgentsId'][_0x73bc('0xf')];this[_0x73bc('0xb')]=_[_0x73bc('0x10')](this[_0x73bc('0x11')],'id');this[_0x73bc('0xb')][_0x73bc('0xf')]=_0x179524;};FaxQueue[_0x73bc('0xe')]['updateRealtime']=function(){this[_0x73bc('0x12')]=0x0;this[_0x73bc('0x13')]=0x0;for(var _0x4a7546=0x0;_0x4a7546=0x0?this[_0x73bc('0x16')]:0x0;var _0x330395={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0x73bc('0xc')]};var _0x258dbf=md5(JSON['stringify'](_0x330395));if(this['md5']!==_0x258dbf){this['md5']=_0x258dbf;io['to'](util[_0x73bc('0x17')](_0x73bc('0x18'),_0x330395[_0x73bc('0x7')]))['emit']('fax_queue:save',_0x330395);}};module[_0x73bc('0x19')]=FaxQueue; \ No newline at end of file +var _0xf40c=['faxPause','available','stringify','format','fax_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','strategy','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','Agents','length','online'];(function(_0x4ce688,_0x3a9bc3){var _0x368b9c=function(_0x3944a5){while(--_0x3944a5){_0x4ce688['push'](_0x4ce688['shift']());}};_0x368b9c(++_0x3a9bc3);}(_0xf40c,0x96));var _0xcf40=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0xf40c[_0x5d7227];return _0x15ac55;};'use strict';var _=require(_0xcf40('0x0'));var md5=require(_0xcf40('0x1'));var util=require(_0xcf40('0x2'));var Redis=require(_0xcf40('0x3'));var config=require(_0xcf40('0x4'));config[_0xcf40('0x5')]=_[_0xcf40('0x6')](config[_0xcf40('0x5')],{'host':_0xcf40('0x7'),'port':0x18eb});var io=require(_0xcf40('0x8'))(new Redis(config[_0xcf40('0x5')]));function FaxQueue(_0x1f25c3){this['id']=_0x1f25c3['id']||0x0;this[_0xcf40('0x9')]=_0x1f25c3['name']||'';this['timeout']=_0x1f25c3['timeout']||0xa;this[_0xcf40('0xa')]=_0x1f25c3[_0xcf40('0xa')]||_0xcf40('0xb');this['Agents']=_0x1f25c3['Agents'];this[_0xcf40('0xc')]={};this[_0xcf40('0xd')]=0x0;this[_0xcf40('0x1')]='';this[_0xcf40('0xe')]();this[_0xcf40('0xf')]();}FaxQueue[_0xcf40('0x10')][_0xcf40('0xe')]=function(){var _0x3b52a3=this[_0xcf40('0xc')]['_rr'];this[_0xcf40('0xc')]=_[_0xcf40('0x11')](this['Agents'],'id');this[_0xcf40('0xc')][_0xcf40('0x12')]=_0x3b52a3;};FaxQueue[_0xcf40('0x10')][_0xcf40('0xf')]=function(){this[_0xcf40('0x13')]=0x0;this[_0xcf40('0x14')]=0x0;for(var _0xc20e7f=0x0;_0xc20e7f=0x0?this[_0xcf40('0x19')]:0x0;var _0x54682e={'id':this['id'],'available':this[_0xcf40('0x19')],'loggedIn':this[_0xcf40('0x13')],'name':this[_0xcf40('0x9')],'paused':this[_0xcf40('0x14')],'waiting':this[_0xcf40('0xd')]};var _0x554b96=md5(JSON[_0xcf40('0x1a')](_0x54682e));if(this[_0xcf40('0x1')]!==_0x554b96){this[_0xcf40('0x1')]=_0x554b96;io['to'](util[_0xcf40('0x1b')]('fax:queue:%s',_0x54682e[_0xcf40('0x9')]))['emit'](_0xcf40('0x1c'),_0x54682e);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index c0ebcf4..be39234 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 _0x7792=['name','Intervals','exports'];(function(_0x5ad07b,_0x83231e){var _0x5c0912=function(_0x112d7f){while(--_0x112d7f){_0x5ad07b['push'](_0x5ad07b['shift']());}};_0x5c0912(++_0x83231e);}(_0x7792,0x81));var _0x2779=function(_0x45fcb3,_0x1381c4){_0x45fcb3=_0x45fcb3-0x0;var _0x506991=_0x7792[_0x45fcb3];return _0x506991;};'use strict';function Interval(_0x312e6c){this['id']=_0x312e6c['id']||0x0;this[_0x2779('0x0')]=_0x312e6c[_0x2779('0x0')]||'';this['Intervals']=_0x312e6c[_0x2779('0x1')]||{};}module[_0x2779('0x2')]=Interval; \ No newline at end of file +var _0x9659=['name','Intervals','exports'];(function(_0x1d1398,_0x403e11){var _0x51ac32=function(_0x3d295d){while(--_0x3d295d){_0x1d1398['push'](_0x1d1398['shift']());}};_0x51ac32(++_0x403e11);}(_0x9659,0x1e0));var _0x9965=function(_0x3ecc59,_0x502bef){_0x3ecc59=_0x3ecc59-0x0;var _0x140319=_0x9659[_0x3ecc59];return _0x140319;};'use strict';function Interval(_0x4ef958){this['id']=_0x4ef958['id']||0x0;this[_0x9965('0x0')]=_0x4ef958[_0x9965('0x0')]||'';this[_0x9965('0x1')]=_0x4ef958[_0x9965('0x1')]||{};}module[_0x9965('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 2412ddf..917a5ff 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 _0xc632=['mapAgentsId','waiting','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','length','online','mailPause','available','stringify','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents'];(function(_0x324012,_0x23f45f){var _0x435cf2=function(_0x378a82){while(--_0x378a82){_0x324012['push'](_0x324012['shift']());}};_0x435cf2(++_0x23f45f);}(_0xc632,0x15c));var _0x2c63=function(_0x2cf5eb,_0x299a69){_0x2cf5eb=_0x2cf5eb-0x0;var _0x297e8a=_0xc632[_0x2cf5eb];return _0x297e8a;};'use strict';var _=require(_0x2c63('0x0'));var md5=require(_0x2c63('0x1'));var util=require('util');var Redis=require(_0x2c63('0x2'));var config=require(_0x2c63('0x3'));config[_0x2c63('0x4')]=_['defaults'](config['redis'],{'host':_0x2c63('0x5'),'port':0x18eb});var io=require(_0x2c63('0x6'))(new Redis(config['redis']));function MailQueue(_0x220d7d){this['id']=_0x220d7d['id']||0x0;this[_0x2c63('0x7')]=_0x220d7d[_0x2c63('0x7')]||'';this[_0x2c63('0x8')]=_0x220d7d[_0x2c63('0x8')]||0xa;this[_0x2c63('0x9')]=_0x220d7d[_0x2c63('0x9')]||_0x2c63('0xa');this[_0x2c63('0xb')]=_0x220d7d[_0x2c63('0xb')];this[_0x2c63('0xc')]={};this[_0x2c63('0xd')]=0x0;this[_0x2c63('0x1')]='';this[_0x2c63('0xe')]();this['updateRealtime']();}MailQueue[_0x2c63('0xf')][_0x2c63('0xe')]=function(){var _0x29ad3f=this[_0x2c63('0xc')][_0x2c63('0x10')];this['mapAgentsId']=_[_0x2c63('0x11')](this[_0x2c63('0xb')],'id');this[_0x2c63('0xc')]['_rr']=_0x29ad3f;};MailQueue['prototype'][_0x2c63('0x12')]=function(){this[_0x2c63('0x13')]=0x0;this[_0x2c63('0x14')]=0x0;for(var _0x12c6b4=0x0;_0x12c6b4=0x0?this[_0x2c63('0x18')]:0x0;var _0x2a8c39={'id':this['id'],'available':this[_0x2c63('0x18')],'loggedIn':this[_0x2c63('0x13')],'name':this[_0x2c63('0x7')],'paused':this['paused'],'waiting':this[_0x2c63('0xd')]};var _0x3a8d46=md5(JSON[_0x2c63('0x19')](_0x2a8c39));if(this[_0x2c63('0x1')]!==_0x3a8d46){this[_0x2c63('0x1')]=_0x3a8d46;io['to'](util['format'](_0x2c63('0x1a'),_0x2a8c39[_0x2c63('0x7')]))[_0x2c63('0x1b')](_0x2c63('0x1c'),_0x2a8c39);}};module[_0x2c63('0x1d')]=MailQueue; \ No newline at end of file +var _0x46d8=['mail:queue:%s','emit','exports','md5','util','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','online','mailPause','available','waiting','stringify'];(function(_0x4e9274,_0x49576e){var _0x8b474c=function(_0x204cca){while(--_0x204cca){_0x4e9274['push'](_0x4e9274['shift']());}};_0x8b474c(++_0x49576e);}(_0x46d8,0x73));var _0x846d=function(_0x837dad,_0x1d9098){_0x837dad=_0x837dad-0x0;var _0x1d62d3=_0x46d8[_0x837dad];return _0x1d62d3;};'use strict';var _=require('lodash');var md5=require(_0x846d('0x0'));var util=require(_0x846d('0x1'));var Redis=require(_0x846d('0x2'));var config=require('../../../config/environment');config[_0x846d('0x3')]=_['defaults'](config[_0x846d('0x3')],{'host':_0x846d('0x4'),'port':0x18eb});var io=require(_0x846d('0x5'))(new Redis(config[_0x846d('0x3')]));function MailQueue(_0x1d1f27){this['id']=_0x1d1f27['id']||0x0;this['name']=_0x1d1f27[_0x846d('0x6')]||'';this[_0x846d('0x7')]=_0x1d1f27[_0x846d('0x7')]||0xa;this[_0x846d('0x8')]=_0x1d1f27[_0x846d('0x8')]||_0x846d('0x9');this[_0x846d('0xa')]=_0x1d1f27['Agents'];this[_0x846d('0xb')]={};this['waiting']=0x0;this['md5']='';this[_0x846d('0xc')]();this[_0x846d('0xd')]();}MailQueue['prototype'][_0x846d('0xc')]=function(){var _0x549648=this['mapAgentsId'][_0x846d('0xe')];this[_0x846d('0xb')]=_[_0x846d('0xf')](this[_0x846d('0xa')],'id');this[_0x846d('0xb')][_0x846d('0xe')]=_0x549648;};MailQueue[_0x846d('0x10')][_0x846d('0xd')]=function(){this[_0x846d('0x11')]=0x0;this[_0x846d('0x12')]=0x0;for(var _0x191323=0x0;_0x191323=0x0?this[_0x846d('0x16')]:0x0;var _0x1689d4={'id':this['id'],'available':this[_0x846d('0x16')],'loggedIn':this[_0x846d('0x11')],'name':this[_0x846d('0x6')],'paused':this['paused'],'waiting':this[_0x846d('0x17')]};var _0x22b2b0=md5(JSON[_0x846d('0x18')](_0x1689d4));if(this[_0x846d('0x0')]!==_0x22b2b0){this[_0x846d('0x0')]=_0x22b2b0;io['to'](util['format'](_0x846d('0x19'),_0x1689d4[_0x846d('0x6')]))[_0x846d('0x1a')]('mail_queue:save',_0x1689d4);}};module[_0x846d('0x1b')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 5b78c42..0d76737 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 _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x3ddb58,_0x1cf8b6){var _0x4aaa6e=function(_0x3c3753){while(--_0x3c3753){_0x3ddb58['push'](_0x3ddb58['shift']());}};_0x4aaa6e(++_0x1cf8b6);}(_0x814b,0x1a2));var _0xb814=function(_0x5106c1,_0x13233a){_0x5106c1=_0x5106c1-0x0;var _0x5bcaac=_0x814b[_0x5106c1];return _0x5bcaac;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x326f,0xd1));var _0xf326=function(_0x53b93d,_0x2ea690){_0x53b93d=_0x53b93d-0x0;var _0x2b1abf=_0x326f[_0x53b93d];return _0x2b1abf;};'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 9291907..424be61 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 _0xe94a=['timeout','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','loggedIn','paused','length','online','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name'];(function(_0x37e586,_0x2b2ddc){var _0x30bce2=function(_0x40a9fc){while(--_0x40a9fc){_0x37e586['push'](_0x37e586['shift']());}};_0x30bce2(++_0x2b2ddc);}(_0xe94a,0x1c7));var _0xae94=function(_0x4cc492,_0x162c85){_0x4cc492=_0x4cc492-0x0;var _0x1f36b9=_0xe94a[_0x4cc492];return _0x1f36b9;};'use strict';var _=require(_0xae94('0x0'));var md5=require(_0xae94('0x1'));var util=require(_0xae94('0x2'));var Redis=require('ioredis');var config=require(_0xae94('0x3'));config[_0xae94('0x4')]=_[_0xae94('0x5')](config[_0xae94('0x4')],{'host':_0xae94('0x6'),'port':0x18eb});var io=require(_0xae94('0x7'))(new Redis(config['redis']));function SmsQueue(_0x429d6d){this['id']=_0x429d6d['id']||0x0;this[_0xae94('0x8')]=_0x429d6d[_0xae94('0x8')]||'';this[_0xae94('0x9')]=_0x429d6d[_0xae94('0x9')]||0xa;this['strategy']=_0x429d6d['strategy']||_0xae94('0xa');this[_0xae94('0xb')]=_0x429d6d['Agents'];this[_0xae94('0xc')]={};this[_0xae94('0xd')]=0x0;this[_0xae94('0x1')]='';this[_0xae94('0xe')]();this[_0xae94('0xf')]();}SmsQueue[_0xae94('0x10')][_0xae94('0xe')]=function(){var _0x3e24c6=this['mapAgentsId']['_rr'];this[_0xae94('0xc')]=_[_0xae94('0x11')](this['Agents'],'id');this[_0xae94('0xc')]['_rr']=_0x3e24c6;};SmsQueue[_0xae94('0x10')][_0xae94('0xf')]=function(){this[_0xae94('0x12')]=0x0;this[_0xae94('0x13')]=0x0;for(var _0x223e35=0x0;_0x223e35=0x0?this[_0xae94('0x16')]:0x0;var _0x382b4a={'id':this['id'],'available':this[_0xae94('0x16')],'loggedIn':this[_0xae94('0x12')],'name':this['name'],'paused':this[_0xae94('0x13')],'waiting':this[_0xae94('0xd')]};var _0x5a0cdd=md5(JSON[_0xae94('0x17')](_0x382b4a));if(this[_0xae94('0x1')]!==_0x5a0cdd){this['md5']=_0x5a0cdd;io['to'](util[_0xae94('0x18')](_0xae94('0x19'),_0x382b4a[_0xae94('0x8')]))[_0xae94('0x1a')](_0xae94('0x1b'),_0x382b4a);}};module[_0xae94('0x1c')]=SmsQueue; \ No newline at end of file +var _0x032a=['waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','online','smsPause','available','format','sms:queue:%s','emit','exports','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId'];(function(_0x1505e5,_0x5cc291){var _0x5b1dcd=function(_0x18bfe5){while(--_0x18bfe5){_0x1505e5['push'](_0x1505e5['shift']());}};_0x5b1dcd(++_0x5cc291);}(_0x032a,0xf0));var _0xa032=function(_0x34bc6c,_0x10d089){_0x34bc6c=_0x34bc6c-0x0;var _0x168820=_0x032a[_0x34bc6c];return _0x168820;};'use strict';var _=require('lodash');var md5=require(_0xa032('0x0'));var util=require('util');var Redis=require(_0xa032('0x1'));var config=require(_0xa032('0x2'));config[_0xa032('0x3')]=_[_0xa032('0x4')](config[_0xa032('0x3')],{'host':_0xa032('0x5'),'port':0x18eb});var io=require(_0xa032('0x6'))(new Redis(config[_0xa032('0x3')]));function SmsQueue(_0x44fd88){this['id']=_0x44fd88['id']||0x0;this[_0xa032('0x7')]=_0x44fd88[_0xa032('0x7')]||'';this[_0xa032('0x8')]=_0x44fd88['timeout']||0xa;this[_0xa032('0x9')]=_0x44fd88['strategy']||'beepall';this[_0xa032('0xa')]=_0x44fd88['Agents'];this[_0xa032('0xb')]={};this[_0xa032('0xc')]=0x0;this[_0xa032('0x0')]='';this[_0xa032('0xd')]();this[_0xa032('0xe')]();}SmsQueue['prototype'][_0xa032('0xd')]=function(){var _0x144909=this['mapAgentsId'][_0xa032('0xf')];this[_0xa032('0xb')]=_[_0xa032('0x10')](this[_0xa032('0xa')],'id');this[_0xa032('0xb')]['_rr']=_0x144909;};SmsQueue[_0xa032('0x11')][_0xa032('0xe')]=function(){this[_0xa032('0x12')]=0x0;this[_0xa032('0x13')]=0x0;for(var _0x39ff1f=0x0;_0x39ff1f=0x0?this['available']:0x0;var _0xff6817={'id':this['id'],'available':this['available'],'loggedIn':this[_0xa032('0x12')],'name':this[_0xa032('0x7')],'paused':this[_0xa032('0x13')],'waiting':this['waiting']};var _0x196947=md5(JSON['stringify'](_0xff6817));if(this[_0xa032('0x0')]!==_0x196947){this[_0xa032('0x0')]=_0x196947;io['to'](util[_0xa032('0x18')](_0xa032('0x19'),_0xff6817[_0xa032('0x7')]))[_0xa032('0x1a')]('sms_queue:save',_0xff6817);}};module[_0xa032('0x1b')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 4401333..712ca27 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 _0x0d2d=['defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','loggedIn','length','whatsappPause','paused','available','whatsapp:queue:%s','whatsapp_queue:save','exports','lodash','ioredis','../../../config/environment','redis'];(function(_0x22d7b8,_0x37a86f){var _0x49eba7=function(_0x76aeb2){while(--_0x76aeb2){_0x22d7b8['push'](_0x22d7b8['shift']());}};_0x49eba7(++_0x37a86f);}(_0x0d2d,0x19c));var _0xd0d2=function(_0x2ffb97,_0x3141e9){_0x2ffb97=_0x2ffb97-0x0;var _0x474336=_0x0d2d[_0x2ffb97];return _0x474336;};'use strict';var _=require(_0xd0d2('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xd0d2('0x1'));var config=require(_0xd0d2('0x2'));config[_0xd0d2('0x3')]=_[_0xd0d2('0x4')](config[_0xd0d2('0x3')],{'host':_0xd0d2('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd0d2('0x3')]));function WhatsappQueue(_0x1feaef){this['id']=_0x1feaef['id']||0x0;this[_0xd0d2('0x6')]=_0x1feaef[_0xd0d2('0x6')]||'';this[_0xd0d2('0x7')]=_0x1feaef[_0xd0d2('0x7')]||0xa;this['strategy']=_0x1feaef[_0xd0d2('0x8')]||_0xd0d2('0x9');this[_0xd0d2('0xa')]=_0x1feaef['Agents'];this[_0xd0d2('0xb')]={};this[_0xd0d2('0xc')]=0x0;this[_0xd0d2('0xd')]='';this[_0xd0d2('0xe')]();this[_0xd0d2('0xf')]();}WhatsappQueue[_0xd0d2('0x10')][_0xd0d2('0xe')]=function(){var _0x2af160=this[_0xd0d2('0xb')][_0xd0d2('0x11')];this[_0xd0d2('0xb')]=_['map'](this[_0xd0d2('0xa')],'id');this[_0xd0d2('0xb')][_0xd0d2('0x11')]=_0x2af160;};WhatsappQueue['prototype']['updateRealtime']=function(){this[_0xd0d2('0x12')]=0x0;this['paused']=0x0;for(var _0x33a99b=0x0;_0x33a99b=0x0?this[_0xd0d2('0x16')]:0x0;var _0x509a01={'id':this['id'],'available':this[_0xd0d2('0x16')],'loggedIn':this[_0xd0d2('0x12')],'name':this[_0xd0d2('0x6')],'paused':this[_0xd0d2('0x15')],'waiting':this[_0xd0d2('0xc')]};var _0x1a290d=md5(JSON['stringify'](_0x509a01));if(this[_0xd0d2('0xd')]!==_0x1a290d){this[_0xd0d2('0xd')]=_0x1a290d;io['to'](util['format'](_0xd0d2('0x17'),_0x509a01['name']))['emit'](_0xd0d2('0x18'),_0x509a01);}};module[_0xd0d2('0x19')]=WhatsappQueue; \ No newline at end of file +var _0xfd46=['ioredis','../../../config/environment','defaults','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRealtime','_rr','map','prototype','loggedIn','paused','length','online','available','waiting','format','emit','whatsapp_queue:save','md5'];(function(_0xbac1ec,_0x2f59dc){var _0x1d5ce9=function(_0x18c604){while(--_0x18c604){_0xbac1ec['push'](_0xbac1ec['shift']());}};_0x1d5ce9(++_0x2f59dc);}(_0xfd46,0x11f));var _0x6fd4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xfd46[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var md5=require(_0x6fd4('0x0'));var util=require('util');var Redis=require(_0x6fd4('0x1'));var config=require(_0x6fd4('0x2'));config['redis']=_[_0x6fd4('0x3')](config[_0x6fd4('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6fd4('0x4')]));function WhatsappQueue(_0x1b2389){this['id']=_0x1b2389['id']||0x0;this[_0x6fd4('0x5')]=_0x1b2389[_0x6fd4('0x5')]||'';this[_0x6fd4('0x6')]=_0x1b2389[_0x6fd4('0x6')]||0xa;this[_0x6fd4('0x7')]=_0x1b2389[_0x6fd4('0x7')]||_0x6fd4('0x8');this[_0x6fd4('0x9')]=_0x1b2389[_0x6fd4('0x9')];this[_0x6fd4('0xa')]={};this['waiting']=0x0;this[_0x6fd4('0x0')]='';this['updateRouting']();this[_0x6fd4('0xb')]();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x10b665=this[_0x6fd4('0xa')][_0x6fd4('0xc')];this['mapAgentsId']=_[_0x6fd4('0xd')](this['Agents'],'id');this[_0x6fd4('0xa')][_0x6fd4('0xc')]=_0x10b665;};WhatsappQueue[_0x6fd4('0xe')]['updateRealtime']=function(){this[_0x6fd4('0xf')]=0x0;this[_0x6fd4('0x10')]=0x0;for(var _0x1ad052=0x0;_0x1ad052=0x0?this[_0x6fd4('0x13')]:0x0;var _0x463f51={'id':this['id'],'available':this[_0x6fd4('0x13')],'loggedIn':this[_0x6fd4('0xf')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x6fd4('0x14')]};var _0x80c3f4=md5(JSON['stringify'](_0x463f51));if(this['md5']!==_0x80c3f4){this['md5']=_0x80c3f4;io['to'](util[_0x6fd4('0x15')]('whatsapp:queue:%s',_0x463f51[_0x6fd4('0x5')]))[_0x6fd4('0x16')](_0x6fd4('0x17'),_0x463f51);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 4695ccf..3f8b727 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(_0x1a76b7,_0x3fa19d){var _0x2a72a8=function(_0x28cd2e){while(--_0x28cd2e){_0x1a76b7['push'](_0x1a76b7['shift']());}};_0x2a72a8(++_0x3fa19d);}(_0xb10b,0x12a));var _0xbb10=function(_0x3de873,_0x174b5f){_0x3de873=_0x3de873-0x0;var _0x380b8c=_0xb10b[_0x3de873];return _0x380b8c;};'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 _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index d25b1cc..5cb84b2 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 _0x932b=['UpdateChatInteraction','updateChatInteraction','addTags','addTagsToChatInteraction','../client','update'];(function(_0x5a1ead,_0x461d29){var _0x547b03=function(_0x197a58){while(--_0x197a58){_0x5a1ead['push'](_0x5a1ead['shift']());}};_0x547b03(++_0x461d29);}(_0x932b,0x16c));var _0xb932=function(_0x5caf7e,_0x52e1bc){_0x5caf7e=_0x5caf7e-0x0;var _0x5c3435=_0x932b[_0x5caf7e];return _0x5c3435;};'use strict';var client=require(_0xb932('0x0'));exports[_0xb932('0x1')]=function(_0x2df290,_0x47750c){return client['Request'](_0xb932('0x2'),{'body':_0x47750c,'options':{'where':{'id':_0x2df290}},'log':_0xb932('0x3')});};exports[_0xb932('0x4')]=function(_0x4fe329,_0x346ab8){return client['Request']('AddTagsToChatInteraction',{'body':_0x346ab8,'options':{'where':{'id':_0x4fe329}},'log':_0xb932('0x5')});}; \ No newline at end of file +var _0x7b62=['update','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0xbd1aeb,_0x3f04b0){var _0x55b1be=function(_0x5f5d78){while(--_0x5f5d78){_0xbd1aeb['push'](_0xbd1aeb['shift']());}};_0x55b1be(++_0x3f04b0);}(_0x7b62,0x1e0));var _0x27b6=function(_0x5b41ff,_0x30b800){_0x5b41ff=_0x5b41ff-0x0;var _0x23423a=_0x7b62[_0x5b41ff];return _0x23423a;};'use strict';var client=require('../client');exports[_0x27b6('0x0')]=function(_0x42f7a0,_0x5ab524){return client[_0x27b6('0x1')](_0x27b6('0x2'),{'body':_0x5ab524,'options':{'where':{'id':_0x42f7a0}},'log':_0x27b6('0x3')});};exports['addTags']=function(_0x59868c,_0x5dcb4e){return client[_0x27b6('0x1')]('AddTagsToChatInteraction',{'body':_0x5dcb4e,'options':{'where':{'id':_0x59868c}},'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 e65c36c..7deec38 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 _0x69cf=['CreateChatMessage','createChatMessage','Request'];(function(_0xfd3603,_0x193b47){var _0xadf282=function(_0x24386e){while(--_0x24386e){_0xfd3603['push'](_0xfd3603['shift']());}};_0xadf282(++_0x193b47);}(_0x69cf,0xb9));var _0xf69c=function(_0x3ad06e,_0x2cc9af){_0x3ad06e=_0x3ad06e-0x0;var _0xa97338=_0x69cf[_0x3ad06e];return _0xa97338;};'use strict';var client=require('../client');exports['create']=function(_0x2f2bf0){return client[_0xf69c('0x0')](_0xf69c('0x1'),{'body':_0x2f2bf0,'log':_0xf69c('0x2')});}; \ No newline at end of file +var _0x0ce1=['Request','CreateChatMessage','createChatMessage','../client'];(function(_0x5cd915,_0xf58d05){var _0x4e6bfb=function(_0x3bb219){while(--_0x3bb219){_0x5cd915['push'](_0x5cd915['shift']());}};_0x4e6bfb(++_0xf58d05);}(_0x0ce1,0x177));var _0x10ce=function(_0x579388,_0x191c12){_0x579388=_0x579388-0x0;var _0x155c8d=_0x0ce1[_0x579388];return _0x155c8d;};'use strict';var client=require(_0x10ce('0x0'));exports['create']=function(_0x42856e){return client[_0x10ce('0x1')](_0x10ce('0x2'),{'body':_0x42856e,'log':_0x10ce('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 980d100..3c69bbf 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 _0xc18a=['chatPause','../client','getChatQueues','Request','GetChatQueue','timeout','strategy','User','Agents','name','online'];(function(_0x5e909d,_0xcb0787){var _0x4cf7b5=function(_0x4581c6){while(--_0x4581c6){_0x5e909d['push'](_0x5e909d['shift']());}};_0x4cf7b5(++_0xcb0787);}(_0xc18a,0x1cf));var _0xac18=function(_0x5c8150,_0x5c9d2b){_0x5c8150=_0x5c8150-0x0;var _0x1ad0a9=_0xc18a[_0x5c8150];return _0x1ad0a9;};'use strict';var client=require(_0xac18('0x0'));exports[_0xac18('0x1')]=function(){return function(){return client[_0xac18('0x2')](_0xac18('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xac18('0x4'),_0xac18('0x5')],'include':[{'model':_0xac18('0x6'),'as':_0xac18('0x7'),'attributes':['id',_0xac18('0x8'),_0xac18('0x9'),_0xac18('0xa')]}]},'log':_0xac18('0x1')});};}; \ No newline at end of file +var _0x2975=['name','timeout','strategy','online','chatPause','getChatQueues','Request','GetChatQueue'];(function(_0x280e95,_0x2e5619){var _0x190fba=function(_0xbbba42){while(--_0xbbba42){_0x280e95['push'](_0x280e95['shift']());}};_0x190fba(++_0x2e5619);}(_0x2975,0x1c5));var _0x5297=function(_0x19b59d,_0x1865da){_0x19b59d=_0x19b59d-0x0;var _0x45a611=_0x2975[_0x19b59d];return _0x45a611;};'use strict';var client=require('../client');exports[_0x5297('0x0')]=function(){return function(){return client[_0x5297('0x1')](_0x5297('0x2'),{'options':{'raw':![],'attributes':['id',_0x5297('0x3'),_0x5297('0x4'),_0x5297('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0x5297('0x6'),_0x5297('0x7')]}]},'log':_0x5297('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index fee4de4..6d51c88 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 _0xe799=['../client','CreateChatQueueReport','Request','DESC'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe799,0x170));var _0x9e79=function(_0x2898bd,_0x4504b4){_0x2898bd=_0x2898bd-0x0;var _0x448a16=_0xe799[_0x2898bd];return _0x448a16;};'use strict';var client=require(_0x9e79('0x0'));exports['create']=function(_0x3308ba){return client['Request'](_0x9e79('0x1'),{'body':_0x3308ba,'log':_0x9e79('0x1')});};exports['update']=function(_0x34a40e,_0x3f0a4f){return client[_0x9e79('0x2')]('UpdateChatQueueReport',{'body':_0x3f0a4f,'options':{'where':{'uniqueid':_0x34a40e},'order':[['id',_0x9e79('0x3')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x177a=['Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client'];(function(_0x55e86b,_0x3c19d2){var _0x3c9b4e=function(_0x1e5c7d){while(--_0x1e5c7d){_0x55e86b['push'](_0x55e86b['shift']());}};_0x3c9b4e(++_0x3c19d2);}(_0x177a,0xdd));var _0xa177=function(_0x5313de,_0x2691ff){_0x5313de=_0x5313de-0x0;var _0x40f5a1=_0x177a[_0x5313de];return _0x40f5a1;};'use strict';var client=require(_0xa177('0x0'));exports['create']=function(_0x5ce606){return client[_0xa177('0x1')](_0xa177('0x2'),{'body':_0x5ce606,'log':_0xa177('0x2')});};exports[_0xa177('0x3')]=function(_0x4275db,_0x471a81){return client['Request'](_0xa177('0x4'),{'body':_0x471a81,'options':{'where':{'uniqueid':_0x4275db},'order':[['id',_0xa177('0x5')]],'limit':0x1},'log':_0xa177('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 788533e..b7ce4ef 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x11946c,_0x12152c){var _0x383935=function(_0x61fce2){while(--_0x61fce2){_0x11946c['push'](_0x11946c['shift']());}};_0x383935(++_0x12152c);}(_0x7a54,0x106));var _0x47a5=function(_0x5e090d,_0x21bfab){_0x5e090d=_0x5e090d-0x0;var _0x4ba8e5=_0x7a54[_0x5e090d];return _0x4ba8e5;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x2bd630,_0x494f0a){var _0x34d159=function(_0x540cfd){while(--_0x540cfd){_0x2bd630['push'](_0x2bd630['shift']());}};_0x34d159(++_0x494f0a);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index ffcc030..7c7ebc7 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 _0xd4ef=['../client','create','Request'];(function(_0x504a16,_0x193ecd){var _0x4c2e54=function(_0x547457){while(--_0x547457){_0x504a16['push'](_0x504a16['shift']());}};_0x4c2e54(++_0x193ecd);}(_0xd4ef,0x171));var _0xfd4e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4ef[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xfd4e('0x0'));exports[_0xfd4e('0x1')]=function(_0x1d7501){return client[_0xfd4e('0x2')]('CreateFaxMessage',{'body':_0x1d7501,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x0c66=['create','Request','CreateFaxMessage','createFaxMessage','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0c66,0x1a8));var _0x60c6=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x0c66[_0x45783c];return _0x1161da;};'use strict';var client=require(_0x60c6('0x0'));exports[_0x60c6('0x1')]=function(_0x1e7c40){return client[_0x60c6('0x2')](_0x60c6('0x3'),{'body':_0x1e7c40,'log':_0x60c6('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index f2e22f7..9393799 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 _0x3364=['../client','Request','GetFaxQueue','name','timeout','strategy','User','faxPause'];(function(_0xc1b70b,_0x3ccbb4){var _0x21852d=function(_0x22e1a8){while(--_0x22e1a8){_0xc1b70b['push'](_0xc1b70b['shift']());}};_0x21852d(++_0x3ccbb4);}(_0x3364,0xd8));var _0x4336=function(_0x52e1dd,_0x4b6b24){_0x52e1dd=_0x52e1dd-0x0;var _0x136ea1=_0x3364[_0x52e1dd];return _0x136ea1;};'use strict';var client=require(_0x4336('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x4336('0x1')](_0x4336('0x2'),{'options':{'raw':![],'attributes':['id',_0x4336('0x3'),_0x4336('0x4'),_0x4336('0x5')],'include':[{'model':_0x4336('0x6'),'as':'Agents','attributes':['id',_0x4336('0x3'),'online',_0x4336('0x7')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0x37dc=['getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','User','Agents','online','faxPause','../client'];(function(_0x3d2a90,_0x44d159){var _0xbe7d7f=function(_0x23d64d){while(--_0x23d64d){_0x3d2a90['push'](_0x3d2a90['shift']());}};_0xbe7d7f(++_0x44d159);}(_0x37dc,0x8e));var _0xc37d=function(_0x54dfa8,_0x295848){_0x54dfa8=_0x54dfa8-0x0;var _0x410df2=_0x37dc[_0x54dfa8];return _0x410df2;};'use strict';var client=require(_0xc37d('0x0'));exports[_0xc37d('0x1')]=function(){return function(){return client[_0xc37d('0x2')](_0xc37d('0x3'),{'options':{'raw':![],'attributes':['id',_0xc37d('0x4'),_0xc37d('0x5'),_0xc37d('0x6')],'include':[{'model':_0xc37d('0x7'),'as':_0xc37d('0x8'),'attributes':['id',_0xc37d('0x4'),_0xc37d('0x9'),_0xc37d('0xa')]}]},'log':_0xc37d('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 0e7643c..25d9f99 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 _0xe185=['update','Request','UpdateFaxQueueReport','create','CreateFaxQueueReport'];(function(_0x2bb089,_0x1d87d8){var _0x1471a9=function(_0x4a02a0){while(--_0x4a02a0){_0x2bb089['push'](_0x2bb089['shift']());}};_0x1471a9(++_0x1d87d8);}(_0xe185,0xa3));var _0x5e18=function(_0x2e5fb2,_0x2b4be0){_0x2e5fb2=_0x2e5fb2-0x0;var _0x3be9dc=_0xe185[_0x2e5fb2];return _0x3be9dc;};'use strict';var client=require('../client');exports[_0x5e18('0x0')]=function(_0x13312e){return client['Request']('CreateFaxQueueReport',{'body':_0x13312e,'log':_0x5e18('0x1')});};exports[_0x5e18('0x2')]=function(_0x282602,_0x40a065){return client[_0x5e18('0x3')](_0x5e18('0x4'),{'body':_0x40a065,'options':{'where':{'uniqueid':_0x282602},'order':[['id','DESC']],'limit':0x1},'log':_0x5e18('0x4')});}; \ No newline at end of file +var _0xa700=['create','CreateFaxQueueReport','Request','DESC','../client'];(function(_0xad5e8,_0x58df67){var _0x596909=function(_0x529911){while(--_0x529911){_0xad5e8['push'](_0xad5e8['shift']());}};_0x596909(++_0x58df67);}(_0xa700,0x13f));var _0x0a70=function(_0x3f1a89,_0x17ce94){_0x3f1a89=_0x3f1a89-0x0;var _0x3efe92=_0xa700[_0x3f1a89];return _0x3efe92;};'use strict';var client=require(_0x0a70('0x0'));exports[_0x0a70('0x1')]=function(_0x3d5bf6){return client['Request']('CreateFaxQueueReport',{'body':_0x3d5bf6,'log':_0x0a70('0x2')});};exports['update']=function(_0x138d8d,_0x3ea99f){return client[_0x0a70('0x3')]('UpdateFaxQueueReport',{'body':_0x3ea99f,'options':{'where':{'uniqueid':_0x138d8d},'order':[['id',_0x0a70('0x4')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 5222100..81a786f 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 _0xe8d8=['Intervals','../client','getIntervals','Request','GetInterval','name'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xe8d8,0x163));var _0x8e8d=function(_0x2e7c0c,_0x3d0ff3){_0x2e7c0c=_0x2e7c0c-0x0;var _0x23be6f=_0xe8d8[_0x2e7c0c];return _0x23be6f;};'use strict';var client=require(_0x8e8d('0x0'));exports[_0x8e8d('0x1')]=function(){return function(){return client[_0x8e8d('0x2')](_0x8e8d('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x8e8d('0x4')],'include':[{'model':'Interval','as':_0x8e8d('0x5'),'attributes':['id',_0x8e8d('0x4'),'interval']}]},'log':_0x8e8d('0x1')});};}; \ No newline at end of file +var _0x03fe=['name','Interval','../client','getIntervals','Request','GetInterval'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x03fe,0x116));var _0xe03f=function(_0x3f07c1,_0x3a093b){_0x3f07c1=_0x3f07c1-0x0;var _0x9839ca=_0x03fe[_0x3f07c1];return _0x9839ca;};'use strict';var client=require(_0xe03f('0x0'));exports[_0xe03f('0x1')]=function(){return function(){return client[_0xe03f('0x2')](_0xe03f('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xe03f('0x4')],'include':[{'model':_0xe03f('0x5'),'as':'Intervals','attributes':['id',_0xe03f('0x4'),'interval']}]},'log':_0xe03f('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index cfce9cf..7e9261d 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 _0xd943=['addTagsToChatInteraction','../client','update','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x2f079a,_0x1d08b7){var _0x46d238=function(_0x4689bf){while(--_0x4689bf){_0x2f079a['push'](_0x2f079a['shift']());}};_0x46d238(++_0x1d08b7);}(_0xd943,0x15d));var _0x3d94=function(_0x11e614,_0x23d523){_0x11e614=_0x11e614-0x0;var _0x5a1e39=_0xd943[_0x11e614];return _0x5a1e39;};'use strict';var client=require(_0x3d94('0x0'));exports[_0x3d94('0x1')]=function(_0x55353d,_0x440dd8){return client['Request'](_0x3d94('0x2'),{'body':_0x440dd8,'options':{'where':{'id':_0x55353d}},'log':_0x3d94('0x3')});};exports[_0x3d94('0x4')]=function(_0xc13b61,_0xaf8962){return client['Request']('AddTagsToMailInteraction',{'body':_0xaf8962,'options':{'where':{'id':_0xc13b61}},'log':_0x3d94('0x5')});}; \ No newline at end of file +var _0x056b=['addTags','AddTagsToMailInteraction','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x43daa8,_0x2b964e){var _0x42a182=function(_0x16a94b){while(--_0x16a94b){_0x43daa8['push'](_0x43daa8['shift']());}};_0x42a182(++_0x2b964e);}(_0x056b,0xb6));var _0xb056=function(_0x3e618a,_0x135251){_0x3e618a=_0x3e618a-0x0;var _0x1f3d61=_0x056b[_0x3e618a];return _0x1f3d61;};'use strict';var client=require('../client');exports[_0xb056('0x0')]=function(_0x556e84,_0xed6810){return client[_0xb056('0x1')](_0xb056('0x2'),{'body':_0xed6810,'options':{'where':{'id':_0x556e84}},'log':_0xb056('0x3')});};exports[_0xb056('0x4')]=function(_0x4157e0,_0x343d88){return client[_0xb056('0x1')](_0xb056('0x5'),{'body':_0x343d88,'options':{'where':{'id':_0x4157e0}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index b4d56d0..9f6a47b 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 _0x87e0=['CreateMailMessage','../client'];(function(_0x366961,_0x3a976d){var _0x24d566=function(_0x46be04){while(--_0x46be04){_0x366961['push'](_0x366961['shift']());}};_0x24d566(++_0x3a976d);}(_0x87e0,0x11d));var _0x087e=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x87e0[_0x3b380d];return _0x54502b;};'use strict';var client=require(_0x087e('0x0'));exports['create']=function(_0x439cbb){return client['Request'](_0x087e('0x1'),{'body':_0x439cbb,'log':'createMailMessage'});}; \ No newline at end of file +var _0x87ed=['Request','CreateMailMessage','createMailMessage','create'];(function(_0x11a55c,_0x4eced9){var _0x26c390=function(_0x5b0662){while(--_0x5b0662){_0x11a55c['push'](_0x11a55c['shift']());}};_0x26c390(++_0x4eced9);}(_0x87ed,0x183));var _0xd87e=function(_0x4042a4,_0x10df88){_0x4042a4=_0x4042a4-0x0;var _0x3adbba=_0x87ed[_0x4042a4];return _0x3adbba;};'use strict';var client=require('../client');exports[_0xd87e('0x0')]=function(_0x19fae7){return client[_0xd87e('0x1')](_0xd87e('0x2'),{'body':_0x19fae7,'log':_0xd87e('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index a4529c3..1d339c5 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 _0x13c2=['name','strategy','User','Agents','online','mailPause','../client','getMailQueues','GetMailQueue'];(function(_0x2d7fbe,_0x44b669){var _0x3a93ac=function(_0x101520){while(--_0x101520){_0x2d7fbe['push'](_0x2d7fbe['shift']());}};_0x3a93ac(++_0x44b669);}(_0x13c2,0x180));var _0x213c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x13c2[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x213c('0x0'));exports[_0x213c('0x1')]=function(){return function(){return client['Request'](_0x213c('0x2'),{'options':{'raw':![],'attributes':['id',_0x213c('0x3'),'timeout',_0x213c('0x4')],'include':[{'model':_0x213c('0x5'),'as':_0x213c('0x6'),'attributes':['id',_0x213c('0x3'),_0x213c('0x7'),_0x213c('0x8')]}]},'log':_0x213c('0x1')});};}; \ No newline at end of file +var _0xda08=['Request','GetMailQueue','name','timeout','strategy','User','Agents','online','mailPause'];(function(_0x1dd97c,_0x3061ff){var _0x3ce657=function(_0x536cc3){while(--_0x536cc3){_0x1dd97c['push'](_0x1dd97c['shift']());}};_0x3ce657(++_0x3061ff);}(_0xda08,0xc6));var _0x8da0=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0xda08[_0x580647];return _0x5f0792;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client[_0x8da0('0x0')](_0x8da0('0x1'),{'options':{'raw':![],'attributes':['id',_0x8da0('0x2'),_0x8da0('0x3'),_0x8da0('0x4')],'include':[{'model':_0x8da0('0x5'),'as':_0x8da0('0x6'),'attributes':['id',_0x8da0('0x2'),_0x8da0('0x7'),_0x8da0('0x8')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 27c67da..519e744 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 _0x6812=['../client','create','Request','CreateMailQueueReport','update','DESC','UpdateMailQueueReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6812,0x165));var _0x2681=function(_0x76cb31,_0x5bf128){_0x76cb31=_0x76cb31-0x0;var _0x27cdd1=_0x6812[_0x76cb31];return _0x27cdd1;};'use strict';var client=require(_0x2681('0x0'));exports[_0x2681('0x1')]=function(_0x173d59){return client[_0x2681('0x2')](_0x2681('0x3'),{'body':_0x173d59,'log':_0x2681('0x3')});};exports[_0x2681('0x4')]=function(_0x27046c,_0x44784f){return client['Request']('UpdateMailQueueReport',{'body':_0x44784f,'options':{'where':{'uniqueid':_0x27046c},'order':[['id',_0x2681('0x5')]],'limit':0x1},'log':_0x2681('0x6')});}; \ No newline at end of file +var _0x5327=['UpdateMailQueueReport','DESC','../client','create','Request','CreateMailQueueReport'];(function(_0x1cacd6,_0x18e29d){var _0x13ae71=function(_0x5d89ba){while(--_0x5d89ba){_0x1cacd6['push'](_0x1cacd6['shift']());}};_0x13ae71(++_0x18e29d);}(_0x5327,0x19a));var _0x7532=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5327[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x7532('0x0'));exports[_0x7532('0x1')]=function(_0x2658b7){return client[_0x7532('0x2')](_0x7532('0x3'),{'body':_0x2658b7,'log':_0x7532('0x3')});};exports['update']=function(_0x1f9217,_0x5c411b){return client[_0x7532('0x2')](_0x7532('0x4'),{'body':_0x5c411b,'options':{'where':{'uniqueid':_0x1f9217},'order':[['id',_0x7532('0x5')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 192922c..c29a4aa 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 _0x003b=['addTags','AddTagsToOpenchannelInteraction','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x5b7257,_0x3e79ac){var _0x32bc7a=function(_0x1c794d){while(--_0x1c794d){_0x5b7257['push'](_0x5b7257['shift']());}};_0x32bc7a(++_0x3e79ac);}(_0x003b,0x1dd));var _0xb003=function(_0x4e9007,_0x4d4a5a){_0x4e9007=_0x4e9007-0x0;var _0x1d3025=_0x003b[_0x4e9007];return _0x1d3025;};'use strict';var client=require('../client');exports['update']=function(_0x548638,_0x4bc82b){return client[_0xb003('0x0')](_0xb003('0x1'),{'body':_0x4bc82b,'options':{'where':{'id':_0x548638}},'log':_0xb003('0x2')});};exports[_0xb003('0x3')]=function(_0x2cef60,_0x1a28cc){return client[_0xb003('0x0')](_0xb003('0x4'),{'body':_0x1a28cc,'options':{'where':{'id':_0x2cef60}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xe63a=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe63a,0x91));var _0xae63=function(_0x31bacc,_0x3c0c79){_0x31bacc=_0x31bacc-0x0;var _0x2f8ea7=_0xe63a[_0x31bacc];return _0x2f8ea7;};'use strict';var client=require(_0xae63('0x0'));exports[_0xae63('0x1')]=function(_0x4bad0d,_0x4f1bc1){return client[_0xae63('0x2')](_0xae63('0x3'),{'body':_0x4f1bc1,'options':{'where':{'id':_0x4bad0d}},'log':_0xae63('0x4')});};exports['addTags']=function(_0x2193c3,_0x1f5246){return client['Request'](_0xae63('0x5'),{'body':_0x1f5246,'options':{'where':{'id':_0x2193c3}},'log':_0xae63('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 9c41d86..4f9a8b5 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 _0x4435=['createOpenchannelMessage','../client','create','CreateOpenchannelMessage'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x4435,0x16d));var _0x5443=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x4435[_0x1694f5];return _0x5b4321;};'use strict';var client=require(_0x5443('0x0'));exports[_0x5443('0x1')]=function(_0x3cb06c){return client['Request'](_0x5443('0x2'),{'body':_0x3cb06c,'log':_0x5443('0x3')});}; \ No newline at end of file +var _0x2426=['../client','create','createOpenchannelMessage'];(function(_0x15e92f,_0x30133c){var _0x1f756e=function(_0x52f47a){while(--_0x52f47a){_0x15e92f['push'](_0x15e92f['shift']());}};_0x1f756e(++_0x30133c);}(_0x2426,0x1e0));var _0x6242=function(_0x3eb4c7,_0x4f7b83){_0x3eb4c7=_0x3eb4c7-0x0;var _0x1e3e22=_0x2426[_0x3eb4c7];return _0x1e3e22;};'use strict';var client=require(_0x6242('0x0'));exports[_0x6242('0x1')]=function(_0x22296e){return client['Request']('CreateOpenchannelMessage',{'body':_0x22296e,'log':_0x6242('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 7c601e4..aad528c 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 _0xe53c=['strategy','User','Agents','online','getOpenchannelQueues','Request','GetOpenchannelQueue','timeout'];(function(_0x9489f0,_0x23eb38){var _0x845027=function(_0x57fbd2){while(--_0x57fbd2){_0x9489f0['push'](_0x9489f0['shift']());}};_0x845027(++_0x23eb38);}(_0xe53c,0x14c));var _0xce53=function(_0x5a9397,_0x2e444c){_0x5a9397=_0x5a9397-0x0;var _0x5b89be=_0xe53c[_0x5a9397];return _0x5b89be;};'use strict';var client=require('../client');exports[_0xce53('0x0')]=function(){return function(){return client[_0xce53('0x1')](_0xce53('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xce53('0x3'),_0xce53('0x4')],'include':[{'model':_0xce53('0x5'),'as':_0xce53('0x6'),'attributes':['id','name',_0xce53('0x7'),'openchannelPause']}]},'log':_0xce53('0x0')});};}; \ No newline at end of file +var _0x35f6=['strategy','User','online','openchannelPause','getOpenchannelQueues','GetOpenchannelQueue','name','timeout'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x35f6,0x11c));var _0x635f=function(_0x12722f,_0x4809b6){_0x12722f=_0x12722f-0x0;var _0x1deefb=_0x35f6[_0x12722f];return _0x1deefb;};'use strict';var client=require('../client');exports[_0x635f('0x0')]=function(){return function(){return client['Request'](_0x635f('0x1'),{'options':{'raw':![],'attributes':['id',_0x635f('0x2'),_0x635f('0x3'),_0x635f('0x4')],'include':[{'model':_0x635f('0x5'),'as':'Agents','attributes':['id',_0x635f('0x2'),_0x635f('0x6'),_0x635f('0x7')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 1e95758..add8651 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 _0x25c1=['UpdateOpenchannelQueueReport','../client','create','Request','update'];(function(_0x341b7d,_0x250911){var _0x4517a1=function(_0x3abc5c){while(--_0x3abc5c){_0x341b7d['push'](_0x341b7d['shift']());}};_0x4517a1(++_0x250911);}(_0x25c1,0x8d));var _0x125c=function(_0x3e5fb1,_0x137d57){_0x3e5fb1=_0x3e5fb1-0x0;var _0x13bd6a=_0x25c1[_0x3e5fb1];return _0x13bd6a;};'use strict';var client=require(_0x125c('0x0'));exports[_0x125c('0x1')]=function(_0x42c134){return client[_0x125c('0x2')]('CreateOpenchannelQueueReport',{'body':_0x42c134,'log':'CreateOpenchannelQueueReport'});};exports[_0x125c('0x3')]=function(_0x321c82,_0x116ad2){return client[_0x125c('0x2')](_0x125c('0x4'),{'body':_0x116ad2,'options':{'where':{'uniqueid':_0x321c82},'order':[['id','DESC']],'limit':0x1},'log':_0x125c('0x4')});}; \ No newline at end of file +var _0xaa5e=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','create','Request'];(function(_0x3f4ec8,_0x59d978){var _0x1809f7=function(_0x22a2f8){while(--_0x22a2f8){_0x3f4ec8['push'](_0x3f4ec8['shift']());}};_0x1809f7(++_0x59d978);}(_0xaa5e,0xa5));var _0xeaa5=function(_0x35a95f,_0x327960){_0x35a95f=_0x35a95f-0x0;var _0x4bb671=_0xaa5e[_0x35a95f];return _0x4bb671;};'use strict';var client=require(_0xeaa5('0x0'));exports[_0xeaa5('0x1')]=function(_0x5782de){return client[_0xeaa5('0x2')](_0xeaa5('0x3'),{'body':_0x5782de,'log':_0xeaa5('0x3')});};exports[_0xeaa5('0x4')]=function(_0x131fc3,_0x5a1aca){return client[_0xeaa5('0x2')](_0xeaa5('0x5'),{'body':_0x5a1aca,'options':{'where':{'uniqueid':_0x131fc3},'order':[['id',_0xeaa5('0x6')]],'limit':0x1},'log':_0xeaa5('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index c79eff3..50ad39d 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 _0xf483=['addTags','addTagsToSmsInteraction','update','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x353ab6,_0x2d9b5a){var _0x2991aa=function(_0x3b53c1){while(--_0x3b53c1){_0x353ab6['push'](_0x353ab6['shift']());}};_0x2991aa(++_0x2d9b5a);}(_0xf483,0xf2));var _0x3f48=function(_0x536a34,_0x2f63ee){_0x536a34=_0x536a34-0x0;var _0x48aaf6=_0xf483[_0x536a34];return _0x48aaf6;};'use strict';var client=require('../client');exports[_0x3f48('0x0')]=function(_0x4fa0f8,_0x37d0f3){return client[_0x3f48('0x1')](_0x3f48('0x2'),{'body':_0x37d0f3,'options':{'where':{'id':_0x4fa0f8}},'log':_0x3f48('0x3')});};exports[_0x3f48('0x4')]=function(_0x312d9c,_0x5deb61){return client['Request']('AddTagsToSmsInteraction',{'body':_0x5deb61,'options':{'where':{'id':_0x312d9c}},'log':_0x3f48('0x5')});}; \ No newline at end of file +var _0x777f=['UpdateSmsInteraction','updateSmsInteraction','addTags','../client','update','Request'];(function(_0x1d39f6,_0x146f4a){var _0x3dbd7a=function(_0x4486f2){while(--_0x4486f2){_0x1d39f6['push'](_0x1d39f6['shift']());}};_0x3dbd7a(++_0x146f4a);}(_0x777f,0x9f));var _0xf777=function(_0xadde88,_0x58ad47){_0xadde88=_0xadde88-0x0;var _0x3b8eb6=_0x777f[_0xadde88];return _0x3b8eb6;};'use strict';var client=require(_0xf777('0x0'));exports[_0xf777('0x1')]=function(_0x41dd3a,_0x37721a){return client[_0xf777('0x2')](_0xf777('0x3'),{'body':_0x37721a,'options':{'where':{'id':_0x41dd3a}},'log':_0xf777('0x4')});};exports[_0xf777('0x5')]=function(_0x508470,_0x3caeaa){return client[_0xf777('0x2')]('AddTagsToSmsInteraction',{'body':_0x3caeaa,'options':{'where':{'id':_0x508470}},'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 4e13fb7..ad50d7a 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 _0x3d3e=['create','Request','CreateSmsMessage','createSmsMessage','../client'];(function(_0x28c6cf,_0x31f179){var _0x2c72e4=function(_0xee20e){while(--_0xee20e){_0x28c6cf['push'](_0x28c6cf['shift']());}};_0x2c72e4(++_0x31f179);}(_0x3d3e,0x18a));var _0xe3d3=function(_0x4e0d7c,_0x8129fd){_0x4e0d7c=_0x4e0d7c-0x0;var _0x1a2f6d=_0x3d3e[_0x4e0d7c];return _0x1a2f6d;};'use strict';var client=require(_0xe3d3('0x0'));exports[_0xe3d3('0x1')]=function(_0x160c6d){return client[_0xe3d3('0x2')](_0xe3d3('0x3'),{'body':_0x160c6d,'log':_0xe3d3('0x4')});}; \ No newline at end of file +var _0xa9b9=['Request','CreateSmsMessage','../client'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa9b9,0x1dc));var _0x9a9b=function(_0xdeac17,_0x19ad66){_0xdeac17=_0xdeac17-0x0;var _0x33aabd=_0xa9b9[_0xdeac17];return _0x33aabd;};'use strict';var client=require(_0x9a9b('0x0'));exports['create']=function(_0x1323fd){return client[_0x9a9b('0x1')](_0x9a9b('0x2'),{'body':_0x1323fd,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index c15f716..e43167b 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 _0x9c44=['Request','GetSmsQueue','name','timeout','strategy','User','online','getSmsQueues'];(function(_0x3714d4,_0x303533){var _0x47fad9=function(_0x575403){while(--_0x575403){_0x3714d4['push'](_0x3714d4['shift']());}};_0x47fad9(++_0x303533);}(_0x9c44,0x178));var _0x49c4=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x9c44[_0x4f9b18];return _0x29f20c;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'attributes':['id',_0x49c4('0x2'),_0x49c4('0x3'),_0x49c4('0x4')],'include':[{'model':_0x49c4('0x5'),'as':'Agents','attributes':['id','name',_0x49c4('0x6'),'smsPause']}]},'log':_0x49c4('0x7')});};}; \ No newline at end of file +var _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0x2b053a,_0x2ba5af){var _0x12d7c1=function(_0x105f22){while(--_0x105f22){_0x2b053a['push'](_0x2b053a['shift']());}};_0x12d7c1(++_0x2ba5af);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0xcb91[_0x243217];return _0x478029;};'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 diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index f8443c1..0f12384 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x3b37e0,_0x542705){var _0x1cb6b6=function(_0x4bc3bd){while(--_0x4bc3bd){_0x3b37e0['push'](_0x3b37e0['shift']());}};_0x1cb6b6(++_0x542705);}(_0x9c44,0x178));var _0x49c4=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x9c44[_0x3d42d8];return _0x27fc41;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file +var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x687c66,_0x5d9f47){var _0x5ac8a1=function(_0x44bac5){while(--_0x44bac5){_0x687c66['push'](_0x687c66['shift']());}};_0x5ac8a1(++_0x5d9f47);}(_0x55ca,0x126));var _0xa55c=function(_0x2b70f8,_0x361789){_0x2b70f8=_0x2b70f8-0x0;var _0x2f741e=_0x55ca[_0x2b70f8];return _0x2f741e;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 585ec28..663540c 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(_0x541765,_0xfb2d04){var _0x33372c=function(_0x10a197){while(--_0x10a197){_0x541765['push'](_0x541765['shift']());}};_0x33372c(++_0xfb2d04);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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(_0x55a4af,_0x3d1a53){var _0x308f1c=function(_0x1a6cd8){while(--_0x1a6cd8){_0x55a4af['push'](_0x55a4af['shift']());}};_0x308f1c(++_0x3d1a53);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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 57798ab..edb4049 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 _0x49fe=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','Request'];(function(_0x4cef8e,_0x1d06e2){var _0x28fc91=function(_0x4159ec){while(--_0x4159ec){_0x4cef8e['push'](_0x4cef8e['shift']());}};_0x28fc91(++_0x1d06e2);}(_0x49fe,0x75));var _0xe49f=function(_0x11ac83,_0x10a2c5){_0x11ac83=_0x11ac83-0x0;var _0x1911e1=_0x49fe[_0x11ac83];return _0x1911e1;};'use strict';var client=require(_0xe49f('0x0'));exports['update']=function(_0x540832,_0x556c1d){return client[_0xe49f('0x1')](_0xe49f('0x2'),{'body':_0x556c1d,'options':{'where':{'id':_0x540832}},'log':_0xe49f('0x3')});};exports[_0xe49f('0x4')]=function(_0x1cac40,_0x2db0ec){return client[_0xe49f('0x1')](_0xe49f('0x5'),{'body':_0x2db0ec,'options':{'where':{'id':_0x1cac40}},'log':_0xe49f('0x6')});}; \ No newline at end of file +var _0xe7de=['updateWhatsappInteraction','addTags','Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','UpdateWhatsappInteraction'];(function(_0x400b6c,_0x4a6139){var _0x4c4e3e=function(_0x191233){while(--_0x191233){_0x400b6c['push'](_0x400b6c['shift']());}};_0x4c4e3e(++_0x4a6139);}(_0xe7de,0x165));var _0xee7d=function(_0xe679a5,_0x525f0d){_0xe679a5=_0xe679a5-0x0;var _0x34bff7=_0xe7de[_0xe679a5];return _0x34bff7;};'use strict';var client=require(_0xee7d('0x0'));exports[_0xee7d('0x1')]=function(_0x2f1cd7,_0x58d2f9){return client['Request'](_0xee7d('0x2'),{'body':_0x58d2f9,'options':{'where':{'id':_0x2f1cd7}},'log':_0xee7d('0x3')});};exports[_0xee7d('0x4')]=function(_0x3f1c6d,_0x3afa35){return client[_0xee7d('0x5')](_0xee7d('0x6'),{'body':_0x3afa35,'options':{'where':{'id':_0x3f1c6d}},'log':_0xee7d('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 6a580ce..7083749 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 _0x81ae=['../client','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x2a8001,_0x4f309e){var _0x3388bf=function(_0x57d2c2){while(--_0x57d2c2){_0x2a8001['push'](_0x2a8001['shift']());}};_0x3388bf(++_0x4f309e);}(_0x81ae,0x1dd));var _0xe81a=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x81ae[_0xfae23b];return _0x200640;};'use strict';var client=require(_0xe81a('0x0'));exports['create']=function(_0x220e22){return client['Request'](_0xe81a('0x1'),{'body':_0x220e22,'log':_0xe81a('0x2')});}; \ No newline at end of file +var _0x268d=['createWhatsappMessage','../client','create','Request','CreateWhatsappMessage'];(function(_0x446e1d,_0x150e79){var _0xffd5fd=function(_0x1ff4a6){while(--_0x1ff4a6){_0x446e1d['push'](_0x446e1d['shift']());}};_0xffd5fd(++_0x150e79);}(_0x268d,0x119));var _0xd268=function(_0x3ae35d,_0x534860){_0x3ae35d=_0x3ae35d-0x0;var _0x7b995=_0x268d[_0x3ae35d];return _0x7b995;};'use strict';var client=require(_0xd268('0x0'));exports[_0xd268('0x1')]=function(_0x50c2a1){return client[_0xd268('0x2')](_0xd268('0x3'),{'body':_0x50c2a1,'log':_0xd268('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 31e8d2a..931db9f 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 _0x693d=['strategy','Agents','online','../client','getWhatsappQueues','Request','name','timeout'];(function(_0x11a55c,_0x4eced9){var _0x26c390=function(_0x5b0662){while(--_0x5b0662){_0x11a55c['push'](_0x11a55c['shift']());}};_0x26c390(++_0x4eced9);}(_0x693d,0xbb));var _0xd693=function(_0x585bae,_0x2fb782){_0x585bae=_0x585bae-0x0;var _0x1d45bf=_0x693d[_0x585bae];return _0x1d45bf;};'use strict';var client=require(_0xd693('0x0'));exports[_0xd693('0x1')]=function(){return function(){return client[_0xd693('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xd693('0x3'),_0xd693('0x4'),_0xd693('0x5')],'include':[{'model':'User','as':_0xd693('0x6'),'attributes':['id',_0xd693('0x3'),_0xd693('0x7'),'whatsappPause']}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0xdf13=['Agents','online','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','User'];(function(_0x2b9828,_0x50c0a6){var _0x381948=function(_0x367698){while(--_0x367698){_0x2b9828['push'](_0x2b9828['shift']());}};_0x381948(++_0x50c0a6);}(_0xdf13,0x111));var _0x3df1=function(_0x49258d,_0x5bcf0e){_0x49258d=_0x49258d-0x0;var _0x2a9044=_0xdf13[_0x49258d];return _0x2a9044;};'use strict';var client=require(_0x3df1('0x0'));exports[_0x3df1('0x1')]=function(){return function(){return client[_0x3df1('0x2')](_0x3df1('0x3'),{'options':{'raw':![],'attributes':['id',_0x3df1('0x4'),_0x3df1('0x5'),'strategy'],'include':[{'model':_0x3df1('0x6'),'as':_0x3df1('0x7'),'attributes':['id',_0x3df1('0x4'),_0x3df1('0x8'),_0x3df1('0x9')]}]},'log':_0x3df1('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 44c21a8..040c810 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 _0x440b=['update','Request','UpdateWhatsappQueueReport','DESC','../client','create','CreateWhatsappQueueReport'];(function(_0x37ac04,_0x599c7c){var _0x35f374=function(_0xb63ae5){while(--_0xb63ae5){_0x37ac04['push'](_0x37ac04['shift']());}};_0x35f374(++_0x599c7c);}(_0x440b,0xdd));var _0xb440=function(_0x564eec,_0x2174aa){_0x564eec=_0x564eec-0x0;var _0xb25d75=_0x440b[_0x564eec];return _0xb25d75;};'use strict';var client=require(_0xb440('0x0'));exports[_0xb440('0x1')]=function(_0x105eaa){return client['Request'](_0xb440('0x2'),{'body':_0x105eaa,'log':'CreateWhatsappQueueReport'});};exports[_0xb440('0x3')]=function(_0x3ddcc4,_0x8870b7){return client[_0xb440('0x4')](_0xb440('0x5'),{'body':_0x8870b7,'options':{'where':{'uniqueid':_0x3ddcc4},'order':[['id',_0xb440('0x6')]],'limit':0x1},'log':_0xb440('0x5')});}; \ No newline at end of file +var _0x0b90=['../client','create','Request','CreateWhatsappQueueReport','update'];(function(_0x2bfd4f,_0x1bbf2c){var _0x341849=function(_0x4c246e){while(--_0x4c246e){_0x2bfd4f['push'](_0x2bfd4f['shift']());}};_0x341849(++_0x1bbf2c);}(_0x0b90,0xb4));var _0x00b9=function(_0x289355,_0x1e6d3c){_0x289355=_0x289355-0x0;var _0x1cbefc=_0x0b90[_0x289355];return _0x1cbefc;};'use strict';var client=require(_0x00b9('0x0'));exports[_0x00b9('0x1')]=function(_0x3ea37d){return client[_0x00b9('0x2')](_0x00b9('0x3'),{'body':_0x3ea37d,'log':'CreateWhatsappQueueReport'});};exports[_0x00b9('0x4')]=function(_0x108db9,_0x2a9a03){return client[_0x00b9('0x2')]('UpdateWhatsappQueueReport',{'body':_0x2a9a03,'options':{'where':{'uniqueid':_0x108db9},'order':[['id','DESC']],'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 cc99400..e0322d1 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 _0xc153=['info','format','[%s][AGENT][NAME:%s][STATUS:%s]','toLowerCase','consequence','validate','length','error','map','message','join','stop','find','agents','timeout','createQueue','atimeout','channel','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','[%s][AGENT]\x20ROUTING\x20END','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','name','[%s][QUEUE]\x20%s','stack','lodash','util','seq-queue','../../../../config/logger','routing','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc153,0x191));var _0x3c15=function(_0xc0ca57,_0x2b8778){_0xc0ca57=_0xc0ca57-0x0;var _0x3954b0=_0xc153[_0xc0ca57];return _0x3954b0;};'use strict';var schema=require('validate');var _=require(_0x3c15('0x0'));var util=require(_0x3c15('0x1'));var seqqueue=require(_0x3c15('0x2'));var logger=require(_0x3c15('0x3'))(_0x3c15('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0x3c15('0x5')},'timeout':{'type':_0x3c15('0x6'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x349438,_0x27ae0f,_0x42a714){return logger[_0x3c15('0x7')](util[_0x3c15('0x8')](_0x3c15('0x9'),_0x349438,_0x27ae0f['name'],_0x42a714));}function handleFindAgent(_0x2285ab){return function(_0x41a24e){return _0x41a24e['name'][_0x3c15('0xa')]()===_0x2285ab['toLowerCase']();};}exports[_0x3c15('0xb')]=function(_0x266840,_0x37d8de,_0xb7bdcd,_0x457f51){return function(_0x27f8b1){try{var _0x2e5d01={'name':_0x37d8de[0x0],'timeout':_0x37d8de[0x1]};var _0x17323d=queue[_0x3c15('0xc')](_0x2e5d01,{'typecast':!![]});if(_0x17323d[_0x3c15('0xd')]){logger[_0x3c15('0xe')]('[%s][AGENT]\x20%s',_0x266840,_[_0x3c15('0xf')](_0x17323d,_0x3c15('0x10'))[_0x3c15('0x11')](',\x20'));_0x27f8b1[_0x3c15('0x12')]();}else{var _0x5b981b=_[_0x3c15('0x13')](_0xb7bdcd[_0x3c15('0x14')],handleFindAgent(_0x2e5d01['name']));if(_0x5b981b){var _0x2164df=(_0x2e5d01[_0x3c15('0x15')]||0xa)*0x3e8;var _0x1900b5,_0xdd88f4;var _0x2208ad=seqqueue[_0x3c15('0x16')](_0x2164df);_0x2208ad['id']=_0x266840;_0x2208ad[_0x3c15('0x17')]=_0x2164df;_0x2208ad['channel']=_0x457f51[_0x3c15('0x18')];writeLog(_0x266840,_0x5b981b,util[_0x3c15('0x8')]('START:%s',_0x2164df));_0xb7bdcd[_0x3c15('0x19')][_0x266840]['on'](_0x3c15('0x1a'),function(){logger['info'](_0x3c15('0x1b'),_0x266840);clearTimeout(_0xdd88f4);_0xdd88f4=undefined;_0x2208ad['close']();if(_0xb7bdcd[_0x3c15('0x19')][_0x266840]){delete _0xb7bdcd[_0x3c15('0x19')][_0x266840];}_0x27f8b1['stop']();});_0xb7bdcd[_0x3c15('0x19')][_0x266840]['on']('complete',function(){if(_0xb7bdcd[_0x3c15('0x19')][_0x266840]){delete _0xb7bdcd[_0x3c15('0x19')][_0x266840];}});_0xdd88f4=setTimeout(function(){logger[_0x3c15('0x7')](_0x3c15('0x1c'),_0x266840);clearTimeout(_0xdd88f4);_0x2208ad['close']();_0x27f8b1[_0x3c15('0x1d')]();},_0x2164df);strategy['agent'](_0x2208ad,_0x5b981b,_0xb7bdcd,_0x457f51);}else{logger[_0x3c15('0xe')](_0x3c15('0x1e'),_0x266840,_0x2e5d01[_0x3c15('0x1f')]);_0x27f8b1[_0x3c15('0x12')]();}}}catch(_0x59dc94){console['log'](_0x59dc94);logger[_0x3c15('0xe')](_0x3c15('0x20'),_0x266840,_0x59dc94[_0x3c15('0x21')]);_0x27f8b1[_0x3c15('0x12')]();}};}; \ No newline at end of file +var _0xf09d=['length','error','map','message','join','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','close','complete','[%s][AGENT]\x20ROUTING\x20END','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','lodash','seq-queue','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase'];(function(_0x5b924a,_0x557cdf){var _0x47286a=function(_0x15d22d){while(--_0x15d22d){_0x5b924a['push'](_0x5b924a['shift']());}};_0x47286a(++_0x557cdf);}(_0xf09d,0x168));var _0xdf09=function(_0x558010,_0x4a71e6){_0x558010=_0x558010-0x0;var _0x3b9dba=_0xf09d[_0x558010];return _0x3b9dba;};'use strict';var schema=require(_0xdf09('0x0'));var _=require(_0xdf09('0x1'));var util=require('util');var seqqueue=require(_0xdf09('0x2'));var logger=require(_0xdf09('0x3'))(_0xdf09('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0xdf09('0x5'),'required':!![],'message':_0xdf09('0x6')},'timeout':{'type':_0xdf09('0x7'),'message':_0xdf09('0x8')}});function writeLog(_0x55e4f1,_0x52c66e,_0x54dcab){return logger[_0xdf09('0x9')](util[_0xdf09('0xa')](_0xdf09('0xb'),_0x55e4f1,_0x52c66e[_0xdf09('0xc')],_0x54dcab));}function handleFindAgent(_0x33335a){return function(_0x5feb97){return _0x5feb97[_0xdf09('0xc')][_0xdf09('0xd')]()===_0x33335a[_0xdf09('0xd')]();};}exports['consequence']=function(_0x1f71de,_0x409a03,_0x9361c0,_0x22fa00){return function(_0x540c07){try{var _0x4ab349={'name':_0x409a03[0x0],'timeout':_0x409a03[0x1]};var _0x1a12c2=queue['validate'](_0x4ab349,{'typecast':!![]});if(_0x1a12c2[_0xdf09('0xe')]){logger[_0xdf09('0xf')]('[%s][AGENT]\x20%s',_0x1f71de,_[_0xdf09('0x10')](_0x1a12c2,_0xdf09('0x11'))[_0xdf09('0x12')](',\x20'));_0x540c07[_0xdf09('0x13')]();}else{var _0xe69ed4=_[_0xdf09('0x14')](_0x9361c0[_0xdf09('0x15')],handleFindAgent(_0x4ab349['name']));if(_0xe69ed4){var _0x1c73ec=(_0x4ab349[_0xdf09('0x16')]||0xa)*0x3e8;var _0x52424e,_0x1a16a4;var _0x4e7990=seqqueue[_0xdf09('0x17')](_0x1c73ec);_0x4e7990['id']=_0x1f71de;_0x4e7990[_0xdf09('0x18')]=_0x1c73ec;_0x4e7990['channel']=_0x22fa00[_0xdf09('0x19')];writeLog(_0x1f71de,_0xe69ed4,util['format'](_0xdf09('0x1a'),_0x1c73ec));_0x9361c0[_0xdf09('0x1b')][_0x1f71de]['on']('end',function(){logger[_0xdf09('0x9')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x1f71de);clearTimeout(_0x1a16a4);_0x1a16a4=undefined;_0x4e7990[_0xdf09('0x1c')]();if(_0x9361c0[_0xdf09('0x1b')][_0x1f71de]){delete _0x9361c0[_0xdf09('0x1b')][_0x1f71de];}_0x540c07[_0xdf09('0x13')]();});_0x9361c0['rules'][_0x1f71de]['on'](_0xdf09('0x1d'),function(){if(_0x9361c0[_0xdf09('0x1b')][_0x1f71de]){delete _0x9361c0[_0xdf09('0x1b')][_0x1f71de];}});_0x1a16a4=setTimeout(function(){logger[_0xdf09('0x9')](_0xdf09('0x1e'),_0x1f71de);clearTimeout(_0x1a16a4);_0x4e7990[_0xdf09('0x1c')]();_0x540c07['next']();},_0x1c73ec);strategy['agent'](_0x4e7990,_0xe69ed4,_0x9361c0,_0x22fa00);}else{logger[_0xdf09('0xf')](_0xdf09('0x1f'),_0x1f71de,_0x4ab349[_0xdf09('0xc')]);_0x540c07[_0xdf09('0x13')]();}}}catch(_0x7f7f6e){console['log'](_0x7f7f6e);logger['error'](_0xdf09('0x20'),_0x1f71de,_0x7f7f6e[_0xdf09('0x21')]);_0x540c07[_0xdf09('0x13')]();}};}; \ 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 b4db928..bd9f125 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 _0x62af=['[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','out','sms','whatsapp','phone','channel','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','$LATEST','toString','message','next','amazonlex','providerName','stringify','dialogState','Failed','catch','lodash','moment','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x62af,0x1c5));var _0xf62a=function(_0xa75db,_0x97eeb8){_0xa75db=_0xa75db-0x0;var _0x988497=_0x62af[_0xa75db];return _0x988497;};'use strict';var _=require(_0xf62a('0x0'));var moment=require(_0xf62a('0x1'));var AWS=require(_0xf62a('0x2'));var utils=require('./utils');var logger=require(_0xf62a('0x3'))(_0xf62a('0x4'));var rpc={'chatMessage':require(_0xf62a('0x5')),'openchannelMessage':require(_0xf62a('0x6')),'mailMessage':require(_0xf62a('0x7')),'smsMessage':require(_0xf62a('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xf62a('0x9'))};exports[_0xf62a('0xa')]=function(_0x5edc1e,_0x491d6b){return function(_0x4efd){try{if(!_[_0xf62a('0xb')](this[_0xf62a('0xc')][_0xf62a('0xd')])){logger[_0xf62a('0xe')](_0xf62a('0xf'),_0x5edc1e,_0xf62a('0x10'));return _0x4efd['next']();}var _0x5eb8d4={'ContactId':this[_0xf62a('0x11')]['id'],'sentAt':moment()[_0xf62a('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xf62a('0x13')};if(this['channel']===_0xf62a('0x14')||this['channel']===_0xf62a('0x15')){_0x5eb8d4['phone']=this[_0xf62a('0xc')][_0xf62a('0x16')];}var _0x44a05=this[_0xf62a('0x17')];if(_0x44a05===_0xf62a('0x18')){_0x5eb8d4[_0xf62a('0x19')]=this['account']['id'];}else{_0x5eb8d4[_[_0xf62a('0x1a')](_0x44a05)+_0xf62a('0x1b')]=this[_0xf62a('0x1c')]['id'];}_0x5eb8d4[_[_0xf62a('0x1a')](_0x44a05)+_0xf62a('0x1d')]=this['interaction']['id'];if(this[_0xf62a('0xc')][_0xf62a('0x1e')]){var _0x5a1d64=_0x491d6b[0x4];if(!_[_0xf62a('0x1f')](_0x5a1d64)){_0x5eb8d4[_0xf62a('0x20')]=utils[_0xf62a('0x21')](_0x5a1d64,this);return rpc[_0x44a05+_0xf62a('0x22')][_0xf62a('0x23')](_0x5eb8d4)['then'](function(_0x540ee8){logger[_0xf62a('0xe')](_0xf62a('0xf'),_0x5edc1e,_0x5eb8d4[_0xf62a('0x20')]);})['catch'](function(_0x5ecfea){logger[_0xf62a('0x24')](_0xf62a('0xf'),_0x5edc1e,JSON['stringify'](_0x5ecfea));})[_0xf62a('0x25')](function(){logger[_0xf62a('0xe')](_0xf62a('0x26'),_0x5edc1e);_0x4efd['stop']();});}else{logger[_0xf62a('0xe')](_0xf62a('0x27'),_0x5edc1e);_0x4efd[_0xf62a('0x28')]();}}else{var _0x6603ca=this;var _0x5226e6=new AWS[(_0xf62a('0x29'))]({'accessKeyId':_0x491d6b[0x0],'secretAccessKey':_0x491d6b[0x1],'region':_0x491d6b[0x2]});var _0x9abf05={'botAlias':_0xf62a('0x2a'),'botName':_0x491d6b[0x3],'inputText':this['message'][_0xf62a('0x20')],'userId':this[_0xf62a('0x17')]+':'+this[_0xf62a('0xc')]['id'][_0xf62a('0x2b')]()};_0x5226e6['postText'](_0x9abf05,function(_0x365a03,_0x3aabee){if(_0x365a03){logger[_0xf62a('0x24')](_0xf62a('0xf'),_0x5edc1e,_0x365a03[_0xf62a('0x2c')]);_0x4efd[_0xf62a('0x2d')]();}else if(_0x3aabee&&_0x3aabee[_0xf62a('0x2c')]){_0x6603ca[_0xf62a('0x20')][_0xf62a('0x2e')]=_0x3aabee;_0x5eb8d4[_0xf62a('0x20')]=_0x3aabee[_0xf62a('0x2c')];_0x5eb8d4[_0xf62a('0x2f')]=_0xf62a('0x2e');_0x5eb8d4['providerResponse']=JSON[_0xf62a('0x30')](_0x3aabee);return rpc[_0x44a05+_0xf62a('0x22')][_0xf62a('0x23')](_0x5eb8d4)['then'](function(_0x12a031){logger[_0xf62a('0xe')](_0xf62a('0xf'),_0x5edc1e,_0x5eb8d4[_0xf62a('0x20')]);if(_0x3aabee[_0xf62a('0x31')]==_0xf62a('0x32')){_0x4efd['next']();}else{_0x4efd['stop']();}})[_0xf62a('0x33')](function(_0x1816a7){logger[_0xf62a('0x24')](_0xf62a('0xf'),_0x5edc1e,JSON[_0xf62a('0x30')](_0x1816a7));_0x4efd[_0xf62a('0x2d')]();});}else{_0x4efd['next']();}});}}catch(_0x537ba9){logger[_0xf62a('0x24')](_0xf62a('0xf'),_0x5edc1e,JSON[_0xf62a('0x30')](_0x537ba9));_0x4efd[_0xf62a('0x28')]();}};}; \ No newline at end of file +var _0x9d3d=['YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','ChatWebsiteId','upperFirst','AccountId','InteractionId','created','isEmpty','body','Message','create','info','catch','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','$LATEST','message','toString','error','providerName','amazonlex','providerResponse','stringify','Failed','lodash','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format'];(function(_0x12fee5,_0x25b586){var _0x17c36a=function(_0xd212fc){while(--_0xd212fc){_0x12fee5['push'](_0x12fee5['shift']());}};_0x17c36a(++_0x25b586);}(_0x9d3d,0x104));var _0xd9d3=function(_0x3aa398,_0x37f0b2){_0x3aa398=_0x3aa398-0x0;var _0x2fa1dd=_0x9d3d[_0x3aa398];return _0x2fa1dd;};'use strict';var _=require(_0xd9d3('0x0'));var moment=require('moment');var AWS=require(_0xd9d3('0x1'));var utils=require('./utils');var logger=require(_0xd9d3('0x2'))(_0xd9d3('0x3'));var rpc={'chatMessage':require(_0xd9d3('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xd9d3('0x5')),'smsMessage':require(_0xd9d3('0x6')),'faxMessage':require(_0xd9d3('0x7')),'whatsappMessage':require(_0xd9d3('0x8'))};exports['consequence']=function(_0x4d64c7,_0x329d65){return function(_0x2d5ab0){try{if(!_[_0xd9d3('0x9')](this[_0xd9d3('0xa')][_0xd9d3('0xb')])){logger['info'](_0xd9d3('0xc'),_0x4d64c7,_0xd9d3('0xd'));return _0x2d5ab0[_0xd9d3('0xe')]();}var _0x2a6a2a={'ContactId':this['contact']['id'],'sentAt':moment()[_0xd9d3('0xf')](_0xd9d3('0x10')),'direction':'out'};if(this[_0xd9d3('0x11')]===_0xd9d3('0x12')||this[_0xd9d3('0x11')]===_0xd9d3('0x13')){_0x2a6a2a[_0xd9d3('0x14')]=this['interaction'][_0xd9d3('0x14')];}var _0x547dfe=this[_0xd9d3('0x11')];if(_0x547dfe==='chat'){_0x2a6a2a[_0xd9d3('0x15')]=this['account']['id'];}else{_0x2a6a2a[_[_0xd9d3('0x16')](_0x547dfe)+_0xd9d3('0x17')]=this['account']['id'];}_0x2a6a2a[_[_0xd9d3('0x16')](_0x547dfe)+_0xd9d3('0x18')]=this[_0xd9d3('0xa')]['id'];if(this[_0xd9d3('0xa')][_0xd9d3('0x19')]){var _0x123054=_0x329d65[0x4];if(!_[_0xd9d3('0x1a')](_0x123054)){_0x2a6a2a[_0xd9d3('0x1b')]=utils['getMustacheRender'](_0x123054,this);return rpc[_0x547dfe+_0xd9d3('0x1c')][_0xd9d3('0x1d')](_0x2a6a2a)['then'](function(_0x1f2705){logger[_0xd9d3('0x1e')](_0xd9d3('0xc'),_0x4d64c7,_0x2a6a2a[_0xd9d3('0x1b')]);})[_0xd9d3('0x1f')](function(_0x1d9e46){logger['error'](_0xd9d3('0xc'),_0x4d64c7,JSON['stringify'](_0x1d9e46));})[_0xd9d3('0x20')](function(){logger[_0xd9d3('0x1e')](_0xd9d3('0x21'),_0x4d64c7);_0x2d5ab0['stop']();});}else{logger[_0xd9d3('0x1e')](_0xd9d3('0x22'),_0x4d64c7);_0x2d5ab0[_0xd9d3('0x23')]();}}else{var _0x4df9af=this;var _0x437f1e=new AWS[(_0xd9d3('0x24'))]({'accessKeyId':_0x329d65[0x0],'secretAccessKey':_0x329d65[0x1],'region':_0x329d65[0x2]});var _0x3640cf={'botAlias':_0xd9d3('0x25'),'botName':_0x329d65[0x3],'inputText':this[_0xd9d3('0x26')][_0xd9d3('0x1b')],'userId':this[_0xd9d3('0x11')]+':'+this['interaction']['id'][_0xd9d3('0x27')]()};_0x437f1e['postText'](_0x3640cf,function(_0x33e5d2,_0x1ef9ef){if(_0x33e5d2){logger[_0xd9d3('0x28')]('[%s][AMAZONLEX]\x20%s',_0x4d64c7,_0x33e5d2[_0xd9d3('0x26')]);_0x2d5ab0['next']();}else if(_0x1ef9ef&&_0x1ef9ef['message']){_0x4df9af[_0xd9d3('0x1b')]['amazonlex']=_0x1ef9ef;_0x2a6a2a[_0xd9d3('0x1b')]=_0x1ef9ef[_0xd9d3('0x26')];_0x2a6a2a[_0xd9d3('0x29')]=_0xd9d3('0x2a');_0x2a6a2a[_0xd9d3('0x2b')]=JSON[_0xd9d3('0x2c')](_0x1ef9ef);return rpc[_0x547dfe+_0xd9d3('0x1c')][_0xd9d3('0x1d')](_0x2a6a2a)['then'](function(_0x2ddbb4){logger['info']('[%s][AMAZONLEX]\x20%s',_0x4d64c7,_0x2a6a2a[_0xd9d3('0x1b')]);if(_0x1ef9ef['dialogState']==_0xd9d3('0x2d')){_0x2d5ab0[_0xd9d3('0xe')]();}else{_0x2d5ab0[_0xd9d3('0x23')]();}})['catch'](function(_0xe2998f){logger['error'](_0xd9d3('0xc'),_0x4d64c7,JSON[_0xd9d3('0x2c')](_0xe2998f));_0x2d5ab0['next']();});}else{_0x2d5ab0['next']();}});}}catch(_0x3d6217){logger[_0xd9d3('0x28')](_0xd9d3('0xc'),_0x4d64c7,JSON[_0xd9d3('0x2c')](_0x3d6217));_0x2d5ab0[_0xd9d3('0x23')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 2be676b..ce1a3e5 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 _0x5e53=['update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','Interaction','stop','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','info','[%s][AUTOREPLY]\x20%s','interaction','created','Autoreply\x20already\x20sent','next','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','AccountId','upperFirst','Message','service','Smtp','host','port','secure','auth','user','inReplyTo','html','','','auto-replied','All','sendMailMessage','then','messageId','create','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','resolve'];(function(_0x4e1e19,_0x565eca){var _0x42723e=function(_0x35ef78){while(--_0x35ef78){_0x4e1e19['push'](_0x4e1e19['shift']());}};_0x42723e(++_0x565eca);}(_0x5e53,0x94));var _0x35e5=function(_0x3f7526,_0x3fa99c){_0x3f7526=_0x3f7526-0x0;var _0x5ecc43=_0x5e53[_0x3f7526];return _0x5ecc43;};'use strict';var _=require('lodash');var moment=require(_0x35e5('0x0'));var utils=require('./utils');var logger=require(_0x35e5('0x1'))(_0x35e5('0x2'));var rpc={'chatMessage':require(_0x35e5('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x35e5('0x4')),'smsMessage':require(_0x35e5('0x5')),'faxMessage':require(_0x35e5('0x6')),'whatsappMessage':require(_0x35e5('0x7')),'chatInteraction':require(_0x35e5('0x8')),'openchannelInteraction':require(_0x35e5('0x9')),'mailInteraction':require(_0x35e5('0xa')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x35e5('0xb'))};var mailRpc=require(_0x35e5('0xc'));exports[_0x35e5('0xd')]=function(_0x187b1c,_0x3f156b,_0x4df68b,_0x1c9d30){return function(_0x2ed23e){try{var _0x148d98=this[_0x35e5('0xe')];if(_0x148d98===_0x35e5('0xf')&&_0x1c9d30[_0x35e5('0x10')]['isAutoreply']){logger[_0x35e5('0x11')](_0x35e5('0x12'),_0x187b1c,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x2ed23e['next']();}if(_0x3f156b[0x0]==='1'&&(_['isNil'](this[_0x35e5('0x13')][_0x35e5('0x14')])||!this[_0x35e5('0x13')][_0x35e5('0x14')])){logger['info']('[%s][AUTOREPLY]\x20%s',_0x187b1c,_0x35e5('0x15'));return _0x2ed23e[_0x35e5('0x16')]();}if(_0x3f156b[0x0]==='2'&&this[_0x35e5('0x13')][_0x35e5('0x17')]){logger[_0x35e5('0x11')](_0x35e5('0x18'),_0x187b1c,_0x35e5('0x19'));return _0x2ed23e[_0x35e5('0x16')]();}var _0x2dce1d={'ContactId':this[_0x35e5('0x1a')]['id'],'sentAt':moment()[_0x35e5('0x1b')](_0x35e5('0x1c')),'direction':_0x35e5('0x1d')};if(this['channel']==='mail'){_0x2dce1d[_0x35e5('0x10')]=utils[_0x35e5('0x1e')](_0x3f156b[0x2],this);}else{_0x2dce1d['body']=utils[_0x35e5('0x1e')](_0x3f156b[0x1],this);}if(this[_0x35e5('0x1f')]){_0x2dce1d['to']=this['message']['from']||'';if(this[_0x35e5('0xe')]===_0x35e5('0xf')&&_0x3f156b[0x1]==='1'){_0x2dce1d['cc']=this[_0x35e5('0x1f')]['cc']||'';}_0x2dce1d['from']=this['message']['to']||'';_0x2dce1d[_0x35e5('0x20')]=this[_0x35e5('0x1f')][_0x35e5('0x20')]||'';_0x2dce1d[_0x35e5('0x21')]=!![];if(this['message'][_0x35e5('0x22')]){_0x2dce1d[_0x35e5('0x22')]='';_0x2dce1d[_0x35e5('0x22')]+=_[_0x35e5('0x23')](this[_0x35e5('0x1f')][_0x35e5('0x22')],_0x35e5('0x24'))?'':_0x35e5('0x25');_0x2dce1d['subject']+=this[_0x35e5('0x1f')][_0x35e5('0x22')];}}if(this[_0x35e5('0xe')]===_0x35e5('0x26')){_0x2dce1d[_0x35e5('0x27')]=this[_0x35e5('0x28')]['id'];}else{_0x2dce1d[_['upperFirst'](this['channel'])+_0x35e5('0x29')]=this[_0x35e5('0x28')]['id'];}_0x2dce1d[_[_0x35e5('0x2a')](this['channel'])+'InteractionId']=this[_0x35e5('0x13')]['id'];var _0x5ea246=this[_0x35e5('0x13')];if(rpc[this[_0x35e5('0xe')]+_0x35e5('0x2b')]){if(this['channel']==='mail'){var _0x4f3676={'tls':{'rejectUnauthorized':![]}};if(this[_0x35e5('0x28')]['Smtp'][_0x35e5('0x2c')]){_0x4f3676[_0x35e5('0x2c')]=this['account'][_0x35e5('0x2d')][_0x35e5('0x2c')];}else{_0x4f3676[_0x35e5('0x2e')]=this[_0x35e5('0x28')][_0x35e5('0x2d')][_0x35e5('0x2e')];_0x4f3676[_0x35e5('0x2f')]=this[_0x35e5('0x28')][_0x35e5('0x2d')][_0x35e5('0x2f')];_0x4f3676[_0x35e5('0x30')]=this['account'][_0x35e5('0x2d')][_0x35e5('0x30')];}if(this[_0x35e5('0x28')][_0x35e5('0x2d')]['authentication']){_0x4f3676[_0x35e5('0x31')]={'user':this['account']['Smtp'][_0x35e5('0x32')],'pass':this['account'][_0x35e5('0x2d')]['pass']};}_0x2dce1d[_0x35e5('0x33')]=this[_0x35e5('0x1f')]['messageId'];_0x2dce1d[_0x35e5('0x34')]=_0x35e5('0x35')+_['replace'](_0x2dce1d['body'],_0x35e5('0x36'),'','replace','';_0x3e5b55[_0x41b7('0x38')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x41b7('0x39'),'Precedence':'auto_reply'};return mailRpc[_0x41b7('0x3a')](_0x51f3bf,_0x3e5b55)[_0x41b7('0x3b')](function(_0x5e56c1){logger['info']('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x151412);_0x3e5b55[_0x41b7('0x33')]=_0x5e56c1['message']['messageId'];return rpc[_0xce7116+_0x41b7('0x2c')][_0x41b7('0x3c')](_0x3e5b55);})['then'](function(_0x3ec526){logger['info'](_0x41b7('0x12'),_0x151412,JSON['stringify'](_0x3ec526));})['catch'](function(_0xb93aa4){logger['error'](_0x41b7('0x3d'),_0x151412,JSON[_0x41b7('0x3e')](_0xb93aa4));})[_0x41b7('0x3f')](function(){Promise[_0x41b7('0x40')]()['then'](function(){if(_0x39d213[0x0]!=='2'||_0x167c9c[_0x41b7('0x16')])return;return rpc[_0xce7116+_0x41b7('0x41')][_0x41b7('0x42')](_0x167c9c['id'],{'autoreplyExecuted':!![]})[_0x41b7('0x3b')](function(_0x2e7c28){logger['info'](_0x41b7('0x17'),_0x151412,JSON['stringify'](_0x2e7c28));})[_0x41b7('0x43')](function(_0x36d6a4){logger[_0x41b7('0x44')](_0x41b7('0x45'),_0x151412,JSON['stringify'](_0x36d6a4));});})[_0x41b7('0x3b')](function(){_0x48a403['next']();});});}else{return rpc[this[_0x41b7('0x1d')]+_0x41b7('0x2c')][_0x41b7('0x3c')](_0x3e5b55)[_0x41b7('0x3b')](function(_0x24748a){logger[_0x41b7('0x11')]('[%s][AUTOREPLY]\x20%s',_0x151412,_0x3e5b55['body']);})[_0x41b7('0x43')](function(_0x2bac9f){logger[_0x41b7('0x44')](_0x41b7('0x12'),_0x151412,JSON['stringify'](_0x2bac9f));})[_0x41b7('0x3f')](function(){Promise[_0x41b7('0x40')]()[_0x41b7('0x3b')](function(){if(_0x39d213[0x0]!=='2'||_0x167c9c['autoreplyExecuted'])return;return rpc[_0xce7116+_0x41b7('0x41')][_0x41b7('0x42')](_0x167c9c['id'],{'autoreplyExecuted':!![]})[_0x41b7('0x3b')](function(_0x22bfb5){logger['info'](_0x41b7('0x17'),_0x151412,JSON[_0x41b7('0x3e')](_0x22bfb5));})['catch'](function(_0x45a31a){logger[_0x41b7('0x44')](_0x41b7('0x45'),_0x151412,JSON[_0x41b7('0x3e')](_0x45a31a));});})['then'](function(){_0x48a403['next']();});});}}}catch(_0xecabda){logger[_0x41b7('0x44')](_0x41b7('0x12'),_0x151412,JSON['stringify'](_0xecabda));_0x48a403[_0x41b7('0x46')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 26509f1..004e6c1 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a2a=['finally','stop','stringify','moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s'];(function(_0x130ecc,_0x1744c6){var _0x81b6d3=function(_0x56c096){while(--_0x56c096){_0x130ecc['push'](_0x130ecc['shift']());}};_0x81b6d3(++_0x1744c6);}(_0x7a2a,0x19b));var _0xa7a2=function(_0x96c140,_0x10fbc1){_0x96c140=_0x96c140-0x0;var _0x2b6d04=_0x7a2a[_0x96c140];return _0x2b6d04;};'use strict';var moment=require(_0xa7a2('0x0'));var logger=require(_0xa7a2('0x1'))('routing');var rpc={'chatInteraction':require(_0xa7a2('0x2')),'openchannelInteraction':require(_0xa7a2('0x3')),'smsInteraction':require(_0xa7a2('0x4')),'mailInteraction':require(_0xa7a2('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xa7a2('0x6'))};exports['consequence']=function(_0x23c148,_0x5f319f,_0x50cde4,_0x55647d){return function(_0x2d12d4){try{logger[_0xa7a2('0x7')](_0xa7a2('0x8'),_0x23c148,_0x5f319f[0x0]);var _0x27f880={'closed':0x1,'closedAt':moment()[_0xa7a2('0x9')](_0xa7a2('0xa')),'closeReason':_0xa7a2('0xb'),'disposition':_0x5f319f[0x0]};if(rpc[_0x55647d[_0xa7a2('0xc')]+'Interaction']){rpc[_0x55647d['channel']+_0xa7a2('0xd')][_0xa7a2('0xe')](_0x55647d[_0xa7a2('0xf')]['id'],_0x27f880)[_0xa7a2('0x10')](function(_0x708cf7){logger[_0xa7a2('0x7')](_0xa7a2('0x11'),_0x23c148,_0x55647d[_0xa7a2('0xf')]['id']);})[_0xa7a2('0x12')](function(_0x63e55c){logger[_0xa7a2('0x13')](_0xa7a2('0x14'),_0x23c148,JSON['stringify'](_0x63e55c));})[_0xa7a2('0x15')](function(){_0x2d12d4[_0xa7a2('0x16')]();});}}catch(_0x11af78){logger[_0xa7a2('0x13')](_0xa7a2('0x14'),_0x23c148,JSON[_0xa7a2('0x17')](_0x11af78));_0x2d12d4[_0xa7a2('0x16')]();}};}; \ No newline at end of file +var _0xe965=['[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error'];(function(_0x3b1022,_0x49509e){var _0x3d700a=function(_0x193ea5){while(--_0x193ea5){_0x3b1022['push'](_0x3b1022['shift']());}};_0x3d700a(++_0x49509e);}(_0xe965,0x1d0));var _0x5e96=function(_0x39faf3,_0x1f009d){_0x39faf3=_0x39faf3-0x0;var _0x2c2a40=_0xe965[_0x39faf3];return _0x2c2a40;};'use strict';var moment=require(_0x5e96('0x0'));var logger=require(_0x5e96('0x1'))(_0x5e96('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x5e96('0x3')),'smsInteraction':require(_0x5e96('0x4')),'mailInteraction':require(_0x5e96('0x5')),'faxInteraction':require(_0x5e96('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x5e96('0x7')]=function(_0x2d8639,_0xef15a2,_0x43e60e,_0x53156b){return function(_0x229554){try{logger[_0x5e96('0x8')](_0x5e96('0x9'),_0x2d8639,_0xef15a2[0x0]);var _0x1dd432={'closed':0x1,'closedAt':moment()[_0x5e96('0xa')](_0x5e96('0xb')),'closeReason':'system','disposition':_0xef15a2[0x0]};if(rpc[_0x53156b[_0x5e96('0xc')]+_0x5e96('0xd')]){rpc[_0x53156b[_0x5e96('0xc')]+_0x5e96('0xd')]['update'](_0x53156b[_0x5e96('0xe')]['id'],_0x1dd432)[_0x5e96('0xf')](function(_0x1ae0c5){logger[_0x5e96('0x8')](_0x5e96('0x10'),_0x2d8639,_0x53156b['interaction']['id']);})[_0x5e96('0x11')](function(_0xa7bb23){logger[_0x5e96('0x12')](_0x5e96('0x13'),_0x2d8639,JSON[_0x5e96('0x14')](_0xa7bb23));})[_0x5e96('0x15')](function(){_0x229554[_0x5e96('0x16')]();});}}catch(_0x685516){logger['error'](_0x5e96('0x13'),_0x2d8639,JSON['stringify'](_0x685516));_0x229554[_0x5e96('0x16')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 127302a..3a38541 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaaee=['contact','out','channel','whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','create','then','[%s][DIALOGFLOW]\x20%s','body','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','fulfillment','speech','providerName','providerResponse','Message','metadata','endConversation','stop','lodash','moment','apiai-promise','md5','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next'];(function(_0x3c02a7,_0x111584){var _0xea8e7c=function(_0x1d2fe6){while(--_0x1d2fe6){_0x3c02a7['push'](_0x3c02a7['shift']());}};_0xea8e7c(++_0x111584);}(_0xaaee,0x132));var _0xeaae=function(_0x217f7f,_0x1dc066){_0x217f7f=_0x217f7f-0x0;var _0x4bf8b1=_0xaaee[_0x217f7f];return _0x4bf8b1;};'use strict';var _=require(_0xeaae('0x0'));var moment=require(_0xeaae('0x1'));var apiai=require(_0xeaae('0x2'));var md5=require(_0xeaae('0x3'));var utils=require(_0xeaae('0x4'));var logger=require('../../../../config/logger')(_0xeaae('0x5'));var rpc={'chatMessage':require(_0xeaae('0x6')),'openchannelMessage':require(_0xeaae('0x7')),'mailMessage':require(_0xeaae('0x8')),'smsMessage':require(_0xeaae('0x9')),'faxMessage':require(_0xeaae('0xa')),'whatsappMessage':require(_0xeaae('0xb'))};exports[_0xeaae('0xc')]=function(_0x113fa9,_0x13023a){return function(_0x33afb9){try{if(!_[_0xeaae('0xd')](this['interaction'][_0xeaae('0xe')])){logger[_0xeaae('0xf')]('[%s][DIALOGFLOW]\x20%s',_0x113fa9,_0xeaae('0x10'));return _0x33afb9[_0xeaae('0x11')]();}var _0xc3570c={'ContactId':this[_0xeaae('0x12')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xeaae('0x13')};if(this[_0xeaae('0x14')]==='sms'||this[_0xeaae('0x14')]===_0xeaae('0x15')){_0xc3570c[_0xeaae('0x16')]=this[_0xeaae('0x17')]['phone'];}var _0x25d4bb=this['channel'];if(_0x25d4bb===_0xeaae('0x18')){_0xc3570c[_0xeaae('0x19')]=this[_0xeaae('0x1a')]['id'];}else{_0xc3570c[_[_0xeaae('0x1b')](_0x25d4bb)+_0xeaae('0x1c')]=this[_0xeaae('0x1a')]['id'];}_0xc3570c[_[_0xeaae('0x1b')](_0x25d4bb)+_0xeaae('0x1d')]=this[_0xeaae('0x17')]['id'];if(this[_0xeaae('0x17')][_0xeaae('0x1e')]){var _0x29d624=_0x13023a[0x2];if(!_[_0xeaae('0x1f')](_0x29d624)){_0xc3570c['body']=utils[_0xeaae('0x20')](_0x29d624,this);return rpc[_0x25d4bb+'Message'][_0xeaae('0x21')](_0xc3570c)[_0xeaae('0x22')](function(_0x2b4fd3){logger[_0xeaae('0xf')](_0xeaae('0x23'),_0x113fa9,_0xc3570c[_0xeaae('0x24')]);})[_0xeaae('0x25')](function(_0x482676){logger[_0xeaae('0x26')](_0xeaae('0x23'),_0x113fa9,JSON[_0xeaae('0x27')](_0x482676));})[_0xeaae('0x28')](function(){logger[_0xeaae('0xf')](_0xeaae('0x29'),_0x113fa9);_0x33afb9['stop']();});}else{logger[_0xeaae('0xf')](_0xeaae('0x2a'),_0x113fa9);_0x33afb9['stop']();}}else{var _0x3da7c3=this;var _0x5b69c1=apiai(_0x13023a[0x0],{'language':_0x13023a[0x1]||'en'});return _0x5b69c1[_0xeaae('0x2b')](this[_0xeaae('0x2c')][_0xeaae('0x24')],{'sessionId':md5(this[_0xeaae('0x17')]['id'])})['then'](function(_0x445b35){_0x3da7c3[_0xeaae('0x24')][_0xeaae('0x2d')]=_0x445b35;_0xc3570c['body']=_0x445b35['result'][_0xeaae('0x2e')][_0xeaae('0x2f')];_0xc3570c[_0xeaae('0x30')]=_0xeaae('0x2d');_0xc3570c[_0xeaae('0x31')]=JSON['stringify'](_0x445b35);return rpc[_0x25d4bb+_0xeaae('0x32')][_0xeaae('0x21')](_0xc3570c)['then'](function(_0x3433c4){logger[_0xeaae('0xf')](_0xeaae('0x23'),_0x113fa9,_0xc3570c[_0xeaae('0x24')]);if(_0x445b35['result'][_0xeaae('0x33')][_0xeaae('0x34')]){_0x33afb9[_0xeaae('0x11')]();}else{_0x33afb9['stop']();}})[_0xeaae('0x25')](function(_0x2b95b0){logger[_0xeaae('0x26')](_0xeaae('0x23'),_0x113fa9,JSON[_0xeaae('0x27')](_0x2b95b0));_0x33afb9['next']();});})[_0xeaae('0x25')](function(_0x3b73fa){logger['error'](_0xeaae('0x23'),_0x113fa9,_0x3b73fa['message']);_0x33afb9[_0xeaae('0x11')]();});}}catch(_0x533585){logger[_0xeaae('0x26')](_0xeaae('0x23'),_0x113fa9,JSON['stringify'](_0x533585));_0x33afb9[_0xeaae('0x35')]();}};}; \ No newline at end of file +var _0x7b84=['chat','ChatWebsiteId','account','upperFirst','InteractionId','created','body','then','stringify','finally','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','dialogflow','result','fulfillment','speech','providerName','providerResponse','create','endConversation','catch','error','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone'];(function(_0x399d76,_0xdc4493){var _0x3b19a1=function(_0x262225){while(--_0x262225){_0x399d76['push'](_0x399d76['shift']());}};_0x3b19a1(++_0xdc4493);}(_0x7b84,0x17c));var _0x47b8=function(_0x3a182b,_0x99e824){_0x3a182b=_0x3a182b-0x0;var _0x3b8647=_0x7b84[_0x3a182b];return _0x3b8647;};'use strict';var _=require(_0x47b8('0x0'));var moment=require(_0x47b8('0x1'));var apiai=require(_0x47b8('0x2'));var md5=require(_0x47b8('0x3'));var utils=require(_0x47b8('0x4'));var logger=require(_0x47b8('0x5'))(_0x47b8('0x6'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x47b8('0x7')),'mailMessage':require(_0x47b8('0x8')),'smsMessage':require(_0x47b8('0x9')),'faxMessage':require(_0x47b8('0xa')),'whatsappMessage':require(_0x47b8('0xb'))};exports[_0x47b8('0xc')]=function(_0x53e656,_0x3867ca){return function(_0x3ce846){try{if(!_[_0x47b8('0xd')](this[_0x47b8('0xe')][_0x47b8('0xf')])){logger[_0x47b8('0x10')](_0x47b8('0x11'),_0x53e656,_0x47b8('0x12'));return _0x3ce846[_0x47b8('0x13')]();}var _0x429262={'ContactId':this[_0x47b8('0x14')]['id'],'sentAt':moment()[_0x47b8('0x15')](_0x47b8('0x16')),'direction':_0x47b8('0x17')};if(this[_0x47b8('0x18')]===_0x47b8('0x19')||this[_0x47b8('0x18')]===_0x47b8('0x1a')){_0x429262[_0x47b8('0x1b')]=this[_0x47b8('0xe')][_0x47b8('0x1b')];}var _0x127d42=this[_0x47b8('0x18')];if(_0x127d42===_0x47b8('0x1c')){_0x429262[_0x47b8('0x1d')]=this[_0x47b8('0x1e')]['id'];}else{_0x429262[_[_0x47b8('0x1f')](_0x127d42)+'AccountId']=this[_0x47b8('0x1e')]['id'];}_0x429262[_[_0x47b8('0x1f')](_0x127d42)+_0x47b8('0x20')]=this[_0x47b8('0xe')]['id'];if(this[_0x47b8('0xe')][_0x47b8('0x21')]){var _0x4765ad=_0x3867ca[0x2];if(!_['isEmpty'](_0x4765ad)){_0x429262[_0x47b8('0x22')]=utils['getMustacheRender'](_0x4765ad,this);return rpc[_0x127d42+'Message']['create'](_0x429262)[_0x47b8('0x23')](function(_0x36faf1){logger[_0x47b8('0x10')]('[%s][DIALOGFLOW]\x20%s',_0x53e656,_0x429262['body']);})['catch'](function(_0x1c5bfd){logger['error'](_0x47b8('0x11'),_0x53e656,JSON[_0x47b8('0x24')](_0x1c5bfd));})[_0x47b8('0x25')](function(){logger[_0x47b8('0x10')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x53e656);_0x3ce846[_0x47b8('0x26')]();});}else{logger[_0x47b8('0x10')](_0x47b8('0x27'),_0x53e656);_0x3ce846[_0x47b8('0x26')]();}}else{var _0x168cde=this;var _0x232708=apiai(_0x3867ca[0x0],{'language':_0x3867ca[0x1]||'en'});return _0x232708['textRequest'](this[_0x47b8('0x28')][_0x47b8('0x22')],{'sessionId':md5(this['interaction']['id'])})[_0x47b8('0x23')](function(_0x247429){_0x168cde[_0x47b8('0x22')][_0x47b8('0x29')]=_0x247429;_0x429262['body']=_0x247429[_0x47b8('0x2a')][_0x47b8('0x2b')][_0x47b8('0x2c')];_0x429262[_0x47b8('0x2d')]=_0x47b8('0x29');_0x429262[_0x47b8('0x2e')]=JSON[_0x47b8('0x24')](_0x247429);return rpc[_0x127d42+'Message'][_0x47b8('0x2f')](_0x429262)[_0x47b8('0x23')](function(_0x4bcc98){logger[_0x47b8('0x10')](_0x47b8('0x11'),_0x53e656,_0x429262[_0x47b8('0x22')]);if(_0x247429[_0x47b8('0x2a')]['metadata'][_0x47b8('0x30')]){_0x3ce846['next']();}else{_0x3ce846[_0x47b8('0x26')]();}})[_0x47b8('0x31')](function(_0x33e653){logger[_0x47b8('0x32')]('[%s][DIALOGFLOW]\x20%s',_0x53e656,JSON[_0x47b8('0x24')](_0x33e653));_0x3ce846[_0x47b8('0x13')]();});})[_0x47b8('0x31')](function(_0x1b6c0a){logger[_0x47b8('0x32')](_0x47b8('0x11'),_0x53e656,_0x1b6c0a['message']);_0x3ce846['next']();});}}catch(_0x52599e){logger[_0x47b8('0x32')](_0x47b8('0x11'),_0x53e656,JSON[_0x47b8('0x24')](_0x52599e));_0x3ce846['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 403d507..0f86eb9 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba62=['../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','replace','SessionsClient','sessionPath','message','detectIntent','dialogflowV2','diagnosticInfo','queryResult','fields','end_conversation','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','boolValue','intent','name','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','queryText','intentDetectionConfidence','providerName','length','fulfillmentText','push','all','next','lodash','dialogflow','moment','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0xba62,0x12b));var _0x2ba6=function(_0x2b152a,_0x3dd988){_0x2b152a=_0x2b152a-0x0;var _0x2ad4c7=_0xba62[_0x2b152a];return _0x2ad4c7;};'use strict';var _=require(_0x2ba6('0x0'));var dialogflow=require(_0x2ba6('0x1'));var md5=require('md5');var moment=require(_0x2ba6('0x2'));var Promise=require('bluebird');var logger=require(_0x2ba6('0x3'))(_0x2ba6('0x4'));var utils=require(_0x2ba6('0x5'));var rpc={'chatMessage':require(_0x2ba6('0x6')),'openchannelMessage':require(_0x2ba6('0x7')),'mailMessage':require(_0x2ba6('0x8')),'smsMessage':require(_0x2ba6('0x9')),'faxMessage':require(_0x2ba6('0xa')),'whatsappMessage':require(_0x2ba6('0xb'))};function createMessage(_0x10ed1c,_0x574c55,_0x30bb43,_0x24555a){return new Promise(function(_0x38905b,_0x1ab942){var _0x2a7216=_[_0x2ba6('0xc')](_0x30bb43);_0x2a7216[_0x2ba6('0xd')]=_0x24555a;return rpc[_0x574c55+_0x2ba6('0xe')][_0x2ba6('0xf')](_0x2a7216)[_0x2ba6('0x10')](function(){logger[_0x2ba6('0x11')](_0x2ba6('0x12'),_0x10ed1c,_0x2a7216[_0x2ba6('0xd')]);_0x38905b();})[_0x2ba6('0x13')](function(_0x344719){logger[_0x2ba6('0x14')](_0x2ba6('0x12'),_0x10ed1c,JSON[_0x2ba6('0x15')](_0x344719));_0x1ab942(_0x344719);});});}exports[_0x2ba6('0x16')]=function(_0x5ae7f5,_0x6b07e7){return function(_0x57f46a){try{if(!_[_0x2ba6('0x17')](this[_0x2ba6('0x18')][_0x2ba6('0x19')])){logger[_0x2ba6('0x11')](_0x2ba6('0x12'),_0x5ae7f5,_0x2ba6('0x1a'));return _0x57f46a['next']();}var _0x254d81={'ContactId':this['contact']['id'],'sentAt':moment()[_0x2ba6('0x1b')](_0x2ba6('0x1c')),'direction':_0x2ba6('0x1d')};if(this[_0x2ba6('0x1e')]===_0x2ba6('0x1f')||this[_0x2ba6('0x1e')]===_0x2ba6('0x20')){_0x254d81[_0x2ba6('0x21')]=this[_0x2ba6('0x18')][_0x2ba6('0x21')];}var _0x39cbf8=this[_0x2ba6('0x1e')];if(_0x39cbf8===_0x2ba6('0x22')){_0x254d81[_0x2ba6('0x23')]=this[_0x2ba6('0x24')]['id'];}else{_0x254d81[_[_0x2ba6('0x25')](_0x39cbf8)+_0x2ba6('0x26')]=this[_0x2ba6('0x24')]['id'];}_0x254d81[_[_0x2ba6('0x25')](_0x39cbf8)+_0x2ba6('0x27')]=this[_0x2ba6('0x18')]['id'];if(this['interaction'][_0x2ba6('0x28')]){var _0x4e7dc2=_0x6b07e7[0x4];if(!_[_0x2ba6('0x29')](_0x4e7dc2)){_0x254d81['body']=utils[_0x2ba6('0x2a')](_0x4e7dc2,this);return rpc[_0x39cbf8+_0x2ba6('0xe')][_0x2ba6('0xf')](_0x254d81)['then'](function(_0x20b46e){logger[_0x2ba6('0x11')](_0x2ba6('0x12'),_0x5ae7f5,_0x254d81['body']);})['catch'](function(_0x111cfd){logger[_0x2ba6('0x14')](_0x2ba6('0x12'),_0x5ae7f5,JSON['stringify'](_0x111cfd));})[_0x2ba6('0x2b')](function(){logger[_0x2ba6('0x11')](_0x2ba6('0x2c'),_0x5ae7f5);_0x57f46a['stop']();});}else{logger['info'](_0x2ba6('0x2d'),_0x5ae7f5);_0x57f46a[_0x2ba6('0x2e')]();}}else{var _0x4cd72f=this;var _0x8161b7=_0x6b07e7[0x2][_0x2ba6('0x2f')](/\\n/g,'\x0a');var _0x512d5c={'credentials':{'private_key':_0x8161b7,'client_email':_0x6b07e7[0x1]}};var _0x2ee6c0=new dialogflow[(_0x2ba6('0x30'))](_0x512d5c);var _0xbbb96a=_0x2ee6c0[_0x2ba6('0x31')](_0x6b07e7[0x0],md5(_0x4cd72f[_0x2ba6('0x18')]['id']));var _0x112927={'session':_0xbbb96a,'queryInput':{'text':{'text':_0x4cd72f[_0x2ba6('0x32')][_0x2ba6('0xd')],'languageCode':_0x6b07e7[0x3]||'en'}}};return _0x2ee6c0[_0x2ba6('0x33')](_0x112927)[_0x2ba6('0x10')](function(_0x1c4700){if(_0x1c4700&&_0x1c4700['length']){_0x4cd72f[_0x2ba6('0xd')][_0x2ba6('0x34')]=_0x1c4700;var _0x4969a4=_0x1c4700[0x0];var _0x15b64d=_0x4969a4['queryResult'][_0x2ba6('0x35')]&&_0x4969a4[_0x2ba6('0x36')][_0x2ba6('0x35')][_0x2ba6('0x37')]?_0x4969a4[_0x2ba6('0x36')][_0x2ba6('0x35')][_0x2ba6('0x37')][_0x2ba6('0x38')]['boolValue']:![];_0x4cd72f[_0x2ba6('0xd')][_0x2ba6('0x39')]=_0x4969a4[_0x2ba6('0x36')][_0x2ba6('0x3a')];_0x4cd72f[_0x2ba6('0xd')][_0x2ba6('0x3b')]=_0x4969a4['queryResult'][_0x2ba6('0x3c')];_0x4cd72f[_0x2ba6('0xd')][_0x2ba6('0x3d')]=_0x4969a4['queryResult'][_0x2ba6('0x35')]&&_0x4969a4[_0x2ba6('0x36')][_0x2ba6('0x35')][_0x2ba6('0x37')]?_0x4969a4[_0x2ba6('0x36')][_0x2ba6('0x35')][_0x2ba6('0x37')][_0x2ba6('0x38')][_0x2ba6('0x3e')]:![];_0x4cd72f[_0x2ba6('0xd')]['DIALOGFLOWV2_INTENTNAME']=_0x4969a4['queryResult'][_0x2ba6('0x3f')][_0x2ba6('0x40')];_0x4cd72f['body']['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x4969a4['queryResult'][_0x2ba6('0x3f')][_0x2ba6('0x41')];_0x4cd72f[_0x2ba6('0xd')][_0x2ba6('0x42')]=_0x4969a4['queryResult'][_0x2ba6('0x3f')][_0x2ba6('0x43')];_0x4cd72f[_0x2ba6('0xd')]['DIALOGFLOWV2_LANGUAGECODE']=_0x4969a4[_0x2ba6('0x36')][_0x2ba6('0x44')];_0x4cd72f[_0x2ba6('0xd')]['DIALOGFLOWV2_QUERYTEXT']=_0x4969a4[_0x2ba6('0x36')][_0x2ba6('0x45')];_0x4cd72f[_0x2ba6('0xd')]['DIALOGFLOWV2_SCORE']=_0x4969a4[_0x2ba6('0x36')][_0x2ba6('0x46')];_0x254d81[_0x2ba6('0x47')]=_0x2ba6('0x34');_0x254d81['providerResponse']=JSON[_0x2ba6('0x15')](_0x1c4700);var _0x76c500=[];for(var _0x2e1b56=0x0;_0x2e1b56<_0x1c4700[_0x2ba6('0x48')];_0x2e1b56++){var _0x4cbbb1=_0x1c4700[_0x2e1b56];if(_0x4cbbb1&&_0x4cbbb1[_0x2ba6('0x36')]&&_0x4cbbb1['queryResult'][_0x2ba6('0x49')]){_0x76c500[_0x2ba6('0x4a')](createMessage(_0x5ae7f5,_0x39cbf8,_0x254d81,_0x4cbbb1[_0x2ba6('0x36')][_0x2ba6('0x49')]));}}return Promise[_0x2ba6('0x4b')](_0x76c500)['then'](function(){if(_0x15b64d){_0x57f46a[_0x2ba6('0x4c')]();}else{_0x57f46a[_0x2ba6('0x2e')]();}})[_0x2ba6('0x13')](function(_0x335cd2){logger[_0x2ba6('0x14')]('[%s][DIALOGFLOWV2]\x20%s',_0x5ae7f5,JSON[_0x2ba6('0x15')](_0x335cd2));_0x57f46a[_0x2ba6('0x4c')]();});}})[_0x2ba6('0x13')](function(_0x22009a){logger['error'](_0x2ba6('0x12'),_0x5ae7f5,_0x22009a[_0x2ba6('0x32')]);_0x57f46a[_0x2ba6('0x4c')]();});}}catch(_0x111733){logger[_0x2ba6('0x14')](_0x2ba6('0x12'),_0x5ae7f5,JSON['stringify'](_0x111733));_0x57f46a[_0x2ba6('0x2e')]();}};}; \ No newline at end of file +var _0x00ce=['finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','end_conversation','boolValue','allRequiredParamsPresent','fields','DIALOGFLOWV2_INTENTNAME','name','displayName','intent','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerResponse','fulfillmentText','all','lodash','dialogflow','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','body','create','then','info','catch','error','[%s][DIALOGFLOWV2]\x20%s','stringify','interaction','UserId','next','contact','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','isEmpty','getMustacheRender'];(function(_0x346962,_0x4f69d6){var _0x3f2a3d=function(_0x5cf591){while(--_0x5cf591){_0x346962['push'](_0x346962['shift']());}};_0x3f2a3d(++_0x4f69d6);}(_0x00ce,0x132));var _0xe00c=function(_0x35c8e7,_0x1bbd00){_0x35c8e7=_0x35c8e7-0x0;var _0x3d5a6c=_0x00ce[_0x35c8e7];return _0x3d5a6c;};'use strict';var _=require(_0xe00c('0x0'));var dialogflow=require(_0xe00c('0x1'));var md5=require(_0xe00c('0x2'));var moment=require(_0xe00c('0x3'));var Promise=require(_0xe00c('0x4'));var logger=require(_0xe00c('0x5'))(_0xe00c('0x6'));var utils=require(_0xe00c('0x7'));var rpc={'chatMessage':require(_0xe00c('0x8')),'openchannelMessage':require(_0xe00c('0x9')),'mailMessage':require(_0xe00c('0xa')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xe00c('0xb')),'whatsappMessage':require(_0xe00c('0xc'))};function createMessage(_0x4ceabd,_0x28ba6c,_0xeb7f87,_0x543962){return new Promise(function(_0x33c5b7,_0x6e3c7f){var _0x1d5535=_['clone'](_0xeb7f87);_0x1d5535[_0xe00c('0xd')]=_0x543962;return rpc[_0x28ba6c+'Message'][_0xe00c('0xe')](_0x1d5535)[_0xe00c('0xf')](function(){logger[_0xe00c('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x4ceabd,_0x1d5535[_0xe00c('0xd')]);_0x33c5b7();})[_0xe00c('0x11')](function(_0x13e045){logger[_0xe00c('0x12')](_0xe00c('0x13'),_0x4ceabd,JSON[_0xe00c('0x14')](_0x13e045));_0x6e3c7f(_0x13e045);});});}exports['consequence']=function(_0x371314,_0x1f4217){return function(_0x4474b9){try{if(!_['isNil'](this[_0xe00c('0x15')][_0xe00c('0x16')])){logger[_0xe00c('0x10')](_0xe00c('0x13'),_0x371314,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x4474b9[_0xe00c('0x17')]();}var _0xeae658={'ContactId':this[_0xe00c('0x18')]['id'],'sentAt':moment()['format'](_0xe00c('0x19')),'direction':'out'};if(this[_0xe00c('0x1a')]===_0xe00c('0x1b')||this['channel']===_0xe00c('0x1c')){_0xeae658['phone']=this[_0xe00c('0x15')][_0xe00c('0x1d')];}var _0x1c22e4=this[_0xe00c('0x1a')];if(_0x1c22e4===_0xe00c('0x1e')){_0xeae658[_0xe00c('0x1f')]=this['account']['id'];}else{_0xeae658[_[_0xe00c('0x20')](_0x1c22e4)+_0xe00c('0x21')]=this[_0xe00c('0x22')]['id'];}_0xeae658[_[_0xe00c('0x20')](_0x1c22e4)+_0xe00c('0x23')]=this[_0xe00c('0x15')]['id'];if(this[_0xe00c('0x15')][_0xe00c('0x24')]){var _0x1d7e9e=_0x1f4217[0x4];if(!_[_0xe00c('0x25')](_0x1d7e9e)){_0xeae658[_0xe00c('0xd')]=utils[_0xe00c('0x26')](_0x1d7e9e,this);return rpc[_0x1c22e4+'Message']['create'](_0xeae658)[_0xe00c('0xf')](function(_0x3609a6){logger[_0xe00c('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x371314,_0xeae658[_0xe00c('0xd')]);})[_0xe00c('0x11')](function(_0x10b67e){logger[_0xe00c('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x371314,JSON[_0xe00c('0x14')](_0x10b67e));})[_0xe00c('0x27')](function(){logger[_0xe00c('0x10')](_0xe00c('0x28'),_0x371314);_0x4474b9[_0xe00c('0x29')]();});}else{logger[_0xe00c('0x10')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x371314);_0x4474b9[_0xe00c('0x29')]();}}else{var _0x2d6a44=this;var _0x2acb8d=_0x1f4217[0x2][_0xe00c('0x2a')](/\\n/g,'\x0a');var _0x22668b={'credentials':{'private_key':_0x2acb8d,'client_email':_0x1f4217[0x1]}};var _0x408561=new dialogflow[(_0xe00c('0x2b'))](_0x22668b);var _0x478fb3=_0x408561[_0xe00c('0x2c')](_0x1f4217[0x0],md5(_0x2d6a44[_0xe00c('0x15')]['id']));var _0x4d42d3={'session':_0x478fb3,'queryInput':{'text':{'text':_0x2d6a44[_0xe00c('0x2d')][_0xe00c('0xd')],'languageCode':_0x1f4217[0x3]||'en'}}};return _0x408561[_0xe00c('0x2e')](_0x4d42d3)[_0xe00c('0xf')](function(_0x554f14){if(_0x554f14&&_0x554f14[_0xe00c('0x2f')]){_0x2d6a44[_0xe00c('0xd')][_0xe00c('0x30')]=_0x554f14;var _0x5596a1=_0x554f14[0x0];var _0x1cbfb2=_0x5596a1[_0xe00c('0x31')]['diagnosticInfo']&&_0x5596a1[_0xe00c('0x31')]['diagnosticInfo']['fields']?_0x5596a1[_0xe00c('0x31')][_0xe00c('0x32')]['fields'][_0xe00c('0x33')][_0xe00c('0x34')]:![];_0x2d6a44[_0xe00c('0xd')]['DIALOGFLOWV2_ACTION']=_0x5596a1[_0xe00c('0x31')]['action'];_0x2d6a44['body']['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x5596a1[_0xe00c('0x31')][_0xe00c('0x35')];_0x2d6a44[_0xe00c('0xd')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x5596a1[_0xe00c('0x31')][_0xe00c('0x32')]&&_0x5596a1[_0xe00c('0x31')][_0xe00c('0x32')][_0xe00c('0x36')]?_0x5596a1['queryResult'][_0xe00c('0x32')]['fields'][_0xe00c('0x33')][_0xe00c('0x34')]:![];_0x2d6a44['body'][_0xe00c('0x37')]=_0x5596a1['queryResult']['intent'][_0xe00c('0x38')];_0x2d6a44['body']['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x5596a1[_0xe00c('0x31')]['intent'][_0xe00c('0x39')];_0x2d6a44[_0xe00c('0xd')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x5596a1[_0xe00c('0x31')][_0xe00c('0x3a')][_0xe00c('0x3b')];_0x2d6a44[_0xe00c('0xd')][_0xe00c('0x3c')]=_0x5596a1[_0xe00c('0x31')][_0xe00c('0x3d')];_0x2d6a44[_0xe00c('0xd')][_0xe00c('0x3e')]=_0x5596a1[_0xe00c('0x31')][_0xe00c('0x3f')];_0x2d6a44[_0xe00c('0xd')][_0xe00c('0x40')]=_0x5596a1['queryResult'][_0xe00c('0x41')];_0xeae658['providerName']='dialogflowV2';_0xeae658[_0xe00c('0x42')]=JSON[_0xe00c('0x14')](_0x554f14);var _0x2ee0a4=[];for(var _0x4aeabb=0x0;_0x4aeabb<_0x554f14[_0xe00c('0x2f')];_0x4aeabb++){var _0x11b889=_0x554f14[_0x4aeabb];if(_0x11b889&&_0x11b889[_0xe00c('0x31')]&&_0x11b889[_0xe00c('0x31')]['fulfillmentText']){_0x2ee0a4['push'](createMessage(_0x371314,_0x1c22e4,_0xeae658,_0x11b889[_0xe00c('0x31')][_0xe00c('0x43')]));}}return Promise[_0xe00c('0x44')](_0x2ee0a4)[_0xe00c('0xf')](function(){if(_0x1cbfb2){_0x4474b9[_0xe00c('0x17')]();}else{_0x4474b9[_0xe00c('0x29')]();}})['catch'](function(_0x25c8f0){logger[_0xe00c('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x371314,JSON[_0xe00c('0x14')](_0x25c8f0));_0x4474b9[_0xe00c('0x17')]();});}})[_0xe00c('0x11')](function(_0xec0f81){logger[_0xe00c('0x12')](_0xe00c('0x13'),_0x371314,_0xec0f81[_0xe00c('0x2d')]);_0x4474b9[_0xe00c('0x17')]();});}}catch(_0x2f6720){logger[_0xe00c('0x12')](_0xe00c('0x13'),_0x371314,JSON[_0xe00c('0x14')](_0x2f6720));_0x4474b9[_0xe00c('0x29')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 2e5c081..a2f9c86 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x254a=['stop','condition','priorityFalse','info','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20%s','stringify','validate','html-to-text','./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','consequence','fromString','getMustacheRender','length','error','map','message','join'];(function(_0x43e97d,_0x56a06b){var _0x424cd9=function(_0x4f574b){while(--_0x4f574b){_0x43e97d['push'](_0x43e97d['shift']());}};_0x424cd9(++_0x56a06b);}(_0x254a,0x167));var _0xa254=function(_0x7d6eca,_0x59d54a){_0x7d6eca=_0x7d6eca-0x0;var _0x128263=_0x254a[_0x7d6eca];return _0x128263;};'use strict';var schema=require(_0xa254('0x0'));var _=require('lodash');var htmlToText=require(_0xa254('0x1'));var utils=require(_0xa254('0x2'));var logger=require('../../../../config/logger')(_0xa254('0x3'));var gotoif=schema({'condition':{'type':_0xa254('0x4'),'required':!![],'message':_0xa254('0x5')},'priorityTrue':{'type':'number','message':_0xa254('0x6')},'priorityFalse':{'type':_0xa254('0x7'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0xa254('0x8')]=function(_0x5ddf66,_0x3c06d0){return function(_0x3f1f82){try{var _0x5ecc30={'condition':htmlToText[_0xa254('0x9')](utils[_0xa254('0xa')](_0x3c06d0[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x3c06d0[0x1],'priorityFalse':_0x3c06d0[0x2]};var _0x1e61d7=gotoif[_0xa254('0x0')](_0x5ecc30,{'typecast':!![]});if(_0x1e61d7[_0xa254('0xb')]){logger[_0xa254('0xc')]('[%s][GOTOIF]\x20%s',_0x5ddf66,_[_0xa254('0xd')](_0x1e61d7,_0xa254('0xe'))[_0xa254('0xf')](',\x20'));_0x3f1f82[_0xa254('0x10')]();}else{try{var _0x25fc39=eval('('+_0x5ecc30[_0xa254('0x11')]+')');var _0x2e668f=_0x25fc39?_0x5ecc30['priorityTrue']:_0x5ecc30[_0xa254('0x12')];logger[_0xa254('0x13')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x5ddf66,_0x5ecc30[_0xa254('0x11')],_0x25fc39,_0x2e668f||'next');if(_0x2e668f){var _0x5df6b9=_[_0xa254('0x14')](_0x3f1f82['rules'](),{'p':_0x2e668f});if(_0x5df6b9>=0x0){logger[_0xa254('0x13')](_0xa254('0x15'),_0x5ddf66,_0x2e668f||'next',_0x5df6b9);_0x3f1f82['next'](_0x5df6b9);}else{logger[_0xa254('0x13')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x5ddf66,_0x2e668f||_0xa254('0x16'));_0x3f1f82['stop']();}}else{_0x3f1f82['next']();}}catch(_0x43ebf1){logger['error']('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x5ddf66,_0x43ebf1[_0xa254('0xe')]);_0x3f1f82[_0xa254('0x10')]();}}}catch(_0x31b2dd){logger[_0xa254('0xc')](_0xa254('0x17'),_0x5ddf66,JSON[_0xa254('0x18')](_0x31b2dd));_0x3f1f82['stop']();}};}; \ No newline at end of file +var _0x00cb=['priorityTrue','info','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','[%s][GOTOIF]\x20%s','stringify','validate','html-to-text','./utils','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','length','map','stop','condition'];(function(_0x413476,_0x4a7c69){var _0x91aee=function(_0x441698){while(--_0x441698){_0x413476['push'](_0x413476['shift']());}};_0x91aee(++_0x4a7c69);}(_0x00cb,0xd3));var _0xb00c=function(_0x16bea0,_0x59b8aa){_0x16bea0=_0x16bea0-0x0;var _0x476103=_0x00cb[_0x16bea0];return _0x476103;};'use strict';var schema=require(_0xb00c('0x0'));var _=require('lodash');var htmlToText=require(_0xb00c('0x1'));var utils=require(_0xb00c('0x2'));var logger=require('../../../../config/logger')('routing');var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0xb00c('0x3')},'priorityTrue':{'type':_0xb00c('0x4'),'message':_0xb00c('0x5')},'priorityFalse':{'type':_0xb00c('0x4'),'message':_0xb00c('0x6')}});exports[_0xb00c('0x7')]=function(_0x2591af,_0x470b97){return function(_0x30258c){try{var _0x3ba401={'condition':htmlToText[_0xb00c('0x8')](utils[_0xb00c('0x9')](_0x470b97[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x470b97[0x1],'priorityFalse':_0x470b97[0x2]};var _0x31c35e=gotoif[_0xb00c('0x0')](_0x3ba401,{'typecast':!![]});if(_0x31c35e[_0xb00c('0xa')]){logger['error']('[%s][GOTOIF]\x20%s',_0x2591af,_[_0xb00c('0xb')](_0x31c35e,'message')['join'](',\x20'));_0x30258c[_0xb00c('0xc')]();}else{try{var _0xd62131=eval('('+_0x3ba401[_0xb00c('0xd')]+')');var _0x559b00=_0xd62131?_0x3ba401[_0xb00c('0xe')]:_0x3ba401['priorityFalse'];logger[_0xb00c('0xf')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x2591af,_0x3ba401['condition'],_0xd62131,_0x559b00||_0xb00c('0x10'));if(_0x559b00){var _0x28fade=_[_0xb00c('0x11')](_0x30258c[_0xb00c('0x12')](),{'p':_0x559b00});if(_0x28fade>=0x0){logger[_0xb00c('0xf')](_0xb00c('0x13'),_0x2591af,_0x559b00||'next',_0x28fade);_0x30258c[_0xb00c('0x10')](_0x28fade);}else{logger[_0xb00c('0xf')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x2591af,_0x559b00||'next');_0x30258c[_0xb00c('0xc')]();}}else{_0x30258c['next']();}}catch(_0x473373){logger[_0xb00c('0x14')](_0xb00c('0x15'),_0x2591af,_0x473373[_0xb00c('0x16')]);_0x30258c[_0xb00c('0xc')]();}}}catch(_0x3fc2d1){logger[_0xb00c('0x14')](_0xb00c('0x17'),_0x2591af,JSON[_0xb00c('0x18')](_0x3fc2d1));_0x30258c['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index beb3686..8c63835 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 _0x9ef5=['map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','../../../../config/logger','routing','consequence','validate','length','error','[%s][GOTOP]\x20%s'];(function(_0x2b790c,_0x40c30d){var _0xa48960=function(_0x51b757){while(--_0x51b757){_0x2b790c['push'](_0x2b790c['shift']());}};_0xa48960(++_0x40c30d);}(_0x9ef5,0x14f));var _0x59ef=function(_0x50e593,_0x3ae998){_0x50e593=_0x50e593-0x0;var _0x3821d0=_0x9ef5[_0x50e593];return _0x3821d0;};'use strict';var schema=require('validate');var _=require('lodash');var logger=require(_0x59ef('0x0'))(_0x59ef('0x1'));var gotop=schema({'priority':{'type':'number','required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x59ef('0x2')]=function(_0x1b2130,_0x4bdd9f){return function(_0x4e465d){try{var _0x3bd4fb={'priority':_0x4bdd9f[0x0]};var _0x489f7c=gotop[_0x59ef('0x3')](_0x3bd4fb,{'typecast':!![]});if(_0x489f7c[_0x59ef('0x4')]){logger[_0x59ef('0x5')](_0x59ef('0x6'),_0x1b2130,_[_0x59ef('0x7')](_0x489f7c,_0x59ef('0x8'))[_0x59ef('0x9')](',\x20'));_0x4e465d[_0x59ef('0xa')]();}else{logger[_0x59ef('0xb')](_0x59ef('0xc'),_0x1b2130,_0x3bd4fb[_0x59ef('0xd')]);if(_0x3bd4fb[_0x59ef('0xd')]){var _0x438358=_[_0x59ef('0xe')](_0x4e465d['rules'](),{'p':_0x3bd4fb[_0x59ef('0xd')]});if(_0x438358>=0x0){logger[_0x59ef('0xb')](_0x59ef('0xf'),_0x1b2130,_0x3bd4fb['priority']||_0x59ef('0x10'),_0x438358);_0x4e465d[_0x59ef('0x10')](_0x438358);}else{logger[_0x59ef('0xb')](_0x59ef('0x11'),_0x1b2130,_0x3bd4fb[_0x59ef('0xd')]||'next');_0x4e465d[_0x59ef('0xa')]();}}else{_0x4e465d[_0x59ef('0x10')]();}}}catch(_0x5230ff){logger[_0x59ef('0x5')](_0x59ef('0x6'),_0x1b2130,JSON[_0x59ef('0x12')](_0x5230ff));_0x4e465d[_0x59ef('0xa')]();}};}; \ No newline at end of file +var _0x8029=['findIndex','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s','stringify','lodash','../../../../config/logger','routing','number','consequence','length','error','map','message','join','stop','[%s][GOTOP]\x20priority\x20%s','priority'];(function(_0x9fc569,_0x19b3b7){var _0x4d45be=function(_0x3758dc){while(--_0x3758dc){_0x9fc569['push'](_0x9fc569['shift']());}};_0x4d45be(++_0x19b3b7);}(_0x8029,0xc5));var _0x9802=function(_0x375bc6,_0x355445){_0x375bc6=_0x375bc6-0x0;var _0x573863=_0x8029[_0x375bc6];return _0x573863;};'use strict';var schema=require('validate');var _=require(_0x9802('0x0'));var logger=require(_0x9802('0x1'))(_0x9802('0x2'));var gotop=schema({'priority':{'type':_0x9802('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x9802('0x4')]=function(_0x3872aa,_0x42bbbe){return function(_0x34a1aa){try{var _0x37ae95={'priority':_0x42bbbe[0x0]};var _0x487cc6=gotop['validate'](_0x37ae95,{'typecast':!![]});if(_0x487cc6[_0x9802('0x5')]){logger[_0x9802('0x6')]('[%s][GOTOP]\x20%s',_0x3872aa,_[_0x9802('0x7')](_0x487cc6,_0x9802('0x8'))[_0x9802('0x9')](',\x20'));_0x34a1aa[_0x9802('0xa')]();}else{logger['info'](_0x9802('0xb'),_0x3872aa,_0x37ae95[_0x9802('0xc')]);if(_0x37ae95[_0x9802('0xc')]){var _0x418cff=_[_0x9802('0xd')](_0x34a1aa[_0x9802('0xe')](),{'p':_0x37ae95['priority']});if(_0x418cff>=0x0){logger[_0x9802('0xf')](_0x9802('0x10'),_0x3872aa,_0x37ae95[_0x9802('0xc')]||_0x9802('0x11'),_0x418cff);_0x34a1aa[_0x9802('0x11')](_0x418cff);}else{logger['info'](_0x9802('0x12'),_0x3872aa,_0x37ae95[_0x9802('0xc')]||_0x9802('0x11'));_0x34a1aa[_0x9802('0xa')]();}}else{_0x34a1aa[_0x9802('0x11')]();}}}catch(_0x4881f9){logger[_0x9802('0x6')](_0x9802('0x13'),_0x3872aa,JSON[_0x9802('0x14')](_0x4881f9));_0x34a1aa[_0x9802('0xa')]();}};}; \ 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 2dd6f3d..a803342 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 _0x28e8=['consequence','getMustacheRender','contact','channel','chat','AccountId','account','upperFirst','interaction','Message','then','info','body','next','catch','[%s][MESSAGE]\x20%s','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage'];(function(_0x39610d,_0x4158d9){var _0x3dfcbb=function(_0x2bc092){while(--_0x2bc092){_0x39610d['push'](_0x39610d['shift']());}};_0x3dfcbb(++_0x4158d9);}(_0x28e8,0x17e));var _0x828e=function(_0x45fa4a,_0x237f31){_0x45fa4a=_0x45fa4a-0x0;var _0xa967ca=_0x28e8[_0x45fa4a];return _0xa967ca;};'use strict';var _=require(_0x828e('0x0'));var utils=require(_0x828e('0x1'));var logger=require(_0x828e('0x2'))(_0x828e('0x3'));var rpc={'chatMessage':require(_0x828e('0x4')),'openchannelMessage':require(_0x828e('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x828e('0x6')),'whatsappMessage':require(_0x828e('0x7'))};exports[_0x828e('0x8')]=function(_0x69c9d9,_0x3b0d2d){return function(_0x56105f){try{var _0x44de07={'body':utils[_0x828e('0x9')](_0x3b0d2d[0x0],this),'ContactId':this[_0x828e('0xa')]['id']};if(this[_0x828e('0xb')]===_0x828e('0xc')){_0x44de07['ChatWebsiteId']=this['account']['id'];}else{_0x44de07[_['upperFirst'](this[_0x828e('0xb')])+_0x828e('0xd')]=this[_0x828e('0xe')]['id'];}_0x44de07[_[_0x828e('0xf')](this['channel'])+'InteractionId']=this[_0x828e('0x10')]['id'];if(rpc[this['channel']+_0x828e('0x11')]){return rpc[this[_0x828e('0xb')]+_0x828e('0x11')]['create'](_0x44de07)[_0x828e('0x12')](function(_0x657f18){logger[_0x828e('0x13')]('[%s][MESSAGE]\x20%s',_0x69c9d9,_0x44de07[_0x828e('0x14')]);_0x56105f[_0x828e('0x15')]();})[_0x828e('0x16')](function(_0x1ab031){logger['error'](_0x828e('0x17'),_0x69c9d9,JSON[_0x828e('0x18')](_0x1ab031));_0x56105f['stop']();});}}catch(_0x4e94c1){logger['error'](_0x828e('0x17'),_0x69c9d9,JSON[_0x828e('0x18')](_0x4e94c1));_0x56105f[_0x828e('0x19')]();}};}; \ No newline at end of file +var _0x53f5=['getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','Message','then','info','[%s][MESSAGE]\x20%s','catch','error','stringify','stop','lodash','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence'];(function(_0x38acf3,_0x3df840){var _0x2ae0fb=function(_0x4627f4){while(--_0x4627f4){_0x38acf3['push'](_0x38acf3['shift']());}};_0x2ae0fb(++_0x3df840);}(_0x53f5,0x1c0));var _0x553f=function(_0x21d5a1,_0x30fff3){_0x21d5a1=_0x21d5a1-0x0;var _0x51160a=_0x53f5[_0x21d5a1];return _0x51160a;};'use strict';var _=require(_0x553f('0x0'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x553f('0x1'));var rpc={'chatMessage':require(_0x553f('0x2')),'openchannelMessage':require(_0x553f('0x3')),'mailMessage':require(_0x553f('0x4')),'smsMessage':require(_0x553f('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x553f('0x6'))};exports[_0x553f('0x7')]=function(_0x1fcbc6,_0x57a2ed){return function(_0x15fcbe){try{var _0x2383e2={'body':utils[_0x553f('0x8')](_0x57a2ed[0x0],this),'ContactId':this[_0x553f('0x9')]['id']};if(this[_0x553f('0xa')]===_0x553f('0xb')){_0x2383e2[_0x553f('0xc')]=this[_0x553f('0xd')]['id'];}else{_0x2383e2[_[_0x553f('0xe')](this[_0x553f('0xa')])+'AccountId']=this[_0x553f('0xd')]['id'];}_0x2383e2[_[_0x553f('0xe')](this[_0x553f('0xa')])+_0x553f('0xf')]=this['interaction']['id'];if(rpc[this[_0x553f('0xa')]+_0x553f('0x10')]){return rpc[this[_0x553f('0xa')]+_0x553f('0x10')]['create'](_0x2383e2)[_0x553f('0x11')](function(_0x4f1ffe){logger[_0x553f('0x12')](_0x553f('0x13'),_0x1fcbc6,_0x2383e2['body']);_0x15fcbe['next']();})[_0x553f('0x14')](function(_0x5019f0){logger[_0x553f('0x15')](_0x553f('0x13'),_0x1fcbc6,JSON[_0x553f('0x16')](_0x5019f0));_0x15fcbe[_0x553f('0x17')]();});}}catch(_0x261c56){logger[_0x553f('0x15')]('[%s][MESSAGE]\x20%s',_0x1fcbc6,JSON[_0x553f('0x16')](_0x261c56));_0x15fcbe[_0x553f('0x17')]();}};}; \ 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 86b3cda..be32965 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 _0x2097=['[%s][NOOP]\x20%s','stringify','stop','./utils','routing','info','getMustacheRender','error'];(function(_0x179194,_0x8fca3){var _0x1b3ac7=function(_0x321450){while(--_0x321450){_0x179194['push'](_0x179194['shift']());}};_0x1b3ac7(++_0x8fca3);}(_0x2097,0x1ab));var _0x7209=function(_0x22632a,_0x5ad920){_0x22632a=_0x22632a-0x0;var _0x356781=_0x2097[_0x22632a];return _0x356781;};'use strict';var utils=require(_0x7209('0x0'));var logger=require('../../../../config/logger')(_0x7209('0x1'));exports['consequence']=function(_0x1ec9de,_0x630b31){return function(_0x91d6a){try{logger[_0x7209('0x2')]('[%s][NOOP]\x20%s',_0x1ec9de,utils[_0x7209('0x3')](_0x630b31[0x0],this));_0x91d6a['next']();}catch(_0x3a8300){logger[_0x7209('0x4')](_0x7209('0x5'),_0x1ec9de,JSON[_0x7209('0x6')](_0x3a8300));_0x91d6a[_0x7209('0x7')]();}};}; \ No newline at end of file +var _0x8b8d=['[%s][NOOP]\x20%s','getMustacheRender','next','error','stop','./utils','routing'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x8b8d,0x67));var _0xd8b8=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x8b8d[_0x33032e];return _0x13316b;};'use strict';var utils=require(_0xd8b8('0x0'));var logger=require('../../../../config/logger')(_0xd8b8('0x1'));exports['consequence']=function(_0x3c48fd,_0x3dd8fd){return function(_0x53c355){try{logger['info'](_0xd8b8('0x2'),_0x3c48fd,utils[_0xd8b8('0x3')](_0x3dd8fd[0x0],this));_0x53c355[_0xd8b8('0x4')]();}catch(_0x4f8270){logger[_0xd8b8('0x5')]('[%s][NOOP]\x20%s',_0x3c48fd,JSON['stringify'](_0x4f8270));_0x53c355[_0xd8b8('0x6')]();}};}; \ 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 3d1d962..93ea4f9 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 _0x283d=['log','validate','lodash','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','name','QueueReport','create','catch','error','accepted','info','[%s][STOP:QUEUE][NAME:%s]','update','timeout','update\x20queue\x20report','toLowerCase','consequence','length','map','join','stop','find','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x283d,0x9f));var _0xd283=function(_0x44478c,_0x518bb8){_0x44478c=_0x44478c-0x0;var _0x801221=_0x283d[_0x44478c];return _0x801221;};'use strict';var schema=require(_0xd283('0x0'));var _=require(_0xd283('0x1'));var util=require('util');var seqqueue=require(_0xd283('0x2'));var moment=require(_0xd283('0x3'));var Redis=require(_0xd283('0x4'));var config=require(_0xd283('0x5'));var logger=require(_0xd283('0x6'))(_0xd283('0x7'));var strategy=require('./strategy');config['redis']=_['defaults'](config[_0xd283('0x8')],{'host':_0xd283('0x9'),'port':0x18eb});var io=require(_0xd283('0xa'))(new Redis(config[_0xd283('0x8')]));var attributes=['id',_0xd283('0xb'),_0xd283('0xc'),_0xd283('0xd'),_0xd283('0xe'),_0xd283('0xf')];function emit(_0x37a341,_0x28ab56,_0x10bfa1){io['to'](_0x37a341)[_0xd283('0x10')](_0x28ab56,_0x10bfa1);}function emitChannelQueueInteraction(_0x24c703,_0x5e1c74,_0x47a6ad,_0x3b799e,_0x1c04a4,_0x14802a,_0x14f896,_0x17b484){var _0xf4fcab=_[_0xd283('0x11')](_0x47a6ad);_0xf4fcab['queue_id']=_0x17b484;_0xf4fcab[_0xd283('0xd')]=_0x5e1c74;_0xf4fcab[_0xd283('0xc')]=_0x3b799e;_0xf4fcab['id']=_0x1c04a4;if(_0x14802a){_0x14f896[util[_0xd283('0x12')]('%sQueuesWaitingInteractions',_0x24c703)][_0x1c04a4]=_[_0xd283('0x13')](_0xf4fcab,attributes);}else{delete _0x14f896[util[_0xd283('0x12')](_0xd283('0x14'),_0x24c703)][_0x1c04a4];}emit(util[_0xd283('0x12')](_0xd283('0x15'),_0x24c703,_0x5e1c74),util['format'](_0xd283('0x16'),_0x24c703,_0x14802a?_0xd283('0x17'):'remove'),_[_0xd283('0x13')](_0xf4fcab,attributes));}var rpc={'openchannelQueueReport':require(_0xd283('0x18')),'mailQueueReport':require(_0xd283('0x19')),'chatQueueReport':require(_0xd283('0x1a')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0xd283('0x1b')),'whatsappQueueReport':require(_0xd283('0x1c'))};var queue=schema({'name':{'type':_0xd283('0x1d'),'required':!![],'message':_0xd283('0x1e')},'timeout':{'type':_0xd283('0x1f'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x361b57,_0x3a8904,_0x1d8737,_0x208ca1){if(_0x361b57&&_0x3a8904&&_0x1d8737){_0x3a8904[_0xd283('0x20')]+=0x1;var _0x2e2813={'uniqueid':_0x361b57,'from':_0x1d8737[_0xd283('0x21')]?_0x1d8737['body'][_0xd283('0xe')]:'','joinAt':moment()[_0xd283('0x12')](_0xd283('0x22')),'ContactId':_0x1d8737[_0xd283('0x23')]?_0x1d8737[_0xd283('0x23')]['id']:null,'ListId':_0x1d8737[_0xd283('0x24')]?_0x1d8737[_0xd283('0x24')]['id']:null};_0x2e2813[_[_0xd283('0x25')](_0x1d8737[_0xd283('0x26')])+'QueueId']=_0x3a8904['id']||null;_0x2e2813[_[_0xd283('0x25')](_0x1d8737[_0xd283('0x26')])+_0xd283('0x27')]=_0x1d8737[_0xd283('0x28')]?_0x1d8737[_0xd283('0x28')]['id']:null;_0x2e2813[_['upperFirst'](_0x1d8737[_0xd283('0x26')])+_0xd283('0x29')]=_0x1d8737[_0xd283('0x2a')]?_0x1d8737[_0xd283('0x2a')]['id']:null;_0x2e2813[_[_0xd283('0x25')](_0x1d8737[_0xd283('0x26')])+(_0x1d8737['channel']!==_0xd283('0x2b')?_0xd283('0x2c'):_0xd283('0x2d'))]=_0x1d8737[_0xd283('0xc')]?_0x1d8737[_0xd283('0xc')]['id']:null;logger['info'](util['format']('[%s][START:QUEUE][NAME:%s]',_0x361b57,_0x3a8904[_0xd283('0x2e')]));emitChannelQueueInteraction(_0x1d8737[_0xd283('0x26')],_0x3a8904[_0xd283('0x2e')],_0x2e2813,_0x1d8737[_0xd283('0xc')]['name'],_0x1d8737[_0xd283('0x2a')]['id'],!![],_0x208ca1,_0x3a8904['id']);if(rpc[_0x1d8737[_0xd283('0x26')]+_0xd283('0x2f')]){return rpc[_0x1d8737[_0xd283('0x26')]+_0xd283('0x2f')][_0xd283('0x30')](_0x2e2813)[_0xd283('0x31')](function(_0x26d9eb){logger[_0xd283('0x32')]('create\x20queue\x20report');});}}}function stopRouting(_0x26a9d0,_0x1e3b89,_0x144d99,_0x501af3){if(_0x26a9d0&&_0x1e3b89){_0x1e3b89[_0xd283('0x20')]-=0x1;var _0x4c91f7={'leaveAt':moment()[_0xd283('0x12')](_0xd283('0x22')),'acceptAt':moment()[_0xd283('0x12')](_0xd283('0x22')),'reason':_0xd283('0x33')};logger[_0xd283('0x34')](util['format'](_0xd283('0x35'),_0x26a9d0,_0x1e3b89[_0xd283('0x2e')]));emitChannelQueueInteraction(_0x144d99[_0xd283('0x26')],_0x1e3b89['name'],_0x144d99[_0xd283('0x21')],_0x144d99[_0xd283('0xc')][_0xd283('0x2e')],_0x144d99[_0xd283('0x2a')]['id'],![],_0x501af3,_0x1e3b89['id']);if(rpc[_0x144d99[_0xd283('0x26')]+_0xd283('0x2f')]){return rpc[_0x144d99[_0xd283('0x26')]+'QueueReport'][_0xd283('0x36')](_0x26a9d0,_0x4c91f7)[_0xd283('0x31')](function(_0x4220ff){logger['error']('update\x20queue\x20report');});}}}function endRouting(_0x5b2e5e,_0x2bea1f,_0x4f5a50,_0x19047e){if(_0x5b2e5e&&_0x2bea1f){_0x2bea1f[_0xd283('0x20')]-=0x1;var _0x28f3f0={'leaveAt':moment()[_0xd283('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xd283('0x37')};logger[_0xd283('0x34')](util[_0xd283('0x12')]('[%s][END:QUEUE][NAME:%s]',_0x5b2e5e,_0x2bea1f['name']));emitChannelQueueInteraction(_0x4f5a50[_0xd283('0x26')],_0x2bea1f[_0xd283('0x2e')],_0x4f5a50[_0xd283('0x21')],_0x4f5a50[_0xd283('0xc')][_0xd283('0x2e')],_0x4f5a50[_0xd283('0x2a')]['id'],![],_0x19047e);if(rpc[_0x4f5a50[_0xd283('0x26')]+_0xd283('0x2f')]){return rpc[_0x4f5a50['channel']+_0xd283('0x2f')][_0xd283('0x36')](_0x5b2e5e,_0x28f3f0)[_0xd283('0x31')](function(_0x74a5f3){logger[_0xd283('0x32')](_0xd283('0x38'));});}}}function handleFindQueue(_0x36b88e){return function(_0x463cdd){return _0x463cdd['name']['toLowerCase']()===_0x36b88e[_0xd283('0x39')]();};}exports[_0xd283('0x3a')]=function(_0xe53e9f,_0x304896,_0x44c050,_0x3a0c38){return function(_0x25ac59){try{var _0x5792be={'name':_0x304896[0x0],'timeout':_0x304896[0x1]};var _0x52e634=queue['validate'](_0x5792be,{'typecast':!![]});if(_0x52e634[_0xd283('0x3b')]){logger[_0xd283('0x32')]('[%s][QUEUE]\x20%s',_0xe53e9f,_[_0xd283('0x3c')](_0x52e634,_0xd283('0x2a'))[_0xd283('0x3d')](',\x20'));_0x25ac59[_0xd283('0x3e')]();}else{var _0x4620c2=_[_0xd283('0x3f')](_0x44c050[_0x3a0c38[_0xd283('0x26')]+_0xd283('0x40')],handleFindQueue(_0x5792be[_0xd283('0x2e')]));if(_0x4620c2){startRouting(_0xe53e9f,_0x4620c2,_0x3a0c38,_0x44c050);var _0x33efc6=(_0x4620c2[_0xd283('0x37')]||0xa)*0x3e8;var _0xb285e=(_0x5792be['timeout']||0x14)*0x3e8;var _0x33a785,_0x4682de;if(_0x33efc6>_0xb285e){_0xb285e=_0x33efc6;}var _0x2f03f1=seqqueue[_0xd283('0x41')](_0x33efc6);_0x2f03f1['id']=_0xe53e9f;_0x2f03f1[_0xd283('0x42')]=_0x33efc6;_0x2f03f1[_0xd283('0x43')]=_0xb285e;_0x2f03f1[_0xd283('0x26')]=_0x3a0c38['channel'];_0x44c050[_0xd283('0x44')][_0xe53e9f]['on'](_0xd283('0x45'),function(){logger[_0xd283('0x34')](_0xd283('0x46'),_0xe53e9f);stopRouting(_0xe53e9f,_0x4620c2,_0x3a0c38,_0x44c050);clearTimeout(_0x33a785);_0x33a785=undefined;_0x2f03f1['close'](!![]);if(_0x44c050[_0xd283('0x44')][_0xe53e9f]){delete _0x44c050['rules'][_0xe53e9f];}_0x25ac59[_0xd283('0x3e')]();});_0x44c050[_0xd283('0x44')][_0xe53e9f]['on'](_0xd283('0x47'),function(){if(_0x44c050[_0xd283('0x44')][_0xe53e9f]){delete _0x44c050[_0xd283('0x44')][_0xe53e9f];}});_0x33a785=setTimeout(function(){logger[_0xd283('0x34')](_0xd283('0x48'),_0xe53e9f);endRouting(_0xe53e9f,_0x4620c2,_0x3a0c38,_0x44c050);clearTimeout(_0x33a785);_0x2f03f1[_0xd283('0x49')](!![]);_0x25ac59[_0xd283('0x4a')]();},_0xb285e);switch(_0x4620c2['strategy']){case _0xd283('0x4b'):strategy[_0xd283('0x4b')](_0x2f03f1,_0x4620c2,_0x44c050,_0x3a0c38);break;default:strategy[_0xd283('0x4c')](_0x2f03f1,_0x4620c2,_0x44c050,_0x3a0c38);}}else{logger[_0xd283('0x32')](_0xd283('0x4d'),_0xe53e9f,_0x5792be[_0xd283('0x2e')]);_0x25ac59[_0xd283('0x3e')]();}}}catch(_0x2b94ec){console[_0xd283('0x4e')](_0x2b94ec);logger[_0xd283('0x32')]('[%s][QUEUE]\x20%s',_0xe53e9f,_0x2b94ec['stack']);_0x25ac59[_0xd283('0x3e')]();}};}; \ No newline at end of file +var _0x29b4=['qtimeout','end','close','rules','complete','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','info','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','toLowerCase','consequence','[%s][QUEUE]\x20%s','join','stop','createQueue'];(function(_0xc1fac2,_0x725358){var _0x1a31f8=function(_0x22e4f3){while(--_0x22e4f3){_0xc1fac2['push'](_0xc1fac2['shift']());}};_0x1a31f8(++_0x725358);}(_0x29b4,0x183));var _0x429b=function(_0x140f8f,_0x3c84d2){_0x140f8f=_0x140f8f-0x0;var _0x485c30=_0x29b4[_0x140f8f];return _0x485c30;};'use strict';var schema=require(_0x429b('0x0'));var _=require(_0x429b('0x1'));var util=require(_0x429b('0x2'));var seqqueue=require(_0x429b('0x3'));var moment=require('moment');var Redis=require(_0x429b('0x4'));var config=require(_0x429b('0x5'));var logger=require(_0x429b('0x6'))(_0x429b('0x7'));var strategy=require(_0x429b('0x8'));config[_0x429b('0x9')]=_['defaults'](config[_0x429b('0x9')],{'host':_0x429b('0xa'),'port':0x18eb});var io=require(_0x429b('0xb'))(new Redis(config[_0x429b('0x9')]));var attributes=['id',_0x429b('0xc'),_0x429b('0xd'),_0x429b('0xe'),_0x429b('0xf'),_0x429b('0x10')];function emit(_0x1b32cf,_0x2ccb34,_0x3193b3){io['to'](_0x1b32cf)[_0x429b('0x11')](_0x2ccb34,_0x3193b3);}function emitChannelQueueInteraction(_0x1d40c2,_0x1ed3e6,_0x13e213,_0x32172d,_0x1c6846,_0x479c22,_0x217955,_0xc62acd){var _0x3fb0fc=_['clone'](_0x13e213);_0x3fb0fc[_0x429b('0xc')]=_0xc62acd;_0x3fb0fc[_0x429b('0xe')]=_0x1ed3e6;_0x3fb0fc[_0x429b('0xd')]=_0x32172d;_0x3fb0fc['id']=_0x1c6846;if(_0x479c22){_0x217955[util[_0x429b('0x12')](_0x429b('0x13'),_0x1d40c2)][_0x1c6846]=_[_0x429b('0x14')](_0x3fb0fc,attributes);}else{delete _0x217955[util[_0x429b('0x12')](_0x429b('0x13'),_0x1d40c2)][_0x1c6846];}emit(util[_0x429b('0x12')](_0x429b('0x15'),_0x1d40c2,_0x1ed3e6),util[_0x429b('0x12')](_0x429b('0x16'),_0x1d40c2,_0x479c22?_0x429b('0x17'):'remove'),_[_0x429b('0x14')](_0x3fb0fc,attributes));}var rpc={'openchannelQueueReport':require(_0x429b('0x18')),'mailQueueReport':require(_0x429b('0x19')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x429b('0x1a')),'faxQueueReport':require(_0x429b('0x1b')),'whatsappQueueReport':require(_0x429b('0x1c'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0x429b('0x1d')},'timeout':{'type':'number','message':_0x429b('0x1e')}});function startRouting(_0xdf2d5d,_0x2ae0d2,_0x5f01db,_0x449eab){if(_0xdf2d5d&&_0x2ae0d2&&_0x5f01db){_0x2ae0d2[_0x429b('0x1f')]+=0x1;var _0x2a1384={'uniqueid':_0xdf2d5d,'from':_0x5f01db[_0x429b('0x20')]?_0x5f01db['body']['from']:'','joinAt':moment()['format'](_0x429b('0x21')),'ContactId':_0x5f01db[_0x429b('0x22')]?_0x5f01db['contact']['id']:null,'ListId':_0x5f01db['list']?_0x5f01db['list']['id']:null};_0x2a1384[_[_0x429b('0x23')](_0x5f01db[_0x429b('0x24')])+_0x429b('0x25')]=_0x2ae0d2['id']||null;_0x2a1384[_[_0x429b('0x23')](_0x5f01db['channel'])+_0x429b('0x26')]=_0x5f01db[_0x429b('0x27')]?_0x5f01db[_0x429b('0x27')]['id']:null;_0x2a1384[_[_0x429b('0x23')](_0x5f01db['channel'])+_0x429b('0x28')]=_0x5f01db[_0x429b('0x29')]?_0x5f01db[_0x429b('0x29')]['id']:null;_0x2a1384[_['upperFirst'](_0x5f01db['channel'])+(_0x5f01db['channel']!=='chat'?_0x429b('0x2a'):_0x429b('0x2b'))]=_0x5f01db['account']?_0x5f01db[_0x429b('0xd')]['id']:null;logger['info'](util[_0x429b('0x12')](_0x429b('0x2c'),_0xdf2d5d,_0x2ae0d2[_0x429b('0x2d')]));emitChannelQueueInteraction(_0x5f01db[_0x429b('0x24')],_0x2ae0d2['name'],_0x2a1384,_0x5f01db['account'][_0x429b('0x2d')],_0x5f01db[_0x429b('0x29')]['id'],!![],_0x449eab,_0x2ae0d2['id']);if(rpc[_0x5f01db[_0x429b('0x24')]+'QueueReport']){return rpc[_0x5f01db[_0x429b('0x24')]+_0x429b('0x2e')][_0x429b('0x2f')](_0x2a1384)[_0x429b('0x30')](function(_0x4b23c0){logger[_0x429b('0x31')](_0x429b('0x32'));});}}}function stopRouting(_0xb7aa02,_0x6b81e,_0x2b57f7,_0x20fdcf){if(_0xb7aa02&&_0x6b81e){_0x6b81e[_0x429b('0x1f')]-=0x1;var _0x1970fc={'leaveAt':moment()[_0x429b('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x429b('0x12')](_0x429b('0x21')),'reason':_0x429b('0x33')};logger[_0x429b('0x34')](util['format'](_0x429b('0x35'),_0xb7aa02,_0x6b81e[_0x429b('0x2d')]));emitChannelQueueInteraction(_0x2b57f7[_0x429b('0x24')],_0x6b81e[_0x429b('0x2d')],_0x2b57f7[_0x429b('0x20')],_0x2b57f7['account'][_0x429b('0x2d')],_0x2b57f7['message']['id'],![],_0x20fdcf,_0x6b81e['id']);if(rpc[_0x2b57f7[_0x429b('0x24')]+_0x429b('0x2e')]){return rpc[_0x2b57f7[_0x429b('0x24')]+'QueueReport'][_0x429b('0x36')](_0xb7aa02,_0x1970fc)[_0x429b('0x30')](function(_0x26db83){logger['error'](_0x429b('0x37'));});}}}function endRouting(_0x265e33,_0xbb432e,_0x396d69,_0x5cfdc6){if(_0x265e33&&_0xbb432e){_0xbb432e[_0x429b('0x1f')]-=0x1;var _0x50b0a9={'leaveAt':moment()[_0x429b('0x12')](_0x429b('0x21')),'exitAt':moment()[_0x429b('0x12')](_0x429b('0x21')),'reason':_0x429b('0x38')};logger['info'](util[_0x429b('0x12')]('[%s][END:QUEUE][NAME:%s]',_0x265e33,_0xbb432e[_0x429b('0x2d')]));emitChannelQueueInteraction(_0x396d69[_0x429b('0x24')],_0xbb432e[_0x429b('0x2d')],_0x396d69['body'],_0x396d69[_0x429b('0xd')][_0x429b('0x2d')],_0x396d69[_0x429b('0x29')]['id'],![],_0x5cfdc6);if(rpc[_0x396d69['channel']+_0x429b('0x2e')]){return rpc[_0x396d69[_0x429b('0x24')]+_0x429b('0x2e')]['update'](_0x265e33,_0x50b0a9)[_0x429b('0x30')](function(_0x3653aa){logger[_0x429b('0x31')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x2111ae){return function(_0x2033b1){return _0x2033b1[_0x429b('0x2d')]['toLowerCase']()===_0x2111ae[_0x429b('0x39')]();};}exports[_0x429b('0x3a')]=function(_0x42dd35,_0x3a2724,_0xadea41,_0x4ba445){return function(_0x41838a){try{var _0x1d6f68={'name':_0x3a2724[0x0],'timeout':_0x3a2724[0x1]};var _0x20c39d=queue[_0x429b('0x0')](_0x1d6f68,{'typecast':!![]});if(_0x20c39d['length']){logger[_0x429b('0x31')](_0x429b('0x3b'),_0x42dd35,_['map'](_0x20c39d,_0x429b('0x29'))[_0x429b('0x3c')](',\x20'));_0x41838a[_0x429b('0x3d')]();}else{var _0x1f56b1=_['find'](_0xadea41[_0x4ba445[_0x429b('0x24')]+'Queues'],handleFindQueue(_0x1d6f68['name']));if(_0x1f56b1){startRouting(_0x42dd35,_0x1f56b1,_0x4ba445,_0xadea41);var _0x2e38f5=(_0x1f56b1[_0x429b('0x38')]||0xa)*0x3e8;var _0x2dc12f=(_0x1d6f68[_0x429b('0x38')]||0x14)*0x3e8;var _0x260bee,_0x3cae63;if(_0x2e38f5>_0x2dc12f){_0x2dc12f=_0x2e38f5;}var _0x12890a=seqqueue[_0x429b('0x3e')](_0x2e38f5);_0x12890a['id']=_0x42dd35;_0x12890a['atimeout']=_0x2e38f5;_0x12890a[_0x429b('0x3f')]=_0x2dc12f;_0x12890a[_0x429b('0x24')]=_0x4ba445[_0x429b('0x24')];_0xadea41['rules'][_0x42dd35]['on'](_0x429b('0x40'),function(){logger['info']('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x42dd35);stopRouting(_0x42dd35,_0x1f56b1,_0x4ba445,_0xadea41);clearTimeout(_0x260bee);_0x260bee=undefined;_0x12890a[_0x429b('0x41')](!![]);if(_0xadea41['rules'][_0x42dd35]){delete _0xadea41[_0x429b('0x42')][_0x42dd35];}_0x41838a[_0x429b('0x3d')]();});_0xadea41[_0x429b('0x42')][_0x42dd35]['on'](_0x429b('0x43'),function(){if(_0xadea41[_0x429b('0x42')][_0x42dd35]){delete _0xadea41['rules'][_0x42dd35];}});_0x260bee=setTimeout(function(){logger[_0x429b('0x34')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x42dd35);endRouting(_0x42dd35,_0x1f56b1,_0x4ba445,_0xadea41);clearTimeout(_0x260bee);_0x12890a['close'](!![]);_0x41838a[_0x429b('0x44')]();},_0x2dc12f);switch(_0x1f56b1[_0x429b('0x45')]){case'rrmemory':strategy[_0x429b('0x46')](_0x12890a,_0x1f56b1,_0xadea41,_0x4ba445);break;default:strategy[_0x429b('0x47')](_0x12890a,_0x1f56b1,_0xadea41,_0x4ba445);}}else{logger[_0x429b('0x31')](_0x429b('0x48'),_0x42dd35,_0x1d6f68[_0x429b('0x2d')]);_0x41838a['stop']();}}}catch(_0x51fb5a){console[_0x429b('0x49')](_0x51fb5a);logger['error']('[%s][QUEUE]\x20%s',_0x42dd35,_0x51fb5a[_0x429b('0x4a')]);_0x41838a['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 0e97dcd..ff504ed 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 _0xb34e=['bind','handleTimeout','timeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','realtime','agents','channel','busyQueue','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','busy','writeLog','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','push','handleRun'];(function(_0x5a0876,_0x1e363e){var _0x55969f=function(_0x3e12ce){while(--_0x3e12ce){_0x5a0876['push'](_0x5a0876['shift']());}};_0x55969f(++_0x1e363e);}(_0xb34e,0x129));var _0xeb34=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xb34e[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0xeb34('0x0'));var uuid=require(_0xeb34('0x1'));var util=require(_0xeb34('0x2'));var logger=require(_0xeb34('0x3'))(_0xeb34('0x4'));var Agent=function(_0x1c30ec,_0x2e7b95,_0x10b975,_0x29a130){this[_0xeb34('0x5')]=uuid['v4']();this[_0xeb34('0x6')]=_0x1c30ec;this['agent']=_0x2e7b95;this['realtime']=_0x10b975;this['routing']=_0x29a130;this[_0xeb34('0x6')][_0xeb34('0x7')](this[_0xeb34('0x8')][_0xeb34('0x9')](this),this[_0xeb34('0xa')][_0xeb34('0x9')](this));this['squeue']['on'](_0xeb34('0xb'),this[_0xeb34('0xa')][_0xeb34('0x9')](this));this[_0xeb34('0x6')]['on'](_0xeb34('0xc'),this[_0xeb34('0xd')]['bind'](this));};Agent[_0xeb34('0xe')][_0xeb34('0x7')]=function(){this[_0xeb34('0x6')][_0xeb34('0x7')](this[_0xeb34('0x8')][_0xeb34('0x9')](this),this[_0xeb34('0xa')][_0xeb34('0x9')](this));};Agent['prototype'][_0xeb34('0xd')]=function(){this[_0xeb34('0xa')](!![]);};Agent[_0xeb34('0xe')][_0xeb34('0x8')]=function(_0x55c916){logger[_0xeb34('0xf')](_0xeb34('0x10'),this[_0xeb34('0x6')]['id'],this[_0xeb34('0x11')]['id']);if(_[_0xeb34('0x12')](this['realtime']['agents'][this['agent']['id']])){logger['info'](_0xeb34('0x13'),this[_0xeb34('0x6')]['id'],this[_0xeb34('0x11')]['id']);setTimeout(this['push'][_0xeb34('0x9')](this),0x3e8);}else{if(this[_0xeb34('0x4')]['forcedOwnership']||util[_0xeb34('0x14')](this[_0xeb34('0x6')]['id'],this[_0xeb34('0x15')][_0xeb34('0x16')][this[_0xeb34('0x11')]['id']],this[_0xeb34('0x6')][_0xeb34('0x17')],![])){this[_0xeb34('0x15')][_0xeb34('0x16')][this[_0xeb34('0x11')]['id']]['busy']=!![];this[_0xeb34('0x15')][_0xeb34('0x16')][this['agent']['id']][_0xeb34('0x18')]=undefined;util['showNotification'](this['notificationId'],this[_0xeb34('0x6')]['id'],this[_0xeb34('0x15')][_0xeb34('0x16')][this[_0xeb34('0x11')]['id']],null,this['routing']);util['writeLog'](this[_0xeb34('0x6')]['id'],this[_0xeb34('0x15')][_0xeb34('0x16')][this[_0xeb34('0x11')]['id']],_0xeb34('0x19')+(this[_0xeb34('0x4')]['forcedOwnership']?_0xeb34('0x1a'):''));}else{logger[_0xeb34('0xf')](_0xeb34('0x1b'),this[_0xeb34('0x6')]['id'],this['agent']['id']);setTimeout(this[_0xeb34('0x7')]['bind'](this),0x3e8);}}};Agent[_0xeb34('0xe')]['handleTimeout']=function(_0x4b92ec){if(_[_0xeb34('0x12')](this['realtime'][_0xeb34('0x16')][this[_0xeb34('0x11')]['id']])){return logger[_0xeb34('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xeb34('0x6')]['id'],this['agent']['id']);}else{logger[_0xeb34('0xf')](_0xeb34('0x1c'),this[_0xeb34('0x6')]['id'],this[_0xeb34('0x11')]['id']);util['hideNotification'](this[_0xeb34('0x5')],this[_0xeb34('0x6')]['id'],this[_0xeb34('0x15')][_0xeb34('0x16')][this['agent']['id']],null,this[_0xeb34('0x4')]);this[_0xeb34('0x15')][_0xeb34('0x16')][this[_0xeb34('0x11')]['id']][_0xeb34('0x1d')]=![];this['realtime']['agents'][this[_0xeb34('0x11')]['id']][_0xeb34('0x18')]=undefined;util[_0xeb34('0x1e')](this[_0xeb34('0x6')]['id'],this[_0xeb34('0x15')]['agents'][this[_0xeb34('0x11')]['id']],_0x4b92ec?_0xeb34('0x1f'):_0xeb34('0x20'));}if(!_0x4b92ec){setTimeout(this['push'][_0xeb34('0x9')](this),0x3e8);}};function agent(_0x9e4d5c,_0x35e309,_0x4848d5,_0x23c283){return new Agent(_0x9e4d5c,_0x35e309,_0x4848d5,_0x23c283);}module[_0xeb34('0x21')]=agent; \ No newline at end of file +var _0x9cb0=['TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','agents','forcedOwnership','isAgentAvailable','channel','busyQueue','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','busy','writeLog','STOP'];(function(_0x9e55f6,_0x5df434){var _0x220e55=function(_0x1fd729){while(--_0x1fd729){_0x9e55f6['push'](_0x9e55f6['shift']());}};_0x220e55(++_0x5df434);}(_0x9cb0,0x86));var _0x09cb=function(_0x547add,_0x387042){_0x547add=_0x547add-0x0;var _0x2ed1f3=_0x9cb0[_0x547add];return _0x2ed1f3;};'use strict';var _=require(_0x09cb('0x0'));var uuid=require(_0x09cb('0x1'));var util=require(_0x09cb('0x2'));var logger=require(_0x09cb('0x3'))(_0x09cb('0x4'));var Agent=function(_0x558492,_0xdbce7c,_0x51ed66,_0x1837e2){this[_0x09cb('0x5')]=uuid['v4']();this[_0x09cb('0x6')]=_0x558492;this[_0x09cb('0x7')]=_0xdbce7c;this[_0x09cb('0x8')]=_0x51ed66;this[_0x09cb('0x4')]=_0x1837e2;this[_0x09cb('0x6')][_0x09cb('0x9')](this[_0x09cb('0xa')][_0x09cb('0xb')](this),this[_0x09cb('0xc')][_0x09cb('0xb')](this));this[_0x09cb('0x6')]['on'](_0x09cb('0xd'),this[_0x09cb('0xc')]['bind'](this));this['squeue']['on'](_0x09cb('0xe'),this[_0x09cb('0xf')][_0x09cb('0xb')](this));};Agent[_0x09cb('0x10')][_0x09cb('0x9')]=function(){this[_0x09cb('0x6')][_0x09cb('0x9')](this['handleRun']['bind'](this),this[_0x09cb('0xc')]['bind'](this));};Agent[_0x09cb('0x10')]['handleDrained']=function(){this[_0x09cb('0xc')](!![]);};Agent[_0x09cb('0x10')][_0x09cb('0xa')]=function(_0x4b7495){logger[_0x09cb('0x11')](_0x09cb('0x12'),this[_0x09cb('0x6')]['id'],this['agent']['id']);if(_['isNil'](this[_0x09cb('0x8')][_0x09cb('0x13')][this[_0x09cb('0x7')]['id']])){logger[_0x09cb('0x11')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x09cb('0x6')]['id'],this['agent']['id']);setTimeout(this[_0x09cb('0x9')][_0x09cb('0xb')](this),0x3e8);}else{if(this[_0x09cb('0x4')][_0x09cb('0x14')]||util[_0x09cb('0x15')](this[_0x09cb('0x6')]['id'],this[_0x09cb('0x8')][_0x09cb('0x13')][this['agent']['id']],this[_0x09cb('0x6')][_0x09cb('0x16')],![])){this[_0x09cb('0x8')][_0x09cb('0x13')][this[_0x09cb('0x7')]['id']]['busy']=!![];this[_0x09cb('0x8')][_0x09cb('0x13')][this[_0x09cb('0x7')]['id']][_0x09cb('0x17')]=undefined;util['showNotification'](this[_0x09cb('0x5')],this[_0x09cb('0x6')]['id'],this[_0x09cb('0x8')]['agents'][this[_0x09cb('0x7')]['id']],null,this['routing']);util['writeLog'](this[_0x09cb('0x6')]['id'],this[_0x09cb('0x8')][_0x09cb('0x13')][this[_0x09cb('0x7')]['id']],'RINGING'+(this[_0x09cb('0x4')][_0x09cb('0x14')]?':FORCED':''));}else{logger[_0x09cb('0x11')](_0x09cb('0x18'),this['squeue']['id'],this[_0x09cb('0x7')]['id']);setTimeout(this[_0x09cb('0x9')][_0x09cb('0xb')](this),0x3e8);}}};Agent[_0x09cb('0x10')][_0x09cb('0xc')]=function(_0x4f02a7){if(_[_0x09cb('0x19')](this['realtime'][_0x09cb('0x13')][this['agent']['id']])){return logger[_0x09cb('0x11')](_0x09cb('0x1a'),this[_0x09cb('0x6')]['id'],this[_0x09cb('0x7')]['id']);}else{logger['info']('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x09cb('0x6')]['id'],this['agent']['id']);util[_0x09cb('0x1b')](this[_0x09cb('0x5')],this[_0x09cb('0x6')]['id'],this[_0x09cb('0x8')][_0x09cb('0x13')][this[_0x09cb('0x7')]['id']],null,this[_0x09cb('0x4')]);this['realtime'][_0x09cb('0x13')][this[_0x09cb('0x7')]['id']][_0x09cb('0x1c')]=![];this[_0x09cb('0x8')][_0x09cb('0x13')][this['agent']['id']][_0x09cb('0x17')]=undefined;util[_0x09cb('0x1d')](this['squeue']['id'],this[_0x09cb('0x8')][_0x09cb('0x13')][this[_0x09cb('0x7')]['id']],_0x4f02a7?_0x09cb('0x1e'):_0x09cb('0x1f'));}if(!_0x4f02a7){setTimeout(this[_0x09cb('0x9')][_0x09cb('0xb')](this),0x3e8);}};function agent(_0x30a425,_0x2944fa,_0x293926,_0x1d8255){return new Agent(_0x30a425,_0x2944fa,_0x293926,_0x1d8255);}module[_0x09cb('0x20')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 2e79158..7100fe2 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 _0xf3cc=['name','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','hideNotification','STOP','TIMEOUT','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','realtime','routing','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','queue','Agents','length','isNil','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','writeLog','RINGING','busy','busyQueue'];(function(_0x2c6717,_0x240ba5){var _0x5395f6=function(_0x4184c5){while(--_0x4184c5){_0x2c6717['push'](_0x2c6717['shift']());}};_0x5395f6(++_0x240ba5);}(_0xf3cc,0x10d));var _0xcf3c=function(_0x20beae,_0x5eac6d){_0x20beae=_0x20beae-0x0;var _0xf5725=_0xf3cc[_0x20beae];return _0xf5725;};'use strict';var _=require(_0xcf3c('0x0'));var uuid=require(_0xcf3c('0x1'));var util=require(_0xcf3c('0x2'));var logger=require(_0xcf3c('0x3'))('routing');var Beepall=function(_0x3b60ce,_0x14ec9a,_0x2bc6a3,_0x582153){this[_0xcf3c('0x4')]=uuid['v4']();this[_0xcf3c('0x5')]=_0x3b60ce;this['queue']=_0x14ec9a;this[_0xcf3c('0x6')]=_0x2bc6a3;this[_0xcf3c('0x7')]=_0x582153;this[_0xcf3c('0x5')][_0xcf3c('0x8')](this[_0xcf3c('0x9')][_0xcf3c('0xa')](this),this[_0xcf3c('0xb')][_0xcf3c('0xa')](this));this[_0xcf3c('0x5')]['on'](_0xcf3c('0xc'),this['handleTimeout']['bind'](this));this[_0xcf3c('0x5')]['on'](_0xcf3c('0xd'),this[_0xcf3c('0xe')][_0xcf3c('0xa')](this));};Beepall[_0xcf3c('0xf')][_0xcf3c('0x8')]=function(){this[_0xcf3c('0x5')][_0xcf3c('0x8')](this['handleRun'][_0xcf3c('0xa')](this),this[_0xcf3c('0xb')]['bind'](this));};Beepall[_0xcf3c('0xf')]['handleDrained']=function(_0x55ef34){this['handleTimeout'](!![]);};Beepall[_0xcf3c('0xf')]['handleRun']=function(_0x2f387b){var _0x1a3565=!![];if(!_['isNil'](this[_0xcf3c('0x10')])&&!_['isNil'](this[_0xcf3c('0x10')][_0xcf3c('0x11')])&&this[_0xcf3c('0x10')]['Agents'][_0xcf3c('0x12')]>0x0){for(var _0x190c8c=0x0,_0x395159;_0x190c8c0x0){for(var _0x4244b3=0x0,_0x41e598;_0x4244b30x0&&_0x56b91e[_0x5713e4+_0x2254('0x22')]>=_0x56b91e[_0x5713e4+'Capacity']){writeLog(_0xf88b56,_0x56b91e,_0x5713e4[_0x2254('0x23')]()+_0x2254('0x24'));return![];}}return!![];};exports[_0x2254('0x25')]=function(_0x3aa0bd,_0x19043b,_0x482688,_0x1a8a0d,_0x2a789b){return sendNotification(!![],_0x3aa0bd,_0x19043b,_0x482688,_0x1a8a0d,_0x2a789b);};exports[_0x2254('0x26')]=function(_0x37af8b,_0x13366a,_0x377c41,_0x3214a7,_0x22e791){return sendNotification(![],_0x37af8b,_0x13366a,_0x377c41,_0x3214a7,_0x22e791);};exports[_0x2254('0x27')]=writeLog; \ No newline at end of file +var _0x4888=['busy','BUSY','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','showNotification','hideNotification','util','../utils','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','defaults','redis','localhost','socket.io-emitter','format','user:%s','emit','user:save','split','\x20interaction','name','account','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable'];(function(_0xd8ccc,_0x59e017){var _0x4ce783=function(_0x4afa7d){while(--_0x4afa7d){_0xd8ccc['push'](_0xd8ccc['shift']());}};_0x4ce783(++_0x59e017);}(_0x4888,0x198));var _0x8488=function(_0x46361e,_0x243aaf){_0x46361e=_0x46361e-0x0;var _0x14e302=_0x4888[_0x46361e];return _0x14e302;};'use strict';var _=require('lodash');var util=require(_0x8488('0x0'));var utils=require(_0x8488('0x1'));var Mustache=require(_0x8488('0x2'));var Redis=require(_0x8488('0x3'));var config=require(_0x8488('0x4'));var logger=require(_0x8488('0x5'))(_0x8488('0x6'));config['redis']=_[_0x8488('0x7')](config[_0x8488('0x8')],{'host':_0x8488('0x9'),'port':0x18eb});var io=require(_0x8488('0xa'))(new Redis(config[_0x8488('0x8')]));function emit(_0x19e508,_0x5250a1,_0x5b30a7){io['to'](_0x19e508)['emit'](_0x5250a1,_0x5b30a7);}function sendNotification(_0x568a82,_0x151528,_0x1bae81,_0x542bd8,_0x19c994,_0x1334fe){io['to'](util[_0x8488('0xb')](_0x8488('0xc'),_0x542bd8['name']))[_0x8488('0xd')](_0x8488('0xe'),_0x542bd8);var _0x468896=_0x1334fe||{};var _0x256bab=_0x1bae81[_0x8488('0xf')]('.');var _0x50ea94={'uniqueid':_0x151528,'channel':_0x256bab[0x0],'id':_0x256bab[0x1],'title':_0x256bab[0x0]+_0x8488('0x10'),'interactionId':_0x256bab[0x2],'queue':_0x19c994?_0x19c994[_0x8488('0x11')]:null,'sound':_0x468896['account']['notificationSound'],'shake':_0x468896[_0x8488('0x12')]['notificationShake']};try{if(!_0x468896[_0x8488('0x13')]){_0x468896['body']={};}if(_0x19c994){_0x468896['body'][_0x8488('0x14')]=_0x19c994;}else if(_0x468896[_0x8488('0x13')][_0x8488('0x14')]){delete _0x468896[_0x8488('0x13')][_0x8488('0x14')];}_0x50ea94[_0x8488('0x15')]=utils[_0x8488('0x16')](_0x468896['account'][_0x8488('0x17')],_0x468896);}catch(_0x322264){_0x50ea94[_0x8488('0x15')]=_0x8488('0x18');logger[_0x8488('0x19')](util[_0x8488('0xb')](_0x8488('0x1a'),_0x151528,_0x322264[_0x8488('0x1b')]));}io['to'](util[_0x8488('0xb')](_0x8488('0xc'),_0x542bd8[_0x8488('0x11')]))[_0x8488('0xd')](util[_0x8488('0xb')]('notification:%s',_0x568a82?'save':_0x8488('0x1c')),_0x50ea94);}function writeLog(_0x12d40f,_0xbb10fe,_0x3c9fc2){return logger[_0x8488('0x1d')](util[_0x8488('0xb')](_0x8488('0x1e'),_0x12d40f,_0xbb10fe[_0x8488('0x11')],_0x3c9fc2));}exports[_0x8488('0x1f')]=function(_0x5123d0,_0x476a14,_0x4e07e1,_0x140b0b){if(_0x476a14[_0x8488('0x20')]){writeLog(_0x5123d0,_0x476a14,_0x8488('0x21'));return![];}if(!_0x476a14['online']){writeLog(_0x5123d0,_0x476a14,'OFFLINE');return![];}if(_0x476a14[_0x4e07e1+'Pause']){writeLog(_0x5123d0,_0x476a14,'PAUSE');return![];}if(_0x140b0b&&_0x476a14[_0x8488('0x22')](_0x4e07e1+'Capacity')&&_0x476a14['hasOwnProperty'](_0x4e07e1+_0x8488('0x23'))){if(_0x476a14[_0x4e07e1+_0x8488('0x24')]>0x0&&_0x476a14[_0x4e07e1+_0x8488('0x23')]>=_0x476a14[_0x4e07e1+_0x8488('0x24')]){writeLog(_0x5123d0,_0x476a14,_0x4e07e1[_0x8488('0x25')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x8488('0x26')]=function(_0x38c137,_0xf9720e,_0x3df1f9,_0x460001,_0x27f5cf){return sendNotification(!![],_0x38c137,_0xf9720e,_0x3df1f9,_0x460001,_0x27f5cf);};exports[_0x8488('0x27')]=function(_0x296b6c,_0x368f9c,_0x1d9317,_0x888b24,_0x58d0cc){return sendNotification(![],_0x296b6c,_0x368f9c,_0x1d9317,_0x888b24,_0x58d0cc);};exports['writeLog']=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 7da4617..771321c 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 _0xf24a=['[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','body'];(function(_0xaf1037,_0x4b5016){var _0x33c39f=function(_0x2cbed7){while(--_0x2cbed7){_0xaf1037['push'](_0xaf1037['shift']());}};_0x33c39f(++_0x4b5016);}(_0xf24a,0x17d));var _0xaf24=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf24a[_0x321bb2];return _0x9c12ed;};'use strict';var schema=require(_0xaf24('0x0'));var sh=require(_0xaf24('0x1'));var _=require(_0xaf24('0x2'));var utils=require(_0xaf24('0x3'));var logger=require(_0xaf24('0x4'))(_0xaf24('0x5'));var system=schema({'command':{'type':'string','required':!![],'message':_0xaf24('0x6')}});exports[_0xaf24('0x7')]=function(_0x162c99,_0x33aa5b){return function(_0x8f121e){try{var _0x49d418={'command':_0x33aa5b[0x0]};var _0x905b93=system[_0xaf24('0x0')](_0x49d418,{'typecast':!![]});if(_0x905b93[_0xaf24('0x8')]){logger[_0xaf24('0x9')](_0xaf24('0xa'),_0x162c99,_[_0xaf24('0xb')](_0x905b93,'message')[_0xaf24('0xc')](',\x20'));logger[_0xaf24('0xd')](_0xaf24('0xe'),_0x162c99);_0x8f121e[_0xaf24('0xf')]();}else{var _0x5c981d=this;var _0x4302d4=utils[_0xaf24('0x10')](_0x33aa5b[0x0],this);logger[_0xaf24('0xd')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x162c99,_0x4302d4);sh[_0xaf24('0x11')](_[_0xaf24('0x12')](_0x4302d4),function(_0x237dfa,_0x51958a){logger[_0xaf24('0xd')](_0xaf24('0x13'),_0x162c99,_0x237dfa);if(_0x237dfa==0x0){var _0x5da6da=_0x51958a[_0xaf24('0x14')](/(\r\n|\n|\r)/gm,'');if(_[_0xaf24('0x15')](_0x33aa5b[0x1])||_[_0xaf24('0x16')](_0x33aa5b[0x1])){logger[_0xaf24('0xd')]('[%s][SYSTEM]\x20no\x20variable',_0x162c99);_0x5c981d[_0xaf24('0x17')][_0x33aa5b[0x1]]=_0x5da6da;}else{logger[_0xaf24('0xd')](_0xaf24('0x18'),_0x162c99,_0x33aa5b[0x1],_0x5da6da);_0x5c981d[_0xaf24('0x17')][_0x33aa5b[0x1]]=_0x5da6da;}}_0x8f121e[_0xaf24('0xf')]();});}}catch(_0x225d5f){logger[_0xaf24('0x9')]('[%s][SYSTEM]\x20%s',_0x162c99,_[_0xaf24('0x19')](_0x225d5f)?JSON[_0xaf24('0x1a')](_0x225d5f):_0x225d5f);logger[_0xaf24('0xd')](_0xaf24('0xe'),_0x162c99);_0x8f121e[_0xaf24('0xf')]();}};}; \ No newline at end of file +var _0xdff5=['[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','isObject','stringify','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','error','[%s][SYSTEM]\x20%s','map','message','join'];(function(_0x1ebeea,_0x2f54f4){var _0x576465=function(_0x47fc77){while(--_0x47fc77){_0x1ebeea['push'](_0x1ebeea['shift']());}};_0x576465(++_0x2f54f4);}(_0xdff5,0x100));var _0x5dff=function(_0x29da7c,_0x8fe26){_0x29da7c=_0x29da7c-0x0;var _0x43d535=_0xdff5[_0x29da7c];return _0x43d535;};'use strict';var schema=require('validate');var sh=require(_0x5dff('0x0'));var _=require(_0x5dff('0x1'));var utils=require(_0x5dff('0x2'));var logger=require(_0x5dff('0x3'))(_0x5dff('0x4'));var system=schema({'command':{'type':_0x5dff('0x5'),'required':!![],'message':_0x5dff('0x6')}});exports[_0x5dff('0x7')]=function(_0x2b7fd2,_0x16cff8){return function(_0x307342){try{var _0x490fdd={'command':_0x16cff8[0x0]};var _0x5999bc=system[_0x5dff('0x8')](_0x490fdd,{'typecast':!![]});if(_0x5999bc['length']){logger[_0x5dff('0x9')](_0x5dff('0xa'),_0x2b7fd2,_[_0x5dff('0xb')](_0x5999bc,_0x5dff('0xc'))[_0x5dff('0xd')](',\x20'));logger['info'](_0x5dff('0xe'),_0x2b7fd2);_0x307342[_0x5dff('0xf')]();}else{var _0x5895ff=this;var _0xc9d0f8=utils['getMustacheRender'](_0x16cff8[0x0],this);logger[_0x5dff('0x10')](_0x5dff('0x11'),_0x2b7fd2,_0xc9d0f8);sh[_0x5dff('0x12')](_[_0x5dff('0x13')](_0xc9d0f8),function(_0x30bf47,_0x3e7a95){logger[_0x5dff('0x10')](_0x5dff('0x14'),_0x2b7fd2,_0x30bf47);if(_0x30bf47==0x0){var _0xa68b46=_0x3e7a95[_0x5dff('0x15')](/(\r\n|\n|\r)/gm,'');if(_[_0x5dff('0x16')](_0x16cff8[0x1])||_['isEmpty'](_0x16cff8[0x1])){logger[_0x5dff('0x10')](_0x5dff('0x17'),_0x2b7fd2);_0x5895ff['body'][_0x16cff8[0x1]]=_0xa68b46;}else{logger[_0x5dff('0x10')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x2b7fd2,_0x16cff8[0x1],_0xa68b46);_0x5895ff[_0x5dff('0x18')][_0x16cff8[0x1]]=_0xa68b46;}}_0x307342['next']();});}}catch(_0x383c9c){logger[_0x5dff('0x9')]('[%s][SYSTEM]\x20%s',_0x2b7fd2,_[_0x5dff('0x19')](_0x383c9c)?JSON[_0x5dff('0x1a')](_0x383c9c):_0x383c9c);logger[_0x5dff('0x10')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x2b7fd2);_0x307342[_0x5dff('0xf')]();}};}; \ 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 2ec0038..5ad4d26 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 _0x07f4=['message','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','stringify','info','finally','next','isObject','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','[%s][TAG]\x20%s','map'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x07f4,0xd6));var _0x407f=function(_0x408b33,_0x26be88){_0x408b33=_0x408b33-0x0;var _0x47357e=_0x07f4[_0x408b33];return _0x47357e;};'use strict';var schema=require('validate');var _=require('lodash');var rpc={'chatInteraction':require(_0x407f('0x0')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x407f('0x1')),'mailInteraction':require(_0x407f('0x2')),'faxInteraction':require(_0x407f('0x3')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')(_0x407f('0x4'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x407f('0x5')}});exports[_0x407f('0x6')]=function(_0x4bb479,_0x18fb3b,_0x711c7b,_0x3aee99){return function(_0x13d600){try{var _0x20667c={'tag':_0x18fb3b[0x0]};var _0x12a1fc=tag[_0x407f('0x7')](_0x20667c,{'typecast':!![]});if(_0x12a1fc[_0x407f('0x8')]){logger['error'](_0x407f('0x9'),_0x4bb479,_[_0x407f('0xa')](_0x12a1fc,_0x407f('0xb'))['join'](',\x20'));logger['info'](_0x407f('0xc'),_0x4bb479);_0x13d600['next']();}else{var _0x51a7d2={'ids':[_0x18fb3b[0x0]]};if(rpc[_0x3aee99[_0x407f('0xd')]+_0x407f('0xe')]){rpc[_0x3aee99[_0x407f('0xd')]+'Interaction'][_0x407f('0xf')](_0x3aee99[_0x407f('0x10')]['id'],_0x51a7d2)['then'](function(_0x5c052e){logger['info'](_0x407f('0x11'),_0x4bb479,_0x18fb3b[0x1],_0x3aee99[_0x407f('0xd')],_0x3aee99[_0x407f('0x10')]['id']);})[_0x407f('0x12')](function(_0x3db99d){logger[_0x407f('0x13')]('[%s][TAG]\x20%s',_0x4bb479,JSON[_0x407f('0x14')](_0x3db99d));logger[_0x407f('0x15')](_0x407f('0xc'),_0x4bb479);})[_0x407f('0x16')](function(){_0x13d600[_0x407f('0x17')]();});}}}catch(_0x11539f){logger[_0x407f('0x13')](_0x407f('0x9'),_0x4bb479,_[_0x407f('0x18')](_0x11539f)?JSON[_0x407f('0x14')](_0x11539f):_0x11539f);logger[_0x407f('0x15')](_0x407f('0xc'),_0x4bb479);_0x13d600[_0x407f('0x17')]();}};}; \ No newline at end of file +var _0xd40d=['consequence','length','[%s][TAG]\x20%s','map','message','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','error','info','next','isObject','stringify','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number'];(function(_0x38ce4c,_0xfdbe8c){var _0x5d4544=function(_0x503537){while(--_0x503537){_0x38ce4c['push'](_0x38ce4c['shift']());}};_0x5d4544(++_0xfdbe8c);}(_0xd40d,0x16e));var _0xdd40=function(_0x1e6f72,_0xe759d9){_0x1e6f72=_0x1e6f72-0x0;var _0x1d8359=_0xd40d[_0x1e6f72];return _0x1d8359;};'use strict';var schema=require(_0xdd40('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0xdd40('0x1')),'openchannelInteraction':require(_0xdd40('0x2')),'smsInteraction':require(_0xdd40('0x3')),'mailInteraction':require(_0xdd40('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xdd40('0x5'))};var logger=require(_0xdd40('0x6'))(_0xdd40('0x7'));var tag=schema({'tag':{'type':_0xdd40('0x8'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xdd40('0x9')]=function(_0x209fd6,_0x447ea0,_0x5f11d0,_0x49e8d9){return function(_0x1246af){try{var _0xc574cb={'tag':_0x447ea0[0x0]};var _0x4610bc=tag['validate'](_0xc574cb,{'typecast':!![]});if(_0x4610bc[_0xdd40('0xa')]){logger['error'](_0xdd40('0xb'),_0x209fd6,_[_0xdd40('0xc')](_0x4610bc,_0xdd40('0xd'))['join'](',\x20'));logger['info'](_0xdd40('0xe'),_0x209fd6);_0x1246af['next']();}else{var _0x3af24c={'ids':[_0x447ea0[0x0]]};if(rpc[_0x49e8d9[_0xdd40('0xf')]+_0xdd40('0x10')]){rpc[_0x49e8d9['channel']+_0xdd40('0x10')][_0xdd40('0x11')](_0x49e8d9[_0xdd40('0x12')]['id'],_0x3af24c)['then'](function(_0x398709){logger['info'](_0xdd40('0x13'),_0x209fd6,_0x447ea0[0x1],_0x49e8d9[_0xdd40('0xf')],_0x49e8d9['interaction']['id']);})['catch'](function(_0x2aef54){logger[_0xdd40('0x14')](_0xdd40('0xb'),_0x209fd6,JSON['stringify'](_0x2aef54));logger[_0xdd40('0x15')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x209fd6);})['finally'](function(){_0x1246af[_0xdd40('0x16')]();});}}}catch(_0x43a7e0){logger['error'](_0xdd40('0xb'),_0x209fd6,_[_0xdd40('0x17')](_0x43a7e0)?JSON[_0xdd40('0x18')](_0x43a7e0):_0x43a7e0);logger['info'](_0xdd40('0xe'),_0x209fd6);_0x1246af[_0xdd40('0x16')]();}};}; \ 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 6aec64f..691f509 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 _0xb918=['result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId=','&sessionId=','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','request-promise','../../../../config/logger','routing','consequence','replace','\x20-\x20','includes','urlOnAnswer','?params=','title','jsonrpc','2.0','method','login','push','stringify','then','parse'];(function(_0x23af31,_0x8a1add){var _0x49b82f=function(_0x5d08d5){while(--_0x5d08d5){_0x23af31['push'](_0x23af31['shift']());}};_0x49b82f(++_0x8a1add);}(_0xb918,0x84));var _0x8b91=function(_0x2a9051,_0x2f0b1d){_0x2a9051=_0x2a9051-0x0;var _0x3eb69f=_0xb918[_0x2a9051];return _0x3eb69f;};'use strict';var rp=require(_0x8b91('0x0'));var logger=require(_0x8b91('0x1'))(_0x8b91('0x2'));var _=require('lodash');var arr=[];exports[_0x8b91('0x3')]=function(_0xbdf290,_0x16b336){return function(_0x963eaa){var _0x5f2c94=_0x16b336[0xa];var _0x1299e0=_0x16b336[0xb];var _0x4c0312=_0x16b336[0xc];var _0x2a66ac=_0x16b336[0xd];var _0x15aac1=_0x16b336[0xe];var _0x5ac9b8=_0x16b336[0xf][_0x8b91('0x4')](/\n/g,_0x8b91('0x5'));var _0x5d8c50=_0x16b336[0x10][_0x8b91('0x4')](/\n/g,'\x20');if(!arr[_0x8b91('0x6')](_0x1299e0)){arr['push'](_0x1299e0);var _0x384400=_0x16b336[0x3];var _0x51726e=_0x16b336[0x4];var _0x4ad64e=_0x16b336[0x1];var _0x295652=_0x16b336[0x0];var _0x41d7ab={};_0x41d7ab[_0x8b91('0x7')]=_0x16b336[0x8]+'?params='+_0x4c0312+'|'+_0x5f2c94+'|'+_0x2a66ac+'|'+_0x1299e0+'|'+_0x15aac1;_0x41d7ab['urlOnRing']=_0x16b336[0x7]+_0x8b91('0x8')+_0x4c0312+'|'+_0x5f2c94+'|'+_0x2a66ac+'|'+_0x1299e0+'|'+_0x15aac1+'|'+_0x5ac9b8+'|'+_0x5d8c50;_0x41d7ab[_0x8b91('0x9')]=_0x16b336[0x9];var _0xd9d92={};_0xd9d92[_0x8b91('0xa')]=_0x8b91('0xb');_0xd9d92[_0x8b91('0xc')]=_0x8b91('0xd');var _0x360fcb=[];_0x360fcb[_0x8b91('0xe')](_0x16b336[0x2]);_0x360fcb['push'](_0x16b336[0x5]);_0x360fcb[_0x8b91('0xe')](_0x16b336[0x6]);_0xd9d92['params']=_0x360fcb;_0xd9d92['id']=0x1;var _0x45b179=JSON[_0x8b91('0xf')](_0xd9d92);var _0x5f1b85={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x384400,'headers':{'Content-Type':'application/json-rpc'},'body':_0x45b179};return rp(_0x5f1b85)[_0x8b91('0x10')](function(_0x40e081){const _0x36e409=JSON[_0x8b91('0x11')](_0x40e081);if(!_0x36e409[_0x8b91('0x12')][_0x8b91('0x13')]){throw new Error(_0x8b91('0x14'));}var _0x9229e4=_0x1299e0;var _0x15bb78='channelId='+_0x4ad64e+_0x8b91('0x15')+_0x295652+_0x8b91('0x16')+_0x9229e4+'&data='+JSON[_0x8b91('0xf')](_0x41d7ab);var _0x506de1=_0x51726e+'?'+_0x15bb78;return rp(_0x506de1);})[_0x8b91('0x10')](function(_0xa36ae3){logger[_0x8b91('0x17')](_0x8b91('0x18'),_0xbdf290,_0xa36ae3);_0x963eaa[_0x8b91('0x19')]();})[_0x8b91('0x1a')](function(_0x3b73f2){logger[_0x8b91('0x1b')](_0x8b91('0x1c'),_0xbdf290,_['isObject'](_0x3b73f2)?JSON['stringify'](_0x3b73f2):_0x3b73f2);_0x963eaa['stop']();});}else{logger[_0x8b91('0x17')](_0x8b91('0x1d'),_0xbdf290);_0x963eaa['next']();}};}; \ No newline at end of file +var _0x8575=['stringify','parse','result','logged','&serviceId=','&sessionId=','&data=','then','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','error','[%s][TVOX]\x20%s','isObject','next','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','push','urlOnAnswer','urlOnRing','title','jsonrpc','params'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x8575,0x102));var _0x5857=function(_0x2578af,_0x1822cf){_0x2578af=_0x2578af-0x0;var _0x414ecf=_0x8575[_0x2578af];return _0x414ecf;};'use strict';var rp=require('request-promise');var logger=require(_0x5857('0x0'))(_0x5857('0x1'));var _=require(_0x5857('0x2'));var arr=[];exports[_0x5857('0x3')]=function(_0x5b1631,_0xd52f92){return function(_0xa75c4c){var _0x43f98a=_0xd52f92[0xa];var _0x4f18e2=_0xd52f92[0xb];var _0x449f29=_0xd52f92[0xc];var _0x1b749f=_0xd52f92[0xd];var _0x306bbc=_0xd52f92[0xe];var _0x345cff=_0xd52f92[0xf][_0x5857('0x4')](/\n/g,_0x5857('0x5'));var _0x36d1ae=_0xd52f92[0x10][_0x5857('0x4')](/\n/g,'\x20');if(!arr['includes'](_0x4f18e2)){arr[_0x5857('0x6')](_0x4f18e2);var _0xb74104=_0xd52f92[0x3];var _0x2356e1=_0xd52f92[0x4];var _0x394c25=_0xd52f92[0x1];var _0x360ed5=_0xd52f92[0x0];var _0x5bf2b8={};_0x5bf2b8[_0x5857('0x7')]=_0xd52f92[0x8]+'?params='+_0x449f29+'|'+_0x43f98a+'|'+_0x1b749f+'|'+_0x4f18e2+'|'+_0x306bbc;_0x5bf2b8[_0x5857('0x8')]=_0xd52f92[0x7]+'?params='+_0x449f29+'|'+_0x43f98a+'|'+_0x1b749f+'|'+_0x4f18e2+'|'+_0x306bbc+'|'+_0x345cff+'|'+_0x36d1ae;_0x5bf2b8[_0x5857('0x9')]=_0xd52f92[0x9];var _0x37ae64={};_0x37ae64[_0x5857('0xa')]='2.0';_0x37ae64['method']='login';var _0x2ae7a5=[];_0x2ae7a5[_0x5857('0x6')](_0xd52f92[0x2]);_0x2ae7a5[_0x5857('0x6')](_0xd52f92[0x5]);_0x2ae7a5[_0x5857('0x6')](_0xd52f92[0x6]);_0x37ae64[_0x5857('0xb')]=_0x2ae7a5;_0x37ae64['id']=0x1;var _0x269702=JSON[_0x5857('0xc')](_0x37ae64);var _0x1746ea={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0xb74104,'headers':{'Content-Type':'application/json-rpc'},'body':_0x269702};return rp(_0x1746ea)['then'](function(_0x1493f2){const _0x54be62=JSON[_0x5857('0xd')](_0x1493f2);if(!_0x54be62[_0x5857('0xe')][_0x5857('0xf')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x5e8904=_0x4f18e2;var _0x82ec7b='channelId='+_0x394c25+_0x5857('0x10')+_0x360ed5+_0x5857('0x11')+_0x5e8904+_0x5857('0x12')+JSON[_0x5857('0xc')](_0x5bf2b8);var _0x1b6c49=_0x2356e1+'?'+_0x82ec7b;return rp(_0x1b6c49);})[_0x5857('0x13')](function(_0x2232bf){logger[_0x5857('0x14')](_0x5857('0x15'),_0x5b1631,_0x2232bf);_0xa75c4c['stop']();})[_0x5857('0x16')](function(_0x270563){logger[_0x5857('0x17')](_0x5857('0x18'),_0x5b1631,_[_0x5857('0x19')](_0x270563)?JSON[_0x5857('0xc')](_0x270563):_0x270563);_0xa75c4c['stop']();});}else{logger[_0x5857('0x14')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x5b1631);_0xa75c4c[_0x5857('0x1a')]();}};}; \ 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 4367395..95a07f5 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(_0x53e01d,_0x34354b){var _0x2daf42=function(_0x57b3d5){while(--_0x57b3d5){_0x53e01d['push'](_0x53e01d['shift']());}};_0x2daf42(++_0x34354b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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 _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x26a7e6,_0x3baf51){var _0x51e49b=function(_0x1638b5){while(--_0x1638b5){_0x26a7e6['push'](_0x26a7e6['shift']());}};_0x51e49b(++_0x3baf51);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index dc88c58..e5a0bd1 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 _0x13c0=['agents','busyQueue','emit','end','QueueReport','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','rules','channel','message','interaction','applications','length','existsSync','app','appdata','split','mail','push','join','slice','dialogflow','dialogflowv2','amazonlex','tag','TagId','tvox','getMustacheRender','ContactId','body','%s:%s:%s','condition','intervals','./applications/','consequence','info','\x20|\x20','error','.js','execute','complete','stack','routing\x20is\x20empty','agent'];(function(_0x537eeb,_0x2bc2d7){var _0x19625d=function(_0x13c118){while(--_0x13c118){_0x537eeb['push'](_0x537eeb['shift']());}};_0x19625d(++_0x2bc2d7);}(_0x13c0,0x79));var _0x013c=function(_0x65a0db,_0x55c5a0){_0x65a0db=_0x65a0db-0x0;var _0x987620=_0x13c0[_0x65a0db];return _0x987620;};'use strict';var _=require(_0x013c('0x0'));var util=require(_0x013c('0x1'));var path=require(_0x013c('0x2'));var fs=require('fs');var jayson=require(_0x013c('0x3'));var BPromise=require('bluebird');var uuid=require('uuid');var utils=require('./applications/utils');var config=require(_0x013c('0x4'));var logger=require(_0x013c('0x5'))(_0x013c('0x6'));var rpc={'openchannelQueueReport':require(_0x013c('0x7')),'mailQueueReport':require(_0x013c('0x8')),'chatQueueReport':require(_0x013c('0x9')),'smsQueueReport':require(_0x013c('0xa')),'faxQueueReport':require(_0x013c('0xb')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0x593053,_0x27c830,_0x164605){return util['format'](_0x013c('0xc'),_0x593053,_0x27c830||0x0,_0x164605||0x0);}function getIntervals(_0xa99b50,_0x371681){var _0x3fa7ff=[];if(!_[_0x013c('0xd')](_0x371681[_0x013c('0xe')])&&!_[_0x013c('0xd')](_0xa99b50[_0x371681[_0x013c('0xe')]])&&!_[_0x013c('0xd')](_0xa99b50[_0x371681[_0x013c('0xe')]]['Intervals'])){_0x3fa7ff=_['map'](_0xa99b50[_0x371681[_0x013c('0xe')]][_0x013c('0xf')],_0x013c('0x10'));}else if(!_[_0x013c('0xd')](_0x371681['interval'])){_0x3fa7ff=[_0x371681[_0x013c('0x10')]];}return _0x3fa7ff;}exports[_0x013c('0x11')]=function(_0xcfe81a){_0xcfe81a[_0x013c('0x12')]={};return new BPromise(function(_0x424437,_0x57f017){var _0x307f34={'Start':function(_0x1c2e11){var _0x84244=this;return new Promise(function(_0x92c3ca,_0x1a5e16){if(_0x1c2e11){try{var _0x1038d6=[];var _0x6b8b5=getId(_0x1c2e11[_0x013c('0x13')],_0x1c2e11[_0x013c('0x14')]?_0x1c2e11[_0x013c('0x14')]['id']:0x0,_0x1c2e11[_0x013c('0x15')]?_0x1c2e11[_0x013c('0x15')]['id']:0x0);if(_0x1c2e11[_0x013c('0x16')]&&_['isArray'](_0x1c2e11['applications'])&&_0x1c2e11[_0x013c('0x16')][_0x013c('0x17')]){for(var _0x5752bd=0x0;_0x5752bd<_0x1c2e11[_0x013c('0x16')][_0x013c('0x17')];_0x5752bd+=0x1){var _0x29c141=_0x1c2e11[_0x013c('0x16')][_0x5752bd];if(fs[_0x013c('0x18')](path['join'](__dirname,_0x013c('0x16'),_0x29c141[_0x013c('0x19')]+'.js'))){var _0x1df9d2=[];switch(_0x29c141[_0x013c('0x19')]['toLowerCase']()){case'autoreply':var _0x20f8e7=_0x29c141[_0x013c('0x1a')][_0x013c('0x1b')](',');if(_0x1c2e11[_0x013c('0x13')]===_0x013c('0x1c')){_0x1df9d2[_0x013c('0x1d')](_0x20f8e7[0x0]);_0x1df9d2[_0x013c('0x1d')](_0x20f8e7[0x1]);_0x1df9d2[_0x013c('0x1d')](_0x20f8e7['slice'](0x2,_0x20f8e7[_0x013c('0x17')])[_0x013c('0x1e')](','));}else{_0x1df9d2[_0x013c('0x1d')](_0x20f8e7[0x0]);_0x1df9d2[_0x013c('0x1d')](_0x20f8e7[_0x013c('0x1f')](0x1,_0x20f8e7[_0x013c('0x17')])['join'](','));}break;case _0x013c('0x20'):var _0xd85349=_0x29c141[_0x013c('0x1a')]['split'](',');_0x1df9d2[_0x013c('0x1d')](_0xd85349[0x0]);_0x1df9d2['push'](_0xd85349[0x1]);_0x1df9d2[_0x013c('0x1d')](_0xd85349[_0x013c('0x1f')](0x2,_0xd85349['length'])[_0x013c('0x1e')](','));break;case _0x013c('0x21'):var _0x16cdad=_0x29c141[_0x013c('0x1a')][_0x013c('0x1b')](',');_0x1df9d2[_0x013c('0x1d')](_0x16cdad[0x0]);_0x1df9d2[_0x013c('0x1d')](_0x16cdad[0x1]);_0x1df9d2[_0x013c('0x1d')](_0x16cdad[0x2]);_0x1df9d2[_0x013c('0x1d')](_0x16cdad[0x3]);_0x1df9d2[_0x013c('0x1d')](_0x16cdad['slice'](0x4,_0x16cdad[_0x013c('0x17')])[_0x013c('0x1e')](','));break;case _0x013c('0x22'):var _0x24617f=_0x29c141[_0x013c('0x1a')]['split'](',');_0x1df9d2[_0x013c('0x1d')](_0x24617f[0x0]);_0x1df9d2[_0x013c('0x1d')](_0x24617f[0x1]);_0x1df9d2[_0x013c('0x1d')](_0x24617f[0x2]);_0x1df9d2[_0x013c('0x1d')](_0x24617f[0x3]);_0x1df9d2['push'](_0x24617f['slice'](0x4,_0x24617f['length'])[_0x013c('0x1e')](','));break;case _0x013c('0x14'):_0x1df9d2[_0x013c('0x1d')](_0x29c141[_0x013c('0x1a')]);break;case _0x013c('0x23'):_0x1df9d2[_0x013c('0x1d')](_0x29c141[_0x013c('0x24')]);_0x1df9d2[_0x013c('0x1d')](_0x29c141[_0x013c('0x1a')]);break;case _0x013c('0x25'):var _0xc69c3f=utils[_0x013c('0x26')](_0x1c2e11['account']['notificationTemplate'],_0x1c2e11);var _0x42aa8a=_0x29c141[_0x013c('0x1a')][_0x013c('0x1b')](',');_0x1df9d2[_0x013c('0x1d')](_0x42aa8a[0x0]);_0x1df9d2['push'](_0x42aa8a[0x1]);_0x1df9d2[_0x013c('0x1d')](_0x42aa8a[0x2]);_0x1df9d2[_0x013c('0x1d')](_0x42aa8a[0x3]);_0x1df9d2[_0x013c('0x1d')](_0x42aa8a[0x4]);_0x1df9d2[_0x013c('0x1d')](_0x42aa8a[0x5]);_0x1df9d2['push'](_0x42aa8a[0x6]);_0x1df9d2[_0x013c('0x1d')](_0x42aa8a[0x7]);_0x1df9d2[_0x013c('0x1d')](_0x42aa8a[0x8]);_0x1df9d2['push'](_0x42aa8a[0x9]);_0x1df9d2[_0x013c('0x1d')](_0x42aa8a[0xa]);_0x1df9d2['push'](_0x1c2e11[_0x013c('0x15')]['id']);_0x1df9d2[_0x013c('0x1d')](_0x1c2e11[_0x013c('0x14')]['id']);_0x1df9d2[_0x013c('0x1d')](_0x29c141['ChatWebsiteId']);_0x1df9d2[_0x013c('0x1d')](_0x1c2e11[_0x013c('0x15')][_0x013c('0x27')]);_0x1df9d2[_0x013c('0x1d')](_0x1c2e11[_0x013c('0x28')][_0x013c('0x28')]);_0x1df9d2[_0x013c('0x1d')](_0xc69c3f);break;default:_0x1df9d2=_[_0x013c('0xd')](_0x29c141[_0x013c('0x1a')])?[]:_0x29c141['appdata'][_0x013c('0x1b')](',');}var _0x3e5e50={'id':util['format'](_0x013c('0x29'),_0x6b8b5,_0x29c141['id'],_0x29c141[_0x013c('0x19')]),'condition':require('./interval')[_0x013c('0x2a')](_0x6b8b5,getIntervals(_0xcfe81a[_0x013c('0x2b')],_0x29c141),_0xcfe81a),'consequence':require(_0x013c('0x2c')+_0x29c141[_0x013c('0x19')])[_0x013c('0x2d')](_0x6b8b5,_0x1df9d2,_0xcfe81a,_0x1c2e11),'p':_0x29c141['priority']||0x0};logger[_0x013c('0x2e')]('Push\x20new\x20rule',_0x3e5e50['id'],'on\x20interval',getIntervals(_0xcfe81a['intervals'],_0x29c141)['join'](_0x013c('0x2f')));_0x1038d6[_0x013c('0x1d')](_0x3e5e50);}else{logger[_0x013c('0x30')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x013c('0x1e')](__dirname,_0x013c('0x16'),_0x29c141[_0x013c('0x19')]+_0x013c('0x31')));}}_0xcfe81a[_0x013c('0x12')][_0x6b8b5]=new RuleEngine(_0x1038d6);_0xcfe81a['rules'][_0x6b8b5][_0x013c('0x32')](_0x1c2e11,function(_0x3bfcd4){logger['info']('Applications\x20executed',JSON['stringify'](_0x3bfcd4['matchPath']));if(_0xcfe81a[_0x013c('0x12')][_0x6b8b5]){_0xcfe81a[_0x013c('0x12')][_0x6b8b5]['emit'](_0x013c('0x33'));}});return _0x92c3ca({'code':0xc8,'message':_0x1c2e11});}else{logger[_0x013c('0x2e')]('No\x20applications\x20to\x20execute');return _0x92c3ca({'code':0xc8,'message':_0x1c2e11});}}catch(_0x268a3b){logger[_0x013c('0x30')](_0x268a3b[_0x013c('0x34')]);return _0x1a5e16(_0x84244[_0x013c('0x30')](0x1f4,_0x268a3b));}}return _0x1a5e16(_0x013c('0x35'));});},'AcceptMessage':function(_0x2cb393){var _0x1f289f=this;return new Promise(function(_0x7e44ac,_0x5780e7){if(_0x2cb393[_0x013c('0x36')]&&_0x2cb393['agent']['id']){if(_0xcfe81a[_0x013c('0x37')][_0x2cb393['agent']['id']]){_0xcfe81a['agents'][_0x2cb393[_0x013c('0x36')]['id']]['busy']=![];_0xcfe81a[_0x013c('0x37')][_0x2cb393[_0x013c('0x36')]['id']][_0x013c('0x38')]=undefined;}}if(_0x2cb393[_0x013c('0x14')]&&_0x2cb393['message']['id']){try{var _0x5185a3=getId(_0x2cb393['channel'],_0x2cb393['message']?_0x2cb393[_0x013c('0x14')]['id']:0x0,_0x2cb393['interaction']?_0x2cb393[_0x013c('0x15')]['id']:0x0);if(_0xcfe81a[_0x013c('0x12')][_0x5185a3]){_0xcfe81a[_0x013c('0x12')][_0x5185a3][_0x013c('0x39')](_0x013c('0x3a'));if(rpc[_0x2cb393[_0x013c('0x13')]+_0x013c('0x3b')]){rpc[_0x2cb393[_0x013c('0x13')]+_0x013c('0x3b')]['update'](_0x5185a3,{'UserId':_0x2cb393[_0x013c('0x14')]['UserId']})['catch'](function(_0x12236a){logger['error']('error\x20update\x20queue\x20report');});}}return _0x7e44ac({'code':0xc8,'message':_0x2cb393});}catch(_0x38d0de){logger[_0x013c('0x30')](_0x38d0de['stack']);return _0x5780e7(_0x1f289f[_0x013c('0x30')](0x1f4,_0x38d0de));}}logger[_0x013c('0x30')](_0x013c('0x3c'));return _0x5780e7(_0x1f289f['error'](0x1f4,_0x013c('0x3c')));});},'RejectMessage':function(_0x419c6b){var _0x21b5f1=this;return new Promise(function(_0x82e15a,_0x2a64a1){if(_0x419c6b['agent']&&_0x419c6b[_0x013c('0x36')]['id']){try{if(_0xcfe81a[_0x013c('0x37')][_0x419c6b[_0x013c('0x36')]['id']]){_0xcfe81a[_0x013c('0x37')][_0x419c6b['agent']['id']][_0x013c('0x3d')]=![];_0xcfe81a[_0x013c('0x37')][_0x419c6b[_0x013c('0x36')]['id']][_0x013c('0x38')]=undefined;}return _0x82e15a({'code':0xc8,'message':_0x419c6b});}catch(_0x17f162){logger[_0x013c('0x30')](_0x17f162[_0x013c('0x34')]);return _0x2a64a1(_0x21b5f1[_0x013c('0x30')](0x1f4,_0x17f162));}}logger[_0x013c('0x30')]('message\x20is\x20empty');return _0x2a64a1(_0x21b5f1[_0x013c('0x30')](0x1f4,_0x013c('0x3c')));});},'AbandonInteraction':function(_0x5c8cc9){var _0x55bf4a=this;return new Promise(function(_0x37d8b7,_0x5539db){if(_0x5c8cc9[_0x013c('0x13')]&&_0x5c8cc9[_0x013c('0x15')]&&_0x5c8cc9[_0x013c('0x15')]['id']){try{var _0x1e36bb=getId(_0x5c8cc9['channel'],_0x5c8cc9[_0x013c('0x14')]?_0x5c8cc9[_0x013c('0x14')]['id']:0x0,_0x5c8cc9[_0x013c('0x15')]?_0x5c8cc9['interaction']['id']:0x0);if(_0xcfe81a[_0x013c('0x12')][_0x1e36bb]){_0xcfe81a['rules'][_0x1e36bb][_0x013c('0x39')]('end');}return _0x37d8b7({'code':0xc8,'message':_0x5c8cc9});}catch(_0x2ed53a){logger[_0x013c('0x30')](_0x2ed53a[_0x013c('0x34')]);return _0x5539db(_0x55bf4a['error'](0x1f4,_0x2ed53a));}}logger['error'](_0x013c('0x3c'));return _0x5539db(_0x55bf4a[_0x013c('0x30')](0x1f4,_0x013c('0x3c')));});},'AgentCapacity':function(_0x6467d7){var _0x1e52f0=this;return new Promise(function(_0x59f9e6,_0x2bd9aa){if(_0xcfe81a[_0x013c('0x37')][_0x013c('0x3e')](_0x6467d7['id'])){for(var _0x5d0325 in _0x6467d7['capacity']){if(_0x6467d7[_0x013c('0x3f')][_0x013c('0x3e')](_0x5d0325)){if(_0xcfe81a['agents'][_0x6467d7['id']][_0x013c('0x3e')](_0x5d0325+_0x013c('0x40'))){_0xcfe81a[_0x013c('0x37')][_0x6467d7['id']][_0x5d0325+_0x013c('0x40')]=parseInt(_0x6467d7['capacity'][_0x5d0325],0xa);}}}_0xcfe81a[_0x013c('0x37')][_0x6467d7['id']][_0x013c('0x41')]();return _0x59f9e6({'code':0xc8,'message':_0xcfe81a[_0x013c('0x37')][_0x6467d7['id']]});}else{return _0x2bd9aa(_0x1e52f0[_0x013c('0x30')](0x1f4,_0x013c('0x42')));}});},'Agents':function(_0x49d3ae){return new Promise(function(_0x5848e6,_0x9c77a9){var _0x54de46=_['values'](_0xcfe81a['agents']);_0x5848e6({'count':_0x54de46[_0x013c('0x17')],'rows':_0x54de46});});},'ChatQueues':function(_0x1f0017){return new Promise(function(_0x7d2a4f,_0x512e23){var _0x56c54a=[];for(var _0x37acc2 in _0xcfe81a[_0x013c('0x43')]){if(_0xcfe81a[_0x013c('0x43')][_0x013c('0x3e')](_0x37acc2)){var _0x5e2f1d=_0xcfe81a['chatQueues'][_0x37acc2];var _0x280fab={'id':_0x5e2f1d['id'],'available':_0x5e2f1d[_0x013c('0x44')],'loggedIn':_0x5e2f1d[_0x013c('0x45')],'name':_0x5e2f1d[_0x013c('0x46')],'paused':_0x5e2f1d[_0x013c('0x47')],'waiting':_0x5e2f1d[_0x013c('0x48')]};_0x56c54a[_0x013c('0x1d')](_0x280fab);}}_0x7d2a4f({'count':_0x56c54a[_0x013c('0x17')],'rows':_0x56c54a});});},'MailQueues':function(_0x126d20){return new Promise(function(_0x5569b4,_0x20e93f){var _0x136a35=[];for(var _0x25dec4 in _0xcfe81a['mailQueues']){if(_0xcfe81a[_0x013c('0x49')][_0x013c('0x3e')](_0x25dec4)){var _0x1ebed6=_0xcfe81a[_0x013c('0x49')][_0x25dec4];var _0xd4357c={'id':_0x1ebed6['id'],'available':_0x1ebed6[_0x013c('0x44')],'loggedIn':_0x1ebed6[_0x013c('0x45')],'name':_0x1ebed6['name'],'paused':_0x1ebed6['paused'],'waiting':_0x1ebed6[_0x013c('0x48')]};_0x136a35[_0x013c('0x1d')](_0xd4357c);}}_0x5569b4({'count':_0x136a35[_0x013c('0x17')],'rows':_0x136a35});});},'OpenchannelQueues':function(_0x15a550){return new Promise(function(_0x31d1e2,_0x1ca0c5){var _0x41b201=[];for(var _0x45512c in _0xcfe81a[_0x013c('0x4a')]){if(_0xcfe81a['openchannelQueues']['hasOwnProperty'](_0x45512c)){var _0x571782=_0xcfe81a[_0x013c('0x4a')][_0x45512c];var _0x4d412c={'id':_0x571782['id'],'available':_0x571782[_0x013c('0x44')],'loggedIn':_0x571782[_0x013c('0x45')],'name':_0x571782['name'],'paused':_0x571782[_0x013c('0x47')],'waiting':_0x571782[_0x013c('0x48')]};_0x41b201[_0x013c('0x1d')](_0x4d412c);}}_0x31d1e2({'count':_0x41b201[_0x013c('0x17')],'rows':_0x41b201});});},'SmsQueues':function(_0x10ad0c){return new Promise(function(_0xed88fd,_0x9d6377){var _0x4383be=[];for(var _0x4c76c6 in _0xcfe81a['smsQueues']){if(_0xcfe81a[_0x013c('0x4b')][_0x013c('0x3e')](_0x4c76c6)){var _0x1d3839=_0xcfe81a['smsQueues'][_0x4c76c6];var _0x57950f={'id':_0x1d3839['id'],'available':_0x1d3839[_0x013c('0x44')],'loggedIn':_0x1d3839[_0x013c('0x45')],'name':_0x1d3839[_0x013c('0x46')],'paused':_0x1d3839['paused'],'waiting':_0x1d3839[_0x013c('0x48')]};_0x4383be[_0x013c('0x1d')](_0x57950f);}}_0xed88fd({'count':_0x4383be['length'],'rows':_0x4383be});});},'FaxQueues':function(_0x45a01c){return new Promise(function(_0x465c53,_0x310841){var _0x3dea3b=[];for(var _0x5613e0 in _0xcfe81a[_0x013c('0x4c')]){if(_0xcfe81a['faxQueues'][_0x013c('0x3e')](_0x5613e0)){var _0x4e872b=_0xcfe81a[_0x013c('0x4c')][_0x5613e0];var _0x50deb5={'id':_0x4e872b['id'],'available':_0x4e872b['available'],'loggedIn':_0x4e872b['loggedIn'],'name':_0x4e872b[_0x013c('0x46')],'paused':_0x4e872b[_0x013c('0x47')],'waiting':_0x4e872b[_0x013c('0x48')]};_0x3dea3b[_0x013c('0x1d')](_0x50deb5);}}_0x465c53({'count':_0x3dea3b[_0x013c('0x17')],'rows':_0x3dea3b});});},'WhatsappQueues':function(_0x1924f2){return new Promise(function(_0xb8298c,_0x5a86b6){var _0x1bf7b5=[];for(var _0x1a3442 in _0xcfe81a[_0x013c('0x4d')]){if(_0xcfe81a['whatsappQueues'][_0x013c('0x3e')](_0x1a3442)){var _0x24ecf2=_0xcfe81a[_0x013c('0x4d')][_0x1a3442];var _0x38b53f={'id':_0x24ecf2['id'],'available':_0x24ecf2[_0x013c('0x44')],'loggedIn':_0x24ecf2[_0x013c('0x45')],'name':_0x24ecf2[_0x013c('0x46')],'paused':_0x24ecf2[_0x013c('0x47')],'waiting':_0x24ecf2[_0x013c('0x48')]};_0x1bf7b5[_0x013c('0x1d')](_0x38b53f);}}_0xb8298c({'count':_0x1bf7b5[_0x013c('0x17')],'rows':_0x1bf7b5});});},'ChatQueuesWaitingInteractions':function(_0x26406c){return new Promise(function(_0x468c73,_0x198c06){var _0x3a10c0=_[_0x013c('0x4e')](_0xcfe81a[_0x013c('0x4f')]);_0x468c73({'count':_0x3a10c0[_0x013c('0x17')],'rows':_0x3a10c0});});},'MailQueuesWaitingInteractions':function(_0x20d569){return new Promise(function(_0x45f7ac,_0x1a23e9){var _0x2b6064=_[_0x013c('0x4e')](_0xcfe81a[_0x013c('0x50')]);_0x45f7ac({'count':_0x2b6064[_0x013c('0x17')],'rows':_0x2b6064});});},'OpenchannelQueuesWaitingInteractions':function(_0x52b563){return new Promise(function(_0x3bed3d,_0x539488){var _0x6cf90e=_['values'](_0xcfe81a[_0x013c('0x51')]);_0x3bed3d({'count':_0x6cf90e[_0x013c('0x17')],'rows':_0x6cf90e});});},'SmsQueuesWaitingInteractions':function(_0x56bbcf){return new Promise(function(_0x3bd59c,_0x277219){var _0x2a316d=_[_0x013c('0x4e')](_0xcfe81a['smsQueuesWaitingInteractions']);_0x3bd59c({'count':_0x2a316d['length'],'rows':_0x2a316d});});},'FaxQueuesWaitingInteractions':function(_0x530f42){return new Promise(function(_0x1a35dd,_0x1f290b){var _0x257eb8=_[_0x013c('0x4e')](_0xcfe81a[_0x013c('0x52')]);_0x1a35dd({'count':_0x257eb8['length'],'rows':_0x257eb8});});},'WhatsappQueuesWaitingInteractions':function(_0x5b795d){return new Promise(function(_0x3a23b2,_0x4f0c95){var _0x367d4f=_[_0x013c('0x4e')](_0xcfe81a[_0x013c('0x53')]);_0x3a23b2({'count':_0x367d4f[_0x013c('0x17')],'rows':_0x367d4f});});}};var _0x50aece=jayson[_0x013c('0x54')](_0x307f34)[_0x013c('0x55')]();_0x50aece['on'](_0x013c('0x30'),function(_0x1bcc6c){logger[_0x013c('0x30')](JSON['stringify'](_0x1bcc6c));return _0x57f017(_0x1bcc6c);});_0x50aece[_0x013c('0x11')](0x232c,'127.0.0.1',function(){console['log'](_0x013c('0x56'),0x232c);return _0x424437(_0x013c('0x57')+0x232c);});});}; \ No newline at end of file +var _0xa699=['faxQueuesWaitingInteractions','server','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','uuid','./applications/utils','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','listen','rules','channel','message','interaction','applications','isArray','length','existsSync','join','.js','app','appdata','mail','push','slice','dialogflow','split','amazonlex','tag','getMustacheRender','account','notificationTemplate','body','./interval','condition','intervals','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','name','paused','waiting','mailQueues','openchannelQueues','available','loggedIn','smsQueues','faxQueues','whatsappQueues','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xa699,0x6b));var _0x9a69=function(_0x134827,_0x21f6ed){_0x134827=_0x134827-0x0;var _0x366671=_0xa699[_0x134827];return _0x366671;};'use strict';var _=require(_0x9a69('0x0'));var util=require(_0x9a69('0x1'));var path=require(_0x9a69('0x2'));var fs=require('fs');var jayson=require(_0x9a69('0x3'));var BPromise=require(_0x9a69('0x4'));var uuid=require(_0x9a69('0x5'));var utils=require(_0x9a69('0x6'));var config=require(_0x9a69('0x7'));var logger=require(_0x9a69('0x8'))(_0x9a69('0x9'));var rpc={'openchannelQueueReport':require(_0x9a69('0xa')),'mailQueueReport':require(_0x9a69('0xb')),'chatQueueReport':require(_0x9a69('0xc')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x9a69('0xd')),'whatsappQueueReport':require(_0x9a69('0xe'))};var RuleEngine=require(_0x9a69('0xf'));function getId(_0x4665a9,_0x5031b0,_0x1f13ba){return util[_0x9a69('0x10')](_0x9a69('0x11'),_0x4665a9,_0x5031b0||0x0,_0x1f13ba||0x0);}function getIntervals(_0x1ee4e3,_0x43d2f2){var _0x58b59e=[];if(!_['isNil'](_0x43d2f2[_0x9a69('0x12')])&&!_['isNil'](_0x1ee4e3[_0x43d2f2[_0x9a69('0x12')]])&&!_[_0x9a69('0x13')](_0x1ee4e3[_0x43d2f2['IntervalId']][_0x9a69('0x14')])){_0x58b59e=_[_0x9a69('0x15')](_0x1ee4e3[_0x43d2f2['IntervalId']][_0x9a69('0x14')],_0x9a69('0x16'));}else if(!_[_0x9a69('0x13')](_0x43d2f2[_0x9a69('0x16')])){_0x58b59e=[_0x43d2f2[_0x9a69('0x16')]];}return _0x58b59e;}exports[_0x9a69('0x17')]=function(_0x34b5b0){_0x34b5b0[_0x9a69('0x18')]={};return new BPromise(function(_0x1581d6,_0x4d4450){var _0x2323ae={'Start':function(_0x17de41){var _0x2be3ec=this;return new Promise(function(_0x5e982d,_0x13fd7){if(_0x17de41){try{var _0x397565=[];var _0x380e46=getId(_0x17de41[_0x9a69('0x19')],_0x17de41[_0x9a69('0x1a')]?_0x17de41['message']['id']:0x0,_0x17de41[_0x9a69('0x1b')]?_0x17de41[_0x9a69('0x1b')]['id']:0x0);if(_0x17de41[_0x9a69('0x1c')]&&_[_0x9a69('0x1d')](_0x17de41[_0x9a69('0x1c')])&&_0x17de41[_0x9a69('0x1c')][_0x9a69('0x1e')]){for(var _0x45cae5=0x0;_0x45cae5<_0x17de41[_0x9a69('0x1c')][_0x9a69('0x1e')];_0x45cae5+=0x1){var _0x4f50d4=_0x17de41['applications'][_0x45cae5];if(fs[_0x9a69('0x1f')](path[_0x9a69('0x20')](__dirname,_0x9a69('0x1c'),_0x4f50d4['app']+_0x9a69('0x21')))){var _0x527ca6=[];switch(_0x4f50d4[_0x9a69('0x22')]['toLowerCase']()){case'autoreply':var _0x5b336e=_0x4f50d4[_0x9a69('0x23')]['split'](',');if(_0x17de41[_0x9a69('0x19')]===_0x9a69('0x24')){_0x527ca6[_0x9a69('0x25')](_0x5b336e[0x0]);_0x527ca6[_0x9a69('0x25')](_0x5b336e[0x1]);_0x527ca6['push'](_0x5b336e[_0x9a69('0x26')](0x2,_0x5b336e['length'])[_0x9a69('0x20')](','));}else{_0x527ca6['push'](_0x5b336e[0x0]);_0x527ca6['push'](_0x5b336e[_0x9a69('0x26')](0x1,_0x5b336e[_0x9a69('0x1e')])[_0x9a69('0x20')](','));}break;case _0x9a69('0x27'):var _0x26369e=_0x4f50d4[_0x9a69('0x23')][_0x9a69('0x28')](',');_0x527ca6[_0x9a69('0x25')](_0x26369e[0x0]);_0x527ca6[_0x9a69('0x25')](_0x26369e[0x1]);_0x527ca6[_0x9a69('0x25')](_0x26369e['slice'](0x2,_0x26369e[_0x9a69('0x1e')])[_0x9a69('0x20')](','));break;case'dialogflowv2':var _0x54e643=_0x4f50d4['appdata'][_0x9a69('0x28')](',');_0x527ca6['push'](_0x54e643[0x0]);_0x527ca6[_0x9a69('0x25')](_0x54e643[0x1]);_0x527ca6[_0x9a69('0x25')](_0x54e643[0x2]);_0x527ca6[_0x9a69('0x25')](_0x54e643[0x3]);_0x527ca6[_0x9a69('0x25')](_0x54e643[_0x9a69('0x26')](0x4,_0x54e643[_0x9a69('0x1e')])[_0x9a69('0x20')](','));break;case _0x9a69('0x29'):var _0x389e61=_0x4f50d4[_0x9a69('0x23')][_0x9a69('0x28')](',');_0x527ca6[_0x9a69('0x25')](_0x389e61[0x0]);_0x527ca6[_0x9a69('0x25')](_0x389e61[0x1]);_0x527ca6[_0x9a69('0x25')](_0x389e61[0x2]);_0x527ca6[_0x9a69('0x25')](_0x389e61[0x3]);_0x527ca6[_0x9a69('0x25')](_0x389e61[_0x9a69('0x26')](0x4,_0x389e61['length'])['join'](','));break;case _0x9a69('0x1a'):_0x527ca6[_0x9a69('0x25')](_0x4f50d4[_0x9a69('0x23')]);break;case _0x9a69('0x2a'):_0x527ca6[_0x9a69('0x25')](_0x4f50d4['TagId']);_0x527ca6['push'](_0x4f50d4['appdata']);break;case'tvox':var _0x4196de=utils[_0x9a69('0x2b')](_0x17de41[_0x9a69('0x2c')][_0x9a69('0x2d')],_0x17de41);var _0x4699f2=_0x4f50d4[_0x9a69('0x23')]['split'](',');_0x527ca6['push'](_0x4699f2[0x0]);_0x527ca6[_0x9a69('0x25')](_0x4699f2[0x1]);_0x527ca6[_0x9a69('0x25')](_0x4699f2[0x2]);_0x527ca6[_0x9a69('0x25')](_0x4699f2[0x3]);_0x527ca6['push'](_0x4699f2[0x4]);_0x527ca6[_0x9a69('0x25')](_0x4699f2[0x5]);_0x527ca6[_0x9a69('0x25')](_0x4699f2[0x6]);_0x527ca6[_0x9a69('0x25')](_0x4699f2[0x7]);_0x527ca6[_0x9a69('0x25')](_0x4699f2[0x8]);_0x527ca6[_0x9a69('0x25')](_0x4699f2[0x9]);_0x527ca6[_0x9a69('0x25')](_0x4699f2[0xa]);_0x527ca6[_0x9a69('0x25')](_0x17de41[_0x9a69('0x1b')]['id']);_0x527ca6[_0x9a69('0x25')](_0x17de41[_0x9a69('0x1a')]['id']);_0x527ca6[_0x9a69('0x25')](_0x4f50d4['ChatWebsiteId']);_0x527ca6[_0x9a69('0x25')](_0x17de41['interaction']['ContactId']);_0x527ca6['push'](_0x17de41['body'][_0x9a69('0x2e')]);_0x527ca6[_0x9a69('0x25')](_0x4196de);break;default:_0x527ca6=_['isNil'](_0x4f50d4['appdata'])?[]:_0x4f50d4['appdata'][_0x9a69('0x28')](',');}var _0x1ca2a2={'id':util[_0x9a69('0x10')]('%s:%s:%s',_0x380e46,_0x4f50d4['id'],_0x4f50d4[_0x9a69('0x22')]),'condition':require(_0x9a69('0x2f'))[_0x9a69('0x30')](_0x380e46,getIntervals(_0x34b5b0[_0x9a69('0x31')],_0x4f50d4),_0x34b5b0),'consequence':require(_0x9a69('0x32')+_0x4f50d4[_0x9a69('0x22')])['consequence'](_0x380e46,_0x527ca6,_0x34b5b0,_0x17de41),'p':_0x4f50d4[_0x9a69('0x33')]||0x0};logger[_0x9a69('0x34')](_0x9a69('0x35'),_0x1ca2a2['id'],_0x9a69('0x36'),getIntervals(_0x34b5b0['intervals'],_0x4f50d4)[_0x9a69('0x20')](_0x9a69('0x37')));_0x397565['push'](_0x1ca2a2);}else{logger[_0x9a69('0x38')](_0x9a69('0x39'),path[_0x9a69('0x20')](__dirname,'applications',_0x4f50d4['app']+'.js'));}}_0x34b5b0[_0x9a69('0x18')][_0x380e46]=new RuleEngine(_0x397565);_0x34b5b0[_0x9a69('0x18')][_0x380e46][_0x9a69('0x3a')](_0x17de41,function(_0x436371){logger['info'](_0x9a69('0x3b'),JSON[_0x9a69('0x3c')](_0x436371[_0x9a69('0x3d')]));if(_0x34b5b0[_0x9a69('0x18')][_0x380e46]){_0x34b5b0['rules'][_0x380e46][_0x9a69('0x3e')](_0x9a69('0x3f'));}});return _0x5e982d({'code':0xc8,'message':_0x17de41});}else{logger[_0x9a69('0x34')](_0x9a69('0x40'));return _0x5e982d({'code':0xc8,'message':_0x17de41});}}catch(_0x48c296){logger[_0x9a69('0x38')](_0x48c296['stack']);return _0x13fd7(_0x2be3ec[_0x9a69('0x38')](0x1f4,_0x48c296));}}return _0x13fd7('routing\x20is\x20empty');});},'AcceptMessage':function(_0x322906){var _0x4c0f2a=this;return new Promise(function(_0x45fec6,_0x508b9e){if(_0x322906[_0x9a69('0x41')]&&_0x322906[_0x9a69('0x41')]['id']){if(_0x34b5b0[_0x9a69('0x42')][_0x322906[_0x9a69('0x41')]['id']]){_0x34b5b0['agents'][_0x322906[_0x9a69('0x41')]['id']][_0x9a69('0x43')]=![];_0x34b5b0[_0x9a69('0x42')][_0x322906[_0x9a69('0x41')]['id']][_0x9a69('0x44')]=undefined;}}if(_0x322906[_0x9a69('0x1a')]&&_0x322906[_0x9a69('0x1a')]['id']){try{var _0x1aed26=getId(_0x322906[_0x9a69('0x19')],_0x322906['message']?_0x322906[_0x9a69('0x1a')]['id']:0x0,_0x322906[_0x9a69('0x1b')]?_0x322906[_0x9a69('0x1b')]['id']:0x0);if(_0x34b5b0[_0x9a69('0x18')][_0x1aed26]){_0x34b5b0[_0x9a69('0x18')][_0x1aed26][_0x9a69('0x3e')](_0x9a69('0x45'));if(rpc[_0x322906[_0x9a69('0x19')]+_0x9a69('0x46')]){rpc[_0x322906[_0x9a69('0x19')]+_0x9a69('0x46')][_0x9a69('0x47')](_0x1aed26,{'UserId':_0x322906[_0x9a69('0x1a')][_0x9a69('0x48')]})[_0x9a69('0x49')](function(_0x4c5b25){logger[_0x9a69('0x38')](_0x9a69('0x4a'));});}}return _0x45fec6({'code':0xc8,'message':_0x322906});}catch(_0x13c6a0){logger[_0x9a69('0x38')](_0x13c6a0[_0x9a69('0x4b')]);return _0x508b9e(_0x4c0f2a[_0x9a69('0x38')](0x1f4,_0x13c6a0));}}logger[_0x9a69('0x38')]('message\x20is\x20empty');return _0x508b9e(_0x4c0f2a[_0x9a69('0x38')](0x1f4,_0x9a69('0x4c')));});},'RejectMessage':function(_0x2b7b66){var _0x9a7c34=this;return new Promise(function(_0x18c353,_0x32c826){if(_0x2b7b66[_0x9a69('0x41')]&&_0x2b7b66[_0x9a69('0x41')]['id']){try{if(_0x34b5b0[_0x9a69('0x42')][_0x2b7b66[_0x9a69('0x41')]['id']]){_0x34b5b0[_0x9a69('0x42')][_0x2b7b66['agent']['id']][_0x9a69('0x43')]=![];_0x34b5b0[_0x9a69('0x42')][_0x2b7b66[_0x9a69('0x41')]['id']]['busyQueue']=undefined;}return _0x18c353({'code':0xc8,'message':_0x2b7b66});}catch(_0x424a3a){logger['error'](_0x424a3a['stack']);return _0x32c826(_0x9a7c34[_0x9a69('0x38')](0x1f4,_0x424a3a));}}logger[_0x9a69('0x38')](_0x9a69('0x4c'));return _0x32c826(_0x9a7c34[_0x9a69('0x38')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x5f3f2b){var _0x42e685=this;return new Promise(function(_0x5c49e0,_0x1ddd4c){if(_0x5f3f2b['channel']&&_0x5f3f2b['interaction']&&_0x5f3f2b[_0x9a69('0x1b')]['id']){try{var _0x434870=getId(_0x5f3f2b[_0x9a69('0x19')],_0x5f3f2b[_0x9a69('0x1a')]?_0x5f3f2b[_0x9a69('0x1a')]['id']:0x0,_0x5f3f2b[_0x9a69('0x1b')]?_0x5f3f2b[_0x9a69('0x1b')]['id']:0x0);if(_0x34b5b0['rules'][_0x434870]){_0x34b5b0[_0x9a69('0x18')][_0x434870][_0x9a69('0x3e')](_0x9a69('0x45'));}return _0x5c49e0({'code':0xc8,'message':_0x5f3f2b});}catch(_0x298a50){logger['error'](_0x298a50[_0x9a69('0x4b')]);return _0x1ddd4c(_0x42e685[_0x9a69('0x38')](0x1f4,_0x298a50));}}logger[_0x9a69('0x38')]('message\x20is\x20empty');return _0x1ddd4c(_0x42e685[_0x9a69('0x38')](0x1f4,_0x9a69('0x4c')));});},'AgentCapacity':function(_0x4795ab){var _0x533dcd=this;return new Promise(function(_0x34ee21,_0x1a525b){if(_0x34b5b0[_0x9a69('0x42')][_0x9a69('0x4d')](_0x4795ab['id'])){for(var _0x51a8ec in _0x4795ab['capacity']){if(_0x4795ab[_0x9a69('0x4e')][_0x9a69('0x4d')](_0x51a8ec)){if(_0x34b5b0['agents'][_0x4795ab['id']][_0x9a69('0x4d')](_0x51a8ec+_0x9a69('0x4f'))){_0x34b5b0['agents'][_0x4795ab['id']][_0x51a8ec+_0x9a69('0x4f')]=parseInt(_0x4795ab['capacity'][_0x51a8ec],0xa);}}}_0x34b5b0[_0x9a69('0x42')][_0x4795ab['id']]['updateRealtime']();return _0x34ee21({'code':0xc8,'message':_0x34b5b0['agents'][_0x4795ab['id']]});}else{return _0x1a525b(_0x533dcd[_0x9a69('0x38')](0x1f4,_0x9a69('0x50')));}});},'Agents':function(_0x1a9b43){return new Promise(function(_0x526f30,_0x215974){var _0x269cd7=_[_0x9a69('0x51')](_0x34b5b0[_0x9a69('0x42')]);_0x526f30({'count':_0x269cd7['length'],'rows':_0x269cd7});});},'ChatQueues':function(_0x420057){return new Promise(function(_0x45549e,_0x665d9e){var _0x86336f=[];for(var _0x378b5c in _0x34b5b0[_0x9a69('0x52')]){if(_0x34b5b0[_0x9a69('0x52')][_0x9a69('0x4d')](_0x378b5c)){var _0x5b8c79=_0x34b5b0[_0x9a69('0x52')][_0x378b5c];var _0x51bf8d={'id':_0x5b8c79['id'],'available':_0x5b8c79['available'],'loggedIn':_0x5b8c79['loggedIn'],'name':_0x5b8c79[_0x9a69('0x53')],'paused':_0x5b8c79[_0x9a69('0x54')],'waiting':_0x5b8c79[_0x9a69('0x55')]};_0x86336f[_0x9a69('0x25')](_0x51bf8d);}}_0x45549e({'count':_0x86336f[_0x9a69('0x1e')],'rows':_0x86336f});});},'MailQueues':function(_0x3ba1cd){return new Promise(function(_0x48a1b2,_0x361da3){var _0x50bd06=[];for(var _0x6633fd in _0x34b5b0[_0x9a69('0x56')]){if(_0x34b5b0[_0x9a69('0x56')][_0x9a69('0x4d')](_0x6633fd)){var _0x358df3=_0x34b5b0[_0x9a69('0x56')][_0x6633fd];var _0x3ec023={'id':_0x358df3['id'],'available':_0x358df3['available'],'loggedIn':_0x358df3['loggedIn'],'name':_0x358df3[_0x9a69('0x53')],'paused':_0x358df3[_0x9a69('0x54')],'waiting':_0x358df3[_0x9a69('0x55')]};_0x50bd06['push'](_0x3ec023);}}_0x48a1b2({'count':_0x50bd06[_0x9a69('0x1e')],'rows':_0x50bd06});});},'OpenchannelQueues':function(_0xa11f00){return new Promise(function(_0xb93218,_0x270e6b){var _0xbbc647=[];for(var _0x2a7f48 in _0x34b5b0[_0x9a69('0x57')]){if(_0x34b5b0['openchannelQueues']['hasOwnProperty'](_0x2a7f48)){var _0x323d6f=_0x34b5b0['openchannelQueues'][_0x2a7f48];var _0x5238be={'id':_0x323d6f['id'],'available':_0x323d6f[_0x9a69('0x58')],'loggedIn':_0x323d6f[_0x9a69('0x59')],'name':_0x323d6f[_0x9a69('0x53')],'paused':_0x323d6f[_0x9a69('0x54')],'waiting':_0x323d6f[_0x9a69('0x55')]};_0xbbc647[_0x9a69('0x25')](_0x5238be);}}_0xb93218({'count':_0xbbc647[_0x9a69('0x1e')],'rows':_0xbbc647});});},'SmsQueues':function(_0x7dc47f){return new Promise(function(_0x37901d,_0x3735e6){var _0x59f64c=[];for(var _0x5ec07d in _0x34b5b0['smsQueues']){if(_0x34b5b0[_0x9a69('0x5a')][_0x9a69('0x4d')](_0x5ec07d)){var _0x4806c1=_0x34b5b0[_0x9a69('0x5a')][_0x5ec07d];var _0x3a515f={'id':_0x4806c1['id'],'available':_0x4806c1[_0x9a69('0x58')],'loggedIn':_0x4806c1[_0x9a69('0x59')],'name':_0x4806c1[_0x9a69('0x53')],'paused':_0x4806c1['paused'],'waiting':_0x4806c1[_0x9a69('0x55')]};_0x59f64c[_0x9a69('0x25')](_0x3a515f);}}_0x37901d({'count':_0x59f64c[_0x9a69('0x1e')],'rows':_0x59f64c});});},'FaxQueues':function(_0x49829){return new Promise(function(_0x2e8f2e,_0x586faa){var _0x3ba3d9=[];for(var _0x22103a in _0x34b5b0[_0x9a69('0x5b')]){if(_0x34b5b0[_0x9a69('0x5b')][_0x9a69('0x4d')](_0x22103a)){var _0x27dc6b=_0x34b5b0[_0x9a69('0x5b')][_0x22103a];var _0x2320db={'id':_0x27dc6b['id'],'available':_0x27dc6b['available'],'loggedIn':_0x27dc6b[_0x9a69('0x59')],'name':_0x27dc6b['name'],'paused':_0x27dc6b[_0x9a69('0x54')],'waiting':_0x27dc6b['waiting']};_0x3ba3d9[_0x9a69('0x25')](_0x2320db);}}_0x2e8f2e({'count':_0x3ba3d9[_0x9a69('0x1e')],'rows':_0x3ba3d9});});},'WhatsappQueues':function(_0x3425ce){return new Promise(function(_0x5d9afd,_0x340a0b){var _0x464e17=[];for(var _0x481b5a in _0x34b5b0[_0x9a69('0x5c')]){if(_0x34b5b0[_0x9a69('0x5c')][_0x9a69('0x4d')](_0x481b5a)){var _0x109a27=_0x34b5b0['whatsappQueues'][_0x481b5a];var _0x5d1fa2={'id':_0x109a27['id'],'available':_0x109a27[_0x9a69('0x58')],'loggedIn':_0x109a27['loggedIn'],'name':_0x109a27[_0x9a69('0x53')],'paused':_0x109a27[_0x9a69('0x54')],'waiting':_0x109a27[_0x9a69('0x55')]};_0x464e17['push'](_0x5d1fa2);}}_0x5d9afd({'count':_0x464e17['length'],'rows':_0x464e17});});},'ChatQueuesWaitingInteractions':function(_0x5868aa){return new Promise(function(_0x39749f,_0x57d8f9){var _0x51c119=_[_0x9a69('0x51')](_0x34b5b0['chatQueuesWaitingInteractions']);_0x39749f({'count':_0x51c119['length'],'rows':_0x51c119});});},'MailQueuesWaitingInteractions':function(_0x1594c5){return new Promise(function(_0x40a1f9,_0x99e46d){var _0x2d1411=_[_0x9a69('0x51')](_0x34b5b0['mailQueuesWaitingInteractions']);_0x40a1f9({'count':_0x2d1411[_0x9a69('0x1e')],'rows':_0x2d1411});});},'OpenchannelQueuesWaitingInteractions':function(_0x266c02){return new Promise(function(_0x146558,_0x27acab){var _0x447d34=_[_0x9a69('0x51')](_0x34b5b0[_0x9a69('0x5d')]);_0x146558({'count':_0x447d34[_0x9a69('0x1e')],'rows':_0x447d34});});},'SmsQueuesWaitingInteractions':function(_0x24efff){return new Promise(function(_0x41ad8b,_0x9636ec){var _0x4a617d=_[_0x9a69('0x51')](_0x34b5b0[_0x9a69('0x5e')]);_0x41ad8b({'count':_0x4a617d[_0x9a69('0x1e')],'rows':_0x4a617d});});},'FaxQueuesWaitingInteractions':function(_0x2e8d10){return new Promise(function(_0x4d051c,_0x1b2f5d){var _0x59609a=_[_0x9a69('0x51')](_0x34b5b0[_0x9a69('0x5f')]);_0x4d051c({'count':_0x59609a['length'],'rows':_0x59609a});});},'WhatsappQueuesWaitingInteractions':function(_0x2ac739){return new Promise(function(_0x55feb3,_0x1b8883){var _0x2cc3a5=_[_0x9a69('0x51')](_0x34b5b0['whatsappQueuesWaitingInteractions']);_0x55feb3({'count':_0x2cc3a5['length'],'rows':_0x2cc3a5});});}};var _0x505675=jayson[_0x9a69('0x60')](_0x2323ae)['http']();_0x505675['on'](_0x9a69('0x38'),function(_0x17736b){logger[_0x9a69('0x38')](JSON['stringify'](_0x17736b));return _0x4d4450(_0x17736b);});_0x505675[_0x9a69('0x17')](0x232c,_0x9a69('0x61'),function(){console[_0x9a69('0x62')](_0x9a69('0x63'),0x232c);return _0x1581d6(_0x9a69('0x64')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 6a512f7..97502a9 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 _0xa81f=['http','request','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','format','iftime\x20%s','message','true','catch','error','[%s][INTERVAL]\x20%s','all','then','some','[%s][INTERVAL]\x20%s\x20%s','join','when','log','\x20|\x20','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client'];(function(_0x53b780,_0x863743){var _0x5160a3=function(_0xedab95){while(--_0xedab95){_0x53b780['push'](_0x53b780['shift']());}};_0x5160a3(++_0x863743);}(_0xa81f,0x16d));var _0xfa81=function(_0x1ae7b0,_0x2301a2){_0x1ae7b0=_0x1ae7b0-0x0;var _0x2d83dc=_0xa81f[_0x1ae7b0];return _0x2d83dc;};'use strict';var util=require(_0xfa81('0x0'));var BPromise=require(_0xfa81('0x1'));var jayson=require(_0xfa81('0x2'));var _=require(_0xfa81('0x3'));var logger=require(_0xfa81('0x4'))(_0xfa81('0x5'));var client=jayson[_0xfa81('0x6')][_0xfa81('0x7')]({'port':0x232a});function request(_0x2cb79e,_0x3bd3ad){return new BPromise(function(_0x33e9cd,_0x5addbb){return client[_0xfa81('0x8')](_0x2cb79e,_0x3bd3ad)['then'](function(_0x36616f){if(_0x36616f['error']){return _0x5addbb(_0x36616f['error']['message']);}else{return _0x33e9cd(_0x36616f['result']);}})['catch'](function(_0x4f967){return _0x5addbb(_0x4f967);});});}exports['condition']=function(_0xd49329,_0x16d93f,_0x52861a){return function(_0x40f5e8){if(_0x52861a[_0xfa81('0x9')]&&!_0x52861a[_0xfa81('0x9')][_0xd49329]){logger[_0xfa81('0xa')](_0xfa81('0xb'),_0xd49329);return _0x40f5e8[_0xfa81('0xc')]();}var _0x518b57=[];for(var _0x299aa6=0x0;_0x299aa6<_0x16d93f['length'];_0x299aa6+=0x1){_0x518b57[_0xfa81('0xd')](request(_0xfa81('0xe'),{'command':util[_0xfa81('0xf')](_0xfa81('0x10'),_0x16d93f[_0x299aa6])})['then'](function(_0x825103){return _0x825103&&_0x825103[_0xfa81('0x11')]&&_0x825103[_0xfa81('0x11')]['indexOf'](_0xfa81('0x12'))>=0x0?!![]:![];})[_0xfa81('0x13')](function(_0x21ffdc){logger[_0xfa81('0x14')](_0xfa81('0x15'),_0xd49329,_0x16d93f[_0x299aa6]);}));}BPromise[_0xfa81('0x16')](_0x518b57)[_0xfa81('0x17')](function(_0x52ec89){var _0x4569ae=_[_0xfa81('0x18')](_0x52ec89);logger[_0xfa81('0xa')](_0xfa81('0x19'),_0xd49329,_0x16d93f[_0xfa81('0x1a')]('\x20|\x20'),_0x4569ae);_0x40f5e8[_0xfa81('0x1b')](_0x4569ae);})[_0xfa81('0x13')](function(_0x487e97){console[_0xfa81('0x1c')](_0x487e97);logger['error'](_0xfa81('0x19'),_0xd49329,_0x16d93f[_0xfa81('0x1a')](_0xfa81('0x1d')),_0x487e97[_0xfa81('0x1e')]);_0x40f5e8[_0xfa81('0xc')]();});};}; \ No newline at end of file +var _0xabf6=['stack','bluebird','jayson/promise','../../../config/logger','routing','client','http','request','error','message','result','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','iftime\x20%s','then','indexOf','true','[%s][INTERVAL]\x20%s','some','info','[%s][INTERVAL]\x20%s\x20%s','log','join','\x20|\x20'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0xabf6,0x196));var _0x6abf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xabf6[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var BPromise=require(_0x6abf('0x0'));var jayson=require(_0x6abf('0x1'));var _=require('lodash');var logger=require(_0x6abf('0x2'))(_0x6abf('0x3'));var client=jayson[_0x6abf('0x4')][_0x6abf('0x5')]({'port':0x232a});function request(_0x2e016b,_0x4deb93){return new BPromise(function(_0x26f692,_0x25f53e){return client[_0x6abf('0x6')](_0x2e016b,_0x4deb93)['then'](function(_0x337c3f){if(_0x337c3f[_0x6abf('0x7')]){return _0x25f53e(_0x337c3f[_0x6abf('0x7')][_0x6abf('0x8')]);}else{return _0x26f692(_0x337c3f[_0x6abf('0x9')]);}})['catch'](function(_0x338070){return _0x25f53e(_0x338070);});});}exports[_0x6abf('0xa')]=function(_0x23556d,_0x4f6a3c,_0x29034c){return function(_0x432639){if(_0x29034c[_0x6abf('0xb')]&&!_0x29034c[_0x6abf('0xb')][_0x23556d]){logger['info'](_0x6abf('0xc'),_0x23556d);return _0x432639['stop']();}var _0xf848fc=[];for(var _0x5b57b1=0x0;_0x5b57b1<_0x4f6a3c[_0x6abf('0xd')];_0x5b57b1+=0x1){_0xf848fc[_0x6abf('0xe')](request('Command',{'command':util['format'](_0x6abf('0xf'),_0x4f6a3c[_0x5b57b1])})[_0x6abf('0x10')](function(_0x2a9b92){return _0x2a9b92&&_0x2a9b92[_0x6abf('0x8')]&&_0x2a9b92[_0x6abf('0x8')][_0x6abf('0x11')](_0x6abf('0x12'))>=0x0?!![]:![];})['catch'](function(_0x4a9ceb){logger['error'](_0x6abf('0x13'),_0x23556d,_0x4f6a3c[_0x5b57b1]);}));}BPromise['all'](_0xf848fc)['then'](function(_0x4707e4){var _0x34663b=_[_0x6abf('0x14')](_0x4707e4);logger[_0x6abf('0x15')](_0x6abf('0x16'),_0x23556d,_0x4f6a3c['join']('\x20|\x20'),_0x34663b);_0x432639['when'](_0x34663b);})['catch'](function(_0x4821f3){console[_0x6abf('0x17')](_0x4821f3);logger[_0x6abf('0x7')]('[%s][INTERVAL]\x20%s\x20%s',_0x23556d,_0x4f6a3c[_0x6abf('0x18')](_0x6abf('0x19')),_0x4821f3[_0x6abf('0x1a')]);_0x432639['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 34d750f..66caefd 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 _0x5423=['info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','agentringnoanswer','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','error','queuecallerabandon','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfertype','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','cause','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','lodash','util','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','interface','calleridnum','connectedlinenum','lastevent','queue','then','type','agentcomplete','acw','agentacw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5423,0xe3));var _0x3542=function(_0xc1a094,_0x9b609f){_0xc1a094=_0xc1a094-0x0;var _0x5c17d4=_0x5423[_0xc1a094];return _0x5c17d4;};'use strict';var _=require(_0x3542('0x0'));var util=require(_0x3542('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x331a98,_0x457909){utils['info'](util[_0x3542('0x2')](_0x3542('0x3'),_0x331a98[_0x3542('0x4')],_0x331a98[_0x3542('0x5')],_0x331a98['queue'],_0x331a98[_0x3542('0x6')],_0x331a98[_0x3542('0x7')],_0x331a98[_0x3542('0x8')],_0x331a98[_0x3542('0x9')],_0x331a98[_0x3542('0xa')]));if(_0x331a98['queue']){utils['getVoiceQueueByName'](_0x331a98[_0x3542('0xb')])[_0x3542('0xc')](function(_0x53ece9){if(_0x53ece9){_0x331a98[_0x3542('0xd')]=_0x53ece9[_0x3542('0xd')];_0x331a98['agentacw']=_0x331a98[_0x3542('0xe')]?_0x53ece9[_0x3542('0xf')]:![];_0x331a98['acwtime']=_0x331a98[_0x3542('0x10')]?_0x53ece9[_0x3542('0x11')]:0x0;}utils[_0x3542('0x12')](_0x3542('0x13'),_0x331a98);});}else{utils[_0x3542('0x12')](_0x3542('0x13'),_0x331a98);}if(_0x457909){delete transfers[_0x331a98[_0x3542('0x4')]];}else{delete agents[_0x331a98[_0x3542('0x14')]];}}exports[_0x3542('0x15')]=function(_0x1a9062){try{utils[_0x3542('0x16')](util[_0x3542('0x2')](_0x3542('0x17'),_0x1a9062['uniqueid']),_0x1a9062);agents[_0x1a9062[_0x3542('0x14')]]=_0x1a9062;agents[_0x1a9062['destuniqueid']][_0x3542('0x18')]=utils[_0x3542('0x19')]();agents[_0x1a9062[_0x3542('0x14')]]['lastevent']=_0x3542('0x1a');agents[_0x1a9062[_0x3542('0x14')]][_0x3542('0x9')]=null;agents[_0x1a9062['destuniqueid']][_0x3542('0x1b')]=null;utils[_0x3542('0x1c')](util[_0x3542('0x2')](_0x3542('0x1d'),_0x1a9062['uniqueid'],agents[_0x1a9062[_0x3542('0x14')]]['membername'],_0x1a9062[_0x3542('0x14')]));}catch(_0x369e0c){utils['error'](util[_0x3542('0x2')](_0x3542('0x17'),_0x1a9062[_0x3542('0x4')]),_0x369e0c);}};exports[_0x3542('0x1e')]=function(_0x212950){try{if(!_['isNil'](agents[_0x212950['destuniqueid']])){utils['debug'](util[_0x3542('0x2')]('[%s][agents][agentringnoanswer]',_0x212950[_0x3542('0x4')]),_0x212950);utils['info'](util[_0x3542('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x212950['uniqueid'],agents[_0x212950[_0x3542('0x14')]][_0x3542('0x6')],_0x212950['destuniqueid']));agents[_0x212950['destuniqueid']][_0x3542('0x1e')]=!![];agents[_0x212950['destuniqueid']][_0x3542('0x1f')]=utils[_0x3542('0x19')]();agents[_0x212950[_0x3542('0x14')]][_0x3542('0xa')]=_0x3542('0x20');agents[_0x212950[_0x3542('0x14')]][_0x3542('0x21')]=_0x3542('0x20');agents[_0x212950[_0x3542('0x14')]][_0x3542('0x22')]=_0x212950[_0x3542('0x23')]?parseInt(_0x212950[_0x3542('0x23')])/0x3e8:0x0;agents[_0x212950[_0x3542('0x14')]][_0x3542('0x24')]=0x0;unanswered[_0x3542('0x25')](_0x212950[_0x3542('0x14')]);}}catch(_0x303412){utils[_0x3542('0x26')](util[_0x3542('0x2')]('[%s][agents][agentringnoanswer]',_0x212950[_0x3542('0x4')]),_0x303412);}};exports[_0x3542('0x27')]=function(_0x2aec76){try{_['forIn'](agents,function(_0x402c97,_0xc6f23b){if(_0x402c97[_0x3542('0x4')]==_0x2aec76[_0x3542('0x4')]&&!_['includes'](unanswered,_0x402c97['destuniqueid'])){utils[_0x3542('0x16')](util[_0x3542('0x2')](_0x3542('0x28'),_0x2aec76[_0x3542('0x4')]),_0x2aec76);utils[_0x3542('0x1c')](util[_0x3542('0x2')](_0x3542('0x29'),_0x2aec76['uniqueid'],_0x402c97['membername'],_0x402c97[_0x3542('0x14')]));_0x402c97['agentringnoanswer']=!![];_0x402c97['agentringnoanswerAt']=utils[_0x3542('0x19')]();_0x402c97['lastevent']='abandoned';_0x402c97[_0x3542('0x21')]=_0x3542('0x2a');_0x402c97[_0x3542('0x22')]=_0x2aec76['holdtime'];_0x402c97[_0x3542('0x24')]=0x0;writeDB(_0x402c97);}});}catch(_0x49b523){utils[_0x3542('0x26')](util[_0x3542('0x2')]('[%s][agents][queuecallerabandon]',_0x2aec76[_0x3542('0x4')]),_0x49b523);}};exports['agentconnect']=function(_0x204e5e){try{if(agents[_0x204e5e[_0x3542('0x14')]]){utils[_0x3542('0x16')](util['format'](_0x3542('0x2b'),_0x204e5e['uniqueid']),_0x204e5e);utils[_0x3542('0x1c')](util[_0x3542('0x2')](_0x3542('0x2c'),_0x204e5e[_0x3542('0x4')],agents[_0x204e5e[_0x3542('0x14')]][_0x3542('0x6')],_0x204e5e[_0x3542('0x14')]));agents[_0x204e5e[_0x3542('0x14')]][_0x3542('0x2d')]=utils[_0x3542('0x19')]();agents[_0x204e5e[_0x3542('0x14')]][_0x3542('0x9')]=_0x204e5e[_0x3542('0x9')];agents[_0x204e5e['destuniqueid']][_0x3542('0x1b')]=_0x204e5e['connectedlinename'];agents[_0x204e5e['destuniqueid']][_0x3542('0x22')]=_0x204e5e[_0x3542('0x23')];agents[_0x204e5e[_0x3542('0x14')]][_0x3542('0xa')]=_0x3542('0x2e');_[_0x3542('0x2f')](agents,function(_0xc7f13c,_0x42e87a){if(_0xc7f13c['destuniqueid']!=_0x204e5e[_0x3542('0x14')]&&_0xc7f13c['uniqueid']==_0x204e5e[_0x3542('0x4')]){_0xc7f13c[_0x3542('0x24')]=0x0;_0xc7f13c['holdtime']=_0x204e5e[_0x3542('0x23')];_0xc7f13c[_0x3542('0x1e')]=!![];_0xc7f13c['agentringnoanswerAt']=utils[_0x3542('0x19')]();_0xc7f13c[_0x3542('0xa')]='answered_elsewhere';_0xc7f13c[_0x3542('0x21')]=_0x3542('0x30');_0xc7f13c[_0x3542('0x31')]=_0x204e5e[_0x3542('0x14')];_0xc7f13c[_0x3542('0x32')]=_0x204e5e[_0x3542('0x6')];writeDB(_0xc7f13c);}});}}catch(_0x2b54b9){utils['error'](util['format'](_0x3542('0x2b'),_0x204e5e[_0x3542('0x4')]),_0x2b54b9);}};exports[_0x3542('0xe')]=function(_0xdeebd3){try{if(!_[_0x3542('0x33')](agents[_0xdeebd3['destuniqueid']])){utils[_0x3542('0x16')](util['format'](_0x3542('0x34'),_0xdeebd3[_0x3542('0x4')]),_0xdeebd3);utils[_0x3542('0x1c')](util['format'](_0x3542('0x35'),_0xdeebd3[_0x3542('0x4')],agents[_0xdeebd3['destuniqueid']][_0x3542('0x6')],_0xdeebd3[_0x3542('0x14')]));agents[_0xdeebd3[_0x3542('0x14')]][_0x3542('0xe')]=!![];agents[_0xdeebd3[_0x3542('0x14')]][_0x3542('0x36')]=utils[_0x3542('0x19')]();agents[_0xdeebd3[_0x3542('0x14')]]['talktime']=utils['diffTime'](agents[_0xdeebd3['destuniqueid']][_0x3542('0x36')],agents[_0xdeebd3[_0x3542('0x14')]][_0x3542('0x2d')]);agents[_0xdeebd3[_0x3542('0x14')]][_0x3542('0x21')]=_0xdeebd3[_0x3542('0x21')];agents[_0xdeebd3[_0x3542('0x14')]]['lastevent']=_0x3542('0x37');writeDB(agents[_0xdeebd3[_0x3542('0x14')]]);}}catch(_0x3da43e){utils[_0x3542('0x26')](util['format'](_0x3542('0x34'),_0xdeebd3[_0x3542('0x4')]),_0x3da43e);}};exports['blindtransfer']=function(_0x528f8c){try{if(!_[_0x3542('0x33')](agents[_0x528f8c[_0x3542('0x38')]])){utils[_0x3542('0x16')](util[_0x3542('0x2')](_0x3542('0x39'),_0x528f8c[_0x3542('0x4')]),_0x528f8c);utils[_0x3542('0x1c')](util['format'](_0x3542('0x3a'),_0x528f8c[_0x3542('0x4')],agents[_0x528f8c[_0x3542('0x38')]][_0x3542('0x6')],agents[_0x528f8c[_0x3542('0x38')]][_0x3542('0x4')]));agents[_0x528f8c[_0x3542('0x38')]][_0x3542('0x3b')]=!![];agents[_0x528f8c[_0x3542('0x38')]]['transfertype']='blind';agents[_0x528f8c[_0x3542('0x38')]]['transferexten']=_0x528f8c['extension'];agents[_0x528f8c['transfereruniqueid']][_0x3542('0x3c')]=agents[_0x528f8c[_0x3542('0x38')]][_0x3542('0x4')];}}catch(_0x48cfc4){utils[_0x3542('0x26')](util[_0x3542('0x2')]('[%s][agents][blindtransfer]',_0x528f8c[_0x3542('0x4')]),_0x48cfc4);}};exports[_0x3542('0x3d')]=function(_0x442000){try{utils[_0x3542('0x16')](util[_0x3542('0x2')]('[%s][agents][attendedtransfer]',_0x442000[_0x3542('0x3e')]),_0x442000);if(_0x442000[_0x3542('0x3e')]==_0x442000[_0x3542('0x3f')]){if(!_[_0x3542('0x33')](agents[_0x442000[_0x3542('0x40')]])){utils['info'](util['format'](_0x3542('0x41'),_0x442000[_0x3542('0x3e')],agents[_0x442000[_0x3542('0x40')]]['membername']));agents[_0x442000[_0x3542('0x40')]][_0x3542('0x3b')]=!![];agents[_0x442000[_0x3542('0x40')]][_0x3542('0x42')]=_0x3542('0x43');agents[_0x442000['secondtransfereruniqueid']]['transferexten']=_0x442000[_0x3542('0x44')];agents[_0x442000['secondtransfereruniqueid']][_0x3542('0x3c')]=_0x442000[_0x3542('0x3e')];}if(_0x442000['transfereeuniqueid']&&agents[_0x442000[_0x3542('0x45')]]){agents[_0x442000[_0x3542('0x45')]][_0x3542('0x46')]=0x1;transfers[_0x442000[_0x3542('0x45')]]=_[_0x3542('0x47')](agents[_0x442000['transfereeuniqueid']]);transfers[_0x442000['transfereeuniqueid']][_0x3542('0x8')]=agents[_0x442000['secondtransfereruniqueid']][_0x3542('0x8')];transfers[_0x442000[_0x3542('0x45')]][_0x3542('0x48')]=agents[_0x442000['secondtransfereruniqueid']][_0x3542('0x48')];transfers[_0x442000[_0x3542('0x45')]][_0x3542('0x18')]=utils[_0x3542('0x19')]();transfers[_0x442000[_0x3542('0x45')]][_0x3542('0x2d')]=utils['now']();transfers[_0x442000[_0x3542('0x45')]][_0x3542('0x22')]=0x0;transfers[_0x442000[_0x3542('0x45')]][_0x3542('0x46')]=0x2;}}else if(_0x442000[_0x3542('0x40')]==_0x442000[_0x3542('0x49')]){if(!_['isNil'](agents[_0x442000[_0x3542('0x3e')]])){utils[_0x3542('0x1c')](util[_0x3542('0x2')](_0x3542('0x41'),_0x442000['origtransfereruniqueid'],agents[_0x442000[_0x3542('0x3e')]][_0x3542('0x6')]));agents[_0x442000['origtransfereruniqueid']]['transfer']=!![];agents[_0x442000[_0x3542('0x3e')]]['transfertype']=_0x3542('0x43');agents[_0x442000['origtransfereruniqueid']]['transferexten']=_0x442000[_0x3542('0x4a')];agents[_0x442000[_0x3542('0x3e')]][_0x3542('0x3c')]=_0x442000[_0x3542('0x40')];}if(_0x442000[_0x3542('0x4b')]&&agents[_0x442000[_0x3542('0x4b')]]){agents[_0x442000[_0x3542('0x4b')]]['agententerreason']=0x1;transfers[_0x442000[_0x3542('0x4b')]]=_[_0x3542('0x47')](agents[_0x442000[_0x3542('0x4b')]]);transfers[_0x442000[_0x3542('0x4b')]][_0x3542('0x8')]=agents[_0x442000['origtransfereruniqueid']][_0x3542('0x8')];transfers[_0x442000[_0x3542('0x4b')]][_0x3542('0x48')]=agents[_0x442000[_0x3542('0x3e')]][_0x3542('0x48')];transfers[_0x442000[_0x3542('0x4b')]][_0x3542('0x18')]=utils['now']();transfers[_0x442000[_0x3542('0x4b')]]['agentconnectAt']=utils[_0x3542('0x19')]();transfers[_0x442000[_0x3542('0x4b')]][_0x3542('0x22')]=0x0;transfers[_0x442000[_0x3542('0x4b')]]['agententerreason']=0x2;}}}catch(_0x47c624){utils['error'](util[_0x3542('0x2')](_0x3542('0x4c'),_0x442000[_0x3542('0x3e')]),_0x47c624);}};exports[_0x3542('0x4d')]=function(_0x1ebe3a){try{utils[_0x3542('0x16')](util[_0x3542('0x2')](_0x3542('0x4e'),_0x1ebe3a[_0x3542('0x4')]),_0x1ebe3a);if(agents[_0x1ebe3a['uniqueid']]&&agents[_0x1ebe3a[_0x3542('0x4')]][_0x3542('0x21')]===_0x3542('0x20')){if(_0x1ebe3a[_0x3542('0x4f')]==='21'){agents[_0x1ebe3a[_0x3542('0x4')]]['reason']='rejected';agents[_0x1ebe3a[_0x3542('0x4')]][_0x3542('0xa')]='rejected';}utils[_0x3542('0x1c')](util['format'](_0x3542('0x50'),_0x1ebe3a['uniqueid'],agents[_0x1ebe3a[_0x3542('0x4')]][_0x3542('0x6')],agents[_0x1ebe3a['uniqueid']]['reason'],agents[_0x1ebe3a['uniqueid']][_0x3542('0xa')]));writeDB(agents[_0x1ebe3a['uniqueid']]);var _0x16159f=unanswered[_0x3542('0x51')](_0x1ebe3a['uniqueid']);if(_0x16159f>-0x1){unanswered[_0x3542('0x52')](_0x16159f,0x1);}}if(transfers[_0x1ebe3a[_0x3542('0x4')]]){transfers[_0x1ebe3a[_0x3542('0x4')]]['agentcomplete']=!![];transfers[_0x1ebe3a[_0x3542('0x4')]]['agentcompleteAt']=utils[_0x3542('0x19')]();transfers[_0x1ebe3a['uniqueid']][_0x3542('0x24')]=utils[_0x3542('0x53')](transfers[_0x1ebe3a[_0x3542('0x4')]]['agentcompleteAt'],transfers[_0x1ebe3a[_0x3542('0x4')]][_0x3542('0x2d')]);transfers[_0x1ebe3a[_0x3542('0x4')]][_0x3542('0x21')]='agent';transfers[_0x1ebe3a['uniqueid']][_0x3542('0xa')]=_0x3542('0x37');utils[_0x3542('0x1c')](util[_0x3542('0x2')](_0x3542('0x50'),_0x1ebe3a[_0x3542('0x4')],transfers[_0x1ebe3a[_0x3542('0x4')]][_0x3542('0x6')],transfers[_0x1ebe3a[_0x3542('0x4')]][_0x3542('0x21')],transfers[_0x1ebe3a[_0x3542('0x4')]][_0x3542('0xa')]));writeDB(transfers[_0x1ebe3a[_0x3542('0x4')]],!![]);}if(agents[_0x1ebe3a[_0x3542('0x4')]]&&agents[_0x1ebe3a[_0x3542('0x4')]][_0x3542('0x2d')]){agents[_0x1ebe3a[_0x3542('0x4')]][_0x3542('0xe')]=!![];agents[_0x1ebe3a['uniqueid']][_0x3542('0x36')]=utils[_0x3542('0x19')]();agents[_0x1ebe3a['uniqueid']]['talktime']=utils[_0x3542('0x53')](agents[_0x1ebe3a[_0x3542('0x4')]][_0x3542('0x36')],agents[_0x1ebe3a[_0x3542('0x4')]]['agentconnectAt']);agents[_0x1ebe3a[_0x3542('0x4')]][_0x3542('0x21')]=agents[_0x1ebe3a['uniqueid']][_0x3542('0x3b')]?'transfer':_0x3542('0x54');agents[_0x1ebe3a['uniqueid']][_0x3542('0xa')]=_0x3542('0x37');utils[_0x3542('0x1c')](util[_0x3542('0x2')](_0x3542('0x50'),_0x1ebe3a[_0x3542('0x4')],agents[_0x1ebe3a[_0x3542('0x4')]]['membername'],agents[_0x1ebe3a[_0x3542('0x4')]]['reason'],agents[_0x1ebe3a['uniqueid']][_0x3542('0xa')]));writeDB(agents[_0x1ebe3a[_0x3542('0x4')]]);}}catch(_0x2c6f2b){utils[_0x3542('0x26')](util['format'](_0x3542('0x4e'),_0x1ebe3a[_0x3542('0x4')]),_0x2c6f2b);}}; \ No newline at end of file +var _0x0fd9=['agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','format','agentcalledAt','now','connectedlinenum','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','holdtime','ringtime','forIn','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','reason','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connect','talktime','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','transfer','ATTENDED','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','calleridnum','hangup','cause','rejected','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','[%s][agents][hangup]','util','./utils','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','lastevent','then','type'];(function(_0x28387c,_0x548fd1){var _0x127141=function(_0x43cf24){while(--_0x43cf24){_0x28387c['push'](_0x28387c['shift']());}};_0x127141(++_0x548fd1);}(_0x0fd9,0xa3));var _0x90fd=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x0fd9[_0x2235bf];return _0x4c3a64;};'use strict';var _=require('lodash');var util=require(_0x90fd('0x0'));var utils=require(_0x90fd('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x685cd0,_0x32f6b6){utils['info'](util['format'](_0x90fd('0x2'),_0x685cd0[_0x90fd('0x3')],_0x685cd0[_0x90fd('0x4')],_0x685cd0[_0x90fd('0x5')],_0x685cd0[_0x90fd('0x6')],_0x685cd0[_0x90fd('0x7')],_0x685cd0['calleridnum'],_0x685cd0['connectedlinenum'],_0x685cd0[_0x90fd('0x8')]));if(_0x685cd0['queue']){utils['getVoiceQueueByName'](_0x685cd0[_0x90fd('0x5')])[_0x90fd('0x9')](function(_0x5e66f0){if(_0x5e66f0){_0x685cd0[_0x90fd('0xa')]=_0x5e66f0[_0x90fd('0xa')];_0x685cd0[_0x90fd('0xb')]=_0x685cd0[_0x90fd('0xc')]?_0x5e66f0[_0x90fd('0xd')]:![];_0x685cd0[_0x90fd('0xe')]=_0x685cd0[_0x90fd('0xb')]?_0x5e66f0[_0x90fd('0xf')]:0x0;}utils[_0x90fd('0x10')]('CreateVoiceAgentReport',_0x685cd0);});}else{utils[_0x90fd('0x10')](_0x90fd('0x11'),_0x685cd0);}if(_0x32f6b6){delete transfers[_0x685cd0['uniqueid']];}else{delete agents[_0x685cd0[_0x90fd('0x12')]];}}exports[_0x90fd('0x13')]=function(_0x19a594){try{utils['debug'](util[_0x90fd('0x14')]('[%s][agents][agentcalled]',_0x19a594[_0x90fd('0x3')]),_0x19a594);agents[_0x19a594[_0x90fd('0x12')]]=_0x19a594;agents[_0x19a594[_0x90fd('0x12')]][_0x90fd('0x15')]=utils[_0x90fd('0x16')]();agents[_0x19a594[_0x90fd('0x12')]][_0x90fd('0x8')]='called';agents[_0x19a594['destuniqueid']][_0x90fd('0x17')]=null;agents[_0x19a594[_0x90fd('0x12')]]['connectedlinename']=null;utils[_0x90fd('0x18')](util[_0x90fd('0x14')](_0x90fd('0x19'),_0x19a594['uniqueid'],agents[_0x19a594[_0x90fd('0x12')]][_0x90fd('0x6')],_0x19a594[_0x90fd('0x12')]));}catch(_0x14958b){utils[_0x90fd('0x1a')](util[_0x90fd('0x14')](_0x90fd('0x1b'),_0x19a594[_0x90fd('0x3')]),_0x14958b);}};exports[_0x90fd('0x1c')]=function(_0x90197e){try{if(!_[_0x90fd('0x1d')](agents[_0x90197e[_0x90fd('0x12')]])){utils[_0x90fd('0x1e')](util[_0x90fd('0x14')](_0x90fd('0x1f'),_0x90197e['uniqueid']),_0x90197e);utils[_0x90fd('0x18')](util[_0x90fd('0x14')](_0x90fd('0x20'),_0x90197e[_0x90fd('0x3')],agents[_0x90197e[_0x90fd('0x12')]][_0x90fd('0x6')],_0x90197e[_0x90fd('0x12')]));agents[_0x90197e[_0x90fd('0x12')]]['agentringnoanswer']=!![];agents[_0x90197e[_0x90fd('0x12')]]['agentringnoanswerAt']=utils[_0x90fd('0x16')]();agents[_0x90197e[_0x90fd('0x12')]][_0x90fd('0x8')]=_0x90fd('0x21');agents[_0x90197e[_0x90fd('0x12')]]['reason']=_0x90fd('0x21');agents[_0x90197e[_0x90fd('0x12')]][_0x90fd('0x22')]=_0x90197e[_0x90fd('0x23')]?parseInt(_0x90197e[_0x90fd('0x23')])/0x3e8:0x0;agents[_0x90197e[_0x90fd('0x12')]]['talktime']=0x0;unanswered['push'](_0x90197e[_0x90fd('0x12')]);}}catch(_0x170cfb){utils[_0x90fd('0x1a')](util[_0x90fd('0x14')](_0x90fd('0x1f'),_0x90197e['uniqueid']),_0x170cfb);}};exports['queuecallerabandon']=function(_0x3781bb){try{_[_0x90fd('0x24')](agents,function(_0x228fbc,_0x3a0102){if(_0x228fbc['uniqueid']==_0x3781bb['uniqueid']&&!_[_0x90fd('0x25')](unanswered,_0x228fbc[_0x90fd('0x12')])){utils[_0x90fd('0x1e')](util[_0x90fd('0x14')]('[%s][agents][queuecallerabandon]',_0x3781bb[_0x90fd('0x3')]),_0x3781bb);utils[_0x90fd('0x18')](util[_0x90fd('0x14')](_0x90fd('0x26'),_0x3781bb[_0x90fd('0x3')],_0x228fbc[_0x90fd('0x6')],_0x228fbc[_0x90fd('0x12')]));_0x228fbc[_0x90fd('0x1c')]=!![];_0x228fbc[_0x90fd('0x27')]=utils[_0x90fd('0x16')]();_0x228fbc[_0x90fd('0x8')]=_0x90fd('0x28');_0x228fbc[_0x90fd('0x29')]=_0x90fd('0x28');_0x228fbc[_0x90fd('0x22')]=_0x3781bb[_0x90fd('0x22')];_0x228fbc['talktime']=0x0;writeDB(_0x228fbc);}});}catch(_0x13c019){utils[_0x90fd('0x1a')](util[_0x90fd('0x14')](_0x90fd('0x2a'),_0x3781bb[_0x90fd('0x3')]),_0x13c019);}};exports[_0x90fd('0x2b')]=function(_0x35eae2){try{if(agents[_0x35eae2[_0x90fd('0x12')]]){utils[_0x90fd('0x1e')](util[_0x90fd('0x14')](_0x90fd('0x2c'),_0x35eae2[_0x90fd('0x3')]),_0x35eae2);utils[_0x90fd('0x18')](util['format'](_0x90fd('0x2d'),_0x35eae2[_0x90fd('0x3')],agents[_0x35eae2[_0x90fd('0x12')]][_0x90fd('0x6')],_0x35eae2['destuniqueid']));agents[_0x35eae2[_0x90fd('0x12')]][_0x90fd('0x2e')]=utils[_0x90fd('0x16')]();agents[_0x35eae2['destuniqueid']]['connectedlinenum']=_0x35eae2[_0x90fd('0x17')];agents[_0x35eae2[_0x90fd('0x12')]][_0x90fd('0x2f')]=_0x35eae2[_0x90fd('0x2f')];agents[_0x35eae2[_0x90fd('0x12')]][_0x90fd('0x22')]=_0x35eae2[_0x90fd('0x23')];agents[_0x35eae2[_0x90fd('0x12')]][_0x90fd('0x8')]=_0x90fd('0x30');_[_0x90fd('0x24')](agents,function(_0x43c84c,_0x21dc9c){if(_0x43c84c[_0x90fd('0x12')]!=_0x35eae2[_0x90fd('0x12')]&&_0x43c84c[_0x90fd('0x3')]==_0x35eae2[_0x90fd('0x3')]){_0x43c84c[_0x90fd('0x31')]=0x0;_0x43c84c['holdtime']=_0x35eae2[_0x90fd('0x23')];_0x43c84c[_0x90fd('0x1c')]=!![];_0x43c84c[_0x90fd('0x27')]=utils['now']();_0x43c84c['lastevent']='answered_elsewhere';_0x43c84c[_0x90fd('0x29')]=_0x90fd('0x32');_0x43c84c[_0x90fd('0x33')]=_0x35eae2[_0x90fd('0x12')];_0x43c84c[_0x90fd('0x34')]=_0x35eae2[_0x90fd('0x6')];writeDB(_0x43c84c);}});}}catch(_0x363365){utils[_0x90fd('0x1a')](util[_0x90fd('0x14')](_0x90fd('0x2c'),_0x35eae2[_0x90fd('0x3')]),_0x363365);}};exports[_0x90fd('0xc')]=function(_0x4cb682){try{if(!_[_0x90fd('0x1d')](agents[_0x4cb682[_0x90fd('0x12')]])){utils['debug'](util['format'](_0x90fd('0x35'),_0x4cb682[_0x90fd('0x3')]),_0x4cb682);utils[_0x90fd('0x18')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x4cb682[_0x90fd('0x3')],agents[_0x4cb682[_0x90fd('0x12')]]['membername'],_0x4cb682['destuniqueid']));agents[_0x4cb682[_0x90fd('0x12')]][_0x90fd('0xc')]=!![];agents[_0x4cb682['destuniqueid']]['agentcompleteAt']=utils[_0x90fd('0x16')]();agents[_0x4cb682[_0x90fd('0x12')]][_0x90fd('0x31')]=utils['diffTime'](agents[_0x4cb682[_0x90fd('0x12')]][_0x90fd('0x36')],agents[_0x4cb682['destuniqueid']]['agentconnectAt']);agents[_0x4cb682['destuniqueid']][_0x90fd('0x29')]=_0x4cb682[_0x90fd('0x29')];agents[_0x4cb682['destuniqueid']][_0x90fd('0x8')]=_0x90fd('0x37');writeDB(agents[_0x4cb682[_0x90fd('0x12')]]);}}catch(_0xe5e47e){utils[_0x90fd('0x1a')](util['format']('[%s][agents][agentcomplete]',_0x4cb682[_0x90fd('0x3')]),_0xe5e47e);}};exports[_0x90fd('0x38')]=function(_0x125874){try{if(!_[_0x90fd('0x1d')](agents[_0x125874[_0x90fd('0x39')]])){utils[_0x90fd('0x1e')](util[_0x90fd('0x14')](_0x90fd('0x3a'),_0x125874[_0x90fd('0x3')]),_0x125874);utils[_0x90fd('0x18')](util['format'](_0x90fd('0x3b'),_0x125874[_0x90fd('0x3')],agents[_0x125874[_0x90fd('0x39')]][_0x90fd('0x6')],agents[_0x125874['transfereruniqueid']]['uniqueid']));agents[_0x125874[_0x90fd('0x39')]]['transfer']=!![];agents[_0x125874['transfereruniqueid']][_0x90fd('0x3c')]=_0x90fd('0x3d');agents[_0x125874[_0x90fd('0x39')]][_0x90fd('0x3e')]=_0x125874[_0x90fd('0x3f')];agents[_0x125874[_0x90fd('0x39')]][_0x90fd('0x40')]=agents[_0x125874['transfereruniqueid']]['uniqueid'];}}catch(_0x1b81dc){utils[_0x90fd('0x1a')](util[_0x90fd('0x14')]('[%s][agents][blindtransfer]',_0x125874[_0x90fd('0x3')]),_0x1b81dc);}};exports[_0x90fd('0x41')]=function(_0x223554){try{utils[_0x90fd('0x1e')](util[_0x90fd('0x14')](_0x90fd('0x42'),_0x223554[_0x90fd('0x43')]),_0x223554);if(_0x223554[_0x90fd('0x43')]==_0x223554['origtransfererlinkedid']){if(!_['isNil'](agents[_0x223554[_0x90fd('0x44')]])){utils[_0x90fd('0x18')](util[_0x90fd('0x14')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x223554[_0x90fd('0x43')],agents[_0x223554[_0x90fd('0x44')]][_0x90fd('0x6')]));agents[_0x223554[_0x90fd('0x44')]][_0x90fd('0x45')]=!![];agents[_0x223554[_0x90fd('0x44')]]['transfertype']=_0x90fd('0x46');agents[_0x223554['secondtransfereruniqueid']][_0x90fd('0x3e')]=_0x223554['origtransfererexten'];agents[_0x223554[_0x90fd('0x44')]][_0x90fd('0x40')]=_0x223554[_0x90fd('0x43')];}if(_0x223554[_0x90fd('0x47')]&&agents[_0x223554['transfereeuniqueid']]){agents[_0x223554[_0x90fd('0x47')]][_0x90fd('0x48')]=0x1;transfers[_0x223554[_0x90fd('0x47')]]=_[_0x90fd('0x49')](agents[_0x223554[_0x90fd('0x47')]]);transfers[_0x223554[_0x90fd('0x47')]]['calleridnum']=agents[_0x223554['secondtransfereruniqueid']]['calleridnum'];transfers[_0x223554['transfereeuniqueid']]['calleridname']=agents[_0x223554[_0x90fd('0x44')]][_0x90fd('0x4a')];transfers[_0x223554[_0x90fd('0x47')]][_0x90fd('0x15')]=utils[_0x90fd('0x16')]();transfers[_0x223554['transfereeuniqueid']]['agentconnectAt']=utils['now']();transfers[_0x223554[_0x90fd('0x47')]][_0x90fd('0x22')]=0x0;transfers[_0x223554['transfereeuniqueid']][_0x90fd('0x48')]=0x2;}}else if(_0x223554[_0x90fd('0x44')]==_0x223554[_0x90fd('0x4b')]){if(!_[_0x90fd('0x1d')](agents[_0x223554[_0x90fd('0x43')]])){utils[_0x90fd('0x18')](util[_0x90fd('0x14')](_0x90fd('0x4c'),_0x223554[_0x90fd('0x43')],agents[_0x223554['origtransfereruniqueid']][_0x90fd('0x6')]));agents[_0x223554[_0x90fd('0x43')]][_0x90fd('0x45')]=!![];agents[_0x223554['origtransfereruniqueid']]['transfertype']=_0x90fd('0x46');agents[_0x223554[_0x90fd('0x43')]]['transferexten']=_0x223554[_0x90fd('0x4d')];agents[_0x223554['origtransfereruniqueid']]['transferuniqueid']=_0x223554[_0x90fd('0x44')];}if(_0x223554[_0x90fd('0x4e')]&&agents[_0x223554[_0x90fd('0x4e')]]){agents[_0x223554[_0x90fd('0x4e')]][_0x90fd('0x48')]=0x1;transfers[_0x223554[_0x90fd('0x4e')]]=_[_0x90fd('0x49')](agents[_0x223554[_0x90fd('0x4e')]]);transfers[_0x223554['transfertargetuniqueid']][_0x90fd('0x4f')]=agents[_0x223554[_0x90fd('0x43')]][_0x90fd('0x4f')];transfers[_0x223554['transfertargetuniqueid']][_0x90fd('0x4a')]=agents[_0x223554[_0x90fd('0x43')]]['calleridname'];transfers[_0x223554['transfertargetuniqueid']][_0x90fd('0x15')]=utils[_0x90fd('0x16')]();transfers[_0x223554[_0x90fd('0x4e')]]['agentconnectAt']=utils[_0x90fd('0x16')]();transfers[_0x223554['transfertargetuniqueid']]['holdtime']=0x0;transfers[_0x223554[_0x90fd('0x4e')]]['agententerreason']=0x2;}}}catch(_0x27a080){utils[_0x90fd('0x1a')](util['format'](_0x90fd('0x42'),_0x223554[_0x90fd('0x43')]),_0x27a080);}};exports[_0x90fd('0x50')]=function(_0x454201){try{utils[_0x90fd('0x1e')](util[_0x90fd('0x14')]('[%s][agents][hangup]',_0x454201['uniqueid']),_0x454201);if(agents[_0x454201['uniqueid']]&&agents[_0x454201['uniqueid']][_0x90fd('0x29')]===_0x90fd('0x21')){if(_0x454201[_0x90fd('0x51')]==='21'){agents[_0x454201['uniqueid']][_0x90fd('0x29')]=_0x90fd('0x52');agents[_0x454201['uniqueid']][_0x90fd('0x8')]=_0x90fd('0x52');}utils[_0x90fd('0x18')](util[_0x90fd('0x14')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x454201[_0x90fd('0x3')],agents[_0x454201[_0x90fd('0x3')]]['membername'],agents[_0x454201['uniqueid']]['reason'],agents[_0x454201[_0x90fd('0x3')]]['lastevent']));writeDB(agents[_0x454201['uniqueid']]);var _0x328bda=unanswered['indexOf'](_0x454201[_0x90fd('0x3')]);if(_0x328bda>-0x1){unanswered[_0x90fd('0x53')](_0x328bda,0x1);}}if(transfers[_0x454201[_0x90fd('0x3')]]){transfers[_0x454201[_0x90fd('0x3')]][_0x90fd('0xc')]=!![];transfers[_0x454201[_0x90fd('0x3')]]['agentcompleteAt']=utils[_0x90fd('0x16')]();transfers[_0x454201[_0x90fd('0x3')]][_0x90fd('0x31')]=utils['diffTime'](transfers[_0x454201['uniqueid']][_0x90fd('0x36')],transfers[_0x454201[_0x90fd('0x3')]][_0x90fd('0x2e')]);transfers[_0x454201[_0x90fd('0x3')]][_0x90fd('0x29')]=_0x90fd('0x54');transfers[_0x454201[_0x90fd('0x3')]][_0x90fd('0x8')]=_0x90fd('0x37');utils[_0x90fd('0x18')](util[_0x90fd('0x14')](_0x90fd('0x55'),_0x454201[_0x90fd('0x3')],transfers[_0x454201[_0x90fd('0x3')]][_0x90fd('0x6')],transfers[_0x454201[_0x90fd('0x3')]][_0x90fd('0x29')],transfers[_0x454201['uniqueid']][_0x90fd('0x8')]));writeDB(transfers[_0x454201[_0x90fd('0x3')]],!![]);}if(agents[_0x454201[_0x90fd('0x3')]]&&agents[_0x454201[_0x90fd('0x3')]][_0x90fd('0x2e')]){agents[_0x454201[_0x90fd('0x3')]][_0x90fd('0xc')]=!![];agents[_0x454201['uniqueid']][_0x90fd('0x36')]=utils[_0x90fd('0x16')]();agents[_0x454201[_0x90fd('0x3')]][_0x90fd('0x31')]=utils['diffTime'](agents[_0x454201[_0x90fd('0x3')]][_0x90fd('0x36')],agents[_0x454201[_0x90fd('0x3')]][_0x90fd('0x2e')]);agents[_0x454201[_0x90fd('0x3')]]['reason']=agents[_0x454201['uniqueid']][_0x90fd('0x45')]?_0x90fd('0x45'):_0x90fd('0x54');agents[_0x454201[_0x90fd('0x3')]][_0x90fd('0x8')]=_0x90fd('0x37');utils['info'](util[_0x90fd('0x14')](_0x90fd('0x55'),_0x454201[_0x90fd('0x3')],agents[_0x454201[_0x90fd('0x3')]][_0x90fd('0x6')],agents[_0x454201[_0x90fd('0x3')]][_0x90fd('0x29')],agents[_0x454201[_0x90fd('0x3')]][_0x90fd('0x8')]));writeDB(agents[_0x454201['uniqueid']]);}}catch(_0x1adcc2){utils[_0x90fd('0x1a')](util[_0x90fd('0x14')](_0x90fd('0x56'),_0x454201[_0x90fd('0x3')]),_0x1adcc2);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 38bab57..20c7663 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 _0x4d4e=['callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','billableseconds','diffTime','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][varset]','xmd-originatecalleridnum','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','variable','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','xmd-contactid','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','application','appdata','toLowerCase','set','cdr','split','includes','hangup','noop','execif','gotoif','lastdata','lodash','./utils','./transfers.controller','FAILED','NO\x20ANSWER','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','calleridnum','connectedlinenum','lastevent','getUserByInternal','accountcode','then','CreateVoiceCallReport','recording','newchannel','debug','[%s][calls][newchannel]','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','newstate','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','now','linkedid','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','error','[%s][calls][hangup]'];(function(_0x3cdf85,_0x448272){var _0x10262a=function(_0x44541f){while(--_0x44541f){_0x3cdf85['push'](_0x3cdf85['shift']());}};_0x10262a(++_0x448272);}(_0x4d4e,0xa4));var _0xe4d4=function(_0x109df9,_0x506331){_0x109df9=_0x109df9-0x0;var _0x47b297=_0x4d4e[_0x109df9];return _0x47b297;};'use strict';var _=require(_0xe4d4('0x0'));var util=require('util');var utils=require(_0xe4d4('0x1'));var transfers=require(_0xe4d4('0x2'));var dispositions=['NO\x20ANSWER',_0xe4d4('0x3'),_0xe4d4('0x3'),_0xe4d4('0x4'),_0xe4d4('0x4'),_0xe4d4('0x4'),'ANSWERED','BUSY',_0xe4d4('0x3'),'FAILED','FAILED'];var channels={};function writeDB(_0x4e9d70){var _0xf010c6;if(transfers[_0xe4d4('0x5')][_0x4e9d70[_0xe4d4('0x6')]]){_0xf010c6=_0x4e9d70[_0xe4d4('0x6')];_0x4e9d70[_0xe4d4('0x6')]=transfers['blinds'][_0x4e9d70['uniqueid']][_0xe4d4('0x7')];}utils[_0xe4d4('0x8')](util[_0xe4d4('0x9')](_0xe4d4('0xa'),_0x4e9d70[_0xe4d4('0x6')],_0x4e9d70[_0xe4d4('0xb')],_0x4e9d70[_0xe4d4('0xc')],_0x4e9d70[_0xe4d4('0xd')],_0x4e9d70['interface'],_0x4e9d70[_0xe4d4('0xe')],_0x4e9d70[_0xe4d4('0xf')],_0x4e9d70[_0xe4d4('0x10')]));if(_0x4e9d70['accountcode']){utils[_0xe4d4('0x11')](_0x4e9d70[_0xe4d4('0x12')])[_0xe4d4('0x13')](function(_0x1adc63){if(_0x1adc63){_0x4e9d70['UserId']=_0x1adc63['id'];}utils['request'](_0xe4d4('0x14'),_0x4e9d70);});}else{utils['request'](_0xe4d4('0x14'),_0x4e9d70);}if(channels[_0x4e9d70[_0xe4d4('0x6')]]){delete channels[_0x4e9d70['uniqueid']];}else if(_0xf010c6&&channels[_0xf010c6]){if(!transfers[_0xe4d4('0x5')][_0xf010c6][_0xe4d4('0x15')])delete transfers[_0xe4d4('0x5')][_0xf010c6];delete channels[_0xf010c6];}}exports[_0xe4d4('0x16')]=function(_0x389b84){try{utils[_0xe4d4('0x17')](util[_0xe4d4('0x9')](_0xe4d4('0x18'),_0x389b84[_0xe4d4('0x6')]),_0x389b84);if(_0x389b84[_0xe4d4('0x6')]==_0x389b84['linkedid']&&_0x389b84[_0xe4d4('0xb')]!=_0xe4d4('0x19')){utils[_0xe4d4('0x8')](util[_0xe4d4('0x9')](_0xe4d4('0x1a'),_0x389b84[_0xe4d4('0x6')],_0x389b84[_0xe4d4('0x1b')],_0x389b84[_0xe4d4('0x1c')]));channels[_0x389b84[_0xe4d4('0x6')]]={'uniqueid':_0x389b84[_0xe4d4('0x6')],'accountcode':_0x389b84[_0xe4d4('0x12')],'source':_0x389b84[_0xe4d4('0xe')],'destination':_0x389b84[_0xe4d4('0x1c')],'destinationcontext':_0x389b84[_0xe4d4('0x1b')],'channel':_0x389b84[_0xe4d4('0xb')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xe4d4('0x4'),'amaflags':'DOCUMENTATION'};}}catch(_0x5a93f8){utils['error'](util[_0xe4d4('0x9')](_0xe4d4('0x18'),_0x389b84['uniqueid']),_0x5a93f8);}};exports[_0xe4d4('0x1d')]=function(_0x5b8905){try{utils[_0xe4d4('0x17')](util['format'](_0xe4d4('0x1e'),_0x5b8905['uniqueid']),_0x5b8905);if(!_[_0xe4d4('0x1f')](channels[_0x5b8905[_0xe4d4('0x6')]])&&_0x5b8905['channelstate']==0x6){utils[_0xe4d4('0x8')](util[_0xe4d4('0x9')](_0xe4d4('0x20'),_0x5b8905['uniqueid'],_0x5b8905[_0xe4d4('0x1b')],_0x5b8905[_0xe4d4('0xb')]));if(_['isNil'](channels[_0x5b8905[_0xe4d4('0x6')]]['systemanswertime'])){channels[_0x5b8905[_0xe4d4('0x6')]]['systemanswertime']=utils[_0xe4d4('0x21')]();}}else if(!_['isNil'](channels[_0x5b8905[_0xe4d4('0x22')]])&&_0x5b8905[_0xe4d4('0x23')]==0x6&&_0x5b8905[_0xe4d4('0x1b')]!=_0xe4d4('0x24')){utils[_0xe4d4('0x8')](util[_0xe4d4('0x9')](_0xe4d4('0x25'),_0x5b8905[_0xe4d4('0x6')],_0x5b8905[_0xe4d4('0x22')],_0x5b8905['context'],_0x5b8905[_0xe4d4('0xb')]));channels[_0x5b8905[_0xe4d4('0x22')]][_0xe4d4('0x12')]=_0x5b8905[_0xe4d4('0x12')];channels[_0x5b8905['linkedid']][_0xe4d4('0x26')]=_0x5b8905[_0xe4d4('0xb')];if(_['isNil'](channels[_0x5b8905[_0xe4d4('0x22')]][_0xe4d4('0x27')])){channels[_0x5b8905[_0xe4d4('0x22')]][_0xe4d4('0x27')]=utils['now']();}channels[_0x5b8905['linkedid']][_0xe4d4('0x28')]=dispositions[_[_0xe4d4('0x29')](_0x5b8905[_0xe4d4('0x23')])]||'ANSWERED';}}catch(_0xee583f){utils[_0xe4d4('0x2a')](util[_0xe4d4('0x9')]('[%s][calls][newstate]',_0x5b8905[_0xe4d4('0x6')]),_0xee583f);}};exports['hangup']=function(_0x168e44){try{if(!_[_0xe4d4('0x1f')](channels[_0x168e44[_0xe4d4('0x6')]])){utils[_0xe4d4('0x17')](util[_0xe4d4('0x9')](_0xe4d4('0x2b'),_0x168e44[_0xe4d4('0x6')]),_0x168e44);if(_[_0xe4d4('0x1f')](channels[_0x168e44[_0xe4d4('0x6')]][_0xe4d4('0x2c')])){channels[_0x168e44[_0xe4d4('0x6')]][_0xe4d4('0x2c')]=_0x168e44[_0xe4d4('0x2d')]+'\x20<'+_0x168e44[_0xe4d4('0xe')]+'>';}utils['info'](util['format'](_0xe4d4('0x2e'),_0x168e44[_0xe4d4('0x6')],channels[_0x168e44['uniqueid']][_0xe4d4('0x2c')],_0x168e44[_0xe4d4('0x2f')]));channels[_0x168e44[_0xe4d4('0x6')]][_0xe4d4('0x30')]=utils['now']();channels[_0x168e44[_0xe4d4('0x6')]]['duration']=utils['diffTime'](channels[_0x168e44[_0xe4d4('0x6')]][_0xe4d4('0x30')],channels[_0x168e44[_0xe4d4('0x6')]]['starttime']);channels[_0x168e44[_0xe4d4('0x6')]][_0xe4d4('0x31')]=channels[_0x168e44[_0xe4d4('0x6')]]['answertime']?utils[_0xe4d4('0x32')](channels[_0x168e44[_0xe4d4('0x6')]][_0xe4d4('0x30')],channels[_0x168e44['uniqueid']][_0xe4d4('0x27')]):0x0;writeDB(channels[_0x168e44[_0xe4d4('0x6')]]);}}catch(_0x733f2e){utils['error'](util[_0xe4d4('0x9')](_0xe4d4('0x2b'),_0x168e44[_0xe4d4('0x6')]),_0x733f2e);}};exports['attendedtransfer']=function(_0xab5bcd){try{if(!_['isNil'](channels[_0xab5bcd[_0xe4d4('0x33')]])){utils[_0xe4d4('0x17')](util[_0xe4d4('0x9')](_0xe4d4('0x34'),_0xab5bcd[_0xe4d4('0x35')]),_0xab5bcd);if(channels[_0xab5bcd[_0xe4d4('0x33')]][_0xe4d4('0xb')]==_0xab5bcd[_0xe4d4('0x36')]){utils[_0xe4d4('0x8')](util[_0xe4d4('0x9')](_0xe4d4('0x37'),_0xab5bcd[_0xe4d4('0x35')],_0xab5bcd[_0xe4d4('0x33')],_0xab5bcd[_0xe4d4('0x38')]));channels[_0xab5bcd['localtwolinkedid']][_0xe4d4('0x26')]=_0xab5bcd[_0xe4d4('0x38')];channels[_0xab5bcd['localtwolinkedid']][_0xe4d4('0x39')]=_0xe4d4('0x3a');}else if(channels[_0xab5bcd[_0xe4d4('0x33')]][_0xe4d4('0xb')]=_0xab5bcd[_0xe4d4('0x3b')]){utils[_0xe4d4('0x8')](util[_0xe4d4('0x9')](_0xe4d4('0x37'),_0xab5bcd[_0xe4d4('0x35')],_0xab5bcd[_0xe4d4('0x33')],_0xab5bcd[_0xe4d4('0x3c')]));channels[_0xab5bcd[_0xe4d4('0x33')]][_0xe4d4('0x26')]=_0xab5bcd[_0xe4d4('0x3c')];channels[_0xab5bcd[_0xe4d4('0x33')]][_0xe4d4('0x39')]='_attended';}}}catch(_0x307308){utils[_0xe4d4('0x2a')](util[_0xe4d4('0x9')](_0xe4d4('0x34'),_0xab5bcd[_0xe4d4('0x35')]),_0x307308);}};exports[_0xe4d4('0x3d')]=function(_0x4e0571){try{if(!_[_0xe4d4('0x1f')](channels[_0x4e0571[_0xe4d4('0x6')]])){utils[_0xe4d4('0x17')](util[_0xe4d4('0x9')](_0xe4d4('0x3e'),_0x4e0571[_0xe4d4('0x6')]),_0x4e0571);channels[_0x4e0571[_0xe4d4('0x6')]][_0xe4d4('0x3f')]=utils['now']();utils['info'](util[_0xe4d4('0x9')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x4e0571[_0xe4d4('0x6')],channels[_0x4e0571[_0xe4d4('0x6')]][_0xe4d4('0x3f')]));}}catch(_0x2ac6b8){utils[_0xe4d4('0x2a')](util[_0xe4d4('0x9')](_0xe4d4('0x3e'),_0x4e0571[_0xe4d4('0x6')]),_0x2ac6b8);}};exports[_0xe4d4('0x40')]=function(_0x159399){try{if(!_[_0xe4d4('0x1f')](channels[_0x159399[_0xe4d4('0x6')]])){utils[_0xe4d4('0x17')](util['format'](_0xe4d4('0x41'),_0x159399[_0xe4d4('0x6')]),_0x159399);if(!_['isNil'](channels[_0x159399[_0xe4d4('0x6')]][_0xe4d4('0x3f')])){channels[_0x159399[_0xe4d4('0x6')]][_0xe4d4('0x42')]+=utils[_0xe4d4('0x32')](utils['now'](),channels[_0x159399[_0xe4d4('0x6')]][_0xe4d4('0x3f')]);utils['info'](util['format'](_0xe4d4('0x43'),_0x159399[_0xe4d4('0x6')],channels[_0x159399[_0xe4d4('0x6')]][_0xe4d4('0x42')]));delete channels[_0x159399['uniqueid']][_0xe4d4('0x3f')];}}}catch(_0x5624a5){utils[_0xe4d4('0x2a')](util[_0xe4d4('0x9')](_0xe4d4('0x41'),_0x159399[_0xe4d4('0x6')]),_0x5624a5);}};exports['varset']=function(_0x1c11ad){try{if(!_[_0xe4d4('0x1f')](channels[_0x1c11ad[_0xe4d4('0x6')]])){utils[_0xe4d4('0x17')](util[_0xe4d4('0x9')](_0xe4d4('0x44'),_0x1c11ad[_0xe4d4('0x6')]),_0x1c11ad);if(!_[_0xe4d4('0x1f')](_0x1c11ad['variable'][_0xe4d4('0x45')])){utils[_0xe4d4('0x8')](util[_0xe4d4('0x9')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x1c11ad[_0xe4d4('0x6')],_0x1c11ad[_0xe4d4('0x46')]));channels[_0x1c11ad[_0xe4d4('0x6')]][_0xe4d4('0x47')]=_0x1c11ad['value'];}if(!_[_0xe4d4('0x1f')](_0x1c11ad['variable'][_0xe4d4('0x48')])){utils[_0xe4d4('0x8')](util[_0xe4d4('0x9')](_0xe4d4('0x49'),_0x1c11ad[_0xe4d4('0x6')],_0x1c11ad[_0xe4d4('0x46')]));channels[_0x1c11ad[_0xe4d4('0x6')]][_0xe4d4('0x4a')]=_0x1c11ad[_0xe4d4('0x46')];channels[_0x1c11ad[_0xe4d4('0x6')]]['callerid']='\x22'+_0x1c11ad[_0xe4d4('0x46')]+'\x22\x20<'+_0x1c11ad[_0xe4d4('0x46')]+'>';}if(!_[_0xe4d4('0x1f')](_0x1c11ad[_0xe4d4('0x4b')][_0xe4d4('0x4c')])||!_['isNil'](_0x1c11ad[_0xe4d4('0x4b')]['xmd-callerid'])){utils['info'](util[_0xe4d4('0x9')](_0xe4d4('0x4d'),_0x1c11ad['uniqueid'],!_[_0xe4d4('0x1f')](_0x1c11ad[_0xe4d4('0x4b')][_0xe4d4('0x4c')])?_0xe4d4('0x4c'):'xmd-callerid',_0x1c11ad[_0xe4d4('0x46')]));channels[_0x1c11ad[_0xe4d4('0x6')]][_0xe4d4('0x2c')]=_0x1c11ad[_0xe4d4('0x46')];}if(!_[_0xe4d4('0x1f')](_0x1c11ad['variable'][_0xe4d4('0x4e')])||!_['isNil'](_0x1c11ad['variable'][_0xe4d4('0x4f')])){utils[_0xe4d4('0x8')](util[_0xe4d4('0x9')](_0xe4d4('0x4d'),_0x1c11ad['uniqueid'],!_[_0xe4d4('0x1f')](_0x1c11ad[_0xe4d4('0x4b')][_0xe4d4('0x4e')])?_0xe4d4('0x4e'):_0xe4d4('0x4f'),_0x1c11ad[_0xe4d4('0x46')]));channels[_0x1c11ad[_0xe4d4('0x6')]][_0xe4d4('0x50')]='Queue';channels[_0x1c11ad[_0xe4d4('0x6')]]['lastdata']=_0x1c11ad[_0xe4d4('0x46')];channels[_0x1c11ad['uniqueid']][_0xe4d4('0xc')]=!![];}if(!_['isNil'](_0x1c11ad['variable'][_0xe4d4('0x51')])){utils['info'](util[_0xe4d4('0x9')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x1c11ad[_0xe4d4('0x6')],_0x1c11ad[_0xe4d4('0x46')]));channels[_0x1c11ad[_0xe4d4('0x6')]]['ContactId']=_0x1c11ad['value'];}if(!_[_0xe4d4('0x1f')](_0x1c11ad['variable'][_0xe4d4('0x52')])){utils['info'](util[_0xe4d4('0x9')](_0xe4d4('0x53'),_0x1c11ad[_0xe4d4('0x6')],_0x1c11ad[_0xe4d4('0x46')]));channels[_0x1c11ad[_0xe4d4('0x6')]][_0xe4d4('0x54')]=_0x1c11ad[_0xe4d4('0x46')];}if(!_[_0xe4d4('0x1f')](_0x1c11ad[_0xe4d4('0x4b')][_0xe4d4('0x55')])){utils[_0xe4d4('0x8')](util['format'](_0xe4d4('0x56'),_0x1c11ad[_0xe4d4('0x6')],_0x1c11ad['value']));channels[_0x1c11ad[_0xe4d4('0x6')]][_0xe4d4('0x57')]=_0x1c11ad['value'];}if(!_[_0xe4d4('0x1f')](_0x1c11ad[_0xe4d4('0x4b')][_0xe4d4('0x58')])){utils[_0xe4d4('0x8')](util['format'](_0xe4d4('0x59'),_0x1c11ad[_0xe4d4('0x6')],_0x1c11ad[_0xe4d4('0x46')]));channels[_0x1c11ad['uniqueid']][_0xe4d4('0x58')]=_0x1c11ad[_0xe4d4('0x46')];}}}catch(_0x8dcd12){utils[_0xe4d4('0x2a')](util['format']('[%s][calls][varset]',_0x1c11ad[_0xe4d4('0x6')]),_0x8dcd12);}};exports[_0xe4d4('0x5a')]=function(_0x1caa1e){try{if(!_[_0xe4d4('0x1f')](channels[_0x1caa1e[_0xe4d4('0x6')]])){utils['debug'](util[_0xe4d4('0x9')](_0xe4d4('0x5b'),_0x1caa1e[_0xe4d4('0x6')]),_0x1caa1e);utils['info'](util[_0xe4d4('0x9')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x1caa1e[_0xe4d4('0x6')],_0x1caa1e[_0xe4d4('0x5c')],_0x1caa1e[_0xe4d4('0x5d')]));if(_0x1caa1e[_0xe4d4('0x5c')][_0xe4d4('0x5e')]()==_0xe4d4('0x5f')&&_['startsWith'](_0x1caa1e[_0xe4d4('0x5d')][_0xe4d4('0x5e')](),_0xe4d4('0x60'))){var _0x5015f7=_0x1caa1e[_0xe4d4('0x5d')][_0xe4d4('0x61')]('=');var _0x580c0d=_0x5015f7[0x0]['substring'](_0x5015f7[0x0]['lastIndexOf']('(')+0x1,_0x5015f7[0x0]['lastIndexOf'](')'));var _0x30aab5=_0x5015f7[0x1];channels[_0x1caa1e[_0xe4d4('0x6')]][_0x580c0d]=_0x30aab5;}if(!_[_0xe4d4('0x62')]([_0xe4d4('0x63'),_0xe4d4('0x64'),_0xe4d4('0x65'),_0xe4d4('0x5f'),_0xe4d4('0x66')],_0x1caa1e['application'][_0xe4d4('0x5e')]())){channels[_0x1caa1e[_0xe4d4('0x6')]][_0xe4d4('0x50')]=_0x1caa1e[_0xe4d4('0x5c')];channels[_0x1caa1e[_0xe4d4('0x6')]][_0xe4d4('0x67')]=_0x1caa1e[_0xe4d4('0x5d')];}}}catch(_0x5598dc){utils['error'](util[_0xe4d4('0x9')](_0xe4d4('0x5b'),_0x1caa1e[_0xe4d4('0x6')]),_0x5598dc);}}; \ No newline at end of file +var _0x8458=['interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','newchannel','debug','format','[%s][calls][newchannel]','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','linkedid','answertime','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%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','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','variable','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','newexten','[%s][calls][newexten]','application','toLowerCase','set','appdata','cdr','lastIndexOf','includes','noop','execif','gotoif','lastdata','lodash','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername'];(function(_0x3dc7cd,_0x267795){var _0x59c631=function(_0x51fe79){while(--_0x51fe79){_0x3dc7cd['push'](_0x3dc7cd['shift']());}};_0x59c631(++_0x267795);}(_0x8458,0x1a5));var _0x8845=function(_0x3ecd46,_0x14b4de){_0x3ecd46=_0x3ecd46-0x0;var _0x287b0f=_0x8458[_0x3ecd46];return _0x287b0f;};'use strict';var _=require(_0x8845('0x0'));var util=require('util');var utils=require(_0x8845('0x1'));var transfers=require(_0x8845('0x2'));var dispositions=[_0x8845('0x3'),_0x8845('0x4'),_0x8845('0x4'),'NO\x20ANSWER',_0x8845('0x3'),_0x8845('0x3'),_0x8845('0x5'),_0x8845('0x6'),_0x8845('0x4'),'FAILED',_0x8845('0x4')];var channels={};function writeDB(_0x59d900){var _0x2a91b4;if(transfers[_0x8845('0x7')][_0x59d900[_0x8845('0x8')]]){_0x2a91b4=_0x59d900['uniqueid'];_0x59d900[_0x8845('0x8')]=transfers[_0x8845('0x7')][_0x59d900['uniqueid']][_0x8845('0x9')];}utils[_0x8845('0xa')](util['format'](_0x8845('0xb'),_0x59d900[_0x8845('0x8')],_0x59d900[_0x8845('0xc')],_0x59d900[_0x8845('0xd')],_0x59d900[_0x8845('0xe')],_0x59d900[_0x8845('0xf')],_0x59d900[_0x8845('0x10')],_0x59d900[_0x8845('0x11')],_0x59d900[_0x8845('0x12')]));if(_0x59d900[_0x8845('0x13')]){utils[_0x8845('0x14')](_0x59d900[_0x8845('0x13')])[_0x8845('0x15')](function(_0x2b9b36){if(_0x2b9b36){_0x59d900['UserId']=_0x2b9b36['id'];}utils[_0x8845('0x16')](_0x8845('0x17'),_0x59d900);});}else{utils['request'](_0x8845('0x17'),_0x59d900);}if(channels[_0x59d900[_0x8845('0x8')]]){delete channels[_0x59d900[_0x8845('0x8')]];}else if(_0x2a91b4&&channels[_0x2a91b4]){if(!transfers['blinds'][_0x2a91b4]['recording'])delete transfers['blinds'][_0x2a91b4];delete channels[_0x2a91b4];}}exports[_0x8845('0x18')]=function(_0x1164e8){try{utils[_0x8845('0x19')](util[_0x8845('0x1a')](_0x8845('0x1b'),_0x1164e8[_0x8845('0x8')]),_0x1164e8);if(_0x1164e8[_0x8845('0x8')]==_0x1164e8['linkedid']&&_0x1164e8['channel']!='OutgoingSpoolFailed'){utils[_0x8845('0xa')](util[_0x8845('0x1a')](_0x8845('0x1c'),_0x1164e8[_0x8845('0x8')],_0x1164e8['context'],_0x1164e8[_0x8845('0x1d')]));channels[_0x1164e8['uniqueid']]={'uniqueid':_0x1164e8['uniqueid'],'accountcode':_0x1164e8[_0x8845('0x13')],'source':_0x1164e8[_0x8845('0x10')],'destination':_0x1164e8['exten'],'destinationcontext':_0x1164e8[_0x8845('0x1e')],'channel':_0x1164e8[_0x8845('0xc')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x8845('0x3'),'amaflags':_0x8845('0x1f')};}}catch(_0x2b7ad7){utils[_0x8845('0x20')](util['format']('[%s][calls][newchannel]',_0x1164e8[_0x8845('0x8')]),_0x2b7ad7);}};exports[_0x8845('0x21')]=function(_0x3b4f41){try{utils[_0x8845('0x19')](util[_0x8845('0x1a')](_0x8845('0x22'),_0x3b4f41[_0x8845('0x8')]),_0x3b4f41);if(!_[_0x8845('0x23')](channels[_0x3b4f41[_0x8845('0x8')]])&&_0x3b4f41[_0x8845('0x24')]==0x6){utils[_0x8845('0xa')](util[_0x8845('0x1a')](_0x8845('0x25'),_0x3b4f41[_0x8845('0x8')],_0x3b4f41[_0x8845('0x1e')],_0x3b4f41[_0x8845('0xc')]));if(_[_0x8845('0x23')](channels[_0x3b4f41['uniqueid']]['systemanswertime'])){channels[_0x3b4f41[_0x8845('0x8')]][_0x8845('0x26')]=utils[_0x8845('0x27')]();}}else if(!_[_0x8845('0x23')](channels[_0x3b4f41[_0x8845('0x28')]])&&_0x3b4f41[_0x8845('0x24')]==0x6&&_0x3b4f41[_0x8845('0x1e')]!='transfer'){utils[_0x8845('0xa')](util[_0x8845('0x1a')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x3b4f41[_0x8845('0x8')],_0x3b4f41[_0x8845('0x28')],_0x3b4f41[_0x8845('0x1e')],_0x3b4f41[_0x8845('0xc')]));channels[_0x3b4f41[_0x8845('0x28')]][_0x8845('0x13')]=_0x3b4f41[_0x8845('0x13')];channels[_0x3b4f41[_0x8845('0x28')]]['destinationchannel']=_0x3b4f41['channel'];if(_[_0x8845('0x23')](channels[_0x3b4f41[_0x8845('0x28')]]['answertime'])){channels[_0x3b4f41[_0x8845('0x28')]][_0x8845('0x29')]=utils[_0x8845('0x27')]();}channels[_0x3b4f41['linkedid']]['disposition']=dispositions[_[_0x8845('0x2a')](_0x3b4f41['channelstate'])]||_0x8845('0x5');}}catch(_0x21e581){utils[_0x8845('0x20')](util['format'](_0x8845('0x22'),_0x3b4f41[_0x8845('0x8')]),_0x21e581);}};exports[_0x8845('0x2b')]=function(_0x4d898a){try{if(!_[_0x8845('0x23')](channels[_0x4d898a['uniqueid']])){utils[_0x8845('0x19')](util[_0x8845('0x1a')](_0x8845('0x2c'),_0x4d898a[_0x8845('0x8')]),_0x4d898a);if(_[_0x8845('0x23')](channels[_0x4d898a[_0x8845('0x8')]][_0x8845('0x2d')])){channels[_0x4d898a[_0x8845('0x8')]]['callerid']=_0x4d898a[_0x8845('0x2e')]+'\x20<'+_0x4d898a['calleridnum']+'>';}utils[_0x8845('0xa')](util['format'](_0x8845('0x2f'),_0x4d898a[_0x8845('0x8')],channels[_0x4d898a['uniqueid']][_0x8845('0x2d')],_0x4d898a['cause-txt']));channels[_0x4d898a[_0x8845('0x8')]][_0x8845('0x30')]=utils[_0x8845('0x27')]();channels[_0x4d898a[_0x8845('0x8')]][_0x8845('0x31')]=utils[_0x8845('0x32')](channels[_0x4d898a[_0x8845('0x8')]][_0x8845('0x30')],channels[_0x4d898a[_0x8845('0x8')]][_0x8845('0x33')]);channels[_0x4d898a['uniqueid']][_0x8845('0x34')]=channels[_0x4d898a['uniqueid']][_0x8845('0x29')]?utils[_0x8845('0x32')](channels[_0x4d898a['uniqueid']][_0x8845('0x30')],channels[_0x4d898a[_0x8845('0x8')]][_0x8845('0x29')]):0x0;writeDB(channels[_0x4d898a['uniqueid']]);}}catch(_0x3c86e0){utils['error'](util['format'](_0x8845('0x2c'),_0x4d898a[_0x8845('0x8')]),_0x3c86e0);}};exports[_0x8845('0x35')]=function(_0x18cfa4){try{if(!_[_0x8845('0x23')](channels[_0x18cfa4[_0x8845('0x36')]])){utils['debug'](util['format'](_0x8845('0x37'),_0x18cfa4[_0x8845('0x38')]),_0x18cfa4);if(channels[_0x18cfa4[_0x8845('0x36')]][_0x8845('0xc')]==_0x18cfa4[_0x8845('0x39')]){utils[_0x8845('0xa')](util[_0x8845('0x1a')](_0x8845('0x3a'),_0x18cfa4['origtransfereruniqueid'],_0x18cfa4[_0x8845('0x36')],_0x18cfa4[_0x8845('0x3b')]));channels[_0x18cfa4[_0x8845('0x36')]]['destinationchannel']=_0x18cfa4[_0x8845('0x3b')];channels[_0x18cfa4[_0x8845('0x36')]][_0x8845('0x3c')]=_0x8845('0x3d');}else if(channels[_0x18cfa4[_0x8845('0x36')]][_0x8845('0xc')]=_0x18cfa4['transfertargetchannel']){utils['info'](util[_0x8845('0x1a')](_0x8845('0x3a'),_0x18cfa4['origtransfereruniqueid'],_0x18cfa4[_0x8845('0x36')],_0x18cfa4[_0x8845('0x3e')]));channels[_0x18cfa4[_0x8845('0x36')]]['destinationchannel']=_0x18cfa4[_0x8845('0x3e')];channels[_0x18cfa4['localtwolinkedid']]['userfield']=_0x8845('0x3d');}}}catch(_0x393edd){utils[_0x8845('0x20')](util[_0x8845('0x1a')](_0x8845('0x37'),_0x18cfa4[_0x8845('0x38')]),_0x393edd);}};exports['musiconholdstart']=function(_0x16c9ce){try{if(!_['isNil'](channels[_0x16c9ce[_0x8845('0x8')]])){utils[_0x8845('0x19')](util[_0x8845('0x1a')](_0x8845('0x3f'),_0x16c9ce['uniqueid']),_0x16c9ce);channels[_0x16c9ce[_0x8845('0x8')]][_0x8845('0x40')]=utils[_0x8845('0x27')]();utils[_0x8845('0xa')](util[_0x8845('0x1a')](_0x8845('0x41'),_0x16c9ce[_0x8845('0x8')],channels[_0x16c9ce['uniqueid']][_0x8845('0x40')]));}}catch(_0x25485d){utils[_0x8845('0x20')](util[_0x8845('0x1a')](_0x8845('0x3f'),_0x16c9ce['uniqueid']),_0x25485d);}};exports[_0x8845('0x42')]=function(_0x2ff993){try{if(!_[_0x8845('0x23')](channels[_0x2ff993['uniqueid']])){utils[_0x8845('0x19')](util[_0x8845('0x1a')](_0x8845('0x43'),_0x2ff993[_0x8845('0x8')]),_0x2ff993);if(!_[_0x8845('0x23')](channels[_0x2ff993[_0x8845('0x8')]]['musiconholdstartAt'])){channels[_0x2ff993['uniqueid']][_0x8845('0x44')]+=utils[_0x8845('0x32')](utils['now'](),channels[_0x2ff993[_0x8845('0x8')]][_0x8845('0x40')]);utils[_0x8845('0xa')](util['format'](_0x8845('0x45'),_0x2ff993[_0x8845('0x8')],channels[_0x2ff993[_0x8845('0x8')]]['mohtime']));delete channels[_0x2ff993['uniqueid']][_0x8845('0x40')];}}}catch(_0x39f94b){utils[_0x8845('0x20')](util[_0x8845('0x1a')]('[%s][calls][musiconholdstop]',_0x2ff993['uniqueid']),_0x39f94b);}};exports[_0x8845('0x46')]=function(_0x208fce){try{if(!_[_0x8845('0x23')](channels[_0x208fce[_0x8845('0x8')]])){utils[_0x8845('0x19')](util[_0x8845('0x1a')](_0x8845('0x47'),_0x208fce['uniqueid']),_0x208fce);if(!_[_0x8845('0x23')](_0x208fce['variable'][_0x8845('0x48')])){utils['info'](util[_0x8845('0x1a')](_0x8845('0x49'),_0x208fce[_0x8845('0x8')],_0x208fce[_0x8845('0x4a')]));channels[_0x208fce[_0x8845('0x8')]][_0x8845('0x4b')]=_0x208fce[_0x8845('0x4a')];}if(!_[_0x8845('0x23')](_0x208fce['variable'][_0x8845('0x4c')])){utils[_0x8845('0xa')](util[_0x8845('0x1a')](_0x8845('0x4d'),_0x208fce['uniqueid'],_0x208fce[_0x8845('0x4a')]));channels[_0x208fce['uniqueid']][_0x8845('0x4e')]=_0x208fce[_0x8845('0x4a')];channels[_0x208fce[_0x8845('0x8')]]['callerid']='\x22'+_0x208fce[_0x8845('0x4a')]+_0x8845('0x4f')+_0x208fce[_0x8845('0x4a')]+'>';}if(!_[_0x8845('0x23')](_0x208fce[_0x8845('0x50')][_0x8845('0x51')])||!_['isNil'](_0x208fce[_0x8845('0x50')]['xmd-callerid'])){utils[_0x8845('0xa')](util['format'](_0x8845('0x52'),_0x208fce[_0x8845('0x8')],!_[_0x8845('0x23')](_0x208fce[_0x8845('0x50')][_0x8845('0x51')])?_0x8845('0x51'):'xmd-callerid',_0x208fce[_0x8845('0x4a')]));channels[_0x208fce[_0x8845('0x8')]][_0x8845('0x2d')]=_0x208fce[_0x8845('0x4a')];}if(!_['isNil'](_0x208fce[_0x8845('0x50')][_0x8845('0x53')])||!_[_0x8845('0x23')](_0x208fce[_0x8845('0x50')][_0x8845('0x54')])){utils[_0x8845('0xa')](util[_0x8845('0x1a')](_0x8845('0x52'),_0x208fce[_0x8845('0x8')],!_[_0x8845('0x23')](_0x208fce[_0x8845('0x50')]['xmd-queue'])?_0x8845('0x53'):_0x8845('0x54'),_0x208fce['value']));channels[_0x208fce[_0x8845('0x8')]][_0x8845('0x55')]=_0x8845('0x56');channels[_0x208fce[_0x8845('0x8')]]['lastdata']=_0x208fce[_0x8845('0x4a')];channels[_0x208fce[_0x8845('0x8')]][_0x8845('0xd')]=!![];}if(!_[_0x8845('0x23')](_0x208fce[_0x8845('0x50')][_0x8845('0x57')])){utils['info'](util[_0x8845('0x1a')](_0x8845('0x58'),_0x208fce[_0x8845('0x8')],_0x208fce[_0x8845('0x4a')]));channels[_0x208fce[_0x8845('0x8')]][_0x8845('0x59')]=_0x208fce['value'];}if(!_['isNil'](_0x208fce['variable'][_0x8845('0x5a')])){utils[_0x8845('0xa')](util[_0x8845('0x1a')](_0x8845('0x5b'),_0x208fce['uniqueid'],_0x208fce[_0x8845('0x4a')]));channels[_0x208fce[_0x8845('0x8')]][_0x8845('0x5c')]=_0x208fce[_0x8845('0x4a')];}if(!_[_0x8845('0x23')](_0x208fce['variable']['outboundrouteid'])){utils[_0x8845('0xa')](util[_0x8845('0x1a')](_0x8845('0x5d'),_0x208fce['uniqueid'],_0x208fce[_0x8845('0x4a')]));channels[_0x208fce[_0x8845('0x8')]][_0x8845('0x5e')]=_0x208fce[_0x8845('0x4a')];}if(!_['isNil'](_0x208fce[_0x8845('0x50')][_0x8845('0x5f')])){utils['info'](util[_0x8845('0x1a')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x208fce[_0x8845('0x8')],_0x208fce[_0x8845('0x4a')]));channels[_0x208fce['uniqueid']][_0x8845('0x5f')]=_0x208fce['value'];}}}catch(_0x13159b){utils[_0x8845('0x20')](util['format'](_0x8845('0x47'),_0x208fce['uniqueid']),_0x13159b);}};exports[_0x8845('0x60')]=function(_0x399635){try{if(!_[_0x8845('0x23')](channels[_0x399635[_0x8845('0x8')]])){utils[_0x8845('0x19')](util['format'](_0x8845('0x61'),_0x399635['uniqueid']),_0x399635);utils[_0x8845('0xa')](util[_0x8845('0x1a')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x399635[_0x8845('0x8')],_0x399635[_0x8845('0x62')],_0x399635['appdata']));if(_0x399635[_0x8845('0x62')][_0x8845('0x63')]()==_0x8845('0x64')&&_['startsWith'](_0x399635[_0x8845('0x65')][_0x8845('0x63')](),_0x8845('0x66'))){var _0x51488b=_0x399635['appdata']['split']('=');var _0x107ce1=_0x51488b[0x0]['substring'](_0x51488b[0x0][_0x8845('0x67')]('(')+0x1,_0x51488b[0x0][_0x8845('0x67')](')'));var _0xb6aac2=_0x51488b[0x1];channels[_0x399635[_0x8845('0x8')]][_0x107ce1]=_0xb6aac2;}if(!_[_0x8845('0x68')]([_0x8845('0x2b'),_0x8845('0x69'),_0x8845('0x6a'),_0x8845('0x64'),_0x8845('0x6b')],_0x399635[_0x8845('0x62')][_0x8845('0x63')]())){channels[_0x399635[_0x8845('0x8')]]['lastapplication']=_0x399635[_0x8845('0x62')];channels[_0x399635[_0x8845('0x8')]][_0x8845('0x6c')]=_0x399635[_0x8845('0x65')];}}}catch(_0x4aa591){utils['error'](util[_0x8845('0x1a')](_0x8845('0x61'),_0x399635[_0x8845('0x8')]),_0x4aa591);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 364cff6..406b9b7 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 _0xa644=['[core]\x20shutdown','fullybooted','error','[core]\x20error','close','[core]\x20close','./utils','connect','info','[core]\x20connected','shutdown'];(function(_0x5c9b38,_0xc2867){var _0x59516b=function(_0x5457ec){while(--_0x5457ec){_0x5c9b38['push'](_0x5c9b38['shift']());}};_0x59516b(++_0xc2867);}(_0xa644,0x15b));var _0x4a64=function(_0x24def2,_0x36557c){_0x24def2=_0x24def2-0x0;var _0x1ab2d8=_0xa644[_0x24def2];return _0x1ab2d8;};'use strict';var utils=require(_0x4a64('0x0'));exports[_0x4a64('0x1')]=function(){utils[_0x4a64('0x2')](_0x4a64('0x3'));};exports[_0x4a64('0x4')]=function(){utils['info'](_0x4a64('0x5'));};exports[_0x4a64('0x6')]=function(){utils[_0x4a64('0x2')]('[core]\x20fullybooted');};exports[_0x4a64('0x7')]=function(_0x75be77){utils['error'](_0x4a64('0x8'),_0x75be77);};exports[_0x4a64('0x9')]=function(){utils[_0x4a64('0x2')](_0x4a64('0xa'));};exports['managerevent']=function(_0x5a9571){}; \ No newline at end of file +var _0xf95c=['shutdown','info','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','[core]\x20connected'];(function(_0x2af89c,_0x1dadeb){var _0x4b5333=function(_0xb0c69f){while(--_0xb0c69f){_0x2af89c['push'](_0x2af89c['shift']());}};_0x4b5333(++_0x1dadeb);}(_0xf95c,0x1e9));var _0xcf95=function(_0x44f2aa,_0x2e6170){_0x44f2aa=_0x44f2aa-0x0;var _0x27903d=_0xf95c[_0x44f2aa];return _0x27903d;};'use strict';var utils=require(_0xcf95('0x0'));exports[_0xcf95('0x1')]=function(){utils['info'](_0xcf95('0x2'));};exports[_0xcf95('0x3')]=function(){utils[_0xcf95('0x4')](_0xcf95('0x5'));};exports[_0xcf95('0x6')]=function(){utils[_0xcf95('0x4')](_0xcf95('0x7'));};exports['error']=function(_0x3cec19){utils['error'](_0xcf95('0x8'),_0x3cec19);};exports[_0xcf95('0x9')]=function(){utils['info'](_0xcf95('0xa'));};exports[_0xcf95('0xb')]=function(_0x34739a){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index fdb42e4..b146b25 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 _0x9486=['diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','toLowerCase','cdr(routeid)','split','error','[%s][dials][newexten]','varset','debug','[%s][dials][varset]','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','complete','duration'];(function(_0x508c0a,_0x1bcd5e){var _0x1c19b7=function(_0x21300d){while(--_0x21300d){_0x508c0a['push'](_0x508c0a['shift']());}};_0x1c19b7(++_0x1bcd5e);}(_0x9486,0xd8));var _0x6948=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9486[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x6948('0x0'));var util=require(_0x6948('0x1'));var utils=require(_0x6948('0x2'));var dials={};function writeDB(_0x3d69e6){utils['info'](util[_0x6948('0x3')](_0x6948('0x4'),_0x3d69e6['uniqueid'],_0x3d69e6[_0x6948('0x5')],_0x3d69e6[_0x6948('0x6')],_0x3d69e6['calleridnum'],_0x3d69e6[_0x6948('0x7')],_0x3d69e6[_0x6948('0x8')]));utils[_0x6948('0x9')](_0x6948('0xa'),_0x3d69e6);delete dials[_0x3d69e6[_0x6948('0xb')]];}exports[_0x6948('0xc')]=function(_0x5340d5){try{utils['debug'](util[_0x6948('0x3')]('[%s][dials][newexten]',_0x5340d5['uniqueid']),_0x5340d5);utils[_0x6948('0xd')](util['format'](_0x6948('0xe'),_0x5340d5[_0x6948('0xb')],_0x5340d5[_0x6948('0xf')],_0x5340d5[_0x6948('0x10')]));if(_0x5340d5[_0x6948('0xf')]['toLowerCase']()==_0x6948('0x11')&&_['startsWith'](_0x5340d5['appdata'][_0x6948('0x12')](),_0x6948('0x13'))){var _0x590f73=_0x5340d5[_0x6948('0x10')][_0x6948('0x14')]('=');dials[_0x5340d5['uniqueid']]={'routeId':_0x590f73[0x1]};}}catch(_0xab9e28){utils[_0x6948('0x15')](util['format'](_0x6948('0x16'),_0x5340d5[_0x6948('0xb')]),_0xab9e28);}};exports[_0x6948('0x17')]=function(_0x2d7f02){try{utils[_0x6948('0x18')](util[_0x6948('0x3')](_0x6948('0x19'),_0x2d7f02['uniqueid']),_0x2d7f02);if(!_['isNil'](_0x2d7f02['variable'][_0x6948('0x1a')])){utils[_0x6948('0xd')](util[_0x6948('0x3')](_0x6948('0x1b'),_0x2d7f02[_0x6948('0xb')],_0x2d7f02[_0x6948('0x1c')]));dials[_0x2d7f02[_0x6948('0xb')]]={'routeId':_0x2d7f02[_0x6948('0x1c')]};}}catch(_0x4f873b){utils['error'](util[_0x6948('0x3')]('[%s][dials][varset]',_0x2d7f02[_0x6948('0xb')]),_0x4f873b);}};exports[_0x6948('0x1d')]=function(_0x61169f){try{if(!_['isNil'](dials[_0x61169f[_0x6948('0xb')]])){utils[_0x6948('0x18')](util[_0x6948('0x3')](_0x6948('0x1e'),_0x61169f[_0x6948('0xb')]),_0x61169f);dials[_0x61169f[_0x6948('0xb')]]=_[_0x6948('0x1f')](dials[_0x61169f[_0x6948('0xb')]],_0x61169f);dials[_0x61169f['uniqueid']][_0x6948('0x20')]=utils[_0x6948('0x21')]();dials[_0x61169f[_0x6948('0xb')]]['lastevent']=_0x6948('0x22');utils[_0x6948('0xd')](util['format'](_0x6948('0x23'),_0x61169f[_0x6948('0xb')],dials[_0x61169f[_0x6948('0xb')]][_0x6948('0x20')]));}}catch(_0x35ad9a){utils[_0x6948('0x15')](util[_0x6948('0x3')](_0x6948('0x1e'),_0x61169f[_0x6948('0xb')]),_0x35ad9a);}};exports[_0x6948('0x24')]=function(_0x788d5){try{if(!_['isNil'](dials[_0x788d5['uniqueid']])){utils[_0x6948('0x18')](util['format'](_0x6948('0x25'),_0x788d5[_0x6948('0xb')]),_0x788d5);dials[_0x788d5[_0x6948('0xb')]][_0x6948('0x8')]=_0x788d5['dialstatus'];if(_0x788d5[_0x6948('0x8')]==_0x6948('0x26')){dials[_0x788d5['uniqueid']]=_[_0x6948('0x1f')](dials[_0x788d5[_0x6948('0xb')]],_0x788d5);dials[_0x788d5[_0x6948('0xb')]][_0x6948('0x27')]=utils['now']();dials[_0x788d5[_0x6948('0xb')]]['lastevent']=_0x6948('0x28');utils[_0x6948('0xd')](util[_0x6948('0x3')](_0x6948('0x29'),_0x788d5[_0x6948('0xb')],_0x788d5[_0x6948('0x8')],dials[_0x788d5[_0x6948('0xb')]]['answertime']));}else{utils[_0x6948('0xd')](util[_0x6948('0x3')](_0x6948('0x2a'),_0x788d5[_0x6948('0xb')],_0x788d5[_0x6948('0x8')]));}}}catch(_0x27d59d){utils[_0x6948('0x15')](util[_0x6948('0x3')](_0x6948('0x25'),_0x788d5[_0x6948('0xb')]),_0x27d59d);}};exports[_0x6948('0x2b')]=function(_0x3b675f){try{if(!_['isNil'](dials[_0x3b675f[_0x6948('0xb')]])){utils[_0x6948('0x18')](util[_0x6948('0x3')](_0x6948('0x2c'),_0x3b675f['uniqueid']),_0x3b675f);utils[_0x6948('0xd')](util['format'](_0x6948('0x2d'),_0x3b675f[_0x6948('0xb')],_0x3b675f['calleridnum'],_0x3b675f['calleridname'],_0x3b675f[_0x6948('0x2e')]));dials[_0x3b675f[_0x6948('0xb')]]=_['assign'](dials[_0x3b675f[_0x6948('0xb')]],{'endtime':utils['now'](),'lastevent':_0x6948('0x2f')});dials[_0x3b675f[_0x6948('0xb')]][_0x6948('0x30')]=utils[_0x6948('0x31')](dials[_0x3b675f[_0x6948('0xb')]][_0x6948('0x32')],dials[_0x3b675f['uniqueid']][_0x6948('0x20')]);dials[_0x3b675f[_0x6948('0xb')]][_0x6948('0x33')]=utils['diffTime'](dials[_0x3b675f[_0x6948('0xb')]][_0x6948('0x27')]||dials[_0x3b675f['uniqueid']]['endtime'],dials[_0x3b675f[_0x6948('0xb')]][_0x6948('0x20')]);dials[_0x3b675f[_0x6948('0xb')]][_0x6948('0x34')]=dials[_0x3b675f[_0x6948('0xb')]][_0x6948('0x27')]?utils[_0x6948('0x31')](dials[_0x3b675f['uniqueid']][_0x6948('0x32')],dials[_0x3b675f['uniqueid']][_0x6948('0x27')]):0x0;writeDB(dials[_0x3b675f[_0x6948('0xb')]]);}}catch(_0x2bc9a4){utils[_0x6948('0x15')](util[_0x6948('0x3')](_0x6948('0x2c'),_0x3b675f[_0x6948('0xb')]),_0x2bc9a4);}}; \ No newline at end of file +var _0x42cd=['debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','startsWith','cdr(routeid)','error','varset','[%s][dials][varset]','isNil','outboundrouteid','info','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','ANSWER','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','[%s][dials][hangup]','calleridnum','cause-txt','complete','duration','diffTime','endtime','answertime','billableseconds','lodash','util','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten'];(function(_0x2e4bde,_0x529a7c){var _0x5418b6=function(_0x4d0775){while(--_0x4d0775){_0x2e4bde['push'](_0x2e4bde['shift']());}};_0x5418b6(++_0x529a7c);}(_0x42cd,0x1e7));var _0xd42c=function(_0x219e9b,_0x295d91){_0x219e9b=_0x219e9b-0x0;var _0x332e80=_0x42cd[_0x219e9b];return _0x332e80;};'use strict';var _=require(_0xd42c('0x0'));var util=require(_0xd42c('0x1'));var utils=require(_0xd42c('0x2'));var dials={};function writeDB(_0x595cf0){utils['info'](util[_0xd42c('0x3')](_0xd42c('0x4'),_0x595cf0[_0xd42c('0x5')],_0x595cf0[_0xd42c('0x6')],_0x595cf0[_0xd42c('0x7')],_0x595cf0['calleridnum'],_0x595cf0[_0xd42c('0x8')],_0x595cf0[_0xd42c('0x9')]));utils[_0xd42c('0xa')](_0xd42c('0xb'),_0x595cf0);delete dials[_0x595cf0[_0xd42c('0x5')]];}exports[_0xd42c('0xc')]=function(_0x11eec9){try{utils[_0xd42c('0xd')](util[_0xd42c('0x3')](_0xd42c('0xe'),_0x11eec9['uniqueid']),_0x11eec9);utils['info'](util['format'](_0xd42c('0xf'),_0x11eec9[_0xd42c('0x5')],_0x11eec9['application'],_0x11eec9[_0xd42c('0x10')]));if(_0x11eec9[_0xd42c('0x11')][_0xd42c('0x12')]()=='set'&&_[_0xd42c('0x13')](_0x11eec9[_0xd42c('0x10')][_0xd42c('0x12')](),_0xd42c('0x14'))){var _0x5ef841=_0x11eec9[_0xd42c('0x10')]['split']('=');dials[_0x11eec9[_0xd42c('0x5')]]={'routeId':_0x5ef841[0x1]};}}catch(_0x4c6de2){utils[_0xd42c('0x15')](util[_0xd42c('0x3')](_0xd42c('0xe'),_0x11eec9[_0xd42c('0x5')]),_0x4c6de2);}};exports[_0xd42c('0x16')]=function(_0x18e9e7){try{utils[_0xd42c('0xd')](util[_0xd42c('0x3')](_0xd42c('0x17'),_0x18e9e7['uniqueid']),_0x18e9e7);if(!_[_0xd42c('0x18')](_0x18e9e7['variable'][_0xd42c('0x19')])){utils[_0xd42c('0x1a')](util[_0xd42c('0x3')](_0xd42c('0x1b'),_0x18e9e7[_0xd42c('0x5')],_0x18e9e7[_0xd42c('0x1c')]));dials[_0x18e9e7[_0xd42c('0x5')]]={'routeId':_0x18e9e7[_0xd42c('0x1c')]};}}catch(_0x22d77e){utils[_0xd42c('0x15')](util[_0xd42c('0x3')](_0xd42c('0x17'),_0x18e9e7['uniqueid']),_0x22d77e);}};exports['dialbegin']=function(_0x27b831){try{if(!_[_0xd42c('0x18')](dials[_0x27b831['uniqueid']])){utils[_0xd42c('0xd')](util[_0xd42c('0x3')](_0xd42c('0x1d'),_0x27b831[_0xd42c('0x5')]),_0x27b831);dials[_0x27b831['uniqueid']]=_[_0xd42c('0x1e')](dials[_0x27b831[_0xd42c('0x5')]],_0x27b831);dials[_0x27b831[_0xd42c('0x5')]][_0xd42c('0x1f')]=utils[_0xd42c('0x20')]();dials[_0x27b831[_0xd42c('0x5')]][_0xd42c('0x21')]=_0xd42c('0x22');utils[_0xd42c('0x1a')](util[_0xd42c('0x3')](_0xd42c('0x23'),_0x27b831['uniqueid'],dials[_0x27b831['uniqueid']]['starttime']));}}catch(_0x2bdc46){utils[_0xd42c('0x15')](util[_0xd42c('0x3')](_0xd42c('0x1d'),_0x27b831[_0xd42c('0x5')]),_0x2bdc46);}};exports['dialend']=function(_0x3d660f){try{if(!_[_0xd42c('0x18')](dials[_0x3d660f[_0xd42c('0x5')]])){utils[_0xd42c('0xd')](util['format']('[%s][dials][dialend]',_0x3d660f[_0xd42c('0x5')]),_0x3d660f);dials[_0x3d660f[_0xd42c('0x5')]][_0xd42c('0x9')]=_0x3d660f['dialstatus'];if(_0x3d660f['dialstatus']==_0xd42c('0x24')){dials[_0x3d660f['uniqueid']]=_[_0xd42c('0x1e')](dials[_0x3d660f['uniqueid']],_0x3d660f);dials[_0x3d660f[_0xd42c('0x5')]]['answertime']=utils['now']();dials[_0x3d660f[_0xd42c('0x5')]][_0xd42c('0x21')]=_0xd42c('0x25');utils['info'](util[_0xd42c('0x3')](_0xd42c('0x26'),_0x3d660f[_0xd42c('0x5')],_0x3d660f[_0xd42c('0x9')],dials[_0x3d660f[_0xd42c('0x5')]]['answertime']));}else{utils[_0xd42c('0x1a')](util['format'](_0xd42c('0x27'),_0x3d660f[_0xd42c('0x5')],_0x3d660f[_0xd42c('0x9')]));}}}catch(_0x5b97fd){utils['error'](util['format'](_0xd42c('0x28'),_0x3d660f[_0xd42c('0x5')]),_0x5b97fd);}};exports['hangup']=function(_0x5ee97f){try{if(!_[_0xd42c('0x18')](dials[_0x5ee97f[_0xd42c('0x5')]])){utils[_0xd42c('0xd')](util[_0xd42c('0x3')](_0xd42c('0x29'),_0x5ee97f['uniqueid']),_0x5ee97f);utils['info'](util[_0xd42c('0x3')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x5ee97f['uniqueid'],_0x5ee97f[_0xd42c('0x2a')],_0x5ee97f['calleridname'],_0x5ee97f[_0xd42c('0x2b')]));dials[_0x5ee97f[_0xd42c('0x5')]]=_[_0xd42c('0x1e')](dials[_0x5ee97f[_0xd42c('0x5')]],{'endtime':utils[_0xd42c('0x20')](),'lastevent':_0xd42c('0x2c')});dials[_0x5ee97f[_0xd42c('0x5')]][_0xd42c('0x2d')]=utils[_0xd42c('0x2e')](dials[_0x5ee97f[_0xd42c('0x5')]][_0xd42c('0x2f')],dials[_0x5ee97f['uniqueid']][_0xd42c('0x1f')]);dials[_0x5ee97f[_0xd42c('0x5')]]['holdtime']=utils[_0xd42c('0x2e')](dials[_0x5ee97f['uniqueid']][_0xd42c('0x30')]||dials[_0x5ee97f['uniqueid']]['endtime'],dials[_0x5ee97f[_0xd42c('0x5')]][_0xd42c('0x1f')]);dials[_0x5ee97f['uniqueid']][_0xd42c('0x31')]=dials[_0x5ee97f[_0xd42c('0x5')]]['answertime']?utils[_0xd42c('0x2e')](dials[_0x5ee97f[_0xd42c('0x5')]][_0xd42c('0x2f')],dials[_0x5ee97f[_0xd42c('0x5')]][_0xd42c('0x30')]):0x0;writeDB(dials[_0x5ee97f[_0xd42c('0x5')]]);}}catch(_0x1f3739){utils[_0xd42c('0x15')](util[_0xd42c('0x3')](_0xd42c('0x29'),_0x5ee97f[_0xd42c('0x5')]),_0x1f3739);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 0187776..5b732eb 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 _0x10b9=['dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','port','asterisk','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin'];(function(_0x448422,_0x362248){var _0xcc0afd=function(_0x576b07){while(--_0x576b07){_0x448422['push'](_0x448422['shift']());}};_0xcc0afd(++_0x362248);}(_0x10b9,0xc8));var _0x910b=function(_0x48d178,_0x31506c){_0x48d178=_0x48d178-0x0;var _0x165d95=_0x10b9[_0x48d178];return _0x165d95;};var AsteriskManager=require(_0x910b('0x0'));var config=require(_0x910b('0x1'));var utils=require('./utils');var util=require('util');var ami=new AsteriskManager(config['asterisk'][_0x910b('0x2')],config['asterisk']['ip'],config[_0x910b('0x3')]['username'],config[_0x910b('0x3')][_0x910b('0x4')],!![]);ami[_0x910b('0x5')]();if(config['xdr']&&config[_0x910b('0x6')][_0x910b('0x7')]){utils[_0x910b('0x8')](_0x910b('0x9'));}else{var agents=require(_0x910b('0xa'));var calls=require(_0x910b('0xb'));var queues=require('./queues.controller');var recordings=require(_0x910b('0xc'));var members=require('./members.controller');var dials=require(_0x910b('0xd'));var transfers=require(_0x910b('0xe'));var core=require(_0x910b('0xf'));ami['on'](_0x910b('0x10'),core[_0x910b('0x10')]);ami['on'](_0x910b('0x11'),core[_0x910b('0x11')]);ami['on'](_0x910b('0x12'),core[_0x910b('0x12')]);ami['on'](_0x910b('0x13'),core[_0x910b('0x13')]);ami['on'](_0x910b('0x14'),core[_0x910b('0x14')]);ami['on'](_0x910b('0x15'),core[_0x910b('0x15')]);ami['on'](_0x910b('0x16'),function(_0x1c8403){try{utils[_0x910b('0x17')](util[_0x910b('0x18')](_0x910b('0x19'),_0x1c8403[_0x910b('0x1a')]),_0x1c8403);members['devicestatechange'](_0x1c8403);}catch(_0x3de1cc){utils[_0x910b('0x13')](util[_0x910b('0x18')](_0x910b('0x19'),_0x1c8403[_0x910b('0x1a')]),_0x3de1cc);}});ami['on'](_0x910b('0x1b'),function(_0x341530){try{utils[_0x910b('0x17')](util['format'](_0x910b('0x1c'),_0x341530[_0x910b('0x1d')]),_0x341530);agents[_0x910b('0x1b')](_0x341530);}catch(_0x1a450b){utils[_0x910b('0x13')](util['format'](_0x910b('0x1c'),_0x341530[_0x910b('0x1d')]),_0x1a450b);}});ami['on'](_0x910b('0x1e'),function(_0x470c27){try{utils[_0x910b('0x17')](util['format'](_0x910b('0x1f'),_0x470c27[_0x910b('0x1d')]),_0x470c27);agents[_0x910b('0x1e')](_0x470c27);}catch(_0x2cc92e){utils[_0x910b('0x13')](util[_0x910b('0x18')](_0x910b('0x1f'),_0x470c27[_0x910b('0x1d')]),_0x2cc92e);}});ami['on']('agentconnect',function(_0x1756d7){try{utils[_0x910b('0x17')](util['format'](_0x910b('0x20'),_0x1756d7[_0x910b('0x1d')]),_0x1756d7);agents['agentconnect'](_0x1756d7);queues['agentconnect'](_0x1756d7);}catch(_0x5cd151){utils[_0x910b('0x13')](util['format'](_0x910b('0x20'),_0x1756d7[_0x910b('0x1d')]),_0x5cd151);}});ami['on'](_0x910b('0x21'),function(_0x47f1a0){try{utils['debug'](util[_0x910b('0x18')](_0x910b('0x22'),_0x47f1a0[_0x910b('0x1d')]),_0x47f1a0);agents[_0x910b('0x21')](_0x47f1a0);queues['agentcomplete'](_0x47f1a0);members['agentcomplete'](_0x47f1a0);}catch(_0x49814d){utils['error'](util['format'](_0x910b('0x22'),_0x47f1a0[_0x910b('0x1d')]),_0x49814d);}});ami['on'](_0x910b('0x23'),function(_0x183144){try{utils[_0x910b('0x17')](util[_0x910b('0x18')](_0x910b('0x24'),_0x183144['uniqueid']),_0x183144);agents['queuecallerabandon'](_0x183144);queues[_0x910b('0x23')](_0x183144);}catch(_0xbe42e6){utils[_0x910b('0x13')](util[_0x910b('0x18')](_0x910b('0x24'),_0x183144['uniqueid']),_0xbe42e6);}});ami['on'](_0x910b('0x25'),function(_0x14c6e8){try{utils[_0x910b('0x17')](util[_0x910b('0x18')]('[%s][index][queuecallerjoin]',_0x14c6e8['uniqueid']),_0x14c6e8);queues[_0x910b('0x25')](_0x14c6e8);recordings[_0x910b('0x25')](_0x14c6e8);}catch(_0x55b0d4){utils['error'](util['format'](_0x910b('0x26'),_0x14c6e8[_0x910b('0x1d')]),_0x55b0d4);}});ami['on'](_0x910b('0x27'),function(_0x52a2ea){try{utils[_0x910b('0x17')](util[_0x910b('0x18')](_0x910b('0x28'),_0x52a2ea[_0x910b('0x1d')]),_0x52a2ea);queues['queuecallerleave'](_0x52a2ea);}catch(_0x229383){utils[_0x910b('0x13')](util[_0x910b('0x18')](_0x910b('0x28'),_0x52a2ea[_0x910b('0x1d')]),_0x229383);}});ami['on'](_0x910b('0x29'),function(_0xa863ed){try{utils[_0x910b('0x17')](util['format'](_0x910b('0x2a'),_0xa863ed[_0x910b('0x1d')]),_0xa863ed);queues[_0x910b('0x29')](_0xa863ed);calls[_0x910b('0x29')](_0xa863ed);}catch(_0xf6051c){utils[_0x910b('0x13')](util['format'](_0x910b('0x2a'),_0xa863ed[_0x910b('0x1d')]),_0xf6051c);}});ami['on']('musiconholdstop',function(_0x3f648d){try{utils['debug'](util[_0x910b('0x18')](_0x910b('0x2b'),_0x3f648d[_0x910b('0x1d')]),_0x3f648d);queues['musiconholdstop'](_0x3f648d);calls[_0x910b('0x2c')](_0x3f648d);}catch(_0x4219a4){utils[_0x910b('0x13')](util[_0x910b('0x18')](_0x910b('0x2b'),_0x3f648d[_0x910b('0x1d')]),_0x4219a4);}});ami['on']('newstate',function(_0x3a2609){try{utils[_0x910b('0x17')](util[_0x910b('0x18')](_0x910b('0x2d'),_0x3a2609[_0x910b('0x1d')]),_0x3a2609);calls[_0x910b('0x2e')](_0x3a2609);recordings[_0x910b('0x2e')](_0x3a2609);}catch(_0x36de4c){utils['error'](util[_0x910b('0x18')]('[%s][index][newstate]',_0x3a2609[_0x910b('0x1d')]),_0x36de4c);}});ami['on'](_0x910b('0x2f'),function(_0x585e9d){try{utils[_0x910b('0x17')](util['format'](_0x910b('0x30'),_0x585e9d[_0x910b('0x1d')]),_0x585e9d);calls[_0x910b('0x2f')](_0x585e9d);recordings[_0x910b('0x2f')](_0x585e9d);dials[_0x910b('0x2f')](_0x585e9d);agents[_0x910b('0x2f')](_0x585e9d);queues[_0x910b('0x2f')](_0x585e9d);}catch(_0x596b1c){utils[_0x910b('0x13')](util['format'](_0x910b('0x30'),_0x585e9d[_0x910b('0x1d')]),_0x596b1c);}});ami['on'](_0x910b('0x31'),function(_0x1798d4){try{utils[_0x910b('0x17')](util[_0x910b('0x18')](_0x910b('0x32'),_0x1798d4[_0x910b('0x1d')]),_0x1798d4);members[_0x910b('0x31')](_0x1798d4);}catch(_0xd0ad72){utils[_0x910b('0x13')](util[_0x910b('0x18')](_0x910b('0x32'),_0x1798d4[_0x910b('0x1d')]),_0xd0ad72);}});ami['on'](_0x910b('0x33'),function(_0x1887d3){try{utils[_0x910b('0x17')](util['format'](_0x910b('0x34'),_0x1887d3[_0x910b('0x1d')]),_0x1887d3);queues[_0x910b('0x33')](_0x1887d3);agents[_0x910b('0x33')](_0x1887d3);transfers[_0x910b('0x33')](_0x1887d3);recordings[_0x910b('0x33')](_0x1887d3);}catch(_0x47fbb9){utils['error'](util[_0x910b('0x18')](_0x910b('0x34'),_0x1887d3[_0x910b('0x1d')]),_0x47fbb9);}});ami['on'](_0x910b('0x35'),function(_0x50599a){try{utils[_0x910b('0x17')](util[_0x910b('0x18')]('[%s][index][attendedtransfer]',_0x50599a['origtransfereruniqueid']),_0x50599a);queues[_0x910b('0x35')](_0x50599a);transfers[_0x910b('0x35')](_0x50599a);agents['attendedtransfer'](_0x50599a);calls[_0x910b('0x35')](_0x50599a);}catch(_0x1c0f87){utils[_0x910b('0x13')](util[_0x910b('0x18')](_0x910b('0x36'),_0x50599a[_0x910b('0x37')]),_0x1c0f87);}});ami['on'](_0x910b('0x38'),function(_0x2a1294){try{utils['debug'](util['format']('[%s][index][varset]',_0x2a1294[_0x910b('0x1d')]),_0x2a1294);queues['varset'](_0x2a1294);recordings[_0x910b('0x38')](_0x2a1294);calls['varset'](_0x2a1294);dials[_0x910b('0x38')](_0x2a1294);}catch(_0x2f9e83){utils['error'](util[_0x910b('0x18')](_0x910b('0x39'),_0x2a1294[_0x910b('0x1d')]),_0x2f9e83);}});ami['on']('newexten',function(_0x1ace9a){try{utils[_0x910b('0x17')](util['format']('[%s][index][newexten]',_0x1ace9a[_0x910b('0x1d')]),_0x1ace9a);calls[_0x910b('0x3a')](_0x1ace9a);recordings[_0x910b('0x3a')](_0x1ace9a);dials[_0x910b('0x3a')](_0x1ace9a);}catch(_0x5c119f){utils['error'](util[_0x910b('0x18')]('[%s][index][newexten]',_0x1ace9a[_0x910b('0x1d')]),_0x5c119f);}});ami['on']('newchannel',function(_0x51d706){try{utils['debug'](util['format']('[%s][index][newchannel]',_0x51d706['uniqueid']),_0x51d706);calls[_0x910b('0x3b')](_0x51d706);recordings['newchannel'](_0x51d706);}catch(_0x59d910){utils[_0x910b('0x13')](util['format'](_0x910b('0x3c'),_0x51d706[_0x910b('0x1d')]),_0x59d910);}});ami['on'](_0x910b('0x3d'),function(_0x575d07){try{utils[_0x910b('0x17')](util[_0x910b('0x18')](_0x910b('0x3e'),_0x575d07[_0x910b('0x1d')]),_0x575d07);dials[_0x910b('0x3d')](_0x575d07);}catch(_0x2d867d){utils[_0x910b('0x13')](util[_0x910b('0x18')](_0x910b('0x3f'),_0x575d07[_0x910b('0x1d')]),_0x2d867d);}});ami['on'](_0x910b('0x40'),function(_0x1b94d2){try{utils[_0x910b('0x17')](util['format']('[%s][index][dialend]',_0x1b94d2['uniqueid']),_0x1b94d2);dials[_0x910b('0x40')](_0x1b94d2);}catch(_0x324c70){utils[_0x910b('0x13')](util['format'](_0x910b('0x41'),_0x1b94d2[_0x910b('0x1d')]),_0x324c70);}});} \ No newline at end of file +var _0xb5ec=['varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','port','username','keepConnected','xdr','info','XDR\x20DISABLED','./agents.controller','./queues.controller','./recordings.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','[%s][index][devicestatechange]','device','devicestatechange','format','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid'];(function(_0x175b8d,_0x147fc8){var _0x3193b9=function(_0x4d0d7c){while(--_0x4d0d7c){_0x175b8d['push'](_0x175b8d['shift']());}};_0x3193b9(++_0x147fc8);}(_0xb5ec,0xd0));var _0xcb5e=function(_0x304d8f,_0x1a2682){_0x304d8f=_0x304d8f-0x0;var _0x5a603d=_0xb5ec[_0x304d8f];return _0x5a603d;};var AsteriskManager=require(_0xcb5e('0x0'));var config=require(_0xcb5e('0x1'));var utils=require(_0xcb5e('0x2'));var util=require(_0xcb5e('0x3'));var ami=new AsteriskManager(config['asterisk'][_0xcb5e('0x4')],config['asterisk']['ip'],config['asterisk'][_0xcb5e('0x5')],config['asterisk']['password'],!![]);ami[_0xcb5e('0x6')]();if(config[_0xcb5e('0x7')]&&config[_0xcb5e('0x7')]['disabled']){utils[_0xcb5e('0x8')](_0xcb5e('0x9'));}else{var agents=require(_0xcb5e('0xa'));var calls=require('./calls.controller');var queues=require(_0xcb5e('0xb'));var recordings=require(_0xcb5e('0xc'));var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require(_0xcb5e('0xd'));var core=require(_0xcb5e('0xe'));ami['on'](_0xcb5e('0xf'),core[_0xcb5e('0xf')]);ami['on'](_0xcb5e('0x10'),core[_0xcb5e('0x10')]);ami['on'](_0xcb5e('0x11'),core[_0xcb5e('0x11')]);ami['on'](_0xcb5e('0x12'),core['error']);ami['on'](_0xcb5e('0x13'),core[_0xcb5e('0x13')]);ami['on'](_0xcb5e('0x14'),core[_0xcb5e('0x14')]);ami['on']('devicestatechange',function(_0x2a3522){try{utils[_0xcb5e('0x15')](util['format'](_0xcb5e('0x16'),_0x2a3522[_0xcb5e('0x17')]),_0x2a3522);members[_0xcb5e('0x18')](_0x2a3522);}catch(_0x437e2a){utils[_0xcb5e('0x12')](util[_0xcb5e('0x19')](_0xcb5e('0x16'),_0x2a3522[_0xcb5e('0x17')]),_0x437e2a);}});ami['on'](_0xcb5e('0x1a'),function(_0x5b8164){try{utils['debug'](util[_0xcb5e('0x19')](_0xcb5e('0x1b'),_0x5b8164[_0xcb5e('0x1c')]),_0x5b8164);agents['agentcalled'](_0x5b8164);}catch(_0x3887d5){utils['error'](util[_0xcb5e('0x19')](_0xcb5e('0x1b'),_0x5b8164[_0xcb5e('0x1c')]),_0x3887d5);}});ami['on'](_0xcb5e('0x1d'),function(_0x42ee46){try{utils['debug'](util[_0xcb5e('0x19')](_0xcb5e('0x1e'),_0x42ee46[_0xcb5e('0x1c')]),_0x42ee46);agents[_0xcb5e('0x1d')](_0x42ee46);}catch(_0x21a420){utils['error'](util[_0xcb5e('0x19')](_0xcb5e('0x1e'),_0x42ee46[_0xcb5e('0x1c')]),_0x21a420);}});ami['on'](_0xcb5e('0x1f'),function(_0x414711){try{utils[_0xcb5e('0x15')](util[_0xcb5e('0x19')](_0xcb5e('0x20'),_0x414711[_0xcb5e('0x1c')]),_0x414711);agents[_0xcb5e('0x1f')](_0x414711);queues[_0xcb5e('0x1f')](_0x414711);}catch(_0x37aca0){utils[_0xcb5e('0x12')](util[_0xcb5e('0x19')](_0xcb5e('0x20'),_0x414711[_0xcb5e('0x1c')]),_0x37aca0);}});ami['on'](_0xcb5e('0x21'),function(_0x17377f){try{utils[_0xcb5e('0x15')](util['format'](_0xcb5e('0x22'),_0x17377f[_0xcb5e('0x1c')]),_0x17377f);agents[_0xcb5e('0x21')](_0x17377f);queues[_0xcb5e('0x21')](_0x17377f);members['agentcomplete'](_0x17377f);}catch(_0x397a56){utils[_0xcb5e('0x12')](util[_0xcb5e('0x19')](_0xcb5e('0x22'),_0x17377f[_0xcb5e('0x1c')]),_0x397a56);}});ami['on'](_0xcb5e('0x23'),function(_0x5f1a65){try{utils['debug'](util['format'](_0xcb5e('0x24'),_0x5f1a65[_0xcb5e('0x1c')]),_0x5f1a65);agents[_0xcb5e('0x23')](_0x5f1a65);queues[_0xcb5e('0x23')](_0x5f1a65);}catch(_0x35ffbd){utils[_0xcb5e('0x12')](util[_0xcb5e('0x19')](_0xcb5e('0x24'),_0x5f1a65[_0xcb5e('0x1c')]),_0x35ffbd);}});ami['on'](_0xcb5e('0x25'),function(_0x3a056a){try{utils[_0xcb5e('0x15')](util[_0xcb5e('0x19')](_0xcb5e('0x26'),_0x3a056a[_0xcb5e('0x1c')]),_0x3a056a);queues['queuecallerjoin'](_0x3a056a);recordings[_0xcb5e('0x25')](_0x3a056a);}catch(_0x2c9bbe){utils['error'](util[_0xcb5e('0x19')]('[%s][index][queuecallerjoin]',_0x3a056a['uniqueid']),_0x2c9bbe);}});ami['on'](_0xcb5e('0x27'),function(_0x37c2f7){try{utils[_0xcb5e('0x15')](util[_0xcb5e('0x19')](_0xcb5e('0x28'),_0x37c2f7[_0xcb5e('0x1c')]),_0x37c2f7);queues[_0xcb5e('0x27')](_0x37c2f7);}catch(_0x394e55){utils[_0xcb5e('0x12')](util[_0xcb5e('0x19')]('[%s][index][queuecallerleave]',_0x37c2f7[_0xcb5e('0x1c')]),_0x394e55);}});ami['on'](_0xcb5e('0x29'),function(_0x1a7135){try{utils[_0xcb5e('0x15')](util[_0xcb5e('0x19')](_0xcb5e('0x2a'),_0x1a7135[_0xcb5e('0x1c')]),_0x1a7135);queues[_0xcb5e('0x29')](_0x1a7135);calls['musiconholdstart'](_0x1a7135);}catch(_0x1ce56d){utils[_0xcb5e('0x12')](util[_0xcb5e('0x19')](_0xcb5e('0x2a'),_0x1a7135['uniqueid']),_0x1ce56d);}});ami['on']('musiconholdstop',function(_0x26106e){try{utils[_0xcb5e('0x15')](util[_0xcb5e('0x19')]('[%s][index][musiconholdstop]',_0x26106e[_0xcb5e('0x1c')]),_0x26106e);queues[_0xcb5e('0x2b')](_0x26106e);calls['musiconholdstop'](_0x26106e);}catch(_0x4e707e){utils[_0xcb5e('0x12')](util[_0xcb5e('0x19')](_0xcb5e('0x2c'),_0x26106e[_0xcb5e('0x1c')]),_0x4e707e);}});ami['on'](_0xcb5e('0x2d'),function(_0x2f4f06){try{utils[_0xcb5e('0x15')](util[_0xcb5e('0x19')](_0xcb5e('0x2e'),_0x2f4f06[_0xcb5e('0x1c')]),_0x2f4f06);calls[_0xcb5e('0x2d')](_0x2f4f06);recordings['newstate'](_0x2f4f06);}catch(_0x2594ee){utils[_0xcb5e('0x12')](util[_0xcb5e('0x19')](_0xcb5e('0x2e'),_0x2f4f06['uniqueid']),_0x2594ee);}});ami['on'](_0xcb5e('0x2f'),function(_0x278fb6){try{utils['debug'](util[_0xcb5e('0x19')](_0xcb5e('0x30'),_0x278fb6[_0xcb5e('0x1c')]),_0x278fb6);calls[_0xcb5e('0x2f')](_0x278fb6);recordings[_0xcb5e('0x2f')](_0x278fb6);dials[_0xcb5e('0x2f')](_0x278fb6);agents[_0xcb5e('0x2f')](_0x278fb6);queues[_0xcb5e('0x2f')](_0x278fb6);}catch(_0x4681f0){utils[_0xcb5e('0x12')](util['format']('[%s][index][hangup]',_0x278fb6[_0xcb5e('0x1c')]),_0x4681f0);}});ami['on'](_0xcb5e('0x31'),function(_0x320323){try{utils['debug'](util['format'](_0xcb5e('0x32'),_0x320323['uniqueid']),_0x320323);members[_0xcb5e('0x31')](_0x320323);}catch(_0x4ac05f){utils[_0xcb5e('0x12')](util[_0xcb5e('0x19')](_0xcb5e('0x32'),_0x320323['uniqueid']),_0x4ac05f);}});ami['on'](_0xcb5e('0x33'),function(_0x2fd8be){try{utils['debug'](util['format'](_0xcb5e('0x34'),_0x2fd8be[_0xcb5e('0x1c')]),_0x2fd8be);queues['blindtransfer'](_0x2fd8be);agents[_0xcb5e('0x33')](_0x2fd8be);transfers[_0xcb5e('0x33')](_0x2fd8be);recordings[_0xcb5e('0x33')](_0x2fd8be);}catch(_0xf28a71){utils[_0xcb5e('0x12')](util[_0xcb5e('0x19')](_0xcb5e('0x34'),_0x2fd8be[_0xcb5e('0x1c')]),_0xf28a71);}});ami['on'](_0xcb5e('0x35'),function(_0x1a69b2){try{utils[_0xcb5e('0x15')](util[_0xcb5e('0x19')](_0xcb5e('0x36'),_0x1a69b2[_0xcb5e('0x37')]),_0x1a69b2);queues[_0xcb5e('0x35')](_0x1a69b2);transfers['attendedtransfer'](_0x1a69b2);agents[_0xcb5e('0x35')](_0x1a69b2);calls['attendedtransfer'](_0x1a69b2);}catch(_0x1d1d29){utils[_0xcb5e('0x12')](util[_0xcb5e('0x19')](_0xcb5e('0x36'),_0x1a69b2[_0xcb5e('0x37')]),_0x1d1d29);}});ami['on'](_0xcb5e('0x38'),function(_0x5a2dfe){try{utils[_0xcb5e('0x15')](util[_0xcb5e('0x19')](_0xcb5e('0x39'),_0x5a2dfe[_0xcb5e('0x1c')]),_0x5a2dfe);queues[_0xcb5e('0x38')](_0x5a2dfe);recordings[_0xcb5e('0x38')](_0x5a2dfe);calls[_0xcb5e('0x38')](_0x5a2dfe);dials[_0xcb5e('0x38')](_0x5a2dfe);}catch(_0xef82e2){utils['error'](util[_0xcb5e('0x19')](_0xcb5e('0x39'),_0x5a2dfe[_0xcb5e('0x1c')]),_0xef82e2);}});ami['on'](_0xcb5e('0x3a'),function(_0x20eac4){try{utils[_0xcb5e('0x15')](util['format'](_0xcb5e('0x3b'),_0x20eac4['uniqueid']),_0x20eac4);calls[_0xcb5e('0x3a')](_0x20eac4);recordings[_0xcb5e('0x3a')](_0x20eac4);dials[_0xcb5e('0x3a')](_0x20eac4);}catch(_0x5306f6){utils[_0xcb5e('0x12')](util[_0xcb5e('0x19')](_0xcb5e('0x3b'),_0x20eac4[_0xcb5e('0x1c')]),_0x5306f6);}});ami['on'](_0xcb5e('0x3c'),function(_0x57390d){try{utils['debug'](util[_0xcb5e('0x19')]('[%s][index][newchannel]',_0x57390d[_0xcb5e('0x1c')]),_0x57390d);calls[_0xcb5e('0x3c')](_0x57390d);recordings[_0xcb5e('0x3c')](_0x57390d);}catch(_0x6d0c71){utils['error'](util[_0xcb5e('0x19')](_0xcb5e('0x3d'),_0x57390d['uniqueid']),_0x6d0c71);}});ami['on'](_0xcb5e('0x3e'),function(_0x3fa338){try{utils[_0xcb5e('0x15')](util[_0xcb5e('0x19')]('[%s][index][dialbegin]',_0x3fa338[_0xcb5e('0x1c')]),_0x3fa338);dials[_0xcb5e('0x3e')](_0x3fa338);}catch(_0x362d6d){utils[_0xcb5e('0x12')](util[_0xcb5e('0x19')](_0xcb5e('0x3f'),_0x3fa338[_0xcb5e('0x1c')]),_0x362d6d);}});ami['on'](_0xcb5e('0x40'),function(_0x5a94d8){try{utils[_0xcb5e('0x15')](util['format'](_0xcb5e('0x41'),_0x5a94d8[_0xcb5e('0x1c')]),_0x5a94d8);dials[_0xcb5e('0x40')](_0x5a94d8);}catch(_0x225995){utils['error'](util[_0xcb5e('0x19')](_0xcb5e('0x41'),_0x5a94d8['uniqueid']),_0x225995);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index fd98e6a..b2ee7b2 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 _0xc9d9=['[%s][members][devicestatechange]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','debug','[%s][members][cdr]','channel','data1','data2','destination','data3','destinationchannel','source','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','./utils','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','membername','type','getUserByInterface','name','internal','request','CreateMemberReport','getUserByName','split','then','catch','error','format','some','startsWith','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','enterAt'];(function(_0x4e46dd,_0xa549bc){var _0x2d050d=function(_0x40cc68){while(--_0x40cc68){_0x4e46dd['push'](_0x4e46dd['shift']());}};_0x2d050d(++_0xa549bc);}(_0xc9d9,0x141));var _0x9c9d=function(_0x46772c,_0x5f0cfe){_0x46772c=_0x46772c-0x0;var _0x58f8af=_0xc9d9[_0x46772c];return _0x58f8af;};'use strict';var _=require(_0x9c9d('0x0'));var util=require(_0x9c9d('0x1'));var utils=require(_0x9c9d('0x2'));var members={};var exclude=['Local/_attended@transfer',_0x9c9d('0x3')];function writeDB(_0x31b092){utils[_0x9c9d('0x4')](util['format'](_0x9c9d('0x5'),_0x31b092[_0x9c9d('0x6')],_0x31b092[_0x9c9d('0x7')],_0x31b092['channel'],_0x31b092['data2'],_0x31b092[_0x9c9d('0x8')],_0x31b092[_0x9c9d('0x9')]));if(_0x31b092[_0x9c9d('0x7')]){utils[_0x9c9d('0xa')](_0x31b092[_0x9c9d('0x7')])['then'](function(_0x15efd9){if(_0x15efd9){_0x31b092[_0x9c9d('0x8')]=_0x15efd9[_0x9c9d('0xb')];_0x31b092[_0x9c9d('0xc')]=_0x15efd9[_0x9c9d('0xc')];utils[_0x9c9d('0xd')](_0x9c9d('0xe'),_0x31b092);}else{utils[_0x9c9d('0xf')](_0x31b092[_0x9c9d('0x7')][_0x9c9d('0x10')]('/')[0x1])[_0x9c9d('0x11')](function(_0x12ace5){if(_0x12ace5){_0x31b092['membername']=_0x12ace5[_0x9c9d('0xb')];_0x31b092['internal']=_0x12ace5['internal'];utils[_0x9c9d('0xd')]('CreateMemberReport',_0x31b092);}});}})[_0x9c9d('0x12')](function(_0x3c0650){utils[_0x9c9d('0x13')](util[_0x9c9d('0x14')]('[%s][members][writeDB]',_0x31b092[_0x9c9d('0x6')]),_0x3c0650);});}delete members[_0x31b092[_0x9c9d('0x7')]];}function startsWith(_0x18b8cf,_0x45581b){return _[_0x9c9d('0x15')](_0x18b8cf,function(_0x1268f7){return _[_0x9c9d('0x16')](_0x45581b,_0x1268f7);});}exports['devicestatechange']=function(_0x5f221e){try{utils['debug'](util[_0x9c9d('0x14')]('[%s][members][devicestatechange]',members[_0x5f221e[_0x9c9d('0x17')]]?members[_0x5f221e[_0x9c9d('0x17')]][_0x9c9d('0x6')]:_0x5f221e[_0x9c9d('0x17')]),_0x5f221e);utils[_0x9c9d('0x4')](util[_0x9c9d('0x14')](_0x9c9d('0x18'),members[_0x5f221e['device']]?members[_0x5f221e[_0x9c9d('0x17')]]['uniqueid']:_0x5f221e[_0x9c9d('0x17')],_0x5f221e[_0x9c9d('0x19')],_0x5f221e[_0x9c9d('0x17')]));switch(_0x5f221e[_0x9c9d('0x19')]){case'INUSE':case _0x9c9d('0x1a'):if(!startsWith(exclude,_0x5f221e[_0x9c9d('0x17')])){members[_0x5f221e[_0x9c9d('0x17')]]={'channel':_0x9c9d('0x1b'),'interface':_0x5f221e[_0x9c9d('0x17')],'type':_0x9c9d('0x1c'),'enterAt':utils[_0x9c9d('0x1d')](),'role':_0x9c9d('0x1e')};}break;case _0x9c9d('0x1f'):if(!_[_0x9c9d('0x20')](members[_0x5f221e[_0x9c9d('0x17')]])){members[_0x5f221e[_0x9c9d('0x17')]][_0x9c9d('0x21')]=utils[_0x9c9d('0x1d')]();members[_0x5f221e[_0x9c9d('0x17')]][_0x9c9d('0x22')]=utils['diffTime'](members[_0x5f221e[_0x9c9d('0x17')]][_0x9c9d('0x21')],members[_0x5f221e[_0x9c9d('0x17')]][_0x9c9d('0x23')]);if(members[_0x5f221e[_0x9c9d('0x17')]][_0x9c9d('0x6')]){writeDB(members[_0x5f221e[_0x9c9d('0x17')]]);}}break;default:break;}}catch(_0xa9561a){utils[_0x9c9d('0x13')](util[_0x9c9d('0x14')](_0x9c9d('0x24'),members[_0x5f221e[_0x9c9d('0x17')]]?members[_0x5f221e[_0x9c9d('0x17')]][_0x9c9d('0x6')]:_0x5f221e['device']),_0xa9561a);}};exports['agentcomplete']=function(_0x4e5724){try{if(!_[_0x9c9d('0x20')](members[_0x4e5724[_0x9c9d('0x7')]])){utils['debug'](util[_0x9c9d('0x14')]('[%s][members][agentcomplete]',_0x4e5724['uniqueid']),_0x4e5724);utils[_0x9c9d('0x4')](util['format'](_0x9c9d('0x25'),_0x4e5724[_0x9c9d('0x6')],_0x4e5724[_0x9c9d('0x7')],_0x4e5724[_0x9c9d('0x26')]));members[_0x4e5724[_0x9c9d('0x7')]]=_[_0x9c9d('0x27')](members[_0x4e5724[_0x9c9d('0x7')]],{'data4':_0x4e5724[_0x9c9d('0x26')],'uniqueid':_0x4e5724[_0x9c9d('0x6')]});}}catch(_0x10cc94){utils[_0x9c9d('0x13')](util[_0x9c9d('0x14')]('[%s][members][agentcomplete]',_0x4e5724[_0x9c9d('0x6')]),_0x10cc94);}};exports[_0x9c9d('0x28')]=function(_0xf5f108){try{utils[_0x9c9d('0x29')](util[_0x9c9d('0x14')](_0x9c9d('0x2a'),_0xf5f108[_0x9c9d('0x6')]),_0xf5f108);if(_0xf5f108[_0x9c9d('0x2b')]){var _0x4d4fed=_0xf5f108[_0x9c9d('0x2b')]['split']('-')[0x0];if(!_[_0x9c9d('0x20')](members[_0x4d4fed])){members[_0x4d4fed]=_['assign'](members[_0x4d4fed],{'data1':members[_0x4d4fed][_0x9c9d('0x2c')]||_0xf5f108['type'],'data2':members[_0x4d4fed][_0x9c9d('0x2d')]||_0xf5f108['source'],'data3':members[_0x4d4fed]['data3']||_0xf5f108[_0x9c9d('0x2e')],'uniqueid':members[_0x4d4fed]['uniqueid']||_0xf5f108[_0x9c9d('0x6')]});utils[_0x9c9d('0x4')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0xf5f108[_0x9c9d('0x6')],members[_0x4d4fed][_0x9c9d('0x2c')],members[_0x4d4fed][_0x9c9d('0x2d')],members[_0x4d4fed][_0x9c9d('0x2f')]));if(members[_0x4d4fed][_0x9c9d('0x21')]){writeDB(members[_0x4d4fed]);}}}if(_0xf5f108[_0x9c9d('0x30')]){var _0x3fe670=_0xf5f108['destinationchannel'][_0x9c9d('0x10')]('-')[0x0];if(!_['isNil'](members[_0x3fe670])){members[_0x3fe670]=_[_0x9c9d('0x27')](members[_0x3fe670],{'data1':members[_0x3fe670]['data1']||_0xf5f108['type'],'data2':members[_0x3fe670][_0x9c9d('0x2d')]||_0xf5f108[_0x9c9d('0x31')],'data3':members[_0x3fe670][_0x9c9d('0x2f')]||_0xf5f108[_0x9c9d('0x2e')],'uniqueid':members[_0x3fe670][_0x9c9d('0x6')]||_0xf5f108[_0x9c9d('0x6')]});utils[_0x9c9d('0x4')](util[_0x9c9d('0x14')](_0x9c9d('0x32'),_0xf5f108[_0x9c9d('0x6')],members[_0x3fe670][_0x9c9d('0x2c')],members[_0x3fe670][_0x9c9d('0x2d')],members[_0x3fe670]['data3']));if(members[_0x3fe670][_0x9c9d('0x21')]){writeDB(members[_0x3fe670]);}}}}catch(_0x3273bc){utils[_0x9c9d('0x13')](util[_0x9c9d('0x14')](_0x9c9d('0x2a'),_0xf5f108[_0x9c9d('0x6')]),_0x3273bc);}}; \ No newline at end of file +var _0xa198=['then','internal','request','getUserByName','split','catch','error','[%s][members][writeDB]','startsWith','devicestatechange','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','INUSE','BUSY','TALKING','now','agent','isNil','exitAt','duration','agentcomplete','debug','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','data1','data2','source','data3','destination','destinationchannel','type','lodash','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','membername','getUserByInterface'];(function(_0x519380,_0x7f196){var _0x60ba2c=function(_0x5b2110){while(--_0x5b2110){_0x519380['push'](_0x519380['shift']());}};_0x60ba2c(++_0x7f196);}(_0xa198,0x7f));var _0x8a19=function(_0x5e006b,_0x59b4c7){_0x5e006b=_0x5e006b-0x0;var _0x4be286=_0xa198[_0x5e006b];return _0x4be286;};'use strict';var _=require(_0x8a19('0x0'));var util=require('util');var utils=require('./utils');var members={};var exclude=[_0x8a19('0x1'),_0x8a19('0x2')];function writeDB(_0x1884de){utils[_0x8a19('0x3')](util[_0x8a19('0x4')](_0x8a19('0x5'),_0x1884de[_0x8a19('0x6')],_0x1884de[_0x8a19('0x7')],_0x1884de[_0x8a19('0x8')],_0x1884de['data2'],_0x1884de[_0x8a19('0x9')],_0x1884de['type']));if(_0x1884de[_0x8a19('0x7')]){utils[_0x8a19('0xa')](_0x1884de['interface'])[_0x8a19('0xb')](function(_0x1931eb){if(_0x1931eb){_0x1884de[_0x8a19('0x9')]=_0x1931eb['name'];_0x1884de[_0x8a19('0xc')]=_0x1931eb[_0x8a19('0xc')];utils[_0x8a19('0xd')]('CreateMemberReport',_0x1884de);}else{utils[_0x8a19('0xe')](_0x1884de['interface'][_0x8a19('0xf')]('/')[0x1])[_0x8a19('0xb')](function(_0x1c1f13){if(_0x1c1f13){_0x1884de[_0x8a19('0x9')]=_0x1c1f13['name'];_0x1884de['internal']=_0x1c1f13[_0x8a19('0xc')];utils[_0x8a19('0xd')]('CreateMemberReport',_0x1884de);}});}})[_0x8a19('0x10')](function(_0x71d1de){utils[_0x8a19('0x11')](util[_0x8a19('0x4')](_0x8a19('0x12'),_0x1884de[_0x8a19('0x6')]),_0x71d1de);});}delete members[_0x1884de[_0x8a19('0x7')]];}function startsWith(_0x3df818,_0x20796f){return _['some'](_0x3df818,function(_0x7743c6){return _[_0x8a19('0x13')](_0x20796f,_0x7743c6);});}exports[_0x8a19('0x14')]=function(_0x4d448c){try{utils['debug'](util['format']('[%s][members][devicestatechange]',members[_0x4d448c[_0x8a19('0x15')]]?members[_0x4d448c[_0x8a19('0x15')]][_0x8a19('0x6')]:_0x4d448c['device']),_0x4d448c);utils['info'](util[_0x8a19('0x4')](_0x8a19('0x16'),members[_0x4d448c[_0x8a19('0x15')]]?members[_0x4d448c[_0x8a19('0x15')]]['uniqueid']:_0x4d448c[_0x8a19('0x15')],_0x4d448c['state'],_0x4d448c[_0x8a19('0x15')]));switch(_0x4d448c['state']){case _0x8a19('0x17'):case _0x8a19('0x18'):if(!startsWith(exclude,_0x4d448c[_0x8a19('0x15')])){members[_0x4d448c[_0x8a19('0x15')]]={'channel':'voice','interface':_0x4d448c[_0x8a19('0x15')],'type':_0x8a19('0x19'),'enterAt':utils[_0x8a19('0x1a')](),'role':_0x8a19('0x1b')};}break;case'NOT_INUSE':if(!_[_0x8a19('0x1c')](members[_0x4d448c[_0x8a19('0x15')]])){members[_0x4d448c[_0x8a19('0x15')]][_0x8a19('0x1d')]=utils[_0x8a19('0x1a')]();members[_0x4d448c[_0x8a19('0x15')]][_0x8a19('0x1e')]=utils['diffTime'](members[_0x4d448c[_0x8a19('0x15')]][_0x8a19('0x1d')],members[_0x4d448c[_0x8a19('0x15')]]['enterAt']);if(members[_0x4d448c['device']][_0x8a19('0x6')]){writeDB(members[_0x4d448c[_0x8a19('0x15')]]);}}break;default:break;}}catch(_0x2c798d){utils[_0x8a19('0x11')](util[_0x8a19('0x4')]('[%s][members][devicestatechange]',members[_0x4d448c[_0x8a19('0x15')]]?members[_0x4d448c[_0x8a19('0x15')]]['uniqueid']:_0x4d448c[_0x8a19('0x15')]),_0x2c798d);}};exports[_0x8a19('0x1f')]=function(_0x64b267){try{if(!_['isNil'](members[_0x64b267[_0x8a19('0x7')]])){utils[_0x8a19('0x20')](util[_0x8a19('0x4')](_0x8a19('0x21'),_0x64b267[_0x8a19('0x6')]),_0x64b267);utils[_0x8a19('0x3')](util[_0x8a19('0x4')](_0x8a19('0x22'),_0x64b267['uniqueid'],_0x64b267['interface'],_0x64b267[_0x8a19('0x23')]));members[_0x64b267[_0x8a19('0x7')]]=_[_0x8a19('0x24')](members[_0x64b267[_0x8a19('0x7')]],{'data4':_0x64b267[_0x8a19('0x23')],'uniqueid':_0x64b267['uniqueid']});}}catch(_0x1b4ab9){utils[_0x8a19('0x11')](util[_0x8a19('0x4')]('[%s][members][agentcomplete]',_0x64b267[_0x8a19('0x6')]),_0x1b4ab9);}};exports[_0x8a19('0x25')]=function(_0x255f46){try{utils[_0x8a19('0x20')](util[_0x8a19('0x4')](_0x8a19('0x26'),_0x255f46[_0x8a19('0x6')]),_0x255f46);if(_0x255f46[_0x8a19('0x8')]){var _0x294597=_0x255f46[_0x8a19('0x8')][_0x8a19('0xf')]('-')[0x0];if(!_[_0x8a19('0x1c')](members[_0x294597])){members[_0x294597]=_[_0x8a19('0x24')](members[_0x294597],{'data1':members[_0x294597][_0x8a19('0x27')]||_0x255f46['type'],'data2':members[_0x294597][_0x8a19('0x28')]||_0x255f46[_0x8a19('0x29')],'data3':members[_0x294597][_0x8a19('0x2a')]||_0x255f46[_0x8a19('0x2b')],'uniqueid':members[_0x294597][_0x8a19('0x6')]||_0x255f46['uniqueid']});utils[_0x8a19('0x3')](util[_0x8a19('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x255f46[_0x8a19('0x6')],members[_0x294597][_0x8a19('0x27')],members[_0x294597][_0x8a19('0x28')],members[_0x294597][_0x8a19('0x2a')]));if(members[_0x294597][_0x8a19('0x1d')]){writeDB(members[_0x294597]);}}}if(_0x255f46[_0x8a19('0x2c')]){var _0x1f3e55=_0x255f46[_0x8a19('0x2c')][_0x8a19('0xf')]('-')[0x0];if(!_['isNil'](members[_0x1f3e55])){members[_0x1f3e55]=_[_0x8a19('0x24')](members[_0x1f3e55],{'data1':members[_0x1f3e55]['data1']||_0x255f46[_0x8a19('0x2d')],'data2':members[_0x1f3e55][_0x8a19('0x28')]||_0x255f46[_0x8a19('0x29')],'data3':members[_0x1f3e55][_0x8a19('0x2a')]||_0x255f46[_0x8a19('0x2b')],'uniqueid':members[_0x1f3e55][_0x8a19('0x6')]||_0x255f46[_0x8a19('0x6')]});utils[_0x8a19('0x3')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x255f46[_0x8a19('0x6')],members[_0x1f3e55][_0x8a19('0x27')],members[_0x1f3e55][_0x8a19('0x28')],members[_0x1f3e55][_0x8a19('0x2a')]));if(members[_0x1f3e55][_0x8a19('0x1d')]){writeDB(members[_0x1f3e55]);}}}}catch(_0x11e458){utils['error'](util['format']('[%s][members][cdr]',_0x255f46[_0x8a19('0x6')]),_0x11e458);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 508b60c..bdb7bee 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 _0x8b68=['info','position','assign','now','error','hangup','debug','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','isNil','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]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','queuecallerleaveAt','diffTime','queuecallerjoinAt','count','connectedlinenum','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','lastAssignedTo','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDED','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','musiconholdstartAt','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','calleridnum','accountcode','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','[%s][queues][queuecallerjoin]'];(function(_0x3b660b,_0x1430a9){var _0x4dcd4b=function(_0x1577c3){while(--_0x1577c3){_0x3b660b['push'](_0x3b660b['shift']());}};_0x4dcd4b(++_0x1430a9);}(_0x8b68,0xc2));var _0x88b6=function(_0x4c7726,_0x5cdb85){_0x4c7726=_0x4c7726-0x0;var _0x1056cd=_0x8b68[_0x4c7726];return _0x1056cd;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var queues={};function writeDB(_0x1a30cc){utils['info'](util[_0x88b6('0x0')](_0x88b6('0x1'),_0x1a30cc[_0x88b6('0x2')],_0x1a30cc[_0x88b6('0x3')],_0x1a30cc[_0x88b6('0x4')],_0x1a30cc['lastAssignedTo'],_0x1a30cc[_0x88b6('0x5')],_0x1a30cc[_0x88b6('0x6')],_0x1a30cc['queuecallerexitreason']));if(_0x1a30cc[_0x88b6('0x4')]){utils[_0x88b6('0x7')](_0x1a30cc[_0x88b6('0x4')])[_0x88b6('0x8')](function(_0x500291){if(_0x500291){_0x1a30cc[_0x88b6('0x9')]=_0x500291[_0x88b6('0x9')];}utils[_0x88b6('0xa')](_0x88b6('0xb'),_0x1a30cc);});}else{utils['request'](_0x88b6('0xb'),_0x1a30cc);}if(_0x1a30cc[_0x88b6('0xc')]){delete queues[_0x1a30cc[_0x88b6('0xc')]];}else{delete queues[_0x1a30cc[_0x88b6('0x2')]];}}exports['queuecallerjoin']=function(_0x32461f){try{utils['debug'](util['format'](_0x88b6('0xd'),_0x32461f[_0x88b6('0x2')]),_0x32461f);utils[_0x88b6('0xe')](util[_0x88b6('0x0')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x32461f[_0x88b6('0x2')],_0x32461f[_0x88b6('0x4')],_0x32461f[_0x88b6('0xf')]));queues[_0x32461f[_0x88b6('0x2')]]=_[_0x88b6('0x10')](_0x32461f,{'originalposition':_0x32461f[_0x88b6('0xf')],'queuecallerjoinAt':utils[_0x88b6('0x11')](),'mohtime':0x0});}catch(_0x48ef90){utils[_0x88b6('0x12')](util[_0x88b6('0x0')](_0x88b6('0xd'),_0x32461f['uniqueid']),_0x48ef90);}};exports[_0x88b6('0x13')]=function(_0x3acc8d){try{if(!_['isNil'](queues[_0x3acc8d[_0x88b6('0x2')]])){utils[_0x88b6('0x14')](util[_0x88b6('0x0')]('[%s][queues][hangup]',_0x3acc8d[_0x88b6('0x2')]),_0x3acc8d);if(queues[_0x3acc8d['uniqueid']]['queuecallerleaveAt']){if(!queues[_0x3acc8d[_0x88b6('0x2')]][_0x88b6('0x15')]&&!queues[_0x3acc8d['uniqueid']][_0x88b6('0x16')]){queues[_0x3acc8d['uniqueid']][_0x88b6('0x17')]=!![];queues[_0x3acc8d[_0x88b6('0x2')]]['queuecallercompleteAt']=utils[_0x88b6('0x11')]();queues[_0x3acc8d['uniqueid']][_0x88b6('0x18')]=_0x88b6('0x19');}utils[_0x88b6('0xe')](util[_0x88b6('0x0')](_0x88b6('0x1a'),_0x3acc8d[_0x88b6('0x2')],queues[_0x3acc8d['uniqueid']][_0x88b6('0x1b')],queues[_0x3acc8d[_0x88b6('0x2')]][_0x88b6('0x18')]));writeDB(queues[_0x3acc8d[_0x88b6('0x2')]]);}else if(queues[_0x3acc8d[_0x88b6('0x2')]][_0x88b6('0xc')]){utils[_0x88b6('0xe')](util[_0x88b6('0x0')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x3acc8d[_0x88b6('0x2')],queues[_0x3acc8d['uniqueid']]['name'],queues[_0x3acc8d[_0x88b6('0x2')]][_0x88b6('0xc')]));queues[queues[_0x3acc8d[_0x88b6('0x2')]][_0x88b6('0xc')]]=queues[_0x3acc8d[_0x88b6('0x2')]];queues[queues[_0x3acc8d[_0x88b6('0x2')]][_0x88b6('0xc')]][_0x88b6('0x1c')]=0x2;delete queues[_0x3acc8d[_0x88b6('0x2')]];}}}catch(_0x1021bf){utils[_0x88b6('0x12')](util['format']('[%s][queues][hangup]',_0x3acc8d[_0x88b6('0x2')]),_0x1021bf);}};exports[_0x88b6('0x1d')]=function(_0x183a0b){try{utils[_0x88b6('0x14')](util[_0x88b6('0x0')](_0x88b6('0x1e'),_0x183a0b['uniqueid']),_0x183a0b);if(!_['isNil'](_0x183a0b[_0x88b6('0x1f')][_0x88b6('0x20')])&&_0x183a0b[_0x88b6('0x21')][_0x88b6('0x22')]()!==_0x88b6('0x23')){if(!_[_0x88b6('0x24')](queues[_0x183a0b[_0x88b6('0x2')]])){queues[_0x183a0b[_0x88b6('0x2')]]['queuecallerabandon']=![];queues[_0x183a0b[_0x88b6('0x2')]][_0x88b6('0x25')]=null;queues[_0x183a0b[_0x88b6('0x2')]][_0x88b6('0x16')]=!![];queues[_0x183a0b[_0x88b6('0x2')]][_0x88b6('0x26')]=utils[_0x88b6('0x11')]();queues[_0x183a0b[_0x88b6('0x2')]][_0x88b6('0x18')]=_0x183a0b['value']['toUpperCase']();utils[_0x88b6('0xe')](util['format'](_0x88b6('0x27'),_0x183a0b['uniqueid'],queues[_0x183a0b['uniqueid']][_0x88b6('0x1b')],_0x183a0b['value'],queues[_0x183a0b[_0x88b6('0x2')]][_0x88b6('0x18')]));writeDB(queues[_0x183a0b[_0x88b6('0x2')]]);}}else if(!_['isNil'](_0x183a0b['variable'][_0x88b6('0x28')])){if(!_[_0x88b6('0x24')](queues[_0x183a0b[_0x88b6('0x2')]])&&!queues[_0x183a0b[_0x88b6('0x2')]][_0x88b6('0x15')]){queues[_0x183a0b[_0x88b6('0x2')]][_0x88b6('0x15')]=![];queues[_0x183a0b['uniqueid']][_0x88b6('0x25')]=null;queues[_0x183a0b[_0x88b6('0x2')]][_0x88b6('0x16')]=!![];queues[_0x183a0b['uniqueid']][_0x88b6('0x26')]=utils['now']();queues[_0x183a0b[_0x88b6('0x2')]][_0x88b6('0x18')]=_0x88b6('0x29');utils[_0x88b6('0xe')](util[_0x88b6('0x0')](_0x88b6('0x2a'),_0x183a0b[_0x88b6('0x2')],queues[_0x183a0b['uniqueid']]['name'],_0x183a0b[_0x88b6('0x21')],queues[_0x183a0b[_0x88b6('0x2')]][_0x88b6('0x18')]));}}}catch(_0x3b8cb6){utils[_0x88b6('0x12')](util['format'](_0x88b6('0x1e'),_0x183a0b[_0x88b6('0x2')]),_0x3b8cb6);}};exports['queuecallerabandon']=function(_0x4e4c1e){try{if(!_['isNil'](queues[_0x4e4c1e['uniqueid']])){utils['debug'](util['format'](_0x88b6('0x2b'),_0x4e4c1e[_0x88b6('0x2')]),_0x4e4c1e);queues[_0x4e4c1e[_0x88b6('0x2')]][_0x88b6('0x16')]=![];queues[_0x4e4c1e[_0x88b6('0x2')]][_0x88b6('0x26')]=null;queues[_0x4e4c1e[_0x88b6('0x2')]][_0x88b6('0x15')]=!![];queues[_0x4e4c1e[_0x88b6('0x2')]]['queuecallerabandonAt']=utils[_0x88b6('0x11')]();queues[_0x4e4c1e['uniqueid']][_0x88b6('0x18')]=_0x88b6('0x2c');utils[_0x88b6('0xe')](util[_0x88b6('0x0')](_0x88b6('0x2d'),_0x4e4c1e[_0x88b6('0x2')],queues[_0x4e4c1e[_0x88b6('0x2')]]['name'],queues[_0x4e4c1e['uniqueid']][_0x88b6('0x18')]));}}catch(_0x30b3e9){utils[_0x88b6('0x12')](util['format']('[%s][queues][queuecallerabandon]',_0x4e4c1e['uniqueid']),_0x30b3e9);}};exports['queuecallerleave']=function(_0x181d45){try{if(!_['isNil'](queues[_0x181d45['uniqueid']])){utils[_0x88b6('0x14')](util[_0x88b6('0x0')]('[%s][queues][queuecallerleave]',_0x181d45['uniqueid']),_0x181d45);utils[_0x88b6('0xe')](util['format'](_0x88b6('0x2e'),_0x181d45['uniqueid'],queues[_0x181d45['uniqueid']]['name'],_0x181d45['connectedlinenum'],_0x181d45[_0x88b6('0x2f')]));queues[_0x181d45['uniqueid']]['queuecallerleave']=!![];queues[_0x181d45[_0x88b6('0x2')]][_0x88b6('0x30')]=utils[_0x88b6('0x11')]();queues[_0x181d45[_0x88b6('0x2')]]['holdtime']=utils[_0x88b6('0x31')](queues[_0x181d45[_0x88b6('0x2')]][_0x88b6('0x30')],queues[_0x181d45[_0x88b6('0x2')]][_0x88b6('0x32')]);queues[_0x181d45[_0x88b6('0x2')]]['position']=_0x181d45[_0x88b6('0xf')];queues[_0x181d45[_0x88b6('0x2')]]['count']=_0x181d45[_0x88b6('0x33')];queues[_0x181d45[_0x88b6('0x2')]][_0x88b6('0x34')]=_0x181d45['connectedlinenum'];queues[_0x181d45['uniqueid']][_0x88b6('0x2f')]=_0x181d45[_0x88b6('0x2f')];}}catch(_0x1a5e76){utils[_0x88b6('0x12')](util['format'](_0x88b6('0x35'),_0x181d45[_0x88b6('0x2')]),_0x1a5e76);}};exports[_0x88b6('0x36')]=function(_0x47568d){try{if(!_['isNil'](queues[_0x47568d[_0x88b6('0x2')]])){utils[_0x88b6('0x14')](util['format'](_0x88b6('0x37'),_0x47568d[_0x88b6('0x2')]),_0x47568d);utils['info'](util[_0x88b6('0x0')](_0x88b6('0x38'),_0x47568d['uniqueid'],queues[_0x47568d['uniqueid']]['name'],_0x47568d[_0x88b6('0x39')],_0x47568d[_0x88b6('0x3a')]));queues[_0x47568d[_0x88b6('0x2')]][_0x88b6('0x15')]=![];queues[_0x47568d[_0x88b6('0x2')]][_0x88b6('0x15')]=![];queues[_0x47568d['uniqueid']][_0x88b6('0x25')]=null;queues[_0x47568d[_0x88b6('0x2')]][_0x88b6('0x16')]=![];queues[_0x47568d['uniqueid']]['queuecallerexitreason']=null;queues[_0x47568d[_0x88b6('0x2')]][_0x88b6('0x26')]=null;queues[_0x47568d[_0x88b6('0x2')]][_0x88b6('0x3b')]=!![];queues[_0x47568d[_0x88b6('0x2')]]['accountcode']=_0x47568d[_0x88b6('0x3a')];queues[_0x47568d['uniqueid']][_0x88b6('0x3c')]=_0x47568d[_0x88b6('0x39')];}}catch(_0x393364){utils[_0x88b6('0x12')](util[_0x88b6('0x0')](_0x88b6('0x37'),_0x47568d[_0x88b6('0x2')]),_0x393364);}};exports[_0x88b6('0x3d')]=function(_0x1465fa){try{if(!_[_0x88b6('0x24')](queues[_0x1465fa['uniqueid']])){if(queues[_0x1465fa[_0x88b6('0x2')]][_0x88b6('0x30')]){utils[_0x88b6('0x14')](util[_0x88b6('0x0')](_0x88b6('0x3e'),_0x1465fa[_0x88b6('0x2')]),_0x1465fa);queues[_0x1465fa[_0x88b6('0x2')]][_0x88b6('0x15')]=![];queues[_0x1465fa[_0x88b6('0x2')]][_0x88b6('0x15')]=![];queues[_0x1465fa[_0x88b6('0x2')]][_0x88b6('0x25')]=null;queues[_0x1465fa['uniqueid']][_0x88b6('0x16')]=![];queues[_0x1465fa['uniqueid']][_0x88b6('0x26')]=null;queues[_0x1465fa[_0x88b6('0x2')]][_0x88b6('0x3b')]=!![];queues[_0x1465fa[_0x88b6('0x2')]]['lastAssignedTo']=_0x1465fa['membername'];queues[_0x1465fa[_0x88b6('0x2')]][_0x88b6('0x17')]=!![];queues[_0x1465fa[_0x88b6('0x2')]]['queuecallercompleteAt']=utils['now']();if(_0x1465fa[_0x88b6('0x3f')]==_0x88b6('0x40')){if(!queues[_0x1465fa[_0x88b6('0x2')]][_0x88b6('0x40')]){queues[_0x1465fa['uniqueid']]['queuecallerexitreason']=_0x88b6('0x41');}}else{queues[_0x1465fa['uniqueid']][_0x88b6('0x18')]='COMPLETEDBY'+_0x1465fa[_0x88b6('0x3f')]['toUpperCase']();}utils['info'](util[_0x88b6('0x0')](_0x88b6('0x42'),_0x1465fa[_0x88b6('0x2')],queues[_0x1465fa[_0x88b6('0x2')]][_0x88b6('0x1b')],_0x1465fa[_0x88b6('0x39')],queues[_0x1465fa[_0x88b6('0x2')]]['queuecallerexitreason']));writeDB(queues[_0x1465fa[_0x88b6('0x2')]]);}}}catch(_0x2afcba){utils[_0x88b6('0x12')](util['format']('[%s][queues][agentcomplete]',_0x1465fa[_0x88b6('0x2')]),_0x2afcba);}};exports[_0x88b6('0x43')]=function(_0x42598d){try{if(!_[_0x88b6('0x24')](queues[_0x42598d[_0x88b6('0x44')]])){utils[_0x88b6('0x14')](util[_0x88b6('0x0')]('[%s][queues][blindtransfer]',_0x42598d[_0x88b6('0x2')]),_0x42598d);queues[_0x42598d[_0x88b6('0x44')]][_0x88b6('0x40')]=!![];queues[_0x42598d[_0x88b6('0x44')]][_0x88b6('0x45')]=_0x88b6('0x46');queues[_0x42598d[_0x88b6('0x44')]][_0x88b6('0x47')]=_0x42598d[_0x88b6('0x48')];queues[_0x42598d[_0x88b6('0x44')]][_0x88b6('0x49')]=_0x42598d[_0x88b6('0x44')];queues[_0x42598d[_0x88b6('0x44')]][_0x88b6('0x18')]=_0x88b6('0x4a');utils[_0x88b6('0xe')](util['format']('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x42598d[_0x88b6('0x2')],queues[_0x42598d[_0x88b6('0x44')]][_0x88b6('0x1b')],_0x42598d[_0x88b6('0x44')],_0x42598d[_0x88b6('0x48')]));}}catch(_0xfd0dd5){utils[_0x88b6('0x12')](util[_0x88b6('0x0')](_0x88b6('0x4b'),_0x42598d['uniqueid']),_0xfd0dd5);}};exports[_0x88b6('0x4c')]=function(_0x33da44){try{utils['debug'](util[_0x88b6('0x0')](_0x88b6('0x4d'),_0x33da44[_0x88b6('0x4e')]),_0x33da44);if(_0x33da44[_0x88b6('0x4e')]==_0x33da44[_0x88b6('0x4f')]){if(!_[_0x88b6('0x24')](queues[_0x33da44[_0x88b6('0x50')]])){utils[_0x88b6('0xe')](util['format'](_0x88b6('0x51'),_0x33da44[_0x88b6('0x4e')],queues[_0x33da44[_0x88b6('0x50')]][_0x88b6('0x1b')],_0x33da44[_0x88b6('0x52')]));queues[_0x33da44[_0x88b6('0x50')]][_0x88b6('0x40')]=!![];queues[_0x33da44[_0x88b6('0x50')]][_0x88b6('0x45')]='ATTENDED';queues[_0x33da44[_0x88b6('0x50')]][_0x88b6('0x47')]=_0x33da44[_0x88b6('0x52')];queues[_0x33da44[_0x88b6('0x50')]]['transferuniqueid']=_0x33da44['origtransfereruniqueid'];queues[_0x33da44[_0x88b6('0x50')]]['queuecallerexitreason']=_0x88b6('0x53');}if(!_['isNil'](queues[_0x33da44[_0x88b6('0x4f')]])){if(_0x33da44[_0x88b6('0x54')]&&queues[_0x33da44[_0x88b6('0x54')]]){queues[_0x33da44[_0x88b6('0x54')]][_0x88b6('0x1c')]=0x1;queues[_0x33da44[_0x88b6('0x44')]]=_[_0x88b6('0x55')](queues[_0x33da44[_0x88b6('0x54')]]);queues[_0x33da44[_0x88b6('0x44')]][_0x88b6('0xc')]=_0x33da44['transfertargetuniqueid'];queues[_0x33da44[_0x88b6('0x44')]][_0x88b6('0x1c')]=0x2;queues[_0x33da44[_0x88b6('0x44')]][_0x88b6('0x5')]=queues[_0x33da44['secondtransfererlinkedid']]['calleridnum'];queues[_0x33da44['transfereeuniqueid']][_0x88b6('0x56')]=queues[_0x33da44[_0x88b6('0x50')]][_0x88b6('0x56')];queues[_0x33da44[_0x88b6('0x44')]][_0x88b6('0x32')]=utils['now']();queues[_0x33da44[_0x88b6('0x44')]][_0x88b6('0x30')]=utils['now']();queues[_0x33da44[_0x88b6('0x44')]][_0x88b6('0x57')]=0x0;queues[_0x33da44['transfereeuniqueid']][_0x88b6('0x58')]=0x0;utils[_0x88b6('0xe')](util[_0x88b6('0x0')](_0x88b6('0x59'),_0x33da44[_0x88b6('0x4e')],queues[_0x33da44[_0x88b6('0x44')]][_0x88b6('0x1b')],queues[_0x33da44[_0x88b6('0x44')]][_0x88b6('0x5')],queues[_0x33da44[_0x88b6('0x44')]][_0x88b6('0x56')]));}else{utils[_0x88b6('0xe')](util['format'](_0x88b6('0x5a'),_0x33da44['origtransfereruniqueid'],queues[_0x33da44[_0x88b6('0x4f')]][_0x88b6('0x1b')],_0x33da44[_0x88b6('0x50')]));queues[_0x33da44['origtransfererlinkedid']]['transfereduniqueid']=_0x33da44['secondtransfererlinkedid'];}}}else if(_0x33da44[_0x88b6('0x5b')]==_0x33da44[_0x88b6('0x50')]){if(!_[_0x88b6('0x24')](queues[_0x33da44[_0x88b6('0x4f')]])){utils[_0x88b6('0xe')](util[_0x88b6('0x0')](_0x88b6('0x5c'),_0x33da44[_0x88b6('0x4e')],queues[_0x33da44[_0x88b6('0x4f')]][_0x88b6('0x1b')],_0x33da44[_0x88b6('0x5b')],_0x33da44[_0x88b6('0x5d')]));queues[_0x33da44[_0x88b6('0x4f')]][_0x88b6('0x40')]=!![];queues[_0x33da44[_0x88b6('0x4f')]]['transfertype']=_0x88b6('0x5e');queues[_0x33da44['origtransfererlinkedid']]['transferexten']=_0x33da44[_0x88b6('0x5d')];queues[_0x33da44[_0x88b6('0x4f')]]['transferuniqueid']=_0x33da44['secondtransfereruniqueid'];queues[_0x33da44[_0x88b6('0x4f')]][_0x88b6('0x18')]='ATTENDEDTRANSFER';}if(!_[_0x88b6('0x24')](queues[_0x33da44[_0x88b6('0x50')]])){if(_0x33da44['transfertargetlinkedid']&&queues[_0x33da44[_0x88b6('0x5f')]]){queues[_0x33da44[_0x88b6('0x5f')]]['queuecallerenterreason']=0x1;queues[_0x33da44[_0x88b6('0x60')]]=_[_0x88b6('0x55')](queues[_0x33da44[_0x88b6('0x5f')]]);queues[_0x33da44[_0x88b6('0x60')]][_0x88b6('0xc')]=_0x33da44[_0x88b6('0x60')];queues[_0x33da44[_0x88b6('0x60')]]['queuecallerenterreason']=0x2;queues[_0x33da44[_0x88b6('0x60')]][_0x88b6('0x5')]=queues[_0x33da44[_0x88b6('0x4f')]][_0x88b6('0x5')];queues[_0x33da44['transfertargetuniqueid']][_0x88b6('0x56')]=queues[_0x33da44[_0x88b6('0x4f')]][_0x88b6('0x56')];queues[_0x33da44[_0x88b6('0x60')]][_0x88b6('0x32')]=utils[_0x88b6('0x11')]();queues[_0x33da44[_0x88b6('0x60')]][_0x88b6('0x30')]=utils[_0x88b6('0x11')]();queues[_0x33da44[_0x88b6('0x60')]]['holdtime']=0x0;queues[_0x33da44[_0x88b6('0x60')]][_0x88b6('0x58')]=0x0;utils['info'](util['format'](_0x88b6('0x61'),_0x33da44[_0x88b6('0x4e')],queues[_0x33da44[_0x88b6('0x60')]][_0x88b6('0x1b')],queues[_0x33da44[_0x88b6('0x60')]]['transfereduniqueid'],queues[_0x33da44['transfertargetuniqueid']]['calleridnum'],queues[_0x33da44[_0x88b6('0x60')]]['calleridname']));}else{utils[_0x88b6('0xe')](util[_0x88b6('0x0')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x33da44[_0x88b6('0x4e')],queues[_0x33da44[_0x88b6('0x50')]][_0x88b6('0x1b')],_0x33da44[_0x88b6('0x4f')]));queues[_0x33da44[_0x88b6('0x50')]]['transfereduniqueid']=_0x33da44[_0x88b6('0x4f')];}}}}catch(_0x17aa69){utils['error'](util['format'](_0x88b6('0x4d'),_0x33da44[_0x88b6('0x4e')]),_0x17aa69);}};exports['musiconholdstart']=function(_0x3a8786){try{if(!_[_0x88b6('0x24')](queues[_0x3a8786[_0x88b6('0x2')]])){utils[_0x88b6('0x14')](util['format'](_0x88b6('0x62'),_0x3a8786[_0x88b6('0x2')]),_0x3a8786);queues[_0x3a8786[_0x88b6('0x2')]]['musiconholdstartAt']=utils[_0x88b6('0x11')]();utils[_0x88b6('0xe')](util[_0x88b6('0x0')](_0x88b6('0x63'),_0x3a8786['uniqueid'],queues[_0x3a8786[_0x88b6('0x2')]]['name'],queues[_0x3a8786[_0x88b6('0x2')]]['musiconholdstartAt']));}}catch(_0x20c243){utils[_0x88b6('0x12')](util[_0x88b6('0x0')](_0x88b6('0x62'),_0x3a8786[_0x88b6('0x2')]),_0x20c243);}};exports[_0x88b6('0x64')]=function(_0x534c10){try{if(!_['isNil'](queues[_0x534c10['uniqueid']])){if(!_['isNil'](queues[_0x534c10[_0x88b6('0x2')]][_0x88b6('0x65')])){utils[_0x88b6('0x14')](util[_0x88b6('0x0')](_0x88b6('0x66'),_0x534c10[_0x88b6('0x2')]),_0x534c10);queues[_0x534c10[_0x88b6('0x2')]]['mohtime']+=utils['diffTime'](utils['now'](),queues[_0x534c10[_0x88b6('0x2')]][_0x88b6('0x65')]);utils['info'](util[_0x88b6('0x0')](_0x88b6('0x67'),_0x534c10[_0x88b6('0x2')],queues[_0x534c10['uniqueid']][_0x88b6('0x1b')],queues[_0x534c10['uniqueid']][_0x88b6('0x58')]));delete queues[_0x534c10['uniqueid']]['musiconholdstartAt'];}}}catch(_0x1bf7ca){utils['error'](util['format']('[%s][queues][musiconholdstop]',_0x534c10[_0x88b6('0x2')]),_0x1bf7ca);}}; \ No newline at end of file +var _0x8364=['util','./utils','info','format','uniqueid','channel','queue','queuecallerexitreason','then','type','request','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','assign','position','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][varset]','queuestatus','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','accountcode','lastAssignedTo','agentcomplete','reason','transfer','toUpperCase','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','extension','transferuniqueid','BLINDTRANSFER','attendedtransfer','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfereruniqueid','origtransfererexten','ATTENDED','transfereelinkedid','clone','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transferexten','ATTENDEDTRANSFER','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8364,0xc0));var _0x4836=function(_0x107179,_0x46e138){_0x107179=_0x107179-0x0;var _0x31f40e=_0x8364[_0x107179];return _0x31f40e;};'use strict';var _=require('lodash');var util=require(_0x4836('0x0'));var utils=require(_0x4836('0x1'));var queues={};function writeDB(_0x2afc5d){utils[_0x4836('0x2')](util[_0x4836('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x2afc5d[_0x4836('0x4')],_0x2afc5d[_0x4836('0x5')],_0x2afc5d[_0x4836('0x6')],_0x2afc5d['lastAssignedTo'],_0x2afc5d['calleridnum'],_0x2afc5d['accountcode'],_0x2afc5d[_0x4836('0x7')]));if(_0x2afc5d[_0x4836('0x6')]){utils['getVoiceQueueByName'](_0x2afc5d['queue'])[_0x4836('0x8')](function(_0x4bff0e){if(_0x4bff0e){_0x2afc5d['type']=_0x4bff0e[_0x4836('0x9')];}utils['request']('CreateVoiceQueueReport',_0x2afc5d);});}else{utils[_0x4836('0xa')]('CreateVoiceQueueReport',_0x2afc5d);}if(_0x2afc5d['transfereduniqueid']){delete queues[_0x2afc5d[_0x4836('0xb')]];}else{delete queues[_0x2afc5d[_0x4836('0x4')]];}}exports[_0x4836('0xc')]=function(_0x4f1b0d){try{utils[_0x4836('0xd')](util[_0x4836('0x3')](_0x4836('0xe'),_0x4f1b0d['uniqueid']),_0x4f1b0d);utils[_0x4836('0x2')](util['format']('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x4f1b0d[_0x4836('0x4')],_0x4f1b0d[_0x4836('0x6')],_0x4f1b0d['position']));queues[_0x4f1b0d[_0x4836('0x4')]]=_[_0x4836('0xf')](_0x4f1b0d,{'originalposition':_0x4f1b0d[_0x4836('0x10')],'queuecallerjoinAt':utils[_0x4836('0x11')](),'mohtime':0x0});}catch(_0x547770){utils[_0x4836('0x12')](util[_0x4836('0x3')]('[%s][queues][queuecallerjoin]',_0x4f1b0d['uniqueid']),_0x547770);}};exports[_0x4836('0x13')]=function(_0x32b31e){try{if(!_[_0x4836('0x14')](queues[_0x32b31e[_0x4836('0x4')]])){utils[_0x4836('0xd')](util[_0x4836('0x3')](_0x4836('0x15'),_0x32b31e['uniqueid']),_0x32b31e);if(queues[_0x32b31e[_0x4836('0x4')]][_0x4836('0x16')]){if(!queues[_0x32b31e[_0x4836('0x4')]]['queuecallerabandon']&&!queues[_0x32b31e[_0x4836('0x4')]][_0x4836('0x17')]){queues[_0x32b31e[_0x4836('0x4')]][_0x4836('0x18')]=!![];queues[_0x32b31e[_0x4836('0x4')]][_0x4836('0x19')]=utils[_0x4836('0x11')]();queues[_0x32b31e[_0x4836('0x4')]][_0x4836('0x7')]=_0x4836('0x1a');}utils[_0x4836('0x2')](util[_0x4836('0x3')](_0x4836('0x1b'),_0x32b31e[_0x4836('0x4')],queues[_0x32b31e['uniqueid']][_0x4836('0x1c')],queues[_0x32b31e[_0x4836('0x4')]][_0x4836('0x7')]));writeDB(queues[_0x32b31e[_0x4836('0x4')]]);}else if(queues[_0x32b31e['uniqueid']]['transfereduniqueid']){utils[_0x4836('0x2')](util[_0x4836('0x3')](_0x4836('0x1d'),_0x32b31e['uniqueid'],queues[_0x32b31e[_0x4836('0x4')]][_0x4836('0x1c')],queues[_0x32b31e[_0x4836('0x4')]][_0x4836('0xb')]));queues[queues[_0x32b31e[_0x4836('0x4')]][_0x4836('0xb')]]=queues[_0x32b31e[_0x4836('0x4')]];queues[queues[_0x32b31e[_0x4836('0x4')]]['transfereduniqueid']][_0x4836('0x1e')]=0x2;delete queues[_0x32b31e[_0x4836('0x4')]];}}}catch(_0x22c4f7){utils[_0x4836('0x12')](util['format']('[%s][queues][hangup]',_0x32b31e[_0x4836('0x4')]),_0x22c4f7);}};exports['varset']=function(_0x249d5c){try{utils[_0x4836('0xd')](util[_0x4836('0x3')](_0x4836('0x1f'),_0x249d5c[_0x4836('0x4')]),_0x249d5c);if(!_[_0x4836('0x14')](_0x249d5c['variable'][_0x4836('0x20')])&&_0x249d5c['value']['toUpperCase']()!==_0x4836('0x21')){if(!_[_0x4836('0x14')](queues[_0x249d5c[_0x4836('0x4')]])){queues[_0x249d5c[_0x4836('0x4')]][_0x4836('0x22')]=![];queues[_0x249d5c[_0x4836('0x4')]][_0x4836('0x23')]=null;queues[_0x249d5c[_0x4836('0x4')]][_0x4836('0x17')]=!![];queues[_0x249d5c[_0x4836('0x4')]][_0x4836('0x24')]=utils[_0x4836('0x11')]();queues[_0x249d5c['uniqueid']][_0x4836('0x7')]=_0x249d5c[_0x4836('0x25')]['toUpperCase']();utils[_0x4836('0x2')](util[_0x4836('0x3')](_0x4836('0x26'),_0x249d5c[_0x4836('0x4')],queues[_0x249d5c['uniqueid']][_0x4836('0x1c')],_0x249d5c['value'],queues[_0x249d5c['uniqueid']][_0x4836('0x7')]));writeDB(queues[_0x249d5c[_0x4836('0x4')]]);}}else if(!_[_0x4836('0x14')](_0x249d5c['variable']['queueposition'])){if(!_[_0x4836('0x14')](queues[_0x249d5c['uniqueid']])&&!queues[_0x249d5c[_0x4836('0x4')]][_0x4836('0x22')]){queues[_0x249d5c[_0x4836('0x4')]][_0x4836('0x22')]=![];queues[_0x249d5c[_0x4836('0x4')]][_0x4836('0x23')]=null;queues[_0x249d5c[_0x4836('0x4')]]['queuecallerexit']=!![];queues[_0x249d5c[_0x4836('0x4')]][_0x4836('0x24')]=utils['now']();queues[_0x249d5c[_0x4836('0x4')]][_0x4836('0x7')]='EXITWITHKEY';utils[_0x4836('0x2')](util[_0x4836('0x3')](_0x4836('0x27'),_0x249d5c[_0x4836('0x4')],queues[_0x249d5c[_0x4836('0x4')]][_0x4836('0x1c')],_0x249d5c[_0x4836('0x25')],queues[_0x249d5c[_0x4836('0x4')]][_0x4836('0x7')]));}}}catch(_0x5f4eca){utils[_0x4836('0x12')](util[_0x4836('0x3')](_0x4836('0x1f'),_0x249d5c[_0x4836('0x4')]),_0x5f4eca);}};exports[_0x4836('0x22')]=function(_0x527a6d){try{if(!_[_0x4836('0x14')](queues[_0x527a6d[_0x4836('0x4')]])){utils[_0x4836('0xd')](util[_0x4836('0x3')]('[%s][queues][queuecallerabandon]',_0x527a6d[_0x4836('0x4')]),_0x527a6d);queues[_0x527a6d[_0x4836('0x4')]]['queuecallerexit']=![];queues[_0x527a6d[_0x4836('0x4')]][_0x4836('0x24')]=null;queues[_0x527a6d[_0x4836('0x4')]][_0x4836('0x22')]=!![];queues[_0x527a6d[_0x4836('0x4')]][_0x4836('0x23')]=utils[_0x4836('0x11')]();queues[_0x527a6d[_0x4836('0x4')]][_0x4836('0x7')]='ABANDONED';utils[_0x4836('0x2')](util['format']('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x527a6d['uniqueid'],queues[_0x527a6d[_0x4836('0x4')]][_0x4836('0x1c')],queues[_0x527a6d['uniqueid']][_0x4836('0x7')]));}}catch(_0x3361e0){utils['error'](util[_0x4836('0x3')](_0x4836('0x28'),_0x527a6d[_0x4836('0x4')]),_0x3361e0);}};exports[_0x4836('0x29')]=function(_0x4d9bdc){try{if(!_[_0x4836('0x14')](queues[_0x4d9bdc[_0x4836('0x4')]])){utils['debug'](util[_0x4836('0x3')](_0x4836('0x2a'),_0x4d9bdc[_0x4836('0x4')]),_0x4d9bdc);utils['info'](util[_0x4836('0x3')](_0x4836('0x2b'),_0x4d9bdc[_0x4836('0x4')],queues[_0x4d9bdc[_0x4836('0x4')]][_0x4836('0x1c')],_0x4d9bdc[_0x4836('0x2c')],_0x4d9bdc[_0x4836('0x2d')]));queues[_0x4d9bdc['uniqueid']]['queuecallerleave']=!![];queues[_0x4d9bdc[_0x4836('0x4')]]['queuecallerleaveAt']=utils[_0x4836('0x11')]();queues[_0x4d9bdc[_0x4836('0x4')]][_0x4836('0x2e')]=utils[_0x4836('0x2f')](queues[_0x4d9bdc['uniqueid']]['queuecallerleaveAt'],queues[_0x4d9bdc[_0x4836('0x4')]][_0x4836('0x30')]);queues[_0x4d9bdc['uniqueid']][_0x4836('0x10')]=_0x4d9bdc[_0x4836('0x10')];queues[_0x4d9bdc[_0x4836('0x4')]]['count']=_0x4d9bdc[_0x4836('0x31')];queues[_0x4d9bdc['uniqueid']]['connectedlinenum']=_0x4d9bdc[_0x4836('0x2c')];queues[_0x4d9bdc[_0x4836('0x4')]]['connectedlinename']=_0x4d9bdc[_0x4836('0x2d')];}}catch(_0x3ac1bc){utils[_0x4836('0x12')](util[_0x4836('0x3')](_0x4836('0x2a'),_0x4d9bdc[_0x4836('0x4')]),_0x3ac1bc);}};exports['agentconnect']=function(_0x35388c){try{if(!_[_0x4836('0x14')](queues[_0x35388c['uniqueid']])){utils['debug'](util[_0x4836('0x3')](_0x4836('0x32'),_0x35388c['uniqueid']),_0x35388c);utils[_0x4836('0x2')](util[_0x4836('0x3')](_0x4836('0x33'),_0x35388c[_0x4836('0x4')],queues[_0x35388c[_0x4836('0x4')]]['name'],_0x35388c[_0x4836('0x34')],_0x35388c['destaccountcode']));queues[_0x35388c[_0x4836('0x4')]]['queuecallerabandon']=![];queues[_0x35388c[_0x4836('0x4')]][_0x4836('0x22')]=![];queues[_0x35388c[_0x4836('0x4')]][_0x4836('0x23')]=null;queues[_0x35388c['uniqueid']][_0x4836('0x17')]=![];queues[_0x35388c[_0x4836('0x4')]][_0x4836('0x7')]=null;queues[_0x35388c['uniqueid']][_0x4836('0x24')]=null;queues[_0x35388c['uniqueid']][_0x4836('0x35')]=!![];queues[_0x35388c[_0x4836('0x4')]][_0x4836('0x36')]=_0x35388c['destaccountcode'];queues[_0x35388c[_0x4836('0x4')]][_0x4836('0x37')]=_0x35388c[_0x4836('0x34')];}}catch(_0x455bd1){utils[_0x4836('0x12')](util['format']('[%s][queues][agentconnect]',_0x35388c[_0x4836('0x4')]),_0x455bd1);}};exports[_0x4836('0x38')]=function(_0x27309f){try{if(!_[_0x4836('0x14')](queues[_0x27309f[_0x4836('0x4')]])){if(queues[_0x27309f[_0x4836('0x4')]][_0x4836('0x16')]){utils[_0x4836('0xd')](util['format']('[%s][queues][agentcomplete]',_0x27309f[_0x4836('0x4')]),_0x27309f);queues[_0x27309f[_0x4836('0x4')]][_0x4836('0x22')]=![];queues[_0x27309f[_0x4836('0x4')]]['queuecallerabandon']=![];queues[_0x27309f[_0x4836('0x4')]]['queuecallerabandonAt']=null;queues[_0x27309f['uniqueid']]['queuecallerexit']=![];queues[_0x27309f[_0x4836('0x4')]][_0x4836('0x24')]=null;queues[_0x27309f['uniqueid']][_0x4836('0x35')]=!![];queues[_0x27309f[_0x4836('0x4')]][_0x4836('0x37')]=_0x27309f[_0x4836('0x34')];queues[_0x27309f[_0x4836('0x4')]][_0x4836('0x18')]=!![];queues[_0x27309f[_0x4836('0x4')]][_0x4836('0x19')]=utils[_0x4836('0x11')]();if(_0x27309f[_0x4836('0x39')]=='transfer'){if(!queues[_0x27309f[_0x4836('0x4')]][_0x4836('0x3a')]){queues[_0x27309f['uniqueid']][_0x4836('0x7')]='TRANSFER';}}else{queues[_0x27309f[_0x4836('0x4')]][_0x4836('0x7')]='COMPLETEDBY'+_0x27309f[_0x4836('0x39')][_0x4836('0x3b')]();}utils[_0x4836('0x2')](util[_0x4836('0x3')](_0x4836('0x3c'),_0x27309f[_0x4836('0x4')],queues[_0x27309f[_0x4836('0x4')]][_0x4836('0x1c')],_0x27309f[_0x4836('0x34')],queues[_0x27309f['uniqueid']][_0x4836('0x7')]));writeDB(queues[_0x27309f[_0x4836('0x4')]]);}}}catch(_0x423bc0){utils[_0x4836('0x12')](util[_0x4836('0x3')](_0x4836('0x3d'),_0x27309f[_0x4836('0x4')]),_0x423bc0);}};exports['blindtransfer']=function(_0x1c2b5e){try{if(!_['isNil'](queues[_0x1c2b5e[_0x4836('0x3e')]])){utils[_0x4836('0xd')](util[_0x4836('0x3')](_0x4836('0x3f'),_0x1c2b5e[_0x4836('0x4')]),_0x1c2b5e);queues[_0x1c2b5e['transfereeuniqueid']]['transfer']=!![];queues[_0x1c2b5e[_0x4836('0x3e')]][_0x4836('0x40')]='BLIND';queues[_0x1c2b5e[_0x4836('0x3e')]]['transferexten']=_0x1c2b5e[_0x4836('0x41')];queues[_0x1c2b5e[_0x4836('0x3e')]][_0x4836('0x42')]=_0x1c2b5e['transfereeuniqueid'];queues[_0x1c2b5e['transfereeuniqueid']][_0x4836('0x7')]=_0x4836('0x43');utils['info'](util[_0x4836('0x3')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x1c2b5e[_0x4836('0x4')],queues[_0x1c2b5e[_0x4836('0x3e')]][_0x4836('0x1c')],_0x1c2b5e[_0x4836('0x3e')],_0x1c2b5e['extension']));}}catch(_0x4f999c){utils[_0x4836('0x12')](util[_0x4836('0x3')](_0x4836('0x3f'),_0x1c2b5e['uniqueid']),_0x4f999c);}};exports[_0x4836('0x44')]=function(_0x44c746){try{utils['debug'](util[_0x4836('0x3')]('[%s][queues][attendedtransfer]',_0x44c746['origtransfereruniqueid']),_0x44c746);if(_0x44c746['origtransfereruniqueid']==_0x44c746[_0x4836('0x45')]){if(!_['isNil'](queues[_0x44c746[_0x4836('0x46')]])){utils[_0x4836('0x2')](util[_0x4836('0x3')](_0x4836('0x47'),_0x44c746[_0x4836('0x48')],queues[_0x44c746['secondtransfererlinkedid']]['name'],_0x44c746[_0x4836('0x49')]));queues[_0x44c746[_0x4836('0x46')]][_0x4836('0x3a')]=!![];queues[_0x44c746['secondtransfererlinkedid']][_0x4836('0x40')]=_0x4836('0x4a');queues[_0x44c746['secondtransfererlinkedid']]['transferexten']=_0x44c746[_0x4836('0x49')];queues[_0x44c746[_0x4836('0x46')]][_0x4836('0x42')]=_0x44c746[_0x4836('0x48')];queues[_0x44c746[_0x4836('0x46')]][_0x4836('0x7')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x44c746['origtransfererlinkedid']])){if(_0x44c746[_0x4836('0x4b')]&&queues[_0x44c746[_0x4836('0x4b')]]){queues[_0x44c746[_0x4836('0x4b')]][_0x4836('0x1e')]=0x1;queues[_0x44c746[_0x4836('0x3e')]]=_[_0x4836('0x4c')](queues[_0x44c746['transfereelinkedid']]);queues[_0x44c746['transfereeuniqueid']][_0x4836('0xb')]=_0x44c746['transfertargetuniqueid'];queues[_0x44c746[_0x4836('0x3e')]]['queuecallerenterreason']=0x2;queues[_0x44c746[_0x4836('0x3e')]][_0x4836('0x4d')]=queues[_0x44c746[_0x4836('0x46')]][_0x4836('0x4d')];queues[_0x44c746['transfereeuniqueid']][_0x4836('0x4e')]=queues[_0x44c746['secondtransfererlinkedid']][_0x4836('0x4e')];queues[_0x44c746[_0x4836('0x3e')]][_0x4836('0x30')]=utils[_0x4836('0x11')]();queues[_0x44c746[_0x4836('0x3e')]][_0x4836('0x16')]=utils['now']();queues[_0x44c746[_0x4836('0x3e')]][_0x4836('0x2e')]=0x0;queues[_0x44c746[_0x4836('0x3e')]][_0x4836('0x4f')]=0x0;utils[_0x4836('0x2')](util[_0x4836('0x3')](_0x4836('0x50'),_0x44c746[_0x4836('0x48')],queues[_0x44c746['transfereeuniqueid']][_0x4836('0x1c')],queues[_0x44c746['transfereeuniqueid']][_0x4836('0x4d')],queues[_0x44c746['transfereeuniqueid']][_0x4836('0x4e')]));}else{utils[_0x4836('0x2')](util['format'](_0x4836('0x51'),_0x44c746[_0x4836('0x48')],queues[_0x44c746['origtransfererlinkedid']]['name'],_0x44c746[_0x4836('0x46')]));queues[_0x44c746[_0x4836('0x45')]][_0x4836('0xb')]=_0x44c746[_0x4836('0x46')];}}}else if(_0x44c746['secondtransfereruniqueid']==_0x44c746[_0x4836('0x46')]){if(!_[_0x4836('0x14')](queues[_0x44c746[_0x4836('0x45')]])){utils[_0x4836('0x2')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x44c746[_0x4836('0x48')],queues[_0x44c746[_0x4836('0x45')]]['name'],_0x44c746[_0x4836('0x52')],_0x44c746[_0x4836('0x53')]));queues[_0x44c746[_0x4836('0x45')]][_0x4836('0x3a')]=!![];queues[_0x44c746['origtransfererlinkedid']][_0x4836('0x40')]=_0x4836('0x4a');queues[_0x44c746['origtransfererlinkedid']][_0x4836('0x54')]=_0x44c746[_0x4836('0x53')];queues[_0x44c746[_0x4836('0x45')]][_0x4836('0x42')]=_0x44c746[_0x4836('0x52')];queues[_0x44c746[_0x4836('0x45')]][_0x4836('0x7')]=_0x4836('0x55');}if(!_[_0x4836('0x14')](queues[_0x44c746[_0x4836('0x46')]])){if(_0x44c746[_0x4836('0x56')]&&queues[_0x44c746[_0x4836('0x56')]]){queues[_0x44c746['transfertargetlinkedid']][_0x4836('0x1e')]=0x1;queues[_0x44c746['transfertargetuniqueid']]=_['clone'](queues[_0x44c746[_0x4836('0x56')]]);queues[_0x44c746[_0x4836('0x57')]][_0x4836('0xb')]=_0x44c746['transfertargetuniqueid'];queues[_0x44c746['transfertargetuniqueid']][_0x4836('0x1e')]=0x2;queues[_0x44c746['transfertargetuniqueid']][_0x4836('0x4d')]=queues[_0x44c746[_0x4836('0x45')]]['calleridnum'];queues[_0x44c746['transfertargetuniqueid']][_0x4836('0x4e')]=queues[_0x44c746[_0x4836('0x45')]][_0x4836('0x4e')];queues[_0x44c746['transfertargetuniqueid']][_0x4836('0x30')]=utils[_0x4836('0x11')]();queues[_0x44c746['transfertargetuniqueid']][_0x4836('0x16')]=utils[_0x4836('0x11')]();queues[_0x44c746[_0x4836('0x57')]]['holdtime']=0x0;queues[_0x44c746[_0x4836('0x57')]][_0x4836('0x4f')]=0x0;utils['info'](util['format'](_0x4836('0x58'),_0x44c746[_0x4836('0x48')],queues[_0x44c746['transfertargetuniqueid']]['name'],queues[_0x44c746[_0x4836('0x57')]]['transfereduniqueid'],queues[_0x44c746[_0x4836('0x57')]][_0x4836('0x4d')],queues[_0x44c746[_0x4836('0x57')]][_0x4836('0x4e')]));}else{utils[_0x4836('0x2')](util[_0x4836('0x3')](_0x4836('0x51'),_0x44c746[_0x4836('0x48')],queues[_0x44c746[_0x4836('0x46')]][_0x4836('0x1c')],_0x44c746[_0x4836('0x45')]));queues[_0x44c746[_0x4836('0x46')]]['transfereduniqueid']=_0x44c746[_0x4836('0x45')];}}}}catch(_0xc32062){utils[_0x4836('0x12')](util[_0x4836('0x3')](_0x4836('0x59'),_0x44c746['origtransfereruniqueid']),_0xc32062);}};exports[_0x4836('0x5a')]=function(_0x29d64d){try{if(!_['isNil'](queues[_0x29d64d['uniqueid']])){utils[_0x4836('0xd')](util['format'](_0x4836('0x5b'),_0x29d64d[_0x4836('0x4')]),_0x29d64d);queues[_0x29d64d[_0x4836('0x4')]][_0x4836('0x5c')]=utils['now']();utils[_0x4836('0x2')](util['format'](_0x4836('0x5d'),_0x29d64d[_0x4836('0x4')],queues[_0x29d64d[_0x4836('0x4')]][_0x4836('0x1c')],queues[_0x29d64d[_0x4836('0x4')]]['musiconholdstartAt']));}}catch(_0x3b9ae1){utils[_0x4836('0x12')](util[_0x4836('0x3')](_0x4836('0x5b'),_0x29d64d['uniqueid']),_0x3b9ae1);}};exports[_0x4836('0x5e')]=function(_0x56dac7){try{if(!_[_0x4836('0x14')](queues[_0x56dac7['uniqueid']])){if(!_['isNil'](queues[_0x56dac7[_0x4836('0x4')]]['musiconholdstartAt'])){utils[_0x4836('0xd')](util[_0x4836('0x3')]('[%s][queues][musiconholdstop]',_0x56dac7[_0x4836('0x4')]),_0x56dac7);queues[_0x56dac7[_0x4836('0x4')]]['mohtime']+=utils['diffTime'](utils['now'](),queues[_0x56dac7[_0x4836('0x4')]][_0x4836('0x5c')]);utils[_0x4836('0x2')](util[_0x4836('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x56dac7[_0x4836('0x4')],queues[_0x56dac7[_0x4836('0x4')]]['name'],queues[_0x56dac7[_0x4836('0x4')]]['mohtime']));delete queues[_0x56dac7['uniqueid']][_0x4836('0x5c')];}}}catch(_0x4b0b1f){utils[_0x4836('0x12')](util['format'](_0x4836('0x5f'),_0x56dac7[_0x4836('0x4')]),_0x4b0b1f);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index f74c1e4..fc243d7 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 _0xfd46=['uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','membername','name','UserId','request','newchannel','debug','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','.WAV','find','monitors','push','[%s][recordings][varset]','hangup','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','forEach','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','blindtransfer','[%s][recordings][blindtransfer]','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','util','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xfd46,0x129));var _0x6fd4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xfd46[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x6fd4('0x0'));var util=require(_0x6fd4('0x1'));var utils=require(_0x6fd4('0x2'));var transfers=require(_0x6fd4('0x3'));var recordings={};function writeDB(_0x2055c7){var _0x187050;utils[_0x6fd4('0x4')](util[_0x6fd4('0x5')](_0x6fd4('0x6'),_0x2055c7[_0x6fd4('0x7')]));if(transfers['blinds'][_0x2055c7[_0x6fd4('0x7')]]){_0x187050=_0x2055c7[_0x6fd4('0x7')];_0x2055c7[_0x6fd4('0x7')]=transfers[_0x6fd4('0x8')][_0x2055c7[_0x6fd4('0x7')]][_0x6fd4('0x9')];}if(_0x2055c7[_0x6fd4('0xa')]){utils[_0x6fd4('0xb')](_0x2055c7['accountcode'])['then'](function(_0x36adad){if(_0x36adad){_0x2055c7[_0x6fd4('0xc')]=_0x36adad[_0x6fd4('0xd')];_0x2055c7[_0x6fd4('0xe')]=_0x36adad['id'];}utils[_0x6fd4('0xf')]('CreateVoiceRecording',_0x2055c7);});}else{utils[_0x6fd4('0xf')]('CreateVoiceRecording',_0x2055c7);}if(_0x187050)delete transfers[_0x6fd4('0x8')][_0x187050];}exports[_0x6fd4('0x10')]=function(_0x5c5282){try{utils[_0x6fd4('0x11')](util['format']('[%s][recordings][newchannel]',_0x5c5282[_0x6fd4('0x7')]),_0x5c5282);if(_0x5c5282[_0x6fd4('0x7')]==_0x5c5282[_0x6fd4('0x12')]){utils[_0x6fd4('0x4')](util[_0x6fd4('0x5')](_0x6fd4('0x13'),_0x5c5282[_0x6fd4('0x7')],_0x5c5282[_0x6fd4('0x14')],_0x5c5282[_0x6fd4('0x15')]));recordings[_0x5c5282[_0x6fd4('0x7')]]={'uniqueid':_0x5c5282['uniqueid'],'accountcode':_0x5c5282['accountcode'],'exten':_0x5c5282[_0x6fd4('0x15')],'context':_0x5c5282[_0x6fd4('0x14')],'channel':_0x5c5282[_0x6fd4('0x16')],'monitors':[]};}}catch(_0x4427da){utils[_0x6fd4('0x17')](util[_0x6fd4('0x5')](_0x6fd4('0x18'),_0x5c5282['uniqueid']),_0x4427da);}};exports[_0x6fd4('0x19')]=function(_0x1d8b22){try{utils[_0x6fd4('0x11')](util[_0x6fd4('0x5')](_0x6fd4('0x1a'),_0x1d8b22[_0x6fd4('0x7')]),_0x1d8b22);if(!_[_0x6fd4('0x1b')](recordings[_0x1d8b22[_0x6fd4('0x7')]])&&_0x1d8b22[_0x6fd4('0x1c')]==0x6){utils[_0x6fd4('0x4')](util['format'](_0x6fd4('0x1d'),_0x1d8b22[_0x6fd4('0x7')],_0x1d8b22['context'],_0x1d8b22['channel']));}else if(!_[_0x6fd4('0x1b')](recordings[_0x1d8b22[_0x6fd4('0x12')]])&&_0x1d8b22[_0x6fd4('0x1c')]==0x6&&_0x1d8b22['context']!=_0x6fd4('0x1e')){utils[_0x6fd4('0x4')](util[_0x6fd4('0x5')](_0x6fd4('0x1f'),_0x1d8b22[_0x6fd4('0x7')],_0x1d8b22['linkedid'],_0x1d8b22[_0x6fd4('0x14')],_0x1d8b22[_0x6fd4('0x16')]));recordings[_0x1d8b22[_0x6fd4('0x12')]][_0x6fd4('0xa')]=_0x1d8b22[_0x6fd4('0xa')];}}catch(_0x157a85){utils['error'](util['format'](_0x6fd4('0x1a'),_0x1d8b22[_0x6fd4('0x7')]),_0x157a85);}};exports['varset']=function(_0x23050a){try{if(!_[_0x6fd4('0x1b')](_0x23050a[_0x6fd4('0x20')])&&!_[_0x6fd4('0x1b')](_0x23050a['variable'][_0x6fd4('0x21')])){utils[_0x6fd4('0x11')](util[_0x6fd4('0x5')]('[%s][recordings][varset]',_0x23050a[_0x6fd4('0x7')]),_0x23050a);utils[_0x6fd4('0x4')](util[_0x6fd4('0x5')](_0x6fd4('0x22'),_0x23050a[_0x6fd4('0x7')],_0x23050a[_0x6fd4('0x20')],_0x23050a[_0x6fd4('0x23')]));if(_[_0x6fd4('0x24')](_0x23050a[_0x6fd4('0x23')],'.wav49')){_0x23050a[_0x6fd4('0x23')]=_0x23050a[_0x6fd4('0x23')][_0x6fd4('0x25')]('.wav49',_0x6fd4('0x26'));}if(recordings[_0x23050a[_0x6fd4('0x12')]]){var _0x352fc4=_[_0x6fd4('0x27')](recordings[_0x23050a[_0x6fd4('0x12')]][_0x6fd4('0x28')],{'value':_0x23050a[_0x6fd4('0x23')]});if(_[_0x6fd4('0x1b')](_0x352fc4)){recordings[_0x23050a[_0x6fd4('0x12')]][_0x6fd4('0x28')][_0x6fd4('0x29')]({'value':_0x23050a[_0x6fd4('0x23')]});}}}}catch(_0x526a7e){utils[_0x6fd4('0x17')](util[_0x6fd4('0x5')](_0x6fd4('0x2a'),_0x23050a[_0x6fd4('0x7')]),_0x526a7e);}};exports[_0x6fd4('0x2b')]=function(_0x74138d){try{if(!_[_0x6fd4('0x1b')](recordings[_0x74138d['uniqueid']])){utils[_0x6fd4('0x11')](util[_0x6fd4('0x5')]('[%s][recordings][hangup]',_0x74138d[_0x6fd4('0x7')]),_0x74138d);utils[_0x6fd4('0x4')](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x74138d[_0x6fd4('0x7')],_0x74138d[_0x6fd4('0x2c')],_0x74138d[_0x6fd4('0x2d')],_0x74138d[_0x6fd4('0x2e')]));recordings[_0x74138d['uniqueid']][_0x6fd4('0x2c')]=_0x74138d[_0x6fd4('0x2c')];recordings[_0x74138d[_0x6fd4('0x7')]][_0x6fd4('0x2d')]=_0x74138d[_0x6fd4('0x2d')];recordings[_0x74138d['uniqueid']][_0x6fd4('0x2f')]=_0x74138d[_0x6fd4('0x2f')];recordings[_0x74138d[_0x6fd4('0x7')]]['connectedlinename']=_0x74138d[_0x6fd4('0x30')];if(recordings[_0x74138d[_0x6fd4('0x7')]][_0x6fd4('0x31')]=='outbound'&&recordings[_0x74138d[_0x6fd4('0x7')]][_0x6fd4('0xa')]){recordings[_0x74138d[_0x6fd4('0x7')]][_0x6fd4('0x2f')]=recordings[_0x74138d['uniqueid']][_0x6fd4('0xa')];recordings[_0x74138d[_0x6fd4('0x7')]][_0x6fd4('0x30')]='';}recordings[_0x74138d[_0x6fd4('0x7')]][_0x6fd4('0x28')][_0x6fd4('0x32')](function(_0x410c9b){var _0x1c8d5a=_[_0x6fd4('0x33')](recordings[_0x74138d[_0x6fd4('0x7')]]);_0x1c8d5a[_0x6fd4('0x23')]=_0x410c9b['value'];writeDB(_0x1c8d5a);});delete recordings[_0x74138d[_0x6fd4('0x7')]];}}catch(_0x593f7d){utils[_0x6fd4('0x17')](util[_0x6fd4('0x5')](_0x6fd4('0x34'),_0x74138d[_0x6fd4('0x7')]),_0x593f7d);}};exports[_0x6fd4('0x35')]=function(_0x3d303f){try{if(!_[_0x6fd4('0x1b')](recordings[_0x3d303f[_0x6fd4('0x7')]])){utils[_0x6fd4('0x11')](util[_0x6fd4('0x5')](_0x6fd4('0x36'),_0x3d303f[_0x6fd4('0x7')]),_0x3d303f);utils['info'](util[_0x6fd4('0x5')](_0x6fd4('0x37'),_0x3d303f['uniqueid'],_0x3d303f[_0x6fd4('0x38')],_0x3d303f[_0x6fd4('0x39')]));if(_0x3d303f[_0x6fd4('0x38')][_0x6fd4('0x3a')]()==_0x6fd4('0x3b')&&_[_0x6fd4('0x3c')](_0x3d303f[_0x6fd4('0x39')][_0x6fd4('0x3a')](),_0x6fd4('0x3d'))){var _0x5e7710=_0x3d303f['appdata'][_0x6fd4('0x3e')]('=');var _0x548b4e=_0x5e7710[0x0][_0x6fd4('0x3f')](_0x5e7710[0x0][_0x6fd4('0x40')]('(')+0x1,_0x5e7710[0x0]['lastIndexOf'](')'));var _0x1f60f4=_0x5e7710[0x1];recordings[_0x3d303f[_0x6fd4('0x7')]][_0x548b4e]=_0x1f60f4;}}}catch(_0x47659f){utils[_0x6fd4('0x17')](util[_0x6fd4('0x5')](_0x6fd4('0x36'),_0x3d303f[_0x6fd4('0x7')]),_0x47659f);}};exports[_0x6fd4('0x41')]=function(_0x585367){try{if(!_['isNil'](recordings[_0x585367['uniqueid']])){utils[_0x6fd4('0x11')](util[_0x6fd4('0x5')]('[%s][recordings][queuecallerjoin]',_0x585367[_0x6fd4('0x7')]),_0x585367);utils[_0x6fd4('0x4')](util['format'](_0x6fd4('0x42'),_0x585367[_0x6fd4('0x7')],_0x585367['queue']));recordings[_0x585367['uniqueid']]['queue']=_0x585367[_0x6fd4('0x43')];}}catch(_0x264b4e){utils[_0x6fd4('0x17')](util[_0x6fd4('0x5')](_0x6fd4('0x44'),_0x585367['uniqueid']),_0x264b4e);}};exports[_0x6fd4('0x45')]=function(_0xad012a){try{utils[_0x6fd4('0x11')](util[_0x6fd4('0x5')](_0x6fd4('0x46'),_0xad012a['uniqueid']),_0xad012a);utils[_0x6fd4('0x4')](util['format']('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0xad012a[_0x6fd4('0x7')],_0xad012a['transferercalleridnum'],_0xad012a[_0x6fd4('0x47')],_0xad012a[_0x6fd4('0x48')],_0xad012a[_0x6fd4('0x49')]));if(recordings[_0xad012a[_0x6fd4('0x4a')]]&&transfers[_0x6fd4('0x8')][_0xad012a[_0x6fd4('0x4a')]]){transfers[_0x6fd4('0x8')][_0xad012a[_0x6fd4('0x4a')]][_0x6fd4('0x4b')]=!![];}}catch(_0x25e22a){utils[_0x6fd4('0x17')](util[_0x6fd4('0x5')](_0x6fd4('0x46'),_0xad012a[_0x6fd4('0x7')]),_0x25e22a);}}; \ No newline at end of file +var _0x7063=['lodash','util','./utils','info','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','request','newchannel','format','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','error','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','debug','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','.WAV','find','monitors','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','newexten','appdata','application','set','startsWith','cdr','split','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording'];(function(_0x256d6a,_0x2f002f){var _0x460058=function(_0x195be7){while(--_0x195be7){_0x256d6a['push'](_0x256d6a['shift']());}};_0x460058(++_0x2f002f);}(_0x7063,0x154));var _0x3706=function(_0x194f70,_0x2e0f35){_0x194f70=_0x194f70-0x0;var _0x81faa0=_0x7063[_0x194f70];return _0x81faa0;};'use strict';var _=require(_0x3706('0x0'));var util=require(_0x3706('0x1'));var utils=require(_0x3706('0x2'));var transfers=require('./transfers.controller');var recordings={};function writeDB(_0x149a64){var _0x31c968;utils[_0x3706('0x3')](util['format'](_0x3706('0x4'),_0x149a64[_0x3706('0x5')]));if(transfers[_0x3706('0x6')][_0x149a64[_0x3706('0x5')]]){_0x31c968=_0x149a64[_0x3706('0x5')];_0x149a64[_0x3706('0x5')]=transfers[_0x3706('0x6')][_0x149a64[_0x3706('0x5')]][_0x3706('0x7')];}if(_0x149a64[_0x3706('0x8')]){utils[_0x3706('0x9')](_0x149a64[_0x3706('0x8')])['then'](function(_0x4d5b52){if(_0x4d5b52){_0x149a64['membername']=_0x4d5b52['name'];_0x149a64['UserId']=_0x4d5b52['id'];}utils['request']('CreateVoiceRecording',_0x149a64);});}else{utils[_0x3706('0xa')]('CreateVoiceRecording',_0x149a64);}if(_0x31c968)delete transfers[_0x3706('0x6')][_0x31c968];}exports[_0x3706('0xb')]=function(_0x7cfcfb){try{utils['debug'](util[_0x3706('0xc')]('[%s][recordings][newchannel]',_0x7cfcfb[_0x3706('0x5')]),_0x7cfcfb);if(_0x7cfcfb[_0x3706('0x5')]==_0x7cfcfb[_0x3706('0xd')]){utils[_0x3706('0x3')](util['format'](_0x3706('0xe'),_0x7cfcfb[_0x3706('0x5')],_0x7cfcfb['context'],_0x7cfcfb[_0x3706('0xf')]));recordings[_0x7cfcfb[_0x3706('0x5')]]={'uniqueid':_0x7cfcfb[_0x3706('0x5')],'accountcode':_0x7cfcfb[_0x3706('0x8')],'exten':_0x7cfcfb[_0x3706('0xf')],'context':_0x7cfcfb[_0x3706('0x10')],'channel':_0x7cfcfb[_0x3706('0x11')],'monitors':[]};}}catch(_0x17a988){utils[_0x3706('0x12')](util[_0x3706('0xc')](_0x3706('0x13'),_0x7cfcfb[_0x3706('0x5')]),_0x17a988);}};exports[_0x3706('0x14')]=function(_0x50157d){try{utils['debug'](util[_0x3706('0xc')](_0x3706('0x15'),_0x50157d[_0x3706('0x5')]),_0x50157d);if(!_[_0x3706('0x16')](recordings[_0x50157d[_0x3706('0x5')]])&&_0x50157d[_0x3706('0x17')]==0x6){utils[_0x3706('0x3')](util['format']('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x50157d[_0x3706('0x5')],_0x50157d[_0x3706('0x10')],_0x50157d[_0x3706('0x11')]));}else if(!_['isNil'](recordings[_0x50157d['linkedid']])&&_0x50157d[_0x3706('0x17')]==0x6&&_0x50157d[_0x3706('0x10')]!='transfer'){utils['info'](util[_0x3706('0xc')](_0x3706('0x18'),_0x50157d[_0x3706('0x5')],_0x50157d[_0x3706('0xd')],_0x50157d[_0x3706('0x10')],_0x50157d[_0x3706('0x11')]));recordings[_0x50157d[_0x3706('0xd')]][_0x3706('0x8')]=_0x50157d[_0x3706('0x8')];}}catch(_0x5fc10d){utils[_0x3706('0x12')](util[_0x3706('0xc')](_0x3706('0x15'),_0x50157d['uniqueid']),_0x5fc10d);}};exports[_0x3706('0x19')]=function(_0x1ede3a){try{if(!_['isNil'](_0x1ede3a[_0x3706('0x1a')])&&!_[_0x3706('0x16')](_0x1ede3a[_0x3706('0x1a')]['mixmonitor_filename'])){utils[_0x3706('0x1b')](util[_0x3706('0xc')]('[%s][recordings][varset]',_0x1ede3a[_0x3706('0x5')]),_0x1ede3a);utils[_0x3706('0x3')](util[_0x3706('0xc')](_0x3706('0x1c'),_0x1ede3a['uniqueid'],_0x1ede3a[_0x3706('0x1a')],_0x1ede3a[_0x3706('0x1d')]));if(_['endsWith'](_0x1ede3a[_0x3706('0x1d')],_0x3706('0x1e'))){_0x1ede3a[_0x3706('0x1d')]=_0x1ede3a['value'][_0x3706('0x1f')](_0x3706('0x1e'),_0x3706('0x20'));}if(recordings[_0x1ede3a[_0x3706('0xd')]]){var _0x3ebb2b=_[_0x3706('0x21')](recordings[_0x1ede3a['linkedid']][_0x3706('0x22')],{'value':_0x1ede3a[_0x3706('0x1d')]});if(_[_0x3706('0x16')](_0x3ebb2b)){recordings[_0x1ede3a[_0x3706('0xd')]]['monitors'][_0x3706('0x23')]({'value':_0x1ede3a[_0x3706('0x1d')]});}}}}catch(_0x41b14b){utils[_0x3706('0x12')](util[_0x3706('0xc')](_0x3706('0x24'),_0x1ede3a['uniqueid']),_0x41b14b);}};exports[_0x3706('0x25')]=function(_0x269ec6){try{if(!_[_0x3706('0x16')](recordings[_0x269ec6['uniqueid']])){utils[_0x3706('0x1b')](util[_0x3706('0xc')](_0x3706('0x26'),_0x269ec6[_0x3706('0x5')]),_0x269ec6);utils[_0x3706('0x3')](util[_0x3706('0xc')](_0x3706('0x27'),_0x269ec6[_0x3706('0x5')],_0x269ec6[_0x3706('0x28')],_0x269ec6[_0x3706('0x29')],_0x269ec6[_0x3706('0x2a')]));recordings[_0x269ec6[_0x3706('0x5')]][_0x3706('0x28')]=_0x269ec6[_0x3706('0x28')];recordings[_0x269ec6[_0x3706('0x5')]][_0x3706('0x29')]=_0x269ec6['calleridname'];recordings[_0x269ec6[_0x3706('0x5')]][_0x3706('0x2b')]=_0x269ec6[_0x3706('0x2b')];recordings[_0x269ec6[_0x3706('0x5')]][_0x3706('0x2c')]=_0x269ec6[_0x3706('0x2c')];if(recordings[_0x269ec6['uniqueid']][_0x3706('0x2d')]==_0x3706('0x2e')&&recordings[_0x269ec6['uniqueid']][_0x3706('0x8')]){recordings[_0x269ec6[_0x3706('0x5')]]['connectedlinenum']=recordings[_0x269ec6[_0x3706('0x5')]][_0x3706('0x8')];recordings[_0x269ec6[_0x3706('0x5')]]['connectedlinename']='';}recordings[_0x269ec6['uniqueid']][_0x3706('0x22')][_0x3706('0x2f')](function(_0x26ba77){var _0x2b7e17=_['clone'](recordings[_0x269ec6['uniqueid']]);_0x2b7e17[_0x3706('0x1d')]=_0x26ba77[_0x3706('0x1d')];writeDB(_0x2b7e17);});delete recordings[_0x269ec6['uniqueid']];}}catch(_0x4c80fe){utils['error'](util[_0x3706('0xc')]('[%s][recordings][hangup]',_0x269ec6['uniqueid']),_0x4c80fe);}};exports[_0x3706('0x30')]=function(_0x6a6121){try{if(!_[_0x3706('0x16')](recordings[_0x6a6121[_0x3706('0x5')]])){utils[_0x3706('0x1b')](util['format']('[%s][recordings][newexten]',_0x6a6121[_0x3706('0x5')]),_0x6a6121);utils[_0x3706('0x3')](util[_0x3706('0xc')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x6a6121[_0x3706('0x5')],_0x6a6121['application'],_0x6a6121[_0x3706('0x31')]));if(_0x6a6121[_0x3706('0x32')]['toLowerCase']()==_0x3706('0x33')&&_[_0x3706('0x34')](_0x6a6121[_0x3706('0x31')]['toLowerCase'](),_0x3706('0x35'))){var _0x32595a=_0x6a6121[_0x3706('0x31')][_0x3706('0x36')]('=');var _0x1ec140=_0x32595a[0x0]['substring'](_0x32595a[0x0][_0x3706('0x37')]('(')+0x1,_0x32595a[0x0][_0x3706('0x37')](')'));var _0x49bf02=_0x32595a[0x1];recordings[_0x6a6121[_0x3706('0x5')]][_0x1ec140]=_0x49bf02;}}}catch(_0x451c78){utils[_0x3706('0x12')](util[_0x3706('0xc')](_0x3706('0x38'),_0x6a6121[_0x3706('0x5')]),_0x451c78);}};exports[_0x3706('0x39')]=function(_0x4cb6a7){try{if(!_[_0x3706('0x16')](recordings[_0x4cb6a7[_0x3706('0x5')]])){utils['debug'](util[_0x3706('0xc')](_0x3706('0x3a'),_0x4cb6a7[_0x3706('0x5')]),_0x4cb6a7);utils[_0x3706('0x3')](util[_0x3706('0xc')](_0x3706('0x3b'),_0x4cb6a7[_0x3706('0x5')],_0x4cb6a7['queue']));recordings[_0x4cb6a7[_0x3706('0x5')]][_0x3706('0x3c')]=_0x4cb6a7['queue'];}}catch(_0xf79309){utils[_0x3706('0x12')](util[_0x3706('0xc')](_0x3706('0x3a'),_0x4cb6a7[_0x3706('0x5')]),_0xf79309);}};exports[_0x3706('0x3d')]=function(_0x5f45d3){try{utils[_0x3706('0x1b')](util[_0x3706('0xc')](_0x3706('0x3e'),_0x5f45d3[_0x3706('0x5')]),_0x5f45d3);utils['info'](util['format']('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x5f45d3[_0x3706('0x5')],_0x5f45d3['transferercalleridnum'],_0x5f45d3[_0x3706('0x3f')],_0x5f45d3[_0x3706('0x40')],_0x5f45d3[_0x3706('0x41')]));if(recordings[_0x5f45d3['transfereruniqueid']]&&transfers['blinds'][_0x5f45d3[_0x3706('0x42')]]){transfers['blinds'][_0x5f45d3[_0x3706('0x42')]][_0x3706('0x43')]=!![];}}catch(_0x129bc1){utils[_0x3706('0x12')](util['format'](_0x3706('0x3e'),_0x5f45d3[_0x3706('0x5')]),_0x129bc1);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 105f55c..a51f0b2 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 _0xbb81=['transfertargetexten','transfertargetlinkedid','error','lodash','./utils','info','format','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','type','transfereruniqueid','[%s][transfers][blindtransfer]','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','attended','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext'];(function(_0x506c35,_0x3bb47a){var _0x43d6ca=function(_0x1cfcd1){while(--_0x1cfcd1){_0x506c35['push'](_0x506c35['shift']());}};_0x43d6ca(++_0x3bb47a);}(_0xbb81,0x163));var _0x1bb8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbb81[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1bb8('0x0'));var util=require('util');var utils=require(_0x1bb8('0x1'));function writeDB(_0x557a24){utils[_0x1bb8('0x2')](util[_0x1bb8('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x557a24['type']==='attended'?_0x557a24[_0x1bb8('0x4')]:_0x557a24[_0x1bb8('0x5')],_0x557a24['type']));utils['request'](_0x1bb8('0x6'),_0x557a24);}exports[_0x1bb8('0x7')]={};exports[_0x1bb8('0x8')]=function(_0x591098){try{utils[_0x1bb8('0x9')](util['format']('[%s][transfers][blindtransfer]',_0x591098[_0x1bb8('0x5')]),_0x591098);utils[_0x1bb8('0x2')](util[_0x1bb8('0x3')](_0x1bb8('0xa'),_0x591098[_0x1bb8('0x5')],_0x591098[_0x1bb8('0xb')],_0x591098[_0x1bb8('0xc')],_0x591098[_0x1bb8('0xd')],_0x591098[_0x1bb8('0xe')]));_0x591098[_0x1bb8('0xf')]='blind';exports[_0x1bb8('0x7')][_0x591098[_0x1bb8('0x10')]]=_0x591098;writeDB(_0x591098);}catch(_0x13b48e){utils['error'](util['format'](_0x1bb8('0x11'),_0x591098[_0x1bb8('0x5')]),_0x13b48e);}};exports['attendedtransfer']=function(_0x3eeefd){try{utils[_0x1bb8('0x9')](util[_0x1bb8('0x3')](_0x1bb8('0x12'),_0x3eeefd[_0x1bb8('0x4')]),_0x3eeefd);utils[_0x1bb8('0x2')](util[_0x1bb8('0x3')](_0x1bb8('0x13'),_0x3eeefd[_0x1bb8('0x4')],_0x3eeefd[_0x1bb8('0x14')],_0x3eeefd[_0x1bb8('0x15')],_0x3eeefd[_0x1bb8('0x16')],_0x3eeefd['transfertargetcalleridname']));_0x3eeefd=_[_0x1bb8('0x17')](_0x3eeefd,{'transfererchannel':_0x3eeefd[_0x1bb8('0x18')],'transferercalleridnum':_0x3eeefd[_0x1bb8('0x14')],'transferercalleridname':_0x3eeefd[_0x1bb8('0x15')],'transfererconnectedlinenum':_0x3eeefd[_0x1bb8('0x19')],'transfererconnectedlinename':_0x3eeefd[_0x1bb8('0x1a')],'transfereraccountcode':_0x3eeefd[_0x1bb8('0x1b')],'transferercontext':_0x3eeefd[_0x1bb8('0x1c')],'transfererexten':_0x3eeefd[_0x1bb8('0x1d')],'transfererlinkedid':_0x3eeefd[_0x1bb8('0x1e')],'context':_0x3eeefd[_0x1bb8('0x1f')],'extension':_0x3eeefd['origtransfererexten'],'type':_0x1bb8('0x20')});if(_[_0x1bb8('0x21')](_0x3eeefd[_0x1bb8('0x22')])){_0x3eeefd=_[_0x1bb8('0x17')](_0x3eeefd,{'transfereechannel':_0x3eeefd[_0x1bb8('0x23')],'transfereecalleridnum':_0x3eeefd[_0x1bb8('0x16')],'transfereecalleridname':_0x3eeefd[_0x1bb8('0x24')],'transfereeconnectedlinenum':_0x3eeefd[_0x1bb8('0x25')],'transfereeconnectedlinename':_0x3eeefd[_0x1bb8('0x26')],'transfereeaccountcode':_0x3eeefd[_0x1bb8('0x27')],'transfereecontext':_0x3eeefd[_0x1bb8('0x28')],'transfereeexten':_0x3eeefd[_0x1bb8('0x29')],'transfereelinkedid':_0x3eeefd[_0x1bb8('0x2a')]});}writeDB(_0x3eeefd);}catch(_0x2b6c84){utils[_0x1bb8('0x2b')](util['format'](_0x1bb8('0x12'),_0x3eeefd[_0x1bb8('0x4')]),_0x2b6c84);}}; \ No newline at end of file +var _0x6f56=['CreateVoiceTransferReport','blinds','blindtransfer','[%s][transfers][blindtransfer]','uniqueid','format','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','blind','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransferercontext','origtransferercontext','origtransfererexten','isNil','transfereechannel','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','type','attended','request'];(function(_0x52a68c,_0x8aaf05){var _0x2df538=function(_0x20a71b){while(--_0x20a71b){_0x52a68c['push'](_0x52a68c['shift']());}};_0x2df538(++_0x8aaf05);}(_0x6f56,0xef));var _0x66f5=function(_0x4ffd8b,_0x88dfc){_0x4ffd8b=_0x4ffd8b-0x0;var _0x548b66=_0x6f56[_0x4ffd8b];return _0x548b66;};'use strict';var _=require(_0x66f5('0x0'));var util=require(_0x66f5('0x1'));var utils=require(_0x66f5('0x2'));function writeDB(_0x5e0c8b){utils[_0x66f5('0x3')](util['format']('[%s][transfers][writeDB]\x20type:%s',_0x5e0c8b[_0x66f5('0x4')]===_0x66f5('0x5')?_0x5e0c8b['origtransfereruniqueid']:_0x5e0c8b['uniqueid'],_0x5e0c8b[_0x66f5('0x4')]));utils[_0x66f5('0x6')](_0x66f5('0x7'),_0x5e0c8b);}exports[_0x66f5('0x8')]={};exports[_0x66f5('0x9')]=function(_0x49e190){try{utils['debug'](util['format'](_0x66f5('0xa'),_0x49e190[_0x66f5('0xb')]),_0x49e190);utils['info'](util[_0x66f5('0xc')](_0x66f5('0xd'),_0x49e190[_0x66f5('0xb')],_0x49e190[_0x66f5('0xe')],_0x49e190['transferercalleridname'],_0x49e190[_0x66f5('0xf')],_0x49e190['transfereecalleridname']));_0x49e190[_0x66f5('0x4')]=_0x66f5('0x10');exports[_0x66f5('0x8')][_0x49e190[_0x66f5('0x11')]]=_0x49e190;writeDB(_0x49e190);}catch(_0xc98437){utils[_0x66f5('0x12')](util[_0x66f5('0xc')](_0x66f5('0xa'),_0x49e190[_0x66f5('0xb')]),_0xc98437);}};exports[_0x66f5('0x13')]=function(_0x44f7de){try{utils['debug'](util[_0x66f5('0xc')](_0x66f5('0x14'),_0x44f7de[_0x66f5('0x15')]),_0x44f7de);utils['info'](util['format'](_0x66f5('0x16'),_0x44f7de[_0x66f5('0x15')],_0x44f7de['origtransferercalleridnum'],_0x44f7de[_0x66f5('0x17')],_0x44f7de[_0x66f5('0x18')],_0x44f7de[_0x66f5('0x19')]));_0x44f7de=_['assign'](_0x44f7de,{'transfererchannel':_0x44f7de[_0x66f5('0x1a')],'transferercalleridnum':_0x44f7de[_0x66f5('0x1b')],'transferercalleridname':_0x44f7de[_0x66f5('0x17')],'transfererconnectedlinenum':_0x44f7de[_0x66f5('0x1c')],'transfererconnectedlinename':_0x44f7de['secondtransfererconnectedlinename'],'transfereraccountcode':_0x44f7de['origtransfereraccountcode'],'transferercontext':_0x44f7de[_0x66f5('0x1d')],'transfererexten':_0x44f7de['secondtransfererexten'],'transfererlinkedid':_0x44f7de['origtransfererlinkedid'],'context':_0x44f7de[_0x66f5('0x1e')],'extension':_0x44f7de[_0x66f5('0x1f')],'type':_0x66f5('0x5')});if(_[_0x66f5('0x20')](_0x44f7de[_0x66f5('0x21')])){_0x44f7de=_[_0x66f5('0x22')](_0x44f7de,{'transfereechannel':_0x44f7de[_0x66f5('0x23')],'transfereecalleridnum':_0x44f7de['transfertargetcalleridnum'],'transfereecalleridname':_0x44f7de[_0x66f5('0x19')],'transfereeconnectedlinenum':_0x44f7de[_0x66f5('0x24')],'transfereeconnectedlinename':_0x44f7de['transfertargetconnectedlinename'],'transfereeaccountcode':_0x44f7de[_0x66f5('0x25')],'transfereecontext':_0x44f7de[_0x66f5('0x26')],'transfereeexten':_0x44f7de[_0x66f5('0x27')],'transfereelinkedid':_0x44f7de[_0x66f5('0x28')]});}writeDB(_0x44f7de);}catch(_0x1264ae){utils[_0x66f5('0x12')](util[_0x66f5('0xc')]('[%s][transfers][attendedtransfer]',_0x44f7de['origtransfereruniqueid']),_0x1264ae);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 5944a65..0466f4f 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 _0x9ff0=['[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','error','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','GetVoiceQueue','name','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','diffTime','diff','isAfter','isBefore','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','request','then','[utils][request]\x20name:%s','catch','internal','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal'];(function(_0xe39f34,_0xabdbf5){var _0x538cbc=function(_0x28c328){while(--_0x28c328){_0xe39f34['push'](_0xe39f34['shift']());}};_0x538cbc(++_0xabdbf5);}(_0x9ff0,0x1c1));var _0x09ff=function(_0x12003b,_0x510441){_0x12003b=_0x12003b-0x0;var _0x4a9126=_0x9ff0[_0x12003b];return _0x4a9126;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x09ff('0x0'));var moment=require(_0x09ff('0x1'));var util=require(_0x09ff('0x2'));var client=jayson[_0x09ff('0x3')][_0x09ff('0x4')]({'port':0x2329});var logger=require(_0x09ff('0x5'))(_0x09ff('0x6'));exports[_0x09ff('0x7')]=function(_0x34fc78,_0x197d74){logger[_0x09ff('0x7')](_0x34fc78,_0x197d74?util[_0x09ff('0x8')](_0x197d74,{'showHidden':![],'depth':null}):'');};exports[_0x09ff('0x9')]=function(_0x1a01c4,_0xbda2f0){logger['debug'](_0x1a01c4,_0xbda2f0?util[_0x09ff('0x8')](_0xbda2f0,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x59f81d,_0x34fae0){logger['error'](_0x59f81d,_0x34fae0?util[_0x09ff('0x8')](_0x34fae0,{'showHidden':![],'depth':null}):'');};exports[_0x09ff('0xa')]=function(_0x3e9de6,_0x3711ff){return client['request'](_0x3e9de6,{'body':_0x3711ff})[_0x09ff('0xb')](function(_0x5f1863){logger[_0x09ff('0x9')](_0x09ff('0xc'),_0x3e9de6,_0x5f1863?util[_0x09ff('0x8')](_0x5f1863,{'showHidden':![],'depth':null}):'');})[_0x09ff('0xd')](function(_0xe46cd9){logger['error']('[utils][request]\x20name:%s',_0x3e9de6,_0xe46cd9?util[_0x09ff('0x8')](_0xe46cd9,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4b5438){return client[_0x09ff('0xa')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x09ff('0xe'),'name',_0x09ff('0xf')],'where':_0x4b5438,'limit':0x1}})['then'](function(_0x3ea016){logger[_0x09ff('0x9')](_0x09ff('0x10'),JSON[_0x09ff('0x11')](_0x4b5438),_0x3ea016?util[_0x09ff('0x8')](_0x3ea016,{'showHidden':![],'depth':null}):'');return _0x3ea016[_0x09ff('0x12')][_0x09ff('0x13')]?_0x3ea016[_0x09ff('0x12')][0x0]:null;});}exports[_0x09ff('0x14')]=function(_0x30ccb8){return new BPromise(function(_0x3e63c3,_0x526816){if(_0x30ccb8){return getUser({'internal':_0x30ccb8})[_0x09ff('0xb')](function(_0x47475f){logger[_0x09ff('0x7')](_0x09ff('0x15'),_0x30ccb8,_0x47475f?_0x09ff('0x16'):_0x09ff('0x17'));return _0x3e63c3(_0x47475f);})[_0x09ff('0xd')](function(_0x3c72f2){logger[_0x09ff('0x18')](_0x09ff('0x19'),_0x3c72f2?util[_0x09ff('0x8')](_0x3c72f2,{'showHidden':![],'depth':null}):'');return _0x3e63c3(null);});}return _0x3e63c3(null);});};exports['getUserByInterface']=function(_0x53a227){return new BPromise(function(_0x1dbbf6,_0x755952){if(_0x53a227){return getUser({'interface':_0x53a227})[_0x09ff('0xb')](function(_0x5beba5){logger[_0x09ff('0x7')](_0x09ff('0x1a'),_0x53a227,_0x5beba5?_0x09ff('0x16'):_0x09ff('0x17'));return _0x1dbbf6(_0x5beba5);})[_0x09ff('0xd')](function(_0x9b5064){logger[_0x09ff('0x18')](_0x09ff('0x1b'),_0x9b5064?util['inspect'](_0x9b5064,{'showHidden':![],'depth':null}):'');return _0x1dbbf6(null);});}return _0x1dbbf6(null);});};exports[_0x09ff('0x1c')]=function(_0x58a25a){return new BPromise(function(_0x2a5de6,_0x3d9531){if(_0x58a25a){return getUser({'name':_0x58a25a})['then'](function(_0x311020){logger[_0x09ff('0x7')](_0x09ff('0x1d'),_0x58a25a,_0x311020?_0x09ff('0x16'):'notfound');return _0x2a5de6(_0x311020);})['catch'](function(_0x47f38a){logger[_0x09ff('0x18')](_0x09ff('0x1e'),_0x47f38a?util[_0x09ff('0x8')](_0x47f38a,{'showHidden':![],'depth':null}):'');return _0x2a5de6(null);});}return _0x2a5de6(null);});};exports['getVoiceQueueByName']=function(_0x196966){return new BPromise(function(_0xe78c5f,_0x39b8f2){if(_0x196966){return client[_0x09ff('0xa')](_0x09ff('0x1f'),{'options':{'raw':!![],'attributes':['id',_0x09ff('0x20'),_0x09ff('0x21'),_0x09ff('0x22'),_0x09ff('0x23')],'where':{'name':_0x196966},'limit':0x1}})[_0x09ff('0xb')](function(_0x49d2ed){logger[_0x09ff('0x9')](_0x09ff('0x24'),_0x196966,_0x49d2ed?util[_0x09ff('0x8')](_0x49d2ed,{'showHidden':![],'depth':null}):'');logger[_0x09ff('0x7')](_0x09ff('0x25'),_0x196966,_0x49d2ed?'found':_0x09ff('0x17'));return _0xe78c5f(_0x49d2ed['result'][_0x09ff('0x13')]?_0x49d2ed['result'][0x0]:null);})[_0x09ff('0xd')](function(_0x2c4066){logger[_0x09ff('0x18')](_0x09ff('0x26'),_0x2c4066?util[_0x09ff('0x8')](_0x2c4066,{'showHidden':![],'depth':null}):'');return _0xe78c5f(null);});}return _0xe78c5f(null);});};exports['addTime']=function(_0x5f083b,_0x208785){return moment(_0x5f083b)['add'](_0x208785,_0x09ff('0x27'))[_0x09ff('0x28')](_0x09ff('0x29'));};exports[_0x09ff('0x2a')]=function(_0xc8e245,_0x17ca52){return moment(_0xc8e245)['subtract'](_0x17ca52,_0x09ff('0x27'))[_0x09ff('0x28')](_0x09ff('0x29'));};exports[_0x09ff('0x2b')]=function(_0x4b8c4b,_0x1e4152){return moment(_0x4b8c4b)[_0x09ff('0x2c')](moment(_0x1e4152),_0x09ff('0x27'));};exports['sumTime']=function(_0x4b854c,_0x344f1c){return parseInt(_0x4b854c,0xa)+parseInt(_0x344f1c,0xa);};exports['now']=function(){return moment()[_0x09ff('0x28')](_0x09ff('0x29'));};exports[_0x09ff('0x2d')]=function(_0x281d6e,_0x102c6e){if(_0x102c6e){return moment(_0x281d6e)['isAfter'](_0x102c6e);}return!![];};exports[_0x09ff('0x2e')]=function(_0x93c295,_0x507899){if(_0x507899){return moment(_0x93c295)['isBefore'](_0x507899);}else if(_0x93c295){return!![];}return![];}; \ No newline at end of file +var _0x3f6b=['debug','inspect','error','request','then','[utils][request]\x20name:%s','GetUser','internal','name','stringify','result','length','found','catch','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','notfound','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtract','format','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','info'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x3f6b,0x10b));var _0xb3f6=function(_0x584dbc,_0x4b102c){_0x584dbc=_0x584dbc-0x0;var _0x554b9a=_0x3f6b[_0x584dbc];return _0x554b9a;};'use strict';var BPromise=require(_0xb3f6('0x0'));var jayson=require(_0xb3f6('0x1'));var moment=require(_0xb3f6('0x2'));var util=require(_0xb3f6('0x3'));var client=jayson[_0xb3f6('0x4')][_0xb3f6('0x5')]({'port':0x2329});var logger=require(_0xb3f6('0x6'))(_0xb3f6('0x7'));exports[_0xb3f6('0x8')]=function(_0x3a29d0,_0x347c1b){logger[_0xb3f6('0x8')](_0x3a29d0,_0x347c1b?util['inspect'](_0x347c1b,{'showHidden':![],'depth':null}):'');};exports[_0xb3f6('0x9')]=function(_0x5b869b,_0x59d3a8){logger['debug'](_0x5b869b,_0x59d3a8?util[_0xb3f6('0xa')](_0x59d3a8,{'showHidden':![],'depth':null}):'');};exports[_0xb3f6('0xb')]=function(_0x18fb6f,_0xdbb21b){logger[_0xb3f6('0xb')](_0x18fb6f,_0xdbb21b?util[_0xb3f6('0xa')](_0xdbb21b,{'showHidden':![],'depth':null}):'');};exports[_0xb3f6('0xc')]=function(_0x216527,_0xe599a7){return client['request'](_0x216527,{'body':_0xe599a7})[_0xb3f6('0xd')](function(_0x4e7519){logger[_0xb3f6('0x9')](_0xb3f6('0xe'),_0x216527,_0x4e7519?util[_0xb3f6('0xa')](_0x4e7519,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x2d6518){logger[_0xb3f6('0xb')](_0xb3f6('0xe'),_0x216527,_0x2d6518?util[_0xb3f6('0xa')](_0x2d6518,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4caf1f){return client[_0xb3f6('0xc')](_0xb3f6('0xf'),{'options':{'raw':!![],'attributes':['id',_0xb3f6('0x10'),_0xb3f6('0x11'),'interface'],'where':_0x4caf1f,'limit':0x1}})['then'](function(_0x1d7205){logger[_0xb3f6('0x9')]('[utils][getUser]\x20where:%s',JSON[_0xb3f6('0x12')](_0x4caf1f),_0x1d7205?util['inspect'](_0x1d7205,{'showHidden':![],'depth':null}):'');return _0x1d7205[_0xb3f6('0x13')][_0xb3f6('0x14')]?_0x1d7205[_0xb3f6('0x13')][0x0]:null;});}exports['getUserByInternal']=function(_0x35e997){return new BPromise(function(_0x3a94d3,_0xc55628){if(_0x35e997){return getUser({'internal':_0x35e997})['then'](function(_0x10db0e){logger[_0xb3f6('0x8')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x35e997,_0x10db0e?_0xb3f6('0x15'):'notfound');return _0x3a94d3(_0x10db0e);})[_0xb3f6('0x16')](function(_0x5e26c9){logger[_0xb3f6('0xb')](_0xb3f6('0x17'),_0x5e26c9?util[_0xb3f6('0xa')](_0x5e26c9,{'showHidden':![],'depth':null}):'');return _0x3a94d3(null);});}return _0x3a94d3(null);});};exports['getUserByInterface']=function(_0xb1f3f8){return new BPromise(function(_0x52d444,_0x2a1300){if(_0xb1f3f8){return getUser({'interface':_0xb1f3f8})['then'](function(_0x353ca8){logger['info'](_0xb3f6('0x18'),_0xb1f3f8,_0x353ca8?_0xb3f6('0x15'):'notfound');return _0x52d444(_0x353ca8);})['catch'](function(_0x44eb3d){logger[_0xb3f6('0xb')](_0xb3f6('0x19'),_0x44eb3d?util['inspect'](_0x44eb3d,{'showHidden':![],'depth':null}):'');return _0x52d444(null);});}return _0x52d444(null);});};exports[_0xb3f6('0x1a')]=function(_0x8fa4ca){return new BPromise(function(_0x465f1a,_0x2c924e){if(_0x8fa4ca){return getUser({'name':_0x8fa4ca})[_0xb3f6('0xd')](function(_0x2f3163){logger[_0xb3f6('0x8')](_0xb3f6('0x1b'),_0x8fa4ca,_0x2f3163?_0xb3f6('0x15'):_0xb3f6('0x1c'));return _0x465f1a(_0x2f3163);})[_0xb3f6('0x16')](function(_0x553fb9){logger['error'](_0xb3f6('0x1d'),_0x553fb9?util[_0xb3f6('0xa')](_0x553fb9,{'showHidden':![],'depth':null}):'');return _0x465f1a(null);});}return _0x465f1a(null);});};exports[_0xb3f6('0x1e')]=function(_0xa0e8e1){return new BPromise(function(_0x1016a5,_0x5b908d){if(_0xa0e8e1){return client[_0xb3f6('0xc')](_0xb3f6('0x1f'),{'options':{'raw':!![],'attributes':['id',_0xb3f6('0x11'),_0xb3f6('0x20'),'acw',_0xb3f6('0x21')],'where':{'name':_0xa0e8e1},'limit':0x1}})[_0xb3f6('0xd')](function(_0x257ed8){logger['debug']('[utils][getVoiceQueueByName]\x20name:%s',_0xa0e8e1,_0x257ed8?util[_0xb3f6('0xa')](_0x257ed8,{'showHidden':![],'depth':null}):'');logger[_0xb3f6('0x8')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0xa0e8e1,_0x257ed8?_0xb3f6('0x15'):_0xb3f6('0x1c'));return _0x1016a5(_0x257ed8[_0xb3f6('0x13')][_0xb3f6('0x14')]?_0x257ed8[_0xb3f6('0x13')][0x0]:null);})[_0xb3f6('0x16')](function(_0x38d834){logger[_0xb3f6('0xb')]('[utils][getVoiceQueueByName]',_0x38d834?util[_0xb3f6('0xa')](_0x38d834,{'showHidden':![],'depth':null}):'');return _0x1016a5(null);});}return _0x1016a5(null);});};exports[_0xb3f6('0x22')]=function(_0x56d7b7,_0x1bc94a){return moment(_0x56d7b7)[_0xb3f6('0x23')](_0x1bc94a,_0xb3f6('0x24'))['format'](_0xb3f6('0x25'));};exports['subtractTime']=function(_0x2a4a73,_0x4a9bb3){return moment(_0x2a4a73)[_0xb3f6('0x26')](_0x4a9bb3,_0xb3f6('0x24'))[_0xb3f6('0x27')](_0xb3f6('0x25'));};exports[_0xb3f6('0x28')]=function(_0x12faf4,_0x2755ec){return moment(_0x12faf4)[_0xb3f6('0x29')](moment(_0x2755ec),_0xb3f6('0x24'));};exports[_0xb3f6('0x2a')]=function(_0x35e6ad,_0x2e7062){return parseInt(_0x35e6ad,0xa)+parseInt(_0x2e7062,0xa);};exports[_0xb3f6('0x2b')]=function(){return moment()[_0xb3f6('0x27')](_0xb3f6('0x25'));};exports[_0xb3f6('0x2c')]=function(_0xbdd8c6,_0xa4a0f1){if(_0xa4a0f1){return moment(_0xbdd8c6)['isAfter'](_0xa4a0f1);}return!![];};exports[_0xb3f6('0x2d')]=function(_0x520bcb,_0x507ac5){if(_0x507ac5){return moment(_0x520bcb)['isBefore'](_0x507ac5);}else if(_0x520bcb){return!![];}return![];}; \ No newline at end of file